azirid-react 0.9.3 → 0.9.5

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 CHANGED
@@ -667,6 +667,54 @@ const { data: proofs } = useTransferProofs()
667
667
  // [{ id, status: 'PENDING_REVIEW' | 'APPROVED' | 'REJECTED', ... }]
668
668
  ```
669
669
 
670
+ ### `usePayphoneCheckout`
671
+
672
+ Hook that returns a **renderable widget component** and **payment status**. Pass an `intentId` and get full control over where the widget renders and how to react to the payment result.
673
+
674
+ ```tsx
675
+ import { usePayphoneCheckout } from 'azirid-react'
676
+
677
+ function CheckoutPage({ intentId }: { intentId: string }) {
678
+ const { PayphoneWidget, status, error } = usePayphoneCheckout({
679
+ intentId,
680
+ onSuccess: (data) => {
681
+ // data: { status: 'confirmed' | 'cancelled' | 'already_confirmed', intentId: string }
682
+ console.log('Payment result:', data.status)
683
+ },
684
+ onError: (err) => console.error(err),
685
+ })
686
+
687
+ return (
688
+ <div>
689
+ <h1>Pay</h1>
690
+ <PayphoneWidget />
691
+ {status === 'loading' && <p>Preparing checkout...</p>}
692
+ {status === 'confirming' && <p>Confirming payment...</p>}
693
+ {status === 'confirmed' && <p>Payment confirmed!</p>}
694
+ {status === 'cancelled' && <p>Payment was cancelled</p>}
695
+ {status === 'error' && <p>Error: {error?.message}</p>}
696
+ </div>
697
+ )
698
+ }
699
+ ```
700
+
701
+ | Option | Type | Description |
702
+ |--------|------|-------------|
703
+ | `intentId` | `string` | **Required.** Payment intent ID |
704
+ | `onSuccess` | `(data) => void` | Called after payment confirmation |
705
+ | `onError` | `(error) => void` | Called on any error |
706
+
707
+ | Return | Type | Description |
708
+ |--------|------|-------------|
709
+ | `PayphoneWidget` | `() => ReactElement \| null` | Component to render the Payphone widget |
710
+ | `status` | `PayphoneCheckoutStatus` | `'idle' \| 'loading' \| 'ready' \| 'confirming' \| 'confirmed' \| 'cancelled' \| 'error'` |
711
+ | `intentId` | `string` | The intent ID passed in |
712
+ | `error` | `Error \| null` | Error details if status is `'error'` |
713
+
714
+ The hook handles both phases automatically:
715
+ 1. **Widget phase**: Calls checkout API, loads Payphone SDK, widget renders via `<PayphoneWidget />`.
716
+ 2. **Confirmation phase**: After Payphone redirects back (same page), detects URL params and confirms the payment.
717
+
670
718
  ### `usePayphoneConfirm`
671
719
 
672
720
  Confirm a Payphone payment callback. Used on the Payphone return URL page.
@@ -689,7 +737,6 @@ Drop-in pricing grid with checkout flow integrated.
689
737
 
690
738
  ```tsx
691
739
  import { PricingTable } from 'azirid-react'
692
-
693
740
  ;<PricingTable
694
741
  successUrl={`${window.location.origin}/billing?success=true`}
695
742
  cancelUrl={`${window.location.origin}/billing`}
@@ -712,7 +759,6 @@ Flexible payment button with provider selection modal. Supports both plans and p
712
759
 
