@webitel/ui-sdk 26.8.35 → 26.8.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/locale/en/en.js +4 -0
- package/src/locale/es/es.js +4 -0
- package/src/locale/kz/kz.js +4 -0
- package/src/locale/pl/pl.js +4 -0
- package/src/locale/ro/ro.js +4 -0
- package/src/locale/ru/ru.js +4 -0
- package/src/locale/uk/uk.js +4 -0
- package/src/locale/uz/uz.js +4 -0
- package/src/locale/vi/vi.js +4 -0
- package/src/modules/AgentStatusSelect/api/agent-status.js +2 -0
- package/src/modules/AgentStatusSelect/components/_internals/wt-cc-activity-type-popup.vue +104 -0
- package/src/modules/AgentStatusSelect/components/wt-cc-agent-status-select.vue +148 -37
- package/src/modules/AgentStatusSelect/composables/useCCenterModeSwitcher.ts +43 -0
- package/src/modules/AgentStatusSelect/types/StatusChangePayload.types.ts +9 -0
- package/src/modules/AgentStatusSelect/types/UseCCenterModeSwitcherParams.types.ts +9 -0
- package/src/types/LookupOption.types.ts +4 -0
- package/src/types/index.ts +1 -0
- package/types/.tsbuildinfo +1 -1
- package/types/locale/en/en.d.ts +4 -0
- package/types/locale/es/es.d.ts +7 -2
- package/types/locale/i18n.d.ts +36 -0
- package/types/locale/index.d.ts +36 -0
- package/types/locale/kz/kz.d.ts +7 -2
- package/types/locale/pl/pl.d.ts +7 -2
- package/types/locale/ro/ro.d.ts +7 -2
- package/types/locale/ru/ru.d.ts +7 -2
- package/types/locale/uk/uk.d.ts +7 -2
- package/types/locale/uz/uz.d.ts +7 -2
- package/types/locale/vi/vi.d.ts +7 -2
- package/types/modules/AgentStatusSelect/api/agent-status.d.ts +2 -1
- package/types/modules/AgentStatusSelect/components/_internals/wt-cc-activity-type-popup.vue.d.ts +15 -0
- package/types/modules/AgentStatusSelect/components/wt-cc-agent-status-select.vue.d.ts +21 -32
- package/types/modules/AgentStatusSelect/composables/useCCenterModeSwitcher.d.ts +5 -0
- package/types/modules/AgentStatusSelect/types/StatusChangePayload.types.d.ts +8 -0
- package/types/modules/AgentStatusSelect/types/UseCCenterModeSwitcherParams.types.d.ts +8 -0
- package/types/types/LookupOption.types.d.ts +4 -0
- package/types/types/index.d.ts +1 -0
package/package.json
CHANGED
package/src/locale/en/en.js
CHANGED
|
@@ -654,6 +654,10 @@ export default deepmerge(
|
|
|
654
654
|
message:
|
|
655
655
|
'The limit for agents to take a pause has been exceeded. The pause is unavailable right now.',
|
|
656
656
|
},
|
|
657
|
+
activityTypePopup: {
|
|
658
|
+
title: 'Please select activity type',
|
|
659
|
+
defaultOption: 'Standard Online',
|
|
660
|
+
},
|
|
657
661
|
},
|
|
658
662
|
pdfGeneration: {
|
|
659
663
|
generationStarted: 'Your PDF file is being created…',
|
package/src/locale/es/es.js
CHANGED
|
@@ -644,6 +644,10 @@ export default {
|
|
|
644
644
|
message:
|
|
645
645
|
'Se ha excedido el límite de agentes para tomar una pausa. La pausa no está disponible en este momento.',
|
|
646
646
|
},
|
|
647
|
+
activityTypePopup: {
|
|
648
|
+
title: 'Selecciona el tipo de actividad',
|
|
649
|
+
defaultOption: 'Estándar en línea',
|
|
650
|
+
},
|
|
647
651
|
},
|
|
648
652
|
pdfGeneration: {
|
|
649
653
|
generationStarted: 'Su archivo PDF se está creando…',
|
package/src/locale/kz/kz.js
CHANGED
|
@@ -645,6 +645,10 @@ export default {
|
|
|
645
645
|
message:
|
|
646
646
|
'Операторлардың паузаға шығу шегі асып кетті. Қазір пауза мүмкін емес.',
|
|
647
647
|
},
|
|
648
|
+
activityTypePopup: {
|
|
649
|
+
title: 'Әрекет түрін таңдаңыз',
|
|
650
|
+
defaultOption: 'Стандартты онлайн',
|
|
651
|
+
},
|
|
648
652
|
},
|
|
649
653
|
pdfGeneration: {
|
|
650
654
|
generationStarted: 'Сіздің PDF файлыңыз жасалуда…',
|
package/src/locale/pl/pl.js
CHANGED
|
@@ -644,6 +644,10 @@ export default {
|
|
|
644
644
|
message:
|
|
645
645
|
'Przekroczono limit agentów mogących wziąć pauzę. Pauza jest w tej chwili niedostępna.',
|
|
646
646
|
},
|
|
647
|
+
activityTypePopup: {
|
|
648
|
+
title: 'Wybierz typ aktywności',
|
|
649
|
+
defaultOption: 'Standardowy online',
|
|
650
|
+
},
|
|
647
651
|
},
|
|
648
652
|
pdfGeneration: {
|
|
649
653
|
generationStarted: 'Twój plik PDF jest tworzony…',
|
package/src/locale/ro/ro.js
CHANGED
|
@@ -650,6 +650,10 @@ export default {
|
|
|
650
650
|
message:
|
|
651
651
|
'Limita pentru agenții care pot lua pauză a fost depășită. Pauza nu este disponibilă momentan.',
|
|
652
652
|
},
|
|
653
|
+
activityTypePopup: {
|
|
654
|
+
title: 'Selectați tipul de activitate',
|
|
655
|
+
defaultOption: 'Standard Online',
|
|
656
|
+
},
|
|
653
657
|
},
|
|
654
658
|
pdfGeneration: {
|
|
655
659
|
generationStarted: 'Fișierul dvs. PDF este în curs de creare…',
|
package/src/locale/ru/ru.js
CHANGED
|
@@ -639,6 +639,10 @@ export default {
|
|
|
639
639
|
message:
|
|
640
640
|
'Лимит операторов в паузе превышен. Перерыв сейчас недоступен.',
|
|
641
641
|
},
|
|
642
|
+
activityTypePopup: {
|
|
643
|
+
title: 'Пожалуйста, выберите тип статуса',
|
|
644
|
+
defaultOption: 'Обычный онлайн',
|
|
645
|
+
},
|
|
642
646
|
},
|
|
643
647
|
pdfGeneration: {
|
|
644
648
|
generationStarted: 'Ваш PDF-файл генерируется…',
|
package/src/locale/uk/uk.js
CHANGED
|
@@ -637,6 +637,10 @@ export default {
|
|
|
637
637
|
message:
|
|
638
638
|
'Ліміт операторів в паузі перевищено. Перерва наразі недоступна.',
|
|
639
639
|
},
|
|
640
|
+
activityTypePopup: {
|
|
641
|
+
title: 'Будь ласка, виберіть тип статусу',
|
|
642
|
+
defaultOption: 'Звичайний онлайн',
|
|
643
|
+
},
|
|
640
644
|
},
|
|
641
645
|
pdfGeneration: {
|
|
642
646
|
generationStarted: 'Ваш PDF-файл генерується…',
|
package/src/locale/uz/uz.js
CHANGED
|
@@ -649,6 +649,10 @@ export default {
|
|
|
649
649
|
message:
|
|
650
650
|
'Agentlarning tanaffusga chiqish limiti oshib ketdi. Hozir tanaffus imkonsiz.',
|
|
651
651
|
},
|
|
652
|
+
activityTypePopup: {
|
|
653
|
+
title: 'Faoliyat turini tanlang',
|
|
654
|
+
defaultOption: 'Standart onlayn',
|
|
655
|
+
},
|
|
652
656
|
},
|
|
653
657
|
pdfGeneration: {
|
|
654
658
|
generationStarted: 'Sizning PDF faylingiz yaratilmoqda…',
|
package/src/locale/vi/vi.js
CHANGED
|
@@ -647,6 +647,10 @@ export default {
|
|
|
647
647
|
message:
|
|
648
648
|
'Đã vượt quá giới hạn số lượng tổng đài viên tạm dừng. Không thể tạm dừng ngay bây giờ.',
|
|
649
649
|
},
|
|
650
|
+
activityTypePopup: {
|
|
651
|
+
title: 'Vui lòng chọn loại hoạt động',
|
|
652
|
+
defaultOption: 'Trực tuyến tiêu chuẩn',
|
|
653
|
+
},
|
|
650
654
|
},
|
|
651
655
|
pdfGeneration: {
|
|
652
656
|
generationStarted: 'Tệp PDF của bạn đang được tạo…',
|
|
@@ -8,12 +8,14 @@ const AgentStatusAPIFactory = ({ instance, OpenAPIConfig }) => {
|
|
|
8
8
|
status,
|
|
9
9
|
pauseCause,
|
|
10
10
|
statusComment,
|
|
11
|
+
onlineSkill,
|
|
11
12
|
}) => {
|
|
12
13
|
const res = await service.updateAgentStatus(agentId, {
|
|
13
14
|
status,
|
|
14
15
|
id: agentId,
|
|
15
16
|
payload: pauseCause,
|
|
16
17
|
status_comment: statusComment,
|
|
18
|
+
online_skill: onlineSkill,
|
|
17
19
|
});
|
|
18
20
|
return {
|
|
19
21
|
success: !!res,
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<wt-popup
|
|
3
|
+
class="wt-cc-activity-type-popup"
|
|
4
|
+
size="md"
|
|
5
|
+
@close="close"
|
|
6
|
+
>
|
|
7
|
+
<template #title>
|
|
8
|
+
{{ t('webitelUI.agentStatusSelect.activityTypePopup.title') }}
|
|
9
|
+
</template>
|
|
10
|
+
<template #main>
|
|
11
|
+
<form @submit.prevent="setActivityType">
|
|
12
|
+
<ul class="wt-cc-activity-type-popup-option__wrapper">
|
|
13
|
+
<li
|
|
14
|
+
v-for="option of options"
|
|
15
|
+
:key="option.id"
|
|
16
|
+
class="wt-cc-activity-type-popup-option"
|
|
17
|
+
>
|
|
18
|
+
<wt-radio
|
|
19
|
+
:label="option.name"
|
|
20
|
+
:selected="selected?.id"
|
|
21
|
+
:value="option.id"
|
|
22
|
+
class="wt-cc-activity-type-popup-option__radio"
|
|
23
|
+
@update:selected="select(option)"
|
|
24
|
+
/>
|
|
25
|
+
</li>
|
|
26
|
+
</ul>
|
|
27
|
+
</form>
|
|
28
|
+
</template>
|
|
29
|
+
<template #actions>
|
|
30
|
+
<wt-button
|
|
31
|
+
:disabled="!selected"
|
|
32
|
+
@click="setActivityType"
|
|
33
|
+
>
|
|
34
|
+
{{ t('reusable.ok') }}
|
|
35
|
+
</wt-button>
|
|
36
|
+
<wt-button
|
|
37
|
+
color="secondary"
|
|
38
|
+
@click="close"
|
|
39
|
+
>
|
|
40
|
+
{{ t('reusable.cancel') }}
|
|
41
|
+
</wt-button>
|
|
42
|
+
</template>
|
|
43
|
+
</wt-popup>
|
|
44
|
+
</template>
|
|
45
|
+
|
|
46
|
+
<script setup lang="ts">
|
|
47
|
+
import { ref } from 'vue';
|
|
48
|
+
import { useI18n } from 'vue-i18n';
|
|
49
|
+
import type { LookupOption } from '../../../../types';
|
|
50
|
+
|
|
51
|
+
const props = withDefaults(
|
|
52
|
+
defineProps<{
|
|
53
|
+
options?: LookupOption[];
|
|
54
|
+
}>(),
|
|
55
|
+
{
|
|
56
|
+
options: () => [],
|
|
57
|
+
},
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
const emit = defineEmits<{
|
|
61
|
+
change: [
|
|
62
|
+
option: LookupOption,
|
|
63
|
+
];
|
|
64
|
+
close: [];
|
|
65
|
+
}>();
|
|
66
|
+
|
|
67
|
+
const { t } = useI18n();
|
|
68
|
+
|
|
69
|
+
const selected = ref<LookupOption | undefined>(props.options[0]);
|
|
70
|
+
|
|
71
|
+
function select(option: LookupOption) {
|
|
72
|
+
selected.value = option;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function close() {
|
|
76
|
+
emit('close');
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function setActivityType() {
|
|
80
|
+
emit('change', selected.value);
|
|
81
|
+
close();
|
|
82
|
+
}
|
|
83
|
+
</script>
|
|
84
|
+
|
|
85
|
+
<style lang="scss" scoped>
|
|
86
|
+
.wt-cc-activity-type-popup {
|
|
87
|
+
:deep(.wt-popup__popup) {
|
|
88
|
+
max-height: 500px;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.wt-cc-activity-type-popup-option {
|
|
93
|
+
display: flex;
|
|
94
|
+
justify-content: space-between;
|
|
95
|
+
align-items: center;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.wt-cc-activity-type-popup-option__wrapper {
|
|
99
|
+
display: flex;
|
|
100
|
+
flex-direction: column;
|
|
101
|
+
gap: var(--spacing-sm);
|
|
102
|
+
padding: var(--spacing-sm);
|
|
103
|
+
}
|
|
104
|
+
</style>
|
|
@@ -1,11 +1,26 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<article class="wt-cc-agent-status-select">
|
|
3
|
+
<wt-switcher
|
|
4
|
+
v-if="showCallCenterSwitcher"
|
|
5
|
+
controlled
|
|
6
|
+
:label="t('agentStatus.callCenter')"
|
|
7
|
+
:model-value="isCallCenterOn"
|
|
8
|
+
class="wt-cc-agent-status-select__call-center-switcher"
|
|
9
|
+
@update:model-value="toggleCallCenterMode"
|
|
10
|
+
/>
|
|
3
11
|
<wt-status-select
|
|
4
12
|
:key="status"
|
|
5
13
|
:status="status"
|
|
6
14
|
:status-duration="statusDuration"
|
|
7
15
|
@closed="handleClosed"
|
|
8
16
|
@change="handleSelectInput"
|
|
17
|
+
class="wt-cc-agent-status-select__status-select"
|
|
18
|
+
/>
|
|
19
|
+
<activity-type-popup
|
|
20
|
+
v-if="isActivityTypePopup"
|
|
21
|
+
:options="activityTypes"
|
|
22
|
+
@change="handleActivityTypeInput"
|
|
23
|
+
@close="closeActivityTypePopup"
|
|
9
24
|
/>
|
|
10
25
|
<pause-cause-popup
|
|
11
26
|
v-if="isPauseCausePopup"
|
|
@@ -21,51 +36,75 @@
|
|
|
21
36
|
</article>
|
|
22
37
|
</template>
|
|
23
38
|
|
|
24
|
-
<script setup>
|
|
39
|
+
<script setup lang="ts">
|
|
40
|
+
import type { EngineForAgentPauseCauseList } from '@webitel/api-services/gen';
|
|
25
41
|
import { ref } from 'vue';
|
|
42
|
+
import { useI18n } from 'vue-i18n';
|
|
26
43
|
import { useStore } from 'vuex';
|
|
27
44
|
import { PauseNotAllowedError } from 'webitel-sdk';
|
|
28
|
-
|
|
29
|
-
import
|
|
45
|
+
import { OnlineSkillsAPI } from '../../../../packages/api-services/src/api/clients/onlineSkills/onlineSkills';
|
|
46
|
+
import WtSwitcher from '../../../components/wt-switcher/wt-switcher.vue';
|
|
47
|
+
import { AgentStatus } from '../../../enums';
|
|
48
|
+
import type { LookupOption } from '../../../types';
|
|
30
49
|
import AgentStatusAPIFactory from '../api/agent-status.js';
|
|
31
50
|
import PauseCauseAPIFactory from '../api/pause-cause.js';
|
|
51
|
+
import { useCCenterModeSwitcher } from '../composables/useCCenterModeSwitcher';
|
|
52
|
+
import type { StatusChangePayload } from '../types/StatusChangePayload.types';
|
|
53
|
+
import ActivityTypePopup from './_internals/wt-cc-activity-type-popup.vue';
|
|
32
54
|
import PauseCausePopup from './_internals/wt-cc-pause-cause-popup.vue';
|
|
33
55
|
import StatusSelectErrorPopup from './_internals/wt-cc-status-select-error-popup.vue';
|
|
34
56
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
String,
|
|
51
|
-
],
|
|
52
|
-
default: 0,
|
|
57
|
+
type ActivityType = LookupOption;
|
|
58
|
+
|
|
59
|
+
const props = withDefaults(
|
|
60
|
+
defineProps<{
|
|
61
|
+
agentId: string | number;
|
|
62
|
+
status?: string;
|
|
63
|
+
statusDuration?: string | number;
|
|
64
|
+
showCallCenterSwitcher?: boolean;
|
|
65
|
+
isCallCenterOn?: boolean;
|
|
66
|
+
}>(),
|
|
67
|
+
{
|
|
68
|
+
status: AgentStatus.OFFLINE,
|
|
69
|
+
statusDuration: 0,
|
|
70
|
+
showCallCenterSwitcher: false,
|
|
71
|
+
isCallCenterOn: false,
|
|
53
72
|
},
|
|
54
|
-
|
|
73
|
+
);
|
|
55
74
|
|
|
56
|
-
const emit = defineEmits
|
|
57
|
-
|
|
58
|
-
|
|
75
|
+
const emit = defineEmits<{
|
|
76
|
+
changed: [
|
|
77
|
+
payload: StatusChangePayload,
|
|
78
|
+
];
|
|
79
|
+
'changed-call-center-mode': [
|
|
80
|
+
payload?: ActivityType,
|
|
81
|
+
];
|
|
82
|
+
}>();
|
|
59
83
|
|
|
60
84
|
const { api } = useStore().state;
|
|
61
85
|
const AgentStatusAPI = AgentStatusAPIFactory(api);
|
|
62
86
|
const PauseCauseAPI = PauseCauseAPIFactory(api);
|
|
87
|
+
const { t } = useI18n();
|
|
63
88
|
|
|
64
89
|
const isPauseCausePopup = ref(false);
|
|
65
|
-
const pauseCauses = ref([]);
|
|
90
|
+
const pauseCauses = ref<EngineForAgentPauseCauseList>([]);
|
|
66
91
|
const error = ref(null);
|
|
67
92
|
const chosenStatus = ref('');
|
|
68
93
|
|
|
94
|
+
const isActivityTypePopup = ref(false);
|
|
95
|
+
const activityTypes = ref<ActivityType[]>([]);
|
|
96
|
+
|
|
97
|
+
const defaultActivityTypeOption = ref<ActivityType | null>(null);
|
|
98
|
+
|
|
99
|
+
const { callCenterModeChanging, toggleCallCenterMode } = useCCenterModeSwitcher(
|
|
100
|
+
{
|
|
101
|
+
activityTypes,
|
|
102
|
+
loadActivityTypes,
|
|
103
|
+
openActivityTypePopup,
|
|
104
|
+
emit,
|
|
105
|
+
},
|
|
106
|
+
);
|
|
107
|
+
|
|
69
108
|
function openPauseCausePopup() {
|
|
70
109
|
isPauseCausePopup.value = true;
|
|
71
110
|
}
|
|
@@ -74,29 +113,67 @@ function closePauseCausePopup() {
|
|
|
74
113
|
isPauseCausePopup.value = false;
|
|
75
114
|
}
|
|
76
115
|
|
|
77
|
-
async function loadPauseCauses() {
|
|
116
|
+
async function loadPauseCauses(): Promise<void> {
|
|
78
117
|
const response = await PauseCauseAPI.getList({
|
|
79
118
|
agentId: props.agentId,
|
|
80
119
|
});
|
|
81
120
|
pauseCauses.value = response.items;
|
|
82
121
|
}
|
|
83
122
|
|
|
84
|
-
|
|
123
|
+
function openActivityTypePopup() {
|
|
124
|
+
isActivityTypePopup.value = true;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function closeActivityTypePopup() {
|
|
128
|
+
isActivityTypePopup.value = false;
|
|
129
|
+
callCenterModeChanging.value = false;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
async function loadActivityTypes(): Promise<void> {
|
|
133
|
+
const response = await OnlineSkillsAPI.getList({
|
|
134
|
+
skipDefault: false,
|
|
135
|
+
});
|
|
136
|
+
defaultActivityTypeOption.value = response.items[0];
|
|
137
|
+
activityTypes.value = [
|
|
138
|
+
{
|
|
139
|
+
id: defaultActivityTypeOption.value?.id,
|
|
140
|
+
name: t('webitelUI.agentStatusSelect.activityTypePopup.defaultOption'),
|
|
141
|
+
},
|
|
142
|
+
...response.items.slice(1),
|
|
143
|
+
];
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
async function updateStatus({
|
|
147
|
+
agentId,
|
|
148
|
+
status,
|
|
149
|
+
pauseCause,
|
|
150
|
+
statusComment,
|
|
151
|
+
onlineSkill,
|
|
152
|
+
}: StatusChangePayload) {
|
|
85
153
|
return AgentStatusAPI.patch({
|
|
86
154
|
agentId,
|
|
87
155
|
status,
|
|
88
156
|
pauseCause,
|
|
89
157
|
statusComment,
|
|
158
|
+
onlineSkill,
|
|
90
159
|
});
|
|
91
160
|
}
|
|
92
161
|
|
|
93
|
-
async function changeStatus({
|
|
162
|
+
async function changeStatus({
|
|
163
|
+
status,
|
|
164
|
+
pauseCause,
|
|
165
|
+
statusComment,
|
|
166
|
+
onlineSkill,
|
|
167
|
+
}: Omit<StatusChangePayload, 'agentId'>) {
|
|
94
168
|
try {
|
|
95
|
-
const statusPayload = {
|
|
169
|
+
const statusPayload: StatusChangePayload = {
|
|
96
170
|
agentId: props.agentId,
|
|
97
171
|
status,
|
|
98
172
|
pauseCause,
|
|
99
173
|
statusComment,
|
|
174
|
+
...(status === AgentStatus.ONLINE && {
|
|
175
|
+
onlineSkill,
|
|
176
|
+
}),
|
|
100
177
|
};
|
|
101
178
|
await updateStatus(statusPayload);
|
|
102
179
|
emit('changed', statusPayload);
|
|
@@ -106,8 +183,14 @@ async function changeStatus({ status, pauseCause, statusComment }) {
|
|
|
106
183
|
}
|
|
107
184
|
}
|
|
108
185
|
|
|
109
|
-
async function handleStatus(status) {
|
|
110
|
-
if (status === AgentStatus.
|
|
186
|
+
async function handleStatus(status: string) {
|
|
187
|
+
if (status === AgentStatus.ONLINE) {
|
|
188
|
+
await loadActivityTypes();
|
|
189
|
+
if (activityTypes.value.length > 1) {
|
|
190
|
+
openActivityTypePopup();
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
} else if (status === AgentStatus.PAUSE) {
|
|
111
194
|
await loadPauseCauses();
|
|
112
195
|
if (pauseCauses.value.length) {
|
|
113
196
|
openPauseCausePopup();
|
|
@@ -120,14 +203,14 @@ async function handleStatus(status) {
|
|
|
120
203
|
});
|
|
121
204
|
}
|
|
122
205
|
|
|
123
|
-
function handleSelectInput(newStatus) {
|
|
206
|
+
function handleSelectInput(newStatus: string) {
|
|
124
207
|
handleStatus(newStatus);
|
|
125
208
|
chosenStatus.value = newStatus;
|
|
126
209
|
// we need to save changes which come from input, because sometimes we want
|
|
127
210
|
// to choose 'pause' repeatedly and have to check the previous status
|
|
128
211
|
}
|
|
129
212
|
|
|
130
|
-
function handleClosed(event) {
|
|
213
|
+
function handleClosed(event: { value: string }) {
|
|
131
214
|
// sometimes we want to choose 'pause' repeatedly
|
|
132
215
|
// but 'change' event from wt-status-select can't give us the same value,
|
|
133
216
|
// in this case we have to use value from 'closed' event to choose 'pause' status
|
|
@@ -140,7 +223,29 @@ function handleClosed(event) {
|
|
|
140
223
|
}
|
|
141
224
|
}
|
|
142
225
|
|
|
143
|
-
function
|
|
226
|
+
function handleActivityTypeInput(activityType: ActivityType) {
|
|
227
|
+
const payload =
|
|
228
|
+
activityType.id === defaultActivityTypeOption.value?.id
|
|
229
|
+
? defaultActivityTypeOption.value
|
|
230
|
+
: activityType;
|
|
231
|
+
if (callCenterModeChanging.value) {
|
|
232
|
+
emit('changed-call-center-mode', payload);
|
|
233
|
+
callCenterModeChanging.value = false;
|
|
234
|
+
} else {
|
|
235
|
+
return changeStatus({
|
|
236
|
+
status: AgentStatus.ONLINE,
|
|
237
|
+
onlineSkill: payload,
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
function handlePauseCauseInput({
|
|
243
|
+
pauseCause,
|
|
244
|
+
statusComment,
|
|
245
|
+
}: {
|
|
246
|
+
pauseCause: string;
|
|
247
|
+
statusComment: string;
|
|
248
|
+
}) {
|
|
144
249
|
const status = AgentStatus.PAUSE;
|
|
145
250
|
return changeStatus({
|
|
146
251
|
status,
|
|
@@ -151,7 +256,13 @@ function handlePauseCauseInput({ pauseCause, statusComment }) {
|
|
|
151
256
|
</script>
|
|
152
257
|
|
|
153
258
|
<style lang="scss" scoped>
|
|
154
|
-
.wt-cc-agent-status-select
|
|
155
|
-
|
|
259
|
+
.wt-cc-agent-status-select {
|
|
260
|
+
display: flex;
|
|
261
|
+
&__call-center-switcher{
|
|
262
|
+
margin-right: var(--wt-app-header-content-gap);
|
|
263
|
+
}
|
|
264
|
+
&__status-select {
|
|
265
|
+
width: 150px;
|
|
266
|
+
}
|
|
156
267
|
}
|
|
157
268
|
</style>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ref } from 'vue';
|
|
2
|
+
|
|
3
|
+
import type { UseCCenterModeSwitcherParams } from '../types/UseCCenterModeSwitcherParams.types';
|
|
4
|
+
|
|
5
|
+
export const useCCenterModeSwitcher = ({
|
|
6
|
+
activityTypes,
|
|
7
|
+
loadActivityTypes,
|
|
8
|
+
openActivityTypePopup,
|
|
9
|
+
emit,
|
|
10
|
+
}: UseCCenterModeSwitcherParams) => {
|
|
11
|
+
const callCenterModeChanging = ref(false);
|
|
12
|
+
|
|
13
|
+
function changedCallCenterModeHandler() {
|
|
14
|
+
emit('changed-call-center-mode');
|
|
15
|
+
callCenterModeChanging.value = false;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
async function toggleCallCenterMode(value: boolean) {
|
|
19
|
+
callCenterModeChanging.value = true;
|
|
20
|
+
if (value) {
|
|
21
|
+
if (activityTypes.value.length <= 1) {
|
|
22
|
+
try {
|
|
23
|
+
await loadActivityTypes();
|
|
24
|
+
} catch (err) {
|
|
25
|
+
callCenterModeChanging.value = false;
|
|
26
|
+
throw err;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (activityTypes.value.length > 1) {
|
|
30
|
+
openActivityTypePopup();
|
|
31
|
+
} else {
|
|
32
|
+
changedCallCenterModeHandler();
|
|
33
|
+
}
|
|
34
|
+
} else {
|
|
35
|
+
changedCallCenterModeHandler();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
callCenterModeChanging,
|
|
41
|
+
toggleCallCenterMode,
|
|
42
|
+
};
|
|
43
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
import type { LookupOption } from '../../../types';
|
|
3
|
+
|
|
4
|
+
export interface UseCCenterModeSwitcherParams {
|
|
5
|
+
activityTypes: Ref<LookupOption[]>;
|
|
6
|
+
loadActivityTypes: () => Promise<void>;
|
|
7
|
+
openActivityTypePopup: () => void;
|
|
8
|
+
emit: (event: 'changed-call-center-mode', payload?: LookupOption) => void;
|
|
9
|
+
}
|
package/src/types/index.ts
CHANGED