Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/app/locale/en/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,8 @@ export default {
'Camera access is denied. Cannot perform action.',
[LicencePermissionError.id.replaceAll('.', '_')]:
'You can not work in Workspace because your license has expired.',
store_sql_user_get_default_device_app_error:
"Device is missing. You can't work with calls.",
},
endpoint: {
noLicense:
Expand Down
2 changes: 2 additions & 0 deletions src/app/locale/es/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,8 @@ export default {
'El acceso a la cámara está denegado. No se puede realizar la acción.',
[LicencePermissionError.id.replaceAll('.', '_')]:
'No puede trabajar en el Espacio de trabajo porque su licencia ha expirado.',
store_sql_user_get_default_device_app_error:
'No tiene ningún dispositivo. No puede trabajar con llamadas.',
},
endpoint: {
noLicense:
Expand Down
2 changes: 2 additions & 0 deletions src/app/locale/kz/kz.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,8 @@ export default {
'Камераны қосу мүмкін емес. Әрекетті орындау мүмкін емес.',
[LicencePermissionError.id.replaceAll('.', '_')]:
'Workspace жұмыс істеу мүмкін емес. Лицензияның мерзімі аяқталды.',
store_sql_user_get_default_device_app_error:
'Сізде құрылғы жоқ. Қоңыраулармен жұмыс істей алмайсыз.',
},
endpoint: {
noLicense:
Expand Down
2 changes: 2 additions & 0 deletions src/app/locale/pl/pl.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@ export default {
'Odmowa dostępu do kamery. Nie można wykonać akcji.',
[LicencePermissionError.id.replaceAll('.', '_')]:
'Nie możesz pracować w Workspace, ponieważ Twoja licencja wygasła.',
store_sql_user_get_default_device_app_error:
'Nie masz urządzenia. Nie możesz pracować z połączeniami.',
},
endpoint: {
noLicense:
Expand Down
2 changes: 2 additions & 0 deletions src/app/locale/ro/ro.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@ export default {
'Accesul la cameră este refuzat. Nu se poate efectua acțiunea.',
[LicencePermissionError.id.replaceAll('.', '_')]:
'Nu puteți lucra în Spațiul de lucru deoarece licența dvs. a expirat.',
store_sql_user_get_default_device_app_error:
'Nu aveți niciun dispozitiv. Nu puteți lucra cu apeluri.',
},
endpoint: {
noLicense:
Expand Down
2 changes: 2 additions & 0 deletions src/app/locale/ru/ru.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,8 @@ export default {
'Нет доступа к камере. Невозможно выполнить действие.',
[LicencePermissionError.id.replaceAll('.', '_')]:
'Невозможно работать в Workspace. Истёк срок действия лицензии.',
store_sql_user_get_default_device_app_error:
'У вас нет устройства. Вы не можете работать со звонками.',
},
endpoint: {
noLicense:
Expand Down
2 changes: 2 additions & 0 deletions src/app/locale/uk/uk.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,8 @@ export default {
'Немає доступу до камери. Неможливо виконати дію.',
[LicencePermissionError.id.replaceAll('.', '_')]:
'Неможливо працювати у Workspace. Закінчився термін ліцензії.',
store_sql_user_get_default_device_app_error:
'У вас немає пристрою. Ви не можете працювати з дзвінками.',
},
endpoint: {
noLicense: 'Неможливо працювати у Workspace. Закінчився термін ліцензії.',
Expand Down
2 changes: 2 additions & 0 deletions src/app/locale/uz/uz.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,8 @@ export default {
'Kameraga ruxsat yoʻq. Amalni bajarib boʻlmaydi.',
[LicencePermissionError.id.replaceAll('.', '_')]:
'Workspace ishlamaydi. Litsenziya muddati tugagan.',
store_sql_user_get_default_device_app_error:
'Sizda qurilma yoʻq. Qoʻngʻiroqlar bilan ishlay olmaysiz.',
},
endpoint: {
noLicense: 'Workspace ishlamaydi. Litsenziya muddati tugagan.',
Expand Down
2 changes: 2 additions & 0 deletions src/app/locale/vi/vi.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,8 @@ export default {
'Từ chối truy cập camera. Không thể thực hiện hành động.',
[LicencePermissionError.id.replaceAll('.', '_')]:
'Bạn không thể làm việc trong Workspace vì giấy phép đã hết hạn.',
store_sql_user_get_default_device_app_error:
'Bạn không có thiết bị. Bạn không thể làm việc với cuộc gọi.',
},
endpoint: {
noLicense:
Expand Down
16 changes: 15 additions & 1 deletion src/features/modules/agent-status/agent-status.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const state = {
user: {
status: {},
},
isAgentRemoved: false,
};

const getters = {
Expand All @@ -19,6 +20,7 @@ const getters = {
getters.IS_AGENT && state.agent.status !== AgentStatus.Offline,
IS_AGENT_ONLINE: (state, getters) =>
getters.IS_AGENT && state.agent.status === AgentStatus.Online,
AGENT_REMOVED: (state) => state.isAgentRemoved,
};

const actions = {
Expand All @@ -34,7 +36,15 @@ const actions = {
const { channels, onDemand, onlineSkill } = {
onlineSkill: activityType,
};
agent.online(channels, onDemand, onlineSkill);
try {
await agent.online(channels, onDemand, onlineSkill);
} catch (error) {
if (error?.id === 'app.agent.login.app_err') {
context.commit('SET_AGENT_REMOVED', true);
} else {
throw error;
}
}
},

SET_AGENT_PAUSE_STATUS: async (context, note = '') => {
Expand Down Expand Up @@ -73,6 +83,10 @@ const mutations = {
SET_USER_INSTANCE: (state, user) => {
state.user = user;
},

SET_AGENT_REMOVED: (state, value) => {
state.isAgentRemoved = value;
},
};

export default {
Expand Down
18 changes: 18 additions & 0 deletions src/features/modules/global-handlers/store/global-handlers.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { eventBus } from '@webitel/ui-sdk/scripts';
import { watch } from 'vue';
import i18n from '../../../../app/locale/i18n';
import { WebSocketConnectionState } from '../../../../ui/enums/WebSocketConnectionState.enum.ts';

const state = {
Expand All @@ -14,6 +16,7 @@ const actions = {
context.dispatch('SUBSCRIBE_TO_PHONE_REGISTRATION');
context.dispatch('SUBSCRIBE_TO_CLIENT_DISCONNECT');
context.dispatch('SUBSCRIBE_TO_CLIENT_CLOSED');
context.dispatch('SUBSCRIBE_TO_PHONE_UNREGISTERED_NOTIFICATION');
},
RESET_GLOBAL_HANDLERS: (context) => {
context.dispatch('CLOSE_DISCONNECT_POPUP');
Expand Down Expand Up @@ -106,6 +109,21 @@ const actions = {
root: true,
});
},
SUBSCRIBE_TO_PHONE_UNREGISTERED_NOTIFICATION: (context) => {
watch(
() => context.state.isPhoneReg,
(value, prev) => {
if (prev === true && value === false) {
eventBus.$emit('notification', {
type: 'error',
text: i18n.global.t(
'error.websocket.store_sql_user_get_default_device_app_error',
),
});
}
},
);
},
};

const mutations = {
Expand Down
76 changes: 39 additions & 37 deletions src/ui/modules/app-header/components/agent-status-select.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,46 +6,48 @@
:agent-id="agent.agentId"
:status="agent.status"
:status-duration="statusDuration"
@changed-call-center-mode="$emit('changed-call-center-mode', $event)"
:disabled="isControlsDisabled"
@changed-call-center-mode="emit('changed-call-center-mode', $event)"
></wt-cc-agent-status-select>
</template>

<script>
<script setup lang="ts">
import WtCcAgentStatusSelect from '@webitel/ui-sdk/src/modules/AgentStatusSelect/components/wt-cc-agent-status-select.vue';
import convertDuration from '@webitel/ui-sdk/src/scripts/convertDuration';
import { mapGetters, mapState } from 'vuex';

export default {
name: 'AgentStatusSelect',
emits: [
'changed-call-center-mode',
],
components: {
WtCcAgentStatusSelect,
},

computed: {
...mapState('ui/now', {
now: (state) => state.now,
}),

...mapState('features/status', {
agent: (state) => state.agent,
}),

...mapGetters('features/status', {
isCcenterOn: 'IS_CCENTER_ON',
}),

statusDuration() {
let time = this.now - (this.agent.lastStatusChange || Date.now());
time = time < 0 ? 0 : time;
return convertDuration(time / 1000);
},
},
};
import type { LookupOption } from '@webitel/ui-sdk/src/types';
import { computed } from 'vue';
import { useStore } from 'vuex';

import { useWebSocketClient } from '../../../../app/api/agent-workspace/websocket/useWebSocketClient';
import { WebSocketConnectionState } from '../../../../ui/enums/WebSocketConnectionState.enum';

const emit = defineEmits<{
'changed-call-center-mode': [
payload?: LookupOption,
];
}>();

const store = useStore();
const { state: websocketState } = useWebSocketClient();

const now = computed(() => store.state.ui.now.now);
const agent = computed(() => store.state.features.status.agent);
const isCcenterOn = computed(
() => store.getters['features/status/IS_CCENTER_ON'],
);
const agentRemoved = computed(
() => store.getters['features/status/AGENT_REMOVED'],
);

const statusDuration = computed<string>(() => {
let time = now.value - (agent.value.lastStatusChange || Date.now());
time = time < 0 ? 0 : time;
return convertDuration(time / 1000);
});

const isControlsDisabled = computed<boolean>(
() =>
agentRemoved.value ||
websocketState.value !== WebSocketConnectionState.Connected,
);
</script>

<style lang="scss" scoped>

</style>
Loading