@alipay/ams-checkout 1.24.0 → 1.25.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/component/channel.d.ts +19 -0
- package/esm/component/channel.js +87 -0
- package/esm/component/component.inline.style.d.ts +10 -0
- package/esm/component/component.inline.style.js +121 -0
- package/esm/component/component.popup.style.d.ts +23 -0
- package/esm/component/component.popup.style.js +190 -0
- package/esm/component/popupWindow.style.d.ts +11 -0
- package/esm/component/popupWindow.style.js +121 -0
- package/esm/config/index.d.ts +7 -7
- package/esm/config/index.js +7 -7
- package/esm/constant/index.d.ts +3 -5
- package/esm/constant/index.js +4 -78
- package/esm/core/bus/interface.d.ts +0 -12
- package/esm/core/bus/interface.js +2 -16
- package/esm/core/component/address.d.ts +2 -2
- package/esm/core/component/appPreloadProcessing.js +0 -2
- package/esm/core/component/ckp/index.d.ts +3 -3
- package/esm/core/component/element/components/address.js +1 -1
- package/esm/core/component/element/components/auth.d.ts +1 -1
- package/esm/core/component/element/components/payment.js +1 -1
- package/esm/core/component/element/index.js +19 -19
- package/esm/core/component/element/type.d.ts +6 -0
- package/esm/core/component/index.d.ts +2 -2
- package/esm/core/component/index.js +2 -6
- package/esm/core/drop-in/index.d.ts +2 -2
- package/esm/core/instance/index.d.ts +5 -5
- package/esm/core/instance/index.js +1 -2
- package/esm/foundation/core/index.d.ts +5 -5
- package/esm/foundation/core/index.js +117 -52
- package/esm/foundation/index.d.ts +10 -7
- package/esm/foundation/product-processor/easysafepay/deps.d.ts +8 -5
- package/esm/foundation/product-processor/easysafepay/deps.js +5 -2
- package/esm/foundation/product-processor/easysafepay/index.d.ts +6 -6
- package/esm/foundation/product-processor/easysafepay/index.js +192 -265
- package/esm/foundation/service/{event-bus → api-bus}/ability/callback.js +1 -1
- package/esm/foundation/service/{event-bus → api-bus}/ability/globalData.d.ts +1 -1
- package/esm/{core/bus → foundation/service/api-bus}/ability/globalData.js +2 -2
- package/esm/{core/bus → foundation/service/api-bus}/ability/request.d.ts +1 -1
- package/esm/{core/bus → foundation/service/api-bus}/ability/request.js +2 -2
- package/esm/foundation/service/{event-bus → api-bus}/ability/security.js +29 -19
- package/esm/foundation/service/{event-bus → api-bus}/ability/tracker.js +1 -1
- package/esm/foundation/service/{event-bus → api-bus}/busManager.js +1 -1
- package/esm/foundation/service/{event-bus → api-bus}/index.d.ts +2 -2
- package/esm/foundation/service/api-bus/interface.d.ts +48 -0
- package/esm/foundation/service/api-bus/interface.js +54 -0
- package/esm/foundation/service/container/index.d.ts +4 -2
- package/esm/foundation/service/container/index.js +47 -5
- package/esm/foundation/service/container/popup.js +1 -1
- package/esm/foundation/service/event-center.d.ts +6 -5
- package/esm/foundation/service/event-center.js +16 -17
- package/esm/foundation/service/global-data/index.d.ts +2 -2
- package/esm/foundation/service/global-data/index.js +4 -5
- package/esm/foundation/service/index.d.ts +2 -2
- package/esm/foundation/service/index.js +1 -1
- package/esm/foundation/service/log/index.d.ts +2 -2
- package/esm/foundation/service/log/index.js +1 -1
- package/esm/foundation/service/requester/deps.d.ts +1 -1
- package/esm/foundation/service/requester/requester.d.ts +2 -2
- package/esm/foundation/service/requester/requester.js +14 -11
- package/esm/foundation/service/security/index.d.ts +11 -9
- package/esm/foundation/service/security/index.js +114 -44
- package/esm/foundation/utils/payment_product_utils.d.ts +13 -0
- package/esm/foundation/utils/payment_product_utils.js +38 -0
- package/esm/foundation/utils/redirect_utils.d.ts +5 -0
- package/esm/foundation/utils/redirect_utils.js +209 -45
- package/esm/foundation/utils/system_events.js +0 -5
- package/esm/foundation/utils/web_app_url_utils.d.ts +11 -2
- package/esm/foundation/utils/web_app_url_utils.js +18 -3
- package/esm/index.d.ts +12 -12
- package/esm/index.js +31 -31
- package/esm/plugin/component/cashierApp.d.ts +3 -3
- package/esm/plugin/component/cashierApp.js +9 -10
- package/esm/plugin/component/component.inline.style.d.ts +1 -1
- package/esm/plugin/component/component.inline.style.js +2 -3
- package/esm/plugin/component/component.popup.style.d.ts +1 -10
- package/esm/plugin/component/component.popup.style.js +10 -28
- package/esm/plugin/component/index.d.ts +1 -1
- package/esm/plugin/component/index.js +64 -62
- package/esm/plugin/payment-element/utils.d.ts +1 -1
- package/esm/plugin/payment-element/utils.js +1 -2
- package/esm/plugin/type.d.ts +1 -1
- package/esm/types/index.d.ts +17 -11
- package/esm/types/index.js +7 -1
- package/esm/util/getBackScheme.js +95 -3
- package/esm/util/index.d.ts +1 -1
- package/esm/util/index.js +4 -3
- package/esm/util/security.d.ts +33 -0
- package/esm/{foundation/service/event-bus/ability/request.js → util/security.js} +153 -122
- package/package.json +1 -1
- package/esm/core/bus/ability/globalData.d.ts +0 -10
- package/esm/foundation/service/event-bus/ability/globalData.js +0 -89
- package/esm/foundation/service/event-bus/ability/request.d.ts +0 -10
- package/esm/foundation/types/index.d.ts +0 -4
- package/esm/foundation/types/index.js +0 -4
- package/esm/util/ua/index.d.ts +0 -2
- package/esm/util/ua/index.js +0 -2
- package/esm/util/ua/isAndroid.d.ts +0 -4
- package/esm/util/ua/isAndroid.js +0 -7
- package/esm/util/ua/isIOS.d.ts +0 -4
- package/esm/util/ua/isIOS.js +0 -7
- /package/esm/foundation/service/{event-bus → api-bus}/ability/callback.d.ts +0 -0
- /package/esm/foundation/service/{event-bus → api-bus}/ability/security.d.ts +0 -0
- /package/esm/foundation/service/{event-bus → api-bus}/ability/tracker.d.ts +0 -0
- /package/esm/foundation/service/{event-bus → api-bus}/busManager.d.ts +0 -0
- /package/esm/foundation/service/{event-bus → api-bus}/index.js +0 -0
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { IoptionsParams, PaymentContext, RequestConfig, SDKMetaData, Service } from './deps';
|
2
2
|
/**
|
3
3
|
* @author congle.zzq <congle.zzq@alipay.com>
|
4
4
|
* @date 2024/9/18
|
@@ -6,7 +6,7 @@ import { IOptionsParams, PaymentContext, RequestConfig, SDKMetaData, Service } f
|
|
6
6
|
export declare class RequesterService implements Service {
|
7
7
|
private sandboxFlag?;
|
8
8
|
private instanceId;
|
9
|
-
init(initOptions:
|
9
|
+
init(initOptions: IoptionsParams, instanceId: string, sdkMetaData: SDKMetaData): void;
|
10
10
|
/**
|
11
11
|
*
|
12
12
|
* @param requestData 请求参数
|
@@ -46,7 +46,7 @@ export var RequesterService = /*#__PURE__*/function () {
|
|
46
46
|
key: "request",
|
47
47
|
value: (function () {
|
48
48
|
var _request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(requestData, options) {
|
49
|
-
var envInfo, _data, startTime, myRequest, _yield$myRequest, data, headers, resData,
|
49
|
+
var envInfo, _data, startTime, traceId, myRequest, _yield$myRequest, data, headers, resData, handleGetWayError, errorMessage, errorCode, _error$message, _error, timeoutCode, _errorCode;
|
50
50
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
51
51
|
while (1) switch (_context.prev = _context.next) {
|
52
52
|
case 0:
|
@@ -58,13 +58,14 @@ export var RequesterService = /*#__PURE__*/function () {
|
|
58
58
|
})
|
59
59
|
})];
|
60
60
|
startTime = Date.now();
|
61
|
-
|
61
|
+
traceId = '';
|
62
|
+
_context.prev = 4;
|
62
63
|
myRequest = this.createRequestInstance(options);
|
63
|
-
_context.next =
|
64
|
+
_context.next = 8;
|
64
65
|
return myRequest({
|
65
66
|
data: _data
|
66
67
|
});
|
67
|
-
case
|
68
|
+
case 8:
|
68
69
|
_yield$myRequest = _context.sent;
|
69
70
|
data = _yield$myRequest.data;
|
70
71
|
headers = _yield$myRequest.headers;
|
@@ -73,7 +74,7 @@ export var RequesterService = /*#__PURE__*/function () {
|
|
73
74
|
resData.traceId = traceId || '';
|
74
75
|
handleGetWayError = fomatGetwayError(headers, traceId);
|
75
76
|
if (!(handleGetWayError !== null && handleGetWayError !== void 0 && handleGetWayError.errorCode)) {
|
76
|
-
_context.next =
|
77
|
+
_context.next = 20;
|
77
78
|
break;
|
78
79
|
}
|
79
80
|
errorMessage = (resData === null || resData === void 0 ? void 0 : resData.errorMessage) || (handleGetWayError === null || handleGetWayError === void 0 ? void 0 : handleGetWayError.errorMessage);
|
@@ -92,7 +93,7 @@ export var RequesterService = /*#__PURE__*/function () {
|
|
92
93
|
errorCode: errorCode,
|
93
94
|
success: false
|
94
95
|
}));
|
95
|
-
case
|
96
|
+
case 20:
|
96
97
|
this.reportRequestTimeCost({
|
97
98
|
name: options === null || options === void 0 ? void 0 : options['Operation-Type'],
|
98
99
|
label: 'request',
|
@@ -103,12 +104,13 @@ export var RequesterService = /*#__PURE__*/function () {
|
|
103
104
|
traceId: traceId
|
104
105
|
});
|
105
106
|
return _context.abrupt("return", resData);
|
106
|
-
case
|
107
|
-
_context.prev =
|
108
|
-
_context.t0 = _context["catch"](
|
107
|
+
case 24:
|
108
|
+
_context.prev = 24;
|
109
|
+
_context.t0 = _context["catch"](4);
|
109
110
|
_error = safeJson(_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message, {
|
110
111
|
success: false,
|
111
112
|
errorCode: errorEnum.SYSTEM,
|
113
|
+
traceId: traceId,
|
112
114
|
errorMessage: _context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message
|
113
115
|
});
|
114
116
|
timeoutCode = _context.t0 !== null && _context.t0 !== void 0 && (_error$message = _context.t0.message) !== null && _error$message !== void 0 && _error$message.includes('timeout') ? errorEnum.TIMEOUT : '';
|
@@ -124,13 +126,14 @@ export var RequesterService = /*#__PURE__*/function () {
|
|
124
126
|
return _context.abrupt("return", Promise.reject({
|
125
127
|
success: false,
|
126
128
|
errorCode: _errorCode,
|
129
|
+
traceId: traceId,
|
127
130
|
errorMessage: _error === null || _error === void 0 ? void 0 : _error.message
|
128
131
|
}));
|
129
|
-
case
|
132
|
+
case 31:
|
130
133
|
case "end":
|
131
134
|
return _context.stop();
|
132
135
|
}
|
133
|
-
}, _callee, this, [[
|
136
|
+
}, _callee, this, [[4, 24]]);
|
134
137
|
}));
|
135
138
|
function request(_x, _x2) {
|
136
139
|
return _request.apply(this, arguments);
|
@@ -1,26 +1,28 @@
|
|
1
|
-
import { DeviceIdParameter,
|
1
|
+
import { DeviceIdParameter, IoptionsParams } from '../../../types';
|
2
2
|
import { PaymentContext, SDKMetaData, Service } from '../../index';
|
3
3
|
import { Security } from './security';
|
4
4
|
export declare class SecurityService implements Service {
|
5
5
|
private logger;
|
6
6
|
private productScene;
|
7
7
|
static securitySdkMap: Map<string, Security>;
|
8
|
-
init(initOptions:
|
8
|
+
init(initOptions: IoptionsParams, instanceId: string, sdkMetaData: SDKMetaData): void;
|
9
9
|
update(paymentContext: PaymentContext): void;
|
10
10
|
destroy(): void;
|
11
11
|
getDeviceId(deviceIdParameter?: DeviceIdParameter, isPolling?: boolean): Promise<string>;
|
12
|
-
|
12
|
+
preInitSecurity(timeout?: number): Promise<void>;
|
13
|
+
initSecurity(timeout?: number): Promise<void>;
|
14
|
+
private _initSecurity;
|
13
15
|
private logDeviceId;
|
14
16
|
/**
|
15
|
-
|
16
|
-
|
17
|
+
* @description Obtain security SDK through scenario identification
|
18
|
+
*/
|
17
19
|
private _getSecuritySDKByProductScene;
|
18
20
|
/**
|
19
|
-
|
20
|
-
|
21
|
+
* @description New security SDK through scenario identification
|
22
|
+
*/
|
21
23
|
private _newSecuritySDKByScene;
|
22
24
|
/**
|
23
|
-
|
24
|
-
|
25
|
+
* @description Obtain risk control configuration in local storage
|
26
|
+
*/
|
25
27
|
private _getSecurityConfigStorage;
|
26
28
|
}
|
@@ -23,13 +23,10 @@ export var SecurityService = /*#__PURE__*/function () {
|
|
23
23
|
value: function init(initOptions, instanceId, sdkMetaData) {
|
24
24
|
this.logger = ServiceProvider.getInstance(instanceId).getService('Log');
|
25
25
|
this.productScene = sdkMetaData.productScene;
|
26
|
-
this.initSecurity(true);
|
27
26
|
}
|
28
27
|
}, {
|
29
28
|
key: "update",
|
30
|
-
value: function update(paymentContext) {
|
31
|
-
this.initSecurity(false);
|
32
|
-
}
|
29
|
+
value: function update(paymentContext) {}
|
33
30
|
}, {
|
34
31
|
key: "destroy",
|
35
32
|
value: function destroy() {}
|
@@ -100,42 +97,116 @@ export var SecurityService = /*#__PURE__*/function () {
|
|
100
97
|
}
|
101
98
|
return getDeviceId;
|
102
99
|
}()
|
100
|
+
}, {
|
101
|
+
key: "preInitSecurity",
|
102
|
+
value: function () {
|
103
|
+
var _preInitSecurity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(timeout) {
|
104
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
105
|
+
while (1) switch (_context3.prev = _context3.next) {
|
106
|
+
case 0:
|
107
|
+
_context3.next = 2;
|
108
|
+
return this._initSecurity(true, timeout);
|
109
|
+
case 2:
|
110
|
+
case "end":
|
111
|
+
return _context3.stop();
|
112
|
+
}
|
113
|
+
}, _callee3, this);
|
114
|
+
}));
|
115
|
+
function preInitSecurity(_x) {
|
116
|
+
return _preInitSecurity.apply(this, arguments);
|
117
|
+
}
|
118
|
+
return preInitSecurity;
|
119
|
+
}()
|
103
120
|
}, {
|
104
121
|
key: "initSecurity",
|
105
|
-
value: function
|
106
|
-
var
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
122
|
+
value: function () {
|
123
|
+
var _initSecurity2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(timeout) {
|
124
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
125
|
+
while (1) switch (_context4.prev = _context4.next) {
|
126
|
+
case 0:
|
127
|
+
_context4.next = 2;
|
128
|
+
return this._initSecurity(false, timeout);
|
129
|
+
case 2:
|
130
|
+
case "end":
|
131
|
+
return _context4.stop();
|
132
|
+
}
|
133
|
+
}, _callee4, this);
|
134
|
+
}));
|
135
|
+
function initSecurity(_x2) {
|
136
|
+
return _initSecurity2.apply(this, arguments);
|
114
137
|
}
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
138
|
+
return initSecurity;
|
139
|
+
}()
|
140
|
+
}, {
|
141
|
+
key: "_initSecurity",
|
142
|
+
value: function () {
|
143
|
+
var _initSecurity3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
144
|
+
var _this2 = this;
|
145
|
+
var isPre,
|
146
|
+
timeout,
|
147
|
+
sdkAction,
|
148
|
+
_args5 = arguments;
|
149
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
150
|
+
while (1) switch (_context5.prev = _context5.next) {
|
151
|
+
case 0:
|
152
|
+
isPre = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : false;
|
153
|
+
timeout = _args5.length > 1 ? _args5[1] : undefined;
|
154
|
+
sdkAction = isPre ? 'PreInit' : 'Init';
|
155
|
+
if (!this._getSecuritySDKByProductScene({
|
156
|
+
product: this.productScene
|
157
|
+
})) {
|
158
|
+
_context5.next = 5;
|
159
|
+
break;
|
160
|
+
}
|
161
|
+
return _context5.abrupt("return", Promise.resolve());
|
162
|
+
case 5:
|
163
|
+
this.logger.logInfo({
|
164
|
+
title: "sdk_event_securitySdk".concat(sdkAction)
|
165
|
+
});
|
166
|
+
return _context5.abrupt("return", new Promise(function (resolve, reject) {
|
167
|
+
if (timeout) {
|
168
|
+
setTimeout(function () {
|
169
|
+
_this2.logger.logError({
|
170
|
+
title: 'sdk_error_securitySdkInitTimeout'
|
171
|
+
}, {
|
172
|
+
product: _this2.productScene,
|
173
|
+
sign: isPre ? 'Active initialization' : 'SDK internal initialization'
|
174
|
+
}).send();
|
175
|
+
reject();
|
176
|
+
}, timeout);
|
177
|
+
}
|
178
|
+
_this2._newSecuritySDKByScene({
|
179
|
+
product: _this2.productScene,
|
180
|
+
region: isPre ? SecurityRegionEnum.SG : undefined
|
181
|
+
}, function () {
|
182
|
+
_this2.logger.logInfo({
|
183
|
+
title: "sdk_event_securitySdk".concat(sdkAction, "Success")
|
184
|
+
}, isPre ? {
|
185
|
+
product: _this2.productScene
|
186
|
+
} : undefined).send();
|
187
|
+
resolve();
|
188
|
+
}, function (msg) {
|
189
|
+
_this2.logger.logError({
|
190
|
+
title: 'sdk_error_securitySdkInitFailed',
|
191
|
+
msg: msg || undefined
|
192
|
+
}, {
|
193
|
+
product: _this2.productScene,
|
194
|
+
sign: isPre ? 'Active initialization' : 'SDK internal initialization'
|
195
|
+
}).send();
|
196
|
+
reject();
|
197
|
+
});
|
198
|
+
}));
|
199
|
+
case 7:
|
200
|
+
case "end":
|
201
|
+
return _context5.stop();
|
202
|
+
}
|
203
|
+
}, _callee5, this);
|
204
|
+
}));
|
205
|
+
function _initSecurity() {
|
206
|
+
return _initSecurity3.apply(this, arguments);
|
207
|
+
}
|
208
|
+
return _initSecurity;
|
209
|
+
}()
|
139
210
|
}, {
|
140
211
|
key: "logDeviceId",
|
141
212
|
value: function logDeviceId(deviceId, getDeviceIdStartTime) {
|
@@ -158,8 +229,8 @@ export var SecurityService = /*#__PURE__*/function () {
|
|
158
229
|
}
|
159
230
|
|
160
231
|
/**
|
161
|
-
|
162
|
-
|
232
|
+
* @description Obtain security SDK through scenario identification
|
233
|
+
*/
|
163
234
|
}, {
|
164
235
|
key: "_getSecuritySDKByProductScene",
|
165
236
|
value: function _getSecuritySDKByProductScene(securityConfig) {
|
@@ -170,8 +241,8 @@ export var SecurityService = /*#__PURE__*/function () {
|
|
170
241
|
}
|
171
242
|
|
172
243
|
/**
|
173
|
-
|
174
|
-
|
244
|
+
* @description New security SDK through scenario identification
|
245
|
+
*/
|
175
246
|
}, {
|
176
247
|
key: "_newSecuritySDKByScene",
|
177
248
|
value: function _newSecuritySDKByScene(securityConfig, successCallback, failCallback) {
|
@@ -185,15 +256,14 @@ export var SecurityService = /*#__PURE__*/function () {
|
|
185
256
|
});
|
186
257
|
SecurityService.securitySdkMap.set(scene, securitySdk);
|
187
258
|
securitySdk.initSecurity(successCallback, failCallback);
|
188
|
-
return securitySdk;
|
189
259
|
} catch (error) {
|
190
260
|
failCallback && failCallback(error === null || error === void 0 ? void 0 : error.toString());
|
191
261
|
}
|
192
262
|
}
|
193
263
|
|
194
264
|
/**
|
195
|
-
|
196
|
-
|
265
|
+
* @description Obtain risk control configuration in local storage
|
266
|
+
*/
|
197
267
|
}, {
|
198
268
|
key: "_getSecurityConfigStorage",
|
199
269
|
value: function _getSecurityConfigStorage(product) {
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { ProductSceneEnum } from "../../types";
|
2
|
+
export declare class ProductInfoCacheUtil {
|
3
|
+
static savePreviousProductInfo(productScene: ProductSceneEnum, info: {
|
4
|
+
productSceneVersion: string;
|
5
|
+
paymentMethodCategoryType: string;
|
6
|
+
hostSign: string;
|
7
|
+
}): void;
|
8
|
+
static getPreviousProductInfo(productScene: ProductSceneEnum, onError: (msg: string) => void): {
|
9
|
+
productSceneVersion: string;
|
10
|
+
paymentMethodCategoryType: string;
|
11
|
+
hostSign: string;
|
12
|
+
} | null;
|
13
|
+
}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
2
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
3
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
4
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
6
|
+
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); }
|
7
|
+
var KEY_PREVIOUS_PRODUCT_INFO = 'antom_checkout_previous_ProductInfo_';
|
8
|
+
export var ProductInfoCacheUtil = /*#__PURE__*/function () {
|
9
|
+
function ProductInfoCacheUtil() {
|
10
|
+
_classCallCheck(this, ProductInfoCacheUtil);
|
11
|
+
}
|
12
|
+
_createClass(ProductInfoCacheUtil, null, [{
|
13
|
+
key: "savePreviousProductInfo",
|
14
|
+
value: function savePreviousProductInfo(productScene, info) {
|
15
|
+
var key = KEY_PREVIOUS_PRODUCT_INFO + '_' + productScene;
|
16
|
+
localStorage.setItem(key, JSON.stringify({
|
17
|
+
productSceneVersion: info.productSceneVersion,
|
18
|
+
paymentMethodCategoryType: info.paymentMethodCategoryType,
|
19
|
+
hostSign: info.hostSign
|
20
|
+
}));
|
21
|
+
}
|
22
|
+
}, {
|
23
|
+
key: "getPreviousProductInfo",
|
24
|
+
value: function getPreviousProductInfo(productScene, onError) {
|
25
|
+
var key = KEY_PREVIOUS_PRODUCT_INFO + '_' + productScene;
|
26
|
+
var previousProductInfoString = localStorage.getItem(key);
|
27
|
+
if (previousProductInfoString) {
|
28
|
+
try {
|
29
|
+
return JSON.parse(previousProductInfoString);
|
30
|
+
} catch (error) {
|
31
|
+
onError(error === null || error === void 0 ? void 0 : error.message);
|
32
|
+
}
|
33
|
+
}
|
34
|
+
return null;
|
35
|
+
}
|
36
|
+
}]);
|
37
|
+
return ProductInfoCacheUtil;
|
38
|
+
}();
|
@@ -1,6 +1,11 @@
|
|
1
1
|
import { RedirectBehaviorPayload } from '../index';
|
2
|
+
import { LogService } from '../service/log';
|
2
3
|
/**
|
3
4
|
* @author 谦彧 <zhangmian.zm@alipay.com>
|
4
5
|
* @date 2024/9/19
|
5
6
|
*/
|
6
7
|
export declare const redirect: (payload: RedirectBehaviorPayload, instanceId: string) => void;
|
8
|
+
/**
|
9
|
+
* 通过配置规则检测 UA 和获得回跳 scheme
|
10
|
+
*/
|
11
|
+
export declare function getBackScheme(mockUa?: string, logger?: LogService): any;
|