713
760
  ```tsx
714
761
  import { PayButton } from 'azirid-react'
715
-
716
762
  ;<PayButton
717
763
  planId="plan_123"
718
764
  successUrl="/billing?success=true"
@@ -725,14 +771,15 @@ import { PayButton } from 'azirid-react'
725
771
 
726
772
  | Prop | Type | Default | Description |
727
773
  | ------------ | ----------------- | ------- | --------------------------------------------- |
728
- | `planId` | `string` | — | Plan to purchase (use `planId` or `intentId`) |
729
- | `intentId` | `string` | — | Payment intent ID (alternative to `planId`) |
730
- | `successUrl` | `string` | — | **Required.** Redirect URL after success |
731
- | `cancelUrl` | `string` | — | **Required.** Redirect URL on cancel |
732
- | `onSuccess` | `(data) => void` | — | Called on successful checkout |
733
- | `onError` | `(error) => void` | — | Called on error |
734
- | `children` | `ReactNode` | — | Button label |
735
- | `disabled` | `boolean` | — | Disable the button |
774
+ | `planId` | `string` | — | Plan to purchase (use `planId` or `intentId`) |
775
+ | `intentId` | `string` | — | Payment intent ID (alternative to `planId`) |
776
+ | `successUrl` | `string` | — | **Required.** Redirect URL after success |
777
+ | `cancelUrl` | `string` | — | **Required.** Redirect URL on cancel |
778
+ | `onSuccess` | `(data) => void` | — | Called on successful checkout. For `MANUAL_TRANSFER` and `PAYPHONE`, deferred until the user closes the modal |
779
+ | `onError` | `(error) => void` | — | Called on error |
780
+ | `onProviderSelect` | `(provider: string) => void` | — | Called when a provider is selected |
781
+ | `children` | `ReactNode` | — | Button label |
782
+ | `disabled` | `boolean` | — | Disable the button |
736
783
 
737
784
  #### `CheckoutButton`
738
785
 
@@ -740,7 +787,6 @@ Simple checkout button for a specific plan.
740
787
 
741
788
  ```tsx
742
789
  import { CheckoutButton } from 'azirid-react'
743
-
744
790
  ;<CheckoutButton planId="plan_123" successUrl="/billing?success=true" cancelUrl="/billing">
745
791
  Subscribe
746
792
  </CheckoutButton>
@@ -752,7 +798,6 @@ Color-coded badge showing the current subscription status.
752
798
 
753
799
  ```tsx
754
800
  import { SubscriptionBadge } from 'azirid-react'
755
-
756
801
  ;<SubscriptionBadge />
757
802
  // Renders: "Pro · Active" (green), "Free · Trialing" (blue), etc.
758
803
  ```
@@ -765,7 +810,6 @@ Table of invoices with status badges and download links.
765
810
 
766
811
  ```tsx
767
812
  import { InvoiceList } from 'azirid-react'
768
-
769
813
  ;<InvoiceList />
770
814
  ```
771
815
 
@@ -934,7 +978,6 @@ Card displaying the referral link with copy button and stats.
934
978
 
935
979
  ```tsx
936
980
  import { ReferralCard } from 'azirid-react'
937
-
938
981
  ;<ReferralCard
939
982
  title="Refer a Friend"
940
983
  description="Share your link and earn rewards for each signup."
@@ -953,7 +996,6 @@ Table showing referral history with status and reward badges.
953
996
 
954
997
  ```tsx
955
998
  import { ReferralStats } from 'azirid-react'
956
-
957
999
  ;<ReferralStats />
958
1000
  ```
959
1001
 
@@ -1424,7 +1466,6 @@ Tailwind class merge utility (powered by `clsx` + `tailwind-merge`).
1424
1466
 
1425
1467
  ```tsx
1426
1468
  import { cn } from 'azirid-react'
1427
-
1428
1469
  ;<div className={cn('bg-white p-4', isActive && 'bg-blue-500')} />
