azirid-react 0.9.4 → 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 +49 -0
- package/dist/index.cjs +129 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +35 -2
- package/dist/index.d.ts +35 -2
- package/dist/index.js +128 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { CSSProperties, ReactNode, FormEvent } from 'react';
|
|
2
|
+
import { CSSProperties, ReactNode, FormEvent, ReactElement } from 'react';
|
|
3
3
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
4
4
|
import { UseMutationResult, UseQueryResult } from '@tanstack/react-query';
|
|
5
5
|
import { z } from 'zod';
|
|
@@ -727,6 +727,25 @@ interface PayphoneCallbackProps {
|
|
|
727
727
|
}
|
|
728
728
|
declare function PayphoneCallback({ onSuccess, onError, className, style }: PayphoneCallbackProps): react_jsx_runtime.JSX.Element;
|
|
729
729
|
|
|
730
|
+
declare global {
|
|
731
|
+
interface Window {
|
|
732
|
+
PPaymentButtonBox: new (config: Record<string, unknown>) => {
|
|
733
|
+
render: (containerId: string) => void;
|
|
734
|
+
};
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
/**
|
|
738
|
+
* Internal widget renderer — loads Payphone SDK and mounts PPaymentButtonBox.
|
|
739
|
+
* Used by usePayphoneCheckout hook. Not meant to be used directly.
|
|
740
|
+
*/
|
|
741
|
+
declare function PayphoneWidgetRenderer({ config, responseUrl, containerId, onReady, onError, }: {
|
|
742
|
+
config: PayphoneWidgetConfig;
|
|
743
|
+
responseUrl: string;
|
|
744
|
+
containerId: string;
|
|
745
|
+
onReady?: () => void;
|
|
746
|
+
onError?: (error: Error) => void;
|
|
747
|
+
}): react_jsx_runtime.JSX.Element;
|
|
748
|
+
|
|
730
749
|
interface SubscriptionBadgeProps {
|
|
731
750
|
className?: string;
|
|
732
751
|
style?: CSSProperties;
|
|
@@ -1559,6 +1578,20 @@ interface UsePayphoneConfirmOptions {
|
|
|
1559
1578
|
}
|
|
1560
1579
|
declare function usePayphoneConfirm(options?: UsePayphoneConfirmOptions): _tanstack_react_query.UseMutationResult<PayphoneConfirmResult, Error, PayphoneConfirmParams, unknown>;
|
|
1561
1580
|
|
|
1581
|
+
type PayphoneCheckoutStatus = 'idle' | 'loading' | 'ready' | 'confirming' | 'confirmed' | 'cancelled' | 'error';
|
|
1582
|
+
interface UsePayphoneCheckoutOptions {
|
|
1583
|
+
intentId: string;
|
|
1584
|
+
onSuccess?: (data: PayphoneConfirmResult) => void;
|
|
1585
|
+
onError?: (error: Error) => void;
|
|
1586
|
+
}
|
|
1587
|
+
interface UsePayphoneCheckoutReturn {
|
|
1588
|
+
PayphoneWidget: () => ReactElement | null;
|
|
1589
|
+
status: PayphoneCheckoutStatus;
|
|
1590
|
+
intentId: string;
|
|
1591
|
+
error: Error | null;
|
|
1592
|
+
}
|
|
1593
|
+
declare function usePayphoneCheckout({ intentId, onSuccess, onError, }: UsePayphoneCheckoutOptions): UsePayphoneCheckoutReturn;
|
|
1594
|
+
|
|
1562
1595
|
declare function useTenants(): _tanstack_react_query.UseQueryResult<TenantWithRole[], Error>;
|
|
1563
1596
|
declare function useTenantMembers(tenantId: string): _tanstack_react_query.UseQueryResult<TenantMemberInfo[], Error>;
|
|
1564
1597
|
declare function useSwitchTenant(): {
|
|
@@ -1895,4 +1928,4 @@ interface SessionSyncOptions {
|
|
|
1895
1928
|
|
|
1896
1929
|
declare const SDK_VERSION: string;
|
|
1897
1930
|
|
|
1898
|
-
export { type AccessClient, type AccessClientConfig, type AccessMessages, type ApiError, type AppBranding, AuthForm, type AuthFormProps, type AuthPaths, type AuthState, type AuthSuccessResponse, type AuthUser, type AuthView, type AvailableProvider, type AziridContextValue, AziridProvider, type AziridProviderProps, BASE_PATHS, type BillingInvoice, type BillingPlan, type BootstrapResponse, type ChangePasswordData, type ChangePasswordInput, CheckoutButton, type CheckoutButtonProps, type CheckoutParams, type CheckoutResponse, type CreateTenantData, type FieldError, ForgotPasswordForm, type ForgotPasswordFormProps, type ForgotPasswordInput, InvoiceList, type InvoiceListProps, type LoginData, LoginForm, type LoginFormProps, type LoginInput, type MagicLinkRequestData, type MagicLinkRequestInput, type MagicLinkVerifyData, type MagicLinkVerifyInput, type MutationHookConfig, PATHS, type PasskeyItem, type PasskeyLoginData, type PasskeyLoginStartData, type PasskeyLoginStartResponse, type PasskeyLoginVerifyData, type PasskeyRegisterStartData, type PasskeyRegisterStartInput, type PasskeyRegisterStartResponse, type PasskeyRegisterVerifyData, type PasswordResetConfirmData, type PasswordResetRequestData, PayButton, type PayButtonProps, type PaymentIntent, type PaymentProviderType, PayphoneCallback, type PayphoneCallbackProps, type PayphoneConfirmParams, type PayphoneConfirmResult, type PayphoneModalProps, type PayphoneWidgetConfig, type PricingCardProps, type PricingFeatureListProps, PricingTable, type PricingTableProps, type ProviderModalProps, ReferralCard, type ReferralCardProps, type ReferralInfo, type ReferralItem, ReferralStats, type ReferralStatsData, type ReferralStatsProps, type RegisterPasskeyData, type ResetPasswordConfirmInput, ResetPasswordForm, type ResetPasswordFormProps, SDK_VERSION, type SessionSyncOptions, type SignupData, SignupForm, type SignupFormProps, type SignupInput, type SimpleMutationOptions, type SocialLoginData, type SocialLoginInput, type SubmitTransferProofData, SubscriptionBadge, type SubscriptionBadgeProps, type SupportedLocale, type TenantMemberInfo, type TenantWithRole, type TransferModalProps, type TransferProof, type UseBootstrapOptions, type UseBootstrapReturn, type UseChangePasswordOptions, type UseChangePasswordReturn, type UseCheckoutOptions, type UseFormReturn, type UseLoginOptions, type UseLoginReturn, type UseLogoutOptions, type UseLogoutReturn, type UseMagicLinkOptions, type UseMagicLinkReturn, type UsePasskeysOptions, type UsePasskeysReturn, type UsePasswordResetOptions, type UsePasswordResetReturn, type UsePayphoneConfirmOptions, type UseRefreshOptions, type UseRefreshReturn, type UseSessionOptions, type UseSessionReturn, type UseSignupOptions, type UseSignupReturn, type UseSocialLoginOptions, type UseSocialLoginReturn, type UserSubscription, 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 };
|
|
1931
|
+
export { type AccessClient, type AccessClientConfig, type AccessMessages, type ApiError, type AppBranding, AuthForm, type AuthFormProps, type AuthPaths, type AuthState, type AuthSuccessResponse, type AuthUser, type AuthView, type AvailableProvider, type AziridContextValue, AziridProvider, type AziridProviderProps, BASE_PATHS, type BillingInvoice, type BillingPlan, type BootstrapResponse, type ChangePasswordData, type ChangePasswordInput, CheckoutButton, type CheckoutButtonProps, type CheckoutParams, type CheckoutResponse, type CreateTenantData, type FieldError, ForgotPasswordForm, type ForgotPasswordFormProps, type ForgotPasswordInput, InvoiceList, type InvoiceListProps, type LoginData, LoginForm, type LoginFormProps, type LoginInput, type MagicLinkRequestData, type MagicLinkRequestInput, type MagicLinkVerifyData, type MagicLinkVerifyInput, type MutationHookConfig, PATHS, type PasskeyItem, type PasskeyLoginData, type PasskeyLoginStartData, type PasskeyLoginStartResponse, type PasskeyLoginVerifyData, type PasskeyRegisterStartData, type PasskeyRegisterStartInput, type PasskeyRegisterStartResponse, type PasskeyRegisterVerifyData, type PasswordResetConfirmData, type PasswordResetRequestData, PayButton, type PayButtonProps, type PaymentIntent, type PaymentProviderType, PayphoneCallback, type PayphoneCallbackProps, type PayphoneCheckoutStatus, type PayphoneConfirmParams, type PayphoneConfirmResult, type PayphoneModalProps, type PayphoneWidgetConfig, PayphoneWidgetRenderer, type PricingCardProps, type PricingFeatureListProps, PricingTable, type PricingTableProps, type ProviderModalProps, ReferralCard, type ReferralCardProps, type ReferralInfo, type ReferralItem, ReferralStats, type ReferralStatsData, type ReferralStatsProps, type RegisterPasskeyData, type ResetPasswordConfirmInput, ResetPasswordForm, type ResetPasswordFormProps, SDK_VERSION, type SessionSyncOptions, type SignupData, SignupForm, type SignupFormProps, type SignupInput, type SimpleMutationOptions, type SocialLoginData, type SocialLoginInput, type SubmitTransferProofData, SubscriptionBadge, type SubscriptionBadgeProps, type SupportedLocale, type TenantMemberInfo, type TenantWithRole, type TransferModalProps, type TransferProof, type UseBootstrapOptions, type UseBootstrapReturn, type UseChangePasswordOptions, type UseChangePasswordReturn, type UseCheckoutOptions, type UseFormReturn, type UseLoginOptions, type UseLoginReturn, type UseLogoutOptions, type UseLogoutReturn, type UseMagicLinkOptions, type UseMagicLinkReturn, type UsePasskeysOptions, type UsePasskeysReturn, type UsePasswordResetOptions, type UsePasswordResetReturn, type UsePayphoneCheckoutOptions, type UsePayphoneCheckoutReturn, type UsePayphoneConfirmOptions, type UseRefreshOptions, type UseRefreshReturn, type UseSessionOptions, type UseSessionReturn, type UseSignupOptions, type UseSignupReturn, type UseSocialLoginOptions, type UseSocialLoginReturn, type UserSubscription, 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, usePayphoneCheckout, usePayphoneConfirm, usePlans, useReferral, useReferralStats, useRefresh, useSession, useSignup, useSocialLogin, useSubmitTransferProof, useSubscription, useSwitchTenant, useTenantMembers, useTenants, useTransferProofs };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { CSSProperties, ReactNode, FormEvent } from 'react';
|
|
2
|
+
import { CSSProperties, ReactNode, FormEvent, ReactElement } from 'react';
|
|
3
3
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
4
4
|
import { UseMutationResult, UseQueryResult } from '@tanstack/react-query';
|
|
5
5
|
import { z } from 'zod';
|
|
@@ -727,6 +727,25 @@ interface PayphoneCallbackProps {
|
|
|
727
727
|
}
|
|
728
728
|
declare function PayphoneCallback({ onSuccess, onError, className, style }: PayphoneCallbackProps): react_jsx_runtime.JSX.Element;
|
|
729
729
|
|
|
730
|
+
declare global {
|
|
731
|
+
interface Window {
|
|
732
|
+
PPaymentButtonBox: new (config: Record<string, unknown>) => {
|
|
733
|
+
render: (containerId: string) => void;
|
|
734
|
+
};
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
/**
|
|
738
|
+
* Internal widget renderer — loads Payphone SDK and mounts PPaymentButtonBox.
|
|
739
|
+
* Used by usePayphoneCheckout hook. Not meant to be used directly.
|
|
740
|
+
*/
|
|
741
|
+
declare function PayphoneWidgetRenderer({ config, responseUrl, containerId, onReady, onError, }: {
|
|
742
|
+
config: PayphoneWidgetConfig;
|
|
743
|
+
responseUrl: string;
|
|
744
|
+
containerId: string;
|
|
745
|
+
onReady?: () => void;
|
|
746
|
+
onError?: (error: Error) => void;
|
|
747
|
+
}): react_jsx_runtime.JSX.Element;
|
|
748
|
+
|
|
730
749
|
interface SubscriptionBadgeProps {
|
|
731
750
|
className?: string;
|
|
732
751
|
style?: CSSProperties;
|
|
@@ -1559,6 +1578,20 @@ interface UsePayphoneConfirmOptions {
|
|
|
1559
1578
|
}
|
|
1560
1579
|
declare function usePayphoneConfirm(options?: UsePayphoneConfirmOptions): _tanstack_react_query.UseMutationResult<PayphoneConfirmResult, Error, PayphoneConfirmParams, unknown>;
|
|
1561
1580
|
|
|
1581
|
+
type PayphoneCheckoutStatus = 'idle' | 'loading' | 'ready' | 'confirming' | 'confirmed' | 'cancelled' | 'error';
|
|
1582
|
+
interface UsePayphoneCheckoutOptions {
|
|
1583
|
+
intentId: string;
|
|
1584
|
+
onSuccess?: (data: PayphoneConfirmResult) => void;
|
|
1585
|
+
onError?: (error: Error) => void;
|
|
1586
|
+
}
|
|
1587
|
+
interface UsePayphoneCheckoutReturn {
|
|
1588
|
+
PayphoneWidget: () => ReactElement | null;
|
|
1589
|
+
status: PayphoneCheckoutStatus;
|
|
1590
|
+
intentId: string;
|
|
1591
|
+
error: Error | null;
|
|
1592
|
+
}
|
|
1593
|
+
declare function usePayphoneCheckout({ intentId, onSuccess, onError, }: UsePayphoneCheckoutOptions): UsePayphoneCheckoutReturn;
|
|
1594
|
+
|
|
1562
1595
|
declare function useTenants(): _tanstack_react_query.UseQueryResult<TenantWithRole[], Error>;
|
|
1563
1596
|
declare function useTenantMembers(tenantId: string): _tanstack_react_query.UseQueryResult<TenantMemberInfo[], Error>;
|
|
1564
1597
|
declare function useSwitchTenant(): {
|
|
@@ -1895,4 +1928,4 @@ interface SessionSyncOptions {
|
|
|
1895
1928
|
|
|
1896
1929
|
declare const SDK_VERSION: string;
|
|
1897
1930
|
|
|
1898
|
-
export { type AccessClient, type AccessClientConfig, type AccessMessages, type ApiError, type AppBranding, AuthForm, type AuthFormProps, type AuthPaths, type AuthState, type AuthSuccessResponse, type AuthUser, type AuthView, type AvailableProvider, type AziridContextValue, AziridProvider, type AziridProviderProps, BASE_PATHS, type BillingInvoice, type BillingPlan, type BootstrapResponse, type ChangePasswordData, type ChangePasswordInput, CheckoutButton, type CheckoutButtonProps, type CheckoutParams, type CheckoutResponse, type CreateTenantData, type FieldError, ForgotPasswordForm, type ForgotPasswordFormProps, type ForgotPasswordInput, InvoiceList, type InvoiceListProps, type LoginData, LoginForm, type LoginFormProps, type LoginInput, type MagicLinkRequestData, type MagicLinkRequestInput, type MagicLinkVerifyData, type MagicLinkVerifyInput, type MutationHookConfig, PATHS, type PasskeyItem, type PasskeyLoginData, type PasskeyLoginStartData, type PasskeyLoginStartResponse, type PasskeyLoginVerifyData, type PasskeyRegisterStartData, type PasskeyRegisterStartInput, type PasskeyRegisterStartResponse, type PasskeyRegisterVerifyData, type PasswordResetConfirmData, type PasswordResetRequestData, PayButton, type PayButtonProps, type PaymentIntent, type PaymentProviderType, PayphoneCallback, type PayphoneCallbackProps, type PayphoneConfirmParams, type PayphoneConfirmResult, type PayphoneModalProps, type PayphoneWidgetConfig, type PricingCardProps, type PricingFeatureListProps, PricingTable, type PricingTableProps, type ProviderModalProps, ReferralCard, type ReferralCardProps, type ReferralInfo, type ReferralItem, ReferralStats, type ReferralStatsData, type ReferralStatsProps, type RegisterPasskeyData, type ResetPasswordConfirmInput, ResetPasswordForm, type ResetPasswordFormProps, SDK_VERSION, type SessionSyncOptions, type SignupData, SignupForm, type SignupFormProps, type SignupInput, type SimpleMutationOptions, type SocialLoginData, type SocialLoginInput, type SubmitTransferProofData, SubscriptionBadge, type SubscriptionBadgeProps, type SupportedLocale, type TenantMemberInfo, type TenantWithRole, type TransferModalProps, type TransferProof, type UseBootstrapOptions, type UseBootstrapReturn, type UseChangePasswordOptions, type UseChangePasswordReturn, type UseCheckoutOptions, type UseFormReturn, type UseLoginOptions, type UseLoginReturn, type UseLogoutOptions, type UseLogoutReturn, type UseMagicLinkOptions, type UseMagicLinkReturn, type UsePasskeysOptions, type UsePasskeysReturn, type UsePasswordResetOptions, type UsePasswordResetReturn, type UsePayphoneConfirmOptions, type UseRefreshOptions, type UseRefreshReturn, type UseSessionOptions, type UseSessionReturn, type UseSignupOptions, type UseSignupReturn, type UseSocialLoginOptions, type UseSocialLoginReturn, type UserSubscription, 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 };
|
|
1931
|
+
export { type AccessClient, type AccessClientConfig, type AccessMessages, type ApiError, type AppBranding, AuthForm, type AuthFormProps, type AuthPaths, type AuthState, type AuthSuccessResponse, type AuthUser, type AuthView, type AvailableProvider, type AziridContextValue, AziridProvider, type AziridProviderProps, BASE_PATHS, type BillingInvoice, type BillingPlan, type BootstrapResponse, type ChangePasswordData, type ChangePasswordInput, CheckoutButton, type CheckoutButtonProps, type CheckoutParams, type CheckoutResponse, type CreateTenantData, type FieldError, ForgotPasswordForm, type ForgotPasswordFormProps, type ForgotPasswordInput, InvoiceList, type InvoiceListProps, type LoginData, LoginForm, type LoginFormProps, type LoginInput, type MagicLinkRequestData, type MagicLinkRequestInput, type MagicLinkVerifyData, type MagicLinkVerifyInput, type MutationHookConfig, PATHS, type PasskeyItem, type PasskeyLoginData, type PasskeyLoginStartData, type PasskeyLoginStartResponse, type PasskeyLoginVerifyData, type PasskeyRegisterStartData, type PasskeyRegisterStartInput, type PasskeyRegisterStartResponse, type PasskeyRegisterVerifyData, type PasswordResetConfirmData, type PasswordResetRequestData, PayButton, type PayButtonProps, type PaymentIntent, type PaymentProviderType, PayphoneCallback, type PayphoneCallbackProps, type PayphoneCheckoutStatus, type PayphoneConfirmParams, type PayphoneConfirmResult, type PayphoneModalProps, type PayphoneWidgetConfig, PayphoneWidgetRenderer, type PricingCardProps, type PricingFeatureListProps, PricingTable, type PricingTableProps, type ProviderModalProps, ReferralCard, type ReferralCardProps, type ReferralInfo, type ReferralItem, ReferralStats, type ReferralStatsData, type ReferralStatsProps, type RegisterPasskeyData, type ResetPasswordConfirmInput, ResetPasswordForm, type ResetPasswordFormProps, SDK_VERSION, type SessionSyncOptions, type SignupData, SignupForm, type SignupFormProps, type SignupInput, type SimpleMutationOptions, type SocialLoginData, type SocialLoginInput, type SubmitTransferProofData, SubscriptionBadge, type SubscriptionBadgeProps, type SupportedLocale, type TenantMemberInfo, type TenantWithRole, type TransferModalProps, type TransferProof, type UseBootstrapOptions, type UseBootstrapReturn, type UseChangePasswordOptions, type UseChangePasswordReturn, type UseCheckoutOptions, type UseFormReturn, type UseLoginOptions, type UseLoginReturn, type UseLogoutOptions, type UseLogoutReturn, type UseMagicLinkOptions, type UseMagicLinkReturn, type UsePasskeysOptions, type UsePasskeysReturn, type UsePasswordResetOptions, type UsePasswordResetReturn, type UsePayphoneCheckoutOptions, type UsePayphoneCheckoutReturn, type UsePayphoneConfirmOptions, type UseRefreshOptions, type UseRefreshReturn, type UseSessionOptions, type UseSessionReturn, type UseSignupOptions, type UseSignupReturn, type UseSocialLoginOptions, type UseSocialLoginReturn, type UserSubscription, 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, usePayphoneCheckout, usePayphoneConfirm, usePlans, useReferral, useReferralStats, useRefresh, useSession, useSignup, useSocialLogin, useSubmitTransferProof, useSubscription, useSwitchTenant, useTenantMembers, useTenants, useTransferProofs };
|
package/dist/index.js
CHANGED
|
@@ -2254,8 +2254,9 @@ function usePaymentProviders() {
|
|
|
2254
2254
|
}
|
|
2255
2255
|
|
|
2256
2256
|
// src/utils/payphone-loader.ts
|
|
2257
|
-
var
|
|
2258
|
-
var
|
|
2257
|
+
var PAYPHONE_CDN = "https://cdn.payphonetodoesposible.com";
|
|
2258
|
+
var PAYPHONE_CSS_URL = `${PAYPHONE_CDN}/box/v1.1/payphone-payment-box.css`;
|
|
2259
|
+
var PAYPHONE_JS_URL = `${PAYPHONE_CDN}/box/v1.1/payphone-payment-box.js`;
|
|
2259
2260
|
var loadPromise = null;
|
|
2260
2261
|
function loadCss(href) {
|
|
2261
2262
|
if (document.querySelector(`link[href="${href}"]`)) return;
|
|
@@ -2273,7 +2274,11 @@ function loadScript(src) {
|
|
|
2273
2274
|
const script = document.createElement("script");
|
|
2274
2275
|
script.src = src;
|
|
2275
2276
|
script.onload = () => resolve();
|
|
2276
|
-
script.onerror = () => reject(
|
|
2277
|
+
script.onerror = () => reject(
|
|
2278
|
+
new Error(
|
|
2279
|
+
`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.`
|
|
2280
|
+
)
|
|
2281
|
+
);
|
|
2277
2282
|
document.head.appendChild(script);
|
|
2278
2283
|
});
|
|
2279
2284
|
}
|
|
@@ -2282,7 +2287,10 @@ function loadPayphoneSdk() {
|
|
|
2282
2287
|
loadPromise = (async () => {
|
|
2283
2288
|
loadCss(PAYPHONE_CSS_URL);
|
|
2284
2289
|
await loadScript(PAYPHONE_JS_URL);
|
|
2285
|
-
})()
|
|
2290
|
+
})().catch((err) => {
|
|
2291
|
+
loadPromise = null;
|
|
2292
|
+
throw err;
|
|
2293
|
+
});
|
|
2286
2294
|
return loadPromise;
|
|
2287
2295
|
}
|
|
2288
2296
|
function PayphoneModal({ config, successUrl, onClose }) {
|
|
@@ -3235,6 +3243,41 @@ var subtextStyle = {
|
|
|
3235
3243
|
color: "#6b7280",
|
|
3236
3244
|
margin: 0
|
|
3237
3245
|
};
|
|
3246
|
+
function PayphoneWidgetRenderer({
|
|
3247
|
+
config,
|
|
3248
|
+
responseUrl,
|
|
3249
|
+
containerId,
|
|
3250
|
+
onReady,
|
|
3251
|
+
onError
|
|
3252
|
+
}) {
|
|
3253
|
+
const initialized = useRef(false);
|
|
3254
|
+
useEffect(() => {
|
|
3255
|
+
if (initialized.current) return;
|
|
3256
|
+
initialized.current = true;
|
|
3257
|
+
loadPayphoneSdk().then(() => {
|
|
3258
|
+
requestAnimationFrame(() => {
|
|
3259
|
+
if (typeof window.PPaymentButtonBox === "undefined") {
|
|
3260
|
+
onError?.(new Error("Payphone SDK failed to initialize"));
|
|
3261
|
+
return;
|
|
3262
|
+
}
|
|
3263
|
+
new window.PPaymentButtonBox({
|
|
3264
|
+
token: config.token,
|
|
3265
|
+
clientTransactionId: config.clientTransactionId,
|
|
3266
|
+
amount: config.amount,
|
|
3267
|
+
amountWithoutTax: config.amountWithoutTax,
|
|
3268
|
+
currency: config.currency,
|
|
3269
|
+
storeId: config.storeId,
|
|
3270
|
+
reference: config.reference,
|
|
3271
|
+
responseUrl
|
|
3272
|
+
}).render(containerId);
|
|
3273
|
+
onReady?.();
|
|
3274
|
+
});
|
|
3275
|
+
}).catch((err) => {
|
|
3276
|
+
onError?.(new Error(err instanceof Error ? err.message : "Failed to load Payphone SDK"));
|
|
3277
|
+
});
|
|
3278
|
+
}, [config, responseUrl, containerId, onReady, onError]);
|
|
3279
|
+
return /* @__PURE__ */ jsx("div", { id: containerId });
|
|
3280
|
+
}
|
|
3238
3281
|
var statusConfig = {
|
|
3239
3282
|
ACTIVE: { bg: "#d1fae5", color: "#065f46", label: "Active" },
|
|
3240
3283
|
TRIALING: { bg: "#dbeafe", color: "#1e40af", label: "Trial" },
|
|
@@ -3696,6 +3739,85 @@ function useTransferProofs() {
|
|
|
3696
3739
|
queryFn: () => client.get(client.paths.transferProofs)
|
|
3697
3740
|
});
|
|
3698
3741
|
}
|
|
3742
|
+
var CONTAINER_ID = "pp-checkout-azirid";
|
|
3743
|
+
function usePayphoneCheckout({
|
|
3744
|
+
intentId,
|
|
3745
|
+
onSuccess,
|
|
3746
|
+
onError
|
|
3747
|
+
}) {
|
|
3748
|
+
const [status, setStatus] = useState("idle");
|
|
3749
|
+
const [widgetConfig, setWidgetConfig] = useState(null);
|
|
3750
|
+
const [currentError, setCurrentError] = useState(null);
|
|
3751
|
+
const checkoutTriggered = useRef(false);
|
|
3752
|
+
const confirmTriggered = useRef(false);
|
|
3753
|
+
const responseUrl = typeof window !== "undefined" ? window.location.href.split("?")[0] : "";
|
|
3754
|
+
const params = typeof window !== "undefined" ? new URLSearchParams(window.location.search) : new URLSearchParams();
|
|
3755
|
+
const callbackId = params.get("id");
|
|
3756
|
+
const callbackClientTxId = params.get("clientTransactionId");
|
|
3757
|
+
const isCallback = !!(callbackId && callbackClientTxId);
|
|
3758
|
+
const { checkout } = useCheckout({
|
|
3759
|
+
redirectOnSuccess: false,
|
|
3760
|
+
onSuccess: (data) => {
|
|
3761
|
+
if (data.provider === "PAYPHONE" && data.widgetConfig) {
|
|
3762
|
+
setWidgetConfig(data.widgetConfig);
|
|
3763
|
+
setStatus("ready");
|
|
3764
|
+
}
|
|
3765
|
+
},
|
|
3766
|
+
onError: (err) => {
|
|
3767
|
+
setCurrentError(err);
|
|
3768
|
+
setStatus("error");
|
|
3769
|
+
onError?.(err);
|
|
3770
|
+
}
|
|
3771
|
+
});
|
|
3772
|
+
useEffect(() => {
|
|
3773
|
+
if (isCallback || checkoutTriggered.current) return;
|
|
3774
|
+
checkoutTriggered.current = true;
|
|
3775
|
+
setStatus("loading");
|
|
3776
|
+
checkout({
|
|
3777
|
+
intentId,
|
|
3778
|
+
provider: "PAYPHONE",
|
|
3779
|
+
successUrl: responseUrl,
|
|
3780
|
+
cancelUrl: responseUrl
|
|
3781
|
+
});
|
|
3782
|
+
}, [checkout, intentId, responseUrl, isCallback]);
|
|
3783
|
+
const { mutate: confirm } = usePayphoneConfirm({
|
|
3784
|
+
onSuccess: (data) => {
|
|
3785
|
+
setStatus(data.status === "confirmed" || data.status === "already_confirmed" ? "confirmed" : "cancelled");
|
|
3786
|
+
onSuccess?.(data);
|
|
3787
|
+
},
|
|
3788
|
+
onError: (err) => {
|
|
3789
|
+
setCurrentError(err);
|
|
3790
|
+
setStatus("error");
|
|
3791
|
+
onError?.(err);
|
|
3792
|
+
}
|
|
3793
|
+
});
|
|
3794
|
+
useEffect(() => {
|
|
3795
|
+
if (!isCallback || confirmTriggered.current) return;
|
|
3796
|
+
confirmTriggered.current = true;
|
|
3797
|
+
setStatus("confirming");
|
|
3798
|
+
confirm({ id: Number(callbackId), clientTransactionId: callbackClientTxId });
|
|
3799
|
+
}, [isCallback, callbackId, callbackClientTxId, confirm]);
|
|
3800
|
+
const handleSdkError = useCallback(
|
|
3801
|
+
(err) => {
|
|
3802
|
+
setCurrentError(err);
|
|
3803
|
+
setStatus("error");
|
|
3804
|
+
onError?.(err);
|
|
3805
|
+
},
|
|
3806
|
+
[onError]
|
|
3807
|
+
);
|
|
3808
|
+
const PayphoneWidget = useMemo(() => {
|
|
3809
|
+
return function PayphoneWidgetInner() {
|
|
3810
|
+
if (!widgetConfig || isCallback) return null;
|
|
3811
|
+
return PayphoneWidgetRenderer({
|
|
3812
|
+
config: widgetConfig,
|
|
3813
|
+
responseUrl,
|
|
3814
|
+
containerId: CONTAINER_ID,
|
|
3815
|
+
onError: handleSdkError
|
|
3816
|
+
});
|
|
3817
|
+
};
|
|
3818
|
+
}, [widgetConfig, responseUrl, isCallback, handleSdkError]);
|
|
3819
|
+
return { PayphoneWidget, status, intentId, error: currentError };
|
|
3820
|
+
}
|
|
3699
3821
|
function useTenants() {
|
|
3700
3822
|
const client = useAccessClient();
|
|
3701
3823
|
return useQuery({
|
|
@@ -3788,8 +3910,8 @@ function usePasswordToggle() {
|
|
|
3788
3910
|
}
|
|
3789
3911
|
|
|
3790
3912
|
// src/index.ts
|
|
3791
|
-
var SDK_VERSION = "0.9.
|
|
3913
|
+
var SDK_VERSION = "0.9.5";
|
|
3792
3914
|
|
|
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 };
|
|
3915
|
+
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, usePaymentProviders, usePayphoneCheckout, usePayphoneConfirm, usePlans, useReferral, useReferralStats, useRefresh, useSession, useSignup, useSocialLogin, useSubmitTransferProof, useSubscription, useSwitchTenant, useTenantMembers, useTenants, useTransferProofs };
|
|
3794
3916
|
//# sourceMappingURL=index.js.map
|
|
3795
3917
|
//# sourceMappingURL=index.js.map
|