@alipay/ams-checkout 1.20.1 → 1.22.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 +11 -0
- package/esm/config/index.js +20 -1
- package/esm/constant/index.d.ts +10 -0
- package/esm/constant/index.js +83 -1
- package/esm/core/component/address.d.ts +8 -0
- package/esm/core/component/address.js +72 -0
- package/esm/core/component/index.d.ts +5 -2
- package/esm/core/component/index.js +70 -55
- package/esm/core/instance/index.d.ts +1 -0
- package/esm/core/instance/index.js +13 -1
- package/esm/index.d.ts +8 -8
- package/esm/index.js +44 -8
- package/esm/plugin/applepay/component.js +1 -1
- package/esm/plugin/component/cashierApp.d.ts +3 -3
- package/esm/plugin/component/cashierApp.js +33 -3
- package/esm/plugin/component/channel.js +1 -0
- 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/component.popup.style.d.ts +1 -0
- package/esm/plugin/component/component.popup.style.js +3 -0
- package/esm/plugin/component/index.d.ts +4 -1
- package/esm/plugin/component/index.js +175 -97
- package/esm/plugin/component/popupWindow.style.d.ts +5 -2
- package/esm/plugin/component/popupWindow.style.js +70 -14
- package/esm/plugin/payment-element/utils.d.ts +2 -0
- package/esm/plugin/payment-element/utils.js +6 -0
- package/esm/plugin/paypal/index.js +1 -0
- package/esm/plugin/type.d.ts +1 -0
- package/esm/types/index.d.ts +93 -4
- package/esm/types/index.js +14 -0
- package/esm/util/getBackScheme.d.ts +5 -0
- package/esm/util/getBackScheme.js +42 -0
- package/esm/util/security.d.ts +1 -0
- package/esm/util/security.js +1 -1
- package/esm/util/ua/index.d.ts +2 -0
- package/esm/util/ua/index.js +2 -0
- package/esm/util/ua/isAndroid.d.ts +4 -0
- package/esm/util/ua/isAndroid.js +7 -0
- package/esm/util/ua/isIOS.d.ts +4 -0
- package/esm/util/ua/isIOS.js +7 -0
- package/package.json +2 -1
package/esm/config/index.d.ts
CHANGED
@@ -1,3 +1,14 @@
|
|
1
1
|
export declare const marmotMap: Record<string, string>;
|
2
2
|
export declare const marmotConfigMap: Record<string, string>;
|
3
|
+
export declare const elementAppMarmotMap: Record<string, string>;
|
3
4
|
export declare const sdkVersion: string;
|
5
|
+
/**
|
6
|
+
* @description: 目前应用层分为v1和v2,会存在两个应用版本号不是同步发布的情况。所以需要把默认的应用版本号配置抽离出来。
|
7
|
+
*/
|
8
|
+
export declare const AMSCheckoutAppVersion = "1.22.0";
|
9
|
+
export declare const AMSAutoDebitAppVersion = "1.22.0";
|
10
|
+
export declare const AMSEasyPayAppVersion = "1.22.0";
|
11
|
+
export declare const AMSCashierPaymentAppVersion = "1.22.0";
|
12
|
+
export declare const AMSVaultingAppVersion = "1.22.0";
|
13
|
+
export declare const AMSPaymentElementAppVersion = "1.22.0";
|
14
|
+
export declare const ADDRESSElementAppVersion = "1.22.0";
|
package/esm/config/index.js
CHANGED
@@ -22,4 +22,23 @@ export var marmotConfigMap = {
|
|
22
22
|
light_sandbox: 'https://config.marmot-cloud.com/config/data/antom-sdk-config/en_US.json',
|
23
23
|
prod: 'https://config.marmot-cloud.com/config/data/antom-sdk-config/en_US.json'
|
24
24
|
};
|
25
|
-
export var
|
25
|
+
export var elementAppMarmotMap = {
|
26
|
+
dev: 'http://page.alipay.net/page/antom-web-checkout-v2',
|
27
|
+
sit: 'http://page.test.alipay.net/page/antom-web-checkout-v2',
|
28
|
+
pre: 'https://pre.ac.alipay.com/page/antom-web-checkout-v2',
|
29
|
+
sandbox: 'https://ac.alipay.com/page/antom-web-checkout-v2',
|
30
|
+
light_sandbox: 'https://ac.alipay.com/page/antom-web-checkout-v2',
|
31
|
+
prod: 'https://ac.alipay.com/page/antom-web-checkout-v2'
|
32
|
+
};
|
33
|
+
export var sdkVersion = json.version;
|
34
|
+
|
35
|
+
/**
|
36
|
+
* @description: 目前应用层分为v1和v2,会存在两个应用版本号不是同步发布的情况。所以需要把默认的应用版本号配置抽离出来。
|
37
|
+
*/
|
38
|
+
export var AMSCheckoutAppVersion = '1.22.0'; // 兜底版本号
|
39
|
+
export var AMSAutoDebitAppVersion = '1.22.0'; // 代扣
|
40
|
+
export var AMSEasyPayAppVersion = '1.22.0'; // easypay
|
41
|
+
export var AMSCashierPaymentAppVersion = '1.22.0'; // 收银台(卡、apm)
|
42
|
+
export var AMSVaultingAppVersion = '1.22.0'; // 绑卡
|
43
|
+
export var AMSPaymentElementAppVersion = '1.22.0'; // payment element
|
44
|
+
export var ADDRESSElementAppVersion = '1.22.0'; // address element
|
package/esm/constant/index.d.ts
CHANGED
@@ -175,6 +175,10 @@ export declare const EVENT: {
|
|
175
175
|
name: string;
|
176
176
|
uniqueKey: string;
|
177
177
|
};
|
178
|
+
onChange: {
|
179
|
+
name: string;
|
180
|
+
uniqueKey: string;
|
181
|
+
};
|
178
182
|
};
|
179
183
|
export declare const COMPONENT_CONTAINER_ID = "ams-component-container";
|
180
184
|
export declare const COMPONENT_SECTION_ID = "ams-component-section";
|
@@ -183,6 +187,7 @@ export declare const COMPONENT_CLOSE_BLOCK_ID = "asm-component-close-block";
|
|
183
187
|
export declare const COMPONENT_RETENTION_ID = "ams-component-retention";
|
184
188
|
export declare const MOCKUP_ID = "ams-component-mockup";
|
185
189
|
export declare const LOADING_ID = "ams-component-loading";
|
190
|
+
export declare const POPUPLOADING_ID = "ams-component-popup-loading";
|
186
191
|
export declare const LISTENER_PREFIX = "_ams_sdk_component_listener";
|
187
192
|
export declare const INLINE_BASE_STYLE_ID = "ams-inline-component-style";
|
188
193
|
export declare const INLINE_IMG_CLASSNAME = "inline-loading";
|
@@ -194,3 +199,8 @@ export declare const TIMEOUT_WEB_APP_HEART_BEAT = 6000;
|
|
194
199
|
export declare const TIME_DELAY_SEND_HEART_BEAT = 1000;
|
195
200
|
export declare const closeImg = "https://cdn.marmot-cloud.com/storage/2023/5/18/1692a487-99b5-4314-9d6f-e9814bc1ca41.svg";
|
196
201
|
export declare const LOADINGIMG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIQAAACEBAMAAACjap6UAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAJcEhZcwAAITgAACE4AUWWMWAAAAAqUExURUdwTKe3zKGxyK27z7K/05ytxLbD1bvH2Jaowb/K28DL3JCjvYueucDL2xLcxpgAAAAOdFJOUwCKoHRft0w5zCgY4fYKKSYvdQAABvtJREFUaN6lmt+LG1UUx6fddbcZHOgkpWutBTPbVBEfNp1xS6uF2oQURUGnBBbqw7YdsooV2ipZ06c+uBBZCistDRMUqgV1gnnwJ4HMg2jBh+Qh1bW1A/lfPOfcO9lkNz/m3j3dh2XT+eznfM+dmTvTKsroUovpeGotbyetlXuKTH17vFxeKq9R5fOJG8KAR6+Uy2vlJag8ALDmxSDa2TLWEhos5UPKnEA7sy8yALNYyod1/mpUwiYpQB9MYy1sJZWybwgRgLGGDLRAhg1ftn0qIqHBkijzefBO7HwKRN6cTJguNxoho38gjGHb7y5PTHJpvdyLgsaap3UBSdjISKWMCZlqzzTBosGj4CMJC+LEmh8/20+b62jRM+EGjIAQsLDnxhH+IQduUS7P50p1RQk85zgRwCIPhJTx9pjz6gIev84k1o59tfVJ7HIKw0iRRio5upX3GaGBjPMbg5/FjnOAYRvGC6MIU83mOkGAcHLnx7cxC8O2ETNqsofhcIgT2xja7WOmYRsp4+hwwt9NKErz1xG/ZJYRsE4PXRIX0GAdwxi5AGfjNrYCiGRnyMf/kgRgGmNm9ihl8DoyVAKOxzxfGrdy7vOZGPM7NfaiBDI+G38KXDK4yMKOj16lNiDKCVc3Nc47OTpkTRCjeWTi9SRMY3voHzZZ/TL5inKJAPHtS1TlhMZyhIszk4hvm+t/HPF5lEvjNyRhxAd7PuwziY0oCJV3cqz/hzPNph9ZQlG+hi6SRjze/wu/9/3oEnywycEVerhFFr9FvVldT5LFgb4Lvw8EEFmIipihiSSNLet9PjKaP0a/656Nx0FD37+1uFvNVstv3oq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Ep1lgGx2xzMMt3DdSQN1eBvndsbMCJ47oZW7WSdHiCGvXTBMtHDHtvI4yy1yQ4IHDbfquuMZMcfJMYmPhn3sIQE13JGTVaEJsHCGS6CGy6o0ykN1CrkcWjjDJVDDIwm34g69McUKSIDjnSHj4PNiEpWKWyoNWelewXEoCuhj5EPpEzeEVFa3L3X1bgHaKOQcjOOD0YFXqYtSCRkDEPW7ApbjMJExZ5LasyCIW8M9mBZ4FQLkHB7G2MfzJ3Q8eKyGtVIsFlcKvBwayfh/ldW8Ck4Va7USEorFAkEoi1zu3KQrEu+Ca6wwi54GpFmYeC6ruLRAgffCLVgv2EchwkuGgGVZWe15bElAL5FeUwSUBR1f5AQUESCQR2mVh1FkjfAkohJgLj1GEVtZIRFACP0fCm/AgmdREnzYqIRhFHkvq+J77MBFQpEPpCQOYPcntwIWeK6Mu0P9D9pzJq4u5hj+AAAAAElFTkSuQmCC";
|
202
|
+
export declare const RULES: {
|
203
|
+
matchRule: string;
|
204
|
+
iosScheme: string;
|
205
|
+
andScheme: string;
|
206
|
+
}[];
|
package/esm/constant/index.js
CHANGED
@@ -174,6 +174,10 @@ export var EVENT = {
|
|
174
174
|
beforeSubmitDone: {
|
175
175
|
name: 'beforeSubmitDone',
|
176
176
|
uniqueKey: 'userBeforeSubmitDone'
|
177
|
+
},
|
178
|
+
onChange: {
|
179
|
+
name: 'onChange',
|
180
|
+
uniqueKey: 'userChange'
|
177
181
|
}
|
178
182
|
};
|
179
183
|
export var COMPONENT_CONTAINER_ID = 'ams-component-container';
|
@@ -183,6 +187,7 @@ export var COMPONENT_CLOSE_BLOCK_ID = 'asm-component-close-block';
|
|
183
187
|
export var COMPONENT_RETENTION_ID = 'ams-component-retention';
|
184
188
|
export var MOCKUP_ID = 'ams-component-mockup';
|
185
189
|
export var LOADING_ID = 'ams-component-loading';
|
190
|
+
export var POPUPLOADING_ID = 'ams-component-popup-loading'; // popup弹窗loading
|
186
191
|
export var LISTENER_PREFIX = '_ams_sdk_component_listener';
|
187
192
|
export var INLINE_BASE_STYLE_ID = 'ams-inline-component-style';
|
188
193
|
export var INLINE_IMG_CLASSNAME = 'inline-loading';
|
@@ -193,4 +198,81 @@ export var ANIMATION_TIME = 300;
|
|
193
198
|
export var TIMEOUT_WEB_APP_HEART_BEAT = 6000;
|
194
199
|
export var TIME_DELAY_SEND_HEART_BEAT = 1000;
|
195
200
|
export var closeImg = 'https://cdn.marmot-cloud.com/storage/2023/5/18/1692a487-99b5-4314-9d6f-e9814bc1ca41.svg';
|
196
|
-
export var LOADINGIMG = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIQAAACEBAMAAACjap6UAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAJcEhZcwAAITgAACE4AUWWMWAAAAAqUExURUdwTKe3zKGxyK27z7K/05ytxLbD1bvH2Jaowb/K28DL3JCjvYueucDL2xLcxpgAAAAOdFJOUwCKoHRft0w5zCgY4fYKKSYvdQAABvtJREFUaN6lmt+LG1UUx6fddbcZHOgkpWutBTPbVBEfNp1xS6uF2oQURUGnBBbqw7YdsooV2ipZ06c+uBBZCistDRMUqgV1gnnwJ4HMg2jBh+Qh1bW1A/lfPOfcO9lkNz/m3j3dh2XT+eznfM+dmTvTKsroUovpeGotbyetlXuKTH17vFxeKq9R5fOJG8KAR6+Uy2vlJag8ALDmxSDa2TLWEhos5UPKnEA7sy8yALNYyod1/mpUwiYpQB9MYy1sJZWybwgRgLGGDLRAhg1ftn0qIqHBkijzefBO7HwKRN6cTJguNxoho38gjGHb7y5PTHJpvdyLgsaap3UBSdjISKWMCZlqzzTBosGj4CMJC+LEmh8/20+b62jRM+EGjIAQsLDnxhH+IQduUS7P50p1RQk85zgRwCIPhJTx9pjz6gIev84k1o59tfVJ7HIKw0iRRio5upX3GaGBjPMbg5/FjnOAYRvGC6MIU83mOkGAcHLnx7cxC8O2ETNqsofhcIgT2xja7WOmYRsp4+hwwt9NKErz1xG/ZJYRsE4PXRIX0GAdwxi5AGf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3KQrEu+Ca6wwi54GpFmYeC6ruLRAgffCLVgv2EchwkuGgGVZWe15bElAL5FeUwSUBR1f5AQUESCQR2mVh1FkjfAkohJgLj1GEVtZIRFACP0fCm/AgmdREnzYqIRhFHkvq+J77MBFQpEPpCQOYPcntwIWeK6Mu0P9D9pzJq4u5hj+AAAAAElFTkSuQmCC';
|
202
|
+
export var RULES = [{
|
203
|
+
matchRule: 'AppleWebKit\\/([0-9\\.]+).* Version\\/([0-9\\._]+) Mobile\\/([0-9\\._A-Z]+) Safari\\/([0-9\\._]+)$',
|
204
|
+
iosScheme: 'https',
|
205
|
+
andScheme: ''
|
206
|
+
}, {
|
207
|
+
matchRule: 'HeyTapBrowser',
|
208
|
+
iosScheme: '',
|
209
|
+
andScheme: ''
|
210
|
+
}, {
|
211
|
+
matchRule: 'HuaweiBrowser',
|
212
|
+
iosScheme: '',
|
213
|
+
andScheme: ''
|
214
|
+
}, {
|
215
|
+
matchRule: 'Kwai',
|
216
|
+
iosScheme: 'kwai',
|
217
|
+
andScheme: ''
|
218
|
+
}, {
|
219
|
+
matchRule: 'MQQBrowser',
|
220
|
+
iosScheme: 'mttbrowser',
|
221
|
+
andScheme: ''
|
222
|
+
}, {
|
223
|
+
matchRule: 'MicroMessenger',
|
224
|
+
iosScheme: '',
|
225
|
+
andScheme: ''
|
226
|
+
}, {
|
227
|
+
matchRule: 'MiuiBrowser',
|
228
|
+
iosScheme: '',
|
229
|
+
andScheme: ''
|
230
|
+
}, {
|
231
|
+
matchRule: 'Mozilla\\/([0-9\\.]+).* AppleWebKit\\/([0-9\\.]+).* CriOS\\/([0-9\\._]+) Mobile\\/([0-9\\._A-Z\\._a-z]+) Safari\\/([0-9\\._]+)$',
|
232
|
+
iosScheme: 'googlechrome',
|
233
|
+
andScheme: ''
|
234
|
+
}, {
|
235
|
+
matchRule: 'Mozilla\\/([0-9\\.]+).* AppleWebKit\\/([0-9\\.]+).* Version\\/([0-9\\._]+) Mobile Safari\\/([0-9\\._]+)$',
|
236
|
+
iosScheme: 'googlechrome',
|
237
|
+
andScheme: ''
|
238
|
+
}, {
|
239
|
+
matchRule: 'NewsArticle',
|
240
|
+
iosScheme: 'snssdk141',
|
241
|
+
andScheme: ''
|
242
|
+
}, {
|
243
|
+
matchRule: 'UCBrowser',
|
244
|
+
iosScheme: 'ucbrowser',
|
245
|
+
andScheme: ''
|
246
|
+
}, {
|
247
|
+
matchRule: 'VideoArticle',
|
248
|
+
iosScheme: 'snssdk32',
|
249
|
+
andScheme: ''
|
250
|
+
}, {
|
251
|
+
matchRule: 'VivoBrowser',
|
252
|
+
iosScheme: '',
|
253
|
+
andScheme: ''
|
254
|
+
}, {
|
255
|
+
matchRule: 'ZhongAnWebView',
|
256
|
+
iosScheme: 'zaapp',
|
257
|
+
andScheme: ''
|
258
|
+
}, {
|
259
|
+
matchRule: 'aweme',
|
260
|
+
iosScheme: 'snssdk1128',
|
261
|
+
andScheme: ''
|
262
|
+
}, {
|
263
|
+
matchRule: 'aweme_lite',
|
264
|
+
iosScheme: 'snssdk2329',
|
265
|
+
andScheme: ''
|
266
|
+
}, {
|
267
|
+
matchRule: 'com.xs.fm',
|
268
|
+
iosScheme: 'novelfm3040',
|
269
|
+
andScheme: ''
|
270
|
+
}, {
|
271
|
+
matchRule: 'netdisk',
|
272
|
+
iosScheme: '',
|
273
|
+
andScheme: ''
|
274
|
+
}, {
|
275
|
+
matchRule: 'qqnews',
|
276
|
+
iosScheme: 'qqnews',
|
277
|
+
andScheme: ''
|
278
|
+
}];
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { IoptionsParams } from '../../types';
|
2
|
+
import { AMSComponent } from './index';
|
3
|
+
export declare class AddressComponent extends AMSComponent {
|
4
|
+
constructor(options: IoptionsParams & {
|
5
|
+
appVersion: string;
|
6
|
+
});
|
7
|
+
getValue(hasValidate?: boolean): Promise<unknown>;
|
8
|
+
}
|
@@ -0,0 +1,72 @@
|
|
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 _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
6
|
+
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); }
|
7
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
8
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
9
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
10
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
11
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
12
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
13
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
14
|
+
/**
|
15
|
+
* Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
|
16
|
+
*
|
17
|
+
* 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:
|
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
|
+
* 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
|
+
*/
|
21
|
+
import { v4 as uuid } from 'uuid';
|
22
|
+
import { BusManager, BusMessage } from "../bus";
|
23
|
+
import { AMSComponent } from "./index";
|
24
|
+
export var AddressComponent = /*#__PURE__*/function (_AMSComponent) {
|
25
|
+
_inherits(AddressComponent, _AMSComponent);
|
26
|
+
var _super = _createSuper(AddressComponent);
|
27
|
+
function AddressComponent(options) {
|
28
|
+
_classCallCheck(this, AddressComponent);
|
29
|
+
return _super.call(this, options);
|
30
|
+
}
|
31
|
+
_createClass(AddressComponent, [{
|
32
|
+
key: "getValue",
|
33
|
+
value: function getValue(hasValidate) {
|
34
|
+
var _this = this;
|
35
|
+
return new Promise(function (resolve, reject) {
|
36
|
+
try {
|
37
|
+
var _this$getBusActionNam;
|
38
|
+
var eventCallbackId = uuid();
|
39
|
+
_this.logger.logInfo({
|
40
|
+
title: 'sdk_event_apiGetValue'
|
41
|
+
});
|
42
|
+
var actionName = (_this$getBusActionNam = _this.getBusActionNames()) === null || _this$getBusActionNam === void 0 ? void 0 : _this$getBusActionNam.getValue;
|
43
|
+
if (actionName && BusManager.isSubscribed(actionName)) {
|
44
|
+
// 执行出错了,在通用拦截器返回
|
45
|
+
BusManager.publishForResult(new BusMessage(actionName, JSON.stringify({
|
46
|
+
appendParams: _this._appendParams,
|
47
|
+
options: _this.originOptions,
|
48
|
+
data: hasValidate
|
49
|
+
}))).then(function (busMessage) {
|
50
|
+
resolve(busMessage === null || busMessage === void 0 ? void 0 : busMessage.getJSONObject());
|
51
|
+
});
|
52
|
+
} else {
|
53
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
54
|
+
_this._eventCenter.once(eventCallbackId, function (_data) {
|
55
|
+
resolve(_data);
|
56
|
+
});
|
57
|
+
_this._componentApp.dispatchToApp({
|
58
|
+
context: {
|
59
|
+
event: 'getValue',
|
60
|
+
eventCallbackId: eventCallbackId,
|
61
|
+
data: hasValidate
|
62
|
+
}
|
63
|
+
});
|
64
|
+
}
|
65
|
+
} catch (error) {
|
66
|
+
reject(error);
|
67
|
+
}
|
68
|
+
});
|
69
|
+
}
|
70
|
+
}]);
|
71
|
+
return AddressComponent;
|
72
|
+
}(AMSComponent);
|
@@ -3,12 +3,15 @@ import { componentSignEnum, IcreateComponent, IoptionsParams, IpaymentSessionMet
|
|
3
3
|
import CoreInstance from '../instance/index';
|
4
4
|
export declare const getComponentSign: (params: IpaymentSessionMetaData) => componentSignEnum;
|
5
5
|
export declare const parseSessionData: (sessionData: string) => [IpaymentSessionMetaData, string];
|
6
|
+
export type IAMSComponentOptions = IoptionsParams & {
|
7
|
+
appVersion: string;
|
8
|
+
};
|
6
9
|
export declare class AMSComponent extends CoreInstance {
|
7
10
|
_componentApp: ComponentApp;
|
8
11
|
channelType: componentSignEnum[];
|
9
12
|
productSceneVersion: string;
|
10
13
|
timer: any;
|
11
|
-
constructor(options:
|
14
|
+
constructor(options: IAMSComponentOptions);
|
12
15
|
private parameterInitAndCheck;
|
13
16
|
private pluginAppendIframe;
|
14
17
|
private savePreviousChannel;
|
@@ -31,7 +34,7 @@ export declare class AMSComponent extends CoreInstance {
|
|
31
34
|
createComponent(params: IcreateComponent): Promise<void>;
|
32
35
|
private createComponentProcess;
|
33
36
|
preloadComponent(channelType: any, productSceneVersion: any): void;
|
34
|
-
clearPreloadIframe
|
37
|
+
private clearPreloadIframe;
|
35
38
|
/**
|
36
39
|
* @description Create and render components in the specified element area
|
37
40
|
* @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,6 +17,10 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
17
17
|
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; }
|
18
18
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
19
19
|
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); }
|
20
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
21
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
22
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
23
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
20
24
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
21
25
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
22
26
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
@@ -36,7 +40,7 @@ import { ApplePayBusSubscriber } from "../../plugin/applepay";
|
|
36
40
|
import ComponentApp from "../../plugin/component";
|
37
41
|
import { ExtendPlugin } from "../../plugin/const";
|
38
42
|
import { PaypalBusSubscriber } from "../../plugin/paypal";
|
39
|
-
import { componentSignEnum, environmentEnum, modeEnum, networkModeEnum, productSceneEnum, renderDisplayTypeEnum } from "../../types";
|
43
|
+
import { componentSignEnum, ComponentSignEnumV2, environmentEnum, modeEnum, networkModeEnum, productSceneEnum, renderDisplayTypeEnum } from "../../types";
|
40
44
|
import { getOrSetStorageId, isPC, parseBase64ToString } from "../../util";
|
41
45
|
import { createIframeNode, createPreloadIframeNode } from "../../util/createIframeNode";
|
42
46
|
import { getSecurityConfigStorageKey } from "../../util/security";
|
@@ -53,7 +57,9 @@ export var getComponentSign = function getComponentSign(params) {
|
|
53
57
|
productScene = _params$paymentSessio3 === void 0 ? '' : _params$paymentSessio3,
|
54
58
|
_params$paymentSessio4 = _params$paymentSessio2.paymentMethodCategoryType,
|
55
59
|
paymentMethodCategoryType = _params$paymentSessio4 === void 0 ? '' : _params$paymentSessio4;
|
56
|
-
|
60
|
+
if (productScene && paymentMethodCategoryType) return "".concat(productScene, "_").concat(paymentMethodCategoryType);
|
61
|
+
if (productScene) return "".concat(productScene);
|
62
|
+
return componentSignEnum.NONE;
|
57
63
|
};
|
58
64
|
export var parseSessionData = function parseSessionData(sessionData) {
|
59
65
|
try {
|
@@ -85,7 +91,7 @@ var handleSessionData = function handleSessionData(originSessionData) {
|
|
85
91
|
resetEasyPaySceneVersion(parseData);
|
86
92
|
return [parseData !== null && parseData !== void 0 ? parseData : {}, sessionData];
|
87
93
|
};
|
88
|
-
var handleParams = function handleParams(params) {
|
94
|
+
var handleParams = function handleParams(params, _this) {
|
89
95
|
var _params = Object.assign({
|
90
96
|
paymentSessionMetaData: {},
|
91
97
|
renderDisplayType: renderDisplayTypeEnum.popup
|
@@ -95,6 +101,15 @@ var handleParams = function handleParams(params) {
|
|
95
101
|
parseData = _handleSessionData2[0],
|
96
102
|
sessionData = _handleSessionData2[1];
|
97
103
|
var componentSign = getComponentSign(parseData);
|
104
|
+
if (_toConsumableArray(Object.values(ComponentSignEnumV2)).includes(componentSign) && _params.renderDisplayType === renderDisplayTypeEnum.popup) {
|
105
|
+
return Promise.reject({
|
106
|
+
code: ERRORMESSAGE.CREATEPAYMENT_PARAMETER_ERROR.code,
|
107
|
+
message: "unsupported payment method"
|
108
|
+
});
|
109
|
+
}
|
110
|
+
if (_this.options.product === productSceneEnum.ELEMENT_ADDRESS) {
|
111
|
+
componentSign = componentSignEnum.ELEMENT_ADDRESS;
|
112
|
+
}
|
98
113
|
if (componentSign === componentSignEnum.NONE) {
|
99
114
|
// eslint-disable-next-line prefer-promise-reject-errors
|
100
115
|
return Promise.reject({
|
@@ -118,21 +133,23 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
118
133
|
_inherits(AMSComponent, _CoreInstance);
|
119
134
|
var _super = _createSuper(AMSComponent);
|
120
135
|
function AMSComponent(options) {
|
121
|
-
var
|
136
|
+
var _this2;
|
122
137
|
_classCallCheck(this, AMSComponent);
|
123
|
-
|
138
|
+
_this2 = _super.call(this, options);
|
124
139
|
// Instantiate the plug-in and set render
|
125
|
-
_defineProperty(_assertThisInitialized(
|
126
|
-
_defineProperty(_assertThisInitialized(
|
127
|
-
_defineProperty(_assertThisInitialized(
|
128
|
-
var ComponentPlugin = new ComponentApp(
|
140
|
+
_defineProperty(_assertThisInitialized(_this2), "channelType", void 0);
|
141
|
+
_defineProperty(_assertThisInitialized(_this2), "productSceneVersion", void 0);
|
142
|
+
_defineProperty(_assertThisInitialized(_this2), "timer", void 0);
|
143
|
+
var ComponentPlugin = new ComponentApp({
|
144
|
+
appVersion: options.appVersion
|
145
|
+
});
|
129
146
|
ComponentPlugin.setRender(createIframeNode);
|
130
147
|
ComponentPlugin.setPreloadRender(createPreloadIframeNode);
|
131
148
|
// Register Cashier Application Plug in
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
return
|
149
|
+
_this2._registerPlugin(COMPONENTPLUGINID, ComponentPlugin);
|
150
|
+
_this2._componentApp = _this2._getPlugin(COMPONENTPLUGINID);
|
151
|
+
_this2.registerBusAbility();
|
152
|
+
return _this2;
|
136
153
|
}
|
137
154
|
_createClass(AMSComponent, [{
|
138
155
|
key: "parameterInitAndCheck",
|
@@ -146,7 +163,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
146
163
|
selector: selector,
|
147
164
|
renderDisplayType: renderDisplayType
|
148
165
|
}, params);
|
149
|
-
if (_params && !_params.sessionData && !(_params !== null && _params !== void 0 && _params.paymentSessionData)) {
|
166
|
+
if (this.options.product !== productSceneEnum.ELEMENT_ADDRESS && _params && !_params.sessionData && !(_params !== null && _params !== void 0 && _params.paymentSessionData)) {
|
150
167
|
return Promise.reject(ERRORMESSAGE.CREATEPAYMENT_PARAMETER_ERROR);
|
151
168
|
}
|
152
169
|
if (this.options.networkMode === networkModeEnum.proxy) {
|
@@ -224,7 +241,6 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
224
241
|
localStorage.setItem('antom_checkout_previousChannel', JSON.stringify(previousChannel));
|
225
242
|
}
|
226
243
|
}
|
227
|
-
|
228
244
|
/**
|
229
245
|
* 初始化 Bus总线的能力
|
230
246
|
*/
|
@@ -232,12 +248,12 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
232
248
|
key: "registerBusAbility",
|
233
249
|
value: function registerBusAbility() {
|
234
250
|
var _this$originOptions,
|
235
|
-
|
251
|
+
_this3 = this;
|
236
252
|
BusManager.debugTrace(((_this$originOptions = this.originOptions) === null || _this$originOptions === void 0 ? void 0 : _this$originOptions.environment) !== environmentEnum.prod, this.logger);
|
237
253
|
BusManager.clear();
|
238
254
|
BusManager.addInterceptor({
|
239
255
|
onPublishException: function onPublishException(message, e) {
|
240
|
-
|
256
|
+
_this3.logger.logError({
|
241
257
|
title: 'onBusPublishException'
|
242
258
|
}, _objectSpread(_objectSpread({}, message), {}, {
|
243
259
|
errorMessage: JSON.stringify(e)
|
@@ -246,12 +262,12 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
246
262
|
});
|
247
263
|
// subscribe basic ablility
|
248
264
|
BusManager.subscribe(new SDKCallbackBusSubscriber(function (state) {
|
249
|
-
var
|
250
|
-
(
|
265
|
+
var _this3$_componentApp;
|
266
|
+
(_this3$_componentApp = _this3._componentApp) === null || _this3$_componentApp === void 0 || (_this3$_componentApp = _this3$_componentApp.AMSSDK) === null || _this3$_componentApp === void 0 || _this3$_componentApp._eventCenter.emit(EVENT.eventCallback.name, state);
|
251
267
|
}));
|
252
268
|
BusManager.subscribe(new SecurityBusSubscriber(function (deviceIdParameter, isPolling) {
|
253
|
-
var
|
254
|
-
return (
|
269
|
+
var _this3$_componentApp2;
|
270
|
+
return (_this3$_componentApp2 = _this3._componentApp) === null || _this3$_componentApp2 === void 0 ? void 0 : _this3$_componentApp2.getDeviceIdAndLog(deviceIdParameter, isPolling);
|
255
271
|
}));
|
256
272
|
BusManager.subscribe(new TrackerBusSubscriber(this.logger));
|
257
273
|
// subscribe plugin
|
@@ -266,7 +282,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
266
282
|
}
|
267
283
|
var paymentChannelMatcher = item.paymentChannelMatcher;
|
268
284
|
if (paymentChannelMatcher) {
|
269
|
-
|
285
|
+
_this3._registerPlugin(paymentChannelMatcher.paymentMethod, item.busActionNames);
|
270
286
|
}
|
271
287
|
var sessionMatcher = item.sessionMatcher;
|
272
288
|
if (sessionMatcher) {
|
@@ -274,19 +290,18 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
274
290
|
if (sessionMatcher.paymentMethodTypes) {
|
275
291
|
sessionMatcher.paymentMethodTypes.forEach(function (paymentMethodType) {
|
276
292
|
var subPluginKey = pluginKey + paymentMethodType;
|
277
|
-
|
293
|
+
_this3._registerPlugin(subPluginKey, item.busActionNames);
|
278
294
|
});
|
279
295
|
} else {
|
280
|
-
|
296
|
+
_this3._registerPlugin(pluginKey, item.busActionNames);
|
281
297
|
}
|
282
298
|
}
|
283
299
|
var optInit = item === null || item === void 0 || (_item$busActionNames = item.busActionNames) === null || _item$busActionNames === void 0 ? void 0 : _item$busActionNames.optional_init;
|
284
300
|
if (optInit) {
|
285
|
-
BusManager.publish(new BusMessage(optInit, JSON.stringify(
|
301
|
+
BusManager.publish(new BusMessage(optInit, JSON.stringify(_this3.originOptions)));
|
286
302
|
}
|
287
303
|
});
|
288
304
|
}
|
289
|
-
|
290
305
|
/**
|
291
306
|
* To determine whether the corresponding payment method is available,
|
292
307
|
* only the channel described in the document will be called, and it will be returned as available by default
|
@@ -297,14 +312,14 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
297
312
|
}, {
|
298
313
|
key: "canMakePayments",
|
299
314
|
value: function canMakePayments(paymentMethod, subPaymentMethod) {
|
300
|
-
var
|
315
|
+
var _this4 = this;
|
301
316
|
// 判断支付方式是否可用
|
302
317
|
return new Promise(function (resolve) {
|
303
|
-
var
|
318
|
+
var _this4$_getPlugin;
|
304
319
|
if (!paymentMethod) {
|
305
320
|
return resolve(true);
|
306
321
|
}
|
307
|
-
var actionName = (
|
322
|
+
var actionName = (_this4$_getPlugin = _this4._getPlugin(paymentMethod)) === null || _this4$_getPlugin === void 0 ? void 0 : _this4$_getPlugin.canMakePayments;
|
308
323
|
if (actionName && BusManager.isSubscribed(actionName)) {
|
309
324
|
BusManager.publishForResult(new BusMessage(actionName, JSON.stringify({
|
310
325
|
paymentMethod: paymentMethod,
|
@@ -314,7 +329,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
314
329
|
}).then(function (message) {
|
315
330
|
resolve(message.getJSONObject());
|
316
331
|
}).catch(function (e) {
|
317
|
-
|
332
|
+
_this4.logger.logInfo({
|
318
333
|
title: 'canMakePayments_error'
|
319
334
|
}, {
|
320
335
|
params: JSON.stringify(e)
|
@@ -326,7 +341,6 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
326
341
|
}
|
327
342
|
});
|
328
343
|
}
|
329
|
-
|
330
344
|
/**
|
331
345
|
* @description Create component application
|
332
346
|
* @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.
|
@@ -334,26 +348,26 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
334
348
|
}, {
|
335
349
|
key: "createComponent",
|
336
350
|
value: function createComponent(params) {
|
337
|
-
var
|
351
|
+
var _this5 = this;
|
338
352
|
this.clearPreloadIframe();
|
339
353
|
this.logger.setComponentStartTime(Date.now());
|
340
354
|
return this.parameterInitAndCheck({
|
341
355
|
params: params,
|
342
356
|
renderDisplayType: renderDisplayTypeEnum.popup
|
343
357
|
}).then(function (_params) {
|
344
|
-
return handleParams(_params);
|
358
|
+
return handleParams(_params, _this5);
|
345
359
|
}).catch(function (error) {
|
346
|
-
|
360
|
+
_this5.logger.logError({
|
347
361
|
title: 'sdk_error_parameter'
|
348
362
|
}, {
|
349
363
|
params: JSON.stringify(params)
|
350
364
|
}).send();
|
351
|
-
|
365
|
+
_this5._eventCenter.emit(EVENT.error.name, error);
|
352
366
|
return Promise.reject(error);
|
353
367
|
}).then(function (appendParams) {
|
354
368
|
var iframeNodesParams = appendParams.iframeNodesParams;
|
355
|
-
|
356
|
-
return
|
369
|
+
_this5.logger.setTrackId(iframeNodesParams === null || iframeNodesParams === void 0 ? void 0 : iframeNodesParams.sessionData);
|
370
|
+
return _this5.createComponentProcess(appendParams);
|
357
371
|
});
|
358
372
|
}
|
359
373
|
}, {
|
@@ -377,7 +391,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
377
391
|
}, {
|
378
392
|
key: "preloadComponent",
|
379
393
|
value: function preloadComponent(channelType, productSceneVersion) {
|
380
|
-
var
|
394
|
+
var _this6 = this;
|
381
395
|
this.channelType = channelType;
|
382
396
|
this.productSceneVersion = productSceneVersion;
|
383
397
|
var MAX_CLEAR_TIME = 10000;
|
@@ -393,7 +407,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
393
407
|
});
|
394
408
|
}
|
395
409
|
this.timer = setTimeout(function () {
|
396
|
-
|
410
|
+
_this6.clearPreloadIframe(true);
|
397
411
|
}, MAX_CLEAR_TIME);
|
398
412
|
}
|
399
413
|
}, {
|
@@ -425,7 +439,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
425
439
|
}, {
|
426
440
|
key: "mountComponent",
|
427
441
|
value: function mountComponent(params, selector) {
|
428
|
-
var
|
442
|
+
var _this7 = this;
|
429
443
|
this.clearPreloadIframe();
|
430
444
|
this.logger.setComponentStartTime(Date.now());
|
431
445
|
return this.parameterInitAndCheck({
|
@@ -433,19 +447,19 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
433
447
|
renderDisplayType: renderDisplayTypeEnum.inline,
|
434
448
|
selector: selector
|
435
449
|
}).then(function (_params) {
|
436
|
-
return handleParams(_params);
|
450
|
+
return handleParams(_params, _this7);
|
437
451
|
}).catch(function (error) {
|
438
|
-
|
452
|
+
_this7.logger.logError({
|
439
453
|
title: 'sdk_error_parameter'
|
440
454
|
}, {
|
441
455
|
params: JSON.stringify(params)
|
442
456
|
}).send();
|
443
|
-
|
457
|
+
_this7._eventCenter.emit(EVENT.error.name, error);
|
444
458
|
return Promise.reject(error);
|
445
459
|
}).then(function (appendParams) {
|
446
460
|
var iframeNodesParams = appendParams.iframeNodesParams;
|
447
|
-
|
448
|
-
return
|
461
|
+
_this7.logger.setTrackId(iframeNodesParams === null || iframeNodesParams === void 0 ? void 0 : iframeNodesParams.sessionData);
|
462
|
+
return _this7.mountComponentProcess(appendParams);
|
449
463
|
});
|
450
464
|
}
|
451
465
|
}, {
|
@@ -463,10 +477,11 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
463
477
|
return Promise.resolve();
|
464
478
|
}
|
465
479
|
var iframeNodesParams = appendParams.iframeNodesParams;
|
466
|
-
this.
|
480
|
+
if (this.options.product !== productSceneEnum.ELEMENT_ADDRESS) {
|
481
|
+
this.savePreviousChannel(iframeNodesParams);
|
482
|
+
}
|
467
483
|
return this.pluginAppendIframe(appendParams);
|
468
484
|
}
|
469
|
-
|
470
485
|
/**
|
471
486
|
* @description Execute payment submission process
|
472
487
|
* @description - When using your own payment button, you can execute the submit payment process by actively calling this function.
|
@@ -475,30 +490,30 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
475
490
|
}, {
|
476
491
|
key: "submit",
|
477
492
|
value: function submit(data) {
|
478
|
-
var
|
493
|
+
var _this8 = this;
|
479
494
|
return new Promise(function (resolve, reject) {
|
480
495
|
try {
|
481
|
-
var
|
496
|
+
var _this8$getBusActionNa;
|
482
497
|
var eventCallbackId = uuid();
|
483
|
-
|
498
|
+
_this8.logger.logInfo({
|
484
499
|
title: 'sdk_event_apiSubmit'
|
485
500
|
});
|
486
|
-
var actionName = (
|
501
|
+
var actionName = (_this8$getBusActionNa = _this8.getBusActionNames()) === null || _this8$getBusActionNa === void 0 ? void 0 : _this8$getBusActionNa.submit;
|
487
502
|
if (actionName && BusManager.isSubscribed(actionName)) {
|
488
503
|
// 执行出错了,在通用拦截器返回
|
489
504
|
BusManager.publishForResult(new BusMessage(actionName, JSON.stringify({
|
490
|
-
appendParams:
|
491
|
-
options:
|
505
|
+
appendParams: _this8._appendParams,
|
506
|
+
options: _this8.originOptions,
|
492
507
|
data: data
|
493
508
|
}))).then(function (busMessage) {
|
494
509
|
resolve(busMessage === null || busMessage === void 0 ? void 0 : busMessage.getJSONObject());
|
495
510
|
});
|
496
511
|
} else {
|
497
512
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
498
|
-
|
513
|
+
_this8._eventCenter.once(eventCallbackId, function (_data) {
|
499
514
|
resolve(_data);
|
500
515
|
});
|
501
|
-
|
516
|
+
_this8._componentApp.dispatchToApp({
|
502
517
|
context: {
|
503
518
|
event: 'submitPay',
|
504
519
|
eventCallbackId: eventCallbackId,
|