@bunnyapp/components 1.0.19 → 1.0.21

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 (46) hide show
  1. package/dist/cjs/index.js +285 -468
  2. package/dist/cjs/src/components/PaymentForm/useRemovePaymentMethod.d.ts +1 -1
  3. package/dist/cjs/src/components/Quote/Quote.stories.d.ts +15 -15
  4. package/dist/cjs/src/components/Subscriptions/Subscriptions.d.ts +11 -5
  5. package/dist/cjs/src/components/Subscriptions/SubscriptionsContext.d.ts +1 -4
  6. package/dist/cjs/src/components/Subscriptions/subscriptionsList/SubscriptionCardActions.d.ts +3 -3
  7. package/dist/cjs/src/components/Subscriptions/subscriptionsList/SubscriptionCardHeader.d.ts +3 -3
  8. package/dist/cjs/src/components/Subscriptions/subscriptionsList/SubscriptionsList.d.ts +4 -5
  9. package/dist/cjs/src/components/Subscriptions/subscriptionsList/subscriptionCardDesktop/SubscriptionCardDesktop.d.ts +3 -3
  10. package/dist/cjs/src/components/Subscriptions/subscriptionsList/subscriptionCardMobile/SubscriptionCardMobile.d.ts +2 -5
  11. package/dist/cjs/src/components/Subscriptions/subscriptionsList/subscriptionUtils.d.ts +0 -3
  12. package/dist/cjs/src/components/Transactions/Transactions.d.ts +4 -1
  13. package/dist/cjs/src/components/Transactions/TransactionsListContext.d.ts +3 -1
  14. package/dist/cjs/src/components/Transactions/transactionsList/TransactionsListDesktop.d.ts +2 -2
  15. package/dist/cjs/src/components/Transactions/transactionsList/TransactionsListMobile.d.ts +1 -1
  16. package/dist/cjs/src/components/Transactions/transactionsList/utils.d.ts +3 -0
  17. package/dist/cjs/src/graphql/queries/getSubscriptions.d.ts +2 -2
  18. package/dist/esm/index.js +287 -470
  19. package/dist/esm/src/components/PaymentForm/useRemovePaymentMethod.d.ts +1 -1
  20. package/dist/esm/src/components/Quote/Quote.stories.d.ts +15 -15
  21. package/dist/esm/src/components/Subscriptions/Subscriptions.d.ts +11 -5
  22. package/dist/esm/src/components/Subscriptions/SubscriptionsContext.d.ts +1 -4
  23. package/dist/esm/src/components/Subscriptions/subscriptionsList/SubscriptionCardActions.d.ts +3 -3
  24. package/dist/esm/src/components/Subscriptions/subscriptionsList/SubscriptionCardHeader.d.ts +3 -3
  25. package/dist/esm/src/components/Subscriptions/subscriptionsList/SubscriptionsList.d.ts +4 -5
  26. package/dist/esm/src/components/Subscriptions/subscriptionsList/subscriptionCardDesktop/SubscriptionCardDesktop.d.ts +3 -3
  27. package/dist/esm/src/components/Subscriptions/subscriptionsList/subscriptionCardMobile/SubscriptionCardMobile.d.ts +2 -5
  28. package/dist/esm/src/components/Subscriptions/subscriptionsList/subscriptionUtils.d.ts +0 -3
  29. package/dist/esm/src/components/Transactions/Transactions.d.ts +4 -1
  30. package/dist/esm/src/components/Transactions/TransactionsListContext.d.ts +3 -1
  31. package/dist/esm/src/components/Transactions/transactionsList/TransactionsListDesktop.d.ts +2 -2
  32. package/dist/esm/src/components/Transactions/transactionsList/TransactionsListMobile.d.ts +1 -1
  33. package/dist/esm/src/components/Transactions/transactionsList/utils.d.ts +3 -0
  34. package/dist/esm/src/graphql/queries/getSubscriptions.d.ts +2 -2
  35. package/dist/index.d.ts +16 -7
  36. package/package.json +2 -2
  37. package/dist/cjs/src/components/PageHeaderWithActions.d.ts +0 -7
  38. package/dist/cjs/src/components/Subscriptions/subscriptionsList/ChangeQuantitiesButton.d.ts +0 -5
  39. package/dist/cjs/src/components/Subscriptions/subscriptionsList/HideExpiredToggle.d.ts +0 -7
  40. package/dist/cjs/src/components/Subscriptions/subscriptionsList/SubscriptionsNavigation.d.ts +0 -8
  41. package/dist/cjs/src/graphql/queries/getQuote.d.ts +0 -7
  42. package/dist/esm/src/components/PageHeaderWithActions.d.ts +0 -7
  43. package/dist/esm/src/components/Subscriptions/subscriptionsList/ChangeQuantitiesButton.d.ts +0 -5
  44. package/dist/esm/src/components/Subscriptions/subscriptionsList/HideExpiredToggle.d.ts +0 -7
  45. package/dist/esm/src/components/Subscriptions/subscriptionsList/SubscriptionsNavigation.d.ts +0 -8
  46. package/dist/esm/src/graphql/queries/getQuote.d.ts +0 -7
