@webitel/ui-sdk 23.12.2 → 23.12.5-1

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 (191) hide show
  1. package/dist/favicon.ico +0 -0
  2. package/dist/img/sprite/index.js +148 -1
  3. package/dist/img/sprite/link.svg +8 -0
  4. package/dist/img/sprite/variable-select.svg +9 -0
  5. package/dist/plyr.svg +70 -0
  6. package/dist/ui-sdk.css +1 -1
  7. package/dist/ui-sdk.mjs +22670 -0
  8. package/dist/ui-sdk.umd.js +37 -43084
  9. package/package.json +34 -40
  10. package/src/api/axios/generateInstance.js +1 -1
  11. package/src/components/on-demand/wt-cc-agent-status-timers/wt-cc-agent-status-timers.vue +3 -3
  12. package/src/components/on-demand/wt-save-failed-popup/__tests__/WtPopup.spec.js +9 -0
  13. package/src/components/on-demand/wt-save-failed-popup/wt-save-failed-popup.vue +70 -0
  14. package/src/components/transitions/wt-expand-transition.vue +2 -2
  15. package/src/components/wt-app-header/_variables.scss +1 -1
  16. package/src/components/wt-app-header/wt-app-header.vue +2 -5
  17. package/src/components/wt-app-header/wt-app-navigator.vue +6 -5
  18. package/src/components/wt-app-header/wt-header-actions.vue +30 -14
  19. package/src/components/wt-avatar/_variables.scss +1 -1
  20. package/src/components/wt-avatar/wt-avatar.vue +2 -2
  21. package/src/components/wt-badge/wt-badge.vue +3 -3
  22. package/src/components/wt-button/_variables.scss +2 -32
  23. package/src/components/wt-button/wt-button.vue +5 -3
  24. package/src/components/wt-button-select/__tests__/WtButtonSelect.spec.js +9 -8
  25. package/src/components/wt-button-select/wt-button-select.vue +58 -59
  26. package/src/components/wt-checkbox/wt-checkbox.vue +15 -48
  27. package/src/components/wt-chip/_variables.scss +21 -2
  28. package/src/components/wt-chip/wt-chip.scss +20 -17
  29. package/src/components/wt-chip/wt-chip.vue +10 -5
  30. package/src/components/wt-context-menu/wt-context-menu.vue +4 -4
  31. package/src/components/wt-copy-action/wt-copy-action.vue +6 -6
  32. package/src/components/wt-datepicker/_variables.scss +1 -1
  33. package/src/components/wt-datepicker/wt-datepicker.vue +14 -12
  34. package/src/components/wt-divider/wt-divider.vue +1 -1
  35. package/src/components/wt-dummy/wt-dummy.vue +6 -2
  36. package/src/components/wt-error-page/wt-error-page.vue +10 -4
  37. package/src/components/wt-expansion-panel/wt-expansion-panel.vue +4 -4
  38. package/src/components/wt-filters-panel-wrapper/wt-filters-panel-wrapper.vue +7 -4
  39. package/src/components/wt-headline/wt-headline.vue +4 -4
  40. package/src/components/wt-headline-nav/_variables.scss +5 -2
  41. package/src/components/wt-headline-nav/wt-headline-nav.vue +46 -33
  42. package/src/components/wt-hint/wt-hint.vue +5 -6
  43. package/src/components/wt-icon/_variables.scss +5 -10
  44. package/src/components/wt-icon/wt-icon.vue +15 -6
  45. package/src/components/wt-icon-action/_internals/wt-add-icon-action.vue +2 -2
  46. package/src/components/wt-icon-action/_internals/wt-delete-icon-action.vue +2 -2
  47. package/src/components/wt-icon-action/_internals/wt-download-icon-action.vue +2 -2
  48. package/src/components/wt-icon-action/_internals/wt-edit-icon-action.vue +2 -2
  49. package/src/components/wt-icon-action/_internals/wt-history-icon-action.vue +2 -2
  50. package/src/components/wt-icon-action/_internals/wt-refresh-icon-action.vue +2 -2
  51. package/src/components/wt-icon-action/wt-icon-action.vue +1 -1
  52. package/src/components/wt-icon-btn/wt-icon-btn.vue +4 -2
  53. package/src/components/wt-indicator/_variables.scss +14 -19
  54. package/src/components/wt-indicator/wt-indicator.vue +26 -27
  55. package/src/components/wt-input/wt-input.vue +200 -219
  56. package/src/components/wt-input-info/wt-input-info.vue +2 -2
  57. package/src/components/wt-item-link/wt-item-link.vue +1 -1
  58. package/src/components/wt-label/_variables.scss +4 -2
  59. package/src/components/wt-label/wt-label.vue +5 -18
  60. package/src/components/wt-load-bar/wt-load-bar.vue +7 -4
  61. package/src/components/wt-loader/_internals/wt-loader--md.vue +11 -2
  62. package/src/components/wt-loader/_internals/wt-loader--sm.vue +9 -2
  63. package/src/components/wt-loader/_variables.scss +2 -2
  64. package/src/components/wt-loader/wt-loader.vue +10 -3
  65. package/src/components/wt-navigation-bar/wt-navigation-bar.vue +17 -9
  66. package/src/components/wt-notification/wt-notification.vue +4 -4
  67. package/src/components/wt-notifications-bar/wt-notifications-bar.vue +9 -5
  68. package/src/components/wt-page-header/wt-page-header.vue +7 -8
  69. package/src/components/wt-page-wrapper/wt-page-wrapper.vue +8 -5
  70. package/src/components/wt-pagination/wt-pagination.vue +17 -15
  71. package/src/components/wt-player/__tests__/WtPlayer.spec.js +1 -1
  72. package/src/components/wt-player/_variables.scss +1 -1
  73. package/src/components/wt-player/wt-player.vue +17 -17
  74. package/src/components/wt-popup/_variables.scss +4 -3
  75. package/src/components/wt-popup/wt-popup.vue +18 -10
  76. package/src/components/wt-progress-bar/_variables.scss +10 -8
  77. package/src/components/wt-progress-bar/wt-progress-bar.vue +27 -18
  78. package/src/components/wt-radio/wt-radio.vue +26 -54
  79. package/src/components/wt-rounded-action/_variables.scss +4 -35
  80. package/src/components/wt-rounded-action/wt-rounded-action.vue +15 -70
  81. package/src/components/wt-search-bar/__tests__/WtSearchBar.spec.js +1 -1
  82. package/src/components/wt-search-bar/wt-search-bar.vue +18 -42
  83. package/src/components/wt-select/_multiselect.scss +48 -53
  84. package/src/components/wt-select/_variables.scss +0 -3
  85. package/src/components/wt-select/mixins/multiselectMixin.js +9 -1
  86. package/src/components/wt-select/wt-select.vue +41 -40
  87. package/src/components/wt-slider/_variables.scss +6 -0
  88. package/src/components/wt-slider/wt-slider.vue +25 -9
  89. package/src/components/wt-status-select/_variables.scss +7 -4
  90. package/src/components/wt-status-select/wt-status-select.vue +18 -12
  91. package/src/components/wt-stepper/_variables.scss +5 -0
  92. package/src/components/wt-stepper/wt-stepper.vue +15 -9
  93. package/src/components/wt-switcher/_variables.scss +30 -7
  94. package/src/components/wt-switcher/wt-switcher.vue +56 -35
  95. package/src/components/wt-table/_variables.scss +8 -5
  96. package/src/components/wt-table/wt-table.vue +123 -90
  97. package/src/components/wt-table-actions/wt-table-actions.vue +14 -14
  98. package/src/components/wt-table-column-select/wt-table-column-select.vue +33 -28
  99. package/src/components/wt-tabs/_variables.scss +4 -4
  100. package/src/components/wt-tabs/wt-tabs.vue +15 -13
  101. package/src/components/wt-tags-input/wt-tags-input.vue +26 -35
  102. package/src/components/wt-textarea/wt-textarea.vue +37 -54
  103. package/src/components/wt-time-input/wt-time-input.vue +24 -54
  104. package/src/components/wt-timepicker/wt-timepicker.vue +19 -27
  105. package/src/components/wt-tooltip/__tests__/WtTooltip.spec.js +0 -10
  106. package/src/components/wt-tooltip/_internals/wt-tooltip-floating.vue +2 -2
  107. package/src/components/wt-tooltip/_variables.scss +2 -4
  108. package/src/components/wt-tooltip/wt-tooltip.vue +6 -18
  109. package/src/composables/useCachedInterval/__tests__/useCachedInterval.spec.js +5 -5
  110. package/src/composables/useRepresentableAgentPauseCause/__tests__/useRepresentableAgentPauseCause.spec.js +1 -1
  111. package/src/composables/useRepresentableAgentPauseCause/useRepresentableAgentPauseCause.js +1 -1
  112. package/src/css/styleguide/colors/_colors.scss +45 -29
  113. package/src/css/styleguide/colors/reusable/_text-field.scss +36 -0
  114. package/src/css/styleguide/placeholder/_placeholder.scss +9 -9
  115. package/src/enums/WebitelApplications/AdminSections.enum.js +2 -1
  116. package/src/locale/en/en.js +11 -3
  117. package/src/locale/es/es.js +2 -0
  118. package/src/locale/i18n.js +3 -1
  119. package/src/locale/kz/kz.js +327 -0
  120. package/src/locale/ru/ru.js +11 -3
  121. package/src/locale/ua/ua.js +11 -3
  122. package/src/mixins/validationMixin/__tests__/validationMixin.spec.js +2 -2
  123. package/src/mixins/validationMixin/useValidation.js +19 -4
  124. package/src/mixins/validationMixin/validationMixin.js +1 -0
  125. package/src/modules/AgentStatusSelect/components/__tests__/wt-cc-agent-status-select.spec.js +4 -4
  126. package/src/modules/AgentStatusSelect/components/_internals/wt-cc-pause-cause-popup.vue +11 -9
  127. package/src/modules/AgentStatusSelect/components/_internals/wt-cc-status-select-error-popup.vue +6 -5
  128. package/src/modules/AgentStatusSelect/components/wt-cc-agent-status-select.vue +3 -3
  129. package/src/modules/AuditForm/components/__tests__/audit-form.spec.js +1 -1
  130. package/src/modules/AuditForm/components/audit-form-question-read-wrapper.vue +11 -8
  131. package/src/modules/AuditForm/components/audit-form-question-write-wrapper.vue +8 -8
  132. package/src/modules/AuditForm/components/audit-form-question.vue +8 -8
  133. package/src/modules/AuditForm/components/audit-form.vue +6 -5
  134. package/src/modules/AuditForm/components/questions/options/audit-form-question-options-write-row.vue +4 -4
  135. package/src/modules/AuditForm/components/questions/options/audit-form-question-options.vue +7 -4
  136. package/src/modules/AuditForm/components/questions/score/audit-form-question-score.vue +3 -3
  137. package/src/modules/CSVExport/__tests__/CSVExport.spec.js +5 -2
  138. package/src/modules/DeleteConfirmationPopup/__tests__/delete-confirmation-popup.spec.js +77 -0
  139. package/src/modules/DeleteConfirmationPopup/components/delete-confirmation-popup.vue +35 -17
  140. package/src/modules/FilesExport/__tests__/FilesExport.spec.js +6 -3
  141. package/src/modules/FilesExport/scripts/generateMediaURL.js +1 -1
  142. package/src/modules/Filters/components/filter-pagination.vue +1 -1
  143. package/src/modules/Filters/components/filter-table-fields.vue +1 -1
  144. package/src/modules/Notifications/store/__tests__/NotificationsStoreModule.actions.spec.js +6 -6
  145. package/src/modules/QueryFilters/classes/__tests__/ApiFilterSchema.spec.js +1 -1
  146. package/src/modules/QueryFilters/components/__tests__/abstract-api-filter.spec.js +7 -5
  147. package/src/modules/QueryFilters/components/__tests__/abstract-enum-filter.spec.js +3 -1
  148. package/src/modules/QueryFilters/components/__tests__/filter-datetime.spec.js +2 -2
  149. package/src/modules/QueryFilters/components/__tests__/filter-from-to.spec.js +4 -4
  150. package/src/modules/QueryFilters/components/__tests__/filter-search.spec.js +2 -2
  151. package/src/modules/QueryFilters/components/abstract-api-filter.vue +2 -2
  152. package/src/modules/QueryFilters/components/abstract-enum-filter.vue +2 -2
  153. package/src/modules/QueryFilters/components/filter-datetime.vue +2 -2
  154. package/src/modules/QueryFilters/components/filter-from-to.vue +12 -10
  155. package/src/modules/QueryFilters/components/filter-search.vue +2 -2
  156. package/src/modules/QueryFilters/components/filter-table-fields.vue +7 -7
  157. package/src/modules/QueryFilters/mixins/__tests__/apiFilterMixin.spec.js +1 -1
  158. package/src/modules/QueryFilters/mixins/__tests__/enumFilterMixin.spec.js +2 -2
  159. package/src/modules/QueryFilters/mixins/__tests__/paginationFilterMixin.spec.js +2 -2
  160. package/src/modules/QueryFilters/mixins/__tests__/sortFilterMixin.spec.js +1 -1
  161. package/src/modules/QueryFilters/store/__tests__/QueryFiltersStoreModule.spec.js +2 -2
  162. package/src/modules/Userinfo/classes/ApplicationsAccess.js +6 -2
  163. package/src/modules/Userinfo/components/__tests__/auth.spec.js +7 -8
  164. package/src/modules/Userinfo/components/the-auth.vue +8 -5
  165. package/src/scripts/debounce.js +1 -1
  166. package/src/scripts/saveAsJSON.js +9 -0
  167. package/src/store/BaseStoreModules/__tests__/BaseStoreModule.spec.js +6 -6
  168. package/src/validators/variableSearchValidator/__tests__/variableSearchValidator.spec.js +48 -0
  169. package/src/validators/variableSearchValidator/variableSearchValidator.js +10 -0
  170. package/src/validators/websocketValidator/__tests__/websocketValidator.spec.js +28 -0
  171. package/src/validators/websocketValidator/websocketValidator.js +9 -0
  172. package/dist/demo.html +0 -1
  173. package/dist/ui-sdk.common.js +0 -43066
  174. package/dist/ui-sdk.common.js.map +0 -1
  175. package/dist/ui-sdk.umd.js.map +0 -1
  176. package/dist/ui-sdk.umd.min.js +0 -35
  177. package/dist/ui-sdk.umd.min.js.map +0 -1
  178. package/src/components/wt-button/Readme.md +0 -23
  179. package/src/components/wt-button-select/Readme.md +0 -13
  180. package/src/components/wt-icon/Readme.md +0 -327
  181. package/src/components/wt-icon/docs/cleanup-svg-fill-none.png +0 -0
  182. package/src/components/wt-icon/docs/cleanup-svg-fill.png +0 -0
  183. package/src/components/wt-icon/docs/cleanup-svg-viewbox-correct.png +0 -0
  184. package/src/components/wt-icon/docs/cleanup-svg-viewbox-incorrect.png +0 -0
  185. package/src/components/wt-icon/docs/cleanup-svg-width-height.png +0 -0
  186. package/src/components/wt-icon/docs/svg-icon-code-example.png +0 -0
  187. package/src/components/wt-icon/docs/svg-sprite-in-dom.png +0 -0
  188. package/src/components/wt-icon-btn/Readme.md +0 -10
  189. package/src/components/wt-rounded-action/Readme.md +0 -68
  190. package/src/components/wt-tags-input/_variables.scss +0 -24
  191. package/src/locale/.DS_Store +0 -0
