azirid-react 0.10.1 → 0.10.2

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.js CHANGED
@@ -3009,6 +3009,7 @@ function usePayButton({
3009
3009
  const [payphoneConfig, setPayphoneConfig] = useState(null);
3010
3010
  const [currentError, setCurrentError] = useState(null);
3011
3011
  const payphoneConfirmTriggered = useRef(false);
3012
+ const { isBootstrapping } = useAzirid();
3012
3013
  const params = typeof window !== "undefined" ? new URLSearchParams(window.location.search) : new URLSearchParams();
3013
3014
  const callbackId = params.get("id");
3014
3015
  const callbackClientTxId = params.get("clientTransactionId");
@@ -3091,12 +3092,12 @@ function usePayButton({
3091
3092
  }
3092
3093
  });
3093
3094
  useEffect(() => {
3094
- if (!isPayphoneCallback || payphoneConfirmTriggered.current) return;
3095
+ if (!isPayphoneCallback || payphoneConfirmTriggered.current || isBootstrapping) return;
3095
3096
  payphoneConfirmTriggered.current = true;
3096
3097
  setSelectedProvider("PAYPHONE");
3097
3098
  setStatus("processing");
3098
3099
  confirmPayphone({ id: Number(callbackId), clientTransactionId: callbackClientTxId });
3099
- }, [isPayphoneCallback, callbackId, callbackClientTxId, confirmPayphone]);
3100
+ }, [isPayphoneCallback, isBootstrapping, callbackId, callbackClientTxId, confirmPayphone]);
3100
3101
  const handleSdkError = useCallback(
3101
3102
  (err) => {
3102
3103
  setCurrentError(err);
@@ -3530,16 +3531,17 @@ function PayphoneCallback({ onSuccess, onError, className, style }) {
3530
3531
  onSuccess,
3531
3532
  onError
3532
3533
  });
3534
+ const { isBootstrapping } = useAzirid();
3533
3535
  const called = useRef(false);
3534
3536
  useEffect(() => {
3535
- if (called.current) return;
3537
+ if (called.current || isBootstrapping) return;
3536
3538
  called.current = true;
3537
3539
  const params = new URLSearchParams(window.location.search);
3538
3540
  const id = params.get("id");
3539
3541
  const clientTransactionId = params.get("clientTransactionId");
3540
3542
  if (!id || !clientTransactionId) return;
3541
3543
  mutate({ id: Number(id), clientTransactionId });
3542
- }, [mutate]);
3544
+ }, [mutate, isBootstrapping]);
3543
3545
  return /* @__PURE__ */ jsxs("div", { className, style: { textAlign: "center", padding: "32px", ...style }, children: [
3544
3546
  isPending && /* @__PURE__ */ jsxs("div", { children: [
3545
3547
  /* @__PURE__ */ jsx("p", { style: textStyle, children: "Confirming your payment..." }),
@@ -4041,6 +4043,7 @@ function usePayphoneCheckout({
4041
4043
  const [currentError, setCurrentError] = useState(null);
4042
4044
  const checkoutTriggered = useRef(false);
4043
4045
  const confirmTriggered = useRef(false);
4046
+ const { isBootstrapping } = useAzirid();
4044
4047
  const params = typeof window !== "undefined" ? new URLSearchParams(window.location.search) : new URLSearchParams();
4045
4048
  const callbackId = params.get("id");
4046
4049
  const callbackClientTxId = params.get("clientTransactionId");
@@ -4082,11 +4085,11 @@ function usePayphoneCheckout({
4082
4085
  }
4083
4086
  });
4084
4087
  useEffect(() => {
4085
- if (!isCallback || confirmTriggered.current) return;
4088
+ if (!isCallback || confirmTriggered.current || isBootstrapping) return;
4086
4089
  confirmTriggered.current = true;
4087
4090
  setStatus("confirming");
4088
4091
  confirm({ id: Number(callbackId), clientTransactionId: callbackClientTxId });
4089
- }, [isCallback, callbackId, callbackClientTxId, confirm]);
4092
+ }, [isCallback, isBootstrapping, callbackId, callbackClientTxId, confirm]);
4090
4093
  const handleSdkError = useCallback(
4091
4094
  (err) => {
4092
4095
  setCurrentError(err);
@@ -4344,7 +4347,7 @@ function usePasswordToggle() {
4344
4347
  }
4345
4348
 
4346
4349
  // src/index.ts
4347
- var SDK_VERSION = "0.10.1";
4350
+ var SDK_VERSION = "0.10.2";
4348
4351
 
4349
4352
  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
4353
  //# sourceMappingURL=index.js.map