@bunnyapp/components 1.7.0-beta.2 → 1.7.0-beta.3

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/cjs/index.js CHANGED
@@ -143,7 +143,7 @@ const useAllErrorFormats = () => {
143
143
  };
144
144
 
145
145
  // This will be replaced at build time by rollup-plugin-replace
146
- const PACKAGE_VERSION = '1.7.0-beta.1';
146
+ const PACKAGE_VERSION = '1.7.0-beta.2';
147
147
  const createRequestHeaders = (token) => {
148
148
  const headers = createClientDevHeaders({ token });
149
149
  // Add the components version header
@@ -19414,7 +19414,7 @@ var PaymentType;
19414
19414
  PaymentType["CHECKOUT_NO_PAYMENT"] = "CHECKOUT_NO_PAYMENT";
19415
19415
  })(PaymentType || (PaymentType = {}));
19416
19416
 
19417
- const handleAllErrorFormats$2 = common.useAllErrorFormats();
19417
+ const handleAllErrorFormats$3 = common.useAllErrorFormats();
19418
19418
  const showErrorNotification$6 = common.useErrorNotification();
19419
19419
  const useHandlePayment = ({ quote, invoice, onPaymentSuccess, onPaymentHoldSuccess, plugin, paymentHoldOptions, accountId, }) => {
19420
19420
  // Context
@@ -19436,7 +19436,7 @@ const useHandlePayment = ({ quote, invoice, onPaymentSuccess, onPaymentHoldSucce
19436
19436
  const { pay: payDemoPay, isPaying: isPayingDemoPay } = usePay$1({
19437
19437
  onPaymentSuccess: handlePaymentSuccess,
19438
19438
  onPaymentError: error => {
19439
- handleAllErrorFormats$2(error);
19439
+ handleAllErrorFormats$3(error);
19440
19440
  },
19441
19441
  quote: quote,
19442
19442
  invoice: invoice,
@@ -19445,7 +19445,7 @@ const useHandlePayment = ({ quote, invoice, onPaymentSuccess, onPaymentHoldSucce
19445
19445
  const { pay: payStripe, isPaying: isPayingStripe } = usePay({
19446
19446
  onPaymentSuccess: handlePaymentSuccess,
19447
19447
  onPaymentError: error => {
19448
- handleAllErrorFormats$2(error);
19448
+ handleAllErrorFormats$3(error);
19449
19449
  },
19450
19450
  quote: quote,
19451
19451
  invoice: invoice,
@@ -19457,7 +19457,7 @@ const useHandlePayment = ({ quote, invoice, onPaymentSuccess, onPaymentHoldSucce
19457
19457
  onPaymentHoldSuccess === null || onPaymentHoldSuccess === void 0 ? void 0 : onPaymentHoldSuccess(response);
19458
19458
  },
19459
19459
  onApproveHoldError: error => {
19460
- handleAllErrorFormats$2(error);
19460
+ handleAllErrorFormats$3(error);
19461
19461
  },
19462
19462
  });
19463
19463
  const { approveHold: approveHoldDemoPay, isApprovingHold: isApprovingHoldDemoPay } = useApproveHold$1({
@@ -19465,7 +19465,7 @@ const useHandlePayment = ({ quote, invoice, onPaymentSuccess, onPaymentHoldSucce
19465
19465
  onPaymentHoldSuccess === null || onPaymentHoldSuccess === void 0 ? void 0 : onPaymentHoldSuccess(response);
19466
19466
  },
19467
19467
  onApproveHoldError: error => {
19468
- handleAllErrorFormats$2(error);
19468
+ handleAllErrorFormats$3(error);
19469
19469
  },
19470
19470
  });
19471
19471
  // Mutations
@@ -19483,7 +19483,7 @@ const useHandlePayment = ({ quote, invoice, onPaymentSuccess, onPaymentHoldSucce
19483
19483
  onPaymentSuccess === null || onPaymentSuccess === void 0 ? void 0 : onPaymentSuccess({});
19484
19484
  },
19485
19485
  onError: error => {
19486
- handleAllErrorFormats$2(error);
19486
+ handleAllErrorFormats$3(error);
19487
19487
  },
19488
19488
  });
19489
19489
  const handleApproveHold = async (overridePaymentMethodId) => {
@@ -19626,7 +19626,7 @@ function useSave({ onSaveSuccess, onSaveError, accountId, }) {
19626
19626
  const useShowPaymentDetailsState = (isOpen = false) => react.useState(isOpen);
19627
19627
  const [ShowPaymentDetailsProvider, useShowPaymentDetails] = createStateContext(useShowPaymentDetailsState);
19628
19628
 
19629
- const handleAllErrorFormats$1 = common.useAllErrorFormats();
19629
+ const handleAllErrorFormats$2 = common.useAllErrorFormats();
19630
19630
  const showErrorNotification$5 = common.useErrorNotification();
19631
19631
  // Contexts
19632
19632
  const [FormattedAmountDueProvider, useFormattedAmountDue] = createValueContext();
@@ -19672,7 +19672,7 @@ function PaymentProvider({ children, accountId, quote, invoice, onPaymentSuccess
19672
19672
  });
19673
19673
  setShowPaymentMethodForm(false);
19674
19674
  },
19675
- onSaveError: handleAllErrorFormats$1,
19675
+ onSaveError: handleAllErrorFormats$2,
19676
19676
  accountId,
19677
19677
  });
19678
19678
  const { save: saveStripe, isSaving: isSavingStripe } = useSave({
@@ -19686,7 +19686,7 @@ function PaymentProvider({ children, accountId, quote, invoice, onPaymentSuccess
19686
19686
  });
19687
19687
  setShowPaymentMethodForm(false);
19688
19688
  },
19689
- onSaveError: handleAllErrorFormats$1,
19689
+ onSaveError: handleAllErrorFormats$2,
19690
19690
  accountId,
19691
19691
  });
19692
19692
  const pluginName = (_c = (_b = (_a = selectedPlugin === null || selectedPlugin === void 0 ? void 0 : selectedPlugin.components) === null || _a === void 0 ? void 0 : _a.frontend) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.name;
@@ -19851,7 +19851,7 @@ const DemoPayExpiry = ({ autoFocus, onChange, placeholder, value, }) => {
19851
19851
  };
19852
19852
 
19853
19853
  const { Text: Text$z } = antd.Typography;
19854
- const handleAllErrorFormats = common.useAllErrorFormats();
19854
+ const handleAllErrorFormats$1 = common.useAllErrorFormats();
19855
19855
  const TEST_CARD = '4242424242424242';
19856
19856
  const DemoPayForm = () => {
19857
19857
  // Context
@@ -19868,7 +19868,7 @@ const DemoPayForm = () => {
19868
19868
  onPaymentFormSubmit(cardDetails);
19869
19869
  }
19870
19870
  catch (error) {
19871
- handleAllErrorFormats(error);
19871
+ handleAllErrorFormats$1(error);
19872
19872
  }
19873
19873
  }
19874
19874
  function validateCardDetails() {
@@ -20493,6 +20493,7 @@ const useSigningPlugins = ({ apiHost, token, }) => {
20493
20493
  return filterSigningPlugins(plugins.data);
20494
20494
  };
20495
20495
 
20496
+ const handleAllErrorFormats = common.useAllErrorFormats();
20496
20497
  const QUOTE_ACCEPT = `
20497
20498
  mutation quoteAccept($name: String!, $title: String!, $poNumber: String, $taxNumber: String, $quoteId: ID) {
20498
20499
  quoteAccept(name: $name, title: $title, poNumber: $poNumber, taxNumber: $taxNumber, quoteId: $quoteId) {
@@ -20546,8 +20547,10 @@ const useSendAcceptQuote = ({ quoteId, apiHost, token, onQuoteAccepted, }) => {
20546
20547
  quoteId,
20547
20548
  };
20548
20549
  graphQLMutation(mutation, variables, (rsp) => {
20549
- if (rsp.errors)
20550
- console.log('rsp.errors', rsp.errors);
20550
+ if (rsp.errors) {
20551
+ handleAllErrorFormats(rsp.errors[0].message);
20552
+ setIsAccepting(false);
20553
+ }
20551
20554
  else {
20552
20555
  const { redirectUri, message, pluginShortName } = rsp.data.quoteSigningUrlCreate;
20553
20556
  if (redirectUri) {
@@ -20698,7 +20701,7 @@ const PandadocPollingModal = ({ isVisible, setVisible, id }) => {
20698
20701
  };
20699
20702
  graphQLMutation(mutation, variables, (rsp) => {
20700
20703
  if (rsp.errors)
20701
- handleAllErrorFormats(rsp.errors);
20704
+ handleAllErrorFormats(rsp.errors[0].message);
20702
20705
  else if (rsp.data.quotePollSigningUrl.status === 'document.sent') {
20703
20706
  setVisible(false);
20704
20707
  window.location.href = rsp.data.quotePollSigningUrl.redirectUri;
package/dist/esm/index.js CHANGED
@@ -141,7 +141,7 @@ const useAllErrorFormats = () => {
141
141
  };
142
142
 
143
143
  // This will be replaced at build time by rollup-plugin-replace
144
- const PACKAGE_VERSION = '1.7.0-beta.1';
144
+ const PACKAGE_VERSION = '1.7.0-beta.2';
145
145
  const createRequestHeaders = (token) => {
146
146
  const headers = createClientDevHeaders({ token });
147
147
  // Add the components version header
@@ -19412,7 +19412,7 @@ var PaymentType;
19412
19412
  PaymentType["CHECKOUT_NO_PAYMENT"] = "CHECKOUT_NO_PAYMENT";
19413
19413
  })(PaymentType || (PaymentType = {}));
19414
19414
 
19415
- const handleAllErrorFormats$2 = useAllErrorFormats$1();
19415
+ const handleAllErrorFormats$3 = useAllErrorFormats$1();
19416
19416
  const showErrorNotification$6 = useErrorNotification();
19417
19417
  const useHandlePayment = ({ quote, invoice, onPaymentSuccess, onPaymentHoldSuccess, plugin, paymentHoldOptions, accountId, }) => {
19418
19418
  // Context
@@ -19434,7 +19434,7 @@ const useHandlePayment = ({ quote, invoice, onPaymentSuccess, onPaymentHoldSucce
19434
19434
  const { pay: payDemoPay, isPaying: isPayingDemoPay } = usePay$1({
19435
19435
  onPaymentSuccess: handlePaymentSuccess,
19436
19436
  onPaymentError: error => {
19437
- handleAllErrorFormats$2(error);
19437
+ handleAllErrorFormats$3(error);
19438
19438
  },
19439
19439
  quote: quote,
19440
19440
  invoice: invoice,
@@ -19443,7 +19443,7 @@ const useHandlePayment = ({ quote, invoice, onPaymentSuccess, onPaymentHoldSucce
19443
19443
  const { pay: payStripe, isPaying: isPayingStripe } = usePay({
19444
19444
  onPaymentSuccess: handlePaymentSuccess,
19445
19445
  onPaymentError: error => {
19446
- handleAllErrorFormats$2(error);
19446
+ handleAllErrorFormats$3(error);
19447
19447
  },
19448
19448
  quote: quote,
19449
19449
  invoice: invoice,
@@ -19455,7 +19455,7 @@ const useHandlePayment = ({ quote, invoice, onPaymentSuccess, onPaymentHoldSucce
19455
19455
  onPaymentHoldSuccess === null || onPaymentHoldSuccess === void 0 ? void 0 : onPaymentHoldSuccess(response);
19456
19456
  },
19457
19457
  onApproveHoldError: error => {
19458
- handleAllErrorFormats$2(error);
19458
+ handleAllErrorFormats$3(error);
19459
19459
  },
19460
19460
  });
19461
19461
  const { approveHold: approveHoldDemoPay, isApprovingHold: isApprovingHoldDemoPay } = useApproveHold$1({
@@ -19463,7 +19463,7 @@ const useHandlePayment = ({ quote, invoice, onPaymentSuccess, onPaymentHoldSucce
19463
19463
  onPaymentHoldSuccess === null || onPaymentHoldSuccess === void 0 ? void 0 : onPaymentHoldSuccess(response);
19464
19464
  },
19465
19465
  onApproveHoldError: error => {
19466
- handleAllErrorFormats$2(error);
19466
+ handleAllErrorFormats$3(error);
19467
19467
  },
19468
19468
  });
19469
19469
  // Mutations
@@ -19481,7 +19481,7 @@ const useHandlePayment = ({ quote, invoice, onPaymentSuccess, onPaymentHoldSucce
19481
19481
  onPaymentSuccess === null || onPaymentSuccess === void 0 ? void 0 : onPaymentSuccess({});
19482
19482
  },
19483
19483
  onError: error => {
19484
- handleAllErrorFormats$2(error);
19484
+ handleAllErrorFormats$3(error);
19485
19485
  },
19486
19486
  });
19487
19487
  const handleApproveHold = async (overridePaymentMethodId) => {
@@ -19624,7 +19624,7 @@ function useSave({ onSaveSuccess, onSaveError, accountId, }) {
19624
19624
  const useShowPaymentDetailsState = (isOpen = false) => useState(isOpen);
19625
19625
  const [ShowPaymentDetailsProvider, useShowPaymentDetails] = createStateContext(useShowPaymentDetailsState);
19626
19626
 
19627
- const handleAllErrorFormats$1 = useAllErrorFormats$1();
19627
+ const handleAllErrorFormats$2 = useAllErrorFormats$1();
19628
19628
  const showErrorNotification$5 = useErrorNotification();
19629
19629
  // Contexts
19630
19630
  const [FormattedAmountDueProvider, useFormattedAmountDue] = createValueContext();
@@ -19670,7 +19670,7 @@ function PaymentProvider({ children, accountId, quote, invoice, onPaymentSuccess
19670
19670
  });
19671
19671
  setShowPaymentMethodForm(false);
19672
19672
  },
19673
- onSaveError: handleAllErrorFormats$1,
19673
+ onSaveError: handleAllErrorFormats$2,
19674
19674
  accountId,
19675
19675
  });
19676
19676
  const { save: saveStripe, isSaving: isSavingStripe } = useSave({
@@ -19684,7 +19684,7 @@ function PaymentProvider({ children, accountId, quote, invoice, onPaymentSuccess
19684
19684
  });
19685
19685
  setShowPaymentMethodForm(false);
19686
19686
  },
19687
- onSaveError: handleAllErrorFormats$1,
19687
+ onSaveError: handleAllErrorFormats$2,
19688
19688
  accountId,
19689
19689
  });
19690
19690
  const pluginName = (_c = (_b = (_a = selectedPlugin === null || selectedPlugin === void 0 ? void 0 : selectedPlugin.components) === null || _a === void 0 ? void 0 : _a.frontend) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.name;
@@ -19849,7 +19849,7 @@ const DemoPayExpiry = ({ autoFocus, onChange, placeholder, value, }) => {
19849
19849
  };
19850
19850
 
19851
19851
  const { Text: Text$z } = Typography;
19852
- const handleAllErrorFormats = useAllErrorFormats$1();
19852
+ const handleAllErrorFormats$1 = useAllErrorFormats$1();
19853
19853
  const TEST_CARD = '4242424242424242';
19854
19854
  const DemoPayForm = () => {
19855
19855
  // Context
@@ -19866,7 +19866,7 @@ const DemoPayForm = () => {
19866
19866
  onPaymentFormSubmit(cardDetails);
19867
19867
  }
19868
19868
  catch (error) {
19869
- handleAllErrorFormats(error);
19869
+ handleAllErrorFormats$1(error);
19870
19870
  }
19871
19871
  }
19872
19872
  function validateCardDetails() {
@@ -20491,6 +20491,7 @@ const useSigningPlugins = ({ apiHost, token, }) => {
20491
20491
  return filterSigningPlugins(plugins.data);
20492
20492
  };
20493
20493
 
20494
+ const handleAllErrorFormats = useAllErrorFormats$1();
20494
20495
  const QUOTE_ACCEPT = `
20495
20496
  mutation quoteAccept($name: String!, $title: String!, $poNumber: String, $taxNumber: String, $quoteId: ID) {
20496
20497
  quoteAccept(name: $name, title: $title, poNumber: $poNumber, taxNumber: $taxNumber, quoteId: $quoteId) {
@@ -20544,8 +20545,10 @@ const useSendAcceptQuote = ({ quoteId, apiHost, token, onQuoteAccepted, }) => {
20544
20545
  quoteId,
20545
20546
  };
20546
20547
  graphQLMutation(mutation, variables, (rsp) => {
20547
- if (rsp.errors)
20548
- console.log('rsp.errors', rsp.errors);
20548
+ if (rsp.errors) {
20549
+ handleAllErrorFormats(rsp.errors[0].message);
20550
+ setIsAccepting(false);
20551
+ }
20549
20552
  else {
20550
20553
  const { redirectUri, message, pluginShortName } = rsp.data.quoteSigningUrlCreate;
20551
20554
  if (redirectUri) {
@@ -20696,7 +20699,7 @@ const PandadocPollingModal = ({ isVisible, setVisible, id }) => {
20696
20699
  };
20697
20700
  graphQLMutation(mutation, variables, (rsp) => {
20698
20701
  if (rsp.errors)
20699
- handleAllErrorFormats(rsp.errors);
20702
+ handleAllErrorFormats(rsp.errors[0].message);
20700
20703
  else if (rsp.data.quotePollSigningUrl.status === 'document.sent') {
20701
20704
  setVisible(false);
20702
20705
  window.location.href = rsp.data.quotePollSigningUrl.redirectUri;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bunnyapp/components",
3
- "version": "1.7.0-beta.2",
3
+ "version": "1.7.0-beta.3",
4
4
  "description": "Components from the Bunny portal to embed Bunny UI functionality into your application.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",