@alipay/ams-checkout 1.34.0 → 1.36.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.
Files changed (43) hide show
  1. package/dist/umd/ams-checkout.min.js +1 -1
  2. package/esm/component/channel.d.ts +3 -1
  3. package/esm/component/channel.js +26 -62
  4. package/esm/config/index.d.ts +8 -8
  5. package/esm/config/index.js +8 -8
  6. package/esm/constant/easysafepay.d.ts +16 -0
  7. package/esm/constant/easysafepay.js +19 -0
  8. package/esm/constant/index.d.ts +4 -0
  9. package/esm/constant/index.js +4 -0
  10. package/esm/core/component/ckp/index.d.ts +2 -0
  11. package/esm/core/component/ckp/index.js +39 -5
  12. package/esm/core/component/element/elementContainerService/containerService.js +2 -2
  13. package/esm/core/component/element/elementController/index.js +15 -9
  14. package/esm/core/component/element/elementProcessor/baseElementProcessor.d.ts +3 -0
  15. package/esm/core/component/element/elementProcessor/baseElementProcessor.js +11 -0
  16. package/esm/core/component/element/elementProcessor/paymentProcessor.js +15 -8
  17. package/esm/core/component/element/index.js +6 -1
  18. package/esm/core/component/element/util.d.ts +6 -0
  19. package/esm/core/component/element/util.js +27 -0
  20. package/esm/core/instance/index.d.ts +1 -1
  21. package/esm/foundation/core/index.d.ts +3 -0
  22. package/esm/foundation/core/index.js +103 -37
  23. package/esm/foundation/index.d.ts +6 -0
  24. package/esm/foundation/product-processor/easysafepay/deps.d.ts +1 -1
  25. package/esm/foundation/product-processor/easysafepay/index.d.ts +2 -0
  26. package/esm/foundation/product-processor/easysafepay/index.js +244 -121
  27. package/esm/foundation/service/container/index.d.ts +1 -0
  28. package/esm/foundation/service/container/index.js +20 -2
  29. package/esm/foundation/utils/preload_helper.d.ts +2 -2
  30. package/esm/foundation/utils/preload_helper.js +8 -4
  31. package/esm/foundation/utils/web_app_url_utils.d.ts +71 -1
  32. package/esm/foundation/utils/web_app_url_utils.js +215 -8
  33. package/esm/index.js +1 -1
  34. package/esm/plugin/component/cashierApp.js +4 -4
  35. package/esm/plugin/component/channel.d.ts +3 -1
  36. package/esm/plugin/component/channel.js +10 -12
  37. package/esm/plugin/component/index.js +45 -42
  38. package/esm/plugin/type.d.ts +1 -1
  39. package/esm/types/index.d.ts +17 -0
  40. package/esm/types/index.js +6 -0
  41. package/esm/util/redirect.d.ts +6 -0
  42. package/esm/util/redirect.js +54 -0
  43. package/package.json +3 -2
@@ -1,4 +1,6 @@
1
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 ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
2
4
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
3
5
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4
6
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
@@ -40,7 +42,10 @@ export var ElementComponent = /*#__PURE__*/function () {
40
42
  }, {
41
43
  key: "mount",
42
44
  value: function mount(renderOptions, sdkSelector) {
43
- return this.controller.mount(renderOptions, sdkSelector);
45
+ var _this$options;
46
+ return this.controller.mount(_objectSpread({
47
+ appearance: this === null || this === void 0 || (_this$options = this.options) === null || _this$options === void 0 ? void 0 : _this$options.appearance
48
+ }, renderOptions), sdkSelector);
44
49
  }
45
50
  }, {
46
51
  key: "mountCashier",
@@ -57,4 +57,10 @@ export declare function redirect(data: {
57
57
  callAppJudgeTime?: number;
58
58
  }): Promise<void>;
59
59
  export declare function showToast(options?: IToastOptions, callback?: Function): void;
60
+ export declare const isElementMobile: () => boolean;
61
+ /**
62
+ * @description judge whether the device is a pad, by userAgent and screen aspect ratio, but not accurate
63
+ */
64
+ export declare const isElementPad: () => boolean;
65
+ export declare const isElementPC: () => boolean;
60
66
  export { formatElementOption };
@@ -448,4 +448,31 @@ export function showToast() {
448
448
  }, 300);
449
449
  }, config.duration);
450
450
  }
