@webitel/ui-sdk 26.8.54 → 26.8.56

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 (30) hide show
  1. package/dist/{clients-jhkEj9YI.js → clients-CWSXQd89.js} +8319 -7470
  2. package/dist/{components-C4rE9PlV.js → components-CWSUHV29.js} +8 -8
  3. package/dist/ui-sdk.css +1 -1
  4. package/dist/ui-sdk.js +1 -1
  5. package/dist/ui-sdk.umd.cjs +1495 -1383
  6. package/dist/{wt-chat-emoji-DVIlMP3o.js → wt-chat-emoji-DRK_E-lD.js} +1 -1
  7. package/dist/{wt-display-chip-items-DwMS-DJc.js → wt-display-chip-items-C5z7aCDZ.js} +1 -1
  8. package/dist/{wt-send-message-popup-DPjllTAk.js → wt-send-message-popup-G26F9NPH.js} +2 -2
  9. package/dist/{wt-type-extension-value-input-BO44atDh.js → wt-type-extension-value-input--Vc1cs5d.js} +2 -2
  10. package/dist/{wt-vidstack-player-BD28KRTU.js → wt-vidstack-player-FD4gfDSE.js} +1 -1
  11. package/package.json +2 -1
  12. package/src/api/clients/caseSources/caseSources.ts +2 -151
  13. package/src/api/clients/quickReplies/quickReplies.ts +2 -157
  14. package/src/components/on-demand/wt-type-extension-value-input/wt-type-extension-value-input.vue +2 -2
  15. package/src/components/wt-image/wt-image.vue +4 -4
  16. package/src/components/wt-multi-select/wt-multi-select.vue +3 -2
  17. package/src/components/wt-single-select/wt-single-select.vue +6 -3
  18. package/src/modules/AgentStatusSelect/components/_internals/wt-cc-activity-type-options.vue +52 -0
  19. package/src/modules/AgentStatusSelect/components/_internals/wt-cc-activity-type-popup.vue +7 -35
  20. package/src/modules/AgentStatusSelect/components/_internals/wt-cc-pause-cause-popup.vue +2 -2
  21. package/src/modules/AgentStatusSelect/components/wt-cc-agent-status-select.vue +4 -18
  22. package/src/modules/AgentStatusSelect/composables/useActivityTypesOptions.ts +37 -0
  23. package/src/modules/QueryFilters/mixins/__tests__/enumFilterMixin.spec.js +60 -0
  24. package/src/modules/QueryFilters/mixins/enumFilterMixin.js +21 -6
  25. package/src/modules/UserNotifications/api/UserNotifications.ts +1 -1
  26. package/types/.tsbuildinfo +1 -1
  27. package/types/api/clients/caseSources/caseSources.d.ts +1 -16
  28. package/types/api/clients/quickReplies/quickReplies.d.ts +1 -16
  29. package/types/modules/AgentStatusSelect/components/_internals/wt-cc-activity-type-options.vue.d.ts +17 -0
  30. package/types/modules/AgentStatusSelect/composables/useActivityTypesOptions.d.ts +18 -0
@@ -1,4 +1,4 @@
1
- import "./components-C4rE9PlV.js";
1
+ import "./components-CWSUHV29.js";
2
2
  import { t as e } from "./_plugin-vue_export-helper-B3ysoDQm.js";
3
3
  import { l as t } from "./enums-DY3jIXFF.js";
4
4
  import { t as n } from "./wt-button-2_aOV7LX.js";
@@ -1,4 +1,4 @@
1
- import { C as e, i as t } from "./components-C4rE9PlV.js";
1
+ import { C as e, i as t } from "./components-CWSUHV29.js";
2
2
  import { t as n } from "./_plugin-vue_export-helper-B3ysoDQm.js";
3
3
  import { t as r } from "./displayText-CtaxzaBz.js";
