@alipay/ams-checkout 1.11.0 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/umd/ams-checkout.min.js +1 -1
- package/esm/config/request.js +3 -3
- package/esm/core/bus/index.d.ts +1 -1
- package/esm/core/bus/interface.d.ts +5 -1
- package/esm/core/bus/interface.js +6 -1
- package/esm/core/component/index.d.ts +1 -0
- package/esm/core/component/index.js +14 -6
- package/esm/core/instance/index.d.ts +8 -1
- package/esm/core/instance/index.js +20 -13
- package/esm/plugin/applepay/component.d.ts +1 -1
- package/esm/plugin/applepay/component.js +5 -5
- package/esm/plugin/applepay/index.d.ts +1 -1
- package/esm/plugin/applepay/index.js +6 -6
- package/esm/plugin/component/component.popup.style.js +1 -1
- package/esm/plugin/component/index.d.ts +1 -2
- package/esm/plugin/component/index.js +137 -83
- package/esm/plugin/const.js +18 -4
- package/esm/plugin/paypal/index.d.ts +20 -0
- package/esm/plugin/paypal/index.js +389 -0
- package/esm/plugin/type.d.ts +2 -2
- package/esm/plugin/utils.d.ts +6 -0
- package/esm/plugin/utils.js +21 -0
- package/esm/request/index.js +8 -14
- package/esm/types/index.d.ts +58 -3
- package/esm/types/index.js +18 -0
- package/esm/util/index.d.ts +2 -1
- package/esm/util/index.js +4 -2
- package/esm/util/logger.d.ts +4 -0
- package/esm/util/logger.js +23 -3
- package/esm/util/versionCompare.d.ts +3 -1
- package/esm/util/versionCompare.js +75 -0
- package/package.json +1 -1
@@ -22,6 +22,7 @@ import { queryPaymentInfo, submitPayInfo } from "../../service";
|
|
22
22
|
import { componentSignEnum, eventCodeEnum, messageName, platformEnum, productSceneEnum, RedirectType, renderDisplayTypeEnum, targetEnum } from "../../types";
|
23
23
|
import { getType, isJsonString, isPC } from "../../util";
|
24
24
|
import { isLocalMock } from "../../util/mock";
|
25
|
+
import { matchVersion } from "../../util/versionCompare";
|
25
26
|
import { createIframe, createPreloadIframe, getAppDomain, getIframeUrl } from "./cashierApp";
|
26
27
|
import { addInlineLoading, createInlineBaseElement } from "./component.inline.style";
|
27
28
|
import { addPopupLoading, createBaseElement, createMockup, createRetentionPopup, handleDeclareInfo as _handleDeclareInfo, hideRetentionPopup, removeRetentionPopup as _removeRetentionPopup } from "./component.popup.style";
|
@@ -52,9 +53,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
52
53
|
_defineProperty(this, "_renderDisplayType", renderDisplayTypeEnum.popup);
|
53
54
|
_defineProperty(this, "_multipleCallbackEvents", void 0);
|
54
55
|
_defineProperty(this, "_merchantAppointParam", void 0);
|
55
|
-
_defineProperty(this, "_webAppHeartBeatTimeoutId", void 0);
|
56
56
|
_defineProperty(this, "_webAppHeartBeatTimeoutFn", void 0);
|
57
|
-
this._appVersion = '1.
|
57
|
+
this._appVersion = '1.12.0';
|
58
58
|
this._isInitComponent = false;
|
59
59
|
this._selector = "#".concat(COMPONENT_SECTION_ID);
|
60
60
|
this.createIframeNode = function () {
|
@@ -94,7 +94,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
94
94
|
}, {
|
95
95
|
key: "initLoggerMeta",
|
96
96
|
value: function initLoggerMeta() {
|
97
|
-
var _this$_renderParams, _paymentSessionMetaDa, _this$_renderParams2;
|
97
|
+
var _this$_renderParams, _paymentSessionMetaDa, _this$_renderParams2, _this$_renderParams3;
|
98
98
|
var paymentSessionMetaData = (_this$_renderParams = this._renderParams) === null || _this$_renderParams === void 0 ? void 0 : _this$_renderParams.paymentSessionMetaData;
|
99
99
|
var paymentSessionConfig = paymentSessionMetaData.paymentSessionConfig;
|
100
100
|
this.AMSSDK.logger.setMedta({
|
@@ -110,9 +110,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
110
110
|
productSceneVersion: paymentSessionConfig === null || paymentSessionConfig === void 0 ? void 0 : paymentSessionConfig.productSceneVersion,
|
111
111
|
paymentMethodType: paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa = paymentSessionMetaData.paymentMethodInfoView) === null || _paymentSessionMetaDa === void 0 ? void 0 : _paymentSessionMetaDa.paymentMethodType,
|
112
112
|
paymentMethodCategoryType: paymentSessionConfig === null || paymentSessionConfig === void 0 ? void 0 : paymentSessionConfig.paymentMethodCategoryType,
|
113
|
-
requestSeq: (_this$_renderParams2 = this._renderParams) === null || _this$_renderParams2 === void 0 ? void 0 : _this$_renderParams2.paymentSessionData
|
113
|
+
requestSeq: (_this$_renderParams2 = this._renderParams) === null || _this$_renderParams2 === void 0 ? void 0 : _this$_renderParams2.paymentSessionData,
|
114
|
+
trackId: (_this$_renderParams3 = this._renderParams) === null || _this$_renderParams3 === void 0 ? void 0 : _this$_renderParams3.sessionData
|
114
115
|
});
|
115
|
-
this.AMSSDK.logger.setComponentStartTime(Date.now());
|
116
116
|
}
|
117
117
|
|
118
118
|
/**
|
@@ -131,9 +131,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
131
131
|
}, {
|
132
132
|
key: "initSecurity",
|
133
133
|
value: function initSecurity() {
|
134
|
-
var _this$
|
134
|
+
var _this$_renderParams4,
|
135
135
|
_this = this;
|
136
|
-
var product = (_this$
|
136
|
+
var product = (_this$_renderParams4 = this._renderParams) === null || _this$_renderParams4 === void 0 || (_this$_renderParams4 = _this$_renderParams4.paymentSessionMetaData) === null || _this$_renderParams4 === void 0 || (_this$_renderParams4 = _this$_renderParams4.paymentSessionConfig) === null || _this$_renderParams4 === void 0 ? void 0 : _this$_renderParams4.productScene;
|
137
137
|
if (componentSignEnum.CASHIER_PAYMENT_APM === this._componentSign) return;
|
138
138
|
if (componentSignEnum.CASHIER_PAYMENT_BANK === this._componentSign) {
|
139
139
|
this.AMSSDK.logger.logInfo({
|
@@ -364,7 +364,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
364
364
|
this._actionQueryPromise = new Promise( /*#__PURE__*/function () {
|
365
365
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(resolve, reject) {
|
366
366
|
var _this5$_renderParams, _this5$_renderParams2, _this5$_renderParams3, _this5$_renderParams4, _this5$_renderParams5;
|
367
|
-
var envInfo, params, _ref3, extendInfo, enableVaultingApiOptimize, enableEasypayApiOptimize, extendInfoData, _this5$_renderParams6, _this5$_renderParams7,
|
367
|
+
var envInfo, params, _ref3, _ref3$extendInfo, extendInfo, enableVaultingApiOptimize, enableEasypayApiOptimize, _ref4, skipSdkQuery, skipSdkQueryForm, extendInfoData, ifSkip, _this5$_renderParams6, _this5$_renderParams7, _ref5, _ref5$productSceneVer, productSceneVersion, _ref5$productScene, productScene, _ref6, _ref6$action, _ref6$action2, _ref6$action2$autoDeb, autoDebitWithToken, _this5$_renderParams8, _action$web, _action$wap, action, signType;
|
368
368
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
369
369
|
while (1) switch (_context2.prev = _context2.next) {
|
370
370
|
case 0:
|
@@ -380,9 +380,10 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
380
380
|
/**
|
381
381
|
* @description Simulated or unnecessary scenarios
|
382
382
|
*/
|
383
|
-
_ref3 = ((_this5$_renderParams4 = _this5._renderParams) === null || _this5$_renderParams4 === void 0 ? void 0 : _this5$_renderParams4.paymentSessionMetaData) || {}, extendInfo = _ref3.extendInfo;
|
383
|
+
_ref3 = ((_this5$_renderParams4 = _this5._renderParams) === null || _this5$_renderParams4 === void 0 ? void 0 : _this5$_renderParams4.paymentSessionMetaData) || {}, _ref3$extendInfo = _ref3.extendInfo, extendInfo = _ref3$extendInfo === void 0 ? '' : _ref3$extendInfo;
|
384
384
|
enableVaultingApiOptimize = false;
|
385
385
|
enableEasypayApiOptimize = false;
|
386
|
+
_ref4 = ((_this5$_renderParams5 = _this5._renderParams) === null || _this5$_renderParams5 === void 0 || (_this5$_renderParams5 = _this5$_renderParams5.paymentSessionMetaData) === null || _this5$_renderParams5 === void 0 ? void 0 : _this5$_renderParams5.action) || {}, skipSdkQuery = _ref4.skipSdkQuery, skipSdkQueryForm = _ref4.skipSdkQueryForm;
|
386
387
|
try {
|
387
388
|
extendInfoData = JSON.parse(extendInfo);
|
388
389
|
enableVaultingApiOptimize = extendInfoData.enableVaultingApiOptimize || false;
|
@@ -391,99 +392,128 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
391
392
|
console.log(error);
|
392
393
|
}
|
393
394
|
if (!isLocalMock()) {
|
394
|
-
_context2.next =
|
395
|
+
_context2.next = 9;
|
395
396
|
break;
|
396
397
|
}
|
397
398
|
return _context2.abrupt("return", resolve({
|
398
399
|
message: 'sdk no need to make query request',
|
399
400
|
success: true
|
400
401
|
}));
|
401
|
-
case
|
402
|
-
if (!(componentSignEnum.VAULTING_CARD === _this5._componentSign
|
403
|
-
_context2.next =
|
402
|
+
case 9:
|
403
|
+
if (!(componentSignEnum.VAULTING_CARD === _this5._componentSign)) {
|
404
|
+
_context2.next = 21;
|
404
405
|
break;
|
405
406
|
}
|
406
|
-
|
407
|
+
if (!enableVaultingApiOptimize) {
|
408
|
+
_context2.next = 21;
|
409
|
+
break;
|
410
|
+
}
|
411
|
+
if (!skipSdkQueryForm) {
|
412
|
+
_context2.next = 18;
|
413
|
+
break;
|
414
|
+
}
|
415
|
+
// 优先判断 skipSdkQueryForm
|
416
|
+
ifSkip = matchVersion(skipSdkQueryForm, _this5._appVersion);
|
417
|
+
if (!ifSkip) {
|
418
|
+
_context2.next = 16;
|
419
|
+
break;
|
420
|
+
}
|
421
|
+
resolve({
|
407
422
|
message: 'sdk no need to make query request',
|
408
423
|
success: true
|
409
|
-
})
|
410
|
-
|
424
|
+
});
|
425
|
+
return _context2.abrupt("return");
|
426
|
+
case 16:
|
427
|
+
_context2.next = 21;
|
428
|
+
break;
|
429
|
+
case 18:
|
430
|
+
if (!skipSdkQuery) {
|
431
|
+
_context2.next = 21;
|
432
|
+
break;
|
433
|
+
}
|
434
|
+
resolve({
|
435
|
+
message: 'sdk no need to make query request',
|
436
|
+
success: true
|
437
|
+
});
|
438
|
+
return _context2.abrupt("return");
|
439
|
+
case 21:
|
411
440
|
if (!(componentSignEnum.CASHIER_PAYMENT_CARD === _this5._componentSign || componentSignEnum.VAULTING_CARD === _this5._componentSign)) {
|
412
|
-
_context2.next =
|
441
|
+
_context2.next = 27;
|
413
442
|
break;
|
414
443
|
}
|
415
444
|
params.paymentMethodType = 'CARD';
|
416
|
-
_context2.next =
|
445
|
+
_context2.next = 25;
|
417
446
|
return _this5.getDeviceIdAndLog();
|
418
|
-
case
|
447
|
+
case 25:
|
419
448
|
envInfo.deviceId = _context2.sent;
|
420
449
|
if (window.navigator.userAgent.indexOf('miniProgram') > -1) {
|
421
450
|
envInfo.extendInfo = {
|
422
451
|
WAP_SUB_TYPE: 'WECHAT_MINI_PROGRAM'
|
423
452
|
};
|
424
453
|
}
|
425
|
-
case
|
454
|
+
case 27:
|
426
455
|
if (!(componentSignEnum.EASY_PAY_WALLET === _this5._componentSign)) {
|
427
|
-
_context2.next =
|
456
|
+
_context2.next = 37;
|
428
457
|
break;
|
429
458
|
}
|
430
|
-
|
431
|
-
|
459
|
+
_ref5 = params.paymentSessionConfig || {}, _ref5$productSceneVer = _ref5.productSceneVersion, productSceneVersion = _ref5$productSceneVer === void 0 ? '' : _ref5$productSceneVer, _ref5$productScene = _ref5.productScene, productScene = _ref5$productScene === void 0 ? '' : _ref5$productScene;
|
460
|
+
_ref6 = ((_this5$_renderParams6 = _this5._renderParams) === null || _this5$_renderParams6 === void 0 ? void 0 : _this5$_renderParams6.paymentSessionMetaData) || {}, _ref6$action = _ref6.action, _ref6$action2 = _ref6$action === void 0 ? {} : _ref6$action, _ref6$action2$autoDeb = _ref6$action2.autoDebitWithToken, autoDebitWithToken = _ref6$action2$autoDeb === void 0 ? false : _ref6$action2$autoDeb;
|
432
461
|
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)) {
|
433
|
-
_context2.next =
|
462
|
+
_context2.next = 32;
|
434
463
|
break;
|
435
464
|
}
|
436
465
|
return _context2.abrupt("return", resolve({
|
437
466
|
message: 'sdk no need to make query request',
|
438
467
|
success: true
|
439
468
|
}));
|
440
|
-
case
|
469
|
+
case 32:
|
441
470
|
if (!(productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0' && !autoDebitWithToken)) {
|
442
|
-
_context2.next =
|
471
|
+
_context2.next = 34;
|
443
472
|
break;
|
444
473
|
}
|
445
474
|
return _context2.abrupt("return", resolve({
|
446
475
|
message: 'sdk no need to make query request',
|
447
476
|
success: true
|
448
477
|
}));
|
449
|
-
case
|
450
|
-
_context2.next =
|
478
|
+
case 34:
|
479
|
+
_context2.next = 36;
|
451
480
|
return _this5.getDeviceIdAndLog();
|
452
|
-
case
|
481
|
+
case 36:
|
453
482
|
envInfo.deviceId = _context2.sent;
|
454
|
-
case
|
483
|
+
case 37:
|
455
484
|
if (!(componentSignEnum.AUTO_DEBIT_WALLET === _this5._componentSign)) {
|
456
|
-
_context2.next =
|
485
|
+
_context2.next = 47;
|
457
486
|
break;
|
458
487
|
}
|
459
488
|
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) || {};
|
460
489
|
signType = isPC() ? action === null || action === void 0 || (_action$web = action.web) === null || _action$web === void 0 ? void 0 : _action$web.signType : action === null || action === void 0 || (_action$wap = action.wap) === null || _action$wap === void 0 ? void 0 : _action$wap.signType;
|
461
490
|
if (!(signType === 'SMS')) {
|
462
|
-
_context2.next =
|
491
|
+
_context2.next = 42;
|
463
492
|
break;
|
464
493
|
}
|
465
494
|
return _context2.abrupt("return", resolve({
|
466
495
|
message: 'sdk no need to make query request',
|
467
496
|
success: true
|
468
497
|
}));
|
469
|
-
case
|
498
|
+
case 42:
|
470
499
|
if (!(!signType || signType !== 'REDIRECT')) {
|
471
|
-
_context2.next =
|
500
|
+
_context2.next = 44;
|
472
501
|
break;
|
473
502
|
}
|
474
503
|
return _context2.abrupt("return", resolve({
|
475
504
|
success: false
|
476
505
|
}));
|
477
|
-
case
|
478
|
-
_context2.next =
|
506
|
+
case 44:
|
507
|
+
_context2.next = 46;
|
479
508
|
return _this5.getDeviceIdAndLog();
|
480
|
-
case
|
509
|
+
case 46:
|
481
510
|
envInfo.deviceId = _context2.sent;
|
482
|
-
case
|
511
|
+
case 47:
|
483
512
|
_this5.AMSSDK.logger.logInfo({
|
484
513
|
title: 'sdk_event_sdkQuery'
|
485
514
|
}, {
|
486
|
-
paymentSessionConfig: JSON.stringify(params.paymentSessionConfig)
|
515
|
+
paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
|
516
|
+
requestBody: params
|
487
517
|
}).send();
|
488
518
|
queryPaymentInfo(params, {
|
489
519
|
env: _this5.AMSSDK.options.env.environment,
|
@@ -494,6 +524,12 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
494
524
|
value: Date.now()
|
495
525
|
});
|
496
526
|
resolve(res);
|
527
|
+
_this5.AMSSDK.logger.logInfo({
|
528
|
+
title: 'sdk_event_sdkQueryEnd'
|
529
|
+
}, {
|
530
|
+
paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
|
531
|
+
responseBody: res
|
532
|
+
}).send();
|
497
533
|
}).catch(function (err) {
|
498
534
|
if ([componentSignEnum.CASHIER_PAYMENT_CARD, componentSignEnum.VAULTING_CARD, componentSignEnum.CASHIER_PAYMENT_APM].includes(_this5._componentSign)) {
|
499
535
|
return resolve({
|
@@ -503,15 +539,15 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
503
539
|
_this5.dispatchToSDK(EVENT.error.name, {
|
504
540
|
code: ERRORMESSAGE.CREATECOMPONENT_ERROR.code
|
505
541
|
});
|
506
|
-
|
507
|
-
|
508
|
-
_this5.AMSSDK.logger.logInfo({
|
509
|
-
title: 'sdk_event_sdkQueryEnd'
|
542
|
+
_this5.AMSSDK.logger.logError({
|
543
|
+
title: 'sdk_event_sdkQuery_failed'
|
510
544
|
}, {
|
511
|
-
paymentSessionConfig: JSON.stringify(params.paymentSessionConfig)
|
545
|
+
paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
|
546
|
+
errorReason: err
|
512
547
|
}).send();
|
548
|
+
reject(err);
|
513
549
|
});
|
514
|
-
case
|
550
|
+
case 49:
|
515
551
|
case "end":
|
516
552
|
return _context2.stop();
|
517
553
|
}
|
@@ -528,21 +564,21 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
528
564
|
}, {
|
529
565
|
key: "createSubmitPromise",
|
530
566
|
value: function createSubmitPromise() {
|
531
|
-
var _this$
|
532
|
-
_this$
|
567
|
+
var _this$_renderParams5,
|
568
|
+
_this$_renderParams6,
|
533
569
|
_this6 = this;
|
534
570
|
this._performanceData.push({
|
535
571
|
key: 'sdk_submit_start',
|
536
572
|
value: Date.now()
|
537
573
|
});
|
538
574
|
var params = {
|
539
|
-
paymentSessionData: this._renderParams && ((_this$
|
540
|
-
paymentSessionConfig: (_this$
|
575
|
+
paymentSessionData: this._renderParams && ((_this$_renderParams5 = this._renderParams) === null || _this$_renderParams5 === void 0 ? void 0 : _this$_renderParams5.sessionData) || '',
|
576
|
+
paymentSessionConfig: (_this$_renderParams6 = this._renderParams) === null || _this$_renderParams6 === void 0 || (_this$_renderParams6 = _this$_renderParams6.paymentSessionMetaData) === null || _this$_renderParams6 === void 0 ? void 0 : _this$_renderParams6.paymentSessionConfig
|
541
577
|
};
|
542
578
|
|
543
579
|
// eslint-disable-next-line no-async-promise-executor
|
544
580
|
this._actionSubmitPromise = new Promise( /*#__PURE__*/function () {
|
545
|
-
var
|
581
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
|
546
582
|
var _this6$_renderParams;
|
547
583
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
548
584
|
while (1) switch (_context3.prev = _context3.next) {
|
@@ -559,7 +595,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
559
595
|
_this6.AMSSDK.logger.logInfo({
|
560
596
|
title: 'sdk_event_submitPay'
|
561
597
|
}, {
|
562
|
-
paymentSessionConfig: JSON.stringify(params.paymentSessionConfig)
|
598
|
+
paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
|
599
|
+
requestBody: params
|
563
600
|
}).send();
|
564
601
|
_context3.t0 = submitPayInfo;
|
565
602
|
_context3.t1 = params;
|
@@ -582,21 +619,23 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
582
619
|
key: 'sdk_submit_end',
|
583
620
|
value: Date.now()
|
584
621
|
});
|
585
|
-
if (res !== null && res !== void 0 && res.success) {
|
586
|
-
resolve(res);
|
587
|
-
} else {
|
588
|
-
resolve(res);
|
589
|
-
}
|
590
|
-
}).catch(function () {
|
591
|
-
resolve({
|
592
|
-
success: false
|
593
|
-
});
|
594
|
-
}).finally(function () {
|
595
622
|
_this6.AMSSDK.logger.logInfo({
|
596
623
|
title: 'sdk_event_submitPayEnd'
|
597
624
|
}, {
|
598
|
-
paymentSessionConfig: JSON.stringify(params.paymentSessionConfig)
|
625
|
+
paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
|
626
|
+
responseBody: res
|
599
627
|
}).send();
|
628
|
+
resolve(res);
|
629
|
+
}).catch(function (err) {
|
630
|
+
_this6.AMSSDK.logger.logError({
|
631
|
+
title: 'sdk_event_submitPay_failed'
|
632
|
+
}, {
|
633
|
+
paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
|
634
|
+
responseBody: err
|
635
|
+
}).send();
|
636
|
+
resolve({
|
637
|
+
success: false
|
638
|
+
});
|
600
639
|
});
|
601
640
|
case 13:
|
602
641
|
case "end":
|
@@ -605,7 +644,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
605
644
|
}, _callee3);
|
606
645
|
}));
|
607
646
|
return function (_x3) {
|
608
|
-
return
|
647
|
+
return _ref7.apply(this, arguments);
|
609
648
|
};
|
610
649
|
}());
|
611
650
|
}
|
@@ -1196,9 +1235,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1196
1235
|
}
|
1197
1236
|
}, {
|
1198
1237
|
key: "handleDeclareInfo",
|
1199
|
-
value: function handleDeclareInfo(
|
1200
|
-
var
|
1201
|
-
closeDialogData =
|
1238
|
+
value: function handleDeclareInfo(_ref8) {
|
1239
|
+
var _ref8$closeDialogData = _ref8.closeDialogData,
|
1240
|
+
closeDialogData = _ref8$closeDialogData === void 0 ? {} : _ref8$closeDialogData;
|
1202
1241
|
_handleDeclareInfo({
|
1203
1242
|
closeDialogData: closeDialogData
|
1204
1243
|
});
|
@@ -1235,12 +1274,12 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1235
1274
|
}
|
1236
1275
|
};
|
1237
1276
|
}
|
1238
|
-
if (
|
1239
|
-
clearTimeout(
|
1240
|
-
|
1277
|
+
if (window._webAppHeartBeatTimeoutId) {
|
1278
|
+
clearTimeout(window._webAppHeartBeatTimeoutId);
|
1279
|
+
window._webAppHeartBeatTimeoutId = null;
|
1241
1280
|
}
|
1242
1281
|
if (this._webAppHeartBeatTimeoutFn) {
|
1243
|
-
|
1282
|
+
window._webAppHeartBeatTimeoutId = setTimeout(this._webAppHeartBeatTimeoutFn, TIMEOUT_WEB_APP_HEART_BEAT);
|
1244
1283
|
}
|
1245
1284
|
setTimeout(function () {
|
1246
1285
|
if (_this8.isAppAttached()) {
|
@@ -1299,17 +1338,20 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1299
1338
|
key: "dispatchToApp",
|
1300
1339
|
value: function dispatchToApp(payload) {
|
1301
1340
|
var targetElement = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
1341
|
+
var sendLog = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
1302
1342
|
var data = Object.assign({}, payload, {
|
1303
1343
|
name: messageName.SDK_TO_APP,
|
1304
1344
|
mode: this.AMSSDK.options.mode,
|
1305
1345
|
appId: COMPONENTPLUGINID,
|
1306
1346
|
instanceId: this.AMSSDK._instanceId
|
1307
1347
|
});
|
1308
|
-
|
1309
|
-
|
1310
|
-
|
1311
|
-
|
1312
|
-
|
1348
|
+
if (sendLog) {
|
1349
|
+
this.AMSSDK.logger.logInfo({
|
1350
|
+
title: 'sdk_event_send_message_to_web'
|
1351
|
+
}, {
|
1352
|
+
event: data === null || data === void 0 ? void 0 : data.context.event
|
1353
|
+
}).send();
|
1354
|
+
}
|
1313
1355
|
if (targetElement && targetElement.contentWindow) {
|
1314
1356
|
return targetElement.contentWindow.postMessage(JSON.stringify(data), '*');
|
1315
1357
|
}
|
@@ -1344,7 +1386,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1344
1386
|
key: "sendRenderEvent",
|
1345
1387
|
value: (function () {
|
1346
1388
|
var _sendRenderEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
1347
|
-
var _this$
|
1389
|
+
var _this$_renderParams7, _this$_renderParams8, _this$_renderParams9, _this$_renderParams10, _this$_renderParams11, _this$_renderParams12, _this$AMSSDK$logger, _this$_renderParams13, _this$_renderParams14, _this$_renderParams15, _this$AMSSDK, _this$_renderParams16, res, submitRes;
|
1348
1390
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
1349
1391
|
while (1) switch (_context8.prev = _context8.next) {
|
1350
1392
|
case 0:
|
@@ -1373,20 +1415,32 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1373
1415
|
data: {
|
1374
1416
|
queryResult: res,
|
1375
1417
|
submitResult: submitRes,
|
1376
|
-
sessionResult: (_this$
|
1377
|
-
paymentSessionData: (_this$
|
1418
|
+
sessionResult: (_this$_renderParams7 = this._renderParams) === null || _this$_renderParams7 === void 0 ? void 0 : _this$_renderParams7.paymentSessionMetaData,
|
1419
|
+
paymentSessionData: (_this$_renderParams8 = this._renderParams) === null || _this$_renderParams8 === void 0 ? void 0 : _this$_renderParams8.sessionData,
|
1378
1420
|
heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
|
1379
|
-
renderDisplayType: (_this$
|
1380
|
-
appearance: (_this$
|
1381
|
-
notRedirectAfterComplete: ((_this$
|
1421
|
+
renderDisplayType: (_this$_renderParams9 = this._renderParams) === null || _this$_renderParams9 === void 0 ? void 0 : _this$_renderParams9.renderDisplayType,
|
1422
|
+
appearance: (_this$_renderParams10 = this._renderParams) === null || _this$_renderParams10 === void 0 ? void 0 : _this$_renderParams10.appearance,
|
1423
|
+
notRedirectAfterComplete: ((_this$_renderParams11 = this._renderParams) === null || _this$_renderParams11 === void 0 ? void 0 : _this$_renderParams11.notRedirectAfterComplete) === true,
|
1382
1424
|
merchantAppointParam: this._merchantAppointParam,
|
1383
1425
|
envInfo: {
|
1384
1426
|
screenHeight: screen.height,
|
1385
1427
|
screenWidth: screen.width
|
1386
|
-
}
|
1428
|
+
},
|
1429
|
+
logMetaData: _objectSpread(_objectSpread({
|
1430
|
+
trackId: (_this$_renderParams12 = this._renderParams) === null || _this$_renderParams12 === void 0 ? void 0 : _this$_renderParams12.sessionData,
|
1431
|
+
platform: this.platform,
|
1432
|
+
firstLogTime: (_this$AMSSDK$logger = this.AMSSDK.logger) === null || _this$AMSSDK$logger === void 0 ? void 0 : _this$AMSSDK$logger.getComponentStartTime()
|
1433
|
+
}, ((_this$_renderParams13 = this._renderParams) === null || _this$_renderParams13 === void 0 || (_this$_renderParams13 = _this$_renderParams13.paymentSessionMetaData) === null || _this$_renderParams13 === void 0 ? void 0 : _this$_renderParams13.paymentSessionConfig) || {}), {}, {
|
1434
|
+
renderDisplayType: (_this$_renderParams14 = this._renderParams) === null || _this$_renderParams14 === void 0 ? void 0 : _this$_renderParams14.renderDisplayType,
|
1435
|
+
sdkVersion: this._appVersion,
|
1436
|
+
merchantId: (_this$_renderParams15 = this._renderParams) === null || _this$_renderParams15 === void 0 || (_this$_renderParams15 = _this$_renderParams15.paymentSessionMetaData) === null || _this$_renderParams15 === void 0 ? void 0 : _this$_renderParams15.clientId,
|
1437
|
+
instanceId: (_this$AMSSDK = this.AMSSDK) === null || _this$AMSSDK === void 0 ? void 0 : _this$AMSSDK._instanceId,
|
1438
|
+
performanceData: this._performanceData,
|
1439
|
+
paymentMethodType: (_this$_renderParams16 = this._renderParams) === null || _this$_renderParams16 === void 0 || (_this$_renderParams16 = _this$_renderParams16.paymentSessionMetaData) === null || _this$_renderParams16 === void 0 || (_this$_renderParams16 = _this$_renderParams16.paymentMethodInfoView) === null || _this$_renderParams16 === void 0 ? void 0 : _this$_renderParams16.paymentMethodType
|
1440
|
+
})
|
1387
1441
|
}
|
1388
1442
|
}
|
1389
|
-
});
|
1443
|
+
}, null, true);
|
1390
1444
|
this.AMSSDK.logger.logInfo({
|
1391
1445
|
title: 'sdk_event_renderComponent'
|
1392
1446
|
});
|
package/esm/plugin/const.js
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
import { ApplePayActionEnum, PaymentActionEnum } from "../core/bus/interface";
|
2
|
-
import { paymentMethodCategoryTypeEnum, productSceneEnum, ProductSceneVersion } from "../types/index";
|
1
|
+
import { ApplePayActionEnum, PaymentActionEnum, PaypalActionEnum } from "../core/bus/interface";
|
2
|
+
import { paymentMethodCategoryTypeEnum, PaypalMethodEnum, productSceneEnum, ProductSceneVersion } from "../types/index";
|
3
3
|
export var ExtendPlugin = [{
|
4
4
|
sessionMatcher: {
|
5
5
|
productScene: productSceneEnum.CASHIER_PAYMENT,
|
6
6
|
productSceneVersion: ProductSceneVersion.V1,
|
7
7
|
paymentMethodCategoryType: paymentMethodCategoryTypeEnum.CARD,
|
8
|
-
paymentMethodTypes: [
|
8
|
+
paymentMethodTypes: ['CARD_APPLE_PAY']
|
9
9
|
},
|
10
10
|
paymentChannelMatcher: {
|
11
11
|
paymentMethod: 'ApplePay'
|
@@ -14,6 +14,20 @@ export var ExtendPlugin = [{
|
|
14
14
|
canMakePayments: ApplePayActionEnum.canMakePayments,
|
15
15
|
optional_init: PaymentActionEnum.optional_init,
|
16
16
|
createComponent: ApplePayActionEnum.createComponent,
|
17
|
-
|
17
|
+
destroyComponent: ApplePayActionEnum.destroyComponent
|
18
|
+
}
|
19
|
+
}, {
|
20
|
+
sessionMatcher: {
|
21
|
+
productScene: productSceneEnum.CASHIER_PAYMENT,
|
22
|
+
productSceneVersion: ProductSceneVersion.V1,
|
23
|
+
paymentMethodCategoryType: paymentMethodCategoryTypeEnum.APM,
|
24
|
+
paymentMethodTypes: [PaypalMethodEnum.PAYPAL_CHECKOUT, PaypalMethodEnum.PAYPAL_PAYLATER, PaypalMethodEnum.PAYPAL_VAULT]
|
25
|
+
},
|
26
|
+
paymentChannelMatcher: {
|
27
|
+
paymentMethod: 'Paypal'
|
28
|
+
},
|
29
|
+
busActionNames: {
|
30
|
+
mountComponent: PaypalActionEnum.mountComponent,
|
31
|
+
destroyComponent: PaypalActionEnum.destroyComponent
|
18
32
|
}
|
19
33
|
}];
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import { BusContext, BusMessage, BusSubscriber } from '../../core/bus';
|
2
|
+
import { Logger } from '../../util/logger';
|
3
|
+
export declare class PaypalBusSubscriber extends BusSubscriber {
|
4
|
+
logger: Logger;
|
5
|
+
constructor(logger: Logger);
|
6
|
+
actionNames(): string[];
|
7
|
+
private onEventCallback;
|
8
|
+
protected renderPaypalButton(context: BusContext, message: BusMessage): Promise<never>;
|
9
|
+
private appendPaypalLoading;
|
10
|
+
private removePaypalLoading;
|
11
|
+
private preCheck;
|
12
|
+
private loadPaypalResource;
|
13
|
+
private createPaypalScript;
|
14
|
+
private onShippingChange;
|
15
|
+
private createOrder;
|
16
|
+
private onApprove;
|
17
|
+
private onCancel;
|
18
|
+
private destroyComponent;
|
19
|
+
onMessage(context: BusContext, message: BusMessage): void;
|
20
|
+
}
|