@alipay/ams-checkout 1.5.2 → 1.5.7

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.
@@ -15,16 +15,23 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
15
15
  * 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.
16
16
  */
17
17
  /* eslint-disable no-console */
18
+ /* eslint-disable @typescript-eslint/no-explicit-any */
18
19
  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 } from "../../constant";
19
20
  import { queryPaymentInfo } from "../../service";
20
21
  import { componentSignEnum, eventCodeEnum, messageName, platformEnum, productSceneEnum, renderDisplayTypeEnum, targetEnum } from "../../types";
21
- import { getType, isJsonString, isPC } from "../../util";
22
+ import { getType, isJsonString, isPC, queryParse } from "../../util";
22
23
  import { isLocalMock } from "../../util/mock";
23
24
  import { createIframe, getAppDomain, getIframeUrl } from "./cashierApp";
24
25
  import { addInlineLoading, createInlineBaseElement } from "./component.inline.style";
25
26
  import { addPopupLoading, createBaseElement, createMockup, createRetentionPopup, handleDeclareInfo as _handleDeclareInfo, hideRetentionPopup, removeRetentionPopup as _removeRetentionPopup } from "./component.popup.style";
26
- var _window = window,
27
- innerHeight = _window.innerHeight;
27
+ import APDID from '@alipay/jshield-apdid';
28
+ import { getSecurityHost, getAppname } from "../../util/security";
29
+ var _ref = queryParse() || {},
30
+ preinit = _ref.preinit,
31
+ rebuild = _ref.rebuild,
32
+ scene = _ref.scene,
33
+ region = _ref.region;
34
+ window.changingPageHeight = window.innerHeight;
28
35
  var ComponentApp = /*#__PURE__*/function () {
29
36
  function ComponentApp() {
30
37
  _classCallCheck(this, ComponentApp);
@@ -44,7 +51,7 @@ var ComponentApp = /*#__PURE__*/function () {
44
51
  _defineProperty(this, "_componentSign", componentSignEnum.NONE);
45
52
  _defineProperty(this, "_clickEventName", void 0);
46
53
  _defineProperty(this, "_renderDisplayType", renderDisplayTypeEnum.popup);
47
- this._appVersion = '1.5.2';
54
+ this._appVersion = '1.5.7';
48
55
  this._isInitComponent = false;
49
56
  this._selector = "#".concat(COMPONENT_SECTION_ID);
50
57
  this.createIframeNode = function () {
@@ -86,6 +93,29 @@ var ComponentApp = /*#__PURE__*/function () {
86
93
  value: function setRender(renderFunc) {
87
94
  this.createIframeNode = renderFunc;
88
95
  }
96
+ }, {
97
+ key: "initAPSecurity",
98
+ value: function initAPSecurity() {
99
+ var _this$_renderParams, _this$_renderParams$p;
100
+ if (componentSignEnum.CASHIER_PAYMENT_CARD !== this._componentSign) {
101
+ return;
102
+ }
103
+ var securityConfig = (_this$_renderParams = this._renderParams) === null || _this$_renderParams === void 0 ? void 0 : (_this$_renderParams$p = _this$_renderParams.paymentSessionMetaData) === null || _this$_renderParams$p === void 0 ? void 0 : _this$_renderParams$p.securityConfig;
104
+ if (!securityConfig) {
105
+ return;
106
+ }
107
+ var appName = securityConfig === null || securityConfig === void 0 ? void 0 : securityConfig.appName;
108
+ var h5gateway = securityConfig === null || securityConfig === void 0 ? void 0 : securityConfig.h5gateway;
109
+ if (preinit === 'true' || rebuild === 'true') {
110
+ appName = getAppname(scene);
111
+ h5gateway = getSecurityHost(region);
112
+ }
113
+ APDID.initToken(appName, {
114
+ host: h5gateway
115
+ }, function (success, tokenResult, msg) {
116
+ console.log("initToken result tokenResult", JSON.stringify(tokenResult));
117
+ });
118
+ }
89
119
 
90
120
  /**
91
121
  * @description render iframe content
@@ -104,6 +134,7 @@ var ComponentApp = /*#__PURE__*/function () {
104
134
  if (renderParams !== null && renderParams !== void 0 && renderParams.selector) this._selector = renderParams.selector;
105
135
  this._renderDisplayType = renderParams.renderDisplayType;
106
136
  var insertedNode = this._renderDisplayType === renderDisplayTypeEnum.inline ? "#".concat(COMPONENT_CONTAINER_ID) : this._selector;
137
+ this.initAPSecurity();
107
138
  this._performanceData.push({
108
139
  key: 'sdk_create_component',
109
140
  value: Date.now()
@@ -179,32 +210,45 @@ var ComponentApp = /*#__PURE__*/function () {
179
210
  value: Date.now()
180
211
  });
181
212
  this._actionQueryPromise = new Promise(function (resolve, reject) {
182
- var _this3$_renderParams, _this3$_renderParams2, _this3$_renderParams3;
213
+ var _this3$_renderParams, _this3$_renderParams2, _this3$_renderParams3, _this3$_renderParams4, _this3$_renderParams5;
183
214
  var params = {
184
- paymentSessionData: _this3._renderParams && ((_this3$_renderParams = _this3._renderParams) === null || _this3$_renderParams === void 0 ? void 0 : _this3$_renderParams.paymentSessionData) || '',
215
+ paymentSessionData: _this3._renderParams && ((_this3$_renderParams = _this3._renderParams) === null || _this3$_renderParams === void 0 ? void 0 : _this3$_renderParams.sessionData) || '',
185
216
  paymentSessionConfig: (_this3$_renderParams2 = _this3._renderParams) === null || _this3$_renderParams2 === void 0 ? void 0 : (_this3$_renderParams3 = _this3$_renderParams2.paymentSessionMetaData) === null || _this3$_renderParams3 === void 0 ? void 0 : _this3$_renderParams3.paymentSessionConfig
186
217
  };
187
218
  /**
188
219
  * @description card
189
220
  */
190
- if (componentSignEnum.CASHIER_PAYMENT_CARD === _this3._componentSign) {
221
+ if (componentSignEnum.CASHIER_PAYMENT_CARD === _this3._componentSign || componentSignEnum.VAULTING_CARD === _this3._componentSign) {
191
222
  params.paymentMethodType = 'CARD';
192
223
  }
224
+ var needDeviceId = false;
225
+ var waitTime = '3000';
226
+ var securityConfig = (_this3$_renderParams4 = _this3._renderParams) === null || _this3$_renderParams4 === void 0 ? void 0 : (_this3$_renderParams5 = _this3$_renderParams4.paymentSessionMetaData) === null || _this3$_renderParams5 === void 0 ? void 0 : _this3$_renderParams5.securityConfig;
227
+ if (componentSignEnum.CASHIER_PAYMENT_CARD === _this3._componentSign && securityConfig) {
228
+ var _this3$_renderParams6, _this3$_renderParams7;
229
+ var extendInfo = ((_this3$_renderParams6 = _this3._renderParams) === null || _this3$_renderParams6 === void 0 ? void 0 : (_this3$_renderParams7 = _this3$_renderParams6.paymentSessionMetaData) === null || _this3$_renderParams7 === void 0 ? void 0 : _this3$_renderParams7.extendInfo) || '';
230
+ var info = JSON.parse(extendInfo);
231
+ if ((info === null || info === void 0 ? void 0 : info.cardTokenPay) !== 'false') {
232
+ needDeviceId = true;
233
+ waitTime = securityConfig === null || securityConfig === void 0 ? void 0 : securityConfig.tokenCollectTime;
234
+ }
235
+ }
236
+
193
237
  /**
194
238
  * @description easyPay
195
239
  */
196
240
  if (componentSignEnum.EASY_PAY_WALLET === _this3._componentSign) {
197
- var _this3$_renderParams4;
198
- var _ref = params.paymentSessionConfig || {},
199
- _ref$productSceneVers = _ref.productSceneVersion,
200
- productSceneVersion = _ref$productSceneVers === void 0 ? '' : _ref$productSceneVers,
201
- _ref$productScene = _ref.productScene,
202
- productScene = _ref$productScene === void 0 ? '' : _ref$productScene;
203
- var _ref2 = ((_this3$_renderParams4 = _this3._renderParams) === null || _this3$_renderParams4 === void 0 ? void 0 : _this3$_renderParams4.paymentSessionMetaData) || {},
204
- _ref2$action = _ref2.action,
205
- _ref2$action2 = _ref2$action === void 0 ? {} : _ref2$action,
206
- _ref2$action2$autoDeb = _ref2$action2.autoDebitWithToken,
207
- autoDebitWithToken = _ref2$action2$autoDeb === void 0 ? false : _ref2$action2$autoDeb;
241
+ var _this3$_renderParams8;
242
+ var _ref2 = params.paymentSessionConfig || {},
243
+ _ref2$productSceneVer = _ref2.productSceneVersion,
244
+ productSceneVersion = _ref2$productSceneVer === void 0 ? '' : _ref2$productSceneVer,
245
+ _ref2$productScene = _ref2.productScene,
246
+ productScene = _ref2$productScene === void 0 ? '' : _ref2$productScene;
247
+ var _ref3 = ((_this3$_renderParams8 = _this3._renderParams) === null || _this3$_renderParams8 === void 0 ? void 0 : _this3$_renderParams8.paymentSessionMetaData) || {},
248
+ _ref3$action = _ref3.action,
249
+ _ref3$action2 = _ref3$action === void 0 ? {} : _ref3$action,
250
+ _ref3$action2$autoDeb = _ref3$action2.autoDebitWithToken,
251
+ autoDebitWithToken = _ref3$action2$autoDeb === void 0 ? false : _ref3$action2$autoDeb;
208
252
  if (productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0' && !autoDebitWithToken) {
209
253
  // if EASY_PAY 2.0 , no need to query payment request
210
254
  return resolve({
@@ -218,8 +262,8 @@ var ComponentApp = /*#__PURE__*/function () {
218
262
  * @description autoDebit
219
263
  */
220
264
  if (componentSignEnum.AUTO_DEBIT_WALLET === _this3._componentSign) {
221
- var _this3$_renderParams5, _this3$_renderParams6, _action$web, _action$wap;
222
- var action = ((_this3$_renderParams5 = _this3._renderParams) === null || _this3$_renderParams5 === void 0 ? void 0 : (_this3$_renderParams6 = _this3$_renderParams5.paymentSessionMetaData) === null || _this3$_renderParams6 === void 0 ? void 0 : _this3$_renderParams6.action) || {};
265
+ var _this3$_renderParams9, _this3$_renderParams10, _action$web, _action$wap;
266
+ var action = ((_this3$_renderParams9 = _this3._renderParams) === null || _this3$_renderParams9 === void 0 ? void 0 : (_this3$_renderParams10 = _this3$_renderParams9.paymentSessionMetaData) === null || _this3$_renderParams10 === void 0 ? void 0 : _this3$_renderParams10.action) || {};
223
267
  var signType = isPC() ? action === null || action === void 0 ? void 0 : (_action$web = action.web) === null || _action$web === void 0 ? void 0 : _action$web.signType : action === null || action === void 0 ? void 0 : (_action$wap = action.wap) === null || _action$wap === void 0 ? void 0 : _action$wap.signType;
224
268
  if (signType === 'SMS') {
225
269
  return resolve({
@@ -243,7 +287,9 @@ var ComponentApp = /*#__PURE__*/function () {
243
287
  }
244
288
  queryPaymentInfo(params, {
245
289
  env: _this3.AMSSDK.options.env.environment,
246
- locale: _this3.AMSSDK.options.locale
290
+ locale: _this3.AMSSDK.options.locale,
291
+ needDeviceId: needDeviceId,
292
+ waitTime: waitTime
247
293
  }).then(function (res) {
248
294
  _this3._performanceData.push({
249
295
  key: 'sdk_action_query_end',
@@ -323,6 +369,7 @@ var ComponentApp = /*#__PURE__*/function () {
323
369
  });
324
370
  this.app = createIframe(this.AMSSDK.options.mode, this.platform);
325
371
  this.app.src = getIframeUrl({
372
+ renderDisplayType: renderParams.renderDisplayType,
326
373
  componentSign: this._componentSign,
327
374
  analytics: this.AMSSDK.options.analytics,
328
375
  productSceneVersion: productSceneVersion,
@@ -363,15 +410,16 @@ var ComponentApp = /*#__PURE__*/function () {
363
410
  }
364
411
  }, {
365
412
  key: "resizeListener",
366
- value: function resizeListener() {
413
+ value: function resizeListener(e) {
414
+ var _e$target, _e$target2;
367
415
  var cashier = document.getElementById(COMPONENT_CONTAINER_ID);
368
416
  cashier.style.transition = 'none';
369
417
  this.dispatchToApp({
370
418
  context: {
371
419
  event: 'renderResize',
372
420
  data: {
373
- heightOfVisible: window.innerHeight,
374
- widthOfVisible: window.innerWidth
421
+ heightOfVisible: (e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.innerHeight) || window.innerHeight,
422
+ widthOfVisible: (e === null || e === void 0 ? void 0 : (_e$target2 = e.target) === null || _e$target2 === void 0 ? void 0 : _e$target2.innerWidth) || window.innerWidth
375
423
  }
376
424
  }
377
425
  });
@@ -455,7 +503,7 @@ var ComponentApp = /*#__PURE__*/function () {
455
503
  }
456
504
 
457
505
  // The plug-in communicates with the sdk after processing
458
- this.dispatchToSDK(data.context.event, data.context.data);
506
+ this.dispatchToSDK(data.context.event, data.context.data, data.context.eventCallbackId);
459
507
  }
460
508
  }, {
461
509
  key: "handleSizeChanged",
@@ -562,9 +610,9 @@ var ComponentApp = /*#__PURE__*/function () {
562
610
  }
563
611
  }, {
564
612
  key: "handleDeclareInfo",
565
- value: function handleDeclareInfo(_ref3) {
566
- var _ref3$closeDialogData = _ref3.closeDialogData,
567
- closeDialogData = _ref3$closeDialogData === void 0 ? {} : _ref3$closeDialogData;
613
+ value: function handleDeclareInfo(_ref4) {
614
+ var _ref4$closeDialogData = _ref4.closeDialogData,
615
+ closeDialogData = _ref4$closeDialogData === void 0 ? {} : _ref4$closeDialogData;
568
616
  _handleDeclareInfo({
569
617
  closeDialogData: closeDialogData
570
618
  });
@@ -585,8 +633,9 @@ var ComponentApp = /*#__PURE__*/function () {
585
633
  */
586
634
  }, {
587
635
  key: "dispatchToSDK",
588
- value: function dispatchToSDK(event, data) {
636
+ value: function dispatchToSDK(event, data, eventCallbackId) {
589
637
  this.AMSSDK._eventCenter.emit(event, data);
638
+ if (eventCallbackId) this.AMSSDK._eventCenter.emit(eventCallbackId, data);
590
639
  }
591
640
 
592
641
  /**
@@ -630,7 +679,7 @@ var ComponentApp = /*#__PURE__*/function () {
630
679
  key: "sendRenderEvent",
631
680
  value: function () {
632
681
  var _sendRenderEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
633
- var _this$_renderParams, _this$_renderParams2, _this$_renderParams3, _this$_renderParams4, res;
682
+ var _this$_renderParams2, _this$_renderParams3, _this$_renderParams4, _this$_renderParams5, res;
634
683
  return _regeneratorRuntime().wrap(function _callee$(_context) {
635
684
  while (1) switch (_context.prev = _context.next) {
636
685
  case 0:
@@ -654,11 +703,11 @@ var ComponentApp = /*#__PURE__*/function () {
654
703
  event: 'renderComponent',
655
704
  data: {
656
705
  queryResult: res,
657
- sessionResult: (_this$_renderParams = this._renderParams) === null || _this$_renderParams === void 0 ? void 0 : _this$_renderParams.paymentSessionMetaData,
658
- paymentSessionData: (_this$_renderParams2 = this._renderParams) === null || _this$_renderParams2 === void 0 ? void 0 : _this$_renderParams2.paymentSessionData,
659
- heightOfVisible: Math.max(innerHeight, window.innerHeight),
660
- renderDisplayType: (_this$_renderParams3 = this._renderParams) === null || _this$_renderParams3 === void 0 ? void 0 : _this$_renderParams3.renderDisplayType,
661
- appearance: (_this$_renderParams4 = this._renderParams) === null || _this$_renderParams4 === void 0 ? void 0 : _this$_renderParams4.appearance,
706
+ sessionResult: (_this$_renderParams2 = this._renderParams) === null || _this$_renderParams2 === void 0 ? void 0 : _this$_renderParams2.paymentSessionMetaData,
707
+ paymentSessionData: (_this$_renderParams3 = this._renderParams) === null || _this$_renderParams3 === void 0 ? void 0 : _this$_renderParams3.sessionData,
708
+ heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
709
+ renderDisplayType: (_this$_renderParams4 = this._renderParams) === null || _this$_renderParams4 === void 0 ? void 0 : _this$_renderParams4.renderDisplayType,
710
+ appearance: (_this$_renderParams5 = this._renderParams) === null || _this$_renderParams5 === void 0 ? void 0 : _this$_renderParams5.appearance,
662
711
  envInfo: {
663
712
  screenHeight: screen.height,
664
713
  screenWidth: screen.width
@@ -1,5 +1,5 @@
1
1
  import type AMSCheckout from '../../core/instance';
2
- import type { IcreatePaymentParams, eventPlayload } from '../../types';
2
+ import type { IcreatePaymentParams, eventPayload } from '../../types';
3
3
  export default class CheckoutApp {
4
4
  app: any;
5
5
  paymentMethodsResult: any;
@@ -47,15 +47,15 @@ export default class CheckoutApp {
47
47
  /**
48
48
  * @description Processing messages from iframe
49
49
  */
50
- _handleAppMessage(data: eventPlayload): void;
50
+ _handleAppMessage(data: eventPayload): void;
51
51
  /**
52
52
  * @description Send message to SDK
53
53
  */
54
- _dispatchToSDK(data: eventPlayload): void;
54
+ _dispatchToSDK(data: eventPayload): void;
55
55
  /**
56
56
  * @description Send message to iframe
57
57
  */
58
- _dispatchToApp(data: eventPlayload): void;
58
+ _dispatchToApp(data: eventPayload): void;
59
59
  /**
60
60
  * @description Subscribe to messages from SDK
61
61
  */
@@ -67,5 +67,5 @@ export default class CheckoutApp {
67
67
  /**
68
68
  * @description Send the post submission processing event, and the cashier applies the consumption result
69
69
  */
70
- _handleRequestPayment(data: eventPlayload): void;
70
+ _handleRequestPayment(data: eventPayload): void;
71
71
  }
@@ -11,6 +11,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
11
11
  * 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
12
12
  * 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.
13
13
  */
14
+ /* eslint-disable @typescript-eslint/no-explicit-any */
14
15
  import { BASEPLUGINID, ERRORMESSAGE, EVENT } from "../../constant";
15
16
  import { messageName } from "../../types";
16
17
  import { getOrigin, getType, getViewPort, isDom, isJsonString, serialize } from "../../util";
@@ -1,10 +1,3 @@
1
- /**
2
- * Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), the rights to use, copy, modify, merge, and/or distribute the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
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
- * 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
- */
8
1
  import { IrequestConfig } from '../types';
9
2
  /**
10
3
  *
@@ -14,11 +14,12 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
14
14
  * 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
15
15
  * 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.
16
16
  */
17
-
17
+ /* eslint-disable @typescript-eslint/no-explicit-any */
18
18
  import { sdkVersion } from "../config/index";
19
19
  import { appId, hostSignMap, lightSandboxMap, requestHost, sofaId, tntInstId } from "../config/request";
20
20
  import { errorEnum } from "../types";
21
21
  import { get } from "../util/get";
22
+ import { getApdidToken, getAppname } from "../util/security";
22
23
  import axios from 'axios';
23
24
  import { device, fomatGetwayError, isPC, queryParse, safeJson } from "../util";
24
25
  var _queryParse = queryParse(),
@@ -63,7 +64,7 @@ export function request(_x, _x2) {
63
64
  }
64
65
  function _request() {
65
66
  _request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(requestData, options) {
66
- var myRequest, startTime, envInfo, _navigator, _data, _yield$myRequest, data, headers, resData, traceId, handleGetWayError, _error$message, _error, timeoutCode, errorCode;
67
+ var myRequest, startTime, envInfo, deviceId, _navigator, _data, _yield$myRequest, data, headers, resData, traceId, handleGetWayError, _error$message, _error, timeoutCode, errorCode;
67
68
  return _regeneratorRuntime().wrap(function _callee$(_context) {
68
69
  while (1) switch (_context.prev = _context.next) {
69
70
  case 0:
@@ -83,6 +84,16 @@ function _request() {
83
84
  screenHeight: screen.height,
84
85
  timeZoneOffset: new Date().getTimezoneOffset()
85
86
  };
87
+ if (!(options !== null && options !== void 0 && options.needDeviceId)) {
88
+ _context.next = 8;
89
+ break;
90
+ }
91
+ _context.next = 6;
92
+ return getApdidToken(getAppname('Card'), options === null || options === void 0 ? void 0 : options.waitTime);
93
+ case 6:
94
+ deviceId = _context.sent;
95
+ envInfo.deviceId = deviceId;
96
+ case 8:
86
97
  try {
87
98
  envInfo.browserInfo.browserJavaEnabled = ((_navigator = navigator) === null || _navigator === void 0 ? void 0 : _navigator.javaEnabled()) || false;
88
99
  // eslint-disable-next-line no-empty
@@ -94,12 +105,12 @@ function _request() {
94
105
  refUrl: window.location.href
95
106
  }
96
107
  })] : [requestData];
97
- _context.prev = 6;
98
- _context.next = 9;
108
+ _context.prev = 11;
109
+ _context.next = 14;
99
110
  return myRequest({
100
111
  data: _data
101
112
  });
102
- case 9:
113
+ case 14:
103
114
  _yield$myRequest = _context.sent;
104
115
  data = _yield$myRequest.data;
105
116
  headers = _yield$myRequest.headers;
@@ -108,7 +119,7 @@ function _request() {
108
119
  resData.traceId = traceId || '';
109
120
  handleGetWayError = fomatGetwayError(headers, traceId);
110
121
  if (!(handleGetWayError !== null && handleGetWayError !== void 0 && handleGetWayError.errorCode)) {
111
- _context.next = 18;
122
+ _context.next = 23;
112
123
  break;
113
124
  }
114
125
  throw new Error(JSON.stringify({
@@ -116,13 +127,11 @@ function _request() {
116
127
  errorCode: handleGetWayError === null || handleGetWayError === void 0 ? void 0 : handleGetWayError.errorCode,
117
128
  success: false
118
129
  }));
119
- case 18:
130
+ case 23:
120
131
  return _context.abrupt("return", resData);
121
- case 21:
122
- _context.prev = 21;
123
- _context.t0 = _context["catch"](6);
124
- // eslint-disable-next-line no-console
125
- console.log('request error', _context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message);
132
+ case 26:
133
+ _context.prev = 26;
134
+ _context.t0 = _context["catch"](11);
126
135
  _error = safeJson(_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message, {
127
136
  success: false,
128
137
  errorCode: errorEnum.SYSTEM,
@@ -135,11 +144,11 @@ function _request() {
135
144
  errorCode: errorCode,
136
145
  errorMessage: ''
137
146
  }));
138
- case 28:
147
+ case 32:
139
148
  case "end":
140
149
  return _context.stop();
141
150
  }
142
- }, _callee, null, [[6, 21]]);
151
+ }, _callee, null, [[11, 26]]);
143
152
  }));
144
153
  return _request.apply(this, arguments);
145
154
  }
@@ -25,4 +25,4 @@ export declare const fomatGetwayError: (headers: Record<string, any>, traceId: s
25
25
  memo: string;
26
26
  };
27
27
  resultStatus: any;
28
- } | null;
28
+ };
@@ -8,6 +8,8 @@
8
8
 
9
9
  import { errorEnum } from "../types";
10
10
  import { get } from "../util/get";
11
+
12
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
13
  export var safeJson = function safeJson(data, obj) {
12
14
  try {
13
15
  return JSON.parse(data) || obj;
@@ -17,6 +19,7 @@ export var safeJson = function safeJson(data, obj) {
17
19
  };
18
20
 
19
21
  // 判断header 中的resultStatus
22
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
20
23
  export var fomatGetwayError = function fomatGetwayError(headers, traceId) {
21
24
  var resultStatus = get(headers, 'Result-Status') || get(headers, 'result-status', '');
22
25
  // 请求静态数据情况
@@ -30,7 +30,7 @@ export declare enum renderDisplayTypeEnum {
30
30
  }
31
31
  export interface IcreatePaymentParams {
32
32
  paymentMethodsResult?: any;
33
- paymentSessionData?: string;
33
+ sessionData?: string;
34
34
  selector: Iselector;
35
35
  appearance?: {
36
36
  displayType?: checkoutDisplayEnum;
@@ -42,12 +42,14 @@ export declare enum componentSignEnum {
42
42
  'CASHIER_PAYMENT_CARD' = "CASHIER_PAYMENT_CARD",
43
43
  'CASHIER_PAYMENT_BANK' = "CASHIER_PAYMENT_BANK",
44
44
  'AUTO_DEBIT_WALLET' = "AUTO_DEBIT_WALLET",
45
- 'NONE' = "NONE"
45
+ 'NONE' = "NONE",
46
+ 'VAULTING_CARD' = "VAULTING_CARD"
46
47
  }
47
48
  export declare enum productSceneEnum {
48
49
  'EASY_PAY' = "EASY_PAY",
49
50
  'CASHIER_PAYMENT' = "CASHIER_PAYMENT",
50
- 'AUTO_DEBIT' = "AUTO_DEBIT"
51
+ 'AUTO_DEBIT' = "AUTO_DEBIT",
52
+ 'VAULTING' = "VAULTING"
51
53
  }
52
54
  export declare enum paymentMethodCategoryTypeEnum {
53
55
  'CARD' = "CARD",
@@ -55,7 +57,7 @@ export declare enum paymentMethodCategoryTypeEnum {
55
57
  'BANK' = "BANK"
56
58
  }
57
59
  export interface IcreateComponent {
58
- paymentSessionData: string;
60
+ sessionData: string;
59
61
  appearance?: Record<string, any>;
60
62
  }
61
63
  export interface IappendIframeNodesParams extends IcreateComponent {
@@ -63,13 +65,34 @@ export interface IappendIframeNodesParams extends IcreateComponent {
63
65
  renderDisplayType: renderDisplayTypeEnum;
64
66
  selector?: Iselector;
65
67
  }
68
+ export interface IbillingAddress {
69
+ region: string;
70
+ address1: string;
71
+ address2?: string;
72
+ city: string;
73
+ state?: string;
74
+ zipCode: string;
75
+ }
76
+ export interface Isubmit {
77
+ billingAddress?: IbillingAddress;
78
+ }
66
79
  interface IpaymentSessionConfig {
67
80
  productScene: productSceneEnum;
68
81
  paymentMethodCategoryType: paymentMethodCategoryTypeEnum;
69
82
  productSceneVersion: string;
70
83
  }
84
+ interface IpaymentSecurityConfig {
85
+ appId: string;
86
+ appName: string;
87
+ bizToken: string;
88
+ gateway: string;
89
+ h5gateway: string;
90
+ tokenCollectTime: string;
91
+ workSpaceId: string;
92
+ }
71
93
  export interface IpaymentSessionMetaData {
72
94
  paymentSessionConfig?: IpaymentSessionConfig;
95
+ securityConfig?: IpaymentSecurityConfig;
73
96
  moneyView?: any;
74
97
  extendInfo?: string;
75
98
  paymentMethodInfoView?: any;
@@ -158,15 +181,17 @@ export declare enum messageName {
158
181
  APP_TO_SDK = "APP_TO_SDK",
159
182
  APP_TO_APP = "APP_TO_APP"
160
183
  }
161
- export interface eventPlayload {
184
+ export interface eventPayload {
162
185
  name: messageName;
163
186
  mode?: string;
164
187
  appId?: string;
165
188
  instanceId: string;
166
- context: {
167
- event: string;
168
- data: any;
169
- };
189
+ context: eventPayloadContext;
190
+ }
191
+ export interface eventPayloadContext {
192
+ event: string;
193
+ data: any;
194
+ eventCallbackId?: string;
170
195
  }
171
196
  export interface AMSCheckoutOptions {
172
197
  env: Ienv;
@@ -209,6 +234,8 @@ export interface IrequestConfig {
209
234
  beforerRequest?: () => void;
210
235
  afterRequest?: () => void;
211
236
  needEnvInfo?: boolean;
237
+ needDeviceId?: boolean;
238
+ waitTime?: string;
212
239
  locale?: string;
213
240
  hostSign?: string;
214
241
  }
@@ -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
-
8
+ /* eslint-disable @typescript-eslint/no-explicit-any */
9
9
  /**
10
10
  * SDK options
11
11
  */
@@ -21,12 +21,14 @@ export var componentSignEnum = /*#__PURE__*/function (componentSignEnum) {
21
21
  componentSignEnum["CASHIER_PAYMENT_BANK"] = "CASHIER_PAYMENT_BANK";
22
22
  componentSignEnum["AUTO_DEBIT_WALLET"] = "AUTO_DEBIT_WALLET";
23
23
  componentSignEnum["NONE"] = "NONE";
24
+ componentSignEnum["VAULTING_CARD"] = "VAULTING_CARD";
24
25
  return componentSignEnum;
25
26
  }({});
26
27
  export var productSceneEnum = /*#__PURE__*/function (productSceneEnum) {
27
28
  productSceneEnum["EASY_PAY"] = "EASY_PAY";
28
29
  productSceneEnum["CASHIER_PAYMENT"] = "CASHIER_PAYMENT";
29
30
  productSceneEnum["AUTO_DEBIT"] = "AUTO_DEBIT";
31
+ productSceneEnum["VAULTING"] = "VAULTING";
30
32
  return productSceneEnum;
31
33
  }({});
32
34
  export var paymentMethodCategoryTypeEnum = /*#__PURE__*/function (paymentMethodCategoryTypeEnum) {
@@ -1,3 +1,10 @@
1
+ /**
2
+ * Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), the rights to use, copy, modify, merge, and/or distribute the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+ * 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
5
+ * 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.
6
+ */
7
+ /* eslint-disable @typescript-eslint/no-explicit-any */
1
8
  import { getType } from '.';
2
9
  import { ERRORMESSAGE, EVENT } from "../constant";
3
10
  import { messageName, renderDisplayTypeEnum } from "../types";
package/esm/util/get.js CHANGED
@@ -1,4 +1,11 @@
1
1
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ /**
3
+ * Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), the rights to use, copy, modify, merge, and/or distribute the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
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
+ * 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
+ */
8
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
9
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
3
10
  // @ts-nocheck
4
11
  var charCodeOfDot = '.'.charCodeAt(0);
@@ -1,10 +1,10 @@
1
- import { errorEnum } from '../types';
2
1
  /**
3
2
  * Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
4
3
  * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), the rights to use, copy, modify, merge, and/or distribute the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5
4
  * 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
5
  * 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
6
  */
7
+ import { errorEnum } from '../types';
8
8
  declare const getType: (target: any) => string;
9
9
  declare class EventCenter {
10
10
  private events;
@@ -19,7 +19,7 @@ declare const getViewPort: (key: string) => any;
19
19
  declare const getOrigin: () => string;
20
20
  declare const serialize: (obj: Record<string, string>) => string;
21
21
  declare const isJsonString: (str: string) => boolean;
22
- declare const isDom: (obj: any) => any;
22
+ declare const isDom: (obj: any) => boolean;
23
23
  declare const device: {
24
24
  iOS: boolean;
25
25
  Android: boolean;
@@ -46,7 +46,7 @@ declare const fomatGetwayError: (headers: Record<string, any>, traceId: string)
46
46
  memo: string;
47
47
  };
48
48
  resultStatus: any;
49
- } | null;
49
+ };
50
50
  declare const isPC: () => boolean;
51
51
  declare const queryParse: (url?: string) => Record<string, any>;
52
52
  declare const getDesignFontSize: () => number;
package/esm/util/index.js CHANGED
@@ -5,15 +5,15 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
5
5
  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; }
6
6
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
7
7
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
8
- import { errorEnum } from "../types";
9
- import { get } from "./get";
10
-
11
8
  /**
12
9
  * Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
13
10
  * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), the rights to use, copy, modify, merge, and/or distribute the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
14
11
  * 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
15
12
  * 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.
16
13
  */
14
+ /* eslint-disable @typescript-eslint/no-explicit-any */
15
+ import { errorEnum } from "../types";
16
+ import { get } from "./get";
17
17
  var getType = function getType(target) {
18
18
  return Object.prototype.toString.call(target).slice(8, -1).toLowerCase();
19
19
  };
@@ -79,10 +79,7 @@ var EventCenter = /*#__PURE__*/function () {
79
79
  value: function once(name, func, key) {
80
80
  var _this = this;
81
81
  var onceF = function onceF() {
82
- for (var _len2 = arguments.length, rest = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
83
- rest[_key2] = arguments[_key2];
84
- }
85
- func.call.apply(func, [_this].concat(rest));
82
+ func.apply(void 0, arguments);
86
83
  _this.off(name, onceF, key);
87
84
  };
88
85
  this.on(name, onceF, key);
@@ -239,7 +236,7 @@ var amsSetSize = function amsSetSize(event, dom) {
239
236
  var componentContainerId = 'ams-component-container';
240
237
  var _dom = dom || document.getElementById(componentContainerId);
241
238
  _dom.style.fontSize = "".concat(getDesignFontSize(), "px");
242
- innerHeight = window.innerHeight;
239
+ window.changingPageHeight = window.innerHeight;
243
240
  // eslint-disable-next-line no-empty
244
241
  } catch (error) {}
245
242
  };