451
+ export var isElementMobile = function isElementMobile() {
452
+ var userAgentInfo = navigator.userAgent;
453
+ // webview 容器
454
+ if (userAgentInfo.includes('AlipayWebViewClient')) {
455
+ return true;
456
+ }
457
+ var agents = ['Android', 'iPhone', 'SymbianOS', 'Windows Phone', 'iPod', 'iPad'];
458
+ return agents.some(function (agent) {
459
+ return userAgentInfo.includes(agent);
460
+ });
461
+ };
462
+
463
+ /**
464
+ * @description judge whether the device is a pad, by userAgent and screen aspect ratio, but not accurate
465
+ */
466
+ export var isElementPad = function isElementPad() {
467
+ var userAgent = navigator.userAgent.toLowerCase();
468
+ var width = window.screen.width;
469
+ var height = window.screen.height;
470
+ var aspectRatio = Math.min(width, height) / Math.max(width, height);
471
+ var userAgentCheck = /ipad|tablet|(android(?!.*mobile))/i.test(userAgent);
472
+ var screenCheck = aspectRatio > 0.5 && aspectRatio < 0.75 && width >= 768 && height >= 1024;
473
+ return userAgentCheck || screenCheck;
474
+ };
475
+ export var isElementPC = function isElementPC() {
476
+ return !isElementMobile();
477
+ };
451
478
  export { formatElementOption };
@@ -5,7 +5,7 @@
5
5
  * 1. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE; and
6
6
  * 2. If applicable, the use of the Software is also subject to the terms and conditions of any non-disclosure agreement signed by you and the relevant Ant Group entity.
7
7
  */
8
- import { ComponentActionNamesType } from 'src/plugin/type';
8
+ import { ComponentActionNamesType } from '../../plugin/type';
9
9
  import ComponentApp from '../../plugin/component';
10
10
  import type { AMSCheckoutOptions, IAppendParams, InitSecurityConfig, IoptionsParams } from '../../types/index';
11
11
  import { EventCenter } from '../../util/index';
