@webitel/ui-sdk 3.0.9 → 3.0.10

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": "3.0.9",
3
+ "version": "3.0.10",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve-lib": "vue-cli-service serve",
@@ -50,7 +50,7 @@
50
50
  "vue-observe-visibility": "^1.0.0",
51
51
  "vue-router": "^4.1.6",
52
52
  "vuejs-datepicker": "^1.6.2",
53
- "webitel-sdk": "^0.1.157"
53
+ "webitel-sdk": "^0.1.184"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@babel/eslint-parser": "^7.17.0",
@@ -1,6 +1,7 @@
1
1
  import { shallowMount } from '@vue/test-utils';
2
+ import { EngineAuditQuestionType } from 'webitel-sdk';
2
3
  import {
3
- generateQuestionOptionsSchema
4
+ generateQuestionOptionsSchema,
4
5
  } from '../../schemas/AuditFormQuestionOptionsSchema';
5
6
  import AuditFormQuestionWriteWrapper from '../audit-form-question-write-wrapper.vue';
6
7
  import { generateQuestionSchema } from '../../schemas/AuditFormQuestionSchema';
@@ -39,7 +40,7 @@ describe('AuditFormQuestionWriteWrapper', () => {
39
40
  },
40
41
  });
41
42
  wrapper.find('.audit-form-question-write-content-question')
42
- .findComponent({ name: 'wt-select' }).vm.$emit('input', { value: 'score' });
43
+ .findComponent({ name: 'wt-select' }).vm.$emit('input', { value: EngineAuditQuestionType.Score });
43
44
  expect(wrapper.emitted()['change:question'][0][0])
44
45
  .toEqual(generateQuestionScoreSchema());
45
46
  });
@@ -35,6 +35,7 @@
35
35
 
36
36
  <script setup>
37
37
  import { computed } from 'vue';
38
+ import { EngineAuditQuestionType } from 'webitel-sdk';
38
39
  import AuditFormQuestionOptions from './questions/audit-form-question-options.vue';
39
40
  import AuditFormQuestionScore from './questions/audit-form-question-score.vue';
40
41
  import WtIcon from '../../../components/atoms/wt-icon/wt-icon.vue';
@@ -60,8 +61,8 @@ const emit = defineEmits([
60
61
  ]);
61
62
 
62
63
  const QuestionTypeComponent = computed(() => {
63
- if (props.question.type === 'options') return AuditFormQuestionOptions;
64
- if (props.question.type === 'score') return AuditFormQuestionScore;
64
+ if (props.question.type === EngineAuditQuestionType.Option) return AuditFormQuestionOptions;
65
+ if (props.question.type === EngineAuditQuestionType.Score) return AuditFormQuestionScore;
65
66
  return null;
66
67
  });
67
68
  </script>
@@ -60,6 +60,7 @@
60
60
  import set from 'lodash/set';
61
61
  import cloneDeep from 'lodash/cloneDeep';
62
62
  import { computed } from 'vue';
63
+ import { EngineAuditQuestionType } from 'webitel-sdk';
63
64
  import WtTooltip from '../../../components/atoms/wt-tooltip/wt-tooltip.vue';
64
65
  import WtSwitcher from '../../../components/molecules/wt-switcher/wt-switcher.vue';
65
66
  import WtIconBtn from '../../../components/molecules/wt-icon-btn/wt-icon-btn.vue';
@@ -93,15 +94,15 @@ const emit = defineEmits([
93
94
  ]);
94
95
 
95
96
  const QuestionType = [
96
- { value: 'options', locale: 'webitelUI.auditForm.type.options' },
97
- { value: 'score', locale: 'webitelUI.auditForm.type.score' },
97
+ { value: EngineAuditQuestionType.Option, locale: 'webitelUI.auditForm.type.options' },
98
+ { value: EngineAuditQuestionType.Score, locale: 'webitelUI.auditForm.type.score' },
98
99
  ];
99
100
 
100
101
  const prettifiedQuestionType = computed(() => QuestionType.find(({ value }) => value === props.question.type));
101
102
 
102
103
  const QuestionTypeComponent = computed(() => {
103
- if (props.question.type === 'options') return AuditFormQuestionOptions;
104
- if (props.question.type === 'score') return AuditFormQuestionScore;
104
+ if (props.question.type === EngineAuditQuestionType.Option) return AuditFormQuestionOptions;
105
+ if (props.question.type === EngineAuditQuestionType.Score) return AuditFormQuestionScore;
105
106
  return null;
106
107
  });
107
108
 
@@ -112,9 +113,9 @@ function updateQuestion({ path, value }) {
112
113
 
113
114
  function handleQuestionTypeChange(type) {
114
115
  const question = cloneDeep(props.question);
115
- if (type === 'options') {
116
+ if (type === EngineAuditQuestionType.Option) {
116
117
  Object.assign(question, generateQuestionOptionsSchema());
117
- } else if (type === 'score') {
118
+ } else if (type === EngineAuditQuestionType.Score) {
118
119
  Object.assign(question, generateQuestionScoreSchema());
119
120
  }
120
121
  emit('change:question', question);
@@ -1,10 +1,12 @@
1
+ import { EngineAuditQuestionType } from 'webitel-sdk';
2
+
1
3
  export const generateOption = () => ({
2
4
  name: '',
3
5
  score: 10,
4
6
  });
5
7
 
6
8
  export const generateQuestionOptionsSchema = () => ({
7
- type: 'options',
9
+ type: EngineAuditQuestionType.Option,
8
10
  options: [
9
11
  generateOption(),
10
12
  ],
@@ -1,6 +1,8 @@
1
+ import { EngineAuditQuestionType } from 'webitel-sdk';
2
+
1
3
  // eslint-disable-next-line import/prefer-default-export
2
4
  export const generateQuestionScoreSchema = () => ({
3
- type: 'score',
5
+ type: EngineAuditQuestionType.Score,
4
6
  min: 1,
5
7
  max: 5,
6
8
  });