cja-phoenix 1.2.21 → 1.2.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/dist/module.json
CHANGED
|
@@ -16,11 +16,8 @@ export const useValidateForm = (options) => {
|
|
|
16
16
|
await validate();
|
|
17
17
|
if (validForm.value) {
|
|
18
18
|
if (!submitLock.value) {
|
|
19
|
-
console.log("Toggle submitLock");
|
|
20
19
|
submitLock.value = true;
|
|
21
|
-
console.log("Executing callback");
|
|
22
20
|
await options.onSubmit?.();
|
|
23
|
-
console.log("Toggle submitLock");
|
|
24
21
|
submitLock.value = false;
|
|
25
22
|
}
|
|
26
23
|
} else {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { useRuntimeConfig, useCookie, updateForm } from "#imports";
|
|
2
|
+
export const getAbTestVersion = async (journeyId, config) => {
|
|
3
|
+
const { apiURL } = useRuntimeConfig().public;
|
|
4
|
+
const abTestCookie = useCookie(`abTestVersion_${config.experiment}`);
|
|
5
|
+
const fetchAbTestVersion = async () => fetch(new URL("/core/apis/data/abTestServiceLookup", apiURL), {
|
|
6
|
+
method: "post",
|
|
7
|
+
body: JSON.stringify({
|
|
8
|
+
experimentName: config.experiment,
|
|
9
|
+
journeyId
|
|
10
|
+
})
|
|
11
|
+
}).then((r) => r.json()).then(async (d) => {
|
|
12
|
+
const abTestVersion = d.version || "control";
|
|
13
|
+
abTestCookie.value = abTestVersion;
|
|
14
|
+
await updateForm({
|
|
15
|
+
journeyId,
|
|
16
|
+
step: 0,
|
|
17
|
+
stepName: "AB Test Version",
|
|
18
|
+
formType: config.formType,
|
|
19
|
+
eventType: "STEP_CHANGED",
|
|
20
|
+
payload: {
|
|
21
|
+
abTestName: config.experiment,
|
|
22
|
+
abTestVersion
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
return abTestVersion;
|
|
26
|
+
});
|
|
27
|
+
if (!abTestCookie.value && journeyId && config.enabled) {
|
|
28
|
+
if (config.condition) {
|
|
29
|
+
switch (config.condition.type) {
|
|
30
|
+
case "utmSource":
|
|
31
|
+
const url = new URL(location.href);
|
|
32
|
+
if (url.searchParams.get("utm_source") == config.condition.utmSource) {
|
|
33
|
+
return fetchAbTestVersion();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
} else {
|
|
37
|
+
return fetchAbTestVersion();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return abTestCookie.value || "control";
|
|
41
|
+
};
|