@@ -13,7 +13,9 @@ export declare class AntomSDKCore {
13
13
  private sdkMetaData;
14
14
  private productProcessors;
15
15
  private enablePopWindowEventCallback;
16
+ private eventLogging;
16
17
  private status;
18
+ private logger;
17
19
  constructor();
18
20
  getStatus(): IElementStatus;
19
21
  setStatus(status: any): void;
@@ -27,6 +29,7 @@ export declare class AntomSDKCore {
27
29
  getPaymentContext(): PaymentContext;
28
30
  destroy(): void;
29
31
  private handleBehaviorRender;
32
+ private handleRemain;
30
33
  private handleClose;
31
34
  private cleanRender;
32
35
  getInstanceId(): string;
@@ -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,7 +36,9 @@ 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;
42
43
  }
43
44
  _createClass(AntomSDKCore, [{
@@ -84,6 +85,7 @@ export var AntomSDKCore = /*#__PURE__*/function () {
84
85
  };
85
86
  this.sdkMetaData.webAppVersion = getWebAppVersion(this.sdkMetaData);
86
87
  ServiceProvider.getInstance(this.instanceId).init(options, this.sdkMetaData);
88
+ this.logger = ServiceProvider.getInstance(this.instanceId).getService('Log');
87
89
  this.prepare(options, this.sdkMetaData);
88
90
  }
89
91
  }, {
@@ -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();
@@ -188,6 +213,12 @@ export var AntomSDKCore = /*#__PURE__*/function () {
188
213
  });
189
214
  eventCenter.listen(EVENT.eventCallback.name, function (data) {
190
215
  var _options$onEventCallb;
216
+ _this.logger.logInfo({
217
+ title: 'sdk_event_event_callback'
218
+ }, {
219
+ eventCode: JSON.stringify((data === null || data === void 0 ? void 0 : data.code) || ''),
220
+ eventMessage: JSON.stringify((data === null || data === void 0 ? void 0 : data.message) || '')
221
+ });
191
222
  (_options$onEventCallb = options.onEventCallback) === null || _options$onEventCallb === void 0 || _options$onEventCallb.call(options, data);
192
223
  });
193
224
  eventCenter.listen(EVENT.error.name, function (data) {
@@ -197,6 +228,7 @@ export var AntomSDKCore = /*#__PURE__*/function () {
197
228
  eventCenter.listen(EVENT.declareEventCallbackInfo.name, function (data) {
198
229
  if (data !== null && data !== void 0 && data.popWindowEventInfo) {
199
230
  _this.enablePopWindowEventCallback = data.popWindowEventInfo.enableCallback;
231
+ _this.eventLogging = data.popWindowEventInfo.eventLogging;
200
232
  }
201
233
  });
202
234
 
@@ -208,18 +240,21 @@ export var AntomSDKCore = /*#__PURE__*/function () {
208
240
  }, {
209
241
  key: "startBizFlow",
210
242
  value: function () {
211
- var _startBizFlow = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(options) {
243
+ var _startBizFlow = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(options) {
212
244
  var _this$paymentContext$, _this$paymentContext$2, _this$paymentContext$3;
213
245
  var paymentSession, displayInfo, _convertPaymentSessio2, paymentSessionId, paymentSessionMetaData, mid, webAppMatchConfig, webAppVersion, productScene, paymentMethod, _this$bizFlowStartBeh, payload;
214
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
215
- while (1) switch (_context3.prev = _context3.next) {
246
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
247
+ while (1) switch (_context4.prev = _context4.next) {
216
248
  case 0:
217
249
  if (!(!options || !options.paymentSession)) {
218
- _context3.next = 2;
250
+ _context4.next = 2;
219
251
  break;
220
252
  }
221
253
  throw new Error('paymentSession is empty');
222
254
  case 2:
255
+ this.logger.logInfo({
256
+ title: 'sdk_event_createComponent'
257
+ });
223
258
  this.setStatus(IElementStatus.IN_BIZ_FLOW);
224
259
  paymentSession = options.paymentSession, displayInfo = options.displayInfo;
225
260
  _convertPaymentSessio2 = convertPaymentSession(paymentSession), paymentSessionId = _convertPaymentSessio2.id, paymentSessionMetaData = _convertPaymentSessio2.data;
@@ -245,61 +280,61 @@ export var AntomSDKCore = /*#__PURE__*/function () {
245
280
  // Invoke processor
246
281
  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
282
  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
- _context3.prev = 14;
283
+ _context4.prev = 15;
249
284
  if (!this.productProcessors["".concat(productScene, "|").concat(paymentMethod)]) {
250
- _context3.next = 21;
285
+ _context4.next = 22;
251
286
  break;
252
287
  }
253
- _context3.next = 18;
288
+ _context4.next = 19;
254
289
  return this.productProcessors["".concat(productScene, "|").concat(paymentMethod)].startBizFlow(this.paymentContext);
255
- case 18:
256
- this.bizFlowStartBehavior = _context3.sent;
257
- _context3.next = 25;
290
+ case 19:
291
+ this.bizFlowStartBehavior = _context4.sent;
292
+ _context4.next = 26;
258
293
  break;
259
- case 21:
294
+ case 22:
260
295
  if (!this.productProcessors["".concat(productScene)]) {
261
- _context3.next = 25;
296
+ _context4.next = 26;
262
297
  break;
263
298
  }
264
- _context3.next = 24;
299
+ _context4.next = 25;
265
300
  return this.productProcessors["".concat(productScene)].startBizFlow(this.paymentContext);
266
- case 24:
267
- this.bizFlowStartBehavior = _context3.sent;
268
301
  case 25:
269
- _context3.next = 30;
302
+ this.bizFlowStartBehavior = _context4.sent;
303
+ case 26:
304
+ _context4.next = 31;
270
305
  break;
271
- case 27:
272
- _context3.prev = 27;
273
- _context3.t0 = _context3["catch"](14);
274
- console.error('Invoke processor failed', _context3.t0);
275
- case 30:
306
+ case 28:
307
+ _context4.prev = 28;
308
+ _context4.t0 = _context4["catch"](15);
309
+ console.error('Invoke processor failed', _context4.t0);
310
+ case 31:
276
311
  if (!(!this.bizFlowStartBehavior || this.bizFlowStartBehavior.behaviorType === 'NONE' || !this.bizFlowStartBehavior.payload)) {
277
- _context3.next = 32;
312
+ _context4.next = 33;
278
313
  break;
279
314
  }
280
- return _context3.abrupt("return");
281
- case 32:
315
+ return _context4.abrupt("return");
316
+ case 33:
282
317
  if (!(this.bizFlowStartBehavior.behaviorType === 'RENDER')) {
283
- _context3.next = 35;
318
+ _context4.next = 36;
284
319
  break;
285
320
  }
286
321
  this.handleBehaviorRender();
287
- return _context3.abrupt("return");
288
- case 35:
322
+ return _context4.abrupt("return");
323
+ case 36:
289
324
  if (!(this.bizFlowStartBehavior.behaviorType === 'REDIRECT')) {
290
- _context3.next = 39;
325
+ _context4.next = 40;
291
326
  break;
292
327
  }
293
328
  payload = (_this$bizFlowStartBeh = this.bizFlowStartBehavior) === null || _this$bizFlowStartBeh === void 0 ? void 0 : _this$bizFlowStartBeh.payload;
294
329
  redirect(payload, this.instanceId);
295
- return _context3.abrupt("return");
296
- case 39:
330
+ return _context4.abrupt("return");
331
+ case 40:
297
332
  case "end":
298
- return _context3.stop();
333
+ return _context4.stop();
299
334
  }
300
- }, _callee3, this, [[14, 27]]);
335
+ }, _callee4, this, [[15, 28]]);
301
336
  }));
302
- function startBizFlow(_x5) {
337
+ function startBizFlow(_x7) {
303
338
  return _startBizFlow.apply(this, arguments);
304
339
  }
305
340
  return startBizFlow;
@@ -342,7 +377,7 @@ export var AntomSDKCore = /*#__PURE__*/function () {
342
377
  showRetentionPopup();
343
378
  return;
344
379
  } else {
345
- _this2.handleClose(isOnCloseEvent);
380
+ _this2.handleClose(isOnCloseEvent, 'behavior');
346
381
  }
347
382
  };
348
383
 
@@ -368,9 +403,10 @@ export var AntomSDKCore = /*#__PURE__*/function () {
368
403
  if (displayType == DisplayTypeEnum.popup) {
369
404
  createRetentionPopup(platform, function () {
370
405
  hideRetentionPopup();
406
+ _this2.handleRemain();
371
407
  }, function () {
372
408
  hideRetentionPopup();
373
- _this2.handleClose();
409
+ _this2.handleClose(false, 'retention');
374
410
  });
375
411
  createMockup({
376
412
  platform: platform,
@@ -381,13 +417,40 @@ export var AntomSDKCore = /*#__PURE__*/function () {
381
417
  return;
382
418
  }
383
419
  }
420
+ }, {
421
+ key: "handleRemain",
422
+ value: function handleRemain() {
423
+ if (this.eventLogging && this.eventLogging.enableLogging) {
424
+ var _this$eventLogging, _this$eventLogging2, _this$eventLogging3, _this$eventLogging4;
425
+ this.logger.logInfo({
426
+ code: ((_this$eventLogging = this.eventLogging) === null || _this$eventLogging === void 0 ? void 0 : _this$eventLogging.eventName) || ''
427
+ }, {
428
+ eventId: EventLoggingEventId.ContinuePaying,
429
+ eventName: ((_this$eventLogging2 = this.eventLogging) === null || _this$eventLogging2 === void 0 ? void 0 : _this$eventLogging2.eventName) || '',
430
+ eventAlias: ((_this$eventLogging3 = this.eventLogging) === null || _this$eventLogging3 === void 0 ? void 0 : _this$eventLogging3.eventAlias) || '',
431
+ userPath: ((_this$eventLogging4 = this.eventLogging) === null || _this$eventLogging4 === void 0 ? void 0 : _this$eventLogging4.userPath) || ''
432
+ });
433
+ }
434
+ }
384
435
  }, {
385
436
  key: "handleClose",
386
437
  value: function handleClose() {
387
438
  var isOnCloseEvent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
439
+ var source = arguments.length > 1 ? arguments[1] : undefined;
388
440
  var eventCenter = ServiceProvider.getInstance(this.instanceId).getService('EventCenter');
389
441
  eventCenter.emit(EVENT.closeCallback.name, {});
390
442
  if (this.enablePopWindowEventCallback && !isOnCloseEvent) {
443
+ if (this.eventLogging && this.eventLogging.enableLogging) {
444
+ var _this$eventLogging5, _this$eventLogging6, _this$eventLogging7, _this$eventLogging8;
445
+ this.logger.logInfo({
446
+ code: ((_this$eventLogging5 = this.eventLogging) === null || _this$eventLogging5 === void 0 ? void 0 : _this$eventLogging5.eventName) || ''
447
+ }, {
448
+ eventId: source === 'behavior' ? EventLoggingEventId.OnlyClose : EventLoggingEventId.LeaveAnyWay,
449
+ eventName: ((_this$eventLogging6 = this.eventLogging) === null || _this$eventLogging6 === void 0 ? void 0 : _this$eventLogging6.eventName) || '',
450
+ eventAlias: ((_this$eventLogging7 = this.eventLogging) === null || _this$eventLogging7 === void 0 ? void 0 : _this$eventLogging7.eventAlias) || '',
451
+ userPath: ((_this$eventLogging8 = this.eventLogging) === null || _this$eventLogging8 === void 0 ? void 0 : _this$eventLogging8.userPath) || ''
452
+ });
453
+ }
391
454
  eventCenter.emit(EVENT.eventCallback.name, {
392
455
  code: eventCodeEnum.SDK_PAYMENT_CANCEL,
393
456
  result: {
@@ -423,6 +486,9 @@ export var AntomSDKCore = /*#__PURE__*/function () {
423
486
  setTimeout(function () {
424
487
  cleanElement();
425
488
  }, 300);
489
+ this.logger.logInfo({
490
+ title: 'sdk_event_destroyComponent'
491
+ });
426
492
  }
427
493
  }, {
428
494
  key: "getInstanceId",
@@ -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?: string;
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;