@@ -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;
@@ -16,13 +16,13 @@ export declare const Default: import("@storybook/csf").StoryAnnotations<import("
16
16
  className?: string | undefined;
17
17
  hideDownloadButton?: boolean | undefined;
18
18
  }, {
19
- id?: string | undefined;
20
19
  entityId?: string | undefined;
20
+ className?: string | undefined;
21
+ id?: string | undefined;
22
+ shadow?: import("../../types/shadowType").ShadowType | undefined;
21
23
  backButtonName?: string | undefined;
22
24
  onBackButtonClick?: (() => void) | undefined;
23
- shadow?: import("../../types/shadowType").ShadowType | undefined;
24
25
  hideDownloadButton?: boolean | undefined;
25
- className?: string | undefined;
26
26
  onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
27
27
  invoiceQuoteViewComponent?: import("react").ReactNode;
28
28
  onInvoiceDownloadError?: (() => void) | undefined;
@@ -39,13 +39,13 @@ export declare const NoShadow: import("@storybook/csf").StoryAnnotations<import(
39
39
  className?: string | undefined;
40
40
  hideDownloadButton?: boolean | undefined;
41
41
  }, {
42
- id?: string | undefined;
43
42
  entityId?: string | undefined;
43
+ className?: string | undefined;
44
+ id?: string | undefined;
45
+ shadow?: import("../../types/shadowType").ShadowType | undefined;
44
46
  backButtonName?: string | undefined;
45
47
  onBackButtonClick?: (() => void) | undefined;
46
- shadow?: import("../../types/shadowType").ShadowType | undefined;
47
48
  hideDownloadButton?: boolean | undefined;
48
- className?: string | undefined;
49
49
  onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
50
50
  invoiceQuoteViewComponent?: import("react").ReactNode;
51
51
  onInvoiceDownloadError?: (() => void) | undefined;
@@ -62,13 +62,13 @@ export declare const Mobile: import("@storybook/csf").StoryAnnotations<import("@
62
62
  className?: string | undefined;
63
63
  hideDownloadButton?: boolean | undefined;
64
64
  }, {
65
- id?: string | undefined;
66
65
  entityId?: string | undefined;
66
+ className?: string | undefined;
67
+ id?: string | undefined;
68
+ shadow?: import("../../types/shadowType").ShadowType | undefined;
67
69
  backButtonName?: string | undefined;
68
70
  onBackButtonClick?: (() => void) | undefined;
69
- shadow?: import("../../types/shadowType").ShadowType | undefined;
70
71
  hideDownloadButton?: boolean | undefined;
71
- className?: string | undefined;
72
72
  onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
73
73
  invoiceQuoteViewComponent?: import("react").ReactNode;
74
74
  onInvoiceDownloadError?: (() => void) | undefined;
@@ -85,13 +85,13 @@ export declare const CustomClassName: import("@storybook/csf").StoryAnnotations<
85
85
  className?: string | undefined;
86
86
  hideDownloadButton?: boolean | undefined;
87
87
  }, {
88
- id?: string | undefined;
89
88
  entityId?: string | undefined;
89
+ className?: string | undefined;
90
+ id?: string | undefined;
91
+ shadow?: import("../../types/shadowType").ShadowType | undefined;
90
92
  backButtonName?: string | undefined;
91
93
  onBackButtonClick?: (() => void) | undefined;
92
- shadow?: import("../../types/shadowType").ShadowType | undefined;
93
94
  hideDownloadButton?: boolean | undefined;
94
- className?: string | undefined;
95
95
  onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
96
96
  invoiceQuoteViewComponent?: import("react").ReactNode;
97
97
  onInvoiceDownloadError?: (() => void) | undefined;
@@ -111,13 +111,13 @@ export declare const DarkMode: import("@storybook/csf").StoryAnnotations<import(
111
111
  className?: string | undefined;
112
112
  hideDownloadButton?: boolean | undefined;
113
113
  }, {
114
- id?: string | undefined;
115
114
  entityId?: string | undefined;
115
+ className?: string | undefined;
116
+ id?: string | undefined;
117
+ shadow?: import("../../types/shadowType").ShadowType | undefined;
116
118
  backButtonName?: string | undefined;
117
119
  onBackButtonClick?: (() => void) | undefined;
118
- shadow?: import("../../types/shadowType").ShadowType | undefined;
119
120
  hideDownloadButton?: boolean | undefined;
120
- className?: string | undefined;
121
121
  onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
122
122
  invoiceQuoteViewComponent?: import("react").ReactNode;
123
123
  onInvoiceDownloadError?: (() => void) | undefined;
@@ -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" | "lg" | "md" | "sm" | 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;