@alipay/ams-checkout 1.15.1 → 1.16.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.
@@ -1,5 +1,6 @@
|
|
1
1
|
export function getChannelBehavior(paymentSessionMetaData) {
|
2
|
-
var _paymentSessionMetaDa, _paymentSessionMetaDa2, _paymentSessionMetaDa3, _paymentSessionMetaDa4;
|
2
|
+
var _paymentSessionMetaDa, _paymentSessionMetaDa2, _paymentSessionMetaDa3, _paymentSessionMetaDa4, _paymentSessionMetaDa5, _paymentSessionMetaDa6, _paymentSessionMetaDa7, _paymentSessionMetaDa8;
|
3
|
+
// TOSS EASYPAY 2.0
|
3
4
|
if ('BANKTRANSFER_QUICKPAY' === (paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa = paymentSessionMetaData.paymentMethodInfoView) === null || _paymentSessionMetaDa === void 0 ? void 0 : _paymentSessionMetaDa.paymentMethodType) && (paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa2 = paymentSessionMetaData.paymentSessionConfig) === null || _paymentSessionMetaDa2 === void 0 ? void 0 : _paymentSessionMetaDa2.productScene) === 'EASY_PAY' && (paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa3 = paymentSessionMetaData.paymentSessionConfig) === null || _paymentSessionMetaDa3 === void 0 ? void 0 : _paymentSessionMetaDa3.paymentMethodCategoryType) === 'APM' && (paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa4 = paymentSessionMetaData.paymentSessionConfig) === null || _paymentSessionMetaDa4 === void 0 ? void 0 : _paymentSessionMetaDa4.productSceneVersion) === '2.0') {
|
4
5
|
return {
|
5
6
|
usePaymentSessionAsQueryResult: true,
|
@@ -15,6 +16,19 @@ export function getChannelBehavior(paymentSessionMetaData) {
|
|
15
16
|
}
|
16
17
|
};
|
17
18
|
}
|
19
|
+
// TNG EASYPAY 2.0
|
20
|
+
if ('TNG' === (paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa5 = paymentSessionMetaData.paymentMethodInfoView) === null || _paymentSessionMetaDa5 === void 0 ? void 0 : _paymentSessionMetaDa5.paymentMethodType) && (paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa6 = paymentSessionMetaData.paymentSessionConfig) === null || _paymentSessionMetaDa6 === void 0 ? void 0 : _paymentSessionMetaDa6.productScene) === 'EASY_PAY' && (paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa7 = paymentSessionMetaData.paymentSessionConfig) === null || _paymentSessionMetaDa7 === void 0 ? void 0 : _paymentSessionMetaDa7.paymentMethodCategoryType) === 'WALLET' && (paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa8 = paymentSessionMetaData.paymentSessionConfig) === null || _paymentSessionMetaDa8 === void 0 ? void 0 : _paymentSessionMetaDa8.productSceneVersion) === '2.0') {
|
21
|
+
return {
|
22
|
+
usePaymentSessionAsQueryResult: false,
|
23
|
+
submitPayInSdk: false,
|
24
|
+
createIframeNode: true,
|
25
|
+
loadApp: true,
|
26
|
+
allowClickOutsideClose: false,
|
27
|
+
buildSubmitPayExtParams: function buildSubmitPayExtParams(params) {
|
28
|
+
return {};
|
29
|
+
}
|
30
|
+
};
|
31
|
+
}
|
18
32
|
return undefined;
|
19
33
|
}
|
20
34
|
export function getDoubleFaUrl(params) {
|
@@ -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;
|
@@ -47,6 +47,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
47
47
|
_defineProperty(this, "_selector", void 0);
|
48
48
|
_defineProperty(this, "_appVersion", void 0);
|
49
49
|
_defineProperty(this, "_isRetention", void 0);
|
50
|
+
_defineProperty(this, "_allowSubmitPayCallAhead", void 0);
|
50
51
|
_defineProperty(this, "_actionQueryPromise", null);
|
51
52
|
_defineProperty(this, "_actionSubmitPromise", null);
|
52
53
|
_defineProperty(this, "_renderParams", null);
|
@@ -56,7 +57,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
56
57
|
_defineProperty(this, "_multipleCallbackEvents", void 0);
|
57
58
|
_defineProperty(this, "_merchantAppointParam", void 0);
|
58
59
|
_defineProperty(this, "_webAppHeartBeatTimeoutFn", void 0);
|
59
|
-
this._appVersion = '1.
|
60
|
+
this._appVersion = '1.16.0';
|
60
61
|
this._isInitComponent = false;
|
61
62
|
this._selector = "#".concat(COMPONENT_SECTION_ID);
|
62
63
|
this.createIframeNode = function () {
|
@@ -247,6 +248,10 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
247
248
|
key: "appendIframeNodes",
|
248
249
|
value: function appendIframeNodes(componentSign, renderParams) {
|
249
250
|
var _renderParams,
|
251
|
+
_this$_renderParams5,
|
252
|
+
_this$_renderParams6,
|
253
|
+
_this$_renderParams7,
|
254
|
+
_this$_renderParams8,
|
250
255
|
_this3 = this;
|
251
256
|
if (this._isInitComponent) {
|
252
257
|
this.dispatchToSDK(EVENT.error.name, ERRORMESSAGE.CREATECOMPONENT_ERROR.SINGLETON_COMPONENT_ERROR);
|
@@ -266,6 +271,49 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
266
271
|
key: 'sdk_create_component',
|
267
272
|
value: Date.now()
|
268
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
|
+
}
|
269
317
|
this.dispatchToSDK(EVENT.eventCallback.name, {
|
270
318
|
code: eventCodeEnum.SDK_START_OF_LOADING
|
271
319
|
});
|
@@ -275,10 +323,10 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
275
323
|
insertStyleSheet();
|
276
324
|
}
|
277
325
|
if (this._renderDisplayType === renderDisplayTypeEnum.popup) {
|
278
|
-
var _this$
|
326
|
+
var _this$_renderParams10;
|
279
327
|
createBaseElement(this.platform, this.closeBtnFunc.bind(this));
|
280
328
|
createRetentionPopup(this.platform, this.hideRetentionPopupFunc.bind(this), this.retentionPopupLeaveFunc.bind(this));
|
281
|
-
var channelBehavior = getChannelBehavior((_this$
|
329
|
+
var channelBehavior = getChannelBehavior((_this$_renderParams10 = this._renderParams) === null || _this$_renderParams10 === void 0 ? void 0 : _this$_renderParams10.paymentSessionMetaData);
|
282
330
|
var onClickOutside = function onClickOutside() {};
|
283
331
|
if (channelBehavior !== null && channelBehavior !== void 0 && channelBehavior.allowClickOutsideClose) {
|
284
332
|
onClickOutside = this.closeBtnFunc.bind(this);
|
@@ -366,9 +414,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
366
414
|
}, {
|
367
415
|
key: "createActionQueryPromise",
|
368
416
|
value: function createActionQueryPromise() {
|
369
|
-
var _this$
|
417
|
+
var _this$_renderParams11,
|
370
418
|
_this5 = this;
|
371
|
-
var paymentMethodType = (_this$
|
419
|
+
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;
|
372
420
|
this._performanceData.push({
|
373
421
|
key: 'sdk_action_query_start',
|
374
422
|
value: Date.now()
|
@@ -376,9 +424,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
376
424
|
|
377
425
|
// eslint-disable-next-line no-async-promise-executor
|
378
426
|
this._actionQueryPromise = new Promise( /*#__PURE__*/function () {
|
379
|
-
var
|
427
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(resolve, reject) {
|
380
428
|
var _this5$_renderParams, _this5$_renderParams2, _this5$_renderParams3, _this5$_renderParams4, _this5$_renderParams5, _this5$_renderParams6;
|
381
|
-
var envInfo, params,
|
429
|
+
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;
|
382
430
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
383
431
|
while (1) switch (_context2.prev = _context2.next) {
|
384
432
|
case 0:
|
@@ -394,10 +442,10 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
394
442
|
/**
|
395
443
|
* @description Simulated or unnecessary scenarios
|
396
444
|
*/
|
397
|
-
|
445
|
+
_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;
|
398
446
|
enableVaultingApiOptimize = false;
|
399
447
|
enableEasypayApiOptimize = false;
|
400
|
-
|
448
|
+
_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;
|
401
449
|
try {
|
402
450
|
extendInfoData = JSON.parse(extendInfo);
|
403
451
|
enableVaultingApiOptimize = extendInfoData.enableVaultingApiOptimize || false;
|
@@ -481,8 +529,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
481
529
|
_context2.next = 40;
|
482
530
|
break;
|
483
531
|
}
|
484
|
-
|
485
|
-
|
532
|
+
_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;
|
533
|
+
_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;
|
486
534
|
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)) {
|
487
535
|
_context2.next = 35;
|
488
536
|
break;
|
@@ -492,7 +540,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
492
540
|
success: true
|
493
541
|
}));
|
494
542
|
case 35:
|
495
|
-
if (!(productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0'
|
543
|
+
if (!(productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0')) {
|
496
544
|
_context2.next = 37;
|
497
545
|
break;
|
498
546
|
}
|
@@ -511,7 +559,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
511
559
|
break;
|
512
560
|
}
|
513
561
|
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) || {};
|
514
|
-
signType = isPC() ? action === null || action === void 0 || (_action$
|
562
|
+
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;
|
515
563
|
if (!(signType === 'SMS')) {
|
516
564
|
_context2.next = 45;
|
517
565
|
break;
|
@@ -579,7 +627,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
579
627
|
}, _callee2);
|
580
628
|
}));
|
581
629
|
return function (_x, _x2) {
|
582
|
-
return
|
630
|
+
return _ref5.apply(this, arguments);
|
583
631
|
};
|
584
632
|
}());
|
585
633
|
return this._actionQueryPromise;
|
@@ -589,24 +637,24 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
589
637
|
}, {
|
590
638
|
key: "createSubmitPromise",
|
591
639
|
value: function createSubmitPromise() {
|
592
|
-
var _this$
|
593
|
-
_this$
|
594
|
-
_this$
|
640
|
+
var _this$_renderParams12,
|
641
|
+
_this$_renderParams13,
|
642
|
+
_this$_renderParams14,
|
595
643
|
_this6 = this;
|
596
644
|
this._performanceData.push({
|
597
645
|
key: 'sdk_submit_start',
|
598
646
|
value: Date.now()
|
599
647
|
});
|
600
648
|
var params = {
|
601
|
-
paymentSessionData: this._renderParams && ((_this$
|
602
|
-
paymentSessionConfig: (_this$
|
649
|
+
paymentSessionData: this._renderParams && ((_this$_renderParams12 = this._renderParams) === null || _this$_renderParams12 === void 0 ? void 0 : _this$_renderParams12.sessionData) || '',
|
650
|
+
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
|
603
651
|
};
|
604
|
-
var channelBehavior = getChannelBehavior((_this$
|
652
|
+
var channelBehavior = getChannelBehavior((_this$_renderParams14 = this._renderParams) === null || _this$_renderParams14 === void 0 ? void 0 : _this$_renderParams14.paymentSessionMetaData);
|
605
653
|
// eslint-disable-next-line no-async-promise-executor
|
606
654
|
this._actionSubmitPromise = new Promise( /*#__PURE__*/function () {
|
607
|
-
var
|
655
|
+
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
|
608
656
|
var _channelBehavior$buil, _this6$_renderParams$;
|
609
|
-
var shouldSkipSubmitPayInSDK, _this6$_renderParams, extParams;
|
657
|
+
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;
|
610
658
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
611
659
|
while (1) switch (_context3.prev = _context3.next) {
|
612
660
|
case 0:
|
@@ -617,15 +665,25 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
617
665
|
} else {
|
618
666
|
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;
|
619
667
|
}
|
668
|
+
if (componentSignEnum.EASY_PAY_WALLET === _this6._componentSign) {
|
669
|
+
_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;
|
670
|
+
_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;
|
671
|
+
if (productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0' && !autoDebitWithToken) {
|
672
|
+
///EasyPay 2.0 首次传signAgreement字段
|
673
|
+
params['signAgreement'] = enableSignAgreement;
|
674
|
+
}
|
675
|
+
}
|
676
|
+
// 带上标记告知WebCheckOut SDK已发送submitpay请求
|
677
|
+
_this6._allowSubmitPayCallAhead = !shouldSkipSubmitPayInSDK;
|
620
678
|
if (!shouldSkipSubmitPayInSDK) {
|
621
|
-
_context3.next =
|
679
|
+
_context3.next = 6;
|
622
680
|
break;
|
623
681
|
}
|
624
682
|
return _context3.abrupt("return", resolve({
|
625
683
|
message: 'sdk no need to make submitPay request',
|
626
684
|
success: true
|
627
685
|
}));
|
628
|
-
case
|
686
|
+
case 6:
|
629
687
|
_this6.AMSSDK.logger.logInfo({
|
630
688
|
title: 'sdk_event_submitPay'
|
631
689
|
}, {
|
@@ -644,9 +702,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
644
702
|
_context3.t0 = submitPayInfo;
|
645
703
|
_context3.t1 = params;
|
646
704
|
_context3.t2 = _this6.AMSSDK.options.env.environment;
|
647
|
-
_context3.next =
|
705
|
+
_context3.next = 14;
|
648
706
|
return _this6.getDeviceIdAndLog();
|
649
|
-
case
|
707
|
+
case 14:
|
650
708
|
_context3.t3 = _context3.sent;
|
651
709
|
_context3.t4 = {
|
652
710
|
deviceId: _context3.t3
|
@@ -680,14 +738,14 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
680
738
|
success: false
|
681
739
|
});
|
682
740
|
});
|
683
|
-
case
|
741
|
+
case 19:
|
684
742
|
case "end":
|
685
743
|
return _context3.stop();
|
686
744
|
}
|
687
745
|
}, _callee3);
|
688
746
|
}));
|
689
747
|
return function (_x3) {
|
690
|
-
return
|
748
|
+
return _ref10.apply(this, arguments);
|
691
749
|
};
|
692
750
|
}());
|
693
751
|
}
|
@@ -807,8 +865,13 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
807
865
|
path = _getIframeUrl2.path,
|
808
866
|
locationSearch = _getIframeUrl2.locationSearch;
|
809
867
|
this._appLocationSearch = locationSearch;
|
810
|
-
|
811
|
-
|
868
|
+
// locationSearch 是一个序列化好的字符串
|
869
|
+
// 先判断path 是否有QueryParams,如果有需要扩展,否则直接拼?xx=xx
|
870
|
+
if (path.indexOf('?') !== -1) {
|
871
|
+
this.app.src = "".concat(path, "&").concat(locationSearch);
|
872
|
+
} else {
|
873
|
+
this.app.src = "".concat(path, "?").concat(locationSearch);
|
874
|
+
}
|
812
875
|
// Subscribe to messages from iframe
|
813
876
|
this.addEventListener();
|
814
877
|
} catch (error) {
|
@@ -823,7 +886,12 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
823
886
|
}, {
|
824
887
|
key: "listener",
|
825
888
|
value: function listener(e) {
|
889
|
+
var _e$data;
|
826
890
|
if (e.origin !== this.appDomain) return;
|
891
|
+
if (((_e$data = e.data) === null || _e$data === void 0 ? void 0 : _e$data.source) === 'react-devtools-content-script') {
|
892
|
+
// 防止 react 开发工具发的消息,非常频繁影响查看日志
|
893
|
+
return;
|
894
|
+
}
|
827
895
|
var isJson = isJsonString(e.data);
|
828
896
|
if (isJson) {
|
829
897
|
var data = JSON.parse(e.data);
|
@@ -1203,11 +1271,31 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1203
1271
|
this.app.style.height = "".concat(data.context.data.height, "px");
|
1204
1272
|
}
|
1205
1273
|
}
|
1274
|
+
}, {
|
1275
|
+
key: "handleAuthUrlInfo",
|
1276
|
+
value: function handleAuthUrlInfo(authUrlInfo) {
|
1277
|
+
var data = {};
|
1278
|
+
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) {
|
1279
|
+
data = {
|
1280
|
+
normalUrl: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.authUrl,
|
1281
|
+
schemeUrl: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.authUrl,
|
1282
|
+
applinkUrl: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.authUrl
|
1283
|
+
};
|
1284
|
+
} else {
|
1285
|
+
data = {
|
1286
|
+
normalUrl: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.normalUrl,
|
1287
|
+
schemeUrl: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.schemeUrl,
|
1288
|
+
applinkUrl: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.applinkUrl
|
1289
|
+
};
|
1290
|
+
}
|
1291
|
+
this.handleRedirect(data, true);
|
1292
|
+
}
|
1206
1293
|
}, {
|
1207
1294
|
key: "handleRedirect",
|
1208
1295
|
value: function handleRedirect(data) {
|
1209
1296
|
var _data$isDestroy,
|
1210
1297
|
_this7 = this;
|
1298
|
+
var fromFastSdk = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
1211
1299
|
var _data = typeof data === 'string' ? {
|
1212
1300
|
normalUrl: data
|
1213
1301
|
} : _objectSpread(_objectSpread({}, data), {}, {
|
@@ -1230,7 +1318,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1230
1318
|
}, {
|
1231
1319
|
redirectInfo: JSON.stringify(_data),
|
1232
1320
|
openType: type,
|
1233
|
-
url: url
|
1321
|
+
url: url,
|
1322
|
+
fromFastSdk: fromFastSdk
|
1234
1323
|
}).send();
|
1235
1324
|
};
|
1236
1325
|
var failCallback = function failCallback(type, url) {
|
@@ -1243,7 +1332,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1243
1332
|
}, {
|
1244
1333
|
redirectInfo: JSON.stringify(_data),
|
1245
1334
|
openType: type,
|
1246
|
-
url: url
|
1335
|
+
url: url,
|
1336
|
+
fromFastSdk: fromFastSdk
|
1247
1337
|
}).send();
|
1248
1338
|
};
|
1249
1339
|
|
@@ -1286,9 +1376,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1286
1376
|
}
|
1287
1377
|
}, {
|
1288
1378
|
key: "handleDeclareInfo",
|
1289
|
-
value: function handleDeclareInfo(
|
1290
|
-
var
|
1291
|
-
closeDialogData =
|
1379
|
+
value: function handleDeclareInfo(_ref13) {
|
1380
|
+
var _ref13$closeDialogDat = _ref13.closeDialogData,
|
1381
|
+
closeDialogData = _ref13$closeDialogDat === void 0 ? {} : _ref13$closeDialogDat;
|
1292
1382
|
_handleDeclareInfo({
|
1293
1383
|
closeDialogData: closeDialogData
|
1294
1384
|
});
|
@@ -1429,7 +1519,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1429
1519
|
key: "sendRenderEvent",
|
1430
1520
|
value: (function () {
|
1431
1521
|
var _sendRenderEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
1432
|
-
var _this$
|
1522
|
+
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;
|
1433
1523
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
1434
1524
|
while (1) switch (_context8.prev = _context8.next) {
|
1435
1525
|
case 0:
|
@@ -1458,28 +1548,29 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1458
1548
|
data: {
|
1459
1549
|
queryResult: res,
|
1460
1550
|
submitResult: submitRes,
|
1461
|
-
sessionResult: (_this$
|
1462
|
-
paymentSessionData: (_this$
|
1551
|
+
sessionResult: (_this$_renderParams15 = this._renderParams) === null || _this$_renderParams15 === void 0 ? void 0 : _this$_renderParams15.paymentSessionMetaData,
|
1552
|
+
paymentSessionData: (_this$_renderParams16 = this._renderParams) === null || _this$_renderParams16 === void 0 ? void 0 : _this$_renderParams16.sessionData,
|
1463
1553
|
heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
|
1464
|
-
renderDisplayType: (_this$
|
1465
|
-
appearance: (_this$
|
1466
|
-
notRedirectAfterComplete: ((_this$
|
1554
|
+
renderDisplayType: (_this$_renderParams17 = this._renderParams) === null || _this$_renderParams17 === void 0 ? void 0 : _this$_renderParams17.renderDisplayType,
|
1555
|
+
appearance: (_this$_renderParams18 = this._renderParams) === null || _this$_renderParams18 === void 0 ? void 0 : _this$_renderParams18.appearance,
|
1556
|
+
notRedirectAfterComplete: ((_this$_renderParams19 = this._renderParams) === null || _this$_renderParams19 === void 0 ? void 0 : _this$_renderParams19.notRedirectAfterComplete) === true,
|
1467
1557
|
merchantAppointParam: this._merchantAppointParam,
|
1558
|
+
allowSubmitPayCallAhead: this._allowSubmitPayCallAhead,
|
1468
1559
|
envInfo: {
|
1469
1560
|
screenHeight: screen.height,
|
1470
1561
|
screenWidth: screen.width
|
1471
1562
|
},
|
1472
1563
|
logMetaData: _objectSpread(_objectSpread({
|
1473
|
-
trackId: (_this$
|
1564
|
+
trackId: (_this$_renderParams20 = this._renderParams) === null || _this$_renderParams20 === void 0 ? void 0 : _this$_renderParams20.sessionData,
|
1474
1565
|
platform: this.platform,
|
1475
1566
|
firstLogTime: (_this$AMSSDK$logger = this.AMSSDK.logger) === null || _this$AMSSDK$logger === void 0 ? void 0 : _this$AMSSDK$logger.getComponentStartTime()
|
1476
|
-
}, ((_this$
|
1477
|
-
renderDisplayType: (_this$
|
1567
|
+
}, ((_this$_renderParams21 = this._renderParams) === null || _this$_renderParams21 === void 0 || (_this$_renderParams21 = _this$_renderParams21.paymentSessionMetaData) === null || _this$_renderParams21 === void 0 ? void 0 : _this$_renderParams21.paymentSessionConfig) || {}), {}, {
|
1568
|
+
renderDisplayType: (_this$_renderParams22 = this._renderParams) === null || _this$_renderParams22 === void 0 ? void 0 : _this$_renderParams22.renderDisplayType,
|
1478
1569
|
sdkVersion: this._appVersion,
|
1479
|
-
merchantId: (_this$
|
1570
|
+
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,
|
1480
1571
|
instanceId: (_this$AMSSDK = this.AMSSDK) === null || _this$AMSSDK === void 0 ? void 0 : _this$AMSSDK._instanceId,
|
1481
1572
|
performanceData: this._performanceData,
|
1482
|
-
paymentMethodType: (_this$
|
1573
|
+
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
|
1483
1574
|
})
|
1484
1575
|
}
|
1485
1576
|
}
|
package/esm/types/index.d.ts
CHANGED
@@ -147,13 +147,22 @@ export interface IpaymentSessionMetaData {
|
|
147
147
|
action?: {
|
148
148
|
amountConfirmRequired?: boolean;
|
149
149
|
autoDebitWithToken: boolean;
|
150
|
+
enableSignAgreement?: boolean;
|
150
151
|
skipSdkQuery: boolean;
|
152
|
+
requireFastSdk: boolean;
|
151
153
|
skipSdkQueryForm?: {
|
152
154
|
value: boolean;
|
153
155
|
version: string;
|
154
156
|
platform: string;
|
155
157
|
};
|
156
158
|
};
|
159
|
+
authUrlInfo?: {
|
160
|
+
appIdentifier?: string;
|
161
|
+
applinkUrl?: string;
|
162
|
+
normalUrl?: string;
|
163
|
+
schemeUrl?: string;
|
164
|
+
authUrl?: string;
|
165
|
+
};
|
157
166
|
paymentSessionFactor?: {
|
158
167
|
extendInfo?: {
|
159
168
|
merchantCapabilities?: string[];
|