@bunnyapp/components 1.0.19 → 1.0.20

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 (40) hide show
  1. package/dist/cjs/index.js +278 -465
  2. package/dist/cjs/src/components/Card.d.ts +0 -1
  3. package/dist/cjs/src/components/PaymentForm/useRemovePaymentMethod.d.ts +1 -1
  4. package/dist/cjs/src/components/Quote/Quote.stories.d.ts +20 -21
  5. package/dist/cjs/src/components/Subscriptions/Subscriptions.d.ts +11 -5
  6. package/dist/cjs/src/components/Subscriptions/SubscriptionsContext.d.ts +1 -4
  7. package/dist/cjs/src/components/Subscriptions/subscriptionsList/SubscriptionCardActions.d.ts +3 -3
  8. package/dist/cjs/src/components/Subscriptions/subscriptionsList/SubscriptionCardHeader.d.ts +3 -3
  9. package/dist/cjs/src/components/Subscriptions/subscriptionsList/SubscriptionsList.d.ts +4 -5
  10. package/dist/cjs/src/components/Subscriptions/subscriptionsList/subscriptionCardDesktop/SubscriptionCardDesktop.d.ts +3 -3
  11. package/dist/cjs/src/components/Subscriptions/subscriptionsList/subscriptionCardMobile/SubscriptionCardMobile.d.ts +2 -5
  12. package/dist/cjs/src/components/Subscriptions/subscriptionsList/subscriptionUtils.d.ts +0 -3
  13. package/dist/cjs/src/components/Transactions/Transactions.d.ts +4 -1
  14. package/dist/cjs/src/components/Transactions/TransactionsListContext.d.ts +3 -1
  15. package/dist/cjs/src/components/Transactions/transactionsList/TransactionsListDesktop.d.ts +2 -2
  16. package/dist/cjs/src/components/Transactions/transactionsList/TransactionsListMobile.d.ts +1 -1
  17. package/dist/cjs/src/components/Transactions/transactionsList/utils.d.ts +3 -0
  18. package/dist/cjs/src/graphql/queries/getSubscriptions.d.ts +2 -2
  19. package/dist/cjs/src/hooks/quotes/useSendAcceptQuote.d.ts +0 -1
  20. package/dist/esm/index.js +279 -466
  21. package/dist/esm/src/components/Card.d.ts +0 -1
  22. package/dist/esm/src/components/PaymentForm/useRemovePaymentMethod.d.ts +1 -1
  23. package/dist/esm/src/components/Quote/Quote.stories.d.ts +20 -21
  24. package/dist/esm/src/components/Subscriptions/Subscriptions.d.ts +11 -5
  25. package/dist/esm/src/components/Subscriptions/SubscriptionsContext.d.ts +1 -4
  26. package/dist/esm/src/components/Subscriptions/subscriptionsList/SubscriptionCardActions.d.ts +3 -3
  27. package/dist/esm/src/components/Subscriptions/subscriptionsList/SubscriptionCardHeader.d.ts +3 -3
  28. package/dist/esm/src/components/Subscriptions/subscriptionsList/SubscriptionsList.d.ts +4 -5
  29. package/dist/esm/src/components/Subscriptions/subscriptionsList/subscriptionCardDesktop/SubscriptionCardDesktop.d.ts +3 -3
  30. package/dist/esm/src/components/Subscriptions/subscriptionsList/subscriptionCardMobile/SubscriptionCardMobile.d.ts +2 -5
  31. package/dist/esm/src/components/Subscriptions/subscriptionsList/subscriptionUtils.d.ts +0 -3
  32. package/dist/esm/src/components/Transactions/Transactions.d.ts +4 -1
  33. package/dist/esm/src/components/Transactions/TransactionsListContext.d.ts +3 -1
  34. package/dist/esm/src/components/Transactions/transactionsList/TransactionsListDesktop.d.ts +2 -2
  35. package/dist/esm/src/components/Transactions/transactionsList/TransactionsListMobile.d.ts +1 -1
  36. package/dist/esm/src/components/Transactions/transactionsList/utils.d.ts +3 -0
  37. package/dist/esm/src/graphql/queries/getSubscriptions.d.ts +2 -2
  38. package/dist/esm/src/hooks/quotes/useSendAcceptQuote.d.ts +0 -1
  39. package/dist/index.d.ts +16 -7
  40. package/package.json +2 -2