1429
1470
  ```
1430
1471
 
@@ -1571,6 +1612,7 @@ import type {
1571
1612
  | `UsePasswordResetOptions` / `UsePasswordResetReturn` | Options and return type for `usePasswordReset()` |
1572
1613
  | `UseCheckoutOptions` / `CheckoutParams` | Options and params for `useCheckout()` |
1573
1614
  | `UsePayphoneConfirmOptions` / `PayphoneConfirmParams` | Options and params for `usePayphoneConfirm()` |
1615
+ | `PayphoneCheckoutProps` | Props for `PayphoneCheckout` component |
1574
1616
  | `SimpleMutationOptions<T>` | Options for hooks created via `createMutationHook` |
1575
1617
  | `MutationHookConfig<TData, TInput>` | Configuration for `createMutationHook()` |
1576
1618
 
package/dist/index.cjs CHANGED
@@ -679,10 +679,7 @@ function AziridProviderInner({
679
679
  () => resolveMessages(props.locale ?? "es", props.messages),
680
680
  [props.locale, props.messages]
681
681
  );
682
- const brandingValue = react.useMemo(
683
- () => ({ branding, messages }),
684
- [branding, messages]
685
- );
682
+ const brandingValue = react.useMemo(() => ({ branding, messages }), [branding, messages]);
686
683
  const isProxyMode = !props.apiUrl;
687
684
  const syncUrl = react.useMemo(() => {
688
685
  if (props.sessionSyncUrl === false) return null;
@@ -807,13 +804,7 @@ function AziridProviderInner({
807
804
  (data) => data.at ?? data.accessToken,
808
805
  []
809
806
  );
810
- const {
811
- loginMutation,
812
- signupMutation,
813
- logoutMutation,
814
- refreshFn,
815
- switchTenantFn
816
- } = useAuthMutations({
807
+ const { loginMutation, signupMutation, logoutMutation, refreshFn, switchTenantFn } = useAuthMutations({
817
808
  client,
818
809
  props,
819
810
  setUser,
@@ -1874,10 +1865,7 @@ function useReferral() {
1874
1865
  }
1875
1866
  return false;
1876
1867
  }, [query.data?.referralUrl]);
1877
- return react.useMemo(
1878
- () => ({ ...query, copyToClipboard }),
1879
- [query, copyToClipboard]
1880
- );
1868
+ return react.useMemo(() => ({ ...query, copyToClipboard }), [query, copyToClipboard]);
1881
1869
  }
1882
1870
  var styles = {
1883
1871
  card: {
@@ -2268,8 +2256,9 @@ function usePaymentProviders() {
2268
2256
  }
2269
2257
 
2270
2258
  // src/utils/payphone-loader.ts
2271
- var PAYPHONE_CSS_URL = "https://cdn.payphonetodoesposible.com/box/v1.1/payphone-payment-box.css";
2272
- var PAYPHONE_JS_URL = "https://cdn.payphonetodoesposible.com/box/v1.1/payphone-payment-box.js";
2259
+ var PAYPHONE_CDN = "https://cdn.payphonetodoesposible.com";
2260
+ var PAYPHONE_CSS_URL = `${PAYPHONE_CDN}/box/v1.1/payphone-payment-box.css`;
2261
+ var PAYPHONE_JS_URL = `${PAYPHONE_CDN}/box/v1.1/payphone-payment-box.js`;
2273
2262
  var loadPromise = null;
2274
2263
  function loadCss(href) {
2275
2264
  if (document.querySelector(`link[href="${href}"]`)) return;
@@ -2287,7 +2276,11 @@ function loadScript(src) {
2287
2276
  const script = document.createElement("script");
2288
2277
  script.src = src;
2289
2278
  script.onload = () => resolve();
2290
- script.onerror = () => reject(new Error(`Failed to load Payphone SDK: ${src}`));
2279
+ script.onerror = () => reject(
2280
+ new Error(
2281
+ `Failed to load Payphone SDK from ${src}. If your app uses a Content-Security-Policy, add "${PAYPHONE_CDN}" to both script-src and style-src directives.`
2282
+ )
2283
+ );
2291
2284
  document.head.appendChild(script);
2292
2285
  });
2293
2286
  }
@@ -2296,7 +2289,10 @@ function loadPayphoneSdk() {
2296
2289
  loadPromise = (async () => {
2297
2290
  loadCss(PAYPHONE_CSS_URL);
2298
2291
  await loadScript(PAYPHONE_JS_URL);
2299
- })();
2292
+ })().catch((err) => {
2293
+ loadPromise = null;
2294
+ throw err;
2295
+ });
2300
2296
  return loadPromise;
2301
2297
  }
2302
2298
  function PayphoneModal({ config, successUrl, onClose }) {
@@ -2664,16 +2660,12 @@ var intervalLabels2 = {
2664
2660
  YEARLY: "/yr",
2665
2661
  ONE_TIME: ""
2666
2662
  };
2667
- function TransferModal({
2668
- data,
2669
- onClose
2670
- }) {
2663
+ function TransferModal({ data, onClose }) {
2671
2664
  const bankDetails = data.bankDetails;
2672
2665
  return /* @__PURE__ */ jsxRuntime.jsx("div", { style: styles5.overlay, onClick: onClose, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: styles5.modal, onClick: (e) => e.stopPropagation(), children: [
2673
2666
  /* @__PURE__ */ jsxRuntime.jsx("h2", { style: styles5.modalTitle, children: "Manual Transfer" }),
2674
2667
  /* @__PURE__ */ jsxRuntime.jsxs("p", { style: styles5.modalSubtitle, children: [
2675
- "Transfer the amount below to subscribe to",
2676
- " ",
2668
+ "Transfer the amount below to subscribe to ",
2677
2669
  /* @__PURE__ */ jsxRuntime.jsx("strong", { children: data.plan?.name })
2678
2670
  ] }),
2679
2671
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -2736,9 +2728,7 @@ function PricingTable({
2736
2728
  const { data: plans, isLoading: plansLoading } = usePlans();
2737
2729
  const { data: subscription } = useSubscription();
2738
2730
  const { data: providers } = usePaymentProviders();
2739
- const [transferData, setTransferData] = react.useState(
2740
- null
2741
- );
2731
+ const [transferData, setTransferData] = react.useState(null);
2742
2732
  const [payphoneData, setPayphoneData] = react.useState(null);
2743
2733
  const [pendingPlan, setPendingPlan] = react.useState(null);
2744
2734
  const [showProviderModal, setShowProviderModal] = react.useState(false);
@@ -2758,8 +2748,7 @@ function PricingTable({
2758
2748
  checkout({ planId, provider, successUrl, cancelUrl });
2759
2749
  };
2760
2750
  const handleSelect = (plan) => {
2761
- if (subscription?.planId === plan.id && subscription.status === "ACTIVE")
2762
- return;
2751
+ if (subscription?.planId === plan.id && subscription.status === "ACTIVE") return;
2763
2752
  if (onPlanSelect) {
2764
2753
  onPlanSelect(plan);
2765
2754
  return;
@@ -2831,26 +2820,19 @@ function PricingTable({
2831
2820
  }
2832
2821
  const sortedPlans = plans ? [...plans].sort((a, b) => a.sortOrder - b.sortOrder) : [];
2833
2822
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2834
- /* @__PURE__ */ jsxRuntime.jsx(
2835
- "div",
2836
- {
2837
- className,
2838
- style: { ...styles5.grid(columns), ...style },
2839
- children: sortedPlans.map((plan) => {
2840
- const isCurrentPlan = subscription?.planId === plan.id && subscription.status === "ACTIVE";
2841
- return /* @__PURE__ */ jsxRuntime.jsx(
2842
- PricingCard,
2843
- {
2844
- plan,
2845
- isCurrentPlan,
2846
- isCheckoutPending: checkoutPending,
2847
- onSelect: handleSelect
2848
- },
2849
- plan.id
2850
- );
2851
- })
2852
- }
2853
- ),
2823
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className, style: { ...styles5.grid(columns), ...style }, children: sortedPlans.map((plan) => {
2824
+ const isCurrentPlan = subscription?.planId === plan.id && subscription.status === "ACTIVE";
2825
+ return /* @__PURE__ */ jsxRuntime.jsx(
2826
+ PricingCard,
2827
+ {
2828
+ plan,
2829
+ isCurrentPlan,
2830
+ isCheckoutPending: checkoutPending,
2831
+ onSelect: handleSelect
2832
+ },
2833
+ plan.id
2834
+ );
2835
+ }) }),
2854
2836
  showProviderModal && pendingPlan && providers && providers.length > 1 && /* @__PURE__ */ jsxRuntime.jsx(
2855
2837
  ProviderSelectModal,
2856
2838
  {
@@ -2863,13 +2845,7 @@ function PricingTable({
2863
2845
  }
2864
2846
  }
2865
2847
  ),
2866
- transferData && /* @__PURE__ */ jsxRuntime.jsx(
2867
- TransferModal,
2868
- {
2869
- data: transferData,
2870
- onClose: () => setTransferData(null)
2871
- }
2872
- ),
2848
+ transferData && /* @__PURE__ */ jsxRuntime.jsx(TransferModal, { data: transferData, onClose: () => setTransferData(null) }),
2873
2849
  payphoneData?.widgetConfig && /* @__PURE__ */ jsxRuntime.jsx(
2874
2850
  PayphoneModal,
2875
2851
  {
@@ -3018,11 +2994,7 @@ function ProviderModal({
3018
2994
  /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", style: modalStyles.cancelButton, onClick: onClose, children: labels?.cancel ?? "Cancel" })
3019
2995
  ] }) });
3020
2996
  }
3021
- function TransferModal2({
3022
- data,
3023
- onClose,
3024
- labels
3025
- }) {
2997
+ function TransferModal2({ data, onClose, labels }) {
3026
2998
  const bankDetails = data.bankDetails;
3027
2999
  const plan = data.plan;
3028
3000
  const intent = data.intent;
@@ -3133,9 +3105,12 @@ function PayButton({
3133
3105
  setTransferData(data);
3134
3106
  setShowTransferModal(true);
3135
3107
  setShowProviderModal(false);
3136
- } else if (data.provider === "PAYPHONE" && data.widgetConfig) {
3108
+ return;
3109
+ }
3110
+ if (data.provider === "PAYPHONE" && data.widgetConfig) {
3137
3111
  setPayphoneData(data);
3138
3112
  setShowProviderModal(false);
3113
+ return;
3139
3114
  }
3140
3115
  onSuccess?.(data);
3141
3116
  },
@@ -3180,7 +3155,7 @@ function PayButton({
3180
3155
  },
3181
3156
  onClick: handleClick,
3182
3157
  disabled: isDisabled,
3183
- children: isPending ? billing?.processing ?? "Processing..." : children ?? (billing?.pay ?? "Pay")
3158
+ children: isPending ? billing?.processing ?? "Processing..." : children ?? billing?.pay ?? "Pay"
3184
3159
  }
3185
3160
  ),
3186
3161
  showProviderModal && providers && providers.length > 1 && /* @__PURE__ */ jsxRuntime.jsx(
@@ -3199,6 +3174,7 @@ function PayButton({
3199
3174
  data: transferData,
3200
3175
  onClose: () => {
3201
3176
  setShowTransferModal(false);
3177
+ onSuccess?.(transferData);
3202
3178
  setTransferData(null);
3203
3179
  },
3204
3180
  labels: billing
@@ -3209,7 +3185,10 @@ function PayButton({
3209
3185
  {
3210
3186
  config: payphoneData.widgetConfig,
3211
3187
  successUrl,
3212
- onClose: () => setPayphoneData(null)
3188
+ onClose: () => {
3189
+ onSuccess?.(payphoneData);
3190
+ setPayphoneData(null);
3191
+ }
3213
3192
  }
3214
3193
  )
3215
3194
  ] });
@@ -3222,12 +3201,7 @@ function usePayphoneConfirm(options) {
3222
3201
  onError: options?.onError
3223
3202
  });
3224
3203
  }
3225
- function PayphoneCallback({
3226
- onSuccess,
3227
- onError,
3228
- className,
3229
- style
3230
- }) {
3204
+ function PayphoneCallback({ onSuccess, onError, className, style }) {
3231
3205
  const { mutate, isPending, isSuccess, isError, error, data } = usePayphoneConfirm({
3232
3206
  onSuccess,
3233
3207
  onError
@@ -3271,6 +3245,41 @@ var subtextStyle = {
3271
3245
  color: "#6b7280",
3272
3246
  margin: 0
3273
3247
  };
3248
+ function PayphoneWidgetRenderer({
3249
+ config,
3250
+ responseUrl,
3251
+ containerId,
3252
+ onReady,
3253
+ onError
3254
+ }) {
3255
+ const initialized = react.useRef(false);
3256
+ react.useEffect(() => {
3257
+ if (initialized.current) return;
3258
+ initialized.current = true;
3259
+ loadPayphoneSdk().then(() => {
3260
+ requestAnimationFrame(() => {
3261
+ if (typeof window.PPaymentButtonBox === "undefined") {
3262
+ onError?.(new Error("Payphone SDK failed to initialize"));
3263
+ return;
3264
+ }
3265
+ new window.PPaymentButtonBox({
3266
+ token: config.token,
3267
+ clientTransactionId: config.clientTransactionId,
3268
+ amount: config.amount,
3269
+ amountWithoutTax: config.amountWithoutTax,
3270
+ currency: config.currency,
3271
+ storeId: config.storeId,
3272
+ reference: config.reference,
3273
+ responseUrl
3274
+ }).render(containerId);
3275
+ onReady?.();
3276
+ });
3277
+ }).catch((err) => {
3278
+ onError?.(new Error(err instanceof Error ? err.message : "Failed to load Payphone SDK"));
3279
+ });
3280
+ }, [config, responseUrl, containerId, onReady, onError]);
3281
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { id: containerId });
3282
+ }
3274
3283
  var statusConfig = {
3275
3284
  ACTIVE: { bg: "#d1fae5", color: "#065f46", label: "Active" },
3276
3285
  TRIALING: { bg: "#dbeafe", color: "#1e40af", label: "Trial" },
@@ -3732,6 +3741,85 @@ function useTransferProofs() {
3732
3741
  queryFn: () => client.get(client.paths.transferProofs)
3733
3742
  });
3734
3743
  }
3744
+ var CONTAINER_ID = "pp-checkout-azirid";
3745
+ function usePayphoneCheckout({
3746
+ intentId,
3747
+ onSuccess,
3748
+ onError
3749
+ }) {
3750
+ const [status, setStatus] = react.useState("idle");
3751
+ const [widgetConfig, setWidgetConfig] = react.useState(null);
3752
+ const [currentError, setCurrentError] = react.useState(null);
3753
+ const checkoutTriggered = react.useRef(false);
3754
+ const confirmTriggered = react.useRef(false);
3755
+ const responseUrl = typeof window !== "undefined" ? window.location.href.split("?")[0] : "";
3756
+ const params = typeof window !== "undefined" ? new URLSearchParams(window.location.search) : new URLSearchParams();
3757
+ const callbackId = params.get("id");
3758
+ const callbackClientTxId = params.get("clientTransactionId");
3759
+ const isCallback = !!(callbackId && callbackClientTxId);
3760
+ const { checkout } = useCheckout({
3761
+ redirectOnSuccess: false,
3762
+ onSuccess: (data) => {
3763
+ if (data.provider === "PAYPHONE" && data.widgetConfig) {
3764
+ setWidgetConfig(data.widgetConfig);
3765
+ setStatus("ready");
3766
+ }
3767
+ },
3768
+ onError: (err) => {
3769
+ setCurrentError(err);
3770
+ setStatus("error");
3771
+ onError?.(err);
3772
+ }
3773
+ });
3774
+ react.useEffect(() => {
3775
+ if (isCallback || checkoutTriggered.current) return;
3776
+ checkoutTriggered.current = true;
3777
+ setStatus("loading");
3778
+ checkout({
3779
+ intentId,
3780
+ provider: "PAYPHONE",
3781
+ successUrl: responseUrl,
3782
+ cancelUrl: responseUrl
3783
+ });
3784
+ }, [checkout, intentId, responseUrl, isCallback]);
3785
+ const { mutate: confirm } = usePayphoneConfirm({
3786
+ onSuccess: (data) => {
3787
+ setStatus(data.status === "confirmed" || data.status === "already_confirmed" ? "confirmed" : "cancelled");
3788
+ onSuccess?.(data);
3789
+ },
3790
+ onError: (err) => {
3791
+ setCurrentError(err);
3792
+ setStatus("error");
3793
+ onError?.(err);
3794
+ }
3795
+ });
3796
+ react.useEffect(() => {
3797
+ if (!isCallback || confirmTriggered.current) return;
3798
+ confirmTriggered.current = true;
3799
+ setStatus("confirming");
3800
+ confirm({ id: Number(callbackId), clientTransactionId: callbackClientTxId });
3801
+ }, [isCallback, callbackId, callbackClientTxId, confirm]);
3802
+ const handleSdkError = react.useCallback(
3803
+ (err) => {
3804
+ setCurrentError(err);
3805
+ setStatus("error");
3806
+ onError?.(err);
3807
+ },
3808
+ [onError]
3809
+ );
3810
+ const PayphoneWidget = react.useMemo(() => {
3811
+ return function PayphoneWidgetInner() {
3812
+ if (!widgetConfig || isCallback) return null;
3813
+ return PayphoneWidgetRenderer({
3814
+ config: widgetConfig,
3815
+ responseUrl,
3816
+ containerId: CONTAINER_ID,
3817
+ onError: handleSdkError
3818
+ });
3819
+ };
3820
+ }, [widgetConfig, responseUrl, isCallback, handleSdkError]);
3821
+ return { PayphoneWidget, status, intentId, error: currentError };
3822
+ }
3735
3823
  function useTenants() {
3736
3824
  const client = useAccessClient();
3737
3825
  return reactQuery.useQuery({
@@ -3824,7 +3912,7 @@ function usePasswordToggle() {
3824
3912
  }
3825
3913
 
3826
3914
  // src/index.ts
3827
- var SDK_VERSION = "0.9.3";
3915
+ var SDK_VERSION = "0.9.5";
3828
3916
 
3829
3917
  exports.AuthForm = AuthForm;
3830
3918
  exports.AziridProvider = AziridProvider;
@@ -3836,6 +3924,7 @@ exports.LoginForm = LoginForm;
3836
3924
  exports.PATHS = PATHS;
3837
3925
  exports.PayButton = PayButton;
3838
3926
  exports.PayphoneCallback = PayphoneCallback;
3927
+ exports.PayphoneWidgetRenderer = PayphoneWidgetRenderer;
3839
3928
  exports.PricingTable = PricingTable;
3840
3929
  exports.ReferralCard = ReferralCard;
3841
3930
  exports.ReferralStats = ReferralStats;
@@ -3881,6 +3970,7 @@ exports.usePasskeys = usePasskeys;
3881
3970
  exports.usePasswordReset = usePasswordReset;
3882
3971
  exports.usePasswordToggle = usePasswordToggle;
3883
3972
  exports.usePaymentProviders = usePaymentProviders;
3973
+ exports.usePayphoneCheckout = usePayphoneCheckout;
3884
3974
  exports.usePayphoneConfirm = usePayphoneConfirm;
3885
3975
  exports.usePlans = usePlans;
3886
3976
  exports.useReferral = useReferral;