@bunnyapp/components 1.0.36 → 1.0.38
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 +59 -20
- package/dist/cjs/index.js +20857 -0
- package/dist/cjs/playground/billingdetails/index.d.ts +1 -0
- package/dist/cjs/playground/main.d.ts +1 -0
- package/dist/cjs/playground/transactions/index.d.ts +1 -0
- package/dist/cjs/src/ajax.d.ts +1 -0
- package/dist/cjs/src/components/BillingDetails/BillingDetails.d.ts +15 -0
- package/dist/cjs/src/components/BillingDetails/BillingDetails.stories.d.ts +14 -0
- package/dist/cjs/src/components/BillingDetails/BillingDetailsForm.d.ts +9 -0
- package/dist/cjs/src/components/BillingDetails/index.d.ts +1 -0
- package/dist/cjs/src/components/BunnyProvider.d.ts +23 -0
- package/dist/cjs/src/components/Card.d.ts +7 -0
- package/dist/cjs/src/components/Checkout/Checkout.d.ts +11 -0
- package/dist/cjs/src/components/Checkout/CouponComponent.d.ts +7 -0
- package/dist/cjs/src/components/Checkout/QuoteCheckout.d.ts +12 -0
- package/dist/cjs/src/components/Checkout/checkoutUtils.d.ts +2 -0
- package/dist/cjs/src/components/Checkout/index.d.ts +2 -0
- package/dist/cjs/src/components/DrawerHeader.d.ts +7 -0
- package/dist/cjs/src/components/Error.d.ts +5 -0
- package/dist/cjs/src/components/FeatureUsageGraph.d.ts +6 -0
- package/dist/cjs/src/components/HeaderModalWrapper.d.ts +2 -0
- package/dist/cjs/src/components/Invoice/Invoice.d.ts +3 -0
- package/dist/cjs/src/components/Invoice/Invoice.stories.d.ts +18 -0
- package/dist/cjs/src/components/Invoice/InvoiceQuoteContext.d.ts +18 -0
- package/dist/cjs/src/components/Invoice/InvoiceQuoteView.d.ts +11 -0
- package/dist/cjs/src/components/Invoice/index.d.ts +8 -0
- package/dist/cjs/src/components/LegacyInvoicePDF.d.ts +5 -0
- package/dist/cjs/src/components/PageWrapper.d.ts +1 -0
- package/dist/cjs/src/components/PandadocPollingModal.d.ts +7 -0
- package/dist/cjs/src/components/PaymentForm/CheckoutFooter.d.ts +9 -0
- package/dist/cjs/src/components/PaymentForm/DemoPay/DemoPayCardCvc.d.ts +7 -0
- package/dist/cjs/src/components/PaymentForm/DemoPay/DemoPayCardNumber.d.ts +7 -0
- package/dist/cjs/src/components/PaymentForm/DemoPay/DemoPayExpiry.d.ts +7 -0
- package/dist/cjs/src/components/PaymentForm/DemoPay/DemoPayForm.d.ts +7 -0
- package/dist/cjs/src/components/PaymentForm/DemoPay/demoPayUtils.d.ts +21 -0
- package/dist/cjs/src/components/PaymentForm/DemoPay/hooks/usePay.d.ts +12 -0
- package/dist/cjs/src/components/PaymentForm/DemoPay/hooks/useSave.d.ts +21 -0
- package/dist/cjs/src/components/PaymentForm/DemoPay/index.d.ts +1 -0
- package/dist/cjs/src/components/PaymentForm/PaymentForm.d.ts +17 -0
- package/dist/cjs/src/components/PaymentForm/PaymentFormTypes.d.ts +24 -0
- package/dist/cjs/src/components/PaymentForm/PaymentMethod/CreditCard/CreditCard.d.ts +22 -0
- package/dist/cjs/src/components/PaymentForm/PaymentMethod/CreditCard/LargCardIcon.d.ts +2 -0
- package/dist/cjs/src/components/PaymentForm/PaymentMethod/CreditCard/PlusIcon.d.ts +4 -0
- package/dist/cjs/src/components/PaymentForm/PaymentMethod/PaymentMethod.d.ts +9 -0
- package/dist/cjs/src/components/PaymentForm/PaymentMethod/PaymentMethod.stories.d.ts +11 -0
- package/dist/cjs/src/components/PaymentForm/PaymentMethod/index.d.ts +1 -0
- package/dist/cjs/src/components/PaymentForm/PaymentMethodDetails.d.ts +9 -0
- package/dist/cjs/src/components/PaymentForm/PaymentMethodSelector.d.ts +7 -0
- package/dist/cjs/src/components/PaymentForm/SavePaymentMethodFooter.d.ts +6 -0
- package/dist/cjs/src/components/PaymentForm/Stripe/PaymentMethodForm.d.ts +7 -0
- package/dist/cjs/src/components/PaymentForm/Stripe/StripeForm.d.ts +7 -0
- package/dist/cjs/src/components/PaymentForm/Stripe/hooks/usePay.d.ts +12 -0
- package/dist/cjs/src/components/PaymentForm/Stripe/hooks/useSave.d.ts +10 -0
- package/dist/cjs/src/components/PaymentForm/Stripe/stripeUtils.d.ts +26 -0
- package/dist/cjs/src/components/PaymentForm/index.d.ts +2 -0
- package/dist/cjs/src/components/PaymentForm/useRemovePaymentMethod.d.ts +3 -0
- package/dist/cjs/src/components/Quote/AcceptQuoteModal.d.ts +9 -0
- package/dist/cjs/src/components/Quote/Quote.d.ts +3 -0
- package/dist/cjs/src/components/Quote/Quote.stories.d.ts +144 -0
- package/dist/cjs/src/components/Quote/StyledModal.d.ts +3 -0
- package/dist/cjs/src/components/Quote/index.d.ts +1 -0
- package/dist/cjs/src/components/Quotes/Quotes.d.ts +40 -0
- package/dist/cjs/src/components/Quotes/Quotes.stories.d.ts +22 -0
- package/dist/cjs/src/components/Quotes/index.d.ts +1 -0
- package/dist/cjs/src/components/Signup/PaymentForms.d.ts +18 -0
- package/dist/cjs/src/components/Signup/PaymentSuccess.d.ts +9 -0
- package/dist/cjs/src/components/Signup/PriceListDisplay.d.ts +6 -0
- package/dist/cjs/src/components/Signup/Signup.d.ts +21 -0
- package/dist/cjs/src/components/Signup/Signup.stories.d.ts +10 -0
- package/dist/cjs/src/components/Signup/index.d.ts +1 -0
- package/dist/cjs/src/components/StateTag.d.ts +4 -0
- package/dist/cjs/src/components/Subscriptions/Subscriptions.d.ts +23 -0
- package/dist/cjs/src/components/Subscriptions/Subscriptions.stories.d.ts +10 -0
- package/dist/cjs/src/components/Subscriptions/SubscriptionsContext.d.ts +8 -0
- package/dist/cjs/src/components/Subscriptions/index.d.ts +1 -0
- package/dist/cjs/src/components/Subscriptions/subscriptionsList/SubscriptionCardActions.d.ts +8 -0
- package/dist/cjs/src/components/Subscriptions/subscriptionsList/SubscriptionCardHeader.d.ts +8 -0
- package/dist/cjs/src/components/Subscriptions/subscriptionsList/SubscriptionChargeTotal.d.ts +6 -0
- package/dist/cjs/src/components/Subscriptions/subscriptionsList/SubscriptionChargeUnitPrice.d.ts +6 -0
- package/dist/cjs/src/components/Subscriptions/subscriptionsList/SubscriptionsList.d.ts +9 -0
- package/dist/cjs/src/components/Subscriptions/subscriptionsList/subscriptionCardDesktop/SubscriptionCardColumnHeaders.d.ts +12 -0
- package/dist/cjs/src/components/Subscriptions/subscriptionsList/subscriptionCardDesktop/SubscriptionCardDesktop.d.ts +8 -0
- package/dist/cjs/src/components/Subscriptions/subscriptionsList/subscriptionCardDesktop/SubscriptionsCardCell.d.ts +9 -0
- package/dist/cjs/src/components/Subscriptions/subscriptionsList/subscriptionCardMobile/SubscriptionCardCellMobile.d.ts +8 -0
- package/dist/cjs/src/components/Subscriptions/subscriptionsList/subscriptionCardMobile/SubscriptionCardMobile.d.ts +5 -0
- package/dist/cjs/src/components/Subscriptions/subscriptionsList/subscriptionUtils.d.ts +16 -0
- package/dist/cjs/src/components/TaxationForm.d.ts +6 -0
- package/dist/cjs/src/components/Transactions/Transactions.d.ts +55 -0
- package/dist/cjs/src/components/Transactions/Transactions.stories.d.ts +26 -0
- package/dist/cjs/src/components/Transactions/TransactionsListContext.d.ts +30 -0
- package/dist/cjs/src/components/Transactions/index.d.ts +1 -0
- package/dist/cjs/src/components/Transactions/transactionsList/TransactionDate.d.ts +4 -0
- package/dist/cjs/src/components/Transactions/transactionsList/TransactionDownload.d.ts +7 -0
- package/dist/cjs/src/components/Transactions/transactionsList/TransactionGridCell.d.ts +2 -0
- package/dist/cjs/src/components/Transactions/transactionsList/TransactionTitle.d.ts +5 -0
- package/dist/cjs/src/components/Transactions/transactionsList/TransactionsEmptyState.d.ts +2 -0
- package/dist/cjs/src/components/Transactions/transactionsList/TransactionsListDesktop.d.ts +7 -0
- package/dist/cjs/src/components/Transactions/transactionsList/TransactionsListMobile.d.ts +6 -0
- package/dist/cjs/src/components/Transactions/transactionsList/utils.d.ts +3 -0
- package/dist/cjs/src/components/icons/ArrowDownToLine.d.ts +5 -0
- package/dist/cjs/src/components/icons/CardIcon.d.ts +2 -0
- package/dist/cjs/src/components/index.d.ts +10 -0
- package/dist/cjs/src/contexts/BrandContext.d.ts +7 -0
- package/dist/cjs/src/contexts/NavigationContext.d.ts +9 -0
- package/dist/cjs/src/contexts/PaymentContext.d.ts +10 -0
- package/dist/cjs/src/enums/SubscriptionState.d.ts +8 -0
- package/dist/cjs/src/graphql/mutations/accountSignup.d.ts +12 -0
- package/dist/cjs/src/graphql/mutations/accountUpdate.d.ts +7 -0
- package/dist/cjs/src/graphql/mutations/billingDetailsUpdate.d.ts +6 -0
- package/dist/cjs/src/graphql/mutations/checkout.d.ts +23 -0
- package/dist/cjs/src/graphql/mutations/quoteAccountSignup.d.ts +14 -0
- package/dist/cjs/src/graphql/mutations/quoteAddCoupon.d.ts +8 -0
- package/dist/cjs/src/graphql/mutations/quoteCompose.d.ts +13 -0
- package/dist/cjs/src/graphql/mutations/quoteRecalculateTaxes.d.ts +6 -0
- package/dist/cjs/src/graphql/mutations/quoteSubscriptionReinstate.d.ts +7 -0
- package/dist/cjs/src/graphql/queries/getBillingDetails.d.ts +6 -0
- package/dist/cjs/src/graphql/queries/getBranding.d.ts +6 -0
- package/dist/cjs/src/graphql/queries/getFeatureUsage.d.ts +10 -0
- package/dist/cjs/src/graphql/queries/getFormattedQuote.d.ts +7 -0
- package/dist/cjs/src/graphql/queries/getPlanChangeOptions.d.ts +8 -0
- package/dist/cjs/src/graphql/queries/getPriceList.d.ts +7 -0
- package/dist/cjs/src/graphql/queries/getQuotes.d.ts +6 -0
- package/dist/cjs/src/graphql/queries/getSubscriptions.d.ts +7 -0
- package/dist/cjs/src/graphql/queries/getTaxationRequiredAccountFields.d.ts +6 -0
- package/dist/cjs/src/graphql/queries/getTransactions.d.ts +3 -0
- package/dist/cjs/src/hooks/index.d.ts +1 -0
- package/dist/cjs/src/hooks/quotes/useSendAcceptQuote.d.ts +20 -0
- package/dist/cjs/src/hooks/quotes/useSigningComplete.d.ts +5 -0
- package/dist/cjs/src/hooks/subscriptions/useSubscriptions.d.ts +5 -0
- package/dist/cjs/src/hooks/useFocusFirstInput.d.ts +7 -0
- package/dist/cjs/src/hooks/useHasTaxPlugin.d.ts +6 -0
- package/dist/cjs/src/hooks/useIsExpired.d.ts +2 -0
- package/dist/cjs/src/hooks/usePaymentMethod.d.ts +5 -0
- package/dist/cjs/src/hooks/usePaymentPlugins.d.ts +11 -0
- package/dist/cjs/src/hooks/usePlugins.d.ts +6 -0
- package/dist/cjs/src/hooks/useSigningPlugins.d.ts +6 -0
- package/dist/cjs/src/hooks/useToken.d.ts +2 -0
- package/dist/cjs/src/index.d.ts +3 -0
- package/dist/cjs/src/mocks/browser.d.ts +1 -0
- package/dist/cjs/src/mocks/handlers.d.ts +1 -0
- package/dist/cjs/src/storybook-utils.d.ts +10 -0
- package/dist/cjs/src/types/billingDetails.d.ts +14 -0
- package/dist/cjs/src/types/shadowType.d.ts +1 -0
- package/dist/cjs/src/utils/GraphQLClient.d.ts +2 -0
- package/dist/cjs/src/utils/quoteInvoiceUtils.d.ts +6 -0
- package/dist/cjs/src/utils/styled.d.ts +3 -0
- package/dist/cjs/vite.config.d.ts +2 -0
- package/dist/esm/index.js +109 -137
- package/dist/esm/src/ajax.d.ts +1 -1
- package/dist/esm/src/components/BunnyProvider.d.ts +2 -2
- package/dist/esm/src/components/LegacyInvoicePDF.d.ts +1 -1
- package/dist/esm/src/components/PaymentForm/DemoPay/demoPayUtils.d.ts +1 -1
- package/dist/esm/src/components/PaymentForm/DemoPay/hooks/useSave.d.ts +1 -1
- package/dist/esm/src/components/PaymentForm/PaymentForm.d.ts +3 -1
- package/dist/esm/src/components/PaymentForm/PaymentMethodDetails.d.ts +3 -1
- package/dist/esm/src/components/PaymentForm/Stripe/stripeUtils.d.ts +3 -3
- package/dist/esm/src/components/PaymentForm/index.d.ts +1 -0
- package/dist/esm/src/components/PaymentForm/useRemovePaymentMethod.d.ts +1 -1
- package/dist/esm/src/components/Transactions/Transactions.d.ts +2 -1
- package/dist/esm/src/components/Transactions/transactionsList/TransactionDownload.d.ts +1 -1
- package/dist/esm/src/components/Transactions/transactionsList/TransactionsListDesktop.d.ts +1 -1
- package/dist/esm/src/components/index.d.ts +1 -1
- package/dist/esm/src/graphql/mutations/accountUpdate.d.ts +1 -1
- package/dist/esm/src/graphql/mutations/billingDetailsUpdate.d.ts +1 -1
- package/dist/esm/src/graphql/mutations/checkout.d.ts +1 -1
- package/dist/esm/src/graphql/mutations/quoteAccountSignup.d.ts +1 -1
- package/dist/esm/src/graphql/mutations/quoteAddCoupon.d.ts +1 -1
- package/dist/esm/src/graphql/queries/getBillingDetails.d.ts +1 -1
- package/dist/esm/src/graphql/queries/getBranding.d.ts +1 -1
- package/dist/esm/src/graphql/queries/getFeatureUsage.d.ts +1 -1
- package/dist/esm/src/graphql/queries/getFormattedQuote.d.ts +1 -1
- package/dist/esm/src/graphql/queries/getPlanChangeOptions.d.ts +1 -1
- package/dist/esm/src/graphql/queries/getPriceList.d.ts +1 -1
- package/dist/esm/src/graphql/queries/getQuotes.d.ts +1 -1
- package/dist/esm/src/graphql/queries/getSubscriptions.d.ts +1 -1
- package/dist/esm/src/graphql/queries/getTransactions.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 +1 -1
- package/dist/esm/src/hooks/usePaymentPlugins.d.ts +1 -1
- package/dist/esm/src/hooks/usePlugins.d.ts +1 -1
- package/dist/esm/src/hooks/useSigningPlugins.d.ts +1 -1
- package/dist/esm/src/hooks/useToken.d.ts +1 -1
- package/dist/esm/src/utils/GraphQLClient.d.ts +1 -1
- package/dist/index.d.ts +23 -8
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# ℹ️ About
|
|
2
2
|
|
|
3
|
-
This
|
|
3
|
+
This package provides components from the Bunny portal to integrate Bunny UI functionality into your application. Both CJS and ESM builds are provided.
|
|
4
4
|
|
|
5
5
|
# 🧩 Components
|
|
6
6
|
|
|
@@ -8,13 +8,28 @@ This repository provides components from the Bunny portal to integrate Bunny UI
|
|
|
8
8
|
- Quote
|
|
9
9
|
- Quotes
|
|
10
10
|
- PaymentMethod
|
|
11
|
+
- BillingDetails
|
|
11
12
|
- Transactions
|
|
12
13
|
- Subscriptions (view-only mode)
|
|
14
|
+
- BillingDetails
|
|
15
|
+
- Signup
|
|
13
16
|
|
|
14
17
|
# 📦 Install
|
|
15
18
|
|
|
16
19
|
```bash
|
|
17
|
-
npm
|
|
20
|
+
npm i @bunnyapp/components
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
yarn add @bunnyapp/components
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pnpm add @bunnyapp/components
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
bun add @bunnyapp/components
|
|
18
33
|
```
|
|
19
34
|
|
|
20
35
|
Ensure all peer dependencies in the package.json are installed.
|
|
@@ -22,7 +37,12 @@ Ensure all peer dependencies in the package.json are installed.
|
|
|
22
37
|
# ⚙️ Configuration
|
|
23
38
|
|
|
24
39
|
1. Whitelist your subdomain in Bunny (e.g., `localhost` for development, `https://[company-name].bunny.com` for production).
|
|
25
|
-
|
|
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.
|
|
26
46
|
|
|
27
47
|
# 🔨 Usage
|
|
28
48
|
|
|
@@ -36,19 +56,13 @@ The below example shows how to use the BunnyProvider component with the Invoice
|
|
|
36
56
|
Here the data such as the saved payment method will be updated between the components.
|
|
37
57
|
|
|
38
58
|
```tsx
|
|
39
|
-
import {
|
|
40
|
-
BunnyProvider,
|
|
41
|
-
Invoice,
|
|
42
|
-
PaymentMethod,
|
|
43
|
-
Transactions,
|
|
44
|
-
Subscriptions,
|
|
45
|
-
} from "@bunnyapp/components";
|
|
59
|
+
import { BunnyProvider, Invoice, PaymentMethod } from "@bunnyapp/components";
|
|
46
60
|
|
|
47
61
|
function App() {
|
|
48
62
|
return (
|
|
49
|
-
<BunnyProvider token={token}
|
|
50
|
-
<Invoice id="12345" />
|
|
51
|
-
<PaymentMethod />
|
|
63
|
+
<BunnyProvider token={token} apiHost={apiHost}>
|
|
64
|
+
<Invoice id="12345" entityId="1" />
|
|
65
|
+
<PaymentMethod entityId="1" />
|
|
52
66
|
</BunnyProvider>
|
|
53
67
|
);
|
|
54
68
|
}
|
|
@@ -63,28 +77,53 @@ import { BunnyProvider, Invoice, PaymentMethod } from "@bunnyapp/components";
|
|
|
63
77
|
function App() {
|
|
64
78
|
return (
|
|
65
79
|
<div>
|
|
66
|
-
<BunnyProvider token={token}
|
|
67
|
-
<Invoice id="12345" />
|
|
80
|
+
<BunnyProvider token={token} apiHost={apiHost}>
|
|
81
|
+
<Invoice id="12345" entityId="1" />
|
|
68
82
|
</BunnyProvider>
|
|
69
83
|
{/* Other components */}
|
|
70
|
-
<BunnyProvider token={token}
|
|
71
|
-
<PaymentMethod />
|
|
84
|
+
<BunnyProvider token={token} apiHost={apiHost}>
|
|
85
|
+
<PaymentMethod entityId="1" />
|
|
72
86
|
</BunnyProvider>
|
|
73
87
|
</div>
|
|
74
88
|
);
|
|
75
89
|
}
|
|
76
90
|
```
|
|
77
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
|
+
|
|
78
117
|
## Parameters
|
|
79
118
|
|
|
80
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)
|
|
81
|
-
- `
|
|
82
|
-
- `
|
|
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)
|
|
83
122
|
|
|
84
123
|
## Development
|
|
85
124
|
|
|
86
125
|
To run the development server, run `npm run dev`.
|
|
87
126
|
|
|
88
|
-
|
|
127
|
+
#### Storybook stories
|
|
89
128
|
|
|
90
129
|
To view the storybook stories, run `npm run storybook`.
|