azirid-react 0.10.3 → 0.10.4
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 +1 -1
- package/dist/index.cjs +12 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +12 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -870,6 +870,8 @@ interface AccessClient {
|
|
|
870
870
|
refreshSession: (opts?: {
|
|
871
871
|
tenantId?: string;
|
|
872
872
|
}) => Promise<void>;
|
|
873
|
+
/** Deduplicated bootstrap — safe to call from Strict Mode double-mounts */
|
|
874
|
+
bootstrapSession: <T = unknown>() => Promise<T>;
|
|
873
875
|
}
|
|
874
876
|
declare function createAccessClient(config: AccessClientConfig, appContext?: AccessClient['appContext']): AccessClient;
|
|
875
877
|
|
package/dist/index.d.ts
CHANGED
|
@@ -870,6 +870,8 @@ interface AccessClient {
|
|
|
870
870
|
refreshSession: (opts?: {
|
|
871
871
|
tenantId?: string;
|
|
872
872
|
}) => Promise<void>;
|
|
873
|
+
/** Deduplicated bootstrap — safe to call from Strict Mode double-mounts */
|
|
874
|
+
bootstrapSession: <T = unknown>() => Promise<T>;
|
|
873
875
|
}
|
|
874
876
|
declare function createAccessClient(config: AccessClientConfig, appContext?: AccessClient['appContext']): AccessClient;
|
|
875
877
|
|
package/dist/index.js
CHANGED
|
@@ -163,6 +163,7 @@ function createAccessClient(config, appContext) {
|
|
|
163
163
|
let refreshToken = ssGet(storageKeyRt);
|
|
164
164
|
let csrfToken = ssGet(storageKeyCsrf);
|
|
165
165
|
let refreshPromise = null;
|
|
166
|
+
let bootstrapPromise = null;
|
|
166
167
|
let channel = null;
|
|
167
168
|
try {
|
|
168
169
|
if (typeof BroadcastChannel !== "undefined") {
|
|
@@ -262,6 +263,13 @@ function createAccessClient(config, appContext) {
|
|
|
262
263
|
});
|
|
263
264
|
return refreshPromise;
|
|
264
265
|
}
|
|
266
|
+
function deduplicatedBootstrap() {
|
|
267
|
+
if (bootstrapPromise) return bootstrapPromise;
|
|
268
|
+
bootstrapPromise = request("POST", paths.bootstrap).finally(() => {
|
|
269
|
+
bootstrapPromise = null;
|
|
270
|
+
});
|
|
271
|
+
return bootstrapPromise;
|
|
272
|
+
}
|
|
265
273
|
async function request(method, path, body) {
|
|
266
274
|
const headers = {
|
|
267
275
|
"Content-Type": "application/json",
|
|
@@ -363,7 +371,8 @@ function createAccessClient(config, appContext) {
|
|
|
363
371
|
getRefreshToken,
|
|
364
372
|
setCsrfToken,
|
|
365
373
|
getCsrfToken,
|
|
366
|
-
refreshSession: (opts) => refreshTokens(opts)
|
|
374
|
+
refreshSession: (opts) => refreshTokens(opts),
|
|
375
|
+
bootstrapSession: () => deduplicatedBootstrap()
|
|
367
376
|
};
|
|
368
377
|
}
|
|
369
378
|
|
|
@@ -766,20 +775,14 @@ function AziridProviderInner({
|
|
|
766
775
|
},
|
|
767
776
|
[client]
|
|
768
777
|
);
|
|
769
|
-
const bootstrapCalled = useRef(false);
|
|
770
778
|
useEffect(() => {
|
|
771
779
|
const autoBootstrap = props.autoBootstrap ?? true;
|
|
772
780
|
if (!autoBootstrap) return;
|
|
773
|
-
if (bootstrapCalled.current) {
|
|
774
|
-
setIsBootstrapping(false);
|
|
775
|
-
return;
|
|
776
|
-
}
|
|
777
|
-
bootstrapCalled.current = true;
|
|
778
781
|
let cancelled = false;
|
|
779
782
|
async function bootstrap() {
|
|
780
783
|
setIsBootstrapping(true);
|
|
781
784
|
try {
|
|
782
|
-
const response = await client.
|
|
785
|
+
const response = await client.bootstrapSession();
|
|
783
786
|
if (cancelled) return;
|
|
784
787
|
if (response.branding) {
|
|
785
788
|
setBranding(response.branding);
|
|
@@ -4353,7 +4356,7 @@ function usePasswordToggle() {
|
|
|
4353
4356
|
}
|
|
4354
4357
|
|
|
4355
4358
|
// src/index.ts
|
|
4356
|
-
var SDK_VERSION = "0.10.
|
|
4359
|
+
var SDK_VERSION = "0.10.4";
|
|
4357
4360
|
|
|
4358
4361
|
export { AuthForm, AziridProvider, BASE_PATHS, CheckoutButton, ForgotPasswordForm, InvoiceList, LoginForm, PATHS, PayButton, PayphoneCallback, PayphoneWidgetRenderer, PricingTable, ReferralCard, ReferralStats, ResetPasswordForm, SDK_VERSION, SignupForm, SubscriptionBadge, buildPaths, changePasswordSchema, cn, createAccessClient, createForgotPasswordSchema, createLoginSchema, createMutationHook, createResetPasswordConfirmSchema, createSignupSchema, en, es, forgotPasswordSchema, isAuthError, loginSchema, magicLinkRequestSchema, magicLinkVerifySchema, passkeyRegisterStartSchema, removeStyles, resetPasswordConfirmSchema, resolveMessages, signupSchema, socialLoginSchema, useAccessClient, useAzirid, useBootstrap, useBranding, useChangePassword, useCheckout, useFormState, useInvoices, useLogin, useLogout, useMagicLink, useMessages, usePasskeys, usePasswordReset, usePasswordToggle, usePayButton, usePaymentProviders, usePayphoneCheckout, usePayphoneConfirm, usePlans, useReferral, useReferralStats, useRefresh, useSession, useSignup, useSocialLogin, useSubmitTransferProof, useSubscription, useSwitchTenant, useTenantMembers, useTenants, useTransferPayment, useTransferProofs };
|
|
4359
4362
|
//# sourceMappingURL=index.js.map
|