@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.
Files changed (255) hide show
  1. package/dist/components/identity/IdentityBar.d.ts +8 -0
  2. package/dist/components/identity/IdentityBar.d.ts.map +1 -0
  3. package/dist/components/order/OrderSummaryAccordion.d.ts +9 -0
  4. package/dist/components/order/OrderSummaryAccordion.d.ts.map +1 -0
  5. package/dist/components/order/ShipmentCard.d.ts +8 -0
  6. package/dist/components/order/ShipmentCard.d.ts.map +1 -0
  7. package/dist/components/payos/ActiveCardWidget.d.ts +55 -0
  8. package/dist/components/payos/ActiveCardWidget.d.ts.map +1 -0
  9. package/dist/components/payos/PayOSFooter.d.ts +24 -0
  10. package/dist/components/payos/PayOSFooter.d.ts.map +1 -0
  11. package/dist/components/payos/PaymentMethodRow.d.ts +53 -0
  12. package/dist/components/payos/PaymentMethodRow.d.ts.map +1 -0
  13. package/dist/components/payos/PaymentSheet.d.ts +32 -0
  14. package/dist/components/payos/PaymentSheet.d.ts.map +1 -0
  15. package/dist/components/payos/PriceTag.d.ts +64 -0
  16. package/dist/components/payos/PriceTag.d.ts.map +1 -0
  17. package/dist/components/payos/ReceiptPanel.d.ts +67 -0
  18. package/dist/components/payos/ReceiptPanel.d.ts.map +1 -0
  19. package/dist/components/payos/ViewHeader.d.ts +40 -0
  20. package/dist/components/payos/ViewHeader.d.ts.map +1 -0
  21. package/dist/components/payos/drawer.d.ts +98 -0
  22. package/dist/components/payos/drawer.d.ts.map +1 -0
  23. package/dist/components/payos/order-summary.d.ts +44 -0
  24. package/dist/components/payos/order-summary.d.ts.map +1 -0
  25. package/dist/components/payos/otp-input.d.ts +37 -0
  26. package/dist/components/payos/otp-input.d.ts.map +1 -0
  27. package/dist/components/payos/phone-input.d.ts +107 -0
  28. package/dist/components/payos/phone-input.d.ts.map +1 -0
  29. package/dist/components/payos/views/AgentRegistrationView.d.ts +58 -0
  30. package/dist/components/payos/views/AgentRegistrationView.d.ts.map +1 -0
  31. package/dist/components/payos/views/CardAddView.d.ts +78 -0
  32. package/dist/components/payos/views/CardAddView.d.ts.map +1 -0
  33. package/dist/components/payos/views/CheckoutView.d.ts +80 -0
  34. package/dist/components/payos/views/CheckoutView.d.ts.map +1 -0
  35. package/dist/components/payos/views/IdentityView.d.ts +43 -0
  36. package/dist/components/payos/views/IdentityView.d.ts.map +1 -0
  37. package/dist/components/payos/views/MethodListView.d.ts +52 -0
  38. package/dist/components/payos/views/MethodListView.d.ts.map +1 -0
  39. package/dist/components/payos/views/OTPView.d.ts +54 -0
  40. package/dist/components/payos/views/OTPView.d.ts.map +1 -0
  41. package/dist/components/payos/views/SuccessView.d.ts +49 -0
  42. package/dist/components/payos/views/SuccessView.d.ts.map +1 -0
  43. package/dist/components/payos/views/VisaIframeView.d.ts +19 -0
  44. package/dist/components/payos/views/VisaIframeView.d.ts.map +1 -0
  45. package/dist/components/payos/views/VisaMethodView.d.ts +35 -0
  46. package/dist/components/payos/views/VisaMethodView.d.ts.map +1 -0
  47. package/dist/components/payos/views/VisaOtpView.d.ts +45 -0
  48. package/dist/components/payos/views/VisaOtpView.d.ts.map +1 -0
  49. package/dist/components/payos/views/WelcomeBackView.d.ts +34 -0
  50. package/dist/components/payos/views/WelcomeBackView.d.ts.map +1 -0
  51. package/dist/components/ui/CardBrandIcon.d.ts +10 -0
  52. package/dist/components/ui/CardBrandIcon.d.ts.map +1 -0
  53. package/dist/components/ui/ConfirmDialog.d.ts +25 -0
  54. package/dist/components/ui/ConfirmDialog.d.ts.map +1 -0
  55. package/dist/components/ui/InfoTooltip.d.ts +8 -0
  56. package/dist/components/ui/InfoTooltip.d.ts.map +1 -0
  57. package/dist/components/ui/PinInput.d.ts +12 -0
  58. package/dist/components/ui/PinInput.d.ts.map +1 -0
  59. package/dist/components/ui/button.d.ts +14 -0
  60. package/dist/components/ui/button.d.ts.map +1 -0
  61. package/dist/components/ui/card.d.ts +15 -0
  62. package/dist/components/ui/card.d.ts.map +1 -0
  63. package/dist/components/ui/input.d.ts +6 -0
  64. package/dist/components/ui/input.d.ts.map +1 -0
  65. package/dist/components/ui/label.d.ts +6 -0
  66. package/dist/components/ui/label.d.ts.map +1 -0
  67. package/dist/components/ui/separator.d.ts +5 -0
  68. package/dist/components/ui/separator.d.ts.map +1 -0
  69. package/dist/hooks/index.d.ts +8 -0
  70. package/dist/hooks/index.d.ts.map +1 -0
  71. package/dist/hooks/useBodyScrollLock.d.ts +32 -0
  72. package/dist/hooks/useBodyScrollLock.d.ts.map +1 -0
  73. package/dist/hooks/useCardElement.d.ts +123 -0
  74. package/dist/hooks/useCardElement.d.ts.map +1 -0
  75. package/dist/hooks/useCheckoutFlow.d.ts +29 -0
  76. package/dist/hooks/useCheckoutFlow.d.ts.map +1 -0
  77. package/dist/hooks/useDrawerState.d.ts +4 -0
  78. package/dist/hooks/useDrawerState.d.ts.map +1 -0
  79. package/dist/hooks/usePasskeySDK.d.ts +99 -0
  80. package/dist/hooks/usePasskeySDK.d.ts.map +1 -0
  81. package/dist/hooks/useSession.d.ts +68 -0
  82. package/dist/hooks/useSession.d.ts.map +1 -0
  83. package/dist/hooks/useVisualViewport.d.ts +15 -0
  84. package/dist/hooks/useVisualViewport.d.ts.map +1 -0
  85. package/dist/index.css +1 -0
  86. package/dist/index.d.ts +43 -0
  87. package/dist/index.d.ts.map +1 -0
  88. package/dist/lib/theme.d.ts +53 -0
  89. package/dist/lib/theme.d.ts.map +1 -0
  90. package/dist/lib/utils.d.ts +3 -0
  91. package/dist/lib/utils.d.ts.map +1 -0
  92. package/dist/mocks/index.d.ts +3 -0
  93. package/dist/mocks/index.d.ts.map +1 -0
  94. package/dist/mocks/mockCheckoutFlow.d.ts +25 -0
  95. package/dist/mocks/mockCheckoutFlow.d.ts.map +1 -0
  96. package/dist/mocks/mockData.d.ts +6 -0
  97. package/dist/mocks/mockData.d.ts.map +1 -0
  98. package/dist/mocks/mockSessionData.d.ts +38 -0
  99. package/dist/mocks/mockSessionData.d.ts.map +1 -0
  100. package/dist/payos-react.css +1 -0
  101. package/dist/payos-react.esm.js +23 -0
  102. package/dist/payos-react.min.js +1 -0
  103. package/dist/services/apiService.d.ts +297 -0
  104. package/dist/services/apiService.d.ts.map +1 -0
  105. package/dist/services/linkTokenService.d.ts +27 -0
  106. package/dist/services/linkTokenService.d.ts.map +1 -0
  107. package/dist/services/mockSessionService.d.ts +78 -0
  108. package/dist/services/mockSessionService.d.ts.map +1 -0
  109. package/dist/types/cardElement.d.ts +138 -0
  110. package/dist/types/cardElement.d.ts.map +1 -0
  111. package/dist/types/components/identity/IdentityBar.d.ts +8 -0
  112. package/dist/types/components/identity/IdentityBar.d.ts.map +1 -0
  113. package/dist/types/components/order/OrderSummaryAccordion.d.ts +9 -0
  114. package/dist/types/components/order/OrderSummaryAccordion.d.ts.map +1 -0
  115. package/dist/types/components/order/ShipmentCard.d.ts +8 -0
  116. package/dist/types/components/order/ShipmentCard.d.ts.map +1 -0
  117. package/dist/types/components/payos/ActiveCardWidget.d.ts +55 -0
  118. package/dist/types/components/payos/ActiveCardWidget.d.ts.map +1 -0
  119. package/dist/types/components/payos/PayOSFooter.d.ts +24 -0
  120. package/dist/types/components/payos/PayOSFooter.d.ts.map +1 -0
  121. package/dist/types/components/payos/PaymentMethodRow.d.ts +53 -0
  122. package/dist/types/components/payos/PaymentMethodRow.d.ts.map +1 -0
  123. package/dist/types/components/payos/PaymentSheet.d.ts +32 -0
  124. package/dist/types/components/payos/PaymentSheet.d.ts.map +1 -0
  125. package/dist/types/components/payos/PriceTag.d.ts +64 -0
  126. package/dist/types/components/payos/PriceTag.d.ts.map +1 -0
  127. package/dist/types/components/payos/ReceiptPanel.d.ts +67 -0
  128. package/dist/types/components/payos/ReceiptPanel.d.ts.map +1 -0
  129. package/dist/types/components/payos/ViewHeader.d.ts +40 -0
  130. package/dist/types/components/payos/ViewHeader.d.ts.map +1 -0
  131. package/dist/types/components/payos/drawer.d.ts +98 -0
  132. package/dist/types/components/payos/drawer.d.ts.map +1 -0
  133. package/dist/types/components/payos/order-summary.d.ts +44 -0
  134. package/dist/types/components/payos/order-summary.d.ts.map +1 -0
  135. package/dist/types/components/payos/otp-input.d.ts +37 -0
  136. package/dist/types/components/payos/otp-input.d.ts.map +1 -0
  137. package/dist/types/components/payos/phone-input.d.ts +107 -0
  138. package/dist/types/components/payos/phone-input.d.ts.map +1 -0
  139. package/dist/types/components/payos/views/AgentRegistrationView.d.ts +58 -0
  140. package/dist/types/components/payos/views/AgentRegistrationView.d.ts.map +1 -0
  141. package/dist/types/components/payos/views/CardAddView.d.ts +78 -0
  142. package/dist/types/components/payos/views/CardAddView.d.ts.map +1 -0
  143. package/dist/types/components/payos/views/CheckoutView.d.ts +80 -0
  144. package/dist/types/components/payos/views/CheckoutView.d.ts.map +1 -0
  145. package/dist/types/components/payos/views/IdentityView.d.ts +43 -0
  146. package/dist/types/components/payos/views/IdentityView.d.ts.map +1 -0
  147. package/dist/types/components/payos/views/MethodListView.d.ts +52 -0
  148. package/dist/types/components/payos/views/MethodListView.d.ts.map +1 -0
  149. package/dist/types/components/payos/views/OTPView.d.ts +54 -0
  150. package/dist/types/components/payos/views/OTPView.d.ts.map +1 -0
  151. package/dist/types/components/payos/views/SuccessView.d.ts +49 -0
  152. package/dist/types/components/payos/views/SuccessView.d.ts.map +1 -0
  153. package/dist/types/components/payos/views/VisaIframeView.d.ts +19 -0
  154. package/dist/types/components/payos/views/VisaIframeView.d.ts.map +1 -0
  155. package/dist/types/components/payos/views/VisaMethodView.d.ts +35 -0
  156. package/dist/types/components/payos/views/VisaMethodView.d.ts.map +1 -0
  157. package/dist/types/components/payos/views/VisaOtpView.d.ts +45 -0
  158. package/dist/types/components/payos/views/VisaOtpView.d.ts.map +1 -0
  159. package/dist/types/components/payos/views/WelcomeBackView.d.ts +34 -0
  160. package/dist/types/components/payos/views/WelcomeBackView.d.ts.map +1 -0
  161. package/dist/types/components/ui/CardBrandIcon.d.ts +10 -0
  162. package/dist/types/components/ui/CardBrandIcon.d.ts.map +1 -0
  163. package/dist/types/components/ui/ConfirmDialog.d.ts +25 -0
  164. package/dist/types/components/ui/ConfirmDialog.d.ts.map +1 -0
  165. package/dist/types/components/ui/InfoTooltip.d.ts +8 -0
  166. package/dist/types/components/ui/InfoTooltip.d.ts.map +1 -0
  167. package/dist/types/components/ui/PinInput.d.ts +12 -0
  168. package/dist/types/components/ui/PinInput.d.ts.map +1 -0
  169. package/dist/types/components/ui/button.d.ts +14 -0
  170. package/dist/types/components/ui/button.d.ts.map +1 -0
  171. package/dist/types/components/ui/card.d.ts +15 -0
  172. package/dist/types/components/ui/card.d.ts.map +1 -0
  173. package/dist/types/components/ui/input.d.ts +6 -0
  174. package/dist/types/components/ui/input.d.ts.map +1 -0
  175. package/dist/types/components/ui/label.d.ts +6 -0
  176. package/dist/types/components/ui/label.d.ts.map +1 -0
  177. package/dist/types/components/ui/separator.d.ts +5 -0
  178. package/dist/types/components/ui/separator.d.ts.map +1 -0
  179. package/dist/types/drawer.d.ts +33 -0
  180. package/dist/types/drawer.d.ts.map +1 -0
  181. package/dist/types/hooks/index.d.ts +8 -0
  182. package/dist/types/hooks/index.d.ts.map +1 -0
  183. package/dist/types/hooks/useBodyScrollLock.d.ts +32 -0
  184. package/dist/types/hooks/useBodyScrollLock.d.ts.map +1 -0
  185. package/dist/types/hooks/useCardElement.d.ts +123 -0
  186. package/dist/types/hooks/useCardElement.d.ts.map +1 -0
  187. package/dist/types/hooks/useCheckoutFlow.d.ts +29 -0
  188. package/dist/types/hooks/useCheckoutFlow.d.ts.map +1 -0
  189. package/dist/types/hooks/useDrawerState.d.ts +4 -0
  190. package/dist/types/hooks/useDrawerState.d.ts.map +1 -0
  191. package/dist/types/hooks/usePasskeySDK.d.ts +99 -0
  192. package/dist/types/hooks/usePasskeySDK.d.ts.map +1 -0
  193. package/dist/types/hooks/useSession.d.ts +68 -0
  194. package/dist/types/hooks/useSession.d.ts.map +1 -0
  195. package/dist/types/hooks/useVisualViewport.d.ts +15 -0
  196. package/dist/types/hooks/useVisualViewport.d.ts.map +1 -0
  197. package/dist/types/index.d.ts +43 -0
  198. package/dist/types/index.d.ts.map +1 -0
  199. package/dist/types/lib/theme.d.ts +53 -0
  200. package/dist/types/lib/theme.d.ts.map +1 -0
  201. package/dist/types/lib/utils.d.ts +3 -0
  202. package/dist/types/lib/utils.d.ts.map +1 -0
  203. package/dist/types/mocks/index.d.ts +3 -0
  204. package/dist/types/mocks/index.d.ts.map +1 -0
  205. package/dist/types/mocks/mockCheckoutFlow.d.ts +25 -0
  206. package/dist/types/mocks/mockCheckoutFlow.d.ts.map +1 -0
  207. package/dist/types/mocks/mockData.d.ts +6 -0
  208. package/dist/types/mocks/mockData.d.ts.map +1 -0
  209. package/dist/types/mocks/mockSessionData.d.ts +38 -0
  210. package/dist/types/mocks/mockSessionData.d.ts.map +1 -0
  211. package/dist/types/order.d.ts +25 -0
  212. package/dist/types/order.d.ts.map +1 -0
  213. package/dist/types/payment.d.ts +52 -0
  214. package/dist/types/payment.d.ts.map +1 -0
  215. package/dist/types/services/apiService.d.ts +297 -0
  216. package/dist/types/services/apiService.d.ts.map +1 -0
  217. package/dist/types/services/linkTokenService.d.ts +27 -0
  218. package/dist/types/services/linkTokenService.d.ts.map +1 -0
  219. package/dist/types/services/mockSessionService.d.ts +78 -0
  220. package/dist/types/services/mockSessionService.d.ts.map +1 -0
  221. package/dist/types/session.d.ts +148 -0
  222. package/dist/types/session.d.ts.map +1 -0
  223. package/dist/types/types/cardElement.d.ts +138 -0
  224. package/dist/types/types/cardElement.d.ts.map +1 -0
  225. package/dist/types/types/drawer.d.ts +33 -0
  226. package/dist/types/types/drawer.d.ts.map +1 -0
  227. package/dist/types/types/index.d.ts +4 -0
  228. package/dist/types/types/index.d.ts.map +1 -0
  229. package/dist/types/types/order.d.ts +25 -0
  230. package/dist/types/types/order.d.ts.map +1 -0
  231. package/dist/types/types/payment.d.ts +52 -0
  232. package/dist/types/types/payment.d.ts.map +1 -0
  233. package/dist/types/types/session.d.ts +148 -0
  234. package/dist/types/types/session.d.ts.map +1 -0
  235. package/dist/types/utils/deviceFingerprint.d.ts +27 -0
  236. package/dist/types/utils/deviceFingerprint.d.ts.map +1 -0
  237. package/dist/types/utils/environment.d.ts +22 -0
  238. package/dist/types/utils/environment.d.ts.map +1 -0
  239. package/dist/types/utils/formatting.d.ts +38 -0
  240. package/dist/types/utils/formatting.d.ts.map +1 -0
  241. package/dist/types/utils/index.d.ts +3 -0
  242. package/dist/types/utils/index.d.ts.map +1 -0
  243. package/dist/types/utils/validation.d.ts +52 -0
  244. package/dist/types/utils/validation.d.ts.map +1 -0
  245. package/dist/utils/deviceFingerprint.d.ts +27 -0
  246. package/dist/utils/deviceFingerprint.d.ts.map +1 -0
  247. package/dist/utils/environment.d.ts +22 -0
  248. package/dist/utils/environment.d.ts.map +1 -0
  249. package/dist/utils/formatting.d.ts +38 -0
  250. package/dist/utils/formatting.d.ts.map +1 -0
  251. package/dist/utils/index.d.ts +3 -0
  252. package/dist/utils/index.d.ts.map +1 -0
  253. package/dist/utils/validation.d.ts +52 -0
  254. package/dist/utils/validation.d.ts.map +1 -0
  255. 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,3 @@
1
+ export * from './formatting';
2
+ export * from './validation';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -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,3 @@
1
+ export * from './formatting';
2
+ export * from './validation';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -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
+ }