@@ -6,7 +6,8 @@
6
6
  <wt-label
7
7
  class="filter-from-to__input-label"
8
8
  for="filter-from-to-from"
9
- >{{ $t('reusable.from') }}
9
+ >
10
+ {{ $t('reusable.from') }}
10
11
  </wt-label>
11
12
  <wt-input
12
13
  class="filter-from-to-input"
@@ -16,13 +17,14 @@
16
17
  :number-min="0"
17
18
  :number-max="numberMax"
18
19
  @input="setFrom"
19
- ></wt-input>
20
+ />
20
21
  </div>
21
22
  <div class="filter-from-to__input-wrapper">
22
23
  <wt-label
23
24
  class="filter-from-to__input-label"
24
25
  for="filter-from-to-to"
25
- >{{ $t('reusable.to') }}
26
+ >
27
+ {{ $t('reusable.to') }}
26
28
  </wt-label>
27
29
  <wt-input
28
30
  class="filter-from-to-input"
@@ -32,7 +34,7 @@
32
34
  :number-min="0"
33
35
  :number-max="numberMax"
34
36
  @input="setTo"
35
- ></wt-input>
37
+ />
36
38
  </div>
37
39
  </div>
38
40
  </div>
@@ -43,7 +45,7 @@ import debounce from '../../../scripts/debounce';
43
45
  import baseFilterMixin from '../mixins/baseFilterMixin/baseFilterMixin';
