@alipay/ams-checkout 1.6.0 → 1.6.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/umd/ams-checkout.min.js +1 -1
- package/esm/config/index.d.ts +1 -0
- package/esm/config/index.js +8 -0
- package/esm/constant/index.d.ts +3 -0
- package/esm/constant/index.js +3 -0
- package/esm/core/component/index.d.ts +3 -1
- package/esm/core/component/index.js +10 -3
- package/esm/core/instance/index.d.ts +23 -10
- package/esm/core/instance/index.js +136 -57
- package/esm/index.d.ts +9 -7
- package/esm/index.js +41 -1
- package/esm/plugin/component/cashierApp.js +2 -1
- package/esm/plugin/component/index.d.ts +5 -1
- package/esm/plugin/component/index.js +275 -126
- package/esm/request/index.d.ts +2 -2
- package/esm/request/index.js +7 -10
- package/esm/request/utils.js +1 -4
- package/esm/service/index.d.ts +4 -9
- package/esm/service/index.js +61 -2
- package/esm/types/index.d.ts +80 -12
- package/esm/types/index.js +7 -5
- package/esm/util/index.d.ts +6 -21
- package/esm/util/index.js +43 -45
- package/esm/util/security.d.ts +24 -8
- package/esm/util/security.js +165 -112
- package/esm/util/versionCompare.d.ts +10 -0
- package/esm/util/versionCompare.js +50 -0
- package/package.json +1 -1
package/esm/config/index.d.ts
CHANGED
package/esm/config/index.js
CHANGED
@@ -14,4 +14,12 @@ export var marmotMap = {
|
|
14
14
|
light_sandbox: 'https://cdn.marmot-cloud.com/page/antom-web-checkout/src/component-app',
|
15
15
|
prod: 'https://cdn.marmot-cloud.com/page/antom-web-checkout/src/component-app'
|
16
16
|
};
|
17
|
+
export var marmotConfigMap = {
|
18
|
+
dev: 'https://config-dev.marmot-cloud.com/config/data/antom-sdk-config/en_US.json',
|
19
|
+
sit: 'https://config-test.marmot-cloud.com/config/data/antom-sdk-config/en_US.json',
|
20
|
+
pre: 'https://config-pre.marmot-cloud.com/config/data/antom-sdk-config/en_US.json',
|
21
|
+
sandbox: 'https://config.marmot-cloud.com/config/data/antom-sdk-config/en_US.json',
|
22
|
+
light_sandbox: 'https://config.marmot-cloud.com/config/data/antom-sdk-config/en_US.json',
|
23
|
+
prod: 'https://config.marmot-cloud.com/config/data/antom-sdk-config/en_US.json'
|
24
|
+
};
|
17
25
|
export var sdkVersion = json.version;
|
package/esm/constant/index.d.ts
CHANGED
@@ -152,6 +152,9 @@ export declare const EVENT: {
|
|
152
152
|
getDeviceId: {
|
153
153
|
name: string;
|
154
154
|
};
|
155
|
+
declareEventCallbackInfo: {
|
156
|
+
name: string;
|
157
|
+
};
|
155
158
|
};
|
156
159
|
export declare const COMPONENT_CONTAINER_ID = "ams-component-container";
|
157
160
|
export declare const COMPONENT_SECTION_ID = "ams-component-section";
|
package/esm/constant/index.js
CHANGED
@@ -13,12 +13,14 @@ export declare class AMSComponent extends CoreInstance {
|
|
13
13
|
createComponent(params: IcreateComponent): Promise<void>;
|
14
14
|
/**
|
15
15
|
* @description Create and render components in the specified element area
|
16
|
-
* @param params - The data source created by the component, necessary sessionData,
|
16
|
+
* @param params - The data source created by the component, necessary sessionData, optional appearance configurations, and refer to the documentation for other parameters and detailed information.
|
17
|
+
* @param selector - Necessary element selector ID
|
17
18
|
*/
|
18
19
|
mountComponent(params: IcreateComponent, selector: Iselector): Promise<void>;
|
19
20
|
/**
|
20
21
|
* @description Execute payment submission process
|
21
22
|
* @description - When using your own payment button, you can execute the submit payment process by actively calling this function.
|
23
|
+
* @param data - Transfer information in the submission interface according to your requirements (optional)
|
22
24
|
*/
|
23
25
|
submit(data?: Isubmit): Promise<unknown>;
|
24
26
|
}
|
@@ -29,8 +29,9 @@ import { v4 as uuid } from 'uuid';
|
|
29
29
|
import { COMPONENTPLUGINID, ERRORMESSAGE, EVENT } from "../../constant";
|
30
30
|
import ComponentApp from "../../plugin/component";
|
31
31
|
import { componentSignEnum, modeEnum, networkModeEnum, productSceneEnum, renderDisplayTypeEnum } from "../../types";
|
32
|
-
import { isPC } from "../../util";
|
32
|
+
import { getOrSetStorageId, isPC } from "../../util";
|
33
33
|
import { createIframeNode } from "../../util/createIframeNode";
|
34
|
+
import { getSecurityConfigStorageKey } from "../../util/security";
|
34
35
|
import CoreInstance from "../instance/index";
|
35
36
|
var getComponentSign = function getComponentSign(params) {
|
36
37
|
var _params$paymentSessio = params.paymentSessionConfig,
|
@@ -84,6 +85,11 @@ var handleParams = function handleParams(params) {
|
|
84
85
|
message: "Abnormal response data, interface failure, or unsupported payment method"
|
85
86
|
});
|
86
87
|
}
|
88
|
+
if (parseData && parseData !== null && parseData !== void 0 && parseData.securityConfig) {
|
89
|
+
var _parseData$paymentSes;
|
90
|
+
var product = parseData === null || parseData === void 0 || (_parseData$paymentSes = parseData.paymentSessionConfig) === null || _parseData$paymentSes === void 0 ? void 0 : _parseData$paymentSes.productScene;
|
91
|
+
getOrSetStorageId(getSecurityConfigStorageKey(product), JSON.stringify(parseData === null || parseData === void 0 ? void 0 : parseData.securityConfig));
|
92
|
+
}
|
87
93
|
_params.sessionData = sessionData;
|
88
94
|
_params.paymentSessionMetaData = parseData;
|
89
95
|
return Promise.resolve({
|
@@ -140,7 +146,6 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
140
146
|
return Promise.reject(error);
|
141
147
|
}
|
142
148
|
}
|
143
|
-
|
144
149
|
/**
|
145
150
|
* @description Create component application
|
146
151
|
* @param params - The data source created by the component, necessary sessionData, optional appearance configuration, and refer to the documentation for other parameters and detailed information.
|
@@ -163,7 +168,8 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
163
168
|
}
|
164
169
|
/**
|
165
170
|
* @description Create and render components in the specified element area
|
166
|
-
* @param params - The data source created by the component, necessary sessionData,
|
171
|
+
* @param params - The data source created by the component, necessary sessionData, optional appearance configurations, and refer to the documentation for other parameters and detailed information.
|
172
|
+
* @param selector - Necessary element selector ID
|
167
173
|
*/
|
168
174
|
}, {
|
169
175
|
key: "mountComponent",
|
@@ -185,6 +191,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
185
191
|
/**
|
186
192
|
* @description Execute payment submission process
|
187
193
|
* @description - When using your own payment button, you can execute the submit payment process by actively calling this function.
|
194
|
+
* @param data - Transfer information in the submission interface according to your requirements (optional)
|
188
195
|
*/
|
189
196
|
}, {
|
190
197
|
key: "submit",
|
@@ -1,28 +1,41 @@
|
|
1
|
-
import {
|
2
|
-
import type { AMSCheckoutOptions, IcheckoutState, IoptionsParams, IsecurityConfig } from '../../types/index';
|
1
|
+
import type { AMSCheckoutOptions, InitSecurityConfig, IoptionsParams } from '../../types/index';
|
3
2
|
import { EventCenter } from '../../util/index';
|
3
|
+
import { Logger } from '../../util/logger';
|
4
|
+
import { Security } from '../../util/security';
|
4
5
|
export default class AMSSDK {
|
5
6
|
options: AMSCheckoutOptions;
|
6
|
-
|
7
|
-
securityConfig: IsecurityConfig;
|
7
|
+
logger: Logger;
|
8
8
|
_eventCenter: EventCenter;
|
9
|
-
protected plugins: Map<string, any>;
|
10
9
|
_instanceId: string;
|
11
10
|
_storageId: string;
|
12
|
-
|
11
|
+
protected securitySdkMap: Map<string, Security>;
|
12
|
+
protected plugins: Map<string, any>;
|
13
13
|
constructor(options: IoptionsParams);
|
14
|
+
private preInitSecurity;
|
14
15
|
/**
|
15
16
|
* @description Destroy and process some contents of the plug-in
|
16
17
|
*/
|
17
18
|
unmount(): void;
|
18
19
|
/**
|
19
|
-
* @description
|
20
|
+
* @description init security SDK
|
21
|
+
* @param product Product Scenarios
|
22
|
+
* @param scene Scenario of the product (compatible with old version parameters, about to be deleted)
|
23
|
+
*/
|
24
|
+
initSecurity({ product, scene, }: InitSecurityConfig & {
|
25
|
+
scene?: string;
|
26
|
+
}): void;
|
27
|
+
/**
|
28
|
+
* @description Obtain security SDK through scenario identification
|
29
|
+
*/
|
30
|
+
_getSecuritySDKByProductScene(securityConfig: InitSecurityConfig): Security;
|
31
|
+
/**
|
32
|
+
* @description New security SDK through scenario identification
|
20
33
|
*/
|
21
|
-
|
34
|
+
_newSecuritySDKByScene(securityConfig: InitSecurityConfig, successCallback?: () => void, failCallback?: (errMsg?: string) => void): Security;
|
22
35
|
/**
|
23
|
-
* @description
|
36
|
+
* @description Obtain risk control configuration in local storage
|
24
37
|
*/
|
25
|
-
|
38
|
+
private getSecurityConfigStorage;
|
26
39
|
/**
|
27
40
|
* @description Set the sdk basic configuration
|
28
41
|
*/
|
@@ -17,33 +17,39 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
17
17
|
*/
|
18
18
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
19
19
|
import { v4 as uuid } from 'uuid';
|
20
|
-
import {
|
20
|
+
import { sdkVersion } from "../../config/index";
|
21
21
|
import { ERRORMESSAGE, EVENT } from "../../constant";
|
22
|
-
import {
|
23
|
-
import {
|
22
|
+
import { antomConfig } from "../../service";
|
23
|
+
import { environmentEnum, modeEnum, networkModeEnum, osTypeEnum, productSceneEnum, terminalTypeEnum } from "../../types/index";
|
24
|
+
import { checkTimeElapsed, device, EventCenter, getOrSetStorageId, getType, queryParse, safeJson } from "../../util/index";
|
24
25
|
import CallApp from "../../util/intl-callapp/es/main";
|
25
|
-
import {
|
26
|
-
|
27
|
-
|
26
|
+
import { LogConfig, Logger } from "../../util/logger";
|
27
|
+
import { compareVersion } from "../../util/versionCompare";
|
28
|
+
import { getSecurityConfigStorageKey, getSecurityHost, getSecurityScene, Security, SecurityRegionEnum } from "../../util/security";
|
28
29
|
var AMSSDK = /*#__PURE__*/function () {
|
29
30
|
function AMSSDK(options) {
|
30
31
|
_classCallCheck(this, AMSSDK);
|
31
32
|
_defineProperty(this, "options", void 0);
|
32
|
-
_defineProperty(this, "
|
33
|
-
_defineProperty(this, "securityConfig", void 0);
|
33
|
+
_defineProperty(this, "logger", void 0);
|
34
34
|
_defineProperty(this, "_eventCenter", void 0);
|
35
|
-
_defineProperty(this, "plugins", void 0);
|
36
35
|
_defineProperty(this, "_instanceId", void 0);
|
37
36
|
_defineProperty(this, "_storageId", void 0);
|
38
|
-
_defineProperty(this, "
|
37
|
+
_defineProperty(this, "securitySdkMap", void 0);
|
38
|
+
_defineProperty(this, "plugins", void 0);
|
39
39
|
this._instanceId = uuid();
|
40
|
-
this._storageId = this.getStorageId(this._instanceId);
|
41
40
|
this.options = {};
|
42
41
|
this._eventCenter = new EventCenter();
|
43
42
|
this._initEvent(options);
|
44
43
|
this._setOptions(options);
|
45
44
|
this.plugins = new Map();
|
46
|
-
this.
|
45
|
+
this.securitySdkMap = new Map();
|
46
|
+
var storageIdKey = 'AMSSDK_STORAGE_ID';
|
47
|
+
var _storageId = getOrSetStorageId(storageIdKey);
|
48
|
+
if (!_storageId) {
|
49
|
+
getOrSetStorageId(storageIdKey, this._instanceId);
|
50
|
+
_storageId = this._instanceId;
|
51
|
+
}
|
52
|
+
this._storageId = _storageId;
|
47
53
|
|
48
54
|
// TODO Consumption data analysis control parameters
|
49
55
|
this.logger = new Logger(LogConfig, (options === null || options === void 0 ? void 0 : options.environment) !== environmentEnum.prod);
|
@@ -55,14 +61,44 @@ var AMSSDK = /*#__PURE__*/function () {
|
|
55
61
|
title: 'NEW_AMSSDK_BY_MECHANT',
|
56
62
|
msg: "".concat(options === null || options === void 0 ? void 0 : options.environment, "_").concat(options === null || options === void 0 ? void 0 : options.locale, "}")
|
57
63
|
}).send();
|
58
|
-
|
59
|
-
this.initSecurity(options === null || options === void 0 ? void 0 : options.securityConfig);
|
60
|
-
}
|
64
|
+
this.preInitSecurity();
|
61
65
|
}
|
62
|
-
/**
|
63
|
-
* @description Destroy and process some contents of the plug-in
|
64
|
-
*/
|
65
66
|
_createClass(AMSSDK, [{
|
67
|
+
key: "preInitSecurity",
|
68
|
+
value: function preInitSecurity() {
|
69
|
+
var _this$options;
|
70
|
+
var antomSDKConfigKey = 'antomSDKConfigKey';
|
71
|
+
var config = safeJson(getOrSetStorageId(antomSDKConfigKey), {});
|
72
|
+
if (checkTimeElapsed()) {
|
73
|
+
antomConfig({
|
74
|
+
env: this.options.env.environment
|
75
|
+
}, this.logger).then(function (res) {
|
76
|
+
getOrSetStorageId(antomSDKConfigKey, JSON.stringify(res));
|
77
|
+
});
|
78
|
+
}
|
79
|
+
var product = ((_this$options = this.options) === null || _this$options === void 0 ? void 0 : _this$options.product) || productSceneEnum.EASY_PAY;
|
80
|
+
var enable = true;
|
81
|
+
try {
|
82
|
+
var matchingConfig = config['pl_sec'].find(function (item) {
|
83
|
+
var _item$v, _item$v2, _item$platform;
|
84
|
+
var minVersion = item === null || item === void 0 || (_item$v = item.v) === null || _item$v === void 0 ? void 0 : _item$v.split('|')[0];
|
85
|
+
var maxVersion = (item === null || item === void 0 || (_item$v2 = item.v) === null || _item$v2 === void 0 ? void 0 : _item$v2.split('|')[1]) || '999.9.9';
|
86
|
+
var matchVersion = compareVersion(sdkVersion, minVersion) >= 0 && compareVersion(maxVersion, sdkVersion) >= 0;
|
87
|
+
return ((item === null || item === void 0 || (_item$platform = item.platform) === null || _item$platform === void 0 ? void 0 : _item$platform.includes('Web')) || (item === null || item === void 0 ? void 0 : item.platform) === '') && (item === null || item === void 0 ? void 0 : item.product) === product && (!(item !== null && item !== void 0 && item.v) || matchVersion);
|
88
|
+
});
|
89
|
+
enable = (matchingConfig === null || matchingConfig === void 0 ? void 0 : matchingConfig.enable) === false ? false : true;
|
90
|
+
} catch (error) {
|
91
|
+
/* empty */
|
92
|
+
}
|
93
|
+
if (!enable) return;
|
94
|
+
this.initSecurity({
|
95
|
+
product: product
|
96
|
+
});
|
97
|
+
}
|
98
|
+
/**
|
99
|
+
* @description Destroy and process some contents of the plug-in
|
100
|
+
*/
|
101
|
+
}, {
|
66
102
|
key: "unmount",
|
67
103
|
value: function unmount() {
|
68
104
|
this.logger.logInfo({
|
@@ -86,56 +122,98 @@ var AMSSDK = /*#__PURE__*/function () {
|
|
86
122
|
_iterator.f();
|
87
123
|
}
|
88
124
|
}
|
89
|
-
|
90
125
|
/**
|
91
|
-
* @description
|
126
|
+
* @description init security SDK
|
127
|
+
* @param product Product Scenarios
|
128
|
+
* @param scene Scenario of the product (compatible with old version parameters, about to be deleted)
|
92
129
|
*/
|
93
130
|
}, {
|
94
|
-
key: "
|
95
|
-
value: function
|
96
|
-
var
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
131
|
+
key: "initSecurity",
|
132
|
+
value: function initSecurity(_ref) {
|
133
|
+
var _this = this;
|
134
|
+
var _ref$product = _ref.product,
|
135
|
+
product = _ref$product === void 0 ? productSceneEnum.EASY_PAY : _ref$product,
|
136
|
+
_ref$scene = _ref.scene,
|
137
|
+
scene = _ref$scene === void 0 ? productSceneEnum.EASY_PAY : _ref$scene;
|
138
|
+
this.logger.logInfo({
|
139
|
+
title: 'sdk_event_securitySdkPreInit'
|
140
|
+
}, {
|
141
|
+
product: product
|
142
|
+
}).send();
|
143
|
+
var sdk = this._getSecuritySDKByProductScene({
|
144
|
+
product: product || scene
|
145
|
+
});
|
146
|
+
if (sdk) return;
|
147
|
+
this._newSecuritySDKByScene({
|
148
|
+
product: product || scene,
|
149
|
+
region: SecurityRegionEnum.SG
|
150
|
+
}, function () {
|
151
|
+
_this.logger.logInfo({
|
152
|
+
title: 'sdk_event_securitySdkPreInitSuccess'
|
153
|
+
}, {
|
154
|
+
product: product
|
155
|
+
}).send();
|
156
|
+
}, function (msg) {
|
157
|
+
_this.logger.logError({
|
158
|
+
title: 'sdk_error_securitySdkInitFailed',
|
159
|
+
msg: msg
|
160
|
+
}, {
|
161
|
+
product: product,
|
162
|
+
sign: 'Active initialization'
|
163
|
+
}).send();
|
164
|
+
});
|
108
165
|
}
|
109
|
-
|
110
166
|
/**
|
111
|
-
* @description
|
167
|
+
* @description Obtain security SDK through scenario identification
|
112
168
|
*/
|
113
169
|
}, {
|
114
|
-
key: "
|
115
|
-
value: function
|
116
|
-
var
|
170
|
+
key: "_getSecuritySDKByProductScene",
|
171
|
+
value: function _getSecuritySDKByProductScene(securityConfig) {
|
172
|
+
var storage = this.getSecurityConfigStorage(securityConfig.product);
|
173
|
+
var scene = storage.scene || getSecurityScene(securityConfig.product);
|
174
|
+
var securitySdk = this.securitySdkMap.get(scene);
|
175
|
+
return securitySdk;
|
176
|
+
}
|
177
|
+
/**
|
178
|
+
* @description New security SDK through scenario identification
|
179
|
+
*/
|
180
|
+
}, {
|
181
|
+
key: "_newSecuritySDKByScene",
|
182
|
+
value: function _newSecuritySDKByScene(securityConfig, successCallback, failCallback) {
|
183
|
+
var storage = this.getSecurityConfigStorage(securityConfig.product);
|
184
|
+
var scene = storage.scene || getSecurityScene(securityConfig.product);
|
185
|
+
var h5gateway = storage.h5gateway || getSecurityHost(securityConfig.region);
|
117
186
|
try {
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
title: 'sdk_event_securitySdkPreInitSuccess'
|
122
|
-
}).send();
|
123
|
-
}, function (msg) {
|
124
|
-
_this.logger.logError({
|
125
|
-
title: 'sdk_error_securitySdkInitFailed',
|
126
|
-
msg: msg
|
127
|
-
}).send();
|
187
|
+
var securitySdk = new Security({
|
188
|
+
scene: scene,
|
189
|
+
h5gateway: h5gateway
|
128
190
|
});
|
129
|
-
this.
|
130
|
-
|
131
|
-
|
132
|
-
} catch (
|
133
|
-
|
134
|
-
title: 'sdk_error_securitySdkInitFailed'
|
135
|
-
}).send();
|
191
|
+
this.securitySdkMap.set(scene, securitySdk);
|
192
|
+
securitySdk.initSecurity(successCallback, failCallback);
|
193
|
+
return securitySdk;
|
194
|
+
} catch (error) {
|
195
|
+
failCallback && failCallback(JSON.stringify(error));
|
136
196
|
}
|
137
197
|
}
|
138
|
-
|
198
|
+
/**
|
199
|
+
* @description Obtain risk control configuration in local storage
|
200
|
+
*/
|
201
|
+
}, {
|
202
|
+
key: "getSecurityConfigStorage",
|
203
|
+
value: function getSecurityConfigStorage(product) {
|
204
|
+
var scene = '';
|
205
|
+
var h5gateway = '';
|
206
|
+
var securityConfigStorage = getOrSetStorageId(getSecurityConfigStorageKey(product));
|
207
|
+
if (securityConfigStorage) {
|
208
|
+
var config = safeJson(securityConfigStorage, {});
|
209
|
+
scene = config === null || config === void 0 ? void 0 : config.appName;
|
210
|
+
h5gateway = config === null || config === void 0 ? void 0 : config.h5gateway;
|
211
|
+
}
|
212
|
+
return {
|
213
|
+
scene: scene,
|
214
|
+
h5gateway: h5gateway
|
215
|
+
};
|
216
|
+
}
|
139
217
|
/**
|
140
218
|
* @description Set the sdk basic configuration
|
141
219
|
*/
|
@@ -145,6 +223,7 @@ var AMSSDK = /*#__PURE__*/function () {
|
|
145
223
|
this._setMode(options);
|
146
224
|
this._setEnv(options);
|
147
225
|
this.options.locale = (options === null || options === void 0 ? void 0 : options.locale) || '';
|
226
|
+
this.options.product = options === null || options === void 0 ? void 0 : options.product;
|
148
227
|
}
|
149
228
|
/**
|
150
229
|
* @description Set environment variables
|
package/esm/index.d.ts
CHANGED
@@ -1,10 +1,3 @@
|
|
1
|
-
/**
|
2
|
-
* Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
|
3
|
-
*
|
4
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), the rights to use, copy, modify, merge, and/or distribute the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
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
|
-
* 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
|
-
*/
|
8
1
|
import { AMSComponent } from './core/component/index';
|
9
2
|
import { IoptionsParams } from './types';
|
10
3
|
export * from './types';
|
@@ -13,4 +6,13 @@ export declare class AMSCheckout extends AMSComponent {
|
|
13
6
|
export declare class AMSAutoDebit extends AMSCheckout {
|
14
7
|
constructor(options: IoptionsParams);
|
15
8
|
}
|
9
|
+
export declare class AMSEasyPay extends AMSCheckout {
|
10
|
+
constructor(options: IoptionsParams);
|
11
|
+
}
|
12
|
+
export declare class AMSCashierPayment extends AMSCheckout {
|
13
|
+
constructor(options: IoptionsParams);
|
14
|
+
}
|
15
|
+
export declare class AMSVaulting extends AMSCheckout {
|
16
|
+
constructor(options: IoptionsParams);
|
17
|
+
}
|
16
18
|
export default AMSCheckout;
|
package/esm/index.js
CHANGED
@@ -18,6 +18,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
18
18
|
* 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
|
19
19
|
* 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.
|
20
20
|
*/
|
21
|
+
import { productSceneEnum } from "./types/index";
|
21
22
|
import { AMSComponent } from "./core/component/index";
|
22
23
|
export * from "./types";
|
23
24
|
export var AMSCheckout = /*#__PURE__*/function (_AMSComponent) {
|
@@ -34,8 +35,47 @@ export var AMSAutoDebit = /*#__PURE__*/function (_AMSCheckout) {
|
|
34
35
|
var _super2 = _createSuper(AMSAutoDebit);
|
35
36
|
function AMSAutoDebit(options) {
|
36
37
|
_classCallCheck(this, AMSAutoDebit);
|
37
|
-
|
38
|
+
var _options = Object.assign({}, options, {
|
39
|
+
product: productSceneEnum.AUTO_DEBIT
|
40
|
+
});
|
41
|
+
return _super2.call(this, _options);
|
38
42
|
}
|
39
43
|
return _createClass(AMSAutoDebit);
|
40
44
|
}(AMSCheckout);
|
45
|
+
export var AMSEasyPay = /*#__PURE__*/function (_AMSCheckout2) {
|
46
|
+
_inherits(AMSEasyPay, _AMSCheckout2);
|
47
|
+
var _super3 = _createSuper(AMSEasyPay);
|
48
|
+
function AMSEasyPay(options) {
|
49
|
+
_classCallCheck(this, AMSEasyPay);
|
50
|
+
var _options = Object.assign({}, options, {
|
51
|
+
product: productSceneEnum.EASY_PAY
|
52
|
+
});
|
53
|
+
return _super3.call(this, _options);
|
54
|
+
}
|
55
|
+
return _createClass(AMSEasyPay);
|
56
|
+
}(AMSCheckout);
|
57
|
+
export var AMSCashierPayment = /*#__PURE__*/function (_AMSCheckout3) {
|
58
|
+
_inherits(AMSCashierPayment, _AMSCheckout3);
|
59
|
+
var _super4 = _createSuper(AMSCashierPayment);
|
60
|
+
function AMSCashierPayment(options) {
|
61
|
+
_classCallCheck(this, AMSCashierPayment);
|
62
|
+
var _options = Object.assign({}, options, {
|
63
|
+
product: productSceneEnum.CASHIER_PAYMENT
|
64
|
+
});
|
65
|
+
return _super4.call(this, _options);
|
66
|
+
}
|
67
|
+
return _createClass(AMSCashierPayment);
|
68
|
+
}(AMSCheckout);
|
69
|
+
export var AMSVaulting = /*#__PURE__*/function (_AMSCheckout4) {
|
70
|
+
_inherits(AMSVaulting, _AMSCheckout4);
|
71
|
+
var _super5 = _createSuper(AMSVaulting);
|
72
|
+
function AMSVaulting(options) {
|
73
|
+
_classCallCheck(this, AMSVaulting);
|
74
|
+
var _options = Object.assign({}, options, {
|
75
|
+
product: productSceneEnum.VAULTING
|
76
|
+
});
|
77
|
+
return _super5.call(this, _options);
|
78
|
+
}
|
79
|
+
return _createClass(AMSVaulting);
|
80
|
+
}(AMSCheckout);
|
41
81
|
export default AMSCheckout;
|
@@ -90,7 +90,8 @@ export var getIframeUrl = function getIframeUrl(iframeParams) {
|
|
90
90
|
instanceId: instanceId,
|
91
91
|
analyticsEnabled: (analytics === null || analytics === void 0 ? void 0 : analytics.enabled) === false ? 'false' : 'true',
|
92
92
|
sdkVersion: sdkVersion,
|
93
|
-
refUrl: window.location.href
|
93
|
+
refUrl: window.location.href,
|
94
|
+
_componentStartTime: "".concat(Date.now())
|
94
95
|
});
|
95
96
|
if (LOCAL_MOCK) urlParams.LOCAL_MOCK = LOCAL_MOCK;
|
96
97
|
if (requestHost) urlParams.requestHost = requestHost;
|
@@ -17,10 +17,12 @@ export default class ComponentApp {
|
|
17
17
|
private _appVersion;
|
18
18
|
private _isRetention;
|
19
19
|
private _actionQueryPromise;
|
20
|
+
private _actionSubmitPromise;
|
20
21
|
private _renderParams;
|
21
22
|
private _componentSign;
|
22
23
|
private _appLocationSearch;
|
23
24
|
private _renderDisplayType;
|
25
|
+
private _multipleCallbackEvents;
|
24
26
|
constructor();
|
25
27
|
/**
|
26
28
|
* @description Cancel listening and destroy the dom
|
@@ -35,7 +37,7 @@ export default class ComponentApp {
|
|
35
37
|
* @description Set the rendering capability of the cashier plug-in. Different technology stacks have some differences in the packaging and use of rendering functions
|
36
38
|
*/
|
37
39
|
setRender(renderFunc: IrenderFuncParams): void;
|
38
|
-
private
|
40
|
+
private initSecurity;
|
39
41
|
private logDeviceId;
|
40
42
|
private getDeviceIdAndLog;
|
41
43
|
/**
|
@@ -49,6 +51,7 @@ export default class ComponentApp {
|
|
49
51
|
* @description Interface request
|
50
52
|
*/
|
51
53
|
private createActionQueryPromise;
|
54
|
+
private createSubmitPromise;
|
52
55
|
private cleanElement;
|
53
56
|
/**
|
54
57
|
* @description Create app
|
@@ -70,6 +73,7 @@ export default class ComponentApp {
|
|
70
73
|
private handleSizeChanged;
|
71
74
|
private handleRedirect;
|
72
75
|
private handleDeclareInfo;
|
76
|
+
private handleDeclarePopWindowCallback;
|
73
77
|
private handleCloseBtnShow;
|
74
78
|
/**
|
75
79
|
* @description Send message to SDK
|