@bunnyapp/components 1.6.0-beta.19 → 1.6.0-beta.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.
- package/dist/cjs/index.js +1529 -1321
- package/dist/cjs/types/src/components/Checkout/QuoteCheckout.d.ts +1 -1
- package/dist/cjs/types/src/components/PaymentForm/DemoPay/CreditCard/CreditCard.d.ts +17 -13
- package/dist/cjs/types/src/components/PaymentForm/DemoPay/CreditCard/MiniCreditCard.d.ts +27 -0
- package/dist/cjs/types/src/components/PaymentForm/DemoPay/CreditCard/components/CardImage.d.ts +14 -0
- package/dist/cjs/types/src/components/PaymentForm/DemoPay/CreditCard/index.d.ts +1 -1
- package/dist/cjs/types/src/components/PaymentForm/DemoPay/DemoPayForm.d.ts +1 -6
- package/dist/cjs/types/src/components/PaymentForm/DemoPay/hooks/useApproveHold.d.ts +1 -1
- package/dist/cjs/types/src/components/PaymentForm/DemoPay/hooks/usePay.d.ts +4 -4
- package/dist/cjs/types/src/components/PaymentForm/DemoPay/hooks/useSave.d.ts +7 -16
- package/dist/cjs/types/src/components/PaymentForm/PaymentForm.d.ts +5 -6
- package/dist/cjs/types/src/components/PaymentForm/Stripe/StripeForm.d.ts +1 -6
- package/dist/cjs/types/src/components/PaymentForm/Stripe/hooks/useApproveHold.d.ts +1 -1
- package/dist/cjs/types/src/components/PaymentForm/Stripe/hooks/usePay.d.ts +4 -4
- package/dist/cjs/types/src/components/PaymentForm/Stripe/hooks/useSave.d.ts +4 -5
- package/dist/cjs/types/src/components/PaymentForm/Stripe/stripeUtils.d.ts +1 -1
- package/dist/cjs/types/src/components/PaymentForm/components/CheckoutFooter.d.ts +2 -0
- package/dist/cjs/types/src/components/PaymentForm/components/PaymentMethodDetails.d.ts +2 -0
- package/dist/cjs/types/src/components/PaymentForm/components/PaymentMethodFooter.d.ts +4 -0
- package/dist/cjs/types/src/components/PaymentForm/components/PaymentMethodSelector.d.ts +2 -0
- package/dist/cjs/types/src/components/PaymentForm/context/CustomCheckoutFunctionContext.d.ts +5 -0
- package/dist/cjs/types/src/components/PaymentForm/context/OverrideTokenContext.d.ts +4 -0
- package/dist/cjs/types/src/components/PaymentForm/context/PaymentProvider.d.ts +31 -0
- package/dist/cjs/types/src/components/PaymentForm/context/SelectedPaymentPluginContext.d.ts +6 -0
- package/dist/cjs/types/src/components/PaymentForm/context/SelectedPluginProvider.d.ts +16 -0
- package/dist/cjs/types/src/components/PaymentForm/context/ShowPaymentDetailsContext.d.ts +5 -0
- package/dist/cjs/types/src/components/PaymentForm/fragments/PaymentForm_PaymentMethodsFragment.d.ts +10 -0
- package/dist/cjs/types/src/components/PaymentForm/hooks/useAutoSetDefaultPaymentMethod.d.ts +2 -5
- package/dist/cjs/types/src/components/PaymentForm/hooks/useHandlePayment.d.ts +24 -0
- package/dist/cjs/types/src/components/PaymentForm/hooks/usePayableCurrency.d.ts +6 -0
- package/dist/cjs/types/src/components/PaymentForm/hooks/useRemovePaymentMethod.d.ts +2 -0
- package/dist/cjs/types/src/components/PaymentForm/hooks/useSetDefaultPaymentMethod.d.ts +5 -0
- package/dist/cjs/types/src/components/PaymentForm/types/PaymentType.d.ts +5 -0
- package/dist/cjs/types/src/components/Signup/PaymentForms.d.ts +3 -4
- package/dist/cjs/types/src/components/Subscriptions/Subscriptions.d.ts +1 -1
- package/dist/cjs/types/src/components/Subscriptions/quantityChangeDrawer/quantityInput/QuantityInput.d.ts +1 -1
- package/dist/cjs/types/src/components/Subscriptions/quantityChangeDrawer/utils/utils.d.ts +1 -1
- package/dist/cjs/types/src/graphql/queries/getCurrentUserData.d.ts +11 -7
- package/dist/cjs/types/src/hooks/useCurrentUserData.d.ts +11 -7
- package/dist/cjs/types/src/hooks/useIsMobile.d.ts +9 -0
- package/dist/cjs/types/src/hooks/usePaymentMethod.d.ts +47 -6
- package/dist/cjs/types/src/hooks/usePaymentPlugins.d.ts +13 -27
- package/dist/cjs/types/src/utils/QueryKeyFactory.d.ts +1 -0
- package/dist/cjs/types/src/utils/apiUtils/invokePlugin.d.ts +10 -0
- package/dist/esm/index.js +1549 -1341
- package/dist/esm/types/src/components/Checkout/QuoteCheckout.d.ts +1 -1
- package/dist/esm/types/src/components/PaymentForm/DemoPay/CreditCard/CreditCard.d.ts +17 -13
- package/dist/esm/types/src/components/PaymentForm/DemoPay/CreditCard/MiniCreditCard.d.ts +27 -0
- package/dist/esm/types/src/components/PaymentForm/DemoPay/CreditCard/components/CardImage.d.ts +14 -0
- package/dist/esm/types/src/components/PaymentForm/DemoPay/CreditCard/index.d.ts +1 -1
- package/dist/esm/types/src/components/PaymentForm/DemoPay/DemoPayForm.d.ts +1 -6
- package/dist/esm/types/src/components/PaymentForm/DemoPay/hooks/useApproveHold.d.ts +1 -1
- package/dist/esm/types/src/components/PaymentForm/DemoPay/hooks/usePay.d.ts +4 -4
- package/dist/esm/types/src/components/PaymentForm/DemoPay/hooks/useSave.d.ts +7 -16
- package/dist/esm/types/src/components/PaymentForm/PaymentForm.d.ts +5 -6
- package/dist/esm/types/src/components/PaymentForm/Stripe/StripeForm.d.ts +1 -6
- package/dist/esm/types/src/components/PaymentForm/Stripe/hooks/useApproveHold.d.ts +1 -1
- package/dist/esm/types/src/components/PaymentForm/Stripe/hooks/usePay.d.ts +4 -4
- package/dist/esm/types/src/components/PaymentForm/Stripe/hooks/useSave.d.ts +4 -5
- package/dist/esm/types/src/components/PaymentForm/Stripe/stripeUtils.d.ts +1 -1
- package/dist/esm/types/src/components/PaymentForm/components/CheckoutFooter.d.ts +2 -0
- package/dist/esm/types/src/components/PaymentForm/components/PaymentMethodDetails.d.ts +2 -0
- package/dist/esm/types/src/components/PaymentForm/components/PaymentMethodFooter.d.ts +4 -0
- package/dist/esm/types/src/components/PaymentForm/components/PaymentMethodSelector.d.ts +2 -0
- package/dist/esm/types/src/components/PaymentForm/context/CustomCheckoutFunctionContext.d.ts +5 -0
- package/dist/esm/types/src/components/PaymentForm/context/OverrideTokenContext.d.ts +4 -0
- package/dist/esm/types/src/components/PaymentForm/context/PaymentProvider.d.ts +31 -0
- package/dist/esm/types/src/components/PaymentForm/context/SelectedPaymentPluginContext.d.ts +6 -0
- package/dist/esm/types/src/components/PaymentForm/context/SelectedPluginProvider.d.ts +16 -0
- package/dist/esm/types/src/components/PaymentForm/context/ShowPaymentDetailsContext.d.ts +5 -0
- package/dist/esm/types/src/components/PaymentForm/fragments/PaymentForm_PaymentMethodsFragment.d.ts +10 -0
- package/dist/esm/types/src/components/PaymentForm/hooks/useAutoSetDefaultPaymentMethod.d.ts +2 -5
- package/dist/esm/types/src/components/PaymentForm/hooks/useHandlePayment.d.ts +24 -0
- package/dist/esm/types/src/components/PaymentForm/hooks/usePayableCurrency.d.ts +6 -0
- package/dist/esm/types/src/components/PaymentForm/hooks/useRemovePaymentMethod.d.ts +2 -0
- package/dist/esm/types/src/components/PaymentForm/hooks/useSetDefaultPaymentMethod.d.ts +5 -0
- package/dist/esm/types/src/components/PaymentForm/types/PaymentType.d.ts +5 -0
- package/dist/esm/types/src/components/Signup/PaymentForms.d.ts +3 -4
- package/dist/esm/types/src/components/Subscriptions/Subscriptions.d.ts +1 -1
- package/dist/esm/types/src/components/Subscriptions/quantityChangeDrawer/quantityInput/QuantityInput.d.ts +1 -1
- package/dist/esm/types/src/components/Subscriptions/quantityChangeDrawer/utils/utils.d.ts +1 -1
- package/dist/esm/types/src/graphql/queries/getCurrentUserData.d.ts +11 -7
- package/dist/esm/types/src/hooks/useCurrentUserData.d.ts +11 -7
- package/dist/esm/types/src/hooks/useIsMobile.d.ts +9 -0
- package/dist/esm/types/src/hooks/usePaymentMethod.d.ts +47 -6
- package/dist/esm/types/src/hooks/usePaymentPlugins.d.ts +13 -27
- package/dist/esm/types/src/utils/QueryKeyFactory.d.ts +1 -0
- package/dist/esm/types/src/utils/apiUtils/invokePlugin.d.ts +10 -0
- package/dist/index.d.ts +26 -9
- package/package.json +1 -1
- package/dist/cjs/types/src/components/PaymentForm/CheckoutFooter.d.ts +0 -13
- package/dist/cjs/types/src/components/PaymentForm/DemoPay/CreditCard/LargCardIcon.d.ts +0 -2
- package/dist/cjs/types/src/components/PaymentForm/DemoPay/CreditCard/PlusIcon.d.ts +0 -4
- package/dist/cjs/types/src/components/PaymentForm/PaymentMethodDetails.d.ts +0 -7
- package/dist/cjs/types/src/components/PaymentForm/PaymentMethodSelector.d.ts +0 -7
- package/dist/cjs/types/src/components/PaymentForm/SavePaymentMethodFooter.d.ts +0 -6
- package/dist/cjs/types/src/components/PaymentForm/Stripe/PaymentMethodForm.d.ts +0 -7
- package/dist/cjs/types/src/components/PaymentForm/hooks/usePaymentMethodSelectorPlugin.d.ts +0 -10
- package/dist/cjs/types/src/components/PaymentForm/useRemovePaymentMethod.d.ts +0 -3
- package/dist/cjs/types/src/components/PaymentForm/useSetDefaultPaymentMethod.d.ts +0 -6
- package/dist/cjs/types/src/contexts/PaymentContext.d.ts +0 -10
- package/dist/esm/types/src/components/PaymentForm/CheckoutFooter.d.ts +0 -13
- package/dist/esm/types/src/components/PaymentForm/DemoPay/CreditCard/LargCardIcon.d.ts +0 -2
- package/dist/esm/types/src/components/PaymentForm/DemoPay/CreditCard/PlusIcon.d.ts +0 -4
- package/dist/esm/types/src/components/PaymentForm/PaymentMethodDetails.d.ts +0 -7
- package/dist/esm/types/src/components/PaymentForm/PaymentMethodSelector.d.ts +0 -7
- package/dist/esm/types/src/components/PaymentForm/SavePaymentMethodFooter.d.ts +0 -6
- package/dist/esm/types/src/components/PaymentForm/Stripe/PaymentMethodForm.d.ts +0 -7
- package/dist/esm/types/src/components/PaymentForm/hooks/usePaymentMethodSelectorPlugin.d.ts +0 -10
- package/dist/esm/types/src/components/PaymentForm/useRemovePaymentMethod.d.ts +0 -3
- package/dist/esm/types/src/components/PaymentForm/useSetDefaultPaymentMethod.d.ts +0 -6
- package/dist/esm/types/src/contexts/PaymentContext.d.ts +0 -10
- /package/dist/cjs/types/src/components/PaymentForm/{CouponEditor.d.ts → components/CouponEditor.d.ts} +0 -0
- /package/dist/cjs/types/src/components/PaymentForm/{PaymentFormTypes.d.ts → types/PaymentFormTypes.d.ts} +0 -0
- /package/dist/cjs/types/src/utils/{apiUtils.d.ts → apiUtils/apiUtils.d.ts} +0 -0
- /package/dist/esm/types/src/components/PaymentForm/{CouponEditor.d.ts → components/CouponEditor.d.ts} +0 -0
- /package/dist/esm/types/src/components/PaymentForm/{PaymentFormTypes.d.ts → types/PaymentFormTypes.d.ts} +0 -0
- /package/dist/esm/types/src/utils/{apiUtils.d.ts → apiUtils/apiUtils.d.ts} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Account, PaymentMethod, TaxationRequiredAccountFields } from '@bunnyapp/common';
|
|
2
2
|
import { FragmentOf } from 'gql.tada';
|
|
3
|
-
import { InvoiceQuoteParentProps } from '../PaymentForm/PaymentFormTypes';
|
|
3
|
+
import { InvoiceQuoteParentProps } from '../PaymentForm/types/PaymentFormTypes';
|
|
4
4
|
export declare const QuoteCheckout_QuoteFragment: import("gql.tada").TadaDocumentNode<{
|
|
5
5
|
id: string | null;
|
|
6
6
|
accountId: string;
|
|
@@ -1,21 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FragmentOf } from 'gql.tada';
|
|
2
2
|
import { ShadowType } from '../../../../types/shadowType';
|
|
3
|
+
export declare const CreditCard_PaymentMethodFragment: import("gql.tada").TadaDocumentNode<{
|
|
4
|
+
[$tada.fragmentRefs]: {
|
|
5
|
+
CardImage_PaymentMethodFragment: "PaymentMethod";
|
|
6
|
+
};
|
|
7
|
+
id: string;
|
|
8
|
+
expirationDate: unknown;
|
|
9
|
+
metadata: {
|
|
10
|
+
identifier: string | null;
|
|
11
|
+
} | null;
|
|
12
|
+
}, {}, {
|
|
13
|
+
fragment: "CreditCard_PaymentMethodFragment";
|
|
14
|
+
on: "PaymentMethod";
|
|
15
|
+
masked: true;
|
|
16
|
+
}>;
|
|
3
17
|
type CreditCardProps = {
|
|
4
18
|
onClickRemove: () => void;
|
|
5
19
|
onClickUpdate: () => void;
|
|
6
|
-
|
|
20
|
+
paymentMethod: FragmentOf<typeof CreditCard_PaymentMethodFragment>;
|
|
7
21
|
shadow?: ShadowType;
|
|
8
22
|
cardEnabled?: boolean;
|
|
9
23
|
};
|
|
10
|
-
declare const CreditCard: ({ onClickRemove, onClickUpdate,
|
|
11
|
-
export declare const MiniCreditCard: ({ className, buttons, hideDropdownMenu, hideDefaultTag, onClickRemove, paymentMethodData, onClickSetDefault, id, }: {
|
|
12
|
-
className?: string;
|
|
13
|
-
buttons?: React.ReactNode;
|
|
14
|
-
hideDropdownMenu?: boolean;
|
|
15
|
-
hideDefaultTag?: boolean;
|
|
16
|
-
onClickRemove?: () => void;
|
|
17
|
-
paymentMethodData?: PaymentMethod;
|
|
18
|
-
onClickSetDefault?: () => void;
|
|
19
|
-
id?: string;
|
|
20
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
declare const CreditCard: ({ onClickRemove, onClickUpdate, paymentMethod: maskedPaymentMethod, shadow, cardEnabled, }: CreditCardProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
25
|
export default CreditCard;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { FragmentOf } from 'gql.tada';
|
|
2
|
+
export declare const MiniCreditCard_PaymentMethodFragment: import("gql.tada").TadaDocumentNode<{
|
|
3
|
+
[$tada.fragmentRefs]: {
|
|
4
|
+
CardImage_PaymentMethodFragment: "PaymentMethod";
|
|
5
|
+
};
|
|
6
|
+
isDefault: boolean | null;
|
|
7
|
+
metadata: {
|
|
8
|
+
issuer: string | null;
|
|
9
|
+
type: string | null;
|
|
10
|
+
identifier: string | null;
|
|
11
|
+
} | null;
|
|
12
|
+
id: string;
|
|
13
|
+
}, {}, {
|
|
14
|
+
fragment: "MiniCreditCard_PaymentMethodFragment";
|
|
15
|
+
on: "PaymentMethod";
|
|
16
|
+
masked: true;
|
|
17
|
+
}>;
|
|
18
|
+
export declare function MiniCreditCard({ className, buttons, hideDropdownMenu, hideDefaultTag, onClickRemove, paymentMethod: maskedPaymentMethod, onClickSetDefault, id, }: {
|
|
19
|
+
className?: string;
|
|
20
|
+
buttons?: React.ReactNode;
|
|
21
|
+
hideDropdownMenu?: boolean;
|
|
22
|
+
hideDefaultTag?: boolean;
|
|
23
|
+
onClickRemove?: () => void;
|
|
24
|
+
paymentMethod?: FragmentOf<typeof MiniCreditCard_PaymentMethodFragment>;
|
|
25
|
+
onClickSetDefault?: () => void;
|
|
26
|
+
id?: string;
|
|
27
|
+
}): import("react/jsx-runtime").JSX.Element;
|
package/dist/cjs/types/src/components/PaymentForm/DemoPay/CreditCard/components/CardImage.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FragmentOf } from 'gql.tada';
|
|
2
|
+
export declare const CardImage_PaymentMethodFragment: import("gql.tada").TadaDocumentNode<{
|
|
3
|
+
metadata: {
|
|
4
|
+
issuer: string | null;
|
|
5
|
+
type: string | null;
|
|
6
|
+
} | null;
|
|
7
|
+
}, {}, {
|
|
8
|
+
fragment: "CardImage_PaymentMethodFragment";
|
|
9
|
+
on: "PaymentMethod";
|
|
10
|
+
masked: true;
|
|
11
|
+
}>;
|
|
12
|
+
export declare function CardImage({ paymentMethod: maskedPaymentMethod, }: {
|
|
13
|
+
paymentMethod: FragmentOf<typeof CardImage_PaymentMethodFragment>;
|
|
14
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { MiniCreditCard } from './
|
|
1
|
+
export { MiniCreditCard } from './MiniCreditCard';
|
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
declare const DemoPayForm: ({ onFail, onSavePaymentMethod, plugin, }: {
|
|
3
|
-
onFail: (error: any) => void;
|
|
4
|
-
onSavePaymentMethod: (response: any) => void;
|
|
5
|
-
plugin: PluginData;
|
|
6
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
declare const DemoPayForm: () => import("react/jsx-runtime").JSX.Element;
|
|
7
2
|
export default DemoPayForm;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { FormattedInvoice, Invoice,
|
|
2
|
-
export declare function usePay({ onPaymentSuccess, onPaymentError, quote, invoice,
|
|
1
|
+
import { FormattedInvoice, Invoice, PluginData, Quote } from '@bunnyapp/common';
|
|
2
|
+
export declare function usePay({ onPaymentSuccess, onPaymentError, quote, invoice, plugin, }: {
|
|
3
3
|
onPaymentSuccess?: (response: any) => void;
|
|
4
4
|
onPaymentError?: (error: any) => void;
|
|
5
5
|
quote?: Quote;
|
|
6
6
|
invoice?: FormattedInvoice | Invoice;
|
|
7
|
-
storedPaymentMethod?: PaymentMethod;
|
|
8
7
|
plugin: PluginData | undefined;
|
|
9
8
|
}): {
|
|
10
|
-
pay: () => Promise<void>;
|
|
9
|
+
pay: (paymentMethodId: string) => Promise<void>;
|
|
10
|
+
isPaying: boolean;
|
|
11
11
|
};
|
|
12
12
|
export default usePay;
|
|
@@ -1,22 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function useSave({ onSaveSuccess, onSaveError, token, apiHost, accountId, }: {
|
|
1
|
+
export declare function useSave({ onSaveSuccess, onSaveError, accountId, }: {
|
|
3
2
|
onSaveSuccess?: (response: any) => void;
|
|
4
3
|
onSaveError?: (error: any) => void;
|
|
5
|
-
|
|
6
|
-
invoice?: FormattedInvoice;
|
|
7
|
-
token?: string;
|
|
8
|
-
apiHost: string;
|
|
9
|
-
accountId?: string;
|
|
4
|
+
accountId: string | undefined;
|
|
10
5
|
}): {
|
|
11
|
-
save: (
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
};
|
|
17
|
-
plugin: PluginData;
|
|
18
|
-
savePaymentMethod: boolean;
|
|
19
|
-
}) => Promise<void>;
|
|
6
|
+
save: (cardDetails: {
|
|
7
|
+
number: string;
|
|
8
|
+
expiry: string;
|
|
9
|
+
cvc: string;
|
|
10
|
+
}) => Promise<string | undefined>;
|
|
20
11
|
isSaving: boolean;
|
|
21
12
|
};
|
|
22
13
|
export default useSave;
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import { FormattedInvoice, Invoice,
|
|
2
|
-
export declare
|
|
1
|
+
import { FormattedInvoice, Invoice, Quote } from '@bunnyapp/common';
|
|
2
|
+
export declare function PaymentForm({ invoice, quote, onPaymentSuccess, onPaymentHoldSuccess, accountId, onSavePaymentMethod, onRemovePaymentMethod, onSetDefaultPaymentMethod, overrideToken, customCheckoutFunction, paymentHoldOptions, }: {
|
|
3
3
|
invoice?: FormattedInvoice | Invoice;
|
|
4
4
|
quote?: Quote;
|
|
5
|
-
|
|
6
|
-
onPaymentSuccess?: () => void;
|
|
5
|
+
onPaymentSuccess?: (response: any) => void;
|
|
7
6
|
onPaymentHoldSuccess?: (response: any) => void;
|
|
8
7
|
onSavePaymentMethod?: (response: any) => void;
|
|
9
8
|
onRemovePaymentMethod?: () => void;
|
|
10
9
|
onSetDefaultPaymentMethod?: () => void;
|
|
11
10
|
accountId?: string;
|
|
12
11
|
overrideToken?: string;
|
|
13
|
-
customCheckoutFunction?: (
|
|
12
|
+
customCheckoutFunction?: (pluginId: string, paymentMethodId: string) => Promise<any>;
|
|
14
13
|
paymentHoldOptions?: {
|
|
15
14
|
payToAccept?: boolean;
|
|
16
15
|
amountToHold?: number;
|
|
17
16
|
};
|
|
18
|
-
})
|
|
17
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
declare const StripeForm: ({ plugin, onFail, onSavePaymentMethod, }: {
|
|
3
|
-
plugin: PluginData;
|
|
4
|
-
onFail: (error: any) => void;
|
|
5
|
-
onSavePaymentMethod: (response: any) => void;
|
|
6
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
declare const StripeForm: () => import("react/jsx-runtime").JSX.Element;
|
|
7
2
|
export default StripeForm;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { FormattedInvoice, Invoice,
|
|
2
|
-
export declare function usePay({ onPaymentSuccess, onPaymentError, quote, invoice,
|
|
1
|
+
import { FormattedInvoice, Invoice, PluginData, Quote } from '@bunnyapp/common';
|
|
2
|
+
export declare function usePay({ onPaymentSuccess, onPaymentError, quote, invoice, plugin, }: {
|
|
3
3
|
onPaymentSuccess?: (response: any) => void;
|
|
4
4
|
onPaymentError?: (error: any) => void;
|
|
5
5
|
quote?: Quote;
|
|
6
6
|
invoice?: FormattedInvoice | Invoice;
|
|
7
|
-
storedPaymentMethod?: PaymentMethod;
|
|
8
7
|
plugin: PluginData | undefined;
|
|
9
8
|
}): {
|
|
10
|
-
pay: () => Promise<void>;
|
|
9
|
+
pay: (paymentMethodId: string) => Promise<void>;
|
|
10
|
+
isPaying: boolean;
|
|
11
11
|
};
|
|
12
12
|
export default usePay;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function useSave({ onSaveSuccess, onSaveError, }: {
|
|
1
|
+
export declare function useSave({ onSaveSuccess, onSaveError, accountId, }: {
|
|
3
2
|
onSaveSuccess?: (response: any) => void;
|
|
4
3
|
onSaveError?: (error: any) => void;
|
|
4
|
+
accountId: string | undefined;
|
|
5
5
|
}): {
|
|
6
|
-
save: (
|
|
7
|
-
|
|
8
|
-
}) => Promise<void>;
|
|
6
|
+
save: () => Promise<string | undefined>;
|
|
7
|
+
createStripePaymentMethodId: () => Promise<string>;
|
|
9
8
|
isSaving: boolean;
|
|
10
9
|
};
|
|
11
10
|
export default useSave;
|
|
@@ -23,7 +23,7 @@ export declare const createPaymentHold: ({ quote, plugin, token, apiHost, paymen
|
|
|
23
23
|
apiHost: string;
|
|
24
24
|
paymentMethodId: string;
|
|
25
25
|
}) => Promise<any>;
|
|
26
|
-
export declare const useStripePlugin: (plugin: PluginData | undefined,
|
|
26
|
+
export declare const useStripePlugin: (plugin: PluginData | undefined, currencyId: string, accountId?: string) => {
|
|
27
27
|
stripe: Stripe | null;
|
|
28
28
|
options: import("@stripe/stripe-js").StripeElementsOptionsMode;
|
|
29
29
|
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
declare const CustomCheckoutFunctionProvider: ({ value, children }: {
|
|
2
|
+
value: ((pluginId: string, paymentMethodId: string) => Promise<any>) | undefined;
|
|
3
|
+
children?: import("react").ReactNode;
|
|
4
|
+
}) => import("react/jsx-runtime").JSX.Element, useCustomCheckoutFunction: () => ((pluginId: string, paymentMethodId: string) => Promise<any>) | undefined;
|
|
5
|
+
export { CustomCheckoutFunctionProvider, useCustomCheckoutFunction };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { FormattedInvoice, Invoice, Quote } from '@bunnyapp/common';
|
|
2
|
+
import { PaymentType } from '../types/PaymentType';
|
|
3
|
+
declare const useAmountDue: () => string | undefined;
|
|
4
|
+
declare const usePaymentType: () => PaymentType | undefined;
|
|
5
|
+
declare const useIsPaying: () => boolean | undefined;
|
|
6
|
+
declare const useHandlePaymentFormSubmit: () => (demoPayCardDetails?: {
|
|
7
|
+
number: string;
|
|
8
|
+
expiry: string;
|
|
9
|
+
cvc: string;
|
|
10
|
+
}) => Promise<void>;
|
|
11
|
+
declare const useIsSaving: () => boolean | undefined;
|
|
12
|
+
declare const useAccountId: () => string | undefined;
|
|
13
|
+
export { useAccountId, useAmountDue, useHandlePaymentFormSubmit, useIsPaying, useIsSaving, usePaymentType, };
|
|
14
|
+
export declare function PaymentProvider({ children, accountId, quote, invoice, onPaymentSuccess, onPaymentHoldSuccess, paymentHoldOptions, onSavePaymentMethod, }: {
|
|
15
|
+
children: React.ReactNode;
|
|
16
|
+
accountId?: string;
|
|
17
|
+
quote: Quote | undefined;
|
|
18
|
+
invoice: FormattedInvoice | Invoice | undefined;
|
|
19
|
+
onPaymentSuccess?: (response: any) => void;
|
|
20
|
+
onPaymentHoldSuccess?: (response: any) => void;
|
|
21
|
+
paymentHoldOptions: {
|
|
22
|
+
payToAccept?: boolean;
|
|
23
|
+
amountToHold?: number;
|
|
24
|
+
};
|
|
25
|
+
onSavePaymentMethod?: (response: any) => void;
|
|
26
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
export declare function StripeWrapper({ children, currencyId, accountId, }: {
|
|
28
|
+
children: React.ReactNode;
|
|
29
|
+
currencyId: string;
|
|
30
|
+
accountId?: string;
|
|
31
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PluginData } from '@bunnyapp/common';
|
|
2
|
+
declare const SelectedPaymentPluginProvider: ({ initialValue, children, }: {
|
|
3
|
+
initialValue?: PluginData | undefined;
|
|
4
|
+
children?: import("react").ReactNode;
|
|
5
|
+
}) => import("react/jsx-runtime").JSX.Element, useSelectedPaymentPlugin: () => [PluginData | undefined, import("react").Dispatch<import("react").SetStateAction<PluginData | undefined>>];
|
|
6
|
+
export { SelectedPaymentPluginProvider, useSelectedPaymentPlugin };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare const useSelectedPluginId: () => [string | undefined, import("react").Dispatch<import("react").SetStateAction<string | undefined>>];
|
|
2
|
+
declare const useSelectedPlugin: () => any;
|
|
3
|
+
export { useSelectedPlugin, // Get the selected plugin data (derived from the id using useSelectedPluginId)
|
|
4
|
+
useSelectedPluginId, };
|
|
5
|
+
/**
|
|
6
|
+
* SelectedPluginProvider manages the selected payment plugin state.
|
|
7
|
+
*
|
|
8
|
+
* Data Flow Pattern:
|
|
9
|
+
* - Children components should set the plugin ID using `setSelectedPluginId` from `useSelectedPluginId`
|
|
10
|
+
* - This provider then derives the `selectedPlugin` from that ID and provides it via `useSelectedPlugin`
|
|
11
|
+
* - This ensures that data flows only downward: children control the ID, and the provider computes and provides the data
|
|
12
|
+
*/
|
|
13
|
+
export declare function SelectedPluginProvider({ children, accountId, }: {
|
|
14
|
+
children: React.ReactNode;
|
|
15
|
+
accountId?: string;
|
|
16
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
declare const ShowPaymentDetailsProvider: ({ initialValue, children, }: {
|
|
2
|
+
initialValue?: boolean | undefined;
|
|
3
|
+
children?: import("react").ReactNode;
|
|
4
|
+
}) => import("react/jsx-runtime").JSX.Element, useShowPaymentDetails: () => [boolean, import("react").Dispatch<import("react").SetStateAction<boolean>>];
|
|
5
|
+
export { ShowPaymentDetailsProvider, useShowPaymentDetails };
|
package/dist/cjs/types/src/components/PaymentForm/fragments/PaymentForm_PaymentMethodsFragment.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const PaymentForm_PaymentMethodsFragment: import("gql.tada").TadaDocumentNode<{
|
|
2
|
+
[$tada.fragmentRefs]: {
|
|
3
|
+
MiniCreditCard_PaymentMethodFragment: "PaymentMethod";
|
|
4
|
+
};
|
|
5
|
+
id: string;
|
|
6
|
+
}, {}, {
|
|
7
|
+
fragment: "PaymentForm_PaymentMethodsFragment";
|
|
8
|
+
on: "PaymentMethod";
|
|
9
|
+
masked: true;
|
|
10
|
+
}>;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
accountId: string | undefined;
|
|
4
|
-
token?: string;
|
|
5
|
-
handleSetDefault: (paymentMethod: PaymentMethod) => void;
|
|
1
|
+
declare const useAutoSetDefaultPaymentMethod: ({ handleSetDefault, setDefaultPaymentMethodLoading, enabled, }: {
|
|
2
|
+
handleSetDefault: (paymentMethodId: string) => void;
|
|
6
3
|
setDefaultPaymentMethodLoading: boolean;
|
|
7
4
|
enabled?: boolean;
|
|
8
5
|
}) => void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { FormattedInvoice, Invoice, PluginData, Quote } from '@bunnyapp/common';
|
|
2
|
+
import { PaymentType } from '../types/PaymentType';
|
|
3
|
+
declare const useHandlePayment: ({ quote, invoice, onPaymentSuccess, onPaymentHoldSuccess, plugin, paymentHoldOptions, accountId, }: {
|
|
4
|
+
quote?: Quote;
|
|
5
|
+
invoice?: FormattedInvoice | Invoice;
|
|
6
|
+
onPaymentSuccess?: (response: any) => void;
|
|
7
|
+
onPaymentHoldSuccess?: (response: any) => void;
|
|
8
|
+
plugin: PluginData | undefined;
|
|
9
|
+
paymentHoldOptions: {
|
|
10
|
+
payToAccept?: boolean;
|
|
11
|
+
amountToHold?: number;
|
|
12
|
+
};
|
|
13
|
+
accountId: string | undefined;
|
|
14
|
+
}) => {
|
|
15
|
+
handleApproveHold: (overridePaymentMethodId?: string) => Promise<void>;
|
|
16
|
+
handlePayment: (overridePaymentMethodId: string) => Promise<void>;
|
|
17
|
+
handleCheckoutNoPayment: import("@tanstack/react-query").UseMutateFunction<{
|
|
18
|
+
savePaymentMethod: boolean | undefined;
|
|
19
|
+
}, Error, void, unknown>;
|
|
20
|
+
isPaying: boolean;
|
|
21
|
+
paymentType: PaymentType;
|
|
22
|
+
formattedAmountDue: string | undefined;
|
|
23
|
+
};
|
|
24
|
+
export default useHandlePayment;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export default function PaymentForms({ quote, handlePaymentSuccess,
|
|
1
|
+
import { Quote } from '@bunnyapp/common';
|
|
2
|
+
export default function PaymentForms({ quote, handlePaymentSuccess, handleSubmit, proceedingToPayment, accountId, overrideToken, customCheckoutFunction, defaultValues, }: {
|
|
3
3
|
quote?: Quote;
|
|
4
4
|
handlePaymentSuccess: () => void;
|
|
5
|
-
handlePaymentFail: (error: any) => void;
|
|
6
5
|
handleSubmit: (formData: FormData) => void;
|
|
7
6
|
proceedingToPayment: boolean;
|
|
8
7
|
accountId?: string;
|
|
9
8
|
overrideToken?: string;
|
|
10
|
-
customCheckoutFunction?: (
|
|
9
|
+
customCheckoutFunction?: (pluginId: string, paymentMethodId: string) => Promise<any>;
|
|
11
10
|
defaultValues?: DefaultSignupValues;
|
|
12
11
|
}): import("react/jsx-runtime").JSX.Element;
|
|
13
12
|
export type FormData = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const Subscriptions_SubscriptionFragment: import("gql.tada").TadaDocumentNode<{
|
|
2
|
-
state: "
|
|
2
|
+
state: "TRIAL" | "ACTIVE" | "CANCELED" | "EXPIRED" | "TRIAL_EXPIRED" | "PENDING";
|
|
3
3
|
}, {}, {
|
|
4
4
|
fragment: "Subscriptions_SubscriptionFragment";
|
|
5
5
|
on: "Subscription";
|
|
@@ -11,7 +11,7 @@ export declare const QuantityInput_SubscriptionChargeFragment: import("gql.tada"
|
|
|
11
11
|
}>;
|
|
12
12
|
export declare const QuantityInput_SubscriptionFragment: import("gql.tada").TadaDocumentNode<{
|
|
13
13
|
id: string;
|
|
14
|
-
state: "
|
|
14
|
+
state: "TRIAL" | "ACTIVE" | "CANCELED" | "EXPIRED" | "TRIAL_EXPIRED" | "PENDING";
|
|
15
15
|
priceList: {
|
|
16
16
|
id: string;
|
|
17
17
|
} | null;
|
|
@@ -12,7 +12,7 @@ export declare const CanShowQuantitiesInput_SubscriptionChargeFragment: import("
|
|
|
12
12
|
}>;
|
|
13
13
|
export declare const CanShowQuantitiesInput_SubscriptionFragment: import("gql.tada").TadaDocumentNode<{
|
|
14
14
|
id: string;
|
|
15
|
-
state: "
|
|
15
|
+
state: "TRIAL" | "ACTIVE" | "CANCELED" | "EXPIRED" | "TRIAL_EXPIRED" | "PENDING";
|
|
16
16
|
priceList: {
|
|
17
17
|
id: string;
|
|
18
18
|
} | null;
|
|
@@ -2,12 +2,16 @@ declare const getCurrentUserData: ({ token, apiHost }: {
|
|
|
2
2
|
token?: string;
|
|
3
3
|
apiHost: string;
|
|
4
4
|
}) => Promise<{
|
|
5
|
-
authObjectName:
|
|
6
|
-
account:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
authObjectName: string | null;
|
|
6
|
+
account: {
|
|
7
|
+
billingCountry: string | null;
|
|
8
|
+
currencyId: string | null;
|
|
9
|
+
id: string;
|
|
10
|
+
} | null;
|
|
11
|
+
companyName: string | null | undefined;
|
|
12
|
+
returnUrl: string | null | undefined;
|
|
13
|
+
privacyUrl: string | null;
|
|
14
|
+
termsUrl: string | null;
|
|
15
|
+
entityId: string | null;
|
|
12
16
|
}>;
|
|
13
17
|
export default getCurrentUserData;
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { currentUser as CurrentUser } from '@bunnyapp/common';
|
|
2
2
|
declare const useCurrentUserData: (token: string | undefined) => {
|
|
3
3
|
currentUser: {
|
|
4
|
-
authObjectName:
|
|
5
|
-
account:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
authObjectName: string | null;
|
|
5
|
+
account: {
|
|
6
|
+
billingCountry: string | null;
|
|
7
|
+
currencyId: string | null;
|
|
8
|
+
id: string;
|
|
9
|
+
} | null;
|
|
10
|
+
companyName: string | null | undefined;
|
|
11
|
+
returnUrl: string | null | undefined;
|
|
12
|
+
privacyUrl: string | null;
|
|
13
|
+
termsUrl: string | null;
|
|
14
|
+
entityId: string | null;
|
|
11
15
|
} | CurrentUser;
|
|
12
16
|
isCurrentUserDataLoading: boolean;
|
|
13
17
|
};
|
|
@@ -1,11 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const usePaymentMethod: ({ accountId, token, apiHost, enabled, }: {
|
|
1
|
+
export declare const usePaymentMethod: ({ accountId, enabled, }: {
|
|
3
2
|
accountId?: string;
|
|
4
|
-
token?: string;
|
|
5
|
-
apiHost: string;
|
|
6
3
|
enabled?: boolean;
|
|
7
4
|
}) => {
|
|
8
|
-
paymentMethods:
|
|
9
|
-
|
|
5
|
+
paymentMethods: {
|
|
6
|
+
id: string;
|
|
7
|
+
pluginId: string | null;
|
|
8
|
+
accountId: string | null;
|
|
9
|
+
expirationDate: unknown;
|
|
10
|
+
plugin: {
|
|
11
|
+
guid: string;
|
|
12
|
+
id: string;
|
|
13
|
+
} | null;
|
|
14
|
+
state: "UNKNOWN" | "SUCCESS" | "FAILED" | null;
|
|
15
|
+
metadata: {
|
|
16
|
+
issuer: string | null;
|
|
17
|
+
identifier: string | null;
|
|
18
|
+
kind: string | null;
|
|
19
|
+
description: string | null;
|
|
20
|
+
icon: string | null;
|
|
21
|
+
type: string | null;
|
|
22
|
+
} | null;
|
|
23
|
+
isDefault: boolean | null;
|
|
24
|
+
[$tada.fragmentRefs]: {
|
|
25
|
+
PaymentForm_PaymentMethodsFragment: "PaymentMethod";
|
|
26
|
+
};
|
|
27
|
+
}[] | undefined;
|
|
28
|
+
defaultPaymentMethod: {
|
|
29
|
+
id: string;
|
|
30
|
+
pluginId: string | null;
|
|
31
|
+
accountId: string | null;
|
|
32
|
+
expirationDate: unknown;
|
|
33
|
+
plugin: {
|
|
34
|
+
guid: string;
|
|
35
|
+
id: string;
|
|
36
|
+
} | null;
|
|
37
|
+
state: "UNKNOWN" | "SUCCESS" | "FAILED" | null;
|
|
38
|
+
metadata: {
|
|
39
|
+
issuer: string | null;
|
|
40
|
+
identifier: string | null;
|
|
41
|
+
kind: string | null;
|
|
42
|
+
description: string | null;
|
|
43
|
+
icon: string | null;
|
|
44
|
+
type: string | null;
|
|
45
|
+
} | null;
|
|
46
|
+
isDefault: boolean | null;
|
|
47
|
+
[$tada.fragmentRefs]: {
|
|
48
|
+
PaymentForm_PaymentMethodsFragment: "PaymentMethod";
|
|
49
|
+
};
|
|
50
|
+
} | undefined;
|
|
10
51
|
isLoading: boolean;
|
|
11
52
|
};
|