@alipay/ams-checkout 0.0.1729593469-dev.0 → 0.0.1730107332-dev.1

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 (126) hide show
  1. package/dist/umd/ams-checkout.min.js +1 -1
  2. package/esm/{plugin/component → component}/channel.d.ts +3 -4
  3. package/esm/{plugin/component → component}/channel.js +1 -37
  4. package/esm/component/component.inline.style.d.ts +10 -0
  5. package/esm/{plugin/component → component}/component.inline.style.js +11 -9
  6. package/esm/{plugin/component → component}/component.popup.style.d.ts +15 -6
  7. package/esm/{plugin/component → component}/component.popup.style.js +36 -18
  8. package/esm/{plugin/component → component}/popupWindow.style.js +2 -2
  9. package/esm/config/index.d.ts +7 -7
  10. package/esm/config/index.js +7 -7
  11. package/esm/constant/index.d.ts +7 -6
  12. package/esm/constant/index.js +11 -80
  13. package/esm/foundation/core/index.d.ts +26 -0
  14. package/esm/foundation/core/index.js +335 -0
  15. package/esm/foundation/index.d.ts +71 -0
  16. package/esm/foundation/index.js +42 -0
  17. package/esm/foundation/product-processor/easysafepay/deps.d.ts +17 -0
  18. package/esm/foundation/product-processor/easysafepay/deps.js +11 -0
  19. package/esm/foundation/product-processor/easysafepay/index.d.ts +27 -0
  20. package/esm/foundation/product-processor/easysafepay/index.js +581 -0
  21. package/esm/{core/bus → foundation/service/api-bus}/ability/callback.d.ts +2 -2
  22. package/esm/{core/bus → foundation/service/api-bus}/ability/callback.js +1 -1
  23. package/esm/foundation/service/api-bus/ability/globalData.d.ts +10 -0
  24. package/esm/{core/component/address.js → foundation/service/api-bus/ability/globalData.js} +75 -58
  25. package/esm/foundation/service/api-bus/ability/request.d.ts +10 -0
  26. package/esm/foundation/service/api-bus/ability/request.js +151 -0
  27. package/esm/{core/bus → foundation/service/api-bus}/ability/security.d.ts +6 -4
  28. package/esm/{core/bus → foundation/service/api-bus}/ability/security.js +92 -35
  29. package/esm/{core/bus → foundation/service/api-bus}/ability/tracker.d.ts +4 -4
  30. package/esm/{core/bus → foundation/service/api-bus}/ability/tracker.js +6 -3
  31. package/esm/{core/bus/index.d.ts → foundation/service/api-bus/busManager.d.ts} +17 -15
  32. package/esm/{core/bus/index.js → foundation/service/api-bus/busManager.js} +67 -35
  33. package/esm/foundation/service/api-bus/index.d.ts +20 -0
  34. package/esm/foundation/service/api-bus/index.js +88 -0
  35. package/esm/{core/bus → foundation/service/api-bus}/interface.d.ts +12 -0
  36. package/esm/{core/bus → foundation/service/api-bus}/interface.js +16 -2
  37. package/esm/foundation/service/container/index.d.ts +28 -0
  38. package/esm/foundation/service/container/index.js +257 -0
  39. package/esm/foundation/service/container/popup.d.ts +17 -0
  40. package/esm/{core/component/appPreloadProcessing.js → foundation/service/container/popup.js} +97 -83
  41. package/esm/foundation/service/container/utils.d.ts +7 -0
  42. package/esm/foundation/service/container/utils.js +48 -0
  43. package/esm/foundation/service/event-center.d.ts +74 -0
  44. package/esm/foundation/service/event-center.js +213 -0
  45. package/esm/foundation/service/global-data/index.d.ts +11 -0
  46. package/esm/foundation/service/global-data/index.js +68 -0
  47. package/esm/foundation/service/index.d.ts +19 -0
  48. package/esm/foundation/service/index.js +82 -0
  49. package/esm/foundation/service/log/index.d.ts +43 -0
  50. package/esm/foundation/service/log/index.js +235 -0
  51. package/esm/foundation/service/log/types.d.ts +32 -0
  52. package/esm/foundation/service/requester/deps.d.ts +17 -0
  53. package/esm/foundation/service/requester/deps.js +11 -0
  54. package/esm/foundation/service/requester/requester.d.ts +22 -0
  55. package/esm/foundation/service/requester/requester.js +214 -0
  56. package/esm/foundation/service/security/index.d.ts +28 -0
  57. package/esm/foundation/service/security/index.js +285 -0
  58. package/esm/{util → foundation/service/security}/security.d.ts +2 -2
  59. package/esm/{util → foundation/service/security}/security.js +3 -3
  60. package/esm/foundation/types/index.d.ts +4 -0
  61. package/esm/foundation/types/index.js +4 -0
  62. package/esm/foundation/utils/gray_scale_utils.d.ts +7 -0
  63. package/esm/foundation/utils/gray_scale_utils.js +40 -0
  64. package/esm/foundation/utils/payment_context_utils.d.ts +13 -0
  65. package/esm/foundation/utils/payment_context_utils.js +57 -0
  66. package/esm/foundation/utils/payment_product_utils.d.ts +13 -0
  67. package/esm/foundation/utils/payment_product_utils.js +38 -0
  68. package/esm/foundation/utils/redirect_utils.d.ts +6 -0
  69. package/esm/foundation/utils/redirect_utils.js +99 -0
  70. package/esm/foundation/utils/system_events.d.ts +4 -0
  71. package/esm/foundation/utils/system_events.js +71 -0
  72. package/esm/foundation/utils/web_app_url_utils.d.ts +46 -0
  73. package/esm/foundation/utils/web_app_url_utils.js +112 -0
  74. package/esm/index.d.ts +5 -28
  75. package/esm/index.js +28 -158
  76. package/esm/types/index.d.ts +66 -38
  77. package/esm/types/index.js +63 -59
  78. package/esm/util/index.d.ts +1 -1
  79. package/esm/util/index.js +3 -4
  80. package/package.json +2 -2
  81. package/esm/core/component/address.d.ts +0 -8
  82. package/esm/core/component/appPreloadProcessing.d.ts +0 -1
  83. package/esm/core/component/ckp/index.d.ts +0 -27
  84. package/esm/core/component/ckp/index.js +0 -166
  85. package/esm/core/component/index.d.ts +0 -51
  86. package/esm/core/component/index.js +0 -531
  87. package/esm/core/drop-in/index.d.ts +0 -22
  88. package/esm/core/drop-in/index.js +0 -104
  89. package/esm/core/instance/index.d.ts +0 -89
  90. package/esm/core/instance/index.js +0 -499
  91. package/esm/plugin/applepay/component.d.ts +0 -50
  92. package/esm/plugin/applepay/component.js +0 -339
  93. package/esm/plugin/applepay/index.d.ts +0 -17
  94. package/esm/plugin/applepay/index.js +0 -117
  95. package/esm/plugin/applepay/interface.d.ts +0 -161
  96. package/esm/plugin/applepay/interface.js +0 -69
  97. package/esm/plugin/applepay/service.d.ts +0 -54
  98. package/esm/plugin/applepay/service.js +0 -289
  99. package/esm/plugin/component/cashierApp.d.ts +0 -34
  100. package/esm/plugin/component/cashierApp.js +0 -237
  101. package/esm/plugin/component/component.inline.style.d.ts +0 -10
  102. package/esm/plugin/component/index.d.ts +0 -126
  103. package/esm/plugin/component/index.js +0 -1839
  104. package/esm/plugin/const.d.ts +0 -2
  105. package/esm/plugin/const.js +0 -33
  106. package/esm/plugin/drop-in/index.d.ts +0 -71
  107. package/esm/plugin/drop-in/index.js +0 -324
  108. package/esm/plugin/payment-element/utils.d.ts +0 -2
  109. package/esm/plugin/payment-element/utils.js +0 -6
  110. package/esm/plugin/paypal/index.d.ts +0 -20
  111. package/esm/plugin/paypal/index.js +0 -390
  112. package/esm/plugin/type.d.ts +0 -34
  113. package/esm/plugin/utils.d.ts +0 -6
  114. package/esm/plugin/utils.js +0 -21
  115. package/esm/util/createIframeNode.d.ts +0 -6
  116. package/esm/util/createIframeNode.js +0 -48
  117. package/esm/util/getBackScheme.d.ts +0 -5
  118. package/esm/util/getBackScheme.js +0 -42
  119. package/esm/util/ua/index.d.ts +0 -2
  120. package/esm/util/ua/index.js +0 -2
  121. package/esm/util/ua/isAndroid.d.ts +0 -4
  122. package/esm/util/ua/isAndroid.js +0 -7
  123. package/esm/util/ua/isIOS.d.ts +0 -4
  124. package/esm/util/ua/isIOS.js +0 -7
  125. /package/esm/{plugin/component → component}/popupWindow.style.d.ts +0 -0
  126. /package/esm/{plugin/type.js → foundation/service/log/types.js} +0 -0
