@alipay/ams-checkout 0.0.1710212811-dev.10 → 0.0.1710212811-dev.11

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.
@@ -47,7 +47,7 @@ export var SDKCallbackBusSubscriber = /*#__PURE__*/function (_BusSubscriber) {
47
47
  this.onEventCallback(message);
48
48
  break;
49
49
  default:
50
- throw new Error("Unknown action: " + message.getAction());
50
+ console.log("Unknown action: " + message.getAction());
51
51
  }
52
52
  }
53
53
  }]);
@@ -0,0 +1,10 @@
1
+ import { DeviceIdParameter } from '../../../types';
2
+ import { BusContext, BusMessage, BusSubscriber } from '../index';
3
+ export type onDeviceIdCallback = (deviceIdParameter: DeviceIdParameter, isPolling: boolean) => Promise<string>;
4
+ export declare class SecurityBusSubscriber extends BusSubscriber {
5
+ private _onDeviceIdCallback?;
6
+ constructor(onDeviceIdCallback?: onDeviceIdCallback);
7
+ actionNames(): string[];
8
+ protected getSecurityDeviceId(context: BusContext, message: BusMessage): Promise<void>;
9
+ onMessage(context: BusContext, message: BusMessage): void;
10
+ }
@@ -0,0 +1,91 @@
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 _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
+ 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
+ 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); }); }; }
5
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
+ 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); } }
7
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
8
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
9
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
10
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
11
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
12
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
13
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
14
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
15
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
16
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
17
+ 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); }
18
+ import { BusSubscriber } from "../index";
19
+ import { SecuritySDKActionEnum } from "../interface";
20
+ export var SecurityBusSubscriber = /*#__PURE__*/function (_BusSubscriber) {
21
+ _inherits(SecurityBusSubscriber, _BusSubscriber);
22
+ var _super = _createSuper(SecurityBusSubscriber);
23
+ function SecurityBusSubscriber(onDeviceIdCallback) {
24
+ var _this;
25
+ _classCallCheck(this, SecurityBusSubscriber);
26
+ _this = _super.call(this);
27
+ _defineProperty(_assertThisInitialized(_this), "_onDeviceIdCallback", void 0);
28
+ _this._onDeviceIdCallback = onDeviceIdCallback;
29
+ return _this;
30
+ }
31
+ _createClass(SecurityBusSubscriber, [{
32
+ key: "actionNames",
33
+ value: function actionNames() {
34
+ return Object.values(SecuritySDKActionEnum);
35
+ }
36
+ }, {
37
+ key: "getSecurityDeviceId",
38
+ value: function () {
39
+ var _getSecurityDeviceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(context, message) {
40
+ var data, deviceId;
41
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
42
+ while (1) switch (_context.prev = _context.next) {
43
+ case 0:
44
+ console.log('getSecurityDeviceId', message);
45
+ if (!this._onDeviceIdCallback) {
46
+ _context.next = 15;
47
+ break;
48
+ }
49
+ data = message.getJSONObject();
50
+ _context.prev = 3;
51
+ _context.next = 6;
52
+ return this._onDeviceIdCallback(data === null || data === void 0 ? void 0 : data.deviceIdParameter, data === null || data === void 0 ? void 0 : data.isPolling);
53
+ case 6:
54
+ deviceId = _context.sent;
55
+ context === null || context === void 0 || context.onCallBack(message.result(deviceId));
56
+ _context.next = 13;
57
+ break;
58
+ case 10:
59
+ _context.prev = 10;
60
+ _context.t0 = _context["catch"](3);
61
+ context === null || context === void 0 || context.onCallBack(message.result());
62
+ case 13:
63
+ _context.next = 16;
64
+ break;
65
+ case 15:
66
+ context === null || context === void 0 || context.onCallBack(message.result());
67
+ case 16:
68
+ case "end":
69
+ return _context.stop();
70
+ }
71
+ }, _callee, this, [[3, 10]]);
72
+ }));
73
+ function getSecurityDeviceId(_x, _x2) {
74
+ return _getSecurityDeviceId.apply(this, arguments);
75
+ }
76
+ return getSecurityDeviceId;
77
+ }()
78
+ }, {
79
+ key: "onMessage",
80
+ value: function onMessage(context, message) {
81
+ switch (message.getAction()) {
82
+ case SecuritySDKActionEnum.getSecurityDeviceId:
83
+ this.getSecurityDeviceId(context, message);
84
+ break;
85
+ default:
86
+ console.log('Unknown action: ' + message.getAction());
87
+ }
88
+ }
89
+ }]);
90
+ return SecurityBusSubscriber;
91
+ }(BusSubscriber);
@@ -0,0 +1,9 @@
1
+ import { Logger } from '../../../util/logger';
2
+ import { BusContext, BusMessage, BusSubscriber } from '../index';
3
+ export declare class TrackerBusSubscriber extends BusSubscriber {
4
+ logger: Logger;
5
+ constructor(logger: Logger);
6
+ actionNames(): string[];
7
+ protected reportAnalytics(context: BusContext, message: BusMessage): Promise<void>;
8
+ onMessage(context: BusContext, message: BusMessage): void;
9
+ }
@@ -0,0 +1,77 @@
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 _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
+ 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
+ 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); }); }; }
5
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
+ 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); } }
7
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
8
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
9
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
10
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
11
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
12
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
13
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
14
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
15
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
16
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
17
+ 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); }
18
+ import { BusSubscriber } from "../index";
19
+ import { TrackerActionEnum } from "../interface";
20
+ export var TrackerBusSubscriber = /*#__PURE__*/function (_BusSubscriber) {
21
+ _inherits(TrackerBusSubscriber, _BusSubscriber);
22
+ var _super = _createSuper(TrackerBusSubscriber);
23
+ function TrackerBusSubscriber(logger) {
24
+ var _this;
25
+ _classCallCheck(this, TrackerBusSubscriber);
26
+ _this = _super.call(this);
27
+ _defineProperty(_assertThisInitialized(_this), "logger", void 0);
28
+ _this.logger = logger;
29
+ return _this;
30
+ }
31
+ _createClass(TrackerBusSubscriber, [{
32
+ key: "actionNames",
33
+ value: function actionNames() {
34
+ return Object.values(TrackerActionEnum);
35
+ }
36
+ }, {
37
+ key: "reportAnalytics",
38
+ value: function () {
39
+ var _reportAnalytics = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(context, message) {
40
+ var data;
41
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
42
+ while (1) switch (_context.prev = _context.next) {
43
+ case 0:
44
+ console.log('reportAnalytics', message);
45
+ data = message.getJSONObject();
46
+ if (this.logger && data !== null && data !== void 0 && data.basic) {
47
+ if ('error' === (data === null || data === void 0 ? void 0 : data.level)) {
48
+ this.logger.logError(data === null || data === void 0 ? void 0 : data.basic, data === null || data === void 0 ? void 0 : data.extra);
49
+ } else {
50
+ this.logger.logInfo(data === null || data === void 0 ? void 0 : data.basic, data === null || data === void 0 ? void 0 : data.extra);
51
+ }
52
+ }
53
+ case 3:
54
+ case "end":
55
+ return _context.stop();
56
+ }
57
+ }, _callee, this);
58
+ }));
59
+ function reportAnalytics(_x, _x2) {
60
+ return _reportAnalytics.apply(this, arguments);
61
+ }
62
+ return reportAnalytics;
63
+ }()
64
+ }, {
65
+ key: "onMessage",
66
+ value: function onMessage(context, message) {
67
+ switch (message.getAction()) {
68
+ case TrackerActionEnum.reportAnalytics:
69
+ this.reportAnalytics(context, message);
70
+ break;
71
+ default:
72
+ console.log('Unknown action: ' + message.getAction());
73
+ }
74
+ }
75
+ }]);
76
+ return TrackerBusSubscriber;
77
+ }(BusSubscriber);
@@ -5,13 +5,13 @@ export declare class BusMessage {
5
5
  private action;
6
6
  private data;
7
7
  private jsonData;
8
- constructor(action: string, data: string);
8
+ constructor(action: string, data?: string);
9
9
  getAction(): string;
10
10
  getData(): string;
11
11
  isJSONData(): boolean;
12
12
  getJSONObject(): any;
13
13
  private parseJSONData;
14
- result(result: boolean): BusMessage;
14
+ result(result?: any): BusMessage;
15
15
  }
