@vaultix.ai/react 0.3.6 → 0.3.7

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.d.mts CHANGED
@@ -87,6 +87,13 @@ interface VaultixContextValue {
87
87
  * Controls which login methods and OAuth providers are rendered by <SignIn /> and <SignUp />.
88
88
  */
89
89
  appConfig: AppConfig | null;
90
+ /**
91
+ * True once the /api/v1/app/config fetch has settled (success OR failure).
92
+ * <SignIn /> and <SignUp /> render a skeleton until this is true so the
93
+ * default full set of methods/providers never flashes before narrowing
94
+ * to the app's configured set.
95
+ */
96
+ appConfigLoaded: boolean;
90
97
  signOut: (redirectUrl?: string) => Promise<void>;
91
98
  /** Update the current user's profile. Resolves with the updated user. */
92
99
  updateUser: (params: UpdateUserParams) => Promise<VaultixUser>;
package/dist/index.d.ts CHANGED
@@ -87,6 +87,13 @@ interface VaultixContextValue {
87
87
  * Controls which login methods and OAuth providers are rendered by <SignIn /> and <SignUp />.
88
88
  */
89
89
  appConfig: AppConfig | null;
90
+ /**
91
+ * True once the /api/v1/app/config fetch has settled (success OR failure).
92
+ * <SignIn /> and <SignUp /> render a skeleton until this is true so the
93
+ * default full set of methods/providers never flashes before narrowing
94
+ * to the app's configured set.
95
+ */
96
+ appConfigLoaded: boolean;
90
97
  signOut: (redirectUrl?: string) => Promise<void>;
91
98
  /** Update the current user's profile. Resolves with the updated user. */
92
99
  updateUser: (params: UpdateUserParams) => Promise<VaultixUser>;
package/dist/index.js CHANGED
@@ -113,6 +113,7 @@ function VaultixProvider({
113
113
  const [session, setSession] = (0, import_react.useState)(null);
114
114
  const [organization, setOrganization] = (0, import_react.useState)(null);
115
115
  const [appConfig, setAppConfig] = (0, import_react.useState)(null);
116
+ const [appConfigLoaded, setAppConfigLoaded] = (0, import_react.useState)(false);
116
117
  const jwtRef = (0, import_react.useRef)(null);
117
118
  const refreshTimerRef = (0, import_react.useRef)(null);
118
119
  const clearAuth = (0, import_react.useCallback)(() => {
@@ -224,6 +225,8 @@ function VaultixProvider({
224
225
  setAppConfig(cfg);
225
226
  }
226
227
  } catch {
228
+ } finally {
229
+ if (!cancelled) setAppConfigLoaded(true);
227
230
  }
228
231
  }
229
232
  hydrate();
@@ -287,6 +290,7 @@ function VaultixProvider({
287
290
  isSignedIn: !!session,
288
291
  apiOrigin,
289
292
  appConfig,
293
+ appConfigLoaded,
290
294
  signOut,
291
295
  updateUser,
292
296
  connectPlatform
@@ -438,8 +442,11 @@ function SignIn({
438
442
  const textColor = vars.colorText ?? "rgba(255,255,255,0.9)";
439
443
  const mutedColor = vars.colorTextMuted ?? "#475569";
440
444
  let appConfig = null;
445
+ let appConfigLoaded = true;
441
446
  try {
442
- appConfig = useVaultixContext().appConfig;
447
+ const ctx = useVaultixContext();
448
+ appConfig = ctx.appConfig;
449
+ appConfigLoaded = ctx.appConfigLoaded;
443
450
  } catch {
444
451
  }
445
452
  const enabledProviders = appConfig?.providers ?? ["google", "github", "meta", "linkedin", "x", "threads"];
@@ -711,6 +718,39 @@ function SignIn({
711
718
  "forgot-verify": `Code sent to ${email}`,
712
719
  "forgot-reset": "Choose a new password"
713
720
  };
721
+ if (!appConfigLoaded) {
722
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
723
+ "div",
724
+ {
725
+ className: (0, import_clsx.clsx)(
726
+ "w-full max-w-sm mx-auto rounded-2xl border border-white/8 shadow-2xl",
727
+ "backdrop-blur-[16px]",
728
+ className
729
+ ),
730
+ style: { background: cardBg },
731
+ "aria-busy": "true",
732
+ children: [
733
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "px-8 pt-8 pb-6 text-center", children: [
734
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
735
+ "div",
736
+ {
737
+ className: "inline-flex items-center justify-center w-10 h-10 rounded-xl shadow-lg mb-4 animate-pulse",
738
+ style: { background: primaryColor ?? "linear-gradient(to bottom right, #7c3aed, #2563eb)" },
739
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(LockIcon, {})
740
+ }
741
+ ),
742
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "h-5 w-32 mx-auto rounded bg-white/10 animate-pulse" }),
743
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "h-3 w-44 mx-auto mt-2 rounded bg-white/5 animate-pulse" })
744
+ ] }),
745
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "px-8 pb-8 space-y-3", children: [
746
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "h-11 w-full rounded-lg bg-white/10 animate-pulse" }),
747
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "h-11 w-full rounded-lg bg-white/5 animate-pulse" }),
748
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "h-11 w-full rounded-lg bg-white/5 animate-pulse" })
749
+ ] })
750
+ ]
751
+ }
752
+ );
753
+ }
714
754
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
715
755
  "div",
