project-booster-vue 9.10.2 → 9.10.5

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.10.2",
3
+ "version": "9.10.5",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -71,7 +71,7 @@
71
71
  class="pb-estimates-list__show-more-button"
72
72
  theme="bordered"
73
73
  label="Voir plus"
74
- @click="$store.dispatch('estimates/loadEstimates')"
74
+ @click="$store.dispatch('estimates/loadMoreEstimates')"
75
75
  width="fit"
76
76
  :style="`transition-delay: ${showMoreButtonAnimationDelay}ms;`"
77
77
  />
@@ -79,7 +79,7 @@ export const TemplateSandbox = (args, { argTypes }) => {
79
79
  :show-more-button-label="args.showMoreButtonLabel"
80
80
  :padding="args.padding"
81
81
  :separator="args.separator"
82
- v-model="args.modelValue"
82
+ :model-value="args.modelValue"
83
83
  @click="args.click"
84
84
  @update:model-value="args.update"
85
85
  />`,
@@ -23,7 +23,7 @@
23
23
  :image="item.viewModel.image"
24
24
  :image-size="item.viewModel.imageSize"
25
25
  :selectable="selectType"
26
- v-model="selectedItems[item.code]"
26
+ :model-value="selectedItems.get(item.code)"
27
27
  :disabled="item.disabled"
28
28
  :padding="padding"
29
29
  :icon="icon"
@@ -203,7 +203,7 @@ export default defineComponent({
203
203
  }
204
204
  }
205
205
  selectedItems.value.set(code, value);
206
- emit('update:modelValue', selectedItems.value);
206
+ emit('update:modelValue', Object.fromEntries(selectedItems.value));
207
207
  };
208
208
  const handleClick = (event: Event) => {
209
209
  emit('click', event);
@@ -175,14 +175,14 @@ export default defineComponent({
175
175
  .filter((answer) => !!answer.selected)
176
176
  .map((answer) => ({ key: answer.code, value: answer.selected }));
177
177
  };
178
- const handleSelectionChange = (items: Item[]) => {
178
+ const handleSelectionChange = (items: Record<string, string | boolean>) => {
179
179
  selectedAnswers.value = Object.entries(items)
180
180
  .filter(([, value]) => !!value)
181
181
  .map(([key, value]) => ({ key, value }));
182
182
  Object.entries(items).map(([key, value]) => {
183
183
  displayedAnswers.value.map((answer) => {
184
184
  if (answer.code === key) {
185
- answer.selected = value.selected;
185
+ answer.selected = value;
186
186
  }
187
187
  });
188
188
  });
@@ -69,7 +69,7 @@ export const TemplateSandbox = (args, { argTypes }) => {
69
69
  store.dispatch('configurations/defineConfiguratorTypes', [DEFAULT_PAYLOAD.__START__.meta.configuratorType]);
70
70
  store.dispatch('configurations/searchConfigurations', '001');
71
71
  store.dispatch('inhabitants/loadInhabitant', '123456');
72
- store.dispatch('appointmentQualification/loadClicRDVBaseUrl');
72
+ store.dispatch('appointmentQualification/loadClicRDVBaseUrl', 'https://sandbox-user.clicrdv.com');
73
73
  store.dispatch('appointmentQualification/initSessions', {
74
74
  formId: 'appointment-qualification-kitchen',
75
75
  correlationId: uuidv4(),
@@ -195,9 +195,9 @@ export default {
195
195
  initSessions({ commit }: AppointmentQualificationContext, sessions: any) {
196
196
  commit('setSession', sessions);
197
197
  },
198
- loadClicRDVBaseUrl({ commit }: AppointmentQualificationContext) {
199
- if ((<any>window).config) {
200
- commit('setClicRDVBaseUrl', (<any>window).config.VUE_APP_CLICRDV_BASE_URL);
198
+ loadClicRDVBaseUrl({ commit }: AppointmentQualificationContext, baseUrl: string) {
199
+ if (baseUrl) {
200
+ commit('setClicRDVBaseUrl', baseUrl);
201
201
  } else {
202
202
  commit('setClicRDVBaseUrl', 'https://www.clicrdv.com');
203
203
  }
@@ -207,10 +207,12 @@ export default {
207
207
  },
208
208
  async loadEstimates({ commit, state }: EstimatesContext, projectId: string) {
209
209
  commit('setIsDisplayed', true);
210
+ commit('setEstimates', []);
210
211
  commit('setCurrentProjectId', projectId);
211
212
  commit('setIsLoadingEstimates', true);
212
213
  commit('setEstimatesLoadError', null);
213
214
  commit('setEstimateCreationError', null);
215
+ commit('setCurrentEstimatesPage', 0);
214
216
 
215
217
  try {
216
218
  const estimates = await getAllEstimates(state.currentEstimatesPage, state.estimatesPerPageCount, projectId);
@@ -235,6 +237,39 @@ export default {
235
237
  commit('setIsLoadingEstimates', false);
236
238
  });
237
239
  },
240
+ async loadMoreEstimates({ commit, state }: EstimatesContext) {
241
+ commit('setIsDisplayed', true);
242
+ commit('setIsLoadingEstimates', true);
243
+ commit('setEstimatesLoadError', null);
244
+ commit('setEstimateCreationError', null);
245
+
246
+ try {
247
+ const estimates = await getAllEstimates(
248
+ state.currentEstimatesPage,
249
+ state.estimatesPerPageCount,
250
+ state.currentProjectId!,
251
+ );
252
+
253
+ if (estimates.results) {
254
+ commit('addEstimates', estimates.results);
255
+ }
256
+
257
+ if (state?.estimates?.length >= estimates.total) {
258
+ commit('setHasStillEstimates', false);
259
+ } else {
260
+ commit('setHasStillEstimates', true);
261
+ }
262
+
263
+ commit('setCurrentEstimatesPage', state.currentEstimatesPage + 1);
264
+ } catch (error) {
265
+ console.error('Failure when loading estimates', error);
266
+ commit('setEstimatesLoadError', error);
267
+ }
268
+
269
+ setTimeout(() => {
270
+ commit('setIsLoadingEstimates', false);
271
+ });
272
+ },
238
273
  async saveEstimate({ commit }: EstimatesContext, estimateToCreate: Estimate) {
239
274
  commit('setIsCreatingEstimate', true);
240
275
  commit('setEstimateCreationError', null);
@@ -55,7 +55,7 @@ export interface ScenarioStepAnswerViewModel {
55
55
 
56
56
  export interface ScenarioStepAnswer {
57
57
  code: string;
58
- selected?: boolean;
58
+ selected?: boolean | string;
59
59
  viewModel?: ScenarioStepAnswerViewModel;
60
60
  conditions?: string[];
61
61
  nextStep?: ScenarioStepNextStep;