project-booster-vue 9.62.4 → 9.63.1
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 +1 -1
- package/src/components/appointment/PbAppointmentForm.vue +6 -7
- package/src/components/projects/project-hub/PbProjectHub.vue +2 -0
- package/src/components/projects/projects-list/PbProjectHub.vue +2 -0
- package/src/services/api/appointmentQualificationsApi.ts +16 -0
- package/src/stores/modules/appointmentQualificationStore.ts +18 -0
package/package.json
CHANGED
|
@@ -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
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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}`;
|
|
@@ -1052,6 +1052,8 @@ export default defineComponent({
|
|
|
1052
1052
|
KITCHEN_REMOTE: 'à distance',
|
|
1053
1053
|
BATHROOM_REMOTE: 'à distance',
|
|
1054
1054
|
BATHROOM_IN_STORE: 'en magasin',
|
|
1055
|
+
BATHROOM_AT_HOME: 'à domicile',
|
|
1056
|
+
BATHROOM_FURNITURES_AND_SHOWER: 'à distance',
|
|
1055
1057
|
})[this.appointment.appointmentType];
|
|
1056
1058
|
return `${prefix} le ${appointmenDateLabel} ${appointmentTypeLabel}`;
|
|
1057
1059
|
},
|
|
@@ -1052,6 +1052,8 @@ export default defineComponent({
|
|
|
1052
1052
|
KITCHEN_REMOTE: 'à distance',
|
|
1053
1053
|
BATHROOM_REMOTE: 'à distance',
|
|
1054
1054
|
BATHROOM_IN_STORE: 'en magasin',
|
|
1055
|
+
BATHROOM_AT_HOME: 'à domicile',
|
|
1056
|
+
BATHROOM_FURNITURES_AND_SHOWER: 'à distance',
|
|
1055
1057
|
})[this.appointment.appointmentType];
|
|
1056
1058
|
return `${prefix} le ${appointmenDateLabel} ${appointmentTypeLabel}`;
|
|
1057
1059
|
},
|
|
@@ -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
|
};
|