project-booster-vue 10.7.7 → 10.7.8

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.8",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -16,16 +16,15 @@ if ((<any>window).config) {
16
16
  * @returns
17
17
  */
18
18
  export const getTimifyObject = async (appointmentCategory: string, storeId: string) => {
19
- try {
20
- const response = await clientApi.get(
21
- `/appointment-qualifications/timify/is-enabled?storeId=${storeId}&appointmentCategory=${appointmentCategory}`,
22
- );
23
- return JSON.parse(
24
- JSON.stringify(response.data).replace(/:"([^"]+)"/g, (match, $1) => {
19
+ const { data, status } = await clientApi.get(
20
+ `/appointment-qualifications/timify/is-enabled?storeId=${storeId}&appointmentCategory=${appointmentCategory}`,
21
+ );
22
+ return {
23
+ data: JSON.parse(
24
+ JSON.stringify(data).replace(/:"([^"]+)"/g, (match, $1) => {
25
25
  return `: "${escape($1)}"`;
26
26
  }),
27
- );
28
- } catch (e) {
29
- return false;
30
- }
27
+ ),
28
+ status,
29
+ };
31
30
  };
@@ -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,22 +56,26 @@ 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, status } = await getTimifyObject(appointmentCategory, storeId.toString());
60
+
61
+ if (status === RequestStatus.SUCCESS) {
62
+ if (data) {
63
+ if (data.services.length) {
64
+ const servicesIds = data.services.map((service: TimifyServices) => {
65
+ return service.id;
66
+ });
67
+ commit('setShowServices', servicesIds.toString());
68
+ } else {
69
+ commit('setShowClicRDV', true);
70
+ }
56
71
 
57
- if (timify) {
58
- if (timify.services.length) {
59
- const servicesIds = timify.services.map((service: TimifyServices) => {
60
- return service.id;
61
- });
62
- commit('setShowServices', servicesIds.toString());
72
+ if (data.company) {
73
+ const accountId = data.company.id;
74
+ commit('setAccountId', accountId);
75
+ }
63
76
  } else {
64
77
  commit('setShowClicRDV', true);
65
78
  }
66
-
67
- if (timify.company) {
68
- const accountId = timify.company.id;
69
- commit('setAccountId', accountId);
70
- }
71
79
  } else {
72
80
  commit('setShowClicRDV', true);
73
81
  }