716
756
  {
@@ -1115,8 +1155,11 @@ function SignUp({
1115
1155
  const textColor = vars.colorText ?? "rgba(255,255,255,0.9)";
1116
1156
  const mutedColor = vars.colorTextMuted ?? "#475569";
1117
1157
  let appConfig = null;
1158
+ let appConfigLoaded = true;
1118
1159
  try {
1119
- appConfig = useVaultixContext().appConfig;
1160
+ const ctx = useVaultixContext();
1161
+ appConfig = ctx.appConfig;
1162
+ appConfigLoaded = ctx.appConfigLoaded;
1120
1163
  } catch {
1121
1164
  }
1122
1165
  const enabledProviders = appConfig?.providers ?? ["google", "github", "meta", "linkedin", "x", "threads"];
@@ -1209,6 +1252,37 @@ function SignUp({
1209
1252
  } catch {
1210
1253
  }
1211
1254
  }
1255
+ if (!appConfigLoaded) {
1256
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1257
+ "div",
1258
+ {
1259
+ className: (0, import_clsx2.clsx)(
1260
+ "w-full max-w-sm mx-auto rounded-2xl border border-white/8 shadow-2xl backdrop-blur-[16px]",
1261
+ className
1262
+ ),
1263
+ style: { background: cardBg },
1264
+ "aria-busy": "true",
1265
+ children: [
1266
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "px-8 pt-8 pb-6 text-center", children: [
1267
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1268
+ "div",
1269
+ {
1270
+ className: "inline-flex items-center justify-center w-10 h-10 rounded-xl shadow-lg mb-4 animate-pulse",
1271
+ style: { background: primaryColor ?? "linear-gradient(to bottom right, #7c3aed, #2563eb)" }
1272
+ }
1273
+ ),
1274
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "h-5 w-32 mx-auto rounded bg-white/10 animate-pulse" }),
1275
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "h-3 w-44 mx-auto mt-2 rounded bg-white/5 animate-pulse" })
1276
+ ] }),
1277
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "px-8 pb-8 space-y-3", children: [
1278
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "h-11 w-full rounded-lg bg-white/10 animate-pulse" }),
1279
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "h-11 w-full rounded-lg bg-white/5 animate-pulse" }),
1280
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "h-11 w-full rounded-lg bg-white/5 animate-pulse" })
1281
+ ] })
1282
+ ]
1283
+ }
1284
+ );
1285
+ }
1212
1286
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1213
1287
  "div",
