project-booster-vue 10.7.7 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "project-booster-vue",
3
- "version": "10.7.7",
3
+ "version": "10.7.9",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -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
- const sessions: any = computed(() => store.getters['appointmentQualification/getSessions']);
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
- iframeUri.value += `&guestFirstName=${currentUser.value.firstname}&guestLastName=${currentUser.value.lastname}&guestEmail=${currentUser.value.email}&guestPhone=${currentUser.value.phone}`;
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>
@@ -17,15 +17,17 @@ if ((<any>window).config) {
17
17
  */
18
18
  export const getTimifyObject = async (appointmentCategory: string, storeId: string) => {
19
19
  try {
20
- const response = await clientApi.get(
20
+ const { data, status } = await clientApi.get(
21
21
  `/appointment-qualifications/timify/is-enabled?storeId=${storeId}&appointmentCategory=${appointmentCategory}`,
22
22
  );
23
- return JSON.parse(
24
- JSON.stringify(response.data).replace(/:"([^"]+)"/g, (match, $1) => {
25
- return `: "${escape($1)}"`;
26
- }),
27
- );
28
- } catch (e) {
29
- return false;
30
- }
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;
31
33
  };
@@ -5,6 +5,10 @@ import { TimifyServices, TimifyState } from '@/types/pb/Timify';
5
5
 
6
6
  type TimifyContext = ActionContext<TimifyState, State>;
7
7
 
8
+ enum RequestStatus {
9
+ SUCCESS = 200,
10
+ }
11
+
8
12
  enum callboratorUris {
9
13
  prod = 'https://collaborators.pb-prod-adeo-disp.tech.adeo.cloud/index.html/projects/',
10
14
  prep = 'https://collaborators.pb-preprod-adeo-disp.tech.adeo.cloud/index.html/projects/',
@@ -52,11 +56,11 @@ export default {
52
56
  { commit, state }: TimifyContext,
53
57
  { appointmentCategory, storeId }: { appointmentCategory: string; storeId: string },
54
58
  ) {
55
- const timify = await getTimifyObject(appointmentCategory, storeId);
59
+ const data = await getTimifyObject(appointmentCategory, storeId.toString());
56
60
 
57
- if (timify) {
58
- if (timify.services.length) {
59
- const servicesIds = timify.services.map((service: TimifyServices) => {
61
+ if (data) {
62
+ if (data.services.length) {
63
+ const servicesIds = data.services.map((service: TimifyServices) => {
60
64
  return service.id;
61
65
  });
62
66
  commit('setShowServices', servicesIds.toString());
@@ -64,8 +68,8 @@ export default {
64
68
  commit('setShowClicRDV', true);
65
69
  }
66
70
 
67
- if (timify.company) {
68
- const accountId = timify.company.id;
71
+ if (data.company) {
72
+ const accountId = data.company.id;
69
73
  commit('setAccountId', accountId);
70
74
  }
71
75
  } else {