16
16
  export type OnBusCallback = (message: BusMessage) => void;
17
17
  /**
@@ -51,8 +51,13 @@ export interface BusInterceptor {
51
51
  * 发送者 和 接收者的关系: 一对多,可能有,埋点多重上报?不需要callback,业务场景应该是一个广播场景
52
52
  */
53
53
  export declare class BusManager {
54
+ private static TAG;
54
55
  private static interceptors;
55
56
  private static subscribersMap;
57
+ private static isDebug;
58
+ static debugTrace(enable: boolean): void;
59
+ private static traceLog;
60
+ private static traceError;
56
61
  static clear(): void;
57
62
  static addInterceptor(interceptor: BusInterceptor): void;
58
63
  static publishForResult(message: BusMessage, timeoutMs?: number): Promise<BusMessage>;
@@ -57,9 +57,7 @@ export var BusMessage = /*#__PURE__*/function () {
57
57
  }, {
58
58
  key: "result",
59
59
  value: function result(_result) {
60
- return new BusMessage(this.action, JSON.stringify({
61
- result: _result
62
- }));
60
+ return new BusMessage(this.action, JSON.stringify(_result));
63
61
  }
64
62
  }]);
65
63
  return BusMessage;
@@ -106,14 +104,41 @@ export var BusManager = /*#__PURE__*/function () {
106
104
  _classCallCheck(this, BusManager);
107
105
  }
