@webitel/ui-sdk 26.8.34 → 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.
Files changed (42) hide show
  1. package/package.json +1 -1
  2. package/src/locale/en/en.js +7 -0
  3. package/src/locale/es/es.js +9 -0
  4. package/src/locale/kz/kz.js +9 -0
  5. package/src/locale/pl/pl.js +8 -0
  6. package/src/locale/ro/ro.js +9 -0
  7. package/src/locale/ru/ru.js +8 -0
  8. package/src/locale/uk/uk.js +7 -0
  9. package/src/locale/uz/uz.js +9 -0
  10. package/src/locale/vi/vi.js +8 -0
  11. package/src/modules/AgentStatusSelect/api/agent-status.js +2 -0
  12. package/src/modules/AgentStatusSelect/components/_internals/wt-cc-activity-type-popup.vue +104 -0
  13. package/src/modules/AgentStatusSelect/components/wt-cc-agent-status-select.vue +148 -37
  14. package/src/modules/AgentStatusSelect/composables/useCCenterModeSwitcher.ts +43 -0
  15. package/src/modules/AgentStatusSelect/types/StatusChangePayload.types.ts +9 -0
  16. package/src/modules/AgentStatusSelect/types/UseCCenterModeSwitcherParams.types.ts +9 -0
  17. package/src/modules/ObjectPermissions/headers/headers.ts +5 -0
  18. package/src/types/LookupOption.types.ts +4 -0
  19. package/src/types/index.ts +1 -0
  20. package/src/validations/config/errors/__tests__/customZodErrorsHandler.spec.ts +103 -0
  21. package/src/validations/config/errors/customZodErrorsHandler.ts +14 -0
  22. package/types/.tsbuildinfo +1 -1
  23. package/types/locale/en/en.d.ts +7 -0
  24. package/types/locale/es/es.d.ts +10 -2
  25. package/types/locale/i18n.d.ts +63 -0
  26. package/types/locale/index.d.ts +63 -0
  27. package/types/locale/kz/kz.d.ts +10 -2
  28. package/types/locale/pl/pl.d.ts +10 -2
  29. package/types/locale/ro/ro.d.ts +10 -2
  30. package/types/locale/ru/ru.d.ts +10 -2
  31. package/types/locale/uk/uk.d.ts +10 -2
  32. package/types/locale/uz/uz.d.ts +10 -2
  33. package/types/locale/vi/vi.d.ts +10 -2
  34. package/types/modules/AgentStatusSelect/api/agent-status.d.ts +2 -1
  35. package/types/modules/AgentStatusSelect/components/_internals/wt-cc-activity-type-popup.vue.d.ts +15 -0
  36. package/types/modules/AgentStatusSelect/components/wt-cc-agent-status-select.vue.d.ts +21 -32
  37. package/types/modules/AgentStatusSelect/composables/useCCenterModeSwitcher.d.ts +5 -0
  38. package/types/modules/AgentStatusSelect/types/StatusChangePayload.types.d.ts +8 -0
  39. package/types/modules/AgentStatusSelect/types/UseCCenterModeSwitcherParams.types.d.ts +8 -0
  40. package/types/modules/ObjectPermissions/headers/headers.d.ts +5 -0
  41. package/types/types/LookupOption.types.d.ts +4 -0
  42. package/types/types/index.d.ts +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webitel/ui-sdk",
3
- "version": "26.8.34",
3
+ "version": "26.8.36",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "npm run docs:dev",
@@ -439,6 +439,9 @@ export default deepmerge(
439
439
  },
440
440
  },
441
441
  validation: {
442
+ hourRange: 'Hours must be from 00 to 23',
443
+ timerangeStartLessThanEnd: 'Time From cannot be greater than To',
444
+ timerangeNotIntersect: 'Time intervals on the same day cannot overlap',
442
445
  required: 'Field is required',
443
446
  numeric: 'Should be numeric',
444
447
  email: 'Should look like email',
@@ -651,6 +654,10 @@ export default deepmerge(
651
654
  message:
652
655
  'The limit for agents to take a pause has been exceeded. The pause is unavailable right now.',
653
656
  },
657
+ activityTypePopup: {
658
+ title: 'Please select activity type',
659
+ defaultOption: 'Standard Online',
660
+ },
654
661
  },
655
662
  pdfGeneration: {
656
663
  generationStarted: 'Your PDF file is being created…',
@@ -429,6 +429,11 @@ export default {
429
429
  },
430
430
  },
