@alipay/ams-checkout 1.20.1 → 1.21.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 +5 -0
- package/esm/constant/index.js +5 -0
- 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.js +9 -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 +3 -1
- package/esm/plugin/component/index.js +123 -88
- 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 +92 -4
- package/esm/types/index.js +14 -0
- package/esm/util/security.d.ts +1 -0
- package/esm/util/security.js +1 -1
- package/package.json +1 -1
@@ -25,14 +25,15 @@ 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 { handlePaymentSessionConfig } from "../payment-element/utils";
|
28
29
|
import { createIframe, createPreloadIframe, getAppDomain, getIframeUrl } from "./cashierApp";
|
29
30
|
import { getChannelBehavior } from "./channel";
|
30
31
|
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";
|
32
|
+
import { addPopupLoading, createBaseElement, createMockup, createRetentionPopup, handleDeclareInfo as _handleDeclareInfo, hideRetentionPopup, removeRetentionPopup as _removeRetentionPopup, slideInAndOutKeyframes } from "./component.popup.style";
|
33
|
+
import { createModal, destroyModal, insertStyleSheet, removePopupLoading } from "./popupWindow.style";
|
33
34
|
window.changingPageHeight = window.innerHeight;
|
34
35
|
var ComponentApp = /*#__PURE__*/function () {
|
35
|
-
function ComponentApp() {
|
36
|
+
function ComponentApp(componentOption) {
|
36
37
|
_classCallCheck(this, ComponentApp);
|
37
38
|
_defineProperty(this, "app", void 0);
|
38
39
|
_defineProperty(this, "AMSSDK", void 0);
|
@@ -58,7 +59,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
58
59
|
_defineProperty(this, "_multipleCallbackEvents", void 0);
|
59
60
|
_defineProperty(this, "_merchantAppointParam", void 0);
|
60
61
|
_defineProperty(this, "_webAppHeartBeatTimeoutFn", void 0);
|
61
|
-
this._appVersion =
|
62
|
+
this._appVersion = componentOption.appVersion;
|
62
63
|
this._isInitComponent = false;
|
63
64
|
this._selector = "#".concat(COMPONENT_SECTION_ID);
|
64
65
|
this.createIframeNode = function () {
|
@@ -259,12 +260,12 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
259
260
|
return Promise.reject(ERRORMESSAGE.CREATECOMPONENT_ERROR.SINGLETON_COMPONENT_ERROR);
|
260
261
|
}
|
261
262
|
renderParams = this.setParameterDefaultValues(componentSign, renderParams);
|
263
|
+
this._merchantAppointParam = renderParams.merchantAppointParam;
|
262
264
|
this._isInitComponent = true;
|
263
265
|
this._renderParams = renderParams;
|
264
266
|
this._componentSign = componentSign;
|
265
267
|
if ((_renderParams = renderParams) !== null && _renderParams !== void 0 && _renderParams.selector) this._selector = renderParams.selector;
|
266
268
|
this._renderDisplayType = renderParams.renderDisplayType;
|
267
|
-
this._merchantAppointParam = renderParams.merchantAppointParam;
|
268
269
|
var insertedNode = this._renderDisplayType === renderDisplayTypeEnum.inline ? "#".concat(COMPONENT_CONTAINER_ID) : this._selector;
|
269
270
|
this.initLoggerMeta();
|
270
271
|
this.initSecurity();
|
@@ -387,10 +388,22 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
387
388
|
}, {
|
388
389
|
key: "renderInlineLoading",
|
389
390
|
value: function renderInlineLoading(renderParams, selector) {
|
390
|
-
var _renderParams$appeara;
|
391
|
+
var _renderParams$appeara, _this$_renderParams11;
|
391
392
|
var showLoading = renderParams === null || renderParams === void 0 || (_renderParams$appeara = renderParams.appearance) === null || _renderParams$appeara === void 0 ? void 0 : _renderParams$appeara.showLoading;
|
392
393
|
showLoading = typeof showLoading === 'boolean' ? showLoading : true;
|
393
|
-
|
394
|
+
var extendInfo = renderParams.paymentSessionMetaData.extendInfo;
|
395
|
+
var isExpressCheckout = false;
|
396
|
+
try {
|
397
|
+
// expressCheckout可能出现string(false) JSON.parse再转一次
|
398
|
+
isExpressCheckout = JSON.parse(JSON.parse(extendInfo).expressCheckout);
|
399
|
+
} catch (error) {
|
400
|
+
// 遇到JSON解析错误,默认false
|
401
|
+
}
|
402
|
+
if (showLoading) addInlineLoading(selector, this.platform, {
|
403
|
+
componentSign: this._componentSign,
|
404
|
+
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,
|
405
|
+
isExpressCheckout: isExpressCheckout
|
406
|
+
});
|
394
407
|
}
|
395
408
|
}, {
|
396
409
|
key: "renderPopupLoading",
|
@@ -427,9 +440,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
427
440
|
}, {
|
428
441
|
key: "createActionQueryPromise",
|
429
442
|
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;
|
443
|
+
var _this5 = this;
|
433
444
|
this._performanceData.push({
|
434
445
|
key: 'sdk_action_query_start',
|
435
446
|
value: Date.now()
|
@@ -438,7 +449,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
438
449
|
this._actionQueryPromise = new Promise( /*#__PURE__*/function () {
|
439
450
|
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(resolve, reject) {
|
440
451
|
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,
|
452
|
+
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
453
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
443
454
|
while (1) switch (_context2.prev = _context2.next) {
|
444
455
|
case 0:
|
@@ -474,22 +485,35 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
474
485
|
success: true
|
475
486
|
}));
|
476
487
|
case 9:
|
488
|
+
if (componentSignEnum.ELEMENT_PAYMENT === _this5._componentSign) {
|
489
|
+
params.paymentSessionConfig = handlePaymentSessionConfig(params.paymentSessionConfig);
|
490
|
+
}
|
491
|
+
/** 地址组件跳过接口查询 */
|
492
|
+
if (!(componentSignEnum.ELEMENT_ADDRESS === _this5._componentSign)) {
|
493
|
+
_context2.next = 12;
|
494
|
+
break;
|
495
|
+
}
|
496
|
+
return _context2.abrupt("return", resolve({
|
497
|
+
message: 'sdk no need to make query request',
|
498
|
+
success: true
|
499
|
+
}));
|
500
|
+
case 12:
|
477
501
|
if (!(componentSignEnum.VAULTING_CARD === _this5._componentSign)) {
|
478
|
-
_context2.next =
|
502
|
+
_context2.next = 24;
|
479
503
|
break;
|
480
504
|
}
|
481
505
|
if (!enableVaultingApiOptimize) {
|
482
|
-
_context2.next =
|
506
|
+
_context2.next = 24;
|
483
507
|
break;
|
484
508
|
}
|
485
509
|
if (!skipSdkQueryForm) {
|
486
|
-
_context2.next =
|
510
|
+
_context2.next = 21;
|
487
511
|
break;
|
488
512
|
}
|
489
513
|
// 优先判断 skipSdkQueryForm
|
490
514
|
ifSkip = matchVersion(skipSdkQueryForm, _this5._appVersion);
|
491
515
|
if (!ifSkip) {
|
492
|
-
_context2.next =
|
516
|
+
_context2.next = 19;
|
493
517
|
break;
|
494
518
|
}
|
495
519
|
resolve({
|
@@ -497,12 +521,12 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
497
521
|
success: true
|
498
522
|
});
|
499
523
|
return _context2.abrupt("return");
|
500
|
-
case
|
501
|
-
_context2.next =
|
524
|
+
case 19:
|
525
|
+
_context2.next = 24;
|
502
526
|
break;
|
503
|
-
case
|
527
|
+
case 21:
|
504
528
|
if (!skipSdkQuery) {
|
505
|
-
_context2.next =
|
529
|
+
_context2.next = 24;
|
506
530
|
break;
|
507
531
|
}
|
508
532
|
resolve({
|
@@ -510,10 +534,10 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
510
534
|
success: true
|
511
535
|
});
|
512
536
|
return _context2.abrupt("return");
|
513
|
-
case
|
537
|
+
case 24:
|
514
538
|
channelBehavior = getChannelBehavior((_this5$_renderParams6 = _this5._renderParams) === null || _this5$_renderParams6 === void 0 ? void 0 : _this5$_renderParams6.paymentSessionMetaData); // Easypay TOSS 渠道无需actionQuery
|
515
539
|
if (!(channelBehavior !== null && channelBehavior !== void 0 && channelBehavior.usePaymentSessionAsQueryResult)) {
|
516
|
-
_context2.next =
|
540
|
+
_context2.next = 27;
|
517
541
|
break;
|
518
542
|
}
|
519
543
|
return _context2.abrupt("return", resolve({
|
@@ -521,79 +545,78 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
521
545
|
amountConfirmRequired: actionData === null || actionData === void 0 ? void 0 : actionData.amountConfirmRequired,
|
522
546
|
success: true
|
523
547
|
}));
|
524
|
-
case
|
548
|
+
case 27:
|
525
549
|
if (!(componentSignEnum.CASHIER_PAYMENT_CARD === _this5._componentSign || componentSignEnum.VAULTING_CARD === _this5._componentSign)) {
|
526
|
-
_context2.next =
|
550
|
+
_context2.next = 33;
|
527
551
|
break;
|
528
552
|
}
|
529
553
|
params.paymentMethodType = 'CARD';
|
530
|
-
_context2.next =
|
554
|
+
_context2.next = 31;
|
531
555
|
return _this5.getDeviceIdAndLog();
|
532
|
-
case
|
556
|
+
case 31:
|
533
557
|
envInfo.deviceId = _context2.sent;
|
534
558
|
if (window.navigator.userAgent.indexOf('miniProgram') > -1) {
|
535
559
|
envInfo.extendInfo = {
|
536
560
|
WAP_SUB_TYPE: 'WECHAT_MINI_PROGRAM'
|
537
561
|
};
|
538
562
|
}
|
539
|
-
case
|
563
|
+
case 33:
|
540
564
|
if (!(componentSignEnum.EASY_PAY_WALLET === _this5._componentSign)) {
|
541
|
-
_context2.next =
|
565
|
+
_context2.next = 42;
|
542
566
|
break;
|
543
567
|
}
|
544
568
|
_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;
|
569
|
+
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)) {
|
570
|
+
_context2.next = 37;
|
548
571
|
break;
|
549
572
|
}
|
550
573
|
return _context2.abrupt("return", resolve({
|
551
574
|
message: 'sdk no need to make query request',
|
552
575
|
success: true
|
553
576
|
}));
|
554
|
-
case
|
577
|
+
case 37:
|
555
578
|
if (!(productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0')) {
|
556
|
-
_context2.next =
|
579
|
+
_context2.next = 39;
|
557
580
|
break;
|
558
581
|
}
|
559
582
|
return _context2.abrupt("return", resolve({
|
560
583
|
message: 'sdk no need to make query request',
|
561
584
|
success: true
|
562
585
|
}));
|
563
|
-
case 37:
|
564
|
-
_context2.next = 39;
|
565
|
-
return _this5.getDeviceIdAndLog();
|
566
586
|
case 39:
|
587
|
+
_context2.next = 41;
|
588
|
+
return _this5.getDeviceIdAndLog();
|
589
|
+
case 41:
|
567
590
|
envInfo.deviceId = _context2.sent;
|
568
|
-
case
|
591
|
+
case 42:
|
569
592
|
if (!(componentSignEnum.AUTO_DEBIT_WALLET === _this5._componentSign)) {
|
570
|
-
_context2.next =
|
593
|
+
_context2.next = 52;
|
571
594
|
break;
|
572
595
|
}
|
573
|
-
action = ((_this5$
|
596
|
+
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
597
|
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
598
|
if (!(signType === 'SMS')) {
|
576
|
-
_context2.next =
|
599
|
+
_context2.next = 47;
|
577
600
|
break;
|
578
601
|
}
|
579
602
|
return _context2.abrupt("return", resolve({
|
580
603
|
message: 'sdk no need to make query request',
|
581
604
|
success: true
|
582
605
|
}));
|
583
|
-
case
|
606
|
+
case 47:
|
584
607
|
if (!(!signType || signType !== 'REDIRECT')) {
|
585
|
-
_context2.next =
|
608
|
+
_context2.next = 49;
|
586
609
|
break;
|
587
610
|
}
|
588
611
|
return _context2.abrupt("return", resolve({
|
589
612
|
success: false
|
590
613
|
}));
|
591
|
-
case 47:
|
592
|
-
_context2.next = 49;
|
593
|
-
return _this5.getDeviceIdAndLog();
|
594
614
|
case 49:
|
615
|
+
_context2.next = 51;
|
616
|
+
return _this5.getDeviceIdAndLog();
|
617
|
+
case 51:
|
595
618
|
envInfo.deviceId = _context2.sent;
|
596
|
-
case
|
619
|
+
case 52:
|
597
620
|
_this5.AMSSDK.logger.logInfo({
|
598
621
|
title: 'sdk_event_sdkQuery'
|
599
622
|
}, {
|
@@ -632,7 +655,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
632
655
|
}).send();
|
633
656
|
reject(err);
|
634
657
|
});
|
635
|
-
case
|
658
|
+
case 54:
|
636
659
|
case "end":
|
637
660
|
return _context2.stop();
|
638
661
|
}
|
@@ -664,12 +687,21 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
664
687
|
var channelBehavior = getChannelBehavior((_this$_renderParams14 = this._renderParams) === null || _this$_renderParams14 === void 0 ? void 0 : _this$_renderParams14.paymentSessionMetaData);
|
665
688
|
// eslint-disable-next-line no-async-promise-executor
|
666
689
|
this._actionSubmitPromise = new Promise( /*#__PURE__*/function () {
|
667
|
-
var
|
690
|
+
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
|
668
691
|
var _channelBehavior$buil, _this6$_renderParams$;
|
669
|
-
var shouldSkipSubmitPayInSDK, _this6$_renderParams, _this6$_renderParams2,
|
692
|
+
var shouldSkipSubmitPayInSDK, _this6$_renderParams, _this6$_renderParams2, _ref10, _ref10$productSceneVe, productSceneVersion, _ref10$productScene, productScene, _ref11, _ref11$action, _ref11$action2, _ref11$action2$enable, enableSignAgreement, _ref11$action2$autoDe, autoDebitWithToken, extParams;
|
670
693
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
671
694
|
while (1) switch (_context3.prev = _context3.next) {
|
672
695
|
case 0:
|
696
|
+
if (!(_this6.AMSSDK.options.product === productSceneEnum.ELEMENT_ADDRESS)) {
|
697
|
+
_context3.next = 2;
|
698
|
+
break;
|
699
|
+
}
|
700
|
+
return _context3.abrupt("return", resolve({
|
701
|
+
message: 'sdk no need to make submitPay request',
|
702
|
+
success: true
|
703
|
+
}));
|
704
|
+
case 2:
|
673
705
|
shouldSkipSubmitPayInSDK = false;
|
674
706
|
if (channelBehavior) {
|
675
707
|
// 新逻辑走 channelBehavior判断
|
@@ -678,8 +710,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
678
710
|
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
711
|
}
|
680
712
|
if (componentSignEnum.EASY_PAY_WALLET === _this6._componentSign) {
|
681
|
-
|
682
|
-
|
713
|
+
_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;
|
714
|
+
_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;
|
683
715
|
if (productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0' && !autoDebitWithToken) {
|
684
716
|
///EasyPay 2.0 首次传signAgreement字段
|
685
717
|
params['signAgreement'] = enableSignAgreement;
|
@@ -688,14 +720,14 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
688
720
|
// 带上标记告知WebCheckOut SDK已发送submitpay请求
|
689
721
|
_this6._allowSubmitPayCallAhead = !shouldSkipSubmitPayInSDK;
|
690
722
|
if (!shouldSkipSubmitPayInSDK) {
|
691
|
-
_context3.next =
|
723
|
+
_context3.next = 8;
|
692
724
|
break;
|
693
725
|
}
|
694
726
|
return _context3.abrupt("return", resolve({
|
695
727
|
message: 'sdk no need to make submitPay request',
|
696
728
|
success: true
|
697
729
|
}));
|
698
|
-
case
|
730
|
+
case 8:
|
699
731
|
_this6.AMSSDK.logger.logInfo({
|
700
732
|
title: 'sdk_event_submitPay'
|
701
733
|
}, {
|
@@ -714,9 +746,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
714
746
|
_context3.t0 = submitPayInfo;
|
715
747
|
_context3.t1 = params;
|
716
748
|
_context3.t2 = _this6.AMSSDK.options.env.environment;
|
717
|
-
_context3.next =
|
749
|
+
_context3.next = 16;
|
718
750
|
return _this6.getDeviceIdAndLog();
|
719
|
-
case
|
751
|
+
case 16:
|
720
752
|
_context3.t3 = _context3.sent;
|
721
753
|
_context3.t4 = {
|
722
754
|
deviceId: _context3.t3
|
@@ -750,14 +782,14 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
750
782
|
success: false
|
751
783
|
});
|
752
784
|
});
|
753
|
-
case
|
785
|
+
case 21:
|
754
786
|
case "end":
|
755
787
|
return _context3.stop();
|
756
788
|
}
|
757
789
|
}, _callee3);
|
758
790
|
}));
|
759
791
|
return function (_x3) {
|
760
|
-
return
|
792
|
+
return _ref9.apply(this, arguments);
|
761
793
|
};
|
762
794
|
}());
|
763
795
|
}
|
@@ -798,19 +830,17 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
798
830
|
value: function createPreloadApp(componentSign) {
|
799
831
|
var productSceneVersion = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '1.0';
|
800
832
|
var preloadIframe = createPreloadIframe(componentSign, productSceneVersion);
|
833
|
+
var productScene = componentSign.split(/_(?=[^_]*$)/)[0];
|
801
834
|
var _getIframeUrl = getIframeUrl({
|
802
835
|
renderDisplayType: renderDisplayTypeEnum.popup,
|
803
836
|
componentSign: componentSign,
|
804
837
|
analytics: {
|
805
838
|
enabled: false
|
806
839
|
},
|
807
|
-
productScene:
|
840
|
+
productScene: productScene,
|
808
841
|
productSceneVersion: productSceneVersion,
|
809
842
|
environment: this.AMSSDK.options.env.environment,
|
810
|
-
// TODO 确定一下这个参数是干啥的
|
811
843
|
appVersion: this._appVersion,
|
812
|
-
extendInfo: '',
|
813
|
-
locale: '',
|
814
844
|
instanceId: '',
|
815
845
|
isPreload: 'true',
|
816
846
|
mid: ''
|
@@ -934,7 +964,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
934
964
|
key: "createDialog",
|
935
965
|
value: function () {
|
936
966
|
var _createDialog = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(data) {
|
937
|
-
var pageUrl, isLoad, timeout, logTimeout;
|
967
|
+
var pageUrl, _data$device, isLoad, timeout, logTimeout;
|
938
968
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
939
969
|
while (1) switch (_context4.prev = _context4.next) {
|
940
970
|
case 0:
|
@@ -944,8 +974,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
944
974
|
_context4.next = 5;
|
945
975
|
return createModal({
|
946
976
|
widthPadding: data === null || data === void 0 ? void 0 : data.widthPadding,
|
947
|
-
|
948
|
-
|
977
|
+
device: (_data$device = data === null || data === void 0 ? void 0 : data.device) !== null && _data$device !== void 0 ? _data$device : this.platform,
|
978
|
+
loadingConfig: data === null || data === void 0 ? void 0 : data.loadingConfig,
|
949
979
|
url: pageUrl
|
950
980
|
});
|
951
981
|
case 5:
|
@@ -964,6 +994,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
964
994
|
}, POPUP_LOADTIME_LOG_LIMIT);
|
965
995
|
this.popupApp.onload = function () {
|
966
996
|
isLoad = true;
|
997
|
+
removePopupLoading();
|
967
998
|
clearTimeout(timeout);
|
968
999
|
clearTimeout(logTimeout);
|
969
1000
|
};
|
@@ -1275,9 +1306,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1275
1306
|
|
1276
1307
|
// 此style用于弹窗出现和高度变化时动画,动画不同,属性不同
|
1277
1308
|
this.app.style.height = parseInt(this.app.style.height) > 0 ? '100%' : "".concat(data.context.data.height, "px");
|
1278
|
-
|
1279
1309
|
// 弹出和弹入动画
|
1280
|
-
var runkeyframes =
|
1310
|
+
var runkeyframes = slideInAndOutKeyframes(COMPONENT_CONTAINER_ID, data.context.data.height);
|
1281
1311
|
// 创建style标签
|
1282
1312
|
var style = document.createElement('style');
|
1283
1313
|
style.id = animationStyleId;
|
@@ -1287,7 +1317,6 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1287
1317
|
style.innerHTML = runkeyframes;
|
1288
1318
|
// 将style样式存放到head标签
|
1289
1319
|
document.getElementsByTagName('head')[0].appendChild(style);
|
1290
|
-
|
1291
1320
|
// size变动时动画
|
1292
1321
|
setTimeout(function () {
|
1293
1322
|
cashier.style.transition = 'height 0.28s ease-in-out';
|
@@ -1407,9 +1436,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1407
1436
|
}
|
1408
1437
|
}, {
|
1409
1438
|
key: "handleDeclareInfo",
|
1410
|
-
value: function handleDeclareInfo(
|
1411
|
-
var
|
1412
|
-
closeDialogData =
|
1439
|
+
value: function handleDeclareInfo(_ref12) {
|
1440
|
+
var _ref12$closeDialogDat = _ref12.closeDialogData,
|
1441
|
+
closeDialogData = _ref12$closeDialogDat === void 0 ? {} : _ref12$closeDialogDat;
|
1413
1442
|
_handleDeclareInfo({
|
1414
1443
|
closeDialogData: closeDialogData
|
1415
1444
|
});
|
@@ -1550,24 +1579,25 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1550
1579
|
key: "sendRenderEvent",
|
1551
1580
|
value: (function () {
|
1552
1581
|
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$
|
1582
|
+
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
1583
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
1555
1584
|
while (1) switch (_context8.prev = _context8.next) {
|
1556
1585
|
case 0:
|
1557
1586
|
_context8.prev = 0;
|
1558
|
-
|
1559
|
-
|
1587
|
+
isAddressElement = this.AMSSDK.options.product === productSceneEnum.ELEMENT_ADDRESS;
|
1588
|
+
if (!((!this._actionQueryPromise || !this._actionSubmitPromise) && !isAddressElement)) {
|
1589
|
+
_context8.next = 4;
|
1560
1590
|
break;
|
1561
1591
|
}
|
1562
1592
|
return _context8.abrupt("return");
|
1563
|
-
case
|
1564
|
-
_context8.next =
|
1593
|
+
case 4:
|
1594
|
+
_context8.next = 6;
|
1565
1595
|
return this._actionQueryPromise;
|
1566
|
-
case
|
1596
|
+
case 6:
|
1567
1597
|
res = _context8.sent;
|
1568
|
-
_context8.next =
|
1598
|
+
_context8.next = 9;
|
1569
1599
|
return this._actionSubmitPromise;
|
1570
|
-
case
|
1600
|
+
case 9:
|
1571
1601
|
submitRes = _context8.sent;
|
1572
1602
|
this._performanceData.push({
|
1573
1603
|
key: 'sdk_render_component',
|
@@ -1587,21 +1617,25 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1587
1617
|
notRedirectAfterComplete: ((_this$_renderParams19 = this._renderParams) === null || _this$_renderParams19 === void 0 ? void 0 : _this$_renderParams19.notRedirectAfterComplete) === true,
|
1588
1618
|
merchantAppointParam: this._merchantAppointParam,
|
1589
1619
|
allowSubmitPayCallAhead: this._allowSubmitPayCallAhead,
|
1620
|
+
/** 地址组件集成的参数 */
|
1621
|
+
configParams: (_this$_renderParams20 = this._renderParams) === null || _this$_renderParams20 === void 0 ? void 0 : _this$_renderParams20.configParams,
|
1622
|
+
prefillValue: (_this$_renderParams21 = this._renderParams) === null || _this$_renderParams21 === void 0 ? void 0 : _this$_renderParams21.prefillValue,
|
1623
|
+
componentSession: (_this$_renderParams22 = this._renderParams) === null || _this$_renderParams22 === void 0 ? void 0 : _this$_renderParams22.componentSession,
|
1590
1624
|
envInfo: {
|
1591
1625
|
screenHeight: screen.height,
|
1592
1626
|
screenWidth: screen.width
|
1593
1627
|
},
|
1594
1628
|
logMetaData: _objectSpread(_objectSpread({
|
1595
|
-
trackId: (_this$
|
1629
|
+
trackId: (_this$_renderParams23 = this._renderParams) === null || _this$_renderParams23 === void 0 ? void 0 : _this$_renderParams23.sessionData,
|
1596
1630
|
platform: this.platform,
|
1597
1631
|
firstLogTime: (_this$AMSSDK$logger = this.AMSSDK.logger) === null || _this$AMSSDK$logger === void 0 ? void 0 : _this$AMSSDK$logger.getComponentStartTime()
|
1598
|
-
}, ((_this$
|
1599
|
-
renderDisplayType: (_this$
|
1632
|
+
}, ((_this$_renderParams24 = this._renderParams) === null || _this$_renderParams24 === void 0 || (_this$_renderParams24 = _this$_renderParams24.paymentSessionMetaData) === null || _this$_renderParams24 === void 0 ? void 0 : _this$_renderParams24.paymentSessionConfig) || {}), {}, {
|
1633
|
+
renderDisplayType: (_this$_renderParams25 = this._renderParams) === null || _this$_renderParams25 === void 0 ? void 0 : _this$_renderParams25.renderDisplayType,
|
1600
1634
|
sdkVersion: this._appVersion,
|
1601
|
-
merchantId: (_this$
|
1635
|
+
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
1636
|
instanceId: (_this$AMSSDK = this.AMSSDK) === null || _this$AMSSDK === void 0 ? void 0 : _this$AMSSDK._instanceId,
|
1603
1637
|
performanceData: this._performanceData,
|
1604
|
-
paymentMethodType: (_this$
|
1638
|
+
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
1639
|
})
|
1606
1640
|
}
|
1607
1641
|
}
|
@@ -1618,16 +1652,16 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1618
1652
|
}
|
1619
1653
|
});
|
1620
1654
|
// eslint-disable-next-line no-empty
|
1621
|
-
_context8.next =
|
1655
|
+
_context8.next = 18;
|
1622
1656
|
break;
|
1623
|
-
case
|
1624
|
-
_context8.prev =
|
1657
|
+
case 16:
|
1658
|
+
_context8.prev = 16;
|
1625
1659
|
_context8.t0 = _context8["catch"](0);
|
1626
|
-
case
|
1660
|
+
case 18:
|
1627
1661
|
case "end":
|
1628
1662
|
return _context8.stop();
|
1629
1663
|
}
|
1630
|
-
}, _callee8, this, [[0,
|
1664
|
+
}, _callee8, this, [[0, 16]]);
|
1631
1665
|
}));
|
1632
1666
|
function sendRenderEvent() {
|
1633
1667
|
return _sendRenderEvent.apply(this, arguments);
|
@@ -1661,8 +1695,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1661
1695
|
}, {
|
1662
1696
|
key: "hideComponentAnimation",
|
1663
1697
|
value: function hideComponentAnimation() {
|
1698
|
+
var _container$style;
|
1664
1699
|
var container = document.getElementById(COMPONENT_CONTAINER_ID);
|
1665
|
-
if (this.app) this.app.style.height = container.style.height;
|
1700
|
+
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
1701
|
if (container) {
|
1667
1702
|
// size变化动画取消
|
1668
1703
|
container.style.transition = '';
|
@@ -1,8 +1,11 @@
|
|
1
|
+
export declare const createCustomSheet: (curTheme?: 'dark' | 'light') => void;
|
2
|
+
export declare const renderPopupLoading: (container: HTMLDivElement, curTheme: 'dark' | 'light') => void;
|
3
|
+
export declare const removePopupLoading: (isShowMockup?: boolean) => void;
|
1
4
|
export declare const insertStyleSheet: () => void;
|
2
|
-
export declare const createModal: ({ device, url, widthPadding,
|
5
|
+
export declare const createModal: ({ device, url, widthPadding, loadingConfig }: {
|
3
6
|
device: any;
|
4
7
|
url: any;
|
5
8
|
widthPadding: any;
|
6
|
-
|
9
|
+
loadingConfig: any;
|
7
10
|
}) => Promise<HTMLIFrameElement>;
|
8
11
|
export declare const destroyModal: () => void;
|