@alipay/ams-checkout 0.0.1697942541-dev.4 → 0.0.1698315116-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- export declare const marmptMap: Record<string, string>;
1
+ export declare const marmotMap: Record<string, string>;
2
2
  export declare const sdkVersion: string;
@@ -6,12 +6,12 @@
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 json from "../../package.json";
9
- export var marmptMap = {
9
+ export var marmotMap = {
10
10
  dev: 'http://page.alipay.net/page/antom-web-checkout/src/component-app',
11
11
  sit: 'http://page.test.alipay.net/page/antom-web-checkout/src/component-app',
12
12
  pre: 'https://pre.ac.alipay.com/page/antom-web-checkout/src/component-app',
13
- sandbox: 'https://ac.alipay.com/page/antom-web-checkout/src/component-app',
14
- light_sandbox: 'https://ac.alipay.com/page/antom-web-checkout/src/component-app',
15
- prod: 'https://ac.alipay.com/page/antom-web-checkout/src/component-app'
13
+ sandbox: 'https://cdn.marmot-cloud.com/page/antom-web-checkout/src/component-app',
14
+ light_sandbox: 'https://cdn.marmot-cloud.com/page/antom-web-checkout/src/component-app',
15
+ prod: 'https://cdn.marmot-cloud.com/page/antom-web-checkout/src/component-app'
16
16
  };
17
17
  export var sdkVersion = json.version;
@@ -140,15 +140,6 @@ export declare const EVENT: {
140
140
  dismissLoading: {
141
141
  name: string;
142
142
  };
143
- popupWindow: {
144
- name: string;
145
- };
146
- closePopup: {
147
- name: string;
148
- };
149
- threedReady: {
150
- name: string;
151
- };
152
143
  };
153
144
  export declare const COMPONENT_CONTAINER_ID = "ams-component-container";
154
145
  export declare const COMPONENT_SECTION_ID = "ams-component-section";
@@ -160,7 +151,6 @@ export declare const LOADING_ID = "ams-component-loading";
160
151
  export declare const LISTENER_PREFIX = "_ams_sdk_component_listener";
161
152
  export declare const INLINE_BASE_STYLE_ID = "ams-inline-component-style";
162
153
  export declare const INLINE_IMG_CLASSNAME = "inline-loading";
163
- export declare const AMSPOPUP_PREFIX = "ams-popup";
164
154
  export declare const LOADTIME_LIMIT = 15000;
165
155
  export declare const ANIMATION_TIME = 300;
166
156
  export declare const closeImg = "https://cdn.marmot-cloud.com/storage/2023/5/18/1692a487-99b5-4314-9d6f-e9814bc1ca41.svg";
@@ -139,15 +139,6 @@ export var EVENT = {
139
139
  },
140
140
  dismissLoading: {
141
141
  name: 'dismissLoading'
142
- },
143
- popupWindow: {
144
- name: 'popupWindow'
145
- },
146
- closePopup: {
147
- name: 'closePopup'
148
- },
149
- threedReady: {
150
- name: 'threedReady'
151
142
  }
152
143
  };
153
144
  export var COMPONENT_CONTAINER_ID = 'ams-component-container';
@@ -160,7 +151,6 @@ export var LOADING_ID = 'ams-component-loading';
160
151
  export var LISTENER_PREFIX = '_ams_sdk_component_listener';
161
152
  export var INLINE_BASE_STYLE_ID = 'ams-inline-component-style';
162
153
  export var INLINE_IMG_CLASSNAME = 'inline-loading';
163
- export var AMSPOPUP_PREFIX = 'ams-popup';
164
154
  export var LOADTIME_LIMIT = 15000;
165
155
  export var ANIMATION_TIME = 300;
166
156
  export var closeImg = 'https://cdn.marmot-cloud.com/storage/2023/5/18/1692a487-99b5-4314-9d6f-e9814bc1ca41.svg';
@@ -72,7 +72,7 @@ var handleParams = function handleParams(params) {
72
72
  paymentSessionMetaData: {},
73
73
  renderDisplayType: renderDisplayTypeEnum.popup
74
74
  }, params);
75
- var _handleSessionData = handleSessionData(_params.sessionData || (_params === null || _params === void 0 ? void 0 : _params.paymentSessionData)),
75
+ var _handleSessionData = handleSessionData(_params.sessionData),
76
76
  _handleSessionData2 = _slicedToArray(_handleSessionData, 2),
77
77
  parseData = _handleSessionData2[0],
