@alipay/ams-checkout 0.0.1745808793-dev.1 → 0.0.1745808793-dev.3

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.
Files changed (35) hide show
  1. package/dist/umd/ams-checkout.min.js +1 -1
  2. package/esm/component/channel.d.ts +1 -0
  3. package/esm/component/channel.js +25 -42
  4. package/esm/config/index.d.ts +7 -7
  5. package/esm/config/index.js +7 -7
  6. package/esm/constant/easysafepay.d.ts +16 -0
  7. package/esm/constant/easysafepay.js +19 -0
  8. package/esm/constant/index.d.ts +1 -0
  9. package/esm/constant/index.js +1 -0
  10. package/esm/core/component/element/elementContainerService/containerService.js +2 -2
  11. package/esm/core/component/element/elementController/index.js +15 -9
  12. package/esm/core/component/element/elementProcessor/baseElementProcessor.d.ts +3 -0
  13. package/esm/core/component/element/elementProcessor/baseElementProcessor.js +11 -0
  14. package/esm/core/component/element/elementProcessor/paymentProcessor.js +15 -8
  15. package/esm/core/component/element/index.js +6 -1
  16. package/esm/core/component/element/util.d.ts +6 -0
  17. package/esm/core/component/element/util.js +27 -0
  18. package/esm/core/instance/index.d.ts +1 -1
  19. package/esm/foundation/core/index.d.ts +3 -0
  20. package/esm/foundation/core/index.js +33 -4
  21. package/esm/foundation/index.d.ts +6 -0
  22. package/esm/foundation/product-processor/easysafepay/deps.d.ts +1 -1
  23. package/esm/foundation/product-processor/easysafepay/index.d.ts +2 -0
  24. package/esm/foundation/product-processor/easysafepay/index.js +164 -79
  25. package/esm/foundation/service/container/index.d.ts +1 -0
  26. package/esm/foundation/service/container/index.js +20 -2
  27. package/esm/foundation/utils/web_app_url_utils.d.ts +13 -4
  28. package/esm/foundation/utils/web_app_url_utils.js +69 -35
  29. package/esm/plugin/component/channel.d.ts +2 -1
  30. package/esm/plugin/component/channel.js +9 -12
  31. package/esm/plugin/component/index.js +44 -42
  32. package/esm/plugin/type.d.ts +1 -1
  33. package/esm/types/index.d.ts +17 -0
  34. package/esm/types/index.js +6 -0
  35. package/package.json +1 -1
@@ -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",
@@ -220,6 +222,7 @@ export var AntomSDKCore = /*#__PURE__*/function () {
220
222
  eventCenter.listen(EVENT.declareEventCallbackInfo.name, function (data) {
221
223
  if (data !== null && data !== void 0 && data.popWindowEventInfo) {
222
224
  _this.enablePopWindowEventCallback = data.popWindowEventInfo.enableCallback;
225
+ _this.eventLogging = data.eventLogging;
223
226
  }
224
227
  });
225
228
 
@@ -365,7 +368,7 @@ export var AntomSDKCore = /*#__PURE__*/function () {
365
368
  showRetentionPopup();
366
369
  return;
367
370
  } else {
368
- _this2.handleClose(isOnCloseEvent);
371
+ _this2.handleClose(isOnCloseEvent, 'behavior');
369
372
  }
370
373
  };
371
374
 
