ublo-lib 1.19.21 → 1.19.23
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/es/common/components/plausible/hooks/use-plausible.d.ts +12 -0
- package/es/common/components/plausible/hooks/use-plausible.d.ts.map +1 -0
- package/es/common/components/plausible/hooks/use-plausible.js +19 -23
- package/es/common/components/plausible/index.d.ts +8 -0
- package/es/common/components/plausible/index.d.ts.map +1 -0
- package/es/common/components/plausible/index.js +1 -1
- package/es/common/components/plausible/plausible.d.ts +7 -0
- package/es/common/components/plausible/plausible.d.ts.map +1 -0
- package/es/common/components/plausible/plausible.js +14 -23
- package/es/common/components/plausible/services/callback.d.ts +24 -0
- package/es/common/components/plausible/services/callback.d.ts.map +1 -0
- package/es/common/components/plausible/services/callback.js +109 -146
- package/es/common/components/plausible/services/load.d.ts +2 -0
- package/es/common/components/plausible/services/load.d.ts.map +1 -0
- package/es/common/components/plausible/services/load.js +7 -6
- package/es/common/components/plausible/services/send-goal.d.ts +7 -0
- package/es/common/components/plausible/services/send-goal.d.ts.map +1 -0
- package/es/common/components/plausible/services/send-goal.js +4 -7
- package/es/esf/hooks/use-booking-links.js +3 -2
- package/package.json +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type Revenue = {
|
|
2
|
+
currency: string;
|
|
3
|
+
amount: number;
|
|
4
|
+
};
|
|
5
|
+
export default function useGoal(goal: string, props: Record<string, any>, revenue?: Revenue, overridenDomain?: string): void;
|
|
6
|
+
declare global {
|
|
7
|
+
interface Window {
|
|
8
|
+
plausible: any;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=use-plausible.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-plausible.d.ts","sourceRoot":"","sources":["../../../../../src/common/components/plausible/hooks/use-plausible.ts"],"names":[],"mappings":"AAQA,KAAK,OAAO,GAAG;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,OAAO,CAC7B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC1B,OAAO,CAAC,EAAE,OAAO,EACjB,eAAe,CAAC,EAAE,MAAM,QAQzB;AAcD,OAAO,CAAC,MAAM,CAAC;IAEb,UAAU,MAAM;QACd,SAAS,EAAE,GAAG,CAAC;KAChB;CACF"}
|
|
@@ -2,28 +2,24 @@ import * as React from "react";
|
|
|
2
2
|
import getConfig from "next/config";
|
|
3
3
|
import load from "../services/load";
|
|
4
4
|
import sendGoal from "../services/send-goal";
|
|
5
|
-
const {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const defaultProps = {
|
|
16
|
-
path: document.location.pathname
|
|
17
|
-
};
|
|
18
|
-
sendGoal(goal, props || defaultProps);
|
|
19
|
-
}, [goal, loaded, props]);
|
|
5
|
+
const { publicRuntimeConfig } = getConfig();
|
|
6
|
+
const { plausibleDomain } = publicRuntimeConfig;
|
|
7
|
+
export default function useGoal(goal, props, revenue, overridenDomain) {
|
|
8
|
+
const [loaded] = usePlausible(overridenDomain);
|
|
9
|
+
React.useEffect(() => {
|
|
10
|
+
if (!loaded || !window.plausible)
|
|
11
|
+
return;
|
|
12
|
+
const defaultProps = { path: document.location.pathname };
|
|
13
|
+
sendGoal(goal, props || defaultProps, revenue);
|
|
14
|
+
}, [goal, loaded, props]);
|
|
20
15
|
}
|
|
21
16
|
function usePlausible(overridenDomain) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
17
|
+
const [loaded, setLoaded] = React.useState(false);
|
|
18
|
+
React.useEffect(() => {
|
|
19
|
+
if (!overridenDomain && !plausibleDomain)
|
|
20
|
+
return;
|
|
21
|
+
load();
|
|
22
|
+
setLoaded(true);
|
|
23
|
+
}, [overridenDomain]);
|
|
24
|
+
return [loaded, setLoaded];
|
|
25
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import Script from "./plausible";
|
|
2
|
+
import * as Callback from "./services/callback";
|
|
3
|
+
declare const callback: typeof Callback.MseM;
|
|
4
|
+
export { default as load } from "./services/load";
|
|
5
|
+
export { default as sendGoal } from "./services/send-goal";
|
|
6
|
+
export { default as useGoal } from "./hooks/use-plausible";
|
|
7
|
+
export { callback, Script };
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/common/components/plausible/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAEhD,QAAA,MAAM,QAAQ,sBAAgB,CAAC;AAE/B,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plausible.d.ts","sourceRoot":"","sources":["../../../../src/common/components/plausible/plausible.tsx"],"names":[],"mappings":"AAOA,KAAK,KAAK,GAAG;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAKF,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EACtC,IAAI,EACJ,MAAuB,GACxB,EAAE,KAAK,kDAeP"}
|
|
@@ -1,26 +1,17 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import Script from "next/script";
|
|
3
3
|
import getConfig from "next/config";
|
|
4
|
-
|
|
5
|
-
const {
|
|
6
|
-
publicRuntimeConfig
|
|
7
|
-
} = getConfig();
|
|
8
|
-
const {
|
|
9
|
-
plausibleDomain
|
|
10
|
-
} = publicRuntimeConfig;
|
|
4
|
+
const { publicRuntimeConfig } = getConfig();
|
|
5
|
+
const { plausibleDomain } = publicRuntimeConfig;
|
|
11
6
|
const DEFAULT_SOURCE = "https://plausible.io/js/script.file-downloads.outbound-links.js";
|
|
12
|
-
export default function PlausibleScript({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"data-domain": domain,
|
|
24
|
-
src: source
|
|
25
|
-
});
|
|
26
|
-
}
|
|
7
|
+
export default function PlausibleScript({ lang, source = DEFAULT_SOURCE, }) {
|
|
8
|
+
const hasI18n = typeof plausibleDomain === "object";
|
|
9
|
+
if (hasI18n && !lang) {
|
|
10
|
+
// eslint-disable-next-line no-console
|
|
11
|
+
console.warn("PlausibleScript: the lang props is mandatory if you want to use a specific domain for each lang");
|
|
12
|
+
}
|
|
13
|
+
const domain = hasI18n && lang ? plausibleDomain[lang] : plausibleDomain;
|
|
14
|
+
if (!domain)
|
|
15
|
+
return null;
|
|
16
|
+
return _jsx(Script, { "data-domain": domain, src: source });
|
|
17
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
type Item = {
|
|
2
|
+
gtmData: {
|
|
3
|
+
item_name: string;
|
|
4
|
+
item_brand: string;
|
|
5
|
+
item_category: string;
|
|
6
|
+
item_category2: string;
|
|
7
|
+
item_category3: string;
|
|
8
|
+
item_variant: string;
|
|
9
|
+
price: number;
|
|
10
|
+
quantity: number;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
type Props = {
|
|
14
|
+
event: string;
|
|
15
|
+
payment_type?: string;
|
|
16
|
+
execcode?: string;
|
|
17
|
+
items?: Item[];
|
|
18
|
+
orderId?: string;
|
|
19
|
+
cartId?: string;
|
|
20
|
+
currency?: string;
|
|
21
|
+
};
|
|
22
|
+
export declare function MseM({ event, payment_type: paymentType, execcode, items, orderId, cartId, currency, }: Props): void;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=callback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"callback.d.ts","sourceRoot":"","sources":["../../../../../src/common/components/plausible/services/callback.ts"],"names":[],"mappings":"AAEA,KAAK,IAAI,GAAG;IACV,OAAO,EAAE;QACP,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,EAAE,MAAM,CAAC;QACnB,aAAa,EAAE,MAAM,CAAC;QACtB,cAAc,EAAE,MAAM,CAAC;QACvB,cAAc,EAAE,MAAM,CAAC;QACvB,YAAY,EAAE,MAAM,CAAC;QACrB,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;CACH,CAAC;AAEF,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAiBF,wBAAgB,IAAI,CAAC,EACnB,KAAK,EACL,YAAY,EAAE,WAAW,EACzB,QAAQ,EACR,KAAU,EACV,OAAO,EACP,MAAM,EACN,QAAgB,GACjB,EAAE,KAAK,QA8EP"}
|
|
@@ -1,158 +1,121 @@
|
|
|
1
1
|
import sendGoal from "./send-goal";
|
|
2
|
+
// TODO lors de la mise en prod de la nouvelle version PeekPerformances
|
|
3
|
+
// rename events "MseM:" > "PeekPerformances:"
|
|
4
|
+
// Retirer les anciennes props :
|
|
5
|
+
// Name, Brand, Kind, Activity, Code, Product, cartId,
|
|
6
|
+
// orderId, Code, Payment type
|
|
2
7
|
const EVENT_NAMES = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
view_item: "MseM: View item",
|
|
9
|
+
add_to_cart: "MseM: Add to cart",
|
|
10
|
+
checkout: "MseM: Begin checkout",
|
|
11
|
+
add_payment_info: "MseM: Checkout process",
|
|
12
|
+
purchase: "MseM: Payment success",
|
|
13
|
+
payment_failure: "MseM: Payment failure",
|
|
9
14
|
};
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
Kind: items[0]?.gtmData.item_category,
|
|
32
|
-
Activity: items[0]?.gtmData.item_category2,
|
|
33
|
-
Code: items[0]?.gtmData.item_category3,
|
|
34
|
-
Product: items[0]?.gtmData.item_variant,
|
|
35
|
-
rawData
|
|
36
|
-
});
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
case "add_to_cart":
|
|
40
|
-
{
|
|
41
|
-
const formatedItems = formatPeekPerformancesItem(items);
|
|
42
|
-
const rawData = JSON.stringify({
|
|
43
|
-
products: formatedItems,
|
|
44
|
-
hoteId
|
|
45
|
-
});
|
|
46
|
-
sendGoal(name, {
|
|
47
|
-
Name: items[0]?.gtmData.item_name,
|
|
48
|
-
Brand: items[0]?.gtmData.item_brand,
|
|
49
|
-
Kind: items[0]?.gtmData.item_category,
|
|
50
|
-
Activity: items[0]?.gtmData.item_category2,
|
|
51
|
-
Code: items[0]?.gtmData.item_category3,
|
|
52
|
-
Product: items[0]?.gtmData.item_variant,
|
|
53
|
-
rawData
|
|
54
|
-
});
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
case "checkout":
|
|
58
|
-
{
|
|
59
|
-
const formatedItems = formatPeekPerformancesItem(items);
|
|
60
|
-
const rawData = JSON.stringify({
|
|
61
|
-
products: formatedItems,
|
|
62
|
-
hoteId
|
|
63
|
-
});
|
|
64
|
-
sendGoal(name, {
|
|
65
|
-
cartId,
|
|
66
|
-
rawData
|
|
67
|
-
});
|
|
68
|
-
break;
|
|
69
|
-
}
|
|
70
|
-
case "add_payment_info":
|
|
71
|
-
{
|
|
72
|
-
const formatedItems = formatPeekPerformancesItem(items);
|
|
73
|
-
const rawData = JSON.stringify({
|
|
74
|
-
products: formatedItems,
|
|
75
|
-
hoteId,
|
|
76
|
-
paymentMethod: payment_type
|
|
77
|
-
});
|
|
78
|
-
sendGoal(name, {
|
|
79
|
-
cartId,
|
|
80
|
-
"Payment type": payment_type,
|
|
81
|
-
rawData
|
|
82
|
-
});
|
|
83
|
-
break;
|
|
84
|
-
}
|
|
85
|
-
case "purchase":
|
|
86
|
-
{
|
|
87
|
-
const isFailure = execcode !== "0000";
|
|
88
|
-
const formatedItems = formatPeekPerformancesItem(items);
|
|
89
|
-
const attempts = getPurchaseAttempts()[cartId] || 0;
|
|
90
|
-
const rawData = JSON.stringify({
|
|
91
|
-
products: formatedItems,
|
|
92
|
-
hoteId,
|
|
93
|
-
attempts,
|
|
94
|
-
paymentMethod: payment_type,
|
|
95
|
-
execCode: execcode
|
|
96
|
-
});
|
|
97
|
-
if (isFailure) {
|
|
98
|
-
name = EVENT_NAMES.payment_failure;
|
|
99
|
-
sendGoal(name, {
|
|
100
|
-
cartId,
|
|
101
|
-
orderId,
|
|
102
|
-
Code: execcode,
|
|
103
|
-
rawData
|
|
104
|
-
});
|
|
105
|
-
setPurchaseAttempts(cartId, attempts + 1);
|
|
106
|
-
} else {
|
|
107
|
-
sendGoal(name, {
|
|
108
|
-
cartId,
|
|
109
|
-
orderId,
|
|
110
|
-
Code: execcode,
|
|
111
|
-
rawData
|
|
112
|
-
});
|
|
15
|
+
export function MseM({ event, payment_type: paymentType, execcode, items = [], orderId, cartId, currency = "EUR", }) {
|
|
16
|
+
const hoteId = getBusinessProvider();
|
|
17
|
+
const amount = items.reduce((acc, item) => {
|
|
18
|
+
return acc + item.gtmData.price * item.gtmData.quantity;
|
|
19
|
+
}, 0);
|
|
20
|
+
const revenue = { currency, amount };
|
|
21
|
+
let name = EVENT_NAMES[event];
|
|
22
|
+
const firstProductProps = {
|
|
23
|
+
Name: items[0]?.gtmData.item_name,
|
|
24
|
+
Brand: items[0]?.gtmData.item_brand,
|
|
25
|
+
Kind: items[0]?.gtmData.item_category,
|
|
26
|
+
Activity: items[0]?.gtmData.item_category2,
|
|
27
|
+
Code: items[0]?.gtmData.item_category3,
|
|
28
|
+
Product: items[0]?.gtmData.item_variant,
|
|
29
|
+
};
|
|
30
|
+
switch (event) {
|
|
31
|
+
case "view_item": {
|
|
32
|
+
const formatedItems = formatPeekPerformancesItem(items);
|
|
33
|
+
const rawData = JSON.stringify({ products: formatedItems, hoteId });
|
|
34
|
+
sendGoal(name, { ...firstProductProps, rawData });
|
|
35
|
+
break;
|
|
113
36
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
};
|
|
37
|
+
case "add_to_cart": {
|
|
38
|
+
const formatedItems = formatPeekPerformancesItem(items);
|
|
39
|
+
const rawData = JSON.stringify({ products: formatedItems, hoteId });
|
|
40
|
+
sendGoal(name, { ...firstProductProps, rawData }, revenue);
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
case "checkout": {
|
|
44
|
+
const formatedItems = formatPeekPerformancesItem(items);
|
|
45
|
+
const rawData = JSON.stringify({ products: formatedItems, hoteId });
|
|
46
|
+
sendGoal(name, { cartId, rawData }, revenue);
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
case "add_payment_info": {
|
|
50
|
+
const formatedItems = formatPeekPerformancesItem(items);
|
|
51
|
+
const rawData = JSON.stringify({
|
|
52
|
+
products: formatedItems,
|
|
53
|
+
hoteId,
|
|
54
|
+
paymentMethod: paymentType,
|
|
55
|
+
});
|
|
56
|
+
sendGoal(name, { cartId, "Payment type": paymentType, rawData }, revenue);
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
case "purchase": {
|
|
60
|
+
const isFailure = execcode !== "0000";
|
|
61
|
+
const formatedItems = formatPeekPerformancesItem(items);
|
|
62
|
+
const attempts = (cartId && getPurchaseAttempts()[cartId]) || 0;
|
|
63
|
+
const rawData = JSON.stringify({
|
|
64
|
+
products: formatedItems,
|
|
65
|
+
hoteId,
|
|
66
|
+
attempts,
|
|
67
|
+
paymentMethod: paymentType,
|
|
68
|
+
execCode: execcode,
|
|
69
|
+
});
|
|
70
|
+
if (isFailure) {
|
|
71
|
+
name = EVENT_NAMES.payment_failure;
|
|
72
|
+
sendGoal(name, { cartId, orderId, Code: execcode, rawData }, revenue);
|
|
73
|
+
if (cartId) {
|
|
74
|
+
setPurchaseAttempts(cartId, attempts + 1);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
sendGoal(name, { cartId, orderId, Code: execcode, rawData }, revenue);
|
|
79
|
+
}
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
118
84
|
const PURCHASE_ATTEMPTS_STORAGE_KEY = "purchase_attempts";
|
|
119
85
|
function getPurchaseAttempts() {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
86
|
+
try {
|
|
87
|
+
const storedAttempts = window.localStorage.getItem(PURCHASE_ATTEMPTS_STORAGE_KEY);
|
|
88
|
+
return storedAttempts !== null ? JSON.parse(storedAttempts) : {};
|
|
89
|
+
}
|
|
90
|
+
catch (e) {
|
|
91
|
+
return {};
|
|
92
|
+
}
|
|
125
93
|
}
|
|
126
94
|
function setPurchaseAttempts(cartId, attempts) {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
...purchaseAttempts,
|
|
130
|
-
[cartId]: attempts
|
|
131
|
-
}));
|
|
95
|
+
const purchaseAttempts = getPurchaseAttempts();
|
|
96
|
+
window.localStorage.setItem(PURCHASE_ATTEMPTS_STORAGE_KEY, JSON.stringify({ ...purchaseAttempts, [cartId]: attempts }));
|
|
132
97
|
}
|
|
133
98
|
function formatPeekPerformancesItem(items) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
gtmData
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
};
|
|
144
|
-
});
|
|
99
|
+
if (!items || !items.length)
|
|
100
|
+
return;
|
|
101
|
+
return items.map(({ gtmData }) => {
|
|
102
|
+
return {
|
|
103
|
+
category: gtmData.item_category,
|
|
104
|
+
subCategory: gtmData.item_category2,
|
|
105
|
+
merchant: gtmData.item_brand,
|
|
106
|
+
price: gtmData.price,
|
|
107
|
+
};
|
|
108
|
+
});
|
|
145
109
|
}
|
|
146
110
|
function getBusinessProvider() {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
}
|
|
111
|
+
const businessProvider = window.localStorage.getItem("businessProvider");
|
|
112
|
+
if (businessProvider) {
|
|
113
|
+
try {
|
|
114
|
+
const { id } = JSON.parse(businessProvider);
|
|
115
|
+
if (id !== -1) {
|
|
116
|
+
return id;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
catch (e) { }
|
|
120
|
+
}
|
|
121
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../../../../src/common/components/plausible/services/load.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,IAAI,SAM3B"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
export default function load() {
|
|
2
|
+
window.plausible =
|
|
3
|
+
window.plausible ||
|
|
4
|
+
function () {
|
|
5
|
+
(window.plausible.q = window.plausible.q || []).push(arguments);
|
|
6
|
+
};
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-goal.d.ts","sourceRoot":"","sources":["../../../../../src/common/components/plausible/services/send-goal.ts"],"names":[],"mappings":"AAEA,KAAK,OAAO,GAAG;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,QAAQ,CAC9B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC1B,OAAO,CAAC,EAAE,OAAO,QAIlB"}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import load from "./load";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
});
|
|
7
|
-
};
|
|
8
|
-
export default sendGoal;
|
|
2
|
+
export default function sendGoal(goal, props, revenue) {
|
|
3
|
+
load();
|
|
4
|
+
window.plausible(goal, { props, revenue });
|
|
5
|
+
}
|
|
@@ -27,7 +27,8 @@ const useBookingLinks = (cart, multipleVillages, setupCallback, channel = "ESF")
|
|
|
27
27
|
const {
|
|
28
28
|
breadcrumb,
|
|
29
29
|
config,
|
|
30
|
-
lang
|
|
30
|
+
lang,
|
|
31
|
+
path
|
|
31
32
|
} = useUbloContext();
|
|
32
33
|
const hasLangPrefix = config.langPrefix.links;
|
|
33
34
|
const bookingLang = lang === "fr" ? "fr" : "en";
|
|
@@ -39,6 +40,6 @@ const useBookingLinks = (cart, multipleVillages, setupCallback, channel = "ESF")
|
|
|
39
40
|
setupCallback?.();
|
|
40
41
|
};
|
|
41
42
|
run();
|
|
42
|
-
}, [bookingLang, breadcrumb, cart, channel, hasLangPrefix, multipleVillages, setupCallback]);
|
|
43
|
+
}, [bookingLang, breadcrumb, cart, channel, hasLangPrefix, multipleVillages, path, setupCallback]);
|
|
43
44
|
};
|
|
44
45
|
export default useBookingLinks;
|