@bunnyapp/components 1.0.73-beta.9 → 1.0.76

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 (32) hide show
  1. package/dist/cjs/index.js +79 -74
  2. package/dist/cjs/src/components/PaymentForm/CheckoutFooter.d.ts +2 -2
  3. package/dist/cjs/src/components/PaymentForm/DemoPay/hooks/usePay.d.ts +2 -2
  4. package/dist/cjs/src/components/PaymentForm/PaymentForm.d.ts +2 -2
  5. package/dist/cjs/src/components/PaymentForm/Stripe/hooks/usePay.d.ts +2 -2
  6. package/dist/cjs/src/components/Quotes/Quotes.d.ts +6 -6
  7. package/dist/cjs/src/components/Quotes/Quotes.stories.d.ts +2 -2
  8. package/dist/cjs/src/components/Transactions/Transactions.d.ts +5 -5
  9. package/dist/cjs/src/components/Transactions/TransactionsListContext.d.ts +8 -8
  10. package/dist/cjs/src/components/Transactions/transactionsList/TransactionDownload.d.ts +2 -2
  11. package/dist/cjs/src/components/Transactions/transactionsList/TransactionTitle.d.ts +3 -3
  12. package/dist/cjs/src/components/Transactions/transactionsList/TransactionsListDesktop.d.ts +4 -4
  13. package/dist/cjs/src/components/Transactions/transactionsList/TransactionsListMobile.d.ts +3 -3
  14. package/dist/cjs/src/components/Transactions/transactionsList/utils.d.ts +3 -3
  15. package/dist/cjs/src/graphql/queries/getTransactions.d.ts +2 -2
  16. package/dist/esm/index.js +80 -75
  17. package/dist/esm/src/components/PaymentForm/CheckoutFooter.d.ts +2 -2
  18. package/dist/esm/src/components/PaymentForm/DemoPay/hooks/usePay.d.ts +2 -2
  19. package/dist/esm/src/components/PaymentForm/PaymentForm.d.ts +2 -2
  20. package/dist/esm/src/components/PaymentForm/Stripe/hooks/usePay.d.ts +2 -2
  21. package/dist/esm/src/components/Quotes/Quotes.d.ts +6 -6
  22. package/dist/esm/src/components/Quotes/Quotes.stories.d.ts +2 -2
  23. package/dist/esm/src/components/Transactions/Transactions.d.ts +5 -5
  24. package/dist/esm/src/components/Transactions/TransactionsListContext.d.ts +8 -8
  25. package/dist/esm/src/components/Transactions/transactionsList/TransactionDownload.d.ts +2 -2
  26. package/dist/esm/src/components/Transactions/transactionsList/TransactionTitle.d.ts +3 -3
  27. package/dist/esm/src/components/Transactions/transactionsList/TransactionsListDesktop.d.ts +4 -4
  28. package/dist/esm/src/components/Transactions/transactionsList/TransactionsListMobile.d.ts +3 -3
  29. package/dist/esm/src/components/Transactions/transactionsList/utils.d.ts +3 -3
  30. package/dist/esm/src/graphql/queries/getTransactions.d.ts +2 -2
  31. package/dist/index.d.ts +10 -10
  32. package/package.json +3 -3
package/dist/cjs/index.js CHANGED
@@ -154,7 +154,7 @@ var BrandContext = react.createContext({
154
154
  });
155
155
 
156
156
  // This will be replaced at build time by rollup-plugin-replace
157
- var PACKAGE_VERSION = '1.0.73-beta.9';
157
+ var PACKAGE_VERSION = '1.0.75';
158
158
  var createRequestHeaders = function (token) {
159
159
  var headers = common.createClientDevHeaders(token);
160
160
  // Add the components version header
@@ -19779,31 +19779,31 @@ var StateTag = function (_a) {
19779
19779
  if (transactionStateRenderer) {
19780
19780
  return jsxRuntime.jsx(jsxRuntime.Fragment, { children: transactionStateRenderer(state) });
19781
19781
  }
19782
- return jsxRuntime.jsx(CustomizedTag, __assign({ color: getColor(state) }, { children: lodashExports.capitalize(lodashExports.startCase(state)) }));
19782
+ return (jsxRuntime.jsx(CustomizedTag, __assign({ color: getColor(state) }, { children: lodashExports.capitalize(lodashExports.startCase(state)) })));
19783
19783
  };
19784
19784
  var getColor = function (state) {
19785
19785
  switch (state) {
19786
- case common.TransactionState.not_due:
19787
- return 'yellow';
19788
- case common.TransactionState.voided:
19789
- return 'black';
19790
- case common.TransactionState.ready:
19791
- return 'orange';
19792
- case common.TransactionState.preparing:
19793
- return 'purple';
19794
- case common.TransactionState.unapplied:
19795
- case common.TransactionState.partially_applied:
19796
- case common.TransactionState.applied:
19797
- return 'blue';
19798
- case common.TransactionState.due:
19799
- case common.TransactionState.unpaid:
19800
- return 'orange';
19801
- case common.TransactionState.failed:
19802
- return 'red';
19803
- case common.TransactionState.paid:
19804
- return 'green';
19786
+ case common.FrontendTransaction.TransactionState.not_due:
19787
+ return "yellow";
19788
+ case common.FrontendTransaction.TransactionState.voided:
19789
+ return "black";
19790
+ case common.FrontendTransaction.TransactionState.ready:
19791
+ return "orange";
19792
+ case common.FrontendTransaction.TransactionState.preparing:
19793
+ return "purple";
19794
+ case common.FrontendTransaction.TransactionState.unapplied:
19795
+ case common.FrontendTransaction.TransactionState.partially_applied:
19796
+ case common.FrontendTransaction.TransactionState.applied:
19797
+ return "blue";
19798
+ case common.FrontendTransaction.TransactionState.due:
19799
+ case common.FrontendTransaction.TransactionState.unpaid:
19800
+ return "orange";
19801
+ case common.FrontendTransaction.TransactionState.failed:
19802
+ return "red";
19803
+ case common.FrontendTransaction.TransactionState.paid:
19804
+ return "green";
19805
19805
  default:
19806
- return 'blue';
19806
+ return "blue";
19807
19807
  }
19808
19808
  };
19809
19809
 
@@ -19824,7 +19824,7 @@ var TransactionDownload = function (_a) {
19824
19824
  var downloadTransactionLink = react.useContext(TransactionsListContext).downloadTransactionLink;
19825
19825
  var downloadFile = useDownloadFile();
19826
19826
  var isMobile = common.useIsMobile();
19827
- var isClickable = transaction.kind === 'INVOICE' || downloadTransactionLink !== undefined;
19827
+ var isClickable = transaction.kind === "INVOICE" || downloadTransactionLink !== undefined;
19828
19828
  var downloadLink = downloadTransactionLink
19829
19829
  ? downloadTransactionLink(transaction.transactionableId)
19830
19830
  : "".concat(apiHost, "/api/pdf/invoice/").concat(transaction.transactionableId);
@@ -19833,7 +19833,7 @@ var TransactionDownload = function (_a) {
19833
19833
  return (jsxRuntime.jsx("div", __assign({ onClick: function (e) {
19834
19834
  e.stopPropagation();
19835
19835
  downloadFile(downloadLink, token);
19836
- } }, { children: jsxRuntime.jsx(ArrowDownToLine, { className: "".concat(isMobile ? '' : 'bunny-show-on-hover'), color: darkMode ? common.WHITE : common.SLATE_600 }) })));
19836
+ } }, { children: jsxRuntime.jsx(ArrowDownToLine, { className: "".concat(isMobile ? "" : "bunny-show-on-hover"), color: darkMode ? common.WHITE : common.SLATE_600 }) })));
19837
19837
  };
19838
19838
 
