project-booster-vue 10.7.8 → 10.7.9
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
|
@@ -35,28 +35,24 @@ const props = defineProps({
|
|
|
35
35
|
|
|
36
36
|
const iframeUri = ref('https://book.timify.com/services?');
|
|
37
37
|
const store = useStore();
|
|
38
|
+
const showClicRDV = computed(() => store.getters['timify/getShowClicRDV']);
|
|
39
|
+
const getShowServices = computed(() => store.getters['timify/getShowServices']);
|
|
40
|
+
const getAccountId = computed(() => store.getters['timify/getAccountId']);
|
|
41
|
+
const projectId = computed(() => store.getters['appointmentQualification/getCurrentAppointmentQualification']);
|
|
42
|
+
const currentUser = computed(() => store.getters['inhabitants/getCurrentInhabitant']);
|
|
43
|
+
const collaboratorUri = computed(() => store.getters['timify/getCollaboratorUri']);
|
|
38
44
|
|
|
39
|
-
onBeforeMount(() => {
|
|
40
|
-
|
|
41
|
-
const showClicRDV = computed(() => store.getters['timify/getShowClicRDV']);
|
|
42
|
-
const getShowServices = computed(() => store.getters['timify/getShowServices']);
|
|
43
|
-
const getAccountId = computed(() => store.getters['timify/getAccountId']);
|
|
44
|
-
const currentUser = computed(() => store.getters['inhabitants/getCurrentInhabitant']);
|
|
45
|
-
const projectId = computed(() => store.getters['appointmentQualification/getCurrentAppointmentQualification']);
|
|
46
|
-
const collaboratorUri = computed(() => store.getters['timify/getCollaboratorUri']);
|
|
47
|
-
const metadata = computed(() => store.getters['metaData/metaData']);
|
|
48
|
-
|
|
49
|
-
store.dispatch('timify/loadTimify', {
|
|
50
|
-
appointmentCategory: props.payload.viewModel.appointmentCategory,
|
|
51
|
-
storeId: metadata.value.storeId || sessions.storeId,
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
store.dispatch('timify/loadCollaboratorUri', {
|
|
45
|
+
onBeforeMount(async () => {
|
|
46
|
+
await store.dispatch('timify/loadCollaboratorUri', {
|
|
55
47
|
projectId: projectId.value.inhabitantProjectId,
|
|
56
48
|
});
|
|
57
49
|
|
|
58
50
|
iframeUri.value += `accountId=${getAccountId.value}&showServices=${getShowServices.value}`;
|
|
59
|
-
|
|
51
|
+
if (currentUser.value) {
|
|
52
|
+
iframeUri.value += `&guestFirstName=${currentUser.value.firstname || ''}&guestLastName=${
|
|
53
|
+
currentUser.value.lastname || ''
|
|
54
|
+
}&guestEmail=${currentUser.value.email || ''}&guestPhone=${currentUser.value.phone || ''}`;
|
|
55
|
+
}
|
|
60
56
|
iframeUri.value += `&externalCustomerField[inhabitantProjectId]=${projectId.value.inhabitantProjectId}&externalCustomerField[collaboratorLink]=${collaboratorUri.value}&hideCloseButton=true`;
|
|
61
57
|
});
|
|
62
58
|
</script>
|
|
@@ -16,15 +16,18 @@ if ((<any>window).config) {
|
|
|
16
16
|
* @returns
|
|
17
17
|
*/
|
|
18
18
|
export const getTimifyObject = async (appointmentCategory: string, storeId: string) => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
JSON.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
19
|
+
try {
|
|
20
|
+
const { data, status } = await clientApi.get(
|
|
21
|
+
`/appointment-qualifications/timify/is-enabled?storeId=${storeId}&appointmentCategory=${appointmentCategory}`,
|
|
22
|
+
);
|
|
23
|
+
if (status == 200) {
|
|
24
|
+
return JSON.parse(
|
|
25
|
+
JSON.stringify(data).replace(/:"([^"]+)"/g, (match, $1) => {
|
|
26
|
+
return `: "${escape($1)}"`;
|
|
27
|
+
}),
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
} catch (error) {}
|
|
31
|
+
|
|
32
|
+
return null;
|
|
30
33
|
};
|
|
@@ -56,26 +56,22 @@ export default {
|
|
|
56
56
|
{ commit, state }: TimifyContext,
|
|
57
57
|
{ appointmentCategory, storeId }: { appointmentCategory: string; storeId: string },
|
|
58
58
|
) {
|
|
59
|
-
const
|
|
59
|
+
const data = await getTimifyObject(appointmentCategory, storeId.toString());
|
|
60
60
|
|
|
61
|
-
if (
|
|
62
|
-
if (data) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
commit('setShowServices', servicesIds.toString());
|
|
68
|
-
} else {
|
|
69
|
-
commit('setShowClicRDV', true);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (data.company) {
|
|
73
|
-
const accountId = data.company.id;
|
|
74
|
-
commit('setAccountId', accountId);
|
|
75
|
-
}
|
|
61
|
+
if (data) {
|
|
62
|
+
if (data.services.length) {
|
|
63
|
+
const servicesIds = data.services.map((service: TimifyServices) => {
|
|
64
|
+
return service.id;
|
|
65
|
+
});
|
|
66
|
+
commit('setShowServices', servicesIds.toString());
|
|
76
67
|
} else {
|
|
77
68
|
commit('setShowClicRDV', true);
|
|
78
69
|
}
|
|
70
|
+
|
|
71
|
+
if (data.company) {
|
|
72
|
+
const accountId = data.company.id;
|
|
73
|
+
commit('setAccountId', accountId);
|
|
74
|
+
}
|
|
79
75
|
} else {
|
|
80
76
|
commit('setShowClicRDV', true);
|
|
81
77
|
}
|