108
106
  _createClass(BusManager, null, [{
107
+ key: "debugTrace",
108
+ value: function debugTrace(enable) {
109
+ this.isDebug = enable;
110
+ }
111
+ }, {
112
+ key: "traceLog",
113
+ value: function traceLog(message) {
114
+ if (this.isDebug) {
115
+ for (var _len = arguments.length, optionalParams = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
116
+ optionalParams[_key - 1] = arguments[_key];
117
+ }
118
+ console.log(message, optionalParams);
119
+ }
120
+ }
121
+ }, {
122
+ key: "traceError",
123
+ value: function traceError(message) {
124
+ if (this.isDebug) {
125
+ for (var _len2 = arguments.length, optionalParams = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
126
+ optionalParams[_key2 - 1] = arguments[_key2];
127
+ }
128
+ console.error(message, optionalParams);
129
+ }
130
+ }
131
+ }, {
109
132
  key: "clear",
110
133
  value: function clear() {
134
+ BusManager.traceLog(BusManager, 'clear');
111
135
  BusManager.interceptors.length = 0;
112
136
  BusManager.subscribersMap.clear();
113
137
  }
114
138
  }, {
115
139
  key: "addInterceptor",
116
140
  value: function addInterceptor(interceptor) {
141
+ BusManager.traceLog(BusManager, 'addInterceptor');
117
142
  if (!BusManager.interceptors.includes(interceptor)) {
118
143
  BusManager.interceptors.push(interceptor);
119
144
  }
@@ -128,7 +153,7 @@ export var BusManager = /*#__PURE__*/function () {
128
153
  resolve(result);
129
154
  });
130
155
  setTimeout(function () {
131
- reject("publish timeout");
156
+ reject('publish timeout');
132
157
  }, timeoutMs);
133
158
  });
134
159
  }
