cja-phoenix 1.2.54 → 1.2.56

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.54",
4
+ "version": "1.2.56",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -73,7 +73,12 @@ const toggleModal = () => {
73
73
  };
74
74
  watch(active, () => {
75
75
  nextTick(() => {
76
- mobileFull.value = active.value ? props.forceMobileFull || modalContainer.value.clientHeight >= window.innerHeight * 0.75 : false;
76
+ if (!active.value) {
77
+ mobileFull.value = false;
78
+ return;
79
+ }
80
+ const containerHeight = modalContainer.value?.clientHeight ?? 0;
81
+ mobileFull.value = props.forceMobileFull || containerHeight >= window.innerHeight * 0.75;
77
82
  });
78
83
  });
79
84
  defineExpose({ active, openModal, closeModal, toggleModal });
@@ -32,6 +32,7 @@ onMounted(() => {
32
32
  () => [top, headerHeight.value],
33
33
  () => {
34
34
  if (observer) observer.disconnect();
35
+ const stickyOffset = top ?? headerHeight.value;
35
36
  observer = new IntersectionObserver(
36
37
  (entries) => {
37
38
  const entry = entries[0];
@@ -40,7 +41,7 @@ onMounted(() => {
40
41
  }
41
42
  },
42
43
  {
43
- rootMargin: `0px 0px -${window.innerHeight - (top || headerHeight.value)}px 0px`
44
+ rootMargin: `0px 0px -${window.innerHeight - stickyOffset}px 0px`
44
45
  }
45
46
  );
46
47
  observer.observe(stickyContainer.value);
@@ -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();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cja-phoenix",
3
- "version": "1.2.54",
3
+ "version": "1.2.56",
4
4
  "description": "Phoenix utility",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,10 +0,0 @@
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,46 +0,0 @@
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;
9
- 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",
14
- body: {
15
- experimentName: config.experiment,
16
- journeyId
17
- }
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
- });
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
- };