@bunnyapp/components 1.6.0-beta.15 → 1.6.0-beta.16

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 (47) hide show
  1. package/dist/cjs/index.js +290 -120
  2. package/dist/cjs/types/src/components/BunnyProvider.d.ts +0 -2
  3. package/dist/cjs/types/src/components/Subscriptions/Subscriptions.d.ts +0 -4
  4. package/dist/cjs/types/src/components/Subscriptions/SubscriptionsListContainer.d.ts +0 -4
  5. package/dist/cjs/types/src/components/Subscriptions/quantityChangeDrawer/QuantityChangeGridRow.d.ts +1 -5
  6. package/dist/cjs/types/src/components/Subscriptions/quantityChangeDrawer/QuantityDrawer.d.ts +1 -4
  7. package/dist/cjs/types/src/components/Subscriptions/quantityChangeDrawer/QuoteChangeSummarySection.d.ts +11 -6
  8. package/dist/cjs/types/src/components/Subscriptions/quantityChangeDrawer/context/quoteIdContext.d.ts +5 -0
  9. package/dist/cjs/types/src/components/Subscriptions/quantityChangeDrawer/fragments/{QuantityDrawerQuoteFragment.d.ts → QuantityDrawer_QuoteFragment.d.ts} +4 -0
  10. package/dist/cjs/types/src/components/Subscriptions/quantityChangeDrawer/hooks/useQuoteQueryData.d.ts +3 -3
  11. package/dist/cjs/types/src/components/Subscriptions/quantityChangeDrawer/hooks/useSetQuoteQueryData.d.ts +2 -2
  12. package/dist/cjs/types/src/components/Subscriptions/quantityChangeDrawer/quantityChangeDrawerDesktop/QuantityChangeDrawerDesktop.d.ts +1 -6
  13. package/dist/cjs/types/src/components/Subscriptions/quantityChangeDrawer/{QuantityInput.d.ts → quantityInput/QuantityInput.d.ts} +1 -8
  14. package/dist/cjs/types/src/components/Subscriptions/quantityChangeDrawer/quantityInput/fragments/QuantityInput_QuoteFragment.d.ts +27 -0
  15. package/dist/cjs/types/src/components/Subscriptions/quantityChangeDrawer/utils/utils.d.ts +2 -1
  16. package/dist/cjs/types/src/hooks/useAllErrorFormats.d.ts +1 -0
  17. package/dist/cjs/types/src/hooks/useCreateQueryClient.d.ts +2 -0
  18. package/dist/cjs/types/src/utils/createStateContext.d.ts +11 -0
  19. package/dist/cjs/types/src/utils/pricePickerUtils.d.ts +1 -1
  20. package/dist/esm/index.js +297 -127
  21. package/dist/esm/types/src/components/BunnyProvider.d.ts +0 -2
  22. package/dist/esm/types/src/components/Subscriptions/Subscriptions.d.ts +0 -4
  23. package/dist/esm/types/src/components/Subscriptions/SubscriptionsListContainer.d.ts +0 -4
  24. package/dist/esm/types/src/components/Subscriptions/quantityChangeDrawer/QuantityChangeGridRow.d.ts +1 -5
  25. package/dist/esm/types/src/components/Subscriptions/quantityChangeDrawer/QuantityDrawer.d.ts +1 -4
  26. package/dist/esm/types/src/components/Subscriptions/quantityChangeDrawer/QuoteChangeSummarySection.d.ts +11 -6
  27. package/dist/esm/types/src/components/Subscriptions/quantityChangeDrawer/context/quoteIdContext.d.ts +5 -0
  28. package/dist/esm/types/src/components/Subscriptions/quantityChangeDrawer/fragments/{QuantityDrawerQuoteFragment.d.ts → QuantityDrawer_QuoteFragment.d.ts} +4 -0
  29. package/dist/esm/types/src/components/Subscriptions/quantityChangeDrawer/hooks/useQuoteQueryData.d.ts +3 -3
  30. package/dist/esm/types/src/components/Subscriptions/quantityChangeDrawer/hooks/useSetQuoteQueryData.d.ts +2 -2
  31. package/dist/esm/types/src/components/Subscriptions/quantityChangeDrawer/quantityChangeDrawerDesktop/QuantityChangeDrawerDesktop.d.ts +1 -6
  32. package/dist/esm/types/src/components/Subscriptions/quantityChangeDrawer/{QuantityInput.d.ts → quantityInput/QuantityInput.d.ts} +1 -8
  33. package/dist/esm/types/src/components/Subscriptions/quantityChangeDrawer/quantityInput/fragments/QuantityInput_QuoteFragment.d.ts +27 -0
  34. package/dist/esm/types/src/components/Subscriptions/quantityChangeDrawer/utils/utils.d.ts +2 -1
  35. package/dist/esm/types/src/hooks/useAllErrorFormats.d.ts +1 -0
  36. package/dist/esm/types/src/hooks/useCreateQueryClient.d.ts +2 -0
  37. package/dist/esm/types/src/utils/createStateContext.d.ts +11 -0
  38. package/dist/esm/types/src/utils/pricePickerUtils.d.ts +1 -1
  39. package/package.json +1 -1
  40. package/dist/cjs/types/src/utils/GraphQLClient.d.ts +0 -2
  41. package/dist/esm/types/src/utils/GraphQLClient.d.ts +0 -2
  42. /package/dist/cjs/types/src/components/Subscriptions/quantityChangeDrawer/{queries → mutations}/quoteChargeCreate.d.ts +0 -0
  43. /package/dist/cjs/types/src/components/Subscriptions/quantityChangeDrawer/{queries → mutations}/quoteChargeUpdate.d.ts +0 -0
  44. /package/dist/cjs/types/src/components/Subscriptions/quantityChangeDrawer/{queries → mutations}/quoteSubscriptionUpdate.d.ts +0 -0
  45. /package/dist/esm/types/src/components/Subscriptions/quantityChangeDrawer/{queries → mutations}/quoteChargeCreate.d.ts +0 -0
  46. /package/dist/esm/types/src/components/Subscriptions/quantityChangeDrawer/{queries → mutations}/quoteChargeUpdate.d.ts +0 -0
  47. /package/dist/esm/types/src/components/Subscriptions/quantityChangeDrawer/{queries → mutations}/quoteSubscriptionUpdate.d.ts +0 -0
