@paykka/card-checkout-ui 0.9.2 → 0.11.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 (108) hide show
  1. package/dist/card-checkout-ui.js +16 -16
  2. package/dist/card-checkout-ui.umd.cjs +16 -16
  3. package/dist/es/api/index.js +1 -2
  4. package/dist/es/api/modules/index.js +1 -2
  5. package/dist/es/api/modules/risk/index.js +13 -0
  6. package/dist/es/api/modules/threeDS/index.js +1 -0
  7. package/dist/es/components/AccordionItem/AccordionItem.js +1 -0
  8. package/dist/es/components/AccountNameField/index.js +1 -0
  9. package/dist/es/components/AddressField/index.js +1 -0
  10. package/dist/es/components/AliPay/index.js +1 -1
  11. package/dist/es/components/ApplePay/index.js +2 -2
  12. package/dist/es/components/Boost/index.js +3 -1
  13. package/dist/es/components/Card/index.js +29 -8
  14. package/dist/es/components/CardBrands/index.js +1 -0
  15. package/dist/es/components/CardExpireDateField/index.js +1 -0
  16. package/dist/es/components/CardHolderNameField/index.js +1 -0
  17. package/dist/es/components/CardIBANField/index.js +1 -0
  18. package/dist/es/components/CardNo/index.js +1 -0
  19. package/dist/es/components/CardNumberField/index.js +13 -2
  20. package/dist/es/components/CardSecurityCodeField/index.js +1 -0
  21. package/dist/es/components/CardSelector/index.js +1 -0
  22. package/dist/es/components/CombinedCardInfo/index.js +4 -0
  23. package/dist/es/components/DropIn/index.js +2 -1
  24. package/dist/es/components/EmailField/EmailField.js +14 -15
  25. package/dist/es/components/EncryptedCard/index.js +1 -0
  26. package/dist/es/components/GooglePay/index.js +2 -2
  27. package/dist/es/components/GrabPay/index.js +3 -1
  28. package/dist/es/components/GuideCard/index.js +1 -0
  29. package/dist/es/components/LinePay/index.js +3 -1
  30. package/dist/es/components/MayBankQRPay/index.js +3 -1
  31. package/dist/es/components/NinePay/index.js +3 -1
  32. package/dist/es/components/RecurringTip/index.js +1 -0
  33. package/dist/es/components/SecuredFieldsProvider/index.js +2 -1
  34. package/dist/es/components/SecuredIframe/index.js +54 -2
  35. package/dist/es/components/Sepa/index.js +1 -1
  36. package/dist/es/components/ShopeePay/index.js +3 -1
  37. package/dist/es/components/SubmitButton/index.js +1 -0
  38. package/dist/es/components/TNGWallet/index.js +3 -1
  39. package/dist/es/components/ThreeDS/index.js +1 -0
  40. package/dist/es/components/WechatPay/index.js +1 -1
  41. package/dist/es/components/business/QRCodeModal/QRCodeModal.js +1 -0
  42. package/dist/es/components/business/QRCodeModal/index.js +1 -0
  43. package/dist/es/components/business/index.js +1 -0
  44. package/dist/es/components/index.js +1 -0
  45. package/dist/es/components/internal/Accordion/index.js +1 -0
  46. package/dist/es/components/internal/Button/Button.js +1 -0
  47. package/dist/es/components/internal/Button/index.js +1 -0
  48. package/dist/es/components/internal/CheckBox/CheckBox.js +1 -0
  49. package/dist/es/components/internal/CheckBox/index.js +1 -0
  50. package/dist/es/components/internal/Form/type.js +1 -0
  51. package/dist/es/components/internal/Info/Info.js +1 -0
  52. package/dist/es/components/internal/Info/index.js +1 -0
  53. package/dist/es/components/internal/Input/type.js +1 -0
  54. package/dist/es/components/internal/LoadingCheck/LoadingCheck.js +1 -0
  55. package/dist/es/components/internal/LoadingCheck/index.js +1 -0
  56. package/dist/es/components/internal/Modal/Modal.js +1 -0
  57. package/dist/es/components/internal/QRCode/QRCode.js +1 -0
  58. package/dist/es/components/internal/QRCode/index.js +1 -0
  59. package/dist/es/components/internal/Select/Select.js +11 -9
  60. package/dist/es/components/internal/Select/SelectMenu.js +1 -0
  61. package/dist/es/components/internal/Select/SelectMenuItem.js +1 -0
  62. package/dist/es/components/wallets/GCash/GCash.js +15 -3
  63. package/dist/es/components/wallets/Paymaya/Paymaya.js +3 -1
  64. package/dist/es/core/PayKKaCheckout.js +7 -2
  65. package/dist/es/core/index.js +1 -0
  66. package/dist/es/core/query.js +1 -2
  67. package/dist/es/hooks/index.js +1 -0
  68. package/dist/es/hooks/useI18n.js +1 -0
  69. package/dist/es/hooks/usePayState.js +7 -2
  70. package/dist/es/i18n/locales/index.js +2 -1
  71. package/dist/es/i18n/locales/nl-NL.js +88 -0
  72. package/dist/es/index.js +2 -0
  73. package/dist/es/out/fraud-detection.js +39 -13
  74. package/dist/es/out/worldpay-ddc.js +143 -0
  75. package/dist/es/types/event.js +15 -0
  76. package/dist/es/types/fraud-detection.js +1 -0
  77. package/dist/es/types/message.js +3 -0
  78. package/dist/es/utils/iframe.js +1 -1
  79. package/dist/es/utils/reg-exp.js +4 -0
  80. package/dist/types/api/modules/index.d.ts +2 -0
  81. package/dist/types/api/modules/risk/index.d.ts +8 -0
  82. package/dist/types/api/modules/threeDS/index.d.ts +3 -0
  83. package/dist/types/components/CardNumberField/type.d.ts +7 -1
  84. package/dist/types/components/CombinedCardInfo/type.d.ts +1 -0
  85. package/dist/types/components/SecuredFieldsProvider/type.d.ts +1 -1
  86. package/dist/types/components/ThreeDS/components/ThreeDSIframe/ThreeDSIframe.d.ts +1 -0
  87. package/dist/types/components/ThreeDS/components/ThreeDSIframe/output.d.ts +1 -1
  88. package/dist/types/components/ThreeDS/components/ThreeDSIframe/type.d.ts +13 -3
  89. package/dist/types/components/internal/Select/Select.d.ts +1 -17
  90. package/dist/types/components/internal/Select/type.d.ts +26 -1
  91. package/dist/types/components/wallets/GCash/type.d.ts +5 -0
  92. package/dist/types/core/error.d.ts +12 -1
  93. package/dist/types/hooks/usePayState.d.ts +5 -2
  94. package/dist/types/i18n/locales/index.d.ts +2 -0
  95. package/dist/types/i18n/locales/nl-NL.d.ts +71 -0
  96. package/dist/types/index.d.ts +1 -0
  97. package/dist/types/out/fraud-detection.d.ts +5 -1
  98. package/dist/types/out/types.d.ts +4 -0
  99. package/dist/types/out/worldpay-ddc-iframe.d.ts +1 -0
  100. package/dist/types/out/worldpay-ddc.d.ts +37 -0
  101. package/dist/types/types/event.d.ts +26 -0
  102. package/dist/types/types/fraud-detection.d.ts +3 -1
  103. package/dist/types/types/index.d.ts +13 -1
  104. package/dist/types/types/message.d.ts +21 -2
  105. package/dist/types/utils/iframe.d.ts +1 -1
  106. package/dist/types/utils/index.d.ts +1 -0
  107. package/dist/types/utils/reg-exp.d.ts +1 -0
  108. package/package.json +3 -1
