cja-phoenix 1.2.34 → 1.2.36
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 +1 -1
- package/dist/runtime/utils/getAbTestVersion.d.ts +1 -1
- package/dist/runtime/utils/getAbTestVersion.js +5 -12
- package/dist/runtime/utils/updateForm.d.ts +1 -1
- package/dist/runtime/utils/updateForm.js +20 -17
- package/dist/runtime/utils/updateMarketingConsent.d.ts +1 -1
- package/dist/runtime/utils/updateMarketingConsent.js +3 -4
- package/dist/runtime/utils/uploadFile.d.ts +1 -1
- package/dist/runtime/utils/uploadFile.js +9 -7
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -1,21 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useRuntimeConfig,
|
|
3
|
-
useCookie,
|
|
4
|
-
updateForm,
|
|
5
|
-
useRequestFetch
|
|
6
|
-
} from "#imports";
|
|
1
|
+
import { useRuntimeConfig, useCookie, updateForm } from "#imports";
|
|
7
2
|
export const getAbTestVersion = async (journeyId, config) => {
|
|
8
3
|
const { apiURL } = useRuntimeConfig().public;
|
|
9
|
-
const requestFetch = useRequestFetch();
|
|
10
4
|
const abTestCookie = useCookie(`abTestVersion_${config.experiment}`);
|
|
11
|
-
const fetchAbTestVersion = async () =>
|
|
12
|
-
baseURL: apiURL,
|
|
5
|
+
const fetchAbTestVersion = async () => fetch(new URL("/core/apis/data/abTestServiceLookup", apiURL), {
|
|
13
6
|
method: "post",
|
|
14
|
-
body: {
|
|
7
|
+
body: JSON.stringify({
|
|
15
8
|
experimentName: config.experiment,
|
|
16
9
|
journeyId
|
|
17
|
-
}
|
|
18
|
-
}).then(async (d) => {
|
|
10
|
+
})
|
|
11
|
+
}).then((r) => r.json()).then(async (d) => {
|
|
19
12
|
const abTestVersion = d.version || "control";
|
|
20
13
|
abTestCookie.value = abTestVersion;
|
|
21
14
|
await updateForm({
|
|
@@ -2,23 +2,26 @@ import { useRoute, useRuntimeConfig } from "#imports";
|
|
|
2
2
|
export const updateForm = (options) => {
|
|
3
3
|
const { apiURL } = useRuntimeConfig().public;
|
|
4
4
|
const route = useRoute();
|
|
5
|
-
return
|
|
6
|
-
baseURL: apiURL,
|
|
5
|
+
return fetch(new URL("/core/apis/data/updateForm", apiURL), {
|
|
7
6
|
method: "PUT",
|
|
8
|
-
body:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
7
|
+
body: JSON.stringify(
|
|
8
|
+
Object.fromEntries(
|
|
9
|
+
Object.entries({
|
|
10
|
+
eventType: options.eventType || "STEP_CHANGED",
|
|
11
|
+
isActionEvent: true,
|
|
12
|
+
journeyId: options.journeyId,
|
|
13
|
+
stepName: options.stepName,
|
|
14
|
+
isCompleted: options.isCompleted || false,
|
|
15
|
+
sentToDialer: options.sentToDialer || true,
|
|
16
|
+
lastStepNumber: options.step,
|
|
17
|
+
lastStepType: options.formType,
|
|
18
|
+
lastStepUrl: route.fullPath,
|
|
19
|
+
data: JSON.stringify({
|
|
20
|
+
...options.payload,
|
|
21
|
+
formType: options.formType
|
|
22
|
+
})
|
|
23
|
+
}).filter(([_, v]) => v != null)
|
|
24
|
+
)
|
|
25
|
+
)
|
|
23
26
|
});
|
|
24
27
|
};
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { useRuntimeConfig } from "#imports";
|
|
2
2
|
export const updateMarketingConsent = (options) => {
|
|
3
3
|
const { apiURL } = useRuntimeConfig().public;
|
|
4
|
-
return
|
|
5
|
-
baseURL: apiURL,
|
|
4
|
+
return fetch(new URL("/core/apis/data/verifyConsent", apiURL), {
|
|
6
5
|
method: "POST",
|
|
7
|
-
body: {
|
|
6
|
+
body: JSON.stringify({
|
|
8
7
|
email: options.email,
|
|
9
8
|
currentPageUrl: location.origin + location.pathname,
|
|
10
9
|
journeyId: options.journeyId
|
|
11
|
-
}
|
|
10
|
+
})
|
|
12
11
|
});
|
|
13
12
|
};
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { useRuntimeConfig } from "#imports";
|
|
2
2
|
export const uploadFile = (options) => {
|
|
3
3
|
const { apiURL } = useRuntimeConfig().public;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const data = new FormData();
|
|
5
|
+
data.append(
|
|
6
|
+
"path",
|
|
7
|
+
`${options.basePath}/${options.journeyId}/${options.fileName}.${options.extension}`
|
|
8
|
+
);
|
|
9
|
+
data.append("file", options.file);
|
|
10
|
+
data.append("bucketName", options.bucketName);
|
|
11
|
+
return fetch(new URL("/core/apis/data/saveFileToS3", apiURL), {
|
|
6
12
|
method: "POST",
|
|
7
|
-
body:
|
|
8
|
-
path: `${options.basePath}/${options.journeyId}/${options.fileName}.${options.extension}`,
|
|
9
|
-
file: options.file,
|
|
10
|
-
bucketName: options.bucketName
|
|
11
|
-
}
|
|
13
|
+
body: data
|
|
12
14
|
});
|
|
13
15
|
};
|