@@ -10,6 +10,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
10
10
  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; }
11
11
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
12
12
  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); }
13
+ import { ServiceProvider } from '..';
13
14
  /**
14
15
  * Bus 埋点内容定义
15
16
  */
@@ -121,20 +122,26 @@ export var BusSubscriber = /*#__PURE__*/_createClass(function BusSubscriber() {
121
122
  */
122
123
  export var BusManager = /*#__PURE__*/function () {
123
124
  function BusManager() {
125
+ var instanceId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
124
126
  _classCallCheck(this, BusManager);
127
+ // Instance Variable
128
+ _defineProperty(this, "isDebug", true);
129
+ _defineProperty(this, "instanceId", void 0);
130
+ _defineProperty(this, "logger", void 0);
131
+ this.instanceId = instanceId;
132
+ this.logger = ServiceProvider.getInstance(this.instanceId).getService('Log');
125
133
  }
126
- _createClass(BusManager, null, [{
134
+ _createClass(BusManager, [{
127
135
  key: "debugTrace",
128
- value: function debugTrace(enable, logger) {
136
+ value: function debugTrace(enable) {
129
137
  this.isDebug = enable;
130
- this.logger = logger;
131
138
  }
132
139
  }, {
133
140
  key: "traceLog",
134
141
  value: function traceLog(title, optionalParams) {
135
142
  var report = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
136
143
  if (this.isDebug) {
137
- console.log([BusManager.TAG, title].concat(JSON.stringify(optionalParams)).join(this._logSplit));
144
+ console.log([BusManager.TAG, title].concat(JSON.stringify(optionalParams)).join(BusManager._logSplit));
138
145
  }
139
146
  if (report && this.logger) {
140
147
  this.logger.logInfo({
@@ -148,7 +155,7 @@ export var BusManager = /*#__PURE__*/function () {
148
155
  key: "traceError",
149
156
  value: function traceError(title, optionalParams) {
150
157
  if (this.isDebug) {
151
- console.error([BusManager.TAG, title].concat(JSON.stringify(optionalParams)).join(this._logSplit));
158
+ console.error([BusManager.TAG, title].concat(JSON.stringify(optionalParams)).join(BusManager._logSplit));
152
159
  }
153
160
  if (this.logger) {
154
161
  this.logger.logError({
@@ -161,14 +168,14 @@ export var BusManager = /*#__PURE__*/function () {
161
168
  }, {
162
169
  key: "clear",
163
170
  value: function clear() {
164
- BusManager.traceLog(BusLogEventEnum.sdk_event_busClear);
171
+ this.traceLog(BusLogEventEnum.sdk_event_busClear);
165
172
  BusManager.interceptors.length = 0;
166
173
  BusManager.subscribersMap.clear();
167
174
  }
168
175
  }, {
169
176
  key: "addInterceptor",
170
177
  value: function addInterceptor(interceptor) {
171
- BusManager.traceLog(BusLogEventEnum.sdk_event_busAddInterceptor);
178
+ this.traceLog(BusLogEventEnum.sdk_event_busAddInterceptor);
172
179
  if (!BusManager.interceptors.includes(interceptor)) {
173
180
  BusManager.interceptors.push(interceptor);
174
181
  }
@@ -186,7 +193,7 @@ export var BusManager = /*#__PURE__*/function () {
186
193
  });
187
194
  setTimeout(function () {
188
195
  if (failed) {
189
- BusManager.traceError(BusLogEventEnum.sdk_error_busPublishNoResult, {
196
+ _this.traceError(BusLogEventEnum.sdk_error_busPublishNoResult, {
190
197
  action: message.getAction()
191
198
  });
192
199
  if ((config === null || config === void 0 ? void 0 : config.fallback) !== null) {
@@ -201,20 +208,27 @@ export var BusManager = /*#__PURE__*/function () {
201
208
  }, {
202
209
  key: "publish",
203
210
  value: function publish(message, callback) {
211
+ var _this2 = this;
204
212
  var _callBack = function _callBack(result) {
205
- BusManager.traceLog(BusLogEventEnum.sdk_event_busPublishCallback, {
206
- action: message.getAction()
213
+ _this2.traceLog(BusLogEventEnum.sdk_event_busPublishCallback, {
214
+ action: message.getAction(),
215
+ instanceId: _this2.instanceId
207
216
  });
208
217
  if (callback) {
209
218
  callback(result);
210
219
  }
211
220
  };
212
221
  var context = new BusContext(_callBack);
213
- var actionName = message.getAction();
222
+ var actionName = this.instanceId ? BusManager.getInstanceActionName(message.getAction(), this.instanceId) : message.getAction();
214
223
  var subscribers = BusManager.subscribersMap.get(actionName);
215
- BusManager.traceLog(BusLogEventEnum.sdk_event_busPublishMessage, {
216
- action: message.getAction()
224
+ this.traceLog(BusLogEventEnum.sdk_event_busPublishMessage, {
225
+ action: message.getAction(),
226
+ instanceId: this.instanceId
217
227
  });
228
+ if (!subscribers && this.instanceId) {
229
+ // 如果没有找到特定实例的订阅者,尝试查找通用订阅者
230
+ subscribers = BusManager.subscribersMap.get(message.getAction());
231
+ }
218
232
  if (subscribers) {
219
233
  var _iterator = _createForOfIteratorHelper(subscribers),
220
234
  _step;
@@ -224,8 +238,9 @@ export var BusManager = /*#__PURE__*/function () {
224
238
  try {
225
239
  subscriber.onMessage(context, message);
226
240
  } catch (e) {
227
- BusManager.traceError(BusLogEventEnum.sdk_error_busPublishError, {
241
+ this.traceError(BusLogEventEnum.sdk_error_busPublishError, {
228
242
  action: message.getAction(),
243
+ instanceId: this.instanceId,
229
244
  error: e
230
245
  });
231
246
  var _iterator2 = _createForOfIteratorHelper(BusManager.interceptors),
@@ -254,7 +269,6 @@ export var BusManager = /*#__PURE__*/function () {
254
269
  try {
255
270
  for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
256
271
  var _interceptor = _step3.value;
257
- BusManager.traceLog('onUnsubscribedAction', JSON.stringify(message));
258
272
  handle = handle || (_interceptor === null || _interceptor === void 0 ? void 0 : _interceptor.onUnsubscribedAction(message.getAction()));
259
273
  }
260
274
  } catch (err) {
@@ -263,10 +277,11 @@ export var BusManager = /*#__PURE__*/function () {
263
277
  _iterator3.f();
264
278
  }
265
279
  if (handle) {
266
- BusManager.publish(message, callback); // Re-publish the message
280
+ this.publish(message, callback); // Re-publish the message
267
281
  } else {
268
- BusManager.traceError(BusLogEventEnum.sdk_error_busPublishUnsubscribeError, {
269
- action: message.getAction()
282
+ this.traceError(BusLogEventEnum.sdk_error_busPublishUnsubscribeError, {
283
+ action: message.getAction(),
284
+ instanceId: this.instanceId
270
285
  });
271
286
  }
272
287
  }
@@ -274,18 +289,20 @@ export var BusManager = /*#__PURE__*/function () {
274
289
  }, {
275
290
  key: "subscribe",
276
291
  value: function subscribe(subscriber) {
277
- BusManager.traceLog(BusLogEventEnum.sdk_event_busSubscribe, {
278
- actions: subscriber === null || subscriber === void 0 ? void 0 : subscriber.actionNames()
292
+ this.traceLog(BusLogEventEnum.sdk_event_busSubscribe, {
293
+ actions: subscriber.actionNames(),
294
+ instanceId: this.instanceId
279
295
  });
280
296
  var _iterator4 = _createForOfIteratorHelper(subscriber.actionNames()),
281
297
  _step4;
282
298
  try {
283
299
  for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
284
300
  var _actionName = _step4.value;
285
- if (!BusManager.subscribersMap.has(_actionName)) {
286
- BusManager.subscribersMap.set(_actionName, []);
301
+ var key = this.instanceId ? BusManager.getInstanceActionName(_actionName, this.instanceId) : _actionName;
302
+ if (!BusManager.subscribersMap.has(key)) {
303
+ BusManager.subscribersMap.set(key, []);
287
304
  }
288
- var subscribers = BusManager.subscribersMap.get(_actionName);
305
+ var subscribers = BusManager.subscribersMap.get(key);
289
306
  if (subscribers && !subscribers.includes(subscriber)) {
290
307
  subscribers.push(subscriber);
291
308
  }
@@ -299,20 +316,25 @@ export var BusManager = /*#__PURE__*/function () {
299
316
  }, {
300
317
  key: "unsubscribe",
301
318
  value: function unsubscribe(subscriber) {
302
- BusManager.traceLog(BusLogEventEnum.sdk_event_busUnsubscribe, {
303
- actions: subscriber === null || subscriber === void 0 ? void 0 : subscriber.actionNames()
319
+ this.traceLog(BusLogEventEnum.sdk_event_busUnsubscribe, {
320
+ actions: subscriber.actionNames(),
321
+ instanceId: this.instanceId
304
322
  });
305
323
  var _iterator5 = _createForOfIteratorHelper(subscriber.actionNames()),
306
324
  _step5;
307
325
  try {
308
326
  for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
309
327
  var _actionName2 = _step5.value;
310
- var subscribers = BusManager.subscribersMap.get(_actionName2);
328
+ var key = this.instanceId ? BusManager.getInstanceActionName(_actionName2, this.instanceId) : _actionName2;
329
+ var subscribers = BusManager.subscribersMap.get(key);
311
330
  if (subscribers) {
312
331
  var index = subscribers.indexOf(subscriber);
313
332
  if (index !== -1) {
314
333
  subscribers.splice(index, 1);
315
334
  }
335
+ if (subscribers.length === 0) {
336
+ BusManager.subscribersMap.delete(key);
337
+ }
316
338
  }
317
339
  }
318
340
  } catch (err) {
@@ -324,10 +346,16 @@ export var BusManager = /*#__PURE__*/function () {
324
346
  }, {
325
347
  key: "isSubscribed",
326
348
  value: function isSubscribed(actionName) {
327
- var subscribers = BusManager.subscribersMap.get(actionName);
349
+ var key = this.instanceId ? BusManager.getInstanceActionName(actionName, this.instanceId) : actionName;
350
+ var subscribers = BusManager.subscribersMap.get(key);
351
+ if (!subscribers && this.instanceId) {
352
+ // 如果没有找到特定实例的订阅者,检查是否有通用订阅者
353
+ subscribers = BusManager.subscribersMap.get(actionName);
354
+ }
328
355
  if (subscribers && subscribers.length > 0) {
329
- BusManager.traceLog(BusLogEventEnum.sdk_event_busIsSubscribe, {
356
+ this.traceLog(BusLogEventEnum.sdk_event_busIsSubscribe, {
330
357
  action: actionName,
358
+ instanceId: this.instanceId,
331
359
  sub: true
332
360
  });
333
361
  return true;
@@ -346,21 +374,25 @@ export var BusManager = /*#__PURE__*/function () {
346
374
  _iterator6.f();
347
375
  }
348
376
  if (handle) {
349
- // 内部会上报
350
- return BusManager.subscribersMap.has(actionName);
377
+ return BusManager.subscribersMap.has(key);
351
378
  }
352
- BusManager.traceLog(BusLogEventEnum.sdk_event_busIsSubscribe, {
379
+ this.traceLog(BusLogEventEnum.sdk_event_busIsSubscribe, {
353
380
  action: actionName,
381
+ instanceId: this.instanceId,
354
382
  sub: false
355
383
  });
356
384
  return false;
357
385
  }
386
+ }], [{
387
+ key: "getInstanceActionName",
388
+ value: function getInstanceActionName(actionName, instanceId) {
389
+ return "".concat(actionName, "@").concat(instanceId);
390
+ }
358
391
  }]);
359
392
  return BusManager;
360
393
  }();
361
- _defineProperty(BusManager, "TAG", 'BusManager');
362
- _defineProperty(BusManager, "_logSplit", ' , ');
394
+ // Static Variable
363
395
  _defineProperty(BusManager, "interceptors", []);
364
396
  _defineProperty(BusManager, "subscribersMap", new Map());
365
- _defineProperty(BusManager, "isDebug", true);
366
- _defineProperty(BusManager, "logger", void 0);
397
+ _defineProperty(BusManager, "TAG", 'BusManager');
398
+ _defineProperty(BusManager, "_logSplit", ' , ');
@@ -0,0 +1,20 @@
1
+ import { Service } from '../../index';
2
+ import { IOptionsParams } from '../../../types';
3
+ import { LogService } from '../log';
4
+ import { BusMessage, BusSubscriber, OnBusCallback } from './busManager';
5
+ /**
6
+ * @author 谦彧 <zhangmian.zm@alipay.com>
7
+ * @date 2024/9/17
8
+ */
9
+ export declare class ApiBusManagerService implements Service {
10
+ protected logger: LogService;
11
+ protected instanceId: string;
12
+ private busManager;
13
+ init(initOptions: IOptionsParams, instanceId: string): void;
14
+ subscribe(subscriber: BusSubscriber): void;
15
+ unsubscribe(subscriber: BusSubscriber): void;
16
+ isSubscribed(actionName: string): boolean;
17
+ publish(message: BusMessage, callback?: OnBusCallback): void;
18
+ update(): void;
19
+ destroy(): void;
20
+ }
@@ -0,0 +1,88 @@
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; }
4
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5
+ 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); } }
6
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
7
+ 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; }
8
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
9
+ 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); }
10
+ import { EnvironmentEnum } from "../../../types";
11
+ import { TrackerBusSubscriber } from "./ability/tracker";
12
+ import { ServiceProvider } from '..';
13
+ import { SecurityBusSubscriber } from "./ability/security";
14
+ import { DataBusSubscriber } from "./ability/globalData";
15
+ import { RequestBusSubscriber } from "./ability/request";
16
+ import { BusManager } from "./busManager";
17
+
18
+ /**
19
+ * @author 谦彧 <zhangmian.zm@alipay.com>
20
+ * @date 2024/9/17
21
+ */
22
+ export var ApiBusManagerService = /*#__PURE__*/function () {
23
+ function ApiBusManagerService() {
24
+ _classCallCheck(this, ApiBusManagerService);
25
+ _defineProperty(this, "logger", void 0);
26
+ _defineProperty(this, "instanceId", void 0);
27
+ _defineProperty(this, "busManager", void 0);
28
+ }
29
+ _createClass(ApiBusManagerService, [{
30
+ key: "init",
31
+ value: function init(initOptions, instanceId) {
32
+ var _this = this;
33
+ this.instanceId = instanceId;
34
+ this.logger = ServiceProvider.getInstance(this.instanceId).getService('Log');
35
+ this.busManager = new BusManager(this.instanceId);
36
+ this.busManager.debugTrace((initOptions === null || initOptions === void 0 ? void 0 : initOptions.environment) !== EnvironmentEnum.prod);
37
+ this.busManager.clear();
38
+ // addInterceptor
39
+ this.busManager.addInterceptor({
40
+ onPublishException: function onPublishException(message, e) {
41
+ _this.logger.logError({
42
+ title: 'onBusPublishException'
43
+ }, _objectSpread(_objectSpread({}, message), {}, {
44
+ errorMessage: JSON.stringify(e)
45
+ }));
46
+ }
47
+ });
48
+ // subscribe basic ability TODO
49
+ // this.busManager.subscribe(
50
+ // new SDKCallbackBusSubscriber((state: { code: string; message?: string; result?: EventCallbackResult }) => {
51
+ // const eventCenter = ServiceProvider.getInstance(this.instanceId).getService<EventCenter>('EventCenter');
52
+ // eventCenter.emit(EVENT.eventCallback.name, state);
53
+ // }),
54
+ // );
55
+ this.busManager.subscribe(new SecurityBusSubscriber(this.instanceId));
56
+ this.busManager.subscribe(new TrackerBusSubscriber(this.instanceId));
57
+ this.busManager.subscribe(new DataBusSubscriber(this.instanceId));
58
+ this.busManager.subscribe(new RequestBusSubscriber(this.instanceId));
59
+ }
60
+ }, {
61
+ key: "subscribe",
62
+ value: function subscribe(subscriber) {
63
+ this.busManager.subscribe(subscriber);
64
+ }
65
+ }, {
66
+ key: "unsubscribe",
67
+ value: function unsubscribe(subscriber) {
68
+ this.busManager.unsubscribe(subscriber);
69
+ }
70
+ }, {
71
+ key: "isSubscribed",
72
+ value: function isSubscribed(actionName) {
73
+ return this.busManager.isSubscribed(actionName);
74
+ }
75
+ }, {
76
+ key: "publish",
77
+ value: function publish(message, callback) {
78
+ this.busManager.publish(message, callback);
79
+ }
80
+ }, {
81
+ key: "update",
82
+ value: function update() {}
83
+ }, {
84
+ key: "destroy",
85
+ value: function destroy() {}
86
+ }]);
87
+ return ApiBusManagerService;
88
+ }();
@@ -13,7 +13,19 @@ export declare enum PaypalActionEnum {
13
13
  export declare enum SDKCallbackActionEnum {
14
14
  onEventCallback = "onEventCallback"
15
15
  }
16
+ export declare enum RequestActiontEnum {
17
+ request = "request",
18
+ getEnvInfo = "getEnvInfo",
19
+ getUserAgent = "getUserAgent"
20
+ }
21
+ export declare enum DataActiontEnum {
22
+ getGlobalData = "getGlobalData",
23
+ setGlobalData = "setGlobalData",
24
+ clearGlobalData = "clearGlobalData"
25
+ }
16
26
  export declare enum SecuritySDKActionEnum {
27
+ preInitSecurity = "preInitSecurity",
28
+ initSecurity = "initSecurity",
17
29
  getSecurityDeviceId = "getSecurityDeviceId"
18
30
  }
19
31
  export declare enum TrackerActionEnum {
@@ -17,7 +17,21 @@ export var SDKCallbackActionEnum = /*#__PURE__*/function (SDKCallbackActionEnum)
17
17
  SDKCallbackActionEnum["onEventCallback"] = "onEventCallback";
18
18
  return SDKCallbackActionEnum;
19
19
  }({});
20
+ export var RequestActiontEnum = /*#__PURE__*/function (RequestActiontEnum) {
21
+ RequestActiontEnum["request"] = "request";
22
+ RequestActiontEnum["getEnvInfo"] = "getEnvInfo";
23
+ RequestActiontEnum["getUserAgent"] = "getUserAgent";
24
+ return RequestActiontEnum;
25
+ }({});
26
+ export var DataActiontEnum = /*#__PURE__*/function (DataActiontEnum) {
27
+ DataActiontEnum["getGlobalData"] = "getGlobalData";
28
+ DataActiontEnum["setGlobalData"] = "setGlobalData";
29
+ DataActiontEnum["clearGlobalData"] = "clearGlobalData";
30
+ return DataActiontEnum;
31
+ }({});
20
32
  export var SecuritySDKActionEnum = /*#__PURE__*/function (SecuritySDKActionEnum) {
33
+ SecuritySDKActionEnum["preInitSecurity"] = "preInitSecurity";
34
+ SecuritySDKActionEnum["initSecurity"] = "initSecurity";
21
35
  SecuritySDKActionEnum["getSecurityDeviceId"] = "getSecurityDeviceId";
22
36
  return SecuritySDKActionEnum;
23
37
  }({});
@@ -29,10 +43,10 @@ export var ComponentActiontEnum = /*#__PURE__*/function (ComponentActiontEnum) {
29
43
  ComponentActiontEnum["onDestory"] = "onDestory";
30
44
  return ComponentActiontEnum;
31
45
  }({});
32
- export var RequestActiontEnum = /*#__PURE__*/function (RequestActiontEnum) {
46
+ RequestActiontEnum = /*#__PURE__*/function (RequestActiontEnum) {
33
47
  RequestActiontEnum["onDestory"] = "httpRequest";
34
48
  return RequestActiontEnum;
35
- }({});
49
+ }(RequestActiontEnum || {});
36
50
  export var LoadingActiontEnum = /*#__PURE__*/function (LoadingActiontEnum) {
37
51
  LoadingActiontEnum["showLoading"] = "showLoading";
38
52
  LoadingActiontEnum["dismissLoading"] = "dismissLoading";
@@ -0,0 +1,28 @@
1
+ import { DisplayInfo, SDKMetaData, Service } from '../../index';
2
+ import { IOptionsParams } from '../../../types';
3
+ export declare class ContainerService implements Service {
4
+ private instanceId;
5
+ private sdkMetaData;
6
+ private clearTimerIdMapping;
7
+ private popupManager;
8
+ private eventCenter;
9
+ private logService;
10
+ private displayInfo;
11
+ private webApp;
12
+ private customizedLoadingListener;
13
+ destroy(): void;
14
+ init(initOptions: IOptionsParams, instanceId: string, sdkMetaData: SDKMetaData): void;
15
+ update(): void;
16
+ load(displayInfo: DisplayInfo, url: string, closeBtnFunc: () => void): HTMLDivElement;
17
+ cleanContainer(displayInfo: DisplayInfo): void;
18
+ preload(taskId: string, url: string): void;
19
+ clearPreloadContainer(taskId: string): void;
20
+ showLoading(container: HTMLDivElement, displayInfo: DisplayInfo): void;
21
+ dismissLoading(isKeepMockup?: boolean): void;
22
+ customizeLoading(listener: (event: 'SDK_START_OF_LOADING' | 'SDK_END_OF_LOADING') => void): void;
23
+ startHideAnim(): void;
24
+ private addCapabilityToEventCenter;
25
+ private addCapabilityToApiBusManager;
26
+ private handleSizeChanged;
27
+ private changeCloseBtnVisibility;
28
+ }