@paykka/card-checkout-ui 0.6.0 → 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.
- package/dist/card-checkout-ui.js +12 -12
- package/dist/card-checkout-ui.umd.cjs +12 -12
- package/dist/es/api/index.js +0 -2
- package/dist/es/api/modules/checkout/index.js +1 -15
- package/dist/es/api/modules/checkout/map.js +20 -3
- package/dist/es/api/modules/index.js +0 -2
- package/dist/es/components/AccountNameField/index.js +0 -3
- package/dist/es/components/AddressField/index.js +2 -7
- package/dist/es/components/AliPay/index.js +8 -7
- package/dist/es/components/ApplePay/index.js +7 -8
- package/dist/es/components/Card/index.js +301 -125
- package/dist/es/components/CardBrands/index.js +0 -2
- package/dist/es/components/CardExpireDateField/index.js +1 -4
- package/dist/es/components/CardHolderNameField/index.js +3 -5
- package/dist/es/components/CardIBANField/index.js +0 -3
- package/dist/es/components/CardNo/index.js +0 -2
- package/dist/es/components/CardNumberField/index.js +1 -4
- package/dist/es/components/CardSecurityCodeField/index.js +1 -4
- package/dist/es/components/CardSelector/index.js +0 -3
- package/dist/es/components/CombinedCardInfo/index.js +99 -0
- package/dist/es/components/EmailField/EmailField.js +0 -3
- package/dist/es/components/EncryptedCard/index.js +35 -75
- package/dist/es/components/GooglePay/index.js +62 -28
- package/dist/es/components/RecurringTip/index.js +0 -2
- package/dist/es/components/SecuredFieldsProvider/index.js +230 -1
- package/dist/es/components/SecuredIframe/index.js +3 -1
- package/dist/es/components/Sepa/index.js +21 -27
- package/dist/es/components/SubmitButton/index.js +0 -2
- package/dist/es/components/ThreeDS/index.js +94 -0
- package/dist/es/components/WechatPay/index.js +26 -25
- package/dist/es/components/index.js +1 -3
- package/dist/es/components/internal/Button/Button.js +0 -2
- package/dist/es/components/internal/Button/index.js +0 -2
- package/dist/es/components/internal/CheckBox/CheckBox.js +0 -2
- package/dist/es/components/internal/CheckBox/index.js +0 -2
- package/dist/es/components/internal/Form/type.js +0 -2
- package/dist/es/components/internal/Info/Info.js +0 -2
- package/dist/es/components/internal/Info/index.js +0 -2
- package/dist/es/components/internal/Input/Input.js +2 -2
- package/dist/es/components/internal/Input/type.js +0 -2
- package/dist/es/components/internal/LoadingCheck/LoadingCheck.js +0 -2
- package/dist/es/components/internal/LoadingCheck/index.js +0 -2
- package/dist/es/components/internal/Modal/Modal.js +40 -0
- package/dist/es/components/internal/Modal/modal2.js +1 -0
- package/dist/es/components/internal/Select/Select.js +0 -2
- package/dist/es/components/internal/Select/SelectMenu.js +0 -2
- package/dist/es/components/internal/Select/SelectMenuItem.js +0 -2
- package/dist/es/components/internal/icons/Icon3DSFail.js +3 -0
- package/dist/es/components/internal/icons/Icon3DSInfo.js +62 -0
- package/dist/es/components/internal/icons/Icon3DSSuccess.js +3 -0
- package/dist/es/config.js +0 -2
- package/dist/es/constant.js +3 -2
- package/dist/es/core/PayKKaCheckout.js +96 -42
- package/dist/es/core/Session.js +7 -6
- package/dist/es/core/environment.js +26 -0
- package/dist/es/core/error.js +21 -0
- package/dist/es/core/index.js +0 -2
- package/dist/es/core/query.js +0 -2
- package/dist/es/core.js +34 -34
- package/dist/es/hooks/index.js +0 -2
- package/dist/es/hooks/useBreakpoints.js +57 -0
- package/dist/es/hooks/useI18n.js +1 -2
- package/dist/es/hooks/usePayState.js +18 -24
- package/dist/es/i18n/index.js +0 -2
- package/dist/es/i18n/locales/de-DE.js +11 -1
- package/dist/es/i18n/locales/en-GB.js +11 -1
- package/dist/es/i18n/locales/es-ES.js +11 -1
- package/dist/es/i18n/locales/fr-FR.js +11 -1
- package/dist/es/i18n/locales/index.js +8 -6
- package/dist/es/i18n/locales/ja-JP.js +11 -1
- package/dist/es/i18n/locales/ko-KR.js +11 -1
- package/dist/es/i18n/locales/pt-PT.js +11 -1
- package/dist/es/i18n/locales/ru-RU.js +11 -1
- package/dist/es/i18n/locales/zh-CN.js +11 -1
- package/dist/es/i18n/locales/zh-HK.js +11 -1
- package/dist/es/i18n/locales/zh-TW.js +11 -1
- package/dist/es/i18n/util.js +11 -8
- package/dist/es/index.js +4 -2
- package/dist/es/style.css +186 -4
- package/dist/es/types/message.js +28 -0
- package/dist/es/utils/card-brand/brands.js +12 -10
- package/dist/es/utils/card-brand/index.js +3 -2
- package/dist/es/utils/iframe.js +23 -0
- package/dist/es/utils/index.js +0 -1
- package/dist/es/utils/style.js +47 -0
- package/dist/style.css +1 -1
- package/dist/types/api/modules/checkout/type.d.ts +14 -1
- package/dist/types/api/modules/get-browser-params.d.ts +1 -1
- package/dist/types/components/AddressField/type.d.ts +1 -0
- package/dist/types/components/AliPay/type.d.ts +4 -2
- package/dist/types/components/ApplePay/type.d.ts +4 -3
- package/dist/types/components/Card/type.d.ts +56 -10
- package/dist/types/components/CardHolderNameField/type.d.ts +1 -1
- package/dist/types/components/CombinedCardInfo/CombinedCardInfo.d.ts +5 -0
- package/dist/types/components/CombinedCardInfo/index.d.ts +2 -0
- package/dist/types/components/{CombinedEncryptedField → CombinedCardInfo}/type.d.ts +3 -2
- package/dist/types/components/GooglePay/type.d.ts +4 -3
- package/dist/types/components/SecuredFieldsProvider/index.d.ts +1 -0
- package/dist/types/components/SecuredFieldsProvider/type.d.ts +1 -153
- package/dist/types/components/SecuredFieldsProvider/utils/index.d.ts +1 -1
- package/dist/types/components/SecuredIframe/useSecuredInput.d.ts +2 -1
- package/dist/types/components/Sepa/type.d.ts +4 -2
- package/dist/types/components/ThreeDS/components/ThreeDSAuth/ThreeDSAuth.d.ts +3 -0
- package/dist/types/components/ThreeDS/components/ThreeDSAuth/index.d.ts +2 -0
- package/dist/types/components/ThreeDS/components/ThreeDSAuth/type.d.ts +17 -0
- package/dist/types/components/ThreeDS/components/ThreeDSIframe/ThreeDSIframe.d.ts +2 -0
- package/dist/types/components/ThreeDS/components/ThreeDSIframe/index.d.ts +1 -0
- package/dist/types/components/ThreeDS/components/ThreeDSIframe/output.d.ts +1 -0
- package/dist/types/components/ThreeDS/components/ThreeDSIframe/type.d.ts +5 -0
- package/dist/types/components/ThreeDS/components/ThreeDSStatus/ThreeDSStatus.d.ts +3 -0
- package/dist/types/components/ThreeDS/components/ThreeDSStatus/output.d.ts +1 -0
- package/dist/types/components/ThreeDS/components/ThreeDSStatus/type.d.ts +6 -0
- package/dist/types/components/ThreeDS/index.d.ts +1 -0
- package/dist/types/components/WechatPay/type.d.ts +4 -2
- package/dist/types/components/index.d.ts +1 -1
- package/dist/types/components/internal/Input/type.d.ts +1 -0
- package/dist/types/components/internal/Loading/Loading.d.ts +1 -0
- package/dist/types/components/internal/Loading/index.d.ts +1 -0
- package/dist/types/components/internal/Modal/Modal.d.ts +5 -0
- package/dist/types/components/internal/Modal/index.d.ts +0 -0
- package/dist/types/components/internal/Modal/type.d.ts +20 -0
- package/dist/types/components/internal/icons/Icon3DSFail.d.ts +2 -0
- package/dist/types/components/internal/icons/Icon3DSInfo.d.ts +2 -0
- package/dist/types/components/internal/icons/Icon3DSSuccess.d.ts +2 -0
- package/dist/types/components/internal/icons/index.d.ts +3 -0
- package/dist/types/constant.d.ts +6 -2
- package/dist/types/core/PayKKaCheckout.d.ts +22 -6
- package/dist/types/core/Session.d.ts +1 -1
- package/dist/types/core/context.d.ts +1 -0
- package/dist/types/core/environment.d.ts +4 -0
- package/dist/types/core/error.d.ts +16 -0
- package/dist/types/core/index.d.ts +1 -0
- package/dist/types/hooks/index.d.ts +1 -0
- package/dist/types/hooks/useBreakpoints.d.ts +15 -0
- package/dist/types/hooks/usePayState.d.ts +3 -6
- package/dist/types/i18n/locales/de-DE.d.ts +8 -0
- package/dist/types/i18n/locales/en-GB.d.ts +8 -0
- package/dist/types/i18n/locales/es-ES.d.ts +8 -0
- package/dist/types/i18n/locales/fr-FR.d.ts +8 -0
- package/dist/types/i18n/locales/index.d.ts +2 -2
- package/dist/types/i18n/locales/ja-JP.d.ts +8 -0
- package/dist/types/i18n/locales/ko-KR.d.ts +8 -0
- package/dist/types/i18n/locales/pt-PT.d.ts +8 -0
- package/dist/types/i18n/locales/ru-RU.d.ts +8 -0
- package/dist/types/i18n/locales/zh-CN.d.ts +8 -0
- package/dist/types/i18n/locales/zh-HK.d.ts +8 -0
- package/dist/types/i18n/locales/zh-TW.d.ts +8 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/types/index.d.ts +39 -8
- package/dist/types/types/message.d.ts +170 -0
- package/dist/types/utils/card-brand/brands.d.ts +1 -8
- package/dist/types/utils/card-brand/index.d.ts +2 -2
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/style.d.ts +12 -0
- package/package.json +63 -63
- package/dist/es/components/CombinedEncryptedField/index.js +0 -75
- package/dist/es/components/SecuredFieldsProvider/SecuredFieldsProvider.js +0 -268
- package/dist/types/components/CombinedEncryptedField/CombinedEncryptedField.d.ts +0 -4
- package/dist/types/components/CombinedEncryptedField/index.d.ts +0 -2
- /package/dist/types/{components/SecuredFieldsProvider/utils → utils}/iframe.d.ts +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const
|
|
1
|
+
declare const getLocales: () => Recordable<() => Promise<typeof import('./zh-CN')>>;
|
|
2
2
|
export type Translation = typeof import('./zh-CN')['default'];
|
|
3
3
|
export type CustomLocales = DeepPartial<Recordable<Translation>>;
|
|
4
4
|
export declare enum LocaleKey {
|
|
@@ -26,4 +26,4 @@ export declare enum LocaleKey {
|
|
|
26
26
|
zhTW = "zh-TW"
|
|
27
27
|
}
|
|
28
28
|
export type LocaleKeyType = LocaleKey | `${LocaleKey}`;
|
|
29
|
-
export default
|
|
29
|
+
export default getLocales;
|
|
@@ -16,6 +16,7 @@ declare const _default: {
|
|
|
16
16
|
'card.cardSelector.change': string;
|
|
17
17
|
'card.cardSelector.useOtherCard': string;
|
|
18
18
|
'card.storeInfo': string;
|
|
19
|
+
'card.info.label': string;
|
|
19
20
|
'common.pay': string;
|
|
20
21
|
'common.payProcessing': string;
|
|
21
22
|
'common.paySuccess': string;
|
|
@@ -27,6 +28,8 @@ declare const _default: {
|
|
|
27
28
|
'common.noData': string;
|
|
28
29
|
'common.netError': string;
|
|
29
30
|
'common.unknownError': string;
|
|
31
|
+
'common.cancel': string;
|
|
32
|
+
'common.confirm': string;
|
|
30
33
|
'common.email.label': string;
|
|
31
34
|
'common.email.incomplete': string;
|
|
32
35
|
'common.email.incorrect': string;
|
|
@@ -44,5 +47,10 @@ declare const _default: {
|
|
|
44
47
|
'sepa.iban.label': string;
|
|
45
48
|
'sepa.iban.placeholder': string;
|
|
46
49
|
'sepa.iban.invalid': string;
|
|
50
|
+
'threeDS.paymentIncomplete': string;
|
|
51
|
+
'threeDS.completeFirst': string;
|
|
52
|
+
'threeDS.authenticationSuccessful': string;
|
|
53
|
+
'threeDS.authenticationFailed': string;
|
|
54
|
+
'threeDS.returnToCheckout': string;
|
|
47
55
|
};
|
|
48
56
|
export default _default;
|
|
@@ -16,6 +16,7 @@ declare const _default: {
|
|
|
16
16
|
'card.cardSelector.change': string;
|
|
17
17
|
'card.cardSelector.useOtherCard': string;
|
|
18
18
|
'card.storeInfo': string;
|
|
19
|
+
'card.info.label': string;
|
|
19
20
|
'common.pay': string;
|
|
20
21
|
'common.payProcessing': string;
|
|
21
22
|
'common.paySuccess': string;
|
|
@@ -27,6 +28,8 @@ declare const _default: {
|
|
|
27
28
|
'common.noData': string;
|
|
28
29
|
'common.netError': string;
|
|
29
30
|
'common.unknownError': string;
|
|
31
|
+
'common.cancel': string;
|
|
32
|
+
'common.confirm': string;
|
|
30
33
|
'common.email.label': string;
|
|
31
34
|
'common.email.incomplete': string;
|
|
32
35
|
'common.email.incorrect': string;
|
|
@@ -44,5 +47,10 @@ declare const _default: {
|
|
|
44
47
|
'sepa.iban.label': string;
|
|
45
48
|
'sepa.iban.placeholder': string;
|
|
46
49
|
'sepa.iban.invalid': string;
|
|
50
|
+
'threeDS.paymentIncomplete': string;
|
|
51
|
+
'threeDS.completeFirst': string;
|
|
52
|
+
'threeDS.authenticationSuccessful': string;
|
|
53
|
+
'threeDS.authenticationFailed': string;
|
|
54
|
+
'threeDS.returnToCheckout': string;
|
|
47
55
|
};
|
|
48
56
|
export default _default;
|
|
@@ -16,6 +16,7 @@ declare const _default: {
|
|
|
16
16
|
'card.cardSelector.change': string;
|
|
17
17
|
'card.cardSelector.useOtherCard': string;
|
|
18
18
|
'card.storeInfo': string;
|
|
19
|
+
'card.info.label': string;
|
|
19
20
|
'common.pay': string;
|
|
20
21
|
'common.payProcessing': string;
|
|
21
22
|
'common.paySuccess': string;
|
|
@@ -27,6 +28,8 @@ declare const _default: {
|
|
|
27
28
|
'common.noData': string;
|
|
28
29
|
'common.netError': string;
|
|
29
30
|
'common.unknownError': string;
|
|
31
|
+
'common.cancel': string;
|
|
32
|
+
'common.confirm': string;
|
|
30
33
|
'common.email.label': string;
|
|
31
34
|
'common.email.incomplete': string;
|
|
32
35
|
'common.email.incorrect': string;
|
|
@@ -44,5 +47,10 @@ declare const _default: {
|
|
|
44
47
|
'sepa.iban.label': string;
|
|
45
48
|
'sepa.iban.placeholder': string;
|
|
46
49
|
'sepa.iban.invalid': string;
|
|
50
|
+
'threeDS.paymentIncomplete': string;
|
|
51
|
+
'threeDS.completeFirst': string;
|
|
52
|
+
'threeDS.authenticationSuccessful': string;
|
|
53
|
+
'threeDS.authenticationFailed': string;
|
|
54
|
+
'threeDS.returnToCheckout': string;
|
|
47
55
|
};
|
|
48
56
|
export default _default;
|
|
@@ -16,6 +16,7 @@ declare const _default: {
|
|
|
16
16
|
'card.cardSelector.change': string;
|
|
17
17
|
'card.cardSelector.useOtherCard': string;
|
|
18
18
|
'card.storeInfo': string;
|
|
19
|
+
'card.info.label': string;
|
|
19
20
|
'common.pay': string;
|
|
20
21
|
'common.payProcessing': string;
|
|
21
22
|
'common.paySuccess': string;
|
|
@@ -27,6 +28,8 @@ declare const _default: {
|
|
|
27
28
|
'common.noData': string;
|
|
28
29
|
'common.netError': string;
|
|
29
30
|
'common.unknownError': string;
|
|
31
|
+
'common.cancel': string;
|
|
32
|
+
'common.confirm': string;
|
|
30
33
|
'common.email.label': string;
|
|
31
34
|
'common.email.incomplete': string;
|
|
32
35
|
'common.email.incorrect': string;
|
|
@@ -44,5 +47,10 @@ declare const _default: {
|
|
|
44
47
|
'sepa.iban.label': string;
|
|
45
48
|
'sepa.iban.placeholder': string;
|
|
46
49
|
'sepa.iban.invalid': string;
|
|
50
|
+
'threeDS.paymentIncomplete': string;
|
|
51
|
+
'threeDS.completeFirst': string;
|
|
52
|
+
'threeDS.authenticationSuccessful': string;
|
|
53
|
+
'threeDS.authenticationFailed': string;
|
|
54
|
+
'threeDS.returnToCheckout': string;
|
|
47
55
|
};
|
|
48
56
|
export default _default;
|
|
@@ -16,6 +16,7 @@ declare const _default: {
|
|
|
16
16
|
'card.cardSelector.change': string;
|
|
17
17
|
'card.cardSelector.useOtherCard': string;
|
|
18
18
|
'card.storeInfo': string;
|
|
19
|
+
'card.info.label': string;
|
|
19
20
|
'common.pay': string;
|
|
20
21
|
'common.payProcessing': string;
|
|
21
22
|
'common.paySuccess': string;
|
|
@@ -27,6 +28,8 @@ declare const _default: {
|
|
|
27
28
|
'common.noData': string;
|
|
28
29
|
'common.netError': string;
|
|
29
30
|
'common.unknownError': string;
|
|
31
|
+
'common.cancel': string;
|
|
32
|
+
'common.confirm': string;
|
|
30
33
|
'common.email.label': string;
|
|
31
34
|
'common.email.incomplete': string;
|
|
32
35
|
'common.email.incorrect': string;
|
|
@@ -44,5 +47,10 @@ declare const _default: {
|
|
|
44
47
|
'sepa.iban.label': string;
|
|
45
48
|
'sepa.iban.placeholder': string;
|
|
46
49
|
'sepa.iban.invalid': string;
|
|
50
|
+
'threeDS.paymentIncomplete': string;
|
|
51
|
+
'threeDS.completeFirst': string;
|
|
52
|
+
'threeDS.authenticationSuccessful': string;
|
|
53
|
+
'threeDS.authenticationFailed': string;
|
|
54
|
+
'threeDS.returnToCheckout': string;
|
|
47
55
|
};
|
|
48
56
|
export default _default;
|
|
@@ -16,6 +16,7 @@ declare const _default: {
|
|
|
16
16
|
'card.cardSelector.change': string;
|
|
17
17
|
'card.cardSelector.useOtherCard': string;
|
|
18
18
|
'card.storeInfo': string;
|
|
19
|
+
'card.info.label': string;
|
|
19
20
|
'common.pay': string;
|
|
20
21
|
'common.payProcessing': string;
|
|
21
22
|
'common.paySuccess': string;
|
|
@@ -27,6 +28,8 @@ declare const _default: {
|
|
|
27
28
|
'common.noData': string;
|
|
28
29
|
'common.netError': string;
|
|
29
30
|
'common.unknownError': string;
|
|
31
|
+
'common.cancel': string;
|
|
32
|
+
'common.confirm': string;
|
|
30
33
|
'common.email.label': string;
|
|
31
34
|
'common.email.incomplete': string;
|
|
32
35
|
'common.email.incorrect': string;
|
|
@@ -44,5 +47,10 @@ declare const _default: {
|
|
|
44
47
|
'sepa.iban.label': string;
|
|
45
48
|
'sepa.iban.placeholder': string;
|
|
46
49
|
'sepa.iban.invalid': string;
|
|
50
|
+
'threeDS.paymentIncomplete': string;
|
|
51
|
+
'threeDS.completeFirst': string;
|
|
52
|
+
'threeDS.authenticationSuccessful': string;
|
|
53
|
+
'threeDS.authenticationFailed': string;
|
|
54
|
+
'threeDS.returnToCheckout': string;
|
|
47
55
|
};
|
|
48
56
|
export default _default;
|
|
@@ -16,6 +16,7 @@ declare const _default: {
|
|
|
16
16
|
'card.cardSelector.change': string;
|
|
17
17
|
'card.cardSelector.useOtherCard': string;
|
|
18
18
|
'card.storeInfo': string;
|
|
19
|
+
'card.info.label': string;
|
|
19
20
|
'common.pay': string;
|
|
20
21
|
'common.payProcessing': string;
|
|
21
22
|
'common.paySuccess': string;
|
|
@@ -27,6 +28,8 @@ declare const _default: {
|
|
|
27
28
|
'common.noData': string;
|
|
28
29
|
'common.netError': string;
|
|
29
30
|
'common.unknownError': string;
|
|
31
|
+
'common.cancel': string;
|
|
32
|
+
'common.confirm': string;
|
|
30
33
|
'common.email.label': string;
|
|
31
34
|
'common.email.incomplete': string;
|
|
32
35
|
'common.email.incorrect': string;
|
|
@@ -44,5 +47,10 @@ declare const _default: {
|
|
|
44
47
|
'sepa.iban.label': string;
|
|
45
48
|
'sepa.iban.placeholder': string;
|
|
46
49
|
'sepa.iban.invalid': string;
|
|
50
|
+
'threeDS.paymentIncomplete': string;
|
|
51
|
+
'threeDS.completeFirst': string;
|
|
52
|
+
'threeDS.authenticationSuccessful': string;
|
|
53
|
+
'threeDS.authenticationFailed': string;
|
|
54
|
+
'threeDS.returnToCheckout': string;
|
|
47
55
|
};
|
|
48
56
|
export default _default;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from './components';
|
|
2
|
-
export { type ComponentInst, create, querySession, Session, PayKKaCheckout } from './core';
|
|
2
|
+
export { type ComponentInst, create, querySession, Session, PayKKaCheckout, PayKKaError } from './core';
|
|
3
3
|
export { I18n, LocaleKey } from './i18n';
|
|
4
4
|
export { setApiUrl, setCDNUrl, setFraudDetectionEnv, setCustomReqHeaders, setCustomLocale, setCheckoutConfig } from './config';
|
|
5
5
|
export { getFingerprint } from './utils';
|
|
@@ -1,30 +1,58 @@
|
|
|
1
1
|
import type { HTMLAttributes } from 'preact/compat';
|
|
2
2
|
import type { LocaleKeyType } from '../i18n';
|
|
3
|
+
import type { PayKKaError, Session } from '../core';
|
|
3
4
|
import type { FraudDetectionEnv } from './fraud-detection';
|
|
4
5
|
export * from './fraud-detection';
|
|
6
|
+
export * from './message';
|
|
5
7
|
export type CustomAttributes<T extends EventTarget, K extends keyof HTMLAttributes<T> = 'style' | 'className'> = Pick<HTMLAttributes<T>, K>;
|
|
6
8
|
/** 收银台初始化参数 */
|
|
7
9
|
export interface PayKKaInitConfiguration {
|
|
8
10
|
sessionId: string;
|
|
11
|
+
/** 环境配置,必传! */
|
|
12
|
+
env: PayKKaEnvType;
|
|
9
13
|
/** 嵌入式收银台必传,需要商户进行配置 */
|
|
10
14
|
clientKey?: string;
|
|
11
15
|
/** 国际化语言 */
|
|
12
16
|
locale?: LocaleKeyType;
|
|
13
17
|
/** 是否隐藏支付按钮 */
|
|
14
18
|
hidePaymentButton?: boolean;
|
|
15
|
-
/**
|
|
16
|
-
|
|
19
|
+
/** 定义 3DS 所需配置 */
|
|
20
|
+
threeDSFrame?: ThreeDSFrameConfig;
|
|
17
21
|
/** 收银台已经获取到可用支付方式时调用 */
|
|
18
22
|
onPaymentMethodsReady?: (methods: string[]) => void;
|
|
19
|
-
/** 收银台过期时触发,可被组件参数中的 onExpired 回调覆盖 */
|
|
20
23
|
/** 收银台创建时报错触发 */
|
|
21
|
-
onInitError?: (error:
|
|
24
|
+
onInitError?: (error: PayKKaError) => void;
|
|
22
25
|
/**
|
|
23
|
-
*
|
|
26
|
+
* 内部参数
|
|
24
27
|
*/
|
|
25
|
-
/**
|
|
26
|
-
|
|
28
|
+
/** 环境配置,优先级大于 env 参数 */
|
|
29
|
+
_envConfig?: PayKKaEnvConfig;
|
|
27
30
|
}
|
|
31
|
+
export interface CoreProps {
|
|
32
|
+
session?: Session;
|
|
33
|
+
/** 定义 3DS 所需配置 */
|
|
34
|
+
threeDSFrame?: ThreeDSFrameConfig;
|
|
35
|
+
}
|
|
36
|
+
export interface ThreeDSFrameConfig {
|
|
37
|
+
/** 3DS 页面宽度 */
|
|
38
|
+
modalWidth?: number | string;
|
|
39
|
+
/** 3DS 页面高度 */
|
|
40
|
+
modalHeight?: number | string;
|
|
41
|
+
}
|
|
42
|
+
export declare enum EPayKKaEnv {
|
|
43
|
+
/** 沙箱环境 */
|
|
44
|
+
SANDBOX = "sandbox",
|
|
45
|
+
/** 欧洲生产环境 */
|
|
46
|
+
EU = "eu",
|
|
47
|
+
/** 香港生产环境 */
|
|
48
|
+
HK = "hk"
|
|
49
|
+
}
|
|
50
|
+
export interface PayKKaEnvConfig {
|
|
51
|
+
api?: string;
|
|
52
|
+
cdn?: string;
|
|
53
|
+
fraudDetection?: FraudDetectionEnv;
|
|
54
|
+
}
|
|
55
|
+
export type PayKKaEnvType = `${EPayKKaEnv}`;
|
|
28
56
|
export type PaymentSuccessData = {
|
|
29
57
|
returnUrl?: string;
|
|
30
58
|
};
|
|
@@ -36,7 +64,7 @@ export declare enum CardBrandCode {
|
|
|
36
64
|
DISCOVER = "DISCOVER",
|
|
37
65
|
DINERS_CLUB = "DINERS_CLUB"
|
|
38
66
|
}
|
|
39
|
-
export type CardBrand =
|
|
67
|
+
export type CardBrand = `${CardBrandCode}`;
|
|
40
68
|
export interface ElementStylesConfig {
|
|
41
69
|
/** input 元素的样式 */
|
|
42
70
|
input?: InputStylesConfig;
|
|
@@ -45,6 +73,9 @@ export interface ElementStylesConfig {
|
|
|
45
73
|
/** 错误提示文案的样式 */
|
|
46
74
|
errorMessage?: Partial<CSSStyleDeclaration>;
|
|
47
75
|
}
|
|
76
|
+
export interface FullElementStylesConfig extends ElementStylesConfig {
|
|
77
|
+
inputWrapper?: StylesConfig;
|
|
78
|
+
}
|
|
48
79
|
export interface StylesConfig {
|
|
49
80
|
/** 默认样式 */
|
|
50
81
|
base?: Partial<CSSStyleDeclaration>;
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import type { CardBrand, InputStylesConfig } from '.';
|
|
2
|
+
import type { PayRes } from '../api';
|
|
3
|
+
import type { EncryptCardRes } from '../api/modules/encrypted-card/type';
|
|
4
|
+
import type { EFieldType, FieldIframeConfig } from '../components/SecuredFieldsProvider';
|
|
5
|
+
import type { FormValidationStatus } from '../components/internal/Form';
|
|
6
|
+
import type { LocaleKeyType } from '../i18n';
|
|
7
|
+
export declare enum MessageAction {
|
|
8
|
+
/** 通知 iframe 初始化 input */
|
|
9
|
+
INIT = "init",
|
|
10
|
+
/** 表单 iframe DOM 已加载 */
|
|
11
|
+
ACTIVATED = "Activated",
|
|
12
|
+
/** 隐藏的 iframe 已经加载 */
|
|
13
|
+
HIDDEN_IFRAME_READY = "hiddenIframeReady",
|
|
14
|
+
/** 是否聚焦 */
|
|
15
|
+
FOCUS = "focus",
|
|
16
|
+
/** 卡 bin 信息改变 */
|
|
17
|
+
BIN_VALUE = "binValue",
|
|
18
|
+
/** 检测到卡品牌 */
|
|
19
|
+
BRAND = "brand",
|
|
20
|
+
/** 传递验证通过信息(附带值) */
|
|
21
|
+
VALID_WITH_VALUE = "validWithValue",
|
|
22
|
+
/** 通知隐藏 iframe 进行支付 */
|
|
23
|
+
PAYMENT = "payment",
|
|
24
|
+
/** 通知表单组件支付响应信息 */
|
|
25
|
+
AFTER_PAYMENT = "afterPayment",
|
|
26
|
+
/** 通知表单组件支付错误信息 */
|
|
27
|
+
PAYMENT_ERROR = "paymentError",
|
|
28
|
+
/** 通知表单组件支付超时 */
|
|
29
|
+
PAYMENT_TIMEOUT = "paymentTimeout",
|
|
30
|
+
/** 通知表单项验证信息 */
|
|
31
|
+
VALID_STATUS_CHANGED = "validStatusChanged",
|
|
32
|
+
/** 通知表单项校验 */
|
|
33
|
+
VALIDATE = "validate",
|
|
34
|
+
/** 通知表单项校验结果 */
|
|
35
|
+
VALIDATED = "validated",
|
|
36
|
+
/** 通知表单项配置 */
|
|
37
|
+
SET_CONFIG = "setConfig",
|
|
38
|
+
/**
|
|
39
|
+
* encrypted card
|
|
40
|
+
*/
|
|
41
|
+
/** 通知 clientKey 已校验 */
|
|
42
|
+
AUTHORIZED = "authorized",
|
|
43
|
+
/** 通知隐藏 iframe 加密卡信息 */
|
|
44
|
+
ENCRYPT_CARD = "encryptCard",
|
|
45
|
+
/** 通知加密后的卡信息 */
|
|
46
|
+
CARD_ENCRYPTED = "cardEncrypted",
|
|
47
|
+
/** 通知卡信息加密错误 */
|
|
48
|
+
CARD_ENCRYPTION_FAILED = "cardEncryptionFailed",
|
|
49
|
+
/**
|
|
50
|
+
* 3DS
|
|
51
|
+
*/
|
|
52
|
+
/** 通知组件查询 3DS 结果 */
|
|
53
|
+
CHECK_THREE_DS = "checkThreeDS",
|
|
54
|
+
/** 通知组件 3DS 结果页加载 */
|
|
55
|
+
THREE_DS_STATUS_INIT = "threeDSStatusInit",
|
|
56
|
+
/** 向 3DS 状态页传递配置 */
|
|
57
|
+
THREE_DS_STATUS_CONFIG = "threeDSStatusConfig"
|
|
58
|
+
}
|
|
59
|
+
export type Message<T extends MessageAction> = {
|
|
60
|
+
action: T;
|
|
61
|
+
} & MessageMapping[T];
|
|
62
|
+
type MessageMapping = {
|
|
63
|
+
[MessageAction.INIT]: InitMessage;
|
|
64
|
+
[MessageAction.FOCUS]: FocusMessage;
|
|
65
|
+
[MessageAction.BIN_VALUE]: BinValueMessage;
|
|
66
|
+
[MessageAction.VALID_WITH_VALUE]: ValidWithValueMessage;
|
|
67
|
+
[MessageAction.PAYMENT]: PaymentMessage;
|
|
68
|
+
[MessageAction.AFTER_PAYMENT]: AfterPaymentMessage;
|
|
69
|
+
[MessageAction.PAYMENT_ERROR]: PaymentErrorMessage;
|
|
70
|
+
[MessageAction.PAYMENT_TIMEOUT]: PaymentTimeoutMessage;
|
|
71
|
+
[MessageAction.VALID_STATUS_CHANGED]: ValidStatusChangedMessage;
|
|
72
|
+
[MessageAction.ENCRYPT_CARD]: EncryptCardMessage;
|
|
73
|
+
[MessageAction.CARD_ENCRYPTED]: CardEncryptedMessage;
|
|
74
|
+
[MessageAction.CARD_ENCRYPTION_FAILED]: CardEncryptionFailedMessage;
|
|
75
|
+
[MessageAction.AUTHORIZED]: AuthorizedMessage;
|
|
76
|
+
[MessageAction.BRAND]: BrandMessage;
|
|
77
|
+
[MessageAction.ACTIVATED]: ActivatedMessage;
|
|
78
|
+
[MessageAction.HIDDEN_IFRAME_READY]: {};
|
|
79
|
+
[MessageAction.VALIDATE]: {};
|
|
80
|
+
[MessageAction.VALIDATED]: ValidatedMessage;
|
|
81
|
+
[MessageAction.SET_CONFIG]: SetConfigMessage;
|
|
82
|
+
[MessageAction.CHECK_THREE_DS]: CheckThreeDSMessage;
|
|
83
|
+
[MessageAction.THREE_DS_STATUS_INIT]: {};
|
|
84
|
+
[MessageAction.THREE_DS_STATUS_CONFIG]: ThreeDSStatusConfigMessage;
|
|
85
|
+
};
|
|
86
|
+
export interface InitMessage {
|
|
87
|
+
config?: FieldIframeConfig;
|
|
88
|
+
/** 是否隐藏,如不隐藏则为表单iframe */
|
|
89
|
+
hidden: boolean;
|
|
90
|
+
apiUrl?: string;
|
|
91
|
+
cdnUrl?: string;
|
|
92
|
+
}
|
|
93
|
+
export interface FocusMessage {
|
|
94
|
+
focus: boolean;
|
|
95
|
+
fieldType: EFieldType;
|
|
96
|
+
}
|
|
97
|
+
export interface InvalidMessage {
|
|
98
|
+
errorTip: string;
|
|
99
|
+
fieldType: EFieldType;
|
|
100
|
+
}
|
|
101
|
+
export interface ValidMessage {
|
|
102
|
+
fieldType: EFieldType;
|
|
103
|
+
}
|
|
104
|
+
export interface BinValueMessage {
|
|
105
|
+
binValue: string;
|
|
106
|
+
fieldType: EFieldType;
|
|
107
|
+
brand?: CardBrand;
|
|
108
|
+
}
|
|
109
|
+
export interface ValidWithValueMessage {
|
|
110
|
+
value: string;
|
|
111
|
+
fieldType: EFieldType;
|
|
112
|
+
}
|
|
113
|
+
export interface PaymentMessage {
|
|
114
|
+
formData: any;
|
|
115
|
+
locale: string;
|
|
116
|
+
}
|
|
117
|
+
export interface AfterPaymentMessage {
|
|
118
|
+
response: PayRes;
|
|
119
|
+
}
|
|
120
|
+
export interface PaymentErrorMessage {
|
|
121
|
+
error: {
|
|
122
|
+
message: string;
|
|
123
|
+
code: string;
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
export interface ValidStatusChangedMessage {
|
|
127
|
+
status: FormValidationStatus;
|
|
128
|
+
errorTip?: string;
|
|
129
|
+
fieldType: EFieldType;
|
|
130
|
+
}
|
|
131
|
+
export interface PaymentTimeoutMessage {
|
|
132
|
+
message?: string;
|
|
133
|
+
}
|
|
134
|
+
export interface CardEncryptedMessage {
|
|
135
|
+
encryptedInfo: EncryptCardRes;
|
|
136
|
+
}
|
|
137
|
+
export interface CardEncryptionFailedMessage {
|
|
138
|
+
error: {
|
|
139
|
+
message: string;
|
|
140
|
+
code: string;
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
export interface AuthorizedMessage {
|
|
144
|
+
success: boolean;
|
|
145
|
+
}
|
|
146
|
+
export interface BrandMessage {
|
|
147
|
+
brand?: CardBrand;
|
|
148
|
+
fieldType: EFieldType;
|
|
149
|
+
}
|
|
150
|
+
export interface EncryptCardMessage {
|
|
151
|
+
merchantId: string;
|
|
152
|
+
clientKey: string;
|
|
153
|
+
}
|
|
154
|
+
export interface ActivatedMessage {
|
|
155
|
+
fieldType: EFieldType;
|
|
156
|
+
}
|
|
157
|
+
export interface ValidatedMessage {
|
|
158
|
+
status: FormValidationStatus;
|
|
159
|
+
fieldType: EFieldType;
|
|
160
|
+
}
|
|
161
|
+
export interface SetConfigMessage {
|
|
162
|
+
style?: InputStylesConfig;
|
|
163
|
+
}
|
|
164
|
+
export interface CheckThreeDSMessage {
|
|
165
|
+
status: string;
|
|
166
|
+
}
|
|
167
|
+
export interface ThreeDSStatusConfigMessage {
|
|
168
|
+
locale?: LocaleKeyType;
|
|
169
|
+
}
|
|
170
|
+
export {};
|
|
@@ -9,13 +9,6 @@ export interface CardBrandConfig {
|
|
|
9
9
|
order: number;
|
|
10
10
|
}
|
|
11
11
|
export declare const cardBrands: CardBrandConfig[];
|
|
12
|
-
export declare const
|
|
13
|
-
VISA: typeof IconVisa;
|
|
14
|
-
MASTER_CARD: typeof IconMasterCard;
|
|
15
|
-
JCB: typeof IconJcb;
|
|
16
|
-
AMEX: typeof IconAmex;
|
|
17
|
-
DISCOVER: typeof IconDiscover;
|
|
18
|
-
DINERS_CLUB: typeof IconDinnersClub;
|
|
19
|
-
};
|
|
12
|
+
export declare const getCardBrandIconMap: (code: CardBrandCode) => typeof IconVisa | typeof IconMasterCard | typeof IconJcb | typeof IconAmex | typeof IconDiscover | typeof IconDinnersClub;
|
|
20
13
|
export type CardBrands = (typeof cardBrands)[number]['code'];
|
|
21
14
|
export declare const cardBrandsLengthList: number[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { cardBrands, cardBrandsLengthList, cardBrandCodes,
|
|
2
|
-
export { cardBrands, cardBrandsLengthList, cardBrandCodes
|
|
1
|
+
import { cardBrands, cardBrandsLengthList, cardBrandCodes, type CardBrandConfig } from './brands';
|
|
2
|
+
export { cardBrands, cardBrandsLengthList, cardBrandCodes };
|
|
3
3
|
export declare function getSupportedCardBrands(supportedCardBrands?: string[]): CardBrandConfig[];
|
|
4
4
|
export declare function findCardBrand(number: string, brands?: CardBrandConfig[]): CardBrandConfig | undefined;
|
|
5
5
|
export declare function findCardBrandInfo(number: string, brands?: CardBrandConfig[]): {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ElementStylesConfig, type FullElementStylesConfig } from '../types';
|
|
1
2
|
/**
|
|
2
3
|
* 将对象转换为 CSS 样式字符串
|
|
3
4
|
* @param style 样式对象
|
|
@@ -15,3 +16,14 @@ export declare const generateClassNameMap: (selector?: string) => {
|
|
|
15
16
|
export declare const loadStyle: (styleStr: string, extraOptions?: Partial<HTMLScriptElement>) => void;
|
|
16
17
|
/** 创建 placeholder 样式 */
|
|
17
18
|
export declare const createPlaceholderStyle: (selector: string, style?: Recordable) => string;
|
|
19
|
+
/** 将可以直接应用到 iframe 中的 input 样式剥离出来 */
|
|
20
|
+
export declare const separateInputStyle: (styles: ElementStylesConfig) => FullElementStylesConfig;
|
|
21
|
+
/**
|
|
22
|
+
* 生成组件样式字符串
|
|
23
|
+
* @param style 样式对象
|
|
24
|
+
* @param selector 选择器,可以是父元素也可以是当前元素
|
|
25
|
+
*/
|
|
26
|
+
export declare const genComponentStyle: (list?: Array<{
|
|
27
|
+
selector: string;
|
|
28
|
+
style?: Recordable;
|
|
29
|
+
}>) => string;
|
package/package.json
CHANGED
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@paykka/card-checkout-ui",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"type": "module",
|
|
5
|
-
"main": "dist/paykka-card-checkout-ui.umd.js",
|
|
6
|
-
"module": "dist/es/index.js",
|
|
7
|
-
"typings": "dist/types/index.d.ts",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"import": "./dist/es/index.js",
|
|
11
|
-
"require": "./dist/paykka-card-checkout-ui.umd.js",
|
|
12
|
-
"types": "./dist/types/index.d.ts"
|
|
13
|
-
},
|
|
14
|
-
"./*": "./dist/*"
|
|
15
|
-
},
|
|
16
|
-
"files": [
|
|
17
|
-
"dist"
|
|
18
|
-
],
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
}
|
|
63
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@paykka/card-checkout-ui",
|
|
3
|
+
"version": "0.7.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "dist/paykka-card-checkout-ui.umd.js",
|
|
6
|
+
"module": "dist/es/index.js",
|
|
7
|
+
"typings": "dist/types/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/es/index.js",
|
|
11
|
+
"require": "./dist/paykka-card-checkout-ui.umd.js",
|
|
12
|
+
"types": "./dist/types/index.d.ts"
|
|
13
|
+
},
|
|
14
|
+
"./*": "./dist/*"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"registry": "https://packages.aliyun.com/640edee5a84870ae9d591e48/npm/npm-registry/"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@ctrl/tinycolor": "^4.0.3",
|
|
24
|
+
"@fingerprintjs/fingerprintjs": "^4.2.2",
|
|
25
|
+
"@preact/signals": "^1.3.0",
|
|
26
|
+
"@types/applepayjs": "^14.0.9",
|
|
27
|
+
"@types/googlepay": "^0.7.6",
|
|
28
|
+
"preact": "^10.24.3",
|
|
29
|
+
"ts-toolbelt": "^9.6.0",
|
|
30
|
+
"unfetch": "^5.0.0",
|
|
31
|
+
"vue-tsc": "^2.1.10"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@changesets/cli": "^2.27.1",
|
|
35
|
+
"@preact/preset-vite": "^2.9.1",
|
|
36
|
+
"@types/node": "^20.12.7",
|
|
37
|
+
"autoprefixer": "^10.4.18",
|
|
38
|
+
"execa": "^8.0.1",
|
|
39
|
+
"fast-glob": "^3.3.2",
|
|
40
|
+
"sass": "^1.71.1",
|
|
41
|
+
"tsx": "^4.7.3",
|
|
42
|
+
"typescript": "^5.4.5",
|
|
43
|
+
"vite": "^5.2.10"
|
|
44
|
+
},
|
|
45
|
+
"scripts": {
|
|
46
|
+
"dev": "vite --host",
|
|
47
|
+
"build": "pnpm type-check && pnpm build:npm && pnpm build:inner && pnpm copy-dist-to-cdn && pnpm build:outer",
|
|
48
|
+
"build:npm": "tsx ./build/run.ts",
|
|
49
|
+
"build:inner": "tsx ./build/runInner.ts",
|
|
50
|
+
"build:outer": "tsx ./build/runOuter.ts",
|
|
51
|
+
"build:type": "tsc -p ./tsconfig.build.json",
|
|
52
|
+
"copy-dist-to-cdn": "tsx ./build/copyDist2CDN.ts",
|
|
53
|
+
"changeset": "changeset",
|
|
54
|
+
"changeset:pre": "changeset pre enter beta",
|
|
55
|
+
"changeset:pre-exit": "changeset pre exit",
|
|
56
|
+
"changeset:version": "changeset version",
|
|
57
|
+
"changeset:release": "changeset publish",
|
|
58
|
+
"changeset:prelease": "changeset publish --tag beta",
|
|
59
|
+
"release:prod": "pnpm build && pnpm changeset:release",
|
|
60
|
+
"release:noprod": "pnpm build && pnpm changeset:pre-exit && pnpm changeset:prelease",
|
|
61
|
+
"type-check": "vue-tsc --noEmit -p tsconfig.json --composite false"
|
|
62
|
+
}
|
|
63
|
+
}
|