@getcredify/credify-insurance-widget 1.41.1 → 1.43.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 (65) hide show
  1. package/README.md +109 -0
  2. package/dist/address-BEVwov8q-Cgvd-ydq.js +59 -0
  3. package/dist/{api-Cjj6Dfhg.js → api-BGeBevot.js} +15 -15
  4. package/dist/car-BQXTRajZ.js +26 -0
  5. package/dist/check-04Hiu_0S.js +15 -0
  6. package/dist/copy-applicant-offer-CqzfNhkJ-CXzGxES4.js +56 -0
  7. package/dist/copy-from-record-BNP6CFFR-Ea4bf4lq.js +189 -0
  8. package/dist/core-CrEw_I-E-B6agkb7g.js +417 -0
  9. package/dist/coverageDerivation-CV2ORogj-B42UJhMa.js +76 -0
  10. package/dist/credify-insurance-widget.css +1 -1
  11. package/dist/{fixtures-ijbZ16Zg-BfdDTLYu.js → fixtures-ijbZ16Zg-Bmt9N4zO.js} +1 -1
  12. package/dist/household-prefill-CmtB9R3R-DaQcDYh7.js +151 -0
  13. package/dist/householdPrefill-DLm3pxFH-CqqJoa0N.js +111 -0
  14. package/dist/iframe/assets/address-BEVwov8q-Bqt4jr_e.js +1 -0
  15. package/dist/iframe/assets/car-B0PQzDYj.js +6 -0
  16. package/dist/iframe/assets/check-bC0Zibyh.js +6 -0
  17. package/dist/iframe/assets/copy-applicant-offer-CqzfNhkJ-D6mTQGjz.js +1 -0
  18. package/dist/iframe/assets/copy-from-record-BNP6CFFR-D3zdAXXN.js +6 -0
  19. package/dist/iframe/assets/core-CrEw_I-E-ecektrnv.js +16 -0
  20. package/dist/iframe/assets/coverageDerivation-CV2ORogj-CA4KQiLs.js +1 -0
  21. package/dist/iframe/assets/dob-calendar-RIJ5S6YU-1oIu3-0M.js +1 -0
  22. package/dist/iframe/assets/{fixtures-ijbZ16Zg-DbpkZfa3.js → fixtures-ijbZ16Zg-Dif2LDkg.js} +1 -1
  23. package/dist/iframe/assets/household-prefill-CmtB9R3R-CrgN1qav.js +1 -0
  24. package/dist/iframe/assets/householdPrefill-DLm3pxFH-B3K_XX2k.js +6 -0
  25. package/dist/iframe/assets/iframe-Bl0qTZgO.css +1 -0
  26. package/dist/iframe/assets/iframe-BsUmazO0.js +107 -0
  27. package/dist/iframe/assets/index-BipROEB3.js +6 -0
  28. package/dist/iframe/assets/intake-review-panel-D27t8CZO-UOfbb2gR.js +1 -0
  29. package/dist/iframe/assets/{mockJump-CL8w249w-Bp9W72n5.js → mockJump-hNzgzUmO-Dd1MY0fT.js} +1 -1
  30. package/dist/iframe/assets/payload-DrGFAxms-DeQGFkZt.js +1 -0
  31. package/dist/iframe/assets/question-list-DFjWa8ZA--GTrxgeK.js +317 -0
  32. package/dist/iframe/assets/rates-panel-BSFiWEZX-Bw7hcmIi.js +17 -0
  33. package/dist/iframe/assets/review-panel-C_WxX33U-BxLq8fbL.js +6 -0
  34. package/dist/iframe/assets/stage-knShj71W-BctzWtx2.js +1 -0
  35. package/dist/iframe/assets/types-LUGvo5ic-CB-wcgK3.js +1 -0
  36. package/dist/iframe/assets/validation-D42QXxck-CI1J_zUB.js +3 -0
  37. package/dist/iframe/assets/vehicleCoverage-CBWORI1l-D_NVJvjm.js +1 -0
  38. package/dist/iframe/assets/visibility-CKRGC3Il-CzwGG4Rt.js +1 -0
  39. package/dist/iframe/iframe.html +2 -2
  40. package/dist/index-C9szcdxC.js +354 -0
  41. package/dist/index.d.ts +24 -0
  42. package/dist/index.es.js +4 -4
  43. package/dist/index.umd.js +105 -115
  44. package/dist/intake-review-panel-D27t8CZO-BprNqAxn.js +186 -0
  45. package/dist/{mockJump-CL8w249w-1jjBaNyK.js → mockJump-hNzgzUmO-DdKPcdjz.js} +1 -1
  46. package/dist/payload-DrGFAxms-4aJBixaL.js +128 -0
  47. package/dist/question-list-DFjWa8ZA-DqUPEU4a.js +6505 -0
  48. package/dist/rates-panel-BSFiWEZX-poz1p0rK.js +1001 -0
  49. package/dist/review-panel-C_WxX33U-DAqsW53a.js +903 -0
  50. package/dist/stage-knShj71W-DkbEgye4.js +197 -0
  51. package/dist/types-LUGvo5ic-CiVRcsV9.js +9 -0
  52. package/dist/utils/assets.d.ts +12 -0
  53. package/dist/utils/branding.d.ts +21 -0
  54. package/dist/utils/partner.d.ts +32 -0
  55. package/dist/utils/prefill.d.ts +18 -0
  56. package/dist/utils/support/bland.d.ts +5 -0
  57. package/dist/validation-D42QXxck-6HA5X_Ql.js +2852 -0
  58. package/dist/vehicleCoverage-CBWORI1l-Cy7XD_03.js +144 -0
  59. package/dist/visibility-CKRGC3Il-v2xplFmb.js +198 -0
  60. package/dist/widget-wgT55Lu5.js +13109 -0
  61. package/package.json +2 -2
  62. package/dist/iframe/assets/dob-calendar-RIJ5S6YU-DMJbmHdB.js +0 -1
  63. package/dist/iframe/assets/iframe-DFqQdMHv.css +0 -1
  64. package/dist/iframe/assets/iframe-iPSy7w5L.js +0 -494
  65. package/dist/widget-Umfy69_M.js +0 -27318
