@vergelijkdirect/comparison-forms 2.0.0-rc.7 → 2.0.0-rc.9
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.
|
@@ -116,19 +116,14 @@ declare const __VLS_export_15: DefineComponent<ComparisonFormFlowProps, {}, {},
|
|
|
116
116
|
declare const __VLS_export_16: DefineComponent<RiskScannerFormProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<RiskScannerFormProps> & Readonly<{}>, {
|
|
117
117
|
title: string;
|
|
118
118
|
description: string;
|
|
119
|
-
qaId: string;
|
|
120
|
-
thankyouPageTemplate: string;
|
|
121
119
|
buttonText: string;
|
|
122
120
|
showTitle: boolean;
|
|
123
|
-
|
|
124
|
-
currentItemId: string;
|
|
125
|
-
nextItemId: string;
|
|
121
|
+
qaOptions: Partial<QaOptions>;
|
|
126
122
|
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
127
123
|
|
|
128
124
|
declare const __VLS_export_17: DefineComponent<QuestionnaireSharedProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<QuestionnaireSharedProps> & Readonly<{}>, {
|
|
129
125
|
title: string;
|
|
130
126
|
description: string;
|
|
131
|
-
thankyouPageTemplate: string;
|
|
132
127
|
buttonText: string;
|
|
133
128
|
showTitle: boolean;
|
|
134
129
|
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
@@ -608,42 +603,31 @@ export declare interface PetFormData {
|
|
|
608
603
|
|
|
609
604
|
export declare function petPresenter(data: PetFormData): ComparisonPayload;
|
|
610
605
|
|
|
606
|
+
export declare interface QaOptions {
|
|
607
|
+
qaId: string;
|
|
608
|
+
thankyouPageTemplate?: string;
|
|
609
|
+
qaUrl?: string;
|
|
610
|
+
currentItemId?: string;
|
|
611
|
+
nextItemId?: string;
|
|
612
|
+
}
|
|
613
|
+
|
|
611
614
|
export declare const QuestionnaireForm: typeof __VLS_export_17;
|
|
612
615
|
|
|
613
616
|
export declare type QuestionnaireFormProps = QuestionnaireSharedProps;
|
|
614
617
|
|
|
615
|
-
/**
|
|
616
|
-
* The shared public API of every questionnaire (QA-renderer quiz starter).
|
|
617
|
-
* Deliberately independent from the comparison forms' `ComparisonFormProps` —
|
|
618
|
-
* questionnaires are VD-internal drop-ins, their contract evolves separately.
|
|
619
|
-
*
|
|
620
|
-
* On master (1.x) this contract was `link`/`title`/`description`/`buttonText`/
|
|
621
|
-
* `showTitle` + an `additionalOptions` object carrying the QA params; 2.x
|
|
622
|
-
* flattens those params into plain props, keeping the master names
|
|
623
|
-
* (`thankyouPageTemplate` still lands in the url as the `template` query param).
|
|
624
|
-
*/
|
|
625
618
|
export declare interface QuestionnaireSharedProps {
|
|
626
|
-
/** base page url of the quiz app; `{qaId, template, …}` are merged into its query */
|
|
627
619
|
link: string;
|
|
628
|
-
qaId: string;
|
|
629
|
-
thankyouPageTemplate?: string;
|
|
630
620
|
title?: string;
|
|
631
621
|
description?: string;
|
|
632
622
|
buttonText?: string;
|
|
633
623
|
showTitle?: boolean;
|
|
624
|
+
qaOptions: QaOptions;
|
|
634
625
|
}
|
|
635
626
|
|
|
636
627
|
export declare const RiskScannerForm: typeof __VLS_export_16;
|
|
637
628
|
|
|
638
|
-
export declare interface RiskScannerFormProps extends Omit<QuestionnaireSharedProps, '
|
|
639
|
-
|
|
640
|
-
* base url of the QA API (a missing trailing slash is normalized internally);
|
|
641
|
-
* falls back to the ITC client's qa config when omitted
|
|
642
|
-
*/
|
|
643
|
-
qaUrl?: string;
|
|
644
|
-
qaId?: string;
|
|
645
|
-
currentItemId?: string;
|
|
646
|
-
nextItemId?: string;
|
|
629
|
+
export declare interface RiskScannerFormProps extends Omit<QuestionnaireSharedProps, 'qaOptions'> {
|
|
630
|
+
qaOptions?: Partial<QaOptions>;
|
|
647
631
|
}
|
|
648
632
|
|
|
649
633
|
export declare const TravelForm: typeof __VLS_export_4;
|
|
@@ -5719,20 +5719,19 @@ var Sa = /* @__PURE__ */ B({
|
|
|
5719
5719
|
__name: "QuestionnaireForm",
|
|
5720
5720
|
props: {
|
|
5721
5721
|
link: {},
|
|
5722
|
-
qaId: {},
|
|
5723
|
-
thankyouPageTemplate: { default: "common" },
|
|
5724
5722
|
title: { default: "" },
|
|
5725
5723
|
description: { default: "" },
|
|
5726
5724
|
buttonText: { default: "" },
|
|
5727
5725
|
showTitle: {
|
|
5728
5726
|
type: Boolean,
|
|
5729
5727
|
default: !0
|
|
5730
|
-
}
|
|
5728
|
+
},
|
|
5729
|
+
qaOptions: {}
|
|
5731
5730
|
},
|
|
5732
5731
|
setup(e) {
|
|
5733
5732
|
let n = e, a = t(() => Qr(n.link, {
|
|
5734
|
-
qaId: n.qaId,
|
|
5735
|
-
template: n.thankyouPageTemplate
|
|
5733
|
+
qaId: n.qaOptions.qaId,
|
|
5734
|
+
template: n.qaOptions.thankyouPageTemplate ?? "common"
|
|
5736
5735
|
}));
|
|
5737
5736
|
return (t, n) => (y(), i("div", Ra, [e.showTitle && e.title || e.description ? (y(), i("div", za, [e.showTitle && e.title ? (y(), i("h2", Ba, T(e.title), 1)) : r("", !0), e.description ? (y(), i("p", Va, T(e.description), 1)) : r("", !0)])) : r("", !0), c(E(Ie), {
|
|
5738
5737
|
href: a.value,
|
|
@@ -5755,12 +5754,8 @@ var Sa = /* @__PURE__ */ B({
|
|
|
5755
5754
|
}, Ka = { class: "vd-form__row" }, qa = { class: "vd-form__col-10 vd-form__col-md-6" }, Ja = { class: "vd-form__col-2 vd-form__action" }, Ya = /* @__PURE__ */ l({
|
|
5756
5755
|
__name: "RiskScannerForm",
|
|
5757
5756
|
props: {
|
|
5758
|
-
|
|
5759
|
-
qaId: { default: "6627c64764165beec8076818" },
|
|
5760
|
-
currentItemId: { default: "6627e21c64165beec8076830" },
|
|
5761
|
-
nextItemId: { default: "6627e32464165beec8076838" },
|
|
5757
|
+
qaOptions: { default: () => ({}) },
|
|
5762
5758
|
link: {},
|
|
5763
|
-
thankyouPageTemplate: { default: "risk-scanner" },
|
|
5764
5759
|
title: { default: "Check de risico`s voor jouw bedrijf + ontvang gratis offerte!" },
|
|
5765
5760
|
description: { default: "Doe onze risicoscan en ontdek de beste verzekering voor jouw specifieke bedrijf. Om te starten hebben we je bedrijfsnaam of KVK-nummer nodig!" },
|
|
5766
5761
|
buttonText: { default: "Start de gratis scan" },
|
|
@@ -5770,9 +5765,15 @@ var Sa = /* @__PURE__ */ B({
|
|
|
5770
5765
|
}
|
|
5771
5766
|
},
|
|
5772
5767
|
setup(e) {
|
|
5773
|
-
let o = e, s =
|
|
5774
|
-
|
|
5775
|
-
|
|
5768
|
+
let o = e, s = t(() => ({
|
|
5769
|
+
qaId: "6627c64764165beec8076818",
|
|
5770
|
+
currentItemId: "6627e21c64165beec8076830",
|
|
5771
|
+
nextItemId: "6627e32464165beec8076838",
|
|
5772
|
+
thankyouPageTemplate: "risk-scanner",
|
|
5773
|
+
...o.qaOptions
|
|
5774
|
+
})), l = x(null), { isSubmitting: u, handleSubmit: f, defineField: p, setErrors: h, removeError: g } = Z(R({ company: Br() }), { company: null }), [_, v, b] = p("company"), S = (e) => e ? h({ company: e }) : g("company"), C = t(() => !!_.value && !_.value.hasVisitingAddress);
|
|
5775
|
+
async function w(e) {
|
|
5776
|
+
let t = s.value.qaUrl || An(), n = t.endsWith("/") ? t : `${t}/`, r = await fetch(`${n}api/v1/active-questionnaire/${s.value.qaId}/start`, {
|
|
5776
5777
|
method: "POST",
|
|
5777
5778
|
headers: { "Content-Type": "application/json" },
|
|
5778
5779
|
body: JSON.stringify({
|
|
@@ -5780,23 +5781,23 @@ var Sa = /* @__PURE__ */ B({
|
|
|
5780
5781
|
value: e.kvkNummer,
|
|
5781
5782
|
data: e
|
|
5782
5783
|
} } },
|
|
5783
|
-
current_item_id:
|
|
5784
|
-
next_item_id:
|
|
5784
|
+
current_item_id: s.value.currentItemId,
|
|
5785
|
+
next_item_id: s.value.nextItemId
|
|
5785
5786
|
})
|
|
5786
5787
|
});
|
|
5787
5788
|
if (!r.ok) throw Error(`Failed to start the questionnaire (${r.status})`);
|
|
5788
5789
|
let { leadId: i } = await r.json();
|
|
5789
5790
|
return Qr(o.link, {
|
|
5790
5791
|
leadid: i,
|
|
5791
|
-
qaId:
|
|
5792
|
-
template:
|
|
5792
|
+
qaId: s.value.qaId,
|
|
5793
|
+
template: s.value.thankyouPageTemplate
|
|
5793
5794
|
});
|
|
5794
5795
|
}
|
|
5795
|
-
function
|
|
5796
|
-
|
|
5796
|
+
function D() {
|
|
5797
|
+
u.value || f(async () => {
|
|
5797
5798
|
try {
|
|
5798
|
-
if (!
|
|
5799
|
-
let e = await
|
|
5799
|
+
if (!l.value) throw Error("Missing company data");
|
|
5800
|
+
let e = await w(l.value);
|
|
5800
5801
|
window.location.href = e;
|
|
5801
5802
|
} catch (e) {
|
|
5802
5803
|
console.error(e);
|
|
@@ -5805,22 +5806,22 @@ var Sa = /* @__PURE__ */ B({
|
|
|
5805
5806
|
}
|
|
5806
5807
|
return (t, o) => (y(), i("form", {
|
|
5807
5808
|
class: "vd-form vd-form--vertical vd-form--card",
|
|
5808
|
-
onSubmit: I(
|
|
5809
|
+
onSubmit: I(D, ["prevent"])
|
|
5809
5810
|
}, [e.showTitle && e.title || e.description ? (y(), i("div", Ua, [e.showTitle && e.title ? (y(), i("h2", Wa, T(e.title), 1)) : r("", !0), e.description ? (y(), i("p", Ga, T(e.description), 1)) : r("", !0)])) : r("", !0), a("div", Ka, [a("div", qa, [c(E(zr), m({
|
|
5810
|
-
modelValue: E(
|
|
5811
|
-
"onUpdate:modelValue": o[0] ||= (e) => d(
|
|
5812
|
-
}, E(
|
|
5813
|
-
"error-message": E(
|
|
5814
|
-
onError:
|
|
5815
|
-
onRaw: o[1] ||= (e) =>
|
|
5816
|
-
}), null, 16, ["modelValue", "error-message"]),
|
|
5811
|
+
modelValue: E(_),
|
|
5812
|
+
"onUpdate:modelValue": o[0] ||= (e) => d(_) ? _.value = e : null
|
|
5813
|
+
}, E(v), {
|
|
5814
|
+
"error-message": E(b),
|
|
5815
|
+
onError: S,
|
|
5816
|
+
onRaw: o[1] ||= (e) => l.value = e
|
|
5817
|
+
}), null, 16, ["modelValue", "error-message"]), C.value ? (y(), n(E(Kt), {
|
|
5817
5818
|
key: 0,
|
|
5818
5819
|
style: { "margin-top": "12px" },
|
|
5819
5820
|
text: "Dit bedrijf heeft geen geregistreerd bezoekadres. Voeg dit toe bij de KvK om door te gaan met de aanvraag."
|
|
5820
5821
|
})) : r("", !0)]), a("div", Ja, [c(E(Ie), {
|
|
5821
5822
|
label: e.buttonText,
|
|
5822
|
-
"is-loading": E(
|
|
5823
|
-
disabled:
|
|
5823
|
+
"is-loading": E(u),
|
|
5824
|
+
disabled: C.value,
|
|
5824
5825
|
"button-type": "green",
|
|
5825
5826
|
size: "big",
|
|
5826
5827
|
block: "",
|