@bunnyapp/components 1.6.0-beta.1 → 1.6.0-beta.11
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 +71 -0
- package/dist/cjs/index.js +2811 -2381
- package/dist/cjs/types/src/components/Checkout/Checkout.d.ts +18 -3
- package/dist/cjs/types/src/components/Checkout/QuoteCheckout.d.ts +77 -3
- package/dist/cjs/types/src/components/Checkout/checkoutUtils.d.ts +4 -2
- package/dist/cjs/types/src/components/FeatureUsageGraph.d.ts +4 -3
- package/dist/cjs/types/src/components/QuoteProvider/QuoteProvider.d.ts +4 -0
- package/dist/cjs/types/src/components/{QuoteProvider.d.ts → QuoteProvider/context/QuoteContext.d.ts} +4 -6
- package/dist/cjs/types/src/components/QuoteProvider/fragments/quoteFragment.d.ts +142 -0
- package/dist/cjs/types/src/components/QuoteProvider/hooks/useQuoteCreate.d.ts +19 -0
- package/dist/{esm/types/src/hooks/quotes → cjs/types/src/components/QuoteProvider/hooks}/useQuoteQuantities.d.ts +4 -2
- package/dist/cjs/types/src/{graphql → components/QuoteProvider}/mutations/quoteChargeUpdate.d.ts +12 -2
- package/dist/cjs/types/src/components/QuoteProvider/queries/getQuote.d.ts +16 -0
- package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/PriceListGrid.d.ts +2 -1
- package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/checkoutBar/CheckoutBarInput.d.ts +2 -2
- package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/planPickerDesktop/BillingPeriodSelector.d.ts +3 -2
- package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/planPickerDesktop/PlanAddonsCard.d.ts +2 -1
- package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/planPickerDesktop/PriceListGridDesktop.d.ts +3 -2
- package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/planPickerDesktop/util.d.ts +1 -1
- package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/priceListCard/PriceDescription/PriceListCardPriceDescription.d.ts +6 -0
- package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/priceListCard/PriceDescription/utils/hasMultipleRecurringCharges.d.ts +2 -0
- package/dist/cjs/types/src/components/Subscriptions/quantityChangeDrawer/QuantityChangeGridRow.d.ts +2 -3
- package/dist/{esm/types/src/components/Subscriptions/QuantityDrawerContainer.d.ts → cjs/types/src/components/Subscriptions/quantityChangeDrawer/QuantityDrawer.d.ts} +4 -4
- package/dist/cjs/types/src/components/Subscriptions/quantityChangeDrawer/QuantityInput.d.ts +3 -11
- package/dist/cjs/types/src/components/Subscriptions/quantityChangeDrawer/fragments/QuantityDrawerQuoteFragment.d.ts +10 -0
- package/dist/cjs/types/src/components/Subscriptions/quantityChangeDrawer/hooks/useQuoteQueryData.d.ts +3 -0
- package/dist/cjs/types/src/components/Subscriptions/quantityChangeDrawer/hooks/useSetQuoteQueryData.d.ts +5 -0
- package/dist/cjs/types/src/components/Subscriptions/quantityChangeDrawer/quantityChangeDrawerDesktop/QuantityChangeDrawerDesktop.d.ts +0 -2
- package/dist/cjs/types/src/components/Subscriptions/quantityChangeDrawer/queries/quoteChargeCreate.d.ts +23 -0
- package/dist/cjs/types/src/components/Subscriptions/quantityChangeDrawer/queries/quoteChargeUpdate.d.ts +12 -0
- package/dist/cjs/types/src/components/Subscriptions/quantityChangeDrawer/queries/quoteSubscriptionUpdate.d.ts +22 -0
- package/dist/cjs/types/src/components/Subscriptions/quantityChangeDrawer/utils/formatDateForApi.d.ts +2 -0
- package/dist/cjs/types/src/components/Subscriptions/quantityChangeDrawer/{utils.d.ts → utils/utils.d.ts} +0 -9
- package/dist/cjs/types/src/components/Subscriptions/subscriptionsList/SubscriptionsNavigation.d.ts +1 -1
- package/dist/cjs/types/src/components/Subscriptions/subscriptionsList/subscriptionUtils.d.ts +0 -2
- package/dist/cjs/types/src/components/Subscriptions/tieredDisplayDropdown/TieredDisplayDropdown.d.ts +9 -0
- package/dist/cjs/types/src/components/Subscriptions/tieredDisplayDropdown/util.d.ts +9 -0
- package/dist/cjs/types/src/components/TaxationForm.d.ts +3 -3
- package/dist/cjs/types/src/components/priceListPricing/PricingTooltip.d.ts +40 -0
- package/dist/cjs/types/src/components/priceListPricing/components/ChargePriceTiers.d.ts +23 -0
- package/dist/cjs/types/src/components/priceListPricing/components/PriceTierPrice.d.ts +7 -0
- package/dist/cjs/types/src/components/priceListPricing/components/PriceTierRow.d.ts +13 -0
- package/dist/cjs/types/src/components/priceListPricing/misc/consts.d.ts +1 -0
- package/dist/cjs/types/src/components/priceListPricing/types/PriceTier.d.ts +4 -0
- package/dist/cjs/types/src/components/priceListPricing/utils/getPricingModelDescription.d.ts +2 -0
- package/dist/cjs/types/src/components/priceListPricing/utils/getPricingModelTitle.d.ts +2 -0
- package/dist/cjs/types/src/components/priceListPricing/utils/hasPriceTiers.d.ts +9 -0
- package/dist/cjs/types/src/components/priceListPricing/utils/priceListChargeUtil.ts/getFirstTierPrice.d.ts +7 -0
- package/dist/cjs/types/src/enums/SubscriptionState.d.ts +9 -0
- package/dist/cjs/types/src/graphql/QuoteRequests.d.ts +0 -5
- package/dist/cjs/types/src/graphql/mutations/quoteChargeDelete.d.ts +11 -2
- package/dist/cjs/types/src/graphql/queries/getQuote.d.ts +29 -2
- package/dist/cjs/types/src/graphql-codegen/exportedScalarTypes.d.ts +6 -0
- package/dist/cjs/types/src/index.d.ts +2 -2
- package/dist/cjs/types/src/utils/addonPlanUtils.d.ts +2 -1
- package/dist/cjs/types/src/utils/featureAddonUtils.d.ts +16 -1
- package/dist/cjs/types/src/utils/formatCurrency.d.ts +1 -0
- package/dist/cjs/types/src/utils/priceListUtils/doesPriceListHaveFlatFeeCharges.d.ts +7 -0
- package/dist/cjs/types/src/utils/priceListUtils/getPrice.d.ts +5 -0
- package/dist/cjs/types/src/utils/priceListUtils/priceDescription.d.ts +6 -0
- package/dist/cjs/types/src/utils/priceListUtils/priceListPriceText.d.ts +12 -0
- package/dist/cjs/types/src/utils/pricePickerUtils.d.ts +3 -3
- package/dist/esm/index.js +2849 -2419
- package/dist/esm/types/src/components/Checkout/Checkout.d.ts +18 -3
- package/dist/esm/types/src/components/Checkout/QuoteCheckout.d.ts +77 -3
- package/dist/esm/types/src/components/Checkout/checkoutUtils.d.ts +4 -2
- package/dist/esm/types/src/components/FeatureUsageGraph.d.ts +4 -3
- package/dist/esm/types/src/components/QuoteProvider/QuoteProvider.d.ts +4 -0
- package/dist/esm/types/src/components/{QuoteProvider.d.ts → QuoteProvider/context/QuoteContext.d.ts} +4 -6
- package/dist/esm/types/src/components/QuoteProvider/fragments/quoteFragment.d.ts +142 -0
- package/dist/esm/types/src/components/QuoteProvider/hooks/useQuoteCreate.d.ts +19 -0
- package/dist/{cjs/types/src/hooks/quotes → esm/types/src/components/QuoteProvider/hooks}/useQuoteQuantities.d.ts +4 -2
- package/dist/esm/types/src/{graphql → components/QuoteProvider}/mutations/quoteChargeUpdate.d.ts +12 -2
- package/dist/esm/types/src/components/QuoteProvider/queries/getQuote.d.ts +16 -0
- package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/PriceListGrid.d.ts +2 -1
- package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/checkoutBar/CheckoutBarInput.d.ts +2 -2
- package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/planPickerDesktop/BillingPeriodSelector.d.ts +3 -2
- package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/planPickerDesktop/PlanAddonsCard.d.ts +2 -1
- package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/planPickerDesktop/PriceListGridDesktop.d.ts +3 -2
- package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/planPickerDesktop/util.d.ts +1 -1
- package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/priceListCard/PriceDescription/PriceListCardPriceDescription.d.ts +6 -0
- package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/priceListCard/PriceDescription/utils/hasMultipleRecurringCharges.d.ts +2 -0
- package/dist/esm/types/src/components/Subscriptions/quantityChangeDrawer/QuantityChangeGridRow.d.ts +2 -3
- package/dist/{cjs/types/src/components/Subscriptions/QuantityDrawerContainer.d.ts → esm/types/src/components/Subscriptions/quantityChangeDrawer/QuantityDrawer.d.ts} +4 -4
- package/dist/esm/types/src/components/Subscriptions/quantityChangeDrawer/QuantityInput.d.ts +3 -11
- package/dist/esm/types/src/components/Subscriptions/quantityChangeDrawer/fragments/QuantityDrawerQuoteFragment.d.ts +10 -0
- package/dist/esm/types/src/components/Subscriptions/quantityChangeDrawer/hooks/useQuoteQueryData.d.ts +3 -0
- package/dist/esm/types/src/components/Subscriptions/quantityChangeDrawer/hooks/useSetQuoteQueryData.d.ts +5 -0
- package/dist/esm/types/src/components/Subscriptions/quantityChangeDrawer/quantityChangeDrawerDesktop/QuantityChangeDrawerDesktop.d.ts +0 -2
- package/dist/esm/types/src/components/Subscriptions/quantityChangeDrawer/queries/quoteChargeCreate.d.ts +23 -0
- package/dist/esm/types/src/components/Subscriptions/quantityChangeDrawer/queries/quoteChargeUpdate.d.ts +12 -0
- package/dist/esm/types/src/components/Subscriptions/quantityChangeDrawer/queries/quoteSubscriptionUpdate.d.ts +22 -0
- package/dist/esm/types/src/components/Subscriptions/quantityChangeDrawer/utils/formatDateForApi.d.ts +2 -0
- package/dist/esm/types/src/components/Subscriptions/quantityChangeDrawer/{utils.d.ts → utils/utils.d.ts} +0 -9
- package/dist/esm/types/src/components/Subscriptions/subscriptionsList/SubscriptionsNavigation.d.ts +1 -1
- package/dist/esm/types/src/components/Subscriptions/subscriptionsList/subscriptionUtils.d.ts +0 -2
- package/dist/esm/types/src/components/Subscriptions/tieredDisplayDropdown/TieredDisplayDropdown.d.ts +9 -0
- package/dist/esm/types/src/components/Subscriptions/tieredDisplayDropdown/util.d.ts +9 -0
- package/dist/esm/types/src/components/TaxationForm.d.ts +3 -3
- package/dist/esm/types/src/components/priceListPricing/PricingTooltip.d.ts +40 -0
- package/dist/esm/types/src/components/priceListPricing/components/ChargePriceTiers.d.ts +23 -0
- package/dist/esm/types/src/components/priceListPricing/components/PriceTierPrice.d.ts +7 -0
- package/dist/esm/types/src/components/priceListPricing/components/PriceTierRow.d.ts +13 -0
- package/dist/esm/types/src/components/priceListPricing/misc/consts.d.ts +1 -0
- package/dist/esm/types/src/components/priceListPricing/types/PriceTier.d.ts +4 -0
- package/dist/esm/types/src/components/priceListPricing/utils/getPricingModelDescription.d.ts +2 -0
- package/dist/esm/types/src/components/priceListPricing/utils/getPricingModelTitle.d.ts +2 -0
- package/dist/esm/types/src/components/priceListPricing/utils/hasPriceTiers.d.ts +9 -0
- package/dist/esm/types/src/components/priceListPricing/utils/priceListChargeUtil.ts/getFirstTierPrice.d.ts +7 -0
- package/dist/esm/types/src/enums/SubscriptionState.d.ts +9 -0
- package/dist/esm/types/src/graphql/QuoteRequests.d.ts +0 -5
- package/dist/esm/types/src/graphql/mutations/quoteChargeDelete.d.ts +11 -2
- package/dist/esm/types/src/graphql/queries/getQuote.d.ts +29 -2
- package/dist/esm/types/src/graphql-codegen/exportedScalarTypes.d.ts +6 -0
- package/dist/esm/types/src/index.d.ts +2 -2
- package/dist/esm/types/src/utils/addonPlanUtils.d.ts +2 -1
- package/dist/esm/types/src/utils/featureAddonUtils.d.ts +16 -1
- package/dist/esm/types/src/utils/formatCurrency.d.ts +1 -0
- package/dist/esm/types/src/utils/priceListUtils/doesPriceListHaveFlatFeeCharges.d.ts +7 -0
- package/dist/esm/types/src/utils/priceListUtils/getPrice.d.ts +5 -0
- package/dist/esm/types/src/utils/priceListUtils/priceDescription.d.ts +6 -0
- package/dist/esm/types/src/utils/priceListUtils/priceListPriceText.d.ts +12 -0
- package/dist/esm/types/src/utils/pricePickerUtils.d.ts +3 -3
- package/package.json +2 -2
- package/dist/cjs/types/src/components/Subscriptions/TieredDisplayDropdown.d.ts +0 -8
- package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/priceListCard/PriceListCardPriceDescription.d.ts +0 -13
- package/dist/cjs/types/src/hooks/quotes/useQuoteCreate.d.ts +0 -9
- package/dist/esm/types/src/components/Subscriptions/TieredDisplayDropdown.d.ts +0 -8
- package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/priceListCard/PriceListCardPriceDescription.d.ts +0 -13
- package/dist/esm/types/src/hooks/quotes/useQuoteCreate.d.ts +0 -9
- /package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/planPickerDesktop/{PriceListCardDesktop.d.ts → priceListCardDesktop/PriceListCardDesktop.d.ts} +0 -0
- /package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/planPickerDesktop/{PriceListCardDesktop.d.ts → priceListCardDesktop/PriceListCardDesktop.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -30,6 +30,56 @@ Ensure all peer dependencies in the package.json are installed.
|
|
|
30
30
|
|
|
31
31
|
To run the development server, run `npm run dev`.
|
|
32
32
|
|
|
33
|
+
### Folder structure
|
|
34
|
+
|
|
35
|
+
Unfortunately, the current folder structure isn't perfect. The goal is to progressively (whenever making changes) to begin to follow a module oriented structure.
|
|
36
|
+
|
|
37
|
+
This folder structure is inspired by [Twenty's frontend development folder architecture](https://docs.twenty.com/developers/frontend-development/folder-architecture-front#ui).
|
|
38
|
+
|
|
39
|
+
**Structure**
|
|
40
|
+
|
|
41
|
+
By following this folder architecture convention, it's easier to find the files related to specific features and ensure that the components are scalable and maintainable.
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
src/
|
|
45
|
+
└───modules
|
|
46
|
+
│ └───module1
|
|
47
|
+
│ │ └───submodule1
|
|
48
|
+
│ └───module2
|
|
49
|
+
│ └───components
|
|
50
|
+
│ │ └───display
|
|
51
|
+
│ │ └───inputs
|
|
52
|
+
│ │ │ └───buttons
|
|
53
|
+
│ │ └───...
|
|
54
|
+
└───...
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Modules**
|
|
58
|
+
|
|
59
|
+
Each module represents a feature or a group of feature, comprising its specific components, states, and operational logic. They should all follow the structure below. You can nest modules within modules (referred to as submodules) and the same rules will apply.
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
module1
|
|
63
|
+
├── components/
|
|
64
|
+
│ └───stories/
|
|
65
|
+
│ ├── component1/
|
|
66
|
+
│ └── component2/
|
|
67
|
+
├── constants/
|
|
68
|
+
├── contexts/
|
|
69
|
+
├── graphql/
|
|
70
|
+
│ ├── fragments/
|
|
71
|
+
│ ├── queries/
|
|
72
|
+
│ └── mutations/
|
|
73
|
+
├── hooks/
|
|
74
|
+
├── types/
|
|
75
|
+
└── utils/
|
|
76
|
+
└── ...
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Interface and dependencies**
|
|
80
|
+
|
|
81
|
+
You can import other module code from any module except for components exported in the index.ts file in the components folder. This will keep its code easy to test and maintain.
|
|
82
|
+
|
|
33
83
|
### Using gql.tada for typed queries and mutations
|
|
34
84
|
|
|
35
85
|
We use [gql.tada](https://gql-tada.0no.co/get-started/) to automatically derive types from GraphQL queries and mutations.
|
|
@@ -54,6 +104,27 @@ npm run codegen
|
|
|
54
104
|
npx gql-tada doctor
|
|
55
105
|
```
|
|
56
106
|
|
|
107
|
+
### Deprecating @bunnyapp/common
|
|
108
|
+
|
|
109
|
+
We are gradually deprecating `@bunnyapp/common` and moving types and enums locally to this repository. When something is moved from `@bunnyapp/common`, follow this pattern:
|
|
110
|
+
|
|
111
|
+
1. **Create local definitions**:
|
|
112
|
+
|
|
113
|
+
- **Enums** → Create in `src/enums/` directory (e.g., `src/enums/SubscriptionState.ts`)
|
|
114
|
+
- **Types** → Create in `src/types/` directory (e.g., `src/types/billingDetails.ts`)
|
|
115
|
+
|
|
116
|
+
2. **Update imports incrementally**: Only update the files that need the change. Other files can continue importing from `@bunnyapp/common` until they need to be updated.
|
|
117
|
+
|
|
118
|
+
3. **Example pattern**:
|
|
119
|
+
|
|
120
|
+
```typescript
|
|
121
|
+
// Before (from @bunnyapp/common)
|
|
122
|
+
import { SubscriptionState } from '@bunnyapp/common';
|
|
123
|
+
|
|
124
|
+
// After (local enum)
|
|
125
|
+
import SubscriptionState from '../enums/SubscriptionState';
|
|
126
|
+
```
|
|
127
|
+
|
|
57
128
|
### Storybook stories
|
|
58
129
|
|
|
59
130
|
To view the storybook stories, run `npx storybook dev`.
|