@bunnyapp/components 1.6.0-beta.2 → 1.6.0-beta.4
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 +19 -0
- package/dist/cjs/index.js +15 -9
- package/dist/cjs/types/src/components/Subscriptions/quantityChangeDrawer/quantityChangeDrawerDesktop/QuantityChangeDrawerDesktop.d.ts +0 -2
- package/dist/cjs/types/src/enums/SubscriptionState.d.ts +9 -0
- package/dist/esm/index.js +43 -37
- package/dist/esm/types/src/components/Subscriptions/quantityChangeDrawer/quantityChangeDrawerDesktop/QuantityChangeDrawerDesktop.d.ts +0 -2
- package/dist/esm/types/src/enums/SubscriptionState.d.ts +9 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -54,6 +54,25 @@ npm run codegen
|
|
|
54
54
|
npx gql-tada doctor
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
+
### Deprecating @bunnyapp/common
|
|
58
|
+
|
|
59
|
+
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:
|
|
60
|
+
|
|
61
|
+
1. **Create local definitions**:
|
|
62
|
+
- **Enums** → Create in `src/enums/` directory (e.g., `src/enums/SubscriptionState.ts`)
|
|
63
|
+
- **Types** → Create in `src/types/` directory (e.g., `src/types/billingDetails.ts`)
|
|
64
|
+
|
|
65
|
+
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.
|
|
66
|
+
|
|
67
|
+
3. **Example pattern**:
|
|
68
|
+
```typescript
|
|
69
|
+
// Before (from @bunnyapp/common)
|
|
70
|
+
import { SubscriptionState } from '@bunnyapp/common';
|
|
71
|
+
|
|
72
|
+
// After (local enum)
|
|
73
|
+
import SubscriptionState from '../enums/SubscriptionState';
|
|
74
|
+
```
|
|
75
|
+
|
|
57
76
|
### Storybook stories
|
|
58
77
|
|
|
59
78
|
To view the storybook stories, run `npx storybook dev`.
|
package/dist/cjs/index.js
CHANGED
|
@@ -52,7 +52,7 @@ var css_248z = ":root {\n --row-background: #ffffff;\n --row-background-altern
|
|
|
52
52
|
styleInject(css_248z);
|
|
53
53
|
|
|
54
54
|
// This will be replaced at build time by rollup-plugin-replace
|
|
55
|
-
const PACKAGE_VERSION = '1.6.0-beta.
|
|
55
|
+
const PACKAGE_VERSION = '1.6.0-beta.3';
|
|
56
56
|
const createRequestHeaders = (token) => {
|
|
57
57
|
const headers = createClientDevHeaders({ token });
|
|
58
58
|
// Add the components version header
|
|
@@ -22068,10 +22068,8 @@ const QUANTITY_CHANGE_HEADER_TITLE = 'Update quantities';
|
|
|
22068
22068
|
const QUANTITY_CHANGE_HEADER_DESCRIPTION = 'Adjust quantities below. The change will take effect immediately after checkout has been completed.';
|
|
22069
22069
|
const QuantityDrawerDesktop_SubscriptionFragment = t(`
|
|
22070
22070
|
fragment QuantityDrawerDesktop_SubscriptionFragment on Subscription {
|
|
22071
|
-
state
|
|
22072
22071
|
currentCharges {
|
|
22073
22072
|
chargeType
|
|
22074
|
-
trial
|
|
22075
22073
|
...QuantityChangeGridRow_SubscriptionChargeFragment
|
|
22076
22074
|
}
|
|
22077
22075
|
...QuantityChangeGridRow_SubscriptionFragment
|
|
@@ -22116,11 +22114,8 @@ const QuantityChangeDrawerDesktop = ({ editingQuote, editingQuoteData, onClose,
|
|
|
22116
22114
|
}, children: [jsxRuntime.jsx(QuantityChangeGridTitle, { children: " " }), jsxRuntime.jsx(QuantityChangeGridTitle, { right: true, children: "CURRENT QUANTITY" }), jsxRuntime.jsx(QuantityChangeGridTitle, { right: true, children: "NEW QUANTITY" }), jsxRuntime.jsx(antd.Divider, { className: "bunny-col-span-full", style: { marginBottom: '8px', marginTop: '20px' } }), subscriptions.map((maskedSubscription, index) => {
|
|
22117
22115
|
var _a;
|
|
22118
22116
|
const subscription = readFragment(QuantityDrawerDesktop_SubscriptionFragment, maskedSubscription);
|
|
22119
|
-
const isTrial = (subscription === null || subscription === void 0 ? void 0 : subscription.state) === 'TRIAL';
|
|
22120
22117
|
return (jsxRuntime.jsx("div", { className: "bunny-contents", children: (_a = subscription === null || subscription === void 0 ? void 0 : subscription.currentCharges) === null || _a === void 0 ? void 0 : _a.map((charge, chargeIndex) => {
|
|
22121
|
-
if (
|
|
22122
|
-
(!isTrial && charge.trial) ||
|
|
22123
|
-
charge.chargeType === 'USAGE')
|
|
22118
|
+
if (charge.chargeType === 'USAGE')
|
|
22124
22119
|
return null;
|
|
22125
22120
|
return (jsxRuntime.jsx(QuantityChangeGridRow, { chargeIndex: chargeIndex, editingQuote: editingQuote, setEditingQuoteData: setEditingQuoteData, subscription: subscription, subscriptionCharge: charge, subscriptionIndex: index, setUpdatingChargeQuantityId: setUpdatingChargeQuantityId, updatingChargeQuantityId: updatingChargeQuantityId, setErrorUpdatingQuantity: setErrorUpdatingQuantity }, chargeIndex));
|
|
22126
22121
|
}) }, index));
|
|
@@ -22164,10 +22159,21 @@ const useHasTaxPlugin = ({ apiHost, token, }) => {
|
|
|
22164
22159
|
return Boolean(plugins === null || plugins === void 0 ? void 0 : plugins.some((plugin) => plugin.type === "taxation"));
|
|
22165
22160
|
};
|
|
22166
22161
|
|
|
22162
|
+
var SubscriptionState;
|
|
22163
|
+
(function (SubscriptionState) {
|
|
22164
|
+
SubscriptionState["ACTIVE"] = "ACTIVE";
|
|
22165
|
+
SubscriptionState["TRIAL"] = "TRIAL";
|
|
22166
|
+
SubscriptionState["PENDING"] = "PENDING";
|
|
22167
|
+
SubscriptionState["EXPIRED"] = "EXPIRED";
|
|
22168
|
+
SubscriptionState["CANCELED"] = "CANCELED";
|
|
22169
|
+
SubscriptionState["TRIAL_EXPIRED"] = "TRIAL_EXPIRED";
|
|
22170
|
+
})(SubscriptionState || (SubscriptionState = {}));
|
|
22171
|
+
var SubscriptionState$1 = SubscriptionState;
|
|
22172
|
+
|
|
22167
22173
|
function shouldShowCouponEditor(quote, activeCouponsExist, upgradingSubscription) {
|
|
22168
22174
|
var _a, _b;
|
|
22169
|
-
const upgradingFromTrial = ((_a = upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) ===
|
|
22170
|
-
((_b = upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) ===
|
|
22175
|
+
const upgradingFromTrial = ((_a = upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState$1.TRIAL ||
|
|
22176
|
+
((_b = upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState$1.TRIAL_EXPIRED;
|
|
22171
22177
|
function upgradingFromFree() {
|
|
22172
22178
|
const totalPrice = upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.charges.reduce((acc, charge) => acc + Number((charge === null || charge === void 0 ? void 0 : charge.discountedPrice) || 0), 0);
|
|
22173
22179
|
return totalPrice === 0;
|
|
@@ -2,10 +2,8 @@ import { Quote } from '@bunnyapp/common';
|
|
|
2
2
|
import { FragmentOf } from 'gql.tada';
|
|
3
3
|
import { EditingQuoteDataType } from '../../SubscriptionsListContainer';
|
|
4
4
|
export declare const QuantityDrawerDesktop_SubscriptionFragment: import("gql.tada").TadaDocumentNode<{
|
|
5
|
-
state: "ACTIVE" | "TRIAL" | "CANCELED" | "EXPIRED" | "TRIAL_EXPIRED" | "PENDING";
|
|
6
5
|
currentCharges: {
|
|
7
6
|
chargeType: "ONE_TIME" | "RECURRING" | "USAGE" | null;
|
|
8
|
-
trial: boolean;
|
|
9
7
|
[$tada.fragmentRefs]: {
|
|
10
8
|
QuantityChangeGridRow_SubscriptionChargeFragment: "SubscriptionCharge";
|
|
11
9
|
};
|
package/dist/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { createContext, useContext, useMemo, useState, useEffect, useRef, useCallback, Fragment as Fragment$1 } from 'react';
|
|
3
3
|
import { DownloadOutlined, CreditCardOutlined, EllipsisOutlined, BankOutlined, SearchOutlined, CheckCircleFilled, CloseOutlined, InfoCircleOutlined } from '@ant-design/icons';
|
|
4
|
-
import { gqlRequest as gqlRequest$1, createClientDevHeaders as createClientDevHeaders$1, X_BUNNY_COMPONENTS_VERSION_HEADER_NAME, DEFAULT_ACCENT_COLOR, DEFAULT_BRAND_COLOR, DEFAULT_SECONDARY_COLOR, DEFAULT_TOP_NAV_IMAGE_URL, QueryKeyFactory, useIsMobile, isColorTooDark, INPUT_BORDER_COLOR, SLATE_50, SLATE_400, SLATE_200, request as request$1, PRIMARY_COLOR, useErrorNotification, invokePlugin, useAllErrorFormats, formatCurrency, GRAY_500, GRAY_200, useSuccessNotification, PAYABLE_INVOICE_STATES, BreakpointNumbers, useGraphQLmutation, useInfoNotification, formatDate, TransactionState, SLATE_600, WHITE, TransactionKind, SLATE_500, Lists,
|
|
4
|
+
import { gqlRequest as gqlRequest$1, createClientDevHeaders as createClientDevHeaders$1, X_BUNNY_COMPONENTS_VERSION_HEADER_NAME, DEFAULT_ACCENT_COLOR, DEFAULT_BRAND_COLOR, DEFAULT_SECONDARY_COLOR, DEFAULT_TOP_NAV_IMAGE_URL, QueryKeyFactory, useIsMobile, isColorTooDark, INPUT_BORDER_COLOR, SLATE_50, SLATE_400, SLATE_200, request as request$1, PRIMARY_COLOR, useErrorNotification, invokePlugin, useAllErrorFormats, formatCurrency, GRAY_500, GRAY_200, useSuccessNotification, PAYABLE_INVOICE_STATES, BreakpointNumbers, useGraphQLmutation, useInfoNotification, formatDate, TransactionState, SLATE_600, WHITE, TransactionKind, SLATE_500, Lists, QuoteChangeKind, getAccount, BillingPeriod, MODAL_MAX_HEIGHT, DataInterval, SubscriptionState as SubscriptionState$2, PricingModel, ChargeType, StringUtils, PERIOD_LABELS, PricingStyle, SLATE_100 } from '@bunnyapp/common';
|
|
5
5
|
import { ConfigProvider, Spin, Button, theme as theme$1, Tag, Dropdown, Typography, Input, Modal, Checkbox, Skeleton, Collapse, Form, Tooltip, Drawer, Card as Card$1, Divider, Select, Image, Popconfirm, Table, Radio, Space, Switch } from 'antd';
|
|
6
6
|
import { Markup } from 'interweave';
|
|
7
7
|
import request, { GraphQLClient } from 'graphql-request';
|
|
@@ -50,7 +50,7 @@ var css_248z = ":root {\n --row-background: #ffffff;\n --row-background-altern
|
|
|
50
50
|
styleInject(css_248z);
|
|
51
51
|
|
|
52
52
|
// This will be replaced at build time by rollup-plugin-replace
|
|
53
|
-
const PACKAGE_VERSION = '1.6.0-beta.
|
|
53
|
+
const PACKAGE_VERSION = '1.6.0-beta.3';
|
|
54
54
|
const createRequestHeaders = (token) => {
|
|
55
55
|
const headers = createClientDevHeaders({ token });
|
|
56
56
|
// Add the components version header
|
|
@@ -22066,10 +22066,8 @@ const QUANTITY_CHANGE_HEADER_TITLE = 'Update quantities';
|
|
|
22066
22066
|
const QUANTITY_CHANGE_HEADER_DESCRIPTION = 'Adjust quantities below. The change will take effect immediately after checkout has been completed.';
|
|
22067
22067
|
const QuantityDrawerDesktop_SubscriptionFragment = t(`
|
|
22068
22068
|
fragment QuantityDrawerDesktop_SubscriptionFragment on Subscription {
|
|
22069
|
-
state
|
|
22070
22069
|
currentCharges {
|
|
22071
22070
|
chargeType
|
|
22072
|
-
trial
|
|
22073
22071
|
...QuantityChangeGridRow_SubscriptionChargeFragment
|
|
22074
22072
|
}
|
|
22075
22073
|
...QuantityChangeGridRow_SubscriptionFragment
|
|
@@ -22114,11 +22112,8 @@ const QuantityChangeDrawerDesktop = ({ editingQuote, editingQuoteData, onClose,
|
|
|
22114
22112
|
}, children: [jsx(QuantityChangeGridTitle, { children: " " }), jsx(QuantityChangeGridTitle, { right: true, children: "CURRENT QUANTITY" }), jsx(QuantityChangeGridTitle, { right: true, children: "NEW QUANTITY" }), jsx(Divider, { className: "bunny-col-span-full", style: { marginBottom: '8px', marginTop: '20px' } }), subscriptions.map((maskedSubscription, index) => {
|
|
22115
22113
|
var _a;
|
|
22116
22114
|
const subscription = readFragment(QuantityDrawerDesktop_SubscriptionFragment, maskedSubscription);
|
|
22117
|
-
const isTrial = (subscription === null || subscription === void 0 ? void 0 : subscription.state) === 'TRIAL';
|
|
22118
22115
|
return (jsx("div", { className: "bunny-contents", children: (_a = subscription === null || subscription === void 0 ? void 0 : subscription.currentCharges) === null || _a === void 0 ? void 0 : _a.map((charge, chargeIndex) => {
|
|
22119
|
-
if (
|
|
22120
|
-
(!isTrial && charge.trial) ||
|
|
22121
|
-
charge.chargeType === 'USAGE')
|
|
22116
|
+
if (charge.chargeType === 'USAGE')
|
|
22122
22117
|
return null;
|
|
22123
22118
|
return (jsx(QuantityChangeGridRow, { chargeIndex: chargeIndex, editingQuote: editingQuote, setEditingQuoteData: setEditingQuoteData, subscription: subscription, subscriptionCharge: charge, subscriptionIndex: index, setUpdatingChargeQuantityId: setUpdatingChargeQuantityId, updatingChargeQuantityId: updatingChargeQuantityId, setErrorUpdatingQuantity: setErrorUpdatingQuantity }, chargeIndex));
|
|
22124
22119
|
}) }, index));
|
|
@@ -22162,10 +22157,21 @@ const useHasTaxPlugin = ({ apiHost, token, }) => {
|
|
|
22162
22157
|
return Boolean(plugins === null || plugins === void 0 ? void 0 : plugins.some((plugin) => plugin.type === "taxation"));
|
|
22163
22158
|
};
|
|
22164
22159
|
|
|
22160
|
+
var SubscriptionState;
|
|
22161
|
+
(function (SubscriptionState) {
|
|
22162
|
+
SubscriptionState["ACTIVE"] = "ACTIVE";
|
|
22163
|
+
SubscriptionState["TRIAL"] = "TRIAL";
|
|
22164
|
+
SubscriptionState["PENDING"] = "PENDING";
|
|
22165
|
+
SubscriptionState["EXPIRED"] = "EXPIRED";
|
|
22166
|
+
SubscriptionState["CANCELED"] = "CANCELED";
|
|
22167
|
+
SubscriptionState["TRIAL_EXPIRED"] = "TRIAL_EXPIRED";
|
|
22168
|
+
})(SubscriptionState || (SubscriptionState = {}));
|
|
22169
|
+
var SubscriptionState$1 = SubscriptionState;
|
|
22170
|
+
|
|
22165
22171
|
function shouldShowCouponEditor(quote, activeCouponsExist, upgradingSubscription) {
|
|
22166
22172
|
var _a, _b;
|
|
22167
|
-
const upgradingFromTrial = ((_a = upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState.TRIAL ||
|
|
22168
|
-
((_b = upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState.TRIAL_EXPIRED;
|
|
22173
|
+
const upgradingFromTrial = ((_a = upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState$1.TRIAL ||
|
|
22174
|
+
((_b = upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState$1.TRIAL_EXPIRED;
|
|
22169
22175
|
function upgradingFromFree() {
|
|
22170
22176
|
const totalPrice = upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.charges.reduce((acc, charge) => acc + Number((charge === null || charge === void 0 ? void 0 : charge.discountedPrice) || 0), 0);
|
|
22171
22177
|
return totalPrice === 0;
|
|
@@ -22856,29 +22862,29 @@ const TAG_COLORS = {
|
|
|
22856
22862
|
|
|
22857
22863
|
const canSubscriptionUpgradeFromTrial = (subscription) => {
|
|
22858
22864
|
var _a;
|
|
22859
|
-
return (((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState.TRIAL &&
|
|
22865
|
+
return (((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState$2.TRIAL &&
|
|
22860
22866
|
subscription.plan.selfServiceBuy) ||
|
|
22861
22867
|
false;
|
|
22862
22868
|
};
|
|
22863
22869
|
const canSubscriptionUpgradeFromTrialExpired = (subscription) => {
|
|
22864
22870
|
var _a;
|
|
22865
|
-
return (((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState.TRIAL_EXPIRED &&
|
|
22871
|
+
return (((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState$2.TRIAL_EXPIRED &&
|
|
22866
22872
|
subscription.plan.selfServiceBuy) ||
|
|
22867
22873
|
false;
|
|
22868
22874
|
};
|
|
22869
22875
|
const isSubscriptionNotActive = (subscription) => {
|
|
22870
22876
|
var _a, _b, _c;
|
|
22871
|
-
return ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState.EXPIRED ||
|
|
22872
|
-
((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState.CANCELED ||
|
|
22873
|
-
((_c = subscription.state) === null || _c === void 0 ? void 0 : _c.toUpperCase()) === SubscriptionState.TRIAL_EXPIRED;
|
|
22877
|
+
return ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState$2.EXPIRED ||
|
|
22878
|
+
((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState$2.CANCELED ||
|
|
22879
|
+
((_c = subscription.state) === null || _c === void 0 ? void 0 : _c.toUpperCase()) === SubscriptionState$2.TRIAL_EXPIRED;
|
|
22874
22880
|
};
|
|
22875
22881
|
const isSubscriptionActiveOrPending = (subscription) => {
|
|
22876
22882
|
var _a, _b;
|
|
22877
|
-
return ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState.ACTIVE ||
|
|
22878
|
-
((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState.PENDING;
|
|
22883
|
+
return ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState$2.ACTIVE ||
|
|
22884
|
+
((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState$2.PENDING;
|
|
22879
22885
|
};
|
|
22880
|
-
const isSubscriptionTrial = (subscription) => { var _a; return ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState.TRIAL; };
|
|
22881
|
-
const isSubscriptionTrialExpired = (subscription) => { var _a; return ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState.TRIAL_EXPIRED; };
|
|
22886
|
+
const isSubscriptionTrial = (subscription) => { var _a; return ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState$2.TRIAL; };
|
|
22887
|
+
const isSubscriptionTrialExpired = (subscription) => { var _a; return ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState$2.TRIAL_EXPIRED; };
|
|
22882
22888
|
// Helper function to check if charge is a discount
|
|
22883
22889
|
const isDiscount = (kind) => kind === QuoteChangeKind.DISCOUNT || kind === QuoteChangeKind.FREE_PERIOD_DISCOUNT;
|
|
22884
22890
|
const hasPriceTiers = (charge) => {
|
|
@@ -22947,12 +22953,12 @@ const { Text: Text$f } = Typography;
|
|
|
22947
22953
|
const getSubscriptionStatusText = (subscription) => {
|
|
22948
22954
|
const { cancellationDate, state, evergreen, endDate, trialEndDate, trialStartDate, startDate, trialExpirationAction, } = subscription;
|
|
22949
22955
|
const stateUpperCased = state === null || state === void 0 ? void 0 : state.toUpperCase();
|
|
22950
|
-
const isActive = stateUpperCased === SubscriptionState.ACTIVE;
|
|
22951
|
-
const isPending = stateUpperCased === SubscriptionState.PENDING;
|
|
22952
|
-
const isCanceled = stateUpperCased === SubscriptionState.CANCELED;
|
|
22953
|
-
const isExpired = stateUpperCased === SubscriptionState.EXPIRED;
|
|
22954
|
-
const isTrialExpired = stateUpperCased === SubscriptionState.TRIAL_EXPIRED;
|
|
22955
|
-
const isTrial = stateUpperCased === SubscriptionState.TRIAL;
|
|
22956
|
+
const isActive = stateUpperCased === SubscriptionState$2.ACTIVE;
|
|
22957
|
+
const isPending = stateUpperCased === SubscriptionState$2.PENDING;
|
|
22958
|
+
const isCanceled = stateUpperCased === SubscriptionState$2.CANCELED;
|
|
22959
|
+
const isExpired = stateUpperCased === SubscriptionState$2.EXPIRED;
|
|
22960
|
+
const isTrialExpired = stateUpperCased === SubscriptionState$2.TRIAL_EXPIRED;
|
|
22961
|
+
const isTrial = stateUpperCased === SubscriptionState$2.TRIAL;
|
|
22956
22962
|
if (cancellationDate && (isActive || isPending || isTrial))
|
|
22957
22963
|
return (jsxs(CustomizedTag, { color: "red", children: ["Canceled - ends on ", formatDate(cancellationDate)] }));
|
|
22958
22964
|
if (cancellationDate && isCanceled)
|
|
@@ -23358,9 +23364,9 @@ const useQuoteCreate = ({ upgradingSubscription, selectedPriceList, token, }) =>
|
|
|
23358
23364
|
return;
|
|
23359
23365
|
}
|
|
23360
23366
|
const buyingAddonsForCurrentSubscription = (upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.priceList.id) === (selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id);
|
|
23361
|
-
const isActivatingTrialSubscription = ((_a = upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState.TRIAL &&
|
|
23367
|
+
const isActivatingTrialSubscription = ((_a = upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState$2.TRIAL &&
|
|
23362
23368
|
upgradingSubscription.priceList.id === (selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id);
|
|
23363
|
-
const isActivatingExpiredTrialSubscription = ((_b = upgradingSubscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState.TRIAL_EXPIRED &&
|
|
23369
|
+
const isActivatingExpiredTrialSubscription = ((_b = upgradingSubscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState$2.TRIAL_EXPIRED &&
|
|
23364
23370
|
upgradingSubscription.priceList.id === (selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id);
|
|
23365
23371
|
if (isActivatingTrialSubscription || isActivatingExpiredTrialSubscription) {
|
|
23366
23372
|
subscriptionActivate({
|
|
@@ -24223,9 +24229,9 @@ const PriceListCard = ({ hideButton, isSelected, priceList, subscriptions, trial
|
|
|
24223
24229
|
const subscriptionPlan = subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.find(subscription => {
|
|
24224
24230
|
var _a, _b, _c;
|
|
24225
24231
|
return subscription.plan.id === priceList.plan.id &&
|
|
24226
|
-
((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) !== SubscriptionState.CANCELED &&
|
|
24227
|
-
((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) !== SubscriptionState.EXPIRED &&
|
|
24228
|
-
((_c = subscription.state) === null || _c === void 0 ? void 0 : _c.toUpperCase()) !== SubscriptionState.TRIAL_EXPIRED;
|
|
24232
|
+
((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) !== SubscriptionState$2.CANCELED &&
|
|
24233
|
+
((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) !== SubscriptionState$2.EXPIRED &&
|
|
24234
|
+
((_c = subscription.state) === null || _c === void 0 ? void 0 : _c.toUpperCase()) !== SubscriptionState$2.TRIAL_EXPIRED;
|
|
24229
24235
|
});
|
|
24230
24236
|
if (!activeCharge) {
|
|
24231
24237
|
return null;
|
|
@@ -24622,7 +24628,7 @@ const PlanAddonsCard = ({ selectedPriceList, subscriptions, addonPlans, selected
|
|
|
24622
24628
|
const addonSubscriptionIds = currentSubscription === null || currentSubscription === void 0 ? void 0 : currentSubscription.addonSubscriptions;
|
|
24623
24629
|
const addonSubscriptions = addonSubscriptionIds === null || addonSubscriptionIds === void 0 ? void 0 : addonSubscriptionIds.map(addonSubscription => subscriptions.find(subscription => subscription.id === addonSubscription.id));
|
|
24624
24630
|
// filter out cancelled addons
|
|
24625
|
-
const activeAddonSubscriptions = addonSubscriptions === null || addonSubscriptions === void 0 ? void 0 : addonSubscriptions.filter(addonSubscription => (addonSubscription === null || addonSubscription === void 0 ? void 0 : addonSubscription.state) !== SubscriptionState.CANCELED);
|
|
24631
|
+
const activeAddonSubscriptions = addonSubscriptions === null || addonSubscriptions === void 0 ? void 0 : addonSubscriptions.filter(addonSubscription => (addonSubscription === null || addonSubscription === void 0 ? void 0 : addonSubscription.state) !== SubscriptionState$2.CANCELED);
|
|
24626
24632
|
return activeAddonSubscriptions === null || activeAddonSubscriptions === void 0 ? void 0 : activeAddonSubscriptions.some(addonSubscription => (addonSubscription === null || addonSubscription === void 0 ? void 0 : addonSubscription.priceList.id) === priceList.id);
|
|
24627
24633
|
}
|
|
24628
24634
|
return (jsxs(Text$4, { className: `bunny-flex bunny-flex-col ${className}`, children: [jsx(AddonPlanModal, { onClose: () => setSelectedAddonPriceList(undefined), priceList: selectedAddonPriceList }), addonPriceLists.length > 0 && (jsxs(Fragment, { children: [jsx("div", { className: "bunny-text-slate-500 bunny-text-xs bunny-font-medium", children: 'Add-on plans'.toUpperCase() }), jsx("div", { className: "bunny-flex bunny-flex-col", children: addonPriceLists.map(addonPriceList => {
|
|
@@ -25430,16 +25436,16 @@ const Subscriptions = ({ handlePortalErrors, companyName, noSubscriptionsCompone
|
|
|
25430
25436
|
const allSubscriptionsInactive = (_c = (_b = subscriptionsData === null || subscriptionsData === void 0 ? void 0 : subscriptionsData.subscriptions) === null || _b === void 0 ? void 0 : _b.nodes) === null || _c === void 0 ? void 0 : _c.every(maskedSubscription => {
|
|
25431
25437
|
var _a, _b, _c;
|
|
25432
25438
|
const subscription = readFragment(Subscriptions_SubscriptionFragment, maskedSubscription);
|
|
25433
|
-
return (((_a = subscription === null || subscription === void 0 ? void 0 : subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState.EXPIRED ||
|
|
25434
|
-
((_b = subscription === null || subscription === void 0 ? void 0 : subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState.TRIAL_EXPIRED ||
|
|
25435
|
-
((_c = subscription === null || subscription === void 0 ? void 0 : subscription.state) === null || _c === void 0 ? void 0 : _c.toUpperCase()) === SubscriptionState.CANCELED);
|
|
25439
|
+
return (((_a = subscription === null || subscription === void 0 ? void 0 : subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState$2.EXPIRED ||
|
|
25440
|
+
((_b = subscription === null || subscription === void 0 ? void 0 : subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState$2.TRIAL_EXPIRED ||
|
|
25441
|
+
((_c = subscription === null || subscription === void 0 ? void 0 : subscription.state) === null || _c === void 0 ? void 0 : _c.toUpperCase()) === SubscriptionState$2.CANCELED);
|
|
25436
25442
|
});
|
|
25437
25443
|
const hasInactiveSubscriptions = (_e = (_d = subscriptionsData === null || subscriptionsData === void 0 ? void 0 : subscriptionsData.subscriptions) === null || _d === void 0 ? void 0 : _d.nodes) === null || _e === void 0 ? void 0 : _e.some(maskedSubscription => {
|
|
25438
25444
|
var _a, _b, _c;
|
|
25439
25445
|
const subscription = readFragment(Subscriptions_SubscriptionFragment, maskedSubscription);
|
|
25440
|
-
return (((_a = subscription === null || subscription === void 0 ? void 0 : subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState.EXPIRED ||
|
|
25441
|
-
((_b = subscription === null || subscription === void 0 ? void 0 : subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState.TRIAL_EXPIRED ||
|
|
25442
|
-
((_c = subscription === null || subscription === void 0 ? void 0 : subscription.state) === null || _c === void 0 ? void 0 : _c.toUpperCase()) === SubscriptionState.CANCELED);
|
|
25446
|
+
return (((_a = subscription === null || subscription === void 0 ? void 0 : subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState$2.EXPIRED ||
|
|
25447
|
+
((_b = subscription === null || subscription === void 0 ? void 0 : subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState$2.TRIAL_EXPIRED ||
|
|
25448
|
+
((_c = subscription === null || subscription === void 0 ? void 0 : subscription.state) === null || _c === void 0 ? void 0 : _c.toUpperCase()) === SubscriptionState$2.CANCELED);
|
|
25443
25449
|
});
|
|
25444
25450
|
useEffect(() => {
|
|
25445
25451
|
if (allSubscriptionsInactive && subscriptions && subscriptions.length > 0) {
|
|
@@ -2,10 +2,8 @@ import { Quote } from '@bunnyapp/common';
|
|
|
2
2
|
import { FragmentOf } from 'gql.tada';
|
|
3
3
|
import { EditingQuoteDataType } from '../../SubscriptionsListContainer';
|
|
4
4
|
export declare const QuantityDrawerDesktop_SubscriptionFragment: import("gql.tada").TadaDocumentNode<{
|
|
5
|
-
state: "ACTIVE" | "TRIAL" | "CANCELED" | "EXPIRED" | "TRIAL_EXPIRED" | "PENDING";
|
|
6
5
|
currentCharges: {
|
|
7
6
|
chargeType: "ONE_TIME" | "RECURRING" | "USAGE" | null;
|
|
8
|
-
trial: boolean;
|
|
9
7
|
[$tada.fragmentRefs]: {
|
|
10
8
|
QuantityChangeGridRow_SubscriptionChargeFragment: "SubscriptionCharge";
|
|
11
9
|
};
|
package/package.json
CHANGED