@@ -138,6 +163,7 @@ export var BusManager = /*#__PURE__*/function () {
138
163
  var context = new BusContext(callback);
139
164
  var actionName = message.getAction();
140
165
  var subscribers = BusManager.subscribersMap.get(actionName);
166
+ BusManager.traceLog(BusManager, 'publish', message);
141
167
  if (subscribers) {
142
168
  var _iterator = _createForOfIteratorHelper(subscribers),
143
169
  _step;
@@ -147,6 +173,7 @@ export var BusManager = /*#__PURE__*/function () {
147
173
  try {
148
174
  subscriber.onMessage(context, message);
149
175
  } catch (e) {
176
+ BusManager.traceError(BusManager, 'excute onMessage error ', message, e);
150
177
  var _iterator2 = _createForOfIteratorHelper(BusManager.interceptors),
151
178
  _step2;
152
179
  try {
@@ -173,6 +200,7 @@ export var BusManager = /*#__PURE__*/function () {
173
200
  try {
174
201
  for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
175
202
  var _interceptor = _step3.value;
203
+ BusManager.traceLog(BusManager, 'onUnsubscribedAction', message);
176
204
  handle = handle || (_interceptor === null || _interceptor === void 0 ? void 0 : _interceptor.onUnsubscribedAction(message.getAction()));
177
205
  }
178
206
  } catch (err) {
@@ -183,37 +211,14 @@ export var BusManager = /*#__PURE__*/function () {
183
211
  if (handle) {
184
212
  BusManager.publish(message, callback); // Re-publish the message
185
213
  } else {
186
- // BusTraceUtils.notSubscribeMessage(message); // Implement this function as needed
214
+ BusManager.traceError(BusManager, 'notSubscribeMessage', message);
187
215
  }
188
216
  }
189
217
  }
190
-
191
- // public static publish(message: BusMessage): void {
192
- // const actionName = message.getAction();
193
- // const subscribers = BusManager.subscribersMap.get(actionName);
194
- // if (subscribers) {
195
- // for (const subscriber of subscribers) {
196
- // try {
197
- // subscriber.onMessage(context, message);
198
- // } catch (e) {
199
- // // BusTraceUtils.sendMessageError(message, e); // Implement this function as needed
200
- // }
201
- // }
202
- // } else {
203
- // let handle = false;
204
- // for (const interceptor of BusManager.interceptors) {
205
- // handle = handle || interceptor.onUnsubscribedAction(message.getAction());
206
- // }
207
- // if (handle) {
208
- // BusManager.publish(context, message); // Re-publish the message
209
- // } else {
210
- // // BusTraceUtils.notSubscribeMessage(message); // Implement this function as needed
211
- // }
212
- // }
213
- // }
214
218
  }, {
215
219
  key: "subscribe",
216
220
  value: function subscribe(subscriber) {
221
+ BusManager.traceLog(BusManager, 'subscribe', subscriber === null || subscriber === void 0 ? void 0 : subscriber.actionNames());
217
222
  var _iterator4 = _createForOfIteratorHelper(subscriber.actionNames()),
218
223
  _step4;
219
224
  try {
@@ -236,6 +241,7 @@ export var BusManager = /*#__PURE__*/function () {
236
241
  }, {
237
242
  key: "unsubscribe",
238
243
  value: function unsubscribe(subscriber) {
244
+ BusManager.traceLog(BusManager, 'unsubscribe', subscriber === null || subscriber === void 0 ? void 0 : subscriber.actionNames());
239
245
  var _iterator5 = _createForOfIteratorHelper(subscriber.actionNames()),
240
246
  _step5;
241
247
  try {
@@ -260,6 +266,7 @@ export var BusManager = /*#__PURE__*/function () {
260
266
  value: function isSubscribed(actionName) {
261
267
  var subscribers = BusManager.subscribersMap.get(actionName);
262
268
  if (subscribers && subscribers.length > 0) {
269
+ BusManager.traceLog(BusManager, 'isSubscribed: ' + actionName, true);
263
270
  return true;
264
271
  }
265
272
  var handle = false;
@@ -278,10 +285,13 @@ export var BusManager = /*#__PURE__*/function () {
278
285
  if (handle) {
279
286
  return BusManager.subscribersMap.has(actionName);
280
287
  }
288
+ BusManager.traceLog(BusManager, 'isSubscribed: ' + actionName, false);
281
289
  return false;
282
290
  }
283
291
  }]);
284
292
  return BusManager;
285
293
  }();
294
+ _defineProperty(BusManager, "TAG", 'BusManager');
286
295
  _defineProperty(BusManager, "interceptors", []);
287
- _defineProperty(BusManager, "subscribersMap", new Map());
296
+ _defineProperty(BusManager, "subscribersMap", new Map());
297
+ _defineProperty(BusManager, "isDebug", true);
@@ -9,6 +9,17 @@ export declare enum ApplePayActionEnum {
9
9
  export declare enum SDKCallbackActionEnum {
10
10
  onEventCallback = "onEventCallback"
11
11
  }
12
+ export declare enum SecuritySDKActionEnum {
13
+ getSecurityDeviceId = "getSecurityDeviceId"
14
+ }
15
+ export declare enum TrackerActionEnum {
16
+ /**
17
+ * level: string info/error
18
+ * basic: json object
19
+ * extra: json object
20
+ */
21
+ reportAnalytics = "reportAnalytics"
22
+ }
12
23
  export declare enum ComponentActiontEnum {
13
24
  onDestory = "onDestory"
14
25
  }
@@ -12,6 +12,14 @@ export var SDKCallbackActionEnum = /*#__PURE__*/function (SDKCallbackActionEnum)
12
12
  SDKCallbackActionEnum["onEventCallback"] = "onEventCallback";
13
13
  return SDKCallbackActionEnum;
14
14
  }({});
15
+ export var SecuritySDKActionEnum = /*#__PURE__*/function (SecuritySDKActionEnum) {
16
+ SecuritySDKActionEnum["getSecurityDeviceId"] = "getSecurityDeviceId";
17
+ return SecuritySDKActionEnum;
18
+ }({});
19
+ export var TrackerActionEnum = /*#__PURE__*/function (TrackerActionEnum) {
20
+ TrackerActionEnum["reportAnalytics"] = "reportAnalytics";
21
+ return TrackerActionEnum;
22
+ }({});
15
23
  export var ComponentActiontEnum = /*#__PURE__*/function (ComponentActiontEnum) {
16
24
  ComponentActiontEnum["onDestory"] = "onDestory";
17
25
  return ComponentActiontEnum;
@@ -30,15 +30,17 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
30
30
  import { v4 as uuid } from 'uuid';
31
31
  import { COMPONENTPLUGINID, ERRORMESSAGE, EVENT } from "../../constant";
32
32
  import ComponentApp from "../../plugin/component";
33
- import { componentSignEnum, modeEnum, networkModeEnum, PaymentMethodTypeEnum, productSceneEnum, renderDisplayTypeEnum } from "../../types";
33
+ import { componentSignEnum, environmentEnum, modeEnum, networkModeEnum, PaymentMethodTypeEnum, productSceneEnum, renderDisplayTypeEnum } from "../../types";
34
34
  import { getOrSetStorageId, isPC, parseBase64ToString } from "../../util";
35
35
  import { createIframeNode, createPreloadIframeNode } from "../../util/createIframeNode";
36
36
  import { getSecurityConfigStorageKey } from "../../util/security";
37
37
  import CoreInstance from "../instance/index";
38
38
  import { BusManager, BusMessage } from "../bus";
39
39
  import { ApplePayActionEnum, PaymentActionEnum } from "../bus/interface";
40
- import { SDKCallbackBusSubscriber } from "../bus/ability/sdk";
40
+ import { SDKCallbackBusSubscriber } from "../bus/ability/callback";
41
41
  import { ApplePayBusSubscriber } from "../../plugin/applepay";
42
+ import { SecurityBusSubscriber } from "../bus/ability/security";
43
+ import { TrackerBusSubscriber } from "../bus/ability/tracker";
42
44
  export var getComponentSign = function getComponentSign(params) {
43
45
  var _params$paymentSessio = params.paymentSessionConfig,
44
46
  _params$paymentSessio2 = _params$paymentSessio === void 0 ? {} : _params$paymentSessio,
@@ -202,8 +204,10 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
202
204
  }, {
203
205
  key: "registerBusAbility",
204
206
  value: function registerBusAbility() {
205
- var _this2 = this,
206
- _this$originOptions;
207
+ var _this$originOptions,
208
+ _this2 = this,
209
+ _this$originOptions2;
210
+ BusManager.debugTrace(((_this$originOptions = this.originOptions) === null || _this$originOptions === void 0 ? void 0 : _this$originOptions.environment) !== environmentEnum.prod);
207
211
  BusManager.clear();
208
212
  BusManager.addInterceptor({
209
213
  onPublishException: function onPublishException(message, e) {
@@ -214,8 +218,13 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
214
218
  }));
215
219
  }
216
220
  });
217
- BusManager.subscribe(new SDKCallbackBusSubscriber((_this$originOptions = this.originOptions) === null || _this$originOptions === void 0 ? void 0 : _this$originOptions.onEventCallback));
218
- BusManager.subscribe(new ApplePayBusSubscriber());
221
+ // subscribe basic ablility
222
+ BusManager.subscribe(new SDKCallbackBusSubscriber((_this$originOptions2 = this.originOptions) === null || _this$originOptions2 === void 0 ? void 0 : _this$originOptions2.onEventCallback));
223
+ BusManager.subscribe(new SecurityBusSubscriber(this._componentApp.getDeviceIdAndLog));
224
+ BusManager.subscribe(new TrackerBusSubscriber(this.logger));
225
+ // subscribe plugin
226
+ BusManager.subscribe(new ApplePayBusSubscriber(this.logger));
227
+ // publish devent
219
228
  BusManager.publish(new BusMessage(PaymentActionEnum.optional_init, JSON.stringify(this.originOptions)));
220
229
  }
221
230
  }, {
@@ -228,7 +237,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
228
237
  BusManager.publishForResult(new BusMessage(ApplePayActionEnum.canMakePayments, JSON.stringify({
229
238
  subPaymentMethod: subPaymentMethod
230
239
  }))).then(function (message) {
231
- resolve(message.getJSONObject().result);
240
+ resolve(message.getData() === 'true');
232
241
  }).catch(function (e) {
233
242
  _this3.logger.logInfo({
234
243
  title: 'canMakePayments_error'
@@ -6,25 +6,31 @@
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
8
  import { ApplePaySubTypeEnum, IApplePayOptionsParams } from '../../types';
9
- import CoreInstance from '../../core/instance';
9
+ import { Logger } from '../../util/logger';
10
10
  /**
11
11
  * Apple pay Component
12
12
  */
13
- declare class ApplePayComponent extends CoreInstance {
13
+ declare class ApplePayComponent {
14
14
  private _applePayService;
15
15
  private _parseData;
16
16
  private _sessionData;
17
17
  private _isFinish;
18
- constructor(options: IApplePayOptionsParams);
19
- private getDeviceIdAndLog;
20
- private logDeviceId;
18
+ private _options;
19
+ logger: Logger;
20
+ constructor(options: IApplePayOptionsParams, logger: Logger);
21
21
  /**
22
22
  * Is Apple Pay Enabled
23
23
  * @param subTypeEnum
24
24
  * @returns
25
25
  */
26
26
  canMakePayments(subTypeEnum?: ApplePaySubTypeEnum): boolean;
27
- isAppPayEnabled(): boolean;
27
+ /**
28
+ * Is Apple Pay Enabled
29
+ * @param subTypeEnum
30
+ * @returns
31
+ */
32
+ isAppPayEnabled(subTypeEnum?: ApplePaySubTypeEnum): boolean;
33
+ private onEventCallback;
28
34
  /**
29
35
  * Submit Pay
30
36
  * @param paymentSessionData