@payos-inc/payos-react 1.2.0-staging.89 → 1.2.0-staging.92

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.
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { UseLinkSessionReturn } from '../../hooks/useLinkSession';
3
3
  import type { UsePasskeySDKReturn } from '../../hooks/usePasskeySDK';
4
- import type { RegistrationSubPhase, SessionPhase } from '../../hooks/useSession';
4
+ import type { RegistrationSubPhase, SessionCardActivity, SessionPhase } from '../../hooks/useSession';
5
5
  import type { PaymentView } from '../../types/payment';
6
6
  import type { BillingAddress, CardData } from '../../types';
7
7
  import type { CheckoutSession, Payment } from '../../types/session';
@@ -10,6 +10,7 @@ import type { CountryCode } from './phone-input';
10
10
  interface PaymentSheetContentProps {
11
11
  phase: SessionPhase;
12
12
  session: CheckoutSession | null;
13
+ cardActivity?: SessionCardActivity;
13
14
  linkSession: UseLinkSessionReturn;
14
15
  linkCheckoutPayment: Payment | null;
15
16
  approvalDeadline: number | null;
@@ -77,5 +78,5 @@ interface PaymentSheetContentProps {
77
78
  skipShareCards: (nextView?: PaymentView) => void;
78
79
  reopenShareCards: () => void;
79
80
  }
80
- export declare function PaymentSheetContent({ phase, session, linkSession, linkCheckoutPayment, approvalDeadline, errorMessage, displayError, onClose, onVerifyAgain, skipToAuth, isSetupMode, isAgentMode, skipCredentialGeneration, loading, phoneNumber, setPhoneNumber, selectedCountry, setSelectedCountry, otp, setOTP, isResending, resendCooldown, retryCount, clearLocalError, clearSessionError, onPhoneSubmit, onOTPSubmit, onOTPResend, registrationSubPhase, passkey, localError, visaOtp, setVisaOtp, setLocalError, setRegistrationSubPhase, onCreatePasskey, onSkipRegistration, onVisaMethodSelect, onVisaOtpVerify, onVisaIframeCancel, onBackToCheckout, hasSelectedCard, hasSavedCards, paymentView, cvc, setCvc, passkeyClosed, isLinkCheckoutAvailable, showShippingAsBilling, cardElementUrl, cardElementApiUrl, environment, theme, cardElementStyles, binsWarning, onBinWarning, setDefaultCard, showAddCard, deletePaymentCard, completeSetup, setPaymentView, handleCardAdd, handleCardSelect, handlePaymentSubmit, showMethodList, shareCards, skipShareCards, reopenShareCards, }: PaymentSheetContentProps): import("react/jsx-runtime").JSX.Element | null;
81
+ export declare function PaymentSheetContent({ phase, session, cardActivity, linkSession, linkCheckoutPayment, approvalDeadline, errorMessage, displayError, onClose, onVerifyAgain, skipToAuth, isSetupMode, isAgentMode, skipCredentialGeneration, loading, phoneNumber, setPhoneNumber, selectedCountry, setSelectedCountry, otp, setOTP, isResending, resendCooldown, retryCount, clearLocalError, clearSessionError, onPhoneSubmit, onOTPSubmit, onOTPResend, registrationSubPhase, passkey, localError, visaOtp, setVisaOtp, setLocalError, setRegistrationSubPhase, onCreatePasskey, onSkipRegistration, onVisaMethodSelect, onVisaOtpVerify, onVisaIframeCancel, onBackToCheckout, hasSelectedCard, hasSavedCards, paymentView, cvc, setCvc, passkeyClosed, isLinkCheckoutAvailable, showShippingAsBilling, cardElementUrl, cardElementApiUrl, environment, theme, cardElementStyles, binsWarning, onBinWarning, setDefaultCard, showAddCard, deletePaymentCard, completeSetup, setPaymentView, handleCardAdd, handleCardSelect, handlePaymentSubmit, showMethodList, shareCards, skipShareCards, reopenShareCards, }: PaymentSheetContentProps): import("react/jsx-runtime").JSX.Element | null;
81
82
  export {};
@@ -41,5 +41,5 @@ interface PaymentSheetPaymentFlowProps {
41
41
  skipShareCards: (nextView?: PaymentView) => void;
42
42
  reopenShareCards: () => void;
43
43
  }
44
- export declare function PaymentSheetPaymentFlow({ session, isSetupMode, isAgentMode, hasSelectedCard, hasSavedCards, paymentView, loading, passkeyLoading, skipToAuth, passkeyClosed, cvc, setCvc, displayError, linkSession, isLinkCheckoutAvailable, showShippingAsBilling, cardElementUrl, cardElementApiUrl, environment, theme, cardElementStyles, binsWarning, onBinWarning, clearError, setDefaultCard, showAddCard, deletePaymentCard, completeSetup, setPaymentView, handleCardAdd, handleCardSelect, handlePaymentSubmit, showMethodList, shareCards, skipShareCards, reopenShareCards, }: PaymentSheetPaymentFlowProps): import("react/jsx-runtime").JSX.Element | null;
44
+ export declare function PaymentSheetPaymentFlow({ session, isSetupMode, isAgentMode, hasSelectedCard, hasSavedCards, paymentView, loading, passkeyLoading, skipToAuth, passkeyClosed, cvc, setCvc, displayError, linkSession, isLinkCheckoutAvailable, showShippingAsBilling, cardElementUrl, cardElementApiUrl, environment, theme, cardElementStyles, binsWarning, onBinWarning, clearError, setDefaultCard, showAddCard, deletePaymentCard, completeSetup, handleCardAdd, handleCardSelect, handlePaymentSubmit, showMethodList, shareCards, skipShareCards, reopenShareCards, }: PaymentSheetPaymentFlowProps): import("react/jsx-runtime").JSX.Element | null;
45
45
  export {};
@@ -1,4 +1,5 @@
1
1
  import type { CheckoutSession, SavedCard } from '../../types/session';
2
+ import type { SessionCardActivity } from '../../hooks/useSession';
2
3
  export declare function PaymentSheetLoadingView({ skipToAuth }: {
3
4
  skipToAuth: boolean;
4
5
  }): import("react/jsx-runtime").JSX.Element;
@@ -20,8 +21,9 @@ export declare function PaymentSheetProcessingView({ skipToAuth, isSetupMode, is
20
21
  isAgentMode: boolean;
21
22
  skipCredentialGeneration: boolean;
22
23
  }): import("react/jsx-runtime").JSX.Element;
23
- export declare function PaymentSheetSuccessView({ session, isSetupMode, isAgentMode, }: {
24
+ export declare function PaymentSheetSuccessView({ session, isSetupMode, isAgentMode, cardActivity, }: {
24
25
  session: CheckoutSession;
25
26
  isSetupMode: boolean;
26
27
  isAgentMode: boolean;
28
+ cardActivity?: SessionCardActivity;
27
29
  }): import("react/jsx-runtime").JSX.Element;
@@ -3,6 +3,8 @@ interface ViewHeaderProps {
3
3
  title: string;
4
4
  onBack?: () => void;
5
5
  action?: React.ReactNode;
6
+ /** Extra classes for the header row (e.g. to match a centered content column) */
7
+ className?: string;
6
8
  }
7
9
  export declare const ViewHeader: React.FC<ViewHeaderProps>;
8
10
  export {};
@@ -74,6 +74,11 @@ export interface DrawerProps {
74
74
  * Disable the bottom content mask/fade (e.g. when inner view has its own footer)
75
75
  */
76
76
  disableContentMask?: boolean;
77
+ /**
78
+ * Lay the content area out as a flex column so a view can size itself to
79
+ * the drawer and keep its own footer visible while a list scrolls.
80
+ */
81
+ fillContent?: boolean;
77
82
  /**
78
83
  * Custom children (for non-smart flows) - backward compatible
79
84
  */
@@ -4,13 +4,16 @@ import type { WalletCard } from "../../../types/session";
4
4
  * ShareCardsView - consent step
5
5
  *
6
6
  * A person with an existing PayOS wallet chooses which of their saved cards
7
- * this merchant may use. Nothing is pre-selected; the merchant only sees the
8
- * cards the person picks.
7
+ * this organization may use. Nothing is pre-selected; the organization only
8
+ * sees the cards the person picks. The card list scrolls on its own so the
9
+ * Share / Not now actions stay visible.
9
10
  */
10
11
  interface ShareCardsViewProps {
11
- /** The person's saved cards not yet shared with this merchant */
12
+ /** The person's saved cards not yet shared with this organization */
12
13
  cards: WalletCard[];
13
- /** Shown in the prompt; falls back to "this merchant" */
14
+ /** Display name of the organization; falls back to "this business" */
15
+ organizationName?: string;
16
+ /** @deprecated Use organizationName */
14
17
  merchantName?: string;
15
18
  isLoading?: boolean;
16
19
  error?: string;
@@ -20,5 +23,6 @@ interface ShareCardsViewProps {
20
23
  onSkip: () => void;
21
24
  onAddNewCard: () => void;
22
25
  }
26
+ export declare function walletCardLabel(card: Pick<WalletCard, "brand" | "last4">): string;
23
27
  export declare const ShareCardsView: React.FC<ShareCardsViewProps>;
24
28
  export {};
@@ -0,0 +1,22 @@
1
+ import * as React from "react";
2
+ import type { CardBrand } from "../../types/payment";
3
+ /** ISO/IEC 7810 ID-1 card ratio (85.60mm x 53.98mm) */
4
+ export declare const CARD_ASPECT_RATIO = 1.586;
5
+ export declare function toCardBrand(brand?: string | null): CardBrand;
6
+ export declare function artFitForSize(naturalWidth: number, naturalHeight: number): "cover" | "contain";
7
+ interface CardArtProps {
8
+ /** Card brand; picks the network logo shown when there is no usable art */
9
+ brand?: string | null;
10
+ cardArtUrl?: string | null;
11
+ /** Width utility for the box; height follows the card ratio */
12
+ className?: string;
13
+ /** True when a text label (e.g. "Visa •••• 4242") sits next to the art */
14
+ decorative?: boolean;
15
+ }
16
+ /**
17
+ * Card artwork in a fixed card-ratio box. Card-shaped art fills the box;
18
+ * portrait or odd-ratio art is shown whole on a white background. Falls back
19
+ * to the network logo when there is no art or it fails to load.
20
+ */
21
+ export declare const CardArt: React.FC<CardArtProps>;
22
+ export {};
@@ -0,0 +1,17 @@
1
+ import * as React from "react";
2
+ interface HelpPopoverProps {
3
+ /** Accessible name for the trigger button */
4
+ label: string;
5
+ children: React.ReactNode;
6
+ className?: string;
7
+ }
8
+ /**
9
+ * Small "?" button that toggles an explanation panel. Opens on click, tap,
10
+ * Enter or Space; closes on Escape (focus returns to the button), a press
11
+ * outside, or tabbing away. The panel stays in the DOM (hidden) so
12
+ * aria-controls always resolves. Renders inline (button + span), so it can
13
+ * sit at the end of a heading's text; the panel spans the nearest positioned
14
+ * ancestor, so wrap the heading in a `relative` element.
15
+ */
16
+ export declare const HelpPopover: React.FC<HelpPopoverProps>;
17
+ export {};
@@ -70,6 +70,8 @@ export interface UseSessionReturn {
70
70
  skipShareCards: (nextView?: PaymentView) => void;
71
71
  /** Show the share step again (e.g. back from adding a card) */
72
72
  reopenShareCards: () => void;
73
+ /** Cards added and shared during this session (drives the setup success copy) */
74
+ cardActivity: SessionCardActivity;
73
75
  complete: (options?: {
74
76
  passkeyAuthenticated?: boolean;
75
77
  }) => Promise<CompletionResult>;
@@ -77,6 +79,10 @@ export interface UseSessionReturn {
77
79
  clearError: () => void;
78
80
  refresh: () => Promise<void>;
79
81
  }
82
+ export interface SessionCardActivity {
83
+ added: number;
84
+ shared: number;
85
+ }
80
86
  export interface UseSessionOptions {
81
87
  /** API base URL for credential generation and other API calls */
82
88
  apiBaseUrl: string;
@@ -302,6 +302,8 @@ export interface GetCurrentSessionResponse {
302
302
  paymentIntent: PaymentIntentResponse | null;
303
303
  sessionType?: string;
304
304
  validCardBrandAcceptance?: string[] | null;
305
+ /** Display name of the organization that created the session */
306
+ organizationName?: string | null;
305
307
  /** True when the wallet user's identity was pre-verified via token (skip OTP) */
306
308
  identityPreVerified?: boolean;
307
309
  /** Wallet user ID embedded in token metadata (pre-verified wallet consumer flow) */
@@ -119,6 +119,8 @@ export interface CheckoutSession {
119
119
  paymentIntent?: MultiPaymentIntent;
120
120
  walletUser?: WalletUser;
121
121
  organizationId: string;
122
+ /** Display name of the organization the person is paying or saving cards with */
123
+ organizationName?: string;
122
124
  deviceVerified: boolean;
123
125
  verificationMethod?: 'email' | 'phone';
124
126
  verificationReference?: string;
@@ -0,0 +1,10 @@
1
+ import type { CheckoutSession } from '../types/session';
2
+ /**
3
+ * Make sure the payment intent has a card before agent-mode authentication.
4
+ *
5
+ * The default card is auto-selected for display only (see selectCard.ts), so
6
+ * a returning person who taps Authorize without picking a card leaves the
7
+ * intent with no selectedCardId, and passkey authentication rejects it.
8
+ * Attach the displayed card in that case. Returns false when attaching failed.
9
+ */
10
+ export declare function ensureSelectedCardAttached(session: Pick<CheckoutSession, 'selectedCard' | 'paymentIntent'>, attachCard: (cardId: string) => Promise<boolean>): Promise<boolean>;
@@ -0,0 +1,8 @@
1
+ import type { CheckoutSession } from '../types/session';
2
+ /**
3
+ * The name shown to the person for the organization they are dealing with.
4
+ * Prefers the organization's own display name, then the payment's merchant
5
+ * name. Never uses the sheet title: hosts pass step titles there, and this
6
+ * name is recorded in consent text.
7
+ */
8
+ export declare function organizationDisplayName(session?: CheckoutSession | null): string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payos-inc/payos-react",
3
- "version": "1.2.0-staging.89",
3
+ "version": "1.2.0-staging.92",
4
4
  "description": "PayOS React SDK - Drawer checkout component for React",
5
5
  "main": "dist/payos-react.cjs",
6
6
  "module": "dist/payos-react.mjs",