@webitel/ui-sdk 24.12.23 → 24.12.25

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webitel/ui-sdk",
3
- "version": "24.12.23",
3
+ "version": "24.12.25",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vite",
@@ -1,5 +1,5 @@
1
- import agents from './agents/agents.js';
2
1
  import agentChats from './agents/agentChats.js';
2
+ import agents from './agents/agents.js';
3
3
  import buckets from './buckets/buckets.js';
4
4
  import calendars from './calendars/calendars.js';
5
5
  import catalog from './catalog/catalog.js';
@@ -12,6 +12,8 @@ import lists from './lists/blacklists.js';
12
12
  import media from './media/media.js';
13
13
  import queues from './queues/queues.js';
14
14
  import roles from './roles/roles.js';
15
+ import skills from './skills/skills.js';
16
+ import teams from './teams/teams.js';
15
17
  import users from './users/users.js';
16
18
  import { contactChatMessagesHistory, contacts } from './сontacts/index.js';
17
19
 
@@ -25,6 +27,8 @@ export {
25
27
  communications,
26
28
  flows,
27
29
  gateways,
30
+ teams,
31
+ skills,
28
32
  lists,
29
33
  media,
30
34
  queues,
@@ -0,0 +1,98 @@
1
+ import { SkillServiceApiFactory } from 'webitel-sdk';
2
+ import {
3
+ getDefaultGetListResponse,
4
+ getDefaultGetParams,
5
+ getDefaultInstance,
6
+ getDefaultOpenAPIConfig,
7
+ } from '../../defaults/index.js';
8
+ import applyTransform, {
9
+ camelToSnake,
10
+ merge,
11
+ notify,
12
+ sanitize,
13
+ snakeToCamel,
14
+ starToSearch,
15
+ } from '../../transformers/index.js';
16
+
17
+ const instance = getDefaultInstance();
18
+ const configuration = getDefaultOpenAPIConfig();
19
+
20
+ const skillService = new SkillServiceApiFactory(configuration, '', instance);
21
+
22
+ const getSkillsList = async (params) => {
23
+ const { page, size, search, sort, fields, id } = applyTransform(params, [
24
+ merge(getDefaultGetParams()),
25
+ starToSearch('search'),
26
+ ]);
27
+
28
+ try {
29
+ const response = await skillService.searchSkill(page, size, search, sort, fields, id);
30
+ const { items, next } = applyTransform(response.data, [
31
+ snakeToCamel(),
32
+ merge(getDefaultGetListResponse()),
33
+ ]);
34
+ return {
35
+ items,
36
+ next,
37
+ };
38
+ } catch (err) {
39
+ throw applyTransform(err, [notify]);
40
+ }
41
+ };
42
+
43
+ const getSkill = async ({ itemId: id }) => {
44
+ try {
45
+ const response = await skillService.readSkill(id);
46
+ return applyTransform(response.data, [snakeToCamel()]);
47
+ } catch (err) {
48
+ throw applyTransform(err, [notify]);
49
+ }
50
+ };
51
+
52
+ const fieldsToSend = ['name', 'description'];
53
+
54
+ const addSkill = async ({ itemInstance }) => {
55
+ const item = applyTransform(itemInstance, [sanitize(fieldsToSend), camelToSnake()]);
56
+ try {
57
+ const response = await skillService.createSkill(item);
58
+ return applyTransform(response.data, [snakeToCamel()]);
59
+ } catch (err) {
60
+ throw applyTransform(err, [notify]);
61
+ }
62
+ };
63
+
64
+ const updateSkill = async ({ itemInstance, itemId: id }) => {
65
+ const item = applyTransform(itemInstance, [sanitize(fieldsToSend), camelToSnake()]);
66
+ try {
67
+ const response = await skillService.updateSkill(id, item);
68
+ return applyTransform(response.data, [snakeToCamel()]);
69
+ } catch (err) {
70
+ throw applyTransform(err, [notify]);
71
+ }
72
+ };
73
+
74
+ const deleteSkill = async ({ id }) => {
75
+ try {
76
+ const response = await skillService.deleteSkill(id);
77
+ return applyTransform(response.data, []);
78
+ } catch (err) {
79
+ throw applyTransform(err, [notify]);
80
+ }
81
+ };
82
+
83
+ const getSkillsLookup = (params) =>
84
+ getSkillsList({
85
+ ...params,
86
+ fields: params.fields || ['id', 'name'],
87
+ });
88
+
89
+ const SkillsAPI = {
90
+ getList: getSkillsList,
91
+ get: getSkill,
92
+ add: addSkill,
93
+ update: updateSkill,
94
+ delete: deleteSkill,
95
+ getLookup: getSkillsLookup,
96
+ };
97
+
98
+ export default SkillsAPI;
@@ -0,0 +1,133 @@
1
+ import { AgentTeamServiceApiFactory } from 'webitel-sdk';
2
+ import {
3
+ getDefaultGetListResponse,
4
+ getDefaultGetParams,
5
+ getDefaultInstance,
6
+ getDefaultOpenAPIConfig,
7
+ } from '../../defaults/index.js';
8
+ import applyTransform, {
9
+ camelToSnake,
10
+ merge,
11
+ notify,
12
+ sanitize,
13
+ snakeToCamel,
14
+ starToSearch,
15
+ } from '../../transformers/index.js';
16
+
17
+ const instance = getDefaultInstance();
18
+ const configuration = getDefaultOpenAPIConfig();
19
+
20
+ const teamService = new AgentTeamServiceApiFactory(configuration, '', instance);
21
+
22
+ const fieldsToSend = [
23
+ 'name',
24
+ 'description',
25
+ 'strategy',
26
+ 'admin',
27
+ 'maxNoAnswer',
28
+ 'wrapUpTime',
29
+ 'noAnswerDelayTime',
30
+ 'taskAcceptTimeout',
31
+ 'callTimeout',
32
+ 'inviteChatTimeout',
33
+ ];
34
+
35
+ const getTeamsList = async (params) => {
36
+ const { page, size, search, sort, fields, id, strategy, adminId } = applyTransform(params, [
37
+ merge(getDefaultGetParams()),
38
+ starToSearch('search'),
39
+ ]);
40
+
41
+ try {
42
+ const response = await teamService.searchAgentTeam(
43
+ page,
44
+ size,
45
+ search,
46
+ sort,
47
+ fields,
48
+ id,
49
+ strategy,
50
+ adminId,
51
+ );
52
+ const { items, next } = applyTransform(response.data, [
53
+ snakeToCamel(),
54
+ merge(getDefaultGetListResponse()),
55
+ ]);
56
+ return {
57
+ items,
58
+ next,
59
+ };
60
+ } catch (err) {
61
+ throw applyTransform(err, [notify]);
62
+ }
63
+ };
64
+
65
+ const getTeam = async ({ itemId: id }) => {
66
+ const defaultObject = {
67
+ name: '',
68
+ strategy: {},
69
+ admin: [],
70
+ description: '',
71
+ busyDelayTime: 0,
72
+ callTimeout: 0,
73
+ maxNoAnswer: 0,
74
+ noAnswerDelayTime: 0,
75
+ taskAcceptTimeout: 0,
76
+ inviteChatTimeout: 0,
77
+ rejectDelayTime: 0,
78
+ wrapUpTime: 0,
79
+ };
80
+
81
+ try {
82
+ const response = await teamService.readAgentTeam(id);
83
+ return applyTransform(response.data, [snakeToCamel(), merge(defaultObject)]);
84
+ } catch (err) {
85
+ throw applyTransform(err, [notify]);
86
+ }
87
+ };
88
+
89
+ const addTeam = async ({ itemInstance }) => {
90
+ const item = applyTransform(itemInstance, [sanitize(fieldsToSend), camelToSnake()]);
91
+ try {
92
+ const response = await teamService.createAgentTeam(item);
93
+ return applyTransform(response.data, [snakeToCamel()]);
94
+ } catch (err) {
95
+ throw applyTransform(err, [notify]);
96
+ }
97
+ };
98
+
99
+ const updateTeam = async ({ itemInstance, itemId: id }) => {
100
+ const item = applyTransform(itemInstance, [sanitize(fieldsToSend), camelToSnake()]);
101
+ try {
102
+ const response = await teamService.updateAgentTeam(id, item);
103
+ return applyTransform(response.data, [snakeToCamel()]);
104
+ } catch (err) {
105
+ throw applyTransform(err, [notify]);
106
+ }
107
+ };
108
+
109
+ const deleteTeam = async ({ id }) => {
110
+ try {
111
+ const response = await teamService.deleteAgentTeam(id);
112
+ return applyTransform(response.data, []);
113
+ } catch (err) {
114
+ throw applyTransform(err, [notify]);
115
+ }
116
+ };
117
+
118
+ const getTeamsLookup = (params) =>
119
+ getTeamsList({
120
+ ...params,
121
+ fields: params.fields || ['id', 'name'],
122
+ });
123
+
124
+ const TeamsAPI = {
125
+ getList: getTeamsList,
126
+ get: getTeam,
127
+ add: addTeam,
128
+ update: updateTeam,
129
+ delete: deleteTeam,
130
+ getLookup: getTeamsLookup,
131
+ };
132
+
133
+ export default TeamsAPI;
@@ -14,7 +14,7 @@
14
14
  name="label"
15
15
  v-bind="{ label }"
16
16
  >
17
- {{ label }}
17
+ {{ requiredLabel }}
18
18
  </slot>
19
19
  </wt-label>
20
20
  <vue-datepicker
@@ -80,9 +80,14 @@
80
80
  <script setup>
81
81
  import VueDatepicker from '@vuepic/vue-datepicker';
82
82
  import '@vuepic/vue-datepicker/dist/main.css';
83
- import { ref } from 'vue';
83
+ import { computed, ref } from 'vue';
84
84
 
85
85
  const props = defineProps({
86
+
87
+ /**
88
+ * [`'date'`, `'datetime'`]
89
+ * */
90
+
86
91
  mode: {
87
92
  type: String,
88
93
  default: 'date',
@@ -114,9 +119,22 @@ const props = defineProps({
114
119
  type: String,
115
120
  default: 'en',
116
121
  },
122
+
123
+ /**
124
+ * Object with props, passed down to wt-label as props
125
+ */
126
+
117
127
  labelProps: {
118
128
  type: Object,
119
- description: 'Object with props, passed down to wt-label as props',
129
+ },
130
+
131
+ /**
132
+ * Native input required attribute
133
+ */
134
+
135
+ required: {
136
+ type: Boolean,
137
+ default: false,
120
138
  },
121
139
  });
122
140
  const emit = defineEmits(['input']);
@@ -125,6 +143,10 @@ const isOpened = ref(false);
125
143
  const datepicker = ref(null); // template ref
126
144
 
127
145
  const isDateTime = props.mode === 'datetime';
146
+
147
+ const requiredLabel = computed(() => {
148
+ return props.required ? `${props.label}*` : props.label;
149
+ });
128
150
  </script>
129
151
 
130
152
  <style lang="scss">
@@ -8,7 +8,13 @@
8
8
  :invalid="invalid"
9
9
  v-bind="labelProps"
10
10
  >
11
- {{ `${label} (${format})` }}
11
+ <!-- @slot Custom input label -->
12
+ <slot
13
+ name="label"
14
+ v-bind="{ label }"
15
+ >
16
+ {{ requiredLabel }}
17
+ </slot>
12
18
  </wt-label>
13
19
  <div class="wt-timepicker__wrapper">
14
20
  <wt-time-input
@@ -65,6 +71,9 @@ export default {
65
71
  event: 'input',
66
72
  },
67
73
  props: {
74
+ /**
75
+ * Time value in seconds (not milliseconds!)
76
+ */
68
77
  value: {
69
78
  type: [String, Number],
70
79
  default: 0,
@@ -93,6 +102,11 @@ export default {
93
102
  type: Boolean,
94
103
  default: false,
95
104
  },
105
+ required: {
106
+ type: Boolean,
107
+ default: false,
108
+ description: 'Native input required attribute',
109
+ },
96
110
  },
97
111
 
98
112
  computed: {
@@ -154,6 +168,9 @@ export default {
154
168
  this.$emit('input', newValue);
155
169
  },
156
170
  },
171
+ requiredLabel() {
172
+ return this.required ? `${this.label} (${this.format})*` : `${this.label} (${this.format})`;
173
+ },
157
174
  },
158
175
 
159
176
  methods: {},