19839
19839
  var TransactionGridCell = defaultStyled.div.withConfig({
@@ -19855,25 +19855,29 @@ var TransactionsEmptyState = function () {
19855
19855
 
19856
19856
  var Text$k = antd.Typography.Text;
19857
19857
  var isInvoice = function (transaction) {
19858
- return transaction.kind === 'INVOICE';
19858
+ return transaction.kind === "INVOICE";
19859
+ };
19860
+ var isQuote = function (transaction) {
19861
+ return transaction.kind === "QUOTE";
19859
19862
  };
19860
19863
  var TransactionRowTitle = function (_a) {
19861
19864
  var transaction = _a.transaction;
19862
- if (!isInvoice(transaction)) {
19865
+ if (!isInvoice(transaction) && !isQuote(transaction)) {
19863
19866
  return jsxRuntime.jsx(jsxRuntime.Fragment, {});
19864
19867
  }
19865
- return (jsxRuntime.jsx(Text$k, __assign({ className: "bunny-text-slate-400", style: { fontSize: '11px' } }, { children: transaction.transactionable.number })));
19868
+ return (jsxRuntime.jsx(Text$k, __assign({ className: "bunny-text-slate-400", style: { fontSize: "11px" } }, { children: transaction.transactionable.number })));
19866
19869
  };
19867
19870
 
19868
19871
  function transactionDateToDisplay(transaction, transactionDateType) {
19869
- if (transaction.kind === common.TransactionKind.PAYMENT) {
19872
+ var _a, _b;
19873
+ if (transaction.kind === "PAYMENT") {
19870
19874
  return transaction.createdAt;
19871
19875
  }
19872
- else if (transaction.kind !== common.TransactionKind.REFUND && transactionDateType === 'dueAt') {
19873
- return transaction.transactionable.dueAt || '';
19876
+ else if (transaction.kind !== "REFUND" && transactionDateType === "dueAt") {
19877
+ return (_a = transaction.transactionable) === null || _a === void 0 ? void 0 : _a.dueAt;
19874
19878
  }
19875
- else if (transactionDateType === 'issuedAt') {
19876
- return transaction.transactionable.issuedAt || '';
19879
+ else if (transactionDateType === "issuedAt") {
19880
+ return (_b = transaction.transactionable) === null || _b === void 0 ? void 0 : _b.issuedAt;
19877
19881
  }
19878
19882
  else {
19879
19883
  return transaction.createdAt;
@@ -19887,29 +19891,29 @@ var TransactionsListDesktop = function (_a) {
19887
19891
  var _c = react.useContext(BunnyContext), apiHost = _c.apiHost, darkMode = _c.darkMode;
19888
19892
  var token = useToken();
19889
19893
  // Columns to show
19890
- var showDate = columns.includes('date');
19891
- var showTitle = columns.includes('title');
19892
- var showAccountName = columns.includes('accountName');
19893
- var showDownload = columns.includes('download');
19894
- var showAmount = columns.includes('amount');
19895
- var showState = columns.includes('state');
19894
+ var showDate = columns.includes("date");
19895
+ var showTitle = columns.includes("title");
19896
+ var showAccountName = columns.includes("accountName");
19897
+ var showDownload = columns.includes("download");
19898
+ var showAmount = columns.includes("amount");
19899
+ var showState = columns.includes("state");
19896
19900
  if ((transactions === null || transactions === void 0 ? void 0 : transactions.length) === 0)
19897
19901
  return jsxRuntime.jsx(TransactionsEmptyState, {});
19898
19902
  return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: transactions === null || transactions === void 0 ? void 0 : transactions.map(function (transaction, index) {
19899
19903
  var _a, _b;
19900
19904
  var isClickable = onTransactionClick !== undefined;
19901
- return (jsxRuntime.jsxs("div", __assign({ className: "bunny-contents ".concat(isClickable && 'cursor-pointer', " bunny-show-on-hover-container"), onClick: function () {
19905
+ return (jsxRuntime.jsxs("div", __assign({ className: "bunny-contents ".concat(isClickable && "cursor-pointer", " bunny-show-on-hover-container"), onClick: function () {
19902
19906
  onTransactionClick === null || onTransactionClick === void 0 ? void 0 : onTransactionClick(transaction);
19903
19907
  }, style: {
19904
19908
  backgroundColor: index % 2 === 0
19905
- ? "var(--row-background".concat(darkMode ? '-dark' : '', ")")
19906
- : "var(--row-background-alternate".concat(darkMode ? '-dark' : '', ")"),
19909
+ ? "var(--row-background".concat(darkMode ? "-dark" : "", ")")
19910
+ : "var(--row-background-alternate".concat(darkMode ? "-dark" : "", ")"),
19907
19911
  } }, { children: [!showDate &&
19908
19912
  !showTitle &&
19909
19913
  !showState &&
19910
19914
  !showAmount &&
19911
19915
  !showDownload &&
19912
- !showAccountName && (jsxRuntime.jsx(TransactionGridCell, { children: jsxRuntime.jsx(Text$j, { children: "No columns selected" }) })), showDate && (jsxRuntime.jsx(TransactionGridCell, __assign({ right: false }, { children: jsxRuntime.jsx(TransactionDate, { date: transactionDateToDisplay(transaction, transactionDateType) }) }))), showTitle && (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs(TransactionGridCell, __assign({ right: false, className: "bunny-flex bunny-items-center bunny-gap-2" }, { children: [jsxRuntime.jsx(Text$j, { children: lodashExports.capitalize(transaction.kind.toLowerCase()) }), jsxRuntime.jsx(TransactionRowTitle, { transaction: transaction })] })) })), showAccountName && (jsxRuntime.jsx(TransactionGridCell, __assign({ right: false }, { children: jsxRuntime.jsx(Text$j, { children: (_a = transaction.account) === null || _a === void 0 ? void 0 : _a.name }) }))), !showDate && !showTitle && !showAccountName && jsxRuntime.jsx(TransactionGridCell, { right: false }), showDownload && (jsxRuntime.jsx(TransactionGridCell, { children: jsxRuntime.jsx(TransactionDownload, { transaction: transaction, token: token, apiHost: apiHost }) })), showState ? (jsxRuntime.jsx(TransactionGridCell, __assign({ right: true }, { children: jsxRuntime.jsx(StateTag, { state: transaction.state }) }))) : null, showAmount && (jsxRuntime.jsx(TransactionGridCell, __assign({ right: true }, { children: jsxRuntime.jsx(Text$j, { children: common.formatCurrency(((_b = transaction === null || transaction === void 0 ? void 0 : transaction.transactionable) === null || _b === void 0 ? void 0 : _b.amount) || transaction.amount, transaction.currencyId) }) })))] }), index));
19916
+ !showAccountName && (jsxRuntime.jsx(TransactionGridCell, { children: jsxRuntime.jsx(Text$j, { children: "No columns selected" }) })), showDate && (jsxRuntime.jsx(TransactionGridCell, __assign({ right: false }, { children: jsxRuntime.jsx(TransactionDate, { date: transactionDateToDisplay(transaction, transactionDateType) }) }))), showTitle && (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs(TransactionGridCell, __assign({ right: false, className: "bunny-flex bunny-items-center bunny-gap-2" }, { children: [jsxRuntime.jsx(Text$j, { children: lodashExports.capitalize(transaction.kind.toLowerCase()) }), jsxRuntime.jsx(TransactionRowTitle, { transaction: transaction })] })) })), showAccountName && (jsxRuntime.jsx(TransactionGridCell, __assign({ right: false }, { children: jsxRuntime.jsx(Text$j, { children: (_a = transaction.account) === null || _a === void 0 ? void 0 : _a.name }) }))), !showDate && !showTitle && !showAccountName && (jsxRuntime.jsx(TransactionGridCell, { right: false })), showDownload && (jsxRuntime.jsx(TransactionGridCell, { children: jsxRuntime.jsx(TransactionDownload, { transaction: transaction, token: token, apiHost: apiHost }) })), showState ? (jsxRuntime.jsx(TransactionGridCell, __assign({ right: true }, { children: jsxRuntime.jsx(StateTag, { state: transaction.state }) }))) : null, showAmount && (jsxRuntime.jsx(TransactionGridCell, __assign({ right: true }, { children: jsxRuntime.jsx(Text$j, { children: common.formatCurrency(((_b = transaction === null || transaction === void 0 ? void 0 : transaction.transactionable) === null || _b === void 0 ? void 0 : _b.amount) || transaction.amount, transaction.currencyId) }) })))] }), index));
19913
19917
  }) }));
19914
19918
  };
19915
19919
 
@@ -19919,24 +19923,25 @@ var TransactionsListMobile = function (_a) {
19919
19923
  var _b = react.useContext(TransactionsListContext), columns = _b.columns, transactionDateType = _b.transactionDateType;
19920
19924
  var _c = react.useContext(BunnyContext), apiHost = _c.apiHost, darkMode = _c.darkMode;
19921
19925
  var token = useToken();
19922
- var showAmount = columns.includes('amount');
19923
- var showDate = columns.includes('date');
19924
- var showTitle = columns.includes('title');
19925
- var showAccountName = columns.includes('accountName');
19926
- var showDownload = columns.includes('download');
19927
- var showState = columns.includes('state');
19926
+ var showAmount = columns.includes("amount");
19927
+ var showDate = columns.includes("date");
19928
+ var showTitle = columns.includes("title");
19929
+ var showAccountName = columns.includes("accountName");
19930
+ var showDownload = columns.includes("download");
19931
+ var showState = columns.includes("state");
19928
19932
  if ((transactions === null || transactions === void 0 ? void 0 : transactions.length) === 0)
19929
19933
  return jsxRuntime.jsx(TransactionsEmptyState, {});
19930
19934
  return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: transactions === null || transactions === void 0 ? void 0 : transactions.map(function (transaction, index) {
19931
19935
  var _a;
19932
- var isClickable = transaction.kind === 'INVOICE';
19933
- return (jsxRuntime.jsxs("div", __assign({ className: "bunny-contents ".concat(isClickable && 'cursor-pointer', " bunny-show-on-hover-container"), onClick: function () {
19936
+ var isClickable = transaction.kind === "INVOICE";
19937
+ return (jsxRuntime.jsxs("div", __assign({ className: "bunny-contents ".concat(isClickable && "cursor-pointer", " bunny-show-on-hover-container"), onClick: function () {
19934
19938
  onTransactionClick(transaction);
19935
19939
  }, style: {
19936
19940
  backgroundColor: index % 2 === 0
19937
- ? "var(--row-background".concat(darkMode ? '-dark' : '', ")")
19938
- : "var(--row-background-alternate".concat(darkMode ? '-dark' : '', ")"),
19939
- } }, { children: [jsxRuntime.jsx(TransactionGridCell, { children: jsxRuntime.jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-gap-2" }, { children: [(showTitle || showState) && (jsxRuntime.jsxs("div", __assign({ className: "bunny-flex bunny-items-center bunny-gap-2" }, { children: [showTitle && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Text$i, { children: lodashExports.capitalize(transaction.kind.toLowerCase()) }), jsxRuntime.jsx(TransactionRowTitle, { transaction: transaction })] })), showState && jsxRuntime.jsx(StateTag, { state: transaction.state })] }))), jsxRuntime.jsxs("div", __assign({ className: "bunny-flex bunny-items-center bunny-gap-2" }, { children: [showAccountName && jsxRuntime.jsx(Text$i, { children: (_a = transaction.account) === null || _a === void 0 ? void 0 : _a.name }), showAccountName && showDate && jsxRuntime.jsx(Text$i, { children: "\u00B7" }), showDate && (jsxRuntime.jsx(TransactionDate, { date: transactionDateToDisplay(transaction, transactionDateType) })), showDate && showAmount && jsxRuntime.jsx(Text$i, { children: "\u00B7" }), showAmount && (jsxRuntime.jsx(Text$i, { children: common.formatCurrency(transaction.transactionable.amount || transaction.amount, transaction.currencyId) }))] }))] })) }), showDownload && (jsxRuntime.jsx(TransactionGridCell, __assign({ right: true }, { children: jsxRuntime.jsx(TransactionDownload, { transaction: transaction, token: token, apiHost: apiHost }) })))] }), index));
19941
+ ? "var(--row-background".concat(darkMode ? "-dark" : "", ")")
19942
+ : "var(--row-background-alternate".concat(darkMode ? "-dark" : "", ")"),
19943
+ } }, { children: [jsxRuntime.jsx(TransactionGridCell, { children: jsxRuntime.jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-gap-2" }, { children: [(showTitle || showState) && (jsxRuntime.jsxs("div", __assign({ className: "bunny-flex bunny-items-center bunny-gap-2" }, { children: [showTitle && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Text$i, { children: lodashExports.capitalize(transaction.kind.toLowerCase()) }), jsxRuntime.jsx(TransactionRowTitle, { transaction: transaction })] })), showState && jsxRuntime.jsx(StateTag, { state: transaction.state })] }))), jsxRuntime.jsxs("div", __assign({ className: "bunny-flex bunny-items-center bunny-gap-2" }, { children: [showAccountName && jsxRuntime.jsx(Text$i, { children: (_a = transaction.account) === null || _a === void 0 ? void 0 : _a.name }), showAccountName && showDate && jsxRuntime.jsx(Text$i, { children: "\u00B7" }), showDate && (jsxRuntime.jsx(TransactionDate, { date: transactionDateToDisplay(transaction, transactionDateType) })), showDate && showAmount && jsxRuntime.jsx(Text$i, { children: "\u00B7" }), showAmount && (jsxRuntime.jsx(Text$i, { children: common.formatCurrency(transaction.transactionable.amount ||
19944
+ transaction.amount, transaction.currencyId) }))] }))] })) }), showDownload && (jsxRuntime.jsx(TransactionGridCell, __assign({ right: true }, { children: jsxRuntime.jsx(TransactionDownload, { transaction: transaction, token: token, apiHost: apiHost }) })))] }), index));
19940
19945
  }) }));
19941
19946
  };
19942
19947
 
@@ -20066,9 +20071,9 @@ function TransactionsDisplay(_a) {
20066
20071
  }
20067
20072
 
