@alipay/ams-checkout 0.0.1730706734-dev.0 → 0.0.1730878287-dev.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/umd/ams-checkout.min.js +1 -1
- package/esm/config/index.d.ts +2 -2
- package/esm/config/index.js +5 -5
- package/esm/constant/index.d.ts +0 -6
- package/esm/constant/index.js +0 -8
- package/esm/core/bus/interface.d.ts +0 -12
- package/esm/core/bus/interface.js +2 -16
- package/esm/core/component/address.d.ts +2 -2
- package/esm/core/component/appPreloadProcessing.js +0 -2
- package/esm/core/component/ckp/index.d.ts +3 -3
- package/esm/core/component/ckp/index.js +3 -3
- package/esm/core/component/index.d.ts +5 -5
- package/esm/core/component/index.js +16 -20
- package/esm/core/drop-in/index.d.ts +2 -2
- package/esm/core/drop-in/index.js +2 -2
- package/esm/core/instance/index.d.ts +5 -5
- package/esm/core/instance/index.js +10 -11
- package/esm/index.d.ts +10 -16
- package/esm/index.js +59 -70
- package/esm/plugin/applepay/component.js +3 -3
- package/esm/plugin/applepay/service.d.ts +2 -2
- package/esm/plugin/applepay/service.js +2 -2
- package/esm/plugin/component/cashierApp.d.ts +5 -7
- package/esm/plugin/component/cashierApp.js +8 -16
- package/esm/plugin/component/channel.d.ts +4 -4
- package/esm/plugin/component/component.inline.style.d.ts +4 -4
- package/esm/plugin/component/component.inline.style.js +7 -10
- package/esm/plugin/component/component.popup.style.d.ts +6 -15
- package/esm/plugin/component/component.popup.style.js +15 -33
- package/esm/plugin/component/index.d.ts +7 -7
- package/esm/plugin/component/index.js +90 -113
- package/esm/plugin/const.js +5 -5
- package/esm/plugin/drop-in/index.d.ts +5 -5
- package/esm/plugin/drop-in/index.js +7 -7
- package/esm/plugin/payment-element/utils.d.ts +1 -1
- package/esm/plugin/payment-element/utils.js +1 -2
- package/esm/plugin/type.d.ts +4 -4
- package/esm/service/index.d.ts +0 -1
- package/esm/service/index.js +0 -2
- package/esm/types/index.d.ts +38 -240
- package/esm/types/index.js +59 -103
- package/esm/util/createIframeNode.d.ts +2 -2
- package/esm/util/createIframeNode.js +3 -3
- package/esm/util/index.d.ts +1 -1
- package/esm/util/index.js +4 -3
- package/esm/{foundation/service/security → util}/security.d.ts +2 -2
- package/esm/{foundation/service/security → util}/security.js +3 -3
- package/package.json +1 -2
- package/esm/core/bus/ability/globalData.d.ts +0 -10
- package/esm/core/bus/ability/globalData.js +0 -89
- package/esm/core/bus/ability/request.d.ts +0 -10
- package/esm/core/bus/ability/request.js +0 -151
- package/esm/core/component/element/components/address.d.ts +0 -19
- package/esm/core/component/element/components/address.js +0 -68
- package/esm/core/component/element/components/auth.d.ts +0 -17
- package/esm/core/component/element/components/auth.js +0 -59
- package/esm/core/component/element/components/payment.d.ts +0 -19
- package/esm/core/component/element/components/payment.js +0 -74
- package/esm/core/component/element/element-mock.d.ts +0 -2
- package/esm/core/component/element/element-mock.js +0 -263
- package/esm/core/component/element/index.d.ts +0 -47
- package/esm/core/component/element/index.js +0 -776
- package/esm/core/component/element/mock.d.ts +0 -3
- package/esm/core/component/element/mock.js +0 -1156
- package/esm/core/component/element/type.d.ts +0 -176
- package/esm/core/component/element/type.js +0 -34
- package/esm/core/component/element/utils.d.ts +0 -13
- package/esm/core/component/element/utils.js +0 -6
- package/esm/foundation/core/index.d.ts +0 -26
- package/esm/foundation/core/index.js +0 -301
- package/esm/foundation/index.d.ts +0 -72
- package/esm/foundation/index.js +0 -42
- package/esm/foundation/product-processor/easysafepay/deps.d.ts +0 -15
- package/esm/foundation/product-processor/easysafepay/deps.js +0 -9
- package/esm/foundation/product-processor/easysafepay/index.d.ts +0 -26
- package/esm/foundation/product-processor/easysafepay/index.js +0 -536
- package/esm/foundation/service/container/index.d.ts +0 -28
- package/esm/foundation/service/container/index.js +0 -256
- package/esm/foundation/service/container/popup.d.ts +0 -17
- package/esm/foundation/service/container/popup.js +0 -103
- package/esm/foundation/service/container/utils.d.ts +0 -7
- package/esm/foundation/service/container/utils.js +0 -48
- package/esm/foundation/service/event-bus/ability/callback.d.ts +0 -9
- package/esm/foundation/service/event-bus/ability/callback.js +0 -55
- package/esm/foundation/service/event-bus/ability/globalData.d.ts +0 -10
- package/esm/foundation/service/event-bus/ability/globalData.js +0 -89
- package/esm/foundation/service/event-bus/ability/request.d.ts +0 -10
- package/esm/foundation/service/event-bus/ability/request.js +0 -151
- package/esm/foundation/service/event-bus/ability/security.d.ts +0 -12
- package/esm/foundation/service/event-bus/ability/security.js +0 -151
- package/esm/foundation/service/event-bus/ability/tracker.d.ts +0 -9
- package/esm/foundation/service/event-bus/ability/tracker.js +0 -80
- package/esm/foundation/service/event-bus/busManager.d.ts +0 -127
- package/esm/foundation/service/event-bus/busManager.js +0 -398
- package/esm/foundation/service/event-bus/index.d.ts +0 -20
- package/esm/foundation/service/event-bus/index.js +0 -88
- package/esm/foundation/service/event-center.d.ts +0 -75
- package/esm/foundation/service/event-center.js +0 -244
- package/esm/foundation/service/global-data/index.d.ts +0 -11
- package/esm/foundation/service/global-data/index.js +0 -69
- package/esm/foundation/service/index.d.ts +0 -19
- package/esm/foundation/service/index.js +0 -82
- package/esm/foundation/service/log/index.d.ts +0 -43
- package/esm/foundation/service/log/index.js +0 -235
- package/esm/foundation/service/log/types.d.ts +0 -32
- package/esm/foundation/service/log/types.js +0 -1
- package/esm/foundation/service/requester/deps.d.ts +0 -17
- package/esm/foundation/service/requester/deps.js +0 -11
- package/esm/foundation/service/requester/requester.d.ts +0 -22
- package/esm/foundation/service/requester/requester.js +0 -211
- package/esm/foundation/service/security/index.d.ts +0 -26
- package/esm/foundation/service/security/index.js +0 -216
- package/esm/foundation/types/index.d.ts +0 -4
- package/esm/foundation/types/index.js +0 -4
- package/esm/foundation/utils/gray_scale_utils.d.ts +0 -7
- package/esm/foundation/utils/gray_scale_utils.js +0 -40
- package/esm/foundation/utils/payment_context_utils.d.ts +0 -13
- package/esm/foundation/utils/payment_context_utils.js +0 -57
- package/esm/foundation/utils/redirect_utils.d.ts +0 -6
- package/esm/foundation/utils/redirect_utils.js +0 -99
- package/esm/foundation/utils/system_events.d.ts +0 -4
- package/esm/foundation/utils/system_events.js +0 -71
- package/esm/foundation/utils/web_app_url_utils.d.ts +0 -37
- package/esm/foundation/utils/web_app_url_utils.js +0 -97
- package/esm/service/element.d.ts +0 -4
- package/esm/service/element.js +0 -51
package/esm/config/index.d.ts
CHANGED
@@ -10,5 +10,5 @@ export declare const AMSAutoDebitAppVersion = "1.23.0";
|
|
10
10
|
export declare const AMSEasyPayAppVersion = "1.23.0";
|
11
11
|
export declare const AMSCashierPaymentAppVersion = "1.23.0";
|
12
12
|
export declare const AMSVaultingAppVersion = "1.23.0";
|
13
|
-
export declare const AMSPaymentElementAppVersion = "1.23.
|
14
|
-
export declare const ADDRESSElementAppVersion = "1.23.
|
13
|
+
export declare const AMSPaymentElementAppVersion = "1.23.2";
|
14
|
+
export declare const ADDRESSElementAppVersion = "1.23.2";
|
package/esm/config/index.js
CHANGED
@@ -26,9 +26,9 @@ export var elementAppMarmotMap = {
|
|
26
26
|
dev: 'http://page.alipay.net/page/antom-web-checkout-v2',
|
27
27
|
sit: 'http://page.test.alipay.net/page/antom-web-checkout-v2',
|
28
28
|
pre: 'https://pre.ac.alipay.com/page/antom-web-checkout-v2',
|
29
|
-
sandbox: 'https://
|
30
|
-
light_sandbox: 'https://
|
31
|
-
prod: 'https://
|
29
|
+
sandbox: 'https://checkout.antom.com',
|
30
|
+
light_sandbox: 'https://checkout.antom.com',
|
31
|
+
prod: 'https://checkout.antom.com'
|
32
32
|
};
|
33
33
|
export var sdkVersion = json.version;
|
34
34
|
|
@@ -40,5 +40,5 @@ export var AMSAutoDebitAppVersion = '1.23.0'; // 代扣
|
|
40
40
|
export var AMSEasyPayAppVersion = '1.23.0'; // easypay
|
41
41
|
export var AMSCashierPaymentAppVersion = '1.23.0'; // 收银台(卡、apm)
|
42
42
|
export var AMSVaultingAppVersion = '1.23.0'; // 绑卡
|
43
|
-
export var AMSPaymentElementAppVersion = '1.23.
|
44
|
-
export var ADDRESSElementAppVersion = '1.23.
|
43
|
+
export var AMSPaymentElementAppVersion = '1.23.2'; // payment element
|
44
|
+
export var ADDRESSElementAppVersion = '1.23.2'; // address element
|
package/esm/constant/index.d.ts
CHANGED
package/esm/constant/index.js
CHANGED
@@ -155,20 +155,12 @@ export var EVENT = {
|
|
155
155
|
getGlobalData: {
|
156
156
|
name: 'getGlobalData'
|
157
157
|
},
|
158
|
-
// deprecated
|
159
158
|
sendMuitiAppEventToSdk: {
|
160
159
|
name: 'sendMuitiAppEventToSdk'
|
161
160
|
},
|
162
|
-
// deprecated
|
163
161
|
receiveMuitiAppFromSdk: {
|
164
162
|
name: 'receiveMuitiAppFromSdk'
|
165
163
|
},
|
166
|
-
sendBroadcast: {
|
167
|
-
name: 'sendBroadcast'
|
168
|
-
},
|
169
|
-
receiveBroadcast: {
|
170
|
-
name: 'receiveBroadcast'
|
171
|
-
},
|
172
164
|
getUserAgentFromSdk: {
|
173
165
|
name: 'getUserAgentFromSdk'
|
174
166
|
},
|
@@ -13,19 +13,7 @@ export declare enum PaypalActionEnum {
|
|
13
13
|
export declare enum SDKCallbackActionEnum {
|
14
14
|
onEventCallback = "onEventCallback"
|
15
15
|
}
|
16
|
-
export declare enum RequestActiontEnum {
|
17
|
-
request = "request",
|
18
|
-
getEnvInfo = "getEnvInfo",
|
19
|
-
getUserAgent = "getUserAgent"
|
20
|
-
}
|
21
|
-
export declare enum DataActiontEnum {
|
22
|
-
getGlobalData = "getGlobalData",
|
23
|
-
setGlobalData = "setGlobalData",
|
24
|
-
clearGlobalData = "clearGlobalData"
|
25
|
-
}
|
26
16
|
export declare enum SecuritySDKActionEnum {
|
27
|
-
preInitSecurity = "preInitSecurity",
|
28
|
-
initSecurity = "initSecurity",
|
29
17
|
getSecurityDeviceId = "getSecurityDeviceId"
|
30
18
|
}
|
31
19
|
export declare enum TrackerActionEnum {
|
@@ -17,21 +17,7 @@ export var SDKCallbackActionEnum = /*#__PURE__*/function (SDKCallbackActionEnum)
|
|
17
17
|
SDKCallbackActionEnum["onEventCallback"] = "onEventCallback";
|
18
18
|
return SDKCallbackActionEnum;
|
19
19
|
}({});
|
20
|
-
export var RequestActiontEnum = /*#__PURE__*/function (RequestActiontEnum) {
|
21
|
-
RequestActiontEnum["request"] = "request";
|
22
|
-
RequestActiontEnum["getEnvInfo"] = "getEnvInfo";
|
23
|
-
RequestActiontEnum["getUserAgent"] = "getUserAgent";
|
24
|
-
return RequestActiontEnum;
|
25
|
-
}({});
|
26
|
-
export var DataActiontEnum = /*#__PURE__*/function (DataActiontEnum) {
|
27
|
-
DataActiontEnum["getGlobalData"] = "getGlobalData";
|
28
|
-
DataActiontEnum["setGlobalData"] = "setGlobalData";
|
29
|
-
DataActiontEnum["clearGlobalData"] = "clearGlobalData";
|
30
|
-
return DataActiontEnum;
|
31
|
-
}({});
|
32
20
|
export var SecuritySDKActionEnum = /*#__PURE__*/function (SecuritySDKActionEnum) {
|
33
|
-
SecuritySDKActionEnum["preInitSecurity"] = "preInitSecurity";
|
34
|
-
SecuritySDKActionEnum["initSecurity"] = "initSecurity";
|
35
21
|
SecuritySDKActionEnum["getSecurityDeviceId"] = "getSecurityDeviceId";
|
36
22
|
return SecuritySDKActionEnum;
|
37
23
|
}({});
|
@@ -43,10 +29,10 @@ export var ComponentActiontEnum = /*#__PURE__*/function (ComponentActiontEnum) {
|
|
43
29
|
ComponentActiontEnum["onDestory"] = "onDestory";
|
44
30
|
return ComponentActiontEnum;
|
45
31
|
}({});
|
46
|
-
RequestActiontEnum = /*#__PURE__*/function (RequestActiontEnum) {
|
32
|
+
export var RequestActiontEnum = /*#__PURE__*/function (RequestActiontEnum) {
|
47
33
|
RequestActiontEnum["onDestory"] = "httpRequest";
|
48
34
|
return RequestActiontEnum;
|
49
|
-
}(
|
35
|
+
}({});
|
50
36
|
export var LoadingActiontEnum = /*#__PURE__*/function (LoadingActiontEnum) {
|
51
37
|
LoadingActiontEnum["showLoading"] = "showLoading";
|
52
38
|
LoadingActiontEnum["dismissLoading"] = "dismissLoading";
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import {
|
1
|
+
import { IoptionsParams } from '../../types';
|
2
2
|
import { AMSComponent } from './index';
|
3
3
|
export declare class AddressComponent extends AMSComponent {
|
4
|
-
constructor(options:
|
4
|
+
constructor(options: IoptionsParams & {
|
5
5
|
appVersion: string;
|
6
6
|
});
|
7
7
|
getValue(hasValidate?: boolean): Promise<unknown>;
|
@@ -3,8 +3,6 @@ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyri
|
|
3
3
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
4
4
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
5
5
|
import { loadSDKScript } from "../../util";
|
6
|
-
|
7
|
-
// 收银台卡支付
|
8
6
|
export function loadChannelPneumaticControl(_x, _x2) {
|
9
7
|
return _loadChannelPneumaticControl.apply(this, arguments);
|
10
8
|
}
|
@@ -1,16 +1,16 @@
|
|
1
|
-
import { IcreateComponent,
|
1
|
+
import { IcreateComponent, IoptionsParams } from '../../../types';
|
2
2
|
import { Logger } from '../../../util/logger';
|
3
3
|
type LOCAL_URL = string;
|
4
4
|
export type CKPEmbeddedAppEnv = 'dev' | 'sit' | 'pre' | 'prod';
|
5
5
|
export type CKPEmbeddedEventType = 'SDK_PAYMENT_SUCCESSFUL' | 'SDK_PAYMENT_FAIL' | 'SDK_PAYMENT_CANCEL' | 'SDK_PAYMENT_CLICK_BACK_TO_MERCHANT';
|
6
|
-
export declare const getCKPPageAddress: (env:
|
6
|
+
export declare const getCKPPageAddress: (env: IoptionsParams['environment'] | LOCAL_URL) => string;
|
7
7
|
export declare class AMSCheckoutPage {
|
8
8
|
logger: Logger;
|
9
9
|
private _instanceId;
|
10
10
|
private originOptions;
|
11
11
|
private readonly APP_IFRAME_ID;
|
12
12
|
private eventListener?;
|
13
|
-
constructor(options: Pick<
|
13
|
+
constructor(options: Pick<IoptionsParams, 'environment' | 'locale' | 'onEventCallback'>);
|
14
14
|
private generateIframeSrc;
|
15
15
|
private eventListenerWrapper;
|
16
16
|
private addListener;
|
@@ -6,7 +6,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
6
6
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
7
7
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
8
8
|
import { v4 as uuid } from 'uuid';
|
9
|
-
import {
|
9
|
+
import { environmentEnum } from "../../../types";
|
10
10
|
import { queryParse } from "../../../util";
|
11
11
|
import { LogConfig, Logger } from "../../../util/logger";
|
12
12
|
var CKP_PAYMENT_PAGE_HOST = {
|
@@ -87,11 +87,11 @@ export var AMSCheckoutPage = /*#__PURE__*/function () {
|
|
87
87
|
_defineProperty(this, "removeListener", function () {
|
88
88
|
window.removeEventListener('message', _this.eventListenerWrapper);
|
89
89
|
});
|
90
|
-
options.environment = options.environment ||
|
90
|
+
options.environment = options.environment || environmentEnum.prod;
|
91
91
|
this._instanceId = uuid();
|
92
92
|
this.originOptions = options;
|
93
93
|
this.eventListener = options.onEventCallback;
|
94
|
-
this.logger = new Logger(LogConfig, ![
|
94
|
+
this.logger = new Logger(LogConfig, ![environmentEnum.prod, environmentEnum.sandbox].includes(options === null || options === void 0 ? void 0 : options.environment));
|
95
95
|
Logger.setInstance(this.logger);
|
96
96
|
this.logger.setMedta({
|
97
97
|
instanceId: this._instanceId
|
@@ -1,14 +1,14 @@
|
|
1
1
|
import ComponentApp from '../../plugin/component';
|
2
|
-
import {
|
2
|
+
import { componentSignEnum, IcreateComponent, IoptionsParams, IpaymentSessionMetaData, Iselector, Isubmit, PaymentMethodTypeEnum, SubPaymentMethodTypeEnum } from '../../types';
|
3
3
|
import CoreInstance from '../instance/index';
|
4
|
-
export declare const getComponentSign: (params:
|
5
|
-
export declare const parseSessionData: (sessionData: string) => [
|
6
|
-
export type IAMSComponentOptions =
|
4
|
+
export declare const getComponentSign: (params: IpaymentSessionMetaData) => componentSignEnum;
|
5
|
+
export declare const parseSessionData: (sessionData: string) => [IpaymentSessionMetaData, string];
|
6
|
+
export type IAMSComponentOptions = IoptionsParams & {
|
7
7
|
appVersion: string;
|
8
8
|
};
|
9
9
|
export declare class AMSComponent extends CoreInstance {
|
10
10
|
_componentApp: ComponentApp;
|
11
|
-
channelType:
|
11
|
+
channelType: componentSignEnum[];
|
12
12
|
productSceneVersion: string;
|
13
13
|
timer: any;
|
14
14
|
constructor(options: IAMSComponentOptions);
|
@@ -40,10 +40,10 @@ import { ApplePayBusSubscriber } from "../../plugin/applepay";
|
|
40
40
|
import ComponentApp from "../../plugin/component";
|
41
41
|
import { ExtendPlugin } from "../../plugin/const";
|
42
42
|
import { PaypalBusSubscriber } from "../../plugin/paypal";
|
43
|
-
import {
|
43
|
+
import { componentSignEnum, ComponentSignEnumV2, environmentEnum, modeEnum, networkModeEnum, productSceneEnum, renderDisplayTypeEnum } from "../../types";
|
44
44
|
import { getOrSetStorageId, isPC, parseBase64ToString } from "../../util";
|
45
45
|
import { createIframeNode, createPreloadIframeNode } from "../../util/createIframeNode";
|
46
|
-
import { getSecurityConfigStorageKey } from "../../
|
46
|
+
import { getSecurityConfigStorageKey } from "../../util/security";
|
47
47
|
import { BusManager, BusMessage } from "../bus";
|
48
48
|
import { SDKCallbackBusSubscriber } from "../bus/ability/callback";
|
49
49
|
import { SecurityBusSubscriber } from "../bus/ability/security";
|
@@ -59,7 +59,7 @@ export var getComponentSign = function getComponentSign(params) {
|
|
59
59
|
paymentMethodCategoryType = _params$paymentSessio4 === void 0 ? '' : _params$paymentSessio4;
|
60
60
|
if (productScene && paymentMethodCategoryType) return "".concat(productScene, "_").concat(paymentMethodCategoryType);
|
61
61
|
if (productScene) return "".concat(productScene);
|
62
|
-
return
|
62
|
+
return componentSignEnum.NONE;
|
63
63
|
};
|
64
64
|
export var parseSessionData = function parseSessionData(sessionData) {
|
65
65
|
try {
|
@@ -74,7 +74,7 @@ export var parseSessionData = function parseSessionData(sessionData) {
|
|
74
74
|
var resetEasyPaySceneVersion = function resetEasyPaySceneVersion(parseData) {
|
75
75
|
if (isPC() && parseData !== null && parseData !== void 0 && parseData.paymentSessionConfig) {
|
76
76
|
var productScene = parseData.paymentSessionConfig.productScene;
|
77
|
-
if (productScene ===
|
77
|
+
if (productScene === productSceneEnum.EASY_PAY) {
|
78
78
|
var _parseData$paymentMet;
|
79
79
|
// 非TOSS渠道,在PC场景需要改成1.0
|
80
80
|
if ('BANKTRANSFER_QUICKPAY' !== (parseData === null || parseData === void 0 || (_parseData$paymentMet = parseData.paymentMethodInfoView) === null || _parseData$paymentMet === void 0 ? void 0 : _parseData$paymentMet.paymentMethodType)) {
|
@@ -92,26 +92,25 @@ var handleSessionData = function handleSessionData(originSessionData) {
|
|
92
92
|
return [parseData !== null && parseData !== void 0 ? parseData : {}, sessionData];
|
93
93
|
};
|
94
94
|
var handleParams = function handleParams(params, _this) {
|
95
|
-
var _parseData$connectFac;
|
96
95
|
var _params = Object.assign({
|
97
96
|
paymentSessionMetaData: {},
|
98
|
-
renderDisplayType:
|
97
|
+
renderDisplayType: renderDisplayTypeEnum.popup
|
99
98
|
}, params);
|
100
99
|
var _handleSessionData = handleSessionData(_params.sessionData || (_params === null || _params === void 0 ? void 0 : _params.paymentSessionData)),
|
101
100
|
_handleSessionData2 = _slicedToArray(_handleSessionData, 2),
|
102
101
|
parseData = _handleSessionData2[0],
|
103
102
|
sessionData = _handleSessionData2[1];
|
104
103
|
var componentSign = getComponentSign(parseData);
|
105
|
-
if (_toConsumableArray(Object.values(ComponentSignEnumV2)).includes(componentSign) && _params.renderDisplayType ===
|
104
|
+
if (_toConsumableArray(Object.values(ComponentSignEnumV2)).includes(componentSign) && _params.renderDisplayType === renderDisplayTypeEnum.popup) {
|
106
105
|
return Promise.reject({
|
107
106
|
code: ERRORMESSAGE.CREATEPAYMENT_PARAMETER_ERROR.code,
|
108
107
|
message: "unsupported payment method"
|
109
108
|
});
|
110
109
|
}
|
111
|
-
if (_this.options.product ===
|
112
|
-
componentSign =
|
110
|
+
if (_this.options.product === productSceneEnum.ELEMENT_ADDRESS) {
|
111
|
+
componentSign = componentSignEnum.ELEMENT_ADDRESS;
|
113
112
|
}
|
114
|
-
if (componentSign ===
|
113
|
+
if (componentSign === componentSignEnum.NONE) {
|
115
114
|
// eslint-disable-next-line prefer-promise-reject-errors
|
116
115
|
return Promise.reject({
|
117
116
|
code: ERRORMESSAGE.CREATEPAYMENT_PARAMETER_ERROR.code,
|
@@ -125,9 +124,6 @@ var handleParams = function handleParams(params, _this) {
|
|
125
124
|
}
|
126
125
|
_params.sessionData = sessionData;
|
127
126
|
_params.paymentSessionMetaData = parseData;
|
128
|
-
if (parseData.paymentSessionConfig.productScene === "ELEMENT_PAYMENT" && parseData !== null && parseData !== void 0 && (_parseData$connectFac = parseData.connectFactor) !== null && _parseData$connectFac !== void 0 && _parseData$connectFac.enableConnect) {
|
129
|
-
console.log('截断处理payment render数据---------------');
|
130
|
-
}
|
131
127
|
return Promise.resolve({
|
132
128
|
iframeNodesParams: _params,
|
133
129
|
componentSign: componentSign
|
@@ -167,7 +163,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
167
163
|
selector: selector,
|
168
164
|
renderDisplayType: renderDisplayType
|
169
165
|
}, params);
|
170
|
-
if (this.options.product !==
|
166
|
+
if (this.options.product !== productSceneEnum.ELEMENT_ADDRESS && _params && !_params.sessionData && !(_params !== null && _params !== void 0 && _params.paymentSessionData)) {
|
171
167
|
return Promise.reject(ERRORMESSAGE.CREATEPAYMENT_PARAMETER_ERROR);
|
172
168
|
}
|
173
169
|
if (this.options.networkMode === networkModeEnum.proxy) {
|
@@ -205,7 +201,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
205
201
|
return _pluginAppendIframe.apply(this, arguments);
|
206
202
|
}
|
207
203
|
return pluginAppendIframe;
|
208
|
-
}()
|
204
|
+
}()
|
209
205
|
}, {
|
210
206
|
key: "savePreviousChannel",
|
211
207
|
value: function savePreviousChannel(iframeNodesParams) {
|
@@ -239,7 +235,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
239
235
|
});
|
240
236
|
}
|
241
237
|
var previousChannel = {
|
242
|
-
channelType: channelType ===
|
238
|
+
channelType: channelType === componentSignEnum.VAULTING_CARD ? componentSignEnum.CASHIER_PAYMENT_CARD : channelType,
|
243
239
|
productSceneVersion: productSceneVersion
|
244
240
|
};
|
245
241
|
localStorage.setItem('antom_checkout_previousChannel', JSON.stringify(previousChannel));
|
@@ -253,7 +249,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
253
249
|
value: function registerBusAbility() {
|
254
250
|
var _this$originOptions,
|
255
251
|
_this3 = this;
|
256
|
-
BusManager.debugTrace(((_this$originOptions = this.originOptions) === null || _this$originOptions === void 0 ? void 0 : _this$originOptions.environment) !==
|
252
|
+
BusManager.debugTrace(((_this$originOptions = this.originOptions) === null || _this$originOptions === void 0 ? void 0 : _this$originOptions.environment) !== environmentEnum.prod, this.logger);
|
257
253
|
BusManager.clear();
|
258
254
|
BusManager.addInterceptor({
|
259
255
|
onPublishException: function onPublishException(message, e) {
|
@@ -357,7 +353,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
357
353
|
this.logger.setComponentStartTime(Date.now());
|
358
354
|
return this.parameterInitAndCheck({
|
359
355
|
params: params,
|
360
|
-
renderDisplayType:
|
356
|
+
renderDisplayType: renderDisplayTypeEnum.popup
|
361
357
|
}).then(function (_params) {
|
362
358
|
return handleParams(_params, _this5);
|
363
359
|
}).catch(function (error) {
|
@@ -448,7 +444,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
448
444
|
this.logger.setComponentStartTime(Date.now());
|
449
445
|
return this.parameterInitAndCheck({
|
450
446
|
params: params,
|
451
|
-
renderDisplayType:
|
447
|
+
renderDisplayType: renderDisplayTypeEnum.inline,
|
452
448
|
selector: selector
|
453
449
|
}).then(function (_params) {
|
454
450
|
return handleParams(_params, _this7);
|
@@ -481,7 +477,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
481
477
|
return Promise.resolve();
|
482
478
|
}
|
483
479
|
var iframeNodesParams = appendParams.iframeNodesParams;
|
484
|
-
if (this.options.product !==
|
480
|
+
if (this.options.product !== productSceneEnum.ELEMENT_ADDRESS) {
|
485
481
|
this.savePreviousChannel(iframeNodesParams);
|
486
482
|
}
|
487
483
|
return this.pluginAppendIframe(appendParams);
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { IcreatePaymentParams,
|
2
|
-
export declare const mixinDropInConstructor: (options:
|
1
|
+
import { IcreatePaymentParams, IoptionsParams } from '../../types';
|
2
|
+
export declare const mixinDropInConstructor: (options: IoptionsParams, context: any) => void;
|
3
3
|
/**
|
4
4
|
* @description Create checkout application
|
5
5
|
* @description drop-in
|
@@ -11,7 +11,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
11
11
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
12
12
|
import { BASEPLUGINID, ERRORMESSAGE, EVENT } from "../../constant";
|
13
13
|
import CheckoutApp from "../../plugin/drop-in";
|
14
|
-
import {
|
14
|
+
import { messageName, networkModeEnum } from "../../types";
|
15
15
|
import { createIframeNode } from "../../util/createIframeNode";
|
16
16
|
export var mixinDropInConstructor = function mixinDropInConstructor(options, context) {
|
17
17
|
// Instantiate the plug-in and set render
|
@@ -57,7 +57,7 @@ export var confirmPayment = function confirmPayment(result) {
|
|
57
57
|
});
|
58
58
|
});
|
59
59
|
_this2.eventCenter.emit("".concat(BASEPLUGINID, "-handleRequestPayment"), {
|
60
|
-
name:
|
60
|
+
name: messageName.SDK_TO_APP,
|
61
61
|
mode: _this2.options.mode,
|
62
62
|
appId: BASEPLUGINID,
|
63
63
|
instanceId: _this2._instanceId,
|
@@ -5,15 +5,15 @@
|
|
5
5
|
* 1. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE; and
|
6
6
|
* 2. If applicable, the use of the Software is also subject to the terms and conditions of any non-disclosure agreement signed by you and the relevant Ant Group entity.
|
7
7
|
*/
|
8
|
-
import { ComponentActionNamesType } from
|
8
|
+
import { ComponentActionNamesType } from 'src/plugin/type';
|
9
9
|
import ComponentApp from '../../plugin/component';
|
10
|
-
import type { AMSCheckoutOptions, IAppendParams, InitSecurityConfig,
|
10
|
+
import type { AMSCheckoutOptions, IAppendParams, InitSecurityConfig, IoptionsParams } from '../../types/index';
|
11
11
|
import { EventCenter } from '../../util/index';
|
12
12
|
import { Logger } from '../../util/logger';
|
13
|
-
import { Security } from '../../
|
13
|
+
import { Security } from '../../util/security';
|
14
14
|
export default class AMSSDK {
|
15
15
|
options: AMSCheckoutOptions;
|
16
|
-
originOptions:
|
16
|
+
originOptions: IoptionsParams;
|
17
17
|
logger: Logger;
|
18
18
|
_eventCenter: EventCenter;
|
19
19
|
_instanceId: string;
|
@@ -22,7 +22,7 @@ export default class AMSSDK {
|
|
22
22
|
_componentApp: ComponentApp;
|
23
23
|
protected securitySdkMap: Map<string, Security>;
|
24
24
|
protected plugins: Map<string, any>;
|
25
|
-
constructor(options:
|
25
|
+
constructor(options: IoptionsParams);
|
26
26
|
private preInitSecurity;
|
27
27
|
/**
|
28
28
|
* @description Destroy and process some contents of the plug-in
|
@@ -24,11 +24,11 @@ import { v4 as uuid } from 'uuid';
|
|
24
24
|
import { sdkVersion } from "../../config/index";
|
25
25
|
import { ERRORMESSAGE, EVENT } from "../../constant";
|
26
26
|
import { antomConfig } from "../../service";
|
27
|
-
import {
|
27
|
+
import { environmentEnum, modeEnum, networkModeEnum, osTypeEnum, productSceneEnum, terminalTypeEnum } from "../../types/index";
|
28
28
|
import { checkTimeElapsed, device, EventCenter, getOrSetStorageId, getType, queryParse, safeJson } from "../../util/index";
|
29
29
|
import CallApp from "../../util/intl-callapp/es/main";
|
30
30
|
import { LogConfig, Logger } from "../../util/logger";
|
31
|
-
import { getSecurityConfigStorageKey, getSecurityHost, getSecurityScene, Security, SecurityRegionEnum } from "../../
|
31
|
+
import { getSecurityConfigStorageKey, getSecurityHost, getSecurityScene, Security, SecurityRegionEnum } from "../../util/security";
|
32
32
|
import { compareVersion } from "../../util/versionCompare";
|
33
33
|
import { BusManager, BusMessage } from "../bus";
|
34
34
|
var AMSSDK = /*#__PURE__*/function () {
|
@@ -61,8 +61,7 @@ var AMSSDK = /*#__PURE__*/function () {
|
|
61
61
|
this._storageId = _storageId;
|
62
62
|
|
63
63
|
// TODO Consumption data analysis control parameters
|
64
|
-
|
65
|
-
this.logger = new Logger(LogConfig, ![EnvironmentEnum.prod, EnvironmentEnum.sandbox].includes(options === null || options === void 0 ? void 0 : options.environment));
|
64
|
+
this.logger = new Logger(LogConfig, ![environmentEnum.prod, environmentEnum.sandbox].includes(options === null || options === void 0 ? void 0 : options.environment));
|
66
65
|
Logger.setInstance(this.logger);
|
67
66
|
this.logger.setMedta({
|
68
67
|
instanceId: this._instanceId
|
@@ -82,7 +81,7 @@ var AMSSDK = /*#__PURE__*/function () {
|
|
82
81
|
var _this$options;
|
83
82
|
var antomSDKConfigKey = 'antomSDKConfigKey';
|
84
83
|
var config = safeJson(getOrSetStorageId(antomSDKConfigKey), {});
|
85
|
-
if (![
|
84
|
+
if (![environmentEnum.prod, environmentEnum.sandbox].includes(options === null || options === void 0 ? void 0 : options.environment)) return;
|
86
85
|
if (checkTimeElapsed()) {
|
87
86
|
antomConfig({
|
88
87
|
env: this.options.env.environment
|
@@ -90,7 +89,7 @@ var AMSSDK = /*#__PURE__*/function () {
|
|
90
89
|
getOrSetStorageId(antomSDKConfigKey, JSON.stringify(res));
|
91
90
|
});
|
92
91
|
}
|
93
|
-
var product = ((_this$options = this.options) === null || _this$options === void 0 ? void 0 : _this$options.product) ||
|
92
|
+
var product = ((_this$options = this.options) === null || _this$options === void 0 ? void 0 : _this$options.product) || productSceneEnum.EASY_PAY;
|
94
93
|
var enable = true;
|
95
94
|
try {
|
96
95
|
var matchingConfig = config['pl_sec'].find(function (item) {
|
@@ -158,9 +157,9 @@ var AMSSDK = /*#__PURE__*/function () {
|
|
158
157
|
value: function initSecurity(_ref) {
|
159
158
|
var _this = this;
|
160
159
|
var _ref$product = _ref.product,
|
161
|
-
product = _ref$product === void 0 ?
|
160
|
+
product = _ref$product === void 0 ? productSceneEnum.EASY_PAY : _ref$product,
|
162
161
|
_ref$scene = _ref.scene,
|
163
|
-
scene = _ref$scene === void 0 ?
|
162
|
+
scene = _ref$scene === void 0 ? productSceneEnum.EASY_PAY : _ref$scene;
|
164
163
|
this.logger.logInfo({
|
165
164
|
title: 'sdk_event_securitySdkPreInit'
|
166
165
|
}, {
|
@@ -259,7 +258,7 @@ var AMSSDK = /*#__PURE__*/function () {
|
|
259
258
|
value: function _setEnv(options) {
|
260
259
|
var _queryParse = queryParse(),
|
261
260
|
_moreEnv = _queryParse._moreEnv;
|
262
|
-
if (options !== null && options !== void 0 && options.environment && !((options === null || options === void 0 ? void 0 : options.environment) in
|
261
|
+
if (options !== null && options !== void 0 && options.environment && !((options === null || options === void 0 ? void 0 : options.environment) in environmentEnum) && _moreEnv !== 'true') {
|
263
262
|
console.warn(ERRORMESSAGE.INIT_PARAMETER_ERROR.ENVIRONMENT_ERROR.message);
|
264
263
|
options.environment = 'prod';
|
265
264
|
}
|
@@ -489,8 +488,8 @@ var AMSSDK = /*#__PURE__*/function () {
|
|
489
488
|
}
|
490
489
|
actionNames = this._getPlugin(pluginKey);
|
491
490
|
}
|
492
|
-
if (this.options.product ===
|
493
|
-
actionNames = this._getPlugin(
|
491
|
+
if (this.options.product === productSceneEnum.ELEMENT_ADDRESS) {
|
492
|
+
actionNames = this._getPlugin(productSceneEnum.ELEMENT_ADDRESS);
|
494
493
|
}
|
495
494
|
return actionNames;
|
496
495
|
}
|
package/esm/index.d.ts
CHANGED
@@ -1,36 +1,30 @@
|
|
1
|
-
import { AddressComponent } from './core/component/address';
|
2
|
-
import { ElementComponent } from './core/component/element';
|
3
1
|
import { AMSComponent } from './core/component/index';
|
4
|
-
import {
|
2
|
+
import { AddressComponent } from './core/component/address';
|
3
|
+
import { IoptionsParams, componentSignEnum, IoptionsAddressParams } from './types';
|
5
4
|
export { AMSCheckoutPage } from './core/component/ckp';
|
6
5
|
export * from './types';
|
7
6
|
export declare class AMSCheckout extends AMSComponent {
|
8
|
-
constructor(_options:
|
7
|
+
constructor(_options: IoptionsParams, channelType?: componentSignEnum[], productSceneVersion?: string);
|
9
8
|
}
|
10
9
|
export declare class AMSAutoDebit extends AMSCheckout {
|
11
|
-
constructor(options:
|
10
|
+
constructor(options: IoptionsParams);
|
12
11
|
}
|
13
12
|
export declare class AMSAutoDebitPay extends AMSCheckout {
|
14
|
-
constructor(options:
|
13
|
+
constructor(options: IoptionsParams);
|
15
14
|
}
|
16
|
-
export declare class AMSEasyPay {
|
17
|
-
|
18
|
-
constructor(options: IOptionsParams);
|
19
|
-
createComponent(params: IcreateComponent): void;
|
15
|
+
export declare class AMSEasyPay extends AMSCheckout {
|
16
|
+
constructor(options: IoptionsParams);
|
20
17
|
}
|
21
18
|
export declare class AMSCashierPayment extends AMSCheckout {
|
22
|
-
constructor(options:
|
19
|
+
constructor(options: IoptionsParams);
|
23
20
|
}
|
24
21
|
export declare class AMSVaulting extends AMSCheckout {
|
25
|
-
constructor(options:
|
22
|
+
constructor(options: IoptionsParams);
|
26
23
|
}
|
27
24
|
export declare class AntomElement extends AMSCheckout {
|
28
|
-
constructor(options:
|
25
|
+
constructor(options: IoptionsParams);
|
29
26
|
}
|
30
27
|
export declare class AddressElement extends AddressComponent {
|
31
28
|
constructor(options: IoptionsAddressParams);
|
32
29
|
}
|
33
|
-
export declare class Element extends ElementComponent {
|
34
|
-
constructor(options: IElementOptions);
|
35
|
-
}
|
36
30
|
export default AMSCheckout;
|