cja-phoenix 1.2.53 → 1.2.55

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.53",
4
+ "version": "1.2.55",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -12,11 +12,16 @@
12
12
  </button>
13
13
  </div>
14
14
  <div class="content-container">
15
- <Transition name="fade" mode="out-in">
16
- <div :key="activeTab" :class="`tab-${activeTab}`">
17
- <slot :name="activeTab" />
15
+ <TransitionGroup name="fade">
16
+ <div
17
+ v-for="(tab, i) in tabs"
18
+ v-show="activeTab == i"
19
+ :key="i"
20
+ :class="`tab-${i}`"
21
+ >
22
+ <slot :name="i" />
18
23
  </div>
19
- </Transition>
24
+ </TransitionGroup>
20
25
  </div>
21
26
  </div>
22
27
  </template>
@@ -72,11 +77,18 @@ defineExpose({ activeTab });
72
77
  position: relative;
73
78
  overflow: hidden;
74
79
 
75
- .fade-enter-active,
76
80
  .fade-leave-active {
81
+ position: absolute;
82
+ left: 0;
83
+ top: 0;
84
+ width: 100%;
77
85
  transition: all 0.3s ease-in-out;
78
86
  }
79
87
 
88
+ .fade-enter-active {
89
+ transition: all 0.3s ease-in-out 0.3s;
90
+ }
91
+
80
92
  .fade-enter-from,
81
93
  .fade-leave-to {
82
94
  opacity: 0;
@@ -1,4 +1,4 @@
1
- import { type Ref } from 'vue';
1
+ import { type Ref } from "vue";
2
2
  export declare const useValidateForm: (options: {
3
3
  fields?: Ref[];
4
4
  onSubmit?: () => void | Promise<void>;
@@ -1,16 +1,14 @@
1
- import { ref } from "vue";
1
+ import { nextTick, ref } from "vue";
2
2
  export const useValidateForm = (options) => {
3
3
  const validForm = ref(false);
4
4
  const submitLock = ref(false);
5
5
  const validate = async () => {
6
- const fields = options.fields?.filter((f) => f.value);
7
- if (fields) {
8
- for (let i = 0; i < fields.length; i++) {
9
- const field = fields[i];
10
- await field.value.validate();
11
- }
6
+ await nextTick();
7
+ const fields = options.fields?.filter((f) => f.value) ?? [];
8
+ for (const field of fields) {
9
+ await field.value.validate();
12
10
  }
13
- validForm.value = fields?.every((f) => f.value.meta.valid) ?? true;
11
+ validForm.value = fields.every((f) => f.value.meta.valid);
14
12
  };
15
13
  const submit = async () => {
16
14
  await validate();
@@ -1,10 +1,2 @@
1
- import type { StepType } from "../types/index.js";
2
- export declare const getAbTestVersion: (journeyId: string | undefined, config: {
3
- stepType: StepType;
4
- enabled: boolean;
5
- experiment: string;
6
- condition?: {
7
- type: "utmSource";
8
- utmSource: string;
9
- };
10
- }) => Promise<any>;
1
+ export type AbTestVersion = "control" | "variant";
2
+ export declare function getAbTestVersion(experimentName: string): Promise<AbTestVersion>;
@@ -1,46 +1,26 @@
1
- import {
2
- useRuntimeConfig,
3
- useCookie,
4
- updateForm,
5
- useRequestFetch
6
- } from "#imports";
7
- export const getAbTestVersion = async (journeyId, config) => {
8
- const { apiURL } = useRuntimeConfig().public;
1
+ import { useCookie, useRequestFetch, useRuntimeConfig } from "#imports";
2
+ export async function getAbTestVersion(experimentName) {
3
+ const { nucleusURL } = useRuntimeConfig().public;
9
4
  const requestFetch = useRequestFetch();
10
- const abTestCookie = useCookie(`abTestVersion_${config.experiment}`);
11
- const fetchAbTestVersion = async () => requestFetch("/core/apis/data/abTestServiceLookup", {
12
- baseURL: apiURL,
13
- method: "post",
5
+ const abTestCookie = useCookie(
6
+ `abTestVersion_${experimentName}`
7
+ );
8
+ const deviceIdCookie = useCookie("device_id");
9
+ if (abTestCookie.value == "control" || abTestCookie.value == "variant") {
10
+ return abTestCookie.value;
11
+ }
12
+ const response = await requestFetch("/experiments/abtest", {
13
+ baseURL: nucleusURL,
14
+ method: "POST",
15
+ headers: {
16
+ "Content-Type": "application/json"
17
+ },
14
18
  body: {
15
- experimentName: config.experiment,
16
- journeyId
19
+ experiment_name: experimentName,
20
+ device_id: deviceIdCookie.value
17
21
  }
18
- }).then(async (d) => {
19
- const abTestVersion = d.version || "control";
20
- abTestCookie.value = abTestVersion;
21
- await updateForm({
22
- journeyId,
23
- stepName: "AB Test Version",
24
- stepType: config.stepType,
25
- payload: {
26
- abTestName: config.experiment,
27
- abTestVersion
28
- }
29
- });
30
- return abTestVersion;
31
22
  });
32
- if (!abTestCookie.value && journeyId && config.enabled) {
33
- if (config.condition) {
34
- switch (config.condition.type) {
35
- case "utmSource":
36
- const url = new URL(location.href);
37
- if (url.searchParams.get("utm_source") == config.condition.utmSource) {
38
- return fetchAbTestVersion();
39
- }
40
- }
41
- } else {
42
- return fetchAbTestVersion();
43
- }
44
- }
45
- return abTestCookie.value || "control";
46
- };
23
+ const version = response?.version_shown || "control";
24
+ abTestCookie.value = version;
25
+ return version;
26
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cja-phoenix",
3
- "version": "1.2.53",
3
+ "version": "1.2.55",
4
4
  "description": "Phoenix utility",
5
5
  "repository": {
6
6
  "type": "git",