@alipay/ams-checkout 0.0.1745808793-dev.0 → 0.0.1745808793-dev.10
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 +3 -1
- package/esm/component/channel.js +24 -42
- package/esm/config/index.d.ts +8 -8
- package/esm/config/index.js +8 -8
- package/esm/constant/easysafepay.d.ts +16 -0
- package/esm/constant/easysafepay.js +19 -0
- package/esm/constant/index.d.ts +4 -0
- package/esm/constant/index.js +4 -0
- package/esm/core/component/element/elementContainerService/containerService.js +2 -2
- package/esm/core/component/element/elementController/index.js +15 -9
- package/esm/core/component/element/elementProcessor/baseElementProcessor.d.ts +3 -0
- package/esm/core/component/element/elementProcessor/baseElementProcessor.js +11 -0
- package/esm/core/component/element/elementProcessor/paymentProcessor.js +15 -8
- package/esm/core/component/element/index.js +6 -1
- package/esm/core/component/element/util.d.ts +6 -0
- package/esm/core/component/element/util.js +27 -0
- package/esm/core/instance/index.d.ts +1 -1
- package/esm/foundation/core/index.d.ts +3 -0
- package/esm/foundation/core/index.js +81 -29
- package/esm/foundation/index.d.ts +6 -0
- package/esm/foundation/product-processor/easysafepay/deps.d.ts +1 -1
- package/esm/foundation/product-processor/easysafepay/index.d.ts +2 -0
- package/esm/foundation/product-processor/easysafepay/index.js +234 -120
- package/esm/foundation/service/container/index.d.ts +1 -0
- package/esm/foundation/service/container/index.js +20 -2
- package/esm/foundation/utils/preload_helper.d.ts +2 -2
- package/esm/foundation/utils/preload_helper.js +8 -4
- package/esm/foundation/utils/web_app_url_utils.d.ts +71 -1
- package/esm/foundation/utils/web_app_url_utils.js +215 -8
- package/esm/index.js +1 -1
- package/esm/plugin/component/cashierApp.js +4 -4
- package/esm/plugin/component/channel.d.ts +3 -1
- package/esm/plugin/component/channel.js +10 -12
- package/esm/plugin/component/index.js +45 -42
- package/esm/plugin/type.d.ts +1 -1
- package/esm/types/index.d.ts +17 -0
- package/esm/types/index.js +6 -0
- package/package.json +3 -2
@@ -15,14 +15,13 @@ import { cleanMockup, createMockup, createRetentionPopup, handleDeclareInfo, hid
|
|
15
15
|
import { insertStyleSheet } from "../../component/popupWindow.style";
|
16
16
|
import { sdkVersion } from "../../config";
|
17
17
|
import { COMPONENT_CLOSE_MASK_BLOCK_ID, EVENT, LOADING_ID } from "../../constant";
|
18
|
-
import { DisplayTypeEnum, eventCodeEnum } from "../../types";
|
18
|
+
import { DisplayTypeEnum, eventCodeEnum, EventLoggingEventId } from "../../types";
|
19
19
|
import { DisplayInfo, IElementStatus } from "../index";
|
20
20
|
import { ServiceProvider } from "../service";
|
21
21
|
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
|
@@ -37,8 +36,11 @@ export var AntomSDKCore = /*#__PURE__*/function () {
|
|
37
36
|
_defineProperty(this, "sdkMetaData", void 0);
|
38
37
|
_defineProperty(this, "productProcessors", {});
|
39
38
|
_defineProperty(this, "enablePopWindowEventCallback", false);
|
39
|
+
_defineProperty(this, "eventLogging", void 0);
|
40
40
|
_defineProperty(this, "status", IElementStatus.UNINIT);
|
41
|
+
_defineProperty(this, "logger", void 0);
|
41
42
|
this.status = IElementStatus.INITING;
|
43
|
+
this.logger = ServiceProvider.getInstance(this.instanceId).getService('Log');
|
42
44
|
}
|
43
45
|
_createClass(AntomSDKCore, [{
|
44
46
|
key: "getStatus",
|
@@ -178,6 +180,29 @@ export var AntomSDKCore = /*#__PURE__*/function () {
|
|
178
180
|
return _ref2.apply(this, arguments);
|
179
181
|
};
|
180
182
|
}());
|
183
|
+
eventCenter.listen(EVENT.getSdkVersion.name, /*#__PURE__*/function () {
|
184
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(data, payload) {
|
185
|
+
var _payload$context3;
|
186
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
187
|
+
while (1) switch (_context3.prev = _context3.next) {
|
188
|
+
case 0:
|
189
|
+
eventCenter.dispatchToApp({
|
190
|
+
event: 'appEventCallback',
|
191
|
+
eventCallbackId: (_payload$context3 = payload.context) === null || _payload$context3 === void 0 ? void 0 : _payload$context3.eventCallbackId,
|
192
|
+
data: {
|
193
|
+
version: sdkMetaData === null || sdkMetaData === void 0 ? void 0 : sdkMetaData.sdkVersion
|
194
|
+
}
|
195
|
+
});
|
196
|
+
case 1:
|
197
|
+
case "end":
|
198
|
+
return _context3.stop();
|
199
|
+
}
|
200
|
+
}, _callee3);
|
201
|
+
}));
|
202
|
+
return function (_x5, _x6) {
|
203
|
+
return _ref3.apply(this, arguments);
|
204
|
+
};
|
205
|
+
}());
|
181
206
|
eventCenter.listen(EVENT.destroy.name, function (data) {
|
182
207
|
_this.setStatus(IElementStatus.READY);
|
183
208
|
_this.destroy();
|
@@ -197,6 +222,7 @@ export var AntomSDKCore = /*#__PURE__*/function () {
|
|
197
222
|
eventCenter.listen(EVENT.declareEventCallbackInfo.name, function (data) {
|
198
223
|
if (data !== null && data !== void 0 && data.popWindowEventInfo) {
|
199
224
|
_this.enablePopWindowEventCallback = data.popWindowEventInfo.enableCallback;
|
225
|
+
_this.eventLogging = data.eventLogging;
|
200
226
|
}
|
201
227
|
});
|
202
228
|
|
@@ -208,14 +234,14 @@ export var AntomSDKCore = /*#__PURE__*/function () {
|
|
208
234
|
}, {
|
209
235
|
key: "startBizFlow",
|
210
236
|
value: function () {
|
211
|
-
var _startBizFlow = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
237
|
+
var _startBizFlow = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(options) {
|
212
238
|
var _this$paymentContext$, _this$paymentContext$2, _this$paymentContext$3;
|
213
239
|
var paymentSession, displayInfo, _convertPaymentSessio2, paymentSessionId, paymentSessionMetaData, mid, webAppMatchConfig, webAppVersion, productScene, paymentMethod, _this$bizFlowStartBeh, payload;
|
214
|
-
return _regeneratorRuntime().wrap(function
|
215
|
-
while (1) switch (
|
240
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
241
|
+
while (1) switch (_context4.prev = _context4.next) {
|
216
242
|
case 0:
|
217
243
|
if (!(!options || !options.paymentSession)) {
|
218
|
-
|
244
|
+
_context4.next = 2;
|
219
245
|
break;
|
220
246
|
}
|
221
247
|
throw new Error('paymentSession is empty');
|
@@ -245,61 +271,61 @@ export var AntomSDKCore = /*#__PURE__*/function () {
|
|
245
271
|
// Invoke processor
|
246
272
|
productScene = (_this$paymentContext$2 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$2 === void 0 || (_this$paymentContext$2 = _this$paymentContext$2.paymentSessionConfig) === null || _this$paymentContext$2 === void 0 ? void 0 : _this$paymentContext$2.productScene;
|
247
273
|
paymentMethod = (_this$paymentContext$3 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$3 === void 0 || (_this$paymentContext$3 = _this$paymentContext$3.paymentMethodInfoView) === null || _this$paymentContext$3 === void 0 ? void 0 : _this$paymentContext$3.paymentMethodType;
|
248
|
-
|
274
|
+
_context4.prev = 14;
|
249
275
|
if (!this.productProcessors["".concat(productScene, "|").concat(paymentMethod)]) {
|
250
|
-
|
276
|
+
_context4.next = 21;
|
251
277
|
break;
|
252
278
|
}
|
253
|
-
|
279
|
+
_context4.next = 18;
|
254
280
|
return this.productProcessors["".concat(productScene, "|").concat(paymentMethod)].startBizFlow(this.paymentContext);
|
255
281
|
case 18:
|
256
|
-
this.bizFlowStartBehavior =
|
257
|
-
|
282
|
+
this.bizFlowStartBehavior = _context4.sent;
|
283
|
+
_context4.next = 25;
|
258
284
|
break;
|
259
285
|
case 21:
|
260
286
|
if (!this.productProcessors["".concat(productScene)]) {
|
261
|
-
|
287
|
+
_context4.next = 25;
|
262
288
|
break;
|
263
289
|
}
|
264
|
-
|
290
|
+
_context4.next = 24;
|
265
291
|
return this.productProcessors["".concat(productScene)].startBizFlow(this.paymentContext);
|
266
292
|
case 24:
|
267
|
-
this.bizFlowStartBehavior =
|
293
|
+
this.bizFlowStartBehavior = _context4.sent;
|
268
294
|
case 25:
|
269
|
-
|
295
|
+
_context4.next = 30;
|
270
296
|
break;
|
271
297
|
case 27:
|
272
|
-
|
273
|
-
|
274
|
-
console.error('Invoke processor failed',
|
298
|
+
_context4.prev = 27;
|
299
|
+
_context4.t0 = _context4["catch"](14);
|
300
|
+
console.error('Invoke processor failed', _context4.t0);
|
275
301
|
case 30:
|
276
302
|
if (!(!this.bizFlowStartBehavior || this.bizFlowStartBehavior.behaviorType === 'NONE' || !this.bizFlowStartBehavior.payload)) {
|
277
|
-
|
303
|
+
_context4.next = 32;
|
278
304
|
break;
|
279
305
|
}
|
280
|
-
return
|
306
|
+
return _context4.abrupt("return");
|
281
307
|
case 32:
|
282
308
|
if (!(this.bizFlowStartBehavior.behaviorType === 'RENDER')) {
|
283
|
-
|
309
|
+
_context4.next = 35;
|
284
310
|
break;
|
285
311
|
}
|
286
312
|
this.handleBehaviorRender();
|
287
|
-
return
|
313
|
+
return _context4.abrupt("return");
|
288
314
|
case 35:
|
289
315
|
if (!(this.bizFlowStartBehavior.behaviorType === 'REDIRECT')) {
|
290
|
-
|
316
|
+
_context4.next = 39;
|
291
317
|
break;
|
292
318
|
}
|
293
319
|
payload = (_this$bizFlowStartBeh = this.bizFlowStartBehavior) === null || _this$bizFlowStartBeh === void 0 ? void 0 : _this$bizFlowStartBeh.payload;
|
294
320
|
redirect(payload, this.instanceId);
|
295
|
-
return
|
321
|
+
return _context4.abrupt("return");
|
296
322
|
case 39:
|
297
323
|
case "end":
|
298
|
-
return
|
324
|
+
return _context4.stop();
|
299
325
|
}
|
300
|
-
},
|
326
|
+
}, _callee4, this, [[14, 27]]);
|
301
327
|
}));
|
302
|
-
function startBizFlow(
|
328
|
+
function startBizFlow(_x7) {
|
303
329
|
return _startBizFlow.apply(this, arguments);
|
304
330
|
}
|
305
331
|
return startBizFlow;
|
@@ -342,7 +368,7 @@ export var AntomSDKCore = /*#__PURE__*/function () {
|
|
342
368
|
showRetentionPopup();
|
343
369
|
return;
|
344
370
|
} else {
|
345
|
-
_this2.handleClose(isOnCloseEvent);
|
371
|
+
_this2.handleClose(isOnCloseEvent, 'behavior');
|
346
372
|
}
|
347
373
|
};
|
348
374
|
|
@@ -368,9 +394,10 @@ export var AntomSDKCore = /*#__PURE__*/function () {
|
|
368
394
|
if (displayType == DisplayTypeEnum.popup) {
|
369
395
|
createRetentionPopup(platform, function () {
|
370
396
|
hideRetentionPopup();
|
397
|
+
_this2.handleRemain();
|
371
398
|
}, function () {
|
372
399
|
hideRetentionPopup();
|
373
|
-
_this2.handleClose();
|
400
|
+
_this2.handleClose(false, 'retention');
|
374
401
|
});
|
375
402
|
createMockup({
|
376
403
|
platform: platform,
|
@@ -381,13 +408,38 @@ export var AntomSDKCore = /*#__PURE__*/function () {
|
|
381
408
|
return;
|
382
409
|
}
|
383
410
|
}
|
411
|
+
}, {
|
412
|
+
key: "handleRemain",
|
413
|
+
value: function handleRemain() {
|
414
|
+
if (this.eventLogging && this.eventLogging.enableLogging) {
|
415
|
+
this.logger.logInfo({
|
416
|
+
code: this.eventLogging.eventName
|
417
|
+
}, {
|
418
|
+
eventId: EventLoggingEventId.ContinuePaying,
|
419
|
+
eventName: this.eventLogging.eventName,
|
420
|
+
eventAlias: this.eventLogging.eventAlias,
|
421
|
+
userPath: this.eventLogging.userPath
|
422
|
+
});
|
423
|
+
}
|
424
|
+
}
|
384
425
|
}, {
|
385
426
|
key: "handleClose",
|
386
427
|
value: function handleClose() {
|
387
428
|
var isOnCloseEvent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
429
|
+
var source = arguments.length > 1 ? arguments[1] : undefined;
|
388
430
|
var eventCenter = ServiceProvider.getInstance(this.instanceId).getService('EventCenter');
|
389
431
|
eventCenter.emit(EVENT.closeCallback.name, {});
|
390
432
|
if (this.enablePopWindowEventCallback && !isOnCloseEvent) {
|
433
|
+
if (this.eventLogging && this.eventLogging.enableLogging) {
|
434
|
+
this.logger.logInfo({
|
435
|
+
code: this.eventLogging.eventName
|
436
|
+
}, {
|
437
|
+
eventId: source === 'behavior' ? EventLoggingEventId.OnlyClose : EventLoggingEventId.LeaveAnyWay,
|
438
|
+
eventName: this.eventLogging.eventName,
|
439
|
+
eventAlias: this.eventLogging.eventAlias,
|
440
|
+
userPath: this.eventLogging.userPath
|
441
|
+
});
|
442
|
+
}
|
391
443
|
eventCenter.emit(EVENT.eventCallback.name, {
|
392
444
|
code: eventCodeEnum.SDK_PAYMENT_CANCEL,
|
393
445
|
result: {
|
@@ -76,6 +76,12 @@ export interface SDKMetaData {
|
|
76
76
|
webAppVersion: string;
|
77
77
|
greyscaleId?: number;
|
78
78
|
}
|
79
|
+
export interface EventLogging {
|
80
|
+
enableLogging: boolean;
|
81
|
+
eventName: string;
|
82
|
+
eventAlias: any;
|
83
|
+
userPath: string;
|
84
|
+
}
|
79
85
|
export interface InitContext {
|
80
86
|
initOptions: IoptionsParams;
|
81
87
|
sdkMetaData: SDKMetaData;
|
@@ -4,7 +4,7 @@ export type { BizFlowStartBehavior, PaymentContext, ProductProcessor, RedirectBe
|
|
4
4
|
export * as ChannelCustomize from '../../../component/channel';
|
5
5
|
export type { IChannelBehavior } from '../../../component/channel';
|
6
6
|
export { DisplayTypeEnum, PaymentMethodCategoryTypeEnum, ProductSceneEnum, RiskSdkInfoEnum } from '../../../types';
|
7
|
-
export type { CashierSdkActionQueryRequest, CashierSdkActionQueryResult, CashierSubmitPayRequest, CashierSubmitPayResult, IoptionsParams, } from '../../../types';
|
7
|
+
export type { CashierSdkActionQueryRequest, CashierSdkActionQueryResult, CashierSdkActionQuerySessionResult, CashierSubmitPayRequest, CashierSubmitPayResult, IoptionsParams, } from '../../../types';
|
8
8
|
export { isPC } from '../../../util';
|
9
9
|
export { getBackScheme } from '../../utils/redirect_utils';
|
10
10
|
export { isLocalMock } from '../../../util/mock';
|
@@ -7,6 +7,7 @@ export declare class EasySafePayProcessor implements ProductProcessor {
|
|
7
7
|
private eventCenter;
|
8
8
|
private instanceId;
|
9
9
|
private hostSign;
|
10
|
+
private allowQueryCall;
|
10
11
|
private allowSubmitPayCallAhead;
|
11
12
|
private channelBehavior?;
|
12
13
|
private SECURITY_SDK_INIT_TIMEOUT;
|
@@ -21,6 +22,7 @@ export declare class EasySafePayProcessor implements ProductProcessor {
|
|
21
22
|
* start waiting web launch, then send renderComponent event
|
22
23
|
* */
|
23
24
|
private sendRequestAndWaitWebLaunch;
|
25
|
+
private processQuery;
|
24
26
|
private processSubmitPay;
|
25
27
|
private acquireApdidToken;
|
26
28
|
private initSecuritySDK;
|