azirid-react 0.10.1 → 0.10.3
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 +37 -4
- package/dist/index.cjs +16 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +16 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -766,9 +766,15 @@ function AziridProviderInner({
|
|
|
766
766
|
},
|
|
767
767
|
[client]
|
|
768
768
|
);
|
|
769
|
+
const bootstrapCalled = useRef(false);
|
|
769
770
|
useEffect(() => {
|
|
770
771
|
const autoBootstrap = props.autoBootstrap ?? true;
|
|
771
772
|
if (!autoBootstrap) return;
|
|
773
|
+
if (bootstrapCalled.current) {
|
|
774
|
+
setIsBootstrapping(false);
|
|
775
|
+
return;
|
|
776
|
+
}
|
|
777
|
+
bootstrapCalled.current = true;
|
|
772
778
|
let cancelled = false;
|
|
773
779
|
async function bootstrap() {
|
|
774
780
|
setIsBootstrapping(true);
|
|
@@ -3009,6 +3015,7 @@ function usePayButton({
|
|
|
3009
3015
|
const [payphoneConfig, setPayphoneConfig] = useState(null);
|
|
3010
3016
|
const [currentError, setCurrentError] = useState(null);
|
|
3011
3017
|
const payphoneConfirmTriggered = useRef(false);
|
|
3018
|
+
const { isBootstrapping } = useAzirid();
|
|
3012
3019
|
const params = typeof window !== "undefined" ? new URLSearchParams(window.location.search) : new URLSearchParams();
|
|
3013
3020
|
const callbackId = params.get("id");
|
|
3014
3021
|
const callbackClientTxId = params.get("clientTransactionId");
|
|
@@ -3091,12 +3098,12 @@ function usePayButton({
|
|
|
3091
3098
|
}
|
|
3092
3099
|
});
|
|
3093
3100
|
useEffect(() => {
|
|
3094
|
-
if (!isPayphoneCallback || payphoneConfirmTriggered.current) return;
|
|
3101
|
+
if (!isPayphoneCallback || payphoneConfirmTriggered.current || isBootstrapping) return;
|
|
3095
3102
|
payphoneConfirmTriggered.current = true;
|
|
3096
3103
|
setSelectedProvider("PAYPHONE");
|
|
3097
3104
|
setStatus("processing");
|
|
3098
3105
|
confirmPayphone({ id: Number(callbackId), clientTransactionId: callbackClientTxId });
|
|
3099
|
-
}, [isPayphoneCallback, callbackId, callbackClientTxId, confirmPayphone]);
|
|
3106
|
+
}, [isPayphoneCallback, isBootstrapping, callbackId, callbackClientTxId, confirmPayphone]);
|
|
3100
3107
|
const handleSdkError = useCallback(
|
|
3101
3108
|
(err) => {
|
|
3102
3109
|
setCurrentError(err);
|
|
@@ -3530,16 +3537,17 @@ function PayphoneCallback({ onSuccess, onError, className, style }) {
|
|
|
3530
3537
|
onSuccess,
|
|
3531
3538
|
onError
|
|
3532
3539
|
});
|
|
3540
|
+
const { isBootstrapping } = useAzirid();
|
|
3533
3541
|
const called = useRef(false);
|
|
3534
3542
|
useEffect(() => {
|
|
3535
|
-
if (called.current) return;
|
|
3543
|
+
if (called.current || isBootstrapping) return;
|
|
3536
3544
|
called.current = true;
|
|
3537
3545
|
const params = new URLSearchParams(window.location.search);
|
|
3538
3546
|
const id = params.get("id");
|
|
3539
3547
|
const clientTransactionId = params.get("clientTransactionId");
|
|
3540
3548
|
if (!id || !clientTransactionId) return;
|
|
3541
3549
|
mutate({ id: Number(id), clientTransactionId });
|
|
3542
|
-
}, [mutate]);
|
|
3550
|
+
}, [mutate, isBootstrapping]);
|
|
3543
3551
|
return /* @__PURE__ */ jsxs("div", { className, style: { textAlign: "center", padding: "32px", ...style }, children: [
|
|
3544
3552
|
isPending && /* @__PURE__ */ jsxs("div", { children: [
|
|
3545
3553
|
/* @__PURE__ */ jsx("p", { style: textStyle, children: "Confirming your payment..." }),
|
|
@@ -4041,6 +4049,7 @@ function usePayphoneCheckout({
|
|
|
4041
4049
|
const [currentError, setCurrentError] = useState(null);
|
|
4042
4050
|
const checkoutTriggered = useRef(false);
|
|
4043
4051
|
const confirmTriggered = useRef(false);
|
|
4052
|
+
const { isBootstrapping } = useAzirid();
|
|
4044
4053
|
const params = typeof window !== "undefined" ? new URLSearchParams(window.location.search) : new URLSearchParams();
|
|
4045
4054
|
const callbackId = params.get("id");
|
|
4046
4055
|
const callbackClientTxId = params.get("clientTransactionId");
|
|
@@ -4082,11 +4091,11 @@ function usePayphoneCheckout({
|
|
|
4082
4091
|
}
|
|
4083
4092
|
});
|
|
4084
4093
|
useEffect(() => {
|
|
4085
|
-
if (!isCallback || confirmTriggered.current) return;
|
|
4094
|
+
if (!isCallback || confirmTriggered.current || isBootstrapping) return;
|
|
4086
4095
|
confirmTriggered.current = true;
|
|
4087
4096
|
setStatus("confirming");
|
|
4088
4097
|
confirm({ id: Number(callbackId), clientTransactionId: callbackClientTxId });
|
|
4089
|
-
}, [isCallback, callbackId, callbackClientTxId, confirm]);
|
|
4098
|
+
}, [isCallback, isBootstrapping, callbackId, callbackClientTxId, confirm]);
|
|
4090
4099
|
const handleSdkError = useCallback(
|
|
4091
4100
|
(err) => {
|
|
4092
4101
|
setCurrentError(err);
|
|
@@ -4344,7 +4353,7 @@ function usePasswordToggle() {
|
|
|
4344
4353
|
}
|
|
4345
4354
|
|
|
4346
4355
|
// src/index.ts
|
|
4347
|
-
var SDK_VERSION = "0.10.
|
|
4356
|
+
var SDK_VERSION = "0.10.3";
|
|
4348
4357
|
|
|
4349
4358
|
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 };
|
|
4350
4359
|
//# sourceMappingURL=index.js.map
|