@getcredify/credify-insurance-widget 1.6.0 → 1.7.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/dist/iframe/assets/iframe-5Q3mEx6K.js +50 -0
- package/dist/iframe/assets/iframe-5Q3mEx6K.js.map +1 -0
- package/dist/iframe/iframe.html +1 -1
- package/dist/index.es.js +618 -555
- package/dist/index.es.js.map +1 -1
- package/dist/index.html +13 -0
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/dist/iframe/assets/iframe-wE-QZFHu.js +0 -50
- package/dist/iframe/assets/iframe-wE-QZFHu.js.map +0 -1
package/dist/index.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(`@import"https://fonts.googleapis.com/css2?family=Spline+Sans:wght@400;500;700&display=swap";/*! tailwindcss v4.1.12 | MIT License | https://tailwindcss.com */@layer properties,theme,base,components,utilities;@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-emerald-600:oklch(59.6% .145 163.225);--color-blue-50:oklch(97% .014 254.604);--color-blue-600:oklch(54.6% .245 262.881);--color-blue-700:oklch(48.8% .243 264.376);--color-slate-50:oklch(98.4% .003 247.858);--color-slate-100:oklch(96.8% .007 247.896);--color-slate-200:oklch(92.9% .013 255.508);--color-slate-300:oklch(86.9% .022 252.894);--color-slate-400:oklch(70.4% .04 256.788);--color-slate-500:oklch(55.4% .046 257.417);--color-slate-600:oklch(44.6% .043 257.281);--color-slate-700:oklch(37.2% .044 257.287);--color-slate-900:oklch(20.8% .042 265.755);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-900:oklch(21% .034 264.665);--color-white:#fff;--spacing:.25rem;--container-2xl:42rem;--container-4xl:56rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2/1.5);--text-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--animate-spin:spin 1s linear infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer utilities{.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.inset-0{inset:calc(var(--spacing)*0)}.top-4{top:calc(var(--spacing)*4)}.right-4{right:calc(var(--spacing)*4)}.z-0{z-index:0}.z-50{z-index:50}.z-\\[9999\\]{z-index:9999}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.mx-auto{margin-inline:auto}.-mt-4{margin-top:calc(var(--spacing)*-4)}.mt-0\\.5{margin-top:calc(var(--spacing)*.5)}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-3{margin-top:calc(var(--spacing)*3)}.mt-4{margin-top:calc(var(--spacing)*4)}.mt-6{margin-top:calc(var(--spacing)*6)}.mt-8{margin-top:calc(var(--spacing)*8)}.mt-auto{margin-top:auto}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.mb-6{margin-bottom:calc(var(--spacing)*6)}.mb-8{margin-bottom:calc(var(--spacing)*8)}.ml-1{margin-left:calc(var(--spacing)*1)}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-flex{display:inline-flex}.h-5{height:calc(var(--spacing)*5)}.h-12{height:calc(var(--spacing)*12)}.max-h-60{max-height:calc(var(--spacing)*60)}.max-h-\\[90vh\\]{max-height:90vh}.min-h-0{min-height:calc(var(--spacing)*0)}.min-h-screen{min-height:100vh}.w-5{width:calc(var(--spacing)*5)}.w-12{width:calc(var(--spacing)*12)}.w-auto{width:auto}.w-full{width:100%}.max-w-2xl{max-width:var(--container-2xl)}.max-w-4xl{max-width:var(--container-4xl)}.flex-1{flex:1}.flex-shrink{flex-shrink:1}.flex-shrink-0{flex-shrink:0}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.animate-spin{animation:var(--animate-spin)}.cursor-pointer{cursor:pointer}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*4)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*6)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*6)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-x-2>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing)*2)*var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-x-reverse)))}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-l-lg{border-top-left-radius:var(--radius-lg);border-bottom-left-radius:var(--radius-lg)}.rounded-r-lg{border-top-right-radius:var(--radius-lg);border-bottom-right-radius:var(--radius-lg)}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-\\[var\\(--accent-color\\)\\]{border-color:var(--accent-color)}.border-blue-600{border-color:var(--color-blue-600)}.border-gray-200{border-color:var(--color-gray-200)}.border-gray-300{border-color:var(--color-gray-300)}.border-red-500{border-color:var(--color-red-500)}.border-slate-100{border-color:var(--color-slate-100)}.border-slate-200{border-color:var(--color-slate-200)}.bg-blue-50{background-color:var(--color-blue-50)}.bg-blue-600{background-color:var(--color-blue-600)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-300{background-color:var(--color-gray-300)}.bg-slate-50{background-color:var(--color-slate-50)}.bg-slate-100{background-color:var(--color-slate-100)}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.object-contain{object-fit:contain}.p-3{padding:calc(var(--spacing)*3)}.p-6{padding:calc(var(--spacing)*6)}.p-8{padding:calc(var(--spacing)*8)}.px-1{padding-inline:calc(var(--spacing)*1)}.px-2\\.5{padding-inline:calc(var(--spacing)*2.5)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-6{padding-inline:calc(var(--spacing)*6)}.py-1{padding-block:calc(var(--spacing)*1)}.py-2\\.5{padding-block:calc(var(--spacing)*2.5)}.py-3{padding-block:calc(var(--spacing)*3)}.py-12{padding-block:calc(var(--spacing)*12)}.pt-4{padding-top:calc(var(--spacing)*4)}.pt-6{padding-top:calc(var(--spacing)*6)}.pb-1{padding-bottom:calc(var(--spacing)*1)}.text-center{text-align:center}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-\\[var\\(--text-primary\\)\\]{color:var(--text-primary)}.text-blue-600{color:var(--color-blue-600)}.text-emerald-600{color:var(--color-emerald-600)}.text-gray-700{color:var(--color-gray-700)}.text-gray-900{color:var(--color-gray-900)}.text-red-600{color:var(--color-red-600)}.text-slate-400{color:var(--color-slate-400)}.text-slate-500{color:var(--color-slate-500)}.text-slate-600{color:var(--color-slate-600)}.text-slate-700{color:var(--color-slate-700)}.text-slate-900{color:var(--color-slate-900)}.text-white{color:var(--color-white)}.lowercase{text-transform:lowercase}.underline{text-decoration-line:underline}.opacity-25{opacity:.25}.opacity-75{opacity:.75}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,visibility,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.outline-none{--tw-outline-style:none;outline-style:none}.focus-within\\:border-\\[var\\(--primary-color\\)\\]:focus-within{border-color:var(--primary-color)}@media (hover:hover){.hover\\:bg-blue-600\\/90:hover{background-color:#155dfce6}@supports (color:color-mix(in lab,red,red)){.hover\\:bg-blue-600\\/90:hover{background-color:color-mix(in oklab,var(--color-blue-600)90%,transparent)}}.hover\\:bg-gray-50:hover{background-color:var(--color-gray-50)}.hover\\:bg-slate-50:hover{background-color:var(--color-slate-50)}.hover\\:text-blue-700:hover{color:var(--color-blue-700)}.hover\\:text-slate-600:hover{color:var(--color-slate-600)}.hover\\:shadow-md:hover{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}.focus-visible\\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\\:ring-blue-600\\/40:focus-visible{--tw-ring-color:#155dfc66}@supports (color:color-mix(in lab,red,red)){.focus-visible\\:ring-blue-600\\/40:focus-visible{--tw-ring-color:color-mix(in oklab,var(--color-blue-600)40%,transparent)}}.focus-visible\\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:bg-slate-300:disabled{background-color:var(--color-slate-300)}.disabled\\:text-slate-500:disabled{color:var(--color-slate-500)}.disabled\\:opacity-50:disabled{opacity:.5}@media (min-width:40rem){.sm\\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (min-width:64rem){.lg\\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}}:root{--primary-color:#006aff;--secondary-color:#f0f4ff;--background-color:#fff;--text-primary:#1a202c;--text-secondary:#718096;--accent-color:#e2e8f0;--radius-sm:.25rem;--radius-md:.5rem;--radius-lg:.75rem;--radius-xl:1rem;--radius-2xl:1.25rem;--radius-3xl:1.75rem;--radius-full:9999px;--radio-dot-svg:url("data:image/svg+xml,%3csvg viewBox=%270 0 16 16%27 fill=%27%23006aff%27 xmlns=%27http://www.w3.org/2000/svg%27%3e%3ccircle cx=%278%27 cy=%278%27 r=%274%27/%3e%3c/svg%3e");--select-button-svg:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='24px' height='24px' fill='%23718096' viewBox='0 0 256 256'%3e%3cpath d='m215.39 92.94-80 80a8 8 0 0 1-11.32 0l-80-80a8 8 0 1 1 11.32-11.32L128 154.06l74.07-72.44a8 8 0 0 1 11.32 11.32Z'/%3e%3c/svg%3e")}#insurance-widget-root,#root{color:var(--text-primary);font-family:Spline Sans,ui-sans-serif,system-ui,sans-serif}#insurance-widget-root .backdrop,#root .backdrop{background:#00000080;position:fixed;inset:0}#insurance-widget-root .modal-panel,#root .modal-panel{border-radius:var(--radius-2xl);padding:1.5rem;box-shadow:0 24px 64px -20px #00000059;background:#fff!important}@media (min-width:640px){#insurance-widget-root .modal-panel,#root .modal-panel{padding:2rem}}@media (min-width:768px){#insurance-widget-root .modal-panel,#root .modal-panel{padding:2.5rem}}@media (max-width:767px){#insurance-widget-root .modal-panel,#root .modal-panel{width:100%;max-width:none;height:100%;max-height:none;box-shadow:none;border-radius:0;position:fixed;inset:0}}#insurance-widget-root .h1-title,#root .h1-title{letter-spacing:-.01em;color:var(--text-primary);font-size:1.875rem;font-weight:700;line-height:2.25rem}@media (min-width:640px){#insurance-widget-root .h1-title,#root .h1-title{font-size:2.25rem;line-height:2.5rem}}#insurance-widget-root .p-subtitle,#root .p-subtitle{color:var(--text-secondary);margin-top:.5rem}#insurance-widget-root .form-label,#root .form-label{color:var(--text-secondary);margin-bottom:.5rem;font-size:.875rem;font-weight:500;display:block}#insurance-widget-root .form-input,#root .form-input{border-radius:var(--radius-lg);border:1px solid var(--accent-color);width:100%;color:var(--text-primary);background:#fff;outline:none;padding:.75rem 1rem;font-size:1rem;transition:box-shadow .15s,border-color .15s}#insurance-widget-root .form-input::placeholder,#root .form-input::placeholder{color:#94a3b8}#insurance-widget-root .form-input:focus,#root .form-input:focus{border-color:var(--primary-color);box-shadow:0 0 0 1px var(--primary-color)}#insurance-widget-root .select-caret,#root .select-caret{background-image:var(--select-button-svg);appearance:none;background-position:right .75rem center;background-repeat:no-repeat;background-size:1.25rem 1.25rem;padding-right:2.5rem}#insurance-widget-root .radio-card,#root .radio-card{border-radius:var(--radius-md);border:2px solid var(--accent-color);cursor:pointer;background:#fff;align-items:center;gap:.75rem;padding:1rem;transition:all .15s;display:flex}#insurance-widget-root .radio-card:hover,#root .radio-card:hover{border-color:#cfd8e3}#insurance-widget-root .radio-input,#root .radio-input{border:2px solid var(--accent-color);appearance:none;background:0 0;border-radius:9999px;outline:none;width:1.25rem;height:1.25rem}#insurance-widget-root .radio-input:checked,#root .radio-input:checked{border-color:var(--primary-color);background-image:var(--radio-dot-svg);background-position:50%;background-repeat:no-repeat}#insurance-widget-root .radio-card:has(.radio-input:checked),#root .radio-card:has(.radio-input:checked){border-color:var(--primary-color);box-shadow:0 0 0 2px var(--primary-color)}@supports (color:color-mix(in lab,red,red)){#insurance-widget-root .radio-card:has(.radio-input:checked),#root .radio-card:has(.radio-input:checked){box-shadow:0 0 0 2px color-mix(in oklab,var(--primary-color)20%,transparent)}}#insurance-widget-root .radio-label,#root .radio-label{color:var(--text-primary);font-size:1rem;font-weight:600}#insurance-widget-root .btn-primary,#root .btn-primary{border-radius:var(--radius-full);background:var(--primary-color);color:#fff;letter-spacing:.02em;justify-content:center;align-items:center;width:100%;height:3rem;font-weight:700;transition:opacity .15s;display:flex}#insurance-widget-root .btn-primary:hover,#root .btn-primary:hover{opacity:.9}#insurance-widget-root .btn-outline,#root .btn-outline{border-radius:var(--radius-full);width:100%;height:3rem;color:var(--text-primary);border:1px solid var(--accent-color);letter-spacing:.02em;background:#fff;justify-content:center;align-items:center;font-weight:700;transition:background .15s,color .15s,border-color .15s,opacity .15s;display:flex}#insurance-widget-root .btn-outline:hover,#root .btn-outline:hover{border-color:#cfd8e3}#insurance-widget-root .btn-primary,#root .btn-primary,#insurance-widget-root .btn-outline,#root .btn-outline{cursor:pointer}#insurance-widget-root .btn-primary:disabled,#root .btn-primary:disabled,#insurance-widget-root .btn-outline:disabled,#root .btn-outline:disabled{opacity:.5;cursor:not-allowed;filter:grayscale(20%)}#insurance-widget-root .btn-primary:not(:disabled):hover,#root .btn-primary:not(:disabled):hover{opacity:.95}#insurance-widget-root .btn-outline:not(:disabled):hover,#root .btn-outline:not(:disabled):hover{border-color:#cfd8e3}#insurance-widget-root .quote-btn,#root .quote-btn{background-color:var(--color-blue-600);padding-inline:calc(var(--spacing)*6);padding-block:calc(var(--spacing)*3);--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-white);--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,visibility,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration));border-radius:3.40282e38px}@media (hover:hover){:is(#insurance-widget-root .quote-btn,#root .quote-btn):hover{background-color:var(--color-blue-700)}}#insurance-widget-root .input-error,#root .input-error{border-color:#dc2626!important;box-shadow:0 0 0 1px #dc2626!important}#insurance-widget-root .checkbox-card,#root .checkbox-card{border-radius:var(--radius-md);border:2px solid var(--accent-color);cursor:pointer;background:#fff;align-items:center;gap:.75rem;padding:1rem;transition:all .15s;display:flex}#insurance-widget-root .checkbox-card:hover,#root .checkbox-card:hover{border-color:#cfd8e3}#insurance-widget-root .checkbox-input,#root .checkbox-input{border:2px solid var(--accent-color);appearance:none;background:#fff;border-radius:.375rem;outline:none;place-items:center;width:1.25rem;height:1.25rem;display:grid}#insurance-widget-root .checkbox-input:checked,#root .checkbox-input:checked{border-color:var(--primary-color);background-color:var(--primary-color);background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' viewBox='0 0 24 24'%3e%3cpath d='M20.285 6.709a1 1 0 0 1 0 1.414l-9.192 9.193a1 1 0 0 1-1.414 0L3.715 11.55a1 1 0 1 1 1.414-1.414l5.05 5.05 8.485-8.478a1 1 0 0 1 1.621.001z'/%3e%3c/svg%3e");background-position:50%;background-repeat:no-repeat}#insurance-widget-root .checkbox-card:has(.checkbox-input:checked),#root .checkbox-card:has(.checkbox-input:checked){border-color:var(--primary-color);box-shadow:0 0 0 2px var(--primary-color)}@supports (color:color-mix(in lab,red,red)){#insurance-widget-root .checkbox-card:has(.checkbox-input:checked),#root .checkbox-card:has(.checkbox-input:checked){box-shadow:0 0 0 2px color-mix(in oklab,var(--primary-color)20%,transparent)}}#insurance-widget-root .checkbox-label,#root .checkbox-label{color:var(--text-primary);font-size:1rem;font-weight:600}#insurance-widget-root .modal-scroll,#root .modal-scroll{overscroll-behavior:contain;-webkit-overflow-scrolling:touch;max-height:min(90dvh,800px);overflow-y:auto}#insurance-widget-root .modal-scroll .h1-title,#root .modal-scroll .h1-title{z-index:1;background:#fff;padding-top:.25rem;padding-bottom:.75rem;position:sticky;top:0}#insurance-widget-root .panel-body,#root .panel-body{padding:4px;scroll-padding:4px}#insurance-widget-root .tel-input-wrapper:focus-within:not(.error),#root .tel-input-wrapper:focus-within:not(.error){outline:1px solid var(--primary-color);outline-offset:0px;z-index:1}#insurance-widget-root .tel-input-wrapper.error,#root .tel-input-wrapper.error{outline-offset:0px;z-index:1;outline:1px solid #ef4444}#insurance-widget-root .tel-input-wrapper:focus-within:after,#root .tel-input-wrapper:focus-within:after{content:"";border:1px solid var(--primary-color);pointer-events:none;z-index:10;border-radius:.75rem;position:absolute;inset:-1px}#insurance-widget-root .tel-input-wrapper.error:after,#root .tel-input-wrapper.error:after{content:"";pointer-events:none;z-index:10;border:1px solid #ef4444;border-radius:.75rem;position:absolute;inset:-1px}#insurance-widget-root .form-label:has(+input[aria-required=true]):after,#root .form-label:has(+input[aria-required=true]):after,#insurance-widget-root .form-label:has(+select[aria-required=true]):after,#root .form-label:has(+select[aria-required=true]):after,#insurance-widget-root .form-label:has(+textarea[aria-required=true]):after,#root .form-label:has(+textarea[aria-required=true]):after,#insurance-widget-root .legend-required:after,#root .legend-required:after{content:" *";color:#dc2626;margin-left:.25rem}#insurance-widget-root .scrollbar-hide,#root .scrollbar-hide{-ms-overflow-style:none;scrollbar-width:none}#insurance-widget-root .scrollbar-hide::-webkit-scrollbar{display:none}#root .scrollbar-hide::-webkit-scrollbar{display:none}#insurance-widget-root button.form-wizard-next-btn[data-widget-ctrl=next][type=button],#root button.form-wizard-next-btn[data-widget-ctrl=next][type=button],#insurance-widget-root button.form-wizard-next-btn[data-widget-ctrl=next][type=button]:disabled,#root button.form-wizard-next-btn[data-widget-ctrl=next][type=button]:disabled{visibility:visible!important;opacity:1!important;clip-path:none!important;pointer-events:auto!important;color:#fff!important;background-color:#2563eb!important;min-height:3rem!important;display:flex!important;position:relative!important;overflow:visible!important}#insurance-widget-root button.form-wizard-next-btn[data-widget-ctrl=next][type=button]:disabled,#root button.form-wizard-next-btn[data-widget-ctrl=next][type=button]:disabled{opacity:.5!important;background-color:#d1d5db!important}#insurance-widget-root .credify-link-underline,#root .credify-link-underline{color:var(--primary-color);text-decoration:underline}#insurance-widget-root .credify-link-underline:hover,#root .credify-link-underline:hover{color:#0052cc}#insurance-widget-root button.modal-close-btn[type=button],#root button.modal-close-btn[type=button]{appearance:none;background:0 0;border:none;padding:0;visibility:visible!important;opacity:1!important;cursor:pointer!important;clip-path:none!important;pointer-events:auto!important;display:inline-flex!important;overflow:visible!important}@media (max-width:767px){#insurance-widget-root button.modal-close-btn[type=button],#root button.modal-close-btn[type=button]{visibility:hidden!important;pointer-events:none!important;display:none!important}}#insurance-widget-root button.credify-btn-back[type=button],#root button.credify-btn-back[type=button],#insurance-widget-root button.credify-btn-back[type=button]:disabled,#root button.credify-btn-back[type=button]:disabled{transition:border-color .15s,background-color .15s;visibility:visible!important;opacity:1!important;clip-path:none!important;pointer-events:auto!important;box-sizing:border-box!important;border-radius:var(--radius-full)!important;color:#1a202c!important;text-align:center!important;cursor:pointer!important;background-color:#fff!important;border:1px solid #e2e8f0!important;place-content:center!important;place-items:center!important;height:3rem!important;min-height:3rem!important;margin:0!important;padding:0!important;font-size:1rem!important;font-weight:600!important;line-height:1!important;display:grid!important;overflow:visible!important}#insurance-widget-root button.credify-btn-back[type=button]:not(:disabled):hover,#root button.credify-btn-back[type=button]:not(:disabled):hover{background-color:#f9fafb!important;border-color:#cbd5e1!important}#insurance-widget-root button.credify-btn-back[type=button]:disabled,#root button.credify-btn-back[type=button]:disabled{opacity:.5!important;cursor:not-allowed!important;background-color:#f3f4f6!important}#insurance-widget-root button.credify-btn-back-rates[type=button],#root button.credify-btn-back-rates[type=button]{margin-top:2rem!important}#insurance-widget-root button.credify-retry-btn[type=button],#root button.credify-retry-btn[type=button]{cursor:pointer;font:inherit;border:none;visibility:visible!important;color:var(--text-primary)!important;clip-path:none!important;pointer-events:auto!important;background:0 0!important;text-decoration:underline!important;display:inline!important;overflow:visible!important}#insurance-widget-root button.rates-bind-btn[type=button],#root button.rates-bind-btn[type=button],#insurance-widget-root button.rates-bind-btn[type=button]:disabled,#root button.rates-bind-btn[type=button]:disabled{visibility:visible!important;opacity:1!important;clip-path:none!important;pointer-events:auto!important;box-sizing:border-box!important;text-align:center!important;color:#fff!important;background-color:#2563eb!important;place-content:center!important;place-items:center!important;min-height:2.5rem!important;padding:0 1rem!important;line-height:1!important;display:grid!important;overflow:visible!important}#insurance-widget-root button.rates-bind-btn[type=button]:disabled,#root button.rates-bind-btn[type=button]:disabled{opacity:.5!important;background-color:#cbd5e1!important}#insurance-widget-root button.rates-bind-btn.rates-bind-btn-requested,#root button.rates-bind-btn.rates-bind-btn-requested{color:#fff!important;background-color:#10b981!important}#insurance-widget-root button.quote-btn[type=button],#root button.quote-btn[type=button]{visibility:visible!important;opacity:1!important;clip-path:none!important;pointer-events:auto!important;color:#fff!important;background-color:#2563eb!important;display:inline-flex!important;overflow:visible!important}#insurance-widget-root a.credify-link-underline[href],#root a.credify-link-underline[href]{color:var(--primary-color);visibility:visible!important;clip-path:none!important;pointer-events:auto!important;text-decoration:underline!important;display:inline!important;overflow:visible!important}#insurance-widget-root input.form-input,#root input.form-input,#insurance-widget-root select.form-input,#root select.form-input,#insurance-widget-root textarea.form-input,#root textarea.form-input{visibility:visible!important;opacity:1!important;clip-path:none!important;pointer-events:auto!important;display:block!important;overflow:visible!important}#insurance-widget-root button.btn-primary[type=button],#root button.btn-primary[type=button],#insurance-widget-root button.btn-primary[type=submit],#root button.btn-primary[type=submit],#insurance-widget-root button.btn-outline[type=button],#root button.btn-outline[type=button],#insurance-widget-root button.btn-primary[type=button]:disabled,#root button.btn-primary[type=button]:disabled,#insurance-widget-root button.btn-outline[type=button]:disabled,#root button.btn-outline[type=button]:disabled{visibility:visible!important;opacity:1!important;clip-path:none!important;pointer-events:auto!important;min-height:3rem!important;display:flex!important;overflow:visible!important}#insurance-widget-root button.btn-primary[type=button],#root button.btn-primary[type=button],#insurance-widget-root button.btn-primary[type=submit],#root button.btn-primary[type=submit]{color:#fff!important;background-color:#2563eb!important}#insurance-widget-root button.btn-outline[type=button],#root button.btn-outline[type=button]{color:var(--text-primary)!important;border:1px solid var(--accent-color)!important;background-color:#fff!important}#insurance-widget-root button.btn-primary[type=button]:disabled,#root button.btn-primary[type=button]:disabled,#insurance-widget-root button.btn-outline[type=button]:disabled,#root button.btn-outline[type=button]:disabled{opacity:.5!important}#insurance-widget-root button.btn-primary[type=button]:disabled,#root button.btn-primary[type=button]:disabled{color:#fff!important;background-color:#d1d5db!important}#insurance-widget-root button.btn-outline[type=button]:disabled,#root button.btn-outline[type=button]:disabled{color:var(--text-primary)!important;background-color:#f1f5f9!important}#insurance-widget-root .form-wizard-steps-header,#root .form-wizard-steps-header{visibility:visible!important;display:flex!important}#insurance-widget-root .form-wizard-steps,#root .form-wizard-steps{flex:1;align-items:center;gap:.5rem;min-width:0;margin:0;padding:0;font-size:.75rem;line-height:1rem;list-style:none;overflow-x:auto;display:flex!important}#insurance-widget-root .form-wizard-step-pill,#root .form-wizard-step-pill{white-space:nowrap;border:1px solid;border-radius:9999px;flex-shrink:0;padding:.25rem .625rem;visibility:visible!important;display:inline-flex!important}#insurance-widget-root .form-wizard-step-arrow,#root .form-wizard-step-arrow{color:#94a3b8;flex-shrink:0;visibility:visible!important;display:inline-flex!important}#insurance-widget-root .form-wizard-step-counter,#root .form-wizard-step-counter{color:#64748b;flex-shrink:0;font-size:.875rem;line-height:1.25rem;visibility:visible!important;display:block!important}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@keyframes spin{to{transform:rotate(360deg)}}@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-border-style:solid;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}`)),document.head.appendChild(t)}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}})();
|
|
2
|
-
import { useState as
|
|
3
|
-
import { createRoot as
|
|
4
|
-
import { jsxs as b, jsx as o, Fragment as
|
|
2
|
+
import { useState as Q, useRef as O, useEffect as B, useMemo as ae, useCallback as st, createElement as it } from "react";
|
|
3
|
+
import { createRoot as at } from "react-dom/client";
|
|
4
|
+
import { jsxs as b, jsx as o, Fragment as Ue } from "react/jsx-runtime";
|
|
5
5
|
(function() {
|
|
6
6
|
if (typeof e > "u")
|
|
7
7
|
var e = { env: {} };
|
|
@@ -18,7 +18,7 @@ function U({ id: e, label: t, hint: r, error: s, required: n, className: i, chil
|
|
|
18
18
|
s && /* @__PURE__ */ o("p", { id: `${e}-error`, className: "mt-1 text-sm text-red-600", children: s })
|
|
19
19
|
] });
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function ot({ id: e, label: t, hint: r, error: s, required: n, className: i, ...l }) {
|
|
22
22
|
return /* @__PURE__ */ o(U, { id: e, label: t, hint: r, error: s, required: n, className: i, children: /* @__PURE__ */ o(
|
|
23
23
|
"input",
|
|
24
24
|
{
|
|
@@ -32,7 +32,7 @@ function st({ id: e, label: t, hint: r, error: s, required: n, className: i, ...
|
|
|
32
32
|
}
|
|
33
33
|
) });
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function lt({ id: e, label: t, hint: r, error: s, required: n, className: i, ...l }) {
|
|
36
36
|
return /* @__PURE__ */ o(U, { id: e, label: t, hint: r, error: s, required: n, className: i, children: /* @__PURE__ */ o(
|
|
37
37
|
"input",
|
|
38
38
|
{
|
|
@@ -46,7 +46,7 @@ function it({ id: e, label: t, hint: r, error: s, required: n, className: i, ...
|
|
|
46
46
|
}
|
|
47
47
|
) });
|
|
48
48
|
}
|
|
49
|
-
function
|
|
49
|
+
function ct({ id: e, label: t, hint: r, error: s, required: n, className: i, ...l }) {
|
|
50
50
|
return /* @__PURE__ */ o(U, { id: e, label: t, hint: r, error: s, required: n, className: i, children: /* @__PURE__ */ o(
|
|
51
51
|
"input",
|
|
52
52
|
{
|
|
@@ -62,7 +62,7 @@ function at({ id: e, label: t, hint: r, error: s, required: n, className: i, ...
|
|
|
62
62
|
}
|
|
63
63
|
) });
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function ve(e) {
|
|
66
66
|
const t = e.replace(/\D/g, "");
|
|
67
67
|
if (t.length === 10)
|
|
68
68
|
return `(${t.slice(0, 3)}) ${t.slice(3, 6)} - ${t.slice(6)}`;
|
|
@@ -72,41 +72,41 @@ function be(e) {
|
|
|
72
72
|
}
|
|
73
73
|
return t.length >= 6 ? `(${t.slice(0, 3)}) ${t.slice(3, 6)} - ${t.slice(6)}` : t.length >= 3 ? `(${t.slice(0, 3)}) ${t.slice(3)}` : t.length > 0 ? `(${t}` : t;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function we(e) {
|
|
76
76
|
return e.replace(/\D/g, "");
|
|
77
77
|
}
|
|
78
|
-
function
|
|
79
|
-
const [v,
|
|
80
|
-
|
|
78
|
+
function dt({ id: e, label: t, hint: r, error: s, required: n, className: i, value: l = "", onChange: a, ..._ }) {
|
|
79
|
+
const [v, S] = Q(""), g = O(null), A = O(0);
|
|
80
|
+
B(() => {
|
|
81
81
|
if (!l) {
|
|
82
|
-
|
|
82
|
+
S("");
|
|
83
83
|
return;
|
|
84
84
|
}
|
|
85
|
-
let
|
|
86
|
-
|
|
87
|
-
const
|
|
88
|
-
|
|
85
|
+
let E = we(l);
|
|
86
|
+
E.length === 11 && E.startsWith("1") && (E = E.slice(1));
|
|
87
|
+
const I = E.slice(0, 10);
|
|
88
|
+
S(ve(I));
|
|
89
89
|
}, [l]);
|
|
90
|
-
const
|
|
91
|
-
const
|
|
92
|
-
A.current =
|
|
93
|
-
const d =
|
|
94
|
-
|
|
95
|
-
const c = d.length === 10 ? `+1${d}` : d,
|
|
96
|
-
...
|
|
90
|
+
const T = (E) => {
|
|
91
|
+
const I = E.target, D = I.value;
|
|
92
|
+
A.current = I.selectionStart || 0;
|
|
93
|
+
const d = we(D).slice(0, 10), u = ve(d);
|
|
94
|
+
S(u);
|
|
95
|
+
const c = d.length === 10 ? `+1${d}` : d, f = {
|
|
96
|
+
...E,
|
|
97
97
|
currentTarget: {
|
|
98
|
-
...
|
|
98
|
+
...E.currentTarget,
|
|
99
99
|
value: c
|
|
100
100
|
},
|
|
101
101
|
target: {
|
|
102
|
-
...
|
|
102
|
+
...E.target,
|
|
103
103
|
value: c
|
|
104
104
|
}
|
|
105
105
|
};
|
|
106
|
-
a?.(
|
|
107
|
-
if (
|
|
108
|
-
const w =
|
|
109
|
-
|
|
106
|
+
a?.(f), setTimeout(() => {
|
|
107
|
+
if (g.current) {
|
|
108
|
+
const w = D.slice(0, A.current), $ = we(w), x = ve($), h = Math.min(x.length, u.length);
|
|
109
|
+
g.current.setSelectionRange(h, h);
|
|
110
110
|
}
|
|
111
111
|
}, 0);
|
|
112
112
|
};
|
|
@@ -126,7 +126,7 @@ function ot({ id: e, label: t, hint: r, error: s, required: n, className: i, val
|
|
|
126
126
|
/* @__PURE__ */ o(
|
|
127
127
|
"input",
|
|
128
128
|
{
|
|
129
|
-
ref:
|
|
129
|
+
ref: g,
|
|
130
130
|
id: e,
|
|
131
131
|
type: "tel",
|
|
132
132
|
className: `flex-1 px-4 py-3 border-0 rounded-r-lg outline-none bg-transparent text-[var(--text-primary)] text-base ${s ? "input-error" : ""}`,
|
|
@@ -136,15 +136,15 @@ function ot({ id: e, label: t, hint: r, error: s, required: n, className: i, val
|
|
|
136
136
|
"aria-invalid": !!s,
|
|
137
137
|
"aria-describedby": [r ? `${e}-hint` : null, s ? `${e}-error` : null].filter(Boolean).join(" ") || void 0,
|
|
138
138
|
value: v,
|
|
139
|
-
onChange:
|
|
140
|
-
...
|
|
139
|
+
onChange: T,
|
|
140
|
+
..._
|
|
141
141
|
}
|
|
142
142
|
)
|
|
143
143
|
]
|
|
144
144
|
}
|
|
145
145
|
) });
|
|
146
146
|
}
|
|
147
|
-
function
|
|
147
|
+
function ut({ id: e, label: t, hint: r, error: s, required: n, className: i, ...l }) {
|
|
148
148
|
return /* @__PURE__ */ o(U, { id: e, label: t, hint: r, error: s, required: n, className: i, children: /* @__PURE__ */ o(
|
|
149
149
|
"input",
|
|
150
150
|
{
|
|
@@ -160,7 +160,7 @@ function lt({ id: e, label: t, hint: r, error: s, required: n, className: i, ...
|
|
|
160
160
|
}
|
|
161
161
|
) });
|
|
162
162
|
}
|
|
163
|
-
function
|
|
163
|
+
function _t({ id: e, label: t, hint: r, error: s, required: n, className: i, ...l }) {
|
|
164
164
|
return /* @__PURE__ */ o(U, { id: e, label: t, hint: r, error: s, required: n, className: i, children: /* @__PURE__ */ o(
|
|
165
165
|
"input",
|
|
166
166
|
{
|
|
@@ -175,7 +175,7 @@ function ct({ id: e, label: t, hint: r, error: s, required: n, className: i, ...
|
|
|
175
175
|
}
|
|
176
176
|
) });
|
|
177
177
|
}
|
|
178
|
-
function
|
|
178
|
+
function ft({ id: e, label: t, hint: r, error: s, required: n, className: i, rows: l = 4, ...a }) {
|
|
179
179
|
return /* @__PURE__ */ o(U, { id: e, label: t, hint: r, error: s, required: n, className: i, children: /* @__PURE__ */ o(
|
|
180
180
|
"textarea",
|
|
181
181
|
{
|
|
@@ -189,7 +189,7 @@ function dt({ id: e, label: t, hint: r, error: s, required: n, className: i, row
|
|
|
189
189
|
}
|
|
190
190
|
) });
|
|
191
191
|
}
|
|
192
|
-
function
|
|
192
|
+
function mt({ id: e, label: t, hint: r, error: s, required: n, className: i, ...l }) {
|
|
193
193
|
return /* @__PURE__ */ o(U, { id: e, label: t, hint: r, error: s, required: n, className: i, children: /* @__PURE__ */ o(
|
|
194
194
|
"input",
|
|
195
195
|
{
|
|
@@ -203,13 +203,13 @@ function ut({ id: e, label: t, hint: r, error: s, required: n, className: i, ...
|
|
|
203
203
|
}
|
|
204
204
|
) });
|
|
205
205
|
}
|
|
206
|
-
function
|
|
206
|
+
function Qe({ id: e, label: t, className: r, ...s }) {
|
|
207
207
|
return /* @__PURE__ */ b("label", { className: `checkbox-card ${r || ""}`, htmlFor: e, children: [
|
|
208
208
|
/* @__PURE__ */ o("input", { id: e, type: "checkbox", className: "checkbox-input", ...s }),
|
|
209
209
|
/* @__PURE__ */ o("span", { className: "checkbox-label", children: t })
|
|
210
210
|
] });
|
|
211
211
|
}
|
|
212
|
-
function
|
|
212
|
+
function pt({
|
|
213
213
|
name: e,
|
|
214
214
|
value: t,
|
|
215
215
|
checked: r,
|
|
@@ -221,7 +221,7 @@ function _t({
|
|
|
221
221
|
/* @__PURE__ */ o("span", { className: "radio-label", children: n })
|
|
222
222
|
] });
|
|
223
223
|
}
|
|
224
|
-
function
|
|
224
|
+
function gt({
|
|
225
225
|
legend: e,
|
|
226
226
|
children: t,
|
|
227
227
|
className: r,
|
|
@@ -233,26 +233,26 @@ function ft({
|
|
|
233
233
|
/* @__PURE__ */ o("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-2", children: t })
|
|
234
234
|
] });
|
|
235
235
|
}
|
|
236
|
-
function
|
|
237
|
-
const
|
|
236
|
+
function ht({ id: e, label: t, hint: r, error: s, required: n, className: i, placeholder: l, options: a, children: _, ...v }) {
|
|
237
|
+
const S = [r ? `${e}-hint` : null, s ? `${e}-error` : null].filter(Boolean).join(" ") || void 0, g = !!_;
|
|
238
238
|
return /* @__PURE__ */ o(U, { id: e, label: t, hint: r, error: s, required: n, className: i, children: /* @__PURE__ */ b(
|
|
239
239
|
"select",
|
|
240
240
|
{
|
|
241
241
|
id: e,
|
|
242
242
|
className: `form-input select-caret ${s ? "input-error" : ""}`,
|
|
243
243
|
"aria-invalid": !!s,
|
|
244
|
-
"aria-describedby":
|
|
244
|
+
"aria-describedby": S,
|
|
245
245
|
required: n,
|
|
246
246
|
...v,
|
|
247
247
|
children: [
|
|
248
248
|
l && /* @__PURE__ */ o("option", { value: "", disabled: !0, selected: !("value" in v), children: l }),
|
|
249
|
-
|
|
249
|
+
g ? _ : a?.map((A) => /* @__PURE__ */ o("option", { value: A.value, disabled: A.disabled, children: A.label }, A.value))
|
|
250
250
|
]
|
|
251
251
|
}
|
|
252
252
|
) });
|
|
253
253
|
}
|
|
254
|
-
const
|
|
255
|
-
function
|
|
254
|
+
const yt = "AIzaSyDjLdKLxoa-maLNGAyq_I_2r_Fe_TzFikw";
|
|
255
|
+
function bt() {
|
|
256
256
|
return new Promise((e, t) => {
|
|
257
257
|
if (window.google?.maps?.places) {
|
|
258
258
|
e();
|
|
@@ -264,10 +264,10 @@ function gt() {
|
|
|
264
264
|
return;
|
|
265
265
|
}
|
|
266
266
|
const s = document.createElement("script");
|
|
267
|
-
s.src = `https://maps.googleapis.com/maps/api/js?key=${
|
|
267
|
+
s.src = `https://maps.googleapis.com/maps/api/js?key=${yt}&libraries=places`, s.async = !0, s.defer = !0, s.onload = () => e(), s.onerror = () => t(new Error("Failed to load Google Maps script")), document.head.appendChild(s);
|
|
268
268
|
});
|
|
269
269
|
}
|
|
270
|
-
function
|
|
270
|
+
function vt(e) {
|
|
271
271
|
const t = {
|
|
272
272
|
fullAddress: e.formatted_address
|
|
273
273
|
};
|
|
@@ -276,93 +276,93 @@ function ht(e) {
|
|
|
276
276
|
s.includes("street_number") && (t.streetNumber = r.long_name), s.includes("route") && (t.streetName = r.long_name), s.includes("locality") && (t.city = r.long_name), s.includes("administrative_area_level_1") && (t.state = r.short_name), s.includes("postal_code") && (t.zipCode = r.long_name), s.includes("country") && (t.country = r.short_name);
|
|
277
277
|
}), t;
|
|
278
278
|
}
|
|
279
|
-
function
|
|
280
|
-
const
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
}, [d]),
|
|
284
|
-
|
|
285
|
-
}, [c]),
|
|
286
|
-
|
|
287
|
-
}, [w]),
|
|
288
|
-
|
|
289
|
-
}, [
|
|
290
|
-
const
|
|
291
|
-
|
|
292
|
-
if (!
|
|
279
|
+
function wt({ id: e, label: t, hint: r, error: s, required: n, className: i, onChange: l, onPlaceSelect: a, value: _, ...v }) {
|
|
280
|
+
const S = O(null), g = O(null), A = O(null), T = O(null), [E, I] = Q(!0), [D, M] = Q(_ || ""), [d, u] = Q([]), [c, f] = Q(!1), [w, $] = Q(-1), x = O([]), h = O(!1), y = O(-1);
|
|
281
|
+
B(() => {
|
|
282
|
+
x.current = d;
|
|
283
|
+
}, [d]), B(() => {
|
|
284
|
+
h.current = c;
|
|
285
|
+
}, [c]), B(() => {
|
|
286
|
+
y.current = w;
|
|
287
|
+
}, [w]), B(() => {
|
|
288
|
+
_ !== void 0 && M(String(_));
|
|
289
|
+
}, [_]);
|
|
290
|
+
const p = O(null);
|
|
291
|
+
B(() => {
|
|
292
|
+
if (!S.current) return;
|
|
293
293
|
let N = !0;
|
|
294
|
-
return
|
|
295
|
-
!N || !
|
|
296
|
-
}).catch((
|
|
297
|
-
console.error("Error loading Google Maps:",
|
|
294
|
+
return bt().then(() => {
|
|
295
|
+
!N || !S.current || (g.current = new google.maps.places.AutocompleteService(), A.current = new google.maps.places.PlacesService(document.createElement("div")), I(!1));
|
|
296
|
+
}).catch((k) => {
|
|
297
|
+
console.error("Error loading Google Maps:", k), I(!1);
|
|
298
298
|
}), () => {
|
|
299
|
-
N = !1,
|
|
299
|
+
N = !1, p.current && clearTimeout(p.current);
|
|
300
300
|
};
|
|
301
301
|
}, []);
|
|
302
|
-
const
|
|
303
|
-
const
|
|
304
|
-
if (
|
|
305
|
-
|
|
302
|
+
const m = (N) => {
|
|
303
|
+
const k = N.target.value;
|
|
304
|
+
if (M(k), l?.(k), p.current && clearTimeout(p.current), k.length < 3) {
|
|
305
|
+
u([]), f(!1);
|
|
306
306
|
return;
|
|
307
307
|
}
|
|
308
|
-
|
|
309
|
-
|
|
308
|
+
p.current = setTimeout(() => {
|
|
309
|
+
g.current && g.current.getPlacePredictions(
|
|
310
310
|
{
|
|
311
|
-
input:
|
|
311
|
+
input: k,
|
|
312
312
|
types: ["address"]
|
|
313
313
|
},
|
|
314
|
-
(F,
|
|
315
|
-
|
|
314
|
+
(F, L) => {
|
|
315
|
+
L === google.maps.places.PlacesServiceStatus.OK && F ? (u(F), f(!0), $(-1)) : (u([]), f(!1));
|
|
316
316
|
}
|
|
317
317
|
);
|
|
318
318
|
}, 300);
|
|
319
|
-
},
|
|
320
|
-
if (!
|
|
321
|
-
N.key === "Escape" && (
|
|
319
|
+
}, j = (N) => {
|
|
320
|
+
if (!h.current || x.current.length === 0) {
|
|
321
|
+
N.key === "Escape" && (f(!1), h.current = !1);
|
|
322
322
|
return;
|
|
323
323
|
}
|
|
324
324
|
switch (N.key) {
|
|
325
325
|
case "ArrowDown":
|
|
326
|
-
N.preventDefault(), $((
|
|
327
|
-
const F =
|
|
328
|
-
return
|
|
326
|
+
N.preventDefault(), $((k) => {
|
|
327
|
+
const F = k < x.current.length - 1 ? k + 1 : k;
|
|
328
|
+
return y.current = F, F;
|
|
329
329
|
});
|
|
330
330
|
break;
|
|
331
331
|
case "ArrowUp":
|
|
332
|
-
N.preventDefault(), $((
|
|
333
|
-
const F =
|
|
334
|
-
return
|
|
332
|
+
N.preventDefault(), $((k) => {
|
|
333
|
+
const F = k > 0 ? k - 1 : -1;
|
|
334
|
+
return y.current = F, F;
|
|
335
335
|
});
|
|
336
336
|
break;
|
|
337
337
|
case "Enter":
|
|
338
|
-
N.preventDefault(),
|
|
338
|
+
N.preventDefault(), y.current >= 0 && y.current < x.current.length && C(x.current[y.current]);
|
|
339
339
|
break;
|
|
340
340
|
case "Escape":
|
|
341
|
-
N.preventDefault(),
|
|
341
|
+
N.preventDefault(), f(!1), h.current = !1;
|
|
342
342
|
break;
|
|
343
343
|
}
|
|
344
344
|
};
|
|
345
|
-
|
|
346
|
-
const N = (
|
|
347
|
-
|
|
345
|
+
B(() => {
|
|
346
|
+
const N = (k) => {
|
|
347
|
+
T.current && !T.current.contains(k.target) && S.current && !S.current.contains(k.target) && (f(!1), h.current = !1);
|
|
348
348
|
};
|
|
349
349
|
if (c)
|
|
350
350
|
return document.addEventListener("mousedown", N), () => {
|
|
351
351
|
document.removeEventListener("mousedown", N);
|
|
352
352
|
};
|
|
353
353
|
}, [c]);
|
|
354
|
-
const
|
|
354
|
+
const C = (N) => {
|
|
355
355
|
A.current && A.current.getDetails(
|
|
356
356
|
{
|
|
357
357
|
placeId: N.place_id,
|
|
358
358
|
fields: ["address_components", "formatted_address", "geometry"]
|
|
359
359
|
},
|
|
360
|
-
(
|
|
361
|
-
if (F === google.maps.places.PlacesServiceStatus.OK &&
|
|
362
|
-
const
|
|
363
|
-
|
|
364
|
-
const Z =
|
|
365
|
-
l?.(
|
|
360
|
+
(k, F) => {
|
|
361
|
+
if (F === google.maps.places.PlacesServiceStatus.OK && k) {
|
|
362
|
+
const L = k.formatted_address || "";
|
|
363
|
+
M(L), f(!1), u([]), h.current = !1;
|
|
364
|
+
const Z = vt(k);
|
|
365
|
+
l?.(L, Z), a?.(k);
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
368
|
);
|
|
@@ -371,37 +371,37 @@ function yt({ id: e, label: t, hint: r, error: s, required: n, className: i, onC
|
|
|
371
371
|
/* @__PURE__ */ o(
|
|
372
372
|
"input",
|
|
373
373
|
{
|
|
374
|
-
ref:
|
|
374
|
+
ref: S,
|
|
375
375
|
id: e,
|
|
376
376
|
type: "text",
|
|
377
377
|
className: `form-input ${s ? "input-error" : ""}`,
|
|
378
|
-
value:
|
|
379
|
-
onChange:
|
|
380
|
-
onKeyDown:
|
|
378
|
+
value: D,
|
|
379
|
+
onChange: m,
|
|
380
|
+
onKeyDown: j,
|
|
381
381
|
"aria-invalid": !!s,
|
|
382
382
|
"aria-describedby": [r ? `${e}-hint` : null, s ? `${e}-error` : null].filter(Boolean).join(" ") || void 0,
|
|
383
383
|
required: n,
|
|
384
384
|
autoComplete: "street-address",
|
|
385
385
|
placeholder: v.placeholder || "Enter an address",
|
|
386
|
-
disabled:
|
|
386
|
+
disabled: E || v.disabled,
|
|
387
387
|
...v
|
|
388
388
|
}
|
|
389
389
|
),
|
|
390
|
-
|
|
390
|
+
E && /* @__PURE__ */ o("p", { className: "mt-1 text-sm text-slate-500", children: "Loading address suggestions..." }),
|
|
391
391
|
c && d.length > 0 && /* @__PURE__ */ o(
|
|
392
392
|
"div",
|
|
393
393
|
{
|
|
394
|
-
ref:
|
|
394
|
+
ref: T,
|
|
395
395
|
className: "absolute z-50 w-full mt-1 bg-white border border-slate-200 rounded-lg shadow-lg max-h-60 overflow-y-auto",
|
|
396
396
|
role: "listbox",
|
|
397
|
-
children: d.map((N,
|
|
397
|
+
children: d.map((N, k) => /* @__PURE__ */ b(
|
|
398
398
|
"div",
|
|
399
399
|
{
|
|
400
|
-
className: `px-4 py-3 cursor-pointer transition-colors ${
|
|
400
|
+
className: `px-4 py-3 cursor-pointer transition-colors ${k === w ? "bg-blue-50 text-slate-900" : "bg-white text-slate-900 hover:bg-slate-50"} ${k < d.length - 1 ? "border-b border-slate-100" : ""}`,
|
|
401
401
|
role: "option",
|
|
402
|
-
"aria-selected":
|
|
403
|
-
onClick: () =>
|
|
404
|
-
onMouseEnter: () => $(
|
|
402
|
+
"aria-selected": k === w,
|
|
403
|
+
onClick: () => C(N),
|
|
404
|
+
onMouseEnter: () => $(k),
|
|
405
405
|
children: [
|
|
406
406
|
/* @__PURE__ */ o("div", { className: "font-medium text-slate-900", children: N.structured_formatting.main_text }),
|
|
407
407
|
N.structured_formatting.secondary_text && /* @__PURE__ */ o("div", { className: "text-sm text-slate-500 mt-0.5", children: N.structured_formatting.secondary_text })
|
|
@@ -416,13 +416,13 @@ function yt({ id: e, label: t, hint: r, error: s, required: n, className: i, onC
|
|
|
416
416
|
function Ne(e) {
|
|
417
417
|
return e.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "");
|
|
418
418
|
}
|
|
419
|
-
function
|
|
419
|
+
function Ve(e, t) {
|
|
420
420
|
return e.key ?? `${Ne(e.question)}-${t}`;
|
|
421
421
|
}
|
|
422
|
-
function
|
|
422
|
+
function he(e, t) {
|
|
423
423
|
const r = {}, s = (n) => n == null || typeof n == "string" && n.trim() === "";
|
|
424
424
|
return e.forEach((n, i) => {
|
|
425
|
-
const l =
|
|
425
|
+
const l = Ve(n, i), a = t[l];
|
|
426
426
|
if (n.required)
|
|
427
427
|
switch (n.inputType) {
|
|
428
428
|
case "checkbox":
|
|
@@ -449,12 +449,12 @@ function ge(e, t) {
|
|
|
449
449
|
}
|
|
450
450
|
}), r;
|
|
451
451
|
}
|
|
452
|
-
function
|
|
452
|
+
function xt(e) {
|
|
453
453
|
if (e === "" || e === null || e === void 0) return;
|
|
454
454
|
const t = Number(e);
|
|
455
455
|
return Number.isNaN(t) ? void 0 : t;
|
|
456
456
|
}
|
|
457
|
-
function
|
|
457
|
+
function Me(e) {
|
|
458
458
|
return typeof e == "number" && Number.isFinite(e) ? e : typeof e == "string" && e.trim() !== "" && !Number.isNaN(Number(e)) ? Number(e) : null;
|
|
459
459
|
}
|
|
460
460
|
function je(e) {
|
|
@@ -465,29 +465,29 @@ function je(e) {
|
|
|
465
465
|
}
|
|
466
466
|
return null;
|
|
467
467
|
}
|
|
468
|
-
function
|
|
469
|
-
const r =
|
|
468
|
+
function Be(e, t) {
|
|
469
|
+
const r = Me(e), s = Me(t);
|
|
470
470
|
if (r != null && s != null) return r - s;
|
|
471
471
|
const n = je(e), i = je(t);
|
|
472
472
|
return n != null && i != null ? n - i : e == null || t == null ? null : String(e).localeCompare(String(t));
|
|
473
473
|
}
|
|
474
|
-
function
|
|
474
|
+
function kt(e, t) {
|
|
475
475
|
return Array.isArray(e) ? e.some((r) => r === t) : typeof e == "string" ? t != null && e.includes(String(t)) : !1;
|
|
476
476
|
}
|
|
477
|
-
function
|
|
477
|
+
function le(e, t, r) {
|
|
478
478
|
switch (t) {
|
|
479
479
|
case "equals":
|
|
480
480
|
return e === r;
|
|
481
481
|
case "lessThan": {
|
|
482
|
-
const s =
|
|
482
|
+
const s = Be(e, r);
|
|
483
483
|
return s != null && s < 0;
|
|
484
484
|
}
|
|
485
485
|
case "greaterThan": {
|
|
486
|
-
const s =
|
|
486
|
+
const s = Be(e, r);
|
|
487
487
|
return s != null && s > 0;
|
|
488
488
|
}
|
|
489
489
|
case "contains":
|
|
490
|
-
return
|
|
490
|
+
return kt(e, r);
|
|
491
491
|
case "startsWith":
|
|
492
492
|
return e != null && r != null && String(e).startsWith(String(r));
|
|
493
493
|
case "endsWith":
|
|
@@ -496,7 +496,7 @@ function oe(e, t, r) {
|
|
|
496
496
|
return !1;
|
|
497
497
|
}
|
|
498
498
|
}
|
|
499
|
-
function
|
|
499
|
+
function Se(e, t) {
|
|
500
500
|
return t.reduce((r, s) => r?.[s], e);
|
|
501
501
|
}
|
|
502
502
|
function X(e, t, r) {
|
|
@@ -516,18 +516,18 @@ function X(e, t, r) {
|
|
|
516
516
|
}
|
|
517
517
|
return { ...e, [s]: a };
|
|
518
518
|
}
|
|
519
|
-
function
|
|
520
|
-
return
|
|
519
|
+
function ce(e, t, r) {
|
|
520
|
+
return Se(e, [...t ?? [], r]);
|
|
521
521
|
}
|
|
522
|
-
function
|
|
522
|
+
function Nt(e, t, r, s) {
|
|
523
523
|
return X(e, [...t ?? [], r], s);
|
|
524
524
|
}
|
|
525
|
-
const
|
|
526
|
-
function
|
|
525
|
+
const St = "__items", me = (e) => `${e}${St}`;
|
|
526
|
+
function $t(e) {
|
|
527
527
|
const t = (r, s) => r.map((n, i) => {
|
|
528
|
-
const l = s.length ? s.join("__") : "root", a = n.key ?? `${l}__q${i}_${String(n.question).slice(0, 24).replace(/\W+/g, "-") || "field"}`, v = (n.conditionals ?? []).map((
|
|
529
|
-
const A =
|
|
530
|
-
return { ...
|
|
528
|
+
const l = s.length ? s.join("__") : "root", a = n.key ?? `${l}__q${i}_${String(n.question).slice(0, 24).replace(/\W+/g, "-") || "field"}`, v = (n.conditionals ?? []).map((S, g) => {
|
|
529
|
+
const A = S.conditionalQuestions ? t(S.conditionalQuestions, [...s, `${a}__c${g}`]) : void 0;
|
|
530
|
+
return { ...S, conditionalQuestions: A };
|
|
531
531
|
});
|
|
532
532
|
return { ...n, key: a, conditionals: v };
|
|
533
533
|
});
|
|
@@ -536,74 +536,74 @@ function Nt(e) {
|
|
|
536
536
|
function J(e) {
|
|
537
537
|
return e == null ? "" : typeof e == "string" ? e : String(e);
|
|
538
538
|
}
|
|
539
|
-
function
|
|
539
|
+
function At(e) {
|
|
540
540
|
return e == null ? "" : typeof e == "number" && Number.isFinite(e) || typeof e == "string" ? e : "";
|
|
541
541
|
}
|
|
542
|
-
function
|
|
542
|
+
function Ct(e) {
|
|
543
543
|
return e == null ? "" : typeof e == "string" || typeof e == "number" ? e : String(e);
|
|
544
544
|
}
|
|
545
|
-
function
|
|
545
|
+
function Tt({
|
|
546
546
|
questions: e,
|
|
547
547
|
initialValues: t,
|
|
548
548
|
controlledValues: r,
|
|
549
549
|
onChangeValues: s,
|
|
550
550
|
onSubmit: n
|
|
551
551
|
}) {
|
|
552
|
-
const i =
|
|
552
|
+
const i = ae(() => $t(e), [e]), l = ae(() => {
|
|
553
553
|
const d = {};
|
|
554
554
|
return t && Object.assign(d, t), d;
|
|
555
|
-
}, [t]), [a,
|
|
556
|
-
|
|
557
|
-
|
|
555
|
+
}, [t]), [a, _] = Q(l);
|
|
556
|
+
B(() => {
|
|
557
|
+
_(l);
|
|
558
558
|
}, [l]);
|
|
559
|
-
const [v,
|
|
559
|
+
const [v, S] = Q({}), g = ae(
|
|
560
560
|
() => ({ ...v, ...r ?? a }),
|
|
561
561
|
[v, r, a]
|
|
562
562
|
);
|
|
563
|
-
|
|
564
|
-
r &&
|
|
563
|
+
B(() => {
|
|
564
|
+
r && S((d) => ({ ...d, ...r }));
|
|
565
565
|
}, [r]);
|
|
566
|
-
const [A,
|
|
567
|
-
function
|
|
568
|
-
const c = d.key,
|
|
569
|
-
let
|
|
566
|
+
const [A, T] = Q({});
|
|
567
|
+
function E(d, u) {
|
|
568
|
+
const c = d.key, f = d.question, w = ce(g, u, c), $ = A[c], x = (h) => {
|
|
569
|
+
let y = Nt(g, u, c, h);
|
|
570
570
|
if (d.inputType === "radio" && d.conditionals) {
|
|
571
|
-
const
|
|
572
|
-
for (const
|
|
573
|
-
const
|
|
574
|
-
if (
|
|
575
|
-
const
|
|
576
|
-
if (
|
|
577
|
-
const F =
|
|
578
|
-
|
|
579
|
-
const
|
|
580
|
-
Z.forEach((
|
|
581
|
-
(
|
|
582
|
-
if (
|
|
583
|
-
const ee =
|
|
584
|
-
|
|
571
|
+
const p = d.conditionals ?? [];
|
|
572
|
+
for (const m of p) {
|
|
573
|
+
const j = ce(g, u, c), C = le(j, m.conditionalType, m.conditionalValue), N = le(h, m.conditionalType, m.conditionalValue);
|
|
574
|
+
if (C && !N && m.conditionalQuestionsAllowMultiple) {
|
|
575
|
+
const k = m.conditionalQuestions ?? [];
|
|
576
|
+
if (k.length > 0) {
|
|
577
|
+
const F = me(c);
|
|
578
|
+
y = X(y, [...u ?? [], F], []);
|
|
579
|
+
const L = (Z, q) => {
|
|
580
|
+
Z.forEach((z) => {
|
|
581
|
+
(z.conditionals ?? []).forEach((K) => {
|
|
582
|
+
if (K.conditionalQuestionsAllowMultiple) {
|
|
583
|
+
const ee = me(z.key);
|
|
584
|
+
y = X(y, [...q, ee], []);
|
|
585
585
|
}
|
|
586
|
-
const W =
|
|
587
|
-
W.length > 0 &&
|
|
586
|
+
const W = K.conditionalQuestions ?? [];
|
|
587
|
+
W.length > 0 && L(W, q);
|
|
588
588
|
});
|
|
589
589
|
});
|
|
590
590
|
};
|
|
591
|
-
|
|
591
|
+
L(k, [...u ?? [], F]);
|
|
592
592
|
}
|
|
593
593
|
}
|
|
594
594
|
}
|
|
595
595
|
}
|
|
596
|
-
r && s ? s(
|
|
596
|
+
r && s ? s(y) : _(y), S(y);
|
|
597
597
|
};
|
|
598
598
|
switch (d.inputType) {
|
|
599
599
|
case "text":
|
|
600
600
|
return /* @__PURE__ */ o(
|
|
601
|
-
|
|
601
|
+
ot,
|
|
602
602
|
{
|
|
603
603
|
id: c,
|
|
604
|
-
label:
|
|
604
|
+
label: f,
|
|
605
605
|
value: J(w),
|
|
606
|
-
onChange: (
|
|
606
|
+
onChange: (h) => x(h.currentTarget.value),
|
|
607
607
|
"aria-required": d.required || void 0,
|
|
608
608
|
error: $
|
|
609
609
|
},
|
|
@@ -611,12 +611,12 @@ function $t({
|
|
|
611
611
|
);
|
|
612
612
|
case "email":
|
|
613
613
|
return /* @__PURE__ */ o(
|
|
614
|
-
|
|
614
|
+
ct,
|
|
615
615
|
{
|
|
616
616
|
id: c,
|
|
617
|
-
label:
|
|
617
|
+
label: f,
|
|
618
618
|
value: J(w),
|
|
619
|
-
onChange: (
|
|
619
|
+
onChange: (h) => x(h.currentTarget.value),
|
|
620
620
|
"aria-required": d.required || void 0,
|
|
621
621
|
error: $
|
|
622
622
|
},
|
|
@@ -624,26 +624,26 @@ function $t({
|
|
|
624
624
|
);
|
|
625
625
|
case "password":
|
|
626
626
|
return /* @__PURE__ */ o(
|
|
627
|
-
|
|
627
|
+
_t,
|
|
628
628
|
{
|
|
629
629
|
id: c,
|
|
630
|
-
label:
|
|
630
|
+
label: f,
|
|
631
631
|
value: J(w),
|
|
632
|
-
onChange: (
|
|
632
|
+
onChange: (h) => x(h.currentTarget.value),
|
|
633
633
|
"aria-required": d.required || void 0,
|
|
634
634
|
error: $
|
|
635
635
|
},
|
|
636
636
|
c
|
|
637
637
|
);
|
|
638
638
|
case "tel":
|
|
639
|
-
return /* @__PURE__ */ b(
|
|
639
|
+
return /* @__PURE__ */ b(Ue, { children: [
|
|
640
640
|
/* @__PURE__ */ o(
|
|
641
|
-
|
|
641
|
+
dt,
|
|
642
642
|
{
|
|
643
643
|
id: c,
|
|
644
|
-
label:
|
|
644
|
+
label: f,
|
|
645
645
|
value: J(w),
|
|
646
|
-
onChange: (
|
|
646
|
+
onChange: (h) => x(h.currentTarget.value),
|
|
647
647
|
"aria-required": d.required || void 0,
|
|
648
648
|
error: $
|
|
649
649
|
},
|
|
@@ -666,12 +666,12 @@ function $t({
|
|
|
666
666
|
] });
|
|
667
667
|
case "url":
|
|
668
668
|
return /* @__PURE__ */ o(
|
|
669
|
-
|
|
669
|
+
ut,
|
|
670
670
|
{
|
|
671
671
|
id: c,
|
|
672
|
-
label:
|
|
672
|
+
label: f,
|
|
673
673
|
value: J(w),
|
|
674
|
-
onChange: (
|
|
674
|
+
onChange: (h) => x(h.currentTarget.value),
|
|
675
675
|
"aria-required": d.required || void 0,
|
|
676
676
|
error: $
|
|
677
677
|
},
|
|
@@ -679,12 +679,12 @@ function $t({
|
|
|
679
679
|
);
|
|
680
680
|
case "number":
|
|
681
681
|
return /* @__PURE__ */ o(
|
|
682
|
-
|
|
682
|
+
lt,
|
|
683
683
|
{
|
|
684
684
|
id: c,
|
|
685
|
-
label:
|
|
686
|
-
value:
|
|
687
|
-
onChange: (
|
|
685
|
+
label: f,
|
|
686
|
+
value: At(w),
|
|
687
|
+
onChange: (h) => x(xt(h.currentTarget.value)),
|
|
688
688
|
"aria-required": d.required || void 0,
|
|
689
689
|
error: $
|
|
690
690
|
},
|
|
@@ -692,12 +692,12 @@ function $t({
|
|
|
692
692
|
);
|
|
693
693
|
case "textarea":
|
|
694
694
|
return /* @__PURE__ */ o(
|
|
695
|
-
|
|
695
|
+
ft,
|
|
696
696
|
{
|
|
697
697
|
id: c,
|
|
698
|
-
label:
|
|
698
|
+
label: f,
|
|
699
699
|
value: J(w),
|
|
700
|
-
onChange: (
|
|
700
|
+
onChange: (h) => x(h.currentTarget.value),
|
|
701
701
|
"aria-required": d.required || void 0,
|
|
702
702
|
error: $,
|
|
703
703
|
rows: 4
|
|
@@ -706,12 +706,12 @@ function $t({
|
|
|
706
706
|
);
|
|
707
707
|
case "date":
|
|
708
708
|
return /* @__PURE__ */ o(
|
|
709
|
-
|
|
709
|
+
mt,
|
|
710
710
|
{
|
|
711
711
|
id: c,
|
|
712
|
-
label:
|
|
712
|
+
label: f,
|
|
713
713
|
value: J(w),
|
|
714
|
-
onChange: (
|
|
714
|
+
onChange: (h) => x(h.currentTarget.value),
|
|
715
715
|
"aria-required": d.required || void 0,
|
|
716
716
|
error: $
|
|
717
717
|
},
|
|
@@ -719,73 +719,73 @@ function $t({
|
|
|
719
719
|
);
|
|
720
720
|
case "checkbox": {
|
|
721
721
|
if (d.options) {
|
|
722
|
-
const
|
|
722
|
+
const h = Array.isArray(w) ? w : [];
|
|
723
723
|
return /* @__PURE__ */ b("div", { className: "space-y-2", children: [
|
|
724
724
|
/* @__PURE__ */ b("div", { className: "form-label", children: [
|
|
725
|
-
|
|
725
|
+
f,
|
|
726
726
|
d.required && /* @__PURE__ */ o("span", { className: "text-red-600 ml-1", children: "*" })
|
|
727
727
|
] }),
|
|
728
|
-
/* @__PURE__ */ o("div", { className: "grid grid-cols-1 gap-3 sm:grid-cols-2", children: d.options.map((
|
|
729
|
-
const
|
|
728
|
+
/* @__PURE__ */ o("div", { className: "grid grid-cols-1 gap-3 sm:grid-cols-2", children: d.options.map((y) => {
|
|
729
|
+
const p = `${c}-${Ne(y)}`, m = h.includes(y);
|
|
730
730
|
return /* @__PURE__ */ o(
|
|
731
|
-
|
|
731
|
+
Qe,
|
|
732
732
|
{
|
|
733
|
-
id:
|
|
734
|
-
label:
|
|
735
|
-
checked:
|
|
736
|
-
onChange: (
|
|
737
|
-
const
|
|
738
|
-
|
|
733
|
+
id: p,
|
|
734
|
+
label: y,
|
|
735
|
+
checked: m,
|
|
736
|
+
onChange: (j) => {
|
|
737
|
+
const C = new Set(h);
|
|
738
|
+
j.currentTarget.checked ? C.add(y) : C.delete(y), x(Array.from(C));
|
|
739
739
|
},
|
|
740
740
|
"aria-required": d.required || void 0
|
|
741
741
|
},
|
|
742
|
-
|
|
742
|
+
p
|
|
743
743
|
);
|
|
744
744
|
}) }),
|
|
745
745
|
$ && /* @__PURE__ */ o("p", { className: "mt-1 text-sm text-red-600", children: $ })
|
|
746
746
|
] }, c);
|
|
747
747
|
}
|
|
748
748
|
return /* @__PURE__ */ o(
|
|
749
|
-
|
|
749
|
+
Qe,
|
|
750
750
|
{
|
|
751
751
|
id: c,
|
|
752
|
-
label: d.required ? `${
|
|
752
|
+
label: d.required ? `${f} *` : f,
|
|
753
753
|
checked: !!w,
|
|
754
|
-
onChange: (
|
|
754
|
+
onChange: (h) => x(h.currentTarget.checked),
|
|
755
755
|
"aria-required": d.required || void 0
|
|
756
756
|
},
|
|
757
757
|
c
|
|
758
758
|
);
|
|
759
759
|
}
|
|
760
760
|
case "radio": {
|
|
761
|
-
const
|
|
762
|
-
return /* @__PURE__ */ o(
|
|
761
|
+
const h = d.options ?? [], y = u && u.length > 0 ? `${c}__${u.join("__")}` : c;
|
|
762
|
+
return /* @__PURE__ */ o(gt, { legend: f, legendClassName: d.required ? "legend-required" : void 0, children: h.map((p) => /* @__PURE__ */ o(pt, { name: y, value: p, checked: w === p, onChange: () => x(p), children: p }, `${c}-${Ne(p)}`)) }, c);
|
|
763
763
|
}
|
|
764
764
|
case "select": {
|
|
765
|
-
let
|
|
766
|
-
return c === "quote_vehicle_id" && (
|
|
767
|
-
|
|
765
|
+
let h = d.options ?? [];
|
|
766
|
+
return c === "quote_vehicle_id" && (h = r?.vehicles__items?.map((y) => y.vin) ?? []), /* @__PURE__ */ o(
|
|
767
|
+
ht,
|
|
768
768
|
{
|
|
769
769
|
id: c,
|
|
770
|
-
label:
|
|
770
|
+
label: f,
|
|
771
771
|
"aria-required": d.required || void 0,
|
|
772
772
|
error: $,
|
|
773
|
-
value:
|
|
774
|
-
onChange: (
|
|
773
|
+
value: Ct(w),
|
|
774
|
+
onChange: (y) => x(y.currentTarget.value),
|
|
775
775
|
placeholder: "Select an option",
|
|
776
|
-
options:
|
|
776
|
+
options: h.map((y) => ({ value: y, label: y }))
|
|
777
777
|
},
|
|
778
778
|
c
|
|
779
779
|
);
|
|
780
780
|
}
|
|
781
781
|
case "address":
|
|
782
782
|
return /* @__PURE__ */ o(
|
|
783
|
-
|
|
783
|
+
wt,
|
|
784
784
|
{
|
|
785
785
|
id: c,
|
|
786
|
-
label:
|
|
786
|
+
label: f,
|
|
787
787
|
value: J(w),
|
|
788
|
-
onChange: (
|
|
788
|
+
onChange: (h) => x(h),
|
|
789
789
|
"aria-required": d.required || void 0,
|
|
790
790
|
error: $
|
|
791
791
|
},
|
|
@@ -795,118 +795,152 @@ function $t({
|
|
|
795
795
|
return null;
|
|
796
796
|
}
|
|
797
797
|
}
|
|
798
|
-
function
|
|
799
|
-
return d.map((c,
|
|
800
|
-
const w = String(c.key), $ =
|
|
801
|
-
if (!
|
|
802
|
-
const
|
|
798
|
+
function I(d, u) {
|
|
799
|
+
return d.map((c, f) => {
|
|
800
|
+
const w = String(c.key), $ = E(c, u), x = c.conditionals ?? [];
|
|
801
|
+
if (!x.length) return /* @__PURE__ */ o("div", { children: $ }, `wrap-${w}-${f}`);
|
|
802
|
+
const h = ce(g, u, w), y = x.filter((m) => le(h, m.conditionalType, m.conditionalValue)), p = y.length > 1 && !y.some((m) => m.conditionalQuestionsAllowMultiple) ? y.slice(0, 1) : y;
|
|
803
803
|
return /* @__PURE__ */ b("div", { children: [
|
|
804
804
|
$,
|
|
805
|
-
|
|
806
|
-
const
|
|
807
|
-
if (!
|
|
808
|
-
if (!
|
|
809
|
-
return /* @__PURE__ */ o("div", { className: "mt-3", children:
|
|
810
|
-
const N =
|
|
811
|
-
const
|
|
812
|
-
r && s ? s(
|
|
805
|
+
p.map((m, j) => {
|
|
806
|
+
const C = m.conditionalQuestions ?? [];
|
|
807
|
+
if (!C.length) return null;
|
|
808
|
+
if (!m.conditionalQuestionsAllowMultiple)
|
|
809
|
+
return /* @__PURE__ */ o("div", { className: "mt-3", children: I(C, u) }, `branch-${w}-${j}`);
|
|
810
|
+
const N = me(w), k = Se(g, [...u ?? [], N]) ?? [], F = Math.max(1, k.length || 1), L = () => {
|
|
811
|
+
const z = X(g, [...u ?? [], N, k.length], {});
|
|
812
|
+
r && s ? s(z) : _(z), S(z);
|
|
813
813
|
}, Z = () => {
|
|
814
|
-
const
|
|
815
|
-
r && s ? s(V) :
|
|
816
|
-
}, q = `${w}__c${
|
|
814
|
+
const z = k.slice(0, Math.max(0, k.length - 1)), V = X(g, [...u ?? [], N], z);
|
|
815
|
+
r && s ? s(V) : _(V), S(V);
|
|
816
|
+
}, q = `${w}__c${j}`;
|
|
817
817
|
return /* @__PURE__ */ b("div", { className: "mt-3", children: [
|
|
818
818
|
/* @__PURE__ */ b("div", { className: "flex items-center justify-between mb-2", children: [
|
|
819
819
|
/* @__PURE__ */ o("div", { className: "text-sm font-medium opacity-75", children: "Add one or more entries" }),
|
|
820
820
|
/* @__PURE__ */ b("div", { className: "space-x-2", children: [
|
|
821
|
-
/* @__PURE__ */ o("button", { type: "button", className: "btn-outline px-3 py-1", onClick:
|
|
821
|
+
/* @__PURE__ */ o("button", { type: "button", className: "btn-outline px-3 py-1", onClick: L, children: "Add another" }),
|
|
822
822
|
F > 1 && /* @__PURE__ */ o("button", { type: "button", className: "btn-outline px-3 py-1", onClick: Z, children: "Remove last" })
|
|
823
823
|
] })
|
|
824
824
|
] }),
|
|
825
|
-
Array.from({ length: F }).map((
|
|
826
|
-
const
|
|
825
|
+
Array.from({ length: F }).map((z, V) => {
|
|
826
|
+
const K = [...u ?? [], N, V], W = `${q}__i${V}`;
|
|
827
827
|
return /* @__PURE__ */ b("div", { className: "rounded-lg border p-3 mb-3", children: [
|
|
828
828
|
/* @__PURE__ */ b("div", { className: "text-sm font-semibold mb-2", children: [
|
|
829
829
|
"Entry #",
|
|
830
830
|
V + 1
|
|
831
831
|
] }),
|
|
832
|
-
|
|
833
|
-
|
|
832
|
+
C.map((ee) => /* @__PURE__ */ b("div", { className: "mt-3", children: [
|
|
833
|
+
E(ee, K),
|
|
834
834
|
(() => {
|
|
835
|
-
const
|
|
836
|
-
if (!
|
|
837
|
-
const
|
|
838
|
-
return (
|
|
839
|
-
const
|
|
840
|
-
if (!
|
|
835
|
+
const Ie = ee.conditionals ?? [];
|
|
836
|
+
if (!Ie.length) return null;
|
|
837
|
+
const et = ce(g, K, ee.key), ue = Ie.filter((te) => le(et, te.conditionalType, te.conditionalValue));
|
|
838
|
+
return (ue.length > 1 && !ue.some((te) => te.conditionalQuestionsAllowMultiple) ? ue.slice(0, 1) : ue).map((te, ye) => {
|
|
839
|
+
const be = te.conditionalQuestions ?? [];
|
|
840
|
+
if (!be.length) return null;
|
|
841
841
|
if (!te.conditionalQuestionsAllowMultiple)
|
|
842
|
-
return /* @__PURE__ */ o("div", { className: "mt-3", children:
|
|
843
|
-
const
|
|
844
|
-
const
|
|
845
|
-
r && s ? s(
|
|
846
|
-
},
|
|
847
|
-
const
|
|
848
|
-
r && s ? s(ne) :
|
|
842
|
+
return /* @__PURE__ */ o("div", { className: "mt-3", children: I(be, K) }, `nested-${W}-${ye}`);
|
|
843
|
+
const _e = me(ee.key), fe = Se(g, [...K, _e]) ?? [], Re = Math.max(1, fe.length || 1), tt = () => {
|
|
844
|
+
const ie = X(g, [...K, _e, fe.length], {});
|
|
845
|
+
r && s ? s(ie) : _(ie), S(ie);
|
|
846
|
+
}, nt = () => {
|
|
847
|
+
const ie = fe.slice(0, Math.max(0, fe.length - 1)), ne = X(g, [...K, _e], ie);
|
|
848
|
+
r && s ? s(ne) : _(ne), S(ne);
|
|
849
849
|
};
|
|
850
850
|
return /* @__PURE__ */ b("div", { className: "mt-3", children: [
|
|
851
851
|
/* @__PURE__ */ b("div", { className: "flex items-center justify-between mb-2", children: [
|
|
852
852
|
/* @__PURE__ */ o("div", { className: "text-sm font-medium opacity-75", children: "Add one or more entries" }),
|
|
853
853
|
/* @__PURE__ */ b("div", { className: "space-x-2", children: [
|
|
854
|
-
/* @__PURE__ */ o("button", { type: "button", className: "btn-outline px-3 py-1", onClick:
|
|
855
|
-
|
|
854
|
+
/* @__PURE__ */ o("button", { type: "button", className: "btn-outline px-3 py-1", onClick: tt, children: "Add another" }),
|
|
855
|
+
Re > 1 && /* @__PURE__ */ o("button", { type: "button", className: "btn-outline px-3 py-1", onClick: nt, children: "Remove last" })
|
|
856
856
|
] })
|
|
857
857
|
] }),
|
|
858
|
-
Array.from({ length:
|
|
859
|
-
const
|
|
858
|
+
Array.from({ length: Re }).map((ie, ne) => {
|
|
859
|
+
const rt = [...K, _e, ne];
|
|
860
860
|
return /* @__PURE__ */ b("div", { className: "rounded-lg border p-3 mb-3", children: [
|
|
861
861
|
/* @__PURE__ */ b("div", { className: "text-sm font-semibold mb-2", children: [
|
|
862
862
|
"Entry #",
|
|
863
863
|
ne + 1
|
|
864
864
|
] }),
|
|
865
|
-
|
|
866
|
-
] }, `nested-item-${W}-${
|
|
865
|
+
I(be, rt)
|
|
866
|
+
] }, `nested-item-${W}-${ye}-${ne}`);
|
|
867
867
|
})
|
|
868
|
-
] }, `nested-repeat-${W}-${
|
|
868
|
+
] }, `nested-repeat-${W}-${ye}`);
|
|
869
869
|
});
|
|
870
870
|
})()
|
|
871
871
|
] }, `${W}-${String(ee.key)}`))
|
|
872
872
|
] }, `group-${W}`);
|
|
873
873
|
})
|
|
874
|
-
] }, `branch-${w}-${
|
|
874
|
+
] }, `branch-${w}-${j}`);
|
|
875
875
|
})
|
|
876
|
-
] }, `wrap-${w}-${
|
|
876
|
+
] }, `wrap-${w}-${f}`);
|
|
877
877
|
});
|
|
878
878
|
}
|
|
879
|
-
const
|
|
880
|
-
const d = [],
|
|
879
|
+
const D = ae(() => {
|
|
880
|
+
const d = [], u = (c, f) => {
|
|
881
881
|
c.forEach((w) => {
|
|
882
882
|
d.push(w);
|
|
883
|
-
const $ = String(w.key),
|
|
884
|
-
if (!
|
|
885
|
-
const
|
|
886
|
-
(
|
|
887
|
-
const
|
|
888
|
-
|
|
883
|
+
const $ = String(w.key), x = w.conditionals ?? [];
|
|
884
|
+
if (!x.length) return;
|
|
885
|
+
const h = ce(g, f, $), y = x.filter((m) => le(h, m.conditionalType, m.conditionalValue));
|
|
886
|
+
(y.length > 1 && !y.some((m) => m.conditionalQuestionsAllowMultiple) ? y.slice(0, 1) : y).forEach((m) => {
|
|
887
|
+
const j = m.conditionalQuestions ?? [];
|
|
888
|
+
j.length && (m.conditionalQuestionsAllowMultiple || u(j, f));
|
|
889
889
|
});
|
|
890
890
|
});
|
|
891
891
|
};
|
|
892
|
-
return
|
|
893
|
-
}, [i,
|
|
894
|
-
function
|
|
892
|
+
return u(i), d;
|
|
893
|
+
}, [i, g]);
|
|
894
|
+
function M(d) {
|
|
895
895
|
d.preventDefault();
|
|
896
|
-
const
|
|
897
|
-
if (
|
|
898
|
-
const c =
|
|
899
|
-
c >= 0 && document.getElementById(
|
|
896
|
+
const u = he(D, g);
|
|
897
|
+
if (T(u), Object.keys(u).length > 0) {
|
|
898
|
+
const c = D.findIndex((f) => u[f.key]);
|
|
899
|
+
c >= 0 && document.getElementById(D[c].key)?.focus();
|
|
900
900
|
return;
|
|
901
901
|
}
|
|
902
|
-
n(
|
|
902
|
+
n(g);
|
|
903
903
|
}
|
|
904
|
-
return /* @__PURE__ */ o("form", { className: "space-y-6 px-1", onSubmit:
|
|
904
|
+
return /* @__PURE__ */ o("form", { className: "space-y-6 px-1", onSubmit: M, noValidate: !0, children: I(i) });
|
|
905
|
+
}
|
|
906
|
+
const Et = "GTM-NK8LGHTQ";
|
|
907
|
+
function It() {
|
|
908
|
+
return typeof window > "u" ? [] : (window.dataLayer = window.dataLayer ?? [], window.dataLayer);
|
|
909
|
+
}
|
|
910
|
+
function se(e, t = {}) {
|
|
911
|
+
It().push({
|
|
912
|
+
event: e,
|
|
913
|
+
credifyWidget: {
|
|
914
|
+
...t,
|
|
915
|
+
containerId: Et
|
|
916
|
+
}
|
|
917
|
+
});
|
|
918
|
+
}
|
|
919
|
+
function Rt() {
|
|
920
|
+
se("credify_widget_opened");
|
|
905
921
|
}
|
|
906
|
-
function
|
|
922
|
+
function Fe() {
|
|
923
|
+
se("credify_widget_closed");
|
|
924
|
+
}
|
|
925
|
+
function Qt(e) {
|
|
926
|
+
se("credify_widget_stage_viewed", e);
|
|
927
|
+
}
|
|
928
|
+
function De(e) {
|
|
929
|
+
se("credify_widget_stage_completed", e);
|
|
930
|
+
}
|
|
931
|
+
function Mt() {
|
|
932
|
+
se("credify_widget_flow_completed");
|
|
933
|
+
}
|
|
934
|
+
function jt(e) {
|
|
935
|
+
se("credify_widget_rates_viewed", e ?? {});
|
|
936
|
+
}
|
|
937
|
+
function Bt() {
|
|
938
|
+
se("credify_widget_rates_back");
|
|
939
|
+
}
|
|
940
|
+
function Le(e) {
|
|
907
941
|
return typeof e == "number" && Number.isFinite(e) ? e : typeof e == "string" && e.trim() !== "" && !Number.isNaN(Number(e)) ? Number(e) : null;
|
|
908
942
|
}
|
|
909
|
-
function
|
|
943
|
+
function Ke(e) {
|
|
910
944
|
if (e instanceof Date && !Number.isNaN(e.getTime())) return e.getTime();
|
|
911
945
|
if (typeof e == "string") {
|
|
912
946
|
const t = Date.parse(e);
|
|
@@ -914,29 +948,29 @@ function Fe(e) {
|
|
|
914
948
|
}
|
|
915
949
|
return null;
|
|
916
950
|
}
|
|
917
|
-
function
|
|
918
|
-
const r =
|
|
951
|
+
function ze(e, t) {
|
|
952
|
+
const r = Le(e), s = Le(t);
|
|
919
953
|
if (r != null && s != null) return r - s;
|
|
920
|
-
const n =
|
|
954
|
+
const n = Ke(e), i = Ke(t);
|
|
921
955
|
return n != null && i != null ? n - i : e == null || t == null ? null : String(e).localeCompare(String(t));
|
|
922
956
|
}
|
|
923
|
-
function
|
|
957
|
+
function Ft(e, t) {
|
|
924
958
|
return Array.isArray(e) ? e.some((r) => r === t) : typeof e == "string" ? t != null && e.includes(String(t)) : !1;
|
|
925
959
|
}
|
|
926
|
-
function
|
|
960
|
+
function Ge(e, t, r) {
|
|
927
961
|
switch (t) {
|
|
928
962
|
case "equals":
|
|
929
963
|
return e === r;
|
|
930
964
|
case "lessThan": {
|
|
931
|
-
const s =
|
|
965
|
+
const s = ze(e, r);
|
|
932
966
|
return s != null && s < 0;
|
|
933
967
|
}
|
|
934
968
|
case "greaterThan": {
|
|
935
|
-
const s =
|
|
969
|
+
const s = ze(e, r);
|
|
936
970
|
return s != null && s > 0;
|
|
937
971
|
}
|
|
938
972
|
case "contains":
|
|
939
|
-
return
|
|
973
|
+
return Ft(e, r);
|
|
940
974
|
case "startsWith":
|
|
941
975
|
return e != null && r != null && String(e).startsWith(String(r));
|
|
942
976
|
case "endsWith":
|
|
@@ -945,132 +979,141 @@ function Pe(e, t, r) {
|
|
|
945
979
|
return !1;
|
|
946
980
|
}
|
|
947
981
|
}
|
|
948
|
-
function
|
|
982
|
+
function We(e, t) {
|
|
949
983
|
const r = [];
|
|
950
984
|
return ((n) => {
|
|
951
985
|
n.forEach((i) => {
|
|
952
986
|
r.push(i);
|
|
953
|
-
const l = String(i.key), a = t[l],
|
|
954
|
-
if (!
|
|
955
|
-
const v =
|
|
956
|
-
(v.length > 1 && !v.some((
|
|
957
|
-
const A =
|
|
958
|
-
A.length && (
|
|
987
|
+
const l = String(i.key), a = t[l], _ = i.conditionals ?? [];
|
|
988
|
+
if (!_.length) return;
|
|
989
|
+
const v = _.filter((g) => Ge(a, g.conditionalType, g.conditionalValue));
|
|
990
|
+
(v.length > 1 && !v.some((g) => g.conditionalQuestionsAllowMultiple) ? v.slice(0, 1) : v).forEach((g) => {
|
|
991
|
+
const A = g.conditionalQuestions ?? [];
|
|
992
|
+
A.length && (g.conditionalQuestionsAllowMultiple || A.forEach((T) => r.push(T)));
|
|
959
993
|
});
|
|
960
994
|
});
|
|
961
995
|
})(e), r;
|
|
962
996
|
}
|
|
963
|
-
const
|
|
964
|
-
function
|
|
997
|
+
const Ye = "__items", He = (e) => `${e}${Ye}`;
|
|
998
|
+
function $e(e, t) {
|
|
965
999
|
for (const r of e) {
|
|
966
1000
|
const s = String(r.key), n = t[s], i = r.conditionals ?? [];
|
|
967
1001
|
if (!i.length) continue;
|
|
968
|
-
const l = i.filter((
|
|
969
|
-
for (const
|
|
970
|
-
const v =
|
|
1002
|
+
const l = i.filter((_) => Ge(n, _.conditionalType, _.conditionalValue)), a = l.length > 1 && !l.some((_) => _.conditionalQuestionsAllowMultiple) ? l.slice(0, 1) : l;
|
|
1003
|
+
for (const _ of a) {
|
|
1004
|
+
const v = _.conditionalQuestions ?? [];
|
|
971
1005
|
if (!v.length) continue;
|
|
972
|
-
if (!
|
|
973
|
-
if (
|
|
1006
|
+
if (!_.conditionalQuestionsAllowMultiple) {
|
|
1007
|
+
if ($e(v, t)) return !0;
|
|
974
1008
|
continue;
|
|
975
1009
|
}
|
|
976
|
-
const
|
|
977
|
-
if (
|
|
978
|
-
for (const
|
|
979
|
-
const A =
|
|
980
|
-
if (Object.values(A).some(Boolean) ||
|
|
1010
|
+
const S = t[He(s)] ?? [];
|
|
1011
|
+
if (S.length === 0) return !0;
|
|
1012
|
+
for (const g of S) {
|
|
1013
|
+
const A = he(v, g);
|
|
1014
|
+
if (Object.values(A).some(Boolean) || $e(v, g)) return !0;
|
|
981
1015
|
}
|
|
982
1016
|
}
|
|
983
1017
|
}
|
|
984
1018
|
return !1;
|
|
985
1019
|
}
|
|
986
|
-
function
|
|
987
|
-
return
|
|
1020
|
+
function Oe(e, t) {
|
|
1021
|
+
return $e(e, t);
|
|
988
1022
|
}
|
|
989
|
-
function
|
|
1023
|
+
function Dt({
|
|
990
1024
|
stages: e,
|
|
991
1025
|
onStageComplete: t,
|
|
992
1026
|
onComplete: r,
|
|
993
1027
|
initialValues: s,
|
|
994
1028
|
initialActive: n
|
|
995
1029
|
}) {
|
|
996
|
-
const [i, l] =
|
|
997
|
-
|
|
1030
|
+
const [i, l] = Q(n ?? 0), [a, _] = Q(s ?? {}), [v, S] = Q({}), [g, A] = Q(!1), [T, E] = Q(!1), [I, D] = Q(null), M = O([]), d = Array.isArray(e) && e.length > 0, u = d ? e[Math.min(i, e.length - 1)] : null, c = u?.key ?? null;
|
|
1031
|
+
B(() => {
|
|
998
1032
|
n !== void 0 && l(n);
|
|
999
|
-
}, [n]),
|
|
1000
|
-
const
|
|
1001
|
-
|
|
1002
|
-
}, [i]),
|
|
1003
|
-
s !== void 0 &&
|
|
1004
|
-
}, [s]),
|
|
1005
|
-
if (!
|
|
1006
|
-
A(!1),
|
|
1033
|
+
}, [n]), B(() => {
|
|
1034
|
+
const p = M.current[i];
|
|
1035
|
+
p && p.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "center" });
|
|
1036
|
+
}, [i]), B(() => {
|
|
1037
|
+
s !== void 0 && _(s);
|
|
1038
|
+
}, [s]), B(() => {
|
|
1039
|
+
if (!u || !c) {
|
|
1040
|
+
A(!1), D(null);
|
|
1007
1041
|
return;
|
|
1008
1042
|
}
|
|
1009
1043
|
if (v[c]) {
|
|
1010
|
-
A(!1),
|
|
1044
|
+
A(!1), D(null);
|
|
1011
1045
|
return;
|
|
1012
1046
|
}
|
|
1013
|
-
let
|
|
1014
|
-
return A(!0),
|
|
1015
|
-
if (!
|
|
1016
|
-
if (!Array.isArray(
|
|
1017
|
-
|
|
1047
|
+
let p = !1;
|
|
1048
|
+
return A(!0), D(null), Promise.resolve(u.loadQuestions()).then((m) => {
|
|
1049
|
+
if (!p) {
|
|
1050
|
+
if (!Array.isArray(m)) throw new Error(`loadQuestions("${c}") did not return an array`);
|
|
1051
|
+
S((j) => ({ ...j, [c]: m }));
|
|
1018
1052
|
}
|
|
1019
|
-
}).catch((
|
|
1020
|
-
|
|
1053
|
+
}).catch((m) => {
|
|
1054
|
+
p || D(`Failed to load stage "${u?.title ?? ""}": ${m?.message ?? "Unknown error"}`);
|
|
1021
1055
|
}).finally(() => {
|
|
1022
|
-
|
|
1056
|
+
p || A(!1);
|
|
1023
1057
|
}), () => {
|
|
1024
|
-
|
|
1058
|
+
p = !0;
|
|
1025
1059
|
};
|
|
1026
|
-
}, [
|
|
1027
|
-
const
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1060
|
+
}, [u, c, v]);
|
|
1061
|
+
const f = c ? v[c] : void 0;
|
|
1062
|
+
B(() => {
|
|
1063
|
+
u && c && f && Qt({
|
|
1064
|
+
stageKey: c,
|
|
1065
|
+
stageTitle: u.title ?? c,
|
|
1066
|
+
stepIndex: i + 1,
|
|
1067
|
+
totalSteps: e.length
|
|
1068
|
+
});
|
|
1069
|
+
}, [c, i, e.length, u, f]);
|
|
1070
|
+
const w = ae(() => {
|
|
1071
|
+
if (!f) return {};
|
|
1072
|
+
const p = {};
|
|
1073
|
+
((C) => {
|
|
1074
|
+
const N = [], k = (F) => {
|
|
1075
|
+
F.forEach((L, Z) => {
|
|
1076
|
+
const q = Ve(L, Z);
|
|
1034
1077
|
N.push(q);
|
|
1035
|
-
const
|
|
1036
|
-
N.push(
|
|
1037
|
-
const W =
|
|
1038
|
-
W.length > 0 &&
|
|
1078
|
+
const z = He(q);
|
|
1079
|
+
N.push(z), (L.conditionals ?? []).forEach((K) => {
|
|
1080
|
+
const W = K.conditionalQuestions ?? [];
|
|
1081
|
+
W.length > 0 && k(W);
|
|
1039
1082
|
});
|
|
1040
1083
|
});
|
|
1041
1084
|
};
|
|
1042
|
-
return
|
|
1043
|
-
})(
|
|
1044
|
-
|
|
1085
|
+
return k(C), N;
|
|
1086
|
+
})(f).forEach((C) => {
|
|
1087
|
+
C in a && (p[C] = a[C]);
|
|
1045
1088
|
});
|
|
1046
|
-
for (const [
|
|
1047
|
-
|
|
1048
|
-
return
|
|
1049
|
-
}, [
|
|
1050
|
-
|
|
1051
|
-
},
|
|
1052
|
-
l((
|
|
1053
|
-
},
|
|
1054
|
-
if (!
|
|
1055
|
-
const
|
|
1056
|
-
if (!(
|
|
1057
|
-
|
|
1089
|
+
for (const [C, N] of Object.entries(a))
|
|
1090
|
+
C.endsWith(Ye) && !(C in p) && (p[C] = N);
|
|
1091
|
+
return p;
|
|
1092
|
+
}, [f, a]), $ = (p) => {
|
|
1093
|
+
_((m) => ({ ...m, ...p }));
|
|
1094
|
+
}, x = () => {
|
|
1095
|
+
l((p) => p > 0 ? p - 1 : 0), document.querySelector(".panel-body")?.scrollTo({ top: 0, behavior: "instant" });
|
|
1096
|
+
}, h = async () => {
|
|
1097
|
+
if (!f || !u || g || I || T) return;
|
|
1098
|
+
const p = We(f, a), m = he(p, a), j = Object.values(m).some(Boolean), C = Oe(f, a);
|
|
1099
|
+
if (!(j || C)) {
|
|
1100
|
+
E(!0);
|
|
1058
1101
|
try {
|
|
1059
|
-
const N = Math.min(i + 1, e.length - 1),
|
|
1102
|
+
const N = Math.min(i + 1, e.length - 1), k = i >= e.length - 1, { success: F, error: L } = k ? await r(a, c ?? "") : await t(w, c ?? "");
|
|
1060
1103
|
if (!F) {
|
|
1061
|
-
|
|
1104
|
+
D(L ?? "An error occurred");
|
|
1062
1105
|
return;
|
|
1063
1106
|
}
|
|
1064
|
-
|
|
1107
|
+
k || l(N);
|
|
1065
1108
|
} finally {
|
|
1066
|
-
|
|
1109
|
+
E(!1);
|
|
1067
1110
|
}
|
|
1068
1111
|
}
|
|
1069
|
-
},
|
|
1070
|
-
if (!
|
|
1071
|
-
const
|
|
1072
|
-
return
|
|
1073
|
-
}, [
|
|
1112
|
+
}, y = ae(() => {
|
|
1113
|
+
if (!f || g || I || T) return !0;
|
|
1114
|
+
const p = We(f, a), m = he(p, a), j = Object.values(m).some(Boolean), C = Oe(f, a);
|
|
1115
|
+
return j || C;
|
|
1116
|
+
}, [f, a, g, I, T]);
|
|
1074
1117
|
return d ? /* @__PURE__ */ b("div", { className: "space-y-6", children: [
|
|
1075
1118
|
/* @__PURE__ */ b("div", { className: "form-wizard-steps-header flex items-center justify-between gap-4", children: [
|
|
1076
1119
|
/* @__PURE__ */ o(
|
|
@@ -1078,20 +1121,20 @@ function Ct({
|
|
|
1078
1121
|
{
|
|
1079
1122
|
className: "form-wizard-steps flex gap-2 text-xs overflow-x-auto flex-1 pb-1 scrollbar-hide items-center",
|
|
1080
1123
|
style: { scrollbarWidth: "none", msOverflowStyle: "none" },
|
|
1081
|
-
children: e.flatMap((
|
|
1124
|
+
children: e.flatMap((p, m) => [
|
|
1082
1125
|
/* @__PURE__ */ o(
|
|
1083
1126
|
"li",
|
|
1084
1127
|
{
|
|
1085
|
-
ref: (
|
|
1086
|
-
|
|
1128
|
+
ref: (j) => {
|
|
1129
|
+
M.current[m] = j;
|
|
1087
1130
|
},
|
|
1088
|
-
className: `form-wizard-step-pill px-2.5 py-1 rounded-full border whitespace-nowrap flex-shrink-0 ${
|
|
1089
|
-
children:
|
|
1131
|
+
className: `form-wizard-step-pill px-2.5 py-1 rounded-full border whitespace-nowrap flex-shrink-0 ${m < i ? "bg-blue-600 text-white border-blue-600" : m === i ? "border-blue-600 text-blue-600 bg-white" : "border-slate-200 text-slate-600"}`,
|
|
1132
|
+
children: p.title
|
|
1090
1133
|
},
|
|
1091
|
-
|
|
1134
|
+
p.key ?? `stage-${m}`
|
|
1092
1135
|
),
|
|
1093
|
-
...
|
|
1094
|
-
/* @__PURE__ */ o("li", { className: "form-wizard-step-arrow text-slate-400 flex-shrink-0", children: "→" }, `arrow-${
|
|
1136
|
+
...m < e.length - 1 ? [
|
|
1137
|
+
/* @__PURE__ */ o("li", { className: "form-wizard-step-arrow text-slate-400 flex-shrink-0", children: "→" }, `arrow-${p.key ?? m}`)
|
|
1095
1138
|
] : []
|
|
1096
1139
|
])
|
|
1097
1140
|
}
|
|
@@ -1103,30 +1146,30 @@ function Ct({
|
|
|
1103
1146
|
] })
|
|
1104
1147
|
] }),
|
|
1105
1148
|
/* @__PURE__ */ b("div", { children: [
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1149
|
+
g && /* @__PURE__ */ o("div", { className: "text-slate-500", children: "Loading…" }),
|
|
1150
|
+
u && /* @__PURE__ */ o(
|
|
1151
|
+
Tt,
|
|
1109
1152
|
{
|
|
1110
|
-
questions:
|
|
1153
|
+
questions: f ?? [],
|
|
1111
1154
|
controlledValues: w,
|
|
1112
1155
|
onChangeValues: $,
|
|
1113
|
-
onSubmit: () =>
|
|
1156
|
+
onSubmit: () => h()
|
|
1114
1157
|
},
|
|
1115
|
-
|
|
1158
|
+
u.key
|
|
1116
1159
|
)
|
|
1117
1160
|
] }),
|
|
1118
|
-
!
|
|
1119
|
-
/* @__PURE__ */ o("div", { children:
|
|
1120
|
-
|
|
1161
|
+
!g && I && /* @__PURE__ */ b("div", { className: "text-red-600 text-sm -mt-4", children: [
|
|
1162
|
+
/* @__PURE__ */ o("div", { children: I }),
|
|
1163
|
+
u && /* @__PURE__ */ o(
|
|
1121
1164
|
"button",
|
|
1122
1165
|
{
|
|
1123
1166
|
type: "button",
|
|
1124
1167
|
className: "credify-retry-btn underline mt-1 font-bold",
|
|
1125
1168
|
onClick: () => {
|
|
1126
|
-
|
|
1127
|
-
if (!c) return
|
|
1128
|
-
const
|
|
1129
|
-
return delete
|
|
1169
|
+
S((p) => {
|
|
1170
|
+
if (!c) return p;
|
|
1171
|
+
const m = { ...p };
|
|
1172
|
+
return delete m[c], m;
|
|
1130
1173
|
});
|
|
1131
1174
|
},
|
|
1132
1175
|
children: "Retry"
|
|
@@ -1138,8 +1181,8 @@ function Ct({
|
|
|
1138
1181
|
"button",
|
|
1139
1182
|
{
|
|
1140
1183
|
type: "button",
|
|
1141
|
-
onClick:
|
|
1142
|
-
disabled:
|
|
1184
|
+
onClick: x,
|
|
1185
|
+
disabled: g,
|
|
1143
1186
|
className: "credify-btn-back h-12 rounded-full border border-gray-300 text-text-primary hover:bg-gray-50 transition",
|
|
1144
1187
|
children: "Back"
|
|
1145
1188
|
}
|
|
@@ -1149,18 +1192,18 @@ function Ct({
|
|
|
1149
1192
|
{
|
|
1150
1193
|
type: "button",
|
|
1151
1194
|
"data-widget-ctrl": "next",
|
|
1152
|
-
onClick:
|
|
1153
|
-
disabled:
|
|
1195
|
+
onClick: h,
|
|
1196
|
+
disabled: y,
|
|
1154
1197
|
className: [
|
|
1155
1198
|
"form-wizard-next-btn",
|
|
1156
1199
|
i > 0 ? "" : "w-full",
|
|
1157
1200
|
"h-12 rounded-full text-white transition",
|
|
1158
1201
|
"disabled:opacity-50 disabled:cursor-not-allowed",
|
|
1159
1202
|
"flex items-center justify-center gap-2",
|
|
1160
|
-
|
|
1203
|
+
y ? "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"
|
|
1161
1204
|
].join(" "),
|
|
1162
1205
|
children: [
|
|
1163
|
-
|
|
1206
|
+
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: [
|
|
1164
1207
|
/* @__PURE__ */ o("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
1165
1208
|
/* @__PURE__ */ o(
|
|
1166
1209
|
"path",
|
|
@@ -1178,72 +1221,72 @@ function Ct({
|
|
|
1178
1221
|
] })
|
|
1179
1222
|
] }) : /* @__PURE__ */ o("div", { className: "text-slate-600", children: "Loading..." });
|
|
1180
1223
|
}
|
|
1181
|
-
const
|
|
1182
|
-
function
|
|
1224
|
+
const Te = "credify_quote_id", Ee = "credify_auth_token";
|
|
1225
|
+
function Lt(e) {
|
|
1183
1226
|
try {
|
|
1184
|
-
localStorage.setItem(
|
|
1227
|
+
localStorage.setItem(Te, e);
|
|
1185
1228
|
} catch (t) {
|
|
1186
1229
|
console.error("Failed to save quoteId to localStorage:", t);
|
|
1187
1230
|
}
|
|
1188
1231
|
}
|
|
1189
|
-
function
|
|
1232
|
+
function Kt() {
|
|
1190
1233
|
try {
|
|
1191
|
-
return localStorage.getItem(
|
|
1234
|
+
return localStorage.getItem(Te);
|
|
1192
1235
|
} catch (e) {
|
|
1193
1236
|
return console.error("Failed to load quoteId from localStorage:", e), null;
|
|
1194
1237
|
}
|
|
1195
1238
|
}
|
|
1196
|
-
function
|
|
1239
|
+
function Je() {
|
|
1197
1240
|
try {
|
|
1198
|
-
localStorage.removeItem(
|
|
1241
|
+
localStorage.removeItem(Te);
|
|
1199
1242
|
} catch (e) {
|
|
1200
1243
|
console.error("Failed to clear quoteId from localStorage:", e);
|
|
1201
1244
|
}
|
|
1202
1245
|
}
|
|
1203
|
-
function
|
|
1246
|
+
function zt(e) {
|
|
1204
1247
|
try {
|
|
1205
1248
|
localStorage.setItem(Ee, e);
|
|
1206
1249
|
} catch (t) {
|
|
1207
1250
|
console.error("Failed to save authToken to localStorage:", t);
|
|
1208
1251
|
}
|
|
1209
1252
|
}
|
|
1210
|
-
function
|
|
1253
|
+
function Wt() {
|
|
1211
1254
|
try {
|
|
1212
1255
|
return localStorage.getItem(Ee);
|
|
1213
1256
|
} catch (e) {
|
|
1214
1257
|
return console.error("Failed to load authToken from localStorage:", e), null;
|
|
1215
1258
|
}
|
|
1216
1259
|
}
|
|
1217
|
-
function
|
|
1260
|
+
function Xe() {
|
|
1218
1261
|
try {
|
|
1219
1262
|
localStorage.removeItem(Ee);
|
|
1220
1263
|
} catch (e) {
|
|
1221
1264
|
console.error("Failed to clear authToken from localStorage:", e);
|
|
1222
1265
|
}
|
|
1223
1266
|
}
|
|
1224
|
-
function
|
|
1225
|
-
|
|
1267
|
+
function Ot() {
|
|
1268
|
+
Je(), Xe();
|
|
1226
1269
|
}
|
|
1227
|
-
const
|
|
1228
|
-
let
|
|
1229
|
-
function
|
|
1230
|
-
|
|
1270
|
+
const Y = "https://api.getcredify.com";
|
|
1271
|
+
let oe = null;
|
|
1272
|
+
function Pt(e) {
|
|
1273
|
+
oe = e, zt(e);
|
|
1231
1274
|
}
|
|
1232
|
-
function
|
|
1233
|
-
return
|
|
1275
|
+
function pe() {
|
|
1276
|
+
return oe;
|
|
1234
1277
|
}
|
|
1235
|
-
function
|
|
1236
|
-
const e =
|
|
1237
|
-
e && (
|
|
1278
|
+
function Ae() {
|
|
1279
|
+
const e = Wt();
|
|
1280
|
+
e && (oe = e);
|
|
1238
1281
|
}
|
|
1239
|
-
function
|
|
1240
|
-
|
|
1282
|
+
function Ze() {
|
|
1283
|
+
oe = null, Xe();
|
|
1241
1284
|
}
|
|
1242
1285
|
async function H(e, t) {
|
|
1243
1286
|
const r = {
|
|
1244
1287
|
"Content-Type": "application/json"
|
|
1245
1288
|
};
|
|
1246
|
-
|
|
1289
|
+
oe && (r.Authorization = `Bearer ${oe}`);
|
|
1247
1290
|
const s = await fetch(e, {
|
|
1248
1291
|
method: "POST",
|
|
1249
1292
|
headers: r,
|
|
@@ -1261,70 +1304,72 @@ async function H(e, t) {
|
|
|
1261
1304
|
}
|
|
1262
1305
|
return s;
|
|
1263
1306
|
}
|
|
1264
|
-
async function
|
|
1265
|
-
return await (await H(`${
|
|
1307
|
+
async function Ut(e) {
|
|
1308
|
+
return await (await H(`${Y}/get-questions-by-stage`, { stage: e })).json();
|
|
1266
1309
|
}
|
|
1267
|
-
async function
|
|
1268
|
-
return await (await H(`${
|
|
1310
|
+
async function xe() {
|
|
1311
|
+
return await (await H(`${Y}/get-stages-for-quote`, {})).json();
|
|
1269
1312
|
}
|
|
1270
|
-
async function
|
|
1271
|
-
const r = await (await H(`${
|
|
1313
|
+
async function Vt(e) {
|
|
1314
|
+
const r = await (await H(`${Y}/create-quote`, { phone: e })).json();
|
|
1272
1315
|
if (!r || typeof r != "object" || !r.quoteId)
|
|
1273
1316
|
throw new Error(`Invalid createQuote response: ${JSON.stringify(r)}`);
|
|
1274
1317
|
return r;
|
|
1275
1318
|
}
|
|
1276
|
-
async function
|
|
1319
|
+
async function de(e, t, r) {
|
|
1277
1320
|
const s = { payload: e, getRates: t };
|
|
1278
|
-
return r && typeof r == "string" && r.trim() !== "" && (s.quoteId = r), await (await H(`${
|
|
1321
|
+
return r && typeof r == "string" && r.trim() !== "" && (s.quoteId = r), await (await H(`${Y}/update-quote`, s)).json();
|
|
1279
1322
|
}
|
|
1280
|
-
async function
|
|
1281
|
-
return await (await H(`${
|
|
1323
|
+
async function Gt(e, t) {
|
|
1324
|
+
return await (await H(`${Y}/verify-quote`, { quoteId: e, smsCode: t })).json();
|
|
1282
1325
|
}
|
|
1283
|
-
async function
|
|
1284
|
-
return await (await H(`${
|
|
1326
|
+
async function Yt(e) {
|
|
1327
|
+
return await (await H(`${Y}/is-supported-state`, { state: e })).json();
|
|
1285
1328
|
}
|
|
1286
|
-
async function
|
|
1287
|
-
return await (await H(`${
|
|
1329
|
+
async function Ht() {
|
|
1330
|
+
return await (await H(`${Y}/get-rates`, {})).json();
|
|
1288
1331
|
}
|
|
1289
|
-
async function
|
|
1332
|
+
async function Jt(e) {
|
|
1290
1333
|
const t = e ? { quoteId: e } : {};
|
|
1291
|
-
return await (await H(`${
|
|
1334
|
+
return await (await H(`${Y}/get-quote`, t)).json();
|
|
1292
1335
|
}
|
|
1293
|
-
async function
|
|
1294
|
-
const r = await (await H(`${
|
|
1336
|
+
async function Xt(e) {
|
|
1337
|
+
const r = await (await H(`${Y}/request-bind`, { quoteRateId: e })).json();
|
|
1295
1338
|
return r && typeof r == "object" && "success" in r ? r : { success: !0 };
|
|
1296
1339
|
}
|
|
1297
|
-
const
|
|
1340
|
+
const Zt = new Intl.NumberFormat("en-US", {
|
|
1298
1341
|
style: "currency",
|
|
1299
1342
|
currency: "USD"
|
|
1300
1343
|
});
|
|
1301
|
-
function
|
|
1344
|
+
function Pe({ onBack: e }) {
|
|
1302
1345
|
return /* @__PURE__ */ o(
|
|
1303
1346
|
"button",
|
|
1304
1347
|
{
|
|
1305
1348
|
type: "button",
|
|
1306
|
-
onClick:
|
|
1349
|
+
onClick: () => {
|
|
1350
|
+
Bt(), e?.();
|
|
1351
|
+
},
|
|
1307
1352
|
className: "credify-btn-back credify-btn-back-rates h-12 rounded-full border border-gray-300 text-text-primary hover:bg-gray-50 transition w-full",
|
|
1308
1353
|
children: "Back"
|
|
1309
1354
|
}
|
|
1310
1355
|
);
|
|
1311
1356
|
}
|
|
1312
|
-
function
|
|
1313
|
-
const r = Array.isArray(e) && e.length > 0, [s, n] =
|
|
1314
|
-
return
|
|
1315
|
-
|
|
1357
|
+
function qt({ rates: e, onBack: t }) {
|
|
1358
|
+
const r = Array.isArray(e) && e.length > 0, [s, n] = Q({});
|
|
1359
|
+
return B(() => {
|
|
1360
|
+
Ae();
|
|
1316
1361
|
}, []), r ? /* @__PURE__ */ b("section", { className: "mt-8", children: [
|
|
1317
1362
|
/* @__PURE__ */ o("h3", { className: "text-lg font-semibold text-slate-900", children: "Rates" }),
|
|
1318
1363
|
/* @__PURE__ */ o("div", { className: "mt-4 grid gap-4 sm:grid-cols-2 lg:grid-cols-3", children: e.map((i) => {
|
|
1319
|
-
const l = i.premium_cents / 100, a =
|
|
1320
|
-
n((
|
|
1364
|
+
const l = i.premium_cents / 100, a = Zt.format(l), _ = i.quote_rate_id, v = s[_] ?? "idle", S = v === "loading", g = v === "success", A = async () => {
|
|
1365
|
+
n((T) => ({ ...T, [_]: "loading" }));
|
|
1321
1366
|
try {
|
|
1322
|
-
if (
|
|
1367
|
+
if (Ae(), !pe())
|
|
1323
1368
|
throw new Error("Authentication required. Please verify your phone number first.");
|
|
1324
|
-
if (!((await
|
|
1325
|
-
|
|
1369
|
+
if (!((await Xt(i.quote_rate_id))?.success !== !1)) throw new Error("Request failed");
|
|
1370
|
+
Ot(), Ze(), n((D) => ({ ...D, [_]: "success" }));
|
|
1326
1371
|
} catch {
|
|
1327
|
-
n((
|
|
1372
|
+
n((T) => ({ ...T, [_]: "error" }));
|
|
1328
1373
|
}
|
|
1329
1374
|
};
|
|
1330
1375
|
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: [
|
|
@@ -1353,24 +1398,24 @@ function Ot({ rates: e, onBack: t }) {
|
|
|
1353
1398
|
{
|
|
1354
1399
|
type: "button",
|
|
1355
1400
|
onClick: A,
|
|
1356
|
-
disabled:
|
|
1357
|
-
className: `rates-bind-btn w-full rounded-full px-4 py-2.5 text-sm font-semibold transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-600/40 disabled:cursor-not-allowed ${
|
|
1358
|
-
children:
|
|
1401
|
+
disabled: S || g,
|
|
1402
|
+
className: `rates-bind-btn w-full rounded-full px-4 py-2.5 text-sm font-semibold transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-600/40 disabled:cursor-not-allowed ${g ? "rates-bind-btn-requested" : "hover:bg-blue-600/90 disabled:bg-slate-300 disabled:text-slate-500"}`,
|
|
1403
|
+
children: S ? "Requesting…" : g ? "Requested" : "Request Bind"
|
|
1359
1404
|
}
|
|
1360
1405
|
),
|
|
1361
1406
|
v === "error" && /* @__PURE__ */ o("p", { className: "mt-2 text-xs text-red-600", children: "Something went wrong. Please try again." }),
|
|
1362
1407
|
v === "success" && /* @__PURE__ */ o("p", { className: "mt-2 text-xs text-emerald-600", children: "We received your bind request." })
|
|
1363
1408
|
] })
|
|
1364
|
-
] },
|
|
1409
|
+
] }, _);
|
|
1365
1410
|
}) }),
|
|
1366
|
-
t && /* @__PURE__ */ o(
|
|
1411
|
+
t && /* @__PURE__ */ o(Pe, { onBack: t })
|
|
1367
1412
|
] }) : /* @__PURE__ */ b("section", { className: "mt-8", children: [
|
|
1368
1413
|
/* @__PURE__ */ o("h3", { className: "text-lg font-semibold text-slate-900", children: "Rates" }),
|
|
1369
1414
|
/* @__PURE__ */ o("p", { className: "mt-2 text-sm text-slate-500", children: "No rates are available at this time." }),
|
|
1370
|
-
t && /* @__PURE__ */ o(
|
|
1415
|
+
t && /* @__PURE__ */ o(Pe, { onBack: t })
|
|
1371
1416
|
] });
|
|
1372
1417
|
}
|
|
1373
|
-
function
|
|
1418
|
+
function R(e) {
|
|
1374
1419
|
if (e === !0) return "Yes";
|
|
1375
1420
|
if (e === !1) return "No";
|
|
1376
1421
|
}
|
|
@@ -1383,13 +1428,13 @@ function P(e) {
|
|
|
1383
1428
|
return;
|
|
1384
1429
|
}
|
|
1385
1430
|
}
|
|
1386
|
-
function
|
|
1431
|
+
function en(e) {
|
|
1387
1432
|
const t = {};
|
|
1388
1433
|
e.phone && (t.phone = e.phone), e.first_name && (t.first_name = e.first_name), e.last_name && (t.last_name = e.last_name), e.email && (t.email = e.email), e.date_of_birth && (t.date_of_birth = P(e.date_of_birth)), e.product && (t.product = e.product), e.state && (t.state = e.state);
|
|
1389
1434
|
const r = [];
|
|
1390
1435
|
e.line_1 && r.push(e.line_1), e.line_2 && r.push(e.line_2), e.city && r.push(e.city), e.state && r.push(e.state), e.postal_code && r.push(e.postal_code), r.length > 0 && (t.address = r.join(", ")), e.years_at_address !== null && e.years_at_address !== void 0 && (t.years_at_address = e.years_at_address), e.months_at_address !== null && e.months_at_address !== void 0 && (t.months_at_address = e.months_at_address), e.move_in_date && (t.move_in_date = P(e.move_in_date));
|
|
1391
1436
|
const s = [];
|
|
1392
|
-
return e.prior_line_1 && s.push(e.prior_line_1), e.prior_line_2 && s.push(e.prior_line_2), e.prior_city && s.push(e.prior_city), e.prior_state && s.push(e.prior_state), e.prior_postal_code && s.push(e.prior_postal_code), s.length > 0 && (t.prior_address = s.join(", ")), e.years_at_prior_address !== null && e.years_at_prior_address !== void 0 && (t.years_at_prior_address = e.years_at_prior_address), e.auto_has_prior_insurance !== null && e.auto_has_prior_insurance !== void 0 && (t.auto_has_prior_insurance =
|
|
1437
|
+
return e.prior_line_1 && s.push(e.prior_line_1), e.prior_line_2 && s.push(e.prior_line_2), e.prior_city && s.push(e.prior_city), e.prior_state && s.push(e.prior_state), e.prior_postal_code && s.push(e.prior_postal_code), s.length > 0 && (t.prior_address = s.join(", ")), e.years_at_prior_address !== null && e.years_at_prior_address !== void 0 && (t.years_at_prior_address = e.years_at_prior_address), e.auto_has_prior_insurance !== null && e.auto_has_prior_insurance !== void 0 && (t.auto_has_prior_insurance = R(e.auto_has_prior_insurance)), e.auto_prior_expiration_date && (t.auto_prior_expiration_date = P(e.auto_prior_expiration_date)), e.auto_prior_carrier_name && (t.auto_prior_carrier_name = e.auto_prior_carrier_name), e.auto_prior_liability_limit && (t.auto_prior_liability_limit = e.auto_prior_liability_limit), e.auto_reason_for_no_insurance && (t.auto_reason_for_no_insurance = e.auto_reason_for_no_insurance), e.auto_prior_years !== null && e.auto_prior_years !== void 0 && (t.auto_prior_years = e.auto_prior_years), e.auto_prior_months !== null && e.auto_prior_months !== void 0 && (t.auto_prior_months = e.auto_prior_months), e.auto_continuous_coverage_years !== null && e.auto_continuous_coverage_years !== void 0 && (t.auto_continuous_coverage_years = e.auto_continuous_coverage_years), e.auto_cancelled_declined_refused_to_renew !== null && e.auto_cancelled_declined_refused_to_renew !== void 0 && (t.auto_cancelled_declined_refused_to_renew = R(e.auto_cancelled_declined_refused_to_renew)), e.home_has_prior_insurance !== null && e.home_has_prior_insurance !== void 0 && (t.home_has_prior_insurance = R(e.home_has_prior_insurance)), e.home_prior_expiration_date && (t.home_prior_expiration_date = P(e.home_prior_expiration_date)), e.home_prior_carrier_name && (t.home_prior_carrier_name = e.home_prior_carrier_name), e.year_built !== null && e.year_built !== void 0 && (t.year_built = e.year_built), e.number_of_units !== null && e.number_of_units !== void 0 && (t.number_of_units = e.number_of_units), e.number_of_stories !== null && e.number_of_stories !== void 0 && (t.number_of_stories = e.number_of_stories), e.number_of_beds !== null && e.number_of_beds !== void 0 && (t.number_of_beds = e.number_of_beds), e.number_of_full_baths !== null && e.number_of_full_baths !== void 0 && (t.number_of_full_baths = e.number_of_full_baths), e.number_of_partial_baths !== null && e.number_of_partial_baths !== void 0 && (t.number_of_partial_baths = e.number_of_partial_baths), e.under_construction !== null && e.under_construction !== void 0 && (t.under_construction = R(e.under_construction)), e.distance_from_fire_hydrant_ft && (t.distance_from_fire_hydrant_ft = e.distance_from_fire_hydrant_ft), e.distance_from_fire_station_miles && (t.distance_from_fire_station_miles = e.distance_from_fire_station_miles), e.architectural_style && (t.architectural_style = e.architectural_style), e.dwelling_type && (t.dwelling_type = e.dwelling_type), e.construction_quality && (t.construction_quality = e.construction_quality), e.located_over_water !== null && e.located_over_water !== void 0 && (t.located_over_water = e.located_over_water), e.construction_type && (t.construction_type = e.construction_type), e.exterior_wall_type && (t.exterior_wall_type = e.exterior_wall_type), e.foundation_type && (t.foundation_type = e.foundation_type), e.roof_material_type && (t.roof_material_type = e.roof_material_type), e.year_roof_updated !== null && e.year_roof_updated !== void 0 && (t.year_roof_updated = e.year_roof_updated), e.heating_type && (t.heating_type = e.heating_type), e.heating_fuel_type && (t.heating_fuel_type = e.heating_fuel_type), e.number_of_fireplaces !== null && e.number_of_fireplaces !== void 0 && (t.number_of_fireplaces = e.number_of_fireplaces), e.basement_type && (t.basement_type = e.basement_type), e.parking_type && (t.parking_type = e.parking_type), e.number_of_parking_spaces !== null && e.number_of_parking_spaces !== void 0 && (t.number_of_parking_spaces = e.number_of_parking_spaces), e.plumbing_type && (t.plumbing_type = e.plumbing_type), e.pool_type && (t.pool_type = e.pool_type), e.total_area_sq_ft !== null && e.total_area_sq_ft !== void 0 && (t.total_area_sq_ft = e.total_area_sq_ft), e.parcel_area_sq_ft !== null && e.parcel_area_sq_ft !== void 0 && (t.parcel_area_sq_ft = e.parcel_area_sq_ft), e.residence_type && (t.residence_type = e.residence_type), e.usage_type && (t.usage_type = e.usage_type), e.household_size !== null && e.household_size !== void 0 && (t.household_size = e.household_size), e.number_of_mortgagees !== null && e.number_of_mortgagees !== void 0 && (t.number_of_mortgagees = e.number_of_mortgagees), e.has_dog !== null && e.has_dog !== void 0 && (t.has_dog = R(e.has_dog)), e.dog_breed_type && (t.dog_breed_type = e.dog_breed_type), e.number_of_dogs !== null && e.number_of_dogs !== void 0 && (t.number_of_dogs = e.number_of_dogs), e.has_business_on_premises !== null && e.has_business_on_premises !== void 0 && (t.has_business_on_premises = R(e.has_business_on_premises)), e.business_class && (t.business_class = e.business_class), e.retiree_discount !== null && e.retiree_discount !== void 0 && (t.retiree_discount = R(e.retiree_discount)), e.gated_community_discount !== null && e.gated_community_discount !== void 0 && (t.gated_community_discount = R(e.gated_community_discount)), e.multi_policy_discount !== null && e.multi_policy_discount !== void 0 && (t.multi_policy_discount = R(e.multi_policy_discount)), e.non_smoker_discount !== null && e.non_smoker_discount !== void 0 && (t.non_smoker_discount = R(e.non_smoker_discount)), e.first_time_buyer_discount !== null && e.first_time_buyer_discount !== void 0 && (t.first_time_buyer_discount = R(e.first_time_buyer_discount)), e.fire_detection_system !== null && e.fire_detection_system !== void 0 && (t.fire_detection_system = R(e.fire_detection_system)), e.burglar_alarm_system !== null && e.burglar_alarm_system !== void 0 && (t.burglar_alarm_system = R(e.burglar_alarm_system)), e.burglar_alarm_system_type && (t.burglar_alarm_system_type = e.burglar_alarm_system_type), e.smoke_detectors !== null && e.smoke_detectors !== void 0 && (t.smoke_detectors = R(e.smoke_detectors)), e.sprinkler_system !== null && e.sprinkler_system !== void 0 && (t.sprinkler_system = R(e.sprinkler_system)), e.sprinkler_system_type && (t.sprinkler_system_type = e.sprinkler_system_type), e.gas_leakage_detector !== null && e.gas_leakage_detector !== void 0 && (t.gas_leakage_detector = R(e.gas_leakage_detector)), e.deadbolt_locks !== null && e.deadbolt_locks !== void 0 && (t.deadbolt_locks = R(e.deadbolt_locks)), e.fire_extinguisher !== null && e.fire_extinguisher !== void 0 && (t.fire_extinguisher = R(e.fire_extinguisher)), e.order_credit_authorized !== null && e.order_credit_authorized !== void 0 && (t.order_credit_authorized = R(e.order_credit_authorized)), e.has_health_insurance_auto_accident !== null && e.has_health_insurance_auto_accident !== void 0 && (t.has_health_insurance_auto_accident = R(e.has_health_insurance_auto_accident)), e.named_insured_foreclosure_repo_bankruptcy !== null && e.named_insured_foreclosure_repo_bankruptcy !== void 0 && (t.named_insured_foreclosure_repo_bankruptcy = R(e.named_insured_foreclosure_repo_bankruptcy)), e.named_insured_convicted_insurance_fraud !== null && e.named_insured_convicted_insurance_fraud !== void 0 && (t.named_insured_convicted_insurance_fraud = R(e.named_insured_convicted_insurance_fraud)), e.drivers && e.drivers.length > 0 ? (t.drivers = "Yes", t.drivers__items = e.drivers.map((n) => {
|
|
1393
1438
|
const i = {};
|
|
1394
1439
|
return n.first_name && (i.first_name = n.first_name), n.last_name && (i.last_name = n.last_name), n.date_of_birth && (i.date_of_birth = P(n.date_of_birth)), n.gender && (i.gender = n.gender), n.marital_status && (i.marital_status = n.marital_status), n.relationship_to_insured && (i.relationship_to_insured = n.relationship_to_insured), n.license_state && (i.license_state = n.license_state), n.license_status && (i.license_status = n.license_status), n.license_number && (i.license_number = n.license_number), n.date_first_licensed && (i.date_first_licensed = P(n.date_first_licensed)), n.education_level && (i.education_level = n.education_level), n.occupation && (i.occupation = n.occupation), n.industry && (i.industry = n.industry), n.driver_violations && n.driver_violations.length > 0 && (i.driver_violations__items = n.driver_violations.map((l) => {
|
|
1395
1440
|
const a = {};
|
|
@@ -1406,18 +1451,18 @@ function Pt(e) {
|
|
|
1406
1451
|
n.vin && (i.vin = n.vin), n.year !== null && n.year !== void 0 && (i.year = n.year), n.make && (i.make = n.make), n.model && (i.model = n.model), n.ownership_type && (i.ownership_type = n.ownership_type), n.usage && (i.usage = n.usage), n.annual_mileage !== null && n.annual_mileage !== void 0 && (i.annual_mileage = n.annual_mileage), n.miles_to_work !== null && n.miles_to_work !== void 0 && (i.miles_to_work = n.miles_to_work), n.percent_to_work !== null && n.percent_to_work !== void 0 && (i.percent_to_work = n.percent_to_work);
|
|
1407
1452
|
const l = [];
|
|
1408
1453
|
return n.garaging_address_line_1 && l.push(n.garaging_address_line_1), n.garaging_address_line_2 && l.push(n.garaging_address_line_2), n.garaging_address_city && l.push(n.garaging_address_city), n.garaging_address_state && l.push(n.garaging_address_state), n.garaging_address_postal_code && l.push(n.garaging_address_postal_code), l.length > 0 && (i.garaging_address = l.join(", ")), n.anti_theft_type && (i.anti_theft_type = n.anti_theft_type), n.passive_restraint_type && (i.passive_restraint_type = n.passive_restraint_type), n.coverages && n.coverages.length > 0 && (i.coverages__items = n.coverages.map((a) => {
|
|
1409
|
-
const
|
|
1410
|
-
return a.type && (
|
|
1454
|
+
const _ = {};
|
|
1455
|
+
return a.type && (_.type = a.type), a.per_person_limit_cents !== null && a.per_person_limit_cents !== void 0 && (_.per_person_limit_cents = a.per_person_limit_cents), a.per_incident_limit_cents !== null && a.per_incident_limit_cents !== void 0 && (_.per_incident_limit_cents = a.per_incident_limit_cents), a.per_incident_limit_percent !== null && a.per_incident_limit_percent !== void 0 && (_.per_incident_limit_percent = a.per_incident_limit_percent), a.per_day_limit_cents !== null && a.per_day_limit_cents !== void 0 && (_.per_day_limit_cents = a.per_day_limit_cents), a.deductible_cents !== null && a.deductible_cents !== void 0 && (_.deductible_cents = a.deductible_cents), a.is_declined !== null && a.is_declined !== void 0 && (_.is_declined = R(a.is_declined)), _;
|
|
1411
1456
|
})), n.vehicle_lienholders && n.vehicle_lienholders.length > 0 && (i.vehicle_lienholders__items = n.vehicle_lienholders.map((a) => {
|
|
1412
|
-
const
|
|
1413
|
-
return a.name && (
|
|
1457
|
+
const _ = {};
|
|
1458
|
+
return a.name && (_.name = a.name), a.type && (_.type = a.type), a.line_1 && (_.line_1 = a.line_1), a.line_2 && (_.line_2 = a.line_2), a.city && (_.city = a.city), a.state && (_.state = a.state), a.postal_code && (_.postal_code = a.postal_code), a.phone && (_.phone = a.phone), a.fax && (_.fax = a.fax), _;
|
|
1414
1459
|
})), i;
|
|
1415
1460
|
})) : t.vehicles = "No", e.losses && e.losses.length > 0 && (t.home_losses__items = e.losses.map((n) => {
|
|
1416
1461
|
const i = {};
|
|
1417
1462
|
return n.description && (i.description = n.description), n.date_of_incident && (i.date_of_incident = P(n.date_of_incident)), n.amount_paid_cents !== null && n.amount_paid_cents !== void 0 && (i.amount_paid_cents = n.amount_paid_cents), i;
|
|
1418
1463
|
})), t;
|
|
1419
1464
|
}
|
|
1420
|
-
function
|
|
1465
|
+
function Ce(e) {
|
|
1421
1466
|
const t = {}, r = (i) => {
|
|
1422
1467
|
if (typeof i == "string") {
|
|
1423
1468
|
if (i === "Yes") return !0;
|
|
@@ -1427,95 +1472,101 @@ function Ae(e) {
|
|
|
1427
1472
|
}, s = Object.keys(e).filter((i) => !i.includes("__items")), n = /* @__PURE__ */ new Set();
|
|
1428
1473
|
for (const [i, l] of Object.entries(e))
|
|
1429
1474
|
i.endsWith("__items") && Array.isArray(l) && l.forEach((a) => {
|
|
1430
|
-
typeof a == "object" && a !== null && Object.keys(a).forEach((
|
|
1431
|
-
n.add(
|
|
1475
|
+
typeof a == "object" && a !== null && Object.keys(a).forEach((_) => {
|
|
1476
|
+
n.add(_);
|
|
1432
1477
|
});
|
|
1433
1478
|
});
|
|
1434
1479
|
for (const [i, l] of Object.entries(e))
|
|
1435
1480
|
if (i.endsWith("__items")) {
|
|
1436
1481
|
const a = i.replace("__items", "");
|
|
1437
1482
|
if (s.includes(a)) {
|
|
1438
|
-
const v = Array.isArray(l) ? l.map((
|
|
1483
|
+
const v = Array.isArray(l) ? l.map((S) => Ce(S)) : l;
|
|
1439
1484
|
t[a] = v;
|
|
1440
1485
|
}
|
|
1441
1486
|
} else i.includes("__items") || n.has(i) || (t[i] = r(l));
|
|
1442
1487
|
return t;
|
|
1443
1488
|
}
|
|
1444
|
-
function
|
|
1445
|
-
const [r, s] =
|
|
1446
|
-
function
|
|
1447
|
-
const
|
|
1489
|
+
function tn({ isOpen: e, onClose: t }) {
|
|
1490
|
+
const [r, s] = Q([]), [n, i] = Q(null), [l, a] = Q(null), [_, v] = Q(null), [S, g] = Q(void 0), [A, T] = Q(!1);
|
|
1491
|
+
function E(M) {
|
|
1492
|
+
const d = {
|
|
1448
1493
|
SMSVerification: "Verify",
|
|
1449
1494
|
AutoCurrentCarrier: "Current Auto Policy",
|
|
1450
1495
|
HomeCurrentCarrier: "Current Home Policy"
|
|
1451
1496
|
};
|
|
1452
|
-
return
|
|
1453
|
-
key:
|
|
1454
|
-
title:
|
|
1455
|
-
loadQuestions: async () => (await
|
|
1497
|
+
return M.map((u) => ({
|
|
1498
|
+
key: u,
|
|
1499
|
+
title: d[u] || u,
|
|
1500
|
+
loadQuestions: async () => (await Ut(u)).questions
|
|
1456
1501
|
}));
|
|
1457
1502
|
}
|
|
1458
|
-
|
|
1503
|
+
B(() => {
|
|
1459
1504
|
e && (async () => {
|
|
1460
1505
|
try {
|
|
1461
|
-
const
|
|
1462
|
-
if (
|
|
1463
|
-
|
|
1506
|
+
const d = Kt();
|
|
1507
|
+
if (Ae(), d) {
|
|
1508
|
+
T(!0), i(d);
|
|
1464
1509
|
try {
|
|
1465
|
-
const
|
|
1466
|
-
if (!
|
|
1510
|
+
const u = pe(), c = await Jt(u ? void 0 : d);
|
|
1511
|
+
if (!c || !c.quote)
|
|
1467
1512
|
throw new Error("Invalid response from getQuote: missing quote data");
|
|
1468
|
-
const { quote:
|
|
1469
|
-
s(
|
|
1513
|
+
const { quote: f } = c, { stages: w } = await xe(), $ = E(w);
|
|
1514
|
+
s($);
|
|
1470
1515
|
try {
|
|
1471
|
-
const
|
|
1472
|
-
v(
|
|
1473
|
-
} catch (
|
|
1474
|
-
throw new Error(`Failed to transform quote data: ${
|
|
1516
|
+
const x = en(f);
|
|
1517
|
+
v(x);
|
|
1518
|
+
} catch (x) {
|
|
1519
|
+
throw new Error(`Failed to transform quote data: ${x instanceof Error ? x.message : "Unknown error"}`);
|
|
1475
1520
|
}
|
|
1476
|
-
if (
|
|
1477
|
-
const
|
|
1478
|
-
|
|
1521
|
+
if (f.current_stage) {
|
|
1522
|
+
const x = $.findIndex((h) => h.key === f.current_stage);
|
|
1523
|
+
x >= 0 ? g(x) : g($.length - 1);
|
|
1479
1524
|
} else
|
|
1480
|
-
|
|
1481
|
-
} catch (
|
|
1482
|
-
|
|
1525
|
+
g($.length - 1);
|
|
1526
|
+
} catch (u) {
|
|
1527
|
+
u.statusCode === 404 ? (Je(), i(null)) : Ze();
|
|
1483
1528
|
} finally {
|
|
1484
|
-
|
|
1529
|
+
T(!1);
|
|
1485
1530
|
}
|
|
1486
1531
|
} else {
|
|
1487
|
-
const { stages:
|
|
1488
|
-
s(
|
|
1532
|
+
const { stages: u } = await xe();
|
|
1533
|
+
s(E(u));
|
|
1489
1534
|
}
|
|
1490
1535
|
} catch {
|
|
1491
|
-
|
|
1536
|
+
T(!1);
|
|
1492
1537
|
}
|
|
1493
1538
|
})();
|
|
1494
|
-
}, [e]),
|
|
1539
|
+
}, [e]), B(() => {
|
|
1495
1540
|
if (!e) return;
|
|
1496
|
-
const { overflow:
|
|
1541
|
+
const { overflow: M } = document.body.style;
|
|
1497
1542
|
return document.body.style.overflow = "hidden", () => {
|
|
1498
|
-
document.body.style.overflow =
|
|
1543
|
+
document.body.style.overflow = M;
|
|
1499
1544
|
};
|
|
1500
1545
|
}, [e]);
|
|
1501
|
-
const
|
|
1502
|
-
(
|
|
1503
|
-
|
|
1546
|
+
const I = st(
|
|
1547
|
+
(M) => {
|
|
1548
|
+
M.key === "Escape" && (Fe(), t());
|
|
1504
1549
|
},
|
|
1505
1550
|
[t]
|
|
1506
1551
|
);
|
|
1507
|
-
return
|
|
1552
|
+
return B(() => {
|
|
1508
1553
|
if (e)
|
|
1509
|
-
return window.addEventListener("keydown",
|
|
1510
|
-
}, [e,
|
|
1511
|
-
e || (v(null),
|
|
1512
|
-
}, [e]),
|
|
1554
|
+
return window.addEventListener("keydown", I), () => window.removeEventListener("keydown", I);
|
|
1555
|
+
}, [e, I]), B(() => {
|
|
1556
|
+
e || (v(null), g(void 0), T(!1));
|
|
1557
|
+
}, [e]), B(() => {
|
|
1558
|
+
e && Rt();
|
|
1559
|
+
}, [e]), B(() => {
|
|
1560
|
+
l && Array.isArray(l) && jt({ rateCount: l.length });
|
|
1561
|
+
}, [l]), e ? /* @__PURE__ */ b("div", { className: "fixed inset-0 z-[9999] flex items-center justify-center", role: "dialog", "aria-modal": "true", "aria-labelledby": "insurance-modal-title", children: [
|
|
1513
1562
|
/* @__PURE__ */ o("div", { className: "backdrop", "aria-hidden": "true" }),
|
|
1514
1563
|
/* @__PURE__ */ b("div", { className: "modal-panel bg-white relative w-full max-w-2xl flex flex-col max-h-[90vh] overflow-hidden", role: "document", children: [
|
|
1515
1564
|
/* @__PURE__ */ o(
|
|
1516
1565
|
"button",
|
|
1517
1566
|
{
|
|
1518
|
-
onClick:
|
|
1567
|
+
onClick: () => {
|
|
1568
|
+
Fe(), t();
|
|
1569
|
+
},
|
|
1519
1570
|
className: "modal-close-btn absolute top-4 right-4 text-slate-400 hover:text-slate-600 text-xl",
|
|
1520
1571
|
"aria-label": "Close",
|
|
1521
1572
|
type: "button",
|
|
@@ -1527,101 +1578,113 @@ function Ut({ isOpen: e, onClose: t }) {
|
|
|
1527
1578
|
/* @__PURE__ */ o("p", { className: "p-subtitle", children: "This should only take a few minutes." })
|
|
1528
1579
|
] }),
|
|
1529
1580
|
/* @__PURE__ */ b("div", { className: "panel-body flex-1 min-h-0 overflow-y-auto", children: [
|
|
1530
|
-
!l && /* @__PURE__ */ o(
|
|
1531
|
-
|
|
1581
|
+
!l && /* @__PURE__ */ o(Ue, { 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(
|
|
1582
|
+
Dt,
|
|
1532
1583
|
{
|
|
1533
1584
|
stages: r,
|
|
1534
|
-
initialValues:
|
|
1535
|
-
initialActive:
|
|
1536
|
-
onStageComplete: async (
|
|
1585
|
+
initialValues: _ ?? void 0,
|
|
1586
|
+
initialActive: S,
|
|
1587
|
+
onStageComplete: async (M, d) => {
|
|
1537
1588
|
try {
|
|
1538
|
-
const
|
|
1539
|
-
s(
|
|
1540
|
-
const w =
|
|
1589
|
+
const u = Ce(M), { stages: c } = await xe(), f = E(c);
|
|
1590
|
+
s(f);
|
|
1591
|
+
const w = f.findIndex((p) => p.key === d), $ = f[w], x = w + 1, y = (x < f.length ? f[x] : null)?.key || d;
|
|
1541
1592
|
if (n)
|
|
1542
|
-
if (
|
|
1543
|
-
const { isVerified:
|
|
1544
|
-
if (!
|
|
1593
|
+
if (d === "SMSVerification") {
|
|
1594
|
+
const { isVerified: p, token: m } = await Gt(n, u.sms_code);
|
|
1595
|
+
if (!p)
|
|
1545
1596
|
throw new Error("Invalid SMS code");
|
|
1546
|
-
|
|
1547
|
-
} else if (
|
|
1548
|
-
const { isSupported:
|
|
1549
|
-
if (!
|
|
1597
|
+
m && Pt(m), await de({ current_stage: y }, !1);
|
|
1598
|
+
} else if (d === "State") {
|
|
1599
|
+
const { isSupported: p } = await Yt(u.state);
|
|
1600
|
+
if (!p)
|
|
1550
1601
|
throw new Error("State is not supported");
|
|
1551
|
-
const
|
|
1552
|
-
await
|
|
1602
|
+
const m = pe();
|
|
1603
|
+
await de({ ...u, current_stage: y }, !1, m ? void 0 : n);
|
|
1553
1604
|
} else {
|
|
1554
|
-
const
|
|
1555
|
-
await
|
|
1605
|
+
const p = pe();
|
|
1606
|
+
await de({ ...u, current_stage: y }, !1, p ? void 0 : n || void 0);
|
|
1556
1607
|
}
|
|
1557
1608
|
else {
|
|
1558
|
-
const
|
|
1559
|
-
if (!
|
|
1560
|
-
throw new Error(`Failed to create quote - invalid quoteId returned: ${
|
|
1561
|
-
i(
|
|
1609
|
+
const m = (await Vt(u.phone))?.quoteId;
|
|
1610
|
+
if (!m || typeof m != "string" || m.trim() === "")
|
|
1611
|
+
throw new Error(`Failed to create quote - invalid quoteId returned: ${m}`);
|
|
1612
|
+
i(m), Lt(m), await de({ current_stage: y }, !1, m);
|
|
1562
1613
|
}
|
|
1563
|
-
return {
|
|
1564
|
-
|
|
1565
|
-
|
|
1614
|
+
return De({
|
|
1615
|
+
stageKey: d,
|
|
1616
|
+
stageTitle: $?.title ?? d,
|
|
1617
|
+
stepIndex: w + 1,
|
|
1618
|
+
totalSteps: f.length
|
|
1619
|
+
}), { success: !0 };
|
|
1620
|
+
} catch (u) {
|
|
1621
|
+
return { success: !1, error: u instanceof Error ? u.message : "An error occurred" };
|
|
1566
1622
|
}
|
|
1567
1623
|
},
|
|
1568
|
-
onComplete: async (
|
|
1624
|
+
onComplete: async (M) => {
|
|
1569
1625
|
try {
|
|
1570
|
-
const
|
|
1626
|
+
const d = Ce(M);
|
|
1571
1627
|
if (!n)
|
|
1572
1628
|
throw new Error("Quote ID is required");
|
|
1573
|
-
await
|
|
1574
|
-
const { rates:
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
return {
|
|
1629
|
+
await de(d, !0), v(M);
|
|
1630
|
+
const { rates: u } = await Ht();
|
|
1631
|
+
a(u);
|
|
1632
|
+
const c = r.length, f = r[c - 1];
|
|
1633
|
+
return De({
|
|
1634
|
+
stageKey: f?.key ?? "unknown",
|
|
1635
|
+
stageTitle: f?.title ?? "unknown",
|
|
1636
|
+
stepIndex: c,
|
|
1637
|
+
totalSteps: c
|
|
1638
|
+
}), Mt(), { success: !0 };
|
|
1639
|
+
} catch (d) {
|
|
1640
|
+
return { success: !1, error: d instanceof Error ? d.message : "An error occurred" };
|
|
1578
1641
|
}
|
|
1579
1642
|
}
|
|
1580
1643
|
}
|
|
1581
1644
|
) }),
|
|
1582
1645
|
" ",
|
|
1583
|
-
l && n && /* @__PURE__ */ o(
|
|
1646
|
+
l && n && /* @__PURE__ */ o(qt, { rates: l, onBack: () => a(null) })
|
|
1584
1647
|
] }),
|
|
1585
1648
|
/* @__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." }) })
|
|
1586
1649
|
] })
|
|
1587
1650
|
] }) : null;
|
|
1588
1651
|
}
|
|
1589
|
-
function
|
|
1652
|
+
function nn({ isOpen: e }) {
|
|
1590
1653
|
return /* @__PURE__ */ o(
|
|
1591
|
-
|
|
1654
|
+
tn,
|
|
1592
1655
|
{
|
|
1593
1656
|
isOpen: e,
|
|
1594
1657
|
onClose: () => {
|
|
1595
|
-
|
|
1658
|
+
qe.close();
|
|
1596
1659
|
}
|
|
1597
1660
|
}
|
|
1598
1661
|
);
|
|
1599
1662
|
}
|
|
1600
|
-
let
|
|
1601
|
-
function
|
|
1602
|
-
|
|
1663
|
+
let G = null, re = null, ge = !1;
|
|
1664
|
+
function rn() {
|
|
1665
|
+
G || (G = document.createElement("div"), G.id = "insurance-widget-root", document.documentElement.appendChild(G)), !re && G && (re = at(G));
|
|
1603
1666
|
}
|
|
1604
|
-
function
|
|
1605
|
-
|
|
1667
|
+
function ke() {
|
|
1668
|
+
rn(), re && re.render(it(nn, { isOpen: ge }));
|
|
1606
1669
|
}
|
|
1607
|
-
function
|
|
1608
|
-
re &&
|
|
1670
|
+
function sn() {
|
|
1671
|
+
re && G && (re.unmount(), G.remove()), re = null, G = null;
|
|
1609
1672
|
}
|
|
1610
|
-
const
|
|
1673
|
+
const qe = {
|
|
1611
1674
|
init: (e) => {
|
|
1612
|
-
|
|
1675
|
+
ge = !!e?.autoOpen, ke();
|
|
1613
1676
|
},
|
|
1614
1677
|
open: () => {
|
|
1615
|
-
|
|
1678
|
+
ge = !0, ke();
|
|
1616
1679
|
},
|
|
1617
1680
|
close: () => {
|
|
1618
|
-
|
|
1681
|
+
ge = !1, ke();
|
|
1619
1682
|
},
|
|
1620
|
-
destroy:
|
|
1683
|
+
destroy: sn
|
|
1621
1684
|
};
|
|
1622
|
-
typeof window < "u" && (window.CredifyInsuranceWidget =
|
|
1685
|
+
typeof window < "u" && (window.CredifyInsuranceWidget = qe);
|
|
1623
1686
|
export {
|
|
1624
|
-
|
|
1625
|
-
|
|
1687
|
+
qe as CredifyInsuranceWidget,
|
|
1688
|
+
qe as default
|
|
1626
1689
|
};
|
|
1627
1690
|
//# sourceMappingURL=index.es.js.map
|