@paykka/card-checkout-ui 0.5.17 → 0.6.0

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 (98) hide show
  1. package/dist/card-checkout-ui.js +22 -0
  2. package/dist/card-checkout-ui.umd.cjs +19 -5
  3. package/dist/es/api/modules/checkout/map.js +2 -1
  4. package/dist/es/api/modules/encrypted-card/index.js +54 -0
  5. package/dist/es/api/modules/get-browser-params.js +2 -2
  6. package/dist/es/components/AccountNameField/index.js +2 -0
  7. package/dist/es/components/AddressField/index.js +2 -0
  8. package/dist/es/components/AliPay/index.js +8 -8
  9. package/dist/es/components/ApplePay/index.js +71 -14
  10. package/dist/es/components/Card/index.js +56 -40
  11. package/dist/es/components/CardExpireDateField/index.js +6 -3
  12. package/dist/es/components/CardHolderNameField/index.js +2 -0
  13. package/dist/es/components/CardIBANField/index.js +2 -0
  14. package/dist/es/components/CardNumberField/index.js +32 -17
  15. package/dist/es/components/CardSecurityCodeField/index.js +6 -3
  16. package/dist/es/components/CardSelector/index.js +1 -0
  17. package/dist/es/components/CombinedEncryptedField/index.js +75 -0
  18. package/dist/es/components/EmailField/EmailField.js +2 -0
  19. package/dist/es/components/EncryptedCard/index.js +448 -0
  20. package/dist/es/components/GooglePay/index.js +57 -19
  21. package/dist/es/components/SecuredFieldsProvider/SecuredFieldsProvider.js +70 -24
  22. package/dist/es/components/SecuredIframe/index.js +190 -22
  23. package/dist/es/components/Sepa/index.js +16 -6
  24. package/dist/es/components/WechatPay/index.js +8 -8
  25. package/dist/es/components/index.js +4 -0
  26. package/dist/es/components/internal/Form/FormItem.js +28 -24
  27. package/dist/es/components/internal/Form/index.js +1 -0
  28. package/dist/es/components/internal/Form/type.js +15 -1
  29. package/dist/es/components/internal/Input/Input.js +9 -11
  30. package/dist/es/components/internal/Input/index.js +1 -0
  31. package/dist/es/components/internal/Input/type.js +13 -1
  32. package/dist/es/components/internal/Select/Select.js +2 -0
  33. package/dist/es/config.js +12 -6
  34. package/dist/es/constant.js +10 -0
  35. package/dist/es/core/PayKKaCheckout.js +62 -0
  36. package/dist/es/core/query.js +1 -6
  37. package/dist/es/core.js +34 -34
  38. package/dist/es/hooks/useI18n.js +1 -1
  39. package/dist/es/hooks/usePayState.js +11 -18
  40. package/dist/es/index.js +13 -2
  41. package/dist/es/out/fraud-detection.js +99 -0
  42. package/dist/es/style.css +8 -0
  43. package/dist/es/types/{radar.js → fraud-detection.js} +1 -1
  44. package/dist/es/types/index.js +49 -1
  45. package/dist/es/utils/card-brand/brands.js +16 -42
  46. package/dist/es/utils/index.js +11 -0
  47. package/dist/es/utils/load.js +14 -0
  48. package/dist/es/utils/style.js +37 -0
  49. package/dist/style.css +1 -1
  50. package/dist/types/api/modules/checkout/map.d.ts +1 -0
  51. package/dist/types/api/modules/encrypted-card/index.d.ts +6 -0
  52. package/dist/types/api/modules/encrypted-card/type.d.ts +31 -0
  53. package/dist/types/api/modules/get-browser-params.d.ts +2 -2
  54. package/dist/types/components/AliPay/type.d.ts +0 -2
  55. package/dist/types/components/ApplePay/type.d.ts +16 -5
  56. package/dist/types/components/ApplePay/utils.d.ts +3 -0
  57. package/dist/types/components/Card/type.d.ts +15 -3
  58. package/dist/types/components/CardExpireDateField/type.d.ts +1 -0
  59. package/dist/types/components/CardNumberField/type.d.ts +3 -0
  60. package/dist/types/components/CardSecurityCodeField/type.d.ts +1 -0
  61. package/dist/types/components/CombinedEncryptedField/CombinedEncryptedField.d.ts +4 -0
  62. package/dist/types/components/CombinedEncryptedField/index.d.ts +2 -0
  63. package/dist/types/components/CombinedEncryptedField/type.d.ts +15 -0
  64. package/dist/types/components/EncryptedCard/EncryptedCard.d.ts +4 -0
  65. package/dist/types/components/EncryptedCard/index.d.ts +4 -0
  66. package/dist/types/components/EncryptedCard/output.d.ts +9 -0
  67. package/dist/types/components/EncryptedCard/type.d.ts +85 -0
  68. package/dist/types/components/GooglePay/type.d.ts +17 -6
  69. package/dist/types/components/GooglePay/utils.d.ts +2 -0
  70. package/dist/types/components/SecuredFieldsProvider/type.d.ts +103 -22
  71. package/dist/types/components/SecuredIframe/useSecuredInput.d.ts +6 -2
  72. package/dist/types/components/Sepa/type.d.ts +0 -2
  73. package/dist/types/components/WechatPay/type.d.ts +0 -2
  74. package/dist/types/components/index.d.ts +2 -0
  75. package/dist/types/components/internal/Form/FormItem.d.ts +1 -1
  76. package/dist/types/components/internal/Form/type.d.ts +7 -0
  77. package/dist/types/components/internal/Input/Input.d.ts +1 -1
  78. package/dist/types/components/internal/Input/type.d.ts +6 -0
  79. package/dist/types/config.d.ts +7 -3
  80. package/dist/types/constant.d.ts +1 -0
  81. package/dist/types/core/PayKKaCheckout.d.ts +12 -0
  82. package/dist/types/core/index.d.ts +1 -0
  83. package/dist/types/core/query.d.ts +2 -2
  84. package/dist/types/hooks/usePayState.d.ts +4 -20
  85. package/dist/types/index.d.ts +2 -2
  86. package/dist/types/out/fraud-detection.d.ts +9 -0
  87. package/dist/types/types/{radar.d.ts → fraud-detection.d.ts} +3 -2
  88. package/dist/types/types/index.d.ts +69 -1
  89. package/dist/types/utils/card-brand/brands.d.ts +3 -10
  90. package/dist/types/utils/card-brand/index.d.ts +10 -9
  91. package/dist/types/utils/format.d.ts +0 -1
  92. package/dist/types/utils/index.d.ts +3 -0
  93. package/dist/types/utils/load.d.ts +7 -0
  94. package/dist/types/utils/style.d.ts +17 -0
  95. package/package.json +2 -2
  96. package/dist/card-checkout-ui.iife.js +0 -8
  97. package/dist/es/out/radar.js +0 -123
  98. package/dist/types/out/radar.d.ts +0 -14
