@alipay/ams-checkout 0.0.1723203704-dev.3 → 0.0.1723203704-dev.5

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.
@@ -314,6 +314,11 @@ var AMSSDK = /*#__PURE__*/function () {
314
314
  if (getType(options.onClose) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.message);
315
315
  this._overrideSubscription(EVENT.close.name, options.onClose, EVENT.close.uniqueKey);
316
316
  }
317
+ /** 地址监听 */
318
+ if (options !== null && options !== void 0 && options.onChange) {
319
+ if (getType(options.onChange) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.message);
320
+ this._overrideSubscription(EVENT.onChange.name, options.onChange, EVENT.onChange.uniqueKey);
321
+ }
317
322
  }
318
323
  /**
319
324
  * @description Register plug-in
@@ -424,6 +429,9 @@ var AMSSDK = /*#__PURE__*/function () {
424
429
  }
425
430
  actionNames = this._getPlugin(pluginKey);
426
431
  }
432
+ if (this.options.product === productSceneEnum.ELEMENT_ADDRESS) {
433
+ actionNames = this._getPlugin(productSceneEnum.ELEMENT_ADDRESS);
434
+ }
427
435
  return actionNames;
428
436
  }
429
437
  }]);
package/esm/index.d.ts CHANGED
@@ -8,7 +8,7 @@
8
8
  import { AMSComponent } from './core/component/index';
9
9
  import { AddressComponent } from './core/component/address';
10
10
  import { IoptionsParams, componentSignEnum } from './types';
11
- import { IoptionsAddressParams } from './types/address';
11
+ import { IoptionsAddressParams } from './types/index';
12
12
  export * from './types';
