@alipay/ams-checkout 1.14.0 → 1.15.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 +7 -4
- package/esm/plugin/component/cashierApp.d.ts +1 -1
- package/esm/plugin/component/cashierApp.js +20 -20
- 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.d.ts +1 -1
- package/esm/plugin/component/index.js +96 -66
- package/esm/plugin/paypal/index.js +1 -1
- package/esm/request/index.js +2 -2
- package/esm/types/index.d.ts +4 -1
- package/esm/types/index.js +1 -0
- package/esm/util/debug.js +2 -2
- package/esm/util/logger.js +18 -11
- 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
|
};
|
@@ -152,9 +156,6 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
152
156
|
key: "pluginAppendIframe",
|
153
157
|
value: function pluginAppendIframe(appendParams) {
|
154
158
|
try {
|
155
|
-
this.logger.logInfo({
|
156
|
-
title: 'sdk_event_createComponent'
|
157
|
-
}).send();
|
158
159
|
return this._componentApp.appendIframeNodes(appendParams.componentSign, appendParams.iframeNodesParams);
|
159
160
|
} catch (error) {
|
160
161
|
return Promise.reject(error);
|
@@ -311,6 +312,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
311
312
|
value: function createComponent(params) {
|
312
313
|
var _this4 = this;
|
313
314
|
this.clearPreloadIframe();
|
315
|
+
this.logger.setComponentStartTime(Date.now());
|
314
316
|
return this.parameterInitAndCheck({
|
315
317
|
params: params,
|
316
318
|
renderDisplayType: renderDisplayTypeEnum.popup
|
@@ -401,6 +403,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
401
403
|
value: function mountComponent(params, selector) {
|
402
404
|
var _this6 = this;
|
403
405
|
this.clearPreloadIframe();
|
406
|
+
this.logger.setComponentStartTime(Date.now());
|
404
407
|
return this.parameterInitAndCheck({
|
405
408
|
params: params,
|
406
409
|
renderDisplayType: renderDisplayTypeEnum.inline,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { componentSignEnum, Ianalytics, renderDisplayTypeEnum } from '../../types';
|
2
|
-
export declare const getAppPath: (environment: string, appVersion: string, componentSign: componentSignEnum, productScene: string, productSceneVersion: string, extendInfo: string, mid: string) => any;
|
2
|
+
export declare const getAppPath: (environment: string, appVersion: string, componentSign: componentSignEnum, productScene: string, productSceneVersion: string, extendInfo: string, mid: string, sendLog?: boolean) => any;
|
3
3
|
export declare const getAppDomain: (domainParams: {
|
4
4
|
environment: string;
|
5
5
|
appVersion: string;
|
@@ -12,28 +12,31 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
12
12
|
import { marmotMap, sdkVersion } from "../../config/index";
|
13
13
|
import { componentSignEnum } from "../../types";
|
14
14
|
import { isDebugLog } from "../../util/debug";
|
15
|
-
import {
|
15
|
+
import { queryParse, serialize } from "../../util/index";
|
16
16
|
import { Logger } from "../../util/logger";
|
17
17
|
import { getLastAppVersion, getMatchAppVersion, setLastAppVersion } from "../../util/upgrade";
|
18
18
|
var getAppVersion = function getAppVersion(_extendInfo, productScene, mid) {
|
19
|
+
var sendLog = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
19
20
|
try {
|
20
|
-
var _Logger$getInstance;
|
21
21
|
var appVersion = getMatchAppVersion(_extendInfo, {
|
22
22
|
sdkVersion: sdkVersion,
|
23
23
|
productScene: productScene,
|
24
24
|
mid: mid
|
25
25
|
});
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
26
|
+
if (sendLog) {
|
27
|
+
var _Logger$getInstance;
|
28
|
+
(_Logger$getInstance = Logger.getInstance()) === null || _Logger$getInstance === void 0 || _Logger$getInstance.logInfo({
|
29
|
+
title: 'sdk_event_appUpgradeInfo'
|
30
|
+
}, {
|
31
|
+
appUpgradeVersion: appVersion,
|
32
|
+
appUpgraded: appVersion ? true : false,
|
33
|
+
isPreload: _extendInfo ? false : true,
|
34
|
+
extendInfo: _extendInfo,
|
35
|
+
productScene: productScene,
|
36
|
+
mid: mid
|
37
|
+
});
|
38
|
+
}
|
39
|
+
|
37
40
|
// 没有匹配到版本,查询上次的加载版本
|
38
41
|
if (!appVersion) {
|
39
42
|
appVersion = getLastAppVersion(productScene);
|
@@ -49,7 +52,7 @@ var getAppVersion = function getAppVersion(_extendInfo, productScene, mid) {
|
|
49
52
|
}
|
50
53
|
};
|
51
54
|
var getFinalProductSceneVersion = function getFinalProductSceneVersion(componentSign, productSceneVersion) {
|
52
|
-
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']);
|
53
56
|
var supportProductSceneVersion = signSupportMap[componentSign];
|
54
57
|
// 从左到右,从旧到新
|
55
58
|
var isSupport = supportProductSceneVersion.find(function (it) {
|
@@ -66,9 +69,10 @@ export var getAppPath = function getAppPath() {
|
|
66
69
|
var productSceneVersion = arguments.length > 4 ? arguments[4] : undefined;
|
67
70
|
var extendInfo = arguments.length > 5 ? arguments[5] : undefined;
|
68
71
|
var mid = arguments.length > 6 ? arguments[6] : undefined;
|
72
|
+
var sendLog = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
|
69
73
|
var _ref = queryParse() || {},
|
70
74
|
urlTestHost = _ref.host;
|
71
|
-
var upgradeAppVersion = getAppVersion(extendInfo, productScene, mid);
|
75
|
+
var upgradeAppVersion = getAppVersion(extendInfo, productScene, mid, sendLog);
|
72
76
|
var finalAppVersion = upgradeAppVersion || appVersion;
|
73
77
|
// 当有升级版本时,更新到全局字段
|
74
78
|
if (upgradeAppVersion) {
|
@@ -120,14 +124,12 @@ export var getIframeUrl = function getIframeUrl(iframeParams) {
|
|
120
124
|
hostSign = _iframeParams$hostSig === void 0 ? '' : _iframeParams$hostSig,
|
121
125
|
_iframeParams$mid = iframeParams.mid,
|
122
126
|
mid = _iframeParams$mid === void 0 ? '' : _iframeParams$mid;
|
123
|
-
var path = getAppPath(environment, appVersion, componentSign, productScene, productSceneVersion, extendInfo || '', mid);
|
127
|
+
var path = getAppPath(environment, appVersion, componentSign, productScene, productSceneVersion, extendInfo || '', mid, true);
|
124
128
|
var appMatched = getMatchAppVersion(extendInfo, {
|
125
129
|
sdkVersion: sdkVersion,
|
126
130
|
productScene: productScene,
|
127
131
|
mid: mid
|
128
132
|
}) ? 'true' : 'false';
|
129
|
-
var initialScale = 1;
|
130
|
-
var scale = getViewPort('initial-scale') || initialScale;
|
131
133
|
var _queryParse = queryParse(),
|
132
134
|
_sandbox = _queryParse._sandbox,
|
133
135
|
_light_sandbox = _queryParse._light_sandbox,
|
@@ -140,7 +142,6 @@ export var getIframeUrl = function getIframeUrl(iframeParams) {
|
|
140
142
|
var urlParams = Object.assign({}, {
|
141
143
|
displayType: renderDisplayType,
|
142
144
|
locale: locale,
|
143
|
-
scale: scale,
|
144
145
|
instanceId: instanceId,
|
145
146
|
appMatched: appMatched,
|
146
147
|
analyticsEnabled: (analytics === null || analytics === void 0 ? void 0 : analytics.enabled) === false ? 'false' : 'true',
|
@@ -156,7 +157,6 @@ export var getIframeUrl = function getIframeUrl(iframeParams) {
|
|
156
157
|
if (environment === 'light_sandbox' || _light_sandbox === 'true') urlParams.sandbox = 'true';
|
157
158
|
if (environment === 'sandbox' || _sandbox === 'true') urlParams.shadow = 'true';
|
158
159
|
if (_displayType) urlParams.displayType = _displayType;
|
159
|
-
if (isPreload) urlParams.isPreload = isPreload;
|
160
160
|
var locationSearch = serialize(urlParams);
|
161
161
|
if (isDebugLog()) {
|
162
162
|
console.log('appUpgrade#getIframeUrl#appMatched', appMatched);
|
@@ -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";
|
@@ -55,7 +56,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
55
56
|
_defineProperty(this, "_multipleCallbackEvents", void 0);
|
56
57
|
_defineProperty(this, "_merchantAppointParam", void 0);
|
57
58
|
_defineProperty(this, "_webAppHeartBeatTimeoutFn", void 0);
|
58
|
-
this._appVersion = '1.
|
59
|
+
this._appVersion = '1.15.1';
|
59
60
|
this._isInitComponent = false;
|
60
61
|
this._selector = "#".concat(COMPONENT_SECTION_ID);
|
61
62
|
this.createIframeNode = function () {
|
@@ -112,7 +113,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
112
113
|
productSceneVersion: paymentSessionConfig === null || paymentSessionConfig === void 0 ? void 0 : paymentSessionConfig.productSceneVersion,
|
113
114
|
paymentMethodType: paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa = paymentSessionMetaData.paymentMethodInfoView) === null || _paymentSessionMetaDa === void 0 ? void 0 : _paymentSessionMetaDa.paymentMethodType,
|
114
115
|
paymentMethodCategoryType: paymentSessionConfig === null || paymentSessionConfig === void 0 ? void 0 : paymentSessionConfig.paymentMethodCategoryType,
|
115
|
-
requestSeq: (_this$_renderParams2 = this._renderParams) === null || _this$_renderParams2 === void 0 ? void 0 : _this$_renderParams2.
|
116
|
+
requestSeq: (_this$_renderParams2 = this._renderParams) === null || _this$_renderParams2 === void 0 ? void 0 : _this$_renderParams2.sessionData,
|
116
117
|
trackId: (_this$_renderParams3 = this._renderParams) === null || _this$_renderParams3 === void 0 ? void 0 : _this$_renderParams3.sessionData
|
117
118
|
});
|
118
119
|
}
|
@@ -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
|
}
|
@@ -1348,20 +1389,12 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1348
1389
|
key: "dispatchToApp",
|
1349
1390
|
value: function dispatchToApp(payload) {
|
1350
1391
|
var targetElement = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
1351
|
-
var sendLog = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
1352
1392
|
var data = Object.assign({}, payload, {
|
1353
1393
|
name: messageName.SDK_TO_APP,
|
1354
1394
|
mode: this.AMSSDK.options.mode,
|
1355
1395
|
appId: COMPONENTPLUGINID,
|
1356
1396
|
instanceId: this.AMSSDK._instanceId
|
1357
1397
|
});
|
1358
|
-
if (sendLog) {
|
1359
|
-
this.AMSSDK.logger.logInfo({
|
1360
|
-
title: 'sdk_event_send_message_to_web'
|
1361
|
-
}, {
|
1362
|
-
event: data === null || data === void 0 ? void 0 : data.context.event
|
1363
|
-
}).send();
|
1364
|
-
}
|
1365
1398
|
if (targetElement && targetElement.contentWindow) {
|
1366
1399
|
return targetElement.contentWindow.postMessage(JSON.stringify(data), '*');
|
1367
1400
|
}
|
@@ -1396,7 +1429,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1396
1429
|
key: "sendRenderEvent",
|
1397
1430
|
value: (function () {
|
1398
1431
|
var _sendRenderEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
1399
|
-
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;
|
1400
1433
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
1401
1434
|
while (1) switch (_context8.prev = _context8.next) {
|
1402
1435
|
case 0:
|
@@ -1425,32 +1458,32 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1425
1458
|
data: {
|
1426
1459
|
queryResult: res,
|
1427
1460
|
submitResult: submitRes,
|
1428
|
-
sessionResult: (_this$
|
1429
|
-
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,
|
1430
1463
|
heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
|
1431
|
-
renderDisplayType: (_this$
|
1432
|
-
appearance: (_this$
|
1433
|
-
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,
|
1434
1467
|
merchantAppointParam: this._merchantAppointParam,
|
1435
1468
|
envInfo: {
|
1436
1469
|
screenHeight: screen.height,
|
1437
1470
|
screenWidth: screen.width
|
1438
1471
|
},
|
1439
1472
|
logMetaData: _objectSpread(_objectSpread({
|
1440
|
-
trackId: (_this$
|
1473
|
+
trackId: (_this$_renderParams15 = this._renderParams) === null || _this$_renderParams15 === void 0 ? void 0 : _this$_renderParams15.sessionData,
|
1441
1474
|
platform: this.platform,
|
1442
1475
|
firstLogTime: (_this$AMSSDK$logger = this.AMSSDK.logger) === null || _this$AMSSDK$logger === void 0 ? void 0 : _this$AMSSDK$logger.getComponentStartTime()
|
1443
|
-
}, ((_this$
|
1444
|
-
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,
|
1445
1478
|
sdkVersion: this._appVersion,
|
1446
|
-
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,
|
1447
1480
|
instanceId: (_this$AMSSDK = this.AMSSDK) === null || _this$AMSSDK === void 0 ? void 0 : _this$AMSSDK._instanceId,
|
1448
1481
|
performanceData: this._performanceData,
|
1449
|
-
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
|
1450
1483
|
})
|
1451
1484
|
}
|
1452
1485
|
}
|
1453
|
-
}, null
|
1486
|
+
}, null);
|
1454
1487
|
this.AMSSDK.logger.logInfo({
|
1455
1488
|
title: 'sdk_event_renderComponent'
|
1456
1489
|
});
|
@@ -1489,9 +1522,6 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1489
1522
|
var _document$getElementB4,
|
1490
1523
|
_this9 = this;
|
1491
1524
|
var immediately = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
1492
|
-
this.AMSSDK.logger.logInfo({
|
1493
|
-
title: 'sdk_event_clean_component'
|
1494
|
-
}).send();
|
1495
1525
|
(_document$getElementB4 = document.getElementById(LOADING_ID)) === null || _document$getElementB4 === void 0 || _document$getElementB4.remove();
|
1496
1526
|
this.hideComponentAnimation();
|
1497
1527
|
var mockup = document.getElementById(MOCKUP_ID);
|