@webitel/ui-sdk 26.8.55 → 26.8.57

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 (41) hide show
  1. package/dist/clients-B8MJJx6E.js +39958 -0
  2. package/dist/{components-DNSY1_s4.js → components-BWyW5EEY.js} +3 -3
  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 +2088 -1976
  7. package/dist/{wt-call-media-action-Bn2bGCWs.js → wt-call-media-action-Bkyppnsm.js} +1 -1
  8. package/dist/{wt-chat-emoji-B13JscVZ.js → wt-chat-emoji-Cj3B8oR5.js} +1 -1
  9. package/dist/{wt-display-chip-items-Cf8L5Upd.js → wt-display-chip-items-Cvm5rOYr.js} +1 -1
  10. package/dist/{wt-screen-recordings-action-Dj6ITuhE.js → wt-screen-recordings-action-DI1qlUi1.js} +1 -1
  11. package/dist/{wt-send-message-popup-CO92UYST.js → wt-send-message-popup-OYvzhdyL.js} +2 -2
  12. package/dist/{wt-type-extension-value-input-FHQ4bN4j.js → wt-type-extension-value-input-BfUPxO-s.js} +2 -2
  13. package/dist/{wt-vidstack-player-DcItshB2.js → wt-vidstack-player-DjQEPOTu.js} +1 -1
  14. package/package.json +6 -2
  15. package/src/api/clients/caseSources/caseSources.ts +2 -151
  16. package/src/api/clients/quickReplies/quickReplies.ts +2 -157
  17. package/src/modules/QueryFilters/mixins/__tests__/enumFilterMixin.spec.js +60 -0
  18. package/src/modules/QueryFilters/mixins/enumFilterMixin.js +21 -6
  19. package/src/modules/UploadCsvPopup/components/__tests__/wt-upload-csv-popup.spec.js +32 -0
  20. package/src/modules/UploadCsvPopup/components/wt-upload-csv-popup.vue +15 -26
  21. package/src/modules/UploadCsvPopup/composable/__tests__/useUploadCsv.spec.js +393 -0
  22. package/src/modules/UploadCsvPopup/composable/useUploadCsv.ts +36 -19
  23. package/src/modules/UploadCsvPopup/index.ts +11 -0
  24. package/src/modules/UploadCsvPopup/scripts/__tests__/normalizeCSVData.spec.js +125 -0
  25. package/src/modules/UploadCsvPopup/scripts/__tests__/parseCSV.spec.js +63 -0
  26. package/src/modules/UploadCsvPopup/scripts/normalizeCSVData.ts +2 -0
  27. package/src/modules/UploadCsvPopup/scripts/parseCSV.ts +0 -23
  28. package/src/modules/UserNotifications/api/UserNotifications.ts +1 -1
  29. package/types/.tsbuildinfo +1 -1
  30. package/types/api/clients/caseSources/caseSources.d.ts +1 -16
  31. package/types/api/clients/quickReplies/quickReplies.d.ts +1 -16
  32. package/types/api/defaults/getDefaultInstance/getDefaultInstance.d.ts +1 -1
  33. package/types/modules/UploadCsvPopup/components/__tests__/wt-upload-csv-popup.spec.d.ts +1 -0
  34. package/types/modules/UploadCsvPopup/components/wt-upload-csv-popup.vue.d.ts +5 -5
  35. package/types/modules/UploadCsvPopup/composable/__tests__/useUploadCsv.spec.d.ts +1 -0
  36. package/types/modules/UploadCsvPopup/composable/useUploadCsv.d.ts +7 -3
  37. package/types/modules/UploadCsvPopup/index.d.ts +5 -0
  38. package/types/modules/UploadCsvPopup/scripts/__tests__/normalizeCSVData.spec.d.ts +1 -0
  39. package/types/modules/UploadCsvPopup/scripts/__tests__/parseCSV.spec.d.ts +1 -0
  40. package/types/modules/UploadCsvPopup/scripts/normalizeCSVData.d.ts +2 -0
  41. package/dist/clients-Ck0KwDIR.js +0 -39275
