@alipay/ams-checkout 0.0.1716363774-dev.0 → 0.0.1716363774-dev.1
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/core/component/index.js +5 -1
- package/esm/plugin/component/cashierApp.js +1 -1
- package/esm/plugin/component/channel.d.ts +20 -0
- package/esm/plugin/component/channel.js +38 -0
- package/esm/plugin/component/component.popup.style.d.ts +4 -1
- package/esm/plugin/component/component.popup.style.js +7 -1
- package/esm/plugin/component/index.js +93 -52
- package/esm/request/index.js +2 -2
- package/esm/types/index.d.ts +3 -0
- package/esm/types/index.js +1 -0
- package/package.json +1 -1
@@ -65,7 +65,11 @@ var resetEasyPaySceneVersion = function resetEasyPaySceneVersion(parseData) {
|
|
65
65
|
if (isPC() && parseData !== null && parseData !== void 0 && parseData.paymentSessionConfig) {
|
66
66
|
var productScene = parseData.paymentSessionConfig.productScene;
|
67
67
|
if (productScene === productSceneEnum.EASY_PAY) {
|
68
|
-
|
68
|
+
var _parseData$paymentMet;
|
69
|
+
// 非TOSS渠道,在PC场景需要改成1.0
|
70
|
+
if ('BANKTRANSFER_QUICKPAY' !== (parseData === null || parseData === void 0 || (_parseData$paymentMet = parseData.paymentMethodInfoView) === null || _parseData$paymentMet === void 0 ? void 0 : _parseData$paymentMet.paymentMethodType)) {
|
71
|
+
parseData.paymentSessionConfig.productSceneVersion = '1.0';
|
72
|
+
}
|
69
73
|
}
|
70
74
|
}
|
71
75
|
};
|
@@ -52,7 +52,7 @@ var getAppVersion = function getAppVersion(_extendInfo, productScene, mid) {
|
|
52
52
|
}
|
53
53
|
};
|
54
54
|
var getFinalProductSceneVersion = function getFinalProductSceneVersion(componentSign, productSceneVersion) {
|
55
|
-
var signSupportMap = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, componentSignEnum.NONE, ['']), componentSignEnum.AUTO_DEBIT_WALLET, ['1.0']), componentSignEnum.CASHIER_PAYMENT_BANK, ['1.0']), componentSignEnum.CASHIER_PAYMENT_CARD, ['1.0']), componentSignEnum.CASHIER_PAYMENT_APM, ['1.0']), componentSignEnum.EASY_PAY_WALLET, ['1.0', '2.0']), componentSignEnum.VAULTING_CARD, ['1.0']);
|
55
|
+
var signSupportMap = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, componentSignEnum.NONE, ['']), componentSignEnum.AUTO_DEBIT_WALLET, ['1.0']), componentSignEnum.CASHIER_PAYMENT_BANK, ['1.0']), componentSignEnum.CASHIER_PAYMENT_CARD, ['1.0']), componentSignEnum.CASHIER_PAYMENT_APM, ['1.0']), componentSignEnum.EASY_PAY_WALLET, ['1.0', '2.0']), componentSignEnum.EASY_PAY_APM, ['2.0']), componentSignEnum.VAULTING_CARD, ['1.0']);
|
56
56
|
var supportProductSceneVersion = signSupportMap[componentSign];
|
57
57
|
// 从左到右,从旧到新
|
58
58
|
var isSupport = supportProductSceneVersion.find(function (it) {
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import type { IpaymentSessionMetaData } from "src/types";
|
2
|
+
type IChannelBehavior = {
|
3
|
+
usePaymentSessionAsQueryResult: boolean;
|
4
|
+
submitPayInSdk: boolean;
|
5
|
+
createIframeNode: boolean;
|
6
|
+
loadApp: boolean;
|
7
|
+
buildSubmitPayExtParams?: (params: GetDoubleFaParams) => any;
|
8
|
+
allowClickOutsideClose?: boolean;
|
9
|
+
};
|
10
|
+
type GetDoubleFaParams = {
|
11
|
+
instanceId: string;
|
12
|
+
paymentSessionData: string;
|
13
|
+
locale: string;
|
14
|
+
paymentMethodType: string;
|
15
|
+
env: string;
|
16
|
+
sdkVersion: string;
|
17
|
+
};
|
18
|
+
export declare function getChannelBehavior(paymentSessionMetaData?: IpaymentSessionMetaData): IChannelBehavior | undefined;
|
19
|
+
export declare function getDoubleFaUrl(params: GetDoubleFaParams): string;
|
20
|
+
export {};
|
@@ -0,0 +1,38 @@
|
|
1
|
+
export function getChannelBehavior(paymentSessionMetaData) {
|
2
|
+
var _paymentSessionMetaDa, _paymentSessionMetaDa2, _paymentSessionMetaDa3, _paymentSessionMetaDa4;
|
3
|
+
if ('BANKTRANSFER_QUICKPAY' === (paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa = paymentSessionMetaData.paymentMethodInfoView) === null || _paymentSessionMetaDa === void 0 ? void 0 : _paymentSessionMetaDa.paymentMethodType) && (paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa2 = paymentSessionMetaData.paymentSessionConfig) === null || _paymentSessionMetaDa2 === void 0 ? void 0 : _paymentSessionMetaDa2.productScene) === 'EASY_PAY' && (paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa3 = paymentSessionMetaData.paymentSessionConfig) === null || _paymentSessionMetaDa3 === void 0 ? void 0 : _paymentSessionMetaDa3.paymentMethodCategoryType) === 'APM' && (paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa4 = paymentSessionMetaData.paymentSessionConfig) === null || _paymentSessionMetaDa4 === void 0 ? void 0 : _paymentSessionMetaDa4.productSceneVersion) === '2.0') {
|
4
|
+
return {
|
5
|
+
usePaymentSessionAsQueryResult: true,
|
6
|
+
submitPayInSdk: true,
|
7
|
+
createIframeNode: true,
|
8
|
+
loadApp: true,
|
9
|
+
allowClickOutsideClose: true,
|
10
|
+
buildSubmitPayExtParams: function buildSubmitPayExtParams(params) {
|
11
|
+
var callBackUrl = getDoubleFaUrl(params);
|
12
|
+
return {
|
13
|
+
callBackUrl: callBackUrl
|
14
|
+
};
|
15
|
+
}
|
16
|
+
};
|
17
|
+
}
|
18
|
+
return undefined;
|
19
|
+
}
|
20
|
+
export function getDoubleFaUrl(params) {
|
21
|
+
var instanceId = params.instanceId,
|
22
|
+
paymentMethodType = params.paymentMethodType,
|
23
|
+
paymentSessionData = params.paymentSessionData,
|
24
|
+
locale = params.locale,
|
25
|
+
env = params.env,
|
26
|
+
sdkVersion = params.sdkVersion;
|
27
|
+
var isLandscapeOrientation = false; // Web 不含横屏
|
28
|
+
|
29
|
+
var DOUBLE_FA_URL_MAPPING = {
|
30
|
+
local: "http://page.alipay.net/page/antom-web-checkout/src/component-app/doubleFA/index.".concat(sdkVersion, ".html"),
|
31
|
+
dev: "http://page.alipay.net/page/antom-web-checkout/src/component-app/doubleFA/index.".concat(sdkVersion, ".html"),
|
32
|
+
sit: "http://page.test.alipay.net/page/antom-web-checkout/src/component-app/doubleFA/index.".concat(sdkVersion, ".html"),
|
33
|
+
pre: "https://pre.ac.alipay.com/page/antom-web-checkout/src/component-app/doubleFA/index.".concat(sdkVersion, ".html"),
|
34
|
+
prod: "https://ac.alipay.com/page/antom-web-checkout/src/component-app/doubleFA/index.".concat(sdkVersion, ".html")
|
35
|
+
};
|
36
|
+
var doubleFaBaseUrl = DOUBLE_FA_URL_MAPPING[env] || DOUBLE_FA_URL_MAPPING.prod;
|
37
|
+
return "".concat(doubleFaBaseUrl, "?scene=cashierResultPage&instanceId=").concat(instanceId, "&paymentSessionData=").concat(encodeURIComponent(paymentSessionData), "&isLandscape=").concat(isLandscapeOrientation ? 'true' : '', "&pmt=").concat(paymentMethodType, "&locale=").concat(locale, "&sdkVersion=").concat(sdkVersion);
|
38
|
+
}
|
@@ -5,7 +5,10 @@ export declare const createCloseBtn: (platform: platformEnum, closeBtnFunc: () =
|
|
5
5
|
export declare const createRetentionPopup: (platform: platformEnum, remainBtnFunc: () => void, leaveBtnFunc: () => void) => void;
|
6
6
|
export declare const hideRetentionPopup: () => void;
|
7
7
|
export declare const removeRetentionPopup: (platform: platformEnum, remainBtnFunc: () => void, leaveBtnFunc: () => void) => void;
|
8
|
-
export declare const createMockup: (
|
8
|
+
export declare const createMockup: (options: {
|
9
|
+
platform: platformEnum;
|
10
|
+
onClickOutside: () => void;
|
11
|
+
}) => void;
|
9
12
|
export declare const addPopupLoading: () => void;
|
10
13
|
export declare const handleDeclareInfo: ({ closeDialogData }: {
|
11
14
|
closeDialogData: any;
|
@@ -89,7 +89,8 @@ export var removeRetentionPopup = function removeRetentionPopup(platform, remain
|
|
89
89
|
}
|
90
90
|
(_document$getElementB = document.getElementById(COMPONENT_RETENTION_ID)) === null || _document$getElementB === void 0 || _document$getElementB.remove();
|
91
91
|
};
|
92
|
-
export var createMockup = function createMockup() {
|
92
|
+
export var createMockup = function createMockup(options) {
|
93
|
+
var clickEventName = (options === null || options === void 0 ? void 0 : options.platform) === platformEnum.mobile ? 'touchend' : 'click';
|
93
94
|
var body = document.getElementsByTagName('body')[0];
|
94
95
|
body.style.overflow = 'hidden';
|
95
96
|
var mockup = document.createElement('div');
|
@@ -102,6 +103,11 @@ export var createMockup = function createMockup() {
|
|
102
103
|
mockup.style.background = 'rgba(0,0,0,0.5)';
|
103
104
|
mockup.style.display = 'none';
|
104
105
|
mockup.id = MOCKUP_ID;
|
106
|
+
// let click to close
|
107
|
+
mockup.addEventListener(clickEventName, function () {
|
108
|
+
var _options$onClickOutsi;
|
109
|
+
options === null || options === void 0 || (_options$onClickOutsi = options.onClickOutside) === null || _options$onClickOutsi === void 0 || _options$onClickOutsi.call(options);
|
110
|
+
});
|
105
111
|
body.appendChild(mockup);
|
106
112
|
};
|
107
113
|
export var addPopupLoading = function addPopupLoading() {
|
@@ -25,6 +25,7 @@ import { getType, isJsonString, isPC } from "../../util";
|
|
25
25
|
import { isLocalMock } from "../../util/mock";
|
26
26
|
import { matchVersion } from "../../util/versionCompare";
|
27
27
|
import { createIframe, createPreloadIframe, getAppDomain, getIframeUrl } from "./cashierApp";
|
28
|
+
import { getChannelBehavior } from "./channel";
|
28
29
|
import { addInlineLoading, createInlineBaseElement } from "./component.inline.style";
|
29
30
|
import { addPopupLoading, createBaseElement, createMockup, createRetentionPopup, handleDeclareInfo as _handleDeclareInfo, hideRetentionPopup, removeRetentionPopup as _removeRetentionPopup } from "./component.popup.style";
|
30
31
|
import { createModal, destroyModal, insertStyleSheet } from "./popupWindow.style";
|
@@ -274,9 +275,18 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
274
275
|
insertStyleSheet();
|
275
276
|
}
|
276
277
|
if (this._renderDisplayType === renderDisplayTypeEnum.popup) {
|
278
|
+
var _this$_renderParams5;
|
277
279
|
createBaseElement(this.platform, this.closeBtnFunc.bind(this));
|
278
280
|
createRetentionPopup(this.platform, this.hideRetentionPopupFunc.bind(this), this.retentionPopupLeaveFunc.bind(this));
|
279
|
-
|
281
|
+
var channelBehavior = getChannelBehavior((_this$_renderParams5 = this._renderParams) === null || _this$_renderParams5 === void 0 ? void 0 : _this$_renderParams5.paymentSessionMetaData);
|
282
|
+
var onClickOutside = function onClickOutside() {};
|
283
|
+
if (channelBehavior !== null && channelBehavior !== void 0 && channelBehavior.allowClickOutsideClose) {
|
284
|
+
onClickOutside = this.closeBtnFunc.bind(this);
|
285
|
+
}
|
286
|
+
createMockup({
|
287
|
+
platform: this.platform,
|
288
|
+
onClickOutside: onClickOutside
|
289
|
+
});
|
280
290
|
this.renderPopupLoading(renderParams);
|
281
291
|
}
|
282
292
|
this.createApp(renderParams);
|
@@ -356,7 +366,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
356
366
|
}, {
|
357
367
|
key: "createActionQueryPromise",
|
358
368
|
value: function createActionQueryPromise() {
|
359
|
-
var
|
369
|
+
var _this$_renderParams6,
|
370
|
+
_this5 = this;
|
371
|
+
var paymentMethodType = (_this$_renderParams6 = this._renderParams) === null || _this$_renderParams6 === void 0 || (_this$_renderParams6 = _this$_renderParams6.paymentSessionMetaData) === null || _this$_renderParams6 === void 0 || (_this$_renderParams6 = _this$_renderParams6.paymentMethodInfoView) === null || _this$_renderParams6 === void 0 ? void 0 : _this$_renderParams6.paymentMethodType;
|
360
372
|
this._performanceData.push({
|
361
373
|
key: 'sdk_action_query_start',
|
362
374
|
value: Date.now()
|
@@ -365,8 +377,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
365
377
|
// eslint-disable-next-line no-async-promise-executor
|
366
378
|
this._actionQueryPromise = new Promise( /*#__PURE__*/function () {
|
367
379
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(resolve, reject) {
|
368
|
-
var _this5$_renderParams, _this5$_renderParams2, _this5$_renderParams3, _this5$_renderParams4, _this5$_renderParams5;
|
369
|
-
var envInfo, params, _ref3, _ref3$extendInfo, extendInfo, enableVaultingApiOptimize, enableEasypayApiOptimize, _ref4, skipSdkQuery, skipSdkQueryForm, extendInfoData, ifSkip, _this5$
|
380
|
+
var _this5$_renderParams, _this5$_renderParams2, _this5$_renderParams3, _this5$_renderParams4, _this5$_renderParams5, _this5$_renderParams6;
|
381
|
+
var envInfo, params, _ref3, _ref3$extendInfo, extendInfo, actionData, enableVaultingApiOptimize, enableEasypayApiOptimize, _ref4, skipSdkQuery, skipSdkQueryForm, extendInfoData, ifSkip, channelBehavior, _this5$_renderParams7, _this5$_renderParams8, _ref5, _ref5$productSceneVer, productSceneVersion, _ref5$productScene, productScene, _ref6, _ref6$action, _ref6$action2, _ref6$action2$autoDeb, autoDebitWithToken, _this5$_renderParams9, _action$web, _action$wap, action, signType;
|
370
382
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
371
383
|
while (1) switch (_context2.prev = _context2.next) {
|
372
384
|
case 0:
|
@@ -382,7 +394,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
382
394
|
/**
|
383
395
|
* @description Simulated or unnecessary scenarios
|
384
396
|
*/
|
385
|
-
_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;
|
397
|
+
_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, actionData = _ref3.action;
|
386
398
|
enableVaultingApiOptimize = false;
|
387
399
|
enableEasypayApiOptimize = false;
|
388
400
|
_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;
|
@@ -439,78 +451,89 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
439
451
|
});
|
440
452
|
return _context2.abrupt("return");
|
441
453
|
case 21:
|
454
|
+
channelBehavior = getChannelBehavior((_this5$_renderParams6 = _this5._renderParams) === null || _this5$_renderParams6 === void 0 ? void 0 : _this5$_renderParams6.paymentSessionMetaData); // Easypay TOSS 渠道无需actionQuery
|
455
|
+
if (!(channelBehavior !== null && channelBehavior !== void 0 && channelBehavior.usePaymentSessionAsQueryResult)) {
|
456
|
+
_context2.next = 24;
|
457
|
+
break;
|
458
|
+
}
|
459
|
+
return _context2.abrupt("return", resolve({
|
460
|
+
autoDebitWithToken: actionData === null || actionData === void 0 ? void 0 : actionData.autoDebitWithToken,
|
461
|
+
amountConfirmRequired: actionData === null || actionData === void 0 ? void 0 : actionData.amountConfirmRequired,
|
462
|
+
success: true
|
463
|
+
}));
|
464
|
+
case 24:
|
442
465
|
if (!(componentSignEnum.CASHIER_PAYMENT_CARD === _this5._componentSign || componentSignEnum.VAULTING_CARD === _this5._componentSign)) {
|
443
|
-
_context2.next =
|
466
|
+
_context2.next = 30;
|
444
467
|
break;
|
445
468
|
}
|
446
469
|
params.paymentMethodType = 'CARD';
|
447
|
-
_context2.next =
|
470
|
+
_context2.next = 28;
|
448
471
|
return _this5.getDeviceIdAndLog();
|
449
|
-
case
|
472
|
+
case 28:
|
450
473
|
envInfo.deviceId = _context2.sent;
|
451
474
|
if (window.navigator.userAgent.indexOf('miniProgram') > -1) {
|
452
475
|
envInfo.extendInfo = {
|
453
476
|
WAP_SUB_TYPE: 'WECHAT_MINI_PROGRAM'
|
454
477
|
};
|
455
478
|
}
|
456
|
-
case
|
479
|
+
case 30:
|
457
480
|
if (!(componentSignEnum.EASY_PAY_WALLET === _this5._componentSign)) {
|
458
|
-
_context2.next =
|
481
|
+
_context2.next = 40;
|
459
482
|
break;
|
460
483
|
}
|
461
484
|
_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;
|
462
|
-
_ref6 = ((_this5$
|
463
|
-
if (!((_this5$
|
464
|
-
_context2.next =
|
485
|
+
_ref6 = ((_this5$_renderParams7 = _this5._renderParams) === null || _this5$_renderParams7 === void 0 ? void 0 : _this5$_renderParams7.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;
|
486
|
+
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)) {
|
487
|
+
_context2.next = 35;
|
465
488
|
break;
|
466
489
|
}
|
467
490
|
return _context2.abrupt("return", resolve({
|
468
491
|
message: 'sdk no need to make query request',
|
469
492
|
success: true
|
470
493
|
}));
|
471
|
-
case
|
494
|
+
case 35:
|
472
495
|
if (!(productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0' && !autoDebitWithToken)) {
|
473
|
-
_context2.next =
|
496
|
+
_context2.next = 37;
|
474
497
|
break;
|
475
498
|
}
|
476
499
|
return _context2.abrupt("return", resolve({
|
477
500
|
message: 'sdk no need to make query request',
|
478
501
|
success: true
|
479
502
|
}));
|
480
|
-
case
|
481
|
-
_context2.next =
|
503
|
+
case 37:
|
504
|
+
_context2.next = 39;
|
482
505
|
return _this5.getDeviceIdAndLog();
|
483
|
-
case
|
506
|
+
case 39:
|
484
507
|
envInfo.deviceId = _context2.sent;
|
485
|
-
case
|
508
|
+
case 40:
|
486
509
|
if (!(componentSignEnum.AUTO_DEBIT_WALLET === _this5._componentSign)) {
|
487
|
-
_context2.next =
|
510
|
+
_context2.next = 50;
|
488
511
|
break;
|
489
512
|
}
|
490
|
-
action = ((_this5$
|
513
|
+
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) || {};
|
491
514
|
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;
|
492
515
|
if (!(signType === 'SMS')) {
|
493
|
-
_context2.next =
|
516
|
+
_context2.next = 45;
|
494
517
|
break;
|
495
518
|
}
|
496
519
|
return _context2.abrupt("return", resolve({
|
497
520
|
message: 'sdk no need to make query request',
|
498
521
|
success: true
|
499
522
|
}));
|
500
|
-
case
|
523
|
+
case 45:
|
501
524
|
if (!(!signType || signType !== 'REDIRECT')) {
|
502
|
-
_context2.next =
|
525
|
+
_context2.next = 47;
|
503
526
|
break;
|
504
527
|
}
|
505
528
|
return _context2.abrupt("return", resolve({
|
506
529
|
success: false
|
507
530
|
}));
|
508
|
-
case
|
509
|
-
_context2.next =
|
531
|
+
case 47:
|
532
|
+
_context2.next = 49;
|
510
533
|
return _this5.getDeviceIdAndLog();
|
511
|
-
case
|
534
|
+
case 49:
|
512
535
|
envInfo.deviceId = _context2.sent;
|
513
|
-
case
|
536
|
+
case 50:
|
514
537
|
_this5.AMSSDK.logger.logInfo({
|
515
538
|
title: 'sdk_event_sdkQuery'
|
516
539
|
}, {
|
@@ -549,7 +572,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
549
572
|
}).send();
|
550
573
|
reject(err);
|
551
574
|
});
|
552
|
-
case
|
575
|
+
case 52:
|
553
576
|
case "end":
|
554
577
|
return _context2.stop();
|
555
578
|
}
|
@@ -566,46 +589,64 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
566
589
|
}, {
|
567
590
|
key: "createSubmitPromise",
|
568
591
|
value: function createSubmitPromise() {
|
569
|
-
var _this$
|
570
|
-
_this$
|
592
|
+
var _this$_renderParams7,
|
593
|
+
_this$_renderParams8,
|
594
|
+
_this$_renderParams9,
|
571
595
|
_this6 = this;
|
572
596
|
this._performanceData.push({
|
573
597
|
key: 'sdk_submit_start',
|
574
598
|
value: Date.now()
|
575
599
|
});
|
576
600
|
var params = {
|
577
|
-
paymentSessionData: this._renderParams && ((_this$
|
578
|
-
paymentSessionConfig: (_this$
|
601
|
+
paymentSessionData: this._renderParams && ((_this$_renderParams7 = this._renderParams) === null || _this$_renderParams7 === void 0 ? void 0 : _this$_renderParams7.sessionData) || '',
|
602
|
+
paymentSessionConfig: (_this$_renderParams8 = this._renderParams) === null || _this$_renderParams8 === void 0 || (_this$_renderParams8 = _this$_renderParams8.paymentSessionMetaData) === null || _this$_renderParams8 === void 0 ? void 0 : _this$_renderParams8.paymentSessionConfig
|
579
603
|
};
|
580
|
-
|
604
|
+
var channelBehavior = getChannelBehavior((_this$_renderParams9 = this._renderParams) === null || _this$_renderParams9 === void 0 ? void 0 : _this$_renderParams9.paymentSessionMetaData);
|
581
605
|
// eslint-disable-next-line no-async-promise-executor
|
582
606
|
this._actionSubmitPromise = new Promise( /*#__PURE__*/function () {
|
583
607
|
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
|
584
|
-
var _this6$_renderParams
|
608
|
+
var _channelBehavior$buil, _this6$_renderParams$;
|
609
|
+
var shouldSkipSubmitPayInSDK, _this6$_renderParams, extParams;
|
585
610
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
586
611
|
while (1) switch (_context3.prev = _context3.next) {
|
587
612
|
case 0:
|
588
|
-
|
589
|
-
|
613
|
+
shouldSkipSubmitPayInSDK = false;
|
614
|
+
if (channelBehavior) {
|
615
|
+
// 新逻辑走 channelBehavior判断
|
616
|
+
shouldSkipSubmitPayInSDK = !channelBehavior.submitPayInSdk;
|
617
|
+
} else {
|
618
|
+
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;
|
619
|
+
}
|
620
|
+
if (!shouldSkipSubmitPayInSDK) {
|
621
|
+
_context3.next = 4;
|
590
622
|
break;
|
591
623
|
}
|
592
624
|
return _context3.abrupt("return", resolve({
|
593
625
|
message: 'sdk no need to make submitPay request',
|
594
626
|
success: true
|
595
627
|
}));
|
596
|
-
case
|
628
|
+
case 4:
|
597
629
|
_this6.AMSSDK.logger.logInfo({
|
598
630
|
title: 'sdk_event_submitPay'
|
599
631
|
}, {
|
600
632
|
paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
|
601
633
|
requestBody: params
|
602
634
|
}).send();
|
635
|
+
extParams = (channelBehavior === null || channelBehavior === void 0 || (_channelBehavior$buil = channelBehavior.buildSubmitPayExtParams) === null || _channelBehavior$buil === void 0 ? void 0 : _channelBehavior$buil.call(channelBehavior, {
|
636
|
+
instanceId: _this6.AMSSDK._instanceId,
|
637
|
+
locale: _this6.AMSSDK.options.locale,
|
638
|
+
paymentMethodType: (_this6$_renderParams$ = _this6._renderParams.paymentSessionMetaData) === null || _this6$_renderParams$ === void 0 || (_this6$_renderParams$ = _this6$_renderParams$.paymentMethodInfoView) === null || _this6$_renderParams$ === void 0 ? void 0 : _this6$_renderParams$.paymentMethodType,
|
639
|
+
paymentSessionData: _this6._renderParams.sessionData,
|
640
|
+
env: _this6.AMSSDK.options.env.environment,
|
641
|
+
sdkVersion: _this6._appVersion
|
642
|
+
})) || {};
|
643
|
+
params.extParams = extParams;
|
603
644
|
_context3.t0 = submitPayInfo;
|
604
645
|
_context3.t1 = params;
|
605
646
|
_context3.t2 = _this6.AMSSDK.options.env.environment;
|
606
|
-
_context3.next =
|
647
|
+
_context3.next = 12;
|
607
648
|
return _this6.getDeviceIdAndLog();
|
608
|
-
case
|
649
|
+
case 12:
|
609
650
|
_context3.t3 = _context3.sent;
|
610
651
|
_context3.t4 = {
|
611
652
|
deviceId: _context3.t3
|
@@ -639,7 +680,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
639
680
|
success: false
|
640
681
|
});
|
641
682
|
});
|
642
|
-
case
|
683
|
+
case 17:
|
643
684
|
case "end":
|
644
685
|
return _context3.stop();
|
645
686
|
}
|
@@ -1388,7 +1429,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1388
1429
|
key: "sendRenderEvent",
|
1389
1430
|
value: (function () {
|
1390
1431
|
var _sendRenderEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
1391
|
-
var _this$
|
1432
|
+
var _this$_renderParams10, _this$_renderParams11, _this$_renderParams12, _this$_renderParams13, _this$_renderParams14, _this$_renderParams15, _this$AMSSDK$logger, _this$_renderParams16, _this$_renderParams17, _this$_renderParams18, _this$AMSSDK, _this$_renderParams19, res, submitRes;
|
1392
1433
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
1393
1434
|
while (1) switch (_context8.prev = _context8.next) {
|
1394
1435
|
case 0:
|
@@ -1417,28 +1458,28 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1417
1458
|
data: {
|
1418
1459
|
queryResult: res,
|
1419
1460
|
submitResult: submitRes,
|
1420
|
-
sessionResult: (_this$
|
1421
|
-
paymentSessionData: (_this$
|
1461
|
+
sessionResult: (_this$_renderParams10 = this._renderParams) === null || _this$_renderParams10 === void 0 ? void 0 : _this$_renderParams10.paymentSessionMetaData,
|
1462
|
+
paymentSessionData: (_this$_renderParams11 = this._renderParams) === null || _this$_renderParams11 === void 0 ? void 0 : _this$_renderParams11.sessionData,
|
1422
1463
|
heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
|
1423
|
-
renderDisplayType: (_this$
|
1424
|
-
appearance: (_this$
|
1425
|
-
notRedirectAfterComplete: ((_this$
|
1464
|
+
renderDisplayType: (_this$_renderParams12 = this._renderParams) === null || _this$_renderParams12 === void 0 ? void 0 : _this$_renderParams12.renderDisplayType,
|
1465
|
+
appearance: (_this$_renderParams13 = this._renderParams) === null || _this$_renderParams13 === void 0 ? void 0 : _this$_renderParams13.appearance,
|
1466
|
+
notRedirectAfterComplete: ((_this$_renderParams14 = this._renderParams) === null || _this$_renderParams14 === void 0 ? void 0 : _this$_renderParams14.notRedirectAfterComplete) === true,
|
1426
1467
|
merchantAppointParam: this._merchantAppointParam,
|
1427
1468
|
envInfo: {
|
1428
1469
|
screenHeight: screen.height,
|
1429
1470
|
screenWidth: screen.width
|
1430
1471
|
},
|
1431
1472
|
logMetaData: _objectSpread(_objectSpread({
|
1432
|
-
trackId: (_this$
|
1473
|
+
trackId: (_this$_renderParams15 = this._renderParams) === null || _this$_renderParams15 === void 0 ? void 0 : _this$_renderParams15.sessionData,
|
1433
1474
|
platform: this.platform,
|
1434
1475
|
firstLogTime: (_this$AMSSDK$logger = this.AMSSDK.logger) === null || _this$AMSSDK$logger === void 0 ? void 0 : _this$AMSSDK$logger.getComponentStartTime()
|
1435
|
-
}, ((_this$
|
1436
|
-
renderDisplayType: (_this$
|
1476
|
+
}, ((_this$_renderParams16 = this._renderParams) === null || _this$_renderParams16 === void 0 || (_this$_renderParams16 = _this$_renderParams16.paymentSessionMetaData) === null || _this$_renderParams16 === void 0 ? void 0 : _this$_renderParams16.paymentSessionConfig) || {}), {}, {
|
1477
|
+
renderDisplayType: (_this$_renderParams17 = this._renderParams) === null || _this$_renderParams17 === void 0 ? void 0 : _this$_renderParams17.renderDisplayType,
|
1437
1478
|
sdkVersion: this._appVersion,
|
1438
|
-
merchantId: (_this$
|
1479
|
+
merchantId: (_this$_renderParams18 = this._renderParams) === null || _this$_renderParams18 === void 0 || (_this$_renderParams18 = _this$_renderParams18.paymentSessionMetaData) === null || _this$_renderParams18 === void 0 ? void 0 : _this$_renderParams18.clientId,
|
1439
1480
|
instanceId: (_this$AMSSDK = this.AMSSDK) === null || _this$AMSSDK === void 0 ? void 0 : _this$AMSSDK._instanceId,
|
1440
1481
|
performanceData: this._performanceData,
|
1441
|
-
paymentMethodType: (_this$
|
1482
|
+
paymentMethodType: (_this$_renderParams19 = this._renderParams) === null || _this$_renderParams19 === void 0 || (_this$_renderParams19 = _this$_renderParams19.paymentSessionMetaData) === null || _this$_renderParams19 === void 0 || (_this$_renderParams19 = _this$_renderParams19.paymentMethodInfoView) === null || _this$_renderParams19 === void 0 ? void 0 : _this$_renderParams19.paymentMethodType
|
1442
1483
|
})
|
1443
1484
|
}
|
1444
1485
|
}
|
package/esm/request/index.js
CHANGED
@@ -91,9 +91,9 @@ function _request() {
|
|
91
91
|
if (envInfo.terminalType === 'WAP') envInfo.osType = device.iOS ? 'IOS' : 'ANDROID';
|
92
92
|
_data = [_objectSpread(_objectSpread({}, requestData), {}, {
|
93
93
|
envInfo: envInfo,
|
94
|
-
extParams: {
|
94
|
+
extParams: _objectSpread(_objectSpread({}, requestData === null || requestData === void 0 ? void 0 : requestData.extParams), {}, {
|
95
95
|
refUrl: window.location.href
|
96
|
-
}
|
96
|
+
})
|
97
97
|
})];
|
98
98
|
startTime = Date.now();
|
99
99
|
_context.prev = 5;
|
package/esm/types/index.d.ts
CHANGED
@@ -42,6 +42,7 @@ export interface IcreatePaymentParams {
|
|
42
42
|
}
|
43
43
|
export declare enum componentSignEnum {
|
44
44
|
'EASY_PAY_WALLET' = "EASY_PAY_WALLET",
|
45
|
+
'EASY_PAY_APM' = "EASY_PAY_APM",
|
45
46
|
'CASHIER_PAYMENT_CARD' = "CASHIER_PAYMENT_CARD",
|
46
47
|
'CASHIER_PAYMENT_BANK' = "CASHIER_PAYMENT_BANK",
|
47
48
|
'CASHIER_PAYMENT_APM' = "CASHIER_PAYMENT_APM",
|
@@ -144,6 +145,7 @@ export interface IpaymentSessionMetaData {
|
|
144
145
|
extendInfo?: string;
|
145
146
|
paymentMethodInfoView?: any;
|
146
147
|
action?: {
|
148
|
+
amountConfirmRequired?: boolean;
|
147
149
|
autoDebitWithToken: boolean;
|
148
150
|
skipSdkQuery: boolean;
|
149
151
|
skipSdkQueryForm?: {
|
@@ -425,6 +427,7 @@ export interface CashierSubmitPayRequest {
|
|
425
427
|
verifyFactors?: Record<string, string>;
|
426
428
|
paymentSessionData: string;
|
427
429
|
paymentSessionConfig?: any;
|
430
|
+
extParams?: any;
|
428
431
|
}
|
429
432
|
export interface CashierSdkActionQueryResult {
|
430
433
|
supportedLanguages?: any[];
|
package/esm/types/index.js
CHANGED
@@ -17,6 +17,7 @@ export var renderDisplayTypeEnum = /*#__PURE__*/function (renderDisplayTypeEnum)
|
|
17
17
|
}({});
|
18
18
|
export var componentSignEnum = /*#__PURE__*/function (componentSignEnum) {
|
19
19
|
componentSignEnum["EASY_PAY_WALLET"] = "EASY_PAY_WALLET";
|
20
|
+
componentSignEnum["EASY_PAY_APM"] = "EASY_PAY_APM";
|
20
21
|
componentSignEnum["CASHIER_PAYMENT_CARD"] = "CASHIER_PAYMENT_CARD";
|
21
22
|
componentSignEnum["CASHIER_PAYMENT_BANK"] = "CASHIER_PAYMENT_BANK";
|
22
23
|
componentSignEnum["CASHIER_PAYMENT_APM"] = "CASHIER_PAYMENT_APM";
|