cja-phoenix 1.2.47 → 1.2.48

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.47",
4
+ "version": "1.2.48",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -1,11 +1,11 @@
1
- import { type ComputedRef } from 'vue';
2
- import type { StepData } from '../types/JourneyConfig.js';
1
+ import { type ComputedRef } from "vue";
2
+ import type { StepData } from "../types/JourneyConfig.js";
3
3
  export declare const useFunnelConfig: (structure: ComputedRef<Map<string, string[]>>) => {
4
4
  steps: ComputedRef<string[]>;
5
5
  structure: ComputedRef<Map<string, string[]>>;
6
6
  currentStep: ComputedRef<StepData>;
7
7
  totalSteps: ComputedRef<number>;
8
8
  getStep: (step: string | number | undefined) => StepData | undefined;
9
- goNextStep: () => Promise<void>;
10
- goPrevStep: () => Promise<void>;
9
+ goNextStep: (relative?: boolean) => Promise<void>;
10
+ goPrevStep: (relative?: boolean) => Promise<void>;
11
11
  };
@@ -3,7 +3,9 @@ import { computed } from "vue";
3
3
  export const useFunnelConfig = (structure) => {
4
4
  const route = useRouter().currentRoute;
5
5
  const steps = computed(() => Array.from(structure.value.keys()));
6
- const currentStep = computed(() => getStep(route.value.path.split("/").reverse()[0]) || currentStep.value);
6
+ const currentStep = computed(
7
+ () => getStep(route.value.path.split("/").reverse()[0]) || currentStep.value
8
+ );
7
9
  const totalSteps = computed(() => structure.value.size);
8
10
  const getStep = (step) => {
9
11
  if (step === void 0) return;
@@ -17,9 +19,18 @@ export const useFunnelConfig = (structure) => {
17
19
  fields: stepFields
18
20
  } : void 0;
19
21
  };
20
- const goNextStep = async () => {
22
+ const currentStepStatic = getStep(
23
+ route.value.path.split("/").reverse()[0]
24
+ );
25
+ const goNextStep = async (relative) => {
21
26
  if (currentStep.value) {
22
- const nextStep = getStep(currentStep.value.index + 1);
27
+ const nextStep = (() => {
28
+ if (relative) {
29
+ return getStep(currentStep.value.index + 1);
30
+ } else if (currentStepStatic) {
31
+ return getStep(currentStepStatic.index + 1);
32
+ }
33
+ })();
23
34
  if (nextStep) {
24
35
  await navigateTo({
25
36
  path: nextStep.path,
@@ -28,12 +39,18 @@ export const useFunnelConfig = (structure) => {
28
39
  }
29
40
  }
30
41
  };
31
- const goPrevStep = async () => {
42
+ const goPrevStep = async (relative) => {
32
43
  if (currentStep.value) {
33
- const nextStep = getStep(currentStep.value.index - 1);
34
- if (nextStep) {
44
+ const prevStep = (() => {
45
+ if (relative) {
46
+ return getStep(currentStep.value.index - 1);
47
+ } else if (currentStepStatic) {
48
+ return;
49
+ }
50
+ })();
51
+ if (prevStep) {
35
52
  await navigateTo({
36
- path: nextStep.path,
53
+ path: prevStep.path,
37
54
  query: useRoute().query
38
55
  });
39
56
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cja-phoenix",
3
- "version": "1.2.47",
3
+ "version": "1.2.48",
4
4
  "description": "Phoenix utility",
5
5
  "repository": {
6
6
  "type": "git",