@bunnyapp/components 1.0.55 → 1.0.56

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.
Files changed (50) hide show
  1. package/dist/cjs/index.js +41 -30
  2. package/dist/cjs/src/components/BunnyProvider.d.ts +2 -2
  3. package/dist/cjs/src/components/Checkout/Checkout.d.ts +1 -1
  4. package/dist/cjs/src/components/Checkout/QuoteCheckout.d.ts +1 -1
  5. package/dist/cjs/src/components/PaymentForm/PaymentForm.d.ts +2 -1
  6. package/dist/cjs/src/components/PaymentForm/PaymentFormTypes.d.ts +1 -1
  7. package/dist/cjs/src/components/PaymentForm/useRemovePaymentMethod.d.ts +1 -1
  8. package/dist/cjs/src/components/Quote/Quote.stories.d.ts +10 -10
  9. package/dist/cjs/src/components/Subscriptions/SubscriptionRequests.d.ts +2 -2
  10. package/dist/cjs/src/graphql/QuoteRequests.d.ts +3 -3
  11. package/dist/cjs/src/graphql/mutations/quoteChargeCreate.d.ts +1 -1
  12. package/dist/cjs/src/graphql/mutations/quoteCompose.d.ts +1 -1
  13. package/dist/cjs/src/graphql/mutations/quoteRecalculateTaxes.d.ts +2 -2
  14. package/dist/cjs/src/graphql/queries/getPriceListChangeOptions.d.ts +1 -1
  15. package/dist/cjs/src/graphql/queries/getTaxationRequiredAccountFields.d.ts +2 -2
  16. package/dist/cjs/src/hooks/quotes/useSendAcceptQuote.d.ts +1 -1
  17. package/dist/cjs/src/hooks/quotes/useSigningComplete.d.ts +1 -1
  18. package/dist/cjs/src/hooks/useHasTaxPlugin.d.ts +1 -1
  19. package/dist/cjs/src/hooks/usePaymentMethod.d.ts +1 -1
  20. package/dist/cjs/src/hooks/usePaymentPlugins.d.ts +1 -1
  21. package/dist/cjs/src/hooks/usePlugins.d.ts +2 -2
  22. package/dist/cjs/src/hooks/useSigningPlugins.d.ts +1 -1
  23. package/dist/cjs/src/hooks/useToken.d.ts +1 -1
  24. package/dist/cjs/src/utils/apiUtils.d.ts +1 -1
  25. package/dist/esm/index.js +41 -30
  26. package/dist/esm/src/components/BunnyProvider.d.ts +2 -2
  27. package/dist/esm/src/components/Checkout/Checkout.d.ts +1 -1
  28. package/dist/esm/src/components/Checkout/QuoteCheckout.d.ts +1 -1
  29. package/dist/esm/src/components/PaymentForm/PaymentForm.d.ts +2 -1
  30. package/dist/esm/src/components/PaymentForm/PaymentFormTypes.d.ts +1 -1
  31. package/dist/esm/src/components/PaymentForm/useRemovePaymentMethod.d.ts +1 -1
  32. package/dist/esm/src/components/Quote/Quote.stories.d.ts +10 -10
  33. package/dist/esm/src/components/Subscriptions/SubscriptionRequests.d.ts +2 -2
  34. package/dist/esm/src/graphql/QuoteRequests.d.ts +3 -3
  35. package/dist/esm/src/graphql/mutations/quoteChargeCreate.d.ts +1 -1
  36. package/dist/esm/src/graphql/mutations/quoteCompose.d.ts +1 -1
  37. package/dist/esm/src/graphql/mutations/quoteRecalculateTaxes.d.ts +2 -2
  38. package/dist/esm/src/graphql/queries/getPriceListChangeOptions.d.ts +1 -1
  39. package/dist/esm/src/graphql/queries/getTaxationRequiredAccountFields.d.ts +2 -2
  40. package/dist/esm/src/hooks/quotes/useSendAcceptQuote.d.ts +1 -1
  41. package/dist/esm/src/hooks/quotes/useSigningComplete.d.ts +1 -1
  42. package/dist/esm/src/hooks/useHasTaxPlugin.d.ts +1 -1
  43. package/dist/esm/src/hooks/usePaymentMethod.d.ts +1 -1
  44. package/dist/esm/src/hooks/usePaymentPlugins.d.ts +1 -1
  45. package/dist/esm/src/hooks/usePlugins.d.ts +2 -2
  46. package/dist/esm/src/hooks/useSigningPlugins.d.ts +1 -1
  47. package/dist/esm/src/hooks/useToken.d.ts +1 -1
  48. package/dist/esm/src/utils/apiUtils.d.ts +1 -1
  49. package/dist/index.d.ts +3 -2
  50. package/package.json +1 -1
