@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
@@ -25,14 +25,16 @@ import { componentSignEnum, eventCodeEnum, messageName, platformEnum, productSce
|
|
25
25
|
import { getType, isJsonString, isPC } from "../../util";
|
26
26
|
import { isLocalMock } from "../../util/mock";
|
27
27
|
import { matchVersion } from "../../util/versionCompare";
|
28
|
+
import { getBackScheme } from "../../util/getBackScheme";
|
29
|
+
import { handlePaymentSessionConfig } from "../payment-element/utils";
|
28
30
|
import { createIframe, createPreloadIframe, getAppDomain, getIframeUrl } from "./cashierApp";
|
29
31
|
import { getChannelBehavior } from "./channel";
|
30
32
|
import { addInlineLoading, createInlineBaseElement } from "./component.inline.style";
|
31
|
-
import { addPopupLoading, createBaseElement, createMockup, createRetentionPopup, handleDeclareInfo as _handleDeclareInfo, hideRetentionPopup, removeRetentionPopup as _removeRetentionPopup } from "./component.popup.style";
|
32
|
-
import { createModal, destroyModal, insertStyleSheet } from "./popupWindow.style";
|
33
|
+
import { addPopupLoading, createBaseElement, createMockup, createRetentionPopup, handleDeclareInfo as _handleDeclareInfo, hideRetentionPopup, removeRetentionPopup as _removeRetentionPopup, slideInAndOutKeyframes } from "./component.popup.style";
|
34
|
+
import { createModal, destroyModal, insertStyleSheet, removePopupLoading } from "./popupWindow.style";
|
33
35
|
window.changingPageHeight = window.innerHeight;
|
34
36
|
var ComponentApp = /*#__PURE__*/function () {
|
35
|
-
function ComponentApp() {
|
37
|
+
function ComponentApp(componentOption) {
|
36
38
|
_classCallCheck(this, ComponentApp);
|
37
39
|
_defineProperty(this, "app", void 0);
|
38
40
|
_defineProperty(this, "AMSSDK", void 0);
|
@@ -56,9 +58,10 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
56
58
|
_defineProperty(this, "_appLocationSearch", void 0);
|
57
59
|
_defineProperty(this, "_renderDisplayType", renderDisplayTypeEnum.popup);
|
58
60
|
_defineProperty(this, "_multipleCallbackEvents", void 0);
|
61
|
+
_defineProperty(this, "_isAppWebview", void 0);
|
59
62
|
_defineProperty(this, "_merchantAppointParam", void 0);
|
60
63
|
_defineProperty(this, "_webAppHeartBeatTimeoutFn", void 0);
|
61
|
-
this._appVersion =
|
64
|
+
this._appVersion = componentOption.appVersion;
|
62
65
|
this._isInitComponent = false;
|
63
66
|
this._selector = "#".concat(COMPONENT_SECTION_ID);
|
64
67
|
this.createIframeNode = function () {
|
@@ -259,12 +262,13 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
259
262
|
return Promise.reject(ERRORMESSAGE.CREATECOMPONENT_ERROR.SINGLETON_COMPONENT_ERROR);
|
260
263
|
}
|
261
264
|
renderParams = this.setParameterDefaultValues(componentSign, renderParams);
|
265
|
+
this._merchantAppointParam = renderParams.merchantAppointParam;
|
262
266
|
this._isInitComponent = true;
|
263
267
|
this._renderParams = renderParams;
|
264
268
|
this._componentSign = componentSign;
|
265
269
|
if ((_renderParams = renderParams) !== null && _renderParams !== void 0 && _renderParams.selector) this._selector = renderParams.selector;
|
266
270
|
this._renderDisplayType = renderParams.renderDisplayType;
|
267
|
-
this.
|
271
|
+
this._isAppWebview = renderParams.isAppWebview;
|
268
272
|
var insertedNode = this._renderDisplayType === renderDisplayTypeEnum.inline ? "#".concat(COMPONENT_CONTAINER_ID) : this._selector;
|
269
273
|
this.initLoggerMeta();
|
270
274
|
this.initSecurity();
|
@@ -387,10 +391,22 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
387
391
|
}, {
|
388
392
|
key: "renderInlineLoading",
|
389
393
|
value: function renderInlineLoading(renderParams, selector) {
|
390
|
-
var _renderParams$appeara;
|
394
|
+
var _renderParams$appeara, _this$_renderParams11;
|
391
395
|
var showLoading = renderParams === null || renderParams === void 0 || (_renderParams$appeara = renderParams.appearance) === null || _renderParams$appeara === void 0 ? void 0 : _renderParams$appeara.showLoading;
|
392
396
|
showLoading = typeof showLoading === 'boolean' ? showLoading : true;
|
393
|
-
|
397
|
+
var extendInfo = renderParams.paymentSessionMetaData.extendInfo;
|
398
|
+
var isExpressCheckout = false;
|
399
|
+
try {
|
400
|
+
// expressCheckout可能出现string(false) JSON.parse再转一次
|
401
|
+
isExpressCheckout = JSON.parse(JSON.parse(extendInfo).expressCheckout);
|
402
|
+
} catch (error) {
|
403
|
+
// 遇到JSON解析错误,默认false
|
404
|
+
}
|
405
|
+
if (showLoading) addInlineLoading(selector, this.platform, {
|
406
|
+
componentSign: this._componentSign,
|
407
|
+
type: (_this$_renderParams11 = this._renderParams) === null || _this$_renderParams11 === void 0 || (_this$_renderParams11 = _this$_renderParams11.appearance) === null || _this$_renderParams11 === void 0 || (_this$_renderParams11 = _this$_renderParams11.layout) === null || _this$_renderParams11 === void 0 ? void 0 : _this$_renderParams11.type,
|
408
|
+
isExpressCheckout: isExpressCheckout
|
409
|
+
});
|
394
410
|
}
|
395
411
|
}, {
|
396
412
|
key: "renderPopupLoading",
|
@@ -427,9 +443,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
427
443
|
}, {
|
428
444
|
key: "createActionQueryPromise",
|
429
445
|
value: function createActionQueryPromise() {
|
430
|
-
var
|
431
|
-
_this5 = this;
|
432
|
-
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;
|
446
|
+
var _this5 = this;
|
433
447
|
this._performanceData.push({
|
434
448
|
key: 'sdk_action_query_start',
|
435
449
|
value: Date.now()
|
@@ -438,7 +452,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
438
452
|
this._actionQueryPromise = new Promise( /*#__PURE__*/function () {
|
439
453
|
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(resolve, reject) {
|
440
454
|
var _this5$_renderParams, _this5$_renderParams2, _this5$_renderParams3, _this5$_renderParams4, _this5$_renderParams5, _this5$_renderParams6;
|
441
|
-
var envInfo, params, _ref6, _ref6$extendInfo, extendInfo, actionData, enableVaultingApiOptimize, enableEasypayApiOptimize, _ref7, skipSdkQuery, skipSdkQueryForm, extendInfoData, ifSkip, channelBehavior, _this5$_renderParams7,
|
455
|
+
var envInfo, params, _ref6, _ref6$extendInfo, extendInfo, actionData, enableVaultingApiOptimize, enableEasypayApiOptimize, _ref7, skipSdkQuery, skipSdkQueryForm, extendInfoData, ifSkip, channelBehavior, _this5$_renderParams7, _ref8, _ref8$productSceneVer, productSceneVersion, _ref8$productScene, productScene, _this5$_renderParams8, _action$web2, _action$wap2, action, signType;
|
442
456
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
443
457
|
while (1) switch (_context2.prev = _context2.next) {
|
444
458
|
case 0:
|
@@ -474,22 +488,35 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
474
488
|
success: true
|
475
489
|
}));
|
476
490
|
case 9:
|
491
|
+
if (componentSignEnum.ELEMENT_PAYMENT === _this5._componentSign) {
|
492
|
+
params.paymentSessionConfig = handlePaymentSessionConfig(params.paymentSessionConfig);
|
493
|
+
}
|
494
|
+
/** 地址组件跳过接口查询 */
|
495
|
+
if (!(componentSignEnum.ELEMENT_ADDRESS === _this5._componentSign)) {
|
496
|
+
_context2.next = 12;
|
497
|
+
break;
|
498
|
+
}
|
499
|
+
return _context2.abrupt("return", resolve({
|
500
|
+
message: 'sdk no need to make query request',
|
501
|
+
success: true
|
502
|
+
}));
|
503
|
+
case 12:
|
477
504
|
if (!(componentSignEnum.VAULTING_CARD === _this5._componentSign)) {
|
478
|
-
_context2.next =
|
505
|
+
_context2.next = 24;
|
479
506
|
break;
|
480
507
|
}
|
481
508
|
if (!enableVaultingApiOptimize) {
|
482
|
-
_context2.next =
|
509
|
+
_context2.next = 24;
|
483
510
|
break;
|
484
511
|
}
|
485
512
|
if (!skipSdkQueryForm) {
|
486
|
-
_context2.next =
|
513
|
+
_context2.next = 21;
|
487
514
|
break;
|
488
515
|
}
|
489
516
|
// 优先判断 skipSdkQueryForm
|
490
517
|
ifSkip = matchVersion(skipSdkQueryForm, _this5._appVersion);
|
491
518
|
if (!ifSkip) {
|
492
|
-
_context2.next =
|
519
|
+
_context2.next = 19;
|
493
520
|
break;
|
494
521
|
}
|
495
522
|
resolve({
|
@@ -497,12 +524,12 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
497
524
|
success: true
|
498
525
|
});
|
499
526
|
return _context2.abrupt("return");
|
500
|
-
case
|
501
|
-
_context2.next =
|
527
|
+
case 19:
|
528
|
+
_context2.next = 24;
|
502
529
|
break;
|
503
|
-
case
|
530
|
+
case 21:
|
504
531
|
if (!skipSdkQuery) {
|
505
|
-
_context2.next =
|
532
|
+
_context2.next = 24;
|
506
533
|
break;
|
507
534
|
}
|
508
535
|
resolve({
|
@@ -510,10 +537,10 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
510
537
|
success: true
|
511
538
|
});
|
512
539
|
return _context2.abrupt("return");
|
513
|
-
case
|
540
|
+
case 24:
|
514
541
|
channelBehavior = getChannelBehavior((_this5$_renderParams6 = _this5._renderParams) === null || _this5$_renderParams6 === void 0 ? void 0 : _this5$_renderParams6.paymentSessionMetaData); // Easypay TOSS 渠道无需actionQuery
|
515
542
|
if (!(channelBehavior !== null && channelBehavior !== void 0 && channelBehavior.usePaymentSessionAsQueryResult)) {
|
516
|
-
_context2.next =
|
543
|
+
_context2.next = 27;
|
517
544
|
break;
|
518
545
|
}
|
519
546
|
return _context2.abrupt("return", resolve({
|
@@ -521,79 +548,78 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
521
548
|
amountConfirmRequired: actionData === null || actionData === void 0 ? void 0 : actionData.amountConfirmRequired,
|
522
549
|
success: true
|
523
550
|
}));
|
524
|
-
case
|
551
|
+
case 27:
|
525
552
|
if (!(componentSignEnum.CASHIER_PAYMENT_CARD === _this5._componentSign || componentSignEnum.VAULTING_CARD === _this5._componentSign)) {
|
526
|
-
_context2.next =
|
553
|
+
_context2.next = 33;
|
527
554
|
break;
|
528
555
|
}
|
529
556
|
params.paymentMethodType = 'CARD';
|
530
|
-
_context2.next =
|
557
|
+
_context2.next = 31;
|
531
558
|
return _this5.getDeviceIdAndLog();
|
532
|
-
case
|
559
|
+
case 31:
|
533
560
|
envInfo.deviceId = _context2.sent;
|
534
561
|
if (window.navigator.userAgent.indexOf('miniProgram') > -1) {
|
535
562
|
envInfo.extendInfo = {
|
536
563
|
WAP_SUB_TYPE: 'WECHAT_MINI_PROGRAM'
|
537
564
|
};
|
538
565
|
}
|
539
|
-
case
|
566
|
+
case 33:
|
540
567
|
if (!(componentSignEnum.EASY_PAY_WALLET === _this5._componentSign)) {
|
541
|
-
_context2.next =
|
568
|
+
_context2.next = 42;
|
542
569
|
break;
|
543
570
|
}
|
544
571
|
_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;
|
545
|
-
|
546
|
-
|
547
|
-
_context2.next = 35;
|
572
|
+
if (!((_this5$_renderParams7 = _this5._renderParams) !== null && _this5$_renderParams7 !== void 0 && (_this5$_renderParams7 = _this5$_renderParams7.paymentSessionMetaData) !== null && _this5$_renderParams7 !== void 0 && (_this5$_renderParams7 = _this5$_renderParams7.action) !== null && _this5$_renderParams7 !== void 0 && _this5$_renderParams7.skipSdkQuery && enableEasypayApiOptimize)) {
|
573
|
+
_context2.next = 37;
|
548
574
|
break;
|
549
575
|
}
|
550
576
|
return _context2.abrupt("return", resolve({
|
551
577
|
message: 'sdk no need to make query request',
|
552
578
|
success: true
|
553
579
|
}));
|
554
|
-
case
|
580
|
+
case 37:
|
555
581
|
if (!(productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0')) {
|
556
|
-
_context2.next =
|
582
|
+
_context2.next = 39;
|
557
583
|
break;
|
558
584
|
}
|
559
585
|
return _context2.abrupt("return", resolve({
|
560
586
|
message: 'sdk no need to make query request',
|
561
587
|
success: true
|
562
588
|
}));
|
563
|
-
case 37:
|
564
|
-
_context2.next = 39;
|
565
|
-
return _this5.getDeviceIdAndLog();
|
566
589
|
case 39:
|
590
|
+
_context2.next = 41;
|
591
|
+
return _this5.getDeviceIdAndLog();
|
592
|
+
case 41:
|
567
593
|
envInfo.deviceId = _context2.sent;
|
568
|
-
case
|
594
|
+
case 42:
|
569
595
|
if (!(componentSignEnum.AUTO_DEBIT_WALLET === _this5._componentSign)) {
|
570
|
-
_context2.next =
|
596
|
+
_context2.next = 52;
|
571
597
|
break;
|
572
598
|
}
|
573
|
-
action = ((_this5$
|
599
|
+
action = ((_this5$_renderParams8 = _this5._renderParams) === null || _this5$_renderParams8 === void 0 || (_this5$_renderParams8 = _this5$_renderParams8.paymentSessionMetaData) === null || _this5$_renderParams8 === void 0 ? void 0 : _this5$_renderParams8.action) || {};
|
574
600
|
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;
|
575
601
|
if (!(signType === 'SMS')) {
|
576
|
-
_context2.next =
|
602
|
+
_context2.next = 47;
|
577
603
|
break;
|
578
604
|
}
|
579
605
|
return _context2.abrupt("return", resolve({
|
580
606
|
message: 'sdk no need to make query request',
|
581
607
|
success: true
|
582
608
|
}));
|
583
|
-
case
|
609
|
+
case 47:
|
584
610
|
if (!(!signType || signType !== 'REDIRECT')) {
|
585
|
-
_context2.next =
|
611
|
+
_context2.next = 49;
|
586
612
|
break;
|
587
613
|
}
|
588
614
|
return _context2.abrupt("return", resolve({
|
589
615
|
success: false
|
590
616
|
}));
|
591
|
-
case 47:
|
592
|
-
_context2.next = 49;
|
593
|
-
return _this5.getDeviceIdAndLog();
|
594
617
|
case 49:
|
618
|
+
_context2.next = 51;
|
619
|
+
return _this5.getDeviceIdAndLog();
|
620
|
+
case 51:
|
595
621
|
envInfo.deviceId = _context2.sent;
|
596
|
-
case
|
622
|
+
case 52:
|
597
623
|
_this5.AMSSDK.logger.logInfo({
|
598
624
|
title: 'sdk_event_sdkQuery'
|
599
625
|
}, {
|
@@ -632,7 +658,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
632
658
|
}).send();
|
633
659
|
reject(err);
|
634
660
|
});
|
635
|
-
case
|
661
|
+
case 54:
|
636
662
|
case "end":
|
637
663
|
return _context2.stop();
|
638
664
|
}
|
@@ -664,12 +690,21 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
664
690
|
var channelBehavior = getChannelBehavior((_this$_renderParams14 = this._renderParams) === null || _this$_renderParams14 === void 0 ? void 0 : _this$_renderParams14.paymentSessionMetaData);
|
665
691
|
// eslint-disable-next-line no-async-promise-executor
|
666
692
|
this._actionSubmitPromise = new Promise( /*#__PURE__*/function () {
|
667
|
-
var
|
693
|
+
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
|
668
694
|
var _channelBehavior$buil, _this6$_renderParams$;
|
669
|
-
var shouldSkipSubmitPayInSDK, _this6$_renderParams, _this6$_renderParams2,
|
695
|
+
var shouldSkipSubmitPayInSDK, _this6$_renderParams, _this6$_renderParams2, _this6$_renderParams3, _ref10, _ref10$productSceneVe, productSceneVersion, _ref10$productScene, productScene, _ref11, _ref11$action, _ref11$action2, _ref11$action2$enable, enableSignAgreement, _ref11$action2$autoDe, autoDebitWithToken, _ref12, _ref12$paymentMethodI, _ref12$paymentMethodI2, _ref12$paymentMethodI3, paymentMethodType, isAppWebview, backScheme, extParams;
|
670
696
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
671
697
|
while (1) switch (_context3.prev = _context3.next) {
|
672
698
|
case 0:
|
699
|
+
if (!(_this6.AMSSDK.options.product === productSceneEnum.ELEMENT_ADDRESS)) {
|
700
|
+
_context3.next = 2;
|
701
|
+
break;
|
702
|
+
}
|
703
|
+
return _context3.abrupt("return", resolve({
|
704
|
+
message: 'sdk no need to make submitPay request',
|
705
|
+
success: true
|
706
|
+
}));
|
707
|
+
case 2:
|
673
708
|
shouldSkipSubmitPayInSDK = false;
|
674
709
|
if (channelBehavior) {
|
675
710
|
// 新逻辑走 channelBehavior判断
|
@@ -678,24 +713,31 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
678
713
|
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;
|
679
714
|
}
|
680
715
|
if (componentSignEnum.EASY_PAY_WALLET === _this6._componentSign) {
|
681
|
-
|
682
|
-
|
716
|
+
_ref10 = params.paymentSessionConfig || {}, _ref10$productSceneVe = _ref10.productSceneVersion, productSceneVersion = _ref10$productSceneVe === void 0 ? '' : _ref10$productSceneVe, _ref10$productScene = _ref10.productScene, productScene = _ref10$productScene === void 0 ? '' : _ref10$productScene;
|
717
|
+
_ref11 = ((_this6$_renderParams2 = _this6._renderParams) === null || _this6$_renderParams2 === void 0 ? void 0 : _this6$_renderParams2.paymentSessionMetaData) || {}, _ref11$action = _ref11.action, _ref11$action2 = _ref11$action === void 0 ? {} : _ref11$action, _ref11$action2$enable = _ref11$action2.enableSignAgreement, enableSignAgreement = _ref11$action2$enable === void 0 ? false : _ref11$action2$enable, _ref11$action2$autoDe = _ref11$action2.autoDebitWithToken, autoDebitWithToken = _ref11$action2$autoDe === void 0 ? false : _ref11$action2$autoDe;
|
718
|
+
_ref12 = ((_this6$_renderParams3 = _this6._renderParams) === null || _this6$_renderParams3 === void 0 ? void 0 : _this6$_renderParams3.paymentSessionMetaData) || {}, _ref12$paymentMethodI = _ref12.paymentMethodInfoView, _ref12$paymentMethodI2 = _ref12$paymentMethodI === void 0 ? {} : _ref12$paymentMethodI, _ref12$paymentMethodI3 = _ref12$paymentMethodI2.paymentMethodType, paymentMethodType = _ref12$paymentMethodI3 === void 0 ? '' : _ref12$paymentMethodI3;
|
683
719
|
if (productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0' && !autoDebitWithToken) {
|
684
|
-
///EasyPay 2.0 首次传signAgreement字段
|
720
|
+
isAppWebview = _this6._isAppWebview || false; ///EasyPay 2.0 首次传signAgreement字段
|
685
721
|
params['signAgreement'] = enableSignAgreement;
|
722
|
+
if (paymentMethodType == 'ALIPAY_CN' && !isAppWebview) {
|
723
|
+
backScheme = getBackScheme(undefined, _this6.AMSSDK.logger);
|
724
|
+
if (backScheme && backScheme !== 'https') {
|
725
|
+
params['h5FromApp'] = encodeURIComponent(backScheme);
|
726
|
+
}
|
727
|
+
}
|
686
728
|
}
|
687
729
|
}
|
688
730
|
// 带上标记告知WebCheckOut SDK已发送submitpay请求
|
689
731
|
_this6._allowSubmitPayCallAhead = !shouldSkipSubmitPayInSDK;
|
690
732
|
if (!shouldSkipSubmitPayInSDK) {
|
691
|
-
_context3.next =
|
733
|
+
_context3.next = 8;
|
692
734
|
break;
|
693
735
|
}
|
694
736
|
return _context3.abrupt("return", resolve({
|
695
737
|
message: 'sdk no need to make submitPay request',
|
696
738
|
success: true
|
697
739
|
}));
|
698
|
-
case
|
740
|
+
case 8:
|
699
741
|
_this6.AMSSDK.logger.logInfo({
|
700
742
|
title: 'sdk_event_submitPay'
|
701
743
|
}, {
|
@@ -714,9 +756,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
714
756
|
_context3.t0 = submitPayInfo;
|
715
757
|
_context3.t1 = params;
|
716
758
|
_context3.t2 = _this6.AMSSDK.options.env.environment;
|
717
|
-
_context3.next =
|
759
|
+
_context3.next = 16;
|
718
760
|
return _this6.getDeviceIdAndLog();
|
719
|
-
case
|
761
|
+
case 16:
|
720
762
|
_context3.t3 = _context3.sent;
|
721
763
|
_context3.t4 = {
|
722
764
|
deviceId: _context3.t3
|
@@ -750,14 +792,14 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
750
792
|
success: false
|
751
793
|
});
|
752
794
|
});
|
753
|
-
case
|
795
|
+
case 21:
|
754
796
|
case "end":
|
755
797
|
return _context3.stop();
|
756
798
|
}
|
757
799
|
}, _callee3);
|
758
800
|
}));
|
759
801
|
return function (_x3) {
|
760
|
-
return
|
802
|
+
return _ref9.apply(this, arguments);
|
761
803
|
};
|
762
804
|
}());
|
763
805
|
}
|
@@ -798,19 +840,17 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
798
840
|
value: function createPreloadApp(componentSign) {
|
799
841
|
var productSceneVersion = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '1.0';
|
800
842
|
var preloadIframe = createPreloadIframe(componentSign, productSceneVersion);
|
843
|
+
var productScene = componentSign.split(/_(?=[^_]*$)/)[0];
|
801
844
|
var _getIframeUrl = getIframeUrl({
|
802
845
|
renderDisplayType: renderDisplayTypeEnum.popup,
|
803
846
|
componentSign: componentSign,
|
804
847
|
analytics: {
|
805
848
|
enabled: false
|
806
849
|
},
|
807
|
-
productScene:
|
850
|
+
productScene: productScene,
|
808
851
|
productSceneVersion: productSceneVersion,
|
809
852
|
environment: this.AMSSDK.options.env.environment,
|
810
|
-
// TODO 确定一下这个参数是干啥的
|
811
853
|
appVersion: this._appVersion,
|
812
|
-
extendInfo: '',
|
813
|
-
locale: '',
|
814
854
|
instanceId: '',
|
815
855
|
isPreload: 'true',
|
816
856
|
mid: ''
|
@@ -934,7 +974,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
934
974
|
key: "createDialog",
|
935
975
|
value: function () {
|
936
976
|
var _createDialog = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(data) {
|
937
|
-
var pageUrl, isLoad, timeout, logTimeout;
|
977
|
+
var pageUrl, _data$device, isLoad, timeout, logTimeout;
|
938
978
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
939
979
|
while (1) switch (_context4.prev = _context4.next) {
|
940
980
|
case 0:
|
@@ -944,8 +984,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
944
984
|
_context4.next = 5;
|
945
985
|
return createModal({
|
946
986
|
widthPadding: data === null || data === void 0 ? void 0 : data.widthPadding,
|
947
|
-
|
948
|
-
|
987
|
+
device: (_data$device = data === null || data === void 0 ? void 0 : data.device) !== null && _data$device !== void 0 ? _data$device : this.platform,
|
988
|
+
loadingConfig: data === null || data === void 0 ? void 0 : data.loadingConfig,
|
949
989
|
url: pageUrl
|
950
990
|
});
|
951
991
|
case 5:
|
@@ -964,6 +1004,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
964
1004
|
}, POPUP_LOADTIME_LOG_LIMIT);
|
965
1005
|
this.popupApp.onload = function () {
|
966
1006
|
isLoad = true;
|
1007
|
+
removePopupLoading();
|
967
1008
|
clearTimeout(timeout);
|
968
1009
|
clearTimeout(logTimeout);
|
969
1010
|
};
|
@@ -1275,9 +1316,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1275
1316
|
|
1276
1317
|
// 此style用于弹窗出现和高度变化时动画,动画不同,属性不同
|
1277
1318
|
this.app.style.height = parseInt(this.app.style.height) > 0 ? '100%' : "".concat(data.context.data.height, "px");
|
1278
|
-
|
1279
1319
|
// 弹出和弹入动画
|
1280
|
-
var runkeyframes =
|
1320
|
+
var runkeyframes = slideInAndOutKeyframes(COMPONENT_CONTAINER_ID, data.context.data.height);
|
1281
1321
|
// 创建style标签
|
1282
1322
|
var style = document.createElement('style');
|
1283
1323
|
style.id = animationStyleId;
|
@@ -1287,7 +1327,6 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1287
1327
|
style.innerHTML = runkeyframes;
|
1288
1328
|
// 将style样式存放到head标签
|
1289
1329
|
document.getElementsByTagName('head')[0].appendChild(style);
|
1290
|
-
|
1291
1330
|
// size变动时动画
|
1292
1331
|
setTimeout(function () {
|
1293
1332
|
cashier.style.transition = 'height 0.28s ease-in-out';
|
@@ -1325,6 +1364,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1325
1364
|
key: "handleRedirect",
|
1326
1365
|
value: function handleRedirect(data) {
|
1327
1366
|
var _data$isDestroy,
|
1367
|
+
_data$isCallApp,
|
1368
|
+
_data$callAppDetectSu,
|
1328
1369
|
_this7 = this;
|
1329
1370
|
var fromFastSdk = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
1330
1371
|
var _data = typeof data === 'string' ? {
|
@@ -1334,38 +1375,48 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1334
1375
|
schemeUrl: (data === null || data === void 0 ? void 0 : data.schemeUrl) || '',
|
1335
1376
|
normalUrl: (data === null || data === void 0 ? void 0 : data.normalUrl) || '',
|
1336
1377
|
target: data === null || data === void 0 ? void 0 : data.target,
|
1337
|
-
isDestroy: (_data$isDestroy = data === null || data === void 0 ? void 0 : data.isDestroy) !== null && _data$isDestroy !== void 0 ? _data$isDestroy : true
|
1378
|
+
isDestroy: (_data$isDestroy = data === null || data === void 0 ? void 0 : data.isDestroy) !== null && _data$isDestroy !== void 0 ? _data$isDestroy : true,
|
1379
|
+
isCallApp: (_data$isCallApp = data === null || data === void 0 ? void 0 : data.isCallApp) !== null && _data$isCallApp !== void 0 ? _data$isCallApp : false,
|
1380
|
+
callAppDetectSuccessDelay: (_data$callAppDetectSu = data === null || data === void 0 ? void 0 : data.callAppDetectSuccessDelay) !== null && _data$callAppDetectSu !== void 0 ? _data$callAppDetectSu : 2000
|
1338
1381
|
});
|
1339
1382
|
this.AMSSDK.logger.logInfo({
|
1340
1383
|
title: 'sdk_event_call_url_start'
|
1341
1384
|
}, _objectSpread({}, data)).send();
|
1342
|
-
var successCallback = function successCallback(type, url) {
|
1385
|
+
var successCallback = function successCallback(type, url, durationInSeconds) {
|
1343
1386
|
_this7.dispatchToSDK(EVENT.eventCallback.name, {
|
1344
1387
|
code: eventCodeEnum.SDK_CALL_URL_SUCCESS,
|
1345
1388
|
message: "Successfully opened the app,".concat(type, ": ").concat(url)
|
1346
1389
|
});
|
1347
|
-
|
1348
|
-
title: 'sdk_event_call_url_success'
|
1349
|
-
}, {
|
1390
|
+
var extra = {
|
1350
1391
|
redirectInfo: JSON.stringify(_data),
|
1351
1392
|
openType: type,
|
1352
1393
|
url: url,
|
1353
1394
|
fromFastSdk: fromFastSdk
|
1354
|
-
}
|
1395
|
+
};
|
1396
|
+
if (durationInSeconds) {
|
1397
|
+
extra['durationInSeconds'] = durationInSeconds;
|
1398
|
+
}
|
1399
|
+
_this7.AMSSDK.logger.logInfo({
|
1400
|
+
title: 'sdk_event_call_url_success'
|
1401
|
+
}, extra).send();
|
1355
1402
|
};
|
1356
|
-
var failCallback = function failCallback(type, url) {
|
1403
|
+
var failCallback = function failCallback(type, url, durationInSeconds) {
|
1357
1404
|
_this7.dispatchToSDK(EVENT.eventCallback.name, {
|
1358
1405
|
code: eventCodeEnum.SDK_CALL_URL_ERROR,
|
1359
1406
|
message: "Failed to open app,applinkUrl: ".concat(_data === null || _data === void 0 ? void 0 : _data.applinkUrl, " schemeUrl: ").concat(_data === null || _data === void 0 ? void 0 : _data.schemeUrl, " normalUrl: ").concat(_data === null || _data === void 0 ? void 0 : _data.normalUrl)
|
1360
1407
|
});
|
1361
|
-
|
1362
|
-
title: 'sdk_error_call_url_failed'
|
1363
|
-
}, {
|
1408
|
+
var extra = {
|
1364
1409
|
redirectInfo: JSON.stringify(_data),
|
1365
1410
|
openType: type,
|
1366
1411
|
url: url,
|
1367
1412
|
fromFastSdk: fromFastSdk
|
1368
|
-
}
|
1413
|
+
};
|
1414
|
+
if (durationInSeconds) {
|
1415
|
+
extra['durationInSeconds'] = durationInSeconds;
|
1416
|
+
}
|
1417
|
+
_this7.AMSSDK.logger.logInfo({
|
1418
|
+
title: 'sdk_error_call_url_failed'
|
1419
|
+
}, extra).send();
|
1369
1420
|
};
|
1370
1421
|
|
1371
1422
|
// 支持 target: _blank,新开tab页打开
|
@@ -1383,6 +1434,26 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1383
1434
|
}
|
1384
1435
|
// 销毁iframe和全局loading
|
1385
1436
|
if (_data !== null && _data !== void 0 && _data.isDestroy) this.cleanContainer();
|
1437
|
+
// 唤端
|
1438
|
+
if (_data !== null && _data !== void 0 && _data.isCallApp && _data !== null && _data !== void 0 && _data.schemeUrl) {
|
1439
|
+
var startCallAppTime = new Date();
|
1440
|
+
var detectSuccessDelay = typeof (data === null || data === void 0 ? void 0 : data.callAppDetectSuccessDelay) === 'number' ? data.callAppDetectSuccessDelay : 5000;
|
1441
|
+
this.AMSSDK._redirect({
|
1442
|
+
schemeUrl: _data === null || _data === void 0 ? void 0 : _data.schemeUrl,
|
1443
|
+
callAppJudgeTime: detectSuccessDelay
|
1444
|
+
}).then(function () {
|
1445
|
+
var endCallAppTime = new Date();
|
1446
|
+
var durationInMilliseconds = endCallAppTime.getTime() - startCallAppTime.getTime();
|
1447
|
+
var durationInSeconds = durationInMilliseconds / 1000;
|
1448
|
+
successCallback(RedirectType.SchemeUrl, _data === null || _data === void 0 ? void 0 : _data.schemeUrl, durationInSeconds);
|
1449
|
+
}).catch(function () {
|
1450
|
+
var endCallAppTime = new Date();
|
1451
|
+
var durationInMilliseconds = endCallAppTime.getTime() - startCallAppTime.getTime();
|
1452
|
+
var durationInSeconds = durationInMilliseconds / 1000;
|
1453
|
+
failCallback(RedirectType.SchemeUrl, _data.schemeUrl, durationInSeconds);
|
1454
|
+
});
|
1455
|
+
return;
|
1456
|
+
}
|
1386
1457
|
this.AMSSDK._redirect({
|
1387
1458
|
applinkUrl: _data === null || _data === void 0 ? void 0 : _data.applinkUrl
|
1388
1459
|
}).then(function () {
|
@@ -1550,24 +1621,25 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1550
1621
|
key: "sendRenderEvent",
|
1551
1622
|
value: (function () {
|
1552
1623
|
var _sendRenderEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
1553
|
-
var _this$_renderParams15, _this$_renderParams16, _this$_renderParams17, _this$_renderParams18, _this$_renderParams19, _this$_renderParams20, _this$AMSSDK$logger, _this$
|
1624
|
+
var _this$_renderParams15, _this$_renderParams16, _this$_renderParams17, _this$_renderParams18, _this$_renderParams19, _this$_renderParams20, _this$_renderParams21, _this$_renderParams22, _this$_renderParams23, _this$AMSSDK$logger, _this$_renderParams24, _this$_renderParams25, _this$_renderParams26, _this$AMSSDK, _this$_renderParams27, isAddressElement, res, submitRes;
|
1554
1625
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
1555
1626
|
while (1) switch (_context8.prev = _context8.next) {
|
1556
1627
|
case 0:
|
1557
1628
|
_context8.prev = 0;
|
1558
|
-
|
1559
|
-
|
1629
|
+
isAddressElement = this.AMSSDK.options.product === productSceneEnum.ELEMENT_ADDRESS;
|
1630
|
+
if (!((!this._actionQueryPromise || !this._actionSubmitPromise) && !isAddressElement)) {
|
1631
|
+
_context8.next = 4;
|
1560
1632
|
break;
|
1561
1633
|
}
|
1562
1634
|
return _context8.abrupt("return");
|
1563
|
-
case
|
1564
|
-
_context8.next =
|
1635
|
+
case 4:
|
1636
|
+
_context8.next = 6;
|
1565
1637
|
return this._actionQueryPromise;
|
1566
|
-
case
|
1638
|
+
case 6:
|
1567
1639
|
res = _context8.sent;
|
1568
|
-
_context8.next =
|
1640
|
+
_context8.next = 9;
|
1569
1641
|
return this._actionSubmitPromise;
|
1570
|
-
case
|
1642
|
+
case 9:
|
1571
1643
|
submitRes = _context8.sent;
|
1572
1644
|
this._performanceData.push({
|
1573
1645
|
key: 'sdk_render_component',
|
@@ -1585,23 +1657,28 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1585
1657
|
renderDisplayType: (_this$_renderParams17 = this._renderParams) === null || _this$_renderParams17 === void 0 ? void 0 : _this$_renderParams17.renderDisplayType,
|
1586
1658
|
appearance: (_this$_renderParams18 = this._renderParams) === null || _this$_renderParams18 === void 0 ? void 0 : _this$_renderParams18.appearance,
|
1587
1659
|
notRedirectAfterComplete: ((_this$_renderParams19 = this._renderParams) === null || _this$_renderParams19 === void 0 ? void 0 : _this$_renderParams19.notRedirectAfterComplete) === true,
|
1660
|
+
isAppWebview: this._isAppWebview,
|
1588
1661
|
merchantAppointParam: this._merchantAppointParam,
|
1589
1662
|
allowSubmitPayCallAhead: this._allowSubmitPayCallAhead,
|
1663
|
+
/** 地址组件集成的参数 */
|
1664
|
+
configParams: (_this$_renderParams20 = this._renderParams) === null || _this$_renderParams20 === void 0 ? void 0 : _this$_renderParams20.configParams,
|
1665
|
+
prefillValue: (_this$_renderParams21 = this._renderParams) === null || _this$_renderParams21 === void 0 ? void 0 : _this$_renderParams21.prefillValue,
|
1666
|
+
componentSession: (_this$_renderParams22 = this._renderParams) === null || _this$_renderParams22 === void 0 ? void 0 : _this$_renderParams22.componentSession,
|
1590
1667
|
envInfo: {
|
1591
1668
|
screenHeight: screen.height,
|
1592
1669
|
screenWidth: screen.width
|
1593
1670
|
},
|
1594
1671
|
logMetaData: _objectSpread(_objectSpread({
|
1595
|
-
trackId: (_this$
|
1672
|
+
trackId: (_this$_renderParams23 = this._renderParams) === null || _this$_renderParams23 === void 0 ? void 0 : _this$_renderParams23.sessionData,
|
1596
1673
|
platform: this.platform,
|
1597
1674
|
firstLogTime: (_this$AMSSDK$logger = this.AMSSDK.logger) === null || _this$AMSSDK$logger === void 0 ? void 0 : _this$AMSSDK$logger.getComponentStartTime()
|
1598
|
-
}, ((_this$
|
1599
|
-
renderDisplayType: (_this$
|
1675
|
+
}, ((_this$_renderParams24 = this._renderParams) === null || _this$_renderParams24 === void 0 || (_this$_renderParams24 = _this$_renderParams24.paymentSessionMetaData) === null || _this$_renderParams24 === void 0 ? void 0 : _this$_renderParams24.paymentSessionConfig) || {}), {}, {
|
1676
|
+
renderDisplayType: (_this$_renderParams25 = this._renderParams) === null || _this$_renderParams25 === void 0 ? void 0 : _this$_renderParams25.renderDisplayType,
|
1600
1677
|
sdkVersion: this._appVersion,
|
1601
|
-
merchantId: (_this$
|
1678
|
+
merchantId: (_this$_renderParams26 = this._renderParams) === null || _this$_renderParams26 === void 0 || (_this$_renderParams26 = _this$_renderParams26.paymentSessionMetaData) === null || _this$_renderParams26 === void 0 ? void 0 : _this$_renderParams26.clientId,
|
1602
1679
|
instanceId: (_this$AMSSDK = this.AMSSDK) === null || _this$AMSSDK === void 0 ? void 0 : _this$AMSSDK._instanceId,
|
1603
1680
|
performanceData: this._performanceData,
|
1604
|
-
paymentMethodType: (_this$
|
1681
|
+
paymentMethodType: (_this$_renderParams27 = this._renderParams) === null || _this$_renderParams27 === void 0 || (_this$_renderParams27 = _this$_renderParams27.paymentSessionMetaData) === null || _this$_renderParams27 === void 0 || (_this$_renderParams27 = _this$_renderParams27.paymentMethodInfoView) === null || _this$_renderParams27 === void 0 ? void 0 : _this$_renderParams27.paymentMethodType
|
1605
1682
|
})
|
1606
1683
|
}
|
1607
1684
|
}
|
@@ -1618,16 +1695,16 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1618
1695
|
}
|
1619
1696
|
});
|
1620
1697
|
// eslint-disable-next-line no-empty
|
1621
|
-
_context8.next =
|
1698
|
+
_context8.next = 18;
|
1622
1699
|
break;
|
1623
|
-
case
|
1624
|
-
_context8.prev =
|
1700
|
+
case 16:
|
1701
|
+
_context8.prev = 16;
|
1625
1702
|
_context8.t0 = _context8["catch"](0);
|
1626
|
-
case
|
1703
|
+
case 18:
|
1627
1704
|
case "end":
|
1628
1705
|
return _context8.stop();
|
1629
1706
|
}
|
1630
|
-
}, _callee8, this, [[0,
|
1707
|
+
}, _callee8, this, [[0, 16]]);
|
1631
1708
|
}));
|
1632
1709
|
function sendRenderEvent() {
|
1633
1710
|
return _sendRenderEvent.apply(this, arguments);
|
@@ -1661,8 +1738,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1661
1738
|
}, {
|
1662
1739
|
key: "hideComponentAnimation",
|
1663
1740
|
value: function hideComponentAnimation() {
|
1741
|
+
var _container$style;
|
1664
1742
|
var container = document.getElementById(COMPONENT_CONTAINER_ID);
|
1665
|
-
if (this.app) this.app.style.height = container.style.height;
|
1743
|
+
if (this.app) this.app.style.height = container === null || container === void 0 || (_container$style = container.style) === null || _container$style === void 0 ? void 0 : _container$style.height;
|
1666
1744
|
if (container) {
|
1667
1745
|
// size变化动画取消
|
1668
1746
|
container.style.transition = '';
|