@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,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Format amount in cents to currency string
|
|
3
|
+
* @param cents - Amount in cents
|
|
4
|
+
* @param currency - Currency code (default: USD)
|
|
5
|
+
* @returns Formatted currency string (e.g., "$165.00")
|
|
6
|
+
*/
|
|
7
|
+
export declare function formatCurrency(cents: number, currency?: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* Format phone number for display
|
|
10
|
+
* @param phone - Raw phone number
|
|
11
|
+
* @returns Formatted phone number (e.g., "+1 (555) 000-0000")
|
|
12
|
+
*/
|
|
13
|
+
export declare function formatPhoneNumber(phone: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* Format phone number progressively as user types (for input display)
|
|
16
|
+
* @param digits - Raw digits only (no formatting)
|
|
17
|
+
* @returns Progressively formatted phone number
|
|
18
|
+
*/
|
|
19
|
+
export declare function formatPhoneInput(digits: string): string;
|
|
20
|
+
/**
|
|
21
|
+
* Format card number with spaces (4-4-4-4)
|
|
22
|
+
* @param cardNumber - Raw card number
|
|
23
|
+
* @returns Formatted card number
|
|
24
|
+
*/
|
|
25
|
+
export declare function formatCardNumber(cardNumber: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* Mask card number for display
|
|
28
|
+
* @param cardNumber - Full card number
|
|
29
|
+
* @returns Masked number (e.g., "•••• •••• •••• 4242")
|
|
30
|
+
*/
|
|
31
|
+
export declare function maskCardNumber(cardNumber: string): string;
|
|
32
|
+
/**
|
|
33
|
+
* Format expiry date as MM/YY
|
|
34
|
+
* @param expiry - Raw expiry (MMYY or MM/YY)
|
|
35
|
+
* @returns Formatted expiry (MM/YY)
|
|
36
|
+
*/
|
|
37
|
+
export declare function formatExpiry(expiry: string): string;
|
|
38
|
+
//# sourceMappingURL=formatting.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatting.d.ts","sourceRoot":"","sources":["../../../src/utils/formatting.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,SAAQ,GAAG,MAAM,CAMtE;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAevD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAiBvD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAI3D;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAMzD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAUnD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { CardBrand } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Validate phone number
|
|
4
|
+
* Supports both US (10-11 digits) and international (7-15 digits) formats
|
|
5
|
+
* @param phone - Phone number to validate
|
|
6
|
+
* @param countryCode - Optional country code for stricter validation
|
|
7
|
+
* @returns True if valid
|
|
8
|
+
*/
|
|
9
|
+
export declare function isPhoneValid(phone: string, countryCode?: string): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Validate email address
|
|
12
|
+
* @param email - Email to validate
|
|
13
|
+
* @returns True if valid
|
|
14
|
+
*/
|
|
15
|
+
export declare function isEmailValid(email: string): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Luhn algorithm for card number validation
|
|
18
|
+
* @param cardNumber - Card number to validate
|
|
19
|
+
* @returns True if valid by Luhn check
|
|
20
|
+
*/
|
|
21
|
+
export declare function isCardNumberValid(cardNumber: string): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Detect card brand from card number
|
|
24
|
+
* @param cardNumber - Card number
|
|
25
|
+
* @returns Card brand
|
|
26
|
+
*/
|
|
27
|
+
export declare function detectCardBrand(cardNumber: string): CardBrand;
|
|
28
|
+
/**
|
|
29
|
+
* Validate expiry date
|
|
30
|
+
* @param expiry - Expiry in MM/YY format
|
|
31
|
+
* @returns True if valid and not expired
|
|
32
|
+
*/
|
|
33
|
+
export declare function isExpiryValid(expiry: string): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Validate CVC
|
|
36
|
+
* @param cvc - CVC code
|
|
37
|
+
* @param brand - Card brand (Amex requires 4 digits, others 3)
|
|
38
|
+
* @returns True if valid
|
|
39
|
+
*/
|
|
40
|
+
export declare function isCvcValid(cvc: string, brand?: CardBrand): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Validate billing address
|
|
43
|
+
* @param address - Billing address object
|
|
44
|
+
* @returns True if all required fields are filled
|
|
45
|
+
*/
|
|
46
|
+
export declare function isBillingAddressValid(address: {
|
|
47
|
+
line1: string;
|
|
48
|
+
city: string;
|
|
49
|
+
state: string;
|
|
50
|
+
zip: string;
|
|
51
|
+
}): boolean;
|
|
52
|
+
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/utils/validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAUzE;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAGnD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAyB7D;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CA0B7D;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CA4BrD;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,SAAS,GAAG,OAAO,CAQlE;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb,GAAG,OAAO,CAOV"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Device Fingerprint Utility
|
|
3
|
+
*
|
|
4
|
+
* Generates a stable device fingerprint for 90-day device verification.
|
|
5
|
+
* The fingerprint is stored in localStorage for persistence.
|
|
6
|
+
*
|
|
7
|
+
* Note: This is not a security-grade fingerprint (like FingerprintJS Pro).
|
|
8
|
+
* It's meant for convenience (skip OTP on known devices), not fraud prevention.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Get or create a persistent device ID
|
|
12
|
+
* Combines browser fingerprint with a random component for uniqueness
|
|
13
|
+
*/
|
|
14
|
+
export declare function getDeviceId(): string;
|
|
15
|
+
/**
|
|
16
|
+
* Get the device creation timestamp
|
|
17
|
+
*/
|
|
18
|
+
export declare function getDeviceCreatedAt(): string | null;
|
|
19
|
+
/**
|
|
20
|
+
* Clear device ID (for logout/reset scenarios)
|
|
21
|
+
*/
|
|
22
|
+
export declare function clearDeviceId(): void;
|
|
23
|
+
/**
|
|
24
|
+
* Check if device ID exists
|
|
25
|
+
*/
|
|
26
|
+
export declare function hasDeviceId(): boolean;
|
|
27
|
+
//# sourceMappingURL=deviceFingerprint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deviceFingerprint.d.ts","sourceRoot":"","sources":["../../src/utils/deviceFingerprint.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA8DH;;;GAGG;AACH,wBAAgB,WAAW,IAAI,MAAM,CAsBpC;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,GAAG,IAAI,CAMlD;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,IAAI,CAOpC;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,OAAO,CAMrC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Environment utilities for PayOS Elements
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Get the API base URL based on environment and optional development override.
|
|
6
|
+
*
|
|
7
|
+
* @param environment - 'sandbox' or 'production'
|
|
8
|
+
* @param developmentApiUrl - Optional override for local development (e.g., 'http://localhost:3000')
|
|
9
|
+
* @returns The API base URL to use for all SDK/API calls
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* // Local development
|
|
13
|
+
* getApiBaseUrl('sandbox', 'http://localhost:3000') // => 'http://localhost:3000'
|
|
14
|
+
*
|
|
15
|
+
* // Production sandbox
|
|
16
|
+
* getApiBaseUrl('sandbox') // => 'https://sandbox.api.payos.ai'
|
|
17
|
+
*
|
|
18
|
+
* // Production live
|
|
19
|
+
* getApiBaseUrl('production') // => 'https://api.payos.ai'
|
|
20
|
+
*/
|
|
21
|
+
export declare function getApiBaseUrl(environment: 'sandbox' | 'production', developmentApiUrl?: string): string;
|
|
22
|
+
//# sourceMappingURL=environment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../src/utils/environment.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,aAAa,CAC3B,WAAW,EAAE,SAAS,GAAG,YAAY,EACrC,iBAAiB,CAAC,EAAE,MAAM,GACzB,MAAM,CAUR"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Format amount in cents to currency string
|
|
3
|
+
* @param cents - Amount in cents
|
|
4
|
+
* @param currency - Currency code (default: USD)
|
|
5
|
+
* @returns Formatted currency string (e.g., "$165.00")
|
|
6
|
+
*/
|
|
7
|
+
export declare function formatCurrency(cents: number, currency?: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* Format phone number for display
|
|
10
|
+
* @param phone - Raw phone number
|
|
11
|
+
* @returns Formatted phone number (e.g., "+1 (555) 000-0000")
|
|
12
|
+
*/
|
|
13
|
+
export declare function formatPhoneNumber(phone: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* Format phone number progressively as user types (for input display)
|
|
16
|
+
* @param digits - Raw digits only (no formatting)
|
|
17
|
+
* @returns Progressively formatted phone number
|
|
18
|
+
*/
|
|
19
|
+
export declare function formatPhoneInput(digits: string): string;
|
|
20
|
+
/**
|
|
21
|
+
* Format card number with spaces (4-4-4-4)
|
|
22
|
+
* @param cardNumber - Raw card number
|
|
23
|
+
* @returns Formatted card number
|
|
24
|
+
*/
|
|
25
|
+
export declare function formatCardNumber(cardNumber: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* Mask card number for display
|
|
28
|
+
* @param cardNumber - Full card number
|
|
29
|
+
* @returns Masked number (e.g., "•••• •••• •••• 4242")
|
|
30
|
+
*/
|
|
31
|
+
export declare function maskCardNumber(cardNumber: string): string;
|
|
32
|
+
/**
|
|
33
|
+
* Format expiry date as MM/YY
|
|
34
|
+
* @param expiry - Raw expiry (MMYY or MM/YY)
|
|
35
|
+
* @returns Formatted expiry (MM/YY)
|
|
36
|
+
*/
|
|
37
|
+
export declare function formatExpiry(expiry: string): string;
|
|
38
|
+
//# sourceMappingURL=formatting.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatting.d.ts","sourceRoot":"","sources":["../../src/utils/formatting.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,SAAQ,GAAG,MAAM,CAMtE;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAevD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAiBvD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAI3D;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAMzD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAUnD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { CardBrand } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Validate phone number
|
|
4
|
+
* Supports both US (10-11 digits) and international (7-15 digits) formats
|
|
5
|
+
* @param phone - Phone number to validate
|
|
6
|
+
* @param countryCode - Optional country code for stricter validation
|
|
7
|
+
* @returns True if valid
|
|
8
|
+
*/
|
|
9
|
+
export declare function isPhoneValid(phone: string, countryCode?: string): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Validate email address
|
|
12
|
+
* @param email - Email to validate
|
|
13
|
+
* @returns True if valid
|
|
14
|
+
*/
|
|
15
|
+
export declare function isEmailValid(email: string): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Luhn algorithm for card number validation
|
|
18
|
+
* @param cardNumber - Card number to validate
|
|
19
|
+
* @returns True if valid by Luhn check
|
|
20
|
+
*/
|
|
21
|
+
export declare function isCardNumberValid(cardNumber: string): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Detect card brand from card number
|
|
24
|
+
* @param cardNumber - Card number
|
|
25
|
+
* @returns Card brand
|
|
26
|
+
*/
|
|
27
|
+
export declare function detectCardBrand(cardNumber: string): CardBrand;
|
|
28
|
+
/**
|
|
29
|
+
* Validate expiry date
|
|
30
|
+
* @param expiry - Expiry in MM/YY format
|
|
31
|
+
* @returns True if valid and not expired
|
|
32
|
+
*/
|
|
33
|
+
export declare function isExpiryValid(expiry: string): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Validate CVC
|
|
36
|
+
* @param cvc - CVC code
|
|
37
|
+
* @param brand - Card brand (Amex requires 4 digits, others 3)
|
|
38
|
+
* @returns True if valid
|
|
39
|
+
*/
|
|
40
|
+
export declare function isCvcValid(cvc: string, brand?: CardBrand): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Validate billing address
|
|
43
|
+
* @param address - Billing address object
|
|
44
|
+
* @returns True if all required fields are filled
|
|
45
|
+
*/
|
|
46
|
+
export declare function isBillingAddressValid(address: {
|
|
47
|
+
line1: string;
|
|
48
|
+
city: string;
|
|
49
|
+
state: string;
|
|
50
|
+
zip: string;
|
|
51
|
+
}): boolean;
|
|
52
|
+
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAUzE;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAGnD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAyB7D;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CA0B7D;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CA4BrD;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,SAAS,GAAG,OAAO,CAQlE;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb,GAAG,OAAO,CAOV"}
|
package/package.json
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@payos-inc/payos-react",
|
|
3
|
+
"version": "1.0.3-staging.6",
|
|
4
|
+
"description": "PayOS React SDK - Drawer checkout component for React",
|
|
5
|
+
"main": "dist/payos-react.esm.js",
|
|
6
|
+
"module": "dist/payos-react.esm.js",
|
|
7
|
+
"browser": "dist/payos-react.min.js",
|
|
8
|
+
"types": "dist/types/index.d.ts",
|
|
9
|
+
"style": "dist/payos-react.css",
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"dev": "webpack serve --mode development --config webpack.config.js --host",
|
|
15
|
+
"build": "npm run clean && npm run build:webpack && npm run build:esm && npm run build:types && npm run build:css",
|
|
16
|
+
"clean": "rm -rf dist",
|
|
17
|
+
"build:webpack": "webpack --mode production",
|
|
18
|
+
"build:esm": "NODE_ENV=production tsup src/index.ts --format esm --no-dts --minify --out-dir dist && mv dist/index.mjs dist/payos-react.esm.js",
|
|
19
|
+
"build:types": "tsc --declaration --emitDeclarationOnly --outDir dist/types",
|
|
20
|
+
"build:css": "npx tailwindcss -i ./src/styles/base.css -o ./dist/payos-react.css --minify",
|
|
21
|
+
"lint": "eslint src --ext .ts,.tsx",
|
|
22
|
+
"type-check": "tsc --noEmit"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"payos",
|
|
26
|
+
"checkout",
|
|
27
|
+
"payments",
|
|
28
|
+
"react",
|
|
29
|
+
"drawer",
|
|
30
|
+
"sdk",
|
|
31
|
+
"elements"
|
|
32
|
+
],
|
|
33
|
+
"author": "PayOS Inc.",
|
|
34
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "https://github.com/payos-inc/payos-react.git"
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"react": "^18.2.0",
|
|
41
|
+
"react-dom": "^18.2.0"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@payos-inc/payos-passkey-js": "^1.3.2",
|
|
45
|
+
"lucide-react": "^0.536.0",
|
|
46
|
+
"framer-motion": "^12.5.0",
|
|
47
|
+
"clsx": "^2.1.1",
|
|
48
|
+
"class-variance-authority": "^0.7.1",
|
|
49
|
+
"tailwind-merge": "^3.3.1",
|
|
50
|
+
"@radix-ui/react-label": "^2.0.2",
|
|
51
|
+
"@radix-ui/react-separator": "^1.0.3",
|
|
52
|
+
"@radix-ui/react-slot": "^1.0.2"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@types/react": "^18.2.15",
|
|
56
|
+
"@types/react-dom": "^18.2.7",
|
|
57
|
+
"@types/node": "^20.8.0",
|
|
58
|
+
"@typescript-eslint/eslint-plugin": "^6.7.4",
|
|
59
|
+
"@typescript-eslint/parser": "^6.7.4",
|
|
60
|
+
"autoprefixer": "^10.4.21",
|
|
61
|
+
"css-loader": "^6.8.1",
|
|
62
|
+
"eslint": "^8.51.0",
|
|
63
|
+
"postcss": "^8.5.6",
|
|
64
|
+
"postcss-loader": "^7.3.3",
|
|
65
|
+
"style-loader": "^3.3.3",
|
|
66
|
+
"tailwindcss": "^3.4.17",
|
|
67
|
+
"terser-webpack-plugin": "^5.3.9",
|
|
68
|
+
"ts-loader": "^9.4.2",
|
|
69
|
+
"tsup": "^7.2.0",
|
|
70
|
+
"typescript": "^5.2.2",
|
|
71
|
+
"webpack": "^5.80.0",
|
|
72
|
+
"webpack-cli": "^5.0.2",
|
|
73
|
+
"webpack-dev-server": "^4.13.3",
|
|
74
|
+
"react": "^18.2.0",
|
|
75
|
+
"react-dom": "^18.2.0"
|
|
76
|
+
},
|
|
77
|
+
"publishConfig": {
|
|
78
|
+
"access": "public",
|
|
79
|
+
"registry": "https://registry.npmjs.org/"
|
|
80
|
+
},
|
|
81
|
+
"engines": {
|
|
82
|
+
"node": ">=14.0.0"
|
|
83
|
+
}
|
|
84
|
+
}
|