@insforge/react 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -766,7 +766,6 @@ function AuthVerificationCodeInput({
766
766
  }
767
767
  function AuthEmailVerificationStep({
768
768
  email,
769
- title = "Verify Your Email",
770
769
  description,
771
770
  method = "code",
772
771
  onVerifyCode
@@ -843,29 +842,29 @@ function AuthEmailVerificationStep({
843
842
  }
844
843
  };
845
844
  const displayDescription = description || defaultDescription;
846
- return /* @__PURE__ */ jsxs("div", { className: "w-full flex flex-col gap-6 items-center", children: [
847
- /* @__PURE__ */ jsxs("div", { className: "w-full bg-neutral-100 dark:bg-neutral-800 rounded-lg px-4 pt-4 pb-6 flex flex-col gap-4", children: [
848
- /* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold text-black dark:text-white", children: title }),
849
- /* @__PURE__ */ jsx("p", { className: "text-neutral-600 dark:text-neutral-400 text-sm leading-relaxed", children: displayDescription.split("{email}").map((part, index, array) => /* @__PURE__ */ jsxs("span", { children: [
850
- part,
851
- index < array.length - 1 && /* @__PURE__ */ jsx("span", { className: "font-medium text-black dark:text-white", children: email })
852
- ] }, index)) }),
853
- method === "code" && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3 mt-2", children: [
854
- /* @__PURE__ */ jsx(
855
- AuthVerificationCodeInput,
856
- {
857
- value: verificationCode,
858
- onChange: setVerificationCode,
859
- email,
860
- disabled: isVerifying,
861
- onComplete: (code) => {
862
- void handleVerifyCode(code);
863
- }
845
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6 items-stretch", children: [
846
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-neutral-600 dark:text-neutral-400 leading-relaxed", children: displayDescription.split("{email}").map((part, index, array) => /* @__PURE__ */ jsxs("span", { children: [
847
+ part,
848
+ index < array.length - 1 && /* @__PURE__ */ jsx("span", { className: "font-medium text-black dark:text-white", children: email })
849
+ ] }, index)) }),
850
+ verificationError && /* @__PURE__ */ jsx("div", { className: "pl-3 py-2 pr-2 bg-red-50 border-2 border-red-600 rounded", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
851
+ /* @__PURE__ */ jsx("svg", { className: "w-6 h-6 text-red-500 shrink-0", fill: "none", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ 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" }) }),
852
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-red-600 flex-1", children: verificationError })
853
+ ] }) }),
854
+ method === "code" && /* @__PURE__ */ jsxs("div", { className: "w-full bg-neutral-100 dark:bg-neutral-800 rounded-lg px-4 pt-4 pb-6 flex flex-col gap-4", children: [
855
+ /* @__PURE__ */ jsx(
856
+ AuthVerificationCodeInput,
857
+ {
858
+ value: verificationCode,
859
+ onChange: setVerificationCode,
860
+ email,
861
+ disabled: isVerifying,
862
+ onComplete: (code) => {
863
+ void handleVerifyCode(code);
864
864
  }
865
- ),
866
- verificationError && /* @__PURE__ */ jsx("p", { className: "text-sm text-red-600 dark:text-red-400 text-center", children: verificationError }),
867
- isVerifying && /* @__PURE__ */ jsx("p", { className: "text-sm text-neutral-600 dark:text-neutral-400 text-center", children: "Verifying..." })
868
- ] })
865
+ }
866
+ ),
867
+ isVerifying && /* @__PURE__ */ jsx("p", { className: "text-sm text-neutral-600 dark:text-neutral-400 text-center", children: "Verifying..." })
869
868
  ] }),
