@alipay/ams-checkout 0.0.1737621505-dev.3 → 0.0.1738831627-dev.4

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,5 +1,4 @@
1
- import { IElementOptions } from '../../../types';
2
- import type { AddressMountOptions, AddressMountResult, LinkAuthMountOptions, LinkAuthMountResult, PaymentMountOptions, PaymentMountResult } from './type';
1
+ import type { AddressMountOptions, AddressMountResult, IElementOptions, LinkAuthMountOptions, LinkAuthMountResult, PaymentMountOptions, PaymentMountResult } from './type';
3
2
  export declare class ElementComponent {
4
3
  private parseData;
5
4
  private loading;
@@ -18,11 +17,12 @@ export declare class ElementComponent {
18
17
  private iframeSrc;
19
18
  private mountOptions;
20
19
  private iframes;
20
+ private loadingElement;
21
21
  private componentsCount;
22
22
  private eventCallback;
23
- private ApplePayService;
24
23
  constructor(options: IElementOptions);
25
24
  private createElement;
25
+ private createComponentSdk;
26
26
  private createIframeSrc;
27
27
  private addListener;
28
28
  private launchFunc;
@@ -34,8 +34,7 @@ export declare class ElementComponent {
34
34
  private mountAuth;
35
35
  private mountAddress;
36
36
  private mountPayment;
37
- private initApplePaySdk;
38
- mountErrorHandle(): void;
37
+ mountErrorHandle(type?: string): void;
39
38
  mount(renderOptions: AddressMountOptions, sdkSelector: string): AddressMountResult;
40
39
  mount(renderOptions: PaymentMountOptions, sdkSelector: string): PaymentMountResult;
41
40
  mount(renderOptions: LinkAuthMountOptions, sdkSelector: string): LinkAuthMountResult;
@@ -19,16 +19,15 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
19
19
  import PackageJson from "../../../../package.json";
20
20
  import { AntomSDKCore } from "../../../foundation/core";
21
21
  import { EVENT as ConstantEvent } from "../../../constant";
22
- import { ConnectErrorCode, ElementPaymentEvent, ElementPaymentMethod, EventCallbackCode, ProductSceneEnum } from "../../../types";
22
+ import { ConnectErrorCode, ProductSceneEnum } from "../../../types";
23
23
  import { parseSessionData } from "../index";
24
24
  import { ElementAddressComponent } from "./components/address";
25
25
  import { ElementAuthComponent } from "./components/auth";
26
26
  import { ElementPaymentComponent } from "./components/payment";
27
27
  // import { oneAccount, sdkAction, submitResult } from './mock';
28
- import { ApplePaySdk, isSkipRenderPaymentMethod } from "../../../plugin/component/channel";
29
28
  import { v4 as uuid } from 'uuid';
30
29
  import { LogConfig, Logger } from "../../../util/logger";
31
- import { addressTheme, ELEMENT_ENVIRONMENT, ThemeType } from "./type";
30
+ import { addressTheme, ElementPaymentEvent, ElementPaymentMethod, ElementType, ELEMENT_ENVIRONMENT, EventCallbackCode, ThemeType, MountElementType } from "./type";
32
31
  var logger = new Logger(LogConfig, true);
33
32
  var ElementProcessor = /*#__PURE__*/function () {
34
33
  function ElementProcessor(options) {
@@ -150,6 +149,8 @@ var ElementProcessor = /*#__PURE__*/function () {
150
149
  return ElementProcessor;
151
150
  }();
152
151
  export var ElementComponent = /*#__PURE__*/function () {
152
+ // address事件回调
153
+
153
154
  function ElementComponent(options) {
154
155
  var _this4 = this;
155
156
  _classCallCheck(this, ElementComponent);
@@ -187,12 +188,11 @@ export var ElementComponent = /*#__PURE__*/function () {
187
188
  // 组件mount配置记录
188
189
  _defineProperty(this, "iframes", void 0);
189
190
  // iframs合集
191
+ _defineProperty(this, "loadingElement", []);
192
+ // 当前加载中的element
190
193
  _defineProperty(this, "componentsCount", void 0);
191
194
  // mount 渲染了多少个element
192
195
  _defineProperty(this, "eventCallback", void 0);
193
- // address事件回调
194
- // apple pay
195
- _defineProperty(this, "ApplePayService", void 0);
196
196
  // 渲染地址组件
197
197
  _defineProperty(this, "mountAddress", function (renderOptions, sdkSelector) {
198
198
  var _renderOptions$appear, _this4$_options;
@@ -214,7 +214,7 @@ export var ElementComponent = /*#__PURE__*/function () {
214
214
  elementProps: renderOptions.elementProps
215
215
  }, _mountParams)).then(function (result) {
216
216
  if (!result) {
217
- return _this4.mountErrorHandle();
217
+ return _this4.mountErrorHandle(renderOptions.type);
218
218
  }
219
219
  _this4.eventService.addIFrame(result);
220
220
  _this4.iframes[ElementPaymentMethod.ADDRESS_ELEMENT] = result;
@@ -234,13 +234,12 @@ export var ElementComponent = /*#__PURE__*/function () {
234
234
  }
235
235
  };
236
236
  _this4.mountOptions[ElementPaymentMethod.PAYMENT_ELEMENT] = _mountParams;
237
- _this4.initApplePaySdk();
238
237
  _this4.paymentBase.mount(_this4._options.sessionData, _objectSpread({
239
238
  selector: sdkSelector,
240
239
  elementProps: renderOptions.elementProps
241
240
  }, _mountParams)).then(function (result) {
242
241
  if (!result) {
243
- return _this4.mountErrorHandle();
242
+ return _this4.mountErrorHandle(renderOptions.type);
244
243
  }
245
244
  _this4.eventService.addIFrame(result);
246
245
  _this4.iframes[ElementPaymentMethod.PAYMENT_ELEMENT] = result;
@@ -310,10 +309,6 @@ export var ElementComponent = /*#__PURE__*/function () {
310
309
  success: false,
311
310
  msg: 'submitPayByPaymentSession api error'
312
311
  });
313
- // this?._options?.onEventCallback?.({
314
- // code: EventCallbackCode.Failed,
315
- // message: 'submitPayByPaymentSession api error',
316
- // });
317
312
  });
318
313
  });
319
314
  });
@@ -344,70 +339,65 @@ export var ElementComponent = /*#__PURE__*/function () {
344
339
  case 0:
345
340
  params = {};
346
341
  if (!_this4.launchSource.includes(ElementPaymentMethod.AUTH_ELEMENT)) {
347
- _context.next = 9;
342
+ _context.next = 8;
348
343
  break;
349
344
  }
350
345
  _context.next = 4;
351
346
  return _this4.onValidateFunc(ElementPaymentMethod.AUTH_ELEMENT);
352
347
  case 4:
353
348
  result = _context.sent;
354
- console.log('element submit validate auth---------', result);
355
349
  params.accountInfo = (_result$data = result.data) === null || _result$data === void 0 || (_result$data = _result$data.data) === null || _result$data === void 0 ? void 0 : _result$data.accountInfo;
356
350
  if (result !== null && result !== void 0 && (_result$data2 = result.data) !== null && _result$data2 !== void 0 && _result$data2.success) {
357
- _context.next = 9;
351
+ _context.next = 8;
358
352
  break;
359
353
  }
360
354
  return _context.abrupt("return", resolve(undefined));
361
- case 9:
355
+ case 8:
362
356
  if (!_this4.launchSource.includes(ElementPaymentMethod.ADDRESS_ELEMENT)) {
363
- _context.next = 17;
357
+ _context.next = 15;
364
358
  break;
365
359
  }
366
- _context.next = 12;
360
+ _context.next = 11;
367
361
  return _this4.onValidateFunc(ElementPaymentMethod.ADDRESS_ELEMENT);
368
- case 12:
362
+ case 11:
369
363
  _result = _context.sent;
370
- console.log('element submit validate address---------', _result);
371
364
  params.shipping = (_result$data3 = _result.data) === null || _result$data3 === void 0 ? void 0 : _result$data3.data;
372
365
  if (_result !== null && _result !== void 0 && (_result$data4 = _result.data) !== null && _result$data4 !== void 0 && _result$data4.success) {
373
- _context.next = 17;
366
+ _context.next = 15;
374
367
  break;
375
368
  }
376
369
  return _context.abrupt("return", resolve(undefined));
377
- case 17:
370
+ case 15:
378
371
  if (!(_this4.launchSource.includes(ElementPaymentMethod.PAYMENT_ELEMENT) || !_this4.isConnect)) {
379
- _context.next = 30;
372
+ _context.next = 27;
380
373
  break;
381
374
  }
382
- _context.prev = 18;
383
- _context.next = 21;
375
+ _context.prev = 16;
376
+ _context.next = 19;
384
377
  return _this4.onValidateFunc(ElementPaymentMethod.PAYMENT_ELEMENT, params);
385
- case 21:
378
+ case 19:
386
379
  _result2 = _context.sent;
387
- console.log('element submit validate payment---------', _result2, _this4.isConnect);
388
- // params.paymentFactors = result.data?.data?.paymentFactors;
389
- // params.paymentMethod = result.data?.data?.paymentMethod;
390
380
  if (_result2 !== null && _result2 !== void 0 && (_result2$data = _result2.data) !== null && _result2$data !== void 0 && _result2$data.success) {
391
- _context.next = 25;
381
+ _context.next = 22;
392
382
  break;
393
383
  }
394
384
  return _context.abrupt("return", resolve(undefined));
395
- case 25:
396
- _context.next = 30;
385
+ case 22:
386
+ _context.next = 27;
397
387
  break;
398
- case 27:
399
- _context.prev = 27;
400
- _context.t0 = _context["catch"](18);
388
+ case 24:
389
+ _context.prev = 24;
390
+ _context.t0 = _context["catch"](16);
401
391
  return _context.abrupt("return", resolve(undefined));
402
- case 30:
392
+ case 27:
403
393
  // params.paymentFactors = paymentResult.data?.data.paymentFactors;
404
394
  // params.paymentMethod = paymentResult.data?.data.paymentMethod;
405
395
  resolve(params);
406
- case 31:
396
+ case 28:
407
397
  case "end":
408
398
  return _context.stop();
409
399
  }
410
- }, _callee, null, [[18, 27]]);
400
+ }, _callee, null, [[16, 24]]);
411
401
  }));
