@bunnyapp/components 1.6.0-beta.20 → 1.6.0-beta.22
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 +101 -77
- package/dist/cjs/types/src/components/PaymentForm/context/PaymentProvider.d.ts +3 -2
- package/dist/cjs/types/src/components/PaymentForm/hooks/useHandlePayment.d.ts +1 -0
- package/dist/cjs/types/src/components/PaymentForm/hooks/usePaymentButtonText.d.ts +1 -0
- package/dist/cjs/types/src/components/Quotes/Quotes.d.ts +3 -3
- package/dist/cjs/types/src/graphql/queries/getFormattedQuote.d.ts +139 -1
- package/dist/esm/index.js +103 -79
- package/dist/esm/types/src/components/PaymentForm/context/PaymentProvider.d.ts +3 -2
- package/dist/esm/types/src/components/PaymentForm/hooks/useHandlePayment.d.ts +1 -0
- package/dist/esm/types/src/components/PaymentForm/hooks/usePaymentButtonText.d.ts +1 -0
- package/dist/esm/types/src/components/Quotes/Quotes.d.ts +3 -3
- package/dist/esm/types/src/graphql/queries/getFormattedQuote.d.ts +139 -1
- package/dist/index.d.ts +3 -3
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -143,7 +143,7 @@ const useAllErrorFormats = () => {
|
|
|
143
143
|
};
|
|
144
144
|
|
|
145
145
|
// This will be replaced at build time by rollup-plugin-replace
|
|
146
|
-
const PACKAGE_VERSION = '1.6.0-beta.
|
|
146
|
+
const PACKAGE_VERSION = '1.6.0-beta.21';
|
|
147
147
|
const createRequestHeaders = (token) => {
|
|
148
148
|
const headers = createClientDevHeaders({ token });
|
|
149
149
|
// Add the components version header
|
|
@@ -929,7 +929,7 @@ function readFragment(...r) {
|
|
|
929
929
|
|
|
930
930
|
var t = initGraphQLTada();
|
|
931
931
|
|
|
932
|
-
const query$
|
|
932
|
+
const query$7 = t(`
|
|
933
933
|
query entityBranding {
|
|
934
934
|
entityBranding {
|
|
935
935
|
accentColor
|
|
@@ -939,7 +939,7 @@ const query$6 = t(`
|
|
|
939
939
|
}
|
|
940
940
|
`);
|
|
941
941
|
const getBranding = async ({ token, apiHost }) => {
|
|
942
|
-
return await execute(query$
|
|
942
|
+
return await execute(query$7, { apiHost, token }, {});
|
|
943
943
|
};
|
|
944
944
|
|
|
945
945
|
const BunnyContext = react.createContext({});
|
|
@@ -1146,7 +1146,7 @@ const InvoiceQuoteView = ({ children, formattedInvoice, html, backButtonName, on
|
|
|
1146
1146
|
}, children: [targetUrl ? (jsxRuntime.jsx(DocumentTemplatePreview, { targetUrl: targetUrl })) : (jsxRuntime.jsx(interweave.Markup, { content: html })), children] }))] }));
|
|
1147
1147
|
};
|
|
1148
1148
|
|
|
1149
|
-
const MUTATION$
|
|
1149
|
+
const MUTATION$9 = `
|
|
1150
1150
|
query FormattedInvoice($id: ID) {
|
|
1151
1151
|
formattedInvoice(id: $id) {
|
|
1152
1152
|
amount
|
|
@@ -1214,7 +1214,7 @@ query FormattedInvoice($id: ID) {
|
|
|
1214
1214
|
const getFormattedInvoice = async ({ id, token, apiHost, }) => {
|
|
1215
1215
|
const vars = { id };
|
|
1216
1216
|
const response = await gqlRequest({
|
|
1217
|
-
query: MUTATION$
|
|
1217
|
+
query: MUTATION$9,
|
|
1218
1218
|
token,
|
|
1219
1219
|
vars,
|
|
1220
1220
|
apiHost,
|
|
@@ -18732,7 +18732,7 @@ const QueryKeyFactory = {
|
|
|
18732
18732
|
paymentPluginsKey: (token) => ['paymentPlugins', ...(token ? [token] : [])],
|
|
18733
18733
|
};
|
|
18734
18734
|
|
|
18735
|
-
const query$
|
|
18735
|
+
const query$6 = t(`
|
|
18736
18736
|
query PaymentMethods($accountId: ID) {
|
|
18737
18737
|
paymentMethods(accountId: $accountId) {
|
|
18738
18738
|
nodes {
|
|
@@ -18761,7 +18761,7 @@ const query$5 = t(`
|
|
|
18761
18761
|
`, [PaymentForm_PaymentMethodsFragment]);
|
|
18762
18762
|
const getPaymentMethods = async ({ apiHost, token, accountId, }) => {
|
|
18763
18763
|
var _a, _b, _c;
|
|
18764
|
-
const response = await execute(query$
|
|
18764
|
+
const response = await execute(query$6, { apiHost, token }, { accountId });
|
|
18765
18765
|
// Filter out null values that are technically possible due to api schema
|
|
18766
18766
|
return (_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.paymentMethods) === null || _a === void 0 ? void 0 : _a.nodes) === null || _b === void 0 ? void 0 : _b.filter(paymentMethod => paymentMethod !== null)) !== null && _c !== void 0 ? _c : [];
|
|
18767
18767
|
};
|
|
@@ -19007,7 +19007,7 @@ function useSave$1({ onSaveSuccess, onSaveError, accountId, }) {
|
|
|
19007
19007
|
return { save, isSaving };
|
|
19008
19008
|
}
|
|
19009
19009
|
|
|
19010
|
-
const MUTATION$
|
|
19010
|
+
const MUTATION$8 = `
|
|
19011
19011
|
mutation checkout(
|
|
19012
19012
|
$invoiceId: ID,
|
|
19013
19013
|
$quoteId: ID,
|
|
@@ -19056,7 +19056,7 @@ const checkout = async ({ quoteId, invoiceId, paymentMethodId, paymentMethodData
|
|
|
19056
19056
|
};
|
|
19057
19057
|
}
|
|
19058
19058
|
const response = await gqlRequest({
|
|
19059
|
-
query: MUTATION$
|
|
19059
|
+
query: MUTATION$8,
|
|
19060
19060
|
token,
|
|
19061
19061
|
vars: mutationVars,
|
|
19062
19062
|
apiHost: apiHost,
|
|
@@ -19344,14 +19344,20 @@ const useHandlePayment = ({ quote, invoice, onPaymentSuccess, onPaymentHoldSucce
|
|
|
19344
19344
|
const { defaultPaymentMethod } = usePaymentMethod({ accountId });
|
|
19345
19345
|
const { apiHost } = react.useContext(BunnyContext);
|
|
19346
19346
|
const token = useToken();
|
|
19347
|
+
// State
|
|
19348
|
+
const [isPaid, setIsPaid] = react.useState(false);
|
|
19347
19349
|
const formattedAmountDue = () => {
|
|
19348
19350
|
const amountDue = quote ? getQuoteAmountDue(quote) : invoice === null || invoice === void 0 ? void 0 : invoice.amountDue;
|
|
19349
19351
|
const currencyId = (quote === null || quote === void 0 ? void 0 : quote.currencyId) || (invoice === null || invoice === void 0 ? void 0 : invoice.currencyId);
|
|
19350
19352
|
return amountDue && currencyId ? common.formatCurrency(amountDue, currencyId).toString() : undefined;
|
|
19351
19353
|
};
|
|
19354
|
+
// Validation checks
|
|
19355
|
+
if (quote !== undefined && invoice !== undefined) {
|
|
19356
|
+
throw new Error('Either quote or invoice must be provided, not both');
|
|
19357
|
+
}
|
|
19352
19358
|
// Payment hooks
|
|
19353
19359
|
const { pay: payDemoPay, isPaying: isPayingDemoPay } = usePay$1({
|
|
19354
|
-
onPaymentSuccess,
|
|
19360
|
+
onPaymentSuccess: handlePaymentSuccess,
|
|
19355
19361
|
onPaymentError: error => {
|
|
19356
19362
|
handleAllErrorFormats$2(error);
|
|
19357
19363
|
},
|
|
@@ -19360,7 +19366,7 @@ const useHandlePayment = ({ quote, invoice, onPaymentSuccess, onPaymentHoldSucce
|
|
|
19360
19366
|
plugin,
|
|
19361
19367
|
});
|
|
19362
19368
|
const { pay: payStripe, isPaying: isPayingStripe } = usePay({
|
|
19363
|
-
onPaymentSuccess,
|
|
19369
|
+
onPaymentSuccess: handlePaymentSuccess,
|
|
19364
19370
|
onPaymentError: error => {
|
|
19365
19371
|
handleAllErrorFormats$2(error);
|
|
19366
19372
|
},
|
|
@@ -19432,6 +19438,10 @@ const useHandlePayment = ({ quote, invoice, onPaymentSuccess, onPaymentHoldSucce
|
|
|
19432
19438
|
break;
|
|
19433
19439
|
}
|
|
19434
19440
|
};
|
|
19441
|
+
function handlePaymentSuccess(response) {
|
|
19442
|
+
setIsPaid(true);
|
|
19443
|
+
onPaymentSuccess === null || onPaymentSuccess === void 0 ? void 0 : onPaymentSuccess(response);
|
|
19444
|
+
}
|
|
19435
19445
|
const handlePayment = async (overridePaymentMethodId) => {
|
|
19436
19446
|
var _a, _b;
|
|
19437
19447
|
if (!plugin)
|
|
@@ -19454,6 +19464,7 @@ const useHandlePayment = ({ quote, invoice, onPaymentSuccess, onPaymentHoldSucce
|
|
|
19454
19464
|
isPayingStripe ||
|
|
19455
19465
|
isApprovingHoldDemoPay ||
|
|
19456
19466
|
isApprovingHoldStripe,
|
|
19467
|
+
isPaid,
|
|
19457
19468
|
paymentType: paymentHoldOptions.payToAccept ? PaymentType.APPROVE_HOLD : PaymentType.PAY,
|
|
19458
19469
|
formattedAmountDue: formattedAmountDue(),
|
|
19459
19470
|
};
|
|
@@ -19541,11 +19552,13 @@ const [ShowPaymentDetailsProvider, useShowPaymentDetails] = createStateContext(u
|
|
|
19541
19552
|
const handleAllErrorFormats$1 = common.useAllErrorFormats();
|
|
19542
19553
|
const showErrorNotification$5 = common.useErrorNotification();
|
|
19543
19554
|
// Contexts
|
|
19544
|
-
const [
|
|
19555
|
+
const [FormattedAmountDueProvider, useFormattedAmountDue] = createValueContext();
|
|
19545
19556
|
const [PaymentTypeProvider, usePaymentType] = createValueContext();
|
|
19546
19557
|
const [IsPayingProvider, useIsPaying] = createValueContext();
|
|
19547
19558
|
const [HandlePaymentFormSubmitProvider, useHandlePaymentFormSubmit] = createValueContext();
|
|
19548
19559
|
const [IsSavingProvider, useIsSaving] = createValueContext();
|
|
19560
|
+
// Used for PaymentMethodFooter to disable pay button if payment is already successful
|
|
19561
|
+
const [IsPaidProvider, useIsPaid] = createValueContext();
|
|
19549
19562
|
// Used for Signup component. Signup uses an apiClient token which api can't infer an account from, so accountId must be used
|
|
19550
19563
|
const [AccountIdProvider, useAccountId] = createValueContext();
|
|
19551
19564
|
function PaymentProvider({ children, accountId, quote, invoice, onPaymentSuccess, onPaymentHoldSuccess, paymentHoldOptions, onSavePaymentMethod, }) {
|
|
@@ -19556,7 +19569,7 @@ function PaymentProvider({ children, accountId, quote, invoice, onPaymentSuccess
|
|
|
19556
19569
|
// Hooks
|
|
19557
19570
|
const queryClient = reactQuery.useQueryClient();
|
|
19558
19571
|
const token = useToken();
|
|
19559
|
-
const { handlePayment, handleApproveHold, handleCheckoutNoPayment, isPaying, paymentType, formattedAmountDue, } = useHandlePayment({
|
|
19572
|
+
const { handlePayment, handleApproveHold, handleCheckoutNoPayment, isPaying, isPaid, paymentType, formattedAmountDue, } = useHandlePayment({
|
|
19560
19573
|
quote,
|
|
19561
19574
|
invoice,
|
|
19562
19575
|
onPaymentSuccess: (response) => {
|
|
@@ -19662,11 +19675,12 @@ function PaymentProvider({ children, accountId, quote, invoice, onPaymentSuccess
|
|
|
19662
19675
|
}
|
|
19663
19676
|
};
|
|
19664
19677
|
const providers = [
|
|
19665
|
-
[
|
|
19678
|
+
[FormattedAmountDueProvider, { value: formattedAmountDue }],
|
|
19666
19679
|
[PaymentTypeProvider, { value: paymentType }],
|
|
19667
19680
|
[IsPayingProvider, { value: isPaying }],
|
|
19668
19681
|
[HandlePaymentFormSubmitProvider, { value: handlePaymentFormSubmit }],
|
|
19669
19682
|
[IsSavingProvider, { value: isSavingDemoPay || isSavingStripe }],
|
|
19683
|
+
[IsPaidProvider, { value: isPaid }],
|
|
19670
19684
|
[AccountIdProvider, { value: accountId }],
|
|
19671
19685
|
];
|
|
19672
19686
|
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: providers.reduceRight((acc, [Provider, props]) => react.createElement(Provider, props, acc), children) }));
|
|
@@ -19677,33 +19691,49 @@ function StripeWrapper({ children, currencyId, accountId, }) {
|
|
|
19677
19691
|
return (jsxRuntime.jsx(reactStripeJs.Elements, { options: options, stripe: stripe, children: children }));
|
|
19678
19692
|
}
|
|
19679
19693
|
|
|
19694
|
+
function usePaymentButtonText() {
|
|
19695
|
+
const formattedAmountDue = useFormattedAmountDue();
|
|
19696
|
+
const paymentType = usePaymentType();
|
|
19697
|
+
const isPaid = useIsPaid();
|
|
19698
|
+
const isSaving = useIsSaving();
|
|
19699
|
+
const isPaying = useIsPaying();
|
|
19700
|
+
const isProcessing = isSaving || isPaying;
|
|
19701
|
+
// If payment is already successful, show the amount paid
|
|
19702
|
+
if (isPaid) {
|
|
19703
|
+
return 'Paid ' + (formattedAmountDue !== null && formattedAmountDue !== void 0 ? formattedAmountDue : '');
|
|
19704
|
+
}
|
|
19705
|
+
const paymentTypeText = isProcessing
|
|
19706
|
+
? paymentType === PaymentType.APPROVE_HOLD
|
|
19707
|
+
? 'Approving hold for'
|
|
19708
|
+
: 'Paying'
|
|
19709
|
+
: paymentType === PaymentType.APPROVE_HOLD
|
|
19710
|
+
? 'Approve hold for'
|
|
19711
|
+
: 'Pay';
|
|
19712
|
+
return paymentTypeText + ' ' + (formattedAmountDue !== null && formattedAmountDue !== void 0 ? formattedAmountDue : '');
|
|
19713
|
+
}
|
|
19714
|
+
|
|
19680
19715
|
const CheckoutFooter = () => {
|
|
19716
|
+
const isPaid = useIsPaid();
|
|
19681
19717
|
const isMobile = useIsMobile();
|
|
19682
|
-
const paymentType = usePaymentType();
|
|
19683
19718
|
const isPaying = useIsPaying();
|
|
19684
|
-
const
|
|
19719
|
+
const paymentButtonText = usePaymentButtonText();
|
|
19685
19720
|
const onPaymentFormSubmit = useHandlePaymentFormSubmit();
|
|
19686
|
-
|
|
19687
|
-
const isPayingButtonText = paymentType === PaymentType.APPROVE_HOLD ? 'Approving hold for' : 'Paying';
|
|
19688
|
-
return (jsxRuntime.jsx(antd.Button, { className: "bunny-w-full", disabled: isPaying, onClick: () => onPaymentFormSubmit(), size: isMobile ? 'large' : 'middle', type: "primary", children: `${isPaying ? isPayingButtonText : buttonText} ${formattedAmountDue}` }));
|
|
19721
|
+
return (jsxRuntime.jsx(antd.Button, { className: "bunny-w-full", disabled: isPaying || isPaid, onClick: () => onPaymentFormSubmit(), size: isMobile ? 'large' : 'middle', type: "primary", children: paymentButtonText }));
|
|
19689
19722
|
};
|
|
19690
19723
|
|
|
19691
19724
|
function PaymentMethodFooter({ onSubmit, noPadding, }) {
|
|
19692
19725
|
const isPaying = useIsPaying();
|
|
19693
19726
|
const isSaving = useIsSaving();
|
|
19694
|
-
const
|
|
19727
|
+
const formattedAmountDue = useFormattedAmountDue();
|
|
19728
|
+
const paymentButtonText = usePaymentButtonText();
|
|
19695
19729
|
const isMobile = common.useIsMobile();
|
|
19696
19730
|
const [, setShowPaymentMethodForm] = useShowPaymentDetails();
|
|
19731
|
+
// If amount due is undefined, show the save button
|
|
19732
|
+
const payableAvailable = formattedAmountDue !== undefined;
|
|
19733
|
+
const saveButtonText = isSaving ? 'Saving' : 'Save';
|
|
19734
|
+
const buttonText = payableAvailable ? paymentButtonText : saveButtonText;
|
|
19697
19735
|
return (jsxRuntime.jsxs("div", { className: `bunny-flex bunny-justify-end bunny-gap-2 ${noPadding ? '' : 'pt-6'}`, children: [jsxRuntime.jsx(antd.Button, { className: "bunny-w-full", size: isMobile ? 'large' : 'middle', onClick: () => setShowPaymentMethodForm(false), children: "Cancel" }), jsxRuntime.jsx(antd.Button, { className: "bunny-w-full", disabled: isSaving || isPaying, loading: isSaving || isPaying, onClick: onSubmit, size: isMobile ? 'large' : 'middle', type: "primary", children: buttonText })] }));
|
|
19698
19736
|
}
|
|
19699
|
-
function useSubmitButtonText() {
|
|
19700
|
-
const amountDue = useAmountDue();
|
|
19701
|
-
const paymentType = usePaymentType();
|
|
19702
|
-
const payableAvailable = amountDue !== undefined;
|
|
19703
|
-
const paymentTypeText = paymentType === PaymentType.APPROVE_HOLD ? 'approve hold for' : 'pay';
|
|
19704
|
-
const buttonTextPrefix = payableAvailable ? paymentTypeText : 'save';
|
|
19705
|
-
return lodashExports.capitalize(buttonTextPrefix) + ' ' + (amountDue !== null && amountDue !== void 0 ? amountDue : '');
|
|
19706
|
-
}
|
|
19707
19737
|
|
|
19708
19738
|
const DemoPayCardCvc = ({ autoFocus, onChange, placeholder, value, }) => {
|
|
19709
19739
|
const onKeyPress = (event) => {
|
|
@@ -19904,7 +19934,7 @@ const useAutoSetDefaultPaymentMethod = ({ handleSetDefault, setDefaultPaymentMet
|
|
|
19904
19934
|
]);
|
|
19905
19935
|
};
|
|
19906
19936
|
|
|
19907
|
-
const query$
|
|
19937
|
+
const query$5 = t(`
|
|
19908
19938
|
query GetCurrentUserData {
|
|
19909
19939
|
company {
|
|
19910
19940
|
name
|
|
@@ -19927,7 +19957,7 @@ const query$4 = t(`
|
|
|
19927
19957
|
`);
|
|
19928
19958
|
const getCurrentUserData = async ({ token, apiHost }) => {
|
|
19929
19959
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
19930
|
-
const response = await execute(query$
|
|
19960
|
+
const response = await execute(query$5, { apiHost, token }, {});
|
|
19931
19961
|
return {
|
|
19932
19962
|
authObjectName: (_a = response === null || response === void 0 ? void 0 : response.currentUser) === null || _a === void 0 ? void 0 : _a.authObjectName,
|
|
19933
19963
|
account: (_b = response === null || response === void 0 ? void 0 : response.currentUser) === null || _b === void 0 ? void 0 : _b.account,
|
|
@@ -20086,7 +20116,7 @@ function PaymentFormContent({ onRemovePaymentMethod, onSetDefaultPaymentMethod,
|
|
|
20086
20116
|
const [showPaymentMethodForm, setShowPaymentMethodForm] = useShowPaymentDetails();
|
|
20087
20117
|
const paymentType = usePaymentType();
|
|
20088
20118
|
const isPaying = useIsPaying();
|
|
20089
|
-
const
|
|
20119
|
+
const formattedAmountDue = useFormattedAmountDue();
|
|
20090
20120
|
const selectedPlugin = useSelectedPlugin();
|
|
20091
20121
|
const onPaymentFormSubmit = useHandlePaymentFormSubmit();
|
|
20092
20122
|
const accountId = useAccountId();
|
|
@@ -20133,7 +20163,7 @@ function PaymentFormContent({ onRemovePaymentMethod, onSetDefaultPaymentMethod,
|
|
|
20133
20163
|
label: !showPaymentMethodForm ? (jsxRuntime.jsx("div", { className: "bunny-pt-2", children: jsxRuntime.jsx(antd.Button, { onClick: handleClickAddPaymentMethod, type: "default", className: "bunny-w-full", id: "addPaymentMethod", children: "Add payment method" }) })) : null,
|
|
20134
20164
|
children: (jsxRuntime.jsxs("div", { className: "bunny-flex bunny-flex-col bunny-gap-2 bunny-mt-2", children: [jsxRuntime.jsx(PaymentMethodSelector, {}), selectedPlugin && (jsxRuntime.jsx("div", { className: "bunny-flex bunny-flex-col", children: jsxRuntime.jsx(PaymentMethodDetails, {}) }))] })),
|
|
20135
20165
|
},
|
|
20136
|
-
] }),
|
|
20166
|
+
] }), formattedAmountDue !== undefined && !showPaymentMethodForm && (jsxRuntime.jsx("div", { className: "bunny-px-4", children: jsxRuntime.jsx(CheckoutFooter, {}) }))] })) : (jsxRuntime.jsx(antd.Button, { style: { margin: '0 16px' }, loading: isPaying, onClick: () => onPaymentFormSubmit(), type: "primary", children: isPaying ? 'Processing...' : 'Complete Order' })) }));
|
|
20137
20167
|
}
|
|
20138
20168
|
|
|
20139
20169
|
function Invoice({ id, invoiceQuoteViewComponent, backButtonName, onBackButtonClick, onInvoiceDownloadError, onPaymentSuccess, shadow = 'shadow-md', className, hideDownloadButton = false, hidePaymentForm = false, onInvoiceLoaded, }) {
|
|
@@ -20168,7 +20198,7 @@ function ActualInvoice({ hidePaymentForm }) {
|
|
|
20168
20198
|
const isInvoicePayable = common.PAYABLE_INVOICE_STATES.includes((formattedInvoice === null || formattedInvoice === void 0 ? void 0 : formattedInvoice.state) || '');
|
|
20169
20199
|
// Local state
|
|
20170
20200
|
const isMobile = common.useIsMobile(isInvoicePayable ? common.BreakpointNumbers.lg : undefined);
|
|
20171
|
-
const
|
|
20201
|
+
const handlePaymentSuccess = () => {
|
|
20172
20202
|
queryClient.invalidateQueries({
|
|
20173
20203
|
queryKey: common.QueryKeyFactory.default.transactionsKey({ token }),
|
|
20174
20204
|
});
|
|
@@ -20188,15 +20218,21 @@ function ActualInvoice({ hidePaymentForm }) {
|
|
|
20188
20218
|
}, [formattedInvoice]);
|
|
20189
20219
|
if (!formattedInvoice)
|
|
20190
20220
|
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
20191
|
-
return (jsxRuntime.jsx("div", { className: "bunny-invoice-container", children: jsxRuntime.jsxs("div", { className: `bunny-flex bunny-gap-6 ${isMobile ? 'bunny-flex-col bunny-w-full' : ''} ${className}`, children: [formattedInvoice.isLegacy ? (jsxRuntime.jsx("div", { className: "bunny-flex bunny-justify-center bunny-w-full", children: jsxRuntime.jsx(LegacyDocument, { documentUuid: formattedInvoice.uuid, documentType: "invoice" }) })) : (invoiceQuoteViewComponent || (jsxRuntime.jsx(InvoiceQuoteView, { html: formattedInvoice.html, formattedInvoice: formattedInvoice, backButtonName: backButtonName, onBackButtonClick: onBackButtonClick }))), isInvoicePayable && !hidePaymentForm && (jsxRuntime.jsx("div", { className: `bunny-w-full ${hideDownloadButton || formattedInvoice.isLegacy ? '' : 'pt-12'}`, children: jsxRuntime.jsx(PaymentForm, { onPaymentSuccess:
|
|
20221
|
+
return (jsxRuntime.jsx("div", { className: "bunny-invoice-container", children: jsxRuntime.jsxs("div", { className: `bunny-flex bunny-gap-6 ${isMobile ? 'bunny-flex-col bunny-w-full' : ''} ${className}`, children: [formattedInvoice.isLegacy ? (jsxRuntime.jsx("div", { className: "bunny-flex bunny-justify-center bunny-w-full", children: jsxRuntime.jsx(LegacyDocument, { documentUuid: formattedInvoice.uuid, documentType: "invoice" }) })) : (invoiceQuoteViewComponent || (jsxRuntime.jsx(InvoiceQuoteView, { html: formattedInvoice.html, formattedInvoice: formattedInvoice, backButtonName: backButtonName, onBackButtonClick: onBackButtonClick }))), isInvoicePayable && !hidePaymentForm && (jsxRuntime.jsx("div", { className: `bunny-w-full ${hideDownloadButton || formattedInvoice.isLegacy ? '' : 'pt-12'}`, children: jsxRuntime.jsx(PaymentForm, { onPaymentSuccess: handlePaymentSuccess, invoice: formattedInvoice }) }))] }) }));
|
|
20192
20222
|
}
|
|
20193
20223
|
|
|
20194
|
-
const
|
|
20195
|
-
query formattedQuote
|
|
20196
|
-
formattedQuote
|
|
20224
|
+
const query$4 = t(`
|
|
20225
|
+
query formattedQuote($id: ID) {
|
|
20226
|
+
formattedQuote(id: $id) {
|
|
20197
20227
|
quote {
|
|
20198
20228
|
documentTemplateId
|
|
20199
|
-
documents {
|
|
20229
|
+
documents {
|
|
20230
|
+
id
|
|
20231
|
+
filename
|
|
20232
|
+
size
|
|
20233
|
+
date
|
|
20234
|
+
url
|
|
20235
|
+
}
|
|
20200
20236
|
firstInvoice {
|
|
20201
20237
|
id
|
|
20202
20238
|
state
|
|
@@ -20326,17 +20362,10 @@ const MUTATION$8 = () => `
|
|
|
20326
20362
|
taxNumberRequired
|
|
20327
20363
|
vendorName
|
|
20328
20364
|
}
|
|
20329
|
-
}
|
|
20365
|
+
}
|
|
20366
|
+
`);
|
|
20330
20367
|
const getFormattedQuote = async ({ token, apiHost, id, }) => {
|
|
20331
|
-
const response = await
|
|
20332
|
-
query: MUTATION$8(),
|
|
20333
|
-
token,
|
|
20334
|
-
apiHost,
|
|
20335
|
-
vars: { id },
|
|
20336
|
-
});
|
|
20337
|
-
if (response.errors && response.errors.length > 0) {
|
|
20338
|
-
throw new Error(response.errors[0].message);
|
|
20339
|
-
}
|
|
20368
|
+
const response = await execute(query$4, { apiHost, token }, { id });
|
|
20340
20369
|
return response === null || response === void 0 ? void 0 : response.formattedQuote;
|
|
20341
20370
|
};
|
|
20342
20371
|
|
|
@@ -20671,7 +20700,7 @@ const PaymentHoldModal = ({ visible, setVisible, quote, }) => {
|
|
|
20671
20700
|
const token = useToken();
|
|
20672
20701
|
return (jsxRuntime.jsxs(StyledModal$2, { centered: true, onCancel: () => {
|
|
20673
20702
|
setVisible(false);
|
|
20674
|
-
}, footer: null, open: visible, width: 600, children: [jsxRuntime.jsxs("div", { className: "bunny-mt-5 bunny-pb-4 bunny-mx-4", children: [jsxRuntime.jsx(Title$2, { className: "bunny-mt-0", level: 5, children: "Pay
|
|
20703
|
+
}, footer: null, open: visible, width: 600, children: [jsxRuntime.jsxs("div", { className: "bunny-mt-5 bunny-pb-4 bunny-mx-4", children: [jsxRuntime.jsx(Title$2, { className: "bunny-mt-0", level: 5, children: "Pay and sign" }), jsxRuntime.jsxs(Text$w, { className: "bunny-bt-2 bunny-text-sm/5 bunny-text-gray-500", children: ["To accept this quote, approve a payment hold for", ' ', common.formatCurrency(quote.amount, quote.currency), ". This amount will be charged to your payment method once the quote is signed."] })] }), jsxRuntime.jsx("div", { className: "bunny-mb-3", children: jsxRuntime.jsx(PaymentForm, { quote: {
|
|
20675
20704
|
amount: quote.amount,
|
|
20676
20705
|
currencyId: quote.currency,
|
|
20677
20706
|
id: quote.quote.id,
|
|
@@ -20766,7 +20795,7 @@ function ActualQuote({ onQuoteAccepted }) {
|
|
|
20766
20795
|
},
|
|
20767
20796
|
placeholderData: reactQuery.keepPreviousData,
|
|
20768
20797
|
});
|
|
20769
|
-
const formattedQuote = data;
|
|
20798
|
+
const formattedQuote = data; // TODO: fix to use the correct type
|
|
20770
20799
|
// Hooks
|
|
20771
20800
|
const { acceptBoxVisible, isAccepting, sendAccept, setAcceptBoxVisible, setIsAccepting, startAcceptance, pandadocPollingModalVisible, setPandadocPollingModalVisible, isSendAcceptPending, } = useSendAcceptQuote({
|
|
20772
20801
|
token,
|
|
@@ -20813,7 +20842,7 @@ function QuoteButtons({ isAccepted, formattedQuote, isMobile, hideDownloadButton
|
|
|
20813
20842
|
const signingPlugins = useSigningPlugins({ apiHost, token });
|
|
20814
20843
|
return (jsxRuntime.jsxs("div", { className: "flex flex-row justify-end items-center gap-4", id: "acceptance", style: {
|
|
20815
20844
|
color: secondaryColor,
|
|
20816
|
-
}, children: [isAccepted && formattedQuote.acceptedAt ? (jsxRuntime.jsx(Text$v, { children: `Quote was accepted by ${formattedQuote.acceptedByName} on ${common.formatDate(formattedQuote.acceptedAt)}` })) : null, (!isMobile || !isAccepted) && (jsxRuntime.jsxs("div", { className: isMobile ? 'flex w-full justify-end gap-2' : 'flex items-center justify-end gap-2', children: [paymentHold ? (jsxRuntime.jsx(PaymentHoldDisplay, { paymentHold: paymentHold, currency: formattedQuote.currency, amount: formattedQuote.amount })) : null, !isMobile && !hideDownloadButton ? (jsxRuntime.jsx(antd.Button, { icon: jsxRuntime.jsx(icons.DownloadOutlined, {}), onClick: () => downloadFile(apiHost + '/api/pdf/quote', token), children: "Download" })) : null, shouldDoPaymentHold && !paymentHoldCompleted ? (jsxRuntime.jsx(antd.Button, { disabled: isExpired, onClick: () => setPaymentHoldModalVisible(true), type: "primary", children: "Pay
|
|
20845
|
+
}, children: [isAccepted && formattedQuote.acceptedAt ? (jsxRuntime.jsx(Text$v, { children: `Quote was accepted by ${formattedQuote.acceptedByName} on ${common.formatDate(formattedQuote.acceptedAt)}` })) : null, (!isMobile || !isAccepted) && (jsxRuntime.jsxs("div", { className: isMobile ? 'flex w-full justify-end gap-2' : 'flex items-center justify-end gap-2', children: [paymentHold ? (jsxRuntime.jsx(PaymentHoldDisplay, { paymentHold: paymentHold, currency: formattedQuote.currency, amount: formattedQuote.amount })) : null, !isMobile && !hideDownloadButton ? (jsxRuntime.jsx(antd.Button, { icon: jsxRuntime.jsx(icons.DownloadOutlined, {}), onClick: () => downloadFile(apiHost + '/api/pdf/quote', token), children: "Download" })) : null, shouldDoPaymentHold && !paymentHoldCompleted ? (jsxRuntime.jsx(antd.Button, { disabled: isExpired, onClick: () => setPaymentHoldModalVisible(true), type: "primary", children: "Pay and sign" })) : (jsxRuntime.jsx(jsxRuntime.Fragment, { children: !isAccepted ? (jsxRuntime.jsx(antd.Button, { disabled: isExpired || isAccepting, onClick: handleClickAccept, type: "primary", children: isExpired
|
|
20817
20846
|
? 'Quote is expired'
|
|
20818
20847
|
: (signingPlugins === null || signingPlugins === void 0 ? void 0 : signingPlugins.length)
|
|
20819
20848
|
? 'Start signing'
|
|
@@ -20829,6 +20858,8 @@ function PaymentHoldDisplay({ paymentHold, currency, amount, }) {
|
|
|
20829
20858
|
return (jsxRuntime.jsx(antd.Tooltip, { title: `${formattedAmount} will be charged to ${paymentMethod} once the quote is accepted. Hold will be released on ${expirationDate} if not accepted.`, children: jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs(CustomizedTag, { color: 'orange', className: "rounded-md", style: { padding: 6 }, children: ["Hold of ", formattedAmount, " on ****", paymentMethod] }) }) }));
|
|
20830
20859
|
}
|
|
20831
20860
|
|
|
20861
|
+
const TransactionsListContext = react.createContext({});
|
|
20862
|
+
|
|
20832
20863
|
const QUOTES_QUERY = (filter) => `
|
|
20833
20864
|
query quotes {
|
|
20834
20865
|
quotes ${filter ? `(${filter})` : ''} {
|
|
@@ -20865,8 +20896,6 @@ const getQuotes = async ({ token, apiHost, filter, }) => {
|
|
|
20865
20896
|
return response === null || response === void 0 ? void 0 : response.quotes;
|
|
20866
20897
|
};
|
|
20867
20898
|
|
|
20868
|
-
const TransactionsListContext = react.createContext({});
|
|
20869
|
-
|
|
20870
20899
|
const transactionMutation = (filter) => `
|
|
20871
20900
|
query transactions {
|
|
20872
20901
|
transactions ${filter ? `(${filter})` : ''} {
|
|
@@ -21190,7 +21219,7 @@ function TransactionsDisplay({ transactions, onSearchValueChanged, search, }) {
|
|
|
21190
21219
|
}, children: isMobile ? (jsxRuntime.jsx(TransactionsListMobile, { transactions: updatedTransactions, onTransactionClick: handleTransactionClick })) : (jsxRuntime.jsx(TransactionsListDesktop, { transactions: updatedTransactions, onTransactionClick: handleTransactionClick })) })] }), useModal ? (jsxRuntime.jsx(antd.Modal, { title: drawerTitle(), open: drawerOpen, onOk: handleDisplayClose, onCancel: handleDisplayClose, width: DISPLAY_WIDTH, footer: null, children: jsxRuntime.jsx(Invoice, { id: selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.transactionableId, hidePaymentForm: hidePaymentForm }) })) : (jsxRuntime.jsx(antd.Drawer, { title: drawerTitle(), onClose: handleDisplayClose, open: drawerOpen, width: DISPLAY_WIDTH, children: transactionComponent ? (transactionComponent) : (selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.kind) === 'INVOICE' ? (jsxRuntime.jsx(Invoice, { id: selectedTransaction.transactionableId, hidePaymentForm: hidePaymentForm })) : (jsxRuntime.jsxs(antd.Card, { className: "bunny-shadow-md", children: [jsxRuntime.jsx(antd.Typography.Title, { level: 2, className: "bunny-mb-4", children: "Transaction Details" }), jsxRuntime.jsxs(antd.Typography.Paragraph, { children: [jsxRuntime.jsx("strong", { children: "Amount:" }), ' ', jsxRuntime.jsx(antd.Typography.Text, { children: common.formatCurrency((selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.amount) || 0, (selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.currencyId) || 'USD') })] }), jsxRuntime.jsxs(antd.Typography.Paragraph, { children: [jsxRuntime.jsx("strong", { children: "Description:" }), ' ', jsxRuntime.jsx(antd.Typography.Text, { children: selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.description })] }), jsxRuntime.jsxs(antd.Typography.Paragraph, { children: [jsxRuntime.jsx("strong", { children: "Kind:" }), ' ', jsxRuntime.jsx(antd.Typography.Text, { children: selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.kind })] }), jsxRuntime.jsxs(antd.Typography.Paragraph, { children: [jsxRuntime.jsx("strong", { children: "State:" }), ' ', jsxRuntime.jsx(antd.Typography.Text, { children: selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.state })] })] })) }))] }));
|
|
21191
21220
|
}
|
|
21192
21221
|
|
|
21193
|
-
function Quotes({ className, columns = ['date', 'title', 'amount', 'download', 'state'], filter, filterQuotes, sort = (a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime(), noQuotesMessage = 'There are no quotes', onQuoteClick,
|
|
21222
|
+
function Quotes({ className, columns = ['date', 'title', 'amount', 'download', 'state'], filter, filterQuotes, sort = (a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime(), noQuotesMessage = 'There are no quotes', onQuoteClick, renderQuote, searchBarClassName, shadow = 'shadow-md', showSearchBar = true, showTitle = true, title = 'Past quotes', style, suppressQuoteDisplay = false, useModal = false, }) {
|
|
21194
21223
|
const { apiHost } = react.useContext(BunnyContext);
|
|
21195
21224
|
const [component, setComponent] = react.useState(null);
|
|
21196
21225
|
const contextValues = {
|
|
@@ -21240,8 +21269,8 @@ function Quotes({ className, columns = ['date', 'title', 'amount', 'download', '
|
|
|
21240
21269
|
}
|
|
21241
21270
|
function handleQuoteClick(quote) {
|
|
21242
21271
|
onQuoteClick === null || onQuoteClick === void 0 ? void 0 : onQuoteClick(quote);
|
|
21243
|
-
if (
|
|
21244
|
-
setComponent(
|
|
21272
|
+
if (renderQuote !== undefined) {
|
|
21273
|
+
setComponent(renderQuote(quote));
|
|
21245
21274
|
}
|
|
21246
21275
|
else {
|
|
21247
21276
|
setComponent(jsxRuntime.jsx(Quote, { id: quote === null || quote === void 0 ? void 0 : quote.transactionableId }));
|
|
@@ -22175,12 +22204,8 @@ const CheckoutBarInput = ({ disabled, priceListCharge, quantity, onQuantityChang
|
|
|
22175
22204
|
}, min: priceListCharge === null || priceListCharge === void 0 ? void 0 : priceListCharge.quantityMin, max: priceListCharge === null || priceListCharge === void 0 ? void 0 : priceListCharge.quantityMax, style: { minWidth: '120px' }, type: "number", value: quantity, required: true }) })] }));
|
|
22176
22205
|
};
|
|
22177
22206
|
const QuantityLabel = ({ activeCharge }) => {
|
|
22178
|
-
|
|
22179
|
-
|
|
22180
|
-
const pluralizedFeatureName = (common.StringUtils.isStringPluralized(featureName) || !featureName
|
|
22181
|
-
? featureName
|
|
22182
|
-
: common.StringUtils.pluralizeEntityName(featureName)) || '';
|
|
22183
|
-
return (jsxRuntime.jsx(Text$n, { className: "bunny-text-slate-500 bunny-font-medium bunny-text-nowrap", style: { fontSize: '11px' }, children: pluralizedFeatureName.toUpperCase() }));
|
|
22207
|
+
const chargeName = activeCharge.name;
|
|
22208
|
+
return (jsxRuntime.jsx(Text$n, { className: "bunny-text-slate-500 bunny-font-medium bunny-text-nowrap", style: { fontSize: '11px' }, children: chargeName.toUpperCase() }));
|
|
22184
22209
|
};
|
|
22185
22210
|
|
|
22186
22211
|
const periodMonthsConverter = (period) => {
|
|
@@ -22709,11 +22734,8 @@ function Signup({ companyName, priceListCode, returnUrl, couponCode, className,
|
|
|
22709
22734
|
token,
|
|
22710
22735
|
});
|
|
22711
22736
|
const { mutate: recalculateTaxesMutation } = reactQuery.useMutation({
|
|
22712
|
-
mutationFn: () => {
|
|
22713
|
-
|
|
22714
|
-
throw new Error('Quote ID is required');
|
|
22715
|
-
}
|
|
22716
|
-
return quoteRecalculateTaxes({ token, apiHost, quoteId: quote.id });
|
|
22737
|
+
mutationFn: (quoteId) => {
|
|
22738
|
+
return quoteRecalculateTaxes({ token, apiHost, quoteId });
|
|
22717
22739
|
},
|
|
22718
22740
|
onError: (error) => {
|
|
22719
22741
|
if (!error[0].message.includes('Ensure that you have a taxation plugin')) {
|
|
@@ -22762,8 +22784,7 @@ function Signup({ companyName, priceListCode, returnUrl, couponCode, className,
|
|
|
22762
22784
|
}),
|
|
22763
22785
|
});
|
|
22764
22786
|
setInitialQuote(data.quote);
|
|
22765
|
-
|
|
22766
|
-
handleRecalculateTaxes();
|
|
22787
|
+
handleRecalculateTaxes(data.quote.id);
|
|
22767
22788
|
},
|
|
22768
22789
|
onError: (error) => {
|
|
22769
22790
|
const errorMessage = error.response.errors[0].message;
|
|
@@ -22801,7 +22822,7 @@ function Signup({ companyName, priceListCode, returnUrl, couponCode, className,
|
|
|
22801
22822
|
queryKey: ['quote', quote === null || quote === void 0 ? void 0 : quote.id],
|
|
22802
22823
|
});
|
|
22803
22824
|
showSuccessNotification('Coupon applied');
|
|
22804
|
-
handleRecalculateTaxes();
|
|
22825
|
+
handleRecalculateTaxes(quote === null || quote === void 0 ? void 0 : quote.id);
|
|
22805
22826
|
setCouponEditorCouponCode('');
|
|
22806
22827
|
},
|
|
22807
22828
|
onCouponRemoved: () => {
|
|
@@ -22809,7 +22830,7 @@ function Signup({ companyName, priceListCode, returnUrl, couponCode, className,
|
|
|
22809
22830
|
queryKey: ['quote', quote === null || quote === void 0 ? void 0 : quote.id],
|
|
22810
22831
|
});
|
|
22811
22832
|
showSuccessNotification('Coupon removed');
|
|
22812
|
-
handleRecalculateTaxes();
|
|
22833
|
+
handleRecalculateTaxes(quote === null || quote === void 0 ? void 0 : quote.id);
|
|
22813
22834
|
},
|
|
22814
22835
|
});
|
|
22815
22836
|
// Handle default coupon application
|
|
@@ -22843,18 +22864,21 @@ function Signup({ companyName, priceListCode, returnUrl, couponCode, className,
|
|
|
22843
22864
|
accountId,
|
|
22844
22865
|
});
|
|
22845
22866
|
}
|
|
22846
|
-
function handleRecalculateTaxes() {
|
|
22847
|
-
|
|
22867
|
+
function handleRecalculateTaxes(quoteId) {
|
|
22868
|
+
if (!quoteId) {
|
|
22869
|
+
showErrorNotification$1('No quote ID found to recalculate taxes');
|
|
22870
|
+
return;
|
|
22871
|
+
}
|
|
22848
22872
|
if (!hasTaxPlugin) {
|
|
22849
|
-
|
|
22873
|
+
showErrorNotification$1('No tax plugin found to recalculate taxes');
|
|
22850
22874
|
return;
|
|
22851
22875
|
}
|
|
22852
|
-
recalculateTaxesMutation();
|
|
22876
|
+
recalculateTaxesMutation(quoteId);
|
|
22853
22877
|
}
|
|
22854
22878
|
if (purchaseSucceeded) {
|
|
22855
22879
|
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: (quote === null || quote === void 0 ? void 0 : quote.currencyId) !== undefined ? (jsxRuntime.jsx("div", { className: "bunny-w-screen bunny-absolute bunny-top-0 bunny-left-0 bunny-flex bunny-items-start bunny-pt-[25vh]", children: jsxRuntime.jsx(PaymentSuccessDisplay, { amountPaid: (quote === null || quote === void 0 ? void 0 : quote.amountDue) || 0, className: "bunny-w-full", companyName: companyName, returnUrl: returnUrl, currencyId: quote === null || quote === void 0 ? void 0 : quote.currencyId }) })) : (jsxRuntime.jsx("div", { children: "No currency ID found from Quote" })) }));
|
|
22856
22880
|
}
|
|
22857
|
-
return (jsxRuntime.jsxs("div", { className: `bunny-flex ${isMobile ? 'bunny-flex-col' : 'bunny-flex-row'} bunny-h-screen bunny-w-screen bunny-absolute bunny-top-0 bunny-left-0 ${shadow} ${className}`, style: style, children: [jsxRuntime.jsx("div", { className: `bunny-flex bunny-items-center bunny-flex-col ${isMobile ? 'bunny-w-full bunny-h-1/2' : 'bunny-w-1/2 bunny-h-full'} bunny-justify-center`, children: jsxRuntime.jsxs("div", { className: "bunny-flex bunny-flex-col bunny-items-start bunny-justify-between bunny-w-3/5 bunny-h-full bunny-gap-4 bunny-my-24", children: [jsxRuntime.jsx("div", { children: topNavImageUrl.length > 0 && (jsxRuntime.jsx(
|
|
22881
|
+
return (jsxRuntime.jsxs("div", { className: `bunny-flex ${isMobile ? 'bunny-flex-col' : 'bunny-flex-row'} bunny-h-screen bunny-w-screen bunny-absolute bunny-top-0 bunny-left-0 ${shadow} ${className}`, style: style, children: [jsxRuntime.jsx("div", { className: `bunny-flex bunny-items-center bunny-flex-col ${isMobile ? 'bunny-w-full bunny-h-1/2' : 'bunny-w-1/2 bunny-h-full'} bunny-justify-center`, children: jsxRuntime.jsxs("div", { className: "bunny-flex bunny-flex-col bunny-items-start bunny-justify-between bunny-w-3/5 bunny-h-full bunny-gap-4 bunny-my-24", children: [jsxRuntime.jsx("div", { children: topNavImageUrl.length > 0 && (jsxRuntime.jsx("img", { alt: "Logo", src: topNavImageUrl, style: { width: 'auto', height: '28px' } })) }), data ? (jsxRuntime.jsx(CheckoutSummary, { quote: data, className: "bunny-h-full bunny-w-full", onAddCoupon: addCoupon, onRemoveCoupon: removeCoupon, isRemovingCoupon: isRemovingCoupon, priceListData: priceListData, isAddingCoupon: isAddingCoupon, couponCode: couponEditorCouponCode, setCouponCode: setCouponEditorCouponCode, activeCouponsExist: activeCouponsExist })) : (jsxRuntime.jsx("div", { className: "bunny-h-full", children: isLoadingPriceList ? (jsxRuntime.jsx(antd.Skeleton, { active: true })) : (jsxRuntime.jsx(PriceListDisplay, { priceListData: priceListData })) })), jsxRuntime.jsx(Footer, {})] }) }), jsxRuntime.jsx("div", { className: `bunny-flex bunny-flex-col ${isMobile ? 'bunny-w-full bunny-h-1/2 bunny-overflow-auto' : 'bunny-w-1/2 bunny-h-full'} bunny-items-center`, style: {
|
|
22858
22882
|
boxShadow: '-5px 0 20px 0 rgba(0, 0, 0, 0.05)',
|
|
22859
22883
|
}, children: isLoadingPriceList ? (jsxRuntime.jsx(antd.Skeleton, { active: true, className: `bunny-flex bunny-flex-col bunny-w-3/5 bunny-mt-24` })) : (jsxRuntime.jsx("div", { className: `bunny-flex bunny-flex-col bunny-w-3/5 bunny-mt-24`, children: jsxRuntime.jsx(PaymentForms, { quote: quote, handlePaymentSuccess: handlePaymentSuccess, handleSubmit: handleSubmit, proceedingToPayment: isSigningUp || isLoadingQuote, accountId: accountId, overrideToken: portalSessionToken, customCheckoutFunction: accountSignupFunction, defaultValues: defaultValues }) })) })] }));
|
|
22860
22884
|
}
|
|
@@ -24623,7 +24647,7 @@ function doesPriceListHaveFlatFeeCharges(maskedPriceList) {
|
|
|
24623
24647
|
function priceDescriptionString({ unitName, showPriceAsMonthly, periodMonths, priceListHasFlatFeeCharges, }) {
|
|
24624
24648
|
const periodMonthsConverted = periodMonthsConverter(periodMonths);
|
|
24625
24649
|
const periodLabel = periodMonthsConverted ? common.PERIOD_LABELS[periodMonthsConverted] : null;
|
|
24626
|
-
return `
|
|
24650
|
+
return `Per ${unitName && !priceListHasFlatFeeCharges ? `${unitName.toLowerCase()} / ` : ''}${showPriceAsMonthly ? 'month' : periodLabel}`;
|
|
24627
24651
|
}
|
|
24628
24652
|
|
|
24629
24653
|
var localizedFormat$2 = {exports: {}};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FormattedInvoice, Invoice, Quote } from '@bunnyapp/common';
|
|
2
2
|
import { PaymentType } from '../types/PaymentType';
|
|
3
|
-
declare const
|
|
3
|
+
declare const useFormattedAmountDue: () => string | undefined;
|
|
4
4
|
declare const usePaymentType: () => PaymentType | undefined;
|
|
5
5
|
declare const useIsPaying: () => boolean | undefined;
|
|
6
6
|
declare const useHandlePaymentFormSubmit: () => (demoPayCardDetails?: {
|
|
@@ -9,8 +9,9 @@ declare const useHandlePaymentFormSubmit: () => (demoPayCardDetails?: {
|
|
|
9
9
|
cvc: string;
|
|
10
10
|
}) => Promise<void>;
|
|
11
11
|
declare const useIsSaving: () => boolean | undefined;
|
|
12
|
+
declare const useIsPaid: () => boolean | undefined;
|
|
12
13
|
declare const useAccountId: () => string | undefined;
|
|
13
|
-
export { useAccountId,
|
|
14
|
+
export { useAccountId, useFormattedAmountDue, useHandlePaymentFormSubmit, useIsPaying, useIsSaving, useIsPaid, usePaymentType, };
|
|
14
15
|
export declare function PaymentProvider({ children, accountId, quote, invoice, onPaymentSuccess, onPaymentHoldSuccess, paymentHoldOptions, onSavePaymentMethod, }: {
|
|
15
16
|
children: React.ReactNode;
|
|
16
17
|
accountId?: string;
|
|
@@ -18,6 +18,7 @@ declare const useHandlePayment: ({ quote, invoice, onPaymentSuccess, onPaymentHo
|
|
|
18
18
|
savePaymentMethod: boolean | undefined;
|
|
19
19
|
}, Error, void, unknown>;
|
|
20
20
|
isPaying: boolean;
|
|
21
|
+
isPaid: boolean;
|
|
21
22
|
paymentType: PaymentType;
|
|
22
23
|
formattedAmountDue: string | undefined;
|
|
23
24
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function usePaymentButtonText(): string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Transaction } from '@bunnyapp/common';
|
|
2
2
|
import { ShadowType } from '../../types/shadowType';
|
|
3
3
|
import { TransactionListColumnType } from '../Transactions/transactionsList/TransactionsListDesktop';
|
|
4
|
-
declare function Quotes({ className, columns, filter, filterQuotes, sort, noQuotesMessage, onQuoteClick,
|
|
5
|
-
/**
|
|
6
|
-
|
|
4
|
+
declare function Quotes({ className, columns, filter, filterQuotes, sort, noQuotesMessage, onQuoteClick, renderQuote, searchBarClassName, shadow, showSearchBar, showTitle, title, style, suppressQuoteDisplay, useModal, }: {
|
|
5
|
+
/** Render a custom quote component. Receives the quoteId as a parameter. */
|
|
6
|
+
renderQuote?: (quote: Transaction) => React.ReactNode;
|
|
7
7
|
/** Whether to show the search bar */
|
|
8
8
|
showSearchBar?: boolean;
|
|
9
9
|
/** Whether to show the title */
|