@@ -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-DNSY1_s4.js";
1
+ import "./components-BWyW5EEY.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-DNSY1_s4.js";
1
+ import { C as e, i as t } from "./components-BWyW5EEY.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 "./rolldown-runtime-BEcgMyyN.js";
2
- import { n as t, r as n } from "./clients-Ck0KwDIR.js";
3
- import { T as r, n as i, w as a } from "./components-DNSY1_s4.js";
2
+ import { n as t, r as n } from "./clients-B8MJJx6E.js";
3
+ import { T as r, n as i, w as a } from "./components-BWyW5EEY.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-Ck0KwDIR.js";
2
- import { a as t, o as n, r, s as i } from "./components-DNSY1_s4.js";
1
+ import { t as e } from "./clients-B8MJJx6E.js";
2
+ import { a as t, o as n, r, s as i } from "./components-BWyW5EEY.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-DNSY1_s4.js";
1
+ import { D as e } from "./components-BWyW5EEY.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.55",
3
+ "version": "26.8.57",
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*"
@@ -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';
@@ -103,4 +103,64 @@ describe('Enum filter mixin', () => {
103
103
  });
104
104
  expect(wrapper.vm.localizedOptions).toEqual(expectedOptions);
105
105
  });
106
+
107
+ it('Normalizes a snake_case scalar locale and translates using the normalized key', async () => {
108
+ const options = [
109
+ {
110
+ locale: 'vi.snake_case_locale',
111
+ },
112
+ ];
113
+ const expectedOptions = [
114
+ {
115
+ locale: 'vi.snakeCaseLocale',
116
+ name: 'vi.snakeCaseLocale',
117
+ },
118
+ ];
119
+ const wrapper = shallowMount(Component, {
120
+ global: {
121
+ plugins: [
122
+ router,
123
+ ],
124
+ },
125
+ data: () => ({
126
+ options,
127
+ }),
128
+ });
129
+ expect(wrapper.vm.localizedOptions).toEqual(expectedOptions);
130
+ });
131
+
132
+ it('Normalizes only the key element of an array locale, preserving the rest of the translation arguments, and translates using the normalized key', async () => {
133
+ const options = [
134
+ {
135
+ locale: [
136
+ 'vi.snake_case_locale',
137
+ {
138
+ count: 5,
139
+ },
140
+ ],
141
+ },
142
+ ];
143
+ const expectedOptions = [
144
+ {
145
+ locale: [
146
+ 'vi.snakeCaseLocale',
147
+ {
148
+ count: 5,
149
+ },
150
+ ],
151
+ name: 'vi.snakeCaseLocale',
152
+ },
153
+ ];
154
+ const wrapper = shallowMount(Component, {
155
+ global: {
156
+ plugins: [
157
+ router,
158
+ ],
159
+ },
160
+ data: () => ({
161
+ options,
162
+ }),
163
+ });
164
+ expect(wrapper.vm.localizedOptions).toEqual(expectedOptions);
165
+ });
106
166
  });
@@ -1,3 +1,4 @@
1
+ import { snakeToCamel } from '../../../scripts';
1
2
  import baseFilterMixin from './baseFilterMixin/baseFilterMixin.js';
2
3
 
3
4
  export default {
@@ -33,12 +34,26 @@ export default {
33
34
  localizedOptions() {
34
35
  const optsHaveLocale = this.options.length && this.options[0].locale; // just check 1st el
35
36
  if (optsHaveLocale) {
36
- return this.options.map((opt) => ({
37
- ...opt,
38
- name: Array.isArray(opt.locale)
39
- ? this.$t(...opt.locale)
40
- : this.$t(opt.locale),
41
- }));
37
+ return this.options.map((opt) => {
38
+ const isLocaleArray = Array.isArray(opt.locale);
39
+ const normalizedLocale = isLocaleArray
40
+ ? [
41
+ typeof opt.locale[0] === 'string'
42
+ ? snakeToCamel(opt.locale[0])
43
+ : opt.locale[0],
44
+ ...opt.locale.slice(1),
45
+ ]
46
+ : typeof opt.locale === 'string'
47
+ ? snakeToCamel(opt.locale)
48
+ : opt.locale;
49
+ return {
50
+ ...opt,
51
+ locale: normalizedLocale,
52
+ name: isLocaleArray
53
+ ? this.$t(...normalizedLocale)
54
+ : this.$t(normalizedLocale),
55
+ };
56
+ });
42
57
  }
43
58
  return this.options;
44
59
  },
@@ -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>