412
402
  return function (_x) {
413
403
  return _ref.apply(this, arguments);
@@ -424,7 +414,7 @@ export var ElementComponent = /*#__PURE__*/function () {
424
414
  this.iframes = {};
425
415
  this.mountOptions = {};
426
416
  logger.logInfo({
427
- title: 'a3753.b101271.c386688'
417
+ title: 'sdk_element_create'
428
418
  });
429
419
  this.createElement();
430
420
  }
@@ -460,10 +450,6 @@ export var ElementComponent = /*#__PURE__*/function () {
460
450
  var bizFlowBehavior = _this5.elementContainer.getBizFlowBehavior();
461
451
  if (!(bizFlowBehavior !== null && bizFlowBehavior !== void 0 && (_bizFlowBehavior$data = bizFlowBehavior.data) !== null && _bizFlowBehavior$data !== void 0 && _bizFlowBehavior$data.success)) {
462
452
  var _this5$_options, _this5$_options$onEve;
463
- console.log('demo event callback----', {
464
- code: EventCallbackCode.FAILED,
465
- message: 'INTERNAL_FAILED'
466
- });
467
453
  _this5 === null || _this5 === void 0 || (_this5$_options = _this5._options) === null || _this5$_options === void 0 || (_this5$_options$onEve = _this5$_options.onEventCallback) === null || _this5$_options$onEve === void 0 || _this5$_options$onEve.call(_this5$_options, {
468
454
  code: EventCallbackCode.FAILED,
469
455
  message: 'INTERNAL_FAILED'
@@ -476,46 +462,49 @@ export var ElementComponent = /*#__PURE__*/function () {
476
462
  }
477
463
  });
478
464
  this.iframeSrc = this.createIframeSrc(this._options.environment, this._options.version);
465
+ var serviceProvider = this.elementContainer.getServiceProvider();
466
+ this.eventService = serviceProvider.getService('EventCenter');
467
+ this.requestService = serviceProvider.getService('Requester');
468
+
469
+ // 注册监听消息
470
+ this.addListener();
471
+ }
472
+ }, {
473
+ key: "createComponentSdk",
474
+ value: function createComponentSdk(type) {
479
475
  try {
480
476
  // 注册 auth 邮箱模块
481
- this.authBase = new ElementAuthComponent();
482
- this.authBase.create({
483
- environment: this._options.environment,
484
- locale: this._options.locale
485
- });
486
- var serviceProvider = this.elementContainer.getServiceProvider();
487
- this.eventService = serviceProvider.getService('EventCenter');
488
- this.requestService = serviceProvider.getService('Requester');
489
- // 注册 payment 卡支付模块
490
- this.paymentBase = new ElementPaymentComponent();
491
- this.paymentBase.create({
492
- environment: this._options.environment,
493
- locale: this._options.locale,
494
- appVersion: this._options.version || ''
495
- }, this.isConnect);
496
-
497
- // 注册 address 地址模块
498
- this.addressBase = new ElementAddressComponent();
499
- this.addressBase.create({
500
- environment: this._options.environment,
501
- locale: this._options.locale,
502
- appVersion: this._options.version || ''
503
- }, this.isConnect);
477
+ if (type === ElementType.auth) {
478
+ this.authBase = new ElementAuthComponent();
479
+ this.authBase.create({
480
+ environment: this._options.environment,
481
+ locale: this._options.locale
482
+ });
483
+ } else if (type === ElementType.address) {
484
+ this.addressBase = new ElementAddressComponent();
485
+ this.addressBase.create({
486
+ environment: this._options.environment,
487
+ locale: this._options.locale,
488
+ appVersion: this._options.version || ''
489
+ }, this.isConnect);
490
+ } else if (type === ElementType.payment) {
491
+ // 注册 payment 卡支付模块
492
+ this.paymentBase = new ElementPaymentComponent();
493
+ this.paymentBase.create({
494
+ environment: this._options.environment,
495
+ locale: this._options.locale,
496
+ appVersion: this._options.version || ''
497
+ }, this.isConnect);
498
+ } else {
499
+ throw Error("The provided 'type' value is invalid");
500
+ }
504
501
  } catch (error) {
505
502
  var _this$_options$onEven, _this$_options;
506
- console.log('demo event callback----', {
507
- code: EventCallbackCode.FAILED,
508
- message: 'INTERNAL_FAILED'
509
- });
510
503
  (_this$_options$onEven = (_this$_options = this._options).onEventCallback) === null || _this$_options$onEven === void 0 || _this$_options$onEven.call(_this$_options, {
511
504
  code: EventCallbackCode.FAILED,
512
505
  message: 'INTERNAL_FAILED'
513
- // message: 'create sdk fail',
514
506
  });
515
507
  }
516
-
517
- // 注册监听消息
518
- this.addListener();
519
508
  }
520
509
 
521
510
  // iframe src生成方法
@@ -573,12 +562,10 @@ export var ElementComponent = /*#__PURE__*/function () {
573
562
  });
574
563
  this.eventService.listen(ElementPaymentEvent.SEND_MUITI_APP_EVENT_TO_SDK, function (result) {
575
564
  var _this6$_options$onEve, _this6$_options;
576
- console.log('demo event callback----', result.data);
577
565
  (_this6$_options$onEve = (_this6$_options = _this6._options).onEventCallback) === null || _this6$_options$onEve === void 0 || _this6$_options$onEve.call(_this6$_options, result.data);
578
566
  });
579
567
  this.eventService.listen(ElementPaymentEvent.CALLBACK, function (result) {
580
568
  var _this6$eventCallback;
581
- console.log('antom sdk 组件事件回调');
582
569
  if ((_this6$eventCallback = _this6.eventCallback) !== null && _this6$eventCallback !== void 0 && (_this6$eventCallback = _this6$eventCallback[result.source]) !== null && _this6$eventCallback !== void 0 && _this6$eventCallback[result.event]) {
583
570
  var _this6$eventCallback$, _this6$eventCallback$2;
584
571
  (_this6$eventCallback$ = (_this6$eventCallback$2 = _this6.eventCallback[result.source])[result.event]) === null || _this6$eventCallback$ === void 0 || _this6$eventCallback$.call(_this6$eventCallback$2, result.data);
@@ -590,26 +577,10 @@ export var ElementComponent = /*#__PURE__*/function () {
590
577
  this.eventService.listen(ConstantEvent.redirect.name, function (data, res) {
591
578
  data.isDestroy && _this6.unmount();
592
579
  });
593
- this.eventService.listen(ElementPaymentEvent.LOG, function (result) {
594
- console.log('antom sdk 组件日志回调');
595
- });
596
- this.eventService.listen(ElementPaymentEvent.HANDLE_PAYMENT, function (result) {
597
- if ((result === null || result === void 0 ? void 0 : result.paymentMethodType) === 'APPLEPAY') {
598
- _this6.ApplePayService.begin().then(function (res) {
599
- _this6.onAfterSubmitFunc(ElementPaymentMethod.PAYMENT_ELEMENT, {
600
- submitPayData: res
601
- });
602
- }).catch(function (e) {
603
- _this6.onAfterSubmitFunc(ElementPaymentMethod.PAYMENT_ELEMENT, {
604
- submitPayData: {},
605
- errorInfo: {
606
- hasError: true,
607
- errorCode: e === null || e === void 0 ? void 0 : e.errorCode
608
- }
609
- });
610
- });
611
- }
612
- });
580
+
581
+ // this.eventService.listen(ElementPaymentEvent.LOG, (result: EventCallbackData) => {
582
+ // console.log('antom sdk 组件日志回调');
583
+ // });
613
584
  }
614
585
 
615
586
  // launch消息处理
@@ -689,7 +660,6 @@ export var ElementComponent = /*#__PURE__*/function () {
689
660
  this.eventService.unlisten(ElementPaymentEvent.CAPTURE_ASSET);
690
661
  this.eventService.unlisten(ElementPaymentEvent.LAUNCH);
691
662
  this.eventService.unlisten(ElementPaymentEvent.SIZE_CHANGE);
692
- this.eventService.unlisten(ElementPaymentEvent.HANDLE_PAYMENT);
693
663
  }
694
664
 
695
665
  // 注册组件事件监听
@@ -721,61 +691,16 @@ export var ElementComponent = /*#__PURE__*/function () {
721
691
  url: url
722
692
  }).then(function (result) {
723
693
  if (!result) {
724
- return _this8.mountErrorHandle();
694
+ return _this8.mountErrorHandle(renderOptions.type);
725
695
  }
726
696
  _this8.eventService.addIFrame(result);
727
697
  _this8.iframes[ElementPaymentMethod.AUTH_ELEMENT] = result;
728
698
  });
729
699
  return {};
730
700
  }
731
- }, {
732
- key: "initApplePaySdk",
733
- value: function () {
734
- var _initApplePaySdk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
735
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
736
- while (1) switch (_context2.prev = _context2.next) {
737
- case 0:
738
- if (!isSkipRenderPaymentMethod(this.parseData)) {
739
- _context2.next = 12;
740
- break;
741
- }
742
- this.ApplePayService = new ApplePaySdk({
743
- paymentSessionData: this.sessionData,
744
- parseData: this.parseData,
745
- logger: logger
746
- });
747
- _context2.prev = 2;
748
- logger.logInfo({
749
- title: 'a3753.b107385.c398110'
750
- });
751
- _context2.next = 6;
752
- return this.ApplePayService.initApplePaySession();
753
- case 6:
754
- logger.logInfo({
755
- title: 'a3753.b107385.c398112'
756
- });
757
- _context2.next = 12;
758
- break;
759
- case 9:
760
- _context2.prev = 9;
761
- _context2.t0 = _context2["catch"](2);
762
- logger.logError({
763
- title: 'a3753.b107385.c398111'
764
- });
765
- case 12:
766
- case "end":
767
- return _context2.stop();
768
- }
769
- }, _callee2, this, [[2, 9]]);
770
- }));
771
- function initApplePaySdk() {
772
- return _initApplePaySdk.apply(this, arguments);
773
- }
774
- return initApplePaySdk;
775
- }()
776
701
  }, {
777
702
  key: "mountErrorHandle",
778
- value: function mountErrorHandle() {
703
+ value: function mountErrorHandle(type) {
779
704
  var _this$_options$onEven2, _this$_options3;
780
705
  console.log('demo event callback----', {
781
706
  code: EventCallbackCode.FAILED,
@@ -785,21 +710,31 @@ export var ElementComponent = /*#__PURE__*/function () {
785
710
  code: EventCallbackCode.FAILED,
786
711
  message: 'INTERNAL_FAILED'
787
712
  });
713
+ if (type) {
714
+ this.loadingElement = this.loadingElement.filter(function (item) {
715
+ return item !== type;
716
+ });
717
+ }
788
718
  logger.logError({
789
- title: 'a3753.b101271.c386691'
719
+ title: 'sdk_element_mount_fail'
790
720
  });
791
721
  }
792
722
  }, {
793
723
  key: "mount",
794
724
  value: function mount(renderOptions, sdkSelector) {
725
+ this.createComponentSdk(renderOptions.type);
726
+ if (this.iframes[MountElementType[renderOptions === null || renderOptions === void 0 ? void 0 : renderOptions.type]] || this.loadingElement.includes(renderOptions === null || renderOptions === void 0 ? void 0 : renderOptions.type)) {
727
+ throw Error("The component has been mounted, please do not execute it again.");
728
+ }
729
+ this.loadingElement.push(renderOptions === null || renderOptions === void 0 ? void 0 : renderOptions.type);
795
730
  logger.logInfo({
796
- title: 'a3753.b101271.c386690'
731
+ title: 'sdk_element_mount_start'
797
732
  });
798
733
  if (typeof sdkSelector === 'string') {
799
734
  var _this$_options$loadin4, _renderOptions$debugP, _renderOptions$debugP2;
800
735
  var element = document.querySelector(sdkSelector);
801
736
  if (!element) {
802
- return this.mountErrorHandle();
737
+ throw Error("Loading failed, you need to check if the element exists.");
803
738
  }
804
739
  this.componentsCount = this.componentsCount + 1;
805
740
  if (!this.loading && (_this$_options$loadin4 = this._options.loading) !== null && _this$_options$loadin4 !== void 0 && _this$_options$loadin4.onStartLoading && this.isConnect) {
@@ -811,13 +746,13 @@ export var ElementComponent = /*#__PURE__*/function () {
811
746
  elementLink: elementLink
812
747
  };
813
748
  this.loading = true;
814
- if (renderOptions.type === 'auth') {
749
+ if (renderOptions.type === ElementType.auth) {
815
750
  return this.mountAuth(renderOptions, sdkSelector);
816
751
  }
817
- if (renderOptions.type === 'address') {
752
+ if (renderOptions.type === ElementType.address) {
818
753
  return this.mountAddress(renderOptions, sdkSelector);
819
754
  }
820
- if (renderOptions.type === 'payment') {
755
+ if (renderOptions.type === ElementType.payment) {
821
756
  return this.mountPayment(renderOptions, sdkSelector);
822
757
  }
823
758
  } else {
@@ -849,37 +784,43 @@ export var ElementComponent = /*#__PURE__*/function () {
849
784
  (_this$addressBase2 = this.addressBase) === null || _this$addressBase2 === void 0 || (_this$addressBase2$un = _this$addressBase2.unmount) === null || _this$addressBase2$un === void 0 || _this$addressBase2$un.call(_this$addressBase2);
850
785
  (_this$paymentBase2 = this.paymentBase) === null || _this$paymentBase2 === void 0 || (_this$paymentBase2$un = _this$paymentBase2.unmount) === null || _this$paymentBase2$un === void 0 || _this$paymentBase2$un.call(_this$paymentBase2);
851
786
  this.launchSource = [];
787
+ this.iframes = {};
852
788
  this.componentsCount = 0;
853
789
  this.eventService.destroy();
854
790
  this.removeListener();
791
+ this.loadingElement = [];
855
792
  }
856
793
  }, {
857
794
  key: "submitPayment",
858
795
  value: // 暴露出去的submit方法
859
796
  function () {
860
- var _submitPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
797
+ var _submitPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
861
798
  var _this$_options$loadin7, _this$_options$loadin10;
862
799
  var _this$_options$loadin8, _this$_options$loadin9, _this$_options$loadin11, _this$_options$loadin12;
863
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
864
- while (1) switch (_context3.prev = _context3.next) {
800
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
801
+ while (1) switch (_context2.prev = _context2.next) {
865
802
  case 0:
866
- // this.onAfterSubmitFunc(ElementPaymentMethod.PAYMENT_ELEMENT, submitResult);
867
- // return
803
+ if (this.iframes.PAYMENT_ELEMENT) {
804
+ _context2.next = 2;
805
+ break;
806
+ }
807
+ throw Error("Component is not mounted. You need to check if the mount method has been successfully called to mount the component.");
808
+ case 2:
868
809
  if ((_this$_options$loadin7 = this._options.loading) !== null && _this$_options$loadin7 !== void 0 && _this$_options$loadin7.onStartLoading) {
869
810
  (_this$_options$loadin8 = this._options.loading) === null || _this$_options$loadin8 === void 0 || (_this$_options$loadin9 = _this$_options$loadin8.onStartLoading) === null || _this$_options$loadin9 === void 0 || _this$_options$loadin9.call(_this$_options$loadin8);
870
811
  }
871
- _context3.next = 3;
812
+ _context2.next = 5;
872
813
  return this.validatePromiseFuncs();
873
- case 3:
814
+ case 5:
874
815
  if ((_this$_options$loadin10 = this._options.loading) !== null && _this$_options$loadin10 !== void 0 && _this$_options$loadin10.onEndLoading) {
875
816
  (_this$_options$loadin11 = this._options.loading) === null || _this$_options$loadin11 === void 0 || (_this$_options$loadin12 = _this$_options$loadin11.onEndLoading) === null || _this$_options$loadin12 === void 0 || _this$_options$loadin12.call(_this$_options$loadin11);
876
817
  }
877
- return _context3.abrupt("return");
878
- case 5:
818
+ return _context2.abrupt("return");
819
+ case 7:
879
820
  case "end":
880
- return _context3.stop();
821
+ return _context2.stop();
881
822
  }
882
- }, _callee3, this);
823
+ }, _callee2, this);
883
824
  }));
884
825
  function submitPayment() {
885
826
  return _submitPayment.apply(this, arguments);