@bunnyapp/components 1.0.39 → 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 +67 -78
- package/dist/cjs/src/components/BunnyProvider.d.ts +2 -2
- package/dist/cjs/src/components/PaymentForm/useRemovePaymentMethod.d.ts +1 -1
- package/dist/cjs/src/hooks/quotes/useSendAcceptQuote.d.ts +1 -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/usePaymentPlugins.d.ts +1 -1
- package/dist/cjs/src/hooks/usePlugins.d.ts +2 -2
- package/dist/cjs/src/hooks/useSigningPlugins.d.ts +1 -1
- package/dist/cjs/src/hooks/useToken.d.ts +1 -1
- package/dist/esm/index.js +67 -78
- package/dist/esm/src/components/BunnyProvider.d.ts +2 -2
- package/dist/esm/src/components/PaymentForm/useRemovePaymentMethod.d.ts +1 -1
- package/dist/esm/src/hooks/quotes/useSendAcceptQuote.d.ts +1 -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/usePaymentPlugins.d.ts +1 -1
- package/dist/esm/src/hooks/usePlugins.d.ts +2 -2
- package/dist/esm/src/hooks/useSigningPlugins.d.ts +1 -1
- package/dist/esm/src/hooks/useToken.d.ts +1 -1
- package/dist/index.d.ts +7 -2
- package/package.json +2 -2
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
|
@@ -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
|
|
|
@@ -1329,7 +1322,7 @@ function useRemovePaymentMethod(paymentPlugins, apiHost, entityId, token, accoun
|
|
|
1329
1322
|
})
|
|
1330
1323
|
.then(function () {
|
|
1331
1324
|
showSuccessNotification("Payment method was removed", "Success");
|
|
1332
|
-
queryClient.setQueryData(common.QueryKeyFactory.default.accountPaymentMethodKey(entityId, token, accountId), null);
|
|
1325
|
+
queryClient.setQueryData(common.QueryKeyFactory.default.accountPaymentMethodKey({ entityId: entityId, token: token, accountId: accountId }), null);
|
|
1333
1326
|
})
|
|
1334
1327
|
.catch(function (error) {
|
|
1335
1328
|
showErrorNotification(error.message, "Error removing payment method");
|
|
@@ -1352,14 +1345,17 @@ var PaymentForm = function (_a) {
|
|
|
1352
1345
|
var _d = react.useState(), selectedPaymentMethod = _d[0], setSelectedPaymentMethod = _d[1];
|
|
1353
1346
|
var _e = react.useState(false), showPaymentMethodForm = _e[0], setShowPaymentMethodForm = _e[1];
|
|
1354
1347
|
var paying = !!(quote || invoice);
|
|
1355
|
-
var currencyId = (_b = ((quote === null || quote === void 0 ? void 0 : quote.currencyId) ||
|
|
1356
|
-
(invoice === null || invoice === void 0 ? void 0 : invoice.currencyId) ||
|
|
1357
|
-
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();
|
|
1358
1349
|
// Hooks
|
|
1359
1350
|
var apiHost = react.useContext(BunnyContext).apiHost;
|
|
1360
1351
|
var tokenFromContexts = useToken();
|
|
1361
1352
|
var token = overrideToken || tokenFromContexts;
|
|
1362
|
-
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;
|
|
1363
1359
|
var isPaymentMethodFetched = storedPaymentMethod !== undefined;
|
|
1364
1360
|
var _g = usePaymentPlugins({ entityId: entityId, apiHost: apiHost, token: token }), allPaymentMethodAllowedPlugins = _g.paymentMethodAllowedPlugins, allPaymentPlugins = _g.paymentPlugins, arePluginsFetched = _g.isFetched;
|
|
1365
1361
|
var paymentMethodAllowedPlugins = react.useMemo(function () {
|
|
@@ -1372,9 +1368,7 @@ var PaymentForm = function (_a) {
|
|
|
1372
1368
|
var queryClient = reactQuery.useQueryClient();
|
|
1373
1369
|
// Set default plugin
|
|
1374
1370
|
react.useEffect(function () {
|
|
1375
|
-
if (!arePluginsFetched ||
|
|
1376
|
-
!isPaymentMethodFetched ||
|
|
1377
|
-
selectedPaymentMethod) {
|
|
1371
|
+
if (!arePluginsFetched || !isPaymentMethodFetched || selectedPaymentMethod) {
|
|
1378
1372
|
return;
|
|
1379
1373
|
}
|
|
1380
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()); });
|
|
@@ -1403,7 +1397,7 @@ var PaymentForm = function (_a) {
|
|
|
1403
1397
|
};
|
|
1404
1398
|
var handleSavePaymentMethod = function () {
|
|
1405
1399
|
queryClient.invalidateQueries({
|
|
1406
|
-
queryKey: common.QueryKeyFactory.default.accountPaymentMethodKey(entityId, token
|
|
1400
|
+
queryKey: common.QueryKeyFactory.default.accountPaymentMethodKey({ accountId: accountId, entityId: entityId, token: token }),
|
|
1407
1401
|
});
|
|
1408
1402
|
onSavePaymentMethod === null || onSavePaymentMethod === void 0 ? void 0 : onSavePaymentMethod();
|
|
1409
1403
|
setShowPaymentMethodForm(false);
|
|
@@ -1448,7 +1442,7 @@ function Invoice(_a) {
|
|
|
1448
1442
|
function ActualInvoice() {
|
|
1449
1443
|
// Context
|
|
1450
1444
|
var queryClient = reactQuery.useQueryClient();
|
|
1451
|
-
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;
|
|
1452
1446
|
var _b = react.useContext(BunnyContext), apiHost = _b.apiHost, onTokenExpired = _b.onTokenExpired, graphQLClient = _b.graphQLClient;
|
|
1453
1447
|
var _c = react.useContext(InvoiceQuoteContext), hideDownloadButton = _c.hideDownloadButton, onInvoiceLoaded = _c.onInvoiceLoaded;
|
|
1454
1448
|
var token = useToken();
|
|
@@ -1457,7 +1451,7 @@ function ActualInvoice() {
|
|
|
1457
1451
|
var handleAllErrorFormats = common.useAllErrorFormats(onTokenExpired);
|
|
1458
1452
|
// Queries
|
|
1459
1453
|
var formattedInvoice = reactQuery.useQuery({
|
|
1460
|
-
queryKey: common.QueryKeyFactory.default.createFormattedInvoiceKey(id, token),
|
|
1454
|
+
queryKey: common.QueryKeyFactory.default.createFormattedInvoiceKey({ id: id, token: token }),
|
|
1461
1455
|
queryFn: function () { return common.getFormattedInvoice({ id: id, token: token, apiHost: apiHost }); },
|
|
1462
1456
|
}).data;
|
|
1463
1457
|
// Derived state
|
|
@@ -1466,12 +1460,13 @@ function ActualInvoice() {
|
|
|
1466
1460
|
var isMobile = common.useIsMobile(isInvoicePayable ? common.BreakpointNumbers.lg : undefined);
|
|
1467
1461
|
var onSuccess = function () {
|
|
1468
1462
|
queryClient.invalidateQueries({
|
|
1469
|
-
queryKey: common.QueryKeyFactory.default.transactionsKey(token),
|
|
1463
|
+
queryKey: common.QueryKeyFactory.default.transactionsKey({ token: token }),
|
|
1470
1464
|
});
|
|
1471
1465
|
queryClient.invalidateQueries({
|
|
1472
|
-
queryKey: common.QueryKeyFactory.default.createFormattedInvoiceKey(id, token),
|
|
1466
|
+
queryKey: common.QueryKeyFactory.default.createFormattedInvoiceKey({ id: id, token: token }),
|
|
1473
1467
|
});
|
|
1474
1468
|
showSuccessNotification("Your invoice has been paid", "Payment successful");
|
|
1469
|
+
onPaymentSuccess === null || onPaymentSuccess === void 0 ? void 0 : onPaymentSuccess();
|
|
1475
1470
|
};
|
|
1476
1471
|
var onFail = function (error) {
|
|
1477
1472
|
handleAllErrorFormats(error.message);
|
|
@@ -1511,11 +1506,7 @@ var getFormattedQuote = function (_a) {
|
|
|
1511
1506
|
};
|
|
1512
1507
|
|
|
1513
1508
|
var filterSigningPlugins = function (plugins) {
|
|
1514
|
-
return plugins === null || plugins === void 0 ? void 0 : plugins.filter(function (plugin) {
|
|
1515
|
-
var _a, _b;
|
|
1516
|
-
return ((_a = plugin.type) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === "signing" &&
|
|
1517
|
-
((_b = plugin.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === "valid";
|
|
1518
|
-
});
|
|
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"; });
|
|
1519
1510
|
};
|
|
1520
1511
|
var useSigningPlugins = function (_a) {
|
|
1521
1512
|
var entityId = _a.entityId, apiHost = _a.apiHost, token = _a.token;
|
|
@@ -1576,10 +1567,10 @@ var useSendAcceptQuote = function (_a) {
|
|
|
1576
1567
|
});
|
|
1577
1568
|
client.on("sign", function (data) {
|
|
1578
1569
|
queryClient.refetchQueries({
|
|
1579
|
-
queryKey: common.QueryKeyFactory.default.createQuoteKey(quoteId, token),
|
|
1570
|
+
queryKey: common.QueryKeyFactory.default.createQuoteKey({ id: quoteId, token: token }),
|
|
1580
1571
|
});
|
|
1581
1572
|
queryClient.refetchQueries({
|
|
1582
|
-
queryKey: common.QueryKeyFactory.default.createQuoteKey(token),
|
|
1573
|
+
queryKey: common.QueryKeyFactory.default.createQuoteKey({ id: quoteId, token: token }),
|
|
1583
1574
|
});
|
|
1584
1575
|
});
|
|
1585
1576
|
// Open the DropboxSign modal
|
|
@@ -1600,10 +1591,10 @@ var useSendAcceptQuote = function (_a) {
|
|
|
1600
1591
|
else {
|
|
1601
1592
|
setAcceptBoxVisible(false);
|
|
1602
1593
|
queryClient.invalidateQueries({
|
|
1603
|
-
queryKey: common.QueryKeyFactory.default.createQuoteKey(quoteId, token),
|
|
1594
|
+
queryKey: common.QueryKeyFactory.default.createQuoteKey({ id: quoteId, token: token }),
|
|
1604
1595
|
});
|
|
1605
1596
|
queryClient.invalidateQueries({
|
|
1606
|
-
queryKey: common.QueryKeyFactory.default.createQuoteKey(token),
|
|
1597
|
+
queryKey: common.QueryKeyFactory.default.createQuoteKey({ id: quoteId, token: token }),
|
|
1607
1598
|
});
|
|
1608
1599
|
}
|
|
1609
1600
|
}, token);
|
|
@@ -1640,7 +1631,7 @@ var useSigningComplete = function (_a) {
|
|
|
1640
1631
|
react.useEffect(function () {
|
|
1641
1632
|
if (data && eventParam === "signing_complete") {
|
|
1642
1633
|
data.state = "ACCEPTED";
|
|
1643
|
-
queryClient.setQueryData(common.QueryKeyFactory.default.createQuoteKey(token), data);
|
|
1634
|
+
queryClient.setQueryData(common.QueryKeyFactory.default.createQuoteKey({ id: data === null || data === void 0 ? void 0 : data.id, token: token }), data);
|
|
1644
1635
|
}
|
|
1645
1636
|
}, [data, eventParam, queryClient, token]);
|
|
1646
1637
|
};
|
|
@@ -1759,7 +1750,7 @@ function ActualQuote(_a) {
|
|
|
1759
1750
|
var _e = react.useContext(InvoiceQuoteContext), className = _e.className, id = _e.id, hideDownloadButton = _e.hideDownloadButton, onQuoteLoaded = _e.onQuoteLoaded;
|
|
1760
1751
|
// Queries
|
|
1761
1752
|
var _f = reactQuery.useQuery({
|
|
1762
|
-
queryKey: common.QueryKeyFactory.default.createQuoteKey(id, token),
|
|
1753
|
+
queryKey: common.QueryKeyFactory.default.createQuoteKey({ id: id, token: token }),
|
|
1763
1754
|
queryFn: function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1764
1755
|
var error_1;
|
|
1765
1756
|
return __generator(this, function (_a) {
|
|
@@ -1804,11 +1795,7 @@ function ActualQuote(_a) {
|
|
|
1804
1795
|
var isAccepted = formattedQuote.state === "ACCEPTED";
|
|
1805
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: {
|
|
1806
1797
|
color: entityBranding.secondaryColor,
|
|
1807
|
-
} }, { 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
|
|
1808
|
-
? "flex w-full justify-end gap-2"
|
|
1809
|
-
: "flex items-center justify-end gap-2" }, { children: [!isMobile && !hideDownloadButton ? (jsxRuntime.jsx(antd.Button, __assign({ icon: jsxRuntime.jsx(icons.DownloadOutlined, {}), onClick: function () {
|
|
1810
|
-
return downloadFile(apiHost + "/api/pdf/quote", token);
|
|
1811
|
-
} }, { 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) {
|
|
1812
1799
|
return (jsxRuntime.jsx(antd.Button, __assign({ download: doc.filename, href: doc.url, type: "link" }, { children: doc.filename }), index));
|
|
1813
1800
|
}) }))) : null }))] })), jsxRuntime.jsx(AcceptQuoteModal, { acceptBoxVisible: acceptBoxVisible, formattedQuote: formattedQuote, setAcceptBoxVisible: setAcceptBoxVisible, setIsAccepting: setIsAccepting, sendAccept: sendAccept }), jsxRuntime.jsx(PandadocPollingModal, { isVisible: pandadocPollingModalVisible, setVisible: setPandadocPollingModalVisible, id: id })] }));
|
|
1814
1801
|
}
|
|
@@ -19528,18 +19515,18 @@ var PaymentMethod = function (_a) {
|
|
|
19528
19515
|
var paymentPlugins = usePaymentPlugins({ entityId: entityId, apiHost: apiHost, token: token }).paymentPlugins;
|
|
19529
19516
|
var showSuccessNotification = common.useSuccessNotification();
|
|
19530
19517
|
var handleAllErrorFormats = common.useAllErrorFormats(onTokenExpired);
|
|
19531
|
-
var data = usePaymentMethod(
|
|
19518
|
+
var data = usePaymentMethod({ entityId: entityId, graphQLClient: graphQLClient, token: token }).data;
|
|
19532
19519
|
var onClickRemove = useRemovePaymentMethod(paymentPlugins || [], apiHost, entityId, token);
|
|
19533
19520
|
// Queries
|
|
19534
19521
|
var billingDetails = reactQuery.useQuery({
|
|
19535
|
-
queryKey: common.QueryKeyFactory.default.billingDetailsKey(entityId, token),
|
|
19522
|
+
queryKey: common.QueryKeyFactory.default.billingDetailsKey({ entityId: entityId, token: token }),
|
|
19536
19523
|
queryFn: function () { return getBillingDetails({ token: token, apiHost: apiHost }); },
|
|
19537
19524
|
}).data;
|
|
19538
19525
|
// Local state
|
|
19539
19526
|
var _g = react.useState(false), showModal = _g[0], setShowModal = _g[1];
|
|
19540
19527
|
var onSuccess = function () {
|
|
19541
19528
|
queryClient.invalidateQueries({
|
|
19542
|
-
queryKey: common.QueryKeyFactory.default.accountPaymentMethodKey(entityId, token),
|
|
19529
|
+
queryKey: common.QueryKeyFactory.default.accountPaymentMethodKey({ entityId: entityId, token: token }),
|
|
19543
19530
|
});
|
|
19544
19531
|
setShowModal(false);
|
|
19545
19532
|
showSuccessNotification("Your payment method has been saved");
|
|
@@ -19787,16 +19774,13 @@ var Checkout = function (_a) {
|
|
|
19787
19774
|
}), taxationRequiredAccountFields = _f.data, isLoadingTaxationRequiredAccountFields = _f.isLoading;
|
|
19788
19775
|
var _g = reactQuery.useQuery({
|
|
19789
19776
|
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,
|
|
19777
|
+
queryFn: function () { return (quote === null || quote === void 0 ? void 0 : quote.accountId) && common.getAccount({ id: quote.accountId, token: token, apiHost: apiHost }); },
|
|
19778
|
+
enabled: Boolean(quote === null || quote === void 0 ? void 0 : quote.accountId) && ((taxationRequiredAccountFields === null || taxationRequiredAccountFields === void 0 ? void 0 : taxationRequiredAccountFields.length) || 0) > 0,
|
|
19795
19779
|
}), account = _g.data, isLoadingAccount = _g.isLoading;
|
|
19796
19780
|
reactQuery.useQuery({
|
|
19797
|
-
queryKey: queryKeyFactory.createQuoteTaxCalculateKey(quote === null || quote === void 0 ? void 0 : quote.id, token),
|
|
19781
|
+
queryKey: queryKeyFactory.createQuoteTaxCalculateKey({ id: quote === null || quote === void 0 ? void 0 : quote.id, token: token }),
|
|
19798
19782
|
queryFn: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
19799
|
-
var updatedQuote;
|
|
19783
|
+
var updatedQuote, quoteKey, calculatedPricesKey;
|
|
19800
19784
|
return __generator(this, function (_a) {
|
|
19801
19785
|
switch (_a.label) {
|
|
19802
19786
|
case 0:
|
|
@@ -19809,8 +19793,14 @@ var Checkout = function (_a) {
|
|
|
19809
19793
|
case 1:
|
|
19810
19794
|
updatedQuote = _a.sent();
|
|
19811
19795
|
if (updatedQuote) {
|
|
19812
|
-
|
|
19813
|
-
|
|
19796
|
+
quoteKey = queryKeyFactory.createObjectKey({ objectName: "editingQuote", id: updatedQuote.id, token: token });
|
|
19797
|
+
calculatedPricesKey = queryKeyFactory.calculatedPricesKey({
|
|
19798
|
+
quantity: quantity,
|
|
19799
|
+
priceListId: selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id,
|
|
19800
|
+
token: token,
|
|
19801
|
+
});
|
|
19802
|
+
queryClient.setQueryData(quoteKey, updatedQuote);
|
|
19803
|
+
queryClient.setQueryData(calculatedPricesKey, updatedQuote);
|
|
19814
19804
|
}
|
|
19815
19805
|
_a.label = 2;
|
|
19816
19806
|
case 2: return [2 /*return*/, {}];
|
|
@@ -19974,7 +19964,11 @@ function Signup(_a) {
|
|
|
19974
19964
|
var _h = react.useState(false), proceedingToPayment = _h[0], setProceedingToPayment = _h[1];
|
|
19975
19965
|
var _j = react.useState(false), purchaseSucceeded = _j[0], setPurchaseSucceeded = _j[1];
|
|
19976
19966
|
var _k = react.useState(undefined), paymentMethodGraphQLClient = _k[0], setPaymentMethodGraphQLClient = _k[1];
|
|
19977
|
-
var paymentMethod = usePaymentMethod(
|
|
19967
|
+
var paymentMethod = usePaymentMethod({
|
|
19968
|
+
entityId: entityId,
|
|
19969
|
+
graphQLClient: paymentMethodGraphQLClient || graphQLClient,
|
|
19970
|
+
token: token,
|
|
19971
|
+
}).data;
|
|
19978
19972
|
var queryClient = reactQuery.useQueryClient();
|
|
19979
19973
|
// Queries
|
|
19980
19974
|
var priceListData = reactQuery.useQuery({
|
|
@@ -20009,7 +20003,7 @@ function Signup(_a) {
|
|
|
20009
20003
|
// We must invalidate the accountPaymentMethodKey query in order to clear payment methods from the provided api token,
|
|
20010
20004
|
// to instead use paymentMethods from portalSessionToken.
|
|
20011
20005
|
queryClient.invalidateQueries({
|
|
20012
|
-
queryKey: common.QueryKeyFactory.default.accountPaymentMethodKey(entityId, token),
|
|
20006
|
+
queryKey: common.QueryKeyFactory.default.accountPaymentMethodKey({ entityId: entityId, token: token }),
|
|
20013
20007
|
});
|
|
20014
20008
|
setProceedingToPayment(false);
|
|
20015
20009
|
setQuote(data.quote);
|
|
@@ -20068,9 +20062,7 @@ function Signup(_a) {
|
|
|
20068
20062
|
var children = _a.children, className = _a.className, style = _a.style;
|
|
20069
20063
|
return isCardEnabled ? (jsxRuntime.jsx(Card, __assign({ className: className, style: style }, { children: children }))) : (jsxRuntime.jsx("div", __assign({ className: className, style: style }, { children: children })));
|
|
20070
20064
|
};
|
|
20071
|
-
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
|
|
20072
|
-
? "items-center justify-center my-12"
|
|
20073
|
-
: "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 }) })) }))] }))) })));
|
|
20074
20066
|
}
|
|
20075
20067
|
|
|
20076
20068
|
// WARNING: There is a preview button on APP that will need to be changed if this query is changed
|
|
@@ -20616,12 +20608,16 @@ var Subscriptions = function (_a) {
|
|
|
20616
20608
|
var token = useToken();
|
|
20617
20609
|
// Queries
|
|
20618
20610
|
var _d = reactQuery.useQuery({
|
|
20619
|
-
queryKey: common.QueryKeyFactory.default.createTableKey(
|
|
20611
|
+
queryKey: common.QueryKeyFactory.default.createTableKey({
|
|
20612
|
+
filterString: "entityId=".concat(entityId),
|
|
20613
|
+
pluralType: "subscriptions",
|
|
20614
|
+
token: token,
|
|
20615
|
+
}),
|
|
20620
20616
|
queryFn: function () { return getSubscriptions({ entityId: entityId, token: token, apiHost: apiHost }); },
|
|
20621
20617
|
enabled: Boolean(entityId),
|
|
20622
20618
|
}), rawSubscriptions = _d.data, subscriptionsAreLoading = _d.isLoading;
|
|
20623
20619
|
var _e = reactQuery.useQuery({
|
|
20624
|
-
queryKey: common.QueryKeyFactory.default.planChangeOptionsKey(token),
|
|
20620
|
+
queryKey: common.QueryKeyFactory.default.planChangeOptionsKey({ token: token }),
|
|
20625
20621
|
queryFn: function () { return getPlanChangeOptions({ token: token, apiHost: apiHost }); },
|
|
20626
20622
|
enabled: Boolean(onChangePlanClick),
|
|
20627
20623
|
}), planChangeOptions = _e.data, arePlanChangeOptionsLoading = _e.isLoading;
|
|
@@ -20631,8 +20627,7 @@ var Subscriptions = function (_a) {
|
|
|
20631
20627
|
if (subscriptions)
|
|
20632
20628
|
onSubscriptionsLoaded === null || onSubscriptionsLoaded === void 0 ? void 0 : onSubscriptionsLoaded(subscriptions);
|
|
20633
20629
|
}, [subscriptions]);
|
|
20634
|
-
if (subscriptionsAreLoading ||
|
|
20635
|
-
(Boolean(onChangePlanClick) ? arePlanChangeOptionsLoading : false))
|
|
20630
|
+
if (subscriptionsAreLoading || (Boolean(onChangePlanClick) ? arePlanChangeOptionsLoading : false))
|
|
20636
20631
|
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
20637
20632
|
return (jsxRuntime.jsx(SubscriptionsContext.Provider, __assign({ value: {
|
|
20638
20633
|
gap: gap,
|
|
@@ -20686,7 +20681,7 @@ function BillingDetailsSection(_a) {
|
|
|
20686
20681
|
var showSuccessNotification = common.useSuccessNotification();
|
|
20687
20682
|
// Queries
|
|
20688
20683
|
var _d = reactQuery.useQuery({
|
|
20689
|
-
queryKey: common.QueryKeyFactory.default.billingDetailsKey(entityId, token),
|
|
20684
|
+
queryKey: common.QueryKeyFactory.default.billingDetailsKey({ entityId: entityId, token: token }),
|
|
20690
20685
|
queryFn: function () { return getBillingDetails({ token: token, apiHost: apiHost }); },
|
|
20691
20686
|
}), billingDetails = _d.data, isLoadingBillingDetails = _d.isLoading;
|
|
20692
20687
|
var _e = reactQuery.useMutation({
|
|
@@ -20710,7 +20705,7 @@ function BillingDetailsSection(_a) {
|
|
|
20710
20705
|
})];
|
|
20711
20706
|
case 1:
|
|
20712
20707
|
updatedBillingDetails = _a.sent();
|
|
20713
|
-
queryClient.setQueryData(common.QueryKeyFactory.default.billingDetailsKey(entityId, token), function (old) {
|
|
20708
|
+
queryClient.setQueryData(common.QueryKeyFactory.default.billingDetailsKey({ entityId: entityId, token: token }), function (old) {
|
|
20714
20709
|
return __assign(__assign({}, old), updatedBillingDetails.billingDetails);
|
|
20715
20710
|
});
|
|
20716
20711
|
return [2 /*return*/, updatedBillingDetails];
|
|
@@ -20720,7 +20715,7 @@ function BillingDetailsSection(_a) {
|
|
|
20720
20715
|
onSuccess: function () {
|
|
20721
20716
|
showSuccessNotification("Your account details have been saved");
|
|
20722
20717
|
queryClient.invalidateQueries({
|
|
20723
|
-
queryKey: common.QueryKeyFactory.default.taxationRequiredAccountFieldsKey(entityId, token),
|
|
20718
|
+
queryKey: common.QueryKeyFactory.default.taxationRequiredAccountFieldsKey({ entityId: entityId, token: token }),
|
|
20724
20719
|
});
|
|
20725
20720
|
},
|
|
20726
20721
|
}), updateBillingDetails = _e.mutate, isUpdatingBillingDetails = _e.isPending;
|
|
@@ -20801,9 +20796,7 @@ function BillingDetailsSection(_a) {
|
|
|
20801
20796
|
});
|
|
20802
20797
|
}); };
|
|
20803
20798
|
var filteredCountryList = react.useMemo(function () {
|
|
20804
|
-
return countryListFilter
|
|
20805
|
-
? common.Lists.COUNTRY_LIST.filter(countryListFilter)
|
|
20806
|
-
: common.Lists.COUNTRY_LIST;
|
|
20799
|
+
return countryListFilter ? common.Lists.COUNTRY_LIST.filter(countryListFilter) : common.Lists.COUNTRY_LIST;
|
|
20807
20800
|
}, [countryListFilter]);
|
|
20808
20801
|
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
20802
|
{
|
|
@@ -20811,12 +20804,8 @@ function BillingDetailsSection(_a) {
|
|
|
20811
20804
|
},
|
|
20812
20805
|
] }, { 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
20806
|
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());
|
|
20807
|
+
return ((_a = option === null || option === void 0 ? void 0 : option.label) !== null && _a !== void 0 ? _a : "").toLowerCase().includes(input.toLowerCase()) ||
|
|
20808
|
+
((_b = option === null || option === void 0 ? void 0 : option.value) !== null && _b !== void 0 ? _b : "").toLowerCase().includes(input.toLowerCase());
|
|
20820
20809
|
} }) }))] })), jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Email", name: "billingContactEmail", rules: [
|
|
20821
20810
|
{
|
|
20822
20811
|
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,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;
|
|
@@ -4,7 +4,7 @@ declare const useSendAcceptQuote: ({ entityId, onTokenExpired, quoteId, apiHost,
|
|
|
4
4
|
onTokenExpired?: (() => void) | undefined;
|
|
5
5
|
quoteId?: string | undefined;
|
|
6
6
|
apiHost: string;
|
|
7
|
-
token
|
|
7
|
+
token: string;
|
|
8
8
|
}) => {
|
|
9
9
|
acceptBoxVisible: boolean;
|
|
10
10
|
isAccepting: boolean;
|
|
@@ -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
|
};
|
|
@@ -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;
|
|
@@ -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
|
|
|
@@ -1301,7 +1294,7 @@ function useRemovePaymentMethod(paymentPlugins, apiHost, entityId, token, accoun
|
|
|
1301
1294
|
})
|
|
1302
1295
|
.then(function () {
|
|
1303
1296
|
showSuccessNotification("Payment method was removed", "Success");
|
|
1304
|
-
queryClient.setQueryData(QueryKeyFactory.default.accountPaymentMethodKey(entityId, token, accountId), null);
|
|
1297
|
+
queryClient.setQueryData(QueryKeyFactory.default.accountPaymentMethodKey({ entityId: entityId, token: token, accountId: accountId }), null);
|
|
1305
1298
|
})
|
|
1306
1299
|
.catch(function (error) {
|
|
1307
1300
|
showErrorNotification(error.message, "Error removing payment method");
|
|
@@ -1324,14 +1317,17 @@ var PaymentForm = function (_a) {
|
|
|
1324
1317
|
var _d = useState(), selectedPaymentMethod = _d[0], setSelectedPaymentMethod = _d[1];
|
|
1325
1318
|
var _e = useState(false), showPaymentMethodForm = _e[0], setShowPaymentMethodForm = _e[1];
|
|
1326
1319
|
var paying = !!(quote || invoice);
|
|
1327
|
-
var currencyId = (_b = ((quote === null || quote === void 0 ? void 0 : quote.currencyId) ||
|
|
1328
|
-
(invoice === null || invoice === void 0 ? void 0 : invoice.currencyId) ||
|
|
1329
|
-
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();
|
|
1330
1321
|
// Hooks
|
|
1331
1322
|
var apiHost = useContext(BunnyContext).apiHost;
|
|
1332
1323
|
var tokenFromContexts = useToken();
|
|
1333
1324
|
var token = overrideToken || tokenFromContexts;
|
|
1334
|
-
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;
|
|
1335
1331
|
var isPaymentMethodFetched = storedPaymentMethod !== undefined;
|
|
1336
1332
|
var _g = usePaymentPlugins({ entityId: entityId, apiHost: apiHost, token: token }), allPaymentMethodAllowedPlugins = _g.paymentMethodAllowedPlugins, allPaymentPlugins = _g.paymentPlugins, arePluginsFetched = _g.isFetched;
|
|
1337
1333
|
var paymentMethodAllowedPlugins = useMemo(function () {
|
|
@@ -1344,9 +1340,7 @@ var PaymentForm = function (_a) {
|
|
|
1344
1340
|
var queryClient = useQueryClient();
|
|
1345
1341
|
// Set default plugin
|
|
1346
1342
|
useEffect(function () {
|
|
1347
|
-
if (!arePluginsFetched ||
|
|
1348
|
-
!isPaymentMethodFetched ||
|
|
1349
|
-
selectedPaymentMethod) {
|
|
1343
|
+
if (!arePluginsFetched || !isPaymentMethodFetched || selectedPaymentMethod) {
|
|
1350
1344
|
return;
|
|
1351
1345
|
}
|
|
1352
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()); });
|
|
@@ -1375,7 +1369,7 @@ var PaymentForm = function (_a) {
|
|
|
1375
1369
|
};
|
|
1376
1370
|
var handleSavePaymentMethod = function () {
|
|
1377
1371
|
queryClient.invalidateQueries({
|
|
1378
|
-
queryKey: QueryKeyFactory.default.accountPaymentMethodKey(entityId, token
|
|
1372
|
+
queryKey: QueryKeyFactory.default.accountPaymentMethodKey({ accountId: accountId, entityId: entityId, token: token }),
|
|
1379
1373
|
});
|
|
1380
1374
|
onSavePaymentMethod === null || onSavePaymentMethod === void 0 ? void 0 : onSavePaymentMethod();
|
|
1381
1375
|
setShowPaymentMethodForm(false);
|
|
@@ -1420,7 +1414,7 @@ function Invoice(_a) {
|
|
|
1420
1414
|
function ActualInvoice() {
|
|
1421
1415
|
// Context
|
|
1422
1416
|
var queryClient = useQueryClient();
|
|
1423
|
-
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;
|
|
1424
1418
|
var _b = useContext(BunnyContext), apiHost = _b.apiHost, onTokenExpired = _b.onTokenExpired, graphQLClient = _b.graphQLClient;
|
|
1425
1419
|
var _c = useContext(InvoiceQuoteContext), hideDownloadButton = _c.hideDownloadButton, onInvoiceLoaded = _c.onInvoiceLoaded;
|
|
1426
1420
|
var token = useToken();
|
|
@@ -1429,7 +1423,7 @@ function ActualInvoice() {
|
|
|
1429
1423
|
var handleAllErrorFormats = useAllErrorFormats(onTokenExpired);
|
|
1430
1424
|
// Queries
|
|
1431
1425
|
var formattedInvoice = useQuery({
|
|
1432
|
-
queryKey: QueryKeyFactory.default.createFormattedInvoiceKey(id, token),
|
|
1426
|
+
queryKey: QueryKeyFactory.default.createFormattedInvoiceKey({ id: id, token: token }),
|
|
1433
1427
|
queryFn: function () { return getFormattedInvoice({ id: id, token: token, apiHost: apiHost }); },
|
|
1434
1428
|
}).data;
|
|
1435
1429
|
// Derived state
|
|
@@ -1438,12 +1432,13 @@ function ActualInvoice() {
|
|
|
1438
1432
|
var isMobile = useIsMobile(isInvoicePayable ? BreakpointNumbers.lg : undefined);
|
|
1439
1433
|
var onSuccess = function () {
|
|
1440
1434
|
queryClient.invalidateQueries({
|
|
1441
|
-
queryKey: QueryKeyFactory.default.transactionsKey(token),
|
|
1435
|
+
queryKey: QueryKeyFactory.default.transactionsKey({ token: token }),
|
|
1442
1436
|
});
|
|
1443
1437
|
queryClient.invalidateQueries({
|
|
1444
|
-
queryKey: QueryKeyFactory.default.createFormattedInvoiceKey(id, token),
|
|
1438
|
+
queryKey: QueryKeyFactory.default.createFormattedInvoiceKey({ id: id, token: token }),
|
|
1445
1439
|
});
|
|
1446
1440
|
showSuccessNotification("Your invoice has been paid", "Payment successful");
|
|
1441
|
+
onPaymentSuccess === null || onPaymentSuccess === void 0 ? void 0 : onPaymentSuccess();
|
|
1447
1442
|
};
|
|
1448
1443
|
var onFail = function (error) {
|
|
1449
1444
|
handleAllErrorFormats(error.message);
|
|
@@ -1483,11 +1478,7 @@ var getFormattedQuote = function (_a) {
|
|
|
1483
1478
|
};
|
|
1484
1479
|
|
|
1485
1480
|
var filterSigningPlugins = function (plugins) {
|
|
1486
|
-
return plugins === null || plugins === void 0 ? void 0 : plugins.filter(function (plugin) {
|
|
1487
|
-
var _a, _b;
|
|
1488
|
-
return ((_a = plugin.type) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === "signing" &&
|
|
1489
|
-
((_b = plugin.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === "valid";
|
|
1490
|
-
});
|
|
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"; });
|
|
1491
1482
|
};
|
|
1492
1483
|
var useSigningPlugins = function (_a) {
|
|
1493
1484
|
var entityId = _a.entityId, apiHost = _a.apiHost, token = _a.token;
|
|
@@ -1548,10 +1539,10 @@ var useSendAcceptQuote = function (_a) {
|
|
|
1548
1539
|
});
|
|
1549
1540
|
client.on("sign", function (data) {
|
|
1550
1541
|
queryClient.refetchQueries({
|
|
1551
|
-
queryKey: QueryKeyFactory.default.createQuoteKey(quoteId, token),
|
|
1542
|
+
queryKey: QueryKeyFactory.default.createQuoteKey({ id: quoteId, token: token }),
|
|
1552
1543
|
});
|
|
1553
1544
|
queryClient.refetchQueries({
|
|
1554
|
-
queryKey: QueryKeyFactory.default.createQuoteKey(token),
|
|
1545
|
+
queryKey: QueryKeyFactory.default.createQuoteKey({ id: quoteId, token: token }),
|
|
1555
1546
|
});
|
|
1556
1547
|
});
|
|
1557
1548
|
// Open the DropboxSign modal
|
|
@@ -1572,10 +1563,10 @@ var useSendAcceptQuote = function (_a) {
|
|
|
1572
1563
|
else {
|
|
1573
1564
|
setAcceptBoxVisible(false);
|
|
1574
1565
|
queryClient.invalidateQueries({
|
|
1575
|
-
queryKey: QueryKeyFactory.default.createQuoteKey(quoteId, token),
|
|
1566
|
+
queryKey: QueryKeyFactory.default.createQuoteKey({ id: quoteId, token: token }),
|
|
1576
1567
|
});
|
|
1577
1568
|
queryClient.invalidateQueries({
|
|
1578
|
-
queryKey: QueryKeyFactory.default.createQuoteKey(token),
|
|
1569
|
+
queryKey: QueryKeyFactory.default.createQuoteKey({ id: quoteId, token: token }),
|
|
1579
1570
|
});
|
|
1580
1571
|
}
|
|
1581
1572
|
}, token);
|
|
@@ -1612,7 +1603,7 @@ var useSigningComplete = function (_a) {
|
|
|
1612
1603
|
useEffect(function () {
|
|
1613
1604
|
if (data && eventParam === "signing_complete") {
|
|
1614
1605
|
data.state = "ACCEPTED";
|
|
1615
|
-
queryClient.setQueryData(QueryKeyFactory.default.createQuoteKey(token), data);
|
|
1606
|
+
queryClient.setQueryData(QueryKeyFactory.default.createQuoteKey({ id: data === null || data === void 0 ? void 0 : data.id, token: token }), data);
|
|
1616
1607
|
}
|
|
1617
1608
|
}, [data, eventParam, queryClient, token]);
|
|
1618
1609
|
};
|
|
@@ -1731,7 +1722,7 @@ function ActualQuote(_a) {
|
|
|
1731
1722
|
var _e = useContext(InvoiceQuoteContext), className = _e.className, id = _e.id, hideDownloadButton = _e.hideDownloadButton, onQuoteLoaded = _e.onQuoteLoaded;
|
|
1732
1723
|
// Queries
|
|
1733
1724
|
var _f = useQuery({
|
|
1734
|
-
queryKey: QueryKeyFactory.default.createQuoteKey(id, token),
|
|
1725
|
+
queryKey: QueryKeyFactory.default.createQuoteKey({ id: id, token: token }),
|
|
1735
1726
|
queryFn: function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1736
1727
|
var error_1;
|
|
1737
1728
|
return __generator(this, function (_a) {
|
|
@@ -1776,11 +1767,7 @@ function ActualQuote(_a) {
|
|
|
1776
1767
|
var isAccepted = formattedQuote.state === "ACCEPTED";
|
|
1777
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: {
|
|
1778
1769
|
color: entityBranding.secondaryColor,
|
|
1779
|
-
} }, { 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
|
|
1780
|
-
? "flex w-full justify-end gap-2"
|
|
1781
|
-
: "flex items-center justify-end gap-2" }, { children: [!isMobile && !hideDownloadButton ? (jsx(Button, __assign({ icon: jsx(DownloadOutlined, {}), onClick: function () {
|
|
1782
|
-
return downloadFile(apiHost + "/api/pdf/quote", token);
|
|
1783
|
-
} }, { 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) {
|
|
1784
1771
|
return (jsx(Button, __assign({ download: doc.filename, href: doc.url, type: "link" }, { children: doc.filename }), index));
|
|
1785
1772
|
}) }))) : null }))] })), jsx(AcceptQuoteModal, { acceptBoxVisible: acceptBoxVisible, formattedQuote: formattedQuote, setAcceptBoxVisible: setAcceptBoxVisible, setIsAccepting: setIsAccepting, sendAccept: sendAccept }), jsx(PandadocPollingModal, { isVisible: pandadocPollingModalVisible, setVisible: setPandadocPollingModalVisible, id: id })] }));
|
|
1786
1773
|
}
|
|
@@ -19500,18 +19487,18 @@ var PaymentMethod = function (_a) {
|
|
|
19500
19487
|
var paymentPlugins = usePaymentPlugins({ entityId: entityId, apiHost: apiHost, token: token }).paymentPlugins;
|
|
19501
19488
|
var showSuccessNotification = useSuccessNotification();
|
|
19502
19489
|
var handleAllErrorFormats = useAllErrorFormats(onTokenExpired);
|
|
19503
|
-
var data = usePaymentMethod(
|
|
19490
|
+
var data = usePaymentMethod({ entityId: entityId, graphQLClient: graphQLClient, token: token }).data;
|
|
19504
19491
|
var onClickRemove = useRemovePaymentMethod(paymentPlugins || [], apiHost, entityId, token);
|
|
19505
19492
|
// Queries
|
|
19506
19493
|
var billingDetails = useQuery({
|
|
19507
|
-
queryKey: QueryKeyFactory.default.billingDetailsKey(entityId, token),
|
|
19494
|
+
queryKey: QueryKeyFactory.default.billingDetailsKey({ entityId: entityId, token: token }),
|
|
19508
19495
|
queryFn: function () { return getBillingDetails({ token: token, apiHost: apiHost }); },
|
|
19509
19496
|
}).data;
|
|
19510
19497
|
// Local state
|
|
19511
19498
|
var _g = useState(false), showModal = _g[0], setShowModal = _g[1];
|
|
19512
19499
|
var onSuccess = function () {
|
|
19513
19500
|
queryClient.invalidateQueries({
|
|
19514
|
-
queryKey: QueryKeyFactory.default.accountPaymentMethodKey(entityId, token),
|
|
19501
|
+
queryKey: QueryKeyFactory.default.accountPaymentMethodKey({ entityId: entityId, token: token }),
|
|
19515
19502
|
});
|
|
19516
19503
|
setShowModal(false);
|
|
19517
19504
|
showSuccessNotification("Your payment method has been saved");
|
|
@@ -19759,16 +19746,13 @@ var Checkout = function (_a) {
|
|
|
19759
19746
|
}), taxationRequiredAccountFields = _f.data, isLoadingTaxationRequiredAccountFields = _f.isLoading;
|
|
19760
19747
|
var _g = useQuery({
|
|
19761
19748
|
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,
|
|
19749
|
+
queryFn: function () { return (quote === null || quote === void 0 ? void 0 : quote.accountId) && getAccount({ id: quote.accountId, token: token, apiHost: apiHost }); },
|
|
19750
|
+
enabled: Boolean(quote === null || quote === void 0 ? void 0 : quote.accountId) && ((taxationRequiredAccountFields === null || taxationRequiredAccountFields === void 0 ? void 0 : taxationRequiredAccountFields.length) || 0) > 0,
|
|
19767
19751
|
}), account = _g.data, isLoadingAccount = _g.isLoading;
|
|
19768
19752
|
useQuery({
|
|
19769
|
-
queryKey: queryKeyFactory.createQuoteTaxCalculateKey(quote === null || quote === void 0 ? void 0 : quote.id, token),
|
|
19753
|
+
queryKey: queryKeyFactory.createQuoteTaxCalculateKey({ id: quote === null || quote === void 0 ? void 0 : quote.id, token: token }),
|
|
19770
19754
|
queryFn: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
19771
|
-
var updatedQuote;
|
|
19755
|
+
var updatedQuote, quoteKey, calculatedPricesKey;
|
|
19772
19756
|
return __generator(this, function (_a) {
|
|
19773
19757
|
switch (_a.label) {
|
|
19774
19758
|
case 0:
|
|
@@ -19781,8 +19765,14 @@ var Checkout = function (_a) {
|
|
|
19781
19765
|
case 1:
|
|
19782
19766
|
updatedQuote = _a.sent();
|
|
19783
19767
|
if (updatedQuote) {
|
|
19784
|
-
|
|
19785
|
-
|
|
19768
|
+
quoteKey = queryKeyFactory.createObjectKey({ objectName: "editingQuote", id: updatedQuote.id, token: token });
|
|
19769
|
+
calculatedPricesKey = queryKeyFactory.calculatedPricesKey({
|
|
19770
|
+
quantity: quantity,
|
|
19771
|
+
priceListId: selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id,
|
|
19772
|
+
token: token,
|
|
19773
|
+
});
|
|
19774
|
+
queryClient.setQueryData(quoteKey, updatedQuote);
|
|
19775
|
+
queryClient.setQueryData(calculatedPricesKey, updatedQuote);
|
|
19786
19776
|
}
|
|
19787
19777
|
_a.label = 2;
|
|
19788
19778
|
case 2: return [2 /*return*/, {}];
|
|
@@ -19946,7 +19936,11 @@ function Signup(_a) {
|
|
|
19946
19936
|
var _h = useState(false), proceedingToPayment = _h[0], setProceedingToPayment = _h[1];
|
|
19947
19937
|
var _j = useState(false), purchaseSucceeded = _j[0], setPurchaseSucceeded = _j[1];
|
|
19948
19938
|
var _k = useState(undefined), paymentMethodGraphQLClient = _k[0], setPaymentMethodGraphQLClient = _k[1];
|
|
19949
|
-
var paymentMethod = usePaymentMethod(
|
|
19939
|
+
var paymentMethod = usePaymentMethod({
|
|
19940
|
+
entityId: entityId,
|
|
19941
|
+
graphQLClient: paymentMethodGraphQLClient || graphQLClient,
|
|
19942
|
+
token: token,
|
|
19943
|
+
}).data;
|
|
19950
19944
|
var queryClient = useQueryClient();
|
|
19951
19945
|
// Queries
|
|
19952
19946
|
var priceListData = useQuery({
|
|
@@ -19981,7 +19975,7 @@ function Signup(_a) {
|
|
|
19981
19975
|
// We must invalidate the accountPaymentMethodKey query in order to clear payment methods from the provided api token,
|
|
19982
19976
|
// to instead use paymentMethods from portalSessionToken.
|
|
19983
19977
|
queryClient.invalidateQueries({
|
|
19984
|
-
queryKey: QueryKeyFactory.default.accountPaymentMethodKey(entityId, token),
|
|
19978
|
+
queryKey: QueryKeyFactory.default.accountPaymentMethodKey({ entityId: entityId, token: token }),
|
|
19985
19979
|
});
|
|
19986
19980
|
setProceedingToPayment(false);
|
|
19987
19981
|
setQuote(data.quote);
|
|
@@ -20040,9 +20034,7 @@ function Signup(_a) {
|
|
|
20040
20034
|
var children = _a.children, className = _a.className, style = _a.style;
|
|
20041
20035
|
return isCardEnabled ? (jsx(Card, __assign({ className: className, style: style }, { children: children }))) : (jsx("div", __assign({ className: className, style: style }, { children: children })));
|
|
20042
20036
|
};
|
|
20043
|
-
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
|
|
20044
|
-
? "items-center justify-center my-12"
|
|
20045
|
-
: "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 }) })) }))] }))) })));
|
|
20046
20038
|
}
|
|
20047
20039
|
|
|
20048
20040
|
// WARNING: There is a preview button on APP that will need to be changed if this query is changed
|
|
@@ -20588,12 +20580,16 @@ var Subscriptions = function (_a) {
|
|
|
20588
20580
|
var token = useToken();
|
|
20589
20581
|
// Queries
|
|
20590
20582
|
var _d = useQuery({
|
|
20591
|
-
queryKey: QueryKeyFactory.default.createTableKey(
|
|
20583
|
+
queryKey: QueryKeyFactory.default.createTableKey({
|
|
20584
|
+
filterString: "entityId=".concat(entityId),
|
|
20585
|
+
pluralType: "subscriptions",
|
|
20586
|
+
token: token,
|
|
20587
|
+
}),
|
|
20592
20588
|
queryFn: function () { return getSubscriptions({ entityId: entityId, token: token, apiHost: apiHost }); },
|
|
20593
20589
|
enabled: Boolean(entityId),
|
|
20594
20590
|
}), rawSubscriptions = _d.data, subscriptionsAreLoading = _d.isLoading;
|
|
20595
20591
|
var _e = useQuery({
|
|
20596
|
-
queryKey: QueryKeyFactory.default.planChangeOptionsKey(token),
|
|
20592
|
+
queryKey: QueryKeyFactory.default.planChangeOptionsKey({ token: token }),
|
|
20597
20593
|
queryFn: function () { return getPlanChangeOptions({ token: token, apiHost: apiHost }); },
|
|
20598
20594
|
enabled: Boolean(onChangePlanClick),
|
|
20599
20595
|
}), planChangeOptions = _e.data, arePlanChangeOptionsLoading = _e.isLoading;
|
|
@@ -20603,8 +20599,7 @@ var Subscriptions = function (_a) {
|
|
|
20603
20599
|
if (subscriptions)
|
|
20604
20600
|
onSubscriptionsLoaded === null || onSubscriptionsLoaded === void 0 ? void 0 : onSubscriptionsLoaded(subscriptions);
|
|
20605
20601
|
}, [subscriptions]);
|
|
20606
|
-
if (subscriptionsAreLoading ||
|
|
20607
|
-
(Boolean(onChangePlanClick) ? arePlanChangeOptionsLoading : false))
|
|
20602
|
+
if (subscriptionsAreLoading || (Boolean(onChangePlanClick) ? arePlanChangeOptionsLoading : false))
|
|
20608
20603
|
return jsx(Fragment, {});
|
|
20609
20604
|
return (jsx(SubscriptionsContext.Provider, __assign({ value: {
|
|
20610
20605
|
gap: gap,
|
|
@@ -20658,7 +20653,7 @@ function BillingDetailsSection(_a) {
|
|
|
20658
20653
|
var showSuccessNotification = useSuccessNotification();
|
|
20659
20654
|
// Queries
|
|
20660
20655
|
var _d = useQuery({
|
|
20661
|
-
queryKey: QueryKeyFactory.default.billingDetailsKey(entityId, token),
|
|
20656
|
+
queryKey: QueryKeyFactory.default.billingDetailsKey({ entityId: entityId, token: token }),
|
|
20662
20657
|
queryFn: function () { return getBillingDetails({ token: token, apiHost: apiHost }); },
|
|
20663
20658
|
}), billingDetails = _d.data, isLoadingBillingDetails = _d.isLoading;
|
|
20664
20659
|
var _e = useMutation({
|
|
@@ -20682,7 +20677,7 @@ function BillingDetailsSection(_a) {
|
|
|
20682
20677
|
})];
|
|
20683
20678
|
case 1:
|
|
20684
20679
|
updatedBillingDetails = _a.sent();
|
|
20685
|
-
queryClient.setQueryData(QueryKeyFactory.default.billingDetailsKey(entityId, token), function (old) {
|
|
20680
|
+
queryClient.setQueryData(QueryKeyFactory.default.billingDetailsKey({ entityId: entityId, token: token }), function (old) {
|
|
20686
20681
|
return __assign(__assign({}, old), updatedBillingDetails.billingDetails);
|
|
20687
20682
|
});
|
|
20688
20683
|
return [2 /*return*/, updatedBillingDetails];
|
|
@@ -20692,7 +20687,7 @@ function BillingDetailsSection(_a) {
|
|
|
20692
20687
|
onSuccess: function () {
|
|
20693
20688
|
showSuccessNotification("Your account details have been saved");
|
|
20694
20689
|
queryClient.invalidateQueries({
|
|
20695
|
-
queryKey: QueryKeyFactory.default.taxationRequiredAccountFieldsKey(entityId, token),
|
|
20690
|
+
queryKey: QueryKeyFactory.default.taxationRequiredAccountFieldsKey({ entityId: entityId, token: token }),
|
|
20696
20691
|
});
|
|
20697
20692
|
},
|
|
20698
20693
|
}), updateBillingDetails = _e.mutate, isUpdatingBillingDetails = _e.isPending;
|
|
@@ -20773,9 +20768,7 @@ function BillingDetailsSection(_a) {
|
|
|
20773
20768
|
});
|
|
20774
20769
|
}); };
|
|
20775
20770
|
var filteredCountryList = useMemo(function () {
|
|
20776
|
-
return countryListFilter
|
|
20777
|
-
? Lists.COUNTRY_LIST.filter(countryListFilter)
|
|
20778
|
-
: Lists.COUNTRY_LIST;
|
|
20771
|
+
return countryListFilter ? Lists.COUNTRY_LIST.filter(countryListFilter) : Lists.COUNTRY_LIST;
|
|
20779
20772
|
}, [countryListFilter]);
|
|
20780
20773
|
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
20774
|
{
|
|
@@ -20783,12 +20776,8 @@ function BillingDetailsSection(_a) {
|
|
|
20783
20776
|
},
|
|
20784
20777
|
] }, { 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
20778
|
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());
|
|
20779
|
+
return ((_a = option === null || option === void 0 ? void 0 : option.label) !== null && _a !== void 0 ? _a : "").toLowerCase().includes(input.toLowerCase()) ||
|
|
20780
|
+
((_b = option === null || option === void 0 ? void 0 : option.value) !== null && _b !== void 0 ? _b : "").toLowerCase().includes(input.toLowerCase());
|
|
20792
20781
|
} }) }))] })), jsx(Form.Item, __assign({ label: "Email", name: "billingContactEmail", rules: [
|
|
20793
20782
|
{
|
|
20794
20783
|
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,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;
|
|
@@ -4,7 +4,7 @@ declare const useSendAcceptQuote: ({ entityId, onTokenExpired, quoteId, apiHost,
|
|
|
4
4
|
onTokenExpired?: (() => void) | undefined;
|
|
5
5
|
quoteId?: string | undefined;
|
|
6
6
|
apiHost: string;
|
|
7
|
-
token
|
|
7
|
+
token: string;
|
|
8
8
|
}) => {
|
|
9
9
|
acceptBoxVisible: boolean;
|
|
10
10
|
isAccepting: boolean;
|
|
@@ -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
|
};
|
|
@@ -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;
|
|
@@ -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;
|
|
@@ -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.41",
|
|
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",
|