@alipay/ams-checkout 0.0.1720509876-dev.2 → 0.0.1723203704-dev.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/request.js +3 -3
- package/esm/constant/index.d.ts +10 -1
- package/esm/constant/index.js +9 -0
- package/esm/core/component/address.d.ts +34 -0
- package/esm/core/component/address.js +298 -0
- package/esm/core/component/appPreloadProcessing.d.ts +1 -0
- package/esm/core/component/appPreloadProcessing.js +89 -0
- package/esm/core/component/index.d.ts +1 -1
- package/esm/core/component/index.js +39 -14
- package/esm/core/instance/address.d.ts +76 -0
- package/esm/core/instance/address.js +283 -0
- package/esm/index.d.ts +12 -1
- package/esm/index.js +57 -19
- package/esm/plugin/address/cashierApp.d.ts +34 -0
- package/esm/plugin/address/cashierApp.js +218 -0
- package/esm/plugin/address/channel.d.ts +20 -0
- package/esm/plugin/address/channel.js +52 -0
- package/esm/plugin/address/component.inline.style.d.ts +11 -0
- package/esm/plugin/address/component.inline.style.js +38 -0
- package/esm/plugin/address/component.popup.style.d.ts +16 -0
- package/esm/plugin/address/component.popup.style.js +174 -0
- package/esm/plugin/address/index.d.ts +108 -0
- package/esm/plugin/address/index.js +862 -0
- package/esm/plugin/address/popupWindow.style.d.ts +8 -0
- package/esm/plugin/address/popupWindow.style.js +65 -0
- package/esm/plugin/component/cashierApp.js +9 -5
- package/esm/plugin/component/component.inline.style.d.ts +8 -9
- package/esm/plugin/component/component.inline.style.js +87 -6
- package/esm/plugin/component/index.js +49 -25
- package/esm/plugin/component/popupWindow.style.d.ts +5 -2
- package/esm/plugin/component/popupWindow.style.js +55 -7
- package/esm/plugin/type.d.ts +1 -0
- package/esm/types/address.d.ts +92 -0
- package/esm/types/address.js +7 -0
- package/esm/types/index.d.ts +13 -3
- package/esm/types/index.js +5 -0
- package/esm/util/index.d.ts +7 -1
- package/esm/util/index.js +67 -1
- package/esm/util/upgrade.d.ts +4 -4
- package/esm/util/upgrade.js +6 -6
- package/package.json +1 -1
@@ -0,0 +1,76 @@
|
|
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
|
+
import { ComponentActionNamesType } from 'src/plugin/type';
|
9
|
+
import type { AMSCheckoutOptions, InitSecurityConfig } from '../../types/index';
|
10
|
+
import { IAppendAddressParams } from '../../types/address';
|
11
|
+
import { IoptionsAddressParams } from '../../types/address';
|
12
|
+
import { EventCenter } from '../../util/index';
|
13
|
+
import { Logger } from '../../util/logger';
|
14
|
+
import { Security } from '../../util/security';
|
15
|
+
export default class AMSADDRESSSDK {
|
16
|
+
options: AMSCheckoutOptions;
|
17
|
+
originOptions: IoptionsAddressParams;
|
18
|
+
logger: Logger;
|
19
|
+
_eventCenter: EventCenter;
|
20
|
+
_instanceId: string;
|
21
|
+
_storageId: string;
|
22
|
+
_appendParams: IAppendAddressParams;
|
23
|
+
protected securitySdkMap: Map<string, Security>;
|
24
|
+
protected plugins: Map<string, any>;
|
25
|
+
constructor(options: IoptionsAddressParams);
|
26
|
+
private preInitSecurity;
|
27
|
+
/**
|
28
|
+
* @description init security SDK
|
29
|
+
* @param product Product Scenarios
|
30
|
+
* @param scene Scenario of the product (compatible with old version parameters, about to be deleted)
|
31
|
+
*/
|
32
|
+
initSecurity({ product, scene, }: InitSecurityConfig & {
|
33
|
+
scene?: string;
|
34
|
+
}): void;
|
35
|
+
/**
|
36
|
+
* @description Obtain security SDK through scenario identification
|
37
|
+
*/
|
38
|
+
_getSecuritySDKByProductScene(securityConfig: InitSecurityConfig): Security;
|
39
|
+
/**
|
40
|
+
* @description New security SDK through scenario identification
|
41
|
+
*/
|
42
|
+
_newSecuritySDKByScene(securityConfig: InitSecurityConfig, successCallback?: () => void, failCallback?: (errMsg?: string) => void): Security;
|
43
|
+
/**
|
44
|
+
* @description Obtain risk control configuration in local storage
|
45
|
+
*/
|
46
|
+
private getSecurityConfigStorage;
|
47
|
+
/**
|
48
|
+
* @description Set the sdk basic configuration
|
49
|
+
*/
|
50
|
+
private _setOptions;
|
51
|
+
/**
|
52
|
+
* @description Set environment variables
|
53
|
+
*/
|
54
|
+
private _setEnv;
|
55
|
+
/**
|
56
|
+
* @description Set UI and Network Mode
|
57
|
+
*/
|
58
|
+
private _setMode;
|
59
|
+
/**
|
60
|
+
* @description Initialize event related tasks
|
61
|
+
*/
|
62
|
+
private _initEvent;
|
63
|
+
/**
|
64
|
+
* @description Register plug-in
|
65
|
+
*/
|
66
|
+
protected _registerPlugin(pluginId: string, plugin: any): void;
|
67
|
+
/**
|
68
|
+
* @description Get Plug-in
|
69
|
+
*/
|
70
|
+
protected _getPlugin(pluginId: string): any;
|
71
|
+
/**
|
72
|
+
* @description Overlay Subscription
|
73
|
+
*/
|
74
|
+
protected _overrideSubscription(name: string, func: any, funcKey: string): void;
|
75
|
+
protected getBusActionNames(): ComponentActionNamesType;
|
76
|
+
}
|
@@ -0,0 +1,283 @@
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
2
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
3
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
4
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
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
|
+
/**
|
9
|
+
* Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
|
10
|
+
*
|
11
|
+
* 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:
|
12
|
+
* 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
|
13
|
+
* 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.
|
14
|
+
*/
|
15
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
16
|
+
|
17
|
+
import { v4 as uuid } from 'uuid';
|
18
|
+
import { ERRORMESSAGE, EVENT } from "../../constant";
|
19
|
+
import { environmentEnum, modeEnum, networkModeEnum, osTypeEnum, productSceneEnum, terminalTypeEnum } from "../../types/index";
|
20
|
+
import { device, EventCenter, getOrSetStorageId, getType, queryParse, safeJson } from "../../util/index";
|
21
|
+
import { LogConfig, Logger } from "../../util/logger";
|
22
|
+
import { getSecurityConfigStorageKey, getSecurityHost, getSecurityScene, Security, SecurityRegionEnum } from "../../util/security";
|
23
|
+
var AMSADDRESSSDK = /*#__PURE__*/function () {
|
24
|
+
function AMSADDRESSSDK(options) {
|
25
|
+
_classCallCheck(this, AMSADDRESSSDK);
|
26
|
+
_defineProperty(this, "options", void 0);
|
27
|
+
_defineProperty(this, "originOptions", void 0);
|
28
|
+
_defineProperty(this, "logger", void 0);
|
29
|
+
_defineProperty(this, "_eventCenter", void 0);
|
30
|
+
_defineProperty(this, "_instanceId", void 0);
|
31
|
+
_defineProperty(this, "_storageId", void 0);
|
32
|
+
_defineProperty(this, "_appendParams", void 0);
|
33
|
+
_defineProperty(this, "securitySdkMap", void 0);
|
34
|
+
_defineProperty(this, "plugins", void 0);
|
35
|
+
this._instanceId = uuid();
|
36
|
+
this.originOptions = options;
|
37
|
+
this.options = {};
|
38
|
+
this._eventCenter = new EventCenter();
|
39
|
+
this._initEvent(options);
|
40
|
+
this._setOptions(options);
|
41
|
+
this.plugins = new Map();
|
42
|
+
this.securitySdkMap = new Map();
|
43
|
+
var storageIdKey = 'AMSADDRESSSDK_STORAGE_ID';
|
44
|
+
var _storageId = getOrSetStorageId(storageIdKey);
|
45
|
+
if (!_storageId) {
|
46
|
+
getOrSetStorageId(storageIdKey, this._instanceId);
|
47
|
+
_storageId = this._instanceId;
|
48
|
+
}
|
49
|
+
this._storageId = _storageId;
|
50
|
+
|
51
|
+
// TODO Consumption data analysis control parameters
|
52
|
+
this.logger = new Logger(LogConfig, ![environmentEnum.prod, environmentEnum.sandbox].includes(options === null || options === void 0 ? void 0 : options.environment));
|
53
|
+
Logger.setInstance(this.logger);
|
54
|
+
this.logger.setMedta({
|
55
|
+
instanceId: this._instanceId
|
56
|
+
});
|
57
|
+
this.logger.initTracker();
|
58
|
+
this.logger.setComponentStartTime(Date.now());
|
59
|
+
this.logger.setTrackId(this._instanceId);
|
60
|
+
this.logger.logInfo({
|
61
|
+
title: 'NEW_ADDRESSSDK_BY_MECHANT',
|
62
|
+
msg: "".concat(options === null || options === void 0 ? void 0 : options.environment, "_").concat(options === null || options === void 0 ? void 0 : options.locale)
|
63
|
+
}).send();
|
64
|
+
this.preInitSecurity(options);
|
65
|
+
}
|
66
|
+
_createClass(AMSADDRESSSDK, [{
|
67
|
+
key: "preInitSecurity",
|
68
|
+
value: function preInitSecurity(options) {
|
69
|
+
var product = productSceneEnum.ELEMENT_ADDRESS;
|
70
|
+
this.initSecurity({
|
71
|
+
product: product
|
72
|
+
});
|
73
|
+
}
|
74
|
+
/**
|
75
|
+
* @description init security SDK
|
76
|
+
* @param product Product Scenarios
|
77
|
+
* @param scene Scenario of the product (compatible with old version parameters, about to be deleted)
|
78
|
+
*/
|
79
|
+
}, {
|
80
|
+
key: "initSecurity",
|
81
|
+
value: function initSecurity(_ref) {
|
82
|
+
var _this = this;
|
83
|
+
var _ref$product = _ref.product,
|
84
|
+
product = _ref$product === void 0 ? productSceneEnum.ELEMENT_ADDRESS : _ref$product,
|
85
|
+
_ref$scene = _ref.scene,
|
86
|
+
scene = _ref$scene === void 0 ? productSceneEnum.ELEMENT_ADDRESS : _ref$scene;
|
87
|
+
this.logger.logInfo({
|
88
|
+
title: 'sdk_event_securitySdkPreInit'
|
89
|
+
}, {
|
90
|
+
product: product
|
91
|
+
}).send();
|
92
|
+
var sdk = this._getSecuritySDKByProductScene({
|
93
|
+
product: product || scene
|
94
|
+
});
|
95
|
+
if (sdk) return;
|
96
|
+
this._newSecuritySDKByScene({
|
97
|
+
product: product || scene,
|
98
|
+
region: SecurityRegionEnum.SG
|
99
|
+
}, function () {
|
100
|
+
_this.logger.logInfo({
|
101
|
+
title: 'sdk_event_securitySdkPreInitSuccess'
|
102
|
+
}, {
|
103
|
+
product: product
|
104
|
+
}).send();
|
105
|
+
}, function (msg) {
|
106
|
+
_this.logger.logError({
|
107
|
+
title: 'sdk_error_securitySdkInitFailed',
|
108
|
+
msg: msg
|
109
|
+
}, {
|
110
|
+
product: product,
|
111
|
+
sign: 'Active initialization'
|
112
|
+
}).send();
|
113
|
+
});
|
114
|
+
}
|
115
|
+
/**
|
116
|
+
* @description Obtain security SDK through scenario identification
|
117
|
+
*/
|
118
|
+
}, {
|
119
|
+
key: "_getSecuritySDKByProductScene",
|
120
|
+
value: function _getSecuritySDKByProductScene(securityConfig) {
|
121
|
+
var storage = this.getSecurityConfigStorage(securityConfig.product);
|
122
|
+
var scene = storage.scene || getSecurityScene(securityConfig.product);
|
123
|
+
var securitySdk = this.securitySdkMap.get(scene);
|
124
|
+
return securitySdk;
|
125
|
+
}
|
126
|
+
/**
|
127
|
+
* @description New security SDK through scenario identification
|
128
|
+
*/
|
129
|
+
}, {
|
130
|
+
key: "_newSecuritySDKByScene",
|
131
|
+
value: function _newSecuritySDKByScene(securityConfig, successCallback, failCallback) {
|
132
|
+
var storage = this.getSecurityConfigStorage(securityConfig.product);
|
133
|
+
var scene = storage.scene || getSecurityScene(securityConfig.product);
|
134
|
+
var h5gateway = storage.h5gateway || getSecurityHost(securityConfig.region);
|
135
|
+
try {
|
136
|
+
var securitySdk = new Security({
|
137
|
+
scene: scene,
|
138
|
+
h5gateway: h5gateway
|
139
|
+
});
|
140
|
+
this.securitySdkMap.set(scene, securitySdk);
|
141
|
+
securitySdk.initSecurity(successCallback, failCallback);
|
142
|
+
return securitySdk;
|
143
|
+
} catch (error) {
|
144
|
+
failCallback && failCallback(error === null || error === void 0 ? void 0 : error.toString());
|
145
|
+
}
|
146
|
+
}
|
147
|
+
/**
|
148
|
+
* @description Obtain risk control configuration in local storage
|
149
|
+
*/
|
150
|
+
}, {
|
151
|
+
key: "getSecurityConfigStorage",
|
152
|
+
value: function getSecurityConfigStorage(product) {
|
153
|
+
var scene = '';
|
154
|
+
var h5gateway = '';
|
155
|
+
var securityConfigStorage = getOrSetStorageId(getSecurityConfigStorageKey(product));
|
156
|
+
if (securityConfigStorage) {
|
157
|
+
var config = safeJson(securityConfigStorage, {});
|
158
|
+
scene = config === null || config === void 0 ? void 0 : config.appName;
|
159
|
+
h5gateway = config === null || config === void 0 ? void 0 : config.h5gateway;
|
160
|
+
}
|
161
|
+
return {
|
162
|
+
scene: scene,
|
163
|
+
h5gateway: h5gateway
|
164
|
+
};
|
165
|
+
}
|
166
|
+
/**
|
167
|
+
* @description Set the sdk basic configuration
|
168
|
+
*/
|
169
|
+
}, {
|
170
|
+
key: "_setOptions",
|
171
|
+
value: function _setOptions(options) {
|
172
|
+
this._setMode(options);
|
173
|
+
this._setEnv(options);
|
174
|
+
this.options.locale = (options === null || options === void 0 ? void 0 : options.locale) || '';
|
175
|
+
this.options.product = options === null || options === void 0 ? void 0 : options.product;
|
176
|
+
}
|
177
|
+
/**
|
178
|
+
* @description Set environment variables
|
179
|
+
*/
|
180
|
+
}, {
|
181
|
+
key: "_setEnv",
|
182
|
+
value: function _setEnv(options) {
|
183
|
+
var _queryParse = queryParse(),
|
184
|
+
_moreEnv = _queryParse._moreEnv;
|
185
|
+
if (options !== null && options !== void 0 && options.environment && !((options === null || options === void 0 ? void 0 : options.environment) in environmentEnum) && _moreEnv !== 'true') {
|
186
|
+
console.warn(ERRORMESSAGE.INIT_PARAMETER_ERROR.ENVIRONMENT_ERROR.message);
|
187
|
+
options.environment = 'prod';
|
188
|
+
}
|
189
|
+
this.options.env = {
|
190
|
+
terminalType: device.isMobile ? terminalTypeEnum.WAP : terminalTypeEnum.WEB,
|
191
|
+
environment: (options === null || options === void 0 ? void 0 : options.environment) || 'prod'
|
192
|
+
};
|
193
|
+
if (this.options.env.terminalType === terminalTypeEnum.WAP) {
|
194
|
+
// eslint-disable-next-line no-nested-ternary
|
195
|
+
this.options.env.osType = device.iOS ? osTypeEnum.IOS : device.Android ? osTypeEnum.ANDROID : osTypeEnum.ELSE;
|
196
|
+
}
|
197
|
+
}
|
198
|
+
/**
|
199
|
+
* @description Set UI and Network Mode
|
200
|
+
*/
|
201
|
+
}, {
|
202
|
+
key: "_setMode",
|
203
|
+
value: function _setMode(options) {
|
204
|
+
this.options.mode = (options === null || options === void 0 ? void 0 : options.mode) || modeEnum.component;
|
205
|
+
if (options !== null && options !== void 0 && options.mode && !((options === null || options === void 0 ? void 0 : options.mode) in modeEnum)) {
|
206
|
+
console.warn(ERRORMESSAGE.INIT_PARAMETER_ERROR.MODE_ERROR.message);
|
207
|
+
this.options.mode = modeEnum.component;
|
208
|
+
}
|
209
|
+
this.options.networkMode = (options === null || options === void 0 ? void 0 : options.networkMode) || networkModeEnum.session;
|
210
|
+
if (options !== null && options !== void 0 && options.networkMode && !((options === null || options === void 0 ? void 0 : options.networkMode) in networkModeEnum)) {
|
211
|
+
console.warn(ERRORMESSAGE.INIT_PARAMETER_ERROR.NET_MODE_NOT_SUPPORT.message);
|
212
|
+
this.options.networkMode = networkModeEnum.proxy;
|
213
|
+
}
|
214
|
+
}
|
215
|
+
/**
|
216
|
+
* @description Initialize event related tasks
|
217
|
+
*/
|
218
|
+
}, {
|
219
|
+
key: "_initEvent",
|
220
|
+
value: function _initEvent(options) {
|
221
|
+
/** 地址监听 */
|
222
|
+
if (options !== null && options !== void 0 && options.onChange) {
|
223
|
+
if (getType(options.onChange) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.message);
|
224
|
+
this._overrideSubscription(EVENT.onChange.name, options.onChange, EVENT.onChange.uniqueKey);
|
225
|
+
}
|
226
|
+
|
227
|
+
/** getValue */
|
228
|
+
if (options !== null && options !== void 0 && options.onGetValue) {
|
229
|
+
if (getType(options.onGetValue) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.message);
|
230
|
+
this._overrideSubscription(EVENT.onGetValue.name, options.onGetValue, EVENT.onGetValue.uniqueKey);
|
231
|
+
}
|
232
|
+
}
|
233
|
+
/**
|
234
|
+
* @description Register plug-in
|
235
|
+
*/
|
236
|
+
}, {
|
237
|
+
key: "_registerPlugin",
|
238
|
+
value: function _registerPlugin(pluginId, plugin) {
|
239
|
+
this.plugins.set(pluginId, plugin);
|
240
|
+
if (plugin !== null && plugin !== void 0 && plugin.applyPlugin) {
|
241
|
+
try {
|
242
|
+
plugin.applyPlugin(this);
|
243
|
+
} catch (error) {
|
244
|
+
this.plugins.delete(pluginId);
|
245
|
+
if (getType(error) === 'error') throw error;
|
246
|
+
throw new Error("Failed to register plug-in\uFF1A".concat(pluginId, " Exception in the apply function of the plug-in"));
|
247
|
+
}
|
248
|
+
}
|
249
|
+
}
|
250
|
+
/**
|
251
|
+
* @description Get Plug-in
|
252
|
+
*/
|
253
|
+
}, {
|
254
|
+
key: "_getPlugin",
|
255
|
+
value: function _getPlugin(pluginId) {
|
256
|
+
if (!this.plugins.has(pluginId)) {
|
257
|
+
console.warn("".concat(pluginId, " Plugin unregistered"));
|
258
|
+
return null;
|
259
|
+
}
|
260
|
+
return this.plugins.get(pluginId);
|
261
|
+
}
|
262
|
+
/**
|
263
|
+
* @description Overlay Subscription
|
264
|
+
*/
|
265
|
+
}, {
|
266
|
+
key: "_overrideSubscription",
|
267
|
+
value: function _overrideSubscription(name, func, funcKey) {
|
268
|
+
this._eventCenter.off(name, func, funcKey);
|
269
|
+
this._eventCenter.on(name, func, funcKey);
|
270
|
+
}
|
271
|
+
}, {
|
272
|
+
key: "getBusActionNames",
|
273
|
+
value: function getBusActionNames() {
|
274
|
+
var appendParams = this._appendParams;
|
275
|
+
if (!appendParams) {
|
276
|
+
return null;
|
277
|
+
}
|
278
|
+
return this._getPlugin("COMPONENT");
|
279
|
+
}
|
280
|
+
}]);
|
281
|
+
return AMSADDRESSSDK;
|
282
|
+
}();
|
283
|
+
export { AMSADDRESSSDK as default };
|
package/esm/index.d.ts
CHANGED
@@ -6,7 +6,9 @@
|
|
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
8
|
import { AMSComponent } from './core/component/index';
|
9
|
+
import { AddressComponent } from './core/component/address';
|
9
10
|
import { IoptionsParams, componentSignEnum } from './types';
|
11
|
+
import { IoptionsAddressParams } from './types/address';
|
10
12
|
export * from './types';
|
11
13
|
export declare class AMSCheckout extends AMSComponent {
|
12
14
|
constructor(_options: any, channelType?: componentSignEnum[], productSceneVersion?: string);
|
@@ -14,6 +16,9 @@ export declare class AMSCheckout extends AMSComponent {
|
|
14
16
|
export declare class AMSAutoDebit extends AMSCheckout {
|
15
17
|
constructor(options: IoptionsParams);
|
16
18
|
}
|
19
|
+
export declare class AMSAutoDebitPay extends AMSCheckout {
|
20
|
+
constructor(options: IoptionsParams);
|
21
|
+
}
|
17
22
|
export declare class AMSEasyPay extends AMSCheckout {
|
18
23
|
constructor(options: IoptionsParams);
|
19
24
|
}
|
@@ -23,7 +28,13 @@ export declare class AMSCashierPayment extends AMSCheckout {
|
|
23
28
|
export declare class AMSVaulting extends AMSCheckout {
|
24
29
|
constructor(options: IoptionsParams);
|
25
30
|
}
|
26
|
-
export declare class
|
31
|
+
export declare class AntomElement extends AMSCheckout {
|
27
32
|
constructor(options: IoptionsParams);
|
28
33
|
}
|
34
|
+
export declare class Address extends AddressComponent {
|
35
|
+
constructor(_options: any, channelType?: componentSignEnum[], productSceneVersion?: string);
|
36
|
+
}
|
37
|
+
export declare class AddressElement extends Address {
|
38
|
+
constructor(options: IoptionsAddressParams);
|
39
|
+
}
|
29
40
|
export default AMSCheckout;
|
package/esm/index.js
CHANGED
@@ -19,6 +19,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
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
21
|
import { AMSComponent } from "./core/component/index";
|
22
|
+
import { AddressComponent } from "./core/component/address";
|
22
23
|
import { componentSignEnum } from "./types";
|
23
24
|
import { productSceneEnum } from "./types/index";
|
24
25
|
import { Logger, LogConfig } from "./util/logger";
|
@@ -49,9 +50,21 @@ export var AMSAutoDebit = /*#__PURE__*/function (_AMSCheckout) {
|
|
49
50
|
}
|
50
51
|
return _createClass(AMSAutoDebit);
|
51
52
|
}(AMSCheckout);
|
52
|
-
export var
|
53
|
-
_inherits(
|
54
|
-
var _super3 = _createSuper(
|
53
|
+
export var AMSAutoDebitPay = /*#__PURE__*/function (_AMSCheckout2) {
|
54
|
+
_inherits(AMSAutoDebitPay, _AMSCheckout2);
|
55
|
+
var _super3 = _createSuper(AMSAutoDebitPay);
|
56
|
+
function AMSAutoDebitPay(options) {
|
57
|
+
_classCallCheck(this, AMSAutoDebitPay);
|
58
|
+
var _options = Object.assign({}, options, {
|
59
|
+
product: productSceneEnum.AUTO_DEBIT_PAY
|
60
|
+
});
|
61
|
+
return _super3.call(this, _options, [componentSignEnum.AUTO_DEBIT_PAY_WALLET]);
|
62
|
+
}
|
63
|
+
return _createClass(AMSAutoDebitPay);
|
64
|
+
}(AMSCheckout);
|
65
|
+
export var AMSEasyPay = /*#__PURE__*/function (_AMSCheckout3) {
|
66
|
+
_inherits(AMSEasyPay, _AMSCheckout3);
|
67
|
+
var _super4 = _createSuper(AMSEasyPay);
|
55
68
|
function AMSEasyPay(options) {
|
56
69
|
_classCallCheck(this, AMSEasyPay);
|
57
70
|
var _options = Object.assign({}, options, {
|
@@ -76,13 +89,13 @@ export var AMSEasyPay = /*#__PURE__*/function (_AMSCheckout2) {
|
|
76
89
|
error: error
|
77
90
|
});
|
78
91
|
}
|
79
|
-
return
|
92
|
+
return _super4.call(this, _options, [componentSignEnum.EASY_PAY_WALLET], currentProductSceneVersion);
|
80
93
|
}
|
81
94
|
return _createClass(AMSEasyPay);
|
82
95
|
}(AMSCheckout);
|
83
|
-
export var AMSCashierPayment = /*#__PURE__*/function (
|
84
|
-
_inherits(AMSCashierPayment,
|
85
|
-
var
|
96
|
+
export var AMSCashierPayment = /*#__PURE__*/function (_AMSCheckout4) {
|
97
|
+
_inherits(AMSCashierPayment, _AMSCheckout4);
|
98
|
+
var _super5 = _createSuper(AMSCashierPayment);
|
86
99
|
function AMSCashierPayment(options) {
|
87
100
|
_classCallCheck(this, AMSCashierPayment);
|
88
101
|
var _options = Object.assign({}, options, {
|
@@ -107,32 +120,57 @@ export var AMSCashierPayment = /*#__PURE__*/function (_AMSCheckout3) {
|
|
107
120
|
error: error
|
108
121
|
});
|
109
122
|
}
|
110
|
-
return
|
123
|
+
return _super5.call(this, _options, currentChannelType);
|
111
124
|
}
|
112
125
|
return _createClass(AMSCashierPayment);
|
113
126
|
}(AMSCheckout);
|
114
|
-
export var AMSVaulting = /*#__PURE__*/function (
|
115
|
-
_inherits(AMSVaulting,
|
116
|
-
var
|
127
|
+
export var AMSVaulting = /*#__PURE__*/function (_AMSCheckout5) {
|
128
|
+
_inherits(AMSVaulting, _AMSCheckout5);
|
129
|
+
var _super6 = _createSuper(AMSVaulting);
|
117
130
|
function AMSVaulting(options) {
|
118
131
|
_classCallCheck(this, AMSVaulting);
|
119
132
|
var _options = Object.assign({}, options, {
|
120
133
|
product: productSceneEnum.VAULTING
|
121
134
|
});
|
122
|
-
return
|
135
|
+
return _super6.call(this, _options, [componentSignEnum.CASHIER_PAYMENT_CARD]);
|
123
136
|
}
|
124
137
|
return _createClass(AMSVaulting);
|
125
138
|
}(AMSCheckout);
|
126
|
-
export var
|
127
|
-
_inherits(
|
128
|
-
var
|
129
|
-
function
|
130
|
-
_classCallCheck(this,
|
139
|
+
export var AntomElement = /*#__PURE__*/function (_AMSCheckout6) {
|
140
|
+
_inherits(AntomElement, _AMSCheckout6);
|
141
|
+
var _super7 = _createSuper(AntomElement);
|
142
|
+
function AntomElement(options) {
|
143
|
+
_classCallCheck(this, AntomElement);
|
131
144
|
var _options = Object.assign({}, options, {
|
132
145
|
product: productSceneEnum.ELEMENT_PAYMENT
|
133
146
|
});
|
134
|
-
return
|
147
|
+
return _super7.call(this, _options, [componentSignEnum.ELEMENT_PAYMENT]);
|
135
148
|
}
|
136
|
-
return _createClass(
|
149
|
+
return _createClass(AntomElement);
|
137
150
|
}(AMSCheckout);
|
151
|
+
export var Address = /*#__PURE__*/function (_AddressComponent) {
|
152
|
+
_inherits(Address, _AddressComponent);
|
153
|
+
var _super8 = _createSuper(Address);
|
154
|
+
function Address(_options, channelType) {
|
155
|
+
var _this2;
|
156
|
+
var productSceneVersion = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '1.0';
|
157
|
+
_classCallCheck(this, Address);
|
158
|
+
_this2 = _super8.call(this, _options);
|
159
|
+
_this2.preloadComponent(channelType, productSceneVersion);
|
160
|
+
return _this2;
|
161
|
+
}
|
162
|
+
return _createClass(Address);
|
163
|
+
}(AddressComponent);
|
164
|
+
export var AddressElement = /*#__PURE__*/function (_Address) {
|
165
|
+
_inherits(AddressElement, _Address);
|
166
|
+
var _super9 = _createSuper(AddressElement);
|
167
|
+
function AddressElement(options) {
|
168
|
+
_classCallCheck(this, AddressElement);
|
169
|
+
var _options = Object.assign({}, options, {
|
170
|
+
product: productSceneEnum.ELEMENT_ADDRESS
|
171
|
+
});
|
172
|
+
return _super9.call(this, _options, [componentSignEnum.ELEMENT_ADDRESS]);
|
173
|
+
}
|
174
|
+
return _createClass(AddressElement);
|
175
|
+
}(Address);
|
138
176
|
export default AMSCheckout;
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import { componentSignEnum, Ianalytics, renderDisplayTypeEnum } from '../../types';
|
2
|
+
export declare const getAppPath: (environment: string, appVersion: string, componentSign: componentSignEnum, productScene: string, productSceneVersion: string, extendInfo: string, mid: string, sendLog?: boolean) => any;
|
3
|
+
export declare const getAppDomain: (domainParams: {
|
4
|
+
environment: string;
|
5
|
+
appVersion: string;
|
6
|
+
componentSign: componentSignEnum;
|
7
|
+
productScene: string;
|
8
|
+
productSceneVersion: string;
|
9
|
+
extendInfo: string;
|
10
|
+
mid: string;
|
11
|
+
}) => string;
|
12
|
+
export declare const getIframeUrl: (iframeParams: {
|
13
|
+
componentSign: componentSignEnum;
|
14
|
+
analytics?: Ianalytics;
|
15
|
+
productScene: string;
|
16
|
+
productSceneVersion: string;
|
17
|
+
environment: string;
|
18
|
+
appVersion: string;
|
19
|
+
extendInfo?: string;
|
20
|
+
locale?: string;
|
21
|
+
instanceId: string;
|
22
|
+
renderDisplayType: renderDisplayTypeEnum;
|
23
|
+
isPreload?: string;
|
24
|
+
hostSign?: string;
|
25
|
+
mid?: string;
|
26
|
+
}) => {
|
27
|
+
path: string;
|
28
|
+
locationSearch: string;
|
29
|
+
};
|
30
|
+
/**
|
31
|
+
* @description Create iframe
|
32
|
+
*/
|
33
|
+
export declare const createIframe: (mode: string, platform: 'mobile' | 'desktop') => HTMLIFrameElement;
|
34
|
+
export declare const createPreloadIframe: (channelType: any, version: any) => HTMLIFrameElement;
|