@webitel/ui-sdk 26.8.56 → 26.8.58

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 (39) hide show
  1. package/dist/clients-C8mcFrih.js +39958 -0
  2. package/dist/{components-CWSUHV29.js → components-BPZw8R7l.js} +4 -4
  3. package/dist/{engineCallFileType.zod-C-t93kQg.js → engineCallFileType-D7QVFOac.js} +1 -1
  4. package/dist/{generateInstance-C9d7J_TX.js → genClient-HHiOUj56.js} +969 -755
  5. package/dist/ui-sdk.js +2 -2
  6. package/dist/ui-sdk.umd.cjs +2056 -2056
  7. package/dist/{useValidation-BD4S-sEW.js → useValidation-Bvastl-C.js} +11 -3
  8. package/dist/{wt-call-media-action-Bn2bGCWs.js → wt-call-media-action-Bkyppnsm.js} +1 -1
  9. package/dist/{wt-chat-emoji-DRK_E-lD.js → wt-chat-emoji-D6B2P8nH.js} +1 -1
  10. package/dist/{wt-datepicker-H4E0JyRE.js → wt-datepicker-DmGisBuB.js} +1 -1
  11. package/dist/{wt-display-chip-items-C5z7aCDZ.js → wt-display-chip-items-Dtei-l63.js} +1 -1
  12. package/dist/{wt-screen-recordings-action-Dj6ITuhE.js → wt-screen-recordings-action-DI1qlUi1.js} +1 -1
  13. package/dist/{wt-search-bar-DzzSQyB3.js → wt-search-bar-D0qgd2ve.js} +1 -1
  14. package/dist/{wt-send-message-popup-G26F9NPH.js → wt-send-message-popup-kfbNJZ7j.js} +2 -2
  15. package/dist/{wt-timepicker-RhM7Sln_.js → wt-timepicker-BhTfiWhA.js} +1 -1
  16. package/dist/{wt-type-extension-value-input--Vc1cs5d.js → wt-type-extension-value-input-6W9v6GSa.js} +2 -2
  17. package/dist/{wt-vidstack-player-FD4gfDSE.js → wt-vidstack-player-B7wlNyKn.js} +1 -1
  18. package/package.json +6 -2
  19. package/src/mixins/validationMixin/regle/useRegleValidation.ts +14 -4
  20. package/src/modules/UploadCsvPopup/components/__tests__/wt-upload-csv-popup.spec.js +32 -0
  21. package/src/modules/UploadCsvPopup/components/wt-upload-csv-popup.vue +15 -26
  22. package/src/modules/UploadCsvPopup/composable/__tests__/useUploadCsv.spec.js +393 -0
  23. package/src/modules/UploadCsvPopup/composable/useUploadCsv.ts +36 -19
  24. package/src/modules/UploadCsvPopup/index.ts +11 -0
  25. package/src/modules/UploadCsvPopup/scripts/__tests__/normalizeCSVData.spec.js +125 -0
  26. package/src/modules/UploadCsvPopup/scripts/__tests__/parseCSV.spec.js +63 -0
  27. package/src/modules/UploadCsvPopup/scripts/normalizeCSVData.ts +2 -0
  28. package/src/modules/UploadCsvPopup/scripts/parseCSV.ts +0 -23
  29. package/types/.tsbuildinfo +1 -1
  30. package/types/api/defaults/getDefaultInstance/getDefaultInstance.d.ts +1 -1
  31. package/types/modules/UploadCsvPopup/components/__tests__/wt-upload-csv-popup.spec.d.ts +1 -0
  32. package/types/modules/UploadCsvPopup/components/wt-upload-csv-popup.vue.d.ts +5 -5
  33. package/types/modules/UploadCsvPopup/composable/__tests__/useUploadCsv.spec.d.ts +1 -0
  34. package/types/modules/UploadCsvPopup/composable/useUploadCsv.d.ts +7 -3
  35. package/types/modules/UploadCsvPopup/index.d.ts +5 -0
  36. package/types/modules/UploadCsvPopup/scripts/__tests__/normalizeCSVData.spec.d.ts +1 -0
  37. package/types/modules/UploadCsvPopup/scripts/__tests__/parseCSV.spec.d.ts +1 -0
  38. package/types/modules/UploadCsvPopup/scripts/normalizeCSVData.d.ts +2 -0
  39. package/dist/clients-CWSXQd89.js +0 -40124
@@ -3,9 +3,17 @@ import { t } from "./vue-i18n-Db_oYfO8.js";
3
3
  import { computed as n, isReactive as r, isRef as i, unref as a } from "vue";
4
4
  //#region src/mixins/validationMixin/regle/useRegleValidation.ts
