@paykka/card-checkout-ui 0.7.0 → 0.9.2

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 (266) hide show
  1. package/dist/card-checkout-ui.js +27 -20
  2. package/dist/card-checkout-ui.umd.cjs +27 -20
  3. package/dist/es/_commonjsHelpers.js +1 -0
  4. package/dist/es/api/http.js +19 -21
  5. package/dist/es/api/index.js +1 -0
  6. package/dist/es/api/modules/ali-pay/index.js +19 -11
  7. package/dist/es/api/modules/apple-pay/index.js +10 -26
  8. package/dist/es/api/modules/boost/index.js +56 -0
  9. package/dist/es/api/modules/card/index.js +17 -11
  10. package/dist/es/api/modules/checkout/index.js +6 -6
  11. package/dist/es/api/modules/checkout/map.js +29 -1
  12. package/dist/es/api/modules/gcash/index.js +56 -0
  13. package/dist/es/api/modules/get-browser-params.js +2 -2
  14. package/dist/es/api/modules/google-pay/index.js +10 -26
  15. package/dist/es/api/modules/grab-pay/index.js +56 -0
  16. package/dist/es/api/modules/index.js +1 -0
  17. package/dist/es/api/modules/line-pay/index.js +56 -0
  18. package/dist/es/api/modules/may-bank-qr-pay/index.js +56 -0
  19. package/dist/es/api/modules/nine-pay/index.js +56 -0
  20. package/dist/es/api/modules/paymaya/index.js +56 -0
  21. package/dist/es/api/modules/sepa/index.js +19 -11
  22. package/dist/es/api/modules/shopee-pay/index.js +56 -0
  23. package/dist/es/api/modules/tng-wallet/index.js +56 -0
  24. package/dist/es/api/modules/wechat-pay/index.js +18 -31
  25. package/dist/es/components/AccordionItem/AccordionItem.js +36 -0
  26. package/dist/es/components/AliPay/index.js +58 -60
  27. package/dist/es/components/ApplePay/index.js +29 -43
  28. package/dist/es/components/Boost/index.js +322 -0
  29. package/dist/es/components/Card/index.js +89 -75
  30. package/dist/es/components/CardBrands/index.js +2 -2
  31. package/dist/es/components/CardNumberField/index.js +113 -106
  32. package/dist/es/components/DropIn/index.js +365 -0
  33. package/dist/es/components/GooglePay/index.js +15 -7
  34. package/dist/es/components/GrabPay/index.js +322 -0
  35. package/dist/es/components/GuideCard/index.js +43 -0
  36. package/dist/es/components/LinePay/index.js +322 -0
  37. package/dist/es/components/MayBankQRPay/index.js +322 -0
  38. package/dist/es/components/NinePay/index.js +322 -0
  39. package/dist/es/components/SecuredIframe/index.js +3 -2
  40. package/dist/es/components/Sepa/index.js +8 -9
  41. package/dist/es/components/ShopeePay/index.js +322 -0
  42. package/dist/es/components/SubmitButton/index.js +6 -20
  43. package/dist/es/components/TNGWallet/index.js +322 -0
  44. package/dist/es/components/WechatPay/index.js +51 -61
  45. package/dist/es/components/business/QRCodeModal/QRCodeModal.js +41 -0
  46. package/dist/es/components/business/QRCodeModal/index.js +6 -0
  47. package/dist/es/components/business/QRCodeModal/qr-code-modal.js +1 -0
  48. package/dist/es/components/business/QRCodeModal/type.js +1 -0
  49. package/dist/es/components/business/index.js +6 -0
  50. package/dist/es/components/index.js +10 -0
  51. package/dist/es/components/internal/Accordion/Accordion.js +14 -0
  52. package/dist/es/components/internal/Accordion/accordion2.js +1 -0
  53. package/dist/es/components/internal/Accordion/accordionTransition.js +26 -0
  54. package/dist/es/components/internal/Accordion/index.js +7 -0
  55. package/dist/es/components/internal/Accordion/type.js +10 -0
  56. package/dist/es/components/internal/Modal/Modal.js +17 -3
  57. package/dist/es/components/internal/Modal/index.js +1 -0
  58. package/dist/es/components/internal/Modal/type.js +1 -0
  59. package/dist/es/components/internal/QRCode/QRCode.js +31 -0
  60. package/dist/es/components/internal/QRCode/index.js +4 -0
  61. package/dist/es/components/internal/QRCode/type.js +1 -0
  62. package/dist/es/components/internal/icons/IconBoost.js +63 -0
  63. package/dist/es/components/internal/icons/IconCard.js +3 -0
  64. package/dist/es/components/internal/icons/IconCard2.js +60 -0
  65. package/dist/es/components/internal/icons/IconGCash.js +196 -0
  66. package/dist/es/components/internal/icons/IconGcashComplete.js +184 -0
  67. package/dist/es/components/internal/icons/IconGrabPay.js +59 -0
  68. package/dist/es/components/internal/icons/IconLinePay.js +99 -0
  69. package/dist/es/components/internal/icons/IconMayBankQRPay.js +69 -0
  70. package/dist/es/components/internal/icons/IconNinePay.js +255 -0
  71. package/dist/es/components/internal/icons/IconPaymaya.js +114 -0
  72. package/dist/es/components/internal/icons/IconRedirect.js +58 -0
  73. package/dist/es/components/internal/icons/IconScan.js +102 -0
  74. package/dist/es/components/internal/icons/IconShopeePay.js +108 -0
  75. package/dist/es/components/internal/icons/IconTNGWallet.js +119 -0
  76. package/dist/es/components/internal/icons/IconUnionPay.js +65 -0
  77. package/dist/es/components/wallets/GCash/GCash.js +356 -0
  78. package/dist/es/components/wallets/GCash/g-cash.js +1 -0
  79. package/dist/es/components/wallets/GCash/index.js +1 -0
  80. package/dist/es/components/wallets/GCash/type.js +1 -0
  81. package/dist/es/components/wallets/Paymaya/Paymaya.js +323 -0
  82. package/dist/es/components/wallets/Paymaya/index.js +1 -0
  83. package/dist/es/components/wallets/Paymaya/paymaya2.js +1 -0
  84. package/dist/es/components/wallets/Paymaya/type.js +1 -0
  85. package/dist/es/config.js +12 -12
  86. package/dist/es/constant.js +94 -4
  87. package/dist/es/core/PayKKaCheckout.js +38 -3
  88. package/dist/es/core/Session.js +24 -23
  89. package/dist/es/core/error.js +7 -0
  90. package/dist/es/core/query.js +3 -2
  91. package/dist/es/core.js +2082 -70
  92. package/dist/es/hooks/usePayState.js +3 -4
  93. package/dist/es/i18n/I18n.js +8 -2
  94. package/dist/es/i18n/locales/de-DE.js +19 -1
  95. package/dist/es/i18n/locales/en-GB.js +19 -1
  96. package/dist/es/i18n/locales/es-ES.js +19 -1
  97. package/dist/es/i18n/locales/fr-FR.js +19 -1
  98. package/dist/es/i18n/locales/ja-JP.js +19 -1
  99. package/dist/es/i18n/locales/ko-KR.js +19 -1
  100. package/dist/es/i18n/locales/pt-PT.js +19 -1
  101. package/dist/es/i18n/locales/ru-RU.js +19 -1
  102. package/dist/es/i18n/locales/zh-CN.js +19 -1
  103. package/dist/es/i18n/locales/zh-HK.js +19 -1
  104. package/dist/es/i18n/locales/zh-TW.js +19 -1
  105. package/dist/es/i18n/util.js +20 -0
  106. package/dist/es/index.js +24 -0
  107. package/dist/es/style.css +1 -1096
  108. package/dist/es/types/index.js +1 -0
  109. package/dist/es/utils/array.js +9 -0
  110. package/dist/es/utils/card-brand/brands.js +11 -1
  111. package/dist/es/utils/card-brand/index.js +4 -3
  112. package/dist/es/utils/card-brand/luhn.js +25 -0
  113. package/dist/es/utils/date.js +25 -0
  114. package/dist/es/utils/detect.js +6 -0
  115. package/dist/es/utils/format.js +28 -12
  116. package/dist/es/utils/index.js +9 -1
  117. package/dist/es/utils/location.js +37 -0
  118. package/dist/es/utils/object.js +14 -0
  119. package/dist/es/utils/redirect.js +32 -0
  120. package/dist/es/utils/system-info/get-browser-info.js +4 -4
  121. package/dist/es/utils/system-info/get-system-info.js +11 -7
  122. package/dist/es/utils/system-info/index.js +4 -4
  123. package/dist/style.css +1 -1
  124. package/dist/types/api/http.d.ts +4 -10
  125. package/dist/types/api/modules/ali-pay/index.d.ts +2 -1
  126. package/dist/types/api/modules/apple-pay/index.d.ts +2 -1
  127. package/dist/types/api/modules/boost/index.d.ts +24 -0
  128. package/dist/types/api/modules/card/index.d.ts +1 -1
  129. package/dist/types/api/modules/checkout/index.d.ts +2 -2
  130. package/dist/types/api/modules/checkout/map.d.ts +2 -1
  131. package/dist/types/api/modules/checkout/type.d.ts +20 -2
  132. package/dist/types/api/modules/gcash/index.d.ts +24 -0
  133. package/dist/types/api/modules/get-browser-params.d.ts +2 -2
  134. package/dist/types/api/modules/google-pay/index.d.ts +2 -1
  135. package/dist/types/api/modules/grab-pay/index.d.ts +24 -0
  136. package/dist/types/api/modules/index.d.ts +9 -0
  137. package/dist/types/api/modules/line-pay/index.d.ts +24 -0
  138. package/dist/types/api/modules/may-bank-qr-pay/index.d.ts +24 -0
  139. package/dist/types/api/modules/nine-pay/index.d.ts +24 -0
  140. package/dist/types/api/modules/paymaya/index.d.ts +24 -0
  141. package/dist/types/api/modules/sepa/index.d.ts +2 -1
  142. package/dist/types/api/modules/shopee-pay/index.d.ts +24 -0
  143. package/dist/types/api/modules/tng-wallet/index.d.ts +24 -0
  144. package/dist/types/api/modules/wechat-pay/index.d.ts +2 -1
  145. package/dist/types/components/AliPay/AliPay.d.ts +2 -1
  146. package/dist/types/components/AliPay/type.d.ts +1 -2
  147. package/dist/types/components/ApplePay/ApplePay.d.ts +2 -1
  148. package/dist/types/components/ApplePay/type.d.ts +9 -6
  149. package/dist/types/components/Boost/Boost.d.ts +7 -0
  150. package/dist/types/components/Boost/index.d.ts +2 -0
  151. package/dist/types/components/Boost/type.d.ts +61 -0
  152. package/dist/types/components/Card/Card.d.ts +2 -1
  153. package/dist/types/components/Card/type.d.ts +2 -2
  154. package/dist/types/components/DropIn/DropIn.d.ts +6 -0
  155. package/dist/types/components/DropIn/components/PaymentTabs/PaymentTabs.d.ts +3 -0
  156. package/dist/types/components/DropIn/components/PaymentTabs/index.d.ts +2 -0
  157. package/dist/types/components/DropIn/components/PaymentTabs/type.d.ts +11 -0
  158. package/dist/types/components/DropIn/config.d.ts +7 -0
  159. package/dist/types/components/DropIn/index.d.ts +2 -0
  160. package/dist/types/components/DropIn/type.d.ts +57 -0
  161. package/dist/types/components/GooglePay/GooglePay.d.ts +2 -1
  162. package/dist/types/components/GooglePay/type.d.ts +20 -9
  163. package/dist/types/components/GrabPay/GrabPay.d.ts +7 -0
  164. package/dist/types/components/GrabPay/index.d.ts +2 -0
  165. package/dist/types/components/GrabPay/type.d.ts +61 -0
  166. package/dist/types/components/GuideCard/GuideCard.d.ts +3 -0
  167. package/dist/types/components/GuideCard/index.d.ts +2 -0
  168. package/dist/types/components/GuideCard/type.d.ts +4 -0
  169. package/dist/types/components/LinePay/LinePay.d.ts +7 -0
  170. package/dist/types/components/LinePay/index.d.ts +2 -0
  171. package/dist/types/components/LinePay/type.d.ts +61 -0
  172. package/dist/types/components/MayBankQRPay/MayBankQRPay.d.ts +6 -0
  173. package/dist/types/components/MayBankQRPay/index.d.ts +2 -0
  174. package/dist/types/components/MayBankQRPay/type.d.ts +61 -0
  175. package/dist/types/components/NinePay/NinePay.d.ts +6 -0
  176. package/dist/types/components/NinePay/index.d.ts +2 -0
  177. package/dist/types/components/NinePay/type.d.ts +61 -0
  178. package/dist/types/components/SecuredIframe/useSecuredInput.d.ts +1 -1
  179. package/dist/types/components/Sepa/Sepa.d.ts +2 -1
  180. package/dist/types/components/Sepa/type.d.ts +1 -2
  181. package/dist/types/components/ShopeePay/ShopeePay.d.ts +7 -0
  182. package/dist/types/components/ShopeePay/index.d.ts +2 -0
  183. package/dist/types/components/ShopeePay/type.d.ts +61 -0
  184. package/dist/types/components/SubmitButton/SubmitButton.d.ts +1 -1
  185. package/dist/types/components/TNGWallet/TNGWallet.d.ts +7 -0
  186. package/dist/types/components/TNGWallet/index.d.ts +2 -0
  187. package/dist/types/components/TNGWallet/type.d.ts +61 -0
  188. package/dist/types/components/WechatPay/WechatPay.d.ts +2 -1
  189. package/dist/types/components/WechatPay/type.d.ts +1 -2
  190. package/dist/types/components/business/QRCodeModal/QRCodeModal.d.ts +3 -0
  191. package/dist/types/components/business/QRCodeModal/index.d.ts +2 -0
  192. package/dist/types/components/business/QRCodeModal/type.d.ts +18 -0
  193. package/dist/types/components/business/index.d.ts +1 -0
  194. package/dist/types/components/index.d.ts +10 -0
  195. package/dist/types/components/internal/Accordion/Accordion.d.ts +3 -0
  196. package/dist/types/components/internal/Accordion/accordionTransition.d.ts +8 -0
  197. package/dist/types/components/internal/Accordion/components/AccordionItem/AccordionItem.d.ts +3 -0
  198. package/dist/types/components/internal/Accordion/components/AccordionItem/index.d.ts +2 -0
  199. package/dist/types/components/internal/Accordion/components/AccordionItem/type.d.ts +18 -0
  200. package/dist/types/components/internal/Accordion/index.d.ts +3 -0
  201. package/dist/types/components/internal/Accordion/type.d.ts +18 -0
  202. package/dist/types/components/internal/Modal/index.d.ts +2 -0
  203. package/dist/types/components/internal/Modal/type.d.ts +3 -1
  204. package/dist/types/components/internal/QRCode/QRCode.d.ts +2 -0
  205. package/dist/types/components/internal/QRCode/index.d.ts +2 -0
  206. package/dist/types/components/internal/QRCode/type.d.ts +9 -0
  207. package/dist/types/components/internal/icons/IconBoost.d.ts +2 -0
  208. package/dist/types/components/internal/icons/IconCard.d.ts +2 -0
  209. package/dist/types/components/internal/icons/IconCard2.d.ts +2 -0
  210. package/dist/types/components/internal/icons/IconGCash.d.ts +2 -0
  211. package/dist/types/components/internal/icons/IconGcashComplete.d.ts +2 -0
  212. package/dist/types/components/internal/icons/IconGrabPay.d.ts +2 -0
  213. package/dist/types/components/internal/icons/IconLinePay.d.ts +2 -0
  214. package/dist/types/components/internal/icons/IconMayBankQRPay.d.ts +2 -0
  215. package/dist/types/components/internal/icons/IconNinePay.d.ts +2 -0
  216. package/dist/types/components/internal/icons/IconPaymaya.d.ts +2 -0
  217. package/dist/types/components/internal/icons/IconRedirect.d.ts +2 -0
  218. package/dist/types/components/internal/icons/IconScan.d.ts +2 -0
  219. package/dist/types/components/internal/icons/IconShopeePay.d.ts +2 -0
  220. package/dist/types/components/internal/icons/IconTNGWallet.d.ts +2 -0
  221. package/dist/types/components/internal/icons/IconUnionPay.d.ts +2 -0
  222. package/dist/types/components/internal/icons/index.d.ts +14 -0
  223. package/dist/types/components/wallets/GCash/GCash.d.ts +6 -0
  224. package/dist/types/components/wallets/GCash/index.d.ts +2 -0
  225. package/dist/types/components/wallets/GCash/type.d.ts +66 -0
  226. package/dist/types/components/wallets/Paymaya/Paymaya.d.ts +6 -0
  227. package/dist/types/components/wallets/Paymaya/index.d.ts +2 -0
  228. package/dist/types/components/wallets/Paymaya/type.d.ts +61 -0
  229. package/dist/types/config.d.ts +9 -9
  230. package/dist/types/constant.d.ts +38 -2
  231. package/dist/types/core/PayKKaCheckout.d.ts +11 -0
  232. package/dist/types/core/Session.d.ts +2 -0
  233. package/dist/types/core/error.d.ts +3 -1
  234. package/dist/types/core/query.d.ts +2 -2
  235. package/dist/types/hooks/usePayState.d.ts +0 -3
  236. package/dist/types/i18n/I18n.d.ts +1 -1
  237. package/dist/types/i18n/locales/de-DE.d.ts +15 -0
  238. package/dist/types/i18n/locales/en-GB.d.ts +15 -0
  239. package/dist/types/i18n/locales/es-ES.d.ts +15 -0
  240. package/dist/types/i18n/locales/fr-FR.d.ts +15 -0
  241. package/dist/types/i18n/locales/ja-JP.d.ts +15 -0
  242. package/dist/types/i18n/locales/ko-KR.d.ts +15 -0
  243. package/dist/types/i18n/locales/pt-PT.d.ts +15 -0
  244. package/dist/types/i18n/locales/ru-RU.d.ts +15 -0
  245. package/dist/types/i18n/locales/zh-CN.d.ts +15 -0
  246. package/dist/types/i18n/locales/zh-HK.d.ts +15 -0
  247. package/dist/types/i18n/locales/zh-TW.d.ts +15 -0
  248. package/dist/types/i18n/util.d.ts +10 -0
  249. package/dist/types/index.d.ts +1 -1
  250. package/dist/types/types/index.d.ts +34 -7
  251. package/dist/types/types/message.d.ts +1 -0
  252. package/dist/types/utils/array.d.ts +1 -0
  253. package/dist/types/utils/card-brand/brands.d.ts +4 -3
  254. package/dist/types/utils/card-brand/index.d.ts +9 -6
  255. package/dist/types/utils/card-brand/luhn.d.ts +9 -0
  256. package/dist/types/utils/date.d.ts +9 -0
  257. package/dist/types/utils/detect.d.ts +1 -0
  258. package/dist/types/utils/format.d.ts +7 -1
  259. package/dist/types/utils/index.d.ts +7 -0
  260. package/dist/types/utils/location.d.ts +7 -0
  261. package/dist/types/utils/object.d.ts +1 -0
  262. package/dist/types/utils/redirect.d.ts +5 -0
  263. package/dist/types/utils/system-info/get-browser-info.d.ts +1 -1
  264. package/dist/types/utils/system-info/get-system-info.d.ts +3 -2
  265. package/dist/types/utils/system-info/index.d.ts +3 -3
  266. package/package.json +65 -63
