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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cja-phoenix",
3
3
  "configKey": "cja-phoenix",
4
- "version": "1.2.34",
4
+ "version": "1.2.36",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -6,4 +6,4 @@ export declare const getAbTestVersion: (journeyId: string | undefined, config: {
6
6
  type: "utmSource";
7
7
  utmSource: string;
8
8
  };
9
- }) => Promise<any>;
9
+ }) => Promise<string>;
@@ -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 () => requestFetch("/core/apis/data/abTestServiceLookup", {
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({
@@ -7,4 +7,4 @@ export declare const updateForm: (options: {
7
7
  sentToDialer?: boolean;
8
8
  eventType?: string;
9
9
  formType: string;
10
- }) => Promise<unknown>;
10
+ }) => Promise<Response>;
@@ -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 $fetch("/core/apis/data/updateForm", {
6
- baseURL: apiURL,
5
+ return fetch(new URL("/core/apis/data/updateForm", apiURL), {
7
6
  method: "PUT",
8
- body: {
9
- eventType: options.eventType || "STEP_CHANGED",
10
- isActionEvent: true,
11
- journeyId: options.journeyId,
12
- stepName: options.stepName,
13
- isCompleted: options.isCompleted || false,
14
- sentToDialer: options.sentToDialer || true,
15
- lastStepNumber: options.step,
16
- lastStepType: options.formType,
17
- lastStepUrl: route.fullPath,
18
- data: {
19
- ...options.payload,
20
- formType: options.formType
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,4 +1,4 @@
1
1
  export declare const updateMarketingConsent: (options: {
2
2
  email: string;
3
3
  journeyId?: string;
4
- }) => Promise<unknown>;
4
+ }) => Promise<Response>;
@@ -1,13 +1,12 @@
1
1
  import { useRuntimeConfig } from "#imports";
2
2
  export const updateMarketingConsent = (options) => {
3
3
  const { apiURL } = useRuntimeConfig().public;
4
- return $fetch("/core/apis/data/verifyConsent", {
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
  };
@@ -5,4 +5,4 @@ export declare const uploadFile: (options: {
5
5
  fileName: string;
6
6
  extension: string;
7
7
  bucketName: string;
8
- }) => Promise<unknown>;
8
+ }) => Promise<Response>;
@@ -1,13 +1,15 @@
1
1
  import { useRuntimeConfig } from "#imports";
2
2
  export const uploadFile = (options) => {
3
3
  const { apiURL } = useRuntimeConfig().public;
4
- return $fetch("/core/apis/data/saveFileToS3", {
5
- baseURL: apiURL,
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
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cja-phoenix",
3
- "version": "1.2.34",
3
+ "version": "1.2.36",
4
4
  "description": "Phoenix utility",
5
5
  "repository": "comparaja/phoenix",
6
6
  "license": "MIT",