project-booster-vue 9.42.2 → 9.42.4

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": "project-booster-vue",
3
- "version": "9.42.2",
3
+ "version": "9.42.4",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -104,14 +104,14 @@ export default defineComponent({
104
104
  product: 'getCurrentProduct',
105
105
  refProduct: 'getRefProduct',
106
106
  }),
107
- ...mapGetters('appointmentQualification', {
108
- sessions: 'getSessions',
107
+ ...mapGetters('metaData', {
108
+ metadata: 'metaData',
109
109
  }),
110
110
  },
111
111
  created() {
112
112
  this.$store.dispatch('products/loadProduct', {
113
113
  payload: this.payload.viewModel.defaultProduct,
114
- sessions: this.sessions,
114
+ sessions: this.metadata.storeId || '',
115
115
  });
116
116
  },
117
117
  methods: {
@@ -90,6 +90,7 @@ export const answerGettersMappers: Map<string, (param: any) => void> = new Map<s
90
90
  Object.entries({
91
91
  PbQuestion: ({ code }: { code: string }): string => code,
92
92
  PbRestitution: ({ code }: { code: string }): string => code,
93
+ PbRestitutionList: ({ code }: { code: string }): string => code,
93
94
  PbConclusion: ({ code }: { code: string }): string => code,
94
95
  PbSpaceInput: ({ space }: { space: string }): number => parseFloat(space),
95
96
  PbNameInput: ({ projectName }: { projectName: string }): string => projectName,
@@ -107,7 +108,10 @@ function adaptAnswers(answers: Map<string, ScenarioStepAnswer[]>, scenario: Reco
107
108
 
108
109
  if (answers) {
109
110
  answers.forEach((value: ScenarioStepAnswer[], key: string) => {
110
- if (!['PbRestitution'].includes(scenario[key]?.component ?? '') && key !== 'SUBPROJECT_FORM_ID') {
111
+ if (
112
+ !['PbRestitution', 'PbRestitutionList'].includes(scenario[key]?.component ?? '') &&
113
+ key !== 'SUBPROJECT_FORM_ID'
114
+ ) {
111
115
  adaptedAnswers.push({
112
116
  questionId: key,
113
117
  answers: value.map(answerGettersMappers.get(scenario[key]?.component ?? '') ?? (() => undefined)),
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="pb-question__container" :style="`padding-bottom: calc(${stickyBottomOffset}px);`">
2
+ <div class="pb-question__container" :style="{ paddingBottom: `calc(${stickyBottomOffset}px)` }">
3
3
  <div class="pb-question">
4
4
  <m-flex align-items="center">
5
5
  <m-link
@@ -8,7 +8,7 @@
8
8
  :class="{
9
9
  'pb-question__back-button': true,
10
10
  'pb-question__back-button--hidden':
11
- !showBackButton && !decorate(answers, runtimeOptions, payload.viewModel.forceBackButton),
11
+ !showBackButton && !decorate(answers, runtimeOptions, payload?.viewModel?.forceBackButton),
12
12
  }"
13
13
  @click="navigateTo(payload.viewModel)"
14
14
  />
@@ -72,71 +72,73 @@
72
72
  :is="payload.viewModel.answersComponent"
73
73
  v-if="payload.viewModel.answersComponent !== 'MButton'"
74
74
  class="pb-question__answer__component"
75
- :border-top="answer.viewModel.borderColor || null"
76
- :image="decorate(answers, runtimeOptions, answer.viewModel.image, payload.defaultDecoratorValue)"
75
+ :border-top="answer?.viewModel?.borderColor || null"
76
+ :image="decorate(answers, runtimeOptions, answer?.viewModel?.image, payload.defaultDecoratorValue)"
77
77
  :image-title="
78
- decorate(answers, runtimeOptions, answer.viewModel.imageTitle, payload.defaultDecoratorValue)
78
+ decorate(answers, runtimeOptions, answer?.viewModel?.imageTitle, payload.defaultDecoratorValue)
79
79
  "
80
80
  :image-ratio="
81
- decorate(answers, runtimeOptions, answer.viewModel.imageRatio, payload.defaultDecoratorValue)
81
+ decorate(answers, runtimeOptions, answer?.viewModel?.imageRatio, payload.defaultDecoratorValue)
82
82
  "
83
83
  :flag-label="
84
- decorate(answers, runtimeOptions, answer.viewModel.flagLabel, payload.defaultDecoratorValue)
84
+ decorate(answers, runtimeOptions, answer?.viewModel?.flagLabel, payload.defaultDecoratorValue)
85
85
  "
86
- :hero="decorate(answers, runtimeOptions, answer.viewModel.hero, payload.defaultDecoratorValue)"
87
- :title="decorate(answers, runtimeOptions, answer.viewModel.title, payload.defaultDecoratorValue)"
88
- :text="decorate(answers, runtimeOptions, answer.viewModel.text, payload.defaultDecoratorValue)"
86
+ :hero="decorate(answers, runtimeOptions, answer?.viewModel?.hero, payload.defaultDecoratorValue)"
87
+ :title="decorate(answers, runtimeOptions, answer?.viewModel?.title, payload.defaultDecoratorValue)"
88
+ :text="decorate(answers, runtimeOptions, answer?.viewModel?.text, payload.defaultDecoratorValue)"
89
89
  :card-link="
90
- decorate(answers, runtimeOptions, answer.viewModel.cardLink, payload.defaultDecoratorValue)
90
+ decorate(answers, runtimeOptions, answer?.viewModel?.cardLink, payload.defaultDecoratorValue)
91
91
  "
92
92
  :button-label="
93
- decorate(answers, runtimeOptions, answer.viewModel.buttonLabel, payload.defaultDecoratorValue)
93
+ decorate(answers, runtimeOptions, answer?.viewModel?.buttonLabel, payload.defaultDecoratorValue)
94
+ "
95
+ :button-href="
96
+ decorate(answers, runtimeOptions, answer?.viewModel?.href, payload.defaultDecoratorValue)
94
97
  "
95
- :button-href="decorate(answers, runtimeOptions, answer.viewModel.href, payload.defaultDecoratorValue)"
96
98
  :link-label="
97
- decorate(answers, runtimeOptions, answer.viewModel.linkLabel, payload.defaultDecoratorValue)
99
+ decorate(answers, runtimeOptions, answer?.viewModel?.linkLabel, payload.defaultDecoratorValue)
98
100
  "
99
101
  :type-icon="
100
- decorate(answers, runtimeOptions, answer.viewModel.typeIcon, payload.defaultDecoratorValue)
102
+ decorate(answers, runtimeOptions, answer?.viewModel?.typeIcon, payload.defaultDecoratorValue)
101
103
  "
102
104
  :card-min-ratio="
103
- decorate(answers, runtimeOptions, answer.viewModel.cardMinRatio, payload.defaultDecoratorValue)
105
+ decorate(answers, runtimeOptions, answer?.viewModel?.cardMinRatio, payload.defaultDecoratorValue)
104
106
  "
105
107
  :align-vertical="
106
- decorate(answers, runtimeOptions, answer.viewModel.alignVertical, payload.defaultDecoratorValue)
108
+ decorate(answers, runtimeOptions, answer?.viewModel?.alignVertical, payload.defaultDecoratorValue)
107
109
  "
108
110
  :align-horizontal="
109
- decorate(answers, runtimeOptions, answer.viewModel.alignHorizontal, payload.defaultDecoratorValue)
111
+ decorate(answers, runtimeOptions, answer?.viewModel?.alignHorizontal, payload.defaultDecoratorValue)
110
112
  "
111
113
  :align-text="
112
- decorate(answers, runtimeOptions, answer.viewModel.alignText, payload.defaultDecoratorValue)
114
+ decorate(answers, runtimeOptions, answer?.viewModel?.alignText, payload.defaultDecoratorValue)
113
115
  "
114
116
  :selectable="!!payload.multiSelect"
115
117
  :selected="selectedAnswers.get(answer.code)"
116
118
  :disabled="isAnswerDisabled(answer)"
117
119
  :flattened="
118
- decorate(answers, runtimeOptions, answer.viewModel.flattened, payload.defaultDecoratorValue)
120
+ decorate(answers, runtimeOptions, answer?.viewModel?.flattened, payload.defaultDecoratorValue)
119
121
  "
120
- @card-click="answer.viewModel.href ? '' : selectAnswer(payload.code, answer)"
122
+ @card-click="answer?.viewModel?.href ? '' : selectAnswer(payload.code, answer)"
121
123
  @button-click="handleAnswerButtonClick"
122
124
  @link-click="handleLinkClick(answer)"
123
125
  />
124
126
  <m-button
125
127
  v-else
126
128
  :disabled="isAnswerDisabled(answer)"
127
- :label="decorate(answers, runtimeOptions, answer.viewModel.label, payload.defaultDecoratorValue)"
128
- :type="decorate(answers, runtimeOptions, answer.viewModel.type, payload.defaultDecoratorValue)"
129
- :theme="decorate(answers, runtimeOptions, answer.viewModel.theme, payload.defaultDecoratorValue)"
129
+ :label="decorate(answers, runtimeOptions, answer?.viewModel?.label, payload.defaultDecoratorValue)"
130
+ :type="decorate(answers, runtimeOptions, answer?.viewModel?.type, payload.defaultDecoratorValue)"
131
+ :theme="decorate(answers, runtimeOptions, answer?.viewModel?.theme, payload.defaultDecoratorValue)"
130
132
  :left-icon="
131
- decorate(answers, runtimeOptions, answer.viewModel.leftIcon, payload.defaultDecoratorValue)
133
+ decorate(answers, runtimeOptions, answer?.viewModel?.leftIcon, payload.defaultDecoratorValue)
132
134
  "
133
135
  :right-icon="
134
- decorate(answers, runtimeOptions, answer.viewModel.rightIcon, payload.defaultDecoratorValue)
136
+ decorate(answers, runtimeOptions, answer?.viewModel?.rightIcon, payload.defaultDecoratorValue)
135
137
  "
136
- :href="decorate(answers, runtimeOptions, answer.viewModel.href, payload.defaultDecoratorValue)"
137
- :width="decorate(answers, runtimeOptions, answer.viewModel.width, payload.defaultDecoratorValue)"
138
+ :href="decorate(answers, runtimeOptions, answer?.viewModel?.href, payload.defaultDecoratorValue)"
139
+ :width="decorate(answers, runtimeOptions, answer?.viewModel?.width, payload.defaultDecoratorValue)"
138
140
  :widthFromM="
139
- decorate(answers, runtimeOptions, answer.viewModel.widthFromM, payload.defaultDecoratorValue)
141
+ decorate(answers, runtimeOptions, answer?.viewModel?.widthFromM, payload.defaultDecoratorValue)
140
142
  "
141
143
  @click="selectAnswer(payload.code, answer)"
142
144
  />
@@ -148,7 +150,7 @@
148
150
  theme="bordered"
149
151
  class="pb-question__show-more-button"
150
152
  width="fit"
151
- :label="payload.viewModel.showMore.label"
153
+ :label="payload?.viewModel?.showMore?.label"
152
154
  @click="handleShowMoreClick()"
153
155
  />
154
156
  </m-flex>
@@ -206,7 +208,7 @@
206
208
  size="m"
207
209
  size-from-l="l"
208
210
  :label="payload.multiSelect.actions.VALIDATE.label"
209
- @click="validMultiSelect(payload.multiSelect.actions.VALIDATE)"
211
+ @click="validMultiSelect(payload?.multiSelect?.actions?.VALIDATE)"
210
212
  />
211
213
  </div>
212
214
  <div
@@ -221,16 +223,16 @@
221
223
  >
222
224
  <m-button
223
225
  v-for="button in skippables"
224
- :key="button.label"
226
+ :key="button?.label"
225
227
  class="pb-question__actions-buttons-button"
226
- :label="button.label"
227
- :theme="button.theme ? button.theme : 'bordered'"
228
- :right-icon="button.rightIcon"
229
- :left-icon="button.leftIcon"
228
+ :label="button?.label"
229
+ :theme="button?.theme ? button?.theme : 'bordered'"
230
+ :right-icon="button?.rightIcon"
231
+ :left-icon="button?.leftIcon"
230
232
  size="m"
231
233
  size-from-l="l"
232
- :width="button.width"
233
- :widthFromM="button.widthFromM"
234
+ :width="button?.width"
235
+ :widthFromM="button?.widthFromM"
234
236
  @click="skipQuestion(button)"
235
237
  />
236
238
  </div>
@@ -238,7 +240,7 @@
238
240
  </pb-sticky-footer>
239
241
  <m-container>
240
242
  <m-flexy
241
- v-if="payload.viewModel.decoratorStripe && payload.viewModel.decoratorStripe.length > 0"
243
+ v-if="payload.viewModel.decoratorStripe && Number(payload.viewModel.decoratorStripe.length) > 0"
242
244
  class="pb-question__decorator-stripe"
243
245
  >
244
246
  <m-flexy-col
@@ -287,8 +289,8 @@
287
289
  >
288
290
  <template #header v-if="helpDialog">
289
291
  <div class="pb-question__dialog-help__title">
290
- <h2>{{ helpDialog.viewModelDialog.headerTitle }}</h2>
291
- <p>{{ helpDialog.viewModelDialog.subTitle }}</p>
292
+ <h2>{{ helpDialog?.viewModelDialog.headerTitle }}</h2>
293
+ <p>{{ helpDialog?.viewModelDialog.subTitle }}</p>
292
294
  </div>
293
295
  </template>
294
296
  <template #body>
@@ -308,27 +310,27 @@
308
310
 
309
311
  <m-dialog class="pb-question__dialog" v-model:show-dialog="displayDialog">
310
312
  <template #header v-if="!displayVideo">
311
- <span>{{ dialog.headerTitle }}</span>
313
+ <span>{{ dialog?.headerTitle }}</span>
312
314
  </template>
313
315
  <template #body>
314
316
  <div class="pb-question__dialog-body" v-if="!displayVideo">
315
- <div :style="`background-image: url(${dialog.imageUrl});`" class="pb-question__dialog-body-image" />
317
+ <div :style="`background-image: url(${dialog?.imageUrl});`" class="pb-question__dialog-body-image" />
316
318
  <m-flex direction="column" class="pb-question__dialog-body-description">
317
- <div class="pb-question__dialog-body-title">{{ dialog.title }}</div>
318
- <div class="pb-question__dialog-body-text" v-html="dialog.text" />
319
+ <div class="pb-question__dialog-body-title">{{ dialog?.title }}</div>
320
+ <div class="pb-question__dialog-body-text" v-html="dialog?.text" />
319
321
  <m-button
320
322
  class="pb-question__dialog-body-button"
321
- :label="payload.viewModel.video.label"
322
- :theme="payload.viewModel.video.theme"
323
- :left-icon="payload.viewModel.video.icon"
323
+ :label="payload?.viewModel?.video?.label"
324
+ :theme="payload?.viewModel?.video?.theme"
325
+ :left-icon="payload?.viewModel?.video?.icon"
324
326
  width="fit"
325
- @click="displayVideoGuide(dialog.headerTitle)"
327
+ @click="displayVideoGuide(dialog?.headerTitle)"
326
328
  />
327
329
  </m-flex>
328
330
  </div>
329
331
  <iframe
330
332
  v-else
331
- :src="payload.viewModel.video.src"
333
+ :src="payload?.viewModel?.video?.src"
332
334
  class="pb-question__dialog-video-container"
333
335
  frameborder="0"
334
336
  allowfullscreen
@@ -491,7 +493,7 @@ export default defineComponent({
491
493
 
492
494
  watch: {
493
495
  payload() {
494
- this.questionPossibleAnswers = new Map<string, ScenarioStepAnswer>(Object.entries(this.payload.answers))!;
496
+ this.questionPossibleAnswers = new Map<string, ScenarioStepAnswer>(Object.entries(this.payload.answers));
495
497
  this.updatePbQuestionActionsButtonsSizeHeight();
496
498
  this.updateSelectedAnswers();
497
499
  },
@@ -630,7 +632,7 @@ export default defineComponent({
630
632
 
631
633
  return selectedAnswersNumber;
632
634
  },
633
- validMultiSelect(multiSelectOptions: ScenarioStepMultiSelectAction) {
635
+ validMultiSelect(multiSelectOptions: ScenarioStepMultiSelectAction | undefined) {
634
636
  const answers = [];
635
637
 
636
638
  for (const answerCode in Object.fromEntries(this.selectedAnswers)) {
@@ -641,14 +643,14 @@ export default defineComponent({
641
643
 
642
644
  this.$emit(this.completedEventName, {
643
645
  answers: answers,
644
- nextStep: multiSelectOptions.nextStep,
646
+ nextStep: multiSelectOptions?.nextStep,
645
647
  });
646
648
  },
647
- skipQuestion(button: ScenarioStepSkippableOptions) {
649
+ skipQuestion(button: ScenarioStepSkippableOptions | undefined) {
648
650
  this.initAnswersSelectedState(this.payload.answers);
649
651
  this.$emit(this.completedEventName, {
650
- answers: button.isAnswer ? (button.defaultAnswer ? [button.defaultAnswer] : []) : null,
651
- nextStep: button.nextStep,
652
+ answers: button?.isAnswer ? (button.defaultAnswer ? [button.defaultAnswer] : []) : null,
653
+ nextStep: button?.nextStep,
652
654
  });
653
655
  },
654
656
  resetMultiSelect(answers: Record<string, ScenarioStepAnswer>) {
@@ -759,7 +761,7 @@ export default defineComponent({
759
761
  },
760
762
  });
761
763
  },
762
- displayVideoGuide(origin: string) {
764
+ displayVideoGuide(origin: string | undefined) {
763
765
  this.displayDialog = true;
764
766
  this.displayVideo = true;
765
767
  this.$store.dispatch('sendEventToBus', {
@@ -203,30 +203,34 @@ export default defineComponent({
203
203
 
204
204
  if (this.computedPayload?.value) {
205
205
  this.selectedCity = {
206
- name: decorate(
207
- this.answers,
208
- this.runtimeOptions,
209
- this?.computedPayload?.value?.city?.name,
210
- this?.computedPayload?.defaultDecoratorValue,
211
- ),
212
- region: decorate(
213
- this.answers,
214
- this.runtimeOptions,
215
- this?.computedPayload?.value?.city?.region,
216
- this?.computedPayload?.defaultDecoratorValue,
217
- ),
218
- inseeCode: decorate(
219
- this.answers,
220
- this.runtimeOptions,
221
- this?.computedPayload?.value?.city?.inseeCode,
222
- this?.computedPayload?.defaultDecoratorValue,
223
- ),
224
- postalCode: decorate(
225
- this.answers,
226
- this.runtimeOptions,
227
- this?.computedPayload?.value?.city?.postalCode,
228
- this?.computedPayload?.defaultDecoratorValue,
229
- ),
206
+ name:
207
+ decorate(
208
+ this.answers,
209
+ this.runtimeOptions,
210
+ this?.computedPayload?.value?.city?.name,
211
+ this?.computedPayload?.defaultDecoratorValue,
212
+ ) || 'DEFAULT_CITY_NAME',
213
+ region:
214
+ decorate(
215
+ this.answers,
216
+ this.runtimeOptions,
217
+ this?.computedPayload?.value?.city?.region,
218
+ this?.computedPayload?.defaultDecoratorValue,
219
+ ) || 'DEFAULT_CITY_REGION',
220
+ inseeCode:
221
+ decorate(
222
+ this.answers,
223
+ this.runtimeOptions,
224
+ this?.computedPayload?.value?.city?.inseeCode,
225
+ this?.computedPayload?.defaultDecoratorValue,
226
+ ) || 'DEFAULT_CITY_INSEE_CODE',
227
+ postalCode:
228
+ decorate(
229
+ this.answers,
230
+ this.runtimeOptions,
231
+ this?.computedPayload?.value?.city?.postalCode,
232
+ this?.computedPayload?.defaultDecoratorValue,
233
+ ) || 'DEFAULT_CITY_POSTAL_CODE',
230
234
  };
231
235
 
232
236
  if (this.selectedCity.postalCode == 'undefined') {
@@ -169,14 +169,16 @@ export default defineComponent({
169
169
  let tempPayload = cloneDeep(DEFAULT_PAYLOAD);
170
170
  tempPayload = merge(tempPayload, props.payload);
171
171
 
172
- tempPayload.viewModel.label = decorate(props.answers!, props.runtimeOptions, tempPayload.viewModel.label);
173
- tempPayload.viewModel.subtitle = decorate(props.answers!, props.runtimeOptions, tempPayload.viewModel.subtitle);
172
+ tempPayload.viewModel.label =
173
+ decorate(props.answers, props.runtimeOptions, tempPayload.viewModel.label) || 'DEFAULT_LABEL';
174
+ tempPayload.viewModel.subtitle =
175
+ decorate(props.answers, props.runtimeOptions, tempPayload.viewModel.subtitle) || 'DEFAULT_SUBTITLE';
174
176
 
175
177
  return tempPayload as IncrementalAmountPayload;
176
178
  });
177
179
  const pbIncrementalAmountInput = ref<HTMLElement>();
178
180
 
179
- let subtitle = computeSubtitleValue(props.runtimeOptions, props.answers!, computedPayload)!;
181
+ let subtitle = computeSubtitleValue(props.runtimeOptions, props.answers, computedPayload);
180
182
  let quantitySelector = parseInt(computeDefaultValue(props.runtimeOptions, props.answers!, computedPayload)!);
181
183
  if (!quantitySelector) {
182
184
  quantitySelector = props.payload.viewModel.defaultValue || props.defaultValue;
@@ -150,6 +150,8 @@ import { ScenarioStepAnswer } from '@/types/pb/Scenario';
150
150
  import PbRestitutionListBlock from './PbRestitutionListBlock.vue';
151
151
  import { Project } from '../../types/pb/Project';
152
152
  import { areConditionsValid } from '../../services/scenarioConditionals';
153
+ const BACK_ICON =
154
+ 'https://storage.googleapis.com/project-booster-media/mozaic-icons/svg/Navigation_Arrow_Arrow--Left_16px.svg';
153
155
 
154
156
  export default defineComponent({
155
157
  components: {
@@ -273,7 +275,7 @@ export default defineComponent({
273
275
  answers: [],
274
276
  action: action,
275
277
  });
276
- } else if (action.code === 'SAVED_ITEM') {
278
+ } else if (action.withoutModal) {
277
279
  this.$emit('click-save-item', {
278
280
  answers: [],
279
281
  action: action,
@@ -16,9 +16,9 @@ import { ScenarioStepAnswer } from '@/types/pb/Scenario';
16
16
  export function decorate(
17
17
  answers: Map<string, ScenarioStepAnswer[]>,
18
18
  runtimeOptions = {},
19
- valueToDecorate: string,
19
+ valueToDecorate: string | undefined,
20
20
  defaultValue = '',
21
- ): string {
21
+ ): string | undefined {
22
22
  let decoratedValue = valueToDecorate;
23
23
  if (valueToDecorate) {
24
24
  const stringToEval = `\`${valueToDecorate}\``;
@@ -1,6 +1,6 @@
1
1
  // Issue with kobi rewriting the lib we extract the part that we need here
2
2
 
3
- const regexEscape: RegExp = /["&'<>`]/g;
3
+ const regexEscape = /["&'<>`]/g;
4
4
 
5
5
  const escapeMap: Record<string, string> = {
6
6
  '"': '&quot;',
@@ -19,7 +19,7 @@ const escapeMap: Record<string, string> = {
19
19
  '`': '&#x60;',
20
20
  };
21
21
 
22
- export const escape = (string: string) => {
22
+ export const escape = (string: string): string => {
23
23
  return string.replace(regexEscape, function ($0) {
24
24
  // Note: there is no need to check `has(escapeMap, $0)` here.
25
25
  return escapeMap[$0];
@@ -42,7 +42,7 @@ export const areConditionsValid = (
42
42
  conditions: boolean | string[],
43
43
  answers: Map<string, ScenarioStepAnswer[]>,
44
44
  runtimeOptions: Record<string, any>,
45
- ) => {
45
+ ): boolean => {
46
46
  let valid = true;
47
47
 
48
48
  if (conditions && conditions instanceof Array) {
@@ -51,7 +51,6 @@ export const areConditionsValid = (
51
51
  try {
52
52
  valid = valid || Condition(condition, answers, runtimeOptions).isValid;
53
53
  } catch (error) {
54
- console.error(error);
55
54
  valid = valid || true;
56
55
  }
57
56
  }
@@ -72,59 +72,59 @@ export const mediaDocumentsUploadStoreOptions = {
72
72
  uploadError: null,
73
73
  },
74
74
  getters: {
75
- getUploadProgress(state: MediaDocumentsState) {
75
+ getUploadProgress(state: MediaDocumentsState): number {
76
76
  return state.uploadProgress;
77
77
  },
78
- isUploading(state: MediaDocumentsState) {
78
+ isUploading(state: MediaDocumentsState): boolean {
79
79
  return state.isUploading;
80
80
  },
81
- isUploaded(state: MediaDocumentsState) {
81
+ isUploaded(state: MediaDocumentsState): boolean {
82
82
  return state.isUploaded;
83
83
  },
84
- getUploadedId(state: MediaDocumentsState) {
84
+ getUploadedId(state: MediaDocumentsState): string {
85
85
  return state.uploadedId;
86
86
  },
87
- getUploadError(state: MediaDocumentsState) {
87
+ getUploadError(state: MediaDocumentsState): Error {
88
88
  return state.uploadError;
89
89
  },
90
- isNameAlreadyUsed(state: MediaDocumentsState) {
90
+ isNameAlreadyUsed(state: MediaDocumentsState): boolean {
91
91
  return state.isNameAlreadyUsed;
92
92
  },
93
- getMediaCorrelationId(state: MediaDocumentsState) {
93
+ getMediaCorrelationId(state: MediaDocumentsState): string {
94
94
  return state.mediaCorrelationId;
95
95
  },
96
96
  },
97
97
  mutations: {
98
- setUploadProgress(state: MediaDocumentsState, uploadProgress: number) {
98
+ setUploadProgress(state: MediaDocumentsState, uploadProgress: number): void {
99
99
  state.uploadProgress = uploadProgress;
100
100
  },
101
- setIsUploading(state: MediaDocumentsState, isUploading: boolean) {
101
+ setIsUploading(state: MediaDocumentsState, isUploading: boolean): void {
102
102
  state.isUploading = isUploading;
103
103
  },
104
- setIsUploaded(state: MediaDocumentsState, isUploaded: boolean) {
104
+ setIsUploaded(state: MediaDocumentsState, isUploaded: boolean): void {
105
105
  state.isUploaded = isUploaded;
106
106
  },
107
- setUploadedId(state: MediaDocumentsState, uploadedId: string) {
107
+ setUploadedId(state: MediaDocumentsState, uploadedId: string): void {
108
108
  state.uploadedId = uploadedId;
109
109
  },
110
- setUploadError(state: MediaDocumentsState, uploadError: any) {
110
+ setUploadError(state: MediaDocumentsState, uploadError: Error): void {
111
111
  state.uploadError = uploadError;
112
112
  },
113
- setIsNameAlreadyUsed(state: MediaDocumentsState, isNameAlreadyUsed: boolean) {
113
+ setIsNameAlreadyUsed(state: MediaDocumentsState, isNameAlreadyUsed: boolean): void {
114
114
  state.isNameAlreadyUsed = isNameAlreadyUsed;
115
115
  },
116
- setMediaCorrelationId(state: MediaDocumentsState, mediaCorrelationId: string) {
116
+ setMediaCorrelationId(state: MediaDocumentsState, mediaCorrelationId: string): void {
117
117
  state.mediaCorrelationId = mediaCorrelationId;
118
118
  },
119
119
  setValidateFileData(
120
120
  state: MediaDocumentsState,
121
121
  validateFileData: { validation: MediaValidationErrors; imgData: MediaImageData },
122
- ) {
122
+ ): void {
123
123
  state.validateFileData = validateFileData;
124
124
  },
125
125
  },
126
126
  actions: {
127
- resetMediaUploadContext({ commit }: MediaDocumentsContext) {
127
+ resetMediaUploadContext({ commit }: MediaDocumentsContext): void {
128
128
  commit('setUploadProgress', 0);
129
129
  commit('setIsUploading', false);
130
130
  commit('setIsUploaded', false);
@@ -132,7 +132,10 @@ export const mediaDocumentsUploadStoreOptions = {
132
132
  commit('setIsNameAlreadyUsed', false);
133
133
  commit('setUploadedId', null);
134
134
  },
135
- async uploadFile({ commit, dispatch, state }: MediaDocumentsContext, uploadFile: MediaUploadOptions) {
135
+ async uploadFile(
136
+ { commit, dispatch, state }: MediaDocumentsContext,
137
+ uploadFile: MediaUploadOptions,
138
+ ): Promise<void> {
136
139
  dispatch('resetMediaUploadContext');
137
140
  commit('setIsUploading', true);
138
141
 
@@ -142,7 +145,7 @@ export const mediaDocumentsUploadStoreOptions = {
142
145
  const correlationId = state.mediaCorrelationId ?? uuidv4();
143
146
  try {
144
147
  commit('eventBusSendEvent', { code: 'interactedDocument', payload: {} }, { root: true });
145
- let response = await uploadDocument(
148
+ const response = await uploadDocument(
146
149
  uploadFile.formData,
147
150
  state.currentProjectId,
148
151
  correlationId,
@@ -165,7 +168,7 @@ export const mediaDocumentsUploadStoreOptions = {
165
168
  }
166
169
  commit('setIsUploading', false);
167
170
  },
168
- async sendEvent({ state, rootState }: MediaDocumentsContext, event: MediaEventOptions) {
171
+ async sendEvent({ state, rootState }: MediaDocumentsContext, event: MediaEventOptions): Promise<void> {
169
172
  let documentEvent: {
170
173
  name: string;
171
174
  businessUnit: string;
@@ -224,13 +227,13 @@ export const mediaDocumentsUploadStoreOptions = {
224
227
  }
225
228
  await sendDocumentsEvent(documentEvent);
226
229
  },
227
- validateFileData({ commit }: MediaDocumentsContext, validateFileData: boolean) {
230
+ validateFileData({ commit }: MediaDocumentsContext, validateFileData: boolean): void {
228
231
  commit('setValidateFileData', validateFileData);
229
232
  },
230
- generateCorrelationId({ commit }: MediaDocumentsContext) {
233
+ generateCorrelationId({ commit }: MediaDocumentsContext): void {
231
234
  commit('setMediaCorrelationId', uuidv4());
232
235
  },
233
- nameChanged({ commit }: MediaDocumentsContext) {
236
+ nameChanged({ commit }: MediaDocumentsContext): void {
234
237
  commit('setIsNameAlreadyUsed', false);
235
238
  },
236
239
  },
@@ -252,92 +255,89 @@ export const mediaDocumentsListStoreOptions = {
252
255
  mediumLoadError: null,
253
256
  },
254
257
  getters: {
255
- isDisplayed(state: MediaDocumentsState) {
258
+ isDisplayed(state: MediaDocumentsState): boolean {
256
259
  return state.isDisplayed;
257
260
  },
258
- getMediaList(state: MediaDocumentsState) {
261
+ getMediaList(state: MediaDocumentsState): Media[] {
259
262
  return state.mediaList;
260
263
  },
261
- getMediaPerPageCount(state: MediaDocumentsState) {
264
+ getMediaPerPageCount(state: MediaDocumentsState): number {
262
265
  return state.mediaPerPageCount;
263
266
  },
264
- getCurrentMediaPage(state: MediaDocumentsState) {
267
+ getCurrentMediaPage(state: MediaDocumentsState): number {
265
268
  return state.currentMediaPage;
266
269
  },
267
- hasStillMedia(state: MediaDocumentsState) {
270
+ hasStillMedia(state: MediaDocumentsState): boolean {
268
271
  return state.hasStillMedia;
269
272
  },
270
- isLoadingMedia(state: MediaDocumentsState) {
273
+ isLoadingMedia(state: MediaDocumentsState): boolean {
271
274
  return state.isLoadingMedia;
272
275
  },
273
- getMediaLoadError(state: MediaDocumentsState) {
276
+ getMediaLoadError(state: MediaDocumentsState): Error {
274
277
  return state.mediaLoadError;
275
278
  },
276
- getThumbnailUrl(state: MediaDocumentsState) {
279
+ getThumbnailUrl(state: MediaDocumentsState): string {
277
280
  return documentContext.thumbnailUrl.replace('@@PB_PROJECT_ID_FILLER@@', state.currentProjectId);
278
281
  },
279
- getMediaUrl(state: MediaDocumentsState) {
282
+ getMediaUrl(state: MediaDocumentsState): string {
280
283
  return documentContext.documentsUrl.replace('@@PB_PROJECT_ID_FILLER@@', state.currentProjectId);
281
284
  },
282
- getPublicMediaUrl(state: MediaDocumentsState) {
283
- return null;
284
- },
285
- isAddPhotoDisabled(state: MediaDocumentsState) {
285
+ isAddPhotoDisabled(state: MediaDocumentsState): boolean {
286
286
  return state.isAddPhotoDisabled;
287
287
  },
288
- getCurrentMedia(state: MediaDocumentsState) {
288
+ getCurrentMedia(state: MediaDocumentsState): Media {
289
289
  return state.currentMedia;
290
290
  },
291
- isLoadingMedium(state: MediaDocumentsState) {
291
+ isLoadingMedium(state: MediaDocumentsState): boolean {
292
292
  return state.isLoadingMedium;
293
293
  },
294
- getMediumLoadError(state: MediaDocumentsState) {
294
+ getMediumLoadError(state: MediaDocumentsState): Error {
295
295
  return state.mediumLoadError;
296
296
  },
297
297
  },
298
298
  mutations: {
299
- setIsDisplayed(state: MediaDocumentsState, isDisplayed: boolean) {
299
+ setIsDisplayed(state: MediaDocumentsState, isDisplayed: boolean): void {
300
300
  state.isDisplayed = isDisplayed;
301
301
  },
302
- setMediaList(state: MediaDocumentsState, mediaList: Media[]) {
302
+ setMediaList(state: MediaDocumentsState, mediaList: Media[]): void {
303
303
  state.mediaList = mediaList;
304
304
  },
305
- setMediaPerPageCount(state: MediaDocumentsState, mediaPerPageCount: number) {
305
+ setMediaPerPageCount(state: MediaDocumentsState, mediaPerPageCount: number): void {
306
306
  state.mediaPerPageCount = mediaPerPageCount;
307
307
  },
308
- addMedia(state: MediaDocumentsState, media: Media[]) {
308
+ addMedia(state: MediaDocumentsState, media: Media[]): void {
309
309
  state.mediaList.push(...media);
310
310
  },
311
- setHasStillMedia(state: MediaDocumentsState, hasStillMedia: boolean) {
311
+ setHasStillMedia(state: MediaDocumentsState, hasStillMedia: boolean): void {
312
312
  state.hasStillMedia = hasStillMedia;
313
313
  },
314
- setIsLoadingMedia(state: MediaDocumentsState, isLoadingMedia: boolean) {
314
+ setIsLoadingMedia(state: MediaDocumentsState, isLoadingMedia: boolean): void {
315
315
  state.isLoadingMedia = isLoadingMedia;
316
316
  },
317
- setCurrentMediaPage(state: MediaDocumentsState, currentMediaPage: number) {
317
+ setCurrentMediaPage(state: MediaDocumentsState, currentMediaPage: number): void {
318
318
  state.currentMediaPage = currentMediaPage;
319
319
  },
320
- setAddedMediaNumber(state: MediaDocumentsState, addedMediaNumber: number) {
320
+ setAddedMediaNumber(state: MediaDocumentsState, addedMediaNumber: number): void {
321
321
  state.addedMediaNumber = addedMediaNumber;
322
322
  },
323
- setIsAddPhotoDisabled(state: MediaDocumentsState, isAddPhotoDisabled: boolean) {
323
+ setIsAddPhotoDisabled(state: MediaDocumentsState, isAddPhotoDisabled: boolean): void {
324
324
  state.isAddPhotoDisabled = isAddPhotoDisabled;
325
325
  },
326
- setMediaLoadError(state: MediaDocumentsState, mediaLoadError: any) {
326
+ setMediaLoadError(state: MediaDocumentsState, mediaLoadError: Error): void {
327
327
  state.mediaLoadError = mediaLoadError;
328
328
  },
329
- setCurrentMedia(state: MediaDocumentsState, currentMedia: Media) {
329
+ setCurrentMedia(state: MediaDocumentsState, currentMedia: Media): void {
330
330
  state.currentMedia = currentMedia;
331
331
  },
332
- setIsLoadingMedium(state: MediaDocumentsState, isLoadingMedium: boolean) {
332
+ setIsLoadingMedium(state: MediaDocumentsState, isLoadingMedium: boolean): void {
333
333
  state.isLoadingMedium = isLoadingMedium;
334
334
  },
335
- setMediumLoadError(state: MediaDocumentsState, mediumLoadError: any) {
335
+ setMediumLoadError(state: MediaDocumentsState, mediumLoadError: Error): void {
336
336
  state.mediumLoadError = mediumLoadError;
337
337
  },
338
338
  },
339
339
  actions: {
340
- resetMediaListContext({ commit }: MediaDocumentsContext) {
340
+ resetMediaListContext({ commit }: MediaDocumentsContext): void {
341
341
  commit('setMediaList', []);
342
342
  commit('setIsLoadingMedia', false);
343
343
  commit('setCurrentMediaPage', 0);
@@ -348,11 +348,11 @@ export const mediaDocumentsListStoreOptions = {
348
348
  async loadMedium(
349
349
  { state, commit }: MediaDocumentsContext,
350
350
  { projectId, mediaId }: { projectId: string; mediaId: string },
351
- ) {
351
+ ): Promise<void> {
352
352
  commit('setIsLoadingMedium', true);
353
353
  commit('setMediumLoadError', false);
354
354
  try {
355
- let medium = await getDocumentById(projectId, mediaId);
355
+ const medium = await getDocumentById(projectId, mediaId);
356
356
  commit('setCurrentMedia', medium);
357
357
  } catch (err) {
358
358
  commit('setMediumLoadError', err);
@@ -360,7 +360,7 @@ export const mediaDocumentsListStoreOptions = {
360
360
  commit('setIsLoadingMedium', false);
361
361
  }
362
362
  },
363
- async getMedia({ commit, state }: MediaDocumentsContext, projectId: string) {
363
+ async getMedia({ commit, state }: MediaDocumentsContext, projectId: string): Promise<void> {
364
364
  commit('setCurrentProjectId', projectId);
365
365
  commit('setIsDisplayed', true);
366
366
  commit('setIsLoadingMedia', true);
@@ -373,7 +373,7 @@ export const mediaDocumentsListStoreOptions = {
373
373
  : (state.mediaPerPageCount - (state.mediaList.length % state.mediaPerPageCount)) % state.mediaPerPageCount;
374
374
  const mediaNumberToAdd = mediaNumberToAddOffset + state.mediaPerPageCount;
375
375
  const subType = state.context ? state.context.subType : undefined;
376
- let media = await getDocumentsByInhabitantProjectId(
376
+ const media = await getDocumentsByInhabitantProjectId(
377
377
  state.currentMediaPage * state.mediaPerPageCount,
378
378
  state.currentMediaPage * state.mediaPerPageCount + mediaNumberToAdd - 1,
379
379
  state.currentProjectId,
@@ -400,20 +400,20 @@ export const mediaDocumentsListStoreOptions = {
400
400
  commit('setIsLoadingMedia', false);
401
401
  }
402
402
  },
403
- async loadMedia({ commit, dispatch }: MediaDocumentsContext, projectId: string) {
403
+ async loadMedia({ commit, dispatch }: MediaDocumentsContext, projectId: string): Promise<void> {
404
404
  dispatch('resetMediaListContext');
405
405
  commit('setIsDisplayed', true);
406
406
  commit('setCurrentProjectId', projectId);
407
407
  dispatch('getMedia', projectId);
408
408
  },
409
- async loadMoreMedia({ commit, state, dispatch }: MediaDocumentsContext) {
409
+ async loadMoreMedia({ commit, state, dispatch }: MediaDocumentsContext): Promise<void> {
410
410
  commit('setCurrentMediaPage', state.currentMediaPage + 1);
411
411
  await dispatch('getMedia', state.currentProjectId);
412
412
  },
413
- async refreshMediaList({ commit, dispatch, state }: MediaDocumentsContext) {
413
+ async refreshMediaList({ commit, dispatch, state }: MediaDocumentsContext): Promise<void> {
414
414
  if (state.currentMediaPage > 0) {
415
415
  const subType = state.context ? state.context.subType : undefined;
416
- let media = await getDocumentsByInhabitantProjectId(
416
+ const media = await getDocumentsByInhabitantProjectId(
417
417
  0,
418
418
  state.currentMediaPage * state.mediaPerPageCount - 1,
419
419
  state.currentProjectId,
@@ -439,19 +439,19 @@ export const mediaDocumentsListStoreOptions = {
439
439
  async updateMediaName(
440
440
  { state, dispatch }: MediaDocumentsContext,
441
441
  { id: mediaId, name: mediaName }: { id: string; name: string },
442
- ) {
442
+ ): Promise<void> {
443
443
  await updateDocumentName(state.currentProjectId, mediaId, mediaName);
444
444
  dispatch('refreshMediaList');
445
445
  },
446
- async deleteMedia({ state, commit, dispatch }: MediaDocumentsContext, mediaToDelete: Media) {
446
+ async deleteMedia({ state, commit, dispatch }: MediaDocumentsContext, mediaToDelete: Media): Promise<void> {
447
447
  commit('eventBusSendEvent', { code: 'interactedDocument', payload: {} }, { root: true });
448
448
  await deleteDocument(state.currentProjectId, mediaToDelete.id);
449
449
  dispatch('refreshMediaList');
450
450
  },
451
- updateCurrentMedia({ commit }: MediaDocumentsContext, currentMedia: Media) {
451
+ updateCurrentMedia({ commit }: MediaDocumentsContext, currentMedia: Media): void {
452
452
  commit('setCurrentMedia', currentMedia);
453
453
  },
454
- updateMediaPerPageCount({ commit }: MediaDocumentsContext, mediaPerPageCount: number) {
454
+ updateMediaPerPageCount({ commit }: MediaDocumentsContext, mediaPerPageCount: number): void {
455
455
  commit('setMediaPerPageCount', mediaPerPageCount);
456
456
  },
457
457
  },
@@ -36,9 +36,9 @@ export default {
36
36
  updateRefProduct({ commit }: ProductContext, { ref }: { ref: string }) {
37
37
  commit('setRefProduct', ref);
38
38
  },
39
- async loadProduct({ commit, state }: ProductContext, { payload, sessions }: { payload: object; sessions: any }) {
39
+ async loadProduct({ commit, state }: ProductContext, { payload, storeId }: { payload: object; storeId: string }) {
40
40
  if (state.refProduct) {
41
- const product = await getProductById(state.refProduct, (sessions && sessions.storeId) || null);
41
+ const product = await getProductById(state.refProduct, storeId);
42
42
 
43
43
  if (product) {
44
44
  commit('setCurrentProduct', { ...payload, ...product });
@@ -31,8 +31,7 @@ export default {
31
31
  { payload, typeLead }: { payload: object; typeLead: string },
32
32
  ) => {
33
33
  if (typeLead) {
34
- const sendData = await sendTrezorForm(typeLead, payload);
35
- commit('setFormData', sendData);
34
+ return await sendTrezorForm(typeLead, payload);
36
35
  }
37
36
  },
38
37
  },
@@ -52,6 +52,7 @@ export interface RestitutionPayloadPriceBar {
52
52
  export interface RestitutionPayloadAction {
53
53
  type: string;
54
54
  code: string;
55
+ withoutModal?: any;
55
56
  component?: string;
56
57
  payload?: {
57
58
  link: string;
@@ -46,7 +46,23 @@ export interface ScenarioStepAnswerViewModel {
46
46
  flagLabel?: string;
47
47
  hero?: string;
48
48
  text?: string;
49
+ href?: string;
50
+ label?: string;
51
+ type?: string;
52
+ theme?: string;
53
+ rightIcon?: string;
54
+ leftIcon?: string;
55
+ width?: string;
56
+ widthFromM?: string;
57
+ borderColor?: string;
58
+ image?: string;
59
+ imageTitle?: string;
60
+ imageRatio?: string;
49
61
  buttonLabel?: string;
62
+ linkLabel?: string;
63
+ cardLink?: string;
64
+ typeIcon?: string;
65
+ flattened?: string;
50
66
  cardMinRatio?: string;
51
67
  alignVertical?: string;
52
68
  alignHorizontal?: string;
@@ -77,7 +93,8 @@ export interface ScenarioStepAnswer {
77
93
  export interface ScenarioStepDialog {
78
94
  viewModelDialog: {
79
95
  headerTitle: string;
80
- imageUrl?: string;
96
+ subTitle: string;
97
+ imgUrl?: string;
81
98
  };
82
99
  }
83
100
 
@@ -100,15 +117,45 @@ export interface ScenarioStepPayload {
100
117
  answers: Record<string, ScenarioStepAnswer>;
101
118
  skippable?: ScenarioStepSkippableOptions[];
102
119
  multiSelect?: ScenarioStepMultiSelectOptions;
120
+ defaultDecoratorValue?: string;
121
+ code?: string;
122
+ helpArea?: {
123
+ label: string;
124
+ type: string;
125
+ action: string;
126
+ };
103
127
  }
104
128
 
105
129
  export interface ScenarioStepViewModel {
106
130
  title?: string;
131
+ subtitle?: string;
107
132
  label?: string;
108
133
  answersComponent?: string;
134
+ hero?: string;
109
135
  backLink: string;
136
+ backLabel?: string;
137
+ forceBackButton?: string;
138
+ forceOneCardPerLineOnMobile?: boolean;
139
+ alwaysDisplaySkippable?: boolean;
140
+ decoratorStripe?: {
141
+ length: string;
142
+ };
143
+ video?: {
144
+ label: string;
145
+ theme?: string;
146
+ icon?: string;
147
+ };
148
+ videoBlock?: {
149
+ label?: string;
150
+ image?: string;
151
+ buttonLabel?: string;
152
+ icon?: string;
153
+ };
110
154
  sortBy?: ScenarioStepAnswerSortOptions;
111
155
  showMore?: ScenarioStepShowMoreOptions;
156
+ footer?: ScenarioStepFooterOptions;
157
+ widthFromM?: string;
158
+ widthFromL?: string;
112
159
  }
113
160
 
114
161
  export interface ScenarioStep {