azirid-react 0.9.3 → 0.9.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/dist/index.d.cts CHANGED
@@ -725,7 +725,7 @@ interface PayphoneCallbackProps {
725
725
  className?: string;
726
726
  style?: CSSProperties;
727
727
  }
728
- declare function PayphoneCallback({ onSuccess, onError, className, style, }: PayphoneCallbackProps): react_jsx_runtime.JSX.Element;
728
+ declare function PayphoneCallback({ onSuccess, onError, className, style }: PayphoneCallbackProps): react_jsx_runtime.JSX.Element;
729
729
 
730
730
  interface SubscriptionBadgeProps {
731
731
  className?: string;
package/dist/index.d.ts CHANGED
@@ -725,7 +725,7 @@ interface PayphoneCallbackProps {
725
725
  className?: string;
726
726
  style?: CSSProperties;
727
727
  }
728
- declare function PayphoneCallback({ onSuccess, onError, className, style, }: PayphoneCallbackProps): react_jsx_runtime.JSX.Element;
728
+ declare function PayphoneCallback({ onSuccess, onError, className, style }: PayphoneCallbackProps): react_jsx_runtime.JSX.Element;
729
729
 
730
730
  interface SubscriptionBadgeProps {
731
731
  className?: string;
package/dist/index.js CHANGED
@@ -677,10 +677,7 @@ function AziridProviderInner({
677
677
  () => resolveMessages(props.locale ?? "es", props.messages),
678
678
  [props.locale, props.messages]
679
679
  );
680
- const brandingValue = useMemo(
681
- () => ({ branding, messages }),
682
- [branding, messages]
683
- );
680
+ const brandingValue = useMemo(() => ({ branding, messages }), [branding, messages]);
684
681
  const isProxyMode = !props.apiUrl;
685
682
  const syncUrl = useMemo(() => {
686
683
  if (props.sessionSyncUrl === false) return null;
@@ -805,13 +802,7 @@ function AziridProviderInner({
805
802
  (data) => data.at ?? data.accessToken,
806
803
  []
807
804
  );
808
- const {
809
- loginMutation,
810
- signupMutation,
811
- logoutMutation,
812
- refreshFn,
813
- switchTenantFn
814
- } = useAuthMutations({
805
+ const { loginMutation, signupMutation, logoutMutation, refreshFn, switchTenantFn } = useAuthMutations({
815
806
  client,
816
807
  props,
817
808
  setUser,
@@ -1872,10 +1863,7 @@ function useReferral() {
1872
1863
  }
1873
1864
  return false;
1874
1865
  }, [query.data?.referralUrl]);
1875
- return useMemo(
1876
- () => ({ ...query, copyToClipboard }),
1877
- [query, copyToClipboard]
1878
- );
1866
+ return useMemo(() => ({ ...query, copyToClipboard }), [query, copyToClipboard]);
1879
1867
  }
1880
1868
  var styles = {
1881
1869
  card: {
@@ -2662,16 +2650,12 @@ var intervalLabels2 = {
2662
2650
  YEARLY: "/yr",
2663
2651
  ONE_TIME: ""
2664
2652
  };
2665
- function TransferModal({
2666
- data,
2667
- onClose
2668
- }) {
2653
+ function TransferModal({ data, onClose }) {
2669
2654
  const bankDetails = data.bankDetails;
2670
2655
  return /* @__PURE__ */ jsx("div", { style: styles5.overlay, onClick: onClose, children: /* @__PURE__ */ jsxs("div", { style: styles5.modal, onClick: (e) => e.stopPropagation(), children: [
2671
2656
  /* @__PURE__ */ jsx("h2", { style: styles5.modalTitle, children: "Manual Transfer" }),
2672
2657
  /* @__PURE__ */ jsxs("p", { style: styles5.modalSubtitle, children: [
2673
- "Transfer the amount below to subscribe to",
2674
- " ",
2658
+ "Transfer the amount below to subscribe to ",
2675
2659
  /* @__PURE__ */ jsx("strong", { children: data.plan?.name })
2676
2660
  ] }),
2677
2661
  /* @__PURE__ */ jsxs(
@@ -2734,9 +2718,7 @@ function PricingTable({
2734
2718
  const { data: plans, isLoading: plansLoading } = usePlans();
2735
2719
  const { data: subscription } = useSubscription();
2736
2720
  const { data: providers } = usePaymentProviders();
2737
- const [transferData, setTransferData] = useState(
2738
- null
2739
- );
2721
+ const [transferData, setTransferData] = useState(null);
2740
2722
  const [payphoneData, setPayphoneData] = useState(null);
2741
2723
  const [pendingPlan, setPendingPlan] = useState(null);
2742
2724
  const [showProviderModal, setShowProviderModal] = useState(false);
@@ -2756,8 +2738,7 @@ function PricingTable({
2756
2738
  checkout({ planId, provider, successUrl, cancelUrl });
2757
2739
  };
2758
2740
  const handleSelect = (plan) => {
2759
- if (subscription?.planId === plan.id && subscription.status === "ACTIVE")
2760
- return;
2741
+ if (subscription?.planId === plan.id && subscription.status === "ACTIVE") return;
2761
2742
  if (onPlanSelect) {
2762
2743
  onPlanSelect(plan);
2763
2744
  return;
@@ -2829,26 +2810,19 @@ function PricingTable({
2829
2810
  }
2830
2811
  const sortedPlans = plans ? [...plans].sort((a, b) => a.sortOrder - b.sortOrder) : [];
2831
2812
  return /* @__PURE__ */ jsxs(Fragment, { children: [
2832
- /* @__PURE__ */ jsx(
2833
- "div",
2834
- {
2835
- className,
2836
- style: { ...styles5.grid(columns), ...style },
2837
- children: sortedPlans.map((plan) => {
2838
- const isCurrentPlan = subscription?.planId === plan.id && subscription.status === "ACTIVE";
2839
- return /* @__PURE__ */ jsx(
2840
- PricingCard,
2841
- {
2842
- plan,
2843
- isCurrentPlan,
2844
- isCheckoutPending: checkoutPending,
2845
- onSelect: handleSelect
2846
- },
2847
- plan.id
2848
- );
2849
- })
2850
- }
2851
- ),
2813
+ /* @__PURE__ */ jsx("div", { className, style: { ...styles5.grid(columns), ...style }, children: sortedPlans.map((plan) => {
2814
+ const isCurrentPlan = subscription?.planId === plan.id && subscription.status === "ACTIVE";
2815
+ return /* @__PURE__ */ jsx(
2816
+ PricingCard,
2817
+ {
2818
+ plan,
2819
+ isCurrentPlan,
2820
+ isCheckoutPending: checkoutPending,
2821
+ onSelect: handleSelect
2822
+ },
2823
+ plan.id
2824
+ );
2825
+ }) }),
2852
2826
  showProviderModal && pendingPlan && providers && providers.length > 1 && /* @__PURE__ */ jsx(
2853
2827
  ProviderSelectModal,
2854
2828
  {
@@ -2861,13 +2835,7 @@ function PricingTable({
2861
2835
  }
2862
2836
  }
2863
2837
  ),
2864
- transferData && /* @__PURE__ */ jsx(
2865
- TransferModal,
2866
- {
2867
- data: transferData,
2868
- onClose: () => setTransferData(null)
2869
- }
2870
- ),
2838
+ transferData && /* @__PURE__ */ jsx(TransferModal, { data: transferData, onClose: () => setTransferData(null) }),
2871
2839
  payphoneData?.widgetConfig && /* @__PURE__ */ jsx(
2872
2840
  PayphoneModal,
2873
2841
  {
@@ -3016,11 +2984,7 @@ function ProviderModal({
3016
2984
  /* @__PURE__ */ jsx("button", { type: "button", style: modalStyles.cancelButton, onClick: onClose, children: labels?.cancel ?? "Cancel" })
3017
2985
  ] }) });
3018
2986
  }
3019
- function TransferModal2({
3020
- data,
3021
- onClose,
3022
- labels
3023
- }) {
2987
+ function TransferModal2({ data, onClose, labels }) {
3024
2988
  const bankDetails = data.bankDetails;
3025
2989
  const plan = data.plan;
3026
2990
  const intent = data.intent;
@@ -3131,9 +3095,12 @@ function PayButton({
3131
3095
  setTransferData(data);
3132
3096
  setShowTransferModal(true);
3133
3097
  setShowProviderModal(false);
3134
- } else if (data.provider === "PAYPHONE" && data.widgetConfig) {
3098
+ return;
3099
+ }
3100
+ if (data.provider === "PAYPHONE" && data.widgetConfig) {
3135
3101
  setPayphoneData(data);
3136
3102
  setShowProviderModal(false);
3103
+ return;
3137
3104
  }
3138
3105
  onSuccess?.(data);
3139
3106
  },
@@ -3178,7 +3145,7 @@ function PayButton({
3178
3145
  },
3179
3146
  onClick: handleClick,
3180
3147
  disabled: isDisabled,
3181
- children: isPending ? billing?.processing ?? "Processing..." : children ?? (billing?.pay ?? "Pay")
3148
+ children: isPending ? billing?.processing ?? "Processing..." : children ?? billing?.pay ?? "Pay"
3182
3149
  }
3183
3150
  ),
3184
3151
  showProviderModal && providers && providers.length > 1 && /* @__PURE__ */ jsx(
@@ -3197,6 +3164,7 @@ function PayButton({
3197
3164
  data: transferData,
3198
3165
  onClose: () => {
3199
3166
  setShowTransferModal(false);
3167
+ onSuccess?.(transferData);
3200
3168
  setTransferData(null);
3201
3169
  },
3202
3170
  labels: billing
@@ -3207,7 +3175,10 @@ function PayButton({
3207
3175
  {
3208
3176
  config: payphoneData.widgetConfig,
3209
3177
  successUrl,
3210
- onClose: () => setPayphoneData(null)
3178
+ onClose: () => {
3179
+ onSuccess?.(payphoneData);
3180
+ setPayphoneData(null);
3181
+ }
3211
3182
  }
3212
3183
  )
3213
3184
  ] });
@@ -3220,12 +3191,7 @@ function usePayphoneConfirm(options) {
3220
3191
  onError: options?.onError
3221
3192
  });
3222
3193
  }
3223
- function PayphoneCallback({
3224
- onSuccess,
3225
- onError,
3226
- className,
3227
- style
3228
- }) {
3194
+ function PayphoneCallback({ onSuccess, onError, className, style }) {
3229
3195
  const { mutate, isPending, isSuccess, isError, error, data } = usePayphoneConfirm({
3230
3196
  onSuccess,
3231
3197
  onError
@@ -3822,7 +3788,7 @@ function usePasswordToggle() {
3822
3788
  }
3823
3789
 
3824
3790
  // src/index.ts
3825
- var SDK_VERSION = "0.9.3";
3791
+ var SDK_VERSION = "0.9.4";
3826
3792
 
3827
3793
  export { AuthForm, AziridProvider, BASE_PATHS, CheckoutButton, ForgotPasswordForm, InvoiceList, LoginForm, PATHS, PayButton, PayphoneCallback, 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, usePaymentProviders, usePayphoneConfirm, usePlans, useReferral, useReferralStats, useRefresh, useSession, useSignup, useSocialLogin, useSubmitTransferProof, useSubscription, useSwitchTenant, useTenantMembers, useTenants, useTransferProofs };
3828
3794
  //# sourceMappingURL=index.js.map