cja-phoenix 0.3.4 → 0.3.6
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/README.md +26 -10
- package/dist/cja-phoenix.es.js +3386 -3218
- package/dist/style.css +1 -1
- package/dist/types/components/composite/CheckoutCrossSell.vue.d.ts +31 -24
- package/dist/types/components/composite/CheckoutLayout.vue.d.ts +11 -14
- package/dist/types/components/composite/CheckoutMilestones.vue.d.ts +10 -13
- package/dist/types/components/composite/CjaMenuBar.vue.d.ts +25 -32
- package/dist/types/components/composite/FunnelLayout.vue.d.ts +23 -20
- package/dist/types/components/composite/FunnelSubmit.vue.d.ts +15 -16
- package/dist/types/components/composite/FunnelSummary.vue.d.ts +54 -55
- package/dist/types/components/composite/FunnelTitle.vue.d.ts +22 -17
- package/dist/types/components/composite/InfoShowcase.vue.d.ts +24 -21
- package/dist/types/components/composite/JourneyMacroSteps.vue.d.ts +10 -13
- package/dist/types/components/forms/CheckboxInput.vue.d.ts +33 -32
- package/dist/types/components/forms/CurrencyInput.vue.d.ts +80 -53
- package/dist/types/components/forms/FileInput.vue.d.ts +92 -67
- package/dist/types/components/forms/NumberInput.vue.d.ts +63 -48
- package/dist/types/components/forms/PhoneInput.vue.d.ts +92 -57
- package/dist/types/components/forms/RadioInput.vue.d.ts +53 -38
- package/dist/types/components/forms/SelectInput.vue.d.ts +108 -67
- package/dist/types/components/forms/SelectionTiles.vue.d.ts +54 -41
- package/dist/types/components/forms/TextInput.vue.d.ts +104 -61
- package/dist/types/components/forms/TileCheckboxInput.vue.d.ts +31 -20
- package/dist/types/components/forms/ToggleInput.vue.d.ts +63 -44
- package/dist/types/components/forms/structure/InputContainer.vue.d.ts +9 -14
- package/dist/types/components/forms/structure/InputError.vue.d.ts +10 -13
- package/dist/types/components/forms/structure/InputTitle.vue.d.ts +22 -17
- package/dist/types/components/structural/CjaButton.vue.d.ts +47 -42
- package/dist/types/components/structural/CollapseContainer.vue.d.ts +22 -33
- package/dist/types/components/structural/ContentTabs.vue.d.ts +20 -17
- package/dist/types/components/structural/FixedContainer.vue.d.ts +56 -55
- package/dist/types/components/structural/GridContainer.vue.d.ts +11 -26
- package/dist/types/components/structural/GridItem.vue.d.ts +21 -18
- package/dist/types/components/structural/InfoMessage.vue.d.ts +29 -20
- package/dist/types/components/structural/LoadingSpinner.vue.d.ts +15 -16
- package/dist/types/components/structural/Modal.vue.d.ts +10 -15
- package/dist/types/utils/formValidations.d.ts +20 -2
- package/dist/types/utils/getFromUrl.d.ts +1 -1
- package/package.json +2 -2
- package/src/components/composite/CheckoutCrossSell.vue +50 -52
- package/src/components/structural/CjaButton.vue +1 -1
- package/src/stories/CjaButton.story.vue +2 -1
- package/src/stories/ContentTabs.story.vue +1 -1
- package/src/stories/Modal.story.vue +1 -1
- package/src/utils/cjaStore.ts +9 -6
- package/src/utils/formValidations.ts +67 -10
- package/src/utils/getFromUrl.ts +14 -6
- /package/src/utils/{getI18nMessages.ts → GetI18nMessages.ts} +0 -0
- /package/src/utils/{jsonReviver.ts → JsonReviver.ts} +0 -0
|
@@ -1,28 +1,23 @@
|
|
|
1
|
-
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<
|
|
2
|
-
title
|
|
3
|
-
|
|
1
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
2
|
+
title: {
|
|
3
|
+
type: import("vue").PropType<string>;
|
|
4
|
+
};
|
|
5
|
+
}, {
|
|
4
6
|
active: import("vue").Ref<boolean>;
|
|
5
7
|
openModal: () => void;
|
|
6
8
|
closeModal: () => void;
|
|
7
9
|
toggleModal: () => void;
|
|
8
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "close"[], "close", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<
|
|
9
|
-
title
|
|
10
|
-
|
|
10
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "close"[], "close", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
11
|
+
title: {
|
|
12
|
+
type: import("vue").PropType<string>;
|
|
13
|
+
};
|
|
14
|
+
}>> & {
|
|
11
15
|
onClose?: ((...args: any[]) => any) | undefined;
|
|
12
16
|
}, {}, {}>, {
|
|
13
17
|
body?(_: {}): any;
|
|
14
18
|
footer?(_: {}): any;
|
|
15
19
|
}>;
|
|
16
20
|
export default _default;
|
|
17
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
18
|
-
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
19
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
20
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
21
|
-
} : {
|
|
22
|
-
type: import('vue').PropType<T[K]>;
|
|
23
|
-
required: true;
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
21
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
27
22
|
new (): {
|
|
28
23
|
$slots: S;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import * as yup from "yup";
|
|
2
2
|
export declare const stringRequired: (messages: {
|
|
3
3
|
required: string;
|
|
4
|
+
minLength?: string;
|
|
5
|
+
maxLength?: string;
|
|
6
|
+
}, options?: {
|
|
7
|
+
minLength?: number;
|
|
8
|
+
maxLength?: number;
|
|
4
9
|
}) => yup.StringSchema<string, yup.AnyObject, undefined, "">;
|
|
5
10
|
export declare const emailRequired: (messages: {
|
|
6
11
|
required: string;
|
|
@@ -8,6 +13,11 @@ export declare const emailRequired: (messages: {
|
|
|
8
13
|
}) => yup.StringSchema<string, yup.AnyObject, undefined, "">;
|
|
9
14
|
export declare const numberRequired: (messages: {
|
|
10
15
|
required: string;
|
|
16
|
+
min?: string;
|
|
17
|
+
max?: string;
|
|
18
|
+
}, options?: {
|
|
19
|
+
min?: number;
|
|
20
|
+
max?: number;
|
|
11
21
|
}) => yup.NumberSchema<number, yup.AnyObject, undefined, "">;
|
|
12
22
|
export declare const phoneRequired: (messages: {
|
|
13
23
|
required: string;
|
|
@@ -34,8 +44,8 @@ export declare const fileDocumentRequired: (messages: {
|
|
|
34
44
|
export declare const dateRequired: (messages: {
|
|
35
45
|
required: string;
|
|
36
46
|
invalid: string;
|
|
37
|
-
|
|
38
|
-
|
|
47
|
+
minDate?: string;
|
|
48
|
+
maxDate?: string;
|
|
39
49
|
}, options?: {
|
|
40
50
|
format?: "mm/yyyy" | "dd/mm/yyyy";
|
|
41
51
|
maxDate?: Date;
|
|
@@ -45,3 +55,11 @@ export declare const nifRequired: (messages: {
|
|
|
45
55
|
required: string;
|
|
46
56
|
invalid: string;
|
|
47
57
|
}) => yup.StringSchema<string, yup.AnyObject, undefined, "">;
|
|
58
|
+
export declare const arrayRequired: (messages: {
|
|
59
|
+
required: string;
|
|
60
|
+
minLength?: string;
|
|
61
|
+
maxLength?: string;
|
|
62
|
+
}, options?: {
|
|
63
|
+
minLength?: number;
|
|
64
|
+
maxLength?: number;
|
|
65
|
+
}) => yup.ArraySchema<any[] | undefined, yup.AnyObject, undefined, "">;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const getFromUrl: (
|
|
1
|
+
export declare const getFromUrl: (searchParam: string, removeFromUrl?: boolean) => string | string[] | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cja-phoenix",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build:dev": "rimraf dist && vue-tsc && vite build -m development",
|
|
6
6
|
"build:link": "rimraf dist && vue-tsc && vite build -m development && npm link",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@gtm-support/vue-gtm": "^2.0.0",
|
|
26
|
+
"@histoire/plugin-vue": "^0.16.1",
|
|
26
27
|
"@types/node": "^17.0.14",
|
|
27
28
|
"@vitejs/plugin-vue": "^2.0.0",
|
|
28
|
-
"@histoire/plugin-vue": "^0.16.1",
|
|
29
29
|
"histoire": "^0.16.2",
|
|
30
30
|
"intl-tel-input": "^17.0.19",
|
|
31
31
|
"maska": "^2.1.7",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
:image="vert.image"
|
|
16
16
|
:label="vert.label"
|
|
17
17
|
:description="vert.description"
|
|
18
|
-
:model-value="crossSellData[vert.
|
|
19
|
-
@update:model-value="(v) => (crossSellData[vert.
|
|
18
|
+
:model-value="crossSellData[vert.value]"
|
|
19
|
+
@update:model-value="(v) => (crossSellData[vert.value] = v)"
|
|
20
20
|
/>
|
|
21
21
|
</div>
|
|
22
22
|
|
|
@@ -72,8 +72,8 @@
|
|
|
72
72
|
:image="vert.image"
|
|
73
73
|
:label="vert.label"
|
|
74
74
|
:description="vert.description"
|
|
75
|
-
:model-value="crossSellData[vert.
|
|
76
|
-
@update:model-value="(v) => (crossSellData[vert.
|
|
75
|
+
:model-value="crossSellData[vert.value]"
|
|
76
|
+
@update:model-value="(v) => (crossSellData[vert.value] = v)"
|
|
77
77
|
/>
|
|
78
78
|
</div>
|
|
79
79
|
</div>
|
|
@@ -136,50 +136,52 @@ const { t, setLocaleMessage } = useI18n({
|
|
|
136
136
|
|
|
137
137
|
const step = ref(1);
|
|
138
138
|
|
|
139
|
-
const crossSellOptions = computed(() =>
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
139
|
+
const crossSellOptions = computed(() =>
|
|
140
|
+
[
|
|
141
|
+
{
|
|
142
|
+
class: "all",
|
|
143
|
+
value: "all",
|
|
144
|
+
image: process.env.VUE_APP_IMG_URL + "xsell-checkout-cpj.svg",
|
|
145
|
+
label: t("xsell.checkout.input.all.title"),
|
|
146
|
+
description: t("xsell.checkout.input.all.description"),
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
class: "hl",
|
|
150
|
+
value: "mg",
|
|
151
|
+
image: process.env.VUE_APP_IMG_URL + "xsell-checkout-hl.svg",
|
|
152
|
+
label: t("xsell.checkout.input.hl.title"),
|
|
153
|
+
description: t("xsell.checkout.input.hl.description"),
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
class: "pl",
|
|
157
|
+
value: "pl",
|
|
158
|
+
image: process.env.VUE_APP_IMG_URL + "xsell-checkout-pl.svg",
|
|
159
|
+
label: t("xsell.checkout.input.pl.title"),
|
|
160
|
+
description: t("xsell.checkout.input.pl.description"),
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
class: "cc",
|
|
164
|
+
value: "cc",
|
|
165
|
+
image: process.env.VUE_APP_IMG_URL + "xsell-checkout-cc.svg",
|
|
166
|
+
label: t("xsell.checkout.input.cc.title"),
|
|
167
|
+
description: t("xsell.checkout.input.cc.description"),
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
class: "pl",
|
|
171
|
+
value: "csc",
|
|
172
|
+
image: process.env.VUE_APP_IMG_URL + "xsell-checkout-csc.svg",
|
|
173
|
+
label: t("xsell.checkout.input.csc.title"),
|
|
174
|
+
description: t("xsell.checkout.input.csc.description"),
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
class: "ci",
|
|
178
|
+
value: "ci",
|
|
179
|
+
image: process.env.VUE_APP_IMG_URL + "xsell-checkout-in.svg",
|
|
180
|
+
label: t("xsell.checkout.input.ci.title"),
|
|
181
|
+
description: t("xsell.checkout.input.ci.description"),
|
|
182
|
+
},
|
|
183
|
+
].filter((o) => o.value != props.activeVertical)
|
|
184
|
+
);
|
|
183
185
|
|
|
184
186
|
const crossSellData = ref({
|
|
185
187
|
all: true,
|
|
@@ -308,10 +310,6 @@ const submit = () => {
|
|
|
308
310
|
|
|
309
311
|
<style lang="scss" scoped>
|
|
310
312
|
.cross-sell-container {
|
|
311
|
-
padding-top: 40px;
|
|
312
|
-
margin-top: 40px;
|
|
313
|
-
border-top: 1px solid #dedede;
|
|
314
|
-
|
|
315
313
|
.cross-sell-wrapper {
|
|
316
314
|
max-width: 1050px;
|
|
317
315
|
margin: 0 auto;
|
package/src/utils/cjaStore.ts
CHANGED
|
@@ -17,10 +17,13 @@ export const getCjaStore = (options: {
|
|
|
17
17
|
...options.state,
|
|
18
18
|
}),
|
|
19
19
|
actions: {
|
|
20
|
-
changeJourneyID(
|
|
21
|
-
this
|
|
20
|
+
changeJourneyID(journeyId: string): void {
|
|
21
|
+
this.journeyId = journeyId;
|
|
22
22
|
},
|
|
23
|
-
changeData(
|
|
23
|
+
changeData(
|
|
24
|
+
payload: { key: string; value: any },
|
|
25
|
+
target: string = "data"
|
|
26
|
+
): void {
|
|
24
27
|
const field = this[target][payload.key];
|
|
25
28
|
|
|
26
29
|
if (field) {
|
|
@@ -33,10 +36,10 @@ export const getCjaStore = (options: {
|
|
|
33
36
|
|
|
34
37
|
if (field.options) {
|
|
35
38
|
field.label = Array.isArray(field.value)
|
|
36
|
-
?
|
|
37
|
-
(v) => field.options.find((
|
|
39
|
+
? field.value.map(
|
|
40
|
+
(v) => field.options.find((k) => k.value == v)?.label
|
|
38
41
|
)
|
|
39
|
-
: field.options.find((k) => k.value ==
|
|
42
|
+
: field.options.find((k) => k.value == field.value)?.label;
|
|
40
43
|
}
|
|
41
44
|
} else {
|
|
42
45
|
field.value = payload.value;
|
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
import * as yup from "yup";
|
|
2
2
|
|
|
3
|
-
export const stringRequired = (
|
|
4
|
-
|
|
3
|
+
export const stringRequired = (
|
|
4
|
+
messages: { required: string; minLength?: string; maxLength?: string },
|
|
5
|
+
options?: { minLength?: number; maxLength?: number }
|
|
6
|
+
) => {
|
|
7
|
+
let validation = yup
|
|
8
|
+
.string()
|
|
9
|
+
.typeError(messages.required)
|
|
10
|
+
.required(messages.required);
|
|
11
|
+
|
|
12
|
+
if (options?.minLength && messages.minLength) {
|
|
13
|
+
validation = validation.min(options.minLength, messages.minLength);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (options?.maxLength && messages.maxLength) {
|
|
17
|
+
validation = validation.min(options.maxLength, messages.maxLength);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return validation;
|
|
21
|
+
};
|
|
5
22
|
|
|
6
23
|
export const emailRequired = (messages: { required: string; email: string }) =>
|
|
7
24
|
yup
|
|
@@ -10,8 +27,28 @@ export const emailRequired = (messages: { required: string; email: string }) =>
|
|
|
10
27
|
.required(messages.required)
|
|
11
28
|
.email(messages.email);
|
|
12
29
|
|
|
13
|
-
export const numberRequired = (
|
|
14
|
-
|
|
30
|
+
export const numberRequired = (
|
|
31
|
+
messages: { required: string; min?: string; max?: string },
|
|
32
|
+
options?: {
|
|
33
|
+
min?: number;
|
|
34
|
+
max?: number;
|
|
35
|
+
}
|
|
36
|
+
) => {
|
|
37
|
+
let validation = yup
|
|
38
|
+
.number()
|
|
39
|
+
.typeError(messages.required)
|
|
40
|
+
.required(messages.required);
|
|
41
|
+
|
|
42
|
+
if (options?.min && messages.min) {
|
|
43
|
+
validation = validation.min(options.min, messages.min);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (options?.max && messages.max) {
|
|
47
|
+
validation = validation.max(options.max, messages.max);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return validation;
|
|
51
|
+
};
|
|
15
52
|
|
|
16
53
|
export const phoneRequired = (messages: { required: string; phone: string }) =>
|
|
17
54
|
yup
|
|
@@ -54,8 +91,8 @@ export const dateRequired = (
|
|
|
54
91
|
messages: {
|
|
55
92
|
required: string;
|
|
56
93
|
invalid: string;
|
|
57
|
-
|
|
58
|
-
|
|
94
|
+
minDate?: string;
|
|
95
|
+
maxDate?: string;
|
|
59
96
|
},
|
|
60
97
|
options?: {
|
|
61
98
|
format?: "mm/yyyy" | "dd/mm/yyyy";
|
|
@@ -85,12 +122,12 @@ export const dateRequired = (
|
|
|
85
122
|
context.originalValue.split("/")[yearPosition].length == 4
|
|
86
123
|
);
|
|
87
124
|
|
|
88
|
-
if (options?.minDate) {
|
|
89
|
-
validation = validation.min(options.minDate, messages.
|
|
125
|
+
if (options?.minDate && messages.minDate) {
|
|
126
|
+
validation = validation.min(options.minDate, messages.minDate);
|
|
90
127
|
}
|
|
91
128
|
|
|
92
|
-
if (options?.maxDate) {
|
|
93
|
-
validation = validation.max(options.maxDate, messages.
|
|
129
|
+
if (options?.maxDate && messages.maxDate) {
|
|
130
|
+
validation = validation.max(options.maxDate, messages.maxDate);
|
|
94
131
|
}
|
|
95
132
|
|
|
96
133
|
return validation;
|
|
@@ -117,3 +154,23 @@ export const nifRequired = (messages: { required: string; invalid: string }) =>
|
|
|
117
154
|
11;
|
|
118
155
|
return Number(nif[8]) == (mod == 0 || mod == 1 ? 0 : 11 - mod);
|
|
119
156
|
});
|
|
157
|
+
|
|
158
|
+
export const arrayRequired = (
|
|
159
|
+
messages: { required: string; minLength?: string; maxLength?: string },
|
|
160
|
+
options?: { minLength?: number; maxLength?: number }
|
|
161
|
+
) => {
|
|
162
|
+
let validation = yup
|
|
163
|
+
.array()
|
|
164
|
+
.typeError(messages.required)
|
|
165
|
+
.min(1, messages.required);
|
|
166
|
+
|
|
167
|
+
if (options?.minLength && messages.minLength) {
|
|
168
|
+
validation = validation.min(options.minLength, messages.minLength);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (options?.maxLength && messages.maxLength) {
|
|
172
|
+
validation = validation.min(options.maxLength, messages.maxLength);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
return validation;
|
|
176
|
+
};
|
package/src/utils/getFromUrl.ts
CHANGED
|
@@ -1,17 +1,25 @@
|
|
|
1
|
-
export const getFromUrl = (
|
|
1
|
+
export const getFromUrl = (searchParam: string, removeFromUrl?: boolean) => {
|
|
2
2
|
const url = new URL(window.location.href);
|
|
3
3
|
|
|
4
|
-
return url.searchParams.has(
|
|
4
|
+
return url.searchParams.has(searchParam)
|
|
5
5
|
? (() => {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
const param = url.searchParams
|
|
7
|
+
.getAll(searchParam)
|
|
8
|
+
.map((p) => decodeURIComponent(p));
|
|
8
9
|
|
|
9
10
|
if (removeFromUrl) {
|
|
10
|
-
url.searchParams.delete(
|
|
11
|
+
url.searchParams.delete(searchParam);
|
|
11
12
|
history.replaceState(history.state, "", url.toString());
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
switch (param.length) {
|
|
16
|
+
case 0:
|
|
17
|
+
return undefined;
|
|
18
|
+
case 1:
|
|
19
|
+
return param[0];
|
|
20
|
+
default:
|
|
21
|
+
return param;
|
|
22
|
+
}
|
|
15
23
|
})()
|
|
16
24
|
: undefined;
|
|
17
25
|
};
|
|
File without changes
|
|
File without changes
|