@insforge/react 0.3.4 → 0.4.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/README.md +485 -604
- package/dist/atoms.cjs +818 -0
- package/dist/atoms.cjs.map +1 -0
- package/dist/atoms.d.cts +222 -0
- package/dist/atoms.d.ts +72 -237
- package/dist/atoms.js +382 -456
- package/dist/atoms.js.map +1 -1
- package/dist/components.cjs +2254 -0
- package/dist/components.cjs.map +1 -0
- package/dist/{components.d.mts → components.d.cts} +10 -32
- package/dist/components.d.ts +9 -31
- package/dist/components.js +1049 -1183
- package/dist/components.js.map +1 -1
- package/dist/forms.cjs +1287 -0
- package/dist/forms.cjs.map +1 -0
- package/dist/forms.d.cts +138 -0
- package/dist/forms.d.ts +115 -162
- package/dist/forms.js +728 -921
- package/dist/forms.js.map +1 -1
- package/dist/{hooks.mjs → hooks.cjs} +15 -13
- package/dist/hooks.cjs.map +1 -0
- package/dist/{hooks.d.mts → hooks.d.cts} +1 -1
- package/dist/hooks.js +9 -15
- package/dist/hooks.js.map +1 -1
- package/dist/index.cjs +2674 -0
- package/dist/index.cjs.map +1 -0
- package/dist/{index.d.mts → index.d.cts} +10 -10
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1096 -1238
- package/dist/index.js.map +1 -1
- package/dist/{lib.mjs → lib.cjs} +13 -11
- package/dist/lib.cjs.map +1 -0
- package/dist/{lib.d.mts → lib.d.cts} +1 -8
- package/dist/lib.d.ts +1 -8
- package/dist/lib.js +4 -17
- package/dist/lib.js.map +1 -1
- package/dist/{router.mjs → router.cjs} +14 -16
- package/dist/router.cjs.map +1 -0
- package/dist/router.js +10 -16
- package/dist/router.js.map +1 -1
- package/dist/styles.css +655 -2
- package/dist/types.cjs +4 -0
- package/dist/{types.mjs.map → types.cjs.map} +1 -1
- package/dist/{types.d.mts → types.d.cts} +2 -2
- package/dist/types.d.ts +2 -2
- package/dist/types.js +0 -1
- package/package.json +106 -98
- package/dist/atoms.d.mts +0 -387
- package/dist/atoms.mjs +0 -861
- package/dist/atoms.mjs.map +0 -1
- package/dist/components.mjs +0 -2327
- package/dist/components.mjs.map +0 -1
- package/dist/forms.d.mts +0 -185
- package/dist/forms.mjs +0 -1468
- package/dist/forms.mjs.map +0 -1
- package/dist/hooks.mjs.map +0 -1
- package/dist/index.mjs +0 -2724
- package/dist/index.mjs.map +0 -1
- package/dist/lib.mjs.map +0 -1
- package/dist/router.mjs.map +0 -1
- package/dist/types.mjs +0 -3
- package/src/styles.css +0 -15
- /package/dist/{router.d.mts → router.d.cts} +0 -0
package/dist/forms.cjs
ADDED
|
@@ -0,0 +1,1287 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var lucideReact = require('lucide-react');
|
|
5
|
+
var react = require('react');
|
|
6
|
+
var sdk = require('@insforge/sdk');
|
|
7
|
+
|
|
8
|
+
function AuthBranding() {
|
|
9
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "if-authBranding if-internal-ab4k9w", children: [
|
|
10
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "if-authBranding-text", children: "Secured by" }),
|
|
11
|
+
/* @__PURE__ */ jsxRuntime.jsx("a", { href: "https://insforge.dev", target: "_blank", rel: "noopener noreferrer", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12
|
+
"svg",
|
|
13
|
+
{
|
|
14
|
+
width: "83",
|
|
15
|
+
height: "20",
|
|
16
|
+
viewBox: "0 0 83 20",
|
|
17
|
+
fill: "none",
|
|
18
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
19
|
+
children: [
|
|
20
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
21
|
+
"path",
|
|
22
|
+
{
|
|
23
|
+
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",
|
|
24
|
+
fill: "url(#paint0_linear_2976_9475)"
|
|
25
|
+
}
|
|
26
|
+
),
|
|
27
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
28
|
+
"path",
|
|
29
|
+
{
|
|
30
|
+
d: "M12.8858 6.44922L16.6 10.168V18.668L8.64108 10.6992L12.8858 6.44922Z",
|
|
31
|
+
fill: "url(#paint1_linear_2976_9475)"
|
|
32
|
+
}
|
|
33
|
+
),
|
|
34
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
35
|
+
"path",
|
|
36
|
+
{
|
|
37
|
+
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",
|
|
38
|
+
fill: "black"
|
|
39
|
+
}
|
|
40
|
+
),
|
|
41
|
+
/* @__PURE__ */ jsxRuntime.jsxs("defs", { children: [
|
|
42
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
43
|
+
"linearGradient",
|
|
44
|
+
{
|
|
45
|
+
id: "paint0_linear_2976_9475",
|
|
46
|
+
x1: "1.85883",
|
|
47
|
+
y1: "1.92425",
|
|
48
|
+
x2: "24.3072",
|
|
49
|
+
y2: "9.64016",
|
|
50
|
+
gradientUnits: "userSpaceOnUse",
|
|
51
|
+
children: [
|
|
52
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", {}),
|
|
53
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "1", stopOpacity: "0.4" })
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
),
|
|
57
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
58
|
+
"linearGradient",
|
|
59
|
+
{
|
|
60
|
+
id: "paint1_linear_2976_9475",
|
|
61
|
+
x1: "25.6475",
|
|
62
|
+
y1: "8.65468",
|
|
63
|
+
x2: "10.7901",
|
|
64
|
+
y2: "8.65468",
|
|
65
|
+
gradientUnits: "userSpaceOnUse",
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", {}),
|
|
68
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "1", stopOpacity: "0.4" })
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
] })
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
) })
|
|
76
|
+
] });
|
|
77
|
+
}
|
|
78
|
+
function AuthContainer({ children }) {
|
|
79
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "if-authContainer if-internal-a8f3d2", children: [
|
|
80
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "if-authCard if-internal-b2k9x1", children }),
|
|
81
|
+
/* @__PURE__ */ jsxRuntime.jsx(AuthBranding, {})
|
|
82
|
+
] });
|
|
83
|
+
}
|
|
84
|
+
function AuthHeader({ title, subtitle }) {
|
|
85
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "if-authHeader if-internal-h3m7w5", children: [
|
|
86
|
+
/* @__PURE__ */ jsxRuntime.jsx("h1", { className: "if-authHeader-title if-internal-t4p1k9", children: title }),
|
|
87
|
+
subtitle && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "if-authHeader-subtitle if-internal-s7q2m3", children: subtitle })
|
|
88
|
+
] });
|
|
89
|
+
}
|
|
90
|
+
function AuthErrorBanner({ error }) {
|
|
91
|
+
if (!error) {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "if-errorBanner if-internal-eb2m7k", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "0.5rem" }, children: [
|
|
95
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
96
|
+
lucideReact.AlertTriangle,
|
|
97
|
+
{
|
|
98
|
+
style: { width: "1.5rem", height: "1.5rem", flexShrink: 0, color: "#dc2626" }
|
|
99
|
+
}
|
|
100
|
+
),
|
|
101
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "if-errorBanner-text", children: error })
|
|
102
|
+
] }) });
|
|
103
|
+
}
|
|
104
|
+
function AuthFormField({
|
|
105
|
+
label,
|
|
106
|
+
id,
|
|
107
|
+
...props
|
|
108
|
+
}) {
|
|
109
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "if-formField if-internal-f9n6p2", children: [
|
|
110
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, className: "if-formField-label if-internal-l3k8m1", children: label }),
|
|
111
|
+
/* @__PURE__ */ jsxRuntime.jsx("input", { id, className: "if-formField-input if-internal-i2v8k4", ...props })
|
|
112
|
+
] });
|
|
113
|
+
}
|
|
114
|
+
function AuthPasswordStrengthIndicator({
|
|
115
|
+
password,
|
|
116
|
+
config
|
|
117
|
+
}) {
|
|
118
|
+
const requirements = createRequirements(config);
|
|
119
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "if-passwordStrength if-internal-ps6w3k", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "if-passwordStrength-requirements", children: requirements.map((req) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
120
|
+
"div",
|
|
121
|
+
{
|
|
122
|
+
className: `if-passwordStrength-requirement ${req.test(password) ? "met" : "unmet"}`,
|
|
123
|
+
children: [
|
|
124
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
125
|
+
"div",
|
|
126
|
+
{
|
|
127
|
+
style: {
|
|
128
|
+
display: "flex",
|
|
129
|
+
alignItems: "center",
|
|
130
|
+
justifyContent: "center",
|
|
131
|
+
width: "1rem",
|
|
132
|
+
height: "1rem",
|
|
133
|
+
borderRadius: "50%",
|
|
134
|
+
border: "2px solid",
|
|
135
|
+
borderColor: req.test(password) ? "transparent" : "#9ca3af",
|
|
136
|
+
backgroundColor: req.test(password) ? "#059669" : "white",
|
|
137
|
+
transition: "all 0.2s"
|
|
138
|
+
},
|
|
139
|
+
children: req.test(password) && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { style: { width: "0.75rem", height: "0.75rem", color: "white" } })
|
|
140
|
+
}
|
|
141
|
+
),
|
|
142
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: req.label })
|
|
143
|
+
]
|
|
144
|
+
},
|
|
145
|
+
req.label
|
|
146
|
+
)) }) });
|
|
147
|
+
}
|
|
148
|
+
function createRequirements(config) {
|
|
149
|
+
const requirements = [];
|
|
150
|
+
if (config.passwordMinLength) {
|
|
151
|
+
requirements.push({
|
|
152
|
+
label: `At least ${config.passwordMinLength} characters`,
|
|
153
|
+
test: (password) => password.length >= config.passwordMinLength
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
if (config.requireLowercase) {
|
|
157
|
+
requirements.push({
|
|
158
|
+
label: "Contains lowercase letter",
|
|
159
|
+
test: (password) => /[a-z]/.test(password)
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
if (config.requireUppercase) {
|
|
163
|
+
requirements.push({
|
|
164
|
+
label: "Contains uppercase letter",
|
|
165
|
+
test: (password) => /[A-Z]/.test(password)
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
if (config.requireNumber) {
|
|
169
|
+
requirements.push({
|
|
170
|
+
label: "Contains number",
|
|
171
|
+
test: (password) => /\d/.test(password)
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
if (config.requireSpecialChar) {
|
|
175
|
+
requirements.push({
|
|
176
|
+
label: "Contains special character",
|
|
177
|
+
test: (password) => /[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/.test(password)
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
return requirements;
|
|
181
|
+
}
|
|
182
|
+
function AuthPasswordField({
|
|
183
|
+
label,
|
|
184
|
+
id,
|
|
185
|
+
showStrengthIndicator = false,
|
|
186
|
+
authConfig,
|
|
187
|
+
forgotPasswordLink,
|
|
188
|
+
value,
|
|
189
|
+
onFocus,
|
|
190
|
+
...props
|
|
191
|
+
}) {
|
|
192
|
+
const [showPassword, setShowPassword] = react.useState(false);
|
|
193
|
+
const [showStrength, setShowStrength] = react.useState(false);
|
|
194
|
+
const handleFocus = (e) => {
|
|
195
|
+
if (showStrengthIndicator) {
|
|
196
|
+
setShowStrength(true);
|
|
197
|
+
}
|
|
198
|
+
onFocus?.(e);
|
|
199
|
+
};
|
|
200
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "if-passwordField if-internal-p5w9m7", children: [
|
|
201
|
+
(label || forgotPasswordLink) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "if-passwordField-labelRow", children: [
|
|
202
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, className: "if-passwordField-label", children: label }),
|
|
203
|
+
forgotPasswordLink && /* @__PURE__ */ jsxRuntime.jsx("a", { href: forgotPasswordLink.href, className: "if-passwordField-forgotLink", children: forgotPasswordLink.text || "Forget Password?" })
|
|
204
|
+
] }),
|
|
205
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "if-passwordField-inputWrapper", children: [
|
|
206
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
207
|
+
"input",
|
|
208
|
+
{
|
|
209
|
+
id,
|
|
210
|
+
type: showPassword ? "text" : "password",
|
|
211
|
+
className: "if-passwordField-input",
|
|
212
|
+
value,
|
|
213
|
+
onFocus: handleFocus,
|
|
214
|
+
...props
|
|
215
|
+
}
|
|
216
|
+
),
|
|
217
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
218
|
+
"button",
|
|
219
|
+
{
|
|
220
|
+
type: "button",
|
|
221
|
+
onClick: () => setShowPassword(!showPassword),
|
|
222
|
+
className: "if-passwordField-toggleButton",
|
|
223
|
+
"aria-label": showPassword ? "Hide password" : "Show password",
|
|
224
|
+
children: showPassword ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.EyeOff, { size: 20 }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Eye, { size: 20 })
|
|
225
|
+
}
|
|
226
|
+
)
|
|
227
|
+
] }),
|
|
228
|
+
showStrengthIndicator && showStrength && /* @__PURE__ */ jsxRuntime.jsx(AuthPasswordStrengthIndicator, { password: String(value || ""), config: authConfig })
|
|
229
|
+
] });
|
|
230
|
+
}
|
|
231
|
+
function AuthSubmitButton({
|
|
232
|
+
children,
|
|
233
|
+
isLoading = false,
|
|
234
|
+
confirmed = false,
|
|
235
|
+
disabled = false
|
|
236
|
+
}) {
|
|
237
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
238
|
+
"button",
|
|
239
|
+
{
|
|
240
|
+
type: "submit",
|
|
241
|
+
className: "if-submitButton if-internal-b8p3m4",
|
|
242
|
+
disabled: disabled || isLoading || confirmed,
|
|
243
|
+
children: [
|
|
244
|
+
isLoading && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "if-submitButton-icon if-submitButton-spinner", size: 20 }),
|
|
245
|
+
confirmed && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CircleCheck, { className: "if-submitButton-icon", size: 20 }),
|
|
246
|
+
children
|
|
247
|
+
]
|
|
248
|
+
}
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
function AuthLink({
|
|
252
|
+
text,
|
|
253
|
+
linkText,
|
|
254
|
+
href
|
|
255
|
+
}) {
|
|
256
|
+
const currentSearch = typeof window !== "undefined" ? window.location.search : "";
|
|
257
|
+
const finalHref = (() => {
|
|
258
|
+
if (!currentSearch) {
|
|
259
|
+
return href;
|
|
260
|
+
}
|
|
261
|
+
try {
|
|
262
|
+
const url = new URL(href, window.location.origin);
|
|
263
|
+
const currentParams = new URLSearchParams(currentSearch);
|
|
264
|
+
currentParams.forEach((value, key) => {
|
|
265
|
+
if (!url.searchParams.has(key)) {
|
|
266
|
+
url.searchParams.set(key, value);
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
return url.pathname + url.search;
|
|
270
|
+
} catch {
|
|
271
|
+
return href;
|
|
272
|
+
}
|
|
273
|
+
})();
|
|
274
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "if-authLink if-internal-al5w9p", children: [
|
|
275
|
+
text && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "if-authLink-text", children: text }),
|
|
276
|
+
text && " ",
|
|
277
|
+
/* @__PURE__ */ jsxRuntime.jsx("a", { href: finalHref, className: "if-authLink-link", children: linkText })
|
|
278
|
+
] });
|
|
279
|
+
}
|
|
280
|
+
function AuthDivider({ text = "or" }) {
|
|
281
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "if-authDivider if-internal-ad7k3m", children: [
|
|
282
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "if-authDivider-line" }),
|
|
283
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "if-authDivider-text", children: text }),
|
|
284
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "if-authDivider-line" })
|
|
285
|
+
] });
|
|
286
|
+
}
|
|
287
|
+
var OAUTH_PROVIDER_CONFIG = {
|
|
288
|
+
google: {
|
|
289
|
+
name: "Google",
|
|
290
|
+
svg: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", children: [
|
|
291
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
292
|
+
"path",
|
|
293
|
+
{
|
|
294
|
+
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",
|
|
295
|
+
fill: "#4285F4"
|
|
296
|
+
}
|
|
297
|
+
),
|
|
298
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
299
|
+
"path",
|
|
300
|
+
{
|
|
301
|
+
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",
|
|
302
|
+
fill: "#34A853"
|
|
303
|
+
}
|
|
304
|
+
),
|
|
305
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
306
|
+
"path",
|
|
307
|
+
{
|
|
308
|
+
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",
|
|
309
|
+
fill: "#FBBC05"
|
|
310
|
+
}
|
|
311
|
+
),
|
|
312
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
313
|
+
"path",
|
|
314
|
+
{
|
|
315
|
+
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",
|
|
316
|
+
fill: "#EA4335"
|
|
317
|
+
}
|
|
318
|
+
)
|
|
319
|
+
] }),
|
|
320
|
+
className: "insforge-oauth-google"
|
|
321
|
+
},
|
|
322
|
+
github: {
|
|
323
|
+
name: "GitHub",
|
|
324
|
+
svg: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "18", height: "18", viewBox: "0 0 16 16", fill: "currentColor", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z" }) }),
|
|
325
|
+
className: "insforge-oauth-github"
|
|
326
|
+
},
|
|
327
|
+
discord: {
|
|
328
|
+
name: "Discord",
|
|
329
|
+
svg: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
330
|
+
"path",
|
|
331
|
+
{
|
|
332
|
+
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",
|
|
333
|
+
fill: "#5865F2"
|
|
334
|
+
}
|
|
335
|
+
) }),
|
|
336
|
+
className: "insforge-oauth-discord"
|
|
337
|
+
},
|
|
338
|
+
facebook: {
|
|
339
|
+
name: "Facebook",
|
|
340
|
+
svg: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
341
|
+
"path",
|
|
342
|
+
{
|
|
343
|
+
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",
|
|
344
|
+
fill: "#1877F2"
|
|
345
|
+
}
|
|
346
|
+
) }),
|
|
347
|
+
className: "insforge-oauth-facebook"
|
|
348
|
+
},
|
|
349
|
+
linkedin: {
|
|
350
|
+
name: "LinkedIn",
|
|
351
|
+
svg: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
352
|
+
"path",
|
|
353
|
+
{
|
|
354
|
+
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",
|
|
355
|
+
fill: "#0A66C2"
|
|
356
|
+
}
|
|
357
|
+
) }),
|
|
358
|
+
className: "insforge-oauth-linkedin"
|
|
359
|
+
},
|
|
360
|
+
microsoft: {
|
|
361
|
+
name: "Microsoft",
|
|
362
|
+
svg: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "18", height: "18", viewBox: "0 0 23 23", fill: "none", children: [
|
|
363
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0 0h11v11H0z", fill: "#F25022" }),
|
|
364
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 0h11v11H12z", fill: "#7FBA00" }),
|
|
365
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0 12h11v11H0z", fill: "#00A4EF" }),
|
|
366
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 12h11v11H12z", fill: "#FFB900" })
|
|
367
|
+
] }),
|
|
368
|
+
className: "insforge-oauth-microsoft"
|
|
369
|
+
},
|
|
370
|
+
apple: {
|
|
371
|
+
name: "Apple",
|
|
372
|
+
svg: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M17.05 20.28c-.98.95-2.05.8-3.08.35-1.09-.46-2.09-.48-3.24 0-1.44.62-2.2.44-3.06-.35C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.54 4.09l.01-.01zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z" }) }),
|
|
373
|
+
className: "insforge-oauth-apple"
|
|
374
|
+
},
|
|
375
|
+
x: {
|
|
376
|
+
name: "X",
|
|
377
|
+
svg: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z" }) }),
|
|
378
|
+
className: "insforge-oauth-x"
|
|
379
|
+
},
|
|
380
|
+
instagram: {
|
|
381
|
+
name: "Instagram",
|
|
382
|
+
svg: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", children: [
|
|
383
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
384
|
+
"path",
|
|
385
|
+
{
|
|
386
|
+
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",
|
|
387
|
+
fill: "url(#instagram-gradient)"
|
|
388
|
+
}
|
|
389
|
+
),
|
|
390
|
+
/* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs("linearGradient", { id: "instagram-gradient", x1: "0%", y1: "100%", x2: "100%", y2: "0%", children: [
|
|
391
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0%", stopColor: "#FD5949" }),
|
|
392
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "50%", stopColor: "#D6249F" }),
|
|
393
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "100%", stopColor: "#285AEB" })
|
|
394
|
+
] }) })
|
|
395
|
+
] }),
|
|
396
|
+
className: "insforge-oauth-instagram"
|
|
397
|
+
},
|
|
398
|
+
tiktok: {
|
|
399
|
+
name: "TikTok",
|
|
400
|
+
svg: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
401
|
+
"path",
|
|
402
|
+
{
|
|
403
|
+
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",
|
|
404
|
+
fill: "currentColor"
|
|
405
|
+
}
|
|
406
|
+
) }),
|
|
407
|
+
className: "insforge-oauth-tiktok"
|
|
408
|
+
},
|
|
409
|
+
spotify: {
|
|
410
|
+
name: "Spotify",
|
|
411
|
+
svg: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
412
|
+
"path",
|
|
413
|
+
{
|
|
414
|
+
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",
|
|
415
|
+
fill: "#1DB954"
|
|
416
|
+
}
|
|
417
|
+
) }),
|
|
418
|
+
className: "insforge-oauth-spotify"
|
|
419
|
+
}
|
|
420
|
+
};
|
|
421
|
+
function getProviderConfig(provider) {
|
|
422
|
+
return OAUTH_PROVIDER_CONFIG[provider] || null;
|
|
423
|
+
}
|
|
424
|
+
function AuthOAuthButton({
|
|
425
|
+
provider,
|
|
426
|
+
onClick,
|
|
427
|
+
disabled,
|
|
428
|
+
loading,
|
|
429
|
+
displayMode = "full",
|
|
430
|
+
style
|
|
431
|
+
}) {
|
|
432
|
+
const config = getProviderConfig(provider);
|
|
433
|
+
if (!config) {
|
|
434
|
+
return null;
|
|
435
|
+
}
|
|
436
|
+
const getButtonText = () => {
|
|
437
|
+
if (displayMode === "full") {
|
|
438
|
+
return `Continue with ${config.name}`;
|
|
439
|
+
}
|
|
440
|
+
if (displayMode === "short") {
|
|
441
|
+
return config.name;
|
|
442
|
+
}
|
|
443
|
+
return "";
|
|
444
|
+
};
|
|
445
|
+
const className = [
|
|
446
|
+
"if-oauthButton",
|
|
447
|
+
"if-internal-o4k7w2",
|
|
448
|
+
displayMode === "full" && "if-oauthButton-full",
|
|
449
|
+
displayMode === "short" && "if-oauthButton-short",
|
|
450
|
+
displayMode === "icon" && "if-oauthButton-icon-only"
|
|
451
|
+
].filter(Boolean).join(" ");
|
|
452
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
453
|
+
"button",
|
|
454
|
+
{
|
|
455
|
+
type: "button",
|
|
456
|
+
onClick: () => onClick(provider),
|
|
457
|
+
className,
|
|
458
|
+
disabled: disabled || loading,
|
|
459
|
+
style,
|
|
460
|
+
children: [
|
|
461
|
+
loading ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "if-oauthButton-icon if-submitButton-spinner", size: 18 }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "if-oauthButton-icon", children: config.svg }),
|
|
462
|
+
getButtonText() && /* @__PURE__ */ jsxRuntime.jsx("span", { children: getButtonText() })
|
|
463
|
+
]
|
|
464
|
+
}
|
|
465
|
+
);
|
|
466
|
+
}
|
|
467
|
+
function AuthOAuthProviders({
|
|
468
|
+
providers,
|
|
469
|
+
onClick,
|
|
470
|
+
disabled,
|
|
471
|
+
loading
|
|
472
|
+
}) {
|
|
473
|
+
if (!providers || providers.length === 0) {
|
|
474
|
+
return null;
|
|
475
|
+
}
|
|
476
|
+
const count = providers.length;
|
|
477
|
+
const getDisplayMode = () => {
|
|
478
|
+
if (count === 1) {
|
|
479
|
+
return "full";
|
|
480
|
+
}
|
|
481
|
+
if (count === 2 || count === 4) {
|
|
482
|
+
return "short";
|
|
483
|
+
}
|
|
484
|
+
return "icon";
|
|
485
|
+
};
|
|
486
|
+
const getGridColumnStyle = (index) => {
|
|
487
|
+
if (count === 1) {
|
|
488
|
+
return { gridColumn: "span 6" };
|
|
489
|
+
}
|
|
490
|
+
if (count === 2) {
|
|
491
|
+
return { gridColumn: "span 3" };
|
|
492
|
+
}
|
|
493
|
+
if (count === 3) {
|
|
494
|
+
return { gridColumn: "span 2 / span 2" };
|
|
495
|
+
}
|
|
496
|
+
if (count === 4) {
|
|
497
|
+
return { gridColumn: "span 3" };
|
|
498
|
+
}
|
|
499
|
+
const totalRows = Math.ceil(count / 3);
|
|
500
|
+
const lastRowStartIndex = (totalRows - 1) * 3;
|
|
501
|
+
const isInLastRow = index >= lastRowStartIndex;
|
|
502
|
+
if (!isInLastRow) {
|
|
503
|
+
return { gridColumn: "span 2 / span 2" };
|
|
504
|
+
}
|
|
505
|
+
const positionInLastRow = index - lastRowStartIndex;
|
|
506
|
+
const itemsInLastRow = count - lastRowStartIndex;
|
|
507
|
+
if (itemsInLastRow === 1) {
|
|
508
|
+
return { gridColumn: "3 / 5" };
|
|
509
|
+
} else if (itemsInLastRow === 2) {
|
|
510
|
+
if (positionInLastRow === 0) {
|
|
511
|
+
return { gridColumn: "2 / 4" };
|
|
512
|
+
} else {
|
|
513
|
+
return { gridColumn: "4 / 6" };
|
|
514
|
+
}
|
|
515
|
+
} else {
|
|
516
|
+
return { gridColumn: "span 2 / span 2" };
|
|
517
|
+
}
|
|
518
|
+
};
|
|
519
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
520
|
+
"div",
|
|
521
|
+
{
|
|
522
|
+
className: "if-oauthProviders if-internal-op3m8k",
|
|
523
|
+
style: {
|
|
524
|
+
display: "grid",
|
|
525
|
+
gridTemplateColumns: "repeat(6, 1fr)",
|
|
526
|
+
gap: "0.75rem",
|
|
527
|
+
width: "100%"
|
|
528
|
+
},
|
|
529
|
+
children: providers.map((provider, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
530
|
+
AuthOAuthButton,
|
|
531
|
+
{
|
|
532
|
+
provider,
|
|
533
|
+
onClick,
|
|
534
|
+
disabled,
|
|
535
|
+
loading: loading === provider,
|
|
536
|
+
displayMode: getDisplayMode(),
|
|
537
|
+
style: getGridColumnStyle(index)
|
|
538
|
+
},
|
|
539
|
+
provider
|
|
540
|
+
))
|
|
541
|
+
}
|
|
542
|
+
);
|
|
543
|
+
}
|
|
544
|
+
function AuthVerificationCodeInput({
|
|
545
|
+
length = 6,
|
|
546
|
+
value,
|
|
547
|
+
email,
|
|
548
|
+
onChange,
|
|
549
|
+
disabled = false,
|
|
550
|
+
onComplete
|
|
551
|
+
}) {
|
|
552
|
+
const inputRefs = react.useRef([]);
|
|
553
|
+
const handleChange = (index, digit) => {
|
|
554
|
+
if (digit.length > 1) {
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
557
|
+
if (digit && !/^\d$/.test(digit)) {
|
|
558
|
+
return;
|
|
559
|
+
}
|
|
560
|
+
const newValue = value.split("");
|
|
561
|
+
newValue[index] = digit;
|
|
562
|
+
const updatedValue = newValue.join("");
|
|
563
|
+
onChange(updatedValue);
|
|
564
|
+
if (digit && index < length - 1) {
|
|
565
|
+
inputRefs.current[index + 1]?.focus();
|
|
566
|
+
}
|
|
567
|
+
if (digit && index === length - 1 && updatedValue.length === length && onComplete) {
|
|
568
|
+
onComplete(updatedValue);
|
|
569
|
+
}
|
|
570
|
+
};
|
|
571
|
+
const handleKeyDown = (index, e) => {
|
|
572
|
+
if (e.key === "Backspace") {
|
|
573
|
+
if (!value[index] && index > 0) {
|
|
574
|
+
inputRefs.current[index - 1]?.focus();
|
|
575
|
+
} else {
|
|
576
|
+
handleChange(index, "");
|
|
577
|
+
}
|
|
578
|
+
} else if (e.key === "ArrowLeft" && index > 0) {
|
|
579
|
+
inputRefs.current[index - 1]?.focus();
|
|
580
|
+
} else if (e.key === "ArrowRight" && index < length - 1) {
|
|
581
|
+
inputRefs.current[index + 1]?.focus();
|
|
582
|
+
}
|
|
583
|
+
};
|
|
584
|
+
const handlePaste = (e) => {
|
|
585
|
+
e.preventDefault();
|
|
586
|
+
const pastedData = e.clipboardData.getData("text/plain").trim();
|
|
587
|
+
if (/^\d+$/.test(pastedData) && pastedData.length === length) {
|
|
588
|
+
onChange(pastedData);
|
|
589
|
+
inputRefs.current[length - 1]?.focus();
|
|
590
|
+
if (onComplete) {
|
|
591
|
+
onComplete(pastedData);
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
};
|
|
595
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "if-verificationCode if-internal-vc8m4p", children: [
|
|
596
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "if-verificationCode-description", children: [
|
|
597
|
+
"We've sent a verification code to your inbox at",
|
|
598
|
+
" ",
|
|
599
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "if-verificationCode-email", children: email }),
|
|
600
|
+
". Enter it below to proceed."
|
|
601
|
+
] }),
|
|
602
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "if-verificationCode-inputContainer", children: Array.from({ length }).map((_, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
603
|
+
"input",
|
|
604
|
+
{
|
|
605
|
+
ref: (el) => {
|
|
606
|
+
inputRefs.current[index] = el;
|
|
607
|
+
},
|
|
608
|
+
type: "text",
|
|
609
|
+
inputMode: "numeric",
|
|
610
|
+
maxLength: 1,
|
|
611
|
+
value: value[index] || "",
|
|
612
|
+
onChange: (e) => handleChange(index, e.target.value),
|
|
613
|
+
onKeyDown: (e) => handleKeyDown(index, e),
|
|
614
|
+
onPaste: handlePaste,
|
|
615
|
+
disabled,
|
|
616
|
+
className: "if-verificationCode-input",
|
|
617
|
+
autoComplete: "one-time-code"
|
|
618
|
+
},
|
|
619
|
+
index
|
|
620
|
+
)) })
|
|
621
|
+
] });
|
|
622
|
+
}
|
|
623
|
+
var InsforgeContext = react.createContext(void 0);
|
|
624
|
+
function useInsforge() {
|
|
625
|
+
const context = react.useContext(InsforgeContext);
|
|
626
|
+
if (!context) {
|
|
627
|
+
throw new Error("useInsforge must be used within InsforgeProvider");
|
|
628
|
+
}
|
|
629
|
+
return context;
|
|
630
|
+
}
|
|
631
|
+
function AuthEmailVerificationStep({
|
|
632
|
+
email,
|
|
633
|
+
description,
|
|
634
|
+
method = "code",
|
|
635
|
+
onVerifyCode
|
|
636
|
+
}) {
|
|
637
|
+
const { baseUrl } = useInsforge();
|
|
638
|
+
const [insforge] = react.useState(() => sdk.createClient({ baseUrl }));
|
|
639
|
+
const [resendDisabled, setResendDisabled] = react.useState(true);
|
|
640
|
+
const [resendCountdown, setResendCountdown] = react.useState(60);
|
|
641
|
+
const [isSending, setIsSending] = react.useState(false);
|
|
642
|
+
const [verificationCode, setVerificationCode] = react.useState("");
|
|
643
|
+
const [isVerifying, setIsVerifying] = react.useState(false);
|
|
644
|
+
const [verificationError, setVerificationError] = react.useState("");
|
|
645
|
+
const defaultDescription = method === "code" ? "We've sent a 6-digit verification code to {email}. Please enter it below to verify your account. The code will expire in 10 minutes." : "We've sent a verification link to {email}. Please check your email and click the link to verify your account. The link will expire in 10 minutes.";
|
|
646
|
+
react.useEffect(() => {
|
|
647
|
+
const sendInitialEmail = async () => {
|
|
648
|
+
try {
|
|
649
|
+
await insforge.auth.sendVerificationEmail({ email });
|
|
650
|
+
} catch {
|
|
651
|
+
}
|
|
652
|
+
};
|
|
653
|
+
void sendInitialEmail();
|
|
654
|
+
}, [email, method, insforge.auth]);
|
|
655
|
+
react.useEffect(() => {
|
|
656
|
+
if (resendCountdown > 0) {
|
|
657
|
+
const timer = setInterval(() => {
|
|
658
|
+
setResendCountdown((prev) => {
|
|
659
|
+
if (prev <= 1) {
|
|
660
|
+
setResendDisabled(false);
|
|
661
|
+
return 0;
|
|
662
|
+
}
|
|
663
|
+
return prev - 1;
|
|
664
|
+
});
|
|
665
|
+
}, 1e3);
|
|
666
|
+
return () => clearInterval(timer);
|
|
667
|
+
}
|
|
668
|
+
}, [resendCountdown]);
|
|
669
|
+
const handleResend = async () => {
|
|
670
|
+
setResendDisabled(true);
|
|
671
|
+
setResendCountdown(60);
|
|
672
|
+
setIsSending(true);
|
|
673
|
+
setVerificationError("");
|
|
674
|
+
try {
|
|
675
|
+
await insforge.auth.sendVerificationEmail({ email });
|
|
676
|
+
} catch {
|
|
677
|
+
setResendDisabled(false);
|
|
678
|
+
setResendCountdown(0);
|
|
679
|
+
} finally {
|
|
680
|
+
setIsSending(false);
|
|
681
|
+
}
|
|
682
|
+
};
|
|
683
|
+
const handleVerifyCode = async (code) => {
|
|
684
|
+
if (!onVerifyCode) {
|
|
685
|
+
return;
|
|
686
|
+
}
|
|
687
|
+
setIsVerifying(true);
|
|
688
|
+
setVerificationError("");
|
|
689
|
+
try {
|
|
690
|
+
await onVerifyCode(code);
|
|
691
|
+
} catch (error) {
|
|
692
|
+
setVerificationError(
|
|
693
|
+
error instanceof Error ? error.message : "Invalid verification code. Please try again."
|
|
694
|
+
);
|
|
695
|
+
setVerificationCode("");
|
|
696
|
+
} finally {
|
|
697
|
+
setIsVerifying(false);
|
|
698
|
+
}
|
|
699
|
+
};
|
|
700
|
+
const displayDescription = description || defaultDescription;
|
|
701
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "1.5rem", alignItems: "stretch" }, children: [
|
|
702
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "if-verificationCode-description", children: displayDescription.split("{email}").map((part, index, array) => /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
703
|
+
part,
|
|
704
|
+
index < array.length - 1 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "if-verificationCode-email", children: email })
|
|
705
|
+
] }, index)) }),
|
|
706
|
+
verificationError && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "if-errorBanner if-internal-eb2m7k", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "0.5rem" }, children: [
|
|
707
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
708
|
+
"svg",
|
|
709
|
+
{
|
|
710
|
+
style: { width: "1.5rem", height: "1.5rem", flexShrink: 0, color: "#DC2626" },
|
|
711
|
+
fill: "none",
|
|
712
|
+
strokeLinecap: "round",
|
|
713
|
+
strokeLinejoin: "round",
|
|
714
|
+
strokeWidth: "2",
|
|
715
|
+
viewBox: "0 0 24 24",
|
|
716
|
+
stroke: "currentColor",
|
|
717
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" })
|
|
718
|
+
}
|
|
719
|
+
),
|
|
720
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "if-errorBanner-text", children: verificationError })
|
|
721
|
+
] }) }),
|
|
722
|
+
method === "code" && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
723
|
+
"div",
|
|
724
|
+
{
|
|
725
|
+
style: {
|
|
726
|
+
width: "100%",
|
|
727
|
+
backgroundColor: "#F5F5F5",
|
|
728
|
+
borderRadius: "0.5rem",
|
|
729
|
+
padding: "1rem 1rem 1.5rem",
|
|
730
|
+
display: "flex",
|
|
731
|
+
flexDirection: "column",
|
|
732
|
+
gap: "1rem"
|
|
733
|
+
},
|
|
734
|
+
children: [
|
|
735
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
736
|
+
AuthVerificationCodeInput,
|
|
737
|
+
{
|
|
738
|
+
value: verificationCode,
|
|
739
|
+
onChange: setVerificationCode,
|
|
740
|
+
email,
|
|
741
|
+
disabled: isVerifying,
|
|
742
|
+
onComplete: (code) => {
|
|
743
|
+
void handleVerifyCode(code);
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
),
|
|
747
|
+
isVerifying && /* @__PURE__ */ jsxRuntime.jsx(
|
|
748
|
+
"p",
|
|
749
|
+
{
|
|
750
|
+
style: {
|
|
751
|
+
fontSize: "0.875rem",
|
|
752
|
+
color: "#828282",
|
|
753
|
+
textAlign: "center",
|
|
754
|
+
fontFamily: "var(--if-font-family)"
|
|
755
|
+
},
|
|
756
|
+
children: "Verifying..."
|
|
757
|
+
}
|
|
758
|
+
)
|
|
759
|
+
]
|
|
760
|
+
}
|
|
761
|
+
),
|
|
762
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
763
|
+
"div",
|
|
764
|
+
{
|
|
765
|
+
style: {
|
|
766
|
+
width: "100%",
|
|
767
|
+
fontSize: "0.875rem",
|
|
768
|
+
textAlign: "center",
|
|
769
|
+
color: "#828282",
|
|
770
|
+
fontFamily: "var(--if-font-family)"
|
|
771
|
+
},
|
|
772
|
+
children: [
|
|
773
|
+
"Didn't receive the email?",
|
|
774
|
+
" ",
|
|
775
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
776
|
+
"button",
|
|
777
|
+
{
|
|
778
|
+
onClick: () => {
|
|
779
|
+
void handleResend();
|
|
780
|
+
},
|
|
781
|
+
disabled: resendDisabled || isSending,
|
|
782
|
+
style: {
|
|
783
|
+
color: "#000",
|
|
784
|
+
fontWeight: 500,
|
|
785
|
+
transition: "all 0.2s",
|
|
786
|
+
cursor: resendDisabled || isSending ? "not-allowed" : "pointer",
|
|
787
|
+
background: "none",
|
|
788
|
+
border: "none",
|
|
789
|
+
padding: 0,
|
|
790
|
+
textDecoration: resendDisabled || isSending ? "none" : "underline",
|
|
791
|
+
opacity: resendDisabled || isSending ? 0.5 : 1,
|
|
792
|
+
fontFamily: "var(--if-font-family)"
|
|
793
|
+
},
|
|
794
|
+
children: isSending ? "Sending..." : resendDisabled ? `Retry in (${resendCountdown}s)` : "Click to resend"
|
|
795
|
+
}
|
|
796
|
+
)
|
|
797
|
+
]
|
|
798
|
+
}
|
|
799
|
+
)
|
|
800
|
+
] });
|
|
801
|
+
}
|
|
802
|
+
function SignInForm({
|
|
803
|
+
email,
|
|
804
|
+
password,
|
|
805
|
+
onEmailChange,
|
|
806
|
+
onPasswordChange,
|
|
807
|
+
onSubmit,
|
|
808
|
+
error,
|
|
809
|
+
loading = false,
|
|
810
|
+
oauthLoading = null,
|
|
811
|
+
availableProviders = [],
|
|
812
|
+
onOAuthClick,
|
|
813
|
+
authConfig,
|
|
814
|
+
title = "Welcome Back",
|
|
815
|
+
subtitle = "Login to your account",
|
|
816
|
+
emailLabel = "Email",
|
|
817
|
+
emailPlaceholder = "example@email.com",
|
|
818
|
+
passwordLabel = "Password",
|
|
819
|
+
passwordPlaceholder = "\u2022\u2022\u2022\u2022\u2022\u2022",
|
|
820
|
+
forgotPasswordText = "Forget Password?",
|
|
821
|
+
forgotPasswordUrl,
|
|
822
|
+
submitButtonText = "Sign In",
|
|
823
|
+
loadingButtonText = "Signing in...",
|
|
824
|
+
signUpText = "Don't have an account?",
|
|
825
|
+
signUpLinkText = "Sign Up Now",
|
|
826
|
+
signUpUrl = "/sign-up",
|
|
827
|
+
dividerText = "or",
|
|
828
|
+
showVerificationStep = false,
|
|
829
|
+
onVerifyCode,
|
|
830
|
+
verificationDescription
|
|
831
|
+
}) {
|
|
832
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(AuthContainer, { children: [
|
|
833
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
834
|
+
AuthHeader,
|
|
835
|
+
{
|
|
836
|
+
title: showVerificationStep ? "Verify Your Email" : title,
|
|
837
|
+
subtitle: showVerificationStep ? "" : subtitle
|
|
838
|
+
}
|
|
839
|
+
),
|
|
840
|
+
/* @__PURE__ */ jsxRuntime.jsx(AuthErrorBanner, { error: error || "" }),
|
|
841
|
+
showVerificationStep ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
842
|
+
AuthEmailVerificationStep,
|
|
843
|
+
{
|
|
844
|
+
email,
|
|
845
|
+
description: verificationDescription,
|
|
846
|
+
onVerifyCode
|
|
847
|
+
}
|
|
848
|
+
) : /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit, noValidate: true, className: "if-form if-internal-fm9k2p", children: [
|
|
849
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
850
|
+
AuthFormField,
|
|
851
|
+
{
|
|
852
|
+
id: "email",
|
|
853
|
+
type: "email",
|
|
854
|
+
label: emailLabel,
|
|
855
|
+
placeholder: emailPlaceholder,
|
|
856
|
+
value: email,
|
|
857
|
+
onChange: (e) => onEmailChange(e.target.value),
|
|
858
|
+
required: true,
|
|
859
|
+
autoComplete: "email"
|
|
860
|
+
}
|
|
861
|
+
),
|
|
862
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
863
|
+
AuthPasswordField,
|
|
864
|
+
{
|
|
865
|
+
id: "password",
|
|
866
|
+
label: passwordLabel,
|
|
867
|
+
placeholder: passwordPlaceholder,
|
|
868
|
+
value: password,
|
|
869
|
+
onChange: (e) => onPasswordChange(e.target.value),
|
|
870
|
+
required: true,
|
|
871
|
+
autoComplete: "current-password",
|
|
872
|
+
authConfig,
|
|
873
|
+
forgotPasswordLink: forgotPasswordUrl ? {
|
|
874
|
+
href: forgotPasswordUrl,
|
|
875
|
+
text: forgotPasswordText
|
|
876
|
+
} : void 0
|
|
877
|
+
}
|
|
878
|
+
),
|
|
879
|
+
/* @__PURE__ */ jsxRuntime.jsx(AuthSubmitButton, { isLoading: loading, disabled: loading || oauthLoading !== null, children: loading ? loadingButtonText : submitButtonText })
|
|
880
|
+
] }),
|
|
881
|
+
!showVerificationStep && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
882
|
+
/* @__PURE__ */ jsxRuntime.jsx(AuthLink, { text: signUpText, linkText: signUpLinkText, href: signUpUrl }),
|
|
883
|
+
availableProviders.length > 0 && onOAuthClick && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
884
|
+
/* @__PURE__ */ jsxRuntime.jsx(AuthDivider, { text: dividerText }),
|
|
885
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
886
|
+
AuthOAuthProviders,
|
|
887
|
+
{
|
|
888
|
+
providers: availableProviders,
|
|
889
|
+
onClick: onOAuthClick,
|
|
890
|
+
disabled: loading || oauthLoading !== null,
|
|
891
|
+
loading: oauthLoading
|
|
892
|
+
}
|
|
893
|
+
)
|
|
894
|
+
] })
|
|
895
|
+
] })
|
|
896
|
+
] });
|
|
897
|
+
}
|
|
898
|
+
function SignUpForm({
|
|
899
|
+
email,
|
|
900
|
+
password,
|
|
901
|
+
onEmailChange,
|
|
902
|
+
onPasswordChange,
|
|
903
|
+
onSubmit,
|
|
904
|
+
error,
|
|
905
|
+
loading = false,
|
|
906
|
+
oauthLoading = null,
|
|
907
|
+
availableProviders = [],
|
|
908
|
+
onOAuthClick,
|
|
909
|
+
authConfig,
|
|
910
|
+
title = "Get Started",
|
|
911
|
+
subtitle = "Create your account",
|
|
912
|
+
emailLabel = "Email",
|
|
913
|
+
emailPlaceholder = "example@email.com",
|
|
914
|
+
passwordLabel = "Password",
|
|
915
|
+
passwordPlaceholder = "\u2022\u2022\u2022\u2022\u2022\u2022",
|
|
916
|
+
submitButtonText = "Sign Up",
|
|
917
|
+
loadingButtonText = "Creating account...",
|
|
918
|
+
signInText = "Already have an account?",
|
|
919
|
+
signInLinkText = "Login Now",
|
|
920
|
+
signInUrl = "/sign-in",
|
|
921
|
+
dividerText = "or",
|
|
922
|
+
showVerificationStep = false,
|
|
923
|
+
onVerifyCode,
|
|
924
|
+
verificationDescription
|
|
925
|
+
}) {
|
|
926
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(AuthContainer, { children: [
|
|
927
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
928
|
+
AuthHeader,
|
|
929
|
+
{
|
|
930
|
+
title: showVerificationStep ? "Verify Your Email" : title,
|
|
931
|
+
subtitle: showVerificationStep ? "" : subtitle
|
|
932
|
+
}
|
|
933
|
+
),
|
|
934
|
+
/* @__PURE__ */ jsxRuntime.jsx(AuthErrorBanner, { error: error || "" }),
|
|
935
|
+
showVerificationStep ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
936
|
+
AuthEmailVerificationStep,
|
|
937
|
+
{
|
|
938
|
+
email,
|
|
939
|
+
description: verificationDescription,
|
|
940
|
+
onVerifyCode
|
|
941
|
+
}
|
|
942
|
+
) : /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit, noValidate: true, className: "if-form if-internal-fm9k2p", children: [
|
|
943
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
944
|
+
AuthFormField,
|
|
945
|
+
{
|
|
946
|
+
id: "email",
|
|
947
|
+
type: "email",
|
|
948
|
+
label: emailLabel,
|
|
949
|
+
placeholder: emailPlaceholder,
|
|
950
|
+
value: email,
|
|
951
|
+
onChange: (e) => onEmailChange(e.target.value),
|
|
952
|
+
required: true,
|
|
953
|
+
autoComplete: "email"
|
|
954
|
+
}
|
|
955
|
+
),
|
|
956
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
957
|
+
AuthPasswordField,
|
|
958
|
+
{
|
|
959
|
+
id: "password",
|
|
960
|
+
label: passwordLabel,
|
|
961
|
+
placeholder: passwordPlaceholder,
|
|
962
|
+
value: password,
|
|
963
|
+
onChange: (e) => onPasswordChange(e.target.value),
|
|
964
|
+
required: true,
|
|
965
|
+
minLength: authConfig.passwordMinLength,
|
|
966
|
+
autoComplete: "new-password",
|
|
967
|
+
showStrengthIndicator: true,
|
|
968
|
+
authConfig
|
|
969
|
+
}
|
|
970
|
+
),
|
|
971
|
+
/* @__PURE__ */ jsxRuntime.jsx(AuthSubmitButton, { isLoading: loading, disabled: loading || oauthLoading !== null, children: loading ? loadingButtonText : submitButtonText })
|
|
972
|
+
] }),
|
|
973
|
+
!showVerificationStep && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
974
|
+
/* @__PURE__ */ jsxRuntime.jsx(AuthLink, { text: signInText, linkText: signInLinkText, href: signInUrl }),
|
|
975
|
+
availableProviders.length > 0 && onOAuthClick && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
976
|
+
/* @__PURE__ */ jsxRuntime.jsx(AuthDivider, { text: dividerText }),
|
|
977
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
978
|
+
AuthOAuthProviders,
|
|
979
|
+
{
|
|
980
|
+
providers: availableProviders,
|
|
981
|
+
onClick: onOAuthClick,
|
|
982
|
+
disabled: loading || oauthLoading !== null,
|
|
983
|
+
loading: oauthLoading
|
|
984
|
+
}
|
|
985
|
+
)
|
|
986
|
+
] })
|
|
987
|
+
] })
|
|
988
|
+
] });
|
|
989
|
+
}
|
|
990
|
+
function ForgotPasswordForm({
|
|
991
|
+
email,
|
|
992
|
+
onEmailChange,
|
|
993
|
+
onSubmit,
|
|
994
|
+
error,
|
|
995
|
+
loading = false,
|
|
996
|
+
success = false,
|
|
997
|
+
title = "Forgot Password?",
|
|
998
|
+
subtitle = "Enter your email address and we'll send you a code to reset your password.",
|
|
999
|
+
emailLabel = "Email",
|
|
1000
|
+
emailPlaceholder = "example@email.com",
|
|
1001
|
+
submitButtonText = "Send Reset Code",
|
|
1002
|
+
loadingButtonText = "Sending...",
|
|
1003
|
+
backToSignInText = "Remember your password?",
|
|
1004
|
+
backToSignInUrl = "/sign-in",
|
|
1005
|
+
successTitle = "Check Your Email",
|
|
1006
|
+
successMessage
|
|
1007
|
+
}) {
|
|
1008
|
+
if (success) {
|
|
1009
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AuthContainer, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1010
|
+
"div",
|
|
1011
|
+
{
|
|
1012
|
+
style: { display: "flex", flexDirection: "column", alignItems: "center", gap: "1rem" },
|
|
1013
|
+
children: [
|
|
1014
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1015
|
+
"div",
|
|
1016
|
+
{
|
|
1017
|
+
style: {
|
|
1018
|
+
width: "4rem",
|
|
1019
|
+
height: "4rem",
|
|
1020
|
+
borderRadius: "50%",
|
|
1021
|
+
backgroundColor: "#D1FAE5",
|
|
1022
|
+
display: "flex",
|
|
1023
|
+
alignItems: "center",
|
|
1024
|
+
justifyContent: "center"
|
|
1025
|
+
},
|
|
1026
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1027
|
+
"svg",
|
|
1028
|
+
{
|
|
1029
|
+
style: { width: "2rem", height: "2rem", color: "#059669" },
|
|
1030
|
+
fill: "none",
|
|
1031
|
+
strokeLinecap: "round",
|
|
1032
|
+
strokeLinejoin: "round",
|
|
1033
|
+
strokeWidth: "2",
|
|
1034
|
+
viewBox: "0 0 24 24",
|
|
1035
|
+
stroke: "currentColor",
|
|
1036
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M5 13l4 4L19 7" })
|
|
1037
|
+
}
|
|
1038
|
+
)
|
|
1039
|
+
}
|
|
1040
|
+
),
|
|
1041
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "if-authHeader-title", style: { textAlign: "center" }, children: successTitle }),
|
|
1042
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "if-authHeader-subtitle", style: { textAlign: "center" }, children: successMessage || `We've sent a password reset link to ${email}. Please check your email and follow the instructions.` }),
|
|
1043
|
+
/* @__PURE__ */ jsxRuntime.jsx("a", { href: backToSignInUrl, className: "if-authLink-link", style: { marginTop: "1rem" }, children: "Back to Sign In" })
|
|
1044
|
+
]
|
|
1045
|
+
}
|
|
1046
|
+
) });
|
|
1047
|
+
}
|
|
1048
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(AuthContainer, { children: [
|
|
1049
|
+
/* @__PURE__ */ jsxRuntime.jsx(AuthHeader, { title, subtitle }),
|
|
1050
|
+
/* @__PURE__ */ jsxRuntime.jsx(AuthErrorBanner, { error: error || "" }),
|
|
1051
|
+
/* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit, noValidate: true, className: "if-form if-internal-fm9k2p", children: [
|
|
1052
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1053
|
+
AuthFormField,
|
|
1054
|
+
{
|
|
1055
|
+
id: "email",
|
|
1056
|
+
type: "email",
|
|
1057
|
+
label: emailLabel,
|
|
1058
|
+
placeholder: emailPlaceholder,
|
|
1059
|
+
value: email,
|
|
1060
|
+
onChange: (e) => onEmailChange(e.target.value),
|
|
1061
|
+
required: true,
|
|
1062
|
+
autoComplete: "email"
|
|
1063
|
+
}
|
|
1064
|
+
),
|
|
1065
|
+
/* @__PURE__ */ jsxRuntime.jsx(AuthSubmitButton, { isLoading: loading, disabled: loading, children: loading ? loadingButtonText : submitButtonText })
|
|
1066
|
+
] }),
|
|
1067
|
+
/* @__PURE__ */ jsxRuntime.jsx(AuthLink, { text: backToSignInText, linkText: "Back to Sign In", href: backToSignInUrl })
|
|
1068
|
+
] });
|
|
1069
|
+
}
|
|
1070
|
+
function ResetPasswordForm({
|
|
1071
|
+
newPassword,
|
|
1072
|
+
confirmPassword,
|
|
1073
|
+
onNewPasswordChange,
|
|
1074
|
+
onConfirmPasswordChange,
|
|
1075
|
+
onSubmit,
|
|
1076
|
+
error,
|
|
1077
|
+
loading = false,
|
|
1078
|
+
success = false,
|
|
1079
|
+
authConfig,
|
|
1080
|
+
title = "Reset Password",
|
|
1081
|
+
subtitle = "Enter your new password below.",
|
|
1082
|
+
newPasswordLabel = "New Password",
|
|
1083
|
+
newPasswordPlaceholder = "\u2022\u2022\u2022\u2022\u2022\u2022",
|
|
1084
|
+
confirmPasswordLabel = "Confirm Password",
|
|
1085
|
+
confirmPasswordPlaceholder = "\u2022\u2022\u2022\u2022\u2022\u2022",
|
|
1086
|
+
submitButtonText = "Reset Password",
|
|
1087
|
+
loadingButtonText = "Resetting...",
|
|
1088
|
+
backToSignInText = "",
|
|
1089
|
+
backToSignInUrl = "/sign-in",
|
|
1090
|
+
successTitle = "Password Reset Successful!",
|
|
1091
|
+
successMessage = "Your password has been successfully reset. You can now sign in with your new password."
|
|
1092
|
+
}) {
|
|
1093
|
+
if (success) {
|
|
1094
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AuthContainer, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1095
|
+
"div",
|
|
1096
|
+
{
|
|
1097
|
+
style: { display: "flex", flexDirection: "column", alignItems: "center", gap: "1rem" },
|
|
1098
|
+
children: [
|
|
1099
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1100
|
+
"div",
|
|
1101
|
+
{
|
|
1102
|
+
style: {
|
|
1103
|
+
width: "4rem",
|
|
1104
|
+
height: "4rem",
|
|
1105
|
+
borderRadius: "50%",
|
|
1106
|
+
backgroundColor: "#D1FAE5",
|
|
1107
|
+
display: "flex",
|
|
1108
|
+
alignItems: "center",
|
|
1109
|
+
justifyContent: "center"
|
|
1110
|
+
},
|
|
1111
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1112
|
+
"svg",
|
|
1113
|
+
{
|
|
1114
|
+
style: { width: "2rem", height: "2rem", color: "#059669" },
|
|
1115
|
+
fill: "none",
|
|
1116
|
+
strokeLinecap: "round",
|
|
1117
|
+
strokeLinejoin: "round",
|
|
1118
|
+
strokeWidth: "2",
|
|
1119
|
+
viewBox: "0 0 24 24",
|
|
1120
|
+
stroke: "currentColor",
|
|
1121
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M5 13l4 4L19 7" })
|
|
1122
|
+
}
|
|
1123
|
+
)
|
|
1124
|
+
}
|
|
1125
|
+
),
|
|
1126
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "if-authHeader-title", style: { textAlign: "center" }, children: successTitle }),
|
|
1127
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "if-authHeader-subtitle", style: { textAlign: "center" }, children: successMessage }),
|
|
1128
|
+
/* @__PURE__ */ jsxRuntime.jsx("a", { href: backToSignInUrl, className: "if-authLink-link", style: { marginTop: "1rem" }, children: "Back to Sign In" })
|
|
1129
|
+
]
|
|
1130
|
+
}
|
|
1131
|
+
) });
|
|
1132
|
+
}
|
|
1133
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(AuthContainer, { children: [
|
|
1134
|
+
/* @__PURE__ */ jsxRuntime.jsx(AuthHeader, { title, subtitle }),
|
|
1135
|
+
/* @__PURE__ */ jsxRuntime.jsx(AuthErrorBanner, { error: error || "" }),
|
|
1136
|
+
/* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit, noValidate: true, className: "if-form if-internal-fm9k2p", children: [
|
|
1137
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1138
|
+
AuthPasswordField,
|
|
1139
|
+
{
|
|
1140
|
+
id: "newPassword",
|
|
1141
|
+
label: newPasswordLabel,
|
|
1142
|
+
placeholder: newPasswordPlaceholder,
|
|
1143
|
+
value: newPassword,
|
|
1144
|
+
onChange: (e) => onNewPasswordChange(e.target.value),
|
|
1145
|
+
required: true,
|
|
1146
|
+
autoComplete: "new-password",
|
|
1147
|
+
showStrengthIndicator: true,
|
|
1148
|
+
authConfig
|
|
1149
|
+
}
|
|
1150
|
+
),
|
|
1151
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1152
|
+
AuthPasswordField,
|
|
1153
|
+
{
|
|
1154
|
+
id: "confirmPassword",
|
|
1155
|
+
label: confirmPasswordLabel,
|
|
1156
|
+
placeholder: confirmPasswordPlaceholder,
|
|
1157
|
+
value: confirmPassword,
|
|
1158
|
+
onChange: (e) => onConfirmPasswordChange(e.target.value),
|
|
1159
|
+
required: true,
|
|
1160
|
+
autoComplete: "new-password",
|
|
1161
|
+
authConfig
|
|
1162
|
+
}
|
|
1163
|
+
),
|
|
1164
|
+
/* @__PURE__ */ jsxRuntime.jsx(AuthSubmitButton, { isLoading: loading, disabled: loading, children: loading ? loadingButtonText : submitButtonText })
|
|
1165
|
+
] }),
|
|
1166
|
+
/* @__PURE__ */ jsxRuntime.jsx(AuthLink, { text: backToSignInText, linkText: "Back to Sign In", href: backToSignInUrl })
|
|
1167
|
+
] });
|
|
1168
|
+
}
|
|
1169
|
+
function VerifyEmailStatus({
|
|
1170
|
+
status,
|
|
1171
|
+
error,
|
|
1172
|
+
verifyingTitle = "Verifying your email...",
|
|
1173
|
+
successTitle = "Email Verified!",
|
|
1174
|
+
successMessage = "Your email has been verified successfully. You can close this page and return to your app.",
|
|
1175
|
+
errorTitle = "Verification Failed"
|
|
1176
|
+
}) {
|
|
1177
|
+
if (status === "verifying") {
|
|
1178
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AuthContainer, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1179
|
+
"div",
|
|
1180
|
+
{
|
|
1181
|
+
style: {
|
|
1182
|
+
width: "100%",
|
|
1183
|
+
display: "flex",
|
|
1184
|
+
flexDirection: "column",
|
|
1185
|
+
alignItems: "center",
|
|
1186
|
+
justifyContent: "center",
|
|
1187
|
+
gap: "1.5rem"
|
|
1188
|
+
},
|
|
1189
|
+
children: [
|
|
1190
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "if-authHeader-title", children: verifyingTitle }),
|
|
1191
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1192
|
+
"div",
|
|
1193
|
+
{
|
|
1194
|
+
className: "if-submitButton-spinner",
|
|
1195
|
+
style: {
|
|
1196
|
+
borderRadius: "50%",
|
|
1197
|
+
height: "3rem",
|
|
1198
|
+
width: "3rem",
|
|
1199
|
+
borderBottom: "2px solid black"
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
)
|
|
1203
|
+
]
|
|
1204
|
+
}
|
|
1205
|
+
) });
|
|
1206
|
+
}
|
|
1207
|
+
if (status === "error") {
|
|
1208
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AuthContainer, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1209
|
+
"div",
|
|
1210
|
+
{
|
|
1211
|
+
style: {
|
|
1212
|
+
width: "100%",
|
|
1213
|
+
display: "flex",
|
|
1214
|
+
flexDirection: "column",
|
|
1215
|
+
alignItems: "stretch",
|
|
1216
|
+
justifyContent: "center",
|
|
1217
|
+
gap: "1.5rem"
|
|
1218
|
+
},
|
|
1219
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "if-authHeader if-internal-h3m7w5", children: [
|
|
1220
|
+
/* @__PURE__ */ jsxRuntime.jsx("h1", { className: "if-authHeader-title if-internal-t4p1k9", children: errorTitle }),
|
|
1221
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "if-authHeader-subtitle if-internal-s7q2m3", style: { lineHeight: "1.5" }, children: [
|
|
1222
|
+
error || "The verification link is invalid or has expired.",
|
|
1223
|
+
" Please try again or contact support if the problem persists. You can close this page and return to your app."
|
|
1224
|
+
] })
|
|
1225
|
+
] })
|
|
1226
|
+
}
|
|
1227
|
+
) });
|
|
1228
|
+
}
|
|
1229
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AuthContainer, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1230
|
+
"div",
|
|
1231
|
+
{
|
|
1232
|
+
style: {
|
|
1233
|
+
width: "100%",
|
|
1234
|
+
display: "flex",
|
|
1235
|
+
flexDirection: "column",
|
|
1236
|
+
alignItems: "stretch",
|
|
1237
|
+
justifyContent: "center",
|
|
1238
|
+
gap: "1.5rem"
|
|
1239
|
+
},
|
|
1240
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1241
|
+
"div",
|
|
1242
|
+
{
|
|
1243
|
+
style: { display: "flex", flexDirection: "column", alignItems: "center", gap: "1rem" },
|
|
1244
|
+
children: [
|
|
1245
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1246
|
+
"div",
|
|
1247
|
+
{
|
|
1248
|
+
style: {
|
|
1249
|
+
width: "4rem",
|
|
1250
|
+
height: "4rem",
|
|
1251
|
+
borderRadius: "50%",
|
|
1252
|
+
backgroundColor: "#D1FAE5",
|
|
1253
|
+
display: "flex",
|
|
1254
|
+
alignItems: "center",
|
|
1255
|
+
justifyContent: "center"
|
|
1256
|
+
},
|
|
1257
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1258
|
+
"svg",
|
|
1259
|
+
{
|
|
1260
|
+
style: { width: "2rem", height: "2rem", color: "#059669" },
|
|
1261
|
+
fill: "none",
|
|
1262
|
+
strokeLinecap: "round",
|
|
1263
|
+
strokeLinejoin: "round",
|
|
1264
|
+
strokeWidth: "2",
|
|
1265
|
+
viewBox: "0 0 24 24",
|
|
1266
|
+
stroke: "currentColor",
|
|
1267
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M5 13l4 4L19 7" })
|
|
1268
|
+
}
|
|
1269
|
+
)
|
|
1270
|
+
}
|
|
1271
|
+
),
|
|
1272
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "if-authHeader-title", style: { textAlign: "center" }, children: successTitle }),
|
|
1273
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "if-authHeader-subtitle", style: { textAlign: "center" }, children: successMessage })
|
|
1274
|
+
]
|
|
1275
|
+
}
|
|
1276
|
+
)
|
|
1277
|
+
}
|
|
1278
|
+
) });
|
|
1279
|
+
}
|
|
1280
|
+
|
|
1281
|
+
exports.ForgotPasswordForm = ForgotPasswordForm;
|
|
1282
|
+
exports.ResetPasswordForm = ResetPasswordForm;
|
|
1283
|
+
exports.SignInForm = SignInForm;
|
|
1284
|
+
exports.SignUpForm = SignUpForm;
|
|
1285
|
+
exports.VerifyEmailStatus = VerifyEmailStatus;
|
|
1286
|
+
//# sourceMappingURL=forms.cjs.map
|
|
1287
|
+
//# sourceMappingURL=forms.cjs.map
|