@paykka/card-checkout-ui 0.5.17 → 0.7.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 (189) 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/index.js +0 -2
  4. package/dist/es/api/modules/checkout/index.js +1 -15
  5. package/dist/es/api/modules/checkout/map.js +22 -4
  6. package/dist/es/api/modules/encrypted-card/index.js +54 -0
  7. package/dist/es/api/modules/get-browser-params.js +2 -2
  8. package/dist/es/api/modules/index.js +0 -2
  9. package/dist/es/components/AccountNameField/index.js +2 -3
  10. package/dist/es/components/AddressField/index.js +4 -7
  11. package/dist/es/components/AliPay/index.js +13 -12
  12. package/dist/es/components/ApplePay/index.js +75 -19
  13. package/dist/es/components/Card/index.js +335 -143
  14. package/dist/es/components/CardBrands/index.js +0 -2
  15. package/dist/es/components/CardExpireDateField/index.js +6 -6
  16. package/dist/es/components/CardHolderNameField/index.js +5 -5
  17. package/dist/es/components/CardIBANField/index.js +2 -3
  18. package/dist/es/components/CardNo/index.js +0 -2
  19. package/dist/es/components/CardNumberField/index.js +32 -20
  20. package/dist/es/components/CardSecurityCodeField/index.js +6 -6
  21. package/dist/es/components/CardSelector/index.js +1 -3
  22. package/dist/es/components/CombinedCardInfo/index.js +99 -0
  23. package/dist/es/components/EmailField/EmailField.js +2 -3
  24. package/dist/es/components/EncryptedCard/index.js +408 -0
  25. package/dist/es/components/GooglePay/index.js +108 -36
  26. package/dist/es/components/RecurringTip/index.js +0 -2
  27. package/dist/es/components/SecuredFieldsProvider/index.js +230 -1
  28. package/dist/es/components/SecuredIframe/index.js +192 -22
  29. package/dist/es/components/Sepa/index.js +36 -32
  30. package/dist/es/components/SubmitButton/index.js +0 -2
  31. package/dist/es/components/ThreeDS/index.js +94 -0
  32. package/dist/es/components/WechatPay/index.js +31 -30
  33. package/dist/es/components/index.js +4 -2
  34. package/dist/es/components/internal/Button/Button.js +0 -2
  35. package/dist/es/components/internal/Button/index.js +0 -2
  36. package/dist/es/components/internal/CheckBox/CheckBox.js +0 -2
  37. package/dist/es/components/internal/CheckBox/index.js +0 -2
  38. package/dist/es/components/internal/Form/FormItem.js +28 -24
  39. package/dist/es/components/internal/Form/index.js +1 -0
  40. package/dist/es/components/internal/Form/type.js +13 -1
  41. package/dist/es/components/internal/Info/Info.js +0 -2
  42. package/dist/es/components/internal/Info/index.js +0 -2
  43. package/dist/es/components/internal/Input/Input.js +11 -13
  44. package/dist/es/components/internal/Input/index.js +1 -0
  45. package/dist/es/components/internal/Input/type.js +11 -1
  46. package/dist/es/components/internal/LoadingCheck/LoadingCheck.js +0 -2
  47. package/dist/es/components/internal/LoadingCheck/index.js +0 -2
  48. package/dist/es/components/internal/Modal/Modal.js +40 -0
  49. package/dist/es/components/internal/Modal/modal2.js +1 -0
  50. package/dist/es/components/internal/Select/Select.js +2 -2
  51. package/dist/es/components/internal/Select/SelectMenu.js +0 -2
  52. package/dist/es/components/internal/Select/SelectMenuItem.js +0 -2
  53. package/dist/es/components/internal/icons/Icon3DSFail.js +3 -0
  54. package/dist/es/components/internal/icons/Icon3DSInfo.js +62 -0
  55. package/dist/es/components/internal/icons/Icon3DSSuccess.js +3 -0
  56. package/dist/es/config.js +12 -8
  57. package/dist/es/constant.js +13 -2
  58. package/dist/es/core/PayKKaCheckout.js +116 -0
  59. package/dist/es/core/Session.js +7 -6
  60. package/dist/es/core/environment.js +26 -0
  61. package/dist/es/core/error.js +21 -0
  62. package/dist/es/core/index.js +0 -2
  63. package/dist/es/core/query.js +1 -8
  64. package/dist/es/hooks/index.js +0 -2
  65. package/dist/es/hooks/useBreakpoints.js +57 -0
  66. package/dist/es/hooks/useI18n.js +0 -1
  67. package/dist/es/hooks/usePayState.js +20 -33
  68. package/dist/es/i18n/index.js +0 -2
  69. package/dist/es/i18n/locales/de-DE.js +11 -1
  70. package/dist/es/i18n/locales/en-GB.js +11 -1
  71. package/dist/es/i18n/locales/es-ES.js +11 -1
  72. package/dist/es/i18n/locales/fr-FR.js +11 -1
  73. package/dist/es/i18n/locales/index.js +8 -6
  74. package/dist/es/i18n/locales/ja-JP.js +11 -1
  75. package/dist/es/i18n/locales/ko-KR.js +11 -1
  76. package/dist/es/i18n/locales/pt-PT.js +11 -1
  77. package/dist/es/i18n/locales/ru-RU.js +11 -1
  78. package/dist/es/i18n/locales/zh-CN.js +11 -1
  79. package/dist/es/i18n/locales/zh-HK.js +11 -1
  80. package/dist/es/i18n/locales/zh-TW.js +11 -1
  81. package/dist/es/i18n/util.js +11 -8
  82. package/dist/es/index.js +15 -2
  83. package/dist/es/out/fraud-detection.js +99 -0
  84. package/dist/es/style.css +194 -4
  85. package/dist/es/types/{radar.js → fraud-detection.js} +1 -1
  86. package/dist/es/types/index.js +49 -1
  87. package/dist/es/types/message.js +28 -0
  88. package/dist/es/utils/card-brand/brands.js +21 -45
  89. package/dist/es/utils/card-brand/index.js +3 -2
  90. package/dist/es/utils/iframe.js +23 -0
  91. package/dist/es/utils/index.js +11 -1
  92. package/dist/es/utils/load.js +14 -0
  93. package/dist/es/utils/style.js +84 -0
  94. package/dist/style.css +1 -1
  95. package/dist/types/api/modules/checkout/map.d.ts +1 -0
  96. package/dist/types/api/modules/checkout/type.d.ts +14 -1
  97. package/dist/types/api/modules/encrypted-card/index.d.ts +6 -0
  98. package/dist/types/api/modules/encrypted-card/type.d.ts +31 -0
  99. package/dist/types/api/modules/get-browser-params.d.ts +3 -3
  100. package/dist/types/components/AddressField/type.d.ts +1 -0
  101. package/dist/types/components/AliPay/type.d.ts +4 -4
  102. package/dist/types/components/ApplePay/type.d.ts +19 -7
  103. package/dist/types/components/ApplePay/utils.d.ts +3 -0
  104. package/dist/types/components/Card/type.d.ts +64 -6
  105. package/dist/types/components/CardExpireDateField/type.d.ts +1 -0
  106. package/dist/types/components/CardHolderNameField/type.d.ts +1 -1
  107. package/dist/types/components/CardNumberField/type.d.ts +3 -0
  108. package/dist/types/components/CardSecurityCodeField/type.d.ts +1 -0
  109. package/dist/types/components/CombinedCardInfo/CombinedCardInfo.d.ts +5 -0
  110. package/dist/types/components/CombinedCardInfo/index.d.ts +2 -0
  111. package/dist/types/components/CombinedCardInfo/type.d.ts +16 -0
  112. package/dist/types/components/EncryptedCard/EncryptedCard.d.ts +4 -0
  113. package/dist/types/components/EncryptedCard/index.d.ts +4 -0
  114. package/dist/types/components/EncryptedCard/output.d.ts +9 -0
  115. package/dist/types/components/EncryptedCard/type.d.ts +85 -0
  116. package/dist/types/components/GooglePay/type.d.ts +20 -8
  117. package/dist/types/components/GooglePay/utils.d.ts +2 -0
  118. package/dist/types/components/SecuredFieldsProvider/index.d.ts +1 -0
  119. package/dist/types/components/SecuredFieldsProvider/type.d.ts +29 -100
  120. package/dist/types/components/SecuredFieldsProvider/utils/index.d.ts +1 -1
  121. package/dist/types/components/SecuredIframe/useSecuredInput.d.ts +7 -2
  122. package/dist/types/components/Sepa/type.d.ts +4 -4
  123. package/dist/types/components/ThreeDS/components/ThreeDSAuth/ThreeDSAuth.d.ts +3 -0
  124. package/dist/types/components/ThreeDS/components/ThreeDSAuth/index.d.ts +2 -0
  125. package/dist/types/components/ThreeDS/components/ThreeDSAuth/type.d.ts +17 -0
  126. package/dist/types/components/ThreeDS/components/ThreeDSIframe/ThreeDSIframe.d.ts +2 -0
  127. package/dist/types/components/ThreeDS/components/ThreeDSIframe/index.d.ts +1 -0
  128. package/dist/types/components/ThreeDS/components/ThreeDSIframe/output.d.ts +1 -0
  129. package/dist/types/components/ThreeDS/components/ThreeDSIframe/type.d.ts +5 -0
  130. package/dist/types/components/ThreeDS/components/ThreeDSStatus/ThreeDSStatus.d.ts +3 -0
  131. package/dist/types/components/ThreeDS/components/ThreeDSStatus/output.d.ts +1 -0
  132. package/dist/types/components/ThreeDS/components/ThreeDSStatus/type.d.ts +6 -0
  133. package/dist/types/components/ThreeDS/index.d.ts +1 -0
  134. package/dist/types/components/WechatPay/type.d.ts +4 -4
  135. package/dist/types/components/index.d.ts +2 -0
  136. package/dist/types/components/internal/Form/FormItem.d.ts +1 -1
  137. package/dist/types/components/internal/Form/type.d.ts +7 -0
  138. package/dist/types/components/internal/Input/Input.d.ts +1 -1
  139. package/dist/types/components/internal/Input/type.d.ts +7 -0
  140. package/dist/types/components/internal/Loading/Loading.d.ts +1 -0
  141. package/dist/types/components/internal/Loading/index.d.ts +1 -0
  142. package/dist/types/components/internal/Modal/Modal.d.ts +5 -0
  143. package/dist/types/components/internal/Modal/index.d.ts +0 -0
  144. package/dist/types/components/internal/Modal/type.d.ts +20 -0
  145. package/dist/types/components/internal/icons/Icon3DSFail.d.ts +2 -0
  146. package/dist/types/components/internal/icons/Icon3DSInfo.d.ts +2 -0
  147. package/dist/types/components/internal/icons/Icon3DSSuccess.d.ts +2 -0
  148. package/dist/types/components/internal/icons/index.d.ts +3 -0
  149. package/dist/types/config.d.ts +7 -3
  150. package/dist/types/constant.d.ts +7 -2
  151. package/dist/types/core/PayKKaCheckout.d.ts +28 -0
  152. package/dist/types/core/Session.d.ts +1 -1
  153. package/dist/types/core/context.d.ts +1 -0
  154. package/dist/types/core/environment.d.ts +4 -0
  155. package/dist/types/core/error.d.ts +16 -0
  156. package/dist/types/core/index.d.ts +2 -0
  157. package/dist/types/core/query.d.ts +2 -2
  158. package/dist/types/hooks/index.d.ts +1 -0
  159. package/dist/types/hooks/useBreakpoints.d.ts +15 -0
  160. package/dist/types/hooks/usePayState.d.ts +6 -25
  161. package/dist/types/i18n/locales/de-DE.d.ts +8 -0
  162. package/dist/types/i18n/locales/en-GB.d.ts +8 -0
  163. package/dist/types/i18n/locales/es-ES.d.ts +8 -0
  164. package/dist/types/i18n/locales/fr-FR.d.ts +8 -0
  165. package/dist/types/i18n/locales/index.d.ts +2 -2
  166. package/dist/types/i18n/locales/ja-JP.d.ts +8 -0
  167. package/dist/types/i18n/locales/ko-KR.d.ts +8 -0
  168. package/dist/types/i18n/locales/pt-PT.d.ts +8 -0
  169. package/dist/types/i18n/locales/ru-RU.d.ts +8 -0
  170. package/dist/types/i18n/locales/zh-CN.d.ts +8 -0
  171. package/dist/types/i18n/locales/zh-HK.d.ts +8 -0
  172. package/dist/types/i18n/locales/zh-TW.d.ts +8 -0
  173. package/dist/types/index.d.ts +2 -2
  174. package/dist/types/out/fraud-detection.d.ts +9 -0
  175. package/dist/types/types/{radar.d.ts → fraud-detection.d.ts} +3 -2
  176. package/dist/types/types/index.d.ts +100 -1
  177. package/dist/types/types/message.d.ts +170 -0
  178. package/dist/types/utils/card-brand/brands.d.ts +4 -18
  179. package/dist/types/utils/card-brand/index.d.ts +10 -9
  180. package/dist/types/utils/format.d.ts +0 -1
  181. package/dist/types/utils/index.d.ts +4 -0
  182. package/dist/types/utils/load.d.ts +7 -0
  183. package/dist/types/utils/style.d.ts +29 -0
  184. package/package.json +63 -63
  185. package/dist/card-checkout-ui.iife.js +0 -8
  186. package/dist/es/components/SecuredFieldsProvider/SecuredFieldsProvider.js +0 -222
  187. package/dist/es/out/radar.js +0 -123
  188. package/dist/types/out/radar.d.ts +0 -14
  189. /package/dist/types/{components/SecuredFieldsProvider/utils → utils}/iframe.d.ts +0 -0
