@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,25 @@
1
+ import type { CardData, PaymentResult } from '../types';
2
+ /**
3
+ * Mock: Send OTP to phone number
4
+ */
5
+ export declare const mockSendOTP: (phone: string) => Promise<void>;
6
+ /**
7
+ * Mock: Verify OTP code
8
+ * Test OTP: "123456" or any 6-digit code
9
+ */
10
+ export declare const mockVerifyOTP: (otp: string) => Promise<boolean>;
11
+ /**
12
+ * Mock: Process payment
13
+ */
14
+ export declare const mockProcessPayment: (data: {
15
+ phoneNumber: string;
16
+ email: string;
17
+ cardData: CardData;
18
+ amount: number;
19
+ mode: "standard" | "agent";
20
+ }) => Promise<PaymentResult>;
21
+ /**
22
+ * Mock: Resend OTP
23
+ */
24
+ export declare const mockResendOTP: (phone: string) => Promise<void>;
25
+ //# sourceMappingURL=mockCheckoutFlow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mockCheckoutFlow.d.ts","sourceRoot":"","sources":["../../../src/mocks/mockCheckoutFlow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAIxD;;GAEG;AACH,eAAO,MAAM,WAAW,GAAU,OAAO,MAAM,KAAG,OAAO,CAAC,IAAI,CAI7D,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAU,KAAK,MAAM,KAAG,OAAO,CAAC,OAAO,CAShE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAAU,MAAM;IAC7C,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,QAAQ,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC;CAC5B,KAAG,OAAO,CAAC,aAAa,CAiBxB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,GAAU,OAAO,MAAM,KAAG,OAAO,CAAC,IAAI,CAI/D,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { OrderItem, OrderData } from '../types';
2
+ export declare const SAMPLE_PRODUCT: OrderItem;
3
+ export declare const SAMPLE_ORDER: OrderData;
4
+ export declare const SAMPLE_ORDER_WITH_SHIPMENTS: OrderData;
5
+ export declare const GRADIENT_OPTIONS: string[];
6
+ //# sourceMappingURL=mockData.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mockData.d.ts","sourceRoot":"","sources":["../../../src/mocks/mockData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErD,eAAO,MAAM,cAAc,EAAE,SAO5B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,SAO1B,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,SAczC,CAAC;AAGF,eAAO,MAAM,gBAAgB,UAO5B,CAAC"}
@@ -0,0 +1,38 @@
1
+ import { CheckoutSession, MultiPaymentIntent, WalletUser, SavedCard, SessionStatus, PaymentIntentType } from '../types/session';
2
+ export declare const MOCK_CARDS: SavedCard[];
3
+ export declare const MOCK_WALLET_USER: WalletUser;
4
+ export declare const MOCK_ONLINE_PAYMENT_INTENT: MultiPaymentIntent;
5
+ export declare const MOCK_AGENT_PAYMENT_INTENT: MultiPaymentIntent;
6
+ export declare const MOCK_MULTI_PAYMENT_INTENT: MultiPaymentIntent;
7
+ export declare const MOCK_SMALL_PAYMENT_INTENT: MultiPaymentIntent;
8
+ export declare const MOCK_SESSION_NEW_USER: CheckoutSession;
9
+ export declare const MOCK_SESSION_RETURNING_USER: CheckoutSession;
10
+ export declare const MOCK_SESSION_AGENT_MODE: CheckoutSession;
11
+ export declare const MOCK_SESSION_AGENT_RETURNING: CheckoutSession;
12
+ export declare const MOCK_SESSION_MULTI_PAYMENT: CheckoutSession;
13
+ export declare const MOCK_SESSION_MULTI_RETURNING: CheckoutSession;
14
+ export declare const MOCK_SESSION_OTP_PENDING: CheckoutSession;
15
+ export declare const MOCK_SESSION_PAYMENT_PENDING: CheckoutSession;
16
+ export interface CreateMockSessionOptions {
17
+ type?: PaymentIntentType;
18
+ status?: SessionStatus;
19
+ hasWalletUser?: boolean;
20
+ hasSavedCards?: boolean;
21
+ deviceVerified?: boolean;
22
+ amount?: number;
23
+ subtotal?: number;
24
+ tax?: number;
25
+ shipping?: number;
26
+ merchantName?: string;
27
+ payments?: Array<{
28
+ merchantName: string;
29
+ amount: number;
30
+ subtotal: number;
31
+ tax?: number;
32
+ shipping?: number;
33
+ description?: string;
34
+ }>;
35
+ }
36
+ export declare function createMockSession(options?: CreateMockSessionOptions): CheckoutSession;
37
+ export declare const PRESET_SESSIONS: Record<string, CheckoutSession>;
38
+ //# sourceMappingURL=mockSessionData.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":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AQ,CAAC,EAAE,KAAK,CAAC;QACf,YAAY,EAAE,MAAM,CAAC;QACrB,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC,CAAC;CACJ;AAED,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,wBAA6B,GAAG,eAAe,CAwEzF;AAKD,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAS3D,CAAC"}
@@ -0,0 +1,25 @@
1
+ export interface OrderItem {
2
+ id?: string;
3
+ name: string;
4
+ price: number;
5
+ quantity: number;
6
+ image?: string;
7
+ description?: string;
8
+ estimatedDelivery?: string;
9
+ }
10
+ export interface Shipment {
11
+ id: string;
12
+ seller: string;
13
+ items: OrderItem[];
14
+ estimatedDelivery?: string;
15
+ }
16
+ export interface OrderData {
17
+ shipments?: Shipment[];
18
+ items?: OrderItem[];
19
+ subtotal: number;
20
+ shipping: number;
21
+ tax: number;
22
+ agentFee?: number;
23
+ total: number;
24
+ }
25
+ //# sourceMappingURL=order.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"order.d.ts","sourceRoot":"","sources":["../../src/types/order.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,SAAS;IACxB,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB,KAAK,CAAC,EAAE,SAAS,EAAE,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACf"}
@@ -0,0 +1,52 @@
1
+ export type CheckoutPhase = 'PHONE_INPUT' | 'OTP_VERIFY' | 'PAYMENT' | 'PAYMENT_CONFIRMATION' | 'AGENT_REGISTRATION' | 'PROCESSING' | 'SUCCESS';
2
+ /**
3
+ * PaymentView - Sub-view state within PAYMENT phase
4
+ *
5
+ * Used for iOS-style push navigation between payment-related screens.
6
+ * This implements the Card Stack Architecture pattern.
7
+ *
8
+ * Flow: checkout (root) <-> methods (list) <-> add (form) -> checkout
9
+ */
10
+ export type PaymentView = 'checkout' | 'methods' | 'add';
11
+ export interface CheckoutState {
12
+ phase: CheckoutPhase;
13
+ phoneNumber: string;
14
+ email: string;
15
+ cardData: CardData | null;
16
+ billingAddress: BillingAddress | null;
17
+ error: string | null;
18
+ isLoading: boolean;
19
+ }
20
+ export interface CardData {
21
+ number: string;
22
+ expiry: string;
23
+ cvc: string;
24
+ cardholderName: string;
25
+ brand?: CardBrand;
26
+ last4?: string;
27
+ cardArtUrl?: string;
28
+ cardId?: string;
29
+ }
30
+ export type CardBrand = 'visa' | 'mastercard' | 'amex' | 'discover' | 'unknown';
31
+ export interface BillingAddress {
32
+ line1: string;
33
+ line2?: string;
34
+ city: string;
35
+ state: string;
36
+ zip: string;
37
+ country?: string;
38
+ }
39
+ export interface SavedCard {
40
+ id: string;
41
+ last4: string;
42
+ brand: CardBrand;
43
+ expiryMonth: string;
44
+ expiryYear: string;
45
+ cardholderName?: string;
46
+ isDefault: boolean;
47
+ network?: CardBrand;
48
+ passkeyEnrolled?: boolean;
49
+ cardArtUrl?: string;
50
+ issuerName?: string;
51
+ }
52
+ //# sourceMappingURL=payment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payment.d.ts","sourceRoot":"","sources":["../../src/types/payment.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GACrB,aAAa,GACb,YAAY,GACZ,SAAS,GACT,sBAAsB,GACtB,oBAAoB,GACpB,YAAY,GACZ,SAAS,CAAC;AAEd;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,GACnB,UAAU,GACV,SAAS,GACT,KAAK,CAAC;AAEV,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,aAAa,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC1B,cAAc,EAAE,cAAc,GAAG,IAAI,CAAC;IACtC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,YAAY,GAAG,MAAM,GAAG,UAAU,GAAG,SAAS,CAAC;AAEhF,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,SAAS,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
@@ -0,0 +1,297 @@
1
+ /**
2
+ * PayOS Elements API Service
3
+ *
4
+ * Centralized API service for all backend calls.
5
+ * All requests are authenticated via link token (Bearer token).
6
+ * Adapted from apps/payos-link/src/api/index.ts
7
+ */
8
+ import { SavedCard } from '../types/session';
9
+ export interface ApiResponse<T> {
10
+ error: boolean;
11
+ message?: string;
12
+ data?: T;
13
+ environment?: string;
14
+ }
15
+ export interface OTPStatus {
16
+ status: 'pending' | 'approved' | 'expired' | 'canceled';
17
+ phone: string;
18
+ createdAt: string;
19
+ expiresAt: string;
20
+ verifiedAt?: string;
21
+ channel: string;
22
+ }
23
+ export interface WalletUserResult {
24
+ walletUserId: string;
25
+ isNewUser: boolean;
26
+ isNewRelationship: boolean;
27
+ hasExistingCards: boolean;
28
+ savedCards: SavedCard[];
29
+ linkedCardIds?: string[];
30
+ }
31
+ export declare class ApiError extends Error {
32
+ status: number;
33
+ details?: string;
34
+ constructor(message: string, status: number, details?: string);
35
+ }
36
+ /**
37
+ * Send OTP verification code to a phone number
38
+ * @param baseUrl API base URL
39
+ * @param token Link token for authentication
40
+ * @param phone Phone number in E.164 format
41
+ * @returns Reference ID for the verification
42
+ */
43
+ export declare function sendOTP(baseUrl: string, token: string, phone: string): Promise<string>;
44
+ /**
45
+ * Verify OTP code
46
+ * @param baseUrl API base URL
47
+ * @param token Link token for authentication
48
+ * @param reference Verification reference from sendOTP
49
+ * @param code 6-digit OTP code
50
+ * @returns Verified phone number and reference
51
+ */
52
+ export declare function verifyOTP(baseUrl: string, token: string, reference: string, code: string): Promise<{
53
+ phone: string;
54
+ reference: string;
55
+ }>;
56
+ /**
57
+ * Get OTP verification status
58
+ * @param baseUrl API base URL
59
+ * @param token Link token for authentication
60
+ * @param reference Verification reference
61
+ * @returns Verification status details
62
+ */
63
+ export declare function getOTPStatus(baseUrl: string, token: string, reference: string): Promise<OTPStatus>;
64
+ /**
65
+ * Resend OTP verification code
66
+ * Checks existing status first to enforce rate limiting (30 second minimum)
67
+ * @param baseUrl API base URL
68
+ * @param token Link token for authentication
69
+ * @param previousReference Previous verification reference
70
+ * @param phone Phone number
71
+ * @returns New reference or existing reference with wait time
72
+ */
73
+ export declare function resendOTP(baseUrl: string, token: string, previousReference: string, phone: string): Promise<{
74
+ reference: string;
75
+ waitTimeRemaining?: number;
76
+ }>;
77
+ /**
78
+ * Process a verified wallet user after OTP verification
79
+ * Creates wallet user if doesn't exist, returns walletUserId and saved cards
80
+ * @param baseUrl API base URL
81
+ * @param token Link token for authentication
82
+ * @param phone Verified phone number
83
+ * @param verificationId OTP verification reference
84
+ * @returns Wallet user details including walletUserId and saved cards
85
+ */
86
+ export declare function processVerifiedWalletUser(baseUrl: string, token: string, phone: string, verificationId: string): Promise<WalletUserResult>;
87
+ /**
88
+ * Get saved cards for a wallet user
89
+ * @param baseUrl API base URL
90
+ * @param token Link token for authentication
91
+ * @param walletUserId Wallet user ID
92
+ * @returns Array of saved cards
93
+ */
94
+ export declare function getWalletUserCards(baseUrl: string, token: string, walletUserId: string): Promise<SavedCard[]>;
95
+ export interface CreatePaymentIntentRequest {
96
+ walletUserId?: string;
97
+ externalUserId?: string;
98
+ currency?: string;
99
+ type?: 'pay_on_behalf' | 'agentic_multi' | 'online_checkout';
100
+ consumerPrompt?: string;
101
+ payments: Array<{
102
+ merchantName: string;
103
+ merchantUrl?: string;
104
+ merchantCategory?: string;
105
+ merchantCategoryCode?: string;
106
+ amount: number;
107
+ description?: string;
108
+ quantity?: number;
109
+ }>;
110
+ credentialType?: 'network_token_short' | 'network_token_long' | 'virtual_card' | 'bank_account' | 'pci_vault_token';
111
+ }
112
+ export interface PaymentIntentResponse {
113
+ id: string;
114
+ type: string;
115
+ currency: string;
116
+ walletUserId?: string;
117
+ organizationId: string;
118
+ status: string;
119
+ payments: Array<{
120
+ id: string;
121
+ merchantName: string;
122
+ merchantUrl?: string;
123
+ merchantCategory?: string;
124
+ merchantCategoryCode?: string;
125
+ amount: number;
126
+ subtotal?: number;
127
+ tax?: number;
128
+ shipping?: number;
129
+ description?: string;
130
+ quantity: number;
131
+ selectedCardId?: string;
132
+ credentialId?: string;
133
+ credentialStatus: string;
134
+ status: string;
135
+ createdAt: string;
136
+ updatedAt: string;
137
+ }>;
138
+ totalAmount: number;
139
+ totalSubtotal?: number;
140
+ totalTax?: number;
141
+ totalShipping?: number;
142
+ consumerPrompt?: string;
143
+ intentType: string;
144
+ selectedCardId?: string;
145
+ requireHitl: boolean;
146
+ hitlAttemptCount?: number;
147
+ hitlApproved?: boolean;
148
+ networkAuthRequired?: boolean;
149
+ networkAuthCompleted?: boolean;
150
+ authValid?: boolean;
151
+ credentialType: string;
152
+ createdAt: string;
153
+ updatedAt: string;
154
+ }
155
+ /**
156
+ * Create a new payment intent via the API
157
+ * @param baseUrl API base URL
158
+ * @param token Link token for authentication
159
+ * @param request Payment intent configuration
160
+ * @returns Created payment intent
161
+ */
162
+ export declare function createPaymentIntent(baseUrl: string, token: string, request: CreatePaymentIntentRequest): Promise<PaymentIntentResponse>;
163
+ /**
164
+ * Get payment intent by ID
165
+ * @param baseUrl API base URL
166
+ * @param token Link token for authentication
167
+ * @param paymentIntentId Payment intent ID
168
+ * @returns Payment intent details
169
+ */
170
+ export declare function getPaymentIntent(baseUrl: string, token: string, paymentIntentId: string): Promise<PaymentIntentResponse>;
171
+ /**
172
+ * Update payment intent (e.g., assign selectedCardId)
173
+ * @param baseUrl API base URL
174
+ * @param token Link token for authentication
175
+ * @param paymentIntentId Payment intent ID
176
+ * @param updates Fields to update
177
+ * @returns Updated payment intent
178
+ */
179
+ export declare function updatePaymentIntent(baseUrl: string, token: string, paymentIntentId: string, updates: {
180
+ selectedCardId?: string;
181
+ }): Promise<PaymentIntentResponse>;
182
+ export interface SessionResponse {
183
+ id: string;
184
+ type: string;
185
+ status: string;
186
+ organizationId: string;
187
+ paymentIntentId: string;
188
+ locale: string;
189
+ metadata: Record<string, any>;
190
+ expiresAt: string;
191
+ startedAt?: string;
192
+ completedAt?: string;
193
+ abandonedAt?: string;
194
+ createdAt: string;
195
+ updatedAt: string;
196
+ }
197
+ export interface GetCurrentSessionResponse {
198
+ session: SessionResponse;
199
+ paymentIntent: PaymentIntentResponse | null;
200
+ }
201
+ /**
202
+ * Get current session for SDK initialization
203
+ * Uses the sessionSecret (JWT) to authenticate and get session + payment intent
204
+ * @param baseUrl API base URL
205
+ * @param sessionSecret Session secret (JWT token) from POST /api/sessions/checkout
206
+ * @returns Session with payment intent data
207
+ */
208
+ export declare function getCurrentSession(baseUrl: string, sessionSecret: string): Promise<GetCurrentSessionResponse>;
209
+ /**
210
+ * Mark session as started (when PaymentSheet opens)
211
+ * @param baseUrl API base URL
212
+ * @param sessionSecret Session secret (JWT token)
213
+ * @returns Updated session
214
+ */
215
+ export declare function startSession(baseUrl: string, sessionSecret: string): Promise<SessionResponse>;
216
+ /**
217
+ * Complete session
218
+ * @param baseUrl API base URL
219
+ * @param sessionSecret Session secret (JWT token)
220
+ * @returns Completed session
221
+ */
222
+ export declare function completeCheckoutSession(baseUrl: string, sessionSecret: string): Promise<SessionResponse>;
223
+ /**
224
+ * Abandon session (user closed PaymentSheet)
225
+ * @param baseUrl API base URL
226
+ * @param sessionSecret Session secret (JWT token)
227
+ * @returns Abandoned session
228
+ */
229
+ export declare function abandonCheckoutSession(baseUrl: string, sessionSecret: string): Promise<SessionResponse>;
230
+ /**
231
+ * Update the session's linked payment intent (e.g., select card)
232
+ * Uses the session context to determine which payment intent to update
233
+ * @param baseUrl API base URL
234
+ * @param sessionSecret Session secret (JWT token)
235
+ * @param updates Fields to update on payment intent (e.g., selectedCardId)
236
+ * @returns Updated payment intent
237
+ */
238
+ export declare function updateSessionPaymentIntent(baseUrl: string, sessionSecret: string, updates: {
239
+ selectedCardId?: string;
240
+ walletUserId?: string;
241
+ }): Promise<PaymentIntentResponse>;
242
+ export interface GenerateCredentialResponse {
243
+ status: string;
244
+ message?: string;
245
+ retrievalToken?: string;
246
+ approvalId?: string;
247
+ }
248
+ /**
249
+ * Generate payment credentials for a payment intent
250
+ * Called after successful passkey authentication in agent mode
251
+ * @param apiBaseUrl API base URL (from environment config)
252
+ * @param linkToken Link token (session secret) for authentication
253
+ * @param paymentIntentId Payment intent ID to generate credentials for
254
+ * @returns Credential generation result with status
255
+ */
256
+ export declare function generateCredential(apiBaseUrl: string, linkToken: string, paymentIntentId: string): Promise<GenerateCredentialResponse>;
257
+ /**
258
+ * Delete a saved card from wallet user
259
+ * Uses soft delete (marks card as inactive, doesn't permanently delete)
260
+ * @param baseUrl API base URL
261
+ * @param token Link token for authentication
262
+ * @param walletUserId Wallet user ID who owns the card
263
+ * @param cardId Card ID to delete
264
+ * @returns Success status
265
+ */
266
+ export declare function deleteCard(baseUrl: string, token: string, walletUserId: string, cardId: string): Promise<{
267
+ success: boolean;
268
+ }>;
269
+ export interface DeviceTrustResult {
270
+ /** Whether this device is trusted for the wallet user */
271
+ isTrusted: boolean;
272
+ /** When the trust expires (if trusted) */
273
+ expiresAt?: string;
274
+ /** Wallet user ID if device was previously verified */
275
+ walletUserId?: string;
276
+ }
277
+ /**
278
+ * Check if a device is trusted for a wallet user (90-day verification)
279
+ * @param baseUrl API base URL
280
+ * @param token Link token for authentication
281
+ * @param deviceId Device fingerprint
282
+ * @param walletUserId Wallet user ID (from PaymentIntent)
283
+ * @returns Device trust status
284
+ */
285
+ export declare function checkDeviceTrust(baseUrl: string, token: string, deviceId: string, walletUserId?: string): Promise<DeviceTrustResult>;
286
+ /**
287
+ * Register a device as trusted after successful OTP verification
288
+ * @param baseUrl API base URL
289
+ * @param token Link token for authentication
290
+ * @param deviceId Device fingerprint
291
+ * @param walletUserId Wallet user ID
292
+ * @returns Success status
293
+ */
294
+ export declare function registerTrustedDevice(baseUrl: string, token: string, deviceId: string, walletUserId: string): Promise<{
295
+ success: boolean;
296
+ }>;
297
+ //# sourceMappingURL=apiService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiService.d.ts","sourceRoot":"","sources":["../../../src/services/apiService.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAgB7C,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,UAAU,CAAC;IACxD,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED,qBAAa,QAAS,SAAQ,KAAK;IACjC,MAAM,EAA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
1
+ /**
2
+ * Link Token Service
3
+ *
4
+ * Fetches real link tokens from the PayOS API for CardElement initialization.
5
+ * This replaces mock token generation with real API calls.
6
+ */
7
+ export interface LinkTokenResponse {
8
+ token: string;
9
+ expiresAt: string;
10
+ }
11
+ /**
12
+ * Fetch a real link token from the PayOS API
13
+ *
14
+ * @returns Promise with token and expiration timestamp
15
+ * @throws Error if the API request fails
16
+ */
17
+ export declare function fetchLinkToken(): Promise<LinkTokenResponse>;
18
+ /**
19
+ * Get the CardElement configuration for the current environment
20
+ * Note: customBaseUrl points to where the CardElement iframe is hosted (payos-link app),
21
+ * NOT the backend API URL
22
+ */
23
+ export declare const CARD_ELEMENT_CONFIG: {
24
+ customBaseUrl: string;
25
+ environment: "sandbox";
26
+ };
27
+ //# sourceMappingURL=linkTokenService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"linkTokenService.d.ts","sourceRoot":"","sources":["../../../src/services/linkTokenService.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAWH,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,iBAAiB,CAAC,CA6BjE;AAED;;;;GAIG;AACH,eAAO,MAAM,mBAAmB;;;CAG/B,CAAC"}
@@ -0,0 +1,78 @@
1
+ import { CheckoutSession, MultiPaymentIntent, VerificationInitResult, VerificationResult, CompletionResult, SavedCard } from '../types/session';
2
+ import { CreateMockSessionOptions } from '../mocks/mockSessionData';
3
+ import { CreatePaymentIntentRequest } from './apiService';
4
+ export declare function loadSession(sessionId: string): Promise<CheckoutSession>;
5
+ export declare function updateSession(sessionId: string, updates: Partial<CheckoutSession>): Promise<CheckoutSession>;
6
+ export declare function initiateVerification(sessionId: string, contact: {
7
+ email?: string;
8
+ phone?: string;
9
+ }): Promise<VerificationInitResult>;
10
+ export declare function confirmVerification(sessionId: string, code: string): Promise<VerificationResult>;
11
+ export declare function resendOTP(sessionId: string): Promise<VerificationInitResult>;
12
+ /**
13
+ * Mock API: Update payment intent with selected card
14
+ * Simulates: PATCH /payment-intents/{paymentIntentId}
15
+ * Body: { selectedCardId: string }
16
+ */
17
+ export declare function updatePaymentIntentCard(paymentIntentId: string, cardId: string): Promise<{
18
+ success: boolean;
19
+ paymentIntent: MultiPaymentIntent;
20
+ }>;
21
+ export declare function selectCard(sessionId: string, cardId: string): Promise<CheckoutSession>;
22
+ export declare function addCard(sessionId: string, tokenizedCard: {
23
+ cardId: string;
24
+ last4: string;
25
+ brand: string;
26
+ network: string;
27
+ expiryMonth?: string;
28
+ expiryYear?: string;
29
+ cardholderName?: string;
30
+ cardArtUrl?: string;
31
+ }): Promise<{
32
+ session: CheckoutSession;
33
+ card: SavedCard;
34
+ }>;
35
+ export declare function clearSelectedCard(sessionId: string): Promise<CheckoutSession>;
36
+ export declare function completeSession(sessionId: string, options?: {
37
+ passkeyAuthenticated?: boolean;
38
+ }): Promise<CompletionResult>;
39
+ export declare function abandonSession(sessionId: string): Promise<CheckoutSession>;
40
+ export declare function createTestSession(options?: CreateMockSessionOptions): string;
41
+ export declare function resetSession(sessionId: string): void;
42
+ export declare function resetAllSessions(): void;
43
+ export declare function getSessionState(sessionId: string): CheckoutSession | undefined;
44
+ export declare function listAllSessions(): string[];
45
+ export interface WalletUserCardsResponse {
46
+ walletUserId: string;
47
+ cards: SavedCard[];
48
+ defaultCardId?: string;
49
+ }
50
+ /**
51
+ * Mock implementation of GET /wallet-users/{wallet_user_id}/cards
52
+ * Returns all saved cards for a wallet user with card art URLs
53
+ */
54
+ export declare function getWalletUserCards(walletUserId: string): Promise<WalletUserCardsResponse>;
55
+ /**
56
+ * Options for creating a test session with a real payment intent
57
+ */
58
+ export interface CreateTestSessionWithRealIntentOptions extends CreatePaymentIntentRequest {
59
+ sessionOptions?: CreateMockSessionOptions;
60
+ }
61
+ /**
62
+ * Create a test session with a REAL payment intent from the API
63
+ *
64
+ * This is for demo/testing purposes - simulates the production flow where:
65
+ * 1. Merchant backend creates a payment intent via API
66
+ * 2. Merchant creates a session that links to the intent
67
+ * 3. Session ID is passed to PaymentSheet
68
+ *
69
+ * In this test helper, we:
70
+ * 1. Fetch a link token for API auth
71
+ * 2. Create a real payment intent via the API
72
+ * 3. Create a mock session locally with the real intent embedded
73
+ *
74
+ * @param options Payment intent configuration + optional session options
75
+ * @returns Session ID to pass to PaymentSheet
76
+ */
77
+ export declare function createTestSessionWithRealIntent(options: CreateTestSessionWithRealIntentOptions): Promise<string>;
78
+ //# sourceMappingURL=mockSessionService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mockSessionService.d.ts","sourceRoot":"","sources":["../../../src/services/mockSessionService.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,gBAAgB,EAChB,SAAS,EAEV,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAKL,wBAAwB,EACzB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAML,0BAA0B,EAE3B,MAAM,cAAc,CAAC;AAgCtB,wBAAsB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CA4B7E;AAED,wBAAsB,aAAa,CACjC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,OAAO,CAAC,eAAe,CAAC,GAChC,OAAO,CAAC,eAAe,CAAC,CAiB1B;AAMD,wBAAsB,oBAAoB,CACxC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAC1C,OAAO,CAAC,sBAAsB,CAAC,CA0CjC;AAED,wBAAsB,mBAAmB,CACvC,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,kBAAkB,CAAC,CA4E7B;AAED,wBAAsB,SAAS,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