@alipay/ams-checkout 0.0.1762410565-dev.0 → 0.0.1763473512-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/umd/ams-checkout.min.js +1 -1
- package/esm/config/index.d.ts +8 -8
- package/esm/config/index.js +8 -8
- package/esm/core/component/ckp/index.d.ts +2 -11
- package/esm/core/component/ckp/index.js +8 -22
- package/esm/core/component/element/elementController/index.js +1 -2
- package/esm/core/component/element/elementProcessor/addressProcessor.js +2 -4
- package/esm/core/component/element/elementProcessor/authProcessor.js +2 -4
- package/esm/core/component/element/elementProcessor/paymentProcessor.js +2 -4
- package/esm/core/component/element/type.d.ts +0 -4
- package/esm/core/component/element/util.d.ts +1 -9
- package/esm/core/component/element/util.js +5 -14
- package/esm/foundation/core/index.js +1 -2
- package/esm/foundation/index.d.ts +1 -8
- package/esm/foundation/product-processor/autoDebit/index.d.ts +1 -5
- package/esm/foundation/product-processor/autoDebit/index.js +2 -5
- package/esm/foundation/product-processor/easysafepay/index.d.ts +1 -4
- package/esm/foundation/product-processor/easysafepay/index.js +17 -25
- package/esm/foundation/product-processor/element/index.d.ts +1 -1
- package/esm/foundation/product-processor/element/index.js +1 -1
- package/esm/foundation/utils/web_app_url_utils.d.ts +0 -3
- package/esm/foundation/utils/web_app_url_utils.js +8 -15
- package/esm/index.js +0 -1
- package/esm/plugin/component/cashierApp.d.ts +1 -9
- package/esm/plugin/component/cashierApp.js +7 -19
- package/esm/plugin/component/index.js +2 -9
- package/esm/types/index.d.ts +0 -8
- package/esm/util/index.d.ts +1 -2
- package/esm/util/index.js +1 -21
- package/package.json +1 -3
package/esm/config/index.d.ts
CHANGED
|
@@ -6,11 +6,11 @@ export declare const sdkVersion: string;
|
|
|
6
6
|
* @description: 目前应用层分为v1和v2,会存在两个应用版本号不是同步发布的情况。所以需要把默认的应用版本号配置抽离出来。
|
|
7
7
|
* TODO 这里考虑直接换成packagejson.version
|
|
8
8
|
*/
|
|
9
|
-
export declare const AMSCheckoutAppVersion = "1.
|
|
10
|
-
export declare const AMSAutoDebitAppVersion = "1.
|
|
11
|
-
export declare const AMSEasyPayAppVersion = "1.
|
|
12
|
-
export declare const AMSCashierPaymentAppVersion = "1.
|
|
13
|
-
export declare const AMSVaultingAppVersion = "1.
|
|
14
|
-
export declare const AMSPaymentElementAppVersion = "1.
|
|
15
|
-
export declare const ADDRESSElementAppVersion = "1.
|
|
16
|
-
export declare const AUTHElementAppVersion = "1.
|
|
9
|
+
export declare const AMSCheckoutAppVersion = "1.46.0";
|
|
10
|
+
export declare const AMSAutoDebitAppVersion = "1.46.0";
|
|
11
|
+
export declare const AMSEasyPayAppVersion = "1.46.0";
|
|
12
|
+
export declare const AMSCashierPaymentAppVersion = "1.46.0";
|
|
13
|
+
export declare const AMSVaultingAppVersion = "1.46.0";
|
|
14
|
+
export declare const AMSPaymentElementAppVersion = "1.46.0";
|
|
15
|
+
export declare const ADDRESSElementAppVersion = "1.46.0";
|
|
16
|
+
export declare const AUTHElementAppVersion = "1.46.0";
|
package/esm/config/index.js
CHANGED
|
@@ -36,11 +36,11 @@ export var sdkVersion = json.version;
|
|
|
36
36
|
* @description: 目前应用层分为v1和v2,会存在两个应用版本号不是同步发布的情况。所以需要把默认的应用版本号配置抽离出来。
|
|
37
37
|
* TODO 这里考虑直接换成packagejson.version
|
|
38
38
|
*/
|
|
39
|
-
export var AMSCheckoutAppVersion = '1.
|
|
40
|
-
export var AMSAutoDebitAppVersion = '1.
|
|
41
|
-
export var AMSEasyPayAppVersion = '1.
|
|
42
|
-
export var AMSCashierPaymentAppVersion = '1.
|
|
43
|
-
export var AMSVaultingAppVersion = '1.
|
|
44
|
-
export var AMSPaymentElementAppVersion = '1.
|
|
45
|
-
export var ADDRESSElementAppVersion = '1.
|
|
46
|
-
export var AUTHElementAppVersion = '1.
|
|
39
|
+
export var AMSCheckoutAppVersion = '1.46.0'; // 兜底版本号
|
|
40
|
+
export var AMSAutoDebitAppVersion = '1.46.0'; // 代扣
|
|
41
|
+
export var AMSEasyPayAppVersion = '1.46.0'; // easypay
|
|
42
|
+
export var AMSCashierPaymentAppVersion = '1.46.0'; // 收银台(卡、apm)
|
|
43
|
+
export var AMSVaultingAppVersion = '1.46.0'; // 绑卡
|
|
44
|
+
export var AMSPaymentElementAppVersion = '1.46.0'; // payment element
|
|
45
|
+
export var ADDRESSElementAppVersion = '1.46.0'; // address element
|
|
46
|
+
export var AUTHElementAppVersion = '1.46.0'; // auth element
|
|
@@ -3,24 +3,15 @@ import { Logger } from '../../../util/logger';
|
|
|
3
3
|
type LOCAL_URL = string;
|
|
4
4
|
export type CKPEmbeddedAppEnv = 'dev' | 'sit' | 'pre' | 'prod';
|
|
5
5
|
export type CKPEmbeddedEventType = 'SDK_PAYMENT_SUCCESSFUL' | 'SDK_PAYMENT_FAIL' | 'SDK_PAYMENT_CANCEL' | 'SDK_PAYMENT_CLICK_BACK_TO_MERCHANT';
|
|
6
|
-
export declare const getCKPPageAddress: (env: IoptionsParams['environment'] | LOCAL_URL
|
|
7
|
-
useMock: boolean;
|
|
8
|
-
mockUserId?: any;
|
|
9
|
-
}) => string;
|
|
6
|
+
export declare const getCKPPageAddress: (env: IoptionsParams['environment'] | LOCAL_URL) => string;
|
|
10
7
|
export declare class AMSCheckoutPage {
|
|
11
8
|
logger: Logger;
|
|
12
9
|
private _instanceId;
|
|
13
10
|
private iframe;
|
|
14
11
|
private originOptions;
|
|
15
|
-
private mockOptions?;
|
|
16
12
|
private readonly APP_IFRAME_ID;
|
|
17
13
|
private eventListener?;
|
|
18
|
-
constructor(options: Pick<IoptionsParams, 'environment' | 'locale' | 'onEventCallback'>
|
|
19
|
-
mockOptions?: {
|
|
20
|
-
useMock: boolean;
|
|
21
|
-
mockUserId?: any;
|
|
22
|
-
};
|
|
23
|
-
});
|
|
14
|
+
constructor(options: Pick<IoptionsParams, 'environment' | 'locale' | 'onEventCallback'>);
|
|
24
15
|
private generateIframeSrc;
|
|
25
16
|
private eventListenerWrapper;
|
|
26
17
|
private addListener;
|
|
@@ -10,7 +10,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
10
10
|
import { redirect } from "../../../util/redirect";
|
|
11
11
|
import { v4 as uuid } from 'uuid';
|
|
12
12
|
import { EnvironmentEnum, MessageName } from "../../../types";
|
|
13
|
-
import {
|
|
13
|
+
import { queryParse } from "../../../util";
|
|
14
14
|
import { LogConfig, Logger } from "../../../util/logger";
|
|
15
15
|
var CKP_PAYMENT_PAGE_HOST = {
|
|
16
16
|
DEV: 'https://dev.page.alipay.net',
|
|
@@ -23,34 +23,22 @@ var CKP_PAYMENT_PAGE_HOST = {
|
|
|
23
23
|
|
|
24
24
|
var CKP_PAGE_ADDRESS = '/page/antom-web-checkout-v2/checkout-page/pages/payment/index.html';
|
|
25
25
|
var CKP_PAGE_NEW_ADDRESS = '/checkout-page/pages/payment/index.html';
|
|
26
|
-
export var getCKPPageAddress = function getCKPPageAddress(env
|
|
27
|
-
var baseUrl;
|
|
26
|
+
export var getCKPPageAddress = function getCKPPageAddress(env) {
|
|
28
27
|
switch (env) {
|
|
29
28
|
case 'dev':
|
|
30
|
-
|
|
31
|
-
break;
|
|
29
|
+
return "".concat(CKP_PAYMENT_PAGE_HOST.DEV).concat(CKP_PAGE_ADDRESS);
|
|
32
30
|
case 'sit':
|
|
33
|
-
|
|
34
|
-
break;
|
|
31
|
+
return "".concat(CKP_PAYMENT_PAGE_HOST.TEST).concat(CKP_PAGE_ADDRESS);
|
|
35
32
|
case 'pre':
|
|
36
|
-
|
|
37
|
-
break;
|
|
33
|
+
return "".concat(CKP_PAYMENT_PAGE_HOST.PRE).concat(CKP_PAGE_ADDRESS);
|
|
38
34
|
case 'prod':
|
|
39
35
|
case 'sandbox':
|
|
40
36
|
case 'light_sandbox':
|
|
41
|
-
|
|
42
|
-
break;
|
|
37
|
+
return "".concat(CKP_PAYMENT_PAGE_HOST.PROD).concat(CKP_PAGE_NEW_ADDRESS);
|
|
43
38
|
default:
|
|
44
39
|
// for local development, e.g. http://localhost:5173/checkout-page/src/pages/payment/index.html
|
|
45
|
-
|
|
46
|
-
break;
|
|
40
|
+
return env;
|
|
47
41
|
}
|
|
48
|
-
|
|
49
|
-
// 简化的Mock逻辑:直接使用genProxyUrl,内部会处理环境安全检查
|
|
50
|
-
if (mockOptions && mockOptions.useMock === true) {
|
|
51
|
-
baseUrl = genProxyUrl(baseUrl, env);
|
|
52
|
-
}
|
|
53
|
-
return baseUrl;
|
|
54
42
|
};
|
|
55
43
|
export var AMSCheckoutPage = /*#__PURE__*/function () {
|
|
56
44
|
function AMSCheckoutPage(options) {
|
|
@@ -60,14 +48,13 @@ export var AMSCheckoutPage = /*#__PURE__*/function () {
|
|
|
60
48
|
_defineProperty(this, "_instanceId", void 0);
|
|
61
49
|
_defineProperty(this, "iframe", void 0);
|
|
62
50
|
_defineProperty(this, "originOptions", void 0);
|
|
63
|
-
_defineProperty(this, "mockOptions", void 0);
|
|
64
51
|
_defineProperty(this, "APP_IFRAME_ID", 'antom-checkout-page-sub-page-iframe');
|
|
65
52
|
_defineProperty(this, "eventListener", void 0);
|
|
66
53
|
_defineProperty(this, "generateIframeSrc", function (sessionData) {
|
|
67
54
|
var env = _this.originOptions.environment || 'prod';
|
|
68
55
|
var session = sessionData || '';
|
|
69
56
|
var lang = _this.originOptions.locale || 'en_US';
|
|
70
|
-
var ckpPageAddress = getCKPPageAddress(env
|
|
57
|
+
var ckpPageAddress = getCKPPageAddress(env);
|
|
71
58
|
console.log('[antom-web-sdk] <antom-checkout-page> generateIframeSrc', _this.originOptions, env, session, lang, ckpPageAddress);
|
|
72
59
|
|
|
73
60
|
// 先获取去除的 query 参数的 url
|
|
@@ -137,7 +124,6 @@ export var AMSCheckoutPage = /*#__PURE__*/function () {
|
|
|
137
124
|
this._instanceId = uuid();
|
|
138
125
|
this.iframe = null;
|
|
139
126
|
this.originOptions = options;
|
|
140
|
-
this.mockOptions = options.mockOptions;
|
|
141
127
|
this.eventListener = options.onEventCallback;
|
|
142
128
|
this.logger = new Logger(LogConfig, ![EnvironmentEnum.prod, EnvironmentEnum.sandbox].includes(options === null || options === void 0 ? void 0 : options.environment));
|
|
143
129
|
Logger.setInstance(this.logger);
|
|
@@ -270,8 +270,7 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
270
270
|
paymentSession: _this2.options.sessionData,
|
|
271
271
|
displayInfo: _objectSpread(_objectSpread({}, renderOptions), {}, {
|
|
272
272
|
appendAliasContainerId: true
|
|
273
|
-
})
|
|
274
|
-
mockOptions: _this2.options.mockOptions
|
|
273
|
+
})
|
|
275
274
|
};
|
|
276
275
|
_this2.setControllerStatusOrView(IElementStatus.IN_BIZ_FLOW);
|
|
277
276
|
_this2.elementContainer.startBizFlow(startBizFlowData);
|
|
@@ -90,8 +90,7 @@ var AddressProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
|
90
90
|
var _ref2 = this.elementContainer.getPaymentContext() || {},
|
|
91
91
|
paymentSession = _ref2.paymentSession,
|
|
92
92
|
paymentSessionObj = _ref2.paymentSessionObj,
|
|
93
|
-
sdkMetaData = _ref2.sdkMetaData
|
|
94
|
-
startBizFlowOptions = _ref2.startBizFlowOptions;
|
|
93
|
+
sdkMetaData = _ref2.sdkMetaData;
|
|
95
94
|
var _this$options = this.options,
|
|
96
95
|
environment = _this$options.env.environment,
|
|
97
96
|
analytics = _this$options.analytics,
|
|
@@ -106,8 +105,7 @@ var AddressProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
|
106
105
|
link: link,
|
|
107
106
|
appVersion: sdkMetaData === null || sdkMetaData === void 0 ? void 0 : sdkMetaData.webAppVersion,
|
|
108
107
|
pageUrl: pageUrl,
|
|
109
|
-
instanceId: instanceId
|
|
110
|
-
mockOptions: startBizFlowOptions === null || startBizFlowOptions === void 0 ? void 0 : startBizFlowOptions.mockOptions
|
|
108
|
+
instanceId: instanceId
|
|
111
109
|
});
|
|
112
110
|
}
|
|
113
111
|
}, {
|
|
@@ -64,8 +64,7 @@ var AuthProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
|
64
64
|
var _ref2 = this.elementContainer.getPaymentContext() || {},
|
|
65
65
|
paymentSession = _ref2.paymentSession,
|
|
66
66
|
paymentSessionObj = _ref2.paymentSessionObj,
|
|
67
|
-
sdkMetaData = _ref2.sdkMetaData
|
|
68
|
-
startBizFlowOptions = _ref2.startBizFlowOptions;
|
|
67
|
+
sdkMetaData = _ref2.sdkMetaData;
|
|
69
68
|
var _this$options = this.options,
|
|
70
69
|
environment = _this$options.env.environment,
|
|
71
70
|
analytics = _this$options.analytics,
|
|
@@ -80,8 +79,7 @@ var AuthProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
|
80
79
|
link: link,
|
|
81
80
|
appVersion: sdkMetaData === null || sdkMetaData === void 0 ? void 0 : sdkMetaData.webAppVersion,
|
|
82
81
|
pageUrl: pageUrl,
|
|
83
|
-
instanceId: instanceId
|
|
84
|
-
mockOptions: startBizFlowOptions === null || startBizFlowOptions === void 0 ? void 0 : startBizFlowOptions.mockOptions
|
|
82
|
+
instanceId: instanceId
|
|
85
83
|
});
|
|
86
84
|
}
|
|
87
85
|
}, {
|
|
@@ -216,8 +216,7 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
|
216
216
|
var _ref2 = this.elementContainer.getPaymentContext() || {},
|
|
217
217
|
paymentSession = _ref2.paymentSession,
|
|
218
218
|
paymentSessionObj = _ref2.paymentSessionObj,
|
|
219
|
-
sdkMetaData = _ref2.sdkMetaData
|
|
220
|
-
startBizFlowOptions = _ref2.startBizFlowOptions;
|
|
219
|
+
sdkMetaData = _ref2.sdkMetaData;
|
|
221
220
|
var _this$options = this.options,
|
|
222
221
|
environment = _this$options.env.environment,
|
|
223
222
|
analytics = _this$options.analytics,
|
|
@@ -241,8 +240,7 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
|
241
240
|
link: link,
|
|
242
241
|
appVersion: sdkMetaData === null || sdkMetaData === void 0 ? void 0 : sdkMetaData.webAppVersion,
|
|
243
242
|
pageUrl: pageUrl,
|
|
244
|
-
instanceId: instanceId
|
|
245
|
-
mockOptions: startBizFlowOptions === null || startBizFlowOptions === void 0 ? void 0 : startBizFlowOptions.mockOptions
|
|
243
|
+
instanceId: instanceId
|
|
246
244
|
});
|
|
247
245
|
this.setElementUrl(url);
|
|
248
246
|
return url;
|
|
@@ -391,10 +391,6 @@ export interface IElementOptions {
|
|
|
391
391
|
onStartLoading: () => void;
|
|
392
392
|
onEndLoading: () => void;
|
|
393
393
|
};
|
|
394
|
-
mockOptions?: {
|
|
395
|
-
useMock: boolean;
|
|
396
|
-
mockUserId?: any;
|
|
397
|
-
};
|
|
398
394
|
}
|
|
399
395
|
export interface IElementProcessors {
|
|
400
396
|
[ElementType.auth]: AuthProcessor;
|
|
@@ -19,10 +19,6 @@ export declare const formatElementOption: (options: IElementOptions) => {
|
|
|
19
19
|
onStartLoading: () => void;
|
|
20
20
|
onEndLoading: () => void;
|
|
21
21
|
};
|
|
22
|
-
mockOptions?: {
|
|
23
|
-
useMock: boolean;
|
|
24
|
-
mockUserId?: any;
|
|
25
|
-
};
|
|
26
22
|
};
|
|
27
23
|
export declare const validateElementOption: (options: IElementOptions) => {
|
|
28
24
|
isValid: boolean;
|
|
@@ -52,7 +48,7 @@ export declare function checkCanUpdate({ status, paymentContainerService, newPay
|
|
|
52
48
|
newPaymentSessionData: string;
|
|
53
49
|
oldPaymentSessionData: string;
|
|
54
50
|
}): boolean;
|
|
55
|
-
export declare function generateIframeSrc({ paymentSessionObj, paymentSession, instanceId, environment, appVersion, analytics, locale, pageUrl, link,
|
|
51
|
+
export declare function generateIframeSrc({ paymentSessionObj, paymentSession, instanceId, environment, appVersion, analytics, locale, pageUrl, link, }: {
|
|
56
52
|
paymentSessionObj: IPaymentSessionMetaData;
|
|
57
53
|
paymentSession: string;
|
|
58
54
|
environment: string;
|
|
@@ -62,10 +58,6 @@ export declare function generateIframeSrc({ paymentSessionObj, paymentSession, i
|
|
|
62
58
|
pageUrl: string;
|
|
63
59
|
appVersion: string;
|
|
64
60
|
link?: string;
|
|
65
|
-
mockOptions?: {
|
|
66
|
-
useMock: boolean;
|
|
67
|
-
mockUserId?: any;
|
|
68
|
-
};
|
|
69
61
|
}): string;
|
|
70
62
|
export declare function handleRedirect(data: any, fromFastSdk: boolean, eventCallback: ({ code, message }: {
|
|
71
63
|
code: any;
|
|
@@ -14,7 +14,7 @@ import { ERRORMESSAGE } from "../../../constant";
|
|
|
14
14
|
import { IElementStatus } from "../../../foundation";
|
|
15
15
|
import { getIframeUrl } from "../../../plugin/component/cashierApp";
|
|
16
16
|
import { DisplayTypeEnum, eventCodeEnum, RedirectType, TargetEnum, terminalTypeEnum } from "../../../types";
|
|
17
|
-
import { device
|
|
17
|
+
import { device } from "../../../util/index";
|
|
18
18
|
import CallApp from "../../../util/intl-callapp/es/main";
|
|
19
19
|
import { getComponentSign, parseSessionData } from "../index";
|
|
20
20
|
import { ELEMENT_ENVIRONMENT, EventCallbackCode } from "./type";
|
|
@@ -129,8 +129,7 @@ export function generateIframeSrc(_ref3) {
|
|
|
129
129
|
analytics = _ref3.analytics,
|
|
130
130
|
locale = _ref3.locale,
|
|
131
131
|
pageUrl = _ref3.pageUrl,
|
|
132
|
-
link = _ref3.link
|
|
133
|
-
mockOptions = _ref3.mockOptions;
|
|
132
|
+
link = _ref3.link;
|
|
134
133
|
var componentSign = getComponentSign(paymentSessionObj);
|
|
135
134
|
var productSceneVersion = (paymentSessionObj === null || paymentSessionObj === void 0 || (_paymentSessionObj$pa = paymentSessionObj.paymentSessionConfig) === null || _paymentSessionObj$pa === void 0 ? void 0 : _paymentSessionObj$pa.productSceneVersion) || '';
|
|
136
135
|
var productScene = (paymentSessionObj === null || paymentSessionObj === void 0 || (_paymentSessionObj$pa2 = paymentSessionObj.paymentSessionConfig) === null || _paymentSessionObj$pa2 === void 0 ? void 0 : _paymentSessionObj$pa2.productScene) || '';
|
|
@@ -155,20 +154,12 @@ export function generateIframeSrc(_ref3) {
|
|
|
155
154
|
instanceId: instanceId,
|
|
156
155
|
hostSign: hostSign,
|
|
157
156
|
mid: mid,
|
|
158
|
-
elementLink: link
|
|
159
|
-
// TODO Connect本地调试link
|
|
160
|
-
mockOptions: mockOptions
|
|
157
|
+
elementLink: link // TODO Connect本地调试link
|
|
161
158
|
}),
|
|
162
159
|
path = _getIframeUrl.path,
|
|
163
160
|
locationSearch = _getIframeUrl.locationSearch;
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
var finalPath = path;
|
|
167
|
-
if (mockOptions && mockOptions.useMock === true) {
|
|
168
|
-
finalPath = genProxyUrl(path, environment);
|
|
169
|
-
}
|
|
170
|
-
console.log('[debug] generateIframeSrc', finalPath, locationSearch);
|
|
171
|
-
return "".concat(finalPath, "?").concat(locationSearch);
|
|
161
|
+
console.log('[debug] generateIframeSrc', path, locationSearch);
|
|
162
|
+
return "".concat(path, "?").concat(locationSearch);
|
|
172
163
|
}
|
|
173
164
|
export function handleRedirect(data) {
|
|
174
165
|
var _data$isDestroy, _data$isCallApp, _data$callAppDetectSu;
|
|
@@ -22,7 +22,6 @@ import { getGrayscaleId } from "../utils/gray_scale_utils";
|
|
|
22
22
|
import { convertPaymentSession, getWebAppVersion, saveWebAppVersion } from "../utils/payment_context_utils";
|
|
23
23
|
import { redirect } from "../utils/redirect_utils";
|
|
24
24
|
import { parseWebAppMatchConfig } from "../utils/web_app_url_utils";
|
|
25
|
-
|
|
26
25
|
/**
|
|
27
26
|
* @author 谦彧 <zhangmian.zm@alipay.com>
|
|
28
27
|
* @date 2024/9/17
|
|
@@ -235,7 +234,7 @@ export var AntomSDKCore = /*#__PURE__*/function () {
|
|
|
235
234
|
|
|
236
235
|
// execute additional logic from specified product
|
|
237
236
|
if (this.productProcessors[sdkMetaData.productScene]) {
|
|
238
|
-
this.productProcessors[sdkMetaData.productScene].init(options, this.instanceId, sdkMetaData
|
|
237
|
+
this.productProcessors[sdkMetaData.productScene].init(options, this.instanceId, sdkMetaData);
|
|
239
238
|
}
|
|
240
239
|
}
|
|
241
240
|
}, {
|
|
@@ -20,10 +20,6 @@ export interface StartBizFlowOptions {
|
|
|
20
20
|
displayInfo?: Partial<DisplayInfo>;
|
|
21
21
|
submitPayRequestExtra?: any;
|
|
22
22
|
isAppWebview?: boolean;
|
|
23
|
-
mockOptions?: {
|
|
24
|
-
useMock: boolean;
|
|
25
|
-
mockUserId?: any;
|
|
26
|
-
};
|
|
27
23
|
isNativeAppWebview?: boolean;
|
|
28
24
|
}
|
|
29
25
|
export declare class DisplayInfo {
|
|
@@ -47,10 +43,7 @@ export declare class DisplayInfo {
|
|
|
47
43
|
* Such as: EasySafePay, PayPal in Cashier
|
|
48
44
|
*/
|
|
49
45
|
export interface ProductProcessor {
|
|
50
|
-
init(config: IoptionsParams, instanceId: string, sdkMetaData: SDKMetaData
|
|
51
|
-
useMock?: boolean;
|
|
52
|
-
mockUserId?: any;
|
|
53
|
-
}): any;
|
|
46
|
+
init(config: IoptionsParams, instanceId: string, sdkMetaData: SDKMetaData): any;
|
|
54
47
|
startBizFlow(paymentContext: PaymentContext): Promise<BizFlowStartBehavior>;
|
|
55
48
|
}
|
|
56
49
|
export interface BizFlowStartBehavior {
|
|
@@ -10,11 +10,7 @@ export declare class AutoDebitProcessor implements ProductProcessor {
|
|
|
10
10
|
private hostSign;
|
|
11
11
|
private _performanceData;
|
|
12
12
|
private SECURITY_SDK_INIT_TIMEOUT;
|
|
13
|
-
|
|
14
|
-
init(config: IoptionsParams, instanceId: string, sdkMetaData: SDKMetaData, mockOptions?: {
|
|
15
|
-
useMock?: boolean;
|
|
16
|
-
mockUserId?: any;
|
|
17
|
-
}): void;
|
|
13
|
+
init(config: IoptionsParams, instanceId: string, sdkMetaData: SDKMetaData): void;
|
|
18
14
|
startBizFlow(paymentContext: PaymentContext): Promise<BizFlowStartBehavior>;
|
|
19
15
|
private acquireApdidToken;
|
|
20
16
|
/**
|
|
@@ -36,14 +36,12 @@ export var AutoDebitProcessor = /*#__PURE__*/function () {
|
|
|
36
36
|
_defineProperty(this, "_performanceData", []);
|
|
37
37
|
// 安全SDK初始化超时时间
|
|
38
38
|
_defineProperty(this, "SECURITY_SDK_INIT_TIMEOUT", 1500);
|
|
39
|
-
_defineProperty(this, "mockOptions", void 0);
|
|
40
39
|
}
|
|
41
40
|
_createClass(AutoDebitProcessor, [{
|
|
42
41
|
key: "init",
|
|
43
|
-
value: function init(config, instanceId, sdkMetaData
|
|
42
|
+
value: function init(config, instanceId, sdkMetaData) {
|
|
44
43
|
this.initConfig = config;
|
|
45
44
|
this.instanceId = instanceId;
|
|
46
|
-
this.mockOptions = mockOptions;
|
|
47
45
|
this.logger = ServiceProvider.getInstance(this.instanceId).getService('Log');
|
|
48
46
|
this.eventCenter = ServiceProvider.getInstance(this.instanceId).getService('EventCenter');
|
|
49
47
|
this.securityService = ServiceProvider.getInstance(this.instanceId).getService('Security');
|
|
@@ -393,8 +391,7 @@ export var AutoDebitProcessor = /*#__PURE__*/function () {
|
|
|
393
391
|
hostSign: hostSign
|
|
394
392
|
},
|
|
395
393
|
mid: mid,
|
|
396
|
-
extendInfo: extendInfo
|
|
397
|
-
mockOptions: this.mockOptions
|
|
394
|
+
extendInfo: extendInfo
|
|
398
395
|
});
|
|
399
396
|
return webAppUrl;
|
|
400
397
|
// // 调试地址
|
|
@@ -13,10 +13,7 @@ export declare class EasySafePayProcessor implements ProductProcessor {
|
|
|
13
13
|
private SECURITY_SDK_INIT_TIMEOUT;
|
|
14
14
|
private SDK_REQUEST_TIMEOUT;
|
|
15
15
|
private LOAD_APP_RESOURCES_TIMEOUT;
|
|
16
|
-
init(config: IoptionsParams, instanceId: string, sdkMetaData: SDKMetaData
|
|
17
|
-
useMock?: boolean;
|
|
18
|
-
mockUserId?: any;
|
|
19
|
-
}): void;
|
|
16
|
+
init(config: IoptionsParams, instanceId: string, sdkMetaData: SDKMetaData): void;
|
|
20
17
|
startBizFlow(paymentContext: PaymentContext): Promise<BizFlowStartBehavior>;
|
|
21
18
|
private buildWebAppUrl;
|
|
22
19
|
private buildRedirectResult;
|
|
@@ -16,10 +16,10 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
16
16
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
17
17
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
18
18
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
19
|
-
import { getDoubleFaUrlFromSession } from "../../utils/web_app_url_utils";
|
|
20
19
|
import PreloadHelper from "../../../foundation/utils/preload_helper";
|
|
20
|
+
import { ChannelCustomize, DisplayTypeEnum, getBackScheme, isPC, PaymentMethodCategoryTypeEnum, ProductInfoCacheUtil, ProductSceneEnum, RiskSdkInfoEnum, ServiceProvider, uuid, WebAppUrlUtil, EVENT, eventCodeEnum } from "./deps";
|
|
21
21
|
import { isEmpty } from "../../../util";
|
|
22
|
-
import {
|
|
22
|
+
import { getDoubleFaUrlFromSession } from "../../utils/web_app_url_utils";
|
|
23
23
|
export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
24
24
|
function EasySafePayProcessor() {
|
|
25
25
|
_classCallCheck(this, EasySafePayProcessor);
|
|
@@ -41,7 +41,7 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
|
41
41
|
}
|
|
42
42
|
_createClass(EasySafePayProcessor, [{
|
|
43
43
|
key: "init",
|
|
44
|
-
value: function init(config, instanceId, sdkMetaData
|
|
44
|
+
value: function init(config, instanceId, sdkMetaData) {
|
|
45
45
|
this.initConfig = config;
|
|
46
46
|
this.instanceId = instanceId;
|
|
47
47
|
this.logger = ServiceProvider.getInstance(this.instanceId).getService('Log');
|
|
@@ -88,7 +88,6 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
|
88
88
|
case 12:
|
|
89
89
|
// 下面的场景是需要渲染UI的渠道, 打开WebUrl
|
|
90
90
|
webAppUrl = this.buildWebAppUrl();
|
|
91
|
-
console.log('object>>>>webAppUrl', webAppUrl);
|
|
92
91
|
resultPayload = {
|
|
93
92
|
url: webAppUrl,
|
|
94
93
|
allowClickPopupOutsideClose: (_this$channelBehavior = this.channelBehavior) === null || _this$channelBehavior === void 0 ? void 0 : _this$channelBehavior.allowClickOutsideClose
|
|
@@ -105,7 +104,7 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
|
105
104
|
behaviorType: 'RENDER',
|
|
106
105
|
payload: resultPayload
|
|
107
106
|
});
|
|
108
|
-
case
|
|
107
|
+
case 17:
|
|
109
108
|
case "end":
|
|
110
109
|
return _context.stop();
|
|
111
110
|
}
|
|
@@ -119,7 +118,7 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
|
119
118
|
}, {
|
|
120
119
|
key: "buildWebAppUrl",
|
|
121
120
|
value: function buildWebAppUrl() {
|
|
122
|
-
var _paymentContext$payme3, _paymentContext$payme4, _paymentContext$payme5,
|
|
121
|
+
var _paymentContext$payme3, _paymentContext$payme4, _paymentContext$payme5, _this$initConfig$anal;
|
|
123
122
|
var paymentContext = this.paymentContext;
|
|
124
123
|
var paymentMethodCategoryType = (_paymentContext$payme3 = paymentContext.paymentSessionObj.paymentSessionConfig) === null || _paymentContext$payme3 === void 0 ? void 0 : _paymentContext$payme3.paymentMethodCategoryType;
|
|
125
124
|
var productScene = (_paymentContext$payme4 = paymentContext.paymentSessionObj.paymentSessionConfig) === null || _paymentContext$payme4 === void 0 ? void 0 : _paymentContext$payme4.productScene;
|
|
@@ -127,7 +126,6 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
|
127
126
|
var hostSign = this.hostSign;
|
|
128
127
|
var mid = paymentContext.paymentSessionObj.clientId;
|
|
129
128
|
var extendInfo = paymentContext.paymentSessionObj.extendInfo;
|
|
130
|
-
var mockOptions = (_paymentContext$start2 = paymentContext.startBizFlowOptions) === null || _paymentContext$start2 === void 0 ? void 0 : _paymentContext$start2.mockOptions;
|
|
131
129
|
var webAppUrl = WebAppUrlUtil.getWebAppV2Url({
|
|
132
130
|
environment: this.initConfig.environment,
|
|
133
131
|
paymentMethodCategoryType: paymentMethodCategoryType,
|
|
@@ -143,8 +141,7 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
|
143
141
|
hostSign: hostSign
|
|
144
142
|
},
|
|
145
143
|
mid: mid,
|
|
146
|
-
extendInfo: extendInfo
|
|
147
|
-
mockOptions: mockOptions
|
|
144
|
+
extendInfo: extendInfo
|
|
148
145
|
});
|
|
149
146
|
return webAppUrl;
|
|
150
147
|
}
|
|
@@ -156,13 +153,15 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
|
156
153
|
data = {
|
|
157
154
|
url: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.authUrl,
|
|
158
155
|
schemeUrl: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.authUrl,
|
|
159
|
-
applinkUrl: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.authUrl
|
|
156
|
+
applinkUrl: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.authUrl,
|
|
157
|
+
openInApp: (authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.openInApp) || false
|
|
160
158
|
};
|
|
161
159
|
} else {
|
|
162
160
|
data = {
|
|
163
161
|
url: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.normalUrl,
|
|
164
162
|
schemeUrl: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.schemeUrl,
|
|
165
|
-
applinkUrl: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.applinkUrl
|
|
163
|
+
applinkUrl: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.applinkUrl,
|
|
164
|
+
openInApp: (authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.openInApp) || false
|
|
166
165
|
};
|
|
167
166
|
}
|
|
168
167
|
var result = {
|
|
@@ -234,26 +233,19 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
|
234
233
|
if (queryRes) {
|
|
235
234
|
data.queryResult = queryRes;
|
|
236
235
|
}
|
|
237
|
-
_this.logger.logInfo({
|
|
238
|
-
title: 'sdk_event_renderComponent'
|
|
239
|
-
});
|
|
240
236
|
_this.eventCenter.dispatchToApp({
|
|
241
237
|
event: 'renderComponent',
|
|
242
238
|
data: data
|
|
243
239
|
});
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
var message = error instanceof Error ? error.message : String(error);
|
|
247
|
-
(_this$logger$logError = (_this$logger = _this.logger).logError) === null || _this$logger$logError === void 0 || _this$logger$logError.call(_this$logger, {
|
|
248
|
-
title: 'sdk_event_webAppOnLaunch_failed'
|
|
249
|
-
}, {
|
|
250
|
-
errorMessage: message
|
|
240
|
+
_this.logger.logInfo({
|
|
241
|
+
title: 'sdk_event_renderComponent'
|
|
251
242
|
});
|
|
252
|
-
|
|
253
|
-
_this.eventCenter.emit(
|
|
254
|
-
|
|
243
|
+
}).catch(function (error) {
|
|
244
|
+
_this.eventCenter.emit(EVENT.destroy.name, {});
|
|
245
|
+
_this.eventCenter.emit(EVENT.eventCallback.name, {
|
|
246
|
+
code: eventCodeEnum.SDK_INTERNAL_ERROR,
|
|
255
247
|
result: {
|
|
256
|
-
message: message
|
|
248
|
+
message: error === null || error === void 0 ? void 0 : error.message
|
|
257
249
|
}
|
|
258
250
|
});
|
|
259
251
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BizFlowStartBehavior, ProductProcessor } from "../..";
|
|
2
2
|
declare class ElementProcessor implements ProductProcessor {
|
|
3
3
|
constructor();
|
|
4
|
-
init(config: any, instanceId: string
|
|
4
|
+
init(config: any, instanceId: string): any;
|
|
5
5
|
startBizFlow(): Promise<BizFlowStartBehavior>;
|
|
6
6
|
}
|
|
7
7
|
export { ElementProcessor };
|
|
@@ -10,7 +10,7 @@ var ElementProcessor = /*#__PURE__*/function () {
|
|
|
10
10
|
}
|
|
11
11
|
_createClass(ElementProcessor, [{
|
|
12
12
|
key: "init",
|
|
13
|
-
value: function init(config, instanceId
|
|
13
|
+
value: function init(config, instanceId) {
|
|
14
14
|
return null;
|
|
15
15
|
}
|
|
16
16
|
// TODO 定义返回类型和实际类型不一致
|
|
@@ -7,7 +7,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
7
7
|
import { marmotMap, sdkVersion, v2AppMarmotMap } from "../../config";
|
|
8
8
|
import { ESP_PAGE_NAME } from "../../constant/easysafepay";
|
|
9
9
|
import { ComponentSignEnum, ProductSceneEnum } from "../../types";
|
|
10
|
-
import {
|
|
10
|
+
import { queryParse, serialize } from "../../util";
|
|
11
11
|
import { isDebugLog } from "../../util/debug";
|
|
12
12
|
import { compareVersion } from "../../util/versionCompare";
|
|
13
13
|
|
|
@@ -39,11 +39,10 @@ export var getWebAppUrlInfo = function getWebAppUrlInfo(params) {
|
|
|
39
39
|
_queryParse$groupId = _queryParse.groupId,
|
|
40
40
|
groupId = _queryParse$groupId === void 0 ? '' : _queryParse$groupId,
|
|
41
41
|
LOCAL_MOCK = _queryParse.LOCAL_MOCK,
|
|
42
|
-
_displayType = _queryParse._displayType
|
|
43
|
-
__DEBUG_TOKEN__ = _queryParse.__DEBUG_TOKEN__;
|
|
42
|
+
_displayType = _queryParse._displayType;
|
|
44
43
|
var urlParams = {};
|
|
45
|
-
for (var
|
|
46
|
-
urlParams[
|
|
44
|
+
for (var key in query) {
|
|
45
|
+
urlParams[key] = '' + query[key];
|
|
47
46
|
}
|
|
48
47
|
// 如果是preload模式,添加一个preload的query参数
|
|
49
48
|
if (isPreload) {
|
|
@@ -59,7 +58,6 @@ export var getWebAppUrlInfo = function getWebAppUrlInfo(params) {
|
|
|
59
58
|
if (environment === 'light_sandbox' || _light_sandbox === 'true') urlParams.sandbox = 'true';
|
|
60
59
|
if (environment === 'sandbox' || _sandbox === 'true') urlParams.shadow = 'true';
|
|
61
60
|
if (_displayType) urlParams.displayType = _displayType;
|
|
62
|
-
if (__DEBUG_TOKEN__) urlParams.__DEBUG_TOKEN__ = __DEBUG_TOKEN__;
|
|
63
61
|
var locationSearch = serialize(urlParams);
|
|
64
62
|
if (isDebugLog()) {
|
|
65
63
|
console.log('appUpgrade#getIframeUrl#appMatched', urlParams.appMatched);
|
|
@@ -75,8 +73,7 @@ export var getWebAppV2Url = function getWebAppV2Url(params) {
|
|
|
75
73
|
isPreload = params.isPreload,
|
|
76
74
|
mid = params.mid,
|
|
77
75
|
extendInfo = params.extendInfo,
|
|
78
|
-
environment = params.environment
|
|
79
|
-
mockOptions = params.mockOptions;
|
|
76
|
+
environment = params.environment;
|
|
80
77
|
var webAppUrlMatchConfig = parseWebAppUrlMatchConfig(extendInfo);
|
|
81
78
|
var v2Url = isPreload ? getLocalCheckoutUrl(productScene, environment) : getMatchedWebAppV2Url(productScene, mid, webAppUrlMatchConfig, environment);
|
|
82
79
|
var info = getWebAppUrlInfo(_objectSpread(_objectSpread({}, params), {}, {
|
|
@@ -87,14 +84,10 @@ export var getWebAppV2Url = function getWebAppV2Url(params) {
|
|
|
87
84
|
saveLocalCheckoutUrl(productScene, info.path);
|
|
88
85
|
}
|
|
89
86
|
var webAppUrl;
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
path = genProxyUrl(info.path, environment);
|
|
93
|
-
}
|
|
94
|
-
if (path.indexOf('?') !== -1) {
|
|
95
|
-
webAppUrl = "".concat(path, "&").concat(info.locationSearch);
|
|
87
|
+
if (info.path.indexOf('?') !== -1) {
|
|
88
|
+
webAppUrl = "".concat(info.path, "&").concat(info.locationSearch);
|
|
96
89
|
} else {
|
|
97
|
-
webAppUrl = "".concat(path, "?").concat(info.locationSearch);
|
|
90
|
+
webAppUrl = "".concat(info.path, "?").concat(info.locationSearch);
|
|
98
91
|
}
|
|
99
92
|
console.log('[web-sdk] web app, url: ', webAppUrl);
|
|
100
93
|
return webAppUrl;
|
package/esm/index.js
CHANGED