@@ -371,6 +371,7 @@ const FieldIframe = (props) => {
371
371
  value: value.current,
372
372
  fieldType: props.fieldType
373
373
  };
374
+ console.log(hiddenIframe, props.hiddenIframeName);
374
375
  postMessageToIframe(validWithValueData, hiddenIframe, cdnOrigin);
375
376
  };
376
377
  const sendActivatedMessage = () => {
@@ -409,6 +410,7 @@ const HiddenIframe = () => {
409
410
  const onReceiveMessage = async (event) => {
410
411
  const { data } = event;
411
412
  const parsedData = safeParse(data);
413
+ console.log(parsedData);
412
414
  if (!Reflect.has(parsedData, "action")) {
413
415
  return;
414
416
  }
@@ -417,22 +419,50 @@ const HiddenIframe = () => {
417
419
  switch (feedbackData.fieldType) {
418
420
  case EFieldType.CVV: {
419
421
  formData.cvv = feedbackData.value;
422
+ setMessageList([
423
+ ...messageList,
424
+ {
425
+ name: "CVV",
426
+ label: `收到值:${feedbackData.value}`
427
+ }
428
+ ]);
420
429
  break;
421
430
  }
422
431
  case EFieldType.CARD_NUMBER: {
423
432
  formData.cardNo = trimAll(feedbackData.value);
433
+ setMessageList([
434
+ ...messageList,
435
+ {
436
+ name: "卡号",
437
+ label: `收到值:${feedbackData.value}`
438
+ }
439
+ ]);
424
440
  break;
425
441
  }
426
442
  case EFieldType.EXPIRE_DATE: {
427
443
  const [expMonth, expYear] = feedbackData.value.split("/");
428
444
  formData.expMonth = expMonth;
429
445
  formData.expYear = `20${expYear}`;
446
+ setMessageList([
447
+ ...messageList,
448
+ {
449
+ name: "卡有效期",
450
+ label: `收到值:${feedbackData.value}`
451
+ }
452
+ ]);
430
453
  break;
431
454
  }
432
455
  }
433
456
  } else if (parsedData.action === MessageAction.PAYMENT) {
434
457
  const feedbackData = parsedData;
435
458
  pay(feedbackData.formData, feedbackData.locale, feedbackData.extraParams);
459
+ setMessageList([
460
+ ...messageList,
461
+ {
462
+ name: "表单组件",
463
+ label: `进行支付,${JSON.stringify(formData || {})}`
464
+ }
465
+ ]);
436
466
  } else if (parsedData.action === MessageAction.ENCRYPT_CARD) {
437
467
  const feedbackData = parsedData;
438
468
  try {
@@ -442,9 +472,14 @@ const HiddenIframe = () => {
442
472
  console.log("error", error);
443
473
  sendCardEncryptionFailedMessage(error);
444
474
  }
475
+ } else if (parsedData.action === MessageAction.DEBUG_MODE) {
476
+ console.log("hidden iframe 开启测试模式");
445
477
  }
446
478
  };
447
- window.addEventListener("message", onReceiveMessage);
479
+ y(() => {
480
+ console.log("hidden iframe 加载完成");
481
+ window.addEventListener("message", onReceiveMessage);
482
+ }, []);
448
483
  const pay = (params, locale, extraParams) => {
449
484
  cardPay(
450
485
  {
@@ -510,7 +545,24 @@ const HiddenIframe = () => {
510
545
  y(() => {
511
546
  sendHiddenIframeReadyMessage();
512
547
  }, []);
513
- return /* @__PURE__ */ u(b, {});
548
+ const [messageList, setMessageList] = h([]);
549
+ const messageListRef = A(null);
550
+ y(() => {
551
+ if (messageListRef.current) {
552
+ messageListRef.current.scrollTop = messageListRef.current.scrollHeight;
553
+ }
554
+ }, [messageList]);
555
+ return /* @__PURE__ */ u(b, { children: /* @__PURE__ */ u("div", { style: "width: 100%; height: 100%; overflow-y: auto", ref: messageListRef, children: messageList.map((message) => /* @__PURE__ */ u("div", { style: { fontSize: "18px", marginBottom: "4px" }, children: [
556
+ /* @__PURE__ */ u("span", { style: { color: "#4f43df" }, children: [
557
+ "[",
558
+ message.name,
559
+ "]"
560
+ ] }),
561
+ /* @__PURE__ */ u("span", { children: [
562
+ ": ",
563
+ message.label
564
+ ] })
565
+ ] })) }) });
514
566
  };
515
567
  const SecuredIframe = () => {
516
568
  const [fieldIframeConfig, setFieldIframeConfig] = h();
@@ -29,7 +29,7 @@ const Sepa = w((props, ref) => {
29
29
  const { session } = props;
30
30
  let addressState = createAddressCore();
31
31
  let emailState = createEmailCore();
32
- const { i18n, sessionReady } = usePayState(session);
32
+ const { i18n, sessionReady } = usePayState(session, props.core);
33
33
  const addressFieldRef = A(null);
34
34
  const emailFieldRef = A(null);
35
35
  const formRef = A(null);
@@ -57,7 +57,9 @@ const ShopeePay = w((props, ref) => {
57
57
  if (!(fieldStatus == null ? void 0 : fieldStatus.email.show))
58
58
  return;
59
59
  setForm(Object.assign(form, { email: emailState.email }));
60
+ form.email = emailState.email;
60
61
  (_a2 = emailFieldRef.current) == null ? void 0 : _a2.update(emailState.email);
62
+ validateForm();
61
63
  },
62
64
  payment: () => {
63
65
  hidePaymentButton && onSubmit();
@@ -68,7 +70,7 @@ const ShopeePay = w((props, ref) => {
68
70
  const addressFieldRef = A(null);
69
71
  const emailFieldRef = A(null);
70
72
  const [isCheckoutEnabled, setIsCheckoutEnabled] = h(false);
71
- const { setErrorMsg, i18n, errorMsg, sessionReady } = usePayState(session);
73
+ const { setErrorMsg, i18n, errorMsg, sessionReady } = usePayState(session, props.core);
72
74
  const [submitButtonStatus, setSubmitButtonStatus] = h("unSubmit");
73
75
  const formRef = A(null);
74
76
  const [form, setForm] = h({
@@ -4,6 +4,7 @@ import "../../core/context.js";
4
4
  import "../../utils/card-brand/brands.js";
5
5
  import "../../utils/system-info/get-browser-info.js";
6
6
  import { normalizedClass } from "../../utils/format.js";
7
+ import "../../api/http.js";
7
8
  import enGB from "../../i18n/locales/en-GB.js";
8
9
  import { Button } from "../internal/Button/Button.js";
9
10
  import { IconSafe } from "../internal/icons/IconSafe.js";
@@ -57,7 +57,9 @@ const TNGWallet = w((props, ref) => {
57
57
  if (!(fieldStatus == null ? void 0 : fieldStatus.email.show))
58
58
  return;
59
59
  setForm(Object.assign(form, { email: emailState.email }));
60
+ form.email = emailState.email;
60
61
  (_a2 = emailFieldRef.current) == null ? void 0 : _a2.update(emailState.email);
62
+ validateForm();
61
63
  },
62
64
  payment: () => {
63
65
  hidePaymentButton && onSubmit();
@@ -68,7 +70,7 @@ const TNGWallet = w((props, ref) => {
68
70
  const addressFieldRef = A(null);
69
71
  const emailFieldRef = A(null);
70
72
  const [isCheckoutEnabled, setIsCheckoutEnabled] = h(false);
71
- const { setErrorMsg, i18n, errorMsg, sessionReady } = usePayState(session);
73
+ const { setErrorMsg, i18n, errorMsg, sessionReady } = usePayState(session, props.core);
72
74
  const [submitButtonStatus, setSubmitButtonStatus] = h("unSubmit");
73
75
  const formRef = A(null);
74
76
  const [form, setForm] = h({
@@ -2,6 +2,7 @@ import { h, A, T, y, u } from "../../core.js";
2
2
  import "../../utils/card-brand/brands.js";
3
3
  import "../../utils/system-info/get-browser-info.js";
4
4
  import "../../core/context.js";
5
+ import "../../api/http.js";
5
6
  import { Modal } from "../internal/Modal/Modal.js";
6
7
  import "../internal/Button/button2.js";
7
8
  import { useBEM } from "../../hooks/useBEM.js";
@@ -49,7 +49,7 @@ const WechatPay = w((props, ref) => {
49
49
  (_a2 = emailFieldRef.current) == null ? void 0 : _a2.update(emailState.email);
50
50
  }
51
51
  }));
52
- const { setErrorMsg, i18n, errorMsg, sessionReady } = usePayState(session);
52
+ const { setErrorMsg, i18n, errorMsg, sessionReady } = usePayState(session, props.core);
53
53
  const [submitButtonStatus, setSubmitButtonStatus] = h("unSubmit");
54
54
  const formRef = A(null);
55
55
  const [form, setForm] = h({
@@ -1,6 +1,7 @@
1
1
  import { u, b } from "../../../core.js";
2
2
  import { useBEM } from "../../../hooks/useBEM.js";
3
3
  import { useI18n } from "../../../hooks/useI18n.js";
4
+ import "../../../api/http.js";
4
5
  import "../../../utils/card-brand/brands.js";
5
6
  import "../../../utils/system-info/get-browser-info.js";
6
7
  import { formatAmount } from "../../../utils/format.js";
@@ -2,5 +2,6 @@ import "../../../core.js";
2
2
  import "../../../utils/card-brand/brands.js";
3
3
  import "../../../utils/system-info/get-browser-info.js";
4
4
  import "../../../core/context.js";
5
+ import "../../../api/http.js";
5
6
  import "../../internal/Modal/Modal.js";
6
7
  import "./qr-code-modal.js";
@@ -2,5 +2,6 @@ import "../../core.js";
2
2
  import "../../utils/card-brand/brands.js";
3
3
  import "../../utils/system-info/get-browser-info.js";
4
4
  import "../../core/context.js";
5
+ import "../../api/http.js";
5
6
  import "../internal/Modal/Modal.js";
6
7
  import "./QRCodeModal/qr-code-modal.js";
@@ -6,6 +6,7 @@ import "./CardBrands/index.js";
6
6
  import "../utils/card-brand/brands.js";
7
7
  import "../utils/system-info/get-browser-info.js";
8
8
  import "../core/context.js";
9
+ import "../api/http.js";
9
10
  import "./CardExpireDateField/index.js";
10
11
  import "./internal/Form/type.js";
11
12
  import "./internal/Form/context.js";
@@ -4,4 +4,5 @@ import "./accordion2.js";
4
4
  import "../../../utils/card-brand/brands.js";
5
5
  import "../../../utils/system-info/get-browser-info.js";
6
6
  import "../../../core/context.js";
7
+ import "../../../api/http.js";
7
8
  import "../../AccordionItem/AccordionItem.js";
@@ -6,6 +6,7 @@ import "../../../core/context.js";
6
6
  import "../../../utils/card-brand/brands.js";
7
7
  import "../../../utils/system-info/get-browser-info.js";
8
8
  import { normalizedClass } from "../../../utils/format.js";
9
+ import "../../../api/http.js";
9
10
  const { bem } = useBEM("button");
10
11
  function Button(props) {
11
12
  const { style, className, children, icon, loading, disabled, dashed } = props;
@@ -3,3 +3,4 @@ import "./button2.js";
3
3
  import "../../../utils/card-brand/brands.js";
4
4
  import "../../../utils/system-info/get-browser-info.js";
5
5
  import "../../../core/context.js";
6
+ import "../../../api/http.js";
@@ -5,6 +5,7 @@ import "../../../core/context.js";
5
5
  import "../../../utils/card-brand/brands.js";
6
6
  import "../../../utils/system-info/get-browser-info.js";
7
7
  import { normalizedClass } from "../../../utils/format.js";
8
+ import "../../../api/http.js";
8
9
  import { COMMON_CLASS_NAME } from "../../../constant.js";
9
10
  import { IconChecked } from "../icons/iconChecked.js";
10
11
  const { bem } = useBEM("check-box");
@@ -3,3 +3,4 @@ import "./check-box.js";
3
3
  import "../../../utils/card-brand/brands.js";
4
4
  import "../../../utils/system-info/get-browser-info.js";
5
5
  import "../../../core/context.js";
6
+ import "../../../api/http.js";
@@ -3,6 +3,7 @@ import "../../../core.js";
3
3
  import "../../../core/context.js";
4
4
  import "../../../utils/card-brand/brands.js";
5
5
  import "../../../utils/system-info/get-browser-info.js";
6
+ import "../../../api/http.js";
6
7
  const formItemBEM = useBEM("form-item");
7
8
  const formItemLabelClassName = formItemBEM.bem("label");
8
9
  const formItemErrorMessageClassName = formItemBEM.bem("error-text");
@@ -6,6 +6,7 @@ import "../../../core/context.js";
6
6
  import "../../../utils/card-brand/brands.js";
7
7
  import "../../../utils/system-info/get-browser-info.js";
8
8
  import { normalizedClass } from "../../../utils/format.js";
9
+ import "../../../api/http.js";
9
10
  import { IconError } from "../icons/IconError.js";
10
11
  const { bem } = useBEM("info");
11
12
  const iconMap = {
@@ -3,3 +3,4 @@ import "./info2.js";
3
3
  import "../../../utils/card-brand/brands.js";
4
4
  import "../../../utils/system-info/get-browser-info.js";
5
5
  import "../../../core/context.js";
6
+ import "../../../api/http.js";
@@ -3,6 +3,7 @@ import "../../../core.js";
3
3
  import "../../../core/context.js";
4
4
  import "../../../utils/card-brand/brands.js";
5
5
  import "../../../utils/system-info/get-browser-info.js";
6
+ import "../../../api/http.js";
6
7
  const inputBEM = useBEM("input");
7
8
  const inputWrapperClassName = inputBEM.bem("input-wrapper");
8
9
  export {
@@ -7,6 +7,7 @@ import { isUndefined } from "../../../utils/is.js";
7
7
  import "../../../utils/card-brand/brands.js";
8
8
  import "../../../utils/system-info/get-browser-info.js";
9
9
  import { normalizedClass, normalizedStyle } from "../../../utils/format.js";
10
+ import "../../../api/http.js";
10
11
  const SIZE = 40;
11
12
  const SVG_VIEW_BOX = `0 0 ${SIZE} ${SIZE}`;
12
13
  const CIRCLE_STROKE_WIDTH = 3.3;
@@ -3,3 +3,4 @@ import "./loading-check.js";
3
3
  import "../../../utils/card-brand/brands.js";
4
4
  import "../../../utils/system-info/get-browser-info.js";
5
5
  import "../../../core/context.js";
6
+ import "../../../api/http.js";
@@ -1,6 +1,7 @@
1
1
  import { w, h, T, u, b, P } from "../../../core.js";
2
2
  import { useBEM } from "../../../hooks/useBEM.js";
3
3
  import { useI18n } from "../../../hooks/useI18n.js";
4
+ import "../../../api/http.js";
4
5
  import "../../../utils/card-brand/brands.js";
5
6
  import "../../../utils/system-info/get-browser-info.js";
6
7
  import "./modal2.js";
@@ -4,6 +4,7 @@ import "../../../core/context.js";
4
4
  import "../../../utils/card-brand/brands.js";
5
5
  import "../../../utils/system-info/get-browser-info.js";
6
6
  import { normalizedClass } from "../../../utils/format.js";
7
+ import "../../../api/http.js";
7
8
  import { COMMON_CLASS_NAME } from "../../../constant.js";
8
9
  const { bem } = useBEM("qr-code");
9
10
  const QRCode = ({ value, size, className, style }) => {
@@ -2,3 +2,4 @@ import "../../../core.js";
2
2
  import "../../../utils/card-brand/brands.js";
3
3
  import "../../../utils/system-info/get-browser-info.js";
4
4
  import "../../../core/context.js";
5
+ import "../../../api/http.js";
@@ -4,6 +4,7 @@ import "../../../core/context.js";
4
4
  import { isNil } from "../../../utils/is.js";
5
5
  import "../../../utils/card-brand/brands.js";
6
6
  import "../../../utils/system-info/get-browser-info.js";
7
+ import "../../../api/http.js";
7
8
  import "../Form/type.js";
8
9
  import { FormItemContext } from "../Form/context.js";
9
10
  import "../Form/FormItem.js";
@@ -37,22 +38,23 @@ const Select = w((props, ref) => {
37
38
  if (props.renderLabel) {
38
39
  return;
39
40
  }
40
- if (isNil(inputValue) || inputValue === "") {
41
+ const isEmpty = isNil(inputValue) || inputValue === "";
42
+ setDoFilter(!isEmpty);
43
+ if (isEmpty) {
41
44
  setSelectOptions(props.options);
42
- setDoFilter(false);
43
- return;
45
+ } else {
46
+ const matchedOptions = props.options.filter((item) => {
47
+ return item.label.toLowerCase().includes(inputValue.toLowerCase());
48
+ });
49
+ setSelectOptions(matchedOptions);
44
50
  }
45
- setDoFilter(true);
46
- const filter = props.options.filter((item) => {
47
- return item.label.toLowerCase().includes(inputValue.toLowerCase());
48
- });
49
- setSelectOptions(filter);
50
51
  }, [inputValue]);
51
52
  F(ref, () => ({
52
53
  blur: () => {
53
- setIsFocus(false);
54
+ var _a, _b;
54
55
  setDropMenuVisible(false);
55
56
  setIsInputChange(false);
57
+ (_b = (_a = inputRef.current) == null ? void 0 : _a.input) == null ? void 0 : _b.blur();
56
58
  }
57
59
  }));
58
60
  function findItemByValue(value2, options) {
@@ -4,6 +4,7 @@ import { useBEM } from "../../../hooks/useBEM.js";
4
4
  import "../../../core/context.js";
5
5
  import "../../../utils/card-brand/brands.js";
6
6
  import "../../../utils/system-info/get-browser-info.js";
7
+ import "../../../api/http.js";
7
8
  const { bem } = useBEM("select");
8
9
  function SelectMenu(props) {
9
10
  const { style, children } = props;
@@ -5,6 +5,7 @@ import "../../../core/context.js";
5
5
  import { isFunction } from "../../../utils/is.js";
6
6
  import "../../../utils/card-brand/brands.js";
7
7
  import "../../../utils/system-info/get-browser-info.js";
8
+ import "../../../api/http.js";
8
9
  import { IconTick } from "../icons/IconTick.js";
9
10
  const { bem } = useBEM("select");
10
11
  function SelectMenuItem(props) {
@@ -62,7 +62,9 @@ const GCash = w((props, ref) => {
62
62
  if (!(fieldStatus == null ? void 0 : fieldStatus.email.show))
63
63
  return;
64
64
  setForm(Object.assign(form, { email: emailState.email }));
65
+ form.email = emailState.email;
65
66
  (_a2 = emailFieldRef.current) == null ? void 0 : _a2.update(emailState.email);
67
+ validateForm();
66
68
  },
67
69
  payment: () => {
68
70
  hidePaymentButton && onSubmit();
@@ -73,7 +75,7 @@ const GCash = w((props, ref) => {
73
75
  const addressFieldRef = A(null);
74
76
  const emailFieldRef = A(null);
75
77
  const [isCheckoutEnabled, setIsCheckoutEnabled] = h(false);
76
- const { setErrorMsg, i18n, errorMsg, sessionReady } = usePayState(session);
78
+ const { setErrorMsg, i18n, errorMsg, sessionReady } = usePayState(session, props.core);
77
79
  const [submitButtonStatus, setSubmitButtonStatus] = h("unSubmit");
78
80
  const formRef = A(null);
79
81
  const [form, setForm] = h({
@@ -123,12 +125,14 @@ const GCash = w((props, ref) => {
123
125
  }, [sessionReady]);
124
126
  const processOnError = (error) => {
125
127
  var _a2;
128
+ setShowQRCodeModal(false);
126
129
  (_a2 = props.onError) == null ? void 0 : _a2.call(props, error);
127
130
  core.resetEnablePaymentMethod();
128
131
  };
129
132
  const onTimeout = q(
130
133
  (message) => {
131
134
  var _a2;
135
+ setShowQRCodeModal(false);
132
136
  setErrorMsg(message || i18n.get("common.payTimeout"));
133
137
  setSubmitButtonStatus("unSubmit");
134
138
  (_a2 = props.onTimeout) == null ? void 0 : _a2.call(props);
@@ -138,7 +142,10 @@ const GCash = w((props, ref) => {
138
142
  );
139
143
  const { start: startReFetchPayInfo, stop: stopReFetchPayInfo } = useRetry(
140
144
  (timeout) => pay(true, timeout),
141
- { onTimeout: () => onTimeout(i18n.get("common.queryTimeout")) }
145
+ {
146
+ timeout: 10 * 60 * 1e3,
147
+ onTimeout: () => onTimeout(i18n.get("common.queryTimeout"))
148
+ }
142
149
  );
143
150
  const getPaymentParams = async () => {
144
151
  return {
@@ -172,6 +179,7 @@ const GCash = w((props, ref) => {
172
179
  setSubmitButtonStatus("unSubmit");
173
180
  return { end: true };
174
181
  } else if (orderStatus === "SUCCESS") {
182
+ setShowQRCodeModal(false);
175
183
  setSubmitButtonStatus("success");
176
184
  (_b2 = props.onSuccess) == null ? void 0 : _b2.call(props);
177
185
  return { end: true };
@@ -195,9 +203,9 @@ const GCash = w((props, ref) => {
195
203
  expiredTime: paymentExpiredAt
196
204
  });
197
205
  }
206
+ startReFetchPayInfo();
198
207
  }
199
208
  }
200
- startReFetchPayInfo();
201
209
  return { end: false };
202
210
  } else if (orderStatus === "CANCELED") {
203
211
  setSubmitButtonStatus("unSubmit");
@@ -206,10 +214,12 @@ const GCash = w((props, ref) => {
206
214
  return { end: true };
207
215
  }
208
216
  } else if (status === "SUCCESS") {
217
+ setShowQRCodeModal(false);
209
218
  setSubmitButtonStatus("success");
210
219
  (_d2 = props.onSuccess) == null ? void 0 : _d2.call(props);
211
220
  return { end: true };
212
221
  } else if (status === "EXPIRED") {
222
+ setShowQRCodeModal(false);
213
223
  setSubmitButtonStatus("unSubmit");
214
224
  (_e2 = props.onExpired) == null ? void 0 : _e2.call(props);
215
225
  return { end: true };
@@ -261,10 +271,12 @@ const GCash = w((props, ref) => {
261
271
  });
262
272
  };
263
273
  const handleCloseQRCodeModal = () => {
274
+ var _a2;
264
275
  setSubmitButtonStatus("unSubmit");
265
276
  stopReFetchPayInfo();
266
277
  setShowQRCodeModal(false);
267
278
  setQrCodeInfo(void 0);
279
+ (_a2 = props.onCloseModal) == null ? void 0 : _a2.call(props);
268
280
  };
269
281
  const setFormRef = (dom) => {
270
282
  formRef.current = dom;
@@ -58,7 +58,9 @@ const Paymaya = w((props, ref) => {
58
58
  if (!(fieldStatus == null ? void 0 : fieldStatus.email.show))
59
59
  return;
60
60
  setForm(Object.assign(form, { email: emailState.email }));
61
+ form.email = emailState.email;
61
62
  (_a2 = emailFieldRef.current) == null ? void 0 : _a2.update(emailState.email);
63
+ validateForm();
62
64
  },
63
65
  payment: () => {
64
66
  hidePaymentButton && onSubmit();
@@ -69,7 +71,7 @@ const Paymaya = w((props, ref) => {
69
71
  const addressFieldRef = A(null);
70
72
  const emailFieldRef = A(null);
71
73
  const [isCheckoutEnabled, setIsCheckoutEnabled] = h(false);
72
- const { setErrorMsg, i18n, errorMsg, sessionReady } = usePayState(session);
74
+ const { setErrorMsg, i18n, errorMsg, sessionReady } = usePayState(session, props.core);
73
75
  const [submitButtonStatus, setSubmitButtonStatus] = h("unSubmit");
74
76
  const formRef = A(null);
75
77
  const [form, setForm] = h({
@@ -28,6 +28,7 @@ import { Session } from "./Session.js";
28
28
  import { setApiUrl, setCDNUrl, setFraudDetectionEnv, setCheckoutConfig, setCustomLocale } from "../config.js";
29
29
  import { PayKKaError } from "./error.js";
30
30
  import { apiEnv, cdnEnv, fraudDetectionEnv } from "./environment.js";
31
+ import "../api/http.js";
31
32
  import { isEmptyObject } from "../utils/is.js";
32
33
  import "../utils/card-brand/brands.js";
33
34
  import "../utils/system-info/get-browser-info.js";
@@ -59,7 +60,7 @@ class PayKKaCheckout {
59
60
  this.initOtherData();
60
61
  }
61
62
  initSession() {
62
- const { sessionId, clientKey, onPaymentMethodsReady, onInitError } = __privateGet(this, _config);
63
+ const { sessionId, clientKey, onPaymentMethodsReady, onInitError, onSuccess } = __privateGet(this, _config);
63
64
  if (!sessionId) {
64
65
  onInitError == null ? void 0 : onInitError(new PayKKaError("ERROR", "SessionId is required"));
65
66
  return;
@@ -71,7 +72,11 @@ class PayKKaCheckout {
71
72
  onInitError == null ? void 0 : onInitError(new PayKKaError("ERROR", "Checkout is empty"));
72
73
  return;
73
74
  }
74
- const { paymentMethod = [] } = ((_b = __privateGet(this, _session)) == null ? void 0 : _b.checkout) || {};
75
+ const { paymentMethod = [], status } = ((_b = __privateGet(this, _session)) == null ? void 0 : _b.checkout) || {};
76
+ if (status === "SUCCESS") {
77
+ onSuccess == null ? void 0 : onSuccess({});
78
+ return;
79
+ }
75
80
  onPaymentMethodsReady == null ? void 0 : onPaymentMethodsReady(paymentMethod);
76
81
  }).catch((error) => {
77
82
  onInitError == null ? void 0 : onInitError(error);
@@ -2,3 +2,4 @@ import "./context.js";
2
2
  import "../core.js";
3
3
  import "../utils/card-brand/brands.js";
4
4
  import "../utils/system-info/get-browser-info.js";
5
+ import "../api/http.js";
@@ -1,7 +1,6 @@
1
+ import "../api/http.js";
1
2
  import "../utils/card-brand/brands.js";
2
3
  import "../utils/system-info/get-browser-info.js";
3
- import "../core.js";
4
- import "./context.js";
5
4
  import { onceGetCheckoutInfo } from "../api/modules/checkout/index.js";
6
5
  const querySession = async ({ sessionId, clientKey }, options) => {
7
6
  return onceGetCheckoutInfo({ sessionId, clientKey }, options);
@@ -2,3 +2,4 @@ import "../utils/card-brand/brands.js";
2
2
  import "../utils/system-info/get-browser-info.js";
3
3
  import "../core.js";
4
4
  import "../core/context.js";
5
+ import "../api/http.js";
@@ -2,6 +2,7 @@ import { x, h } from "../core.js";
2
2
  import { CoreContext } from "../core/context.js";
3
3
  import "../utils/card-brand/brands.js";
4
4
  import "../utils/system-info/get-browser-info.js";
5
+ import "../api/http.js";
5
6
  import { I18n } from "../i18n/I18n.js";
6
7
  function useI18n(locale) {
7
8
  const coreContext = x(CoreContext);
@@ -5,7 +5,7 @@ import { customLocale, fraudDetectionEnv } from "../config.js";
5
5
  import "../utils/card-brand/brands.js";
6
6
  import { getBrowserInfo } from "../utils/system-info/get-browser-info.js";
7
7
  import { getRealLocale } from "../i18n/util.js";
8
- function usePayState(session) {
8
+ function usePayState(session, core) {
9
9
  const [validated, setValidated] = h(false);
10
10
  const [errorMsg, setErrorMsg] = h("");
11
11
  const [sessionReady, setSessionReady] = h(false);
@@ -19,7 +19,12 @@ function usePayState(session) {
19
19
  customLocale || ((_a = session.checkout) == null ? void 0 : _a.locale) || getBrowserInfo().language
20
20
  );
21
21
  i18n.load(locale);
22
- const fraudDetection2 = getFraudDetectionInstance(fraudDetectionEnv);
22
+ const fraudDetection2 = getFraudDetectionInstance(fraudDetectionEnv, void 0, {
23
+ onEvent: (type) => {
24
+ var _a2, _b;
25
+ (_b = core == null ? void 0 : (_a2 = core.config).onEvent) == null ? void 0 : _b.call(_a2, type);
26
+ }
27
+ });
23
28
  setFraudDetection(fraudDetection2);
24
29
  fraudDetection2 == null ? void 0 : fraudDetection2.createFraudDetection();
25
30
  });
@@ -1,5 +1,5 @@
1
1
  const getLocales = () => {
2
- return Object.entries(/* @__PURE__ */ Object.assign({ "./de-DE.ts": () => import("./de-DE.js"), "./en-GB.ts": () => import("./en-GB.js"), "./es-ES.ts": () => import("./es-ES.js"), "./fr-FR.ts": () => import("./fr-FR.js"), "./ja-JP.ts": () => import("./ja-JP.js"), "./ko-KR.ts": () => import("./ko-KR.js"), "./pt-PT.ts": () => import("./pt-PT.js"), "./ru-RU.ts": () => import("./ru-RU.js"), "./zh-CN.ts": () => import("./zh-CN.js"), "./zh-HK.ts": () => import("./zh-HK.js"), "./zh-TW.ts": () => import("./zh-TW.js") })).reduce((prev, [path, loader]) => {
2
+ return Object.entries(/* @__PURE__ */ Object.assign({ "./de-DE.ts": () => import("./de-DE.js"), "./en-GB.ts": () => import("./en-GB.js"), "./es-ES.ts": () => import("./es-ES.js"), "./fr-FR.ts": () => import("./fr-FR.js"), "./ja-JP.ts": () => import("./ja-JP.js"), "./ko-KR.ts": () => import("./ko-KR.js"), "./nl-NL.ts": () => import("./nl-NL.js"), "./pt-PT.ts": () => import("./pt-PT.js"), "./ru-RU.ts": () => import("./ru-RU.js"), "./zh-CN.ts": () => import("./zh-CN.js"), "./zh-HK.ts": () => import("./zh-HK.js"), "./zh-TW.ts": () => import("./zh-TW.js") })).reduce((prev, [path, loader]) => {
3
3
  const key = path.match(/\.\/(.+)\./)[1];
4
4
  prev[key] = loader;
5
5
  return prev;
@@ -12,6 +12,7 @@ var LocaleKey = /* @__PURE__ */ ((LocaleKey2) => {
12
12
  LocaleKey2["frFR"] = "fr-FR";
13
13
  LocaleKey2["jaJP"] = "ja-JP";
14
14
  LocaleKey2["koKR"] = "ko-KR";
15
+ LocaleKey2["nlNL"] = "nl-NL";
15
16
  LocaleKey2["ptPT"] = "pt-PT";
16
17
  LocaleKey2["ruRU"] = "ru-RU";
17
18
  LocaleKey2["zhCN"] = "zh-CN";