package/dist/cjs/index.js CHANGED
@@ -470,7 +470,7 @@ var usePaymentMethod = function (_a) {
470
470
  var usePlugins = function (_a) {
471
471
  var apiHost = _a.apiHost, token = _a.token;
472
472
  var response = reactQuery.useQuery({
473
- queryKey: common.QueryKeyFactory.default.pluginsKey(token),
473
+ queryKey: common.QueryKeyFactory.default.pluginsKey(token || ""),
474
474
  queryFn: function () { return __awaiter(void 0, void 0, void 0, function () {
475
475
  var plugins;
476
476
  return __generator(this, function (_a) {
@@ -1385,7 +1385,7 @@ var PaymentOptionContainer = defaultStyled.div(templateObject_1$9 || (templateOb
1385
1385
  });
1386
1386
  var templateObject_1$9;
1387
1387
 
1388
- function useRemovePaymentMethod(paymentPlugins, apiHost, token, accountId) {
1388
+ function useRemovePaymentMethod(paymentPlugins, apiHost, token, accountId, onRemovePaymentMethod) {
1389
1389
  var _this = this;
1390
1390
  var queryClient = reactQuery.useQueryClient();
1391
1391
  var showErrorNotification = common.useErrorNotification();
@@ -1413,6 +1413,7 @@ function useRemovePaymentMethod(paymentPlugins, apiHost, token, accountId) {
1413
1413
  token: token,
1414
1414
  accountId: accountId,
1415
1415
  }), null);
1416
+ onRemovePaymentMethod === null || onRemovePaymentMethod === void 0 ? void 0 : onRemovePaymentMethod();
1416
1417
  })
1417
1418
  .catch(function (error) {
1418
1419
  showErrorNotification(error.message, "Error removing payment method");
@@ -1430,7 +1431,7 @@ function useRemovePaymentMethod(paymentPlugins, apiHost, token, accountId) {
1430
1431
  var Panel = antd.Collapse.Panel;
1431
1432
  var PaymentForm = function (_a) {
1432
1433
  var _b;
1433
- var invoice = _a.invoice, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, quote = _a.quote, accountId = _a.accountId, onSavePaymentMethod = _a.onSavePaymentMethod, overrideToken = _a.overrideToken, graphQLClient = _a.graphQLClient, customCheckoutFunction = _a.customCheckoutFunction, currencyIdFromProps = _a.currencyId, customPaymentForms = _a.customPaymentForms, _c = _a.useAllPaymentPlugins, useAllPaymentPlugins = _c === void 0 ? false : _c;
1434
+ var invoice = _a.invoice, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, quote = _a.quote, accountId = _a.accountId, onSavePaymentMethod = _a.onSavePaymentMethod, onRemovePaymentMethod = _a.onRemovePaymentMethod, overrideToken = _a.overrideToken, graphQLClient = _a.graphQLClient, customCheckoutFunction = _a.customCheckoutFunction, currencyIdFromProps = _a.currencyId, customPaymentForms = _a.customPaymentForms, _c = _a.useAllPaymentPlugins, useAllPaymentPlugins = _c === void 0 ? false : _c;
1434
1435
  // Local state
1435
1436
  var _d = react.useState(), selectedPaymentMethod = _d[0], setSelectedPaymentMethod = _d[1];
1436
1437
  var _e = react.useState(false), showPaymentMethodForm = _e[0], setShowPaymentMethodForm = _e[1];
@@ -1455,7 +1456,7 @@ var PaymentForm = function (_a) {
1455
1456
  }
1456
1457
  return allPaymentMethodAllowedPlugins;
1457
1458
  }, [allPaymentMethodAllowedPlugins, allPaymentPlugins, useAllPaymentPlugins]);
1458
- var onClickRemove = useRemovePaymentMethod(paymentMethodAllowedPlugins || [], apiHost, token, accountId);
1459
+ var onClickRemove = useRemovePaymentMethod(paymentMethodAllowedPlugins || [], apiHost, token, accountId, onRemovePaymentMethod);
1459
1460
  var queryClient = reactQuery.useQueryClient();
1460
1461
  // Set default plugin
1461
1462
  react.useEffect(function () {
@@ -19923,18 +19924,20 @@ function Signup(_a) {
19923
19924
  }
19924
19925
 
19925
19926
  var createRequestHeaders = function (token) {
19926
- var bearerToken = "Bearer ".concat(token);
19927
+ var bearerToken = token ? "Bearer ".concat(token) : null;
19927
19928
  var headers = {
19928
19929
  "Content-type": "application/json; charset=utf-8",
19929
19930
  };
19930
- headers["Authorization"] = bearerToken;
19931
+ if (bearerToken) {
19932
+ headers["Authorization"] = bearerToken;
19933
+ }
19931
19934
  return headers;
19932
19935
  };
19933
19936
  var getGraphQLBaseURL = function (apiHost) {
19934
19937
  return "".concat(apiHost, "/graphql");
19935
19938
  };
19936
19939
  var useGraphQLRequest = function () {
19937
- return function (query, token, apiHost, variables) { return __awaiter(void 0, void 0, void 0, function () {
19940
+ return function (query, apiHost, token, variables) { return __awaiter(void 0, void 0, void 0, function () {
19938
19941
  var error_1;
19939
19942
  return __generator(this, function (_a) {
19940
19943
  switch (_a.label) {
@@ -19953,11 +19956,11 @@ var useGraphQLRequest = function () {
19953
19956
 
19954
19957
  var useCreateSubscriptionQuote = function () {
19955
19958
  var graphQLRequest = useGraphQLRequest();
19956
- return function (subscriptionIds, token, apiHost) { return __awaiter(void 0, void 0, void 0, function () {
19959
+ return function (subscriptionIds, apiHost, token) { return __awaiter(void 0, void 0, void 0, function () {
19957
19960
  var data;
19958
19961
  return __generator(this, function (_a) {
19959
19962
  switch (_a.label) {
19960
- case 0: return [4 /*yield*/, graphQLRequest("\n mutation quoteSubscriptionUpdate(\n $subscriptionIds: [ID!]!,\n ) {\n quoteSubscriptionUpdate(\n subscriptionIds: $subscriptionIds,\n ) {\n quote {\n id\n quoteChanges {\n id\n priceList {\n id\n }\n subscription {\n charges {\n startDate\n endDate\n id\n priceListCharge {\n id\n }\n }\n }\n }\n }\n }\n }\n ", token, apiHost, {
19963
+ case 0: return [4 /*yield*/, graphQLRequest("\n mutation quoteSubscriptionUpdate(\n $subscriptionIds: [ID!]!,\n ) {\n quoteSubscriptionUpdate(\n subscriptionIds: $subscriptionIds,\n ) {\n quote {\n id\n quoteChanges {\n id\n priceList {\n id\n }\n subscription {\n charges {\n startDate\n endDate\n id\n priceListCharge {\n id\n }\n }\n }\n }\n }\n }\n }\n ", apiHost, token, {
19961
19964
  subscriptionIds: subscriptionIds,
19962
19965
  })];
19963
19966
  case 1:
@@ -19969,11 +19972,11 @@ var useCreateSubscriptionQuote = function () {
19969
19972
  };
19970
19973
  var useQuoteChangeUpdate = function () {
19971
19974
  var graphQLRequest = useGraphQLRequest();
19972
- return function (charges, quoteChangeId, token, apiHost) { return __awaiter(void 0, void 0, void 0, function () {
19975
+ return function (charges, quoteChangeId, apiHost, token) { return __awaiter(void 0, void 0, void 0, function () {
19973
19976
  var response;
19974
19977
  return __generator(this, function (_a) {
19975
19978
  switch (_a.label) {
19976
- case 0: return [4 /*yield*/, graphQLRequest("mutation QuoteChangeUpdate($charges:[QuoteChargeAttributes!], $id:ID!) {\n quoteChangeUpdate(id:$id, charges:$charges) {\n quoteChange { id quoteId }\n errors\n }\n }", token, apiHost, { charges: charges, id: quoteChangeId })];
19979
+ case 0: return [4 /*yield*/, graphQLRequest("mutation QuoteChangeUpdate($charges:[QuoteChargeAttributes!], $id:ID!) {\n quoteChangeUpdate(id:$id, charges:$charges) {\n quoteChange { id quoteId }\n errors\n }\n }", apiHost, token, { charges: charges, id: quoteChangeId })];
19977
19980
  case 1:
19978
19981
  response = _a.sent();
19979
19982
  return [2 /*return*/, response];
@@ -19983,11 +19986,11 @@ var useQuoteChangeUpdate = function () {
19983
19986
  };
19984
19987
  var useQuoteDelete = function () {
19985
19988
  var graphQLRequest = useGraphQLRequest();
19986
- return function (quoteId, token, apiHost) { return __awaiter(void 0, void 0, void 0, function () {
19989
+ return function (quoteId, apiHost, token) { return __awaiter(void 0, void 0, void 0, function () {
19987
19990
  var response;
19988
19991
  return __generator(this, function (_a) {
19989
19992
  switch (_a.label) {
19990
- case 0: return [4 /*yield*/, graphQLRequest("mutation QuoteDelete($id: ID!) {\n quoteDelete(id: $id) {\n errors\n }\n }", token, apiHost, { id: quoteId })];
19993
+ case 0: return [4 /*yield*/, graphQLRequest("mutation QuoteDelete($id: ID!) {\n quoteDelete(id: $id) {\n errors\n }\n }", apiHost, token, { id: quoteId })];
19991
19994
  case 1:
19992
19995
  response = _a.sent();
19993
19996
  return [2 /*return*/, response];
@@ -20073,7 +20076,7 @@ var quoteCompose = function (_a) {
20073
20076
 
20074
20077
  var QUOTE_RECALCULATE_TAXES = "\n mutation QuoteRecalculateTaxes($id: ID!) {\n quoteRecalculateTaxes(id: $id) {\n ".concat(QUOTE_FIELDS, "\n errors\n }\n }\n");
20075
20078
  var quoteRecalculateTaxes = function (_a) {
20076
- var quoteId = _a.quoteId, token = _a.token, apiHost = _a.apiHost;
20079
+ var quoteId = _a.quoteId, apiHost = _a.apiHost, token = _a.token;
20077
20080
  return __awaiter(void 0, void 0, void 0, function () {
20078
20081
  var vars, response, errors;
20079
20082
  var _b, _c;
@@ -20100,7 +20103,7 @@ var quoteRecalculateTaxes = function (_a) {
20100
20103
 
20101
20104
  var MUTATION$2 = "{\n currentUser {\n taxationRequiredAccountFields\n }\n}";
20102
20105
  var getTaxationRequiredAccountFields = function (_a) {
20103
- var token = _a.token, apiHost = _a.apiHost;
20106
+ var apiHost = _a.apiHost, token = _a.token;
20104
20107
  return __awaiter(void 0, void 0, void 0, function () {
20105
20108
  var response;
20106
20109
  var _b, _c;
@@ -20296,14 +20299,14 @@ var Checkout = function (_a) {
20296
20299
  // Queries
20297
20300
  var _f = reactQuery.useQuery({
20298
20301
  queryKey: ["getTaxationRequiredAccountFields", token],
20299
- queryFn: function () { return getTaxationRequiredAccountFields({ token: token, apiHost: apiHost }); },
20302
+ queryFn: function () { return getTaxationRequiredAccountFields({ apiHost: apiHost, token: token }); },
20300
20303
  enabled: Boolean(quote),
20301
20304
  staleTime: 0,
20302
20305
  }), taxationRequiredAccountFields = _f.data, isLoadingTaxationRequiredAccountFields = _f.isLoading;
20303
20306
  var _g = reactQuery.useQuery({
20304
20307
  queryKey: ["account", quote === null || quote === void 0 ? void 0 : quote.accountId],
20305
20308
  queryFn: function () {
20306
- return (quote === null || quote === void 0 ? void 0 : quote.accountId) && common.getAccount({ id: quote.accountId, token: token, apiHost: apiHost });
20309
+ return (quote === null || quote === void 0 ? void 0 : quote.accountId) && common.getAccount({ id: quote.accountId, apiHost: apiHost, token: token });
20307
20310
  },
20308
20311
  enabled: Boolean(quote === null || quote === void 0 ? void 0 : quote.accountId) &&
20309
20312
  ((taxationRequiredAccountFields === null || taxationRequiredAccountFields === void 0 ? void 0 : taxationRequiredAccountFields.length) || 0) > 0,
@@ -20321,8 +20324,8 @@ var Checkout = function (_a) {
20321
20324
  if (!quote) return [3 /*break*/, 2];
20322
20325
  return [4 /*yield*/, quoteRecalculateTaxes({
20323
20326
  quoteId: quote.id,
20324
- token: token,
20325
20327
  apiHost: apiHost,
20328
+ token: token,
20326
20329
  })];
20327
20330
  case 1:
20328
20331
  updatedQuote = _a.sent();
@@ -21452,12 +21455,12 @@ var PlanManager = function (_a) {
21452
21455
 
21453
21456
  var useCancelSubscription = function () {
21454
21457
  var graphQLRequest = useGraphQLRequest();
21455
- return function (subscriptionIds, token, apiHost) { return __awaiter(void 0, void 0, void 0, function () {
21458
+ return function (subscriptionIds, apiHost, token) { return __awaiter(void 0, void 0, void 0, function () {
21456
21459
  var data;
21457
21460
  var _a;
21458
21461
  return __generator(this, function (_b) {
21459
21462
  switch (_b.label) {
21460
- case 0: return [4 /*yield*/, graphQLRequest("\n mutation SubscriptionCancel($subscriptionIds: [ID!]!) {\n subscriptionCancel(ids: $subscriptionIds) {\n subscriptions {\n accountId\n state\n }\n }\n }", token, apiHost, { subscriptionIds: subscriptionIds })];
21463
+ case 0: return [4 /*yield*/, graphQLRequest("\n mutation SubscriptionCancel($subscriptionIds: [ID!]!) {\n subscriptionCancel(ids: $subscriptionIds) {\n subscriptions {\n accountId\n state\n }\n }\n }", apiHost, token, { subscriptionIds: subscriptionIds })];
21461
21464
  case 1:
21462
21465
  data = _b.sent();
21463
21466
  return [2 /*return*/, (_a = data === null || data === void 0 ? void 0 : data.subscriptions) === null || _a === void 0 ? void 0 : _a.nodes];
@@ -21914,7 +21917,7 @@ var SubscriptionsListContainer = function (_a) {
21914
21917
  // Queries
21915
21918
  var _c = reactQuery.useQuery({
21916
21919
  queryKey: common.QueryKeyFactory.default.planChangeOptionsKey({ token: token }),
21917
- queryFn: function () { return getPriceListChangeOptions({ token: token, apiHost: apiHost }); },
21920
+ queryFn: function () { return getPriceListChangeOptions({ apiHost: apiHost, token: token }); },
21918
21921
  enabled: Boolean(onChangePlanClick),
21919
21922
  }), priceListChangeOptions = _c.data, arePriceListChangeOptionsLoading = _c.isLoading;
21920
21923
  if (subscriptionsAreLoading ||
@@ -21962,14 +21965,17 @@ var QuantityInput = function (_a) {
21962
21965
  (updatingChargeQuantityId && updatingChargeQuantityId !== charge.id) ||
21963
21966
  // If the subscription is not self-service, we disable the quantity input
21964
21967
  !charge.selfServiceQuantity;
21965
- var value = (editedSubscription === null || editedSubscription === void 0 ? void 0 : editedSubscription.quantity) === undefined ? "" : editedSubscription.quantity;
21968
+ var value = (editedSubscription === null || editedSubscription === void 0 ? void 0 : editedSubscription.quantity) === undefined
21969
+ ? ""
21970
+ : editedSubscription.quantity;
21966
21971
  // Mutations
21967
21972
  var createCharge = reactQuery.useMutation({
21968
21973
  mutationFn: quoteChargeCreate,
21969
21974
  onSuccess: function (response) {
21970
21975
  var _a, _b, _c, _d, _e, _f, _g, _h;
21971
21976
  if (!(editingQuote === null || editingQuote === void 0 ? void 0 : editingQuote.id)) {
21972
- var isTrial = ((_b = (_a = editedSubscription === null || editedSubscription === void 0 ? void 0 : editedSubscription.subscription) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === common.SubscriptionState.TRIAL;
21977
+ var isTrial = ((_b = (_a = editedSubscription === null || editedSubscription === void 0 ? void 0 : editedSubscription.subscription) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) ===
21978
+ common.SubscriptionState.TRIAL;
21973
21979
  setEditingQuoteData({
21974
21980
  id: (_e = (_d = (_c = response.quoteChargeCreate) === null || _c === void 0 ? void 0 : _c.quoteCharge) === null || _d === void 0 ? void 0 : _d.quoteChange) === null || _e === void 0 ? void 0 : _e.quoteId,
21975
21981
  isTrial: isTrial,
@@ -21986,12 +21992,15 @@ var QuantityInput = function (_a) {
21986
21992
  }).mutate;
21987
21993
  var createQuote = reactQuery.useMutation({
21988
21994
  mutationFn: function (subscriptionIds) {
21989
- return createSubscriptionQuote(subscriptionIds, token, apiHost);
21995
+ return createSubscriptionQuote(subscriptionIds, apiHost, token);
21990
21996
  },
21991
21997
  onSuccess: function (subscriptionUpdateData) {
21992
21998
  var _a, _b;
21993
21999
  var quote = (_a = subscriptionUpdateData === null || subscriptionUpdateData === void 0 ? void 0 : subscriptionUpdateData.quoteSubscriptionUpdate) === null || _a === void 0 ? void 0 : _a.quote;
21994
- var quoteChange = quote.quoteChanges.find(function (quoteChange) { return quoteChange.priceList.id === (editedSubscription === null || editedSubscription === void 0 ? void 0 : editedSubscription.subscription.priceList.id); });
22000
+ var quoteChange = quote.quoteChanges.find(function (quoteChange) {
22001
+ return quoteChange.priceList.id ===
22002
+ (editedSubscription === null || editedSubscription === void 0 ? void 0 : editedSubscription.subscription.priceList.id);
22003
+ });
21995
22004
  var subscriptionCharge = (_b = quoteChange === null || quoteChange === void 0 ? void 0 : quoteChange.subscription) === null || _b === void 0 ? void 0 : _b.charges.find(function (charge) { var _a; return ((_a = charge === null || charge === void 0 ? void 0 : charge.priceListCharge) === null || _a === void 0 ? void 0 : _a.id) === (editedSubscription === null || editedSubscription === void 0 ? void 0 : editedSubscription.chargeId); });
21996
22005
  if (subscriptionCharge && quoteChange && editedSubscription) {
21997
22006
  createCharge({
@@ -22009,12 +22018,13 @@ var QuantityInput = function (_a) {
22009
22018
  var updateQuote = reactQuery.useMutation({
22010
22019
  mutationFn: function (_a) {
22011
22020
  var charges = _a.charges, quoteChangeId = _a.quoteChangeId;
22012
- return quoteChangeUpdate(charges, quoteChangeId, token, apiHost);
22021
+ return quoteChangeUpdate(charges, quoteChangeId, apiHost, token);
22013
22022
  },
22014
22023
  onSuccess: function (response) {
22015
22024
  var _a, _b, _c, _d, _e, _f;
22016
22025
  if (!(editingQuote === null || editingQuote === void 0 ? void 0 : editingQuote.id)) {
22017
- var isTrial = ((_b = (_a = editedSubscription === null || editedSubscription === void 0 ? void 0 : editedSubscription.subscription) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === common.SubscriptionState.TRIAL;
22026
+ var isTrial = ((_b = (_a = editedSubscription === null || editedSubscription === void 0 ? void 0 : editedSubscription.subscription) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) ===
22027
+ common.SubscriptionState.TRIAL;
22018
22028
  setEditingQuoteData({
22019
22029
  id: (_d = (_c = response.quoteChangeUpdate) === null || _c === void 0 ? void 0 : _c.quoteChange) === null || _d === void 0 ? void 0 : _d.quoteId,
22020
22030
  isTrial: isTrial,
@@ -22031,7 +22041,8 @@ var QuantityInput = function (_a) {
22031
22041
  });
22032
22042
  // Handlers
22033
22043
  var isQuantityLowerThanOriginal = function (quantity) {
22034
- return (editedSubscription === null || editedSubscription === void 0 ? void 0 : editedSubscription.quantity) !== undefined && editedSubscription.quantity <= quantity;
22044
+ return (editedSubscription === null || editedSubscription === void 0 ? void 0 : editedSubscription.quantity) !== undefined &&
22045
+ editedSubscription.quantity <= quantity;
22035
22046
  };
22036
22047
  var onChangeQuantity = function (chargeIndex, value, priceListChargeId, subscription, subscriptionIndex) {
22037
22048
  var quantity = isNaN(parseInt(value)) ? 0 : parseInt(value);
@@ -22312,7 +22323,7 @@ var Subscriptions = function (_a) {
22312
22323
  // Mutations
22313
22324
  var subscriptionCancel = reactQuery.useMutation({
22314
22325
  mutationFn: function (subscription) {
22315
- return cancelSubscription([subscription.id], token, apiHost);
22326
+ return cancelSubscription([subscription.id], apiHost, token);
22316
22327
  },
22317
22328
  onSuccess: function () {
22318
22329
  queryClient.invalidateQueries({
@@ -22363,7 +22374,7 @@ var Subscriptions = function (_a) {
22363
22374
  };
22364
22375
  var onClose = function () {
22365
22376
  if (editingQuoteData) {
22366
- quoteDelete(editingQuoteData.id, token, apiHost);
22377
+ quoteDelete(editingQuoteData.id, apiHost, token);
22367
22378
  setEditingQuoteData(undefined);
22368
22379
  }
22369
22380
  if (updatingChargeQuantityId) {
@@ -5,7 +5,7 @@ import { GraphQLClient } from "graphql-request";
5
5
  export type BunnyContextValues = {
6
6
  apiHost: string;
7
7
  graphQLClient: GraphQLClient;
8
- token: string;
8
+ token?: string;
9
9
  displayPayButtonNameAnyways?: boolean;
10
10
  darkMode?: boolean;
11
11
  onTokenExpired?: () => void;
@@ -16,7 +16,7 @@ declare function BunnyProvider({ children, darkMode, queryClient, apiHost, token
16
16
  darkMode?: boolean;
17
17
  queryClient?: QueryClient;
18
18
  apiHost: string;
19
- token: string;
19
+ token?: string;
20
20
  onTokenExpired?: () => void;
21
21
  configProviderProps?: ThemeConfig | undefined;
22
22
  }): import("react/jsx-runtime").JSX.Element;
@@ -2,7 +2,7 @@ import { PaymentMethod } from "@bunnyapp/common";
2
2
  import { CheckoutProps } from "../PaymentForm/PaymentFormTypes";
3
3
  interface CheckoutComponentProps extends CheckoutProps {
4
4
  isMobile: boolean;
5
- token: string;
5
+ token?: string;
6
6
  storedPaymentMethod?: PaymentMethod;
7
7
  quantity?: number;
8
8
  }
@@ -4,7 +4,7 @@ interface QuoteCheckoutProps extends InvoiceQuoteParentProps {
4
4
  account: Account;
5
5
  quote: Quote;
6
6
  taxationRequiredAccountFields?: TaxationRequiredAccountFields | null;
7
- token: string;
7
+ token?: string;
8
8
  storedPaymentMethod?: PaymentMethod;
9
9
  }
10
10
  declare const QuoteCheckout: ({ account, onSuccess, onFail, quote, taxationRequiredAccountFields, }: QuoteCheckoutProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,12 +1,13 @@
1
1
  /// <reference types="react" />
2
2
  import { FormattedInvoice, PluginData, Quote } from "@bunnyapp/common";
3
3
  import { GraphQLClient } from "graphql-request";
4
- export declare const PaymentForm: ({ invoice, onFail, onPaymentSuccess, quote, accountId, onSavePaymentMethod, overrideToken, graphQLClient, customCheckoutFunction, currencyId: currencyIdFromProps, customPaymentForms, useAllPaymentPlugins, }: {
4
+ export declare const PaymentForm: ({ invoice, onFail, onPaymentSuccess, quote, accountId, onSavePaymentMethod, onRemovePaymentMethod, overrideToken, graphQLClient, customCheckoutFunction, currencyId: currencyIdFromProps, customPaymentForms, useAllPaymentPlugins, }: {
5
5
  invoice?: FormattedInvoice | undefined;
6
6
  quote?: Quote | undefined;
7
7
  onFail: (error: any) => void;
8
8
  onPaymentSuccess?: (() => void) | undefined;
9
9
  onSavePaymentMethod?: (() => void) | undefined;
10
+ onRemovePaymentMethod?: (() => void) | undefined;
10
11
  accountId?: string | undefined;
11
12
  overrideToken?: string | undefined;
12
13
  graphQLClient: GraphQLClient;
@@ -20,5 +20,5 @@ export type CheckoutProps = {
20
20
  open: boolean;
21
21
  quote?: Quote;
22
22
  selectedPriceList?: PriceList;
23
- token: string;
23
+ token?: string;
24
24
  };
@@ -1,3 +1,3 @@
1
1
  import { PluginData } from "@bunnyapp/common";
2
- declare function useRemovePaymentMethod(paymentPlugins: PluginData[], apiHost: string, token: string, accountId?: string): (data: any) => Promise<void>;
2
+ declare function useRemovePaymentMethod(paymentPlugins: PluginData[], apiHost: string, token?: string, accountId?: string, onRemovePaymentMethod?: () => void): (data: any) => Promise<void>;
3
3
  export default useRemovePaymentMethod;
@@ -18,12 +18,12 @@ export declare const Default: import("@storybook/core/csf").StoryAnnotations<imp
18
18
  onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
19
19
  }, {
20
20
  className?: string | undefined;
21
+ onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
21
22
  id?: string | undefined;
23
+ shadow?: import("../../types/shadowType").ShadowType | undefined;
22
24
  backButtonName?: string | undefined;
23
25
  onBackButtonClick?: (() => void) | undefined;
24
- shadow?: import("../../types/shadowType").ShadowType | undefined;
25
26
  hideDownloadButton?: boolean | undefined;
26
- onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
27
27
  invoiceQuoteViewComponent?: import("react").ReactNode;
28
28
  onInvoiceDownloadError?: (() => void) | undefined;
29
29
  onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
@@ -43,12 +43,12 @@ export declare const NoShadow: import("@storybook/core/csf").StoryAnnotations<im
43
43
  onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
44
44
  }, {
45
45
  className?: string | undefined;
46
+ onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
46
47
  id?: string | undefined;
48
+ shadow?: import("../../types/shadowType").ShadowType | undefined;
47
49
  backButtonName?: string | undefined;
48
50
  onBackButtonClick?: (() => void) | undefined;
49
- shadow?: import("../../types/shadowType").ShadowType | undefined;
50
51
  hideDownloadButton?: boolean | undefined;
51
- onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
52
52
  invoiceQuoteViewComponent?: import("react").ReactNode;
53
53
  onInvoiceDownloadError?: (() => void) | undefined;
54
54
  onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
@@ -68,12 +68,12 @@ export declare const Mobile: import("@storybook/core/csf").StoryAnnotations<impo
68
68
  onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
69
69
  }, {
70
70
  className?: string | undefined;
71
+ onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
71
72
  id?: string | undefined;
73
+ shadow?: import("../../types/shadowType").ShadowType | undefined;
72
74
  backButtonName?: string | undefined;
73
75
  onBackButtonClick?: (() => void) | undefined;
74
- shadow?: import("../../types/shadowType").ShadowType | undefined;
75
76
  hideDownloadButton?: boolean | undefined;
76
- onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
77
77
  invoiceQuoteViewComponent?: import("react").ReactNode;
78
78
  onInvoiceDownloadError?: (() => void) | undefined;
79
79
  onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
@@ -93,12 +93,12 @@ export declare const CustomClassName: import("@storybook/core/csf").StoryAnnotat
93
93
  onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
94
94
  }, {
95
95
  className?: string | undefined;
96
+ onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
96
97
  id?: string | undefined;
98
+ shadow?: import("../../types/shadowType").ShadowType | undefined;
97
99
  backButtonName?: string | undefined;
98
100
  onBackButtonClick?: (() => void) | undefined;
99
- shadow?: import("../../types/shadowType").ShadowType | undefined;
100
101
  hideDownloadButton?: boolean | undefined;
101
- onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
102
102
  invoiceQuoteViewComponent?: import("react").ReactNode;
103
103
  onInvoiceDownloadError?: (() => void) | undefined;
104
104
  onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
@@ -121,12 +121,12 @@ export declare const DarkMode: import("@storybook/core/csf").StoryAnnotations<im
121
121
  onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
122
122
  }, {
123
123
  className?: string | undefined;
124
+ onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
124
125
  id?: string | undefined;
126
+ shadow?: import("../../types/shadowType").ShadowType | undefined;
125
127
  backButtonName?: string | undefined;
126
128
  onBackButtonClick?: (() => void) | undefined;
127
- shadow?: import("../../types/shadowType").ShadowType | undefined;
128
129
  hideDownloadButton?: boolean | undefined;
129
- onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
130
130
  invoiceQuoteViewComponent?: import("react").ReactNode;
131
131
  onInvoiceDownloadError?: (() => void) | undefined;
132
132
  onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
@@ -1,2 +1,2 @@
1
- export declare const useCancelSubscription: () => (subscriptionIds: string[], token: string, apiHost: string) => Promise<any>;
2
- export declare const useSubscriptionTrialConvert: (handlePortalErrors: (errors: any) => void, apiHost: string) => (subscriptionId: string, token: string, paymentId?: string) => Promise<any>;
1
+ export declare const useCancelSubscription: () => (subscriptionIds: string[], apiHost: string, token?: string) => Promise<any>;
2
+ export declare const useSubscriptionTrialConvert: (handlePortalErrors: (errors: any) => void, apiHost: string) => (subscriptionId: string, token?: string, paymentId?: string) => Promise<any>;
@@ -1,6 +1,6 @@
1
- export declare const useCreateSubscriptionQuote: () => (subscriptionIds: string[], token: string, apiHost: string) => Promise<unknown>;
1
+ export declare const useCreateSubscriptionQuote: () => (subscriptionIds: string[], apiHost: string, token?: string) => Promise<unknown>;
2
2
  export declare const useQuoteChangeUpdate: () => (charges: {
3
3
  id: string;
4
4
  quantity: number;
5
- }[], quoteChangeId: string, token: string, apiHost: string) => Promise<unknown>;
6
- export declare const useQuoteDelete: () => (quoteId: string, token: string, apiHost: string) => Promise<unknown>;
5
+ }[], quoteChangeId: string, apiHost: string, token?: string) => Promise<unknown>;
6
+ export declare const useQuoteDelete: () => (quoteId: string, apiHost: string, token?: string) => Promise<unknown>;
@@ -7,7 +7,7 @@ type QuoteChangeCreateChargeProps = {
7
7
  quoteChangeId: string;
8
8
  startDate: string;
9
9
  subscriptionChargeId?: string;
10
- token: string;
10
+ token?: string;
11
11
  };
12
12
  declare const quoteChargeCreate: ({ endDate, price, priceListChargeId, quantity, quoteChangeId, startDate, subscriptionChargeId, token, apiHost, }: QuoteChangeCreateChargeProps) => Promise<unknown>;
13
13
  export default quoteChargeCreate;
@@ -6,7 +6,7 @@ type Options = {
6
6
  subscriptionId?: string;
7
7
  quantity?: number;
8
8
  accountId?: string;
9
- token: string;
9
+ token?: string;
10
10
  apiHost: string;
11
11
  };
12
12
  declare const quoteCompose: ({ quoteId, priceListId, subscriptionId, quantity, accountId, token, apiHost, }: Options) => Promise<Quote>;
@@ -1,6 +1,6 @@
1
- declare const quoteRecalculateTaxes: ({ quoteId, token, apiHost, }: {
1
+ declare const quoteRecalculateTaxes: ({ quoteId, apiHost, token, }: {
2
2
  quoteId: string;
3
- token: string;
4
3
  apiHost: string;
4
+ token?: string | undefined;
5
5
  }) => Promise<any>;
6
6
  export default quoteRecalculateTaxes;
@@ -3,7 +3,7 @@ declare const getPriceListChangeOptions: ({ apiHost, isInPreviewMode, productId,
3
3
  apiHost: string;
4
4
  isInPreviewMode?: boolean | undefined;
5
5
  productId?: string | undefined;
6
- token: string;
6
+ token?: string | undefined;
7
7
  upgradingSubscription?: Subscription | undefined;
8
8
  }) => Promise<any>;
9
9
  export default getPriceListChangeOptions;
@@ -1,6 +1,6 @@
1
1
  import { TaxationRequiredAccountFields } from "@bunnyapp/common";
2
- declare const getTaxationRequiredAccountFields: ({ token, apiHost, }: {
3
- token: string;
2
+ declare const getTaxationRequiredAccountFields: ({ apiHost, token, }: {
4
3
  apiHost: string;
4
+ token?: string | undefined;
5
5
  }) => Promise<TaxationRequiredAccountFields | null>;
6
6
  export default getTaxationRequiredAccountFields;
@@ -3,7 +3,7 @@ declare const useSendAcceptQuote: ({ onTokenExpired, quoteId, apiHost, token, }:
3
3
  onTokenExpired?: (() => void) | undefined;
4
4
  quoteId?: string | undefined;
5
5
  apiHost: string;
6
- token: string;
6
+ token?: string | undefined;
7
7
  }) => {
8
8
  acceptBoxVisible: boolean;
9
9
  isAccepting: boolean;
@@ -1,5 +1,5 @@
1
1
  declare const useSigningComplete: ({ data, token }: {
2
2
  data: any;
3
- token: string;
3
+ token?: string | undefined;
4
4
  }) => void;
5
5
  export default useSigningComplete;
@@ -1,5 +1,5 @@
1
1
  declare const useHasTaxPlugin: ({ apiHost, token, }: {
2
2
  apiHost: string;
3
- token: string;
3
+ token?: string | undefined;
4
4
  }) => boolean;
5
5
  export default useHasTaxPlugin;
@@ -2,7 +2,7 @@ import { GraphQLClient } from "graphql-request";
2
2
  export declare const usePaymentMethod: ({ accountId, graphQLClient, token, }: {
3
3
  accountId?: string | undefined;
4
4
  graphQLClient: GraphQLClient;
5
- token: string;
5
+ token?: string | undefined;
6
6
  }) => {
7
7
  data: any;
8
8
  isLoading: boolean;
@@ -1,7 +1,7 @@
1
1
  import { PluginData } from "@bunnyapp/common";
2
2
  export declare const usePaymentPlugins: ({ apiHost, token, }: {
3
3
  apiHost: string;
4
- token: string;
4
+ token?: string | undefined;
5
5
  }) => {
6
6
  paymentPlugins: PluginData[] | undefined;
7
7
  paymentMethodAllowedPlugins: PluginData[] | undefined;
@@ -1,5 +1,5 @@
1
- declare const usePlugins: ({ apiHost, token }: {
1
+ declare const usePlugins: ({ apiHost, token, }: {
2
2
  apiHost: string;
3
- token: string;
3
+ token?: string | undefined;
4
4
  }) => import("@tanstack/react-query/build/legacy/types").UseQueryResult<any, Error>;
5
5
  export default usePlugins;
@@ -1,5 +1,5 @@
1
1
  import { PluginData } from "@bunnyapp/common";
2
2
  export declare const useSigningPlugins: ({ apiHost, token, }: {
3
3
  apiHost: string;
4
- token: string;
4
+ token?: string | undefined;
5
5
  }) => PluginData[] | undefined;
@@ -1,2 +1,2 @@
1
- declare function useToken(): string;
1
+ declare function useToken(): string | undefined;
2
2
  export default useToken;
@@ -1,2 +1,2 @@
1
1
  export declare const getGraphQLBaseURL: (apiHost: string) => string;
2
- export declare const useGraphQLRequest: () => (query: string, token: string, apiHost: string, variables?: any) => Promise<unknown>;
2
+ export declare const useGraphQLRequest: () => (query: string, apiHost: string, token?: string, variables?: any) => Promise<unknown>;
package/dist/esm/index.js CHANGED
@@ -441,7 +441,7 @@ var usePaymentMethod = function (_a) {
441
441
  var usePlugins = function (_a) {
442
442
  var apiHost = _a.apiHost, token = _a.token;
443
443
  var response = useQuery({
444
- queryKey: QueryKeyFactory.default.pluginsKey(token),
444
+ queryKey: QueryKeyFactory.default.pluginsKey(token || ""),
445
445
  queryFn: function () { return __awaiter(void 0, void 0, void 0, function () {
446
446
  var plugins;
447
447
  return __generator(this, function (_a) {
@@ -1356,7 +1356,7 @@ var PaymentOptionContainer = defaultStyled.div(templateObject_1$9 || (templateOb
1356
1356
  });
1357
1357
  var templateObject_1$9;
1358
1358
 
1359
- function useRemovePaymentMethod(paymentPlugins, apiHost, token, accountId) {
1359
+ function useRemovePaymentMethod(paymentPlugins, apiHost, token, accountId, onRemovePaymentMethod) {
1360
1360
  var _this = this;
1361
1361
  var queryClient = useQueryClient();
1362
1362
  var showErrorNotification = useErrorNotification();
@@ -1384,6 +1384,7 @@ function useRemovePaymentMethod(paymentPlugins, apiHost, token, accountId) {
1384
1384
  token: token,
1385
1385
  accountId: accountId,
1386
1386
  }), null);
1387
+ onRemovePaymentMethod === null || onRemovePaymentMethod === void 0 ? void 0 : onRemovePaymentMethod();
1387
1388
  })
1388
1389
  .catch(function (error) {
1389
1390
  showErrorNotification(error.message, "Error removing payment method");
@@ -1401,7 +1402,7 @@ function useRemovePaymentMethod(paymentPlugins, apiHost, token, accountId) {
1401
1402
  var Panel = Collapse.Panel;
1402
1403
  var PaymentForm = function (_a) {
1403
1404
  var _b;
1404
- var invoice = _a.invoice, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, quote = _a.quote, accountId = _a.accountId, onSavePaymentMethod = _a.onSavePaymentMethod, overrideToken = _a.overrideToken, graphQLClient = _a.graphQLClient, customCheckoutFunction = _a.customCheckoutFunction, currencyIdFromProps = _a.currencyId, customPaymentForms = _a.customPaymentForms, _c = _a.useAllPaymentPlugins, useAllPaymentPlugins = _c === void 0 ? false : _c;
1405
+ var invoice = _a.invoice, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, quote = _a.quote, accountId = _a.accountId, onSavePaymentMethod = _a.onSavePaymentMethod, onRemovePaymentMethod = _a.onRemovePaymentMethod, overrideToken = _a.overrideToken, graphQLClient = _a.graphQLClient, customCheckoutFunction = _a.customCheckoutFunction, currencyIdFromProps = _a.currencyId, customPaymentForms = _a.customPaymentForms, _c = _a.useAllPaymentPlugins, useAllPaymentPlugins = _c === void 0 ? false : _c;
1405
1406
  // Local state
1406
1407
  var _d = useState(), selectedPaymentMethod = _d[0], setSelectedPaymentMethod = _d[1];
1407
1408
  var _e = useState(false), showPaymentMethodForm = _e[0], setShowPaymentMethodForm = _e[1];
@@ -1426,7 +1427,7 @@ var PaymentForm = function (_a) {
1426
1427
  }
1427
1428
  return allPaymentMethodAllowedPlugins;
1428
1429
  }, [allPaymentMethodAllowedPlugins, allPaymentPlugins, useAllPaymentPlugins]);
1429
- var onClickRemove = useRemovePaymentMethod(paymentMethodAllowedPlugins || [], apiHost, token, accountId);
1430
+ var onClickRemove = useRemovePaymentMethod(paymentMethodAllowedPlugins || [], apiHost, token, accountId, onRemovePaymentMethod);
1430
1431
  var queryClient = useQueryClient();
1431
1432
  // Set default plugin
1432
1433
  useEffect(function () {
@@ -19894,18 +19895,20 @@ function Signup(_a) {
19894
19895
  }
19895
19896
 
19896
19897
  var createRequestHeaders = function (token) {
19897
- var bearerToken = "Bearer ".concat(token);
19898
+ var bearerToken = token ? "Bearer ".concat(token) : null;
19898
19899
  var headers = {
19899
19900
  "Content-type": "application/json; charset=utf-8",
19900
19901
  };
19901
- headers["Authorization"] = bearerToken;
19902
+ if (bearerToken) {
19903
+ headers["Authorization"] = bearerToken;
19904
+ }
19902
19905
  return headers;
19903
19906
  };
19904
19907
  var getGraphQLBaseURL = function (apiHost) {
19905
19908
  return "".concat(apiHost, "/graphql");
19906
19909
  };
19907
19910
  var useGraphQLRequest = function () {
19908
- return function (query, token, apiHost, variables) { return __awaiter(void 0, void 0, void 0, function () {
19911
+ return function (query, apiHost, token, variables) { return __awaiter(void 0, void 0, void 0, function () {
19909
19912
  var error_1;
19910
19913
  return __generator(this, function (_a) {
19911
19914
  switch (_a.label) {
@@ -19924,11 +19927,11 @@ var useGraphQLRequest = function () {
19924
19927
 
19925
19928
  var useCreateSubscriptionQuote = function () {
19926
19929
  var graphQLRequest = useGraphQLRequest();
19927
- return function (subscriptionIds, token, apiHost) { return __awaiter(void 0, void 0, void 0, function () {
19930
+ return function (subscriptionIds, apiHost, token) { return __awaiter(void 0, void 0, void 0, function () {
19928
19931
  var data;
19929
19932
  return __generator(this, function (_a) {
19930
19933
  switch (_a.label) {
19931
- case 0: return [4 /*yield*/, graphQLRequest("\n mutation quoteSubscriptionUpdate(\n $subscriptionIds: [ID!]!,\n ) {\n quoteSubscriptionUpdate(\n subscriptionIds: $subscriptionIds,\n ) {\n quote {\n id\n quoteChanges {\n id\n priceList {\n id\n }\n subscription {\n charges {\n startDate\n endDate\n id\n priceListCharge {\n id\n }\n }\n }\n }\n }\n }\n }\n ", token, apiHost, {
19934
+ case 0: return [4 /*yield*/, graphQLRequest("\n mutation quoteSubscriptionUpdate(\n $subscriptionIds: [ID!]!,\n ) {\n quoteSubscriptionUpdate(\n subscriptionIds: $subscriptionIds,\n ) {\n quote {\n id\n quoteChanges {\n id\n priceList {\n id\n }\n subscription {\n charges {\n startDate\n endDate\n id\n priceListCharge {\n id\n }\n }\n }\n }\n }\n }\n }\n ", apiHost, token, {
19932
19935
  subscriptionIds: subscriptionIds,
19933
19936
  })];
19934
19937
  case 1:
@@ -19940,11 +19943,11 @@ var useCreateSubscriptionQuote = function () {
19940
19943
  };
19941
19944
  var useQuoteChangeUpdate = function () {
19942
19945
  var graphQLRequest = useGraphQLRequest();
19943
- return function (charges, quoteChangeId, token, apiHost) { return __awaiter(void 0, void 0, void 0, function () {
19946
+ return function (charges, quoteChangeId, apiHost, token) { return __awaiter(void 0, void 0, void 0, function () {
19944
19947
  var response;
19945
19948
  return __generator(this, function (_a) {
19946
19949
  switch (_a.label) {
19947
- case 0: return [4 /*yield*/, graphQLRequest("mutation QuoteChangeUpdate($charges:[QuoteChargeAttributes!], $id:ID!) {\n quoteChangeUpdate(id:$id, charges:$charges) {\n quoteChange { id quoteId }\n errors\n }\n }", token, apiHost, { charges: charges, id: quoteChangeId })];
19950
+ case 0: return [4 /*yield*/, graphQLRequest("mutation QuoteChangeUpdate($charges:[QuoteChargeAttributes!], $id:ID!) {\n quoteChangeUpdate(id:$id, charges:$charges) {\n quoteChange { id quoteId }\n errors\n }\n }", apiHost, token, { charges: charges, id: quoteChangeId })];
19948
19951
  case 1:
19949
19952
  response = _a.sent();
19950
19953
  return [2 /*return*/, response];
@@ -19954,11 +19957,11 @@ var useQuoteChangeUpdate = function () {
19954
19957
  };
19955
19958
  var useQuoteDelete = function () {
19956
19959
  var graphQLRequest = useGraphQLRequest();
19957
- return function (quoteId, token, apiHost) { return __awaiter(void 0, void 0, void 0, function () {
19960
+ return function (quoteId, apiHost, token) { return __awaiter(void 0, void 0, void 0, function () {
19958
19961
  var response;
19959
19962
  return __generator(this, function (_a) {
19960
19963
  switch (_a.label) {
19961
- case 0: return [4 /*yield*/, graphQLRequest("mutation QuoteDelete($id: ID!) {\n quoteDelete(id: $id) {\n errors\n }\n }", token, apiHost, { id: quoteId })];
19964
+ case 0: return [4 /*yield*/, graphQLRequest("mutation QuoteDelete($id: ID!) {\n quoteDelete(id: $id) {\n errors\n }\n }", apiHost, token, { id: quoteId })];
19962
19965
  case 1:
19963
19966
  response = _a.sent();
19964
19967
  return [2 /*return*/, response];
@@ -20044,7 +20047,7 @@ var quoteCompose = function (_a) {
20044
20047
 
20045
20048
  var QUOTE_RECALCULATE_TAXES = "\n mutation QuoteRecalculateTaxes($id: ID!) {\n quoteRecalculateTaxes(id: $id) {\n ".concat(QUOTE_FIELDS, "\n errors\n }\n }\n");
20046
20049
  var quoteRecalculateTaxes = function (_a) {
20047
- var quoteId = _a.quoteId, token = _a.token, apiHost = _a.apiHost;
20050
+ var quoteId = _a.quoteId, apiHost = _a.apiHost, token = _a.token;
20048
20051
  return __awaiter(void 0, void 0, void 0, function () {
20049
20052
  var vars, response, errors;
20050
20053
  var _b, _c;
@@ -20071,7 +20074,7 @@ var quoteRecalculateTaxes = function (_a) {
20071
20074
 
20072
20075
  var MUTATION$2 = "{\n currentUser {\n taxationRequiredAccountFields\n }\n}";
20073
20076
  var getTaxationRequiredAccountFields = function (_a) {
20074
- var token = _a.token, apiHost = _a.apiHost;
20077
+ var apiHost = _a.apiHost, token = _a.token;
20075
20078
  return __awaiter(void 0, void 0, void 0, function () {
20076
20079
  var response;
20077
20080
  var _b, _c;
@@ -20267,14 +20270,14 @@ var Checkout = function (_a) {
20267
20270
  // Queries
20268
20271
  var _f = useQuery({
20269
20272
  queryKey: ["getTaxationRequiredAccountFields", token],
20270
- queryFn: function () { return getTaxationRequiredAccountFields({ token: token, apiHost: apiHost }); },
20273
+ queryFn: function () { return getTaxationRequiredAccountFields({ apiHost: apiHost, token: token }); },
20271
20274
  enabled: Boolean(quote),
20272
20275
  staleTime: 0,
20273
20276
  }), taxationRequiredAccountFields = _f.data, isLoadingTaxationRequiredAccountFields = _f.isLoading;
20274
20277
  var _g = useQuery({
20275
20278
  queryKey: ["account", quote === null || quote === void 0 ? void 0 : quote.accountId],
20276
20279
  queryFn: function () {
20277
- return (quote === null || quote === void 0 ? void 0 : quote.accountId) && getAccount({ id: quote.accountId, token: token, apiHost: apiHost });
20280
+ return (quote === null || quote === void 0 ? void 0 : quote.accountId) && getAccount({ id: quote.accountId, apiHost: apiHost, token: token });
20278
20281
  },
20279
20282
  enabled: Boolean(quote === null || quote === void 0 ? void 0 : quote.accountId) &&
20280
20283
  ((taxationRequiredAccountFields === null || taxationRequiredAccountFields === void 0 ? void 0 : taxationRequiredAccountFields.length) || 0) > 0,
@@ -20292,8 +20295,8 @@ var Checkout = function (_a) {
20292
20295
  if (!quote) return [3 /*break*/, 2];
20293
20296
  return [4 /*yield*/, quoteRecalculateTaxes({
20294
20297
  quoteId: quote.id,
20295
- token: token,
20296
20298
  apiHost: apiHost,
20299
+ token: token,
20297
20300
  })];
20298
20301
  case 1:
20299
20302
  updatedQuote = _a.sent();
@@ -21423,12 +21426,12 @@ var PlanManager = function (_a) {
21423
21426
 
21424
21427
  var useCancelSubscription = function () {
21425
21428
  var graphQLRequest = useGraphQLRequest();
21426
- return function (subscriptionIds, token, apiHost) { return __awaiter(void 0, void 0, void 0, function () {
21429
+ return function (subscriptionIds, apiHost, token) { return __awaiter(void 0, void 0, void 0, function () {
21427
21430
  var data;
21428
21431
  var _a;
21429
21432
  return __generator(this, function (_b) {
21430
21433
  switch (_b.label) {
21431
- case 0: return [4 /*yield*/, graphQLRequest("\n mutation SubscriptionCancel($subscriptionIds: [ID!]!) {\n subscriptionCancel(ids: $subscriptionIds) {\n subscriptions {\n accountId\n state\n }\n }\n }", token, apiHost, { subscriptionIds: subscriptionIds })];
21434
+ case 0: return [4 /*yield*/, graphQLRequest("\n mutation SubscriptionCancel($subscriptionIds: [ID!]!) {\n subscriptionCancel(ids: $subscriptionIds) {\n subscriptions {\n accountId\n state\n }\n }\n }", apiHost, token, { subscriptionIds: subscriptionIds })];
21432
21435
  case 1:
21433
21436
  data = _b.sent();
21434
21437
  return [2 /*return*/, (_a = data === null || data === void 0 ? void 0 : data.subscriptions) === null || _a === void 0 ? void 0 : _a.nodes];
@@ -21885,7 +21888,7 @@ var SubscriptionsListContainer = function (_a) {
21885
21888
  // Queries
21886
21889
  var _c = useQuery({
21887
21890
  queryKey: QueryKeyFactory.default.planChangeOptionsKey({ token: token }),
21888
- queryFn: function () { return getPriceListChangeOptions({ token: token, apiHost: apiHost }); },
21891
+ queryFn: function () { return getPriceListChangeOptions({ apiHost: apiHost, token: token }); },
21889
21892
  enabled: Boolean(onChangePlanClick),
21890
21893
  }), priceListChangeOptions = _c.data, arePriceListChangeOptionsLoading = _c.isLoading;
21891
21894
  if (subscriptionsAreLoading ||
@@ -21933,14 +21936,17 @@ var QuantityInput = function (_a) {
21933
21936
  (updatingChargeQuantityId && updatingChargeQuantityId !== charge.id) ||
21934
21937
  // If the subscription is not self-service, we disable the quantity input
21935
21938
  !charge.selfServiceQuantity;
21936
- var value = (editedSubscription === null || editedSubscription === void 0 ? void 0 : editedSubscription.quantity) === undefined ? "" : editedSubscription.quantity;
21939
+ var value = (editedSubscription === null || editedSubscription === void 0 ? void 0 : editedSubscription.quantity) === undefined
21940
+ ? ""
21941
+ : editedSubscription.quantity;
21937
21942
  // Mutations
21938
21943
  var createCharge = useMutation({
21939
21944
  mutationFn: quoteChargeCreate,
21940
21945
  onSuccess: function (response) {
21941
21946
  var _a, _b, _c, _d, _e, _f, _g, _h;
21942
21947
  if (!(editingQuote === null || editingQuote === void 0 ? void 0 : editingQuote.id)) {
21943
- var isTrial = ((_b = (_a = editedSubscription === null || editedSubscription === void 0 ? void 0 : editedSubscription.subscription) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState$2.TRIAL;
21948
+ var isTrial = ((_b = (_a = editedSubscription === null || editedSubscription === void 0 ? void 0 : editedSubscription.subscription) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) ===
21949
+ SubscriptionState$2.TRIAL;
21944
21950
  setEditingQuoteData({
21945
21951
  id: (_e = (_d = (_c = response.quoteChargeCreate) === null || _c === void 0 ? void 0 : _c.quoteCharge) === null || _d === void 0 ? void 0 : _d.quoteChange) === null || _e === void 0 ? void 0 : _e.quoteId,
21946
21952
  isTrial: isTrial,
@@ -21957,12 +21963,15 @@ var QuantityInput = function (_a) {
21957
21963
  }).mutate;
21958
21964
  var createQuote = useMutation({
21959
21965
  mutationFn: function (subscriptionIds) {
21960
- return createSubscriptionQuote(subscriptionIds, token, apiHost);
21966
+ return createSubscriptionQuote(subscriptionIds, apiHost, token);
21961
21967
  },
21962
21968
  onSuccess: function (subscriptionUpdateData) {
21963
21969
  var _a, _b;
21964
21970
  var quote = (_a = subscriptionUpdateData === null || subscriptionUpdateData === void 0 ? void 0 : subscriptionUpdateData.quoteSubscriptionUpdate) === null || _a === void 0 ? void 0 : _a.quote;
21965
- var quoteChange = quote.quoteChanges.find(function (quoteChange) { return quoteChange.priceList.id === (editedSubscription === null || editedSubscription === void 0 ? void 0 : editedSubscription.subscription.priceList.id); });
21971
+ var quoteChange = quote.quoteChanges.find(function (quoteChange) {
21972
+ return quoteChange.priceList.id ===
21973
+ (editedSubscription === null || editedSubscription === void 0 ? void 0 : editedSubscription.subscription.priceList.id);
21974
+ });
21966
21975
  var subscriptionCharge = (_b = quoteChange === null || quoteChange === void 0 ? void 0 : quoteChange.subscription) === null || _b === void 0 ? void 0 : _b.charges.find(function (charge) { var _a; return ((_a = charge === null || charge === void 0 ? void 0 : charge.priceListCharge) === null || _a === void 0 ? void 0 : _a.id) === (editedSubscription === null || editedSubscription === void 0 ? void 0 : editedSubscription.chargeId); });
21967
21976
  if (subscriptionCharge && quoteChange && editedSubscription) {
21968
21977
  createCharge({
@@ -21980,12 +21989,13 @@ var QuantityInput = function (_a) {
21980
21989
  var updateQuote = useMutation({
21981
21990
  mutationFn: function (_a) {
21982
21991
  var charges = _a.charges, quoteChangeId = _a.quoteChangeId;
21983
- return quoteChangeUpdate(charges, quoteChangeId, token, apiHost);
21992
+ return quoteChangeUpdate(charges, quoteChangeId, apiHost, token);
21984
21993
  },
21985
21994
  onSuccess: function (response) {
21986
21995
  var _a, _b, _c, _d, _e, _f;
21987
21996
  if (!(editingQuote === null || editingQuote === void 0 ? void 0 : editingQuote.id)) {
21988
- var isTrial = ((_b = (_a = editedSubscription === null || editedSubscription === void 0 ? void 0 : editedSubscription.subscription) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState$2.TRIAL;
21997
+ var isTrial = ((_b = (_a = editedSubscription === null || editedSubscription === void 0 ? void 0 : editedSubscription.subscription) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) ===
21998
+ SubscriptionState$2.TRIAL;
21989
21999
  setEditingQuoteData({
21990
22000
  id: (_d = (_c = response.quoteChangeUpdate) === null || _c === void 0 ? void 0 : _c.quoteChange) === null || _d === void 0 ? void 0 : _d.quoteId,
21991
22001
  isTrial: isTrial,
@@ -22002,7 +22012,8 @@ var QuantityInput = function (_a) {
22002
22012
  });
22003
22013
  // Handlers
22004
22014
  var isQuantityLowerThanOriginal = function (quantity) {
22005
- return (editedSubscription === null || editedSubscription === void 0 ? void 0 : editedSubscription.quantity) !== undefined && editedSubscription.quantity <= quantity;
22015
+ return (editedSubscription === null || editedSubscription === void 0 ? void 0 : editedSubscription.quantity) !== undefined &&
22016
+ editedSubscription.quantity <= quantity;
22006
22017
  };
22007
22018
  var onChangeQuantity = function (chargeIndex, value, priceListChargeId, subscription, subscriptionIndex) {
22008
22019
  var quantity = isNaN(parseInt(value)) ? 0 : parseInt(value);
@@ -22283,7 +22294,7 @@ var Subscriptions = function (_a) {
22283
22294
  // Mutations
22284
22295
  var subscriptionCancel = useMutation({
22285
22296
  mutationFn: function (subscription) {
22286
- return cancelSubscription([subscription.id], token, apiHost);
22297
+ return cancelSubscription([subscription.id], apiHost, token);
22287
22298
  },
22288
22299
  onSuccess: function () {
22289
22300
  queryClient.invalidateQueries({
@@ -22334,7 +22345,7 @@ var Subscriptions = function (_a) {
22334
22345
  };
22335
22346
  var onClose = function () {
22336
22347
  if (editingQuoteData) {
22337
- quoteDelete(editingQuoteData.id, token, apiHost);
22348
+ quoteDelete(editingQuoteData.id, apiHost, token);
22338
22349
  setEditingQuoteData(undefined);
22339
22350
  }
22340
22351
  if (updatingChargeQuantityId) {
@@ -5,7 +5,7 @@ import { GraphQLClient } from "graphql-request";
5
5
  export type BunnyContextValues = {
6
6
  apiHost: string;
7
7
  graphQLClient: GraphQLClient;
8
- token: string;
8
+ token?: string;
9
9
  displayPayButtonNameAnyways?: boolean;
10
10
  darkMode?: boolean;
11
11
  onTokenExpired?: () => void;
@@ -16,7 +16,7 @@ declare function BunnyProvider({ children, darkMode, queryClient, apiHost, token
16
16
  darkMode?: boolean;
17
17
  queryClient?: QueryClient;
18
18
  apiHost: string;
19
- token: string;
19
+ token?: string;
20
20
  onTokenExpired?: () => void;
21
21
  configProviderProps?: ThemeConfig | undefined;
22
22
  }): import("react/jsx-runtime").JSX.Element;
@@ -2,7 +2,7 @@ import { PaymentMethod } from "@bunnyapp/common";
2
2
  import { CheckoutProps } from "../PaymentForm/PaymentFormTypes";
3
3
  interface CheckoutComponentProps extends CheckoutProps {
4
4
  isMobile: boolean;
5
- token: string;
5
+ token?: string;
6
6
  storedPaymentMethod?: PaymentMethod;
7
7
  quantity?: number;
8
8
  }
@@ -4,7 +4,7 @@ interface QuoteCheckoutProps extends InvoiceQuoteParentProps {
4
4
  account: Account;
5
5
  quote: Quote;
6
6
  taxationRequiredAccountFields?: TaxationRequiredAccountFields | null;
7
- token: string;
7
+ token?: string;
8
8
  storedPaymentMethod?: PaymentMethod;
9
9
  }
10
10
  declare const QuoteCheckout: ({ account, onSuccess, onFail, quote, taxationRequiredAccountFields, }: QuoteCheckoutProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,12 +1,13 @@
1
1
  /// <reference types="react" />
2
2
  import { FormattedInvoice, PluginData, Quote } from "@bunnyapp/common";
3
3
  import { GraphQLClient } from "graphql-request";
4
- export declare const PaymentForm: ({ invoice, onFail, onPaymentSuccess, quote, accountId, onSavePaymentMethod, overrideToken, graphQLClient, customCheckoutFunction, currencyId: currencyIdFromProps, customPaymentForms, useAllPaymentPlugins, }: {
4
+ export declare const PaymentForm: ({ invoice, onFail, onPaymentSuccess, quote, accountId, onSavePaymentMethod, onRemovePaymentMethod, overrideToken, graphQLClient, customCheckoutFunction, currencyId: currencyIdFromProps, customPaymentForms, useAllPaymentPlugins, }: {
5
5
  invoice?: FormattedInvoice | undefined;
6
6
  quote?: Quote | undefined;
7
7
  onFail: (error: any) => void;
8
8
  onPaymentSuccess?: (() => void) | undefined;
9
9
  onSavePaymentMethod?: (() => void) | undefined;
10
+ onRemovePaymentMethod?: (() => void) | undefined;
10
11
  accountId?: string | undefined;
11
12
  overrideToken?: string | undefined;
12
13
  graphQLClient: GraphQLClient;
@@ -20,5 +20,5 @@ export type CheckoutProps = {
20
20
  open: boolean;
21
21
  quote?: Quote;
22
22
  selectedPriceList?: PriceList;
23
- token: string;
23
+ token?: string;
24
24
  };
@@ -1,3 +1,3 @@
1
1
  import { PluginData } from "@bunnyapp/common";
2
- declare function useRemovePaymentMethod(paymentPlugins: PluginData[], apiHost: string, token: string, accountId?: string): (data: any) => Promise<void>;
2
+ declare function useRemovePaymentMethod(paymentPlugins: PluginData[], apiHost: string, token?: string, accountId?: string, onRemovePaymentMethod?: () => void): (data: any) => Promise<void>;
3
3
  export default useRemovePaymentMethod;
@@ -18,12 +18,12 @@ export declare const Default: import("@storybook/core/csf").StoryAnnotations<imp
18
18
  onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
19
19
  }, {
20
20
  className?: string | undefined;
21
+ onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
21
22
  id?: string | undefined;
23
+ shadow?: import("../../types/shadowType").ShadowType | undefined;
22
24
  backButtonName?: string | undefined;
23
25
  onBackButtonClick?: (() => void) | undefined;
24
- shadow?: import("../../types/shadowType").ShadowType | undefined;
25
26
  hideDownloadButton?: boolean | undefined;
26
- onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
27
27
  invoiceQuoteViewComponent?: import("react").ReactNode;
28
28
  onInvoiceDownloadError?: (() => void) | undefined;
29
29
  onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
@@ -43,12 +43,12 @@ export declare const NoShadow: import("@storybook/core/csf").StoryAnnotations<im
43
43
  onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
44
44
  }, {
45
45
  className?: string | undefined;
46
+ onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
46
47
  id?: string | undefined;
48
+ shadow?: import("../../types/shadowType").ShadowType | undefined;
47
49
  backButtonName?: string | undefined;
48
50
  onBackButtonClick?: (() => void) | undefined;
49
- shadow?: import("../../types/shadowType").ShadowType | undefined;
50
51
  hideDownloadButton?: boolean | undefined;
51
- onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
52
52
  invoiceQuoteViewComponent?: import("react").ReactNode;
53
53
  onInvoiceDownloadError?: (() => void) | undefined;
54
54
  onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
@@ -68,12 +68,12 @@ export declare const Mobile: import("@storybook/core/csf").StoryAnnotations<impo
68
68
  onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
69
69
  }, {
70
70
  className?: string | undefined;
71
+ onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
71
72
  id?: string | undefined;
73
+ shadow?: import("../../types/shadowType").ShadowType | undefined;
72
74
  backButtonName?: string | undefined;
73
75
  onBackButtonClick?: (() => void) | undefined;
74
- shadow?: import("../../types/shadowType").ShadowType | undefined;
75
76
  hideDownloadButton?: boolean | undefined;
76
- onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
77
77
  invoiceQuoteViewComponent?: import("react").ReactNode;
78
78
  onInvoiceDownloadError?: (() => void) | undefined;
79
79
  onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
@@ -93,12 +93,12 @@ export declare const CustomClassName: import("@storybook/core/csf").StoryAnnotat
93
93
  onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
94
94
  }, {
95
95
  className?: string | undefined;
96
+ onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
96
97
  id?: string | undefined;
98
+ shadow?: import("../../types/shadowType").ShadowType | undefined;
97
99
  backButtonName?: string | undefined;
98
100
  onBackButtonClick?: (() => void) | undefined;
99
- shadow?: import("../../types/shadowType").ShadowType | undefined;
100
101
  hideDownloadButton?: boolean | undefined;
101
- onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
102
102
  invoiceQuoteViewComponent?: import("react").ReactNode;
103
103
  onInvoiceDownloadError?: (() => void) | undefined;
104
104
  onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
@@ -121,12 +121,12 @@ export declare const DarkMode: import("@storybook/core/csf").StoryAnnotations<im
121
121
  onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
122
122
  }, {
123
123
  className?: string | undefined;
124
+ onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
124
125
  id?: string | undefined;
126
+ shadow?: import("../../types/shadowType").ShadowType | undefined;
125
127
  backButtonName?: string | undefined;
126
128
  onBackButtonClick?: (() => void) | undefined;
127
- shadow?: import("../../types/shadowType").ShadowType | undefined;
128
129
  hideDownloadButton?: boolean | undefined;
129
- onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
130
130
  invoiceQuoteViewComponent?: import("react").ReactNode;
131
131
  onInvoiceDownloadError?: (() => void) | undefined;
132
132
  onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
@@ -1,2 +1,2 @@
1
- export declare const useCancelSubscription: () => (subscriptionIds: string[], token: string, apiHost: string) => Promise<any>;
2
- export declare const useSubscriptionTrialConvert: (handlePortalErrors: (errors: any) => void, apiHost: string) => (subscriptionId: string, token: string, paymentId?: string) => Promise<any>;
1
+ export declare const useCancelSubscription: () => (subscriptionIds: string[], apiHost: string, token?: string) => Promise<any>;
2
+ export declare const useSubscriptionTrialConvert: (handlePortalErrors: (errors: any) => void, apiHost: string) => (subscriptionId: string, token?: string, paymentId?: string) => Promise<any>;
@@ -1,6 +1,6 @@
1
- export declare const useCreateSubscriptionQuote: () => (subscriptionIds: string[], token: string, apiHost: string) => Promise<unknown>;
1
+ export declare const useCreateSubscriptionQuote: () => (subscriptionIds: string[], apiHost: string, token?: string) => Promise<unknown>;
2
2
  export declare const useQuoteChangeUpdate: () => (charges: {
3
3
  id: string;
4
4
  quantity: number;
5
- }[], quoteChangeId: string, token: string, apiHost: string) => Promise<unknown>;
6
- export declare const useQuoteDelete: () => (quoteId: string, token: string, apiHost: string) => Promise<unknown>;
5
+ }[], quoteChangeId: string, apiHost: string, token?: string) => Promise<unknown>;
6
+ export declare const useQuoteDelete: () => (quoteId: string, apiHost: string, token?: string) => Promise<unknown>;
@@ -7,7 +7,7 @@ type QuoteChangeCreateChargeProps = {
7
7
  quoteChangeId: string;
8
8
  startDate: string;
9
9
  subscriptionChargeId?: string;
10
- token: string;
10
+ token?: string;
11
11
  };
12
12
  declare const quoteChargeCreate: ({ endDate, price, priceListChargeId, quantity, quoteChangeId, startDate, subscriptionChargeId, token, apiHost, }: QuoteChangeCreateChargeProps) => Promise<unknown>;
13
13
  export default quoteChargeCreate;
@@ -6,7 +6,7 @@ type Options = {
6
6
  subscriptionId?: string;
7
7
  quantity?: number;
8
8
  accountId?: string;
9
- token: string;
9
+ token?: string;
10
10
  apiHost: string;
11
11
  };
12
12
  declare const quoteCompose: ({ quoteId, priceListId, subscriptionId, quantity, accountId, token, apiHost, }: Options) => Promise<Quote>;
@@ -1,6 +1,6 @@
1
- declare const quoteRecalculateTaxes: ({ quoteId, token, apiHost, }: {
1
+ declare const quoteRecalculateTaxes: ({ quoteId, apiHost, token, }: {
2
2
  quoteId: string;
3
- token: string;
4
3
  apiHost: string;
4
+ token?: string | undefined;
5
5
  }) => Promise<any>;
6
6
  export default quoteRecalculateTaxes;
@@ -3,7 +3,7 @@ declare const getPriceListChangeOptions: ({ apiHost, isInPreviewMode, productId,
3
3
  apiHost: string;
4
4
  isInPreviewMode?: boolean | undefined;
5
5
  productId?: string | undefined;
6
- token: string;
6
+ token?: string | undefined;
7
7
  upgradingSubscription?: Subscription | undefined;
8
8
  }) => Promise<any>;
9
9
  export default getPriceListChangeOptions;
@@ -1,6 +1,6 @@
1
1
  import { TaxationRequiredAccountFields } from "@bunnyapp/common";
2
- declare const getTaxationRequiredAccountFields: ({ token, apiHost, }: {
3
- token: string;
2
+ declare const getTaxationRequiredAccountFields: ({ apiHost, token, }: {
4
3
  apiHost: string;
4
+ token?: string | undefined;
5
5
  }) => Promise<TaxationRequiredAccountFields | null>;
6
6
  export default getTaxationRequiredAccountFields;
@@ -3,7 +3,7 @@ declare const useSendAcceptQuote: ({ onTokenExpired, quoteId, apiHost, token, }:
3
3
  onTokenExpired?: (() => void) | undefined;
4
4
  quoteId?: string | undefined;
5
5
  apiHost: string;
6
- token: string;
6
+ token?: string | undefined;
7
7
  }) => {
8
8
  acceptBoxVisible: boolean;
9
9
  isAccepting: boolean;
@@ -1,5 +1,5 @@
1
1
  declare const useSigningComplete: ({ data, token }: {
2
2
  data: any;
3
- token: string;
3
+ token?: string | undefined;
4
4
  }) => void;
5
5
  export default useSigningComplete;
@@ -1,5 +1,5 @@
1
1
  declare const useHasTaxPlugin: ({ apiHost, token, }: {
2
2
  apiHost: string;
3
- token: string;
3
+ token?: string | undefined;
4
4
  }) => boolean;
5
5
  export default useHasTaxPlugin;
@@ -2,7 +2,7 @@ import { GraphQLClient } from "graphql-request";
2
2
  export declare const usePaymentMethod: ({ accountId, graphQLClient, token, }: {
3
3
  accountId?: string | undefined;
4
4
  graphQLClient: GraphQLClient;
5
- token: string;
5
+ token?: string | undefined;
6
6
  }) => {
7
7
  data: any;
8
8
  isLoading: boolean;
@@ -1,7 +1,7 @@
1
1
  import { PluginData } from "@bunnyapp/common";
2
2
  export declare const usePaymentPlugins: ({ apiHost, token, }: {
3
3
  apiHost: string;
4
- token: string;
4
+ token?: string | undefined;
5
5
  }) => {
6
6
  paymentPlugins: PluginData[] | undefined;
7
7
  paymentMethodAllowedPlugins: PluginData[] | undefined;
@@ -1,5 +1,5 @@
1
- declare const usePlugins: ({ apiHost, token }: {
1
+ declare const usePlugins: ({ apiHost, token, }: {
2
2
  apiHost: string;
3
- token: string;
3
+ token?: string | undefined;
4
4
  }) => import("@tanstack/react-query/build/legacy/types").UseQueryResult<any, Error>;
5
5
  export default usePlugins;
@@ -1,5 +1,5 @@
1
1
  import { PluginData } from "@bunnyapp/common";
2
2
  export declare const useSigningPlugins: ({ apiHost, token, }: {
3
3
  apiHost: string;
4
- token: string;
4
+ token?: string | undefined;
5
5
  }) => PluginData[] | undefined;
@@ -1,2 +1,2 @@
1
- declare function useToken(): string;
1
+ declare function useToken(): string | undefined;
2
2
  export default useToken;
@@ -1,2 +1,2 @@
1
1
  export declare const getGraphQLBaseURL: (apiHost: string) => string;
2
- export declare const useGraphQLRequest: () => (query: string, token: string, apiHost: string, variables?: any) => Promise<unknown>;
2
+ export declare const useGraphQLRequest: () => (query: string, apiHost: string, token?: string, variables?: any) => Promise<unknown>;
package/dist/index.d.ts CHANGED
@@ -79,12 +79,13 @@ declare const PaymentMethod: ({ className, shadow, cardEnabled, useModal, }: {
79
79
  useModal?: boolean | undefined;
80
80
  }) => react_jsx_runtime.JSX.Element;
81
81
 
82
- declare const PaymentForm: ({ invoice, onFail, onPaymentSuccess, quote, accountId, onSavePaymentMethod, overrideToken, graphQLClient, customCheckoutFunction, currencyId: currencyIdFromProps, customPaymentForms, useAllPaymentPlugins, }: {
82
+ declare const PaymentForm: ({ invoice, onFail, onPaymentSuccess, quote, accountId, onSavePaymentMethod, onRemovePaymentMethod, overrideToken, graphQLClient, customCheckoutFunction, currencyId: currencyIdFromProps, customPaymentForms, useAllPaymentPlugins, }: {
83
83
  invoice?: FormattedInvoice | undefined;
84
84
  quote?: Quote$1 | undefined;
85
85
  onFail: (error: any) => void;
86
86
  onPaymentSuccess?: (() => void) | undefined;
87
87
  onSavePaymentMethod?: (() => void) | undefined;
88
+ onRemovePaymentMethod?: (() => void) | undefined;
88
89
  accountId?: string | undefined;
89
90
  overrideToken?: string | undefined;
90
91
  graphQLClient: GraphQLClient;
@@ -118,7 +119,7 @@ declare function BunnyProvider({ children, darkMode, queryClient, apiHost, token
118
119
  darkMode?: boolean;
119
120
  queryClient?: QueryClient;
120
121
  apiHost: string;
121
- token: string;
122
+ token?: string;
122
123
  onTokenExpired?: () => void;
123
124
  configProviderProps?: ThemeConfig | undefined;
124
125
  }): react_jsx_runtime.JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bunnyapp/components",
3
- "version": "1.0.55",
3
+ "version": "1.0.56",
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",