project-booster-vue 10.7.10 → 10.7.12
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
|
@@ -49,8 +49,8 @@ onBeforeMount(async () => {
|
|
|
49
49
|
|
|
50
50
|
iframeUri.value += `accountId=${getAccountId.value}&showServices=${getShowServices.value}`;
|
|
51
51
|
if (currentUser.value) {
|
|
52
|
-
iframeUri.value += `&guestFirstName=${currentUser.value.
|
|
53
|
-
currentUser.value.
|
|
52
|
+
iframeUri.value += `&guestFirstName=${currentUser.value.firstName || ''}&guestLastName=${
|
|
53
|
+
currentUser.value.lastName || ''
|
|
54
54
|
}&guestEmail=${currentUser.value.email || ''}&guestPhone=${currentUser.value.phone || ''}`;
|
|
55
55
|
}
|
|
56
56
|
iframeUri.value += `&externalCustomerField[inhabitantProjectId]=${projectId.value.inhabitantProjectId}&externalCustomerField[collaboratorLink]=${collaboratorUri.value}&hideCloseButton=true&hideFilledFields=true`;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
2
|
import { escape } from '../../services/htmlEscape';
|
|
3
3
|
|
|
4
|
+
import { TimifyAppointmentCategory } from '@/types/pb/Timify';
|
|
5
|
+
|
|
4
6
|
export const clientApi = axios.create({
|
|
5
7
|
baseURL: '/project-booster/api',
|
|
6
8
|
});
|
|
@@ -15,11 +17,15 @@ if ((<any>window).config) {
|
|
|
15
17
|
* @param storeId
|
|
16
18
|
* @returns
|
|
17
19
|
*/
|
|
18
|
-
export const
|
|
20
|
+
export const getTimifyAppointmentCategory = async (
|
|
21
|
+
appointmentCategory: string,
|
|
22
|
+
storeId: string,
|
|
23
|
+
): Promise<TimifyAppointmentCategory | null> => {
|
|
19
24
|
try {
|
|
20
25
|
const { data, status } = await clientApi.get(
|
|
21
26
|
`/appointment-qualifications/timify/is-enabled?storeId=${storeId}&appointmentCategory=${appointmentCategory}`,
|
|
22
27
|
);
|
|
28
|
+
|
|
23
29
|
if (status == 200) {
|
|
24
30
|
return JSON.parse(
|
|
25
31
|
JSON.stringify(data).replace(/:"([^"]+)"/g, (match, $1) => {
|
|
@@ -27,7 +33,9 @@ export const getTimifyObject = async (appointmentCategory: string, storeId: stri
|
|
|
27
33
|
}),
|
|
28
34
|
);
|
|
29
35
|
}
|
|
30
|
-
} catch (error) {
|
|
36
|
+
} catch (error) {
|
|
37
|
+
console.error("Can't get Timify appointment category", error);
|
|
38
|
+
}
|
|
31
39
|
|
|
32
40
|
return null;
|
|
33
41
|
};
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import { ActionContext } from 'vuex';
|
|
2
2
|
import { State } from '@/stores/state';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { getTimifyAppointmentCategory } from '@/services/api/timifyApi';
|
|
4
|
+
import { TimifyAppointmentCategory, TimifyService, TimifyState } from '@/types/pb/Timify';
|
|
5
5
|
|
|
6
6
|
type TimifyContext = ActionContext<TimifyState, State>;
|
|
7
7
|
|
|
8
|
-
enum RequestStatus {
|
|
9
|
-
SUCCESS = 200,
|
|
10
|
-
}
|
|
11
|
-
|
|
12
8
|
enum callboratorUris {
|
|
13
|
-
prod = 'https://collaborators.pb-prod-adeo-disp.tech.adeo.cloud/index.html
|
|
14
|
-
prep = 'https://collaborators.pb-preprod-adeo-disp.tech.adeo.cloud/index.html
|
|
15
|
-
dev = 'https://collaborators.pb-dev-adeo-disp.tech.adeo.cloud/index.html
|
|
9
|
+
prod = 'https://collaborators.pb-prod-adeo-disp.tech.adeo.cloud/index.html#/projects/',
|
|
10
|
+
prep = 'https://collaborators.pb-preprod-adeo-disp.tech.adeo.cloud/index.html#/projects/',
|
|
11
|
+
dev = 'https://collaborators.pb-dev-adeo-disp.tech.adeo.cloud/index.html#/projects/',
|
|
16
12
|
}
|
|
17
13
|
|
|
18
14
|
export default {
|
|
@@ -24,43 +20,46 @@ export default {
|
|
|
24
20
|
showClicRDV: false,
|
|
25
21
|
},
|
|
26
22
|
getters: {
|
|
27
|
-
getShowServices(state: TimifyState) {
|
|
23
|
+
getShowServices(state: TimifyState): string[] {
|
|
28
24
|
return state.showServices;
|
|
29
25
|
},
|
|
30
|
-
getAccountId(state: TimifyState) {
|
|
26
|
+
getAccountId(state: TimifyState): string {
|
|
31
27
|
return state.accountId;
|
|
32
28
|
},
|
|
33
|
-
getCollaboratorUri(state: TimifyState) {
|
|
29
|
+
getCollaboratorUri(state: TimifyState): string {
|
|
34
30
|
return state.collaboratorUri;
|
|
35
31
|
},
|
|
36
|
-
getShowClicRDV(state: TimifyState) {
|
|
32
|
+
getShowClicRDV(state: TimifyState): boolean {
|
|
37
33
|
return state.showClicRDV;
|
|
38
34
|
},
|
|
39
35
|
},
|
|
40
36
|
mutations: {
|
|
41
|
-
setShowServices(state: TimifyState, services: string[]) {
|
|
37
|
+
setShowServices(state: TimifyState, services: string[]): void {
|
|
42
38
|
state.showServices = services;
|
|
43
39
|
},
|
|
44
|
-
setAccountId(state: TimifyState, accountId: string) {
|
|
40
|
+
setAccountId(state: TimifyState, accountId: string): void {
|
|
45
41
|
state.accountId = accountId;
|
|
46
42
|
},
|
|
47
|
-
setCollaboratorUri(state: TimifyState, collaboratorUri: string) {
|
|
43
|
+
setCollaboratorUri(state: TimifyState, collaboratorUri: string): void {
|
|
48
44
|
state.collaboratorUri = collaboratorUri;
|
|
49
45
|
},
|
|
50
|
-
setShowClicRDV(state: TimifyState, showClicRDV: boolean) {
|
|
46
|
+
setShowClicRDV(state: TimifyState, showClicRDV: boolean): void {
|
|
51
47
|
state.showClicRDV = showClicRDV;
|
|
52
48
|
},
|
|
53
49
|
},
|
|
54
50
|
actions: {
|
|
55
51
|
async loadTimify(
|
|
56
|
-
{ commit
|
|
52
|
+
{ commit }: TimifyContext,
|
|
57
53
|
{ appointmentCategory, storeId }: { appointmentCategory: string; storeId: string },
|
|
58
|
-
) {
|
|
59
|
-
const data = await
|
|
54
|
+
): Promise<void> {
|
|
55
|
+
const data: TimifyAppointmentCategory | null = await getTimifyAppointmentCategory(
|
|
56
|
+
appointmentCategory,
|
|
57
|
+
storeId.toString(),
|
|
58
|
+
);
|
|
60
59
|
|
|
61
60
|
if (data) {
|
|
62
61
|
if (data.services.length) {
|
|
63
|
-
const servicesIds = data.services.map((service:
|
|
62
|
+
const servicesIds = data.services.map((service: TimifyService) => {
|
|
64
63
|
return service.id;
|
|
65
64
|
});
|
|
66
65
|
commit('setShowServices', servicesIds.toString());
|
|
@@ -76,7 +75,8 @@ export default {
|
|
|
76
75
|
commit('setShowClicRDV', true);
|
|
77
76
|
}
|
|
78
77
|
},
|
|
79
|
-
|
|
78
|
+
|
|
79
|
+
async loadCollaboratorUri({ commit }: TimifyContext, { projectId }: { projectId: string }): Promise<void> {
|
|
80
80
|
const baseurl = window.location.host;
|
|
81
81
|
|
|
82
82
|
if (baseurl.includes('prep')) {
|
package/src/types/pb/Timify.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
export interface TimifyAppointmentCategory {
|
|
2
|
+
id: string;
|
|
3
|
+
externalId: string;
|
|
4
|
+
name: string;
|
|
5
|
+
company: TimifyCompany;
|
|
6
|
+
services: TimifyService[];
|
|
7
|
+
}
|
|
8
|
+
|
|
1
9
|
export interface TimifyState {
|
|
2
10
|
showServices: string[];
|
|
3
11
|
accountId: string;
|
|
@@ -5,7 +13,7 @@ export interface TimifyState {
|
|
|
5
13
|
showClicRDV: boolean;
|
|
6
14
|
}
|
|
7
15
|
|
|
8
|
-
export interface
|
|
16
|
+
export interface TimifyService {
|
|
9
17
|
id: string;
|
|
10
18
|
categoryId: string;
|
|
11
19
|
externalId: string;
|
|
@@ -13,3 +21,14 @@ export interface TimifyServices {
|
|
|
13
21
|
name: string;
|
|
14
22
|
isBookable: boolean;
|
|
15
23
|
}
|
|
24
|
+
|
|
25
|
+
export interface TimifyCompany {
|
|
26
|
+
id: string;
|
|
27
|
+
name: string;
|
|
28
|
+
externalId: string;
|
|
29
|
+
onlineStatus: OnlineStatus;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface OnlineStatus {
|
|
33
|
+
isOnline: boolean;
|
|
34
|
+
}
|