@alipay/ams-checkout 0.0.1716265961-dev.0 → 0.0.1716362599-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/umd/ams-checkout.min.js +1 -1
- package/esm/config/request.js +3 -3
- package/esm/core/component/appPreloadProcessing.d.ts +1 -0
- package/esm/core/component/appPreloadProcessing.js +89 -0
- package/esm/core/component/ckp/index.d.ts +41 -0
- package/esm/core/component/ckp/index.js +139 -0
- package/esm/core/component/index.js +44 -15
- package/esm/index.d.ts +6 -1
- package/esm/index.js +26 -13
- package/esm/plugin/component/cashierApp.js +3 -3
- package/esm/plugin/component/channel.d.ts +20 -0
- package/esm/plugin/component/channel.js +52 -0
- package/esm/plugin/component/component.popup.style.d.ts +4 -1
- package/esm/plugin/component/component.popup.style.js +7 -1
- package/esm/plugin/component/index.d.ts +2 -0
- package/esm/plugin/component/index.js +218 -76
- package/esm/plugin/paypal/index.js +1 -1
- package/esm/request/index.js +2 -2
- package/esm/types/index.d.ts +19 -0
- package/esm/types/index.js +3 -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
@@ -5,7 +5,10 @@ export declare const createCloseBtn: (platform: platformEnum, closeBtnFunc: () =
|
|
5
5
|
export declare const createRetentionPopup: (platform: platformEnum, remainBtnFunc: () => void, leaveBtnFunc: () => void) => void;
|
6
6
|
export declare const hideRetentionPopup: () => void;
|
7
7
|
export declare const removeRetentionPopup: (platform: platformEnum, remainBtnFunc: () => void, leaveBtnFunc: () => void) => void;
|
8
|
-
export declare const createMockup: (
|
8
|
+
export declare const createMockup: (options: {
|
9
|
+
platform: platformEnum;
|
10
|
+
onClickOutside: () => void;
|
11
|
+
}) => void;
|
9
12
|
export declare const addPopupLoading: () => void;
|
10
13
|
export declare const handleDeclareInfo: ({ closeDialogData }: {
|
11
14
|
closeDialogData: any;
|
@@ -89,7 +89,8 @@ export var removeRetentionPopup = function removeRetentionPopup(platform, remain
|
|
89
89
|
}
|
90
90
|
(_document$getElementB = document.getElementById(COMPONENT_RETENTION_ID)) === null || _document$getElementB === void 0 || _document$getElementB.remove();
|
91
91
|
};
|
92
|
-
export var createMockup = function createMockup() {
|
92
|
+
export var createMockup = function createMockup(options) {
|
93
|
+
var clickEventName = (options === null || options === void 0 ? void 0 : options.platform) === platformEnum.mobile ? 'touchend' : 'click';
|
93
94
|
var body = document.getElementsByTagName('body')[0];
|
94
95
|
body.style.overflow = 'hidden';
|
95
96
|
var mockup = document.createElement('div');
|
@@ -102,6 +103,11 @@ export var createMockup = function createMockup() {
|
|
102
103
|
mockup.style.background = 'rgba(0,0,0,0.5)';
|
103
104
|
mockup.style.display = 'none';
|
104
105
|
mockup.id = MOCKUP_ID;
|
106
|
+
// let click to close
|
107
|
+
mockup.addEventListener(clickEventName, function () {
|
108
|
+
var _options$onClickOutsi;
|
109
|
+
options === null || options === void 0 || (_options$onClickOutsi = options.onClickOutside) === null || _options$onClickOutsi === void 0 || _options$onClickOutsi.call(options);
|
110
|
+
});
|
105
111
|
body.appendChild(mockup);
|
106
112
|
};
|
107
113
|
export var addPopupLoading = function addPopupLoading() {
|
@@ -17,6 +17,7 @@ export default class ComponentApp {
|
|
17
17
|
private _selector;
|
18
18
|
private _appVersion;
|
19
19
|
private _isRetention;
|
20
|
+
private _allowSubmitPayCallAhead;
|
20
21
|
private _actionQueryPromise;
|
21
22
|
private _actionSubmitPromise;
|
22
23
|
private _renderParams;
|
@@ -81,6 +82,7 @@ export default class ComponentApp {
|
|
81
82
|
_handleAppMessage(data: eventPayload): void;
|
82
83
|
private dismissLoadingFunc;
|
83
84
|
private handleSizeChanged;
|
85
|
+
private handleAuthUrlInfo;
|
84
86
|
private handleRedirect;
|
85
87
|
private handleDeclareInfo;
|
86
88
|
private handleDeclarePopWindowCallback;
|
@@ -25,6 +25,7 @@ import { getType, isJsonString, isPC } from "../../util";
|
|
25
25
|
import { isLocalMock } from "../../util/mock";
|
26
26
|
import { matchVersion } from "../../util/versionCompare";
|
27
27
|
import { createIframe, createPreloadIframe, getAppDomain, getIframeUrl } from "./cashierApp";
|
28
|
+
import { getChannelBehavior } from "./channel";
|
28
29
|
import { addInlineLoading, createInlineBaseElement } from "./component.inline.style";
|
29
30
|
import { addPopupLoading, createBaseElement, createMockup, createRetentionPopup, handleDeclareInfo as _handleDeclareInfo, hideRetentionPopup, removeRetentionPopup as _removeRetentionPopup } from "./component.popup.style";
|
30
31
|
import { createModal, destroyModal, insertStyleSheet } from "./popupWindow.style";
|
@@ -46,6 +47,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
46
47
|
_defineProperty(this, "_selector", void 0);
|
47
48
|
_defineProperty(this, "_appVersion", void 0);
|
48
49
|
_defineProperty(this, "_isRetention", void 0);
|
50
|
+
_defineProperty(this, "_allowSubmitPayCallAhead", void 0);
|
49
51
|
_defineProperty(this, "_actionQueryPromise", null);
|
50
52
|
_defineProperty(this, "_actionSubmitPromise", null);
|
51
53
|
_defineProperty(this, "_renderParams", null);
|
@@ -55,7 +57,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
55
57
|
_defineProperty(this, "_multipleCallbackEvents", void 0);
|
56
58
|
_defineProperty(this, "_merchantAppointParam", void 0);
|
57
59
|
_defineProperty(this, "_webAppHeartBeatTimeoutFn", void 0);
|
58
|
-
this._appVersion = '1.
|
60
|
+
this._appVersion = '1.18.0';
|
59
61
|
this._isInitComponent = false;
|
60
62
|
this._selector = "#".concat(COMPONENT_SECTION_ID);
|
61
63
|
this.createIframeNode = function () {
|
@@ -112,7 +114,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
112
114
|
productSceneVersion: paymentSessionConfig === null || paymentSessionConfig === void 0 ? void 0 : paymentSessionConfig.productSceneVersion,
|
113
115
|
paymentMethodType: paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa = paymentSessionMetaData.paymentMethodInfoView) === null || _paymentSessionMetaDa === void 0 ? void 0 : _paymentSessionMetaDa.paymentMethodType,
|
114
116
|
paymentMethodCategoryType: paymentSessionConfig === null || paymentSessionConfig === void 0 ? void 0 : paymentSessionConfig.paymentMethodCategoryType,
|
115
|
-
requestSeq: (_this$_renderParams2 = this._renderParams) === null || _this$_renderParams2 === void 0 ? void 0 : _this$_renderParams2.
|
117
|
+
requestSeq: (_this$_renderParams2 = this._renderParams) === null || _this$_renderParams2 === void 0 ? void 0 : _this$_renderParams2.sessionData,
|
116
118
|
trackId: (_this$_renderParams3 = this._renderParams) === null || _this$_renderParams3 === void 0 ? void 0 : _this$_renderParams3.sessionData
|
117
119
|
});
|
118
120
|
}
|
@@ -246,6 +248,10 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
246
248
|
key: "appendIframeNodes",
|
247
249
|
value: function appendIframeNodes(componentSign, renderParams) {
|
248
250
|
var _renderParams,
|
251
|
+
_this$_renderParams5,
|
252
|
+
_this$_renderParams6,
|
253
|
+
_this$_renderParams7,
|
254
|
+
_this$_renderParams8,
|
249
255
|
_this3 = this;
|
250
256
|
if (this._isInitComponent) {
|
251
257
|
this.dispatchToSDK(EVENT.error.name, ERRORMESSAGE.CREATECOMPONENT_ERROR.SINGLETON_COMPONENT_ERROR);
|
@@ -265,6 +271,61 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
265
271
|
key: 'sdk_create_component',
|
266
272
|
value: Date.now()
|
267
273
|
});
|
274
|
+
var params = {
|
275
|
+
paymentSessionData: this._renderParams && ((_this$_renderParams5 = this._renderParams) === null || _this$_renderParams5 === void 0 ? void 0 : _this$_renderParams5.sessionData) || '',
|
276
|
+
paymentSessionConfig: (_this$_renderParams6 = this._renderParams) === null || _this$_renderParams6 === void 0 || (_this$_renderParams6 = _this$_renderParams6.paymentSessionMetaData) === null || _this$_renderParams6 === void 0 ? void 0 : _this$_renderParams6.paymentSessionConfig
|
277
|
+
};
|
278
|
+
var _ref2 = params.paymentSessionConfig || {},
|
279
|
+
_ref2$productSceneVer = _ref2.productSceneVersion,
|
280
|
+
productSceneVersion = _ref2$productSceneVer === void 0 ? '' : _ref2$productSceneVer,
|
281
|
+
_ref2$productScene = _ref2.productScene,
|
282
|
+
productScene = _ref2$productScene === void 0 ? '' : _ref2$productScene;
|
283
|
+
var _ref3 = ((_this$_renderParams7 = this._renderParams) === null || _this$_renderParams7 === void 0 ? void 0 : _this$_renderParams7.paymentSessionMetaData) || {},
|
284
|
+
_ref3$action = _ref3.action,
|
285
|
+
_ref3$action2 = _ref3$action === void 0 ? {} : _ref3$action,
|
286
|
+
_ref3$action2$autoDeb = _ref3$action2.autoDebitWithToken,
|
287
|
+
autoDebitWithToken = _ref3$action2$autoDeb === void 0 ? false : _ref3$action2$autoDeb,
|
288
|
+
_ref3$action2$require = _ref3$action2.requireFastSdk,
|
289
|
+
requireFastSdk = _ref3$action2$require === void 0 ? false : _ref3$action2$require;
|
290
|
+
var _ref4 = ((_this$_renderParams8 = this._renderParams) === null || _this$_renderParams8 === void 0 ? void 0 : _this$_renderParams8.paymentSessionMetaData) || {},
|
291
|
+
_ref4$authUrlInfo = _ref4.authUrlInfo,
|
292
|
+
authUrlInfo = _ref4$authUrlInfo === void 0 ? {} : _ref4$authUrlInfo;
|
293
|
+
this.AMSSDK.logger.logInfo({
|
294
|
+
title: 'sdk_event_createComponent'
|
295
|
+
}, {
|
296
|
+
version: productSceneVersion,
|
297
|
+
product: this.AMSSDK.options.product
|
298
|
+
}).send();
|
299
|
+
if (componentSignEnum.EASY_PAY_WALLET === this._componentSign) {
|
300
|
+
if (productScene === productSceneEnum.EASY_PAY && productSceneVersion === '1.0' && !autoDebitWithToken && requireFastSdk) {
|
301
|
+
// EASY_PAY 1.0首次支付,requireFastSdk为true,不需要接口请求
|
302
|
+
this.handleAuthUrlInfo(authUrlInfo);
|
303
|
+
return;
|
304
|
+
}
|
305
|
+
}
|
306
|
+
if (componentSignEnum.AUTO_DEBIT_WALLET === this._componentSign) {
|
307
|
+
var _this$_renderParams9, _action$web, _action$wap;
|
308
|
+
var action = ((_this$_renderParams9 = this._renderParams) === null || _this$_renderParams9 === void 0 || (_this$_renderParams9 = _this$_renderParams9.paymentSessionMetaData) === null || _this$_renderParams9 === void 0 ? void 0 : _this$_renderParams9.action) || {};
|
309
|
+
var signType = isPC() ? action === null || action === void 0 || (_action$web = action.web) === null || _action$web === void 0 ? void 0 : _action$web.signType : action === null || action === void 0 || (_action$wap = action.wap) === null || _action$wap === void 0 ? void 0 : _action$wap.signType;
|
310
|
+
var _requireFastSdk = (action === null || action === void 0 ? void 0 : action.requireFastSdk) || false;
|
311
|
+
if (signType === 'REDIRECT' && _requireFastSdk === true) {
|
312
|
+
// REDIRECT,requireFastSdk为true,不需要接口请求
|
313
|
+
this.handleAuthUrlInfo(authUrlInfo);
|
314
|
+
return;
|
315
|
+
}
|
316
|
+
}
|
317
|
+
if (componentSignEnum.AUTO_DEBIT_PAY_WALLET === this._componentSign) {
|
318
|
+
if (requireFastSdk === true && productSceneVersion === '1.0') {
|
319
|
+
// REDIRECT,requireFastSdk为true,不需要接口请求
|
320
|
+
this.handleAuthUrlInfo(authUrlInfo);
|
321
|
+
return;
|
322
|
+
} else {
|
323
|
+
return Promise.reject({
|
324
|
+
code: ERRORMESSAGE.CREATEPAYMENT_PARAMETER_ERROR.code,
|
325
|
+
message: "Abnormal response data, interface failure, or unsupported payment method."
|
326
|
+
});
|
327
|
+
}
|
328
|
+
}
|
268
329
|
this.dispatchToSDK(EVENT.eventCallback.name, {
|
269
330
|
code: eventCodeEnum.SDK_START_OF_LOADING
|
270
331
|
});
|
@@ -274,9 +335,18 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
274
335
|
insertStyleSheet();
|
275
336
|
}
|
276
337
|
if (this._renderDisplayType === renderDisplayTypeEnum.popup) {
|
338
|
+
var _this$_renderParams10;
|
277
339
|
createBaseElement(this.platform, this.closeBtnFunc.bind(this));
|
278
340
|
createRetentionPopup(this.platform, this.hideRetentionPopupFunc.bind(this), this.retentionPopupLeaveFunc.bind(this));
|
279
|
-
|
341
|
+
var channelBehavior = getChannelBehavior((_this$_renderParams10 = this._renderParams) === null || _this$_renderParams10 === void 0 ? void 0 : _this$_renderParams10.paymentSessionMetaData);
|
342
|
+
var onClickOutside = function onClickOutside() {};
|
343
|
+
if (channelBehavior !== null && channelBehavior !== void 0 && channelBehavior.allowClickOutsideClose) {
|
344
|
+
onClickOutside = this.closeBtnFunc.bind(this);
|
345
|
+
}
|
346
|
+
createMockup({
|
347
|
+
platform: this.platform,
|
348
|
+
onClickOutside: onClickOutside
|
349
|
+
});
|
280
350
|
this.renderPopupLoading(renderParams);
|
281
351
|
}
|
282
352
|
this.createApp(renderParams);
|
@@ -356,17 +426,18 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
356
426
|
}, {
|
357
427
|
key: "createActionQueryPromise",
|
358
428
|
value: function createActionQueryPromise() {
|
359
|
-
var
|
429
|
+
var _this$_renderParams11,
|
430
|
+
_this5 = this;
|
431
|
+
var paymentMethodType = (_this$_renderParams11 = this._renderParams) === null || _this$_renderParams11 === void 0 || (_this$_renderParams11 = _this$_renderParams11.paymentSessionMetaData) === null || _this$_renderParams11 === void 0 || (_this$_renderParams11 = _this$_renderParams11.paymentMethodInfoView) === null || _this$_renderParams11 === void 0 ? void 0 : _this$_renderParams11.paymentMethodType;
|
360
432
|
this._performanceData.push({
|
361
433
|
key: 'sdk_action_query_start',
|
362
434
|
value: Date.now()
|
363
435
|
});
|
364
|
-
|
365
436
|
// eslint-disable-next-line no-async-promise-executor
|
366
437
|
this._actionQueryPromise = new Promise( /*#__PURE__*/function () {
|
367
|
-
var
|
368
|
-
var _this5$_renderParams, _this5$_renderParams2, _this5$_renderParams3, _this5$_renderParams4, _this5$_renderParams5;
|
369
|
-
var envInfo, params,
|
438
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(resolve, reject) {
|
439
|
+
var _this5$_renderParams, _this5$_renderParams2, _this5$_renderParams3, _this5$_renderParams4, _this5$_renderParams5, _this5$_renderParams6;
|
440
|
+
var envInfo, params, _ref6, _ref6$extendInfo, extendInfo, actionData, enableVaultingApiOptimize, enableEasypayApiOptimize, _ref7, skipSdkQuery, skipSdkQueryForm, extendInfoData, ifSkip, channelBehavior, _this5$_renderParams7, _this5$_renderParams8, _ref8, _ref8$productSceneVer, productSceneVersion, _ref8$productScene, productScene, _ref9, _ref9$action, _ref9$action2, _ref9$action2$autoDeb, autoDebitWithToken, _this5$_renderParams9, _action$web2, _action$wap2, action, signType;
|
370
441
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
371
442
|
while (1) switch (_context2.prev = _context2.next) {
|
372
443
|
case 0:
|
@@ -382,10 +453,10 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
382
453
|
/**
|
383
454
|
* @description Simulated or unnecessary scenarios
|
384
455
|
*/
|
385
|
-
|
456
|
+
_ref6 = ((_this5$_renderParams4 = _this5._renderParams) === null || _this5$_renderParams4 === void 0 ? void 0 : _this5$_renderParams4.paymentSessionMetaData) || {}, _ref6$extendInfo = _ref6.extendInfo, extendInfo = _ref6$extendInfo === void 0 ? '' : _ref6$extendInfo, actionData = _ref6.action;
|
386
457
|
enableVaultingApiOptimize = false;
|
387
458
|
enableEasypayApiOptimize = false;
|
388
|
-
|
459
|
+
_ref7 = ((_this5$_renderParams5 = _this5._renderParams) === null || _this5$_renderParams5 === void 0 || (_this5$_renderParams5 = _this5$_renderParams5.paymentSessionMetaData) === null || _this5$_renderParams5 === void 0 ? void 0 : _this5$_renderParams5.action) || {}, skipSdkQuery = _ref7.skipSdkQuery, skipSdkQueryForm = _ref7.skipSdkQueryForm;
|
389
460
|
try {
|
390
461
|
extendInfoData = JSON.parse(extendInfo);
|
391
462
|
enableVaultingApiOptimize = extendInfoData.enableVaultingApiOptimize || false;
|
@@ -439,78 +510,89 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
439
510
|
});
|
440
511
|
return _context2.abrupt("return");
|
441
512
|
case 21:
|
513
|
+
channelBehavior = getChannelBehavior((_this5$_renderParams6 = _this5._renderParams) === null || _this5$_renderParams6 === void 0 ? void 0 : _this5$_renderParams6.paymentSessionMetaData); // Easypay TOSS 渠道无需actionQuery
|
514
|
+
if (!(channelBehavior !== null && channelBehavior !== void 0 && channelBehavior.usePaymentSessionAsQueryResult)) {
|
515
|
+
_context2.next = 24;
|
516
|
+
break;
|
517
|
+
}
|
518
|
+
return _context2.abrupt("return", resolve({
|
519
|
+
autoDebitWithToken: actionData === null || actionData === void 0 ? void 0 : actionData.autoDebitWithToken,
|
520
|
+
amountConfirmRequired: actionData === null || actionData === void 0 ? void 0 : actionData.amountConfirmRequired,
|
521
|
+
success: true
|
522
|
+
}));
|
523
|
+
case 24:
|
442
524
|
if (!(componentSignEnum.CASHIER_PAYMENT_CARD === _this5._componentSign || componentSignEnum.VAULTING_CARD === _this5._componentSign)) {
|
443
|
-
_context2.next =
|
525
|
+
_context2.next = 30;
|
444
526
|
break;
|
445
527
|
}
|
446
528
|
params.paymentMethodType = 'CARD';
|
447
|
-
_context2.next =
|
529
|
+
_context2.next = 28;
|
448
530
|
return _this5.getDeviceIdAndLog();
|
449
|
-
case
|
531
|
+
case 28:
|
450
532
|
envInfo.deviceId = _context2.sent;
|
451
533
|
if (window.navigator.userAgent.indexOf('miniProgram') > -1) {
|
452
534
|
envInfo.extendInfo = {
|
453
535
|
WAP_SUB_TYPE: 'WECHAT_MINI_PROGRAM'
|
454
536
|
};
|
455
537
|
}
|
456
|
-
case
|
538
|
+
case 30:
|
457
539
|
if (!(componentSignEnum.EASY_PAY_WALLET === _this5._componentSign)) {
|
458
|
-
_context2.next =
|
540
|
+
_context2.next = 40;
|
459
541
|
break;
|
460
542
|
}
|
461
|
-
|
462
|
-
|
463
|
-
if (!((_this5$
|
464
|
-
_context2.next =
|
543
|
+
_ref8 = params.paymentSessionConfig || {}, _ref8$productSceneVer = _ref8.productSceneVersion, productSceneVersion = _ref8$productSceneVer === void 0 ? '' : _ref8$productSceneVer, _ref8$productScene = _ref8.productScene, productScene = _ref8$productScene === void 0 ? '' : _ref8$productScene;
|
544
|
+
_ref9 = ((_this5$_renderParams7 = _this5._renderParams) === null || _this5$_renderParams7 === void 0 ? void 0 : _this5$_renderParams7.paymentSessionMetaData) || {}, _ref9$action = _ref9.action, _ref9$action2 = _ref9$action === void 0 ? {} : _ref9$action, _ref9$action2$autoDeb = _ref9$action2.autoDebitWithToken, autoDebitWithToken = _ref9$action2$autoDeb === void 0 ? false : _ref9$action2$autoDeb;
|
545
|
+
if (!((_this5$_renderParams8 = _this5._renderParams) !== null && _this5$_renderParams8 !== void 0 && (_this5$_renderParams8 = _this5$_renderParams8.paymentSessionMetaData) !== null && _this5$_renderParams8 !== void 0 && (_this5$_renderParams8 = _this5$_renderParams8.action) !== null && _this5$_renderParams8 !== void 0 && _this5$_renderParams8.skipSdkQuery && enableEasypayApiOptimize)) {
|
546
|
+
_context2.next = 35;
|
465
547
|
break;
|
466
548
|
}
|
467
549
|
return _context2.abrupt("return", resolve({
|
468
550
|
message: 'sdk no need to make query request',
|
469
551
|
success: true
|
470
552
|
}));
|
471
|
-
case
|
472
|
-
if (!(productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0'
|
473
|
-
_context2.next =
|
553
|
+
case 35:
|
554
|
+
if (!(productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0')) {
|
555
|
+
_context2.next = 37;
|
474
556
|
break;
|
475
557
|
}
|
476
558
|
return _context2.abrupt("return", resolve({
|
477
559
|
message: 'sdk no need to make query request',
|
478
560
|
success: true
|
479
561
|
}));
|
480
|
-
case
|
481
|
-
_context2.next =
|
562
|
+
case 37:
|
563
|
+
_context2.next = 39;
|
482
564
|
return _this5.getDeviceIdAndLog();
|
483
|
-
case
|
565
|
+
case 39:
|
484
566
|
envInfo.deviceId = _context2.sent;
|
485
|
-
case
|
567
|
+
case 40:
|
486
568
|
if (!(componentSignEnum.AUTO_DEBIT_WALLET === _this5._componentSign)) {
|
487
|
-
_context2.next =
|
569
|
+
_context2.next = 50;
|
488
570
|
break;
|
489
571
|
}
|
490
|
-
action = ((_this5$
|
491
|
-
signType = isPC() ? action === null || action === void 0 || (_action$
|
572
|
+
action = ((_this5$_renderParams9 = _this5._renderParams) === null || _this5$_renderParams9 === void 0 || (_this5$_renderParams9 = _this5$_renderParams9.paymentSessionMetaData) === null || _this5$_renderParams9 === void 0 ? void 0 : _this5$_renderParams9.action) || {};
|
573
|
+
signType = isPC() ? action === null || action === void 0 || (_action$web2 = action.web) === null || _action$web2 === void 0 ? void 0 : _action$web2.signType : action === null || action === void 0 || (_action$wap2 = action.wap) === null || _action$wap2 === void 0 ? void 0 : _action$wap2.signType;
|
492
574
|
if (!(signType === 'SMS')) {
|
493
|
-
_context2.next =
|
575
|
+
_context2.next = 45;
|
494
576
|
break;
|
495
577
|
}
|
496
578
|
return _context2.abrupt("return", resolve({
|
497
579
|
message: 'sdk no need to make query request',
|
498
580
|
success: true
|
499
581
|
}));
|
500
|
-
case
|
582
|
+
case 45:
|
501
583
|
if (!(!signType || signType !== 'REDIRECT')) {
|
502
|
-
_context2.next =
|
584
|
+
_context2.next = 47;
|
503
585
|
break;
|
504
586
|
}
|
505
587
|
return _context2.abrupt("return", resolve({
|
506
588
|
success: false
|
507
589
|
}));
|
508
|
-
case
|
509
|
-
_context2.next =
|
590
|
+
case 47:
|
591
|
+
_context2.next = 49;
|
510
592
|
return _this5.getDeviceIdAndLog();
|
511
|
-
case
|
593
|
+
case 49:
|
512
594
|
envInfo.deviceId = _context2.sent;
|
513
|
-
case
|
595
|
+
case 50:
|
514
596
|
_this5.AMSSDK.logger.logInfo({
|
515
597
|
title: 'sdk_event_sdkQuery'
|
516
598
|
}, {
|
@@ -549,14 +631,14 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
549
631
|
}).send();
|
550
632
|
reject(err);
|
551
633
|
});
|
552
|
-
case
|
634
|
+
case 52:
|
553
635
|
case "end":
|
554
636
|
return _context2.stop();
|
555
637
|
}
|
556
638
|
}, _callee2);
|
557
639
|
}));
|
558
640
|
return function (_x, _x2) {
|
559
|
-
return
|
641
|
+
return _ref5.apply(this, arguments);
|
560
642
|
};
|
561
643
|
}());
|
562
644
|
return this._actionQueryPromise;
|
@@ -566,46 +648,74 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
566
648
|
}, {
|
567
649
|
key: "createSubmitPromise",
|
568
650
|
value: function createSubmitPromise() {
|
569
|
-
var _this$
|
570
|
-
_this$
|
651
|
+
var _this$_renderParams12,
|
652
|
+
_this$_renderParams13,
|
653
|
+
_this$_renderParams14,
|
571
654
|
_this6 = this;
|
572
655
|
this._performanceData.push({
|
573
656
|
key: 'sdk_submit_start',
|
574
657
|
value: Date.now()
|
575
658
|
});
|
576
659
|
var params = {
|
577
|
-
paymentSessionData: this._renderParams && ((_this$
|
578
|
-
paymentSessionConfig: (_this$
|
660
|
+
paymentSessionData: this._renderParams && ((_this$_renderParams12 = this._renderParams) === null || _this$_renderParams12 === void 0 ? void 0 : _this$_renderParams12.sessionData) || '',
|
661
|
+
paymentSessionConfig: (_this$_renderParams13 = this._renderParams) === null || _this$_renderParams13 === void 0 || (_this$_renderParams13 = _this$_renderParams13.paymentSessionMetaData) === null || _this$_renderParams13 === void 0 ? void 0 : _this$_renderParams13.paymentSessionConfig
|
579
662
|
};
|
580
|
-
|
663
|
+
var channelBehavior = getChannelBehavior((_this$_renderParams14 = this._renderParams) === null || _this$_renderParams14 === void 0 ? void 0 : _this$_renderParams14.paymentSessionMetaData);
|
581
664
|
// eslint-disable-next-line no-async-promise-executor
|
582
665
|
this._actionSubmitPromise = new Promise( /*#__PURE__*/function () {
|
583
|
-
var
|
584
|
-
var _this6$_renderParams
|
666
|
+
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
|
667
|
+
var _channelBehavior$buil, _this6$_renderParams$;
|
668
|
+
var shouldSkipSubmitPayInSDK, _this6$_renderParams, _this6$_renderParams2, _ref11, _ref11$productSceneVe, productSceneVersion, _ref11$productScene, productScene, _ref12, _ref12$action, _ref12$action2, _ref12$action2$enable, enableSignAgreement, _ref12$action2$autoDe, autoDebitWithToken, extParams;
|
585
669
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
586
670
|
while (1) switch (_context3.prev = _context3.next) {
|
587
671
|
case 0:
|
588
|
-
|
589
|
-
|
672
|
+
shouldSkipSubmitPayInSDK = false;
|
673
|
+
if (channelBehavior) {
|
674
|
+
// 新逻辑走 channelBehavior判断
|
675
|
+
shouldSkipSubmitPayInSDK = !channelBehavior.submitPayInSdk;
|
676
|
+
} else {
|
677
|
+
shouldSkipSubmitPayInSDK = !((_this6$_renderParams = _this6._renderParams) !== null && _this6$_renderParams !== void 0 && (_this6$_renderParams = _this6$_renderParams.paymentSessionMetaData) !== null && _this6$_renderParams !== void 0 && (_this6$_renderParams = _this6$_renderParams.action) !== null && _this6$_renderParams !== void 0 && _this6$_renderParams.skipSdkQuery) || componentSignEnum.EASY_PAY_WALLET !== _this6._componentSign;
|
678
|
+
}
|
679
|
+
if (componentSignEnum.EASY_PAY_WALLET === _this6._componentSign) {
|
680
|
+
_ref11 = params.paymentSessionConfig || {}, _ref11$productSceneVe = _ref11.productSceneVersion, productSceneVersion = _ref11$productSceneVe === void 0 ? '' : _ref11$productSceneVe, _ref11$productScene = _ref11.productScene, productScene = _ref11$productScene === void 0 ? '' : _ref11$productScene;
|
681
|
+
_ref12 = ((_this6$_renderParams2 = _this6._renderParams) === null || _this6$_renderParams2 === void 0 ? void 0 : _this6$_renderParams2.paymentSessionMetaData) || {}, _ref12$action = _ref12.action, _ref12$action2 = _ref12$action === void 0 ? {} : _ref12$action, _ref12$action2$enable = _ref12$action2.enableSignAgreement, enableSignAgreement = _ref12$action2$enable === void 0 ? false : _ref12$action2$enable, _ref12$action2$autoDe = _ref12$action2.autoDebitWithToken, autoDebitWithToken = _ref12$action2$autoDe === void 0 ? false : _ref12$action2$autoDe;
|
682
|
+
if (productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0' && !autoDebitWithToken) {
|
683
|
+
///EasyPay 2.0 首次传signAgreement字段
|
684
|
+
params['signAgreement'] = enableSignAgreement;
|
685
|
+
}
|
686
|
+
}
|
687
|
+
// 带上标记告知WebCheckOut SDK已发送submitpay请求
|
688
|
+
_this6._allowSubmitPayCallAhead = !shouldSkipSubmitPayInSDK;
|
689
|
+
if (!shouldSkipSubmitPayInSDK) {
|
690
|
+
_context3.next = 6;
|
590
691
|
break;
|
591
692
|
}
|
592
693
|
return _context3.abrupt("return", resolve({
|
593
694
|
message: 'sdk no need to make submitPay request',
|
594
695
|
success: true
|
595
696
|
}));
|
596
|
-
case
|
697
|
+
case 6:
|
597
698
|
_this6.AMSSDK.logger.logInfo({
|
598
699
|
title: 'sdk_event_submitPay'
|
599
700
|
}, {
|
600
701
|
paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
|
601
702
|
requestBody: params
|
602
703
|
}).send();
|
704
|
+
extParams = (channelBehavior === null || channelBehavior === void 0 || (_channelBehavior$buil = channelBehavior.buildSubmitPayExtParams) === null || _channelBehavior$buil === void 0 ? void 0 : _channelBehavior$buil.call(channelBehavior, {
|
705
|
+
instanceId: _this6.AMSSDK._instanceId,
|
706
|
+
locale: _this6.AMSSDK.options.locale,
|
707
|
+
paymentMethodType: (_this6$_renderParams$ = _this6._renderParams.paymentSessionMetaData) === null || _this6$_renderParams$ === void 0 || (_this6$_renderParams$ = _this6$_renderParams$.paymentMethodInfoView) === null || _this6$_renderParams$ === void 0 ? void 0 : _this6$_renderParams$.paymentMethodType,
|
708
|
+
paymentSessionData: _this6._renderParams.sessionData,
|
709
|
+
env: _this6.AMSSDK.options.env.environment,
|
710
|
+
sdkVersion: _this6._appVersion
|
711
|
+
})) || {};
|
712
|
+
params.extParams = extParams;
|
603
713
|
_context3.t0 = submitPayInfo;
|
604
714
|
_context3.t1 = params;
|
605
715
|
_context3.t2 = _this6.AMSSDK.options.env.environment;
|
606
|
-
_context3.next =
|
716
|
+
_context3.next = 14;
|
607
717
|
return _this6.getDeviceIdAndLog();
|
608
|
-
case
|
718
|
+
case 14:
|
609
719
|
_context3.t3 = _context3.sent;
|
610
720
|
_context3.t4 = {
|
611
721
|
deviceId: _context3.t3
|
@@ -639,14 +749,14 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
639
749
|
success: false
|
640
750
|
});
|
641
751
|
});
|
642
|
-
case
|
752
|
+
case 19:
|
643
753
|
case "end":
|
644
754
|
return _context3.stop();
|
645
755
|
}
|
646
756
|
}, _callee3);
|
647
757
|
}));
|
648
758
|
return function (_x3) {
|
649
|
-
return
|
759
|
+
return _ref10.apply(this, arguments);
|
650
760
|
};
|
651
761
|
}());
|
652
762
|
}
|
@@ -766,8 +876,13 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
766
876
|
path = _getIframeUrl2.path,
|
767
877
|
locationSearch = _getIframeUrl2.locationSearch;
|
768
878
|
this._appLocationSearch = locationSearch;
|
769
|
-
|
770
|
-
|
879
|
+
// locationSearch 是一个序列化好的字符串
|
880
|
+
// 先判断path 是否有QueryParams,如果有需要扩展,否则直接拼?xx=xx
|
881
|
+
if (path.indexOf('?') !== -1) {
|
882
|
+
this.app.src = "".concat(path, "&").concat(locationSearch);
|
883
|
+
} else {
|
884
|
+
this.app.src = "".concat(path, "?").concat(locationSearch);
|
885
|
+
}
|
771
886
|
// Subscribe to messages from iframe
|
772
887
|
this.addEventListener();
|
773
888
|
} catch (error) {
|
@@ -782,7 +897,12 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
782
897
|
}, {
|
783
898
|
key: "listener",
|
784
899
|
value: function listener(e) {
|
900
|
+
var _e$data;
|
785
901
|
if (e.origin !== this.appDomain) return;
|
902
|
+
if (((_e$data = e.data) === null || _e$data === void 0 ? void 0 : _e$data.source) === 'react-devtools-content-script') {
|
903
|
+
// 防止 react 开发工具发的消息,非常频繁影响查看日志
|
904
|
+
return;
|
905
|
+
}
|
786
906
|
var isJson = isJsonString(e.data);
|
787
907
|
if (isJson) {
|
788
908
|
var data = JSON.parse(e.data);
|
@@ -1034,11 +1154,11 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1034
1154
|
return;
|
1035
1155
|
}
|
1036
1156
|
if (data.context.event === EVENT.dismissLoading.name) {
|
1037
|
-
var _data$context$data3
|
1038
|
-
this.dismissLoadingFunc(
|
1157
|
+
var _data$context$data3;
|
1158
|
+
this.dismissLoadingFunc(false);
|
1039
1159
|
this.dispatchToSDK(EVENT.eventCallback.name, {
|
1040
1160
|
code: 'SDK_END_OF_LOADING',
|
1041
|
-
message: ((_data$context$
|
1161
|
+
message: ((_data$context$data3 = data.context.data) === null || _data$context$data3 === void 0 ? void 0 : _data$context$data3.message) || ''
|
1042
1162
|
});
|
1043
1163
|
return;
|
1044
1164
|
}
|
@@ -1106,7 +1226,6 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1106
1226
|
value: function dismissLoadingFunc() {
|
1107
1227
|
var _document$getElementB2;
|
1108
1228
|
var isShowMockup = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
1109
|
-
console.log('============isShowMockup', isShowMockup);
|
1110
1229
|
var mockup = document.getElementById(MOCKUP_ID);
|
1111
1230
|
if (mockup) {
|
1112
1231
|
mockup.style.background = 'rgb(0, 0, 0, 0.6)';
|
@@ -1117,9 +1236,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1117
1236
|
}, {
|
1118
1237
|
key: "handleSizeChanged",
|
1119
1238
|
value: function handleSizeChanged(data) {
|
1120
|
-
var _data$context$
|
1239
|
+
var _data$context$data4;
|
1121
1240
|
var cashier = document.getElementById(COMPONENT_CONTAINER_ID);
|
1122
|
-
if (((_data$context$
|
1241
|
+
if (((_data$context$data4 = data.context.data) === null || _data$context$data4 === void 0 ? void 0 : _data$context$data4.height) <= 1 || data.context.data.height === parseInt(cashier.style.height)) return;
|
1123
1242
|
cashier.style.height = "".concat(data.context.data.height, "px");
|
1124
1243
|
this.app.style.opacity = '1';
|
1125
1244
|
if (this._renderDisplayType === renderDisplayTypeEnum.popup) {
|
@@ -1163,11 +1282,31 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1163
1282
|
this.app.style.height = "".concat(data.context.data.height, "px");
|
1164
1283
|
}
|
1165
1284
|
}
|
1285
|
+
}, {
|
1286
|
+
key: "handleAuthUrlInfo",
|
1287
|
+
value: function handleAuthUrlInfo(authUrlInfo) {
|
1288
|
+
var data = {};
|
1289
|
+
if (!(authUrlInfo !== null && authUrlInfo !== void 0 && authUrlInfo.normalUrl) && !(authUrlInfo !== null && authUrlInfo !== void 0 && authUrlInfo.schemeUrl) && !(authUrlInfo !== null && authUrlInfo !== void 0 && authUrlInfo.applinkUrl) && authUrlInfo !== null && authUrlInfo !== void 0 && authUrlInfo.authUrl) {
|
1290
|
+
data = {
|
1291
|
+
normalUrl: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.authUrl,
|
1292
|
+
schemeUrl: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.authUrl,
|
1293
|
+
applinkUrl: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.authUrl
|
1294
|
+
};
|
1295
|
+
} else {
|
1296
|
+
data = {
|
1297
|
+
normalUrl: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.normalUrl,
|
1298
|
+
schemeUrl: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.schemeUrl,
|
1299
|
+
applinkUrl: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.applinkUrl
|
1300
|
+
};
|
1301
|
+
}
|
1302
|
+
this.handleRedirect(data, true);
|
1303
|
+
}
|
1166
1304
|
}, {
|
1167
1305
|
key: "handleRedirect",
|
1168
1306
|
value: function handleRedirect(data) {
|
1169
1307
|
var _data$isDestroy,
|
1170
1308
|
_this7 = this;
|
1309
|
+
var fromFastSdk = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
1171
1310
|
var _data = typeof data === 'string' ? {
|
1172
1311
|
normalUrl: data
|
1173
1312
|
} : _objectSpread(_objectSpread({}, data), {}, {
|
@@ -1190,7 +1329,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1190
1329
|
}, {
|
1191
1330
|
redirectInfo: JSON.stringify(_data),
|
1192
1331
|
openType: type,
|
1193
|
-
url: url
|
1332
|
+
url: url,
|
1333
|
+
fromFastSdk: fromFastSdk
|
1194
1334
|
}).send();
|
1195
1335
|
};
|
1196
1336
|
var failCallback = function failCallback(type, url) {
|
@@ -1203,7 +1343,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1203
1343
|
}, {
|
1204
1344
|
redirectInfo: JSON.stringify(_data),
|
1205
1345
|
openType: type,
|
1206
|
-
url: url
|
1346
|
+
url: url,
|
1347
|
+
fromFastSdk: fromFastSdk
|
1207
1348
|
}).send();
|
1208
1349
|
};
|
1209
1350
|
|
@@ -1246,9 +1387,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1246
1387
|
}
|
1247
1388
|
}, {
|
1248
1389
|
key: "handleDeclareInfo",
|
1249
|
-
value: function handleDeclareInfo(
|
1250
|
-
var
|
1251
|
-
closeDialogData =
|
1390
|
+
value: function handleDeclareInfo(_ref13) {
|
1391
|
+
var _ref13$closeDialogDat = _ref13.closeDialogData,
|
1392
|
+
closeDialogData = _ref13$closeDialogDat === void 0 ? {} : _ref13$closeDialogDat;
|
1252
1393
|
_handleDeclareInfo({
|
1253
1394
|
closeDialogData: closeDialogData
|
1254
1395
|
});
|
@@ -1389,7 +1530,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1389
1530
|
key: "sendRenderEvent",
|
1390
1531
|
value: (function () {
|
1391
1532
|
var _sendRenderEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
1392
|
-
var _this$
|
1533
|
+
var _this$_renderParams15, _this$_renderParams16, _this$_renderParams17, _this$_renderParams18, _this$_renderParams19, _this$_renderParams20, _this$AMSSDK$logger, _this$_renderParams21, _this$_renderParams22, _this$_renderParams23, _this$AMSSDK, _this$_renderParams24, res, submitRes;
|
1393
1534
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
1394
1535
|
while (1) switch (_context8.prev = _context8.next) {
|
1395
1536
|
case 0:
|
@@ -1418,28 +1559,29 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1418
1559
|
data: {
|
1419
1560
|
queryResult: res,
|
1420
1561
|
submitResult: submitRes,
|
1421
|
-
sessionResult: (_this$
|
1422
|
-
paymentSessionData: (_this$
|
1562
|
+
sessionResult: (_this$_renderParams15 = this._renderParams) === null || _this$_renderParams15 === void 0 ? void 0 : _this$_renderParams15.paymentSessionMetaData,
|
1563
|
+
paymentSessionData: (_this$_renderParams16 = this._renderParams) === null || _this$_renderParams16 === void 0 ? void 0 : _this$_renderParams16.sessionData,
|
1423
1564
|
heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
|
1424
|
-
renderDisplayType: (_this$
|
1425
|
-
appearance: (_this$
|
1426
|
-
notRedirectAfterComplete: ((_this$
|
1565
|
+
renderDisplayType: (_this$_renderParams17 = this._renderParams) === null || _this$_renderParams17 === void 0 ? void 0 : _this$_renderParams17.renderDisplayType,
|
1566
|
+
appearance: (_this$_renderParams18 = this._renderParams) === null || _this$_renderParams18 === void 0 ? void 0 : _this$_renderParams18.appearance,
|
1567
|
+
notRedirectAfterComplete: ((_this$_renderParams19 = this._renderParams) === null || _this$_renderParams19 === void 0 ? void 0 : _this$_renderParams19.notRedirectAfterComplete) === true,
|
1427
1568
|
merchantAppointParam: this._merchantAppointParam,
|
1569
|
+
allowSubmitPayCallAhead: this._allowSubmitPayCallAhead,
|
1428
1570
|
envInfo: {
|
1429
1571
|
screenHeight: screen.height,
|
1430
1572
|
screenWidth: screen.width
|
1431
1573
|
},
|
1432
1574
|
logMetaData: _objectSpread(_objectSpread({
|
1433
|
-
trackId: (_this$
|
1575
|
+
trackId: (_this$_renderParams20 = this._renderParams) === null || _this$_renderParams20 === void 0 ? void 0 : _this$_renderParams20.sessionData,
|
1434
1576
|
platform: this.platform,
|
1435
1577
|
firstLogTime: (_this$AMSSDK$logger = this.AMSSDK.logger) === null || _this$AMSSDK$logger === void 0 ? void 0 : _this$AMSSDK$logger.getComponentStartTime()
|
1436
|
-
}, ((_this$
|
1437
|
-
renderDisplayType: (_this$
|
1578
|
+
}, ((_this$_renderParams21 = this._renderParams) === null || _this$_renderParams21 === void 0 || (_this$_renderParams21 = _this$_renderParams21.paymentSessionMetaData) === null || _this$_renderParams21 === void 0 ? void 0 : _this$_renderParams21.paymentSessionConfig) || {}), {}, {
|
1579
|
+
renderDisplayType: (_this$_renderParams22 = this._renderParams) === null || _this$_renderParams22 === void 0 ? void 0 : _this$_renderParams22.renderDisplayType,
|
1438
1580
|
sdkVersion: this._appVersion,
|
1439
|
-
merchantId: (_this$
|
1581
|
+
merchantId: (_this$_renderParams23 = this._renderParams) === null || _this$_renderParams23 === void 0 || (_this$_renderParams23 = _this$_renderParams23.paymentSessionMetaData) === null || _this$_renderParams23 === void 0 ? void 0 : _this$_renderParams23.clientId,
|
1440
1582
|
instanceId: (_this$AMSSDK = this.AMSSDK) === null || _this$AMSSDK === void 0 ? void 0 : _this$AMSSDK._instanceId,
|
1441
1583
|
performanceData: this._performanceData,
|
1442
|
-
paymentMethodType: (_this$
|
1584
|
+
paymentMethodType: (_this$_renderParams24 = this._renderParams) === null || _this$_renderParams24 === void 0 || (_this$_renderParams24 = _this$_renderParams24.paymentSessionMetaData) === null || _this$_renderParams24 === void 0 || (_this$_renderParams24 = _this$_renderParams24.paymentMethodInfoView) === null || _this$_renderParams24 === void 0 ? void 0 : _this$_renderParams24.paymentMethodType
|
1443
1585
|
})
|
1444
1586
|
}
|
1445
1587
|
}
|