78
78
  sessionData = _handleSessionData2[1];
@@ -119,7 +119,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
119
119
  selector: selector,
120
120
  renderDisplayType: renderDisplayType
121
121
  }, params);
122
- if (_params && !_params.sessionData && !(_params !== null && _params !== void 0 && _params.paymentSessionData)) {
122
+ if (_params && !_params.sessionData) {
123
123
  return Promise.reject(ERRORMESSAGE.CREATEPAYMENT_PARAMETER_ERROR);
124
124
  }
125
125
  if (this.options.networkMode === networkModeEnum.proxy) {
@@ -9,7 +9,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
9
9
  * 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
10
10
  * 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.
11
11
  */
12
- import { marmptMap, sdkVersion } from "../../config/index";
12
+ import { marmotMap, sdkVersion } from "../../config/index";
13
13
  import { componentSignEnum } from "../../types";
14
14
  import { getViewPort, queryParse, serialize } from "../../util/index";
15
15
  var getAppVersion = function getAppVersion(_extendInfo) {
@@ -46,7 +46,7 @@ export var getAppPath = function getAppPath() {
46
46
  if (urlTestHost && !['sandbox', 'light_sandbox', 'prod'].includes(environment)) {
47
47
  return urlTestHost;
48
48
  }
49
- return "".concat(marmptMap[environment], "/").concat(componentSign, "/").concat(finalProductSceneVersion, "/index.").concat(finalAppVersion, ".html");
49
+ return "".concat(marmotMap[environment], "/").concat(componentSign, "/").concat(finalProductSceneVersion, "/index.").concat(finalAppVersion, ".html");
50
50
  };
51
51
  export var getAppDomain = function getAppDomain(domainParams) {
52
52
  var environment = domainParams.environment,
@@ -9,8 +9,6 @@ export default class ComponentApp {
9
9
  _performanceData: any[];
10
10
  _loadAppPromiseResolve: ((value: boolean) => void) | null;
11
11
  _isInitComponent: boolean;
12
- private _threedData?;
13
- private popupWindow?;
14
12
  private appDomain;
15
13
  private createIframeNode;
16
14
  private _selector;
@@ -53,7 +51,6 @@ export default class ComponentApp {
53
51
  private createApp;
54
52
  private listener;
55
53
  private resizeListener;
56
- private createPopupWindow;
57
54
  /**
58
55
  * @description Initialize subscription iframe message
59
56
  */
@@ -76,7 +73,7 @@ export default class ComponentApp {
76
73
  */
77
74
  dispatchToApp(payload: {
78
75
  context: eventPayloadContext;
79
- }, element?: any): any;
76
+ }): any;
80
77
  /**
81
78
  * @description Subscribe to messages from SDK
82
79
  */
@@ -16,18 +16,16 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
16
16
  */
17
17
  /* eslint-disable no-console */
18
18
  /* eslint-disable @typescript-eslint/no-explicit-any */
19
- import APDID from '@alipay/jshield-apdid';
20
- import { marmptMap } from "../../config/index";
21
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";
22
20
  import { queryPaymentInfo } from "../../service";
23
21
  import { componentSignEnum, eventCodeEnum, messageName, platformEnum, productSceneEnum, renderDisplayTypeEnum, targetEnum } from "../../types";
24
22
  import { getType, isJsonString, isPC, queryParse } from "../../util";
25
23
  import { isLocalMock } from "../../util/mock";
26
- import { getAppname, getSecurityHost } from "../../util/security";
27
24
  import { createIframe, getAppDomain, getIframeUrl } from "./cashierApp";
28
25
  import { addInlineLoading, createInlineBaseElement } from "./component.inline.style";
29
26
  import { addPopupLoading, createBaseElement, createMockup, createRetentionPopup, handleDeclareInfo as _handleDeclareInfo, hideRetentionPopup, removeRetentionPopup as _removeRetentionPopup } from "./component.popup.style";
30
- import { createModal, insertStyleSheet, destroyModal } from "./popupWindow.style";
27
+ import APDID from '@alipay/jshield-apdid';
28
+ import { getSecurityHost, getAppname } from "../../util/security";
31
29
  var _ref = queryParse() || {},
32
30
  preinit = _ref.preinit,
33
31
  rebuild = _ref.rebuild,
@@ -43,8 +41,6 @@ var ComponentApp = /*#__PURE__*/function () {
43
41
  _defineProperty(this, "_performanceData", []);
44
42
  _defineProperty(this, "_loadAppPromiseResolve", null);
45
43
  _defineProperty(this, "_isInitComponent", void 0);
46
- _defineProperty(this, "_threedData", void 0);
47
- _defineProperty(this, "popupWindow", void 0);
48
44
  _defineProperty(this, "appDomain", void 0);
49
45
  _defineProperty(this, "createIframeNode", void 0);
50
46
  _defineProperty(this, "_selector", void 0);
@@ -55,7 +51,7 @@ var ComponentApp = /*#__PURE__*/function () {
55
51
  _defineProperty(this, "_componentSign", componentSignEnum.NONE);
56
52
  _defineProperty(this, "_clickEventName", void 0);
57
53
  _defineProperty(this, "_renderDisplayType", renderDisplayTypeEnum.popup);
58
- this._appVersion = '1.5.9';
54
+ this._appVersion = '1.5.8';
59
55
  this._isInitComponent = false;
60
56
  this._selector = "#".concat(COMPONENT_SECTION_ID);
61
57
  this.createIframeNode = function () {
@@ -117,7 +113,7 @@ var ComponentApp = /*#__PURE__*/function () {
117
113
  APDID.initToken(appName, {
118
114
  host: h5gateway
119
115
  }, function (success, tokenResult, msg) {
120
- console.log('initToken result tokenResult', JSON.stringify(tokenResult));
116
+ console.log("initToken result tokenResult", JSON.stringify(tokenResult));
121
117
  });
122
118
  }
123
119
 
@@ -149,7 +145,6 @@ var ComponentApp = /*#__PURE__*/function () {
149
145
  if (this._renderDisplayType === renderDisplayTypeEnum.inline) {
150
146
  var container = createInlineBaseElement(this._selector);
151
147
  if (container) this.renderInlineLoading(renderParams, container);
152
- insertStyleSheet();
153
148
  }
154
149
  if (this._renderDisplayType === renderDisplayTypeEnum.popup) {
155
150
  createBaseElement(this.platform, this.closeBtnFunc.bind(this));
@@ -215,11 +210,10 @@ var ComponentApp = /*#__PURE__*/function () {
215
210
  value: Date.now()
216
211
  });
217
212
  this._actionQueryPromise = new Promise(function (resolve, reject) {
218
- var _this3$_renderParams, _this3$_renderParams2, _this3$_renderParams3, _this3$_renderParams4;
213
+ var _this3$_renderParams, _this3$_renderParams2, _this3$_renderParams3;
219
214
  var params = {
220
215
  paymentSessionData: _this3._renderParams && ((_this3$_renderParams = _this3._renderParams) === null || _this3$_renderParams === void 0 ? void 0 : _this3$_renderParams.sessionData) || '',
221
- paymentSessionConfig: (_this3$_renderParams2 = _this3._renderParams) === null || _this3$_renderParams2 === void 0 || (_this3$_renderParams2 = _this3$_renderParams2.paymentSessionMetaData) === null || _this3$_renderParams2 === void 0 ? void 0 : _this3$_renderParams2.paymentSessionConfig,
222
- notRedirectAfterComplete: ((_this3$_renderParams3 = _this3._renderParams) === null || _this3$_renderParams3 === void 0 ? void 0 : _this3$_renderParams3.notRedirectAfterComplete) === true
216
+ paymentSessionConfig: (_this3$_renderParams2 = _this3._renderParams) === null || _this3$_renderParams2 === void 0 || (_this3$_renderParams2 = _this3$_renderParams2.paymentSessionMetaData) === null || _this3$_renderParams2 === void 0 ? void 0 : _this3$_renderParams2.paymentSessionConfig
223
217
  };
224
218
  /**
225
219
  * @description card
@@ -229,10 +223,10 @@ var ComponentApp = /*#__PURE__*/function () {
229
223
  }
230
224
  var needDeviceId = false;
231
225
  var waitTime = '3000';
232
- var securityConfig = (_this3$_renderParams4 = _this3._renderParams) === null || _this3$_renderParams4 === void 0 || (_this3$_renderParams4 = _this3$_renderParams4.paymentSessionMetaData) === null || _this3$_renderParams4 === void 0 ? void 0 : _this3$_renderParams4.securityConfig;
226
+ var securityConfig = (_this3$_renderParams3 = _this3._renderParams) === null || _this3$_renderParams3 === void 0 || (_this3$_renderParams3 = _this3$_renderParams3.paymentSessionMetaData) === null || _this3$_renderParams3 === void 0 ? void 0 : _this3$_renderParams3.securityConfig;
233
227
  if (componentSignEnum.CASHIER_PAYMENT_CARD === _this3._componentSign && securityConfig) {
234
- var _this3$_renderParams5;
235
- var extendInfo = ((_this3$_renderParams5 = _this3._renderParams) === null || _this3$_renderParams5 === void 0 || (_this3$_renderParams5 = _this3$_renderParams5.paymentSessionMetaData) === null || _this3$_renderParams5 === void 0 ? void 0 : _this3$_renderParams5.extendInfo) || '';
228
+ var _this3$_renderParams4;
229
+ var extendInfo = ((_this3$_renderParams4 = _this3._renderParams) === null || _this3$_renderParams4 === void 0 || (_this3$_renderParams4 = _this3$_renderParams4.paymentSessionMetaData) === null || _this3$_renderParams4 === void 0 ? void 0 : _this3$_renderParams4.extendInfo) || '';
236
230
  var info = JSON.parse(extendInfo);
237
231
  if ((info === null || info === void 0 ? void 0 : info.cardTokenPay) !== 'false') {
238
232
  needDeviceId = true;
@@ -244,13 +238,13 @@ var ComponentApp = /*#__PURE__*/function () {
244
238
  * @description easyPay
245
239
  */
246
240
  if (componentSignEnum.EASY_PAY_WALLET === _this3._componentSign) {
247
- var _this3$_renderParams6;
241
+ var _this3$_renderParams5;
248
242
  var _ref2 = params.paymentSessionConfig || {},
249
243
  _ref2$productSceneVer = _ref2.productSceneVersion,
250
244
  productSceneVersion = _ref2$productSceneVer === void 0 ? '' : _ref2$productSceneVer,
251
245
  _ref2$productScene = _ref2.productScene,
252
246
  productScene = _ref2$productScene === void 0 ? '' : _ref2$productScene;
253
- var _ref3 = ((_this3$_renderParams6 = _this3._renderParams) === null || _this3$_renderParams6 === void 0 ? void 0 : _this3$_renderParams6.paymentSessionMetaData) || {},
247
+ var _ref3 = ((_this3$_renderParams5 = _this3._renderParams) === null || _this3$_renderParams5 === void 0 ? void 0 : _this3$_renderParams5.paymentSessionMetaData) || {},
254
248
  _ref3$action = _ref3.action,
255
249
  _ref3$action2 = _ref3$action === void 0 ? {} : _ref3$action,
256
250
  _ref3$action2$autoDeb = _ref3$action2.autoDebitWithToken,
@@ -268,8 +262,8 @@ var ComponentApp = /*#__PURE__*/function () {
268
262
  * @description autoDebit
269
263
  */
270
264
  if (componentSignEnum.AUTO_DEBIT_WALLET === _this3._componentSign) {
271
- var _this3$_renderParams7, _action$web, _action$wap;
272
- var action = ((_this3$_renderParams7 = _this3._renderParams) === null || _this3$_renderParams7 === void 0 || (_this3$_renderParams7 = _this3$_renderParams7.paymentSessionMetaData) === null || _this3$_renderParams7 === void 0 ? void 0 : _this3$_renderParams7.action) || {};
265
+ var _this3$_renderParams6, _action$web, _action$wap;
266
+ var action = ((_this3$_renderParams6 = _this3._renderParams) === null || _this3$_renderParams6 === void 0 || (_this3$_renderParams6 = _this3$_renderParams6.paymentSessionMetaData) === null || _this3$_renderParams6 === void 0 ? void 0 : _this3$_renderParams6.action) || {};
273
267
  var signType = isPC() ? action === null || action === void 0 || (_action$web = action.web) === null || _action$web === void 0 ? void 0 : _action$web.signType : action === null || action === void 0 || (_action$wap = action.wap) === null || _action$wap === void 0 ? void 0 : _action$wap.signType;
274
268
  if (signType === 'SMS') {
275
269
  return resolve({
@@ -307,11 +301,6 @@ var ComponentApp = /*#__PURE__*/function () {
307
301
  resolve(res);
308
302
  }
309
303
  }).catch(function (err) {
310
- if (componentSignEnum.CASHIER_PAYMENT_CARD === _this3._componentSign) {
311
- return resolve({
312
- success: false
313
- });
314
- }
315
304
  _this3.dispatchToSDK(EVENT.error.name, {
316
305
  code: ERRORMESSAGE.CREATECOMPONENT_ERROR.code
317
306
  });
@@ -411,6 +400,8 @@ var ComponentApp = /*#__PURE__*/function () {
411
400
  if (data.name !== messageName.APP_TO_SDK && data.name !== messageName.APP_TO_APP || data.instanceId !== this.AMSSDK._instanceId) {
412
401
  return;
413
402
  }
403
+ // TODO
404
+ // 如果带有callback标识,则从map结构中取出callbackfunc,执行,执行后在map结构中删除
414
405
  this._handleAppMessage(data);
415
406
  } else {
416
407
  console.warn(ERRORMESSAGE.NOT_JSON_FORMAT);
@@ -433,19 +424,6 @@ var ComponentApp = /*#__PURE__*/function () {
433
424
  }
434
425
  });
435
426
  }
436
- }, {
437
- key: "createPopupWindow",
438
- value: function createPopupWindow(data) {
439
- var _this$_renderParams2;
440
- this._threedData = data;
441
- var sessionData = encodeURIComponent((_this$_renderParams2 = this._renderParams) === null || _this$_renderParams2 === void 0 ? void 0 : _this$_renderParams2.sessionData);
442
- // const threedPageUrl = `http://192.168.1.5:5173/src/component-app/threedPage/demo.html?scene=threedWrapperPage&sessionData=${sessionData}&instanceId=${this.AMSSDK._instanceId}`
443
- var threedPageUrl = "".concat(marmptMap[this.AMSSDK.options.env.environment], "/threedPage/index.html?scene=threedWrapperPage&sessionData=").concat(sessionData, "&instanceId=").concat(this.AMSSDK._instanceId);
444
- this.popupWindow = createModal({
445
- device: this.platform,
446
- url: threedPageUrl
447
- });
448
- }
449
427
 
450
428
  /**
451
429
  * @description Initialize subscription iframe message
@@ -472,28 +450,10 @@ var ComponentApp = /*#__PURE__*/function () {
472
450
  }, {
473
451
  key: "_handleAppMessage",
474
452
  value: function _handleAppMessage(data) {
475
- var eventKeyMap = [EVENT.launch.name, EVENT.redirect.name, EVENT.sizeChanged.name, EVENT.log.name, EVENT.close.name, EVENT.error.name, EVENT.eventCallback.name, EVENT.submitForm.name, EVENT.showCloseButton.name, EVENT.hideCloseButton.name, EVENT.setAllowRetention.name, EVENT.declareCheckoutInfo.name, EVENT.showPopup.name, EVENT.dismissLoading.name, EVENT.popupWindow.name, EVENT.threedReady.name, EVENT.closePopup.name];
453
+ var eventKeyMap = [EVENT.launch.name, EVENT.redirect.name, EVENT.sizeChanged.name, EVENT.log.name, EVENT.close.name, EVENT.error.name, EVENT.eventCallback.name, EVENT.submitForm.name, EVENT.showCloseButton.name, EVENT.hideCloseButton.name, EVENT.setAllowRetention.name, EVENT.declareCheckoutInfo.name, EVENT.showPopup.name, EVENT.dismissLoading.name];
476
454
  if (!eventKeyMap.includes(data.context.event)) {
477
455
  return;
478
456
  }
479
- if (data.context.event === EVENT.closePopup.name) {
480
- destroyModal();
481
- return;
482
- }
483
- if (data.context.event === EVENT.threedReady.name) {
484
- this.dispatchToApp({
485
- context: {
486
- event: 'renderThreedPage',
487
- data: this._threedData
488
- }
489
- }, this.popupWindow);
490
- return;
491
- }
492
- if (data.context.event === EVENT.popupWindow.name) {
493
- var _data$context;
494
- this.createPopupWindow((_data$context = data.context) === null || _data$context === void 0 ? void 0 : _data$context.data);
495
- return;
496
- }
497
457
  if (data.context.event === EVENT.dismissLoading.name) {
498
458
  var _data$context$data;
499
459
  this.dispatchToSDK(EVENT.eventCallback.name, {
@@ -684,16 +644,13 @@ var ComponentApp = /*#__PURE__*/function () {
684
644
  }, {
685
645
  key: "dispatchToApp",
686
646
  value: function dispatchToApp(payload) {
687
- var element = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
688
647
  var data = Object.assign({}, payload, {
689
648
  name: messageName.SDK_TO_APP,
690
649
  mode: this.AMSSDK.options.mode,
691
650
  appId: COMPONENTPLUGINID,
692
651
  instanceId: this.AMSSDK._instanceId
693
652
  });
694
- if (element && element.contentWindow) {
695
- return element.contentWindow.postMessage(JSON.stringify(data), '*');
696
- }
653
+ // TODO 如果存在回调函数,则增加callBack标识,并存入map。map可以设置
697
654
  if (this.app && this.app.contentWindow) {
698
655
  return this.app.contentWindow.postMessage(JSON.stringify(data), this.appDomain);
699
656
  }
@@ -722,7 +679,7 @@ var ComponentApp = /*#__PURE__*/function () {
722
679
  key: "sendRenderEvent",
723
680
  value: function () {
724
681
  var _sendRenderEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
725
- var _this$_renderParams3, _this$_renderParams4, _this$_renderParams5, _this$_renderParams6, _this$_renderParams7, res;
682
+ var _this$_renderParams2, _this$_renderParams3, _this$_renderParams4, _this$_renderParams5, res;
726
683
  return _regeneratorRuntime().wrap(function _callee$(_context) {
727
684
  while (1) switch (_context.prev = _context.next) {
728
685
  case 0:
@@ -746,12 +703,11 @@ var ComponentApp = /*#__PURE__*/function () {
746
703
  event: 'renderComponent',
747
704
  data: {
748
705
  queryResult: res,
749
- sessionResult: (_this$_renderParams3 = this._renderParams) === null || _this$_renderParams3 === void 0 ? void 0 : _this$_renderParams3.paymentSessionMetaData,
750
- paymentSessionData: (_this$_renderParams4 = this._renderParams) === null || _this$_renderParams4 === void 0 ? void 0 : _this$_renderParams4.sessionData,
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,
751
708
  heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
752
- renderDisplayType: (_this$_renderParams5 = this._renderParams) === null || _this$_renderParams5 === void 0 ? void 0 : _this$_renderParams5.renderDisplayType,
753
- appearance: (_this$_renderParams6 = this._renderParams) === null || _this$_renderParams6 === void 0 ? void 0 : _this$_renderParams6.appearance,
754
- notRedirectAfterComplete: ((_this$_renderParams7 = this._renderParams) === null || _this$_renderParams7 === void 0 ? void 0 : _this$_renderParams7.notRedirectAfterComplete) === true,
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,
755
711
  envInfo: {
756
712
  screenHeight: screen.height,
757
713
  screenWidth: screen.width
@@ -58,9 +58,7 @@ export declare enum paymentMethodCategoryTypeEnum {
58
58
  }
59
59
  export interface IcreateComponent {
60
60
  sessionData: string;
61
- paymentSessionData?: string;
62
61
  appearance?: Record<string, any>;
63
- notRedirectAfterComplete?: boolean;
64
62
  }
65
63
  export interface IappendIframeNodesParams extends IcreateComponent {
66
64
  paymentSessionMetaData: IpaymentSessionMetaData;
@@ -68,12 +66,12 @@ export interface IappendIframeNodesParams extends IcreateComponent {
68
66
  selector?: Iselector;
69
67
  }
70
68
  export interface IbillingAddress {
71
- region: string;
72
- address1: string;
69
+ region?: string;
70
+ address1?: string;
73
71
  address2?: string;
74
- city: string;
72
+ city?: string;
75
73
  state?: string;
76
- zipCode: string;
74
+ zipCode?: string;
77
75
  }
78
76
  export interface Isubmit {
79
77
  billingAddress?: IbillingAddress;
@@ -145,16 +143,6 @@ export declare enum platformEnum {
145
143
  desktop = "desktop",
146
144
  mobile = "mobile"
147
145
  }
148
- type EventCallbackResult = {
149
- result: {
150
- resultCode: string;
151
- resultStatus: string;
152
- resultMessage: string;
153
- };
154
- paymentResultCode?: string;
155
- paymentResultMessage?: string;
156
- paymentStatus?: string;
157
- } & Record<string, any>;
158
146
  /**
159
147
  * @description Create an event handler, called when an error occurs in AMSCheckout.
160
148
  */
@@ -175,8 +163,7 @@ export type callOnLog = (state: {
175
163
  */
176
164
  export type callOnEventCallback = (state: {
177
165
  code: string;
178
- message?: string;
179
- result?: EventCallbackResult;
166
+ message: string;
180
167
  }) => void;
181
168
  export type callonPaymentMethodSelected = (state: {
182
169
  paymentMethodType: string;
@@ -256,7 +243,6 @@ export interface CashierSdkActionQueryRequest {
256
243
  paymentSessionData: string;
257
244
  paymentSessionConfig?: IpaymentSessionConfig;
258
245
  paymentMethodType?: string;
259
- notRedirectAfterComplete?: boolean;
260
246
  extParams?: any;
261
247
  }
262
248
  export interface CashierSdkActionQueryResult {
@@ -286,13 +272,6 @@ export declare enum eventCodeEnum {
286
272
  SDK_CALL_URL_ERROR = "SDK_CALL_URL_ERROR",
287
273
  SDK_CALL_URL_SUCCESS = "SDK_CALL_URL_SUCCESS"
288
274
  }
289
- export interface ThreedData {
290
- data: any;
291
- method: string;
292
- targetUrl: string;
293
- pti?: number;
294
- pt?: number;
295
- }
296
275
  declare global {
297
276
  interface Window {
298
277
  [key: string]: any;
@@ -80,7 +80,6 @@ export var platformEnum = /*#__PURE__*/function (platformEnum) {
80
80
  platformEnum["mobile"] = "mobile";
81
81
  return platformEnum;
82
82
  }({});
83
-
84
83
  /**
85
84
  * @description Create an event handler, called when an error occurs in AMSCheckout.
86
85
  */
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@alipay/ams-checkout","version":"0.0.1697942541-dev.4","description":"","author":"","main":"esm/index.js","module":"esm/index.js","typings":"esm/index.d.ts","files":["dist","esm","LEGAL.md","LICENSE","README.md"],"scripts":{"build":"father build","ci":"npm run lint","cov":"jest --coverage","format":"prettier --write --no-error-on-unmatched-pattern \"**/*.{js,jsx,ts,tsx,md,json,css,less}\"","lint":"eslint ./src","test":"jest"},"dependencies":{"axios":"^1.3.4","uuid":"^9.0.0"},"devDependencies":{"@alipay/jshield-apdid":"^2.0.3","@babel/core":"^7.20.7","@babel/preset-env":"^7.20.2","@testing-library/jest-dom":"^5.1.1","@testing-library/react":"^9.5.0","@types/jest":"^29.2.4","@types/uuid":"^9.0.0","@typescript-eslint/eslint-plugin":"latest","@typescript-eslint/parser":"^5.60.0","babel-jest":"^29.3.1","babel-loader":"^9.1.0","babel-plugin-import":"^1.13.0","eslint":"^8.36.0","eslint-plugin-prettier":"latest","father":"^4.2.3","jest":"^29.5.0","jest-environment-jsdom":"^29.3.1","prettier":"^2.8.4","prettier-plugin-organize-imports":"^3.2.3","prettier-plugin-packagejson":"^2.4.5","ts-jest":"^29.0.3","ts-node":"^10.9.1","typescript":"^4.9.5"},"engines":{},"publishConfig":{"access":"public"}}
1
+ {"name":"@alipay/ams-checkout","version":"0.0.1698315116-dev.0","description":"","author":"","main":"esm/index.js","module":"esm/index.js","typings":"esm/index.d.ts","files":["dist","esm","LEGAL.md","LICENSE","README.md"],"scripts":{"build":"father build","ci":"npm run lint","cov":"jest --coverage","format":"prettier --write --no-error-on-unmatched-pattern \"**/*.{js,jsx,ts,tsx,md,json,css,less}\"","lint":"eslint ./src","test":"jest"},"dependencies":{"axios":"^1.3.4","uuid":"^9.0.0"},"devDependencies":{"@alipay/jshield-apdid":"^2.0.3","@babel/core":"^7.20.7","@babel/preset-env":"^7.20.2","@testing-library/jest-dom":"^5.1.1","@testing-library/react":"^9.5.0","@types/jest":"^29.2.4","@types/uuid":"^9.0.0","@typescript-eslint/eslint-plugin":"latest","@typescript-eslint/parser":"^5.60.0","babel-jest":"^29.3.1","babel-loader":"^9.1.0","babel-plugin-import":"^1.13.0","eslint":"^8.36.0","eslint-plugin-prettier":"latest","father":"^4.2.3","jest":"^29.5.0","jest-environment-jsdom":"^29.3.1","prettier":"^2.8.4","prettier-plugin-organize-imports":"^3.2.3","prettier-plugin-packagejson":"^2.4.5","ts-jest":"^29.0.3","ts-node":"^10.9.1","typescript":"^4.9.5"},"engines":{},"publishConfig":{"access":"public"}}
@@ -1,6 +0,0 @@
1
- export declare const insertStyleSheet: () => void;
2
- export declare const createModal: ({ device, url }: {
3
- device: any;
4
- url: any;
5
- }) => HTMLIFrameElement;
6
- export declare const destroyModal: () => void;
@@ -1,54 +0,0 @@
1
- import { AMSPOPUP_PREFIX, ANIMATION_TIME } from "../../constant";
2
-
3
- // CSS样式字符串
4
- var modalStyles = "\n .".concat(AMSPOPUP_PREFIX, "modal {\n /* \u6DFB\u52A0\u5F39\u7A97\u6837\u5F0F */\n background-color: #fff;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 9999; /* \u8BBE\u7F6E\u5F39\u7A97\u7684\u5C42\u7EA7\u4E3A 9999 */\n overflow: hidden;\n }\n\n .").concat(AMSPOPUP_PREFIX, "overlay {\n /* \u6DFB\u52A0\u8499\u5C42\u6837\u5F0F */\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.4);\n z-index: 999;\n }\n\n .").concat(AMSPOPUP_PREFIX, "fadeIn {\n /* \u6DFB\u52A0\u6DE1\u5165\u52A8\u753B */\n animation: fadeIn ").concat(ANIMATION_TIME, "ms;\n }\n\n .").concat(AMSPOPUP_PREFIX, "fadeOut {\n /* \u6DFB\u52A0\u6DE1\u51FA\u52A8\u753B */\n animation: fadeOut ").concat(ANIMATION_TIME, "ms;\n }\n\n /* \u5B9A\u4E49\u6DE1\u5165\u52A8\u753B */\n @keyframes fadeIn {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n\n /* \u5B9A\u4E49\u6DE1\u51FA\u52A8\u753B */\n @keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n");
5
-
6
- // 创建和插入样式表
7
- export var insertStyleSheet = function insertStyleSheet() {
8
- var style = document.createElement('style');
9
- style.innerHTML = modalStyles;
10
- document.head.appendChild(style);
11
- };
12
-
13
- // 插入弹窗
14
- export var createModal = function createModal(_ref) {
15
- var device = _ref.device,
16
- url = _ref.url;
17
- var overlay = document.createElement('div');
18
- overlay.classList.add("".concat(AMSPOPUP_PREFIX, "overlay"), "".concat(AMSPOPUP_PREFIX, "fadeIn"));
19
- var modal = document.createElement('div');
20
- modal.classList.add("".concat(AMSPOPUP_PREFIX, "modal"), "".concat(AMSPOPUP_PREFIX, "fadeIn"));
21
- if (device === 'desktop') {
22
- modal.style.width = '600px';
23
- modal.style.height = '464px';
24
- modal.style.borderRadius = '12px';
25
- } else {
26
- modal.style.width = 'calc(100% - 16px)';
27
- modal.style.height = '80%';
28
- modal.style.borderRadius = '8px';
29
- }
30
- var iframe = document.createElement('iframe');
31
- iframe.src = url; // 替换为实际的 URL 地址
32
- iframe.style.border = 'none';
33
- iframe.style.width = '100%';
34
- iframe.style.height = '100%';
35
- modal.appendChild(iframe);
36
- var body = document.getElementsByTagName('body')[0];
37
- body.appendChild(overlay);
38
- body.appendChild(modal);
39
- return iframe;
40
- };
41
-
42
- // 销毁弹窗
43
- export var destroyModal = function destroyModal() {
44
- var overlay = document.querySelector(".".concat(AMSPOPUP_PREFIX, "overlay"));
45
- var modal = document.querySelector(".".concat(AMSPOPUP_PREFIX, "modal"));
46
- overlay.classList.remove("".concat(AMSPOPUP_PREFIX, "fadeIn"));
47
- overlay.classList.add("".concat(AMSPOPUP_PREFIX, "fadeOut"));
48
- modal.classList.remove("".concat(AMSPOPUP_PREFIX, "fadeIn"));
49
- modal.classList.add("".concat(AMSPOPUP_PREFIX, "fadeOut"));
50
- setTimeout(function () {
51
- overlay.parentNode.removeChild(overlay);
52
- modal.parentNode.removeChild(modal);
53
- }, ANIMATION_TIME);
54
- };