@vergelijkdirect/comparison-forms 2.0.2 → 2.1.0-ver-9053.1
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 +5 -5
- package/dist/vue/VdInput-CRb-iTiH.js +145 -0
- package/dist/vue/VdPopover-B78nVpNU.js +200 -0
- package/dist/vue/VdRadioGroup-D5kHcpsY.js +166 -0
- package/dist/vue/VdSearchableSelect-THqVGo_Q.js +209 -0
- package/dist/vue/VdSelect-Dv35x4sz.js +112 -0
- package/dist/vue/bike-Ch7ZcSpI.js +2 -0
- package/dist/vue/bike.presenter-CdCny1-M.js +1673 -0
- package/dist/vue/birthdate.schema-B9q6IeIR.js +91 -0
- package/dist/vue/businessCar.presenter-DR-Ozf6B.js +121 -0
- package/dist/vue/businessLiability-w4xhGnik.js +2 -0
- package/dist/vue/businessLiability.presenter-8iyRbLgw.js +80 -0
- package/dist/vue/car-business-DMYPV4UK.js +2 -0
- package/dist/vue/car-jPvIXEVK.js +2 -0
- package/dist/vue/car.presenter-gd62kiqS.js +130 -0
- package/dist/vue/caravan-B8l6zEkk.js +2 -0
- package/dist/vue/caravan.presenter-Cr5vuB_r.js +157 -0
- package/dist/vue/company.schema-DStHJpGH.js +241 -0
- package/dist/vue/comparison-forms.d.ts +34 -34
- package/dist/vue/comparison-forms.js +119 -5590
- package/dist/vue/date.util-DjJZwKvn.js +24 -0
- package/dist/vue/familyComposition.enum-D26VYo_a.js +6 -0
- package/dist/vue/familyComposition.schema-CNMH-wP0.js +75 -0
- package/dist/vue/house-BtQscoRa.js +2 -0
- package/dist/vue/house.presenter-DLeGfJAY.js +118 -0
- package/dist/vue/houseOwnedBuilding.model-BLLI1Vm0.js +14 -0
- package/dist/vue/itc-KSDsJZsI.js +10 -0
- package/dist/vue/legal-BjG3LO5G.js +2 -0
- package/dist/vue/legal.presenter-CwEVdXZJ.js +100 -0
- package/dist/vue/liability-_Sp33TSY.js +2 -0
- package/dist/vue/liability.presenter-C_5O-OQm.js +110 -0
- package/dist/vue/loan-T0OYMmxG.js +2 -0
- package/dist/vue/loan.presenter-CEZ3PcSo.js +198 -0
- package/dist/vue/messages-DRFu-PCu.js +40 -0
- package/dist/vue/moped-D9KUmwn6.js +2 -0
- package/dist/vue/moped.presenter-DazWxVEM.js +133 -0
- package/dist/vue/motor-BEAQ5N4w.js +2 -0
- package/dist/vue/motor.presenter-e_ESWwhI.js +130 -0
- package/dist/vue/package-DjsxU0ny.js +2 -0
- package/dist/vue/package.presenter-BA6S0X_L.js +137 -0
- package/dist/vue/pet-Bguvk2H4.js +2 -0
- package/dist/vue/pet.presenter-BpDDlFSQ.js +170 -0
- package/dist/vue/rules-3BZkSj_K.js +13 -0
- package/dist/vue/travel-C_cvpQNA.js +2 -0
- package/dist/vue/travel.presenter-DeoXBmrT.js +108 -0
- package/dist/vue/useAddress-C-h1pGI5.js +245 -0
- package/dist/vue/useLicensePlate-wAVrX9tr.js +187 -0
- package/dist/vue/useValidator-B8ZuqyvJ.js +535 -0
- package/dist/vue/yesNo-BvJlCm7Y.js +6 -0
- package/dist/wc/comparison-forms.js +14836 -14413
- package/dist/wc-noitc/comparison-forms.umd.cjs +3 -3
- package/package.json +1 -1
- package/dist/client/.vite/ssr-manifest.json +0 -600
- package/dist/client/assets/index-6Enzr9rU.css +0 -4
- package/dist/client/assets/index-6Enzr9rU.css.br +0 -0
- package/dist/client/assets/index-DUchBxEo.js +0 -57
- package/dist/client/assets/index-DUchBxEo.js.br +0 -0
- package/dist/client/index.html +0 -15
- package/dist/server/entry-server.js +0 -9981
- package/dist/server/entry-server.js.br +0 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { i as e, o as t, r as n, s as r, t as i, u as a } from "./useValidator-B8ZuqyvJ.js";
|
|
2
|
+
import { t as o } from "./VdRadioGroup-D5kHcpsY.js";
|
|
3
|
+
import { t as s } from "./VdPopover-B78nVpNU.js";
|
|
4
|
+
import { a as c, t as l } from "./birthdate.schema-B9q6IeIR.js";
|
|
5
|
+
import { t as u } from "./messages-DRFu-PCu.js";
|
|
6
|
+
import { n as d } from "./rules-3BZkSj_K.js";
|
|
7
|
+
import { createBlock as f, createVNode as p, defineComponent as m, isRef as h, mergeDefaults as g, mergeProps as _, openBlock as v, unref as y, withCtx as b } from "vue";
|
|
8
|
+
import { object as x } from "yup";
|
|
9
|
+
//#region src/comparisons/travel/paymentTerm.enum.ts
|
|
10
|
+
var S = /* @__PURE__ */ function(e) {
|
|
11
|
+
return e.Continuous = "L", e.ShortTerm = "S", e;
|
|
12
|
+
}({}), C = x({
|
|
13
|
+
PaymentTerm: d([S.Continuous, S.ShortTerm], u.travel.paymentTermRequired),
|
|
14
|
+
birthdate: l()
|
|
15
|
+
}), w = [{
|
|
16
|
+
value: S.Continuous,
|
|
17
|
+
label: "Doorlopend"
|
|
18
|
+
}, {
|
|
19
|
+
value: S.ShortTerm,
|
|
20
|
+
label: "Kortlopend"
|
|
21
|
+
}], T = /* @__PURE__ */ m({
|
|
22
|
+
__name: "TravelForm",
|
|
23
|
+
props: /*@__PURE__*/ g({
|
|
24
|
+
initialData: {},
|
|
25
|
+
title: {},
|
|
26
|
+
description: {},
|
|
27
|
+
banner: {},
|
|
28
|
+
layout: {},
|
|
29
|
+
card: { type: Boolean },
|
|
30
|
+
flat: { type: Boolean },
|
|
31
|
+
fullWidth: { type: Boolean },
|
|
32
|
+
submitLabel: {},
|
|
33
|
+
submitDisabled: { type: Boolean }
|
|
34
|
+
}, {
|
|
35
|
+
...t,
|
|
36
|
+
title: "Reisverzekering vergelijken"
|
|
37
|
+
}),
|
|
38
|
+
emits: ["submitted"],
|
|
39
|
+
setup(t, { emit: a }) {
|
|
40
|
+
let l = t, u = r(l), d = a, { isSubmitting: m, handleSubmit: g, defineField: x } = i(C, {
|
|
41
|
+
PaymentTerm: l.initialData?.PaymentTerm ?? S.Continuous,
|
|
42
|
+
birthdate: l.initialData?.birthdate ?? ""
|
|
43
|
+
}), [T, E, D] = x("PaymentTerm", { validateAt: "change" }), [O, k, A] = x("birthdate");
|
|
44
|
+
function j() {
|
|
45
|
+
g((e) => {
|
|
46
|
+
d("submitted", { ...e });
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return (r, i) => (v(), f(y(n), _(y(u), {
|
|
50
|
+
"submit-disabled": t.submitDisabled || y(m),
|
|
51
|
+
onSubmit: j
|
|
52
|
+
}), {
|
|
53
|
+
default: b(() => [p(y(e), {
|
|
54
|
+
span: "5",
|
|
55
|
+
md: "6"
|
|
56
|
+
}, {
|
|
57
|
+
default: b(() => [p(y(o), _({
|
|
58
|
+
modelValue: y(T),
|
|
59
|
+
"onUpdate:modelValue": i[0] ||= (e) => h(T) ? T.value = e : null,
|
|
60
|
+
legend: "Kies je dekking",
|
|
61
|
+
name: "PaymentTerm",
|
|
62
|
+
options: y(w),
|
|
63
|
+
variant: "boxed",
|
|
64
|
+
required: !1,
|
|
65
|
+
"error-message": y(D)
|
|
66
|
+
}, y(E)), {
|
|
67
|
+
popover: b(() => [p(y(s), {
|
|
68
|
+
"ref-variant": "blue-icon",
|
|
69
|
+
"tooltip-variant": "blue",
|
|
70
|
+
"tooltip-size": "small",
|
|
71
|
+
content: {
|
|
72
|
+
title: "Kies je dekking",
|
|
73
|
+
description: "Doorlopend is al goedkoper wanneer je meer dan 1 keer op vakantie gaat. Ook weekendjes weg zijn meeverzekerd!"
|
|
74
|
+
}
|
|
75
|
+
})]),
|
|
76
|
+
_: 1
|
|
77
|
+
}, 16, [
|
|
78
|
+
"modelValue",
|
|
79
|
+
"options",
|
|
80
|
+
"error-message"
|
|
81
|
+
])]),
|
|
82
|
+
_: 1
|
|
83
|
+
}), p(y(e), {
|
|
84
|
+
span: "5",
|
|
85
|
+
md: "6"
|
|
86
|
+
}, {
|
|
87
|
+
default: b(() => [p(y(c), _({
|
|
88
|
+
modelValue: y(O),
|
|
89
|
+
"onUpdate:modelValue": i[1] ||= (e) => h(O) ? O.value = e : null,
|
|
90
|
+
"error-message": y(A)
|
|
91
|
+
}, y(k)), null, 16, ["modelValue", "error-message"])]),
|
|
92
|
+
_: 1
|
|
93
|
+
})]),
|
|
94
|
+
_: 1
|
|
95
|
+
}, 16, ["submit-disabled"]));
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
//#endregion
|
|
99
|
+
//#region src/comparisons/travel/travel.presenter.ts
|
|
100
|
+
function E(e) {
|
|
101
|
+
return {
|
|
102
|
+
comparison: a.Travel,
|
|
103
|
+
detail: { comparison: { PaymentTerm: e.PaymentTerm } },
|
|
104
|
+
user: { birthdate: e.birthdate }
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
//#endregion
|
|
108
|
+
export { T as n, E as t };
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { a as e, i as t, n } from "./useValidator-B8ZuqyvJ.js";
|
|
2
|
+
import { t as r } from "./VdInput-CRb-iTiH.js";
|
|
3
|
+
import { t as i } from "./VdSelect-Dv35x4sz.js";
|
|
4
|
+
import { n as a } from "./itc-KSDsJZsI.js";
|
|
5
|
+
import { computed as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, createVNode as d, defineComponent as f, isRef as p, mergeModels as m, nextTick as h, normalizeClass as g, onMounted as _, openBlock as v, ref as y, renderSlot as b, toDisplayString as x, unref as S, useModel as C, watch as w, withCtx as T } from "vue";
|
|
6
|
+
import { object as E, string as D } from "yup";
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/components/ui/form/VdFormGroup.vue
|
|
9
|
+
var O = /* @__PURE__ */ f({
|
|
10
|
+
__name: "VdFormGroup",
|
|
11
|
+
props: {
|
|
12
|
+
span: { default: null },
|
|
13
|
+
md: { default: null }
|
|
14
|
+
},
|
|
15
|
+
setup(e) {
|
|
16
|
+
let t = e, n = o(() => [
|
|
17
|
+
"vd-form__group",
|
|
18
|
+
t.span == null ? null : `vd-form__col-${t.span}`,
|
|
19
|
+
t.md == null ? null : `vd-form__col-md-${t.md}`
|
|
20
|
+
]);
|
|
21
|
+
return (e, t) => (v(), c("div", { class: g(n.value) }, [b(e.$slots, "default")], 2));
|
|
22
|
+
}
|
|
23
|
+
}), k = { class: "vd-field" }, A = {
|
|
24
|
+
key: 0,
|
|
25
|
+
class: "vd-field__message vd-field__message--error"
|
|
26
|
+
}, j = {
|
|
27
|
+
key: 1,
|
|
28
|
+
class: "vd-field__message vd-field__message--information"
|
|
29
|
+
}, M = /* @__PURE__ */ f({
|
|
30
|
+
__name: "VdAddress",
|
|
31
|
+
props: /*@__PURE__*/ m({
|
|
32
|
+
path: { default: "address" },
|
|
33
|
+
additionOptions: {}
|
|
34
|
+
}, {
|
|
35
|
+
resolvedAddress: { required: !0 },
|
|
36
|
+
resolvedAddressModifiers: {}
|
|
37
|
+
}),
|
|
38
|
+
emits: ["update:resolvedAddress"],
|
|
39
|
+
setup(a) {
|
|
40
|
+
let f = a, m = C(a, "resolvedAddress"), { path: g } = f, { defineField: y, validateField: b, getFieldMeta: E, getError: D, removeError: M } = n(), [N, , P] = y(`${g}.zipCode`), [F, , I] = y(`${g}.houseNumber`), [L, , R] = y(`${g}.houseNumberAddition`), z = async () => {
|
|
41
|
+
await b(g), L.value || M(`${g}.houseNumberAddition`);
|
|
42
|
+
}, B = (e) => {
|
|
43
|
+
N.value && F.value ? z() : b(e);
|
|
44
|
+
}, V = () => B(`${g}.zipCode`), H = () => B(`${g}.houseNumber`), U = () => h(() => b(g)), W = E(g), G = o(() => D(g) ?? ""), K = o(() => m.value !== null), q = o(() => f.additionOptions.length === 0 ? "-" : "Kies een toevoeging");
|
|
45
|
+
return w([N, F], () => {
|
|
46
|
+
L.value &&= "", m.value = null, M(g), M(`${g}.houseNumberAddition`);
|
|
47
|
+
}), w(L, () => {
|
|
48
|
+
m.value = null;
|
|
49
|
+
}), _(() => {
|
|
50
|
+
N.value && F.value && z();
|
|
51
|
+
}), (n, o) => (v(), c("div", k, [d(e, null, {
|
|
52
|
+
default: T(() => [d(t, {
|
|
53
|
+
span: "5",
|
|
54
|
+
md: "3"
|
|
55
|
+
}, {
|
|
56
|
+
default: T(() => [d(r, {
|
|
57
|
+
modelValue: S(N),
|
|
58
|
+
"onUpdate:modelValue": o[0] ||= (e) => p(N) ? N.value = e : null,
|
|
59
|
+
modelModifiers: { trim: !0 },
|
|
60
|
+
name: "zipCode",
|
|
61
|
+
label: "Postcode",
|
|
62
|
+
placeholder: "bv. 1234 AZ",
|
|
63
|
+
"error-message": S(P),
|
|
64
|
+
mask: "####@@",
|
|
65
|
+
capitalize: "",
|
|
66
|
+
autocomplete: "",
|
|
67
|
+
required: !1,
|
|
68
|
+
verified: K.value,
|
|
69
|
+
loading: S(W).isValidating,
|
|
70
|
+
onBlur: V
|
|
71
|
+
}, null, 8, [
|
|
72
|
+
"modelValue",
|
|
73
|
+
"error-message",
|
|
74
|
+
"verified",
|
|
75
|
+
"loading"
|
|
76
|
+
])]),
|
|
77
|
+
_: 1
|
|
78
|
+
}), d(O, {
|
|
79
|
+
span: "7",
|
|
80
|
+
md: "3"
|
|
81
|
+
}, {
|
|
82
|
+
default: T(() => [d(r, {
|
|
83
|
+
modelValue: S(F),
|
|
84
|
+
"onUpdate:modelValue": o[1] ||= (e) => p(F) ? F.value = e : null,
|
|
85
|
+
modelModifiers: { trim: !0 },
|
|
86
|
+
name: "houseNumber",
|
|
87
|
+
label: "Huisnummer",
|
|
88
|
+
placeholder: "bv. 1",
|
|
89
|
+
inputmode: "numeric",
|
|
90
|
+
"error-message": S(I),
|
|
91
|
+
autocomplete: "",
|
|
92
|
+
required: !1,
|
|
93
|
+
verified: K.value,
|
|
94
|
+
loading: S(W).isValidating,
|
|
95
|
+
onBlur: H
|
|
96
|
+
}, null, 8, [
|
|
97
|
+
"modelValue",
|
|
98
|
+
"error-message",
|
|
99
|
+
"verified",
|
|
100
|
+
"loading"
|
|
101
|
+
]), d(i, {
|
|
102
|
+
modelValue: S(L),
|
|
103
|
+
"onUpdate:modelValue": o[2] ||= (e) => p(L) ? L.value = e : null,
|
|
104
|
+
name: "houseNumberAddition",
|
|
105
|
+
label: "Toevoeging",
|
|
106
|
+
placeholder: q.value,
|
|
107
|
+
options: a.additionOptions,
|
|
108
|
+
"error-message": S(R),
|
|
109
|
+
disabled: a.additionOptions.length === 0 || S(W).isValidating,
|
|
110
|
+
verified: K.value,
|
|
111
|
+
required: !1,
|
|
112
|
+
onSelect: U
|
|
113
|
+
}, null, 8, [
|
|
114
|
+
"modelValue",
|
|
115
|
+
"placeholder",
|
|
116
|
+
"options",
|
|
117
|
+
"error-message",
|
|
118
|
+
"disabled",
|
|
119
|
+
"verified"
|
|
120
|
+
])]),
|
|
121
|
+
_: 1
|
|
122
|
+
})]),
|
|
123
|
+
_: 1
|
|
124
|
+
}), G.value ? (v(), c("div", A, [o[3] ||= l("i", { class: "fas fa-exclamation-circle vd-field__message-icon" }, null, -1), u(" " + x(G.value), 1)])) : m.value ? (v(), c("div", j, [o[4] ||= l("i", { class: "fas fa-info-circle vd-field__message-icon" }, null, -1), u(" " + x(m.value.street) + ", " + x(m.value.city), 1)])) : s("", !0)]));
|
|
125
|
+
}
|
|
126
|
+
}), N = (e) => ({
|
|
127
|
+
zipCode: e.ZipCode,
|
|
128
|
+
houseNumber: String(e.HouseNumber),
|
|
129
|
+
houseNumberAddition: e.HouseNumberAddition,
|
|
130
|
+
city: e.Place,
|
|
131
|
+
street: e.Street
|
|
132
|
+
}), P = /^\d{4}\s?[a-zA-Z]{2}$/, F = /^\d+$/, I = {
|
|
133
|
+
"needs-addition": "Een toevoeging is verplicht",
|
|
134
|
+
"not-found": "Postcode en huisnummer combinatie onbekend.",
|
|
135
|
+
error: "Adres ophalen is mislukt. Probeer het opnieuw."
|
|
136
|
+
};
|
|
137
|
+
function L(e) {
|
|
138
|
+
return e.replace(/\s/g, "").toUpperCase();
|
|
139
|
+
}
|
|
140
|
+
var R = "NO_ADDITION";
|
|
141
|
+
function z(e) {
|
|
142
|
+
return e === R ? "" : e.replace("-", "");
|
|
143
|
+
}
|
|
144
|
+
var B = (e) => e instanceof Error, V = (e) => {
|
|
145
|
+
if (B(e)) throw e;
|
|
146
|
+
return null;
|
|
147
|
+
}, H = (e, t, n) => a().dataValidationService.validateZipCode(e, t, n).then((e) => e).catch(V), U = (e, t) => a().homeService.getAddition({
|
|
148
|
+
zipcode: e,
|
|
149
|
+
houseNumber: t
|
|
150
|
+
}).then((e) => e ?? []).catch(V), W = async (e, t) => {
|
|
151
|
+
let [n, r] = await Promise.all([H(e, t), U(e, t)]);
|
|
152
|
+
return !n && !r?.length ? null : {
|
|
153
|
+
validWithoutAddition: !!n,
|
|
154
|
+
template: n,
|
|
155
|
+
additions: r ?? []
|
|
156
|
+
};
|
|
157
|
+
}, G = (e) => {
|
|
158
|
+
let t = e.additions.map((e) => ({
|
|
159
|
+
title: e,
|
|
160
|
+
value: z(e)
|
|
161
|
+
}));
|
|
162
|
+
return e.validWithoutAddition && t.length ? [{
|
|
163
|
+
title: "Geen toevoeging",
|
|
164
|
+
value: R
|
|
165
|
+
}, ...t] : t;
|
|
166
|
+
}, K = (e) => ({
|
|
167
|
+
zipCode: e?.zipCode ?? "",
|
|
168
|
+
houseNumber: e?.houseNumber ?? "",
|
|
169
|
+
houseNumberAddition: e ? e.houseNumberAddition || R : ""
|
|
170
|
+
}), q = (e) => {
|
|
171
|
+
let t = e?.path ?? "address", n = K(e?.initial), r = y(null), i = y([]), a = 0, o = null, s = async (e) => {
|
|
172
|
+
let t = L(e.zipCode), n = e.houseNumber.trim(), r = z(e.houseNumberAddition), i = `${t}:${n}`;
|
|
173
|
+
try {
|
|
174
|
+
let a = o?.key === i ? o : null;
|
|
175
|
+
if (!a) {
|
|
176
|
+
let e = await W(t, n);
|
|
177
|
+
if (!e) return {
|
|
178
|
+
status: "not-found",
|
|
179
|
+
options: [],
|
|
180
|
+
address: null
|
|
181
|
+
};
|
|
182
|
+
a = o = {
|
|
183
|
+
key: i,
|
|
184
|
+
verdict: e
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
let s = G(a.verdict);
|
|
188
|
+
if (a.verdict.additions.length && !e.houseNumberAddition) return {
|
|
189
|
+
status: "needs-addition",
|
|
190
|
+
options: s,
|
|
191
|
+
address: null
|
|
192
|
+
};
|
|
193
|
+
if (!a.verdict.template) {
|
|
194
|
+
let e = await H(t, n, r);
|
|
195
|
+
if (!e) return {
|
|
196
|
+
status: "not-found",
|
|
197
|
+
options: [],
|
|
198
|
+
address: null
|
|
199
|
+
};
|
|
200
|
+
a.verdict.template = e;
|
|
201
|
+
}
|
|
202
|
+
return {
|
|
203
|
+
status: "resolved",
|
|
204
|
+
options: s,
|
|
205
|
+
address: r ? {
|
|
206
|
+
...a.verdict.template,
|
|
207
|
+
HouseNumberAddition: r
|
|
208
|
+
} : a.verdict.template
|
|
209
|
+
};
|
|
210
|
+
} catch (e) {
|
|
211
|
+
return console.error("Error on ITC address lookup", e), {
|
|
212
|
+
status: "error",
|
|
213
|
+
options: [],
|
|
214
|
+
address: null
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
}, c = async (e) => {
|
|
218
|
+
let t = ++a, n = await s(e), o = t !== a;
|
|
219
|
+
return o || (i.value = n.options, r.value = n.address ? N(n.address) : null), {
|
|
220
|
+
...n,
|
|
221
|
+
stale: o
|
|
222
|
+
};
|
|
223
|
+
};
|
|
224
|
+
return {
|
|
225
|
+
path: t,
|
|
226
|
+
addressSchema: E({
|
|
227
|
+
zipCode: D().required("Vul je postcode in").matches(P, "Postcode is incorrect"),
|
|
228
|
+
houseNumber: D().required("Huisnummer is verplicht").matches(F, "Huisnummer is incorrect"),
|
|
229
|
+
houseNumberAddition: D().defined()
|
|
230
|
+
}).test("address-lookup", async (e, t) => {
|
|
231
|
+
let n = L(e.zipCode ?? ""), r = String(e.houseNumber ?? "").trim();
|
|
232
|
+
if (!P.test(n) || !F.test(r)) return !0;
|
|
233
|
+
let { status: i, stale: a } = await c(e);
|
|
234
|
+
return a || i === "resolved" ? !0 : i === "needs-addition" ? t.createError({
|
|
235
|
+
path: `${t.path}.houseNumberAddition`,
|
|
236
|
+
message: I[i]
|
|
237
|
+
}) : t.createError({ message: I[i] });
|
|
238
|
+
}),
|
|
239
|
+
draft: n,
|
|
240
|
+
resolvedAddress: r,
|
|
241
|
+
additionOptions: i
|
|
242
|
+
};
|
|
243
|
+
};
|
|
244
|
+
//#endregion
|
|
245
|
+
export { M as n, q as t };
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { u as e } from "./useValidator-B8ZuqyvJ.js";
|
|
2
|
+
import { t } from "./VdInput-CRb-iTiH.js";
|
|
3
|
+
import { n } from "./itc-KSDsJZsI.js";
|
|
4
|
+
import { Fragment as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createSlots as l, createTextVNode as u, defineComponent as d, mergeModels as f, mergeProps as p, openBlock as m, ref as h, renderSlot as g, toDisplayString as _, unref as v, useAttrs as y, useModel as b, useSlots as x, watch as S, withCtx as C } from "vue";
|
|
5
|
+
import { string as w } from "yup";
|
|
6
|
+
//#region src/components/fields/licensePlate/licensePlate.model.ts
|
|
7
|
+
var T = {
|
|
8
|
+
[e.Car]: {
|
|
9
|
+
apiTypes: ["Car", "Van"],
|
|
10
|
+
dutch: "auto",
|
|
11
|
+
icon: "fa-car"
|
|
12
|
+
},
|
|
13
|
+
[e.Motor]: {
|
|
14
|
+
apiTypes: ["Motor", "MP3Motor"],
|
|
15
|
+
dutch: "motor",
|
|
16
|
+
icon: "fa-motorcycle"
|
|
17
|
+
},
|
|
18
|
+
[e.Moped]: {
|
|
19
|
+
apiTypes: ["Moped"],
|
|
20
|
+
dutch: "brommer",
|
|
21
|
+
icon: "moped-solid"
|
|
22
|
+
},
|
|
23
|
+
[e.Caravan]: {
|
|
24
|
+
apiTypes: ["Caravan"],
|
|
25
|
+
dutch: "caravan",
|
|
26
|
+
icon: "fa-caravan-alt"
|
|
27
|
+
}
|
|
28
|
+
}, E = Object.fromEntries(Object.values(T).flatMap(({ apiTypes: e, icon: t }) => e.map((e) => [e.toLowerCase(), t]))), D = {
|
|
29
|
+
brommobiel: "fa-car-side",
|
|
30
|
+
"speed pedelec": "fa-bicycle"
|
|
31
|
+
}, O = (e) => !!e?.Brand && !!e.Model && !!e.ManufacturingYear, k = (e) => {
|
|
32
|
+
if (!e) return "";
|
|
33
|
+
let t = String(e.Model ?? "").toLowerCase().trim(), n = String(e.VehicleType ?? "").toLowerCase();
|
|
34
|
+
return D[t] ?? E[n] ?? "";
|
|
35
|
+
}, A = (e) => e ? `${e.Brand} ${e.Model} (${e.ManufacturingYear})` : "", j = [
|
|
36
|
+
"@@-##-@@",
|
|
37
|
+
"##-##-@@",
|
|
38
|
+
"##-@@-@@",
|
|
39
|
+
"@@-@@-##",
|
|
40
|
+
"##-@@-##",
|
|
41
|
+
"@@-##-##",
|
|
42
|
+
"##-@@@-#",
|
|
43
|
+
"@@-###-@",
|
|
44
|
+
"@-###-@@",
|
|
45
|
+
"#-@@@-##",
|
|
46
|
+
"@@@-##-@",
|
|
47
|
+
"@-##-@@@",
|
|
48
|
+
"#-@@-###",
|
|
49
|
+
"###-@@-#"
|
|
50
|
+
];
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/components/fields/licensePlate/licensePlate.util.ts
|
|
53
|
+
function M(e) {
|
|
54
|
+
return e.replace(/[\s\\-]/g, "");
|
|
55
|
+
}
|
|
56
|
+
var N = "*".repeat(6), P = j.map((e) => e.replace(/-/g, ""));
|
|
57
|
+
function F(e) {
|
|
58
|
+
let t = M(e).slice(0, 6);
|
|
59
|
+
if (t.length < 6) return N;
|
|
60
|
+
let n = [...t].map((e) => /[0-9]/.test(e) ? "#" : "@").join(""), r = P.indexOf(n);
|
|
61
|
+
return r === -1 ? N : j[r];
|
|
62
|
+
}
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/components/fields/licensePlate/VdLicensePlate.vue?vue&type=script&setup=true&lang.ts
|
|
65
|
+
var I = {
|
|
66
|
+
key: 0,
|
|
67
|
+
class: "vd-input-license-plate__loading-information"
|
|
68
|
+
}, L = ["src"], R = /* @__PURE__ */ d({
|
|
69
|
+
inheritAttrs: !1,
|
|
70
|
+
__name: "VdLicensePlate",
|
|
71
|
+
props: /*@__PURE__*/ f({
|
|
72
|
+
name: {},
|
|
73
|
+
label: { default: "Kenteken" },
|
|
74
|
+
errorMessage: { default: null },
|
|
75
|
+
loading: {
|
|
76
|
+
type: Boolean,
|
|
77
|
+
default: !1
|
|
78
|
+
},
|
|
79
|
+
required: {
|
|
80
|
+
type: Boolean,
|
|
81
|
+
default: !1
|
|
82
|
+
}
|
|
83
|
+
}, {
|
|
84
|
+
modelValue: { default: "" },
|
|
85
|
+
modelModifiers: {},
|
|
86
|
+
vehicleData: { default: null },
|
|
87
|
+
vehicleDataModifiers: {}
|
|
88
|
+
}),
|
|
89
|
+
emits: /*@__PURE__*/ f(["input"], ["update:modelValue", "update:vehicleData"]),
|
|
90
|
+
setup(e, { emit: n }) {
|
|
91
|
+
let d = { mask: F }, f = e, h = b(e, "modelValue"), w = b(e, "vehicleData"), T = n, E = y(), D = x(), j = i({
|
|
92
|
+
get: () => h.value ?? "",
|
|
93
|
+
set: (e) => {
|
|
94
|
+
h.value = e, T("input", e);
|
|
95
|
+
}
|
|
96
|
+
}), N = (e, t) => M(e).toUpperCase() === M(t).toUpperCase();
|
|
97
|
+
S(h, (e) => {
|
|
98
|
+
w.value && !N(e, w.value.LicensePlate) && (w.value = null);
|
|
99
|
+
});
|
|
100
|
+
let P = i(() => O(w.value) ? w.value : null), R = i(() => f.loading || !!P.value && !f.errorMessage), z = i(() => k(P.value)), B = i(() => A(P.value));
|
|
101
|
+
return (n, i) => (m(), a(t, p(v(E), {
|
|
102
|
+
modelValue: j.value,
|
|
103
|
+
"onUpdate:modelValue": i[0] ||= (e) => j.value = e,
|
|
104
|
+
capitalize: "",
|
|
105
|
+
autocomplete: "",
|
|
106
|
+
name: e.name,
|
|
107
|
+
label: e.label,
|
|
108
|
+
required: e.required,
|
|
109
|
+
"error-message": e.errorMessage || null,
|
|
110
|
+
loading: e.loading,
|
|
111
|
+
mask: d,
|
|
112
|
+
class: "vd-input-license-plate"
|
|
113
|
+
}), l({ _: 2 }, [
|
|
114
|
+
v(D).label ? {
|
|
115
|
+
name: "label",
|
|
116
|
+
fn: C(() => [g(n.$slots, "label")]),
|
|
117
|
+
key: "0"
|
|
118
|
+
} : void 0,
|
|
119
|
+
v(D).popover ? {
|
|
120
|
+
name: "popover",
|
|
121
|
+
fn: C(() => [g(n.$slots, "popover")]),
|
|
122
|
+
key: "1"
|
|
123
|
+
} : void 0,
|
|
124
|
+
R.value ? {
|
|
125
|
+
name: "information",
|
|
126
|
+
fn: C(() => [e.loading ? (m(), s("div", I, [...i[1] ||= [c("i", { class: "fas fa-circle-notch vd-input-license-plate__loading-icon" }, null, -1), u(" Voertuig gegevens ophalen... ", -1)]])) : P.value ? (m(), s(r, { key: 1 }, [z.value ? (m(), s("img", {
|
|
127
|
+
key: 0,
|
|
128
|
+
src: `https://d12bmfj3oyxu0t.cloudfront.net/vergelijkdirect/icons/${z.value}.svg`,
|
|
129
|
+
class: "vd-field__svg-message-icon",
|
|
130
|
+
alt: "vehicle-icon"
|
|
131
|
+
}, null, 8, L)) : o("", !0), u(" " + _(B.value), 1)], 64)) : o("", !0)]),
|
|
132
|
+
key: "2"
|
|
133
|
+
} : void 0
|
|
134
|
+
]), 1040, [
|
|
135
|
+
"modelValue",
|
|
136
|
+
"name",
|
|
137
|
+
"label",
|
|
138
|
+
"required",
|
|
139
|
+
"error-message",
|
|
140
|
+
"loading"
|
|
141
|
+
]));
|
|
142
|
+
}
|
|
143
|
+
}), z = /* @__PURE__ */ new Map(), B = (e, t) => `${t}:${e}`, V = {
|
|
144
|
+
"wrong-type": (e) => `Het ingevoerde kenteken is geen ${T[e].dutch}`,
|
|
145
|
+
unknown: () => "Voertuig onbekend - Voer ander kenteken in of neem contact op",
|
|
146
|
+
"not-found": () => "Kenteken onbekend",
|
|
147
|
+
error: () => "Kenteken is incorrect"
|
|
148
|
+
}, H = async (e, t) => {
|
|
149
|
+
try {
|
|
150
|
+
let r = await n().dataService.findVehicle(e, t);
|
|
151
|
+
if (Array.isArray(r) || !r || !Object.keys(r).length) return { status: "not-found" };
|
|
152
|
+
let i = r;
|
|
153
|
+
return i.VehicleType ? T[t].apiTypes.includes(i.VehicleType) ? {
|
|
154
|
+
status: "found",
|
|
155
|
+
data: i
|
|
156
|
+
} : { status: "wrong-type" } : { status: "unknown" };
|
|
157
|
+
} catch (e) {
|
|
158
|
+
return console.error("Error on ITC findVehicle", e), { status: "error" };
|
|
159
|
+
}
|
|
160
|
+
}, U = (e, t) => {
|
|
161
|
+
let n = B(e, t), r = z.get(n);
|
|
162
|
+
return r || (r = H(e, t), z.set(n, r), r.then(({ status: e }) => {
|
|
163
|
+
e === "error" && z.delete(n);
|
|
164
|
+
}, () => z.delete(n))), r;
|
|
165
|
+
}, W = (e, t = {}) => {
|
|
166
|
+
let n = h(t.initialData ?? null), r = 0;
|
|
167
|
+
t.initialData?.LicensePlate && z.set(B(M(t.initialData.LicensePlate), e), Promise.resolve({
|
|
168
|
+
status: "found",
|
|
169
|
+
data: t.initialData
|
|
170
|
+
}));
|
|
171
|
+
let i = async (t) => {
|
|
172
|
+
let i = M(t), a = ++r, o = await U(i, e);
|
|
173
|
+
return a === r && (n.value = o.status === "found" ? o.data : null), o;
|
|
174
|
+
};
|
|
175
|
+
return {
|
|
176
|
+
vehicleData: n,
|
|
177
|
+
licensePlateSchema: w().required("Dit veld is verplicht").test("license-plate-lookup", async (t, n) => {
|
|
178
|
+
if (!t) return !0;
|
|
179
|
+
let r = M(t);
|
|
180
|
+
if (r.length < 6) return n.createError({ message: "Kenteken is incorrect" });
|
|
181
|
+
let { status: a } = await i(r);
|
|
182
|
+
return a === "found" || n.createError({ message: V[a](e) });
|
|
183
|
+
})
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
//#endregion
|
|
187
|
+
export { R as n, W as t };
|