@insforge/react 0.3.5 → 0.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/README.md +476 -604
  2. package/dist/atoms.cjs +837 -0
  3. package/dist/atoms.cjs.map +1 -0
  4. package/dist/atoms.d.cts +253 -0
  5. package/dist/atoms.d.ts +111 -245
  6. package/dist/atoms.js +412 -468
  7. package/dist/atoms.js.map +1 -1
  8. package/dist/components.cjs +2000 -0
  9. package/dist/components.cjs.map +1 -0
  10. package/dist/components.d.cts +258 -0
  11. package/dist/components.d.ts +71 -123
  12. package/dist/components.js +1040 -1428
  13. package/dist/components.js.map +1 -1
  14. package/dist/forms.cjs +1194 -0
  15. package/dist/forms.cjs.map +1 -0
  16. package/dist/forms.d.cts +135 -0
  17. package/dist/forms.d.ts +113 -163
  18. package/dist/forms.js +657 -943
  19. package/dist/forms.js.map +1 -1
  20. package/dist/{hooks.mjs → hooks.cjs} +15 -13
  21. package/dist/hooks.cjs.map +1 -0
  22. package/dist/{hooks.d.mts → hooks.d.cts} +1 -1
  23. package/dist/hooks.js +9 -15
  24. package/dist/hooks.js.map +1 -1
  25. package/dist/index.cjs +2461 -0
  26. package/dist/index.cjs.map +1 -0
  27. package/dist/{index.d.mts → index.d.cts} +37 -22
  28. package/dist/index.d.ts +34 -19
  29. package/dist/index.js +1142 -1497
  30. package/dist/index.js.map +1 -1
  31. package/dist/{lib.mjs → lib.cjs} +13 -11
  32. package/dist/lib.cjs.map +1 -0
  33. package/dist/{lib.d.mts → lib.d.cts} +1 -8
  34. package/dist/lib.d.ts +1 -8
  35. package/dist/lib.js +4 -17
  36. package/dist/lib.js.map +1 -1
  37. package/dist/{router.mjs → router.cjs} +14 -16
  38. package/dist/router.cjs.map +1 -0
  39. package/dist/{router.d.mts → router.d.cts} +0 -11
  40. package/dist/router.d.ts +0 -11
  41. package/dist/router.js +10 -16
  42. package/dist/router.js.map +1 -1
  43. package/dist/styles.css +864 -2
  44. package/dist/types.cjs +4 -0
  45. package/dist/{types.mjs.map → types.cjs.map} +1 -1
  46. package/dist/types.d.cts +32 -0
  47. package/dist/types.d.ts +11 -613
  48. package/dist/types.js +0 -1
  49. package/package.json +111 -98
  50. package/dist/atoms.d.mts +0 -387
  51. package/dist/atoms.mjs +0 -861
  52. package/dist/atoms.mjs.map +0 -1
  53. package/dist/components.d.mts +0 -310
  54. package/dist/components.mjs +0 -2327
  55. package/dist/components.mjs.map +0 -1
  56. package/dist/forms.d.mts +0 -185
  57. package/dist/forms.mjs +0 -1468
  58. package/dist/forms.mjs.map +0 -1
  59. package/dist/hooks.mjs.map +0 -1
  60. package/dist/index.mjs +0 -2724
  61. package/dist/index.mjs.map +0 -1
  62. package/dist/lib.mjs.map +0 -1
  63. package/dist/router.mjs.map +0 -1
  64. package/dist/types.d.mts +0 -634
  65. package/dist/types.mjs +0 -3
  66. package/src/styles.css +0 -15
package/dist/index.js CHANGED
@@ -5,38 +5,33 @@ if (typeof document !== 'undefined' && typeof window !== 'undefined') {
5
5
  if (!document.getElementById(styleId)) {
6
6
  const style = document.createElement('style');
7
7
  style.id = styleId;
8
- style.textContent = "/*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */\n@import \"https://fonts.googleapis.com/css2?family=Manrope:wght@200..800&display=swap\";@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-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--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;--tw-duration:initial;--tw-content:\"\"}}}@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-50:oklch(97.1% .013 17.38);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-green-100:oklch(96.2% .044 156.743);--color-green-400:oklch(79.2% .209 151.711);--color-green-600:oklch(62.7% .194 149.214);--color-green-900:oklch(39.3% .095 152.535);--color-blue-50:oklch(97% .014 254.604);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-blue-700:oklch(48.8% .243 264.376);--color-blue-900:oklch(37.9% .146 265.522);--color-indigo-50:oklch(96.2% .018 272.314);--color-indigo-600:oklch(51.1% .262 276.966);--color-indigo-700:oklch(45.7% .24 277.023);--color-purple-300:oklch(82.7% .119 306.383);--color-purple-500:oklch(62.7% .265 303.9);--color-purple-600:oklch(55.8% .288 302.321);--color-purple-700:oklch(49.6% .265 301.924);--color-purple-800:oklch(43.8% .218 303.724);--color-purple-900:oklch(38.1% .176 304.987);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-800:oklch(27.8% .033 256.848);--color-gray-900:oklch(21% .034 264.665);--color-neutral-100:oklch(97% 0 0);--color-neutral-400:oklch(70.8% 0 0);--color-neutral-600:oklch(43.9% 0 0);--color-neutral-800:oklch(26.9% 0 0);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-md:28rem;--container-lg:32rem;--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:calc(1.5/1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-2xl:1.5rem;--text-2xl--line-height:calc(2/1.5);--text-3xl:1.875rem;--text-3xl--line-height:calc(2.25/1.875);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--leading-normal:1.5;--leading-relaxed:1.625;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--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);--font-manrope:\"Manrope\",sans-serif}}@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;-webkit-text-decoration: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 components;@layer utilities{.absolute{position:absolute}.relative{position:relative}.top-1\\/2{top:50%}.top-full{top:100%}.right-0{right:calc(var(--spacing)*0)}.right-2{right:calc(var(--spacing)*2)}.z-50{z-index:50}.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-2{margin-top:calc(var(--spacing)*2)}.mt-3{margin-top:calc(var(--spacing)*3)}.mt-4{margin-top:calc(var(--spacing)*4)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline-block{display:inline-block}.h-3{height:calc(var(--spacing)*3)}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-6{height:calc(var(--spacing)*6)}.h-8{height:calc(var(--spacing)*8)}.h-9{height:calc(var(--spacing)*9)}.h-10{height:calc(var(--spacing)*10)}.h-12{height:calc(var(--spacing)*12)}.h-16{height:calc(var(--spacing)*16)}.h-\\[18px\\]{height:18px}.h-full{height:100%}.min-h-screen{min-height:100vh}.w-3{width:calc(var(--spacing)*3)}.w-4{width:calc(var(--spacing)*4)}.w-5{width:calc(var(--spacing)*5)}.w-6{width:calc(var(--spacing)*6)}.w-8{width:calc(var(--spacing)*8)}.w-10{width:calc(var(--spacing)*10)}.w-12{width:calc(var(--spacing)*12)}.w-16{width:calc(var(--spacing)*16)}.w-\\[18px\\]{width:18px}.w-full{width:100%}.max-w-\\[400px\\]{max-width:400px}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.min-w-40{min-width:calc(var(--spacing)*40)}.flex-1{flex:1}.flex-shrink-0,.shrink-0{flex-shrink:0}.-translate-y-1\\/2{--tw-translate-y:calc(calc(1/2*100%)*-1);translate:var(--tw-translate-x)var(--tw-translate-y)}.animate-spin{animation:var(--animate-spin)}.cursor-pointer{cursor:pointer}.grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-row{flex-direction:row}.items-center{align-items:center}.items-start{align-items:flex-start}.items-stretch{align-items:stretch}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-start{justify-content:flex-start}.gap-0{gap:calc(var(--spacing)*0)}.gap-0\\.5{gap:calc(var(--spacing)*.5)}.gap-1{gap:calc(var(--spacing)*1)}.gap-2{gap:calc(var(--spacing)*2)}.gap-2\\.5{gap:calc(var(--spacing)*2.5)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}.gap-6{gap:calc(var(--spacing)*6)}.self-stretch{align-self:stretch}.overflow-hidden{overflow:hidden}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-none{--tw-border-style:none;border-style:none}.border-\\[\\#D4D4D4\\]{border-color:#d4d4d4}.border-\\[\\#E0E0E0\\]{border-color:#e0e0e0}.border-\\[\\#E4E4E7\\]{border-color:#e4e4e7}.border-black{border-color:var(--color-black)}.border-blue-500{border-color:var(--color-blue-500)}.border-blue-600{border-color:var(--color-blue-600)}.border-gray-200{border-color:var(--color-gray-200)}.border-neutral-400{border-color:var(--color-neutral-400)}.border-purple-300{border-color:var(--color-purple-300)}.border-red-600{border-color:var(--color-red-600)}.border-transparent{border-color:#0000}.bg-\\[\\#059669\\]{background-color:#059669}.bg-\\[\\#FAFAFA\\]{background-color:#fafafa}.bg-black{background-color:var(--color-black)}.bg-blue-500{background-color:var(--color-blue-500)}.bg-blue-600{background-color:var(--color-blue-600)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-900{background-color:var(--color-gray-900)}.bg-green-100{background-color:var(--color-green-100)}.bg-indigo-600{background-color:var(--color-indigo-600)}.bg-neutral-100{background-color:var(--color-neutral-100)}.bg-purple-600{background-color:var(--color-purple-600)}.bg-red-50{background-color:var(--color-red-50)}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-blue-50{--tw-gradient-from:var(--color-blue-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-indigo-50{--tw-gradient-from:var(--color-indigo-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-white{--tw-gradient-to:var(--color-white);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.object-cover{object-fit:cover}.p-1{padding:calc(var(--spacing)*1)}.p-2{padding:calc(var(--spacing)*2)}.p-6{padding:calc(var(--spacing)*6)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.py-2{padding-block:calc(var(--spacing)*2)}.py-4{padding-block:calc(var(--spacing)*4)}.pt-4{padding-top:calc(var(--spacing)*4)}.pr-2{padding-right:calc(var(--spacing)*2)}.pr-8{padding-right:calc(var(--spacing)*8)}.pb-6{padding-bottom:calc(var(--spacing)*6)}.pl-3{padding-left:calc(var(--spacing)*3)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.font-manrope{font-family:var(--font-manrope)}.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-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.leading-4{--tw-leading:calc(var(--spacing)*4);line-height:calc(var(--spacing)*4)}.leading-5{--tw-leading:calc(var(--spacing)*5);line-height:calc(var(--spacing)*5)}.leading-6{--tw-leading:calc(var(--spacing)*6);line-height:calc(var(--spacing)*6)}.leading-8{--tw-leading:calc(var(--spacing)*8);line-height:calc(var(--spacing)*8)}.leading-normal{--tw-leading:var(--leading-normal);line-height:var(--leading-normal)}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.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-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.text-\\[\\#09090B\\]{color:#09090b}.text-\\[\\#525252\\]{color:#525252}.text-\\[\\#737373\\]{color:#737373}.text-\\[\\#828282\\]{color:#828282}.text-\\[\\#A3A3A3\\]{color:#a3a3a3}.text-\\[\\#A6A6A6\\]{color:#a6a6a6}.text-black{color:var(--color-black)}.text-blue-500{color:var(--color-blue-500)}.text-blue-900{color:var(--color-blue-900)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-800{color:var(--color-gray-800)}.text-gray-900{color:var(--color-gray-900)}.text-green-600{color:var(--color-green-600)}.text-neutral-600{color:var(--color-neutral-600)}.text-purple-600{color:var(--color-purple-600)}.text-purple-700{color:var(--color-purple-700)}.text-purple-900{color:var(--color-purple-900)}.text-red-500{color:var(--color-red-500)}.text-red-600{color:var(--color-red-600)}.text-white{color:var(--color-white)}.lowercase{text-transform:lowercase}.uppercase{text-transform:uppercase}.shadow{--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)}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\\[0_1px_2px_0_rgba\\(0\\,0\\,0\\,0\\.10\\)\\]{--tw-shadow:0 1px 2px 0 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-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)}.transition-all{transition-property:all;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))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.outline-none{--tw-outline-style:none;outline-style:none}.placeholder\\:font-normal::placeholder{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.placeholder\\:text-\\[\\#A3A3A3\\]::placeholder{color:#a3a3a3}.before\\:h-px:before{content:var(--tw-content);height:1px}.before\\:flex-1:before{content:var(--tw-content);flex:1}.before\\:bg-\\[\\#E5E5E5\\]:before{content:var(--tw-content);background-color:#e5e5e5}.before\\:content-\\[\\'\\'\\]:before{--tw-content:\"\";content:var(--tw-content)}.after\\:h-px:after{content:var(--tw-content);height:1px}.after\\:flex-1:after{content:var(--tw-content);flex:1}.after\\:bg-\\[\\#E5E5E5\\]:after{content:var(--tw-content);background-color:#e5e5e5}.after\\:content-\\[\\'\\'\\]:after{--tw-content:\"\";content:var(--tw-content)}@media (hover:hover){.hover\\:border-\\[\\#9ca3af\\]:hover{border-color:#9ca3af}.hover\\:bg-\\[\\#f9fafb\\]:hover{background-color:#f9fafb}.hover\\:bg-black\\/5:hover{background-color:#0000000d}@supports (color:color-mix(in lab, red, red)){.hover\\:bg-black\\/5:hover{background-color:color-mix(in oklab,var(--color-black)5%,transparent)}}.hover\\:bg-blue-50:hover{background-color:var(--color-blue-50)}.hover\\:bg-blue-700:hover{background-color:var(--color-blue-700)}.hover\\:bg-gray-50:hover{background-color:var(--color-gray-50)}.hover\\:bg-gray-800:hover{background-color:var(--color-gray-800)}.hover\\:bg-indigo-700:hover{background-color:var(--color-indigo-700)}.hover\\:bg-purple-700:hover{background-color:var(--color-purple-700)}.hover\\:bg-red-50:hover{background-color:var(--color-red-50)}.hover\\:bg-white\\/10:hover{background-color:#ffffff1a}@supports (color:color-mix(in lab, red, red)){.hover\\:bg-white\\/10:hover{background-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.hover\\:text-gray-600:hover{color:var(--color-gray-600)}.hover\\:text-purple-800:hover{color:var(--color-purple-800)}.hover\\:underline:hover{text-decoration-line:underline}}.focus\\:border-black:focus{border-color:var(--color-black)}.focus\\:border-purple-500:focus{border-color:var(--color-purple-500)}.focus\\:shadow-\\[0_0_0_2px_rgba\\(0\\,0\\,0\\,0\\.1\\)\\]:focus{--tw-shadow:0 0 0 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\\:ring-blue-500:focus{--tw-ring-color:var(--color-blue-500)}.focus\\:outline-none:focus{--tw-outline-style:none;outline-style:none}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:bg-\\[\\#F5F5F5\\]:disabled{background-color:#f5f5f5}.disabled\\:no-underline:disabled{text-decoration-line:none}.disabled\\:opacity-50:disabled{opacity:.5}.disabled\\:opacity-60:disabled{opacity:.6}@media (prefers-color-scheme:dark){.dark\\:border-white{border-color:var(--color-white)}.dark\\:bg-green-900{background-color:var(--color-green-900)}.dark\\:bg-neutral-800{background-color:var(--color-neutral-800)}.dark\\:text-gray-400{color:var(--color-gray-400)}.dark\\:text-green-400{color:var(--color-green-400)}.dark\\:text-neutral-400{color:var(--color-neutral-400)}.dark\\:text-white{color:var(--color-white)}}}@property --tw-translate-x{syntax:\"*\";inherits:false;initial-value:0}@property --tw-translate-y{syntax:\"*\";inherits:false;initial-value:0}@property --tw-translate-z{syntax:\"*\";inherits:false;initial-value:0}@property --tw-border-style{syntax:\"*\";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:\"*\";inherits:false}@property --tw-gradient-from{syntax:\"<color>\";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:\"<color>\";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:\"<color>\";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:\"*\";inherits:false}@property --tw-gradient-via-stops{syntax:\"*\";inherits:false}@property --tw-gradient-from-position{syntax:\"<length-percentage>\";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:\"<length-percentage>\";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:\"<length-percentage>\";inherits:false;initial-value:100%}@property --tw-leading{syntax:\"*\";inherits:false}@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}@property --tw-duration{syntax:\"*\";inherits:false}@property --tw-content{syntax:\"*\";inherits:false;initial-value:\"\"}@keyframes spin{to{transform:rotate(360deg)}}";
8
+ style.textContent = "/**\n * InsForge React Component Library Styles\n * Traditional CSS with scoped class names (no Tailwind)\n */\n\n/* ============================================\n FONTS\n ============================================ */\n@import url('https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap');\n@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@200..800&display=swap');\n\n/* ============================================\n CSS VARIABLES\n ============================================ */\n:root {\n /* Colors */\n --if-color-primary: #000000;\n --if-color-primary-hover: #1f1f1f;\n --if-color-text: #000000;\n --if-color-text-secondary: #828282;\n --if-color-text-muted: #a3a3a3;\n --if-color-border: #d4d4d4;\n --if-color-border-focus: #000000;\n --if-color-bg-white: #ffffff;\n --if-color-bg-light: #fafafa;\n --if-color-bg-hover: #f9fafb;\n --if-color-error: #dc2626;\n --if-color-error-bg: #fee2e2;\n --if-color-success: #16a34a;\n\n /* Spacing */\n --if-space-1: 0.25rem; /* 4px */\n --if-space-2: 0.5rem; /* 8px */\n --if-space-3: 0.75rem; /* 12px */\n --if-space-4: 1rem; /* 16px */\n --if-space-6: 1.5rem; /* 24px */\n --if-space-8: 2rem; /* 32px */\n\n /* Border Radius */\n --if-radius-xs: 0.125rem; /* 2px */\n --if-radius-sm: 0.25rem; /* 4px */\n --if-radius-md: 0.375rem; /* 6px */\n --if-radius-lg: 0.5rem; /* 8px */\n --if-radius-xl: 0.75rem; /* 12px */\n\n /* Typography */\n --if-font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;\n --if-font-family-manrope:\n 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;\n --if-font-size-xs: 0.75rem; /* 12px */\n --if-font-size-sm: 0.875rem; /* 14px */\n --if-font-size-base: 1rem; /* 16px */\n --if-font-size-lg: 1.125rem; /* 18px */\n --if-font-size-xl: 1.25rem; /* 20px */\n --if-font-size-2xl: 1.5rem; /* 24px */\n\n /* Shadows */\n --if-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n --if-shadow-md: 0 1px 2px 0 rgba(0, 0, 0, 0.1);\n --if-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);\n\n /* Transitions */\n --if-transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);\n --if-transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);\n}\n\n/* ============================================\n AUTH CONTAINER\n ============================================ */\n.if-authContainer {\n width: 100%;\n max-width: 400px;\n border-radius: var(--if-radius-xl);\n overflow: hidden;\n box-shadow: var(--if-shadow-lg);\n}\n\n.if-authCard {\n background-color: var(--if-color-bg-white);\n padding: var(--if-space-6);\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: stretch;\n gap: var(--if-space-6);\n}\n\n/* ============================================\n AUTH HEADER\n ============================================ */\n.if-authHeader {\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n align-items: flex-start;\n gap: var(--if-space-2);\n}\n\n.if-authHeader-title {\n font-size: var(--if-font-size-2xl);\n font-weight: 600;\n color: var(--if-color-text);\n line-height: 2rem;\n margin: 0;\n font-family: var(--if-font-family);\n}\n\n.if-authHeader-subtitle {\n font-size: var(--if-font-size-sm);\n font-weight: 400;\n color: var(--if-color-text-secondary);\n line-height: 1.5rem;\n margin: 0;\n font-family: var(--if-font-family);\n}\n\n/* ============================================\n FORM FIELD\n ============================================ */\n.if-formField {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: stretch;\n gap: var(--if-space-1);\n}\n\n.if-formField-label {\n font-size: var(--if-font-size-sm);\n font-weight: 400;\n color: var(--if-color-text);\n line-height: 1.5rem;\n font-family: var(--if-font-family);\n}\n\n.if-formField-input {\n width: 100%;\n display: flex;\n align-items: center;\n gap: var(--if-space-2);\n align-self: stretch;\n padding: var(--if-space-2) var(--if-space-3);\n border-radius: var(--if-radius-sm);\n border: 1px solid var(--if-color-border);\n background-color: var(--if-color-bg-white);\n font-size: var(--if-font-size-sm);\n font-weight: 400;\n line-height: 1.25rem;\n color: var(--if-color-text);\n font-family: var(--if-font-family);\n transition: border-color var(--if-transition-base);\n}\n\n.if-formField-input::placeholder {\n color: var(--if-color-text-muted);\n font-size: var(--if-font-size-sm);\n font-weight: 400;\n}\n\n.if-formField-input:focus {\n outline: none;\n border-color: var(--if-color-border-focus);\n}\n\n/* ============================================\n PASSWORD FIELD\n ============================================ */\n.if-passwordField {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: stretch;\n gap: var(--if-space-1);\n}\n\n.if-passwordField-labelRow {\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n.if-passwordField-label {\n font-size: var(--if-font-size-sm);\n font-weight: 400;\n color: var(--if-color-text);\n line-height: 1.5rem;\n font-family: var(--if-font-family);\n}\n\n.if-passwordField-forgotLink {\n font-size: var(--if-font-size-sm);\n font-weight: 400;\n color: var(--if-color-text-secondary);\n text-decoration: none;\n transition: color var(--if-transition-fast);\n font-family: var(--if-font-family);\n}\n\n.if-passwordField-inputWrapper {\n position: relative;\n width: 100%;\n}\n\n.if-passwordField-input {\n width: 100%;\n display: flex;\n align-items: center;\n align-self: stretch;\n padding: var(--if-space-2) var(--if-space-3);\n padding-right: 2.5rem; /* Space for toggle button */\n border-radius: var(--if-radius-sm);\n border: 1px solid var(--if-color-border);\n background-color: var(--if-color-bg-white);\n font-size: var(--if-font-size-sm);\n font-weight: 400;\n line-height: 1.25rem;\n color: var(--if-color-text);\n font-family: var(--if-font-family);\n transition: border-color var(--if-transition-base);\n}\n\n.if-passwordField-input::placeholder {\n color: var(--if-color-text-muted);\n}\n\n.if-passwordField-input:focus {\n outline: none;\n border-color: var(--if-color-border-focus);\n}\n\n.if-passwordField-toggleButton {\n position: absolute;\n right: var(--if-space-1);\n top: 50%;\n transform: translateY(-50%);\n background: none;\n border: none;\n cursor: pointer;\n padding: var(--if-space-1);\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--if-color-text-secondary);\n transition: color var(--if-transition-fast);\n}\n\n/* ============================================\n SUBMIT BUTTON\n ============================================ */\n.if-submitButton {\n border-radius: var(--if-radius-sm);\n background-color: var(--if-color-primary);\n height: 2.5rem;\n width: 100%;\n display: flex;\n margin-top: var(--if-space-4);\n padding: var(--if-space-2) var(--if-space-4);\n justify-content: center;\n align-items: center;\n gap: 0.625rem;\n align-self: stretch;\n color: var(--if-color-bg-white);\n font-weight: 600;\n font-family: var(--if-font-family-manrope);\n font-size: var(--if-font-size-base);\n line-height: normal;\n border: none;\n cursor: pointer;\n transition: background-color var(--if-transition-base);\n}\n\n.if-submitButton:hover:not(:disabled) {\n background-color: var(--if-color-primary-hover);\n}\n\n.if-submitButton:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.if-submitButton-icon {\n width: 1.25rem;\n height: 1.25rem;\n}\n\n/* Spinner animation */\n@keyframes if-spin {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}\n\n.if-submitButton-spinner {\n animation: if-spin 1s linear infinite;\n}\n\n/* ============================================\n OAUTH BUTTON\n ============================================ */\n.if-oauthButton {\n display: flex;\n width: 100%;\n height: 2.25rem;\n padding: var(--if-space-2) var(--if-space-3);\n flex-direction: row;\n justify-content: center;\n align-items: center;\n gap: var(--if-space-3);\n border-radius: var(--if-radius-md);\n border: 1px solid #e4e4e7;\n background-color: var(--if-color-bg-white);\n box-shadow: var(--if-shadow-md);\n color: #09090b;\n text-align: center;\n font-size: var(--if-font-size-sm);\n font-weight: 500;\n line-height: 1.25rem;\n cursor: pointer;\n transition: all var(--if-transition-base);\n font-family: var(--if-font-family);\n}\n\n.if-oauthButton:hover:not(:disabled) {\n background-color: var(--if-color-bg-hover);\n border-color: #9ca3af;\n}\n\n.if-oauthButton:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n}\n\n.if-oauthButton-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n width: 1.125rem;\n height: 1.125rem;\n}\n\n.if-oauthButton-full {\n justify-content: center;\n}\n\n.if-oauthButton-short {\n justify-content: center;\n padding: var(--if-space-2);\n gap: var(--if-space-2);\n}\n\n.if-oauthButton-icon-only {\n justify-content: center;\n gap: 0;\n}\n\n/* ============================================\n OAUTH PROVIDERS CONTAINER\n ============================================ */\n.if-oauthProviders {\n display: flex;\n flex-direction: column;\n gap: var(--if-space-3);\n width: 100%;\n}\n\n/* ============================================\n AUTH LINK\n ============================================ */\n.if-authLink {\n display: flex;\n justify-content: center;\n align-items: center;\n gap: var(--if-space-1);\n font-size: var(--if-font-size-sm);\n color: var(--if-color-text-secondary);\n font-family: var(--if-font-family);\n}\n\n.if-authLink-text {\n font-weight: 400;\n}\n\n.if-authLink-link {\n font-weight: 600;\n color: var(--if-color-text);\n text-decoration: none;\n transition: opacity var(--if-transition-fast);\n}\n\n/* ============================================\n AUTH DIVIDER\n ============================================ */\n.if-authDivider {\n display: flex;\n align-items: center;\n text-align: center;\n width: 100%;\n gap: var(--if-space-3);\n}\n\n.if-authDivider-line {\n flex: 1;\n border-top: 1px solid var(--if-color-border);\n}\n\n.if-authDivider-text {\n font-size: var(--if-font-size-sm);\n color: var(--if-color-text-secondary);\n font-weight: 400;\n font-family: var(--if-font-family-manrope);\n}\n\n/* ============================================\n ERROR BANNER\n ============================================ */\n.if-errorBanner {\n padding: var(--if-space-3);\n background-color: var(--if-color-error-bg);\n border-radius: var(--if-radius-md);\n border: 1px solid var(--if-color-error);\n}\n\n.if-errorBanner-content {\n display: flex;\n align-items: center;\n gap: var(--if-space-2);\n}\n\n.if-errorBanner-icon {\n width: 1.5rem;\n height: 1.5rem;\n flex-shrink: 0;\n color: var(--if-color-error);\n}\n\n.if-errorBanner-text {\n font-size: var(--if-font-size-sm);\n color: var(--if-color-error);\n font-weight: 400;\n font-family: var(--if-font-family);\n margin: 0;\n}\n\n/* ============================================\n AUTH BRANDING\n ============================================ */\n.if-authBranding {\n background-color: var(--if-color-bg-light);\n padding: var(--if-space-4) var(--if-space-2);\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n gap: var(--if-space-1);\n}\n\n.if-authBranding-text {\n font-size: var(--if-font-size-xs);\n font-weight: 500;\n color: var(--if-color-text);\n font-family: var(--if-font-family-manrope);\n margin: 0;\n}\n\n/* ============================================\n VERIFICATION CODE INPUT\n ============================================ */\n.if-verificationCode {\n display: flex;\n flex-direction: column;\n gap: var(--if-space-4);\n}\n\n.if-verificationCode-description {\n font-size: var(--if-font-size-sm);\n color: var(--if-color-text-secondary);\n text-align: center;\n font-family: var(--if-font-family);\n}\n\n.if-verificationCode-email {\n font-weight: 600;\n color: var(--if-color-text);\n}\n\n.if-verificationCode-inputContainer {\n display: flex;\n gap: var(--if-space-2);\n justify-content: center;\n}\n\n.if-verificationCode-input {\n width: 3rem;\n height: 3rem;\n text-align: center;\n font-size: var(--if-font-size-xl);\n font-weight: 600;\n border: 2px solid var(--if-color-border);\n border-radius: var(--if-radius-md);\n transition: border-color var(--if-transition-base);\n font-family: var(--if-font-family);\n}\n\n.if-verificationCode-input:focus {\n outline: none;\n border-color: var(--if-color-border-focus);\n}\n\n/* ============================================\n VERIFICATION STEP\n ============================================ */\n.if-verificationStep {\n display: flex;\n flex-direction: column;\n gap: var(--if-space-6);\n align-items: stretch;\n}\n\n.if-verificationStep-description {\n font-size: var(--if-font-size-sm);\n color: var(--if-color-text-secondary);\n text-align: center;\n margin: 0;\n font-family: var(--if-font-family);\n}\n\n.if-verificationStep-codeContainer {\n width: 100%;\n background-color: #f5f5f5;\n border-radius: var(--if-radius-lg);\n padding: var(--if-space-4) var(--if-space-4) var(--if-space-6);\n display: flex;\n flex-direction: column;\n gap: var(--if-space-4);\n}\n\n.if-verificationStep-codeInputWrapper {\n display: flex;\n flex-direction: column;\n gap: var(--if-space-3);\n margin-top: var(--if-space-2);\n}\n\n.if-verificationStep-verifyingText {\n font-size: var(--if-font-size-sm);\n color: var(--if-color-text-secondary);\n text-align: center;\n font-family: var(--if-font-family);\n}\n\n.if-verificationStep-resendContainer {\n width: 100%;\n font-size: var(--if-font-size-sm);\n text-align: center;\n color: var(--if-color-text-secondary);\n font-family: var(--if-font-family);\n}\n\n.if-verificationStep-resendButton {\n color: var(--if-color-text);\n font-weight: 500;\n transition: all var(--if-transition-base);\n background: none;\n border: none;\n padding: 0;\n font-family: var(--if-font-family);\n font-size: var(--if-font-size-sm);\n}\n\n.if-verificationStep-resendButton:not(:disabled) {\n cursor: pointer;\n text-decoration: underline;\n}\n\n.if-verificationStep-resendButton:disabled {\n cursor: not-allowed;\n text-decoration: none;\n opacity: 0.5;\n}\n\n/* ============================================\n PASSWORD STRENGTH INDICATOR\n ============================================ */\n.if-passwordStrength {\n margin-top: var(--if-space-2);\n}\n\n.if-passwordStrength-bar {\n height: 4px;\n background-color: #e5e7eb;\n border-radius: 2px;\n overflow: hidden;\n margin-bottom: var(--if-space-2);\n}\n\n.if-passwordStrength-fill {\n height: 100%;\n transition:\n width var(--if-transition-base),\n background-color var(--if-transition-base);\n}\n\n.if-passwordStrength-fill.weak {\n background-color: #ef4444;\n width: 33%;\n}\n\n.if-passwordStrength-fill.medium {\n background-color: #f59e0b;\n width: 66%;\n}\n\n.if-passwordStrength-fill.strong {\n background-color: var(--if-color-success);\n width: 100%;\n}\n\n.if-passwordStrength-text {\n font-size: var(--if-font-size-xs);\n color: var(--if-color-text-secondary);\n font-family: var(--if-font-family);\n}\n\n.if-passwordStrength-requirements {\n margin-top: var(--if-space-2);\n font-size: var(--if-font-size-xs);\n color: var(--if-color-text-secondary);\n font-family: var(--if-font-family);\n}\n\n.if-passwordStrength-requirement {\n display: flex;\n align-items: center;\n gap: var(--if-space-1);\n margin-bottom: var(--if-space-1);\n}\n\n.if-passwordStrength-requirement.met {\n color: var(--if-color-success);\n}\n\n.if-passwordStrength-requirement.unmet {\n color: var(--if-color-text-muted);\n}\n\n/* ============================================\n FORM CONTAINER\n ============================================ */\n.if-form {\n display: flex;\n flex-direction: column;\n align-items: stretch;\n justify-content: center;\n gap: var(--if-space-6);\n}\n\n/* ============================================\n USER BUTTON\n ============================================ */\n.if-userButton-container {\n position: relative;\n display: inline-block;\n}\n\n.if-userButton {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: var(--if-space-2);\n padding: var(--if-space-2);\n border-radius: 9999px;\n background-color: transparent;\n border: none;\n cursor: pointer;\n transition: all var(--if-transition-base);\n}\n\n.if-userButton:hover {\n opacity: 0.8;\n}\n\n.if-userButton-detailed {\n background-color: var(--if-color-bg-white);\n border: 1px solid var(--if-color-border);\n border-radius: var(--if-radius-sm);\n padding: var(--if-space-2);\n}\n\n.if-userButton-detailed:hover {\n background-color: var(--if-color-bg-light);\n opacity: 1;\n}\n\n.if-userButton-avatar {\n width: 2rem;\n height: 2rem;\n border-radius: 9999px;\n background-color: var(--if-color-primary);\n color: var(--if-color-bg-white);\n display: flex;\n align-items: center;\n justify-content: center;\n font-weight: 600;\n font-size: var(--if-font-size-sm);\n font-family: var(--if-font-family);\n overflow: hidden;\n}\n\n.if-userButton-avatarImage {\n border-radius: 9999px;\n object-fit: cover;\n width: 100%;\n height: 100%;\n}\n\n.if-userButton-avatarInitials {\n color: var(--if-color-bg-white);\n font-weight: 600;\n font-size: var(--if-font-size-sm);\n}\n\n.if-userButton-info {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 0.125rem;\n}\n\n.if-userButton-name {\n font-size: var(--if-font-size-sm);\n font-weight: 600;\n color: var(--if-color-text);\n line-height: 1.25rem;\n text-align: left;\n font-family: var(--if-font-family);\n}\n\n.if-userButton-email {\n font-size: var(--if-font-size-xs);\n color: var(--if-color-text-secondary);\n line-height: 1rem;\n text-align: left;\n font-family: var(--if-font-family);\n}\n\n.if-userButton-menu {\n position: absolute;\n margin-top: var(--if-space-2);\n background-color: var(--if-color-bg-white);\n border: 1px solid var(--if-color-border);\n border-radius: var(--if-radius-md);\n box-shadow: var(--if-shadow-lg);\n padding: var(--if-space-2);\n min-width: 200px;\n z-index: 50;\n}\n\n.if-userButton-menuItem {\n display: flex;\n align-items: center;\n gap: var(--if-space-2);\n padding: var(--if-space-2);\n border-radius: var(--if-radius-sm);\n cursor: pointer;\n transition: background-color var(--if-transition-fast);\n font-size: var(--if-font-size-sm);\n color: var(--if-color-text);\n font-family: var(--if-font-family);\n background: none;\n border: none;\n width: 100%;\n text-align: left;\n}\n\n.if-userButton-menuItem:hover {\n background-color: var(--if-color-bg-light);\n}\n\n.if-userButton-menuItem-signout {\n color: var(--if-color-error);\n}\n\n.if-userButton-menuItem-icon {\n width: 1.25rem;\n height: 1.25rem;\n}\n\n/* ============================================\n EMAIL VERIFICATION STATUS\n ============================================ */\n.if-verifyStatus-container {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: var(--if-space-6);\n}\n\n.if-verifyStatus-container-stretch {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: stretch;\n justify-content: center;\n gap: var(--if-space-6);\n}\n\n.if-verifyStatus-spinner {\n border-radius: 9999px;\n height: 3rem;\n width: 3rem;\n border-bottom: 2px solid var(--if-color-primary);\n}\n\n.if-verifyStatus-successContent {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: var(--if-space-4);\n}\n\n.if-verifyStatus-successIcon {\n width: 4rem;\n height: 4rem;\n border-radius: 9999px;\n background-color: #d1fae5;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.if-verifyStatus-successIconSvg {\n width: 2rem;\n height: 2rem;\n color: #059669;\n}\n\n.if-verifyStatus-textCenter {\n text-align: center;\n}\n\n/* ============================================\n UTILITY CLASSES\n ============================================ */\n.if-hidden {\n display: none;\n}\n\n.if-visuallyHidden {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n}\n";
9
9
  if (document.head) {
10
10
  document.head.appendChild(style);
11
11
  }
12
12
  }
13
13
  }