44
46
 
45
47
  export default {
46
- name: 'filter-from-to',
48
+ name: 'FilterFromTo',
47
49
  mixins: [baseFilterMixin],
48
50
  props: {
49
51
  filterQuery: {
@@ -57,6 +59,11 @@ export default {
57
59
  type: Number,
58
60
  },
59
61
  },
62
+
63
+ created() {
64
+ this.setFrom = debounce(this.setFrom);
65
+ this.setTo = debounce(this.setTo);
66
+ },
60
67
  methods: {
61
68
  restore() {
62
69
  this.restoreFrom();
@@ -97,11 +104,6 @@ export default {
97
104
  });
98
105
  },
99
106
  },
100
-
101
- created() {
102
- this.setFrom = debounce(this.setFrom);
103
- this.setTo = debounce(this.setTo);
104
- },
105
107
  };
106
108
  </script>
107
109
 
@@ -2,9 +2,9 @@
2
2
  <wt-search-bar
3
3
  :value="filterSchema.value"
4
4
  debounce
5
+ :placeholder="$t('reusable.search')"
5
6
  @input="setValue({ filter: filterQuery, value: $event })"
6
7
  @search="setValueToQuery({ filterQuery, value: $event })"
7
- :placeholder="$t('reusable.search')"
8
8
  />