431
431
  validation: {
432
+ hourRange: 'Las horas deben estar entre 00 y 23',
433
+ timerangeStartLessThanEnd:
434
+ 'La hora "Desde" no puede ser posterior a "Hasta"',
435
+ timerangeNotIntersect:
436
+ 'Los intervalos de tiempo del mismo día no pueden superponerse',
432
437
  required: 'Campo requerido',
433
438
  numeric: 'Debe ser numérico',
434
439
  email: 'Debe parecer un correo electrónico',
@@ -639,6 +644,10 @@ export default {
639
644
  message:
640
645
  'Se ha excedido el límite de agentes para tomar una pausa. La pausa no está disponible en este momento.',
641
646
  },
647
+ activityTypePopup: {
648
+ title: 'Selecciona el tipo de actividad',
649
+ defaultOption: 'Estándar en línea',
650
+ },
642
651
  },
643
652
  pdfGeneration: {
644
653
  generationStarted: 'Su archivo PDF se está creando…',
@@ -432,6 +432,11 @@ export default {
432
432
  },
433
433
  },
434
434
  validation: {
435
+ hourRange: 'Сағат 00-ден 23-ке дейін болуы керек',
436
+ timerangeStartLessThanEnd:
437
+ '"Бастап" уақыты "Дейін" уақытынан кеш болмауы керек',
438
+ timerangeNotIntersect:
439
+ 'Бір күннің уақыт аралықтары бір-бірімен қиыспауы керек',
435
440
  required: 'Өріс міндетті',
436
441
  numeric: 'Сандық болуы керек',
437
442
  email: 'Email сияқты болуы керек',
@@ -640,6 +645,10 @@ export default {
640
645
  message:
641
646
  'Операторлардың паузаға шығу шегі асып кетті. Қазір пауза мүмкін емес.',
642
647
  },
648
+ activityTypePopup: {
649
+ title: 'Әрекет түрін таңдаңыз',
650
+ defaultOption: 'Стандартты онлайн',
651
+ },
643
652
  },
644
653
  pdfGeneration: {
645
654
  generationStarted: 'Сіздің PDF файлыңыз жасалуда…',
@@ -432,6 +432,10 @@ export default {
432
432
  },
433
433
  },
434
434
  validation: {
435
+ hourRange: 'Godziny muszą być od 00 do 23',
436
+ timerangeStartLessThanEnd: 'Czas "Od" nie może być późniejszy niż "Do"',
437
+ timerangeNotIntersect:
438
+ 'Interwały czasowe w tym samym dniu nie mogą się nakładać',
435
439
  required: 'Pole jest wymagane',
436
440
  numeric: 'Powinno być numeryczne',
437
441
  email: 'Powinno wyglądać jak email',
@@ -640,6 +644,10 @@ export default {
640
644
  message:
641
645
  'Przekroczono limit agentów mogących wziąć pauzę. Pauza jest w tej chwili niedostępna.',
642
646
  },
647
+ activityTypePopup: {
648
+ title: 'Wybierz typ aktywności',
649
+ defaultOption: 'Standardowy online',
650
+ },
643
651
  },
644
652
  pdfGeneration: {
645
653
  generationStarted: 'Twój plik PDF jest tworzony…',
@@ -436,6 +436,11 @@ export default {
436
436
  },
437
437
  },
438
438
  validation: {
439
+ hourRange: 'Orele trebuie să fie între 00 și 23',
440
+ timerangeStartLessThanEnd:
441
+ 'Ora "De la" nu poate fi mai târzie decât "Până la"',
442
+ timerangeNotIntersect:
443
+ 'Intervalele de timp din aceeași zi nu se pot suprapune',
439
444
  required: 'Câmpul este obligatoriu',
440
445
  numeric: 'Trebuie să fie numeric',
441
446
  email: 'Trebuie să arate ca un email',
@@ -645,6 +650,10 @@ export default {
645
650
  message:
646
651
  'Limita pentru agenții care pot lua pauză a fost depășită. Pauza nu este disponibilă momentan.',
647
652
  },
653
+ activityTypePopup: {
654
+ title: 'Selectați tipul de activitate',
655
+ defaultOption: 'Standard Online',
656
+ },
648
657
  },
649
658
  pdfGeneration: {
650
659
  generationStarted: 'Fișierul dvs. PDF este în curs de creare…',
@@ -431,6 +431,10 @@ export default {
431
431
  },
432
432
  },
433
433
  validation: {
434
+ hourRange: 'Часы должны быть от 00 до 23',
435
+ timerangeStartLessThanEnd: 'Время От не может быть больше чем До',
436
+ timerangeNotIntersect:
437
+ 'Временные интервалы в один день не могут пересекаться',
434
438
  required: 'Обязательное поле',
435
439
  numeric: 'Необходимо ввести цифровое значение',
436
440
  email: 'Необходимо ввести адрес электронной почты',
@@ -635,6 +639,10 @@ export default {
635
639
  message:
636
640
  'Лимит операторов в паузе превышен. Перерыв сейчас недоступен.',
637
641
  },
642
+ activityTypePopup: {
643
+ title: 'Пожалуйста, выберите тип статуса',
644
+ defaultOption: 'Обычный онлайн',
645
+ },
638
646
  },
