@paykka/card-checkout-ui 0.11.6 → 0.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/card-checkout-ui.js +19 -19
- package/dist/card-checkout-ui.umd.cjs +19 -19
- package/dist/es/_commonjsHelpers.js +82 -1
- package/dist/es/api/index.js +1 -0
- package/dist/es/api/modules/address/index.js +9 -9
- package/dist/es/api/modules/ali-pay/index.js +10 -49
- package/dist/es/api/modules/apple-pay/index.js +13 -59
- package/dist/es/api/modules/boost/index.js +8 -48
- package/dist/es/api/modules/card/index.js +10 -54
- package/dist/es/api/modules/checkout/index.js +11 -9
- package/dist/es/api/modules/checkout/map.js +25 -18
- package/dist/es/api/modules/encrypted-card/index.js +3 -2
- package/dist/es/api/modules/gcash/index.js +8 -48
- package/dist/es/api/modules/get-browser-params.js +4 -1
- package/dist/es/api/modules/google-pay/index.js +10 -56
- package/dist/es/api/modules/grab-pay/index.js +8 -48
- package/dist/es/api/modules/index.js +1 -0
- package/dist/es/api/modules/line-pay/index.js +8 -48
- package/dist/es/api/modules/map.js +17 -11
- package/dist/es/api/modules/may-bank-qr-pay/index.js +8 -48
- package/dist/es/api/modules/nine-pay/index.js +8 -48
- package/dist/es/api/modules/paymaya/index.js +8 -48
- package/dist/es/api/modules/risk/index.js +2 -1
- package/dist/es/api/modules/sepa/index.js +10 -51
- package/dist/es/api/modules/shopee-pay/index.js +8 -48
- package/dist/es/api/modules/threeDS/index.js +3 -0
- package/dist/es/api/modules/tng-wallet/index.js +8 -48
- package/dist/es/api/modules/wechat-pay/index.js +10 -51
- package/dist/es/api/modules/zalopay/index.js +16 -0
- package/dist/es/api/utils/index.js +59 -0
- package/dist/es/components/AddressField/index.js +37 -37
- package/dist/es/components/AliPay/index.js +158 -111
- package/dist/es/components/ApplePay/index.js +99 -67
- package/dist/es/components/Boost/index.js +91 -70
- package/dist/es/components/Card/index.js +114 -107
- package/dist/es/components/CardSelector/index.js +1 -1
- package/dist/es/components/DropIn/index.js +12 -4
- package/dist/es/components/EncryptedCard/index.js +6 -2
- package/dist/es/components/GooglePay/index.js +94 -60
- package/dist/es/components/GrabPay/index.js +91 -70
- package/dist/es/components/GuideCard/index.js +10 -7
- package/dist/es/components/LinePay/index.js +91 -70
- package/dist/es/components/MayBankQRPay/index.js +302 -275
- package/dist/es/components/NinePay/index.js +91 -70
- package/dist/es/components/SecuredFieldsProvider/index.js +26 -9
- package/dist/es/components/SecuredIframe/index.js +40 -61
- package/dist/es/components/Sepa/index.js +72 -53
- package/dist/es/components/ShopeePay/index.js +91 -70
- package/dist/es/components/SubmitButton/index.js +8 -7
- package/dist/es/components/TNGWallet/index.js +91 -70
- package/dist/es/components/ThreeDS/index.js +32 -7
- package/dist/es/components/WechatPay/index.js +151 -102
- package/dist/es/components/business/QRCodeModal/QRCodeModal.js +26 -6
- package/dist/es/components/index.js +1 -0
- package/dist/es/components/internal/Form/FormItem.js +1 -1
- package/dist/es/components/internal/Form/util.js +1 -1
- package/dist/es/components/internal/Modal/Modal.js +1 -1
- package/dist/es/components/internal/Select/Select.js +19 -8
- package/dist/es/components/internal/Select/SelectMenu.js +2 -2
- package/dist/es/components/internal/Select/SelectMenuItem.js +12 -4
- package/dist/es/components/internal/icons/IconError.js +7 -4
- package/dist/es/components/internal/icons/IconZalopay.js +47 -0
- package/dist/es/components/internal/icons/IconZalopayComplete.js +48 -0
- package/dist/es/components/wallets/GCash/GCash.js +80 -56
- package/dist/es/components/wallets/Paymaya/Paymaya.js +91 -70
- package/dist/es/components/wallets/Zalopay/Zalopay.js +381 -0
- package/dist/es/components/wallets/Zalopay/index.js +1 -0
- package/dist/es/components/wallets/Zalopay/type.js +1 -0
- package/dist/es/components/wallets/Zalopay/zalopay2.js +1 -0
- package/dist/es/config.js +5 -5
- package/dist/es/constant.js +8 -2
- package/dist/es/core/{Address.js → address.js} +8 -16
- package/dist/es/core/{PayKKaCheckout.js → checkout.js} +101 -27
- package/dist/es/core/create.js +1 -1
- package/dist/es/core/query.js +3 -2
- package/dist/es/core/{Session.js → session.js} +28 -32
- package/dist/es/core/theme.js +65 -0
- package/dist/es/core.js +0 -4
- package/dist/es/hooks/usePayment.js +14 -0
- package/dist/es/i18n/locales/de-DE.js +3 -1
- package/dist/es/i18n/locales/en-GB.js +3 -1
- package/dist/es/i18n/locales/es-ES.js +3 -1
- package/dist/es/i18n/locales/fr-FR.js +3 -1
- package/dist/es/i18n/locales/ja-JP.js +3 -1
- package/dist/es/i18n/locales/ko-KR.js +3 -1
- package/dist/es/i18n/locales/nl-NL.js +3 -1
- package/dist/es/i18n/locales/pt-PT.js +3 -1
- package/dist/es/i18n/locales/ru-RU.js +3 -1
- package/dist/es/i18n/locales/zh-CN.js +3 -1
- package/dist/es/i18n/locales/zh-HK.js +3 -1
- package/dist/es/i18n/locales/zh-TW.js +3 -1
- package/dist/es/index.js +21 -7
- package/dist/es/style.css +1 -1
- package/dist/es/types/index.js +7 -0
- package/dist/es/utils/colors.js +5 -1
- package/dist/es/utils/format.js +0 -5
- package/dist/es/utils/object.js +31 -1
- package/dist/es/utils/payment.js +82 -0
- package/dist/es/utils/redirect.js +4 -4
- package/dist/es/utils/string.js +10 -0
- package/dist/es/utils/system-info/is-ua-webview.js +14 -12
- package/dist/es/utils/theme.js +7 -0
- package/dist/style.css +1 -1
- package/dist/types/api/modules/address/index.d.ts +15 -6
- package/dist/types/api/modules/ali-pay/index.d.ts +3 -19
- package/dist/types/api/modules/apple-pay/index.d.ts +4 -14
- package/dist/types/api/modules/boost/index.d.ts +3 -23
- package/dist/types/api/modules/card/index.d.ts +3 -30
- package/dist/types/api/modules/checkout/index.d.ts +3 -3
- package/dist/types/api/modules/checkout/map.d.ts +3 -3
- package/dist/types/api/modules/checkout/type.d.ts +33 -4
- package/dist/types/api/modules/gcash/index.d.ts +3 -23
- package/dist/types/api/modules/get-browser-params.d.ts +1 -0
- package/dist/types/api/modules/google-pay/index.d.ts +3 -13
- package/dist/types/api/modules/grab-pay/index.d.ts +3 -23
- package/dist/types/api/modules/index.d.ts +1 -0
- package/dist/types/api/modules/line-pay/index.d.ts +3 -23
- package/dist/types/api/modules/map.d.ts +2 -2
- package/dist/types/api/modules/may-bank-qr-pay/index.d.ts +3 -23
- package/dist/types/api/modules/nine-pay/index.d.ts +3 -23
- package/dist/types/api/modules/paymaya/index.d.ts +3 -23
- package/dist/types/api/modules/sepa/index.d.ts +3 -24
- package/dist/types/api/modules/shopee-pay/index.d.ts +3 -23
- package/dist/types/api/modules/tng-wallet/index.d.ts +3 -23
- package/dist/types/api/modules/type.d.ts +74 -21
- package/dist/types/api/modules/wechat-pay/index.d.ts +3 -20
- package/dist/types/api/modules/zalopay/index.d.ts +4 -0
- package/dist/types/api/utils/index.d.ts +48 -0
- package/dist/types/components/AddressField/type.d.ts +3 -9
- package/dist/types/components/AliPay/AliPay.d.ts +6 -2
- package/dist/types/components/AliPay/type.d.ts +15 -2
- package/dist/types/components/ApplePay/ApplePay.d.ts +6 -2
- package/dist/types/components/ApplePay/type.d.ts +10 -14
- package/dist/types/components/ApplePay/utils.d.ts +1 -1
- package/dist/types/components/Boost/Boost.d.ts +6 -2
- package/dist/types/components/Boost/type.d.ts +2 -24
- package/dist/types/components/Card/Card.d.ts +6 -2
- package/dist/types/components/Card/type.d.ts +3 -43
- package/dist/types/components/DropIn/DropIn.d.ts +6 -2
- package/dist/types/components/DropIn/type.d.ts +4 -10
- package/dist/types/components/GooglePay/GooglePay.d.ts +6 -2
- package/dist/types/components/GooglePay/createGooglePay.d.ts +2 -1
- package/dist/types/components/GooglePay/type.d.ts +10 -26
- package/dist/types/components/GrabPay/GrabPay.d.ts +6 -2
- package/dist/types/components/GrabPay/type.d.ts +3 -25
- package/dist/types/components/LinePay/LinePay.d.ts +6 -2
- package/dist/types/components/LinePay/type.d.ts +3 -25
- package/dist/types/components/MayBankQRPay/MayBankQRPay.d.ts +6 -2
- package/dist/types/components/MayBankQRPay/type.d.ts +3 -25
- package/dist/types/components/NinePay/NinePay.d.ts +6 -2
- package/dist/types/components/NinePay/type.d.ts +3 -25
- package/dist/types/components/SecuredFieldsProvider/type.d.ts +5 -0
- package/dist/types/components/SecuredIframe/HiddenIframe.d.ts +3 -1
- package/dist/types/components/Sepa/Sepa.d.ts +6 -2
- package/dist/types/components/Sepa/type.d.ts +3 -2
- package/dist/types/components/ShopeePay/ShopeePay.d.ts +6 -2
- package/dist/types/components/ShopeePay/type.d.ts +3 -25
- package/dist/types/components/TNGWallet/TNGWallet.d.ts +6 -2
- package/dist/types/components/TNGWallet/type.d.ts +3 -25
- package/dist/types/components/ThreeDS/components/ThreeDSAuth/type.d.ts +2 -0
- package/dist/types/components/WechatPay/WechatPay.d.ts +6 -2
- package/dist/types/components/WechatPay/type.d.ts +15 -2
- package/dist/types/components/business/QRCodeModal/type.d.ts +2 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/components/internal/Loading/Loading.d.ts +1 -0
- package/dist/types/components/internal/Select/SelectMenu.d.ts +1 -1
- package/dist/types/components/internal/icons/IconZalopay.d.ts +2 -0
- package/dist/types/components/internal/icons/IconZalopayComplete.d.ts +2 -0
- package/dist/types/components/internal/icons/index.d.ts +3 -0
- package/dist/types/components/wallets/GCash/GCash.d.ts +6 -2
- package/dist/types/components/wallets/GCash/type.d.ts +3 -35
- package/dist/types/components/wallets/Paymaya/Paymaya.d.ts +6 -2
- package/dist/types/components/wallets/Paymaya/type.d.ts +3 -25
- package/dist/types/components/wallets/Zalopay/Zalopay.d.ts +10 -0
- package/dist/types/components/wallets/Zalopay/index.d.ts +2 -0
- package/dist/types/components/wallets/Zalopay/type.d.ts +39 -0
- package/dist/types/config.d.ts +2 -4
- package/dist/types/constant.d.ts +3 -1
- package/dist/types/core/{Address.d.ts → address.d.ts} +23 -24
- package/dist/types/core/{PayKKaCheckout.d.ts → checkout.d.ts} +9 -3
- package/dist/types/core/context.d.ts +3 -2
- package/dist/types/core/index.d.ts +3 -2
- package/dist/types/core/query.d.ts +2 -2
- package/dist/types/core/session.d.ts +23 -0
- package/dist/types/core/theme.d.ts +7 -0
- package/dist/types/hooks/index.d.ts +1 -0
- package/dist/types/hooks/usePayment.d.ts +8 -0
- package/dist/types/i18n/locales/de-DE.d.ts +2 -0
- package/dist/types/i18n/locales/en-GB.d.ts +2 -0
- package/dist/types/i18n/locales/es-ES.d.ts +2 -0
- package/dist/types/i18n/locales/fr-FR.d.ts +2 -0
- package/dist/types/i18n/locales/ja-JP.d.ts +2 -0
- package/dist/types/i18n/locales/ko-KR.d.ts +2 -0
- package/dist/types/i18n/locales/nl-NL.d.ts +2 -0
- package/dist/types/i18n/locales/pt-PT.d.ts +2 -0
- package/dist/types/i18n/locales/ru-RU.d.ts +2 -0
- package/dist/types/i18n/locales/zh-CN.d.ts +2 -0
- package/dist/types/i18n/locales/zh-HK.d.ts +2 -0
- package/dist/types/i18n/locales/zh-TW.d.ts +2 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/types/index.d.ts +70 -32
- package/dist/types/types/message.d.ts +30 -25
- package/dist/types/utils/card-brand/index.d.ts +3 -3
- package/dist/types/utils/colors.d.ts +1 -0
- package/dist/types/utils/index.d.ts +4 -2
- package/dist/types/utils/object.d.ts +7 -0
- package/dist/types/utils/payment.d.ts +37 -0
- package/dist/types/utils/string.d.ts +1 -0
- package/dist/types/utils/style.d.ts +1 -1
- package/dist/types/utils/system-info/is-ua-webview.d.ts +1 -1
- package/dist/types/utils/theme.d.ts +4 -0
- package/package.json +3 -3
- package/dist/es/utils/deep-freeze.js +0 -13
- package/dist/es/utils/obj.js +0 -22
- package/dist/types/core/Session.d.ts +0 -16
- package/dist/types/utils/deep-freeze.d.ts +0 -1
- package/dist/types/utils/obj.d.ts +0 -6
|
@@ -10,6 +10,7 @@ export interface SecuredFieldsProviderProps extends SecuredFieldsCallback {
|
|
|
10
10
|
children?: ReactNode;
|
|
11
11
|
targetElement?: HTMLElement;
|
|
12
12
|
style?: InputStylesConfig;
|
|
13
|
+
checkoutId: string;
|
|
13
14
|
}
|
|
14
15
|
export interface SecuredFieldsProviderRef {
|
|
15
16
|
payment: (formData: Recordable, extraParams?: Recordable) => void;
|
|
@@ -44,6 +45,7 @@ export interface SecuredFieldConfig extends FieldIframeConfig, SecuredFieldsCall
|
|
|
44
45
|
rootNode: HTMLElement;
|
|
45
46
|
fieldNode: HTMLElement;
|
|
46
47
|
iframeSrc: string;
|
|
48
|
+
iframeName: string;
|
|
47
49
|
iframeClassName: string;
|
|
48
50
|
hiddenIframe: HTMLIFrameElement;
|
|
49
51
|
}
|
|
@@ -53,7 +55,10 @@ export interface FieldIframeConfig {
|
|
|
53
55
|
hiddenIframeName: string;
|
|
54
56
|
supportedCardBrands: string[];
|
|
55
57
|
style?: InputStylesConfig;
|
|
58
|
+
checkoutId: string;
|
|
56
59
|
}
|
|
57
60
|
export declare const SECURED_FILED_ATTR = "data-sf";
|
|
58
61
|
export declare const SECURED_IFRAME_CLASS_NAME = "secured-iframe";
|
|
59
62
|
export declare const HIDDEN_IFRAME_NAME = "hidden-pay-iframe";
|
|
63
|
+
export declare const FIELD_IFRAME_NAME = "field-pay-iframe";
|
|
64
|
+
export declare const THREE_DS_IFRAME_NAME = "three-ds-iframe";
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import './sepa.scss';
|
|
2
2
|
import type { SepaProps, SepaRef } from './type';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
export declare const Sepa: import("preact").FunctionalComponent<import("preact/compat").PropsWithoutRef<SepaProps & import("../../types").PayKKaCommonConfig & {
|
|
4
|
+
session: import("../../core").Session;
|
|
5
|
+
core: import("../../core").PayKKaCheckout;
|
|
6
|
+
threeDSFrame?: import("../../types").ThreeDSFrameConfig | undefined;
|
|
7
|
+
isDropIn?: boolean | undefined;
|
|
8
|
+
}> & {
|
|
5
9
|
ref?: import("preact").Ref<SepaRef> | undefined;
|
|
6
10
|
}>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { PayKKaError } from '../../core';
|
|
2
|
+
import type { PayKKaCommonConfig, PaymentInfo } from '../../types';
|
|
2
3
|
import type { FormValidateError } from '../internal/Form';
|
|
3
|
-
export interface SepaProps {
|
|
4
|
+
export interface SepaProps extends PayKKaCommonConfig {
|
|
4
5
|
onSubmit?: (formValidateError?: Recordable<FormValidateError[]>) => void;
|
|
5
|
-
onSuccess?: (
|
|
6
|
+
onSuccess?: (data: PaymentInfo) => void;
|
|
6
7
|
onError?: (error: PayKKaError) => void;
|
|
7
8
|
onTimeout?: () => void;
|
|
8
9
|
onAuthorized?: () => void;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { ShopeePayProps } from './type';
|
|
2
2
|
import type { ShopeePayRef } from './type';
|
|
3
|
-
import type { CoreProps } from '../../types';
|
|
4
3
|
import './shopee-pay.scss';
|
|
5
|
-
export declare const ShopeePay: import("preact").FunctionalComponent<import("preact/compat").PropsWithoutRef<ShopeePayProps &
|
|
4
|
+
export declare const ShopeePay: import("preact").FunctionalComponent<import("preact/compat").PropsWithoutRef<ShopeePayProps & import("../../types").PayKKaCommonConfig & {
|
|
5
|
+
session: import("../../core").Session;
|
|
6
|
+
core: import("../../core").PayKKaCheckout;
|
|
7
|
+
threeDSFrame?: import("../../types").ThreeDSFrameConfig | undefined;
|
|
8
|
+
isDropIn?: boolean | undefined;
|
|
9
|
+
}> & {
|
|
6
10
|
ref?: import("preact").Ref<ShopeePayRef> | undefined;
|
|
7
11
|
}>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PayKKaError } from '../../core';
|
|
2
|
-
import type {
|
|
2
|
+
import type { PayKKaCommonConfig, PaymentInfo } from '../../types';
|
|
3
3
|
import type { FormValidateError } from '../internal/Form';
|
|
4
|
-
export interface ShopeePayProps {
|
|
4
|
+
export interface ShopeePayProps extends PayKKaCommonConfig {
|
|
5
5
|
/**
|
|
6
6
|
* 是否展示邮箱
|
|
7
7
|
* 若配置 true 但创建收银台时已经传了,就展示禁用状态。
|
|
@@ -17,35 +17,13 @@ export interface ShopeePayProps {
|
|
|
17
17
|
/** 提交表单时触发 */
|
|
18
18
|
onSubmit?: (formValidateError?: Recordable<FormValidateError[]>) => void;
|
|
19
19
|
/** 支付成功后触发 */
|
|
20
|
-
onSuccess?: (
|
|
20
|
+
onSuccess?: (data: PaymentInfo) => void;
|
|
21
21
|
/** 支付失败时触发 */
|
|
22
22
|
onError?: (error: PayKKaError) => void;
|
|
23
23
|
/** 支付超时时触发 */
|
|
24
24
|
onTimeout?: () => void;
|
|
25
25
|
/** 收银台已过期时触发 */
|
|
26
26
|
onExpired?: () => void;
|
|
27
|
-
/**
|
|
28
|
-
* @internal
|
|
29
|
-
* 请求支付接口成功后返回跳转链接
|
|
30
|
-
*/
|
|
31
|
-
onSubmitResponse?: (payRes: PayRes) => void;
|
|
32
|
-
/**
|
|
33
|
-
* @internal
|
|
34
|
-
* 跳转模式,钱包支付时需要跳转到第三方页面进行支付,流程结束在返回收银台
|
|
35
|
-
* auto: 自动跳转
|
|
36
|
-
* manual: 需要在 onSubmitResponse 中接收跳转链接并手动跳转
|
|
37
|
-
*/
|
|
38
|
-
redirectMode?: 'auto' | 'manual';
|
|
39
|
-
/**
|
|
40
|
-
* @internal
|
|
41
|
-
* 从第三方支付页面跳转回来时,是否自动查询支付结果
|
|
42
|
-
*/
|
|
43
|
-
autoQuery?: boolean;
|
|
44
|
-
/**
|
|
45
|
-
* @internal
|
|
46
|
-
* 是否展示引导卡片
|
|
47
|
-
*/
|
|
48
|
-
showGuideCard?: boolean;
|
|
49
27
|
}
|
|
50
28
|
export interface ShopeePayRef {
|
|
51
29
|
/** 停止轮询支付结果 */
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { TNGWalletProps } from './type';
|
|
2
2
|
import type { TNGWalletRef } from './type';
|
|
3
|
-
import type { CoreProps } from '../../types';
|
|
4
3
|
import './tng-wallet.scss';
|
|
5
|
-
export declare const TNGWallet: import("preact").FunctionalComponent<import("preact/compat").PropsWithoutRef<TNGWalletProps &
|
|
4
|
+
export declare const TNGWallet: import("preact").FunctionalComponent<import("preact/compat").PropsWithoutRef<TNGWalletProps & import("../../types").PayKKaCommonConfig & {
|
|
5
|
+
session: import("../../core").Session;
|
|
6
|
+
core: import("../../core").PayKKaCheckout;
|
|
7
|
+
threeDSFrame?: import("../../types").ThreeDSFrameConfig | undefined;
|
|
8
|
+
isDropIn?: boolean | undefined;
|
|
9
|
+
}> & {
|
|
6
10
|
ref?: import("preact").Ref<TNGWalletRef> | undefined;
|
|
7
11
|
}>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PayKKaError } from '../../core';
|
|
2
|
-
import type { PayRes } from '../../api';
|
|
3
2
|
import type { FormValidateError } from '../internal/Form';
|
|
4
|
-
|
|
3
|
+
import type { PayKKaCommonConfig, PaymentInfo } from '../../types';
|
|
4
|
+
export interface TNGWalletProps extends PayKKaCommonConfig {
|
|
5
5
|
/**
|
|
6
6
|
* 是否展示邮箱
|
|
7
7
|
* 若配置 true 但创建收银台时已经传了,就展示禁用状态。
|
|
@@ -17,35 +17,13 @@ export interface TNGWalletProps {
|
|
|
17
17
|
/** 提交表单时触发 */
|
|
18
18
|
onSubmit?: (formValidateError?: Recordable<FormValidateError[]>) => void;
|
|
19
19
|
/** 支付成功后触发 */
|
|
20
|
-
onSuccess?: (
|
|
20
|
+
onSuccess?: (data: PaymentInfo) => void;
|
|
21
21
|
/** 支付失败时触发 */
|
|
22
22
|
onError?: (error: PayKKaError) => void;
|
|
23
23
|
/** 支付超时时触发 */
|
|
24
24
|
onTimeout?: () => void;
|
|
25
25
|
/** 收银台已过期时触发 */
|
|
26
26
|
onExpired?: () => void;
|
|
27
|
-
/**
|
|
28
|
-
* @internal
|
|
29
|
-
* 请求支付接口成功后返回跳转链接
|
|
30
|
-
*/
|
|
31
|
-
onSubmitResponse?: (payRes: PayRes) => void;
|
|
32
|
-
/**
|
|
33
|
-
* @internal
|
|
34
|
-
* 跳转模式,钱包支付时需要跳转到第三方页面进行支付,流程结束在返回收银台
|
|
35
|
-
* auto: 自动跳转
|
|
36
|
-
* manual: 需要在 onSubmitResponse 中接收跳转链接并手动跳转
|
|
37
|
-
*/
|
|
38
|
-
redirectMode?: 'auto' | 'manual';
|
|
39
|
-
/**
|
|
40
|
-
* @internal
|
|
41
|
-
* 从第三方支付页面跳转回来时,是否自动查询支付结果
|
|
42
|
-
*/
|
|
43
|
-
autoQuery?: boolean;
|
|
44
|
-
/**
|
|
45
|
-
* @internal
|
|
46
|
-
* 是否展示引导卡片
|
|
47
|
-
*/
|
|
48
|
-
showGuideCard?: boolean;
|
|
49
27
|
}
|
|
50
28
|
export interface TNGWalletRef {
|
|
51
29
|
/** 停止轮询支付结果 */
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import './wechat-pay.scss';
|
|
2
2
|
import type { WechatPayProps, WechatPayRef } from './type';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
export declare const WechatPay: import("preact").FunctionalComponent<import("preact/compat").PropsWithoutRef<WechatPayProps & import("../../types").PayKKaCommonConfig & {
|
|
4
|
+
session: import("../../core").Session;
|
|
5
|
+
core: import("../../core").PayKKaCheckout;
|
|
6
|
+
threeDSFrame?: import("../../types").ThreeDSFrameConfig | undefined;
|
|
7
|
+
isDropIn?: boolean | undefined;
|
|
8
|
+
}> & {
|
|
5
9
|
ref?: import("preact").Ref<WechatPayRef> | undefined;
|
|
6
10
|
}>;
|
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
import type { PayRes } from '../../api';
|
|
2
2
|
import type { PayKKaError } from '../../core';
|
|
3
|
+
import type { PayKKaCommonConfig, PaymentInfo } from '../../types';
|
|
3
4
|
import type { FormValidateError } from '../internal/Form';
|
|
4
|
-
export interface WechatPayProps {
|
|
5
|
+
export interface WechatPayProps extends PayKKaCommonConfig {
|
|
6
|
+
/**
|
|
7
|
+
* 是否展示邮箱
|
|
8
|
+
* 若配置 true 但创建收银台时已经传了,就展示禁用状态。
|
|
9
|
+
* 若配置 false 但创建收银台时未传,依旧会展示该输入框。
|
|
10
|
+
*/
|
|
11
|
+
showEmail?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* 是否展示邮箱
|
|
14
|
+
* 若配置 true 但创建收银台时已经传了,还是展示,先不禁用。
|
|
15
|
+
* 若配置 false 但创建收银台时未传,依旧会展示该输入框。
|
|
16
|
+
*/
|
|
17
|
+
showAddress?: boolean;
|
|
5
18
|
onSubmit?: (formValidateError?: Recordable<FormValidateError[]>) => void;
|
|
6
|
-
onSuccess?: (
|
|
19
|
+
onSuccess?: (data: PaymentInfo) => void;
|
|
7
20
|
onError?: (error: PayKKaError) => void;
|
|
8
21
|
onTimeout?: (source: 'retry' | 'channel') => void;
|
|
9
22
|
onExpired?: () => void;
|
|
@@ -4,5 +4,5 @@ import type { ReactNode } from 'preact/compat';
|
|
|
4
4
|
interface SelectMenuProps extends CustomAttributes<HTMLDivElement> {
|
|
5
5
|
children?: ReactNode;
|
|
6
6
|
}
|
|
7
|
-
export declare
|
|
7
|
+
export declare const SelectMenu: (props: SelectMenuProps) => import("preact/compat").JSX.Element;
|
|
8
8
|
export {};
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { GCashProps, GCashRef } from './type';
|
|
2
|
-
import type { CoreProps } from '../../../types';
|
|
3
2
|
import './g-cash.scss';
|
|
4
|
-
export declare const GCash: import("preact").FunctionalComponent<import("preact/compat").PropsWithoutRef<GCashProps &
|
|
3
|
+
export declare const GCash: import("preact").FunctionalComponent<import("preact/compat").PropsWithoutRef<GCashProps & import("../../../types").PayKKaCommonConfig & {
|
|
4
|
+
session: import("../../../core").Session;
|
|
5
|
+
core: import("../../../core").PayKKaCheckout;
|
|
6
|
+
threeDSFrame?: import("../../../types").ThreeDSFrameConfig | undefined;
|
|
7
|
+
isDropIn?: boolean | undefined;
|
|
8
|
+
}> & {
|
|
5
9
|
ref?: import("preact").Ref<GCashRef> | undefined;
|
|
6
10
|
}>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PayKKaError } from '../../..';
|
|
2
|
-
import type {
|
|
2
|
+
import type { PayKKaCommonConfig, PaymentInfo } from '../../../types';
|
|
3
3
|
import type { FormValidateError } from '../../internal/Form';
|
|
4
|
-
export interface GCashProps {
|
|
4
|
+
export interface GCashProps extends PayKKaCommonConfig {
|
|
5
5
|
/**
|
|
6
6
|
* 是否展示邮箱
|
|
7
7
|
* 若配置 true 但创建收银台时已经传了,就展示禁用状态。
|
|
@@ -17,45 +17,13 @@ export interface GCashProps {
|
|
|
17
17
|
/** 提交表单时触发 */
|
|
18
18
|
onSubmit?: (formValidateError?: Recordable<FormValidateError[]>) => void;
|
|
19
19
|
/** 支付成功后触发 */
|
|
20
|
-
onSuccess?: (
|
|
20
|
+
onSuccess?: (data: PaymentInfo) => void;
|
|
21
21
|
/** 支付失败时触发 */
|
|
22
22
|
onError?: (error: PayKKaError) => void;
|
|
23
23
|
/** 支付超时时触发 */
|
|
24
24
|
onTimeout?: () => void;
|
|
25
25
|
/** 收银台已过期时触发 */
|
|
26
26
|
onExpired?: () => void;
|
|
27
|
-
/**
|
|
28
|
-
* @internal
|
|
29
|
-
* 请求支付接口成功后返回跳转链接
|
|
30
|
-
*/
|
|
31
|
-
onSubmitResponse?: (payRes: PayRes) => void;
|
|
32
|
-
/**
|
|
33
|
-
* @internal
|
|
34
|
-
* 跳转模式,钱包支付时需要跳转到第三方页面进行支付,流程结束在返回收银台
|
|
35
|
-
* auto: 自动跳转
|
|
36
|
-
* manual: 需要在 onSubmitResponse 中接收跳转链接并手动跳转
|
|
37
|
-
*/
|
|
38
|
-
redirectMode?: 'auto' | 'manual';
|
|
39
|
-
/**
|
|
40
|
-
* @internal
|
|
41
|
-
* 从第三方支付页面跳转回来时,是否自动查询支付结果
|
|
42
|
-
*/
|
|
43
|
-
autoQuery?: boolean;
|
|
44
|
-
/**
|
|
45
|
-
* @internal
|
|
46
|
-
* 是否展示引导卡片
|
|
47
|
-
*/
|
|
48
|
-
showGuideCard?: boolean;
|
|
49
|
-
/**
|
|
50
|
-
* @internal
|
|
51
|
-
* 是否展示二维码弹窗
|
|
52
|
-
*/
|
|
53
|
-
enableQRCodeModal?: boolean;
|
|
54
|
-
/**
|
|
55
|
-
* @internal
|
|
56
|
-
* 用户关闭支付弹窗时触发
|
|
57
|
-
*/
|
|
58
|
-
onCloseModal?: () => void;
|
|
59
27
|
}
|
|
60
28
|
export interface GCashRef {
|
|
61
29
|
/** 停止轮询支付结果 */
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { PaymayaProps, PaymayaRef } from './type';
|
|
2
|
-
import type { CoreProps } from '../../../types';
|
|
3
2
|
import './paymaya.scss';
|
|
4
|
-
export declare const Paymaya: import("preact").FunctionalComponent<import("preact/compat").PropsWithoutRef<PaymayaProps &
|
|
3
|
+
export declare const Paymaya: import("preact").FunctionalComponent<import("preact/compat").PropsWithoutRef<PaymayaProps & import("../../../types").PayKKaCommonConfig & {
|
|
4
|
+
session: import("../../../core").Session;
|
|
5
|
+
core: import("../../../core").PayKKaCheckout;
|
|
6
|
+
threeDSFrame?: import("../../../types").ThreeDSFrameConfig | undefined;
|
|
7
|
+
isDropIn?: boolean | undefined;
|
|
8
|
+
}> & {
|
|
5
9
|
ref?: import("preact").Ref<PaymayaRef> | undefined;
|
|
6
10
|
}>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PayKKaError } from '../../..';
|
|
2
|
-
import type {
|
|
2
|
+
import type { PayKKaCommonConfig, PaymentInfo } from '../../../types';
|
|
3
3
|
import type { FormValidateError } from '../../internal/Form';
|
|
4
|
-
export interface PaymayaProps {
|
|
4
|
+
export interface PaymayaProps extends PayKKaCommonConfig {
|
|
5
5
|
/**
|
|
6
6
|
* 是否展示邮箱
|
|
7
7
|
* 若配置 true 但创建收银台时已经传了,就展示禁用状态。
|
|
@@ -17,35 +17,13 @@ export interface PaymayaProps {
|
|
|
17
17
|
/** 提交表单时触发 */
|
|
18
18
|
onSubmit?: (formValidateError?: Recordable<FormValidateError[]>) => void;
|
|
19
19
|
/** 支付成功后触发 */
|
|
20
|
-
onSuccess?: (
|
|
20
|
+
onSuccess?: (data: PaymentInfo) => void;
|
|
21
21
|
/** 支付失败时触发 */
|
|
22
22
|
onError?: (error: PayKKaError) => void;
|
|
23
23
|
/** 支付超时时触发 */
|
|
24
24
|
onTimeout?: () => void;
|
|
25
25
|
/** 收银台已过期时触发 */
|
|
26
26
|
onExpired?: () => void;
|
|
27
|
-
/**
|
|
28
|
-
* @internal
|
|
29
|
-
* 请求支付接口成功后返回跳转链接
|
|
30
|
-
*/
|
|
31
|
-
onSubmitResponse?: (payRes: PayRes) => void;
|
|
32
|
-
/**
|
|
33
|
-
* @internal
|
|
34
|
-
* 跳转模式,钱包支付时需要跳转到第三方页面进行支付,流程结束在返回收银台
|
|
35
|
-
* auto: 自动跳转
|
|
36
|
-
* manual: 需要在 onSubmitResponse 中接收跳转链接并手动跳转
|
|
37
|
-
*/
|
|
38
|
-
redirectMode?: 'auto' | 'manual';
|
|
39
|
-
/**
|
|
40
|
-
* @internal
|
|
41
|
-
* 从第三方支付页面跳转回来时,是否自动查询支付结果
|
|
42
|
-
*/
|
|
43
|
-
autoQuery?: boolean;
|
|
44
|
-
/**
|
|
45
|
-
* @internal
|
|
46
|
-
* 是否展示引导卡片
|
|
47
|
-
*/
|
|
48
|
-
showGuideCard?: boolean;
|
|
49
27
|
}
|
|
50
28
|
export interface PaymayaRef {
|
|
51
29
|
/** 停止轮询支付结果 */
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ZalopayProps, ZalopayRef } from './type';
|
|
2
|
+
import './zalopay.scss';
|
|
3
|
+
export declare const Zalopay: import("preact").FunctionalComponent<import("preact/compat").PropsWithoutRef<ZalopayProps & import("../../../types").PayKKaCommonConfig & {
|
|
4
|
+
session: import("../../../core").Session;
|
|
5
|
+
core: import("../../../core").PayKKaCheckout;
|
|
6
|
+
threeDSFrame?: import("../../../types").ThreeDSFrameConfig | undefined;
|
|
7
|
+
isDropIn?: boolean | undefined;
|
|
8
|
+
}> & {
|
|
9
|
+
ref?: import("preact").Ref<ZalopayRef> | undefined;
|
|
10
|
+
}>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { PayKKaError } from '../../..';
|
|
2
|
+
import type { PayKKaCommonConfig, PaymentInfo } from '../../../types';
|
|
3
|
+
import type { FormValidateError } from '../../internal/Form';
|
|
4
|
+
export interface ZalopayProps extends PayKKaCommonConfig {
|
|
5
|
+
/**
|
|
6
|
+
* 是否展示邮箱
|
|
7
|
+
* 若配置 true 但创建收银台时已经传了,就展示禁用状态。
|
|
8
|
+
* 若配置 false 但创建收银台时未传,依旧会展示该输入框。
|
|
9
|
+
*/
|
|
10
|
+
showEmail?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* 是否展示邮箱
|
|
13
|
+
* 若配置 true 但创建收银台时已经传了,还是展示,先不禁用。
|
|
14
|
+
* 若配置 false 但创建收银台时未传,依旧会展示该输入框。
|
|
15
|
+
*/
|
|
16
|
+
showAddress?: boolean;
|
|
17
|
+
/** 提交表单时触发 */
|
|
18
|
+
onSubmit?: (formValidateError?: Recordable<FormValidateError[]>) => void;
|
|
19
|
+
/** 支付成功后触发 */
|
|
20
|
+
onSuccess?: (data: PaymentInfo) => void;
|
|
21
|
+
/** 支付失败时触发 */
|
|
22
|
+
onError?: (error: PayKKaError) => void;
|
|
23
|
+
/** 支付超时时触发 */
|
|
24
|
+
onTimeout?: (type: 'retry' | 'channel') => void;
|
|
25
|
+
/** 收银台已过期时触发 */
|
|
26
|
+
onExpired?: () => void;
|
|
27
|
+
}
|
|
28
|
+
export interface ZalopayRef {
|
|
29
|
+
/** 停止轮询支付结果 */
|
|
30
|
+
stopRetry: () => void;
|
|
31
|
+
/** 开始轮询支付结果 */
|
|
32
|
+
startRetry: (timeout?: number) => void;
|
|
33
|
+
/** 更新表单地址 */
|
|
34
|
+
updateAddress: () => void;
|
|
35
|
+
/** 更新表单邮箱 */
|
|
36
|
+
updateEmail: () => void;
|
|
37
|
+
/** 不展示支付按钮时,可调用该方法进行支付 */
|
|
38
|
+
payment: () => void;
|
|
39
|
+
}
|
package/dist/types/config.d.ts
CHANGED
|
@@ -7,12 +7,10 @@ export declare let cdnUrl: string;
|
|
|
7
7
|
export declare let fraudDetectionEnv: FraudDetectionEnv | undefined;
|
|
8
8
|
export declare let customReqHeaders: Recordable;
|
|
9
9
|
export declare let customLocale: LocaleKeyType | undefined;
|
|
10
|
-
export declare let
|
|
10
|
+
export declare let apiPrefix: string;
|
|
11
11
|
export declare const setApiUrl: (url: string) => void;
|
|
12
12
|
export declare const setCDNUrl: (url: string) => void;
|
|
13
13
|
export declare const setFraudDetectionEnv: (env: FraudDetectionEnv) => void;
|
|
14
14
|
export declare const setCustomReqHeaders: (headers: Recordable) => void;
|
|
15
15
|
export declare const setCustomLocale: (locale: LocaleKeyType) => void;
|
|
16
|
-
export declare const
|
|
17
|
-
hidePaymentButton?: boolean;
|
|
18
|
-
}) => void;
|
|
16
|
+
export declare const setApiPrefix: (prefix: string) => void;
|
package/dist/types/constant.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export declare enum PaymentMethod {
|
|
|
27
27
|
NINE_PAY = "NINE_PAY",
|
|
28
28
|
GCASH = "G_CASH",
|
|
29
29
|
PAYMAYA = "PAYMAYA",
|
|
30
|
+
ZALOPAY = "ZALOPAY",
|
|
30
31
|
/** 目前没用 */
|
|
31
32
|
SEPA_DEBIT = "SEPA_DEBIT"
|
|
32
33
|
}
|
|
@@ -48,7 +49,8 @@ export declare enum PaymentCategory {
|
|
|
48
49
|
LINE_PAY = "linePay",
|
|
49
50
|
NINE_PAY = "ninePay",
|
|
50
51
|
GCASH = "gcash",
|
|
51
|
-
PAYMAYA = "paymaya"
|
|
52
|
+
PAYMAYA = "paymaya",
|
|
53
|
+
ZALOPAY = "zalopay"
|
|
52
54
|
}
|
|
53
55
|
export declare const PaymentMethod2CategoryMap: Partial<Record<PaymentMethod, PaymentCategory>>;
|
|
54
56
|
export declare const PaymentCategory2MethodMap: Partial<Record<PaymentCategory, PaymentMethod[]>>;
|
|
@@ -4,14 +4,14 @@ interface Option {
|
|
|
4
4
|
label: string;
|
|
5
5
|
value: string;
|
|
6
6
|
}
|
|
7
|
-
interface
|
|
8
|
-
country
|
|
9
|
-
province
|
|
10
|
-
city
|
|
11
|
-
area
|
|
12
|
-
postCode
|
|
13
|
-
address1
|
|
14
|
-
address2
|
|
7
|
+
export interface Address {
|
|
8
|
+
country?: string;
|
|
9
|
+
province?: string;
|
|
10
|
+
city?: string;
|
|
11
|
+
area?: string;
|
|
12
|
+
postCode?: string;
|
|
13
|
+
address1?: string;
|
|
14
|
+
address2?: string;
|
|
15
15
|
}
|
|
16
16
|
export interface AddressFormatItem {
|
|
17
17
|
addressItem: keyof typeof EAddressType;
|
|
@@ -38,20 +38,20 @@ export declare class AddressCore {
|
|
|
38
38
|
getProvinceOption(): Option[];
|
|
39
39
|
requestCityOption(): Promise<void>;
|
|
40
40
|
setCountry(country: string): void;
|
|
41
|
-
getCountry(): string;
|
|
41
|
+
getCountry(): string | undefined;
|
|
42
42
|
setProvince(province: string): void;
|
|
43
|
-
getProvince(): string;
|
|
43
|
+
getProvince(): string | undefined;
|
|
44
44
|
setAddressFormat(addressFormat: AddressFormatItem[]): void;
|
|
45
45
|
getAddressFormat(): AddressFormatItem[];
|
|
46
|
-
getAddress1(): string;
|
|
46
|
+
getAddress1(): string | undefined;
|
|
47
47
|
setAddress1(address1: string): void;
|
|
48
|
-
getAddress2(): string;
|
|
48
|
+
getAddress2(): string | undefined;
|
|
49
49
|
setAddress2(address2: string): void;
|
|
50
|
-
getCity(): string;
|
|
50
|
+
getCity(): string | undefined;
|
|
51
51
|
setCity(city: string): void;
|
|
52
|
-
getArea(): string;
|
|
52
|
+
getArea(): string | undefined;
|
|
53
53
|
setArea(area: string): void;
|
|
54
|
-
getPostCode(): string;
|
|
54
|
+
getPostCode(): string | undefined;
|
|
55
55
|
setPostCode(postCode: string): void;
|
|
56
56
|
setMap(): {
|
|
57
57
|
ADDRESS_1: (value: string) => void;
|
|
@@ -64,20 +64,19 @@ export declare class AddressCore {
|
|
|
64
64
|
};
|
|
65
65
|
setAddressStateByKey(key: keyof typeof EAddressType | 'COUNTRY', value: string): void;
|
|
66
66
|
getAddressState(): {
|
|
67
|
-
country: string;
|
|
68
|
-
province: string;
|
|
69
|
-
city: string;
|
|
70
|
-
area: string;
|
|
71
|
-
postCode: string;
|
|
72
|
-
address1: string;
|
|
73
|
-
address2: string;
|
|
67
|
+
country: string | undefined;
|
|
68
|
+
province: string | undefined;
|
|
69
|
+
city: string | undefined;
|
|
70
|
+
area: string | undefined;
|
|
71
|
+
postCode: string | undefined;
|
|
72
|
+
address1: string | undefined;
|
|
73
|
+
address2: string | undefined;
|
|
74
74
|
};
|
|
75
|
-
setAddressState(value:
|
|
75
|
+
setAddressState(value: Address): void;
|
|
76
76
|
getValidateAllFields(): boolean;
|
|
77
77
|
setValidateAllFields(value: boolean): void;
|
|
78
78
|
getCityOptions(): Option[];
|
|
79
79
|
setCityOptions(options: Option[]): void;
|
|
80
80
|
getLabel(value: string, options: Option[]): string | null;
|
|
81
81
|
}
|
|
82
|
-
export declare const createAddressCore: () => AddressCore;
|
|
83
82
|
export {};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { ComponentType, JSX } from 'preact';
|
|
2
2
|
import type { CoreProps, PayKKaEnvConfig, PayKKaInitConfiguration } from '../types';
|
|
3
3
|
import { type ComponentInst } from './create';
|
|
4
|
-
import { Session } from './
|
|
4
|
+
import { Session } from './session';
|
|
5
5
|
import getFraudDetectionInstance from '../out/fraud-detection';
|
|
6
6
|
import type { PaymentMethod } from '../constant';
|
|
7
|
+
import { AddressCore } from './address';
|
|
8
|
+
import { PayKKaTheme } from './theme';
|
|
7
9
|
export type FraudDetectionType = ReturnType<typeof getFraudDetectionInstance>;
|
|
8
10
|
/**
|
|
9
11
|
* 收银台实例
|
|
@@ -19,7 +21,8 @@ export declare class PayKKaCheckout {
|
|
|
19
21
|
*/
|
|
20
22
|
enablePaymentMethod: import("@preact/signals").Signal<PaymentMethod | null>;
|
|
21
23
|
constructor(config: PayKKaInitConfiguration);
|
|
22
|
-
|
|
24
|
+
init(): Promise<void>;
|
|
25
|
+
private initCheckoutConfig;
|
|
23
26
|
private initSession;
|
|
24
27
|
/**
|
|
25
28
|
* 初始化环境配置
|
|
@@ -27,13 +30,16 @@ export declare class PayKKaCheckout {
|
|
|
27
30
|
*/
|
|
28
31
|
private initEnv;
|
|
29
32
|
private initLocale;
|
|
30
|
-
private
|
|
33
|
+
private initTheme;
|
|
31
34
|
private initOtherData;
|
|
32
35
|
get session(): Session;
|
|
36
|
+
get theme(): PayKKaTheme;
|
|
33
37
|
get envConfig(): PayKKaEnvConfig;
|
|
34
38
|
get config(): PayKKaInitConfiguration;
|
|
39
|
+
get id(): string;
|
|
35
40
|
/** 创建组件,把 session 作为组件的 props 传递 */
|
|
36
41
|
create<P extends Recordable>(component: ComponentType<P> | ((props: P) => JSX.Element), props?: Partial<P> | null): ComponentInst<P>;
|
|
37
42
|
getCoreProps(): CoreProps;
|
|
38
43
|
resetEnablePaymentMethod(): void;
|
|
44
|
+
getAddressCore(): AddressCore;
|
|
39
45
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { I18n } from '../i18n';
|
|
2
|
-
import type { Session } from './
|
|
2
|
+
import type { Session } from './session';
|
|
3
|
+
import type { PayKKaCheckout } from './checkout';
|
|
3
4
|
export declare const CoreContext: import("preact").Context<{
|
|
5
|
+
core?: PayKKaCheckout | null | undefined;
|
|
4
6
|
i18n?: I18n | null | undefined;
|
|
5
7
|
session?: Session | null | undefined;
|
|
6
|
-
threeDSMessageListenerInit?: boolean | undefined;
|
|
7
8
|
} | null>;
|