@@ -0,0 +1,197 @@
1
+ import { t as O, $ as V, a0 as x, a1 as D, a2 as F } from "./widget-wgT55Lu5.js";
2
+ import { t as q, n as g } from "./types-LUGvo5ic-CiVRcsV9.js";
3
+ import { k as h, j as f, n as L, u as P, c as R, d as U, A as j } from "./visibility-CKRGC3Il-v2xplFmb.js";
4
+ import { k as A } from "./validation-D42QXxck-6HA5X_Ql.js";
5
+ import { t as $, l as Y, a as Q, o as M, i as K, f as B, n as W, r as I } from "./vehicleCoverage-CBWORI1l-Cy7XD_03.js";
6
+ (function() {
7
+ if (typeof s > "u")
8
+ var s = { env: {} };
9
+ })();
10
+ var C = /* @__PURE__ */ new Set([
11
+ "sale_price_cents",
12
+ "dwelling_replacement_cost",
13
+ "other_structures_coverage",
14
+ "personal_property_coverage",
15
+ "loss_of_use_coverage",
16
+ "custom_equipment_value_cents",
17
+ "cost_new_value_cents",
18
+ "stated_value_amount_cents",
19
+ "property_damage_amount_paid_cents",
20
+ "personal_injury_amount_paid_cents",
21
+ "auto_current_annual_premium_cents",
22
+ "amount_paid_cents"
23
+ ]), G = /* @__PURE__ */ new Set([
24
+ "total_area_sq_ft",
25
+ "annual_mileage",
26
+ "miles_to_work",
27
+ "distance_to_coast_miles"
28
+ ]), H = (s) => C.has(s), Z = (s) => C.has(s) || G.has(s), z = (s, e) => {
29
+ let r = String(s ?? "").replace(/\D/g, "");
30
+ if (!r) return "";
31
+ let t = Number(r);
32
+ if (!Number.isFinite(t)) return "";
33
+ let o = t.toLocaleString("en-US");
34
+ return e ? `$${o}` : o;
35
+ }, pe = /* @__PURE__ */ O({
36
+ STAGES_BY_PRODUCT: () => F,
37
+ ZIP_FIRST_PAINT_CACHE_KEY: () => D,
38
+ ZIP_FIRST_PAINT_QUESTIONS: () => x,
39
+ itemScope: () => w,
40
+ reviewGroupsForStage: () => le,
41
+ reviewRowsForStage: () => oe,
42
+ stageSlice: () => te,
43
+ validateStage: () => se
44
+ }), J = ["ssn_display"], w = (s, e) => {
45
+ let r = {
46
+ ...s,
47
+ ...e
48
+ };
49
+ for (let t of J) t in e || delete r[t];
50
+ return r;
51
+ }, X = (s, e, r) => {
52
+ let t = w(s, e);
53
+ for (let o of r) o.key in e ? t[o.key] = e[o.key] : delete t[o.key];
54
+ return t;
55
+ }, ee = {
56
+ vehicles: "Vehicle",
57
+ drivers: "Driver",
58
+ driver_accidents: "Accident",
59
+ driver_violations: "Violation",
60
+ losses: "Loss",
61
+ home_losses: "Loss"
62
+ }, d = (s) => ee[s] ?? "Entry", b = (s, e, r, t) => {
63
+ let o = (l, i) => {
64
+ l.forEach((a) => {
65
+ let u = P(a);
66
+ if (u) {
67
+ let n = R(a) || i[a.key] === u.conditionalValue;
68
+ t(a.key, u.conditionalQuestions ?? [], n);
69
+ }
70
+ U(a, i).forEach((n) => {
71
+ n.conditionalQuestionsAllowMultiple || o(n.conditionalQuestions ?? [], i);
72
+ });
73
+ });
74
+ };
75
+ o(L(s), e);
76
+ }, se = ({ questions: s, values: e, stageKey: r }) => {
77
+ let t = h(s, e, r), o = A(t, e), l = [], i = [];
78
+ for (let [a, u] of Object.entries(o)) {
79
+ let n = t.find((c) => c.key === a);
80
+ i.push(`${n?.question ?? a}: ${u}`);
81
+ }
82
+ if (b(s, e, r, (a, u, n) => {
83
+ if (!n) return;
84
+ let c = f(e, a);
85
+ if (!c.length) {
86
+ i.push(`Add at least one ${d(a).toLowerCase()}.`), o[g(a)] = `Add at least one ${d(a).toLowerCase()}.`;
87
+ return;
88
+ }
89
+ c.forEach((y, p) => {
90
+ let _ = j(u, y, e, r, p), N = A(_, X(e, y, _)), m = {};
91
+ for (let v of _) {
92
+ let k = N[v.key];
93
+ k && (m[v.key] = k, i.push(`${d(a)} ${p + 1} — ${v.question}: ${k}`));
94
+ }
95
+ Object.keys(m).length && l.push({
96
+ groupKey: a,
97
+ index: p,
98
+ errorsByKey: m
99
+ });
100
+ });
101
+ }), t.some((a) => a.key === "vehicle_policy_selections")) {
102
+ let a = f(e, "vehicles"), u = /* @__PURE__ */ new Map();
103
+ for (let y of Y(a)) u.set(y.index, { ...y.errorsByKey }), i.push(`Vehicle ${y.index + 1} — coverage selections are incomplete.`);
104
+ let n = Q(e), c = f(e, "drivers").length;
105
+ a.forEach((y, p) => {
106
+ let _ = M(n, p, c);
107
+ _ && (u.set(p, {
108
+ ...u.get(p) ?? {},
109
+ [$]: _
110
+ }), i.push(`Vehicle ${p + 1} — ${_}`));
111
+ });
112
+ for (let [y, p] of u) l.push({
113
+ groupKey: "vehicles",
114
+ index: y,
115
+ errorsByKey: p
116
+ });
117
+ }
118
+ return {
119
+ errorsByKey: o,
120
+ itemErrors: l,
121
+ issues: i,
122
+ isValid: Object.keys(o).length === 0 && l.length === 0
123
+ };
124
+ }, E = (s) => Object.values(s).every((e) => e == null || String(e).trim() === ""), te = (s, e, r) => {
125
+ let t = {};
126
+ for (let l of h(s, e, r)) l.key in e && (t[l.key] = e[l.key]);
127
+ b(s, e, r, (l, i, a) => {
128
+ let u = g(l);
129
+ if (!a || !(u in e)) return;
130
+ let n = f(e, l), c = n.filter((y) => !E(y));
131
+ !c.length && n.length || (t[u] = c, t[l] = e[l] ?? "Yes");
132
+ });
133
+ let o = g("vehicles");
134
+ return h(s, e, r).some((l) => l.key === "vehicle_policy_selections") && o in e && !(o in t) && (t[o] = f(e, "vehicles").filter((l) => !E(l)), t.vehicles = e.vehicles ?? "Yes", "driver_vehicle_assignments" in e && (t[$] = e[$])), t;
135
+ }, re = (s, e) => [s.first_name, s.last_name].map((r) => String(r ?? "").trim()).filter(Boolean).join(" ") || `Driver ${e + 1}`, ie = (s, e, r) => s === "vehicles" ? B(e, r) : s === "drivers" ? re(e, r) : `${d(s)} ${r + 1}`, le = ({ questions: s, values: e, stageKey: r, suppressedKeys: t }) => {
136
+ let o = [];
137
+ return b(s, e, r, (l, i, a) => {
138
+ if (!a) return;
139
+ let u = f(e, l).map((n, c) => {
140
+ let y = w(e, n), p = j(i, n, e, r, c);
141
+ return {
142
+ name: ie(l, n, c),
143
+ rows: p.filter((_) => !_.key.endsWith(q)).filter((_) => !t?.has(_.key)).map((_) => ({
144
+ key: `${l}__${c}__${_.key}`,
145
+ label: _.question,
146
+ value: S(_, n[_.key], y)
147
+ }))
148
+ };
149
+ });
150
+ o.push({
151
+ groupKey: l,
152
+ label: l.replace(/_/g, " ").replace(/^./, (n) => n.toUpperCase()),
153
+ entries: u
154
+ });
155
+ }), o;
156
+ }, T = (s) => {
157
+ let e = String(s ?? "").replace(/\D/g, "");
158
+ return e.length >= 4 ? e.slice(-4) : null;
159
+ }, S = (s, e, r) => {
160
+ if (s.key === "social_security_number") {
161
+ let t = T(e) ?? T(r.ssn_display);
162
+ return t ? `•••–••–${t}` : "—";
163
+ }
164
+ return e == null || e === "" ? "—" : e === !0 ? "Yes" : e === !1 ? "No" : Array.isArray(e) ? `${e.length} added` : s.inputType === "select" || s.inputType === "radio" ? V(s.key, String(e)) : s.inputType === "number" && Z(s.key) && z(e, H(s.key)) || String(e);
165
+ }, ae = (s) => ({
166
+ question: I[s],
167
+ key: s,
168
+ required: !0,
169
+ inputType: "select"
170
+ }), oe = ({ questions: s, values: e, stageKey: r, suppressedKeys: t }) => {
171
+ let o = h(s, e, r), l = o.filter((i) => !i.key.endsWith(q)).filter((i) => i.key !== K).filter((i) => !t?.has(i.key)).map((i) => ({
172
+ key: i.key,
173
+ label: i.question,
174
+ value: S(i, e[i.key], e)
175
+ }));
176
+ return o.some((i) => i.key === "vehicle_policy_selections") && f(e, "vehicles").forEach((i, a) => {
177
+ let u = B(i, a);
178
+ for (let n of W) l.push({
179
+ key: `${K}__${a}__${n}`,
180
+ label: `${u} — ${I[n]}`,
181
+ value: S(ae(n), i[n], e)
182
+ });
183
+ }), l;
184
+ };
185
+ export {
186
+ pe as a,
187
+ G as c,
188
+ Z as d,
189
+ te as i,
190
+ z as l,
191
+ le as n,
192
+ se as o,
193
+ oe as r,
194
+ C as s,
195
+ w as t,
196
+ H as u
197
+ };
@@ -0,0 +1,9 @@
1
+ (function() {
2
+ if (typeof e > "u")
3
+ var e = { env: {} };
4
+ })();
5
+ var n = "__items", t = (e) => `${e}${n}`;
6
+ export {
7
+ t as n,
8
+ n as t
9
+ };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Where partner logos and branding documents live.
3
+ *
4
+ * Read from the build environment for the same reason as the API origin, and
5
+ * with the same production default — see `./api`. A stable host rather than the
6
+ * distribution's generated CloudFront name: this bundle is published
7
+ * independently of the infrastructure, so it cannot learn a generated hostname,
8
+ * and a recreated distribution would silently orphan every embed already out
9
+ * in the wild.
10
+ */
11
+ export declare const ASSETS_BASE_URL: string;
12
+ //# sourceMappingURL=assets.d.ts.map
@@ -0,0 +1,21 @@
1
+ export type PartnerBranding = {
2
+ firmName: string | null;
3
+ logoUrl: string | null;
4
+ /** Any colour string the kit's theme layer accepts, or null to keep Credify's. */
5
+ brandColour: string | null;
6
+ };
7
+ /**
8
+ * Takes `unknown` because this is a network document: it is ours, but a stale
9
+ * or truncated object must not reach the theme layer unchecked.
10
+ */
11
+ export declare function parseBrandingDocument(input: unknown): PartnerBranding | null;
12
+ /**
13
+ * Starts the fetch. Called from `init()` so the document is usually in hand by
14
+ * the time someone opens the widget, and at most one request is made per page.
15
+ */
16
+ export declare function primeBranding(): void;
17
+ /** The primed result, or null for an embed with no partner or no document. */
18
+ export declare function loadBranding(): Promise<PartnerBranding | null>;
19
+ /** Test seam: clears the memoised request. */
20
+ export declare function resetBrandingForTests(): void;
21
+ //# sourceMappingURL=branding.d.ts.map
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Partner attribution supplied by the host's embed snippet.
3
+ *
4
+ * `init({ partner })` is the only source. Unlike the product and the test flag
5
+ * there is no URL param to read: the id belongs to the page the embed sits on,
6
+ * not to the link that reached it. Held as module state for the same reason
7
+ * those are — `configureKit()` runs from the flow's first render, well after
8
+ * `init()` returned, so the value has to outlive the call that supplied it.
9
+ */
10
+ export type PartnerAttribution = {
11
+ /** The partner's public id, `cp_live_…`. */
12
+ id: string;
13
+ /** The partner's own campaign or placement label. */
14
+ sub?: string;
15
+ };
16
+ /**
17
+ * Validates the host's `partner` option and keeps it for the create-quote call.
18
+ *
19
+ * Takes `unknown` because the type is only a promise: this arrives from a
20
+ * hand-written snippet on someone else's page, where nothing checked it.
21
+ *
22
+ * Every rejection path drops the attribution and carries on. A partner id is
23
+ * worth money to us and nothing at all to the customer typing their ZIP, so a
24
+ * typo in a snippet must cost an unattributed quote and never a quote. Nothing
25
+ * here throws, including on an option whose own property getters do.
26
+ *
27
+ * Call once at init, before rendering — the flow reads the result as it mounts.
28
+ */
29
+ export declare function capturePartner(option: unknown): void;
30
+ /** The validated attribution, if the host supplied a usable one. */
31
+ export declare function getPartner(): PartnerAttribution | undefined;
32
+ //# sourceMappingURL=partner.d.ts.map
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Contact details the host page already collected, passed to `init()`. Module
3
+ * state, like the partner attribution: the flow reads it as it mounts.
4
+ */
5
+ import type { QuotePrefill } from '@getcredify/credify-insurance-ui-kit/ui';
6
+ export type WidgetPrefill = {
7
+ /** 5-digit ZIP. Anything else is dropped. */
8
+ zip?: string;
9
+ email?: string;
10
+ };
11
+ /**
12
+ * Validates the host's `prefill` option. Every rejection path drops the value and
13
+ * carries on — a bad one costs a skipped question, never the quote — and nothing
14
+ * here throws, including on an option whose own getters do.
15
+ */
16
+ export declare function capturePrefill(option: unknown): void;
17
+ export declare function getPrefill(): QuotePrefill | undefined;
18
+ //# sourceMappingURL=prefill.d.ts.map
@@ -32,6 +32,11 @@ export declare function hostBlandPresent(): boolean;
32
32
  /**
33
33
  * Ensure Bland is loading. No-op when the host already owns it — `blandSettings`
34
34
  * is assigned only when absent, so a host's agent id and request data always win.
35
+ *
36
+ * The host's partner id travels with the conversation. A chat that escalates
37
+ * into an application is submitted by the agent, not the browser, so this is
38
+ * the only point at which the page it started on can name the partner who owns
39
+ * the lead — the backend resolves it and credits them, or ignores it.
35
40
  */
36
41
  export declare function loadBland(widgetId: string, requestData?: Record<string, unknown>): void;
37
42
  /**