639
647
  pdfGeneration: {
640
648
  generationStarted: 'Ваш PDF-файл генерируется…',
@@ -430,6 +430,9 @@ export default {
430
430
  },
431
431
  },
432
432
  validation: {
433
+ hourRange: 'Години мають бути від 00 до 23',
434
+ timerangeStartLessThanEnd: 'Час Від не може бути більший ніж До',
435
+ timerangeNotIntersect: 'Інтервали часу в один день не можуть перетинатися',
433
436
  required: "Обов'язкове поле",
434
437
  numeric: 'Необхідно ввести цифрові значення',
435
438
  email: 'Необхідно ввести адресу електронної пошти',
@@ -634,6 +637,10 @@ export default {
634
637
  message:
635
638
  'Ліміт операторів в паузі перевищено. Перерва наразі недоступна.',
636
639
  },
640
+ activityTypePopup: {
641
+ title: 'Будь ласка, виберіть тип статусу',
642
+ defaultOption: 'Звичайний онлайн',
643
+ },
637
644
  },
638
645
  pdfGeneration: {
639
646
  generationStarted: 'Ваш PDF-файл генерується…',
@@ -436,6 +436,11 @@ export default {
436
436
  },
437
437
  },
438
438
  validation: {
439
+ hourRange: "Soatlar 00 dan 23 gacha bo'lishi kerak",
440
+ timerangeStartLessThanEnd:
441
+ '"Dan" vaqti "Gacha" vaqtidan kech bo\'lishi mumkin emas',
442
+ timerangeNotIntersect:
443
+ "Bir kundagi vaqt oralig'lari bir-biriga kesilib o'tmasligi kerak",
439
444
  required: "Maydon to'ldirilishi shart",
440
445
  numeric: "Raqam bo'lishi kerak",
441
446
  email: "Email ko'rinishida bo'lishi kerak",
@@ -644,6 +649,10 @@ export default {
644
649
  message:
645
650
  'Agentlarning tanaffusga chiqish limiti oshib ketdi. Hozir tanaffus imkonsiz.',
646
651
  },
652
+ activityTypePopup: {
653
+ title: 'Faoliyat turini tanlang',
654
+ defaultOption: 'Standart onlayn',
655
+ },
647
656
  },
648
657
  pdfGeneration: {
649
658
  generationStarted: 'Sizning PDF faylingiz yaratilmoqda…',
@@ -436,6 +436,10 @@ export default {
436
436
  },
437
437
  },
438
438
  validation: {
439
+ hourRange: 'Giờ phải từ 00 đến 23',
440
+ timerangeStartLessThanEnd: 'Thời gian "Từ" không được muộn hơn "Đến"',
441
+ timerangeNotIntersect:
442
+ 'Các khoảng thời gian trong cùng một ngày không được chồng chéo',
439
443
  required: 'Trường bắt buộc',
440
444
  numeric: 'Phải là số',
441
445
  email: 'Phải là email',
@@ -643,6 +647,10 @@ export default {
643
647
  message:
644
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ờ.',
645
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
+ },
646
654
  },
647
655
  pdfGeneration: {
648
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 AgentStatus from '../../../enums/AgentStatus/AgentStatus.enum.js';
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
- const props = defineProps({
36
- agentId: {
37
- type: [
38
- String,
39
- Number,
40
- ],
41
- required: true,
42
- },
43
- status: {
44
- // can be undefined, is agent wasn't loaded yet
45
- default: AgentStatus.OFFLINE,
46
- },
47
- statusDuration: {
48
- type: [
49
- Number,
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
- 'changed',
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
- async function updateStatus({ agentId, status, pauseCause, statusComment }) {
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({ status, pauseCause, statusComment }) {
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.PAUSE) {
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 handlePauseCauseInput({ pauseCause, statusComment }) {
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 .wt-status-select {
155
- width: 150px;
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 { LookupOption } from '../../../types';
2
+
3
+ export interface StatusChangePayload {
4
+ agentId: string | number;
5
+ status: string;
6
+ pauseCause?: string;
7
+ statusComment?: string;
8
+ onlineSkill?: LookupOption;
9
+ }
@@ -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
+ }
@@ -1,5 +1,10 @@
1
1
  import { SortSymbols } from '../../../scripts/sortQueryAdapters';
2
2
 
3
+ /**
4
+ * `field` is what goes into the `fields` query of `GET <object>/:id/acl`, where
5
+ * the three rule columns all come from one `granted` string — the store asks
6
+ * for it once. The rule letters (`r`, `w`, `d`) are not attributes there.
7
+ */
3
8
  export const headers = [
4
9
  {
5
10
  value: 'grantee',