870
869
  /* @__PURE__ */ jsxs("div", { className: "w-full text-sm text-center text-neutral-600 dark:text-neutral-400", children: [
871
870
  "Didn't receive the email?",
@@ -910,7 +909,11 @@ function SignInForm({
910
909
  signUpText = "Don't have an account?",
911
910
  signUpLinkText = "Sign Up Now",
912
911
  signUpUrl = "/sign-up",
913
- dividerText = "or"
912
+ dividerText = "or",
913
+ // Email verification step props
914
+ showVerificationStep = false,
915
+ onVerifyCode,
916
+ verificationDescription
914
917
  }) {
915
918
  return /* @__PURE__ */ jsxs(
916
919
  AuthContainer,
@@ -923,8 +926,8 @@ function SignInForm({
923
926
  /* @__PURE__ */ jsx(
924
927
  AuthHeader,
925
928
  {
926
- title,
927
- subtitle,
929
+ title: showVerificationStep ? "Verify Your Email" : title,
930
+ subtitle: showVerificationStep ? "" : subtitle,
928
931
  appearance: {
929
932
  containerClassName: appearance.header?.container,
930
933
  titleClassName: appearance.header?.title,
@@ -939,7 +942,14 @@ function SignInForm({
939
942
  className: appearance.errorBanner
940
943
  }
941
944
  ),
942
- /* @__PURE__ */ jsxs(
945
+ showVerificationStep ? /* @__PURE__ */ jsx(
946
+ AuthEmailVerificationStep,
947
+ {
948
+ email,
949
+ description: verificationDescription,
950
+ onVerifyCode
951
+ }
952
+ ) : /* @__PURE__ */ jsxs(
943
953
  "form",
944
954
  {
945
955
  onSubmit,
@@ -998,39 +1008,41 @@ function SignInForm({
998
1008
  ]
999
1009
  }
1000
1010
  ),
1001
- /* @__PURE__ */ jsx(
1002
- AuthLink,
1003
- {
1004
- text: signUpText,
1005
- linkText: signUpLinkText,
1006
- href: signUpUrl,
1007
- appearance: {
1008
- containerClassName: appearance.link?.container,
1009
- linkClassName: appearance.link?.link
1010
- }
1011
- }
1012
- ),
1013
- availableProviders.length > 0 && onOAuthClick && /* @__PURE__ */ jsxs(Fragment, { children: [
1011
+ !showVerificationStep && /* @__PURE__ */ jsxs(Fragment, { children: [
1014
1012
  /* @__PURE__ */ jsx(
1015
- AuthDivider,
1013
+ AuthLink,
1016
1014
  {
1017
- text: dividerText,
1018
- className: appearance.divider
1019
- }
1020
- ),
1021
- /* @__PURE__ */ jsx(
1022
- AuthOAuthProviders,
1023
- {
1024
- providers: availableProviders,
1025
- onClick: onOAuthClick,
1026
- disabled: loading || oauthLoading !== null,
1027
- loading: oauthLoading,
1015
+ text: signUpText,
1016
+ linkText: signUpLinkText,
1017
+ href: signUpUrl,
1028
1018
  appearance: {
1029
- containerClassName: appearance.oauth?.container,
1030
- buttonClassName: appearance.oauth?.button
1019
+ containerClassName: appearance.link?.container,
1020
+ linkClassName: appearance.link?.link
1031
1021
  }
1032
1022
  }
1033
- )
1023
+ ),
1024
+ availableProviders.length > 0 && onOAuthClick && /* @__PURE__ */ jsxs(Fragment, { children: [
1025
+ /* @__PURE__ */ jsx(
1026
+ AuthDivider,
1027
+ {
1028
+ text: dividerText,
1029
+ className: appearance.divider
1030
+ }
1031
+ ),
1032
+ /* @__PURE__ */ jsx(
1033
+ AuthOAuthProviders,
1034
+ {
1035
+ providers: availableProviders,
1036
+ onClick: onOAuthClick,
1037
+ disabled: loading || oauthLoading !== null,
1038
+ loading: oauthLoading,
1039
+ appearance: {
1040
+ containerClassName: appearance.oauth?.container,
1041
+ buttonClassName: appearance.oauth?.button
1042
+ }
1043
+ }
1044
+ )
1045
+ ] })
1034
1046
  ] })
1035
1047
  ]
1036
1048
  }
@@ -1112,7 +1124,7 @@ function SignIn({
1112
1124
  if (!emailConfig) {
1113
1125
  return null;
1114
1126
  }
1115
- return step === "form" ? /* @__PURE__ */ jsx(
1127
+ return /* @__PURE__ */ jsx(
1116
1128
  SignInForm,
1117
1129
  {
1118
1130
  email,
@@ -1126,14 +1138,10 @@ function SignIn({
1126
1138
  availableProviders: emailConfig?.oAuthProviders || [],
1127
1139
  onOAuthClick: handleOAuth,
1128
1140
  emailAuthConfig: emailConfig,
1141
+ showVerificationStep: step === "awaiting-verification",
1142
+ onVerifyCode: handleVerifyCode,
1129
1143
  ...uiProps
1130
1144
  }
1131
- ) : /* @__PURE__ */ jsx(
1132
- AuthEmailVerificationStep,
1133
- {
1134
- email,
1135
- onVerifyCode: handleVerifyCode
1136
- }
1137
1145
  );
1138
1146
  }
1139
1147
  function SignUpForm({
@@ -1160,7 +1168,11 @@ function SignUpForm({
1160
1168
  signInText = "Already have an account?",
1161
1169
  signInLinkText = "Login Now",
1162
1170
  signInUrl = "/sign-in",
1163
- dividerText = "or"
1171
+ dividerText = "or",
1172
+ // Email verification step props
1173
+ showVerificationStep = false,
1174
+ onVerifyCode,
1175
+ verificationDescription
1164
1176
  }) {
1165
1177
  return /* @__PURE__ */ jsxs(
1166
1178
  AuthContainer,
@@ -1173,8 +1185,8 @@ function SignUpForm({
1173
1185
  /* @__PURE__ */ jsx(
1174
1186
  AuthHeader,
1175
1187
  {
1176
- title,
1177
- subtitle,
1188
+ title: showVerificationStep ? "Verify Your Email" : title,
1189
+ subtitle: showVerificationStep ? "" : subtitle,
1178
1190
  appearance: {
1179
1191
  containerClassName: appearance.header?.container,
1180
1192
  titleClassName: appearance.header?.title,
@@ -1189,7 +1201,14 @@ function SignUpForm({
1189
1201
  className: appearance.errorBanner
1190
1202
  }
1191
1203
  ),
1192
- /* @__PURE__ */ jsxs(
1204
+ showVerificationStep ? /* @__PURE__ */ jsx(
1205
+ AuthEmailVerificationStep,
1206
+ {
1207
+ email,
1208
+ description: verificationDescription,
1209
+ onVerifyCode
1210
+ }
1211
+ ) : /* @__PURE__ */ jsxs(
1193
1212
  "form",
1194
1213
  {
1195
1214
  onSubmit,
@@ -1246,39 +1265,41 @@ function SignUpForm({
1246
1265
  ]
1247
1266
  }
1248
1267
  ),
1249
- /* @__PURE__ */ jsx(
1250
- AuthLink,
1251
- {
1252
- text: signInText,
1253
- linkText: signInLinkText,
1254
- href: signInUrl,
1255
- appearance: {
1256
- containerClassName: appearance.link?.container,
1257
- linkClassName: appearance.link?.link
1258
- }
1259
- }
1260
- ),
1261
- availableProviders.length > 0 && onOAuthClick && /* @__PURE__ */ jsxs(Fragment, { children: [
1262
- /* @__PURE__ */ jsx(
1263
- AuthDivider,
1264
- {
1265
- text: dividerText,
1266
- className: appearance.divider
1267
- }
1268
- ),
1268
+ !showVerificationStep && /* @__PURE__ */ jsxs(Fragment, { children: [
1269
1269
  /* @__PURE__ */ jsx(
1270
- AuthOAuthProviders,
1270
+ AuthLink,
1271
1271
  {
1272
- providers: availableProviders,
1273
- onClick: onOAuthClick,
1274
- disabled: loading || oauthLoading !== null,
1275
- loading: oauthLoading,
1272
+ text: signInText,
1273
+ linkText: signInLinkText,
1274
+ href: signInUrl,
1276
1275
  appearance: {
1277
- containerClassName: appearance.oauth?.container,
1278
- buttonClassName: appearance.oauth?.button
1276
+ containerClassName: appearance.link?.container,
1277
+ linkClassName: appearance.link?.link
1279
1278
  }
1280
1279
  }
1281
- )
1280
+ ),
1281
+ availableProviders.length > 0 && onOAuthClick && /* @__PURE__ */ jsxs(Fragment, { children: [
1282
+ /* @__PURE__ */ jsx(
1283
+ AuthDivider,
1284
+ {
1285
+ text: dividerText,
1286
+ className: appearance.divider
1287
+ }
1288
+ ),
1289
+ /* @__PURE__ */ jsx(
1290
+ AuthOAuthProviders,
1291
+ {
1292
+ providers: availableProviders,
1293
+ onClick: onOAuthClick,
1294
+ disabled: loading || oauthLoading !== null,
1295
+ loading: oauthLoading,
1296
+ appearance: {
1297
+ containerClassName: appearance.oauth?.container,
1298
+ buttonClassName: appearance.oauth?.button
1299
+ }
1300
+ }
1301
+ )
1302
+ ] })
1282
1303
  ] })
1283
1304
  ]
1284
1305
  }
@@ -1415,7 +1436,7 @@ function SignUp({
1415
1436
  if (!emailConfig) {
1416
1437
  return null;
1417
1438
  }
1418
- return step === "form" ? /* @__PURE__ */ jsx(
1439
+ return /* @__PURE__ */ jsx(
1419
1440
  SignUpForm,
1420
1441
  {
1421
1442
  email,
@@ -1429,14 +1450,10 @@ function SignUp({
1429
1450
  availableProviders: emailConfig?.oAuthProviders || [],
1430
1451
  onOAuthClick: handleOAuth,
1431
1452
  emailAuthConfig: emailConfig,
1453
+ showVerificationStep: step === "awaiting-verification",
1454
+ onVerifyCode: handleVerifyCode,
1432
1455
  ...uiProps
1433
1456
  }
1434
- ) : /* @__PURE__ */ jsx(
1435
- AuthEmailVerificationStep,
1436
- {
1437
- email,
1438
- onVerifyCode: handleVerifyCode
1439
- }
1440
1457
  );
1441
1458
  }
1442
1459
  function ForgotPasswordForm({
@@ -1659,13 +1676,18 @@ function ResetPasswordForm({
1659
1676
  ]
1660
1677
  }
1661
1678
  ),
1662
- /* @__PURE__ */ jsxs("p", { className: appearance.backToSignIn || "text-center text-sm text-gray-600 dark:text-gray-400", children: [
1663
- backToSignInText && /* @__PURE__ */ jsxs("span", { children: [
1664
- backToSignInText,
1665
- " "
1666
- ] }),
1667
- /* @__PURE__ */ jsx("a", { href: backToSignInUrl, className: "text-black dark:text-white font-medium", children: "Back to Sign In" })
1668
- ] })
1679
+ /* @__PURE__ */ jsx(
1680
+ AuthLink,
1681
+ {
1682
+ text: backToSignInText,
1683
+ linkText: "Back to Sign In",
1684
+ href: backToSignInUrl,
1685
+ appearance: {
1686
+ containerClassName: appearance.link?.container,
1687
+ linkClassName: appearance.link?.link
1688
+ }
1689
+ }
1690
+ )
1669
1691
  ]
1670
1692
  }
1671
1693
  );