@@ -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,3 +1,3 @@
1
1
  import { PluginData } from "@bunnyapp/common";
2
- declare function useRemovePaymentMethod(paymentPlugins: PluginData[], token: string, apiHost: string, accountId?: string): (data: any) => void;
2
+ declare function useRemovePaymentMethod(paymentPlugins: PluginData[], token: string, apiHost: string, accountId?: string): (data: any) => Promise<void>;
3
3
  export default useRemovePaymentMethod;
@@ -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>;
@@ -16,16 +15,16 @@ export declare const Default: import("@storybook/csf").StoryAnnotations<import("
16
15
  className?: string | undefined;
17
16
  hideDownloadButton?: boolean | undefined;
18
17
  }, {
18
+ className?: string | undefined;
19
19
  id?: string | undefined;
20
20
  entityId?: string | undefined;
21
- backButtonName?: string | undefined;
22
- onBackButtonClick?: (() => void) | undefined;
23
21
  shadow?: import("../../types/shadowType").ShadowType | undefined;
24
- hideDownloadButton?: boolean | undefined;
25
- className?: string | undefined;
26
22
  onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
23
+ backButtonName?: string | undefined;
24
+ onBackButtonClick?: (() => void) | undefined;
27
25
  invoiceQuoteViewComponent?: import("react").ReactNode;
28
26
  onInvoiceDownloadError?: (() => void) | undefined;
27
+ hideDownloadButton?: boolean | undefined;
29
28
  }>;