@@ -9,10 +9,12 @@ import "../core/context.js";
9
9
  import "../i18n/util.js";
10
10
  import "../i18n/locales/index.js";
11
11
  import "./CardExpireDateField/index.js";
12
+ import "./internal/Form/type.js";
12
13
  import "./internal/Form/context.js";
13
14
  import "./internal/Form/FormItem.js";
14
15
  import "./internal/Form/Form.js";
15
16
  import "./internal/Input/Input.js";
17
+ import "./internal/Input/type.js";
16
18
  import "./CardNumberField/index.js";
17
19
  import "./CardSecurityCodeField/index.js";
18
20
  import "./CardSelector/index.js";
@@ -25,3 +27,5 @@ import "./WechatPay/index.js";
25
27
  import "./ApplePay/index.js";
26
28
  import "./GooglePay/index.js";
27
29
  import "./Sepa/index.js";
30
+ import "./EncryptedCard/index.js";
31
+ import "./CombinedEncryptedField/index.js";
@@ -1,18 +1,14 @@
1
1
  import { w, F, x, h, y, u } from "../../../core.js";
2
2
  import "./form-item.js";
3
3
  import { COMMON_CLASS_NAME } from "../../../constant.js";
4
- import { useBEM } from "../../../hooks/useBEM.js";
5
- import "../../../core/context.js";
6
4
  import { isNil } from "../../../utils/is.js";
7
5
  import "../../../utils/card-brand/brands.js";
8
6
  import "../../../utils/system-info/get-browser-info.js";
9
7
  import { normalizedClass } from "../../../utils/format.js";
10
8
  import { set } from "../../../utils/obj.js";
11
- import "../../../i18n/util.js";
12
- import "../../../i18n/locales/index.js";
13
9
  import { FormItemContext, FormContext } from "./context.js";
10
+ import { formItemBEM, formItemLabelClassName, formItemErrorMessageClassName } from "./type.js";
14
11
  import { getActiveRules } from "./util.js";