@@ -0,0 +1,323 @@
1
+ import { w, F, A, h, y, q, u, b } from "../../../core.js";
2
+ import { useBEM } from "../../../hooks/useBEM.js";
3
+ import { CoreContext } from "../../../core/context.js";
4
+ import "../../../utils/card-brand/brands.js";
5
+ import "../../../utils/system-info/get-browser-info.js";
6
+ import { cssVarPrefix, normalizedClass, formatAmount } from "../../../utils/format.js";
7
+ import { redirectToPayment } from "../../../utils/redirect.js";
8
+ import { isTimeoutError } from "../../../api/http.js";
9
+ import { PaymentCategory, COMMON_CLASS_NAME, PaymentMethod, SessionMode } from "../../../constant.js";
10
+ import { getBrowserParams } from "../../../api/modules/get-browser-params.js";
11
+ import { getPaymayaPayInfo, paymayaPay } from "../../../api/modules/paymaya/index.js";
12
+ import { PayKKaError } from "../../../core/error.js";
13
+ import { hidePaymentButton } from "../../../config.js";
14
+ import { usePayState } from "../../../hooks/usePayState.js";
15
+ import { useRetry } from "../../../hooks/useRetry.js";
16
+ import { createAddressCore } from "../../../core/Address.js";
17
+ import { createEmailCore, EmailField } from "../../EmailField/EmailField.js";
18
+ import { SubmitButton } from "../../SubmitButton/index.js";
19
+ import { GuideCard } from "../../GuideCard/index.js";
20
+ import { AddressField } from "../../AddressField/index.js";
21
+ import { Info } from "../../internal/Info/Info.js";
22
+ import "../../internal/Form/type.js";
23
+ import "../../internal/Form/context.js";
24
+ import "../../internal/Form/FormItem.js";
25
+ import { Form } from "../../internal/Form/Form.js";
26
+ import "./paymaya2.js";
27
+ const { bem } = useBEM("paymaya");
28
+ const fieldClassNames = bem("field");
29
+ const Paymaya = w((props, ref) => {
30
+ var _a, _b, _c, _d, _e, _f;
31
+ const {
32
+ session,
33
+ showEmail = false,
34
+ showAddress = false,
35
+ core,
36
+ redirectMode = "auto",
37
+ autoQuery = true,
38
+ showGuideCard = true
39
+ } = props;
40
+ F(ref, () => ({
41
+ stopRetry: () => {
42
+ setSubmitButtonStatus("unSubmit");
43
+ stopReFetchPayInfo();
44
+ },
45
+ startRetry: (timeout) => {
46
+ setSubmitButtonStatus("loading");
47
+ startReFetchPayInfo({ timeout });
48
+ },
49
+ updateAddress: () => {
50
+ var _a2;
51
+ if (!(fieldStatus == null ? void 0 : fieldStatus.address.show))
52
+ return;
53
+ setForm(Object.assign(form, { address: addressState.getAddressState() }));
54
+ (_a2 = addressFieldRef.current) == null ? void 0 : _a2.update(addressState.getAddressState());
55
+ },
56
+ updateEmail: () => {
57
+ var _a2;
58
+ if (!(fieldStatus == null ? void 0 : fieldStatus.email.show))
59
+ return;
60
+ setForm(Object.assign(form, { email: emailState.email }));
61
+ (_a2 = emailFieldRef.current) == null ? void 0 : _a2.update(emailState.email);
62
+ },
63
+ payment: () => {
64
+ hidePaymentButton && onSubmit();
65
+ }
66
+ }));
67
+ const addressState = createAddressCore();
68
+ const emailState = createEmailCore();
69
+ const addressFieldRef = A(null);
70
+ const emailFieldRef = A(null);
71
+ const [isCheckoutEnabled, setIsCheckoutEnabled] = h(false);
72
+ const { setErrorMsg, i18n, errorMsg, sessionReady } = usePayState(session);
73
+ const [submitButtonStatus, setSubmitButtonStatus] = h("unSubmit");
74
+ const formRef = A(null);
75
+ const [form, setForm] = h({
76
+ email: "",
77
+ address: {
78
+ country: "",
79
+ province: "",
80
+ city: "",
81
+ area: "",
82
+ postCode: "",
83
+ address1: "",
84
+ address2: ""
85
+ }
86
+ });
87
+ const [validated, setValidated] = h(false);
88
+ const [fieldStatus, setFieldStatus] = h();
89
+ const initFieldStatus = () => {
90
+ const { field, sessionMode } = session.checkout;
91
+ const { email, address } = field;
92
+ if (sessionMode === SessionMode.COMPONENT) {
93
+ if (email.disabled) {
94
+ email.show = showEmail;
95
+ }
96
+ if (showAddress && !(address == null ? void 0 : address.show)) {
97
+ address.show = true;
98
+ }
99
+ }
100
+ setFieldStatus({ ...field });
101
+ };
102
+ y(() => {
103
+ if (!sessionReady) {
104
+ return;
105
+ }
106
+ const { bill = {}, paymentMethod = [] } = (session == null ? void 0 : session.checkout) || {};
107
+ if (!paymentMethod.includes(PaymentMethod.PAYMAYA)) {
108
+ return;
109
+ }
110
+ initFieldStatus();
111
+ setIsCheckoutEnabled(true);
112
+ form.email = bill.email ?? "";
113
+ if (autoQuery && core.processingPaymentMethod === PaymentMethod.PAYMAYA) {
114
+ setSubmitButtonStatus("loading");
115
+ startReFetchPayInfo();
116
+ }
117
+ }, [sessionReady]);
118
+ const processOnError = (error) => {
119
+ var _a2;
120
+ (_a2 = props.onError) == null ? void 0 : _a2.call(props, error);
121
+ core.resetEnablePaymentMethod();
122
+ };
123
+ const onTimeout = q(
124
+ (message) => {
125
+ var _a2;
126
+ setErrorMsg(message || i18n.get("common.payTimeout"));
127
+ setSubmitButtonStatus("unSubmit");
128
+ (_a2 = props.onTimeout) == null ? void 0 : _a2.call(props);
129
+ core.resetEnablePaymentMethod();
130
+ },
131
+ [i18n, props.onTimeout]
132
+ );
133
+ const { start: startReFetchPayInfo, stop: stopReFetchPayInfo } = useRetry(
134
+ (timeout) => pay(true, timeout),
135
+ { onTimeout: () => onTimeout(i18n.get("common.queryTimeout")) }
136
+ );
137
+ const getPaymentParams = async () => {
138
+ return {
139
+ sessionId: session.sessionId,
140
+ clientKey: session.clientKey,
141
+ payment: {
142
+ paymentMethod: PaymentMethod.PAYMAYA
143
+ },
144
+ bill: {
145
+ email: form.email,
146
+ ...form.address,
147
+ province: addressState.getLabel(form.address.province, addressState.getProvinceOption()) ?? form.address.province,
148
+ city: addressState.getLabel(form.address.city, addressState.getCityOptions()) ?? form.address.city
149
+ },
150
+ browser: await getBrowserParams()
151
+ };
152
+ };
153
+ const pay = async (search = false, timeout) => {
154
+ var _a2, _b2, _c2, _d2, _e2;
155
+ try {
156
+ const paymentParams = await getPaymentParams();
157
+ const requestOptions = { locale: i18n.locale, timeout };
158
+ const res = search ? await getPaymayaPayInfo(
159
+ { sessionId: session.sessionId, clientKey: session.clientKey },
160
+ requestOptions
161
+ ) : await paymayaPay(paymentParams, props.core, requestOptions);
162
+ !search && ((_a2 = props.onSubmitResponse) == null ? void 0 : _a2.call(props, res));
163
+ const { status, orderStatus, errorMessage, errorCode, payInfo } = res;
164
+ if (status === "PROCESSING") {
165
+ if (!orderStatus) {
166
+ setSubmitButtonStatus("unSubmit");
167
+ return { end: true };
168
+ } else if (orderStatus === "SUCCESS") {
169
+ setSubmitButtonStatus("success");
170
+ (_b2 = props.onSuccess) == null ? void 0 : _b2.call(props);
171
+ return { end: true };
172
+ } else if (orderStatus === "FAILURE") {
173
+ setErrorMsg(errorMessage);
174
+ setSubmitButtonStatus("unSubmit");
175
+ processOnError(new PayKKaError("API_ERROR", errorMessage, { code: errorCode }));
176
+ return { end: true };
177
+ } else if (orderStatus === "PROCESSING") {
178
+ if (!search) {
179
+ if (redirectMode === "auto" && payInfo) {
180
+ redirectToPayment(payInfo);
181
+ return { end: true };
182
+ } else {
183
+ startReFetchPayInfo();
184
+ }
185
+ }
186
+ return { end: false };
187
+ } else if (orderStatus === "CANCELED") {
188
+ setSubmitButtonStatus("unSubmit");
189
+ (_c2 = props.onTimeout) == null ? void 0 : _c2.call(props);
190
+ core.resetEnablePaymentMethod();
191
+ return { end: true };
192
+ }
193
+ } else if (status === "SUCCESS") {
194
+ setSubmitButtonStatus("success");
195
+ (_d2 = props.onSuccess) == null ? void 0 : _d2.call(props);
196
+ return { end: true };
197
+ } else if (status === "EXPIRED") {
198
+ setSubmitButtonStatus("unSubmit");
199
+ (_e2 = props.onExpired) == null ? void 0 : _e2.call(props);
200
+ return { end: true };
201
+ }
202
+ setSubmitButtonStatus("unSubmit");
203
+ return { end: true };
204
+ } catch (error) {
205
+ if (isTimeoutError(error)) {
206
+ if (search) {
207
+ return { end: false };
208
+ } else {
209
+ onTimeout();
210
+ return { end: true };
211
+ }
212
+ } else {
213
+ const message = error.i18nKey ? i18n.get(error.i18nKey) : error.message;
214
+ setErrorMsg(message);
215
+ processOnError(new PayKKaError("API_ERROR", message, { code: error.code, cause: error }));
216
+ setSubmitButtonStatus("unSubmit");
217
+ return { end: true };
218
+ }
219
+ }
220
+ };
221
+ const validateForm = () => {
222
+ var _a2;
223
+ (_a2 = formRef.current) == null ? void 0 : _a2.validate(void 0, false).then(() => {
224
+ setValidated(true);
225
+ }).catch(() => {
226
+ setValidated(false);
227
+ });
228
+ };
229
+ y(() => {
230
+ validateForm();
231
+ }, [form]);
232
+ const onSubmit = async () => {
233
+ var _a2;
234
+ setErrorMsg("");
235
+ (_a2 = formRef.current) == null ? void 0 : _a2.validate(async (errors) => {
236
+ var _a3;
237
+ (fieldStatus == null ? void 0 : fieldStatus.address.show) && addressState.setValidateAllFields(true);
238
+ (_a3 = props.onSubmit) == null ? void 0 : _a3.call(props, errors);
239
+ if (errors) {
240
+ setSubmitButtonStatus("unSubmit");
241
+ return;
242
+ }
243
+ setErrorMsg("");
244
+ setSubmitButtonStatus("loading");
245
+ await pay();
246
+ });
247
+ };
248
+ const setFormRef = (dom) => {
249
+ formRef.current = dom;
250
+ dom && validateForm();
251
+ };
252
+ const Button = () => {
253
+ var _a2;
254
+ const transAmount = (_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.transAmount;
255
+ const amountText = (transAmount == null ? void 0 : transAmount.amount) ? formatAmount(transAmount).jointSymbol() : "";
256
+ const text = i18n.get("common.pay") + (amountText ? ` ${amountText}` : "");
257
+ return /* @__PURE__ */ u(
258
+ SubmitButton,
259
+ {
260
+ className: bem("button"),
261
+ status: submitButtonStatus,
262
+ text,
263
+ loadingText: i18n.get("common.payProcessing"),
264
+ successText: i18n.get("common.paySuccess"),
265
+ onClick: onSubmit,
266
+ verified: validated
267
+ }
268
+ );
269
+ };
270
+ const Email = () => {
271
+ return /* @__PURE__ */ u(b, { children: (fieldStatus == null ? void 0 : fieldStatus.email.show) && /* @__PURE__ */ u("div", { className: fieldClassNames, children: /* @__PURE__ */ u(
272
+ EmailField,
273
+ {
274
+ ref: emailFieldRef,
275
+ value: form.email,
276
+ disabled: fieldStatus == null ? void 0 : fieldStatus.email.disabled
277
+ }
278
+ ) }) });
279
+ };
280
+ const formStyle = {
281
+ [cssVarPrefix("button-bg-color")]: (_a = session == null ? void 0 : session.colors) == null ? void 0 : _a.primary,
282
+ [cssVarPrefix("button-bg-color-hover")]: (_b = session == null ? void 0 : session.colors) == null ? void 0 : _b.primaryHover,
283
+ [cssVarPrefix("button-bg-color-active")]: (_c = session == null ? void 0 : session.colors) == null ? void 0 : _c.primaryActive,
284
+ [cssVarPrefix("button-text-color")]: (_e = (_d = session == null ? void 0 : session.checkout) == null ? void 0 : _d.theme) == null ? void 0 : _e.payButtonTextColor,
285
+ [cssVarPrefix("input-color")]: (_f = session == null ? void 0 : session.colors) == null ? void 0 : _f.primary
286
+ };
287
+ const ErrorMessage = () => {
288
+ return /* @__PURE__ */ u(b, { children: !!errorMsg && /* @__PURE__ */ u(Info, { content: errorMsg, style: { marginTop: "12px" } }) });
289
+ };
290
+ const Address = () => {
291
+ var _a2, _b2;
292
+ return /* @__PURE__ */ u(b, { children: (fieldStatus == null ? void 0 : fieldStatus.address.show) && /* @__PURE__ */ u("div", { className: fieldClassNames, children: /* @__PURE__ */ u(
293
+ AddressField,
294
+ {
295
+ ref: addressFieldRef,
296
+ value: form.address,
297
+ country: ((_a2 = session == null ? void 0 : session.checkout) == null ? void 0 : _a2.country) || ((_b2 = session == null ? void 0 : session.checkout) == null ? void 0 : _b2.bill.country),
298
+ onAddressChange: (value) => setForm(Object.assign(form, { address: value }))
299
+ }
300
+ ) }) });
301
+ };
302
+ return /* @__PURE__ */ u(
303
+ CoreContext.Provider,
304
+ {
305
+ value: {
306
+ i18n,
307
+ session
308
+ },
309
+ children: isCheckoutEnabled && i18n.ready.value && /* @__PURE__ */ u(b, { children: [
310
+ showGuideCard && /* @__PURE__ */ u(GuideCard, { type: PaymentCategory.PAYMAYA }),
311
+ /* @__PURE__ */ u(Form, { form, ref: setFormRef, onFormChange: (form2) => setForm(form2), children: /* @__PURE__ */ u("div", { className: normalizedClass(COMMON_CLASS_NAME, bem()), style: formStyle, children: [
312
+ Email(),
313
+ Address(),
314
+ ErrorMessage(),
315
+ !hidePaymentButton && Button()
316
+ ] }) })
317
+ ] })
318
+ }
319
+ );
320
+ });
321
+ export {
322
+ Paymaya
323
+ };
@@ -0,0 +1 @@
1
+ import "./Paymaya.js";
package/dist/es/config.js CHANGED
@@ -9,27 +9,27 @@ let fraudDetectionEnv = void 0;
9
9
  let customReqHeaders = {};
10
10
  let customLocale = void 0;
11
11
  let hidePaymentButton = false;
12
- function setApiUrl(url) {
12
+ const setApiUrl = (url) => {
13
13
  apiUrl = url;
14
- }
15
- function setCDNUrl(url) {
14
+ };
15
+ const setCDNUrl = (url) => {
16
16
  const urlInfo = new URL(url);
17
17
  cdnOrigin = urlInfo.origin;
18
18
  cdnDir = urlInfo.pathname;
19
19
  cdnUrl = `${cdnOrigin}${cdnDir === "/" ? "" : cdnDir}`;
20
- }
21
- function setFraudDetectionEnv(env) {
20
+ };
21
+ const setFraudDetectionEnv = (env) => {
22
22
  fraudDetectionEnv = env;
23
- }
24
- function setCustomReqHeaders(headers) {
23
+ };
24
+ const setCustomReqHeaders = (headers) => {
25
25
  customReqHeaders = headers;
26
- }
27
- function setCustomLocale(locale) {
26
+ };
27
+ const setCustomLocale = (locale) => {
28
28
  customLocale = locale;
29
- }
30
- function setCheckoutConfig(params) {
29
+ };
30
+ const setCheckoutConfig = (params) => {
31
31
  hidePaymentButton = params.hidePaymentButton || false;
32
- }
32
+ };
33
33
  export {
34
34
  apiUrl,
35
35
  cdnOrigin,
@@ -2,8 +2,6 @@ const PREFIX = "paykka-card-checkout";
2
2
  const COMMON_CLASS_NAME = PREFIX;
3
3
  var PaymentMethod = /* @__PURE__ */ ((PaymentMethod2) => {
4
4
  PaymentMethod2["ALL"] = "ALL";
5
- PaymentMethod2["ALI_PAY"] = "ALIPAY_PLUS";
6
- PaymentMethod2["WECHAT_PAY"] = "WECHAT_PAY_GLOBAL";
7
5
  PaymentMethod2["APPLE_PAY"] = "APPLE_PAY";
8
6
  PaymentMethod2["GOOGLE_PAY"] = "GOOGLE_PAY";
9
7
  PaymentMethod2["BANKCARD"] = "BANKCARD";
@@ -14,17 +12,107 @@ var PaymentMethod = /* @__PURE__ */ ((PaymentMethod2) => {
14
12
  PaymentMethod2["DINERS_CLUB"] = "DINERS_CLUB";
15
13
  PaymentMethod2["DISCOVER"] = "DISCOVER";
16
14
  PaymentMethod2["BOC"] = "BOC";
15
+ PaymentMethod2["CHINA_UNION_PAY"] = "CHINA_UNION_PAY";
16
+ PaymentMethod2["ALI_PAY"] = "ALIPAY_PLUS";
17
+ PaymentMethod2["WECHAT_PAY"] = "WECHAT_PAY_GLOBAL";
18
+ PaymentMethod2["BOOST"] = "BOOST";
19
+ PaymentMethod2["GRAB_PAY"] = "GRABPAY";
20
+ PaymentMethod2["TNG_WALLET"] = "TNG_EWALLET";
21
+ PaymentMethod2["MAY_BANK_QR_PAY"] = "MAYBANK_QRPAY";
22
+ PaymentMethod2["SHOPEE_PAY"] = "SHOPEE_PAY";
23
+ PaymentMethod2["LINE_PAY"] = "LINE_PAY";
24
+ PaymentMethod2["NINE_PAY"] = "NINE_PAY";
25
+ PaymentMethod2["GCASH"] = "G_CASH";
26
+ PaymentMethod2["PAYMAYA"] = "PAYMAYA";
17
27
  PaymentMethod2["SEPA_DEBIT"] = "SEPA_DEBIT";
18
28
  return PaymentMethod2;
19
29
  })(PaymentMethod || {});
30
+ var PaymentCategory = /* @__PURE__ */ ((PaymentCategory2) => {
31
+ PaymentCategory2["CARD"] = "card";
32
+ PaymentCategory2["APPLE_PAY"] = "applePay";
33
+ PaymentCategory2["GOOGLE_PAY"] = "googlePay";
34
+ PaymentCategory2["SEPA_DEBIT"] = "sepaDebit";
35
+ PaymentCategory2["WECHAT_PAY"] = "wechatPay";
36
+ PaymentCategory2["ALI_PAY"] = "aliPay";
37
+ PaymentCategory2["BOOST"] = "boost";
38
+ PaymentCategory2["GRAB_PAY"] = "grabPay";
39
+ PaymentCategory2["TNG_WALLET"] = "tngEWallet";
40
+ PaymentCategory2["MAY_BANK_QR_PAY"] = "mayBankQRPay";
41
+ PaymentCategory2["SHOPEE_PAY"] = "shopeePay";
42
+ PaymentCategory2["LINE_PAY"] = "linePay";
43
+ PaymentCategory2["NINE_PAY"] = "ninePay";
44
+ PaymentCategory2["GCASH"] = "gcash";
45
+ PaymentCategory2["PAYMAYA"] = "paymaya";
46
+ return PaymentCategory2;
47
+ })(PaymentCategory || {});
48
+ const PaymentMethod2CategoryMap = {
49
+ [
50
+ "APPLE_PAY"
51
+ /* APPLE_PAY */
52
+ ]: "applePay",
53
+ [
54
+ "GOOGLE_PAY"
55
+ /* GOOGLE_PAY */
56
+ ]: "googlePay",
57
+ [
58
+ "SEPA_DEBIT"
59
+ /* SEPA_DEBIT */
60
+ ]: "sepaDebit",
61
+ [
62
+ "WECHAT_PAY_GLOBAL"
63
+ /* WECHAT_PAY */
64
+ ]: "wechatPay",
65
+ [
66
+ "ALIPAY_PLUS"
67
+ /* ALI_PAY */
68
+ ]: "aliPay",
69
+ [
70
+ "BOOST"
71
+ /* BOOST */
72
+ ]: "boost",
73
+ [
74
+ "GRABPAY"
75
+ /* GRAB_PAY */
76
+ ]: "grabPay",
77
+ [
78
+ "TNG_EWALLET"
79
+ /* TNG_WALLET */
80
+ ]: "tngEWallet",
81
+ [
82
+ "MAYBANK_QRPAY"
83
+ /* MAY_BANK_QR_PAY */
84
+ ]: "mayBankQRPay",
85
+ [
86
+ "SHOPEE_PAY"
87
+ /* SHOPEE_PAY */
88
+ ]: "shopeePay",
89
+ [
90
+ "LINE_PAY"
91
+ /* LINE_PAY */
92
+ ]: "linePay",
93
+ [
94
+ "NINE_PAY"
95
+ /* NINE_PAY */
96
+ ]: "ninePay",
97
+ [
98
+ "G_CASH"
99
+ /* GCASH */
100
+ ]: "gcash",
101
+ [
102
+ "PAYMAYA"
103
+ /* PAYMAYA */
104
+ ]: "paymaya"
105
+ /* PAYMAYA */
106
+ };
20
107
  const CardPaymentMethods = [
21
108
  "VISA",
22
109
  "MASTER_CARD",
23
110
  "JCB",
24
111
  "AMEX",
25
112
  "DINERS_CLUB",
26
- "DISCOVER"
27
- /* DISCOVER */
113
+ "DISCOVER",
114
+ "CHINA_UNION_PAY"
115
+ /* CHINA_UNION_PAY */
28
116
  ];
29
117
  var PaymentType = /* @__PURE__ */ ((PaymentType2) => {
30
118
  PaymentType2["PURCHASE"] = "PURCHASE";
@@ -53,7 +141,9 @@ export {
53
141
  CardPaymentMethods,
54
142
  EAddressType,
55
143
  PREFIX,
144
+ PaymentCategory,
56
145
  PaymentMethod,
146
+ PaymentMethod2CategoryMap,
57
147
  PaymentType,
58
148
  SessionMode
59
149
  };
@@ -1,3 +1,9 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => {
4
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
+ return value;
6
+ };
1
7
  var __accessCheck = (obj, member, msg) => {
2
8
  if (!member.has(obj))
3
9
  throw TypeError("Cannot " + msg);
@@ -25,12 +31,23 @@ import { apiEnv, cdnEnv, fraudDetectionEnv } from "./environment.js";
25
31
  import { isEmptyObject } from "../utils/is.js";
26
32
  import "../utils/card-brand/brands.js";
27
33
  import "../utils/system-info/get-browser-info.js";
34
+ import { getUrlParam } from "../utils/location.js";
35
+ import { d } from "../core.js";
36
+ const PROCESSING_PARAM_NAME = "m";
28
37
  class PayKKaCheckout {
29
38
  constructor(config) {
30
39
  __privateAdd(this, _config, void 0);
31
40
  __privateAdd(this, _envConfig, void 0);
32
41
  __privateAdd(this, _session, void 0);
33
42
  __privateAdd(this, _componentInsts, []);
43
+ // TODO: 这俩属性不应该放在这里,但他们是在 PayKKaCheckout 实例中保持唯一的数据,还没想好放哪里
44
+ /** 当前正在处理的支付方式,在第三方支付页面跳回收银台时,会通过 url 参数传递过来 */
45
+ __publicField(this, "processingPaymentMethod", null);
46
+ /**
47
+ * 当前启用的支付方式(禁用则展示禁用样式)
48
+ * 在 DropIn 且有正在处理的支付方式时,会设置为当前支付方式,并把其他支付方式设为禁用
49
+ */
50
+ __publicField(this, "enablePaymentMethod", d(null));
34
51
  __privateSet(this, _config, config);
35
52
  this.init();
36
53
  }
@@ -39,6 +56,7 @@ class PayKKaCheckout {
39
56
  this.initLocale();
40
57
  this.initExtraParams();
41
58
  this.initSession();
59
+ this.initOtherData();
42
60
  }
43
61
  initSession() {
44
62
  const { sessionId, clientKey, onPaymentMethodsReady, onInitError } = __privateGet(this, _config);
@@ -79,9 +97,13 @@ class PayKKaCheckout {
79
97
  }
80
98
  initExtraParams() {
81
99
  const { hidePaymentButton = false } = __privateGet(this, _config);
82
- setCheckoutConfig({
83
- hidePaymentButton
84
- });
100
+ setCheckoutConfig({ hidePaymentButton });
101
+ }
102
+ initOtherData() {
103
+ const res = getUrlParam(PROCESSING_PARAM_NAME);
104
+ if (res) {
105
+ this.processingPaymentMethod = res;
106
+ }
85
107
  }
86
108
  get session() {
87
109
  return __privateGet(this, _session);
@@ -89,11 +111,20 @@ class PayKKaCheckout {
89
111
  get envConfig() {
90
112
  return __privateGet(this, _envConfig);
91
113
  }
114
+ get config() {
115
+ return __privateGet(this, _config);
116
+ }
92
117
  /** 创建组件,把 session 作为组件的 props 传递 */
93
118
  create(component, props) {
94
119
  var _a;
120
+ const { onSubmit, onSuccess, onError, onTimeout, onExpired } = __privateGet(this, _config);
95
121
  const coreProps = this.getCoreProps();
96
122
  const componentInst = create(component, {
123
+ onSubmit,
124
+ onSuccess,
125
+ onError,
126
+ onTimeout,
127
+ onExpired,
97
128
  ...props,
98
129
  ...coreProps
99
130
  });
@@ -103,9 +134,13 @@ class PayKKaCheckout {
103
134
  getCoreProps() {
104
135
  return {
105
136
  session: __privateGet(this, _session),
137
+ core: this,
106
138
  threeDSFrame: __privateGet(this, _config).threeDSFrame
107
139
  };
108
140
  }
141
+ resetEnablePaymentMethod() {
142
+ this.enablePaymentMethod.value = null;
143
+ }
109
144
  }
110
145
  _config = new WeakMap();
111
146
  _envConfig = new WeakMap();
@@ -21,18 +21,17 @@ var __privateMethod = (obj, member, method) => {
21
21
  __accessCheck(obj, member, "access private method");
22
22
  return method;
23
23
  };
24
- var _readyPromise, _init, init_fn, _genColors, genColors_fn;
24
+ var _readyPromise, _init, init_fn;
25
+ import { isTimeoutError } from "../api/http.js";
25
26
  import "../utils/card-brand/brands.js";
26
27
  import "../utils/system-info/get-browser-info.js";
27
28
  import { generateColors } from "../utils/colors.js";
28
29
  import { createPromise } from "../utils/create-promise.js";
29
- import "../core.js";
30
30
  import { PayKKaError } from "./error.js";
31
31
  import { querySession } from "./query.js";
32
32
  class Session {
33
33
  constructor(sessionId, clientKey) {
34
34
  __privateAdd(this, _init);
35
- __privateAdd(this, _genColors);
36
35
  __publicField(this, "sessionId");
37
36
  __publicField(this, "clientKey");
38
37
  __publicField(this, "checkout");
@@ -41,11 +40,29 @@ class Session {
41
40
  this.sessionId = sessionId;
42
41
  this.clientKey = clientKey;
43
42
  __privateMethod(this, _init, init_fn).call(this).then(() => __privateGet(this, _readyPromise).resolve(true)).catch((err) => {
44
- return __privateGet(this, _readyPromise).reject(
45
- new PayKKaError("API_ERROR", err.message, { code: err.code })
46
- );
43
+ if (isTimeoutError(err)) {
44
+ __privateGet(this, _readyPromise).reject(err);
45
+ } else {
46
+ __privateGet(this, _readyPromise).reject(new PayKKaError("API_ERROR", err.message, { code: err.code }));
47
+ }
47
48
  });
48
49
  }
50
+ /** 生成主题色 */
51
+ genColors() {
52
+ var _a;
53
+ const { payButtonBackgroundColor } = ((_a = this.checkout) == null ? void 0 : _a.theme) || {};
54
+ if (payButtonBackgroundColor) {
55
+ const colors = generateColors(payButtonBackgroundColor, {
56
+ theme: "default",
57
+ backgroundColor: "#fff"
58
+ });
59
+ this.colors = {
60
+ primary: colors[5],
61
+ primaryHover: colors[4],
62
+ primaryActive: colors[6]
63
+ };
64
+ }
65
+ }
49
66
  ready() {
50
67
  return __privateGet(this, _readyPromise);
51
68
  }
@@ -57,23 +74,7 @@ init_fn = async function() {
57
74
  sessionId: this.sessionId,
58
75
  clientKey: this.clientKey
59
76
  });
60
- __privateMethod(this, _genColors, genColors_fn).call(this);
61
- };
62
- _genColors = new WeakSet();
63
- genColors_fn = function() {
64
- var _a;
65
- const { payButtonBackgroundColor } = ((_a = this.checkout) == null ? void 0 : _a.theme) || {};
66
- if (payButtonBackgroundColor) {
67
- const colors = generateColors(payButtonBackgroundColor, {
68
- theme: "default",
69
- backgroundColor: "#fff"
70
- });
71
- this.colors = {
72
- primary: colors[5],
73
- primaryHover: colors[4],
74
- primaryActive: colors[6]
75
- };
76
- }
77
+ this.genColors();
77
78
  };
78
79
  export {
79
80
  Session
@@ -4,6 +4,12 @@ var __publicField = (obj, key, value) => {
4
4
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
5
  return value;
6
6
  };
7
+ var EPayKKaError = /* @__PURE__ */ ((EPayKKaError2) => {
8
+ EPayKKaError2["ERROR"] = "ERROR";
9
+ EPayKKaError2["API_ERROR"] = "API_ERROR";
10
+ EPayKKaError2["TIMEOUT"] = "TIMEOUT";
11
+ return EPayKKaError2;
12
+ })(EPayKKaError || {});
7
13
  class PayKKaError extends Error {
8
14
  constructor(type, message, info) {
9
15
  super(message);
@@ -17,5 +23,6 @@ class PayKKaError extends Error {
17
23
  }
18
24
  }
19
25
  export {
26
+ EPayKKaError,
20
27
  PayKKaError
21
28
  };