@bunnyapp/components 1.7.0-beta.33 → 1.7.0-beta.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +30 -6
- package/dist/esm/index.js +30 -6
- package/package.json +2 -2
package/dist/cjs/index.js
CHANGED
|
@@ -1283,7 +1283,7 @@ const DEFAULT_CONFIG = {
|
|
|
1283
1283
|
};
|
|
1284
1284
|
|
|
1285
1285
|
// This will be replaced at build time by rollup-plugin-replace
|
|
1286
|
-
const PACKAGE_VERSION = '1.7.0-beta.
|
|
1286
|
+
const PACKAGE_VERSION = '1.7.0-beta.33';
|
|
1287
1287
|
const createRequestHeaders = (token) => {
|
|
1288
1288
|
const headers = createClientDevHeaders({ token });
|
|
1289
1289
|
// Add the components version header
|
|
@@ -2264,7 +2264,11 @@ const getBranding = async ({ token, apiHost }) => {
|
|
|
2264
2264
|
const BunnyContext = react.createContext({});
|
|
2265
2265
|
// Every component shares similar props and functionality, which this wrapper handles.
|
|
2266
2266
|
function BunnyProvider({ children, darkMode = false, queryClient, apiHost, token, onTokenExpired, onUserUnavailable, onInvalidOrMissingAuthorization, suppressUserUnavailableErrorNotification = false, configProviderProps, }) {
|
|
2267
|
-
return (jsxRuntime.jsx(BunnyProviderCallbacksProvider, { value: {
|
|
2267
|
+
return (jsxRuntime.jsx(BunnyProviderCallbacksProvider, { value: {
|
|
2268
|
+
onUserUnavailable,
|
|
2269
|
+
onInvalidOrMissingAuthorization,
|
|
2270
|
+
suppressUserUnavailableErrorNotification,
|
|
2271
|
+
}, children: jsxRuntime.jsx(BunnyProviderContent, { darkMode: darkMode, queryClient: queryClient, apiHost: apiHost, token: token, onTokenExpired: onTokenExpired, configProviderProps: configProviderProps, children: children }) }));
|
|
2268
2272
|
}
|
|
2269
2273
|
function BunnyProviderContent({ children, darkMode = false, queryClient, apiHost, token, onTokenExpired, configProviderProps, }) {
|
|
2270
2274
|
const createQueryClient = useCreateQueryClient();
|
|
@@ -25375,13 +25379,18 @@ const QuoteContext = react.createContext({});
|
|
|
25375
25379
|
const BillingPeriodSelector = ({ availableBillingPeriods, onChangeBillingPeriod, products, selectedBillingPeriod, selectedProduct, onChangeProduct, }) => {
|
|
25376
25380
|
const { secondaryColor, brandColor } = useBrand();
|
|
25377
25381
|
const isMobile = useIsMobile();
|
|
25382
|
+
const { isInPreviewMode } = useSubscriptionProps();
|
|
25378
25383
|
if (!availableBillingPeriods || (availableBillingPeriods === null || availableBillingPeriods === void 0 ? void 0 : availableBillingPeriods.length) < 2)
|
|
25379
25384
|
return null;
|
|
25380
25385
|
return (jsxRuntime.jsxs("div", { className: "bunny-flex bunny-items-center bunny-gap-8", children: [(products === null || products === void 0 ? void 0 : products.length) && products.length > 1 && (jsxRuntime.jsxs("div", { className: "bunny-flex bunny-flex-col bunny-gap-2", children: [jsxRuntime.jsx("div", { className: "bunny-font-medium bunny-text-xs", style: {
|
|
25381
25386
|
color: secondaryColor,
|
|
25382
25387
|
}, children: "Select product" }), jsxRuntime.jsx(ProductRadioStyled, { brandColor: brandColor, children: jsxRuntime.jsx(antd.Radio.Group, { onChange: e => {
|
|
25388
|
+
if (isInPreviewMode)
|
|
25389
|
+
return;
|
|
25383
25390
|
onChangeProduct(products === null || products === void 0 ? void 0 : products.find(product => product.id === e.target.value));
|
|
25384
25391
|
}, value: selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.id, buttonStyle: "solid", children: jsxRuntime.jsx(antd.Space, { className: "bunny-gap-2", children: products === null || products === void 0 ? void 0 : products.map(product => (jsxRuntime.jsx(antd.Radio.Button, { value: product.id, children: product.name }, product.id))) }) }) })] })), jsxRuntime.jsx("div", { className: "bunny-flex bunny-flex-col bunny-w-full bunny-gap-2", children: jsxRuntime.jsx(StyledRadioGroup, { className: "bunny-w-full", "$isMobile": isMobile, children: jsxRuntime.jsx(antd.Radio.Group, { onChange: e => {
|
|
25392
|
+
if (isInPreviewMode)
|
|
25393
|
+
return;
|
|
25385
25394
|
onChangeBillingPeriod(e.target.value);
|
|
25386
25395
|
}, value: selectedBillingPeriod, size: "small", buttonStyle: "solid", children: availableBillingPeriods === null || availableBillingPeriods === void 0 ? void 0 : availableBillingPeriods.map((periodMonth, index) => {
|
|
25387
25396
|
return (jsxRuntime.jsx(antd.Radio.Button, { value: periodMonthsConverter(periodMonth), children: periodMonthsConverter(periodMonth) }, index));
|
|
@@ -25970,10 +25979,14 @@ const PriceListCardDesktop_PriceListFragment = t(`
|
|
|
25970
25979
|
]);
|
|
25971
25980
|
const PriceListCardDesktop = ({ hideButton, description, disableSelectCurrentPlan, feature, isPriceListCurrentSubscription, isSelected, priceList: maskedPriceList, subscriptionPlan, trialRemainingDays, noBorder, onClickPriceListCard, }) => {
|
|
25972
25981
|
var _a, _b, _c, _d;
|
|
25982
|
+
// Context
|
|
25983
|
+
const { isInPreviewMode } = useSubscriptionProps();
|
|
25973
25984
|
// Read fragments
|
|
25974
25985
|
const priceList = readFragment(PriceListCardDesktop_PriceListFragment, maskedPriceList);
|
|
25975
25986
|
return (jsxRuntime.jsx(PlanPickerGridCell, { noBorder: noBorder, children: jsxRuntime.jsxs("div", { className: `bunny-flex bunny-flex-col bunny-items-start bunny-justify-between bunny-w-full bunny-rounded-md bunny-gap-4 bunny-pt-4 bunny-px-4 ${disableSelectCurrentPlan ? '' : 'cursor-pointer'} bunny-box-border`, onClick: () => {
|
|
25976
25987
|
var _a, _b, _c;
|
|
25988
|
+
if (isInPreviewMode)
|
|
25989
|
+
return;
|
|
25977
25990
|
if (!disableSelectCurrentPlan) {
|
|
25978
25991
|
if (((_a = priceList.plan) === null || _a === void 0 ? void 0 : _a.pricingStyle) === t.scalar('PlanPricingStyles', 'CONTACT_US')) {
|
|
25979
25992
|
window.open((_c = (_b = priceList.plan) === null || _b === void 0 ? void 0 : _b.contactUsUrl) !== null && _c !== void 0 ? _c : undefined, '_blank');
|
|
@@ -26015,9 +26028,12 @@ const PriceListCardMobile = ({ description, feature, isPriceListCurrentSubscript
|
|
|
26015
26028
|
var _a, _b;
|
|
26016
26029
|
// Context
|
|
26017
26030
|
const { brandColor } = useBrand();
|
|
26031
|
+
const { isInPreviewMode } = useSubscriptionProps();
|
|
26018
26032
|
// Read fragments
|
|
26019
26033
|
const priceList = readFragment(PriceListCardMobile_PriceListFragment, maskedPriceList);
|
|
26020
26034
|
return (jsxRuntime.jsxs("div", { className: `bunny-relative bunny-flex bunny-flex-col bunny-border-2 bunny-border-solid bunny-rounded-lg bunny-p-4`, onClick: () => {
|
|
26035
|
+
if (isInPreviewMode)
|
|
26036
|
+
return;
|
|
26021
26037
|
if (!disableOnClickPriceListCard)
|
|
26022
26038
|
onClickPriceListCard === null || onClickPriceListCard === void 0 ? void 0 : onClickPriceListCard(priceList);
|
|
26023
26039
|
}, style: {
|
|
@@ -26320,7 +26336,7 @@ const PlanPickerCheckoutBar_QuoteFragment = t(`
|
|
|
26320
26336
|
`, [Checkout_QuoteFragment]);
|
|
26321
26337
|
const PlanPickerCheckoutBar = ({ selectedPriceList, handlePortalErrors, onCheckoutSuccess, }) => {
|
|
26322
26338
|
// Context
|
|
26323
|
-
const { shadow } = useSubscriptionProps();
|
|
26339
|
+
const { shadow, isInPreviewMode } = useSubscriptionProps();
|
|
26324
26340
|
const { quote: maskedQuote, onChangeQuantity, getFeatureQuantity, onRecalculateTaxes, isFeatureAddonsLoading, isUpdatingQuote, } = react.useContext(QuoteContext);
|
|
26325
26341
|
// Read fragments
|
|
26326
26342
|
const quote = readFragment(PlanPickerCheckoutBar_QuoteFragment, maskedQuote);
|
|
@@ -26377,6 +26393,8 @@ const PlanPickerCheckoutBar = ({ selectedPriceList, handlePortalErrors, onChecko
|
|
|
26377
26393
|
}
|
|
26378
26394
|
const isDisabled = !quote || maybeIsChargeLoading || !selectedPriceList || !charge.selfServiceQuantity;
|
|
26379
26395
|
return (jsxRuntime.jsx(CheckoutBarInput, { disabled: isDisabled, priceListCharge: charge, quantity: quantity, onQuantityChanged: quantity => {
|
|
26396
|
+
if (isInPreviewMode)
|
|
26397
|
+
return;
|
|
26380
26398
|
onChangeQuantity(charge.id, quantity);
|
|
26381
26399
|
} }, index));
|
|
26382
26400
|
}) }), jsxRuntime.jsx(CheckoutBarSummarySection, { onClickCheckout: () => setPayModalVisible(true), selectedPriceList: selectedPriceList }), jsxRuntime.jsx(Checkout, { onCancel: () => setPayModalVisible(false), onFail: error => handlePortalErrors === null || handlePortalErrors === void 0 ? void 0 : handlePortalErrors(error), onSuccess: handleCheckoutSuccess, onRecalculateTaxes: onRecalculateTaxes, open: payModalVisible, quote: quote, token: token, isUpdatingQuote: isUpdatingQuote })] }));
|
|
@@ -27062,7 +27080,11 @@ function AddonPlanRow({ addonPriceList: maskedAddonPriceList, selectedPriceList,
|
|
|
27062
27080
|
// Derived state
|
|
27063
27081
|
const switchDisabled = isInPreviewMode || isPurchased;
|
|
27064
27082
|
const hasCustomPrice = ((_b = addonPriceList.plan) === null || _b === void 0 ? void 0 : _b.pricingDescription) != null;
|
|
27065
|
-
return (jsxRuntime.jsxs("div", { className: `bunny-flex bunny-flex-row bunny-gap-2 bunny-justify-between bunny-items-center bunny-p-4 bunny-rounded-md bunny-bg-white ${shadow ? `shadow-${shadow}` : ''} bunny-mb-2`, children: [jsxRuntime.jsxs("div", { className: "bunny-flex bunny-flex-row bunny-gap-2 bunny-items-center", children: [jsxRuntime.jsx("div", { className: `bunny-font-medium bunny-text-center bunny-text-orange-600`, children: (_c = addonPriceList.plan) === null || _c === void 0 ? void 0 : _c.name }), jsxRuntime.jsx(PriceListCardDescription, { description: (_e = (_d = addonPriceList.plan) === null || _d === void 0 ? void 0 : _d.description) !== null && _e !== void 0 ? _e : '' }), !hasCustomPrice && (jsxRuntime.jsx(PriceListCardPrice, { priceList: addonPriceList, className: "bunny-text-sm bunny-font-medium bunny-text-gray-900" })), jsxRuntime.jsx(PriceListCardPriceDescription, { feature: activeCharge === null || activeCharge === void 0 ? void 0 : activeCharge.feature, priceList: addonPriceList }), jsxRuntime.jsx(antd.Button, { type: "link", onClick:
|
|
27083
|
+
return (jsxRuntime.jsxs("div", { className: `bunny-flex bunny-flex-row bunny-gap-2 bunny-justify-between bunny-items-center bunny-p-4 bunny-rounded-md bunny-bg-white ${shadow ? `shadow-${shadow}` : ''} bunny-mb-2`, children: [jsxRuntime.jsxs("div", { className: "bunny-flex bunny-flex-row bunny-gap-2 bunny-items-center", children: [jsxRuntime.jsx("div", { className: `bunny-font-medium bunny-text-center bunny-text-orange-600`, children: (_c = addonPriceList.plan) === null || _c === void 0 ? void 0 : _c.name }), jsxRuntime.jsx(PriceListCardDescription, { description: (_e = (_d = addonPriceList.plan) === null || _d === void 0 ? void 0 : _d.description) !== null && _e !== void 0 ? _e : '' }), !hasCustomPrice && (jsxRuntime.jsx(PriceListCardPrice, { priceList: addonPriceList, className: "bunny-text-sm bunny-font-medium bunny-text-gray-900" })), jsxRuntime.jsx(PriceListCardPriceDescription, { feature: activeCharge === null || activeCharge === void 0 ? void 0 : activeCharge.feature, priceList: addonPriceList }), jsxRuntime.jsx(antd.Button, { type: "link", onClick: () => {
|
|
27084
|
+
if (isInPreviewMode)
|
|
27085
|
+
return;
|
|
27086
|
+
onClickSelect();
|
|
27087
|
+
}, children: jsxRuntime.jsx(icons.InfoCircleOutlined, {}) })] }), jsxRuntime.jsx(antd.Switch, { id: addonPlanSwitchTestId((_g = (_f = addonPriceList.plan) === null || _f === void 0 ? void 0 : _f.name) !== null && _g !== void 0 ? _g : ''), loading: isPending && !switchDisabled, checked: addedQuoteChange || isPurchased, onChange: (checked) => {
|
|
27066
27088
|
if (checked) {
|
|
27067
27089
|
addAddonQuoteChange();
|
|
27068
27090
|
}
|
|
@@ -29209,7 +29231,8 @@ const UpgradeWrapper = ({ onChangePlanCancel, handlePortalErrors, upgradingSubsc
|
|
|
29209
29231
|
pluralType: 'upgradeSubscriptions',
|
|
29210
29232
|
token,
|
|
29211
29233
|
}),
|
|
29212
|
-
queryFn: () => getSubscriptions({
|
|
29234
|
+
queryFn: () => getSubscriptions({ token, apiHost, isInPreviewMode }),
|
|
29235
|
+
enabled: !isInPreviewMode, // Don't query subscriptions in preview mode
|
|
29213
29236
|
});
|
|
29214
29237
|
// find upgrading subscription based on upgradingSubscriptionId
|
|
29215
29238
|
const upgradingSubscription = (_b = (_a = subscriptionsData === null || subscriptionsData === void 0 ? void 0 : subscriptionsData.subscriptions) === null || _a === void 0 ? void 0 : _a.nodes) === null || _b === void 0 ? void 0 : _b.find(subscription => (subscription === null || subscription === void 0 ? void 0 : subscription.id) === upgradingSubscriptionId);
|
|
@@ -29272,7 +29295,8 @@ const SubscriptionsWrapper = ({ handlePortalErrors, companyName, isInPreviewMode
|
|
|
29272
29295
|
pluralType: 'subscriptions',
|
|
29273
29296
|
token,
|
|
29274
29297
|
}),
|
|
29275
|
-
queryFn: () => getSubscriptions$1({ token, apiHost }),
|
|
29298
|
+
queryFn: () => getSubscriptions$1({ token, apiHost, isInPreviewMode }),
|
|
29299
|
+
enabled: !isInPreviewMode, // Don't query subscriptions in preview mode
|
|
29276
29300
|
});
|
|
29277
29301
|
const subscriptions = (_b = (_a = subscriptionsData === null || subscriptionsData === void 0 ? void 0 : subscriptionsData.subscriptions) === null || _a === void 0 ? void 0 : _a.nodes) === null || _b === void 0 ? void 0 : _b.filter(subscription => subscription !== null);
|
|
29278
29302
|
const defaultStyles = {
|
package/dist/esm/index.js
CHANGED
|
@@ -1281,7 +1281,7 @@ const DEFAULT_CONFIG = {
|
|
|
1281
1281
|
};
|
|
1282
1282
|
|
|
1283
1283
|
// This will be replaced at build time by rollup-plugin-replace
|
|
1284
|
-
const PACKAGE_VERSION = '1.7.0-beta.
|
|
1284
|
+
const PACKAGE_VERSION = '1.7.0-beta.33';
|
|
1285
1285
|
const createRequestHeaders = (token) => {
|
|
1286
1286
|
const headers = createClientDevHeaders({ token });
|
|
1287
1287
|
// Add the components version header
|
|
@@ -2262,7 +2262,11 @@ const getBranding = async ({ token, apiHost }) => {
|
|
|
2262
2262
|
const BunnyContext = createContext({});
|
|
2263
2263
|
// Every component shares similar props and functionality, which this wrapper handles.
|
|
2264
2264
|
function BunnyProvider({ children, darkMode = false, queryClient, apiHost, token, onTokenExpired, onUserUnavailable, onInvalidOrMissingAuthorization, suppressUserUnavailableErrorNotification = false, configProviderProps, }) {
|
|
2265
|
-
return (jsx(BunnyProviderCallbacksProvider, { value: {
|
|
2265
|
+
return (jsx(BunnyProviderCallbacksProvider, { value: {
|
|
2266
|
+
onUserUnavailable,
|
|
2267
|
+
onInvalidOrMissingAuthorization,
|
|
2268
|
+
suppressUserUnavailableErrorNotification,
|
|
2269
|
+
}, children: jsx(BunnyProviderContent, { darkMode: darkMode, queryClient: queryClient, apiHost: apiHost, token: token, onTokenExpired: onTokenExpired, configProviderProps: configProviderProps, children: children }) }));
|
|
2266
2270
|
}
|
|
2267
2271
|
function BunnyProviderContent({ children, darkMode = false, queryClient, apiHost, token, onTokenExpired, configProviderProps, }) {
|
|
2268
2272
|
const createQueryClient = useCreateQueryClient();
|
|
@@ -25373,13 +25377,18 @@ const QuoteContext = createContext({});
|
|
|
25373
25377
|
const BillingPeriodSelector = ({ availableBillingPeriods, onChangeBillingPeriod, products, selectedBillingPeriod, selectedProduct, onChangeProduct, }) => {
|
|
25374
25378
|
const { secondaryColor, brandColor } = useBrand();
|
|
25375
25379
|
const isMobile = useIsMobile();
|
|
25380
|
+
const { isInPreviewMode } = useSubscriptionProps();
|
|
25376
25381
|
if (!availableBillingPeriods || (availableBillingPeriods === null || availableBillingPeriods === void 0 ? void 0 : availableBillingPeriods.length) < 2)
|
|
25377
25382
|
return null;
|
|
25378
25383
|
return (jsxs("div", { className: "bunny-flex bunny-items-center bunny-gap-8", children: [(products === null || products === void 0 ? void 0 : products.length) && products.length > 1 && (jsxs("div", { className: "bunny-flex bunny-flex-col bunny-gap-2", children: [jsx("div", { className: "bunny-font-medium bunny-text-xs", style: {
|
|
25379
25384
|
color: secondaryColor,
|
|
25380
25385
|
}, children: "Select product" }), jsx(ProductRadioStyled, { brandColor: brandColor, children: jsx(Radio.Group, { onChange: e => {
|
|
25386
|
+
if (isInPreviewMode)
|
|
25387
|
+
return;
|
|
25381
25388
|
onChangeProduct(products === null || products === void 0 ? void 0 : products.find(product => product.id === e.target.value));
|
|
25382
25389
|
}, value: selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.id, buttonStyle: "solid", children: jsx(Space, { className: "bunny-gap-2", children: products === null || products === void 0 ? void 0 : products.map(product => (jsx(Radio.Button, { value: product.id, children: product.name }, product.id))) }) }) })] })), jsx("div", { className: "bunny-flex bunny-flex-col bunny-w-full bunny-gap-2", children: jsx(StyledRadioGroup, { className: "bunny-w-full", "$isMobile": isMobile, children: jsx(Radio.Group, { onChange: e => {
|
|
25390
|
+
if (isInPreviewMode)
|
|
25391
|
+
return;
|
|
25383
25392
|
onChangeBillingPeriod(e.target.value);
|
|
25384
25393
|
}, value: selectedBillingPeriod, size: "small", buttonStyle: "solid", children: availableBillingPeriods === null || availableBillingPeriods === void 0 ? void 0 : availableBillingPeriods.map((periodMonth, index) => {
|
|
25385
25394
|
return (jsx(Radio.Button, { value: periodMonthsConverter(periodMonth), children: periodMonthsConverter(periodMonth) }, index));
|
|
@@ -25968,10 +25977,14 @@ const PriceListCardDesktop_PriceListFragment = t(`
|
|
|
25968
25977
|
]);
|
|
25969
25978
|
const PriceListCardDesktop = ({ hideButton, description, disableSelectCurrentPlan, feature, isPriceListCurrentSubscription, isSelected, priceList: maskedPriceList, subscriptionPlan, trialRemainingDays, noBorder, onClickPriceListCard, }) => {
|
|
25970
25979
|
var _a, _b, _c, _d;
|
|
25980
|
+
// Context
|
|
25981
|
+
const { isInPreviewMode } = useSubscriptionProps();
|
|
25971
25982
|
// Read fragments
|
|
25972
25983
|
const priceList = readFragment(PriceListCardDesktop_PriceListFragment, maskedPriceList);
|
|
25973
25984
|
return (jsx(PlanPickerGridCell, { noBorder: noBorder, children: jsxs("div", { className: `bunny-flex bunny-flex-col bunny-items-start bunny-justify-between bunny-w-full bunny-rounded-md bunny-gap-4 bunny-pt-4 bunny-px-4 ${disableSelectCurrentPlan ? '' : 'cursor-pointer'} bunny-box-border`, onClick: () => {
|
|
25974
25985
|
var _a, _b, _c;
|
|
25986
|
+
if (isInPreviewMode)
|
|
25987
|
+
return;
|
|
25975
25988
|
if (!disableSelectCurrentPlan) {
|
|
25976
25989
|
if (((_a = priceList.plan) === null || _a === void 0 ? void 0 : _a.pricingStyle) === t.scalar('PlanPricingStyles', 'CONTACT_US')) {
|
|
25977
25990
|
window.open((_c = (_b = priceList.plan) === null || _b === void 0 ? void 0 : _b.contactUsUrl) !== null && _c !== void 0 ? _c : undefined, '_blank');
|
|
@@ -26013,9 +26026,12 @@ const PriceListCardMobile = ({ description, feature, isPriceListCurrentSubscript
|
|
|
26013
26026
|
var _a, _b;
|
|
26014
26027
|
// Context
|
|
26015
26028
|
const { brandColor } = useBrand();
|
|
26029
|
+
const { isInPreviewMode } = useSubscriptionProps();
|
|
26016
26030
|
// Read fragments
|
|
26017
26031
|
const priceList = readFragment(PriceListCardMobile_PriceListFragment, maskedPriceList);
|
|
26018
26032
|
return (jsxs("div", { className: `bunny-relative bunny-flex bunny-flex-col bunny-border-2 bunny-border-solid bunny-rounded-lg bunny-p-4`, onClick: () => {
|
|
26033
|
+
if (isInPreviewMode)
|
|
26034
|
+
return;
|
|
26019
26035
|
if (!disableOnClickPriceListCard)
|
|
26020
26036
|
onClickPriceListCard === null || onClickPriceListCard === void 0 ? void 0 : onClickPriceListCard(priceList);
|
|
26021
26037
|
}, style: {
|
|
@@ -26318,7 +26334,7 @@ const PlanPickerCheckoutBar_QuoteFragment = t(`
|
|
|
26318
26334
|
`, [Checkout_QuoteFragment]);
|
|
26319
26335
|
const PlanPickerCheckoutBar = ({ selectedPriceList, handlePortalErrors, onCheckoutSuccess, }) => {
|
|
26320
26336
|
// Context
|
|
26321
|
-
const { shadow } = useSubscriptionProps();
|
|
26337
|
+
const { shadow, isInPreviewMode } = useSubscriptionProps();
|
|
26322
26338
|
const { quote: maskedQuote, onChangeQuantity, getFeatureQuantity, onRecalculateTaxes, isFeatureAddonsLoading, isUpdatingQuote, } = useContext(QuoteContext);
|
|
26323
26339
|
// Read fragments
|
|
26324
26340
|
const quote = readFragment(PlanPickerCheckoutBar_QuoteFragment, maskedQuote);
|
|
@@ -26375,6 +26391,8 @@ const PlanPickerCheckoutBar = ({ selectedPriceList, handlePortalErrors, onChecko
|
|
|
26375
26391
|
}
|
|
26376
26392
|
const isDisabled = !quote || maybeIsChargeLoading || !selectedPriceList || !charge.selfServiceQuantity;
|
|
26377
26393
|
return (jsx(CheckoutBarInput, { disabled: isDisabled, priceListCharge: charge, quantity: quantity, onQuantityChanged: quantity => {
|
|
26394
|
+
if (isInPreviewMode)
|
|
26395
|
+
return;
|
|
26378
26396
|
onChangeQuantity(charge.id, quantity);
|
|
26379
26397
|
} }, index));
|
|
26380
26398
|
}) }), jsx(CheckoutBarSummarySection, { onClickCheckout: () => setPayModalVisible(true), selectedPriceList: selectedPriceList }), jsx(Checkout, { onCancel: () => setPayModalVisible(false), onFail: error => handlePortalErrors === null || handlePortalErrors === void 0 ? void 0 : handlePortalErrors(error), onSuccess: handleCheckoutSuccess, onRecalculateTaxes: onRecalculateTaxes, open: payModalVisible, quote: quote, token: token, isUpdatingQuote: isUpdatingQuote })] }));
|
|
@@ -27060,7 +27078,11 @@ function AddonPlanRow({ addonPriceList: maskedAddonPriceList, selectedPriceList,
|
|
|
27060
27078
|
// Derived state
|
|
27061
27079
|
const switchDisabled = isInPreviewMode || isPurchased;
|
|
27062
27080
|
const hasCustomPrice = ((_b = addonPriceList.plan) === null || _b === void 0 ? void 0 : _b.pricingDescription) != null;
|
|
27063
|
-
return (jsxs("div", { className: `bunny-flex bunny-flex-row bunny-gap-2 bunny-justify-between bunny-items-center bunny-p-4 bunny-rounded-md bunny-bg-white ${shadow ? `shadow-${shadow}` : ''} bunny-mb-2`, children: [jsxs("div", { className: "bunny-flex bunny-flex-row bunny-gap-2 bunny-items-center", children: [jsx("div", { className: `bunny-font-medium bunny-text-center bunny-text-orange-600`, children: (_c = addonPriceList.plan) === null || _c === void 0 ? void 0 : _c.name }), jsx(PriceListCardDescription, { description: (_e = (_d = addonPriceList.plan) === null || _d === void 0 ? void 0 : _d.description) !== null && _e !== void 0 ? _e : '' }), !hasCustomPrice && (jsx(PriceListCardPrice, { priceList: addonPriceList, className: "bunny-text-sm bunny-font-medium bunny-text-gray-900" })), jsx(PriceListCardPriceDescription, { feature: activeCharge === null || activeCharge === void 0 ? void 0 : activeCharge.feature, priceList: addonPriceList }), jsx(Button, { type: "link", onClick:
|
|
27081
|
+
return (jsxs("div", { className: `bunny-flex bunny-flex-row bunny-gap-2 bunny-justify-between bunny-items-center bunny-p-4 bunny-rounded-md bunny-bg-white ${shadow ? `shadow-${shadow}` : ''} bunny-mb-2`, children: [jsxs("div", { className: "bunny-flex bunny-flex-row bunny-gap-2 bunny-items-center", children: [jsx("div", { className: `bunny-font-medium bunny-text-center bunny-text-orange-600`, children: (_c = addonPriceList.plan) === null || _c === void 0 ? void 0 : _c.name }), jsx(PriceListCardDescription, { description: (_e = (_d = addonPriceList.plan) === null || _d === void 0 ? void 0 : _d.description) !== null && _e !== void 0 ? _e : '' }), !hasCustomPrice && (jsx(PriceListCardPrice, { priceList: addonPriceList, className: "bunny-text-sm bunny-font-medium bunny-text-gray-900" })), jsx(PriceListCardPriceDescription, { feature: activeCharge === null || activeCharge === void 0 ? void 0 : activeCharge.feature, priceList: addonPriceList }), jsx(Button, { type: "link", onClick: () => {
|
|
27082
|
+
if (isInPreviewMode)
|
|
27083
|
+
return;
|
|
27084
|
+
onClickSelect();
|
|
27085
|
+
}, children: jsx(InfoCircleOutlined, {}) })] }), jsx(Switch, { id: addonPlanSwitchTestId((_g = (_f = addonPriceList.plan) === null || _f === void 0 ? void 0 : _f.name) !== null && _g !== void 0 ? _g : ''), loading: isPending && !switchDisabled, checked: addedQuoteChange || isPurchased, onChange: (checked) => {
|
|
27064
27086
|
if (checked) {
|
|
27065
27087
|
addAddonQuoteChange();
|
|
27066
27088
|
}
|
|
@@ -29207,7 +29229,8 @@ const UpgradeWrapper = ({ onChangePlanCancel, handlePortalErrors, upgradingSubsc
|
|
|
29207
29229
|
pluralType: 'upgradeSubscriptions',
|
|
29208
29230
|
token,
|
|
29209
29231
|
}),
|
|
29210
|
-
queryFn: () => getSubscriptions({
|
|
29232
|
+
queryFn: () => getSubscriptions({ token, apiHost, isInPreviewMode }),
|
|
29233
|
+
enabled: !isInPreviewMode, // Don't query subscriptions in preview mode
|
|
29211
29234
|
});
|
|
29212
29235
|
// find upgrading subscription based on upgradingSubscriptionId
|
|
29213
29236
|
const upgradingSubscription = (_b = (_a = subscriptionsData === null || subscriptionsData === void 0 ? void 0 : subscriptionsData.subscriptions) === null || _a === void 0 ? void 0 : _a.nodes) === null || _b === void 0 ? void 0 : _b.find(subscription => (subscription === null || subscription === void 0 ? void 0 : subscription.id) === upgradingSubscriptionId);
|
|
@@ -29270,7 +29293,8 @@ const SubscriptionsWrapper = ({ handlePortalErrors, companyName, isInPreviewMode
|
|
|
29270
29293
|
pluralType: 'subscriptions',
|
|
29271
29294
|
token,
|
|
29272
29295
|
}),
|
|
29273
|
-
queryFn: () => getSubscriptions$1({ token, apiHost }),
|
|
29296
|
+
queryFn: () => getSubscriptions$1({ token, apiHost, isInPreviewMode }),
|
|
29297
|
+
enabled: !isInPreviewMode, // Don't query subscriptions in preview mode
|
|
29274
29298
|
});
|
|
29275
29299
|
const subscriptions = (_b = (_a = subscriptionsData === null || subscriptionsData === void 0 ? void 0 : subscriptionsData.subscriptions) === null || _a === void 0 ? void 0 : _a.nodes) === null || _b === void 0 ? void 0 : _b.filter(subscription => subscription !== null);
|
|
29276
29300
|
const defaultStyles = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bunnyapp/components",
|
|
3
|
-
"version": "1.7.0-beta.
|
|
3
|
+
"version": "1.7.0-beta.34",
|
|
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",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"@pdf-viewer/react": "^1.8.0",
|
|
81
81
|
"@stripe/react-stripe-js": "^3.8.1",
|
|
82
82
|
"@stripe/stripe-js": "^7.7.0",
|
|
83
|
-
"@tanstack/react-query": "^5.
|
|
83
|
+
"@tanstack/react-query": "^5.59.0",
|
|
84
84
|
"antd": "^5.28.0",
|
|
85
85
|
"graphql": "^16.11.0",
|
|
86
86
|
"graphql-request": "^6.1.0",
|