@@ -1,9 +1,7 @@
1
1
  import { QueryClient } from '@tanstack/react-query';
2
2
  import { ThemeConfig } from 'antd';
3
- import { GraphQLClient } from 'graphql-request';
4
3
  export type BunnyContextValues = {
5
4
  apiHost: string;
6
- graphQLClient: GraphQLClient;
7
5
  token?: string;
8
6
  darkMode?: boolean;
9
7
  onTokenExpired?: () => void;
@@ -5,10 +5,6 @@ export declare const Subscriptions_SubscriptionFragment: import("gql.tada").Tada
5
5
  on: "Subscription";
6
6
  masked: true;
7
7
  }>;
8
- export type EditingQuoteDataType = {
9
- id: string;
10
- isTrial: boolean;
11
- };
12
8
  declare const SubscriptionsWrapper: ({ handlePortalErrors, companyName, isInPreviewMode, productId, className, styles: userStyles, noSubscriptionsComponent, showInactiveSubscriptions, showInactiveSubscriptionsToggle, }: {
13
9
  handlePortalErrors?: (errors: any) => void;
14
10
  companyName: string;
@@ -1,9 +1,5 @@
1
1
  import { Subscription } from '@bunnyapp/common';
2
2
  import '../../styles/index.less';
3
- export type EditingQuoteDataType = {
4
- id: string;
5
- isTrial: boolean;
6
- };
7
3
  declare const SubscriptionsListContainer: ({ companyName, showInactive, onCancelSubscriptionClick, onChangePlanClick, noSubscriptionsComponent, subscriptions, subscriptionsAreLoading, }: {
8
4
  companyName: string;
9
5
  showInactive?: boolean;
@@ -1,4 +1,3 @@
1
- import { Quote } from '@bunnyapp/common';
2
1
  import { FragmentOf } from 'gql.tada';
3
2
  export declare const QuantityChangeGridRow_SubscriptionChargeFragment: import("gql.tada").TadaDocumentNode<{
4
3
  id: string | null;
@@ -39,10 +38,7 @@ export declare const QuantityChangeGridRow_SubscriptionFragment: import("gql.tad
39
38
  on: "Subscription";
40
39
  masked: true;
41
40
  }>;
42
- declare const QuantityChangeGridRow: ({ editingQuote, editingQuoteId, setEditingQuoteData, subscription: maskedSubscription, subscriptionCharge: maskedSubscriptionCharge, setUpdatingChargeQuantityId, updatingChargeQuantityId, setErrorUpdatingQuantity, }: {
43
- editingQuote?: Quote;
44
- editingQuoteId?: string;
45
- setEditingQuoteData: (value: any) => void;
41
+ declare const QuantityChangeGridRow: ({ subscription: maskedSubscription, subscriptionCharge: maskedSubscriptionCharge, setUpdatingChargeQuantityId, updatingChargeQuantityId, setErrorUpdatingQuantity, }: {
46
42
  subscription: FragmentOf<typeof QuantityChangeGridRow_SubscriptionFragment>;
47
43
  subscriptionCharge: FragmentOf<typeof QuantityChangeGridRow_SubscriptionChargeFragment>;
48
44
  setUpdatingChargeQuantityId: (updatingChargeQuantityId: string | undefined) => void;
@@ -1,9 +1,5 @@
1
1
  import { FragmentOf } from 'gql.tada';
2
2
  import { QuantityDrawerDesktop_SubscriptionFragment } from './quantityChangeDrawerDesktop/QuantityChangeDrawerDesktop';
3
- export type EditingQuoteDataType = {
4
- id: string;
5
- isTrial: boolean;
6
- };
7
3
  interface QuantityDrawerProps {
8
4
  subscriptions: (FragmentOf<typeof QuantityDrawerDesktop_SubscriptionFragment> | null)[];
9
5
  quantityDrawerOpen: boolean;
@@ -11,5 +7,6 @@ interface QuantityDrawerProps {
11
7
  handlePortalErrors?: (errors: any) => void;
12
8
  setShowInactive: (showInactive: boolean) => void;
13
9
  }
10
+ export declare const QuantityDrawerContent: ({ subscriptions, quantityDrawerOpen, setQuantityDrawerOpen, handlePortalErrors, setShowInactive, }: QuantityDrawerProps) => import("react/jsx-runtime").JSX.Element;
14
11
  export declare const QuantityDrawer: ({ subscriptions, quantityDrawerOpen, setQuantityDrawerOpen, handlePortalErrors, setShowInactive, }: QuantityDrawerProps) => import("react/jsx-runtime").JSX.Element;
15
12
  export {};
@@ -1,10 +1,15 @@
1
- import { Quote } from '@bunnyapp/common';
2
- import { EditingQuoteDataType } from '../SubscriptionsListContainer';
3
- declare const QuoteChangeSummarySection: ({ editingQuote, editingQuoteData, openCheckout, setEditingQuoteData, errorUpdatingQuantity, }: {
4
- editingQuote?: Quote;
5
- editingQuoteData?: EditingQuoteDataType;
1
+ export declare const QuoteChangeSummarySection_QuoteFragment: import("gql.tada").TadaDocumentNode<{
2
+ id: string | null;
3
+ amountDue: number | null;
4
+ amount: number;
5
+ currencyId: string;
6
+ }, {}, {
7
+ fragment: "QuoteChangeSummarySection_QuoteFragment";
8
+ on: "Quote";
9
+ masked: true;
10
+ }>;
11
+ declare const QuoteChangeSummarySection: ({ openCheckout, errorUpdatingQuantity, }: {
6
12
  openCheckout: () => void;
7
- setEditingQuoteData: (editingQuoteData: EditingQuoteDataType | undefined) => void;
8
13
  errorUpdatingQuantity: boolean;
9
14
  }) => import("react/jsx-runtime").JSX.Element;
10
15
  export default QuoteChangeSummarySection;
@@ -0,0 +1,5 @@
1
+ declare const QuoteIdProvider: ({ initialValue, children, }: {
2
+ initialValue?: string | undefined;
3
+ children?: import("react").ReactNode;
4
+ }) => import("react/jsx-runtime").JSX.Element, useQuoteId: () => [string | undefined, import("react").Dispatch<import("react").SetStateAction<string | undefined>>];
5
+ export { QuoteIdProvider, useQuoteId };
@@ -2,6 +2,10 @@ export declare const QuantityDrawer_QuoteFragment: import("gql.tada").TadaDocume
2
2
  id: string | null;
3
3
  [$tada.fragmentRefs]: {
4
4
  Checkout_QuoteFragment: "Quote";
5
+ } & {
6
+ QuantityInput_QuoteFragment: "Quote";
7
+ } & {
8
+ QuoteChangeSummarySection_QuoteFragment: "Quote";
5
9
  };
6
10
  }, {}, {
7
11
  fragment: "QuantityDrawer_QuoteFragment";
@@ -1,3 +1,3 @@
1
- import { FragmentOf } from 'gql.tada';
2
- import { QuantityDrawer_QuoteFragment } from '../fragments/QuantityDrawerQuoteFragment';
3
- export declare const useQuoteQueryData: (quoteId: string | undefined) => FragmentOf<typeof QuantityDrawer_QuoteFragment> | undefined;
1
+ import { ResultOf } from 'gql.tada';
2
+ import { QuantityDrawer_QuoteFragment } from '../fragments/QuantityDrawer_QuoteFragment';
3
+ export declare const useQuoteQueryData: (quoteId: string | undefined) => ResultOf<typeof QuantityDrawer_QuoteFragment> | undefined;
@@ -1,5 +1,5 @@
1
1
  import { FragmentOf } from 'gql.tada';
2
- import { QuantityDrawer_QuoteFragment } from '../fragments/QuantityDrawerQuoteFragment';
2
+ import { QuantityDrawer_QuoteFragment } from '../fragments/QuantityDrawer_QuoteFragment';
3
3
  export declare const useSetQuoteQueryData: () => {
4
- setQuoteQueryData: (quoteId: string, maskedQuote: FragmentOf<typeof QuantityDrawer_QuoteFragment> | null) => void;
4
+ setQuoteQueryData: (quoteId: string, quote: FragmentOf<typeof QuantityDrawer_QuoteFragment> | null) => void;
5
5
  };
@@ -1,6 +1,4 @@
1
- import { Quote } from '@bunnyapp/common';
2
1
  import { FragmentOf } from 'gql.tada';
3
- import { EditingQuoteDataType } from '../../SubscriptionsListContainer';
4
2
  export declare const QuantityDrawerDesktop_SubscriptionFragment: import("gql.tada").TadaDocumentNode<{
5
3
  currentCharges: {
6
4
  chargeType: "ONE_TIME" | "RECURRING" | "USAGE" | null;
@@ -16,13 +14,10 @@ export declare const QuantityDrawerDesktop_SubscriptionFragment: import("gql.tad
16
14
  on: "Subscription";
17
15
  masked: true;
18
16
  }>;
19
- declare const QuantityChangeDrawerDesktop: ({ editingQuote, editingQuoteData, onClose, open, openCheckout, setEditingQuoteData, subscriptions, setUpdatingChargeQuantityId, updatingChargeQuantityId, }: {
20
- editingQuote?: Quote;
21
- editingQuoteData?: EditingQuoteDataType;
17
+ declare const QuantityChangeDrawerDesktop: ({ onClose, open, openCheckout, subscriptions, setUpdatingChargeQuantityId, updatingChargeQuantityId, }: {
22
18
  onClose: () => void;
23
19
  open: boolean;
24
20
  openCheckout: () => void;
25
- setEditingQuoteData: (value: EditingQuoteDataType | undefined) => void;
26
21
  subscriptions: (FragmentOf<typeof QuantityDrawerDesktop_SubscriptionFragment> | null)[];
27
22
  setUpdatingChargeQuantityId: (updatingChargeQuantityId: string | undefined) => void;
28
23
  updatingChargeQuantityId: string | undefined;
@@ -1,4 +1,3 @@
1
- import { Quote } from '@bunnyapp/common';
2
1
  import { FragmentOf } from 'gql.tada';
3
2
  export declare const QuantityInput_SubscriptionChargeFragment: import("gql.tada").TadaDocumentNode<{
4
3
  id: string | null;
@@ -31,14 +30,8 @@ export declare const QuantityInput_SubscriptionFragment: import("gql.tada").Tada
31
30
  on: "Subscription";
32
31
  masked: true;
33
32
  }>;
34
- declare const QuantityInput: ({ charge: maskedCharge, editingQuote, editingQuoteId, setEditingQuoteData, subscription: maskedSubscription, setUpdatingChargeQuantityId, updatingChargeQuantityId, setErrorUpdatingQuantity, }: {
33
+ declare const QuantityInput: ({ charge: maskedCharge, subscription: maskedSubscription, setUpdatingChargeQuantityId, updatingChargeQuantityId, setErrorUpdatingQuantity, }: {
35
34
  charge: FragmentOf<typeof QuantityInput_SubscriptionChargeFragment>;
36
- editingQuote?: Quote;
37
- editingQuoteId?: string;
38
- setEditingQuoteData: (editingQuoteData: {
39
- id: string;
40
- isTrial: boolean;
41
- } | undefined) => void;
42
35
  subscription: FragmentOf<typeof QuantityInput_SubscriptionFragment>;
43
36
  setUpdatingChargeQuantityId: (updatingChargeQuantityId: string | undefined) => void;
44
37
  updatingChargeQuantityId: string | undefined;
@@ -0,0 +1,27 @@
1
+ export declare const QuantityInput_QuoteFragment: import("gql.tada").TadaDocumentNode<{
2
+ id: string | null;
3
+ quoteChanges: {
4
+ id: string | null;
5
+ priceList: {
6
+ id: string;
7
+ } | null;
8
+ charges: {
9
+ id: string | null;
10
+ priceListCharge: {
11
+ id: string;
12
+ } | null;
13
+ }[];
14
+ subscription: {
15
+ charges: {
16
+ id: string | null;
17
+ priceListCharge: {
18
+ id: string;
19
+ } | null;
20
+ }[] | null;
21
+ } | null;
22
+ }[] | null;
23
+ }, {}, {
24
+ fragment: "QuantityInput_QuoteFragment";
25
+ on: "Quote";
26
+ masked: true;
27
+ }>;
@@ -4,6 +4,7 @@ export declare const CanShowQuantitiesInput_SubscriptionChargeFragment: import("
4
4
  pricingModel: "FLAT" | "TIERED" | "VOLUME" | "BANDS" | null;
5
5
  expired: boolean;
6
6
  selfServiceQuantity: boolean | null;
7
+ kind: "SUBSCRIBE" | "UPDATE" | "RENEW" | "REINSTATE" | "UNSUBSCRIBE" | "ADJUSTMENT" | "COUPON" | "DISCOUNT" | "CREDIT" | "PRICE_UPDATE" | "QUANTITY_UPDATE" | "FREE_PERIOD_DISCOUNT" | "ACTIVATE" | null;
7
8
  }, {}, {
8
9
  fragment: "CanShowQuantitiesInput_SubscriptionChargeFragment";
9
10
  on: "SubscriptionCharge";
@@ -15,7 +16,7 @@ export declare const CanShowQuantitiesInput_SubscriptionFragment: import("gql.ta
15
16
  priceList: {
16
17
  id: string;
17
18
  } | null;
18
- chargeReport: {
19
+ currentCharges: {
19
20
  [$tada.fragmentRefs]: {
20
21
  CanShowQuantitiesInput_SubscriptionChargeFragment: "SubscriptionCharge";
21
22
  };
@@ -0,0 +1 @@
1
+ export declare const useAllErrorFormats: () => (error: any, mutationName?: string) => any;
@@ -0,0 +1,2 @@
1
+ import { QueryClient } from '@tanstack/react-query';
2
+ export declare const useCreateQueryClient: () => () => QueryClient;
@@ -0,0 +1,11 @@
1
+ import { ReactNode } from 'react';
2
+ /**
3
+ * Creates a context and provider for a state value
4
+ * @param useValue - A function that returns the state value
5
+ * @returns A tuple containing the provider and the context value
6
+ * @example take a look at how this is used in the quoteIdContext in the QuantityDrawer
7
+ */
8
+ export declare const createStateContext: <Value, State>(useValue: (init?: Value) => State) => readonly [({ initialValue, children, }: {
9
+ initialValue?: Value;
10
+ children?: ReactNode;
11
+ }) => import("react/jsx-runtime").JSX.Element, () => State & ({} | undefined)];
@@ -1,5 +1,5 @@
1
1
  import { Plan, Product } from '@bunnyapp/common';
2
2
  import { BillingPeriod } from '@/graphql-codegen/exportedScalarTypes';
3
3
  export declare const periodMonthsConverter: (period?: number) => "ONCE" | "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "ANNUAL";
4
- export declare const billingPeriodConverter: (period?: BillingPeriod) => 1 | 0 | 3 | 6 | 12;
4
+ export declare const billingPeriodConverter: (period?: BillingPeriod) => 0 | 1 | 3 | 6 | 12;
5
5
  export declare const createAvailableBillingPeriods: (plans?: Plan[], selectedProduct?: Product) => (0 | 1 | 3 | 6 | 12)[] | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bunnyapp/components",
3
- "version": "1.6.0-beta.15",
3
+ "version": "1.6.0-beta.16",
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",
@@ -1,2 +0,0 @@
1
- import { GraphQLClient } from "graphql-request";
2
- export declare const createGraphQLClient: (apiHost: string, token?: string) => GraphQLClient;
@@ -1,2 +0,0 @@
1
- import { GraphQLClient } from "graphql-request";
2
- export declare const createGraphQLClient: (apiHost: string, token?: string) => GraphQLClient;