@alipay/ams-checkout 0.0.1701663818-dev.0 → 0.0.1701850681-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.
@@ -140,13 +140,10 @@ export declare const EVENT: {
140
140
  dismissLoading: {
141
141
  name: string;
142
142
  };
143
- popupWindow: {
143
+ startDialog: {
144
144
  name: string;
145
145
  };
146
- closePopup: {
147
- name: string;
148
- };
149
- threedReady: {
146
+ popWindow: {
150
147
  name: string;
151
148
  };
152
149
  getDeviceId: {
@@ -155,6 +152,18 @@ export declare const EVENT: {
155
152
  declareEventCallbackInfo: {
156
153
  name: string;
157
154
  };
155
+ setGlobalData: {
156
+ name: string;
157
+ };
158
+ getGlobalData: {
159
+ name: string;
160
+ };
161
+ sendMuitiAppEventToSdk: {
162
+ name: string;
163
+ };
164
+ receiveMuitiAppFromSdk: {
165
+ name: string;
166
+ };
158
167
  };
159
168
  export declare const COMPONENT_CONTAINER_ID = "ams-component-container";
160
169
  export declare const COMPONENT_SECTION_ID = "ams-component-section";
@@ -140,20 +140,29 @@ export var EVENT = {
140
140
  dismissLoading: {
141
141
  name: 'dismissLoading'
142
142
  },
143
- popupWindow: {
144
- name: 'popupWindow'
143
+ startDialog: {
144
+ name: 'startDialog'
145
145
  },
146
- closePopup: {
147
- name: 'closePopup'
148
- },
149
- threedReady: {
150
- name: 'threedReady'
146
+ popWindow: {
147
+ name: 'popWindow'
151
148
  },
152
149
  getDeviceId: {
153
150
  name: 'getDeviceId'
154
151
  },
155
152
  declareEventCallbackInfo: {
156
153
  name: 'declareEventCallbackInfo'
154
+ },
155
+ setGlobalData: {
156
+ name: 'setGlobalData'
157
+ },
158
+ getGlobalData: {
159
+ name: 'getGlobalData'
160
+ },
161
+ sendMuitiAppEventToSdk: {
162
+ name: 'sendMuitiAppEventToSdk'
163
+ },
164
+ receiveMuitiAppFromSdk: {
165
+ name: 'receiveMuitiAppFromSdk'
157
166
  }
158
167
  };
159
168
  export var COMPONENT_CONTAINER_ID = 'ams-component-container';
@@ -163,6 +163,16 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
163
163
  _this2._eventCenter.emit(EVENT.error.name, error);
164
164
  return Promise.reject(error);
165
165
  }).then(function (appendParams) {
166
+ var _appendParams$iframeN, _appendParams$iframeN2;
167
+ // This version, easypay2.0 only supports alipayhk
168
+ var productSceneVersion = appendParams === null || appendParams === void 0 || (_appendParams$iframeN = appendParams.iframeNodesParams) === null || _appendParams$iframeN === void 0 || (_appendParams$iframeN = _appendParams$iframeN.paymentSessionMetaData) === null || _appendParams$iframeN === void 0 || (_appendParams$iframeN = _appendParams$iframeN.paymentSessionConfig) === null || _appendParams$iframeN === void 0 ? void 0 : _appendParams$iframeN.productSceneVersion;
169
+ var paymentMethodType = appendParams === null || appendParams === void 0 || (_appendParams$iframeN2 = appendParams.iframeNodesParams) === null || _appendParams$iframeN2 === void 0 || (_appendParams$iframeN2 = _appendParams$iframeN2.paymentSessionMetaData) === null || _appendParams$iframeN2 === void 0 || (_appendParams$iframeN2 = _appendParams$iframeN2.paymentMethodInfoView) === null || _appendParams$iframeN2 === void 0 ? void 0 : _appendParams$iframeN2.paymentMethodType;
170
+ if ((appendParams === null || appendParams === void 0 ? void 0 : appendParams.componentSign) === componentSignEnum.EASY_PAY_WALLET && productSceneVersion === '2.0' && paymentMethodType !== 'ALIPAY_HK') {
171
+ return Promise.reject({
172
+ code: ERRORMESSAGE.CREATEPAYMENT_PARAMETER_ERROR.code,
173
+ message: "Abnormal response data, interface failure, or unsupported payment method"
174
+ });
175
+ }
166
176
  return _this2.pluginAppendIframe(appendParams);
167
177
  });
168
178
  }
@@ -3,14 +3,14 @@ import type { eventPayload, eventPayloadContext, IappendIframeNodesParams, Isele
3
3
  import { componentSignEnum, platformEnum, renderDisplayTypeEnum } from '../../types';
4
4
  type IrenderFuncParams = (context: ComponentApp, selector: Iselector, renderDisplayType: renderDisplayTypeEnum) => Promise<void>;
5
5
  export default class ComponentApp {
6
- app: any;
6
+ app: null | HTMLIFrameElement;
7
7
  AMSSDK: AMSCheckout;
8
8
  platform: platformEnum;
9
9
  _performanceData: any[];
10
10
  _loadAppPromiseResolve: ((value: boolean) => void) | null;
11
11
  _isInitComponent: boolean;
12
- private _threedData?;
13
- private popupWindow?;
12
+ private _globalData?;
13
+ private popupApp?;
14
14
  private appDomain;
15
15
  private createIframeNode;
16
16
  private _selector;
@@ -44,9 +44,10 @@ export default class ComponentApp {
44
44
  * @description render iframe content
45
45
  */
46
46
  appendIframeNodes(componentSign: componentSignEnum, renderParams: IappendIframeNodesParams): Promise<void>;
47
+ private setParameterDefaultValues;
47
48
  private renderInlineLoading;
48
49
  private renderPopupLoading;
49
- _createLoadAppPromise(): Promise<unknown>;
50
+ _createLoadAppPromise(loadTimeLimit?: number): Promise<unknown>;
50
51
  /**
51
52
  * @description Interface request
52
53
  */
@@ -59,8 +60,9 @@ export default class ComponentApp {
59
60
  private createApp;
60
61
  private listener;
61
62
  private resizeListener;
62
- private createPopupWindow;
63
+ private createDialog;
63
64
  private getDeviceIdAndCallback;
65
+ private returnDataAndCallback;
64
66
  /**
65
67
  * @description Initialize subscription iframe message
66
68
  */
@@ -15,7 +15,7 @@ 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 @typescript-eslint/no-explicit-any */
18
- import { marmotMap } from "../../config/index";
18
+ // import { marmotMap } from '../../config/index';
19
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";
20
20
  import { queryPaymentInfo, submitPayInfo } from "../../service";
21
21
  import { componentSignEnum, eventCodeEnum, messageName, platformEnum, productSceneEnum, RedirectType, renderDisplayTypeEnum, targetEnum } from "../../types";
@@ -35,8 +35,8 @@ var ComponentApp = /*#__PURE__*/function () {
35
35
  _defineProperty(this, "_performanceData", []);
36
36
  _defineProperty(this, "_loadAppPromiseResolve", null);
37
37
  _defineProperty(this, "_isInitComponent", void 0);
38
- _defineProperty(this, "_threedData", void 0);
39
- _defineProperty(this, "popupWindow", void 0);
38
+ _defineProperty(this, "_globalData", void 0);
39
+ _defineProperty(this, "popupApp", void 0);
40
40
  _defineProperty(this, "appDomain", void 0);
41
41
  _defineProperty(this, "createIframeNode", void 0);
42
42
  _defineProperty(this, "_selector", void 0);
@@ -49,7 +49,7 @@ var ComponentApp = /*#__PURE__*/function () {
49
49
  _defineProperty(this, "_appLocationSearch", void 0);
50
50
  _defineProperty(this, "_renderDisplayType", renderDisplayTypeEnum.popup);
51
51
  _defineProperty(this, "_multipleCallbackEvents", void 0);
52
- this._appVersion = '1.6.2';
52
+ this._appVersion = '1.7.0';
53
53
  this._isInitComponent = false;
54
54
  this._selector = "#".concat(COMPONENT_SECTION_ID);
55
55
  this.createIframeNode = function () {
@@ -62,6 +62,7 @@ var ComponentApp = /*#__PURE__*/function () {
62
62
  key: 'sdk_init',
63
63
  value: Date.now()
64
64
  });
65
+ this._globalData = new Map();
65
66
  }
66
67
 
67
68
  /**
@@ -227,15 +228,17 @@ var ComponentApp = /*#__PURE__*/function () {
227
228
  }, {
228
229
  key: "appendIframeNodes",
229
230
  value: function appendIframeNodes(componentSign, renderParams) {
230
- var _this3 = this;
231
+ var _renderParams,
232
+ _this3 = this;
231
233
  if (this._isInitComponent) {
232
234
  this.dispatchToSDK(EVENT.error.name, ERRORMESSAGE.CREATECOMPONENT_ERROR.SINGLETON_COMPONENT_ERROR);
233
235
  return Promise.reject(ERRORMESSAGE.CREATECOMPONENT_ERROR.SINGLETON_COMPONENT_ERROR);
234
236
  }
237
+ renderParams = this.setParameterDefaultValues(componentSign, renderParams);
235
238
  this._isInitComponent = true;
236
239
  this._renderParams = renderParams;
237
240
  this._componentSign = componentSign;
238
- if (renderParams !== null && renderParams !== void 0 && renderParams.selector) this._selector = renderParams.selector;
241
+ if ((_renderParams = renderParams) !== null && _renderParams !== void 0 && _renderParams.selector) this._selector = renderParams.selector;
239
242
  this._renderDisplayType = renderParams.renderDisplayType;
240
243
  var insertedNode = this._renderDisplayType === renderDisplayTypeEnum.inline ? "#".concat(COMPONENT_CONTAINER_ID) : this._selector;
241
244
  this.initSecurity();
@@ -270,6 +273,16 @@ var ComponentApp = /*#__PURE__*/function () {
270
273
  return Promise.reject(error);
271
274
  });
272
275
  }
276
+ }, {
277
+ key: "setParameterDefaultValues",
278
+ value: function setParameterDefaultValues(componentSign, renderParams) {
279
+ var newParams = Object.assign({}, renderParams);
280
+ if (componentSign === componentSignEnum.VAULTING_CARD) {
281
+ var _newParams$notRedirec;
282
+ newParams.notRedirectAfterComplete = (_newParams$notRedirec = newParams === null || newParams === void 0 ? void 0 : newParams.notRedirectAfterComplete) !== null && _newParams$notRedirec !== void 0 ? _newParams$notRedirec : true;
283
+ }
284
+ return newParams;
285
+ }
273
286
  }, {
274
287
  key: "renderInlineLoading",
275
288
  value: function renderInlineLoading(renderParams, selector) {
@@ -291,18 +304,15 @@ var ComponentApp = /*#__PURE__*/function () {
291
304
  }
292
305
  }, {
293
306
  key: "_createLoadAppPromise",
294
- value: function _createLoadAppPromise() {
307
+ value: function _createLoadAppPromise(loadTimeLimit) {
295
308
  var _this4 = this;
296
309
  return new Promise(function (resolve, reject) {
297
310
  _this4._loadAppPromiseResolve = resolve;
298
311
  setTimeout(function () {
299
312
  reject(ERRORMESSAGE.CREATECOMPONENT_ERROR.LOAD_APP_TIMEOUT);
300
- }, LOADTIME_LIMIT);
313
+ }, loadTimeLimit !== null && loadTimeLimit !== void 0 ? loadTimeLimit : LOADTIME_LIMIT);
301
314
  }).catch(function (error) {
302
- _this4.dispatchToSDK(EVENT.error.name, {
303
- code: ERRORMESSAGE.CREATECOMPONENT_ERROR.code,
304
- message: ERRORMESSAGE.CREATECOMPONENT_ERROR.LOAD_APP_TIMEOUT.message
305
- });
315
+ _this4.dispatchToSDK(EVENT.error.name, ERRORMESSAGE.CREATECOMPONENT_ERROR.LOAD_APP_TIMEOUT);
306
316
  _this4.AMSSDK.logger.logError({
307
317
  title: 'sdk_error_web_app_timeout'
308
318
  }).send();
@@ -427,7 +437,7 @@ var ComponentApp = /*#__PURE__*/function () {
427
437
  resolve(res);
428
438
  }
429
439
  }).catch(function (err) {
430
- if (componentSignEnum.CASHIER_PAYMENT_CARD === _this5._componentSign) {
440
+ if ([componentSignEnum.CASHIER_PAYMENT_CARD, componentSignEnum.VAULTING_CARD].includes(_this5._componentSign)) {
431
441
  return resolve({
432
442
  success: false
433
443
  });
@@ -653,13 +663,12 @@ var ComponentApp = /*#__PURE__*/function () {
653
663
  });
654
664
  }
655
665
  }, {
656
- key: "createPopupWindow",
657
- value: function createPopupWindow(data) {
658
- var _this$_renderParams5;
659
- this._threedData = data;
660
- var sessionData = encodeURIComponent((_this$_renderParams5 = this._renderParams) === null || _this$_renderParams5 === void 0 ? void 0 : _this$_renderParams5.sessionData);
661
- var threedPageUrl = "".concat(marmotMap[this.AMSSDK.options.env.environment], "/threedPage/index.html?scene=threedWrapperPage&sessionData=").concat(sessionData, "&").concat(this._appLocationSearch);
662
- this.popupWindow = createModal({
666
+ key: "createDialog",
667
+ value: function createDialog(data) {
668
+ var threedPageUrl = data.url.includes('?') ? "".concat(data.url, "&").concat(this._appLocationSearch) : "".concat(data.url, "?").concat(this._appLocationSearch);
669
+ this.popupApp = createModal({
670
+ widthPadding: data === null || data === void 0 ? void 0 : data.widthPadding,
671
+ heightPadding: data === null || data === void 0 ? void 0 : data.heightPadding,
663
672
  device: this.platform,
664
673
  url: threedPageUrl
665
674
  });
@@ -700,6 +709,35 @@ var ComponentApp = /*#__PURE__*/function () {
700
709
  }
701
710
  return getDeviceIdAndCallback;
702
711
  }()
712
+ }, {
713
+ key: "returnDataAndCallback",
714
+ value: function () {
715
+ var _returnDataAndCallback = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(eventContext) {
716
+ var _eventContext$data, targetData;
717
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
718
+ while (1) switch (_context5.prev = _context5.next) {
719
+ case 0:
720
+ if (eventContext !== null && eventContext !== void 0 && eventContext.eventCallbackId) {
721
+ targetData = this._globalData.get((_eventContext$data = eventContext.data) === null || _eventContext$data === void 0 ? void 0 : _eventContext$data.dataKey);
722
+ this.dispatchToApp({
723
+ context: {
724
+ event: 'appEventCallback',
725
+ eventCallbackId: eventContext === null || eventContext === void 0 ? void 0 : eventContext.eventCallbackId,
726
+ data: targetData
727
+ }
728
+ });
729
+ }
730
+ case 1:
731
+ case "end":
732
+ return _context5.stop();
733
+ }
734
+ }, _callee5, this);
735
+ }));
736
+ function returnDataAndCallback(_x5) {
737
+ return _returnDataAndCallback.apply(this, arguments);
738
+ }
739
+ return returnDataAndCallback;
740
+ }()
703
741
  /**
704
742
  * @description Initialize subscription iframe message
705
743
  */
@@ -725,7 +763,9 @@ var ComponentApp = /*#__PURE__*/function () {
725
763
  }, {
726
764
  key: "_handleAppMessage",
727
765
  value: function _handleAppMessage(data) {
728
- 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, EVENT.getDeviceId.name, EVENT.declareEventCallbackInfo.name];
766
+ var eventKeyMap = Object.keys(EVENT).map(function (key) {
767
+ return EVENT[key].name;
768
+ });
729
769
  if (!eventKeyMap.includes(data.context.event)) {
730
770
  return;
731
771
  }
@@ -733,29 +773,38 @@ var ComponentApp = /*#__PURE__*/function () {
733
773
  this.getDeviceIdAndCallback(data.context);
734
774
  return;
735
775
  }
736
- if (data.context.event === EVENT.closePopup.name) {
776
+ if (data.context.event === EVENT.popWindow.name) {
737
777
  destroyModal();
738
778
  return;
739
779
  }
740
- if (data.context.event === EVENT.threedReady.name) {
741
- this.dispatchToApp({
742
- context: {
743
- event: 'renderThreedPage',
744
- data: this._threedData
745
- }
746
- }, this.popupWindow);
780
+ if (data.context.event === EVENT.getGlobalData.name) {
781
+ this.returnDataAndCallback(data.context);
747
782
  return;
748
783
  }
749
- if (data.context.event === EVENT.popupWindow.name) {
784
+ if (data.context.event === EVENT.setGlobalData.name) {
785
+ var _data$context$data, _data$context$data2;
786
+ this._globalData.set((_data$context$data = data.context.data) === null || _data$context$data === void 0 ? void 0 : _data$context$data.dataKey, (_data$context$data2 = data.context.data) === null || _data$context$data2 === void 0 ? void 0 : _data$context$data2.data);
787
+ return;
788
+ }
789
+ if (data.context.event === EVENT.startDialog.name) {
750
790
  var _data$context;
751
- this.createPopupWindow((_data$context = data.context) === null || _data$context === void 0 ? void 0 : _data$context.data);
791
+ this.createDialog((_data$context = data.context) === null || _data$context === void 0 ? void 0 : _data$context.data);
792
+ return;
793
+ }
794
+ if (data.context.event === EVENT.sendMuitiAppEventToSdk.name) {
795
+ this.dispatchToApp({
796
+ context: {
797
+ event: 'receiveMuitiAppFromSdk',
798
+ data: data.context.data
799
+ }
800
+ });
752
801
  return;
753
802
  }
754
803
  if (data.context.event === EVENT.dismissLoading.name) {
755
- var _data$context$data;
804
+ var _data$context$data3;
756
805
  this.dispatchToSDK(EVENT.eventCallback.name, {
757
806
  code: 'SDK_END_OF_LOADING',
758
- message: ((_data$context$data = data.context.data) === null || _data$context$data === void 0 ? void 0 : _data$context$data.message) || ''
807
+ message: ((_data$context$data3 = data.context.data) === null || _data$context$data3 === void 0 ? void 0 : _data$context$data3.message) || ''
759
808
  });
760
809
  return;
761
810
  }
@@ -814,8 +863,8 @@ var ComponentApp = /*#__PURE__*/function () {
814
863
  }, {
815
864
  key: "handleSizeChanged",
816
865
  value: function handleSizeChanged(data) {
817
- var _data$context$data2;
818
- if (((_data$context$data2 = data.context.data) === null || _data$context$data2 === void 0 ? void 0 : _data$context$data2.height) <= 1) return;
866
+ var _data$context$data4;
867
+ if (((_data$context$data4 = data.context.data) === null || _data$context$data4 === void 0 ? void 0 : _data$context$data4.height) <= 1) return;
819
868
  var cashier = document.getElementById(COMPONENT_CONTAINER_ID);
820
869
  cashier.style.height = "".concat(data.context.data.height, "px");
821
870
  if (this._renderDisplayType === renderDisplayTypeEnum.popup) {
@@ -1004,8 +1053,11 @@ var ComponentApp = /*#__PURE__*/function () {
1004
1053
  if (targetElement && targetElement.contentWindow) {
1005
1054
  return targetElement.contentWindow.postMessage(JSON.stringify(data), '*');
1006
1055
  }
1007
- if (this.app && this.app.contentWindow) {
1008
- return this.app.contentWindow.postMessage(JSON.stringify(data), this.appDomain);
1056
+ if (this.app || this.popupApp) {
1057
+ var _this$app, _this$app2, _this$popupApp, _this$popupApp2;
1058
+ (this === null || this === void 0 || (_this$app = this.app) === null || _this$app === void 0 ? void 0 : _this$app.contentWindow) && (this === null || this === void 0 || (_this$app2 = this.app) === null || _this$app2 === void 0 ? void 0 : _this$app2.contentWindow.postMessage(JSON.stringify(data), this.appDomain));
1059
+ (this === null || this === void 0 || (_this$popupApp = this.popupApp) === null || _this$popupApp === void 0 ? void 0 : _this$popupApp.contentWindow) && (this === null || this === void 0 || (_this$popupApp2 = this.popupApp) === null || _this$popupApp2 === void 0 ? void 0 : _this$popupApp2.contentWindow.postMessage(JSON.stringify(data), '*'));
1060
+ return;
1009
1061
  }
1010
1062
  throw new Error(ERRORMESSAGE.SDK_SUBMIT_ERROR.message);
1011
1063
  }
@@ -1031,26 +1083,26 @@ var ComponentApp = /*#__PURE__*/function () {
1031
1083
  }, {
1032
1084
  key: "sendRenderEvent",
1033
1085
  value: function () {
1034
- var _sendRenderEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
1035
- var _this$_renderParams6, _this$_renderParams7, _this$_renderParams8, _this$_renderParams9, _this$_renderParams10, res, submitRes;
1036
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
1037
- while (1) switch (_context5.prev = _context5.next) {
1086
+ var _sendRenderEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
1087
+ var _this$_renderParams5, _this$_renderParams6, _this$_renderParams7, _this$_renderParams8, _this$_renderParams9, res, submitRes;
1088
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
1089
+ while (1) switch (_context6.prev = _context6.next) {
1038
1090
  case 0:
1039
- _context5.prev = 0;
1091
+ _context6.prev = 0;
1040
1092
  if (!(!this._actionQueryPromise || !this._actionSubmitPromise)) {
1041
- _context5.next = 3;
1093
+ _context6.next = 3;
1042
1094
  break;
1043
1095
  }
1044
- return _context5.abrupt("return");
1096
+ return _context6.abrupt("return");
1045
1097
  case 3:
1046
- _context5.next = 5;
1098
+ _context6.next = 5;
1047
1099
  return this._actionQueryPromise;
1048
1100
  case 5:
1049
- res = _context5.sent;
1050
- _context5.next = 8;
1101
+ res = _context6.sent;
1102
+ _context6.next = 8;
1051
1103
  return this._actionSubmitPromise;
1052
1104
  case 8:
1053
- submitRes = _context5.sent;
1105
+ submitRes = _context6.sent;
1054
1106
  this._performanceData.push({
1055
1107
  key: 'sdk_render_component',
1056
1108
  value: Date.now()
@@ -1061,12 +1113,12 @@ var ComponentApp = /*#__PURE__*/function () {
1061
1113
  data: {
1062
1114
  queryResult: res,
1063
1115
  submitResult: submitRes,
1064
- sessionResult: (_this$_renderParams6 = this._renderParams) === null || _this$_renderParams6 === void 0 ? void 0 : _this$_renderParams6.paymentSessionMetaData,
1065
- paymentSessionData: (_this$_renderParams7 = this._renderParams) === null || _this$_renderParams7 === void 0 ? void 0 : _this$_renderParams7.sessionData,
1116
+ sessionResult: (_this$_renderParams5 = this._renderParams) === null || _this$_renderParams5 === void 0 ? void 0 : _this$_renderParams5.paymentSessionMetaData,
1117
+ paymentSessionData: (_this$_renderParams6 = this._renderParams) === null || _this$_renderParams6 === void 0 ? void 0 : _this$_renderParams6.sessionData,
1066
1118
  heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
1067
- renderDisplayType: (_this$_renderParams8 = this._renderParams) === null || _this$_renderParams8 === void 0 ? void 0 : _this$_renderParams8.renderDisplayType,
1068
- appearance: (_this$_renderParams9 = this._renderParams) === null || _this$_renderParams9 === void 0 ? void 0 : _this$_renderParams9.appearance,
1069
- notRedirectAfterComplete: ((_this$_renderParams10 = this._renderParams) === null || _this$_renderParams10 === void 0 ? void 0 : _this$_renderParams10.notRedirectAfterComplete) === true,
1119
+ renderDisplayType: (_this$_renderParams7 = this._renderParams) === null || _this$_renderParams7 === void 0 ? void 0 : _this$_renderParams7.renderDisplayType,
1120
+ appearance: (_this$_renderParams8 = this._renderParams) === null || _this$_renderParams8 === void 0 ? void 0 : _this$_renderParams8.appearance,
1121
+ notRedirectAfterComplete: ((_this$_renderParams9 = this._renderParams) === null || _this$_renderParams9 === void 0 ? void 0 : _this$_renderParams9.notRedirectAfterComplete) === true,
1070
1122
  envInfo: {
1071
1123
  screenHeight: screen.height,
1072
1124
  screenWidth: screen.width
@@ -1083,16 +1135,16 @@ var ComponentApp = /*#__PURE__*/function () {
1083
1135
  }
1084
1136
  });
1085
1137
  // eslint-disable-next-line no-empty
1086
- _context5.next = 16;
1138
+ _context6.next = 16;
1087
1139
  break;
1088
1140
  case 14:
1089
- _context5.prev = 14;
1090
- _context5.t0 = _context5["catch"](0);
1141
+ _context6.prev = 14;
1142
+ _context6.t0 = _context6["catch"](0);
1091
1143
  case 16:
1092
1144
  case "end":
1093
- return _context5.stop();
1145
+ return _context6.stop();
1094
1146
  }
1095
- }, _callee5, this, [[0, 14]]);
1147
+ }, _callee6, this, [[0, 14]]);
1096
1148
  }));
1097
1149
  function sendRenderEvent() {
1098
1150
  return _sendRenderEvent.apply(this, arguments);
@@ -1,6 +1,8 @@
1
1
  export declare const insertStyleSheet: () => void;
2
- export declare const createModal: ({ device, url }: {
2
+ export declare const createModal: ({ device, url, widthPadding, heightPadding }: {
3
3
  device: any;
4
4
  url: any;
5
+ widthPadding: any;
6
+ heightPadding: any;
5
7
  }) => HTMLIFrameElement;
6
8
  export declare const destroyModal: () => void;
@@ -13,7 +13,9 @@ export var insertStyleSheet = function insertStyleSheet() {
13
13
  // 插入弹窗
14
14
  export var createModal = function createModal(_ref) {
15
15
  var device = _ref.device,
16
- url = _ref.url;
16
+ url = _ref.url,
17
+ widthPadding = _ref.widthPadding,
18
+ heightPadding = _ref.heightPadding;
17
19
  var overlay = document.createElement('div');
18
20
  overlay.classList.add("".concat(AMSPOPUP_PREFIX, "overlay"), "".concat(AMSPOPUP_PREFIX, "fadeIn"));
19
21
  var modal = document.createElement('div');
@@ -23,8 +25,8 @@ export var createModal = function createModal(_ref) {
23
25
  modal.style.height = '464px';
24
26
  modal.style.borderRadius = '12px';
25
27
  } else {
26
- modal.style.width = 'calc(100% - 16px)';
27
- modal.style.height = '80%';
28
+ modal.style.width = "calc(100% - ".concat(2 * widthPadding, "px)");
29
+ modal.style.height = "calc(100% - ".concat(2 * heightPadding, "px)");
28
30
  modal.style.borderRadius = '8px';
29
31
  }
30
32
  var iframe = document.createElement('iframe');
@@ -357,13 +357,6 @@ export declare enum eventCodeEnum {
357
357
  SDK_CALL_URL_ERROR = "SDK_CALL_URL_ERROR",
358
358
  SDK_CALL_URL_SUCCESS = "SDK_CALL_URL_SUCCESS"
359
359
  }
360
- export interface ThreedData {
361
- data: any;
362
- method: string;
363
- targetUrl: string;
364
- pti?: number;
365
- pt?: number;
366
- }
367
360
  export declare enum RedirectType {
368
361
  ApplinkUrl = "ApplinkUrl",
369
362
  SchemeUrl = "SchemeUrl",
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@alipay/ams-checkout","version":"0.0.1701663818-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":{"@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.1701850681-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":{"@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"}}