@pelcro/react-pelcro-js 3.26.0-beta.67 → 3.26.0-beta.69

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.
package/dist/index.cjs.js CHANGED
@@ -18701,6 +18701,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18701
18701
  title
18702
18702
  } = _ref2;
18703
18703
  notifyBugsnag(() => {
18704
+ // eslint-disable-next-line no-undef
18704
18705
  Bugsnag.notify(title !== null && title !== void 0 ? title : "ERROR", event => {
18705
18706
  var _document$getElementB, _document$querySelect;
18706
18707
  event.addMetadata("MetaData", {
@@ -18953,6 +18954,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18953
18954
  key: jwk
18954
18955
  } = res;
18955
18956
  // SETUP MICROFORM
18957
+ // eslint-disable-next-line no-undef
18956
18958
  FLEX.microform({
18957
18959
  keyId: jwk.kid,
18958
18960
  keystore: jwk,
@@ -20235,10 +20237,20 @@ const PaymentMethodContainerWithoutStripe = _ref => {
20235
20237
  error
20236
20238
  } = _ref9;
20237
20239
  if (error) {
20240
+ var _error$response, _error$response2, _error$response2$data, _error$response2$data2, _window$Pelcro2, _window$Pelcro2$site, _window$Pelcro3, _window$Pelcro3$user, _window$Pelcro4;
20238
20241
  handlePaymentError(error);
20239
20242
  fireBugSnag({
20240
20243
  error,
20241
- title: "generate3DSecureSource - ERROR"
20244
+ title: "generate3DSecureSource - ERROR",
20245
+ name: error === null || error === void 0 ? void 0 : error.name,
20246
+ message: error === null || error === void 0 ? void 0 : error.message,
20247
+ type: error === null || error === void 0 ? void 0 : error.type,
20248
+ code: error === null || error === void 0 ? void 0 : error.code,
20249
+ status: error === null || error === void 0 ? void 0 : (_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.status,
20250
+ error_message: error === null || error === void 0 ? void 0 : (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : (_error$response2$data = _error$response2.data) === null || _error$response2$data === void 0 ? void 0 : (_error$response2$data2 = _error$response2$data.error) === null || _error$response2$data2 === void 0 ? void 0 : _error$response2$data2.message,
20251
+ site: (_window$Pelcro2 = window.Pelcro) === null || _window$Pelcro2 === void 0 ? void 0 : (_window$Pelcro2$site = _window$Pelcro2.site) === null || _window$Pelcro2$site === void 0 ? void 0 : _window$Pelcro2$site.read(),
20252
+ user: (_window$Pelcro3 = window.Pelcro) === null || _window$Pelcro3 === void 0 ? void 0 : (_window$Pelcro3$user = _window$Pelcro3.user) === null || _window$Pelcro3$user === void 0 ? void 0 : _window$Pelcro3$user.read(),
20253
+ environment: (_window$Pelcro4 = window.Pelcro) === null || _window$Pelcro4 === void 0 ? void 0 : _window$Pelcro4.environment
20242
20254
  });
20243
20255
  return;
20244
20256
  }
@@ -20505,13 +20517,14 @@ const PaymentMethodContainerWithoutStripe = _ref => {
20505
20517
  * @param error
20506
20518
  * @returns {*}
20507
20519
  */
20508
- const confirmStripeCardPayment = function (response, error) {
20520
+ const confirmStripeCardPayment = async function (response, error) {
20509
20521
  let isSubCreate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
20510
- if (response) {
20511
- var _response$data;
20512
- const paymentIntent = (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.payment_intent;
20513
- if ((paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.status) === "requires_action" && paymentIntent !== null && paymentIntent !== void 0 && paymentIntent.client_secret) {
20514
- stripe.confirmCardPayment(paymentIntent.client_secret).then(res => {
20522
+ try {
20523
+ if (response) {
20524
+ var _response$data;
20525
+ const paymentIntent = (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.payment_intent;
20526
+ if ((paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.status) === "requires_action" && paymentIntent !== null && paymentIntent !== void 0 && paymentIntent.client_secret) {
20527
+ const res = await stripe.confirmCardPayment(paymentIntent.client_secret);
20515
20528
  if (!isSubCreate) {
20516
20529
  dispatch({
20517
20530
  type: DISABLE_SUBMIT,
@@ -20523,50 +20536,106 @@ const PaymentMethodContainerWithoutStripe = _ref => {
20523
20536
  payload: false
20524
20537
  });
20525
20538
  if (res.error) {
20539
+ notifyBugsnag(() => {
20540
+ // eslint-disable-next-line no-undef
20541
+ Bugsnag.notify(`Payment ${res.error}`, event => {
20542
+ var _error$response3, _error$response3$data, _error$response3$data2, _window$Pelcro5, _window$Pelcro5$site, _window$Pelcro6, _window$Pelcro6$user, _window$Pelcro7;
20543
+ event.addMetadata("Stripe Error MetaData", {
20544
+ message: res.error.message,
20545
+ type: res.error.type,
20546
+ code: res.error.code,
20547
+ error_message: error === null || error === void 0 ? void 0 : (_error$response3 = error.response) === null || _error$response3 === void 0 ? void 0 : (_error$response3$data = _error$response3.data) === null || _error$response3$data === void 0 ? void 0 : (_error$response3$data2 = _error$response3$data.error) === null || _error$response3$data2 === void 0 ? void 0 : _error$response3$data2.message,
20548
+ site: (_window$Pelcro5 = window.Pelcro) === null || _window$Pelcro5 === void 0 ? void 0 : (_window$Pelcro5$site = _window$Pelcro5.site) === null || _window$Pelcro5$site === void 0 ? void 0 : _window$Pelcro5$site.read(),
20549
+ user: (_window$Pelcro6 = window.Pelcro) === null || _window$Pelcro6 === void 0 ? void 0 : (_window$Pelcro6$user = _window$Pelcro6.user) === null || _window$Pelcro6$user === void 0 ? void 0 : _window$Pelcro6$user.read(),
20550
+ environment: (_window$Pelcro7 = window.Pelcro) === null || _window$Pelcro7 === void 0 ? void 0 : _window$Pelcro7.environment
20551
+ });
20552
+ });
20553
+ });
20526
20554
  onFailure(res.error);
20527
- dispatch({
20555
+ return dispatch({
20528
20556
  type: SHOW_ALERT,
20529
20557
  payload: {
20530
20558
  type: "error",
20531
20559
  content: isSubCreate ? t("messages.tryAgainFromInvoice") : getErrorMessages(res.error)
20532
20560
  }
20533
20561
  });
20534
- fireBugSnag({
20535
- error: getErrorMessages(res.error),
20536
- title: "StripeConfirmCardPayment - ERROR"
20537
- });
20538
- return;
20539
20562
  }
20540
20563
  onSuccess(res);
20541
- });
20542
- } else if ((paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.status) === "requires_payment_method" && paymentIntent !== null && paymentIntent !== void 0 && paymentIntent.client_secret) {
20543
- if (!isSubCreate) {
20564
+ } else if ((paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.status) === "requires_payment_method" && paymentIntent !== null && paymentIntent !== void 0 && paymentIntent.client_secret) {
20565
+ if (!isSubCreate) {
20566
+ dispatch({
20567
+ type: DISABLE_SUBMIT,
20568
+ payload: false
20569
+ });
20570
+ }
20544
20571
  dispatch({
20545
- type: DISABLE_SUBMIT,
20572
+ type: LOADING,
20546
20573
  payload: false
20547
20574
  });
20575
+ onFailure(error);
20576
+ return dispatch({
20577
+ type: SHOW_ALERT,
20578
+ payload: {
20579
+ type: "error",
20580
+ content: isSubCreate ? t("messages.tryAgainFromInvoice") : t("messages.cardAuthFailed")
20581
+ }
20582
+ });
20583
+ } else {
20584
+ onSuccess(response);
20548
20585
  }
20586
+ } else {
20549
20587
  dispatch({
20550
- type: LOADING,
20588
+ type: DISABLE_SUBMIT,
20551
20589
  payload: false
20552
20590
  });
20553
- onFailure(error);
20554
20591
  dispatch({
20555
- type: SHOW_ALERT,
20556
- payload: {
20557
- type: "error",
20558
- content: isSubCreate ? t("messages.tryAgainFromInvoice") : t("messages.cardAuthFailed")
20559
- }
20560
- });
20561
- fireBugSnag({
20562
- error: getErrorMessages(error),
20563
- title: "StripeConfirmCardPayment - ERROR"
20592
+ type: LOADING,
20593
+ payload: false
20564
20594
  });
20565
- return;
20566
- } else {
20595
+ if (error) {
20596
+ notifyBugsnag(() => {
20597
+ // eslint-disable-next-line no-undef
20598
+ Bugsnag.notify(`Payment ${error}`, event => {
20599
+ var _error$response4, _error$response5, _error$response5$data, _error$response5$data2, _window$Pelcro8, _window$Pelcro8$site, _window$Pelcro9, _window$Pelcro9$user, _window$Pelcro10;
20600
+ event.addMetadata("MetaData", {
20601
+ name: error === null || error === void 0 ? void 0 : error.name,
20602
+ message: error === null || error === void 0 ? void 0 : error.message,
20603
+ type: error === null || error === void 0 ? void 0 : error.type,
20604
+ code: error === null || error === void 0 ? void 0 : error.code,
20605
+ status: error === null || error === void 0 ? void 0 : (_error$response4 = error.response) === null || _error$response4 === void 0 ? void 0 : _error$response4.status,
20606
+ error_message: error === null || error === void 0 ? void 0 : (_error$response5 = error.response) === null || _error$response5 === void 0 ? void 0 : (_error$response5$data = _error$response5.data) === null || _error$response5$data === void 0 ? void 0 : (_error$response5$data2 = _error$response5$data.error) === null || _error$response5$data2 === void 0 ? void 0 : _error$response5$data2.message,
20607
+ site: (_window$Pelcro8 = window.Pelcro) === null || _window$Pelcro8 === void 0 ? void 0 : (_window$Pelcro8$site = _window$Pelcro8.site) === null || _window$Pelcro8$site === void 0 ? void 0 : _window$Pelcro8$site.read(),
20608
+ user: (_window$Pelcro9 = window.Pelcro) === null || _window$Pelcro9 === void 0 ? void 0 : (_window$Pelcro9$user = _window$Pelcro9.user) === null || _window$Pelcro9$user === void 0 ? void 0 : _window$Pelcro9$user.read(),
20609
+ environment: (_window$Pelcro10 = window.Pelcro) === null || _window$Pelcro10 === void 0 ? void 0 : _window$Pelcro10.environment
20610
+ });
20611
+ });
20612
+ });
20613
+ onFailure(error);
20614
+ return dispatch({
20615
+ type: SHOW_ALERT,
20616
+ payload: {
20617
+ type: "error",
20618
+ content: getErrorMessages(error)
20619
+ }
20620
+ });
20621
+ }
20567
20622
  onSuccess(response);
20568
20623
  }
20569
- } else {
20624
+ } catch (error) {
20625
+ notifyBugsnag(() => {
20626
+ // eslint-disable-next-line no-undef
20627
+ Bugsnag.notify(`Payment ${error}`, event => {
20628
+ var _error$response6, _error$response6$data, _error$response6$data2, _window$Pelcro11, _window$Pelcro11$site, _window$Pelcro12, _window$Pelcro12$user, _window$Pelcro13;
20629
+ event.addMetadata("UnexpectedError", {
20630
+ message: error.message,
20631
+ stack: error.stack,
20632
+ error_message: error === null || error === void 0 ? void 0 : (_error$response6 = error.response) === null || _error$response6 === void 0 ? void 0 : (_error$response6$data = _error$response6.data) === null || _error$response6$data === void 0 ? void 0 : (_error$response6$data2 = _error$response6$data.error) === null || _error$response6$data2 === void 0 ? void 0 : _error$response6$data2.message,
20633
+ site: (_window$Pelcro11 = window.Pelcro) === null || _window$Pelcro11 === void 0 ? void 0 : (_window$Pelcro11$site = _window$Pelcro11.site) === null || _window$Pelcro11$site === void 0 ? void 0 : _window$Pelcro11$site.read(),
20634
+ user: (_window$Pelcro12 = window.Pelcro) === null || _window$Pelcro12 === void 0 ? void 0 : (_window$Pelcro12$user = _window$Pelcro12.user) === null || _window$Pelcro12$user === void 0 ? void 0 : _window$Pelcro12$user.read(),
20635
+ environment: (_window$Pelcro13 = window.Pelcro) === null || _window$Pelcro13 === void 0 ? void 0 : _window$Pelcro13.environment
20636
+ });
20637
+ });
20638
+ });
20570
20639
  dispatch({
20571
20640
  type: DISABLE_SUBMIT,
20572
20641
  payload: false
@@ -20575,22 +20644,14 @@ const PaymentMethodContainerWithoutStripe = _ref => {
20575
20644
  type: LOADING,
20576
20645
  payload: false
20577
20646
  });
20578
- if (error) {
20579
- onFailure(error);
20580
- dispatch({
20581
- type: SHOW_ALERT,
20582
- payload: {
20583
- type: "error",
20584
- content: getErrorMessages(error)
20585
- }
20586
- });
20587
- fireBugSnag({
20588
- error: getErrorMessages(error),
20589
- title: "StripeConfirmCardPayment - ERROR"
20590
- });
20591
- return;
20592
- }
20593
- onSuccess(response);
20647
+ onFailure(error);
20648
+ return dispatch({
20649
+ type: SHOW_ALERT,
20650
+ payload: {
20651
+ type: "error",
20652
+ content: t("messages.unexpectedError")
20653
+ }
20654
+ });
20594
20655
  }
20595
20656
  };
20596
20657
  const confirmStripeIntentSetup = (response, flow, paymentMethodId) => {
@@ -20901,7 +20962,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
20901
20962
  addressId: selectedAddressId,
20902
20963
  couponCode
20903
20964
  }, (err, orderResponse) => {
20904
- var _window$Pelcro2, _window$Pelcro2$user, _window$Pelcro2$user$;
20965
+ var _window$Pelcro14, _window$Pelcro14$user, _window$Pelcro14$user2;
20905
20966
  if (err) {
20906
20967
  toggleAuthenticationSuccessPendingView(false);
20907
20968
  dispatch({
@@ -20932,7 +20993,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
20932
20993
  });
20933
20994
  }
20934
20995
  window.Pelcro.user.refresh({
20935
- auth_token: (_window$Pelcro2 = window.Pelcro) === null || _window$Pelcro2 === void 0 ? void 0 : (_window$Pelcro2$user = _window$Pelcro2.user) === null || _window$Pelcro2$user === void 0 ? void 0 : (_window$Pelcro2$user$ = _window$Pelcro2$user.read()) === null || _window$Pelcro2$user$ === void 0 ? void 0 : _window$Pelcro2$user$.auth_token
20996
+ auth_token: (_window$Pelcro14 = window.Pelcro) === null || _window$Pelcro14 === void 0 ? void 0 : (_window$Pelcro14$user = _window$Pelcro14.user) === null || _window$Pelcro14$user === void 0 ? void 0 : (_window$Pelcro14$user2 = _window$Pelcro14$user.read()) === null || _window$Pelcro14$user2 === void 0 ? void 0 : _window$Pelcro14$user2.auth_token
20936
20997
  }, (err, res) => {
20937
20998
  dispatch({
20938
20999
  type: DISABLE_SUBMIT,
package/dist/index.esm.js CHANGED
@@ -18671,6 +18671,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18671
18671
  title
18672
18672
  } = _ref2;
18673
18673
  notifyBugsnag(() => {
18674
+ // eslint-disable-next-line no-undef
18674
18675
  Bugsnag.notify(title !== null && title !== void 0 ? title : "ERROR", event => {
18675
18676
  var _document$getElementB, _document$querySelect;
18676
18677
  event.addMetadata("MetaData", {
@@ -18923,6 +18924,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18923
18924
  key: jwk
18924
18925
  } = res;
18925
18926
  // SETUP MICROFORM
18927
+ // eslint-disable-next-line no-undef
18926
18928
  FLEX.microform({
18927
18929
  keyId: jwk.kid,
18928
18930
  keystore: jwk,
@@ -20205,10 +20207,20 @@ const PaymentMethodContainerWithoutStripe = _ref => {
20205
20207
  error
20206
20208
  } = _ref9;
20207
20209
  if (error) {
20210
+ var _error$response, _error$response2, _error$response2$data, _error$response2$data2, _window$Pelcro2, _window$Pelcro2$site, _window$Pelcro3, _window$Pelcro3$user, _window$Pelcro4;
20208
20211
  handlePaymentError(error);
20209
20212
  fireBugSnag({
20210
20213
  error,
20211
- title: "generate3DSecureSource - ERROR"
20214
+ title: "generate3DSecureSource - ERROR",
20215
+ name: error === null || error === void 0 ? void 0 : error.name,
20216
+ message: error === null || error === void 0 ? void 0 : error.message,
20217
+ type: error === null || error === void 0 ? void 0 : error.type,
20218
+ code: error === null || error === void 0 ? void 0 : error.code,
20219
+ status: error === null || error === void 0 ? void 0 : (_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.status,
20220
+ error_message: error === null || error === void 0 ? void 0 : (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : (_error$response2$data = _error$response2.data) === null || _error$response2$data === void 0 ? void 0 : (_error$response2$data2 = _error$response2$data.error) === null || _error$response2$data2 === void 0 ? void 0 : _error$response2$data2.message,
20221
+ site: (_window$Pelcro2 = window.Pelcro) === null || _window$Pelcro2 === void 0 ? void 0 : (_window$Pelcro2$site = _window$Pelcro2.site) === null || _window$Pelcro2$site === void 0 ? void 0 : _window$Pelcro2$site.read(),
20222
+ user: (_window$Pelcro3 = window.Pelcro) === null || _window$Pelcro3 === void 0 ? void 0 : (_window$Pelcro3$user = _window$Pelcro3.user) === null || _window$Pelcro3$user === void 0 ? void 0 : _window$Pelcro3$user.read(),
20223
+ environment: (_window$Pelcro4 = window.Pelcro) === null || _window$Pelcro4 === void 0 ? void 0 : _window$Pelcro4.environment
20212
20224
  });
20213
20225
  return;
20214
20226
  }
@@ -20475,13 +20487,14 @@ const PaymentMethodContainerWithoutStripe = _ref => {
20475
20487
  * @param error
20476
20488
  * @returns {*}
20477
20489
  */
20478
- const confirmStripeCardPayment = function (response, error) {
20490
+ const confirmStripeCardPayment = async function (response, error) {
20479
20491
  let isSubCreate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
20480
- if (response) {
20481
- var _response$data;
20482
- const paymentIntent = (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.payment_intent;
20483
- if ((paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.status) === "requires_action" && paymentIntent !== null && paymentIntent !== void 0 && paymentIntent.client_secret) {
20484
- stripe.confirmCardPayment(paymentIntent.client_secret).then(res => {
20492
+ try {
20493
+ if (response) {
20494
+ var _response$data;
20495
+ const paymentIntent = (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.payment_intent;
20496
+ if ((paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.status) === "requires_action" && paymentIntent !== null && paymentIntent !== void 0 && paymentIntent.client_secret) {
20497
+ const res = await stripe.confirmCardPayment(paymentIntent.client_secret);
20485
20498
  if (!isSubCreate) {
20486
20499
  dispatch({
20487
20500
  type: DISABLE_SUBMIT,
@@ -20493,50 +20506,106 @@ const PaymentMethodContainerWithoutStripe = _ref => {
20493
20506
  payload: false
20494
20507
  });
20495
20508
  if (res.error) {
20509
+ notifyBugsnag(() => {
20510
+ // eslint-disable-next-line no-undef
20511
+ Bugsnag.notify(`Payment ${res.error}`, event => {
20512
+ var _error$response3, _error$response3$data, _error$response3$data2, _window$Pelcro5, _window$Pelcro5$site, _window$Pelcro6, _window$Pelcro6$user, _window$Pelcro7;
20513
+ event.addMetadata("Stripe Error MetaData", {
20514
+ message: res.error.message,
20515
+ type: res.error.type,
20516
+ code: res.error.code,
20517
+ error_message: error === null || error === void 0 ? void 0 : (_error$response3 = error.response) === null || _error$response3 === void 0 ? void 0 : (_error$response3$data = _error$response3.data) === null || _error$response3$data === void 0 ? void 0 : (_error$response3$data2 = _error$response3$data.error) === null || _error$response3$data2 === void 0 ? void 0 : _error$response3$data2.message,
20518
+ site: (_window$Pelcro5 = window.Pelcro) === null || _window$Pelcro5 === void 0 ? void 0 : (_window$Pelcro5$site = _window$Pelcro5.site) === null || _window$Pelcro5$site === void 0 ? void 0 : _window$Pelcro5$site.read(),
20519
+ user: (_window$Pelcro6 = window.Pelcro) === null || _window$Pelcro6 === void 0 ? void 0 : (_window$Pelcro6$user = _window$Pelcro6.user) === null || _window$Pelcro6$user === void 0 ? void 0 : _window$Pelcro6$user.read(),
20520
+ environment: (_window$Pelcro7 = window.Pelcro) === null || _window$Pelcro7 === void 0 ? void 0 : _window$Pelcro7.environment
20521
+ });
20522
+ });
20523
+ });
20496
20524
  onFailure(res.error);
20497
- dispatch({
20525
+ return dispatch({
20498
20526
  type: SHOW_ALERT,
20499
20527
  payload: {
20500
20528
  type: "error",
20501
20529
  content: isSubCreate ? t("messages.tryAgainFromInvoice") : getErrorMessages(res.error)
20502
20530
  }
20503
20531
  });
20504
- fireBugSnag({
20505
- error: getErrorMessages(res.error),
20506
- title: "StripeConfirmCardPayment - ERROR"
20507
- });
20508
- return;
20509
20532
  }
20510
20533
  onSuccess(res);
20511
- });
20512
- } else if ((paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.status) === "requires_payment_method" && paymentIntent !== null && paymentIntent !== void 0 && paymentIntent.client_secret) {
20513
- if (!isSubCreate) {
20534
+ } else if ((paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.status) === "requires_payment_method" && paymentIntent !== null && paymentIntent !== void 0 && paymentIntent.client_secret) {
20535
+ if (!isSubCreate) {
20536
+ dispatch({
20537
+ type: DISABLE_SUBMIT,
20538
+ payload: false
20539
+ });
20540
+ }
20514
20541
  dispatch({
20515
- type: DISABLE_SUBMIT,
20542
+ type: LOADING,
20516
20543
  payload: false
20517
20544
  });
20545
+ onFailure(error);
20546
+ return dispatch({
20547
+ type: SHOW_ALERT,
20548
+ payload: {
20549
+ type: "error",
20550
+ content: isSubCreate ? t("messages.tryAgainFromInvoice") : t("messages.cardAuthFailed")
20551
+ }
20552
+ });
20553
+ } else {
20554
+ onSuccess(response);
20518
20555
  }
20556
+ } else {
20519
20557
  dispatch({
20520
- type: LOADING,
20558
+ type: DISABLE_SUBMIT,
20521
20559
  payload: false
20522
20560
  });
20523
- onFailure(error);
20524
20561
  dispatch({
20525
- type: SHOW_ALERT,
20526
- payload: {
20527
- type: "error",
20528
- content: isSubCreate ? t("messages.tryAgainFromInvoice") : t("messages.cardAuthFailed")
20529
- }
20530
- });
20531
- fireBugSnag({
20532
- error: getErrorMessages(error),
20533
- title: "StripeConfirmCardPayment - ERROR"
20562
+ type: LOADING,
20563
+ payload: false
20534
20564
  });
20535
- return;
20536
- } else {
20565
+ if (error) {
20566
+ notifyBugsnag(() => {
20567
+ // eslint-disable-next-line no-undef
20568
+ Bugsnag.notify(`Payment ${error}`, event => {
20569
+ var _error$response4, _error$response5, _error$response5$data, _error$response5$data2, _window$Pelcro8, _window$Pelcro8$site, _window$Pelcro9, _window$Pelcro9$user, _window$Pelcro10;
20570
+ event.addMetadata("MetaData", {
20571
+ name: error === null || error === void 0 ? void 0 : error.name,
20572
+ message: error === null || error === void 0 ? void 0 : error.message,
20573
+ type: error === null || error === void 0 ? void 0 : error.type,
20574
+ code: error === null || error === void 0 ? void 0 : error.code,
20575
+ status: error === null || error === void 0 ? void 0 : (_error$response4 = error.response) === null || _error$response4 === void 0 ? void 0 : _error$response4.status,
20576
+ error_message: error === null || error === void 0 ? void 0 : (_error$response5 = error.response) === null || _error$response5 === void 0 ? void 0 : (_error$response5$data = _error$response5.data) === null || _error$response5$data === void 0 ? void 0 : (_error$response5$data2 = _error$response5$data.error) === null || _error$response5$data2 === void 0 ? void 0 : _error$response5$data2.message,
20577
+ site: (_window$Pelcro8 = window.Pelcro) === null || _window$Pelcro8 === void 0 ? void 0 : (_window$Pelcro8$site = _window$Pelcro8.site) === null || _window$Pelcro8$site === void 0 ? void 0 : _window$Pelcro8$site.read(),
20578
+ user: (_window$Pelcro9 = window.Pelcro) === null || _window$Pelcro9 === void 0 ? void 0 : (_window$Pelcro9$user = _window$Pelcro9.user) === null || _window$Pelcro9$user === void 0 ? void 0 : _window$Pelcro9$user.read(),
20579
+ environment: (_window$Pelcro10 = window.Pelcro) === null || _window$Pelcro10 === void 0 ? void 0 : _window$Pelcro10.environment
20580
+ });
20581
+ });
20582
+ });
20583
+ onFailure(error);
20584
+ return dispatch({
20585
+ type: SHOW_ALERT,
20586
+ payload: {
20587
+ type: "error",
20588
+ content: getErrorMessages(error)
20589
+ }
20590
+ });
20591
+ }
20537
20592
  onSuccess(response);
20538
20593
  }
20539
- } else {
20594
+ } catch (error) {
20595
+ notifyBugsnag(() => {
20596
+ // eslint-disable-next-line no-undef
20597
+ Bugsnag.notify(`Payment ${error}`, event => {
20598
+ var _error$response6, _error$response6$data, _error$response6$data2, _window$Pelcro11, _window$Pelcro11$site, _window$Pelcro12, _window$Pelcro12$user, _window$Pelcro13;
20599
+ event.addMetadata("UnexpectedError", {
20600
+ message: error.message,
20601
+ stack: error.stack,
20602
+ error_message: error === null || error === void 0 ? void 0 : (_error$response6 = error.response) === null || _error$response6 === void 0 ? void 0 : (_error$response6$data = _error$response6.data) === null || _error$response6$data === void 0 ? void 0 : (_error$response6$data2 = _error$response6$data.error) === null || _error$response6$data2 === void 0 ? void 0 : _error$response6$data2.message,
20603
+ site: (_window$Pelcro11 = window.Pelcro) === null || _window$Pelcro11 === void 0 ? void 0 : (_window$Pelcro11$site = _window$Pelcro11.site) === null || _window$Pelcro11$site === void 0 ? void 0 : _window$Pelcro11$site.read(),
20604
+ user: (_window$Pelcro12 = window.Pelcro) === null || _window$Pelcro12 === void 0 ? void 0 : (_window$Pelcro12$user = _window$Pelcro12.user) === null || _window$Pelcro12$user === void 0 ? void 0 : _window$Pelcro12$user.read(),
20605
+ environment: (_window$Pelcro13 = window.Pelcro) === null || _window$Pelcro13 === void 0 ? void 0 : _window$Pelcro13.environment
20606
+ });
20607
+ });
20608
+ });
20540
20609
  dispatch({
20541
20610
  type: DISABLE_SUBMIT,
20542
20611
  payload: false
@@ -20545,22 +20614,14 @@ const PaymentMethodContainerWithoutStripe = _ref => {
20545
20614
  type: LOADING,
20546
20615
  payload: false
20547
20616
  });
20548
- if (error) {
20549
- onFailure(error);
20550
- dispatch({
20551
- type: SHOW_ALERT,
20552
- payload: {
20553
- type: "error",
20554
- content: getErrorMessages(error)
20555
- }
20556
- });
20557
- fireBugSnag({
20558
- error: getErrorMessages(error),
20559
- title: "StripeConfirmCardPayment - ERROR"
20560
- });
20561
- return;
20562
- }
20563
- onSuccess(response);
20617
+ onFailure(error);
20618
+ return dispatch({
20619
+ type: SHOW_ALERT,
20620
+ payload: {
20621
+ type: "error",
20622
+ content: t("messages.unexpectedError")
20623
+ }
20624
+ });
20564
20625
  }
20565
20626
  };
20566
20627
  const confirmStripeIntentSetup = (response, flow, paymentMethodId) => {
@@ -20871,7 +20932,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
20871
20932
  addressId: selectedAddressId,
20872
20933
  couponCode
20873
20934
  }, (err, orderResponse) => {
20874
- var _window$Pelcro2, _window$Pelcro2$user, _window$Pelcro2$user$;
20935
+ var _window$Pelcro14, _window$Pelcro14$user, _window$Pelcro14$user2;
20875
20936
  if (err) {
20876
20937
  toggleAuthenticationSuccessPendingView(false);
20877
20938
  dispatch({
@@ -20902,7 +20963,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
20902
20963
  });
20903
20964
  }
20904
20965
  window.Pelcro.user.refresh({
20905
- auth_token: (_window$Pelcro2 = window.Pelcro) === null || _window$Pelcro2 === void 0 ? void 0 : (_window$Pelcro2$user = _window$Pelcro2.user) === null || _window$Pelcro2$user === void 0 ? void 0 : (_window$Pelcro2$user$ = _window$Pelcro2$user.read()) === null || _window$Pelcro2$user$ === void 0 ? void 0 : _window$Pelcro2$user$.auth_token
20966
+ auth_token: (_window$Pelcro14 = window.Pelcro) === null || _window$Pelcro14 === void 0 ? void 0 : (_window$Pelcro14$user = _window$Pelcro14.user) === null || _window$Pelcro14$user === void 0 ? void 0 : (_window$Pelcro14$user2 = _window$Pelcro14$user.read()) === null || _window$Pelcro14$user2 === void 0 ? void 0 : _window$Pelcro14$user2.auth_token
20906
20967
  }, (err, res) => {
20907
20968
  dispatch({
20908
20969
  type: DISABLE_SUBMIT,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pelcro/react-pelcro-js",
3
3
  "description": "Pelcro's React UI Elements",
4
- "version": "3.26.0-beta.67",
4
+ "version": "3.26.0-beta.69",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",