13
13
  export declare class AMSCheckout extends AMSComponent {
14
14
  constructor(_options: any, channelType?: componentSignEnum[], productSceneVersion?: string);
@@ -31,10 +31,7 @@ export declare class AMSVaulting extends AMSCheckout {
31
31
  export declare class AntomElement extends AMSCheckout {
32
32
  constructor(options: IoptionsParams);
33
33
  }
34
- export declare class Address extends AddressComponent {
35
- constructor(_options: any, channelType?: componentSignEnum[], productSceneVersion?: string);
36
- }
37
- export declare class AddressElement extends Address {
34
+ export declare class AddressElement extends AddressComponent {
38
35
  constructor(options: IoptionsAddressParams);
39
36
  }
40
37
  export default AMSCheckout;
package/esm/index.js CHANGED
@@ -148,29 +148,17 @@ export var AntomElement = /*#__PURE__*/function (_AMSCheckout6) {
148
148
  }
149
149
  return _createClass(AntomElement);
150
150
  }(AMSCheckout);
151
- export var Address = /*#__PURE__*/function (_AddressComponent) {
152
- _inherits(Address, _AddressComponent);
153
- var _super8 = _createSuper(Address);
154
- function Address(_options, channelType) {
155
- var _this2;
156
- var productSceneVersion = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '1.0';
157
- _classCallCheck(this, Address);
158
- _this2 = _super8.call(this, _options);
159
- _this2.preloadComponent(channelType, productSceneVersion);
160
- return _this2;
161
- }
162
- return _createClass(Address);
163
- }(AddressComponent);
164
- export var AddressElement = /*#__PURE__*/function (_Address) {
165
- _inherits(AddressElement, _Address);
166
- var _super9 = _createSuper(AddressElement);
151
+ export var AddressElement = /*#__PURE__*/function (_AddressComponent) {
152
+ _inherits(AddressElement, _AddressComponent);
153
+ var _super8 = _createSuper(AddressElement);
167
154
  function AddressElement(options) {
168
155
  _classCallCheck(this, AddressElement);
169
156
  var _options = Object.assign({}, options, {
170
- product: productSceneEnum.ELEMENT_ADDRESS
157
+ product: productSceneEnum.ELEMENT_ADDRESS,
158
+ environment: 'dev'
171
159
  });
172
- return _super9.call(this, _options, [componentSignEnum.ELEMENT_ADDRESS]);
160
+ return _super8.call(this, _options);
173
161
  }
174
162
  return _createClass(AddressElement);
175
- }(Address);
163
+ }(AddressComponent);
176
164
  export default AMSCheckout;
@@ -97,6 +97,10 @@ export var getAppPath = function getAppPath() {
97
97
  if (urlTestHost && !['sandbox', 'light_sandbox', 'prod'].includes(environment)) {
98
98
  return urlTestHost;
99
99
  }
100
+ // 地址应用特殊处理
101
+ if (componentSign === componentSignEnum.ELEMENT_ADDRESS) {
102
+ return "".concat(elementAppMarmotMap[environment], "/element-address/").concat(finalAppVersion, "/pages/address/index.html");
103
+ }
100
104
  // element应用特殊处理
101
105
  if (_toConsumableArray(Object.values(ComponentSignEnumV2)).includes(componentSign)) {
102
106
  // element又分为express_checkout模式和普通模式, express_checkout 模式在扩展参数是返回expressCheckout=true
@@ -259,12 +259,12 @@ var ComponentApp = /*#__PURE__*/function () {
259
259
  return Promise.reject(ERRORMESSAGE.CREATECOMPONENT_ERROR.SINGLETON_COMPONENT_ERROR);
260
260
  }
261
261
  renderParams = this.setParameterDefaultValues(componentSign, renderParams);
262
+ this._merchantAppointParam = renderParams.merchantAppointParam;
262
263
  this._isInitComponent = true;
263
264
  this._renderParams = renderParams;
264
265
  this._componentSign = componentSign;
265
266
  if ((_renderParams = renderParams) !== null && _renderParams !== void 0 && _renderParams.selector) this._selector = renderParams.selector;
266
267
  this._renderDisplayType = renderParams.renderDisplayType;
267
- this._merchantAppointParam = renderParams.merchantAppointParam;
268
268
  var insertedNode = this._renderDisplayType === renderDisplayTypeEnum.inline ? "#".concat(COMPONENT_CONTAINER_ID) : this._selector;
269
269
  this.initLoggerMeta();
270
270
  this.initSecurity();
@@ -487,25 +487,32 @@ var ComponentApp = /*#__PURE__*/function () {
487
487
  if (componentSignEnum.ELEMENT_PAYMENT === _this5._componentSign) {
488
488
  params.paymentSessionConfig = handlePaymentSessionConfig(params.paymentSessionConfig);
489
489
  }
490
-
491
- // 绑卡跳过actionQuery接口
492
- // 目前只有绑卡加上 skipSdkQueryForm 判断
490
+ /** 地址组件跳过接口查询 */
491
+ if (!(componentSignEnum.ELEMENT_ADDRESS === _this5._componentSign)) {
492
+ _context2.next = 12;
493
+ break;
494
+ }
495
+ return _context2.abrupt("return", resolve({
496
+ message: 'sdk no need to make query request',
497
+ success: true
498
+ }));
499
+ case 12:
493
500
  if (!(componentSignEnum.VAULTING_CARD === _this5._componentSign)) {
494
- _context2.next = 22;
501
+ _context2.next = 24;
495
502
  break;
496
503
  }
497
504
  if (!enableVaultingApiOptimize) {
498
- _context2.next = 22;
505
+ _context2.next = 24;
499
506
  break;
500
507
  }
501
508
  if (!skipSdkQueryForm) {
502
- _context2.next = 19;
509
+ _context2.next = 21;
503
510
  break;
504
511
  }
505
512
  // 优先判断 skipSdkQueryForm
506
513
  ifSkip = matchVersion(skipSdkQueryForm, _this5._appVersion);
507
514
  if (!ifSkip) {
508
- _context2.next = 17;
515
+ _context2.next = 19;
509
516
  break;
510
517
  }
511
518
  resolve({
@@ -513,12 +520,12 @@ var ComponentApp = /*#__PURE__*/function () {
513
520
  success: true
514
521
  });
515
522
  return _context2.abrupt("return");
516
- case 17:
517
- _context2.next = 22;
518
- break;
519
523
  case 19:
524
+ _context2.next = 24;
525
+ break;
526
+ case 21:
520
527
  if (!skipSdkQuery) {
521
- _context2.next = 22;
528
+ _context2.next = 24;
522
529
  break;
523
530
  }
524
531
  resolve({
@@ -526,10 +533,10 @@ var ComponentApp = /*#__PURE__*/function () {
526
533
  success: true
527
534
  });
528
535
  return _context2.abrupt("return");
529
- case 22:
536
+ case 24:
530
537
  channelBehavior = getChannelBehavior((_this5$_renderParams6 = _this5._renderParams) === null || _this5$_renderParams6 === void 0 ? void 0 : _this5$_renderParams6.paymentSessionMetaData); // Easypay TOSS 渠道无需actionQuery
531
538
  if (!(channelBehavior !== null && channelBehavior !== void 0 && channelBehavior.usePaymentSessionAsQueryResult)) {
532
- _context2.next = 25;
539
+ _context2.next = 27;
533
540
  break;
534
541
  }
535
542
  return _context2.abrupt("return", resolve({
@@ -537,78 +544,78 @@ var ComponentApp = /*#__PURE__*/function () {
537
544
  amountConfirmRequired: actionData === null || actionData === void 0 ? void 0 : actionData.amountConfirmRequired,
538
545
  success: true
539
546
  }));
540
- case 25:
547
+ case 27:
541
548
  if (!(componentSignEnum.CASHIER_PAYMENT_CARD === _this5._componentSign || componentSignEnum.VAULTING_CARD === _this5._componentSign)) {
542
- _context2.next = 31;
549
+ _context2.next = 33;
543
550
  break;
544
551
  }
545
552
  params.paymentMethodType = 'CARD';
546
- _context2.next = 29;
553
+ _context2.next = 31;
547
554
  return _this5.getDeviceIdAndLog();
548
- case 29:
555
+ case 31:
549
556
  envInfo.deviceId = _context2.sent;
550
557
  if (window.navigator.userAgent.indexOf('miniProgram') > -1) {
551
558
  envInfo.extendInfo = {
552
559
  WAP_SUB_TYPE: 'WECHAT_MINI_PROGRAM'
553
560
  };
554
561
  }
555
- case 31:
562
+ case 33:
556
563
  if (!(componentSignEnum.EASY_PAY_WALLET === _this5._componentSign)) {
557
- _context2.next = 40;
564
+ _context2.next = 42;
558
565
  break;
559
566
  }
560
567
  _ref8 = params.paymentSessionConfig || {}, _ref8$productSceneVer = _ref8.productSceneVersion, productSceneVersion = _ref8$productSceneVer === void 0 ? '' : _ref8$productSceneVer, _ref8$productScene = _ref8.productScene, productScene = _ref8$productScene === void 0 ? '' : _ref8$productScene;
561
568
  if (!((_this5$_renderParams7 = _this5._renderParams) !== null && _this5$_renderParams7 !== void 0 && (_this5$_renderParams7 = _this5$_renderParams7.paymentSessionMetaData) !== null && _this5$_renderParams7 !== void 0 && (_this5$_renderParams7 = _this5$_renderParams7.action) !== null && _this5$_renderParams7 !== void 0 && _this5$_renderParams7.skipSdkQuery && enableEasypayApiOptimize)) {
562
- _context2.next = 35;
569
+ _context2.next = 37;
563
570
  break;
564
571
  }
565
572
  return _context2.abrupt("return", resolve({
566
573
  message: 'sdk no need to make query request',
567
574
  success: true
568
575
  }));
569
- case 35:
576
+ case 37:
570
577
  if (!(productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0')) {
571
- _context2.next = 37;
578
+ _context2.next = 39;
572
579
  break;
573
580
  }
574
581
  return _context2.abrupt("return", resolve({
575
582
  message: 'sdk no need to make query request',
576
583
  success: true
577
584
  }));
578
- case 37:
579
- _context2.next = 39;
580
- return _this5.getDeviceIdAndLog();
581
585
  case 39:
586
+ _context2.next = 41;
587
+ return _this5.getDeviceIdAndLog();
588
+ case 41:
582
589
  envInfo.deviceId = _context2.sent;
583
- case 40:
590
+ case 42:
584
591
  if (!(componentSignEnum.AUTO_DEBIT_WALLET === _this5._componentSign)) {
585
- _context2.next = 50;
592
+ _context2.next = 52;
586
593
  break;
587
594
  }
588
595
  action = ((_this5$_renderParams8 = _this5._renderParams) === null || _this5$_renderParams8 === void 0 || (_this5$_renderParams8 = _this5$_renderParams8.paymentSessionMetaData) === null || _this5$_renderParams8 === void 0 ? void 0 : _this5$_renderParams8.action) || {};
589
596
  signType = isPC() ? action === null || action === void 0 || (_action$web2 = action.web) === null || _action$web2 === void 0 ? void 0 : _action$web2.signType : action === null || action === void 0 || (_action$wap2 = action.wap) === null || _action$wap2 === void 0 ? void 0 : _action$wap2.signType;
590
597
  if (!(signType === 'SMS')) {
591
- _context2.next = 45;
598
+ _context2.next = 47;
592
599
  break;
593
600
  }
594
601
  return _context2.abrupt("return", resolve({
595
602
  message: 'sdk no need to make query request',
596
603
  success: true
597
604
  }));
598
- case 45:
605
+ case 47:
599
606
  if (!(!signType || signType !== 'REDIRECT')) {
600
- _context2.next = 47;
607
+ _context2.next = 49;
601
608
  break;
602
609
  }
603
610
  return _context2.abrupt("return", resolve({
604
611
  success: false
605
612
  }));
606
- case 47:
607
- _context2.next = 49;
608
- return _this5.getDeviceIdAndLog();
609
613
  case 49:
614
+ _context2.next = 51;
615
+ return _this5.getDeviceIdAndLog();
616
+ case 51:
610
617
  envInfo.deviceId = _context2.sent;
611
- case 50:
618
+ case 52:
612
619
  _this5.AMSSDK.logger.logInfo({
613
620
  title: 'sdk_event_sdkQuery'
614
621
  }, {
@@ -647,7 +654,7 @@ var ComponentApp = /*#__PURE__*/function () {
647
654
  }).send();
648
655
  reject(err);
649
656
  });
650
- case 52:
657
+ case 54:
651
658
  case "end":
652
659
  return _context2.stop();
653
660
  }
@@ -685,6 +692,15 @@ var ComponentApp = /*#__PURE__*/function () {
685
692
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
686
693
  while (1) switch (_context3.prev = _context3.next) {
687
694
  case 0:
695
+ if (!(_this6.AMSSDK.options.product === productSceneEnum.ELEMENT_ADDRESS)) {
696
+ _context3.next = 2;
697
+ break;
698
+ }
699
+ return _context3.abrupt("return", resolve({
700
+ message: 'sdk no need to make submitPay request',
701
+ success: true
702
+ }));
703
+ case 2:
688
704
  shouldSkipSubmitPayInSDK = false;
689
705
  if (channelBehavior) {
690
706
  // 新逻辑走 channelBehavior判断
@@ -703,14 +719,14 @@ var ComponentApp = /*#__PURE__*/function () {
703
719
  // 带上标记告知WebCheckOut SDK已发送submitpay请求
704
720
  _this6._allowSubmitPayCallAhead = !shouldSkipSubmitPayInSDK;
705
721
  if (!shouldSkipSubmitPayInSDK) {
706
- _context3.next = 6;
722
+ _context3.next = 8;
707
723
  break;
708
724
  }
709
725
  return _context3.abrupt("return", resolve({
710
726
  message: 'sdk no need to make submitPay request',
711
727
  success: true
712
728
  }));
713
- case 6:
729
+ case 8:
714
730
  _this6.AMSSDK.logger.logInfo({
715
731
  title: 'sdk_event_submitPay'
716
732
  }, {
@@ -729,9 +745,9 @@ var ComponentApp = /*#__PURE__*/function () {
729
745
  _context3.t0 = submitPayInfo;
730
746
  _context3.t1 = params;
731
747
  _context3.t2 = _this6.AMSSDK.options.env.environment;
732
- _context3.next = 14;
748
+ _context3.next = 16;
733
749
  return _this6.getDeviceIdAndLog();
734
- case 14:
750
+ case 16:
735
751
  _context3.t3 = _context3.sent;
736
752
  _context3.t4 = {
737
753
  deviceId: _context3.t3
@@ -765,7 +781,7 @@ var ComponentApp = /*#__PURE__*/function () {
765
781
  success: false
766
782
  });
767
783
  });
768
- case 19:
784
+ case 21:
769
785
  case "end":
770
786
  return _context3.stop();
771
787
  }
@@ -1541,24 +1557,25 @@ var ComponentApp = /*#__PURE__*/function () {
1541
1557
  key: "sendRenderEvent",
1542
1558
  value: (function () {
1543
1559
  var _sendRenderEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
1544
- var _this$_renderParams15, _this$_renderParams16, _this$_renderParams17, _this$_renderParams18, _this$_renderParams19, _this$_renderParams20, _this$AMSSDK$logger, _this$_renderParams21, _this$_renderParams22, _this$_renderParams23, _this$AMSSDK, _this$_renderParams24, res, submitRes;
1560
+ var _this$_renderParams15, _this$_renderParams16, _this$_renderParams17, _this$_renderParams18, _this$_renderParams19, _this$_renderParams20, _this$_renderParams21, _this$_renderParams22, _this$_renderParams23, _this$_renderParams24, _this$AMSSDK$logger, _this$_renderParams25, _this$_renderParams26, _this$_renderParams27, _this$AMSSDK, _this$_renderParams28, isAddressElement, res, submitRes;
1545
1561
  return _regeneratorRuntime().wrap(function _callee8$(_context8) {
1546
1562
  while (1) switch (_context8.prev = _context8.next) {
1547
1563
  case 0:
1548
1564
  _context8.prev = 0;
1549
- if (!(!this._actionQueryPromise || !this._actionSubmitPromise)) {
1550
- _context8.next = 3;
1565
+ isAddressElement = this.AMSSDK.options.product === productSceneEnum.ELEMENT_ADDRESS;
1566
+ if (!((!this._actionQueryPromise || !this._actionSubmitPromise) && !isAddressElement)) {
1567
+ _context8.next = 4;
1551
1568
  break;
1552
1569
  }
1553
1570
  return _context8.abrupt("return");
1554
- case 3:
1555
- _context8.next = 5;
1571
+ case 4:
1572
+ _context8.next = 6;
1556
1573
  return this._actionQueryPromise;
1557
- case 5:
1574
+ case 6:
1558
1575
  res = _context8.sent;
1559
- _context8.next = 8;
1576
+ _context8.next = 9;
1560
1577
  return this._actionSubmitPromise;
1561
- case 8:
1578
+ case 9:
1562
1579
  submitRes = _context8.sent;
1563
1580
  this._performanceData.push({
1564
1581
  key: 'sdk_render_component',
@@ -1578,21 +1595,26 @@ var ComponentApp = /*#__PURE__*/function () {
1578
1595
  notRedirectAfterComplete: ((_this$_renderParams19 = this._renderParams) === null || _this$_renderParams19 === void 0 ? void 0 : _this$_renderParams19.notRedirectAfterComplete) === true,
1579
1596
  merchantAppointParam: this._merchantAppointParam,
1580
1597
  allowSubmitPayCallAhead: this._allowSubmitPayCallAhead,
1598
+ /** 地址组件集成的参数 */
1599
+ configParams: (_this$_renderParams20 = this._renderParams) === null || _this$_renderParams20 === void 0 ? void 0 : _this$_renderParams20.configParams,
1600
+ appId: (_this$_renderParams21 = this._renderParams) === null || _this$_renderParams21 === void 0 ? void 0 : _this$_renderParams21.appId,
1601
+ prefillValue: (_this$_renderParams22 = this._renderParams) === null || _this$_renderParams22 === void 0 ? void 0 : _this$_renderParams22.prefillValue,
1602
+ componentSession: (_this$_renderParams23 = this._renderParams) === null || _this$_renderParams23 === void 0 ? void 0 : _this$_renderParams23.componentSession,
1581
1603
  envInfo: {
1582
1604
  screenHeight: screen.height,
1583
1605
  screenWidth: screen.width
1584
1606
  },
1585
1607
  logMetaData: _objectSpread(_objectSpread({
1586
- trackId: (_this$_renderParams20 = this._renderParams) === null || _this$_renderParams20 === void 0 ? void 0 : _this$_renderParams20.sessionData,
1608
+ trackId: (_this$_renderParams24 = this._renderParams) === null || _this$_renderParams24 === void 0 ? void 0 : _this$_renderParams24.sessionData,
1587
1609
  platform: this.platform,
1588
1610
  firstLogTime: (_this$AMSSDK$logger = this.AMSSDK.logger) === null || _this$AMSSDK$logger === void 0 ? void 0 : _this$AMSSDK$logger.getComponentStartTime()
1589
- }, ((_this$_renderParams21 = this._renderParams) === null || _this$_renderParams21 === void 0 || (_this$_renderParams21 = _this$_renderParams21.paymentSessionMetaData) === null || _this$_renderParams21 === void 0 ? void 0 : _this$_renderParams21.paymentSessionConfig) || {}), {}, {
1590
- renderDisplayType: (_this$_renderParams22 = this._renderParams) === null || _this$_renderParams22 === void 0 ? void 0 : _this$_renderParams22.renderDisplayType,
1611
+ }, ((_this$_renderParams25 = this._renderParams) === null || _this$_renderParams25 === void 0 || (_this$_renderParams25 = _this$_renderParams25.paymentSessionMetaData) === null || _this$_renderParams25 === void 0 ? void 0 : _this$_renderParams25.paymentSessionConfig) || {}), {}, {
1612
+ renderDisplayType: (_this$_renderParams26 = this._renderParams) === null || _this$_renderParams26 === void 0 ? void 0 : _this$_renderParams26.renderDisplayType,
1591
1613
  sdkVersion: this._appVersion,
1592
- merchantId: (_this$_renderParams23 = this._renderParams) === null || _this$_renderParams23 === void 0 || (_this$_renderParams23 = _this$_renderParams23.paymentSessionMetaData) === null || _this$_renderParams23 === void 0 ? void 0 : _this$_renderParams23.clientId,
1614
+ merchantId: (_this$_renderParams27 = this._renderParams) === null || _this$_renderParams27 === void 0 || (_this$_renderParams27 = _this$_renderParams27.paymentSessionMetaData) === null || _this$_renderParams27 === void 0 ? void 0 : _this$_renderParams27.clientId,
1593
1615
  instanceId: (_this$AMSSDK = this.AMSSDK) === null || _this$AMSSDK === void 0 ? void 0 : _this$AMSSDK._instanceId,
1594
1616
  performanceData: this._performanceData,
1595
- paymentMethodType: (_this$_renderParams24 = this._renderParams) === null || _this$_renderParams24 === void 0 || (_this$_renderParams24 = _this$_renderParams24.paymentSessionMetaData) === null || _this$_renderParams24 === void 0 || (_this$_renderParams24 = _this$_renderParams24.paymentMethodInfoView) === null || _this$_renderParams24 === void 0 ? void 0 : _this$_renderParams24.paymentMethodType
1617
+ paymentMethodType: (_this$_renderParams28 = this._renderParams) === null || _this$_renderParams28 === void 0 || (_this$_renderParams28 = _this$_renderParams28.paymentSessionMetaData) === null || _this$_renderParams28 === void 0 || (_this$_renderParams28 = _this$_renderParams28.paymentMethodInfoView) === null || _this$_renderParams28 === void 0 ? void 0 : _this$_renderParams28.paymentMethodType
1596
1618
  })
1597
1619
  }
1598
1620
  }
@@ -1609,16 +1631,16 @@ var ComponentApp = /*#__PURE__*/function () {
1609
1631
  }
1610
1632
  });
1611
1633
  // eslint-disable-next-line no-empty
1612
- _context8.next = 17;
1634
+ _context8.next = 18;
1613
1635
  break;
1614
- case 15:
1615
- _context8.prev = 15;
1636
+ case 16:
1637
+ _context8.prev = 16;
1616
1638
  _context8.t0 = _context8["catch"](0);
1617
- case 17:
1639
+ case 18:
1618
1640
  case "end":
1619
1641
  return _context8.stop();
1620
1642
  }
1621
- }, _callee8, this, [[0, 15]]);
1643
+ }, _callee8, this, [[0, 16]]);
1622
1644
  }));
1623
1645
  function sendRenderEvent() {
1624
1646
  return _sendRenderEvent.apply(this, arguments);
@@ -5,6 +5,17 @@
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
+ export type onChange = () => onCnageResult;
9
+ interface onCnageResult {
10
+ complete: boolean;
11
+ addressValue: AddressItem[];
12
+ selectIndex: number | string;
13
+ }
14
+ export type getValue = (hasValidate: boolean) => Promise<AddressValueResult>;
15
+ interface AddressValueResult {
16
+ complete: boolean;
17
+ value: AddressItem;
18
+ }
8
19
  /**
9
20
  * SDK options
10
21
  */
@@ -17,6 +28,7 @@ export interface IoptionsParams {
17
28
  onLog?: callOnLog;
18
29
  onEventCallback?: callOnEventCallback;
19
30
  onClose?: callOnClose;
31
+ onChange?: onChange;
20
32
  networkMode?: string;
21
33
  mode?: string;
22
34
  analytics?: {
@@ -94,6 +106,81 @@ export interface IappendIframeNodesParams extends IcreateComponent {
94
106
  renderDisplayType: renderDisplayTypeEnum;
95
107
  selector?: Iselector;
96
108
  paypalConfiguration?: IPaypalConfiguration;
109
+ /** 将address-element参数定义合入原参数定义 */
110
+ mode?: string;
111
+ appId?: string;
112
+ configParams?: {
113
+ hideFields?: string[];
114
+ addressAutoSuggestDisabled?: addressAutoSuggestDisabledType;
115
+ };
116
+ prefillValue?: AddressItem[];
117
+ componentSession?: string;
118
+ appearance?: {
119
+ [x: string]: any;
120
+ themeType?: string;
121
+ accentColor?: string;
122
+ };
123
+ local?: string;
124
+ }
125
+ /** 表单地址数据 */
126
+ export interface AddressItem {
127
+ shippingName: {
128
+ firstName: string;
129
+ lastName: string;
130
+ };
131
+ /** 手机号 */
132
+ shippingPhoneNo: string;
133
+ /** 地址 */
134
+ shippingAddress: {
135
+ /** 国家 */
136
+ region: string;
137
+ /** 地址1 */
138
+ address1: string;
139
+ /** 地址2 */
140
+ address2: string;
141
+ /** 省份 */
142
+ province?: string;
143
+ /** 城市 */
144
+ city?: string;
145
+ /** 地址级联 四层 【province,city,district,subDistrict】 */
146
+ district?: string[];
147
+ /** 邮政编码 */
148
+ zipCode: string;
149
+ /** 对应地址级联数据对象 */
150
+ districtValues?: {
151
+ /** 城市 */
152
+ city?: string;
153
+ /** 区/县 */
154
+ district?: string;
155
+ /** 省份 */
156
+ province?: string;
157
+ /** 子区域 */
158
+ subDistrict?: string;
159
+ };
160
+ };
161
+ /** 备注 */
162
+ notes?: string;
163
+ open?: boolean;
164
+ /** 是否默认地址 */
165
+ prefer?: '1' | '0';
166
+ shippingId?: string;
167
+ }
168
+ type addressAutoSuggestDisabledType = 0 | 1;
169
+ export interface addressInitOption {
170
+ mode?: string;
171
+ appId?: string;
172
+ configParams?: {
173
+ hideFields?: string[];
174
+ addressAutoSuggestDisabled?: addressAutoSuggestDisabledType;
175
+ };
176
+ prefillValue?: AddressItem[];
177
+ componentSession?: string;
178
+ appearance?: {
179
+ [x: string]: any;
180
+ themeType: string;
181
+ accentColor: string;
182
+ };
183
+ local?: string;
97
184
  }
98
185
  export interface IPaypalConfiguration {
99
186
  style?: object;
@@ -571,3 +658,16 @@ export type IAppendParams = {
571
658
  componentSign: componentSignEnum;
572
659
  iframeNodesParams: IappendIframeNodesParams;
573
660
  };
661
+ export interface IoptionsAddressParams {
662
+ environment?: string;
663
+ locale?: string;
664
+ onSizeChanged?: callOnSizeChanged;
665
+ onChange?: onChange;
666
+ networkMode?: string;
667
+ mode?: string;
668
+ analytics?: {
669
+ enabled: boolean;
670
+ };
671
+ product?: string;
672
+ }
673
+ export {};
@@ -6,6 +6,7 @@
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
11
  * SDK options
11
12
  */
@@ -54,6 +55,9 @@ export var paymentMethodCategoryTypeEnum = /*#__PURE__*/function (paymentMethodC
54
55
  paymentMethodCategoryTypeEnum["ALL"] = "ALL";
55
56
  return paymentMethodCategoryTypeEnum;
56
57
  }({});
58
+
59
+ /** 表单地址数据 */
60
+
57
61
  export var payPalConfigurationIntentEnum = /*#__PURE__*/function (payPalConfigurationIntentEnum) {
58
62
  payPalConfigurationIntentEnum["intent"] = "intent";
59
63
  payPalConfigurationIntentEnum["capture"] = "capture";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alipay/ams-checkout",
3
- "version": "0.0.1723203704-dev.3",
3
+ "version": "0.0.1723203704-dev.5",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "main": "esm/index.js",
@@ -1,76 +0,0 @@
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
- import { ComponentActionNamesType } from 'src/plugin/type';
9
- import type { AMSCheckoutOptions, InitSecurityConfig } from '../../types/index';
10
- import { IAppendAddressParams } from '../../types/address';
11
- import { IoptionsAddressParams } from '../../types/address';
12
- import { EventCenter } from '../../util/index';
13
- import { Logger } from '../../util/logger';
14
- import { Security } from '../../util/security';
15
- export default class AMSADDRESSSDK {
16
- options: AMSCheckoutOptions;
17
- originOptions: IoptionsAddressParams;
18
- logger: Logger;
19
- _eventCenter: EventCenter;
20
- _instanceId: string;
21
- _storageId: string;
22
- _appendParams: IAppendAddressParams;
23
- protected securitySdkMap: Map<string, Security>;
24
- protected plugins: Map<string, any>;
25
- constructor(options: IoptionsAddressParams);
26
- private preInitSecurity;
27
- /**
28
- * @description init security SDK
29
- * @param product Product Scenarios
30
- * @param scene Scenario of the product (compatible with old version parameters, about to be deleted)
31
- */
32
- initSecurity({ product, scene, }: InitSecurityConfig & {
33
- scene?: string;
34
- }): void;
35
- /**
36
- * @description Obtain security SDK through scenario identification
37
- */
38
- _getSecuritySDKByProductScene(securityConfig: InitSecurityConfig): Security;
39
- /**
40
- * @description New security SDK through scenario identification
41
- */
42
- _newSecuritySDKByScene(securityConfig: InitSecurityConfig, successCallback?: () => void, failCallback?: (errMsg?: string) => void): Security;
43
- /**
44
- * @description Obtain risk control configuration in local storage
45
- */
46
- private getSecurityConfigStorage;
47
- /**
48
- * @description Set the sdk basic configuration
49
- */
50
- private _setOptions;
51
- /**
52
- * @description Set environment variables
53
- */
54
- private _setEnv;
55
- /**
56
- * @description Set UI and Network Mode
57
- */
58
- private _setMode;
59
- /**
60
- * @description Initialize event related tasks
61
- */
62
- private _initEvent;
63
- /**
64
- * @description Register plug-in
65
- */
66
- protected _registerPlugin(pluginId: string, plugin: any): void;
67
- /**
68
- * @description Get Plug-in
69
- */
70
- protected _getPlugin(pluginId: string): any;
71
- /**
72
- * @description Overlay Subscription
73
- */
74
- protected _overrideSubscription(name: string, func: any, funcKey: string): void;
75
- protected getBusActionNames(): ComponentActionNamesType;
76
- }