@bunnyapp/components 1.0.40 → 1.0.41
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/README.md +3 -97
- package/dist/cjs/index.js +39 -40
- package/dist/cjs/src/components/Card.d.ts +1 -0
- package/dist/cjs/src/components/PaymentForm/PaymentForm.d.ts +1 -0
- package/dist/cjs/src/components/PaymentForm/PaymentMethodDetails.d.ts +1 -0
- package/dist/cjs/src/components/PaymentForm/useRemovePaymentMethod.d.ts +1 -1
- package/dist/cjs/src/components/Quote/Quote.stories.d.ts +31 -30
- package/dist/cjs/src/components/Subscriptions/Subscriptions.d.ts +2 -1
- package/dist/cjs/src/hooks/quotes/useSendAcceptQuote.d.ts +2 -1
- package/dist/cjs/src/hooks/usePaymentPlugins.d.ts +1 -1
- package/dist/cjs/src/hooks/useSigningPlugins.d.ts +1 -1
- package/dist/esm/index.js +39 -40
- package/dist/esm/src/components/Card.d.ts +1 -0
- package/dist/esm/src/components/PaymentForm/PaymentForm.d.ts +1 -0
- package/dist/esm/src/components/PaymentForm/PaymentMethodDetails.d.ts +1 -0
- package/dist/esm/src/components/PaymentForm/useRemovePaymentMethod.d.ts +1 -1
- package/dist/esm/src/components/Quote/Quote.stories.d.ts +31 -30
- package/dist/esm/src/components/Subscriptions/Subscriptions.d.ts +2 -1
- package/dist/esm/src/hooks/quotes/useSendAcceptQuote.d.ts +2 -1
- package/dist/esm/src/hooks/usePaymentPlugins.d.ts +1 -1
- package/dist/esm/src/hooks/useSigningPlugins.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
# ℹ️ About
|
|
2
2
|
|
|
3
|
-
This package provides components from
|
|
3
|
+
This package provides components from Bunny to integrate Bunny UI functionality into your application. Both CJS and ESM builds are provided.
|
|
4
4
|
|
|
5
|
-
#
|
|
5
|
+
# 📖 Documentation
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
- Quote
|
|
9
|
-
- Quotes
|
|
10
|
-
- PaymentMethod
|
|
11
|
-
- BillingDetails
|
|
12
|
-
- Transactions
|
|
13
|
-
- Subscriptions (view-only mode)
|
|
14
|
-
- BillingDetails
|
|
15
|
-
- Signup
|
|
7
|
+
Documentation on the usage of the components can be found [here](https://docs.bunny.com/developer/bunny-components/bunny-components).
|
|
16
8
|
|
|
17
9
|
# 📦 Install
|
|
18
10
|
|
|
@@ -34,92 +26,6 @@ bun add @bunnyapp/components
|
|
|
34
26
|
|
|
35
27
|
Ensure all peer dependencies in the package.json are installed.
|
|
36
28
|
|
|
37
|
-
# ⚙️ Configuration
|
|
38
|
-
|
|
39
|
-
1. Whitelist your subdomain in Bunny (e.g., `localhost` for development, `https://[company-name].bunny.com` for production).
|
|
40
|
-
|
|
41
|
-
- 
|
|
42
|
-
|
|
43
|
-
2. Get an access token:
|
|
44
|
-
- **API Token**: Use an API token when you want all of your Bunny data to be accessible to the components. [Create an API Client](https://docs.bunny.com/developer/getting-started/api#create-an-api-client).
|
|
45
|
-
- **Portal Session Token**: Use a portal session token when you only want data for a single Bunny account to be accessible to the components. [Create a Portal Session](https://docs.bunny.com/developer/integrate/enable-upgrades-and-payments/standalone-customer-portal). The account is baked into the portal session token, therefore there is no accountId parameter in most Bunny components.
|
|
46
|
-
|
|
47
|
-
# 🔨 Usage
|
|
48
|
-
|
|
49
|
-
In order to use any of the components, you must wrap them in the BunnyProvider component.
|
|
50
|
-
The BunnyProvider component provides all the state management and context for the components
|
|
51
|
-
and keeps state up to date between all the components.
|
|
52
|
-
|
|
53
|
-
We recommend placing the BunnyProvider component at the root of your application so that all Bunny components will be children of the BunnyProvider component.
|
|
54
|
-
|
|
55
|
-
The below example shows how to use the BunnyProvider component with the Invoice and PaymentMethod components.
|
|
56
|
-
Here the data such as the saved payment method will be updated between the components.
|
|
57
|
-
|
|
58
|
-
```tsx
|
|
59
|
-
import { BunnyProvider, Invoice, PaymentMethod } from "@bunnyapp/components";
|
|
60
|
-
|
|
61
|
-
function App() {
|
|
62
|
-
return (
|
|
63
|
-
<BunnyProvider token={token} apiHost={apiHost}>
|
|
64
|
-
<Invoice id="12345" entityId="1" />
|
|
65
|
-
<PaymentMethod entityId="1" />
|
|
66
|
-
</BunnyProvider>
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
In this example, each component has their own BunnyProvider. This is not recommended as it will create a mismatch in the state
|
|
72
|
-
between each of the components. ie if a payment method is saved in the Invoice component, it will not automatically be available in the PaymentMethod component.
|
|
73
|
-
|
|
74
|
-
```tsx
|
|
75
|
-
import { BunnyProvider, Invoice, PaymentMethod } from "@bunnyapp/components";
|
|
76
|
-
|
|
77
|
-
function App() {
|
|
78
|
-
return (
|
|
79
|
-
<div>
|
|
80
|
-
<BunnyProvider token={token} apiHost={apiHost}>
|
|
81
|
-
<Invoice id="12345" entityId="1" />
|
|
82
|
-
</BunnyProvider>
|
|
83
|
-
{/* Other components */}
|
|
84
|
-
<BunnyProvider token={token} apiHost={apiHost}>
|
|
85
|
-
<PaymentMethod entityId="1" />
|
|
86
|
-
</BunnyProvider>
|
|
87
|
-
</div>
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
### Using Signup
|
|
93
|
-
|
|
94
|
-
The Signup component allows potential customers to sign up for a (paid) subscription and create an account that you can manage within Bunny.
|
|
95
|
-
|
|
96
|
-
Because the Signup component will be exposed to potentially anyone on the internet, it is very important that you use a token with **ONLY** the `signup:read` and `signup:write` scopes. Providing more scopes will leave your data exposed and could lead to security issues. 
|
|
97
|
-
|
|
98
|
-
Because Signup must use a special token, it should have its own BunnyProvider that is not a child of any other BunnyProvider.
|
|
99
|
-
|
|
100
|
-
```tsx
|
|
101
|
-
import { BunnyProvider, Signup } from "@bunnyapp/components";
|
|
102
|
-
|
|
103
|
-
function App() {
|
|
104
|
-
return (
|
|
105
|
-
<BunnyProvider token={tokenWithSignupScope} apiHost={apiHost}>
|
|
106
|
-
<Signup
|
|
107
|
-
companyName="Acme"
|
|
108
|
-
entityId="1"
|
|
109
|
-
priceListCode="business-monthly"
|
|
110
|
-
returnUrl="https://acme.com/dashboard" // Optional, the customer will be led to this url after signing up
|
|
111
|
-
/>
|
|
112
|
-
</BunnyProvider>
|
|
113
|
-
);
|
|
114
|
-
}
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
## Parameters
|
|
118
|
-
|
|
119
|
-
- `token`: Token that allows access to the Bunny API. Generate this using `portalSessionCreate` from [docs](https://docs.bunny.com/developer/api-reference/mutations/portalsessioncreate)
|
|
120
|
-
- `apiHost`: The API host the components will make requests to. e.g. `https://acme.bunny.com`
|
|
121
|
-
- `entityId`: This is the id of the Bunny entity that you want to make requests to. An entity is different from an account. [Entity docs](https://docs.bunny.com/guide/tour/entities)
|
|
122
|
-
|
|
123
29
|
## Development
|
|
124
30
|
|
|
125
31
|
To run the development server, run `npm run dev`.
|
package/dist/cjs/index.js
CHANGED
|
@@ -1322,7 +1322,7 @@ function useRemovePaymentMethod(paymentPlugins, apiHost, entityId, token, accoun
|
|
|
1322
1322
|
})
|
|
1323
1323
|
.then(function () {
|
|
1324
1324
|
showSuccessNotification("Payment method was removed", "Success");
|
|
1325
|
-
queryClient.setQueryData(common.QueryKeyFactory.default.accountPaymentMethodKey(entityId, token, accountId), null);
|
|
1325
|
+
queryClient.setQueryData(common.QueryKeyFactory.default.accountPaymentMethodKey({ entityId: entityId, token: token, accountId: accountId }), null);
|
|
1326
1326
|
})
|
|
1327
1327
|
.catch(function (error) {
|
|
1328
1328
|
showErrorNotification(error.message, "Error removing payment method");
|
|
@@ -1345,14 +1345,17 @@ var PaymentForm = function (_a) {
|
|
|
1345
1345
|
var _d = react.useState(), selectedPaymentMethod = _d[0], setSelectedPaymentMethod = _d[1];
|
|
1346
1346
|
var _e = react.useState(false), showPaymentMethodForm = _e[0], setShowPaymentMethodForm = _e[1];
|
|
1347
1347
|
var paying = !!(quote || invoice);
|
|
1348
|
-
var currencyId = (_b = ((quote === null || quote === void 0 ? void 0 : quote.currencyId) ||
|
|
1349
|
-
(invoice === null || invoice === void 0 ? void 0 : invoice.currencyId) ||
|
|
1350
|
-
currencyIdFromProps)) === null || _b === void 0 ? void 0 : _b.toLowerCase();
|
|
1348
|
+
var currencyId = (_b = ((quote === null || quote === void 0 ? void 0 : quote.currencyId) || (invoice === null || invoice === void 0 ? void 0 : invoice.currencyId) || currencyIdFromProps)) === null || _b === void 0 ? void 0 : _b.toLowerCase();
|
|
1351
1349
|
// Hooks
|
|
1352
1350
|
var apiHost = react.useContext(BunnyContext).apiHost;
|
|
1353
1351
|
var tokenFromContexts = useToken();
|
|
1354
1352
|
var token = overrideToken || tokenFromContexts;
|
|
1355
|
-
var _f = usePaymentMethod(
|
|
1353
|
+
var _f = usePaymentMethod({
|
|
1354
|
+
accountId: accountId,
|
|
1355
|
+
entityId: entityId,
|
|
1356
|
+
graphQLClient: graphQLClient,
|
|
1357
|
+
token: token,
|
|
1358
|
+
}), storedPaymentMethod = _f.data, isPaymentMethodLoading = _f.isLoading;
|
|
1356
1359
|
var isPaymentMethodFetched = storedPaymentMethod !== undefined;
|
|
1357
1360
|
var _g = usePaymentPlugins({ entityId: entityId, apiHost: apiHost, token: token }), allPaymentMethodAllowedPlugins = _g.paymentMethodAllowedPlugins, allPaymentPlugins = _g.paymentPlugins, arePluginsFetched = _g.isFetched;
|
|
1358
1361
|
var paymentMethodAllowedPlugins = react.useMemo(function () {
|
|
@@ -1365,9 +1368,7 @@ var PaymentForm = function (_a) {
|
|
|
1365
1368
|
var queryClient = reactQuery.useQueryClient();
|
|
1366
1369
|
// Set default plugin
|
|
1367
1370
|
react.useEffect(function () {
|
|
1368
|
-
if (!arePluginsFetched ||
|
|
1369
|
-
!isPaymentMethodFetched ||
|
|
1370
|
-
selectedPaymentMethod) {
|
|
1371
|
+
if (!arePluginsFetched || !isPaymentMethodFetched || selectedPaymentMethod) {
|
|
1371
1372
|
return;
|
|
1372
1373
|
}
|
|
1373
1374
|
var pluginPaymentMethod = paymentMethodAllowedPlugins === null || paymentMethodAllowedPlugins === void 0 ? void 0 : paymentMethodAllowedPlugins.find(function (plugin) { var _a, _b, _c; return ((_a = plugin.id) === null || _a === void 0 ? void 0 : _a.toString()) === ((_c = (_b = storedPaymentMethod === null || storedPaymentMethod === void 0 ? void 0 : storedPaymentMethod.plugin) === null || _b === void 0 ? void 0 : _b.id) === null || _c === void 0 ? void 0 : _c.toString()); });
|
|
@@ -1396,7 +1397,7 @@ var PaymentForm = function (_a) {
|
|
|
1396
1397
|
};
|
|
1397
1398
|
var handleSavePaymentMethod = function () {
|
|
1398
1399
|
queryClient.invalidateQueries({
|
|
1399
|
-
queryKey: common.QueryKeyFactory.default.accountPaymentMethodKey(entityId, token
|
|
1400
|
+
queryKey: common.QueryKeyFactory.default.accountPaymentMethodKey({ accountId: accountId, entityId: entityId, token: token }),
|
|
1400
1401
|
});
|
|
1401
1402
|
onSavePaymentMethod === null || onSavePaymentMethod === void 0 ? void 0 : onSavePaymentMethod();
|
|
1402
1403
|
setShowPaymentMethodForm(false);
|
|
@@ -1441,7 +1442,7 @@ function Invoice(_a) {
|
|
|
1441
1442
|
function ActualInvoice() {
|
|
1442
1443
|
// Context
|
|
1443
1444
|
var queryClient = reactQuery.useQueryClient();
|
|
1444
|
-
var _a = react.useContext(InvoiceQuoteContext), id = _a.id, invoiceQuoteViewComponent = _a.invoiceQuoteViewComponent, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick, entityId = _a.entityId, className = _a.className;
|
|
1445
|
+
var _a = react.useContext(InvoiceQuoteContext), id = _a.id, invoiceQuoteViewComponent = _a.invoiceQuoteViewComponent, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick, entityId = _a.entityId, onPaymentSuccess = _a.onPaymentSuccess, className = _a.className;
|
|
1445
1446
|
var _b = react.useContext(BunnyContext), apiHost = _b.apiHost, onTokenExpired = _b.onTokenExpired, graphQLClient = _b.graphQLClient;
|
|
1446
1447
|
var _c = react.useContext(InvoiceQuoteContext), hideDownloadButton = _c.hideDownloadButton, onInvoiceLoaded = _c.onInvoiceLoaded;
|
|
1447
1448
|
var token = useToken();
|
|
@@ -1450,7 +1451,7 @@ function ActualInvoice() {
|
|
|
1450
1451
|
var handleAllErrorFormats = common.useAllErrorFormats(onTokenExpired);
|
|
1451
1452
|
// Queries
|
|
1452
1453
|
var formattedInvoice = reactQuery.useQuery({
|
|
1453
|
-
queryKey: common.QueryKeyFactory.default.createFormattedInvoiceKey(id, token),
|
|
1454
|
+
queryKey: common.QueryKeyFactory.default.createFormattedInvoiceKey({ id: id, token: token }),
|
|
1454
1455
|
queryFn: function () { return common.getFormattedInvoice({ id: id, token: token, apiHost: apiHost }); },
|
|
1455
1456
|
}).data;
|
|
1456
1457
|
// Derived state
|
|
@@ -1459,12 +1460,13 @@ function ActualInvoice() {
|
|
|
1459
1460
|
var isMobile = common.useIsMobile(isInvoicePayable ? common.BreakpointNumbers.lg : undefined);
|
|
1460
1461
|
var onSuccess = function () {
|
|
1461
1462
|
queryClient.invalidateQueries({
|
|
1462
|
-
queryKey: common.QueryKeyFactory.default.transactionsKey(token),
|
|
1463
|
+
queryKey: common.QueryKeyFactory.default.transactionsKey({ token: token }),
|
|
1463
1464
|
});
|
|
1464
1465
|
queryClient.invalidateQueries({
|
|
1465
|
-
queryKey: common.QueryKeyFactory.default.createFormattedInvoiceKey(id, token),
|
|
1466
|
+
queryKey: common.QueryKeyFactory.default.createFormattedInvoiceKey({ id: id, token: token }),
|
|
1466
1467
|
});
|
|
1467
1468
|
showSuccessNotification("Your invoice has been paid", "Payment successful");
|
|
1469
|
+
onPaymentSuccess === null || onPaymentSuccess === void 0 ? void 0 : onPaymentSuccess();
|
|
1468
1470
|
};
|
|
1469
1471
|
var onFail = function (error) {
|
|
1470
1472
|
handleAllErrorFormats(error.message);
|
|
@@ -1504,11 +1506,7 @@ var getFormattedQuote = function (_a) {
|
|
|
1504
1506
|
};
|
|
1505
1507
|
|
|
1506
1508
|
var filterSigningPlugins = function (plugins) {
|
|
1507
|
-
return plugins === null || plugins === void 0 ? void 0 : plugins.filter(function (plugin) {
|
|
1508
|
-
var _a, _b;
|
|
1509
|
-
return ((_a = plugin.type) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === "signing" &&
|
|
1510
|
-
((_b = plugin.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === "valid";
|
|
1511
|
-
});
|
|
1509
|
+
return plugins === null || plugins === void 0 ? void 0 : plugins.filter(function (plugin) { var _a, _b; return ((_a = plugin.type) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === "signing" && ((_b = plugin.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === "valid"; });
|
|
1512
1510
|
};
|
|
1513
1511
|
var useSigningPlugins = function (_a) {
|
|
1514
1512
|
var entityId = _a.entityId, apiHost = _a.apiHost, token = _a.token;
|
|
@@ -1569,10 +1567,10 @@ var useSendAcceptQuote = function (_a) {
|
|
|
1569
1567
|
});
|
|
1570
1568
|
client.on("sign", function (data) {
|
|
1571
1569
|
queryClient.refetchQueries({
|
|
1572
|
-
queryKey: common.QueryKeyFactory.default.createQuoteKey(quoteId, token),
|
|
1570
|
+
queryKey: common.QueryKeyFactory.default.createQuoteKey({ id: quoteId, token: token }),
|
|
1573
1571
|
});
|
|
1574
1572
|
queryClient.refetchQueries({
|
|
1575
|
-
queryKey: common.QueryKeyFactory.default.createQuoteKey(token),
|
|
1573
|
+
queryKey: common.QueryKeyFactory.default.createQuoteKey({ id: quoteId, token: token }),
|
|
1576
1574
|
});
|
|
1577
1575
|
});
|
|
1578
1576
|
// Open the DropboxSign modal
|
|
@@ -1593,10 +1591,10 @@ var useSendAcceptQuote = function (_a) {
|
|
|
1593
1591
|
else {
|
|
1594
1592
|
setAcceptBoxVisible(false);
|
|
1595
1593
|
queryClient.invalidateQueries({
|
|
1596
|
-
queryKey: common.QueryKeyFactory.default.createQuoteKey(quoteId, token),
|
|
1594
|
+
queryKey: common.QueryKeyFactory.default.createQuoteKey({ id: quoteId, token: token }),
|
|
1597
1595
|
});
|
|
1598
1596
|
queryClient.invalidateQueries({
|
|
1599
|
-
queryKey: common.QueryKeyFactory.default.createQuoteKey(token),
|
|
1597
|
+
queryKey: common.QueryKeyFactory.default.createQuoteKey({ id: quoteId, token: token }),
|
|
1600
1598
|
});
|
|
1601
1599
|
}
|
|
1602
1600
|
}, token);
|
|
@@ -1752,7 +1750,7 @@ function ActualQuote(_a) {
|
|
|
1752
1750
|
var _e = react.useContext(InvoiceQuoteContext), className = _e.className, id = _e.id, hideDownloadButton = _e.hideDownloadButton, onQuoteLoaded = _e.onQuoteLoaded;
|
|
1753
1751
|
// Queries
|
|
1754
1752
|
var _f = reactQuery.useQuery({
|
|
1755
|
-
queryKey: common.QueryKeyFactory.default.createQuoteKey(id, token),
|
|
1753
|
+
queryKey: common.QueryKeyFactory.default.createQuoteKey({ id: id, token: token }),
|
|
1756
1754
|
queryFn: function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1757
1755
|
var error_1;
|
|
1758
1756
|
return __generator(this, function (_a) {
|
|
@@ -1797,11 +1795,7 @@ function ActualQuote(_a) {
|
|
|
1797
1795
|
var isAccepted = formattedQuote.state === "ACCEPTED";
|
|
1798
1796
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex flex-col gap-4 ".concat(isMobile ? "w-full overflow-hidden" : "shadow-padding-xb", " ").concat(className) }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex flex-row justify-end items-center gap-4", id: "acceptance", style: {
|
|
1799
1797
|
color: entityBranding.secondaryColor,
|
|
1800
|
-
} }, { children: [isAccepted && formattedQuote.acceptedAt ? (jsxRuntime.jsx(Text$b, { children: "Quote was accepted by ".concat(formattedQuote.acceptedByName, " on ").concat(common.formatDate(formattedQuote.acceptedAt)) })) : null, (!isMobile || !isAccepted) && (jsxRuntime.jsxs("div", __assign({ className: isMobile
|
|
1801
|
-
? "flex w-full justify-end gap-2"
|
|
1802
|
-
: "flex items-center justify-end gap-2" }, { children: [!isMobile && !hideDownloadButton ? (jsxRuntime.jsx(antd.Button, __assign({ icon: jsxRuntime.jsx(icons.DownloadOutlined, {}), onClick: function () {
|
|
1803
|
-
return downloadFile(apiHost + "/api/pdf/quote", token);
|
|
1804
|
-
} }, { children: "Download" }))) : null, !isAccepted ? (jsxRuntime.jsx(antd.Button, __assign({ disabled: isExpired || isAccepting, onClick: function () { return startAcceptance(); }, type: "primary" }, { children: isExpired ? "Quote is expired" : "Accept quote" }))) : null] })))] })), jsxRuntime.jsx(InvoiceQuoteView, __assign({ html: formattedQuote.html }, { children: ((_c = (_b = formattedQuote.object) === null || _b === void 0 ? void 0 : _b.documents) === null || _c === void 0 ? void 0 : _c.length) > 0 ? (jsxRuntime.jsx("div", __assign({ className: "flex flex-col items-end" }, { children: formattedQuote.object.documents.map(function (doc, index) {
|
|
1798
|
+
} }, { children: [isAccepted && formattedQuote.acceptedAt ? (jsxRuntime.jsx(Text$b, { children: "Quote was accepted by ".concat(formattedQuote.acceptedByName, " on ").concat(common.formatDate(formattedQuote.acceptedAt)) })) : null, (!isMobile || !isAccepted) && (jsxRuntime.jsxs("div", __assign({ className: isMobile ? "flex w-full justify-end gap-2" : "flex items-center justify-end gap-2" }, { children: [!isMobile && !hideDownloadButton ? (jsxRuntime.jsx(antd.Button, __assign({ icon: jsxRuntime.jsx(icons.DownloadOutlined, {}), onClick: function () { return downloadFile(apiHost + "/api/pdf/quote", token); } }, { children: "Download" }))) : null, !isAccepted ? (jsxRuntime.jsx(antd.Button, __assign({ disabled: isExpired || isAccepting, onClick: function () { return startAcceptance(); }, type: "primary" }, { children: isExpired ? "Quote is expired" : "Accept quote" }))) : null] })))] })), jsxRuntime.jsx(InvoiceQuoteView, __assign({ html: formattedQuote.html }, { children: ((_c = (_b = formattedQuote.object) === null || _b === void 0 ? void 0 : _b.documents) === null || _c === void 0 ? void 0 : _c.length) > 0 ? (jsxRuntime.jsx("div", __assign({ className: "flex flex-col items-end" }, { children: formattedQuote.object.documents.map(function (doc, index) {
|
|
1805
1799
|
return (jsxRuntime.jsx(antd.Button, __assign({ download: doc.filename, href: doc.url, type: "link" }, { children: doc.filename }), index));
|
|
1806
1800
|
}) }))) : null }))] })), jsxRuntime.jsx(AcceptQuoteModal, { acceptBoxVisible: acceptBoxVisible, formattedQuote: formattedQuote, setAcceptBoxVisible: setAcceptBoxVisible, setIsAccepting: setIsAccepting, sendAccept: sendAccept }), jsxRuntime.jsx(PandadocPollingModal, { isVisible: pandadocPollingModalVisible, setVisible: setPandadocPollingModalVisible, id: id })] }));
|
|
1807
1801
|
}
|
|
@@ -19521,18 +19515,18 @@ var PaymentMethod = function (_a) {
|
|
|
19521
19515
|
var paymentPlugins = usePaymentPlugins({ entityId: entityId, apiHost: apiHost, token: token }).paymentPlugins;
|
|
19522
19516
|
var showSuccessNotification = common.useSuccessNotification();
|
|
19523
19517
|
var handleAllErrorFormats = common.useAllErrorFormats(onTokenExpired);
|
|
19524
|
-
var data = usePaymentMethod(graphQLClient).data;
|
|
19518
|
+
var data = usePaymentMethod({ entityId: entityId, graphQLClient: graphQLClient, token: token }).data;
|
|
19525
19519
|
var onClickRemove = useRemovePaymentMethod(paymentPlugins || [], apiHost, entityId, token);
|
|
19526
19520
|
// Queries
|
|
19527
19521
|
var billingDetails = reactQuery.useQuery({
|
|
19528
|
-
queryKey: common.QueryKeyFactory.default.billingDetailsKey(entityId, token),
|
|
19522
|
+
queryKey: common.QueryKeyFactory.default.billingDetailsKey({ entityId: entityId, token: token }),
|
|
19529
19523
|
queryFn: function () { return getBillingDetails({ token: token, apiHost: apiHost }); },
|
|
19530
19524
|
}).data;
|
|
19531
19525
|
// Local state
|
|
19532
19526
|
var _g = react.useState(false), showModal = _g[0], setShowModal = _g[1];
|
|
19533
19527
|
var onSuccess = function () {
|
|
19534
19528
|
queryClient.invalidateQueries({
|
|
19535
|
-
queryKey: common.QueryKeyFactory.default.accountPaymentMethodKey(entityId, token),
|
|
19529
|
+
queryKey: common.QueryKeyFactory.default.accountPaymentMethodKey({ entityId: entityId, token: token }),
|
|
19536
19530
|
});
|
|
19537
19531
|
setShowModal(false);
|
|
19538
19532
|
showSuccessNotification("Your payment method has been saved");
|
|
@@ -19970,7 +19964,11 @@ function Signup(_a) {
|
|
|
19970
19964
|
var _h = react.useState(false), proceedingToPayment = _h[0], setProceedingToPayment = _h[1];
|
|
19971
19965
|
var _j = react.useState(false), purchaseSucceeded = _j[0], setPurchaseSucceeded = _j[1];
|
|
19972
19966
|
var _k = react.useState(undefined), paymentMethodGraphQLClient = _k[0], setPaymentMethodGraphQLClient = _k[1];
|
|
19973
|
-
var paymentMethod = usePaymentMethod(
|
|
19967
|
+
var paymentMethod = usePaymentMethod({
|
|
19968
|
+
entityId: entityId,
|
|
19969
|
+
graphQLClient: paymentMethodGraphQLClient || graphQLClient,
|
|
19970
|
+
token: token,
|
|
19971
|
+
}).data;
|
|
19974
19972
|
var queryClient = reactQuery.useQueryClient();
|
|
19975
19973
|
// Queries
|
|
19976
19974
|
var priceListData = reactQuery.useQuery({
|
|
@@ -20005,7 +20003,7 @@ function Signup(_a) {
|
|
|
20005
20003
|
// We must invalidate the accountPaymentMethodKey query in order to clear payment methods from the provided api token,
|
|
20006
20004
|
// to instead use paymentMethods from portalSessionToken.
|
|
20007
20005
|
queryClient.invalidateQueries({
|
|
20008
|
-
queryKey: common.QueryKeyFactory.default.accountPaymentMethodKey(entityId, token),
|
|
20006
|
+
queryKey: common.QueryKeyFactory.default.accountPaymentMethodKey({ entityId: entityId, token: token }),
|
|
20009
20007
|
});
|
|
20010
20008
|
setProceedingToPayment(false);
|
|
20011
20009
|
setQuote(data.quote);
|
|
@@ -20064,9 +20062,7 @@ function Signup(_a) {
|
|
|
20064
20062
|
var children = _a.children, className = _a.className, style = _a.style;
|
|
20065
20063
|
return isCardEnabled ? (jsxRuntime.jsx(Card, __assign({ className: className, style: style }, { children: children }))) : (jsxRuntime.jsx("div", __assign({ className: className, style: style }, { children: children })));
|
|
20066
20064
|
};
|
|
20067
|
-
return (jsxRuntime.jsx(WrapperComponent, __assign({ className: "p-4 flex flex-col ".concat(shadow, " ").concat(className), style: style }, { children: purchaseSucceeded ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: (quote === null || quote === void 0 ? void 0 : quote.currencyId) !== undefined ? (jsxRuntime.jsx(PaymentSuccessDisplay, { amountPaid: (quote === null || quote === void 0 ? void 0 : quote.amountDue) || 0, className: "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" })) })) : (jsxRuntime.jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col" : "flex-row", " h-full w-full") }, { children: [jsxRuntime.jsx("div", __assign({ className: "flex flex-col ".concat(isMobile ? "items-center" : "w-1/2 items-center") }, { children: jsxRuntime.jsx(PriceListDisplay, { priceListData: priceListData, topNavImageUrl: topNavImageUrl }) })), jsxRuntime.jsx("div", __assign({ className: "".concat(isMobile ? "h-full" : "my-4") }, { children: jsxRuntime.jsx(antd.Divider, { className: "h-full", type: isMobile ? undefined : "vertical" }) })), jsxRuntime.jsx("div", __assign({ className: "flex ".concat(isMobile
|
|
20068
|
-
? "items-center justify-center my-12"
|
|
20069
|
-
: "w-1/2 items-center justify-center my-12") }, { children: jsxRuntime.jsx("div", __assign({ className: "".concat(isMobile ? "w-full" : "w-1/2") }, { children: jsxRuntime.jsx(PaymentForms, { entityId: entityId, quote: quote, handlePaymentSuccess: handlePaymentSuccess, handlePaymentFail: handlePaymentFail, handleSubmit: handleSubmit, proceedingToPayment: proceedingToPayment, accountId: accountId, overrideToken: portalSessionToken, customCheckoutFunction: accountSignupFunction }) })) }))] }))) })));
|
|
20065
|
+
return (jsxRuntime.jsx(WrapperComponent, __assign({ className: "p-4 flex flex-col ".concat(shadow, " ").concat(className), style: style }, { children: purchaseSucceeded ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: (quote === null || quote === void 0 ? void 0 : quote.currencyId) !== undefined ? (jsxRuntime.jsx(PaymentSuccessDisplay, { amountPaid: (quote === null || quote === void 0 ? void 0 : quote.amountDue) || 0, className: "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" })) })) : (jsxRuntime.jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col" : "flex-row", " h-full w-full") }, { children: [jsxRuntime.jsx("div", __assign({ className: "flex flex-col ".concat(isMobile ? "items-center" : "w-1/2 items-center") }, { children: jsxRuntime.jsx(PriceListDisplay, { priceListData: priceListData, topNavImageUrl: topNavImageUrl }) })), jsxRuntime.jsx("div", __assign({ className: "".concat(isMobile ? "h-full" : "my-4") }, { children: jsxRuntime.jsx(antd.Divider, { className: "h-full", type: isMobile ? undefined : "vertical" }) })), jsxRuntime.jsx("div", __assign({ className: "flex ".concat(isMobile ? "items-center justify-center my-12" : "w-1/2 items-center justify-center my-12") }, { children: jsxRuntime.jsx("div", __assign({ className: "".concat(isMobile ? "w-full" : "w-1/2") }, { children: jsxRuntime.jsx(PaymentForms, { entityId: entityId, quote: quote, handlePaymentSuccess: handlePaymentSuccess, handlePaymentFail: handlePaymentFail, handleSubmit: handleSubmit, proceedingToPayment: proceedingToPayment, accountId: accountId, overrideToken: portalSessionToken, customCheckoutFunction: accountSignupFunction }) })) }))] }))) })));
|
|
20070
20066
|
}
|
|
20071
20067
|
|
|
20072
20068
|
// WARNING: There is a preview button on APP that will need to be changed if this query is changed
|
|
@@ -20612,12 +20608,16 @@ var Subscriptions = function (_a) {
|
|
|
20612
20608
|
var token = useToken();
|
|
20613
20609
|
// Queries
|
|
20614
20610
|
var _d = reactQuery.useQuery({
|
|
20615
|
-
queryKey: common.QueryKeyFactory.default.createTableKey(
|
|
20611
|
+
queryKey: common.QueryKeyFactory.default.createTableKey({
|
|
20612
|
+
filterString: "entityId=".concat(entityId),
|
|
20613
|
+
pluralType: "subscriptions",
|
|
20614
|
+
token: token,
|
|
20615
|
+
}),
|
|
20616
20616
|
queryFn: function () { return getSubscriptions({ entityId: entityId, token: token, apiHost: apiHost }); },
|
|
20617
20617
|
enabled: Boolean(entityId),
|
|
20618
20618
|
}), rawSubscriptions = _d.data, subscriptionsAreLoading = _d.isLoading;
|
|
20619
20619
|
var _e = reactQuery.useQuery({
|
|
20620
|
-
queryKey: common.QueryKeyFactory.default.planChangeOptionsKey(token),
|
|
20620
|
+
queryKey: common.QueryKeyFactory.default.planChangeOptionsKey({ token: token }),
|
|
20621
20621
|
queryFn: function () { return getPlanChangeOptions({ token: token, apiHost: apiHost }); },
|
|
20622
20622
|
enabled: Boolean(onChangePlanClick),
|
|
20623
20623
|
}), planChangeOptions = _e.data, arePlanChangeOptionsLoading = _e.isLoading;
|
|
@@ -20627,8 +20627,7 @@ var Subscriptions = function (_a) {
|
|
|
20627
20627
|
if (subscriptions)
|
|
20628
20628
|
onSubscriptionsLoaded === null || onSubscriptionsLoaded === void 0 ? void 0 : onSubscriptionsLoaded(subscriptions);
|
|
20629
20629
|
}, [subscriptions]);
|
|
20630
|
-
if (subscriptionsAreLoading ||
|
|
20631
|
-
(Boolean(onChangePlanClick) ? arePlanChangeOptionsLoading : false))
|
|
20630
|
+
if (subscriptionsAreLoading || (Boolean(onChangePlanClick) ? arePlanChangeOptionsLoading : false))
|
|
20632
20631
|
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
20633
20632
|
return (jsxRuntime.jsx(SubscriptionsContext.Provider, __assign({ value: {
|
|
20634
20633
|
gap: gap,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { FormattedInvoice, PluginData, Quote } from "@bunnyapp/common";
|
|
2
3
|
import { GraphQLClient } from "graphql-request";
|
|
3
4
|
export declare const PaymentForm: ({ entityId, invoice, onFail, onPaymentSuccess, quote, accountId, onSavePaymentMethod, overrideToken, graphQLClient, customCheckoutFunction, currencyId: currencyIdFromProps, customPaymentForms, useAllPaymentPlugins, }: {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { PluginData } from "@bunnyapp/common";
|
|
2
|
-
declare function useRemovePaymentMethod(paymentPlugins: PluginData[], apiHost: string, entityId: string, token
|
|
2
|
+
declare function useRemovePaymentMethod(paymentPlugins: PluginData[], apiHost: string, entityId: string, token: string, accountId?: string): (data: any) => Promise<void>;
|
|
3
3
|
export default useRemovePaymentMethod;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
3
|
import Quote from "./Quote";
|
|
3
4
|
declare const meta: Meta<typeof Quote>;
|
|
@@ -17,16 +18,16 @@ export declare const Default: import("@storybook/core/csf").StoryAnnotations<imp
|
|
|
17
18
|
onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
|
|
18
19
|
onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
|
|
19
20
|
}, {
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
backButtonName?: string | undefined;
|
|
22
|
+
onBackButtonClick?: (() => void) | undefined;
|
|
22
23
|
shadow?: import("../../types/shadowType").ShadowType | undefined;
|
|
24
|
+
hideDownloadButton?: boolean | undefined;
|
|
23
25
|
id?: string | undefined;
|
|
26
|
+
className?: string | undefined;
|
|
27
|
+
entityId?: string | undefined;
|
|
28
|
+
onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
|
|
24
29
|
invoiceQuoteViewComponent?: import("react").ReactNode;
|
|
25
|
-
backButtonName?: string | undefined;
|
|
26
|
-
onBackButtonClick?: (() => void) | undefined;
|
|
27
30
|
onInvoiceDownloadError?: (() => void) | undefined;
|
|
28
|
-
onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
|
|
29
|
-
hideDownloadButton?: boolean | undefined;
|
|
30
31
|
onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
|
|
31
32
|
onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
|
|
32
33
|
}>;
|
|
@@ -44,16 +45,16 @@ export declare const NoShadow: import("@storybook/core/csf").StoryAnnotations<im
|
|
|
44
45
|
onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
|
|
45
46
|
onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
|
|
46
47
|
}, {
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
backButtonName?: string | undefined;
|
|
49
|
+
onBackButtonClick?: (() => void) | undefined;
|
|
49
50
|
shadow?: import("../../types/shadowType").ShadowType | undefined;
|
|
51
|
+
hideDownloadButton?: boolean | undefined;
|
|
50
52
|
id?: string | undefined;
|
|
53
|
+
className?: string | undefined;
|
|
54
|
+
entityId?: string | undefined;
|
|
55
|
+
onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
|
|
51
56
|
invoiceQuoteViewComponent?: import("react").ReactNode;
|
|
52
|
-
backButtonName?: string | undefined;
|
|
53
|
-
onBackButtonClick?: (() => void) | undefined;
|
|
54
57
|
onInvoiceDownloadError?: (() => void) | undefined;
|
|
55
|
-
onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
|
|
56
|
-
hideDownloadButton?: boolean | undefined;
|
|
57
58
|
onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
|
|
58
59
|
onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
|
|
59
60
|
}>;
|
|
@@ -71,16 +72,16 @@ export declare const Mobile: import("@storybook/core/csf").StoryAnnotations<impo
|
|
|
71
72
|
onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
|
|
72
73
|
onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
|
|
73
74
|
}, {
|
|
74
|
-
|
|
75
|
-
|
|
75
|
+
backButtonName?: string | undefined;
|
|
76
|
+
onBackButtonClick?: (() => void) | undefined;
|
|
76
77
|
shadow?: import("../../types/shadowType").ShadowType | undefined;
|
|
78
|
+
hideDownloadButton?: boolean | undefined;
|
|
77
79
|
id?: string | undefined;
|
|
80
|
+
className?: string | undefined;
|
|
81
|
+
entityId?: string | undefined;
|
|
82
|
+
onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
|
|
78
83
|
invoiceQuoteViewComponent?: import("react").ReactNode;
|
|
79
|
-
backButtonName?: string | undefined;
|
|
80
|
-
onBackButtonClick?: (() => void) | undefined;
|
|
81
84
|
onInvoiceDownloadError?: (() => void) | undefined;
|
|
82
|
-
onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
|
|
83
|
-
hideDownloadButton?: boolean | undefined;
|
|
84
85
|
onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
|
|
85
86
|
onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
|
|
86
87
|
}>;
|
|
@@ -98,16 +99,16 @@ export declare const CustomClassName: import("@storybook/core/csf").StoryAnnotat
|
|
|
98
99
|
onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
|
|
99
100
|
onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
|
|
100
101
|
}, {
|
|
101
|
-
|
|
102
|
-
|
|
102
|
+
backButtonName?: string | undefined;
|
|
103
|
+
onBackButtonClick?: (() => void) | undefined;
|
|
103
104
|
shadow?: import("../../types/shadowType").ShadowType | undefined;
|
|
105
|
+
hideDownloadButton?: boolean | undefined;
|
|
104
106
|
id?: string | undefined;
|
|
107
|
+
className?: string | undefined;
|
|
108
|
+
entityId?: string | undefined;
|
|
109
|
+
onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
|
|
105
110
|
invoiceQuoteViewComponent?: import("react").ReactNode;
|
|
106
|
-
backButtonName?: string | undefined;
|
|
107
|
-
onBackButtonClick?: (() => void) | undefined;
|
|
108
111
|
onInvoiceDownloadError?: (() => void) | undefined;
|
|
109
|
-
onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
|
|
110
|
-
hideDownloadButton?: boolean | undefined;
|
|
111
112
|
onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
|
|
112
113
|
onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
|
|
113
114
|
}>;
|
|
@@ -128,16 +129,16 @@ export declare const DarkMode: import("@storybook/core/csf").StoryAnnotations<im
|
|
|
128
129
|
onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
|
|
129
130
|
onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
|
|
130
131
|
}, {
|
|
131
|
-
|
|
132
|
-
|
|
132
|
+
backButtonName?: string | undefined;
|
|
133
|
+
onBackButtonClick?: (() => void) | undefined;
|
|
133
134
|
shadow?: import("../../types/shadowType").ShadowType | undefined;
|
|
135
|
+
hideDownloadButton?: boolean | undefined;
|
|
134
136
|
id?: string | undefined;
|
|
137
|
+
className?: string | undefined;
|
|
138
|
+
entityId?: string | undefined;
|
|
139
|
+
onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
|
|
135
140
|
invoiceQuoteViewComponent?: import("react").ReactNode;
|
|
136
|
-
backButtonName?: string | undefined;
|
|
137
|
-
onBackButtonClick?: (() => void) | undefined;
|
|
138
141
|
onInvoiceDownloadError?: (() => void) | undefined;
|
|
139
|
-
onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
|
|
140
|
-
hideDownloadButton?: boolean | undefined;
|
|
141
142
|
onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
|
|
142
143
|
onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
|
|
143
144
|
}>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { Subscription } from "@bunnyapp/common";
|
|
2
3
|
import "../../styles/index.less";
|
|
3
4
|
export type EditingQuoteDataType = {
|
|
@@ -14,7 +15,7 @@ declare const Subscriptions: ({ className, companyName, entityId, hideExpired, o
|
|
|
14
15
|
onSubscriptionsLoaded?: ((subscriptions: Subscription[]) => void) | undefined;
|
|
15
16
|
styles?: {
|
|
16
17
|
gap?: number | undefined;
|
|
17
|
-
shadow?: "none" | "
|
|
18
|
+
shadow?: "none" | "lg" | "md" | "sm" | undefined;
|
|
18
19
|
subscriptionProductNameStyle?: import("react").CSSProperties | undefined;
|
|
19
20
|
} | undefined;
|
|
20
21
|
noSubscriptionsComponent?: React.ReactNode;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
declare const useSendAcceptQuote: ({ entityId, onTokenExpired, quoteId, apiHost, token, }: {
|
|
2
3
|
entityId: string;
|
|
3
4
|
onTokenExpired?: (() => void) | undefined;
|
|
4
5
|
quoteId?: string | undefined;
|
|
5
6
|
apiHost: string;
|
|
6
|
-
token
|
|
7
|
+
token: string;
|
|
7
8
|
}) => {
|
|
8
9
|
acceptBoxVisible: boolean;
|
|
9
10
|
isAccepting: boolean;
|
|
@@ -2,7 +2,7 @@ import { PluginData } from "@bunnyapp/common";
|
|
|
2
2
|
export declare const usePaymentPlugins: ({ entityId, apiHost, token, }: {
|
|
3
3
|
entityId: string;
|
|
4
4
|
apiHost: string;
|
|
5
|
-
token
|
|
5
|
+
token: string;
|
|
6
6
|
}) => {
|
|
7
7
|
paymentPlugins: PluginData[] | undefined;
|
|
8
8
|
paymentMethodAllowedPlugins: PluginData[] | undefined;
|
package/dist/esm/index.js
CHANGED
|
@@ -1294,7 +1294,7 @@ function useRemovePaymentMethod(paymentPlugins, apiHost, entityId, token, accoun
|
|
|
1294
1294
|
})
|
|
1295
1295
|
.then(function () {
|
|
1296
1296
|
showSuccessNotification("Payment method was removed", "Success");
|
|
1297
|
-
queryClient.setQueryData(QueryKeyFactory.default.accountPaymentMethodKey(entityId, token, accountId), null);
|
|
1297
|
+
queryClient.setQueryData(QueryKeyFactory.default.accountPaymentMethodKey({ entityId: entityId, token: token, accountId: accountId }), null);
|
|
1298
1298
|
})
|
|
1299
1299
|
.catch(function (error) {
|
|
1300
1300
|
showErrorNotification(error.message, "Error removing payment method");
|
|
@@ -1317,14 +1317,17 @@ var PaymentForm = function (_a) {
|
|
|
1317
1317
|
var _d = useState(), selectedPaymentMethod = _d[0], setSelectedPaymentMethod = _d[1];
|
|
1318
1318
|
var _e = useState(false), showPaymentMethodForm = _e[0], setShowPaymentMethodForm = _e[1];
|
|
1319
1319
|
var paying = !!(quote || invoice);
|
|
1320
|
-
var currencyId = (_b = ((quote === null || quote === void 0 ? void 0 : quote.currencyId) ||
|
|
1321
|
-
(invoice === null || invoice === void 0 ? void 0 : invoice.currencyId) ||
|
|
1322
|
-
currencyIdFromProps)) === null || _b === void 0 ? void 0 : _b.toLowerCase();
|
|
1320
|
+
var currencyId = (_b = ((quote === null || quote === void 0 ? void 0 : quote.currencyId) || (invoice === null || invoice === void 0 ? void 0 : invoice.currencyId) || currencyIdFromProps)) === null || _b === void 0 ? void 0 : _b.toLowerCase();
|
|
1323
1321
|
// Hooks
|
|
1324
1322
|
var apiHost = useContext(BunnyContext).apiHost;
|
|
1325
1323
|
var tokenFromContexts = useToken();
|
|
1326
1324
|
var token = overrideToken || tokenFromContexts;
|
|
1327
|
-
var _f = usePaymentMethod(
|
|
1325
|
+
var _f = usePaymentMethod({
|
|
1326
|
+
accountId: accountId,
|
|
1327
|
+
entityId: entityId,
|
|
1328
|
+
graphQLClient: graphQLClient,
|
|
1329
|
+
token: token,
|
|
1330
|
+
}), storedPaymentMethod = _f.data, isPaymentMethodLoading = _f.isLoading;
|
|
1328
1331
|
var isPaymentMethodFetched = storedPaymentMethod !== undefined;
|
|
1329
1332
|
var _g = usePaymentPlugins({ entityId: entityId, apiHost: apiHost, token: token }), allPaymentMethodAllowedPlugins = _g.paymentMethodAllowedPlugins, allPaymentPlugins = _g.paymentPlugins, arePluginsFetched = _g.isFetched;
|
|
1330
1333
|
var paymentMethodAllowedPlugins = useMemo(function () {
|
|
@@ -1337,9 +1340,7 @@ var PaymentForm = function (_a) {
|
|
|
1337
1340
|
var queryClient = useQueryClient();
|
|
1338
1341
|
// Set default plugin
|
|
1339
1342
|
useEffect(function () {
|
|
1340
|
-
if (!arePluginsFetched ||
|
|
1341
|
-
!isPaymentMethodFetched ||
|
|
1342
|
-
selectedPaymentMethod) {
|
|
1343
|
+
if (!arePluginsFetched || !isPaymentMethodFetched || selectedPaymentMethod) {
|
|
1343
1344
|
return;
|
|
1344
1345
|
}
|
|
1345
1346
|
var pluginPaymentMethod = paymentMethodAllowedPlugins === null || paymentMethodAllowedPlugins === void 0 ? void 0 : paymentMethodAllowedPlugins.find(function (plugin) { var _a, _b, _c; return ((_a = plugin.id) === null || _a === void 0 ? void 0 : _a.toString()) === ((_c = (_b = storedPaymentMethod === null || storedPaymentMethod === void 0 ? void 0 : storedPaymentMethod.plugin) === null || _b === void 0 ? void 0 : _b.id) === null || _c === void 0 ? void 0 : _c.toString()); });
|
|
@@ -1368,7 +1369,7 @@ var PaymentForm = function (_a) {
|
|
|
1368
1369
|
};
|
|
1369
1370
|
var handleSavePaymentMethod = function () {
|
|
1370
1371
|
queryClient.invalidateQueries({
|
|
1371
|
-
queryKey: QueryKeyFactory.default.accountPaymentMethodKey(entityId, token
|
|
1372
|
+
queryKey: QueryKeyFactory.default.accountPaymentMethodKey({ accountId: accountId, entityId: entityId, token: token }),
|
|
1372
1373
|
});
|
|
1373
1374
|
onSavePaymentMethod === null || onSavePaymentMethod === void 0 ? void 0 : onSavePaymentMethod();
|
|
1374
1375
|
setShowPaymentMethodForm(false);
|
|
@@ -1413,7 +1414,7 @@ function Invoice(_a) {
|
|
|
1413
1414
|
function ActualInvoice() {
|
|
1414
1415
|
// Context
|
|
1415
1416
|
var queryClient = useQueryClient();
|
|
1416
|
-
var _a = useContext(InvoiceQuoteContext), id = _a.id, invoiceQuoteViewComponent = _a.invoiceQuoteViewComponent, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick, entityId = _a.entityId, className = _a.className;
|
|
1417
|
+
var _a = useContext(InvoiceQuoteContext), id = _a.id, invoiceQuoteViewComponent = _a.invoiceQuoteViewComponent, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick, entityId = _a.entityId, onPaymentSuccess = _a.onPaymentSuccess, className = _a.className;
|
|
1417
1418
|
var _b = useContext(BunnyContext), apiHost = _b.apiHost, onTokenExpired = _b.onTokenExpired, graphQLClient = _b.graphQLClient;
|
|
1418
1419
|
var _c = useContext(InvoiceQuoteContext), hideDownloadButton = _c.hideDownloadButton, onInvoiceLoaded = _c.onInvoiceLoaded;
|
|
1419
1420
|
var token = useToken();
|
|
@@ -1422,7 +1423,7 @@ function ActualInvoice() {
|
|
|
1422
1423
|
var handleAllErrorFormats = useAllErrorFormats(onTokenExpired);
|
|
1423
1424
|
// Queries
|
|
1424
1425
|
var formattedInvoice = useQuery({
|
|
1425
|
-
queryKey: QueryKeyFactory.default.createFormattedInvoiceKey(id, token),
|
|
1426
|
+
queryKey: QueryKeyFactory.default.createFormattedInvoiceKey({ id: id, token: token }),
|
|
1426
1427
|
queryFn: function () { return getFormattedInvoice({ id: id, token: token, apiHost: apiHost }); },
|
|
1427
1428
|
}).data;
|
|
1428
1429
|
// Derived state
|
|
@@ -1431,12 +1432,13 @@ function ActualInvoice() {
|
|
|
1431
1432
|
var isMobile = useIsMobile(isInvoicePayable ? BreakpointNumbers.lg : undefined);
|
|
1432
1433
|
var onSuccess = function () {
|
|
1433
1434
|
queryClient.invalidateQueries({
|
|
1434
|
-
queryKey: QueryKeyFactory.default.transactionsKey(token),
|
|
1435
|
+
queryKey: QueryKeyFactory.default.transactionsKey({ token: token }),
|
|
1435
1436
|
});
|
|
1436
1437
|
queryClient.invalidateQueries({
|
|
1437
|
-
queryKey: QueryKeyFactory.default.createFormattedInvoiceKey(id, token),
|
|
1438
|
+
queryKey: QueryKeyFactory.default.createFormattedInvoiceKey({ id: id, token: token }),
|
|
1438
1439
|
});
|
|
1439
1440
|
showSuccessNotification("Your invoice has been paid", "Payment successful");
|
|
1441
|
+
onPaymentSuccess === null || onPaymentSuccess === void 0 ? void 0 : onPaymentSuccess();
|
|
1440
1442
|
};
|
|
1441
1443
|
var onFail = function (error) {
|
|
1442
1444
|
handleAllErrorFormats(error.message);
|
|
@@ -1476,11 +1478,7 @@ var getFormattedQuote = function (_a) {
|
|
|
1476
1478
|
};
|
|
1477
1479
|
|
|
1478
1480
|
var filterSigningPlugins = function (plugins) {
|
|
1479
|
-
return plugins === null || plugins === void 0 ? void 0 : plugins.filter(function (plugin) {
|
|
1480
|
-
var _a, _b;
|
|
1481
|
-
return ((_a = plugin.type) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === "signing" &&
|
|
1482
|
-
((_b = plugin.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === "valid";
|
|
1483
|
-
});
|
|
1481
|
+
return plugins === null || plugins === void 0 ? void 0 : plugins.filter(function (plugin) { var _a, _b; return ((_a = plugin.type) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === "signing" && ((_b = plugin.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === "valid"; });
|
|
1484
1482
|
};
|
|
1485
1483
|
var useSigningPlugins = function (_a) {
|
|
1486
1484
|
var entityId = _a.entityId, apiHost = _a.apiHost, token = _a.token;
|
|
@@ -1541,10 +1539,10 @@ var useSendAcceptQuote = function (_a) {
|
|
|
1541
1539
|
});
|
|
1542
1540
|
client.on("sign", function (data) {
|
|
1543
1541
|
queryClient.refetchQueries({
|
|
1544
|
-
queryKey: QueryKeyFactory.default.createQuoteKey(quoteId, token),
|
|
1542
|
+
queryKey: QueryKeyFactory.default.createQuoteKey({ id: quoteId, token: token }),
|
|
1545
1543
|
});
|
|
1546
1544
|
queryClient.refetchQueries({
|
|
1547
|
-
queryKey: QueryKeyFactory.default.createQuoteKey(token),
|
|
1545
|
+
queryKey: QueryKeyFactory.default.createQuoteKey({ id: quoteId, token: token }),
|
|
1548
1546
|
});
|
|
1549
1547
|
});
|
|
1550
1548
|
// Open the DropboxSign modal
|
|
@@ -1565,10 +1563,10 @@ var useSendAcceptQuote = function (_a) {
|
|
|
1565
1563
|
else {
|
|
1566
1564
|
setAcceptBoxVisible(false);
|
|
1567
1565
|
queryClient.invalidateQueries({
|
|
1568
|
-
queryKey: QueryKeyFactory.default.createQuoteKey(quoteId, token),
|
|
1566
|
+
queryKey: QueryKeyFactory.default.createQuoteKey({ id: quoteId, token: token }),
|
|
1569
1567
|
});
|
|
1570
1568
|
queryClient.invalidateQueries({
|
|
1571
|
-
queryKey: QueryKeyFactory.default.createQuoteKey(token),
|
|
1569
|
+
queryKey: QueryKeyFactory.default.createQuoteKey({ id: quoteId, token: token }),
|
|
1572
1570
|
});
|
|
1573
1571
|
}
|
|
1574
1572
|
}, token);
|
|
@@ -1724,7 +1722,7 @@ function ActualQuote(_a) {
|
|
|
1724
1722
|
var _e = useContext(InvoiceQuoteContext), className = _e.className, id = _e.id, hideDownloadButton = _e.hideDownloadButton, onQuoteLoaded = _e.onQuoteLoaded;
|
|
1725
1723
|
// Queries
|
|
1726
1724
|
var _f = useQuery({
|
|
1727
|
-
queryKey: QueryKeyFactory.default.createQuoteKey(id, token),
|
|
1725
|
+
queryKey: QueryKeyFactory.default.createQuoteKey({ id: id, token: token }),
|
|
1728
1726
|
queryFn: function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1729
1727
|
var error_1;
|
|
1730
1728
|
return __generator(this, function (_a) {
|
|
@@ -1769,11 +1767,7 @@ function ActualQuote(_a) {
|
|
|
1769
1767
|
var isAccepted = formattedQuote.state === "ACCEPTED";
|
|
1770
1768
|
return (jsxs(Fragment, { children: [jsxs("div", __assign({ className: "flex flex-col gap-4 ".concat(isMobile ? "w-full overflow-hidden" : "shadow-padding-xb", " ").concat(className) }, { children: [jsxs("div", __assign({ className: "flex flex-row justify-end items-center gap-4", id: "acceptance", style: {
|
|
1771
1769
|
color: entityBranding.secondaryColor,
|
|
1772
|
-
} }, { children: [isAccepted && formattedQuote.acceptedAt ? (jsx(Text$b, { children: "Quote was accepted by ".concat(formattedQuote.acceptedByName, " on ").concat(formatDate(formattedQuote.acceptedAt)) })) : null, (!isMobile || !isAccepted) && (jsxs("div", __assign({ className: isMobile
|
|
1773
|
-
? "flex w-full justify-end gap-2"
|
|
1774
|
-
: "flex items-center justify-end gap-2" }, { children: [!isMobile && !hideDownloadButton ? (jsx(Button, __assign({ icon: jsx(DownloadOutlined, {}), onClick: function () {
|
|
1775
|
-
return downloadFile(apiHost + "/api/pdf/quote", token);
|
|
1776
|
-
} }, { children: "Download" }))) : null, !isAccepted ? (jsx(Button, __assign({ disabled: isExpired || isAccepting, onClick: function () { return startAcceptance(); }, type: "primary" }, { children: isExpired ? "Quote is expired" : "Accept quote" }))) : null] })))] })), jsx(InvoiceQuoteView, __assign({ html: formattedQuote.html }, { children: ((_c = (_b = formattedQuote.object) === null || _b === void 0 ? void 0 : _b.documents) === null || _c === void 0 ? void 0 : _c.length) > 0 ? (jsx("div", __assign({ className: "flex flex-col items-end" }, { children: formattedQuote.object.documents.map(function (doc, index) {
|
|
1770
|
+
} }, { children: [isAccepted && formattedQuote.acceptedAt ? (jsx(Text$b, { children: "Quote was accepted by ".concat(formattedQuote.acceptedByName, " on ").concat(formatDate(formattedQuote.acceptedAt)) })) : null, (!isMobile || !isAccepted) && (jsxs("div", __assign({ className: isMobile ? "flex w-full justify-end gap-2" : "flex items-center justify-end gap-2" }, { children: [!isMobile && !hideDownloadButton ? (jsx(Button, __assign({ icon: jsx(DownloadOutlined, {}), onClick: function () { return downloadFile(apiHost + "/api/pdf/quote", token); } }, { children: "Download" }))) : null, !isAccepted ? (jsx(Button, __assign({ disabled: isExpired || isAccepting, onClick: function () { return startAcceptance(); }, type: "primary" }, { children: isExpired ? "Quote is expired" : "Accept quote" }))) : null] })))] })), jsx(InvoiceQuoteView, __assign({ html: formattedQuote.html }, { children: ((_c = (_b = formattedQuote.object) === null || _b === void 0 ? void 0 : _b.documents) === null || _c === void 0 ? void 0 : _c.length) > 0 ? (jsx("div", __assign({ className: "flex flex-col items-end" }, { children: formattedQuote.object.documents.map(function (doc, index) {
|
|
1777
1771
|
return (jsx(Button, __assign({ download: doc.filename, href: doc.url, type: "link" }, { children: doc.filename }), index));
|
|
1778
1772
|
}) }))) : null }))] })), jsx(AcceptQuoteModal, { acceptBoxVisible: acceptBoxVisible, formattedQuote: formattedQuote, setAcceptBoxVisible: setAcceptBoxVisible, setIsAccepting: setIsAccepting, sendAccept: sendAccept }), jsx(PandadocPollingModal, { isVisible: pandadocPollingModalVisible, setVisible: setPandadocPollingModalVisible, id: id })] }));
|
|
1779
1773
|
}
|
|
@@ -19493,18 +19487,18 @@ var PaymentMethod = function (_a) {
|
|
|
19493
19487
|
var paymentPlugins = usePaymentPlugins({ entityId: entityId, apiHost: apiHost, token: token }).paymentPlugins;
|
|
19494
19488
|
var showSuccessNotification = useSuccessNotification();
|
|
19495
19489
|
var handleAllErrorFormats = useAllErrorFormats(onTokenExpired);
|
|
19496
|
-
var data = usePaymentMethod(graphQLClient).data;
|
|
19490
|
+
var data = usePaymentMethod({ entityId: entityId, graphQLClient: graphQLClient, token: token }).data;
|
|
19497
19491
|
var onClickRemove = useRemovePaymentMethod(paymentPlugins || [], apiHost, entityId, token);
|
|
19498
19492
|
// Queries
|
|
19499
19493
|
var billingDetails = useQuery({
|
|
19500
|
-
queryKey: QueryKeyFactory.default.billingDetailsKey(entityId, token),
|
|
19494
|
+
queryKey: QueryKeyFactory.default.billingDetailsKey({ entityId: entityId, token: token }),
|
|
19501
19495
|
queryFn: function () { return getBillingDetails({ token: token, apiHost: apiHost }); },
|
|
19502
19496
|
}).data;
|
|
19503
19497
|
// Local state
|
|
19504
19498
|
var _g = useState(false), showModal = _g[0], setShowModal = _g[1];
|
|
19505
19499
|
var onSuccess = function () {
|
|
19506
19500
|
queryClient.invalidateQueries({
|
|
19507
|
-
queryKey: QueryKeyFactory.default.accountPaymentMethodKey(entityId, token),
|
|
19501
|
+
queryKey: QueryKeyFactory.default.accountPaymentMethodKey({ entityId: entityId, token: token }),
|
|
19508
19502
|
});
|
|
19509
19503
|
setShowModal(false);
|
|
19510
19504
|
showSuccessNotification("Your payment method has been saved");
|
|
@@ -19942,7 +19936,11 @@ function Signup(_a) {
|
|
|
19942
19936
|
var _h = useState(false), proceedingToPayment = _h[0], setProceedingToPayment = _h[1];
|
|
19943
19937
|
var _j = useState(false), purchaseSucceeded = _j[0], setPurchaseSucceeded = _j[1];
|
|
19944
19938
|
var _k = useState(undefined), paymentMethodGraphQLClient = _k[0], setPaymentMethodGraphQLClient = _k[1];
|
|
19945
|
-
var paymentMethod = usePaymentMethod(
|
|
19939
|
+
var paymentMethod = usePaymentMethod({
|
|
19940
|
+
entityId: entityId,
|
|
19941
|
+
graphQLClient: paymentMethodGraphQLClient || graphQLClient,
|
|
19942
|
+
token: token,
|
|
19943
|
+
}).data;
|
|
19946
19944
|
var queryClient = useQueryClient();
|
|
19947
19945
|
// Queries
|
|
19948
19946
|
var priceListData = useQuery({
|
|
@@ -19977,7 +19975,7 @@ function Signup(_a) {
|
|
|
19977
19975
|
// We must invalidate the accountPaymentMethodKey query in order to clear payment methods from the provided api token,
|
|
19978
19976
|
// to instead use paymentMethods from portalSessionToken.
|
|
19979
19977
|
queryClient.invalidateQueries({
|
|
19980
|
-
queryKey: QueryKeyFactory.default.accountPaymentMethodKey(entityId, token),
|
|
19978
|
+
queryKey: QueryKeyFactory.default.accountPaymentMethodKey({ entityId: entityId, token: token }),
|
|
19981
19979
|
});
|
|
19982
19980
|
setProceedingToPayment(false);
|
|
19983
19981
|
setQuote(data.quote);
|
|
@@ -20036,9 +20034,7 @@ function Signup(_a) {
|
|
|
20036
20034
|
var children = _a.children, className = _a.className, style = _a.style;
|
|
20037
20035
|
return isCardEnabled ? (jsx(Card, __assign({ className: className, style: style }, { children: children }))) : (jsx("div", __assign({ className: className, style: style }, { children: children })));
|
|
20038
20036
|
};
|
|
20039
|
-
return (jsx(WrapperComponent, __assign({ className: "p-4 flex flex-col ".concat(shadow, " ").concat(className), style: style }, { children: purchaseSucceeded ? (jsx(Fragment, { children: (quote === null || quote === void 0 ? void 0 : quote.currencyId) !== undefined ? (jsx(PaymentSuccessDisplay, { amountPaid: (quote === null || quote === void 0 ? void 0 : quote.amountDue) || 0, className: "w-full", companyName: companyName, returnUrl: returnUrl, currencyId: quote === null || quote === void 0 ? void 0 : quote.currencyId })) : (jsx("div", { children: "No currency ID found from Quote" })) })) : (jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col" : "flex-row", " h-full w-full") }, { children: [jsx("div", __assign({ className: "flex flex-col ".concat(isMobile ? "items-center" : "w-1/2 items-center") }, { children: jsx(PriceListDisplay, { priceListData: priceListData, topNavImageUrl: topNavImageUrl }) })), jsx("div", __assign({ className: "".concat(isMobile ? "h-full" : "my-4") }, { children: jsx(Divider, { className: "h-full", type: isMobile ? undefined : "vertical" }) })), jsx("div", __assign({ className: "flex ".concat(isMobile
|
|
20040
|
-
? "items-center justify-center my-12"
|
|
20041
|
-
: "w-1/2 items-center justify-center my-12") }, { children: jsx("div", __assign({ className: "".concat(isMobile ? "w-full" : "w-1/2") }, { children: jsx(PaymentForms, { entityId: entityId, quote: quote, handlePaymentSuccess: handlePaymentSuccess, handlePaymentFail: handlePaymentFail, handleSubmit: handleSubmit, proceedingToPayment: proceedingToPayment, accountId: accountId, overrideToken: portalSessionToken, customCheckoutFunction: accountSignupFunction }) })) }))] }))) })));
|
|
20037
|
+
return (jsx(WrapperComponent, __assign({ className: "p-4 flex flex-col ".concat(shadow, " ").concat(className), style: style }, { children: purchaseSucceeded ? (jsx(Fragment, { children: (quote === null || quote === void 0 ? void 0 : quote.currencyId) !== undefined ? (jsx(PaymentSuccessDisplay, { amountPaid: (quote === null || quote === void 0 ? void 0 : quote.amountDue) || 0, className: "w-full", companyName: companyName, returnUrl: returnUrl, currencyId: quote === null || quote === void 0 ? void 0 : quote.currencyId })) : (jsx("div", { children: "No currency ID found from Quote" })) })) : (jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col" : "flex-row", " h-full w-full") }, { children: [jsx("div", __assign({ className: "flex flex-col ".concat(isMobile ? "items-center" : "w-1/2 items-center") }, { children: jsx(PriceListDisplay, { priceListData: priceListData, topNavImageUrl: topNavImageUrl }) })), jsx("div", __assign({ className: "".concat(isMobile ? "h-full" : "my-4") }, { children: jsx(Divider, { className: "h-full", type: isMobile ? undefined : "vertical" }) })), jsx("div", __assign({ className: "flex ".concat(isMobile ? "items-center justify-center my-12" : "w-1/2 items-center justify-center my-12") }, { children: jsx("div", __assign({ className: "".concat(isMobile ? "w-full" : "w-1/2") }, { children: jsx(PaymentForms, { entityId: entityId, quote: quote, handlePaymentSuccess: handlePaymentSuccess, handlePaymentFail: handlePaymentFail, handleSubmit: handleSubmit, proceedingToPayment: proceedingToPayment, accountId: accountId, overrideToken: portalSessionToken, customCheckoutFunction: accountSignupFunction }) })) }))] }))) })));
|
|
20042
20038
|
}
|
|
20043
20039
|
|
|
20044
20040
|
// WARNING: There is a preview button on APP that will need to be changed if this query is changed
|
|
@@ -20584,12 +20580,16 @@ var Subscriptions = function (_a) {
|
|
|
20584
20580
|
var token = useToken();
|
|
20585
20581
|
// Queries
|
|
20586
20582
|
var _d = useQuery({
|
|
20587
|
-
queryKey: QueryKeyFactory.default.createTableKey(
|
|
20583
|
+
queryKey: QueryKeyFactory.default.createTableKey({
|
|
20584
|
+
filterString: "entityId=".concat(entityId),
|
|
20585
|
+
pluralType: "subscriptions",
|
|
20586
|
+
token: token,
|
|
20587
|
+
}),
|
|
20588
20588
|
queryFn: function () { return getSubscriptions({ entityId: entityId, token: token, apiHost: apiHost }); },
|
|
20589
20589
|
enabled: Boolean(entityId),
|
|
20590
20590
|
}), rawSubscriptions = _d.data, subscriptionsAreLoading = _d.isLoading;
|
|
20591
20591
|
var _e = useQuery({
|
|
20592
|
-
queryKey: QueryKeyFactory.default.planChangeOptionsKey(token),
|
|
20592
|
+
queryKey: QueryKeyFactory.default.planChangeOptionsKey({ token: token }),
|
|
20593
20593
|
queryFn: function () { return getPlanChangeOptions({ token: token, apiHost: apiHost }); },
|
|
20594
20594
|
enabled: Boolean(onChangePlanClick),
|
|
20595
20595
|
}), planChangeOptions = _e.data, arePlanChangeOptionsLoading = _e.isLoading;
|
|
@@ -20599,8 +20599,7 @@ var Subscriptions = function (_a) {
|
|
|
20599
20599
|
if (subscriptions)
|
|
20600
20600
|
onSubscriptionsLoaded === null || onSubscriptionsLoaded === void 0 ? void 0 : onSubscriptionsLoaded(subscriptions);
|
|
20601
20601
|
}, [subscriptions]);
|
|
20602
|
-
if (subscriptionsAreLoading ||
|
|
20603
|
-
(Boolean(onChangePlanClick) ? arePlanChangeOptionsLoading : false))
|
|
20602
|
+
if (subscriptionsAreLoading || (Boolean(onChangePlanClick) ? arePlanChangeOptionsLoading : false))
|
|
20604
20603
|
return jsx(Fragment, {});
|
|
20605
20604
|
return (jsx(SubscriptionsContext.Provider, __assign({ value: {
|
|
20606
20605
|
gap: gap,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { FormattedInvoice, PluginData, Quote } from "@bunnyapp/common";
|
|
2
3
|
import { GraphQLClient } from "graphql-request";
|
|
3
4
|
export declare const PaymentForm: ({ entityId, invoice, onFail, onPaymentSuccess, quote, accountId, onSavePaymentMethod, overrideToken, graphQLClient, customCheckoutFunction, currencyId: currencyIdFromProps, customPaymentForms, useAllPaymentPlugins, }: {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { PluginData } from "@bunnyapp/common";
|
|
2
|
-
declare function useRemovePaymentMethod(paymentPlugins: PluginData[], apiHost: string, entityId: string, token
|
|
2
|
+
declare function useRemovePaymentMethod(paymentPlugins: PluginData[], apiHost: string, entityId: string, token: string, accountId?: string): (data: any) => Promise<void>;
|
|
3
3
|
export default useRemovePaymentMethod;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
3
|
import Quote from "./Quote";
|
|
3
4
|
declare const meta: Meta<typeof Quote>;
|
|
@@ -17,16 +18,16 @@ export declare const Default: import("@storybook/core/csf").StoryAnnotations<imp
|
|
|
17
18
|
onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
|
|
18
19
|
onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
|
|
19
20
|
}, {
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
backButtonName?: string | undefined;
|
|
22
|
+
onBackButtonClick?: (() => void) | undefined;
|
|
22
23
|
shadow?: import("../../types/shadowType").ShadowType | undefined;
|
|
24
|
+
hideDownloadButton?: boolean | undefined;
|
|
23
25
|
id?: string | undefined;
|
|
26
|
+
className?: string | undefined;
|
|
27
|
+
entityId?: string | undefined;
|
|
28
|
+
onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
|
|
24
29
|
invoiceQuoteViewComponent?: import("react").ReactNode;
|
|
25
|
-
backButtonName?: string | undefined;
|
|
26
|
-
onBackButtonClick?: (() => void) | undefined;
|
|
27
30
|
onInvoiceDownloadError?: (() => void) | undefined;
|
|
28
|
-
onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
|
|
29
|
-
hideDownloadButton?: boolean | undefined;
|
|
30
31
|
onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
|
|
31
32
|
onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
|
|
32
33
|
}>;
|
|
@@ -44,16 +45,16 @@ export declare const NoShadow: import("@storybook/core/csf").StoryAnnotations<im
|
|
|
44
45
|
onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
|
|
45
46
|
onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
|
|
46
47
|
}, {
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
backButtonName?: string | undefined;
|
|
49
|
+
onBackButtonClick?: (() => void) | undefined;
|
|
49
50
|
shadow?: import("../../types/shadowType").ShadowType | undefined;
|
|
51
|
+
hideDownloadButton?: boolean | undefined;
|
|
50
52
|
id?: string | undefined;
|
|
53
|
+
className?: string | undefined;
|
|
54
|
+
entityId?: string | undefined;
|
|
55
|
+
onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
|
|
51
56
|
invoiceQuoteViewComponent?: import("react").ReactNode;
|
|
52
|
-
backButtonName?: string | undefined;
|
|
53
|
-
onBackButtonClick?: (() => void) | undefined;
|
|
54
57
|
onInvoiceDownloadError?: (() => void) | undefined;
|
|
55
|
-
onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
|
|
56
|
-
hideDownloadButton?: boolean | undefined;
|
|
57
58
|
onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
|
|
58
59
|
onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
|
|
59
60
|
}>;
|
|
@@ -71,16 +72,16 @@ export declare const Mobile: import("@storybook/core/csf").StoryAnnotations<impo
|
|
|
71
72
|
onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
|
|
72
73
|
onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
|
|
73
74
|
}, {
|
|
74
|
-
|
|
75
|
-
|
|
75
|
+
backButtonName?: string | undefined;
|
|
76
|
+
onBackButtonClick?: (() => void) | undefined;
|
|
76
77
|
shadow?: import("../../types/shadowType").ShadowType | undefined;
|
|
78
|
+
hideDownloadButton?: boolean | undefined;
|
|
77
79
|
id?: string | undefined;
|
|
80
|
+
className?: string | undefined;
|
|
81
|
+
entityId?: string | undefined;
|
|
82
|
+
onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
|
|
78
83
|
invoiceQuoteViewComponent?: import("react").ReactNode;
|
|
79
|
-
backButtonName?: string | undefined;
|
|
80
|
-
onBackButtonClick?: (() => void) | undefined;
|
|
81
84
|
onInvoiceDownloadError?: (() => void) | undefined;
|
|
82
|
-
onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
|
|
83
|
-
hideDownloadButton?: boolean | undefined;
|
|
84
85
|
onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
|
|
85
86
|
onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
|
|
86
87
|
}>;
|
|
@@ -98,16 +99,16 @@ export declare const CustomClassName: import("@storybook/core/csf").StoryAnnotat
|
|
|
98
99
|
onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
|
|
99
100
|
onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
|
|
100
101
|
}, {
|
|
101
|
-
|
|
102
|
-
|
|
102
|
+
backButtonName?: string | undefined;
|
|
103
|
+
onBackButtonClick?: (() => void) | undefined;
|
|
103
104
|
shadow?: import("../../types/shadowType").ShadowType | undefined;
|
|
105
|
+
hideDownloadButton?: boolean | undefined;
|
|
104
106
|
id?: string | undefined;
|
|
107
|
+
className?: string | undefined;
|
|
108
|
+
entityId?: string | undefined;
|
|
109
|
+
onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
|
|
105
110
|
invoiceQuoteViewComponent?: import("react").ReactNode;
|
|
106
|
-
backButtonName?: string | undefined;
|
|
107
|
-
onBackButtonClick?: (() => void) | undefined;
|
|
108
111
|
onInvoiceDownloadError?: (() => void) | undefined;
|
|
109
|
-
onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
|
|
110
|
-
hideDownloadButton?: boolean | undefined;
|
|
111
112
|
onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
|
|
112
113
|
onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
|
|
113
114
|
}>;
|
|
@@ -128,16 +129,16 @@ export declare const DarkMode: import("@storybook/core/csf").StoryAnnotations<im
|
|
|
128
129
|
onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
|
|
129
130
|
onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
|
|
130
131
|
}, {
|
|
131
|
-
|
|
132
|
-
|
|
132
|
+
backButtonName?: string | undefined;
|
|
133
|
+
onBackButtonClick?: (() => void) | undefined;
|
|
133
134
|
shadow?: import("../../types/shadowType").ShadowType | undefined;
|
|
135
|
+
hideDownloadButton?: boolean | undefined;
|
|
134
136
|
id?: string | undefined;
|
|
137
|
+
className?: string | undefined;
|
|
138
|
+
entityId?: string | undefined;
|
|
139
|
+
onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
|
|
135
140
|
invoiceQuoteViewComponent?: import("react").ReactNode;
|
|
136
|
-
backButtonName?: string | undefined;
|
|
137
|
-
onBackButtonClick?: (() => void) | undefined;
|
|
138
141
|
onInvoiceDownloadError?: (() => void) | undefined;
|
|
139
|
-
onPaymentSuccess?: ((savePaymentMethod?: boolean | undefined) => void) | undefined;
|
|
140
|
-
hideDownloadButton?: boolean | undefined;
|
|
141
142
|
onInvoiceLoaded?: ((formattedInvoice: import("@bunnyapp/common").FormattedInvoice) => void) | undefined;
|
|
142
143
|
onQuoteLoaded?: ((formattedQuote: import("@bunnyapp/common").FormattedQuote) => void) | undefined;
|
|
143
144
|
}>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { Subscription } from "@bunnyapp/common";
|
|
2
3
|
import "../../styles/index.less";
|
|
3
4
|
export type EditingQuoteDataType = {
|
|
@@ -14,7 +15,7 @@ declare const Subscriptions: ({ className, companyName, entityId, hideExpired, o
|
|
|
14
15
|
onSubscriptionsLoaded?: ((subscriptions: Subscription[]) => void) | undefined;
|
|
15
16
|
styles?: {
|
|
16
17
|
gap?: number | undefined;
|
|
17
|
-
shadow?: "none" | "
|
|
18
|
+
shadow?: "none" | "lg" | "md" | "sm" | undefined;
|
|
18
19
|
subscriptionProductNameStyle?: import("react").CSSProperties | undefined;
|
|
19
20
|
} | undefined;
|
|
20
21
|
noSubscriptionsComponent?: React.ReactNode;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
declare const useSendAcceptQuote: ({ entityId, onTokenExpired, quoteId, apiHost, token, }: {
|
|
2
3
|
entityId: string;
|
|
3
4
|
onTokenExpired?: (() => void) | undefined;
|
|
4
5
|
quoteId?: string | undefined;
|
|
5
6
|
apiHost: string;
|
|
6
|
-
token
|
|
7
|
+
token: string;
|
|
7
8
|
}) => {
|
|
8
9
|
acceptBoxVisible: boolean;
|
|
9
10
|
isAccepting: boolean;
|
|
@@ -2,7 +2,7 @@ import { PluginData } from "@bunnyapp/common";
|
|
|
2
2
|
export declare const usePaymentPlugins: ({ entityId, apiHost, token, }: {
|
|
3
3
|
entityId: string;
|
|
4
4
|
apiHost: string;
|
|
5
|
-
token
|
|
5
|
+
token: string;
|
|
6
6
|
}) => {
|
|
7
7
|
paymentPlugins: PluginData[] | undefined;
|
|
8
8
|
paymentMethodAllowedPlugins: PluginData[] | undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -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" | "lg" | "md" | "sm" | undefined;
|
|
211
211
|
subscriptionProductNameStyle?: react.CSSProperties | undefined;
|
|
212
212
|
} | undefined;
|
|
213
213
|
noSubscriptionsComponent?: React.ReactNode;
|
package/package.json
CHANGED