4
4
  import { Fragment as i, computed as a, createCommentVNode as o, createElementBlock as s, createTextVNode as c, createVNode as l, defineComponent as u, openBlock as d, renderList as f, renderSlot as p, toDisplayString as m, unref as h, withCtx as g } from "vue";
@@ -1,6 +1,6 @@
1
1
  import { t as e } from "./rolldown-runtime-BEcgMyyN.js";
2
- import { n as t, r as n } from "./clients-jhkEj9YI.js";
3
- import { T as r, n as i, w as a } from "./components-C4rE9PlV.js";
2
+ import { n as t, r as n } from "./clients-CWSXQd89.js";
3
+ import { T as r, n as i, w as a } from "./components-CWSUHV29.js";
4
4
  import { t as o } from "./vue-i18n-Db_oYfO8.js";
5
5
  import { n as s } from "./useEventBus-B-ZeklLu.js";
6
6
  import { createBlock as c, createTextVNode as l, createVNode as u, defineComponent as d, mergeProps as f, onMounted as p, openBlock as m, ref as h, resolveComponent as g, toDisplayString as _, unref as v, withCtx as y } from "vue";
@@ -1,5 +1,5 @@
1
- import { t as e } from "./clients-jhkEj9YI.js";
2
- import { a as t, o as n, r, s as i } from "./components-C4rE9PlV.js";
1
+ import { t as e } from "./clients-CWSXQd89.js";
2
+ import { a as t, o as n, r, s as i } from "./components-CWSUHV29.js";
3
3
  import { t as a } from "./enums-DY3jIXFF.js";
4
4
  import { t as o } from "./vue-i18n-Db_oYfO8.js";
5
5
  import { computed as s, createBlock as c, createCommentVNode as l, createVNode as u, defineComponent as d, mergeModels as f, mergeProps as p, openBlock as m, renderSlot as h, resolveComponent as g, unref as _, useModel as v } from "vue";
@@ -1,4 +1,4 @@
1
- import { D as e } from "./components-C4rE9PlV.js";
1
+ import { D as e } from "./components-CWSUHV29.js";
2
2
  import { t } from "./_plugin-vue_export-helper-B3ysoDQm.js";
3
3
  import { l as n } from "./enums-DY3jIXFF.js";
4
4
  import "./wt-button-2_aOV7LX.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webitel/ui-sdk",
3
- "version": "26.8.54",
3
+ "version": "26.8.56",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "npm run docs:dev",
@@ -124,6 +124,7 @@
124
124
  "@biomejs/biome": "2.4.16",
125
125
  "@pinia/testing": "^1.0.3",
126
126
  "@regle/core": "^1.16.2",
127
+ "@regle/schemas": "^1.x",
127
128
  "@tsconfig/node22": "^22.0.0",
128
129
  "@types/deep-equal": "^1.0.4",
129
130
  "@types/file-saver-es": "^2.0.3",