1214
1288
  {
package/dist/index.mjs CHANGED
@@ -78,6 +78,7 @@ function VaultixProvider({
78
78
  const [session, setSession] = useState(null);
79
79
  const [organization, setOrganization] = useState(null);
80
80
  const [appConfig, setAppConfig] = useState(null);
81
+ const [appConfigLoaded, setAppConfigLoaded] = useState(false);
81
82
  const jwtRef = useRef(null);
82
83
  const refreshTimerRef = useRef(null);
83
84
  const clearAuth = useCallback(() => {
@@ -189,6 +190,8 @@ function VaultixProvider({
189
190
  setAppConfig(cfg);
190
191
  }
191
192
  } catch {
193
+ } finally {
194
+ if (!cancelled) setAppConfigLoaded(true);
192
195
  }
193
196
  }
194
197
  hydrate();
@@ -252,6 +255,7 @@ function VaultixProvider({
252
255
  isSignedIn: !!session,
253
256
  apiOrigin,
254
257
  appConfig,
258
+ appConfigLoaded,
255
259
  signOut,
256
260
  updateUser,
257
261
  connectPlatform
@@ -403,8 +407,11 @@ function SignIn({
403
407
  const textColor = vars.colorText ?? "rgba(255,255,255,0.9)";
404
408
  const mutedColor = vars.colorTextMuted ?? "#475569";
405
409
  let appConfig = null;
410
+ let appConfigLoaded = true;
406
411
  try {
407
- appConfig = useVaultixContext().appConfig;
412
+ const ctx = useVaultixContext();
413
+ appConfig = ctx.appConfig;
414
+ appConfigLoaded = ctx.appConfigLoaded;
408
415
  } catch {
409
416
  }
410
417
  const enabledProviders = appConfig?.providers ?? ["google", "github", "meta", "linkedin", "x", "threads"];
@@ -676,6 +683,39 @@ function SignIn({
676
683
  "forgot-verify": `Code sent to ${email}`,
677
684
  "forgot-reset": "Choose a new password"
678
685
  };
686
+ if (!appConfigLoaded) {
687
+ return /* @__PURE__ */ jsxs(
688
+ "div",
689
+ {
690
+ className: clsx(
691
+ "w-full max-w-sm mx-auto rounded-2xl border border-white/8 shadow-2xl",
692
+ "backdrop-blur-[16px]",
693
+ className
694
+ ),
695
+ style: { background: cardBg },
696
+ "aria-busy": "true",
697
+ children: [
698
+ /* @__PURE__ */ jsxs("div", { className: "px-8 pt-8 pb-6 text-center", children: [
699
+ /* @__PURE__ */ jsx2(
700
+ "div",
701
+ {
702
+ className: "inline-flex items-center justify-center w-10 h-10 rounded-xl shadow-lg mb-4 animate-pulse",
703
+ style: { background: primaryColor ?? "linear-gradient(to bottom right, #7c3aed, #2563eb)" },
704
+ children: /* @__PURE__ */ jsx2(LockIcon, {})
705
+ }
706
+ ),
707
+ /* @__PURE__ */ jsx2("div", { className: "h-5 w-32 mx-auto rounded bg-white/10 animate-pulse" }),
708
+ /* @__PURE__ */ jsx2("div", { className: "h-3 w-44 mx-auto mt-2 rounded bg-white/5 animate-pulse" })
709
+ ] }),
710
+ /* @__PURE__ */ jsxs("div", { className: "px-8 pb-8 space-y-3", children: [
711
+ /* @__PURE__ */ jsx2("div", { className: "h-11 w-full rounded-lg bg-white/10 animate-pulse" }),
712
+ /* @__PURE__ */ jsx2("div", { className: "h-11 w-full rounded-lg bg-white/5 animate-pulse" }),
713
+ /* @__PURE__ */ jsx2("div", { className: "h-11 w-full rounded-lg bg-white/5 animate-pulse" })
714
+ ] })
715
+ ]
716
+ }
717
+ );
718
+ }
679
719
  return /* @__PURE__ */ jsxs(
680
720
  "div",
681
721
  {
@@ -1080,8 +1120,11 @@ function SignUp({
1080
1120
  const textColor = vars.colorText ?? "rgba(255,255,255,0.9)";
1081
1121
  const mutedColor = vars.colorTextMuted ?? "#475569";
1082
1122
  let appConfig = null;
1123
+ let appConfigLoaded = true;
1083
1124
  try {
1084
- appConfig = useVaultixContext().appConfig;
1125
+ const ctx = useVaultixContext();
1126
+ appConfig = ctx.appConfig;
1127
+ appConfigLoaded = ctx.appConfigLoaded;
1085
1128
  } catch {
1086
1129
  }
1087
1130
  const enabledProviders = appConfig?.providers ?? ["google", "github", "meta", "linkedin", "x", "threads"];
@@ -1174,6 +1217,37 @@ function SignUp({
1174
1217
  } catch {
1175
1218
  }
1176
1219
  }
1220
+ if (!appConfigLoaded) {
1221
+ return /* @__PURE__ */ jsxs2(
1222
+ "div",
1223
+ {
1224
+ className: clsx2(
1225
+ "w-full max-w-sm mx-auto rounded-2xl border border-white/8 shadow-2xl backdrop-blur-[16px]",
1226
+ className
1227
+ ),
1228
+ style: { background: cardBg },
1229
+ "aria-busy": "true",
1230
+ children: [
1231
+ /* @__PURE__ */ jsxs2("div", { className: "px-8 pt-8 pb-6 text-center", children: [
1232
+ /* @__PURE__ */ jsx3(
1233
+ "div",
1234
+ {
1235
+ className: "inline-flex items-center justify-center w-10 h-10 rounded-xl shadow-lg mb-4 animate-pulse",
1236
+ style: { background: primaryColor ?? "linear-gradient(to bottom right, #7c3aed, #2563eb)" }
1237
+ }
1238
+ ),
1239
+ /* @__PURE__ */ jsx3("div", { className: "h-5 w-32 mx-auto rounded bg-white/10 animate-pulse" }),
1240
+ /* @__PURE__ */ jsx3("div", { className: "h-3 w-44 mx-auto mt-2 rounded bg-white/5 animate-pulse" })
1241
+ ] }),
1242
+ /* @__PURE__ */ jsxs2("div", { className: "px-8 pb-8 space-y-3", children: [
1243
+ /* @__PURE__ */ jsx3("div", { className: "h-11 w-full rounded-lg bg-white/10 animate-pulse" }),
1244
+ /* @__PURE__ */ jsx3("div", { className: "h-11 w-full rounded-lg bg-white/5 animate-pulse" }),
1245
+ /* @__PURE__ */ jsx3("div", { className: "h-11 w-full rounded-lg bg-white/5 animate-pulse" })
1246
+ ] })
1247
+ ]
1248
+ }
1249
+ );
1250
+ }
1177
1251
  return /* @__PURE__ */ jsxs2(
1178
1252
  "div",
1179
1253
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaultix.ai/react",
3
- "version": "0.3.6",
3
+ "version": "0.3.7",
4
4
  "description": "Vaultix-ID React SDK — drop-in auth components for any React app",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",