@payos-inc/payos-react 1.0.3-staging.6
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/components/identity/IdentityBar.d.ts +8 -0
- package/dist/components/identity/IdentityBar.d.ts.map +1 -0
- package/dist/components/order/OrderSummaryAccordion.d.ts +9 -0
- package/dist/components/order/OrderSummaryAccordion.d.ts.map +1 -0
- package/dist/components/order/ShipmentCard.d.ts +8 -0
- package/dist/components/order/ShipmentCard.d.ts.map +1 -0
- package/dist/components/payos/ActiveCardWidget.d.ts +55 -0
- package/dist/components/payos/ActiveCardWidget.d.ts.map +1 -0
- package/dist/components/payos/PayOSFooter.d.ts +24 -0
- package/dist/components/payos/PayOSFooter.d.ts.map +1 -0
- package/dist/components/payos/PaymentMethodRow.d.ts +53 -0
- package/dist/components/payos/PaymentMethodRow.d.ts.map +1 -0
- package/dist/components/payos/PaymentSheet.d.ts +32 -0
- package/dist/components/payos/PaymentSheet.d.ts.map +1 -0
- package/dist/components/payos/PriceTag.d.ts +64 -0
- package/dist/components/payos/PriceTag.d.ts.map +1 -0
- package/dist/components/payos/ReceiptPanel.d.ts +67 -0
- package/dist/components/payos/ReceiptPanel.d.ts.map +1 -0
- package/dist/components/payos/ViewHeader.d.ts +40 -0
- package/dist/components/payos/ViewHeader.d.ts.map +1 -0
- package/dist/components/payos/drawer.d.ts +98 -0
- package/dist/components/payos/drawer.d.ts.map +1 -0
- package/dist/components/payos/order-summary.d.ts +44 -0
- package/dist/components/payos/order-summary.d.ts.map +1 -0
- package/dist/components/payos/otp-input.d.ts +37 -0
- package/dist/components/payos/otp-input.d.ts.map +1 -0
- package/dist/components/payos/phone-input.d.ts +107 -0
- package/dist/components/payos/phone-input.d.ts.map +1 -0
- package/dist/components/payos/views/AgentRegistrationView.d.ts +58 -0
- package/dist/components/payos/views/AgentRegistrationView.d.ts.map +1 -0
- package/dist/components/payos/views/CardAddView.d.ts +78 -0
- package/dist/components/payos/views/CardAddView.d.ts.map +1 -0
- package/dist/components/payos/views/CheckoutView.d.ts +80 -0
- package/dist/components/payos/views/CheckoutView.d.ts.map +1 -0
- package/dist/components/payos/views/IdentityView.d.ts +43 -0
- package/dist/components/payos/views/IdentityView.d.ts.map +1 -0
- package/dist/components/payos/views/MethodListView.d.ts +52 -0
- package/dist/components/payos/views/MethodListView.d.ts.map +1 -0
- package/dist/components/payos/views/OTPView.d.ts +54 -0
- package/dist/components/payos/views/OTPView.d.ts.map +1 -0
- package/dist/components/payos/views/SuccessView.d.ts +49 -0
- package/dist/components/payos/views/SuccessView.d.ts.map +1 -0
- package/dist/components/payos/views/VisaIframeView.d.ts +19 -0
- package/dist/components/payos/views/VisaIframeView.d.ts.map +1 -0
- package/dist/components/payos/views/VisaMethodView.d.ts +35 -0
- package/dist/components/payos/views/VisaMethodView.d.ts.map +1 -0
- package/dist/components/payos/views/VisaOtpView.d.ts +45 -0
- package/dist/components/payos/views/VisaOtpView.d.ts.map +1 -0
- package/dist/components/payos/views/WelcomeBackView.d.ts +34 -0
- package/dist/components/payos/views/WelcomeBackView.d.ts.map +1 -0
- package/dist/components/ui/CardBrandIcon.d.ts +10 -0
- package/dist/components/ui/CardBrandIcon.d.ts.map +1 -0
- package/dist/components/ui/ConfirmDialog.d.ts +25 -0
- package/dist/components/ui/ConfirmDialog.d.ts.map +1 -0
- package/dist/components/ui/InfoTooltip.d.ts +8 -0
- package/dist/components/ui/InfoTooltip.d.ts.map +1 -0
- package/dist/components/ui/PinInput.d.ts +12 -0
- package/dist/components/ui/PinInput.d.ts.map +1 -0
- package/dist/components/ui/button.d.ts +14 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/card.d.ts +15 -0
- package/dist/components/ui/card.d.ts.map +1 -0
- package/dist/components/ui/input.d.ts +6 -0
- package/dist/components/ui/input.d.ts.map +1 -0
- package/dist/components/ui/label.d.ts +6 -0
- package/dist/components/ui/label.d.ts.map +1 -0
- package/dist/components/ui/separator.d.ts +5 -0
- package/dist/components/ui/separator.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +8 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/useBodyScrollLock.d.ts +32 -0
- package/dist/hooks/useBodyScrollLock.d.ts.map +1 -0
- package/dist/hooks/useCardElement.d.ts +123 -0
- package/dist/hooks/useCardElement.d.ts.map +1 -0
- package/dist/hooks/useCheckoutFlow.d.ts +29 -0
- package/dist/hooks/useCheckoutFlow.d.ts.map +1 -0
- package/dist/hooks/useDrawerState.d.ts +4 -0
- package/dist/hooks/useDrawerState.d.ts.map +1 -0
- package/dist/hooks/usePasskeySDK.d.ts +99 -0
- package/dist/hooks/usePasskeySDK.d.ts.map +1 -0
- package/dist/hooks/useSession.d.ts +68 -0
- package/dist/hooks/useSession.d.ts.map +1 -0
- package/dist/hooks/useVisualViewport.d.ts +15 -0
- package/dist/hooks/useVisualViewport.d.ts.map +1 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +43 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/lib/theme.d.ts +53 -0
- package/dist/lib/theme.d.ts.map +1 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/mocks/index.d.ts +3 -0
- package/dist/mocks/index.d.ts.map +1 -0
- package/dist/mocks/mockCheckoutFlow.d.ts +25 -0
- package/dist/mocks/mockCheckoutFlow.d.ts.map +1 -0
- package/dist/mocks/mockData.d.ts +6 -0
- package/dist/mocks/mockData.d.ts.map +1 -0
- package/dist/mocks/mockSessionData.d.ts +38 -0
- package/dist/mocks/mockSessionData.d.ts.map +1 -0
- package/dist/payos-react.css +1 -0
- package/dist/payos-react.esm.js +23 -0
- package/dist/payos-react.min.js +1 -0
- package/dist/services/apiService.d.ts +297 -0
- package/dist/services/apiService.d.ts.map +1 -0
- package/dist/services/linkTokenService.d.ts +27 -0
- package/dist/services/linkTokenService.d.ts.map +1 -0
- package/dist/services/mockSessionService.d.ts +78 -0
- package/dist/services/mockSessionService.d.ts.map +1 -0
- package/dist/types/cardElement.d.ts +138 -0
- package/dist/types/cardElement.d.ts.map +1 -0
- package/dist/types/components/identity/IdentityBar.d.ts +8 -0
- package/dist/types/components/identity/IdentityBar.d.ts.map +1 -0
- package/dist/types/components/order/OrderSummaryAccordion.d.ts +9 -0
- package/dist/types/components/order/OrderSummaryAccordion.d.ts.map +1 -0
- package/dist/types/components/order/ShipmentCard.d.ts +8 -0
- package/dist/types/components/order/ShipmentCard.d.ts.map +1 -0
- package/dist/types/components/payos/ActiveCardWidget.d.ts +55 -0
- package/dist/types/components/payos/ActiveCardWidget.d.ts.map +1 -0
- package/dist/types/components/payos/PayOSFooter.d.ts +24 -0
- package/dist/types/components/payos/PayOSFooter.d.ts.map +1 -0
- package/dist/types/components/payos/PaymentMethodRow.d.ts +53 -0
- package/dist/types/components/payos/PaymentMethodRow.d.ts.map +1 -0
- package/dist/types/components/payos/PaymentSheet.d.ts +32 -0
- package/dist/types/components/payos/PaymentSheet.d.ts.map +1 -0
- package/dist/types/components/payos/PriceTag.d.ts +64 -0
- package/dist/types/components/payos/PriceTag.d.ts.map +1 -0
- package/dist/types/components/payos/ReceiptPanel.d.ts +67 -0
- package/dist/types/components/payos/ReceiptPanel.d.ts.map +1 -0
- package/dist/types/components/payos/ViewHeader.d.ts +40 -0
- package/dist/types/components/payos/ViewHeader.d.ts.map +1 -0
- package/dist/types/components/payos/drawer.d.ts +98 -0
- package/dist/types/components/payos/drawer.d.ts.map +1 -0
- package/dist/types/components/payos/order-summary.d.ts +44 -0
- package/dist/types/components/payos/order-summary.d.ts.map +1 -0
- package/dist/types/components/payos/otp-input.d.ts +37 -0
- package/dist/types/components/payos/otp-input.d.ts.map +1 -0
- package/dist/types/components/payos/phone-input.d.ts +107 -0
- package/dist/types/components/payos/phone-input.d.ts.map +1 -0
- package/dist/types/components/payos/views/AgentRegistrationView.d.ts +58 -0
- package/dist/types/components/payos/views/AgentRegistrationView.d.ts.map +1 -0
- package/dist/types/components/payos/views/CardAddView.d.ts +78 -0
- package/dist/types/components/payos/views/CardAddView.d.ts.map +1 -0
- package/dist/types/components/payos/views/CheckoutView.d.ts +80 -0
- package/dist/types/components/payos/views/CheckoutView.d.ts.map +1 -0
- package/dist/types/components/payos/views/IdentityView.d.ts +43 -0
- package/dist/types/components/payos/views/IdentityView.d.ts.map +1 -0
- package/dist/types/components/payos/views/MethodListView.d.ts +52 -0
- package/dist/types/components/payos/views/MethodListView.d.ts.map +1 -0
- package/dist/types/components/payos/views/OTPView.d.ts +54 -0
- package/dist/types/components/payos/views/OTPView.d.ts.map +1 -0
- package/dist/types/components/payos/views/SuccessView.d.ts +49 -0
- package/dist/types/components/payos/views/SuccessView.d.ts.map +1 -0
- package/dist/types/components/payos/views/VisaIframeView.d.ts +19 -0
- package/dist/types/components/payos/views/VisaIframeView.d.ts.map +1 -0
- package/dist/types/components/payos/views/VisaMethodView.d.ts +35 -0
- package/dist/types/components/payos/views/VisaMethodView.d.ts.map +1 -0
- package/dist/types/components/payos/views/VisaOtpView.d.ts +45 -0
- package/dist/types/components/payos/views/VisaOtpView.d.ts.map +1 -0
- package/dist/types/components/payos/views/WelcomeBackView.d.ts +34 -0
- package/dist/types/components/payos/views/WelcomeBackView.d.ts.map +1 -0
- package/dist/types/components/ui/CardBrandIcon.d.ts +10 -0
- package/dist/types/components/ui/CardBrandIcon.d.ts.map +1 -0
- package/dist/types/components/ui/ConfirmDialog.d.ts +25 -0
- package/dist/types/components/ui/ConfirmDialog.d.ts.map +1 -0
- package/dist/types/components/ui/InfoTooltip.d.ts +8 -0
- package/dist/types/components/ui/InfoTooltip.d.ts.map +1 -0
- package/dist/types/components/ui/PinInput.d.ts +12 -0
- package/dist/types/components/ui/PinInput.d.ts.map +1 -0
- package/dist/types/components/ui/button.d.ts +14 -0
- package/dist/types/components/ui/button.d.ts.map +1 -0
- package/dist/types/components/ui/card.d.ts +15 -0
- package/dist/types/components/ui/card.d.ts.map +1 -0
- package/dist/types/components/ui/input.d.ts +6 -0
- package/dist/types/components/ui/input.d.ts.map +1 -0
- package/dist/types/components/ui/label.d.ts +6 -0
- package/dist/types/components/ui/label.d.ts.map +1 -0
- package/dist/types/components/ui/separator.d.ts +5 -0
- package/dist/types/components/ui/separator.d.ts.map +1 -0
- package/dist/types/drawer.d.ts +33 -0
- package/dist/types/drawer.d.ts.map +1 -0
- package/dist/types/hooks/index.d.ts +8 -0
- package/dist/types/hooks/index.d.ts.map +1 -0
- package/dist/types/hooks/useBodyScrollLock.d.ts +32 -0
- package/dist/types/hooks/useBodyScrollLock.d.ts.map +1 -0
- package/dist/types/hooks/useCardElement.d.ts +123 -0
- package/dist/types/hooks/useCardElement.d.ts.map +1 -0
- package/dist/types/hooks/useCheckoutFlow.d.ts +29 -0
- package/dist/types/hooks/useCheckoutFlow.d.ts.map +1 -0
- package/dist/types/hooks/useDrawerState.d.ts +4 -0
- package/dist/types/hooks/useDrawerState.d.ts.map +1 -0
- package/dist/types/hooks/usePasskeySDK.d.ts +99 -0
- package/dist/types/hooks/usePasskeySDK.d.ts.map +1 -0
- package/dist/types/hooks/useSession.d.ts +68 -0
- package/dist/types/hooks/useSession.d.ts.map +1 -0
- package/dist/types/hooks/useVisualViewport.d.ts +15 -0
- package/dist/types/hooks/useVisualViewport.d.ts.map +1 -0
- package/dist/types/index.d.ts +43 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/lib/theme.d.ts +53 -0
- package/dist/types/lib/theme.d.ts.map +1 -0
- package/dist/types/lib/utils.d.ts +3 -0
- package/dist/types/lib/utils.d.ts.map +1 -0
- package/dist/types/mocks/index.d.ts +3 -0
- package/dist/types/mocks/index.d.ts.map +1 -0
- package/dist/types/mocks/mockCheckoutFlow.d.ts +25 -0
- package/dist/types/mocks/mockCheckoutFlow.d.ts.map +1 -0
- package/dist/types/mocks/mockData.d.ts +6 -0
- package/dist/types/mocks/mockData.d.ts.map +1 -0
- package/dist/types/mocks/mockSessionData.d.ts +38 -0
- package/dist/types/mocks/mockSessionData.d.ts.map +1 -0
- package/dist/types/order.d.ts +25 -0
- package/dist/types/order.d.ts.map +1 -0
- package/dist/types/payment.d.ts +52 -0
- package/dist/types/payment.d.ts.map +1 -0
- package/dist/types/services/apiService.d.ts +297 -0
- package/dist/types/services/apiService.d.ts.map +1 -0
- package/dist/types/services/linkTokenService.d.ts +27 -0
- package/dist/types/services/linkTokenService.d.ts.map +1 -0
- package/dist/types/services/mockSessionService.d.ts +78 -0
- package/dist/types/services/mockSessionService.d.ts.map +1 -0
- package/dist/types/session.d.ts +148 -0
- package/dist/types/session.d.ts.map +1 -0
- package/dist/types/types/cardElement.d.ts +138 -0
- package/dist/types/types/cardElement.d.ts.map +1 -0
- package/dist/types/types/drawer.d.ts +33 -0
- package/dist/types/types/drawer.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +4 -0
- package/dist/types/types/index.d.ts.map +1 -0
- package/dist/types/types/order.d.ts +25 -0
- package/dist/types/types/order.d.ts.map +1 -0
- package/dist/types/types/payment.d.ts +52 -0
- package/dist/types/types/payment.d.ts.map +1 -0
- package/dist/types/types/session.d.ts +148 -0
- package/dist/types/types/session.d.ts.map +1 -0
- package/dist/types/utils/deviceFingerprint.d.ts +27 -0
- package/dist/types/utils/deviceFingerprint.d.ts.map +1 -0
- package/dist/types/utils/environment.d.ts +22 -0
- package/dist/types/utils/environment.d.ts.map +1 -0
- package/dist/types/utils/formatting.d.ts +38 -0
- package/dist/types/utils/formatting.d.ts.map +1 -0
- package/dist/types/utils/index.d.ts +3 -0
- package/dist/types/utils/index.d.ts.map +1 -0
- package/dist/types/utils/validation.d.ts +52 -0
- package/dist/types/utils/validation.d.ts.map +1 -0
- package/dist/utils/deviceFingerprint.d.ts +27 -0
- package/dist/utils/deviceFingerprint.d.ts.map +1 -0
- package/dist/utils/environment.d.ts +22 -0
- package/dist/utils/environment.d.ts.map +1 -0
- package/dist/utils/formatting.d.ts +38 -0
- package/dist/utils/formatting.d.ts.map +1 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/validation.d.ts +52 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/package.json +84 -0
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PayOS Elements API Service
|
|
3
|
+
*
|
|
4
|
+
* Centralized API service for all backend calls.
|
|
5
|
+
* All requests are authenticated via link token (Bearer token).
|
|
6
|
+
* Adapted from apps/payos-link/src/api/index.ts
|
|
7
|
+
*/
|
|
8
|
+
import { SavedCard } from '../types/session';
|
|
9
|
+
export interface ApiResponse<T> {
|
|
10
|
+
error: boolean;
|
|
11
|
+
message?: string;
|
|
12
|
+
data?: T;
|
|
13
|
+
environment?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface OTPStatus {
|
|
16
|
+
status: 'pending' | 'approved' | 'expired' | 'canceled';
|
|
17
|
+
phone: string;
|
|
18
|
+
createdAt: string;
|
|
19
|
+
expiresAt: string;
|
|
20
|
+
verifiedAt?: string;
|
|
21
|
+
channel: string;
|
|
22
|
+
}
|
|
23
|
+
export interface WalletUserResult {
|
|
24
|
+
walletUserId: string;
|
|
25
|
+
isNewUser: boolean;
|
|
26
|
+
isNewRelationship: boolean;
|
|
27
|
+
hasExistingCards: boolean;
|
|
28
|
+
savedCards: SavedCard[];
|
|
29
|
+
linkedCardIds?: string[];
|
|
30
|
+
}
|
|
31
|
+
export declare class ApiError extends Error {
|
|
32
|
+
status: number;
|
|
33
|
+
details?: string;
|
|
34
|
+
constructor(message: string, status: number, details?: string);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Send OTP verification code to a phone number
|
|
38
|
+
* @param baseUrl API base URL
|
|
39
|
+
* @param token Link token for authentication
|
|
40
|
+
* @param phone Phone number in E.164 format
|
|
41
|
+
* @returns Reference ID for the verification
|
|
42
|
+
*/
|
|
43
|
+
export declare function sendOTP(baseUrl: string, token: string, phone: string): Promise<string>;
|
|
44
|
+
/**
|
|
45
|
+
* Verify OTP code
|
|
46
|
+
* @param baseUrl API base URL
|
|
47
|
+
* @param token Link token for authentication
|
|
48
|
+
* @param reference Verification reference from sendOTP
|
|
49
|
+
* @param code 6-digit OTP code
|
|
50
|
+
* @returns Verified phone number and reference
|
|
51
|
+
*/
|
|
52
|
+
export declare function verifyOTP(baseUrl: string, token: string, reference: string, code: string): Promise<{
|
|
53
|
+
phone: string;
|
|
54
|
+
reference: string;
|
|
55
|
+
}>;
|
|
56
|
+
/**
|
|
57
|
+
* Get OTP verification status
|
|
58
|
+
* @param baseUrl API base URL
|
|
59
|
+
* @param token Link token for authentication
|
|
60
|
+
* @param reference Verification reference
|
|
61
|
+
* @returns Verification status details
|
|
62
|
+
*/
|
|
63
|
+
export declare function getOTPStatus(baseUrl: string, token: string, reference: string): Promise<OTPStatus>;
|
|
64
|
+
/**
|
|
65
|
+
* Resend OTP verification code
|
|
66
|
+
* Checks existing status first to enforce rate limiting (30 second minimum)
|
|
67
|
+
* @param baseUrl API base URL
|
|
68
|
+
* @param token Link token for authentication
|
|
69
|
+
* @param previousReference Previous verification reference
|
|
70
|
+
* @param phone Phone number
|
|
71
|
+
* @returns New reference or existing reference with wait time
|
|
72
|
+
*/
|
|
73
|
+
export declare function resendOTP(baseUrl: string, token: string, previousReference: string, phone: string): Promise<{
|
|
74
|
+
reference: string;
|
|
75
|
+
waitTimeRemaining?: number;
|
|
76
|
+
}>;
|
|
77
|
+
/**
|
|
78
|
+
* Process a verified wallet user after OTP verification
|
|
79
|
+
* Creates wallet user if doesn't exist, returns walletUserId and saved cards
|
|
80
|
+
* @param baseUrl API base URL
|
|
81
|
+
* @param token Link token for authentication
|
|
82
|
+
* @param phone Verified phone number
|
|
83
|
+
* @param verificationId OTP verification reference
|
|
84
|
+
* @returns Wallet user details including walletUserId and saved cards
|
|
85
|
+
*/
|
|
86
|
+
export declare function processVerifiedWalletUser(baseUrl: string, token: string, phone: string, verificationId: string): Promise<WalletUserResult>;
|
|
87
|
+
/**
|
|
88
|
+
* Get saved cards for a wallet user
|
|
89
|
+
* @param baseUrl API base URL
|
|
90
|
+
* @param token Link token for authentication
|
|
91
|
+
* @param walletUserId Wallet user ID
|
|
92
|
+
* @returns Array of saved cards
|
|
93
|
+
*/
|
|
94
|
+
export declare function getWalletUserCards(baseUrl: string, token: string, walletUserId: string): Promise<SavedCard[]>;
|
|
95
|
+
export interface CreatePaymentIntentRequest {
|
|
96
|
+
walletUserId?: string;
|
|
97
|
+
externalUserId?: string;
|
|
98
|
+
currency?: string;
|
|
99
|
+
type?: 'pay_on_behalf' | 'agentic_multi' | 'online_checkout';
|
|
100
|
+
consumerPrompt?: string;
|
|
101
|
+
payments: Array<{
|
|
102
|
+
merchantName: string;
|
|
103
|
+
merchantUrl?: string;
|
|
104
|
+
merchantCategory?: string;
|
|
105
|
+
merchantCategoryCode?: string;
|
|
106
|
+
amount: number;
|
|
107
|
+
description?: string;
|
|
108
|
+
quantity?: number;
|
|
109
|
+
}>;
|
|
110
|
+
credentialType?: 'network_token_short' | 'network_token_long' | 'virtual_card' | 'bank_account' | 'pci_vault_token';
|
|
111
|
+
}
|
|
112
|
+
export interface PaymentIntentResponse {
|
|
113
|
+
id: string;
|
|
114
|
+
type: string;
|
|
115
|
+
currency: string;
|
|
116
|
+
walletUserId?: string;
|
|
117
|
+
organizationId: string;
|
|
118
|
+
status: string;
|
|
119
|
+
payments: Array<{
|
|
120
|
+
id: string;
|
|
121
|
+
merchantName: string;
|
|
122
|
+
merchantUrl?: string;
|
|
123
|
+
merchantCategory?: string;
|
|
124
|
+
merchantCategoryCode?: string;
|
|
125
|
+
amount: number;
|
|
126
|
+
subtotal?: number;
|
|
127
|
+
tax?: number;
|
|
128
|
+
shipping?: number;
|
|
129
|
+
description?: string;
|
|
130
|
+
quantity: number;
|
|
131
|
+
selectedCardId?: string;
|
|
132
|
+
credentialId?: string;
|
|
133
|
+
credentialStatus: string;
|
|
134
|
+
status: string;
|
|
135
|
+
createdAt: string;
|
|
136
|
+
updatedAt: string;
|
|
137
|
+
}>;
|
|
138
|
+
totalAmount: number;
|
|
139
|
+
totalSubtotal?: number;
|
|
140
|
+
totalTax?: number;
|
|
141
|
+
totalShipping?: number;
|
|
142
|
+
consumerPrompt?: string;
|
|
143
|
+
intentType: string;
|
|
144
|
+
selectedCardId?: string;
|
|
145
|
+
requireHitl: boolean;
|
|
146
|
+
hitlAttemptCount?: number;
|
|
147
|
+
hitlApproved?: boolean;
|
|
148
|
+
networkAuthRequired?: boolean;
|
|
149
|
+
networkAuthCompleted?: boolean;
|
|
150
|
+
authValid?: boolean;
|
|
151
|
+
credentialType: string;
|
|
152
|
+
createdAt: string;
|
|
153
|
+
updatedAt: string;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Create a new payment intent via the API
|
|
157
|
+
* @param baseUrl API base URL
|
|
158
|
+
* @param token Link token for authentication
|
|
159
|
+
* @param request Payment intent configuration
|
|
160
|
+
* @returns Created payment intent
|
|
161
|
+
*/
|
|
162
|
+
export declare function createPaymentIntent(baseUrl: string, token: string, request: CreatePaymentIntentRequest): Promise<PaymentIntentResponse>;
|
|
163
|
+
/**
|
|
164
|
+
* Get payment intent by ID
|
|
165
|
+
* @param baseUrl API base URL
|
|
166
|
+
* @param token Link token for authentication
|
|
167
|
+
* @param paymentIntentId Payment intent ID
|
|
168
|
+
* @returns Payment intent details
|
|
169
|
+
*/
|
|
170
|
+
export declare function getPaymentIntent(baseUrl: string, token: string, paymentIntentId: string): Promise<PaymentIntentResponse>;
|
|
171
|
+
/**
|
|
172
|
+
* Update payment intent (e.g., assign selectedCardId)
|
|
173
|
+
* @param baseUrl API base URL
|
|
174
|
+
* @param token Link token for authentication
|
|
175
|
+
* @param paymentIntentId Payment intent ID
|
|
176
|
+
* @param updates Fields to update
|
|
177
|
+
* @returns Updated payment intent
|
|
178
|
+
*/
|
|
179
|
+
export declare function updatePaymentIntent(baseUrl: string, token: string, paymentIntentId: string, updates: {
|
|
180
|
+
selectedCardId?: string;
|
|
181
|
+
}): Promise<PaymentIntentResponse>;
|
|
182
|
+
export interface SessionResponse {
|
|
183
|
+
id: string;
|
|
184
|
+
type: string;
|
|
185
|
+
status: string;
|
|
186
|
+
organizationId: string;
|
|
187
|
+
paymentIntentId: string;
|
|
188
|
+
locale: string;
|
|
189
|
+
metadata: Record<string, any>;
|
|
190
|
+
expiresAt: string;
|
|
191
|
+
startedAt?: string;
|
|
192
|
+
completedAt?: string;
|
|
193
|
+
abandonedAt?: string;
|
|
194
|
+
createdAt: string;
|
|
195
|
+
updatedAt: string;
|
|
196
|
+
}
|
|
197
|
+
export interface GetCurrentSessionResponse {
|
|
198
|
+
session: SessionResponse;
|
|
199
|
+
paymentIntent: PaymentIntentResponse | null;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Get current session for SDK initialization
|
|
203
|
+
* Uses the sessionSecret (JWT) to authenticate and get session + payment intent
|
|
204
|
+
* @param baseUrl API base URL
|
|
205
|
+
* @param sessionSecret Session secret (JWT token) from POST /api/sessions/checkout
|
|
206
|
+
* @returns Session with payment intent data
|
|
207
|
+
*/
|
|
208
|
+
export declare function getCurrentSession(baseUrl: string, sessionSecret: string): Promise<GetCurrentSessionResponse>;
|
|
209
|
+
/**
|
|
210
|
+
* Mark session as started (when PaymentSheet opens)
|
|
211
|
+
* @param baseUrl API base URL
|
|
212
|
+
* @param sessionSecret Session secret (JWT token)
|
|
213
|
+
* @returns Updated session
|
|
214
|
+
*/
|
|
215
|
+
export declare function startSession(baseUrl: string, sessionSecret: string): Promise<SessionResponse>;
|
|
216
|
+
/**
|
|
217
|
+
* Complete session
|
|
218
|
+
* @param baseUrl API base URL
|
|
219
|
+
* @param sessionSecret Session secret (JWT token)
|
|
220
|
+
* @returns Completed session
|
|
221
|
+
*/
|
|
222
|
+
export declare function completeCheckoutSession(baseUrl: string, sessionSecret: string): Promise<SessionResponse>;
|
|
223
|
+
/**
|
|
224
|
+
* Abandon session (user closed PaymentSheet)
|
|
225
|
+
* @param baseUrl API base URL
|
|
226
|
+
* @param sessionSecret Session secret (JWT token)
|
|
227
|
+
* @returns Abandoned session
|
|
228
|
+
*/
|
|
229
|
+
export declare function abandonCheckoutSession(baseUrl: string, sessionSecret: string): Promise<SessionResponse>;
|
|
230
|
+
/**
|
|
231
|
+
* Update the session's linked payment intent (e.g., select card)
|
|
232
|
+
* Uses the session context to determine which payment intent to update
|
|
233
|
+
* @param baseUrl API base URL
|
|
234
|
+
* @param sessionSecret Session secret (JWT token)
|
|
235
|
+
* @param updates Fields to update on payment intent (e.g., selectedCardId)
|
|
236
|
+
* @returns Updated payment intent
|
|
237
|
+
*/
|
|
238
|
+
export declare function updateSessionPaymentIntent(baseUrl: string, sessionSecret: string, updates: {
|
|
239
|
+
selectedCardId?: string;
|
|
240
|
+
walletUserId?: string;
|
|
241
|
+
}): Promise<PaymentIntentResponse>;
|
|
242
|
+
export interface GenerateCredentialResponse {
|
|
243
|
+
status: string;
|
|
244
|
+
message?: string;
|
|
245
|
+
retrievalToken?: string;
|
|
246
|
+
approvalId?: string;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Generate payment credentials for a payment intent
|
|
250
|
+
* Called after successful passkey authentication in agent mode
|
|
251
|
+
* @param apiBaseUrl API base URL (from environment config)
|
|
252
|
+
* @param linkToken Link token (session secret) for authentication
|
|
253
|
+
* @param paymentIntentId Payment intent ID to generate credentials for
|
|
254
|
+
* @returns Credential generation result with status
|
|
255
|
+
*/
|
|
256
|
+
export declare function generateCredential(apiBaseUrl: string, linkToken: string, paymentIntentId: string): Promise<GenerateCredentialResponse>;
|
|
257
|
+
/**
|
|
258
|
+
* Delete a saved card from wallet user
|
|
259
|
+
* Uses soft delete (marks card as inactive, doesn't permanently delete)
|
|
260
|
+
* @param baseUrl API base URL
|
|
261
|
+
* @param token Link token for authentication
|
|
262
|
+
* @param walletUserId Wallet user ID who owns the card
|
|
263
|
+
* @param cardId Card ID to delete
|
|
264
|
+
* @returns Success status
|
|
265
|
+
*/
|
|
266
|
+
export declare function deleteCard(baseUrl: string, token: string, walletUserId: string, cardId: string): Promise<{
|
|
267
|
+
success: boolean;
|
|
268
|
+
}>;
|
|
269
|
+
export interface DeviceTrustResult {
|
|
270
|
+
/** Whether this device is trusted for the wallet user */
|
|
271
|
+
isTrusted: boolean;
|
|
272
|
+
/** When the trust expires (if trusted) */
|
|
273
|
+
expiresAt?: string;
|
|
274
|
+
/** Wallet user ID if device was previously verified */
|
|
275
|
+
walletUserId?: string;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Check if a device is trusted for a wallet user (90-day verification)
|
|
279
|
+
* @param baseUrl API base URL
|
|
280
|
+
* @param token Link token for authentication
|
|
281
|
+
* @param deviceId Device fingerprint
|
|
282
|
+
* @param walletUserId Wallet user ID (from PaymentIntent)
|
|
283
|
+
* @returns Device trust status
|
|
284
|
+
*/
|
|
285
|
+
export declare function checkDeviceTrust(baseUrl: string, token: string, deviceId: string, walletUserId?: string): Promise<DeviceTrustResult>;
|
|
286
|
+
/**
|
|
287
|
+
* Register a device as trusted after successful OTP verification
|
|
288
|
+
* @param baseUrl API base URL
|
|
289
|
+
* @param token Link token for authentication
|
|
290
|
+
* @param deviceId Device fingerprint
|
|
291
|
+
* @param walletUserId Wallet user ID
|
|
292
|
+
* @returns Success status
|
|
293
|
+
*/
|
|
294
|
+
export declare function registerTrustedDevice(baseUrl: string, token: string, deviceId: string, walletUserId: string): Promise<{
|
|
295
|
+
success: boolean;
|
|
296
|
+
}>;
|
|
297
|
+
//# sourceMappingURL=apiService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiService.d.ts","sourceRoot":"","sources":["../../src/services/apiService.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAgB7C,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,M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,EAAE,OAAO,CAAA;CAAE,CAAC,CAmB/B;AAMD,MAAM,WAAW,iBAAiB;IAChC,yDAAyD;IACzD,SAAS,EAAE,OAAO,CAAC;IACnB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uDAAuD;IACvD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC,iBAAiB,CAAC,CA2B5B;AAED;;;;;;;GAOG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAqB/B"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Link Token Service
|
|
3
|
+
*
|
|
4
|
+
* Fetches real link tokens from the PayOS API for CardElement initialization.
|
|
5
|
+
* This replaces mock token generation with real API calls.
|
|
6
|
+
*/
|
|
7
|
+
export interface LinkTokenResponse {
|
|
8
|
+
token: string;
|
|
9
|
+
expiresAt: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Fetch a real link token from the PayOS API
|
|
13
|
+
*
|
|
14
|
+
* @returns Promise with token and expiration timestamp
|
|
15
|
+
* @throws Error if the API request fails
|
|
16
|
+
*/
|
|
17
|
+
export declare function fetchLinkToken(): Promise<LinkTokenResponse>;
|
|
18
|
+
/**
|
|
19
|
+
* Get the CardElement configuration for the current environment
|
|
20
|
+
* Note: customBaseUrl points to where the CardElement iframe is hosted (payos-link app),
|
|
21
|
+
* NOT the backend API URL
|
|
22
|
+
*/
|
|
23
|
+
export declare const CARD_ELEMENT_CONFIG: {
|
|
24
|
+
customBaseUrl: string;
|
|
25
|
+
environment: "sandbox";
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=linkTokenService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linkTokenService.d.ts","sourceRoot":"","sources":["../../src/services/linkTokenService.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAWH,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,iBAAiB,CAAC,CA6BjE;AAED;;;;GAIG;AACH,eAAO,MAAM,mBAAmB;;;CAG/B,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { CheckoutSession, MultiPaymentIntent, VerificationInitResult, VerificationResult, CompletionResult, SavedCard } from '../types/session';
|
|
2
|
+
import { CreateMockSessionOptions } from '../mocks/mockSessionData';
|
|
3
|
+
import { CreatePaymentIntentRequest } from './apiService';
|
|
4
|
+
export declare function loadSession(sessionId: string): Promise<CheckoutSession>;
|
|
5
|
+
export declare function updateSession(sessionId: string, updates: Partial<CheckoutSession>): Promise<CheckoutSession>;
|
|
6
|
+
export declare function initiateVerification(sessionId: string, contact: {
|
|
7
|
+
email?: string;
|
|
8
|
+
phone?: string;
|
|
9
|
+
}): Promise<VerificationInitResult>;
|
|
10
|
+
export declare function confirmVerification(sessionId: string, code: string): Promise<VerificationResult>;
|
|
11
|
+
export declare function resendOTP(sessionId: string): Promise<VerificationInitResult>;
|
|
12
|
+
/**
|
|
13
|
+
* Mock API: Update payment intent with selected card
|
|
14
|
+
* Simulates: PATCH /payment-intents/{paymentIntentId}
|
|
15
|
+
* Body: { selectedCardId: string }
|
|
16
|
+
*/
|
|
17
|
+
export declare function updatePaymentIntentCard(paymentIntentId: string, cardId: string): Promise<{
|
|
18
|
+
success: boolean;
|
|
19
|
+
paymentIntent: MultiPaymentIntent;
|
|
20
|
+
}>;
|
|
21
|
+
export declare function selectCard(sessionId: string, cardId: string): Promise<CheckoutSession>;
|
|
22
|
+
export declare function addCard(sessionId: string, tokenizedCard: {
|
|
23
|
+
cardId: string;
|
|
24
|
+
last4: string;
|
|
25
|
+
brand: string;
|
|
26
|
+
network: string;
|
|
27
|
+
expiryMonth?: string;
|
|
28
|
+
expiryYear?: string;
|
|
29
|
+
cardholderName?: string;
|
|
30
|
+
cardArtUrl?: string;
|
|
31
|
+
}): Promise<{
|
|
32
|
+
session: CheckoutSession;
|
|
33
|
+
card: SavedCard;
|
|
34
|
+
}>;
|
|
35
|
+
export declare function clearSelectedCard(sessionId: string): Promise<CheckoutSession>;
|
|
36
|
+
export declare function completeSession(sessionId: string, options?: {
|
|
37
|
+
passkeyAuthenticated?: boolean;
|
|
38
|
+
}): Promise<CompletionResult>;
|
|
39
|
+
export declare function abandonSession(sessionId: string): Promise<CheckoutSession>;
|
|
40
|
+
export declare function createTestSession(options?: CreateMockSessionOptions): string;
|
|
41
|
+
export declare function resetSession(sessionId: string): void;
|
|
42
|
+
export declare function resetAllSessions(): void;
|
|
43
|
+
export declare function getSessionState(sessionId: string): CheckoutSession | undefined;
|
|
44
|
+
export declare function listAllSessions(): string[];
|
|
45
|
+
export interface WalletUserCardsResponse {
|
|
46
|
+
walletUserId: string;
|
|
47
|
+
cards: SavedCard[];
|
|
48
|
+
defaultCardId?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Mock implementation of GET /wallet-users/{wallet_user_id}/cards
|
|
52
|
+
* Returns all saved cards for a wallet user with card art URLs
|
|
53
|
+
*/
|
|
54
|
+
export declare function getWalletUserCards(walletUserId: string): Promise<WalletUserCardsResponse>;
|
|
55
|
+
/**
|
|
56
|
+
* Options for creating a test session with a real payment intent
|
|
57
|
+
*/
|
|
58
|
+
export interface CreateTestSessionWithRealIntentOptions extends CreatePaymentIntentRequest {
|
|
59
|
+
sessionOptions?: CreateMockSessionOptions;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Create a test session with a REAL payment intent from the API
|
|
63
|
+
*
|
|
64
|
+
* This is for demo/testing purposes - simulates the production flow where:
|
|
65
|
+
* 1. Merchant backend creates a payment intent via API
|
|
66
|
+
* 2. Merchant creates a session that links to the intent
|
|
67
|
+
* 3. Session ID is passed to PaymentSheet
|
|
68
|
+
*
|
|
69
|
+
* In this test helper, we:
|
|
70
|
+
* 1. Fetch a link token for API auth
|
|
71
|
+
* 2. Create a real payment intent via the API
|
|
72
|
+
* 3. Create a mock session locally with the real intent embedded
|
|
73
|
+
*
|
|
74
|
+
* @param options Payment intent configuration + optional session options
|
|
75
|
+
* @returns Session ID to pass to PaymentSheet
|
|
76
|
+
*/
|
|
77
|
+
export declare function createTestSessionWithRealIntent(options: CreateTestSessionWithRealIntentOptions): Promise<string>;
|
|
78
|
+
//# sourceMappingURL=mockSessionService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mockSessionService.d.ts","sourceRoot":"","sources":["../../src/services/mockSessionService.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,gBAAgB,EAChB,SAAS,EAEV,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAKL,wBAAwB,EACzB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAML,0BAA0B,EAE3B,MAAM,cAAc,CAAC;AAgCtB,wBAAsB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CA4B7E;AAED,wBAAsB,aAAa,CACjC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,OAAO,CAAC,eAAe,CAAC,GAChC,OAAO,CAAC,eAAe,CAAC,CAiB1B;AAMD,wBAAsB,oBAAoB,CACxC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,C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sB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAehF;AAMD,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,wBAA6B,GAAG,MAAM,CAKhF;AAED,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAMpD;AAED,wBAAgB,gBAAgB,IAAI,IAAI,CAMvC;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAG9E;AAED,wBAAgB,eAAe,IAAI,MAAM,EAAE,CAE1C;AAMD,MAAM,WAAW,uBAAuB;IACtC,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CACtC,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,uBAAuB,CAAC,CAelC;AAMD;;GAEG;AACH,MAAM,WAAW,sCAAuC,SAAQ,0BAA0B;IACxF,cAAc,CAAC,EAAE,wBAAwB,CAAC;CAC3C;AAmDD;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,+BAA+B,CACnD,OAAO,EAAE,sCAAsC,GAC9C,OAAO,CAAC,MAAM,CAAC,CAmCjB"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CardElement Types
|
|
3
|
+
*
|
|
4
|
+
* Types for the PayOS CardElement iframe integration.
|
|
5
|
+
* These mirror the types from @payos-inc/payos-js for local use.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Card element styling configuration
|
|
9
|
+
*/
|
|
10
|
+
export interface CardElementStyles {
|
|
11
|
+
layout?: {
|
|
12
|
+
padding?: string;
|
|
13
|
+
maxWidth?: string;
|
|
14
|
+
backgroundColor?: string;
|
|
15
|
+
gap?: string;
|
|
16
|
+
direction?: 'row' | 'column';
|
|
17
|
+
labelPlacement?: 'above' | 'inline' | 'floating';
|
|
18
|
+
showLabels?: boolean;
|
|
19
|
+
showErrorMessages?: boolean;
|
|
20
|
+
showLoadingState?: boolean;
|
|
21
|
+
preset?: 'single-row' | 'two-row' | 'compact' | 'stacked';
|
|
22
|
+
};
|
|
23
|
+
container?: {
|
|
24
|
+
borderRadius?: string;
|
|
25
|
+
boxShadow?: string;
|
|
26
|
+
border?: string;
|
|
27
|
+
padding?: string;
|
|
28
|
+
margin?: string;
|
|
29
|
+
};
|
|
30
|
+
base?: Record<string, unknown>;
|
|
31
|
+
cardNumber?: Record<string, unknown>;
|
|
32
|
+
expiry?: Record<string, unknown>;
|
|
33
|
+
cvc?: Record<string, unknown>;
|
|
34
|
+
theme?: 'default' | 'minimal' | 'dark' | 'material';
|
|
35
|
+
}
|
|
36
|
+
export interface CardElementOptions {
|
|
37
|
+
token: string;
|
|
38
|
+
environment?: 'sandbox' | 'production';
|
|
39
|
+
styles?: CardElementStyles;
|
|
40
|
+
height?: string;
|
|
41
|
+
customBaseUrl?: string;
|
|
42
|
+
customParams?: Record<string, string>;
|
|
43
|
+
onReady?: () => void;
|
|
44
|
+
onTokenized?: (event: CardElementTokenizedEvent) => void;
|
|
45
|
+
onChange?: (event: CardElementChangeEvent) => void;
|
|
46
|
+
onCancel?: () => void;
|
|
47
|
+
onError?: (error: Error) => void;
|
|
48
|
+
}
|
|
49
|
+
export interface CardElementTokenizedEvent {
|
|
50
|
+
event: 'cardTokenized';
|
|
51
|
+
card?: {
|
|
52
|
+
id?: string;
|
|
53
|
+
brand?: string;
|
|
54
|
+
last4?: string;
|
|
55
|
+
expMonth?: number;
|
|
56
|
+
expYear?: number;
|
|
57
|
+
cardholderName?: string;
|
|
58
|
+
isDefault?: boolean;
|
|
59
|
+
artwork?: string;
|
|
60
|
+
bankName?: string;
|
|
61
|
+
cardType?: string;
|
|
62
|
+
[key: string]: unknown;
|
|
63
|
+
};
|
|
64
|
+
billingAddress?: {
|
|
65
|
+
street?: string;
|
|
66
|
+
street2?: string;
|
|
67
|
+
city?: string;
|
|
68
|
+
state?: string;
|
|
69
|
+
postalCode?: string;
|
|
70
|
+
country?: string;
|
|
71
|
+
[key: string]: unknown;
|
|
72
|
+
};
|
|
73
|
+
cardholderName?: string;
|
|
74
|
+
visaEnrollment?: Record<string, unknown> | null;
|
|
75
|
+
mastercardEnrollment?: Record<string, unknown> | null;
|
|
76
|
+
walletUserId?: string;
|
|
77
|
+
organizationId?: string;
|
|
78
|
+
[key: string]: unknown;
|
|
79
|
+
}
|
|
80
|
+
export interface CardElementChangeEvent {
|
|
81
|
+
event: 'change';
|
|
82
|
+
complete: boolean;
|
|
83
|
+
empty: boolean;
|
|
84
|
+
error?: string;
|
|
85
|
+
}
|
|
86
|
+
export interface CardElementAddress {
|
|
87
|
+
line1?: string;
|
|
88
|
+
line2?: string;
|
|
89
|
+
city?: string;
|
|
90
|
+
state?: string;
|
|
91
|
+
postalCode?: string;
|
|
92
|
+
country?: string;
|
|
93
|
+
}
|
|
94
|
+
export interface CardElementConfiguration {
|
|
95
|
+
walletUserId?: string;
|
|
96
|
+
cardholderName?: string;
|
|
97
|
+
billingAddress?: CardElementAddress;
|
|
98
|
+
/** Shipping address - CardElement can use for "Same as shipping" feature */
|
|
99
|
+
shippingAddress?: CardElementAddress;
|
|
100
|
+
/** Whether to use shipping as billing (for "Same as shipping" toggle) */
|
|
101
|
+
useShippingAsBilling?: boolean;
|
|
102
|
+
}
|
|
103
|
+
export interface CardElementInstance {
|
|
104
|
+
mount: () => void;
|
|
105
|
+
unmount: () => void;
|
|
106
|
+
destroy: () => void;
|
|
107
|
+
configure: (config: CardElementConfiguration) => void;
|
|
108
|
+
submit: () => void;
|
|
109
|
+
updateStyles?: (styles: CardElementStyles) => void;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* CardElementClient - Creates and manages a secure card capture iframe
|
|
113
|
+
*
|
|
114
|
+
* This is a local implementation that mirrors the @payos-inc/payos-js CardElementClient
|
|
115
|
+
* to avoid build dependency issues in the monorepo.
|
|
116
|
+
*/
|
|
117
|
+
export declare class CardElementClient {
|
|
118
|
+
private container;
|
|
119
|
+
private iframe;
|
|
120
|
+
private options;
|
|
121
|
+
private messageListener;
|
|
122
|
+
private iframeOrigin;
|
|
123
|
+
constructor(container: string | HTMLElement, options: CardElementOptions);
|
|
124
|
+
mount(): void;
|
|
125
|
+
unmount(): void;
|
|
126
|
+
destroy(): void;
|
|
127
|
+
configure(config: CardElementConfiguration): void;
|
|
128
|
+
submit(): void;
|
|
129
|
+
updateStyles(styles: CardElementStyles): void;
|
|
130
|
+
private sendStyles;
|
|
131
|
+
private handleMessage;
|
|
132
|
+
private isAllowedOrigin;
|
|
133
|
+
private buildIframeUrl;
|
|
134
|
+
private getBaseUrl;
|
|
135
|
+
private getAllowedOrigins;
|
|
136
|
+
private validateOptions;
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=cardElement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cardElement.d.ts","sourceRoot":"","sources":["../../src/types/cardElement.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,EAAE;QACP,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,SAAS,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;QAC7B,cAAc,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,UAAU,CAAC;QACjD,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,iBAAiB,CAAC,EAAE,OAAO,CAAC;QAC5B,gBAAgB,CAAC,EAAE,OAAO,CAAC;QAC3B,MAAM,CAAC,EAAE,YAAY,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;KAC3D,CAAC;IACF,SAAS,CAAC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CAAC,aAAa;IAoDrB,OAAO,CAAC,eAAe;IAKvB,OAAO,CAAC,cAAc;IAmBtB,OAAO,CAAC,UAAU;IAQlB,OAAO,CAAC,iBAAiB;IAsBzB,OAAO,CAAC,eAAe;CASxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IdentityBar.d.ts","sourceRoot":"","sources":["../../../../src/components/identity/IdentityBar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,UAAU,gBAAgB;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAkBlD,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { OrderData } from '../../types';
|
|
3
|
+
interface OrderSummaryAccordionProps {
|
|
4
|
+
orderData: OrderData;
|
|
5
|
+
mode?: 'standard' | 'agent';
|
|
6
|
+
}
|
|
7
|
+
export declare const OrderSummaryAccordion: React.FC<OrderSummaryAccordionProps>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=OrderSummaryAccordion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OrderSummaryAccordion.d.ts","sourceRoot":"","sources":["../../../../src/components/order/OrderSummaryAccordion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAIxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAI7C,UAAU,0BAA0B;IAClC,SAAS,EAAE,SAAS,CAAC;IACrB,IAAI,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC;CAC7B;AAED,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC,0BAA0B,CA6FtE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ShipmentCard.d.ts","sourceRoot":"","sources":["../../../../src/components/order/ShipmentCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,UAAU,iBAAiB;IACzB,IAAI,EAAE,SAAS,CAAC;CACjB;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAqBpD,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { SavedCard } from "../../types";
|
|
3
|
+
/**
|
|
4
|
+
* ActiveCardWidget - The "Hero" card component for CheckoutView
|
|
5
|
+
*
|
|
6
|
+
* Combines card display + CVC entry in a unified widget with two sections:
|
|
7
|
+
* - Top Half: Card display (brand icon + last4 + expiry) with "Change" link
|
|
8
|
+
* - Bottom Half: Security code (CVC) input with subtle background contrast
|
|
9
|
+
*
|
|
10
|
+
* **Design System (World-Class Polish):**
|
|
11
|
+
* - Unified container with internal divider
|
|
12
|
+
* - Top section: white background
|
|
13
|
+
* - Bottom section: bg-gray-50/50 for subtle contrast
|
|
14
|
+
* - CVC input:
|
|
15
|
+
* - Placeholder: "123" (not "•••") for clarity
|
|
16
|
+
* - Styling: bg-white, border-gray-300, shadow-sm (looks like input, not button)
|
|
17
|
+
* - Centered, bold text, focus:border-black
|
|
18
|
+
* - "Change" link: text-blue-600 for primary action
|
|
19
|
+
*
|
|
20
|
+
* This follows the "Apple" approach of combining related inputs into a single
|
|
21
|
+
* card container rather than separating them.
|
|
22
|
+
*/
|
|
23
|
+
interface ActiveCardWidgetProps {
|
|
24
|
+
/**
|
|
25
|
+
* The saved card to display
|
|
26
|
+
*/
|
|
27
|
+
card: SavedCard;
|
|
28
|
+
/**
|
|
29
|
+
* Current CVC value
|
|
30
|
+
*/
|
|
31
|
+
cvc: string;
|
|
32
|
+
/**
|
|
33
|
+
* CVC change handler
|
|
34
|
+
*/
|
|
35
|
+
onCvcChange: (cvc: string) => void;
|
|
36
|
+
/**
|
|
37
|
+
* Handler when "Change" button is clicked (opens MethodListView)
|
|
38
|
+
*/
|
|
39
|
+
onChangeClick: () => void;
|
|
40
|
+
/**
|
|
41
|
+
* Optional error message for CVC
|
|
42
|
+
*/
|
|
43
|
+
error?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Disable CVC input
|
|
46
|
+
*/
|
|
47
|
+
disabled?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Hide security code section (for agent mode where passkey replaces CVC)
|
|
50
|
+
*/
|
|
51
|
+
hideSecurityCode?: boolean;
|
|
52
|
+
}
|
|
53
|
+
export declare const ActiveCardWidget: React.FC<ActiveCardWidgetProps>;
|
|
54
|
+
export {};
|
|
55
|
+
//# sourceMappingURL=ActiveCardWidget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActiveCardWidget.d.ts","sourceRoot":"","sources":["../../../../src/components/payos/ActiveCardWidget.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,UAAU,qBAAqB;IAC7B;;OAEG;IACH,IAAI,EAAE,SAAS,CAAC;IAChB;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC;;OAEG;IACH,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CA8H5D,CAAC"}
|