project-booster-vue 9.35.1 → 9.35.2

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.35.1",
3
+ "version": "9.35.2",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -97,6 +97,8 @@ export const answerGettersMappers: Map<string, (param: any) => void> = new Map<s
97
97
  return { width: parseFloat(width), length: parseFloat(length) };
98
98
  },
99
99
  PbListSelect: ({ value }: { value: string }): string => value,
100
+ PbCitySearch: ({ city }: { city: any }) => city.postalCode,
101
+ PbIncrementalAmountInput: ({ value }: { value: string }) => parseInt(value),
100
102
  }),
101
103
  );
102
104
 
@@ -229,7 +229,12 @@ export default defineComponent({
229
229
  this?.computedPayload?.defaultDecoratorValue,
230
230
  ),
231
231
  };
232
- this.searchKeyword = this?.selectedCity?.name;
232
+
233
+ if (this.selectedCity.postalCode == 'undefined') {
234
+ this.selectedCity = null;
235
+ } else {
236
+ this.searchKeyword = this.selectedCityToKeyword();
237
+ }
233
238
  this.forceHideSuggestions = true;
234
239
  }
235
240
 
@@ -344,8 +349,7 @@ export default defineComponent({
344
349
  region: selectedCity.address_components[2].short_name,
345
350
  };
346
351
 
347
- this.searchKeyword =
348
- this.selectedCity.postalCode + ' ' + this.selectedCity.name + ', ' + this.selectedCity.region;
352
+ this.searchKeyword = this.selectedCityToKeyword();
349
353
  this.$forceUpdate();
350
354
  }
351
355
  });
@@ -383,6 +387,9 @@ export default defineComponent({
383
387
  name: placeData.data[0].nom,
384
388
  };
385
389
  },
390
+ selectedCityToKeyword(): string {
391
+ return this.selectedCity?.postalCode + ' ' + this.selectedCity?.name + ', ' + this.selectedCity?.region;
392
+ },
386
393
  },
387
394
  });
388
395
  </script>
@@ -3,7 +3,6 @@ export interface IncrementalAmountValidation {
3
3
  maxValue: number;
4
4
  defaultValue: number;
5
5
  requiredErrorMessage: string;
6
- thresholdsIncluded: number;
7
6
  minValueErrorMessage: string;
8
7
  maxValueErrorMessage: string;
9
8
  }
@@ -11,7 +10,9 @@ export interface IncrementalAmountValidation {
11
10
  export interface IncrementalAmountViewModel {
12
11
  backLabel: string;
13
12
  label: string;
13
+ subtitle: string;
14
14
  actionLabel: string;
15
+ image: string;
15
16
  validation: IncrementalAmountValidation;
16
17
  minValue: number;
17
18
  maxValue: number;
@@ -20,5 +21,6 @@ export interface IncrementalAmountViewModel {
20
21
 
21
22
  export interface IncrementalAmountPayload {
22
23
  viewModel: IncrementalAmountViewModel;
24
+ value: { value: string };
23
25
  defaultDecoratorValue: string;
24
26
  }
@@ -40,7 +40,7 @@
40
40
 
41
41
  <m-flex class="pb-incremental-amount-input__body" justify-content="start" align-items="start">
42
42
  <m-quantity-selector
43
- :value="computedPayload.viewModel.defaultValue"
43
+ :value="quantitySelector"
44
44
  :valuemin="computedPayload.viewModel.minValue"
45
45
  :valuemax="computedPayload.viewModel.maxValue"
46
46
  @input="handleQuantitySelector"
@@ -74,10 +74,27 @@ import { ref } from 'vue';
74
74
  import { ScenarioStepAnswer } from '@/types/pb/Scenario';
75
75
  import { decorate } from '@/components/question/PbQuestion.vue';
76
76
  import MQuantitySelector from '../../mozaic/quantityselector/MQuantitySelector.vue';
77
+ import { IncrementalAmountPayload } from '@/components/question/incremental-amount-input/IncrementalAmount';
77
78
 
78
79
  const BACK_ICON =
79
80
  'https://storage.googleapis.com/project-booster-media/mozaic-icons/svg/Navigation_Arrow_Arrow--Left_16px.svg';
80
81
 
82
+ const computeDefaultValue = (
83
+ runtimeOptions: any,
84
+ answers: Map<string, ScenarioStepAnswer[]>,
85
+ computedPayload: ComputedRef<IncrementalAmountPayload>,
86
+ ) => {
87
+ let amount;
88
+ if (computedPayload?.value?.value) {
89
+ amount = decorate(
90
+ answers,
91
+ runtimeOptions,
92
+ computedPayload?.value?.value?.value,
93
+ computedPayload?.value?.defaultDecoratorValue,
94
+ );
95
+ }
96
+ return amount;
97
+ };
81
98
  export default defineComponent({
82
99
  name: 'PbIncrementalAmountInput',
83
100
  components: {
@@ -94,7 +111,7 @@ export default defineComponent({
94
111
  * from the default ones.
95
112
  */
96
113
  payload: {
97
- type: Object,
114
+ type: Object as PropType<IncrementalAmountPayload>,
98
115
  default: () => ({}),
99
116
  },
100
117
  /**
@@ -136,11 +153,17 @@ export default defineComponent({
136
153
  setup(props, { emit }) {
137
154
  const componentId = uuidv4();
138
155
  const computedPayload = computed(() => {
139
- const tempPayload = cloneDeep(DEFAULT_PAYLOAD);
140
- return merge(tempPayload, props.payload);
156
+ let tempPayload = cloneDeep(DEFAULT_PAYLOAD);
157
+ tempPayload = merge(tempPayload, props.payload);
158
+ tempPayload.viewModel.label = decorate(props.answers!, props.runtimeOptions, tempPayload.viewModel.label);
159
+ return tempPayload as IncrementalAmountPayload;
141
160
  });
142
161
  const pbIncrementalAmountInput = ref<HTMLElement>();
143
- let quantitySelector = props.payload.viewModel.defaultValue || props.defaultValue;
162
+
163
+ let quantitySelector = parseInt(computeDefaultValue(props.runtimeOptions, props.answers!, computedPayload)!);
164
+ if (!quantitySelector) {
165
+ quantitySelector = props.payload.viewModel.defaultValue || props.defaultValue;
166
+ }
144
167
 
145
168
  const handleFormSubmit = () => {
146
169
  emit(props.completedEventName, {