9
9
  </template>
10
10
 
@@ -12,7 +12,7 @@
12
12
  import baseFilterMixin from '../mixins/baseFilterMixin/baseFilterMixin';
13
13
 
14
14
  export default {
15
- name: 'filter-search',
15
+ name: 'FilterSearch',
16
16
  mixins: [baseFilterMixin],
17
17
  props: {
18
18
  filterQuery: {
@@ -3,15 +3,20 @@
3
3
  :headers="headers"
4
4
  :static-headers="staticHeaders"
5
5
  @change="change"
6
- ></wt-table-column-select>
6
+ />
7
7
  </template>
8
8
 
9
9
  <script>
10
10
  import baseFilterMixin from '../mixins/baseFilterMixin/baseFilterMixin';
11
11
 
12
12
  export default {
13
- name: 'filter-table-fields',
13
+ name: 'FilterTableFields',
14
14
  mixins: [baseFilterMixin],
15
+
16
+ model: {
17
+ prop: 'headers',
18
+ event: 'change',
19
+ },
15
20
  props: {
16
21
  entity: {
17
22
  type: String,
@@ -31,11 +36,6 @@ export default {
31
36
  filterQuery: 'fields',
32
37
  }),
33
38
 
34
- model: {
35
- prop: 'headers',
36
- event: 'change',
37
- },
38
-
39
39
  methods: {
40
40
  change(headers) {
41
41
  this.setValue(headers);
@@ -12,7 +12,7 @@ const team = ['1', '2'];
12
12
  const filterSchema = new ApiFilterSchema();
13
13
 
14
14
  describe('API filter mixin', () => {
15
- const setValue = jest.fn();
15
+ const setValue = vi.fn();
16
16
  const Component = {
17
17
  render() {},
18
18
  mixins: [apiFilterMixin],
@@ -17,7 +17,7 @@ const router = createRouter({
17
17
  });
18
18
 
19
19
  describe('Enum filter mixin', () => {
20
- const setValue = jest.fn();
20
+ const setValue = vi.fn();
21
21
  const Component = {
22
22
  render() {
23
23
  },
@@ -53,7 +53,7 @@ describe('Enum filter mixin', () => {
53
53
 
54
54
  it('Attaches locales to options, if they have "locale" key', async () => {
55
55
  const options = [{
56
- locale: 'jest.locale',
56
+ locale: 'vi.locale',
57
57
  }];
58
58
  const expectedOptions = [{
59
59
  locale: options[0].locale,
@@ -11,8 +11,8 @@ const page = 2;
11
11
  const size = 20;
12
12
 
13
13
  describe('Pagination filter mixin', () => {
14
- const setPage = jest.fn();
15
- const setSize = jest.fn();
14
+ const setPage = vi.fn();
15
+ const setSize = vi.fn();
16
16
  let wrapper;
17
17
  const Component = {
18
18
  render() {},
@@ -32,7 +32,7 @@ const sortedHeaders = [{
32
32
  }];
33
33
 
34
34
  describe('Sort filter mixin', () => {
35
- const setHeaders = jest.fn();
35
+ const setHeaders = vi.fn();
36
36
  const Component = {
37
37
  render() {},
38
38
  mixins: [sortFilterMixin],
@@ -33,7 +33,7 @@ describe('QueryFiltersStoreModule getters', () => {
33
33
  });
34
34
  it('GET_FILTERS filters aggregator', () => {
35
35
  const { GET_FILTER } = module.getters;
36
- module.getters.GET_FILTER = jest.fn((filter) => GET_FILTER(state)(filter));
36
+ module.getters.GET_FILTER = vi.fn((filter) => GET_FILTER(state)(filter));
37
37
  expect(module.getters.GET_FILTERS(state, module.getters))
38
38
  .toEqual({ agent: [1], search: 'jest' });
39
39
  });
@@ -42,7 +42,7 @@ describe('QueryFiltersStoreModule getters', () => {
42
42
  describe('QueryFiltersStoreModule actions', () => {
43
43
  const context = {
44
44
  state: { ...state },
45
- commit: jest.fn(),
45
+ commit: vi.fn(),
46
46
  };
47
47
  const module = new QueryFiltersStoreModule().getModule();
48
48
  it('SET_FILTER: single value filter', () => {
@@ -135,6 +135,10 @@ const applicationsAccess = (value = true) => ({
135
135
  _enabled: value,
136
136
  _locale: `WebitelApplications.${WebitelApplications.ADMIN}.sections.${AdminSections.EMAIL_PROFILES}`,
137
137
  },
138
+ [AdminSections.SINGLE_SIGN_ON]: {
139
+ _enabled: value,
140
+ _locale: `WebitelApplications.${WebitelApplications.ADMIN}.sections.${AdminSections.SINGLE_SIGN_ON}`,
141
+ },
138
142
  [AdminSections.IMPORT_CSV]: {
139
143
  _enabled: value,
140
144
  _locale: `WebitelApplications.${WebitelApplications.ADMIN}.sections.${AdminSections.IMPORT_CSV}`,
@@ -155,9 +159,9 @@ const applicationsAccess = (value = true) => ({
155
159
  _enabled: value,
156
160
  _locale: `WebitelApplications.${WebitelApplications.ADMIN}.sections.${AdminSections.CHANGELOGS}`,
157
161
  },
158
- [AdminSections.SETTINGS]: {
162
+ [AdminSections.CONFIGURATION]: {
159
163
  _enabled: value,
160
- _locale: `WebitelApplications.${WebitelApplications.ADMIN}.sections.${AdminSections.SETTINGS}`,
164
+ _locale: `WebitelApplications.${WebitelApplications.ADMIN}.sections.${AdminSections.CONFIGURATION}`,
161
165
  },
162
166
  },
163
167
  [WebitelApplications.AUDIT]: {
@@ -1,7 +1,6 @@
1
1
  import { shallowMount } from '@vue/test-utils';
2
2
  import { createStore } from 'vuex';
3
3
  import { createRouter, createWebHistory } from 'vue-router';
4
- import JSDOM from 'jsdom';
5
4
  import authAPI from '../../api/auth';
6
5
  import userinfoAPI from '../../api/userinfo';
7
6
  import Auth from '../the-auth.vue';
@@ -11,19 +10,18 @@ import '../../../../../tests/mocks/localStorageMock';
11
10
 
12
11
  localStorage.setItem('access-token', 'jest');
13
12
 
14
- authAPI.setToken = jest.fn();
15
- userinfoAPI.getSession = jest.fn(() => ({}));
16
- userinfoAPI.getApplicationsAccess = jest.fn(() => ({}));
13
+ authAPI.setToken = vi.fn();
14
+ userinfoAPI.getSession = vi.fn(() => ({}));
15
+ userinfoAPI.getApplicationsAccess = vi.fn(() => ({}));
17
16
 
18
17
  describe('Auth', () => {
19
18
  let store;
20
19
  let wrapper;
21
- global.window = new JSDOM.JSDOM().window;
22
20
  const router = createRouter({
23
21
  history: createWebHistory(),
24
22
  routes: [],
25
23
  });
26
- router.replace = jest.fn();
24
+ router.replace = vi.fn();
27
25
 
28
26
  const userinfo = new UserinfoStoreModule().getModule();
29
27
  beforeEach(() => {
@@ -45,11 +43,12 @@ describe('Auth', () => {
45
43
  it('sets token, gets session and opens app after auth token message emit', async () => {
46
44
  const accessToken = 'hello there';
47
45
  window.postMessage({ accessToken }, '*');
48
- await setTimeout(() => {
46
+ await new Promise((resolve) => setTimeout(() => {
49
47
  expect(authAPI.setToken).toHaveBeenCalledWith(accessToken);
50
48
  expect(userinfoAPI.getSession).toHaveBeenCalled();
51
49
  expect(userinfoAPI.getApplicationsAccess).toHaveBeenCalled();
52
50
  expect(router.replace).toHaveBeenCalled();
53
- }, 100);
51
+ resolve();
52
+ }, 100));
54
53
  });
55
54
  });
@@ -1,7 +1,10 @@
1
1
  <template>
2
2
  <div class="auth-wrap">
3
- <div v-show="!isLoaded" class="auth-loader">
4
- <wt-loader/>
3
+ <div
4
+ v-show="!isLoaded"
5
+ class="auth-loader"
6
+ >
7
+ <wt-loader />
5
8
  </div>
6
9
  <iframe
7
10
  class="auth"
@@ -16,10 +19,10 @@
16
19
  <script>
17
20
  import AuthAPI from '../api/auth';
18
21
 
19
- const authURL = process.env.VUE_APP_AUTH_MODULE_URL;
22
+ const authURL = process ? process.env.VUE_APP_AUTH_MODULE_URL : import.meta.env.VITE_AUTH_MODE_URL;
20
23
 
21
24
  export default {
22
- name: 'auth',
25
+ name: 'Auth',
23
26
  props: {
24
27
  namespace: {
25
28
  type: String,
@@ -34,7 +37,7 @@ export default {
34
37
  mounted() {
35
38
  window.addEventListener('message', this.authMessageHandler, false);
36
39
  },
37
- destroyed() {
40
+ unmounted() {
38
41
  window.removeEventListener('message', this.authMessageHandler, false);
39
42
  },
40
43
 
@@ -1,4 +1,4 @@
1
- import lodashDebounce from 'lodash.debounce';
1
+ import lodashDebounce from 'lodash/debounce';
2
2
 
3
3
  const debounce = (fn, wait = 1000, options) => lodashDebounce(fn, wait, options);
4
4
 
@@ -0,0 +1,9 @@
1
+ import { saveAs } from 'file-saver';
2
+
3
+ const saveAsJSON = (name, content) => {
4
+ const fileName = name.replace(/[ ,]+/g, '-');
5
+ const file = new Blob([JSON.stringify(content, null, 4)], { type: 'application/json' });
6
+ saveAs(file, fileName);
7
+ };
8
+
9
+ export default saveAsJSON;
@@ -1,12 +1,12 @@
1
1
  import BaseStoreModule from '../BaseStoreModule';
2
2
 
3
3
  const APIModule = {
4
- getList: jest.fn(),
5
- get: jest.fn(),
6
- add: jest.fn(),
7
- update: jest.fn(),
8
- patch: jest.fn(),
9
- delete: jest.fn(),
4
+ getList: vi.fn(),
5
+ get: vi.fn(),
6
+ add: vi.fn(),
7
+ update: vi.fn(),
8
+ patch: vi.fn(),
9
+ delete: vi.fn(),
10
10
  };
11
11
 
12
12
  describe('Base Store Module', () => {
@@ -0,0 +1,48 @@
1
+ import variableSearchValidator from '../variableSearchValidator';
2
+
3
+ describe('Variable search validator', () => {
4
+ it('Ordinary search', () => {
5
+ const searchValue = 'height=100';
6
+ expect(variableSearchValidator(searchValue)).toBe(true);
7
+ });
8
+ it('Search with spacing in value and key', () => {
9
+ const searchValue = 'your height=5 feet 5½ inches (166 cm)';
10
+ expect(variableSearchValidator(searchValue)).toBe(true);
11
+ });
12
+ it('Search with spacing in value', () => {
13
+ const searchValue = 'height=5 feet 5½ inches (166 cm)';
14
+ expect(variableSearchValidator(searchValue)).toBe(true);
15
+ });
16
+ it('Search with spacing in value and spaces before key and after value', () => {
17
+ const searchValue = ' height=5 feet 5½ inches (166 cm) ';
18
+ expect(variableSearchValidator(searchValue)).toBe(true);
19
+ });
20
+ it('Search with snake_case', () => {
21
+ const searchValue = 'expected_output=valid_number';
22
+ expect(variableSearchValidator(searchValue)).toBe(true);
23
+ });
24
+ it('Wrong search with spacing after "=" sign', () => {
25
+ const searchValue = 'height= 100';
26
+ expect(variableSearchValidator(searchValue)).toBe(false);
27
+ });
28
+ it('Wrong search with spacing before "=" sign', () => {
29
+ const searchValue = 'height =100';
30
+ expect(variableSearchValidator(searchValue)).toBe(false);
31
+ });
32
+ it('Wrong search with spacing near "=" sign', () => {
33
+ const searchValue = 'height = 100';
34
+ expect(variableSearchValidator(searchValue)).toBe(false);
35
+ });
36
+ it('Space search', () => {
37
+ const searchValue = ' ';
38
+ expect(variableSearchValidator(searchValue)).toBe(false);
39
+ });
40
+ it('Empty search', () => {
41
+ const searchValue = '';
42
+ expect(variableSearchValidator(searchValue)).toBe(true);
43
+ });
44
+ it('Multiple "=" search', () => {
45
+ const searchValue = 'height=5 feet 5½ inches (166 cm), age=1231, fin=123231';
46
+ expect(variableSearchValidator(searchValue)).toBe(false);
47
+ });
48
+ });
@@ -0,0 +1,10 @@
1
+ export default function variableSearchValidator(input) {
2
+ if (input) {
3
+ const splitInput = input.split('=');
4
+ const [key, value] = splitInput;
5
+ if (key.endsWith(' ') || value.startsWith(' ') || splitInput.length !== 2) {
6
+ return false;
7
+ }
8
+ }
9
+ return true;
10
+ }
@@ -0,0 +1,28 @@
1
+ import websocketValidator from '../websocketValidator';
2
+
3
+ describe('websocketValidator', () => {
4
+ it('truthy case 1: localhost ws', () => {
5
+ expect(websocketValidator('ws://localhost:8080')).toBe(true);
6
+ });
7
+ it('truthy case 2: localhost wss', () => {
8
+ expect(websocketValidator('wss://localhost:8080')).toBe(true);
9
+ });
10
+ it('truthy case 3: ip ws', () => {
11
+ expect(websocketValidator('ws://10.10.10.10:8080')).toBe(true);
12
+ });
13
+ it('truthy case 4: dns name', () => {
14
+ expect(websocketValidator('wss://example.com')).toBe(true);
15
+ });
16
+ it('truthy case 5: dns name', () => {
17
+ expect(websocketValidator('wss://example')).toBe(true);
18
+ });
19
+ it('truthy case 6: dns name', () => {
20
+ expect(websocketValidator('wss://example.com/ws')).toBe(true);
21
+ });
22
+ it('truthy case 7: dns name', () => {
23
+ expect(websocketValidator('wss://socket.socket.com/v3/channel_123?api_key=123')).toBe(true);
24
+ });
25
+ it('falsy case 1: empty string', () => {
26
+ expect(websocketValidator('')).toBe(false);
27
+ });
28
+ });
@@ -0,0 +1,9 @@
1
+ // That's strange but i haven't found any npm package with websocket validator
2
+ export default (value) => {
3
+ try {
4
+ const url = new URL(value);
5
+ return (/^(wss?)/i).test(url.protocol);
6
+ } catch (e) {
7
+ return false;
8
+ }
9
+ };
package/dist/demo.html DELETED
@@ -1 +0,0 @@
1
- <!doctype html><meta charset="utf-8"><title>ui-sdk demo</title><script src="./ui-sdk.umd.js"></script><link rel="stylesheet" href="./ui-sdk.css"><script>console.log(ui-sdk)</script>