@vergelijkdirect/comparison-forms 2.0.2-rc.0 → 2.1.0-ver-9053.0

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.
Files changed (77) hide show
  1. package/README.md +5 -5
  2. package/dist/vue/VdInput-CRb-iTiH.js +145 -0
  3. package/dist/vue/VdPopover-B78nVpNU.js +200 -0
  4. package/dist/vue/VdRadioGroup-D5kHcpsY.js +166 -0
  5. package/dist/vue/VdSearchableSelect-THqVGo_Q.js +209 -0
  6. package/dist/vue/VdSelect-Dv35x4sz.js +112 -0
  7. package/dist/vue/bike-BmAOIT7K.js +2 -0
  8. package/dist/vue/bike.presenter-B28PW7O5.js +1673 -0
  9. package/dist/vue/birthdate.schema-DX1aYftY.js +91 -0
  10. package/dist/vue/businessCar.presenter-DR-Ozf6B.js +121 -0
  11. package/dist/vue/businessLiability-w4xhGnik.js +2 -0
  12. package/dist/vue/businessLiability.presenter-8iyRbLgw.js +80 -0
  13. package/dist/vue/car-business-DMYPV4UK.js +2 -0
  14. package/dist/vue/car-pxn56jlK.js +2 -0
  15. package/dist/vue/car.presenter-CMGN_MtF.js +130 -0
  16. package/dist/vue/caravan-CuhGro4y.js +2 -0
  17. package/dist/vue/caravan.presenter-DCV4ltB7.js +157 -0
  18. package/dist/vue/company.schema-DStHJpGH.js +241 -0
  19. package/dist/vue/comparison-forms.d.ts +36 -35
  20. package/dist/vue/comparison-forms.js +119 -5590
  21. package/dist/vue/date.util-DjJZwKvn.js +24 -0
  22. package/dist/vue/familyComposition.enum-D26VYo_a.js +6 -0
  23. package/dist/vue/familyComposition.schema-A9W0CwZq.js +75 -0
  24. package/dist/vue/house-DJhbPxyX.js +2 -0
  25. package/dist/vue/house.presenter-C7k4TwbP.js +118 -0
  26. package/dist/vue/houseOwnedBuilding.model-DskEdrSG.js +14 -0
  27. package/dist/vue/itc-KSDsJZsI.js +10 -0
  28. package/dist/vue/legal-Ce2WzBp6.js +2 -0
  29. package/dist/vue/legal.presenter-Ddiovxkq.js +175 -0
  30. package/dist/vue/liability-NHH24ecQ.js +2 -0
  31. package/dist/vue/liability.presenter-gHGQxRPP.js +110 -0
  32. package/dist/vue/loan-C9dmM3Vm.js +2 -0
  33. package/dist/vue/loan.presenter-p24T0XvQ.js +198 -0
  34. package/dist/vue/messages-DfcG9Qfd.js +41 -0
  35. package/dist/vue/moped-CnYiLYBp.js +2 -0
  36. package/dist/vue/moped.presenter-C5TcsOIe.js +133 -0
  37. package/dist/vue/motor-DSFijIK7.js +2 -0
  38. package/dist/vue/motor.presenter-Chlott4j.js +130 -0
  39. package/dist/vue/package-TSBIFNzu.js +2 -0
  40. package/dist/vue/package.presenter-Bit_w4np.js +137 -0
  41. package/dist/vue/pet-DRap9f-q.js +2 -0
  42. package/dist/vue/pet.presenter-BrWNvh7j.js +170 -0
  43. package/dist/vue/rules-3BZkSj_K.js +13 -0
  44. package/dist/vue/travel-DB9sfL8A.js +2 -0
  45. package/dist/vue/travel.presenter-CVkNDJwI.js +108 -0
  46. package/dist/vue/useAddress-C-h1pGI5.js +245 -0
  47. package/dist/vue/useLicensePlate-wAVrX9tr.js +187 -0
  48. package/dist/vue/useValidator-B8ZuqyvJ.js +535 -0
  49. package/dist/vue/yesNo-BvJlCm7Y.js +6 -0
  50. package/dist/wc/comparison-forms.js +14922 -14424
  51. package/dist/wc-forms/bike.cjs +1 -1
  52. package/dist/wc-forms/{birthdate.schema-rpmbSDZH.cjs → birthdate.schema-C-y732mA.cjs} +1 -1
  53. package/dist/wc-forms/car.cjs +1 -1
  54. package/dist/wc-forms/caravan.cjs +1 -1
  55. package/dist/wc-forms/{familyComposition.schema-DW6scNvt.cjs → familyComposition.schema-gvSnx-ea.cjs} +1 -1
  56. package/dist/wc-forms/house.cjs +1 -1
  57. package/dist/wc-forms/houseOwnedBuilding.model-G9AqKTZo.cjs +1 -0
  58. package/dist/wc-forms/legal.cjs +1 -1
  59. package/dist/wc-forms/liability.cjs +1 -1
  60. package/dist/wc-forms/loan.cjs +1 -1
  61. package/dist/wc-forms/{messages-stJTqN-x.cjs → messages-CX8jVyEo.cjs} +1 -1
  62. package/dist/wc-forms/moped.cjs +1 -1
  63. package/dist/wc-forms/motor.cjs +1 -1
  64. package/dist/wc-forms/package.cjs +1 -1
  65. package/dist/wc-forms/pet.cjs +1 -1
  66. package/dist/wc-forms/travel.cjs +1 -1
  67. package/dist/wc-noitc/comparison-forms.umd.cjs +3 -3
  68. package/package.json +1 -1
  69. package/dist/client/.vite/ssr-manifest.json +0 -600
  70. package/dist/client/assets/index-6Enzr9rU.css +0 -4
  71. package/dist/client/assets/index-6Enzr9rU.css.br +0 -0
  72. package/dist/client/assets/index-DUchBxEo.js +0 -57
  73. package/dist/client/assets/index-DUchBxEo.js.br +0 -0
  74. package/dist/client/index.html +0 -15
  75. package/dist/server/entry-server.js +0 -9981
  76. package/dist/server/entry-server.js.br +0 -0
  77. package/dist/wc-forms/houseOwnedBuilding.model-DgIQ2pQN.cjs +0 -1
