@insforge/nextjs 0.7.10 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,25 +1,8 @@
1
1
  "use client";
2
-
3
- // Auto-inject InsForge styles
4
- if (typeof document !== 'undefined' && typeof window !== 'undefined') {
5
- const styleId = 'insforge-nextjs-styles';
6
- if (!document.getElementById(styleId)) {
7
- const style = document.createElement('style');
8
- style.id = styleId;
9
- 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-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-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-purple-600:oklch(55.8% .288 302.321);--color-purple-700:oklch(49.6% .265 301.924);--color-purple-900:oklch(38.1% .176 304.987);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-gray-900:oklch(21% .034 264.665);--color-neutral-400:oklch(70.8% 0 0);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-md:28rem;--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;--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)}.ml-auto{margin-left:auto}.flex{display:flex}.grid{display:grid}.inline{display:inline}.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-9{height:calc(var(--spacing)*9)}.h-10{height:calc(var(--spacing)*10)}.h-12{height:calc(var(--spacing)*12)}.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-10{width:calc(var(--spacing)*10)}.w-12{width:calc(var(--spacing)*12)}.w-\\[18px\\]{width:18px}.w-full{width:100%}.max-w-\\[400px\\]{max-width:400px}.max-w-md{max-width:var(--container-md)}.min-w-40{min-width:calc(var(--spacing)*40)}.flex-1{flex:1}.flex-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-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.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-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-gray-700{border-color:var(--color-gray-700)}.border-neutral-400{border-color:var(--color-neutral-400)}.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-100{background-color:var(--color-gray-100)}.bg-gray-900{background-color:var(--color-gray-900)}.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)}.object-cover{object-fit:cover}.p-1{padding:calc(var(--spacing)*1)}.p-2{padding:calc(var(--spacing)*2)}.p-5{padding:calc(var(--spacing)*5)}.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)}.pr-2{padding-right:calc(var(--spacing)*2)}.pr-8{padding-right:calc(var(--spacing)*8)}.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)}.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-300{color:var(--color-gray-300)}.text-gray-500{color:var(--color-gray-500)}.text-gray-900{color:var(--color-gray-900)}.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)}.uppercase{text-transform:uppercase}.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-100:hover{background-color:var(--color-gray-100)}.hover\\:bg-gray-800:hover{background-color:var(--color-gray-800)}.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)}}.focus\\:border-black:focus{border-color:var(--color-black)}.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\\:opacity-50:disabled{opacity:.5}.disabled\\:opacity-60:disabled{opacity:.6}}@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-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)}}";
10
- if (document.head) {
11
- document.head.appendChild(style);
12
- }
13
- }
14
- }
15
-
16
2
  "use strict";
17
- "use client";
18
- var __create = Object.create;
19
3
  var __defProp = Object.defineProperty;
20
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
21
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
22
- var __getProtoOf = Object.getPrototypeOf;
23
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
24
7
  var __export = (target, all) => {
25
8
  for (var name in all)
@@ -33,57 +16,22 @@ var __copyProps = (to, from, except, desc) => {
33
16
  }
34
17
  return to;
35
18
  };
36
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
37
- // If the importer is in node compatibility mode or this is not an ESM
38
- // file that has been converted to a CommonJS file using a Babel-
39
- // compatible transform (i.e. "__esModule" has not been set), then set
40
- // "default" to the CommonJS "module.exports" for node compatibility.
41
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
42
- mod
43
- ));
19
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
44
20
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
45
21
 
46
22
  // src/index.ts
47
23
  var src_exports = {};
48
24
  __export(src_exports, {
49
- AuthBranding: () => AuthBranding,
50
- AuthContainer: () => AuthContainer,
51
- AuthDivider: () => AuthDivider,
52
- AuthErrorBanner: () => AuthErrorBanner,
53
- AuthFormField: () => AuthFormField,
54
- AuthHeader: () => AuthHeader,
55
- AuthLink: () => AuthLink,
56
- AuthOAuthButton: () => AuthOAuthButton,
57
- AuthOAuthProviders: () => AuthOAuthProviders,
58
- AuthPasswordField: () => AuthPasswordField,
59
- AuthPasswordStrengthIndicator: () => AuthPasswordStrengthIndicator,
60
- AuthSubmitButton: () => AuthSubmitButton,
61
- AuthVerificationCodeInput: () => AuthVerificationCodeInput,
62
- InsforgeCallback: () => InsforgeCallback,
63
25
  InsforgeProvider: () => InsforgeProvider,
64
- OAUTH_PROVIDER_CONFIG: () => OAUTH_PROVIDER_CONFIG,
65
- Protect: () => Protect,
66
- SignIn: () => SignIn,
67
- SignUp: () => SignUp,
68
- SignedIn: () => SignedIn,
69
- SignedOut: () => SignedOut,
70
- UserButton: () => UserButton,
71
26
  cn: () => cn,
72
- getProviderConfig: () => getProviderConfig,
73
- getProviderName: () => getProviderName,
74
- isProviderSupported: () => isProviderSupported,
75
- useAuth: () => useAuth,
76
- useInsforge: () => useInsforge,
77
- useUser: () => useUser,
78
- validatePasswordStrength: () => validatePasswordStrength
27
+ useInsforge: () => useInsforge
79
28
  });
80
29
  module.exports = __toCommonJS(src_exports);
30
+ __reExport(src_exports, require("@insforge/react/types"), module.exports);
81
31
 
82
32
  // src/provider/InsforgeProvider.tsx
83
- var import_react = require("react");
84
- var import_sdk = require("@insforge/sdk");
33
+ var import_react = require("@insforge/react");
85
34
  var import_jsx_runtime = require("react/jsx-runtime");