@@ -1,151 +1,2 @@
1
- import {
2
- CreateSourceBody,
3
- getSources,
4
- ListSourcesQueryParams,
5
- UpdateSourceBody,
6
- } from '@webitel/api-services/gen';
7
- import {
8
- // getFieldsToSendFromZodSchema,
9
- getShallowFieldsToSendFromZodSchema,
10
- } from '@webitel/api-services/gen/utils';
11
- import {
12
- getDefaultGetListResponse,
13
- getDefaultGetParams,
14
- } from '../../defaults/index';
15
- import applyTransform, {
16
- camelToSnake,
17
- merge,
18
- notify,
19
- sanitize,
20
- snakeToCamel,
21
- } from '../../transformers/index';
22
- import type {
23
- AddItemParams,
24
- ApiParams,
25
- DeleteItemParams,
26
- GetItemParams,
27
- UpdateItemParams,
28
- } from '../_shared/types';
29
-
30
- const sourceService = getSources();
31
-
32
- const getSourcesList = async (params: ApiParams) => {
33
- const fieldsToSend = getShallowFieldsToSendFromZodSchema(
34
- ListSourcesQueryParams,
35
- );
36
-
37
- const { page, size, fields, sort, id, q, type } = applyTransform(params, [
38
- merge(getDefaultGetParams()),
39
- sanitize(fieldsToSend),
40
- camelToSnake(),
41
- ]);
42
-
43
- try {
44
- const response = await sourceService.listSources({
45
- page,
46
- size,
47
- fields,
48
- sort,
49
- id,
50
- q: q || params.search,
51
- type,
52
- });
53
- const { items, next } = applyTransform(response.data, [
54
- merge(getDefaultGetListResponse()),
55
- ]);
56
- return {
57
- items: applyTransform(items, []),
58
- next,
59
- };
60
- } catch (err) {
61
- throw applyTransform(err, [
62
- notify,
63
- ]);
64
- }
65
- };
66
-
67
- const getSource = async ({ itemId: id }: GetItemParams<string>) => {
68
- const itemResponseHandler = (item: ApiParams) => item.source; // TODO wtf??
69
-
70
- try {
71
- const response = await sourceService.locateSource(id);
72
- return applyTransform(response.data, [
73
- snakeToCamel(),
74
- itemResponseHandler,
75
- ]);
76
- } catch (err) {
77
- throw applyTransform(err, [
78
- notify,
79
- ]);
80
- }
81
- };
82
-
83
- const addSource = async ({ itemInstance }: AddItemParams) => {
84
- const item = applyTransform(itemInstance, [
85
- sanitize(getShallowFieldsToSendFromZodSchema(CreateSourceBody)),
86
- camelToSnake(),
87
- ]);
88
- try {
89
- const response = await sourceService.createSource(item);
90
- return applyTransform(response.data, [
91
- snakeToCamel(),
92
- ]);
93
- } catch (err) {
94
- throw applyTransform(err, [
95
- notify,
96
- ]);
97
- }
98
- };
99
-
100
- const updateSource = async ({
101
- itemInstance,
102
- itemId: id,
103
- }: UpdateItemParams<string>) => {
104
- const item = applyTransform(itemInstance, [
105
- camelToSnake(),
106
- sanitize(getShallowFieldsToSendFromZodSchema(UpdateSourceBody)),
107
- ]);
108
-
109
- try {
110
- const response = await sourceService.updateSource(id, item);
111
- return applyTransform(response.data, [
112
- snakeToCamel(),
113
- ]);
114
- } catch (err) {
115
- throw applyTransform(err, [
116
- notify,
117
- ]);
118
- }
119
- };
120
-
121
- const deleteSource = async ({ id }: DeleteItemParams<string>) => {
122
- try {
123
- const response = await sourceService.deleteSource(id);
124
- return applyTransform(response.data, []);
125
- } catch (err) {
126
- throw applyTransform(err, [
127
- notify,
128
- ]);
129
- }
130
- };
131
-
132
- const getLookup = (params: ApiParams) =>
133
- getSourcesList({
134
- ...params,
135
- fields: params.fields || [
136
- 'id',
137
- 'name',
138
- 'type',
139
- ],
140
- });
141
-
142
- const CaseSourcesAPI = {
143
- getList: getSourcesList,
144
- get: getSource,
145
- add: addSource,
146
- update: updateSource,
147
- delete: deleteSource,
148
- getLookup,
149
- };
150
-
151
- export default CaseSourcesAPI;
1
+ /* moved to @webitel/api-services; kept as a re-export for existing importers */
2
+ export { CaseSourcesAPI as default } from '@webitel/api-services/api';
@@ -1,157 +1,2 @@
1
- import { getQuickRepliesService } from '@webitel/api-services/gen';
2
- import {
3
- getDefaultGetListResponse,
4
- getDefaultGetParams,
5
- } from '../../defaults/index';
6
- import applyTransform, {
7
- camelToSnake,
8
- merge,
9
- notify,
10
- sanitize,
11
- snakeToCamel,
12
- starToSearch,
13
- } from '../../transformers/index';
14
- import type {
15
- AddItemParams,
16
- ApiParams,
17
- DeleteItemParams,
18
- GetItemParams,
19
- UpdateItemParams,
20
- } from '../_shared/types';
21
-
22
- const quickReplyService = getQuickRepliesService();
23
-
24
- const fieldsToSend = [
25
- 'name',
26
- 'queues',
27
- 'article',
28
- 'teams',
29
- 'text',
30
- ];
31
-
32
- const getQuickRepliesList = async (params: ApiParams) => {
33
- const fieldsToSend = [
34
- 'page',
35
- 'size',
36
- 'q',
37
- 'sort',
38
- 'fields',
39
- 'id',
40
- ];
41
-
42
- const { page, size, fields, sort, id, q } = applyTransform(params, [
43
- merge(getDefaultGetParams()),
44
- starToSearch('search'),
45
- (params: ApiParams) => ({
46
- ...params,
47
- q: params.search,
48
- }),
49
- sanitize(fieldsToSend),
50
- camelToSnake(),
51
- ]);
52
-
53
- try {
54
- const response = await quickReplyService.searchQuickReplies({
55
- page,
56
- size,
57
- fields,
58
- sort,
59
- id,
60
- q,
61
- });
62
- const { items, next } = applyTransform(response.data, [
63
- merge(getDefaultGetListResponse()),
64
- ]);
65
- return {
66
- items: applyTransform(items, [
67
- snakeToCamel(),
68
- ]),
69
- next,
70
- };
71
- } catch (err) {
72
- throw applyTransform(err, [
73
- notify,
74
- ]);
75
- }
76
- };
77
-
78
- const getQuickReply = async ({ itemId: id }: GetItemParams<number>) => {
79
- try {
80
- const response = await quickReplyService.readQuickReply(id);
81
- return applyTransform(response.data, [
82
- snakeToCamel(),
83
- ]);
84
- } catch (err) {
85
- throw applyTransform(err, [
86
- notify,
87
- ]);
88
- }
89
- };
90
-
91
- const addQuickReply = async ({ itemInstance }: AddItemParams) => {
92
- const item = applyTransform(itemInstance, [
93
- sanitize(fieldsToSend),
94
- camelToSnake(),
95
- ]);
96
- try {
97
- const response = await quickReplyService.createQuickReply(item);
98
- return applyTransform(response.data, [
99
- snakeToCamel(),
100
- ]);
101
- } catch (err) {
102
- throw applyTransform(err, [
103
- notify,
104
- ]);
105
- }
106
- };
107
-
108
- const updateQuickReply = async ({
109
- itemInstance,
110
- itemId: id,
111
- }: UpdateItemParams<number>) => {
112
- const item = applyTransform(itemInstance, [
113
- camelToSnake(),
114
- sanitize(fieldsToSend),
115
- ]);
116
-
117
- try {
118
- const response = await quickReplyService.updateQuickReply(id, item);
119
- return applyTransform(response.data, [
120
- snakeToCamel(),
121
- ]);
122
- } catch (err) {
123
- throw applyTransform(err, [
124
- notify,
125
- ]);
126
- }
127
- };
128
-
129
- const deleteQuickReply = async ({ id }: DeleteItemParams<number>) => {
130
- try {
131
- const response = await quickReplyService.deleteQuickReply(id);
132
- return applyTransform(response.data, []);
133
- } catch (err) {
134
- throw applyTransform(err, [
135
- notify,
136
- ]);
137
- }
138
- };
139
-
140
- const getLookup = (params: ApiParams) =>
141
- getQuickRepliesList({
142
- ...params,
143
- fields: params.fields || [
144
- 'id',
145
- 'name',
146
- ],
147
- });
148
-
149
- const QuickRepliesApi = {
150
- getList: getQuickRepliesList,
151
- get: getQuickReply,
152
- add: addQuickReply,
153
- update: updateQuickReply,
154
- delete: deleteQuickReply,
155
- getLookup,
156
- };
157
- export default QuickRepliesApi;
1
+ /* moved to @webitel/api-services; kept as a re-export for existing importers */
2
+ export { QuickRepliesAPI as default } from '@webitel/api-services/api';
@@ -111,7 +111,7 @@ const props = defineProps<{
111
111
 
112
112
  const { t } = useI18n();
113
113
 
114
- const label = computed(() => {
114
+ const computedLabel = computed(() => {
115
115
  return props.label || t(props.field?.name || 'vocabulary.labels');
116
116
  });
117
117
 
@@ -125,7 +125,7 @@ const value = computed<any>(() => {
125
125
  });
126
126
 
127
127
  const sharedChildrenProps = computed(() => ({
128
- label: label.value,
128
+ label: computedLabel.value,
129
129
  required: isRequired.value,
130
130
  v: props.v,
131
131
  }));
@@ -1,8 +1,8 @@
1
1
  <template>
2
2
  <div
3
3
  class="wt-image" :style="{
4
- width,
5
- height,
4
+ width: resolvedWidth,
5
+ height: resolvedHeight,
6
6
  minWidth,
7
7
  minHeight,
8
8
  maxWidth,
@@ -56,7 +56,7 @@ const emit = defineEmits([
56
56
  'click',
57
57
  ]);
58
58
 
59
- const width = computed(() => {
59
+ const resolvedWidth = computed(() => {
60
60
  const width = props.size ? sizeToUnits[props.size] : props.width;
61
61
 
62
62
  // if converted to Number without an error, it has no units in it
@@ -67,7 +67,7 @@ const width = computed(() => {
67
67
  return width;
68
68
  });
69
69
 
70
- const height = computed(() => {
70
+ const resolvedHeight = computed(() => {
71
71
  // if (props.aspectRatio) return null;
72
72
 
73
73
  const height = props.size ? sizeToUnits[props.size] : props.height;
@@ -133,7 +133,7 @@
133
133
  <script setup lang="ts">
134
134
  import type { SuperCompatibleRegleFieldStatus } from '@regle/core';
135
135
  import type { SelectProps } from 'primevue';
136
- import { computed, toRefs, useSlots, useTemplateRef } from 'vue';
136
+ import { computed, ref, toRefs, useSlots, useTemplateRef } from 'vue';
137
137
  import { useI18n } from 'vue-i18n';
138
138
  import { ChipColor, ComponentSize, MessageVariant } from '../../enums';
139
139
  import { useValidation } from '../../mixins/validationMixin/useValidation';
@@ -142,6 +142,7 @@ import type {
142
142
  VuelidateFieldLike,
143
143
  } from '../../mixins/validationMixin/vuelidate/useVuelidateValidation';
144
144
  import type {
145
+ SelectComponentRef,
145
146
  SelectOption,
146
147
  SelectSearchMethod,
147
148
  } from '../_internals/composables/useSelect/types';
@@ -220,7 +221,7 @@ const MAX_SELECTED_LABELS = 3;
220
221
  const selectId = `select-${Math.random().toString(36).slice(2, 11)}`;
221
222
 
222
223
  const filterInput = useTemplateRef('filterInput');
223
- const selectRef = useTemplateRef('selectRef');
224
+ const selectRef = ref<SelectComponentRef>();
224
225
 
225
226
  const emit = defineEmits<{
226
227
  'add:custom-value': [
@@ -109,14 +109,17 @@
109
109
  <script setup lang="ts">
110
110
  import type { SuperCompatibleRegleFieldStatus } from '@regle/core';
111
111
  import type { SelectProps } from 'primevue';
112
- import { computed, toRefs, useSlots, useTemplateRef } from 'vue';
112
+ import { computed, ref, toRefs, useSlots, useTemplateRef } from 'vue';
113
113
  import { ComponentSize, MessageVariant } from '../../enums';
114
114
  import { useValidation } from '../../mixins/validationMixin/useValidation';
115
115
  import type {
116
116
  CompatCustomValidator,
117
117
  VuelidateFieldLike,
118
118
  } from '../../mixins/validationMixin/vuelidate/useVuelidateValidation';
119
- import type { SelectSearchMethod } from '../_internals/composables/useSelect/types';
119
+ import type {
120
+ SelectComponentRef,
121
+ SelectSearchMethod,
122
+ } from '../_internals/composables/useSelect/types';
120
123
  import { useSelect } from '../_internals/composables/useSelect/useSelect';
121
124
 
122
125
  interface Props extends Omit<SelectProps, 'size' | 'options'> {
@@ -195,7 +198,7 @@ const emit = defineEmits<{
195
198
  const selectId = `select-${Math.random().toString(36).slice(2, 11)}`;
196
199
 
197
200
  const filterInput = useTemplateRef('filterInput');
198
- const selectRef = useTemplateRef('selectRef');
201
+ const selectRef = ref<SelectComponentRef>();
199
202
 
200
203
  const {
201
204
  showFooterLoader,
@@ -0,0 +1,52 @@
1
+ <template>
2
+ <form
3
+ class="wt-cc-activity-type-options"
4
+ @submit.prevent
5
+ >
6
+ <ul class="wt-cc-activity-type-options__list">
7
+ <li
8
+ v-for="option of options"
9
+ :key="option.id"
10
+ class="wt-cc-activity-type-options__item"
11
+ >
12
+ <wt-radio
13
+ :label="option.name"
14
+ :selected="model?.id"
15
+ :value="option.id"
16
+ class="wt-cc-activity-type-options__radio"
17
+ @update:selected="model = option"
18
+ />
19
+ </li>
20
+ </ul>
21
+ </form>
22
+ </template>
23
+
24
+ <script setup lang="ts">
25
+ import type { LookupOption } from '../../../../types';
26
+
27
+ withDefaults(
28
+ defineProps<{
29
+ options?: LookupOption[];
30
+ }>(),
31
+ {
32
+ options: () => [],
33
+ },
34
+ );
35
+
36
+ const model = defineModel<LookupOption | undefined>();
37
+ </script>
38
+
39
+ <style scoped>
40
+ .wt-cc-activity-type-options__list {
41
+ display: flex;
42
+ flex-direction: column;
43
+ gap: var(--spacing-sm);
44
+ padding: var(--spacing-sm);
45
+ }
46
+
47
+ .wt-cc-activity-type-options__item {
48
+ display: flex;
49
+ justify-content: space-between;
50
+ align-items: center;
51
+ }
52
+ </style>
@@ -8,23 +8,11 @@
8
8
  {{ t('webitelUI.agentStatusSelect.activityTypePopup.title') }}
9
9
  </template>
10
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>
11
+ <wt-cc-activity-type-options
12
+ :model-value="selected"
13
+ :options="options"
14
+ @update:model-value="selected = $event"
15
+ />
28
16
  </template>
29
17
  <template #actions>
30
18
  <wt-button
@@ -47,6 +35,7 @@
47
35
  import { ref } from 'vue';
48
36
  import { useI18n } from 'vue-i18n';
49
37
  import type { LookupOption } from '../../../../types';
38
+ import WtCcActivityTypeOptions from './wt-cc-activity-type-options.vue';
50
39
 
51
40
  const props = withDefaults(
52
41
  defineProps<{
@@ -66,11 +55,7 @@ const emit = defineEmits<{
66
55
 
67
56
  const { t } = useI18n();
68
57
 
69
- const selected = ref<LookupOption | undefined>(props.options[0]);
70
-
71
- function select(option: LookupOption) {
72
- selected.value = option;
73
- }
58
+ const selected = ref<LookupOption | undefined>(props.options?.[0]);
74
59
 
75
60
  function close() {
76
61
  emit('close');
@@ -88,17 +73,4 @@ function setActivityType() {
88
73
  max-height: 500px;
89
74
  }
90
75
  }
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
76
  </style>
@@ -84,13 +84,13 @@ const emit = defineEmits([
84
84
  'close',
85
85
  ]);
86
86
 
87
- const options = toRef(props, 'options');
87
+ const optionsRef = toRef(props, 'options');
88
88
 
89
89
  const selected = ref(null);
90
90
 
91
91
  const { t } = useI18n();
92
92
 
93
- const { representablePauseCause } = useRepresentableAgentPauseCause(options);
93
+ const { representablePauseCause } = useRepresentableAgentPauseCause(optionsRef);
94
94
 
95
95
  const pauseCause = computed(() =>
96
96
  representablePauseCause.value.map((cause) => ({
@@ -9,7 +9,7 @@
9
9
  @update:model-value="toggleCallCenterMode"
10
10
  />
11
11
  <wt-status-select
12
- :key="status"
12
+ :key="status"
13
13
  :status="status"
14
14
  :status-duration="statusDuration"
15
15
  @change="handleStatus"
@@ -36,7 +36,6 @@
36
36
  </template>
37
37
 
38
38
  <script setup lang="ts">
39
- import { OnlineSkillsAPI } from '@webitel/api-services/api';
40
39
  import type { EngineForAgentPauseCause } from '@webitel/api-services/gen';
41
40
  import { ref } from 'vue';
42
41
  import { useI18n } from 'vue-i18n';
@@ -47,6 +46,7 @@ import { AgentStatus } from '../../../enums';
47
46
  import type { LookupOption } from '../../../types';
48
47
  import AgentStatusAPIFactory from '../api/agent-status.js';
49
48
  import PauseCauseAPIFactory from '../api/pause-cause.js';
49
+ import { useActivityTypesOptions } from '../composables/useActivityTypesOptions';
50
50
  import { useCCenterModeSwitcher } from '../composables/useCCenterModeSwitcher';
51
51
  import type { StatusChangePayload } from '../types/StatusChangePayload.types';
52
52
  import ActivityTypePopup from './_internals/wt-cc-activity-type-popup.vue';
@@ -90,9 +90,9 @@ const pauseCauses = ref<EngineForAgentPauseCause[]>([]);
90
90
  const error = ref(null);
91
91
 
92
92
  const isActivityTypePopup = ref(false);
93
- const activityTypes = ref<ActivityType[]>([]);
94
93
 
95
- const defaultActivityTypeOption = ref<ActivityType | null>(null);
94
+ const { activityTypes, defaultActivityTypeOption, loadActivityTypes } =
95
+ useActivityTypesOptions();
96
96
 
97
97
  const { callCenterModeChanging, toggleCallCenterMode } = useCCenterModeSwitcher(
98
98
  {
@@ -127,20 +127,6 @@ function closeActivityTypePopup() {
127
127
  callCenterModeChanging.value = false;
128
128
  }
129
129
 
130
- async function loadActivityTypes(): Promise<void> {
131
- const response = await OnlineSkillsAPI.getList({
132
- skipDefault: false,
133
- });
134
- defaultActivityTypeOption.value = response.items[0];
135
- activityTypes.value = [
136
- {
137
- id: defaultActivityTypeOption.value?.id,
138
- name: t('webitelUI.agentStatusSelect.activityTypePopup.defaultOption'),
139
- },
140
- ...response.items.slice(1),
141
- ];
142
- }
143
-
144
130
  async function updateStatus({
145
131
  agentId,
146
132
  status,