14
14
 
15
- 'use strict';
15
+ import { createContext, useState, useRef, useCallback, useEffect, useContext } from 'react';
16
+ import { useSearchParams } from 'react-router-dom';
17
+ import { createClient } from '@insforge/sdk';
18
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
19
+ import { AlertTriangle, Check, EyeOff, Eye, Loader2, CircleCheck, LogOut } from 'lucide-react';
20
+ import { z } from 'zod';
16
21
 
17
- var react = require('react');
18
- var sdk = require('@insforge/sdk');
19
- var jsxRuntime = require('react/jsx-runtime');
20
- var clsx = require('clsx');
21
- var tailwindMerge = require('tailwind-merge');
22
- var lucideReact = require('lucide-react');
23
- var zod = require('zod');
24
-
25
- var InsforgeContext = react.createContext(
26
- void 0
27
- );
22
+ var InsforgeContext = createContext(void 0);
28
23
  function InsforgeProvider({
29
24
  children,
30
25
  baseUrl,
31
26
  onAuthChange,
32
- syncTokenToCookie,
33
- clearCookie
27
+ onSignIn,
28
+ onSignOut
34
29
  }) {
35
- const [user, setUser] = react.useState(null);
36
- const [isLoaded, setIsLoaded] = react.useState(false);
37
- const refreshIntervalRef = react.useRef(null);
38
- const [insforge] = react.useState(() => sdk.createClient({ baseUrl }));
39
- const loadAuthState = react.useCallback(async () => {
30
+ const [user, setUser] = useState(null);
31
+ const [isLoaded, setIsLoaded] = useState(false);
32
+ const refreshIntervalRef = useRef(null);
33
+ const [insforge] = useState(() => createClient({ baseUrl }));
34
+ const loadAuthState = useCallback(async () => {
40
35
  try {
41
36
  const sessionResult = insforge.auth.getCurrentSession();
42
37
  const session = sessionResult.data?.session;
@@ -66,10 +61,13 @@ function InsforgeProvider({
66
61
  return { success: true };
67
62
  } else {
68
63
  await insforge.auth.signOut();
69
- if (clearCookie) {
64
+ if (onSignOut) {
70
65
  try {
71
- await clearCookie();
66
+ await onSignOut();
72
67
  } catch (error) {
68
+ if (error instanceof Error) {
69
+ console.error("[InsforgeProvider] Error clearing cookie:", error.message);
70
+ }
73
71
  }
74
72
  }
75
73
  setUser(null);
@@ -82,10 +80,13 @@ function InsforgeProvider({
82
80
  } catch (error) {
83
81
  console.error("[InsforgeProvider] Token validation failed:", error);
84
82
  await insforge.auth.signOut();
85
- if (clearCookie) {
83
+ if (onSignOut) {
86
84
  try {
87
- await clearCookie();
85
+ await onSignOut();
88
86
  } catch (error2) {
87
+ if (error2 instanceof Error) {
88
+ console.error("[InsforgeProvider] Error clearing cookie:", error2.message);
89
+ }
89
90
  }
90
91
  }
91
92
  setUser(null);
@@ -95,19 +96,20 @@ function InsforgeProvider({
95
96
  setIsLoaded(true);
96
97
  return {
97
98
  success: false,
98
- error: error instanceof Error ? error.message : "authentication_failed"
99
+ error: error instanceof Error ? error.message : "Authentication failed"
99
100
  };
100
101
  }
101
- }, [insforge, onAuthChange, syncTokenToCookie, clearCookie]);
102
- react.useEffect(() => {
102
+ }, [insforge, onAuthChange, onSignOut]);
103
+ useEffect(() => {
103
104
  loadAuthState();
105
+ const intervalId = refreshIntervalRef.current;
104
106
  return () => {
105
- if (refreshIntervalRef.current) {
106
- clearInterval(refreshIntervalRef.current);
107
+ if (intervalId) {
108
+ clearInterval(intervalId);
107
109
  }
108
110
  };
109
- }, []);
110
- const getPublicAuthConfig = react.useCallback(async () => {
111
+ }, [loadAuthState]);
112
+ const getPublicAuthConfig = useCallback(async () => {
111
113
  try {
112
114
  const result = await insforge.auth.getPublicAuthConfig();
113
115
  if (result.data) {
@@ -117,14 +119,11 @@ function InsforgeProvider({
117
119
  return null;
118
120
  }
119
121
  } catch (error) {
120
- console.error(
121
- "[InsforgeProvider] Failed to get public auth config:",
122
- error
123
- );
122
+ console.error("[InsforgeProvider] Failed to get public auth config:", error);
124
123
  return null;
125
124
  }
126
125
  }, [insforge]);
127
- const handleAuthSuccess = react.useCallback(
126
+ const handleAuthSuccess = useCallback(
128
127
  async (authToken, fallbackUser) => {
129
128
  const userResult = await insforge.auth.getCurrentUser();
130
129
  if (userResult.data) {
@@ -139,10 +138,13 @@ function InsforgeProvider({
139
138
  if (onAuthChange) {
140
139
  onAuthChange(userData);
141
140
  }
142
- if (syncTokenToCookie) {
141
+ if (onSignIn) {
143
142
  try {
144
- await syncTokenToCookie(authToken);
143
+ await onSignIn(authToken);
145
144
  } catch (error) {
145
+ if (error instanceof Error) {
146
+ console.error("[InsforgeProvider] Error syncing token to cookie:", error.message);
147
+ }
146
148
  }
147
149
  }
148
150
  } else if (fallbackUser) {
@@ -158,9 +160,9 @@ function InsforgeProvider({
158
160
  }
159
161
  }
160
162
  },
161
- [insforge, onAuthChange, syncTokenToCookie]
163
+ [insforge, onAuthChange, onSignIn]
162
164
  );
163
- const signIn = react.useCallback(
165
+ const signIn = useCallback(
164
166
  async (email, password) => {
165
167
  const sdkResult = await insforge.auth.signInWithPassword({
166
168
  email,
@@ -186,7 +188,7 @@ function InsforgeProvider({
186
188
  },
187
189
  [insforge, handleAuthSuccess]
188
190
  );
189
- const signUp = react.useCallback(
191
+ const signUp = useCallback(
190
192
  async (email, password) => {
191
193
  const sdkResult = await insforge.auth.signUp({ email, password });
192
194
  if (sdkResult.data) {
@@ -211,12 +213,15 @@ function InsforgeProvider({
211
213
  },
212
214
  [insforge, handleAuthSuccess]
213
215
  );
214
- const signOut = react.useCallback(async () => {
216
+ const signOut = useCallback(async () => {
215
217
  await insforge.auth.signOut();
216
- if (clearCookie) {
218
+ if (onSignOut) {
217
219
  try {
218
- await clearCookie();
220
+ await onSignOut();
219
221
  } catch (error) {
222
+ if (error instanceof Error) {
223
+ console.error("[InsforgeProvider] Error clearing cookie:", error.message);
224
+ }
220
225
  }
221
226
  }
222
227
  if (refreshIntervalRef.current) {
@@ -226,10 +231,12 @@ function InsforgeProvider({
226
231
  if (onAuthChange) {
227
232
  onAuthChange(null);
228
233
  }
229
- }, [insforge, onAuthChange, clearCookie]);
230
- const updateUser = react.useCallback(
234
+ }, [insforge, onAuthChange, onSignOut]);
235
+ const updateUser = useCallback(
231
236
  async (data) => {
232
- if (!user) throw new Error("No user signed in");
237
+ if (!user) {
238
+ throw new Error("No user signed in");
239
+ }
233
240
  const profileUpdate = {
234
241
  nickname: data.name,
235
242
  avatarUrl: data.avatarUrl
@@ -254,14 +261,21 @@ function InsforgeProvider({
254
261
  },
255
262
  [user, onAuthChange, insforge]
256
263
  );
257
- const sendResetPasswordEmail = react.useCallback(
264
+ const sendVerificationEmail = useCallback(
265
+ async (email) => {
266
+ const sdkResult = await insforge.auth.sendVerificationEmail({ email });
267
+ return sdkResult.data;
268
+ },
269
+ [insforge]
270
+ );
271
+ const sendResetPasswordEmail = useCallback(
258
272
  async (email) => {
259
273
  const sdkResult = await insforge.auth.sendResetPasswordEmail({ email });
260
274
  return sdkResult.data;
261
275
  },
262
276
  [insforge]
263
277
  );
264
- const resetPassword = react.useCallback(
278
+ const resetPassword = useCallback(
265
279
  async (token, newPassword) => {
266
280
  const sdkResult = await insforge.auth.resetPassword({
267
281
  newPassword,
@@ -271,14 +285,45 @@ function InsforgeProvider({
271
285
  },
272
286
  [insforge]
273
287
  );
274
- const verifyEmail = react.useCallback(
275
- async (token) => {
276
- const sdkResult = await insforge.auth.verifyEmail({ otp: token });
288
+ const verifyEmail = useCallback(
289
+ async (otp, email) => {
290
+ const sdkResult = await insforge.auth.verifyEmail({ otp, email: email || void 0 });
291
+ if (sdkResult.data) {
292
+ return sdkResult.data;
293
+ } else {
294
+ return {
295
+ accessToken: "",
296
+ error: {
297
+ message: sdkResult.error?.message || "Email verification failed"
298
+ }
299
+ };
300
+ }
301
+ },
302
+ [insforge]
303
+ );
304
+ const exchangeResetPasswordToken = useCallback(
305
+ async (email, code) => {
306
+ const sdkResult = await insforge.auth.exchangeResetPasswordToken({ email, code });
307
+ if (sdkResult.data) {
308
+ return sdkResult.data;
309
+ } else {
310
+ return {
311
+ error: {
312
+ message: sdkResult.error?.message || "Failed to exchange reset password token"
313
+ }
314
+ };
315
+ }
316
+ },
317
+ [insforge]
318
+ );
319
+ const loginWithOAuth = useCallback(
320
+ async (provider, redirectTo) => {
321
+ const sdkResult = await insforge.auth.signInWithOAuth({ provider, redirectTo });
277
322
  return sdkResult.data;
278
323
  },
279
324
  [insforge]
280
325
  );
281
- return /* @__PURE__ */ jsxRuntime.jsx(
326
+ return /* @__PURE__ */ jsx(
282
327
  InsforgeContext.Provider,
283
328
  {
284
329
  value: {
@@ -292,17 +337,20 @@ function InsforgeProvider({
292
337
  updateUser,
293
338
  reloadAuth: loadAuthState,
294
339
  baseUrl,
340
+ sendVerificationEmail,
295
341
  sendResetPasswordEmail,
296
342
  resetPassword,
297
343
  verifyEmail,
298
- getPublicAuthConfig
344
+ exchangeResetPasswordToken,
345
+ getPublicAuthConfig,
346
+ loginWithOAuth
299
347
  },
300
348
  children
301
349
  }
302
350
  );
303
351
  }
304
352
  function useInsforge() {
305
- const context = react.useContext(InsforgeContext);
353
+ const context = useContext(InsforgeContext);
306
354
  if (!context) {
307
355
  throw new Error("useInsforge must be used within InsforgeProvider");
308
356
  }
@@ -310,9 +358,9 @@ function useInsforge() {
310
358
  }
311
359
  function usePublicAuthConfig() {
312
360
  const { getPublicAuthConfig } = useInsforge();
313
- const [authConfig, setAuthConfig] = react.useState(null);
314
- const [isLoaded, setIsLoaded] = react.useState(false);
315
- react.useEffect(() => {
361
+ const [authConfig, setAuthConfig] = useState(null);
362
+ const [isLoaded, setIsLoaded] = useState(false);
363
+ useEffect(() => {
316
364
  async function fetchConfig() {
317
365
  const result = await getPublicAuthConfig();
318
366
  if (result) {
@@ -328,236 +376,170 @@ function usePublicAuthConfig() {
328
376
  return { authConfig, isLoaded };
329
377
  }
330
378
  function AuthBranding() {
331
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-[#FAFAFA] px-2 py-4 flex flex-row justify-center items-center gap-1", children: [
332
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs font-medium text-black font-manrope", children: "Secured by" }),
333
- /* @__PURE__ */ jsxRuntime.jsx("a", { href: "https://insforge.dev", target: "_blank", rel: "noopener noreferrer", children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "83", height: "20", viewBox: "0 0 83 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
334
- /* @__PURE__ */ jsxRuntime.jsx(
335
- "path",
336
- {
337
- d: "M2.16783 8.46797C1.9334 8.23325 1.9334 7.85269 2.16783 7.61797L8.11049 1.66797L16.6 1.66797L6.41259 11.868C6.17815 12.1027 5.79807 12.1027 5.56363 11.868L2.16783 8.46797Z",
338
- fill: "url(#paint0_linear_2976_9475)"
339
- }
340
- ),
341
- /* @__PURE__ */ jsxRuntime.jsx(
342
- "path",
343
- {
344
- d: "M12.8858 6.44922L16.6 10.168V18.668L8.64108 10.6992L12.8858 6.44922Z",
345
- fill: "url(#paint1_linear_2976_9475)"
346
- }
347
- ),
348
- /* @__PURE__ */ jsxRuntime.jsx(
349
- "path",
350
- {
351
- d: "M67.5439 6.48828C68.2894 6.48828 68.9145 6.67064 69.418 7.03516C69.5229 7.10943 69.6214 7.1907 69.7158 7.27637V6.70703H71.248V14.959C71.248 15.1583 71.2381 15.3485 71.2188 15.5283C71.2042 15.7129 71.1774 15.8925 71.1387 16.0674C71.0225 16.5776 70.7998 16.9957 70.4707 17.3213C70.1415 17.6518 69.7321 17.8972 69.2432 18.0576C68.7592 18.2179 68.2222 18.2988 67.6318 18.2988C67.1962 18.2988 66.7768 18.2308 66.375 18.0947C65.9782 17.9587 65.6202 17.7614 65.3008 17.5039C64.9813 17.2512 64.7199 16.9446 64.5166 16.585L66.1289 15.7832C66.2789 16.0698 66.4888 16.2819 66.7598 16.418C67.0356 16.5589 67.3289 16.6289 67.6387 16.6289C68.0016 16.6289 68.3258 16.5628 68.6113 16.4316C68.8969 16.3053 69.1176 16.116 69.2725 15.8633C69.4321 15.6155 69.5077 15.3047 69.498 14.9307V14.1797C69.4665 14.2037 69.4359 14.229 69.4033 14.252C68.8855 14.6164 68.2441 14.7988 67.4795 14.7988C66.7582 14.7988 66.1281 14.6165 65.5908 14.252C65.0537 13.8875 64.637 13.3915 64.3418 12.7646C64.0467 12.1378 63.8994 11.4307 63.8994 10.6436C63.8994 9.84651 64.0465 9.13673 64.3418 8.51465C64.6419 7.88768 65.0663 7.39481 65.6133 7.03516C66.1601 6.67077 66.8036 6.48836 67.5439 6.48828ZM37.5 6.48828C38.1099 6.48828 38.6496 6.58294 39.1191 6.77246C39.5935 6.96201 39.9762 7.2321 40.2666 7.58203C40.5569 7.93184 40.7359 8.34227 40.8037 8.81348L39.0176 9.13477C38.974 8.79951 38.8218 8.53424 38.5605 8.33984C38.304 8.14547 37.96 8.03605 37.5293 8.01172C37.1178 7.98742 36.7859 8.05051 36.5342 8.20117C36.2825 8.34698 36.1562 8.55398 36.1562 8.82129C36.1563 8.97184 36.208 9.10017 36.3096 9.20703C36.4112 9.31394 36.614 9.42141 36.9189 9.52832C37.2288 9.63524 37.6889 9.76635 38.2988 9.92188C38.9232 10.0823 39.4222 10.2666 39.7949 10.4756C40.1722 10.6796 40.4428 10.9254 40.6074 11.2119C40.7768 11.4987 40.8623 11.8466 40.8623 12.2549C40.8623 13.047 40.574 13.6691 39.998 14.1211C39.4268 14.5731 38.6348 14.7988 37.623 14.7988C36.6551 14.7988 35.8687 14.5799 35.2637 14.1426C34.6587 13.7052 34.2909 13.0908 34.1602 12.2988L35.9463 12.0215C36.0383 12.4102 36.2411 12.7169 36.5557 12.9404C36.8703 13.164 37.2678 13.2754 37.7471 13.2754C38.1681 13.2754 38.4922 13.1926 38.7197 13.0273C38.9521 12.8572 39.0684 12.6266 39.0684 12.335C39.0684 12.1552 39.0245 12.0122 38.9375 11.9053C38.8552 11.7935 38.6713 11.686 38.3857 11.584C38.1001 11.4819 37.6618 11.3528 37.0713 11.1973C36.4131 11.0223 35.8901 10.8359 35.5029 10.6367C35.1158 10.4327 34.8374 10.192 34.668 9.91504C34.4985 9.63801 34.4141 9.30188 34.4141 8.9082C34.4141 8.41746 34.5423 7.98943 34.7988 7.625C35.0553 7.26073 35.4135 6.98146 35.873 6.78711C36.3329 6.58784 36.8755 6.48828 37.5 6.48828ZM53.3047 6.48828C54.0937 6.48828 54.7815 6.66572 55.3672 7.02051C55.9527 7.37528 56.4072 7.86634 56.7314 8.49316C57.0558 9.11525 57.2187 9.83193 57.2188 10.6436C57.2188 11.46 57.0537 12.1817 56.7246 12.8086C56.4003 13.4307 55.9451 13.9196 55.3594 14.2744C54.7737 14.6242 54.0888 14.7988 53.3047 14.7988C52.5205 14.7988 51.8357 14.6214 51.25 14.2666C50.6643 13.9118 50.2091 13.4238 49.8848 12.8018C49.5653 12.1748 49.4053 11.4552 49.4053 10.6436C49.4053 9.81735 49.5703 9.09279 49.8994 8.4707C50.2286 7.8488 50.6859 7.36255 51.2715 7.0127C51.8572 6.66281 52.5351 6.48828 53.3047 6.48828ZM76.7471 6.48828C77.5603 6.48828 78.25 6.68053 78.8164 7.06445C79.3876 7.44351 79.812 7.97991 80.0879 8.6748C80.3638 9.36976 80.4672 10.189 80.3994 11.1318H74.7256C74.7843 11.6972 74.949 12.1516 75.2227 12.4951C75.5711 12.9325 76.0792 13.1513 76.7471 13.1514C77.1779 13.1514 77.5486 13.0567 77.8584 12.8672C78.173 12.6728 78.4146 12.3928 78.584 12.0283L80.3125 12.5537C80.0124 13.2633 79.5473 13.8153 78.918 14.209C78.2936 14.6025 77.6036 14.7988 76.8486 14.7988C76.0549 14.7988 75.358 14.6263 74.7578 14.2812C74.1576 13.9362 73.6875 13.458 73.3486 12.8457C73.0147 12.2334 72.8477 11.5284 72.8477 10.7314C72.8477 9.87126 73.0127 9.12495 73.3418 8.49316C73.671 7.85651 74.1282 7.36263 74.7139 7.0127C75.2995 6.6628 75.9775 6.48832 76.7471 6.48828ZM23.3301 14.5801H21.5801V4.08203H23.3301V14.5801ZM29.6152 6.48047C30.1959 6.48052 30.6753 6.5781 31.0527 6.77246C31.4301 6.96681 31.7305 7.21443 31.9531 7.51562C32.1758 7.81695 32.3398 8.13831 32.4463 8.47852C32.5528 8.81873 32.6213 9.14205 32.6504 9.44824C32.6843 9.74946 32.7012 9.99508 32.7012 10.1846V14.5801H30.9287V10.7891C30.9287 10.5413 30.9118 10.2669 30.8779 9.96582C30.844 9.66449 30.7645 9.37469 30.6387 9.09766C30.5177 8.81592 30.3337 8.58503 30.0869 8.40527C29.8449 8.22551 29.5157 8.13579 29.0996 8.13574C28.8769 8.13574 28.6563 8.17221 28.4385 8.24512C28.2206 8.31802 28.0219 8.4442 27.8428 8.62402C27.6685 8.79899 27.5284 9.04249 27.4219 9.35352C27.3154 9.65965 27.2617 10.0532 27.2617 10.5342V14.5801H25.4902V6.70703H27.0518V7.58301C27.2521 7.34675 27.486 7.14172 27.7559 6.96973C28.2593 6.64409 28.8794 6.48047 29.6152 6.48047ZM48.748 5.83887H44.2021V8.45605H47.876V10.2061H44.2021V14.5801H42.4521V4.08203H48.748V5.83887ZM62.5137 6.67773C62.7606 6.65829 63.001 6.66815 63.2334 6.70703V8.34766C63.001 8.27961 62.7317 8.25695 62.4268 8.28125C62.1267 8.30557 61.8553 8.39134 61.6133 8.53711C61.3715 8.66829 61.1733 8.83606 61.0186 9.04004C60.8686 9.24404 60.7572 9.47701 60.6846 9.73926C60.612 9.99685 60.5752 10.2768 60.5752 10.5781V14.5801H58.8184V6.70703H60.3652V7.96582C60.4243 7.85986 60.4888 7.75824 60.5605 7.66211C60.7251 7.4434 60.9219 7.26302 61.1494 7.12207C61.3429 6.99098 61.5559 6.88926 61.7881 6.81641C62.0251 6.73869 62.267 6.69235 62.5137 6.67773ZM67.8057 8.0625C67.3362 8.06252 66.9485 8.17982 66.6436 8.41309C66.3389 8.64144 66.1139 8.95232 65.9688 9.3457C65.8235 9.7345 65.751 10.1673 65.751 10.6436C65.751 11.1247 65.8215 11.5624 65.9619 11.9561C66.1071 12.3447 66.3269 12.6535 66.6221 12.8818C66.9174 13.1103 67.293 13.2246 67.748 13.2246C68.2174 13.2246 68.5953 13.1171 68.8809 12.9033C69.1711 12.6846 69.3811 12.3808 69.5117 11.9922C69.6473 11.6034 69.7158 11.1539 69.7158 10.6436C69.7158 10.1284 69.6473 9.67886 69.5117 9.29492C69.381 8.90617 69.1753 8.60445 68.8945 8.39062C68.6138 8.17213 68.2508 8.0625 67.8057 8.0625ZM53.3047 8.13574C52.8351 8.13574 52.4475 8.24222 52.1426 8.45605C51.8425 8.66504 51.6198 8.95977 51.4746 9.33887C51.3295 9.71303 51.2568 10.148 51.2568 10.6436C51.2568 11.4066 51.4288 12.0168 51.7725 12.4736C52.121 12.9256 52.6318 13.1514 53.3047 13.1514C54.0017 13.1514 54.5196 12.9177 54.8584 12.4512C55.1971 11.9846 55.3672 11.3822 55.3672 10.6436C55.3672 9.8807 55.1951 9.27324 54.8516 8.82129C54.5079 8.36444 53.9921 8.13575 53.3047 8.13574ZM76.8203 8.02637C76.1039 8.02637 75.5712 8.25013 75.2227 8.69727C74.9987 8.98144 74.8476 9.35094 74.7676 9.80566H78.6221C78.5589 9.29301 78.4236 8.89686 78.2139 8.61719C77.9186 8.22359 77.4543 8.02645 76.8203 8.02637Z",
352
- fill: "black"
353
- }
354
- ),
355
- /* @__PURE__ */ jsxRuntime.jsxs("defs", { children: [
356
- /* @__PURE__ */ jsxRuntime.jsxs(
357
- "linearGradient",
358
- {
359
- id: "paint0_linear_2976_9475",
360
- x1: "1.85883",
361
- y1: "1.92425",
362
- x2: "24.3072",
363
- y2: "9.64016",
364
- gradientUnits: "userSpaceOnUse",
365
- children: [
366
- /* @__PURE__ */ jsxRuntime.jsx("stop", {}),
367
- /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "1", stopOpacity: "0.4" })
368
- ]
369
- }
370
- ),
371
- /* @__PURE__ */ jsxRuntime.jsxs(
372
- "linearGradient",
373
- {
374
- id: "paint1_linear_2976_9475",
375
- x1: "25.6475",
376
- y1: "8.65468",
377
- x2: "10.7901",
378
- y2: "8.65468",
379
- gradientUnits: "userSpaceOnUse",
380
- children: [
381
- /* @__PURE__ */ jsxRuntime.jsx("stop", {}),
382
- /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "1", stopOpacity: "0.4" })
383
- ]
384
- }
385
- )
386
- ] })
387
- ] }) })
379
+ return /* @__PURE__ */ jsxs("div", { className: "if-authBranding if-internal-ab4k9w", children: [
380
+ /* @__PURE__ */ jsx("p", { className: "if-authBranding-text", children: "Secured by" }),
381
+ /* @__PURE__ */ jsx("a", { href: "https://insforge.dev", target: "_blank", rel: "noopener noreferrer", children: /* @__PURE__ */ jsxs(
382
+ "svg",
383
+ {
384
+ width: "83",
385
+ height: "20",
386
+ viewBox: "0 0 83 20",
387
+ fill: "none",
388
+ xmlns: "http://www.w3.org/2000/svg",
389
+ children: [
390
+ /* @__PURE__ */ jsx(
391
+ "path",
392
+ {
393
+ d: "M2.16783 8.46797C1.9334 8.23325 1.9334 7.85269 2.16783 7.61797L8.11049 1.66797L16.6 1.66797L6.41259 11.868C6.17815 12.1027 5.79807 12.1027 5.56363 11.868L2.16783 8.46797Z",
394
+ fill: "url(#paint0_linear_2976_9475)"
395
+ }
396
+ ),
397
+ /* @__PURE__ */ jsx(
398
+ "path",
399
+ {
400
+ d: "M12.8858 6.44922L16.6 10.168V18.668L8.64108 10.6992L12.8858 6.44922Z",
401
+ fill: "url(#paint1_linear_2976_9475)"
402
+ }
403
+ ),
404
+ /* @__PURE__ */ jsx(
405
+ "path",
406
+ {
407
+ d: "M67.5439 6.48828C68.2894 6.48828 68.9145 6.67064 69.418 7.03516C69.5229 7.10943 69.6214 7.1907 69.7158 7.27637V6.70703H71.248V14.959C71.248 15.1583 71.2381 15.3485 71.2188 15.5283C71.2042 15.7129 71.1774 15.8925 71.1387 16.0674C71.0225 16.5776 70.7998 16.9957 70.4707 17.3213C70.1415 17.6518 69.7321 17.8972 69.2432 18.0576C68.7592 18.2179 68.2222 18.2988 67.6318 18.2988C67.1962 18.2988 66.7768 18.2308 66.375 18.0947C65.9782 17.9587 65.6202 17.7614 65.3008 17.5039C64.9813 17.2512 64.7199 16.9446 64.5166 16.585L66.1289 15.7832C66.2789 16.0698 66.4888 16.2819 66.7598 16.418C67.0356 16.5589 67.3289 16.6289 67.6387 16.6289C68.0016 16.6289 68.3258 16.5628 68.6113 16.4316C68.8969 16.3053 69.1176 16.116 69.2725 15.8633C69.4321 15.6155 69.5077 15.3047 69.498 14.9307V14.1797C69.4665 14.2037 69.4359 14.229 69.4033 14.252C68.8855 14.6164 68.2441 14.7988 67.4795 14.7988C66.7582 14.7988 66.1281 14.6165 65.5908 14.252C65.0537 13.8875 64.637 13.3915 64.3418 12.7646C64.0467 12.1378 63.8994 11.4307 63.8994 10.6436C63.8994 9.84651 64.0465 9.13673 64.3418 8.51465C64.6419 7.88768 65.0663 7.39481 65.6133 7.03516C66.1601 6.67077 66.8036 6.48836 67.5439 6.48828ZM37.5 6.48828C38.1099 6.48828 38.6496 6.58294 39.1191 6.77246C39.5935 6.96201 39.9762 7.2321 40.2666 7.58203C40.5569 7.93184 40.7359 8.34227 40.8037 8.81348L39.0176 9.13477C38.974 8.79951 38.8218 8.53424 38.5605 8.33984C38.304 8.14547 37.96 8.03605 37.5293 8.01172C37.1178 7.98742 36.7859 8.05051 36.5342 8.20117C36.2825 8.34698 36.1562 8.55398 36.1562 8.82129C36.1563 8.97184 36.208 9.10017 36.3096 9.20703C36.4112 9.31394 36.614 9.42141 36.9189 9.52832C37.2288 9.63524 37.6889 9.76635 38.2988 9.92188C38.9232 10.0823 39.4222 10.2666 39.7949 10.4756C40.1722 10.6796 40.4428 10.9254 40.6074 11.2119C40.7768 11.4987 40.8623 11.8466 40.8623 12.2549C40.8623 13.047 40.574 13.6691 39.998 14.1211C39.4268 14.5731 38.6348 14.7988 37.623 14.7988C36.6551 14.7988 35.8687 14.5799 35.2637 14.1426C34.6587 13.7052 34.2909 13.0908 34.1602 12.2988L35.9463 12.0215C36.0383 12.4102 36.2411 12.7169 36.5557 12.9404C36.8703 13.164 37.2678 13.2754 37.7471 13.2754C38.1681 13.2754 38.4922 13.1926 38.7197 13.0273C38.9521 12.8572 39.0684 12.6266 39.0684 12.335C39.0684 12.1552 39.0245 12.0122 38.9375 11.9053C38.8552 11.7935 38.6713 11.686 38.3857 11.584C38.1001 11.4819 37.6618 11.3528 37.0713 11.1973C36.4131 11.0223 35.8901 10.8359 35.5029 10.6367C35.1158 10.4327 34.8374 10.192 34.668 9.91504C34.4985 9.63801 34.4141 9.30188 34.4141 8.9082C34.4141 8.41746 34.5423 7.98943 34.7988 7.625C35.0553 7.26073 35.4135 6.98146 35.873 6.78711C36.3329 6.58784 36.8755 6.48828 37.5 6.48828ZM53.3047 6.48828C54.0937 6.48828 54.7815 6.66572 55.3672 7.02051C55.9527 7.37528 56.4072 7.86634 56.7314 8.49316C57.0558 9.11525 57.2187 9.83193 57.2188 10.6436C57.2188 11.46 57.0537 12.1817 56.7246 12.8086C56.4003 13.4307 55.9451 13.9196 55.3594 14.2744C54.7737 14.6242 54.0888 14.7988 53.3047 14.7988C52.5205 14.7988 51.8357 14.6214 51.25 14.2666C50.6643 13.9118 50.2091 13.4238 49.8848 12.8018C49.5653 12.1748 49.4053 11.4552 49.4053 10.6436C49.4053 9.81735 49.5703 9.09279 49.8994 8.4707C50.2286 7.8488 50.6859 7.36255 51.2715 7.0127C51.8572 6.66281 52.5351 6.48828 53.3047 6.48828ZM76.7471 6.48828C77.5603 6.48828 78.25 6.68053 78.8164 7.06445C79.3876 7.44351 79.812 7.97991 80.0879 8.6748C80.3638 9.36976 80.4672 10.189 80.3994 11.1318H74.7256C74.7843 11.6972 74.949 12.1516 75.2227 12.4951C75.5711 12.9325 76.0792 13.1513 76.7471 13.1514C77.1779 13.1514 77.5486 13.0567 77.8584 12.8672C78.173 12.6728 78.4146 12.3928 78.584 12.0283L80.3125 12.5537C80.0124 13.2633 79.5473 13.8153 78.918 14.209C78.2936 14.6025 77.6036 14.7988 76.8486 14.7988C76.0549 14.7988 75.358 14.6263 74.7578 14.2812C74.1576 13.9362 73.6875 13.458 73.3486 12.8457C73.0147 12.2334 72.8477 11.5284 72.8477 10.7314C72.8477 9.87126 73.0127 9.12495 73.3418 8.49316C73.671 7.85651 74.1282 7.36263 74.7139 7.0127C75.2995 6.6628 75.9775 6.48832 76.7471 6.48828ZM23.3301 14.5801H21.5801V4.08203H23.3301V14.5801ZM29.6152 6.48047C30.1959 6.48052 30.6753 6.5781 31.0527 6.77246C31.4301 6.96681 31.7305 7.21443 31.9531 7.51562C32.1758 7.81695 32.3398 8.13831 32.4463 8.47852C32.5528 8.81873 32.6213 9.14205 32.6504 9.44824C32.6843 9.74946 32.7012 9.99508 32.7012 10.1846V14.5801H30.9287V10.7891C30.9287 10.5413 30.9118 10.2669 30.8779 9.96582C30.844 9.66449 30.7645 9.37469 30.6387 9.09766C30.5177 8.81592 30.3337 8.58503 30.0869 8.40527C29.8449 8.22551 29.5157 8.13579 29.0996 8.13574C28.8769 8.13574 28.6563 8.17221 28.4385 8.24512C28.2206 8.31802 28.0219 8.4442 27.8428 8.62402C27.6685 8.79899 27.5284 9.04249 27.4219 9.35352C27.3154 9.65965 27.2617 10.0532 27.2617 10.5342V14.5801H25.4902V6.70703H27.0518V7.58301C27.2521 7.34675 27.486 7.14172 27.7559 6.96973C28.2593 6.64409 28.8794 6.48047 29.6152 6.48047ZM48.748 5.83887H44.2021V8.45605H47.876V10.2061H44.2021V14.5801H42.4521V4.08203H48.748V5.83887ZM62.5137 6.67773C62.7606 6.65829 63.001 6.66815 63.2334 6.70703V8.34766C63.001 8.27961 62.7317 8.25695 62.4268 8.28125C62.1267 8.30557 61.8553 8.39134 61.6133 8.53711C61.3715 8.66829 61.1733 8.83606 61.0186 9.04004C60.8686 9.24404 60.7572 9.47701 60.6846 9.73926C60.612 9.99685 60.5752 10.2768 60.5752 10.5781V14.5801H58.8184V6.70703H60.3652V7.96582C60.4243 7.85986 60.4888 7.75824 60.5605 7.66211C60.7251 7.4434 60.9219 7.26302 61.1494 7.12207C61.3429 6.99098 61.5559 6.88926 61.7881 6.81641C62.0251 6.73869 62.267 6.69235 62.5137 6.67773ZM67.8057 8.0625C67.3362 8.06252 66.9485 8.17982 66.6436 8.41309C66.3389 8.64144 66.1139 8.95232 65.9688 9.3457C65.8235 9.7345 65.751 10.1673 65.751 10.6436C65.751 11.1247 65.8215 11.5624 65.9619 11.9561C66.1071 12.3447 66.3269 12.6535 66.6221 12.8818C66.9174 13.1103 67.293 13.2246 67.748 13.2246C68.2174 13.2246 68.5953 13.1171 68.8809 12.9033C69.1711 12.6846 69.3811 12.3808 69.5117 11.9922C69.6473 11.6034 69.7158 11.1539 69.7158 10.6436C69.7158 10.1284 69.6473 9.67886 69.5117 9.29492C69.381 8.90617 69.1753 8.60445 68.8945 8.39062C68.6138 8.17213 68.2508 8.0625 67.8057 8.0625ZM53.3047 8.13574C52.8351 8.13574 52.4475 8.24222 52.1426 8.45605C51.8425 8.66504 51.6198 8.95977 51.4746 9.33887C51.3295 9.71303 51.2568 10.148 51.2568 10.6436C51.2568 11.4066 51.4288 12.0168 51.7725 12.4736C52.121 12.9256 52.6318 13.1514 53.3047 13.1514C54.0017 13.1514 54.5196 12.9177 54.8584 12.4512C55.1971 11.9846 55.3672 11.3822 55.3672 10.6436C55.3672 9.8807 55.1951 9.27324 54.8516 8.82129C54.5079 8.36444 53.9921 8.13575 53.3047 8.13574ZM76.8203 8.02637C76.1039 8.02637 75.5712 8.25013 75.2227 8.69727C74.9987 8.98144 74.8476 9.35094 74.7676 9.80566H78.6221C78.5589 9.29301 78.4236 8.89686 78.2139 8.61719C77.9186 8.22359 77.4543 8.02645 76.8203 8.02637Z",
408
+ fill: "black"
409
+ }
410
+ ),
411
+ /* @__PURE__ */ jsxs("defs", { children: [
412
+ /* @__PURE__ */ jsxs(
413
+ "linearGradient",
414
+ {
415
+ id: "paint0_linear_2976_9475",
416
+ x1: "1.85883",
417
+ y1: "1.92425",
418
+ x2: "24.3072",
419
+ y2: "9.64016",
420
+ gradientUnits: "userSpaceOnUse",
421
+ children: [
422
+ /* @__PURE__ */ jsx("stop", {}),
423
+ /* @__PURE__ */ jsx("stop", { offset: "1", stopOpacity: "0.4" })
424
+ ]
425
+ }
426
+ ),
427
+ /* @__PURE__ */ jsxs(
428
+ "linearGradient",
429
+ {
430
+ id: "paint1_linear_2976_9475",
431
+ x1: "25.6475",
432
+ y1: "8.65468",
433
+ x2: "10.7901",
434
+ y2: "8.65468",
435
+ gradientUnits: "userSpaceOnUse",
436
+ children: [
437
+ /* @__PURE__ */ jsx("stop", {}),
438
+ /* @__PURE__ */ jsx("stop", { offset: "1", stopOpacity: "0.4" })
439
+ ]
440
+ }
441
+ )
442
+ ] })
443
+ ]
444
+ }
445
+ ) })
388
446
  ] });
389
447
  }
390
- function cn(...inputs) {
391
- return tailwindMerge.twMerge(clsx.clsx(inputs));
392
- }
393
- function AuthContainer({ children, appearance = {} }) {
394
- return /* @__PURE__ */ jsxRuntime.jsxs(
395
- "div",
396
- {
397
- className: cn(
398
- "w-full max-w-[400px] rounded-xl overflow-hidden shadow-lg",
399
- appearance.containerClassName
400
- ),
401
- children: [
402
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(
403
- "bg-white p-6 flex flex-col justify-center items-stretch gap-6",
404
- appearance.cardClassName
405
- ), children }),
406
- /* @__PURE__ */ jsxRuntime.jsx(AuthBranding, {})
407
- ]
408
- }
409
- );
448
+ function AuthContainer({ children }) {
449
+ return /* @__PURE__ */ jsxs("div", { className: "if-authContainer if-internal-a8f3d2", children: [
450
+ /* @__PURE__ */ jsx("div", { className: "if-authCard if-internal-b2k9x1", children }),
451
+ /* @__PURE__ */ jsx(AuthBranding, {})
452
+ ] });
410
453
  }
411
- function AuthHeader({
412
- title,
413
- subtitle,
414
- appearance = {}
415
- }) {
416
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(
417
- "flex flex-col justify-start items-start gap-2",
418
- appearance.containerClassName
419
- ), children: [
420
- /* @__PURE__ */ jsxRuntime.jsx("h1", { className: cn(
421
- "text-2xl font-semibold text-black leading-8",
422
- appearance.titleClassName
423
- ), children: title }),
424
- subtitle && /* @__PURE__ */ jsxRuntime.jsx("p", { className: cn(
425
- "text-sm font-normal text-[#828282] leading-6",
426
- appearance.subtitleClassName
427
- ), children: subtitle })
454
+ function AuthHeader({ title, subtitle }) {
455
+ return /* @__PURE__ */ jsxs("div", { className: "if-authHeader if-internal-h3m7w5", children: [
456
+ /* @__PURE__ */ jsx("h1", { className: "if-authHeader-title if-internal-t4p1k9", children: title }),
457
+ subtitle && /* @__PURE__ */ jsx("p", { className: "if-authHeader-subtitle if-internal-s7q2m3", children: subtitle })
428
458
  ] });
429
459
  }
430
- function AuthErrorBanner({ error, className }) {
431
- if (!error) return null;
432
- return /* @__PURE__ */ jsxRuntime.jsxs(
433
- "div",
434
- {
435
- className: cn(
436
- "flex items-center gap-2 mb-4 pl-3 py-2 pr-2 bg-red-50 border-2 border-red-600 rounded",
437
- className
438
- ),
439
- children: [
440
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertTriangle, { className: "w-6 h-6 text-red-500 shrink-0" }),
441
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-red-600 flex-1", children: error })
442
- ]
443
- }
444
- );
460
+ function AuthErrorBanner({ error }) {
461
+ if (!error) {
462
+ return null;
463
+ }
464
+ return /* @__PURE__ */ jsx("div", { className: "if-errorBanner if-internal-eb2m7k", children: /* @__PURE__ */ jsxs("div", { className: "if-errorBanner-content", children: [
465
+ /* @__PURE__ */ jsx(AlertTriangle, { className: "if-errorBanner-icon" }),
466
+ /* @__PURE__ */ jsx("span", { className: "if-errorBanner-text", children: error })
467
+ ] }) });
445
468
  }
446
- function AuthFormField({
447
- label,
448
- id,
449
- appearance = {},
450
- ...props
451
- }) {
452
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(
453
- "flex flex-col justify-center items-stretch gap-1",
454
- appearance.containerClassName
455
- ), children: [
456
- /* @__PURE__ */ jsxRuntime.jsx(
457
- "label",
458
- {
459
- htmlFor: id,
460
- className: cn(
461
- "text-sm font-normal text-black leading-6",
462
- appearance.labelClassName
463
- ),
464
- children: label
465
- }
466
- ),
467
- /* @__PURE__ */ jsxRuntime.jsx(
468
- "input",
469
- {
470
- id,
471
- className: cn(
472
- "w-full flex items-center gap-2 self-stretch",
473
- "pl-3 pr-2 py-2 rounded-sm border border-[#D4D4D4] bg-white",
474
- "text-sm font-normal leading-5",
475
- "placeholder:text-[#A3A3A3] placeholder:font-sm placeholder:font-normal",
476
- "focus:outline-none focus:border-black",
477
- appearance.inputClassName
478
- ),
479
- ...props
480
- }
481
- )
469
+ function AuthFormField({ label, id, ...props }) {
470
+ return /* @__PURE__ */ jsxs("div", { className: "if-formField if-internal-f9n6p2", children: [
471
+ /* @__PURE__ */ jsx("label", { htmlFor: id, className: "if-formField-label if-internal-l3k8m1", children: label }),
472
+ /* @__PURE__ */ jsx("input", { id, className: "if-formField-input if-internal-i2v8k4", ...props })
482
473
  ] });
483
474
  }
484
475
  function AuthPasswordStrengthIndicator({
485
476
  password,
486
- config,
487
- appearance = {}
477
+ config
488
478
  }) {
489
479
  const requirements = createRequirements(config);
490
- return /* @__PURE__ */ jsxRuntime.jsx(
480
+ return /* @__PURE__ */ jsx("div", { className: "if-passwordStrength if-internal-ps6w3k", children: /* @__PURE__ */ jsx("div", { className: "if-passwordStrength-requirements", children: requirements.map((req) => /* @__PURE__ */ jsxs(
491
481
  "div",
492
482
  {
493
- className: cn("mt-3 flex flex-col gap-3", appearance.containerClassName),
494
- children: requirements.map((req) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
495
- /* @__PURE__ */ jsxRuntime.jsx(
483
+ className: `if-passwordStrength-requirement ${req.test(password) ? "met" : "unmet"}`,
484
+ children: [
485
+ /* @__PURE__ */ jsx(
496
486
  "div",
497
487
  {
498
- className: cn(
499
- "flex items-center justify-center w-4 h-4 rounded-full border-2 transition-colors",
500
- req.test(password) ? "bg-[#059669] border-transparent" : "border-neutral-400 bg-white"
501
- ),
502
- children: req.test(password) && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "w-3 h-3 text-white" })
488
+ style: {
489
+ display: "flex",
490
+ alignItems: "center",
491
+ justifyContent: "center",
492
+ width: "1rem",
493
+ height: "1rem",
494
+ borderRadius: "50%",
495
+ border: "2px solid",
496
+ borderColor: req.test(password) ? "transparent" : "#9ca3af",
497
+ backgroundColor: req.test(password) ? "#059669" : "white",
498
+ transition: "all 0.2s"
499
+ },
500
+ children: req.test(password) && /* @__PURE__ */ jsx(Check, { style: { width: "0.75rem", height: "0.75rem", color: "white" } })
503
501
  }
504
502
  ),
505
- /* @__PURE__ */ jsxRuntime.jsx(
506
- "span",
507
- {
508
- className: cn(
509
- "text-sm font-normal leading-5 text-[#525252]",
510
- appearance.requirementClassName
511
- ),
512
- children: req.label
513
- }
514
- )
515
- ] }, req.label))
516
- }
517
- );
503
+ /* @__PURE__ */ jsx("span", { children: req.label })
504
+ ]
505
+ },
506
+ req.label
507
+ )) }) });
518
508
  }
519
509
  function createRequirements(config) {
520
510
  const requirements = [];
521
- const minLength = config.passwordMinLength;
522
- const requireUppercase = config.requireUppercase;
523
- const requireLowercase = config.requireLowercase;
524
- const requireNumber = config.requireNumber;
525
- const requireSpecialChar = config.requireSpecialChar;
526
- if (requireUppercase) {
511
+ if (config.passwordMinLength) {
527
512
  requirements.push({
528
- label: "At least 1 Uppercase letter",
529
- test: (pwd) => /[A-Z]/.test(pwd)
513
+ label: `At least ${config.passwordMinLength} characters`,
514
+ test: (password) => password.length >= config.passwordMinLength
530
515
  });
531
516
  }
532
- if (requireLowercase) {
517
+ if (config.requireLowercase) {
533
518
  requirements.push({
534
- label: "At least 1 Lowercase letter",
535
- test: (pwd) => /[a-z]/.test(pwd)
519
+ label: "Contains lowercase letter",
520
+ test: (password) => /[a-z]/.test(password)
536
521
  });
537
522
  }
538
- if (requireNumber) {
523
+ if (config.requireUppercase) {
539
524
  requirements.push({
540
- label: "At least 1 Number",
541
- test: (pwd) => /\d/.test(pwd)
525
+ label: "Contains uppercase letter",
526
+ test: (password) => /[A-Z]/.test(password)
542
527
  });
543
528
  }
544
- if (requireSpecialChar) {
529
+ if (config.requireNumber) {
545
530
  requirements.push({
546
- label: "Special character (e.g. !?<>@#$%)",
547
- test: (pwd) => /[!@#$%^&*()_+\-=[\]{};\\|,.<>/?]/.test(pwd)
531
+ label: "Contains number",
532
+ test: (password) => /\d/.test(password)
533
+ });
534
+ }
535
+ if (config.requireSpecialChar) {
536
+ requirements.push({
537
+ label: "Contains special character",
538
+ test: (password) => /[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/.test(password)
548
539
  });
549
540
  }
550
- requirements.push({
551
- label: `${minLength} characters or more`,
552
- test: (pwd) => pwd.length >= minLength
553
- });
554
541
  return requirements;
555
542
  }
556
- function validatePasswordStrength(password, config) {
557
- if (!password) return false;
558
- const requirements = createRequirements(config);
559
- return requirements.every((req) => req.test(password));
560
- }
561
543
  function AuthPasswordField({
562
544
  label,
563
545
  id,
@@ -565,187 +547,125 @@ function AuthPasswordField({
565
547
  authConfig,
566
548
  forgotPasswordLink,
567
549
  value,
568
- appearance = {},
569
550
  onFocus,
570
551
  ...props
571
552
  }) {
572
- const [showPassword, setShowPassword] = react.useState(false);
573
- const [showStrength, setShowStrength] = react.useState(false);
553
+ const [showPassword, setShowPassword] = useState(false);
554
+ const [showStrength, setShowStrength] = useState(false);
574
555
  const handleFocus = (e) => {
575
556
  if (showStrengthIndicator) {
576
557
  setShowStrength(true);
577
558
  }
578
559
  onFocus?.(e);
579
560
  };
580
- return /* @__PURE__ */ jsxRuntime.jsxs(
581
- "div",
582
- {
583
- className: cn(
584
- "flex flex-col justify-center items-stretch gap-1",
585
- appearance.containerClassName
561
+ return /* @__PURE__ */ jsxs("div", { className: "if-passwordField if-internal-p5w9m7", children: [
562
+ (label || forgotPasswordLink) && /* @__PURE__ */ jsxs("div", { className: "if-passwordField-labelRow", children: [
563
+ /* @__PURE__ */ jsx("label", { htmlFor: id, className: "if-passwordField-label", children: label }),
564
+ forgotPasswordLink && /* @__PURE__ */ jsx("a", { href: forgotPasswordLink.href, className: "if-passwordField-forgotLink", children: forgotPasswordLink.text || "Forget Password?" })
565
+ ] }),
566
+ /* @__PURE__ */ jsxs("div", { className: "if-passwordField-inputWrapper", children: [
567
+ /* @__PURE__ */ jsx(
568
+ "input",
569
+ {
570
+ id,
571
+ type: showPassword ? "text" : "password",
572
+ className: "if-passwordField-input",
573
+ value,
574
+ onFocus: handleFocus,
575
+ ...props
576
+ }
586
577
  ),
587
- children: [
588
- (label || forgotPasswordLink) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between items-center", children: [
589
- /* @__PURE__ */ jsxRuntime.jsx(
590
- "label",
591
- {
592
- htmlFor: id,
593
- className: cn(
594
- "text-sm font-normal text-black leading-6",
595
- appearance.labelClassName
596
- ),
597
- children: label
598
- }
599
- ),
600
- forgotPasswordLink && /* @__PURE__ */ jsxRuntime.jsx(
601
- "a",
602
- {
603
- href: forgotPasswordLink.href,
604
- className: "text-right text-sm font-normal text-[#737373] leading-6",
605
- children: forgotPasswordLink.text || "Forget Password?"
606
- }
607
- )
608
- ] }),
609
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
610
- /* @__PURE__ */ jsxRuntime.jsx(
611
- "input",
612
- {
613
- id,
614
- type: showPassword ? "text" : "password",
615
- className: cn(
616
- "w-full flex items-center gap-2 self-stretch",
617
- "pl-3 py-2 pr-8 rounded border border-[#D4D4D4] bg-white",
618
- "text-sm font-normal leading-5",
619
- "placeholder:text-[#A3A3A3] placeholder:font-sm placeholder:font-normal",
620
- "focus:outline-none focus:border-black",
621
- appearance.inputClassName
622
- ),
623
- value,
624
- onFocus: handleFocus,
625
- ...props
626
- }
627
- ),
628
- /* @__PURE__ */ jsxRuntime.jsx(
629
- "button",
630
- {
631
- type: "button",
632
- onClick: () => setShowPassword(!showPassword),
633
- className: "absolute right-2 top-1/2 -translate-y-1/2 bg-transparent border-none text-[#A6A6A6] cursor-pointer transition-colors hover:text-gray-600 flex items-center justify-center",
634
- "aria-label": showPassword ? "Hide password" : "Show password",
635
- children: showPassword ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.EyeOff, { size: 20 }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Eye, { size: 20 })
636
- }
637
- )
638
- ] }),
639
- showStrengthIndicator && showStrength && /* @__PURE__ */ jsxRuntime.jsx(
640
- AuthPasswordStrengthIndicator,
641
- {
642
- password: String(value || ""),
643
- config: authConfig
644
- }
645
- )
646
- ]
647
- }
648
- );
578
+ /* @__PURE__ */ jsx(
579
+ "button",
580
+ {
581
+ type: "button",
582
+ onClick: () => setShowPassword(!showPassword),
583
+ className: "if-passwordField-toggleButton",
584
+ "aria-label": showPassword ? "Hide password" : "Show password",
585
+ children: showPassword ? /* @__PURE__ */ jsx(EyeOff, { size: 20 }) : /* @__PURE__ */ jsx(Eye, { size: 20 })
586
+ }
587
+ )
588
+ ] }),
589
+ showStrengthIndicator && showStrength && /* @__PURE__ */ jsx(AuthPasswordStrengthIndicator, { password: String(value || ""), config: authConfig })
590
+ ] });
649
591
  }
650
592
  function AuthSubmitButton({
651
593
  children,
652
594
  isLoading = false,
653
595
  confirmed = false,
654
596
  disabled = false,
655
- className
597
+ type = "submit",
598
+ onClick
656
599
  }) {
657
- return /* @__PURE__ */ jsxRuntime.jsxs(
600
+ return /* @__PURE__ */ jsxs(
658
601
  "button",
659
602
  {
660
- type: "submit",
661
- className: cn(
662
- "rounded-sm bg-black w-full flex mt-4 px-4 py-2",
663
- "justify-center items-center gap-2.5 self-stretch",
664
- "text-white font-semibold font-manrope text-base leading-normal",
665
- "border-none cursor-pointer transition-colors",
666
- "hover:bg-gray-800",
667
- "disabled:opacity-50 disabled:cursor-not-allowed",
668
- className
669
- ),
603
+ type,
604
+ className: "if-submitButton if-internal-b8p3m4",
670
605
  disabled: disabled || isLoading || confirmed,
606
+ onClick,
671
607
  children: [
672
- isLoading && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "w-5 h-5 animate-spin", size: 20 }),
673
- confirmed && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CircleCheck, { className: "w-5 h-5", size: 20 }),
608
+ isLoading && /* @__PURE__ */ jsx(Loader2, { className: "if-submitButton-icon if-submitButton-spinner", size: 20 }),
609
+ confirmed && /* @__PURE__ */ jsx(CircleCheck, { className: "if-submitButton-icon", size: 20 }),
674
610
  children
675
611
  ]
676
612
  }
677
613
  );
678
614
  }
679
- function AuthLink({ text, linkText, href, appearance = {} }) {
680
- const currentSearch = typeof window !== "undefined" ? window.location.search : "";
615
+ function AuthLink({ text, linkText, href }) {
616
+ const [searchParams] = useSearchParams();
617
+ const currentSearch = searchParams.toString();
681
618
  const finalHref = (() => {
682
- if (!currentSearch) return href;
619
+ if (!currentSearch) {
620
+ return href;
621
+ }
683
622
  try {
684
623
  const url = new URL(href, window.location.origin);
685
- const currentParams = new URLSearchParams(currentSearch);
686
- currentParams.forEach((value, key) => {
687
- if (!url.searchParams.has(key)) {
688
- url.searchParams.set(key, value);
689
- }
690
- });
624
+ url.search = currentSearch;
691
625
  return url.pathname + url.search;
692
626
  } catch {
693
627
  return href;
694
628
  }
695
629
  })();
696
- return /* @__PURE__ */ jsxRuntime.jsxs("p", { className: cn(
697
- "text-center text-sm font-normal text-[#828282] leading-6",
698
- appearance.containerClassName
699
- ), children: [
700
- text,
701
- " ",
702
- /* @__PURE__ */ jsxRuntime.jsx(
703
- "a",
704
- {
705
- href: finalHref,
706
- className: cn(
707
- "text-sm font-medium text-black leading-6",
708
- appearance.linkClassName
709
- ),
710
- children: linkText
711
- }
712
- )
630
+ return /* @__PURE__ */ jsxs("p", { className: "if-authLink if-internal-al5w9p", children: [
631
+ text && /* @__PURE__ */ jsx("span", { className: "if-authLink-text", children: text }),
632
+ text && " ",
633
+ /* @__PURE__ */ jsx("a", { href: finalHref, className: "if-authLink-link", children: linkText })
713
634
  ] });
714
635
  }
715
- function AuthDivider({ text = "or", className }) {
716
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(
717
- "flex justify-center items-center gap-6 self-stretch",
718
- "before:content-[''] before:flex-1 before:h-px before:bg-[#E5E5E5]",
719
- "after:content-[''] after:flex-1 after:h-px after:bg-[#E5E5E5]",
720
- className
721
- ), children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-semibold font-manrope text-[#A3A3A3] leading-normal", children: text }) });
636
+ function AuthDivider({ text = "or" }) {
637
+ return /* @__PURE__ */ jsxs("div", { className: "if-authDivider if-internal-ad7k3m", children: [
638
+ /* @__PURE__ */ jsx("div", { className: "if-authDivider-line" }),
639
+ /* @__PURE__ */ jsx("span", { className: "if-authDivider-text", children: text }),
640
+ /* @__PURE__ */ jsx("div", { className: "if-authDivider-line" })
641
+ ] });
722
642
  }
723
643
  var OAUTH_PROVIDER_CONFIG = {
724
644
  google: {
725
645
  name: "Google",
726
- svg: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", children: [
727
- /* @__PURE__ */ jsxRuntime.jsx(
646
+ svg: /* @__PURE__ */ jsxs("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", children: [
647
+ /* @__PURE__ */ jsx(
728
648
  "path",
729
649
  {
730
650
  d: "M17.64 9.2c0-.637-.057-1.251-.164-1.84H9v3.481h4.844c-.209 1.125-.843 2.078-1.796 2.717v2.258h2.908c1.702-1.567 2.684-3.874 2.684-6.615z",
731
651
  fill: "#4285F4"
732
652
  }
733
653
  ),
734
- /* @__PURE__ */ jsxRuntime.jsx(
654
+ /* @__PURE__ */ jsx(
735
655
  "path",
736
656
  {
737
657
  d: "M9 18c2.43 0 4.467-.806 5.956-2.184l-2.908-2.258c-.806.54-1.837.86-3.048.86-2.344 0-4.328-1.584-5.036-3.711H.957v2.332C2.438 15.983 5.482 18 9 18z",
738
658
  fill: "#34A853"
739
659
  }
740
660
  ),
741
- /* @__PURE__ */ jsxRuntime.jsx(
661
+ /* @__PURE__ */ jsx(
742
662
  "path",
743
663
  {
744
664
  d: "M3.964 10.707c-.18-.54-.282-1.117-.282-1.707 0-.593.102-1.17.282-1.709V4.958H.957C.347 6.173 0 7.548 0 9c0 1.452.348 2.827.957 4.042l3.007-2.335z",
745
665
  fill: "#FBBC05"
746
666
  }
747
667
  ),
748
- /* @__PURE__ */ jsxRuntime.jsx(
668
+ /* @__PURE__ */ jsx(
749
669
  "path",
750
670
  {
751
671
  d: "M9 3.58c1.321 0 2.508.454 3.44 1.345l2.582-2.58C13.463.891 11.426 0 9 0 5.482 0 2.438 2.017.957 4.958L3.964 7.29C4.672 5.163 6.656 3.58 9 3.58z",
@@ -757,12 +677,12 @@ var OAUTH_PROVIDER_CONFIG = {
757
677
  },
758
678
  github: {
759
679
  name: "GitHub",
760
- svg: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "18", height: "18", viewBox: "0 0 16 16", fill: "currentColor", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z" }) }),
680
+ svg: /* @__PURE__ */ jsx("svg", { width: "18", height: "18", viewBox: "0 0 16 16", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z" }) }),
761
681
  className: "insforge-oauth-github"
762
682
  },
763
683
  discord: {
764
684
  name: "Discord",
765
- svg: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
685
+ svg: /* @__PURE__ */ jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx(
766
686
  "path",
767
687
  {
768
688
  d: "M20.317 4.37a19.791 19.791 0 00-4.885-1.515.074.074 0 00-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 00-5.487 0 12.64 12.64 0 00-.617-1.25.077.077 0 00-.079-.037A19.736 19.736 0 003.677 4.37a.07.07 0 00-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 00.031.057 19.9 19.9 0 005.993 3.03.078.078 0 00.084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 00-.041-.106 13.107 13.107 0 01-1.872-.892.077.077 0 01-.008-.128 10.2 10.2 0 00.372-.292.074.074 0 01.077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 01.078.01c.12.098.246.198.373.292a.077.077 0 01-.006.127 12.299 12.299 0 01-1.873.892.077.077 0 00-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 00.084.028 19.839 19.839 0 006.002-3.03.077.077 0 00.032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 00-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.946 2.418-2.157 2.418z",
@@ -773,7 +693,7 @@ var OAUTH_PROVIDER_CONFIG = {
773
693
  },
774
694
  facebook: {
775
695
  name: "Facebook",
776
- svg: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
696
+ svg: /* @__PURE__ */ jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx(
777
697
  "path",
778
698
  {
779
699
  d: "M24 12.073C24 5.405 18.627 0 12 0S0 5.405 0 12.073C0 18.1 4.388 23.094 10.125 24v-8.437H7.078v-3.49h3.047v-2.66c0-3.025 1.792-4.697 4.533-4.697 1.312 0 2.686.236 2.686.236v2.971H15.83c-1.49 0-1.955.93-1.955 1.886v2.264h3.328l-.532 3.49h-2.796V24C19.612 23.094 24 18.1 24 12.073z",
@@ -784,7 +704,7 @@ var OAUTH_PROVIDER_CONFIG = {
784
704
  },
785
705
  linkedin: {
786
706
  name: "LinkedIn",
787
- svg: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
707
+ svg: /* @__PURE__ */ jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx(
788
708
  "path",
789
709
  {
790
710
  d: "M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 01-2.063-2.065 2.064 2.064 0 112.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z",
@@ -795,45 +715,45 @@ var OAUTH_PROVIDER_CONFIG = {
795
715
  },
796
716
  microsoft: {
797
717
  name: "Microsoft",
798
- svg: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "18", height: "18", viewBox: "0 0 23 23", fill: "none", children: [
799
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0 0h11v11H0z", fill: "#F25022" }),
800
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 0h11v11H12z", fill: "#7FBA00" }),
801
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0 12h11v11H0z", fill: "#00A4EF" }),
802
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 12h11v11H12z", fill: "#FFB900" })
718
+ svg: /* @__PURE__ */ jsxs("svg", { width: "18", height: "18", viewBox: "0 0 23 23", fill: "none", children: [
719
+ /* @__PURE__ */ jsx("path", { d: "M0 0h11v11H0z", fill: "#F25022" }),
720
+ /* @__PURE__ */ jsx("path", { d: "M12 0h11v11H12z", fill: "#7FBA00" }),
721
+ /* @__PURE__ */ jsx("path", { d: "M0 12h11v11H0z", fill: "#00A4EF" }),
722
+ /* @__PURE__ */ jsx("path", { d: "M12 12h11v11H12z", fill: "#FFB900" })
803
723
  ] }),
804
724
  className: "insforge-oauth-microsoft"
805
725
  },
806
726
  apple: {
807
727
  name: "Apple",
808
- svg: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M17.05 20.28c-.98.95-2.05.8-3.08.35-1.09-.46-2.09-.48-3.24 0-1.44.62-2.2.44-3.06-.35C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.54 4.09l.01-.01zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z" }) }),
728
+ svg: /* @__PURE__ */ jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M17.05 20.28c-.98.95-2.05.8-3.08.35-1.09-.46-2.09-.48-3.24 0-1.44.62-2.2.44-3.06-.35C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.54 4.09l.01-.01zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z" }) }),
809
729
  className: "insforge-oauth-apple"
810
730
  },
811
731
  x: {
812
732
  name: "X",
813
- svg: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z" }) }),
733
+ svg: /* @__PURE__ */ jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z" }) }),
814
734
  className: "insforge-oauth-x"
815
735
  },
816
736
  instagram: {
817
737
  name: "Instagram",
818
- svg: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", children: [
819
- /* @__PURE__ */ jsxRuntime.jsx(
738
+ svg: /* @__PURE__ */ jsxs("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", children: [
739
+ /* @__PURE__ */ jsx(
820
740
  "path",
821
741
  {
822
742
  d: "M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zM12 0C8.741 0 8.333.014 7.053.072 2.695.272.273 2.69.073 7.052.014 8.333 0 8.741 0 12c0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98C8.333 23.986 8.741 24 12 24c3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98C15.668.014 15.259 0 12 0zm0 5.838a6.162 6.162 0 100 12.324 6.162 6.162 0 000-12.324zM12 16a4 4 0 110-8 4 4 0 010 8zm6.406-11.845a1.44 1.44 0 100 2.881 1.44 1.44 0 000-2.881z",
823
743
  fill: "url(#instagram-gradient)"
824
744
  }
825
745
  ),
826
- /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs("linearGradient", { id: "instagram-gradient", x1: "0%", y1: "100%", x2: "100%", y2: "0%", children: [
827
- /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0%", stopColor: "#FD5949" }),
828
- /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "50%", stopColor: "#D6249F" }),
829
- /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "100%", stopColor: "#285AEB" })
746
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: "instagram-gradient", x1: "0%", y1: "100%", x2: "100%", y2: "0%", children: [
747
+ /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: "#FD5949" }),
748
+ /* @__PURE__ */ jsx("stop", { offset: "50%", stopColor: "#D6249F" }),
749
+ /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: "#285AEB" })
830
750
  ] }) })
831
751
  ] }),
832
752
  className: "insforge-oauth-instagram"
833
753
  },
834
754
  tiktok: {
835
755
  name: "TikTok",
836
- svg: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
756
+ svg: /* @__PURE__ */ jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx(
837
757
  "path",
838
758
  {
839
759
  d: "M19.589 6.686a4.793 4.793 0 01-3.77-4.245V2h-3.445v13.672a2.896 2.896 0 01-5.201 1.743l-.002-.001.002.001a2.895 2.895 0 013.183-4.51v-3.5a6.329 6.329 0 00-5.394 10.692 6.33 6.33 0 0010.857-4.424V8.687a8.182 8.182 0 004.773 1.526V6.79a4.831 4.831 0 01-1.003-.104z",
@@ -844,7 +764,7 @@ var OAUTH_PROVIDER_CONFIG = {
844
764
  },
845
765
  spotify: {
846
766
  name: "Spotify",
847
- svg: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
767
+ svg: /* @__PURE__ */ jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx(
848
768
  "path",
849
769
  {
850
770
  d: "M12 0C5.4 0 0 5.4 0 12s5.4 12 12 12 12-5.4 12-12S18.66 0 12 0zm5.521 17.34c-.24.359-.66.48-1.021.24-2.82-1.74-6.36-2.101-10.561-1.141-.418.122-.779-.179-.899-.539-.12-.421.18-.78.54-.9 4.56-1.021 8.52-.6 11.64 1.32.42.18.479.659.301 1.02zm1.44-3.3c-.301.42-.841.6-1.262.3-3.239-1.98-8.159-2.58-11.939-1.38-.479.12-1.02-.12-1.14-.6-.12-.48.12-1.021.6-1.141C9.6 9.9 15 10.561 18.72 12.84c.361.181.54.78.241 1.2zm.12-3.36C15.24 8.4 8.82 8.16 5.16 9.301c-.6.179-1.2-.181-1.38-.721-.18-.601.18-1.2.72-1.381 4.26-1.26 11.28-1.02 15.721 1.621.539.3.719 1.02.419 1.56-.299.421-1.02.599-1.559.3z",
@@ -866,43 +786,39 @@ function AuthOAuthButton({
866
786
  disabled,
867
787
  loading,
868
788
  displayMode = "full",
869
- style,
870
- className
789
+ style
871
790
  }) {
872
791
  const config = getProviderConfig(provider);
873
792
  if (!config) {
874
793
  return null;
875
794
  }
876
795
  const getButtonText = () => {
877
- if (loading) return "Authenticating...";
878
- if (displayMode === "full") return `Continue with ${config.name}`;
879
- if (displayMode === "short") return config.name;
796
+ if (displayMode === "full") {
797
+ return `Continue with ${config.name}`;
798
+ }
799
+ if (displayMode === "short") {
800
+ return config.name;
801
+ }
880
802
  return "";
881
803
  };
882
- return /* @__PURE__ */ jsxRuntime.jsxs(
804
+ const className = [
805
+ "if-oauthButton",
806
+ "if-internal-o4k7w2",
807
+ displayMode === "full" && "if-oauthButton-full",
808
+ displayMode === "short" && "if-oauthButton-short",
809
+ displayMode === "icon" && "if-oauthButton-icon-only"
810
+ ].filter(Boolean).join(" ");
811
+ return /* @__PURE__ */ jsxs(
883
812
  "button",
884
813
  {
885
814
  type: "button",
886
815
  onClick: () => onClick(provider),
887
- className: cn(
888
- "flex w-full h-9 px-3 py-2",
889
- "flex-row justify-center items-center gap-3",
890
- "rounded-md border border-[#E4E4E7] bg-white",
891
- "shadow-[0_1px_2px_0_rgba(0,0,0,0.10)]",
892
- "text-[#09090B] text-center text-sm font-medium leading-5",
893
- "cursor-pointer transition-all duration-200",
894
- "hover:bg-[#f9fafb] hover:border-[#9ca3af]",
895
- "disabled:opacity-60 disabled:cursor-not-allowed",
896
- displayMode === "full" && "justify-center",
897
- displayMode === "short" && "justify-center px-2 gap-2",
898
- displayMode === "icon" && "justify-center gap-0",
899
- className
900
- ),
816
+ className,
901
817
  disabled: disabled || loading,
902
818
  style,
903
819
  children: [
904
- loading ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "w-[18px] h-[18px] animate-spin", size: 18 }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex items-center justify-center shrink-0", children: config.svg }),
905
- getButtonText() && /* @__PURE__ */ jsxRuntime.jsx("span", { children: getButtonText() })
820
+ loading ? /* @__PURE__ */ jsx(Loader2, { className: "if-oauthButton-icon if-submitButton-spinner", size: 18 }) : /* @__PURE__ */ jsx("span", { className: "if-oauthButton-icon", children: config.svg }),
821
+ getButtonText() && /* @__PURE__ */ jsx("span", { children: getButtonText() })
906
822
  ]
907
823
  }
908
824
  );
@@ -911,16 +827,19 @@ function AuthOAuthProviders({
911
827
  providers,
912
828
  onClick,
913
829
  disabled,
914
- loading,
915
- appearance = {}
830
+ loading
916
831
  }) {
917
832
  if (!providers || providers.length === 0) {
918
833
  return null;
919
834
  }
920
835
  const count = providers.length;
921
836
  const getDisplayMode = () => {
922
- if (count === 1) return "full";
923
- if (count === 2 || count === 4) return "short";
837
+ if (count === 1) {
838
+ return "full";
839
+ }
840
+ if (count === 2 || count === 4) {
841
+ return "short";
842
+ }
924
843
  return "icon";
925
844
  };
926
845
  const getGridColumnStyle = (index) => {
@@ -956,22 +875,30 @@ function AuthOAuthProviders({
956
875
  return { gridColumn: "span 2 / span 2" };
957
876
  }
958
877
  };
959
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(
960
- "grid gap-3 w-full grid-cols-6",
961
- appearance.containerClassName
962
- ), children: providers.map((provider, index) => /* @__PURE__ */ jsxRuntime.jsx(
963
- AuthOAuthButton,
878
+ return /* @__PURE__ */ jsx(
879
+ "div",
964
880
  {
965
- provider,
966
- onClick,
967
- disabled,
968
- loading: loading === provider,
969
- displayMode: getDisplayMode(),
970
- style: getGridColumnStyle(index),
971
- className: appearance.buttonClassName
972
- },
973
- provider
974
- )) });
881
+ className: "if-oauthProviders if-internal-op3m8k",
882
+ style: {
883
+ display: "grid",
884
+ gridTemplateColumns: "repeat(6, 1fr)",
885
+ gap: "0.75rem",
886
+ width: "100%"
887
+ },
888
+ children: providers.map((provider, index) => /* @__PURE__ */ jsx(
889
+ AuthOAuthButton,
890
+ {
891
+ provider,
892
+ onClick,
893
+ disabled,
894
+ loading: loading === provider,
895
+ displayMode: getDisplayMode(),
896
+ style: getGridColumnStyle(index)
897
+ },
898
+ provider
899
+ ))
900
+ }
901
+ );
975
902
  }
976
903
  function AuthVerificationCodeInput({
977
904
  length = 6,
@@ -979,13 +906,16 @@ function AuthVerificationCodeInput({
979
906
  email,
980
907
  onChange,
981
908
  disabled = false,
982
- onComplete,
983
- appearance = {}
909
+ onComplete
984
910
  }) {
985
- const inputRefs = react.useRef([]);
911
+ const inputRefs = useRef([]);
986
912
  const handleChange = (index, digit) => {
987
- if (digit.length > 1) return;
988
- if (digit && !/^\d$/.test(digit)) return;
913
+ if (digit.length > 1) {
914
+ return;
915
+ }
916
+ if (digit && !/^\d$/.test(digit)) {
917
+ return;
918
+ }
989
919
  const newValue = value.split("");
990
920
  newValue[index] = digit;
991
921
  const updatedValue = newValue.join("");
@@ -1021,17 +951,14 @@ function AuthVerificationCodeInput({
1021
951
  }
1022
952
  }
1023
953
  };
1024
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(
1025
- "flex flex-col justify-center items-center gap-6",
1026
- appearance.containerClassName
1027
- ), children: [
1028
- /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm font-normal text-[#525252] leading-5", children: [
954
+ return /* @__PURE__ */ jsxs("div", { className: "if-verificationCode if-internal-vc8m4p", children: [
955
+ /* @__PURE__ */ jsxs("p", { className: "if-verificationCode-description", children: [
1029
956
  "We've sent a verification code to your inbox at",
1030
957
  " ",
1031
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-semibold text-black leading-5", children: email }),
958
+ /* @__PURE__ */ jsx("span", { className: "if-verificationCode-email", children: email }),
1032
959
  ". Enter it below to proceed."
1033
960
  ] }),
1034
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-row gap-3 justify-center items-center", children: Array.from({ length }).map((_, index) => /* @__PURE__ */ jsxRuntime.jsx(
961
+ /* @__PURE__ */ jsx("div", { className: "if-verificationCode-inputContainer", children: Array.from({ length }).map((_, index) => /* @__PURE__ */ jsx(
1035
962
  "input",
1036
963
  {
1037
964
  ref: (el) => {
@@ -1045,14 +972,7 @@ function AuthVerificationCodeInput({
1045
972
  onKeyDown: (e) => handleKeyDown(index, e),
1046
973
  onPaste: handlePaste,
1047
974
  disabled,
1048
- className: cn(
1049
- "w-full h-12 px-3 py-2 rounded border border-[#E0E0E0] bg-white",
1050
- "text-center text-base font-semibold leading-5 text-black",
1051
- "transition-all duration-200 outline-none",
1052
- "focus:border-black focus:shadow-[0_0_0_2px_rgba(0,0,0,0.1)]",
1053
- "disabled:bg-[#F5F5F5] disabled:cursor-not-allowed disabled:opacity-60",
1054
- appearance.inputClassName
1055
- ),
975
+ className: "if-verificationCode-input",
1056
976
  autoComplete: "one-time-code"
1057
977
  },
1058
978
  index
@@ -1061,29 +981,27 @@ function AuthVerificationCodeInput({
1061
981
  }
1062
982
  function AuthEmailVerificationStep({
1063
983
  email,
1064
- description,
1065
984
  method = "code",
1066
985
  onVerifyCode
1067
986
  }) {
1068
- const { baseUrl } = useInsforge();
1069
- const [insforge] = react.useState(() => sdk.createClient({ baseUrl }));
1070
- const [resendDisabled, setResendDisabled] = react.useState(true);
1071
- const [resendCountdown, setResendCountdown] = react.useState(60);
1072
- const [isSending, setIsSending] = react.useState(false);
1073
- const [verificationCode, setVerificationCode] = react.useState("");
1074
- const [isVerifying, setIsVerifying] = react.useState(false);
1075
- const [verificationError, setVerificationError] = react.useState("");
987
+ const { sendVerificationEmail } = useInsforge();
988
+ const [resendDisabled, setResendDisabled] = useState(true);
989
+ const [resendCountdown, setResendCountdown] = useState(60);
990
+ const [isSending, setIsSending] = useState(false);
991
+ const [verificationCode, setVerificationCode] = useState("");
992
+ const [isVerifying, setIsVerifying] = useState(false);
1076
993
  const defaultDescription = method === "code" ? "We've sent a 6-digit verification code to {email}. Please enter it below to verify your account. The code will expire in 10 minutes." : "We've sent a verification link to {email}. Please check your email and click the link to verify your account. The link will expire in 10 minutes.";
1077
- react.useEffect(() => {
994
+ useEffect(() => {
1078
995
  const sendInitialEmail = async () => {
1079
996
  try {
1080
- await insforge.auth.sendVerificationEmail({ email });
1081
- } catch {
997
+ await sendVerificationEmail(email);
998
+ } catch (error) {
999
+ console.error("Failed to send verification email:", error);
1082
1000
  }
1083
1001
  };
1084
1002
  void sendInitialEmail();
1085
- }, [email, method, insforge.auth]);
1086
- react.useEffect(() => {
1003
+ }, [email, sendVerificationEmail]);
1004
+ useEffect(() => {
1087
1005
  if (resendCountdown > 0) {
1088
1006
  const timer = setInterval(() => {
1089
1007
  setResendCountdown((prev) => {
@@ -1101,9 +1019,8 @@ function AuthEmailVerificationStep({
1101
1019
  setResendDisabled(true);
1102
1020
  setResendCountdown(60);
1103
1021
  setIsSending(true);
1104
- setVerificationError("");
1105
1022
  try {
1106
- await insforge.auth.sendVerificationEmail({ email });
1023
+ await sendVerificationEmail(email);
1107
1024
  } catch {
1108
1025
  setResendDisabled(false);
1109
1026
  setResendCountdown(0);
@@ -1111,59 +1028,153 @@ function AuthEmailVerificationStep({
1111
1028
  setIsSending(false);
1112
1029
  }
1113
1030
  };
1114
- const handleVerifyCode = async (code) => {
1115
- if (!onVerifyCode) {
1031
+ const handleSubmit = async () => {
1032
+ if (!onVerifyCode || verificationCode.length !== 6) {
1116
1033
  return;
1117
1034
  }
1118
1035
  setIsVerifying(true);
1119
- setVerificationError("");
1120
1036
  try {
1121
- await onVerifyCode(code);
1122
- } catch (error) {
1123
- setVerificationError(
1124
- error instanceof Error ? error.message : "Invalid verification code. Please try again."
1125
- );
1126
- setVerificationCode("");
1037
+ await onVerifyCode(verificationCode);
1127
1038
  } finally {
1128
1039
  setIsVerifying(false);
1040
+ setVerificationCode("");
1129
1041
  }
1130
1042
  };
1131
- const displayDescription = description || defaultDescription;
1132
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-6 items-stretch", children: [
1133
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-neutral-600 dark:text-neutral-400 leading-relaxed", children: displayDescription.split("{email}").map((part, index, array) => /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
1043
+ const displayDescription = defaultDescription;
1044
+ const isLinkMethod = method === "link";
1045
+ return /* @__PURE__ */ jsxs("div", { className: "if-verificationStep", children: [
1046
+ /* @__PURE__ */ jsx("p", { className: "if-verificationStep-description", children: displayDescription.split("{email}").map((part, index, array) => /* @__PURE__ */ jsxs("span", { children: [
1134
1047
  part,
1135
- index < array.length - 1 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium text-black dark:text-white", children: email })
1048
+ index < array.length - 1 && /* @__PURE__ */ jsx("span", { className: "if-verificationCode-email", children: email })
1136
1049
  ] }, index)) }),
1137
- verificationError && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pl-3 py-2 pr-2 bg-red-50 border-2 border-red-600 rounded", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
1138
- /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "w-6 h-6 text-red-500 shrink-0", fill: "none", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" }) }),
1139
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-red-600 flex-1", children: verificationError })
1140
- ] }) }),
1141
- method === "code" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full bg-neutral-100 dark:bg-neutral-800 rounded-lg px-4 pt-4 pb-6 flex flex-col gap-4", children: [
1142
- /* @__PURE__ */ jsxRuntime.jsx(
1050
+ !isLinkMethod && /* @__PURE__ */ jsxs("div", { className: "if-verificationStep-codeContainer", children: [
1051
+ /* @__PURE__ */ jsx("div", { className: "if-verificationStep-codeInputWrapper", children: /* @__PURE__ */ jsx(
1143
1052
  AuthVerificationCodeInput,
1144
1053
  {
1145
1054
  value: verificationCode,
1146
1055
  onChange: setVerificationCode,
1147
1056
  email,
1148
- disabled: isVerifying,
1149
- onComplete: (code) => {
1150
- void handleVerifyCode(code);
1057
+ disabled: isVerifying
1058
+ }
1059
+ ) }),
1060
+ /* @__PURE__ */ jsx(
1061
+ AuthSubmitButton,
1062
+ {
1063
+ type: "button",
1064
+ isLoading: isVerifying,
1065
+ disabled: isVerifying || verificationCode.length !== 6,
1066
+ onClick: () => {
1067
+ void handleSubmit();
1068
+ },
1069
+ children: isVerifying ? "Verifying..." : "Verify Code"
1070
+ }
1071
+ )
1072
+ ] }),
1073
+ /* @__PURE__ */ jsxs("div", { className: "if-verificationStep-resendContainer", children: [
1074
+ "Didn't receive the email?",
1075
+ " ",
1076
+ /* @__PURE__ */ jsx(
1077
+ "button",
1078
+ {
1079
+ onClick: () => {
1080
+ void handleResend();
1081
+ },
1082
+ disabled: resendDisabled || isSending,
1083
+ className: "if-verificationStep-resendButton",
1084
+ children: isSending ? "Sending..." : resendDisabled ? `Retry in (${resendCountdown}s)` : "Click to resend"
1085
+ }
1086
+ )
1087
+ ] })
1088
+ ] });
1089
+ }
1090
+ function AuthResetPasswordVerificationStep({
1091
+ email,
1092
+ method,
1093
+ onVerifyCode,
1094
+ onResendEmail
1095
+ }) {
1096
+ const [resendDisabled, setResendDisabled] = useState(true);
1097
+ const [resendCountdown, setResendCountdown] = useState(60);
1098
+ const [isSending, setIsSending] = useState(false);
1099
+ const [verificationCode, setVerificationCode] = useState("");
1100
+ const [isVerifying, setIsVerifying] = useState(false);
1101
+ useEffect(() => {
1102
+ if (resendCountdown > 0) {
1103
+ const timer = setInterval(() => {
1104
+ setResendCountdown((prev) => {
1105
+ if (prev <= 1) {
1106
+ setResendDisabled(false);
1107
+ return 0;
1151
1108
  }
1109
+ return prev - 1;
1110
+ });
1111
+ }, 1e3);
1112
+ return () => clearInterval(timer);
1113
+ }
1114
+ }, [resendCountdown]);
1115
+ const handleResend = useCallback(async () => {
1116
+ setResendDisabled(true);
1117
+ setResendCountdown(60);
1118
+ setIsSending(true);
1119
+ try {
1120
+ await onResendEmail();
1121
+ } catch {
1122
+ setResendDisabled(false);
1123
+ setResendCountdown(0);
1124
+ } finally {
1125
+ setIsSending(false);
1126
+ }
1127
+ }, [onResendEmail]);
1128
+ const handleSubmit = async () => {
1129
+ if (!onVerifyCode || verificationCode.length !== 6) {
1130
+ return;
1131
+ }
1132
+ setIsVerifying(true);
1133
+ try {
1134
+ await onVerifyCode(verificationCode);
1135
+ } finally {
1136
+ setIsVerifying(false);
1137
+ setVerificationCode("");
1138
+ }
1139
+ };
1140
+ const isLinkMethod = method === "link";
1141
+ const description = isLinkMethod ? `We've sent a password reset link to ${email}. Please check your email and click the link to reset your password. The link will expire in 10 minutes.` : `We've sent a 6-digit verification code to ${email}. Please enter it below to reset your password. The code will expire in 10 minutes.`;
1142
+ return /* @__PURE__ */ jsxs("div", { className: "if-verificationStep", children: [
1143
+ /* @__PURE__ */ jsx("p", { className: "if-verificationStep-description", children: description }),
1144
+ !isLinkMethod && /* @__PURE__ */ jsxs("div", { className: "if-verificationStep-codeContainer", children: [
1145
+ /* @__PURE__ */ jsx("div", { className: "if-verificationStep-codeInputWrapper", children: /* @__PURE__ */ jsx(
1146
+ AuthVerificationCodeInput,
1147
+ {
1148
+ value: verificationCode,
1149
+ onChange: setVerificationCode,
1150
+ email,
1151
+ disabled: isVerifying
1152
1152
  }
1153
- ),
1154
- isVerifying && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-neutral-600 dark:text-neutral-400 text-center", children: "Verifying..." })
1153
+ ) }),
1154
+ /* @__PURE__ */ jsx(
1155
+ AuthSubmitButton,
1156
+ {
1157
+ type: "button",
1158
+ isLoading: isVerifying,
1159
+ disabled: isVerifying || verificationCode.length !== 6,
1160
+ onClick: () => {
1161
+ void handleSubmit();
1162
+ },
1163
+ children: isVerifying ? "Verifying..." : "Continue"
1164
+ }
1165
+ )
1155
1166
  ] }),
1156
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full text-sm text-center text-neutral-600 dark:text-neutral-400", children: [
1167
+ /* @__PURE__ */ jsxs("div", { className: "if-verificationStep-resendContainer", children: [
1157
1168
  "Didn't receive the email?",
1158
1169
  " ",
1159
- /* @__PURE__ */ jsxRuntime.jsx(
1170
+ /* @__PURE__ */ jsx(
1160
1171
  "button",
1161
1172
  {
1162
1173
  onClick: () => {
1163
1174
  void handleResend();
1164
1175
  },
1165
1176
  disabled: resendDisabled || isSending,
1166
- className: "text-black dark:text-white font-medium transition-colors disabled:cursor-not-allowed cursor-pointer hover:underline disabled:no-underline disabled:opacity-50",
1177
+ className: "if-verificationStep-resendButton",
1167
1178
  children: isSending ? "Sending..." : resendDisabled ? `Retry in (${resendCountdown}s)` : "Click to resend"
1168
1179
  }
1169
1180
  )
@@ -1182,7 +1193,6 @@ function SignInForm({
1182
1193
  availableProviders = [],
1183
1194
  onOAuthClick,
1184
1195
  authConfig,
1185
- appearance = {},
1186
1196
  title = "Welcome Back",
1187
1197
  subtitle = "Login to your account",
1188
1198
  emailLabel = "Email",
@@ -1197,161 +1207,79 @@ function SignInForm({
1197
1207
  signUpLinkText = "Sign Up Now",
1198
1208
  signUpUrl = "/sign-up",
1199
1209
  dividerText = "or",
1200
- // Email verification step props
1201
1210
  showVerificationStep = false,
1202
- onVerifyCode,
1203
- verificationDescription
1211
+ onVerifyCode
1204
1212
  }) {
1205
- return /* @__PURE__ */ jsxRuntime.jsxs(
1206
- AuthContainer,
1207
- {
1208
- appearance: {
1209
- containerClassName: appearance.container,
1210
- cardClassName: appearance.card
1211
- },
1212
- children: [
1213
- /* @__PURE__ */ jsxRuntime.jsx(
1214
- AuthHeader,
1215
- {
1216
- title: showVerificationStep ? "Verify Your Email" : title,
1217
- subtitle: showVerificationStep ? "" : subtitle,
1218
- appearance: {
1219
- containerClassName: appearance.header?.container,
1220
- titleClassName: appearance.header?.title,
1221
- subtitleClassName: appearance.header?.subtitle
1222
- }
1223
- }
1224
- ),
1225
- /* @__PURE__ */ jsxRuntime.jsx(
1226
- AuthErrorBanner,
1227
- {
1228
- error: error || "",
1229
- className: appearance.errorBanner
1230
- }
1231
- ),
1232
- showVerificationStep ? /* @__PURE__ */ jsxRuntime.jsx(
1233
- AuthEmailVerificationStep,
1234
- {
1235
- email,
1236
- description: verificationDescription,
1237
- onVerifyCode
1238
- }
1239
- ) : /* @__PURE__ */ jsxRuntime.jsxs(
1240
- "form",
1213
+ return /* @__PURE__ */ jsxs(AuthContainer, { children: [
1214
+ /* @__PURE__ */ jsx(
1215
+ AuthHeader,
1216
+ {
1217
+ title: showVerificationStep ? "Verify Your Email" : title,
1218
+ subtitle: showVerificationStep ? "" : subtitle
1219
+ }
1220
+ ),
1221
+ /* @__PURE__ */ jsx(AuthErrorBanner, { error: error || "" }),
1222
+ showVerificationStep ? /* @__PURE__ */ jsx(AuthEmailVerificationStep, { email, onVerifyCode }) : /* @__PURE__ */ jsxs("form", { onSubmit, noValidate: true, className: "if-form if-internal-fm9k2p", children: [
1223
+ /* @__PURE__ */ jsx(
1224
+ AuthFormField,
1225
+ {
1226
+ id: "email",
1227
+ type: "email",
1228
+ label: emailLabel,
1229
+ placeholder: emailPlaceholder,
1230
+ value: email,
1231
+ onChange: (e) => onEmailChange(e.target.value),
1232
+ required: true,
1233
+ autoComplete: "email"
1234
+ }
1235
+ ),
1236
+ /* @__PURE__ */ jsx(
1237
+ AuthPasswordField,
1238
+ {
1239
+ id: "password",
1240
+ label: passwordLabel,
1241
+ placeholder: passwordPlaceholder,
1242
+ value: password,
1243
+ onChange: (e) => onPasswordChange(e.target.value),
1244
+ required: true,
1245
+ autoComplete: "current-password",
1246
+ authConfig,
1247
+ forgotPasswordLink: forgotPasswordUrl ? {
1248
+ href: forgotPasswordUrl,
1249
+ text: forgotPasswordText
1250
+ } : void 0
1251
+ }
1252
+ ),
1253
+ /* @__PURE__ */ jsx(AuthSubmitButton, { isLoading: loading, disabled: loading || oauthLoading !== null, children: loading ? loadingButtonText : submitButtonText })
1254
+ ] }),
1255
+ !showVerificationStep && /* @__PURE__ */ jsxs(Fragment, { children: [
1256
+ /* @__PURE__ */ jsx(AuthLink, { text: signUpText, linkText: signUpLinkText, href: signUpUrl }),
1257
+ availableProviders.length > 0 && onOAuthClick && /* @__PURE__ */ jsxs(Fragment, { children: [
1258
+ /* @__PURE__ */ jsx(AuthDivider, { text: dividerText }),
1259
+ /* @__PURE__ */ jsx(
1260
+ AuthOAuthProviders,
1241
1261
  {
1242
- onSubmit,
1243
- noValidate: true,
1244
- className: appearance.form?.container || "flex flex-col items-stretch justify-center gap-6",
1245
- children: [
1246
- /* @__PURE__ */ jsxRuntime.jsx(
1247
- AuthFormField,
1248
- {
1249
- id: "email",
1250
- type: "email",
1251
- label: emailLabel,
1252
- placeholder: emailPlaceholder,
1253
- value: email,
1254
- onChange: (e) => onEmailChange(e.target.value),
1255
- required: true,
1256
- autoComplete: "email",
1257
- appearance: {
1258
- containerClassName: appearance.form?.emailField?.container,
1259
- labelClassName: appearance.form?.emailField?.label,
1260
- inputClassName: appearance.form?.emailField?.input
1261
- }
1262
- }
1263
- ),
1264
- /* @__PURE__ */ jsxRuntime.jsx(
1265
- AuthPasswordField,
1266
- {
1267
- id: "password",
1268
- label: passwordLabel,
1269
- placeholder: passwordPlaceholder,
1270
- value: password,
1271
- onChange: (e) => onPasswordChange(e.target.value),
1272
- required: true,
1273
- autoComplete: "current-password",
1274
- authConfig,
1275
- forgotPasswordLink: forgotPasswordUrl ? {
1276
- href: forgotPasswordUrl,
1277
- text: forgotPasswordText
1278
- } : void 0,
1279
- appearance: {
1280
- containerClassName: appearance.form?.passwordField?.container,
1281
- labelClassName: appearance.form?.passwordField?.label,
1282
- inputClassName: appearance.form?.passwordField?.input
1283
- }
1284
- }
1285
- ),
1286
- /* @__PURE__ */ jsxRuntime.jsx(
1287
- AuthSubmitButton,
1288
- {
1289
- isLoading: loading,
1290
- disabled: loading || oauthLoading !== null,
1291
- className: appearance.button,
1292
- children: loading ? loadingButtonText : submitButtonText
1293
- }
1294
- )
1295
- ]
1262
+ providers: availableProviders,
1263
+ onClick: onOAuthClick,
1264
+ disabled: loading || oauthLoading !== null,
1265
+ loading: oauthLoading
1296
1266
  }
1297
- ),
1298
- !showVerificationStep && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1299
- /* @__PURE__ */ jsxRuntime.jsx(
1300
- AuthLink,
1301
- {
1302
- text: signUpText,
1303
- linkText: signUpLinkText,
1304
- href: signUpUrl,
1305
- appearance: {
1306
- containerClassName: appearance.link?.container,
1307
- linkClassName: appearance.link?.link
1308
- }
1309
- }
1310
- ),
1311
- availableProviders.length > 0 && onOAuthClick && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1312
- /* @__PURE__ */ jsxRuntime.jsx(
1313
- AuthDivider,
1314
- {
1315
- text: dividerText,
1316
- className: appearance.divider
1317
- }
1318
- ),
1319
- /* @__PURE__ */ jsxRuntime.jsx(
1320
- AuthOAuthProviders,
1321
- {
1322
- providers: availableProviders,
1323
- onClick: onOAuthClick,
1324
- disabled: loading || oauthLoading !== null,
1325
- loading: oauthLoading,
1326
- appearance: {
1327
- containerClassName: appearance.oauth?.container,
1328
- buttonClassName: appearance.oauth?.button
1329
- }
1330
- }
1331
- )
1332
- ] })
1333
- ] })
1334
- ]
1335
- }
1336
- );
1267
+ )
1268
+ ] })
1269
+ ] })
1270
+ ] });
1337
1271
  }
1338
- function SignIn({
1339
- afterSignInUrl,
1340
- onSuccess,
1341
- onError,
1342
- ...uiProps
1343
- }) {
1344
- const { signIn, baseUrl } = useInsforge();
1272
+ function SignIn({ onError, ...uiProps }) {
1273
+ const { signIn, verifyEmail, loginWithOAuth } = useInsforge();
1345
1274
  const { authConfig } = usePublicAuthConfig();
1346
- const [email, setEmail] = react.useState("");
1347
- const [password, setPassword] = react.useState("");
1348
- const [error, setError] = react.useState("");
1349
- const [loading, setLoading] = react.useState(false);
1350
- const [step, setStep] = react.useState("form");
1351
- const [oauthLoading, setOauthLoading] = react.useState(
1352
- null
1353
- );
1354
- const [insforge] = react.useState(() => sdk.createClient({ baseUrl }));
1275
+ const [email, setEmail] = useState("");
1276
+ const [password, setPassword] = useState("");
1277
+ const [error, setError] = useState("");
1278
+ const [loading, setLoading] = useState(false);
1279
+ const [step, setStep] = useState("form");
1280
+ const [oauthLoading] = useState(null);
1281
+ const [searchParams] = useSearchParams();
1282
+ const redirectUrl = searchParams.get("redirect");
1355
1283
  async function handleSubmit(e) {
1356
1284
  e.preventDefault();
1357
1285
  setLoading(true);
@@ -1367,51 +1295,51 @@ function SignIn({
1367
1295
  throw new Error(result.error);
1368
1296
  }
1369
1297
  const { user, accessToken, redirectTo } = result;
1370
- if (onSuccess) {
1371
- if (user) onSuccess(user, accessToken || "", redirectTo);
1298
+ if (user) {
1299
+ const finalUrl = new URL(redirectTo || redirectUrl || "", window.location.origin);
1300
+ finalUrl.searchParams.set("access_token", accessToken);
1301
+ finalUrl.searchParams.set("user_id", user.id);
1302
+ finalUrl.searchParams.set("email", user.email);
1303
+ finalUrl.searchParams.set("name", user.name);
1304
+ window.location.href = finalUrl.toString();
1372
1305
  }
1373
1306
  } catch (err) {
1374
- const errorMessage = err.message || "Sign in failed";
1307
+ const errorMessage = err instanceof Error ? err.message : "Sign in failed";
1375
1308
  setError(errorMessage);
1376
- if (onError) onError(new Error(errorMessage));
1309
+ if (onError) {
1310
+ onError(new Error(errorMessage));
1311
+ }
1377
1312
  } finally {
1378
1313
  setLoading(false);
1379
1314
  }
1380
1315
  }
1381
1316
  async function handleVerifyCode(code) {
1317
+ setError("");
1382
1318
  try {
1383
- const result = await insforge.auth.verifyEmail({ email, otp: code });
1384
- if (result.error) {
1319
+ const result = await verifyEmail(email, code);
1320
+ if (result?.error) {
1385
1321
  throw new Error(result.error.message || "Verification failed");
1386
1322
  }
1387
- if (result.data?.accessToken) {
1388
- if (onSuccess && result.data.user) {
1389
- onSuccess(result.data.user, result.data.accessToken);
1390
- }
1323
+ if (result?.user) {
1324
+ const finalUrl = new URL(result.redirectTo || redirectUrl || "", window.location.origin);
1325
+ finalUrl.searchParams.set("access_token", result.accessToken);
1326
+ finalUrl.searchParams.set("user_id", result.user.id);
1327
+ finalUrl.searchParams.set("email", result.user.email);
1328
+ finalUrl.searchParams.set("name", result.user.name);
1329
+ window.location.href = finalUrl.toString();
1391
1330
  }
1392
1331
  } catch (err) {
1393
- throw new Error(err.message || "Invalid verification code");
1394
- }
1395
- }
1396
- async function handleOAuth(provider) {
1397
- try {
1398
- setOauthLoading(provider);
1399
- setError("");
1400
- await insforge.auth.signInWithOAuth({
1401
- provider,
1402
- redirectTo: afterSignInUrl
1403
- });
1404
- } catch (err) {
1405
- const errorMessage = err.message || `${provider} sign in failed`;
1332
+ const errorMessage = err instanceof Error ? err.message : "Invalid verification code";
1406
1333
  setError(errorMessage);
1407
- if (onError) onError(new Error(errorMessage));
1408
- setOauthLoading(null);
1409
1334
  }
1410
1335
  }
1336
+ function handleOAuth(provider) {
1337
+ loginWithOAuth(provider, redirectUrl || "");
1338
+ }
1411
1339
  if (!authConfig) {
1412
1340
  return null;
1413
1341
  }
1414
- return /* @__PURE__ */ jsxRuntime.jsx(
1342
+ return /* @__PURE__ */ jsx(
1415
1343
  SignInForm,
1416
1344
  {
1417
1345
  email,
@@ -1443,7 +1371,6 @@ function SignUpForm({
1443
1371
  availableProviders = [],
1444
1372
  onOAuthClick,
1445
1373
  authConfig,
1446
- appearance = {},
1447
1374
  title = "Get Started",
1448
1375
  subtitle = "Create your account",
1449
1376
  emailLabel = "Email",
@@ -1456,143 +1383,67 @@ function SignUpForm({
1456
1383
  signInLinkText = "Login Now",
1457
1384
  signInUrl = "/sign-in",
1458
1385
  dividerText = "or",
1459
- // Email verification step props
1460
1386
  showVerificationStep = false,
1461
- onVerifyCode,
1462
- verificationDescription
1387
+ onVerifyCode
1463
1388
  }) {
1464
- return /* @__PURE__ */ jsxRuntime.jsxs(
1465
- AuthContainer,
1466
- {
1467
- appearance: {
1468
- containerClassName: appearance.container,
1469
- cardClassName: appearance.card
1470
- },
1471
- children: [
1472
- /* @__PURE__ */ jsxRuntime.jsx(
1473
- AuthHeader,
1474
- {
1475
- title: showVerificationStep ? "Verify Your Email" : title,
1476
- subtitle: showVerificationStep ? "" : subtitle,
1477
- appearance: {
1478
- containerClassName: appearance.header?.container,
1479
- titleClassName: appearance.header?.title,
1480
- subtitleClassName: appearance.header?.subtitle
1481
- }
1482
- }
1483
- ),
1484
- /* @__PURE__ */ jsxRuntime.jsx(
1485
- AuthErrorBanner,
1486
- {
1487
- error: error || "",
1488
- className: appearance.errorBanner
1489
- }
1490
- ),
1491
- showVerificationStep ? /* @__PURE__ */ jsxRuntime.jsx(
1492
- AuthEmailVerificationStep,
1493
- {
1494
- email,
1495
- description: verificationDescription,
1496
- onVerifyCode
1497
- }
1498
- ) : /* @__PURE__ */ jsxRuntime.jsxs(
1499
- "form",
1389
+ return /* @__PURE__ */ jsxs(AuthContainer, { children: [
1390
+ /* @__PURE__ */ jsx(
1391
+ AuthHeader,
1392
+ {
1393
+ title: showVerificationStep ? "Verify Your Email" : title,
1394
+ subtitle: showVerificationStep ? "" : subtitle
1395
+ }
1396
+ ),
1397
+ /* @__PURE__ */ jsx(AuthErrorBanner, { error: error || "" }),
1398
+ showVerificationStep ? /* @__PURE__ */ jsx(AuthEmailVerificationStep, { email, onVerifyCode }) : /* @__PURE__ */ jsxs("form", { onSubmit, noValidate: true, className: "if-form if-internal-fm9k2p", children: [
1399
+ /* @__PURE__ */ jsx(
1400
+ AuthFormField,
1401
+ {
1402
+ id: "email",
1403
+ type: "email",
1404
+ label: emailLabel,
1405
+ placeholder: emailPlaceholder,
1406
+ value: email,
1407
+ onChange: (e) => onEmailChange(e.target.value),
1408
+ required: true,
1409
+ autoComplete: "email"
1410
+ }
1411
+ ),
1412
+ /* @__PURE__ */ jsx(
1413
+ AuthPasswordField,
1414
+ {
1415
+ id: "password",
1416
+ label: passwordLabel,
1417
+ placeholder: passwordPlaceholder,
1418
+ value: password,
1419
+ onChange: (e) => onPasswordChange(e.target.value),
1420
+ required: true,
1421
+ minLength: authConfig.passwordMinLength,
1422
+ autoComplete: "new-password",
1423
+ showStrengthIndicator: true,
1424
+ authConfig
1425
+ }
1426
+ ),
1427
+ /* @__PURE__ */ jsx(AuthSubmitButton, { isLoading: loading, disabled: loading || oauthLoading !== null, children: loading ? loadingButtonText : submitButtonText })
1428
+ ] }),
1429
+ !showVerificationStep && /* @__PURE__ */ jsxs(Fragment, { children: [
1430
+ /* @__PURE__ */ jsx(AuthLink, { text: signInText, linkText: signInLinkText, href: signInUrl }),
1431
+ availableProviders.length > 0 && onOAuthClick && /* @__PURE__ */ jsxs(Fragment, { children: [
1432
+ /* @__PURE__ */ jsx(AuthDivider, { text: dividerText }),
1433
+ /* @__PURE__ */ jsx(
1434
+ AuthOAuthProviders,
1500
1435
  {
1501
- onSubmit,
1502
- noValidate: true,
1503
- className: appearance.form?.container || "flex flex-col items-stretch justify-center gap-6",
1504
- children: [
1505
- /* @__PURE__ */ jsxRuntime.jsx(
1506
- AuthFormField,
1507
- {
1508
- id: "email",
1509
- type: "email",
1510
- label: emailLabel,
1511
- placeholder: emailPlaceholder,
1512
- value: email,
1513
- onChange: (e) => onEmailChange(e.target.value),
1514
- required: true,
1515
- autoComplete: "email",
1516
- appearance: {
1517
- containerClassName: appearance.form?.emailField?.container,
1518
- labelClassName: appearance.form?.emailField?.label,
1519
- inputClassName: appearance.form?.emailField?.input
1520
- }
1521
- }
1522
- ),
1523
- /* @__PURE__ */ jsxRuntime.jsx(
1524
- AuthPasswordField,
1525
- {
1526
- id: "password",
1527
- label: passwordLabel,
1528
- placeholder: passwordPlaceholder,
1529
- value: password,
1530
- onChange: (e) => onPasswordChange(e.target.value),
1531
- required: true,
1532
- minLength: authConfig.passwordMinLength,
1533
- autoComplete: "new-password",
1534
- showStrengthIndicator: true,
1535
- authConfig,
1536
- appearance: {
1537
- containerClassName: appearance.form?.passwordField?.container,
1538
- labelClassName: appearance.form?.passwordField?.label,
1539
- inputClassName: appearance.form?.passwordField?.input
1540
- }
1541
- }
1542
- ),
1543
- /* @__PURE__ */ jsxRuntime.jsx(
1544
- AuthSubmitButton,
1545
- {
1546
- isLoading: loading,
1547
- disabled: loading || oauthLoading !== null,
1548
- className: appearance.button,
1549
- children: loading ? loadingButtonText : submitButtonText
1550
- }
1551
- )
1552
- ]
1436
+ providers: availableProviders,
1437
+ onClick: onOAuthClick,
1438
+ disabled: loading || oauthLoading !== null,
1439
+ loading: oauthLoading
1553
1440
  }
1554
- ),
1555
- !showVerificationStep && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1556
- /* @__PURE__ */ jsxRuntime.jsx(
1557
- AuthLink,
1558
- {
1559
- text: signInText,
1560
- linkText: signInLinkText,
1561
- href: signInUrl,
1562
- appearance: {
1563
- containerClassName: appearance.link?.container,
1564
- linkClassName: appearance.link?.link
1565
- }
1566
- }
1567
- ),
1568
- availableProviders.length > 0 && onOAuthClick && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1569
- /* @__PURE__ */ jsxRuntime.jsx(
1570
- AuthDivider,
1571
- {
1572
- text: dividerText,
1573
- className: appearance.divider
1574
- }
1575
- ),
1576
- /* @__PURE__ */ jsxRuntime.jsx(
1577
- AuthOAuthProviders,
1578
- {
1579
- providers: availableProviders,
1580
- onClick: onOAuthClick,
1581
- disabled: loading || oauthLoading !== null,
1582
- loading: oauthLoading,
1583
- appearance: {
1584
- containerClassName: appearance.oauth?.container,
1585
- buttonClassName: appearance.oauth?.button
1586
- }
1587
- }
1588
- )
1589
- ] })
1590
- ] })
1591
- ]
1592
- }
1593
- );
1441
+ )
1442
+ ] })
1443
+ ] })
1444
+ ] });
1594
1445
  }
1595
- var emailSchema = zod.z.string().min(1, "Email is required").email("Invalid email address");
1446
+ var emailSchema = z.string().min(1, "Email is required").email("Invalid email address");
1596
1447
  function createPasswordSchema(options) {
1597
1448
  const {
1598
1449
  minLength = 6,
@@ -1601,7 +1452,7 @@ function createPasswordSchema(options) {
1601
1452
  requireNumber = false,
1602
1453
  requireSpecialChar = false
1603
1454
  } = options || {};
1604
- let schema = zod.z.string().min(minLength, `Password must be at least ${minLength} characters`);
1455
+ let schema = z.string().min(minLength, `Password must be at least ${minLength} characters`);
1605
1456
  if (requireUppercase) {
1606
1457
  schema = schema.regex(/[A-Z]/, "Password must contain at least one uppercase letter");
1607
1458
  }
@@ -1663,23 +1514,17 @@ function checkPasswordStrength(password) {
1663
1514
  }
1664
1515
  return { score, feedback };
1665
1516
  }
1666
- function SignUp({
1667
- afterSignUpUrl,
1668
- onSuccess,
1669
- onError,
1670
- ...uiProps
1671
- }) {
1672
- const { signUp, baseUrl } = useInsforge();
1517
+ function SignUp({ onError, ...uiProps }) {
1518
+ const { signUp, verifyEmail, loginWithOAuth } = useInsforge();
1673
1519
  const { authConfig } = usePublicAuthConfig();
1674
- const [email, setEmail] = react.useState("");
1675
- const [password, setPassword] = react.useState("");
1676
- const [error, setError] = react.useState("");
1677
- const [loading, setLoading] = react.useState(false);
1678
- const [step, setStep] = react.useState("form");
1679
- const [oauthLoading, setOauthLoading] = react.useState(
1680
- null
1681
- );
1682
- const [insforge] = react.useState(() => sdk.createClient({ baseUrl }));
1520
+ const [email, setEmail] = useState("");
1521
+ const [password, setPassword] = useState("");
1522
+ const [error, setError] = useState("");
1523
+ const [loading, setLoading] = useState(false);
1524
+ const [step, setStep] = useState("form");
1525
+ const [oauthLoading] = useState(null);
1526
+ const [searchParams] = useSearchParams();
1527
+ const redirectUrl = searchParams.get("redirect");
1683
1528
  async function handleSubmit(e) {
1684
1529
  e.preventDefault();
1685
1530
  setLoading(true);
@@ -1721,52 +1566,50 @@ function SignUp({
1721
1566
  return;
1722
1567
  }
1723
1568
  if (result.accessToken && result.user) {
1724
- if (onSuccess) {
1725
- onSuccess(result.user, result.accessToken, result.redirectTo);
1726
- }
1569
+ const finalUrl = new URL(result.redirectTo || redirectUrl || "", window.location.origin);
1570
+ finalUrl.searchParams.set("access_token", result.accessToken);
1571
+ finalUrl.searchParams.set("user_id", result.user.id);
1572
+ finalUrl.searchParams.set("email", result.user.email);
1573
+ finalUrl.searchParams.set("name", result.user.name);
1574
+ window.location.href = finalUrl.toString();
1727
1575
  }
1728
1576
  } catch (err) {
1729
- const errorMessage = err.message || "Sign up failed";
1577
+ const errorMessage = err instanceof Error ? err.message : "Sign up failed";
1730
1578
  setError(errorMessage);
1731
- if (onError) onError(new Error(errorMessage));
1579
+ if (onError) {
1580
+ onError(new Error(errorMessage));
1581
+ }
1732
1582
  } finally {
1733
1583
  setLoading(false);
1734
1584
  }
1735
1585
  }
1736
1586
  async function handleVerifyCode(code) {
1587
+ setError("");
1737
1588
  try {
1738
- const result = await insforge.auth.verifyEmail({ email, otp: code });
1739
- if (result.error) {
1589
+ const result = await verifyEmail(email, code);
1590
+ if (result?.error) {
1740
1591
  throw new Error(result.error.message || "Verification failed");
1741
1592
  }
1742
- if (result.data?.accessToken) {
1743
- if (onSuccess && result.data.user) {
1744
- onSuccess(result.data.user, result.data.accessToken);
1745
- }
1593
+ if (result?.user) {
1594
+ const finalUrl = new URL(result.redirectTo || redirectUrl || "", window.location.origin);
1595
+ finalUrl.searchParams.set("access_token", result.accessToken);
1596
+ finalUrl.searchParams.set("user_id", result.user.id);
1597
+ finalUrl.searchParams.set("email", result.user.email);
1598
+ finalUrl.searchParams.set("name", result.user.name);
1599
+ window.location.href = finalUrl.toString();
1746
1600
  }
1747
1601
  } catch (err) {
1748
- throw new Error(err.message || "Invalid verification code");
1749
- }
1750
- }
1751
- async function handleOAuth(provider) {
1752
- try {
1753
- setOauthLoading(provider);
1754
- setError("");
1755
- await insforge.auth.signInWithOAuth({
1756
- provider,
1757
- redirectTo: afterSignUpUrl
1758
- });
1759
- } catch (err) {
1760
- const errorMessage = err.message || `${provider} sign up failed`;
1602
+ const errorMessage = err instanceof Error ? err.message : "Invalid verification code";
1761
1603
  setError(errorMessage);
1762
- if (onError) onError(new Error(errorMessage));
1763
- setOauthLoading(null);
1764
1604
  }
1765
1605
  }
1606
+ function handleOAuth(provider) {
1607
+ loginWithOAuth(provider, redirectUrl || "");
1608
+ }
1766
1609
  if (!authConfig) {
1767
1610
  return null;
1768
1611
  }
1769
- return /* @__PURE__ */ jsxRuntime.jsx(
1612
+ return /* @__PURE__ */ jsx(
1770
1613
  SignUpForm,
1771
1614
  {
1772
1615
  email,
@@ -1792,8 +1635,6 @@ function ForgotPasswordForm({
1792
1635
  onSubmit,
1793
1636
  error,
1794
1637
  loading = false,
1795
- success = false,
1796
- appearance = {},
1797
1638
  title = "Forgot Password?",
1798
1639
  subtitle = "Enter your email address and we'll send you a code to reset your password.",
1799
1640
  emailLabel = "Email",
@@ -1802,105 +1643,47 @@ function ForgotPasswordForm({
1802
1643
  loadingButtonText = "Sending...",
1803
1644
  backToSignInText = "Remember your password?",
1804
1645
  backToSignInUrl = "/sign-in",
1805
- successTitle = "Check Your Email",
1806
- successMessage
1646
+ showVerificationStep = false,
1647
+ resetPasswordMethod = "code",
1648
+ onVerifyCode,
1649
+ onResendEmail
1807
1650
  }) {
1808
- if (success) {
1809
- return /* @__PURE__ */ jsxRuntime.jsx(
1810
- AuthContainer,
1651
+ return /* @__PURE__ */ jsxs(AuthContainer, { children: [
1652
+ /* @__PURE__ */ jsx(
1653
+ AuthHeader,
1811
1654
  {
1812
- appearance: {
1813
- containerClassName: appearance.container,
1814
- cardClassName: appearance.card
1815
- },
1816
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-4", children: [
1817
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-16 h-16 rounded-full bg-green-100 dark:bg-green-900 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "w-8 h-8 text-green-600 dark:text-green-400", fill: "none", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M5 13l4 4L19 7" }) }) }),
1818
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-2xl font-semibold text-black dark:text-white text-center", children: successTitle }),
1819
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-neutral-600 dark:text-neutral-400 text-center", children: successMessage || `We've sent a password reset link to ${email}. Please check your email and follow the instructions.` }),
1820
- /* @__PURE__ */ jsxRuntime.jsx("a", { href: backToSignInUrl, className: "mt-4 text-black dark:text-white font-medium", children: "Back to Sign In" })
1821
- ] })
1655
+ title: showVerificationStep ? resetPasswordMethod === "link" ? "Check Your Email" : "Enter Reset Code" : title,
1656
+ subtitle: showVerificationStep ? "" : subtitle
1822
1657
  }
1823
- );
1824
- }
1825
- return /* @__PURE__ */ jsxRuntime.jsxs(
1826
- AuthContainer,
1827
- {
1828
- appearance: {
1829
- containerClassName: appearance.container,
1830
- cardClassName: appearance.card
1831
- },
1832
- children: [
1833
- /* @__PURE__ */ jsxRuntime.jsx(
1834
- AuthHeader,
1835
- {
1836
- title,
1837
- subtitle,
1838
- appearance: {
1839
- containerClassName: appearance.header?.container,
1840
- titleClassName: appearance.header?.title,
1841
- subtitleClassName: appearance.header?.subtitle
1842
- }
1843
- }
1844
- ),
1845
- /* @__PURE__ */ jsxRuntime.jsx(
1846
- AuthErrorBanner,
1847
- {
1848
- error: error || "",
1849
- className: appearance.errorBanner
1850
- }
1851
- ),
1852
- /* @__PURE__ */ jsxRuntime.jsxs(
1853
- "form",
1854
- {
1855
- onSubmit,
1856
- noValidate: true,
1857
- className: appearance.form?.container || "flex flex-col items-stretch justify-center gap-6",
1858
- children: [
1859
- /* @__PURE__ */ jsxRuntime.jsx(
1860
- AuthFormField,
1861
- {
1862
- id: "email",
1863
- type: "email",
1864
- label: emailLabel,
1865
- placeholder: emailPlaceholder,
1866
- value: email,
1867
- onChange: (e) => onEmailChange(e.target.value),
1868
- required: true,
1869
- autoComplete: "email",
1870
- appearance: {
1871
- containerClassName: appearance.form?.emailField?.container,
1872
- labelClassName: appearance.form?.emailField?.label,
1873
- inputClassName: appearance.form?.emailField?.input
1874
- }
1875
- }
1876
- ),
1877
- /* @__PURE__ */ jsxRuntime.jsx(
1878
- AuthSubmitButton,
1879
- {
1880
- isLoading: loading,
1881
- disabled: loading,
1882
- className: appearance.button,
1883
- children: loading ? loadingButtonText : submitButtonText
1884
- }
1885
- )
1886
- ]
1887
- }
1888
- ),
1889
- /* @__PURE__ */ jsxRuntime.jsx(
1890
- AuthLink,
1891
- {
1892
- text: backToSignInText,
1893
- linkText: "Back to Sign In",
1894
- href: backToSignInUrl,
1895
- appearance: {
1896
- containerClassName: appearance.link?.container,
1897
- linkClassName: appearance.link?.link
1898
- }
1899
- }
1900
- )
1901
- ]
1902
- }
1903
- );
1658
+ ),
1659
+ /* @__PURE__ */ jsx(AuthErrorBanner, { error: error || "" }),
1660
+ showVerificationStep ? /* @__PURE__ */ jsx(
1661
+ AuthResetPasswordVerificationStep,
1662
+ {
1663
+ email,
1664
+ method: resetPasswordMethod,
1665
+ onVerifyCode,
1666
+ onResendEmail: onResendEmail || (async () => {
1667
+ })
1668
+ }
1669
+ ) : /* @__PURE__ */ jsxs("form", { onSubmit, noValidate: true, className: "if-form if-internal-fm9k2p", children: [
1670
+ /* @__PURE__ */ jsx(
1671
+ AuthFormField,
1672
+ {
1673
+ id: "email",
1674
+ type: "email",
1675
+ label: emailLabel,
1676
+ placeholder: emailPlaceholder,
1677
+ value: email,
1678
+ onChange: (e) => onEmailChange(e.target.value),
1679
+ required: true,
1680
+ autoComplete: "email"
1681
+ }
1682
+ ),
1683
+ /* @__PURE__ */ jsx(AuthSubmitButton, { isLoading: loading, disabled: loading, children: loading ? loadingButtonText : submitButtonText })
1684
+ ] }),
1685
+ !showVerificationStep && /* @__PURE__ */ jsx(AuthLink, { text: backToSignInText, linkText: "Back to Sign In", href: backToSignInUrl })
1686
+ ] });
1904
1687
  }
1905
1688
  function ResetPasswordForm({
1906
1689
  newPassword,
@@ -1912,7 +1695,6 @@ function ResetPasswordForm({
1912
1695
  loading = false,
1913
1696
  success = false,
1914
1697
  authConfig,
1915
- appearance = {},
1916
1698
  title = "Reset Password",
1917
1699
  subtitle = "Enter your new password below.",
1918
1700
  newPasswordLabel = "New Password",
@@ -1921,157 +1703,164 @@ function ResetPasswordForm({
1921
1703
  confirmPasswordPlaceholder = "\u2022\u2022\u2022\u2022\u2022\u2022",
1922
1704
  submitButtonText = "Reset Password",
1923
1705
  loadingButtonText = "Resetting...",
1924
- backToSignInText = "",
1925
- backToSignInUrl = "/sign-in",
1926
- successTitle = "Password Reset Successful!",
1927
- successMessage = "Your password has been successfully reset. You can now sign in with your new password."
1706
+ successTitle = "Password Reset Successful!"
1928
1707
  }) {
1708
+ let successMessage = "Your password has been successfully reset. You can close this page and sign in with your new password.";
1709
+ if (authConfig && authConfig.verifyEmailMethod === "code") {
1710
+ successMessage = "Your password has been successfully reset. You can wait for redirect to sign in with your new password.";
1711
+ }
1929
1712
  if (success) {
1930
- return /* @__PURE__ */ jsxRuntime.jsx(
1931
- AuthContainer,
1713
+ return /* @__PURE__ */ jsx(AuthContainer, { children: /* @__PURE__ */ jsxs(
1714
+ "div",
1932
1715
  {
1933
- appearance: {
1934
- containerClassName: appearance.container,
1935
- cardClassName: appearance.card
1936
- },
1937
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-4", children: [
1938
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-16 h-16 rounded-full bg-green-100 dark:bg-green-900 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "w-8 h-8 text-green-600 dark:text-green-400", fill: "none", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M5 13l4 4L19 7" }) }) }),
1939
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-2xl font-semibold text-black dark:text-white text-center", children: successTitle }),
1940
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-neutral-600 dark:text-neutral-400 text-center", children: successMessage }),
1941
- /* @__PURE__ */ jsxRuntime.jsx("a", { href: backToSignInUrl, className: "mt-4 text-black dark:text-white font-medium", children: "Back to Sign In" })
1942
- ] })
1943
- }
1944
- );
1945
- }
1946
- return /* @__PURE__ */ jsxRuntime.jsxs(
1947
- AuthContainer,
1948
- {
1949
- appearance: {
1950
- containerClassName: appearance.container,
1951
- cardClassName: appearance.card
1952
- },
1953
- children: [
1954
- /* @__PURE__ */ jsxRuntime.jsx(
1955
- AuthHeader,
1956
- {
1957
- title,
1958
- subtitle,
1959
- appearance: {
1960
- containerClassName: appearance.header?.container,
1961
- titleClassName: appearance.header?.title,
1962
- subtitleClassName: appearance.header?.subtitle
1963
- }
1964
- }
1965
- ),
1966
- /* @__PURE__ */ jsxRuntime.jsx(
1967
- AuthErrorBanner,
1968
- {
1969
- error: error || "",
1970
- className: appearance.errorBanner
1971
- }
1972
- ),
1973
- /* @__PURE__ */ jsxRuntime.jsxs(
1974
- "form",
1975
- {
1976
- onSubmit,
1977
- noValidate: true,
1978
- className: appearance.form?.container || "flex flex-col items-stretch justify-center gap-6",
1979
- children: [
1980
- /* @__PURE__ */ jsxRuntime.jsx(
1981
- AuthPasswordField,
1982
- {
1983
- id: "newPassword",
1984
- label: newPasswordLabel,
1985
- placeholder: newPasswordPlaceholder,
1986
- value: newPassword,
1987
- onChange: (e) => onNewPasswordChange(e.target.value),
1988
- required: true,
1989
- autoComplete: "new-password",
1990
- showStrengthIndicator: true,
1991
- authConfig,
1992
- appearance: {
1993
- containerClassName: appearance.form?.newPasswordField?.container,
1994
- labelClassName: appearance.form?.newPasswordField?.label,
1995
- inputClassName: appearance.form?.newPasswordField?.input
1996
- }
1997
- }
1998
- ),
1999
- /* @__PURE__ */ jsxRuntime.jsx(
2000
- AuthPasswordField,
2001
- {
2002
- id: "confirmPassword",
2003
- label: confirmPasswordLabel,
2004
- placeholder: confirmPasswordPlaceholder,
2005
- value: confirmPassword,
2006
- onChange: (e) => onConfirmPasswordChange(e.target.value),
2007
- required: true,
2008
- autoComplete: "new-password",
2009
- authConfig,
2010
- appearance: {
2011
- containerClassName: appearance.form?.confirmPasswordField?.container,
2012
- labelClassName: appearance.form?.confirmPasswordField?.label,
2013
- inputClassName: appearance.form?.confirmPasswordField?.input
2014
- }
2015
- }
2016
- ),
2017
- /* @__PURE__ */ jsxRuntime.jsx(
2018
- AuthSubmitButton,
1716
+ style: { display: "flex", flexDirection: "column", alignItems: "center", gap: "1rem" },
1717
+ children: [
1718
+ /* @__PURE__ */ jsx(
1719
+ "div",
1720
+ {
1721
+ style: {
1722
+ width: "4rem",
1723
+ height: "4rem",
1724
+ borderRadius: "50%",
1725
+ backgroundColor: "#D1FAE5",
1726
+ display: "flex",
1727
+ alignItems: "center",
1728
+ justifyContent: "center"
1729
+ },
1730
+ children: /* @__PURE__ */ jsx(
1731
+ "svg",
2019
1732
  {
2020
- isLoading: loading,
2021
- disabled: loading,
2022
- className: appearance.button,
2023
- children: loading ? loadingButtonText : submitButtonText
1733
+ style: { width: "2rem", height: "2rem", color: "#059669" },
1734
+ fill: "none",
1735
+ strokeLinecap: "round",
1736
+ strokeLinejoin: "round",
1737
+ strokeWidth: "2",
1738
+ viewBox: "0 0 24 24",
1739
+ stroke: "currentColor",
1740
+ children: /* @__PURE__ */ jsx("path", { d: "M5 13l4 4L19 7" })
2024
1741
  }
2025
1742
  )
2026
- ]
2027
- }
2028
- ),
2029
- /* @__PURE__ */ jsxRuntime.jsx(
2030
- AuthLink,
2031
- {
2032
- text: backToSignInText,
2033
- linkText: "Back to Sign In",
2034
- href: backToSignInUrl,
2035
- appearance: {
2036
- containerClassName: appearance.link?.container,
2037
- linkClassName: appearance.link?.link
2038
1743
  }
2039
- }
2040
- )
2041
- ]
2042
- }
2043
- );
1744
+ ),
1745
+ /* @__PURE__ */ jsx("h2", { className: "if-authHeader-title", style: { textAlign: "center" }, children: successTitle }),
1746
+ /* @__PURE__ */ jsx("p", { className: "if-authHeader-subtitle", style: { textAlign: "center" }, children: successMessage })
1747
+ ]
1748
+ }
1749
+ ) });
1750
+ }
1751
+ return /* @__PURE__ */ jsxs(AuthContainer, { children: [
1752
+ /* @__PURE__ */ jsx(AuthHeader, { title, subtitle }),
1753
+ /* @__PURE__ */ jsx(AuthErrorBanner, { error: error || "" }),
1754
+ /* @__PURE__ */ jsxs("form", { onSubmit, noValidate: true, className: "if-form if-internal-fm9k2p", children: [
1755
+ /* @__PURE__ */ jsx(
1756
+ AuthPasswordField,
1757
+ {
1758
+ id: "newPassword",
1759
+ label: newPasswordLabel,
1760
+ placeholder: newPasswordPlaceholder,
1761
+ value: newPassword,
1762
+ onChange: (e) => onNewPasswordChange(e.target.value),
1763
+ required: true,
1764
+ autoComplete: "new-password",
1765
+ showStrengthIndicator: true,
1766
+ authConfig
1767
+ }
1768
+ ),
1769
+ /* @__PURE__ */ jsx(
1770
+ AuthPasswordField,
1771
+ {
1772
+ id: "confirmPassword",
1773
+ label: confirmPasswordLabel,
1774
+ placeholder: confirmPasswordPlaceholder,
1775
+ value: confirmPassword,
1776
+ onChange: (e) => onConfirmPasswordChange(e.target.value),
1777
+ required: true,
1778
+ autoComplete: "new-password",
1779
+ authConfig
1780
+ }
1781
+ ),
1782
+ /* @__PURE__ */ jsx(AuthSubmitButton, { isLoading: loading, disabled: loading, children: loading ? loadingButtonText : submitButtonText })
1783
+ ] })
1784
+ ] });
2044
1785
  }
2045
- function ResetPassword({
2046
- token,
2047
- backToSignInUrl = "/sign-in",
2048
- onSuccess,
2049
- onError,
2050
- ...uiProps
2051
- }) {
2052
- const { resetPassword } = useInsforge();
1786
+ function ForgotPassword({ onError, ...uiProps }) {
1787
+ const { sendResetPasswordEmail, exchangeResetPasswordToken, resetPassword } = useInsforge();
2053
1788
  const { authConfig } = usePublicAuthConfig();
2054
- const [newPassword, setNewPassword] = react.useState("");
2055
- const [confirmPassword, setConfirmPassword] = react.useState("");
2056
- const [error, setError] = react.useState("");
2057
- const [loading, setLoading] = react.useState(false);
2058
- const [success, setSuccess] = react.useState(false);
2059
- async function handleSubmit(e) {
1789
+ const [searchParams] = useSearchParams();
1790
+ const [step, setStep] = useState("email");
1791
+ const [email, setEmail] = useState("");
1792
+ const [resetToken, setResetToken] = useState("");
1793
+ const [newPassword, setNewPassword] = useState("");
1794
+ const [confirmPassword, setConfirmPassword] = useState("");
1795
+ const [error, setError] = useState("");
1796
+ const [loading, setLoading] = useState(false);
1797
+ const [success, setSuccess] = useState(false);
1798
+ const [showVerificationStep, setShowVerificationStep] = useState(false);
1799
+ async function handleEmailSubmit(e) {
2060
1800
  e.preventDefault();
2061
1801
  setLoading(true);
2062
1802
  setError("");
2063
- if (!authConfig) {
2064
- setError("Configuration not loaded. Please refresh the page.");
1803
+ const emailValidation = emailSchema.safeParse(email);
1804
+ if (!emailValidation.success) {
1805
+ const firstError = emailValidation.error.issues[0];
1806
+ setError(firstError.message);
2065
1807
  setLoading(false);
2066
1808
  return;
2067
1809
  }
1810
+ try {
1811
+ const result = await sendResetPasswordEmail(emailValidation.data);
1812
+ if (result?.success) {
1813
+ setShowVerificationStep(true);
1814
+ } else {
1815
+ const errorMessage = result?.message || "Failed to send reset email";
1816
+ setError(errorMessage);
1817
+ if (onError) {
1818
+ onError(new Error(errorMessage));
1819
+ }
1820
+ }
1821
+ } catch (err) {
1822
+ const errorMessage = err instanceof Error ? err.message : "Failed to send reset email";
1823
+ setError(errorMessage);
1824
+ if (onError) {
1825
+ onError(new Error(errorMessage));
1826
+ }
1827
+ } finally {
1828
+ setLoading(false);
1829
+ }
1830
+ }
1831
+ async function handleVerifyCode(code) {
1832
+ setError("");
1833
+ try {
1834
+ const result = await exchangeResetPasswordToken(email, code);
1835
+ if ("error" in result) {
1836
+ throw new Error(result.error.message || "Failed to verify code");
1837
+ }
1838
+ if (result.token) {
1839
+ setResetToken(result.token);
1840
+ setStep("password");
1841
+ }
1842
+ } catch (err) {
1843
+ const errorMessage = err instanceof Error ? err.message : "Invalid verification code";
1844
+ setError(errorMessage);
1845
+ if (onError) {
1846
+ onError(new Error(errorMessage));
1847
+ }
1848
+ }
1849
+ }
1850
+ async function handleResendEmail() {
1851
+ await sendResetPasswordEmail(email);
1852
+ }
1853
+ async function handleResetPasswordSubmit(e) {
1854
+ e.preventDefault();
1855
+ setLoading(true);
1856
+ setError("");
2068
1857
  if (newPassword !== confirmPassword) {
2069
1858
  setError("Passwords do not match");
2070
1859
  setLoading(false);
2071
1860
  return;
2072
1861
  }
2073
- if (!token) {
2074
- setError("Reset token is missing");
1862
+ if (!authConfig) {
1863
+ setError("Configuration not loaded");
2075
1864
  setLoading(false);
2076
1865
  return;
2077
1866
  }
@@ -2090,12 +1879,16 @@ function ResetPassword({
2090
1879
  return;
2091
1880
  }
2092
1881
  try {
2093
- const result = await resetPassword(token, newPassword);
1882
+ const result = await resetPassword(resetToken, newPassword);
2094
1883
  if (result?.message) {
2095
1884
  setSuccess(true);
2096
- if (onSuccess) {
2097
- onSuccess();
2098
- }
1885
+ const signInUrl = new URL("/sign-in", window.location.origin);
1886
+ searchParams.forEach((value, key) => {
1887
+ signInUrl.searchParams.set(key, value);
1888
+ });
1889
+ setTimeout(() => {
1890
+ window.location.href = signInUrl.toString();
1891
+ }, 2e3);
2099
1892
  } else {
2100
1893
  const errorMessage = "Failed to reset password";
2101
1894
  setError(errorMessage);
@@ -2104,7 +1897,7 @@ function ResetPassword({
2104
1897
  }
2105
1898
  }
2106
1899
  } catch (err) {
2107
- const errorMessage = err.message || "Failed to reset password";
1900
+ const errorMessage = err instanceof Error ? err.message : "Failed to reset password";
2108
1901
  setError(errorMessage);
2109
1902
  if (onError) {
2110
1903
  onError(new Error(errorMessage));
@@ -2116,90 +1909,97 @@ function ResetPassword({
2116
1909
  if (!authConfig) {
2117
1910
  return null;
2118
1911
  }
2119
- return /* @__PURE__ */ jsxRuntime.jsx(
1912
+ if (step === "email") {
1913
+ return /* @__PURE__ */ jsx(
1914
+ ForgotPasswordForm,
1915
+ {
1916
+ email,
1917
+ onEmailChange: setEmail,
1918
+ onSubmit: (e) => {
1919
+ void handleEmailSubmit(e);
1920
+ },
1921
+ error,
1922
+ loading,
1923
+ showVerificationStep,
1924
+ resetPasswordMethod: authConfig.resetPasswordMethod,
1925
+ onVerifyCode: handleVerifyCode,
1926
+ onResendEmail: handleResendEmail,
1927
+ ...uiProps
1928
+ }
1929
+ );
1930
+ }
1931
+ return /* @__PURE__ */ jsx(
2120
1932
  ResetPasswordForm,
2121
1933
  {
2122
1934
  newPassword,
2123
1935
  confirmPassword,
2124
1936
  onNewPasswordChange: setNewPassword,
2125
1937
  onConfirmPasswordChange: setConfirmPassword,
2126
- onSubmit: handleSubmit,
1938
+ onSubmit: handleResetPasswordSubmit,
2127
1939
  error,
2128
1940
  loading,
2129
1941
  success,
2130
1942
  authConfig,
2131
- backToSignInUrl,
2132
1943
  ...uiProps
2133
1944
  }
2134
1945
  );
2135
1946
  }
2136
- function ForgotPassword({
2137
- backToSignInUrl = "/sign-in",
2138
- onSuccess,
2139
- onError,
2140
- ...uiProps
2141
- }) {
2142
- const { sendResetPasswordEmail, baseUrl } = useInsforge();
1947
+ function ResetPassword({ onError, ...uiProps }) {
1948
+ const [searchParams] = useSearchParams();
1949
+ const token = searchParams.get("token");
1950
+ const { resetPassword } = useInsforge();
2143
1951
  const { authConfig } = usePublicAuthConfig();
2144
- const [insforge] = react.useState(() => sdk.createClient({ baseUrl }));
2145
- const [step, setStep] = react.useState("email");
2146
- const [email, setEmail] = react.useState("");
2147
- const [verificationCode, setVerificationCode] = react.useState("");
2148
- const [resetToken, setResetToken] = react.useState("");
2149
- const [error, setError] = react.useState("");
2150
- const [loading, setLoading] = react.useState(false);
2151
- const [success, setSuccess] = react.useState(false);
2152
- const [resendDisabled, setResendDisabled] = react.useState(true);
2153
- const [resendCountdown, setResendCountdown] = react.useState(60);
2154
- const [isSendingCode, setIsSendingCode] = react.useState(false);
2155
- const [isVerifyingCode, setIsVerifyingCode] = react.useState(false);
2156
- react.useEffect(() => {
2157
- if (resendCountdown > 0 && step === "code") {
2158
- const timer = setInterval(() => {
2159
- setResendCountdown((prev) => {
2160
- if (prev <= 1) {
2161
- setResendDisabled(false);
2162
- return 0;
2163
- }
2164
- return prev - 1;
2165
- });
2166
- }, 1e3);
2167
- return () => clearInterval(timer);
2168
- }
2169
- }, [resendCountdown, step]);
2170
- async function handleEmailSubmit(e) {
1952
+ const [newPassword, setNewPassword] = useState("");
1953
+ const [confirmPassword, setConfirmPassword] = useState("");
1954
+ const [error, setError] = useState("");
1955
+ const [loading, setLoading] = useState(false);
1956
+ const [success, setSuccess] = useState(false);
1957
+ async function handleSubmit(e) {
2171
1958
  e.preventDefault();
2172
1959
  setLoading(true);
2173
1960
  setError("");
2174
- const emailValidation = emailSchema.safeParse(email);
2175
- if (!emailValidation.success) {
2176
- const firstError = emailValidation.error.issues[0];
1961
+ if (!authConfig) {
1962
+ setError("Configuration not loaded. Please refresh the page.");
1963
+ setLoading(false);
1964
+ return;
1965
+ }
1966
+ if (newPassword !== confirmPassword) {
1967
+ setError("Passwords do not match");
1968
+ setLoading(false);
1969
+ return;
1970
+ }
1971
+ if (!token) {
1972
+ setError("Reset token is missing");
1973
+ setLoading(false);
1974
+ return;
1975
+ }
1976
+ const passwordZodSchema = createPasswordSchema({
1977
+ minLength: authConfig.passwordMinLength,
1978
+ requireUppercase: authConfig.requireUppercase,
1979
+ requireLowercase: authConfig.requireLowercase,
1980
+ requireNumber: authConfig.requireNumber,
1981
+ requireSpecialChar: authConfig.requireSpecialChar
1982
+ });
1983
+ const passwordValidation = passwordZodSchema.safeParse(newPassword);
1984
+ if (!passwordValidation.success) {
1985
+ const firstError = passwordValidation.error.issues[0];
2177
1986
  setError(firstError.message);
2178
1987
  setLoading(false);
2179
1988
  return;
2180
1989
  }
2181
1990
  try {
2182
- const result = await sendResetPasswordEmail(emailValidation.data);
2183
- if (result?.success) {
2184
- if (authConfig?.resetPasswordMethod === "link") {
2185
- setSuccess(true);
2186
- if (onSuccess) {
2187
- onSuccess();
2188
- }
2189
- } else {
2190
- setStep("code");
2191
- setResendDisabled(true);
2192
- setResendCountdown(60);
2193
- }
1991
+ const result = await resetPassword(token, newPassword);
1992
+ if (result?.message) {
1993
+ setSuccess(true);
2194
1994
  } else {
2195
- const errorMessage = result?.message || "Failed to send reset code";
1995
+ const errorMessage = "Failed to reset password";
2196
1996
  setError(errorMessage);
2197
1997
  if (onError) {
2198
1998
  onError(new Error(errorMessage));
2199
1999
  }
2200
2000
  }
2201
2001
  } catch (err) {
2202
- const errorMessage = err.message || "Failed to send reset code";
2002
+ const errorMessage = err instanceof Error ? err.message : "Failed to reset password";
2203
2003
  setError(errorMessage);
2204
2004
  if (onError) {
2205
2005
  onError(new Error(errorMessage));
@@ -2208,178 +2008,163 @@ function ForgotPassword({
2208
2008
  setLoading(false);
2209
2009
  }
2210
2010
  }
2211
- async function handleVerifyCode(code) {
2212
- setIsVerifyingCode(true);
2213
- setError("");
2214
- setVerificationCode(code);
2215
- try {
2216
- const result = await insforge.auth.exchangeResetPasswordToken({ email, code });
2217
- if (result.error) {
2218
- throw new Error(result.error.message || "Failed to verify code");
2219
- }
2220
- if (result.data) {
2221
- setResetToken(result.data.token);
2222
- setStep("password");
2223
- }
2224
- } catch (err) {
2225
- setError(err.message || "Invalid verification code");
2226
- setVerificationCode("");
2227
- } finally {
2228
- setIsVerifyingCode(false);
2229
- }
2230
- }
2231
- const handleResendCode = react.useCallback(async () => {
2232
- setResendDisabled(true);
2233
- setResendCountdown(60);
2234
- setIsSendingCode(true);
2235
- setError("");
2236
- try {
2237
- await sendResetPasswordEmail(email);
2238
- } catch (err) {
2239
- setError(err.message || "Failed to resend code");
2240
- setResendDisabled(false);
2241
- setResendCountdown(0);
2242
- } finally {
2243
- setIsSendingCode(false);
2244
- }
2245
- }, [email, sendResetPasswordEmail]);
2246
- function handlePasswordResetSuccess(redirectTo) {
2247
- const targetUrl = redirectTo || backToSignInUrl;
2248
- if (onSuccess) {
2249
- onSuccess();
2250
- }
2251
- setTimeout(() => {
2252
- window.location.href = targetUrl;
2253
- }, 1500);
2254
- }
2255
2011
  if (!authConfig) {
2256
2012
  return null;
2257
2013
  }
2258
- if (step === "email") {
2259
- return /* @__PURE__ */ jsxRuntime.jsx(
2260
- ForgotPasswordForm,
2261
- {
2262
- email,
2263
- onEmailChange: setEmail,
2264
- onSubmit: handleEmailSubmit,
2265
- error,
2266
- loading,
2267
- success,
2268
- backToSignInUrl,
2269
- ...uiProps
2270
- }
2271
- );
2014
+ if (!token) {
2015
+ return /* @__PURE__ */ jsxs(AuthContainer, { children: [
2016
+ /* @__PURE__ */ jsx(AuthHeader, { title: "Invalid Reset Link", subtitle: "" }),
2017
+ /* @__PURE__ */ jsx(
2018
+ "div",
2019
+ {
2020
+ style: {
2021
+ padding: "1.5rem",
2022
+ backgroundColor: "#FEE2E2",
2023
+ borderRadius: "0.5rem",
2024
+ border: "1px solid #DC2626"
2025
+ },
2026
+ children: /* @__PURE__ */ jsx(
2027
+ "p",
2028
+ {
2029
+ style: {
2030
+ fontSize: "0.875rem",
2031
+ color: "#DC2626",
2032
+ margin: 0,
2033
+ fontFamily: "var(--if-font-family)"
2034
+ },
2035
+ children: "The password reset link is missing or invalid. Please request a new password reset link."
2036
+ }
2037
+ )
2038
+ }
2039
+ )
2040
+ ] });
2272
2041
  }
2273
- if (step === "code") {
2274
- return /* @__PURE__ */ jsxRuntime.jsxs(
2275
- AuthContainer,
2042
+ if (success) {
2043
+ return /* @__PURE__ */ jsx(AuthContainer, { children: /* @__PURE__ */ jsxs(
2044
+ "div",
2276
2045
  {
2277
- appearance: {
2278
- containerClassName: uiProps.appearance?.container,
2279
- cardClassName: uiProps.appearance?.card
2280
- },
2046
+ style: { display: "flex", flexDirection: "column", alignItems: "center", gap: "1rem" },
2281
2047
  children: [
2282
- /* @__PURE__ */ jsxRuntime.jsx(
2283
- AuthHeader,
2048
+ /* @__PURE__ */ jsx(
2049
+ "div",
2284
2050
  {
2285
- title: "Enter Reset Code",
2286
- subtitle: `We've sent a 6-digit verification code to ${email}. Please enter it below to reset your password. The code will expire in 10 minutes.`,
2287
- appearance: {
2288
- containerClassName: uiProps.appearance?.header?.container,
2289
- titleClassName: uiProps.appearance?.header?.title,
2290
- subtitleClassName: uiProps.appearance?.header?.subtitle
2291
- }
2292
- }
2293
- ),
2294
- /* @__PURE__ */ jsxRuntime.jsx(AuthErrorBanner, { error, className: uiProps.appearance?.errorBanner }),
2295
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full flex flex-col gap-6 items-center", children: [
2296
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full bg-neutral-100 dark:bg-neutral-800 rounded-lg px-4 pt-4 pb-6 flex flex-col gap-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3 mt-2", children: [
2297
- /* @__PURE__ */ jsxRuntime.jsx(
2298
- AuthVerificationCodeInput,
2051
+ style: {
2052
+ width: "4rem",
2053
+ height: "4rem",
2054
+ borderRadius: "50%",
2055
+ backgroundColor: "#D1FAE5",
2056
+ display: "flex",
2057
+ alignItems: "center",
2058
+ justifyContent: "center"
2059
+ },
2060
+ children: /* @__PURE__ */ jsx(
2061
+ "svg",
2299
2062
  {
2300
- value: verificationCode,
2301
- onChange: setVerificationCode,
2302
- email,
2303
- disabled: isVerifyingCode,
2304
- onComplete: (code) => {
2305
- void handleVerifyCode(code);
2306
- }
2307
- }
2308
- ),
2309
- isVerifyingCode && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-neutral-600 dark:text-neutral-400 text-center", children: "Verifying..." })
2310
- ] }) }),
2311
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full text-sm text-center text-neutral-600 dark:text-neutral-400", children: [
2312
- "Didn't receive the email?",
2313
- " ",
2314
- /* @__PURE__ */ jsxRuntime.jsx(
2315
- "button",
2316
- {
2317
- onClick: () => {
2318
- void handleResendCode();
2319
- },
2320
- disabled: resendDisabled || isSendingCode,
2321
- className: "text-black dark:text-white font-medium transition-colors disabled:cursor-not-allowed cursor-pointer hover:underline disabled:no-underline disabled:opacity-50",
2322
- children: isSendingCode ? "Sending..." : resendDisabled ? `Retry in (${resendCountdown}s)` : "Click to resend"
2063
+ style: { width: "2rem", height: "2rem", color: "#059669" },
2064
+ fill: "none",
2065
+ strokeLinecap: "round",
2066
+ strokeLinejoin: "round",
2067
+ strokeWidth: "2",
2068
+ viewBox: "0 0 24 24",
2069
+ stroke: "currentColor",
2070
+ children: /* @__PURE__ */ jsx("path", { d: "M5 13l4 4L19 7" })
2323
2071
  }
2324
2072
  )
2325
- ] })
2326
- ] }),
2327
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-center text-sm text-gray-600 dark:text-gray-400", children: /* @__PURE__ */ jsxRuntime.jsx("a", { href: backToSignInUrl, className: "text-black dark:text-white font-medium", children: "Back to Sign In" }) })
2073
+ }
2074
+ ),
2075
+ /* @__PURE__ */ jsx(
2076
+ "h2",
2077
+ {
2078
+ style: {
2079
+ fontSize: "1.5rem",
2080
+ fontWeight: 600,
2081
+ color: "#000",
2082
+ margin: 0,
2083
+ textAlign: "center",
2084
+ fontFamily: "var(--if-font-family)"
2085
+ },
2086
+ children: "Password Reset Successfully"
2087
+ }
2088
+ ),
2089
+ /* @__PURE__ */ jsx(
2090
+ "p",
2091
+ {
2092
+ style: {
2093
+ fontSize: "0.875rem",
2094
+ color: "#828282",
2095
+ textAlign: "center",
2096
+ margin: 0,
2097
+ fontFamily: "var(--if-font-family)"
2098
+ },
2099
+ children: "Your password has been reset successfully. You can now close this page and return to the login page in your original tab."
2100
+ }
2101
+ )
2328
2102
  ]
2329
2103
  }
2330
- );
2104
+ ) });
2331
2105
  }
2332
- return /* @__PURE__ */ jsxRuntime.jsx(
2333
- ResetPassword,
2106
+ return /* @__PURE__ */ jsx(
2107
+ ResetPasswordForm,
2334
2108
  {
2335
- token: resetToken,
2336
- backToSignInUrl,
2337
- onSuccess: handlePasswordResetSuccess,
2338
- onError,
2339
- appearance: uiProps.appearance
2109
+ newPassword,
2110
+ confirmPassword,
2111
+ onNewPasswordChange: setNewPassword,
2112
+ onConfirmPasswordChange: setConfirmPassword,
2113
+ onSubmit: handleSubmit,
2114
+ error,
2115
+ loading,
2116
+ success: false,
2117
+ authConfig,
2118
+ ...uiProps
2340
2119
  }
2341
2120
  );
2342
2121
  }
2343
2122
  function VerifyEmailStatus({
2344
2123
  status,
2345
2124
  error,
2346
- appearance = {},
2347
2125
  verifyingTitle = "Verifying your email...",
2348
2126
  successTitle = "Email Verified!",
2349
- successMessage = "Your email has been verified successfully. You can close this page and return to your app.",
2127
+ successMessage = "Your email has been verified successfully. You can close this page and sign in to your app.",
2350
2128
  errorTitle = "Verification Failed"
2351
2129
  }) {
2352
2130
  if (status === "verifying") {
2353
- return /* @__PURE__ */ jsxRuntime.jsx(AuthContainer, { appearance, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full flex flex-col items-center justify-center gap-6", children: [
2354
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-2xl font-semibold text-black dark:text-white", children: verifyingTitle }),
2355
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "animate-spin rounded-full h-12 w-12 border-b-2 border-black dark:border-white" })
2131
+ return /* @__PURE__ */ jsx(AuthContainer, { children: /* @__PURE__ */ jsxs("div", { className: "if-verifyStatus-container", children: [
2132
+ /* @__PURE__ */ jsx("h2", { className: "if-authHeader-title", children: verifyingTitle }),
2133
+ /* @__PURE__ */ jsx("div", { className: "if-submitButton-spinner if-verifyStatus-spinner" })
2356
2134
  ] }) });
2357
2135
  }
2358
2136
  if (status === "error") {
2359
- return /* @__PURE__ */ jsxRuntime.jsx(AuthContainer, { appearance, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full flex flex-col items-stretch justify-center gap-6", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-start justify-center gap-2", children: [
2360
- /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-2xl font-semibold text-black dark:text-white", children: errorTitle }),
2361
- /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-neutral-600 dark:text-neutral-400 leading-relaxed", children: [
2137
+ return /* @__PURE__ */ jsx(AuthContainer, { children: /* @__PURE__ */ jsx("div", { className: "if-verifyStatus-container-stretch", children: /* @__PURE__ */ jsxs("div", { className: "if-authHeader if-internal-h3m7w5", children: [
2138
+ /* @__PURE__ */ jsx("h1", { className: "if-authHeader-title if-internal-t4p1k9", children: errorTitle }),
2139
+ /* @__PURE__ */ jsxs("p", { className: "if-authHeader-subtitle if-internal-s7q2m3", children: [
2362
2140
  error || "The verification link is invalid or has expired.",
2363
2141
  " Please try again or contact support if the problem persists. You can close this page and return to your app."
2364
2142
  ] })
2365
2143
  ] }) }) });
2366
2144
  }
2367
- return /* @__PURE__ */ jsxRuntime.jsx(AuthContainer, { appearance, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full flex flex-col items-stretch justify-center gap-6", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-4", children: [
2368
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-16 h-16 rounded-full bg-green-100 dark:bg-green-900 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "w-8 h-8 text-green-600 dark:text-green-400", fill: "none", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M5 13l4 4L19 7" }) }) }),
2369
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-2xl font-semibold text-black dark:text-white text-center", children: successTitle }),
2370
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-neutral-600 dark:text-neutral-400 text-center", children: successMessage })
2145
+ return /* @__PURE__ */ jsx(AuthContainer, { children: /* @__PURE__ */ jsx("div", { className: "if-verifyStatus-container-stretch", children: /* @__PURE__ */ jsxs("div", { className: "if-verifyStatus-successContent", children: [
2146
+ /* @__PURE__ */ jsx("div", { className: "if-verifyStatus-successIcon", children: /* @__PURE__ */ jsx(
2147
+ "svg",
2148
+ {
2149
+ className: "if-verifyStatus-successIconSvg",
2150
+ fill: "none",
2151
+ strokeLinecap: "round",
2152
+ strokeLinejoin: "round",
2153
+ strokeWidth: "2",
2154
+ viewBox: "0 0 24 24",
2155
+ stroke: "currentColor",
2156
+ children: /* @__PURE__ */ jsx("path", { d: "M5 13l4 4L19 7" })
2157
+ }
2158
+ ) }),
2159
+ /* @__PURE__ */ jsx("h2", { className: "if-authHeader-title if-verifyStatus-textCenter", children: successTitle }),
2160
+ /* @__PURE__ */ jsx("p", { className: "if-authHeader-subtitle if-verifyStatus-textCenter", children: successMessage })
2371
2161
  ] }) }) });
2372
2162
  }
2373
- function VerifyEmail({
2374
- token,
2375
- onSuccess,
2376
- onError,
2377
- ...uiProps
2378
- }) {
2163
+ function VerifyEmail({ token, onSuccess, onError, ...uiProps }) {
2379
2164
  const { verifyEmail } = useInsforge();
2380
- const [status, setStatus] = react.useState("verifying");
2381
- const [error, setError] = react.useState("");
2382
- react.useEffect(() => {
2165
+ const [status, setStatus] = useState("verifying");
2166
+ const [error, setError] = useState("");
2167
+ useEffect(() => {
2383
2168
  const verifyEmailFn = async () => {
2384
2169
  if (!token) {
2385
2170
  const errorMessage = "Invalid verification link. Missing required token.";
@@ -2410,7 +2195,7 @@ function VerifyEmail({
2410
2195
  });
2411
2196
  }
2412
2197
  } catch (err) {
2413
- const errorMessage = err.message || "Email verification failed";
2198
+ const errorMessage = err instanceof Error ? err.message : "Email verification failed";
2414
2199
  setError(errorMessage);
2415
2200
  setStatus("error");
2416
2201
  if (onError) {
@@ -2420,21 +2205,19 @@ function VerifyEmail({
2420
2205
  };
2421
2206
  void verifyEmailFn();
2422
2207
  }, [token, verifyEmail, onSuccess, onError]);
2423
- return /* @__PURE__ */ jsxRuntime.jsx(VerifyEmailStatus, { status, error, ...uiProps });
2208
+ return /* @__PURE__ */ jsx(VerifyEmailStatus, { status, error, ...uiProps });
2424
2209
  }
2425
- function UserButton({
2426
- afterSignOutUrl = "/",
2427
- mode = "detailed",
2428
- appearance = {}
2429
- }) {
2210
+ function UserButton({ afterSignOutUrl = "/", mode = "detailed" }) {
2430
2211
  const { user, signOut } = useInsforge();
2431
- const [isOpen, setIsOpen] = react.useState(false);
2432
- const [imageError, setImageError] = react.useState(false);
2433
- const dropdownRef = react.useRef(null);
2434
- react.useEffect(() => {
2212
+ const [isOpen, setIsOpen] = useState(false);
2213
+ const [imageError, setImageError] = useState(false);
2214
+ const dropdownRef = useRef(null);
2215
+ useEffect(() => {
2435
2216
  setImageError(false);
2436
2217
  const avatarUrl = user?.avatarUrl;
2437
- if (!avatarUrl) return;
2218
+ if (!avatarUrl) {
2219
+ return;
2220
+ }
2438
2221
  const checkImageUrl = async () => {
2439
2222
  try {
2440
2223
  const response = await fetch(avatarUrl, {
@@ -2445,12 +2228,15 @@ function UserButton({
2445
2228
  setImageError(true);
2446
2229
  }
2447
2230
  } catch (error) {
2231
+ if (error instanceof Error) {
2232
+ console.error("Error checking image URL:", error.message);
2233
+ }
2448
2234
  setImageError(true);
2449
2235
  }
2450
2236
  };
2451
2237
  checkImageUrl();
2452
2238
  }, [user?.avatarUrl]);
2453
- react.useEffect(() => {
2239
+ useEffect(() => {
2454
2240
  function handleClickOutside(event) {
2455
2241
  if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
2456
2242
  setIsOpen(false);
@@ -2468,87 +2254,48 @@ function UserButton({
2468
2254
  setIsOpen(false);
2469
2255
  window.location.href = afterSignOutUrl;
2470
2256
  }
2471
- if (!user) return null;
2257
+ if (!user) {
2258
+ return null;
2259
+ }
2472
2260
  const initials = user.name ? user.name.charAt(0).toUpperCase() : user.email.split("@")[0].slice(0, 2).toUpperCase();
2473
- return /* @__PURE__ */ jsxRuntime.jsxs(
2474
- "div",
2475
- {
2476
- className: cn("relative inline-block", appearance.containerClassName),
2477
- ref: dropdownRef,
2478
- children: [
2479
- /* @__PURE__ */ jsxRuntime.jsxs(
2480
- "button",
2481
- {
2482
- className: cn(
2483
- "p-1 bg-transparent border-0 rounded-full cursor-pointer transition-all duration-200",
2484
- "flex items-center justify-center gap-2",
2485
- "hover:bg-black/5",
2486
- mode === "detailed" && "rounded-lg p-2",
2487
- appearance.buttonClassName
2488
- ),
2489
- onClick: () => setIsOpen(!isOpen),
2490
- "aria-expanded": isOpen,
2491
- "aria-haspopup": "true",
2492
- children: [
2493
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center w-10 h-10 bg-blue-500 rounded-full", children: user.avatarUrl && !imageError ? /* @__PURE__ */ jsxRuntime.jsx(
2494
- "img",
2495
- {
2496
- src: user.avatarUrl,
2497
- alt: user.email,
2498
- onError: () => setImageError(true),
2499
- className: "rounded-full object-cover w-full h-full"
2500
- }
2501
- ) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-white font-semibold text-sm", children: initials }) }),
2502
- mode === "detailed" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-start gap-0.5", children: [
2503
- user.name && /* @__PURE__ */ jsxRuntime.jsx(
2504
- "div",
2505
- {
2506
- className: cn(
2507
- "text-sm font-semibold text-gray-900 leading-5 text-left",
2508
- appearance.nameClassName
2509
- ),
2510
- children: user.name
2511
- }
2512
- ),
2513
- /* @__PURE__ */ jsxRuntime.jsx(
2514
- "div",
2515
- {
2516
- className: cn(
2517
- "text-xs text-gray-500 leading-4 text-left",
2518
- appearance.emailClassName
2519
- ),
2520
- children: user.email
2521
- }
2522
- )
2523
- ] })
2524
- ]
2525
- }
2526
- ),
2527
- isOpen && /* @__PURE__ */ jsxRuntime.jsx(
2528
- "div",
2529
- {
2530
- className: cn(
2531
- "absolute top-full right-0 mt-2 min-w-40",
2532
- "bg-white border border-gray-200 rounded-lg",
2533
- "shadow-lg z-50 overflow-hidden p-1",
2534
- appearance.dropdownClassName
2535
- ),
2536
- children: /* @__PURE__ */ jsxRuntime.jsxs(
2537
- "button",
2538
- {
2539
- onClick: handleSignOut,
2540
- className: "flex items-center justify-start gap-2 w-full px-3 py-2 text-sm font-normal text-red-600 bg-transparent border-0 rounded-md cursor-pointer transition-colors hover:bg-red-50 text-left",
2541
- children: [
2542
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.LogOut, { className: "w-5 h-5" }),
2543
- "Sign out"
2544
- ]
2545
- }
2546
- )
2547
- }
2548
- )
2549
- ]
2550
- }
2551
- );
2261
+ const buttonClassName = mode === "detailed" ? "if-userButton if-userButton-detailed" : "if-userButton";
2262
+ return /* @__PURE__ */ jsxs("div", { className: "if-userButton-container if-internal-ub3k8p", ref: dropdownRef, children: [
2263
+ /* @__PURE__ */ jsxs(
2264
+ "button",
2265
+ {
2266
+ className: buttonClassName,
2267
+ onClick: () => setIsOpen(!isOpen),
2268
+ "aria-expanded": isOpen,
2269
+ "aria-haspopup": "true",
2270
+ children: [
2271
+ /* @__PURE__ */ jsx("div", { className: "if-userButton-avatar", children: user.avatarUrl && !imageError ? /* @__PURE__ */ jsx(
2272
+ "img",
2273
+ {
2274
+ src: user.avatarUrl,
2275
+ alt: user.email,
2276
+ onError: () => setImageError(true),
2277
+ className: "if-userButton-avatarImage"
2278
+ }
2279
+ ) : /* @__PURE__ */ jsx("span", { className: "if-userButton-avatarInitials", children: initials }) }),
2280
+ mode === "detailed" && /* @__PURE__ */ jsxs("div", { className: "if-userButton-info", children: [
2281
+ user.name && /* @__PURE__ */ jsx("div", { className: "if-userButton-name", children: user.name }),
2282
+ /* @__PURE__ */ jsx("div", { className: "if-userButton-email", children: user.email })
2283
+ ] })
2284
+ ]
2285
+ }
2286
+ ),
2287
+ isOpen && /* @__PURE__ */ jsx("div", { className: "if-userButton-menu", children: /* @__PURE__ */ jsxs(
2288
+ "button",
2289
+ {
2290
+ onClick: handleSignOut,
2291
+ className: "if-userButton-menuItem if-userButton-menuItem-signout",
2292
+ children: [
2293
+ /* @__PURE__ */ jsx(LogOut, { className: "if-userButton-menuItem-icon" }),
2294
+ "Sign out"
2295
+ ]
2296
+ }
2297
+ ) })
2298
+ ] });
2552
2299
  }
2553
2300
  function Protect({
2554
2301
  children,
@@ -2558,7 +2305,7 @@ function Protect({
2558
2305
  onRedirect
2559
2306
  }) {
2560
2307
  const { isSignedIn, isLoaded, user } = useInsforge();
2561
- react.useEffect(() => {
2308
+ useEffect(() => {
2562
2309
  if (isLoaded && !isSignedIn) {
2563
2310
  if (onRedirect) {
2564
2311
  onRedirect(redirectTo);
@@ -2576,7 +2323,7 @@ function Protect({
2576
2323
  }
2577
2324
  }, [isLoaded, isSignedIn, redirectTo, condition, user, onRedirect]);
2578
2325
  if (!isLoaded) {
2579
- return fallback || /* @__PURE__ */ jsxRuntime.jsx("div", { className: "insforge-loading", children: "Loading..." });
2326
+ return fallback || /* @__PURE__ */ jsx("div", { className: "insforge-loading", children: "Loading..." });
2580
2327
  }
2581
2328
  if (!isSignedIn) {
2582
2329
  return fallback || null;
@@ -2584,80 +2331,27 @@ function Protect({
2584
2331
  if (condition && user && !condition(user)) {
2585
2332
  return fallback || null;
2586
2333
  }
2587
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
2334
+ return /* @__PURE__ */ jsx(Fragment, { children });
2588
2335
  }
2589
2336
  function SignedIn({ children }) {
2590
2337
  const { isSignedIn, isLoaded } = useInsforge();
2591
- if (!isLoaded) return null;
2592
- if (!isSignedIn) return null;
2593
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
2338
+ if (!isLoaded) {
2339
+ return null;
2340
+ }
2341
+ if (!isSignedIn) {
2342
+ return null;
2343
+ }
2344
+ return /* @__PURE__ */ jsx(Fragment, { children });
2594
2345
  }
2595
2346
  function SignedOut({ children }) {
2596
2347
  const { isSignedIn, isLoaded } = useInsforge();
2597
- if (!isLoaded) return null;
2598
- if (isSignedIn) return null;
2599
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
2600
- }
2601
- function InsforgeCallback({
2602
- redirectTo = "/",
2603
- onSuccess,
2604
- onError,
2605
- loadingComponent,
2606
- onRedirect
2607
- }) {
2608
- const isProcessingRef = react.useRef(false);
2609
- const { isLoaded, isSignedIn } = useInsforge();
2610
- react.useEffect(() => {
2611
- if (!isLoaded) return;
2612
- if (isProcessingRef.current) return;
2613
- isProcessingRef.current = true;
2614
- const processCallback = async () => {
2615
- const searchParams = new URLSearchParams(window.location.search);
2616
- const error = searchParams.get("error");
2617
- if (error) {
2618
- if (onError) {
2619
- onError(error);
2620
- } else {
2621
- const errorUrl = "/?error=" + encodeURIComponent(error);
2622
- if (onRedirect) {
2623
- onRedirect(errorUrl);
2624
- } else {
2625
- window.location.href = errorUrl;
2626
- }
2627
- }
2628
- return;
2629
- }
2630
- if (!isSignedIn) {
2631
- const errorMsg = "authentication_failed";
2632
- if (onError) {
2633
- onError(errorMsg);
2634
- } else {
2635
- const errorUrl = "/?error=" + encodeURIComponent(errorMsg);
2636
- if (onRedirect) {
2637
- onRedirect(errorUrl);
2638
- } else {
2639
- window.location.href = errorUrl;
2640
- }
2641
- }
2642
- return;
2643
- }
2644
- window.history.replaceState({}, "", window.location.pathname);
2645
- if (onSuccess) {
2646
- onSuccess();
2647
- }
2648
- if (onRedirect) {
2649
- onRedirect(redirectTo);
2650
- } else {
2651
- window.location.href = redirectTo;
2652
- }
2653
- };
2654
- processCallback();
2655
- }, [isLoaded, isSignedIn, redirectTo, onSuccess, onError, onRedirect]);
2656
- const defaultLoading = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center", children: [
2657
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-2xl font-semibold mb-4", children: "Completing authentication..." }),
2658
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto" })
2659
- ] }) });
2660
- return loadingComponent || defaultLoading;
2348
+ if (!isLoaded) {
2349
+ return null;
2350
+ }
2351
+ if (isSignedIn) {
2352
+ return null;
2353
+ }
2354
+ return /* @__PURE__ */ jsx(Fragment, { children });
2661
2355
  }
2662
2356
 
2663
2357
  // src/hooks/useAuth.ts
@@ -2672,7 +2366,7 @@ function useUser() {
2672
2366
  return { user, isLoaded, updateUser, setUser };
2673
2367
  }
2674
2368
  function RedirectToAuth({ baseUrl, path }) {
2675
- react.useEffect(() => {
2369
+ useEffect(() => {
2676
2370
  const callbackUrl = `${window.location.origin}/auth/callback`;
2677
2371
  const authUrl = new URL(path, baseUrl);
2678
2372
  authUrl.searchParams.set("redirect", callbackUrl);
@@ -2681,11 +2375,7 @@ function RedirectToAuth({ baseUrl, path }) {
2681
2375
  return null;
2682
2376
  }
2683
2377
  function getInsforgeRoutes(config) {
2684
- const {
2685
- baseUrl,
2686
- builtInAuth = true,
2687
- paths = {}
2688
- } = config;
2378
+ const { baseUrl, builtInAuth = true, paths = {} } = config;
2689
2379
  const {
2690
2380
  signIn = "/sign-in",
2691
2381
  signUp = "/sign-up",
@@ -2698,74 +2388,29 @@ function getInsforgeRoutes(config) {
2698
2388
  routes.push(
2699
2389
  {
2700
2390
  path: signIn,
2701
- element: /* @__PURE__ */ jsxRuntime.jsx(RedirectToAuth, { baseUrl, path: "/auth/sign-in" })
2391
+ element: /* @__PURE__ */ jsx(RedirectToAuth, { baseUrl, path: "/auth/sign-in" })
2702
2392
  },
2703
2393
  {
2704
2394
  path: signUp,
2705
- element: /* @__PURE__ */ jsxRuntime.jsx(RedirectToAuth, { baseUrl, path: "/auth/sign-up" })
2395
+ element: /* @__PURE__ */ jsx(RedirectToAuth, { baseUrl, path: "/auth/sign-up" })
2706
2396
  },
2707
2397
  {
2708
2398
  path: verifyEmail,
2709
- element: /* @__PURE__ */ jsxRuntime.jsx(RedirectToAuth, { baseUrl, path: "/auth/verify-email" })
2399
+ element: /* @__PURE__ */ jsx(RedirectToAuth, { baseUrl, path: "/auth/verify-email" })
2710
2400
  },
2711
2401
  {
2712
2402
  path: forgotPassword,
2713
- element: /* @__PURE__ */ jsxRuntime.jsx(RedirectToAuth, { baseUrl, path: "/auth/forgot-password" })
2403
+ element: /* @__PURE__ */ jsx(RedirectToAuth, { baseUrl, path: "/auth/forgot-password" })
2714
2404
  },
2715
2405
  {
2716
2406
  path: resetPassword,
2717
- element: /* @__PURE__ */ jsxRuntime.jsx(RedirectToAuth, { baseUrl, path: "/auth/reset-password" })
2407
+ element: /* @__PURE__ */ jsx(RedirectToAuth, { baseUrl, path: "/auth/reset-password" })
2718
2408
  }
2719
2409
  );
2720
2410
  }
2721
2411
  return routes;
2722
2412
  }
2723
2413
 
2724
- exports.AuthBranding = AuthBranding;
2725
- exports.AuthContainer = AuthContainer;
2726
- exports.AuthDivider = AuthDivider;
2727
- exports.AuthEmailVerificationStep = AuthEmailVerificationStep;
2728
- exports.AuthErrorBanner = AuthErrorBanner;
2729
- exports.AuthFormField = AuthFormField;
2730
- exports.AuthHeader = AuthHeader;
2731
- exports.AuthLink = AuthLink;
2732
- exports.AuthOAuthButton = AuthOAuthButton;
2733
- exports.AuthOAuthProviders = AuthOAuthProviders;
2734
- exports.AuthPasswordField = AuthPasswordField;
2735
- exports.AuthPasswordStrengthIndicator = AuthPasswordStrengthIndicator;
2736
- exports.AuthSubmitButton = AuthSubmitButton;
2737
- exports.AuthVerificationCodeInput = AuthVerificationCodeInput;
2738
- exports.ForgotPassword = ForgotPassword;
2739
- exports.ForgotPasswordForm = ForgotPasswordForm;
2740
- exports.InsforgeCallback = InsforgeCallback;
2741
- exports.InsforgeProvider = InsforgeProvider;
2742
- exports.OAUTH_PROVIDER_CONFIG = OAUTH_PROVIDER_CONFIG;
2743
- exports.Protect = Protect;
2744
- exports.ResetPassword = ResetPassword;
2745
- exports.ResetPasswordForm = ResetPasswordForm;
2746
- exports.SignIn = SignIn;
2747
- exports.SignInForm = SignInForm;
2748
- exports.SignUp = SignUp;
2749
- exports.SignUpForm = SignUpForm;
2750
- exports.SignedIn = SignedIn;
2751
- exports.SignedOut = SignedOut;
2752
- exports.UserButton = UserButton;
2753
- exports.VerifyEmail = VerifyEmail;
2754
- exports.VerifyEmailStatus = VerifyEmailStatus;
2755
- exports.checkPasswordStrength = checkPasswordStrength;
2756
- exports.cn = cn;
2757
- exports.createPasswordSchema = createPasswordSchema;
2758
- exports.emailSchema = emailSchema;
2759
- exports.getAllProviderConfigs = getAllProviderConfigs;
2760
- exports.getInsforgeRoutes = getInsforgeRoutes;
2761
- exports.getProviderConfig = getProviderConfig;
2762
- exports.passwordSchema = passwordSchema;
2763
- exports.useAuth = useAuth;
2764
- exports.useInsforge = useInsforge;
2765
- exports.usePublicAuthConfig = usePublicAuthConfig;
2766
- exports.useUser = useUser;
2767
- exports.validateEmail = validateEmail;
2768
- exports.validatePassword = validatePassword;
2769
- exports.validatePasswordStrength = validatePasswordStrength;
2414
+ export { AuthBranding, AuthContainer, AuthDivider, AuthEmailVerificationStep, AuthErrorBanner, AuthFormField, AuthHeader, AuthLink, AuthOAuthButton, AuthOAuthProviders, AuthPasswordField, AuthPasswordStrengthIndicator, AuthResetPasswordVerificationStep, AuthSubmitButton, AuthVerificationCodeInput, ForgotPassword, ForgotPasswordForm, InsforgeProvider, OAUTH_PROVIDER_CONFIG, Protect, ResetPassword, ResetPasswordForm, SignIn, SignInForm, SignUp, SignUpForm, SignedIn, SignedOut, UserButton, VerifyEmail, VerifyEmailStatus, checkPasswordStrength, createPasswordSchema, emailSchema, getAllProviderConfigs, getInsforgeRoutes, getProviderConfig, passwordSchema, useAuth, useInsforge, usePublicAuthConfig, useUser, validateEmail, validatePassword };
2770
2415
  //# sourceMappingURL=index.js.map
2771
2416
  //# sourceMappingURL=index.js.map