@bunnyapp/components 1.7.0-beta.34 → 1.7.0-beta.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +2952 -2602
- package/dist/cjs/types/src/components/Checkout/Checkout.d.ts +2 -1
- package/dist/cjs/types/src/components/Checkout/QuoteCheckout.d.ts +3 -1
- package/dist/cjs/types/src/components/Checkout/QuoteIsLoadingIndicator.d.ts +1 -0
- package/dist/cjs/types/src/components/PaymentForm/PaymentForm.d.ts +2 -1
- package/dist/cjs/types/src/components/PaymentForm/context/PaymentProvider.d.ts +7 -1
- package/dist/cjs/types/src/components/QuoteProvider/context/QuoteContext.d.ts +1 -0
- package/dist/cjs/types/src/components/QuoteProvider/context/quantityEditableChargesContext.d.ts +32 -0
- package/dist/cjs/types/src/components/QuoteProvider/fragments/quoteFragment.d.ts +3 -0
- package/dist/cjs/types/src/components/QuoteProvider/hooks/useFeatureQuantities.d.ts +4 -4
- package/dist/cjs/types/src/components/QuoteProvider/hooks/useIsFetchingQuote.d.ts +4 -0
- package/dist/cjs/types/src/components/QuoteProvider/hooks/useQuantityEditableCharges.d.ts +70 -0
- package/dist/cjs/types/src/components/QuoteProvider/hooks/useQuoteQuantities.d.ts +28 -4
- package/dist/cjs/types/src/components/QuoteProvider/hooks/useSelectedPriceListQuoteChange.d.ts +37 -0
- package/dist/cjs/types/src/components/QuoteProvider/mutations/quoteChargeCreate.d.ts +23 -0
- package/dist/cjs/types/src/components/QuoteProvider/mutations/quoteChargeUpdate.d.ts +12 -0
- package/dist/cjs/types/src/components/QuoteProvider/quoteMutationKeys.d.ts +20 -0
- package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/checkoutBar/CheckoutBarInput/CheckoutBarInput.d.ts +21 -0
- package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/checkoutBar/CheckoutBarInput/hooks/useChargeCRUD.d.ts +31 -0
- package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/checkoutBar/PlanPickerCheckoutBar.d.ts +9 -14
- package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/checkoutBar/fragments/PlanPickerCheckoutBar_QuoteFragment.d.ts +20 -0
- package/dist/cjs/types/src/components/Subscriptions/context/upgradingSubscriptionContext.d.ts +12 -0
- package/dist/cjs/types/src/components/Subscriptions/fragments/UpgradingSubscriptionContext_SubscriptionFragment.d.ts +6 -0
- package/dist/cjs/types/src/components/Subscriptions/quantityChangeDrawer/context/quoteRecalculateTaxesContext.d.ts +4 -1
- package/dist/cjs/types/src/utils/chargeUtils.d.ts +10 -5
- package/dist/esm/index.js +2954 -2604
- package/dist/esm/types/src/components/Checkout/Checkout.d.ts +2 -1
- package/dist/esm/types/src/components/Checkout/QuoteCheckout.d.ts +3 -1
- package/dist/esm/types/src/components/Checkout/QuoteIsLoadingIndicator.d.ts +1 -0
- package/dist/esm/types/src/components/PaymentForm/PaymentForm.d.ts +2 -1
- package/dist/esm/types/src/components/PaymentForm/context/PaymentProvider.d.ts +7 -1
- package/dist/esm/types/src/components/QuoteProvider/context/QuoteContext.d.ts +1 -0
- package/dist/esm/types/src/components/QuoteProvider/context/quantityEditableChargesContext.d.ts +32 -0
- package/dist/esm/types/src/components/QuoteProvider/fragments/quoteFragment.d.ts +3 -0
- package/dist/esm/types/src/components/QuoteProvider/hooks/useFeatureQuantities.d.ts +4 -4
- package/dist/esm/types/src/components/QuoteProvider/hooks/useIsFetchingQuote.d.ts +4 -0
- package/dist/esm/types/src/components/QuoteProvider/hooks/useQuantityEditableCharges.d.ts +70 -0
- package/dist/esm/types/src/components/QuoteProvider/hooks/useQuoteQuantities.d.ts +28 -4
- package/dist/esm/types/src/components/QuoteProvider/hooks/useSelectedPriceListQuoteChange.d.ts +37 -0
- package/dist/esm/types/src/components/QuoteProvider/mutations/quoteChargeCreate.d.ts +23 -0
- package/dist/esm/types/src/components/QuoteProvider/mutations/quoteChargeUpdate.d.ts +12 -0
- package/dist/esm/types/src/components/QuoteProvider/quoteMutationKeys.d.ts +20 -0
- package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/checkoutBar/CheckoutBarInput/CheckoutBarInput.d.ts +21 -0
- package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/checkoutBar/CheckoutBarInput/hooks/useChargeCRUD.d.ts +31 -0
- package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/checkoutBar/PlanPickerCheckoutBar.d.ts +9 -14
- package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/checkoutBar/fragments/PlanPickerCheckoutBar_QuoteFragment.d.ts +20 -0
- package/dist/esm/types/src/components/Subscriptions/context/upgradingSubscriptionContext.d.ts +12 -0
- package/dist/esm/types/src/components/Subscriptions/fragments/UpgradingSubscriptionContext_SubscriptionFragment.d.ts +6 -0
- package/dist/esm/types/src/components/Subscriptions/quantityChangeDrawer/context/quoteRecalculateTaxesContext.d.ts +4 -1
- package/dist/esm/types/src/utils/chargeUtils.d.ts +10 -5
- package/dist/index.d.ts +2 -1
- package/package.json +1 -1
- package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/checkoutBar/CheckoutBarInput.d.ts +0 -8
- package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/checkoutBar/CheckoutBarInput.d.ts +0 -8
|
@@ -24,6 +24,7 @@ type CheckoutProps = {
|
|
|
24
24
|
quote?: FragmentOf<typeof Checkout_QuoteFragment> | null;
|
|
25
25
|
token?: string;
|
|
26
26
|
isUpdatingQuote: boolean;
|
|
27
|
+
isRecalculatingTaxes: boolean;
|
|
27
28
|
};
|
|
28
|
-
declare const Checkout: ({ onCancel, onSuccess, onFail, onRecalculateTaxes, invoice, open, quote: maskedQuote, isUpdatingQuote, }: CheckoutProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
29
|
+
declare const Checkout: ({ onCancel, onSuccess, onFail, onRecalculateTaxes, invoice, open, quote: maskedQuote, isUpdatingQuote, isRecalculatingTaxes, }: CheckoutProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
29
30
|
export default Checkout;
|
|
@@ -100,6 +100,8 @@ interface QuoteCheckoutProps extends InvoiceQuoteParentProps {
|
|
|
100
100
|
token?: string;
|
|
101
101
|
storedPaymentMethod?: PaymentMethod;
|
|
102
102
|
onRecalculateTaxes: () => void;
|
|
103
|
+
isUpdatingQuote: boolean;
|
|
104
|
+
isRecalculatingTaxes: boolean;
|
|
103
105
|
}
|
|
104
|
-
declare const QuoteCheckout: ({ account, onSuccess, onFail, quote: maskedQuote, taxationRequiredAccountFields, onRecalculateTaxes, }: QuoteCheckoutProps) => import("react/jsx-runtime").JSX.Element;
|
|
106
|
+
declare const QuoteCheckout: ({ account, onSuccess, onFail, quote: maskedQuote, taxationRequiredAccountFields, isUpdatingQuote, onRecalculateTaxes, isRecalculatingTaxes, }: QuoteCheckoutProps) => import("react/jsx-runtime").JSX.Element;
|
|
105
107
|
export default QuoteCheckout;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function QuoteLoadingIndicator(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -14,7 +14,7 @@ export declare const PaymentForm_QuoteFragment: import("gql.tada").TadaDocumentN
|
|
|
14
14
|
on: "Quote";
|
|
15
15
|
masked: true;
|
|
16
16
|
}>;
|
|
17
|
-
export declare function PaymentForm({ currencyId: accountCurrencyId, invoice, quote: maskedQuote, onPaymentSuccess, onPaymentHoldSuccess, paymentHoldPrecondition, accountId, onSavePaymentMethod, onPaymentMethodRemoved, onSetDefaultPaymentMethod, overrideToken, customCheckoutFunction, paymentHoldOptions, }: {
|
|
17
|
+
export declare function PaymentForm({ currencyId: accountCurrencyId, invoice, quote: maskedQuote, onPaymentSuccess, onPaymentHoldSuccess, paymentHoldPrecondition, accountId, onSavePaymentMethod, onPaymentMethodRemoved, onSetDefaultPaymentMethod, overrideToken, customCheckoutFunction, paymentHoldOptions, disablePayButton, }: {
|
|
18
18
|
currencyId?: string;
|
|
19
19
|
invoice?: FormattedInvoice | Invoice;
|
|
20
20
|
quote?: FragmentOf<typeof PaymentForm_QuoteFragment>;
|
|
@@ -34,5 +34,6 @@ export declare function PaymentForm({ currencyId: accountCurrencyId, invoice, qu
|
|
|
34
34
|
payToAccept?: boolean;
|
|
35
35
|
amountToHold?: number;
|
|
36
36
|
};
|
|
37
|
+
disablePayButton?: boolean;
|
|
37
38
|
}): import("react/jsx-runtime").JSX.Element | null;
|
|
38
39
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import FormattedInvoice from '@/types/FormattedInvoice';
|
|
2
2
|
import Invoice from '@/types/Invoice';
|
|
3
3
|
import { FragmentOf } from 'gql.tada';
|
|
4
|
+
import { ReactNode } from 'react';
|
|
4
5
|
import { PaymentType } from '../types/PaymentType';
|
|
5
6
|
declare const useFormattedAmountDue: () => string | undefined;
|
|
6
7
|
declare const usePaymentType: () => PaymentType | undefined;
|
|
@@ -13,7 +14,12 @@ declare const useHandlePaymentFormSubmit: () => (demoPayCardDetails?: {
|
|
|
13
14
|
declare const useIsSaving: () => boolean | undefined;
|
|
14
15
|
declare const useIsPaid: () => boolean | undefined;
|
|
15
16
|
declare const useAccountId: () => string | undefined;
|
|
16
|
-
|
|
17
|
+
declare const IsPayButtonDisabledProvider: ({ value, children }: {
|
|
18
|
+
value: boolean | undefined;
|
|
19
|
+
children?: ReactNode;
|
|
20
|
+
}) => import("react/jsx-runtime").JSX.Element, useIsPayButtonDisabled: () => boolean | undefined;
|
|
21
|
+
export { useAccountId, useFormattedAmountDue, useHandlePaymentFormSubmit, useIsPaid, useIsPaying, useIsSaving, usePaymentType, useIsPayButtonDisabled, };
|
|
22
|
+
export { IsPayButtonDisabledProvider };
|
|
17
23
|
export declare const PaymentProvider_QuoteFragment: import("gql.tada").TadaDocumentNode<{
|
|
18
24
|
id: string | null;
|
|
19
25
|
[$tada.fragmentRefs]: {
|
|
@@ -8,6 +8,7 @@ export type QuoteContextValues = {
|
|
|
8
8
|
isAddonPlanLoading: boolean;
|
|
9
9
|
isFeatureAddonsLoading: boolean;
|
|
10
10
|
isUpdatingQuote: boolean;
|
|
11
|
+
isRecalculatingTaxes: boolean;
|
|
11
12
|
setIsAddonPlanLoading: React.Dispatch<React.SetStateAction<boolean>>;
|
|
12
13
|
addFeatureAddonLoading: (featureAddonId: string) => void;
|
|
13
14
|
removeFeatureAddonLoading: (featureAddonId: string) => void;
|
package/dist/esm/types/src/components/QuoteProvider/context/quantityEditableChargesContext.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare const QuantityEditableChargesProvider: ({ value, children }: {
|
|
2
|
+
value: {
|
|
3
|
+
feature: {
|
|
4
|
+
id: string;
|
|
5
|
+
} | null;
|
|
6
|
+
deprecated: boolean | null;
|
|
7
|
+
id: string;
|
|
8
|
+
featureAddon: boolean | null;
|
|
9
|
+
[$tada.fragmentRefs]: {
|
|
10
|
+
CanEditChargeQuantity_PriceListChargeFragment: "PriceListCharge";
|
|
11
|
+
} & {
|
|
12
|
+
PlanPickerCheckoutBar_PriceListChargeFragment: "PriceListCharge";
|
|
13
|
+
} & {
|
|
14
|
+
useQuoteQuantities_PriceListChargeFragment: "PriceListCharge";
|
|
15
|
+
};
|
|
16
|
+
}[] | undefined;
|
|
17
|
+
children?: import("react").ReactNode;
|
|
18
|
+
}) => import("react/jsx-runtime").JSX.Element, useQuantityEditableChargesContext: () => {
|
|
19
|
+
feature: {
|
|
20
|
+
id: string;
|
|
21
|
+
} | null;
|
|
22
|
+
deprecated: boolean | null;
|
|
23
|
+
id: string;
|
|
24
|
+
featureAddon: boolean | null;
|
|
25
|
+
[$tada.fragmentRefs]: {
|
|
26
|
+
CanEditChargeQuantity_PriceListChargeFragment: "PriceListCharge";
|
|
27
|
+
} & {
|
|
28
|
+
PlanPickerCheckoutBar_PriceListChargeFragment: "PriceListCharge";
|
|
29
|
+
} & {
|
|
30
|
+
useQuoteQuantities_PriceListChargeFragment: "PriceListCharge";
|
|
31
|
+
};
|
|
32
|
+
}[] | undefined;
|
|
@@ -29,6 +29,9 @@ export declare const QuoteContext_QuoteFragment: import("gql.tada").TadaDocument
|
|
|
29
29
|
quantityMin: number | null;
|
|
30
30
|
quantityMax: number | null;
|
|
31
31
|
selfServiceQuantity: boolean | null;
|
|
32
|
+
[$tada.fragmentRefs]: {
|
|
33
|
+
CanEditChargeQuantity_PriceListChargeFragment: "PriceListCharge";
|
|
34
|
+
};
|
|
32
35
|
} | null;
|
|
33
36
|
feature: {
|
|
34
37
|
id: string;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export type FeatureQuantitiesDict = Record<string, number | undefined>;
|
|
2
2
|
/**
|
|
3
|
-
* Hook to manage feature quantities
|
|
4
|
-
*
|
|
3
|
+
* Hook to manage feature quantities per (featureId, priceListChargeId) pair.
|
|
4
|
+
* Supports different quantities for different price list charges that share a feature.
|
|
5
5
|
*/
|
|
6
6
|
export declare function useFeatureQuantities({ onFeatureQuantitiesChanged, }: {
|
|
7
7
|
onFeatureQuantitiesChanged?: (featureQuantities: FeatureQuantitiesDict) => void;
|
|
8
8
|
}): {
|
|
9
9
|
featureQuantities: FeatureQuantitiesDict;
|
|
10
|
-
getFeatureQuantity: (featureId: string,
|
|
11
|
-
onUpdateFeatureQuantity: (featureId: string, quantity: number) => void;
|
|
10
|
+
getFeatureQuantity: (featureId: string, priceListChargeId: string, featureQuantitiesSnapshot?: FeatureQuantitiesDict) => number | undefined;
|
|
11
|
+
onUpdateFeatureQuantity: (featureId: string, priceListChargeId: string, quantity: number) => void;
|
|
12
12
|
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { FragmentOf, ResultOf } from 'gql.tada';
|
|
2
|
+
import { QuoteContext_QuoteFragment } from '../fragments/quoteFragment';
|
|
3
|
+
export declare const useQuantityEditableCharges_SubscriptionFragment: import("gql.tada").TadaDocumentNode<{
|
|
4
|
+
id: string;
|
|
5
|
+
currentCharges: {
|
|
6
|
+
quantity: number | null;
|
|
7
|
+
priceListCharge: {
|
|
8
|
+
id: string;
|
|
9
|
+
} | null;
|
|
10
|
+
}[] | null;
|
|
11
|
+
}, {}, {
|
|
12
|
+
fragment: "useQuantityEditableCharges_SubscriptionFragment";
|
|
13
|
+
on: "Subscription";
|
|
14
|
+
masked: true;
|
|
15
|
+
}>;
|
|
16
|
+
export declare const useQuantityEditableCharges_PriceListFragment: import("gql.tada").TadaDocumentNode<{
|
|
17
|
+
id: string;
|
|
18
|
+
charges: {
|
|
19
|
+
feature: {
|
|
20
|
+
id: string;
|
|
21
|
+
} | null;
|
|
22
|
+
deprecated: boolean | null;
|
|
23
|
+
id: string;
|
|
24
|
+
featureAddon: boolean | null;
|
|
25
|
+
[$tada.fragmentRefs]: {
|
|
26
|
+
CanEditChargeQuantity_PriceListChargeFragment: "PriceListCharge";
|
|
27
|
+
} & {
|
|
28
|
+
PlanPickerCheckoutBar_PriceListChargeFragment: "PriceListCharge";
|
|
29
|
+
} & {
|
|
30
|
+
useQuoteQuantities_PriceListChargeFragment: "PriceListCharge";
|
|
31
|
+
};
|
|
32
|
+
}[] | null;
|
|
33
|
+
[$tada.fragmentRefs]: {
|
|
34
|
+
useSelectedPriceListQuoteChange_PriceListFragment: "PriceList";
|
|
35
|
+
};
|
|
36
|
+
}, {}, {
|
|
37
|
+
fragment: "useQuantityEditableCharges_PriceListFragment";
|
|
38
|
+
on: "PriceList";
|
|
39
|
+
masked: true;
|
|
40
|
+
}>;
|
|
41
|
+
/**
|
|
42
|
+
* Hook to provide list of pricelist charges whose quantities can be edited
|
|
43
|
+
*/
|
|
44
|
+
export declare function useQuantityEditableCharges({ upgradingSubscription: maskedUpgradingSubscription, pricelist: maskedPricelist, quote }: {
|
|
45
|
+
upgradingSubscription: FragmentOf<typeof useQuantityEditableCharges_SubscriptionFragment> | undefined;
|
|
46
|
+
pricelist: FragmentOf<typeof useQuantityEditableCharges_PriceListFragment> | null;
|
|
47
|
+
quote: ResultOf<typeof QuoteContext_QuoteFragment> | null | undefined;
|
|
48
|
+
}): {
|
|
49
|
+
quantityEditableCharges: {
|
|
50
|
+
feature: {
|
|
51
|
+
id: string;
|
|
52
|
+
} | null;
|
|
53
|
+
deprecated: boolean | null;
|
|
54
|
+
id: string;
|
|
55
|
+
featureAddon: boolean | null;
|
|
56
|
+
[$tada.fragmentRefs]: {
|
|
57
|
+
CanEditChargeQuantity_PriceListChargeFragment: "PriceListCharge";
|
|
58
|
+
} & {
|
|
59
|
+
PlanPickerCheckoutBar_PriceListChargeFragment: "PriceListCharge";
|
|
60
|
+
} & {
|
|
61
|
+
useQuoteQuantities_PriceListChargeFragment: "PriceListCharge";
|
|
62
|
+
};
|
|
63
|
+
}[] | undefined;
|
|
64
|
+
findSubscriptionCharge: (priceListChargeId: string) => {
|
|
65
|
+
quantity: number | null;
|
|
66
|
+
priceListCharge: {
|
|
67
|
+
id: string;
|
|
68
|
+
} | null;
|
|
69
|
+
} | undefined;
|
|
70
|
+
};
|
|
@@ -1,11 +1,35 @@
|
|
|
1
1
|
import PriceList from '@/types/PriceList';
|
|
2
|
-
import { ResultOf } from 'gql.tada';
|
|
2
|
+
import { FragmentOf, ResultOf } from 'gql.tada';
|
|
3
3
|
import { QuoteContext_QuoteFragment } from '../fragments/quoteFragment';
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const useQuoteQuantities_PriceListChargeFragment: import("gql.tada").TadaDocumentNode<{
|
|
5
|
+
feature: {
|
|
6
|
+
id: string;
|
|
7
|
+
} | null;
|
|
8
|
+
id: string;
|
|
9
|
+
quantityMax: number | null;
|
|
10
|
+
quantityMin: number | null;
|
|
11
|
+
selfServiceQuantity: boolean | null;
|
|
12
|
+
}, {}, {
|
|
13
|
+
fragment: "useQuoteQuantities_PriceListChargeFragment";
|
|
14
|
+
on: "PriceListCharge";
|
|
15
|
+
masked: true;
|
|
16
|
+
}>;
|
|
17
|
+
export declare const useQuoteQuantities_SubscriptionFragment: import("gql.tada").TadaDocumentNode<{
|
|
18
|
+
currentCharges: {
|
|
19
|
+
id: string | null;
|
|
20
|
+
quantity: number | null;
|
|
21
|
+
}[] | null;
|
|
22
|
+
}, {}, {
|
|
23
|
+
fragment: "useQuoteQuantities_SubscriptionFragment";
|
|
24
|
+
on: "Subscription";
|
|
25
|
+
masked: true;
|
|
26
|
+
}>;
|
|
27
|
+
export declare const useQuoteQuantities: ({ selectedPriceList, quote, quantityEditableCharges: maskedQuantityEditableCharges, }: {
|
|
5
28
|
selectedPriceList: PriceList;
|
|
6
29
|
quote: ResultOf<typeof QuoteContext_QuoteFragment> | null | undefined;
|
|
30
|
+
quantityEditableCharges: FragmentOf<typeof useQuoteQuantities_PriceListChargeFragment>[] | undefined;
|
|
7
31
|
}) => {
|
|
8
32
|
onChangeQuantity: (priceListChargeId: string, quantity: number) => void;
|
|
9
|
-
getFeatureQuantity: (featureId: string) => number | undefined;
|
|
10
|
-
|
|
33
|
+
getFeatureQuantity: (featureId: string, chargeId: string) => number | undefined;
|
|
34
|
+
featureQuantities: import("./useFeatureQuantities").FeatureQuantitiesDict;
|
|
11
35
|
};
|
package/dist/esm/types/src/components/QuoteProvider/hooks/useSelectedPriceListQuoteChange.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { FragmentOf, ResultOf } from 'gql.tada';
|
|
2
|
+
import { QuoteContext_QuoteFragment } from '../fragments/quoteFragment';
|
|
3
|
+
export declare const useSelectedPriceListQuoteChange_PriceListFragment: import("gql.tada").TadaDocumentNode<{
|
|
4
|
+
id: string;
|
|
5
|
+
}, {}, {
|
|
6
|
+
fragment: "useSelectedPriceListQuoteChange_PriceListFragment";
|
|
7
|
+
on: "PriceList";
|
|
8
|
+
masked: true;
|
|
9
|
+
}>;
|
|
10
|
+
export declare function useSelectedPriceListQuoteChange({ quote, selectedPriceList: maskedSelectedPriceList, }: {
|
|
11
|
+
quote: ResultOf<typeof QuoteContext_QuoteFragment> | null | undefined;
|
|
12
|
+
selectedPriceList: FragmentOf<typeof useSelectedPriceListQuoteChange_PriceListFragment> | null;
|
|
13
|
+
}): {
|
|
14
|
+
id: string | null;
|
|
15
|
+
kind: "SUBSCRIBE" | "UPDATE" | "RENEW" | "REINSTATE" | "UNSUBSCRIBE" | "ADJUSTMENT" | "COUPON" | "DISCOUNT" | "CREDIT" | "PRICE_UPDATE" | "QUANTITY_UPDATE" | "FREE_PERIOD_DISCOUNT" | "ACTIVATE";
|
|
16
|
+
priceList: {
|
|
17
|
+
id: string;
|
|
18
|
+
} | null;
|
|
19
|
+
charges: {
|
|
20
|
+
priceListCharge: {
|
|
21
|
+
id: string;
|
|
22
|
+
chargeType: "ONE_TIME" | "RECURRING" | "USAGE" | null;
|
|
23
|
+
pricingModel: "FLAT" | "TIERED" | "VOLUME" | "BANDS" | null;
|
|
24
|
+
quantityMin: number | null;
|
|
25
|
+
quantityMax: number | null;
|
|
26
|
+
selfServiceQuantity: boolean | null;
|
|
27
|
+
[$tada.fragmentRefs]: {
|
|
28
|
+
CanEditChargeQuantity_PriceListChargeFragment: "PriceListCharge";
|
|
29
|
+
};
|
|
30
|
+
} | null;
|
|
31
|
+
feature: {
|
|
32
|
+
id: string;
|
|
33
|
+
} | null;
|
|
34
|
+
quantity: number | null;
|
|
35
|
+
id: string | null;
|
|
36
|
+
}[];
|
|
37
|
+
} | undefined;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
type QuoteChangeCreateChargeProps = {
|
|
2
|
+
apiHost: string;
|
|
3
|
+
price?: number;
|
|
4
|
+
priceListChargeId?: string;
|
|
5
|
+
quantity?: number;
|
|
6
|
+
quoteChangeId: string;
|
|
7
|
+
startDate: string;
|
|
8
|
+
subscriptionChargeId?: string;
|
|
9
|
+
token?: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const quoteChargeCreate: ({ price, priceListChargeId, quantity, quoteChangeId, startDate, subscriptionChargeId, token, apiHost, }: QuoteChangeCreateChargeProps) => Promise<{
|
|
12
|
+
quoteChange: {
|
|
13
|
+
id: string | null;
|
|
14
|
+
quoteId: string;
|
|
15
|
+
quote: {
|
|
16
|
+
[$tada.fragmentRefs]: {
|
|
17
|
+
QuoteContext_QuoteFragment: "Quote";
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
id: string | null;
|
|
22
|
+
} | null | undefined>;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const quoteChargeUpdate: (quoteChargeId: string, quantity: number, apiHost: string, token?: string) => Promise<{
|
|
2
|
+
quoteChange: {
|
|
3
|
+
id: string | null;
|
|
4
|
+
quoteId: string;
|
|
5
|
+
quote: {
|
|
6
|
+
[$tada.fragmentRefs]: {
|
|
7
|
+
QuoteContext_QuoteFragment: "Quote";
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
id: string | null;
|
|
12
|
+
} | null | undefined>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mutation key used by all quote-related mutations (create/update/delete quote,
|
|
3
|
+
* quote changes, quote charges, recalculate taxes, etc.).
|
|
4
|
+
* Use this when calling useMutation so that useIsQuoteMutating() can detect loading.
|
|
5
|
+
*/
|
|
6
|
+
export declare const QUOTE_MUTATION_KEY: readonly ["quote"];
|
|
7
|
+
export declare const QUOTE_RECALCULATE_TAXES_MUTATION_KEY: readonly ["quoteRecalculateTaxes"];
|
|
8
|
+
/**
|
|
9
|
+
* Returns the number of quote-related mutations currently in progress.
|
|
10
|
+
* Use in any component to show loading state or disable actions while the quote is being updated.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* const isQuoteMutating = useIsQuoteMutating();
|
|
14
|
+
* <Button disabled={isQuoteMutating}>Submit</Button>
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* const count = useIsQuoteMutating();
|
|
18
|
+
* const isQuoteMutating = count > 0;
|
|
19
|
+
*/
|
|
20
|
+
export declare function useIsQuoteMutating(): number;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { FragmentOf } from 'gql.tada';
|
|
2
|
+
export declare const CheckoutBarInput_PriceListChargeFragment: import("gql.tada").TadaDocumentNode<{
|
|
3
|
+
name: string;
|
|
4
|
+
quantityMin: number | null;
|
|
5
|
+
quantityMax: number | null;
|
|
6
|
+
id: string;
|
|
7
|
+
feature: {
|
|
8
|
+
id: string;
|
|
9
|
+
} | null;
|
|
10
|
+
}, {}, {
|
|
11
|
+
fragment: "CheckoutBarInput_PriceListChargeFragment";
|
|
12
|
+
on: "PriceListCharge";
|
|
13
|
+
masked: true;
|
|
14
|
+
}>;
|
|
15
|
+
declare const CheckoutBarInput: ({ disabled, priceListCharge: maskedPriceListCharge, quantity, onQuantityChanged, }: {
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
priceListCharge: FragmentOf<typeof CheckoutBarInput_PriceListChargeFragment>;
|
|
18
|
+
quantity: number | undefined;
|
|
19
|
+
onQuantityChanged: (quantity: number) => void;
|
|
20
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export default CheckoutBarInput;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare const useChargeCRUD_SubscriptionFragment: import("gql.tada").TadaDocumentNode<{
|
|
2
|
+
currentCharges: {
|
|
3
|
+
quantity: number | null;
|
|
4
|
+
priceListCharge: {
|
|
5
|
+
id: string;
|
|
6
|
+
} | null;
|
|
7
|
+
}[] | null;
|
|
8
|
+
}, {}, {
|
|
9
|
+
fragment: "useChargeCRUD_SubscriptionFragment";
|
|
10
|
+
on: "Subscription";
|
|
11
|
+
masked: true;
|
|
12
|
+
}>;
|
|
13
|
+
/**
|
|
14
|
+
* Hook used by a single `CheckoutBarInput` to manage CRUD for its own charge.
|
|
15
|
+
*
|
|
16
|
+
* Rules:
|
|
17
|
+
* 1) When quantity changes and there is an existing quote charge on the quote change,
|
|
18
|
+
* update that quote charge's quantity.
|
|
19
|
+
* 2) When quantity changes, there are subscription charges but no quote charges,
|
|
20
|
+
* create a new quote charge – but only if the input quantity differs from the
|
|
21
|
+
* subscription charge quantity. If the quantity later returns to the subscription
|
|
22
|
+
* quantity, delete the quote charge.
|
|
23
|
+
*
|
|
24
|
+
* All network operations are debounced.
|
|
25
|
+
*/
|
|
26
|
+
export declare const useChargeCRUD: ({ priceListChargeId, featureId }: {
|
|
27
|
+
priceListChargeId: string;
|
|
28
|
+
featureId: string | undefined;
|
|
29
|
+
}) => {
|
|
30
|
+
onQuantityChange: (nextQuantity: number) => void;
|
|
31
|
+
};
|
|
@@ -1,21 +1,16 @@
|
|
|
1
1
|
import PriceList from '@/types/PriceList';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const PlanPickerCheckoutBar_PriceListChargeFragment: import("gql.tada").TadaDocumentNode<{
|
|
3
3
|
[$tada.fragmentRefs]: {
|
|
4
|
-
|
|
4
|
+
CheckoutBarInput_PriceListChargeFragment: "PriceListCharge";
|
|
5
5
|
};
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
priceListCharge: {
|
|
12
|
-
id: string;
|
|
13
|
-
} | null;
|
|
14
|
-
}[];
|
|
15
|
-
}[] | null;
|
|
6
|
+
feature: {
|
|
7
|
+
id: string;
|
|
8
|
+
} | null;
|
|
9
|
+
featureAddon: boolean | null;
|
|
10
|
+
id: string;
|
|
16
11
|
}, {}, {
|
|
17
|
-
fragment: "
|
|
18
|
-
on: "
|
|
12
|
+
fragment: "PlanPickerCheckoutBar_PriceListChargeFragment";
|
|
13
|
+
on: "PriceListCharge";
|
|
19
14
|
masked: true;
|
|
20
15
|
}>;
|
|
21
16
|
declare const PlanPickerCheckoutBar: ({ selectedPriceList, handlePortalErrors, onCheckoutSuccess, }: {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const PlanPickerCheckoutBar_QuoteFragment: import("gql.tada").TadaDocumentNode<{
|
|
2
|
+
[$tada.fragmentRefs]: {
|
|
3
|
+
Checkout_QuoteFragment: "Quote";
|
|
4
|
+
};
|
|
5
|
+
quoteChanges: {
|
|
6
|
+
priceList: {
|
|
7
|
+
id: string;
|
|
8
|
+
} | null;
|
|
9
|
+
charges: {
|
|
10
|
+
priceListCharge: {
|
|
11
|
+
id: string;
|
|
12
|
+
} | null;
|
|
13
|
+
}[];
|
|
14
|
+
}[] | null;
|
|
15
|
+
id: string | null;
|
|
16
|
+
}, {}, {
|
|
17
|
+
fragment: "PlanPickerCheckoutBar_QuoteFragment";
|
|
18
|
+
on: "Quote";
|
|
19
|
+
masked: true;
|
|
20
|
+
}>;
|
package/dist/esm/types/src/components/Subscriptions/context/upgradingSubscriptionContext.d.ts
CHANGED
|
@@ -19,6 +19,12 @@ export declare const UpgradingSubscriptionProvider: ({ value, children }: {
|
|
|
19
19
|
PriceListSelectorUpgradingSubscription_SubscriptionFragment: "Subscription";
|
|
20
20
|
} & {
|
|
21
21
|
PriceListCardButtonUpgradingSubscription_SubscriptionFragment: "Subscription";
|
|
22
|
+
} & {
|
|
23
|
+
useQuantityEditableCharges_SubscriptionFragment: "Subscription";
|
|
24
|
+
} & {
|
|
25
|
+
useChargeCRUD_SubscriptionFragment: "Subscription";
|
|
26
|
+
} & {
|
|
27
|
+
useQuoteQuantities_SubscriptionFragment: "Subscription";
|
|
22
28
|
};
|
|
23
29
|
} | undefined;
|
|
24
30
|
children?: import("react").ReactNode;
|
|
@@ -42,5 +48,11 @@ export declare const UpgradingSubscriptionProvider: ({ value, children }: {
|
|
|
42
48
|
PriceListSelectorUpgradingSubscription_SubscriptionFragment: "Subscription";
|
|
43
49
|
} & {
|
|
44
50
|
PriceListCardButtonUpgradingSubscription_SubscriptionFragment: "Subscription";
|
|
51
|
+
} & {
|
|
52
|
+
useQuantityEditableCharges_SubscriptionFragment: "Subscription";
|
|
53
|
+
} & {
|
|
54
|
+
useChargeCRUD_SubscriptionFragment: "Subscription";
|
|
55
|
+
} & {
|
|
56
|
+
useQuoteQuantities_SubscriptionFragment: "Subscription";
|
|
45
57
|
};
|
|
46
58
|
} | undefined;
|
|
@@ -18,6 +18,12 @@ export declare const UpgradingSubscriptionContext_SubscriptionFragment: import("
|
|
|
18
18
|
PriceListSelectorUpgradingSubscription_SubscriptionFragment: "Subscription";
|
|
19
19
|
} & {
|
|
20
20
|
PriceListCardButtonUpgradingSubscription_SubscriptionFragment: "Subscription";
|
|
21
|
+
} & {
|
|
22
|
+
useQuantityEditableCharges_SubscriptionFragment: "Subscription";
|
|
23
|
+
} & {
|
|
24
|
+
useChargeCRUD_SubscriptionFragment: "Subscription";
|
|
25
|
+
} & {
|
|
26
|
+
useQuoteQuantities_SubscriptionFragment: "Subscription";
|
|
21
27
|
};
|
|
22
28
|
}, {}, {
|
|
23
29
|
fragment: "UpgradingSubscriptionContext_SubscriptionFragment";
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
export type QuoteRecalculateTaxesValue =
|
|
1
|
+
export type QuoteRecalculateTaxesValue = {
|
|
2
|
+
quoteRecalculateTaxesMutation: (quoteId: string) => void;
|
|
3
|
+
isRecalculatingTaxes: boolean;
|
|
4
|
+
};
|
|
2
5
|
declare const QuoteRecalculateTaxesProvider: ({ value, children }: {
|
|
3
6
|
value: QuoteRecalculateTaxesValue;
|
|
4
7
|
children?: import("react").ReactNode;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare
|
|
3
|
-
chargeType:
|
|
4
|
-
pricingModel:
|
|
5
|
-
}
|
|
1
|
+
import { FragmentOf } from 'gql.tada';
|
|
2
|
+
export declare const CanEditChargeQuantity_PriceListChargeFragment: import("gql.tada").TadaDocumentNode<{
|
|
3
|
+
chargeType: "ONE_TIME" | "RECURRING" | "USAGE" | null;
|
|
4
|
+
pricingModel: "FLAT" | "TIERED" | "VOLUME" | "BANDS" | null;
|
|
5
|
+
}, {}, {
|
|
6
|
+
fragment: "CanEditChargeQuantity_PriceListChargeFragment";
|
|
7
|
+
on: "PriceListCharge";
|
|
8
|
+
masked: true;
|
|
9
|
+
}>;
|
|
10
|
+
export declare function canEditChargeQuantity(maskedCharge: FragmentOf<typeof CanEditChargeQuantity_PriceListChargeFragment> | null): boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -111,7 +111,7 @@ declare const PaymentForm_QuoteFragment: gql_tada.TadaDocumentNode<{
|
|
|
111
111
|
on: "Quote";
|
|
112
112
|
masked: true;
|
|
113
113
|
}>;
|
|
114
|
-
declare function PaymentForm({ currencyId: accountCurrencyId, invoice, quote: maskedQuote, onPaymentSuccess, onPaymentHoldSuccess, paymentHoldPrecondition, accountId, onSavePaymentMethod, onPaymentMethodRemoved, onSetDefaultPaymentMethod, overrideToken, customCheckoutFunction, paymentHoldOptions, }: {
|
|
114
|
+
declare function PaymentForm({ currencyId: accountCurrencyId, invoice, quote: maskedQuote, onPaymentSuccess, onPaymentHoldSuccess, paymentHoldPrecondition, accountId, onSavePaymentMethod, onPaymentMethodRemoved, onSetDefaultPaymentMethod, overrideToken, customCheckoutFunction, paymentHoldOptions, disablePayButton, }: {
|
|
115
115
|
currencyId?: string;
|
|
116
116
|
invoice?: FormattedInvoice | Invoice$1;
|
|
117
117
|
quote?: FragmentOf<typeof PaymentForm_QuoteFragment>;
|
|
@@ -131,6 +131,7 @@ declare function PaymentForm({ currencyId: accountCurrencyId, invoice, quote: ma
|
|
|
131
131
|
payToAccept?: boolean;
|
|
132
132
|
amountToHold?: number;
|
|
133
133
|
};
|
|
134
|
+
disablePayButton?: boolean;
|
|
134
135
|
}): react_jsx_runtime.JSX.Element | null;
|
|
135
136
|
|
|
136
137
|
declare function Signup({ companyName, priceListCode, returnUrl, couponCode, className, shadow, style, defaultFirstName, defaultLastName, defaultEmail, defaultCompanyName, defaultBillingCountry, }: {
|
package/package.json
CHANGED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { PriceListCharge } from '@/types/PriceListCharge';
|
|
2
|
-
declare const CheckoutBarInput: ({ disabled, priceListCharge, quantity, onQuantityChanged, }: {
|
|
3
|
-
disabled?: boolean;
|
|
4
|
-
priceListCharge: PriceListCharge;
|
|
5
|
-
quantity: number;
|
|
6
|
-
onQuantityChanged: (quantity: number) => void;
|
|
7
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export default CheckoutBarInput;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { PriceListCharge } from '@/types/PriceListCharge';
|
|
2
|
-
declare const CheckoutBarInput: ({ disabled, priceListCharge, quantity, onQuantityChanged, }: {
|
|
3
|
-
disabled?: boolean;
|
|
4
|
-
priceListCharge: PriceListCharge;
|
|
5
|
-
quantity: number;
|
|
6
|
-
onQuantityChanged: (quantity: number) => void;
|
|
7
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export default CheckoutBarInput;
|