30
29
  export declare const NoShadow: import("@storybook/csf").StoryAnnotations<import("@storybook/react/dist/types-a5624094").R, {
31
30
  id?: string | undefined;
@@ -39,16 +38,16 @@ export declare const NoShadow: import("@storybook/csf").StoryAnnotations<import(
39
38
  className?: string | undefined;
40
39
  hideDownloadButton?: boolean | undefined;
41
40
  }, {
41
+ className?: string | undefined;
42
42
  id?: string | undefined;
43
43
  entityId?: string | undefined;
44
- backButtonName?: string | undefined;
45
- onBackButtonClick?: (() => void) | undefined;
46
44
  shadow?: import("../../types/shadowType").ShadowType | undefined;
47
- hideDownloadButton?: boolean | undefined;
48
- className?: string | undefined;
49
45
  onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
46
+ backButtonName?: string | undefined;
47
+ onBackButtonClick?: (() => void) | undefined;
50
48
  invoiceQuoteViewComponent?: import("react").ReactNode;
51
49
  onInvoiceDownloadError?: (() => void) | undefined;
50
+ hideDownloadButton?: boolean | undefined;
52
51
  }>;
53
52
  export declare const Mobile: import("@storybook/csf").StoryAnnotations<import("@storybook/react/dist/types-a5624094").R, {
54
53
  id?: string | undefined;
@@ -62,16 +61,16 @@ export declare const Mobile: import("@storybook/csf").StoryAnnotations<import("@
62
61
  className?: string | undefined;
63
62
  hideDownloadButton?: boolean | undefined;
64
63
  }, {
64
+ className?: string | undefined;
65
65
  id?: string | undefined;
66
66
  entityId?: string | undefined;
67
- backButtonName?: string | undefined;
68
- onBackButtonClick?: (() => void) | undefined;
69
67
  shadow?: import("../../types/shadowType").ShadowType | undefined;
70
- hideDownloadButton?: boolean | undefined;
71
- className?: string | undefined;
72
68
  onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
69
+ backButtonName?: string | undefined;
70
+ onBackButtonClick?: (() => void) | undefined;
73
71
  invoiceQuoteViewComponent?: import("react").ReactNode;
74
72
  onInvoiceDownloadError?: (() => void) | undefined;
73
+ hideDownloadButton?: boolean | undefined;
75
74
  }>;
76
75
  export declare const CustomClassName: import("@storybook/csf").StoryAnnotations<import("@storybook/react/dist/types-a5624094").R, {
77
76
  id?: string | undefined;
@@ -85,16 +84,16 @@ export declare const CustomClassName: import("@storybook/csf").StoryAnnotations<
85
84
  className?: string | undefined;
86
85
  hideDownloadButton?: boolean | undefined;
87
86
  }, {
87
+ className?: string | undefined;
88
88
  id?: string | undefined;
89
89
  entityId?: string | undefined;
90
- backButtonName?: string | undefined;
91
- onBackButtonClick?: (() => void) | undefined;
92
90
  shadow?: import("../../types/shadowType").ShadowType | undefined;
93
- hideDownloadButton?: boolean | undefined;
94
- className?: string | undefined;
95
91
  onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
92
+ backButtonName?: string | undefined;
93
+ onBackButtonClick?: (() => void) | undefined;
96
94
  invoiceQuoteViewComponent?: import("react").ReactNode;
97
95
  onInvoiceDownloadError?: (() => void) | undefined;
96
+ hideDownloadButton?: boolean | undefined;
98
97
  }>;
99
98
  export declare const HideDownloadButton: Story;
100
99
  export declare const AcceptedQuote: Story;
@@ -111,14 +110,14 @@ export declare const DarkMode: import("@storybook/csf").StoryAnnotations<import(
111
110
  className?: string | undefined;
112
111
  hideDownloadButton?: boolean | undefined;
113
112
  }, {
113
+ className?: string | undefined;
114
114
  id?: string | undefined;
115
115
  entityId?: string | undefined;
116
- backButtonName?: string | undefined;
117
- onBackButtonClick?: (() => void) | undefined;
118
116
  shadow?: import("../../types/shadowType").ShadowType | undefined;
119
- hideDownloadButton?: boolean | undefined;
120
- className?: string | undefined;
121
117
  onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
118
+ backButtonName?: string | undefined;
119
+ onBackButtonClick?: (() => void) | undefined;
122
120
  invoiceQuoteViewComponent?: import("react").ReactNode;
123
121
  onInvoiceDownloadError?: (() => void) | undefined;
122
+ hideDownloadButton?: boolean | undefined;
124
123
  }>;
@@ -1,14 +1,20 @@
1
+ import { Subscription } from "@bunnyapp/common";
1
2
  import "../../styles/index.less";
2
3
  export type EditingQuoteDataType = {
3
4
  id: string;
4
5
  isTrial: boolean;
5
6
  };
6
- declare const Subscriptions: ({ companyName, entityId, gap, shadow, showTitle, className, }: {
7
+ declare const Subscriptions: ({ className, companyName, entityId, hideExpired, onCancelSubscriptionClick, onChangePlanClick, onSubscriptionsLoaded, styles, }: {
8
+ className?: string | undefined;
7
9
  companyName: string;
8
10
  entityId: string;
9
- gap?: number | undefined;
10
- shadow?: "none" | "lg" | "md" | "sm" | undefined;
11
- showTitle?: boolean | undefined;
12
- className?: string | undefined;
11
+ hideExpired?: boolean | undefined;
12
+ onCancelSubscriptionClick?: ((subscription: Subscription) => void) | undefined;
13
+ onChangePlanClick?: ((subscription: Subscription) => void) | undefined;
14
+ onSubscriptionsLoaded?: ((subscriptions: Subscription[]) => void) | undefined;
15
+ styles?: {
16
+ gap?: number | undefined;
17
+ shadow?: "none" | "sm" | "md" | "lg" | undefined;
18
+ } | undefined;
13
19
  }) => import("react/jsx-runtime").JSX.Element;
14
20
  export default Subscriptions;
@@ -1,10 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  export type SubscriptionsContextValues = {
3
- onChangePlanClick: () => void;
4
- onClickUpgrade: () => void;
5
- isTempViewOnly: boolean;
6
- shadow?: "none" | "sm" | "md" | "lg";
7
3
  gap?: number;
4
+ shadow?: "none" | "sm" | "md" | "lg";
8
5
  showTitle?: boolean;
9
6
  };
10
7
  export declare const SubscriptionsContext: import("react").Context<SubscriptionsContextValues>;
@@ -1,8 +1,8 @@
1
1
  import { PlanChangeOptions, Subscription } from "@bunnyapp/common";
2
- declare const SubscriptionCardActions: ({ planChangeOptions, subscription, setEditingQuoteData, setPayModalVisible, }: {
2
+ declare const SubscriptionCardActions: ({ onChangePlanClick, onCancelSubscriptionClick, planChangeOptions, subscription, }: {
3
+ onChangePlanClick: (subscription: Subscription) => void;
4
+ onCancelSubscriptionClick: (subscription: Subscription) => void;
3
5
  planChangeOptions?: PlanChangeOptions | undefined;
4
6
  subscription: Subscription;
5
- setEditingQuoteData: (value: any) => void;
6
- setPayModalVisible: (value: any) => void;
7
7
  }) => import("react/jsx-runtime").JSX.Element | null;
8
8
  export default SubscriptionCardActions;
@@ -1,8 +1,8 @@
1
1
  import { PlanChangeOptions, Subscription } from "@bunnyapp/common";
2
- declare const SubscriptionCardHeader: ({ planChangeOptions, setEditingQuoteData, setPayModalVisible, subscription, }: {
2
+ declare const SubscriptionCardHeader: ({ onChangePlanClick, onCancelSubscriptionClick, planChangeOptions, subscription, }: {
3
+ onChangePlanClick?: ((subscription: Subscription) => void) | undefined;
4
+ onCancelSubscriptionClick?: ((subscription: Subscription) => void) | undefined;
3
5
  planChangeOptions?: PlanChangeOptions | undefined;
4
- setEditingQuoteData: (value: any) => void;
5
- setPayModalVisible: (value: any) => void;
6
6
  subscription: Subscription;
7
7
  }) => import("react/jsx-runtime").JSX.Element;
8
8
  export default SubscriptionCardHeader;
@@ -1,10 +1,9 @@
1
- import { Invoice, PlanChangeOptions, Subscription } from "@bunnyapp/common";
2
- declare const SubscriptionsList: ({ hideExpired, planChangeOptions, setEditingQuoteData, setPayModalVisible, subscriptions, }: {
1
+ import { PlanChangeOptions, Subscription } from "@bunnyapp/common";
2
+ declare const SubscriptionsList: ({ hideExpired, onChangePlanClick, onCancelSubscriptionClick, planChangeOptions, subscriptions, }: {
3
3
  hideExpired: boolean;
4
- invoice?: Invoice | undefined;
4
+ onChangePlanClick?: ((subscription: Subscription) => void) | undefined;
5
+ onCancelSubscriptionClick?: ((subscription: Subscription) => void) | undefined;
5
6
  planChangeOptions?: PlanChangeOptions | undefined;
6
- setEditingQuoteData: (value: any) => void;
7
- setPayModalVisible: (value: any) => void;
8
7
  subscriptions: Subscription[];
9
8
  }) => import("react/jsx-runtime").JSX.Element;
10
9
  export default SubscriptionsList;
@@ -1,8 +1,8 @@
1
1
  import { PlanChangeOptions, Subscription } from "@bunnyapp/common";
2
- declare const SubscriptionCardDesktop: ({ planChangeOptions, setEditingQuoteData, setPayModalVisible, subscription, }: {
2
+ declare const SubscriptionCardDesktop: ({ onChangePlanClick, onCancelSubscriptionClick, planChangeOptions, subscription, }: {
3
+ onChangePlanClick?: ((subscription: Subscription) => void) | undefined;
4
+ onCancelSubscriptionClick?: ((subscription: Subscription) => void) | undefined;
3
5
  planChangeOptions?: PlanChangeOptions | undefined;
4
- setEditingQuoteData: (value: any) => void;
5
- setPayModalVisible: (value: any) => void;
6
6
  subscription: Subscription;
7
7
  }) => import("react/jsx-runtime").JSX.Element;
8
8
  export default SubscriptionCardDesktop;
@@ -1,8 +1,5 @@
1
- import { PlanChangeOptions, Subscription } from "@bunnyapp/common";
2
- declare const SubscriptionCard: ({ planChangeOptions, setEditingQuoteData, setPayModalVisible, subscription, }: {
3
- planChangeOptions?: PlanChangeOptions | undefined;
4
- setEditingQuoteData: (value: any) => void;
5
- setPayModalVisible: (value: any) => void;
1
+ import { Subscription } from "@bunnyapp/common";
2
+ declare const SubscriptionCard: ({ subscription }: {
6
3
  subscription: Subscription;
7
4
  }) => import("react/jsx-runtime").JSX.Element;
8
5
  export default SubscriptionCard;
@@ -7,9 +7,6 @@ export declare const createQuoteParams: (quote: Quote, subscriptionQuantity: num
7
7
  }[];
8
8
  quoteChange: import("@bunnyapp/common").QuoteChange | undefined;
9
9
  };
10
- export declare const canShowChangeQuantities: ({ subscriptions, }: {
11
- subscriptions: Subscription[];
12
- }) => boolean;
13
10
  export declare const isSubscriptionNotActive: (subscription: Subscription) => boolean;
14
11
  export declare const productPlanName: ({ plan, product, }: {
15
12
  plan: Plan;
@@ -1,7 +1,8 @@
1
1
  import React from "react";
2
2
  import { FrontendTransaction as T, TransactionKind } from "@bunnyapp/common";
3
3
  import { ShadowType } from "../../types/shadowType";
4
- export default function Transactions({ transactionComponent, showSearchBar, showTitle, title, columns, className, shadow, searchBarClassName, useModal, onTransactionClick, suppressTransactionDisplay, kindsToShow, style, filter, noTransactionsMessage, entityId, filterTransactions, sortTransactions, }: {
4
+ import { TransactionDateType } from "./TransactionsListContext";
5
+ export default function Transactions({ transactionComponent, showSearchBar, showTitle, title, columns, className, shadow, searchBarClassName, useModal, onTransactionClick, suppressTransactionDisplay, kindsToShow, style, filter, noTransactionsMessage, entityId, filterTransactions, sortTransactions, transactionDateType, }: {
5
6
  /** A custom component to render instead of the default invoice component */
6
7
  transactionComponent?: React.ReactNode;
7
8
  /** Whether to show the search bar */
@@ -43,6 +44,8 @@ export default function Transactions({ transactionComponent, showSearchBar, show
43
44
  filterTransactions?: (transaction: T.Transaction) => boolean;
44
45
  /** A function to sort the transactions. Runs on the client side. */
45
46
  sortTransactions?: (transactionA: T.Transaction, transactionB: T.Transaction) => number;
47
+ /** The type of date to display for transactions if applicable. Payments will always only show createdAt date. */
48
+ transactionDateType?: TransactionDateType;
46
49
  }): import("react/jsx-runtime").JSX.Element;
47
50
  export declare function TransactionsDisplay({ transactions, onSearchValueChanged, search, }: {
48
51
  transactions: T.Transaction[];
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { FrontendTransaction as T, TransactionKind } from "@bunnyapp/common";
3
- import { TransactionListColumnType } from "./transactionsList/TransactionsListDesktop";
4
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;
@@ -24,5 +24,7 @@ export type TransactionsContextValues = {
24
24
  entityId: string;
25
25
  filterTransactions?: (transaction: T.Transaction) => boolean;
26
26
  sortTransactions?: (transactionA: T.Transaction, transactionB: T.Transaction) => number;
27
+ transactionDateType: TransactionDateType;
27
28
  };
29
+ export type TransactionDateType = "createdAt" | "issuedAt" | "dueAt";
28
30
  export declare const TransactionsListContext: import("react").Context<TransactionsContextValues>;
@@ -1,7 +1,7 @@
1
- import { FrontendTransaction as T, Transaction } from "@bunnyapp/common";
1
+ import { FrontendTransaction as T } from "@bunnyapp/common";
2
2
  export type TransactionListColumnType = "date-and-title" | "state" | "amount" | "download";
3
3
  declare const TransactionsListDesktop: ({ transactions, onTransactionClick, }: {
4
4
  transactions: T.Transaction[];
5
5
  onTransactionClick?: ((transaction: T.Transaction) => void) | undefined;
6
- }) => import("react/jsx-runtime").JSX.Element | import("react/jsx-runtime").JSX.Element[];
6
+ }) => import("react/jsx-runtime").JSX.Element;
7
7
  export default TransactionsListDesktop;
@@ -2,5 +2,5 @@ import { FrontendTransaction as T } from "@bunnyapp/common";
2
2
  declare const TransactionsListMobile: ({ transactions, onTransactionClick, }: {
3
3
  transactions: T.Transaction[];
4
4
  onTransactionClick: (transaction: T.Transaction) => void;
5
- }) => import("react/jsx-runtime").JSX.Element | import("react/jsx-runtime").JSX.Element[];
5
+ }) => import("react/jsx-runtime").JSX.Element;
6
6
  export default TransactionsListMobile;
@@ -0,0 +1,3 @@
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,7 +1,7 @@
1
- declare const getSubscriptions: ({ entityId, isInPreviewMode, token, apiHost, }: {
1
+ declare const getSubscriptions: ({ apiHost, entityId, isInPreviewMode, token, }: {
2
+ apiHost: string;
2
3
  entityId: string;
3
4
  isInPreviewMode?: boolean | undefined;
4
5
  token: string;
5
- apiHost: string;
6
6
  }) => Promise<any>;
7
7
  export default getSubscriptions;
@@ -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;