@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,6 @@
1
+ import * as React from "react";
2
+ export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
3
+ }
4
+ declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
5
+ export { Input };
6
+ //# sourceMappingURL=input.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,MAAM,WAAW,UACf,SAAQ,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC;CAAG;AAExD,QAAA,MAAM,KAAK,qFAeV,CAAC;AAGF,OAAO,EAAE,KAAK,EAAE,CAAC"}
@@ -0,0 +1,6 @@
1
+ import * as React from "react";
2
+ import * as LabelPrimitive from "@radix-ui/react-label";
3
+ import { type VariantProps } from "class-variance-authority";
4
+ declare const Label: React.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & VariantProps<(props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string> & React.RefAttributes<HTMLLabelElement>>;
5
+ export { Label };
6
+ //# sourceMappingURL=label.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"label.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/label.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,cAAc,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAQlE,QAAA,MAAM,KAAK,iQAUT,CAAC;AAGH,OAAO,EAAE,KAAK,EAAE,CAAC"}
@@ -0,0 +1,5 @@
1
+ import * as React from "react";
2
+ import * as SeparatorPrimitive from "@radix-ui/react-separator";
3
+ declare const Separator: React.ForwardRefExoticComponent<Omit<SeparatorPrimitive.SeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
4
+ export { Separator };
5
+ //# sourceMappingURL=separator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"separator.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/separator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,kBAAkB,MAAM,2BAA2B,CAAC;AAIhE,QAAA,MAAM,SAAS,6JAoBd,CAAC;AAGF,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -0,0 +1,33 @@
1
+ import type { OrderItem } from './order';
2
+ import type { SavedCard } from './payment';
3
+ export type PaymentMode = 'standard' | 'agent';
4
+ export interface PayOSDrawerProps {
5
+ open: boolean;
6
+ onClose: () => void;
7
+ mode?: PaymentMode;
8
+ amount: number;
9
+ orderItems?: OrderItem[];
10
+ shipping?: number;
11
+ tax?: number;
12
+ agentFee?: number;
13
+ savedCards?: SavedCard[];
14
+ onSuccess?: (result: PaymentResult) => void;
15
+ onError?: (error: PaymentError) => void;
16
+ onDeleteCard?: (cardId: string) => void;
17
+ merchantName?: string;
18
+ accentColor?: string;
19
+ locale?: string;
20
+ }
21
+ export interface PaymentResult {
22
+ success: boolean;
23
+ transactionId: string;
24
+ amount: number;
25
+ cardLast4?: string;
26
+ timestamp: number;
27
+ }
28
+ export interface PaymentError {
29
+ code: string;
30
+ message: string;
31
+ details?: Record<string, unknown>;
32
+ }
33
+ //# sourceMappingURL=drawer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../src/types/drawer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,OAAO,CAAC;AAE/C,MAAM,WAAW,gBAAgB;IAE/B,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IAGpB,IAAI,CAAC,EAAE,WAAW,CAAC;IAGnB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;IAGzB,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,CAAC;IAC5C,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;IACxC,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAGxC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC"}
@@ -0,0 +1,8 @@
1
+ export * from './useCheckoutFlow';
2
+ export * from './useDrawerState';
3
+ export * from './useVisualViewport';
4
+ export * from './useBodyScrollLock';
5
+ export * from './useCardElement';
6
+ export * from './useSession';
7
+ export * from './usePasskeySDK';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * useBodyScrollLock - Prevent body scroll and rubber banding on mobile
3
+ *
4
+ * This hook prevents scroll bleed to the background when a modal/drawer is open.
5
+ * It uses multiple techniques to handle iOS Safari quirks:
6
+ *
7
+ * 1. Sets `overflow: hidden` to prevent scroll
8
+ * 2. Sets `position: fixed` to prevent iOS elastic scrolling (rubber banding)
9
+ * 3. Preserves scroll position by setting `top: -scrollY`
10
+ * 4. Optionally sets `touch-action: none` for additional touch prevention
11
+ *
12
+ * **iOS Safari Issues Addressed:**
13
+ * - Scroll bleed: Background scrolling while drawer is open
14
+ * - Rubber banding: Elastic/bouncy overscroll effect
15
+ * - Layout shift: Maintains width to prevent content jump
16
+ *
17
+ * @param isLocked - Whether scroll should be locked
18
+ * @param options - Configuration options
19
+ * @param options.preventTouch - Whether to prevent all touch actions (default: false)
20
+ *
21
+ * @example
22
+ * ```tsx
23
+ * function Drawer({ open }) {
24
+ * useBodyScrollLock(open);
25
+ * // Body scroll is now locked when drawer is open
26
+ * }
27
+ * ```
28
+ */
29
+ export declare function useBodyScrollLock(isLocked: boolean, options?: {
30
+ preventTouch?: boolean;
31
+ }): void;
32
+ //# sourceMappingURL=useBodyScrollLock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useBodyScrollLock.d.ts","sourceRoot":"","sources":["../../../src/hooks/useBodyScrollLock.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,OAAO,EACjB,OAAO,GAAE;IAAE,YAAY,CAAC,EAAE,OAAO,CAAA;CAAO,GACvC,IAAI,CAuCN"}
@@ -0,0 +1,123 @@
1
+ import { CardElementOptions, CardElementStyles, CardElementConfiguration, CardElementTokenizedEvent, CardElementChangeEvent } from '../types/cardElement';
2
+ /**
3
+ * Options for the useCardElement hook
4
+ */
5
+ export interface UseCardElementOptions {
6
+ /**
7
+ * Link token for CardElement initialization (required)
8
+ */
9
+ token: string;
10
+ /**
11
+ * Target environment
12
+ */
13
+ environment?: 'sandbox' | 'production';
14
+ /**
15
+ * Optional custom styles for secure fields
16
+ */
17
+ styles?: CardElementStyles;
18
+ /**
19
+ * Optional height override for the iframe
20
+ */
21
+ height?: string;
22
+ /**
23
+ * Custom base URL override for non-standard environments
24
+ */
25
+ customBaseUrl?: string;
26
+ /**
27
+ * Custom query params for testing
28
+ */
29
+ customParams?: Record<string, string>;
30
+ /**
31
+ * Callback fired when card is tokenized successfully
32
+ */
33
+ onTokenized?: (event: CardElementTokenizedEvent) => void;
34
+ /**
35
+ * Callback fired when iframe is ready
36
+ */
37
+ onReady?: () => void;
38
+ /**
39
+ * Callback fired on error
40
+ */
41
+ onError?: (error: Error) => void;
42
+ /**
43
+ * Callback fired when form fields change
44
+ */
45
+ onChange?: (event: CardElementChangeEvent) => void;
46
+ /**
47
+ * Callback fired when user cancels the flow
48
+ */
49
+ onCancel?: () => void;
50
+ }
51
+ /**
52
+ * Return type for the useCardElement hook
53
+ */
54
+ export interface UseCardElementReturn {
55
+ /**
56
+ * Ref to attach to the container element
57
+ */
58
+ containerRef: React.RefObject<HTMLDivElement>;
59
+ /**
60
+ * Whether the CardElement iframe is ready
61
+ */
62
+ isReady: boolean;
63
+ /**
64
+ * Whether the form is complete (all required fields valid)
65
+ */
66
+ isComplete: boolean;
67
+ /**
68
+ * Whether the form is empty (no fields have values)
69
+ */
70
+ isEmpty: boolean;
71
+ /**
72
+ * Current error message if any
73
+ */
74
+ error: string | undefined;
75
+ /**
76
+ * Trigger form submission (tokenization)
77
+ */
78
+ submit: () => void;
79
+ /**
80
+ * Configure the CardElement with additional data
81
+ * (walletUserId, cardholderName, billingAddress)
82
+ */
83
+ configure: (config: CardElementConfiguration) => void;
84
+ /**
85
+ * Update styles dynamically
86
+ */
87
+ updateStyles: (styles: CardElementStyles) => void;
88
+ }
89
+ /**
90
+ * React hook to manage the CardElementClient lifecycle
91
+ *
92
+ * Handles mounting/unmounting the iframe, message communication,
93
+ * and provides React-friendly state and callbacks.
94
+ *
95
+ * @example
96
+ * ```tsx
97
+ * const { containerRef, isReady, isComplete, submit } = useCardElement({
98
+ * token: session.linkToken,
99
+ * onTokenized: (event) => {
100
+ * console.log('Card tokenized:', event.card);
101
+ * addPaymentCard({
102
+ * cardId: event.card?.id || '',
103
+ * last4: event.card?.last4 || '',
104
+ * brand: event.card?.brand || 'unknown',
105
+ * network: event.card?.brand || 'unknown',
106
+ * cardArtUrl: event.card?.artwork,
107
+ * });
108
+ * },
109
+ * });
110
+ *
111
+ * return (
112
+ * <div>
113
+ * <div ref={containerRef} style={{ minHeight: 400 }} />
114
+ * <button onClick={submit} disabled={!isComplete}>
115
+ * Add Card
116
+ * </button>
117
+ * </div>
118
+ * );
119
+ * ```
120
+ */
121
+ export declare function useCardElement(options: UseCardElementOptions): UseCardElementReturn;
122
+ export type { CardElementOptions, CardElementStyles, CardElementConfiguration, CardElementTokenizedEvent, CardElementChangeEvent, };
123
+ //# sourceMappingURL=useCardElement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCardElement.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCardElement.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,kBAAkB,EAClB,iBAAiB,EACjB,wBAAwB,EACxB,yBAAyB,EACzB,sBAAsB,EACvB,MAAM,sBAAsB,CAAC;AAE9B;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,WAAW,CAAC,EAAE,SAAS,GAAG,YAAY,CAAC;IAEvC;;OAEG;IACH,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAE3B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEtC;;OAEG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,yBAAyB,KAAK,IAAI,CAAC;IAEzD;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAErB;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAEjC;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,IAAI,CAAC;IAEnD;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAE9C;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,UAAU,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAE1B;;OAEG;IACH,MAAM,EAAE,MAAM,IAAI,CAAC;IAEnB;;;OAGG;IACH,SAAS,EAAE,CAAC,MAAM,EAAE,wBAAwB,KAAK,IAAI,CAAC;IAEtD;;OAEG;IACH,YAAY,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,IAAI,CAAC;CACnD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,oBAAoB,CAiInF;AAGD,YAAY,EACV,kBAAkB,EAClB,iBAAiB,EACjB,wBAAwB,EACxB,yBAAyB,EACzB,sBAAsB,GACvB,CAAC"}
@@ -0,0 +1,29 @@
1
+ import type { CheckoutState, CardData, BillingAddress, SavedCard, PaymentView } from '../types';
2
+ interface UseCheckoutFlowProps {
3
+ mode: 'standard' | 'agent';
4
+ amount: number;
5
+ savedCards?: SavedCard[];
6
+ onSuccess?: (result: any) => void;
7
+ onError?: (error: any) => void;
8
+ }
9
+ export declare function useCheckoutFlow({ mode, amount, savedCards, onSuccess, onError }: UseCheckoutFlowProps): {
10
+ state: CheckoutState;
11
+ selectedCardId: string | null;
12
+ paymentView: PaymentView;
13
+ cvc: string;
14
+ setCvc: import("react").Dispatch<import("react").SetStateAction<string>>;
15
+ submitPhone: (phone: string) => Promise<void>;
16
+ verifyOTP: (otp: string) => Promise<void>;
17
+ submitPayment: (email: string, cardData: CardData, billingAddress: BillingAddress | null) => Promise<void>;
18
+ selectCard: (cardId: string) => void;
19
+ addCard: (cardData: CardData) => Promise<void>;
20
+ logout: () => void;
21
+ setError: (error: string | null) => void;
22
+ showMethodList: () => void;
23
+ showAddCard: () => void;
24
+ returnToCheckout: () => void;
25
+ skipToPayment: () => void;
26
+ completeAgentRegistration: () => void;
27
+ };
28
+ export {};
29
+ //# sourceMappingURL=useCheckoutFlow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCheckoutFlow.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCheckoutFlow.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,cAAc,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAGhG,UAAU,oBAAoB;IAC5B,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;IACzB,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC;IAClC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;CAChC;AAED,wBAAgB,eAAe,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,oBAAoB;;;;;;yBAkCtD,MAAM;qBAmBV,MAAM;2BAmCvC,MAAM,YACH,QAAQ,kBACF,cAAc,GAAG,IAAI;yBAuCC,MAAM;wBAOD,QAAQ;;sBA/GhB,MAAM,GAAG,IAAI;;;;;;EAuOnD"}
@@ -0,0 +1,4 @@
1
+ export declare function useDrawerState(open: boolean, onClose: () => void): {
2
+ isMobile: boolean;
3
+ };
4
+ //# sourceMappingURL=useDrawerState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDrawerState.d.ts","sourceRoot":"","sources":["../../../src/hooks/useDrawerState.ts"],"names":[],"mappings":"AAEA,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI;;EA6ChE"}
@@ -0,0 +1,99 @@
1
+ /**
2
+ * usePasskeySDK Hook
3
+ *
4
+ * Manages the PayOS Passkey SDK lifecycle and exposes passkey operations
5
+ * for registration and authentication flows.
6
+ */
7
+ import { PayOSPasskey, RegisterResult, PasskeyResult, OTPSubmitResult } from '@payos-inc/payos-passkey-js';
8
+ /**
9
+ * Step-up verification method (for Visa OTP flow)
10
+ */
11
+ export interface StepUpMethod {
12
+ id: string;
13
+ type: 'sms' | 'email';
14
+ maskedValue: string;
15
+ }
16
+ /**
17
+ * Configuration options for the passkey SDK hook
18
+ */
19
+ export interface UsePasskeySDKOptions {
20
+ /** Session secret (JWT) - used as linkToken for the SDK */
21
+ sessionSecret: string;
22
+ /** Use sandbox environment */
23
+ sandbox?: boolean;
24
+ /** Enable debug logging */
25
+ debug?: boolean;
26
+ /** Container ID for Visa iframe placement */
27
+ visaContainerId?: string;
28
+ /** Backend API base URL (e.g., http://localhost:3001 or ngrok tunnel) */
29
+ apiBaseUrl?: string;
30
+ }
31
+ /**
32
+ * Internal state for passkey operations
33
+ */
34
+ export interface PasskeyState {
35
+ /** Current enrollment ID (for Visa step-up flow) */
36
+ enrollmentId: string | null;
37
+ /** Available step-up methods (Visa) */
38
+ stepUpMethods: StepUpMethod[];
39
+ /** Selected method description (e.g., "***-***-1234") */
40
+ selectedMethodDescription: string | null;
41
+ /** Loading state */
42
+ isLoading: boolean;
43
+ /** Error message */
44
+ error: string | null;
45
+ /** Whether user can retry OTP (false = locked out) */
46
+ canRetry: boolean;
47
+ /** Number of OTP attempts remaining */
48
+ attemptsRemaining?: number;
49
+ }
50
+ /**
51
+ * Return type for usePasskeySDK hook
52
+ */
53
+ export interface UsePasskeySDKReturn {
54
+ /** SDK instance (for advanced use) */
55
+ sdk: PayOSPasskey | null;
56
+ /** Whether SDK is ready for operations */
57
+ isReady: boolean;
58
+ /** Current state */
59
+ state: PasskeyState;
60
+ /** Start registration flow for a card */
61
+ startRegistration: (cardId: string) => Promise<RegisterResult>;
62
+ /** Select step-up method (Visa) - sends OTP */
63
+ selectStepUpMethod: (methodIndex: number) => Promise<OTPSubmitResult>;
64
+ /** Submit OTP for Visa step-up verification (returns registrationContext on success) */
65
+ submitVisaOtp: (otp: string) => Promise<PasskeyResult>;
66
+ /** Complete Visa registration after iframe container is rendered */
67
+ completeVisaRegistration: (registrationContext: any) => Promise<PasskeyResult>;
68
+ /** Authenticate a payment */
69
+ authenticate: (paymentIntentId: string, paymentId?: string) => Promise<PasskeyResult>;
70
+ /** Clear current error */
71
+ clearError: () => void;
72
+ /** Reset state (for restarting flows) */
73
+ resetState: () => void;
74
+ /** Cleanup SDK resources */
75
+ cleanup: () => void;
76
+ }
77
+ /**
78
+ * Hook for managing PayOS Passkey SDK operations
79
+ *
80
+ * @example
81
+ * ```tsx
82
+ * const passkey = usePasskeySDK({
83
+ * sessionSecret: session.secret,
84
+ * sandbox: true,
85
+ * debug: true,
86
+ * });
87
+ *
88
+ * // Registration
89
+ * const result = await passkey.startRegistration(cardId);
90
+ * if (result.requiresStepUp) {
91
+ * // Show Visa OTP flow
92
+ * }
93
+ *
94
+ * // Authentication
95
+ * const authResult = await passkey.authenticate(paymentIntentId);
96
+ * ```
97
+ */
98
+ export declare function usePasskeySDK(options: UsePasskeySDKOptions): UsePasskeySDKReturn;
99
+ //# sourceMappingURL=usePasskeySDK.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePasskeySDK.d.ts","sourceRoot":"","sources":["../../../src/hooks/usePasskeySDK.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACL,YAAY,EACZ,cAAc,EACd,aAAa,EACb,eAAe,EAChB,MAAM,6BAA6B,CAAC;AAErC;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MA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,OAAO,CAAC,aAAa,CAAC,CAAC;IACvD,oEAAoE;IACpE,wBAAwB,EAAE,CAAC,mBAAmB,EAAE,GAAG,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;IAE/E,6BAA6B;IAC7B,YAAY,EAAE,CAAC,eAAe,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;IAEtF,0BAA0B;IAC1B,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,yCAAyC;IACzC,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,4BAA4B;IAC5B,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAYD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,mBAAmB,CA4RhF"}
@@ -0,0 +1,68 @@
1
+ import { CheckoutSession, VerificationResult, CompletionResult, SavedCard, PaymentSheetError } from '../types/session';
2
+ import { PaymentView } from '../types/payment';
3
+ export type SessionPhase = 'LOADING' | 'ERROR' | 'IDENTITY' | 'OTP_VERIFY' | 'PAYMENT' | 'AGENT_REGISTRATION' | 'PROCESSING' | 'SUCCESS' | 'EXPIRED';
4
+ /**
5
+ * Sub-phases for passkey registration flow (within AGENT_REGISTRATION)
6
+ * - 'initial': Show AgentRegistrationView with "Create Passkey" button
7
+ * - 'visa_method_select': Show VisaMethodView to select OTP method
8
+ * - 'visa_otp_entry': Show VisaOtpView to enter OTP code
9
+ * - 'visa_iframe': Show VisaIframeView with SDK iframe after OTP validates
10
+ */
11
+ export type RegistrationSubPhase = 'initial' | 'visa_method_select' | 'visa_otp_entry' | 'visa_iframe';
12
+ export type { PaymentView } from '../types/payment';
13
+ export interface UseSessionReturn {
14
+ session: CheckoutSession | null;
15
+ phase: SessionPhase;
16
+ loading: boolean;
17
+ error: PaymentSheetError | null;
18
+ isAgentMode: boolean;
19
+ hasSelectedCard: boolean;
20
+ hasSavedCards: boolean;
21
+ paymentView: PaymentView;
22
+ cvc: string;
23
+ setCvc: (cvc: string) => void;
24
+ showMethodList: () => void;
25
+ showAddCard: () => void;
26
+ returnToCheckout: () => void;
27
+ submitIdentity: (contact: {
28
+ email?: string;
29
+ phone?: string;
30
+ }) => Promise<boolean>;
31
+ goBackToIdentity: () => void;
32
+ submitOTP: (code: string) => Promise<VerificationResult>;
33
+ resendCode: () => Promise<boolean>;
34
+ selectPaymentCard: (cardId: string) => Promise<boolean>;
35
+ addPaymentCard: (tokenizedCard: {
36
+ cardId: string;
37
+ last4: string;
38
+ brand: string;
39
+ network: string;
40
+ expiryMonth?: string;
41
+ expiryYear?: string;
42
+ cardholderName?: string;
43
+ cardArtUrl?: string;
44
+ }) => Promise<{
45
+ success: boolean;
46
+ card?: SavedCard;
47
+ }>;
48
+ deletePaymentCard: (cardId: string) => Promise<boolean>;
49
+ clearCard: () => Promise<void>;
50
+ registrationSubPhase: RegistrationSubPhase;
51
+ setRegistrationSubPhase: (subPhase: RegistrationSubPhase) => void;
52
+ skipRegistration: () => void;
53
+ completeAgentRegistration: () => void;
54
+ setPhase: (phase: SessionPhase) => void;
55
+ setPaymentView: (view: PaymentView) => void;
56
+ complete: (options?: {
57
+ passkeyAuthenticated?: boolean;
58
+ }) => Promise<CompletionResult>;
59
+ abandon: () => Promise<void>;
60
+ clearError: () => void;
61
+ refresh: () => Promise<void>;
62
+ }
63
+ export interface UseSessionOptions {
64
+ /** API base URL for credential generation and other API calls */
65
+ apiBaseUrl: string;
66
+ }
67
+ export declare function useSession(sessionSecret: string, options: UseSessionOptions): UseSessionReturn;
68
+ //# sourceMappingURL=useSession.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSession.d.ts","sourceRoot":"","sources":["../../../src/hooks/useSession.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,SAAS,EACT,iBAAiB,EAKlB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE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Aa,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,gBAAgB,CA2zB9F"}
@@ -0,0 +1,15 @@
1
+ import * as React from 'react';
2
+ export declare function useVisualViewport(): number;
3
+ /**
4
+ * useVisualViewportStyle - Returns inline style object with bottom offset
5
+ *
6
+ * Convenience hook that returns a style object to spread directly onto elements.
7
+ *
8
+ * @example
9
+ * ```tsx
10
+ * const style = useVisualViewportStyle();
11
+ * return <div className="fixed bottom-0" style={style}>Content</div>
12
+ * ```
13
+ */
14
+ export declare function useVisualViewportStyle(): React.CSSProperties;
15
+ //# sourceMappingURL=useVisualViewport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useVisualViewport.d.ts","sourceRoot":"","sources":["../../../src/hooks/useVisualViewport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA+B/B,wBAAgB,iBAAiB,IAAI,MAAM,CAoD1C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,IAAI,KAAK,CAAC,aAAa,CAS5D"}
@@ -0,0 +1,43 @@
1
+ export { Button } from './components/ui/button';
2
+ export { Input } from './components/ui/input';
3
+ export { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from './components/ui/card';
4
+ export { Label } from './components/ui/label';
5
+ export { Separator } from './components/ui/separator';
6
+ export { PhoneInput } from './components/payos/phone-input';
7
+ export { OTPInput } from './components/payos/otp-input';
8
+ export { PayOSDrawer } from './components/payos/drawer';
9
+ export { PaymentMethodRow } from './components/payos/PaymentMethodRow';
10
+ export { ActiveCardWidget } from './components/payos/ActiveCardWidget';
11
+ export { ViewHeader } from './components/payos/ViewHeader';
12
+ export { OrderSummary } from './components/payos/order-summary';
13
+ export { PriceTag } from './components/payos/PriceTag';
14
+ export { ReceiptPanel } from './components/payos/ReceiptPanel';
15
+ export type { OrderItem } from './components/payos/ReceiptPanel';
16
+ export { PayOSFooter } from './components/payos/PayOSFooter';
17
+ export { IdentityView } from './components/payos/views/IdentityView';
18
+ export { WelcomeBackView } from './components/payos/views/WelcomeBackView';
19
+ export { OTPView } from './components/payos/views/OTPView';
20
+ export { CheckoutView } from './components/payos/views/CheckoutView';
21
+ export { MethodListView } from './components/payos/views/MethodListView';
22
+ export { CardAddView } from './components/payos/views/CardAddView';
23
+ export { SuccessView } from './components/payos/views/SuccessView';
24
+ export type { SuccessViewProps } from './components/payos/views/SuccessView';
25
+ export { VisaMethodView } from './components/payos/views/VisaMethodView';
26
+ export type { VisaMethodViewProps, VisaVerificationMethod } from './components/payos/views/VisaMethodView';
27
+ export { VisaOtpView } from './components/payos/views/VisaOtpView';
28
+ export type { VisaOtpViewProps } from './components/payos/views/VisaOtpView';
29
+ export { AgentRegistrationView } from './components/payos/views/AgentRegistrationView';
30
+ export type { AgentRegistrationViewProps } from './components/payos/views/AgentRegistrationView';
31
+ export { PaymentSheet } from './components/payos/PaymentSheet';
32
+ export type { PaymentSheetProps } from './components/payos/PaymentSheet';
33
+ export { useCheckoutFlow } from './hooks/useCheckoutFlow';
34
+ export { useSession } from './hooks/useSession';
35
+ export type { UseSessionReturn, SessionPhase, PaymentView as SessionPaymentView } from './hooks/useSession';
36
+ export { useBodyScrollLock } from './hooks/useBodyScrollLock';
37
+ export { useVisualViewport, useVisualViewportStyle } from './hooks/useVisualViewport';
38
+ export type { PaymentView, CheckoutPhase, SavedCard, CardData, CardBrand } from './types';
39
+ export type { SessionStatus, PaymentIntentType, MultiPaymentIntent, PaymentIntentStatus, WalletUser, SavedCard as SessionSavedCard, CardNetwork, CheckoutSession, SessionError, SessionErrorCode, VerificationInitResult, VerificationResult, CompletionResult, PaymentSheetResult, PaymentSheetError, } from './types/session';
40
+ export { cn } from './lib/utils';
41
+ export { createTestSessionWithRealIntent } from './services/mockSessionService';
42
+ export type { CreatePaymentIntentRequest } from './services/apiService';
43
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../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,CAAC;AAGjC,OAAO,EAAE,+BAA+B,EAAE,MAAM,+BAA+B,CAAC;AAChF,YAAY,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * PayOS Elements Theming System
3
+ *
4
+ * Provides CSS variable-based theming with support for:
5
+ * - Primary color customization
6
+ * - Font family
7
+ * - Border radius
8
+ * - Dark mode
9
+ */
10
+ export interface PayOSTheme {
11
+ /**
12
+ * Primary brand color (hex format)
13
+ * @default "#0f172a" (slate-900)
14
+ */
15
+ colorPrimary?: string;
16
+ /**
17
+ * Font family stack
18
+ * @default "system-ui, -apple-system, sans-serif"
19
+ */
20
+ fontFamily?: string;
21
+ /**
22
+ * Border radius for components
23
+ * @default "0.75rem" (12px)
24
+ */
25
+ borderRadius?: string;
26
+ }
27
+ declare const DEFAULT_THEME: Required<PayOSTheme>;
28
+ /**
29
+ * Applies theme CSS variables to a target element
30
+ */
31
+ export declare function applyTheme(element: HTMLElement, theme?: PayOSTheme): void;
32
+ /**
33
+ * Removes theme CSS variables from a target element
34
+ */
35
+ export declare function clearTheme(element: HTMLElement): void;
36
+ /**
37
+ * Hook to apply theme to a ref element
38
+ * @example
39
+ * ```tsx
40
+ * const ref = useTheme({ colorPrimary: '#4f46e5' });
41
+ * return <div ref={ref}>...</div>
42
+ * ```
43
+ */
44
+ export declare function useTheme(theme?: PayOSTheme): React.RefObject<HTMLDivElement>;
45
+ export { DEFAULT_THEME };
46
+ export declare function isValidHexColor(color: string): boolean;
47
+ export declare function hexToRgb(hex: string): {
48
+ r: number;
49
+ g: number;
50
+ b: number;
51
+ } | null;
52
+ import * as React from 'react';
53
+ //# sourceMappingURL=theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../src/lib/theme.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,WAAW,UAAU;IACzB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,QAAA,MAAM,aAAa,EAAE,QAAQ,CAAC,UAAU,CAIvC,CAAC;AAEF;;GAEG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,GAAE,UAAe,GAAG,IAAI,CAM7E;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAIrD;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,KAAK,GAAE,UAAe,mCAgB9C;AAGD,OAAO,EAAE,aAAa,EAAE,CAAC;AAGzB,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEtD;AAGD,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAOhF;AAGD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type ClassValue } from "clsx";
2
+ export declare function cn(...inputs: ClassValue[]): string;
3
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAQ,MAAM,MAAM,CAAC;AAG7C,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC"}
@@ -0,0 +1,3 @@
1
+ export * from './mockData';
2
+ export * from './mockCheckoutFlow';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/mocks/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC"}