5
5
  var o = (e) => {
6
- if (Array.isArray(e)) return e.at(0);
7
- if (e && typeof e == "object") {
8
- for (let t of Object.values(e)) if (Array.isArray(t) && t.length) return t.at(0);
6
+ if (typeof e == "string") return e;
7
+ if (Array.isArray(e)) {
8
+ for (let t of e) {
9
+ let e = o(t);
10
+ if (e) return e;
11
+ }
12
+ return;
13
+ }
14
+ if (e && typeof e == "object") for (let t of Object.values(e)) {
15
+ let e = o(t);
16
+ if (e) return e;
9
17
  }
10
18
  }, s = ({ field: e }) => ({
11
19
  invalid: n(() => e?.value?.$error ?? null),
@@ -1,5 +1,5 @@
1
1
  import { t as e } from "./_plugin-vue_export-helper-B3ysoDQm.js";
2
- import { t } from "./engineCallFileType.zod-C-t93kQg.js";
2
+ import { t } from "./engineCallFileType-D7QVFOac.js";
3
3
  import { computed as n, createBlock as r, createCommentVNode as i, createElementVNode as a, createTextVNode as o, createVNode as s, defineComponent as c, openBlock as l, resolveComponent as u, toDisplayString as d, withCtx as f } from "vue";
4
4
  //#region src/components/on-demand/wt-call-media-action/wt-call-media-action.vue?vue&type=script&setup=true&lang.ts
5
5
  var p = { class: "wt-call-media-action__option" }, m = /*#__PURE__*/ e(/* @__PURE__ */ c({
@@ -1,4 +1,4 @@
1
- import "./components-CWSUHV29.js";
1
+ import "./components-BPZw8R7l.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";
@@ -2,7 +2,7 @@ import { t as e } from "./_plugin-vue_export-helper-B3ysoDQm.js";
2
2
  import { g as t, h as n, l as r, r as i } from "./enums-DY3jIXFF.js";
3
3
  import { a, i as o, n as s, r as c, t as l } from "./toZonedTime-B8L5kbse.js";
4
4
  import { t as u } from "./vue-i18n-Db_oYfO8.js";
5
- import { t as d } from "./useValidation-BD4S-sEW.js";
5
+ import { t as d } from "./useValidation-Bvastl-C.js";
6
6
  import { computed as f, createBlock as p, createCommentVNode as m, createElementBlock as h, createElementVNode as g, createTextVNode as _, createVNode as v, defineComponent as y, guardReactiveProps as b, mergeModels as x, mergeProps as S, nextTick as C, normalizeProps as w, onMounted as T, onUnmounted as E, openBlock as D, renderSlot as O, resolveComponent as k, toDisplayString as A, toRefs as j, unref as M, useModel as N, useTemplateRef as P, vShow as F, withCtx as I, withDirectives as ee } from "vue";
7
7
  import te from "primevue/datepicker";
8
8
  //#region node_modules/date-fns-tz/dist/esm/fromZonedTime/index.js
@@ -1,4 +1,4 @@
1
- import { C as e, i as t } from "./components-CWSUHV29.js";
1
+ import { C as e, i as t } from "./components-BPZw8R7l.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,5 +1,5 @@
1
1
  import { t as e } from "./_plugin-vue_export-helper-B3ysoDQm.js";
2
- import { t } from "./engineCallFileType.zod-C-t93kQg.js";
2
+ import { t } from "./engineCallFileType-D7QVFOac.js";
3
3
  import { computed as n, createBlock as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createTextVNode as s, createVNode as c, defineComponent as l, openBlock as u, resolveComponent as d, toDisplayString as f, unref as p, withCtx as m } from "vue";
4
4
  //#region src/components/on-demand/wt-screen-recordings-action/wt-screen-recordings-action.vue?vue&type=script&setup=true&lang.ts
5
5
  var h = { class: "wt-screen-recordings-action" }, g = { class: "wt-screen-recordings-action__option" }, _ = /*#__PURE__*/ e(/* @__PURE__ */ l({
@@ -1,6 +1,6 @@
1
1
  import { t as e } from "./_plugin-vue_export-helper-B3ysoDQm.js";
2
2
  import { t } from "./debounce-Bp3jy7S5.js";
3
- import { t as n } from "./useValidation-BD4S-sEW.js";
3
+ import { t as n } from "./useValidation-Bvastl-C.js";
4
4
  import { computed as r, createBlock as i, createCommentVNode as a, createElementVNode as o, createSlots as s, createTextVNode as c, createVNode as l, defineComponent as u, normalizeClass as d, openBlock as f, renderSlot as p, resolveComponent as m, resolveDirective as h, toDisplayString as g, toRefs as _, unref as v, withCtx as y, withDirectives as b } from "vue";
5
5
  //#region src/components/wt-search-bar/wt-search-bar.vue?vue&type=script&setup=true&lang.ts
6
6
  var x = { class: "wt-search-bar__icon-controls" }, S = /*#__PURE__*/ e(/* @__PURE__ */ u({
@@ -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-CWSXQd89.js";
3
- import { T as r, n as i, w as a } from "./components-CWSUHV29.js";
2
+ import { n as t, r as n } from "./clients-C8mcFrih.js";
3
+ import { T as r, n as i, w as a } from "./components-BPZw8R7l.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,7 +1,7 @@
1
1
  import { t as e } from "./_plugin-vue_export-helper-B3ysoDQm.js";
2
2
  import { l as t, r as n } from "./enums-DY3jIXFF.js";
3
3
  import { t as r } from "./vue-i18n-Db_oYfO8.js";
4
- import { t as i } from "./useValidation-BD4S-sEW.js";
4
+ import { t as i } from "./useValidation-Bvastl-C.js";
5
5
  import { computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, defineComponent as d, guardReactiveProps as f, mergeProps as p, nextTick as m, normalizeClass as h, normalizeProps as g, openBlock as _, renderSlot as v, resolveComponent as y, toDisplayString as b, toRefs as x, unref as S, withCtx as C } from "vue";
6
6
  //#region src/components/wt-timepicker/wt-timepicker.vue?vue&type=script&setup=true&lang.ts
7
7
  var w = { class: "wt-timepicker__wrapper" }, T = 3600, E = 60, D = /*#__PURE__*/ e(/* @__PURE__ */ d({
@@ -1,5 +1,5 @@
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";
1
+ import { t as e } from "./clients-C8mcFrih.js";
2
+ import { a as t, o as n, r, s as i } from "./components-BPZw8R7l.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-CWSUHV29.js";
1
+ import { D as e } from "./components-BPZw8R7l.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.56",
3
+ "version": "26.8.58",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "npm run docs:dev",
@@ -62,6 +62,7 @@
62
62
  "@vuepic/vue-datepicker": "^4.5.1",
63
63
  "@vueuse/components": "^14.0.0",
64
64
  "autosize": "^6.0.1",
65
+ "csv-parse": "^6.1.0",
65
66
  "csv-stringify": "^5.5.3",
66
67
  "date-fns-tz": "^3.2.0",
67
68
  "dompurify": "^3.3.1",
@@ -139,7 +140,6 @@
139
140
  "@vuelidate/validators": "^2.0.4",
140
141
  "@webitel/styleguide": "~26.2",
141
142
  "clipboard-copy": "^4.x",
142
- "csv-parse": "^6.1.0",
143
143
  "globals": "^16.0.0",
144
144
  "globby": "^16.x",
145
145
  "happy-dom": "^20.x",
@@ -355,6 +355,10 @@
355
355
  "types": "./types/modules/ObjectPermissions/index.d.ts",
356
356
  "import": "./src/modules/ObjectPermissions/index.ts"
357
357
  },
358
+ "./modules/UploadCsvPopup": {
359
+ "types": "./types/modules/UploadCsvPopup/index.d.ts",
360
+ "import": "./src/modules/UploadCsvPopup/index.ts"
361
+ },
358
362
  "./plugins*": {
359
363
  "types": "./types/plugins*",
360
364
  "import": "./src/plugins*"
@@ -11,15 +11,25 @@ export type UseFieldValidationReturn = {
11
11
  };
12
12
 
13
13
  const getFirstRegleError = (errors: unknown): string | undefined => {
14
+ if (typeof errors === 'string') {
15
+ return errors;
16
+ }
17
+
14
18
  if (Array.isArray(errors)) {
15
- return errors.at(0);
19
+ for (const entry of errors) {
20
+ const found = getFirstRegleError(entry);
21
+ if (found) return found;
22
+ }
23
+ return undefined;
16
24
  }
17
25
 
26
+ // array-type fields nest their own rule errors under `$self` and
27
+ // per-item errors under `$each`, an array of per-item error shapes —
28
+ // recurse instead of assuming array entries are already messages
18
29
  if (errors && typeof errors === 'object') {
19
30
  for (const value of Object.values(errors)) {
20
- if (Array.isArray(value) && value.length) {
21
- return value.at(0);
22
- }
31
+ const found = getFirstRegleError(value);
32
+ if (found) return found;
23
33
  }
24
34
  }
25
35
 
@@ -0,0 +1,32 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+
3
+ import WtUploadCsvPopup from '../wt-upload-csv-popup.vue';
4
+
5
+ describe('WtUploadCsvPopup', () => {
6
+ it('renders a component', () => {
7
+ const wrapper = shallowMount(WtUploadCsvPopup, {
8
+ props: {
9
+ file: null,
10
+ mappingFields: [],
11
+ },
12
+ });
13
+
14
+ expect(wrapper).toBeTruthy();
15
+ });
16
+
17
+ /*
18
+ An undeclared prop silently falls through as an attribute, so the composable
19
+ would never see the saver and the import would close as a success without
20
+ saving anything. Props extends UseUploadCsvProps to prevent that — this
21
+ guards the contract.
22
+ */
23
+ it.each([
24
+ 'file',
25
+ 'mappingFields',
26
+ 'addBulkItems',
27
+ 'handlingMode',
28
+ 'fileUploadHandler',
29
+ ])('declares the %s prop', (prop) => {
30
+ expect(Object.keys(WtUploadCsvPopup.props)).toContain(prop);
31
+ });
32
+ });
@@ -79,8 +79,8 @@
79
79
  :key="key"
80
80
  class="wt-upload-csv-popup-mapping-item"
81
81
  >
82
- <p class="wt-upload-csv-popup-mapping-item__field">
83
- {{ t(field.locale) }}<span v-if="field.required">*</span>
82
+ <p class="wt-upload-csv-popup-mapping-item__field typo-body-1">
83
+ {{ getFieldLabel(field) }}<span v-if="field.required">*</span>
84
84
  </p>
85
85
 
86
86
  <wt-single-select
@@ -88,34 +88,29 @@
88
88
  v-model:model-value="field.csv"
89
89
  :show-clear="!field.required"
90
90
  :options="csvColumns"
91
- :placeholder="t(field.locale)"
91
+ :placeholder="getFieldLabel(field)"
92
92
  :data-key="null"
93
93
  class="wt-upload-csv-popup-mapping-item__select"
94
94
  />
95
95
  <wt-multi-select
96
96
  v-else
97
97
  v-model:model-value="field.csv"
98
+ chips-view
98
99
  :options="csvColumns"
99
- :placeholder="t(field.locale)"
100
+ :placeholder="getFieldLabel(field)"
101
+ :data-key="null"
100
102
  class="wt-upload-csv-popup-mapping-item__select"
101
103
  />
102
104
 
103
105
  <div
104
106
  v-if="field.tooltip"
105
- class="upload-tooltip"
107
+ class="upload-tooltip typo-caption"
106
108
  >
107
109
  {{ field.tooltip }}
108
110
  </div>
109
111
  </div>
110
112
  </div>
111
113
  </section>
112
-
113
- <div
114
- v-show="!isParsingPreview && parseErrorStackTrace"
115
- class="wt-upload-csv-popup-form__error-stack-trace"
116
- >
117
- {{ parseErrorStackTrace }}
118
- </div>
119
114
  </template>
120
115
 
121
116
  <template
@@ -143,7 +138,10 @@
143
138
  import { ref, toRefs } from 'vue';
144
139
  import { useI18n } from 'vue-i18n';
145
140
 
146
- import useUploadCsv from '../composable/useUploadCsv';
141
+ import useUploadCsv, {
142
+ type UseUploadCsvProps,
143
+ } from '../composable/useUploadCsv';
144
+ import type { CsvMappingField } from '../scripts/normalizeCSVData';
147
145
  import HandlingCSVMode from '../types/WtUploadCSVHandlingMode.enum';
148
146
 
149
147
  interface CharsetOption {
@@ -151,12 +149,9 @@ interface CharsetOption {
151
149
  value: string;
152
150
  }
153
151
 
154
- interface Props {
152
+ interface Props extends UseUploadCsvProps {
155
153
  file: File | null;
156
154
  mappingFields: CsvMappingField[];
157
- addBulkItems?: (items: unknown[]) => unknown | Promise<unknown>;
158
- handlingMode?: string;
159
- fileUploadHandler?: () => unknown | Promise<unknown>;
160
155
  }
161
156
 
162
157
  const props = withDefaults(defineProps<Props>(), {
@@ -173,6 +168,9 @@ const emit = defineEmits<{
173
168
 
174
169
  const { t } = useI18n();
175
170
 
171
+ const getFieldLabel = (field: CsvMappingField) =>
172
+ field.locale ? t(field.locale) : field.name;
173
+
176
174
  const skipHeaders = ref(true);
177
175
  const separator = ref(',');
178
176
  const charsetOptions = ref<CharsetOption[]>([]);
@@ -187,7 +185,6 @@ const {
187
185
  isReadingFile,
188
186
  isParsingCSV,
189
187
  isParsingPreview,
190
- parseErrorStackTrace,
191
188
  csvPreviewTableData,
192
189
  csvPreviewTableHeaders,
193
190
  csvColumns,
@@ -254,13 +251,5 @@ const {
254
251
  }
255
252
  }
256
253
  }
257
-
258
- .wt-upload-csv-popup-form__error-stack-trace {
259
- margin-top: var(--spacing-sm);
260
- padding: var(--spacing-sm);
261
- color: var(--error-color);
262
- border-radius: var(--border-radius);
263
- background: var(--secondary-color);
264
- }
265
254
  }
266
255
  </style>