@alipay/ams-checkout 0.0.1720509876-dev.2 → 0.0.1722309428-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/umd/ams-checkout.min.js +1 -1
- package/esm/config/index.d.ts +0 -1
- package/esm/config/index.js +0 -8
- package/esm/config/request.js +3 -3
- package/esm/core/component/appPreloadProcessing.d.ts +1 -0
- package/esm/core/component/appPreloadProcessing.js +89 -0
- package/esm/core/component/index.d.ts +1 -1
- package/esm/core/component/index.js +45 -28
- package/esm/index.d.ts +3 -3
- package/esm/index.js +24 -24
- package/esm/plugin/applepay/component.js +1 -1
- package/esm/plugin/component/cashierApp.d.ts +3 -3
- package/esm/plugin/component/cashierApp.js +5 -27
- package/esm/plugin/component/component.popup.style.d.ts +0 -1
- package/esm/plugin/component/component.popup.style.js +0 -3
- package/esm/plugin/component/index.js +70 -58
- package/esm/plugin/paypal/index.js +0 -1
- package/esm/types/index.d.ts +11 -10
- package/esm/types/index.js +2 -7
- package/esm/util/index.d.ts +7 -1
- package/esm/util/index.js +67 -1
- package/esm/util/security.d.ts +0 -1
- package/esm/util/security.js +1 -1
- package/esm/util/upgrade.d.ts +4 -4
- package/esm/util/upgrade.js +6 -6
- package/package.json +1 -1
- package/esm/plugin/payment-element/utils.d.ts +0 -2
- package/esm/plugin/payment-element/utils.js +0 -6
@@ -27,8 +27,7 @@ import { matchVersion } from "../../util/versionCompare";
|
|
27
27
|
import { createIframe, createPreloadIframe, getAppDomain, getIframeUrl } from "./cashierApp";
|
28
28
|
import { getChannelBehavior } from "./channel";
|
29
29
|
import { addInlineLoading, createInlineBaseElement } from "./component.inline.style";
|
30
|
-
import { addPopupLoading, createBaseElement, createMockup, createRetentionPopup, handleDeclareInfo as _handleDeclareInfo, hideRetentionPopup, removeRetentionPopup as _removeRetentionPopup
|
31
|
-
import { handlePaymentSessionConfig } from "../payment-element/utils";
|
30
|
+
import { addPopupLoading, createBaseElement, createMockup, createRetentionPopup, handleDeclareInfo as _handleDeclareInfo, hideRetentionPopup, removeRetentionPopup as _removeRetentionPopup } from "./component.popup.style";
|
32
31
|
import { createModal, destroyModal, insertStyleSheet } from "./popupWindow.style";
|
33
32
|
window.changingPageHeight = window.innerHeight;
|
34
33
|
var ComponentApp = /*#__PURE__*/function () {
|
@@ -58,7 +57,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
58
57
|
_defineProperty(this, "_multipleCallbackEvents", void 0);
|
59
58
|
_defineProperty(this, "_merchantAppointParam", void 0);
|
60
59
|
_defineProperty(this, "_webAppHeartBeatTimeoutFn", void 0);
|
61
|
-
this._appVersion = '1.
|
60
|
+
this._appVersion = '1.18.0';
|
62
61
|
this._isInitComponent = false;
|
63
62
|
this._selector = "#".concat(COMPONENT_SECTION_ID);
|
64
63
|
this.createIframeNode = function () {
|
@@ -299,7 +298,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
299
298
|
}).send();
|
300
299
|
if (componentSignEnum.EASY_PAY_WALLET === this._componentSign) {
|
301
300
|
if (productScene === productSceneEnum.EASY_PAY && productSceneVersion === '1.0' && !autoDebitWithToken && requireFastSdk) {
|
302
|
-
// EASY_PAY 1.0首次支付,requireFastSdk为true,不需要接口请求
|
301
|
+
// EASY_PAY 1.0首次支付,requireFastSdk为true,不需要接口请求
|
303
302
|
this.handleAuthUrlInfo(authUrlInfo);
|
304
303
|
return;
|
305
304
|
}
|
@@ -315,6 +314,18 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
315
314
|
return;
|
316
315
|
}
|
317
316
|
}
|
317
|
+
if (componentSignEnum.AUTO_DEBIT_PAY_WALLET === this._componentSign) {
|
318
|
+
if (requireFastSdk === true && productSceneVersion === '1.0') {
|
319
|
+
// REDIRECT,requireFastSdk为true,不需要接口请求
|
320
|
+
this.handleAuthUrlInfo(authUrlInfo);
|
321
|
+
return;
|
322
|
+
} else {
|
323
|
+
return Promise.reject({
|
324
|
+
code: ERRORMESSAGE.CREATEPAYMENT_PARAMETER_ERROR.code,
|
325
|
+
message: "Abnormal response data, interface failure, or unsupported payment method."
|
326
|
+
});
|
327
|
+
}
|
328
|
+
}
|
318
329
|
this.dispatchToSDK(EVENT.eventCallback.name, {
|
319
330
|
code: eventCodeEnum.SDK_START_OF_LOADING
|
320
331
|
});
|
@@ -415,17 +426,18 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
415
426
|
}, {
|
416
427
|
key: "createActionQueryPromise",
|
417
428
|
value: function createActionQueryPromise() {
|
418
|
-
var
|
429
|
+
var _this$_renderParams11,
|
430
|
+
_this5 = this;
|
431
|
+
var paymentMethodType = (_this$_renderParams11 = this._renderParams) === null || _this$_renderParams11 === void 0 || (_this$_renderParams11 = _this$_renderParams11.paymentSessionMetaData) === null || _this$_renderParams11 === void 0 || (_this$_renderParams11 = _this$_renderParams11.paymentMethodInfoView) === null || _this$_renderParams11 === void 0 ? void 0 : _this$_renderParams11.paymentMethodType;
|
419
432
|
this._performanceData.push({
|
420
433
|
key: 'sdk_action_query_start',
|
421
434
|
value: Date.now()
|
422
435
|
});
|
423
|
-
|
424
436
|
// eslint-disable-next-line no-async-promise-executor
|
425
437
|
this._actionQueryPromise = new Promise( /*#__PURE__*/function () {
|
426
438
|
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(resolve, reject) {
|
427
439
|
var _this5$_renderParams, _this5$_renderParams2, _this5$_renderParams3, _this5$_renderParams4, _this5$_renderParams5, _this5$_renderParams6;
|
428
|
-
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$
|
440
|
+
var envInfo, params, _ref6, _ref6$extendInfo, extendInfo, actionData, enableVaultingApiOptimize, enableEasypayApiOptimize, _ref7, skipSdkQuery, skipSdkQueryForm, extendInfoData, ifSkip, channelBehavior, _this5$_renderParams7, _this5$_renderParams8, _ref8, _ref8$productSceneVer, productSceneVersion, _ref8$productScene, productScene, _ref9, _ref9$action, _ref9$action2, _ref9$action2$autoDeb, autoDebitWithToken, _this5$_renderParams9, _action$web2, _action$wap2, action, signType;
|
429
441
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
430
442
|
while (1) switch (_context2.prev = _context2.next) {
|
431
443
|
case 0:
|
@@ -461,28 +473,22 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
461
473
|
success: true
|
462
474
|
}));
|
463
475
|
case 9:
|
464
|
-
if (componentSignEnum.ELEMENT_PAYMENT === _this5._componentSign) {
|
465
|
-
params.paymentSessionConfig = handlePaymentSessionConfig(params.paymentSessionConfig);
|
466
|
-
}
|
467
|
-
|
468
|
-
// 绑卡跳过actionQuery接口
|
469
|
-
// 目前只有绑卡加上 skipSdkQueryForm 判断
|
470
476
|
if (!(componentSignEnum.VAULTING_CARD === _this5._componentSign)) {
|
471
|
-
_context2.next =
|
477
|
+
_context2.next = 21;
|
472
478
|
break;
|
473
479
|
}
|
474
480
|
if (!enableVaultingApiOptimize) {
|
475
|
-
_context2.next =
|
481
|
+
_context2.next = 21;
|
476
482
|
break;
|
477
483
|
}
|
478
484
|
if (!skipSdkQueryForm) {
|
479
|
-
_context2.next =
|
485
|
+
_context2.next = 18;
|
480
486
|
break;
|
481
487
|
}
|
482
488
|
// 优先判断 skipSdkQueryForm
|
483
489
|
ifSkip = matchVersion(skipSdkQueryForm, _this5._appVersion);
|
484
490
|
if (!ifSkip) {
|
485
|
-
_context2.next =
|
491
|
+
_context2.next = 16;
|
486
492
|
break;
|
487
493
|
}
|
488
494
|
resolve({
|
@@ -490,12 +496,12 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
490
496
|
success: true
|
491
497
|
});
|
492
498
|
return _context2.abrupt("return");
|
493
|
-
case
|
494
|
-
_context2.next =
|
499
|
+
case 16:
|
500
|
+
_context2.next = 21;
|
495
501
|
break;
|
496
|
-
case
|
502
|
+
case 18:
|
497
503
|
if (!skipSdkQuery) {
|
498
|
-
_context2.next =
|
504
|
+
_context2.next = 21;
|
499
505
|
break;
|
500
506
|
}
|
501
507
|
resolve({
|
@@ -503,10 +509,10 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
503
509
|
success: true
|
504
510
|
});
|
505
511
|
return _context2.abrupt("return");
|
506
|
-
case
|
512
|
+
case 21:
|
507
513
|
channelBehavior = getChannelBehavior((_this5$_renderParams6 = _this5._renderParams) === null || _this5$_renderParams6 === void 0 ? void 0 : _this5$_renderParams6.paymentSessionMetaData); // Easypay TOSS 渠道无需actionQuery
|
508
514
|
if (!(channelBehavior !== null && channelBehavior !== void 0 && channelBehavior.usePaymentSessionAsQueryResult)) {
|
509
|
-
_context2.next =
|
515
|
+
_context2.next = 24;
|
510
516
|
break;
|
511
517
|
}
|
512
518
|
return _context2.abrupt("return", resolve({
|
@@ -514,28 +520,29 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
514
520
|
amountConfirmRequired: actionData === null || actionData === void 0 ? void 0 : actionData.amountConfirmRequired,
|
515
521
|
success: true
|
516
522
|
}));
|
517
|
-
case
|
523
|
+
case 24:
|
518
524
|
if (!(componentSignEnum.CASHIER_PAYMENT_CARD === _this5._componentSign || componentSignEnum.VAULTING_CARD === _this5._componentSign)) {
|
519
|
-
_context2.next =
|
525
|
+
_context2.next = 30;
|
520
526
|
break;
|
521
527
|
}
|
522
528
|
params.paymentMethodType = 'CARD';
|
523
|
-
_context2.next =
|
529
|
+
_context2.next = 28;
|
524
530
|
return _this5.getDeviceIdAndLog();
|
525
|
-
case
|
531
|
+
case 28:
|
526
532
|
envInfo.deviceId = _context2.sent;
|
527
533
|
if (window.navigator.userAgent.indexOf('miniProgram') > -1) {
|
528
534
|
envInfo.extendInfo = {
|
529
535
|
WAP_SUB_TYPE: 'WECHAT_MINI_PROGRAM'
|
530
536
|
};
|
531
537
|
}
|
532
|
-
case
|
538
|
+
case 30:
|
533
539
|
if (!(componentSignEnum.EASY_PAY_WALLET === _this5._componentSign)) {
|
534
540
|
_context2.next = 40;
|
535
541
|
break;
|
536
542
|
}
|
537
543
|
_ref8 = params.paymentSessionConfig || {}, _ref8$productSceneVer = _ref8.productSceneVersion, productSceneVersion = _ref8$productSceneVer === void 0 ? '' : _ref8$productSceneVer, _ref8$productScene = _ref8.productScene, productScene = _ref8$productScene === void 0 ? '' : _ref8$productScene;
|
538
|
-
|
544
|
+
_ref9 = ((_this5$_renderParams7 = _this5._renderParams) === null || _this5$_renderParams7 === void 0 ? void 0 : _this5$_renderParams7.paymentSessionMetaData) || {}, _ref9$action = _ref9.action, _ref9$action2 = _ref9$action === void 0 ? {} : _ref9$action, _ref9$action2$autoDeb = _ref9$action2.autoDebitWithToken, autoDebitWithToken = _ref9$action2$autoDeb === void 0 ? false : _ref9$action2$autoDeb;
|
545
|
+
if (!((_this5$_renderParams8 = _this5._renderParams) !== null && _this5$_renderParams8 !== void 0 && (_this5$_renderParams8 = _this5$_renderParams8.paymentSessionMetaData) !== null && _this5$_renderParams8 !== void 0 && (_this5$_renderParams8 = _this5$_renderParams8.action) !== null && _this5$_renderParams8 !== void 0 && _this5$_renderParams8.skipSdkQuery && enableEasypayApiOptimize)) {
|
539
546
|
_context2.next = 35;
|
540
547
|
break;
|
541
548
|
}
|
@@ -562,7 +569,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
562
569
|
_context2.next = 50;
|
563
570
|
break;
|
564
571
|
}
|
565
|
-
action = ((_this5$
|
572
|
+
action = ((_this5$_renderParams9 = _this5._renderParams) === null || _this5$_renderParams9 === void 0 || (_this5$_renderParams9 = _this5$_renderParams9.paymentSessionMetaData) === null || _this5$_renderParams9 === void 0 ? void 0 : _this5$_renderParams9.action) || {};
|
566
573
|
signType = isPC() ? action === null || action === void 0 || (_action$web2 = action.web) === null || _action$web2 === void 0 ? void 0 : _action$web2.signType : action === null || action === void 0 || (_action$wap2 = action.wap) === null || _action$wap2 === void 0 ? void 0 : _action$wap2.signType;
|
567
574
|
if (!(signType === 'SMS')) {
|
568
575
|
_context2.next = 45;
|
@@ -641,24 +648,24 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
641
648
|
}, {
|
642
649
|
key: "createSubmitPromise",
|
643
650
|
value: function createSubmitPromise() {
|
644
|
-
var _this$
|
645
|
-
_this$_renderParams12,
|
651
|
+
var _this$_renderParams12,
|
646
652
|
_this$_renderParams13,
|
653
|
+
_this$_renderParams14,
|
647
654
|
_this6 = this;
|
648
655
|
this._performanceData.push({
|
649
656
|
key: 'sdk_submit_start',
|
650
657
|
value: Date.now()
|
651
658
|
});
|
652
659
|
var params = {
|
653
|
-
paymentSessionData: this._renderParams && ((_this$
|
654
|
-
paymentSessionConfig: (_this$
|
660
|
+
paymentSessionData: this._renderParams && ((_this$_renderParams12 = this._renderParams) === null || _this$_renderParams12 === void 0 ? void 0 : _this$_renderParams12.sessionData) || '',
|
661
|
+
paymentSessionConfig: (_this$_renderParams13 = this._renderParams) === null || _this$_renderParams13 === void 0 || (_this$_renderParams13 = _this$_renderParams13.paymentSessionMetaData) === null || _this$_renderParams13 === void 0 ? void 0 : _this$_renderParams13.paymentSessionConfig
|
655
662
|
};
|
656
|
-
var channelBehavior = getChannelBehavior((_this$
|
663
|
+
var channelBehavior = getChannelBehavior((_this$_renderParams14 = this._renderParams) === null || _this$_renderParams14 === void 0 ? void 0 : _this$_renderParams14.paymentSessionMetaData);
|
657
664
|
// eslint-disable-next-line no-async-promise-executor
|
658
665
|
this._actionSubmitPromise = new Promise( /*#__PURE__*/function () {
|
659
|
-
var
|
666
|
+
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
|
660
667
|
var _channelBehavior$buil, _this6$_renderParams$;
|
661
|
-
var shouldSkipSubmitPayInSDK, _this6$_renderParams, _this6$_renderParams2,
|
668
|
+
var shouldSkipSubmitPayInSDK, _this6$_renderParams, _this6$_renderParams2, _ref11, _ref11$productSceneVe, productSceneVersion, _ref11$productScene, productScene, _ref12, _ref12$action, _ref12$action2, _ref12$action2$enable, enableSignAgreement, _ref12$action2$autoDe, autoDebitWithToken, extParams;
|
662
669
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
663
670
|
while (1) switch (_context3.prev = _context3.next) {
|
664
671
|
case 0:
|
@@ -670,8 +677,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
670
677
|
shouldSkipSubmitPayInSDK = !((_this6$_renderParams = _this6._renderParams) !== null && _this6$_renderParams !== void 0 && (_this6$_renderParams = _this6$_renderParams.paymentSessionMetaData) !== null && _this6$_renderParams !== void 0 && (_this6$_renderParams = _this6$_renderParams.action) !== null && _this6$_renderParams !== void 0 && _this6$_renderParams.skipSdkQuery) || componentSignEnum.EASY_PAY_WALLET !== _this6._componentSign;
|
671
678
|
}
|
672
679
|
if (componentSignEnum.EASY_PAY_WALLET === _this6._componentSign) {
|
673
|
-
|
674
|
-
|
680
|
+
_ref11 = params.paymentSessionConfig || {}, _ref11$productSceneVe = _ref11.productSceneVersion, productSceneVersion = _ref11$productSceneVe === void 0 ? '' : _ref11$productSceneVe, _ref11$productScene = _ref11.productScene, productScene = _ref11$productScene === void 0 ? '' : _ref11$productScene;
|
681
|
+
_ref12 = ((_this6$_renderParams2 = _this6._renderParams) === null || _this6$_renderParams2 === void 0 ? void 0 : _this6$_renderParams2.paymentSessionMetaData) || {}, _ref12$action = _ref12.action, _ref12$action2 = _ref12$action === void 0 ? {} : _ref12$action, _ref12$action2$enable = _ref12$action2.enableSignAgreement, enableSignAgreement = _ref12$action2$enable === void 0 ? false : _ref12$action2$enable, _ref12$action2$autoDe = _ref12$action2.autoDebitWithToken, autoDebitWithToken = _ref12$action2$autoDe === void 0 ? false : _ref12$action2$autoDe;
|
675
682
|
if (productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0' && !autoDebitWithToken) {
|
676
683
|
///EasyPay 2.0 首次传signAgreement字段
|
677
684
|
params['signAgreement'] = enableSignAgreement;
|
@@ -749,7 +756,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
749
756
|
}, _callee3);
|
750
757
|
}));
|
751
758
|
return function (_x3) {
|
752
|
-
return
|
759
|
+
return _ref10.apply(this, arguments);
|
753
760
|
};
|
754
761
|
}());
|
755
762
|
}
|
@@ -799,9 +806,13 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
799
806
|
productScene: componentSign,
|
800
807
|
productSceneVersion: productSceneVersion,
|
801
808
|
environment: this.AMSSDK.options.env.environment,
|
809
|
+
// TODO 确定一下这个参数是干啥的
|
802
810
|
appVersion: this._appVersion,
|
811
|
+
extendInfo: '',
|
812
|
+
locale: '',
|
803
813
|
instanceId: '',
|
804
|
-
isPreload: 'true'
|
814
|
+
isPreload: 'true',
|
815
|
+
mid: ''
|
805
816
|
}),
|
806
817
|
path = _getIframeUrl.path,
|
807
818
|
locationSearch = _getIframeUrl.locationSearch;
|
@@ -1244,8 +1255,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1244
1255
|
|
1245
1256
|
// 此style用于弹窗出现和高度变化时动画,动画不同,属性不同
|
1246
1257
|
this.app.style.height = parseInt(this.app.style.height) > 0 ? '100%' : "".concat(data.context.data.height, "px");
|
1258
|
+
|
1247
1259
|
// 弹出和弹入动画
|
1248
|
-
var runkeyframes =
|
1260
|
+
var runkeyframes = "@keyframes ".concat(COMPONENT_CONTAINER_ID, "-slide-in {\n 0% {\n height: 1px;\n }\n 100% {\n height: ").concat(data.context.data.height, "px;\n }\n }\n @keyframes ").concat(COMPONENT_CONTAINER_ID, "-slide-out {\n 0% {\n height: ").concat(data.context.data.height, "px;\n opacity: 1;\n }\n 50% {\n opacity: 1;\n }\n 100% {\n height: 1px;\n opacity: 0;\n }\n }");
|
1249
1261
|
// 创建style标签
|
1250
1262
|
var style = document.createElement('style');
|
1251
1263
|
style.id = animationStyleId;
|
@@ -1255,6 +1267,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1255
1267
|
style.innerHTML = runkeyframes;
|
1256
1268
|
// 将style样式存放到head标签
|
1257
1269
|
document.getElementsByTagName('head')[0].appendChild(style);
|
1270
|
+
|
1258
1271
|
// size变动时动画
|
1259
1272
|
setTimeout(function () {
|
1260
1273
|
cashier.style.transition = 'height 0.28s ease-in-out';
|
@@ -1374,9 +1387,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1374
1387
|
}
|
1375
1388
|
}, {
|
1376
1389
|
key: "handleDeclareInfo",
|
1377
|
-
value: function handleDeclareInfo(
|
1378
|
-
var
|
1379
|
-
closeDialogData =
|
1390
|
+
value: function handleDeclareInfo(_ref13) {
|
1391
|
+
var _ref13$closeDialogDat = _ref13.closeDialogData,
|
1392
|
+
closeDialogData = _ref13$closeDialogDat === void 0 ? {} : _ref13$closeDialogDat;
|
1380
1393
|
_handleDeclareInfo({
|
1381
1394
|
closeDialogData: closeDialogData
|
1382
1395
|
});
|
@@ -1517,7 +1530,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1517
1530
|
key: "sendRenderEvent",
|
1518
1531
|
value: (function () {
|
1519
1532
|
var _sendRenderEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
1520
|
-
var _this$
|
1533
|
+
var _this$_renderParams15, _this$_renderParams16, _this$_renderParams17, _this$_renderParams18, _this$_renderParams19, _this$_renderParams20, _this$AMSSDK$logger, _this$_renderParams21, _this$_renderParams22, _this$_renderParams23, _this$AMSSDK, _this$_renderParams24, res, submitRes;
|
1521
1534
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
1522
1535
|
while (1) switch (_context8.prev = _context8.next) {
|
1523
1536
|
case 0:
|
@@ -1546,12 +1559,12 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1546
1559
|
data: {
|
1547
1560
|
queryResult: res,
|
1548
1561
|
submitResult: submitRes,
|
1549
|
-
sessionResult: (_this$
|
1550
|
-
paymentSessionData: (_this$
|
1562
|
+
sessionResult: (_this$_renderParams15 = this._renderParams) === null || _this$_renderParams15 === void 0 ? void 0 : _this$_renderParams15.paymentSessionMetaData,
|
1563
|
+
paymentSessionData: (_this$_renderParams16 = this._renderParams) === null || _this$_renderParams16 === void 0 ? void 0 : _this$_renderParams16.sessionData,
|
1551
1564
|
heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
|
1552
|
-
renderDisplayType: (_this$
|
1553
|
-
appearance: (_this$
|
1554
|
-
notRedirectAfterComplete: ((_this$
|
1565
|
+
renderDisplayType: (_this$_renderParams17 = this._renderParams) === null || _this$_renderParams17 === void 0 ? void 0 : _this$_renderParams17.renderDisplayType,
|
1566
|
+
appearance: (_this$_renderParams18 = this._renderParams) === null || _this$_renderParams18 === void 0 ? void 0 : _this$_renderParams18.appearance,
|
1567
|
+
notRedirectAfterComplete: ((_this$_renderParams19 = this._renderParams) === null || _this$_renderParams19 === void 0 ? void 0 : _this$_renderParams19.notRedirectAfterComplete) === true,
|
1555
1568
|
merchantAppointParam: this._merchantAppointParam,
|
1556
1569
|
allowSubmitPayCallAhead: this._allowSubmitPayCallAhead,
|
1557
1570
|
envInfo: {
|
@@ -1559,16 +1572,16 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1559
1572
|
screenWidth: screen.width
|
1560
1573
|
},
|
1561
1574
|
logMetaData: _objectSpread(_objectSpread({
|
1562
|
-
trackId: (_this$
|
1575
|
+
trackId: (_this$_renderParams20 = this._renderParams) === null || _this$_renderParams20 === void 0 ? void 0 : _this$_renderParams20.sessionData,
|
1563
1576
|
platform: this.platform,
|
1564
1577
|
firstLogTime: (_this$AMSSDK$logger = this.AMSSDK.logger) === null || _this$AMSSDK$logger === void 0 ? void 0 : _this$AMSSDK$logger.getComponentStartTime()
|
1565
|
-
}, ((_this$
|
1566
|
-
renderDisplayType: (_this$
|
1578
|
+
}, ((_this$_renderParams21 = this._renderParams) === null || _this$_renderParams21 === void 0 || (_this$_renderParams21 = _this$_renderParams21.paymentSessionMetaData) === null || _this$_renderParams21 === void 0 ? void 0 : _this$_renderParams21.paymentSessionConfig) || {}), {}, {
|
1579
|
+
renderDisplayType: (_this$_renderParams22 = this._renderParams) === null || _this$_renderParams22 === void 0 ? void 0 : _this$_renderParams22.renderDisplayType,
|
1567
1580
|
sdkVersion: this._appVersion,
|
1568
|
-
merchantId: (_this$
|
1581
|
+
merchantId: (_this$_renderParams23 = this._renderParams) === null || _this$_renderParams23 === void 0 || (_this$_renderParams23 = _this$_renderParams23.paymentSessionMetaData) === null || _this$_renderParams23 === void 0 ? void 0 : _this$_renderParams23.clientId,
|
1569
1582
|
instanceId: (_this$AMSSDK = this.AMSSDK) === null || _this$AMSSDK === void 0 ? void 0 : _this$AMSSDK._instanceId,
|
1570
1583
|
performanceData: this._performanceData,
|
1571
|
-
paymentMethodType: (_this$
|
1584
|
+
paymentMethodType: (_this$_renderParams24 = this._renderParams) === null || _this$_renderParams24 === void 0 || (_this$_renderParams24 = _this$_renderParams24.paymentSessionMetaData) === null || _this$_renderParams24 === void 0 || (_this$_renderParams24 = _this$_renderParams24.paymentMethodInfoView) === null || _this$_renderParams24 === void 0 ? void 0 : _this$_renderParams24.paymentMethodType
|
1572
1585
|
})
|
1573
1586
|
}
|
1574
1587
|
}
|
@@ -1628,9 +1641,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1628
1641
|
}, {
|
1629
1642
|
key: "hideComponentAnimation",
|
1630
1643
|
value: function hideComponentAnimation() {
|
1631
|
-
var _container$style;
|
1632
1644
|
var container = document.getElementById(COMPONENT_CONTAINER_ID);
|
1633
|
-
if (this.app) this.app.style.height = container
|
1645
|
+
if (this.app) this.app.style.height = container.style.height;
|
1634
1646
|
if (container) {
|
1635
1647
|
// size变化动画取消
|
1636
1648
|
container.style.transition = '';
|
@@ -380,7 +380,6 @@ export var PaypalBusSubscriber = /*#__PURE__*/function (_BusSubscriber) {
|
|
380
380
|
break;
|
381
381
|
case PaypalActionEnum.destroyComponent:
|
382
382
|
this.destroyComponent(context, message);
|
383
|
-
break;
|
384
383
|
default:
|
385
384
|
console.log('Unknown action: ' + message.getAction());
|
386
385
|
}
|
package/esm/types/index.d.ts
CHANGED
@@ -40,9 +40,6 @@ export interface IcreatePaymentParams {
|
|
40
40
|
backgroundColor?: string;
|
41
41
|
};
|
42
42
|
}
|
43
|
-
export declare enum ComponentSignEnumV2 {
|
44
|
-
'ELEMENT_PAYMENT' = "ELEMENT_PAYMENT_ALL"
|
45
|
-
}
|
46
43
|
export declare enum componentSignEnum {
|
47
44
|
'EASY_PAY_WALLET' = "EASY_PAY_WALLET",
|
48
45
|
'EASY_PAY_APM' = "EASY_PAY_APM",
|
@@ -50,25 +47,24 @@ export declare enum componentSignEnum {
|
|
50
47
|
'CASHIER_PAYMENT_BANK' = "CASHIER_PAYMENT_BANK",
|
51
48
|
'CASHIER_PAYMENT_APM' = "CASHIER_PAYMENT_APM",
|
52
49
|
'AUTO_DEBIT_WALLET' = "AUTO_DEBIT_WALLET",
|
50
|
+
'AUTO_DEBIT_PAY_WALLET' = "AUTO_DEBIT_PAY_WALLET",
|
53
51
|
'NONE' = "NONE",
|
54
|
-
'VAULTING_CARD' = "VAULTING_CARD"
|
55
|
-
'ELEMENT_PAYMENT' = "ELEMENT_PAYMENT_ALL"
|
52
|
+
'VAULTING_CARD' = "VAULTING_CARD"
|
56
53
|
}
|
57
54
|
export declare enum productSceneEnum {
|
58
55
|
'EASY_PAY' = "EASY_PAY",
|
59
56
|
'CASHIER_PAYMENT' = "CASHIER_PAYMENT",
|
60
57
|
'AUTO_DEBIT' = "AUTO_DEBIT",
|
58
|
+
'AUTO_DEBIT_PAY' = "AUTO_DEBIT_PAY",
|
61
59
|
'VAULTING' = "VAULTING",
|
62
60
|
'FLASH_BUY' = "FLASH_BUY",
|
63
|
-
'CARD_APPLE_PAY' = "CARD_APPLE_PAY"
|
64
|
-
'ELEMENT_PAYMENT' = "ELEMENT_PAYMENT"
|
61
|
+
'CARD_APPLE_PAY' = "CARD_APPLE_PAY"
|
65
62
|
}
|
66
63
|
export declare enum paymentMethodCategoryTypeEnum {
|
67
64
|
'CARD' = "CARD",
|
68
65
|
'WALLET' = "WALLET",
|
69
66
|
'BANK' = "BANK",
|
70
|
-
'APM' = "APM"
|
71
|
-
'ALL' = "ALL"
|
67
|
+
'APM' = "APM"
|
72
68
|
}
|
73
69
|
export interface DeviceIdParameter {
|
74
70
|
scene?: string;
|
@@ -121,7 +117,7 @@ export interface Isubmit {
|
|
121
117
|
}
|
122
118
|
export interface IpaymentSessionConfig {
|
123
119
|
productScene: productSceneEnum;
|
124
|
-
paymentMethodCategoryType
|
120
|
+
paymentMethodCategoryType: paymentMethodCategoryTypeEnum;
|
125
121
|
productSceneVersion: string;
|
126
122
|
}
|
127
123
|
export interface IpaymentSecurityConfig {
|
@@ -142,6 +138,10 @@ export interface InitSecurityConfig {
|
|
142
138
|
product: productSceneEnum;
|
143
139
|
region?: string;
|
144
140
|
}
|
141
|
+
export interface frontModulesToBeLoadedInterface {
|
142
|
+
acquirerName: string;
|
143
|
+
scriptUrl: string;
|
144
|
+
}
|
145
145
|
export interface IpaymentSessionMetaData {
|
146
146
|
clientId?: string;
|
147
147
|
renderDisplayType?: string;
|
@@ -229,6 +229,7 @@ export interface IpaymentSessionMetaData {
|
|
229
229
|
*/
|
230
230
|
agreementDescription?: string;
|
231
231
|
};
|
232
|
+
frontModulesToBeLoaded?: frontModulesToBeLoadedInterface[];
|
232
233
|
};
|
233
234
|
}
|
234
235
|
export interface IPaymentSessionFactor {
|
package/esm/types/index.js
CHANGED
@@ -15,10 +15,6 @@ export var renderDisplayTypeEnum = /*#__PURE__*/function (renderDisplayTypeEnum)
|
|
15
15
|
renderDisplayTypeEnum["inline"] = "inline";
|
16
16
|
return renderDisplayTypeEnum;
|
17
17
|
}({});
|
18
|
-
export var ComponentSignEnumV2 = /*#__PURE__*/function (ComponentSignEnumV2) {
|
19
|
-
ComponentSignEnumV2["ELEMENT_PAYMENT"] = "ELEMENT_PAYMENT_ALL";
|
20
|
-
return ComponentSignEnumV2;
|
21
|
-
}({});
|
22
18
|
export var componentSignEnum = /*#__PURE__*/function (componentSignEnum) {
|
23
19
|
componentSignEnum["EASY_PAY_WALLET"] = "EASY_PAY_WALLET";
|
24
20
|
componentSignEnum["EASY_PAY_APM"] = "EASY_PAY_APM";
|
@@ -26,19 +22,19 @@ export var componentSignEnum = /*#__PURE__*/function (componentSignEnum) {
|
|
26
22
|
componentSignEnum["CASHIER_PAYMENT_BANK"] = "CASHIER_PAYMENT_BANK";
|
27
23
|
componentSignEnum["CASHIER_PAYMENT_APM"] = "CASHIER_PAYMENT_APM";
|
28
24
|
componentSignEnum["AUTO_DEBIT_WALLET"] = "AUTO_DEBIT_WALLET";
|
25
|
+
componentSignEnum["AUTO_DEBIT_PAY_WALLET"] = "AUTO_DEBIT_PAY_WALLET";
|
29
26
|
componentSignEnum["NONE"] = "NONE";
|
30
27
|
componentSignEnum["VAULTING_CARD"] = "VAULTING_CARD";
|
31
|
-
componentSignEnum["ELEMENT_PAYMENT"] = "ELEMENT_PAYMENT_ALL";
|
32
28
|
return componentSignEnum;
|
33
29
|
}({});
|
34
30
|
export var productSceneEnum = /*#__PURE__*/function (productSceneEnum) {
|
35
31
|
productSceneEnum["EASY_PAY"] = "EASY_PAY";
|
36
32
|
productSceneEnum["CASHIER_PAYMENT"] = "CASHIER_PAYMENT";
|
37
33
|
productSceneEnum["AUTO_DEBIT"] = "AUTO_DEBIT";
|
34
|
+
productSceneEnum["AUTO_DEBIT_PAY"] = "AUTO_DEBIT_PAY";
|
38
35
|
productSceneEnum["VAULTING"] = "VAULTING";
|
39
36
|
productSceneEnum["FLASH_BUY"] = "FLASH_BUY";
|
40
37
|
productSceneEnum["CARD_APPLE_PAY"] = "CARD_APPLE_PAY";
|
41
|
-
productSceneEnum["ELEMENT_PAYMENT"] = "ELEMENT_PAYMENT";
|
42
38
|
return productSceneEnum;
|
43
39
|
}({});
|
44
40
|
export var paymentMethodCategoryTypeEnum = /*#__PURE__*/function (paymentMethodCategoryTypeEnum) {
|
@@ -46,7 +42,6 @@ export var paymentMethodCategoryTypeEnum = /*#__PURE__*/function (paymentMethodC
|
|
46
42
|
paymentMethodCategoryTypeEnum["WALLET"] = "WALLET";
|
47
43
|
paymentMethodCategoryTypeEnum["BANK"] = "BANK";
|
48
44
|
paymentMethodCategoryTypeEnum["APM"] = "APM";
|
49
|
-
paymentMethodCategoryTypeEnum["ALL"] = "ALL";
|
50
45
|
return paymentMethodCategoryTypeEnum;
|
51
46
|
}({});
|
52
47
|
export var payPalConfigurationIntentEnum = /*#__PURE__*/function (payPalConfigurationIntentEnum) {
|
package/esm/util/index.d.ts
CHANGED
@@ -39,4 +39,10 @@ declare const getOrSetStorageId: (key: string, value?: string) => string;
|
|
39
39
|
declare const checkTimeElapsed: () => boolean;
|
40
40
|
declare const isFunction: (func: any) => boolean;
|
41
41
|
declare function parseBase64ToString(base64: string): string;
|
42
|
-
|
42
|
+
declare function loadSDKScript({ src, attrOptions, timeOut, loadCallback }: {
|
43
|
+
src: any;
|
44
|
+
attrOptions?: {};
|
45
|
+
timeOut?: number;
|
46
|
+
loadCallback?: any;
|
47
|
+
}, logger: any): Promise<unknown>;
|
48
|
+
export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, isFunction, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString, loadSDKScript };
|
package/esm/util/index.js
CHANGED
@@ -261,4 +261,70 @@ function parseBase64ToString(base64) {
|
|
261
261
|
return null;
|
262
262
|
}
|
263
263
|
}
|
264
|
-
|
264
|
+
function loadSDKScript(_ref, logger) {
|
265
|
+
var _this2 = this;
|
266
|
+
var src = _ref.src,
|
267
|
+
_ref$attrOptions = _ref.attrOptions,
|
268
|
+
attrOptions = _ref$attrOptions === void 0 ? {} : _ref$attrOptions,
|
269
|
+
_ref$timeOut = _ref.timeOut,
|
270
|
+
timeOut = _ref$timeOut === void 0 ? 3 : _ref$timeOut,
|
271
|
+
_ref$loadCallback = _ref.loadCallback,
|
272
|
+
loadCallback = _ref$loadCallback === void 0 ? null : _ref$loadCallback;
|
273
|
+
return new Promise(function (resolve, reject) {
|
274
|
+
// 创建 script 标签
|
275
|
+
logger.logInfo({
|
276
|
+
title: 'load_item_sdk_start'
|
277
|
+
}, {
|
278
|
+
src: src,
|
279
|
+
attrOptions: JSON.stringify(attrOptions)
|
280
|
+
});
|
281
|
+
console.time();
|
282
|
+
var script = document.createElement('script');
|
283
|
+
var timer = null;
|
284
|
+
script.type = 'text/javascript';
|
285
|
+
|
286
|
+
// 监听加载完成事件
|
287
|
+
script.onload = function () {
|
288
|
+
// 当脚本加载完毕时,执行回调函数
|
289
|
+
logger.logInfo({
|
290
|
+
title: 'load_item_sdk_end'
|
291
|
+
}, {
|
292
|
+
src: src,
|
293
|
+
attrOptions: JSON.stringify(attrOptions)
|
294
|
+
});
|
295
|
+
console.timeEnd();
|
296
|
+
clearTimeout(timer);
|
297
|
+
if (loadCallback) loadCallback();
|
298
|
+
resolve(true);
|
299
|
+
};
|
300
|
+
|
301
|
+
// 监听加载失败事件
|
302
|
+
script.onerror = function () {
|
303
|
+
logger.logError({
|
304
|
+
title: 'load_item_sdk_error'
|
305
|
+
}, {
|
306
|
+
src: src,
|
307
|
+
attrOptions: JSON.stringify(attrOptions)
|
308
|
+
});
|
309
|
+
clearTimeout(timer);
|
310
|
+
console.error('The script ' + src + ' is not accessible.');
|
311
|
+
reject(false);
|
312
|
+
};
|
313
|
+
timer = setTimeout(function () {
|
314
|
+
_this2.logger.logError({
|
315
|
+
title: 'load_item_sdk_timeout'
|
316
|
+
}, {
|
317
|
+
src: src,
|
318
|
+
attrOptions: JSON.stringify(attrOptions)
|
319
|
+
});
|
320
|
+
reject(false);
|
321
|
+
}, timeOut * 1000);
|
322
|
+
script.src = src;
|
323
|
+
attrOptions && Object.keys(attrOptions).forEach(function (key) {
|
324
|
+
script.setAttribute(key, attrOptions[key]);
|
325
|
+
});
|
326
|
+
// 将 script 标签添加到页面中
|
327
|
+
document.head.appendChild(script);
|
328
|
+
});
|
329
|
+
}
|
330
|
+
export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, isFunction, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString, loadSDKScript };
|
package/esm/util/security.d.ts
CHANGED
@@ -18,7 +18,6 @@ export declare const sceneMap: {
|
|
18
18
|
EASYPAY: string;
|
19
19
|
EASY_PAY: string;
|
20
20
|
FLASH_BUY: string;
|
21
|
-
ELEMENT_PAYMENT: string;
|
22
21
|
};
|
23
22
|
export declare const getSecurityHost: (region: string) => string;
|
24
23
|
export declare const getSecurityScene: (product: string) => string;
|
package/esm/util/security.js
CHANGED
@@ -24,7 +24,7 @@ export var securityHost = {
|
|
24
24
|
US: 'https://open-na-global.alipay.com/api/open/risk_client',
|
25
25
|
DE: 'https://open-de-global.alipay.com/api/open/risk_client'
|
26
26
|
};
|
27
|
-
export var sceneMap = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(
|
27
|
+
export var sceneMap = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, productSceneEnum.CASHIER_PAYMENT, 'Acquirer'), productSceneEnum.AUTO_DEBIT, 'Acquirer'), productSceneEnum.VAULTING, 'Acquirer'), productSceneEnum.CARD_APPLE_PAY, 'Acquirer'), "EASYPAY", 'EasyPay'), productSceneEnum.EASY_PAY, 'EasyPay'), productSceneEnum.FLASH_BUY, 'OneAccount');
|
28
28
|
export var getSecurityHost = function getSecurityHost(region) {
|
29
29
|
return securityHost[region] || securityHost[SecurityRegionEnum.SG];
|
30
30
|
};
|
package/esm/util/upgrade.d.ts
CHANGED
@@ -27,13 +27,13 @@ export declare function isGreyscaleMatch(item: UpgradeItem, randomGreyscale: num
|
|
27
27
|
export declare const getMatchAppVersion: (_extendInfo: string, sdkInfo: UpgradeSdkInfo) => string;
|
28
28
|
/**
|
29
29
|
* 获取保存的加载版本
|
30
|
-
* @param
|
30
|
+
* @param versionKey
|
31
31
|
* @returns
|
32
32
|
*/
|
33
|
-
export declare const getLastAppVersion: (
|
33
|
+
export declare const getLastAppVersion: (versionKey: string) => string;
|
34
34
|
/**
|
35
35
|
* 保存指定场景的加载版本供下次使用
|
36
|
-
* @param
|
36
|
+
* @param versionKey
|
37
37
|
* @returns
|
38
38
|
*/
|
39
|
-
export declare const setLastAppVersion: (
|
39
|
+
export declare const setLastAppVersion: (versionKey: string, appVersion: string) => boolean;
|
package/esm/util/upgrade.js
CHANGED
@@ -89,12 +89,12 @@ export var getMatchAppVersion = function getMatchAppVersion(_extendInfo, sdkInfo
|
|
89
89
|
|
90
90
|
/**
|
91
91
|
* 获取保存的加载版本
|
92
|
-
* @param
|
92
|
+
* @param versionKey
|
93
93
|
* @returns
|
94
94
|
*/
|
95
|
-
export var getLastAppVersion = function getLastAppVersion(
|
95
|
+
export var getLastAppVersion = function getLastAppVersion(versionKey) {
|
96
96
|
try {
|
97
|
-
var key = "Antom_".concat(
|
97
|
+
var key = "Antom_".concat(versionKey, "_LastAppVersion");
|
98
98
|
return getStorageString(key, '');
|
99
99
|
} catch (error) {
|
100
100
|
return '';
|
@@ -102,12 +102,12 @@ export var getLastAppVersion = function getLastAppVersion(productScene) {
|
|
102
102
|
};
|
103
103
|
/**
|
104
104
|
* 保存指定场景的加载版本供下次使用
|
105
|
-
* @param
|
105
|
+
* @param versionKey
|
106
106
|
* @returns
|
107
107
|
*/
|
108
|
-
export var setLastAppVersion = function setLastAppVersion(
|
108
|
+
export var setLastAppVersion = function setLastAppVersion(versionKey, appVersion) {
|
109
109
|
try {
|
110
|
-
var key = "Antom_".concat(
|
110
|
+
var key = "Antom_".concat(versionKey, "_LastAppVersion");
|
111
111
|
return setStorageString(key, appVersion);
|
112
112
|
} catch (error) {
|
113
113
|
return false;
|
package/package.json
CHANGED