20068
20073
  function Quotes(_a) {
20069
- var className = _a.className, _b = _a.columns, columns = _b === void 0 ? ['date', 'title', 'amount', 'download', 'state'] : _b, filter = _a.filter, filterQuotes = _a.filterQuotes, _c = _a.sort, sort = _c === void 0 ? function (a, b) {
20074
+ var className = _a.className, _b = _a.columns, columns = _b === void 0 ? ["date", "title", "amount", "download", "state"] : _b, filter = _a.filter, filterQuotes = _a.filterQuotes, _c = _a.sort, sort = _c === void 0 ? function (a, b) {
20070
20075
  return new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime();
20071
- } : _c, _d = _a.noQuotesMessage, noQuotesMessage = _d === void 0 ? 'There are no quotes' : _d, onQuoteClick = _a.onQuoteClick, quoteComponent = _a.quoteComponent, searchBarClassName = _a.searchBarClassName, _e = _a.shadow, shadow = _e === void 0 ? 'shadow-md' : _e, _f = _a.showSearchBar, showSearchBar = _f === void 0 ? true : _f, _g = _a.showTitle, showTitle = _g === void 0 ? true : _g, _h = _a.title, title = _h === void 0 ? 'Past quotes' : _h, style = _a.style, _j = _a.suppressQuoteDisplay, suppressQuoteDisplay = _j === void 0 ? false : _j, _k = _a.useModal, useModal = _k === void 0 ? false : _k;
20076
+ } : _c, _d = _a.noQuotesMessage, noQuotesMessage = _d === void 0 ? "There are no quotes" : _d, onQuoteClick = _a.onQuoteClick, quoteComponent = _a.quoteComponent, searchBarClassName = _a.searchBarClassName, _e = _a.shadow, shadow = _e === void 0 ? "shadow-md" : _e, _f = _a.showSearchBar, showSearchBar = _f === void 0 ? true : _f, _g = _a.showTitle, showTitle = _g === void 0 ? true : _g, _h = _a.title, title = _h === void 0 ? "Past quotes" : _h, style = _a.style, _j = _a.suppressQuoteDisplay, suppressQuoteDisplay = _j === void 0 ? false : _j, _k = _a.useModal, useModal = _k === void 0 ? false : _k;
20072
20077
  var apiHost = react.useContext(BunnyContext).apiHost;
20073
20078
  var _l = react.useState(null), component = _l[0], setComponent = _l[1];
20074
20079
  var contextValues = {
@@ -20094,27 +20099,27 @@ function Quotes(_a) {
20094
20099
  filterTransactions: filterQuotes,
20095
20100
  sortTransactions: sort,
20096
20101
  downloadTransactionLink: function (id) { return "".concat(apiHost, "/api/pdf/quote/").concat(id); },
20097
- transactionDateType: 'createdAt', // Required for the transactions list, but doesn't affect quotes
20102
+ transactionDateType: "createdAt", // Required for the transactions list, but doesn't affect quotes
20098
20103
  };
20099
20104
  function quoteStateRenderer(state) {
20100
20105
  var getColor = function (state) {
20101
20106
  switch (state) {
20102
- case 'ACCEPTED':
20103
- return 'green';
20104
- case 'IN_APPROVAL':
20105
- return 'orange';
20106
- case 'APPROVED':
20107
- return 'green';
20108
- case 'REJECTED':
20109
- return 'red';
20110
- case 'DRAFT':
20111
- case 'SHARED':
20112
- case 'VIEWED':
20107
+ case "ACCEPTED":
20108
+ return "green";
20109
+ case "IN_APPROVAL":
20110
+ return "orange";
20111
+ case "APPROVED":
20112
+ return "green";
20113
+ case "REJECTED":
20114
+ return "red";
20115
+ case "DRAFT":
20116
+ case "SHARED":
20117
+ case "VIEWED":
20113
20118
  default:
20114
- return 'blue';
20119
+ return "blue";
20115
20120
  }
20116
20121
  };
20117
- return jsxRuntime.jsx(CustomizedTag, __assign({ color: getColor(state) }, { children: lodashExports.capitalize(lodashExports.startCase(state)) }));
20122
+ return (jsxRuntime.jsx(CustomizedTag, __assign({ color: getColor(state) }, { children: lodashExports.capitalize(lodashExports.startCase(state)) })));
20118
20123
  }
20119
20124
  function handleQuoteClick(quote) {
20120
20125
  onQuoteClick === null || onQuoteClick === void 0 ? void 0 : onQuoteClick(quote);
@@ -20132,11 +20137,11 @@ function QuotesWrapper() {
20132
20137
  var token = useToken();
20133
20138
  var filterFromContext = react.useContext(TransactionsListContext).filter;
20134
20139
  // Local state
20135
- var _a = react.useState(''), search = _a[0], setSearch = _a[1];
20136
- var filter = filterFromContext || (search ? "filter: \"quote.id is ".concat(search, "\"") : '');
20140
+ var _a = react.useState(""), search = _a[0], setSearch = _a[1];
20141
+ var filter = filterFromContext || (search ? "filter: \"quote.id is ".concat(search, "\"") : "");
20137
20142
  // Queries
20138
20143
  var data = reactQuery.useQuery({
20139
- queryKey: ['quotes', token, filter],
20144
+ queryKey: ["quotes", token, filter],
20140
20145
  queryFn: function () { return getQuotes({ token: token, apiHost: apiHost, filter: filter }); },
20141
20146
  placeholderData: reactQuery.keepPreviousData,
20142
20147
  }).data;
@@ -20144,7 +20149,7 @@ function QuotesWrapper() {
20144
20149
  return null;
20145
20150
  // filter out quotes in draft state, they are not viewable
20146
20151
  var quotes = data.nodes.filter(function (quote) {
20147
- return quote.state !== 'DRAFT';
20152
+ return quote.state !== "DRAFT";
20148
20153
  });
20149
20154
  var quotesAsTransactions = quotes.map(function (quote) {
20150
20155
  var _a, _b;
@@ -20152,7 +20157,7 @@ function QuotesWrapper() {
20152
20157
  transactionableId: quote.id,
20153
20158
  state: quote.state,
20154
20159
  amount: quote.amount || quote.amountDue,
20155
- kind: 'QUOTE',
20160
+ kind: "QUOTE",
20156
20161
  currencyId: quote.currencyId,
20157
20162
  transactionable: {
20158
20163
  number: quote.number,
@@ -1,7 +1,7 @@
1
- import { FormattedInvoice, Invoice, PluginData, Quote } from '@bunnyapp/common';
1
+ import { FormattedInvoice, PluginData, Quote } from '@bunnyapp/common';
2
2
  declare const CheckoutFooter: ({ quote, invoice, onPaymentSuccess, onPaymentHoldSuccess, plugin, paymentHoldOptions, }: {
3
3
  quote?: Quote | undefined;
4
- invoice?: FormattedInvoice | Invoice | undefined;
4
+ invoice?: FormattedInvoice | undefined;
5
5
  onPaymentSuccess?: ((response: any) => void) | undefined;
6
6
  onPaymentHoldSuccess?: ((response: any) => void) | undefined;
7
7
  plugin: PluginData | undefined;
@@ -1,9 +1,9 @@
1
- import { FormattedInvoice, Invoice, PaymentMethod, PluginData, Quote } from '@bunnyapp/common';
1
+ import { FormattedInvoice, PaymentMethod, PluginData, Quote } from '@bunnyapp/common';
2
2
  export declare function usePay({ onPaymentSuccess, onPaymentError, quote, invoice, storedPaymentMethod, plugin, }: {
3
3
  onPaymentSuccess?: (response: any) => void;
4
4
  onPaymentError?: (error: any) => void;
5
5
  quote?: Quote;
6
- invoice?: FormattedInvoice | Invoice;
6
+ invoice?: FormattedInvoice;
7
7
  storedPaymentMethod?: PaymentMethod;
8
8
  plugin: PluginData | undefined;
9
9
  }): {
@@ -1,6 +1,6 @@
1
- import { FormattedInvoice, Invoice, PluginData, Quote } from '@bunnyapp/common';
1
+ import { FormattedInvoice, PluginData, Quote } from '@bunnyapp/common';
2
2
  export declare const PaymentForm: ({ invoice, onFail, onPaymentSuccess, onPaymentHoldSuccess, quote, accountId, onSavePaymentMethod, onRemovePaymentMethod, onSetDefaultPaymentMethod, entityId, overrideToken, customCheckoutFunction, currencyId: currencyIdFromProps, paymentHoldOptions, }: {
3
- invoice?: FormattedInvoice | Invoice | undefined;
3
+ invoice?: FormattedInvoice | undefined;
4
4
  quote?: Quote | undefined;
5
5
  onFail: (error: any) => void;
6
6
  onPaymentSuccess?: (() => void) | undefined;
@@ -1,9 +1,9 @@
1
- import { FormattedInvoice, Invoice, PaymentMethod, PluginData, Quote } from '@bunnyapp/common';
1
+ import { FormattedInvoice, PaymentMethod, PluginData, Quote } from "@bunnyapp/common";
2
2
  export declare function usePay({ onPaymentSuccess, onPaymentError, quote, invoice, storedPaymentMethod, plugin, }: {
3
3
  onPaymentSuccess?: (response: any) => void;
4
4
  onPaymentError?: (error: any) => void;
5
5
  quote?: Quote;
6
- invoice?: FormattedInvoice | Invoice;
6
+ invoice?: FormattedInvoice;
7
7
  storedPaymentMethod?: PaymentMethod;
8
8
  plugin: PluginData | undefined;
9
9
  }): {
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
- import { Transaction } from '@bunnyapp/common';
3
- import { ShadowType } from '../../types/shadowType';
4
- import { TransactionListColumnType } from '../Transactions/transactionsList/TransactionsListDesktop';
2
+ import { FrontendTransaction as T } from "@bunnyapp/common";
3
+ import { ShadowType } from "../../types/shadowType";
4
+ import { TransactionListColumnType } from "../Transactions/transactionsList/TransactionsListDesktop";
5
5
  declare function Quotes({ className, columns, filter, filterQuotes, sort, noQuotesMessage, onQuoteClick, quoteComponent, searchBarClassName, shadow, showSearchBar, showTitle, title, style, suppressQuoteDisplay, useModal, }: {
6
6
  /** A custom component to render instead of the default invoice component */
7
7
  quoteComponent?: React.ReactNode;
@@ -22,7 +22,7 @@ declare function Quotes({ className, columns, filter, filterQuotes, sort, noQuot
22
22
  /** A custom class name to apply to the search bar */
23
23
  searchBarClassName?: string;
24
24
  /** A function to call when a quote is clicked */
25
- onQuoteClick?: (quote: Transaction) => void;
25
+ onQuoteClick?: (quote: T.Transaction) => void;
26
26
  /** Whether to hide the display showing the quote */
27
27
  suppressQuoteDisplay?: boolean;
28
28
  /** A custom style to apply to the component */
@@ -30,9 +30,9 @@ declare function Quotes({ className, columns, filter, filterQuotes, sort, noQuot
30
30
  /** A filter to apply to the quotes. Docs on filter: https://docs.bunny.com/developer/getting-started/using-filters-in-queries */
31
31
  filter?: string;
32
32
  /** A function to filter the quotes. Runs on the client side. */
33
- filterQuotes?: (quote: Transaction) => boolean;
33
+ filterQuotes?: (quote: T.Transaction) => boolean;
34
34
  /** A function to sort the quotes. Runs on the client side. */
35
- sort?: (a: Transaction, b: Transaction) => number;
35
+ sort?: (a: T.Transaction, b: T.Transaction) => number;
36
36
  /** Message to display when there are no quotes */
37
37
  noQuotesMessage?: string;
38
38
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import Quotes from './Quotes';
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import Quotes from "./Quotes";
3
3
  declare const meta: Meta<typeof Quotes>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof meta>;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Transaction, TransactionKind } from '@bunnyapp/common';
2
+ import { FrontendTransaction as T, TransactionKind } from '@bunnyapp/common';
3
3
  import { ShadowType } from '../../types/shadowType';
4
4
  import { TransactionListColumnType } from './transactionsList/TransactionsListDesktop';
5
5
  import { TransactionDateType } from './TransactionsListContext';
@@ -23,7 +23,7 @@ export default function Transactions({ transactionComponent, showSearchBar, show
23
23
  /** A custom class name to apply to the search bar */
24
24
  searchBarClassName?: string;
25
25
  /** A function to call when a transaction is clicked */
26
- onTransactionClick?: (transaction: Transaction) => void;
26
+ onTransactionClick?: (transaction: T.Transaction) => void;
27
27
  /** Whether to hide the display showing the transaction */
28
28
  suppressTransactionDisplay?: boolean;
29
29
  /** The kinds of transactions to show */
@@ -40,14 +40,14 @@ export default function Transactions({ transactionComponent, showSearchBar, show
40
40
  * Filtering is applied on the client side.
41
41
  * This is useful to have more control over the filtering logic.
42
42
  */
43
- filterTransactions?: (transaction: Transaction) => boolean;
43
+ filterTransactions?: (transaction: T.Transaction) => boolean;
44
44
  /** A function to sort the transactions. Runs on the client side. */
45
- sortTransactions?: (transactionA: Transaction, transactionB: Transaction) => number;
45
+ sortTransactions?: (transactionA: T.Transaction, transactionB: T.Transaction) => number;
46
46
  /** The type of date to display for transactions if applicable. Payments will always only show createdAt date. */
47
47
  transactionDateType?: TransactionDateType;
48
48
  }): import("react/jsx-runtime").JSX.Element;
49
49
  export declare function TransactionsDisplay({ transactions, onSearchValueChanged, search, }: {
50
- transactions: Transaction[];
50
+ transactions: T.Transaction[];
51
51
  onSearchValueChanged: (value: string) => void;
52
52
  search: string;
53
53
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
- import { Transaction, TransactionKind } from '@bunnyapp/common';
3
- import { ShadowType } from '../../types/shadowType';
4
- import { TransactionListColumnType } from './transactionsList/TransactionsListDesktop';
2
+ import { FrontendTransaction as T, TransactionKind } from "@bunnyapp/common";
3
+ import { ShadowType } from "../../types/shadowType";
4
+ import { TransactionListColumnType } from "./transactionsList/TransactionsListDesktop";
5
5
  export type TransactionsContextValues = {
6
6
  showSearchBar?: boolean;
7
7
  showTitle?: boolean;
@@ -13,17 +13,17 @@ export type TransactionsContextValues = {
13
13
  shadow?: ShadowType;
14
14
  searchBarClassName?: string;
15
15
  useModal?: boolean;
16
- onTransactionClick?: (transaction: Transaction) => void;
17
- onTransactionDisplayClose?: (transaction: Transaction | null) => void;
16
+ onTransactionClick?: (transaction: T.Transaction) => void;
17
+ onTransactionDisplayClose?: (transaction: T.Transaction | null) => void;
18
18
  suppressTransactionDisplay?: boolean;
19
19
  kindsToShow?: TransactionKind[];
20
20
  style?: React.CSSProperties;
21
21
  filter?: string;
22
22
  noTransactionsMessage?: string;
23
23
  downloadTransactionLink?: (id: string) => string;
24
- filterTransactions?: (transaction: Transaction) => boolean;
25
- sortTransactions?: (transactionA: Transaction, transactionB: Transaction) => number;
24
+ filterTransactions?: (transaction: T.Transaction) => boolean;
25
+ sortTransactions?: (transactionA: T.Transaction, transactionB: T.Transaction) => number;
26
26
  transactionDateType: TransactionDateType;
27
27
  };
28
- export type TransactionDateType = 'createdAt' | 'issuedAt' | 'dueAt';
28
+ export type TransactionDateType = "createdAt" | "issuedAt" | "dueAt";
29
29
  export declare const TransactionsListContext: import("react").Context<TransactionsContextValues>;
@@ -1,6 +1,6 @@
1
- import { Transaction } from '@bunnyapp/common';
1
+ import { FrontendTransaction as T } from "@bunnyapp/common";
2
2
  declare const TransactionDownload: ({ transaction, token, apiHost, }: {
3
- transaction: Transaction;
3
+ transaction: T.Transaction;
4
4
  token?: string | undefined;
5
5
  apiHost: string;
6
6
  }) => import("react/jsx-runtime").JSX.Element | null;
@@ -1,5 +1,5 @@
1
- import { Transaction } from '@bunnyapp/common';
2
- declare const TransactionRowTitle: ({ transaction }: {
3
- transaction: Transaction;
1
+ import { FrontendTransaction as T } from "@bunnyapp/common";
2
+ declare const TransactionRowTitle: ({ transaction, }: {
3
+ transaction: T.Transaction;
4
4
  }) => import("react/jsx-runtime").JSX.Element;
5
5
  export default TransactionRowTitle;
@@ -1,7 +1,7 @@
1
- import { Transaction } from '@bunnyapp/common';
2
- export type TransactionListColumnType = 'date' | 'title' | 'state' | 'amount' | 'download' | 'accountName';
1
+ import { FrontendTransaction as T } from "@bunnyapp/common";
2
+ export type TransactionListColumnType = "date" | "title" | "state" | "amount" | "download" | "accountName";
3
3
  declare const TransactionsListDesktop: ({ transactions, onTransactionClick, }: {
4
- transactions: Transaction[];
5
- onTransactionClick?: ((transaction: Transaction) => void) | undefined;
4
+ transactions: T.Transaction[];
5
+ onTransactionClick?: ((transaction: T.Transaction) => void) | undefined;
6
6
  }) => import("react/jsx-runtime").JSX.Element;
7
7
  export default TransactionsListDesktop;
@@ -1,6 +1,6 @@
1
- import { Transaction } from '@bunnyapp/common';
1
+ import { FrontendTransaction as T } from "@bunnyapp/common";
2
2
  declare const TransactionsListMobile: ({ transactions, onTransactionClick, }: {
3
- transactions: Transaction[];
4
- onTransactionClick: (transaction: Transaction) => void;
3
+ transactions: T.Transaction[];
4
+ onTransactionClick: (transaction: T.Transaction) => void;
5
5
  }) => import("react/jsx-runtime").JSX.Element;
6
6
  export default TransactionsListMobile;
@@ -1,3 +1,3 @@
1
- import { Transaction } from '@bunnyapp/common';
2
- import { TransactionDateType } from '../TransactionsListContext';
3
- export declare function transactionDateToDisplay(transaction: Transaction, transactionDateType: TransactionDateType): string;
1
+ import { FrontendTransaction as T } from "@bunnyapp/common";
2
+ import { TransactionDateType } from "../TransactionsListContext";
3
+ export declare function transactionDateToDisplay(transaction: T.Transaction, transactionDateType: TransactionDateType): any;
@@ -1,3 +1,3 @@
1
- import { Transaction } from '@bunnyapp/common';
2
- declare const getTransactions: (filter: string, apiHost: string, token?: string) => Promise<Transaction[]>;
1
+ import { FrontendTransaction as T } from '@bunnyapp/common';
2
+ declare const getTransactions: (filter: string, apiHost: string, token?: string) => Promise<T.Transaction[]>;
3
3
  export default getTransactions;
package/dist/esm/index.js CHANGED
@@ -4,7 +4,7 @@ import { Markup } from 'interweave';
4
4
  import { ConfigProvider, Spin, Button, Tag, Typography, Dropdown, Input, Checkbox, Skeleton, Collapse, Modal, Form, Tooltip, Drawer, Card as Card$1, Divider, Select, Image, Radio, Space, Popconfirm, Table } from 'antd';
5
5
  import { DownloadOutlined, CreditCardOutlined, EllipsisOutlined, BankOutlined, SearchOutlined, CheckCircleFilled, CloseOutlined, ArrowLeftOutlined } from '@ant-design/icons';
6
6
  import styled from 'styled-components';
7
- import { DEFAULT_ACCENT_COLOR, DEFAULT_BRAND_COLOR, DEFAULT_SECONDARY_COLOR, DEFAULT_TOP_NAV_IMAGE_URL, gqlRequest as gqlRequest$1, createClientDevHeaders, X_BUNNY_COMPONENTS_VERSION_HEADER_NAME, QueryKeyFactory, useIsMobile, isColorTooDark, INPUT_BORDER_COLOR, SLATE_50, SLATE_400, SLATE_200, useErrorNotification, invokePlugin, useAllErrorFormats, formatCurrency, GRAY_500, GRAY_200, useSuccessNotification, getFormattedInvoice, PAYABLE_INVOICE_STATES, BreakpointNumbers, request as request$1, useGraphQLmutation, useInfoNotification, formatDate, TransactionState, SLATE_600, WHITE, TransactionKind, SLATE_500, PRIMARY_COLOR, Lists, sortSubscriptionCharges, getAccount, StringUtils, BillingPeriod, ChargeType, SubscriptionState as SubscriptionState$2, PERIOD_LABELS, PricingStyle, PricingModel, SLATE_100, MODAL_MAX_HEIGHT, DataInterval, QuoteChangeKind, TAG_COLORS } from '@bunnyapp/common';
7
+ import { DEFAULT_ACCENT_COLOR, DEFAULT_BRAND_COLOR, DEFAULT_SECONDARY_COLOR, DEFAULT_TOP_NAV_IMAGE_URL, gqlRequest as gqlRequest$1, createClientDevHeaders, X_BUNNY_COMPONENTS_VERSION_HEADER_NAME, QueryKeyFactory, useIsMobile, isColorTooDark, INPUT_BORDER_COLOR, SLATE_50, SLATE_400, SLATE_200, useErrorNotification, invokePlugin, useAllErrorFormats, formatCurrency, GRAY_500, GRAY_200, useSuccessNotification, getFormattedInvoice, PAYABLE_INVOICE_STATES, BreakpointNumbers, request as request$1, useGraphQLmutation, useInfoNotification, formatDate, FrontendTransaction, SLATE_600, WHITE, TransactionKind, SLATE_500, PRIMARY_COLOR, Lists, sortSubscriptionCharges, getAccount, StringUtils, BillingPeriod, ChargeType, SubscriptionState as SubscriptionState$2, PERIOD_LABELS, PricingStyle, PricingModel, SLATE_100, MODAL_MAX_HEIGHT, DataInterval, QuoteChangeKind, TAG_COLORS } from '@bunnyapp/common';
8
8
  import { QueryClient, QueryClientProvider, useQuery, useQueryClient, useMutation, keepPreviousData } from '@tanstack/react-query';
9
9
  import theme from 'antd/lib/theme/index.js';
10
10
  import { RecoilRoot } from 'recoil';
@@ -143,7 +143,7 @@ var BrandContext = createContext({
143
143
  });
144
144
 
145
145
  // This will be replaced at build time by rollup-plugin-replace
146
- var PACKAGE_VERSION = '1.0.73-beta.9';
146
+ var PACKAGE_VERSION = '1.0.75';
147
147
  var createRequestHeaders = function (token) {
148
148
  var headers = createClientDevHeaders(token);
149
149
  // Add the components version header
@@ -19768,31 +19768,31 @@ var StateTag = function (_a) {
19768
19768
  if (transactionStateRenderer) {
19769
19769
  return jsx(Fragment, { children: transactionStateRenderer(state) });
19770
19770
  }
19771
- return jsx(CustomizedTag, __assign({ color: getColor(state) }, { children: lodashExports.capitalize(lodashExports.startCase(state)) }));
19771
+ return (jsx(CustomizedTag, __assign({ color: getColor(state) }, { children: lodashExports.capitalize(lodashExports.startCase(state)) })));
19772
19772
  };
19773
19773
  var getColor = function (state) {
19774
19774
  switch (state) {
19775
- case TransactionState.not_due:
19776
- return 'yellow';
19777
- case TransactionState.voided:
19778
- return 'black';
19779
- case TransactionState.ready:
19780
- return 'orange';
19781
- case TransactionState.preparing:
19782
- return 'purple';
19783
- case TransactionState.unapplied:
19784
- case TransactionState.partially_applied:
19785
- case TransactionState.applied:
19786
- return 'blue';
19787
- case TransactionState.due:
19788
- case TransactionState.unpaid:
19789
- return 'orange';
19790
- case TransactionState.failed:
19791
- return 'red';
19792
- case TransactionState.paid:
19793
- return 'green';
19775
+ case FrontendTransaction.TransactionState.not_due:
19776
+ return "yellow";
19777
+ case FrontendTransaction.TransactionState.voided:
19778
+ return "black";
19779
+ case FrontendTransaction.TransactionState.ready:
19780
+ return "orange";
19781
+ case FrontendTransaction.TransactionState.preparing:
19782
+ return "purple";
19783
+ case FrontendTransaction.TransactionState.unapplied:
19784
+ case FrontendTransaction.TransactionState.partially_applied:
19785
+ case FrontendTransaction.TransactionState.applied:
19786
+ return "blue";
19787
+ case FrontendTransaction.TransactionState.due:
19788
+ case FrontendTransaction.TransactionState.unpaid:
19789
+ return "orange";
19790
+ case FrontendTransaction.TransactionState.failed:
19791
+ return "red";
19792
+ case FrontendTransaction.TransactionState.paid:
19793
+ return "green";
19794
19794
  default:
19795
- return 'blue';
19795
+ return "blue";
19796
19796
  }
19797
19797
  };
19798
19798
 
@@ -19813,7 +19813,7 @@ var TransactionDownload = function (_a) {
19813
19813
  var downloadTransactionLink = useContext(TransactionsListContext).downloadTransactionLink;
19814
19814
  var downloadFile = useDownloadFile();
19815
19815
  var isMobile = useIsMobile();
19816
- var isClickable = transaction.kind === 'INVOICE' || downloadTransactionLink !== undefined;
19816
+ var isClickable = transaction.kind === "INVOICE" || downloadTransactionLink !== undefined;
19817
19817
  var downloadLink = downloadTransactionLink
19818
19818
  ? downloadTransactionLink(transaction.transactionableId)
19819
19819
  : "".concat(apiHost, "/api/pdf/invoice/").concat(transaction.transactionableId);
@@ -19822,7 +19822,7 @@ var TransactionDownload = function (_a) {
19822
19822
  return (jsx("div", __assign({ onClick: function (e) {
19823
19823
  e.stopPropagation();
19824
19824
  downloadFile(downloadLink, token);
19825
- } }, { children: jsx(ArrowDownToLine, { className: "".concat(isMobile ? '' : 'bunny-show-on-hover'), color: darkMode ? WHITE : SLATE_600 }) })));
19825
+ } }, { children: jsx(ArrowDownToLine, { className: "".concat(isMobile ? "" : "bunny-show-on-hover"), color: darkMode ? WHITE : SLATE_600 }) })));
19826
19826
  };
19827
19827
 
19828
19828
  var TransactionGridCell = defaultStyled.div.withConfig({
@@ -19844,25 +19844,29 @@ var TransactionsEmptyState = function () {
19844
19844
 
19845
19845
  var Text$k = Typography.Text;
19846
19846
  var isInvoice = function (transaction) {
19847
- return transaction.kind === 'INVOICE';
19847
+ return transaction.kind === "INVOICE";
19848
+ };
19849
+ var isQuote = function (transaction) {
19850
+ return transaction.kind === "QUOTE";
19848
19851
  };
19849
19852
  var TransactionRowTitle = function (_a) {
19850
19853
  var transaction = _a.transaction;
19851
- if (!isInvoice(transaction)) {
19854
+ if (!isInvoice(transaction) && !isQuote(transaction)) {
19852
19855
  return jsx(Fragment, {});
19853
19856
  }
19854
- return (jsx(Text$k, __assign({ className: "bunny-text-slate-400", style: { fontSize: '11px' } }, { children: transaction.transactionable.number })));
19857
+ return (jsx(Text$k, __assign({ className: "bunny-text-slate-400", style: { fontSize: "11px" } }, { children: transaction.transactionable.number })));
19855
19858
  };
19856
19859
 
19857
19860
  function transactionDateToDisplay(transaction, transactionDateType) {
19858
- if (transaction.kind === TransactionKind.PAYMENT) {
19861
+ var _a, _b;
19862
+ if (transaction.kind === "PAYMENT") {
19859
19863
  return transaction.createdAt;
19860
19864
  }
19861
- else if (transaction.kind !== TransactionKind.REFUND && transactionDateType === 'dueAt') {
19862
- return transaction.transactionable.dueAt || '';
19865
+ else if (transaction.kind !== "REFUND" && transactionDateType === "dueAt") {
19866
+ return (_a = transaction.transactionable) === null || _a === void 0 ? void 0 : _a.dueAt;
19863
19867
  }
19864
- else if (transactionDateType === 'issuedAt') {
19865
- return transaction.transactionable.issuedAt || '';
19868
+ else if (transactionDateType === "issuedAt") {
19869
+ return (_b = transaction.transactionable) === null || _b === void 0 ? void 0 : _b.issuedAt;
19866
19870
  }
19867
19871
  else {
19868
19872
  return transaction.createdAt;
@@ -19876,29 +19880,29 @@ var TransactionsListDesktop = function (_a) {
19876
19880
  var _c = useContext(BunnyContext), apiHost = _c.apiHost, darkMode = _c.darkMode;
19877
19881
  var token = useToken();
19878
19882
  // Columns to show
19879
- var showDate = columns.includes('date');
19880
- var showTitle = columns.includes('title');
19881
- var showAccountName = columns.includes('accountName');
19882
- var showDownload = columns.includes('download');
19883
- var showAmount = columns.includes('amount');
19884
- var showState = columns.includes('state');
19883
+ var showDate = columns.includes("date");
19884
+ var showTitle = columns.includes("title");
19885
+ var showAccountName = columns.includes("accountName");
19886
+ var showDownload = columns.includes("download");
19887
+ var showAmount = columns.includes("amount");
19888
+ var showState = columns.includes("state");
19885
19889
  if ((transactions === null || transactions === void 0 ? void 0 : transactions.length) === 0)
19886
19890
  return jsx(TransactionsEmptyState, {});
19887
19891
  return (jsx(Fragment, { children: transactions === null || transactions === void 0 ? void 0 : transactions.map(function (transaction, index) {
19888
19892
  var _a, _b;
19889
19893
  var isClickable = onTransactionClick !== undefined;
19890
- return (jsxs("div", __assign({ className: "bunny-contents ".concat(isClickable && 'cursor-pointer', " bunny-show-on-hover-container"), onClick: function () {
19894
+ return (jsxs("div", __assign({ className: "bunny-contents ".concat(isClickable && "cursor-pointer", " bunny-show-on-hover-container"), onClick: function () {
19891
19895
  onTransactionClick === null || onTransactionClick === void 0 ? void 0 : onTransactionClick(transaction);
19892
19896
  }, style: {
19893
19897
  backgroundColor: index % 2 === 0
19894
- ? "var(--row-background".concat(darkMode ? '-dark' : '', ")")
19895
- : "var(--row-background-alternate".concat(darkMode ? '-dark' : '', ")"),
19898
+ ? "var(--row-background".concat(darkMode ? "-dark" : "", ")")
19899
+ : "var(--row-background-alternate".concat(darkMode ? "-dark" : "", ")"),
19896
19900
  } }, { children: [!showDate &&
19897
19901
  !showTitle &&
19898
19902
  !showState &&
19899
19903
  !showAmount &&
19900
19904
  !showDownload &&
19901
- !showAccountName && (jsx(TransactionGridCell, { children: jsx(Text$j, { children: "No columns selected" }) })), showDate && (jsx(TransactionGridCell, __assign({ right: false }, { children: jsx(TransactionDate, { date: transactionDateToDisplay(transaction, transactionDateType) }) }))), showTitle && (jsx(Fragment, { children: jsxs(TransactionGridCell, __assign({ right: false, className: "bunny-flex bunny-items-center bunny-gap-2" }, { children: [jsx(Text$j, { children: lodashExports.capitalize(transaction.kind.toLowerCase()) }), jsx(TransactionRowTitle, { transaction: transaction })] })) })), showAccountName && (jsx(TransactionGridCell, __assign({ right: false }, { children: jsx(Text$j, { children: (_a = transaction.account) === null || _a === void 0 ? void 0 : _a.name }) }))), !showDate && !showTitle && !showAccountName && jsx(TransactionGridCell, { right: false }), showDownload && (jsx(TransactionGridCell, { children: jsx(TransactionDownload, { transaction: transaction, token: token, apiHost: apiHost }) })), showState ? (jsx(TransactionGridCell, __assign({ right: true }, { children: jsx(StateTag, { state: transaction.state }) }))) : null, showAmount && (jsx(TransactionGridCell, __assign({ right: true }, { children: jsx(Text$j, { children: formatCurrency(((_b = transaction === null || transaction === void 0 ? void 0 : transaction.transactionable) === null || _b === void 0 ? void 0 : _b.amount) || transaction.amount, transaction.currencyId) }) })))] }), index));
19905
+ !showAccountName && (jsx(TransactionGridCell, { children: jsx(Text$j, { children: "No columns selected" }) })), showDate && (jsx(TransactionGridCell, __assign({ right: false }, { children: jsx(TransactionDate, { date: transactionDateToDisplay(transaction, transactionDateType) }) }))), showTitle && (jsx(Fragment, { children: jsxs(TransactionGridCell, __assign({ right: false, className: "bunny-flex bunny-items-center bunny-gap-2" }, { children: [jsx(Text$j, { children: lodashExports.capitalize(transaction.kind.toLowerCase()) }), jsx(TransactionRowTitle, { transaction: transaction })] })) })), showAccountName && (jsx(TransactionGridCell, __assign({ right: false }, { children: jsx(Text$j, { children: (_a = transaction.account) === null || _a === void 0 ? void 0 : _a.name }) }))), !showDate && !showTitle && !showAccountName && (jsx(TransactionGridCell, { right: false })), showDownload && (jsx(TransactionGridCell, { children: jsx(TransactionDownload, { transaction: transaction, token: token, apiHost: apiHost }) })), showState ? (jsx(TransactionGridCell, __assign({ right: true }, { children: jsx(StateTag, { state: transaction.state }) }))) : null, showAmount && (jsx(TransactionGridCell, __assign({ right: true }, { children: jsx(Text$j, { children: formatCurrency(((_b = transaction === null || transaction === void 0 ? void 0 : transaction.transactionable) === null || _b === void 0 ? void 0 : _b.amount) || transaction.amount, transaction.currencyId) }) })))] }), index));
19902
19906
  }) }));
19903
19907
  };
19904
19908
 
@@ -19908,24 +19912,25 @@ var TransactionsListMobile = function (_a) {
19908
19912
  var _b = useContext(TransactionsListContext), columns = _b.columns, transactionDateType = _b.transactionDateType;
19909
19913
  var _c = useContext(BunnyContext), apiHost = _c.apiHost, darkMode = _c.darkMode;
19910
19914
  var token = useToken();
19911
- var showAmount = columns.includes('amount');
19912
- var showDate = columns.includes('date');
19913
- var showTitle = columns.includes('title');
19914
- var showAccountName = columns.includes('accountName');
19915
- var showDownload = columns.includes('download');
19916
- var showState = columns.includes('state');
19915
+ var showAmount = columns.includes("amount");
19916
+ var showDate = columns.includes("date");
19917
+ var showTitle = columns.includes("title");
19918
+ var showAccountName = columns.includes("accountName");
19919
+ var showDownload = columns.includes("download");
19920
+ var showState = columns.includes("state");
19917
19921
  if ((transactions === null || transactions === void 0 ? void 0 : transactions.length) === 0)
19918
19922
  return jsx(TransactionsEmptyState, {});
19919
19923
  return (jsx(Fragment, { children: transactions === null || transactions === void 0 ? void 0 : transactions.map(function (transaction, index) {
19920
19924
  var _a;
19921
- var isClickable = transaction.kind === 'INVOICE';
19922
- return (jsxs("div", __assign({ className: "bunny-contents ".concat(isClickable && 'cursor-pointer', " bunny-show-on-hover-container"), onClick: function () {
19925
+ var isClickable = transaction.kind === "INVOICE";
19926
+ return (jsxs("div", __assign({ className: "bunny-contents ".concat(isClickable && "cursor-pointer", " bunny-show-on-hover-container"), onClick: function () {
19923
19927
  onTransactionClick(transaction);
19924
19928
  }, style: {
19925
19929
  backgroundColor: index % 2 === 0
19926
- ? "var(--row-background".concat(darkMode ? '-dark' : '', ")")
19927
- : "var(--row-background-alternate".concat(darkMode ? '-dark' : '', ")"),
19928
- } }, { children: [jsx(TransactionGridCell, { children: jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-gap-2" }, { children: [(showTitle || showState) && (jsxs("div", __assign({ className: "bunny-flex bunny-items-center bunny-gap-2" }, { children: [showTitle && (jsxs(Fragment, { children: [jsx(Text$i, { children: lodashExports.capitalize(transaction.kind.toLowerCase()) }), jsx(TransactionRowTitle, { transaction: transaction })] })), showState && jsx(StateTag, { state: transaction.state })] }))), jsxs("div", __assign({ className: "bunny-flex bunny-items-center bunny-gap-2" }, { children: [showAccountName && jsx(Text$i, { children: (_a = transaction.account) === null || _a === void 0 ? void 0 : _a.name }), showAccountName && showDate && jsx(Text$i, { children: "\u00B7" }), showDate && (jsx(TransactionDate, { date: transactionDateToDisplay(transaction, transactionDateType) })), showDate && showAmount && jsx(Text$i, { children: "\u00B7" }), showAmount && (jsx(Text$i, { children: formatCurrency(transaction.transactionable.amount || transaction.amount, transaction.currencyId) }))] }))] })) }), showDownload && (jsx(TransactionGridCell, __assign({ right: true }, { children: jsx(TransactionDownload, { transaction: transaction, token: token, apiHost: apiHost }) })))] }), index));
19930
+ ? "var(--row-background".concat(darkMode ? "-dark" : "", ")")
19931
+ : "var(--row-background-alternate".concat(darkMode ? "-dark" : "", ")"),
19932
+ } }, { children: [jsx(TransactionGridCell, { children: jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-gap-2" }, { children: [(showTitle || showState) && (jsxs("div", __assign({ className: "bunny-flex bunny-items-center bunny-gap-2" }, { children: [showTitle && (jsxs(Fragment, { children: [jsx(Text$i, { children: lodashExports.capitalize(transaction.kind.toLowerCase()) }), jsx(TransactionRowTitle, { transaction: transaction })] })), showState && jsx(StateTag, { state: transaction.state })] }))), jsxs("div", __assign({ className: "bunny-flex bunny-items-center bunny-gap-2" }, { children: [showAccountName && jsx(Text$i, { children: (_a = transaction.account) === null || _a === void 0 ? void 0 : _a.name }), showAccountName && showDate && jsx(Text$i, { children: "\u00B7" }), showDate && (jsx(TransactionDate, { date: transactionDateToDisplay(transaction, transactionDateType) })), showDate && showAmount && jsx(Text$i, { children: "\u00B7" }), showAmount && (jsx(Text$i, { children: formatCurrency(transaction.transactionable.amount ||
19933
+ transaction.amount, transaction.currencyId) }))] }))] })) }), showDownload && (jsx(TransactionGridCell, __assign({ right: true }, { children: jsx(TransactionDownload, { transaction: transaction, token: token, apiHost: apiHost }) })))] }), index));
19929
19934
  }) }));
19930
19935
  };
19931
19936
 
@@ -20055,9 +20060,9 @@ function TransactionsDisplay(_a) {
20055
20060
  }
20056
20061
 
20057
20062
  function Quotes(_a) {
20058
- var className = _a.className, _b = _a.columns, columns = _b === void 0 ? ['date', 'title', 'amount', 'download', 'state'] : _b, filter = _a.filter, filterQuotes = _a.filterQuotes, _c = _a.sort, sort = _c === void 0 ? function (a, b) {
20063
+ var className = _a.className, _b = _a.columns, columns = _b === void 0 ? ["date", "title", "amount", "download", "state"] : _b, filter = _a.filter, filterQuotes = _a.filterQuotes, _c = _a.sort, sort = _c === void 0 ? function (a, b) {
20059
20064
  return new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime();
20060
- } : _c, _d = _a.noQuotesMessage, noQuotesMessage = _d === void 0 ? 'There are no quotes' : _d, onQuoteClick = _a.onQuoteClick, quoteComponent = _a.quoteComponent, searchBarClassName = _a.searchBarClassName, _e = _a.shadow, shadow = _e === void 0 ? 'shadow-md' : _e, _f = _a.showSearchBar, showSearchBar = _f === void 0 ? true : _f, _g = _a.showTitle, showTitle = _g === void 0 ? true : _g, _h = _a.title, title = _h === void 0 ? 'Past quotes' : _h, style = _a.style, _j = _a.suppressQuoteDisplay, suppressQuoteDisplay = _j === void 0 ? false : _j, _k = _a.useModal, useModal = _k === void 0 ? false : _k;
20065
+ } : _c, _d = _a.noQuotesMessage, noQuotesMessage = _d === void 0 ? "There are no quotes" : _d, onQuoteClick = _a.onQuoteClick, quoteComponent = _a.quoteComponent, searchBarClassName = _a.searchBarClassName, _e = _a.shadow, shadow = _e === void 0 ? "shadow-md" : _e, _f = _a.showSearchBar, showSearchBar = _f === void 0 ? true : _f, _g = _a.showTitle, showTitle = _g === void 0 ? true : _g, _h = _a.title, title = _h === void 0 ? "Past quotes" : _h, style = _a.style, _j = _a.suppressQuoteDisplay, suppressQuoteDisplay = _j === void 0 ? false : _j, _k = _a.useModal, useModal = _k === void 0 ? false : _k;
20061
20066
  var apiHost = useContext(BunnyContext).apiHost;
20062
20067
  var _l = useState(null), component = _l[0], setComponent = _l[1];
20063
20068
  var contextValues = {
@@ -20083,27 +20088,27 @@ function Quotes(_a) {
20083
20088
  filterTransactions: filterQuotes,
20084
20089
  sortTransactions: sort,
20085
20090
  downloadTransactionLink: function (id) { return "".concat(apiHost, "/api/pdf/quote/").concat(id); },
20086
- transactionDateType: 'createdAt', // Required for the transactions list, but doesn't affect quotes
20091
+ transactionDateType: "createdAt", // Required for the transactions list, but doesn't affect quotes
20087
20092
  };
20088
20093
  function quoteStateRenderer(state) {
20089
20094
  var getColor = function (state) {
20090
20095
  switch (state) {
20091
- case 'ACCEPTED':
20092
- return 'green';
20093
- case 'IN_APPROVAL':
20094
- return 'orange';
20095
- case 'APPROVED':
20096
- return 'green';
20097
- case 'REJECTED':
20098
- return 'red';
20099
- case 'DRAFT':
20100
- case 'SHARED':
20101
- case 'VIEWED':
20096
+ case "ACCEPTED":
20097
+ return "green";
20098
+ case "IN_APPROVAL":
20099
+ return "orange";
20100
+ case "APPROVED":
20101
+ return "green";
20102
+ case "REJECTED":
20103
+ return "red";
20104
+ case "DRAFT":
20105
+ case "SHARED":
20106
+ case "VIEWED":
20102
20107
  default:
20103
- return 'blue';
20108
+ return "blue";
20104
20109
  }
20105
20110
  };
20106
- return jsx(CustomizedTag, __assign({ color: getColor(state) }, { children: lodashExports.capitalize(lodashExports.startCase(state)) }));
20111
+ return (jsx(CustomizedTag, __assign({ color: getColor(state) }, { children: lodashExports.capitalize(lodashExports.startCase(state)) })));
20107
20112
  }
20108
20113
  function handleQuoteClick(quote) {
20109
20114
  onQuoteClick === null || onQuoteClick === void 0 ? void 0 : onQuoteClick(quote);
@@ -20121,11 +20126,11 @@ function QuotesWrapper() {
20121
20126
  var token = useToken();
20122
20127
  var filterFromContext = useContext(TransactionsListContext).filter;
20123
20128
  // Local state
20124
- var _a = useState(''), search = _a[0], setSearch = _a[1];
20125
- var filter = filterFromContext || (search ? "filter: \"quote.id is ".concat(search, "\"") : '');
20129
+ var _a = useState(""), search = _a[0], setSearch = _a[1];
20130
+ var filter = filterFromContext || (search ? "filter: \"quote.id is ".concat(search, "\"") : "");
20126
20131
  // Queries
20127
20132
  var data = useQuery({
20128
- queryKey: ['quotes', token, filter],
20133
+ queryKey: ["quotes", token, filter],
20129
20134
  queryFn: function () { return getQuotes({ token: token, apiHost: apiHost, filter: filter }); },
20130
20135
  placeholderData: keepPreviousData,
20131
20136
  }).data;
@@ -20133,7 +20138,7 @@ function QuotesWrapper() {
20133
20138
  return null;
20134
20139
  // filter out quotes in draft state, they are not viewable
20135
20140
  var quotes = data.nodes.filter(function (quote) {
20136
- return quote.state !== 'DRAFT';
20141
+ return quote.state !== "DRAFT";
20137
20142
  });
20138
20143
  var quotesAsTransactions = quotes.map(function (quote) {
20139
20144
  var _a, _b;
@@ -20141,7 +20146,7 @@ function QuotesWrapper() {
20141
20146
  transactionableId: quote.id,
20142
20147
  state: quote.state,
20143
20148
  amount: quote.amount || quote.amountDue,
20144
- kind: 'QUOTE',
20149
+ kind: "QUOTE",
20145
20150
  currencyId: quote.currencyId,
20146
20151
  transactionable: {
20147
20152
  number: quote.number,
@@ -1,7 +1,7 @@
1
- import { FormattedInvoice, Invoice, PluginData, Quote } from '@bunnyapp/common';
1
+ import { FormattedInvoice, PluginData, Quote } from '@bunnyapp/common';
2
2
  declare const CheckoutFooter: ({ quote, invoice, onPaymentSuccess, onPaymentHoldSuccess, plugin, paymentHoldOptions, }: {
3
3
  quote?: Quote | undefined;
4
- invoice?: FormattedInvoice | Invoice | undefined;
4
+ invoice?: FormattedInvoice | undefined;
5
5
  onPaymentSuccess?: ((response: any) => void) | undefined;
6
6
  onPaymentHoldSuccess?: ((response: any) => void) | undefined;
7
7
  plugin: PluginData | undefined;
@@ -1,9 +1,9 @@
1
- import { FormattedInvoice, Invoice, PaymentMethod, PluginData, Quote } from '@bunnyapp/common';
1
+ import { FormattedInvoice, PaymentMethod, PluginData, Quote } from '@bunnyapp/common';
2
2
  export declare function usePay({ onPaymentSuccess, onPaymentError, quote, invoice, storedPaymentMethod, plugin, }: {
3
3
  onPaymentSuccess?: (response: any) => void;
4
4
  onPaymentError?: (error: any) => void;
5
5
  quote?: Quote;
6
- invoice?: FormattedInvoice | Invoice;
6
+ invoice?: FormattedInvoice;
7
7
  storedPaymentMethod?: PaymentMethod;
8
8
  plugin: PluginData | undefined;
9
9
  }): {
@@ -1,6 +1,6 @@
1
- import { FormattedInvoice, Invoice, PluginData, Quote } from '@bunnyapp/common';
1
+ import { FormattedInvoice, PluginData, Quote } from '@bunnyapp/common';
2
2
  export declare const PaymentForm: ({ invoice, onFail, onPaymentSuccess, onPaymentHoldSuccess, quote, accountId, onSavePaymentMethod, onRemovePaymentMethod, onSetDefaultPaymentMethod, entityId, overrideToken, customCheckoutFunction, currencyId: currencyIdFromProps, paymentHoldOptions, }: {
3
- invoice?: FormattedInvoice | Invoice | undefined;
3
+ invoice?: FormattedInvoice | undefined;
4
4
  quote?: Quote | undefined;
5
5
  onFail: (error: any) => void;
6
6
  onPaymentSuccess?: (() => void) | undefined;
@@ -1,9 +1,9 @@
1
- import { FormattedInvoice, Invoice, PaymentMethod, PluginData, Quote } from '@bunnyapp/common';
1
+ import { FormattedInvoice, PaymentMethod, PluginData, Quote } from "@bunnyapp/common";
2
2
  export declare function usePay({ onPaymentSuccess, onPaymentError, quote, invoice, storedPaymentMethod, plugin, }: {
3
3
  onPaymentSuccess?: (response: any) => void;
4
4
  onPaymentError?: (error: any) => void;
5
5
  quote?: Quote;
6
- invoice?: FormattedInvoice | Invoice;
6
+ invoice?: FormattedInvoice;
7
7
  storedPaymentMethod?: PaymentMethod;
8
8
  plugin: PluginData | undefined;
9
9
  }): {
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
- import { Transaction } from '@bunnyapp/common';
3
- import { ShadowType } from '../../types/shadowType';
4
- import { TransactionListColumnType } from '../Transactions/transactionsList/TransactionsListDesktop';
2
+ import { FrontendTransaction as T } from "@bunnyapp/common";
3
+ import { ShadowType } from "../../types/shadowType";
4
+ import { TransactionListColumnType } from "../Transactions/transactionsList/TransactionsListDesktop";
5
5
  declare function Quotes({ className, columns, filter, filterQuotes, sort, noQuotesMessage, onQuoteClick, quoteComponent, searchBarClassName, shadow, showSearchBar, showTitle, title, style, suppressQuoteDisplay, useModal, }: {
6
6
  /** A custom component to render instead of the default invoice component */
7
7
  quoteComponent?: React.ReactNode;
@@ -22,7 +22,7 @@ declare function Quotes({ className, columns, filter, filterQuotes, sort, noQuot
22
22
  /** A custom class name to apply to the search bar */
23
23
  searchBarClassName?: string;
24
24
  /** A function to call when a quote is clicked */
25
- onQuoteClick?: (quote: Transaction) => void;
25
+ onQuoteClick?: (quote: T.Transaction) => void;
26
26
  /** Whether to hide the display showing the quote */
27
27
  suppressQuoteDisplay?: boolean;
28
28
  /** A custom style to apply to the component */
@@ -30,9 +30,9 @@ declare function Quotes({ className, columns, filter, filterQuotes, sort, noQuot
30
30
  /** A filter to apply to the quotes. Docs on filter: https://docs.bunny.com/developer/getting-started/using-filters-in-queries */
31
31
  filter?: string;
32
32
  /** A function to filter the quotes. Runs on the client side. */
33
- filterQuotes?: (quote: Transaction) => boolean;
33
+ filterQuotes?: (quote: T.Transaction) => boolean;
34
34
  /** A function to sort the quotes. Runs on the client side. */
35
- sort?: (a: Transaction, b: Transaction) => number;
35
+ sort?: (a: T.Transaction, b: T.Transaction) => number;
36
36
  /** Message to display when there are no quotes */
37
37
  noQuotesMessage?: string;
38
38
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import Quotes from './Quotes';
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import Quotes from "./Quotes";
3
3
  declare const meta: Meta<typeof Quotes>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof meta>;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Transaction, TransactionKind } from '@bunnyapp/common';
2
+ import { FrontendTransaction as T, TransactionKind } from '@bunnyapp/common';
3
3
  import { ShadowType } from '../../types/shadowType';
4
4
  import { TransactionListColumnType } from './transactionsList/TransactionsListDesktop';
5
5
  import { TransactionDateType } from './TransactionsListContext';
@@ -23,7 +23,7 @@ export default function Transactions({ transactionComponent, showSearchBar, show
23
23
  /** A custom class name to apply to the search bar */
24
24
  searchBarClassName?: string;
25
25
  /** A function to call when a transaction is clicked */
26
- onTransactionClick?: (transaction: Transaction) => void;
26
+ onTransactionClick?: (transaction: T.Transaction) => void;
27
27
  /** Whether to hide the display showing the transaction */
28
28
  suppressTransactionDisplay?: boolean;
29
29
  /** The kinds of transactions to show */
@@ -40,14 +40,14 @@ export default function Transactions({ transactionComponent, showSearchBar, show
40
40
  * Filtering is applied on the client side.
41
41
  * This is useful to have more control over the filtering logic.
42
42
  */
43
- filterTransactions?: (transaction: Transaction) => boolean;
43
+ filterTransactions?: (transaction: T.Transaction) => boolean;
44
44
  /** A function to sort the transactions. Runs on the client side. */
45
- sortTransactions?: (transactionA: Transaction, transactionB: Transaction) => number;
45
+ sortTransactions?: (transactionA: T.Transaction, transactionB: T.Transaction) => number;
46
46
  /** The type of date to display for transactions if applicable. Payments will always only show createdAt date. */
47
47
  transactionDateType?: TransactionDateType;
48
48
  }): import("react/jsx-runtime").JSX.Element;
49
49
  export declare function TransactionsDisplay({ transactions, onSearchValueChanged, search, }: {
50
- transactions: Transaction[];
50
+ transactions: T.Transaction[];
51
51
  onSearchValueChanged: (value: string) => void;
52
52
  search: string;
53
53
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
- import { Transaction, TransactionKind } from '@bunnyapp/common';
3
- import { ShadowType } from '../../types/shadowType';
4
- import { TransactionListColumnType } from './transactionsList/TransactionsListDesktop';
2
+ import { FrontendTransaction as T, TransactionKind } from "@bunnyapp/common";
3
+ import { ShadowType } from "../../types/shadowType";
4
+ import { TransactionListColumnType } from "./transactionsList/TransactionsListDesktop";
5
5
  export type TransactionsContextValues = {
6
6
  showSearchBar?: boolean;
7
7
  showTitle?: boolean;
@@ -13,17 +13,17 @@ export type TransactionsContextValues = {
13
13
  shadow?: ShadowType;
14
14
  searchBarClassName?: string;
15
15
  useModal?: boolean;
16
- onTransactionClick?: (transaction: Transaction) => void;
17
- onTransactionDisplayClose?: (transaction: Transaction | null) => void;
16
+ onTransactionClick?: (transaction: T.Transaction) => void;
17
+ onTransactionDisplayClose?: (transaction: T.Transaction | null) => void;
18
18
  suppressTransactionDisplay?: boolean;
19
19
  kindsToShow?: TransactionKind[];
20
20
  style?: React.CSSProperties;
21
21
  filter?: string;
22
22
  noTransactionsMessage?: string;
23
23
  downloadTransactionLink?: (id: string) => string;
24
- filterTransactions?: (transaction: Transaction) => boolean;
25
- sortTransactions?: (transactionA: Transaction, transactionB: Transaction) => number;
24
+ filterTransactions?: (transaction: T.Transaction) => boolean;
25
+ sortTransactions?: (transactionA: T.Transaction, transactionB: T.Transaction) => number;
26
26
  transactionDateType: TransactionDateType;
27
27
  };
28
- export type TransactionDateType = 'createdAt' | 'issuedAt' | 'dueAt';
28
+ export type TransactionDateType = "createdAt" | "issuedAt" | "dueAt";
29
29
  export declare const TransactionsListContext: import("react").Context<TransactionsContextValues>;
@@ -1,6 +1,6 @@
1
- import { Transaction } from '@bunnyapp/common';
1
+ import { FrontendTransaction as T } from "@bunnyapp/common";
2
2
  declare const TransactionDownload: ({ transaction, token, apiHost, }: {
3
- transaction: Transaction;
3
+ transaction: T.Transaction;
4
4
  token?: string | undefined;
5
5
  apiHost: string;
6
6
  }) => import("react/jsx-runtime").JSX.Element | null;
@@ -1,5 +1,5 @@
1
- import { Transaction } from '@bunnyapp/common';
2
- declare const TransactionRowTitle: ({ transaction }: {
3
- transaction: Transaction;
1
+ import { FrontendTransaction as T } from "@bunnyapp/common";
2
+ declare const TransactionRowTitle: ({ transaction, }: {
3
+ transaction: T.Transaction;
4
4
  }) => import("react/jsx-runtime").JSX.Element;
5
5
  export default TransactionRowTitle;
@@ -1,7 +1,7 @@
1
- import { Transaction } from '@bunnyapp/common';
2
- export type TransactionListColumnType = 'date' | 'title' | 'state' | 'amount' | 'download' | 'accountName';
1
+ import { FrontendTransaction as T } from "@bunnyapp/common";
2
+ export type TransactionListColumnType = "date" | "title" | "state" | "amount" | "download" | "accountName";
3
3
  declare const TransactionsListDesktop: ({ transactions, onTransactionClick, }: {
4
- transactions: Transaction[];
5
- onTransactionClick?: ((transaction: Transaction) => void) | undefined;
4
+ transactions: T.Transaction[];
5
+ onTransactionClick?: ((transaction: T.Transaction) => void) | undefined;
6
6
  }) => import("react/jsx-runtime").JSX.Element;
7
7
  export default TransactionsListDesktop;
@@ -1,6 +1,6 @@
1
- import { Transaction } from '@bunnyapp/common';
1
+ import { FrontendTransaction as T } from "@bunnyapp/common";
2
2
  declare const TransactionsListMobile: ({ transactions, onTransactionClick, }: {
3
- transactions: Transaction[];
4
- onTransactionClick: (transaction: Transaction) => void;
3
+ transactions: T.Transaction[];
4
+ onTransactionClick: (transaction: T.Transaction) => void;
5
5
  }) => import("react/jsx-runtime").JSX.Element;
6
6
  export default TransactionsListMobile;
@@ -1,3 +1,3 @@
1
- import { Transaction } from '@bunnyapp/common';
2
- import { TransactionDateType } from '../TransactionsListContext';
3
- export declare function transactionDateToDisplay(transaction: Transaction, transactionDateType: TransactionDateType): string;
1
+ import { FrontendTransaction as T } from "@bunnyapp/common";
2
+ import { TransactionDateType } from "../TransactionsListContext";
3
+ export declare function transactionDateToDisplay(transaction: T.Transaction, transactionDateType: TransactionDateType): any;
@@ -1,3 +1,3 @@
1
- import { Transaction } from '@bunnyapp/common';
2
- declare const getTransactions: (filter: string, apiHost: string, token?: string) => Promise<Transaction[]>;
1
+ import { FrontendTransaction as T } from '@bunnyapp/common';
2
+ declare const getTransactions: (filter: string, apiHost: string, token?: string) => Promise<T.Transaction[]>;
3
3
  export default getTransactions;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
- import { FormattedInvoice, FormattedQuote, Transaction, Invoice as Invoice$1, Quote as Quote$1, PluginData, TransactionKind, PaymentMethod } from '@bunnyapp/common';
3
+ import { FormattedInvoice, FormattedQuote, FrontendTransaction, Quote as Quote$1, PluginData, TransactionKind, PaymentMethod } from '@bunnyapp/common';
4
4
  import { QueryClient } from '@tanstack/react-query';
5
5
  import { ThemeConfig } from 'antd';
6
6
  import * as react from 'react';
@@ -33,7 +33,7 @@ declare global {
33
33
 
34
34
  declare function Quote({ id, invoiceQuoteViewComponent, onInvoiceDownloadError, onPaymentSuccess, shadow, className, hideDownloadButton, onQuoteLoaded, }: InvoiceQuoteContextProps): react_jsx_runtime.JSX.Element;
35
35
 
36
- type TransactionListColumnType = 'date' | 'title' | 'state' | 'amount' | 'download' | 'accountName';
36
+ type TransactionListColumnType = "date" | "title" | "state" | "amount" | "download" | "accountName";
37
37
 
38
38
  declare function Quotes({ className, columns, filter, filterQuotes, sort, noQuotesMessage, onQuoteClick, quoteComponent, searchBarClassName, shadow, showSearchBar, showTitle, title, style, suppressQuoteDisplay, useModal, }: {
39
39
  /** A custom component to render instead of the default invoice component */
@@ -55,7 +55,7 @@ declare function Quotes({ className, columns, filter, filterQuotes, sort, noQuot
55
55
  /** A custom class name to apply to the search bar */
56
56
  searchBarClassName?: string;
57
57
  /** A function to call when a quote is clicked */
58
- onQuoteClick?: (quote: Transaction) => void;
58
+ onQuoteClick?: (quote: FrontendTransaction.Transaction) => void;
59
59
  /** Whether to hide the display showing the quote */
60
60
  suppressQuoteDisplay?: boolean;
61
61
  /** A custom style to apply to the component */
@@ -63,15 +63,15 @@ declare function Quotes({ className, columns, filter, filterQuotes, sort, noQuot
63
63
  /** A filter to apply to the quotes. Docs on filter: https://docs.bunny.com/developer/getting-started/using-filters-in-queries */
64
64
  filter?: string;
65
65
  /** A function to filter the quotes. Runs on the client side. */
66
- filterQuotes?: (quote: Transaction) => boolean;
66
+ filterQuotes?: (quote: FrontendTransaction.Transaction) => boolean;
67
67
  /** A function to sort the quotes. Runs on the client side. */
68
- sort?: (a: Transaction, b: Transaction) => number;
68
+ sort?: (a: FrontendTransaction.Transaction, b: FrontendTransaction.Transaction) => number;
69
69
  /** Message to display when there are no quotes */
70
70
  noQuotesMessage?: string;
71
71
  }): react_jsx_runtime.JSX.Element;
72
72
 
73
73
  declare const PaymentForm: ({ invoice, onFail, onPaymentSuccess, onPaymentHoldSuccess, quote, accountId, onSavePaymentMethod, onRemovePaymentMethod, onSetDefaultPaymentMethod, entityId, overrideToken, customCheckoutFunction, currencyId: currencyIdFromProps, paymentHoldOptions, }: {
74
- invoice?: FormattedInvoice | Invoice$1 | undefined;
74
+ invoice?: FormattedInvoice | undefined;
75
75
  quote?: Quote$1 | undefined;
76
76
  onFail: (error: any) => void;
77
77
  onPaymentSuccess?: (() => void) | undefined;
@@ -117,7 +117,7 @@ declare function BunnyProvider({ children, darkMode, queryClient, apiHost, token
117
117
  configProviderProps?: ThemeConfig | undefined;
118
118
  }): react_jsx_runtime.JSX.Element;
119
119
 
120
- type TransactionDateType = 'createdAt' | 'issuedAt' | 'dueAt';
120
+ type TransactionDateType = "createdAt" | "issuedAt" | "dueAt";
121
121
 
122
122
  declare function Transactions({ transactionComponent, showSearchBar, showTitle, title, columns, className, shadow, searchBarClassName, useModal, onTransactionClick, suppressTransactionDisplay, kindsToShow, style, filter, noTransactionsMessage, filterTransactions, sortTransactions, transactionDateType, }: {
123
123
  /** A custom component to render instead of the default invoice component */
@@ -139,7 +139,7 @@ declare function Transactions({ transactionComponent, showSearchBar, showTitle,
139
139
  /** A custom class name to apply to the search bar */
140
140
  searchBarClassName?: string;
141
141
  /** A function to call when a transaction is clicked */
142
- onTransactionClick?: (transaction: Transaction) => void;
142
+ onTransactionClick?: (transaction: FrontendTransaction.Transaction) => void;
143
143
  /** Whether to hide the display showing the transaction */
144
144
  suppressTransactionDisplay?: boolean;
145
145
  /** The kinds of transactions to show */
@@ -156,9 +156,9 @@ declare function Transactions({ transactionComponent, showSearchBar, showTitle,
156
156
  * Filtering is applied on the client side.
157
157
  * This is useful to have more control over the filtering logic.
158
158
  */
159
- filterTransactions?: (transaction: Transaction) => boolean;
159
+ filterTransactions?: (transaction: FrontendTransaction.Transaction) => boolean;
160
160
  /** A function to sort the transactions. Runs on the client side. */
161
- sortTransactions?: (transactionA: Transaction, transactionB: Transaction) => number;
161
+ sortTransactions?: (transactionA: FrontendTransaction.Transaction, transactionB: FrontendTransaction.Transaction) => number;
162
162
  /** The type of date to display for transactions if applicable. Payments will always only show createdAt date. */
163
163
  transactionDateType?: TransactionDateType;
164
164
  }): react_jsx_runtime.JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bunnyapp/components",
3
- "version": "1.0.73-beta.9",
3
+ "version": "1.0.76",
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",
@@ -64,13 +64,11 @@
64
64
  },
65
65
  "peerDependencies": {
66
66
  "@ant-design/icons": "^5.6.1",
67
- "@bunnyapp/common": "^1.0.66-beta.12",
68
67
  "@fortawesome/fontawesome-svg-core": "^6.7.2",
69
68
  "@fortawesome/free-brands-svg-icons": "^6.7.2",
70
69
  "@fortawesome/free-regular-svg-icons": "^6.7.2",
71
70
  "@fortawesome/free-solid-svg-icons": "^6.7.2",
72
71
  "@fortawesome/react-fontawesome": "^0.2.2",
73
- "@pdf-viewer/react": "^1.7.2",
74
72
  "@stripe/react-stripe-js": "^3.0.0",
75
73
  "@stripe/stripe-js": "^5.2.0",
76
74
  "@tanstack/react-query": "^5.59.20",
@@ -92,6 +90,8 @@
92
90
  ]
93
91
  },
94
92
  "dependencies": {
93
+ "@bunnyapp/common": "^1.0.66-beta.10",
94
+ "@pdf-viewer/react": "^1.7.2",
95
95
  "msw-storybook-addon": "^2.0.4"
96
96
  }
97
97
  }