@@ -391,9 +394,10 @@ export var AntomSDKCore = /*#__PURE__*/function () {
391
394
  if (displayType == DisplayTypeEnum.popup) {
392
395
  createRetentionPopup(platform, function () {
393
396
  hideRetentionPopup();
397
+ _this2.handleRemain();
394
398
  }, function () {
395
399
  hideRetentionPopup();
396
- _this2.handleClose();
400
+ _this2.handleClose(false, 'retention');
397
401
  });
398
402
  createMockup({
399
403
  platform: platform,
@@ -404,13 +408,38 @@ export var AntomSDKCore = /*#__PURE__*/function () {
404
408
  return;
405
409
  }
406
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
+ }
407
425
  }, {
408
426
  key: "handleClose",
409
427
  value: function handleClose() {
410
428
  var isOnCloseEvent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
429
+ var source = arguments.length > 1 ? arguments[1] : undefined;
411
430
  var eventCenter = ServiceProvider.getInstance(this.instanceId).getService('EventCenter');
412
431
  eventCenter.emit(EVENT.closeCallback.name, {});
413
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
+ }
414
443
  eventCenter.emit(EVENT.eventCallback.name, {
415
444
  code: eventCodeEnum.SDK_PAYMENT_CANCEL,
416
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;
@@ -18,6 +18,9 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
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
19
  import PreloadHelper from "../../../foundation/utils/preload_helper";
20
20
  import { ChannelCustomize, DisplayTypeEnum, getBackScheme, isPC, PaymentMethodCategoryTypeEnum, ProductInfoCacheUtil, ProductSceneEnum, RiskSdkInfoEnum, ServiceProvider, uuid, WebAppUrlUtil, EVENT, eventCodeEnum } from "./deps";
21
+ import { isEmpty } from "../../../util";
22
+ import { getDefaultEasySafePayPageUrl } from "../../utils/web_app_url_utils";
23
+ import { ESP_PAGE_NAME } from "../../../constant/easysafepay";
21
24
  export var EasySafePayProcessor = /*#__PURE__*/function () {
22
25
  function EasySafePayProcessor() {
23
26
  _classCallCheck(this, EasySafePayProcessor);
@@ -29,6 +32,7 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
29
32
  _defineProperty(this, "instanceId", void 0);
30
33
  // 服务端接口区域信息,请求时决定API域名
31
34
  _defineProperty(this, "hostSign", void 0);
35
+ _defineProperty(this, "allowQueryCall", void 0);
32
36
  // 是否允许submitPay提前调用,在ESP非首次的性能优化场景使用
33
37
  _defineProperty(this, "allowSubmitPayCallAhead", void 0);
34
38
  _defineProperty(this, "channelBehavior", void 0);
@@ -73,6 +77,7 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
73
77
  requireFastSdk = paymentContext.paymentSessionObj.action.requireFastSdk;
74
78
  authUrlInfo = ((_paymentContext$payme2 = paymentContext.paymentSessionObj) === null || _paymentContext$payme2 === void 0 ? void 0 : _paymentContext$payme2.authUrlInfo) || {};
75
79
  this.channelBehavior = ChannelCustomize.getChannelBehavior(paymentContext.paymentSessionObj);
80
+
76
81
  // 首次支付
77
82
  isFirstTimeToPay = !autoDebitWithToken; // 处理ESP1.0极速外跳支付场景
78
83
  if (!(productSceneVersion === '1.0' && isFirstTimeToPay && requireFastSdk)) {
@@ -183,17 +188,19 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
183
188
  });
184
189
 
185
190
  // 等请求和 Web启动都Ready之后,发送renderComponent
186
- Promise.all([this.initSecuritySDK(), this.processSubmitPay(), webLaunchPromise]).then(function (_ref) {
191
+ Promise.all([this.initSecuritySDK(), this.processQuery(), this.processSubmitPay(), webLaunchPromise]).then(function (_ref) {
187
192
  var _this$paymentContext, _this$paymentContext2, _this$paymentContext$, _this$paymentContext$2, _this$paymentContext$3, _this$paymentContext$4;
188
- var _ref2 = _slicedToArray(_ref, 3),
193
+ var _ref2 = _slicedToArray(_ref, 4),
189
194
  _initSecurityRes = _ref2[0],
190
- submitRes = _ref2[1],
191
- _webLaunchRes = _ref2[2];
195
+ queryRes = _ref2[1],
196
+ submitRes = _ref2[2],
197
+ _webLaunchRes = _ref2[3];
192
198
  var logMetaData = _this.logger.getLogConfig().mdata;
193
199
  _this.eventCenter.dispatchToApp({
194
200
  event: 'renderComponent',
195
201
  data: {
196
202
  sessionResult: (_this$paymentContext = _this.paymentContext) === null || _this$paymentContext === void 0 ? void 0 : _this$paymentContext.paymentSessionObj,
203
+ queryResult: queryRes,
197
204
  submitResult: submitRes,
198
205
  paymentSessionData: (_this$paymentContext2 = _this.paymentContext) === null || _this$paymentContext2 === void 0 ? void 0 : _this$paymentContext2.paymentSessionId,
199
206
  heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
@@ -203,6 +210,7 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
203
210
  isAppWebview: _this.paymentContext.startBizFlowOptions.isAppWebview,
204
211
  merchantAppointParam: (_this$paymentContext$3 = _this.paymentContext.startBizFlowOptions.submitPayRequestExtra) === null || _this$paymentContext$3 === void 0 ? void 0 : _this$paymentContext$3.merchantAppointParam,
205
212
  allowSubmitPayCallAhead: _this.allowSubmitPayCallAhead,
213
+ doubleFaUrl: getDefaultEasySafePayPageUrl(ESP_PAGE_NAME.DOUBLE_FA, _this.initConfig.environment),
206
214
  envInfo: {
207
215
  screenHeight: screen.height,
208
216
  screenWidth: screen.width
@@ -231,24 +239,105 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
231
239
  });
232
240
  }
233
241
  }, {
234
- key: "processSubmitPay",
242
+ key: "processQuery",
235
243
  value: function () {
236
- var _processSubmitPay = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
237
- var _this$paymentContext3, _this$paymentContext4, _this$paymentContext5, _this$channelBehavior2, _this$channelBehavior3, _this$paymentContext$6;
238
- var submitParams, _ref3, _ref3$productSceneVer, productSceneVersion, _ref4, _ref4$action, _ref4$action2, _ref4$action2$enableS, enableSignAgreement, _ref4$action2$autoDeb, autoDebitWithToken, _this$paymentContext$5, paymentMethodType, isAppWebview, backScheme, requestBizId, extParams, requester, _this$paymentContext$7, res;
244
+ var _processQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
245
+ var _this$paymentContext3, _this$paymentContext4;
246
+ var queryParams, extendInfo, extendInfoData, needQueryRender, requestBizId, requester, _this$paymentContext$5, res;
239
247
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
240
248
  while (1) switch (_context2.prev = _context2.next) {
241
249
  case 0:
242
- submitParams = {
250
+ queryParams = {
243
251
  paymentSessionData: ((_this$paymentContext3 = this.paymentContext) === null || _this$paymentContext3 === void 0 ? void 0 : _this$paymentContext3.paymentSessionId) || '',
244
252
  paymentSessionConfig: (_this$paymentContext4 = this.paymentContext) === null || _this$paymentContext4 === void 0 || (_this$paymentContext4 = _this$paymentContext4.paymentSessionObj) === null || _this$paymentContext4 === void 0 ? void 0 : _this$paymentContext4.paymentSessionConfig
245
253
  };
254
+ extendInfo = this.paymentContext.paymentSessionObj.extendInfo;
255
+ try {
256
+ extendInfoData = JSON.parse(extendInfo);
257
+ needQueryRender = isEmpty(extendInfoData.needQueryRender) || extendInfoData.needQueryRender === true;
258
+ this.allowQueryCall = needQueryRender;
259
+ } catch (error) {
260
+ console.log(error);
261
+ }
262
+ if (this.allowQueryCall) {
263
+ _context2.next = 5;
264
+ break;
265
+ }
266
+ return _context2.abrupt("return", null);
267
+ case 5:
268
+ requestBizId = uuid();
269
+ this.logger.logInfo({
270
+ title: 'sdk_event_sdkQuery'
271
+ }, {
272
+ config: JSON.stringify(queryParams.paymentSessionConfig),
273
+ requestId: requestBizId
274
+ });
275
+ requester = ServiceProvider.getInstance(this.instanceId).getService('Requester');
276
+ _context2.prev = 8;
277
+ _context2.next = 11;
278
+ return requester.request(_objectSpread(_objectSpread({}, queryParams), {}, {
279
+ actionType: 'init',
280
+ integrationType: 'SDK',
281
+ sdkVersion: (_this$paymentContext$5 = this.paymentContext.sdkMetaData.sdkVersion) !== null && _this$paymentContext$5 !== void 0 ? _this$paymentContext$5 : '1.0.0'
282
+ }), {
283
+ env: this.initConfig.environment,
284
+ timeout: this.SDK_REQUEST_TIMEOUT,
285
+ hostSign: this.hostSign,
286
+ needEnvInfo: true,
287
+ 'Operation-Type': 'com.ipay.iexpcashier.sdkAction.query'
288
+ });
289
+ case 11:
290
+ res = _context2.sent;
291
+ this.logger.logInfo({
292
+ title: 'sdk_event_sdkQueryEnd'
293
+ }, {
294
+ config: JSON.stringify(queryParams.paymentSessionConfig),
295
+ requestId: requestBizId,
296
+ rpcTraceId: res.traceId
297
+ });
298
+ return _context2.abrupt("return", res);
299
+ case 16:
300
+ _context2.prev = 16;
301
+ _context2.t0 = _context2["catch"](8);
302
+ this.logger.logError({
303
+ title: 'sdk_event_sdkQuery_failed'
304
+ }, {
305
+ config: JSON.stringify(queryParams.paymentSessionConfig),
306
+ errorMessage: JSON.stringify(_context2.t0),
307
+ requestId: requestBizId,
308
+ rpcTraceId: _context2.t0 === null || _context2.t0 === void 0 ? void 0 : _context2.t0.traceId
309
+ });
310
+ return _context2.abrupt("return", null);
311
+ case 20:
312
+ case "end":
313
+ return _context2.stop();
314
+ }
315
+ }, _callee2, this, [[8, 16]]);
316
+ }));
317
+ function processQuery() {
318
+ return _processQuery.apply(this, arguments);
319
+ }
320
+ return processQuery;
321
+ }()
322
+ }, {
323
+ key: "processSubmitPay",
324
+ value: function () {
325
+ var _processSubmitPay = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
326
+ var _this$paymentContext5, _this$paymentContext6, _this$paymentContext7, _this$channelBehavior2, _this$channelBehavior3, _this$paymentContext$7, _this$paymentContext8;
327
+ var submitParams, _ref3, _ref3$productSceneVer, productSceneVersion, _ref4, _ref4$action, _ref4$action2, _ref4$action2$enableS, enableSignAgreement, _ref4$action2$autoDeb, autoDebitWithToken, _this$paymentContext$6, paymentMethodType, isAppWebview, backScheme, requestBizId, extParams, requester, _this$paymentContext$8, res;
328
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
329
+ while (1) switch (_context3.prev = _context3.next) {
330
+ case 0:
331
+ submitParams = {
332
+ paymentSessionData: ((_this$paymentContext5 = this.paymentContext) === null || _this$paymentContext5 === void 0 ? void 0 : _this$paymentContext5.paymentSessionId) || '',
333
+ paymentSessionConfig: (_this$paymentContext6 = this.paymentContext) === null || _this$paymentContext6 === void 0 || (_this$paymentContext6 = _this$paymentContext6.paymentSessionObj) === null || _this$paymentContext6 === void 0 ? void 0 : _this$paymentContext6.paymentSessionConfig
334
+ };
246
335
  _ref3 = submitParams.paymentSessionConfig || {}, _ref3$productSceneVer = _ref3.productSceneVersion, productSceneVersion = _ref3$productSceneVer === void 0 ? '' : _ref3$productSceneVer;
247
- _ref4 = ((_this$paymentContext5 = this.paymentContext) === null || _this$paymentContext5 === void 0 ? void 0 : _this$paymentContext5.paymentSessionObj) || {}, _ref4$action = _ref4.action, _ref4$action2 = _ref4$action === void 0 ? {} : _ref4$action, _ref4$action2$enableS = _ref4$action2.enableSignAgreement, enableSignAgreement = _ref4$action2$enableS === void 0 ? false : _ref4$action2$enableS, _ref4$action2$autoDeb = _ref4$action2.autoDebitWithToken, autoDebitWithToken = _ref4$action2$autoDeb === void 0 ? false : _ref4$action2$autoDeb;
336
+ _ref4 = ((_this$paymentContext7 = this.paymentContext) === null || _this$paymentContext7 === void 0 ? void 0 : _this$paymentContext7.paymentSessionObj) || {}, _ref4$action = _ref4.action, _ref4$action2 = _ref4$action === void 0 ? {} : _ref4$action, _ref4$action2$enableS = _ref4$action2.enableSignAgreement, enableSignAgreement = _ref4$action2$enableS === void 0 ? false : _ref4$action2$enableS, _ref4$action2$autoDeb = _ref4$action2.autoDebitWithToken, autoDebitWithToken = _ref4$action2$autoDeb === void 0 ? false : _ref4$action2$autoDeb;
248
337
  if (productSceneVersion === '2.0' && !autoDebitWithToken) {
249
338
  ///EasyPay 2.0 首次传signAgreement字段
250
339
  submitParams['signAgreement'] = enableSignAgreement;
251
- paymentMethodType = (_this$paymentContext$5 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$5 === void 0 || (_this$paymentContext$5 = _this$paymentContext$5.paymentMethodInfoView) === null || _this$paymentContext$5 === void 0 ? void 0 : _this$paymentContext$5.paymentMethodType;
340
+ paymentMethodType = (_this$paymentContext$6 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$6 === void 0 || (_this$paymentContext$6 = _this$paymentContext$6.paymentMethodInfoView) === null || _this$paymentContext$6 === void 0 ? void 0 : _this$paymentContext$6.paymentMethodType;
252
341
  isAppWebview = this.paymentContext.startBizFlowOptions.isAppWebview;
253
342
  if (paymentMethodType == 'ALIPAY_CN' && !isAppWebview) {
254
343
  backScheme = getBackScheme(undefined, this.logger);
@@ -260,10 +349,10 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
260
349
  this.allowSubmitPayCallAhead = this.channelBehavior.allowSubmitPayCallAhead;
261
350
  //console.log('[web-sdk] allowSubmitPayCallAhead =', this.allowSubmitPayCallAhead);
262
351
  if (this.allowSubmitPayCallAhead) {
263
- _context2.next = 7;
352
+ _context3.next = 7;
264
353
  break;
265
354
  }
266
- return _context2.abrupt("return", {
355
+ return _context3.abrupt("return", {
267
356
  message: 'sdk no need to make submitPay request',
268
357
  success: true
269
358
  });
@@ -279,44 +368,45 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
279
368
  extParams = ((_this$channelBehavior2 = this.channelBehavior) === null || _this$channelBehavior2 === void 0 || (_this$channelBehavior3 = _this$channelBehavior2.buildSubmitPayExtParams) === null || _this$channelBehavior3 === void 0 ? void 0 : _this$channelBehavior3.call(_this$channelBehavior2, {
280
369
  instanceId: this.instanceId,
281
370
  locale: this.initConfig.locale,
282
- paymentMethodType: (_this$paymentContext$6 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$6 === void 0 || (_this$paymentContext$6 = _this$paymentContext$6.paymentMethodInfoView) === null || _this$paymentContext$6 === void 0 ? void 0 : _this$paymentContext$6.paymentMethodType,
371
+ paymentMethodType: (_this$paymentContext$7 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$7 === void 0 || (_this$paymentContext$7 = _this$paymentContext$7.paymentMethodInfoView) === null || _this$paymentContext$7 === void 0 ? void 0 : _this$paymentContext$7.paymentMethodType,
283
372
  paymentSessionData: this.paymentContext.paymentSessionId,
284
373
  env: this.initConfig.environment,
285
- sdkVersion: this.paymentContext.sdkMetaData.sdkVersion
374
+ sdkVersion: this.paymentContext.sdkMetaData.sdkVersion,
375
+ notRedirectAfterComplete: ((_this$paymentContext8 = this.paymentContext) === null || _this$paymentContext8 === void 0 || (_this$paymentContext8 = _this$paymentContext8.startBizFlowOptions) === null || _this$paymentContext8 === void 0 || (_this$paymentContext8 = _this$paymentContext8.submitPayRequestExtra) === null || _this$paymentContext8 === void 0 ? void 0 : _this$paymentContext8.notRedirectAfterComplete) === true
286
376
  })) || {}; // 二次支付不再需要该参数
287
377
  if (!autoDebitWithToken) {
288
378
  extParams.complianceSDK = true;
289
379
  }
290
380
  submitParams.extParams = extParams;
291
381
  requester = ServiceProvider.getInstance(this.instanceId).getService('Requester');
292
- _context2.prev = 13;
293
- _context2.t0 = requester;
294
- _context2.t1 = _objectSpread(_objectSpread({}, submitParams), {}, {
382
+ _context3.prev = 13;
383
+ _context3.t0 = requester;
384
+ _context3.t1 = _objectSpread(_objectSpread({}, submitParams), {}, {
295
385
  integrationType: 'SDK',
296
- sdkVersion: (_this$paymentContext$7 = this.paymentContext.sdkMetaData.sdkVersion) !== null && _this$paymentContext$7 !== void 0 ? _this$paymentContext$7 : '1.0.0'
386
+ sdkVersion: (_this$paymentContext$8 = this.paymentContext.sdkMetaData.sdkVersion) !== null && _this$paymentContext$8 !== void 0 ? _this$paymentContext$8 : '1.0.0'
297
387
  });
298
- _context2.t2 = this.initConfig.environment;
299
- _context2.t3 = this.SDK_REQUEST_TIMEOUT;
300
- _context2.next = 20;
388
+ _context3.t2 = this.initConfig.environment;
389
+ _context3.t3 = this.SDK_REQUEST_TIMEOUT;
390
+ _context3.next = 20;
301
391
  return this.acquireApdidToken();
302
392
  case 20:
303
- _context2.t4 = _context2.sent;
304
- _context2.t5 = {
305
- deviceId: _context2.t4
393
+ _context3.t4 = _context3.sent;
394
+ _context3.t5 = {
395
+ deviceId: _context3.t4
306
396
  };
307
- _context2.t6 = this.hostSign;
308
- _context2.t7 = {
309
- env: _context2.t2,
310
- timeout: _context2.t3,
311
- envInfo: _context2.t5,
312
- hostSign: _context2.t6,
397
+ _context3.t6 = this.hostSign;
398
+ _context3.t7 = {
399
+ env: _context3.t2,
400
+ timeout: _context3.t3,
401
+ envInfo: _context3.t5,
402
+ hostSign: _context3.t6,
313
403
  needEnvInfo: true,
314
404
  'Operation-Type': 'com.ipay.iexpcashier.cashier.submitPayByPaymentSession'
315
405
  };
316
- _context2.next = 26;
317
- return _context2.t0.request.call(_context2.t0, _context2.t1, _context2.t7);
406
+ _context3.next = 26;
407
+ return _context3.t0.request.call(_context3.t0, _context3.t1, _context3.t7);
318
408
  case 26:
319
- res = _context2.sent;
409
+ res = _context3.sent;
320
410
  this.logger.logInfo({
321
411
  title: 'sdk_event_submitPayEnd'
322
412
  }, {
@@ -324,24 +414,24 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
324
414
  requestId: requestBizId,
325
415
  rpcTraceId: res.traceId
326
416
  });
327
- return _context2.abrupt("return", res);
417
+ return _context3.abrupt("return", res);
328
418
  case 31:
329
- _context2.prev = 31;
330
- _context2.t8 = _context2["catch"](13);
419
+ _context3.prev = 31;
420
+ _context3.t8 = _context3["catch"](13);
331
421
  this.logger.logError({
332
422
  title: 'sdk_event_submitPay_failed'
333
423
  }, {
334
424
  config: JSON.stringify(submitParams.paymentSessionConfig),
335
- errorMessage: JSON.stringify(_context2.t8),
425
+ errorMessage: JSON.stringify(_context3.t8),
336
426
  requestId: requestBizId,
337
- rpcTraceId: _context2.t8 === null || _context2.t8 === void 0 ? void 0 : _context2.t8.traceId
427
+ rpcTraceId: _context3.t8 === null || _context3.t8 === void 0 ? void 0 : _context3.t8.traceId
338
428
  });
339
- return _context2.abrupt("return", null);
429
+ return _context3.abrupt("return", null);
340
430
  case 35:
341
431
  case "end":
342
- return _context2.stop();
432
+ return _context3.stop();
343
433
  }
344
- }, _callee2, this, [[13, 31]]);
434
+ }, _callee3, this, [[13, 31]]);
345
435
  }));
346
436
  function processSubmitPay() {
347
437
  return _processSubmitPay.apply(this, arguments);
@@ -351,23 +441,23 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
351
441
  }, {
352
442
  key: "acquireApdidToken",
353
443
  value: function () {
354
- var _acquireApdidToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
355
- var _this$paymentContext$8;
444
+ var _acquireApdidToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
445
+ var _this$paymentContext$9;
356
446
  var securityService, productScene, deviceId;
357
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
358
- while (1) switch (_context3.prev = _context3.next) {
447
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
448
+ while (1) switch (_context4.prev = _context4.next) {
359
449
  case 0:
360
450
  securityService = ServiceProvider.getInstance(this.instanceId).getService('Security');
361
- productScene = (_this$paymentContext$8 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$8 === void 0 || (_this$paymentContext$8 = _this$paymentContext$8.paymentSessionConfig) === null || _this$paymentContext$8 === void 0 ? void 0 : _this$paymentContext$8.productScene;
451
+ productScene = (_this$paymentContext$9 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$9 === void 0 || (_this$paymentContext$9 = _this$paymentContext$9.paymentSessionConfig) === null || _this$paymentContext$9 === void 0 ? void 0 : _this$paymentContext$9.productScene;
362
452
  deviceId = securityService.getDeviceId({
363
453
  productScene: productScene
364
454
  });
365
- return _context3.abrupt("return", deviceId);
455
+ return _context4.abrupt("return", deviceId);
366
456
  case 4:
367
457
  case "end":
368
- return _context3.stop();
458
+ return _context4.stop();
369
459
  }
370
- }, _callee3, this);
460
+ }, _callee4, this);
371
461
  }));
372
462
  function acquireApdidToken() {
373
463
  return _acquireApdidToken.apply(this, arguments);
@@ -377,15 +467,16 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
377
467
  }, {
378
468
  key: "initSecuritySDK",
379
469
  value: function () {
380
- var _initSecuritySDK = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
381
- var _this$paymentContext$9, _this$paymentContext$10, productSceneVersion, nonCompliant, nonInitSecuritySDK, isFirstTimeToPay, shouldInitSecuritySDK;
382
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
383
- while (1) switch (_context4.prev = _context4.next) {
470
+ var _initSecuritySDK = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
471
+ var _this$paymentContext$10, _this$paymentContext$11, _this$paymentContext$12, _this$paymentContext$13, _this$paymentContext$14, _this$paymentContext$15, productSceneVersion, nonInitSecuritySDK, signButtonDisplay, userSignAgreement, isFirstTimeToPay, shouldInitSecuritySDK;
472
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
473
+ while (1) switch (_context5.prev = _context5.next) {
384
474
  case 0:
385
- _context4.prev = 0;
475
+ _context5.prev = 0;
386
476
  productSceneVersion = this.paymentContext.paymentSessionObj.paymentSessionConfig.productSceneVersion;
387
- nonCompliant = (_this$paymentContext$9 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$9 === void 0 ? void 0 : _this$paymentContext$9.nonCompliant;
388
- nonInitSecuritySDK = (_this$paymentContext$10 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$10 === void 0 ? void 0 : _this$paymentContext$10.nonInitSecuritySDK;
477
+ nonInitSecuritySDK = (_this$paymentContext$10 = (_this$paymentContext$11 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$11 === void 0 ? void 0 : _this$paymentContext$11.nonInitSecuritySDK) !== null && _this$paymentContext$10 !== void 0 ? _this$paymentContext$10 : false;
478
+ signButtonDisplay = (_this$paymentContext$12 = (_this$paymentContext$13 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$13 === void 0 ? void 0 : _this$paymentContext$13.signButtonDisplay) !== null && _this$paymentContext$12 !== void 0 ? _this$paymentContext$12 : false;
479
+ userSignAgreement = (_this$paymentContext$14 = (_this$paymentContext$15 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$15 === void 0 ? void 0 : _this$paymentContext$15.userSignAgreement) !== null && _this$paymentContext$14 !== void 0 ? _this$paymentContext$14 : false;
389
480
  isFirstTimeToPay = !this.paymentContext.paymentSessionObj.action.autoDebitWithToken;
390
481
  shouldInitSecuritySDK = false;
391
482
  if (nonInitSecuritySDK) {
@@ -398,44 +489,38 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
398
489
  // console.log('[web-sdk][security-sdk] DO NOT init security sdk for easypay 1.0');
399
490
  shouldInitSecuritySDK = false;
400
491
  } else if (productSceneVersion === '2.0') {
401
- if (nonCompliant === true) {
402
- // 未切流「隐私合规」
403
- // console.log('[web-sdk][security-sdk] DO init security sdk for easypay 2.0 and nonCompliant is true');
404
- shouldInitSecuritySDK = true;
492
+ if (isFirstTimeToPay) {
493
+ // console.log((signButtonDisplay && userSignAgreement) ? '[web-sdk][security-sdk] DO init security sdk for easypay 2.0, first time to pay and user agreeement signing from merchant' : '[web-sdk][security-sdk] DO NOT init security sdk for easypay 2.0, first time to pay and user agreeement has not been signed from merchant');
494
+ shouldInitSecuritySDK = signButtonDisplay && userSignAgreement;
405
495
  } else {
406
- if (isFirstTimeToPay) {
407
- // console.log('[web-sdk][security-sdk] DO NOT init security sdk for easypay 2.0 and when first time to pay');
408
- shouldInitSecuritySDK = false;
409
- } else {
410
- // 切流「隐私合规」且非首次支付
411
- // console.log('[web-sdk][security-sdk] DO init security sdk for easypay 2.0 and when not first time to pay');
412
- shouldInitSecuritySDK = true;
413
- }
496
+ // 切流「隐私合规」且非首次支付
497
+ // console.log('[web-sdk][security-sdk] DO init security sdk for easypay 2.0 and when not first time to pay');
498
+ shouldInitSecuritySDK = true;
414
499
  }
415
500
  }
416
501
  }
417
502
  if (!shouldInitSecuritySDK) {
418
- _context4.next = 10;
503
+ _context5.next = 11;
419
504
  break;
420
505
  }
421
- _context4.next = 10;
506
+ _context5.next = 11;
422
507
  return this.securityService.initSecurity(this.SECURITY_SDK_INIT_TIMEOUT);
423
- case 10:
508
+ case 11:
424
509
  this.logger.logInfo({
425
510
  title: 'a3753.b101271.c388193.d514078'
426
511
  }, {
427
512
  riskSdkInfo: shouldInitSecuritySDK ? RiskSdkInfoEnum.NEED : RiskSdkInfoEnum.NO_NEED
428
513
  });
429
- _context4.next = 15;
514
+ _context5.next = 16;
430
515
  break;
431
- case 13:
432
- _context4.prev = 13;
433
- _context4.t0 = _context4["catch"](0);
434
- case 15:
516
+ case 14:
517
+ _context5.prev = 14;
518
+ _context5.t0 = _context5["catch"](0);
519
+ case 16:
435
520
  case "end":
436
- return _context4.stop();
521
+ return _context5.stop();
437
522
  }
438
- }, _callee4, this, [[0, 13]]);
523
+ }, _callee5, this, [[0, 14]]);
439
524
  }));
440
525
  function initSecuritySDK() {
441
526
  return _initSecuritySDK.apply(this, arguments);
@@ -29,5 +29,6 @@ export declare class ContainerService implements Service {
29
29
  private handleAppHeartBeat;
30
30
  private changeCloseBtnVisibility;
31
31
  private handleMaskCloseBtnShow;
32
+ private handleCloseButtonTheme;
32
33
  getWebApp(): HTMLIFrameElement;
33
34
  }
@@ -11,7 +11,7 @@ import { isEmpty } from "../../../util";
11
11
  import { addInlineLoading, createInlineBaseElement } from "../../../component/component.inline.style";
12
12
  import { addPopupLoading, createBaseElement } from "../../../component/component.popup.style";
13
13
  import { insertStyleSheet } from "../../../component/popupWindow.style";
14
- import { COMPONENT_CLOSE_BLOCK_ID, COMPONENT_CLOSE_MASK_BLOCK_ID, COMPONENT_CONTAINER_ID, ERRORMESSAGE, EVENT, LOADING_ID, MOCKUP_ID, TIMEOUT_WEB_APP_HEART_BEAT, TIME_DELAY_SEND_HEART_BEAT } from "../../../constant";
14
+ import { COMPONENT_CLOSE_BLOCK_ID, COMPONENT_CLOSE_MASK_BLOCK_ID, COMPONENT_CONTAINER_ID, ERRORMESSAGE, EVENT, LOADING_ID, MOCKUP_ID, TIMEOUT_WEB_APP_HEART_BEAT, TIME_DELAY_SEND_HEART_BEAT, closeImg, closeImgLight } from "../../../constant";
15
15
  import { DisplayTypeEnum, ProductSceneEnum } from "../../../types";
16
16
  import { ServiceProvider } from "../index";
17
17
  import { PopupManager } from "./popup";
@@ -194,7 +194,8 @@ export var ContainerService = /*#__PURE__*/function () {
194
194
  this.eventCenter.listen(EVENT.sizeChanged.name, function (data) {
195
195
  _this.handleSizeChanged(_objectSpread({}, data));
196
196
  });
197
- this.eventCenter.listen(EVENT.showCloseButton.name, function () {
197
+ this.eventCenter.listen(EVENT.showCloseButton.name, function (data) {
198
+ _this.handleCloseButtonTheme(data.theme);
198
199
  _this.changeCloseBtnVisibility(true);
199
200
  });
200
201
  this.eventCenter.listen(EVENT.hideCloseButton.name, function () {
@@ -323,6 +324,23 @@ export var ContainerService = /*#__PURE__*/function () {
323
324
  closeBlock === null || closeBlock === void 0 || closeBlock.classList.add("".concat(COMPONENT_CLOSE_MASK_BLOCK_ID, "-hidden"));
324
325
  }
325
326
  }
327
+ }, {
328
+ key: "handleCloseButtonTheme",
329
+ value: function handleCloseButtonTheme(theme) {
330
+ if (!theme) return;
331
+ var closeBlock = document.getElementById(COMPONENT_CLOSE_BLOCK_ID);
332
+ var closeButtonImg = closeBlock === null || closeBlock === void 0 ? void 0 : closeBlock.querySelector('img');
333
+ var maskCloseBlock = document.getElementById(COMPONENT_CLOSE_MASK_BLOCK_ID);
334
+ if (theme === 'light') {
335
+ closeButtonImg === null || closeButtonImg === void 0 || closeButtonImg.setAttribute('src', closeImgLight);
336
+ closeBlock === null || closeBlock === void 0 || closeBlock.classList.add("".concat(COMPONENT_CLOSE_BLOCK_ID, "-light"));
337
+ maskCloseBlock === null || maskCloseBlock === void 0 || maskCloseBlock.classList.add("".concat(COMPONENT_CLOSE_MASK_BLOCK_ID, "-light"));
338
+ } else {
339
+ closeButtonImg === null || closeButtonImg === void 0 || closeButtonImg.setAttribute('src', closeImg);
340
+ closeBlock === null || closeBlock === void 0 || closeBlock.classList.remove("".concat(COMPONENT_CLOSE_BLOCK_ID, "-light"));
341
+ maskCloseBlock === null || maskCloseBlock === void 0 || maskCloseBlock.classList.remove("".concat(COMPONENT_CLOSE_MASK_BLOCK_ID, "-light"));
342
+ }
343
+ }
326
344
  }, {
327
345
  key: "getWebApp",
328
346
  value: function getWebApp() {
@@ -1,5 +1,6 @@
1
1
  import { DisplayTypeEnum, PaymentMethodCategoryTypeEnum, ProductSceneEnum } from '../../types';
2
2
  import { SDKMetaData } from '../index';
3
+ import { ESP_PAGE_NAME } from "../../constant/easysafepay";
3
4
  /**
4
5
  * Tell the SDK which version of the Web App to load.
5
6
  * Sent by server inside paymentSession.
@@ -21,9 +22,10 @@ export interface WebAppMatchConfig {
21
22
  * Sent by server inside paymentSession.
22
23
  */
23
24
  export interface WebAppUrlMatchConfig {
24
- version: string;
25
+ minSDKVersion: string;
25
26
  url: string;
26
- mid?: string;
27
+ doubleFa: string;
28
+ mids?: string[];
27
29
  }
28
30
  export interface QueryParams {
29
31
  displayType: DisplayTypeEnum;
@@ -81,11 +83,18 @@ export declare const saveLocalCheckoutUrl: (productScene: ProductSceneEnum, url:
81
83
  *
82
84
  * @param productScene - The product scene for which the checkout URL should be retrieved.
83
85
  */
84
- export declare const getLocalCheckoutUrl: (productScene: ProductSceneEnum) => string;
86
+ export declare const getLocalCheckoutUrl: (productScene: ProductSceneEnum, environment: string) => string;
85
87
  /**
86
88
  * Provide default checkout URL for the specified product scene.
87
89
  * Return URL for 'EASY_PAY' product scene, while for other product scenes, it returns an empty string as they are not currently in use
88
90
  *
89
91
  * @param productScene - The product scene for which the default checkout URL should be provided.
90
92
  */
91
- export declare const defaultCheckoutUrl: (productScene: ProductSceneEnum) => string;
93
+ export declare const defaultCheckoutUrl: (productScene: ProductSceneEnum, environment?: string) => string;
94
+ export declare const getMatchedWebAppV2Url: (productScene: ProductSceneEnum, mid: string, config: WebAppUrlMatchConfig[], environment: string) => string;
95
+ /**
96
+ * V2应用EasySafePay 热更新兜底URL构建规则
97
+ * 1. 兜底URL版本与sdk版本保持一致
98
+ * 2. DEV环境下html新增版本前缀
99
+ **/
100
+ export declare const getDefaultEasySafePayPageUrl: (pageName: ESP_PAGE_NAME, env: string) => string;