@alipay/ams-checkout 0.0.1710212811-dev.14 → 0.0.1710212811-dev.17

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.
@@ -39,6 +39,7 @@ import { BusManager, BusMessage } from "../bus";
39
39
  import { ApplePayActionEnum, PaymentActionEnum } from "../bus/interface";
40
40
  import { SDKCallbackBusSubscriber } from "../bus/ability/callback";
41
41
  import { ApplePayBusSubscriber } from "../../plugin/applepay";
42
+ import { SecurityBusSubscriber } from "../bus/ability/security";
42
43
  import { TrackerBusSubscriber } from "../bus/ability/tracker";
43
44
  export var getComponentSign = function getComponentSign(params) {
44
45
  var _params$paymentSessio = params.paymentSessionConfig,
@@ -110,7 +111,6 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
110
111
  function AMSComponent(options) {
111
112
  var _this;
112
113
  _classCallCheck(this, AMSComponent);
113
- BusManager.clear();
114
114
  _this = _super.call(this, options);
115
115
  // Instantiate the plug-in and set render
116
116
  _defineProperty(_assertThisInitialized(_this), "_componentApp", void 0);
@@ -205,9 +205,9 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
205
205
  key: "registerBusAbility",
206
206
  value: function registerBusAbility() {
207
207
  var _this$originOptions,
208
- _this2 = this,
209
- _this$originOptions2;
208
+ _this2 = this;
210
209
  BusManager.debugTrace(((_this$originOptions = this.originOptions) === null || _this$originOptions === void 0 ? void 0 : _this$originOptions.environment) !== environmentEnum.prod);
210
+ BusManager.clear();
211
211
  BusManager.addInterceptor({
212
212
  onPublishException: function onPublishException(message, e) {
213
213
  _this2.logger.logInfo({
@@ -218,7 +218,14 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
218
218
  }
219
219
  });
220
220
  // subscribe basic ablility
221
- BusManager.subscribe(new SDKCallbackBusSubscriber((_this$originOptions2 = this.originOptions) === null || _this$originOptions2 === void 0 ? void 0 : _this$originOptions2.onEventCallback));
221
+ BusManager.subscribe(new SDKCallbackBusSubscriber(function (state) {
222
+ var _this2$originOptions;
223
+ (_this2$originOptions = _this2.originOptions) === null || _this2$originOptions === void 0 || _this2$originOptions.onEventCallback(state);
224
+ }));
225
+ BusManager.subscribe(new SecurityBusSubscriber(function (deviceIdParameter, isPolling) {
226
+ var _this2$_componentApp;
227
+ return (_this2$_componentApp = _this2._componentApp) === null || _this2$_componentApp === void 0 ? void 0 : _this2$_componentApp.getDeviceIdAndLog(deviceIdParameter, isPolling);
228
+ }));
222
229
  BusManager.subscribe(new TrackerBusSubscriber(this.logger));
223
230
  // subscribe plugin
224
231
  BusManager.subscribe(new ApplePayBusSubscriber(this.logger));
@@ -126,58 +126,81 @@ var ApplePayComponent = /*#__PURE__*/function () {
126
126
  }).send();
127
127
  return;
128
128
  }
129
+ var getDeviceId = /*#__PURE__*/function () {
130
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
131
+ var _yield$BusManager$pub, _this$_parseData;
132
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
133
+ while (1) switch (_context.prev = _context.next) {
134
+ case 0:
135
+ _context.next = 2;
136
+ return BusManager.publishForResult(new BusMessage(SecuritySDKActionEnum.getSecurityDeviceId, JSON.stringify({
137
+ deviceIdParameter: {
138
+ productScene: (_this$_parseData = _this._parseData) === null || _this$_parseData === void 0 || (_this$_parseData = _this$_parseData.paymentSessionConfig) === null || _this$_parseData === void 0 ? void 0 : _this$_parseData.productScene
139
+ }
140
+ })));
141
+ case 2:
142
+ _context.t1 = _yield$BusManager$pub = _context.sent;
143
+ _context.t0 = _context.t1 === null;
144
+ if (_context.t0) {
145
+ _context.next = 6;
146
+ break;
147
+ }
148
+ _context.t0 = _yield$BusManager$pub === void 0;
149
+ case 6:
150
+ if (!_context.t0) {
151
+ _context.next = 10;
152
+ break;
153
+ }
154
+ _context.t2 = void 0;
155
+ _context.next = 11;
156
+ break;
157
+ case 10:
158
+ _context.t2 = _yield$BusManager$pub.getData();
159
+ case 11:
160
+ return _context.abrupt("return", _context.t2);
161
+ case 12:
162
+ case "end":
163
+ return _context.stop();
164
+ }
165
+ }, _callee);
166
+ }));
167
+ return function getDeviceId() {
168
+ return _ref.apply(this, arguments);
169
+ };
170
+ }();
129
171
  /**
130
172
  * Get MerchantSession spi
131
173
  * @param event
132
174
  */