@@ -0,0 +1,170 @@
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 "./VdInput-CRb-iTiH.js";
3
+ import { t as s } from "./VdSelect-Dv35x4sz.js";
4
+ import { t as c } from "./VdPopover-B78nVpNU.js";
5
+ import { a as l, i as u, n as d, r as f } from "./birthdate.schema-DX1aYftY.js";
6
+ import { t as p } from "./messages-DfcG9Qfd.js";
7
+ import { createBlock as m, createVNode as h, defineComponent as g, isRef as _, mergeDefaults as v, mergeProps as y, openBlock as b, unref as x, withCtx as S } from "vue";
8
+ import { object as C, string as w } from "yup";
9
+ //#region src/comparisons/pet/constants.ts
10
+ var T = {
11
+ min: 0,
12
+ max: 99
13
+ }, E = C({
14
+ kind: w().required(p.pet.kindRequired),
15
+ age: w().required(p.birthdate.required).test("date_format", p.birthdate.dateFormat, d).test(f({
16
+ min: {
17
+ value: 7,
18
+ unit: "week"
19
+ },
20
+ max: {
21
+ value: T.max,
22
+ unit: "year"
23
+ }
24
+ }, {
25
+ future: () => p.birthdate.tooYoung(T.min),
26
+ tooYoung: ({ earliest: e, latest: t }) => p.pet.outOfRange(e.format(u), t.format(u)),
27
+ tooOld: () => p.birthdate.tooOld(T.max)
28
+ }, "birthdate_range")),
29
+ zipCode: w().required(p.pet.zipCodeRequired).matches(/^\d{4}\s?[a-zA-Z]{2}$/, p.pet.zipCodeInvalid)
30
+ }), D = [
31
+ {
32
+ title: "Hond",
33
+ value: "dog"
34
+ },
35
+ {
36
+ title: "Kat",
37
+ value: "cat"
38
+ },
39
+ {
40
+ title: "Konijn",
41
+ value: "rabbit"
42
+ },
43
+ {
44
+ title: "Vogel",
45
+ value: "bird"
46
+ }
47
+ ], O = /* @__PURE__ */ g({
48
+ __name: "PetForm",
49
+ props: /*@__PURE__*/ v({
50
+ initialData: {},
51
+ title: {},
52
+ description: {},
53
+ banner: {},
54
+ layout: {},
55
+ card: { type: Boolean },
56
+ flat: { type: Boolean },
57
+ fullWidth: { type: Boolean },
58
+ submitLabel: {},
59
+ submitDisabled: { type: Boolean }
60
+ }, {
61
+ ...t,
62
+ title: "Dierenverzekering vergelijken"
63
+ }),
64
+ emits: ["submitted"],
65
+ setup(t, { emit: a }) {
66
+ let u = t, d = r(u), f = a, { isSubmitting: p, handleSubmit: g, defineField: v } = i(E, {
67
+ kind: u.initialData?.kind ?? "dog",
68
+ age: u.initialData?.age ?? "",
69
+ zipCode: u.initialData?.zipCode ?? ""
70
+ }), [C, w, T] = v("kind", { validateAt: "change" }), [O, k, A] = v("age"), [j, M, N] = v("zipCode");
71
+ function P() {
72
+ g((e) => {
73
+ f("submitted", { ...e });
74
+ });
75
+ }
76
+ return (r, i) => (b(), m(x(n), y(x(d), {
77
+ "submit-disabled": t.submitDisabled || x(p),
78
+ onSubmit: P
79
+ }), {
80
+ default: S(() => [
81
+ h(x(e), {
82
+ span: "4",
83
+ md: "6"
84
+ }, {
85
+ default: S(() => [h(x(s), y({
86
+ modelValue: x(C),
87
+ "onUpdate:modelValue": i[0] ||= (e) => _(C) ? C.value = e : null,
88
+ label: "Wat voor huisdier wil je verzekeren?",
89
+ placeholder: "",
90
+ options: x(D),
91
+ name: "kind",
92
+ required: !1,
93
+ "error-message": x(T)
94
+ }, x(w)), null, 16, [
95
+ "modelValue",
96
+ "options",
97
+ "error-message"
98
+ ])]),
99
+ _: 1
100
+ }),
101
+ h(x(e), {
102
+ span: "4",
103
+ md: "6"
104
+ }, {
105
+ default: S(() => [h(x(l), y({
106
+ modelValue: x(O),
107
+ "onUpdate:modelValue": i[1] ||= (e) => _(O) ? O.value = e : null,
108
+ label: "Geboortedatum huisdier",
109
+ "error-message": x(A)
110
+ }, x(k)), {
111
+ popover: S(() => [h(x(c), {
112
+ "ref-variant": "blue-icon",
113
+ "tooltip-variant": "blue",
114
+ "tooltip-size": "small",
115
+ content: {
116
+ title: "Waarom de geboortedatum?",
117
+ description: "De leeftijd van je huisdier is cruciaal voor de premieberekening. Oudere dieren hebben vaak hogere premies vanwege verhoogde gezondheidsrisico's. Als je de exacte datum niet weet, gebruik dan een schatting."
118
+ }
119
+ })]),
120
+ _: 1
121
+ }, 16, ["modelValue", "error-message"])]),
122
+ _: 1
123
+ }),
124
+ h(x(e), {
125
+ span: "2",
126
+ md: "6"
127
+ }, {
128
+ default: S(() => [h(x(o), y({
129
+ modelValue: x(j),
130
+ "onUpdate:modelValue": i[2] ||= (e) => _(j) ? j.value = e : null,
131
+ label: "Postcode",
132
+ placeholder: "bv. 1234 AZ",
133
+ name: "zipCode",
134
+ mask: "####@@",
135
+ capitalize: "",
136
+ required: !1,
137
+ "error-message": x(N)
138
+ }, x(M)), {
139
+ popover: S(() => [h(x(c), {
140
+ "ref-variant": "blue-icon",
141
+ "tooltip-variant": "blue",
142
+ "tooltip-size": "small",
143
+ content: {
144
+ title: "Waarom je postcode?",
145
+ description: "Je postcode helpt ons om de juiste premie voor jouw huisdier te berekenen, omdat sommige verzekeraars hun tarieven op basis van je woonlocatie bepalen."
146
+ }
147
+ })]),
148
+ _: 1
149
+ }, 16, ["modelValue", "error-message"])]),
150
+ _: 1
151
+ })
152
+ ]),
153
+ _: 1
154
+ }, 16, ["submit-disabled"]));
155
+ }
156
+ });
157
+ //#endregion
158
+ //#region src/comparisons/pet/pet.presenter.ts
159
+ function k(e) {
160
+ return {
161
+ comparison: a.Pet,
162
+ detail: { pet: {
163
+ kind: e.kind,
164
+ age: e.age
165
+ } },
166
+ user: { zipCode: e.zipCode }
167
+ };
168
+ }
169
+ //#endregion
170
+ export { O as n, k as t };
@@ -0,0 +1,13 @@
1
+ import { number as e, string as t } from "yup";
2
+ //#region src/schemas/rules.ts
3
+ function n(e, n) {
4
+ return t().required(n).oneOf(e, n);
5
+ }
6
+ function r(e) {
7
+ return t().required(e);
8
+ }
9
+ function i(t) {
10
+ return e().typeError(t).required(t);
11
+ }
12
+ //#endregion
13
+ export { n, r, i as t };
@@ -0,0 +1,2 @@
1
+ import { n as e, t } from "./travel.presenter-CVkNDJwI.js";
2
+ export { e as Form, t as presenter };
@@ -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-DX1aYftY.js";
5
+ import { t as u } from "./messages-DfcG9Qfd.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 };