@@ -21,6 +21,8 @@ const koKR = {
21
21
  "card.cardSelector.change": "변경",
22
22
  "card.cardSelector.useOtherCard": "다른 카드 사용",
23
23
  "card.storeInfo": "미래에 사용할 카드 정보를 저장합니다",
24
+ // card info
25
+ "card.info.label": "카드 정보",
24
26
  // common
25
27
  "common.pay": "지금 구매",
26
28
  "common.payProcessing": "처리 중...",
@@ -33,6 +35,8 @@ const koKR = {
33
35
  "common.noData": "데이터 없음",
34
36
  "common.netError": "네트워크 오류",
35
37
  "common.unknownError": "알 수 없는 오류",
38
+ "common.cancel": "취소",
39
+ "common.confirm": "확인",
36
40
  // common email
37
41
  "common.email.label": "이메일",
38
42
  "common.email.incomplete": "이메일을 입력해 주세요",
@@ -53,7 +57,13 @@ const koKR = {
53
57
  // sepa
54
58
  "sepa.iban.label": "IBAN",
55
59
  "sepa.iban.placeholder": "DE00 0000 0000 0000 0000 00",
56
- "sepa.iban.invalid": "입력한 IBAN이 유효하지 않습니다"
60
+ "sepa.iban.invalid": "입력한 IBAN이 유효하지 않습니다",
61
+ // threeDS
62
+ "threeDS.paymentIncomplete": "최근 결제가 완료되지 않았습니다, ",
63
+ "threeDS.completeFirst": "먼저 처리를 완료해 주세요.",
64
+ "threeDS.authenticationSuccessful": "인증이 성공했습니다,",
65
+ "threeDS.authenticationFailed": "인증이 실패했습니다,",
66
+ "threeDS.returnToCheckout": "곧 돌아갑니다."
57
67
  };
58
68
  export {
59
69
  koKR as default
@@ -21,6 +21,8 @@ const ptPT = {
21
21
  "card.cardSelector.change": "Trocar",
22
22
  "card.cardSelector.useOtherCard": "Usar outro cartão",
23
23
  "card.storeInfo": "Salvar as informações do meu cartão para uso futuro",
24
+ // card info
25
+ "card.info.label": "Informação do cartão",
24
26
  // common
25
27
  "common.pay": "Comprar agora",
26
28
  "common.payProcessing": "Processando...",
@@ -33,6 +35,8 @@ const ptPT = {
33
35
  "common.noData": "Sem dados",
34
36
  "common.netError": "Erro de Rede",
35
37
  "common.unknownError": "Erro Desconhecido",
38
+ "common.cancel": "Cancelar",
39
+ "common.confirm": "Confirmar",
36
40
  // common email
37
41
  "common.email.label": "Email",
38
42
  "common.email.incomplete": "Por favor, insira seu email",
@@ -53,7 +57,13 @@ const ptPT = {
53
57
  // sepa
54
58
  "sepa.iban.label": "IBAN",
55
59
  "sepa.iban.placeholder": "DE00 0000 0000 0000 0000 00",
56
- "sepa.iban.invalid": "O IBAN que introduziu é inválido"
60
+ "sepa.iban.invalid": "O IBAN que introduziu é inválido",
61
+ // threeDS
62
+ "threeDS.paymentIncomplete": "Seu último pagamento está incompleto, ",
63
+ "threeDS.completeFirst": "por favor, conclua o processamento primeiro.",
64
+ "threeDS.authenticationSuccessful": "Autenticação bem-sucedida,",
65
+ "threeDS.authenticationFailed": "Autenticação falhou,",
66
+ "threeDS.returnToCheckout": "a regressar em breve."
57
67
  };
58
68
  export {
59
69
  ptPT as default
@@ -21,6 +21,8 @@ const ruRU = {
21
21
  "card.cardSelector.change": "Изменить",
22
22
  "card.cardSelector.useOtherCard": "Использовать другую карту",
23
23
  "card.storeInfo": "Сохранить информацию о моей карте для будущего использования",
24
+ // card info
25
+ "card.info.label": "Данные карты",
24
26
  // common
25
27
  "common.pay": "Купить сейчас",
26
28
  "common.payProcessing": "Обработка...",
@@ -33,6 +35,8 @@ const ruRU = {
33
35
  "common.noData": "Нет данных",
34
36
  "common.netError": "Ошибка сети",
35
37
  "common.unknownError": "Неизвестная ошибка",
38
+ "common.cancel": "Отмена",
39
+ "common.confirm": "Подтвердить",
36
40
  // common email
37
41
  "common.email.label": "Электронная почта",
38
42
  "common.email.incomplete": "Пожалуйста, введите вашу электронную почту",
@@ -53,7 +57,13 @@ const ruRU = {
53
57
  // sepa
54
58
  "sepa.iban.label": "IBAN",
55
59
  "sepa.iban.placeholder": "DE00 0000 0000 0000 0000 00",
56
- "sepa.iban.invalid": "Введенный вами IBAN недействителен"
60
+ "sepa.iban.invalid": "Введенный вами IBAN недействителен",
61
+ // threeDS
62
+ "threeDS.paymentIncomplete": "Ваш последний платеж не завершен, ",
63
+ "threeDS.completeFirst": "пожалуйста, завершите его в первую очередь.",
64
+ "threeDS.authenticationSuccessful": "Аутентификация успешна,",
65
+ "threeDS.authenticationFailed": "Аутентификация не удалась,",
66
+ "threeDS.returnToCheckout": "скоро возврат."
57
67
  };
58
68
  export {
59
69
  ruRU as default
@@ -21,6 +21,8 @@ const zhCN = {
21
21
  "card.cardSelector.change": "更换",
22
22
  "card.cardSelector.useOtherCard": "输入卡信息支付",
23
23
  "card.storeInfo": "存储卡信息以开启快捷支付",
24
+ // card info
25
+ "card.info.label": "卡信息",
24
26
  // common
25
27
  "common.pay": "支付",
26
28
  "common.payProcessing": "处理中...",
@@ -33,6 +35,8 @@ const zhCN = {
33
35
  "common.noData": "暂无数据",
34
36
  "common.netError": "网络异常",
35
37
  "common.unknownError": "未知异常",
38
+ "common.cancel": "取消",
39
+ "common.confirm": "确认",
36
40
  // common email
37
41
  "common.email.label": "邮箱",
38
42
  "common.email.incomplete": "请输入邮箱",
@@ -53,7 +57,13 @@ const zhCN = {
53
57
  // sepa
54
58
  "sepa.iban.label": "IBAN",
55
59
  "sepa.iban.placeholder": "DE00 0000 0000 0000 0000 00",
56
- "sepa.iban.invalid": "您输入的IBAN无效"
60
+ "sepa.iban.invalid": "您输入的IBAN无效",
61
+ // threeDS
62
+ "threeDS.paymentIncomplete": "您的上一笔支付未完成,",
63
+ "threeDS.completeFirst": "请先完成处理",
64
+ "threeDS.authenticationSuccessful": "认证成功,",
65
+ "threeDS.authenticationFailed": "认证失败,",
66
+ "threeDS.returnToCheckout": "即将返回"
57
67
  };
58
68
  export {
59
69
  zhCN as default
@@ -21,6 +21,8 @@ const zhHK = {
21
21
  "card.cardSelector.change": "更換",
22
22
  "card.cardSelector.useOtherCard": "輸入卡信息支付",
23
23
  "card.storeInfo": "存儲卡信息以開啓快捷支付",
24
+ // card info
25
+ "card.info.label": "卡資料",
24
26
  // common
25
27
  "common.pay": "支付",
26
28
  "common.payProcessing": "處理中...",
@@ -33,6 +35,8 @@ const zhHK = {
33
35
  "common.noData": "暫無數據",
34
36
  "common.netError": "網絡異常",
35
37
  "common.unknownError": "未知異常",
38
+ "common.cancel": "取消",
39
+ "common.confirm": "確認",
36
40
  // common email
37
41
  "common.email.label": "郵箱",
38
42
  "common.email.incomplete": "請輸入郵箱",
@@ -53,7 +57,13 @@ const zhHK = {
53
57
  // sepa
54
58
  "sepa.iban.label": "IBAN",
55
59
  "sepa.iban.placeholder": "DE00 0000 0000 0000 0000 00",
56
- "sepa.iban.invalid": "您輸入的IBAN無效"
60
+ "sepa.iban.invalid": "您輸入的IBAN無效",
61
+ // threeDS
62
+ "threeDS.paymentIncomplete": "您的上一筆支付未完成,",
63
+ "threeDS.completeFirst": "請先完成處理",
64
+ "threeDS.authenticationSuccessful": "認證成功,",
65
+ "threeDS.authenticationFailed": "認證失敗,",
66
+ "threeDS.returnToCheckout": "即將返回"
57
67
  };
58
68
  export {
59
69
  zhHK as default
@@ -21,6 +21,8 @@ const zhTW = {
21
21
  "card.cardSelector.change": "更換",
22
22
  "card.cardSelector.useOtherCard": "輸入卡信息支付",
23
23
  "card.storeInfo": "存儲卡信息以開啓快捷支付",
24
+ // card info
25
+ "card.info.label": "卡片資訊",
24
26
  // common
25
27
  "common.pay": "支付",
26
28
  "common.payProcessing": "處理中...",
@@ -33,6 +35,8 @@ const zhTW = {
33
35
  "common.noData": "暫無數據",
34
36
  "common.netError": "網絡異常",
35
37
  "common.unknownError": "未知異常",
38
+ "common.cancel": "取消",
39
+ "common.confirm": "確認",
36
40
  // common email
37
41
  "common.email.label": "郵箱",
38
42
  "common.email.incomplete": "請輸入郵箱",
@@ -53,7 +57,13 @@ const zhTW = {
53
57
  // sepa
54
58
  "sepa.iban.label": "IBAN",
55
59
  "sepa.iban.placeholder": "DE00 0000 0000 0000 0000 00",
56
- "sepa.iban.invalid": "您輸入的IBAN無效"
60
+ "sepa.iban.invalid": "您輸入的IBAN無效",
61
+ // threeDS
62
+ "threeDS.paymentIncomplete": "您的上一筆支付未完成,",
63
+ "threeDS.completeFirst": "請先完成處理",
64
+ "threeDS.authenticationSuccessful": "認證成功,",
65
+ "threeDS.authenticationFailed": "認證失敗,",
66
+ "threeDS.returnToCheckout": "即將返回"
57
67
  };
58
68
  export {
59
69
  zhTW as default
@@ -1,7 +1,7 @@
1
1
  import { isFunction } from "../utils/is.js";
2
2
  import "../utils/card-brand/brands.js";
3
3
  import { getBrowserInfo } from "../utils/system-info/get-browser-info.js";
4
- import { locales, LocaleKey } from "./locales/index.js";
4
+ import { LocaleKey, getLocales } from "./locales/index.js";
5
5
  import enGB from "./locales/en-GB.js";
6
6
  function normalizedLocale(locale) {
7
7
  return locale.replaceAll("_", "-").toLowerCase();
@@ -9,14 +9,17 @@ function normalizedLocale(locale) {
9
9
  function getLocaleLanguage(locale) {
10
10
  return locale.split("-")[0];
11
11
  }
12
- const localeList = Object.entries(locales).map(([key, value]) => {
13
- return {
14
- locale: normalizedLocale(key),
15
- language: getLocaleLanguage(key),
16
- translation: value
17
- };
18
- });
12
+ const getLocaleList = () => {
13
+ return Object.entries(getLocales()).map(([key, value]) => {
14
+ return {
15
+ locale: normalizedLocale(key),
16
+ language: getLocaleLanguage(key),
17
+ translation: value
18
+ };
19
+ });
20
+ };
19
21
  function mergeCustomLocales(customLocales) {
22
+ const localeList = getLocaleList();
20
23
  return localeList;
21
24
  }
22
25
  function getTranslation(locale, customLocales) {
package/dist/es/index.js CHANGED
@@ -15,13 +15,17 @@ 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 { CombinedCardInfo } from "./components/CombinedCardInfo/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";
25
+ import { PayKKaError } from "./core/error.js";
22
26
  import { I18n } from "./i18n/I18n.js";
23
27
  import { LocaleKey } from "./i18n/locales/index.js";
24
- import { setApiUrl, setCDNUrl, setCustomLocale, setCustomReqHeaders, setRadarEnv } from "./config.js";
28
+ import { setApiUrl, setCDNUrl, setCheckoutConfig, setCustomLocale, setCustomReqHeaders, setFraudDetectionEnv } from "./config.js";
25
29
  import "./utils/card-brand/brands.js";
26
30
  import { getFingerprint } from "./utils/system-info/finger-print.js";
27
31
  import "./utils/system-info/get-browser-info.js";
@@ -36,10 +40,18 @@ export {
36
40
  CardNumberField,
37
41
  CardSecurityCodeField,
38
42
  CardSelector,
43
+ CombinedCardInfo,
44
+ EEncryptedCardType,
45
+ ENCRYPTED_CARD_ITEM_ATTR,
46
+ ENCRYPTED_CARD_WRAPPER_ID,
47
+ EncryptedCard,
39
48
  GooglePay,
40
49
  I18n,
41
50
  IBANField,
42
51
  LocaleKey,
52
+ PayKKaCheckout,
53
+ PayKKaEncryptedCard,
54
+ PayKKaError,
43
55
  SecuredIframe,
44
56
  Sepa,
45
57
  Session,
@@ -50,7 +62,8 @@ export {
50
62
  querySession,
51
63
  setApiUrl,
52
64
  setCDNUrl,
65
+ setCheckoutConfig,
53
66
  setCustomLocale,
54
67
  setCustomReqHeaders,
55
- setRadarEnv
68
+ setFraudDetectionEnv
56
69
  };
@@ -0,0 +1,99 @@
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 { ECollMode } from "../types/fraud-detection.js";
8
+ var define_import_meta_env_default = { VITE_API_URL: "https://checkout.aq.paykka.com", VITE_CDN_ORIGIN: "https://checkout.aq.paykka.com", VITE_CDN_DIR: "/cp", BASE_URL: "/", MODE: "production", DEV: false, PROD: true, SSR: false };
9
+ const stripeKeyMap = {
10
+ eu: "pk_live_51QSXl2G2tOepMLcRVNu0S2T6MxyB1AIgCP5g7qMQvAviQS37v0wkPhJRKqfcbTql6ZkCkGktux4ixfXuZtFy6ZpP00awbGlLEq",
11
+ hk: "pk_live_51QSXh9Azq7GQL5iqwZNLz3KJ896MIUnai4H7H0z9DtlklJkgoH1VAlHKy382vWPqDm80nTy8MKUdJIKs0fFbTlKx006WcKWEDu",
12
+ us: define_import_meta_env_default.VITE_STRIPE_KEY
13
+ };
14
+ const DEFAULT_ENV = "eu";
15
+ let instance = null;
16
+ function getFraudDetectionInstance(env, mode) {
17
+ if (!instance) {
18
+ instance = new FraudDetection(env, mode);
19
+ }
20
+ return instance;
21
+ }
22
+ class FraudDetection {
23
+ constructor(env = DEFAULT_ENV, mode = [ECollMode.SR]) {
24
+ __publicField(this, "collResultMap", {
25
+ [ECollMode.SR]: { s: "" }
26
+ });
27
+ __publicField(this, "collMap", {
28
+ [ECollMode.SR]: () => this.stripeRadarColl()
29
+ });
30
+ __publicField(this, "p");
31
+ __publicField(this, "realMode", []);
32
+ __publicField(this, "keyMap", {
33
+ [ECollMode.SR]: ""
34
+ });
35
+ this.realMode = mode;
36
+ if (mode.includes(ECollMode.SR)) {
37
+ if (typeof env === "string") {
38
+ this.keyMap[ECollMode.SR] = stripeKeyMap[env];
39
+ } else {
40
+ this.keyMap[ECollMode.SR] = env[ECollMode.SR];
41
+ }
42
+ }
43
+ }
44
+ get fraudDetectionID() {
45
+ return this.transferRes();
46
+ }
47
+ /** 创建获取 radar session id 的 promise,缓存单例 */
48
+ async createFraudDetection() {
49
+ if (!this.p) {
50
+ this.p = Promise.all(
51
+ this.realMode.map(async (item) => {
52
+ if (this.collMap[item]) {
53
+ return await this.collMap[item]();
54
+ } else {
55
+ throw new Error(`Unsupported collection mode: ${item}`);
56
+ }
57
+ })
58
+ );
59
+ }
60
+ await this.p;
61
+ }
62
+ /** 获取 stripe 返回的 radar session id,组件直接调,有没有返回值都直接调,传给后端 */
63
+ transferRes() {
64
+ try {
65
+ const s = JSON.stringify(this.collResultMap[ECollMode.SR]);
66
+ return btoa(s);
67
+ } catch (error) {
68
+ console.log("[PayKKa Fraud Detection SDK]:", error);
69
+ return "";
70
+ }
71
+ }
72
+ stripeRadarColl() {
73
+ return new Promise((resolve, reject) => {
74
+ const script = document.createElement("script");
75
+ script.type = "text/javascript";
76
+ script.src = "https://js.stripe.com/v3/";
77
+ script.async = true;
78
+ script.onload = async () => {
79
+ const stripe = window.Stripe(this.keyMap[ECollMode.SR]);
80
+ const { radarSession, error } = await stripe.createRadarSession();
81
+ if (error) {
82
+ console.error(error);
83
+ reject(error);
84
+ } else {
85
+ this.collResultMap[ECollMode.SR].s = radarSession == null ? void 0 : radarSession.id;
86
+ resolve(radarSession);
87
+ }
88
+ };
89
+ script.onerror = function() {
90
+ reject();
91
+ };
92
+ script.crossOrigin = "";
93
+ document.getElementsByTagName("head")[0].appendChild(script);
94
+ });
95
+ }
96
+ }
97
+ export {
98
+ getFraudDetectionInstance
99
+ };
package/dist/es/style.css CHANGED
@@ -96,10 +96,11 @@
96
96
  border: none;
97
97
  height: 100%;
98
98
  width: 100%;
99
- border-radius: 12px;
99
+ border-radius: 8px;
100
100
  caret-color: var(--paykka-card-checkout-input-color, #4F43DF);
101
101
  font-size: 16px;
102
102
  padding-left: 12px;
103
+ background-color: transparent;
103
104
  }
104
105
 
105
106
  .paykka-card-checkout-input__input::placeholder {
@@ -112,6 +113,14 @@
112
113
  align-items: center;
113
114
  flex-shrink: 0;
114
115
  margin-left: 12px;
116
+ }
117
+
118
+ .paykka-card-checkout-input__left-icon {
119
+ padding-left: 12px;
120
+ display: flex;
121
+ align-items: center;
122
+ flex-shrink: 0;
123
+ margin-right: 12px;
115
124
  }::-webkit-scrollbar {
116
125
  height: 6px;
117
126
  width: 6px;
@@ -699,12 +708,163 @@
699
708
  display: none !important;
700
709
  }
701
710
 
711
+ .paykka-card-checkout-modal {
712
+ position: fixed;
713
+ left: 0px;
714
+ right: 0px;
715
+ top: 0px;
716
+ bottom: 0px;
717
+ z-index: 9999;
718
+ display: flex;
719
+ flex-direction: column;
720
+ align-items: center;
721
+ justify-content: center;
722
+ }
723
+
724
+ .paykka-card-checkout-modal__mask {
725
+ position: fixed;
726
+ left: 0;
727
+ right: 0;
728
+ top: 0;
729
+ bottom: 0;
730
+ background-color: rgba(0, 0, 0, 0.4);
731
+ }
732
+
733
+ .paykka-card-checkout-modal__content {
734
+ position: relative;
735
+ z-index: 9999;
736
+ border-radius: 8px;
737
+ background-color: rgb(255, 255, 255);
738
+ box-shadow: 0px 8px 16px -8px rgba(0, 0, 0, 0.08), 0px 12px 32px 0px rgba(0, 0, 0, 0.06), 0px 16px 48px 16px rgba(0, 0, 0, 0.04);
739
+ display: flex;
740
+ flex-direction: column;
741
+ }
742
+
743
+ .paykka-card-checkout-modal__close {
744
+ cursor: pointer;
745
+ right: 0px;
746
+ position: absolute;
747
+ transform: translate(0, -150%);
748
+ color: #d2d2d2;
749
+ }
750
+
751
+ .paykka-card-checkout-modal__close:hover {
752
+ color: #FFFFFF;
753
+ }
754
+
755
+ .paykka-card-checkout-modal__body {
756
+ flex: 1;
757
+ padding-left: 28px;
758
+ padding-right: 28px;
759
+ padding-top: 36px;
760
+ padding-bottom: 24px;
761
+ }::-webkit-scrollbar {
762
+ height: 6px;
763
+ width: 6px;
764
+ }
765
+
766
+ ::-webkit-scrollbar-thumb {
767
+ background-color: rgba(0, 0, 0, 0.25);
768
+ border-radius: 4px;
769
+ }
770
+
771
+ ::-webkit-scrollbar-button {
772
+ display: none !important;
773
+ }
774
+
775
+ ::-moz-scrollbar-button {
776
+ display: none !important;
777
+ }
778
+
779
+ .paykka-card-checkout-three-ds-auth__content {
780
+ height: 100%;
781
+ }
782
+
783
+ .paykka-card-checkout-three-ds-auth__last-three-ds {
784
+ width: 100%;
785
+ height: 100%;
786
+ display: flex;
787
+ align-items: center;
788
+ justify-content: center;
789
+ flex-direction: column;
790
+ }
791
+
792
+ .paykka-card-checkout-three-ds-auth__last-three-ds-title {
793
+ margin-top: 20px;
794
+ margin-bottom: 40px;
795
+ color: #1f1f1f;
796
+ font-size: 20px;
797
+ font-weight: 700;
798
+ text-align: center;
799
+ }::-webkit-scrollbar {
800
+ height: 6px;
801
+ width: 6px;
802
+ }
803
+
804
+ ::-webkit-scrollbar-thumb {
805
+ background-color: rgba(0, 0, 0, 0.25);
806
+ border-radius: 4px;
807
+ }
808
+
809
+ ::-webkit-scrollbar-button {
810
+ display: none !important;
811
+ }
812
+
813
+ ::-moz-scrollbar-button {
814
+ display: none !important;
815
+ }
816
+
817
+ .paykka-card-checkout-combined-card-info {
818
+ width: 100%;
819
+ height: 100%;
820
+ display: flex;
821
+ }
822
+
823
+ .paykka-card-checkout-combined-card-info__card-number {
824
+ flex: 1;
825
+ }
826
+
827
+ .paykka-card-checkout-combined-card-info__expire-date {
828
+ width: 100px;
829
+ }
830
+
831
+ .paykka-card-checkout-combined-card-info__cvv {
832
+ width: 60px;
833
+ }
834
+
835
+ .paykka-card-checkout-combined-card-info__blank-icon {
836
+ width: 16px;
837
+ height: 16px;
838
+ }::-webkit-scrollbar {
839
+ height: 6px;
840
+ width: 6px;
841
+ }
842
+
843
+ ::-webkit-scrollbar-thumb {
844
+ background-color: rgba(0, 0, 0, 0.25);
845
+ border-radius: 4px;
846
+ }
847
+
848
+ ::-webkit-scrollbar-button {
849
+ display: none !important;
850
+ }
851
+
852
+ ::-moz-scrollbar-button {
853
+ display: none !important;
854
+ }
855
+
702
856
  .paykka-card-checkout-card {
703
857
  min-width: 280px;
704
858
  }
705
859
 
706
860
  .paykka-card-checkout-card__field {
707
- margin-bottom: 24px;
861
+ margin-bottom: 16px;
862
+ }
863
+
864
+ @media (min-width: 480px) {
865
+ .paykka-card-checkout-card__field {
866
+ margin-bottom: 20px;
867
+ }
708
868
  }
709
869
 
710
870
  .paykka-card-checkout-card__center {
@@ -723,13 +883,23 @@
723
883
  }
724
884
  }
725
885
 
886
+ .paykka-card-checkout-card__card-info {
887
+ margin-bottom: 16px;
888
+ }
889
+
890
+ @media (min-width: 480px) {
891
+ .paykka-card-checkout-card__card-info {
892
+ margin-bottom: 20px;
893
+ }
894
+ }
895
+
726
896
  .paykka-card-checkout-card__holder-name {
727
- padding-bottom: 16px;
897
+ margin-bottom: 16px;
728
898
  }
729
899
 
730
900
  @media (min-width: 480px) {
731
901
  .paykka-card-checkout-card__holder-name {
732
- padding-bottom: 20px;
902
+ margin-bottom: 20px;
733
903
  }
734
904
  }
735
905
 
@@ -766,6 +936,26 @@
766
936
  .paykka-card-checkout-card__card-selector-wrapper {
767
937
  display: flex;
768
938
  justify-content: space-between;
939
+ }
940
+
941
+ .paykka-card-checkout-card__address {
942
+ margin-bottom: 16px;
943
+ }
944
+
945
+ @media (min-width: 480px) {
946
+ .paykka-card-checkout-card__address {
947
+ margin-bottom: 20px;
948
+ }
949
+ }
950
+
951
+ .paykka-card-checkout-card__store-checkbox {
952
+ margin-top: 16px;
953
+ }
954
+
955
+ @media (min-width: 480px) {
956
+ .paykka-card-checkout-card__store-checkbox {
957
+ margin-top: 20px;
958
+ }
769
959
  }::-webkit-scrollbar {
770
960
  height: 6px;
771
961
  width: 6px;
@@ -1,5 +1,5 @@
1
1
  var ECollMode = /* @__PURE__ */ ((ECollMode2) => {
2
- ECollMode2["STRIPE_RADAR"] = "STRIPE_RADAR";
2
+ ECollMode2["SR"] = "SR";
3
3
  return ECollMode2;
4
4
  })(ECollMode || {});
5
5
  export {
@@ -1 +1,49 @@
1
-
1
+ var CardBrandCode = /* @__PURE__ */ ((CardBrandCode2) => {
2
+ CardBrandCode2["VISA"] = "VISA";
3
+ CardBrandCode2["MASTER_CARD"] = "MASTER_CARD";
4
+ CardBrandCode2["JCB"] = "JCB";
5
+ CardBrandCode2["AMEX"] = "AMEX";
6
+ CardBrandCode2["DISCOVER"] = "DISCOVER";
7
+ CardBrandCode2["DINERS_CLUB"] = "DINERS_CLUB";
8
+ return CardBrandCode2;
9
+ })(CardBrandCode || {});
10
+ const defaultInputStyleConfig = {
11
+ base: {
12
+ padding: "0 0 0 12px"
13
+ }
14
+ };
15
+ const inputStyleAttrs = [
16
+ "padding",
17
+ "background",
18
+ "caretColor",
19
+ "color",
20
+ "font",
21
+ "fontFamily",
22
+ "fontSize",
23
+ "fontWeight",
24
+ "lineHeight",
25
+ "textAlign",
26
+ "textShadow",
27
+ "textTransform",
28
+ "letterSpacing",
29
+ "wordSpacing",
30
+ "textOverflow",
31
+ "whiteSpace",
32
+ "fontSizeAdjust",
33
+ "fontStretch",
34
+ "fontStyle",
35
+ "fontVariant",
36
+ "fontVariantAlternates",
37
+ "fontVariantCaps",
38
+ "fontVariantEastAsian",
39
+ "fontVariantLigatures",
40
+ "fontVariantNumeric",
41
+ "fontVariantPosition",
42
+ "lineHeight",
43
+ "outline"
44
+ ];
45
+ export {
46
+ CardBrandCode,
47
+ defaultInputStyleConfig,
48
+ inputStyleAttrs
49
+ };