133
175
  var getMerchantSession = /*#__PURE__*/function () {
134
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
135
- var _yield$BusManager$pub;
176
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref2) {
136
177
  var validationUrl, requestParams;
137
- return _regeneratorRuntime().wrap(function _callee$(_context) {
138
- while (1) switch (_context.prev = _context.next) {
178
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
179
+ while (1) switch (_context2.prev = _context2.next) {
139
180
  case 0:
140
- validationUrl = _ref.validationUrl;
181
+ validationUrl = _ref2.validationUrl;
141
182
  // get validateUrl
142
183
  requestParams = {
143
184
  validateUrl: validationUrl,
144
185
  paymentSessionData: _this._sessionData
145
186
  }; // get deviceId
146
- _context.t0 = getApplePayPaymentSession;
147
- _context.t1 = _this._sessionData;
148
- _context.t2 = requestParams;
149
- _context.t3 = _this._options.environment;
150
- _context.next = 8;
151
- return BusManager.publishForResult(new BusMessage(SecuritySDKActionEnum.getSecurityDeviceId));
187
+ _context2.t0 = getApplePayPaymentSession;
188
+ _context2.t1 = _this._sessionData;
189
+ _context2.t2 = requestParams;
190
+ _context2.t3 = _this._options.environment;
191
+ _context2.next = 8;
192
+ return getDeviceId();
152
193
  case 8:
153
- _context.t5 = _yield$BusManager$pub = _context.sent;
154
- _context.t4 = _context.t5 === null;
155
- if (_context.t4) {
156
- _context.next = 12;
157
- break;
158
- }
159
- _context.t4 = _yield$BusManager$pub === void 0;
160
- case 12:
161
- if (!_context.t4) {
162
- _context.next = 16;
163
- break;
164
- }
165
- _context.t6 = void 0;
166
- _context.next = 17;
167
- break;
168
- case 16:
169
- _context.t6 = _yield$BusManager$pub.getData();
170
- case 17:
171
- _context.t7 = _context.t6;
172
- _context.t8 = {
173
- deviceId: _context.t7
194
+ _context2.t4 = _context2.sent;
195
+ _context2.t5 = {
196
+ deviceId: _context2.t4
174
197
  };
175
- _context.t9 = {
176
- env: _context.t3,
177
- envInfo: _context.t8
198
+ _context2.t6 = {
199
+ env: _context2.t3,
200
+ envInfo: _context2.t5
178
201
  };
179
- _context.t10 = _this.logger;
180
- return _context.abrupt("return", (0, _context.t0)(_context.t1, _context.t2, _context.t9, _context.t10).then(function (res) {
202
+ _context2.t7 = _this.logger;
203
+ return _context2.abrupt("return", (0, _context2.t0)(_context2.t1, _context2.t2, _context2.t6, _context2.t7).then(function (res) {
181
204
  if (res !== null && res !== void 0 && res.success && res.merchantSessionObject) {
182
205
  return Promise.resolve(res.merchantSessionObject);
183
206
  }
@@ -188,14 +211,14 @@ var ApplePayComponent = /*#__PURE__*/function () {
188
211
  }).catch(function (error) {
189
212
  return Promise.reject(error);
190
213
  }));
191
- case 22:
214
+ case 13:
192
215
  case "end":
193
- return _context.stop();
216
+ return _context2.stop();
194
217
  }
195
- }, _callee);
218
+ }, _callee2);
196
219
  }));
197
220
  return function getMerchantSession(_x) {
198
- return _ref2.apply(this, arguments);
221
+ return _ref3.apply(this, arguments);
199
222
  };
200
223
  }();
201
224
 
@@ -204,53 +227,34 @@ var ApplePayComponent = /*#__PURE__*/function () {
204
227
  * @param tokens
205
228
  */
206
229
  var completePaymentAuthorized = /*#__PURE__*/function () {
207
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref3) {
208
- var _yield$BusManager$pub2;
230
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref4) {
209
231
  var paymentToken, params;
210
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
211
- while (1) switch (_context2.prev = _context2.next) {
232
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
233
+ while (1) switch (_context3.prev = _context3.next) {
212
234
  case 0:
213
- paymentToken = _ref3.paymentToken;
235
+ paymentToken = _ref4.paymentToken;
214
236
  params = {
215
237
  paymentFactors: {
216
238
  instPaymentToken: paymentToken
217
239
  },
218
240
  paymentSessionData: _this._sessionData
219
241
  };
220
- _context2.t0 = submitPayInfo;
221
- _context2.t1 = params;
222
- _context2.t2 = _this._options.environment;
223
- _context2.next = 7;
224
- return BusManager.publishForResult(new BusMessage(SecuritySDKActionEnum.getSecurityDeviceId));
242
+ _context3.t0 = submitPayInfo;
243
+ _context3.t1 = params;
244
+ _context3.t2 = _this._options.environment;
245
+ _context3.next = 7;
246
+ return getDeviceId();
225
247
  case 7:
226
- _context2.t4 = _yield$BusManager$pub2 = _context2.sent;
227
- _context2.t3 = _context2.t4 === null;
228
- if (_context2.t3) {
229
- _context2.next = 11;
230
- break;
231
- }
232
- _context2.t3 = _yield$BusManager$pub2 === void 0;
233
- case 11:
234
- if (!_context2.t3) {
235
- _context2.next = 15;
236
- break;
237
- }
238
- _context2.t5 = void 0;
239
- _context2.next = 16;
240
- break;
241
- case 15:
242
- _context2.t5 = _yield$BusManager$pub2.getData();
243
- case 16:
244
- _context2.t6 = _context2.t5;
245
- _context2.t7 = {
246
- deviceId: _context2.t6
248
+ _context3.t3 = _context3.sent;
249
+ _context3.t4 = {
250
+ deviceId: _context3.t3
247
251
  };
248
- _context2.t8 = {
249
- env: _context2.t2,
250
- envInfo: _context2.t7
252
+ _context3.t5 = {
253
+ env: _context3.t2,
254
+ envInfo: _context3.t4
251
255
  };
252
- _context2.t9 = _this.logger;
253
- return _context2.abrupt("return", (0, _context2.t0)(_context2.t1, _context2.t8, _context2.t9).then(function (res) {
256
+ _context3.t6 = _this.logger;
257
+ return _context3.abrupt("return", (0, _context3.t0)(_context3.t1, _context3.t5, _context3.t6).then(function (res) {
254
258
  _this.logger.logInfo({
255
259
  name: 'APPLE_PAY',
256
260
  title: 'submitPayStatus',
@@ -268,14 +272,14 @@ var ApplePayComponent = /*#__PURE__*/function () {
268
272
  }).catch(function (error) {
269
273
  return Promise.reject(error);
270
274
  }));
271
- case 21:
275
+ case 12:
272
276
  case "end":
273
- return _context2.stop();
277
+ return _context3.stop();
274
278
  }
275
- }, _callee2);
279
+ }, _callee3);
276
280
  }));
277
281
  return function completePaymentAuthorized(_x2) {
278
- return _ref4.apply(this, arguments);
282
+ return _ref5.apply(this, arguments);
279
283
  };
280
284
  }();
281
285
  var completeApplePay = function completeApplePay(data) {
@@ -17,7 +17,6 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
17
17
  * 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.
18
18
  */
19
19
  /* eslint-disable @typescript-eslint/no-explicit-any */
20
- import { SecurityBusSubscriber } from "../../core/bus/ability/security";
21
20
  import { COMPONENTPLUGINID, COMPONENT_CLOSE_BLOCK_ID, COMPONENT_CONTAINER_ID, COMPONENT_RETENTION_ID, COMPONENT_SECTION_ID, ERRORMESSAGE, EVENT, LISTENER_PREFIX, LOADING_ID, LOADTIME_LIMIT, MOCKUP_ID, POPUP_LOADTIME_LOG_LIMIT, TIMEOUT_WEB_APP_HEART_BEAT, TIME_DELAY_SEND_HEART_BEAT } from "../../constant";
22
21
  import { queryPaymentInfo, submitPayInfo } from "../../service";
23
22
  import { componentSignEnum, eventCodeEnum, messageName, platformEnum, productSceneEnum, RedirectType, renderDisplayTypeEnum, targetEnum } from "../../types";
@@ -27,7 +26,6 @@ import { createIframe, createPreloadIframe, getAppDomain, getIframeUrl } from ".
27
26
  import { addInlineLoading, createInlineBaseElement } from "./component.inline.style";
28
27
  import { addPopupLoading, createBaseElement, createMockup, createRetentionPopup, handleDeclareInfo as _handleDeclareInfo, hideRetentionPopup, removeRetentionPopup as _removeRetentionPopup } from "./component.popup.style";
29
28
  import { createModal, destroyModal, insertStyleSheet } from "./popupWindow.style";
30
- import { BusManager } from "../../core/bus";
31
29
  window.changingPageHeight = window.innerHeight;
32
30
  var ComponentApp = /*#__PURE__*/function () {
33
31
  function ComponentApp() {
@@ -73,7 +71,6 @@ var ComponentApp = /*#__PURE__*/function () {
73
71
  value: Date.now()
74
72
  });
75
73
  this._globalData = new Map();
76
- BusManager.subscribe(new SecurityBusSubscriber(this.getDeviceIdAndLog));
77
74
  }
78
75
 
79
76
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alipay/ams-checkout",
3
- "version": "0.0.1710212811-dev.14",
3
+ "version": "0.0.1710212811-dev.17",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "main": "esm/index.js",