project-booster-vue 9.62.3 → 9.63.0

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.62.3",
3
+ "version": "9.63.0",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -39,19 +39,18 @@ export default defineComponent({
39
39
 
40
40
  const appointmentFormUrl = computed(() => {
41
41
  const sessions = store.getters['appointmentQualification/getSessions'];
42
+ store.dispatch('appointmentQualification/getDynamicCalendarId');
42
43
  const currentAppointmentQualification =
43
44
  store.getters['appointmentQualification/getCurrentAppointmentQualification'];
44
45
  const currentUser = store.getters['inhabitants/getCurrentInhabitant'];
45
46
  const baseUrl = store.getters['appointmentQualification/getClicRDVBaseUrl'];
47
+ const calendarId = store.getters['appointmentQualification/getCalendarId'];
46
48
 
47
49
  let url = '';
48
- if (props.payload?.viewModel?.calendarUrlPath) {
49
- url = `${baseUrl}/${props.payload.viewModel.calendarUrlPath}?`;
50
- } else {
51
- url = `${baseUrl}/leroy-merlin-${sessions.storeId}`;
52
- url += `?calendar_id=${sessions.calendarId}`;
53
- url += `&vevent[str5]=${currentAppointmentQualification.inhabitantProjectId}`;
54
- }
50
+
51
+ url = `${baseUrl}/leroy-merlin-${sessions.storeId}`;
52
+ url += `?calendar_id=${calendarId}`;
53
+ url += `&vevent[str5]=${currentAppointmentQualification.inhabitantProjectId}`;
55
54
 
56
55
  if (currentUser) {
57
56
  url += `&fiche[email]=${currentUser.email}`;
@@ -48,7 +48,7 @@
48
48
  </div>
49
49
  </div>
50
50
 
51
- <m-modal :modalTitle="titleModal" :open="showModal" @update:open="showModal = false" class="m-pb-alert__dialog">
51
+ <m-modal :modalTitle="titleModal" :open="showModal" @update:open="handleCloseModal" class="m-pb-alert__dialog">
52
52
  <template #default>
53
53
  <div class="m-pb-alert__dialog__iframe">
54
54
  <iframe
@@ -63,7 +63,7 @@
63
63
  </div>
64
64
  </template>
65
65
  <template #footer>
66
- <m-button label="Fermer" @click.prevent="showModal = false" />
66
+ <m-button label="Fermer" @click.prevent="handleCloseModal" />
67
67
  </template>
68
68
  </m-modal>
69
69
  </div>
@@ -92,9 +92,14 @@ const props = defineProps({
92
92
  },
93
93
  });
94
94
 
95
+ const handleCloseModal = () => {
96
+ showModal.value = false;
97
+ srcModal.value = '';
98
+ };
99
+
95
100
  const handleShowModal = (option: any) => {
96
101
  if (option.viewModel.button.dialog) {
97
- showModal.value = !showModal.value;
102
+ showModal.value = true;
98
103
  titleModal.value = option.viewModel.title;
99
104
  srcModal.value = option.viewModel.button.dialog.src;
100
105
  } else if (option.viewModel.button.href) {
@@ -85,7 +85,6 @@ import { ScenarioStepAnswer } from '@/types/pb/Scenario';
85
85
 
86
86
  const emit = defineEmits(['go-back', 'step-completed']);
87
87
  const message = ref('');
88
- const currentIndex = ref(0);
89
88
 
90
89
  const props = defineProps({
91
90
  /**
@@ -119,18 +118,12 @@ const props = defineProps({
119
118
  */
120
119
  const callAction = (action: PayloadAction) => {
121
120
  if (action.code != '__BACK__') {
122
- let answers: any = [];
123
-
124
- if (message.value.length > 10) {
125
- answers = [
121
+ emit('step-completed', {
122
+ answers: [
126
123
  {
127
124
  message,
128
125
  },
129
- ];
130
- }
131
-
132
- emit('step-completed', {
133
- answers,
126
+ ],
134
127
  nextStep: action,
135
128
  });
136
129
  } else {
@@ -111,6 +111,7 @@
111
111
  },
112
112
  {
113
113
  "conditions": [
114
+ "isAnswerContaining('LMFR_QUESTION_WORKS', 'REPLACE_BATHTUB_TO_SHOWER')",
114
115
  "isAnswerContaining('LMFR_QUESTION_WORKS', 'REPLACE_BATHTUB_TO_SHOWER') && isAnswerContaining('LMFR_QUESTION_WORKS', 'FURNITURES')",
115
116
  "isAnswerContaining('LMFR_QUESTION_WORKS', 'REPLACE_BATHTUB_TO_SHOWER') && isAnswerContaining('LMFR_QUESTION_WORKS', 'WC')",
116
117
  "isAnswerContaining('LMFR_QUESTION_WORKS', 'REPLACE_BATHTUB_TO_SHOWER') && isAnswerContaining('LMFR_QUESTION_WORKS', 'COVERING_WALL')",
@@ -86,10 +86,26 @@ const linkInhabitantProjectToAppointmentQualification = async (data: any, inhabi
86
86
  );
87
87
  };
88
88
 
89
+ const getCalendarIdFromApi = async (storeId: string, appointmentType: string) => {
90
+ const response = await clientApi.get(
91
+ `/appointment-qualifications/contextualize?storeId=${storeId}&appointmentType=${appointmentType}?`,
92
+ {
93
+ headers: { 'Content-Type': 'application/json' },
94
+ },
95
+ );
96
+
97
+ return JSON.parse(
98
+ JSON.stringify(response.data).replace(/:"([^"]+)"/g, (match, $1) => {
99
+ return `: "${escape($1)}"`;
100
+ }),
101
+ );
102
+ };
103
+
89
104
  export {
90
105
  linkInhabitantProjectToAppointmentQualification,
91
106
  declarationsWithAppointment,
92
107
  saveAnswersByAppointmentQualificationId,
93
108
  getAppointmentQualification,
94
109
  declarationsWithoutAppointment,
110
+ getCalendarIdFromApi,
95
111
  };
@@ -4,6 +4,7 @@ import {
4
4
  declarationsWithAppointment,
5
5
  declarationsWithoutAppointment,
6
6
  linkInhabitantProjectToAppointmentQualification,
7
+ getCalendarIdFromApi,
7
8
  } from '../../services/api/appointmentQualificationsApi';
8
9
  import { sendAppointmentQualificationEvent, sendAppointmentQualificationAnswers } from '../../services/api/eventsApi';
9
10
  import { ActionContext } from 'vuex';
@@ -20,6 +21,7 @@ export interface AppointmentQualificationState {
20
21
  currentAppointmentQualification: any;
21
22
  sessions: any;
22
23
  isQualificationAborted: boolean;
24
+ calendarId: string;
23
25
  }
24
26
 
25
27
  type AppointmentQualificationContext = ActionContext<AppointmentQualificationState, State>;
@@ -38,6 +40,7 @@ export default {
38
40
  currentAppointmentQualification: {},
39
41
  sessions: {},
40
42
  isQualificationAborted: false,
43
+ calendarId: '',
41
44
  },
42
45
 
43
46
  getters: {
@@ -65,6 +68,9 @@ export default {
65
68
  isQualificationAborted(state: AppointmentQualificationState) {
66
69
  return state.isQualificationAborted;
67
70
  },
71
+ getCalendarId(state: AppointmentQualificationState) {
72
+ return state.calendarId;
73
+ },
68
74
  },
69
75
 
70
76
  mutations: {
@@ -92,6 +98,9 @@ export default {
92
98
  setIsQualificationAborted(state: AppointmentQualificationState, isQualificationAborted: boolean) {
93
99
  state.isQualificationAborted = isQualificationAborted;
94
100
  },
101
+ setCalendarId(state: AppointmentQualificationState, calendarId: string) {
102
+ state.calendarId = calendarId;
103
+ },
95
104
  },
96
105
 
97
106
  actions: {
@@ -215,5 +224,14 @@ export default {
215
224
  commit('setCurrentAppointmentQualification', null);
216
225
  }
217
226
  },
227
+ async getDynamicCalendarId({ commit, state }: AppointmentQualificationContext) {
228
+ try {
229
+ const type = state.sessions.appointmentQualificationFormStructure['__START__']?.meta?.webAnalytics.scenario;
230
+ const result = await getCalendarIdFromApi(state.sessions.storeId, type);
231
+ if (result) {
232
+ commit('setCalendarId', result.id);
233
+ }
234
+ } catch (e) {}
235
+ },
218
236
  },
219
237
  };