86
- var InsforgeContext = (0, import_react.createContext)(void 0);
87
35
  async function syncTokenToCookie(token) {
88
36
  try {
89
37
  const response = await fetch("/api/auth", {
@@ -104,310 +52,29 @@ async function syncTokenToCookie(token) {
104
52
  return false;
105
53
  }
106
54
  }
55
+ async function clearCookie() {
56
+ try {
57
+ await fetch("/api/auth", { method: "DELETE" });
58
+ } catch (error) {
59
+ }
60
+ }
107
61
  function InsforgeProvider({
108
62
  children,
109
63
  baseUrl,
110
64
  onAuthChange
111
65
  }) {
112
- const [user, setUser] = (0, import_react.useState)(null);
113
- const [isLoaded, setIsLoaded] = (0, import_react.useState)(false);
114
- const refreshIntervalRef = (0, import_react.useRef)(null);
115
- const [insforge] = (0, import_react.useState)(() => (0, import_sdk.createClient)({ baseUrl }));
116
- const loadAuthState = (0, import_react.useCallback)(async () => {
117
- try {
118
- const sessionResult = insforge.auth.getCurrentSession();
119
- const session = sessionResult.data?.session;
120
- const token = session?.accessToken || null;
121
- if (!token) {
122
- setUser(null);
123
- if (onAuthChange) {
124
- onAuthChange(null);
125
- }
126
- setIsLoaded(true);
127
- return { success: false, error: "no_session" };
128
- }
129
- try {
130
- await syncTokenToCookie(token);
131
- } catch (error) {
132
- }
133
- const userResult = await insforge.auth.getCurrentUser();
134
- if (userResult.data) {
135
- const userData = {
136
- id: userResult.data.user.id,
137
- email: userResult.data.user.email,
138
- name: userResult.data.profile?.nickname || "",
139
- avatarUrl: userResult.data.profile?.avatarUrl || ""
140
- };
141
- setUser(userData);
142
- if (onAuthChange) {
143
- onAuthChange(userData);
144
- }
145
- setIsLoaded(true);
146
- return { success: true };
147
- } else {
148
- await insforge.auth.signOut();
149
- try {
150
- await fetch("/api/auth", { method: "DELETE" });
151
- } catch (error) {
152
- }
153
- setUser(null);
154
- if (onAuthChange) {
155
- onAuthChange(null);
156
- }
157
- setIsLoaded(true);
158
- return { success: false, error: "invalid_token" };
159
- }
160
- } catch (error) {
161
- console.error("[InsforgeProvider] Token validation failed:", error);
162
- await insforge.auth.signOut();
163
- try {
164
- await fetch("/api/auth", { method: "DELETE" });
165
- } catch (error2) {
166
- }
167
- setUser(null);
168
- if (onAuthChange) {
169
- onAuthChange(null);
170
- }
171
- setIsLoaded(true);
172
- return {
173
- success: false,
174
- error: error instanceof Error ? error.message : "authentication_failed"
175
- };
176
- }
177
- }, [insforge, onAuthChange]);
178
- (0, import_react.useEffect)(() => {
179
- loadAuthState();
180
- return () => {
181
- if (refreshIntervalRef.current) {
182
- clearInterval(refreshIntervalRef.current);
183
- }
184
- };
185
- }, []);
186
- const handleAuthSuccess = (0, import_react.useCallback)(
187
- async (authToken, fallbackUser) => {
188
- const userResult = await insforge.auth.getCurrentUser();
189
- if (userResult.data) {
190
- const userData = {
191
- id: userResult.data.user.id,
192
- email: userResult.data.user.email,
193
- name: userResult.data.profile?.nickname || "",
194
- avatarUrl: userResult.data.profile?.avatarUrl || ""
195
- };
196
- setUser(userData);
197
- if (onAuthChange) {
198
- onAuthChange(userData);
199
- }
200
- try {
201
- await syncTokenToCookie(authToken);
202
- } catch (error) {
203
- }
204
- } else if (fallbackUser) {
205
- const userData = {
206
- id: fallbackUser.id || "",
207
- email: fallbackUser.email || "",
208
- name: fallbackUser.name || "",
209
- avatarUrl: ""
210
- };
211
- setUser(userData);
212
- if (onAuthChange) {
213
- onAuthChange(userData);
214
- }
215
- }
216
- },
217
- [insforge, onAuthChange]
218
- );
219
- const signIn = (0, import_react.useCallback)(
220
- async (email, password) => {
221
- const sdkResult = await insforge.auth.signInWithPassword({ email, password });
222
- if (sdkResult.data) {
223
- await handleAuthSuccess(
224
- sdkResult.data.accessToken || "",
225
- sdkResult.data.user ? {
226
- id: sdkResult.data.user.id,
227
- email: sdkResult.data.user.email,
228
- name: sdkResult.data.user.name
229
- } : void 0
230
- );
231
- } else {
232
- const errorMessage = sdkResult.error?.message || "Invalid email or password";
233
- throw new Error(errorMessage);
234
- }
235
- },
236
- [insforge, handleAuthSuccess]
237
- );
238
- const signUp = (0, import_react.useCallback)(
239
- async (email, password) => {
240
- const sdkResult = await insforge.auth.signUp({ email, password });
241
- if (sdkResult.data) {
242
- await handleAuthSuccess(
243
- sdkResult.data.accessToken || "",
244
- sdkResult.data.user ? {
245
- id: sdkResult.data.user.id,
246
- email: sdkResult.data.user.email,
247
- name: sdkResult.data.user.name
248
- } : void 0
249
- );
250
- } else {
251
- const errorMessage = sdkResult.error?.message || "Sign up failed";
252
- throw new Error(errorMessage);
253
- }
254
- },
255
- [insforge, handleAuthSuccess]
256
- );
257
- const signOut = (0, import_react.useCallback)(async () => {
258
- await insforge.auth.signOut();
259
- await fetch("/api/auth", { method: "DELETE" }).catch(() => {
260
- });
261
- if (refreshIntervalRef.current) {
262
- clearInterval(refreshIntervalRef.current);
263
- }
264
- setUser(null);
265
- if (onAuthChange) {
266
- onAuthChange(null);
267
- }
268
- }, [insforge, onAuthChange]);
269
- const updateUser = (0, import_react.useCallback)(
270
- async (data) => {
271
- if (!user) throw new Error("No user signed in");
272
- const result = await insforge.auth.setProfile({
273
- nickname: data.name || "",
274
- avatarUrl: data.avatarUrl || ""
275
- });
276
- if (result.data) {
277
- const updatedUser = { ...user, ...result.data };
278
- setUser(updatedUser);
279
- if (onAuthChange) {
280
- onAuthChange(updatedUser);
281
- }
282
- }
283
- },
284
- [user, onAuthChange, insforge]
285
- );
286
66
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
287
- InsforgeContext.Provider,
67
+ import_react.InsforgeProvider,
288
68
  {
289
- value: {
290
- // Auth
291
- user,
292
- isLoaded,
293
- isSignedIn: !!user,
294
- setUser,
295
- signIn,
296
- signUp,
297
- signOut,
298
- updateUser,
299
- reloadAuth: loadAuthState,
300
- // Email verification (commented out - verification disabled for now)
301
- // sendVerificationCode,
302
- // verifySignUpCode,
303
- // verifySignInCode,
304
- // Base
305
- baseUrl
306
- },
69
+ baseUrl,
70
+ onAuthChange,
71
+ syncTokenToCookie,
72
+ clearCookie,
307
73
  children
308
74
  }
309
75
  );
310
76
  }
311
- function useInsforge() {
312
- const context = (0, import_react.useContext)(InsforgeContext);
313
- if (!context) {
314
- throw new Error("useInsforge must be used within InsforgeProvider");
315
- }
316
- return context;
317
- }
318
-
319
- // src/hooks/useAuth.ts
320
- function useAuth() {
321
- const { signIn, signUp, signOut, isLoaded, isSignedIn } = useInsforge();
322
- return { signIn, signUp, signOut, isLoaded, isSignedIn };
323
- }
324
-
325
- // src/hooks/useUser.ts
326
- function useUser() {
327
- const { user, isLoaded, updateUser, setUser } = useInsforge();
328
- return { user, isLoaded, updateUser, setUser };
329
- }
330
-
331
- // src/components/SignIn.tsx
332
- var import_react6 = require("react");
333
- var import_sdk4 = require("@insforge/sdk");
334
-
335
- // src/hooks/useOAuthProviders.ts
336
- var import_react2 = require("react");
337
- var import_sdk2 = require("@insforge/sdk");
338
- function useOAuthProviders() {
339
- const { baseUrl } = useInsforge();
340
- const [providers, setProviders] = (0, import_react2.useState)([]);
341
- const [isLoaded, setIsLoaded] = (0, import_react2.useState)(false);
342
- (0, import_react2.useEffect)(() => {
343
- let mounted = true;
344
- async function fetchProviders() {
345
- try {
346
- const insforge = (0, import_sdk2.createClient)({ baseUrl });
347
- const { data, error } = await insforge.auth.getOAuthProviders();
348
- if (!mounted) return;
349
- if (error) {
350
- console.warn("[useOAuthProviders] Failed to fetch OAuth providers:", error);
351
- setProviders([]);
352
- } else if (data) {
353
- const providerNames = data.map((p) => p.provider);
354
- setProviders(providerNames);
355
- } else {
356
- setProviders([]);
357
- }
358
- setIsLoaded(true);
359
- } catch (error) {
360
- console.warn("[useOAuthProviders] Unexpected error:", error);
361
- if (mounted) {
362
- setProviders([]);
363
- setIsLoaded(true);
364
- }
365
- }
366
- }
367
- fetchProviders();
368
- return () => {
369
- mounted = false;
370
- };
371
- }, [baseUrl]);
372
- return { providers, isLoaded };
373
- }
374
-
375
- // src/hooks/useEmailAuthConfig.ts
376
- var import_react3 = require("react");
377
- var import_sdk3 = require("@insforge/sdk");
378
- function useEmailAuthConfig() {
379
- const { baseUrl } = useInsforge();
380
- const [config, setConfig] = (0, import_react3.useState)(null);
381
- const [isLoaded, setIsLoaded] = (0, import_react3.useState)(false);
382
- (0, import_react3.useEffect)(() => {
383
- let mounted = true;
384
- async function fetchConfig() {
385
- try {
386
- const insforge = (0, import_sdk3.createClient)({ baseUrl });
387
- const { data, error } = await insforge.auth.getEmailAuthConfig();
388
- if (!mounted) return;
389
- if (error) {
390
- console.warn("[useEmailAuthConfig] Failed to fetch email auth config:", error);
391
- setConfig(null);
392
- } else {
393
- setConfig(data);
394
- }
395
- setIsLoaded(true);
396
- } catch (error) {
397
- console.warn("[useEmailAuthConfig] Unexpected error:", error);
398
- if (mounted) {
399
- setConfig(null);
400
- setIsLoaded(true);
401
- }
402
- }
403
- }
404
- fetchConfig();
405
- return () => {
406
- mounted = false;
407
- };
408
- }, [baseUrl]);
409
- return { config, isLoaded };
410
- }
77
+ var useInsforge = import_react.useInsforge;
411
78
 
412
79
  // src/lib/utils.ts
413
80
  var import_clsx = require("clsx");
@@ -416,1338 +83,16 @@ function cn(...inputs) {
416
83
  return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
417
84
  }
418
85
 
419
- // src/components/auth/AuthBranding.tsx
420
- var import_link = __toESM(require("next/link"));
421
- var import_jsx_runtime2 = require("react/jsx-runtime");
422
- function AuthBranding() {
423
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "bg-[#FAFAFA] px-2 py-4 flex flex-row justify-center items-center gap-1", children: [
424
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "text-xs font-medium text-black font-manrope", children: "Secured by" }),
425
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_link.default, { href: "https://insforge.dev", target: "_blank", rel: "noopener noreferrer", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("svg", { width: "83", height: "20", viewBox: "0 0 83 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
426
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
427
- "path",
428
- {
429
- 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",
430
- fill: "url(#paint0_linear_2976_9475)"
431
- }
432
- ),
433
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
434
- "path",
435
- {
436
- d: "M12.8858 6.44922L16.6 10.168V18.668L8.64108 10.6992L12.8858 6.44922Z",
437
- fill: "url(#paint1_linear_2976_9475)"
438
- }
439
- ),
440
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
441
- "path",
442
- {
443
- 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",
444
- fill: "black"
445
- }
446
- ),
447
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("defs", { children: [
448
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
449
- "linearGradient",
450
- {
451
- id: "paint0_linear_2976_9475",
452
- x1: "1.85883",
453
- y1: "1.92425",
454
- x2: "24.3072",
455
- y2: "9.64016",
456
- gradientUnits: "userSpaceOnUse",
457
- children: [
458
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("stop", {}),
459
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("stop", { offset: "1", stopOpacity: "0.4" })
460
- ]
461
- }
462
- ),
463
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
464
- "linearGradient",
465
- {
466
- id: "paint1_linear_2976_9475",
467
- x1: "25.6475",
468
- y1: "8.65468",
469
- x2: "10.7901",
470
- y2: "8.65468",
471
- gradientUnits: "userSpaceOnUse",
472
- children: [
473
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("stop", {}),
474
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("stop", { offset: "1", stopOpacity: "0.4" })
475
- ]
476
- }
477
- )
478
- ] })
479
- ] }) })
480
- ] });
481
- }
482
-
483
- // src/components/auth/AuthContainer.tsx
484
- var import_jsx_runtime3 = require("react/jsx-runtime");
485
- function AuthContainer({ children, appearance = {} }) {
486
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
487
- "div",
488
- {
489
- className: cn(
490
- "w-full max-w-[400px] rounded-xl overflow-hidden shadow-lg",
491
- appearance.containerClassName
492
- ),
493
- children: [
494
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: cn(
495
- "bg-white p-6 flex flex-col justify-center items-stretch gap-6",
496
- appearance.cardClassName
497
- ), children }),
498
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(AuthBranding, {})
499
- ]
500
- }
501
- );
502
- }
503
-
504
- // src/components/auth/AuthHeader.tsx
505
- var import_jsx_runtime4 = require("react/jsx-runtime");
506
- function AuthHeader({
507
- title,
508
- subtitle,
509
- appearance = {}
510
- }) {
511
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: cn(
512
- "flex flex-col justify-start items-start gap-2",
513
- appearance.containerClassName
514
- ), children: [
515
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h1", { className: cn(
516
- "text-2xl font-semibold text-black leading-8",
517
- appearance.titleClassName
518
- ), children: title }),
519
- subtitle && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: cn(
520
- "text-sm font-normal text-[#828282] leading-6",
521
- appearance.subtitleClassName
522
- ), children: subtitle })
523
- ] });
524
- }
525
-
526
- // src/components/auth/AuthErrorBanner.tsx
527
- var import_lucide_react = require("lucide-react");
528
- var import_jsx_runtime5 = require("react/jsx-runtime");
529
- function AuthErrorBanner({ error, className }) {
530
- if (!error) return null;
531
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
532
- "div",
533
- {
534
- className: cn(
535
- "flex items-center gap-2 mb-4 pl-3 py-2 pr-2 bg-red-50 border-2 border-red-600 rounded",
536
- className
537
- ),
538
- children: [
539
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react.AlertTriangle, { className: "w-6 h-6 text-red-500 flex-shrink-0" }),
540
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-sm text-red-600 flex-1", children: error })
541
- ]
542
- }
543
- );
544
- }
545
-
546
- // src/components/auth/AuthFormField.tsx
547
- var import_jsx_runtime6 = require("react/jsx-runtime");
548
- function AuthFormField({
549
- label,
550
- id,
551
- appearance = {},
552
- ...props
553
- }) {
554
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: cn(
555
- "flex flex-col justify-center items-stretch gap-1",
556
- appearance.containerClassName
557
- ), children: [
558
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
559
- "label",
560
- {
561
- htmlFor: id,
562
- className: cn(
563
- "text-sm font-normal text-black leading-6",
564
- appearance.labelClassName
565
- ),
566
- children: label
567
- }
568
- ),
569
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
570
- "input",
571
- {
572
- id,
573
- className: cn(
574
- "w-full flex items-center gap-2 self-stretch",
575
- "pl-3 pr-2 py-2 rounded-sm border border-[#D4D4D4] bg-white",
576
- "text-sm font-normal leading-5",
577
- "placeholder:text-[#A3A3A3] placeholder:font-sm placeholder:font-normal",
578
- "focus:outline-none focus:border-black",
579
- appearance.inputClassName
580
- ),
581
- ...props
582
- }
583
- )
584
- ] });
585
- }
586
-
587
- // src/components/auth/AuthPasswordField.tsx
588
- var import_react4 = require("react");
589
- var import_lucide_react3 = require("lucide-react");
590
-
591
- // src/components/auth/AuthPasswordStrengthIndicator.tsx
592
- var import_lucide_react2 = require("lucide-react");
593
- var import_jsx_runtime7 = require("react/jsx-runtime");
594
- function AuthPasswordStrengthIndicator({
595
- password,
596
- config,
597
- appearance = {}
598
- }) {
599
- const requirements = createRequirements(config);
600
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
601
- "div",
602
- {
603
- className: cn("mt-3 flex flex-col gap-3", appearance.containerClassName),
604
- children: requirements.map((req) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-2", children: [
605
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
606
- "div",
607
- {
608
- className: cn(
609
- "flex items-center justify-center w-4 h-4 rounded-full border-2 transition-colors",
610
- req.test(password) ? "bg-[#059669] border-transparent" : "border-neutral-400 bg-white"
611
- ),
612
- children: req.test(password) && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react2.Check, { className: "w-3 h-3 text-white" })
613
- }
614
- ),
615
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
616
- "span",
617
- {
618
- className: cn(
619
- "text-sm font-normal leading-5 text-[#525252]",
620
- appearance.requirementClassName
621
- ),
622
- children: req.label
623
- }
624
- )
625
- ] }, req.label))
626
- }
627
- );
628
- }
629
- function createRequirements(config) {
630
- const requirements = [];
631
- const minLength = config.passwordMinLength;
632
- const requireUppercase = config.requireUppercase;
633
- const requireLowercase = config.requireLowercase;
634
- const requireNumber = config.requireNumber;
635
- const requireSpecialChar = config.requireSpecialChar;
636
- if (requireUppercase) {
637
- requirements.push({
638
- label: "At least 1 Uppercase letter",
639
- test: (pwd) => /[A-Z]/.test(pwd)
640
- });
641
- }
642
- if (requireLowercase) {
643
- requirements.push({
644
- label: "At least 1 Lowercase letter",
645
- test: (pwd) => /[a-z]/.test(pwd)
646
- });
647
- }
648
- if (requireNumber) {
649
- requirements.push({
650
- label: "At least 1 Number",
651
- test: (pwd) => /\d/.test(pwd)
652
- });
653
- }
654
- if (requireSpecialChar) {
655
- requirements.push({
656
- label: "Special character (e.g. !?<>@#$%)",
657
- test: (pwd) => /[!@#$%^&*()_+\-=[\]{};\\|,.<>/?]/.test(pwd)
658
- });
659
- }
660
- requirements.push({
661
- label: `${minLength} characters or more`,
662
- test: (pwd) => pwd.length >= minLength
663
- });
664
- return requirements;
665
- }
666
- function validatePasswordStrength(password, config) {
667
- if (!password) return false;
668
- const requirements = createRequirements(config);
669
- return requirements.every((req) => req.test(password));
670
- }
671
-
672
- // src/components/auth/AuthPasswordField.tsx
673
- var import_jsx_runtime8 = require("react/jsx-runtime");
674
- function AuthPasswordField({
675
- label,
676
- id,
677
- showStrengthIndicator = false,
678
- emailAuthConfig,
679
- forgotPasswordLink,
680
- value,
681
- appearance = {},
682
- onFocus,
683
- ...props
684
- }) {
685
- const [showPassword, setShowPassword] = (0, import_react4.useState)(false);
686
- const [showStrength, setShowStrength] = (0, import_react4.useState)(false);
687
- const handleFocus = (e) => {
688
- if (showStrengthIndicator) {
689
- setShowStrength(true);
690
- }
691
- onFocus?.(e);
692
- };
693
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
694
- "div",
695
- {
696
- className: cn(
697
- "flex flex-col justify-center items-stretch gap-1",
698
- appearance.containerClassName
699
- ),
700
- children: [
701
- (label || forgotPasswordLink) && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex justify-between items-center", children: [
702
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
703
- "label",
704
- {
705
- htmlFor: id,
706
- className: cn(
707
- "text-sm font-normal text-black leading-6",
708
- appearance.labelClassName
709
- ),
710
- children: label
711
- }
712
- ),
713
- forgotPasswordLink && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
714
- "a",
715
- {
716
- href: forgotPasswordLink.href,
717
- className: "text-right text-sm font-normal text-[#737373] leading-6",
718
- children: forgotPasswordLink.text || "Forget Password?"
719
- }
720
- )
721
- ] }),
722
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "relative", children: [
723
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
724
- "input",
725
- {
726
- id,
727
- type: showPassword ? "text" : "password",
728
- className: cn(
729
- "w-full flex items-center gap-2 self-stretch",
730
- "pl-3 py-2 pr-8 rounded border border-[#D4D4D4] bg-white",
731
- "text-sm font-normal leading-5",
732
- "placeholder:text-[#A3A3A3] placeholder:font-sm placeholder:font-normal",
733
- "focus:outline-none focus:border-black",
734
- appearance.inputClassName
735
- ),
736
- value,
737
- onFocus: handleFocus,
738
- ...props
739
- }
740
- ),
741
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
742
- "button",
743
- {
744
- type: "button",
745
- onClick: () => setShowPassword(!showPassword),
746
- 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",
747
- "aria-label": showPassword ? "Hide password" : "Show password",
748
- children: showPassword ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react3.EyeOff, { size: 20 }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react3.Eye, { size: 20 })
749
- }
750
- )
751
- ] }),
752
- showStrengthIndicator && showStrength && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
753
- AuthPasswordStrengthIndicator,
754
- {
755
- password: String(value || ""),
756
- config: emailAuthConfig
757
- }
758
- )
759
- ]
760
- }
761
- );
762
- }
763
-
764
- // src/components/auth/AuthSubmitButton.tsx
765
- var import_lucide_react4 = require("lucide-react");
766
- var import_jsx_runtime9 = require("react/jsx-runtime");
767
- function AuthSubmitButton({
768
- children,
769
- isLoading = false,
770
- confirmed = false,
771
- disabled = false,
772
- className
773
- }) {
774
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
775
- "button",
776
- {
777
- type: "submit",
778
- className: cn(
779
- "rounded-sm bg-black w-full flex mt-4 px-4 py-2",
780
- "justify-center items-center gap-2.5 self-stretch",
781
- "text-white font-semibold font-manrope text-base leading-normal",
782
- "border-none cursor-pointer transition-colors",
783
- "hover:bg-gray-800",
784
- "disabled:opacity-50 disabled:cursor-not-allowed",
785
- className
786
- ),
787
- disabled: disabled || isLoading || confirmed,
788
- children: [
789
- isLoading && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.Loader2, { className: "w-5 h-5 animate-spin", size: 20 }),
790
- confirmed && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.CircleCheck, { className: "w-5 h-5", size: 20 }),
791
- children
792
- ]
793
- }
794
- );
795
- }
796
-
797
- // src/components/auth/AuthDivider.tsx
798
- var import_jsx_runtime10 = require("react/jsx-runtime");
799
- function AuthDivider({ text = "or", className }) {
800
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: cn(
801
- "flex justify-center items-center gap-6 self-stretch",
802
- "before:content-[''] before:flex-1 before:h-px before:bg-[#E5E5E5]",
803
- "after:content-[''] after:flex-1 after:h-px after:bg-[#E5E5E5]",
804
- className
805
- ), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-sm font-semibold font-manrope text-[#A3A3A3] leading-normal", children: text }) });
806
- }
807
-
808
- // src/components/auth/AuthLink.tsx
809
- var import_jsx_runtime11 = require("react/jsx-runtime");
810
- function AuthLink({ text, linkText, href, appearance = {} }) {
811
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("p", { className: cn(
812
- "text-center text-sm font-normal text-[#828282] leading-6",
813
- appearance.containerClassName
814
- ), children: [
815
- text,
816
- " ",
817
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
818
- "a",
819
- {
820
- href,
821
- className: cn(
822
- "text-sm font-medium text-black leading-6",
823
- appearance.linkClassName
824
- ),
825
- children: linkText
826
- }
827
- )
828
- ] });
829
- }
830
-
831
- // src/components/auth/AuthOAuthButton.tsx
832
- var import_lucide_react5 = require("lucide-react");
833
-
834
- // src/config/oauth-providers.tsx
835
- var import_jsx_runtime12 = require("react/jsx-runtime");
836
- var OAUTH_PROVIDER_CONFIG = {
837
- google: {
838
- name: "Google",
839
- svg: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", children: [
840
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
841
- "path",
842
- {
843
- 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",
844
- fill: "#4285F4"
845
- }
846
- ),
847
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
848
- "path",
849
- {
850
- 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",
851
- fill: "#34A853"
852
- }
853
- ),
854
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
855
- "path",
856
- {
857
- 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",
858
- fill: "#FBBC05"
859
- }
860
- ),
861
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
862
- "path",
863
- {
864
- 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",
865
- fill: "#EA4335"
866
- }
867
- )
868
- ] }),
869
- className: "insforge-oauth-google"
870
- },
871
- github: {
872
- name: "GitHub",
873
- svg: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("svg", { width: "18", height: "18", viewBox: "0 0 16 16", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime12.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" }) }),
874
- className: "insforge-oauth-github"
875
- },
876
- discord: {
877
- name: "Discord",
878
- svg: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
879
- "path",
880
- {
881
- 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",
882
- fill: "#5865F2"
883
- }
884
- ) }),
885
- className: "insforge-oauth-discord"
886
- },
887
- facebook: {
888
- name: "Facebook",
889
- svg: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
890
- "path",
891
- {
892
- 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",
893
- fill: "#1877F2"
894
- }
895
- ) }),
896
- className: "insforge-oauth-facebook"
897
- },
898
- linkedin: {
899
- name: "LinkedIn",
900
- svg: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
901
- "path",
902
- {
903
- 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",
904
- fill: "#0A66C2"
905
- }
906
- ) }),
907
- className: "insforge-oauth-linkedin"
908
- },
909
- microsoft: {
910
- name: "Microsoft",
911
- svg: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 23 23", fill: "none", children: [
912
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M0 0h11v11H0z", fill: "#F25022" }),
913
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M12 0h11v11H12z", fill: "#7FBA00" }),
914
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M0 12h11v11H0z", fill: "#00A4EF" }),
915
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M12 12h11v11H12z", fill: "#FFB900" })
916
- ] }),
917
- className: "insforge-oauth-microsoft"
918
- },
919
- apple: {
920
- name: "Apple",
921
- svg: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime12.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" }) }),
922
- className: "insforge-oauth-apple"
923
- },
924
- x: {
925
- name: "X",
926
- svg: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime12.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" }) }),
927
- className: "insforge-oauth-x"
928
- },
929
- instagram: {
930
- name: "Instagram",
931
- svg: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", children: [
932
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
933
- "path",
934
- {
935
- 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",
936
- fill: "url(#instagram-gradient)"
937
- }
938
- ),
939
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("linearGradient", { id: "instagram-gradient", x1: "0%", y1: "100%", x2: "100%", y2: "0%", children: [
940
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("stop", { offset: "0%", stopColor: "#FD5949" }),
941
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("stop", { offset: "50%", stopColor: "#D6249F" }),
942
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("stop", { offset: "100%", stopColor: "#285AEB" })
943
- ] }) })
944
- ] }),
945
- className: "insforge-oauth-instagram"
946
- },
947
- tiktok: {
948
- name: "TikTok",
949
- svg: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
950
- "path",
951
- {
952
- 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",
953
- fill: "currentColor"
954
- }
955
- ) }),
956
- className: "insforge-oauth-tiktok"
957
- },
958
- spotify: {
959
- name: "Spotify",
960
- svg: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
961
- "path",
962
- {
963
- 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",
964
- fill: "#1DB954"
965
- }
966
- ) }),
967
- className: "insforge-oauth-spotify"
968
- }
969
- };
970
- function getProviderConfig(provider) {
971
- return OAUTH_PROVIDER_CONFIG[provider] || null;
972
- }
973
- function getProviderName(provider) {
974
- return OAUTH_PROVIDER_CONFIG[provider]?.name || provider;
975
- }
976
- function isProviderSupported(provider) {
977
- return provider in OAUTH_PROVIDER_CONFIG;
978
- }
979
-
980
- // src/components/auth/AuthOAuthButton.tsx
981
- var import_jsx_runtime13 = require("react/jsx-runtime");
982
- function AuthOAuthButton({
983
- provider,
984
- onClick,
985
- disabled,
986
- loading,
987
- displayMode = "full",
988
- style,
989
- className
990
- }) {
991
- const config = getProviderConfig(provider);
992
- if (!config) {
993
- return null;
994
- }
995
- const getButtonText = () => {
996
- if (loading) return "Authenticating...";
997
- if (displayMode === "full") return `Continue with ${config.name}`;
998
- if (displayMode === "short") return config.name;
999
- return "";
1000
- };
1001
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
1002
- "button",
1003
- {
1004
- type: "button",
1005
- onClick: () => onClick(provider),
1006
- className: cn(
1007
- "flex w-full h-9 px-3 py-2",
1008
- "flex-row justify-center items-center gap-3",
1009
- "rounded-md border border-[#E4E4E7] bg-white",
1010
- "shadow-[0_1px_2px_0_rgba(0,0,0,0.10)]",
1011
- "text-[#09090B] text-center text-sm font-medium leading-5",
1012
- "cursor-pointer transition-all duration-200",
1013
- "hover:bg-[#f9fafb] hover:border-[#9ca3af]",
1014
- "disabled:opacity-60 disabled:cursor-not-allowed",
1015
- displayMode === "full" && "justify-center",
1016
- displayMode === "short" && "justify-center px-2 gap-2",
1017
- displayMode === "icon" && "justify-center gap-0",
1018
- className
1019
- ),
1020
- disabled: disabled || loading,
1021
- style,
1022
- children: [
1023
- loading ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react5.Loader2, { className: "w-[18px] h-[18px] animate-spin", size: 18 }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "flex items-center justify-center flex-shrink-0", children: config.svg }),
1024
- getButtonText() && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: getButtonText() })
1025
- ]
1026
- }
1027
- );
1028
- }
1029
-
1030
- // src/components/auth/AuthOAuthProviders.tsx
1031
- var import_jsx_runtime14 = require("react/jsx-runtime");
1032
- function AuthOAuthProviders({
1033
- providers,
1034
- onClick,
1035
- disabled,
1036
- loading,
1037
- appearance = {}
1038
- }) {
1039
- if (!providers || providers.length === 0) {
1040
- return null;
1041
- }
1042
- const count = providers.length;
1043
- const getDisplayMode = () => {
1044
- if (count === 1) return "full";
1045
- if (count === 2 || count === 4) return "short";
1046
- return "icon";
1047
- };
1048
- const getGridColumnStyle = (index) => {
1049
- if (count <= 4) {
1050
- return {};
1051
- }
1052
- const totalRows = Math.ceil(count / 3);
1053
- const lastRowStartIndex = (totalRows - 1) * 3;
1054
- const isInLastRow = index >= lastRowStartIndex;
1055
- if (!isInLastRow) {
1056
- return { gridColumn: "span 2" };
1057
- }
1058
- const positionInLastRow = index - lastRowStartIndex;
1059
- const itemsInLastRow = count - lastRowStartIndex;
1060
- if (itemsInLastRow === 1) {
1061
- return { gridColumn: "3 / 5" };
1062
- } else if (itemsInLastRow === 2) {
1063
- if (positionInLastRow === 0) {
1064
- return { gridColumn: "2 / 4" };
1065
- } else {
1066
- return { gridColumn: "4 / 6" };
1067
- }
1068
- } else {
1069
- return { gridColumn: "span 2" };
1070
- }
1071
- };
1072
- const getGridClass = () => {
1073
- if (count === 1) return "grid-cols-1";
1074
- if (count === 2) return "grid-cols-2";
1075
- if (count === 3) return "grid-cols-3";
1076
- if (count === 4) return "grid-cols-2";
1077
- return "grid-cols-6";
1078
- };
1079
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: cn(
1080
- "grid gap-3 w-full",
1081
- getGridClass(),
1082
- appearance.containerClassName
1083
- ), children: providers.map((provider, index) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1084
- AuthOAuthButton,
1085
- {
1086
- provider,
1087
- onClick,
1088
- disabled,
1089
- loading: loading === provider,
1090
- displayMode: getDisplayMode(),
1091
- style: getGridColumnStyle(index),
1092
- className: appearance.buttonClassName
1093
- },
1094
- provider
1095
- )) });
1096
- }
1097
-
1098
- // src/components/auth/AuthVerificationCodeInput.tsx
1099
- var import_react5 = require("react");
1100
- var import_jsx_runtime15 = require("react/jsx-runtime");
1101
- function AuthVerificationCodeInput({
1102
- length = 6,
1103
- value,
1104
- email,
1105
- onChange,
1106
- disabled = false,
1107
- appearance = {}
1108
- }) {
1109
- const inputRefs = (0, import_react5.useRef)([]);
1110
- const handleChange = (index, digit) => {
1111
- if (digit.length > 1) return;
1112
- if (digit && !/^\d$/.test(digit)) return;
1113
- const newValue = value.split("");
1114
- newValue[index] = digit;
1115
- const updatedValue = newValue.join("");
1116
- onChange(updatedValue);
1117
- if (digit && index < length - 1) {
1118
- inputRefs.current[index + 1]?.focus();
1119
- }
1120
- };
1121
- const handleKeyDown = (index, e) => {
1122
- if (e.key === "Backspace") {
1123
- if (!value[index] && index > 0) {
1124
- inputRefs.current[index - 1]?.focus();
1125
- } else {
1126
- handleChange(index, "");
1127
- }
1128
- } else if (e.key === "ArrowLeft" && index > 0) {
1129
- inputRefs.current[index - 1]?.focus();
1130
- } else if (e.key === "ArrowRight" && index < length - 1) {
1131
- inputRefs.current[index + 1]?.focus();
1132
- }
1133
- };
1134
- const handlePaste = (e) => {
1135
- e.preventDefault();
1136
- const pastedData = e.clipboardData.getData("text/plain").trim();
1137
- if (/^\d+$/.test(pastedData) && pastedData.length === length) {
1138
- onChange(pastedData);
1139
- inputRefs.current[length - 1]?.focus();
1140
- }
1141
- };
1142
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: cn(
1143
- "flex flex-col justify-center items-center gap-6",
1144
- appearance.containerClassName
1145
- ), children: [
1146
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("p", { className: "text-sm font-normal text-[#525252] leading-5", children: [
1147
- "We've sent a verification code to your inbox at",
1148
- " ",
1149
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-sm font-semibold text-black leading-5", children: email }),
1150
- ". Enter it below to proceed."
1151
- ] }),
1152
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex flex-row gap-3 justify-center items-center", children: Array.from({ length }).map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1153
- "input",
1154
- {
1155
- ref: (el) => {
1156
- inputRefs.current[index] = el;
1157
- },
1158
- type: "text",
1159
- inputMode: "numeric",
1160
- maxLength: 1,
1161
- value: value[index] || "",
1162
- onChange: (e) => handleChange(index, e.target.value),
1163
- onKeyDown: (e) => handleKeyDown(index, e),
1164
- onPaste: handlePaste,
1165
- disabled,
1166
- className: cn(
1167
- "w-full h-12 px-3 py-2 rounded border border-[#E0E0E0] bg-white",
1168
- "text-center text-base font-semibold leading-5 text-black",
1169
- "transition-all duration-200 outline-none",
1170
- "focus:border-black focus:shadow-[0_0_0_2px_rgba(0,0,0,0.1)]",
1171
- "disabled:bg-[#F5F5F5] disabled:cursor-not-allowed disabled:opacity-60",
1172
- appearance.inputClassName
1173
- ),
1174
- autoComplete: "one-time-code"
1175
- },
1176
- index
1177
- )) })
1178
- ] });
1179
- }
1180
-
1181
- // src/components/SignIn.tsx
1182
- var import_jsx_runtime16 = require("react/jsx-runtime");
1183
- function SignIn({
1184
- afterSignInUrl = "/",
1185
- appearance = {},
1186
- title = "Welcome Back",
1187
- subtitle = "Login to your account",
1188
- emailLabel = "Email",
1189
- emailPlaceholder = "example@email.com",
1190
- passwordLabel = "Password",
1191
- passwordPlaceholder = "\u2022\u2022\u2022\u2022\u2022\u2022",
1192
- submitButtonText = "Sign In",
1193
- loadingButtonText = "Signing in...",
1194
- signUpText = "Don't have an account?",
1195
- signUpLinkText = "Sign Up Now",
1196
- signUpUrl = "/sign-up",
1197
- dividerText = "or",
1198
- onSuccess,
1199
- onError
1200
- }) {
1201
- const { signIn, baseUrl } = useInsforge();
1202
- const { providers: oauthProviders } = useOAuthProviders();
1203
- const { config: emailAuthConfig } = useEmailAuthConfig();
1204
- const [email, setEmail] = (0, import_react6.useState)("");
1205
- const [password, setPassword] = (0, import_react6.useState)("");
1206
- const [error, setError] = (0, import_react6.useState)("");
1207
- const [loading, setLoading] = (0, import_react6.useState)(false);
1208
- const [oauthLoading, setOauthLoading] = (0, import_react6.useState)(
1209
- null
1210
- );
1211
- const insforge = (0, import_react6.useState)(() => (0, import_sdk4.createClient)({ baseUrl }))[0];
1212
- async function handleSubmit(e) {
1213
- e.preventDefault();
1214
- setLoading(true);
1215
- setError("");
1216
- try {
1217
- await signIn(email, password);
1218
- if (onSuccess) {
1219
- const userResult = await insforge.auth.getCurrentUser();
1220
- if (userResult.data) onSuccess(userResult.data);
1221
- }
1222
- window.location.href = afterSignInUrl;
1223
- } catch (err) {
1224
- const errorMessage = err.message || "Sign in failed";
1225
- setError(errorMessage);
1226
- if (onError) onError(new Error(errorMessage));
1227
- } finally {
1228
- setLoading(false);
1229
- }
1230
- }
1231
- async function handleOAuth(provider) {
1232
- try {
1233
- setOauthLoading(provider);
1234
- const redirectTo = `${window.location.origin}/auth/callback`;
1235
- sessionStorage.setItem("oauth_final_destination", afterSignInUrl || "/");
1236
- const result = await insforge.auth.signInWithOAuth({
1237
- provider,
1238
- redirectTo
1239
- });
1240
- } catch (err) {
1241
- const errorMessage = err.message || `${provider} sign in failed`;
1242
- setError(errorMessage);
1243
- if (onError) onError(new Error(errorMessage));
1244
- setOauthLoading(null);
1245
- }
1246
- }
1247
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(AuthContainer, { appearance: { containerClassName: appearance.containerClassName }, children: [
1248
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AuthHeader, { title, subtitle }),
1249
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AuthErrorBanner, { error }),
1250
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
1251
- "form",
1252
- {
1253
- onSubmit: handleSubmit,
1254
- noValidate: true,
1255
- className: "flex flex-col items-stretch justify-center gap-6",
1256
- children: [
1257
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1258
- AuthFormField,
1259
- {
1260
- id: "email",
1261
- type: "email",
1262
- label: emailLabel,
1263
- placeholder: emailPlaceholder,
1264
- value: email,
1265
- onChange: (e) => setEmail(e.target.value),
1266
- required: true,
1267
- autoComplete: "email"
1268
- }
1269
- ),
1270
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1271
- AuthPasswordField,
1272
- {
1273
- id: "password",
1274
- label: passwordLabel,
1275
- placeholder: passwordPlaceholder,
1276
- value: password,
1277
- onChange: (e) => setPassword(e.target.value),
1278
- required: true,
1279
- autoComplete: "current-password",
1280
- emailAuthConfig: emailAuthConfig || {
1281
- requireEmailVerification: false,
1282
- passwordMinLength: 6,
1283
- requireNumber: false,
1284
- requireLowercase: false,
1285
- requireUppercase: false,
1286
- requireSpecialChar: false
1287
- }
1288
- }
1289
- ),
1290
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1291
- AuthSubmitButton,
1292
- {
1293
- isLoading: loading,
1294
- disabled: loading || oauthLoading !== null,
1295
- className: appearance.buttonClassName,
1296
- children: loading ? loadingButtonText : submitButtonText
1297
- }
1298
- )
1299
- ]
1300
- }
1301
- ),
1302
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AuthLink, { text: signUpText, linkText: signUpLinkText, href: signUpUrl }),
1303
- oauthProviders.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
1304
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AuthDivider, { text: dividerText }),
1305
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1306
- AuthOAuthProviders,
1307
- {
1308
- providers: oauthProviders,
1309
- onClick: handleOAuth,
1310
- disabled: loading || oauthLoading !== null,
1311
- loading: oauthLoading
1312
- }
1313
- )
1314
- ] })
1315
- ] });
1316
- }
1317
-
1318
- // src/components/SignUp.tsx
1319
- var import_react7 = require("react");
1320
- var import_sdk5 = require("@insforge/sdk");
1321
- var import_jsx_runtime17 = require("react/jsx-runtime");
1322
- function SignUp({
1323
- afterSignUpUrl = "/",
1324
- appearance = {},
1325
- title = "Get Started",
1326
- subtitle = "Create account",
1327
- emailLabel = "Email",
1328
- emailPlaceholder = "example@email.com",
1329
- passwordLabel = "Password",
1330
- passwordPlaceholder = "\u2022\u2022\u2022\u2022\u2022\u2022",
1331
- submitButtonText = "Sign Up",
1332
- loadingButtonText = "Creating account...",
1333
- // verifyButtonText = "Continue", // Commented out - email verification disabled for now
1334
- // loadingVerifyButtonText = "Verifying...", // Commented out - email verification disabled for now
1335
- // verifiedButtonText = "Verified", // Commented out - email verification disabled for now
1336
- signInText = "Already have an account?",
1337
- signInLinkText = "Login Now",
1338
- signInUrl = "/sign-in",
1339
- dividerText = "or",
1340
- onSuccess,
1341
- onError
1342
- }) {
1343
- const { signUp, baseUrl } = useInsforge();
1344
- const { providers: oauthProviders } = useOAuthProviders();
1345
- const { config: emailAuthConfig } = useEmailAuthConfig();
1346
- const [email, setEmail] = (0, import_react7.useState)("");
1347
- const [password, setPassword] = (0, import_react7.useState)("");
1348
- const [error, setError] = (0, import_react7.useState)("");
1349
- const [loading, setLoading] = (0, import_react7.useState)(false);
1350
- const [oauthLoading, setOauthLoading] = (0, import_react7.useState)(
1351
- null
1352
- );
1353
- const insforge = (0, import_react7.useState)(() => (0, import_sdk5.createClient)({ baseUrl }))[0];
1354
- async function handleCredentialsSubmit(e) {
1355
- e.preventDefault();
1356
- setLoading(true);
1357
- setError("");
1358
- if (emailAuthConfig && !validatePasswordStrength(password, emailAuthConfig)) {
1359
- setError("Password does not meet all requirements");
1360
- setLoading(false);
1361
- return;
1362
- }
1363
- try {
1364
- await signUp(email, password);
1365
- if (onSuccess) {
1366
- const userResult = await insforge.auth.getCurrentUser();
1367
- if (userResult.data) onSuccess(userResult.data);
1368
- }
1369
- window.location.href = afterSignUpUrl;
1370
- } catch (err) {
1371
- const errorMessage = err.message || "Sign up failed";
1372
- setError(errorMessage);
1373
- if (onError) onError(new Error(errorMessage));
1374
- } finally {
1375
- setLoading(false);
1376
- }
1377
- }
1378
- async function handleOAuth(provider) {
1379
- try {
1380
- setOauthLoading(provider);
1381
- const redirectTo = `${window.location.origin}/auth/callback`;
1382
- sessionStorage.setItem("oauth_final_destination", afterSignUpUrl || "/");
1383
- const result = await insforge.auth.signInWithOAuth({
1384
- provider,
1385
- redirectTo
1386
- });
1387
- if (result.data?.url) {
1388
- window.location.href = result.data.url;
1389
- }
1390
- } catch (err) {
1391
- const errorMessage = err.message || `${provider} sign up failed`;
1392
- setError(errorMessage);
1393
- if (onError) onError(new Error(errorMessage));
1394
- setOauthLoading(null);
1395
- }
1396
- }
1397
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(AuthContainer, { appearance: { containerClassName: appearance.containerClassName }, children: [
1398
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AuthHeader, { title, subtitle }),
1399
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AuthErrorBanner, { error }),
1400
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
1401
- "form",
1402
- {
1403
- onSubmit: handleCredentialsSubmit,
1404
- noValidate: true,
1405
- className: "flex flex-col items-stretch justify-center gap-6",
1406
- children: [
1407
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1408
- AuthFormField,
1409
- {
1410
- id: "email",
1411
- type: "email",
1412
- label: emailLabel,
1413
- placeholder: emailPlaceholder,
1414
- value: email,
1415
- onChange: (e) => setEmail(e.target.value),
1416
- required: true,
1417
- autoComplete: "email"
1418
- }
1419
- ),
1420
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1421
- AuthPasswordField,
1422
- {
1423
- id: "password",
1424
- label: passwordLabel,
1425
- placeholder: passwordPlaceholder,
1426
- value: password,
1427
- onChange: (e) => setPassword(e.target.value),
1428
- required: true,
1429
- minLength: emailAuthConfig?.passwordMinLength ?? 8,
1430
- autoComplete: "new-password",
1431
- showStrengthIndicator: true,
1432
- emailAuthConfig: emailAuthConfig || {
1433
- requireEmailVerification: false,
1434
- passwordMinLength: 6,
1435
- requireNumber: false,
1436
- requireLowercase: false,
1437
- requireUppercase: false,
1438
- requireSpecialChar: false
1439
- }
1440
- }
1441
- ),
1442
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1443
- AuthSubmitButton,
1444
- {
1445
- isLoading: loading,
1446
- disabled: loading || oauthLoading !== null,
1447
- className: appearance.buttonClassName,
1448
- children: loading ? loadingButtonText : submitButtonText
1449
- }
1450
- )
1451
- ]
1452
- }
1453
- ),
1454
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AuthLink, { text: signInText, linkText: signInLinkText, href: signInUrl }),
1455
- oauthProviders.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
1456
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AuthDivider, { text: dividerText }),
1457
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1458
- AuthOAuthProviders,
1459
- {
1460
- providers: oauthProviders,
1461
- onClick: handleOAuth,
1462
- disabled: loading || oauthLoading !== null,
1463
- loading: oauthLoading
1464
- }
1465
- )
1466
- ] })
1467
- ] });
1468
- }
1469
-
1470
- // src/components/UserButton.tsx
1471
- var import_react8 = require("react");
1472
- var import_lucide_react6 = require("lucide-react");
1473
- var import_jsx_runtime18 = require("react/jsx-runtime");
1474
- function UserButton({
1475
- afterSignOutUrl = "/",
1476
- mode = "detailed",
1477
- appearance = {}
1478
- }) {
1479
- const { user, signOut } = useInsforge();
1480
- const [isOpen, setIsOpen] = (0, import_react8.useState)(false);
1481
- const [imageError, setImageError] = (0, import_react8.useState)(false);
1482
- const dropdownRef = (0, import_react8.useRef)(null);
1483
- (0, import_react8.useEffect)(() => {
1484
- setImageError(false);
1485
- const avatarUrl = user?.avatarUrl;
1486
- if (!avatarUrl) return;
1487
- const checkImageUrl = async () => {
1488
- try {
1489
- const response = await fetch(avatarUrl, {
1490
- method: "HEAD",
1491
- // Only fetch headers, not the full image
1492
- cache: "no-cache"
1493
- });
1494
- if (!response.ok) {
1495
- setImageError(true);
1496
- }
1497
- } catch (error) {
1498
- setImageError(true);
1499
- }
1500
- };
1501
- checkImageUrl();
1502
- }, [user?.avatarUrl]);
1503
- (0, import_react8.useEffect)(() => {
1504
- function handleClickOutside(event) {
1505
- if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
1506
- setIsOpen(false);
1507
- }
1508
- }
1509
- if (isOpen) {
1510
- document.addEventListener("mousedown", handleClickOutside);
1511
- }
1512
- return () => {
1513
- document.removeEventListener("mousedown", handleClickOutside);
1514
- };
1515
- }, [isOpen]);
1516
- async function handleSignOut() {
1517
- await signOut();
1518
- setIsOpen(false);
1519
- window.location.href = afterSignOutUrl;
1520
- }
1521
- if (!user) return null;
1522
- const initials = user.name ? user.name.charAt(0).toUpperCase() : user.email.split("@")[0].slice(0, 2).toUpperCase();
1523
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1524
- "div",
1525
- {
1526
- className: cn("relative inline-block", appearance.containerClassName),
1527
- ref: dropdownRef,
1528
- children: [
1529
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1530
- "button",
1531
- {
1532
- className: cn(
1533
- // Base styles
1534
- "p-1 bg-transparent border-0 rounded-full cursor-pointer transition-all duration-200",
1535
- "flex items-center justify-center gap-2",
1536
- "hover:bg-black/5",
1537
- // Detailed mode styles
1538
- mode === "detailed" && "rounded-lg p-2",
1539
- // User override
1540
- appearance.buttonClassName
1541
- ),
1542
- onClick: () => setIsOpen(!isOpen),
1543
- "aria-expanded": isOpen,
1544
- "aria-haspopup": "true",
1545
- children: [
1546
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex items-center justify-center w-10 h-10 bg-blue-500 rounded-full", children: user.avatarUrl && !imageError ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1547
- "img",
1548
- {
1549
- src: user.avatarUrl,
1550
- alt: user.email,
1551
- onError: () => setImageError(true),
1552
- className: "rounded-full object-cover w-full h-full"
1553
- }
1554
- ) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-white font-semibold text-sm", children: initials }) }),
1555
- mode === "detailed" && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col items-start gap-0.5", children: [
1556
- user.name && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1557
- "div",
1558
- {
1559
- className: cn(
1560
- "text-sm font-semibold text-gray-900 leading-5 text-left",
1561
- appearance.nameClassName
1562
- ),
1563
- children: user.name
1564
- }
1565
- ),
1566
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1567
- "div",
1568
- {
1569
- className: cn(
1570
- "text-xs text-gray-500 leading-4 text-left",
1571
- appearance.emailClassName
1572
- ),
1573
- children: user.email
1574
- }
1575
- )
1576
- ] })
1577
- ]
1578
- }
1579
- ),
1580
- isOpen && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1581
- "div",
1582
- {
1583
- className: cn(
1584
- "absolute top-full right-0 mt-2 min-w-40",
1585
- "bg-white border border-gray-200 rounded-lg",
1586
- "shadow-lg z-50 overflow-hidden p-1",
1587
- appearance.dropdownClassName
1588
- ),
1589
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1590
- "button",
1591
- {
1592
- onClick: handleSignOut,
1593
- 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",
1594
- children: [
1595
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react6.LogOut, { className: "w-5 h-5" }),
1596
- "Sign out"
1597
- ]
1598
- }
1599
- )
1600
- }
1601
- )
1602
- ]
1603
- }
1604
- );
1605
- }
1606
-
1607
- // src/components/SignedIn.tsx
1608
- var import_jsx_runtime19 = require("react/jsx-runtime");
1609
- function SignedIn({ children }) {
1610
- const { isSignedIn, isLoaded } = useInsforge();
1611
- if (!isLoaded) return null;
1612
- if (!isSignedIn) return null;
1613
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_jsx_runtime19.Fragment, { children });
1614
- }
1615
-
1616
- // src/components/SignedOut.tsx
1617
- var import_jsx_runtime20 = require("react/jsx-runtime");
1618
- function SignedOut({ children }) {
1619
- const { isSignedIn, isLoaded } = useInsforge();
1620
- if (!isLoaded) return null;
1621
- if (isSignedIn) return null;
1622
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, { children });
1623
- }
1624
-
1625
- // src/components/Protect.tsx
1626
- var import_react9 = require("react");
1627
- var import_navigation = require("next/navigation");
1628
- var import_jsx_runtime21 = require("react/jsx-runtime");
1629
- function Protect({
1630
- children,
1631
- fallback,
1632
- redirectTo = "/sign-in",
1633
- condition
1634
- }) {
1635
- const { isSignedIn, isLoaded, user } = useInsforge();
1636
- const router = (0, import_navigation.useRouter)();
1637
- (0, import_react9.useEffect)(() => {
1638
- if (isLoaded && !isSignedIn) {
1639
- router.push(redirectTo);
1640
- } else if (isLoaded && isSignedIn && condition && user) {
1641
- if (!condition(user)) {
1642
- router.push(redirectTo);
1643
- }
1644
- }
1645
- }, [isLoaded, isSignedIn, redirectTo, router, condition, user]);
1646
- if (!isLoaded) {
1647
- return fallback || /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "insforge-loading", children: "Loading..." });
1648
- }
1649
- if (!isSignedIn) {
1650
- return fallback || null;
1651
- }
1652
- if (condition && user && !condition(user)) {
1653
- return fallback || null;
1654
- }
1655
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, { children });
1656
- }
1657
-
1658
- // src/components/InsforgeCallback.tsx
1659
- var import_react10 = require("react");
1660
- var import_navigation2 = require("next/navigation");
1661
- var import_jsx_runtime22 = require("react/jsx-runtime");
1662
- function CallbackContent({
1663
- redirectTo,
1664
- onSuccess,
1665
- onError
1666
- }) {
1667
- const router = (0, import_navigation2.useRouter)();
1668
- const searchParams = (0, import_navigation2.useSearchParams)();
1669
- const isProcessingRef = (0, import_react10.useRef)(false);
1670
- const { reloadAuth } = useInsforge();
1671
- (0, import_react10.useEffect)(() => {
1672
- const processCallback = async () => {
1673
- if (isProcessingRef.current) return;
1674
- isProcessingRef.current = true;
1675
- const error = searchParams.get("error");
1676
- if (error) {
1677
- if (onError) {
1678
- onError(error);
1679
- } else {
1680
- router.push("/?error=" + encodeURIComponent(error));
1681
- }
1682
- return;
1683
- }
1684
- const result = await reloadAuth();
1685
- if (!result.success) {
1686
- const errorMsg = result.error || "authentication_failed";
1687
- if (onError) {
1688
- onError(errorMsg);
1689
- } else {
1690
- router.push("/?error=" + encodeURIComponent(errorMsg));
1691
- }
1692
- return;
1693
- }
1694
- window.history.replaceState({}, "", window.location.pathname);
1695
- if (onSuccess) {
1696
- onSuccess();
1697
- }
1698
- const destination = redirectTo || sessionStorage.getItem("auth_destination") || sessionStorage.getItem("oauth_final_destination") || "/";
1699
- sessionStorage.removeItem("auth_destination");
1700
- sessionStorage.removeItem("oauth_final_destination");
1701
- router.push(destination);
1702
- };
1703
- processCallback();
1704
- }, [searchParams, router, redirectTo, onSuccess, onError, reloadAuth]);
1705
- return null;
1706
- }
1707
- function InsforgeCallback({
1708
- loadingComponent,
1709
- ...props
1710
- }) {
1711
- const defaultLoading = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "text-center", children: [
1712
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h2", { className: "text-2xl font-semibold mb-4", children: "Completing authentication..." }),
1713
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto" })
1714
- ] }) });
1715
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_react10.Suspense, { fallback: loadingComponent || defaultLoading, children: [
1716
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CallbackContent, { ...props }),
1717
- loadingComponent || defaultLoading
1718
- ] });
1719
- }
86
+ // src/index.ts
87
+ __reExport(src_exports, require("@insforge/react/hooks"), module.exports);
88
+ __reExport(src_exports, require("@insforge/react/components"), module.exports);
1720
89
  // Annotate the CommonJS export names for ESM import in node:
1721
90
  0 && (module.exports = {
1722
- AuthBranding,
1723
- AuthContainer,
1724
- AuthDivider,
1725
- AuthErrorBanner,
1726
- AuthFormField,
1727
- AuthHeader,
1728
- AuthLink,
1729
- AuthOAuthButton,
1730
- AuthOAuthProviders,
1731
- AuthPasswordField,
1732
- AuthPasswordStrengthIndicator,
1733
- AuthSubmitButton,
1734
- AuthVerificationCodeInput,
1735
- InsforgeCallback,
1736
91
  InsforgeProvider,
1737
- OAUTH_PROVIDER_CONFIG,
1738
- Protect,
1739
- SignIn,
1740
- SignUp,
1741
- SignedIn,
1742
- SignedOut,
1743
- UserButton,
1744
92
  cn,
1745
- getProviderConfig,
1746
- getProviderName,
1747
- isProviderSupported,
1748
- useAuth,
1749
93
  useInsforge,
1750
- useUser,
1751
- validatePasswordStrength
94
+ ...require("@insforge/react/types"),
95
+ ...require("@insforge/react/hooks"),
96
+ ...require("@insforge/react/components")
1752
97
  });
1753
98
  //# sourceMappingURL=index.js.map