@alipay/ams-checkout 0.0.1710840616-dev.0 → 0.0.1711691167-dev.2
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/ability/callback.d.ts +9 -0
- package/esm/core/bus/ability/callback.js +55 -0
- package/esm/core/bus/ability/security.d.ts +10 -0
- package/esm/core/bus/ability/security.js +104 -0
- package/esm/core/bus/ability/tracker.d.ts +9 -0
- package/esm/core/bus/ability/tracker.js +77 -0
- package/esm/core/bus/index.d.ts +125 -0
- package/esm/core/bus/index.js +366 -0
- package/esm/core/bus/interface.d.ts +36 -0
- package/esm/core/bus/interface.js +40 -0
- package/esm/core/component/index.d.ts +15 -1
- package/esm/core/component/index.js +189 -26
- package/esm/core/instance/index.d.ts +12 -1
- package/esm/core/instance/index.js +55 -12
- package/esm/index.d.ts +0 -3
- package/esm/index.js +8 -18
- package/esm/{core/applepay/index.d.ts → plugin/applepay/component.d.ts} +27 -8
- package/esm/{core/applepay/index.js → plugin/applepay/component.js} +150 -180
- package/esm/plugin/applepay/index.d.ts +17 -0
- package/esm/plugin/applepay/index.js +117 -0
- package/esm/{common → plugin}/applepay/interface.d.ts +62 -3
- package/esm/plugin/applepay/interface.js +69 -0
- package/esm/{common/applepay/index.d.ts → plugin/applepay/service.d.ts} +13 -7
- package/esm/{common/applepay/index.js → plugin/applepay/service.js} +159 -41
- package/esm/plugin/component/index.d.ts +4 -3
- package/esm/plugin/component/index.js +98 -108
- package/esm/plugin/const.d.ts +2 -0
- package/esm/plugin/const.js +33 -0
- package/esm/plugin/paypal/index.d.ts +20 -0
- package/esm/plugin/paypal/index.js +377 -0
- package/esm/plugin/type.d.ts +33 -0
- package/esm/plugin/utils.d.ts +6 -0
- package/esm/plugin/utils.js +21 -0
- package/esm/request/index.d.ts +1 -1
- package/esm/request/index.js +14 -8
- package/esm/service/index.d.ts +1 -1
- package/esm/types/index.d.ts +108 -11
- package/esm/types/index.js +26 -1
- 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 +1 -3
- package/esm/util/versionCompare.js +0 -75
- package/package.json +1 -1
- /package/esm/{common/applepay/interface.js → plugin/type.js} +0 -0
@@ -22,7 +22,6 @@ 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";
|
26
25
|
import { createIframe, createPreloadIframe, getAppDomain, getIframeUrl } from "./cashierApp";
|
27
26
|
import { addInlineLoading, createInlineBaseElement } from "./component.inline.style";
|
28
27
|
import { addPopupLoading, createBaseElement, createMockup, createRetentionPopup, handleDeclareInfo as _handleDeclareInfo, hideRetentionPopup, removeRetentionPopup as _removeRetentionPopup } from "./component.popup.style";
|
@@ -53,8 +52,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
53
52
|
_defineProperty(this, "_renderDisplayType", renderDisplayTypeEnum.popup);
|
54
53
|
_defineProperty(this, "_multipleCallbackEvents", void 0);
|
55
54
|
_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.13.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,
|
367
|
+
var envInfo, params, _ref3, extendInfo, enableVaultingApiOptimize, enableEasypayApiOptimize, extendInfoData, _this5$_renderParams6, _this5$_renderParams7, _ref4, _ref4$productSceneVer, productSceneVersion, _ref4$productScene, productScene, _ref5, _ref5$action, _ref5$action2, _ref5$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,10 +380,9 @@ 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) || {},
|
383
|
+
_ref3 = ((_this5$_renderParams4 = _this5._renderParams) === null || _this5$_renderParams4 === void 0 ? void 0 : _this5$_renderParams4.paymentSessionMetaData) || {}, extendInfo = _ref3.extendInfo;
|
384
384
|
enableVaultingApiOptimize = false;
|
385
385
|
enableEasypayApiOptimize = false;
|
386
|
-
_this5$_renderParams$ = (_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 = _this5$_renderParams$.skipSdkQuery, skipSdkQueryForm = _this5$_renderParams$.skipSdkQueryForm;
|
387
386
|
try {
|
388
387
|
extendInfoData = JSON.parse(extendInfo);
|
389
388
|
enableVaultingApiOptimize = extendInfoData.enableVaultingApiOptimize || false;
|
@@ -392,127 +391,100 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
392
391
|
console.log(error);
|
393
392
|
}
|
394
393
|
if (!isLocalMock()) {
|
395
|
-
_context2.next =
|
394
|
+
_context2.next = 8;
|
396
395
|
break;
|
397
396
|
}
|
398
397
|
return _context2.abrupt("return", resolve({
|
399
398
|
message: 'sdk no need to make query request',
|
400
399
|
success: true
|
401
400
|
}));
|
402
|
-
case
|
403
|
-
if (!(componentSignEnum.VAULTING_CARD === _this5._componentSign)) {
|
404
|
-
_context2.next =
|
405
|
-
break;
|
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({
|
422
|
-
message: 'sdk no need to make query request',
|
423
|
-
success: true
|
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;
|
401
|
+
case 8:
|
402
|
+
if (!(componentSignEnum.VAULTING_CARD === _this5._componentSign && (_this5$_renderParams5 = _this5._renderParams) !== null && _this5$_renderParams5 !== void 0 && (_this5$_renderParams5 = _this5$_renderParams5.paymentSessionMetaData) !== null && _this5$_renderParams5 !== void 0 && (_this5$_renderParams5 = _this5$_renderParams5.action) !== null && _this5$_renderParams5 !== void 0 && _this5$_renderParams5.skipSdkQuery && enableVaultingApiOptimize)) {
|
403
|
+
_context2.next = 10;
|
432
404
|
break;
|
433
405
|
}
|
434
|
-
resolve({
|
406
|
+
return _context2.abrupt("return", resolve({
|
435
407
|
message: 'sdk no need to make query request',
|
436
408
|
success: true
|
437
|
-
});
|
438
|
-
|
439
|
-
case 21:
|
409
|
+
}));
|
410
|
+
case 10:
|
440
411
|
if (!(componentSignEnum.CASHIER_PAYMENT_CARD === _this5._componentSign || componentSignEnum.VAULTING_CARD === _this5._componentSign)) {
|
441
|
-
_context2.next =
|
412
|
+
_context2.next = 16;
|
442
413
|
break;
|
443
414
|
}
|
444
415
|
params.paymentMethodType = 'CARD';
|
445
|
-
_context2.next =
|
416
|
+
_context2.next = 14;
|
446
417
|
return _this5.getDeviceIdAndLog();
|
447
|
-
case
|
418
|
+
case 14:
|
448
419
|
envInfo.deviceId = _context2.sent;
|
449
420
|
if (window.navigator.userAgent.indexOf('miniProgram') > -1) {
|
450
421
|
envInfo.extendInfo = {
|
451
422
|
WAP_SUB_TYPE: 'WECHAT_MINI_PROGRAM'
|
452
423
|
};
|
453
424
|
}
|
454
|
-
case
|
425
|
+
case 16:
|
455
426
|
if (!(componentSignEnum.EASY_PAY_WALLET === _this5._componentSign)) {
|
456
|
-
_context2.next =
|
427
|
+
_context2.next = 26;
|
457
428
|
break;
|
458
429
|
}
|
459
430
|
_ref4 = params.paymentSessionConfig || {}, _ref4$productSceneVer = _ref4.productSceneVersion, productSceneVersion = _ref4$productSceneVer === void 0 ? '' : _ref4$productSceneVer, _ref4$productScene = _ref4.productScene, productScene = _ref4$productScene === void 0 ? '' : _ref4$productScene;
|
460
431
|
_ref5 = ((_this5$_renderParams6 = _this5._renderParams) === null || _this5$_renderParams6 === void 0 ? void 0 : _this5$_renderParams6.paymentSessionMetaData) || {}, _ref5$action = _ref5.action, _ref5$action2 = _ref5$action === void 0 ? {} : _ref5$action, _ref5$action2$autoDeb = _ref5$action2.autoDebitWithToken, autoDebitWithToken = _ref5$action2$autoDeb === void 0 ? false : _ref5$action2$autoDeb;
|
461
432
|
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)) {
|
462
|
-
_context2.next =
|
433
|
+
_context2.next = 21;
|
463
434
|
break;
|
464
435
|
}
|
465
436
|
return _context2.abrupt("return", resolve({
|
466
437
|
message: 'sdk no need to make query request',
|
467
438
|
success: true
|
468
439
|
}));
|
469
|
-
case
|
440
|
+
case 21:
|
470
441
|
if (!(productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0' && !autoDebitWithToken)) {
|
471
|
-
_context2.next =
|
442
|
+
_context2.next = 23;
|
472
443
|
break;
|
473
444
|
}
|
474
445
|
return _context2.abrupt("return", resolve({
|
475
446
|
message: 'sdk no need to make query request',
|
476
447
|
success: true
|
477
448
|
}));
|
478
|
-
case
|
479
|
-
_context2.next =
|
449
|
+
case 23:
|
450
|
+
_context2.next = 25;
|
480
451
|
return _this5.getDeviceIdAndLog();
|
481
|
-
case
|
452
|
+
case 25:
|
482
453
|
envInfo.deviceId = _context2.sent;
|
483
|
-
case
|
454
|
+
case 26:
|
484
455
|
if (!(componentSignEnum.AUTO_DEBIT_WALLET === _this5._componentSign)) {
|
485
|
-
_context2.next =
|
456
|
+
_context2.next = 36;
|
486
457
|
break;
|
487
458
|
}
|
488
459
|
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) || {};
|
489
460
|
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;
|
490
461
|
if (!(signType === 'SMS')) {
|
491
|
-
_context2.next =
|
462
|
+
_context2.next = 31;
|
492
463
|
break;
|
493
464
|
}
|
494
465
|
return _context2.abrupt("return", resolve({
|
495
466
|
message: 'sdk no need to make query request',
|
496
467
|
success: true
|
497
468
|
}));
|
498
|
-
case
|
469
|
+
case 31:
|
499
470
|
if (!(!signType || signType !== 'REDIRECT')) {
|
500
|
-
_context2.next =
|
471
|
+
_context2.next = 33;
|
501
472
|
break;
|
502
473
|
}
|
503
474
|
return _context2.abrupt("return", resolve({
|
504
475
|
success: false
|
505
476
|
}));
|
506
|
-
case
|
507
|
-
_context2.next =
|
477
|
+
case 33:
|
478
|
+
_context2.next = 35;
|
508
479
|
return _this5.getDeviceIdAndLog();
|
509
|
-
case
|
480
|
+
case 35:
|
510
481
|
envInfo.deviceId = _context2.sent;
|
511
|
-
case
|
482
|
+
case 36:
|
512
483
|
_this5.AMSSDK.logger.logInfo({
|
513
484
|
title: 'sdk_event_sdkQuery'
|
514
485
|
}, {
|
515
|
-
paymentSessionConfig: JSON.stringify(params.paymentSessionConfig)
|
486
|
+
paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
|
487
|
+
requestBody: params
|
516
488
|
}).send();
|
517
489
|
queryPaymentInfo(params, {
|
518
490
|
env: _this5.AMSSDK.options.env.environment,
|
@@ -523,6 +495,12 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
523
495
|
value: Date.now()
|
524
496
|
});
|
525
497
|
resolve(res);
|
498
|
+
_this5.AMSSDK.logger.logInfo({
|
499
|
+
title: 'sdk_event_sdkQueryEnd'
|
500
|
+
}, {
|
501
|
+
paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
|
502
|
+
responseBody: res
|
503
|
+
}).send();
|
526
504
|
}).catch(function (err) {
|
527
505
|
if ([componentSignEnum.CASHIER_PAYMENT_CARD, componentSignEnum.VAULTING_CARD, componentSignEnum.CASHIER_PAYMENT_APM].includes(_this5._componentSign)) {
|
528
506
|
return resolve({
|
@@ -532,15 +510,15 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
532
510
|
_this5.dispatchToSDK(EVENT.error.name, {
|
533
511
|
code: ERRORMESSAGE.CREATECOMPONENT_ERROR.code
|
534
512
|
});
|
535
|
-
|
536
|
-
|
537
|
-
_this5.AMSSDK.logger.logInfo({
|
538
|
-
title: 'sdk_event_sdkQueryEnd'
|
513
|
+
_this5.AMSSDK.logger.logError({
|
514
|
+
title: 'sdk_event_sdkQuery_failed'
|
539
515
|
}, {
|
540
|
-
paymentSessionConfig: JSON.stringify(params.paymentSessionConfig)
|
516
|
+
paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
|
517
|
+
errorReason: err
|
541
518
|
}).send();
|
519
|
+
reject(err);
|
542
520
|
});
|
543
|
-
case
|
521
|
+
case 38:
|
544
522
|
case "end":
|
545
523
|
return _context2.stop();
|
546
524
|
}
|
@@ -557,16 +535,16 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
557
535
|
}, {
|
558
536
|
key: "createSubmitPromise",
|
559
537
|
value: function createSubmitPromise() {
|
560
|
-
var _this$
|
561
|
-
_this$
|
538
|
+
var _this$_renderParams5,
|
539
|
+
_this$_renderParams6,
|
562
540
|
_this6 = this;
|
563
541
|
this._performanceData.push({
|
564
542
|
key: 'sdk_submit_start',
|
565
543
|
value: Date.now()
|
566
544
|
});
|
567
545
|
var params = {
|
568
|
-
paymentSessionData: this._renderParams && ((_this$
|
569
|
-
paymentSessionConfig: (_this$
|
546
|
+
paymentSessionData: this._renderParams && ((_this$_renderParams5 = this._renderParams) === null || _this$_renderParams5 === void 0 ? void 0 : _this$_renderParams5.sessionData) || '',
|
547
|
+
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
|
570
548
|
};
|
571
549
|
|
572
550
|
// eslint-disable-next-line no-async-promise-executor
|
@@ -588,7 +566,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
588
566
|
_this6.AMSSDK.logger.logInfo({
|
589
567
|
title: 'sdk_event_submitPay'
|
590
568
|
}, {
|
591
|
-
paymentSessionConfig: JSON.stringify(params.paymentSessionConfig)
|
569
|
+
paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
|
570
|
+
requestBody: params
|
592
571
|
}).send();
|
593
572
|
_context3.t0 = submitPayInfo;
|
594
573
|
_context3.t1 = params;
|
@@ -611,21 +590,23 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
611
590
|
key: 'sdk_submit_end',
|
612
591
|
value: Date.now()
|
613
592
|
});
|
614
|
-
if (res !== null && res !== void 0 && res.success) {
|
615
|
-
resolve(res);
|
616
|
-
} else {
|
617
|
-
resolve(res);
|
618
|
-
}
|
619
|
-
}).catch(function () {
|
620
|
-
resolve({
|
621
|
-
success: false
|
622
|
-
});
|
623
|
-
}).finally(function () {
|
624
593
|
_this6.AMSSDK.logger.logInfo({
|
625
594
|
title: 'sdk_event_submitPayEnd'
|
626
595
|
}, {
|
627
|
-
paymentSessionConfig: JSON.stringify(params.paymentSessionConfig)
|
596
|
+
paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
|
597
|
+
responseBody: res
|
628
598
|
}).send();
|
599
|
+
resolve(res);
|
600
|
+
}).catch(function (err) {
|
601
|
+
_this6.AMSSDK.logger.logError({
|
602
|
+
title: 'sdk_event_submitPay_failed'
|
603
|
+
}, {
|
604
|
+
paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
|
605
|
+
responseBody: err
|
606
|
+
}).send();
|
607
|
+
resolve({
|
608
|
+
success: false
|
609
|
+
});
|
629
610
|
});
|
630
611
|
case 13:
|
631
612
|
case "end":
|
@@ -1264,12 +1245,12 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1264
1245
|
}
|
1265
1246
|
};
|
1266
1247
|
}
|
1267
|
-
if (
|
1268
|
-
clearTimeout(
|
1269
|
-
|
1248
|
+
if (this._webAppHeartBeatTimeoutId) {
|
1249
|
+
clearTimeout(this._webAppHeartBeatTimeoutId);
|
1250
|
+
this._webAppHeartBeatTimeoutId = null;
|
1270
1251
|
}
|
1271
1252
|
if (this._webAppHeartBeatTimeoutFn) {
|
1272
|
-
|
1253
|
+
this._webAppHeartBeatTimeoutId = setTimeout(this._webAppHeartBeatTimeoutFn, TIMEOUT_WEB_APP_HEART_BEAT);
|
1273
1254
|
}
|
1274
1255
|
setTimeout(function () {
|
1275
1256
|
if (_this8.isAppAttached()) {
|
@@ -1278,7 +1259,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1278
1259
|
event: 'sdkHeartBeat',
|
1279
1260
|
data: {}
|
1280
1261
|
}
|
1281
|
-
}
|
1262
|
+
});
|
1282
1263
|
}
|
1283
1264
|
}, TIME_DELAY_SEND_HEART_BEAT);
|
1284
1265
|
} catch (error) {
|
@@ -1328,20 +1309,17 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1328
1309
|
key: "dispatchToApp",
|
1329
1310
|
value: function dispatchToApp(payload) {
|
1330
1311
|
var targetElement = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
1331
|
-
var sendLog = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
1332
1312
|
var data = Object.assign({}, payload, {
|
1333
1313
|
name: messageName.SDK_TO_APP,
|
1334
1314
|
mode: this.AMSSDK.options.mode,
|
1335
1315
|
appId: COMPONENTPLUGINID,
|
1336
1316
|
instanceId: this.AMSSDK._instanceId
|
1337
1317
|
});
|
1338
|
-
|
1339
|
-
|
1340
|
-
|
1341
|
-
|
1342
|
-
|
1343
|
-
}).send();
|
1344
|
-
}
|
1318
|
+
this.AMSSDK.logger.logInfo({
|
1319
|
+
title: 'sdk_event_send_message_to_web'
|
1320
|
+
}, {
|
1321
|
+
event: data === null || data === void 0 ? void 0 : data.context.event
|
1322
|
+
}).send();
|
1345
1323
|
if (targetElement && targetElement.contentWindow) {
|
1346
1324
|
return targetElement.contentWindow.postMessage(JSON.stringify(data), '*');
|
1347
1325
|
}
|
@@ -1376,7 +1354,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1376
1354
|
key: "sendRenderEvent",
|
1377
1355
|
value: (function () {
|
1378
1356
|
var _sendRenderEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
1379
|
-
var _this$
|
1357
|
+
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;
|
1380
1358
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
1381
1359
|
while (1) switch (_context8.prev = _context8.next) {
|
1382
1360
|
case 0:
|
@@ -1405,17 +1383,29 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1405
1383
|
data: {
|
1406
1384
|
queryResult: res,
|
1407
1385
|
submitResult: submitRes,
|
1408
|
-
sessionResult: (_this$
|
1409
|
-
paymentSessionData: (_this$
|
1386
|
+
sessionResult: (_this$_renderParams7 = this._renderParams) === null || _this$_renderParams7 === void 0 ? void 0 : _this$_renderParams7.paymentSessionMetaData,
|
1387
|
+
paymentSessionData: (_this$_renderParams8 = this._renderParams) === null || _this$_renderParams8 === void 0 ? void 0 : _this$_renderParams8.sessionData,
|
1410
1388
|
heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
|
1411
|
-
renderDisplayType: (_this$
|
1412
|
-
appearance: (_this$
|
1413
|
-
notRedirectAfterComplete: ((_this$
|
1389
|
+
renderDisplayType: (_this$_renderParams9 = this._renderParams) === null || _this$_renderParams9 === void 0 ? void 0 : _this$_renderParams9.renderDisplayType,
|
1390
|
+
appearance: (_this$_renderParams10 = this._renderParams) === null || _this$_renderParams10 === void 0 ? void 0 : _this$_renderParams10.appearance,
|
1391
|
+
notRedirectAfterComplete: ((_this$_renderParams11 = this._renderParams) === null || _this$_renderParams11 === void 0 ? void 0 : _this$_renderParams11.notRedirectAfterComplete) === true,
|
1414
1392
|
merchantAppointParam: this._merchantAppointParam,
|
1415
1393
|
envInfo: {
|
1416
1394
|
screenHeight: screen.height,
|
1417
1395
|
screenWidth: screen.width
|
1418
|
-
}
|
1396
|
+
},
|
1397
|
+
logMetaData: _objectSpread(_objectSpread({
|
1398
|
+
trackId: (_this$_renderParams12 = this._renderParams) === null || _this$_renderParams12 === void 0 ? void 0 : _this$_renderParams12.sessionData,
|
1399
|
+
platform: this.platform,
|
1400
|
+
firstLogTime: (_this$AMSSDK$logger = this.AMSSDK.logger) === null || _this$AMSSDK$logger === void 0 ? void 0 : _this$AMSSDK$logger.getComponentStartTime()
|
1401
|
+
}, ((_this$_renderParams13 = this._renderParams) === null || _this$_renderParams13 === void 0 || (_this$_renderParams13 = _this$_renderParams13.paymentSessionMetaData) === null || _this$_renderParams13 === void 0 ? void 0 : _this$_renderParams13.paymentSessionConfig) || {}), {}, {
|
1402
|
+
renderDisplayType: (_this$_renderParams14 = this._renderParams) === null || _this$_renderParams14 === void 0 ? void 0 : _this$_renderParams14.renderDisplayType,
|
1403
|
+
sdkVersion: this._appVersion,
|
1404
|
+
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,
|
1405
|
+
instanceId: (_this$AMSSDK = this.AMSSDK) === null || _this$AMSSDK === void 0 ? void 0 : _this$AMSSDK._instanceId,
|
1406
|
+
performanceData: this._performanceData,
|
1407
|
+
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
|
1408
|
+
})
|
1419
1409
|
}
|
1420
1410
|
}
|
1421
1411
|
});
|
@@ -0,0 +1,33 @@
|
|
1
|
+
import { ApplePayActionEnum, PaymentActionEnum, PaypalActionEnum } from "../core/bus/interface";
|
2
|
+
import { paymentMethodCategoryTypeEnum, PaypalMethodEnum, productSceneEnum, ProductSceneVersion } from "../types/index";
|
3
|
+
export var ExtendPlugin = [{
|
4
|
+
sessionMatcher: {
|
5
|
+
productScene: productSceneEnum.CASHIER_PAYMENT,
|
6
|
+
productSceneVersion: ProductSceneVersion.V1,
|
7
|
+
paymentMethodCategoryType: paymentMethodCategoryTypeEnum.CARD,
|
8
|
+
paymentMethodTypes: ['CARD_APPLE_PAY']
|
9
|
+
},
|
10
|
+
paymentChannelMatcher: {
|
11
|
+
paymentMethod: 'ApplePay'
|
12
|
+
},
|
13
|
+
busActionNames: {
|
14
|
+
canMakePayments: ApplePayActionEnum.canMakePayments,
|
15
|
+
optional_init: PaymentActionEnum.optional_init,
|
16
|
+
createComponent: ApplePayActionEnum.createComponent,
|
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
|
32
|
+
}
|
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
|
+
}
|