@bunnyapp/components 1.0.39 → 1.0.40
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 +31 -41
- package/dist/cjs/src/components/BunnyProvider.d.ts +2 -2
- package/dist/cjs/src/components/Card.d.ts +0 -1
- package/dist/cjs/src/components/PaymentForm/PaymentForm.d.ts +0 -1
- package/dist/cjs/src/components/PaymentForm/PaymentMethodDetails.d.ts +0 -1
- package/dist/cjs/src/components/Quote/Quote.stories.d.ts +30 -31
- package/dist/cjs/src/components/Subscriptions/Subscriptions.d.ts +1 -2
- package/dist/cjs/src/hooks/quotes/useSendAcceptQuote.d.ts +0 -1
- package/dist/cjs/src/hooks/quotes/useSigningComplete.d.ts +1 -1
- package/dist/cjs/src/hooks/usePaymentMethod.d.ts +6 -1
- package/dist/cjs/src/hooks/usePlugins.d.ts +2 -2
- package/dist/cjs/src/hooks/useToken.d.ts +1 -1
- package/dist/esm/index.js +31 -41
- package/dist/esm/src/components/BunnyProvider.d.ts +2 -2
- package/dist/esm/src/components/Card.d.ts +0 -1
- package/dist/esm/src/components/PaymentForm/PaymentForm.d.ts +0 -1
- package/dist/esm/src/components/PaymentForm/PaymentMethodDetails.d.ts +0 -1
- package/dist/esm/src/components/Quote/Quote.stories.d.ts +30 -31
- package/dist/esm/src/components/Subscriptions/Subscriptions.d.ts +1 -2
- package/dist/esm/src/hooks/quotes/useSendAcceptQuote.d.ts +0 -1
- package/dist/esm/src/hooks/quotes/useSigningComplete.d.ts +1 -1
- package/dist/esm/src/hooks/usePaymentMethod.d.ts +6 -1
- package/dist/esm/src/hooks/usePlugins.d.ts +2 -2
- package/dist/esm/src/hooks/useToken.d.ts +1 -1
- package/dist/index.d.ts +8 -3
- package/package.json +2 -2
package/dist/cjs/index.js
CHANGED
|
@@ -232,9 +232,7 @@ function ContextualWrapper(_a) {
|
|
|
232
232
|
var entityBranding = react.useMemo(function () {
|
|
233
233
|
var _a;
|
|
234
234
|
// This is to determine if the secondary color should be white or black
|
|
235
|
-
var brandColor = (branding === null || branding === void 0 ? void 0 : branding.brandColor)
|
|
236
|
-
? "#" + ((_a = branding === null || branding === void 0 ? void 0 : branding.brandColor) === null || _a === void 0 ? void 0 : _a.toString(16))
|
|
237
|
-
: common.DEFAULT_BRAND_COLOR;
|
|
235
|
+
var brandColor = (branding === null || branding === void 0 ? void 0 : branding.brandColor) ? "#" + ((_a = branding === null || branding === void 0 ? void 0 : branding.brandColor) === null || _a === void 0 ? void 0 : _a.toString(16)) : common.DEFAULT_BRAND_COLOR;
|
|
238
236
|
var secondaryColor = common.DEFAULT_SECONDARY_COLOR;
|
|
239
237
|
if (!isMobile && common.isColorTooDark(branding === null || branding === void 0 ? void 0 : branding.accentColor))
|
|
240
238
|
secondaryColor = "#ffffff";
|
|
@@ -269,17 +267,11 @@ function ContextualWrapper(_a) {
|
|
|
269
267
|
boxShadowSecondary: "none",
|
|
270
268
|
fontWeight: "normal",
|
|
271
269
|
contentFontSizeLG: 14,
|
|
272
|
-
colorBgContainerDisabled: darkMode
|
|
273
|
-
|
|
274
|
-
: "#eef0f2",
|
|
275
|
-
borderColorDisabled: darkMode
|
|
276
|
-
? "var(--row-background-dark)"
|
|
277
|
-
: "#eef0f2",
|
|
270
|
+
colorBgContainerDisabled: darkMode ? "var(--row-background-dark)" : "#eef0f2",
|
|
271
|
+
borderColorDisabled: darkMode ? "var(--row-background-dark)" : "#eef0f2",
|
|
278
272
|
},
|
|
279
273
|
Drawer: {
|
|
280
|
-
colorBgElevated: darkMode
|
|
281
|
-
? "var(--row-background-dark)"
|
|
282
|
-
: common.SLATE_50,
|
|
274
|
+
colorBgElevated: darkMode ? "var(--row-background-dark)" : common.SLATE_50,
|
|
283
275
|
},
|
|
284
276
|
Divider: {
|
|
285
277
|
colorSplit: darkMode ? common.SLATE_400 : common.SLATE_200,
|
|
@@ -447,9 +439,10 @@ function InvoicePDF(_a) {
|
|
|
447
439
|
}
|
|
448
440
|
|
|
449
441
|
var paymentMethodsQuery = "query paymentMethods ($filter: String, $first: Int, $sort: String) {\n paymentMethods (filter: $filter, first: $first, sort: $sort) {\n nodes {\n id\n disabled\n pluginId\n accountId\n expirationDate\n plugin {\n guid\n id\n }\n state\n metadata {\n issuer\n identifier\n kind\n description\n icon\n }\n }\n }\n}";
|
|
450
|
-
var usePaymentMethod = function (
|
|
451
|
-
var _a =
|
|
452
|
-
|
|
442
|
+
var usePaymentMethod = function (_a) {
|
|
443
|
+
var accountId = _a.accountId, entityId = _a.entityId, graphQLClient = _a.graphQLClient, token = _a.token;
|
|
444
|
+
var _b = reactQuery.useQuery({
|
|
445
|
+
queryKey: common.QueryKeyFactory.default.accountPaymentMethodKey({ entityId: entityId, token: token, accountId: accountId }),
|
|
453
446
|
queryFn: function () {
|
|
454
447
|
return graphQLClient
|
|
455
448
|
.request(paymentMethodsQuery, {
|
|
@@ -463,7 +456,7 @@ var usePaymentMethod = function (graphQLClient, entityId, token, accountId) {
|
|
|
463
456
|
return paymentMethod;
|
|
464
457
|
});
|
|
465
458
|
},
|
|
466
|
-
}), data =
|
|
459
|
+
}), data = _b.data, isLoading = _b.isLoading;
|
|
467
460
|
return { data: data, isLoading: isLoading };
|
|
468
461
|
};
|
|
469
462
|
|
|
@@ -1359,7 +1352,7 @@ var PaymentForm = function (_a) {
|
|
|
1359
1352
|
var apiHost = react.useContext(BunnyContext).apiHost;
|
|
1360
1353
|
var tokenFromContexts = useToken();
|
|
1361
1354
|
var token = overrideToken || tokenFromContexts;
|
|
1362
|
-
var _f = usePaymentMethod(graphQLClient
|
|
1355
|
+
var _f = usePaymentMethod(graphQLClient), storedPaymentMethod = _f.data, isPaymentMethodLoading = _f.isLoading;
|
|
1363
1356
|
var isPaymentMethodFetched = storedPaymentMethod !== undefined;
|
|
1364
1357
|
var _g = usePaymentPlugins({ entityId: entityId, apiHost: apiHost, token: token }), allPaymentMethodAllowedPlugins = _g.paymentMethodAllowedPlugins, allPaymentPlugins = _g.paymentPlugins, arePluginsFetched = _g.isFetched;
|
|
1365
1358
|
var paymentMethodAllowedPlugins = react.useMemo(function () {
|
|
@@ -1640,7 +1633,7 @@ var useSigningComplete = function (_a) {
|
|
|
1640
1633
|
react.useEffect(function () {
|
|
1641
1634
|
if (data && eventParam === "signing_complete") {
|
|
1642
1635
|
data.state = "ACCEPTED";
|
|
1643
|
-
queryClient.setQueryData(common.QueryKeyFactory.default.createQuoteKey(token), data);
|
|
1636
|
+
queryClient.setQueryData(common.QueryKeyFactory.default.createQuoteKey({ id: data === null || data === void 0 ? void 0 : data.id, token: token }), data);
|
|
1644
1637
|
}
|
|
1645
1638
|
}, [data, eventParam, queryClient, token]);
|
|
1646
1639
|
};
|
|
@@ -19528,7 +19521,7 @@ var PaymentMethod = function (_a) {
|
|
|
19528
19521
|
var paymentPlugins = usePaymentPlugins({ entityId: entityId, apiHost: apiHost, token: token }).paymentPlugins;
|
|
19529
19522
|
var showSuccessNotification = common.useSuccessNotification();
|
|
19530
19523
|
var handleAllErrorFormats = common.useAllErrorFormats(onTokenExpired);
|
|
19531
|
-
var data = usePaymentMethod(graphQLClient
|
|
19524
|
+
var data = usePaymentMethod(graphQLClient).data;
|
|
19532
19525
|
var onClickRemove = useRemovePaymentMethod(paymentPlugins || [], apiHost, entityId, token);
|
|
19533
19526
|
// Queries
|
|
19534
19527
|
var billingDetails = reactQuery.useQuery({
|
|
@@ -19787,16 +19780,13 @@ var Checkout = function (_a) {
|
|
|
19787
19780
|
}), taxationRequiredAccountFields = _f.data, isLoadingTaxationRequiredAccountFields = _f.isLoading;
|
|
19788
19781
|
var _g = reactQuery.useQuery({
|
|
19789
19782
|
queryKey: ["account", quote === null || quote === void 0 ? void 0 : quote.accountId],
|
|
19790
|
-
queryFn: function () {
|
|
19791
|
-
|
|
19792
|
-
},
|
|
19793
|
-
enabled: Boolean(quote === null || quote === void 0 ? void 0 : quote.accountId) &&
|
|
19794
|
-
((taxationRequiredAccountFields === null || taxationRequiredAccountFields === void 0 ? void 0 : taxationRequiredAccountFields.length) || 0) > 0,
|
|
19783
|
+
queryFn: function () { return (quote === null || quote === void 0 ? void 0 : quote.accountId) && common.getAccount({ id: quote.accountId, token: token, apiHost: apiHost }); },
|
|
19784
|
+
enabled: Boolean(quote === null || quote === void 0 ? void 0 : quote.accountId) && ((taxationRequiredAccountFields === null || taxationRequiredAccountFields === void 0 ? void 0 : taxationRequiredAccountFields.length) || 0) > 0,
|
|
19795
19785
|
}), account = _g.data, isLoadingAccount = _g.isLoading;
|
|
19796
19786
|
reactQuery.useQuery({
|
|
19797
|
-
queryKey: queryKeyFactory.createQuoteTaxCalculateKey(quote === null || quote === void 0 ? void 0 : quote.id, token),
|
|
19787
|
+
queryKey: queryKeyFactory.createQuoteTaxCalculateKey({ id: quote === null || quote === void 0 ? void 0 : quote.id, token: token }),
|
|
19798
19788
|
queryFn: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
19799
|
-
var updatedQuote;
|
|
19789
|
+
var updatedQuote, quoteKey, calculatedPricesKey;
|
|
19800
19790
|
return __generator(this, function (_a) {
|
|
19801
19791
|
switch (_a.label) {
|
|
19802
19792
|
case 0:
|
|
@@ -19809,8 +19799,14 @@ var Checkout = function (_a) {
|
|
|
19809
19799
|
case 1:
|
|
19810
19800
|
updatedQuote = _a.sent();
|
|
19811
19801
|
if (updatedQuote) {
|
|
19812
|
-
|
|
19813
|
-
|
|
19802
|
+
quoteKey = queryKeyFactory.createObjectKey({ objectName: "editingQuote", id: updatedQuote.id, token: token });
|
|
19803
|
+
calculatedPricesKey = queryKeyFactory.calculatedPricesKey({
|
|
19804
|
+
quantity: quantity,
|
|
19805
|
+
priceListId: selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id,
|
|
19806
|
+
token: token,
|
|
19807
|
+
});
|
|
19808
|
+
queryClient.setQueryData(quoteKey, updatedQuote);
|
|
19809
|
+
queryClient.setQueryData(calculatedPricesKey, updatedQuote);
|
|
19814
19810
|
}
|
|
19815
19811
|
_a.label = 2;
|
|
19816
19812
|
case 2: return [2 /*return*/, {}];
|
|
@@ -19974,7 +19970,7 @@ function Signup(_a) {
|
|
|
19974
19970
|
var _h = react.useState(false), proceedingToPayment = _h[0], setProceedingToPayment = _h[1];
|
|
19975
19971
|
var _j = react.useState(false), purchaseSucceeded = _j[0], setPurchaseSucceeded = _j[1];
|
|
19976
19972
|
var _k = react.useState(undefined), paymentMethodGraphQLClient = _k[0], setPaymentMethodGraphQLClient = _k[1];
|
|
19977
|
-
var paymentMethod = usePaymentMethod(paymentMethodGraphQLClient || graphQLClient
|
|
19973
|
+
var paymentMethod = usePaymentMethod(paymentMethodGraphQLClient || graphQLClient).data;
|
|
19978
19974
|
var queryClient = reactQuery.useQueryClient();
|
|
19979
19975
|
// Queries
|
|
19980
19976
|
var priceListData = reactQuery.useQuery({
|
|
@@ -20686,7 +20682,7 @@ function BillingDetailsSection(_a) {
|
|
|
20686
20682
|
var showSuccessNotification = common.useSuccessNotification();
|
|
20687
20683
|
// Queries
|
|
20688
20684
|
var _d = reactQuery.useQuery({
|
|
20689
|
-
queryKey: common.QueryKeyFactory.default.billingDetailsKey(entityId, token),
|
|
20685
|
+
queryKey: common.QueryKeyFactory.default.billingDetailsKey({ entityId: entityId, token: token }),
|
|
20690
20686
|
queryFn: function () { return getBillingDetails({ token: token, apiHost: apiHost }); },
|
|
20691
20687
|
}), billingDetails = _d.data, isLoadingBillingDetails = _d.isLoading;
|
|
20692
20688
|
var _e = reactQuery.useMutation({
|
|
@@ -20710,7 +20706,7 @@ function BillingDetailsSection(_a) {
|
|
|
20710
20706
|
})];
|
|
20711
20707
|
case 1:
|
|
20712
20708
|
updatedBillingDetails = _a.sent();
|
|
20713
|
-
queryClient.setQueryData(common.QueryKeyFactory.default.billingDetailsKey(entityId, token), function (old) {
|
|
20709
|
+
queryClient.setQueryData(common.QueryKeyFactory.default.billingDetailsKey({ entityId: entityId, token: token }), function (old) {
|
|
20714
20710
|
return __assign(__assign({}, old), updatedBillingDetails.billingDetails);
|
|
20715
20711
|
});
|
|
20716
20712
|
return [2 /*return*/, updatedBillingDetails];
|
|
@@ -20720,7 +20716,7 @@ function BillingDetailsSection(_a) {
|
|
|
20720
20716
|
onSuccess: function () {
|
|
20721
20717
|
showSuccessNotification("Your account details have been saved");
|
|
20722
20718
|
queryClient.invalidateQueries({
|
|
20723
|
-
queryKey: common.QueryKeyFactory.default.taxationRequiredAccountFieldsKey(entityId, token),
|
|
20719
|
+
queryKey: common.QueryKeyFactory.default.taxationRequiredAccountFieldsKey({ entityId: entityId, token: token }),
|
|
20724
20720
|
});
|
|
20725
20721
|
},
|
|
20726
20722
|
}), updateBillingDetails = _e.mutate, isUpdatingBillingDetails = _e.isPending;
|
|
@@ -20801,9 +20797,7 @@ function BillingDetailsSection(_a) {
|
|
|
20801
20797
|
});
|
|
20802
20798
|
}); };
|
|
20803
20799
|
var filteredCountryList = react.useMemo(function () {
|
|
20804
|
-
return countryListFilter
|
|
20805
|
-
? common.Lists.COUNTRY_LIST.filter(countryListFilter)
|
|
20806
|
-
: common.Lists.COUNTRY_LIST;
|
|
20800
|
+
return countryListFilter ? common.Lists.COUNTRY_LIST.filter(countryListFilter) : common.Lists.COUNTRY_LIST;
|
|
20807
20801
|
}, [countryListFilter]);
|
|
20808
20802
|
return (jsxRuntime.jsxs("div", __assign({ className: "".concat(isMobile || hidePaymentMethodForm ? "w-full" : "w-1/2", " px-4") }, { children: [jsxRuntime.jsx(antd.Skeleton, __assign({ loading: isLoadingBillingDetails }, { children: jsxRuntime.jsxs(antd.Form, __assign({ className: "flex flex-col gap-2", form: form, layout: "vertical", disabled: isUpdatingBillingDetails, autoComplete: "off" }, { children: [jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Account name", name: "name", rules: [{ required: true, message: "Account name is required" }] }, { children: jsxRuntime.jsx(antd.Input, {}) })), jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Street address", name: "billingStreet", rules: [{ required: true, message: "Street address is required" }] }, { children: jsxRuntime.jsx(antd.Input, {}) })), jsxRuntime.jsxs("div", __assign({ className: "flex gap-4" }, { children: [jsxRuntime.jsx(antd.Form.Item, __assign({ label: "City", name: "billingCity", rules: [{ required: true, message: "City is required" }], className: "flex-1" }, { children: jsxRuntime.jsx(antd.Input, {}) })), jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Zipcode", name: "billingZip", rules: [{ required: true, message: "Zipcode is required" }], className: "flex-1" }, { children: jsxRuntime.jsx(antd.Input, {}) }))] })), jsxRuntime.jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col pb-2" : "flex-row", " gap-4") }, { children: [jsxRuntime.jsx(antd.Form.Item, __assign({ label: "State", name: "billingState", className: "flex-1", rules: [
|
|
20809
20803
|
{
|
|
@@ -20811,12 +20805,8 @@ function BillingDetailsSection(_a) {
|
|
|
20811
20805
|
},
|
|
20812
20806
|
] }, { children: jsxRuntime.jsx(antd.Input, {}) })), jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Country", name: "billingCountry", className: "flex-1", rules: [{ required: true, message: "Country is required" }] }, { children: jsxRuntime.jsx(antd.Select, { options: filteredCountryList, placeholder: "Select a country", showSearch: true, filterOption: function (input, option) {
|
|
20813
20807
|
var _a, _b;
|
|
20814
|
-
return ((_a = option === null || option === void 0 ? void 0 : option.label) !== null && _a !== void 0 ? _a : "")
|
|
20815
|
-
.toLowerCase()
|
|
20816
|
-
.includes(input.toLowerCase()) ||
|
|
20817
|
-
((_b = option === null || option === void 0 ? void 0 : option.value) !== null && _b !== void 0 ? _b : "")
|
|
20818
|
-
.toLowerCase()
|
|
20819
|
-
.includes(input.toLowerCase());
|
|
20808
|
+
return ((_a = option === null || option === void 0 ? void 0 : option.label) !== null && _a !== void 0 ? _a : "").toLowerCase().includes(input.toLowerCase()) ||
|
|
20809
|
+
((_b = option === null || option === void 0 ? void 0 : option.value) !== null && _b !== void 0 ? _b : "").toLowerCase().includes(input.toLowerCase());
|
|
20820
20810
|
} }) }))] })), jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Email", name: "billingContactEmail", rules: [
|
|
20821
20811
|
{
|
|
20822
20812
|
required: true,
|
|
@@ -5,7 +5,7 @@ import { GraphQLClient } from "graphql-request";
|
|
|
5
5
|
export type BunnyContextValues = {
|
|
6
6
|
apiHost: string;
|
|
7
7
|
graphQLClient: GraphQLClient;
|
|
8
|
-
token
|
|
8
|
+
token: string;
|
|
9
9
|
displayPayButtonNameAnyways?: boolean;
|
|
10
10
|
darkMode?: boolean;
|
|
11
11
|
onTokenExpired?: () => void;
|
|
@@ -16,7 +16,7 @@ declare function BunnyProvider({ children, darkMode, queryClient, apiHost, token
|
|
|
16
16
|
darkMode?: boolean;
|
|
17
17
|
queryClient?: QueryClient;
|
|
18
18
|
apiHost: string;
|
|
19
|
-
token
|
|
19
|
+
token: string;
|
|
20
20
|
onTokenExpired?: () => void;
|
|
21
21
|
configProviderProps?: ThemeConfig | undefined;
|
|
22
22
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { FormattedInvoice, PluginData, Quote } from "@bunnyapp/common";
|
|
3
2
|
import { GraphQLClient } from "graphql-request";
|
|
4
3
|
export declare const PaymentForm: ({ entityId, invoice, onFail, onPaymentSuccess, quote, accountId, onSavePaymentMethod, overrideToken, graphQLClient, customCheckoutFunction, currencyId: currencyIdFromProps, customPaymentForms, useAllPaymentPlugins, }: {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
2
|
import Quote from "./Quote";
|
|
4
3
|
declare const meta: Meta<typeof Quote>;
|
|
@@ -18,16 +17,16 @@ export declare const Default: import("@storybook/core/csf").StoryAnnotations<imp
|
|
|
18
17
|
onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
|
|
19
18
|
onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
|
|
20
19
|
}, {
|
|
21
|
-
backButtonName?: string | undefined;
|
|
22
|
-
onBackButtonClick?: (() => void) | undefined;
|
|
23
|
-
shadow?: import("../../types/shadowType").ShadowType | undefined;
|
|
24
|
-
hideDownloadButton?: boolean | undefined;
|
|
25
|
-
id?: string | undefined;
|
|
26
20
|
className?: string | undefined;
|
|
27
21
|
entityId?: string | undefined;
|
|
28
|
-
|
|
22
|
+
shadow?: import("../../types/shadowType").ShadowType | undefined;
|
|
23
|
+
id?: string | undefined;
|
|
29
24
|
invoiceQuoteViewComponent?: import("react").ReactNode;
|
|
25
|
+
backButtonName?: string | undefined;
|
|
26
|
+
onBackButtonClick?: (() => void) | undefined;
|
|
30
27
|
onInvoiceDownloadError?: (() => void) | undefined;
|
|
28
|
+
onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
|
|
29
|
+
hideDownloadButton?: boolean | undefined;
|
|
31
30
|
onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
|
|
32
31
|
onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
|
|
33
32
|
}>;
|
|
@@ -45,16 +44,16 @@ export declare const NoShadow: import("@storybook/core/csf").StoryAnnotations<im
|
|
|
45
44
|
onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
|
|
46
45
|
onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
|
|
47
46
|
}, {
|
|
48
|
-
backButtonName?: string | undefined;
|
|
49
|
-
onBackButtonClick?: (() => void) | undefined;
|
|
50
|
-
shadow?: import("../../types/shadowType").ShadowType | undefined;
|
|
51
|
-
hideDownloadButton?: boolean | undefined;
|
|
52
|
-
id?: string | undefined;
|
|
53
47
|
className?: string | undefined;
|
|
54
48
|
entityId?: string | undefined;
|
|
55
|
-
|
|
49
|
+
shadow?: import("../../types/shadowType").ShadowType | undefined;
|
|
50
|
+
id?: string | undefined;
|
|
56
51
|
invoiceQuoteViewComponent?: import("react").ReactNode;
|
|
52
|
+
backButtonName?: string | undefined;
|
|
53
|
+
onBackButtonClick?: (() => void) | undefined;
|
|
57
54
|
onInvoiceDownloadError?: (() => void) | undefined;
|
|
55
|
+
onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
|
|
56
|
+
hideDownloadButton?: boolean | undefined;
|
|
58
57
|
onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
|
|
59
58
|
onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
|
|
60
59
|
}>;
|
|
@@ -72,16 +71,16 @@ export declare const Mobile: import("@storybook/core/csf").StoryAnnotations<impo
|
|
|
72
71
|
onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
|
|
73
72
|
onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
|
|
74
73
|
}, {
|
|
75
|
-
backButtonName?: string | undefined;
|
|
76
|
-
onBackButtonClick?: (() => void) | undefined;
|
|
77
|
-
shadow?: import("../../types/shadowType").ShadowType | undefined;
|
|
78
|
-
hideDownloadButton?: boolean | undefined;
|
|
79
|
-
id?: string | undefined;
|
|
80
74
|
className?: string | undefined;
|
|
81
75
|
entityId?: string | undefined;
|
|
82
|
-
|
|
76
|
+
shadow?: import("../../types/shadowType").ShadowType | undefined;
|
|
77
|
+
id?: string | undefined;
|
|
83
78
|
invoiceQuoteViewComponent?: import("react").ReactNode;
|
|
79
|
+
backButtonName?: string | undefined;
|
|
80
|
+
onBackButtonClick?: (() => void) | undefined;
|
|
84
81
|
onInvoiceDownloadError?: (() => void) | undefined;
|
|
82
|
+
onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
|
|
83
|
+
hideDownloadButton?: boolean | undefined;
|
|
85
84
|
onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
|
|
86
85
|
onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
|
|
87
86
|
}>;
|
|
@@ -99,16 +98,16 @@ export declare const CustomClassName: import("@storybook/core/csf").StoryAnnotat
|
|
|
99
98
|
onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
|
|
100
99
|
onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
|
|
101
100
|
}, {
|
|
102
|
-
backButtonName?: string | undefined;
|
|
103
|
-
onBackButtonClick?: (() => void) | undefined;
|
|
104
|
-
shadow?: import("../../types/shadowType").ShadowType | undefined;
|
|
105
|
-
hideDownloadButton?: boolean | undefined;
|
|
106
|
-
id?: string | undefined;
|
|
107
101
|
className?: string | undefined;
|
|
108
102
|
entityId?: string | undefined;
|
|
109
|
-
|
|
103
|
+
shadow?: import("../../types/shadowType").ShadowType | undefined;
|
|
104
|
+
id?: string | undefined;
|
|
110
105
|
invoiceQuoteViewComponent?: import("react").ReactNode;
|
|
106
|
+
backButtonName?: string | undefined;
|
|
107
|
+
onBackButtonClick?: (() => void) | undefined;
|
|
111
108
|
onInvoiceDownloadError?: (() => void) | undefined;
|
|
109
|
+
onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
|
|
110
|
+
hideDownloadButton?: boolean | undefined;
|
|
112
111
|
onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
|
|
113
112
|
onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
|
|
114
113
|
}>;
|
|
@@ -129,16 +128,16 @@ export declare const DarkMode: import("@storybook/core/csf").StoryAnnotations<im
|
|
|
129
128
|
onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
|
|
130
129
|
onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
|
|
131
130
|
}, {
|
|
132
|
-
backButtonName?: string | undefined;
|
|
133
|
-
onBackButtonClick?: (() => void) | undefined;
|
|
134
|
-
shadow?: import("../../types/shadowType").ShadowType | undefined;
|
|
135
|
-
hideDownloadButton?: boolean | undefined;
|
|
136
|
-
id?: string | undefined;
|
|
137
131
|
className?: string | undefined;
|
|
138
132
|
entityId?: string | undefined;
|
|
139
|
-
|
|
133
|
+
shadow?: import("../../types/shadowType").ShadowType | undefined;
|
|
134
|
+
id?: string | undefined;
|
|
140
135
|
invoiceQuoteViewComponent?: import("react").ReactNode;
|
|
136
|
+
backButtonName?: string | undefined;
|
|
137
|
+
onBackButtonClick?: (() => void) | undefined;
|
|
141
138
|
onInvoiceDownloadError?: (() => void) | undefined;
|
|
139
|
+
onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
|
|
140
|
+
hideDownloadButton?: boolean | undefined;
|
|
142
141
|
onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
|
|
143
142
|
onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
|
|
144
143
|
}>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { Subscription } from "@bunnyapp/common";
|
|
3
2
|
import "../../styles/index.less";
|
|
4
3
|
export type EditingQuoteDataType = {
|
|
@@ -15,7 +14,7 @@ declare const Subscriptions: ({ className, companyName, entityId, hideExpired, o
|
|
|
15
14
|
onSubscriptionsLoaded?: ((subscriptions: Subscription[]) => void) | undefined;
|
|
16
15
|
styles?: {
|
|
17
16
|
gap?: number | undefined;
|
|
18
|
-
shadow?: "none" | "
|
|
17
|
+
shadow?: "none" | "sm" | "md" | "lg" | undefined;
|
|
19
18
|
subscriptionProductNameStyle?: import("react").CSSProperties | undefined;
|
|
20
19
|
} | undefined;
|
|
21
20
|
noSubscriptionsComponent?: React.ReactNode;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { GraphQLClient } from "graphql-request";
|
|
2
|
-
export declare const usePaymentMethod: (
|
|
2
|
+
export declare const usePaymentMethod: ({ accountId, entityId, graphQLClient, token, }: {
|
|
3
|
+
accountId?: string | undefined;
|
|
4
|
+
entityId?: string | undefined;
|
|
5
|
+
graphQLClient: GraphQLClient;
|
|
6
|
+
token: string;
|
|
7
|
+
}) => {
|
|
3
8
|
data: any;
|
|
4
9
|
isLoading: boolean;
|
|
5
10
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
declare const usePlugins: ({ entityId, apiHost, token
|
|
1
|
+
declare const usePlugins: ({ entityId, apiHost, token }: {
|
|
2
2
|
entityId: string;
|
|
3
3
|
apiHost: string;
|
|
4
|
-
token
|
|
4
|
+
token: string;
|
|
5
5
|
}) => import("@tanstack/react-query/build/legacy/types").UseQueryResult<any, Error>;
|
|
6
6
|
export default usePlugins;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare function useToken(): string
|
|
1
|
+
declare function useToken(): string;
|
|
2
2
|
export default useToken;
|
package/dist/esm/index.js
CHANGED
|
@@ -204,9 +204,7 @@ function ContextualWrapper(_a) {
|
|
|
204
204
|
var entityBranding = useMemo(function () {
|
|
205
205
|
var _a;
|
|
206
206
|
// This is to determine if the secondary color should be white or black
|
|
207
|
-
var brandColor = (branding === null || branding === void 0 ? void 0 : branding.brandColor)
|
|
208
|
-
? "#" + ((_a = branding === null || branding === void 0 ? void 0 : branding.brandColor) === null || _a === void 0 ? void 0 : _a.toString(16))
|
|
209
|
-
: DEFAULT_BRAND_COLOR;
|
|
207
|
+
var brandColor = (branding === null || branding === void 0 ? void 0 : branding.brandColor) ? "#" + ((_a = branding === null || branding === void 0 ? void 0 : branding.brandColor) === null || _a === void 0 ? void 0 : _a.toString(16)) : DEFAULT_BRAND_COLOR;
|
|
210
208
|
var secondaryColor = DEFAULT_SECONDARY_COLOR;
|
|
211
209
|
if (!isMobile && isColorTooDark(branding === null || branding === void 0 ? void 0 : branding.accentColor))
|
|
212
210
|
secondaryColor = "#ffffff";
|
|
@@ -241,17 +239,11 @@ function ContextualWrapper(_a) {
|
|
|
241
239
|
boxShadowSecondary: "none",
|
|
242
240
|
fontWeight: "normal",
|
|
243
241
|
contentFontSizeLG: 14,
|
|
244
|
-
colorBgContainerDisabled: darkMode
|
|
245
|
-
|
|
246
|
-
: "#eef0f2",
|
|
247
|
-
borderColorDisabled: darkMode
|
|
248
|
-
? "var(--row-background-dark)"
|
|
249
|
-
: "#eef0f2",
|
|
242
|
+
colorBgContainerDisabled: darkMode ? "var(--row-background-dark)" : "#eef0f2",
|
|
243
|
+
borderColorDisabled: darkMode ? "var(--row-background-dark)" : "#eef0f2",
|
|
250
244
|
},
|
|
251
245
|
Drawer: {
|
|
252
|
-
colorBgElevated: darkMode
|
|
253
|
-
? "var(--row-background-dark)"
|
|
254
|
-
: SLATE_50,
|
|
246
|
+
colorBgElevated: darkMode ? "var(--row-background-dark)" : SLATE_50,
|
|
255
247
|
},
|
|
256
248
|
Divider: {
|
|
257
249
|
colorSplit: darkMode ? SLATE_400 : SLATE_200,
|
|
@@ -419,9 +411,10 @@ function InvoicePDF(_a) {
|
|
|
419
411
|
}
|
|
420
412
|
|
|
421
413
|
var paymentMethodsQuery = "query paymentMethods ($filter: String, $first: Int, $sort: String) {\n paymentMethods (filter: $filter, first: $first, sort: $sort) {\n nodes {\n id\n disabled\n pluginId\n accountId\n expirationDate\n plugin {\n guid\n id\n }\n state\n metadata {\n issuer\n identifier\n kind\n description\n icon\n }\n }\n }\n}";
|
|
422
|
-
var usePaymentMethod = function (
|
|
423
|
-
var _a =
|
|
424
|
-
|
|
414
|
+
var usePaymentMethod = function (_a) {
|
|
415
|
+
var accountId = _a.accountId, entityId = _a.entityId, graphQLClient = _a.graphQLClient, token = _a.token;
|
|
416
|
+
var _b = useQuery({
|
|
417
|
+
queryKey: QueryKeyFactory.default.accountPaymentMethodKey({ entityId: entityId, token: token, accountId: accountId }),
|
|
425
418
|
queryFn: function () {
|
|
426
419
|
return graphQLClient
|
|
427
420
|
.request(paymentMethodsQuery, {
|
|
@@ -435,7 +428,7 @@ var usePaymentMethod = function (graphQLClient, entityId, token, accountId) {
|
|
|
435
428
|
return paymentMethod;
|
|
436
429
|
});
|
|
437
430
|
},
|
|
438
|
-
}), data =
|
|
431
|
+
}), data = _b.data, isLoading = _b.isLoading;
|
|
439
432
|
return { data: data, isLoading: isLoading };
|
|
440
433
|
};
|
|
441
434
|
|
|
@@ -1331,7 +1324,7 @@ var PaymentForm = function (_a) {
|
|
|
1331
1324
|
var apiHost = useContext(BunnyContext).apiHost;
|
|
1332
1325
|
var tokenFromContexts = useToken();
|
|
1333
1326
|
var token = overrideToken || tokenFromContexts;
|
|
1334
|
-
var _f = usePaymentMethod(graphQLClient
|
|
1327
|
+
var _f = usePaymentMethod(graphQLClient), storedPaymentMethod = _f.data, isPaymentMethodLoading = _f.isLoading;
|
|
1335
1328
|
var isPaymentMethodFetched = storedPaymentMethod !== undefined;
|
|
1336
1329
|
var _g = usePaymentPlugins({ entityId: entityId, apiHost: apiHost, token: token }), allPaymentMethodAllowedPlugins = _g.paymentMethodAllowedPlugins, allPaymentPlugins = _g.paymentPlugins, arePluginsFetched = _g.isFetched;
|
|
1337
1330
|
var paymentMethodAllowedPlugins = useMemo(function () {
|
|
@@ -1612,7 +1605,7 @@ var useSigningComplete = function (_a) {
|
|
|
1612
1605
|
useEffect(function () {
|
|
1613
1606
|
if (data && eventParam === "signing_complete") {
|
|
1614
1607
|
data.state = "ACCEPTED";
|
|
1615
|
-
queryClient.setQueryData(QueryKeyFactory.default.createQuoteKey(token), data);
|
|
1608
|
+
queryClient.setQueryData(QueryKeyFactory.default.createQuoteKey({ id: data === null || data === void 0 ? void 0 : data.id, token: token }), data);
|
|
1616
1609
|
}
|
|
1617
1610
|
}, [data, eventParam, queryClient, token]);
|
|
1618
1611
|
};
|
|
@@ -19500,7 +19493,7 @@ var PaymentMethod = function (_a) {
|
|
|
19500
19493
|
var paymentPlugins = usePaymentPlugins({ entityId: entityId, apiHost: apiHost, token: token }).paymentPlugins;
|
|
19501
19494
|
var showSuccessNotification = useSuccessNotification();
|
|
19502
19495
|
var handleAllErrorFormats = useAllErrorFormats(onTokenExpired);
|
|
19503
|
-
var data = usePaymentMethod(graphQLClient
|
|
19496
|
+
var data = usePaymentMethod(graphQLClient).data;
|
|
19504
19497
|
var onClickRemove = useRemovePaymentMethod(paymentPlugins || [], apiHost, entityId, token);
|
|
19505
19498
|
// Queries
|
|
19506
19499
|
var billingDetails = useQuery({
|
|
@@ -19759,16 +19752,13 @@ var Checkout = function (_a) {
|
|
|
19759
19752
|
}), taxationRequiredAccountFields = _f.data, isLoadingTaxationRequiredAccountFields = _f.isLoading;
|
|
19760
19753
|
var _g = useQuery({
|
|
19761
19754
|
queryKey: ["account", quote === null || quote === void 0 ? void 0 : quote.accountId],
|
|
19762
|
-
queryFn: function () {
|
|
19763
|
-
|
|
19764
|
-
},
|
|
19765
|
-
enabled: Boolean(quote === null || quote === void 0 ? void 0 : quote.accountId) &&
|
|
19766
|
-
((taxationRequiredAccountFields === null || taxationRequiredAccountFields === void 0 ? void 0 : taxationRequiredAccountFields.length) || 0) > 0,
|
|
19755
|
+
queryFn: function () { return (quote === null || quote === void 0 ? void 0 : quote.accountId) && getAccount({ id: quote.accountId, token: token, apiHost: apiHost }); },
|
|
19756
|
+
enabled: Boolean(quote === null || quote === void 0 ? void 0 : quote.accountId) && ((taxationRequiredAccountFields === null || taxationRequiredAccountFields === void 0 ? void 0 : taxationRequiredAccountFields.length) || 0) > 0,
|
|
19767
19757
|
}), account = _g.data, isLoadingAccount = _g.isLoading;
|
|
19768
19758
|
useQuery({
|
|
19769
|
-
queryKey: queryKeyFactory.createQuoteTaxCalculateKey(quote === null || quote === void 0 ? void 0 : quote.id, token),
|
|
19759
|
+
queryKey: queryKeyFactory.createQuoteTaxCalculateKey({ id: quote === null || quote === void 0 ? void 0 : quote.id, token: token }),
|
|
19770
19760
|
queryFn: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
19771
|
-
var updatedQuote;
|
|
19761
|
+
var updatedQuote, quoteKey, calculatedPricesKey;
|
|
19772
19762
|
return __generator(this, function (_a) {
|
|
19773
19763
|
switch (_a.label) {
|
|
19774
19764
|
case 0:
|
|
@@ -19781,8 +19771,14 @@ var Checkout = function (_a) {
|
|
|
19781
19771
|
case 1:
|
|
19782
19772
|
updatedQuote = _a.sent();
|
|
19783
19773
|
if (updatedQuote) {
|
|
19784
|
-
|
|
19785
|
-
|
|
19774
|
+
quoteKey = queryKeyFactory.createObjectKey({ objectName: "editingQuote", id: updatedQuote.id, token: token });
|
|
19775
|
+
calculatedPricesKey = queryKeyFactory.calculatedPricesKey({
|
|
19776
|
+
quantity: quantity,
|
|
19777
|
+
priceListId: selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id,
|
|
19778
|
+
token: token,
|
|
19779
|
+
});
|
|
19780
|
+
queryClient.setQueryData(quoteKey, updatedQuote);
|
|
19781
|
+
queryClient.setQueryData(calculatedPricesKey, updatedQuote);
|
|
19786
19782
|
}
|
|
19787
19783
|
_a.label = 2;
|
|
19788
19784
|
case 2: return [2 /*return*/, {}];
|
|
@@ -19946,7 +19942,7 @@ function Signup(_a) {
|
|
|
19946
19942
|
var _h = useState(false), proceedingToPayment = _h[0], setProceedingToPayment = _h[1];
|
|
19947
19943
|
var _j = useState(false), purchaseSucceeded = _j[0], setPurchaseSucceeded = _j[1];
|
|
19948
19944
|
var _k = useState(undefined), paymentMethodGraphQLClient = _k[0], setPaymentMethodGraphQLClient = _k[1];
|
|
19949
|
-
var paymentMethod = usePaymentMethod(paymentMethodGraphQLClient || graphQLClient
|
|
19945
|
+
var paymentMethod = usePaymentMethod(paymentMethodGraphQLClient || graphQLClient).data;
|
|
19950
19946
|
var queryClient = useQueryClient();
|
|
19951
19947
|
// Queries
|
|
19952
19948
|
var priceListData = useQuery({
|
|
@@ -20658,7 +20654,7 @@ function BillingDetailsSection(_a) {
|
|
|
20658
20654
|
var showSuccessNotification = useSuccessNotification();
|
|
20659
20655
|
// Queries
|
|
20660
20656
|
var _d = useQuery({
|
|
20661
|
-
queryKey: QueryKeyFactory.default.billingDetailsKey(entityId, token),
|
|
20657
|
+
queryKey: QueryKeyFactory.default.billingDetailsKey({ entityId: entityId, token: token }),
|
|
20662
20658
|
queryFn: function () { return getBillingDetails({ token: token, apiHost: apiHost }); },
|
|
20663
20659
|
}), billingDetails = _d.data, isLoadingBillingDetails = _d.isLoading;
|
|
20664
20660
|
var _e = useMutation({
|
|
@@ -20682,7 +20678,7 @@ function BillingDetailsSection(_a) {
|
|
|
20682
20678
|
})];
|
|
20683
20679
|
case 1:
|
|
20684
20680
|
updatedBillingDetails = _a.sent();
|
|
20685
|
-
queryClient.setQueryData(QueryKeyFactory.default.billingDetailsKey(entityId, token), function (old) {
|
|
20681
|
+
queryClient.setQueryData(QueryKeyFactory.default.billingDetailsKey({ entityId: entityId, token: token }), function (old) {
|
|
20686
20682
|
return __assign(__assign({}, old), updatedBillingDetails.billingDetails);
|
|
20687
20683
|
});
|
|
20688
20684
|
return [2 /*return*/, updatedBillingDetails];
|
|
@@ -20692,7 +20688,7 @@ function BillingDetailsSection(_a) {
|
|
|
20692
20688
|
onSuccess: function () {
|
|
20693
20689
|
showSuccessNotification("Your account details have been saved");
|
|
20694
20690
|
queryClient.invalidateQueries({
|
|
20695
|
-
queryKey: QueryKeyFactory.default.taxationRequiredAccountFieldsKey(entityId, token),
|
|
20691
|
+
queryKey: QueryKeyFactory.default.taxationRequiredAccountFieldsKey({ entityId: entityId, token: token }),
|
|
20696
20692
|
});
|
|
20697
20693
|
},
|
|
20698
20694
|
}), updateBillingDetails = _e.mutate, isUpdatingBillingDetails = _e.isPending;
|
|
@@ -20773,9 +20769,7 @@ function BillingDetailsSection(_a) {
|
|
|
20773
20769
|
});
|
|
20774
20770
|
}); };
|
|
20775
20771
|
var filteredCountryList = useMemo(function () {
|
|
20776
|
-
return countryListFilter
|
|
20777
|
-
? Lists.COUNTRY_LIST.filter(countryListFilter)
|
|
20778
|
-
: Lists.COUNTRY_LIST;
|
|
20772
|
+
return countryListFilter ? Lists.COUNTRY_LIST.filter(countryListFilter) : Lists.COUNTRY_LIST;
|
|
20779
20773
|
}, [countryListFilter]);
|
|
20780
20774
|
return (jsxs("div", __assign({ className: "".concat(isMobile || hidePaymentMethodForm ? "w-full" : "w-1/2", " px-4") }, { children: [jsx(Skeleton, __assign({ loading: isLoadingBillingDetails }, { children: jsxs(Form, __assign({ className: "flex flex-col gap-2", form: form, layout: "vertical", disabled: isUpdatingBillingDetails, autoComplete: "off" }, { children: [jsx(Form.Item, __assign({ label: "Account name", name: "name", rules: [{ required: true, message: "Account name is required" }] }, { children: jsx(Input, {}) })), jsx(Form.Item, __assign({ label: "Street address", name: "billingStreet", rules: [{ required: true, message: "Street address is required" }] }, { children: jsx(Input, {}) })), jsxs("div", __assign({ className: "flex gap-4" }, { children: [jsx(Form.Item, __assign({ label: "City", name: "billingCity", rules: [{ required: true, message: "City is required" }], className: "flex-1" }, { children: jsx(Input, {}) })), jsx(Form.Item, __assign({ label: "Zipcode", name: "billingZip", rules: [{ required: true, message: "Zipcode is required" }], className: "flex-1" }, { children: jsx(Input, {}) }))] })), jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col pb-2" : "flex-row", " gap-4") }, { children: [jsx(Form.Item, __assign({ label: "State", name: "billingState", className: "flex-1", rules: [
|
|
20781
20775
|
{
|
|
@@ -20783,12 +20777,8 @@ function BillingDetailsSection(_a) {
|
|
|
20783
20777
|
},
|
|
20784
20778
|
] }, { children: jsx(Input, {}) })), jsx(Form.Item, __assign({ label: "Country", name: "billingCountry", className: "flex-1", rules: [{ required: true, message: "Country is required" }] }, { children: jsx(Select, { options: filteredCountryList, placeholder: "Select a country", showSearch: true, filterOption: function (input, option) {
|
|
20785
20779
|
var _a, _b;
|
|
20786
|
-
return ((_a = option === null || option === void 0 ? void 0 : option.label) !== null && _a !== void 0 ? _a : "")
|
|
20787
|
-
.toLowerCase()
|
|
20788
|
-
.includes(input.toLowerCase()) ||
|
|
20789
|
-
((_b = option === null || option === void 0 ? void 0 : option.value) !== null && _b !== void 0 ? _b : "")
|
|
20790
|
-
.toLowerCase()
|
|
20791
|
-
.includes(input.toLowerCase());
|
|
20780
|
+
return ((_a = option === null || option === void 0 ? void 0 : option.label) !== null && _a !== void 0 ? _a : "").toLowerCase().includes(input.toLowerCase()) ||
|
|
20781
|
+
((_b = option === null || option === void 0 ? void 0 : option.value) !== null && _b !== void 0 ? _b : "").toLowerCase().includes(input.toLowerCase());
|
|
20792
20782
|
} }) }))] })), jsx(Form.Item, __assign({ label: "Email", name: "billingContactEmail", rules: [
|
|
20793
20783
|
{
|
|
20794
20784
|
required: true,
|
|
@@ -5,7 +5,7 @@ import { GraphQLClient } from "graphql-request";
|
|
|
5
5
|
export type BunnyContextValues = {
|
|
6
6
|
apiHost: string;
|
|
7
7
|
graphQLClient: GraphQLClient;
|
|
8
|
-
token
|
|
8
|
+
token: string;
|
|
9
9
|
displayPayButtonNameAnyways?: boolean;
|
|
10
10
|
darkMode?: boolean;
|
|
11
11
|
onTokenExpired?: () => void;
|
|
@@ -16,7 +16,7 @@ declare function BunnyProvider({ children, darkMode, queryClient, apiHost, token
|
|
|
16
16
|
darkMode?: boolean;
|
|
17
17
|
queryClient?: QueryClient;
|
|
18
18
|
apiHost: string;
|
|
19
|
-
token
|
|
19
|
+
token: string;
|
|
20
20
|
onTokenExpired?: () => void;
|
|
21
21
|
configProviderProps?: ThemeConfig | undefined;
|
|
22
22
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { FormattedInvoice, PluginData, Quote } from "@bunnyapp/common";
|
|
3
2
|
import { GraphQLClient } from "graphql-request";
|
|
4
3
|
export declare const PaymentForm: ({ entityId, invoice, onFail, onPaymentSuccess, quote, accountId, onSavePaymentMethod, overrideToken, graphQLClient, customCheckoutFunction, currencyId: currencyIdFromProps, customPaymentForms, useAllPaymentPlugins, }: {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
2
|
import Quote from "./Quote";
|
|
4
3
|
declare const meta: Meta<typeof Quote>;
|
|
@@ -18,16 +17,16 @@ export declare const Default: import("@storybook/core/csf").StoryAnnotations<imp
|
|
|
18
17
|
onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
|
|
19
18
|
onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
|
|
20
19
|
}, {
|
|
21
|
-
backButtonName?: string | undefined;
|
|
22
|
-
onBackButtonClick?: (() => void) | undefined;
|
|
23
|
-
shadow?: import("../../types/shadowType").ShadowType | undefined;
|
|
24
|
-
hideDownloadButton?: boolean | undefined;
|
|
25
|
-
id?: string | undefined;
|
|
26
20
|
className?: string | undefined;
|
|
27
21
|
entityId?: string | undefined;
|
|
28
|
-
|
|
22
|
+
shadow?: import("../../types/shadowType").ShadowType | undefined;
|
|
23
|
+
id?: string | undefined;
|
|
29
24
|
invoiceQuoteViewComponent?: import("react").ReactNode;
|
|
25
|
+
backButtonName?: string | undefined;
|
|
26
|
+
onBackButtonClick?: (() => void) | undefined;
|
|
30
27
|
onInvoiceDownloadError?: (() => void) | undefined;
|
|
28
|
+
onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
|
|
29
|
+
hideDownloadButton?: boolean | undefined;
|
|
31
30
|
onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
|
|
32
31
|
onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
|
|
33
32
|
}>;
|
|
@@ -45,16 +44,16 @@ export declare const NoShadow: import("@storybook/core/csf").StoryAnnotations<im
|
|
|
45
44
|
onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
|
|
46
45
|
onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
|
|
47
46
|
}, {
|
|
48
|
-
backButtonName?: string | undefined;
|
|
49
|
-
onBackButtonClick?: (() => void) | undefined;
|
|
50
|
-
shadow?: import("../../types/shadowType").ShadowType | undefined;
|
|
51
|
-
hideDownloadButton?: boolean | undefined;
|
|
52
|
-
id?: string | undefined;
|
|
53
47
|
className?: string | undefined;
|
|
54
48
|
entityId?: string | undefined;
|
|
55
|
-
|
|
49
|
+
shadow?: import("../../types/shadowType").ShadowType | undefined;
|
|
50
|
+
id?: string | undefined;
|
|
56
51
|
invoiceQuoteViewComponent?: import("react").ReactNode;
|
|
52
|
+
backButtonName?: string | undefined;
|
|
53
|
+
onBackButtonClick?: (() => void) | undefined;
|
|
57
54
|
onInvoiceDownloadError?: (() => void) | undefined;
|
|
55
|
+
onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
|
|
56
|
+
hideDownloadButton?: boolean | undefined;
|
|
58
57
|
onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
|
|
59
58
|
onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
|
|
60
59
|
}>;
|
|
@@ -72,16 +71,16 @@ export declare const Mobile: import("@storybook/core/csf").StoryAnnotations<impo
|
|
|
72
71
|
onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
|
|
73
72
|
onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
|
|
74
73
|
}, {
|
|
75
|
-
backButtonName?: string | undefined;
|
|
76
|
-
onBackButtonClick?: (() => void) | undefined;
|
|
77
|
-
shadow?: import("../../types/shadowType").ShadowType | undefined;
|
|
78
|
-
hideDownloadButton?: boolean | undefined;
|
|
79
|
-
id?: string | undefined;
|
|
80
74
|
className?: string | undefined;
|
|
81
75
|
entityId?: string | undefined;
|
|
82
|
-
|
|
76
|
+
shadow?: import("../../types/shadowType").ShadowType | undefined;
|
|
77
|
+
id?: string | undefined;
|
|
83
78
|
invoiceQuoteViewComponent?: import("react").ReactNode;
|
|
79
|
+
backButtonName?: string | undefined;
|
|
80
|
+
onBackButtonClick?: (() => void) | undefined;
|
|
84
81
|
onInvoiceDownloadError?: (() => void) | undefined;
|
|
82
|
+
onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
|
|
83
|
+
hideDownloadButton?: boolean | undefined;
|
|
85
84
|
onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
|
|
86
85
|
onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
|
|
87
86
|
}>;
|
|
@@ -99,16 +98,16 @@ export declare const CustomClassName: import("@storybook/core/csf").StoryAnnotat
|
|
|
99
98
|
onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
|
|
100
99
|
onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
|
|
101
100
|
}, {
|
|
102
|
-
backButtonName?: string | undefined;
|
|
103
|
-
onBackButtonClick?: (() => void) | undefined;
|
|
104
|
-
shadow?: import("../../types/shadowType").ShadowType | undefined;
|
|
105
|
-
hideDownloadButton?: boolean | undefined;
|
|
106
|
-
id?: string | undefined;
|
|
107
101
|
className?: string | undefined;
|
|
108
102
|
entityId?: string | undefined;
|
|
109
|
-
|
|
103
|
+
shadow?: import("../../types/shadowType").ShadowType | undefined;
|
|
104
|
+
id?: string | undefined;
|
|
110
105
|
invoiceQuoteViewComponent?: import("react").ReactNode;
|
|
106
|
+
backButtonName?: string | undefined;
|
|
107
|
+
onBackButtonClick?: (() => void) | undefined;
|
|
111
108
|
onInvoiceDownloadError?: (() => void) | undefined;
|
|
109
|
+
onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
|
|
110
|
+
hideDownloadButton?: boolean | undefined;
|
|
112
111
|
onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
|
|
113
112
|
onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
|
|
114
113
|
}>;
|
|
@@ -129,16 +128,16 @@ export declare const DarkMode: import("@storybook/core/csf").StoryAnnotations<im
|
|
|
129
128
|
onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
|
|
130
129
|
onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
|
|
131
130
|
}, {
|
|
132
|
-
backButtonName?: string | undefined;
|
|
133
|
-
onBackButtonClick?: (() => void) | undefined;
|
|
134
|
-
shadow?: import("../../types/shadowType").ShadowType | undefined;
|
|
135
|
-
hideDownloadButton?: boolean | undefined;
|
|
136
|
-
id?: string | undefined;
|
|
137
131
|
className?: string | undefined;
|
|
138
132
|
entityId?: string | undefined;
|
|
139
|
-
|
|
133
|
+
shadow?: import("../../types/shadowType").ShadowType | undefined;
|
|
134
|
+
id?: string | undefined;
|
|
140
135
|
invoiceQuoteViewComponent?: import("react").ReactNode;
|
|
136
|
+
backButtonName?: string | undefined;
|
|
137
|
+
onBackButtonClick?: (() => void) | undefined;
|
|
141
138
|
onInvoiceDownloadError?: (() => void) | undefined;
|
|
139
|
+
onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
|
|
140
|
+
hideDownloadButton?: boolean | undefined;
|
|
142
141
|
onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
|
|
143
142
|
onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
|
|
144
143
|
}>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { Subscription } from "@bunnyapp/common";
|
|
3
2
|
import "../../styles/index.less";
|
|
4
3
|
export type EditingQuoteDataType = {
|
|
@@ -15,7 +14,7 @@ declare const Subscriptions: ({ className, companyName, entityId, hideExpired, o
|
|
|
15
14
|
onSubscriptionsLoaded?: ((subscriptions: Subscription[]) => void) | undefined;
|
|
16
15
|
styles?: {
|
|
17
16
|
gap?: number | undefined;
|
|
18
|
-
shadow?: "none" | "
|
|
17
|
+
shadow?: "none" | "sm" | "md" | "lg" | undefined;
|
|
19
18
|
subscriptionProductNameStyle?: import("react").CSSProperties | undefined;
|
|
20
19
|
} | undefined;
|
|
21
20
|
noSubscriptionsComponent?: React.ReactNode;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { GraphQLClient } from "graphql-request";
|
|
2
|
-
export declare const usePaymentMethod: (
|
|
2
|
+
export declare const usePaymentMethod: ({ accountId, entityId, graphQLClient, token, }: {
|
|
3
|
+
accountId?: string | undefined;
|
|
4
|
+
entityId?: string | undefined;
|
|
5
|
+
graphQLClient: GraphQLClient;
|
|
6
|
+
token: string;
|
|
7
|
+
}) => {
|
|
3
8
|
data: any;
|
|
4
9
|
isLoading: boolean;
|
|
5
10
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
declare const usePlugins: ({ entityId, apiHost, token
|
|
1
|
+
declare const usePlugins: ({ entityId, apiHost, token }: {
|
|
2
2
|
entityId: string;
|
|
3
3
|
apiHost: string;
|
|
4
|
-
token
|
|
4
|
+
token: string;
|
|
5
5
|
}) => import("@tanstack/react-query/build/legacy/types").UseQueryResult<any, Error>;
|
|
6
6
|
export default usePlugins;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare function useToken(): string
|
|
1
|
+
declare function useToken(): string;
|
|
2
2
|
export default useToken;
|
package/dist/index.d.ts
CHANGED
|
@@ -144,7 +144,7 @@ declare function BunnyProvider({ children, darkMode, queryClient, apiHost, token
|
|
|
144
144
|
darkMode?: boolean;
|
|
145
145
|
queryClient?: QueryClient;
|
|
146
146
|
apiHost: string;
|
|
147
|
-
token
|
|
147
|
+
token: string;
|
|
148
148
|
onTokenExpired?: () => void;
|
|
149
149
|
configProviderProps?: ThemeConfig | undefined;
|
|
150
150
|
}): react_jsx_runtime.JSX.Element;
|
|
@@ -207,7 +207,7 @@ declare const Subscriptions: ({ className, companyName, entityId, hideExpired, o
|
|
|
207
207
|
onSubscriptionsLoaded?: ((subscriptions: Subscription[]) => void) | undefined;
|
|
208
208
|
styles?: {
|
|
209
209
|
gap?: number | undefined;
|
|
210
|
-
shadow?: "none" | "
|
|
210
|
+
shadow?: "none" | "sm" | "md" | "lg" | undefined;
|
|
211
211
|
subscriptionProductNameStyle?: react.CSSProperties | undefined;
|
|
212
212
|
} | undefined;
|
|
213
213
|
noSubscriptionsComponent?: React.ReactNode;
|
|
@@ -226,7 +226,12 @@ declare const BillingDetails: ({ entityId, isCardEnabled, shadow, className, hid
|
|
|
226
226
|
}) => boolean) | undefined;
|
|
227
227
|
}) => react_jsx_runtime.JSX.Element;
|
|
228
228
|
|
|
229
|
-
declare const usePaymentMethod: (
|
|
229
|
+
declare const usePaymentMethod: ({ accountId, entityId, graphQLClient, token, }: {
|
|
230
|
+
accountId?: string | undefined;
|
|
231
|
+
entityId?: string | undefined;
|
|
232
|
+
graphQLClient: GraphQLClient;
|
|
233
|
+
token: string;
|
|
234
|
+
}) => {
|
|
230
235
|
data: any;
|
|
231
236
|
isLoading: boolean;
|
|
232
237
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bunnyapp/components",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.40",
|
|
4
4
|
"description": "Components from the Bunny portal to embed Bunny UI functionality into your application.",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"vite": "^6.2.1"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
|
-
"@bunnyapp/common": "^1.0.
|
|
66
|
+
"@bunnyapp/common": "^1.0.47",
|
|
67
67
|
"@fortawesome/fontawesome-svg-core": "^6.7.2",
|
|
68
68
|
"@fortawesome/free-brands-svg-icons": "^6.7.2",
|
|
69
69
|
"@fortawesome/free-regular-svg-icons": "^6.7.2",
|