@getcredify/credify-insurance-widget 1.5.2 → 1.5.3
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/iframe/assets/{iframe-nHL8IPfa.js → iframe-DfFoSADp.js} +2 -2
- package/dist/iframe/assets/{iframe-nHL8IPfa.js.map → iframe-DfFoSADp.js.map} +1 -1
- package/dist/iframe/iframe.html +1 -1
- package/dist/index.es.js +145 -114
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/iframe/iframe.html
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
overflow: hidden;
|
|
15
15
|
}
|
|
16
16
|
</style>
|
|
17
|
-
<script type="module" crossorigin src="/iframe/assets/iframe-
|
|
17
|
+
<script type="module" crossorigin src="/iframe/assets/iframe-DfFoSADp.js"></script>
|
|
18
18
|
<link rel="stylesheet" crossorigin href="/iframe/assets/iframe-BEDGs5Rs.css">
|
|
19
19
|
</head>
|
|
20
20
|
<body>
|
package/dist/index.es.js
CHANGED
|
@@ -86,7 +86,7 @@ function ot({ id: e, label: t, hint: r, error: s, required: n, className: i, val
|
|
|
86
86
|
const Q = R.slice(0, 10);
|
|
87
87
|
k(be(Q));
|
|
88
88
|
}, [l]);
|
|
89
|
-
const
|
|
89
|
+
const T = (R) => {
|
|
90
90
|
const Q = R.target, C = Q.value;
|
|
91
91
|
A.current = Q.selectionStart || 0;
|
|
92
92
|
const d = ve(C).slice(0, 10), p = be(d);
|
|
@@ -135,7 +135,7 @@ function ot({ id: e, label: t, hint: r, error: s, required: n, className: i, val
|
|
|
135
135
|
"aria-invalid": !!s,
|
|
136
136
|
"aria-describedby": [r ? `${e}-hint` : null, s ? `${e}-error` : null].filter(Boolean).join(" ") || void 0,
|
|
137
137
|
value: v,
|
|
138
|
-
onChange:
|
|
138
|
+
onChange: T,
|
|
139
139
|
...u
|
|
140
140
|
}
|
|
141
141
|
)
|
|
@@ -276,7 +276,7 @@ function ht(e) {
|
|
|
276
276
|
}), t;
|
|
277
277
|
}
|
|
278
278
|
function yt({ id: e, label: t, hint: r, error: s, required: n, className: i, onChange: l, onPlaceSelect: a, value: u, ...v }) {
|
|
279
|
-
const k = O(null), m = O(null), A = O(null),
|
|
279
|
+
const k = O(null), m = O(null), A = O(null), T = O(null), [R, Q] = M(!0), [C, I] = M(u || ""), [d, p] = M([]), [c, y] = M(!1), [w, $] = M(-1), S = O([]), _ = O(!1), f = O(-1);
|
|
280
280
|
D(() => {
|
|
281
281
|
S.current = d;
|
|
282
282
|
}, [d]), D(() => {
|
|
@@ -284,7 +284,7 @@ function yt({ id: e, label: t, hint: r, error: s, required: n, className: i, onC
|
|
|
284
284
|
}, [c]), D(() => {
|
|
285
285
|
f.current = w;
|
|
286
286
|
}, [w]), D(() => {
|
|
287
|
-
u !== void 0 &&
|
|
287
|
+
u !== void 0 && I(String(u));
|
|
288
288
|
}, [u]);
|
|
289
289
|
const g = O(null);
|
|
290
290
|
D(() => {
|
|
@@ -300,7 +300,7 @@ function yt({ id: e, label: t, hint: r, error: s, required: n, className: i, onC
|
|
|
300
300
|
}, []);
|
|
301
301
|
const h = (N) => {
|
|
302
302
|
const x = N.target.value;
|
|
303
|
-
if (
|
|
303
|
+
if (I(x), l?.(x), g.current && clearTimeout(g.current), x.length < 3) {
|
|
304
304
|
p([]), y(!1);
|
|
305
305
|
return;
|
|
306
306
|
}
|
|
@@ -343,7 +343,7 @@ function yt({ id: e, label: t, hint: r, error: s, required: n, className: i, onC
|
|
|
343
343
|
};
|
|
344
344
|
D(() => {
|
|
345
345
|
const N = (x) => {
|
|
346
|
-
|
|
346
|
+
T.current && !T.current.contains(x.target) && k.current && !k.current.contains(x.target) && (y(!1), _.current = !1);
|
|
347
347
|
};
|
|
348
348
|
if (c)
|
|
349
349
|
return document.addEventListener("mousedown", N), () => {
|
|
@@ -359,7 +359,7 @@ function yt({ id: e, label: t, hint: r, error: s, required: n, className: i, onC
|
|
|
359
359
|
(x, F) => {
|
|
360
360
|
if (F === google.maps.places.PlacesServiceStatus.OK && x) {
|
|
361
361
|
const K = x.formatted_address || "";
|
|
362
|
-
|
|
362
|
+
I(K), y(!1), p([]), _.current = !1;
|
|
363
363
|
const Z = ht(x);
|
|
364
364
|
l?.(K, Z), a?.(x);
|
|
365
365
|
}
|
|
@@ -390,7 +390,7 @@ function yt({ id: e, label: t, hint: r, error: s, required: n, className: i, onC
|
|
|
390
390
|
c && d.length > 0 && /* @__PURE__ */ o(
|
|
391
391
|
"div",
|
|
392
392
|
{
|
|
393
|
-
ref:
|
|
393
|
+
ref: T,
|
|
394
394
|
className: "absolute z-50 w-full mt-1 bg-white border border-slate-200 rounded-lg shadow-lg max-h-60 overflow-y-auto",
|
|
395
395
|
role: "listbox",
|
|
396
396
|
children: d.map((N, x) => /* @__PURE__ */ b(
|
|
@@ -562,7 +562,7 @@ function $t({
|
|
|
562
562
|
D(() => {
|
|
563
563
|
r && k((d) => ({ ...d, ...r }));
|
|
564
564
|
}, [r]);
|
|
565
|
-
const [A,
|
|
565
|
+
const [A, T] = M({});
|
|
566
566
|
function R(d, p) {
|
|
567
567
|
const c = d.key, y = d.question, w = le(m, p, c), $ = A[c], S = (_) => {
|
|
568
568
|
let f = wt(m, p, c, _);
|
|
@@ -831,15 +831,15 @@ function $t({
|
|
|
831
831
|
E.map((ee) => /* @__PURE__ */ b("div", { className: "mt-3", children: [
|
|
832
832
|
R(ee, L),
|
|
833
833
|
(() => {
|
|
834
|
-
const
|
|
835
|
-
if (!
|
|
836
|
-
const Xe = le(m, L, ee.key), de =
|
|
834
|
+
const Ie = ee.conditionals ?? [];
|
|
835
|
+
if (!Ie.length) return null;
|
|
836
|
+
const Xe = le(m, L, ee.key), de = Ie.filter((te) => oe(Xe, te.conditionalType, te.conditionalValue));
|
|
837
837
|
return (de.length > 1 && !de.some((te) => te.conditionalQuestionsAllowMultiple) ? de.slice(0, 1) : de).map((te, he) => {
|
|
838
838
|
const ye = te.conditionalQuestions ?? [];
|
|
839
839
|
if (!ye.length) return null;
|
|
840
840
|
if (!te.conditionalQuestionsAllowMultiple)
|
|
841
841
|
return /* @__PURE__ */ o("div", { className: "mt-3", children: Q(ye, L) }, `nested-${z}-${he}`);
|
|
842
|
-
const ue = fe(ee.key), _e = ke(m, [...L, ue]) ?? [],
|
|
842
|
+
const ue = fe(ee.key), _e = ke(m, [...L, ue]) ?? [], Te = Math.max(1, _e.length || 1), Ze = () => {
|
|
843
843
|
const se = X(m, [...L, ue, _e.length], {});
|
|
844
844
|
r && s ? s(se) : u(se), k(se);
|
|
845
845
|
}, qe = () => {
|
|
@@ -851,10 +851,10 @@ function $t({
|
|
|
851
851
|
/* @__PURE__ */ o("div", { className: "text-sm font-medium opacity-75", children: "Add one or more entries" }),
|
|
852
852
|
/* @__PURE__ */ b("div", { className: "space-x-2", children: [
|
|
853
853
|
/* @__PURE__ */ o("button", { type: "button", className: "btn-outline px-3 py-1", onClick: Ze, children: "Add another" }),
|
|
854
|
-
|
|
854
|
+
Te > 1 && /* @__PURE__ */ o("button", { type: "button", className: "btn-outline px-3 py-1", onClick: qe, children: "Remove last" })
|
|
855
855
|
] })
|
|
856
856
|
] }),
|
|
857
|
-
Array.from({ length:
|
|
857
|
+
Array.from({ length: Te }).map((se, ne) => {
|
|
858
858
|
const et = [...L, ue, ne];
|
|
859
859
|
return /* @__PURE__ */ b("div", { className: "rounded-lg border p-3 mb-3", children: [
|
|
860
860
|
/* @__PURE__ */ b("div", { className: "text-sm font-semibold mb-2", children: [
|
|
@@ -890,17 +890,17 @@ function $t({
|
|
|
890
890
|
};
|
|
891
891
|
return p(i), d;
|
|
892
892
|
}, [i, m]);
|
|
893
|
-
function
|
|
893
|
+
function I(d) {
|
|
894
894
|
d.preventDefault();
|
|
895
895
|
const p = ge(C, m);
|
|
896
|
-
if (
|
|
896
|
+
if (T(p), Object.keys(p).length > 0) {
|
|
897
897
|
const c = C.findIndex((y) => p[y.key]);
|
|
898
898
|
c >= 0 && document.getElementById(C[c].key)?.focus();
|
|
899
899
|
return;
|
|
900
900
|
}
|
|
901
901
|
n(m);
|
|
902
902
|
}
|
|
903
|
-
return /* @__PURE__ */ o("form", { className: "space-y-6 px-1", onSubmit:
|
|
903
|
+
return /* @__PURE__ */ o("form", { className: "space-y-6 px-1", onSubmit: I, noValidate: !0, children: Q(i) });
|
|
904
904
|
}
|
|
905
905
|
function Be(e) {
|
|
906
906
|
return typeof e == "number" && Number.isFinite(e) ? e : typeof e == "string" && e.trim() !== "" && !Number.isNaN(Number(e)) ? Number(e) : null;
|
|
@@ -954,7 +954,7 @@ function Ke(e, t) {
|
|
|
954
954
|
const v = u.filter((m) => Pe(a, m.conditionalType, m.conditionalValue));
|
|
955
955
|
(v.length > 1 && !v.some((m) => m.conditionalQuestionsAllowMultiple) ? v.slice(0, 1) : v).forEach((m) => {
|
|
956
956
|
const A = m.conditionalQuestions ?? [];
|
|
957
|
-
A.length && (m.conditionalQuestionsAllowMultiple || A.forEach((
|
|
957
|
+
A.length && (m.conditionalQuestionsAllowMultiple || A.forEach((T) => r.push(T)));
|
|
958
958
|
});
|
|
959
959
|
});
|
|
960
960
|
})(e), r;
|
|
@@ -992,11 +992,11 @@ function Ct({
|
|
|
992
992
|
initialValues: s,
|
|
993
993
|
initialActive: n
|
|
994
994
|
}) {
|
|
995
|
-
const [i, l] = M(n ?? 0), [a, u] = M(s ?? {}), [v, k] = M({}), [m, A] = M(!1), [
|
|
995
|
+
const [i, l] = M(n ?? 0), [a, u] = M(s ?? {}), [v, k] = M({}), [m, A] = M(!1), [T, R] = M(!1), [Q, C] = M(null), I = O([]), d = Array.isArray(e) && e.length > 0, p = d ? e[Math.min(i, e.length - 1)] : null, c = p?.key ?? null;
|
|
996
996
|
D(() => {
|
|
997
997
|
n !== void 0 && l(n);
|
|
998
998
|
}, [n]), D(() => {
|
|
999
|
-
const g =
|
|
999
|
+
const g = I.current[i];
|
|
1000
1000
|
g && g.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "center" });
|
|
1001
1001
|
}, [i]), D(() => {
|
|
1002
1002
|
s !== void 0 && u(s);
|
|
@@ -1050,7 +1050,7 @@ function Ct({
|
|
|
1050
1050
|
}, S = () => {
|
|
1051
1051
|
l((g) => g > 0 ? g - 1 : 0), document.querySelector(".panel-body")?.scrollTo({ top: 0, behavior: "instant" });
|
|
1052
1052
|
}, _ = async () => {
|
|
1053
|
-
if (!y || !p || m || Q ||
|
|
1053
|
+
if (!y || !p || m || Q || T) return;
|
|
1054
1054
|
const g = Ke(y, a), h = ge(g, a), B = Object.values(h).some(Boolean), E = Le(y, a);
|
|
1055
1055
|
if (!(B || E)) {
|
|
1056
1056
|
R(!0);
|
|
@@ -1066,10 +1066,10 @@ function Ct({
|
|
|
1066
1066
|
}
|
|
1067
1067
|
}
|
|
1068
1068
|
}, f = ie(() => {
|
|
1069
|
-
if (!y || m || Q ||
|
|
1069
|
+
if (!y || m || Q || T) return !0;
|
|
1070
1070
|
const g = Ke(y, a), h = ge(g, a), B = Object.values(h).some(Boolean), E = Le(y, a);
|
|
1071
1071
|
return B || E;
|
|
1072
|
-
}, [y, a, m, Q,
|
|
1072
|
+
}, [y, a, m, Q, T]);
|
|
1073
1073
|
return d ? /* @__PURE__ */ b("div", { className: "space-y-6", children: [
|
|
1074
1074
|
/* @__PURE__ */ b("div", { className: "flex items-center justify-between gap-4", children: [
|
|
1075
1075
|
/* @__PURE__ */ o(
|
|
@@ -1082,7 +1082,7 @@ function Ct({
|
|
|
1082
1082
|
"li",
|
|
1083
1083
|
{
|
|
1084
1084
|
ref: (B) => {
|
|
1085
|
-
|
|
1085
|
+
I.current[h] = B;
|
|
1086
1086
|
},
|
|
1087
1087
|
className: `px-2.5 py-1 rounded-full border whitespace-nowrap flex-shrink-0 ${h < i ? "bg-blue-600 text-white border-blue-600" : h === i ? "border-blue-600 text-blue-600 bg-white" : "border-slate-200 text-slate-600"}`,
|
|
1088
1088
|
children: g.title
|
|
@@ -1157,7 +1157,7 @@ function Ct({
|
|
|
1157
1157
|
f ? "bg-gray-300" : "bg-blue-600 hover:bg-blue-600/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-600/40 bg-primary hover:bg-primary/90 focus-visible:ring-primary/40"
|
|
1158
1158
|
].join(" "),
|
|
1159
1159
|
children: [
|
|
1160
|
-
|
|
1160
|
+
T && /* @__PURE__ */ b("svg", { className: "animate-spin h-5 w-5 text-white", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
|
|
1161
1161
|
/* @__PURE__ */ o("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
1162
1162
|
/* @__PURE__ */ o(
|
|
1163
1163
|
"path",
|
|
@@ -1183,7 +1183,7 @@ function Et(e) {
|
|
|
1183
1183
|
console.error("Failed to save quoteId to localStorage:", t);
|
|
1184
1184
|
}
|
|
1185
1185
|
}
|
|
1186
|
-
function
|
|
1186
|
+
function It() {
|
|
1187
1187
|
try {
|
|
1188
1188
|
return localStorage.getItem(Ce);
|
|
1189
1189
|
} catch (e) {
|
|
@@ -1197,7 +1197,7 @@ function Ye() {
|
|
|
1197
1197
|
console.error("Failed to clear quoteId from localStorage:", e);
|
|
1198
1198
|
}
|
|
1199
1199
|
}
|
|
1200
|
-
function
|
|
1200
|
+
function Tt(e) {
|
|
1201
1201
|
try {
|
|
1202
1202
|
localStorage.setItem(Ee, e);
|
|
1203
1203
|
} catch (t) {
|
|
@@ -1224,7 +1224,7 @@ function Qt() {
|
|
|
1224
1224
|
const G = "https://api.getcredify.com";
|
|
1225
1225
|
let ae = null;
|
|
1226
1226
|
function jt(e) {
|
|
1227
|
-
ae = e,
|
|
1227
|
+
ae = e, Tt(e);
|
|
1228
1228
|
}
|
|
1229
1229
|
function me() {
|
|
1230
1230
|
return ae;
|
|
@@ -1314,14 +1314,14 @@ function Ot({ rates: e, onBack: t }) {
|
|
|
1314
1314
|
/* @__PURE__ */ o("h3", { className: "text-lg font-semibold text-slate-900", children: "Rates" }),
|
|
1315
1315
|
/* @__PURE__ */ o("div", { className: "mt-4 grid gap-4 sm:grid-cols-2 lg:grid-cols-3", children: e.map((i) => {
|
|
1316
1316
|
const l = i.premium_cents / 100, a = zt.format(l), u = i.quote_rate_id, v = s[u] ?? "idle", k = v === "loading", m = v === "success", A = async () => {
|
|
1317
|
-
n((
|
|
1317
|
+
n((T) => ({ ...T, [u]: "loading" }));
|
|
1318
1318
|
try {
|
|
1319
1319
|
if ($e(), !me())
|
|
1320
1320
|
throw new Error("Authentication required. Please verify your phone number first.");
|
|
1321
1321
|
if (!((await Wt(i.quote_rate_id))?.success !== !1)) throw new Error("Request failed");
|
|
1322
1322
|
Qt(), He(), n((C) => ({ ...C, [u]: "success" }));
|
|
1323
1323
|
} catch {
|
|
1324
|
-
n((
|
|
1324
|
+
n((T) => ({ ...T, [u]: "error" }));
|
|
1325
1325
|
}
|
|
1326
1326
|
};
|
|
1327
1327
|
return /* @__PURE__ */ b("div", { className: "flex flex-col rounded-xl border border-slate-200 bg-white p-6 shadow-sm transition hover:shadow-md", children: [
|
|
@@ -1439,27 +1439,27 @@ function Ae(e) {
|
|
|
1439
1439
|
return t;
|
|
1440
1440
|
}
|
|
1441
1441
|
function Ut({ isOpen: e, onClose: t }) {
|
|
1442
|
-
const [r, s] = M([]), [n, i] = M(null), [l, a] = M(null), [u, v] = M(null), [k, m] = M(void 0), [A,
|
|
1442
|
+
const [r, s] = M([]), [n, i] = M(null), [l, a] = M(null), [u, v] = M(null), [k, m] = M(void 0), [A, T] = M(!1);
|
|
1443
1443
|
function R(C) {
|
|
1444
|
-
const
|
|
1444
|
+
const I = {
|
|
1445
1445
|
SMSVerification: "Verify",
|
|
1446
1446
|
AutoCurrentCarrier: "Current Auto Policy",
|
|
1447
1447
|
HomeCurrentCarrier: "Current Home Policy"
|
|
1448
1448
|
};
|
|
1449
1449
|
return C.map((d) => ({
|
|
1450
1450
|
key: d,
|
|
1451
|
-
title:
|
|
1451
|
+
title: I[d] || d,
|
|
1452
1452
|
loadQuestions: async () => (await Mt(d)).questions
|
|
1453
1453
|
}));
|
|
1454
1454
|
}
|
|
1455
1455
|
D(() => {
|
|
1456
1456
|
e && (async () => {
|
|
1457
1457
|
try {
|
|
1458
|
-
const
|
|
1459
|
-
if ($e(),
|
|
1460
|
-
|
|
1458
|
+
const I = It();
|
|
1459
|
+
if ($e(), I) {
|
|
1460
|
+
T(!0), i(I);
|
|
1461
1461
|
try {
|
|
1462
|
-
const d = me(), p = await Lt(d ? void 0 :
|
|
1462
|
+
const d = me(), p = await Lt(d ? void 0 : I);
|
|
1463
1463
|
if (!p || !p.quote)
|
|
1464
1464
|
throw new Error("Invalid response from getQuote: missing quote data");
|
|
1465
1465
|
const { quote: c } = p, { stages: y } = await we(), w = R(y);
|
|
@@ -1478,14 +1478,14 @@ function Ut({ isOpen: e, onClose: t }) {
|
|
|
1478
1478
|
} catch (d) {
|
|
1479
1479
|
d.statusCode === 404 ? (Ye(), i(null)) : He();
|
|
1480
1480
|
} finally {
|
|
1481
|
-
|
|
1481
|
+
T(!1);
|
|
1482
1482
|
}
|
|
1483
1483
|
} else {
|
|
1484
1484
|
const { stages: d } = await we();
|
|
1485
1485
|
s(R(d));
|
|
1486
1486
|
}
|
|
1487
1487
|
} catch {
|
|
1488
|
-
|
|
1488
|
+
T(!1);
|
|
1489
1489
|
}
|
|
1490
1490
|
})();
|
|
1491
1491
|
}, [e]), D(() => {
|
|
@@ -1505,82 +1505,113 @@ function Ut({ isOpen: e, onClose: t }) {
|
|
|
1505
1505
|
if (e)
|
|
1506
1506
|
return window.addEventListener("keydown", Q), () => window.removeEventListener("keydown", Q);
|
|
1507
1507
|
}, [e, Q]), D(() => {
|
|
1508
|
-
e || (v(null), m(void 0),
|
|
1509
|
-
}, [e]), e ? /* @__PURE__ */ b(
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
"
|
|
1513
|
-
{
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1508
|
+
e || (v(null), m(void 0), T(!1));
|
|
1509
|
+
}, [e]), e ? /* @__PURE__ */ b(
|
|
1510
|
+
"div",
|
|
1511
|
+
{
|
|
1512
|
+
className: "fixed inset-0 z-[9999] flex items-center justify-center",
|
|
1513
|
+
style: {
|
|
1514
|
+
position: "fixed",
|
|
1515
|
+
inset: 0,
|
|
1516
|
+
zIndex: 2147483647,
|
|
1517
|
+
display: "flex",
|
|
1518
|
+
alignItems: "center",
|
|
1519
|
+
justifyContent: "center",
|
|
1520
|
+
pointerEvents: "auto"
|
|
1521
|
+
},
|
|
1522
|
+
role: "dialog",
|
|
1523
|
+
"aria-modal": "true",
|
|
1524
|
+
"aria-labelledby": "insurance-modal-title",
|
|
1525
|
+
children: [
|
|
1526
|
+
/* @__PURE__ */ o(
|
|
1527
|
+
"div",
|
|
1528
|
+
{
|
|
1529
|
+
className: "backdrop",
|
|
1530
|
+
style: {
|
|
1531
|
+
position: "absolute",
|
|
1532
|
+
inset: 0,
|
|
1533
|
+
background: "rgba(0, 0, 0, 0.5)",
|
|
1534
|
+
pointerEvents: "auto"
|
|
1535
|
+
},
|
|
1536
|
+
onClick: t,
|
|
1537
|
+
"aria-hidden": "true"
|
|
1538
|
+
}
|
|
1539
|
+
),
|
|
1540
|
+
/* @__PURE__ */ b(
|
|
1541
|
+
"div",
|
|
1542
|
+
{
|
|
1543
|
+
className: "modal-panel bg-white relative w-full max-w-2xl flex flex-col max-h-[90vh] overflow-hidden",
|
|
1544
|
+
style: { background: "#ffffff", position: "relative", zIndex: 1 },
|
|
1545
|
+
role: "document",
|
|
1546
|
+
children: [
|
|
1547
|
+
/* @__PURE__ */ o("button", { onClick: t, className: "absolute top-4 right-4 text-slate-400 hover:text-slate-600 text-xl", "aria-label": "Close", type: "button", children: "×" }),
|
|
1548
|
+
/* @__PURE__ */ b("div", { className: "text-center mb-6", children: [
|
|
1549
|
+
/* @__PURE__ */ o("h2", { id: "insurance-modal-title", className: "h1-title", children: "Let's get you the best insurance rates." }),
|
|
1550
|
+
/* @__PURE__ */ o("p", { className: "p-subtitle", children: "This should only take a few minutes." })
|
|
1551
|
+
] }),
|
|
1552
|
+
/* @__PURE__ */ b("div", { className: "panel-body flex-1 min-h-0 overflow-y-auto", children: [
|
|
1553
|
+
!l && /* @__PURE__ */ o(ze, { children: A || r.length === 0 ? /* @__PURE__ */ o("div", { className: "flex items-center justify-center py-12", children: /* @__PURE__ */ o("div", { className: "text-slate-600", children: "Loading..." }) }) : /* @__PURE__ */ o(
|
|
1554
|
+
Ct,
|
|
1555
|
+
{
|
|
1556
|
+
stages: r,
|
|
1557
|
+
initialValues: u ?? void 0,
|
|
1558
|
+
initialActive: k,
|
|
1559
|
+
onStageComplete: async (C, I) => {
|
|
1560
|
+
try {
|
|
1561
|
+
const d = Ae(C), { stages: p } = await we(), c = R(p);
|
|
1562
|
+
s(c);
|
|
1563
|
+
const w = c.findIndex((_) => _.key === I) + 1, S = (w < c.length ? c[w] : null)?.key || I;
|
|
1564
|
+
if (n)
|
|
1565
|
+
if (I === "SMSVerification") {
|
|
1566
|
+
const { isVerified: _, token: f } = await Ft(n, d.sms_code);
|
|
1567
|
+
if (!_)
|
|
1568
|
+
throw new Error("Invalid SMS code");
|
|
1569
|
+
f && jt(f), await ce({ current_stage: S }, !1);
|
|
1570
|
+
} else if (I === "State") {
|
|
1571
|
+
const { isSupported: _ } = await Dt(d.state);
|
|
1572
|
+
if (!_)
|
|
1573
|
+
throw new Error("State is not supported");
|
|
1574
|
+
const f = me();
|
|
1575
|
+
await ce({ ...d, current_stage: S }, !1, f ? void 0 : n);
|
|
1576
|
+
} else {
|
|
1577
|
+
const _ = me();
|
|
1578
|
+
await ce({ ...d, current_stage: S }, !1, _ ? void 0 : n || void 0);
|
|
1579
|
+
}
|
|
1580
|
+
else {
|
|
1581
|
+
const f = (await Bt(d.phone))?.quoteId;
|
|
1582
|
+
if (!f || typeof f != "string" || f.trim() === "")
|
|
1583
|
+
throw new Error(`Failed to create quote - invalid quoteId returned: ${f}`);
|
|
1584
|
+
i(f), Et(f), await ce({ current_stage: S }, !1, f);
|
|
1585
|
+
}
|
|
1586
|
+
return { success: !0 };
|
|
1587
|
+
} catch (d) {
|
|
1588
|
+
return { success: !1, error: d instanceof Error ? d.message : "An error occurred" };
|
|
1589
|
+
}
|
|
1590
|
+
},
|
|
1591
|
+
onComplete: async (C) => {
|
|
1592
|
+
try {
|
|
1593
|
+
const I = Ae(C);
|
|
1594
|
+
if (!n)
|
|
1595
|
+
throw new Error("Quote ID is required");
|
|
1596
|
+
await ce(I, !0), v(C);
|
|
1597
|
+
const { rates: d } = await Kt();
|
|
1598
|
+
return a(d), { success: !0 };
|
|
1599
|
+
} catch (I) {
|
|
1600
|
+
return { success: !1, error: I instanceof Error ? I.message : "An error occurred" };
|
|
1550
1601
|
}
|
|
1551
|
-
else {
|
|
1552
|
-
const f = (await Bt(d.phone))?.quoteId;
|
|
1553
|
-
if (!f || typeof f != "string" || f.trim() === "")
|
|
1554
|
-
throw new Error(`Failed to create quote - invalid quoteId returned: ${f}`);
|
|
1555
|
-
i(f), Et(f), await ce({ current_stage: S }, !1, f);
|
|
1556
1602
|
}
|
|
1557
|
-
return { success: !0 };
|
|
1558
|
-
} catch (d) {
|
|
1559
|
-
return { success: !1, error: d instanceof Error ? d.message : "An error occurred" };
|
|
1560
1603
|
}
|
|
1561
|
-
},
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
}
|
|
1573
|
-
}
|
|
1574
|
-
}
|
|
1575
|
-
) }),
|
|
1576
|
-
" ",
|
|
1577
|
-
l && n && /* @__PURE__ */ o(Ot, { rates: l, onBack: () => a(null) })
|
|
1578
|
-
] }),
|
|
1579
|
-
/* @__PURE__ */ o("div", { className: "mt-4 pt-4 border-t border-slate-200", children: /* @__PURE__ */ o("p", { className: "text-center text-sm text-slate-500", children: "Insurance products offered through Credify Corporation, a licensed insurance agency." }) })
|
|
1580
|
-
]
|
|
1581
|
-
}
|
|
1582
|
-
)
|
|
1583
|
-
] }) : null;
|
|
1604
|
+
) }),
|
|
1605
|
+
" ",
|
|
1606
|
+
l && n && /* @__PURE__ */ o(Ot, { rates: l, onBack: () => a(null) })
|
|
1607
|
+
] }),
|
|
1608
|
+
/* @__PURE__ */ o("div", { className: "mt-4 pt-4 border-t border-slate-200", children: /* @__PURE__ */ o("p", { className: "text-center text-sm text-slate-500", children: "Insurance products offered through Credify Corporation, a licensed insurance agency." }) })
|
|
1609
|
+
]
|
|
1610
|
+
}
|
|
1611
|
+
)
|
|
1612
|
+
]
|
|
1613
|
+
}
|
|
1614
|
+
) : null;
|
|
1584
1615
|
}
|
|
1585
1616
|
function Vt({ isOpen: e }) {
|
|
1586
1617
|
return /* @__PURE__ */ o(
|
|
@@ -1595,7 +1626,7 @@ function Vt({ isOpen: e }) {
|
|
|
1595
1626
|
}
|
|
1596
1627
|
let Y = null, re = null, pe = !1;
|
|
1597
1628
|
function Yt() {
|
|
1598
|
-
Y || (Y = document.createElement("div"), Y.id = "insurance-widget-root", document.
|
|
1629
|
+
Y || (Y = document.createElement("div"), Y.id = "insurance-widget-root", document.documentElement.appendChild(Y)), !re && Y && (re = rt(Y));
|
|
1599
1630
|
}
|
|
1600
1631
|
function xe() {
|
|
1601
1632
|
Yt(), re && re.render(nt(Vt, { isOpen: pe }));
|