15
- const { bem } = useBEM("form-item");
16
12
  const isEmpty = (value) => isNil(value) || value === "";
17
13
  const FormItem = w((props, ref) => {
18
14
  const {
@@ -23,7 +19,8 @@ const FormItem = w((props, ref) => {
23
19
  onValidationStatusChange,
24
20
  className,
25
21
  style,
26
- showErrorMessage = true
22
+ showErrorMessage = true,
23
+ showLabel = true
27
24
  } = props;
28
25
  F(ref, () => ({
29
26
  validate: internalValidate,
@@ -136,24 +133,31 @@ const FormItem = w((props, ref) => {
136
133
  path && (formContext == null ? void 0 : formContext.setFormItems((prev) => prev.filter((item) => item !== internalRef)));
137
134
  };
138
135
  }, []);
139
- return /* @__PURE__ */ u("div", { className: normalizedClass(COMMON_CLASS_NAME, bem(), className), style, children: [
140
- !isNil(label) && /* @__PURE__ */ u("div", { className: bem("label"), children: label }),
141
- /* @__PURE__ */ u(
142
- FormItemContext.Provider,
143
- {
144
- value: {
145
- rule: props.rule,
146
- validateBlur,
147
- validateChange,
148
- resetValidation,
149
- validationResult,
150
- setValue
151
- },
152
- children
153
- }
154
- ),
155
- showErrorMessage && validationResult.status === "error" && /* @__PURE__ */ u("div", { className: bem("error-text"), children: getFirstError().message })
156
- ] });
136
+ return /* @__PURE__ */ u(
137
+ "div",
138
+ {
139
+ className: normalizedClass(COMMON_CLASS_NAME, formItemBEM.bem(), className),
140
+ style,
141
+ children: [
142
+ showLabel && !isNil(label) && /* @__PURE__ */ u("div", { className: formItemLabelClassName, children: label }),
143
+ /* @__PURE__ */ u(
144
+ FormItemContext.Provider,
145
+ {
146
+ value: {
147
+ rule: props.rule,
148
+ validateBlur,
149
+ validateChange,
150
+ resetValidation,
151
+ validationResult,
152
+ setValue
153
+ },
154
+ children
155
+ }
156
+ ),
157
+ showErrorMessage && validationResult.status === "error" && /* @__PURE__ */ u("div", { className: formItemErrorMessageClassName, children: getFirstError().message })
158
+ ]
159
+ }
160
+ );
157
161
  });
158
162
  export {
159
163
  FormItem
@@ -1,3 +1,4 @@
1
+ import "./type.js";
1
2
  import "./context.js";
2
3
  import "./FormItem.js";
3
4
  import "./Form.js";
@@ -1 +1,15 @@
1
-
1
+ import { useBEM } from "../../../hooks/useBEM.js";
2
+ import "../../../core.js";
3
+ import "../../../core/context.js";
4
+ import "../../../utils/card-brand/brands.js";
5
+ import "../../../utils/system-info/get-browser-info.js";
6
+ import "../../../i18n/util.js";
7
+ import "../../../i18n/locales/index.js";
8
+ const formItemBEM = useBEM("form-item");
9
+ const formItemLabelClassName = formItemBEM.bem("label");
10
+ const formItemErrorMessageClassName = formItemBEM.bem("error-text");
11
+ export {
12
+ formItemBEM,
13
+ formItemErrorMessageClassName,
14
+ formItemLabelClassName
15
+ };
@@ -1,19 +1,16 @@
1
1
  import { w, F, x, h, A, w$1, u } from "../../../core.js";
2
2
  import "./input2.js";
3
3
  import { COMMON_CLASS_NAME } from "../../../constant.js";
4
- import { useBEM } from "../../../hooks/useBEM.js";
5
- import "../../../core/context.js";
6
4
  import "../../../utils/card-brand/brands.js";
7
5
  import "../../../utils/system-info/get-browser-info.js";
8
6
  import { normalizedClass } from "../../../utils/format.js";
9
- import "../../../i18n/util.js";
10
- import "../../../i18n/locales/index.js";
7
+ import "../Form/type.js";
11
8
  import { FormItemContext } from "../Form/context.js";
12
9
  import "../Form/FormItem.js";
13
10
  import "../Form/Form.js";
14
11
  import { IconError } from "../icons/IconError.js";
15
12
  import { IconSuccess } from "../icons/IconSuccess.js";
16
- const { bem } = useBEM("input");
13
+ import { inputBEM } from "./type.js";
17
14
  const statusIconMap = {
18
15
  error: IconError,
19
16
  success: IconSuccess
@@ -74,13 +71,13 @@ const Input = w((props, ref) => {
74
71
  formItemContext == null ? void 0 : formItemContext.validateChange(value);
75
72
  }
76
73
  const inputWrapperClass = w$1(() => {
77
- const inputWrapper = bem("input-wrapper", [
74
+ const inputWrapper = inputBEM.bem("input-wrapper", [
78
75
  status,
79
76
  {
80
77
  focus: isFocus
81
78
  }
82
79
  ]);
83
- const inputWrapperDisabled = bem("input-wrapper-disabled");
80
+ const inputWrapperDisabled = inputBEM.bem("input-wrapper-disabled");
84
81
  return disabled ? `${inputWrapper} ${inputWrapperDisabled}` : `${inputWrapper}`;
85
82
  });
86
83
  function onCompositionStart(e) {
@@ -92,16 +89,17 @@ const Input = w((props, ref) => {
92
89
  isComposing = false;
93
90
  onInput(e);
94
91
  }
95
- return /* @__PURE__ */ u("div", { className: normalizedClass(COMMON_CLASS_NAME, bem(), inputClassName), style, onClick: () => {
92
+ return /* @__PURE__ */ u("div", { className: normalizedClass(COMMON_CLASS_NAME, inputBEM.bem(), inputClassName), onClick: () => {
96
93
  var _a;
97
94
  return (_a = inputRef.current) == null ? void 0 : _a.focus();
98
- }, children: /* @__PURE__ */ u("div", { className: inputWrapperClass, children: [
95
+ }, children: /* @__PURE__ */ u("div", { className: `${inputWrapperClass}`, style, children: [
96
+ !!props.leftIcon && /* @__PURE__ */ u("div", { class: inputBEM.bem("left-icon"), children: props.leftIcon }),
99
97
  children ? children : /* @__PURE__ */ u(
100
98
  "input",
101
99
  {
102
100
  ref: inputRef,
103
101
  ...props,
104
- class: bem("input"),
102
+ class: inputBEM.bem("input"),
105
103
  onFocus,
106
104
  onBlur,
107
105
  onInput,
@@ -110,7 +108,7 @@ const Input = w((props, ref) => {
110
108
  autocomplete: "off"
111
109
  }
112
110
  ),
113
- !!rightIcon && /* @__PURE__ */ u("div", { class: bem("right-icon"), children: rightIcon })
111
+ !!rightIcon && /* @__PURE__ */ u("div", { class: inputBEM.bem("right-icon"), children: rightIcon })
114
112
  ] }) });
115
113
  });
116
114
  export {
@@ -1 +1,2 @@
1
1
  import "./Input.js";
2
+ import "./type.js";
@@ -1 +1,13 @@
1
-
1
+ import { useBEM } from "../../../hooks/useBEM.js";
2
+ import "../../../core.js";
3
+ import "../../../core/context.js";
4
+ import "../../../utils/card-brand/brands.js";
5
+ import "../../../utils/system-info/get-browser-info.js";
6
+ import "../../../i18n/util.js";
7
+ import "../../../i18n/locales/index.js";
8
+ const inputBEM = useBEM("input");
9
+ const inputWrapperClassName = inputBEM.bem("input-wrapper");
10
+ export {
11
+ inputBEM,
12
+ inputWrapperClassName
13
+ };
@@ -6,11 +6,13 @@ import "../../../utils/card-brand/brands.js";
6
6
  import "../../../utils/system-info/get-browser-info.js";
7
7
  import "../../../i18n/util.js";
8
8
  import "../../../i18n/locales/index.js";
9
+ import "../Form/type.js";
9
10
  import { FormItemContext } from "../Form/context.js";
10
11
  import "../Form/FormItem.js";
11
12
  import "../Form/Form.js";
12
13
  import { IconArrowDown } from "../icons/IconArrowDown.js";
13
14
  import { Input } from "../Input/Input.js";
15
+ import "../Input/type.js";
14
16
  import { SelectMenu } from "./SelectMenu.js";
15
17
  import { SelectMenuItem } from "./SelectMenuItem.js";
16
18
  const { bem } = useBEM("select");
package/dist/es/config.js CHANGED
@@ -7,9 +7,10 @@ let apiUrl = "https://checkout.aq.paykka.com";
7
7
  let cdnOrigin = "https://checkout.aq.paykka.com";
8
8
  let cdnDir = "/cp";
9
9
  let cdnUrl = `${cdnOrigin}${cdnDir}`;
10
- let radarEnv = void 0;
10
+ let fraudDetectionEnv = void 0;
11
11
  let customReqHeaders = {};
12
12
  let customLocale = void 0;
13
+ let hidePaymentButton = false;
13
14
  function setApiUrl(url) {
14
15
  apiUrl = url;
15
16
  }
@@ -17,10 +18,10 @@ function setCDNUrl(url) {
17
18
  const urlInfo = new URL(url);
18
19
  cdnOrigin = urlInfo.origin;
19
20
  cdnDir = urlInfo.pathname;
20
- cdnUrl = `${cdnOrigin}${cdnDir}`;
21
+ cdnUrl = `${cdnOrigin}${cdnDir === "/" ? "" : cdnDir}`;
21
22
  }
22
- function setRadarEnv(env) {
23
- radarEnv = env;
23
+ function setFraudDetectionEnv(env) {
24
+ fraudDetectionEnv = env;
24
25
  }
25
26
  function setCustomReqHeaders(headers) {
26
27
  customReqHeaders = headers;
@@ -28,16 +29,21 @@ function setCustomReqHeaders(headers) {
28
29
  function setCustomLocale(locale) {
29
30
  customLocale = locale;
30
31
  }
32
+ function setCheckoutConfig(params) {
33
+ hidePaymentButton = params.hidePaymentButton || false;
34
+ }
31
35
  export {
32
36
  apiUrl,
33
37
  cdnOrigin,
34
38
  cdnUrl,
35
39
  customLocale,
36
40
  customReqHeaders,
37
- radarEnv,
41
+ fraudDetectionEnv,
42
+ hidePaymentButton,
38
43
  setApiUrl,
39
44
  setCDNUrl,
45
+ setCheckoutConfig,
40
46
  setCustomLocale,
41
47
  setCustomReqHeaders,
42
- setRadarEnv
48
+ setFraudDetectionEnv
43
49
  };
@@ -17,6 +17,15 @@ var PaymentMethod = /* @__PURE__ */ ((PaymentMethod2) => {
17
17
  PaymentMethod2["SEPA_DEBIT"] = "SEPA_DEBIT";
18
18
  return PaymentMethod2;
19
19
  })(PaymentMethod || {});
20
+ const CardPaymentMethods = [
21
+ "VISA",
22
+ "MASTER_CARD",
23
+ "JCB",
24
+ "AMEX",
25
+ "DINERS_CLUB",
26
+ "DISCOVER"
27
+ /* DISCOVER */
28
+ ];
20
29
  var PaymentType = /* @__PURE__ */ ((PaymentType2) => {
21
30
  PaymentType2["PURCHASE"] = "PURCHASE";
22
31
  PaymentType2["PREPARE_AUTHORIZE"] = "PREPARE_AUTHORIZE";
@@ -40,6 +49,7 @@ var SessionMode = /* @__PURE__ */ ((SessionMode2) => {
40
49
  })(SessionMode || {});
41
50
  export {
42
51
  COMMON_CLASS_NAME,
52
+ CardPaymentMethods,
43
53
  EAddressType,
44
54
  PREFIX,
45
55
  PaymentMethod,
@@ -0,0 +1,62 @@
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
+ };
7
+ import { create } from "./create.js";
8
+ import { Session } from "./Session.js";
9
+ import { setCheckoutConfig, setCDNUrl, setFraudDetectionEnv, setCustomLocale, setApiUrl } from "../config.js";
10
+ const _PayKKaCheckout = class _PayKKaCheckout {
11
+ constructor(config) {
12
+ __publicField(this, "config");
13
+ if (_PayKKaCheckout.instance) {
14
+ return _PayKKaCheckout.instance;
15
+ }
16
+ this.config = config;
17
+ this.init();
18
+ _PayKKaCheckout.instance = this;
19
+ }
20
+ init() {
21
+ const {
22
+ sandbox,
23
+ sessionId,
24
+ clientKey,
25
+ locale,
26
+ fraudDetectionEnv,
27
+ hidePaymentButton,
28
+ onPaymentMethodsReady,
29
+ onInitError
30
+ } = this.config;
31
+ fraudDetectionEnv && setFraudDetectionEnv(fraudDetectionEnv);
32
+ locale && setCustomLocale(locale);
33
+ setCheckoutConfig({
34
+ hidePaymentButton
35
+ });
36
+ if (sandbox) {
37
+ setApiUrl("https://checkout-sandbox.aq.paykka.com");
38
+ setCDNUrl("https://checkout-sandbox.aq.paykka.com/cp");
39
+ }
40
+ _PayKKaCheckout.session = new Session(sessionId, clientKey);
41
+ _PayKKaCheckout.session.ready().then(() => {
42
+ var _a;
43
+ const { paymentMethod = [] } = ((_a = _PayKKaCheckout.session) == null ? void 0 : _a.checkout) || {};
44
+ onPaymentMethodsReady == null ? void 0 : onPaymentMethodsReady(paymentMethod);
45
+ }).catch((error) => {
46
+ onInitError == null ? void 0 : onInitError(error);
47
+ console.log(error);
48
+ });
49
+ }
50
+ static getSession() {
51
+ return _PayKKaCheckout.session;
52
+ }
53
+ create(component, props) {
54
+ return create(component, props);
55
+ }
56
+ };
57
+ __publicField(_PayKKaCheckout, "session");
58
+ __publicField(_PayKKaCheckout, "instance", null);
59
+ let PayKKaCheckout = _PayKKaCheckout;
60
+ export {
61
+ PayKKaCheckout
62
+ };
@@ -5,12 +5,7 @@ import "../core.js";
5
5
  import "../i18n/locales/index.js";
6
6
  import { onceGetCheckoutInfo } from "../api/modules/checkout/index.js";
7
7
  async function querySession({ sessionId, clientKey }, options) {
8
- try {
9
- return await onceGetCheckoutInfo({ sessionId, clientKey }, options);
10
- } catch (error) {
11
- console.log("[PayKKa Checkout UI]:", error);
12
- return {};
13
- }
8
+ return onceGetCheckoutInfo({ sessionId, clientKey }, options);
14
9
  }
15
10
  export {
16
11
  querySession
package/dist/es/core.js CHANGED
@@ -675,6 +675,36 @@ l$3.diffed = function(n2) {
675
675
  var t2 = n2.props, e2 = n2.__e;
676
676
  null != e2 && "textarea" === n2.type && "value" in t2 && t2.value !== e2.value && (e2.value = null == t2.value ? "" : t2.value);
677
677
  };
678
+ function e$1(e2, n2) {
679
+ return n2 = n2 || {}, new Promise(function(t2, r2) {
680
+ var s2 = new XMLHttpRequest(), o2 = [], u2 = {}, a2 = function e3() {
681
+ return { ok: 2 == (s2.status / 100 | 0), statusText: s2.statusText, status: s2.status, url: s2.responseURL, text: function() {
682
+ return Promise.resolve(s2.responseText);
683
+ }, json: function() {
684
+ return Promise.resolve(s2.responseText).then(JSON.parse);
685
+ }, blob: function() {
686
+ return Promise.resolve(new Blob([s2.response]));
687
+ }, clone: e3, headers: { keys: function() {
688
+ return o2;
689
+ }, entries: function() {
690
+ return o2.map(function(e4) {
691
+ return [e4, s2.getResponseHeader(e4)];
692
+ });
693
+ }, get: function(e4) {
694
+ return s2.getResponseHeader(e4);
695
+ }, has: function(e4) {
696
+ return null != s2.getResponseHeader(e4);
697
+ } } };
698
+ };
699
+ for (var i2 in s2.open(n2.method || "get", e2, true), s2.onload = function() {
700
+ s2.getAllResponseHeaders().toLowerCase().replace(/^(.+?):/gm, function(e3, n3) {
701
+ u2[n3] || o2.push(u2[n3] = n3);
702
+ }), t2(a2());
703
+ }, s2.onerror = r2, s2.withCredentials = "include" == n2.credentials, n2.headers)
704
+ s2.setRequestHeader(i2, n2.headers[i2]);
705
+ s2.send(n2.body || null);
706
+ });
707
+ }
678
708
  var __assign = function() {
679
709
  __assign = Object.assign || function __assign2(t2) {
680
710
  for (var s2, i2 = 1, n2 = arguments.length; i2 < n2; i2++) {
@@ -3887,7 +3917,7 @@ function t() {
3887
3917
  }
3888
3918
  var o = void 0;
3889
3919
  var h = void 0, s$1 = 0, f = 0, v = 0;
3890
- function e$1(i2) {
3920
+ function e(i2) {
3891
3921
  if (void 0 !== o) {
3892
3922
  var t2 = i2.n;
3893
3923
  if (void 0 === t2 || t2.t !== o) {
@@ -3978,7 +4008,7 @@ u.prototype.peek = function() {
3978
4008
  }
3979
4009
  };
3980
4010
  Object.defineProperty(u.prototype, "value", { get: function() {
3981
- var i2 = e$1(this);
4011
+ var i2 = e(this);
3982
4012
  if (void 0 !== i2)
3983
4013
  i2.i = this.i;
3984
4014
  return this.v;
@@ -4109,7 +4139,7 @@ y.prototype.N = function() {
4109
4139
  Object.defineProperty(y.prototype, "value", { get: function() {
4110
4140
  if (1 & this.f)
4111
4141
  throw new Error("Cycle detected");
4112
- var i2 = e$1(this);
4142
+ var i2 = e(this);
4113
4143
  this.h();
4114
4144
  if (void 0 !== i2)
4115
4145
  i2.i = this.i;
@@ -4392,36 +4422,6 @@ function useSignal(n2) {
4392
4422
  return d$1(n2);
4393
4423
  }, []);
4394
4424
  }
4395
- function e(e2, n2) {
4396
- return n2 = n2 || {}, new Promise(function(t2, r2) {
4397
- var s2 = new XMLHttpRequest(), o2 = [], u2 = {}, a2 = function e3() {
4398
- return { ok: 2 == (s2.status / 100 | 0), statusText: s2.statusText, status: s2.status, url: s2.responseURL, text: function() {
4399
- return Promise.resolve(s2.responseText);
4400
- }, json: function() {
4401
- return Promise.resolve(s2.responseText).then(JSON.parse);
4402
- }, blob: function() {
4403
- return Promise.resolve(new Blob([s2.response]));
4404
- }, clone: e3, headers: { keys: function() {
4405
- return o2;
4406
- }, entries: function() {
4407
- return o2.map(function(e4) {
4408
- return [e4, s2.getResponseHeader(e4)];
4409
- });
4410
- }, get: function(e4) {
4411
- return s2.getResponseHeader(e4);
4412
- }, has: function(e4) {
4413
- return null != s2.getResponseHeader(e4);
4414
- } } };
4415
- };
4416
- for (var i2 in s2.open(n2.method || "get", e2, true), s2.onload = function() {
4417
- s2.getAllResponseHeaders().toLowerCase().replace(/^(.+?):/gm, function(e3, n3) {
4418
- u2[n3] || o2.push(u2[n3] = n3);
4419
- }), t2(a2());
4420
- }, s2.onerror = r2, s2.withCredentials = "include" == n2.credentials, n2.headers)
4421
- s2.setRequestHeader(i2, n2.headers[i2]);
4422
- s2.send(n2.body || null);
4423
- });
4424
- }
4425
4425
  export {
4426
4426
  A$1 as A,
4427
4427
  B$2 as B,
@@ -4431,7 +4431,7 @@ export {
4431
4431
  _$3 as _,
4432
4432
  b$1 as b,
4433
4433
  d$1 as d,
4434
- e,
4434
+ e$1 as e,
4435
4435
  h$1 as h,
4436
4436
  index,
4437
4437
  inputToRGB,
@@ -7,7 +7,7 @@ import "../i18n/locales/index.js";
7
7
  function useI18n(locale) {
8
8
  const coreContext = x(CoreContext);
9
9
  const [_i18n] = h((coreContext == null ? void 0 : coreContext.i18n) ?? new I18n());
10
- locale && _i18n.load(locale);
10
+ _i18n.load(locale);
11
11
  return { i18n: _i18n };
12
12
  }
13
13
  export {
@@ -2,34 +2,27 @@ import { h, y } from "../core.js";
2
2
  import "../core/context.js";
3
3
  import "../utils/card-brand/brands.js";
4
4
  import "../utils/system-info/get-browser-info.js";
5
- import { Session } from "../core/Session.js";
6
- import { customLocale, radarEnv } from "../config.js";
7
- import { getPayKKaRadarInstance } from "../out/radar.js";
5
+ import { customLocale, fraudDetectionEnv } from "../config.js";
6
+ import { PayKKaCheckout } from "../core/PayKKaCheckout.js";
7
+ import { getFraudDetectionInstance } from "../out/fraud-detection.js";
8
8
  import { useI18n } from "./useI18n.js";
9
- let _session;
10
- function usePayState(props) {
9
+ function usePayState() {
11
10
  const [validated, setValidated] = h(false);
12
11
  const [submitButtonStatus, setSubmitButtonStatus] = h("unSubmit");
13
12
  const [errorMsg, setErrorMsg] = h("");
14
13
  const [session, setSession] = h(null);
15
14
  const [sessionReady, setSessionReady] = h(false);
16
- const [payKKaRadar, setPayKKaRadar] = h(null);
17
- y(() => {
18
- setSessionReady(false);
19
- if (!_session) {
20
- _session = new Session(props.sessionId, props.clientKey);
21
- }
22
- setSession(_session);
23
- _session.ready().then(() => setSessionReady(true)).catch(() => setSessionReady(false));
24
- }, [props.sessionId]);
15
+ const [fraudDetection, setFraudDetection] = h(null);
16
+ setSession(PayKKaCheckout.getSession());
25
17
  const { i18n } = useI18n(customLocale);
26
18
  y(() => {
27
19
  if (session) {
28
20
  session.ready().then(() => {
21
+ setSessionReady(true);
29
22
  i18n.load(session.checkout.locale || customLocale);
30
- const payKKaRadar2 = getPayKKaRadarInstance(radarEnv);
31
- setPayKKaRadar(payKKaRadar2);
32
- payKKaRadar2 == null ? void 0 : payKKaRadar2.createPayKKaRadar();
23
+ const fraudDetection2 = getFraudDetectionInstance(fraudDetectionEnv);
24
+ setFraudDetection(fraudDetection2);
25
+ fraudDetection2 == null ? void 0 : fraudDetection2.createFraudDetection();
33
26
  });
34
27
  }
35
28
  }, [session]);
@@ -45,7 +38,7 @@ function usePayState(props) {
45
38
  sessionReady,
46
39
  setSessionReady,
47
40
  i18n,
48
- payKKaRadar
41
+ fraudDetection
49
42
  };
50
43
  }
51
44
  export {
package/dist/es/index.js CHANGED
@@ -15,13 +15,16 @@ import { GooglePay } from "./components/GooglePay/index.js";
15
15
  import { SecuredIframe } from "./components/SecuredIframe/index.js";
16
16
  import { Sepa } from "./components/Sepa/index.js";
17
17
  import { IBANField } from "./components/CardIBANField/index.js";
18
+ import { EEncryptedCardType, ENCRYPTED_CARD_ITEM_ATTR, ENCRYPTED_CARD_WRAPPER_ID, EncryptedCard, PayKKaEncryptedCard } from "./components/EncryptedCard/index.js";
19
+ import { CombinedEncryptedField } from "./components/CombinedEncryptedField/index.js";
18
20
  import "./core/context.js";
19
21
  import { create } from "./core/create.js";
20
22
  import { Session } from "./core/Session.js";
21
23
  import { querySession } from "./core/query.js";
24
+ import { PayKKaCheckout } from "./core/PayKKaCheckout.js";
22
25
  import { I18n } from "./i18n/I18n.js";
23
26
  import { LocaleKey } from "./i18n/locales/index.js";
24
- import { setApiUrl, setCDNUrl, setCustomLocale, setCustomReqHeaders, setRadarEnv } from "./config.js";
27
+ import { setApiUrl, setCDNUrl, setCheckoutConfig, setCustomLocale, setCustomReqHeaders, setFraudDetectionEnv } from "./config.js";
25
28
  import "./utils/card-brand/brands.js";
26
29
  import { getFingerprint } from "./utils/system-info/finger-print.js";
27
30
  import "./utils/system-info/get-browser-info.js";
@@ -36,10 +39,17 @@ export {
36
39
  CardNumberField,
37
40
  CardSecurityCodeField,
38
41
  CardSelector,
42
+ CombinedEncryptedField,
43
+ EEncryptedCardType,
44
+ ENCRYPTED_CARD_ITEM_ATTR,
45
+ ENCRYPTED_CARD_WRAPPER_ID,
46
+ EncryptedCard,
39
47
  GooglePay,
40
48
  I18n,
41
49
  IBANField,
42
50
  LocaleKey,
51
+ PayKKaCheckout,
52
+ PayKKaEncryptedCard,
43
53
  SecuredIframe,
44
54
  Sepa,
45
55
  Session,
@@ -50,7 +60,8 @@ export {
50
60
  querySession,
51
61
  setApiUrl,
52
62
  setCDNUrl,
63
+ setCheckoutConfig,
53
64
  setCustomLocale,
54
65
  setCustomReqHeaders,
55
- setRadarEnv
66
+ setFraudDetectionEnv
56
67
  };