@bunnyapp/components 1.0.38 → 1.0.40

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
@@ -232,9 +232,7 @@ function ContextualWrapper(_a) {
232
232
  var entityBranding = react.useMemo(function () {
233
233
  var _a;
234
234
  // This is to determine if the secondary color should be white or black
235
- var brandColor = (branding === null || branding === void 0 ? void 0 : branding.brandColor)
236
- ? "#" + ((_a = branding === null || branding === void 0 ? void 0 : branding.brandColor) === null || _a === void 0 ? void 0 : _a.toString(16))
237
- : common.DEFAULT_BRAND_COLOR;
235
+ var brandColor = (branding === null || branding === void 0 ? void 0 : branding.brandColor) ? "#" + ((_a = branding === null || branding === void 0 ? void 0 : branding.brandColor) === null || _a === void 0 ? void 0 : _a.toString(16)) : common.DEFAULT_BRAND_COLOR;
238
236
  var secondaryColor = common.DEFAULT_SECONDARY_COLOR;
239
237
  if (!isMobile && common.isColorTooDark(branding === null || branding === void 0 ? void 0 : branding.accentColor))
240
238
  secondaryColor = "#ffffff";
@@ -269,17 +267,11 @@ function ContextualWrapper(_a) {
269
267
  boxShadowSecondary: "none",
270
268
  fontWeight: "normal",
271
269
  contentFontSizeLG: 14,
272
- colorBgContainerDisabled: darkMode
273
- ? "var(--row-background-dark)"
274
- : "#eef0f2",
275
- borderColorDisabled: darkMode
276
- ? "var(--row-background-dark)"
277
- : "#eef0f2",
270
+ colorBgContainerDisabled: darkMode ? "var(--row-background-dark)" : "#eef0f2",
271
+ borderColorDisabled: darkMode ? "var(--row-background-dark)" : "#eef0f2",
278
272
  },
279
273
  Drawer: {
280
- colorBgElevated: darkMode
281
- ? "var(--row-background-dark)"
282
- : common.SLATE_50,
274
+ colorBgElevated: darkMode ? "var(--row-background-dark)" : common.SLATE_50,
283
275
  },
284
276
  Divider: {
285
277
  colorSplit: darkMode ? common.SLATE_400 : common.SLATE_200,
@@ -447,9 +439,10 @@ function InvoicePDF(_a) {
447
439
  }
448
440
 
449
441
  var paymentMethodsQuery = "query paymentMethods ($filter: String, $first: Int, $sort: String) {\n paymentMethods (filter: $filter, first: $first, sort: $sort) {\n nodes {\n id\n disabled\n pluginId\n accountId\n expirationDate\n plugin {\n guid\n id\n }\n state\n metadata {\n issuer\n identifier\n kind\n description\n icon\n }\n }\n }\n}";
450
- var usePaymentMethod = function (graphQLClient, entityId, token, accountId) {
451
- var _a = reactQuery.useQuery({
452
- queryKey: common.QueryKeyFactory.default.accountPaymentMethodKey(entityId, token, accountId),
442
+ var usePaymentMethod = function (_a) {
443
+ var accountId = _a.accountId, entityId = _a.entityId, graphQLClient = _a.graphQLClient, token = _a.token;
444
+ var _b = reactQuery.useQuery({
445
+ queryKey: common.QueryKeyFactory.default.accountPaymentMethodKey({ entityId: entityId, token: token, accountId: accountId }),
453
446
  queryFn: function () {
454
447
  return graphQLClient
455
448
  .request(paymentMethodsQuery, {
@@ -463,7 +456,7 @@ var usePaymentMethod = function (graphQLClient, entityId, token, accountId) {
463
456
  return paymentMethod;
464
457
  });
465
458
  },
466
- }), data = _a.data, isLoading = _a.isLoading;
459
+ }), data = _b.data, isLoading = _b.isLoading;
467
460
  return { data: data, isLoading: isLoading };
468
461
  };
469
462
 
@@ -471,14 +464,21 @@ var usePlugins = function (_a) {
471
464
  var entityId = _a.entityId, apiHost = _a.apiHost, token = _a.token;
472
465
  var response = reactQuery.useQuery({
473
466
  queryKey: common.QueryKeyFactory.default.pluginsKey(token),
474
- queryFn: function () {
475
- var plugins = common.getPlugins({
476
- entityId: entityId,
477
- token: token,
478
- apiHost: apiHost,
467
+ queryFn: function () { return __awaiter(void 0, void 0, void 0, function () {
468
+ var plugins;
469
+ return __generator(this, function (_a) {
470
+ switch (_a.label) {
471
+ case 0: return [4 /*yield*/, common.getPlugins({
472
+ entityId: entityId,
473
+ token: token,
474
+ apiHost: apiHost,
475
+ })];
476
+ case 1:
477
+ plugins = _a.sent();
478
+ return [2 /*return*/, plugins];
479
+ }
479
480
  });
480
- return plugins;
481
- },
481
+ }); },
482
482
  enabled: Boolean(entityId),
483
483
  });
484
484
  return response;
@@ -1276,7 +1276,6 @@ var CardIcon = function () {
1276
1276
  var Text$c = antd.Typography.Text;
1277
1277
  var PaymentMethodSelector = function (_a) {
1278
1278
  var paymentMethodAllowedPlugins = _a.paymentMethodAllowedPlugins, onSelect = _a.onSelect, value = _a.value;
1279
- console.log("COMPS paymentMethodAllowedPlugins", paymentMethodAllowedPlugins);
1280
1279
  return (jsxRuntime.jsx("div", __assign({ className: "flex flex-col gap-2" }, { children: paymentMethodAllowedPlugins === null || paymentMethodAllowedPlugins === void 0 ? void 0 : paymentMethodAllowedPlugins.map(function (plugin, index) { return (jsxRuntime.jsx(PaymentOption, { name: plugin.name, onClick: onSelect, paymentPlugin: plugin, selected: (value === null || value === void 0 ? void 0 : value.id) === plugin.id }, index)); }) })));
1281
1280
  };
1282
1281
  var PaymentOption = function (_a) {
@@ -1341,23 +1340,28 @@ function useRemovePaymentMethod(paymentPlugins, apiHost, entityId, token, accoun
1341
1340
  var Panel = antd.Collapse.Panel;
1342
1341
  var PaymentForm = function (_a) {
1343
1342
  var _b;
1344
- var entityId = _a.entityId, 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;
1343
+ var entityId = _a.entityId, 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;
1345
1344
  // Local state
1346
- var _c = react.useState(), selectedPaymentMethod = _c[0], setSelectedPaymentMethod = _c[1];
1347
- var _d = react.useState(false), showPaymentMethodForm = _d[0], setShowPaymentMethodForm = _d[1];
1345
+ var _d = react.useState(), selectedPaymentMethod = _d[0], setSelectedPaymentMethod = _d[1];
1346
+ var _e = react.useState(false), showPaymentMethodForm = _e[0], setShowPaymentMethodForm = _e[1];
1348
1347
  var paying = !!(quote || invoice);
1349
1348
  var currencyId = (_b = ((quote === null || quote === void 0 ? void 0 : quote.currencyId) ||
1350
1349
  (invoice === null || invoice === void 0 ? void 0 : invoice.currencyId) ||
1351
1350
  currencyIdFromProps)) === null || _b === void 0 ? void 0 : _b.toLowerCase();
1352
1351
  // Hooks
1353
1352
  var apiHost = react.useContext(BunnyContext).apiHost;
1354
- var token = useToken();
1355
- var _e = usePaymentMethod(graphQLClient, entityId, overrideToken || token, accountId), storedPaymentMethod = _e.data, isPaymentMethodLoading = _e.isLoading;
1356
- console.log("COMPS accountId", accountId);
1357
- console.log("COMPS storedPaymentMethod", storedPaymentMethod);
1353
+ var tokenFromContexts = useToken();
1354
+ var token = overrideToken || tokenFromContexts;
1355
+ var _f = usePaymentMethod(graphQLClient), storedPaymentMethod = _f.data, isPaymentMethodLoading = _f.isLoading;
1358
1356
  var isPaymentMethodFetched = storedPaymentMethod !== undefined;
1359
- var _f = usePaymentPlugins({ entityId: entityId, apiHost: apiHost, token: overrideToken || token }), paymentMethodAllowedPlugins = _f.paymentPlugins, arePluginsFetched = _f.isFetched;
1360
- var onClickRemove = useRemovePaymentMethod(paymentMethodAllowedPlugins || [], apiHost, entityId, overrideToken || token, accountId);
1357
+ var _g = usePaymentPlugins({ entityId: entityId, apiHost: apiHost, token: token }), allPaymentMethodAllowedPlugins = _g.paymentMethodAllowedPlugins, allPaymentPlugins = _g.paymentPlugins, arePluginsFetched = _g.isFetched;
1358
+ var paymentMethodAllowedPlugins = react.useMemo(function () {
1359
+ if (useAllPaymentPlugins) {
1360
+ return allPaymentPlugins;
1361
+ }
1362
+ return allPaymentMethodAllowedPlugins;
1363
+ }, [allPaymentMethodAllowedPlugins, allPaymentPlugins, useAllPaymentPlugins]);
1364
+ var onClickRemove = useRemovePaymentMethod(paymentMethodAllowedPlugins || [], apiHost, entityId, token, accountId);
1361
1365
  var queryClient = reactQuery.useQueryClient();
1362
1366
  // Set default plugin
1363
1367
  react.useEffect(function () {
@@ -1629,7 +1633,7 @@ var useSigningComplete = function (_a) {
1629
1633
  react.useEffect(function () {
1630
1634
  if (data && eventParam === "signing_complete") {
1631
1635
  data.state = "ACCEPTED";
1632
- queryClient.setQueryData(common.QueryKeyFactory.default.createQuoteKey(token), data);
1636
+ queryClient.setQueryData(common.QueryKeyFactory.default.createQuoteKey({ id: data === null || data === void 0 ? void 0 : data.id, token: token }), data);
1633
1637
  }
1634
1638
  }, [data, eventParam, queryClient, token]);
1635
1639
  };
@@ -19517,7 +19521,7 @@ var PaymentMethod = function (_a) {
19517
19521
  var paymentPlugins = usePaymentPlugins({ entityId: entityId, apiHost: apiHost, token: token }).paymentPlugins;
19518
19522
  var showSuccessNotification = common.useSuccessNotification();
19519
19523
  var handleAllErrorFormats = common.useAllErrorFormats(onTokenExpired);
19520
- var data = usePaymentMethod(graphQLClient, entityId, token).data;
19524
+ var data = usePaymentMethod(graphQLClient).data;
19521
19525
  var onClickRemove = useRemovePaymentMethod(paymentPlugins || [], apiHost, entityId, token);
19522
19526
  // Queries
19523
19527
  var billingDetails = reactQuery.useQuery({
@@ -19776,16 +19780,13 @@ var Checkout = function (_a) {
19776
19780
  }), taxationRequiredAccountFields = _f.data, isLoadingTaxationRequiredAccountFields = _f.isLoading;
19777
19781
  var _g = reactQuery.useQuery({
19778
19782
  queryKey: ["account", quote === null || quote === void 0 ? void 0 : quote.accountId],
19779
- queryFn: function () {
19780
- return (quote === null || quote === void 0 ? void 0 : quote.accountId) && common.getAccount({ id: quote.accountId, token: token, apiHost: apiHost });
19781
- },
19782
- enabled: Boolean(quote === null || quote === void 0 ? void 0 : quote.accountId) &&
19783
- ((taxationRequiredAccountFields === null || taxationRequiredAccountFields === void 0 ? void 0 : taxationRequiredAccountFields.length) || 0) > 0,
19783
+ queryFn: function () { return (quote === null || quote === void 0 ? void 0 : quote.accountId) && common.getAccount({ id: quote.accountId, token: token, apiHost: apiHost }); },
19784
+ enabled: Boolean(quote === null || quote === void 0 ? void 0 : quote.accountId) && ((taxationRequiredAccountFields === null || taxationRequiredAccountFields === void 0 ? void 0 : taxationRequiredAccountFields.length) || 0) > 0,
19784
19785
  }), account = _g.data, isLoadingAccount = _g.isLoading;
19785
19786
  reactQuery.useQuery({
19786
- queryKey: queryKeyFactory.createQuoteTaxCalculateKey(quote === null || quote === void 0 ? void 0 : quote.id, token),
19787
+ queryKey: queryKeyFactory.createQuoteTaxCalculateKey({ id: quote === null || quote === void 0 ? void 0 : quote.id, token: token }),
19787
19788
  queryFn: function () { return __awaiter(void 0, void 0, void 0, function () {
19788
- var updatedQuote;
19789
+ var updatedQuote, quoteKey, calculatedPricesKey;
19789
19790
  return __generator(this, function (_a) {
19790
19791
  switch (_a.label) {
19791
19792
  case 0:
@@ -19798,8 +19799,14 @@ var Checkout = function (_a) {
19798
19799
  case 1:
19799
19800
  updatedQuote = _a.sent();
19800
19801
  if (updatedQuote) {
19801
- queryClient.setQueryData(queryKeyFactory.createObjectKey("editingQuote", updatedQuote.id), updatedQuote);
19802
- queryClient.setQueryData(queryKeyFactory.calculatedPricesKey(quantity, selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id, token), updatedQuote);
19802
+ quoteKey = queryKeyFactory.createObjectKey({ objectName: "editingQuote", id: updatedQuote.id, token: token });
19803
+ calculatedPricesKey = queryKeyFactory.calculatedPricesKey({
19804
+ quantity: quantity,
19805
+ priceListId: selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id,
19806
+ token: token,
19807
+ });
19808
+ queryClient.setQueryData(quoteKey, updatedQuote);
19809
+ queryClient.setQueryData(calculatedPricesKey, updatedQuote);
19803
19810
  }
19804
19811
  _a.label = 2;
19805
19812
  case 2: return [2 /*return*/, {}];
@@ -19945,7 +19952,6 @@ function PriceListDisplay(_a) {
19945
19952
  var priceListData = _a.priceListData, topNavImageUrl = _a.topNavImageUrl;
19946
19953
  if (!priceListData)
19947
19954
  return null;
19948
- console.log("topNavImageUrl", topNavImageUrl);
19949
19955
  return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx("div", __assign({ className: "flex flex-col justify-between h-full my-12" }, { children: jsxRuntime.jsxs("div", __assign({ className: "flex flex-col space-y-8" }, { children: [jsxRuntime.jsx(antd.Image, { width: 24, src: topNavImageUrl, alt: "Logo", preview: false }), jsxRuntime.jsxs("div", __assign({ className: "flex flex-col" }, { children: [jsxRuntime.jsx(Text$3, __assign({ className: "text-slate-500 font-bold text-lg" }, { children: priceListData.name })), jsxRuntime.jsxs(Text$3, __assign({ className: "font-bold text-xl" }, { children: [common.formatCurrency(priceListData.basePrice, priceListData.currencyId), " ", "/ month"] }))] })), priceListData.trialAllowed ? (jsxRuntime.jsxs("div", __assign({ className: "flex flex-col" }, { children: [jsxRuntime.jsxs(Text$3, __assign({ style: { fontSize: "16px" }, className: "text-slate-500" }, { children: [priceListData.trialLengthDays, " day trial"] })), jsxRuntime.jsx(Text$3, __assign({ className: "text-slate-500", style: { fontSize: "12px" } }, { children: "You will not be charged until the last day of the trial." }))] }))) : null] })) })) }));
19950
19956
  }
19951
19957
 
@@ -19954,16 +19960,17 @@ function Signup(_a) {
19954
19960
  var companyName = _a.companyName, entityId = _a.entityId, priceListCode = _a.priceListCode, returnUrl = _a.returnUrl, _b = _a.isCardEnabled, isCardEnabled = _b === void 0 ? true : _b, className = _a.className, _c = _a.shadow, shadow = _c === void 0 ? "shadow-md" : _c, style = _a.style;
19955
19961
  // Hooks
19956
19962
  var _d = react.useContext(BunnyContext), apiHost = _d.apiHost, graphQLClient = _d.graphQLClient;
19957
- var token = useToken();
19963
+ var tokenFromContexts = useToken();
19958
19964
  var isMobile = common.useIsMobile();
19959
19965
  var topNavImageUrl = react.useContext(BrandContext).topNavImageUrl;
19960
19966
  var _e = react.useState(undefined), quote = _e[0], setQuote = _e[1];
19961
19967
  var _f = react.useState(undefined), accountId = _f[0], setAccountId = _f[1];
19962
19968
  var _g = react.useState(undefined), portalSessionToken = _g[0], setPortalSessionToken = _g[1];
19969
+ var token = portalSessionToken || tokenFromContexts;
19963
19970
  var _h = react.useState(false), proceedingToPayment = _h[0], setProceedingToPayment = _h[1];
19964
19971
  var _j = react.useState(false), purchaseSucceeded = _j[0], setPurchaseSucceeded = _j[1];
19965
19972
  var _k = react.useState(undefined), paymentMethodGraphQLClient = _k[0], setPaymentMethodGraphQLClient = _k[1];
19966
- var paymentMethod = usePaymentMethod(paymentMethodGraphQLClient || graphQLClient, entityId, token).data;
19973
+ var paymentMethod = usePaymentMethod(paymentMethodGraphQLClient || graphQLClient).data;
19967
19974
  var queryClient = reactQuery.useQueryClient();
19968
19975
  // Queries
19969
19976
  var priceListData = reactQuery.useQuery({
@@ -20006,7 +20013,7 @@ function Signup(_a) {
20006
20013
  case 2:
20007
20014
  error_1 = _a.sent();
20008
20015
  setProceedingToPayment(false);
20009
- showErrorNotification(error_1);
20016
+ showErrorNotification(error_1.response.message);
20010
20017
  return [3 /*break*/, 3];
20011
20018
  case 3: return [2 /*return*/];
20012
20019
  }
@@ -20051,7 +20058,7 @@ function Signup(_a) {
20051
20058
  });
20052
20059
  }
20053
20060
  function handlePaymentFail(error) {
20054
- showErrorNotification(error.message);
20061
+ showErrorNotification(error.response.message);
20055
20062
  }
20056
20063
  var WrapperComponent = function (_a) {
20057
20064
  var children = _a.children, className = _a.className, style = _a.style;
@@ -20675,7 +20682,7 @@ function BillingDetailsSection(_a) {
20675
20682
  var showSuccessNotification = common.useSuccessNotification();
20676
20683
  // Queries
20677
20684
  var _d = reactQuery.useQuery({
20678
- queryKey: common.QueryKeyFactory.default.billingDetailsKey(entityId, token),
20685
+ queryKey: common.QueryKeyFactory.default.billingDetailsKey({ entityId: entityId, token: token }),
20679
20686
  queryFn: function () { return getBillingDetails({ token: token, apiHost: apiHost }); },
20680
20687
  }), billingDetails = _d.data, isLoadingBillingDetails = _d.isLoading;
20681
20688
  var _e = reactQuery.useMutation({
@@ -20699,7 +20706,7 @@ function BillingDetailsSection(_a) {
20699
20706
  })];
20700
20707
  case 1:
20701
20708
  updatedBillingDetails = _a.sent();
20702
- queryClient.setQueryData(common.QueryKeyFactory.default.billingDetailsKey(entityId, token), function (old) {
20709
+ queryClient.setQueryData(common.QueryKeyFactory.default.billingDetailsKey({ entityId: entityId, token: token }), function (old) {
20703
20710
  return __assign(__assign({}, old), updatedBillingDetails.billingDetails);
20704
20711
  });
20705
20712
  return [2 /*return*/, updatedBillingDetails];
@@ -20709,7 +20716,7 @@ function BillingDetailsSection(_a) {
20709
20716
  onSuccess: function () {
20710
20717
  showSuccessNotification("Your account details have been saved");
20711
20718
  queryClient.invalidateQueries({
20712
- queryKey: common.QueryKeyFactory.default.taxationRequiredAccountFieldsKey(entityId, token),
20719
+ queryKey: common.QueryKeyFactory.default.taxationRequiredAccountFieldsKey({ entityId: entityId, token: token }),
20713
20720
  });
20714
20721
  },
20715
20722
  }), updateBillingDetails = _e.mutate, isUpdatingBillingDetails = _e.isPending;
@@ -20790,9 +20797,7 @@ function BillingDetailsSection(_a) {
20790
20797
  });
20791
20798
  }); };
20792
20799
  var filteredCountryList = react.useMemo(function () {
20793
- return countryListFilter
20794
- ? common.Lists.COUNTRY_LIST.filter(countryListFilter)
20795
- : common.Lists.COUNTRY_LIST;
20800
+ return countryListFilter ? common.Lists.COUNTRY_LIST.filter(countryListFilter) : common.Lists.COUNTRY_LIST;
20796
20801
  }, [countryListFilter]);
20797
20802
  return (jsxRuntime.jsxs("div", __assign({ className: "".concat(isMobile || hidePaymentMethodForm ? "w-full" : "w-1/2", " px-4") }, { children: [jsxRuntime.jsx(antd.Skeleton, __assign({ loading: isLoadingBillingDetails }, { children: jsxRuntime.jsxs(antd.Form, __assign({ className: "flex flex-col gap-2", form: form, layout: "vertical", disabled: isUpdatingBillingDetails, autoComplete: "off" }, { children: [jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Account name", name: "name", rules: [{ required: true, message: "Account name is required" }] }, { children: jsxRuntime.jsx(antd.Input, {}) })), jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Street address", name: "billingStreet", rules: [{ required: true, message: "Street address is required" }] }, { children: jsxRuntime.jsx(antd.Input, {}) })), jsxRuntime.jsxs("div", __assign({ className: "flex gap-4" }, { children: [jsxRuntime.jsx(antd.Form.Item, __assign({ label: "City", name: "billingCity", rules: [{ required: true, message: "City is required" }], className: "flex-1" }, { children: jsxRuntime.jsx(antd.Input, {}) })), jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Zipcode", name: "billingZip", rules: [{ required: true, message: "Zipcode is required" }], className: "flex-1" }, { children: jsxRuntime.jsx(antd.Input, {}) }))] })), jsxRuntime.jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col pb-2" : "flex-row", " gap-4") }, { children: [jsxRuntime.jsx(antd.Form.Item, __assign({ label: "State", name: "billingState", className: "flex-1", rules: [
20798
20803
  {
@@ -20800,12 +20805,8 @@ function BillingDetailsSection(_a) {
20800
20805
  },
20801
20806
  ] }, { children: jsxRuntime.jsx(antd.Input, {}) })), jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Country", name: "billingCountry", className: "flex-1", rules: [{ required: true, message: "Country is required" }] }, { children: jsxRuntime.jsx(antd.Select, { options: filteredCountryList, placeholder: "Select a country", showSearch: true, filterOption: function (input, option) {
20802
20807
  var _a, _b;
20803
- return ((_a = option === null || option === void 0 ? void 0 : option.label) !== null && _a !== void 0 ? _a : "")
20804
- .toLowerCase()
20805
- .includes(input.toLowerCase()) ||
20806
- ((_b = option === null || option === void 0 ? void 0 : option.value) !== null && _b !== void 0 ? _b : "")
20807
- .toLowerCase()
20808
- .includes(input.toLowerCase());
20808
+ return ((_a = option === null || option === void 0 ? void 0 : option.label) !== null && _a !== void 0 ? _a : "").toLowerCase().includes(input.toLowerCase()) ||
20809
+ ((_b = option === null || option === void 0 ? void 0 : option.value) !== null && _b !== void 0 ? _b : "").toLowerCase().includes(input.toLowerCase());
20809
20810
  } }) }))] })), jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Email", name: "billingContactEmail", rules: [
20810
20811
  {
20811
20812
  required: true,
@@ -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;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  declare const Card: ({ children, className, style, }: {
3
2
  children: React.ReactNode;
4
3
  className?: string | undefined;
@@ -1,7 +1,6 @@
1
- /// <reference types="react" />
2
1
  import { FormattedInvoice, PluginData, Quote } from "@bunnyapp/common";
3
2
  import { GraphQLClient } from "graphql-request";
4
- export declare const PaymentForm: ({ entityId, invoice, onFail, onPaymentSuccess, quote, accountId, onSavePaymentMethod, overrideToken, graphQLClient, customCheckoutFunction, currencyId: currencyIdFromProps, customPaymentForms, }: {
3
+ export declare const PaymentForm: ({ entityId, invoice, onFail, onPaymentSuccess, quote, accountId, onSavePaymentMethod, overrideToken, graphQLClient, customCheckoutFunction, currencyId: currencyIdFromProps, customPaymentForms, useAllPaymentPlugins, }: {
5
4
  entityId: string;
6
5
  invoice?: FormattedInvoice | undefined;
7
6
  quote?: Quote | undefined;
@@ -14,4 +13,5 @@ export declare const PaymentForm: ({ entityId, invoice, onFail, onPaymentSuccess
14
13
  customCheckoutFunction?: ((plugin: PluginData | undefined) => Promise<any>) | undefined;
15
14
  currencyId?: string | undefined;
16
15
  customPaymentForms?: Record<string, import("react").ReactNode> | undefined;
16
+ useAllPaymentPlugins?: boolean | undefined;
17
17
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { PaymentMethod, PluginData } from "@bunnyapp/common";
3
2
  declare const PaymentMethodDetails: ({ onFail, paymentMethod, onSavePaymentMethod, customPaymentForms, }: {
4
3
  onFail: (error: any) => void;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { Meta, StoryObj } from "@storybook/react";
3
2
  import Quote from "./Quote";
4
3
  declare const meta: Meta<typeof Quote>;
@@ -18,16 +17,16 @@ export declare const Default: import("@storybook/core/csf").StoryAnnotations<imp
18
17
  onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
19
18
  onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
20
19
  }, {
21
- backButtonName?: string | undefined;
22
- onBackButtonClick?: (() => void) | undefined;
23
- shadow?: import("../../types/shadowType").ShadowType | undefined;
24
- hideDownloadButton?: boolean | undefined;
25
- id?: string | undefined;
26
20
  className?: string | undefined;
27
21
  entityId?: string | undefined;
28
- onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
22
+ shadow?: import("../../types/shadowType").ShadowType | undefined;
23
+ id?: string | undefined;
29
24
  invoiceQuoteViewComponent?: import("react").ReactNode;
25
+ backButtonName?: string | undefined;
26
+ onBackButtonClick?: (() => void) | undefined;
30
27
  onInvoiceDownloadError?: (() => void) | undefined;
28
+ onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
29
+ hideDownloadButton?: boolean | undefined;
31
30
  onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
32
31
  onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
33
32
  }>;
@@ -45,16 +44,16 @@ export declare const NoShadow: import("@storybook/core/csf").StoryAnnotations<im
45
44
  onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
46
45
  onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
47
46
  }, {
48
- backButtonName?: string | undefined;
49
- onBackButtonClick?: (() => void) | undefined;
50
- shadow?: import("../../types/shadowType").ShadowType | undefined;
51
- hideDownloadButton?: boolean | undefined;
52
- id?: string | undefined;
53
47
  className?: string | undefined;
54
48
  entityId?: string | undefined;
55
- onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
49
+ shadow?: import("../../types/shadowType").ShadowType | undefined;
50
+ id?: string | undefined;
56
51
  invoiceQuoteViewComponent?: import("react").ReactNode;
52
+ backButtonName?: string | undefined;
53
+ onBackButtonClick?: (() => void) | undefined;
57
54
  onInvoiceDownloadError?: (() => void) | undefined;
55
+ onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
56
+ hideDownloadButton?: boolean | undefined;
58
57
  onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
59
58
  onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
60
59
  }>;
@@ -72,16 +71,16 @@ export declare const Mobile: import("@storybook/core/csf").StoryAnnotations<impo
72
71
  onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
73
72
  onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
74
73
  }, {
75
- backButtonName?: string | undefined;
76
- onBackButtonClick?: (() => void) | undefined;
77
- shadow?: import("../../types/shadowType").ShadowType | undefined;
78
- hideDownloadButton?: boolean | undefined;
79
- id?: string | undefined;
80
74
  className?: string | undefined;
81
75
  entityId?: string | undefined;
82
- onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
76
+ shadow?: import("../../types/shadowType").ShadowType | undefined;
77
+ id?: string | undefined;
83
78
  invoiceQuoteViewComponent?: import("react").ReactNode;
79
+ backButtonName?: string | undefined;
80
+ onBackButtonClick?: (() => void) | undefined;
84
81
  onInvoiceDownloadError?: (() => void) | undefined;
82
+ onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
83
+ hideDownloadButton?: boolean | undefined;
85
84
  onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
86
85
  onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
87
86
  }>;
@@ -99,16 +98,16 @@ export declare const CustomClassName: import("@storybook/core/csf").StoryAnnotat
99
98
  onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
100
99
  onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
101
100
  }, {
102
- backButtonName?: string | undefined;
103
- onBackButtonClick?: (() => void) | undefined;
104
- shadow?: import("../../types/shadowType").ShadowType | undefined;
105
- hideDownloadButton?: boolean | undefined;
106
- id?: string | undefined;
107
101
  className?: string | undefined;
108
102
  entityId?: string | undefined;
109
- onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
103
+ shadow?: import("../../types/shadowType").ShadowType | undefined;
104
+ id?: string | undefined;
110
105
  invoiceQuoteViewComponent?: import("react").ReactNode;
106
+ backButtonName?: string | undefined;
107
+ onBackButtonClick?: (() => void) | undefined;
111
108
  onInvoiceDownloadError?: (() => void) | undefined;
109
+ onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
110
+ hideDownloadButton?: boolean | undefined;
112
111
  onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
113
112
  onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
114
113
  }>;
@@ -129,16 +128,16 @@ export declare const DarkMode: import("@storybook/core/csf").StoryAnnotations<im
129
128
  onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
130
129
  onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
131
130
  }, {
132
- backButtonName?: string | undefined;
133
- onBackButtonClick?: (() => void) | undefined;
134
- shadow?: import("../../types/shadowType").ShadowType | undefined;
135
- hideDownloadButton?: boolean | undefined;
136
- id?: string | undefined;
137
131
  className?: string | undefined;
138
132
  entityId?: string | undefined;
139
- onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
133
+ shadow?: import("../../types/shadowType").ShadowType | undefined;
134
+ id?: string | undefined;
140
135
  invoiceQuoteViewComponent?: import("react").ReactNode;
136
+ backButtonName?: string | undefined;
137
+ onBackButtonClick?: (() => void) | undefined;
141
138
  onInvoiceDownloadError?: (() => void) | undefined;
139
+ onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
140
+ hideDownloadButton?: boolean | undefined;
142
141
  onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
143
142
  onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
144
143
  }>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { Subscription } from "@bunnyapp/common";
3
2
  import "../../styles/index.less";
4
3
  export type EditingQuoteDataType = {
@@ -15,7 +14,7 @@ declare const Subscriptions: ({ className, companyName, entityId, hideExpired, o
15
14
  onSubscriptionsLoaded?: ((subscriptions: Subscription[]) => void) | undefined;
16
15
  styles?: {
17
16
  gap?: number | undefined;
18
- shadow?: "none" | "lg" | "md" | "sm" | undefined;
17
+ shadow?: "none" | "sm" | "md" | "lg" | undefined;
19
18
  subscriptionProductNameStyle?: import("react").CSSProperties | undefined;
20
19
  } | undefined;
21
20
  noSubscriptionsComponent?: React.ReactNode;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  declare const useSendAcceptQuote: ({ entityId, onTokenExpired, quoteId, apiHost, token, }: {
3
2
  entityId: string;
4
3
  onTokenExpired?: (() => void) | undefined;
@@ -1,5 +1,5 @@
1
1
  declare const useSigningComplete: ({ data, token }: {
2
2
  data: any;
3
- token?: string | undefined;
3
+ token: string;
4
4
  }) => void;
5
5
  export default useSigningComplete;
@@ -1,5 +1,10 @@
1
1
  import { GraphQLClient } from "graphql-request";
2
- export declare const usePaymentMethod: (graphQLClient: GraphQLClient, entityId?: string, token?: string, accountId?: string) => {
2
+ export declare const usePaymentMethod: ({ accountId, entityId, graphQLClient, token, }: {
3
+ accountId?: string | undefined;
4
+ entityId?: string | undefined;
5
+ graphQLClient: GraphQLClient;
6
+ token: string;
7
+ }) => {
3
8
  data: any;
4
9
  isLoading: boolean;
5
10
  };
@@ -1,6 +1,6 @@
1
- declare const usePlugins: ({ entityId, apiHost, token, }: {
1
+ declare const usePlugins: ({ entityId, apiHost, token }: {
2
2
  entityId: string;
3
3
  apiHost: string;
4
- token?: string | undefined;
4
+ token: string;
5
5
  }) => import("@tanstack/react-query/build/legacy/types").UseQueryResult<any, Error>;
6
6
  export default usePlugins;
@@ -1,2 +1,2 @@
1
- declare function useToken(): string | undefined;
1
+ declare function useToken(): string;
2
2
  export default useToken;
package/dist/esm/index.js CHANGED
@@ -204,9 +204,7 @@ function ContextualWrapper(_a) {
204
204
  var entityBranding = useMemo(function () {
205
205
  var _a;
206
206
  // This is to determine if the secondary color should be white or black
207
- var brandColor = (branding === null || branding === void 0 ? void 0 : branding.brandColor)
208
- ? "#" + ((_a = branding === null || branding === void 0 ? void 0 : branding.brandColor) === null || _a === void 0 ? void 0 : _a.toString(16))
209
- : DEFAULT_BRAND_COLOR;
207
+ var brandColor = (branding === null || branding === void 0 ? void 0 : branding.brandColor) ? "#" + ((_a = branding === null || branding === void 0 ? void 0 : branding.brandColor) === null || _a === void 0 ? void 0 : _a.toString(16)) : DEFAULT_BRAND_COLOR;
210
208
  var secondaryColor = DEFAULT_SECONDARY_COLOR;
211
209
  if (!isMobile && isColorTooDark(branding === null || branding === void 0 ? void 0 : branding.accentColor))
212
210
  secondaryColor = "#ffffff";
@@ -241,17 +239,11 @@ function ContextualWrapper(_a) {
241
239
  boxShadowSecondary: "none",
242
240
  fontWeight: "normal",
243
241
  contentFontSizeLG: 14,
244
- colorBgContainerDisabled: darkMode
245
- ? "var(--row-background-dark)"
246
- : "#eef0f2",
247
- borderColorDisabled: darkMode
248
- ? "var(--row-background-dark)"
249
- : "#eef0f2",
242
+ colorBgContainerDisabled: darkMode ? "var(--row-background-dark)" : "#eef0f2",
243
+ borderColorDisabled: darkMode ? "var(--row-background-dark)" : "#eef0f2",
250
244
  },
251
245
  Drawer: {
252
- colorBgElevated: darkMode
253
- ? "var(--row-background-dark)"
254
- : SLATE_50,
246
+ colorBgElevated: darkMode ? "var(--row-background-dark)" : SLATE_50,
255
247
  },
256
248
  Divider: {
257
249
  colorSplit: darkMode ? SLATE_400 : SLATE_200,
@@ -419,9 +411,10 @@ function InvoicePDF(_a) {
419
411
  }
420
412
 
421
413
  var paymentMethodsQuery = "query paymentMethods ($filter: String, $first: Int, $sort: String) {\n paymentMethods (filter: $filter, first: $first, sort: $sort) {\n nodes {\n id\n disabled\n pluginId\n accountId\n expirationDate\n plugin {\n guid\n id\n }\n state\n metadata {\n issuer\n identifier\n kind\n description\n icon\n }\n }\n }\n}";
422
- var usePaymentMethod = function (graphQLClient, entityId, token, accountId) {
423
- var _a = useQuery({
424
- queryKey: QueryKeyFactory.default.accountPaymentMethodKey(entityId, token, accountId),
414
+ var usePaymentMethod = function (_a) {
415
+ var accountId = _a.accountId, entityId = _a.entityId, graphQLClient = _a.graphQLClient, token = _a.token;
416
+ var _b = useQuery({
417
+ queryKey: QueryKeyFactory.default.accountPaymentMethodKey({ entityId: entityId, token: token, accountId: accountId }),
425
418
  queryFn: function () {
426
419
  return graphQLClient
427
420
  .request(paymentMethodsQuery, {
@@ -435,7 +428,7 @@ var usePaymentMethod = function (graphQLClient, entityId, token, accountId) {
435
428
  return paymentMethod;
436
429
  });
437
430
  },
438
- }), data = _a.data, isLoading = _a.isLoading;
431
+ }), data = _b.data, isLoading = _b.isLoading;
439
432
  return { data: data, isLoading: isLoading };
440
433
  };
441
434
 
@@ -443,14 +436,21 @@ var usePlugins = function (_a) {
443
436
  var entityId = _a.entityId, apiHost = _a.apiHost, token = _a.token;
444
437
  var response = useQuery({
445
438
  queryKey: QueryKeyFactory.default.pluginsKey(token),
446
- queryFn: function () {
447
- var plugins = getPlugins({
448
- entityId: entityId,
449
- token: token,
450
- apiHost: apiHost,
439
+ queryFn: function () { return __awaiter(void 0, void 0, void 0, function () {
440
+ var plugins;
441
+ return __generator(this, function (_a) {
442
+ switch (_a.label) {
443
+ case 0: return [4 /*yield*/, getPlugins({
444
+ entityId: entityId,
445
+ token: token,
446
+ apiHost: apiHost,
447
+ })];
448
+ case 1:
449
+ plugins = _a.sent();
450
+ return [2 /*return*/, plugins];
451
+ }
451
452
  });
452
- return plugins;
453
- },
453
+ }); },
454
454
  enabled: Boolean(entityId),
455
455
  });
456
456
  return response;
@@ -1248,7 +1248,6 @@ var CardIcon = function () {
1248
1248
  var Text$c = Typography.Text;
1249
1249
  var PaymentMethodSelector = function (_a) {
1250
1250
  var paymentMethodAllowedPlugins = _a.paymentMethodAllowedPlugins, onSelect = _a.onSelect, value = _a.value;
1251
- console.log("COMPS paymentMethodAllowedPlugins", paymentMethodAllowedPlugins);
1252
1251
  return (jsx("div", __assign({ className: "flex flex-col gap-2" }, { children: paymentMethodAllowedPlugins === null || paymentMethodAllowedPlugins === void 0 ? void 0 : paymentMethodAllowedPlugins.map(function (plugin, index) { return (jsx(PaymentOption, { name: plugin.name, onClick: onSelect, paymentPlugin: plugin, selected: (value === null || value === void 0 ? void 0 : value.id) === plugin.id }, index)); }) })));
1253
1252
  };
1254
1253
  var PaymentOption = function (_a) {
@@ -1313,23 +1312,28 @@ function useRemovePaymentMethod(paymentPlugins, apiHost, entityId, token, accoun
1313
1312
  var Panel = Collapse.Panel;
1314
1313
  var PaymentForm = function (_a) {
1315
1314
  var _b;
1316
- var entityId = _a.entityId, 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;
1315
+ var entityId = _a.entityId, 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;
1317
1316
  // Local state
1318
- var _c = useState(), selectedPaymentMethod = _c[0], setSelectedPaymentMethod = _c[1];
1319
- var _d = useState(false), showPaymentMethodForm = _d[0], setShowPaymentMethodForm = _d[1];
1317
+ var _d = useState(), selectedPaymentMethod = _d[0], setSelectedPaymentMethod = _d[1];
1318
+ var _e = useState(false), showPaymentMethodForm = _e[0], setShowPaymentMethodForm = _e[1];
1320
1319
  var paying = !!(quote || invoice);
1321
1320
  var currencyId = (_b = ((quote === null || quote === void 0 ? void 0 : quote.currencyId) ||
1322
1321
  (invoice === null || invoice === void 0 ? void 0 : invoice.currencyId) ||
1323
1322
  currencyIdFromProps)) === null || _b === void 0 ? void 0 : _b.toLowerCase();
1324
1323
  // Hooks
1325
1324
  var apiHost = useContext(BunnyContext).apiHost;
1326
- var token = useToken();
1327
- var _e = usePaymentMethod(graphQLClient, entityId, overrideToken || token, accountId), storedPaymentMethod = _e.data, isPaymentMethodLoading = _e.isLoading;
1328
- console.log("COMPS accountId", accountId);
1329
- console.log("COMPS storedPaymentMethod", storedPaymentMethod);
1325
+ var tokenFromContexts = useToken();
1326
+ var token = overrideToken || tokenFromContexts;
1327
+ var _f = usePaymentMethod(graphQLClient), storedPaymentMethod = _f.data, isPaymentMethodLoading = _f.isLoading;
1330
1328
  var isPaymentMethodFetched = storedPaymentMethod !== undefined;
1331
- var _f = usePaymentPlugins({ entityId: entityId, apiHost: apiHost, token: overrideToken || token }), paymentMethodAllowedPlugins = _f.paymentPlugins, arePluginsFetched = _f.isFetched;
1332
- var onClickRemove = useRemovePaymentMethod(paymentMethodAllowedPlugins || [], apiHost, entityId, overrideToken || token, accountId);
1329
+ var _g = usePaymentPlugins({ entityId: entityId, apiHost: apiHost, token: token }), allPaymentMethodAllowedPlugins = _g.paymentMethodAllowedPlugins, allPaymentPlugins = _g.paymentPlugins, arePluginsFetched = _g.isFetched;
1330
+ var paymentMethodAllowedPlugins = useMemo(function () {
1331
+ if (useAllPaymentPlugins) {
1332
+ return allPaymentPlugins;
1333
+ }
1334
+ return allPaymentMethodAllowedPlugins;
1335
+ }, [allPaymentMethodAllowedPlugins, allPaymentPlugins, useAllPaymentPlugins]);
1336
+ var onClickRemove = useRemovePaymentMethod(paymentMethodAllowedPlugins || [], apiHost, entityId, token, accountId);
1333
1337
  var queryClient = useQueryClient();
1334
1338
  // Set default plugin
1335
1339
  useEffect(function () {
@@ -1601,7 +1605,7 @@ var useSigningComplete = function (_a) {
1601
1605
  useEffect(function () {
1602
1606
  if (data && eventParam === "signing_complete") {
1603
1607
  data.state = "ACCEPTED";
1604
- queryClient.setQueryData(QueryKeyFactory.default.createQuoteKey(token), data);
1608
+ queryClient.setQueryData(QueryKeyFactory.default.createQuoteKey({ id: data === null || data === void 0 ? void 0 : data.id, token: token }), data);
1605
1609
  }
1606
1610
  }, [data, eventParam, queryClient, token]);
1607
1611
  };
@@ -19489,7 +19493,7 @@ var PaymentMethod = function (_a) {
19489
19493
  var paymentPlugins = usePaymentPlugins({ entityId: entityId, apiHost: apiHost, token: token }).paymentPlugins;
19490
19494
  var showSuccessNotification = useSuccessNotification();
19491
19495
  var handleAllErrorFormats = useAllErrorFormats(onTokenExpired);
19492
- var data = usePaymentMethod(graphQLClient, entityId, token).data;
19496
+ var data = usePaymentMethod(graphQLClient).data;
19493
19497
  var onClickRemove = useRemovePaymentMethod(paymentPlugins || [], apiHost, entityId, token);
19494
19498
  // Queries
19495
19499
  var billingDetails = useQuery({
@@ -19748,16 +19752,13 @@ var Checkout = function (_a) {
19748
19752
  }), taxationRequiredAccountFields = _f.data, isLoadingTaxationRequiredAccountFields = _f.isLoading;
19749
19753
  var _g = useQuery({
19750
19754
  queryKey: ["account", quote === null || quote === void 0 ? void 0 : quote.accountId],
19751
- queryFn: function () {
19752
- return (quote === null || quote === void 0 ? void 0 : quote.accountId) && getAccount({ id: quote.accountId, token: token, apiHost: apiHost });
19753
- },
19754
- enabled: Boolean(quote === null || quote === void 0 ? void 0 : quote.accountId) &&
19755
- ((taxationRequiredAccountFields === null || taxationRequiredAccountFields === void 0 ? void 0 : taxationRequiredAccountFields.length) || 0) > 0,
19755
+ queryFn: function () { return (quote === null || quote === void 0 ? void 0 : quote.accountId) && getAccount({ id: quote.accountId, token: token, apiHost: apiHost }); },
19756
+ enabled: Boolean(quote === null || quote === void 0 ? void 0 : quote.accountId) && ((taxationRequiredAccountFields === null || taxationRequiredAccountFields === void 0 ? void 0 : taxationRequiredAccountFields.length) || 0) > 0,
19756
19757
  }), account = _g.data, isLoadingAccount = _g.isLoading;
19757
19758
  useQuery({
19758
- queryKey: queryKeyFactory.createQuoteTaxCalculateKey(quote === null || quote === void 0 ? void 0 : quote.id, token),
19759
+ queryKey: queryKeyFactory.createQuoteTaxCalculateKey({ id: quote === null || quote === void 0 ? void 0 : quote.id, token: token }),
19759
19760
  queryFn: function () { return __awaiter(void 0, void 0, void 0, function () {
19760
- var updatedQuote;
19761
+ var updatedQuote, quoteKey, calculatedPricesKey;
19761
19762
  return __generator(this, function (_a) {
19762
19763
  switch (_a.label) {
19763
19764
  case 0:
@@ -19770,8 +19771,14 @@ var Checkout = function (_a) {
19770
19771
  case 1:
19771
19772
  updatedQuote = _a.sent();
19772
19773
  if (updatedQuote) {
19773
- queryClient.setQueryData(queryKeyFactory.createObjectKey("editingQuote", updatedQuote.id), updatedQuote);
19774
- queryClient.setQueryData(queryKeyFactory.calculatedPricesKey(quantity, selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id, token), updatedQuote);
19774
+ quoteKey = queryKeyFactory.createObjectKey({ objectName: "editingQuote", id: updatedQuote.id, token: token });
19775
+ calculatedPricesKey = queryKeyFactory.calculatedPricesKey({
19776
+ quantity: quantity,
19777
+ priceListId: selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id,
19778
+ token: token,
19779
+ });
19780
+ queryClient.setQueryData(quoteKey, updatedQuote);
19781
+ queryClient.setQueryData(calculatedPricesKey, updatedQuote);
19775
19782
  }
19776
19783
  _a.label = 2;
19777
19784
  case 2: return [2 /*return*/, {}];
@@ -19917,7 +19924,6 @@ function PriceListDisplay(_a) {
19917
19924
  var priceListData = _a.priceListData, topNavImageUrl = _a.topNavImageUrl;
19918
19925
  if (!priceListData)
19919
19926
  return null;
19920
- console.log("topNavImageUrl", topNavImageUrl);
19921
19927
  return (jsx(Fragment, { children: jsx("div", __assign({ className: "flex flex-col justify-between h-full my-12" }, { children: jsxs("div", __assign({ className: "flex flex-col space-y-8" }, { children: [jsx(Image, { width: 24, src: topNavImageUrl, alt: "Logo", preview: false }), jsxs("div", __assign({ className: "flex flex-col" }, { children: [jsx(Text$3, __assign({ className: "text-slate-500 font-bold text-lg" }, { children: priceListData.name })), jsxs(Text$3, __assign({ className: "font-bold text-xl" }, { children: [formatCurrency(priceListData.basePrice, priceListData.currencyId), " ", "/ month"] }))] })), priceListData.trialAllowed ? (jsxs("div", __assign({ className: "flex flex-col" }, { children: [jsxs(Text$3, __assign({ style: { fontSize: "16px" }, className: "text-slate-500" }, { children: [priceListData.trialLengthDays, " day trial"] })), jsx(Text$3, __assign({ className: "text-slate-500", style: { fontSize: "12px" } }, { children: "You will not be charged until the last day of the trial." }))] }))) : null] })) })) }));
19922
19928
  }
19923
19929
 
@@ -19926,16 +19932,17 @@ function Signup(_a) {
19926
19932
  var companyName = _a.companyName, entityId = _a.entityId, priceListCode = _a.priceListCode, returnUrl = _a.returnUrl, _b = _a.isCardEnabled, isCardEnabled = _b === void 0 ? true : _b, className = _a.className, _c = _a.shadow, shadow = _c === void 0 ? "shadow-md" : _c, style = _a.style;
19927
19933
  // Hooks
19928
19934
  var _d = useContext(BunnyContext), apiHost = _d.apiHost, graphQLClient = _d.graphQLClient;
19929
- var token = useToken();
19935
+ var tokenFromContexts = useToken();
19930
19936
  var isMobile = useIsMobile();
19931
19937
  var topNavImageUrl = useContext(BrandContext).topNavImageUrl;
19932
19938
  var _e = useState(undefined), quote = _e[0], setQuote = _e[1];
19933
19939
  var _f = useState(undefined), accountId = _f[0], setAccountId = _f[1];
19934
19940
  var _g = useState(undefined), portalSessionToken = _g[0], setPortalSessionToken = _g[1];
19941
+ var token = portalSessionToken || tokenFromContexts;
19935
19942
  var _h = useState(false), proceedingToPayment = _h[0], setProceedingToPayment = _h[1];
19936
19943
  var _j = useState(false), purchaseSucceeded = _j[0], setPurchaseSucceeded = _j[1];
19937
19944
  var _k = useState(undefined), paymentMethodGraphQLClient = _k[0], setPaymentMethodGraphQLClient = _k[1];
19938
- var paymentMethod = usePaymentMethod(paymentMethodGraphQLClient || graphQLClient, entityId, token).data;
19945
+ var paymentMethod = usePaymentMethod(paymentMethodGraphQLClient || graphQLClient).data;
19939
19946
  var queryClient = useQueryClient();
19940
19947
  // Queries
19941
19948
  var priceListData = useQuery({
@@ -19978,7 +19985,7 @@ function Signup(_a) {
19978
19985
  case 2:
19979
19986
  error_1 = _a.sent();
19980
19987
  setProceedingToPayment(false);
19981
- showErrorNotification(error_1);
19988
+ showErrorNotification(error_1.response.message);
19982
19989
  return [3 /*break*/, 3];
19983
19990
  case 3: return [2 /*return*/];
19984
19991
  }
@@ -20023,7 +20030,7 @@ function Signup(_a) {
20023
20030
  });
20024
20031
  }
20025
20032
  function handlePaymentFail(error) {
20026
- showErrorNotification(error.message);
20033
+ showErrorNotification(error.response.message);
20027
20034
  }
20028
20035
  var WrapperComponent = function (_a) {
20029
20036
  var children = _a.children, className = _a.className, style = _a.style;
@@ -20647,7 +20654,7 @@ function BillingDetailsSection(_a) {
20647
20654
  var showSuccessNotification = useSuccessNotification();
20648
20655
  // Queries
20649
20656
  var _d = useQuery({
20650
- queryKey: QueryKeyFactory.default.billingDetailsKey(entityId, token),
20657
+ queryKey: QueryKeyFactory.default.billingDetailsKey({ entityId: entityId, token: token }),
20651
20658
  queryFn: function () { return getBillingDetails({ token: token, apiHost: apiHost }); },
20652
20659
  }), billingDetails = _d.data, isLoadingBillingDetails = _d.isLoading;
20653
20660
  var _e = useMutation({
@@ -20671,7 +20678,7 @@ function BillingDetailsSection(_a) {
20671
20678
  })];
20672
20679
  case 1:
20673
20680
  updatedBillingDetails = _a.sent();
20674
- queryClient.setQueryData(QueryKeyFactory.default.billingDetailsKey(entityId, token), function (old) {
20681
+ queryClient.setQueryData(QueryKeyFactory.default.billingDetailsKey({ entityId: entityId, token: token }), function (old) {
20675
20682
  return __assign(__assign({}, old), updatedBillingDetails.billingDetails);
20676
20683
  });
20677
20684
  return [2 /*return*/, updatedBillingDetails];
@@ -20681,7 +20688,7 @@ function BillingDetailsSection(_a) {
20681
20688
  onSuccess: function () {
20682
20689
  showSuccessNotification("Your account details have been saved");
20683
20690
  queryClient.invalidateQueries({
20684
- queryKey: QueryKeyFactory.default.taxationRequiredAccountFieldsKey(entityId, token),
20691
+ queryKey: QueryKeyFactory.default.taxationRequiredAccountFieldsKey({ entityId: entityId, token: token }),
20685
20692
  });
20686
20693
  },
20687
20694
  }), updateBillingDetails = _e.mutate, isUpdatingBillingDetails = _e.isPending;
@@ -20762,9 +20769,7 @@ function BillingDetailsSection(_a) {
20762
20769
  });
20763
20770
  }); };
20764
20771
  var filteredCountryList = useMemo(function () {
20765
- return countryListFilter
20766
- ? Lists.COUNTRY_LIST.filter(countryListFilter)
20767
- : Lists.COUNTRY_LIST;
20772
+ return countryListFilter ? Lists.COUNTRY_LIST.filter(countryListFilter) : Lists.COUNTRY_LIST;
20768
20773
  }, [countryListFilter]);
20769
20774
  return (jsxs("div", __assign({ className: "".concat(isMobile || hidePaymentMethodForm ? "w-full" : "w-1/2", " px-4") }, { children: [jsx(Skeleton, __assign({ loading: isLoadingBillingDetails }, { children: jsxs(Form, __assign({ className: "flex flex-col gap-2", form: form, layout: "vertical", disabled: isUpdatingBillingDetails, autoComplete: "off" }, { children: [jsx(Form.Item, __assign({ label: "Account name", name: "name", rules: [{ required: true, message: "Account name is required" }] }, { children: jsx(Input, {}) })), jsx(Form.Item, __assign({ label: "Street address", name: "billingStreet", rules: [{ required: true, message: "Street address is required" }] }, { children: jsx(Input, {}) })), jsxs("div", __assign({ className: "flex gap-4" }, { children: [jsx(Form.Item, __assign({ label: "City", name: "billingCity", rules: [{ required: true, message: "City is required" }], className: "flex-1" }, { children: jsx(Input, {}) })), jsx(Form.Item, __assign({ label: "Zipcode", name: "billingZip", rules: [{ required: true, message: "Zipcode is required" }], className: "flex-1" }, { children: jsx(Input, {}) }))] })), jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col pb-2" : "flex-row", " gap-4") }, { children: [jsx(Form.Item, __assign({ label: "State", name: "billingState", className: "flex-1", rules: [
20770
20775
  {
@@ -20772,12 +20777,8 @@ function BillingDetailsSection(_a) {
20772
20777
  },
20773
20778
  ] }, { children: jsx(Input, {}) })), jsx(Form.Item, __assign({ label: "Country", name: "billingCountry", className: "flex-1", rules: [{ required: true, message: "Country is required" }] }, { children: jsx(Select, { options: filteredCountryList, placeholder: "Select a country", showSearch: true, filterOption: function (input, option) {
20774
20779
  var _a, _b;
20775
- return ((_a = option === null || option === void 0 ? void 0 : option.label) !== null && _a !== void 0 ? _a : "")
20776
- .toLowerCase()
20777
- .includes(input.toLowerCase()) ||
20778
- ((_b = option === null || option === void 0 ? void 0 : option.value) !== null && _b !== void 0 ? _b : "")
20779
- .toLowerCase()
20780
- .includes(input.toLowerCase());
20780
+ return ((_a = option === null || option === void 0 ? void 0 : option.label) !== null && _a !== void 0 ? _a : "").toLowerCase().includes(input.toLowerCase()) ||
20781
+ ((_b = option === null || option === void 0 ? void 0 : option.value) !== null && _b !== void 0 ? _b : "").toLowerCase().includes(input.toLowerCase());
20781
20782
  } }) }))] })), jsx(Form.Item, __assign({ label: "Email", name: "billingContactEmail", rules: [
20782
20783
  {
20783
20784
  required: true,
@@ -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;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  declare const Card: ({ children, className, style, }: {
3
2
  children: React.ReactNode;
4
3
  className?: string | undefined;
@@ -1,7 +1,6 @@
1
- /// <reference types="react" />
2
1
  import { FormattedInvoice, PluginData, Quote } from "@bunnyapp/common";
3
2
  import { GraphQLClient } from "graphql-request";
4
- export declare const PaymentForm: ({ entityId, invoice, onFail, onPaymentSuccess, quote, accountId, onSavePaymentMethod, overrideToken, graphQLClient, customCheckoutFunction, currencyId: currencyIdFromProps, customPaymentForms, }: {
3
+ export declare const PaymentForm: ({ entityId, invoice, onFail, onPaymentSuccess, quote, accountId, onSavePaymentMethod, overrideToken, graphQLClient, customCheckoutFunction, currencyId: currencyIdFromProps, customPaymentForms, useAllPaymentPlugins, }: {
5
4
  entityId: string;
6
5
  invoice?: FormattedInvoice | undefined;
7
6
  quote?: Quote | undefined;
@@ -14,4 +13,5 @@ export declare const PaymentForm: ({ entityId, invoice, onFail, onPaymentSuccess
14
13
  customCheckoutFunction?: ((plugin: PluginData | undefined) => Promise<any>) | undefined;
15
14
  currencyId?: string | undefined;
16
15
  customPaymentForms?: Record<string, import("react").ReactNode> | undefined;
16
+ useAllPaymentPlugins?: boolean | undefined;
17
17
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { PaymentMethod, PluginData } from "@bunnyapp/common";
3
2
  declare const PaymentMethodDetails: ({ onFail, paymentMethod, onSavePaymentMethod, customPaymentForms, }: {
4
3
  onFail: (error: any) => void;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { Meta, StoryObj } from "@storybook/react";
3
2
  import Quote from "./Quote";
4
3
  declare const meta: Meta<typeof Quote>;
@@ -18,16 +17,16 @@ export declare const Default: import("@storybook/core/csf").StoryAnnotations<imp
18
17
  onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
19
18
  onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
20
19
  }, {
21
- backButtonName?: string | undefined;
22
- onBackButtonClick?: (() => void) | undefined;
23
- shadow?: import("../../types/shadowType").ShadowType | undefined;
24
- hideDownloadButton?: boolean | undefined;
25
- id?: string | undefined;
26
20
  className?: string | undefined;
27
21
  entityId?: string | undefined;
28
- onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
22
+ shadow?: import("../../types/shadowType").ShadowType | undefined;
23
+ id?: string | undefined;
29
24
  invoiceQuoteViewComponent?: import("react").ReactNode;
25
+ backButtonName?: string | undefined;
26
+ onBackButtonClick?: (() => void) | undefined;
30
27
  onInvoiceDownloadError?: (() => void) | undefined;
28
+ onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
29
+ hideDownloadButton?: boolean | undefined;
31
30
  onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
32
31
  onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
33
32
  }>;
@@ -45,16 +44,16 @@ export declare const NoShadow: import("@storybook/core/csf").StoryAnnotations<im
45
44
  onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
46
45
  onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
47
46
  }, {
48
- backButtonName?: string | undefined;
49
- onBackButtonClick?: (() => void) | undefined;
50
- shadow?: import("../../types/shadowType").ShadowType | undefined;
51
- hideDownloadButton?: boolean | undefined;
52
- id?: string | undefined;
53
47
  className?: string | undefined;
54
48
  entityId?: string | undefined;
55
- onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
49
+ shadow?: import("../../types/shadowType").ShadowType | undefined;
50
+ id?: string | undefined;
56
51
  invoiceQuoteViewComponent?: import("react").ReactNode;
52
+ backButtonName?: string | undefined;
53
+ onBackButtonClick?: (() => void) | undefined;
57
54
  onInvoiceDownloadError?: (() => void) | undefined;
55
+ onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
56
+ hideDownloadButton?: boolean | undefined;
58
57
  onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
59
58
  onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
60
59
  }>;
@@ -72,16 +71,16 @@ export declare const Mobile: import("@storybook/core/csf").StoryAnnotations<impo
72
71
  onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
73
72
  onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
74
73
  }, {
75
- backButtonName?: string | undefined;
76
- onBackButtonClick?: (() => void) | undefined;
77
- shadow?: import("../../types/shadowType").ShadowType | undefined;
78
- hideDownloadButton?: boolean | undefined;
79
- id?: string | undefined;
80
74
  className?: string | undefined;
81
75
  entityId?: string | undefined;
82
- onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
76
+ shadow?: import("../../types/shadowType").ShadowType | undefined;
77
+ id?: string | undefined;
83
78
  invoiceQuoteViewComponent?: import("react").ReactNode;
79
+ backButtonName?: string | undefined;
80
+ onBackButtonClick?: (() => void) | undefined;
84
81
  onInvoiceDownloadError?: (() => void) | undefined;
82
+ onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
83
+ hideDownloadButton?: boolean | undefined;
85
84
  onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
86
85
  onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
87
86
  }>;
@@ -99,16 +98,16 @@ export declare const CustomClassName: import("@storybook/core/csf").StoryAnnotat
99
98
  onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
100
99
  onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
101
100
  }, {
102
- backButtonName?: string | undefined;
103
- onBackButtonClick?: (() => void) | undefined;
104
- shadow?: import("../../types/shadowType").ShadowType | undefined;
105
- hideDownloadButton?: boolean | undefined;
106
- id?: string | undefined;
107
101
  className?: string | undefined;
108
102
  entityId?: string | undefined;
109
- onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
103
+ shadow?: import("../../types/shadowType").ShadowType | undefined;
104
+ id?: string | undefined;
110
105
  invoiceQuoteViewComponent?: import("react").ReactNode;
106
+ backButtonName?: string | undefined;
107
+ onBackButtonClick?: (() => void) | undefined;
111
108
  onInvoiceDownloadError?: (() => void) | undefined;
109
+ onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
110
+ hideDownloadButton?: boolean | undefined;
112
111
  onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
113
112
  onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
114
113
  }>;
@@ -129,16 +128,16 @@ export declare const DarkMode: import("@storybook/core/csf").StoryAnnotations<im
129
128
  onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
130
129
  onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
131
130
  }, {
132
- backButtonName?: string | undefined;
133
- onBackButtonClick?: (() => void) | undefined;
134
- shadow?: import("../../types/shadowType").ShadowType | undefined;
135
- hideDownloadButton?: boolean | undefined;
136
- id?: string | undefined;
137
131
  className?: string | undefined;
138
132
  entityId?: string | undefined;
139
- onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
133
+ shadow?: import("../../types/shadowType").ShadowType | undefined;
134
+ id?: string | undefined;
140
135
  invoiceQuoteViewComponent?: import("react").ReactNode;
136
+ backButtonName?: string | undefined;
137
+ onBackButtonClick?: (() => void) | undefined;
141
138
  onInvoiceDownloadError?: (() => void) | undefined;
139
+ onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
140
+ hideDownloadButton?: boolean | undefined;
142
141
  onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
143
142
  onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
144
143
  }>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { Subscription } from "@bunnyapp/common";
3
2
  import "../../styles/index.less";
4
3
  export type EditingQuoteDataType = {
@@ -15,7 +14,7 @@ declare const Subscriptions: ({ className, companyName, entityId, hideExpired, o
15
14
  onSubscriptionsLoaded?: ((subscriptions: Subscription[]) => void) | undefined;
16
15
  styles?: {
17
16
  gap?: number | undefined;
18
- shadow?: "none" | "lg" | "md" | "sm" | undefined;
17
+ shadow?: "none" | "sm" | "md" | "lg" | undefined;
19
18
  subscriptionProductNameStyle?: import("react").CSSProperties | undefined;
20
19
  } | undefined;
21
20
  noSubscriptionsComponent?: React.ReactNode;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  declare const useSendAcceptQuote: ({ entityId, onTokenExpired, quoteId, apiHost, token, }: {
3
2
  entityId: string;
4
3
  onTokenExpired?: (() => void) | undefined;
@@ -1,5 +1,5 @@
1
1
  declare const useSigningComplete: ({ data, token }: {
2
2
  data: any;
3
- token?: string | undefined;
3
+ token: string;
4
4
  }) => void;
5
5
  export default useSigningComplete;
@@ -1,5 +1,10 @@
1
1
  import { GraphQLClient } from "graphql-request";
2
- export declare const usePaymentMethod: (graphQLClient: GraphQLClient, entityId?: string, token?: string, accountId?: string) => {
2
+ export declare const usePaymentMethod: ({ accountId, entityId, graphQLClient, token, }: {
3
+ accountId?: string | undefined;
4
+ entityId?: string | undefined;
5
+ graphQLClient: GraphQLClient;
6
+ token: string;
7
+ }) => {
3
8
  data: any;
4
9
  isLoading: boolean;
5
10
  };
@@ -1,6 +1,6 @@
1
- declare const usePlugins: ({ entityId, apiHost, token, }: {
1
+ declare const usePlugins: ({ entityId, apiHost, token }: {
2
2
  entityId: string;
3
3
  apiHost: string;
4
- token?: string | undefined;
4
+ token: string;
5
5
  }) => import("@tanstack/react-query/build/legacy/types").UseQueryResult<any, Error>;
6
6
  export default usePlugins;
@@ -1,2 +1,2 @@
1
- declare function useToken(): string | undefined;
1
+ declare function useToken(): string;
2
2
  export default useToken;
package/dist/index.d.ts CHANGED
@@ -82,7 +82,7 @@ declare const PaymentMethod: ({ entityId, className, shadow, cardEnabled, useMod
82
82
  useModal?: boolean | undefined;
83
83
  }) => react_jsx_runtime.JSX.Element;
84
84
 
85
- declare const PaymentForm: ({ entityId, invoice, onFail, onPaymentSuccess, quote, accountId, onSavePaymentMethod, overrideToken, graphQLClient, customCheckoutFunction, currencyId: currencyIdFromProps, customPaymentForms, }: {
85
+ declare const PaymentForm: ({ entityId, invoice, onFail, onPaymentSuccess, quote, accountId, onSavePaymentMethod, overrideToken, graphQLClient, customCheckoutFunction, currencyId: currencyIdFromProps, customPaymentForms, useAllPaymentPlugins, }: {
86
86
  entityId: string;
87
87
  invoice?: FormattedInvoice | undefined;
88
88
  quote?: Quote$1 | undefined;
@@ -95,6 +95,7 @@ declare const PaymentForm: ({ entityId, invoice, onFail, onPaymentSuccess, quote
95
95
  customCheckoutFunction?: ((plugin: PluginData | undefined) => Promise<any>) | undefined;
96
96
  currencyId?: string | undefined;
97
97
  customPaymentForms?: Record<string, react.ReactNode> | undefined;
98
+ useAllPaymentPlugins?: boolean | undefined;
98
99
  }) => react_jsx_runtime.JSX.Element;
99
100
 
100
101
  type CheckoutProps = {
@@ -143,7 +144,7 @@ declare function BunnyProvider({ children, darkMode, queryClient, apiHost, token
143
144
  darkMode?: boolean;
144
145
  queryClient?: QueryClient;
145
146
  apiHost: string;
146
- token?: string;
147
+ token: string;
147
148
  onTokenExpired?: () => void;
148
149
  configProviderProps?: ThemeConfig | undefined;
149
150
  }): react_jsx_runtime.JSX.Element;
@@ -206,7 +207,7 @@ declare const Subscriptions: ({ className, companyName, entityId, hideExpired, o
206
207
  onSubscriptionsLoaded?: ((subscriptions: Subscription[]) => void) | undefined;
207
208
  styles?: {
208
209
  gap?: number | undefined;
209
- shadow?: "none" | "lg" | "md" | "sm" | undefined;
210
+ shadow?: "none" | "sm" | "md" | "lg" | undefined;
210
211
  subscriptionProductNameStyle?: react.CSSProperties | undefined;
211
212
  } | undefined;
212
213
  noSubscriptionsComponent?: React.ReactNode;
@@ -225,7 +226,12 @@ declare const BillingDetails: ({ entityId, isCardEnabled, shadow, className, hid
225
226
  }) => boolean) | undefined;
226
227
  }) => react_jsx_runtime.JSX.Element;
227
228
 
228
- declare const usePaymentMethod: (graphQLClient: GraphQLClient, entityId?: string, token?: string, accountId?: string) => {
229
+ declare const usePaymentMethod: ({ accountId, entityId, graphQLClient, token, }: {
230
+ accountId?: string | undefined;
231
+ entityId?: string | undefined;
232
+ graphQLClient: GraphQLClient;
233
+ token: string;
234
+ }) => {
229
235
  data: any;
230
236
  isLoading: boolean;
231
237
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bunnyapp/components",
3
- "version": "1.0.38",
3
+ "version": "1.0.40",
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",
@@ -63,7 +63,7 @@
63
63
  "vite": "^6.2.1"
64
64
  },
65
65
  "peerDependencies": {
66
- "@bunnyapp/common": "^1.0.45",
66
+ "@bunnyapp/common": "^1.0.47",
67
67
  "@fortawesome/fontawesome-svg-core": "^6.7.2",
68
68
  "@fortawesome/free-brands-svg-icons": "^6.7.2",
69
69
  "@fortawesome/free-regular-svg-icons": "^6.7.2",