@bunnyapp/components 1.4.0 → 1.5.0-beta.2
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 +1458 -1007
- package/dist/cjs/src/components/BunnyProvider.d.ts +0 -1
- package/dist/cjs/src/components/Checkout/Checkout.d.ts +12 -6
- package/dist/cjs/src/components/Invoice/Invoice.d.ts +5 -2
- package/dist/cjs/src/components/PaymentForm/PaymentForm.d.ts +1 -2
- package/dist/cjs/src/components/PaymentForm/PaymentFormTypes.d.ts +1 -11
- package/dist/cjs/src/components/Quote/Quote.d.ts +1 -1
- package/dist/cjs/src/components/Quote/Quote.stories.d.ts +5 -0
- package/dist/cjs/src/components/QuoteProvider.d.ts +22 -0
- package/dist/cjs/src/components/Subscriptions/AddonIndentation.d.ts +8 -0
- package/dist/cjs/src/components/Subscriptions/AddonSubscriptionCards.d.ts +7 -0
- package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/PriceListGrid.d.ts +4 -3
- package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/checkoutBar/CheckoutBarInput.d.ts +3 -4
- package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/checkoutBar/CheckoutBarSummarySection.d.ts +2 -3
- package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/checkoutBar/CheckoutButton.d.ts +2 -1
- package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/checkoutBar/PlanPickerCheckoutBar.d.ts +5 -6
- package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/EverythingPlanFeatures.d.ts +2 -1
- package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/PlanAddonsCard.d.ts +11 -0
- package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/PriceListCardDesktop.d.ts +5 -3
- package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/PriceListGridDesktop.d.ts +4 -3
- package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/planManagerUtils.d.ts +2 -2
- package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/planPickerMobile/PriceListCardMobile.d.ts +3 -3
- package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/planPickerMobile/PriceListGridMobile.d.ts +3 -3
- package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCard.d.ts +4 -2
- package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCardButton.d.ts +2 -2
- package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCardPrice.d.ts +2 -1
- package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCardTitle.d.ts +1 -1
- package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/priceListCardUtils.d.ts +1 -2
- package/dist/{esm/src/components/Subscriptions/PlanManager/PlanPicker → cjs/src/components/Subscriptions/PlanManager/PlanPicker/priceListSelector}/PriceListSelector.d.ts +2 -4
- package/dist/cjs/src/components/Subscriptions/QuantityDrawerContainer.d.ts +14 -0
- package/dist/cjs/src/components/Subscriptions/quantityChangeDrawer/QuantityChangeGridRow.d.ts +4 -2
- package/dist/cjs/src/components/Subscriptions/quantityChangeDrawer/QuantityInput.d.ts +4 -2
- package/dist/cjs/src/components/Subscriptions/quantityChangeDrawer/quantityChangeDrawerDesktop/QuantityChangeDrawerDesktop.d.ts +3 -1
- package/dist/cjs/src/components/Subscriptions/subscriptionsList/ChangeQuantitiesButton.d.ts +2 -3
- package/dist/cjs/src/components/Subscriptions/subscriptionsList/SubscriptionCardActions.d.ts +4 -3
- package/dist/cjs/src/components/Subscriptions/subscriptionsList/SubscriptionCardHeader.d.ts +2 -3
- package/dist/cjs/src/components/Subscriptions/subscriptionsList/SubscriptionsList.d.ts +2 -3
- package/dist/cjs/src/components/Subscriptions/subscriptionsList/subscriptionCardDesktop/SubscriptionCardDesktop.d.ts +3 -3
- package/dist/cjs/src/components/Subscriptions/subscriptionsList/subscriptionUtils.d.ts +1 -1
- package/dist/cjs/src/components/Transactions/Transactions.d.ts +5 -3
- package/dist/cjs/src/components/Transactions/transactionsList/TransactionsListDesktop.d.ts +1 -1
- package/dist/cjs/src/components/Transactions/transactionsList/TransactionsListMobile.d.ts +1 -1
- package/dist/cjs/src/components/Transactions/transactionsList/utils.d.ts +1 -1
- package/dist/cjs/src/{components/Invoice → contexts}/InvoiceQuoteContext.d.ts +2 -2
- package/dist/{esm/src/components/Subscriptions → cjs/src/contexts}/SubscriptionsContext.d.ts +0 -4
- package/dist/{esm/src/components/Transactions → cjs/src/contexts}/TransactionsListContext.d.ts +3 -2
- package/dist/cjs/src/graphql/QuoteRequests.d.ts +17 -2
- package/dist/cjs/src/graphql/mutations/quoteAddonCreate.d.ts +7 -0
- package/dist/cjs/src/graphql/mutations/quoteChangeCreate.d.ts +8 -0
- package/dist/cjs/src/graphql/mutations/quoteChangeDelete.d.ts +6 -0
- package/dist/cjs/src/graphql/mutations/quoteChargeDelete.d.ts +2 -1
- package/dist/cjs/src/graphql/mutations/quoteChargeUpdate.d.ts +2 -1
- package/dist/cjs/src/graphql/mutations/quoteCompose.d.ts +0 -1
- package/dist/cjs/src/graphql/mutations/quoteCreate.d.ts +8 -0
- package/dist/cjs/src/graphql/mutations/quoteCreateWithDeal.d.ts +10 -0
- package/dist/cjs/src/graphql/queries/getAddonPlans.d.ts +7 -0
- package/dist/cjs/src/graphql/queries/getFormattedQuote.d.ts +2 -1
- package/dist/cjs/src/graphql/queries/getQuote.d.ts +3 -1
- package/dist/cjs/src/hooks/quotes/useQuoteCreate.d.ts +9 -0
- package/dist/cjs/src/hooks/quotes/useQuoteQuantities.d.ts +14 -0
- package/dist/cjs/src/hooks/quotes/useQuoteUpdateFeatureAddon.d.ts +2 -3
- package/dist/cjs/src/hooks/useCurrentUserData.d.ts +11 -8
- package/dist/cjs/src/hooks/usePaymentMethod.d.ts +2 -1
- package/dist/cjs/src/hooks/usePriceListChangeOptions.d.ts +6 -0
- package/dist/cjs/src/hooks/useToggleAddonQuoteChange.d.ts +7 -0
- package/dist/cjs/src/utils/addonPlanUtils.d.ts +6 -0
- package/dist/cjs/src/utils/chargeUtils.d.ts +2 -0
- package/dist/cjs/src/utils/featureAddonUtils.d.ts +5 -2
- package/dist/esm/index.js +1460 -1009
- package/dist/esm/src/components/BunnyProvider.d.ts +0 -1
- package/dist/esm/src/components/Checkout/Checkout.d.ts +12 -6
- package/dist/esm/src/components/Invoice/Invoice.d.ts +5 -2
- package/dist/esm/src/components/PaymentForm/PaymentForm.d.ts +1 -2
- package/dist/esm/src/components/PaymentForm/PaymentFormTypes.d.ts +1 -11
- package/dist/esm/src/components/Quote/Quote.d.ts +1 -1
- package/dist/esm/src/components/Quote/Quote.stories.d.ts +5 -0
- package/dist/esm/src/components/QuoteProvider.d.ts +22 -0
- package/dist/esm/src/components/Subscriptions/AddonIndentation.d.ts +8 -0
- package/dist/esm/src/components/Subscriptions/AddonSubscriptionCards.d.ts +7 -0
- package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/PriceListGrid.d.ts +4 -3
- package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/checkoutBar/CheckoutBarInput.d.ts +3 -4
- package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/checkoutBar/CheckoutBarSummarySection.d.ts +2 -3
- package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/checkoutBar/CheckoutButton.d.ts +2 -1
- package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/checkoutBar/PlanPickerCheckoutBar.d.ts +5 -6
- package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/EverythingPlanFeatures.d.ts +2 -1
- package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/PlanAddonsCard.d.ts +11 -0
- package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/PriceListCardDesktop.d.ts +5 -3
- package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/PriceListGridDesktop.d.ts +4 -3
- package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/planManagerUtils.d.ts +2 -2
- package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/planPickerMobile/PriceListCardMobile.d.ts +3 -3
- package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/planPickerMobile/PriceListGridMobile.d.ts +3 -3
- package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCard.d.ts +4 -2
- package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCardButton.d.ts +2 -2
- package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCardPrice.d.ts +2 -1
- package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCardTitle.d.ts +1 -1
- package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/priceListCardUtils.d.ts +1 -2
- package/dist/{cjs/src/components/Subscriptions/PlanManager/PlanPicker → esm/src/components/Subscriptions/PlanManager/PlanPicker/priceListSelector}/PriceListSelector.d.ts +2 -4
- package/dist/esm/src/components/Subscriptions/QuantityDrawerContainer.d.ts +14 -0
- package/dist/esm/src/components/Subscriptions/quantityChangeDrawer/QuantityChangeGridRow.d.ts +4 -2
- package/dist/esm/src/components/Subscriptions/quantityChangeDrawer/QuantityInput.d.ts +4 -2
- package/dist/esm/src/components/Subscriptions/quantityChangeDrawer/quantityChangeDrawerDesktop/QuantityChangeDrawerDesktop.d.ts +3 -1
- package/dist/esm/src/components/Subscriptions/subscriptionsList/ChangeQuantitiesButton.d.ts +2 -3
- package/dist/esm/src/components/Subscriptions/subscriptionsList/SubscriptionCardActions.d.ts +4 -3
- package/dist/esm/src/components/Subscriptions/subscriptionsList/SubscriptionCardHeader.d.ts +2 -3
- package/dist/esm/src/components/Subscriptions/subscriptionsList/SubscriptionsList.d.ts +2 -3
- package/dist/esm/src/components/Subscriptions/subscriptionsList/subscriptionCardDesktop/SubscriptionCardDesktop.d.ts +3 -3
- package/dist/esm/src/components/Subscriptions/subscriptionsList/subscriptionUtils.d.ts +1 -1
- package/dist/esm/src/components/Transactions/Transactions.d.ts +5 -3
- package/dist/esm/src/components/Transactions/transactionsList/TransactionsListDesktop.d.ts +1 -1
- package/dist/esm/src/components/Transactions/transactionsList/TransactionsListMobile.d.ts +1 -1
- package/dist/esm/src/components/Transactions/transactionsList/utils.d.ts +1 -1
- package/dist/esm/src/{components/Invoice → contexts}/InvoiceQuoteContext.d.ts +2 -2
- package/dist/{cjs/src/components/Subscriptions → esm/src/contexts}/SubscriptionsContext.d.ts +0 -4
- package/dist/{cjs/src/components/Transactions → esm/src/contexts}/TransactionsListContext.d.ts +3 -2
- package/dist/esm/src/graphql/QuoteRequests.d.ts +17 -2
- package/dist/esm/src/graphql/mutations/quoteAddonCreate.d.ts +7 -0
- package/dist/esm/src/graphql/mutations/quoteChangeCreate.d.ts +8 -0
- package/dist/esm/src/graphql/mutations/quoteChangeDelete.d.ts +6 -0
- package/dist/esm/src/graphql/mutations/quoteChargeDelete.d.ts +2 -1
- package/dist/esm/src/graphql/mutations/quoteChargeUpdate.d.ts +2 -1
- package/dist/esm/src/graphql/mutations/quoteCompose.d.ts +0 -1
- package/dist/esm/src/graphql/mutations/quoteCreate.d.ts +8 -0
- package/dist/esm/src/graphql/mutations/quoteCreateWithDeal.d.ts +10 -0
- package/dist/esm/src/graphql/queries/getAddonPlans.d.ts +7 -0
- package/dist/esm/src/graphql/queries/getFormattedQuote.d.ts +2 -1
- package/dist/esm/src/graphql/queries/getQuote.d.ts +3 -1
- package/dist/esm/src/hooks/quotes/useQuoteCreate.d.ts +9 -0
- package/dist/esm/src/hooks/quotes/useQuoteQuantities.d.ts +14 -0
- package/dist/esm/src/hooks/quotes/useQuoteUpdateFeatureAddon.d.ts +2 -3
- package/dist/esm/src/hooks/useCurrentUserData.d.ts +11 -8
- package/dist/esm/src/hooks/usePaymentMethod.d.ts +2 -1
- package/dist/esm/src/hooks/usePriceListChangeOptions.d.ts +6 -0
- package/dist/esm/src/hooks/useToggleAddonQuoteChange.d.ts +7 -0
- package/dist/esm/src/utils/addonPlanUtils.d.ts +6 -0
- package/dist/esm/src/utils/chargeUtils.d.ts +2 -0
- package/dist/esm/src/utils/featureAddonUtils.d.ts +5 -2
- package/dist/index.d.ts +8 -4
- package/package.json +2 -2
- package/dist/cjs/src/components/QuotePreviewProvider.d.ts +0 -17
- package/dist/esm/src/components/QuotePreviewProvider.d.ts +0 -17
package/dist/esm/index.js
CHANGED
|
@@ -2,9 +2,9 @@ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
|
2
2
|
import { createContext, useContext, useMemo, useState, useEffect, useRef, useCallback } from 'react';
|
|
3
3
|
import { Markup } from 'interweave';
|
|
4
4
|
import { ConfigProvider, Spin, Button, Tag, Typography, Dropdown, Input, Modal, Checkbox, Skeleton, Collapse, Form, Tooltip, Drawer, Card as Card$1, Divider, Select, Image, Radio, Space, Switch, Popconfirm, Table } from 'antd';
|
|
5
|
-
import { DownloadOutlined, CreditCardOutlined, EllipsisOutlined, BankOutlined, SearchOutlined, CheckCircleFilled,
|
|
5
|
+
import { DownloadOutlined, CreditCardOutlined, EllipsisOutlined, BankOutlined, SearchOutlined, CheckCircleFilled, ArrowLeftOutlined, CloseOutlined, InfoCircleOutlined } from '@ant-design/icons';
|
|
6
6
|
import styled from 'styled-components';
|
|
7
|
-
import { DEFAULT_ACCENT_COLOR, DEFAULT_BRAND_COLOR, DEFAULT_SECONDARY_COLOR, DEFAULT_TOP_NAV_IMAGE_URL, gqlRequest as gqlRequest$1, createClientDevHeaders, X_BUNNY_COMPONENTS_VERSION_HEADER_NAME, QueryKeyFactory, useIsMobile, isColorTooDark, INPUT_BORDER_COLOR, SLATE_50, SLATE_400, SLATE_200, request as request$1, useErrorNotification, invokePlugin, useAllErrorFormats, formatCurrency, GRAY_500, GRAY_200, useSuccessNotification, getFormattedInvoice, PAYABLE_INVOICE_STATES, BreakpointNumbers, useGraphQLmutation, useInfoNotification, formatDate, TransactionState, SLATE_600, WHITE, TransactionKind, SLATE_500, PRIMARY_COLOR, SubscriptionState as SubscriptionState$2,
|
|
7
|
+
import { DEFAULT_ACCENT_COLOR, DEFAULT_BRAND_COLOR, DEFAULT_SECONDARY_COLOR, DEFAULT_TOP_NAV_IMAGE_URL, gqlRequest as gqlRequest$1, createClientDevHeaders, X_BUNNY_COMPONENTS_VERSION_HEADER_NAME, QueryKeyFactory, useIsMobile, isColorTooDark, INPUT_BORDER_COLOR, SLATE_50, SLATE_400, SLATE_200, request as request$1, useErrorNotification, invokePlugin, useAllErrorFormats, formatCurrency, GRAY_500, GRAY_200, useSuccessNotification, getFormattedInvoice, PAYABLE_INVOICE_STATES, BreakpointNumbers, useGraphQLmutation, useInfoNotification, formatDate, TransactionState, SLATE_600, WHITE, TransactionKind, SLATE_500, PRIMARY_COLOR, Lists, sortSubscriptionCharges, SubscriptionState as SubscriptionState$2, ChargeType, PricingModel, QuoteChangeKind, getAccount, StringUtils, BillingPeriod, PERIOD_LABELS, PricingStyle, SLATE_100, MODAL_MAX_HEIGHT, DataInterval, TAG_COLORS } from '@bunnyapp/common';
|
|
8
8
|
import { QueryClient, QueryClientProvider, useQuery, useQueryClient, useMutation, keepPreviousData } from '@tanstack/react-query';
|
|
9
9
|
import theme from 'antd/lib/theme/index.js';
|
|
10
10
|
import { RecoilRoot } from 'recoil';
|
|
@@ -45,7 +45,7 @@ function styleInject(css, ref) {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
var css_248z = ":root {\n --row-background: #ffffff;\n --row-background-alternate: rgba(100, 116, 139, 0.04);\n --row-background-dark: #121212;\n --row-background-alternate-dark: #1e1e1e;\n --bunny-blue-500: #3b82f6;\n --bunny-blue-200: #bfdbfe;\n --bunny-green-600: #059669;\n --bunny-green-200: #a7f3d0;\n --bunny-red-500: #ef4444;\n --bunny-red-200: #fecaca;\n --bunny-orange-500: #f97316;\n --bunny-orange-200: #fed7aa;\n --bunny-yellow-500: #f59e0b;\n --bunny-yellow-200: #fde68a;\n --bunny-purple-500: #8b5cf6;\n --bunny-purple-200: #ddd6fe;\n --bunny-black: #000000;\n}\n.bunny-component-wrapper {\n box-sizing: border-box;\n}\n.bunny-component-wrapper * {\n box-sizing: border-box;\n}\n.hidden {\n display: none;\n}\n.bunny-show-on-hover {\n opacity: 0;\n}\n.bunny-show-on-hover-container:hover .bunny-show-on-hover {\n opacity: 1;\n}\n.has-tooltip:hover .tooltip {\n visibility: visible;\n z-index: 100;\n}\n.pdf-only {\n display: none !important;\n}\n.notes p {\n margin: 0;\n padding: 0;\n padding-bottom: 0.25rem;\n}\n.bunny-icon-path {\n transition: fill 0.3s;\n}\n.bunny-shadow-padding-x {\n padding-right: 1rem;\n padding-left: 1rem;\n}\n.bunny-shadow-padding-xb {\n padding-right: 1rem;\n padding-left: 1rem;\n padding-bottom: 0.5rem;\n}\n.content-container {\n width: 100%;\n margin: 0 auto;\n}\n@media (min-width: 1220px) {\n .content-container {\n width: 1220px !important;\n margin: 0 auto;\n }\n}\n@media (min-width: 768px) {\n .bunny-shadow-padding-x {\n padding-right: 2rem;\n padding-left: 2rem;\n }\n .bunny-shadow-padding-xb {\n padding-right: 2rem;\n padding-left: 2rem;\n padding-bottom: 0.5rem;\n }\n .sm\\:flex {\n display: flex !important;\n }\n .sm\\:hidden {\n display: none !important;\n }\n}\n.bunny-shadow,\n.bunny-shadow-md {\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n}\n.bunny-fixed {\n position: fixed;\n}\n.bunny-absolute {\n position: absolute;\n}\n.bunny-relative {\n position: relative;\n}\n.bunny-sticky {\n position: sticky;\n}\n.bunny-bottom-0 {\n bottom: 0px;\n}\n.bunny-bottom-4 {\n bottom: 1rem;\n}\n.bunny-left-0 {\n left: 0px;\n}\n.bunny-right-0 {\n right: 0px;\n}\n.bunny-top-0 {\n top: 0px;\n}\n.bunny-col-span-1 {\n grid-column: span 1 / span 1;\n}\n.bunny-col-span-full {\n grid-column: 1 / -1;\n}\n.bunny-m-0 {\n margin: 0px;\n}\n.bunny-mx-0 {\n margin-left: 0px;\n margin-right: 0px;\n}\n.bunny-mx-4 {\n margin-left: 1rem;\n margin-right: 1rem;\n}\n.bunny-my-2 {\n margin-top: 0.5rem;\n margin-bottom: 0.5rem;\n}\n.bunny-my-24 {\n margin-top: 6rem;\n margin-bottom: 6rem;\n}\n.bunny-my-4 {\n margin-top: 1rem;\n margin-bottom: 1rem;\n}\n.bunny-mb-2 {\n margin-bottom: 0.5rem;\n}\n.bunny-mb-4 {\n margin-bottom: 1rem;\n}\n.bunny-mb-8 {\n margin-bottom: 2rem;\n}\n.bunny-mt-2 {\n margin-top: 0.5rem;\n}\n.bunny-mt-24 {\n margin-top: 6rem;\n}\n.bunny-mt-4 {\n margin-top: 1rem;\n}\n.bunny-flex {\n display: flex;\n}\n.bunny-grid {\n display: grid;\n}\n.bunny-contents {\n display: contents;\n}\n.bunny-h-1\\/2 {\n height: 50%;\n}\n.bunny-h-5 {\n height: 1.25rem;\n}\n.bunny-h-8 {\n height: 2rem;\n}\n.bunny-h-full {\n height: 100%;\n}\n.bunny-h-screen {\n height: 100vh;\n}\n.bunny-max-h-\\[calc\\(100vh-10rem\\)\\] {\n max-height: calc(100vh - 10rem);\n}\n.bunny-min-h-0 {\n min-height: 0px;\n}\n.bunny-w-1\\/2 {\n width: 50%;\n}\n.bunny-w-3\\/5 {\n width: 60%;\n}\n.bunny-w-full {\n width: 100%;\n}\n.bunny-w-screen {\n width: 100vw;\n}\n.bunny-flex-1 {\n flex: 1 1 0%;\n}\n.bunny-shrink {\n flex-shrink: 1;\n}\n.bunny-shrink-0 {\n flex-shrink: 0;\n}\n.bunny-grow {\n flex-grow: 1;\n}\n.bunny-cursor-pointer {\n cursor: pointer;\n}\n.bunny-grid-cols-3 {\n grid-template-columns: repeat(3, minmax(0, 1fr));\n}\n.bunny-flex-row {\n flex-direction: row;\n}\n.bunny-flex-col {\n flex-direction: column;\n}\n.bunny-flex-wrap {\n flex-wrap: wrap;\n}\n.bunny-items-start {\n align-items: flex-start;\n}\n.bunny-items-end {\n align-items: flex-end;\n}\n.bunny-items-center {\n align-items: center;\n}\n.bunny-justify-end {\n justify-content: flex-end;\n}\n.bunny-justify-center {\n justify-content: center;\n}\n.bunny-justify-between {\n justify-content: space-between;\n}\n.bunny-gap-0 {\n gap: 0px;\n}\n.bunny-gap-1 {\n gap: 0.25rem;\n}\n.bunny-gap-2 {\n gap: 0.5rem;\n}\n.bunny-gap-3 {\n gap: 0.75rem;\n}\n.bunny-gap-4 {\n gap: 1rem;\n}\n.bunny-gap-6 {\n gap: 1.5rem;\n}\n.bunny-gap-8 {\n gap: 2rem;\n}\n.bunny-space-y-2 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(0.5rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(0.5rem * var(--tw-space-y-reverse));\n}\n.bunny-space-y-4 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(1rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(1rem * var(--tw-space-y-reverse));\n}\n.bunny-space-y-8 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(2rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(2rem * var(--tw-space-y-reverse));\n}\n.bunny-overflow-auto {\n overflow: auto;\n}\n.bunny-overflow-hidden {\n overflow: hidden;\n}\n.bunny-overflow-visible {\n overflow: visible;\n}\n.bunny-overflow-y-auto {\n overflow-y: auto;\n}\n.bunny-whitespace-nowrap {\n white-space: nowrap;\n}\n.bunny-rounded {\n border-radius: 0.25rem;\n}\n.bunny-rounded-full {\n border-radius: 9999px;\n}\n.bunny-rounded-lg {\n border-radius: 0.5rem;\n}\n.bunny-rounded-md {\n border-radius: 0.375rem;\n}\n.bunny-border {\n border-width: 1px;\n}\n.bunny-border-2 {\n border-width: 2px;\n}\n.bunny-border-solid {\n border-style: solid;\n}\n.bunny-border-none {\n border-style: none;\n}\n.bunny-border-slate-200 {\n --tw-border-opacity: 1;\n border-color: rgb(226 232 240 / var(--tw-border-opacity, 1));\n}\n.bunny-bg-slate-50 {\n --tw-bg-opacity: 1;\n background-color: rgb(248 250 252 / var(--tw-bg-opacity, 1));\n}\n.bunny-bg-white {\n --tw-bg-opacity: 1;\n background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));\n}\n.bunny-p-0 {\n padding: 0px;\n}\n.bunny-p-1 {\n padding: 0.25rem;\n}\n.bunny-p-4 {\n padding: 1rem;\n}\n.bunny-px-3 {\n padding-left: 0.75rem;\n padding-right: 0.75rem;\n}\n.bunny-px-4 {\n padding-left: 1rem;\n padding-right: 1rem;\n}\n.bunny-px-6 {\n padding-left: 1.5rem;\n padding-right: 1.5rem;\n}\n.bunny-py-2 {\n padding-top: 0.5rem;\n padding-bottom: 0.5rem;\n}\n.bunny-py-4 {\n padding-top: 1rem;\n padding-bottom: 1rem;\n}\n.bunny-py-6 {\n padding-top: 1.5rem;\n padding-bottom: 1.5rem;\n}\n.bunny-pb-2 {\n padding-bottom: 0.5rem;\n}\n.bunny-pb-4 {\n padding-bottom: 1rem;\n}\n.bunny-pb-6 {\n padding-bottom: 1.5rem;\n}\n.bunny-pl-0 {\n padding-left: 0px;\n}\n.bunny-pl-12 {\n padding-left: 3rem;\n}\n.bunny-pl-4 {\n padding-left: 1rem;\n}\n.bunny-pr-4 {\n padding-right: 1rem;\n}\n.bunny-pt-1 {\n padding-top: 0.25rem;\n}\n.bunny-pt-12 {\n padding-top: 3rem;\n}\n.bunny-pt-2 {\n padding-top: 0.5rem;\n}\n.bunny-pt-4 {\n padding-top: 1rem;\n}\n.bunny-pt-5 {\n padding-top: 1.25rem;\n}\n.bunny-pt-6 {\n padding-top: 1.5rem;\n}\n.bunny-pt-\\[25vh\\] {\n padding-top: 25vh;\n}\n.bunny-text-left {\n text-align: left;\n}\n.bunny-text-center {\n text-align: center;\n}\n.bunny-text-right {\n text-align: right;\n}\n.bunny-text-2xl {\n font-size: 1.5rem;\n line-height: 2rem;\n}\n.bunny-text-base {\n font-size: 1rem;\n line-height: 1.5rem;\n}\n.bunny-text-lg {\n font-size: 1.125rem;\n line-height: 1.75rem;\n}\n.bunny-text-sm {\n font-size: 0.875rem;\n line-height: 1.25rem;\n}\n.bunny-text-xl {\n font-size: 1.25rem;\n line-height: 1.75rem;\n}\n.bunny-text-xs {\n font-size: 0.75rem;\n line-height: 1rem;\n}\n.bunny-font-bold {\n font-weight: 700;\n}\n.bunny-font-medium {\n font-weight: 500;\n}\n.bunny-font-normal {\n font-weight: 400;\n}\n.bunny-text-gray-500 {\n --tw-text-opacity: 1;\n color: rgb(107 114 128 / var(--tw-text-opacity, 1));\n}\n.bunny-text-gray-600 {\n --tw-text-opacity: 1;\n color: rgb(75 85 99 / var(--tw-text-opacity, 1));\n}\n.bunny-text-gray-900 {\n --tw-text-opacity: 1;\n color: rgb(17 24 39 / var(--tw-text-opacity, 1));\n}\n.bunny-text-orange-500 {\n --tw-text-opacity: 1;\n color: rgb(249 115 22 / var(--tw-text-opacity, 1));\n}\n.bunny-text-orange-600 {\n --tw-text-opacity: 1;\n color: rgb(234 88 12 / var(--tw-text-opacity, 1));\n}\n.bunny-text-slate-400 {\n --tw-text-opacity: 1;\n color: rgb(148 163 184 / var(--tw-text-opacity, 1));\n}\n.bunny-text-slate-500 {\n --tw-text-opacity: 1;\n color: rgb(100 116 139 / var(--tw-text-opacity, 1));\n}\n.bunny-text-slate-600 {\n --tw-text-opacity: 1;\n color: rgb(71 85 105 / var(--tw-text-opacity, 1));\n}\n.bunny-underline {\n text-decoration-line: underline;\n}\n.bunny-shadow {\n --tw-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);\n --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.bunny-shadow-md {\n --tw-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);\n --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.bunny-transition-\\[margin\\] {\n transition-property: margin;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n.bunny-duration-300 {\n transition-duration: 300ms;\n}\n.rotate-45,\n.transform {\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n}\n.shadow,\n.shadow-lg,\n.shadow-md,\n.shadow-none,\n.shadow-sm,\n.shadow-xl {\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n}\n.container {\n width: 100%;\n}\n@media (min-width: 768px) {\n .container {\n max-width: 768px;\n }\n}\n@media (min-width: 1024px) {\n .container {\n max-width: 1024px;\n }\n}\n@media (min-width: 1280px) {\n .container {\n max-width: 1280px;\n }\n}\n@media (min-width: 1536px) {\n .container {\n max-width: 1536px;\n }\n}\n.visible {\n visibility: visible;\n}\n.fixed {\n position: fixed;\n}\n.absolute {\n position: absolute;\n}\n.relative {\n position: relative;\n}\n.sticky {\n position: sticky;\n}\n.-top-0\\.5 {\n top: -0.125rem;\n}\n.bottom-0 {\n bottom: 0px;\n}\n.bottom-4 {\n bottom: 1rem;\n}\n.left-0 {\n left: 0px;\n}\n.right-0 {\n right: 0px;\n}\n.top-0 {\n top: 0px;\n}\n.z-50 {\n z-index: 50;\n}\n.col-span-2 {\n grid-column: span 2 / span 2;\n}\n.col-span-3 {\n grid-column: span 3 / span 3;\n}\n.col-span-full {\n grid-column: 1 / -1;\n}\n.m-0 {\n margin: 0px;\n}\n.mx-0 {\n margin-left: 0px;\n margin-right: 0px;\n}\n.mx-4 {\n margin-left: 1rem;\n margin-right: 1rem;\n}\n.my-12 {\n margin-top: 3rem;\n margin-bottom: 3rem;\n}\n.my-2 {\n margin-top: 0.5rem;\n margin-bottom: 0.5rem;\n}\n.my-4 {\n margin-top: 1rem;\n margin-bottom: 1rem;\n}\n.mb-2 {\n margin-bottom: 0.5rem;\n}\n.mb-4 {\n margin-bottom: 1rem;\n}\n.mb-8 {\n margin-bottom: 2rem;\n}\n.ml-2 {\n margin-left: 0.5rem;\n}\n.mr-8 {\n margin-right: 2rem;\n}\n.mt-1 {\n margin-top: 0.25rem;\n}\n.mt-2 {\n margin-top: 0.5rem;\n}\n.mt-4 {\n margin-top: 1rem;\n}\n.mt-6 {\n margin-top: 1.5rem;\n}\n.mt-8 {\n margin-top: 2rem;\n}\n.block {\n display: block;\n}\n.flex {\n display: flex;\n}\n.table {\n display: table;\n}\n.grid {\n display: grid;\n}\n.contents {\n display: contents;\n}\n.hidden {\n display: none;\n}\n.h-4 {\n height: 1rem;\n}\n.h-5 {\n height: 1.25rem;\n}\n.h-8 {\n height: 2rem;\n}\n.h-full {\n height: 100%;\n}\n.w-1\\/2 {\n width: 50%;\n}\n.w-1\\/3 {\n width: 33.333333%;\n}\n.w-12 {\n width: 3rem;\n}\n.w-2\\/3 {\n width: 66.666667%;\n}\n.w-4 {\n width: 1rem;\n}\n.w-full {\n width: 100%;\n}\n.max-w-32 {\n max-width: 8rem;\n}\n.flex-1 {\n flex: 1 1 0%;\n}\n.shrink {\n flex-shrink: 1;\n}\n.shrink-0 {\n flex-shrink: 0;\n}\n.flex-grow {\n flex-grow: 1;\n}\n.grow {\n flex-grow: 1;\n}\n.border-collapse {\n border-collapse: collapse;\n}\n.rotate-45 {\n --tw-rotate: 45deg;\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.transform {\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.cursor-pointer {\n cursor: pointer;\n}\n.grid-cols-2 {\n grid-template-columns: repeat(2, minmax(0, 1fr));\n}\n.grid-cols-3 {\n grid-template-columns: repeat(3, minmax(0, 1fr));\n}\n.flex-row {\n flex-direction: row;\n}\n.flex-col {\n flex-direction: column;\n}\n.items-end {\n align-items: flex-end;\n}\n.items-center {\n align-items: center;\n}\n.justify-start {\n justify-content: flex-start;\n}\n.justify-end {\n justify-content: flex-end;\n}\n.justify-center {\n justify-content: center;\n}\n.justify-between {\n justify-content: space-between;\n}\n.gap-0 {\n gap: 0px;\n}\n.gap-1 {\n gap: 0.25rem;\n}\n.gap-2 {\n gap: 0.5rem;\n}\n.gap-3 {\n gap: 0.75rem;\n}\n.gap-4 {\n gap: 1rem;\n}\n.gap-6 {\n gap: 1.5rem;\n}\n.gap-8 {\n gap: 2rem;\n}\n.space-y-2 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(0.5rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(0.5rem * var(--tw-space-y-reverse));\n}\n.space-y-4 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(1rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(1rem * var(--tw-space-y-reverse));\n}\n.space-y-8 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(2rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(2rem * var(--tw-space-y-reverse));\n}\n.overflow-auto {\n overflow: auto;\n}\n.overflow-hidden {\n overflow: hidden;\n}\n.overflow-visible {\n overflow: visible;\n}\n.whitespace-nowrap {\n white-space: nowrap;\n}\n.text-nowrap {\n text-wrap: nowrap;\n}\n.rounded {\n border-radius: 0.25rem;\n}\n.rounded-full {\n border-radius: 9999px;\n}\n.rounded-lg {\n border-radius: 0.5rem;\n}\n.rounded-md {\n border-radius: 0.375rem;\n}\n.rounded-sm {\n border-radius: 0.125rem;\n}\n.border {\n border-width: 1px;\n}\n.border-2 {\n border-width: 2px;\n}\n.border-b {\n border-bottom-width: 1px;\n}\n.border-t {\n border-top-width: 1px;\n}\n.border-solid {\n border-style: solid;\n}\n.border-none {\n border-style: none;\n}\n.border-gray-400 {\n --tw-border-opacity: 1;\n border-color: rgb(156 163 175 / var(--tw-border-opacity, 1));\n}\n.border-gray-500 {\n --tw-border-opacity: 1;\n border-color: rgb(107 114 128 / var(--tw-border-opacity, 1));\n}\n.border-slate-200 {\n --tw-border-opacity: 1;\n border-color: rgb(226 232 240 / var(--tw-border-opacity, 1));\n}\n.border-slate-300 {\n --tw-border-opacity: 1;\n border-color: rgb(203 213 225 / var(--tw-border-opacity, 1));\n}\n.border-slate-700 {\n --tw-border-opacity: 1;\n border-color: rgb(51 65 85 / var(--tw-border-opacity, 1));\n}\n.bg-black {\n --tw-bg-opacity: 1;\n background-color: rgb(0 0 0 / var(--tw-bg-opacity, 1));\n}\n.bg-emerald-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(167 243 208 / var(--tw-bg-opacity, 1));\n}\n.bg-green-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(187 247 208 / var(--tw-bg-opacity, 1));\n}\n.bg-orange-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(254 215 170 / var(--tw-bg-opacity, 1));\n}\n.bg-red-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(254 202 202 / var(--tw-bg-opacity, 1));\n}\n.bg-red-500 {\n --tw-bg-opacity: 1;\n background-color: rgb(239 68 68 / var(--tw-bg-opacity, 1));\n}\n.bg-slate-50 {\n --tw-bg-opacity: 1;\n background-color: rgb(248 250 252 / var(--tw-bg-opacity, 1));\n}\n.bg-transparent {\n background-color: transparent;\n}\n.bg-white {\n --tw-bg-opacity: 1;\n background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));\n}\n.bg-yellow-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(254 240 138 / var(--tw-bg-opacity, 1));\n}\n.p-0 {\n padding: 0px;\n}\n.p-1 {\n padding: 0.25rem;\n}\n.p-2 {\n padding: 0.5rem;\n}\n.p-4 {\n padding: 1rem;\n}\n.p-8 {\n padding: 2rem;\n}\n.px-2 {\n padding-left: 0.5rem;\n padding-right: 0.5rem;\n}\n.px-3 {\n padding-left: 0.75rem;\n padding-right: 0.75rem;\n}\n.px-4 {\n padding-left: 1rem;\n padding-right: 1rem;\n}\n.px-6 {\n padding-left: 1.5rem;\n padding-right: 1.5rem;\n}\n.px-8 {\n padding-left: 2rem;\n padding-right: 2rem;\n}\n.py-1 {\n padding-top: 0.25rem;\n padding-bottom: 0.25rem;\n}\n.py-2 {\n padding-top: 0.5rem;\n padding-bottom: 0.5rem;\n}\n.py-4 {\n padding-top: 1rem;\n padding-bottom: 1rem;\n}\n.py-6 {\n padding-top: 1.5rem;\n padding-bottom: 1.5rem;\n}\n.pb-2 {\n padding-bottom: 0.5rem;\n}\n.pb-4 {\n padding-bottom: 1rem;\n}\n.pb-6 {\n padding-bottom: 1.5rem;\n}\n.pb-8 {\n padding-bottom: 2rem;\n}\n.pl-0 {\n padding-left: 0px;\n}\n.pl-2 {\n padding-left: 0.5rem;\n}\n.pl-4 {\n padding-left: 1rem;\n}\n.pt-1 {\n padding-top: 0.25rem;\n}\n.pt-12 {\n padding-top: 3rem;\n}\n.pt-2 {\n padding-top: 0.5rem;\n}\n.pt-4 {\n padding-top: 1rem;\n}\n.pt-5 {\n padding-top: 1.25rem;\n}\n.pt-6 {\n padding-top: 1.5rem;\n}\n.pt-8 {\n padding-top: 2rem;\n}\n.text-left {\n text-align: left;\n}\n.text-center {\n text-align: center;\n}\n.text-right {\n text-align: right;\n}\n.align-middle {\n vertical-align: middle;\n}\n.text-2xl {\n font-size: 1.5rem;\n line-height: 2rem;\n}\n.text-base {\n font-size: 1rem;\n line-height: 1.5rem;\n}\n.text-lg {\n font-size: 1.125rem;\n line-height: 1.75rem;\n}\n.text-sm {\n font-size: 0.875rem;\n line-height: 1.25rem;\n}\n.text-xl {\n font-size: 1.25rem;\n line-height: 1.75rem;\n}\n.text-xs {\n font-size: 0.75rem;\n line-height: 1rem;\n}\n.font-bold {\n font-weight: 700;\n}\n.font-medium {\n font-weight: 500;\n}\n.font-normal {\n font-weight: 400;\n}\n.capitalize {\n text-transform: capitalize;\n}\n.text-emerald-600 {\n --tw-text-opacity: 1;\n color: rgb(5 150 105 / var(--tw-text-opacity, 1));\n}\n.text-emerald-700 {\n --tw-text-opacity: 1;\n color: rgb(4 120 87 / var(--tw-text-opacity, 1));\n}\n.text-gray-600 {\n --tw-text-opacity: 1;\n color: rgb(75 85 99 / var(--tw-text-opacity, 1));\n}\n.text-gray-900 {\n --tw-text-opacity: 1;\n color: rgb(17 24 39 / var(--tw-text-opacity, 1));\n}\n.text-green-600 {\n --tw-text-opacity: 1;\n color: rgb(22 163 74 / var(--tw-text-opacity, 1));\n}\n.text-orange-500 {\n --tw-text-opacity: 1;\n color: rgb(249 115 22 / var(--tw-text-opacity, 1));\n}\n.text-orange-600 {\n --tw-text-opacity: 1;\n color: rgb(234 88 12 / var(--tw-text-opacity, 1));\n}\n.text-red-500 {\n --tw-text-opacity: 1;\n color: rgb(239 68 68 / var(--tw-text-opacity, 1));\n}\n.text-slate-400 {\n --tw-text-opacity: 1;\n color: rgb(148 163 184 / var(--tw-text-opacity, 1));\n}\n.text-slate-500 {\n --tw-text-opacity: 1;\n color: rgb(100 116 139 / var(--tw-text-opacity, 1));\n}\n.text-slate-600 {\n --tw-text-opacity: 1;\n color: rgb(71 85 105 / var(--tw-text-opacity, 1));\n}\n.text-white {\n --tw-text-opacity: 1;\n color: rgb(255 255 255 / var(--tw-text-opacity, 1));\n}\n.text-yellow-500 {\n --tw-text-opacity: 1;\n color: rgb(234 179 8 / var(--tw-text-opacity, 1));\n}\n.underline {\n text-decoration-line: underline;\n}\n.shadow {\n --tw-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);\n --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.shadow-lg {\n --tw-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);\n --tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.shadow-md {\n --tw-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);\n --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.shadow-none {\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.shadow-sm {\n --tw-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n --tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.shadow-xl {\n --tw-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);\n --tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.transition {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n.transition-\\[margin\\] {\n transition-property: margin;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n.transition-all {\n transition-property: all;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n.duration-200 {\n transition-duration: 200ms;\n}\n.duration-300 {\n transition-duration: 300ms;\n}\n.hover\\:bg-gray-100:hover {\n --tw-bg-opacity: 1;\n background-color: rgb(243 244 246 / var(--tw-bg-opacity, 1));\n}\n.hover\\:bg-slate-100:hover {\n --tw-bg-opacity: 1;\n background-color: rgb(241 245 249 / var(--tw-bg-opacity, 1));\n}\n.hover\\:bg-slate-200:hover {\n --tw-bg-opacity: 1;\n background-color: rgb(226 232 240 / var(--tw-bg-opacity, 1));\n}\n.hover\\:bg-gray-200:hover {\n --tw-bg-opacity: 1;\n background-color: rgb(229 231 235 / var(--tw-bg-opacity, 1));\n}\n@media (min-width: 768px) {\n .sm\\:flex {\n display: flex;\n }\n .sm\\:hidden {\n display: none;\n }\n}\n.hover\\:bunny-text-orange-400:hover {\n --tw-text-opacity: 1;\n color: rgb(251 146 60 / var(--tw-text-opacity, 1));\n}\n.bunny-components .ant-upload-select-picture-card {\n margin: 0 !important;\n}\n.bunny-components .ant-upload {\n border-radius: 0.5rem !important;\n}\n.bunny-components .ant-checkbox-inner {\n border-color: #cccccc;\n}\n.bunny-components .ant-row {\n margin-bottom: 0px;\n}\n.bunny-components .ant-select-disabled .ant-select-selector .ant-select-selection-item {\n color: rgba(0, 0, 0, 0.25) !important;\n}\n.bunny-components .ant-input-number,\n.bunny-components .ant-input,\n.bunny-components .ant-picker,\n.bunny-components .ant-input-affix-wrapper,\n.bunny-components .ant-select-selector {\n font-size: 0.875rem !important;\n transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);\n color: #232323 !important;\n}\n.bunny-components .ant-input-affix-wrapper {\n padding-top: 0 !important;\n padding-bottom: 0 !important;\n}\n.bunny-components .ant-input-group-addon,\n.bunny-components .ant-input-number-group-addon {\n color: #475569 !important;\n}\n.bunny-components .ant-input-number-group-wrapper,\n.bunny-components .ant-input-number-affix-wrapper {\n width: 100%;\n}\n.bunny-components .ant-input-affix-wrapper input {\n border: none !important;\n}\n.bunny-components .ant-form-item {\n margin-bottom: 0;\n}\n.bunny-components .ant-form-item-label {\n text-transform: none !important;\n font-size: 0.75rem;\n padding-bottom: 2px !important;\n}\n.bunny-components .ant-form-item-label > label {\n width: 100%;\n color: #4b5563 !important;\n}\n.bunny-components .form .ant-form-item-label label {\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n box-sizing: border-box;\n}\n.bunny-components .ant-form-item-explain,\n.bunny-components .ant-form-item-explain-error {\n font-size: 11px;\n min-height: 11px;\n line-height: 11px;\n padding-top: 2px;\n}\n.bunny-components .ant-timeline-item-content {\n font-size: smaller;\n}\n.bunny-components .ant-tree {\n font-size: 0.875rem;\n}\n.bunny-components .ant-tree-treenode {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.bunny-components .ant-tree-draggable-icon {\n height: 24px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.bunny-components .ant-tree-node-content-wrapper {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.bunny-components .ant-tree-switcher {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.bunny-components .ant-page-header {\n padding-left: 0;\n padding-right: 0;\n padding-top: 0;\n}\n.bunny-components .ant-tag {\n display: flex;\n align-items: center;\n justify-content: center;\n border: none;\n border-radius: 14px;\n font-weight: 500;\n white-space: nowrap;\n padding-inline-start: 0.625rem;\n padding-inline-end: 0.625rem;\n margin: 0;\n}\n.bunny-components .ant-tag-blue {\n color: #3b82f6 !important;\n background: #bfdbfe !important;\n}\n.bunny-components .ant-tag-green {\n color: #059669 !important;\n background: #a7f3d0 !important;\n}\n.bunny-components .ant-tag-red {\n color: #ef4444 !important;\n background: #fecaca !important;\n}\n.bunny-components .ant-tag-orange {\n color: #f97316 !important;\n background: #fed7aa !important;\n}\n.bunny-components .ant-tag-yellow {\n color: #f59e0b !important;\n background: #fde68a !important;\n}\n.bunny-components .ant-tag-purple {\n color: #8b5cf6 !important;\n background: #ddd6fe !important;\n}\n.bunny-components .ant-tag-gray {\n color: #6b7280 !important;\n background: #e5e7eb !important;\n}\n.bunny-components .ant-tag-black {\n color: white !important;\n background: black !important;\n}\n.bunny-components .ant-picker {\n width: 100%;\n}\n.bunny-components .ant-input,\n.bunny-components .ant-select,\n.bunny-components .ant-picker {\n height: 32px !important;\n}\n.bunny-components .ant-slider-dot {\n border: 2px solid #f0f0f0;\n}\n.bunny-components .ant-slider-dot-active {\n border-color: #ff5833;\n}\n.bunny-components .ant-slider-mark :last-child {\n transform: translateX(-75%) !important;\n}\n.bunny-components .ant-drawer-content {\n background: #f3f3f9ff;\n}\n.bunny-components .ant-drawer-body,\n.bunny-components .ant-layout {\n background: #f8fafc;\n}\n.bunny-components .vista-link {\n color: #1890ff;\n}\n.bunny-components .vista-link:hover {\n text-decoration: underline;\n cursor: pointer;\n}\n.bunny-components .ant-popover-inner-content {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n max-width: 300px;\n}\n.bunny-components .ant-popconfirm-message-text {\n width: 100% !important;\n}\n.bunny-components .ant-popconfirm-title {\n padding: 0;\n text-align: center;\n font-size: 0.875rem !important;\n width: 100% !important;\n}\n.bunny-components .ant-popconfirm-buttons {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 0.5rem;\n}\n.bunny-components .ant-popconfirm-buttons button {\n margin-inline-start: 0 !important;\n}\n.bunny-components .ant-pagination-item {\n display: flex !important;\n align-items: center;\n justify-content: center;\n}\n.bunny-components .ant-btn-primary:disabled {\n background: #eef0f2 !important;\n color: rgba(0, 0, 0, 0.25) !important;\n border: none;\n}\n.bunny-components .ant-btn {\n box-shadow: none;\n text-shadow: none;\n outline: none !important;\n line-height: 1;\n font-weight: normal;\n}\n.bunny-components .ant-btn-default .ant-btn-icon {\n color: #94a3b8;\n transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);\n}\n.bunny-components .ant-btn-default:hover .ant-btn-icon {\n color: #ff7f5c;\n}\n.bunny-components .ant-btn-default:disabled {\n border-color: rgba(113, 125, 148, 0.2) !important;\n}\n.bunny-components .ant-btn-primary:disabled {\n background-color: rgba(113, 125, 148, 0.1) !important;\n border-color: rgba(113, 125, 148, 0.1) !important;\n}\n.bunny-components .ant-btn-primary:hover:disabled,\n.bunny-components .ant-btn-primary:disabled {\n background-clip: padding-box;\n}\n.bunny-components .ant-select-selection-item-content {\n display: flex !important;\n align-items: center;\n}\n.bunny-components .ant-select-item {\n font-size: 0.875rem;\n}\n.bunny-components .ant-select-item-option-content {\n display: flex;\n align-items: center;\n white-space: nowrap !important;\n overflow: visible !important;\n text-overflow: default !important;\n font-size: 0.875rem;\n}\n.bunny-components .ant-select-arrow .anticon:not(.ant-select-suffix) {\n pointer-events: none;\n}\n.bunny-components .select-dropdown-blue-gray .ant-select-item-option {\n background-color: #fff !important;\n}\n.bunny-components .select-dropdown-blue-gray .ant-select-item-option-active {\n color: #ff5833;\n}\n.bunny-components .ant-dropdown-menu-items {\n padding-left: 0 !important;\n}\n.bunny-components .ant-dropdown-menu-item-active {\n background-color: transparent !important;\n}\n.bunny-components .ant-input-affix-wrapper.searchfield {\n background: white !important;\n}\n.bunny-components .ant-input-affix-wrapper.searchfield input {\n background: white !important;\n}\n.bunny-components .ant-input-affix-wrapper-focused {\n background: white !important;\n}\n.bunny-components .panel .ant-input-affix-wrapper.searchfield {\n background: #f8f8f8 !important;\n}\n.bunny-components .panel .ant-input-affix-wrapper.searchfield input {\n background: #f8f8f8 !important;\n}\n.bunny-components .ant-input-steps-hidden .ant-input-number-handler-wrap {\n display: none;\n}\n.bunny-components .ant-layout-header {\n height: 48px;\n}\n.bunny-components .ant-layout-sider-children {\n width: inherit;\n position: fixed;\n}\n.bunny-components .ant-menu-item-group-list {\n display: flex !important;\n flex-direction: column !important;\n align-items: flex-start !important;\n gap: 4px !important;\n}\n.bunny-components .group {\n display: flex;\n flex-direction: row;\n flex-flow: row wrap;\n box-sizing: border-box;\n}\n.bunny-components .select-datepicker {\n animation-duration: 0.35s !important;\n}\n.bunny-components .header-datepicker {\n top: 96px !important;\n animation-duration: 0s !important;\n}\n.bunny-components .ant-picker-header {\n border-bottom: none !important;\n}\n.bunny-components .ant-picker-content thead tr th {\n font-weight: 500;\n}\n.bunny-components .ant-picker-panel-container {\n border-radius: 0.375rem;\n}\n.bunny-components .ant-picker-cell-selected .custom-date-display {\n color: #ffffff;\n background-color: #ff5833;\n}\n.bunny-components .ant-picker-cell-today .custom-date-display {\n border: 1px solid #ff5833;\n}\n.bunny-components .ant-select:hover,\n.bunny-components * .cardElement:hover {\n border-color: #ff5833;\n}\n.bunny-components .ant-input-number {\n width: 100%;\n}\n.bunny-components .ant-input-number-focused {\n border-color: #ff5833 !important;\n background-color: #ffffff !important;\n}\n.bunny-components .ant-input-affix-wrapper-focused,\n.bunny-components .ant-input-number-focused,\n.bunny-components .ant-picker,\n.bunny-components .ant-input,\n.bunny-components .ant-select-focused .ant-select-selector,\n.bunny-components .ant-select-selector:focus,\n.bunny-components .ant-select-selector:active,\n.bunny-components .ant-select-open .ant-select-selector {\n box-shadow: none !important;\n}\n.bunny-components .ant-select-item-option-selected .ant-select-item-option-state {\n display: none !important;\n}\n.bunny-components .ant-form * input[type='text'].ant-input:not(:disabled),\n.bunny-components .ant-select-selection-item:not(:disabled) {\n color: #232323;\n}\n.bunny-components .ant-tabs-ink-bar {\n display: none !important;\n}\n.bunny-components .ant-tabs-tab.ant-tabs-tab-active {\n border-bottom: 2px solid #ff5833 !important;\n}\n.bunny-components .ant-tabs-tab {\n border-bottom: 2px solid transparent !important;\n padding-bottom: 14px !important;\n}\n.bunny-components .ant-upload-wrapper {\n display: flex;\n}\n.bunny-components .ant-form-item-label > label::after {\n display: none !important;\n}\n.bunny-components .ant-menu-item {\n display: flex !important;\n align-items: center !important;\n}\n.ant-notification {\n width: min-content;\n}\n.ant-notification-topRight {\n right: 0 !important;\n left: 0 !important;\n margin-left: auto !important;\n margin-right: auto !important;\n}\n.ant-notification-notice-wrapper {\n width: 350px !important;\n overflow: hidden !important;\n}\n.ant-notification-notice {\n padding: 16px !important;\n width: 350px !important;\n border-radius: 8px !important;\n display: flex !important;\n box-shadow: 0px 6px 10px rgba(0, 0, 0, 0.08), 0px 1px 18px rgba(0, 0, 0, 0.08), 0px 3px 5px rgba(0, 0, 0, 0.16) !important;\n}\n.ant-notification-notice-description {\n padding: 0 14px 0 0 !important;\n font-size: 14px !important;\n overflow-wrap: break-word;\n}\n.ant-notification-notice-success {\n background-color: #edfffa !important;\n}\n.ant-notification-notice-error {\n background-color: #fff8f4 !important;\n}\n.ant-notification-notice-error .ant-notification-notice-message {\n color: #ff5833 !important;\n font-weight: 500 !important;\n}\n.ant-notification-notice-error .ant-notification-notice-icon {\n color: #ff5833;\n}\n.ant-notification-notice-success .ant-notification-notice-message {\n color: #00b76a !important;\n font-weight: 500 !important;\n}\n.ant-notification-notice-success .ant-notification-notice-icon {\n color: #00b76a !important;\n}\n.ant-notification-notice-message {\n margin-bottom: 0 !important;\n}\n.ant-notification-notice-close {\n top: 16px !important;\n right: 16px !important;\n}\n.bunny-invoice-container {\n padding: 0;\n box-sizing: border-box !important;\n line-height: 1.15;\n}\n@media only screen and (max-width: 768px) {\n select,\n textarea,\n input[type='text'],\n input[type='password'],\n input[type='datetime'],\n input[type='datetime-local'],\n input[type='date'],\n input[type='month'],\n input[type='time'],\n input[type='week'],\n input[type='number'],\n input[type='email'],\n input[type='url'],\n input[type='search'],\n input[type='tel'],\n input[type='color'] {\n font-size: 16px !important;\n }\n}\n@keyframes App-logo-spin {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}\n";
|
|
48
|
+
var css_248z = ":root {\n --row-background: #ffffff;\n --row-background-alternate: rgba(100, 116, 139, 0.04);\n --row-background-dark: #121212;\n --row-background-alternate-dark: #1e1e1e;\n --bunny-blue-500: #3b82f6;\n --bunny-blue-200: #bfdbfe;\n --bunny-green-600: #059669;\n --bunny-green-200: #a7f3d0;\n --bunny-red-500: #ef4444;\n --bunny-red-200: #fecaca;\n --bunny-orange-500: #f97316;\n --bunny-orange-200: #fed7aa;\n --bunny-yellow-500: #f59e0b;\n --bunny-yellow-200: #fde68a;\n --bunny-purple-500: #8b5cf6;\n --bunny-purple-200: #ddd6fe;\n --bunny-black: #000000;\n}\n.bunny-component-wrapper {\n box-sizing: border-box;\n}\n.bunny-component-wrapper * {\n box-sizing: border-box;\n}\n.hidden {\n display: none;\n}\n.bunny-show-on-hover {\n opacity: 0;\n}\n.bunny-show-on-hover-container:hover .bunny-show-on-hover {\n opacity: 1;\n}\n.has-tooltip:hover .tooltip {\n visibility: visible;\n z-index: 100;\n}\n.pdf-only {\n display: none !important;\n}\n.notes p {\n margin: 0;\n padding: 0;\n padding-bottom: 0.25rem;\n}\n.bunny-icon-path {\n transition: fill 0.3s;\n}\n.bunny-shadow-padding-x {\n padding-right: 1rem;\n padding-left: 1rem;\n}\n.bunny-shadow-padding-xb {\n padding-right: 1rem;\n padding-left: 1rem;\n padding-bottom: 0.5rem;\n}\n.content-container {\n width: 100%;\n margin: 0 auto;\n}\n@media (min-width: 1220px) {\n .content-container {\n width: 1220px !important;\n margin: 0 auto;\n }\n}\n@media (min-width: 768px) {\n .bunny-shadow-padding-x {\n padding-right: 2rem;\n padding-left: 2rem;\n }\n .bunny-shadow-padding-xb {\n padding-right: 2rem;\n padding-left: 2rem;\n padding-bottom: 0.5rem;\n }\n .sm\\:flex {\n display: flex !important;\n }\n .sm\\:hidden {\n display: none !important;\n }\n}\n.bunny-shadow,\n.bunny-shadow-md {\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n}\n.bunny-fixed {\n position: fixed;\n}\n.bunny-absolute {\n position: absolute;\n}\n.bunny-relative {\n position: relative;\n}\n.bunny-sticky {\n position: sticky;\n}\n.bunny-bottom-0 {\n bottom: 0px;\n}\n.bunny-bottom-4 {\n bottom: 1rem;\n}\n.bunny-left-0 {\n left: 0px;\n}\n.bunny-right-0 {\n right: 0px;\n}\n.bunny-top-0 {\n top: 0px;\n}\n.bunny-col-span-1 {\n grid-column: span 1 / span 1;\n}\n.bunny-col-span-full {\n grid-column: 1 / -1;\n}\n.bunny-m-0 {\n margin: 0px;\n}\n.bunny-mx-0 {\n margin-left: 0px;\n margin-right: 0px;\n}\n.bunny-mx-4 {\n margin-left: 1rem;\n margin-right: 1rem;\n}\n.bunny-mx-auto {\n margin-left: auto;\n margin-right: auto;\n}\n.bunny-my-2 {\n margin-top: 0.5rem;\n margin-bottom: 0.5rem;\n}\n.bunny-my-24 {\n margin-top: 6rem;\n margin-bottom: 6rem;\n}\n.bunny-my-4 {\n margin-top: 1rem;\n margin-bottom: 1rem;\n}\n.bunny-mb-2 {\n margin-bottom: 0.5rem;\n}\n.bunny-mb-4 {\n margin-bottom: 1rem;\n}\n.bunny-mb-8 {\n margin-bottom: 2rem;\n}\n.bunny-ml-auto {\n margin-left: auto;\n}\n.bunny-mt-2 {\n margin-top: 0.5rem;\n}\n.bunny-mt-24 {\n margin-top: 6rem;\n}\n.bunny-mt-4 {\n margin-top: 1rem;\n}\n.bunny-flex {\n display: flex;\n}\n.bunny-grid {\n display: grid;\n}\n.bunny-contents {\n display: contents;\n}\n.bunny-h-0\\.5 {\n height: 0.125rem;\n}\n.bunny-h-1\\/2 {\n height: 50%;\n}\n.bunny-h-5 {\n height: 1.25rem;\n}\n.bunny-h-8 {\n height: 2rem;\n}\n.bunny-h-full {\n height: 100%;\n}\n.bunny-h-screen {\n height: 100vh;\n}\n.bunny-max-h-\\[calc\\(100vh-10rem\\)\\] {\n max-height: calc(100vh - 10rem);\n}\n.bunny-min-h-0 {\n min-height: 0px;\n}\n.bunny-w-0\\.5 {\n width: 0.125rem;\n}\n.bunny-w-1\\/2 {\n width: 50%;\n}\n.bunny-w-3\\/5 {\n width: 60%;\n}\n.bunny-w-full {\n width: 100%;\n}\n.bunny-w-screen {\n width: 100vw;\n}\n.bunny-flex-1 {\n flex: 1 1 0%;\n}\n.bunny-shrink {\n flex-shrink: 1;\n}\n.bunny-shrink-0 {\n flex-shrink: 0;\n}\n.bunny-grow {\n flex-grow: 1;\n}\n.bunny-cursor-pointer {\n cursor: pointer;\n}\n.bunny-grid-cols-3 {\n grid-template-columns: repeat(3, minmax(0, 1fr));\n}\n.bunny-flex-row {\n flex-direction: row;\n}\n.bunny-flex-col {\n flex-direction: column;\n}\n.bunny-flex-wrap {\n flex-wrap: wrap;\n}\n.bunny-items-start {\n align-items: flex-start;\n}\n.bunny-items-end {\n align-items: flex-end;\n}\n.bunny-items-center {\n align-items: center;\n}\n.bunny-justify-end {\n justify-content: flex-end;\n}\n.bunny-justify-center {\n justify-content: center;\n}\n.bunny-justify-between {\n justify-content: space-between;\n}\n.bunny-gap-0 {\n gap: 0px;\n}\n.bunny-gap-1 {\n gap: 0.25rem;\n}\n.bunny-gap-2 {\n gap: 0.5rem;\n}\n.bunny-gap-3 {\n gap: 0.75rem;\n}\n.bunny-gap-4 {\n gap: 1rem;\n}\n.bunny-gap-6 {\n gap: 1.5rem;\n}\n.bunny-gap-8 {\n gap: 2rem;\n}\n.bunny-space-y-2 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(0.5rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(0.5rem * var(--tw-space-y-reverse));\n}\n.bunny-space-y-4 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(1rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(1rem * var(--tw-space-y-reverse));\n}\n.bunny-space-y-8 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(2rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(2rem * var(--tw-space-y-reverse));\n}\n.bunny-overflow-auto {\n overflow: auto;\n}\n.bunny-overflow-hidden {\n overflow: hidden;\n}\n.bunny-overflow-visible {\n overflow: visible;\n}\n.bunny-overflow-y-auto {\n overflow-y: auto;\n}\n.bunny-whitespace-nowrap {\n white-space: nowrap;\n}\n.bunny-rounded {\n border-radius: 0.25rem;\n}\n.bunny-rounded-full {\n border-radius: 9999px;\n}\n.bunny-rounded-lg {\n border-radius: 0.5rem;\n}\n.bunny-rounded-md {\n border-radius: 0.375rem;\n}\n.bunny-border {\n border-width: 1px;\n}\n.bunny-border-2 {\n border-width: 2px;\n}\n.bunny-border-solid {\n border-style: solid;\n}\n.bunny-border-none {\n border-style: none;\n}\n.bunny-border-slate-200 {\n --tw-border-opacity: 1;\n border-color: rgb(226 232 240 / var(--tw-border-opacity, 1));\n}\n.bunny-bg-gray-300 {\n --tw-bg-opacity: 1;\n background-color: rgb(209 213 219 / var(--tw-bg-opacity, 1));\n}\n.bunny-bg-slate-50 {\n --tw-bg-opacity: 1;\n background-color: rgb(248 250 252 / var(--tw-bg-opacity, 1));\n}\n.bunny-bg-transparent {\n background-color: transparent;\n}\n.bunny-bg-white {\n --tw-bg-opacity: 1;\n background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));\n}\n.bunny-p-0 {\n padding: 0px;\n}\n.bunny-p-1 {\n padding: 0.25rem;\n}\n.bunny-p-4 {\n padding: 1rem;\n}\n.bunny-px-3 {\n padding-left: 0.75rem;\n padding-right: 0.75rem;\n}\n.bunny-px-4 {\n padding-left: 1rem;\n padding-right: 1rem;\n}\n.bunny-px-6 {\n padding-left: 1.5rem;\n padding-right: 1.5rem;\n}\n.bunny-py-2 {\n padding-top: 0.5rem;\n padding-bottom: 0.5rem;\n}\n.bunny-py-4 {\n padding-top: 1rem;\n padding-bottom: 1rem;\n}\n.bunny-py-6 {\n padding-top: 1.5rem;\n padding-bottom: 1.5rem;\n}\n.bunny-pb-2 {\n padding-bottom: 0.5rem;\n}\n.bunny-pb-4 {\n padding-bottom: 1rem;\n}\n.bunny-pb-6 {\n padding-bottom: 1.5rem;\n}\n.bunny-pl-0 {\n padding-left: 0px;\n}\n.bunny-pl-12 {\n padding-left: 3rem;\n}\n.bunny-pl-4 {\n padding-left: 1rem;\n}\n.bunny-pr-4 {\n padding-right: 1rem;\n}\n.bunny-pt-1 {\n padding-top: 0.25rem;\n}\n.bunny-pt-12 {\n padding-top: 3rem;\n}\n.bunny-pt-2 {\n padding-top: 0.5rem;\n}\n.bunny-pt-4 {\n padding-top: 1rem;\n}\n.bunny-pt-5 {\n padding-top: 1.25rem;\n}\n.bunny-pt-6 {\n padding-top: 1.5rem;\n}\n.bunny-pt-\\[25vh\\] {\n padding-top: 25vh;\n}\n.bunny-text-left {\n text-align: left;\n}\n.bunny-text-center {\n text-align: center;\n}\n.bunny-text-right {\n text-align: right;\n}\n.bunny-text-2xl {\n font-size: 1.5rem;\n line-height: 2rem;\n}\n.bunny-text-base {\n font-size: 1rem;\n line-height: 1.5rem;\n}\n.bunny-text-lg {\n font-size: 1.125rem;\n line-height: 1.75rem;\n}\n.bunny-text-sm {\n font-size: 0.875rem;\n line-height: 1.25rem;\n}\n.bunny-text-xl {\n font-size: 1.25rem;\n line-height: 1.75rem;\n}\n.bunny-text-xs {\n font-size: 0.75rem;\n line-height: 1rem;\n}\n.bunny-font-bold {\n font-weight: 700;\n}\n.bunny-font-medium {\n font-weight: 500;\n}\n.bunny-font-normal {\n font-weight: 400;\n}\n.bunny-text-black {\n --tw-text-opacity: 1;\n color: rgb(0 0 0 / var(--tw-text-opacity, 1));\n}\n.bunny-text-gray-500 {\n --tw-text-opacity: 1;\n color: rgb(107 114 128 / var(--tw-text-opacity, 1));\n}\n.bunny-text-gray-600 {\n --tw-text-opacity: 1;\n color: rgb(75 85 99 / var(--tw-text-opacity, 1));\n}\n.bunny-text-gray-900 {\n --tw-text-opacity: 1;\n color: rgb(17 24 39 / var(--tw-text-opacity, 1));\n}\n.bunny-text-orange-500 {\n --tw-text-opacity: 1;\n color: rgb(249 115 22 / var(--tw-text-opacity, 1));\n}\n.bunny-text-orange-600 {\n --tw-text-opacity: 1;\n color: rgb(234 88 12 / var(--tw-text-opacity, 1));\n}\n.bunny-text-slate-400 {\n --tw-text-opacity: 1;\n color: rgb(148 163 184 / var(--tw-text-opacity, 1));\n}\n.bunny-text-slate-500 {\n --tw-text-opacity: 1;\n color: rgb(100 116 139 / var(--tw-text-opacity, 1));\n}\n.bunny-text-slate-600 {\n --tw-text-opacity: 1;\n color: rgb(71 85 105 / var(--tw-text-opacity, 1));\n}\n.bunny-underline {\n text-decoration-line: underline;\n}\n.bunny-shadow {\n --tw-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);\n --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.bunny-shadow-md {\n --tw-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);\n --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.bunny-transition-\\[margin\\] {\n transition-property: margin;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n.bunny-duration-300 {\n transition-duration: 300ms;\n}\n.rotate-45,\n.transform {\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n}\n.shadow,\n.shadow-lg,\n.shadow-md,\n.shadow-none,\n.shadow-sm,\n.shadow-xl {\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n}\n.container {\n width: 100%;\n}\n@media (min-width: 768px) {\n .container {\n max-width: 768px;\n }\n}\n@media (min-width: 1024px) {\n .container {\n max-width: 1024px;\n }\n}\n@media (min-width: 1280px) {\n .container {\n max-width: 1280px;\n }\n}\n@media (min-width: 1536px) {\n .container {\n max-width: 1536px;\n }\n}\n.visible {\n visibility: visible;\n}\n.fixed {\n position: fixed;\n}\n.absolute {\n position: absolute;\n}\n.relative {\n position: relative;\n}\n.sticky {\n position: sticky;\n}\n.-top-0\\.5 {\n top: -0.125rem;\n}\n.bottom-0 {\n bottom: 0px;\n}\n.bottom-4 {\n bottom: 1rem;\n}\n.left-0 {\n left: 0px;\n}\n.right-0 {\n right: 0px;\n}\n.top-0 {\n top: 0px;\n}\n.z-50 {\n z-index: 50;\n}\n.col-span-2 {\n grid-column: span 2 / span 2;\n}\n.col-span-3 {\n grid-column: span 3 / span 3;\n}\n.col-span-full {\n grid-column: 1 / -1;\n}\n.m-0 {\n margin: 0px;\n}\n.mx-0 {\n margin-left: 0px;\n margin-right: 0px;\n}\n.mx-4 {\n margin-left: 1rem;\n margin-right: 1rem;\n}\n.my-12 {\n margin-top: 3rem;\n margin-bottom: 3rem;\n}\n.my-2 {\n margin-top: 0.5rem;\n margin-bottom: 0.5rem;\n}\n.my-4 {\n margin-top: 1rem;\n margin-bottom: 1rem;\n}\n.mb-2 {\n margin-bottom: 0.5rem;\n}\n.mb-4 {\n margin-bottom: 1rem;\n}\n.mb-8 {\n margin-bottom: 2rem;\n}\n.ml-2 {\n margin-left: 0.5rem;\n}\n.mr-8 {\n margin-right: 2rem;\n}\n.mt-1 {\n margin-top: 0.25rem;\n}\n.mt-2 {\n margin-top: 0.5rem;\n}\n.mt-4 {\n margin-top: 1rem;\n}\n.mt-6 {\n margin-top: 1.5rem;\n}\n.mt-8 {\n margin-top: 2rem;\n}\n.block {\n display: block;\n}\n.flex {\n display: flex;\n}\n.table {\n display: table;\n}\n.grid {\n display: grid;\n}\n.contents {\n display: contents;\n}\n.hidden {\n display: none;\n}\n.h-4 {\n height: 1rem;\n}\n.h-5 {\n height: 1.25rem;\n}\n.h-8 {\n height: 2rem;\n}\n.h-full {\n height: 100%;\n}\n.w-1\\/2 {\n width: 50%;\n}\n.w-1\\/3 {\n width: 33.333333%;\n}\n.w-12 {\n width: 3rem;\n}\n.w-2\\/3 {\n width: 66.666667%;\n}\n.w-4 {\n width: 1rem;\n}\n.w-full {\n width: 100%;\n}\n.max-w-32 {\n max-width: 8rem;\n}\n.flex-1 {\n flex: 1 1 0%;\n}\n.shrink {\n flex-shrink: 1;\n}\n.shrink-0 {\n flex-shrink: 0;\n}\n.flex-grow {\n flex-grow: 1;\n}\n.grow {\n flex-grow: 1;\n}\n.border-collapse {\n border-collapse: collapse;\n}\n.rotate-45 {\n --tw-rotate: 45deg;\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.transform {\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.cursor-pointer {\n cursor: pointer;\n}\n.grid-cols-2 {\n grid-template-columns: repeat(2, minmax(0, 1fr));\n}\n.grid-cols-3 {\n grid-template-columns: repeat(3, minmax(0, 1fr));\n}\n.flex-row {\n flex-direction: row;\n}\n.flex-col {\n flex-direction: column;\n}\n.items-end {\n align-items: flex-end;\n}\n.items-center {\n align-items: center;\n}\n.justify-start {\n justify-content: flex-start;\n}\n.justify-end {\n justify-content: flex-end;\n}\n.justify-center {\n justify-content: center;\n}\n.justify-between {\n justify-content: space-between;\n}\n.gap-0 {\n gap: 0px;\n}\n.gap-1 {\n gap: 0.25rem;\n}\n.gap-2 {\n gap: 0.5rem;\n}\n.gap-3 {\n gap: 0.75rem;\n}\n.gap-4 {\n gap: 1rem;\n}\n.gap-6 {\n gap: 1.5rem;\n}\n.gap-8 {\n gap: 2rem;\n}\n.space-y-2 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(0.5rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(0.5rem * var(--tw-space-y-reverse));\n}\n.space-y-4 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(1rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(1rem * var(--tw-space-y-reverse));\n}\n.space-y-8 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(2rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(2rem * var(--tw-space-y-reverse));\n}\n.overflow-auto {\n overflow: auto;\n}\n.overflow-hidden {\n overflow: hidden;\n}\n.overflow-visible {\n overflow: visible;\n}\n.whitespace-nowrap {\n white-space: nowrap;\n}\n.text-nowrap {\n text-wrap: nowrap;\n}\n.rounded {\n border-radius: 0.25rem;\n}\n.rounded-full {\n border-radius: 9999px;\n}\n.rounded-lg {\n border-radius: 0.5rem;\n}\n.rounded-md {\n border-radius: 0.375rem;\n}\n.rounded-sm {\n border-radius: 0.125rem;\n}\n.border {\n border-width: 1px;\n}\n.border-2 {\n border-width: 2px;\n}\n.border-b {\n border-bottom-width: 1px;\n}\n.border-t {\n border-top-width: 1px;\n}\n.border-solid {\n border-style: solid;\n}\n.border-none {\n border-style: none;\n}\n.border-gray-400 {\n --tw-border-opacity: 1;\n border-color: rgb(156 163 175 / var(--tw-border-opacity, 1));\n}\n.border-gray-500 {\n --tw-border-opacity: 1;\n border-color: rgb(107 114 128 / var(--tw-border-opacity, 1));\n}\n.border-slate-200 {\n --tw-border-opacity: 1;\n border-color: rgb(226 232 240 / var(--tw-border-opacity, 1));\n}\n.border-slate-300 {\n --tw-border-opacity: 1;\n border-color: rgb(203 213 225 / var(--tw-border-opacity, 1));\n}\n.border-slate-700 {\n --tw-border-opacity: 1;\n border-color: rgb(51 65 85 / var(--tw-border-opacity, 1));\n}\n.bg-black {\n --tw-bg-opacity: 1;\n background-color: rgb(0 0 0 / var(--tw-bg-opacity, 1));\n}\n.bg-emerald-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(167 243 208 / var(--tw-bg-opacity, 1));\n}\n.bg-green-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(187 247 208 / var(--tw-bg-opacity, 1));\n}\n.bg-orange-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(254 215 170 / var(--tw-bg-opacity, 1));\n}\n.bg-red-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(254 202 202 / var(--tw-bg-opacity, 1));\n}\n.bg-red-500 {\n --tw-bg-opacity: 1;\n background-color: rgb(239 68 68 / var(--tw-bg-opacity, 1));\n}\n.bg-slate-50 {\n --tw-bg-opacity: 1;\n background-color: rgb(248 250 252 / var(--tw-bg-opacity, 1));\n}\n.bg-transparent {\n background-color: transparent;\n}\n.bg-white {\n --tw-bg-opacity: 1;\n background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));\n}\n.bg-yellow-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(254 240 138 / var(--tw-bg-opacity, 1));\n}\n.p-0 {\n padding: 0px;\n}\n.p-1 {\n padding: 0.25rem;\n}\n.p-2 {\n padding: 0.5rem;\n}\n.p-4 {\n padding: 1rem;\n}\n.p-8 {\n padding: 2rem;\n}\n.px-2 {\n padding-left: 0.5rem;\n padding-right: 0.5rem;\n}\n.px-3 {\n padding-left: 0.75rem;\n padding-right: 0.75rem;\n}\n.px-4 {\n padding-left: 1rem;\n padding-right: 1rem;\n}\n.px-6 {\n padding-left: 1.5rem;\n padding-right: 1.5rem;\n}\n.px-8 {\n padding-left: 2rem;\n padding-right: 2rem;\n}\n.py-1 {\n padding-top: 0.25rem;\n padding-bottom: 0.25rem;\n}\n.py-2 {\n padding-top: 0.5rem;\n padding-bottom: 0.5rem;\n}\n.py-4 {\n padding-top: 1rem;\n padding-bottom: 1rem;\n}\n.py-6 {\n padding-top: 1.5rem;\n padding-bottom: 1.5rem;\n}\n.pb-2 {\n padding-bottom: 0.5rem;\n}\n.pb-4 {\n padding-bottom: 1rem;\n}\n.pb-6 {\n padding-bottom: 1.5rem;\n}\n.pb-8 {\n padding-bottom: 2rem;\n}\n.pl-0 {\n padding-left: 0px;\n}\n.pl-2 {\n padding-left: 0.5rem;\n}\n.pl-4 {\n padding-left: 1rem;\n}\n.pt-1 {\n padding-top: 0.25rem;\n}\n.pt-12 {\n padding-top: 3rem;\n}\n.pt-2 {\n padding-top: 0.5rem;\n}\n.pt-4 {\n padding-top: 1rem;\n}\n.pt-5 {\n padding-top: 1.25rem;\n}\n.pt-6 {\n padding-top: 1.5rem;\n}\n.pt-8 {\n padding-top: 2rem;\n}\n.text-left {\n text-align: left;\n}\n.text-center {\n text-align: center;\n}\n.text-right {\n text-align: right;\n}\n.align-middle {\n vertical-align: middle;\n}\n.text-2xl {\n font-size: 1.5rem;\n line-height: 2rem;\n}\n.text-base {\n font-size: 1rem;\n line-height: 1.5rem;\n}\n.text-lg {\n font-size: 1.125rem;\n line-height: 1.75rem;\n}\n.text-sm {\n font-size: 0.875rem;\n line-height: 1.25rem;\n}\n.text-xl {\n font-size: 1.25rem;\n line-height: 1.75rem;\n}\n.text-xs {\n font-size: 0.75rem;\n line-height: 1rem;\n}\n.font-bold {\n font-weight: 700;\n}\n.font-medium {\n font-weight: 500;\n}\n.font-normal {\n font-weight: 400;\n}\n.capitalize {\n text-transform: capitalize;\n}\n.text-emerald-600 {\n --tw-text-opacity: 1;\n color: rgb(5 150 105 / var(--tw-text-opacity, 1));\n}\n.text-emerald-700 {\n --tw-text-opacity: 1;\n color: rgb(4 120 87 / var(--tw-text-opacity, 1));\n}\n.text-gray-600 {\n --tw-text-opacity: 1;\n color: rgb(75 85 99 / var(--tw-text-opacity, 1));\n}\n.text-gray-900 {\n --tw-text-opacity: 1;\n color: rgb(17 24 39 / var(--tw-text-opacity, 1));\n}\n.text-green-600 {\n --tw-text-opacity: 1;\n color: rgb(22 163 74 / var(--tw-text-opacity, 1));\n}\n.text-orange-500 {\n --tw-text-opacity: 1;\n color: rgb(249 115 22 / var(--tw-text-opacity, 1));\n}\n.text-orange-600 {\n --tw-text-opacity: 1;\n color: rgb(234 88 12 / var(--tw-text-opacity, 1));\n}\n.text-red-500 {\n --tw-text-opacity: 1;\n color: rgb(239 68 68 / var(--tw-text-opacity, 1));\n}\n.text-slate-400 {\n --tw-text-opacity: 1;\n color: rgb(148 163 184 / var(--tw-text-opacity, 1));\n}\n.text-slate-500 {\n --tw-text-opacity: 1;\n color: rgb(100 116 139 / var(--tw-text-opacity, 1));\n}\n.text-slate-600 {\n --tw-text-opacity: 1;\n color: rgb(71 85 105 / var(--tw-text-opacity, 1));\n}\n.text-white {\n --tw-text-opacity: 1;\n color: rgb(255 255 255 / var(--tw-text-opacity, 1));\n}\n.text-yellow-500 {\n --tw-text-opacity: 1;\n color: rgb(234 179 8 / var(--tw-text-opacity, 1));\n}\n.underline {\n text-decoration-line: underline;\n}\n.shadow {\n --tw-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);\n --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.shadow-lg {\n --tw-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);\n --tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.shadow-md {\n --tw-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);\n --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.shadow-none {\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.shadow-sm {\n --tw-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n --tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.shadow-xl {\n --tw-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);\n --tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.transition {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n.transition-\\[margin\\] {\n transition-property: margin;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n.transition-all {\n transition-property: all;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n.duration-200 {\n transition-duration: 200ms;\n}\n.duration-300 {\n transition-duration: 300ms;\n}\n.hover\\:bg-gray-100:hover {\n --tw-bg-opacity: 1;\n background-color: rgb(243 244 246 / var(--tw-bg-opacity, 1));\n}\n.hover\\:bg-slate-100:hover {\n --tw-bg-opacity: 1;\n background-color: rgb(241 245 249 / var(--tw-bg-opacity, 1));\n}\n.hover\\:bg-slate-200:hover {\n --tw-bg-opacity: 1;\n background-color: rgb(226 232 240 / var(--tw-bg-opacity, 1));\n}\n.hover\\:bg-gray-200:hover {\n --tw-bg-opacity: 1;\n background-color: rgb(229 231 235 / var(--tw-bg-opacity, 1));\n}\n@media (min-width: 768px) {\n .sm\\:flex {\n display: flex;\n }\n .sm\\:hidden {\n display: none;\n }\n}\n.hover\\:bunny-text-orange-400:hover {\n --tw-text-opacity: 1;\n color: rgb(251 146 60 / var(--tw-text-opacity, 1));\n}\n.bunny-components .ant-upload-select-picture-card {\n margin: 0 !important;\n}\n.bunny-components .ant-upload {\n border-radius: 0.5rem !important;\n}\n.bunny-components .ant-checkbox-inner {\n border-color: #cccccc;\n}\n.bunny-components .ant-row {\n margin-bottom: 0px;\n}\n.bunny-components .ant-select-disabled .ant-select-selector .ant-select-selection-item {\n color: rgba(0, 0, 0, 0.25) !important;\n}\n.bunny-components .ant-input-number,\n.bunny-components .ant-input,\n.bunny-components .ant-picker,\n.bunny-components .ant-input-affix-wrapper,\n.bunny-components .ant-select-selector {\n font-size: 0.875rem !important;\n transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);\n color: #232323 !important;\n}\n.bunny-components .ant-input-affix-wrapper {\n padding-top: 0 !important;\n padding-bottom: 0 !important;\n}\n.bunny-components .ant-input-group-addon,\n.bunny-components .ant-input-number-group-addon {\n color: #475569 !important;\n}\n.bunny-components .ant-input-number-group-wrapper,\n.bunny-components .ant-input-number-affix-wrapper {\n width: 100%;\n}\n.bunny-components .ant-input-affix-wrapper input {\n border: none !important;\n}\n.bunny-components .ant-form-item {\n margin-bottom: 0;\n}\n.bunny-components .ant-form-item-label {\n text-transform: none !important;\n font-size: 0.75rem;\n padding-bottom: 2px !important;\n}\n.bunny-components .ant-form-item-label > label {\n width: 100%;\n color: #4b5563 !important;\n}\n.bunny-components .form .ant-form-item-label label {\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n box-sizing: border-box;\n}\n.bunny-components .ant-form-item-explain,\n.bunny-components .ant-form-item-explain-error {\n font-size: 11px;\n min-height: 11px;\n line-height: 11px;\n padding-top: 2px;\n}\n.bunny-components .ant-timeline-item-content {\n font-size: smaller;\n}\n.bunny-components .ant-tree {\n font-size: 0.875rem;\n}\n.bunny-components .ant-tree-treenode {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.bunny-components .ant-tree-draggable-icon {\n height: 24px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.bunny-components .ant-tree-node-content-wrapper {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.bunny-components .ant-tree-switcher {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.bunny-components .ant-page-header {\n padding-left: 0;\n padding-right: 0;\n padding-top: 0;\n}\n.bunny-components .ant-tag {\n display: flex;\n align-items: center;\n justify-content: center;\n border: none;\n border-radius: 14px;\n font-weight: 500;\n white-space: nowrap;\n padding-inline-start: 0.625rem;\n padding-inline-end: 0.625rem;\n margin: 0;\n}\n.bunny-components .ant-tag-blue {\n color: #3b82f6 !important;\n background: #bfdbfe !important;\n}\n.bunny-components .ant-tag-green {\n color: #059669 !important;\n background: #a7f3d0 !important;\n}\n.bunny-components .ant-tag-red {\n color: #ef4444 !important;\n background: #fecaca !important;\n}\n.bunny-components .ant-tag-orange {\n color: #f97316 !important;\n background: #fed7aa !important;\n}\n.bunny-components .ant-tag-yellow {\n color: #f59e0b !important;\n background: #fde68a !important;\n}\n.bunny-components .ant-tag-purple {\n color: #8b5cf6 !important;\n background: #ddd6fe !important;\n}\n.bunny-components .ant-tag-gray {\n color: #6b7280 !important;\n background: #e5e7eb !important;\n}\n.bunny-components .ant-tag-black {\n color: white !important;\n background: black !important;\n}\n.bunny-components .ant-picker {\n width: 100%;\n}\n.bunny-components .ant-input,\n.bunny-components .ant-select,\n.bunny-components .ant-picker {\n height: 32px !important;\n}\n.bunny-components .ant-slider-dot {\n border: 2px solid #f0f0f0;\n}\n.bunny-components .ant-slider-dot-active {\n border-color: #ff5833;\n}\n.bunny-components .ant-slider-mark :last-child {\n transform: translateX(-75%) !important;\n}\n.bunny-components .ant-drawer-content {\n background: #f3f3f9ff;\n}\n.bunny-components .ant-drawer-body,\n.bunny-components .ant-layout {\n background: #f8fafc;\n}\n.bunny-components .vista-link {\n color: #1890ff;\n}\n.bunny-components .vista-link:hover {\n text-decoration: underline;\n cursor: pointer;\n}\n.bunny-components .ant-popover-inner-content {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n max-width: 300px;\n}\n.bunny-components .ant-popconfirm-message-text {\n width: 100% !important;\n}\n.bunny-components .ant-popconfirm-title {\n padding: 0;\n text-align: center;\n font-size: 0.875rem !important;\n width: 100% !important;\n}\n.bunny-components .ant-popconfirm-buttons {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 0.5rem;\n}\n.bunny-components .ant-popconfirm-buttons button {\n margin-inline-start: 0 !important;\n}\n.bunny-components .ant-pagination-item {\n display: flex !important;\n align-items: center;\n justify-content: center;\n}\n.bunny-components .ant-btn-primary:disabled {\n background: #eef0f2 !important;\n color: rgba(0, 0, 0, 0.25) !important;\n border: none;\n}\n.bunny-components .ant-btn {\n box-shadow: none;\n text-shadow: none;\n outline: none !important;\n line-height: 1;\n font-weight: normal;\n}\n.bunny-components .ant-btn-default .ant-btn-icon {\n color: #94a3b8;\n transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);\n}\n.bunny-components .ant-btn-default:hover .ant-btn-icon {\n color: #ff7f5c;\n}\n.bunny-components .ant-btn-default:disabled {\n border-color: rgba(113, 125, 148, 0.2) !important;\n}\n.bunny-components .ant-btn-primary:disabled {\n background-color: rgba(113, 125, 148, 0.1) !important;\n border-color: rgba(113, 125, 148, 0.1) !important;\n}\n.bunny-components .ant-btn-primary:hover:disabled,\n.bunny-components .ant-btn-primary:disabled {\n background-clip: padding-box;\n}\n.bunny-components .ant-select-selection-item-content {\n display: flex !important;\n align-items: center;\n}\n.bunny-components .ant-select-item {\n font-size: 0.875rem;\n}\n.bunny-components .ant-select-item-option-content {\n display: flex;\n align-items: center;\n white-space: nowrap !important;\n overflow: visible !important;\n text-overflow: default !important;\n font-size: 0.875rem;\n}\n.bunny-components .ant-select-arrow .anticon:not(.ant-select-suffix) {\n pointer-events: none;\n}\n.bunny-components .select-dropdown-blue-gray .ant-select-item-option {\n background-color: #fff !important;\n}\n.bunny-components .select-dropdown-blue-gray .ant-select-item-option-active {\n color: #ff5833;\n}\n.bunny-components .ant-dropdown-menu-items {\n padding-left: 0 !important;\n}\n.bunny-components .ant-dropdown-menu-item-active {\n background-color: transparent !important;\n}\n.bunny-components .ant-input-affix-wrapper.searchfield {\n background: white !important;\n}\n.bunny-components .ant-input-affix-wrapper.searchfield input {\n background: white !important;\n}\n.bunny-components .ant-input-affix-wrapper-focused {\n background: white !important;\n}\n.bunny-components .panel .ant-input-affix-wrapper.searchfield {\n background: #f8f8f8 !important;\n}\n.bunny-components .panel .ant-input-affix-wrapper.searchfield input {\n background: #f8f8f8 !important;\n}\n.bunny-components .ant-input-steps-hidden .ant-input-number-handler-wrap {\n display: none;\n}\n.bunny-components .ant-layout-header {\n height: 48px;\n}\n.bunny-components .ant-layout-sider-children {\n width: inherit;\n position: fixed;\n}\n.bunny-components .ant-menu-item-group-list {\n display: flex !important;\n flex-direction: column !important;\n align-items: flex-start !important;\n gap: 4px !important;\n}\n.bunny-components .group {\n display: flex;\n flex-direction: row;\n flex-flow: row wrap;\n box-sizing: border-box;\n}\n.bunny-components .select-datepicker {\n animation-duration: 0.35s !important;\n}\n.bunny-components .header-datepicker {\n top: 96px !important;\n animation-duration: 0s !important;\n}\n.bunny-components .ant-picker-header {\n border-bottom: none !important;\n}\n.bunny-components .ant-picker-content thead tr th {\n font-weight: 500;\n}\n.bunny-components .ant-picker-panel-container {\n border-radius: 0.375rem;\n}\n.bunny-components .ant-picker-cell-selected .custom-date-display {\n color: #ffffff;\n background-color: #ff5833;\n}\n.bunny-components .ant-picker-cell-today .custom-date-display {\n border: 1px solid #ff5833;\n}\n.bunny-components .ant-select:hover,\n.bunny-components * .cardElement:hover {\n border-color: #ff5833;\n}\n.bunny-components .ant-input-number {\n width: 100%;\n}\n.bunny-components .ant-input-number-focused {\n border-color: #ff5833 !important;\n background-color: #ffffff !important;\n}\n.bunny-components .ant-input-affix-wrapper-focused,\n.bunny-components .ant-input-number-focused,\n.bunny-components .ant-picker,\n.bunny-components .ant-input,\n.bunny-components .ant-select-focused .ant-select-selector,\n.bunny-components .ant-select-selector:focus,\n.bunny-components .ant-select-selector:active,\n.bunny-components .ant-select-open .ant-select-selector {\n box-shadow: none !important;\n}\n.bunny-components .ant-select-item-option-selected .ant-select-item-option-state {\n display: none !important;\n}\n.bunny-components .ant-form * input[type='text'].ant-input:not(:disabled),\n.bunny-components .ant-select-selection-item:not(:disabled) {\n color: #232323;\n}\n.bunny-components .ant-tabs-ink-bar {\n display: none !important;\n}\n.bunny-components .ant-tabs-tab.ant-tabs-tab-active {\n border-bottom: 2px solid #ff5833 !important;\n}\n.bunny-components .ant-tabs-tab {\n border-bottom: 2px solid transparent !important;\n padding-bottom: 14px !important;\n}\n.bunny-components .ant-upload-wrapper {\n display: flex;\n}\n.bunny-components .ant-form-item-label > label::after {\n display: none !important;\n}\n.bunny-components .ant-menu-item {\n display: flex !important;\n align-items: center !important;\n}\n.ant-notification {\n width: min-content;\n}\n.ant-notification-topRight {\n right: 0 !important;\n left: 0 !important;\n margin-left: auto !important;\n margin-right: auto !important;\n}\n.ant-notification-notice-wrapper {\n width: 350px !important;\n overflow: hidden !important;\n}\n.ant-notification-notice {\n padding: 16px !important;\n width: 350px !important;\n border-radius: 8px !important;\n display: flex !important;\n box-shadow: 0px 6px 10px rgba(0, 0, 0, 0.08), 0px 1px 18px rgba(0, 0, 0, 0.08), 0px 3px 5px rgba(0, 0, 0, 0.16) !important;\n}\n.ant-notification-notice-description {\n padding: 0 14px 0 0 !important;\n font-size: 14px !important;\n overflow-wrap: break-word;\n}\n.ant-notification-notice-success {\n background-color: #edfffa !important;\n}\n.ant-notification-notice-error {\n background-color: #fff8f4 !important;\n}\n.ant-notification-notice-error .ant-notification-notice-message {\n color: #ff5833 !important;\n font-weight: 500 !important;\n}\n.ant-notification-notice-error .ant-notification-notice-icon {\n color: #ff5833;\n}\n.ant-notification-notice-success .ant-notification-notice-message {\n color: #00b76a !important;\n font-weight: 500 !important;\n}\n.ant-notification-notice-success .ant-notification-notice-icon {\n color: #00b76a !important;\n}\n.ant-notification-notice-message {\n margin-bottom: 0 !important;\n}\n.ant-notification-notice-close {\n top: 16px !important;\n right: 16px !important;\n}\n.bunny-invoice-container {\n padding: 0;\n box-sizing: border-box !important;\n line-height: 1.15;\n}\n@media only screen and (max-width: 768px) {\n select,\n textarea,\n input[type='text'],\n input[type='password'],\n input[type='datetime'],\n input[type='datetime-local'],\n input[type='date'],\n input[type='month'],\n input[type='time'],\n input[type='week'],\n input[type='number'],\n input[type='email'],\n input[type='url'],\n input[type='search'],\n input[type='tel'],\n input[type='color'] {\n font-size: 16px !important;\n }\n}\n@keyframes App-logo-spin {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}\n";
|
|
49
49
|
styleInject(css_248z);
|
|
50
50
|
|
|
51
51
|
/******************************************************************************
|
|
@@ -143,7 +143,7 @@ var BrandContext = createContext({
|
|
|
143
143
|
});
|
|
144
144
|
|
|
145
145
|
// This will be replaced at build time by rollup-plugin-replace
|
|
146
|
-
var PACKAGE_VERSION = '1.
|
|
146
|
+
var PACKAGE_VERSION = '1.5.0-beta.1';
|
|
147
147
|
var createRequestHeaders = function (token) {
|
|
148
148
|
var headers = createClientDevHeaders({ token: token });
|
|
149
149
|
// Add the components version header
|
|
@@ -538,6 +538,46 @@ var checkout = function (_a) {
|
|
|
538
538
|
});
|
|
539
539
|
};
|
|
540
540
|
|
|
541
|
+
var CURRENT_USER_DATA_QUERY = "{\n company {\n name\n }\n currentUser {\n account {\n billingCountry\n currencyId\n }\n authObjectName\n payload {\n returnUrl\n }\n privacyUrl\n termsUrl\n entityId\n }\n }";
|
|
542
|
+
var getCurrentUserData = function (_a) {
|
|
543
|
+
var token = _a.token, apiHost = _a.apiHost;
|
|
544
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
545
|
+
var response;
|
|
546
|
+
var _b, _c, _d, _e, _f, _g, _h, _j;
|
|
547
|
+
return __generator(this, function (_k) {
|
|
548
|
+
switch (_k.label) {
|
|
549
|
+
case 0: return [4 /*yield*/, gqlRequest$1({
|
|
550
|
+
query: CURRENT_USER_DATA_QUERY,
|
|
551
|
+
token: token,
|
|
552
|
+
apiHost: apiHost,
|
|
553
|
+
})];
|
|
554
|
+
case 1:
|
|
555
|
+
response = _k.sent();
|
|
556
|
+
return [2 /*return*/, {
|
|
557
|
+
authObjectName: (_b = response === null || response === void 0 ? void 0 : response.currentUser) === null || _b === void 0 ? void 0 : _b.authObjectName,
|
|
558
|
+
account: (_c = response === null || response === void 0 ? void 0 : response.currentUser) === null || _c === void 0 ? void 0 : _c.account,
|
|
559
|
+
companyName: (_d = response === null || response === void 0 ? void 0 : response.company) === null || _d === void 0 ? void 0 : _d.name,
|
|
560
|
+
returnUrl: (_f = (_e = response === null || response === void 0 ? void 0 : response.currentUser) === null || _e === void 0 ? void 0 : _e.payload) === null || _f === void 0 ? void 0 : _f.returnUrl,
|
|
561
|
+
privacyUrl: (_g = response === null || response === void 0 ? void 0 : response.currentUser) === null || _g === void 0 ? void 0 : _g.privacyUrl,
|
|
562
|
+
termsUrl: (_h = response === null || response === void 0 ? void 0 : response.currentUser) === null || _h === void 0 ? void 0 : _h.termsUrl,
|
|
563
|
+
entityId: (_j = response === null || response === void 0 ? void 0 : response.currentUser) === null || _j === void 0 ? void 0 : _j.entityId,
|
|
564
|
+
}];
|
|
565
|
+
}
|
|
566
|
+
});
|
|
567
|
+
});
|
|
568
|
+
};
|
|
569
|
+
|
|
570
|
+
var useCurrentUserData = function (token) {
|
|
571
|
+
var apiHost = useContext(BunnyContext).apiHost;
|
|
572
|
+
var _a = useQuery({
|
|
573
|
+
queryKey: QueryKeyFactory.default.currentUserKey(token),
|
|
574
|
+
queryFn: function () { return getCurrentUserData({ token: token, apiHost: apiHost }); },
|
|
575
|
+
enabled: Boolean(token),
|
|
576
|
+
}), currentUserData = _a.data, isCurrentUserDataLoading = _a.isLoading;
|
|
577
|
+
var currentUser = currentUserData || {};
|
|
578
|
+
return { currentUser: currentUser, isCurrentUserDataLoading: isCurrentUserDataLoading };
|
|
579
|
+
};
|
|
580
|
+
|
|
541
581
|
var paymentMethodsQuery = function () { return "query PaymentMethods($accountId: ID) {\n paymentMethods (accountId: $accountId) {\n nodes {\n id\n pluginId\n accountId\n expirationDate\n plugin {\n guid\n id\n }\n state\n metadata {\n issuer\n identifier\n kind\n description\n icon\n type\n }\n isDefault\n }\n }\n}"; };
|
|
542
582
|
var getPaymentMethods = function (_a) {
|
|
543
583
|
var apiHost = _a.apiHost, token = _a.token, accountId = _a.accountId;
|
|
@@ -561,15 +601,16 @@ var getPaymentMethods = function (_a) {
|
|
|
561
601
|
});
|
|
562
602
|
};
|
|
563
603
|
var usePaymentMethod = function (_a) {
|
|
564
|
-
var accountId = _a.accountId, token = _a.token, apiHost = _a.apiHost;
|
|
565
|
-
var
|
|
566
|
-
queryKey: QueryKeyFactory.default.
|
|
604
|
+
var accountId = _a.accountId, token = _a.token, apiHost = _a.apiHost, _b = _a.enabled, enabled = _b === void 0 ? true : _b;
|
|
605
|
+
var _c = useQuery({
|
|
606
|
+
queryKey: QueryKeyFactory.default.accountPaymentMethodsKey({
|
|
567
607
|
accountId: accountId,
|
|
568
608
|
token: token,
|
|
569
609
|
}),
|
|
570
610
|
queryFn: function () { return getPaymentMethods({ apiHost: apiHost, token: token, accountId: accountId }); },
|
|
571
|
-
staleTime: 5 * 60 * 1000,
|
|
572
|
-
|
|
611
|
+
staleTime: 5 * 60 * 1000,
|
|
612
|
+
enabled: enabled,
|
|
613
|
+
}), data = _c.data, isLoading = _c.isLoading;
|
|
573
614
|
return {
|
|
574
615
|
paymentMethods: data,
|
|
575
616
|
defaultPaymentMethod: data === null || data === void 0 ? void 0 : data.find(function (paymentMethod) { return paymentMethod.isDefault; }),
|
|
@@ -920,7 +961,7 @@ function usePay(_a) {
|
|
|
920
961
|
}
|
|
921
962
|
|
|
922
963
|
var handleAllErrorFormats = useAllErrorFormats();
|
|
923
|
-
var showErrorNotification$
|
|
964
|
+
var showErrorNotification$5 = useErrorNotification();
|
|
924
965
|
var ActualCheckoutFooter = function (_a) {
|
|
925
966
|
var quote = _a.quote, invoice = _a.invoice, onPaymentSuccess = _a.onPaymentSuccess, onPaymentHoldSuccess = _a.onPaymentHoldSuccess, plugin = _a.plugin, paymentHoldOptions = _a.paymentHoldOptions;
|
|
926
967
|
var isMobile = useIsMobile();
|
|
@@ -1009,7 +1050,7 @@ var ActualCheckoutFooter = function (_a) {
|
|
|
1009
1050
|
_f.sent();
|
|
1010
1051
|
return [3 /*break*/, 6];
|
|
1011
1052
|
case 5:
|
|
1012
|
-
showErrorNotification$
|
|
1053
|
+
showErrorNotification$5("Payment holds are not supported by ".concat((_e = (_d = plugin.components) === null || _d === void 0 ? void 0 : _d.frontend) === null || _e === void 0 ? void 0 : _e[0].name));
|
|
1013
1054
|
return [3 /*break*/, 6];
|
|
1014
1055
|
case 6: return [2 /*return*/];
|
|
1015
1056
|
}
|
|
@@ -18394,7 +18435,7 @@ var Bancontact = function (_a) {
|
|
|
18394
18435
|
return (jsxs("svg", __assign({ className: className, width: "70", height: "48", viewBox: "0 0 70 48", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: [jsx("rect", { x: "0.5", y: "0.5", width: "69", height: "47", rx: "5.5", fill: "white", stroke: "#D9D9D9" }), jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M18.2243 35.1715C18.2243 34.882 18.156 34.6314 18.0199 34.4199C17.8835 34.2083 17.7043 34.0468 17.4819 33.9355C17.7043 33.8242 17.8766 33.6597 17.9991 33.4426C18.1214 33.2255 18.1825 32.9806 18.1825 32.7078V32.5575C18.1825 32.2233 18.1186 31.9451 17.9908 31.7223C17.8628 31.4996 17.6833 31.3213 17.4526 31.1878C17.2219 31.0541 16.9451 30.9582 16.6227 30.8995C16.3 30.8411 15.9414 30.812 15.5465 30.812C15.4131 30.812 15.274 30.8147 15.1296 30.8203C14.9848 30.8258 14.8445 30.8328 14.7083 30.8411C14.572 30.8494 14.4468 30.8593 14.3329 30.8704C14.2188 30.8817 14.1256 30.8928 14.0534 30.9037C13.8921 30.9318 13.7781 30.9817 13.7114 31.0541C13.6448 31.1266 13.6113 31.2575 13.6113 31.4467V36.5245C13.6113 36.7139 13.646 36.8447 13.7156 36.917C13.7851 36.9895 13.9032 37.0394 14.0702 37.0673C14.1535 37.084 14.2536 37.0979 14.3704 37.1091C14.4871 37.1202 14.6136 37.1299 14.7499 37.1383C14.8862 37.1466 15.0265 37.1535 15.1711 37.1593C15.3158 37.1646 15.4575 37.1676 15.5966 37.1676C15.9581 37.1676 16.2986 37.1397 16.6185 37.084C16.9381 37.0285 17.2161 36.9295 17.4526 36.7874C17.689 36.6456 17.8766 36.4534 18.0157 36.2113C18.1546 35.969 18.2243 35.6642 18.2243 35.2967V35.1715ZM16.8063 32.7746C16.8063 32.8637 16.7924 32.9487 16.7645 33.0293C16.7366 33.11 16.6909 33.1795 16.627 33.2383C16.5629 33.2966 16.4768 33.3439 16.3684 33.38C16.2599 33.4162 16.1222 33.4343 15.9554 33.4343H15.0213V31.9895C15.049 31.9895 15.0921 31.9883 15.1505 31.9853C15.2089 31.9825 15.27 31.9812 15.3339 31.9812H15.6551C16.0833 31.9812 16.3822 32.0354 16.5518 32.144C16.7214 32.2526 16.8063 32.421 16.8063 32.6492V32.7746ZM16.5935 35.8062C16.7576 35.6782 16.8397 35.4971 16.8397 35.2634V35.1714C16.8397 34.971 16.7756 34.797 16.6478 34.6494C16.5198 34.502 16.289 34.4282 15.9554 34.4282H15.0213V35.9898H15.1671C15.231 35.9898 15.2977 35.9916 15.3673 35.9942C15.4368 35.9969 15.5035 35.9985 15.5676 35.9985H15.7051C16.1333 35.9985 16.4295 35.9343 16.5935 35.8062ZM22.7955 33.9438C22.7955 33.6377 22.7496 33.3772 22.6578 33.1629C22.5662 32.9487 22.4368 32.7732 22.27 32.6367C22.1032 32.5004 21.8988 32.4003 21.6568 32.3362C21.415 32.2722 21.1439 32.2401 20.8436 32.2401C20.5654 32.2401 20.2943 32.2597 20.0303 32.2987C19.766 32.3375 19.556 32.3766 19.4005 32.4154C19.2948 32.4435 19.242 32.5046 19.242 32.5991V33.2756C19.242 33.3314 19.2559 33.3705 19.2837 33.3925C19.3115 33.4149 19.3475 33.4261 19.3922 33.4261H19.4337C19.5006 33.4204 19.5839 33.4135 19.684 33.4051C19.7842 33.3968 19.8968 33.3901 20.022 33.3842C20.1471 33.3788 20.2777 33.3746 20.414 33.3717C20.5501 33.3689 20.6851 33.3675 20.8186 33.3675C21.0131 33.3675 21.1661 33.4038 21.2773 33.4761C21.3885 33.5486 21.4441 33.7045 21.4441 33.9438V34.2445H20.9937C20.2763 34.2445 19.7549 34.3572 19.4296 34.5827C19.1043 34.8081 18.9416 35.1659 18.9416 35.6558V35.7313C18.9416 36.0039 18.982 36.2321 19.0625 36.4158C19.1431 36.5996 19.2503 36.7472 19.3837 36.8587C19.5172 36.9699 19.6686 37.0493 19.8384 37.0964C20.008 37.1438 20.1846 37.1676 20.3681 37.1676C20.6184 37.1676 20.8339 37.1341 21.0145 37.0673C21.1952 37.0005 21.3662 36.9086 21.5276 36.7917V36.9253C21.5276 36.9699 21.5442 37.0089 21.5776 37.0422C21.6111 37.0756 21.6499 37.0923 21.6944 37.0923H22.6287C22.6731 37.0923 22.712 37.0756 22.7455 37.0422C22.7789 37.0089 22.7955 36.9699 22.7955 36.9253V33.9438ZM21.1481 36.0942C21.2619 36.0581 21.3691 36.015 21.4692 35.9648V35.0462H20.9937C20.8491 35.0462 20.7296 35.0587 20.635 35.0837C20.5404 35.1088 20.4653 35.1465 20.4098 35.1966C20.3542 35.2465 20.3152 35.3107 20.2931 35.3886C20.2707 35.4666 20.2596 35.5556 20.2596 35.6558V35.7312C20.2596 35.9092 20.3026 36.0233 20.3889 36.0734C20.4751 36.1235 20.6071 36.1485 20.7852 36.1485C20.913 36.1485 21.0339 36.1306 21.1481 36.0942ZM27.9007 36.917V34.1358C27.9007 33.8744 27.8799 33.6278 27.8381 33.3968C27.7964 33.166 27.7214 32.9653 27.6129 32.7954C27.5045 32.6256 27.3543 32.4905 27.1624 32.3904C26.9707 32.2902 26.7245 32.2401 26.4242 32.2401C26.1572 32.2401 25.9208 32.2723 25.7152 32.3369C25.5094 32.4014 25.2925 32.515 25.0646 32.6776V32.4752C25.0646 32.4305 25.0478 32.3911 25.0145 32.3575C24.9811 32.3238 24.9421 32.3068 24.8976 32.3068H23.9634C23.9187 32.3068 23.8799 32.3235 23.8467 32.357C23.8133 32.3904 23.7966 32.4295 23.7966 32.4739V36.917C23.7966 36.9615 23.8145 37.0019 23.8508 37.038C23.8869 37.0743 23.9272 37.0923 23.9717 37.0923H24.9811C25.0256 37.0923 25.0646 37.0743 25.0978 37.0382C25.1313 37.0021 25.1479 36.9619 25.1479 36.9173V33.6341C25.2925 33.5564 25.4287 33.4925 25.5567 33.4426C25.6845 33.3925 25.8096 33.3675 25.932 33.3675C26.0599 33.3675 26.1642 33.38 26.2449 33.4051C26.3254 33.4301 26.388 33.4731 26.4325 33.5345C26.477 33.5954 26.5076 33.6759 26.5243 33.7757C26.5409 33.8758 26.5494 33.9981 26.5494 34.1425V36.9173C26.5494 36.9619 26.566 37.0021 26.5994 37.0382C26.6327 37.0743 26.6715 37.0923 26.7162 37.0923H27.7255C27.7699 37.0923 27.8102 37.0743 27.8464 37.038C27.8826 37.0019 27.9007 36.9615 27.9007 36.917ZM32.0047 36.1071V36.8502C32.0047 36.9114 31.9907 36.9546 31.963 36.9796C31.9351 37.0047 31.8906 37.0255 31.8294 37.0422C31.7127 37.0701 31.5611 37.0978 31.3749 37.1259C31.1885 37.1535 30.9703 37.1676 30.72 37.1676C30.1305 37.1676 29.6592 36.9867 29.3062 36.6246C28.953 36.2628 28.7765 35.7394 28.7765 35.0546V34.3531C28.7765 33.6682 28.953 33.1448 29.3062 32.7831C29.6592 32.421 30.1305 32.2401 30.72 32.2401C30.9703 32.2401 31.1885 32.254 31.3749 32.2817C31.5611 32.3098 31.7127 32.3375 31.8294 32.3653C31.8906 32.3819 31.9351 32.4029 31.963 32.4279C31.9907 32.453 32.0047 32.4962 32.0047 32.5574V33.3007C32.0047 33.3453 31.9893 33.38 31.9588 33.4051C31.9281 33.4301 31.8906 33.4426 31.8462 33.4426H31.8294C31.6737 33.4261 31.5251 33.4121 31.3832 33.401C31.2413 33.3901 31.0508 33.3842 30.8118 33.3842C30.7172 33.3842 30.6283 33.3996 30.5448 33.4301C30.4613 33.4608 30.3891 33.5137 30.328 33.5888C30.2666 33.6641 30.2181 33.7641 30.1819 33.8895C30.1457 34.0147 30.1277 34.1692 30.1277 34.3531V35.0546C30.1277 35.2382 30.1457 35.3927 30.1819 35.5181C30.2181 35.6433 30.2666 35.7436 30.328 35.8187C30.3891 35.8939 30.4613 35.9468 30.5448 35.9774C30.6283 36.008 30.7172 36.0233 30.8118 36.0233C31.0508 36.0233 31.2413 36.0178 31.3832 36.0067C31.5251 35.9956 31.6737 35.9815 31.8294 35.9649H31.8462C31.8906 35.9649 31.9281 35.9774 31.9588 36.0025C31.9893 36.0276 32.0047 36.0623 32.0047 36.1071ZM36.6346 34.4115C36.6346 34.0773 36.5885 33.7768 36.4966 33.5095C36.4046 33.2423 36.2709 33.0155 36.0954 32.8289C35.9199 32.6424 35.7025 32.4976 35.4436 32.3946C35.1844 32.2918 34.8848 32.2401 34.5449 32.2401C34.2051 32.2401 33.9056 32.2918 33.6465 32.3946C33.3873 32.4976 33.1685 32.6424 32.9903 32.8289C32.8119 33.0155 32.6768 33.2423 32.585 33.5095C32.4928 33.7768 32.4469 34.0773 32.4469 34.4115V34.9961C32.4469 35.3301 32.4928 35.6309 32.585 35.8981C32.6768 36.1653 32.8119 36.3922 32.9903 36.5788C33.1685 36.7654 33.3873 36.91 33.6465 37.013C33.9056 37.1159 34.2051 37.1676 34.5449 37.1676C34.8848 37.1676 35.1844 37.1159 35.4436 37.013C35.7025 36.91 35.9199 36.7654 36.0954 36.5788C36.2709 36.3922 36.4046 36.1653 36.4966 35.8981C36.5885 35.6309 36.6346 35.3301 36.6346 34.9961V34.4115ZM34.5449 36.0233C35.037 36.0233 35.2832 35.6809 35.2832 34.9961V34.4115C35.2832 33.7322 35.037 33.3925 34.5449 33.3925C34.3016 33.3925 34.1164 33.4774 33.9893 33.6472C33.8619 33.8172 33.7984 34.0719 33.7984 34.4115V34.9961C33.7984 35.3357 33.8619 35.5918 33.9893 35.7644C34.1164 35.9371 34.3016 36.0233 34.5449 36.0233ZM41.5976 36.917V34.1358C41.5976 33.8744 41.5765 33.6278 41.5351 33.3968C41.4933 33.166 41.4181 32.9653 41.3095 32.7954C41.2011 32.6256 41.0511 32.4905 40.8593 32.3904C40.6674 32.2902 40.4213 32.2401 40.1211 32.2401C39.8542 32.2401 39.6177 32.2723 39.4119 32.3369C39.2062 32.4014 38.9893 32.515 38.7613 32.6776V32.4752C38.7613 32.4305 38.7447 32.3911 38.7111 32.3575C38.678 32.3238 38.6389 32.3068 38.5945 32.3068H37.6602C37.6157 32.3068 37.5769 32.3235 37.5434 32.357C37.5102 32.3904 37.4934 32.4295 37.4934 32.4739V36.917C37.4934 36.9615 37.5114 37.0019 37.5476 37.038C37.5838 37.0743 37.624 37.0923 37.6687 37.0923H38.678C38.7224 37.0923 38.7613 37.0743 38.7948 37.0382C38.828 37.0021 38.8448 36.9619 38.8448 36.9173V33.6341C38.9893 33.5564 39.1256 33.4925 39.2534 33.4426C39.3815 33.3925 39.5065 33.3675 39.629 33.3675C39.7568 33.3675 39.8611 33.38 39.9416 33.4051C40.0222 33.4301 40.0849 33.4731 40.1294 33.5345C40.1739 33.5954 40.2044 33.6759 40.2212 33.7757C40.2378 33.8758 40.2462 33.9981 40.2462 34.1425V36.9173C40.2462 36.9619 40.2628 37.0021 40.2962 37.0382C40.3296 37.0743 40.3684 37.0923 40.413 37.0923H41.4223C41.4668 37.0923 41.5072 37.0743 41.5434 37.038C41.5794 37.0019 41.5976 36.9615 41.5976 36.917ZM45.2348 36.2893V36.9357C45.2348 37.0295 45.182 37.0848 45.0763 37.1011C44.9483 37.1233 44.8371 37.1398 44.7427 37.1509C44.6481 37.162 44.5395 37.1675 44.4174 37.1675C44.1905 37.1675 43.9901 37.1493 43.816 37.1133C43.6419 37.077 43.4966 37.0061 43.3805 36.9003C43.2646 36.7945 43.1761 36.6483 43.1153 36.4617C43.0547 36.2753 43.0242 36.0347 43.0242 35.7394V33.3175L42.357 33.2088C42.3123 33.1977 42.2721 33.1769 42.2359 33.1462C42.1997 33.1157 42.1817 33.0781 42.1817 33.0335V32.4822C42.1817 32.4378 42.1997 32.3974 42.2359 32.3611C42.2721 32.325 42.3123 32.3068 42.357 32.3068H43.0242V31.622C43.0242 31.5774 43.0409 31.5414 43.0739 31.5134C43.1068 31.4857 43.1458 31.4663 43.1902 31.455L44.2016 31.2798H44.2263C44.2705 31.2798 44.3065 31.2921 44.3343 31.3171C44.3618 31.3423 44.3757 31.3771 44.3757 31.4215V32.3068H45.0597C45.104 32.3068 45.143 32.3237 45.1764 32.3573C45.2099 32.3909 45.2265 32.4305 45.2265 32.4752V33.1573C45.2265 33.2024 45.2099 33.2416 45.1764 33.2752C45.143 33.3089 45.104 33.3257 45.0597 33.3257H44.3757V35.7561C44.3757 35.9231 44.3895 36.0304 44.4174 36.0776C44.4451 36.1249 44.5229 36.1485 44.6507 36.1485H45.0597C45.1764 36.1485 45.2348 36.1955 45.2348 36.2893ZM49.6891 33.9438C49.6891 33.6377 49.6433 33.3772 49.5514 33.1629C49.4597 32.9487 49.3305 32.7732 49.1637 32.6367C48.9969 32.5004 48.7925 32.4003 48.5505 32.3362C48.3087 32.2722 48.0376 32.2401 47.7373 32.2401C47.4589 32.2401 47.188 32.2597 46.924 32.2987C46.6597 32.3375 46.4497 32.3766 46.2942 32.4154C46.1882 32.4435 46.1357 32.5046 46.1357 32.5991V33.2756C46.1357 33.3314 46.1494 33.3705 46.1773 33.3925C46.2052 33.4149 46.2412 33.4261 46.2857 33.4261H46.3274C46.3943 33.4204 46.4776 33.4135 46.5777 33.4051C46.6779 33.3968 46.7905 33.3901 46.9155 33.3842C47.0408 33.3788 47.1714 33.3746 47.3077 33.3717C47.4438 33.3689 47.5788 33.3675 47.7121 33.3675C47.9068 33.3675 48.0598 33.4038 48.171 33.4761C48.2822 33.5486 48.3378 33.7045 48.3378 33.9438V34.2445H47.8874C47.1698 34.2445 46.6486 34.3572 46.3233 34.5827C45.998 34.8081 45.8353 35.1659 45.8353 35.6558V35.7313C45.8353 36.0039 45.8755 36.2321 45.9562 36.4158C46.0366 36.5996 46.144 36.7472 46.2774 36.8587C46.4109 36.9699 46.5623 37.0493 46.7321 37.0964C46.9017 37.1438 47.0782 37.1676 47.2618 37.1676C47.5121 37.1676 47.7274 37.1341 47.9082 37.0673C48.0889 37.0005 48.2597 36.9086 48.4213 36.7917V36.9253C48.4213 36.9699 48.4379 37.0089 48.4713 37.0422C48.5046 37.0756 48.5436 37.0923 48.5881 37.0923H49.5224C49.5668 37.0923 49.6057 37.0756 49.6392 37.0422C49.6724 37.0089 49.6891 36.9699 49.6891 36.9253V33.9438ZM48.0418 36.0942C48.1556 36.0581 48.2628 36.015 48.3629 35.9648V35.0462H47.8874C47.7428 35.0462 47.6233 35.0587 47.5287 35.0837C47.4341 35.1088 47.359 35.1465 47.3035 35.1966C47.2477 35.2465 47.2088 35.3107 47.1868 35.3886C47.1644 35.4666 47.1533 35.5556 47.1533 35.6558V35.7312C47.1533 35.9092 47.1963 36.0233 47.2826 36.0734C47.3688 36.1235 47.5008 36.1485 47.6789 36.1485C47.8067 36.1485 47.9274 36.1306 48.0418 36.0942ZM53.7933 36.8502V36.1071C53.7933 36.0623 53.7779 36.0276 53.7474 36.0025C53.7167 35.9774 53.6793 35.9649 53.6348 35.9649H53.6181C53.4624 35.9815 53.3136 35.9956 53.1718 36.0067C53.0301 36.0178 52.8395 36.0233 52.6005 36.0233C52.5057 36.0233 52.4167 36.008 52.3336 35.9774C52.2501 35.9468 52.1777 35.8939 52.1165 35.8187C52.0554 35.7436 52.0067 35.6433 51.9707 35.5181C51.9343 35.3927 51.9165 35.2382 51.9165 35.0546V34.3531C51.9165 34.1692 51.9343 34.0147 51.9707 33.8895C52.0067 33.7641 52.0554 33.6641 52.1165 33.5888C52.1777 33.5137 52.2501 33.4608 52.3336 33.4301C52.4167 33.3996 52.5057 33.3842 52.6005 33.3842C52.8395 33.3842 53.0301 33.3901 53.1718 33.401C53.3136 33.4121 53.4624 33.4261 53.6181 33.4426H53.6348C53.6793 33.4426 53.7167 33.4301 53.7474 33.4051C53.7779 33.38 53.7933 33.3453 53.7933 33.3007V32.5574C53.7933 32.4962 53.7794 32.453 53.7515 32.4279C53.7235 32.4029 53.6793 32.3819 53.6181 32.3653C53.5014 32.3375 53.3497 32.3098 53.1635 32.2817C52.9771 32.254 52.759 32.2401 52.5087 32.2401C51.9189 32.2401 51.4479 32.421 51.0947 32.7831C50.7415 33.1448 50.565 33.6682 50.565 34.3531V35.0546C50.565 35.7394 50.7415 36.2628 51.0947 36.6246C51.4479 36.9867 51.9189 37.1676 52.5087 37.1676C52.759 37.1676 52.9771 37.1535 53.1635 37.1259C53.3497 37.0978 53.5014 37.0701 53.6181 37.0422C53.6793 37.0255 53.7235 37.0047 53.7515 36.9796C53.7794 36.9546 53.7933 36.9114 53.7933 36.8502ZM57.3884 36.2893V36.9357C57.3884 37.0295 57.3354 37.0848 57.2299 37.1011C57.1019 37.1233 56.9907 37.1398 56.8963 37.1509C56.8016 37.162 56.6931 37.1675 56.571 37.1675C56.3441 37.1675 56.1437 37.1493 55.9696 37.1133C55.7954 37.077 55.6502 37.0061 55.5343 36.9003C55.4183 36.7945 55.3298 36.6483 55.269 36.4617C55.2083 36.2753 55.1778 36.0347 55.1778 35.7394V33.3175L54.5106 33.2088C54.4659 33.1977 54.4257 33.1769 54.3895 33.1462C54.3533 33.1157 54.3353 33.0781 54.3353 33.0335V32.4822C54.3353 32.4378 54.3533 32.3974 54.3895 32.3611C54.4257 32.325 54.4659 32.3068 54.5106 32.3068H55.1778V31.622C55.1778 31.5774 55.1945 31.5414 55.2276 31.5134C55.2605 31.4857 55.2993 31.4663 55.3436 31.455L56.355 31.2798H56.38C56.4241 31.2798 56.4602 31.2921 56.4875 31.3171C56.5154 31.3423 56.5293 31.3771 56.5293 31.4215V32.3068H57.2133C57.2577 32.3068 57.2966 32.3237 57.3301 32.3573C57.3633 32.3909 57.3801 32.4305 57.3801 32.4752V33.1573C57.3801 33.2024 57.3633 33.2416 57.3301 33.2752C57.2966 33.3089 57.2577 33.3257 57.2133 33.3257H56.5293V35.7561C56.5293 35.9231 56.5431 36.0304 56.571 36.0776C56.5987 36.1249 56.6765 36.1485 56.8045 36.1485H57.2133C57.3301 36.1485 57.3884 36.1955 57.3884 36.2893Z", fill: "#005697" }), jsx("path", { d: "M52.6187 14.7398H39.0664L37.6881 16.2935L33.2155 21.3349V21.3351L31.8372 22.8886H18.464L19.821 21.3153L20.4633 20.5706L21.8202 18.9973H15.6582C14.5325 18.9973 13.6113 19.943 13.6113 21.0987V25.5326C13.6113 26.6885 14.5325 27.6342 15.6582 27.6342H39.2492C40.3749 27.6342 41.9127 26.9318 42.6665 26.0733L46.235 22.0097L52.6187 14.7398Z", fill: "#005697" }), jsx("path", { d: "M55.3418 10C56.4676 10 57.3887 10.9457 57.3887 12.1015V16.5353C57.3887 17.691 56.4676 18.6368 55.3418 18.6368H49.1999L50.5697 17.0753H50.5699L51.2491 16.3012L52.6189 14.7398H39.0667L31.8375 22.8945H18.3813L28.0314 11.9701L28.3966 11.5566C29.153 10.7005 30.6929 10 31.8186 10H55.3418V10Z", fill: "#FBD500" })] })));
|
|
18395
18436
|
};
|
|
18396
18437
|
|
|
18397
|
-
var Text$
|
|
18438
|
+
var Text$r = Typography.Text;
|
|
18398
18439
|
var MiniCreditCard = function (_a) {
|
|
18399
18440
|
var className = _a.className, buttons = _a.buttons, _b = _a.hideDropdownMenu, hideDropdownMenu = _b === void 0 ? false : _b, _c = _a.hideDefaultTag, hideDefaultTag = _c === void 0 ? false : _c, onClickRemove = _a.onClickRemove, paymentMethodData = _a.paymentMethodData, onClickSetDefault = _a.onClickSetDefault, id = _a.id;
|
|
18400
18441
|
var darkMode = useContext(BunnyContext).darkMode;
|
|
@@ -18405,7 +18446,7 @@ var MiniCreditCard = function (_a) {
|
|
|
18405
18446
|
return darkMode ? 'var(--row-background-alternate)' : 'bg-slate-50';
|
|
18406
18447
|
}, [darkMode]);
|
|
18407
18448
|
var isDefault = paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.isDefault;
|
|
18408
|
-
return (jsx("div", __assign({ className: "bunny-flex bunny-flex-row bunny-justify-between bunny-items-center bunny-p-1 bunny-px-3 bunny-border-solid ".concat(backgroundColor, " bunny-").concat(borderColor, " bunny-rounded-md bunny-border ").concat(className), id: id }, { children: paymentMethodData ? (jsxs(Fragment, { children: [jsx("div", __assign({ className: "bunny-flex bunny-flex-row bunny-gap-4" }, { children: jsxs("div", __assign({ className: "bunny-flex bunny-items-center bunny-gap-2 bunny-space-between bunny-w-full" }, { children: [jsx(CardImage, { paymentMethodData: paymentMethodData }), jsx(Issuer, { paymentMethodData: paymentMethodData }), jsx(Identifier, { paymentMethodData: paymentMethodData }), !hideDefaultTag && (jsx("div", { children: isDefault ? (jsx(Tag, __assign({ bordered: false, color: "blue" }, { children: "Default" }))) : null }))] })) })), buttons ? (buttons) : (jsx(Fragment, { children: !hideDropdownMenu && (jsx(DropdownMenu, { setDefault: onClickSetDefault, remove: onClickRemove, isDefault: isDefault !== null && isDefault !== void 0 ? isDefault : false, id: "credit-card-dropdown-".concat(paymentMethodData.id) })) }))] })) : (jsxs("div", __assign({ className: "bunny-flex bunny-flex-row bunny-items-center justify-between w-full" }, { children: [jsxs("div", __assign({ className: "bunny-flex bunny-flex-row bunny-gap-2 bunny-items-center" }, { children: [jsx(CreditCardOutlined, {}), jsx(Text$
|
|
18449
|
+
return (jsx("div", __assign({ className: "bunny-flex bunny-flex-row bunny-justify-between bunny-items-center bunny-p-1 bunny-px-3 bunny-border-solid ".concat(backgroundColor, " bunny-").concat(borderColor, " bunny-rounded-md bunny-border ").concat(className), id: id }, { children: paymentMethodData ? (jsxs(Fragment, { children: [jsx("div", __assign({ className: "bunny-flex bunny-flex-row bunny-gap-4" }, { children: jsxs("div", __assign({ className: "bunny-flex bunny-items-center bunny-gap-2 bunny-space-between bunny-w-full" }, { children: [jsx(CardImage, { paymentMethodData: paymentMethodData }), jsx(Issuer, { paymentMethodData: paymentMethodData }), jsx(Identifier, { paymentMethodData: paymentMethodData }), !hideDefaultTag && (jsx("div", { children: isDefault ? (jsx(Tag, __assign({ bordered: false, color: "blue" }, { children: "Default" }))) : null }))] })) })), buttons ? (buttons) : (jsx(Fragment, { children: !hideDropdownMenu && (jsx(DropdownMenu, { setDefault: onClickSetDefault, remove: onClickRemove, isDefault: isDefault !== null && isDefault !== void 0 ? isDefault : false, id: "credit-card-dropdown-".concat(paymentMethodData.id) })) }))] })) : (jsxs("div", __assign({ className: "bunny-flex bunny-flex-row bunny-items-center justify-between w-full" }, { children: [jsxs("div", __assign({ className: "bunny-flex bunny-flex-row bunny-gap-2 bunny-items-center" }, { children: [jsx(CreditCardOutlined, {}), jsx(Text$r, __assign({ className: "bunny-text-slate-400", style: { fontSize: '12px' } }, { children: "No payment methods" }))] })), jsx(Button, { disabled: true, type: "link" }), buttons] }))) })));
|
|
18409
18450
|
};
|
|
18410
18451
|
var Identifier = function (_a) {
|
|
18411
18452
|
var _b, _c, _d;
|
|
@@ -18414,9 +18455,9 @@ var Identifier = function (_a) {
|
|
|
18414
18455
|
return null;
|
|
18415
18456
|
}
|
|
18416
18457
|
if (((_c = paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.metadata) === null || _c === void 0 ? void 0 : _c.type) === 'cashapp') {
|
|
18417
|
-
return jsx(Text$
|
|
18458
|
+
return jsx(Text$r, { children: "Cashapp" });
|
|
18418
18459
|
}
|
|
18419
|
-
return (jsxs("div", { children: [jsx(Text$
|
|
18460
|
+
return (jsxs("div", { children: [jsx(Text$r, __assign({ className: "relative -top-0.5" }, { children: "****" })), jsx(Text$r, { children: (_d = paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.metadata) === null || _d === void 0 ? void 0 : _d.identifier })] }));
|
|
18420
18461
|
};
|
|
18421
18462
|
var Issuer = function (_a) {
|
|
18422
18463
|
var _b;
|
|
@@ -18425,7 +18466,7 @@ var Issuer = function (_a) {
|
|
|
18425
18466
|
var issuer = (_b = paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.metadata) === null || _b === void 0 ? void 0 : _b.issuer;
|
|
18426
18467
|
if (issuer.length == 0 || list.includes(issuer.toLowerCase()))
|
|
18427
18468
|
return null;
|
|
18428
|
-
return jsx(Text$
|
|
18469
|
+
return jsx(Text$r, { children: lodashExports.capitalize(issuer) });
|
|
18429
18470
|
};
|
|
18430
18471
|
var DropdownMenu = function (_a) {
|
|
18431
18472
|
var setDefault = _a.setDefault, remove = _a.remove, isDefault = _a.isDefault, id = _a.id;
|
|
@@ -18504,7 +18545,7 @@ var useAutoSetDefaultPaymentMethod = function (_a) {
|
|
|
18504
18545
|
}), storedPaymentMethods = _c.paymentMethods, defaultPaymentMethod = _c.defaultPaymentMethod;
|
|
18505
18546
|
// Set the default payment method on the cache. Prevents 'handleSetDefault' from being called too many times.
|
|
18506
18547
|
function setDefaultPaymentMethodOnCache(targetPaymentMethod) {
|
|
18507
|
-
var cachedPaymentMethods = queryClient.getQueryData(QueryKeyFactory.default.
|
|
18548
|
+
var cachedPaymentMethods = queryClient.getQueryData(QueryKeyFactory.default.accountPaymentMethodsKey({
|
|
18508
18549
|
accountId: accountId,
|
|
18509
18550
|
token: token,
|
|
18510
18551
|
}));
|
|
@@ -18513,7 +18554,7 @@ var useAutoSetDefaultPaymentMethod = function (_a) {
|
|
|
18513
18554
|
var paymentMethod = _a[_i];
|
|
18514
18555
|
paymentMethod.isDefault = paymentMethod.id === targetPaymentMethod.id;
|
|
18515
18556
|
}
|
|
18516
|
-
queryClient.setQueryData(QueryKeyFactory.default.
|
|
18557
|
+
queryClient.setQueryData(QueryKeyFactory.default.accountPaymentMethodsKey({
|
|
18517
18558
|
accountId: accountId,
|
|
18518
18559
|
token: token,
|
|
18519
18560
|
}), cachedPaymentMethods);
|
|
@@ -18722,7 +18763,7 @@ function useSave$1(_a) {
|
|
|
18722
18763
|
return { save: save, isSaving: isSaving };
|
|
18723
18764
|
}
|
|
18724
18765
|
|
|
18725
|
-
var Text$
|
|
18766
|
+
var Text$q = Typography.Text;
|
|
18726
18767
|
var TEST_CARD = '4242424242424242';
|
|
18727
18768
|
var DemoPayForm = function (_a) {
|
|
18728
18769
|
var onFail = _a.onFail, onSavePaymentMethod = _a.onSavePaymentMethod, plugin = _a.plugin;
|
|
@@ -18784,7 +18825,7 @@ var DemoPayForm = function (_a) {
|
|
|
18784
18825
|
var onCardCvcChange = function (cvc) {
|
|
18785
18826
|
setCardDetails(__assign(__assign({}, cardDetails), { cvc: cvc }));
|
|
18786
18827
|
};
|
|
18787
|
-
return (jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-gap-2" }, { children: [jsxs(StyledInputs, __assign({ className: "bunny-flex bunny-flex-col bunny-gap-2", darkMode: darkMode !== null && darkMode !== void 0 ? darkMode : false }, { children: [jsx(DemoPayCardNumber, { onChange: onCardNumberChange, value: cardDetails.number }), jsxs("div", __assign({ className: "bunny-flex bunny-gap-2" }, { children: [jsx(DemoPayExpiry, { onChange: onCardExpiryChange, value: cardDetails.expiry }), jsx(DemoPayCardCvc, { onChange: onCardCvcChange, value: cardDetails.cvc })] }))] })), jsx(Text$
|
|
18828
|
+
return (jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-gap-2" }, { children: [jsxs(StyledInputs, __assign({ className: "bunny-flex bunny-flex-col bunny-gap-2", darkMode: darkMode !== null && darkMode !== void 0 ? darkMode : false }, { children: [jsx(DemoPayCardNumber, { onChange: onCardNumberChange, value: cardDetails.number }), jsxs("div", __assign({ className: "bunny-flex bunny-gap-2" }, { children: [jsx(DemoPayExpiry, { onChange: onCardExpiryChange, value: cardDetails.expiry }), jsx(DemoPayCardCvc, { onChange: onCardCvcChange, value: cardDetails.cvc })] }))] })), jsx(Text$q, { children: "DemoPay is for testing only." }), jsx(SavePaymentMethodFooter, { isSaving: isSaving, onSave: onSave })] })));
|
|
18788
18829
|
};
|
|
18789
18830
|
var StyledInputs = defaultStyled.div(templateObject_1$a || (templateObject_1$a = __makeTemplateObject(["\n .ant-input {\n background-color: ", " !important;\n }\n .ant-input:not(:focus) {\n border-color: ", " !important;\n }\n"], ["\n .ant-input {\n background-color: ", " !important;\n }\n .ant-input:not(:focus) {\n border-color: ", " !important;\n }\n"])), function (_a) {
|
|
18790
18831
|
var darkMode = _a.darkMode;
|
|
@@ -18951,7 +18992,7 @@ var CardIcon = function (_a) {
|
|
|
18951
18992
|
return (jsxs("svg", __assign({ className: className, width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: [jsx("path", { d: "M15 3.75H3C2.17157 3.75 1.5 4.42157 1.5 5.25V12.75C1.5 13.5784 2.17157 14.25 3 14.25H15C15.8284 14.25 16.5 13.5784 16.5 12.75V5.25C16.5 4.42157 15.8284 3.75 15 3.75Z", stroke: SLATE_400, strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), jsx("path", { d: "M1.5 7.5H16.5", stroke: SLATE_400, strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })] })));
|
|
18952
18993
|
};
|
|
18953
18994
|
|
|
18954
|
-
var Text$
|
|
18995
|
+
var Text$p = Typography.Text;
|
|
18955
18996
|
var PaymentMethodSelector = function (_a) {
|
|
18956
18997
|
var paymentMethodAllowedPlugins = _a.paymentMethodAllowedPlugins, onSelect = _a.onSelect, value = _a.value;
|
|
18957
18998
|
return (jsx("div", __assign({ className: "bunny-flex bunny-flex-col bunny-gap-2" }, { children: paymentMethodAllowedPlugins === null || paymentMethodAllowedPlugins === void 0 ? void 0 : paymentMethodAllowedPlugins.map(function (plugin, index) { return (jsx(PaymentOption, { name: plugin.name, onClick: onSelect, paymentPlugin: plugin, selected: (value === null || value === void 0 ? void 0 : value.id) === plugin.id }, index)); }) })));
|
|
@@ -18964,7 +19005,7 @@ var PaymentOption = function (_a) {
|
|
|
18964
19005
|
var isCard = name === null || name === void 0 ? void 0 : name.toLowerCase().includes('card');
|
|
18965
19006
|
return (jsxs(PaymentOptionContainer, __assign({ "$brandColor": brandColor, "$selected": selected, className: "bunny-flex bunny-justify-between bunny-items-center bunny-cursor-pointer bunny-py-2 bunny-rounded bunny-border-solid ".concat(darkMode
|
|
18966
19007
|
? "var(--row-background-dark) border-gray-500"
|
|
18967
|
-
: 'bunny-bg-slate-50 bunny-border-slate-200', " bunny-border"), onClick: function () { return onClick(paymentPlugin); } }, { children: [jsxs("div", __assign({ className: "bunny-flex bunny-gap-2 bunny-items-center bunny-pl-4" }, { children: [jsx(Checkbox, { checked: selected, className: darkMode ? 'border-gray-400' : '' }), jsx(Text$
|
|
19008
|
+
: 'bunny-bg-slate-50 bunny-border-slate-200', " bunny-border"), onClick: function () { return onClick(paymentPlugin); } }, { children: [jsxs("div", __assign({ className: "bunny-flex bunny-gap-2 bunny-items-center bunny-pl-4" }, { children: [jsx(Checkbox, { checked: selected, className: darkMode ? 'border-gray-400' : '' }), jsx(Text$p, { children: name })] })), isAch ? (jsx(BankOutlined, { className: "bunny-pr-4" })) : isCard ? (jsx(CardIcon, { className: "bunny-pr-4" })) : (jsx(CardIcon, { className: "bunny-pr-4" }))] })));
|
|
18968
19009
|
};
|
|
18969
19010
|
var PaymentOptionContainer = defaultStyled.div(templateObject_1$9 || (templateObject_1$9 = __makeTemplateObject(["\n transition: border 0.3s ease;\n\n ", "\n\n &:hover {\n border-color: ", ";\n }\n"], ["\n transition: border 0.3s ease;\n\n ", "\n\n &:hover {\n border-color: ", ";\n }\n"])), function (_a) {
|
|
18970
19011
|
var $brandColor = _a.$brandColor, $selected = _a.$selected;
|
|
@@ -19000,9 +19041,8 @@ function useRemovePaymentMethod(paymentPlugins, apiHost, token, accountId, onRem
|
|
|
19000
19041
|
})
|
|
19001
19042
|
.then(function () {
|
|
19002
19043
|
showSuccessNotification('Payment method was removed', 'Success');
|
|
19003
|
-
// TODO: rename accountPaymentMethodKey to accountPaymentMethodsKey (pluralized)
|
|
19004
19044
|
queryClient.invalidateQueries({
|
|
19005
|
-
queryKey: QueryKeyFactory.default.
|
|
19045
|
+
queryKey: QueryKeyFactory.default.accountPaymentMethodsKey({
|
|
19006
19046
|
token: token,
|
|
19007
19047
|
accountId: accountId,
|
|
19008
19048
|
}),
|
|
@@ -19053,9 +19093,8 @@ function useSetDefaultPaymentMethod(paymentPlugins, apiHost, token, accountId, o
|
|
|
19053
19093
|
.then(function () {
|
|
19054
19094
|
showSuccessNotification("Payment method ".concat(data.metadata.identifier, " was set as default"), 'Success');
|
|
19055
19095
|
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
|
|
19056
|
-
// TODO: rename accountPaymentMethodKey to accountPaymentMethodsKey (pluralized)
|
|
19057
19096
|
queryClient.invalidateQueries({
|
|
19058
|
-
queryKey: QueryKeyFactory.default.
|
|
19097
|
+
queryKey: QueryKeyFactory.default.accountPaymentMethodsKey({
|
|
19059
19098
|
token: token,
|
|
19060
19099
|
accountId: accountId,
|
|
19061
19100
|
}),
|
|
@@ -19082,22 +19121,21 @@ function useSetDefaultPaymentMethod(paymentPlugins, apiHost, token, accountId, o
|
|
|
19082
19121
|
return { setDefaultPaymentMethod: setDefaultPaymentMethod, loading: loading };
|
|
19083
19122
|
}
|
|
19084
19123
|
|
|
19085
|
-
var showErrorNotification$
|
|
19124
|
+
var showErrorNotification$4 = useErrorNotification();
|
|
19086
19125
|
var PaymentForm = function (_a) {
|
|
19087
|
-
var
|
|
19088
|
-
var invoice = _a.invoice, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, onPaymentHoldSuccess = _a.onPaymentHoldSuccess, quote = _a.quote, accountId = _a.accountId, onSavePaymentMethod = _a.onSavePaymentMethod, onRemovePaymentMethod = _a.onRemovePaymentMethod, onSetDefaultPaymentMethod = _a.onSetDefaultPaymentMethod, overrideToken = _a.overrideToken, customCheckoutFunction = _a.customCheckoutFunction, currencyIdFromProps = _a.currencyId, paymentHoldOptions = _a.paymentHoldOptions;
|
|
19126
|
+
var invoice = _a.invoice, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, onPaymentHoldSuccess = _a.onPaymentHoldSuccess, quote = _a.quote, accountId = _a.accountId, onSavePaymentMethod = _a.onSavePaymentMethod, onRemovePaymentMethod = _a.onRemovePaymentMethod, onSetDefaultPaymentMethod = _a.onSetDefaultPaymentMethod, overrideToken = _a.overrideToken, customCheckoutFunction = _a.customCheckoutFunction, paymentHoldOptions = _a.paymentHoldOptions;
|
|
19089
19127
|
// Local state
|
|
19090
|
-
var
|
|
19128
|
+
var _b = useState(false), showPaymentMethodForm = _b[0], setShowPaymentMethodForm = _b[1];
|
|
19091
19129
|
// Simple hooks
|
|
19092
19130
|
var queryClient = useQueryClient();
|
|
19093
19131
|
var apiHost = useContext(BunnyContext).apiHost;
|
|
19094
19132
|
var tokenFromContexts = useToken();
|
|
19095
19133
|
var token = overrideToken || tokenFromContexts;
|
|
19096
|
-
var
|
|
19134
|
+
var _c = usePaymentMethod({
|
|
19097
19135
|
accountId: accountId,
|
|
19098
19136
|
token: token,
|
|
19099
19137
|
apiHost: apiHost,
|
|
19100
|
-
}), storedPaymentMethods =
|
|
19138
|
+
}), storedPaymentMethods = _c.paymentMethods, defaultPaymentMethod = _c.defaultPaymentMethod, isPaymentMethodLoading = _c.isLoading;
|
|
19101
19139
|
// Complex hooks
|
|
19102
19140
|
var paymentPlugins = usePaymentPlugins({ apiHost: apiHost, token: token, accountId: accountId }).paymentPlugins;
|
|
19103
19141
|
var selectedPaymentMethodPlugin = useMemo(function () {
|
|
@@ -19107,13 +19145,14 @@ var PaymentForm = function (_a) {
|
|
|
19107
19145
|
// Derived state
|
|
19108
19146
|
var defaultPaymentMethodPlugin = paymentPlugins === null || paymentPlugins === void 0 ? void 0 : paymentPlugins.find(function (plugin) { var _a, _b, _c; return ((_a = plugin.id) === null || _a === void 0 ? void 0 : _a.toString()) === ((_c = (_b = defaultPaymentMethod === null || defaultPaymentMethod === void 0 ? void 0 : defaultPaymentMethod.plugin) === null || _b === void 0 ? void 0 : _b.id) === null || _c === void 0 ? void 0 : _c.toString()); });
|
|
19109
19147
|
var paying = Boolean(quote || invoice);
|
|
19110
|
-
var
|
|
19111
|
-
|
|
19112
|
-
|
|
19148
|
+
var _d = usePaymentFormCurrencyId({
|
|
19149
|
+
quote: quote,
|
|
19150
|
+
invoice: invoice,
|
|
19151
|
+
}), currencyId = _d.currencyId, isCurrencyIdLoading = _d.isCurrencyIdLoading;
|
|
19113
19152
|
var paymentRequired = quote ? getQuoteAmountDue(quote) > 0 : true;
|
|
19114
19153
|
// Custom hooks
|
|
19115
19154
|
var _e = useSetDefaultPaymentMethod(paymentPlugins || [], apiHost, token, accountId, function (message) {
|
|
19116
|
-
showErrorNotification$
|
|
19155
|
+
showErrorNotification$4(message, 'Error setting default payment method');
|
|
19117
19156
|
}, function () {
|
|
19118
19157
|
onSetDefaultPaymentMethod === null || onSetDefaultPaymentMethod === void 0 ? void 0 : onSetDefaultPaymentMethod();
|
|
19119
19158
|
}), handleSetDefault = _e.setDefaultPaymentMethod, setDefaultPaymentMethodLoading = _e.loading;
|
|
@@ -19150,7 +19189,7 @@ var PaymentForm = function (_a) {
|
|
|
19150
19189
|
onError: onFail,
|
|
19151
19190
|
}), checkoutNoPayment = _g.mutate, isCheckingOutNoPayment = _g.isPending;
|
|
19152
19191
|
var onClickRemove = useRemovePaymentMethod(paymentPlugins || [], apiHost, token, accountId, onRemovePaymentMethod, function (message) {
|
|
19153
|
-
showErrorNotification$
|
|
19192
|
+
showErrorNotification$4(message, 'Error removing payment method');
|
|
19154
19193
|
});
|
|
19155
19194
|
var handlePaymentSuccess = function () {
|
|
19156
19195
|
// Hide payment method selector and form
|
|
@@ -19159,7 +19198,7 @@ var PaymentForm = function (_a) {
|
|
|
19159
19198
|
};
|
|
19160
19199
|
var handleSavePaymentMethod = function (response) {
|
|
19161
19200
|
queryClient.invalidateQueries({
|
|
19162
|
-
queryKey: QueryKeyFactory.default.
|
|
19201
|
+
queryKey: QueryKeyFactory.default.accountPaymentMethodsKey({
|
|
19163
19202
|
accountId: accountId,
|
|
19164
19203
|
token: token,
|
|
19165
19204
|
}),
|
|
@@ -19169,7 +19208,7 @@ var PaymentForm = function (_a) {
|
|
|
19169
19208
|
};
|
|
19170
19209
|
function handleClickAddPaymentMethod() {
|
|
19171
19210
|
if ((paymentPlugins === null || paymentPlugins === void 0 ? void 0 : paymentPlugins.length) === 0) {
|
|
19172
|
-
showErrorNotification$
|
|
19211
|
+
showErrorNotification$4('No payment plugins available', 'Error adding payment method');
|
|
19173
19212
|
}
|
|
19174
19213
|
else {
|
|
19175
19214
|
setShowPaymentMethodForm(true);
|
|
@@ -19181,9 +19220,14 @@ var PaymentForm = function (_a) {
|
|
|
19181
19220
|
setShowPaymentMethodForm(true);
|
|
19182
19221
|
}
|
|
19183
19222
|
}, [storedPaymentMethods]);
|
|
19184
|
-
if (isPaymentMethodLoading) {
|
|
19223
|
+
if (isPaymentMethodLoading || isCurrencyIdLoading) {
|
|
19185
19224
|
return jsx(Skeleton, { active: true, className: "bunny-p-4" });
|
|
19186
19225
|
}
|
|
19226
|
+
// Return early because it is a bug if PaymentForm is rendered without a currency ID.
|
|
19227
|
+
// For example, sepa / iDeal may not show for dutch customer if no currencyId
|
|
19228
|
+
if (!currencyId) {
|
|
19229
|
+
return jsx("div", { children: "PaymentForm error: No currency ID found from Quote or Invoice or props." });
|
|
19230
|
+
}
|
|
19187
19231
|
return (jsx(PaymentContext.Provider, __assign({ value: {
|
|
19188
19232
|
onClickCancel: function () { return setShowPaymentMethodForm(false); },
|
|
19189
19233
|
accountId: accountId,
|
|
@@ -19205,9 +19249,18 @@ function StripeWrapper(_a) {
|
|
|
19205
19249
|
var _b = useStripePlugin(plugin, apiHost, currencyId || 'usd', token, accountId), stripe = _b.stripe, options = _b.options;
|
|
19206
19250
|
return (jsx(Elements, __assign({ options: options, stripe: stripe }, { children: children })));
|
|
19207
19251
|
}
|
|
19252
|
+
function usePaymentFormCurrencyId(_a) {
|
|
19253
|
+
var quote = _a.quote, invoice = _a.invoice;
|
|
19254
|
+
var token = useToken();
|
|
19255
|
+
var _b = useCurrentUserData(token), currentUser = _b.currentUser, isCurrentUserDataLoading = _b.isCurrentUserDataLoading;
|
|
19256
|
+
var account = currentUser === null || currentUser === void 0 ? void 0 : currentUser.account;
|
|
19257
|
+
var accountCurrencyId = account === null || account === void 0 ? void 0 : account.currencyId;
|
|
19258
|
+
var currencyId = useMemo(function () { var _a; return (_a = (accountCurrencyId || (quote === null || quote === void 0 ? void 0 : quote.currencyId) || (invoice === null || invoice === void 0 ? void 0 : invoice.currencyId))) === null || _a === void 0 ? void 0 : _a.toLowerCase(); }, [accountCurrencyId, quote === null || quote === void 0 ? void 0 : quote.currencyId, invoice === null || invoice === void 0 ? void 0 : invoice.currencyId]);
|
|
19259
|
+
return { currencyId: currencyId, isCurrencyIdLoading: isCurrentUserDataLoading };
|
|
19260
|
+
}
|
|
19208
19261
|
|
|
19209
19262
|
function Invoice(_a) {
|
|
19210
|
-
var id = _a.id, invoiceQuoteViewComponent = _a.invoiceQuoteViewComponent, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick, onInvoiceDownloadError = _a.onInvoiceDownloadError, onPaymentSuccess = _a.onPaymentSuccess, _b = _a.shadow, shadow = _b === void 0 ? 'shadow-md' : _b, className = _a.className, _c = _a.hideDownloadButton, hideDownloadButton = _c === void 0 ? false : _c, onInvoiceLoaded = _a.onInvoiceLoaded;
|
|
19263
|
+
var id = _a.id, invoiceQuoteViewComponent = _a.invoiceQuoteViewComponent, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick, onInvoiceDownloadError = _a.onInvoiceDownloadError, onPaymentSuccess = _a.onPaymentSuccess, _b = _a.shadow, shadow = _b === void 0 ? 'shadow-md' : _b, className = _a.className, _c = _a.hideDownloadButton, hideDownloadButton = _c === void 0 ? false : _c, _d = _a.hidePaymentForm, hidePaymentForm = _d === void 0 ? false : _d, onInvoiceLoaded = _a.onInvoiceLoaded;
|
|
19211
19264
|
return (jsx(InvoiceQuoteContext.Provider, __assign({ value: {
|
|
19212
19265
|
id: id,
|
|
19213
19266
|
invoiceQuoteViewComponent: invoiceQuoteViewComponent,
|
|
@@ -19219,14 +19272,15 @@ function Invoice(_a) {
|
|
|
19219
19272
|
className: className,
|
|
19220
19273
|
hideDownloadButton: hideDownloadButton,
|
|
19221
19274
|
onInvoiceLoaded: onInvoiceLoaded,
|
|
19222
|
-
} }, { children: jsx(ActualInvoice, {}) })));
|
|
19275
|
+
} }, { children: jsx(ActualInvoice, { hidePaymentForm: hidePaymentForm }) })));
|
|
19223
19276
|
}
|
|
19224
|
-
function ActualInvoice() {
|
|
19277
|
+
function ActualInvoice(_a) {
|
|
19278
|
+
var hidePaymentForm = _a.hidePaymentForm;
|
|
19225
19279
|
// Context
|
|
19226
19280
|
var queryClient = useQueryClient();
|
|
19227
|
-
var
|
|
19228
|
-
var
|
|
19229
|
-
var
|
|
19281
|
+
var _b = useContext(InvoiceQuoteContext), id = _b.id, invoiceQuoteViewComponent = _b.invoiceQuoteViewComponent, backButtonName = _b.backButtonName, onBackButtonClick = _b.onBackButtonClick, onPaymentSuccess = _b.onPaymentSuccess, className = _b.className;
|
|
19282
|
+
var _c = useContext(BunnyContext), apiHost = _c.apiHost, onTokenExpired = _c.onTokenExpired;
|
|
19283
|
+
var _d = useContext(InvoiceQuoteContext), hideDownloadButton = _d.hideDownloadButton, onInvoiceLoaded = _d.onInvoiceLoaded;
|
|
19230
19284
|
var token = useToken();
|
|
19231
19285
|
// Hooks
|
|
19232
19286
|
var showSuccessNotification = useSuccessNotification();
|
|
@@ -19263,12 +19317,12 @@ function ActualInvoice() {
|
|
|
19263
19317
|
}, [formattedInvoice]);
|
|
19264
19318
|
if (!formattedInvoice)
|
|
19265
19319
|
return jsx(Fragment, {});
|
|
19266
|
-
return (jsx("div", __assign({ className: "bunny-invoice-container" }, { children: jsxs("div", __assign({ className: "bunny-flex bunny-gap-6 ".concat(isMobile ? 'bunny-flex-col bunny-w-full' : '', " ").concat(className) }, { children: [formattedInvoice.isLegacy ? (jsx("div", __assign({ className: "bunny-flex bunny-justify-center bunny-w-full" }, { children: jsx(LegacyDocument, { documentUuid: formattedInvoice.uuid, documentType: "invoice" }) }))) : (invoiceQuoteViewComponent || (jsx(InvoiceQuoteView, { html: formattedInvoice.html, formattedInvoice: formattedInvoice, backButtonName: backButtonName, onBackButtonClick: onBackButtonClick }))), isInvoicePayable && (jsx("div", __assign({ className: "bunny-w-full ".concat(hideDownloadButton || formattedInvoice.isLegacy ? '' : 'pt-12') }, { children: jsx(PaymentForm, { onPaymentSuccess: onSuccess, onFail: onFail, invoice: formattedInvoice }) })))] })) })));
|
|
19320
|
+
return (jsx("div", __assign({ className: "bunny-invoice-container" }, { children: jsxs("div", __assign({ className: "bunny-flex bunny-gap-6 ".concat(isMobile ? 'bunny-flex-col bunny-w-full' : '', " ").concat(className) }, { children: [formattedInvoice.isLegacy ? (jsx("div", __assign({ className: "bunny-flex bunny-justify-center bunny-w-full" }, { children: jsx(LegacyDocument, { documentUuid: formattedInvoice.uuid, documentType: "invoice" }) }))) : (invoiceQuoteViewComponent || (jsx(InvoiceQuoteView, { html: formattedInvoice.html, formattedInvoice: formattedInvoice, backButtonName: backButtonName, onBackButtonClick: onBackButtonClick }))), isInvoicePayable && !hidePaymentForm && (jsx("div", __assign({ className: "bunny-w-full ".concat(hideDownloadButton || formattedInvoice.isLegacy ? '' : 'pt-12') }, { children: jsx(PaymentForm, { onPaymentSuccess: onSuccess, onFail: onFail, invoice: formattedInvoice }) })))] })) })));
|
|
19267
19321
|
}
|
|
19268
19322
|
|
|
19269
19323
|
var MUTATION$8 = function () { return "\n query formattedQuote ($id: ID) {\n formattedQuote (id: $id) {\n quote {\n documentTemplateId\n documents { id filename size date url }\n firstInvoice {\n id\n state\n }\n payableId\n id\n payToAccept\n currentPaymentHold {\n createdAt\n expiresAt\n id\n updatedAt\n paymentMethod {\n accountId\n createdAt\n expirationDate\n failureCode\n id\n isDefault\n lastSuccess\n paymentType\n pluginId\n state\n updatedAt\n metadata {\n description\n expiration\n icon\n identifier\n issuer\n kind\n }\n }\n }\n }\n payableId\n acceptedAt\n acceptedByName\n amount\n amountDue\n amountsByPeriod {\n id\n name\n amount\n }\n billingCity\n billingCountry\n billingState\n billingStreet\n billingZip\n contactName\n currency\n customerBillingCity\n customerBillingCountry\n customerBillingState\n customerBillingStreet\n customerBillingZip\n customerName\n discount\n discountValue\n duration\n endDate\n expiresAt\n html\n formattedLines {\n amount\n amountsByPeriod {\n quantity\n id\n name\n startDate\n endDate\n amount\n amountsByTier {\n id\n tier {\n starts\n ends\n price\n }\n quantity\n amount\n }\n prorationRate\n }\n billingPeriodEnd\n billingPeriodStart\n chargeType\n discount\n frequency\n isRamp\n periods\n planName\n position\n price\n priceDecimals\n priceListChargeId\n priceListChargeName\n priceListId\n priceListName\n priceTiers {\n price\n starts\n }\n pricingModel\n productName\n prorationRate\n quantity\n showProductNameOnLineItem\n taxCode\n trialEndDate\n trialStartDate\n unitOfMeasure\n vatCode\n }\n netPaymentDays\n notes\n number\n poNumberRequired\n salesContactEmail\n sharedAt\n startDate\n state\n subtotal\n taxAmount\n taxNumberLabel\n taxNumberRequired\n vendorName\n }\n }"; };
|
|
19270
19324
|
var getFormattedQuote = function (_a) {
|
|
19271
|
-
var token = _a.token, apiHost = _a.apiHost;
|
|
19325
|
+
var token = _a.token, apiHost = _a.apiHost, id = _a.id;
|
|
19272
19326
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
19273
19327
|
var response;
|
|
19274
19328
|
return __generator(this, function (_b) {
|
|
@@ -19277,6 +19331,7 @@ var getFormattedQuote = function (_a) {
|
|
|
19277
19331
|
query: MUTATION$8(),
|
|
19278
19332
|
token: token,
|
|
19279
19333
|
apiHost: apiHost,
|
|
19334
|
+
vars: { id: id },
|
|
19280
19335
|
})];
|
|
19281
19336
|
case 1:
|
|
19282
19337
|
response = _b.sent();
|
|
@@ -19376,7 +19431,6 @@ var quoteAccept = function (_a) {
|
|
|
19376
19431
|
});
|
|
19377
19432
|
});
|
|
19378
19433
|
};
|
|
19379
|
-
// export default quoteAccept;
|
|
19380
19434
|
var useSendAcceptQuote = function (_a) {
|
|
19381
19435
|
var quoteId = _a.quoteId, apiHost = _a.apiHost, token = _a.token;
|
|
19382
19436
|
// Hooks
|
|
@@ -19594,14 +19648,14 @@ var PaymentHoldModal = function (_a) {
|
|
|
19594
19648
|
showSuccessNotification$2("Approved payment hold for ".concat(formatCurrency(quote.amount, quote.currency)));
|
|
19595
19649
|
queryClient.invalidateQueries({
|
|
19596
19650
|
queryKey: QueryKeyFactory.default.createQuoteKey({
|
|
19597
|
-
id: quote.id,
|
|
19651
|
+
id: quote.quote.id,
|
|
19598
19652
|
token: token,
|
|
19599
19653
|
}),
|
|
19600
19654
|
});
|
|
19601
19655
|
} }) }))] })));
|
|
19602
19656
|
};
|
|
19603
19657
|
|
|
19604
|
-
var Text$
|
|
19658
|
+
var Text$o = Typography.Text;
|
|
19605
19659
|
defaultStyled.div(templateObject_1$7 || (templateObject_1$7 = __makeTemplateObject(["\n span {\n width: 100%;\n }\n"], ["\n span {\n width: 100%;\n }\n"])));
|
|
19606
19660
|
function Quote(_a) {
|
|
19607
19661
|
var id = _a.id, invoiceQuoteViewComponent = _a.invoiceQuoteViewComponent, onInvoiceDownloadError = _a.onInvoiceDownloadError, onPaymentSuccess = _a.onPaymentSuccess, _b = _a.shadow, shadow = _b === void 0 ? 'shadow-md' : _b, className = _a.className, _c = _a.hideDownloadButton, hideDownloadButton = _c === void 0 ? false : _c, onQuoteLoaded = _a.onQuoteLoaded;
|
|
@@ -19616,7 +19670,6 @@ function Quote(_a) {
|
|
|
19616
19670
|
onQuoteLoaded: onQuoteLoaded,
|
|
19617
19671
|
} }, { children: jsx(ActualQuote, {}) })));
|
|
19618
19672
|
}
|
|
19619
|
-
// TODO: dissolve this hook
|
|
19620
19673
|
var useQuotePaymentHold = function (formattedQuote) {
|
|
19621
19674
|
var _a, _b;
|
|
19622
19675
|
var _c = useState(false), paymentHoldModalVisible = _c[0], setPaymentHoldModalVisible = _c[1];
|
|
@@ -19643,7 +19696,7 @@ function ActualQuote() {
|
|
|
19643
19696
|
queryFn: function () { return __awaiter(_this, void 0, void 0, function () {
|
|
19644
19697
|
return __generator(this, function (_a) {
|
|
19645
19698
|
switch (_a.label) {
|
|
19646
|
-
case 0: return [4 /*yield*/, getFormattedQuote({ token: token, apiHost: apiHost })];
|
|
19699
|
+
case 0: return [4 /*yield*/, getFormattedQuote({ token: token, apiHost: apiHost, id: id })];
|
|
19647
19700
|
case 1: return [2 /*return*/, _a.sent()];
|
|
19648
19701
|
}
|
|
19649
19702
|
});
|
|
@@ -19683,11 +19736,10 @@ function ActualQuote() {
|
|
|
19683
19736
|
if ((firstInvoice === null || firstInvoice === void 0 ? void 0 : firstInvoice.state) === 'PAID' && paymentHoldCompleted) {
|
|
19684
19737
|
return jsx(Invoice, { id: firstInvoice.id });
|
|
19685
19738
|
}
|
|
19686
|
-
return (jsxs(Fragment, { children: [jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-gap-4
|
|
19739
|
+
return (jsxs(Fragment, { children: [jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-gap-4 ".concat(isMobile ? 'bunny-w-full bunny-overflow-hidden' : '', " ").concat(className) }, { children: [jsx(QuoteButtons, { isAccepted: isAccepted, formattedQuote: formattedQuote, isMobile: isMobile, hideDownloadButton: hideDownloadButton, id: id, isAccepting: isAccepting, handleClickAccept: handleClickAccept, setPaymentHoldModalVisible: setPaymentHoldModalVisible, shouldDoPaymentHold: shouldDoPaymentHold, paymentHoldCompleted: paymentHoldCompleted, paymentHold: paymentHold }), jsx(InvoiceQuoteView, __assign({ html: formattedQuote.html, targetUrl: ((_b = formattedQuote === null || formattedQuote === void 0 ? void 0 : formattedQuote.quote) === null || _b === void 0 ? void 0 : _b.documentTemplateId) ? "/pdf/quote" : undefined }, { children: ((_d = (_c = formattedQuote.quote) === null || _c === void 0 ? void 0 : _c.documents) === null || _d === void 0 ? void 0 : _d.length) > 0 ? (jsx("div", __assign({ className: "bunny-flex bunny-flex-col bunny-items-end" }, { children: formattedQuote.quote.documents.map(function (doc, index) {
|
|
19687
19740
|
return (jsx(Button, __assign({ download: doc.filename, href: doc.url, type: "link" }, { children: doc.filename }), index));
|
|
19688
19741
|
}) }))) : null }))] })), jsx(AcceptQuoteModal, { acceptBoxVisible: acceptBoxVisible, formattedQuote: formattedQuote, setAcceptBoxVisible: setAcceptBoxVisible, setIsAccepting: setIsAccepting, sendAccept: sendAccept, isSendAcceptPending: isSendAcceptPending }), jsx(PaymentHoldModal, { visible: paymentHoldModalVisible, setVisible: setPaymentHoldModalVisible, quote: formattedQuote }), jsx(PandadocPollingModal, { isVisible: pandadocPollingModalVisible, setVisible: setPandadocPollingModalVisible, id: id })] }));
|
|
19689
19742
|
}
|
|
19690
|
-
// TODO: clean up the logic here. Its quite confusing
|
|
19691
19743
|
function QuoteButtons(_a) {
|
|
19692
19744
|
var isAccepted = _a.isAccepted, formattedQuote = _a.formattedQuote, isMobile = _a.isMobile, hideDownloadButton = _a.hideDownloadButton, id = _a.id, isAccepting = _a.isAccepting, handleClickAccept = _a.handleClickAccept, setPaymentHoldModalVisible = _a.setPaymentHoldModalVisible, shouldDoPaymentHold = _a.shouldDoPaymentHold, paymentHoldCompleted = _a.paymentHoldCompleted, paymentHold = _a.paymentHold;
|
|
19693
19745
|
var apiHost = useContext(BunnyContext).apiHost;
|
|
@@ -19698,7 +19750,7 @@ function QuoteButtons(_a) {
|
|
|
19698
19750
|
var signingPlugins = useSigningPlugins({ apiHost: apiHost, token: token });
|
|
19699
19751
|
return (jsxs("div", __assign({ className: "flex flex-row justify-end items-center gap-4", id: "acceptance", style: {
|
|
19700
19752
|
color: entityBranding.secondaryColor,
|
|
19701
|
-
} }, { children: [isAccepted && formattedQuote.acceptedAt ? (jsx(Text$
|
|
19753
|
+
} }, { children: [isAccepted && formattedQuote.acceptedAt ? (jsx(Text$o, { children: "Quote was accepted by ".concat(formattedQuote.acceptedByName, " on ").concat(formatDate(formattedQuote.acceptedAt)) })) : null, (!isMobile || !isAccepted) && (jsxs("div", __assign({ className: isMobile ? 'flex w-full justify-end gap-2' : 'flex items-center justify-end gap-2' }, { children: [paymentHold ? (jsx(PaymentHoldDisplay, { paymentHold: paymentHold, currency: formattedQuote.currency, amount: formattedQuote.amount })) : null, !isMobile && !hideDownloadButton ? (jsx(Button, __assign({ icon: jsx(DownloadOutlined, {}), onClick: function () { return downloadFile(apiHost + '/api/pdf/quote', token); } }, { children: "Download" }))) : null, shouldDoPaymentHold && !paymentHoldCompleted ? (jsx(Button, __assign({ disabled: isExpired, onClick: function () { return setPaymentHoldModalVisible(true); }, type: "primary" }, { children: "Pay to accept" }))) : (jsx(Fragment, { children: !isAccepted ? (jsx(Button, __assign({ disabled: isExpired || isAccepting, onClick: handleClickAccept, type: "primary" }, { children: isExpired
|
|
19702
19754
|
? 'Quote is expired'
|
|
19703
19755
|
: (signingPlugins === null || signingPlugins === void 0 ? void 0 : signingPlugins.length)
|
|
19704
19756
|
? 'Start signing'
|
|
@@ -19798,10 +19850,10 @@ var getColor = function (state) {
|
|
|
19798
19850
|
}
|
|
19799
19851
|
};
|
|
19800
19852
|
|
|
19801
|
-
var Text$
|
|
19853
|
+
var Text$n = Typography.Text;
|
|
19802
19854
|
var TransactionDate = function (_a) {
|
|
19803
19855
|
var date = _a.date;
|
|
19804
|
-
return jsx(Text$
|
|
19856
|
+
return jsx(Text$n, __assign({ className: "bunny-text-sm" }, { children: formatDate(date) }));
|
|
19805
19857
|
};
|
|
19806
19858
|
|
|
19807
19859
|
var ArrowDownToLine = function (_a) {
|
|
@@ -19838,13 +19890,13 @@ var TransactionGridCell = defaultStyled.div.withConfig({
|
|
|
19838
19890
|
}, SLATE_600);
|
|
19839
19891
|
var templateObject_1$6;
|
|
19840
19892
|
|
|
19841
|
-
var Text$
|
|
19893
|
+
var Text$m = Typography.Text;
|
|
19842
19894
|
var TransactionsEmptyState = function () {
|
|
19843
19895
|
var noTransactionsMessage = useContext(TransactionsListContext).noTransactionsMessage;
|
|
19844
|
-
return (jsx(Text$
|
|
19896
|
+
return (jsx(Text$m, __assign({ className: "bunny-flex bunny-justify-center bunny-p-4 bunny-text-base" }, { children: noTransactionsMessage || 'There are no transactions' })));
|
|
19845
19897
|
};
|
|
19846
19898
|
|
|
19847
|
-
var Text$
|
|
19899
|
+
var Text$l = Typography.Text;
|
|
19848
19900
|
var isInvoice = function (transaction) {
|
|
19849
19901
|
return transaction.kind === 'INVOICE';
|
|
19850
19902
|
};
|
|
@@ -19853,7 +19905,7 @@ var TransactionRowTitle = function (_a) {
|
|
|
19853
19905
|
if (!isInvoice(transaction)) {
|
|
19854
19906
|
return jsx(Fragment, {});
|
|
19855
19907
|
}
|
|
19856
|
-
return (jsx(Text$
|
|
19908
|
+
return (jsx(Text$l, __assign({ className: "bunny-text-slate-400", style: { fontSize: '11px' } }, { children: transaction.transactionable.number })));
|
|
19857
19909
|
};
|
|
19858
19910
|
|
|
19859
19911
|
function transactionDateToDisplay(transaction, transactionDateType) {
|
|
@@ -19871,7 +19923,7 @@ function transactionDateToDisplay(transaction, transactionDateType) {
|
|
|
19871
19923
|
}
|
|
19872
19924
|
}
|
|
19873
19925
|
|
|
19874
|
-
var Text$
|
|
19926
|
+
var Text$k = Typography.Text;
|
|
19875
19927
|
var TransactionsListDesktop = function (_a) {
|
|
19876
19928
|
var transactions = _a.transactions, onTransactionClick = _a.onTransactionClick;
|
|
19877
19929
|
var _b = useContext(TransactionsListContext), columns = _b.columns, transactionDateType = _b.transactionDateType;
|
|
@@ -19900,11 +19952,11 @@ var TransactionsListDesktop = function (_a) {
|
|
|
19900
19952
|
!showState &&
|
|
19901
19953
|
!showAmount &&
|
|
19902
19954
|
!showDownload &&
|
|
19903
|
-
!showAccountName && (jsx(TransactionGridCell, { children: jsx(Text$
|
|
19955
|
+
!showAccountName && (jsx(TransactionGridCell, { children: jsx(Text$k, { children: "No columns selected" }) })), showDate && (jsx(TransactionGridCell, __assign({ right: false }, { children: jsx(TransactionDate, { date: transactionDateToDisplay(transaction, transactionDateType) }) }))), showTitle && (jsx(Fragment, { children: jsxs(TransactionGridCell, __assign({ right: false, className: "bunny-flex bunny-items-center bunny-gap-2" }, { children: [jsx(Text$k, { children: lodashExports.capitalize(transaction.kind.toLowerCase()) }), jsx(TransactionRowTitle, { transaction: transaction })] })) })), showAccountName && (jsx(TransactionGridCell, __assign({ right: false }, { children: jsx(Text$k, { children: (_a = transaction.account) === null || _a === void 0 ? void 0 : _a.name }) }))), !showDate && !showTitle && !showAccountName && jsx(TransactionGridCell, { right: false }), showDownload && (jsx(TransactionGridCell, { children: jsx(TransactionDownload, { transaction: transaction, token: token, apiHost: apiHost }) })), showState ? (jsx(TransactionGridCell, __assign({ right: true }, { children: jsx(StateTag, { state: transaction.state }) }))) : null, showAmount && (jsx(TransactionGridCell, __assign({ right: true }, { children: jsx(Text$k, { children: formatCurrency(((_b = transaction === null || transaction === void 0 ? void 0 : transaction.transactionable) === null || _b === void 0 ? void 0 : _b.amount) || transaction.amount, transaction.currencyId) }) })))] }), index));
|
|
19904
19956
|
}) }));
|
|
19905
19957
|
};
|
|
19906
19958
|
|
|
19907
|
-
var Text$
|
|
19959
|
+
var Text$j = Typography.Text;
|
|
19908
19960
|
var TransactionsListMobile = function (_a) {
|
|
19909
19961
|
var transactions = _a.transactions, onTransactionClick = _a.onTransactionClick;
|
|
19910
19962
|
var _b = useContext(TransactionsListContext), columns = _b.columns, transactionDateType = _b.transactionDateType;
|
|
@@ -19927,11 +19979,11 @@ var TransactionsListMobile = function (_a) {
|
|
|
19927
19979
|
backgroundColor: index % 2 === 0
|
|
19928
19980
|
? "var(--row-background".concat(darkMode ? '-dark' : '', ")")
|
|
19929
19981
|
: "var(--row-background-alternate".concat(darkMode ? '-dark' : '', ")"),
|
|
19930
|
-
} }, { children: [jsx(TransactionGridCell, { children: jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-gap-2" }, { children: [(showTitle || showState) && (jsxs("div", __assign({ className: "bunny-flex bunny-items-center bunny-gap-2" }, { children: [showTitle && (jsxs(Fragment, { children: [jsx(Text$
|
|
19982
|
+
} }, { children: [jsx(TransactionGridCell, { children: jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-gap-2" }, { children: [(showTitle || showState) && (jsxs("div", __assign({ className: "bunny-flex bunny-items-center bunny-gap-2" }, { children: [showTitle && (jsxs(Fragment, { children: [jsx(Text$j, { children: lodashExports.capitalize(transaction.kind.toLowerCase()) }), jsx(TransactionRowTitle, { transaction: transaction })] })), showState && jsx(StateTag, { state: transaction.state })] }))), jsxs("div", __assign({ className: "bunny-flex bunny-items-center bunny-gap-2" }, { children: [showAccountName && jsx(Text$j, { children: (_a = transaction.account) === null || _a === void 0 ? void 0 : _a.name }), showAccountName && showDate && jsx(Text$j, { children: "\u00B7" }), showDate && (jsx(TransactionDate, { date: transactionDateToDisplay(transaction, transactionDateType) })), showDate && showAmount && jsx(Text$j, { children: "\u00B7" }), showAmount && (jsx(Text$j, { children: formatCurrency(transaction.transactionable.amount || transaction.amount, transaction.currencyId) }))] }))] })) }), showDownload && (jsx(TransactionGridCell, __assign({ right: true }, { children: jsx(TransactionDownload, { transaction: transaction, token: token, apiHost: apiHost }) })))] }), index));
|
|
19931
19983
|
}) }));
|
|
19932
19984
|
};
|
|
19933
19985
|
|
|
19934
|
-
var Text$
|
|
19986
|
+
var Text$i = Typography.Text;
|
|
19935
19987
|
var DISPLAY_WIDTH = 1200;
|
|
19936
19988
|
function Transactions(_a) {
|
|
19937
19989
|
var transactionComponent = _a.transactionComponent, _b = _a.showSearchBar, showSearchBar = _b === void 0 ? true : _b, _c = _a.showTitle, showTitle = _c === void 0 ? true : _c, _d = _a.title, title = _d === void 0 ? 'Past transactions' : _d, _e = _a.columns, columns = _e === void 0 ? ['date', 'title', 'state', 'amount', 'download'] : _e, className = _a.className, _f = _a.shadow, shadow = _f === void 0 ? 'shadow-md' : _f, searchBarClassName = _a.searchBarClassName, _g = _a.useModal, useModal = _g === void 0 ? false : _g, onTransactionClick = _a.onTransactionClick, _h = _a.suppressTransactionDisplay, suppressTransactionDisplay = _h === void 0 ? false : _h, _j = _a.kindsToShow, kindsToShow = _j === void 0 ? [
|
|
@@ -19941,7 +19993,7 @@ function Transactions(_a) {
|
|
|
19941
19993
|
TransactionKind.WRITE_OFF,
|
|
19942
19994
|
] : _j, style = _a.style, filter = _a.filter, noTransactionsMessage = _a.noTransactionsMessage, filterTransactions = _a.filterTransactions, _k = _a.sortTransactions, sortTransactions = _k === void 0 ? function (a, b) {
|
|
19943
19995
|
return new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime();
|
|
19944
|
-
} : _k, _l = _a.transactionDateType, transactionDateType = _l === void 0 ? 'createdAt' : _l;
|
|
19996
|
+
} : _k, _l = _a.transactionDateType, transactionDateType = _l === void 0 ? 'createdAt' : _l, _m = _a.hidePaymentForm, hidePaymentForm = _m === void 0 ? false : _m;
|
|
19945
19997
|
var contextValues = {
|
|
19946
19998
|
showSearchBar: showSearchBar,
|
|
19947
19999
|
showTitle: showTitle,
|
|
@@ -19961,24 +20013,25 @@ function Transactions(_a) {
|
|
|
19961
20013
|
filterTransactions: filterTransactions,
|
|
19962
20014
|
sortTransactions: sortTransactions,
|
|
19963
20015
|
transactionDateType: transactionDateType,
|
|
20016
|
+
hidePaymentForm: hidePaymentForm,
|
|
19964
20017
|
};
|
|
19965
20018
|
var apiHost = useContext(BunnyContext).apiHost;
|
|
19966
20019
|
var token = useToken();
|
|
19967
20020
|
// Local state
|
|
19968
|
-
var
|
|
19969
|
-
var filterValue = filter || (search ? "filter: \"transaction.transactionableId is ".concat(search, "\"") : '');
|
|
20021
|
+
var _o = useState(''), search = _o[0], setSearch = _o[1];
|
|
20022
|
+
var filterValue = filter || (search.length > 0 ? "filter: \"transaction.transactionableId is ".concat(search, "\"") : '');
|
|
19970
20023
|
// Queries
|
|
19971
20024
|
var data = useQuery({
|
|
19972
20025
|
queryKey: ['transactions', token, filterValue],
|
|
19973
20026
|
queryFn: function () { return getTransactions(filterValue, apiHost, token); },
|
|
19974
20027
|
placeholderData: keepPreviousData,
|
|
19975
20028
|
}).data;
|
|
19976
|
-
return (jsx(TransactionsListContext.Provider, __assign({ value: contextValues }, { children: jsx(TransactionsDisplay, { transactions: data
|
|
20029
|
+
return (jsx(TransactionsListContext.Provider, __assign({ value: contextValues }, { children: jsx(TransactionsDisplay, { transactions: data, onSearchValueChanged: setSearch, search: search }) })));
|
|
19977
20030
|
}
|
|
19978
20031
|
function TransactionsDisplay(_a) {
|
|
19979
20032
|
var _b, _c;
|
|
19980
20033
|
var transactions = _a.transactions, onSearchValueChanged = _a.onSearchValueChanged, search = _a.search;
|
|
19981
|
-
var _d = useContext(TransactionsListContext), showSearchBar = _d.showSearchBar, showTitle = _d.showTitle, title = _d.title, transactionComponent = _d.transactionComponent, useModal = _d.useModal, suppressTransactionDisplay = _d.suppressTransactionDisplay, className = _d.className, shadow = _d.shadow, searchBarClassName = _d.searchBarClassName, style = _d.style, onTransactionClick = _d.onTransactionClick, onTransactionDisplayClose = _d.onTransactionDisplayClose, kindsToShow = _d.kindsToShow, filterTransactions = _d.filterTransactions, sortTransactions = _d.sortTransactions;
|
|
20034
|
+
var _d = useContext(TransactionsListContext), showSearchBar = _d.showSearchBar, showTitle = _d.showTitle, title = _d.title, transactionComponent = _d.transactionComponent, useModal = _d.useModal, suppressTransactionDisplay = _d.suppressTransactionDisplay, className = _d.className, shadow = _d.shadow, searchBarClassName = _d.searchBarClassName, style = _d.style, onTransactionClick = _d.onTransactionClick, onTransactionDisplayClose = _d.onTransactionDisplayClose, kindsToShow = _d.kindsToShow, filterTransactions = _d.filterTransactions, sortTransactions = _d.sortTransactions, hidePaymentForm = _d.hidePaymentForm;
|
|
19982
20035
|
var columns = useContext(TransactionsListContext).columns;
|
|
19983
20036
|
var darkMode = useContext(BunnyContext).darkMode;
|
|
19984
20037
|
var secondaryColor = useContext(BrandContext).secondaryColor;
|
|
@@ -20042,18 +20095,18 @@ function TransactionsDisplay(_a) {
|
|
|
20042
20095
|
onTransactionDisplayClose === null || onTransactionDisplayClose === void 0 ? void 0 : onTransactionDisplayClose(selectedTransaction);
|
|
20043
20096
|
setDrawerOpen(false);
|
|
20044
20097
|
}
|
|
20045
|
-
return (jsxs("div", __assign({ style: style }, { children: [jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-w-full bunny-shadow-padding-xb bunny-gap-2 ".concat(isMobile ? 'bunny-overflow-hidden' : '', " ").concat(className) }, { children: [showTitle || showSearchBar ? (jsxs("div", __assign({ className: "bunny-flex ".concat(isMobile ? 'bunny-flex-col bunny-gap-1' : 'bunny-flex-row bunny-items-center', " bunny-justify-between") }, { children: [showTitle ? (jsx(Text$
|
|
20098
|
+
return (jsxs("div", __assign({ style: style }, { children: [jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-w-full bunny-shadow-padding-xb bunny-gap-2 ".concat(isMobile ? 'bunny-overflow-hidden' : '', " ").concat(className) }, { children: [showTitle || showSearchBar ? (jsxs("div", __assign({ className: "bunny-flex ".concat(isMobile ? 'bunny-flex-col bunny-gap-1' : 'bunny-flex-row bunny-items-center', " bunny-justify-between") }, { children: [showTitle ? (jsx(Text$i, __assign({ className: "bunny-shrink-0 bunny-font-medium", style: { color: darkMode ? undefined : secondaryColor } }, { children: title }))) : (jsx("div", {}) // Empty div so justify-between works
|
|
20046
20099
|
), showSearchBar && (jsx("div", __assign({ className: "".concat(isMobile ? 'bunny-w-full' : '') }, { children: jsx(Input, { className: searchBarClassName ? searchBarClassName : '', onChange: function (e) {
|
|
20047
20100
|
if (isNaN(Number(e.target.value))) {
|
|
20048
20101
|
return;
|
|
20049
20102
|
}
|
|
20050
20103
|
onSearchValueChanged(e.target.value);
|
|
20051
|
-
}, prefix:
|
|
20104
|
+
}, prefix: jsx(SearchOutlined, {}), placeholder: "Search by id #", style: {
|
|
20052
20105
|
minWidth: '300px',
|
|
20053
20106
|
}, value: search }) })))] }))) : null, jsx("div", __assign({ className: "bunny-grid bunny-w-full bunny-rounded-md bunny-overflow-auto ".concat(shadow), style: {
|
|
20054
20107
|
gridTemplateColumns: gridTemplateColumns(),
|
|
20055
20108
|
backgroundColor: "var(--row-background".concat(darkMode ? '-dark' : '', ")"),
|
|
20056
|
-
} }, { children: isMobile ? (jsx(TransactionsListMobile, { transactions: updatedTransactions, onTransactionClick: handleTransactionClick })) : (jsx(TransactionsListDesktop, { transactions: updatedTransactions, onTransactionClick: handleTransactionClick })) }))] })), useModal ? (jsx(Modal, __assign({ title: drawerTitle(), open: drawerOpen, onOk: handleDisplayClose, onCancel: handleDisplayClose, width: DISPLAY_WIDTH, footer: null }, { children: jsx(Invoice, { id:
|
|
20109
|
+
} }, { children: isMobile ? (jsx(TransactionsListMobile, { transactions: updatedTransactions, onTransactionClick: handleTransactionClick })) : (jsx(TransactionsListDesktop, { transactions: updatedTransactions, onTransactionClick: handleTransactionClick })) }))] })), useModal ? (jsx(Modal, __assign({ title: drawerTitle(), open: drawerOpen, onOk: handleDisplayClose, onCancel: handleDisplayClose, width: DISPLAY_WIDTH, footer: null }, { children: jsx(Invoice, { id: selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.transactionableId, hidePaymentForm: hidePaymentForm }) }))) : (jsx(Drawer, __assign({ title: drawerTitle(), onClose: handleDisplayClose, open: drawerOpen, width: DISPLAY_WIDTH }, { children: transactionComponent ? (transactionComponent) : (selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.kind) === 'INVOICE' ? (jsx(Invoice, { id: selectedTransaction.transactionableId, hidePaymentForm: hidePaymentForm })) : (jsxs(Card$1, __assign({ className: "bunny-shadow-md" }, { children: [jsx(Typography.Title, __assign({ level: 2, className: "bunny-mb-4" }, { children: "Transaction Details" })), jsxs(Typography.Paragraph, { children: [jsx("strong", { children: "Amount:" }), ' ', jsx(Typography.Text, { children: formatCurrency((selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.amount) || 0, (selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.currencyId) || 'USD') })] }), jsxs(Typography.Paragraph, { children: [jsx("strong", { children: "Description:" }), ' ', jsx(Typography.Text, { children: selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.description })] }), jsxs(Typography.Paragraph, { children: [jsx("strong", { children: "Kind:" }), ' ', jsx(Typography.Text, { children: selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.kind })] }), jsxs(Typography.Paragraph, { children: [jsx("strong", { children: "State:" }), ' ', jsx(Typography.Text, { children: selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.state })] })] }))) })))] })));
|
|
20057
20110
|
}
|
|
20058
20111
|
|
|
20059
20112
|
function Quotes(_a) {
|
|
@@ -20272,21 +20325,22 @@ var getPriceList = function (_a) {
|
|
|
20272
20325
|
});
|
|
20273
20326
|
};
|
|
20274
20327
|
|
|
20275
|
-
var
|
|
20328
|
+
var QUOTE_FIELDS = function (removeFormattedQuoteField) { return "\n fragment QuoteFields on Quote {\n accountId\n amount\n amountDue\n smallUnitAmountDue\n currencyId\n ".concat(removeFormattedQuoteField ? '' : "formattedQuote { html }", "\n id\n payableId\n periodAmount\n subtotal\n taxAmount\n startDate\n amountsByPeriod {\n amount\n startDate\n }\n kind\n quoteChanges {\n currencyId\n id\n kind\n charges {\n subtotal\n amountsByPeriod {\n amount\n startDate\n }\n amount\n billingPeriod\n currencyId\n feature {\n unitName\n }\n id\n name\n priceListCharge {\n id\n }\n priceList {\n id\n }\n coupon {\n couponCode\n }\n quantity\n kind\n }\n priceList {\n id\n plan {\n name\n }\n product {\n name\n }\n }\n }\n }\n"); };
|
|
20329
|
+
var QUOTE_QUERY = function (id, removeFormattedQuoteField) { return "\n".concat(QUOTE_FIELDS(removeFormattedQuoteField), "\n query quote {\n quote ").concat(id ? "(id: ".concat(id, ")") : '', " {\n ...QuoteFields\n }\n }"); };
|
|
20276
20330
|
var getQuote = function (_a) {
|
|
20277
|
-
var id = _a.id, token = _a.token, apiHost = _a.apiHost;
|
|
20331
|
+
var id = _a.id, token = _a.token, apiHost = _a.apiHost, _b = _a.removeFormattedQuoteField, removeFormattedQuoteField = _b === void 0 ? false : _b;
|
|
20278
20332
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
20279
20333
|
var response;
|
|
20280
|
-
return __generator(this, function (
|
|
20281
|
-
switch (
|
|
20334
|
+
return __generator(this, function (_c) {
|
|
20335
|
+
switch (_c.label) {
|
|
20282
20336
|
case 0: return [4 /*yield*/, gqlRequest({
|
|
20283
|
-
query: QUOTE_QUERY(id),
|
|
20337
|
+
query: QUOTE_QUERY(id, removeFormattedQuoteField),
|
|
20284
20338
|
token: token,
|
|
20285
20339
|
vars: {},
|
|
20286
20340
|
apiHost: apiHost,
|
|
20287
20341
|
})];
|
|
20288
20342
|
case 1:
|
|
20289
|
-
response =
|
|
20343
|
+
response = _c.sent();
|
|
20290
20344
|
return [2 /*return*/, response === null || response === void 0 ? void 0 : response.quote];
|
|
20291
20345
|
}
|
|
20292
20346
|
});
|
|
@@ -20368,7 +20422,7 @@ var getCoupons = function (_a) {
|
|
|
20368
20422
|
});
|
|
20369
20423
|
};
|
|
20370
20424
|
|
|
20371
|
-
var showErrorNotification$
|
|
20425
|
+
var showErrorNotification$3 = useErrorNotification();
|
|
20372
20426
|
var useUpdateCoupons = function (_a) {
|
|
20373
20427
|
var apiHost = _a.apiHost, token = _a.token, quoteChangeId = _a.quoteChangeId, onCouponAdded = _a.onCouponAdded, onCouponRemoved = _a.onCouponRemoved;
|
|
20374
20428
|
var coupons = useQuery({
|
|
@@ -20395,7 +20449,7 @@ var useUpdateCoupons = function (_a) {
|
|
|
20395
20449
|
},
|
|
20396
20450
|
onError: function (error) {
|
|
20397
20451
|
var _a, _b;
|
|
20398
|
-
showErrorNotification$
|
|
20452
|
+
showErrorNotification$3((_b = (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.errors[0]) === null || _b === void 0 ? void 0 : _b.message, 'Error adding coupon');
|
|
20399
20453
|
},
|
|
20400
20454
|
}), addCoupon = _b.mutate, isAddingCoupon = _b.isPending;
|
|
20401
20455
|
var _c = useMutation({
|
|
@@ -20415,7 +20469,7 @@ var useUpdateCoupons = function (_a) {
|
|
|
20415
20469
|
},
|
|
20416
20470
|
onError: function (error) {
|
|
20417
20471
|
var _a, _b;
|
|
20418
|
-
showErrorNotification$
|
|
20472
|
+
showErrorNotification$3((_b = (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.errors[0]) === null || _b === void 0 ? void 0 : _b.message, 'Error removing coupon');
|
|
20419
20473
|
},
|
|
20420
20474
|
}), removeCoupon = _c.mutate, isRemovingCoupon = _c.isPending;
|
|
20421
20475
|
return {
|
|
@@ -20427,83 +20481,29 @@ var useUpdateCoupons = function (_a) {
|
|
|
20427
20481
|
};
|
|
20428
20482
|
};
|
|
20429
20483
|
|
|
20430
|
-
var CURRENT_USER_DATA_QUERY = "{\n company {\n name\n }\n currentUser {\n account {\n billingCountry\n currencyId\n }\n authObjectName\n payload {\n returnUrl\n }\n privacyUrl\n termsUrl\n entityId\n }\n }";
|
|
20431
|
-
var getCurrentUserData = function (_a) {
|
|
20432
|
-
var token = _a.token, apiHost = _a.apiHost;
|
|
20433
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
20434
|
-
var response;
|
|
20435
|
-
var _b, _c, _d, _e, _f, _g, _h, _j;
|
|
20436
|
-
return __generator(this, function (_k) {
|
|
20437
|
-
switch (_k.label) {
|
|
20438
|
-
case 0: return [4 /*yield*/, gqlRequest$1({
|
|
20439
|
-
query: CURRENT_USER_DATA_QUERY,
|
|
20440
|
-
token: token,
|
|
20441
|
-
apiHost: apiHost,
|
|
20442
|
-
})];
|
|
20443
|
-
case 1:
|
|
20444
|
-
response = _k.sent();
|
|
20445
|
-
return [2 /*return*/, {
|
|
20446
|
-
authObjectName: (_b = response === null || response === void 0 ? void 0 : response.currentUser) === null || _b === void 0 ? void 0 : _b.authObjectName,
|
|
20447
|
-
account: (_c = response === null || response === void 0 ? void 0 : response.currentUser) === null || _c === void 0 ? void 0 : _c.account,
|
|
20448
|
-
companyName: (_d = response === null || response === void 0 ? void 0 : response.company) === null || _d === void 0 ? void 0 : _d.name,
|
|
20449
|
-
returnUrl: (_f = (_e = response === null || response === void 0 ? void 0 : response.currentUser) === null || _e === void 0 ? void 0 : _e.payload) === null || _f === void 0 ? void 0 : _f.returnUrl,
|
|
20450
|
-
privacyUrl: (_g = response === null || response === void 0 ? void 0 : response.currentUser) === null || _g === void 0 ? void 0 : _g.privacyUrl,
|
|
20451
|
-
termsUrl: (_h = response === null || response === void 0 ? void 0 : response.currentUser) === null || _h === void 0 ? void 0 : _h.termsUrl,
|
|
20452
|
-
entityId: (_j = response === null || response === void 0 ? void 0 : response.currentUser) === null || _j === void 0 ? void 0 : _j.entityId,
|
|
20453
|
-
}];
|
|
20454
|
-
}
|
|
20455
|
-
});
|
|
20456
|
-
});
|
|
20457
|
-
};
|
|
20458
|
-
|
|
20459
|
-
var useCurrentUserData = function (token) {
|
|
20460
|
-
var apiHost = useContext(BunnyContext).apiHost;
|
|
20461
|
-
var currentUserData = useQuery({
|
|
20462
|
-
queryKey: QueryKeyFactory.default.currentUserKey(token),
|
|
20463
|
-
queryFn: function () { return getCurrentUserData({ token: token, apiHost: apiHost }); },
|
|
20464
|
-
enabled: Boolean(token),
|
|
20465
|
-
}).data;
|
|
20466
|
-
return currentUserData || {};
|
|
20467
|
-
};
|
|
20468
|
-
|
|
20469
20484
|
var BunnyFooterIcon = function (_a) {
|
|
20470
20485
|
var color = _a.color;
|
|
20471
20486
|
return (jsxs("svg", __assign({ width: "45", height: "15", viewBox: "0 0 39 13", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: [jsxs("g", __assign({ clipPath: "url(#clip0_6_851)" }, { children: [jsx("path", { className: "bunny-icon-path", d: "M14.5898 7.19708C14.5898 9.35053 13.0926 10.325 11.2495 10.325C9.39955 10.325 7.90234 9.35001 7.90234 7.18967V3.26221H10.1125V7.00052C10.1125 7.87719 10.5855 8.27725 11.2495 8.27725C11.9061 8.27725 12.3865 7.87719 12.3865 7.00052V3.26221H14.5898V7.19708Z", fill: color }), jsx("path", { className: "bunny-icon-path", d: "M31.8943 12.9625H29.4793L31.8523 8.62816L28.9355 3.26221H31.4708L33.0457 6.35524L34.5924 3.26221H37.0075L31.8943 12.9625Z", fill: color }), jsx("path", { className: "bunny-icon-path", d: "M15.1602 5.96827C15.1602 3.8148 16.6574 2.84033 18.5005 2.84033C20.3504 2.84033 21.8476 3.81533 21.8476 5.97568V10.1473H19.6374V6.16483C19.6374 5.28815 19.1645 4.8881 18.5005 4.8881C17.8439 4.8881 17.3634 5.28815 17.3634 6.16483V10.1473H15.1602V5.96827Z", fill: color }), jsx("path", { className: "bunny-icon-path", d: "M22.4316 5.96827C22.4316 3.8148 23.9289 2.84033 25.7719 2.84033C27.6219 2.84033 29.1191 3.81533 29.1191 5.97568V10.1473H26.9089V6.16483C26.9089 5.28815 26.4359 4.8881 25.7719 4.8881C25.1154 4.8881 24.6349 5.28815 24.6349 6.16483V10.1473H22.4316V5.96827Z", fill: color }), jsx("path", { className: "bunny-icon-path", d: "M7.40511 6.68957C7.40511 8.7236 6.02815 10.3227 4.17816 10.3227C3.23907 10.3227 2.61071 9.94378 2.19358 9.40371V10.1404H0.0605469V0.0405273H2.26381V3.91939C2.68041 3.42158 3.28802 3.07069 4.17763 3.07069C6.02759 3.07069 7.40511 4.66981 7.40511 6.68957ZM2.17229 6.69642C2.17229 7.60802 2.77937 8.2744 3.64823 8.2744C4.53783 8.2744 5.13107 7.59372 5.13107 6.69642C5.13107 5.79912 4.53783 5.11844 3.64823 5.11844C2.77937 5.11844 2.17229 5.78482 2.17229 6.69642Z", fill: color }), jsx("path", { className: "bunny-icon-path", d: "M38.966 8.94801C38.966 9.76181 38.2668 10.4631 37.4618 10.4631C36.6499 10.4631 35.9434 9.76181 35.9434 8.94801C35.9434 8.14846 36.6494 7.46094 37.4618 7.46094C38.2668 7.46094 38.966 8.14846 38.966 8.94801Z", fill: color })] })), jsx("defs", { children: jsx("clipPath", __assign({ id: "clip0_6_851" }, { children: jsx("rect", { width: "39", height: "13", fill: "white" }) })) })] })));
|
|
20472
20487
|
};
|
|
20473
20488
|
|
|
20474
|
-
var Text$
|
|
20489
|
+
var Text$h = Typography.Text;
|
|
20475
20490
|
var Footer = function (_a) {
|
|
20476
20491
|
var className = _a.className;
|
|
20477
20492
|
var token = useToken();
|
|
20478
|
-
var
|
|
20493
|
+
var currentUser = useCurrentUserData(token).currentUser;
|
|
20494
|
+
var privacyUrl = currentUser.privacyUrl, termsUrl = currentUser.termsUrl;
|
|
20479
20495
|
var isMobile = useIsMobile();
|
|
20480
20496
|
return (jsxs("div", __assign({ className: "bunny-flex bunny-items-center bunny-justify-between bunny-shrink-0 ".concat(isMobile ? 'bunny-flex-col bunny-gap-2' : '', " ").concat(className) }, { children: [(termsUrl || privacyUrl) && (jsxs("div", __assign({ className: "bunny-flex bunny-items-center bunny-gap-3" }, { children: [termsUrl && (jsx(StyedLink, __assign({ className: "bunny-text-xs bunny-text-slate-400", href: termsUrl, rel: "noopener noreferrer", target: "_blank", type: "text" }, { children: "Terms" }))), privacyUrl && (jsx(StyedLink, __assign({ className: "bunny-text-xs bunny-text-slate-400", href: privacyUrl, rel: "noopener noreferrer", target: "_blank", type: "text" }, { children: "Privacy" })))] }))), jsx(BunnyMarketingLink, {})] })));
|
|
20481
20497
|
};
|
|
20482
20498
|
var BunnyMarketingLink = function () {
|
|
20483
20499
|
var _a = useState(false), isHovered = _a[0], setIsHovered = _a[1];
|
|
20484
20500
|
var isMobile = useIsMobile();
|
|
20485
|
-
return (jsx("div", __assign({ className: "bunny-flex bunny-items-end bunny-justify-end ".concat(isMobile ? '' : 'grow') }, { children: jsx(StyledBunnyLink, __assign({ className: "bunny-flex bunny-items-end bunny-justify-end bunny-text-slate-400", href: "https://bunny.com/", rel: "noopener noreferrer", target: "_blank" }, { children: jsxs("div", __assign({ className: "bunny-flex bunny-items-center", onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); } }, { children: [jsx(Text$
|
|
20501
|
+
return (jsx("div", __assign({ className: "bunny-flex bunny-items-end bunny-justify-end ".concat(isMobile ? '' : 'grow') }, { children: jsx(StyledBunnyLink, __assign({ className: "bunny-flex bunny-items-end bunny-justify-end bunny-text-slate-400", href: "https://bunny.com/", rel: "noopener noreferrer", target: "_blank" }, { children: jsxs("div", __assign({ className: "bunny-flex bunny-items-center", onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); } }, { children: [jsx(Text$h, __assign({ className: "bunny-text-xs bunny-text-slate-400" }, { children: "Powered by\u00A0" })), jsx("div", __assign({ style: { paddingTop: '5px' } }, { children: jsx(BunnyFooterIcon, { color: isHovered ? PRIMARY_COLOR : SLATE_400 }) }))] })) })) })));
|
|
20486
20502
|
};
|
|
20487
20503
|
var StyedLink = styled.a(templateObject_1$5 || (templateObject_1$5 = __makeTemplateObject(["\n color: ", ";\n transition: color 0.3s;\n &:hover {\n color: ", ";\n }\n text-decoration: none;\n"], ["\n color: ", ";\n transition: color 0.3s;\n &:hover {\n color: ", ";\n }\n text-decoration: none;\n"])), SLATE_400, SLATE_500);
|
|
20488
20504
|
var StyledBunnyLink = styled(StyedLink)(templateObject_2$1 || (templateObject_2$1 = __makeTemplateObject(["\n &:hover {\n color: ", " !important;\n }\n"], ["\n &:hover {\n color: ", " !important;\n }\n"])), PRIMARY_COLOR);
|
|
20489
20505
|
var templateObject_1$5, templateObject_2$1;
|
|
20490
20506
|
|
|
20491
|
-
function shouldShowCouponEditor(quote, activeCouponsExist, upgradingSubscription) {
|
|
20492
|
-
var _a;
|
|
20493
|
-
var upgradingFromTrial = ((_a = upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState$2.TRIAL;
|
|
20494
|
-
function upgradingFromFree() {
|
|
20495
|
-
var totalPrice = upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.charges.reduce(function (acc, charge) { return acc + Number((charge === null || charge === void 0 ? void 0 : charge.discountedPrice) || 0); }, 0);
|
|
20496
|
-
return totalPrice === 0;
|
|
20497
|
-
}
|
|
20498
|
-
if (quote.kind === QuoteChangeKind.SUBSCRIBE) {
|
|
20499
|
-
return activeCouponsExist;
|
|
20500
|
-
}
|
|
20501
|
-
else if (quote.kind === QuoteChangeKind.ADJUSTMENT) {
|
|
20502
|
-
return activeCouponsExist && (upgradingFromTrial || upgradingFromFree());
|
|
20503
|
-
}
|
|
20504
|
-
return false;
|
|
20505
|
-
}
|
|
20506
|
-
|
|
20507
20507
|
function CouponEditor(_a) {
|
|
20508
20508
|
var className = _a.className, onAddCoupon = _a.onAddCoupon, isAddingCoupon = _a.isAddingCoupon, couponCode = _a.couponCode, setCouponCode = _a.setCouponCode;
|
|
20509
20509
|
function handleAddCoupon() {
|
|
@@ -20517,17 +20517,14 @@ function CouponEditor(_a) {
|
|
|
20517
20517
|
return (jsx("div", __assign({ className: "bunny-flex bunny-flex-col bunny-gap-2 ".concat(className) }, { children: jsxs("div", __assign({ className: "bunny-flex bunny-flex-row bunny-gap-2" }, { children: [jsx(Input, { value: couponCode, onChange: function (e) { return setCouponCode(e.target.value); }, placeholder: "Coupon code", disabled: isAddingCoupon, size: "small" }), jsx(Button, __assign({ loading: isAddingCoupon, type: "primary", onClick: handleAddCoupon, disabled: couponCode.length === 0 }, { children: "Apply" }))] })) })));
|
|
20518
20518
|
}
|
|
20519
20519
|
|
|
20520
|
-
var
|
|
20521
|
-
|
|
20522
|
-
var Text$f = Typography.Text;
|
|
20520
|
+
var Text$g = Typography.Text;
|
|
20523
20521
|
function CheckoutSummary(_a) {
|
|
20524
20522
|
var quote = _a.quote, className = _a.className, onAddCoupon = _a.onAddCoupon, onRemoveCoupon = _a.onRemoveCoupon, isRemovingCoupon = _a.isRemovingCoupon, priceListData = _a.priceListData, isAddingCoupon = _a.isAddingCoupon, couponCode = _a.couponCode, setCouponCode = _a.setCouponCode, activeCouponsExist = _a.activeCouponsExist;
|
|
20525
|
-
|
|
20526
|
-
return (jsxs("div", __assign({ className: "".concat(className, " bunny-space-y-4") }, { children: [jsxs(Text$f, { children: [jsxs("div", __assign({ className: "bunny-text-lg bunny-font-medium bunny-mb-4" }, { children: ["Checkout summary - ", priceListData === null || priceListData === void 0 ? void 0 : priceListData.product.name, " ", priceListData === null || priceListData === void 0 ? void 0 : priceListData.name] })), jsx("div", __assign({ className: "bunny-space-y-4" }, { children: quote === null || quote === void 0 ? void 0 : quote.quoteChanges.map(function (quoteChange) {
|
|
20523
|
+
return (jsxs("div", __assign({ className: "".concat(className, " bunny-space-y-4") }, { children: [jsxs(Text$g, { children: [jsxs("div", __assign({ className: "bunny-text-lg bunny-font-medium bunny-mb-4" }, { children: ["Checkout summary - ", priceListData === null || priceListData === void 0 ? void 0 : priceListData.product.name, " ", priceListData === null || priceListData === void 0 ? void 0 : priceListData.name] })), jsx("div", __assign({ className: "bunny-space-y-4" }, { children: quote === null || quote === void 0 ? void 0 : quote.quoteChanges.map(function (quoteChange) {
|
|
20527
20524
|
return quoteChange === null || quoteChange === void 0 ? void 0 : quoteChange.charges.map(function (charge) {
|
|
20528
20525
|
var _a;
|
|
20529
20526
|
var multiplier = charge.kind === 'COUPON' ? -1 : 1;
|
|
20530
|
-
return (jsxs("div", __assign({ className: "bunny-grid bunny-grid-cols-3 bunny-gap-4 bunny-items-center" }, { children: [jsx("div", __assign({ className: "bunny-col-span-1" }, { children: charge.name })), jsx("div", __assign({ className: "bunny-col-span-1 bunny-text-center" }, { children: ((_a = charge.coupon) === null || _a === void 0 ? void 0 : _a.couponCode) ? (jsx("
|
|
20527
|
+
return (jsxs("div", __assign({ className: "bunny-grid bunny-grid-cols-3 bunny-gap-4 bunny-items-center" }, { children: [jsx("div", __assign({ className: "bunny-col-span-1" }, { children: charge.name })), jsx("div", __assign({ className: "bunny-col-span-1 bunny-text-center" }, { children: ((_a = charge.coupon) === null || _a === void 0 ? void 0 : _a.couponCode) ? (jsx("button", __assign({ onClick: function () {
|
|
20531
20528
|
var _a, _b;
|
|
20532
20529
|
if (isRemovingCoupon) {
|
|
20533
20530
|
return;
|
|
@@ -20536,10 +20533,9 @@ function CheckoutSummary(_a) {
|
|
|
20536
20533
|
throw new Error('Coupon code not found');
|
|
20537
20534
|
}
|
|
20538
20535
|
onRemoveCoupon((_b = charge.coupon) === null || _b === void 0 ? void 0 : _b.couponCode);
|
|
20539
|
-
}, className: "bunny-text-orange-500 hover:bunny-text-orange-400 bunny-cursor-pointer" }, { children: "Remove" }))) : (jsx("div", { children: charge.quantity })) })), jsx("div", __assign({ className: "bunny-col-span-1 bunny-text-right" }, { children: formatCurrency(multiplier * (charge.subtotal || 0), charge.currencyId) }))] }), charge.id));
|
|
20536
|
+
}, className: "bunny-text-orange-500 hover:bunny-text-orange-400 bunny-cursor-pointer bunny-bg-transparent bunny-border-none" }, { children: "Remove" }))) : (jsx("div", { children: charge.quantity })) })), jsx("div", __assign({ className: "bunny-col-span-1 bunny-text-right" }, { children: formatCurrency(multiplier * (charge.subtotal || 0), charge.currencyId) }))] }), charge.id));
|
|
20540
20537
|
});
|
|
20541
|
-
}) })), jsx(CheckoutSummaryDivider, {}), jsxs("div", __assign({ className: "bunny-space-y-4" }, { children: [jsxs("div", __assign({ className: "bunny-flex bunny-justify-between" }, { children: [jsx("div", { children: "Subtotal" }), jsx("div", { children: formatCurrency(quote.subtotal, quote.currencyId) })] })), jsxs("div", __assign({ className: "bunny-flex bunny-justify-between" }, { children: [jsx("div", { children: "Taxes" }), jsx("div", { children: formatCurrency(quote.taxAmount, quote.currencyId) })] }))] })), jsx(CheckoutSummaryDivider, {}), jsxs("div", __assign({ className: "bunny-flex bunny-justify-between" }, { children: [jsx("div", { children: "Total" }), jsx("div", { children: formatCurrency(quote.amountDue, quote.currencyId) })] }))] }),
|
|
20542
|
-
shouldShowCouponEditor(quote, activeCouponsExist, upgradingSubscription) && (jsx(CouponEditor, { className: "bunny-w-full", quote: quote, onAddCoupon: onAddCoupon, isAddingCoupon: isAddingCoupon, couponCode: couponCode, setCouponCode: setCouponCode }))] })));
|
|
20538
|
+
}) })), jsx(CheckoutSummaryDivider, {}), jsxs("div", __assign({ className: "bunny-space-y-4" }, { children: [jsxs("div", __assign({ className: "bunny-flex bunny-justify-between" }, { children: [jsx("div", { children: "Subtotal" }), jsx("div", { children: formatCurrency(quote.subtotal, quote.currencyId) })] })), jsxs("div", __assign({ className: "bunny-flex bunny-justify-between" }, { children: [jsx("div", { children: "Taxes" }), jsx("div", { children: formatCurrency(quote.taxAmount, quote.currencyId) })] }))] })), jsx(CheckoutSummaryDivider, {}), jsxs("div", __assign({ className: "bunny-flex bunny-justify-between" }, { children: [jsx("div", { children: "Total" }), jsx("div", { children: formatCurrency(quote.amountDue, quote.currencyId) })] }))] }), activeCouponsExist && (jsx(CouponEditor, { className: "bunny-w-full", quote: quote, onAddCoupon: onAddCoupon, isAddingCoupon: isAddingCoupon, couponCode: couponCode, setCouponCode: setCouponCode }))] })));
|
|
20543
20539
|
}
|
|
20544
20540
|
var CheckoutSummaryDivider = function () {
|
|
20545
20541
|
return (jsx("div", __assign({ className: "bunny-my-2" }, { children: jsx(Divider, { className: "m-0" }) })));
|
|
@@ -20578,28 +20574,28 @@ function InitialSignupForm(_a) {
|
|
|
20578
20574
|
return (jsx(Form, __assign({ className: "bunny-flex bunny-flex-col bunny-h-full bunny-w-full ".concat(className), form: form, layout: "vertical", autoComplete: "off" }, { children: jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-space-y-2" }, { children: [jsxs("div", __assign({ className: "bunny-flex bunny-gap-4" }, { children: [jsx(Form.Item, __assign({ name: "firstName", rules: [{ required: true, message: 'First name is required' }], className: "bunny-flex-1" }, { children: jsx(Input, { placeholder: "First name" }) })), jsx(Form.Item, __assign({ name: "lastName", rules: [{ required: true, message: 'Last name is required' }], className: "bunny-flex-1" }, { children: jsx(Input, { placeholder: "Last name" }) }))] })), jsxs("div", __assign({ className: "bunny-flex bunny-gap-4" }, { children: [jsx(Form.Item, __assign({ name: "email", rules: [
|
|
20579
20575
|
{ required: true, message: 'Email is required' },
|
|
20580
20576
|
{ type: 'email', message: 'Please enter a valid email' },
|
|
20581
|
-
], className: "bunny-flex-1" }, { children: jsx(Input, { placeholder: "Email" }) })), jsx(Form.Item, __assign({ name: "accountName", rules: [{ required: true, message: 'Company name is required' }], className: "bunny-flex-1" }, { children: jsx(Input, { placeholder: "Company name" }) }))] })), jsx("div", __assign({ className: "bunny-flex ".concat(isMobile ? 'bunny-flex-row bunny-pb-2' : 'bunny-flex-row', " bunny-gap-4") }, { children: jsx("div", __assign({ className: "flex-1 w-1/2" }, { children: jsx(Form.Item, __assign({ name: "billingCountry", rules: [{ required: true, message: 'Country is required' }] }, { children: jsx(Select, {
|
|
20577
|
+
], className: "bunny-flex-1" }, { children: jsx(Input, { placeholder: "Email" }) })), jsx(Form.Item, __assign({ name: "accountName", rules: [{ required: true, message: 'Company name is required' }], className: "bunny-flex-1" }, { children: jsx(Input, { placeholder: "Company name" }) }))] })), jsx("div", __assign({ className: "bunny-flex ".concat(isMobile ? 'bunny-flex-row bunny-pb-2' : 'bunny-flex-row', " bunny-gap-4") }, { children: jsx("div", __assign({ className: "flex-1 w-1/2" }, { children: jsx(Form.Item, __assign({ name: "billingCountry", rules: [{ required: true, message: 'Country is required' }] }, { children: jsx(Select, { options: Lists.COUNTRY_LIST, placeholder: "Select a country", showSearch: true, filterOption: function (input, option) {
|
|
20582
20578
|
var _a, _b;
|
|
20583
20579
|
return ((_a = option === null || option === void 0 ? void 0 : option.label) !== null && _a !== void 0 ? _a : '').toLowerCase().includes(input.toLowerCase()) ||
|
|
20584
20580
|
((_b = option === null || option === void 0 ? void 0 : option.value) !== null && _b !== void 0 ? _b : '').toLowerCase().includes(input.toLowerCase());
|
|
20585
20581
|
} }) })) })) })), jsx(Form.Item, { children: jsx(Button, __assign({ type: "primary", onClick: handleSubmit, loading: submitting, className: "bunny-w-full" }, { children: "Proceed to payment" })) })] })) })));
|
|
20586
20582
|
}
|
|
20587
20583
|
|
|
20588
|
-
var Title = Typography.Title, Text$
|
|
20584
|
+
var Title = Typography.Title, Text$f = Typography.Text;
|
|
20589
20585
|
function PaymentSuccessDisplay(_a) {
|
|
20590
20586
|
var amountPaid = _a.amountPaid, className = _a.className, companyName = _a.companyName, returnUrl = _a.returnUrl, style = _a.style, currencyId = _a.currencyId;
|
|
20591
|
-
return (jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-items-center bunny-justify-center bunny-h-full ".concat(className), style: style }, { children: [jsx(CheckCircleFilled, { style: { fontSize: "48px", color: "rgb(52 211 153)" } }), jsxs(Title, __assign({ level: 3, className: "bunny-mt-2 bunny-m-0" }, { children: ["Payment of ", formatCurrency(amountPaid, currencyId), " successful"] })), returnUrl && (jsxs(Text$
|
|
20587
|
+
return (jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-items-center bunny-justify-center bunny-h-full ".concat(className), style: style }, { children: [jsx(CheckCircleFilled, { style: { fontSize: "48px", color: "rgb(52 211 153)" } }), jsxs(Title, __assign({ level: 3, className: "bunny-mt-2 bunny-m-0" }, { children: ["Payment of ", formatCurrency(amountPaid, currencyId), " successful"] })), returnUrl && (jsxs(Text$f, __assign({ className: "bunny-text-slate-500 bunny-cursor-pointer bunny-underline", onClick: function () { return (window.location.href = returnUrl); } }, { children: ["Back to ", companyName] })))] })));
|
|
20592
20588
|
}
|
|
20593
20589
|
|
|
20594
|
-
var Text$
|
|
20590
|
+
var Text$e = Typography.Text;
|
|
20595
20591
|
function PriceListDisplay(_a) {
|
|
20596
20592
|
var priceListData = _a.priceListData;
|
|
20597
20593
|
if (!priceListData)
|
|
20598
20594
|
return null;
|
|
20599
|
-
return (jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-space-y-8" }, { children: [jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-gap-2" }, { children: [jsxs(Text$
|
|
20595
|
+
return (jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-space-y-8" }, { children: [jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-gap-2" }, { children: [jsxs(Text$e, __assign({ className: "bunny-text-slate-500 bunny-font-bold bunny-text-lg" }, { children: [priceListData.product.name, " ", priceListData.name] })), jsxs(Text$e, __assign({ className: "bunny-font-bold bunny-text-xl" }, { children: [formatCurrency(priceListData.basePrice, priceListData.currencyId), " / month"] }))] })), priceListData.trialAllowed ? (jsxs("div", __assign({ className: "bunny-flex bunny-flex-col" }, { children: [jsxs(Text$e, __assign({ style: { fontSize: '16px' }, className: "bunny-text-slate-500" }, { children: [priceListData.trialLengthDays, " day trial"] })), jsx(Text$e, __assign({ className: "bunny-text-slate-500", style: { fontSize: '12px' } }, { children: "You will not be charged until the last day of the trial." }))] }))) : null] })));
|
|
20600
20596
|
}
|
|
20601
20597
|
|
|
20602
|
-
var showErrorNotification = useErrorNotification();
|
|
20598
|
+
var showErrorNotification$2 = useErrorNotification();
|
|
20603
20599
|
var showSuccessNotification$1 = useSuccessNotification();
|
|
20604
20600
|
function Signup(_a) {
|
|
20605
20601
|
var _b, _c, _d;
|
|
@@ -20609,6 +20605,14 @@ function Signup(_a) {
|
|
|
20609
20605
|
var tokenFromContexts = useToken();
|
|
20610
20606
|
var isMobile = useIsMobile();
|
|
20611
20607
|
var topNavImageUrl = useContext(BrandContext).topNavImageUrl;
|
|
20608
|
+
var defaultValues = useMemo(function () { return ({
|
|
20609
|
+
firstName: defaultFirstName,
|
|
20610
|
+
lastName: defaultLastName,
|
|
20611
|
+
email: defaultEmail,
|
|
20612
|
+
accountName: defaultCompanyName,
|
|
20613
|
+
billingCountry: defaultBillingCountry,
|
|
20614
|
+
}); }, [defaultFirstName, defaultLastName, defaultEmail, defaultCompanyName, defaultBillingCountry]);
|
|
20615
|
+
var queryClient = useQueryClient();
|
|
20612
20616
|
var _f = useState(undefined), initialQuote = _f[0], setInitialQuote = _f[1];
|
|
20613
20617
|
var _g = useState(undefined), accountId = _g[0], setAccountId = _g[1];
|
|
20614
20618
|
var _h = useState(undefined), portalSessionToken = _h[0], setPortalSessionToken = _h[1];
|
|
@@ -20620,8 +20624,8 @@ function Signup(_a) {
|
|
|
20620
20624
|
accountId: accountId,
|
|
20621
20625
|
token: token,
|
|
20622
20626
|
apiHost: apiHost,
|
|
20627
|
+
enabled: Boolean(accountId),
|
|
20623
20628
|
}).defaultPaymentMethod;
|
|
20624
|
-
var queryClient = useQueryClient();
|
|
20625
20629
|
var recalculateTaxes = useMutation({
|
|
20626
20630
|
mutationFn: function () {
|
|
20627
20631
|
if (!(quote === null || quote === void 0 ? void 0 : quote.id)) {
|
|
@@ -20631,7 +20635,7 @@ function Signup(_a) {
|
|
|
20631
20635
|
},
|
|
20632
20636
|
onError: function (error) {
|
|
20633
20637
|
if (!error[0].message.includes('Ensure that you have a taxation plugin')) {
|
|
20634
|
-
showErrorNotification(error.message);
|
|
20638
|
+
showErrorNotification$2(error.message);
|
|
20635
20639
|
}
|
|
20636
20640
|
},
|
|
20637
20641
|
onSuccess: function (quote) {
|
|
@@ -20667,10 +20671,10 @@ function Signup(_a) {
|
|
|
20667
20671
|
onSuccess: function (data) {
|
|
20668
20672
|
setAccountId(data.account.id);
|
|
20669
20673
|
setPortalSessionToken(data.portalSessionToken);
|
|
20670
|
-
// We must invalidate the
|
|
20674
|
+
// We must invalidate the accountPaymentMethodsKey query in order to clear payment methods from the provided api token,
|
|
20671
20675
|
// to instead use paymentMethods from portalSessionToken.
|
|
20672
20676
|
queryClient.invalidateQueries({
|
|
20673
|
-
queryKey: QueryKeyFactory.default.
|
|
20677
|
+
queryKey: QueryKeyFactory.default.accountPaymentMethodsKey({
|
|
20674
20678
|
accountId: accountId,
|
|
20675
20679
|
token: token,
|
|
20676
20680
|
}),
|
|
@@ -20680,10 +20684,10 @@ function Signup(_a) {
|
|
|
20680
20684
|
onError: function (error) {
|
|
20681
20685
|
var errorMessage = error.response.errors[0].message;
|
|
20682
20686
|
if (errorMessage.includes("Address couldn't be validated")) {
|
|
20683
|
-
showErrorNotification('Please enter a valid billing address');
|
|
20687
|
+
showErrorNotification$2('Please enter a valid billing address');
|
|
20684
20688
|
}
|
|
20685
20689
|
else {
|
|
20686
|
-
showErrorNotification(errorMessage);
|
|
20690
|
+
showErrorNotification$2(errorMessage);
|
|
20687
20691
|
}
|
|
20688
20692
|
},
|
|
20689
20693
|
}), quoteAccountSignupMutate = _l.mutate, isSigningUp = _l.isPending;
|
|
@@ -20780,7 +20784,7 @@ function Signup(_a) {
|
|
|
20780
20784
|
}
|
|
20781
20785
|
function handlePaymentFail(error) {
|
|
20782
20786
|
var _a;
|
|
20783
|
-
showErrorNotification((_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.message);
|
|
20787
|
+
showErrorNotification$2((_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.message);
|
|
20784
20788
|
}
|
|
20785
20789
|
useEffect(function () {
|
|
20786
20790
|
if (initialQuote === null || initialQuote === void 0 ? void 0 : initialQuote.id) {
|
|
@@ -20792,28 +20796,42 @@ function Signup(_a) {
|
|
|
20792
20796
|
}
|
|
20793
20797
|
return (jsxs("div", __assign({ className: "bunny-flex ".concat(isMobile ? 'bunny-flex-col' : 'bunny-flex-row', " bunny-h-screen bunny-w-screen bunny-absolute bunny-top-0 bunny-left-0 ").concat(shadow, " ").concat(className), style: style }, { children: [jsx("div", __assign({ className: "bunny-flex bunny-items-center bunny-flex-col ".concat(isMobile ? 'bunny-w-full bunny-h-1/2' : 'bunny-w-1/2 bunny-h-full', " bunny-justify-center") }, { children: jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-items-start bunny-justify-between bunny-w-3/5 bunny-h-full bunny-gap-4 bunny-my-24" }, { children: [jsx("div", { children: topNavImageUrl.length > 0 && (jsx(Image, { width: 24, src: topNavImageUrl, alt: "Logo", preview: false })) }), data ? (jsx(CheckoutSummary, { quote: data, className: "bunny-h-full bunny-w-full", onAddCoupon: addCoupon, onRemoveCoupon: removeCoupon, isRemovingCoupon: isRemovingCoupon, priceListData: priceListData, isAddingCoupon: isAddingCoupon, couponCode: couponEditorCouponCode, setCouponCode: setCouponEditorCouponCode, activeCouponsExist: activeCouponsExist })) : (jsx("div", __assign({ className: "bunny-h-full" }, { children: isLoadingPriceList ? (jsx(Skeleton, { active: true })) : (jsx(PriceListDisplay, { priceListData: priceListData })) }))), jsx(Footer, {})] })) })), jsx("div", __assign({ className: "bunny-flex bunny-flex-col ".concat(isMobile ? 'bunny-w-full bunny-h-1/2 bunny-overflow-auto' : 'bunny-w-1/2 bunny-h-full', " bunny-items-center"), style: {
|
|
20794
20798
|
boxShadow: '-5px 0 20px 0 rgba(0, 0, 0, 0.05)',
|
|
20795
|
-
} }, { children: isLoadingPriceList ? (jsx(Skeleton, { active: true, className: "bunny-flex bunny-flex-col bunny-w-3/5 bunny-mt-24" })) : (jsx("div", __assign({ className: "bunny-flex bunny-flex-col bunny-w-3/5 bunny-mt-24" }, { children: jsx(PaymentForms, { quote: quote, handlePaymentSuccess: handlePaymentSuccess, handlePaymentFail: handlePaymentFail, handleSubmit: handleSubmit, proceedingToPayment: isSigningUp || isLoadingQuote, accountId: accountId, overrideToken: portalSessionToken, customCheckoutFunction: accountSignupFunction, defaultValues:
|
|
20796
|
-
firstName: defaultFirstName,
|
|
20797
|
-
lastName: defaultLastName,
|
|
20798
|
-
email: defaultEmail,
|
|
20799
|
-
accountName: defaultCompanyName,
|
|
20800
|
-
billingCountry: defaultBillingCountry,
|
|
20801
|
-
} }) }))) }))] })));
|
|
20799
|
+
} }, { children: isLoadingPriceList ? (jsx(Skeleton, { active: true, className: "bunny-flex bunny-flex-col bunny-w-3/5 bunny-mt-24" })) : (jsx("div", __assign({ className: "bunny-flex bunny-flex-col bunny-w-3/5 bunny-mt-24" }, { children: jsx(PaymentForms, { quote: quote, handlePaymentSuccess: handlePaymentSuccess, handlePaymentFail: handlePaymentFail, handleSubmit: handleSubmit, proceedingToPayment: isSigningUp || isLoadingQuote, accountId: accountId, overrideToken: portalSessionToken, customCheckoutFunction: accountSignupFunction, defaultValues: defaultValues }) }))) }))] })));
|
|
20802
20800
|
}
|
|
20803
20801
|
|
|
20804
|
-
var
|
|
20805
|
-
|
|
20806
|
-
|
|
20807
|
-
|
|
20808
|
-
|
|
20809
|
-
|
|
20810
|
-
|
|
20802
|
+
var SubscriptionsContext = createContext({});
|
|
20803
|
+
|
|
20804
|
+
var SUBSCRIPTIONS_QUERY = "\nquery subscriptions {\n subscriptions {\n nodes {\n addonSubscriptions {\n id\n plan { id }\n }\n cancellationDate\n currencyId\n endDate\n evergreen\n id\n period\n plan { id name selfServiceBuy selfServiceCancel selfServiceRenew }\n priceList {\n id\n periodMonths\n name\n plan {\n id\n addon\n addonPlans { id }\n }\n }\n product { id name showProductNameOnLineItem }\n startDate\n state\n trialEndDate\n trialPeriod\n trialStartDate\n account { id }\n daysLeftInTrial\n trialExpirationAction\n charges {\n priceListCharge {\n priceListChargeTiers {\n price\n starts\n }\n featureAddon\n id\n }\n amount\n billingPeriod\n chargeType\n discount\n discountedPrice\n endDate\n expired\n feature { name }\n id\n isAmendment\n isRamp\n kind\n name\n periodPrice\n price\n priceDecimals\n priceListChargeId\n priceTiers { starts price }\n pricingModel\n quantity\n selfServiceQuantity\n startDate\n trial\n }\n }\n }\n }";
|
|
20805
|
+
var getSubscriptions = function (_a) {
|
|
20806
|
+
var apiHost = _a.apiHost, isInPreviewMode = _a.isInPreviewMode, token = _a.token;
|
|
20807
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
20808
|
+
var response, combinedSubscriptions;
|
|
20809
|
+
var _b, _c;
|
|
20810
|
+
return __generator(this, function (_d) {
|
|
20811
|
+
switch (_d.label) {
|
|
20812
|
+
case 0: return [4 /*yield*/, gqlRequest({
|
|
20813
|
+
isInPreviewMode: isInPreviewMode,
|
|
20814
|
+
query: SUBSCRIPTIONS_QUERY,
|
|
20815
|
+
token: token,
|
|
20816
|
+
apiHost: apiHost,
|
|
20817
|
+
})];
|
|
20811
20818
|
case 1:
|
|
20812
|
-
|
|
20813
|
-
|
|
20819
|
+
response = _d.sent();
|
|
20820
|
+
combinedSubscriptions = (_c = (_b = response === null || response === void 0 ? void 0 : response.subscriptions) === null || _b === void 0 ? void 0 : _b.nodes) === null || _c === void 0 ? void 0 : _c.map(function (subscription) { return (__assign(__assign({}, subscription), { charges: sortSubscriptionCharges(subscription.charges) })); });
|
|
20821
|
+
return [2 /*return*/, combinedSubscriptions];
|
|
20814
20822
|
}
|
|
20815
20823
|
});
|
|
20816
|
-
});
|
|
20824
|
+
});
|
|
20825
|
+
};
|
|
20826
|
+
|
|
20827
|
+
var quoteSubscriptionUpgrade = function (_a) {
|
|
20828
|
+
var subscriptionId = _a.subscriptionId, priceListId = _a.priceListId, apiHost = _a.apiHost, token = _a.token;
|
|
20829
|
+
return gqlRequest({
|
|
20830
|
+
query: "mutation QuoteSubscriptionUpgrade($subscriptionId: ID!, $priceListId: ID!) {\n quoteSubscriptionUpgrade(\n subscriptionId: $subscriptionId\n priceListId: $priceListId\n ) {\n quote {\n id\n }\n }\n }",
|
|
20831
|
+
vars: { subscriptionId: subscriptionId, priceListId: priceListId },
|
|
20832
|
+
apiHost: apiHost,
|
|
20833
|
+
token: token,
|
|
20834
|
+
});
|
|
20817
20835
|
};
|
|
20818
20836
|
var useCreateSubscriptionQuote = function () {
|
|
20819
20837
|
var graphQLRequest = useGraphQLRequest();
|
|
@@ -20845,96 +20863,510 @@ var useQuoteChangeUpdate = function () {
|
|
|
20845
20863
|
});
|
|
20846
20864
|
}); };
|
|
20847
20865
|
};
|
|
20848
|
-
var
|
|
20849
|
-
var
|
|
20850
|
-
return
|
|
20851
|
-
|
|
20852
|
-
|
|
20853
|
-
|
|
20854
|
-
|
|
20855
|
-
|
|
20856
|
-
|
|
20857
|
-
|
|
20858
|
-
}
|
|
20859
|
-
});
|
|
20860
|
-
}); };
|
|
20861
|
-
};
|
|
20862
|
-
var useQuoteSubscriptionActivate = function () {
|
|
20863
|
-
var graphQLRequest = useGraphQLRequest();
|
|
20864
|
-
return function (subscriptionId, apiHost, token) { return __awaiter(void 0, void 0, void 0, function () {
|
|
20865
|
-
var response;
|
|
20866
|
-
return __generator(this, function (_a) {
|
|
20867
|
-
switch (_a.label) {
|
|
20868
|
-
case 0: return [4 /*yield*/, graphQLRequest("mutation QuoteSubscriptionActivate($subscriptionId: ID!) {\n quoteSubscriptionActivate(subscriptionId: $subscriptionId) {\n quote {\n id\n }\n }\n }", apiHost, token, { subscriptionId: subscriptionId })];
|
|
20869
|
-
case 1:
|
|
20870
|
-
response = _a.sent();
|
|
20871
|
-
return [2 /*return*/, response];
|
|
20872
|
-
}
|
|
20873
|
-
});
|
|
20874
|
-
}); };
|
|
20875
|
-
};
|
|
20876
|
-
|
|
20877
|
-
var SUBSCRIPTIONS_QUERY = "\nquery subscriptions {\n subscriptions {\n nodes {\n cancellationDate\n currencyId\n endDate\n evergreen\n id\n period\n plan { id name selfServiceBuy selfServiceCancel selfServiceRenew }\n priceList { id periodMonths }\n product { id name showProductNameOnLineItem }\n startDate\n state\n trialEndDate\n trialPeriod\n trialStartDate\n daysLeftInTrial\n trialExpirationAction\n charges {\n priceListCharge {\n priceListChargeTiers {\n price\n starts\n }\n featureAddon\n id\n }\n amount\n billingPeriod\n chargeType\n discount\n discountedPrice\n endDate\n expired\n feature { name }\n id\n isAmendment\n isRamp\n kind\n name\n periodPrice\n price\n priceDecimals\n priceListChargeId\n priceTiers { starts price }\n pricingModel\n quantity\n selfServiceQuantity\n startDate\n trial\n }\n }\n }\n }";
|
|
20878
|
-
var getSubscriptions = function (_a) {
|
|
20879
|
-
var apiHost = _a.apiHost, isInPreviewMode = _a.isInPreviewMode, token = _a.token;
|
|
20880
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
20881
|
-
var response, combinedSubscriptions;
|
|
20882
|
-
var _b, _c;
|
|
20883
|
-
return __generator(this, function (_d) {
|
|
20884
|
-
switch (_d.label) {
|
|
20885
|
-
case 0: return [4 /*yield*/, gqlRequest({
|
|
20886
|
-
isInPreviewMode: isInPreviewMode,
|
|
20887
|
-
query: SUBSCRIPTIONS_QUERY,
|
|
20888
|
-
token: token,
|
|
20889
|
-
apiHost: apiHost,
|
|
20890
|
-
})];
|
|
20891
|
-
case 1:
|
|
20892
|
-
response = _d.sent();
|
|
20893
|
-
combinedSubscriptions = (_c = (_b = response === null || response === void 0 ? void 0 : response.subscriptions) === null || _b === void 0 ? void 0 : _b.nodes) === null || _c === void 0 ? void 0 : _c.map(function (subscription) { return (__assign(__assign({}, subscription), { charges: sortSubscriptionCharges(subscription.charges) })); });
|
|
20894
|
-
return [2 /*return*/, combinedSubscriptions];
|
|
20895
|
-
}
|
|
20896
|
-
});
|
|
20897
|
-
});
|
|
20898
|
-
};
|
|
20899
|
-
|
|
20900
|
-
var pageWrapperClassName = function (isMobile) {
|
|
20901
|
-
return "flex flex-col grow pt-4 ".concat(isMobile ? 'pb-4 overflow-hidden' : 'pb-8', " ").concat('content-container');
|
|
20902
|
-
};
|
|
20903
|
-
|
|
20904
|
-
var MUTATION$2 = "{\n currentUser {\n taxationRequiredAccountFields\n }\n}";
|
|
20905
|
-
var getTaxationRequiredAccountFields = function (_a) {
|
|
20906
|
-
var apiHost = _a.apiHost, token = _a.token;
|
|
20907
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
20908
|
-
var response;
|
|
20909
|
-
var _b, _c;
|
|
20910
|
-
return __generator(this, function (_d) {
|
|
20911
|
-
switch (_d.label) {
|
|
20912
|
-
case 0: return [4 /*yield*/, gqlRequest({
|
|
20913
|
-
query: MUTATION$2,
|
|
20914
|
-
token: token,
|
|
20915
|
-
apiHost: apiHost,
|
|
20916
|
-
})];
|
|
20917
|
-
case 1:
|
|
20918
|
-
response = _d.sent();
|
|
20919
|
-
return [2 /*return*/, ((_c = (_b = response === null || response === void 0 ? void 0 : response.currentUser) === null || _b === void 0 ? void 0 : _b.taxationRequiredAccountFields) === null || _c === void 0 ? void 0 : _c.length) > 0
|
|
20920
|
-
? response.currentUser.taxationRequiredAccountFields
|
|
20921
|
-
: null];
|
|
20922
|
-
}
|
|
20923
|
-
});
|
|
20866
|
+
var quoteSubscriptionAddon = function (_a) {
|
|
20867
|
+
var subscriptionId = _a.subscriptionId, priceListId = _a.priceListId, apiHost = _a.apiHost, token = _a.token;
|
|
20868
|
+
return gqlRequest({
|
|
20869
|
+
query: "mutation QuoteSubscriptionAddon($subscriptionId: ID!, $priceListId: ID) {\n quoteSubscriptionAddon(subscriptionId: $subscriptionId, priceListId: $priceListId) {\n errors\n quote {\n id\n }\n }\n }",
|
|
20870
|
+
vars: {
|
|
20871
|
+
subscriptionId: subscriptionId,
|
|
20872
|
+
priceListId: priceListId,
|
|
20873
|
+
},
|
|
20874
|
+
apiHost: apiHost,
|
|
20875
|
+
token: token,
|
|
20924
20876
|
});
|
|
20925
20877
|
};
|
|
20926
|
-
|
|
20927
|
-
var
|
|
20928
|
-
|
|
20929
|
-
|
|
20878
|
+
var quoteSubscriptionActivate = function (_a) {
|
|
20879
|
+
var subscriptionId = _a.subscriptionId, apiHost = _a.apiHost, token = _a.token;
|
|
20880
|
+
return gqlRequest({
|
|
20881
|
+
query: "mutation QuoteSubscriptionActivate($subscriptionId: ID!) {\n quoteSubscriptionActivate(subscriptionId: $subscriptionId) {\n quote {\n id\n }\n }\n }",
|
|
20882
|
+
vars: {
|
|
20883
|
+
subscriptionId: subscriptionId,
|
|
20884
|
+
},
|
|
20930
20885
|
apiHost: apiHost,
|
|
20931
20886
|
token: token,
|
|
20932
|
-
})
|
|
20933
|
-
return Boolean(plugins === null || plugins === void 0 ? void 0 : plugins.some(function (plugin) { return plugin.type === "taxation"; }));
|
|
20887
|
+
});
|
|
20934
20888
|
};
|
|
20935
20889
|
|
|
20936
|
-
var
|
|
20937
|
-
var
|
|
20890
|
+
var useQuoteCreate = function (_a) {
|
|
20891
|
+
var upgradingSubscription = _a.upgradingSubscription, selectedPriceList = _a.selectedPriceList, token = _a.token;
|
|
20892
|
+
// Context
|
|
20893
|
+
var apiHost = useContext(BunnyContext).apiHost;
|
|
20894
|
+
// Local state
|
|
20895
|
+
var _b = useState(), quoteId = _b[0], setQuoteId = _b[1];
|
|
20896
|
+
// Queries
|
|
20897
|
+
var quote = useQuery({
|
|
20898
|
+
queryKey: QueryKeyFactory.default.createObjectKey({
|
|
20899
|
+
objectName: 'editingQuote',
|
|
20900
|
+
id: quoteId,
|
|
20901
|
+
token: token,
|
|
20902
|
+
}),
|
|
20903
|
+
queryFn: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
20904
|
+
var quote;
|
|
20905
|
+
return __generator(this, function (_a) {
|
|
20906
|
+
switch (_a.label) {
|
|
20907
|
+
case 0:
|
|
20908
|
+
if (!quoteId) {
|
|
20909
|
+
throw new Error('editingQuote is undefined');
|
|
20910
|
+
}
|
|
20911
|
+
return [4 /*yield*/, getQuote({
|
|
20912
|
+
id: quoteId,
|
|
20913
|
+
token: token,
|
|
20914
|
+
apiHost: apiHost,
|
|
20915
|
+
removeFormattedQuoteField: false,
|
|
20916
|
+
})];
|
|
20917
|
+
case 1:
|
|
20918
|
+
quote = _a.sent();
|
|
20919
|
+
return [2 /*return*/, quote];
|
|
20920
|
+
}
|
|
20921
|
+
});
|
|
20922
|
+
}); },
|
|
20923
|
+
enabled: Boolean(quoteId),
|
|
20924
|
+
}).data;
|
|
20925
|
+
var _c = useMutation({
|
|
20926
|
+
mutationFn: function (_a) {
|
|
20927
|
+
var subscriptionId = _a.subscriptionId, priceListId = _a.priceListId;
|
|
20928
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
20929
|
+
return __generator(this, function (_b) {
|
|
20930
|
+
switch (_b.label) {
|
|
20931
|
+
case 0: return [4 /*yield*/, quoteSubscriptionUpgrade({ subscriptionId: subscriptionId, priceListId: priceListId, apiHost: apiHost, token: token })];
|
|
20932
|
+
case 1: return [2 /*return*/, _b.sent()];
|
|
20933
|
+
}
|
|
20934
|
+
});
|
|
20935
|
+
});
|
|
20936
|
+
},
|
|
20937
|
+
onSuccess: function (subscriptionUpdateData) {
|
|
20938
|
+
var _a;
|
|
20939
|
+
var quote = (_a = subscriptionUpdateData === null || subscriptionUpdateData === void 0 ? void 0 : subscriptionUpdateData.quoteSubscriptionUpgrade) === null || _a === void 0 ? void 0 : _a.quote;
|
|
20940
|
+
setQuoteId(quote.id);
|
|
20941
|
+
},
|
|
20942
|
+
}), createQuote = _c.mutate, isCreatingQuote = _c.isPending;
|
|
20943
|
+
var _d = useMutation({
|
|
20944
|
+
mutationFn: function (_a) {
|
|
20945
|
+
var subscriptionId = _a.subscriptionId;
|
|
20946
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
20947
|
+
return __generator(this, function (_b) {
|
|
20948
|
+
switch (_b.label) {
|
|
20949
|
+
case 0: return [4 /*yield*/, quoteSubscriptionAddon({ subscriptionId: subscriptionId, apiHost: apiHost, token: token })];
|
|
20950
|
+
case 1: return [2 /*return*/, _b.sent()];
|
|
20951
|
+
}
|
|
20952
|
+
});
|
|
20953
|
+
});
|
|
20954
|
+
},
|
|
20955
|
+
onSuccess: function (subscriptionAddonUpdateData) {
|
|
20956
|
+
var _a;
|
|
20957
|
+
var quote = (_a = subscriptionAddonUpdateData === null || subscriptionAddonUpdateData === void 0 ? void 0 : subscriptionAddonUpdateData.quoteSubscriptionAddon) === null || _a === void 0 ? void 0 : _a.quote;
|
|
20958
|
+
setQuoteId(quote.id);
|
|
20959
|
+
},
|
|
20960
|
+
}), createEmptyQuote = _d.mutate, isCreatingEmptyQuote = _d.isPending;
|
|
20961
|
+
var subscriptionActivate = useMutation({
|
|
20962
|
+
mutationFn: quoteSubscriptionActivate,
|
|
20963
|
+
onSuccess: function (response) {
|
|
20964
|
+
var _a;
|
|
20965
|
+
var quote = (_a = response === null || response === void 0 ? void 0 : response.quoteSubscriptionActivate) === null || _a === void 0 ? void 0 : _a.quote;
|
|
20966
|
+
setQuoteId(quote.id);
|
|
20967
|
+
},
|
|
20968
|
+
}).mutate;
|
|
20969
|
+
useEffect(function () {
|
|
20970
|
+
var _a;
|
|
20971
|
+
if (!(upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id)) {
|
|
20972
|
+
return;
|
|
20973
|
+
}
|
|
20974
|
+
if (!(selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id)) {
|
|
20975
|
+
return;
|
|
20976
|
+
}
|
|
20977
|
+
var buyingAddonsForCurrentSubscription = (upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.priceList.id) === (selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id);
|
|
20978
|
+
var isActivatingTrialSubscription = ((_a = upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState$2.TRIAL &&
|
|
20979
|
+
upgradingSubscription.priceList.id === (selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id);
|
|
20980
|
+
if (isActivatingTrialSubscription) {
|
|
20981
|
+
subscriptionActivate({
|
|
20982
|
+
subscriptionId: upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id,
|
|
20983
|
+
apiHost: apiHost,
|
|
20984
|
+
token: token,
|
|
20985
|
+
});
|
|
20986
|
+
}
|
|
20987
|
+
else if (buyingAddonsForCurrentSubscription) {
|
|
20988
|
+
createEmptyQuote({
|
|
20989
|
+
subscriptionId: upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id,
|
|
20990
|
+
});
|
|
20991
|
+
}
|
|
20992
|
+
else {
|
|
20993
|
+
createQuote({
|
|
20994
|
+
subscriptionId: upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id,
|
|
20995
|
+
priceListId: selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id,
|
|
20996
|
+
});
|
|
20997
|
+
}
|
|
20998
|
+
}, [selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id, upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id, upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.priceList.id]);
|
|
20999
|
+
return { quote: quote, isQuotePending: isCreatingQuote || isCreatingEmptyQuote };
|
|
21000
|
+
};
|
|
21001
|
+
|
|
21002
|
+
var calculateNewQuantity = function (priceListCharge, currentQuantity) {
|
|
21003
|
+
if (currentQuantity === void 0) { currentQuantity = 1; }
|
|
21004
|
+
var quantityMax = (priceListCharge === null || priceListCharge === void 0 ? void 0 : priceListCharge.quantityMax) || Number.POSITIVE_INFINITY;
|
|
21005
|
+
var quantityMin = (priceListCharge === null || priceListCharge === void 0 ? void 0 : priceListCharge.quantityMin) || Number.NEGATIVE_INFINITY;
|
|
21006
|
+
var selfServiceQuantity = priceListCharge === null || priceListCharge === void 0 ? void 0 : priceListCharge.selfServiceQuantity;
|
|
21007
|
+
if (selfServiceQuantity) {
|
|
21008
|
+
return lodashExports.clamp(currentQuantity, quantityMin, quantityMax);
|
|
21009
|
+
}
|
|
21010
|
+
// If self service quantity is disabled, return the min quantity
|
|
21011
|
+
return quantityMin;
|
|
21012
|
+
};
|
|
21013
|
+
|
|
21014
|
+
var QUOTE_CHARGE_UPDATE = "\n".concat(QUOTE_FIELDS(), "\n mutation QuoteChargeUpdate (\n $discount: Float,\n $endDate: ISO8601Date,\n $name: String,\n $price: Float,\n $quantity: Int,\n $quoteChargeId: ID!\n $startDate: ISO8601Date\n $subtotal: Float,\n ) {\n quoteChargeUpdate(\n discount: $discount\n endDate: $endDate\n name: $name\n price: $price\n quantity: $quantity\n quoteChargeId: $quoteChargeId\n startDate: $startDate\n subtotal: $subtotal\n ) {\n quoteCharge {\n quoteChange {\n id\n quoteId\n quote {\n ...QuoteFields\n }\n }\n id\n }\n }\n }\n");
|
|
21015
|
+
var quoteChargeUpdate = function (_a) {
|
|
21016
|
+
var discount = _a.discount, name = _a.name, price = _a.price, quantity = _a.quantity, quoteChargeId = _a.quoteChargeId, startDate = _a.startDate, subtotal = _a.subtotal, apiHost = _a.apiHost, token = _a.token;
|
|
21017
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
21018
|
+
var response;
|
|
21019
|
+
return __generator(this, function (_b) {
|
|
21020
|
+
switch (_b.label) {
|
|
21021
|
+
case 0: return [4 /*yield*/, gqlRequest({
|
|
21022
|
+
query: QUOTE_CHARGE_UPDATE,
|
|
21023
|
+
vars: {
|
|
21024
|
+
subtotal: subtotal,
|
|
21025
|
+
discount: discount,
|
|
21026
|
+
name: name,
|
|
21027
|
+
price: price,
|
|
21028
|
+
quantity: quantity,
|
|
21029
|
+
quoteChargeId: quoteChargeId,
|
|
21030
|
+
startDate: startDate,
|
|
21031
|
+
},
|
|
21032
|
+
apiHost: apiHost,
|
|
21033
|
+
token: token,
|
|
21034
|
+
})];
|
|
21035
|
+
case 1:
|
|
21036
|
+
response = _b.sent();
|
|
21037
|
+
if (response.errors) {
|
|
21038
|
+
throw new Error(response.errors[0].message);
|
|
21039
|
+
}
|
|
21040
|
+
return [2 /*return*/, response.quoteChargeUpdate.quoteCharge];
|
|
21041
|
+
}
|
|
21042
|
+
});
|
|
21043
|
+
});
|
|
21044
|
+
};
|
|
21045
|
+
|
|
21046
|
+
function canEditChargeQuantity(charge) {
|
|
21047
|
+
if (charge.chargeType === ChargeType.USAGE)
|
|
21048
|
+
return false;
|
|
21049
|
+
if (charge.pricingModel === PricingModel.FLAT)
|
|
21050
|
+
return false;
|
|
21051
|
+
return true;
|
|
21052
|
+
}
|
|
21053
|
+
|
|
21054
|
+
// Functionality:
|
|
21055
|
+
// 1: keep track of quantities set for features based on feature.id
|
|
21056
|
+
// a. copy those quantities over to charges with same feature when initializing
|
|
21057
|
+
// ie: if set 5 for Users in Starter, then switching to Pro with Users, keep 5
|
|
21058
|
+
// 2. set initial quantities for features using the first feature quantity found
|
|
21059
|
+
// Limitations:
|
|
21060
|
+
// - When switching between price lists that share features (e.g. both have Users),
|
|
21061
|
+
// quantities will be adjusted to meet the new min/max requirements of the new price list.
|
|
21062
|
+
// The original quantity is not preserved when switching back to the previous price list.
|
|
21063
|
+
var showErrorNotification$1 = useErrorNotification();
|
|
21064
|
+
var useQuoteQuantities = function (_a) {
|
|
21065
|
+
var selectedPriceList = _a.selectedPriceList, quote = _a.quote;
|
|
21066
|
+
var queryClient = useQueryClient();
|
|
21067
|
+
var token = useToken();
|
|
21068
|
+
var apiHost = useContext(BunnyContext).apiHost;
|
|
21069
|
+
var _b = useFeatureQuantities(), getFeatureQuantity = _b.getFeatureQuantity, setFeatureQuantity = _b.setFeatureQuantity;
|
|
21070
|
+
var _c = useMutation({
|
|
21071
|
+
mutationFn: function (_a) {
|
|
21072
|
+
var quoteChargeId = _a.quoteChargeId, quantity = _a.quantity, apiHost = _a.apiHost, token = _a.token;
|
|
21073
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
21074
|
+
var quoteCharge;
|
|
21075
|
+
return __generator(this, function (_b) {
|
|
21076
|
+
switch (_b.label) {
|
|
21077
|
+
case 0: return [4 /*yield*/, quoteChargeUpdate({
|
|
21078
|
+
quoteChargeId: quoteChargeId,
|
|
21079
|
+
quantity: quantity,
|
|
21080
|
+
apiHost: apiHost,
|
|
21081
|
+
token: token,
|
|
21082
|
+
})];
|
|
21083
|
+
case 1:
|
|
21084
|
+
quoteCharge = _b.sent();
|
|
21085
|
+
return [2 /*return*/, { quoteCharge: quoteCharge }];
|
|
21086
|
+
}
|
|
21087
|
+
});
|
|
21088
|
+
});
|
|
21089
|
+
},
|
|
21090
|
+
onSuccess: function (_a) {
|
|
21091
|
+
var quoteCharge = _a.quoteCharge;
|
|
21092
|
+
queryClient.setQueryData(QueryKeyFactory.default.createObjectKey({
|
|
21093
|
+
objectName: 'editingQuote',
|
|
21094
|
+
id: quote === null || quote === void 0 ? void 0 : quote.id,
|
|
21095
|
+
token: token,
|
|
21096
|
+
}), quoteCharge.quoteChange.quote);
|
|
21097
|
+
},
|
|
21098
|
+
}), updateCharge = _c.mutate, isUpdatingCharge = _c.isPending;
|
|
21099
|
+
var handleUpdateQuantity = useCallback(function (quantity, priceListChargeId, quote) {
|
|
21100
|
+
var quoteChange = quote === null || quote === void 0 ? void 0 : quote.quoteChanges.find(function (qc) { return qc.priceList.id === (selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id); });
|
|
21101
|
+
var quoteCharge = quoteChange === null || quoteChange === void 0 ? void 0 : quoteChange.charges.find(function (charge) {
|
|
21102
|
+
var _a;
|
|
21103
|
+
return ((_a = charge === null || charge === void 0 ? void 0 : charge.priceListCharge) === null || _a === void 0 ? void 0 : _a.id) === priceListChargeId;
|
|
21104
|
+
});
|
|
21105
|
+
if (!token) {
|
|
21106
|
+
showErrorNotification$1('Token is undefined in onUpdateQuantity');
|
|
21107
|
+
return;
|
|
21108
|
+
}
|
|
21109
|
+
if (!quoteCharge) {
|
|
21110
|
+
showErrorNotification$1('Quote charge not found');
|
|
21111
|
+
return;
|
|
21112
|
+
}
|
|
21113
|
+
updateCharge({
|
|
21114
|
+
quoteChargeId: quoteCharge.id,
|
|
21115
|
+
quantity: quantity,
|
|
21116
|
+
apiHost: apiHost,
|
|
21117
|
+
token: token,
|
|
21118
|
+
});
|
|
21119
|
+
}, [apiHost, token, updateCharge, selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id, quote === null || quote === void 0 ? void 0 : quote.id]);
|
|
21120
|
+
// Helper function to get quantity from quote for a specific charge
|
|
21121
|
+
var getQuantityFromQuote = function (chargeId) {
|
|
21122
|
+
var _a, _b;
|
|
21123
|
+
if (!quote || !selectedPriceList)
|
|
21124
|
+
return undefined;
|
|
21125
|
+
return (_b = (_a = quote.quoteChanges
|
|
21126
|
+
.find(function (qc) { return qc.priceList.id === selectedPriceList.id; })) === null || _a === void 0 ? void 0 : _a.charges.find(function (c) { return c.priceListCharge.id === chargeId; })) === null || _b === void 0 ? void 0 : _b.quantity;
|
|
21127
|
+
};
|
|
21128
|
+
// Helper function to process a single charge
|
|
21129
|
+
var processCharge = function (charge) {
|
|
21130
|
+
var _a;
|
|
21131
|
+
if (!((_a = charge === null || charge === void 0 ? void 0 : charge.feature) === null || _a === void 0 ? void 0 : _a.id)) {
|
|
21132
|
+
showErrorNotification$1('Charge or feature is undefined', 'Client Error');
|
|
21133
|
+
return;
|
|
21134
|
+
}
|
|
21135
|
+
var storedQuantity = getFeatureQuantity(charge.feature.id);
|
|
21136
|
+
// Determine the quantity to use
|
|
21137
|
+
if (storedQuantity !== undefined) {
|
|
21138
|
+
// Store this quantity for this feature to ensure it's tracked
|
|
21139
|
+
setFeatureQuantity(charge.feature.id, storedQuantity);
|
|
21140
|
+
return storedQuantity;
|
|
21141
|
+
}
|
|
21142
|
+
else {
|
|
21143
|
+
var finalQuantity = calculateNewQuantity(charge, storedQuantity);
|
|
21144
|
+
setFeatureQuantity(charge.feature.id, finalQuantity);
|
|
21145
|
+
return finalQuantity;
|
|
21146
|
+
}
|
|
21147
|
+
};
|
|
21148
|
+
function handleChangeQuantity(priceListChargeId, quantity) {
|
|
21149
|
+
var _a;
|
|
21150
|
+
var charge = selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.charges.find(function (charge) { return charge.id === priceListChargeId; });
|
|
21151
|
+
var featureId = (_a = charge === null || charge === void 0 ? void 0 : charge.feature) === null || _a === void 0 ? void 0 : _a.id;
|
|
21152
|
+
if (!featureId) {
|
|
21153
|
+
showErrorNotification$1('featureId not found');
|
|
21154
|
+
return;
|
|
21155
|
+
}
|
|
21156
|
+
if (!quote) {
|
|
21157
|
+
showErrorNotification$1('quote not found');
|
|
21158
|
+
return;
|
|
21159
|
+
}
|
|
21160
|
+
setFeatureQuantity(featureId, quantity);
|
|
21161
|
+
handleUpdateQuantity(quantity, priceListChargeId, quote);
|
|
21162
|
+
}
|
|
21163
|
+
// Initialize quantities when price list changes
|
|
21164
|
+
useEffect(function () {
|
|
21165
|
+
if (!selectedPriceList)
|
|
21166
|
+
return;
|
|
21167
|
+
selectedPriceList.charges.forEach(function (charge) {
|
|
21168
|
+
if (canEditChargeQuantity(charge)) {
|
|
21169
|
+
processCharge(charge);
|
|
21170
|
+
}
|
|
21171
|
+
});
|
|
21172
|
+
}, [selectedPriceList]);
|
|
21173
|
+
// Update quantities when quote changes if local and quote quantities don't match
|
|
21174
|
+
useEffect(function () {
|
|
21175
|
+
if (!quote || !selectedPriceList)
|
|
21176
|
+
return;
|
|
21177
|
+
selectedPriceList.charges.forEach(function (charge) {
|
|
21178
|
+
if (!canEditChargeQuantity(charge))
|
|
21179
|
+
return;
|
|
21180
|
+
var finalQuantity = processCharge(charge);
|
|
21181
|
+
var quantityOnQuote = getQuantityFromQuote(charge.id);
|
|
21182
|
+
// Update quote if needed
|
|
21183
|
+
if (finalQuantity && quantityOnQuote && finalQuantity !== quantityOnQuote) {
|
|
21184
|
+
handleUpdateQuantity(finalQuantity, charge.id, quote);
|
|
21185
|
+
}
|
|
21186
|
+
});
|
|
21187
|
+
}, [quote === null || quote === void 0 ? void 0 : quote.id]);
|
|
21188
|
+
return {
|
|
21189
|
+
onChangeQuantity: handleChangeQuantity,
|
|
21190
|
+
getFeatureQuantity: getFeatureQuantity,
|
|
21191
|
+
isUpdatingCharges: isUpdatingCharge, // Might be multiple charges updating at once
|
|
21192
|
+
};
|
|
21193
|
+
};
|
|
21194
|
+
var useFeatureQuantities = function () {
|
|
21195
|
+
var _a = useState({}), featureQuantities = _a[0], setFeatureQuantities = _a[1];
|
|
21196
|
+
var getFeatureQuantity = function (featureId) {
|
|
21197
|
+
return featureQuantities[featureId];
|
|
21198
|
+
};
|
|
21199
|
+
var setFeatureQuantity = function (featureId, quantity) {
|
|
21200
|
+
setFeatureQuantities(function (prev) {
|
|
21201
|
+
var _a;
|
|
21202
|
+
return (__assign(__assign({}, prev), (_a = {}, _a[featureId] = quantity, _a)));
|
|
21203
|
+
});
|
|
21204
|
+
};
|
|
21205
|
+
return {
|
|
21206
|
+
getFeatureQuantity: getFeatureQuantity,
|
|
21207
|
+
setFeatureQuantity: setFeatureQuantity,
|
|
21208
|
+
};
|
|
21209
|
+
};
|
|
21210
|
+
|
|
21211
|
+
var QuoteContext = createContext({});
|
|
21212
|
+
function useFeatureAddonsPending() {
|
|
21213
|
+
var _a = useState([]), featureAddonsLoading = _a[0], setFeatureAddonsLoading = _a[1];
|
|
21214
|
+
var addFeatureAddonLoading = function (featureAddonId) {
|
|
21215
|
+
setFeatureAddonsLoading(__spreadArray(__spreadArray([], featureAddonsLoading, true), [featureAddonId], false));
|
|
21216
|
+
};
|
|
21217
|
+
var removeFeatureAddonLoading = function (featureAddonId) {
|
|
21218
|
+
setFeatureAddonsLoading(featureAddonsLoading.filter(function (id) { return id !== featureAddonId; }));
|
|
21219
|
+
};
|
|
21220
|
+
return {
|
|
21221
|
+
isFeatureAddonsLoading: featureAddonsLoading.length > 0,
|
|
21222
|
+
addFeatureAddonLoading: addFeatureAddonLoading,
|
|
21223
|
+
removeFeatureAddonLoading: removeFeatureAddonLoading,
|
|
21224
|
+
};
|
|
21225
|
+
}
|
|
21226
|
+
function QuoteProvider(_a) {
|
|
21227
|
+
var children = _a.children;
|
|
21228
|
+
// Contexts
|
|
21229
|
+
var upgradingSubscription = useContext(SubscriptionsContext).upgradingSubscription;
|
|
21230
|
+
// Local state
|
|
21231
|
+
var _b = useState(), selectedPriceList = _b[0], setSelectedPriceList = _b[1];
|
|
21232
|
+
var _c = useState(false), isAddonPlanLoading = _c[0], setIsAddonPlanLoading = _c[1];
|
|
21233
|
+
// Hooks
|
|
21234
|
+
var token = useToken();
|
|
21235
|
+
var _d = useFeatureAddonsPending(), isFeatureAddonsLoading = _d.isFeatureAddonsLoading, addFeatureAddonLoading = _d.addFeatureAddonLoading, removeFeatureAddonLoading = _d.removeFeatureAddonLoading;
|
|
21236
|
+
var _e = useQuoteCreate({
|
|
21237
|
+
upgradingSubscription: upgradingSubscription,
|
|
21238
|
+
selectedPriceList: selectedPriceList,
|
|
21239
|
+
token: token,
|
|
21240
|
+
}), quote = _e.quote, isQuotePending = _e.isQuotePending;
|
|
21241
|
+
var _f = useQuoteQuantities({
|
|
21242
|
+
selectedPriceList: selectedPriceList,
|
|
21243
|
+
quote: quote,
|
|
21244
|
+
}), onChangeQuantity = _f.onChangeQuantity, getFeatureQuantity = _f.getFeatureQuantity, isUpdatingCharges = _f.isUpdatingCharges;
|
|
21245
|
+
// Handlers
|
|
21246
|
+
function handleClearQuote() {
|
|
21247
|
+
setSelectedPriceList(undefined);
|
|
21248
|
+
}
|
|
21249
|
+
function handleChangeSelectedPriceList(priceList) {
|
|
21250
|
+
setSelectedPriceList(priceList);
|
|
21251
|
+
}
|
|
21252
|
+
// Important that we keep track of all changes taking place so we can recalculate taxes after all changes are complete
|
|
21253
|
+
var isUpdatingQuote = isUpdatingCharges || isAddonPlanLoading || isFeatureAddonsLoading;
|
|
21254
|
+
return (jsx(QuoteContext.Provider, __assign({ value: {
|
|
21255
|
+
quote: quote,
|
|
21256
|
+
selectedPriceList: selectedPriceList,
|
|
21257
|
+
isQuotePending: isQuotePending,
|
|
21258
|
+
isUpdatingQuote: isUpdatingQuote,
|
|
21259
|
+
// Plan add-ons pending
|
|
21260
|
+
isAddonPlanLoading: isAddonPlanLoading,
|
|
21261
|
+
setIsAddonPlanLoading: setIsAddonPlanLoading,
|
|
21262
|
+
// Feature add-ons pending
|
|
21263
|
+
isFeatureAddonsLoading: isFeatureAddonsLoading,
|
|
21264
|
+
addFeatureAddonLoading: addFeatureAddonLoading,
|
|
21265
|
+
removeFeatureAddonLoading: removeFeatureAddonLoading,
|
|
21266
|
+
onClearQuote: handleClearQuote,
|
|
21267
|
+
onChangeSelectedPriceList: handleChangeSelectedPriceList,
|
|
21268
|
+
onChangeQuantity: onChangeQuantity,
|
|
21269
|
+
getFeatureQuantity: getFeatureQuantity,
|
|
21270
|
+
} }, { children: children })));
|
|
21271
|
+
}
|
|
21272
|
+
|
|
21273
|
+
var PageTitle = function (_a) {
|
|
21274
|
+
var onGoBack = _a.onGoBack, title = _a.title;
|
|
21275
|
+
var isMobile = useIsMobile();
|
|
21276
|
+
var secondaryColor = useContext(BrandContext).secondaryColor;
|
|
21277
|
+
return (jsxs("div", __assign({ className: "bunny-flex bunny-items-center bunny-gap-3 bunny-font-medium", style: {
|
|
21278
|
+
fontSize: "28px",
|
|
21279
|
+
paddingBottom: isMobile ? "22px" : "56px",
|
|
21280
|
+
color: secondaryColor,
|
|
21281
|
+
} }, { children: [onGoBack && (jsx(ArrowLeftOutlined, { onClick: onGoBack, style: {
|
|
21282
|
+
fontSize: "20px",
|
|
21283
|
+
cursor: "pointer",
|
|
21284
|
+
} })), title] })));
|
|
21285
|
+
};
|
|
21286
|
+
|
|
21287
|
+
function isAddonPurchased(featureAddon, currentSubscription) {
|
|
21288
|
+
var purchasedFeatureAddons = currentSubscription === null || currentSubscription === void 0 ? void 0 : currentSubscription.charges.filter(function (charge) { var _a; return (_a = charge.priceListCharge) === null || _a === void 0 ? void 0 : _a.featureAddon; });
|
|
21289
|
+
if (!purchasedFeatureAddons)
|
|
21290
|
+
return false;
|
|
21291
|
+
return purchasedFeatureAddons.some(function (addon) { var _a; return ((_a = addon.priceListCharge) === null || _a === void 0 ? void 0 : _a.id) === featureAddon.id; });
|
|
21292
|
+
}
|
|
21293
|
+
function hasUnpurchasedFeatureAddons(priceList, currentSubscription) {
|
|
21294
|
+
var featureAddons = priceList.charges.filter(function (charge) { return charge.featureAddon; });
|
|
21295
|
+
var purchasedFeatureAddons = currentSubscription === null || currentSubscription === void 0 ? void 0 : currentSubscription.charges.filter(function (charge) { var _a; return (_a = charge.priceListCharge) === null || _a === void 0 ? void 0 : _a.featureAddon; });
|
|
21296
|
+
var unpurchasedFeatureAddons = featureAddons.filter(function (charge) {
|
|
21297
|
+
return !(purchasedFeatureAddons === null || purchasedFeatureAddons === void 0 ? void 0 : purchasedFeatureAddons.some(function (purchasedCharge) { var _a; return ((_a = purchasedCharge.priceListCharge) === null || _a === void 0 ? void 0 : _a.id) === charge.id; }));
|
|
21298
|
+
});
|
|
21299
|
+
return unpurchasedFeatureAddons.length > 0;
|
|
21300
|
+
}
|
|
21301
|
+
function findQuoteChangeForFeatureAddon(quote) {
|
|
21302
|
+
return quote === null || quote === void 0 ? void 0 : quote.quoteChanges.find(function (qc) { return qc.kind === QuoteChangeKind.UPDATE || qc.kind === QuoteChangeKind.SUBSCRIBE; });
|
|
21303
|
+
}
|
|
21304
|
+
function featureAddonInQuote(selectedPriceList, priceListCharge, quote) {
|
|
21305
|
+
var quoteChange = quote === null || quote === void 0 ? void 0 : quote.quoteChanges.find(function (qc) { return qc.priceList.id === selectedPriceList.id; });
|
|
21306
|
+
if (!quoteChange)
|
|
21307
|
+
return false;
|
|
21308
|
+
return quoteChange.charges.some(function (c) { var _a; return ((_a = c.priceListCharge) === null || _a === void 0 ? void 0 : _a.id) === priceListCharge.id; });
|
|
21309
|
+
}
|
|
21310
|
+
// ID Cucumber will use to find the feature addon switch
|
|
21311
|
+
function featureAddonSwitchTestId(featureAddon) {
|
|
21312
|
+
var name = featureAddon.name.toLowerCase().replace(/ /g, '-');
|
|
21313
|
+
return "feature-addon-switch-".concat(name);
|
|
21314
|
+
}
|
|
21315
|
+
|
|
21316
|
+
var pageWrapperClassName = function (isMobile) {
|
|
21317
|
+
return "flex flex-col grow pt-4 ".concat(isMobile ? 'pb-4 overflow-hidden' : 'pb-8', " ").concat('content-container');
|
|
21318
|
+
};
|
|
21319
|
+
|
|
21320
|
+
var MUTATION$2 = "{\n currentUser {\n taxationRequiredAccountFields\n }\n}";
|
|
21321
|
+
var getTaxationRequiredAccountFields = function (_a) {
|
|
21322
|
+
var apiHost = _a.apiHost, token = _a.token;
|
|
21323
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
21324
|
+
var response;
|
|
21325
|
+
var _b, _c;
|
|
21326
|
+
return __generator(this, function (_d) {
|
|
21327
|
+
switch (_d.label) {
|
|
21328
|
+
case 0: return [4 /*yield*/, gqlRequest({
|
|
21329
|
+
query: MUTATION$2,
|
|
21330
|
+
token: token,
|
|
21331
|
+
apiHost: apiHost,
|
|
21332
|
+
})];
|
|
21333
|
+
case 1:
|
|
21334
|
+
response = _d.sent();
|
|
21335
|
+
return [2 /*return*/, ((_c = (_b = response === null || response === void 0 ? void 0 : response.currentUser) === null || _b === void 0 ? void 0 : _b.taxationRequiredAccountFields) === null || _c === void 0 ? void 0 : _c.length) > 0
|
|
21336
|
+
? response.currentUser.taxationRequiredAccountFields
|
|
21337
|
+
: null];
|
|
21338
|
+
}
|
|
21339
|
+
});
|
|
21340
|
+
});
|
|
21341
|
+
};
|
|
21342
|
+
|
|
21343
|
+
var useHasTaxPlugin = function (_a) {
|
|
21344
|
+
var apiHost = _a.apiHost, token = _a.token;
|
|
21345
|
+
var plugins = usePlugins({
|
|
21346
|
+
apiHost: apiHost,
|
|
21347
|
+
token: token,
|
|
21348
|
+
}).data;
|
|
21349
|
+
return Boolean(plugins === null || plugins === void 0 ? void 0 : plugins.some(function (plugin) { return plugin.type === "taxation"; }));
|
|
21350
|
+
};
|
|
21351
|
+
|
|
21352
|
+
function shouldShowCouponEditor(quote, activeCouponsExist, upgradingSubscription) {
|
|
21353
|
+
var _a;
|
|
21354
|
+
var upgradingFromTrial = ((_a = upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState$2.TRIAL;
|
|
21355
|
+
function upgradingFromFree() {
|
|
21356
|
+
var totalPrice = upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.charges.reduce(function (acc, charge) { return acc + Number((charge === null || charge === void 0 ? void 0 : charge.discountedPrice) || 0); }, 0);
|
|
21357
|
+
return totalPrice === 0;
|
|
21358
|
+
}
|
|
21359
|
+
var quoteKindIsValid = quote.kind === QuoteChangeKind.SUBSCRIBE ||
|
|
21360
|
+
quote.kind === QuoteChangeKind.ADJUSTMENT ||
|
|
21361
|
+
quote.kind === QuoteChangeKind.ACTIVATE;
|
|
21362
|
+
if (quoteKindIsValid) {
|
|
21363
|
+
return activeCouponsExist && (upgradingFromTrial || upgradingFromFree());
|
|
21364
|
+
}
|
|
21365
|
+
return false;
|
|
21366
|
+
}
|
|
21367
|
+
|
|
21368
|
+
var MUTATION$1 = "\nmutation accountUpdate(\n $id: ID!,\n $attributes: AccountAttributes!) {\n accountUpdate(\n id: $id,\n attributes: $attributes\n ) {\n account {\n id\n billingCountry\n billingState\n billingStreet\n billingCity\n billingZip\n name\n }\n errors\n }\n }\n";
|
|
21369
|
+
var accountUpdate = function (_a) {
|
|
20938
21370
|
var accountId = _a.accountId, attributes = _a.attributes, token = _a.token, apiHost = _a.apiHost;
|
|
20939
21371
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
20940
21372
|
var vars, response, errors;
|
|
@@ -21100,7 +21532,7 @@ var PaymentFormWrapper = function (_a) {
|
|
|
21100
21532
|
var queryKeyFactory = QueryKeyFactory.default;
|
|
21101
21533
|
var Checkout = function (_a) {
|
|
21102
21534
|
var _b, _c;
|
|
21103
|
-
var onCancel = _a.onCancel, onSuccess = _a.onSuccess, onFail = _a.onFail, invoice = _a.invoice, open = _a.open, quote = _a.quote,
|
|
21535
|
+
var onCancel = _a.onCancel, onSuccess = _a.onSuccess, onFail = _a.onFail, invoice = _a.invoice, open = _a.open, quote = _a.quote, isUpdatingQuote = _a.isUpdatingQuote;
|
|
21104
21536
|
var apiHost = useContext(BunnyContext).apiHost;
|
|
21105
21537
|
var isMobile = useIsMobile();
|
|
21106
21538
|
var token = useToken();
|
|
@@ -21126,7 +21558,7 @@ var Checkout = function (_a) {
|
|
|
21126
21558
|
}), account = _e.data, isLoadingAccount = _e.isLoading;
|
|
21127
21559
|
function recalculateTaxes() {
|
|
21128
21560
|
return __awaiter(this, void 0, void 0, function () {
|
|
21129
|
-
var updatedQuote, quoteKey
|
|
21561
|
+
var updatedQuote, quoteKey;
|
|
21130
21562
|
return __generator(this, function (_a) {
|
|
21131
21563
|
switch (_a.label) {
|
|
21132
21564
|
case 0:
|
|
@@ -21144,13 +21576,7 @@ var Checkout = function (_a) {
|
|
|
21144
21576
|
objectName: 'editingQuote',
|
|
21145
21577
|
token: token,
|
|
21146
21578
|
});
|
|
21147
|
-
calculatedPricesKey = queryKeyFactory.calculatedPricesKey({
|
|
21148
|
-
// quantity,
|
|
21149
|
-
priceListId: selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id,
|
|
21150
|
-
token: token,
|
|
21151
|
-
});
|
|
21152
21579
|
queryClient.setQueryData(quoteKey, updatedQuote);
|
|
21153
|
-
queryClient.setQueryData(calculatedPricesKey, updatedQuote);
|
|
21154
21580
|
}
|
|
21155
21581
|
_a.label = 2;
|
|
21156
21582
|
case 2: return [2 /*return*/, {}];
|
|
@@ -21162,7 +21588,8 @@ var Checkout = function (_a) {
|
|
|
21162
21588
|
open &&
|
|
21163
21589
|
hasTaxPlugin &&
|
|
21164
21590
|
!taxationRequiredAccountFields &&
|
|
21165
|
-
!isLoadingTaxationRequiredAccountFields
|
|
21591
|
+
!isLoadingTaxationRequiredAccountFields &&
|
|
21592
|
+
!isUpdatingQuote;
|
|
21166
21593
|
useQuery({
|
|
21167
21594
|
queryKey: queryKeyFactory.createQuoteTaxCalculateKey({
|
|
21168
21595
|
id: quote === null || quote === void 0 ? void 0 : quote.id,
|
|
@@ -21196,69 +21623,11 @@ var Checkout = function (_a) {
|
|
|
21196
21623
|
}, onPaymentSuccess: onSuccess }))] })), jsx(Footer, { className: "bunny-pl-12" })] })) })));
|
|
21197
21624
|
};
|
|
21198
21625
|
|
|
21199
|
-
var QuotePreviewContext = createContext({});
|
|
21200
|
-
function QuotePreviewProvider(_a) {
|
|
21201
|
-
var children = _a.children;
|
|
21202
|
-
var _b = useState(), quotePreviewData = _b[0], setQuotePreviewData = _b[1];
|
|
21203
|
-
function handleSetEditingQuote(editingQuoteId) {
|
|
21204
|
-
setQuotePreviewData(__assign(__assign({}, quotePreviewData), { editingQuoteId: editingQuoteId }));
|
|
21205
|
-
}
|
|
21206
|
-
return (jsx(QuotePreviewContext.Provider, __assign({ value: {
|
|
21207
|
-
quotePreviewData: quotePreviewData,
|
|
21208
|
-
setQuotePreviewData: setQuotePreviewData,
|
|
21209
|
-
handleSetEditingQuote: handleSetEditingQuote,
|
|
21210
|
-
} }, { children: children })));
|
|
21211
|
-
}
|
|
21212
|
-
|
|
21213
|
-
var PageTitle = function (_a) {
|
|
21214
|
-
var onGoBack = _a.onGoBack, title = _a.title;
|
|
21215
|
-
var isMobile = useIsMobile();
|
|
21216
|
-
var secondaryColor = useContext(BrandContext).secondaryColor;
|
|
21217
|
-
return (jsxs("div", __assign({ className: "bunny-flex bunny-items-center bunny-gap-3 bunny-font-medium", style: {
|
|
21218
|
-
fontSize: "28px",
|
|
21219
|
-
paddingBottom: isMobile ? "22px" : "56px",
|
|
21220
|
-
color: secondaryColor,
|
|
21221
|
-
} }, { children: [onGoBack && (jsx(ArrowLeftOutlined, { onClick: onGoBack, style: {
|
|
21222
|
-
fontSize: "20px",
|
|
21223
|
-
cursor: "pointer",
|
|
21224
|
-
} })), title] })));
|
|
21225
|
-
};
|
|
21226
|
-
|
|
21227
|
-
var QUOTE_CHARGE_UPDATE = "\n mutation QuoteChargeUpdate (\n $discount: Float,\n $endDate: ISO8601Date,\n $name: String,\n $price: Float,\n $quantity: Int,\n $quoteChargeId: ID!\n $startDate: ISO8601Date\n $subtotal: Float,\n ) {\n quoteChargeUpdate(\n discount: $discount\n endDate: $endDate\n name: $name\n price: $price\n quantity: $quantity\n quoteChargeId: $quoteChargeId\n startDate: $startDate\n subtotal: $subtotal\n ) {\n quoteCharge {\n id\n }\n }\n }\n";
|
|
21228
|
-
var quoteChargeUpdate = function (_a) {
|
|
21229
|
-
var discount = _a.discount, name = _a.name, price = _a.price, quantity = _a.quantity, quoteChargeId = _a.quoteChargeId, startDate = _a.startDate, subtotal = _a.subtotal, apiHost = _a.apiHost, token = _a.token;
|
|
21230
|
-
return gqlRequest({
|
|
21231
|
-
query: QUOTE_CHARGE_UPDATE,
|
|
21232
|
-
vars: {
|
|
21233
|
-
subtotal: subtotal,
|
|
21234
|
-
discount: discount,
|
|
21235
|
-
name: name,
|
|
21236
|
-
price: price,
|
|
21237
|
-
quantity: quantity,
|
|
21238
|
-
quoteChargeId: quoteChargeId,
|
|
21239
|
-
startDate: startDate,
|
|
21240
|
-
},
|
|
21241
|
-
apiHost: apiHost,
|
|
21242
|
-
token: token,
|
|
21243
|
-
});
|
|
21244
|
-
};
|
|
21245
|
-
|
|
21246
21626
|
var CheckoutBarInput = function (_a) {
|
|
21247
|
-
var
|
|
21248
|
-
|
|
21249
|
-
var
|
|
21250
|
-
var _c = useState(0), quantityLocal = _c[0], setQuantityLocal = _c[1];
|
|
21251
|
-
// Hooks
|
|
21627
|
+
var _b;
|
|
21628
|
+
var disabled = _a.disabled, charge = _a.charge, quantity = _a.quantity, onQuantityChanged = _a.onQuantityChanged;
|
|
21629
|
+
var _c = useState(false), isTooltipOpen = _c[0], setIsTooltipOpen = _c[1];
|
|
21252
21630
|
var isMobile = useIsMobile();
|
|
21253
|
-
var quoteChangeDebounce = useCallback(lodashExports.debounce(function (newQuantity) { return __awaiter(void 0, void 0, void 0, function () {
|
|
21254
|
-
return __generator(this, function (_a) {
|
|
21255
|
-
onQuantityChanged(newQuantity);
|
|
21256
|
-
return [2 /*return*/];
|
|
21257
|
-
});
|
|
21258
|
-
}); }, 1000), []);
|
|
21259
|
-
useEffect(function () {
|
|
21260
|
-
setQuantityLocal(quantity);
|
|
21261
|
-
}, [quantity]);
|
|
21262
21631
|
useEffect(function () {
|
|
21263
21632
|
setTimeout(function () {
|
|
21264
21633
|
setIsTooltipOpen(true);
|
|
@@ -21267,18 +21636,14 @@ var CheckoutBarInput = function (_a) {
|
|
|
21267
21636
|
setIsTooltipOpen(false);
|
|
21268
21637
|
}, 6000);
|
|
21269
21638
|
}, []);
|
|
21270
|
-
|
|
21271
|
-
return null;
|
|
21272
|
-
return (jsxs("div", __assign({ className: "bunny-flex bunny-items-center bunny-gap-2 ".concat(isMobile ? "bunny-justify-between" : "") }, { children: [jsx(QuantityLabel, { activeCharge: charge }), jsx(Tooltip, __assign({ onOpenChange: setIsTooltipOpen, open: isTooltipOpen, title: "Change quantity here", styles: {
|
|
21639
|
+
return (jsxs("div", __assign({ className: "bunny-flex bunny-items-center bunny-gap-2 ".concat(isMobile ? 'bunny-justify-between' : '') }, { children: [jsx(QuantityLabel, { activeCharge: charge }), jsx(Tooltip, __assign({ onOpenChange: setIsTooltipOpen, open: isTooltipOpen, title: "Change quantity here", styles: {
|
|
21273
21640
|
body: {
|
|
21274
|
-
paddingTop:
|
|
21275
|
-
paddingBottom:
|
|
21641
|
+
paddingTop: '0.75rem',
|
|
21642
|
+
paddingBottom: '0.75rem',
|
|
21276
21643
|
},
|
|
21277
|
-
} }, { children: jsx(Input, { className: isMobile ?
|
|
21278
|
-
|
|
21279
|
-
|
|
21280
|
-
quoteChangeDebounce(quantity);
|
|
21281
|
-
}, min: charge === null || charge === void 0 ? void 0 : charge.quantityMin, max: charge === null || charge === void 0 ? void 0 : charge.quantityMax, style: { minWidth: "120px" }, type: "number", value: quantityLocal, required: true }) }))] })));
|
|
21644
|
+
} }, { children: jsx(Input, { id: "".concat((_b = charge.name) === null || _b === void 0 ? void 0 : _b.toLowerCase().replace(/ /g, '-'), "-quantity-input"), className: isMobile ? 'text-right' : '', disabled: disabled, onChange: function (e) {
|
|
21645
|
+
onQuantityChanged(Number(e.target.value));
|
|
21646
|
+
}, min: charge === null || charge === void 0 ? void 0 : charge.quantityMin, max: charge === null || charge === void 0 ? void 0 : charge.quantityMax, style: { minWidth: '120px' }, type: "number", value: quantity, required: true }) }))] })));
|
|
21282
21647
|
};
|
|
21283
21648
|
var QuantityLabel = function (_a) {
|
|
21284
21649
|
var _b;
|
|
@@ -21286,8 +21651,8 @@ var QuantityLabel = function (_a) {
|
|
|
21286
21651
|
var featureName = (_b = activeCharge.feature) === null || _b === void 0 ? void 0 : _b.name;
|
|
21287
21652
|
var pluralizedFeatureName = (StringUtils.isStringPluralized(featureName) || !featureName
|
|
21288
21653
|
? featureName
|
|
21289
|
-
: StringUtils.pluralizeEntityName(featureName)) ||
|
|
21290
|
-
return (jsx("span", __assign({ className: "bunny-text-slate-500 bunny-font-medium", style: { fontSize:
|
|
21654
|
+
: StringUtils.pluralizeEntityName(featureName)) || '';
|
|
21655
|
+
return (jsx("span", __assign({ className: "bunny-text-slate-500 bunny-font-medium", style: { fontSize: '11px' } }, { children: pluralizedFeatureName.toUpperCase() })));
|
|
21291
21656
|
};
|
|
21292
21657
|
|
|
21293
21658
|
var periodMonthsConverter = function (period) {
|
|
@@ -21332,7 +21697,10 @@ var canShowQuantitiesInput = function (charge, subscription) {
|
|
|
21332
21697
|
return shouldProcessCharge;
|
|
21333
21698
|
};
|
|
21334
21699
|
var createQuoteParams = function (quote, subscriptionQuantity, editedSubscription) {
|
|
21335
|
-
|
|
21700
|
+
if (!editedSubscription || editedSubscription.quantity === undefined) {
|
|
21701
|
+
return { charges: [], quoteChange: undefined };
|
|
21702
|
+
}
|
|
21703
|
+
var quoteChange = quote.quoteChanges.find(function (quoteChange) { return quoteChange.priceList.id === editedSubscription.subscription.priceList.id; });
|
|
21336
21704
|
var quoteChangeCharge = quoteChange === null || quoteChange === void 0 ? void 0 : quoteChange.charges.find(function (charge) { return charge.priceListCharge.id === editedSubscription.chargeId; });
|
|
21337
21705
|
var charges = [
|
|
21338
21706
|
{
|
|
@@ -21417,6 +21785,38 @@ var getApplicablePriceTier = function (charge, currencyId, priceDecimals) {
|
|
|
21417
21785
|
: "".concat(formatCurrency(selectedTier.price, currencyId, priceDecimals));
|
|
21418
21786
|
};
|
|
21419
21787
|
|
|
21788
|
+
var ADDON_INDENTATION = 64;
|
|
21789
|
+
function findNonAddonSubscriptions(subscriptions) {
|
|
21790
|
+
return subscriptions.filter(function (subscription) {
|
|
21791
|
+
return (subscription.priceList.plan.addon === false || subscription.priceList.plan.addon === null) &&
|
|
21792
|
+
findParentSubscription(subscription, subscriptions) === undefined;
|
|
21793
|
+
});
|
|
21794
|
+
}
|
|
21795
|
+
function findAddonSubscriptions(parentSubscription, subscriptions) {
|
|
21796
|
+
var _a;
|
|
21797
|
+
var addonSubscriptionsIds = (_a = parentSubscription.addonSubscriptions) === null || _a === void 0 ? void 0 : _a.map(function (addonSubscription) { return addonSubscription.id; });
|
|
21798
|
+
return subscriptions.filter(function (subscription) { return addonSubscriptionsIds === null || addonSubscriptionsIds === void 0 ? void 0 : addonSubscriptionsIds.includes(subscription.id); });
|
|
21799
|
+
}
|
|
21800
|
+
function findParentSubscription(subscription, subscriptions) {
|
|
21801
|
+
return subscriptions.find(function (parentSubscription) {
|
|
21802
|
+
var _a;
|
|
21803
|
+
return (_a = parentSubscription.addonSubscriptions) === null || _a === void 0 ? void 0 : _a.some(function (addonSubscription) { return addonSubscription.id === subscription.id; });
|
|
21804
|
+
});
|
|
21805
|
+
}
|
|
21806
|
+
function hasUnpurchasedAddonPlans(priceList, currentSubscription) {
|
|
21807
|
+
var addonPlans = priceList.plan.addonPlans;
|
|
21808
|
+
var purchasedAddonPlans = currentSubscription === null || currentSubscription === void 0 ? void 0 : currentSubscription.addonSubscriptions;
|
|
21809
|
+
var unpurchasedAddonPlans = addonPlans === null || addonPlans === void 0 ? void 0 : addonPlans.filter(function (addonPlan) {
|
|
21810
|
+
return !(purchasedAddonPlans === null || purchasedAddonPlans === void 0 ? void 0 : purchasedAddonPlans.some(function (purchasedAddonPlan) { return purchasedAddonPlan.plan.id === addonPlan.id; }));
|
|
21811
|
+
});
|
|
21812
|
+
return unpurchasedAddonPlans && unpurchasedAddonPlans.length > 0;
|
|
21813
|
+
}
|
|
21814
|
+
// ID Cucumber will use to find the addon plan switch
|
|
21815
|
+
function addonPlanSwitchTestId(addonPlan) {
|
|
21816
|
+
var name = addonPlan.name.toLowerCase().replace(/ /g, '-');
|
|
21817
|
+
return "addon-plan-switch-".concat(name);
|
|
21818
|
+
}
|
|
21819
|
+
|
|
21420
21820
|
var removeHTMLTagsRegex = /<br>(?=(?:\s*<[^>]*>)*$)|(<br>)|<[^>]*>/gi;
|
|
21421
21821
|
// Description is a string that can contain HTML tags. We want to remove all HTML tags except <br> tags.
|
|
21422
21822
|
var createPlanDescription = function (priceList) {
|
|
@@ -21462,7 +21862,9 @@ var getActivePlanPriceData = function (priceList, selectedPriceList) {
|
|
|
21462
21862
|
};
|
|
21463
21863
|
};
|
|
21464
21864
|
var isPriceListDisabled = function (_a) {
|
|
21465
|
-
var priceList = _a.priceList, upgradingSubscription = _a.upgradingSubscription
|
|
21865
|
+
var priceList = _a.priceList, upgradingSubscription = _a.upgradingSubscription;
|
|
21866
|
+
var canPurchaseFeatureAddons = hasUnpurchasedFeatureAddons(priceList, upgradingSubscription);
|
|
21867
|
+
var canPurchasePlanAddons = hasUnpurchasedAddonPlans(priceList, upgradingSubscription);
|
|
21466
21868
|
var existingSubscriptionInTrial = upgradingSubscription && canSubscriptionUpgradeFromTrial(upgradingSubscription);
|
|
21467
21869
|
var isUpgradingSubscriptionPriceList = (upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.priceList.id) === priceList.id;
|
|
21468
21870
|
// When should priceList be disabled?
|
|
@@ -21472,15 +21874,22 @@ var isPriceListDisabled = function (_a) {
|
|
|
21472
21874
|
// AND cannot purchase add-on plans
|
|
21473
21875
|
// AND selfServiceBuy is false
|
|
21474
21876
|
if (isUpgradingSubscriptionPriceList) {
|
|
21475
|
-
return !existingSubscriptionInTrial && !canPurchaseFeatureAddons;
|
|
21877
|
+
return !existingSubscriptionInTrial && !canPurchaseFeatureAddons && !canPurchasePlanAddons;
|
|
21476
21878
|
}
|
|
21477
21879
|
return false;
|
|
21478
21880
|
};
|
|
21479
21881
|
|
|
21480
21882
|
var CheckoutButton = function (_a) {
|
|
21481
|
-
var checkoutButtonDisabled = _a.checkoutButtonDisabled, onClickCheckout = _a.onClickCheckout, loading = _a.loading;
|
|
21883
|
+
var checkoutButtonDisabled = _a.checkoutButtonDisabled, onClickCheckout = _a.onClickCheckout, loading = _a.loading, tooltipText = _a.tooltipText;
|
|
21482
21884
|
var isMobile = useIsMobile();
|
|
21483
|
-
|
|
21885
|
+
var TooltipWrapper = function (_a) {
|
|
21886
|
+
var children = _a.children;
|
|
21887
|
+
if (tooltipText) {
|
|
21888
|
+
return jsx(Tooltip, __assign({ title: tooltipText }, { children: children }));
|
|
21889
|
+
}
|
|
21890
|
+
return jsx("div", { children: children });
|
|
21891
|
+
};
|
|
21892
|
+
return (jsx(TooltipWrapper, { children: jsx(Button, __assign({ className: isMobile ? 'w-full' : '', disabled: checkoutButtonDisabled, onClick: onClickCheckout, size: isMobile ? 'large' : 'middle', type: "primary", loading: loading }, { children: "Proceed to checkout" })) }));
|
|
21484
21893
|
};
|
|
21485
21894
|
|
|
21486
21895
|
var CheckoutPrice = function (_a) {
|
|
@@ -21497,10 +21906,10 @@ var CheckoutPrice = function (_a) {
|
|
|
21497
21906
|
|
|
21498
21907
|
var CheckoutBarSummarySection = function (_a) {
|
|
21499
21908
|
var _b;
|
|
21500
|
-
var open = _a.open,
|
|
21909
|
+
var open = _a.open, selectedPriceList = _a.selectedPriceList, onClickCheckout = _a.onClickCheckout, upgradingSubscription = _a.upgradingSubscription;
|
|
21501
21910
|
// Context
|
|
21502
21911
|
var apiHost = useContext(BunnyContext).apiHost;
|
|
21503
|
-
var
|
|
21912
|
+
var _c = useContext(QuoteContext), quote = _c.quote, isQuotePending = _c.isQuotePending, isUpdatingQuote = _c.isUpdatingQuote;
|
|
21504
21913
|
var accountId = useContext(PaymentContext).accountId;
|
|
21505
21914
|
// Hooks
|
|
21506
21915
|
var token = useToken();
|
|
@@ -21518,178 +21927,30 @@ var CheckoutBarSummarySection = function (_a) {
|
|
|
21518
21927
|
token: token,
|
|
21519
21928
|
}),
|
|
21520
21929
|
});
|
|
21521
|
-
|
|
21522
|
-
var
|
|
21523
|
-
|
|
21524
|
-
// quantityLocal !== quotePreviewData.quantity ||
|
|
21525
|
-
isFetching ||
|
|
21526
|
-
isUpgradingCurrentSubscription ||
|
|
21527
|
-
open);
|
|
21930
|
+
// When should checkout button be disabled?
|
|
21931
|
+
var isUpgradingSubscription = selectedPriceList.id !== (upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.priceList.id);
|
|
21932
|
+
var disableCheckoutButton = Boolean(!selectedPriceList || isFetching || !isUpgradingSubscription || open);
|
|
21528
21933
|
var checkoutButtonDisabled = (quote === null || quote === void 0 ? void 0 : quote.amountDue) && (quote === null || quote === void 0 ? void 0 : quote.amountDue) > 0 ? false : disableCheckoutButton;
|
|
21529
21934
|
var activeCharge = (_b = getActivePlanPriceData(selectedPriceList, selectedPriceList)) === null || _b === void 0 ? void 0 : _b.activeCharge;
|
|
21530
21935
|
var isUsage = (activeCharge === null || activeCharge === void 0 ? void 0 : activeCharge.chargeType) === ChargeType.USAGE;
|
|
21531
|
-
var
|
|
21532
|
-
return (jsxs("div", __assign({ className: "bunny-flex bunny-items-center bunny-gap-4 ".concat(isMobile ? 'bunny-flex-col' : '') }, { children: [quote && (jsxs("div", __assign({ className: "bunny-flex ".concat(isMobile ? 'items-center justify-between w-full' : 'flex-col') }, { children: [jsx("div", __assign({ className: "bunny-text-slate-500 bunny-font-medium bunny-text-right", style: { fontSize: '11px' } }, { children: "TOTAL" })), jsx(CheckoutPrice, { isUsage: isUsage, quote: quote, selectedPriceList: selectedPriceList })] }))),
|
|
21936
|
+
var hasPaymentPlugins = Boolean(paymentPlugins === null || paymentPlugins === void 0 ? void 0 : paymentPlugins.length);
|
|
21937
|
+
return (jsxs("div", __assign({ className: "bunny-flex bunny-items-center bunny-gap-4 ".concat(isMobile ? 'bunny-flex-col' : '') }, { children: [quote && (jsxs("div", __assign({ className: "bunny-flex ".concat(isMobile ? 'items-center justify-between w-full' : 'flex-col') }, { children: [jsx("div", __assign({ className: "bunny-text-slate-500 bunny-font-medium bunny-text-right", style: { fontSize: '11px' } }, { children: "TOTAL" })), jsx(CheckoutPrice, { isUsage: isUsage, quote: quote, selectedPriceList: selectedPriceList })] }))), jsx(CheckoutButton, { checkoutButtonDisabled: checkoutButtonDisabled || !hasPaymentPlugins, onClickCheckout: onClickCheckout, loading: isQuotePending || isUpdatingQuote, tooltipText: !hasPaymentPlugins
|
|
21938
|
+
? 'Cannot checkout. No valid payment plugins found. Please contact your administrator.'
|
|
21939
|
+
: undefined })] })));
|
|
21533
21940
|
};
|
|
21534
21941
|
|
|
21535
|
-
var PlanPickerCheckoutBarWrapper = function (_a) {
|
|
21536
|
-
var editingQuote = _a.editingQuote, setEditingQuoteData = _a.setEditingQuoteData, handlePortalErrors = _a.handlePortalErrors, onCheckoutSuccess = _a.onCheckoutSuccess;
|
|
21537
|
-
// Context
|
|
21538
|
-
var quotePreviewData = useContext(QuotePreviewContext).quotePreviewData;
|
|
21539
|
-
var selectedPriceList = quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.priceList;
|
|
21540
|
-
if (!selectedPriceList)
|
|
21541
|
-
return null;
|
|
21542
|
-
return (jsx(PlanPickerCheckoutBar, { editingQuote: editingQuote, setEditingQuoteData: setEditingQuoteData, handlePortalErrors: handlePortalErrors, selectedPriceList: selectedPriceList, onCheckoutSuccess: onCheckoutSuccess }));
|
|
21543
|
-
};
|
|
21544
21942
|
var PlanPickerCheckoutBar = function (_a) {
|
|
21545
|
-
var
|
|
21943
|
+
var selectedPriceList = _a.selectedPriceList, handlePortalErrors = _a.handlePortalErrors, onCheckoutSuccess = _a.onCheckoutSuccess;
|
|
21546
21944
|
// Context
|
|
21547
|
-
var token = useToken();
|
|
21548
21945
|
var _b = useContext(SubscriptionsContext), upgradingSubscription = _b.upgradingSubscription, shadow = _b.shadow;
|
|
21549
|
-
var _c = useContext(
|
|
21550
|
-
var apiHost = useContext(BunnyContext).apiHost;
|
|
21946
|
+
var _c = useContext(QuoteContext), quote = _c.quote, onChangeQuantity = _c.onChangeQuantity, getFeatureQuantity = _c.getFeatureQuantity, isFeatureAddonsLoading = _c.isFeatureAddonsLoading, isUpdatingQuote = _c.isUpdatingQuote;
|
|
21551
21947
|
// Local state
|
|
21552
21948
|
var _d = useState(false), payModalVisible = _d[0], setPayModalVisible = _d[1];
|
|
21553
21949
|
// Hooks
|
|
21950
|
+
var token = useToken();
|
|
21554
21951
|
var showSuccessNotification = useSuccessNotification();
|
|
21555
21952
|
var queryClient = useQueryClient();
|
|
21556
21953
|
var isMobile = useIsMobile();
|
|
21557
|
-
var defaultPaymentMethod = usePaymentMethod({
|
|
21558
|
-
token: token,
|
|
21559
|
-
apiHost: apiHost,
|
|
21560
|
-
}).defaultPaymentMethod;
|
|
21561
|
-
var createSubscriptionUpgradeQuote = useQuoteSubscriptionUpgrade();
|
|
21562
|
-
var createSubscriptionUpdateQuote = useCreateSubscriptionQuote();
|
|
21563
|
-
var quoteSubscriptionActivate = useQuoteSubscriptionActivate();
|
|
21564
|
-
// Mutations
|
|
21565
|
-
var createQuote = useMutation({
|
|
21566
|
-
mutationFn: function (_a) {
|
|
21567
|
-
var subscriptionId = _a.subscriptionId, priceListId = _a.priceListId;
|
|
21568
|
-
return createSubscriptionUpgradeQuote(subscriptionId, priceListId, apiHost, token);
|
|
21569
|
-
},
|
|
21570
|
-
onSuccess: function (response) {
|
|
21571
|
-
var _a;
|
|
21572
|
-
var quote = (_a = response === null || response === void 0 ? void 0 : response.quoteSubscriptionUpgrade) === null || _a === void 0 ? void 0 : _a.quote;
|
|
21573
|
-
setEditingQuoteData === null || setEditingQuoteData === void 0 ? void 0 : setEditingQuoteData(quote.id);
|
|
21574
|
-
handleSetEditingQuote(quote.id);
|
|
21575
|
-
},
|
|
21576
|
-
}).mutate;
|
|
21577
|
-
var createEmptyQuote = useMutation({
|
|
21578
|
-
mutationFn: function (_a) {
|
|
21579
|
-
var subscriptionId = _a.subscriptionId;
|
|
21580
|
-
return createSubscriptionUpdateQuote([subscriptionId], apiHost, token);
|
|
21581
|
-
},
|
|
21582
|
-
onSuccess: function (response) {
|
|
21583
|
-
var _a;
|
|
21584
|
-
var quote = (_a = response === null || response === void 0 ? void 0 : response.quoteSubscriptionUpdate) === null || _a === void 0 ? void 0 : _a.quote;
|
|
21585
|
-
setEditingQuoteData === null || setEditingQuoteData === void 0 ? void 0 : setEditingQuoteData(quote.id);
|
|
21586
|
-
handleSetEditingQuote(quote.id);
|
|
21587
|
-
},
|
|
21588
|
-
}).mutate;
|
|
21589
|
-
var updateCharge = useMutation({
|
|
21590
|
-
mutationFn: quoteChargeUpdate,
|
|
21591
|
-
onSuccess: function () {
|
|
21592
|
-
queryClient.invalidateQueries({
|
|
21593
|
-
queryKey: QueryKeyFactory.default.createObjectKey({
|
|
21594
|
-
objectName: 'editingQuote',
|
|
21595
|
-
id: editingQuote === null || editingQuote === void 0 ? void 0 : editingQuote.id,
|
|
21596
|
-
token: token,
|
|
21597
|
-
}),
|
|
21598
|
-
});
|
|
21599
|
-
},
|
|
21600
|
-
}).mutate;
|
|
21601
|
-
var subscriptionActivate = useMutation({
|
|
21602
|
-
mutationFn: function (_a) {
|
|
21603
|
-
var subscriptionId = _a.subscriptionId;
|
|
21604
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
21605
|
-
return __generator(this, function (_b) {
|
|
21606
|
-
switch (_b.label) {
|
|
21607
|
-
case 0: return [4 /*yield*/, quoteSubscriptionActivate(subscriptionId, apiHost, token)];
|
|
21608
|
-
case 1: return [2 /*return*/, _b.sent()];
|
|
21609
|
-
}
|
|
21610
|
-
});
|
|
21611
|
-
});
|
|
21612
|
-
},
|
|
21613
|
-
onSuccess: function (response) {
|
|
21614
|
-
var _a;
|
|
21615
|
-
var quote = (_a = response === null || response === void 0 ? void 0 : response.quoteSubscriptionActivate) === null || _a === void 0 ? void 0 : _a.quote;
|
|
21616
|
-
setEditingQuoteData === null || setEditingQuoteData === void 0 ? void 0 : setEditingQuoteData(quote.id);
|
|
21617
|
-
handleSetEditingQuote(quote.id);
|
|
21618
|
-
queryClient.invalidateQueries({
|
|
21619
|
-
queryKey: QueryKeyFactory.default.createObjectKey({
|
|
21620
|
-
objectName: 'editingQuote',
|
|
21621
|
-
id: editingQuote === null || editingQuote === void 0 ? void 0 : editingQuote.id,
|
|
21622
|
-
token: token,
|
|
21623
|
-
}),
|
|
21624
|
-
});
|
|
21625
|
-
},
|
|
21626
|
-
}).mutate;
|
|
21627
|
-
// Queries
|
|
21628
|
-
var quote = useQuery({
|
|
21629
|
-
queryKey: QueryKeyFactory.default.createObjectKey({
|
|
21630
|
-
objectName: 'editingQuote',
|
|
21631
|
-
id: editingQuote === null || editingQuote === void 0 ? void 0 : editingQuote.id,
|
|
21632
|
-
token: token,
|
|
21633
|
-
}),
|
|
21634
|
-
queryFn: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
21635
|
-
var quote;
|
|
21636
|
-
return __generator(this, function (_a) {
|
|
21637
|
-
switch (_a.label) {
|
|
21638
|
-
case 0:
|
|
21639
|
-
if (!(editingQuote === null || editingQuote === void 0 ? void 0 : editingQuote.id)) {
|
|
21640
|
-
throw new Error('editingQuote is undefined');
|
|
21641
|
-
}
|
|
21642
|
-
return [4 /*yield*/, getQuote({
|
|
21643
|
-
id: editingQuote === null || editingQuote === void 0 ? void 0 : editingQuote.id,
|
|
21644
|
-
token: token,
|
|
21645
|
-
apiHost: apiHost,
|
|
21646
|
-
})];
|
|
21647
|
-
case 1:
|
|
21648
|
-
quote = _a.sent();
|
|
21649
|
-
return [2 /*return*/, quote];
|
|
21650
|
-
}
|
|
21651
|
-
});
|
|
21652
|
-
}); },
|
|
21653
|
-
enabled: Boolean(editingQuote === null || editingQuote === void 0 ? void 0 : editingQuote.id),
|
|
21654
|
-
}).data;
|
|
21655
|
-
useEffect(function () {
|
|
21656
|
-
var _a;
|
|
21657
|
-
if (!(upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id)) {
|
|
21658
|
-
console.error('upgradingSubscription is undefined');
|
|
21659
|
-
return;
|
|
21660
|
-
}
|
|
21661
|
-
var upgradingCurrentSubscription = (upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.priceList.id) === (selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id);
|
|
21662
|
-
if (upgradingCurrentSubscription) {
|
|
21663
|
-
if (((_a = upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState$2.TRIAL) {
|
|
21664
|
-
subscriptionActivate({
|
|
21665
|
-
subscriptionId: upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id,
|
|
21666
|
-
});
|
|
21667
|
-
}
|
|
21668
|
-
else {
|
|
21669
|
-
createEmptyQuote({
|
|
21670
|
-
subscriptionId: upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id,
|
|
21671
|
-
});
|
|
21672
|
-
}
|
|
21673
|
-
}
|
|
21674
|
-
else {
|
|
21675
|
-
createQuote({
|
|
21676
|
-
subscriptionId: upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id,
|
|
21677
|
-
priceListId: selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id,
|
|
21678
|
-
});
|
|
21679
|
-
}
|
|
21680
|
-
}, [selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id, upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id]);
|
|
21681
|
-
// Reset query key on unmount
|
|
21682
|
-
useEffect(function () {
|
|
21683
|
-
return function () {
|
|
21684
|
-
queryClient.invalidateQueries({
|
|
21685
|
-
queryKey: QueryKeyFactory.default.calculatedPricesKey({
|
|
21686
|
-
priceListId: selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id,
|
|
21687
|
-
quantity: (quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.quantity) || 0,
|
|
21688
|
-
token: token,
|
|
21689
|
-
}),
|
|
21690
|
-
});
|
|
21691
|
-
};
|
|
21692
|
-
}, [queryClient, selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id, quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.quantity, token]);
|
|
21693
21954
|
var handleCheckoutSuccess = function () {
|
|
21694
21955
|
queryClient.invalidateQueries({
|
|
21695
21956
|
queryKey: QueryKeyFactory.default.createTableKey({
|
|
@@ -21704,48 +21965,31 @@ var PlanPickerCheckoutBar = function (_a) {
|
|
|
21704
21965
|
showSuccessNotification('Your subscription has been created', 'Checkout successful');
|
|
21705
21966
|
onCheckoutSuccess();
|
|
21706
21967
|
};
|
|
21707
|
-
var onCheckoutFail = function (error) {
|
|
21708
|
-
handlePortalErrors === null || handlePortalErrors === void 0 ? void 0 : handlePortalErrors(error);
|
|
21709
|
-
};
|
|
21710
|
-
function onChangeQuantity(chargeId, quantity) {
|
|
21711
|
-
var quoteChange = quote === null || quote === void 0 ? void 0 : quote.quoteChanges.find(function (qc) { return qc.priceList.id === (selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id); });
|
|
21712
|
-
var quoteCharge = quoteChange === null || quoteChange === void 0 ? void 0 : quoteChange.charges.find(function (charge) {
|
|
21713
|
-
var _a;
|
|
21714
|
-
return ((_a = charge === null || charge === void 0 ? void 0 : charge.priceListCharge) === null || _a === void 0 ? void 0 : _a.id) === chargeId;
|
|
21715
|
-
});
|
|
21716
|
-
if (!token) {
|
|
21717
|
-
console.error('token is undefined');
|
|
21718
|
-
return;
|
|
21719
|
-
}
|
|
21720
|
-
if (!quoteCharge) {
|
|
21721
|
-
console.error('quoteCharge not found');
|
|
21722
|
-
return;
|
|
21723
|
-
}
|
|
21724
|
-
updateCharge({
|
|
21725
|
-
quoteChargeId: quoteCharge.id,
|
|
21726
|
-
quantity: quantity,
|
|
21727
|
-
apiHost: apiHost,
|
|
21728
|
-
token: token,
|
|
21729
|
-
});
|
|
21730
|
-
}
|
|
21731
21968
|
return (jsxs("div", __assign({ className: "flex ".concat(isMobile ? 'bunny-flex-col bunny-gap-4' : 'bunny-flex-row', " my-2 p-4 justify-between bg-white rounded-md ").concat(shadow ? "shadow-".concat(shadow) : '') }, { children: [jsx("div", __assign({ className: "".concat(isMobile ? 'bunny-flex bunny-flex-col' : 'bunny-flex', " bunny-gap-4") }, { children: selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.charges.map(function (charge, index) {
|
|
21732
|
-
var _a;
|
|
21733
|
-
|
|
21734
|
-
var chargeQuantity = (_a = quoteChange === null || quoteChange === void 0 ? void 0 : quoteChange.charges.find(function (charge) { var _a; return ((_a = charge === null || charge === void 0 ? void 0 : charge.priceList) === null || _a === void 0 ? void 0 : _a.id) === (selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id); })) === null || _a === void 0 ? void 0 : _a.quantity;
|
|
21735
|
-
if (charge.chargeType === ChargeType.USAGE)
|
|
21969
|
+
var _a, _b;
|
|
21970
|
+
if (!canEditChargeQuantity(charge))
|
|
21736
21971
|
return null;
|
|
21737
|
-
if (!
|
|
21972
|
+
if (!((_a = charge.feature) === null || _a === void 0 ? void 0 : _a.id))
|
|
21973
|
+
throw new Error('Charge feature is undefined');
|
|
21974
|
+
var isFeatureAddon = charge.featureAddon;
|
|
21975
|
+
var quantity = getFeatureQuantity((_b = charge.feature) === null || _b === void 0 ? void 0 : _b.id, charge.id);
|
|
21976
|
+
var maybeIsChargeLoading = isFeatureAddon && isFeatureAddonsLoading;
|
|
21977
|
+
var showInput = quantity && selectedPriceList.id !== (upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.priceList.id);
|
|
21978
|
+
if (!showInput)
|
|
21738
21979
|
return null;
|
|
21739
|
-
if
|
|
21980
|
+
// if charge is a feature addon, and a corresponding quote charge is not found in quote, return null
|
|
21981
|
+
if (isFeatureAddon && !featureAddonInQuote(selectedPriceList, charge, quote)) {
|
|
21740
21982
|
return null;
|
|
21741
|
-
|
|
21983
|
+
}
|
|
21984
|
+
var isDisabled = !quote || maybeIsChargeLoading || !selectedPriceList || !charge.selfServiceQuantity;
|
|
21985
|
+
return (jsx(CheckoutBarInput, { disabled: isDisabled, charge: charge, quantity: quantity, onQuantityChanged: function (quantity) {
|
|
21742
21986
|
onChangeQuantity(charge.id, quantity);
|
|
21743
21987
|
} }, index));
|
|
21744
|
-
}) })), jsx(CheckoutBarSummarySection, { onClickCheckout: function () { return setPayModalVisible(true); }, open: payModalVisible,
|
|
21988
|
+
}) })), jsx(CheckoutBarSummarySection, { onClickCheckout: function () { return setPayModalVisible(true); }, open: payModalVisible, selectedPriceList: selectedPriceList, upgradingSubscription: upgradingSubscription }), jsx(Checkout, { onCancel: function () { return setPayModalVisible(false); }, onFail: function (error) { return handlePortalErrors === null || handlePortalErrors === void 0 ? void 0 : handlePortalErrors(error); }, onSuccess: handleCheckoutSuccess, open: payModalVisible, quote: quote, token: token, isUpdatingQuote: isUpdatingQuote })] })));
|
|
21745
21989
|
};
|
|
21746
21990
|
|
|
21747
21991
|
// WARNING: There is a preview button on APP that will need to be changed if this query is changed
|
|
21748
|
-
var PRICE_LIST_CHANGE_OPTIONS_QUERY = "\n query priceListChangeOptions($subscriptionId: ID, $productId: ID) {\n priceListChangeOptions(subscriptionId: $subscriptionId, productId: $productId) {\n products {\n everythingInPlus\n id\n name\n plansToDisplay\n features(sort: \"position asc\") {\n description\n id\n isVisible\n kind\n name\n position\n }\n }\n priceLists {\n showPriceAsMonthly\n basePrice\n currencyId\n id\n monthlyBasePrice\n periodMonths\n plan {\n code\n contactUsLabel\n contactUsUrl\n description\n id\n name\n position\n pricingDescription\n pricingStyle\n planFeatures {\n featureId\n value\n feature {\n name\n }\n }\n }\n product {\n id\n }\n charges {\n featureAddon\n basePrice\n billingPeriod\n chargeType\n id\n name\n priceDecimals\n pricingModel\n quantityMax\n quantityMin\n selfServiceQuantity\n priceList {\n id\n }\n feature {\n name\n unitName\n }\n }\n }\n }\n }";
|
|
21992
|
+
var PRICE_LIST_CHANGE_OPTIONS_QUERY = "\n query priceListChangeOptions($subscriptionId: ID, $productId: ID) {\n priceListChangeOptions(subscriptionId: $subscriptionId, productId: $productId) {\n products {\n everythingInPlus\n id\n name\n plansToDisplay\n features(sort: \"position asc\") {\n description\n id\n isVisible\n kind\n name\n position\n }\n }\n priceLists {\n showPriceAsMonthly\n basePrice\n currencyId\n id\n monthlyBasePrice\n periodMonths\n plan {\n code\n contactUsLabel\n contactUsUrl\n description\n id\n name\n position\n pricingDescription\n pricingStyle\n addon\n planFeatures {\n featureId\n value\n feature {\n name\n }\n }\n }\n product {\n id\n }\n charges {\n featureAddon\n basePrice\n billingPeriod\n chargeType\n id\n name\n priceDecimals\n pricingModel\n quantityMax\n quantityMin\n selfServiceQuantity\n priceList {\n id\n }\n feature {\n name\n unitName\n id\n }\n }\n }\n }\n }";
|
|
21749
21993
|
var getPriceListChangeOptions = function (_a) {
|
|
21750
21994
|
var apiHost = _a.apiHost, isInPreviewMode = _a.isInPreviewMode, productId = _a.productId, token = _a.token, upgradingSubscription = _a.upgradingSubscription;
|
|
21751
21995
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -21771,60 +22015,15 @@ var getPriceListChangeOptions = function (_a) {
|
|
|
21771
22015
|
return [2 /*return*/, priceListChangeOptions];
|
|
21772
22016
|
}
|
|
21773
22017
|
});
|
|
21774
|
-
});
|
|
21775
|
-
};
|
|
21776
|
-
|
|
21777
|
-
var ErrorView = function (_a) {
|
|
21778
|
-
var children = _a.children, message = _a.message;
|
|
21779
|
-
return (jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-w-full", style: { marginTop: "80px" } }, { children: [jsx("div", __assign({ style: { fontSize: "32px" } }, { children: message })), children] })));
|
|
21780
|
-
};
|
|
21781
|
-
|
|
21782
|
-
var calculateNewQuantity = function (priceList, currentQuantity) {
|
|
21783
|
-
if (currentQuantity === void 0) { currentQuantity = 1; }
|
|
21784
|
-
var priceListRecurringCharge = priceList === null || priceList === void 0 ? void 0 : priceList.charges.find(function (priceListCharge) {
|
|
21785
|
-
return priceListCharge.chargeType === "RECURRING" ||
|
|
21786
|
-
priceListCharge.chargeType === "USAGE";
|
|
21787
|
-
});
|
|
21788
|
-
var quantityMax = (priceListRecurringCharge === null || priceListRecurringCharge === void 0 ? void 0 : priceListRecurringCharge.quantityMax) || Number.POSITIVE_INFINITY;
|
|
21789
|
-
var quantityMin = (priceListRecurringCharge === null || priceListRecurringCharge === void 0 ? void 0 : priceListRecurringCharge.quantityMin) || Number.NEGATIVE_INFINITY;
|
|
21790
|
-
var selfServiceQuantity = priceListRecurringCharge === null || priceListRecurringCharge === void 0 ? void 0 : priceListRecurringCharge.selfServiceQuantity;
|
|
21791
|
-
// If self service quantity is disabled, return the min quantity
|
|
21792
|
-
if (!selfServiceQuantity && quantityMin) {
|
|
21793
|
-
return quantityMin;
|
|
21794
|
-
}
|
|
21795
|
-
// If the current quantity is greater than the max quantity, return the max quantity
|
|
21796
|
-
else if (currentQuantity > quantityMax) {
|
|
21797
|
-
return quantityMax;
|
|
21798
|
-
}
|
|
21799
|
-
// If the current quantity is less than the min quantity, return the min quantity
|
|
21800
|
-
else if (currentQuantity < quantityMin) {
|
|
21801
|
-
return quantityMin;
|
|
21802
|
-
}
|
|
21803
|
-
// If the current quantity is between the min and max quantity, return the current quantity
|
|
21804
|
-
else if (currentQuantity <= quantityMax && currentQuantity >= quantityMin) {
|
|
21805
|
-
return currentQuantity;
|
|
21806
|
-
}
|
|
21807
|
-
// If all else fails, return 1
|
|
21808
|
-
else {
|
|
21809
|
-
return 1;
|
|
21810
|
-
}
|
|
21811
|
-
};
|
|
21812
|
-
|
|
21813
|
-
function isAddonPurchased(featureAddon, currentSubscription) {
|
|
21814
|
-
var purchasedFeatureAddons = currentSubscription === null || currentSubscription === void 0 ? void 0 : currentSubscription.charges.filter(function (charge) { var _a; return (_a = charge.priceListCharge) === null || _a === void 0 ? void 0 : _a.featureAddon; });
|
|
21815
|
-
if (!purchasedFeatureAddons)
|
|
21816
|
-
return false;
|
|
21817
|
-
return purchasedFeatureAddons.some(function (addon) { var _a; return ((_a = addon.priceListCharge) === null || _a === void 0 ? void 0 : _a.id) === featureAddon.id; });
|
|
21818
|
-
}
|
|
21819
|
-
function priceListHasUnpurchasedFeatureAddons(priceList, currentSubscription) {
|
|
21820
|
-
var featureAddons = priceList.charges.filter(function (charge) { return charge.featureAddon; });
|
|
21821
|
-
var purchasedFeatureAddons = currentSubscription === null || currentSubscription === void 0 ? void 0 : currentSubscription.charges.filter(function (charge) { var _a; return (_a = charge.priceListCharge) === null || _a === void 0 ? void 0 : _a.featureAddon; });
|
|
21822
|
-
var unpurchasedFeatureAddons = featureAddons.filter(function (charge) {
|
|
21823
|
-
return !(purchasedFeatureAddons === null || purchasedFeatureAddons === void 0 ? void 0 : purchasedFeatureAddons.some(function (purchasedCharge) { var _a; return ((_a = purchasedCharge.priceListCharge) === null || _a === void 0 ? void 0 : _a.id) === charge.id; }));
|
|
21824
|
-
});
|
|
21825
|
-
return unpurchasedFeatureAddons.length > 0;
|
|
21826
|
-
}
|
|
22018
|
+
});
|
|
22019
|
+
};
|
|
22020
|
+
|
|
22021
|
+
var ErrorView = function (_a) {
|
|
22022
|
+
var children = _a.children, message = _a.message;
|
|
22023
|
+
return (jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-w-full", style: { marginTop: "80px" } }, { children: [jsx("div", __assign({ style: { fontSize: "32px" } }, { children: message })), children] })));
|
|
22024
|
+
};
|
|
21827
22025
|
|
|
22026
|
+
var Text$d = Typography.Text;
|
|
21828
22027
|
var BillingPeriodSelector = function (_a) {
|
|
21829
22028
|
var availableBillingPeriods = _a.availableBillingPeriods, onChangeBillingPeriod = _a.onChangeBillingPeriod, products = _a.products, selectedBillingPeriod = _a.selectedBillingPeriod, selectedProduct = _a.selectedProduct, onChangeProduct = _a.onChangeProduct;
|
|
21830
22029
|
var _b = useContext(BrandContext), secondaryColor = _b.secondaryColor, brandColor = _b.brandColor;
|
|
@@ -21835,7 +22034,7 @@ var BillingPeriodSelector = function (_a) {
|
|
|
21835
22034
|
color: secondaryColor,
|
|
21836
22035
|
} }, { children: "Select product" })), jsx(ProductRadioStyled, __assign({ brandColor: brandColor }, { children: jsx(Radio.Group, __assign({ onChange: function (e) {
|
|
21837
22036
|
onChangeProduct(products === null || products === void 0 ? void 0 : products.find(function (product) { return product.id === e.target.value; }));
|
|
21838
|
-
}, value: selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.id, buttonStyle: "solid" }, { children: jsx(Space, __assign({ className: "bunny-gap-2" }, { children: products === null || products === void 0 ? void 0 : products.map(function (product) { return (jsx(Radio.Button, __assign({ value: product.id }, { children: product.name }), product.id)); }) })) })) }))] }))), jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-w-full bunny-gap-2" }, { children: [!isMobile && (jsx(
|
|
22037
|
+
}, value: selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.id, buttonStyle: "solid" }, { children: jsx(Space, __assign({ className: "bunny-gap-2" }, { children: products === null || products === void 0 ? void 0 : products.map(function (product) { return (jsx(Radio.Button, __assign({ value: product.id }, { children: product.name }), product.id)); }) })) })) }))] }))), jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-w-full bunny-gap-2" }, { children: [!isMobile && (jsx(Text$d, __assign({ className: "bunny-font-medium bunny-text-xs", style: {
|
|
21839
22038
|
color: secondaryColor,
|
|
21840
22039
|
} }, { children: "Subscription term" }))), jsx(StyledRadioGroup, __assign({ className: "bunny-w-full", "$isMobile": isMobile }, { children: jsx(Radio.Group, __assign({ onChange: function (e) {
|
|
21841
22040
|
onChangeBillingPeriod(e.target.value);
|
|
@@ -21876,6 +22075,8 @@ var NextPriceListButton = function (_a) {
|
|
|
21876
22075
|
var getAvailablePlansAndPriceLists = function (_a) {
|
|
21877
22076
|
var availablePriceLists = _a.availablePriceLists, priceListChangeOptions = _a.priceListChangeOptions, priceListStart = _a.priceListStart, plansToDisplay = _a.plansToDisplay;
|
|
21878
22077
|
var displayPriceLists = availablePriceLists.slice(priceListStart, priceListStart + plansToDisplay);
|
|
22078
|
+
// displayPriceLists don't have enough data in them, so we're finding the same price list within
|
|
22079
|
+
// priceListChangeOptions which has more data in it.
|
|
21879
22080
|
var availablePriceListsArray = displayPriceLists === null || displayPriceLists === void 0 ? void 0 : displayPriceLists.map(function (displayPriceList) {
|
|
21880
22081
|
var _a;
|
|
21881
22082
|
var foundPriceList = (_a = priceListChangeOptions === null || priceListChangeOptions === void 0 ? void 0 : priceListChangeOptions.priceLists) === null || _a === void 0 ? void 0 : _a.find(function (priceList) { return priceList.plan.id === displayPriceList.plan.id; });
|
|
@@ -21892,12 +22093,8 @@ var everythingInPlusString = function (_a) {
|
|
|
21892
22093
|
};
|
|
21893
22094
|
|
|
21894
22095
|
var PriceListCardButton = function (_a) {
|
|
21895
|
-
var
|
|
21896
|
-
// Context
|
|
22096
|
+
var disableSelectCurrentPlan = _a.disableSelectCurrentPlan, isPriceListCurrentSubscription = _a.isPriceListCurrentSubscription, isSelected = _a.isSelected, priceList = _a.priceList, subscriptionPlan = _a.subscriptionPlan;
|
|
21897
22097
|
var upgradingSubscription = useContext(SubscriptionsContext).upgradingSubscription;
|
|
21898
|
-
var showBuyAddonsButton = isPriceListCurrentSubscription &&
|
|
21899
|
-
subscriptionPlan &&
|
|
21900
|
-
priceListHasUnpurchasedFeatureAddons(priceList, upgradingSubscription);
|
|
21901
22098
|
var isPriceListNonSubscribedCurrentPlan = (upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.plan.id) === priceList.plan.id && !isPriceListCurrentSubscription;
|
|
21902
22099
|
var canUpgradeFromTrial = upgradingSubscription && canSubscriptionUpgradeFromTrial(upgradingSubscription);
|
|
21903
22100
|
var createButtonText = function () {
|
|
@@ -21913,11 +22110,9 @@ var PriceListCardButton = function (_a) {
|
|
|
21913
22110
|
return priceList.plan.contactUsLabel;
|
|
21914
22111
|
return 'Select';
|
|
21915
22112
|
};
|
|
21916
|
-
return (
|
|
21917
|
-
|
|
21918
|
-
|
|
21919
|
-
maxWidth: '240px',
|
|
21920
|
-
}, type: isSelected ? 'primary' : 'default' }, { children: createButtonText() })) }))] })));
|
|
22113
|
+
return (jsx("div", __assign({ className: "bunny-flex bunny-flex-col bunny-grow bunny-w-full bunny-justify-end bunny-gap-3" }, { children: jsx("div", __assign({ className: "bunny-flex bunny-justify-center bunny-w-full" }, { children: jsx(Button, __assign({ className: "bunny-w-full", disabled: disableSelectCurrentPlan, style: {
|
|
22114
|
+
maxWidth: '240px',
|
|
22115
|
+
}, type: isSelected ? 'primary' : 'default' }, { children: createButtonText() })) })) })));
|
|
21921
22116
|
};
|
|
21922
22117
|
|
|
21923
22118
|
var Text$c = Typography.Text;
|
|
@@ -21946,9 +22141,9 @@ var calculatePriceDecimals = function (priceList) {
|
|
|
21946
22141
|
return 0;
|
|
21947
22142
|
};
|
|
21948
22143
|
var PriceListCardPrice = function (_a) {
|
|
21949
|
-
var priceList = _a.priceList;
|
|
22144
|
+
var priceList = _a.priceList, _b = _a.fontSize, fontSize = _b === void 0 ? '32px' : _b;
|
|
21950
22145
|
var priceDecimals = calculatePriceDecimals(priceList);
|
|
21951
|
-
return (jsx("div", __assign({ className: "bunny-font-medium bunny-text-center bunny-text-gray-900", style: { fontSize:
|
|
22146
|
+
return (jsx("div", __assign({ className: "bunny-font-medium bunny-text-center bunny-text-gray-900", style: { fontSize: fontSize } }, { children: !priceList.plan.pricingStyle || priceList.plan.pricingStyle === PricingStyle.PRICED
|
|
21952
22147
|
? formatCurrency(getPrice(priceList), priceList.currencyId, priceDecimals)
|
|
21953
22148
|
: priceList.plan.pricingStyle === PricingStyle.CONTACT_US
|
|
21954
22149
|
? ''
|
|
@@ -21992,9 +22187,9 @@ function PriceDescriptionString(_a) {
|
|
|
21992
22187
|
var PriceListCardTitle = function (_a) {
|
|
21993
22188
|
var priceList = _a.priceList, isPriceListCurrentSubscription = _a.isPriceListCurrentSubscription, trialRemainingDays = _a.trialRemainingDays;
|
|
21994
22189
|
var isMobile = useIsMobile();
|
|
21995
|
-
return (jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-items-center bunny-gap-4" }, { children: [Boolean(trialRemainingDays) && (jsx("div", __assign({ className: "bunny-font-medium bunny-text-secondary", style: { height:
|
|
21996
|
-
? "Trial ends in ".concat(trialRemainingDays, " day").concat(trialRemainingDays === 1 ?
|
|
21997
|
-
:
|
|
22190
|
+
return (jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-items-center bunny-gap-4" }, { children: [Boolean(trialRemainingDays) && (jsx("div", __assign({ className: "bunny-font-medium bunny-text-secondary", style: { height: '1rem' } }, { children: isPriceListCurrentSubscription
|
|
22191
|
+
? "Trial ends in ".concat(trialRemainingDays, " day").concat(trialRemainingDays === 1 ? '' : 's')
|
|
22192
|
+
: ' ' }))), jsx("div", __assign({ className: "bunny-font-medium bunny-text-center ".concat(isMobile ? 'bunny-text-slate-500' : 'bunny-text-orange-600'), style: { fontSize: '20px' } }, { children: priceList.plan.name }))] })));
|
|
21998
22193
|
};
|
|
21999
22194
|
|
|
22000
22195
|
var PLAN_GRID_PADDING = 4;
|
|
@@ -22007,18 +22202,19 @@ var PlanPickerGridCell = function (_a) {
|
|
|
22007
22202
|
};
|
|
22008
22203
|
|
|
22009
22204
|
var PriceListCardDesktop = function (_a) {
|
|
22010
|
-
var description = _a.description,
|
|
22011
|
-
return (jsx(PlanPickerGridCell, { children: jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-items-center bunny-justify-between bunny-w-full bunny-rounded-md bunny-gap-4 bunny-pt-6 bunny-px-4 ".concat(
|
|
22012
|
-
if (!
|
|
22205
|
+
var hideButton = _a.hideButton, description = _a.description, disableSelectCurrentPlan = _a.disableSelectCurrentPlan, feature = _a.feature, isPriceListCurrentSubscription = _a.isPriceListCurrentSubscription, isSelected = _a.isSelected, priceList = _a.priceList, subscriptionPlan = _a.subscriptionPlan, trialRemainingDays = _a.trialRemainingDays, noBorder = _a.noBorder, onClickPriceListCard = _a.onClickPriceListCard;
|
|
22206
|
+
return (jsx(PlanPickerGridCell, __assign({ noBorder: noBorder }, { children: jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-items-center bunny-justify-between bunny-w-full bunny-rounded-md bunny-gap-4 bunny-pt-6 bunny-px-4 ".concat(disableSelectCurrentPlan ? '' : 'cursor-pointer'), onClick: function () {
|
|
22207
|
+
if (!disableSelectCurrentPlan) {
|
|
22013
22208
|
if (priceList.plan.pricingStyle === PricingStyle.CONTACT_US) {
|
|
22014
22209
|
window.open(priceList.plan.contactUsUrl, '_blank');
|
|
22015
22210
|
}
|
|
22016
|
-
else
|
|
22017
|
-
|
|
22211
|
+
else {
|
|
22212
|
+
onClickPriceListCard === null || onClickPriceListCard === void 0 ? void 0 : onClickPriceListCard(priceList);
|
|
22213
|
+
}
|
|
22018
22214
|
}
|
|
22019
22215
|
}, style: {
|
|
22020
22216
|
height: '100%',
|
|
22021
|
-
} }, { children: [jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-items-center bunny-gap-3" }, { children: [jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-items-center bunny-gap-2" }, { children: [jsx(PriceListCardTitle, { isPriceListCurrentSubscription: isPriceListCurrentSubscription, priceList: priceList, trialRemainingDays: trialRemainingDays }), jsx(PriceListCardDescription, { description: description })] })), jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-items-center bunny-gap-2" }, { children: [jsx(PriceListCardPrice, { priceList: priceList }), jsx(PriceListCardPriceDescription, { feature: feature, priceList: priceList })] }))] })), jsx(PriceListCardButton, {
|
|
22217
|
+
} }, { children: [jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-items-center bunny-gap-3" }, { children: [jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-items-center bunny-gap-2" }, { children: [jsx(PriceListCardTitle, { isPriceListCurrentSubscription: isPriceListCurrentSubscription, priceList: priceList, trialRemainingDays: trialRemainingDays }), jsx(PriceListCardDescription, { description: description })] })), jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-items-center bunny-gap-2" }, { children: [jsx(PriceListCardPrice, { priceList: priceList }), jsx(PriceListCardPriceDescription, { feature: feature, priceList: priceList })] }))] })), !hideButton && (jsx(PriceListCardButton, { disableSelectCurrentPlan: disableSelectCurrentPlan, isPriceListCurrentSubscription: isPriceListCurrentSubscription, isSelected: isSelected, priceList: priceList, subscriptionPlan: subscriptionPlan }))] })) })));
|
|
22022
22218
|
};
|
|
22023
22219
|
|
|
22024
22220
|
var CheckIcon = function (_a) {
|
|
@@ -22027,23 +22223,23 @@ var CheckIcon = function (_a) {
|
|
|
22027
22223
|
};
|
|
22028
22224
|
|
|
22029
22225
|
var PriceListCardMobile = function (_a) {
|
|
22030
|
-
var description = _a.description,
|
|
22226
|
+
var description = _a.description, feature = _a.feature, isPriceListCurrentSubscription = _a.isPriceListCurrentSubscription, isSelected = _a.isSelected, priceList = _a.priceList, subscriptionPlan = _a.subscriptionPlan, trialRemainingDays = _a.trialRemainingDays, disableOnClickPriceListCard = _a.disableOnClickPriceListCard, onClickPriceListCard = _a.onClickPriceListCard;
|
|
22031
22227
|
var brandColor = useContext(BrandContext).brandColor;
|
|
22032
22228
|
return (jsxs("div", __assign({ className: "bunny-relative bunny-flex bunny-flex-col bunny-border-2 bunny-border-solid bunny-rounded-lg bunny-p-4", onClick: function () {
|
|
22033
|
-
if (!
|
|
22034
|
-
|
|
22229
|
+
if (!disableOnClickPriceListCard)
|
|
22230
|
+
onClickPriceListCard === null || onClickPriceListCard === void 0 ? void 0 : onClickPriceListCard(priceList);
|
|
22035
22231
|
}, style: {
|
|
22036
22232
|
minWidth: '220px',
|
|
22037
22233
|
borderColor: isSelected ? brandColor : SLATE_200,
|
|
22038
22234
|
} }, { children: [isSelected && (jsx("div", __assign({ className: "bunny-absolute", style: {
|
|
22039
22235
|
top: '10px',
|
|
22040
22236
|
right: '10px',
|
|
22041
|
-
} }, { children: jsx(CheckIcon, { backgroundColor: brandColor, size: "20px" }) }))), jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-items-center bunny-grow bunny-gap-2" }, { children: [jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-items-center bunny-gap-2" }, { children: [jsx(PriceListCardTitle, { isPriceListCurrentSubscription: isPriceListCurrentSubscription, priceList: priceList, trialRemainingDays: trialRemainingDays }), jsx(PriceListCardDescription, { description: description })] })), jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-items-center bunny-gap-2" }, { children: [jsx(PriceListCardPrice, { priceList: priceList }), jsx(PriceListCardPriceDescription, { feature: feature, priceList: priceList })] })), jsx(PriceListCardButton, {
|
|
22237
|
+
} }, { children: jsx(CheckIcon, { backgroundColor: brandColor, size: "20px" }) }))), jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-items-center bunny-grow bunny-gap-2" }, { children: [jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-items-center bunny-gap-2" }, { children: [jsx(PriceListCardTitle, { isPriceListCurrentSubscription: isPriceListCurrentSubscription, priceList: priceList, trialRemainingDays: trialRemainingDays }), jsx(PriceListCardDescription, { description: description })] })), jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-items-center bunny-gap-2" }, { children: [jsx(PriceListCardPrice, { priceList: priceList }), jsx(PriceListCardPriceDescription, { feature: feature, priceList: priceList })] })), jsx(PriceListCardButton, { disableSelectCurrentPlan: disableOnClickPriceListCard, isPriceListCurrentSubscription: isPriceListCurrentSubscription, isSelected: isSelected, priceList: priceList, subscriptionPlan: subscriptionPlan })] }))] })));
|
|
22042
22238
|
};
|
|
22043
22239
|
|
|
22044
22240
|
var PriceListCard = function (_a) {
|
|
22045
22241
|
var _b;
|
|
22046
|
-
var
|
|
22242
|
+
var hideButton = _a.hideButton, isSelected = _a.isSelected, priceList = _a.priceList, subscriptions = _a.subscriptions, trialRemainingDays = _a.trialRemainingDays, noBorder = _a.noBorder, onClickPriceListCard = _a.onClickPriceListCard;
|
|
22047
22243
|
// Context
|
|
22048
22244
|
var upgradingSubscription = useContext(SubscriptionsContext).upgradingSubscription;
|
|
22049
22245
|
var isMobile = useIsMobile();
|
|
@@ -22053,11 +22249,9 @@ var PriceListCard = function (_a) {
|
|
|
22053
22249
|
var activeCharge = (_b = getActivePlanPriceData(priceList, priceList)) === null || _b === void 0 ? void 0 : _b.activeCharge;
|
|
22054
22250
|
// Is the price list the current price list for the upgradingSubscription
|
|
22055
22251
|
var isPriceListCurrentSubscription = (upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.priceList.id) === priceList.id;
|
|
22056
|
-
var
|
|
22057
|
-
var disableOnClick = isPriceListDisabled({
|
|
22252
|
+
var disableSelectCurrentPlan = isPriceListDisabled({
|
|
22058
22253
|
priceList: priceList,
|
|
22059
22254
|
upgradingSubscription: upgradingSubscription,
|
|
22060
|
-
canPurchaseFeatureAddons: canPurchaseFeatureAddons,
|
|
22061
22255
|
});
|
|
22062
22256
|
var subscriptionPlan = subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.find(function (subscription) {
|
|
22063
22257
|
var _a, _b;
|
|
@@ -22069,22 +22263,21 @@ var PriceListCard = function (_a) {
|
|
|
22069
22263
|
return null;
|
|
22070
22264
|
}
|
|
22071
22265
|
var feature = activeCharge.feature;
|
|
22072
|
-
return isMobile ? (jsx(PriceListCardMobile, { description: description,
|
|
22266
|
+
return isMobile ? (jsx(PriceListCardMobile, { description: description, feature: feature, isPriceListCurrentSubscription: isPriceListCurrentSubscription, isSelected: isSelected, priceList: priceList, trialRemainingDays: trialRemainingDays, subscriptionPlan: subscriptionPlan,
|
|
22267
|
+
// TODO: naming mismatch disableOnClickPriceListCard vs disableSelectCurrentPlan, maybe also functionality mismatch? (ignore for now, mobile won't ever show this currently)
|
|
22268
|
+
disableOnClickPriceListCard: disableSelectCurrentPlan, onClickPriceListCard: onClickPriceListCard })) : (jsx(PriceListCardDesktop, { hideButton: hideButton, description: description, disableSelectCurrentPlan: disableSelectCurrentPlan, feature: feature, isPriceListCurrentSubscription: isPriceListCurrentSubscription, isSelected: isSelected, priceList: priceList, trialRemainingDays: trialRemainingDays, subscriptionPlan: subscriptionPlan, noBorder: noBorder, onClickPriceListCard: onClickPriceListCard }));
|
|
22073
22269
|
};
|
|
22074
22270
|
|
|
22075
|
-
var QUOTE_CHARGE_CREATE
|
|
22271
|
+
var QUOTE_CHARGE_CREATE = "\n".concat(QUOTE_FIELDS(), "\nmutation QuoteChargeCreate ($quoteChangeId: ID!, $startDate: ISO8601Date!, $endDate: ISO8601Date, $priceListChargeId: ID, $subscriptionChargeId: ID, $price: Float, $quantity: Int) {\n quoteChargeCreate(\n endDate: $endDate\n price: $price\n priceListChargeId: $priceListChargeId\n quantity: $quantity\n quoteChangeId: $quoteChangeId\n startDate: $startDate\n subscriptionChargeId: $subscriptionChargeId\n ) {\n quoteCharge {\n quoteChange {\n id\n quoteId\n quote {\n ...QuoteFields\n }\n }\n id\n }\n }\n}\n\n");
|
|
22076
22272
|
var quoteChargeCreate = function (_a) {
|
|
22077
|
-
var
|
|
22078
|
-
// endDate,
|
|
22079
|
-
price = _a.price, priceListChargeId = _a.priceListChargeId, quantity = _a.quantity, quoteChangeId = _a.quoteChangeId, startDate = _a.startDate, subscriptionChargeId = _a.subscriptionChargeId, token = _a.token, apiHost = _a.apiHost;
|
|
22273
|
+
var price = _a.price, priceListChargeId = _a.priceListChargeId, quantity = _a.quantity, quoteChangeId = _a.quoteChangeId, startDate = _a.startDate, subscriptionChargeId = _a.subscriptionChargeId, token = _a.token, apiHost = _a.apiHost;
|
|
22080
22274
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
22081
22275
|
var response;
|
|
22082
22276
|
return __generator(this, function (_b) {
|
|
22083
22277
|
switch (_b.label) {
|
|
22084
22278
|
case 0: return [4 /*yield*/, gqlRequest({
|
|
22085
|
-
query: QUOTE_CHARGE_CREATE
|
|
22279
|
+
query: QUOTE_CHARGE_CREATE,
|
|
22086
22280
|
vars: {
|
|
22087
|
-
// endDate,
|
|
22088
22281
|
price: price,
|
|
22089
22282
|
priceListChargeId: priceListChargeId,
|
|
22090
22283
|
quantity: quantity,
|
|
@@ -22106,32 +22299,38 @@ var quoteChargeCreate = function (_a) {
|
|
|
22106
22299
|
});
|
|
22107
22300
|
};
|
|
22108
22301
|
|
|
22109
|
-
var
|
|
22302
|
+
var QUOTE_CHARGE_DELETE = "\n".concat(QUOTE_FIELDS(), "\nmutation QuoteChargeDelete ($quoteChargeId: ID!) {\n quoteChargeDelete(\n quoteChargeId: $quoteChargeId\n ) {\n errors\n quoteCharge {\n quoteChange {\n id\n quoteId\n quote {\n ...QuoteFields\n }\n }\n }\n }\n}\n\n");
|
|
22110
22303
|
var quoteChargeDelete = function (_a) {
|
|
22111
22304
|
var quoteChargeId = _a.quoteChargeId, token = _a.token, apiHost = _a.apiHost;
|
|
22112
|
-
return
|
|
22113
|
-
|
|
22114
|
-
|
|
22115
|
-
|
|
22116
|
-
|
|
22117
|
-
|
|
22118
|
-
|
|
22305
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
22306
|
+
var response;
|
|
22307
|
+
return __generator(this, function (_b) {
|
|
22308
|
+
switch (_b.label) {
|
|
22309
|
+
case 0: return [4 /*yield*/, gqlRequest({
|
|
22310
|
+
query: QUOTE_CHARGE_DELETE,
|
|
22311
|
+
vars: {
|
|
22312
|
+
quoteChargeId: quoteChargeId,
|
|
22313
|
+
},
|
|
22314
|
+
apiHost: apiHost,
|
|
22315
|
+
token: token,
|
|
22316
|
+
})];
|
|
22317
|
+
case 1:
|
|
22318
|
+
response = _b.sent();
|
|
22319
|
+
if (response.errors) {
|
|
22320
|
+
throw new Error(response.errors[0].message);
|
|
22321
|
+
}
|
|
22322
|
+
return [2 /*return*/, response.quoteChargeDelete.quoteCharge];
|
|
22323
|
+
}
|
|
22324
|
+
});
|
|
22119
22325
|
});
|
|
22120
22326
|
};
|
|
22121
22327
|
|
|
22122
|
-
var useQuoteUpdateFeatureAddon = function (
|
|
22328
|
+
var useQuoteUpdateFeatureAddon = function (quote, featureAddon) {
|
|
22123
22329
|
var apiHost = useContext(BunnyContext).apiHost;
|
|
22330
|
+
var _a = useContext(QuoteContext), addFeatureAddonLoading = _a.addFeatureAddonLoading, removeFeatureAddonLoading = _a.removeFeatureAddonLoading;
|
|
22124
22331
|
var token = useToken();
|
|
22125
22332
|
var queryClient = useQueryClient();
|
|
22126
22333
|
var addedQuoteChargeId = useRef();
|
|
22127
|
-
var editingQuote = useQuery({
|
|
22128
|
-
queryKey: QueryKeyFactory.default.createObjectKey({
|
|
22129
|
-
objectName: 'editingQuote',
|
|
22130
|
-
id: quoteId,
|
|
22131
|
-
}),
|
|
22132
|
-
queryFn: function () { return (quoteId ? getQuote({ id: quoteId, token: token, apiHost: apiHost }) : undefined); },
|
|
22133
|
-
enabled: Boolean(quoteId),
|
|
22134
|
-
}).data;
|
|
22135
22334
|
function handleAddFeatureAddon() {
|
|
22136
22335
|
quoteChargeCreateMutation();
|
|
22137
22336
|
}
|
|
@@ -22140,20 +22339,23 @@ var useQuoteUpdateFeatureAddon = function (quoteId, featureAddon) {
|
|
|
22140
22339
|
return;
|
|
22141
22340
|
quoteChargeDeleteMutation({ quoteChargeId: addedQuoteChargeId.current });
|
|
22142
22341
|
}
|
|
22143
|
-
var
|
|
22342
|
+
var _b = useMutation({
|
|
22144
22343
|
mutationFn: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
22145
|
-
var quoteCharge;
|
|
22344
|
+
var quoteChangeId, quoteCharge;
|
|
22146
22345
|
return __generator(this, function (_a) {
|
|
22147
22346
|
switch (_a.label) {
|
|
22148
22347
|
case 0:
|
|
22149
22348
|
if (!token)
|
|
22150
22349
|
throw new Error('Token is required');
|
|
22151
|
-
if (!
|
|
22350
|
+
if (!quote)
|
|
22152
22351
|
throw new Error('Editing quote is required');
|
|
22352
|
+
quoteChangeId = findQuoteChangeForFeatureAddon(quote);
|
|
22353
|
+
if (!quoteChangeId)
|
|
22354
|
+
throw new Error('No available quote change for feature add-on');
|
|
22153
22355
|
return [4 /*yield*/, quoteChargeCreate({
|
|
22154
|
-
quoteChangeId:
|
|
22356
|
+
quoteChangeId: quoteChangeId.id,
|
|
22155
22357
|
priceListChargeId: featureAddon.id,
|
|
22156
|
-
startDate:
|
|
22358
|
+
startDate: quote === null || quote === void 0 ? void 0 : quote.startDate,
|
|
22157
22359
|
apiHost: apiHost,
|
|
22158
22360
|
token: token,
|
|
22159
22361
|
})];
|
|
@@ -22166,40 +22368,62 @@ var useQuoteUpdateFeatureAddon = function (quoteId, featureAddon) {
|
|
|
22166
22368
|
onSuccess: function (_a) {
|
|
22167
22369
|
var quoteCharge = _a.quoteCharge;
|
|
22168
22370
|
addedQuoteChargeId.current = quoteCharge.id;
|
|
22169
|
-
queryClient.
|
|
22170
|
-
|
|
22171
|
-
|
|
22172
|
-
|
|
22173
|
-
});
|
|
22371
|
+
queryClient.setQueryData(QueryKeyFactory.default.createObjectKey({
|
|
22372
|
+
objectName: 'editingQuote',
|
|
22373
|
+
id: quote === null || quote === void 0 ? void 0 : quote.id,
|
|
22374
|
+
token: token,
|
|
22375
|
+
}), quoteCharge.quoteChange.quote);
|
|
22174
22376
|
},
|
|
22175
|
-
}), quoteChargeCreateMutation =
|
|
22176
|
-
var
|
|
22377
|
+
}), quoteChargeCreateMutation = _b.mutate, isCreatingFeatureAddon = _b.isPending;
|
|
22378
|
+
var _c = useMutation({
|
|
22177
22379
|
mutationFn: function (_a) {
|
|
22178
22380
|
var quoteChargeId = _a.quoteChargeId;
|
|
22179
|
-
return
|
|
22381
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
22382
|
+
var response;
|
|
22383
|
+
return __generator(this, function (_b) {
|
|
22384
|
+
switch (_b.label) {
|
|
22385
|
+
case 0: return [4 /*yield*/, quoteChargeDelete({ quoteChargeId: quoteChargeId, token: token, apiHost: apiHost })];
|
|
22386
|
+
case 1:
|
|
22387
|
+
response = _b.sent();
|
|
22388
|
+
return [2 /*return*/, { quoteCharge: response }];
|
|
22389
|
+
}
|
|
22390
|
+
});
|
|
22391
|
+
});
|
|
22180
22392
|
},
|
|
22181
|
-
onSuccess: function () {
|
|
22393
|
+
onSuccess: function (_a) {
|
|
22394
|
+
var quoteCharge = _a.quoteCharge;
|
|
22182
22395
|
addedQuoteChargeId.current = undefined;
|
|
22183
|
-
queryClient.
|
|
22184
|
-
|
|
22185
|
-
|
|
22186
|
-
|
|
22187
|
-
});
|
|
22396
|
+
queryClient.setQueryData(QueryKeyFactory.default.createObjectKey({
|
|
22397
|
+
objectName: 'editingQuote',
|
|
22398
|
+
id: quote === null || quote === void 0 ? void 0 : quote.id,
|
|
22399
|
+
token: token,
|
|
22400
|
+
}), quoteCharge.quoteChange.quote);
|
|
22188
22401
|
},
|
|
22189
|
-
}), quoteChargeDeleteMutation =
|
|
22402
|
+
}), quoteChargeDeleteMutation = _c.mutate, isDeletingFeatureAddon = _c.isPending;
|
|
22403
|
+
var isPending = isCreatingFeatureAddon || isDeletingFeatureAddon;
|
|
22190
22404
|
useEffect(function () {
|
|
22191
22405
|
// If the quoteId changes, then its because we changed pricelists, so we need to reset the addedQuoteChargeId
|
|
22192
22406
|
// so that isChecked becomes false
|
|
22193
22407
|
addedQuoteChargeId.current = undefined;
|
|
22194
|
-
}, [
|
|
22408
|
+
}, [quote === null || quote === void 0 ? void 0 : quote.id]);
|
|
22409
|
+
useEffect(function () {
|
|
22410
|
+
if (isPending) {
|
|
22411
|
+
addFeatureAddonLoading(featureAddon.id);
|
|
22412
|
+
}
|
|
22413
|
+
else {
|
|
22414
|
+
removeFeatureAddonLoading(featureAddon.id);
|
|
22415
|
+
}
|
|
22416
|
+
return function () {
|
|
22417
|
+
removeFeatureAddonLoading(featureAddon.id);
|
|
22418
|
+
};
|
|
22419
|
+
}, [isPending]);
|
|
22195
22420
|
return {
|
|
22196
22421
|
handleAddFeatureAddon: handleAddFeatureAddon,
|
|
22197
22422
|
handleRemoveFeatureAddon: handleRemoveFeatureAddon,
|
|
22198
|
-
isPending:
|
|
22423
|
+
isPending: isPending,
|
|
22199
22424
|
isChecked: isDeletingFeatureAddon
|
|
22200
22425
|
? false
|
|
22201
22426
|
: Boolean(addedQuoteChargeId.current || isCreatingFeatureAddon),
|
|
22202
|
-
editingQuoteLoaded: editingQuote !== undefined,
|
|
22203
22427
|
};
|
|
22204
22428
|
};
|
|
22205
22429
|
|
|
@@ -22237,23 +22461,23 @@ function FeatureAddonsList(_a) {
|
|
|
22237
22461
|
}) }));
|
|
22238
22462
|
}
|
|
22239
22463
|
function FeatureAddonRow(_a) {
|
|
22240
|
-
var _b
|
|
22464
|
+
var _b;
|
|
22241
22465
|
var featureAddon = _a.featureAddon, priceList = _a.priceList;
|
|
22242
|
-
var quotePreviewData = useContext(QuotePreviewContext).quotePreviewData;
|
|
22243
22466
|
var upgradingSubscription = useContext(SubscriptionsContext).upgradingSubscription;
|
|
22244
|
-
var
|
|
22467
|
+
var _c = useContext(QuoteContext), quote = _c.quote, selectedPriceList = _c.selectedPriceList;
|
|
22468
|
+
var _d = useQuoteUpdateFeatureAddon(quote, featureAddon), handleAddFeatureAddon = _d.handleAddFeatureAddon, handleRemoveFeatureAddon = _d.handleRemoveFeatureAddon, isPending = _d.isPending, isChecked = _d.isChecked;
|
|
22245
22469
|
var brandColor = useContext(BrandContext).brandColor;
|
|
22246
|
-
var isPriceListSelected = (
|
|
22470
|
+
var isPriceListSelected = (selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id) === priceList.id;
|
|
22247
22471
|
var isPurchased = isAddonPurchased(featureAddon, upgradingSubscription);
|
|
22248
22472
|
var isDisabled = !isPriceListSelected || isPurchased;
|
|
22249
22473
|
var checked = isChecked || isPurchased;
|
|
22250
22474
|
var tooltipContent = (jsxs(Fragment, { children: [jsx("div", { children: formatCurrency(featureAddon.basePrice, priceList.currencyId) }), featureAddon.chargeType === ChargeType.RECURRING && (jsx("div", { children: PriceDescriptionString({
|
|
22251
|
-
unitName: (
|
|
22475
|
+
unitName: (_b = featureAddon.feature) === null || _b === void 0 ? void 0 : _b.unitName,
|
|
22252
22476
|
showPriceAsMonthly: priceList.showPriceAsMonthly,
|
|
22253
22477
|
periodMonths: priceList.periodMonths,
|
|
22254
22478
|
doesPlanHaveFlatFeeCharges: false,
|
|
22255
22479
|
}) }))] }));
|
|
22256
|
-
return (jsxs("div", __assign({ className: "bunny-flex bunny-flex-row bunny-flex-wrap bunny-items-center bunny-justify-between bunny-gap-1" }, { children: [jsxs("div", __assign({ className: "bunny-flex bunny-flex-row bunny-items-center bunny-gap-1" }, { children: [jsxs("div", __assign({ className: "bunny-flex bunny-gap-1 bunny-text-gray-600", style: { fontSize: '13px' } }, { children: [checked ? (jsx(CheckIcon, { backgroundColor: brandColor, size: "15px" })) : (jsx(CheckIcon, { backgroundColor: SLATE_200, size: "15px" })), featureAddon.name] })), jsx(Tooltip, __assign({ title: tooltipContent }, { children: jsx(InfoCircleOutlined, { className: "bunny-text-gray-500", size: 15 }) }))] })), jsx(Switch, { size: "small", loading: isPending, disabled: isDisabled || !
|
|
22480
|
+
return (jsxs("div", __assign({ className: "bunny-flex bunny-flex-row bunny-flex-wrap bunny-items-center bunny-justify-between bunny-gap-1" }, { children: [jsxs("div", __assign({ className: "bunny-flex bunny-flex-row bunny-items-center bunny-gap-1" }, { children: [jsxs("div", __assign({ className: "bunny-flex bunny-gap-1 bunny-text-gray-600", style: { fontSize: '13px' } }, { children: [checked ? (jsx(CheckIcon, { backgroundColor: brandColor, size: "15px" })) : (jsx(CheckIcon, { backgroundColor: SLATE_200, size: "15px" })), featureAddon.name] })), jsx(Tooltip, __assign({ title: tooltipContent }, { children: jsx(InfoCircleOutlined, { className: "bunny-text-gray-500", size: 15 }) }))] })), jsx(Switch, { id: featureAddonSwitchTestId(featureAddon), size: "small", loading: isPending, disabled: isDisabled || !quote, checked: checked, onChange: function (checked) {
|
|
22257
22481
|
if (checked) {
|
|
22258
22482
|
handleAddFeatureAddon();
|
|
22259
22483
|
}
|
|
@@ -22283,23 +22507,169 @@ var filterUniqueFeatures = function (_a) {
|
|
|
22283
22507
|
return updatedPriceLists;
|
|
22284
22508
|
};
|
|
22285
22509
|
var EverythingPlanFeatures = function (_a) {
|
|
22286
|
-
var displayPriceLists = _a.displayPriceLists, selectedProduct = _a.selectedProduct, plansToDisplay = _a.plansToDisplay;
|
|
22510
|
+
var displayPriceLists = _a.displayPriceLists, selectedProduct = _a.selectedProduct, plansToDisplay = _a.plansToDisplay, _b = _a.hideBorder, hideBorder = _b === void 0 ? false : _b;
|
|
22287
22511
|
var brandColor = useContext(BrandContext).brandColor;
|
|
22288
22512
|
var uniquePlanFeatures = filterUniqueFeatures({ availablePriceLists: displayPriceLists });
|
|
22289
22513
|
return (jsx(Fragment, { children: __spreadArray([], Array(plansToDisplay), true).map(function (_, planIndex) {
|
|
22290
22514
|
var priceList = uniquePlanFeatures[planIndex];
|
|
22291
22515
|
var prevPriceList = displayPriceLists[planIndex - 1];
|
|
22292
22516
|
if (!priceList)
|
|
22293
|
-
return (jsx("div", { style: prevPriceList ? { borderLeft: "1px solid ".concat(SLATE_200) } : {} }, planIndex));
|
|
22517
|
+
return (jsx("div", { style: prevPriceList && !hideBorder ? { borderLeft: "1px solid ".concat(SLATE_200) } : {} }, planIndex));
|
|
22294
22518
|
if (!priceList.plan.planFeatures)
|
|
22295
22519
|
return (jsxs("div", { children: [jsx(FeatureAddonsList, { priceList: priceList }), ";"] }, planIndex));
|
|
22296
|
-
return (jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-gap-4 bunny-p-4", style: { borderLeft: "1px solid ".concat(SLATE_200) } }, { children: [priceList.plan.planFeatures.map(function (planFeature, planFeatureIndex) {
|
|
22520
|
+
return (jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-gap-4 bunny-p-4", style: !hideBorder ? { borderLeft: "1px solid ".concat(SLATE_200) } : {} }, { children: [priceList.plan.planFeatures.map(function (planFeature, planFeatureIndex) {
|
|
22297
22521
|
var everythingInPlus = selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.everythingInPlus;
|
|
22298
22522
|
return (jsxs("div", __assign({ className: "bunny-contents" }, { children: [prevPriceList && everythingInPlus && planIndex > 0 && planFeatureIndex === 0 && (jsx("div", __assign({ className: "bunny-font-medium", style: { fontSize: '13px' } }, { children: everythingInPlusString({ priceList: prevPriceList }) }))), jsxs("div", __assign({ className: "bunny-flex bunny-gap-1 bunny-text-gray-600", style: { fontSize: '13px' } }, { children: [jsx(CheckIcon, { backgroundColor: brandColor, size: "15px" }), planFeature.feature.name] }))] }), planFeatureIndex));
|
|
22299
22523
|
}), jsx(FeatureAddonsList, { priceList: priceList })] }), planIndex));
|
|
22300
22524
|
}) }));
|
|
22301
22525
|
};
|
|
22302
22526
|
|
|
22527
|
+
var QUOTE_CHANGE_DELETE = "\n".concat(QUOTE_FIELDS(), "\n mutation QuoteChangeDelete($id: ID!) {\n quoteChangeDelete(id: $id) {\n errors\n quoteChange {\n quote {\n ...QuoteFields\n }\n }\n }\n }\n");
|
|
22528
|
+
var quoteChangeDelete = function (_a) {
|
|
22529
|
+
var id = _a.id, apiHost = _a.apiHost, token = _a.token;
|
|
22530
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
22531
|
+
var vars, response, errors;
|
|
22532
|
+
var _b;
|
|
22533
|
+
return __generator(this, function (_c) {
|
|
22534
|
+
switch (_c.label) {
|
|
22535
|
+
case 0:
|
|
22536
|
+
vars = {
|
|
22537
|
+
id: id,
|
|
22538
|
+
};
|
|
22539
|
+
return [4 /*yield*/, gqlRequest({
|
|
22540
|
+
query: QUOTE_CHANGE_DELETE,
|
|
22541
|
+
token: token,
|
|
22542
|
+
vars: vars,
|
|
22543
|
+
apiHost: apiHost,
|
|
22544
|
+
})];
|
|
22545
|
+
case 1:
|
|
22546
|
+
response = _c.sent();
|
|
22547
|
+
errors = (_b = response === null || response === void 0 ? void 0 : response.quoteChangeDelete) === null || _b === void 0 ? void 0 : _b.errors;
|
|
22548
|
+
if (errors)
|
|
22549
|
+
throw errors;
|
|
22550
|
+
return [2 /*return*/, response.quoteChangeDelete];
|
|
22551
|
+
}
|
|
22552
|
+
});
|
|
22553
|
+
});
|
|
22554
|
+
};
|
|
22555
|
+
|
|
22556
|
+
var QUOTE_CHANGE_CREATE = "\n".concat(QUOTE_FIELDS(), "\nmutation QuoteChangeCreate(\n $quoteId: ID!\n $priceListId: ID!\n $parentQuoteChangeId: ID!\n) {\n quoteChangeCreate(\n quoteId: $quoteId\n priceListId: $priceListId\n parentQuoteChangeId: $parentQuoteChangeId\n ) {\n errors\n quoteChange {\n id\n quote {\n ...QuoteFields\n }\n }\n }\n}\n");
|
|
22557
|
+
var quoteChangeCreate = function (_a) {
|
|
22558
|
+
var parentQuoteChangeId = _a.parentQuoteChangeId, priceListId = _a.priceListId, apiHost = _a.apiHost, token = _a.token, quoteId = _a.quoteId;
|
|
22559
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
22560
|
+
var vars, response, errors;
|
|
22561
|
+
var _b;
|
|
22562
|
+
return __generator(this, function (_c) {
|
|
22563
|
+
switch (_c.label) {
|
|
22564
|
+
case 0:
|
|
22565
|
+
vars = {
|
|
22566
|
+
parentQuoteChangeId: parentQuoteChangeId,
|
|
22567
|
+
priceListId: priceListId,
|
|
22568
|
+
quoteId: quoteId,
|
|
22569
|
+
};
|
|
22570
|
+
return [4 /*yield*/, gqlRequest({
|
|
22571
|
+
query: QUOTE_CHANGE_CREATE,
|
|
22572
|
+
token: token,
|
|
22573
|
+
vars: vars,
|
|
22574
|
+
apiHost: apiHost,
|
|
22575
|
+
})];
|
|
22576
|
+
case 1:
|
|
22577
|
+
response = _c.sent();
|
|
22578
|
+
errors = (_b = response === null || response === void 0 ? void 0 : response.quoteChangeCreate) === null || _b === void 0 ? void 0 : _b.errors;
|
|
22579
|
+
if (errors)
|
|
22580
|
+
throw errors;
|
|
22581
|
+
return [2 /*return*/, response.quoteChangeCreate];
|
|
22582
|
+
}
|
|
22583
|
+
});
|
|
22584
|
+
});
|
|
22585
|
+
};
|
|
22586
|
+
|
|
22587
|
+
var useToggleAddonPlan = function (quote, plan, billingPeriod, selectedPriceList, setIsAddonPlanLoading) {
|
|
22588
|
+
var token = useToken();
|
|
22589
|
+
var isAdded = useRef(false);
|
|
22590
|
+
var queryClient = useQueryClient();
|
|
22591
|
+
var apiHost = useContext(BunnyContext).apiHost;
|
|
22592
|
+
var parentQuoteChange = useMemo(function () {
|
|
22593
|
+
return quote === null || quote === void 0 ? void 0 : quote.quoteChanges.find(function (qc) { return qc.priceList.id === selectedPriceList.id; });
|
|
22594
|
+
}, [quote, selectedPriceList]);
|
|
22595
|
+
var _a = useMutation({
|
|
22596
|
+
mutationFn: quoteChangeCreate,
|
|
22597
|
+
onSuccess: function (quoteChangeCreate) {
|
|
22598
|
+
isAdded.current = true;
|
|
22599
|
+
var updatedQuote = quoteChangeCreate.quoteChange.quote;
|
|
22600
|
+
queryClient.setQueryData(QueryKeyFactory.default.createObjectKey({
|
|
22601
|
+
objectName: 'editingQuote',
|
|
22602
|
+
id: quote === null || quote === void 0 ? void 0 : quote.id,
|
|
22603
|
+
token: token,
|
|
22604
|
+
}), updatedQuote);
|
|
22605
|
+
},
|
|
22606
|
+
}), addAddonQuoteChange = _a.mutate, isAddingAddonQuoteChange = _a.isPending;
|
|
22607
|
+
var _b = useMutation({
|
|
22608
|
+
mutationFn: quoteChangeDelete,
|
|
22609
|
+
onSuccess: function (quoteChangeDelete) {
|
|
22610
|
+
isAdded.current = false;
|
|
22611
|
+
var updatedQuote = quoteChangeDelete.quoteChange.quote;
|
|
22612
|
+
queryClient.setQueryData(QueryKeyFactory.default.createObjectKey({
|
|
22613
|
+
objectName: 'editingQuote',
|
|
22614
|
+
id: quote === null || quote === void 0 ? void 0 : quote.id,
|
|
22615
|
+
token: token,
|
|
22616
|
+
}), updatedQuote);
|
|
22617
|
+
},
|
|
22618
|
+
}), deleteQuoteChange = _b.mutate, isDeletingQuoteChange = _b.isPending;
|
|
22619
|
+
function handleAddAddonQuoteChange() {
|
|
22620
|
+
if (!parentQuoteChange) {
|
|
22621
|
+
throw new Error('Parent quote change not found');
|
|
22622
|
+
}
|
|
22623
|
+
var priceList = plan.priceLists.find(function (pl) { return pl.periodMonths === billingPeriod; });
|
|
22624
|
+
if (!priceList) {
|
|
22625
|
+
throw new Error('Price list not found');
|
|
22626
|
+
}
|
|
22627
|
+
if (!(quote === null || quote === void 0 ? void 0 : quote.id)) {
|
|
22628
|
+
throw new Error('Quote ID not found');
|
|
22629
|
+
}
|
|
22630
|
+
addAddonQuoteChange({
|
|
22631
|
+
parentQuoteChangeId: parentQuoteChange.id,
|
|
22632
|
+
priceListId: priceList.id,
|
|
22633
|
+
apiHost: apiHost,
|
|
22634
|
+
token: token,
|
|
22635
|
+
quoteId: quote === null || quote === void 0 ? void 0 : quote.id,
|
|
22636
|
+
});
|
|
22637
|
+
}
|
|
22638
|
+
function handleDeleteQuoteChange() {
|
|
22639
|
+
var priceList = plan.priceLists.find(function (pl) { return pl.periodMonths === billingPeriod; });
|
|
22640
|
+
if (!priceList) {
|
|
22641
|
+
throw new Error('Price list not found');
|
|
22642
|
+
}
|
|
22643
|
+
var quoteChange = quote === null || quote === void 0 ? void 0 : quote.quoteChanges.find(function (qc) { return qc.priceList.id === priceList.id; });
|
|
22644
|
+
if (!quoteChange) {
|
|
22645
|
+
throw new Error('Quote change not found');
|
|
22646
|
+
}
|
|
22647
|
+
deleteQuoteChange({
|
|
22648
|
+
id: quoteChange.id,
|
|
22649
|
+
apiHost: apiHost,
|
|
22650
|
+
token: token,
|
|
22651
|
+
});
|
|
22652
|
+
}
|
|
22653
|
+
useEffect(function () {
|
|
22654
|
+
if (isAddingAddonQuoteChange || isDeletingQuoteChange) {
|
|
22655
|
+
setIsAddonPlanLoading(true);
|
|
22656
|
+
}
|
|
22657
|
+
else {
|
|
22658
|
+
setIsAddonPlanLoading(false);
|
|
22659
|
+
}
|
|
22660
|
+
}, [isAddingAddonQuoteChange, isDeletingQuoteChange]);
|
|
22661
|
+
useEffect(function () {
|
|
22662
|
+
isAdded.current = false;
|
|
22663
|
+
setIsAddonPlanLoading(false);
|
|
22664
|
+
}, [selectedPriceList]);
|
|
22665
|
+
return {
|
|
22666
|
+
isPending: isAddingAddonQuoteChange || isDeletingQuoteChange || parentQuoteChange === undefined,
|
|
22667
|
+
addedQuoteChange: isAdded.current,
|
|
22668
|
+
deleteQuoteChange: handleDeleteQuoteChange,
|
|
22669
|
+
addAddonQuoteChange: handleAddAddonQuoteChange,
|
|
22670
|
+
};
|
|
22671
|
+
};
|
|
22672
|
+
|
|
22303
22673
|
var Text$a = Typography.Text;
|
|
22304
22674
|
var PlanFeatures = function (_a) {
|
|
22305
22675
|
var _b;
|
|
@@ -22350,8 +22720,97 @@ var FeatureTitle = function (_a) {
|
|
|
22350
22720
|
return (jsx(Text$a, __assign({ className: " ".concat(isFeatureGroup ? 'bunny-text-slate-500 bunny-font-medium bunny-pt-4' : ''), style: __assign({}, (isFeatureGroup ? { fontSize: '11px' } : {})) }, { children: isFeatureGroup ? (_b = feature === null || feature === void 0 ? void 0 : feature.name) === null || _b === void 0 ? void 0 : _b.toUpperCase() : feature === null || feature === void 0 ? void 0 : feature.name })));
|
|
22351
22721
|
};
|
|
22352
22722
|
|
|
22723
|
+
var showErrorNotification = useErrorNotification();
|
|
22724
|
+
var PlanAddonsCard = function (_a) {
|
|
22725
|
+
var selectedPriceList = _a.selectedPriceList, subscriptions = _a.subscriptions, addonPlans = _a.addonPlans, selectedProduct = _a.selectedProduct, priceListChangeOptions = _a.priceListChangeOptions, selectedBillingPeriod = _a.selectedBillingPeriod;
|
|
22726
|
+
var upgradingSubscription = useContext(SubscriptionsContext).upgradingSubscription;
|
|
22727
|
+
var _b = useState(), selectedAddonPriceList = _b[0], setSelectedAddonPriceList = _b[1];
|
|
22728
|
+
function isAddonPlanPurchased(plan) {
|
|
22729
|
+
var isChangingPlans = selectedPriceList.plan.id !== (upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.priceList.plan.id);
|
|
22730
|
+
if (isChangingPlans) {
|
|
22731
|
+
return false;
|
|
22732
|
+
}
|
|
22733
|
+
var currentSubscription = subscriptions.find(function (subscription) { return subscription.id === (upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id); });
|
|
22734
|
+
var addonSubscriptionIds = currentSubscription === null || currentSubscription === void 0 ? void 0 : currentSubscription.addonSubscriptions;
|
|
22735
|
+
var addonSubscriptions = addonSubscriptionIds === null || addonSubscriptionIds === void 0 ? void 0 : addonSubscriptionIds.map(function (addonSubscription) {
|
|
22736
|
+
return subscriptions.find(function (subscription) { return subscription.id === addonSubscription.id; });
|
|
22737
|
+
});
|
|
22738
|
+
// filter out cancelled addons
|
|
22739
|
+
var activeAddonSubscriptions = addonSubscriptions === null || addonSubscriptions === void 0 ? void 0 : addonSubscriptions.filter(function (addonSubscription) { return (addonSubscription === null || addonSubscription === void 0 ? void 0 : addonSubscription.state) !== SubscriptionState$2.CANCELED; });
|
|
22740
|
+
return activeAddonSubscriptions === null || activeAddonSubscriptions === void 0 ? void 0 : activeAddonSubscriptions.some(function (addonSubscription) { return (addonSubscription === null || addonSubscription === void 0 ? void 0 : addonSubscription.plan.id) === plan.id; });
|
|
22741
|
+
}
|
|
22742
|
+
return (jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-overflow-hidden" }, { children: [jsx(AddonPlanModal, { onClose: function () { return setSelectedAddonPriceList(undefined); }, selectedProduct: selectedProduct, priceList: selectedAddonPriceList }), addonPlans.length > 0 && (jsx("div", __assign({ className: "bunny-text-black bunny-pt-2 bunny-pb-4 bunny-font-bold" }, { children: "Add-on plans" }))), jsx("div", __assign({ className: "bunny-flex bunny-flex-col" }, { children: addonPlans.map(function (plan) {
|
|
22743
|
+
var isPurchased = isAddonPlanPurchased(plan);
|
|
22744
|
+
return (jsx(PlanAddonsCardRow, { plan: plan, selectedPriceList: selectedPriceList, setSelectedAddonPriceList: setSelectedAddonPriceList, isPurchased: isPurchased || false, selectedBillingPeriod: selectedBillingPeriod, priceListChangeOptions: priceListChangeOptions }));
|
|
22745
|
+
}) }))] })));
|
|
22746
|
+
};
|
|
22747
|
+
function PlanAddonsCardRow(_a) {
|
|
22748
|
+
var _b, _c;
|
|
22749
|
+
var plan = _a.plan, selectedPriceList = _a.selectedPriceList, setSelectedAddonPriceList = _a.setSelectedAddonPriceList, isPurchased = _a.isPurchased, selectedBillingPeriod = _a.selectedBillingPeriod, priceListChangeOptions = _a.priceListChangeOptions;
|
|
22750
|
+
var _d = useContext(QuoteContext), quote = _d.quote, setIsAddonPlanLoading = _d.setIsAddonPlanLoading;
|
|
22751
|
+
var _e = useToggleAddonPlan(quote, plan, billingPeriodConverter(selectedBillingPeriod), selectedPriceList, setIsAddonPlanLoading), isPending = _e.isPending, addedQuoteChange = _e.addedQuoteChange, addAddonQuoteChange = _e.addAddonQuoteChange, deleteQuoteChange = _e.deleteQuoteChange;
|
|
22752
|
+
var addonPriceListId = (_b = plan.priceLists.find(function (priceList) { return priceList.periodMonths === billingPeriodConverter(selectedBillingPeriod); })) === null || _b === void 0 ? void 0 : _b.id;
|
|
22753
|
+
var addonPriceList = priceListChangeOptions === null || priceListChangeOptions === void 0 ? void 0 : priceListChangeOptions.priceLists.find(function (priceList) { return priceList.id === addonPriceListId; });
|
|
22754
|
+
var activeCharge = (_c = getActivePlanPriceData(addonPriceList, addonPriceList)) === null || _c === void 0 ? void 0 : _c.activeCharge;
|
|
22755
|
+
if (!addonPriceList) {
|
|
22756
|
+
showErrorNotification('Addon price list not found', 'Client Error');
|
|
22757
|
+
return null;
|
|
22758
|
+
}
|
|
22759
|
+
return (jsxs("div", __assign({ className: "bunny-flex bunny-flex-row bunny-gap-2 bunny-justify-between bunny-items-center bunny-w-full bunny-p-4 bunny-rounded-md bunny-border bunny-bg-white bunny-shadow bunny-mb-2" }, { children: [jsxs("div", __assign({ className: "bunny-flex bunny-flex-row bunny-gap-2 bunny-items-center" }, { children: [jsx("div", __assign({ className: "bunny-font-medium bunny-text-center bunny-text-orange-600", style: { fontSize: '16px' } }, { children: plan.name })), jsx(PriceListCardDescription, { description: plan.description }), jsx(PriceListCardPrice, { priceList: addonPriceList, fontSize: "16px" }), jsx(PriceListCardPriceDescription, { feature: activeCharge === null || activeCharge === void 0 ? void 0 : activeCharge.feature, priceList: addonPriceList }), jsx(Button, __assign({ type: "link", onClick: function () { return setSelectedAddonPriceList(addonPriceList); } }, { children: jsx(InfoCircleOutlined, {}) }))] })), jsx(Switch, { id: addonPlanSwitchTestId(plan), loading: isPending, checked: addedQuoteChange || isPurchased, onChange: function (checked) {
|
|
22760
|
+
if (checked) {
|
|
22761
|
+
addAddonQuoteChange();
|
|
22762
|
+
}
|
|
22763
|
+
else {
|
|
22764
|
+
deleteQuoteChange();
|
|
22765
|
+
}
|
|
22766
|
+
}, disabled: isPurchased })] }), plan.id));
|
|
22767
|
+
}
|
|
22768
|
+
function AddonPlanModal(_a) {
|
|
22769
|
+
var onClose = _a.onClose, selectedProduct = _a.selectedProduct, priceList = _a.priceList;
|
|
22770
|
+
var displayPriceLists = priceList ? [priceList] : [];
|
|
22771
|
+
var plansToDisplay = 1;
|
|
22772
|
+
return (jsx(Modal, __assign({ open: !!priceList, onCancel: onClose, footer: null }, { children: jsxs("div", __assign({ className: "bunny-grid bunny-w-full", style: {
|
|
22773
|
+
gridTemplateColumns: "minmax(auto, 200px) repeat(".concat(plansToDisplay, ", minmax(200px, 1fr))"),
|
|
22774
|
+
} }, { children: [jsx(PlanPickerGridCell, { noBorder: true }), priceList && (jsx(PriceListCard, { isSelected: true, priceList: priceList, noBorder: true, hideButton: true })), (selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.everythingInPlus) ? (jsx(EverythingPlanFeatures, { displayPriceLists: displayPriceLists, plansToDisplay: 1, selectedProduct: selectedProduct, hideBorder: true })) : (jsx(PlanFeatures, { displayPriceLists: displayPriceLists, plansToDisplay: 1, selectedProduct: selectedProduct }))] })) })));
|
|
22775
|
+
}
|
|
22776
|
+
|
|
22777
|
+
var ADDON_PLANS_QUERY = function () { return "\n query PriceList($id: ID!) {\n priceList (id: $id) {\n addonPlans {\n addon\n basePrice\n code\n contactUsLabel\n contactUsUrl\n description\n id\n isVisible\n name\n position\n pricingDescription\n pricingStyle\n productId\n selfServiceBuy\n selfServiceCancel\n selfServiceRenew\n priceLists {\n id\n periodMonths\n showPriceAsMonthly\n monthlyBasePrice\n basePrice\n currencyId\n plan {\n pricingStyle\n }\n }\n planFeatures {\n featureId\n value\n feature {\n name\n }\n }\n }\n }\n }\n"; };
|
|
22778
|
+
var getAddonPlans = function (_a) {
|
|
22779
|
+
var token = _a.token, id = _a.id, apiHost = _a.apiHost;
|
|
22780
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
22781
|
+
var response;
|
|
22782
|
+
var _b;
|
|
22783
|
+
return __generator(this, function (_c) {
|
|
22784
|
+
switch (_c.label) {
|
|
22785
|
+
case 0: return [4 /*yield*/, gqlRequest({
|
|
22786
|
+
query: ADDON_PLANS_QUERY(),
|
|
22787
|
+
token: token,
|
|
22788
|
+
vars: { id: id },
|
|
22789
|
+
apiHost: apiHost,
|
|
22790
|
+
})];
|
|
22791
|
+
case 1:
|
|
22792
|
+
response = _c.sent();
|
|
22793
|
+
return [2 /*return*/, (_b = response === null || response === void 0 ? void 0 : response.priceList) === null || _b === void 0 ? void 0 : _b.addonPlans];
|
|
22794
|
+
}
|
|
22795
|
+
});
|
|
22796
|
+
});
|
|
22797
|
+
};
|
|
22798
|
+
|
|
22353
22799
|
var PriceListGridDesktop = function (_a) {
|
|
22354
|
-
var availablePriceLists = _a.availablePriceLists,
|
|
22800
|
+
var availablePriceLists = _a.availablePriceLists, priceListChangeOptions = _a.priceListChangeOptions, priceListStart = _a.priceListStart, selectedPriceList = _a.selectedPriceList, selectedProduct = _a.selectedProduct, setPriceListStart = _a.setPriceListStart, subscriptions = _a.subscriptions, trialRemainingDays = _a.trialRemainingDays, selectedBillingPeriod = _a.selectedBillingPeriod, onClickPriceListCard = _a.onClickPriceListCard;
|
|
22801
|
+
var token = useToken();
|
|
22802
|
+
var apiHost = useContext(BunnyContext).apiHost;
|
|
22803
|
+
var addonPlans = useQuery({
|
|
22804
|
+
queryKey: ['addonPlans', selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id],
|
|
22805
|
+
queryFn: function () {
|
|
22806
|
+
if (!(selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id)) {
|
|
22807
|
+
throw new Error('Selected price list ID is required');
|
|
22808
|
+
}
|
|
22809
|
+
var addonPlans = getAddonPlans({ id: selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id, token: token, apiHost: apiHost });
|
|
22810
|
+
return addonPlans;
|
|
22811
|
+
},
|
|
22812
|
+
enabled: !!(selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id),
|
|
22813
|
+
}).data;
|
|
22355
22814
|
var displayPriceLists = useMemo(function () {
|
|
22356
22815
|
return getAvailablePlansAndPriceLists({
|
|
22357
22816
|
availablePriceLists: availablePriceLists,
|
|
@@ -22365,17 +22824,17 @@ var PriceListGridDesktop = function (_a) {
|
|
|
22365
22824
|
var hasFeatureAddons = displayPriceLists.some(function (priceList) {
|
|
22366
22825
|
return priceList.charges.some(function (charge) { return charge.featureAddon; });
|
|
22367
22826
|
});
|
|
22368
|
-
return (jsxs("div", __assign({ className: "bunny-relative bunny-flex bunny-flex-col bunny-rounded-md bunny-shadow bunny-overflow-hidden bunny-bg-white" }, { children: [jsx(NextPriceListButton, { availablePriceLists: availablePriceLists, numberOfPlansToDisplay: plansToDisplay, priceListStart: priceListStart, setPriceListStart: setPriceListStart }), jsxs("div", __assign({ className: "bunny-grid bunny-w-full", style: {
|
|
22369
|
-
|
|
22370
|
-
|
|
22371
|
-
|
|
22372
|
-
|
|
22373
|
-
|
|
22374
|
-
|
|
22375
|
-
|
|
22376
|
-
|
|
22377
|
-
|
|
22378
|
-
|
|
22827
|
+
return (jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-gap-2" }, { children: [jsxs("div", __assign({ className: "bunny-relative bunny-flex bunny-flex-col bunny-rounded-md bunny-shadow bunny-overflow-hidden bunny-bg-white" }, { children: [jsx(NextPriceListButton, { availablePriceLists: availablePriceLists, numberOfPlansToDisplay: plansToDisplay, priceListStart: priceListStart, setPriceListStart: setPriceListStart }), jsxs("div", __assign({ className: "bunny-grid bunny-w-full", style: {
|
|
22828
|
+
gridTemplateColumns: everythingInPlus
|
|
22829
|
+
? "repeat(".concat(plansToDisplay, ", minmax(120px, 1fr))")
|
|
22830
|
+
: "minmax(auto, 400px) repeat(".concat(plansToDisplay, ", minmax(120px, 1fr))"),
|
|
22831
|
+
} }, { children: [!everythingInPlus && jsx(PlanPickerGridCell, { noBorder: true }), __spreadArray([], Array(plansToDisplay), true).map(function (_, index) {
|
|
22832
|
+
var priceList = displayPriceLists[index];
|
|
22833
|
+
var doesPrevPriceListExist = displayPriceLists[index - 1];
|
|
22834
|
+
if (!priceList)
|
|
22835
|
+
return jsx(PlanPickerGridCell, { noBorder: !Boolean(doesPrevPriceListExist) }, index);
|
|
22836
|
+
return (jsx(PriceListCard, { onClickPriceListCard: onClickPriceListCard, isSelected: priceList.id === (selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id), priceList: priceList, subscriptions: subscriptions, trialRemainingDays: trialRemainingDays }, index));
|
|
22837
|
+
}), (selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.everythingInPlus) ? (jsx(EverythingPlanFeatures, { displayPriceLists: displayPriceLists, plansToDisplay: plansToDisplay, selectedProduct: selectedProduct })) : (jsxs(Fragment, { children: [jsx(PlanFeatures, { displayPriceLists: displayPriceLists, plansToDisplay: plansToDisplay, selectedProduct: selectedProduct }), hasFeatureAddons && (jsx(PlanFeatureAddons, { displayPriceLists: displayPriceLists, plansToDisplay: plansToDisplay }))] }))] }))] })), selectedPriceList && addonPlans && selectedBillingPeriod ? (jsx(PlanAddonsCard, { selectedPriceList: selectedPriceList, subscriptions: subscriptions, addonPlans: addonPlans, selectedProduct: selectedProduct, priceListChangeOptions: priceListChangeOptions, selectedBillingPeriod: selectedBillingPeriod })) : null] })));
|
|
22379
22838
|
};
|
|
22380
22839
|
|
|
22381
22840
|
var Text$9 = Typography.Text;
|
|
@@ -22389,42 +22848,46 @@ var PriceListCardFeature = function (_a) {
|
|
|
22389
22848
|
|
|
22390
22849
|
var PriceListGridMobile = function (_a) {
|
|
22391
22850
|
var _b, _c, _d, _e;
|
|
22392
|
-
var availablePriceLists = _a.availablePriceLists,
|
|
22851
|
+
var availablePriceLists = _a.availablePriceLists, priceListChangeOptions = _a.priceListChangeOptions, selectedPriceList = _a.selectedPriceList, selectedProduct = _a.selectedProduct, subscriptions = _a.subscriptions, trialRemainingDays = _a.trialRemainingDays, onClickPriceListCard = _a.onClickPriceListCard;
|
|
22393
22852
|
var everythingInPlus = selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.everythingInPlus;
|
|
22394
22853
|
var prevPriceListIndex = availablePriceLists.findIndex(function (priceList) { return priceList.id === (selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id); });
|
|
22395
22854
|
var prevPriceListId = (_b = availablePriceLists[prevPriceListIndex - 1]) === null || _b === void 0 ? void 0 : _b.id;
|
|
22396
22855
|
var prevPriceList = (_c = priceListChangeOptions === null || priceListChangeOptions === void 0 ? void 0 : priceListChangeOptions.priceLists) === null || _c === void 0 ? void 0 : _c.find(function (priceList) { return priceList.id === prevPriceListId; });
|
|
22397
22856
|
return (jsxs(Fragment, { children: [jsx("div", __assign({ className: "bunny-flex bunny-gap-4 bunny-overflow-auto bunny-shadow-padding-xb", style: { flexShrink: 0 } }, { children: availablePriceLists.map(function (priceList, index) {
|
|
22398
|
-
return (jsx(PriceListCard, { isSelected: priceList.id === (selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id),
|
|
22857
|
+
return (jsx(PriceListCard, { isSelected: priceList.id === (selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id), priceList: priceList, subscriptions: subscriptions, trialRemainingDays: trialRemainingDays, onClickPriceListCard: onClickPriceListCard }, index));
|
|
22399
22858
|
}) })), jsx("div", __assign({ className: "bunny-text-slate-500 bunny-pt-5 bunny-pb-4 bunny-shadow-padding-x" }, { children: everythingInPlus && prevPriceList
|
|
22400
22859
|
? everythingInPlusString({ priceList: prevPriceList })
|
|
22401
|
-
:
|
|
22860
|
+
: 'Features' })), jsx("div", __assign({ className: "bunny-flex bunny-flex-col bunny-gap-4 bunny-overflow-auto bunny-shadow-padding-x" }, { children: (_e = (_d = selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.plan) === null || _d === void 0 ? void 0 : _d.planFeatures) === null || _e === void 0 ? void 0 : _e.map(function (planFeature, index) { return (jsx(PriceListCardFeature, { planFeature: planFeature, index: index }, index)); }) }))] }));
|
|
22402
22861
|
};
|
|
22403
22862
|
|
|
22404
22863
|
var PriceListGrid = function (_a) {
|
|
22405
22864
|
var _b, _c;
|
|
22406
|
-
var availablePriceLists = _a.availablePriceLists,
|
|
22865
|
+
var availablePriceLists = _a.availablePriceLists, priceListChangeOptions = _a.priceListChangeOptions, priceListStart = _a.priceListStart, selectedPriceList = _a.selectedPriceList, selectedProduct = _a.selectedProduct, setPriceListStart = _a.setPriceListStart, subscriptions = _a.subscriptions, upgradingSubscriptionState = _a.upgradingSubscriptionState, selectedBillingPeriod = _a.selectedBillingPeriod, onClickPriceListCard = _a.onClickPriceListCard;
|
|
22407
22866
|
// Hooks
|
|
22408
22867
|
var isMobile = useIsMobile();
|
|
22409
22868
|
// Derived state
|
|
22410
22869
|
var currentPriceList = (_b = priceListChangeOptions === null || priceListChangeOptions === void 0 ? void 0 : priceListChangeOptions.priceLists) === null || _b === void 0 ? void 0 : _b.find(function (priceList) { var _a; return priceList.id === ((_a = upgradingSubscriptionState === null || upgradingSubscriptionState === void 0 ? void 0 : upgradingSubscriptionState.plan) === null || _a === void 0 ? void 0 : _a.id); });
|
|
22411
22870
|
var trialRemainingDays = dayjs((_c = currentPriceList === null || currentPriceList === void 0 ? void 0 : currentPriceList.plan) === null || _c === void 0 ? void 0 : _c.trialEndDate).diff(dayjs(), 'days');
|
|
22412
|
-
return isMobile ? (jsx(PriceListGridMobile, { availablePriceLists: availablePriceLists,
|
|
22871
|
+
return isMobile ? (jsx(PriceListGridMobile, { availablePriceLists: availablePriceLists, priceListChangeOptions: priceListChangeOptions, selectedPriceList: selectedPriceList, selectedProduct: selectedProduct, subscriptions: subscriptions, trialRemainingDays: trialRemainingDays,
|
|
22872
|
+
// TODO: add selectedBillingPeriod={selectedBillingPeriod} here too (ignore for now, mobile won't ever show this currently)
|
|
22873
|
+
onClickPriceListCard: onClickPriceListCard })) : (jsx(PriceListGridDesktop, { availablePriceLists: availablePriceLists, priceListChangeOptions: priceListChangeOptions, priceListStart: priceListStart, selectedPriceList: selectedPriceList, selectedProduct: selectedProduct, setPriceListStart: setPriceListStart, subscriptions: subscriptions, trialRemainingDays: trialRemainingDays, selectedBillingPeriod: selectedBillingPeriod, onClickPriceListCard: onClickPriceListCard }));
|
|
22413
22874
|
};
|
|
22414
22875
|
|
|
22415
22876
|
var createAvailableBillingPeriods = function (priceLists, selectedProduct) {
|
|
22416
22877
|
return priceLists === null || priceLists === void 0 ? void 0 : priceLists.filter(function (priceList) { return priceList.product.id === (selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.id); }).map(function (priceList) { return priceList.periodMonths; }).sort(function (a, b) { return a - b; }).filter(function (currentValue, index, array) { return index === array.indexOf(currentValue); });
|
|
22417
22878
|
};
|
|
22879
|
+
var showInfoNotification = useInfoNotification();
|
|
22418
22880
|
var PriceListSelector = function (_a) {
|
|
22419
|
-
var
|
|
22881
|
+
var _b;
|
|
22882
|
+
var arePlanChangeOptionsLoading = _a.arePlanChangeOptionsLoading, areSubscriptionsLoading = _a.areSubscriptionsLoading, priceListChangeOptions = _a.priceListChangeOptions, subscriptions = _a.subscriptions;
|
|
22420
22883
|
// Context
|
|
22421
22884
|
var isInPreviewMode = useContext(SubscriptionsContext).isInPreviewMode;
|
|
22422
|
-
var
|
|
22885
|
+
var _c = useContext(QuoteContext), selectedPriceList = _c.selectedPriceList, onChangeSelectedPriceList = _c.onChangeSelectedPriceList, onClearQuote = _c.onClearQuote;
|
|
22423
22886
|
var upgradingSubscription = useContext(SubscriptionsContext).upgradingSubscription;
|
|
22424
22887
|
// Local state
|
|
22425
|
-
var
|
|
22426
|
-
var
|
|
22427
|
-
var
|
|
22888
|
+
var _d = useState(), selectedProduct = _d[0], setSelectedProduct = _d[1];
|
|
22889
|
+
var _e = useState(), selectedBillingPeriod = _e[0], setSelectedBillingPeriod = _e[1];
|
|
22890
|
+
var _f = useState(0), priceListStart = _f[0], setPriceListStart = _f[1];
|
|
22428
22891
|
// Derived state
|
|
22429
22892
|
var availableBillingPeriods = useMemo(function () { return createAvailableBillingPeriods(priceListChangeOptions === null || priceListChangeOptions === void 0 ? void 0 : priceListChangeOptions.priceLists, selectedProduct); }, [priceListChangeOptions === null || priceListChangeOptions === void 0 ? void 0 : priceListChangeOptions.priceLists, selectedProduct]);
|
|
22430
22893
|
var availablePriceLists = useMemo(function () {
|
|
@@ -22432,40 +22895,36 @@ var PriceListSelector = function (_a) {
|
|
|
22432
22895
|
return (((_a = priceListChangeOptions === null || priceListChangeOptions === void 0 ? void 0 : priceListChangeOptions.priceLists) === null || _a === void 0 ? void 0 : _a.filter(function (priceList) {
|
|
22433
22896
|
return periodMonthsConverter(priceList.periodMonths) === selectedBillingPeriod &&
|
|
22434
22897
|
priceList.product.id === (selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.id);
|
|
22435
|
-
})) || []);
|
|
22898
|
+
}).filter(function (priceList) { return priceList.plan.addon !== true; })) || []);
|
|
22436
22899
|
}, [priceListChangeOptions, selectedBillingPeriod, selectedProduct]);
|
|
22437
22900
|
// Handlers
|
|
22438
22901
|
var onChangeBillingPeriod = useCallback(function (billingPeriod) {
|
|
22439
|
-
var _a
|
|
22902
|
+
var _a;
|
|
22440
22903
|
setSelectedBillingPeriod(billingPeriod);
|
|
22441
22904
|
setPriceListStart(0);
|
|
22442
|
-
if (
|
|
22443
|
-
billingPeriod !== periodMonthsConverter(
|
|
22444
|
-
var availablePriceLists_1 = ((
|
|
22905
|
+
if (selectedPriceList &&
|
|
22906
|
+
billingPeriod !== periodMonthsConverter(selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.periodMonths)) {
|
|
22907
|
+
var availablePriceLists_1 = ((_a = priceListChangeOptions === null || priceListChangeOptions === void 0 ? void 0 : priceListChangeOptions.priceLists) === null || _a === void 0 ? void 0 : _a.filter(function (priceList) { return periodMonthsConverter(priceList.periodMonths) === billingPeriod; })) || [];
|
|
22445
22908
|
var newSelectedPriceList = availablePriceLists_1.find(function (priceList) {
|
|
22446
|
-
var _a;
|
|
22447
22909
|
return periodMonthsConverter(priceList.periodMonths) === billingPeriod &&
|
|
22448
|
-
priceList.plan.id === (
|
|
22910
|
+
priceList.plan.id === (selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.plan.id) &&
|
|
22449
22911
|
!isPriceListDisabled({
|
|
22450
22912
|
priceList: priceList,
|
|
22451
22913
|
upgradingSubscription: upgradingSubscription,
|
|
22452
|
-
canPurchaseFeatureAddons: priceListHasUnpurchasedFeatureAddons(quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.priceList, upgradingSubscription),
|
|
22453
22914
|
});
|
|
22454
22915
|
});
|
|
22455
22916
|
var isPriceListCurrentSubscription = newSelectedPriceList && (upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.priceList.id) === newSelectedPriceList.id;
|
|
22456
22917
|
if (newSelectedPriceList && !isPriceListCurrentSubscription) {
|
|
22457
|
-
|
|
22458
|
-
priceList: newSelectedPriceList,
|
|
22459
|
-
quantity: calculateNewQuantity(newSelectedPriceList, quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.quantity),
|
|
22460
|
-
});
|
|
22918
|
+
onChangeSelectedPriceList(newSelectedPriceList);
|
|
22461
22919
|
}
|
|
22462
22920
|
else if (isPriceListCurrentSubscription) {
|
|
22463
|
-
|
|
22464
|
-
|
|
22465
|
-
|
|
22921
|
+
onChangeSelectedPriceList(newSelectedPriceList);
|
|
22922
|
+
}
|
|
22923
|
+
else {
|
|
22924
|
+
onClearQuote();
|
|
22466
22925
|
}
|
|
22467
22926
|
}
|
|
22468
|
-
}, [
|
|
22927
|
+
}, [selectedPriceList, priceListChangeOptions, upgradingSubscription]);
|
|
22469
22928
|
var onChangeProduct = useCallback(function (product) {
|
|
22470
22929
|
var newAvailableBillingPeriods = createAvailableBillingPeriods(priceListChangeOptions === null || priceListChangeOptions === void 0 ? void 0 : priceListChangeOptions.priceLists, product);
|
|
22471
22930
|
if (!(newAvailableBillingPeriods === null || newAvailableBillingPeriods === void 0 ? void 0 : newAvailableBillingPeriods.includes(billingPeriodConverter(selectedBillingPeriod)))) {
|
|
@@ -22474,8 +22933,19 @@ var PriceListSelector = function (_a) {
|
|
|
22474
22933
|
setSelectedProduct(product);
|
|
22475
22934
|
}, [priceListChangeOptions, selectedBillingPeriod, onChangeBillingPeriod]);
|
|
22476
22935
|
// Default settings
|
|
22936
|
+
var initialProduct = (_b = priceListChangeOptions === null || priceListChangeOptions === void 0 ? void 0 : priceListChangeOptions.products) === null || _b === void 0 ? void 0 : _b[0];
|
|
22937
|
+
var initialBillingPeriod = useMemo(function () {
|
|
22938
|
+
var initialAvailableBillingPeriods = createAvailableBillingPeriods(priceListChangeOptions === null || priceListChangeOptions === void 0 ? void 0 : priceListChangeOptions.priceLists, initialProduct);
|
|
22939
|
+
if ((upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.priceList) &&
|
|
22940
|
+
(initialAvailableBillingPeriods === null || initialAvailableBillingPeriods === void 0 ? void 0 : initialAvailableBillingPeriods.includes(billingPeriodConverter(periodMonthsConverter(upgradingSubscription.priceList.periodMonths))))) {
|
|
22941
|
+
return periodMonthsConverter(upgradingSubscription.priceList.periodMonths);
|
|
22942
|
+
}
|
|
22943
|
+
else {
|
|
22944
|
+
return periodMonthsConverter((initialAvailableBillingPeriods === null || initialAvailableBillingPeriods === void 0 ? void 0 : initialAvailableBillingPeriods[0]) || 1);
|
|
22945
|
+
}
|
|
22946
|
+
}, [upgradingSubscription]);
|
|
22947
|
+
// Set initial billing period and initial product
|
|
22477
22948
|
useEffect(function () {
|
|
22478
|
-
var _a, _b, _c, _d;
|
|
22479
22949
|
if (arePlanChangeOptionsLoading ||
|
|
22480
22950
|
areSubscriptionsLoading ||
|
|
22481
22951
|
!priceListChangeOptions ||
|
|
@@ -22483,53 +22953,47 @@ var PriceListSelector = function (_a) {
|
|
|
22483
22953
|
selectedProduct ||
|
|
22484
22954
|
selectedPriceList)
|
|
22485
22955
|
return;
|
|
22486
|
-
var initialProduct = (_a = priceListChangeOptions === null || priceListChangeOptions === void 0 ? void 0 : priceListChangeOptions.products) === null || _a === void 0 ? void 0 : _a[0];
|
|
22487
|
-
var initialAvailableBillingPeriods = createAvailableBillingPeriods(priceListChangeOptions === null || priceListChangeOptions === void 0 ? void 0 : priceListChangeOptions.priceLists, initialProduct);
|
|
22488
|
-
var initialBillingPeriod;
|
|
22489
|
-
if ((upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.priceList) &&
|
|
22490
|
-
(initialAvailableBillingPeriods === null || initialAvailableBillingPeriods === void 0 ? void 0 : initialAvailableBillingPeriods.includes(billingPeriodConverter(periodMonthsConverter(upgradingSubscription.priceList.periodMonths))))) {
|
|
22491
|
-
initialBillingPeriod = periodMonthsConverter(upgradingSubscription.priceList.periodMonths);
|
|
22492
|
-
}
|
|
22493
|
-
else {
|
|
22494
|
-
initialBillingPeriod = periodMonthsConverter((initialAvailableBillingPeriods === null || initialAvailableBillingPeriods === void 0 ? void 0 : initialAvailableBillingPeriods[0]) || 1);
|
|
22495
|
-
}
|
|
22496
|
-
var initialAvailablePriceLists = ((_b = priceListChangeOptions === null || priceListChangeOptions === void 0 ? void 0 : priceListChangeOptions.priceLists) === null || _b === void 0 ? void 0 : _b.filter(function (priceList) {
|
|
22497
|
-
return periodMonthsConverter(priceList.periodMonths) === initialBillingPeriod &&
|
|
22498
|
-
priceList.product.id === (initialProduct === null || initialProduct === void 0 ? void 0 : initialProduct.id);
|
|
22499
|
-
})) || [];
|
|
22500
|
-
var initialPriceList;
|
|
22501
|
-
var initialQuantity = (_d = (_c = upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.charges) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.quantity;
|
|
22502
|
-
if (upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.priceList) {
|
|
22503
|
-
initialPriceList = initialAvailablePriceLists.find(function (priceList) { return priceList.id === upgradingSubscription.priceList.id; });
|
|
22504
|
-
}
|
|
22505
22956
|
if (initialBillingPeriod)
|
|
22506
22957
|
setSelectedBillingPeriod(initialBillingPeriod);
|
|
22507
22958
|
if (initialProduct)
|
|
22508
22959
|
setSelectedProduct(initialProduct);
|
|
22509
|
-
if (initialPriceList &&
|
|
22510
|
-
!isInPreviewMode &&
|
|
22511
|
-
!isPriceListDisabled({
|
|
22512
|
-
priceList: initialPriceList,
|
|
22513
|
-
upgradingSubscription: upgradingSubscription,
|
|
22514
|
-
canPurchaseFeatureAddons: priceListHasUnpurchasedFeatureAddons(initialPriceList, upgradingSubscription),
|
|
22515
|
-
})) {
|
|
22516
|
-
setQuotePreviewData({
|
|
22517
|
-
priceList: initialPriceList,
|
|
22518
|
-
quantity: calculateNewQuantity(initialPriceList, initialQuantity),
|
|
22519
|
-
});
|
|
22520
|
-
}
|
|
22521
22960
|
}, [
|
|
22961
|
+
setSelectedBillingPeriod,
|
|
22962
|
+
setSelectedProduct,
|
|
22963
|
+
selectedBillingPeriod,
|
|
22522
22964
|
arePlanChangeOptionsLoading,
|
|
22523
22965
|
areSubscriptionsLoading,
|
|
22524
|
-
isInPreviewMode,
|
|
22525
22966
|
priceListChangeOptions,
|
|
22526
|
-
selectedBillingPeriod,
|
|
22527
22967
|
selectedPriceList,
|
|
22528
22968
|
selectedProduct,
|
|
22529
|
-
setQuotePreviewData,
|
|
22530
|
-
upgradingSubscription,
|
|
22531
22969
|
]);
|
|
22532
|
-
|
|
22970
|
+
// Set initial price list and initial quantity in quote preview data
|
|
22971
|
+
// Will also set the initial price list and quantity if the billing period is changed
|
|
22972
|
+
useEffect(function () {
|
|
22973
|
+
var _a;
|
|
22974
|
+
var initialAvailablePriceLists = ((_a = priceListChangeOptions === null || priceListChangeOptions === void 0 ? void 0 : priceListChangeOptions.priceLists) === null || _a === void 0 ? void 0 : _a.filter(function (priceList) {
|
|
22975
|
+
return periodMonthsConverter(priceList.periodMonths) === initialBillingPeriod &&
|
|
22976
|
+
priceList.product.id === (initialProduct === null || initialProduct === void 0 ? void 0 : initialProduct.id);
|
|
22977
|
+
})) || [];
|
|
22978
|
+
var initialPriceList = (upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.priceList)
|
|
22979
|
+
? initialAvailablePriceLists.find(function (priceList) { return priceList.id === upgradingSubscription.priceList.id; })
|
|
22980
|
+
: undefined;
|
|
22981
|
+
if (initialPriceList &&
|
|
22982
|
+
!isInPreviewMode &&
|
|
22983
|
+
!isPriceListDisabled({
|
|
22984
|
+
priceList: initialPriceList,
|
|
22985
|
+
upgradingSubscription: upgradingSubscription,
|
|
22986
|
+
}) &&
|
|
22987
|
+
!selectedPriceList) {
|
|
22988
|
+
onChangeSelectedPriceList(initialPriceList);
|
|
22989
|
+
}
|
|
22990
|
+
}, [isInPreviewMode, subscriptions, upgradingSubscription, selectedBillingPeriod]);
|
|
22991
|
+
var onClickPriceListCard = useCallback(function (selectedPriceList) {
|
|
22992
|
+
if (isInPreviewMode)
|
|
22993
|
+
return showInfoNotification('You are in preview mode');
|
|
22994
|
+
return onChangeSelectedPriceList(selectedPriceList);
|
|
22995
|
+
}, [isInPreviewMode, showInfoNotification, onChangeSelectedPriceList]);
|
|
22996
|
+
return (jsxs(Fragment, { children: [jsx(BillingPeriodSelector, { availableBillingPeriods: availableBillingPeriods, onChangeBillingPeriod: onChangeBillingPeriod, products: priceListChangeOptions === null || priceListChangeOptions === void 0 ? void 0 : priceListChangeOptions.products, selectedBillingPeriod: selectedBillingPeriod, selectedProduct: selectedProduct, onChangeProduct: onChangeProduct }), jsx(PriceListGrid, { availablePriceLists: availablePriceLists, priceListChangeOptions: priceListChangeOptions, priceListStart: priceListStart, selectedPriceList: selectedPriceList, selectedProduct: selectedProduct, setPriceListStart: setPriceListStart, subscriptions: subscriptions, upgradingSubscriptionState: upgradingSubscription, selectedBillingPeriod: selectedBillingPeriod, onClickPriceListCard: onClickPriceListCard })] }));
|
|
22533
22997
|
};
|
|
22534
22998
|
|
|
22535
22999
|
var PlanPicker = function () {
|
|
@@ -22538,18 +23002,15 @@ var PlanPicker = function () {
|
|
|
22538
23002
|
var token = useToken();
|
|
22539
23003
|
var apiHost = useContext(BunnyContext).apiHost;
|
|
22540
23004
|
var _b = useContext(SubscriptionsContext), isInPreviewMode = _b.isInPreviewMode, productId = _b.productId, upgradingSubscription = _b.upgradingSubscription;
|
|
22541
|
-
var _c = useContext(QuotePreviewContext), quotePreviewData = _c.quotePreviewData, setQuotePreviewData = _c.setQuotePreviewData;
|
|
22542
|
-
// Hooks
|
|
22543
|
-
var showInfoNotification = useInfoNotification();
|
|
22544
23005
|
// Queries
|
|
22545
|
-
var
|
|
23006
|
+
var _c = useQuery({
|
|
22546
23007
|
queryKey: QueryKeyFactory.default.createTableKey({
|
|
22547
23008
|
pluralType: 'subscriptions',
|
|
22548
23009
|
token: token,
|
|
22549
23010
|
}),
|
|
22550
23011
|
queryFn: function () { return getSubscriptions({ isInPreviewMode: isInPreviewMode, token: token, apiHost: apiHost }); },
|
|
22551
|
-
}), subscriptions =
|
|
22552
|
-
var
|
|
23012
|
+
}), subscriptions = _c.data, areSubscriptionsLoading = _c.isLoading;
|
|
23013
|
+
var _d = useQuery({
|
|
22553
23014
|
queryKey: QueryKeyFactory.default.planChangeOptionsKey({
|
|
22554
23015
|
subscriptionId: upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id,
|
|
22555
23016
|
token: token,
|
|
@@ -22564,25 +23025,8 @@ var PlanPicker = function () {
|
|
|
22564
23025
|
});
|
|
22565
23026
|
},
|
|
22566
23027
|
enabled: !areSubscriptionsLoading,
|
|
22567
|
-
}), priceListChangeOptions =
|
|
22568
|
-
|
|
22569
|
-
var onChangePriceList = useCallback(function (selectedPriceList) {
|
|
22570
|
-
if (isInPreviewMode)
|
|
22571
|
-
return showInfoNotification('You are in preview mode');
|
|
22572
|
-
return setQuotePreviewData({
|
|
22573
|
-
priceList: selectedPriceList,
|
|
22574
|
-
quantity: calculateNewQuantity(selectedPriceList, quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.quantity),
|
|
22575
|
-
});
|
|
22576
|
-
}, [isInPreviewMode, setQuotePreviewData, showInfoNotification]);
|
|
22577
|
-
// Reset quote preview data when the plan picker is unmounted
|
|
22578
|
-
useEffect(function () {
|
|
22579
|
-
return function () {
|
|
22580
|
-
setQuotePreviewData({});
|
|
22581
|
-
};
|
|
22582
|
-
}, [setQuotePreviewData]);
|
|
22583
|
-
if (((_a = priceListChangeOptions === null || priceListChangeOptions === void 0 ? void 0 : priceListChangeOptions.priceLists) === null || _a === void 0 ? void 0 : _a.length) === 0)
|
|
22584
|
-
return jsx(ErrorView, { message: "There are no plans available" });
|
|
22585
|
-
return (jsx(PriceListSelector, { arePlanChangeOptionsLoading: arePlanChangeOptionsLoading, areSubscriptionsLoading: areSubscriptionsLoading, onChangePriceList: onChangePriceList, priceListChangeOptions: priceListChangeOptions, selectedPriceList: quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.priceList, subscriptions: subscriptions }));
|
|
23028
|
+
}), priceListChangeOptions = _d.data, arePlanChangeOptionsLoading = _d.isLoading;
|
|
23029
|
+
return (jsx(Fragment, { children: ((_a = priceListChangeOptions === null || priceListChangeOptions === void 0 ? void 0 : priceListChangeOptions.priceLists) === null || _a === void 0 ? void 0 : _a.length) === 0 ? (jsx(ErrorView, { message: "There are no plans available" })) : (jsx(PriceListSelector, { arePlanChangeOptionsLoading: arePlanChangeOptionsLoading, areSubscriptionsLoading: areSubscriptionsLoading, priceListChangeOptions: priceListChangeOptions, subscriptions: subscriptions })) }));
|
|
22586
23030
|
};
|
|
22587
23031
|
|
|
22588
23032
|
var Text$8 = Typography.Text;
|
|
@@ -22598,47 +23042,22 @@ var PlanManager = function (_a) {
|
|
|
22598
23042
|
// Context
|
|
22599
23043
|
var token = useToken();
|
|
22600
23044
|
var apiHost = useContext(BunnyContext).apiHost;
|
|
22601
|
-
var _b = useContext(SubscriptionsContext), isInPreviewMode = _b.isInPreviewMode,
|
|
22602
|
-
var _c = useContext(
|
|
23045
|
+
var _b = useContext(SubscriptionsContext), isInPreviewMode = _b.isInPreviewMode, className = _b.className;
|
|
23046
|
+
var _c = useContext(QuoteContext), onClearQuote = _c.onClearQuote, selectedPriceList = _c.selectedPriceList;
|
|
22603
23047
|
// Local state
|
|
22604
|
-
var _d = useState(),
|
|
22605
|
-
var _e = useState(false), payModalVisible = _e[0], setPayModalVisible = _e[1];
|
|
22606
|
-
var _f = useState(false), isSticky = _f[0], setIsSticky = _f[1];
|
|
23048
|
+
var _d = useState(false), isSticky = _d[0], setIsSticky = _d[1];
|
|
22607
23049
|
var stickyRef = useRef(null);
|
|
22608
23050
|
// Hooks
|
|
22609
|
-
var queryClient = useQueryClient();
|
|
22610
|
-
var showSuccessNotification = useSuccessNotification();
|
|
22611
23051
|
var showInfoNotification = useInfoNotification();
|
|
22612
|
-
var defaultPaymentMethod = usePaymentMethod({
|
|
22613
|
-
token: token,
|
|
22614
|
-
apiHost: apiHost,
|
|
22615
|
-
}).defaultPaymentMethod;
|
|
22616
23052
|
// Queries
|
|
22617
|
-
var
|
|
23053
|
+
var subscriptionsAreLoading = useQuery({
|
|
22618
23054
|
queryKey: QueryKeyFactory.default.createTableKey({
|
|
22619
23055
|
pluralType: 'subscriptions',
|
|
22620
23056
|
token: token,
|
|
22621
23057
|
}),
|
|
22622
23058
|
queryFn: function () { return getSubscriptions({ isInPreviewMode: isInPreviewMode, token: token, apiHost: apiHost }); },
|
|
22623
23059
|
enabled: false,
|
|
22624
|
-
})
|
|
22625
|
-
var quote = useQuery({
|
|
22626
|
-
queryKey: QueryKeyFactory.default.createObjectKey({
|
|
22627
|
-
id: editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.id,
|
|
22628
|
-
objectName: 'editingQuote',
|
|
22629
|
-
token: token,
|
|
22630
|
-
}),
|
|
22631
|
-
queryFn: function () {
|
|
22632
|
-
return (editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.id) ? getQuote({ token: token, id: editingQuoteData.id, apiHost: apiHost }) : undefined;
|
|
22633
|
-
},
|
|
22634
|
-
enabled: Boolean(editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.id),
|
|
22635
|
-
}).data;
|
|
22636
|
-
useEffect(function () {
|
|
22637
|
-
if (subscriptionUpgradeId && !upgradingSubscription) {
|
|
22638
|
-
var subscription = subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.find(function (subscription) { return subscription.id === subscriptionUpgradeId; });
|
|
22639
|
-
setUpgradingSubscription(subscription);
|
|
22640
|
-
}
|
|
22641
|
-
}, [setUpgradingSubscription, subscriptionUpgradeId, subscriptions, upgradingSubscription]);
|
|
23060
|
+
}).isLoading;
|
|
22642
23061
|
useEffect(function () {
|
|
22643
23062
|
var observer = new IntersectionObserver(function (_a) {
|
|
22644
23063
|
var entry = _a[0];
|
|
@@ -22658,41 +23077,14 @@ var PlanManager = function (_a) {
|
|
|
22658
23077
|
observer.unobserve(el);
|
|
22659
23078
|
};
|
|
22660
23079
|
}, []);
|
|
22661
|
-
function handleSetEditingQuoteData(quoteId, isTrial) {
|
|
22662
|
-
setEditingQuoteData({
|
|
22663
|
-
id: quoteId || (editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.id) || '',
|
|
22664
|
-
isTrial: isTrial || (editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.isTrial) || false,
|
|
22665
|
-
});
|
|
22666
|
-
}
|
|
22667
|
-
// Handlers
|
|
22668
|
-
var onSuccess = function () {
|
|
22669
|
-
setEditingQuoteData(undefined);
|
|
22670
|
-
queryClient.invalidateQueries({
|
|
22671
|
-
queryKey: QueryKeyFactory.default.transactionsKey({ token: token }),
|
|
22672
|
-
});
|
|
22673
|
-
queryClient.invalidateQueries({
|
|
22674
|
-
queryKey: QueryKeyFactory.default.createTableKey({
|
|
22675
|
-
pluralType: 'subscriptions',
|
|
22676
|
-
token: token,
|
|
22677
|
-
}),
|
|
22678
|
-
});
|
|
22679
|
-
showSuccessNotification('Your plan has been updated', 'Payment successful');
|
|
22680
|
-
setPayModalVisible(false);
|
|
22681
|
-
};
|
|
22682
|
-
var onCancel = function () {
|
|
22683
|
-
setPayModalVisible(false);
|
|
22684
|
-
};
|
|
22685
|
-
var onFail = function (error) {
|
|
22686
|
-
handlePortalErrors === null || handlePortalErrors === void 0 ? void 0 : handlePortalErrors(error);
|
|
22687
|
-
};
|
|
22688
23080
|
if (subscriptionsAreLoading && !isInPreviewMode)
|
|
22689
23081
|
return jsx(Fragment, {});
|
|
22690
23082
|
return (jsxs("div", __assign({ className: "".concat(className) }, { children: [jsx(PreviewModeAdvisary, { isInPreviewMode: isInPreviewMode }), jsx(PageTitle, { onGoBack: function () {
|
|
22691
23083
|
if (isInPreviewMode)
|
|
22692
23084
|
return showInfoNotification('You are in preview mode');
|
|
22693
|
-
|
|
23085
|
+
onClearQuote();
|
|
22694
23086
|
onChangePlanCancel();
|
|
22695
|
-
}, title: "Change plan" }), jsx(PlanPicker, {}), jsx(
|
|
23087
|
+
}, title: "Change plan" }), jsx(PlanPicker, {}), jsx("div", { ref: stickyRef }), jsx("div", __assign({ className: "bunny-sticky bunny-bottom-4 bunny-transition-[margin] bunny-duration-300 ".concat(isSticky ? 'bunny-mx-4' : 'bunny-mx-0') }, { children: selectedPriceList && (jsx(PlanPickerCheckoutBar, { selectedPriceList: selectedPriceList, handlePortalErrors: handlePortalErrors, onCheckoutSuccess: function () { return onChangePlanCancel(); } })) }))] })));
|
|
22696
23088
|
};
|
|
22697
23089
|
|
|
22698
23090
|
var useCancelSubscription = function () {
|
|
@@ -22711,6 +23103,11 @@ var useCancelSubscription = function () {
|
|
|
22711
23103
|
}); };
|
|
22712
23104
|
};
|
|
22713
23105
|
|
|
23106
|
+
var AddonIndentation = function (_a) {
|
|
23107
|
+
var isLast = _a.isLast, indentation = _a.indentation, verticalMargin = _a.verticalMargin;
|
|
23108
|
+
return (jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-relative", style: { width: "".concat(indentation, "px") } }, { children: [jsx("div", { className: "bunny-flex-1 bunny-bg-gray-300 bunny-w-0.5 bunny-mx-auto", style: { marginTop: verticalMargin } }), jsx("div", { className: "bunny-bg-gray-300 bunny-h-0.5 bunny-w-1/2 bunny-ml-auto" }), isLast ? (jsx("div", { className: "bunny-flex-1" })) : (jsx("div", { className: "bunny-flex-1 bunny-bg-gray-300 bunny-w-0.5 bunny-mx-auto", style: { marginBottom: verticalMargin } }))] })));
|
|
23109
|
+
};
|
|
23110
|
+
|
|
22714
23111
|
var SubscriptionState;
|
|
22715
23112
|
(function (SubscriptionState) {
|
|
22716
23113
|
SubscriptionState["ACTIVE"] = "ACTIVE";
|
|
@@ -22843,16 +23240,20 @@ var FeatureBarChart = function (_a) {
|
|
|
22843
23240
|
var StyledBarChart = defaultStyled(BarChart)(templateObject_1$2 || (templateObject_1$2 = __makeTemplateObject(["\n .recharts-surface {\n overflow: visible;\n }\n"], ["\n .recharts-surface {\n overflow: visible;\n }\n"])));
|
|
22844
23241
|
var templateObject_1$2;
|
|
22845
23242
|
|
|
22846
|
-
var
|
|
22847
|
-
var _b;
|
|
22848
|
-
var onChangePlanClick = _a.onChangePlanClick, onCancelSubscriptionClick = _a.onCancelSubscriptionClick, priceListChangeOptions = _a.priceListChangeOptions, subscription = _a.subscription;
|
|
23243
|
+
var usePriceListChangeOptions = function (onChangePlanClick) {
|
|
22849
23244
|
var apiHost = useContext(BunnyContext).apiHost;
|
|
22850
23245
|
var token = useToken();
|
|
22851
|
-
var
|
|
22852
|
-
|
|
22853
|
-
token: token,
|
|
22854
|
-
|
|
22855
|
-
}).isLoading;
|
|
23246
|
+
var _a = useQuery({
|
|
23247
|
+
queryKey: QueryKeyFactory.default.planChangeOptionsKey({ token: token }),
|
|
23248
|
+
queryFn: function () { return getPriceListChangeOptions({ apiHost: apiHost, token: token }); },
|
|
23249
|
+
enabled: Boolean(onChangePlanClick),
|
|
23250
|
+
}), priceListChangeOptions = _a.data, arePriceListChangeOptionsLoading = _a.isLoading;
|
|
23251
|
+
return { priceListChangeOptions: priceListChangeOptions, arePriceListChangeOptionsLoading: arePriceListChangeOptionsLoading };
|
|
23252
|
+
};
|
|
23253
|
+
|
|
23254
|
+
var SubscriptionCardActions = function (_a) {
|
|
23255
|
+
var _b;
|
|
23256
|
+
var onChangePlanClick = _a.onChangePlanClick, onCancelSubscriptionClick = _a.onCancelSubscriptionClick, priceListChangeOptions = _a.priceListChangeOptions, subscription = _a.subscription, isPaymentMethodLoading = _a.isPaymentMethodLoading;
|
|
22856
23257
|
// Derived state
|
|
22857
23258
|
var isSelfServiceCancelable = subscription.plan.selfServiceCancel;
|
|
22858
23259
|
var productPlans = (_b = priceListChangeOptions === null || priceListChangeOptions === void 0 ? void 0 : priceListChangeOptions.priceLists) === null || _b === void 0 ? void 0 : _b.filter(function (priceList) { return priceList.product.id === subscription.product.id; });
|
|
@@ -22861,18 +23262,29 @@ var SubscriptionCardActions = function (_a) {
|
|
|
22861
23262
|
var isActiveOrPending = isSubscriptionActiveOrPending(subscription);
|
|
22862
23263
|
if (isPaymentMethodLoading)
|
|
22863
23264
|
return null;
|
|
22864
|
-
return (jsxs(Fragment, { children: [isSelfServiceCancelable && (isInTrial || isActiveOrPending) && (jsx(Popconfirm, __assign({ icon: null, onConfirm: function () { return onCancelSubscriptionClick
|
|
23265
|
+
return (jsxs(Fragment, { children: [isSelfServiceCancelable && onCancelSubscriptionClick && (isInTrial || isActiveOrPending) && (jsx(Popconfirm, __assign({ icon: null, onConfirm: function () { return onCancelSubscriptionClick(subscription); }, title: "Cancel subscription" }, { children: jsx(Button, __assign({ className: "bunny-p-0", type: "link" }, { children: "Cancel subscription" })) }))), arePlansAvailable && onChangePlanClick && (isActiveOrPending || isInTrial) && (jsx(Button, __assign({ onClick: function () { return onChangePlanClick(subscription); }, type: 'primary' }, { children: isInTrial ? 'Upgrade from trial' : 'Change plan' }))), !arePlansAvailable && isInTrial && jsx(Tag, __assign({ color: "warning" }, { children: "Cannot upgrade" }))] }));
|
|
22865
23266
|
};
|
|
22866
23267
|
|
|
22867
23268
|
var Text$7 = Typography.Text;
|
|
22868
23269
|
var getSubscriptionStatusText = function (subscription) {
|
|
22869
|
-
var
|
|
22870
|
-
var
|
|
22871
|
-
var
|
|
22872
|
-
|
|
22873
|
-
|
|
22874
|
-
|
|
23270
|
+
var cancellationDate = subscription.cancellationDate, state = subscription.state, evergreen = subscription.evergreen, endDate = subscription.endDate, trialEndDate = subscription.trialEndDate, trialStartDate = subscription.trialStartDate, startDate = subscription.startDate, trialExpirationAction = subscription.trialExpirationAction;
|
|
23271
|
+
var stateUpperCased = state === null || state === void 0 ? void 0 : state.toUpperCase();
|
|
23272
|
+
var isActive = stateUpperCased === SubscriptionState$2.ACTIVE;
|
|
23273
|
+
var isPending = stateUpperCased === SubscriptionState$2.PENDING;
|
|
23274
|
+
var isCanceled = stateUpperCased === SubscriptionState$2.CANCELED;
|
|
23275
|
+
var isExpired = stateUpperCased === SubscriptionState$2.EXPIRED;
|
|
23276
|
+
var isTrial = stateUpperCased === SubscriptionState$2.TRIAL;
|
|
23277
|
+
if (cancellationDate && (isActive || isPending || isTrial))
|
|
22875
23278
|
return (jsxs(CustomizedTag, __assign({ color: "red" }, { children: ["Canceled - ends on ", formatDate(cancellationDate)] })));
|
|
23279
|
+
if (cancellationDate && isCanceled)
|
|
23280
|
+
return "Canceled on ".concat(formatDate(cancellationDate));
|
|
23281
|
+
if (isExpired)
|
|
23282
|
+
return "Ended on ".concat(formatDate(endDate || trialEndDate));
|
|
23283
|
+
if (isPending) {
|
|
23284
|
+
if (trialStartDate)
|
|
23285
|
+
return "Trial starts on ".concat(formatDate(trialStartDate));
|
|
23286
|
+
if (startDate)
|
|
23287
|
+
return "Activates on ".concat(formatDate(startDate));
|
|
22876
23288
|
}
|
|
22877
23289
|
if (isTrial) {
|
|
22878
23290
|
switch (trialExpirationAction) {
|
|
@@ -22885,26 +23297,42 @@ var getSubscriptionStatusText = function (subscription) {
|
|
|
22885
23297
|
if (evergreen) {
|
|
22886
23298
|
return "Renews on ".concat(formatDate(endDate));
|
|
22887
23299
|
}
|
|
22888
|
-
|
|
22889
|
-
(state === null || state === void 0 ? void 0 : state.toUpperCase()) === SubscriptionState$2.EXPIRED) {
|
|
22890
|
-
return "Ended on ".concat(formatDate(endDate));
|
|
22891
|
-
}
|
|
22892
|
-
return "Ends on ".concat(formatDate(endDate));
|
|
23300
|
+
return "Ends on ".concat(formatDate(endDate || trialEndDate));
|
|
22893
23301
|
};
|
|
22894
23302
|
var SubscriptionCardHeader = function (_a) {
|
|
22895
|
-
var _b, _c, _d, _e
|
|
22896
|
-
var onChangePlanClick = _a.onChangePlanClick, onCancelSubscriptionClick = _a.onCancelSubscriptionClick,
|
|
23303
|
+
var _b, _c, _d, _e;
|
|
23304
|
+
var onChangePlanClick = _a.onChangePlanClick, onCancelSubscriptionClick = _a.onCancelSubscriptionClick, subscription = _a.subscription;
|
|
23305
|
+
// Context
|
|
22897
23306
|
var darkMode = useContext(BunnyContext).darkMode;
|
|
22898
23307
|
var brandColor = useContext(BrandContext).brandColor;
|
|
22899
23308
|
var subscriptionProductNameStyle = useContext(SubscriptionsContext).subscriptionProductNameStyle;
|
|
22900
|
-
var isMobile = useIsMobile();
|
|
22901
23309
|
// Derived state
|
|
22902
23310
|
var trialDaysLeft = subscription === null || subscription === void 0 ? void 0 : subscription.daysLeftInTrial;
|
|
22903
|
-
var isTrial = (
|
|
23311
|
+
var isTrial = isSubscriptionTrial(subscription);
|
|
22904
23312
|
return (jsxs("div", __assign({ className: "bunny-flex bunny-items-center bunny-justify-between", style: {
|
|
22905
23313
|
backgroundColor: darkMode ? 'var(--row-background-dark)' : '',
|
|
22906
|
-
} }, { children: [jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-gap-2" }, { children: [((
|
|
23314
|
+
} }, { children: [jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-gap-2" }, { children: [((_b = subscription === null || subscription === void 0 ? void 0 : subscription.product) === null || _b === void 0 ? void 0 : _b.name) && (jsx(Text$7, __assign({ style: __assign({ fontSize: '11px', fontWeight: 500, color: brandColor }, subscriptionProductNameStyle) }, { children: (_c = subscription.product.name) === null || _c === void 0 ? void 0 : _c.toUpperCase() }))), jsxs("div", __assign({ className: "bunny-flex bunny-grow bunny-items-center bunny-gap-2" }, { children: [((_d = subscription === null || subscription === void 0 ? void 0 : subscription.plan) === null || _d === void 0 ? void 0 : _d.name) && (jsx(Text$7, __assign({ className: "bunny-text-lg" }, { children: subscription.plan.name }))), jsxs(CustomizedTag, __assign({ color: TAG_COLORS[(_e = subscription.state) === null || _e === void 0 ? void 0 : _e.toUpperCase()] }, { children: [lodashExports.capitalize(subscription.state.toLowerCase()), isTrial ? " (".concat(trialDaysLeft || 'N/A', " days left)") : ''] }))] }))] })), jsx("div", __assign({ className: "bunny-flex bunny-items-center bunny-gap-6" }, { children: jsx(SubscriptionStatusAndActions, { onChangePlanClick: onChangePlanClick, onCancelSubscriptionClick: onCancelSubscriptionClick, subscription: subscription }) }))] })));
|
|
22907
23315
|
};
|
|
23316
|
+
function SubscriptionStatusAndActions(_a) {
|
|
23317
|
+
var onChangePlanClick = _a.onChangePlanClick, onCancelSubscriptionClick = _a.onCancelSubscriptionClick, subscription = _a.subscription;
|
|
23318
|
+
// Context
|
|
23319
|
+
var apiHost = useContext(BunnyContext).apiHost;
|
|
23320
|
+
// Hooks
|
|
23321
|
+
var token = useToken();
|
|
23322
|
+
var isMobile = useIsMobile();
|
|
23323
|
+
var _b = usePriceListChangeOptions(onChangePlanClick), priceListChangeOptions = _b.priceListChangeOptions, arePriceListChangeOptionsLoading = _b.arePriceListChangeOptionsLoading;
|
|
23324
|
+
var isPaymentMethodLoading = usePaymentMethod({
|
|
23325
|
+
accountId: subscription.accountId,
|
|
23326
|
+
token: token,
|
|
23327
|
+
apiHost: apiHost,
|
|
23328
|
+
}).isLoading;
|
|
23329
|
+
// Derived state
|
|
23330
|
+
var cardActionsVisible = !isMobile;
|
|
23331
|
+
var showStatusSkeleton = arePriceListChangeOptionsLoading && cardActionsVisible;
|
|
23332
|
+
var showActionsSkeleton = arePriceListChangeOptionsLoading && !priceListChangeOptions;
|
|
23333
|
+
return (jsxs(Fragment, { children: [showStatusSkeleton ? (jsx(Skeleton.Input, { active: true, size: "small", style: { width: 180 } })) : (jsx(Text$7, __assign({ className: "bunny-grow bunny-text-xs" }, { children: getSubscriptionStatusText(subscription) }))), cardActionsVisible &&
|
|
23334
|
+
(showActionsSkeleton ? (jsx(Skeleton.Button, { active: true, size: "default", style: { width: 100 } })) : (jsx(SubscriptionCardActions, { onChangePlanClick: onChangePlanClick, onCancelSubscriptionClick: onCancelSubscriptionClick, priceListChangeOptions: priceListChangeOptions, subscription: subscription, isPaymentMethodLoading: isPaymentMethodLoading })))] }));
|
|
23335
|
+
}
|
|
22908
23336
|
|
|
22909
23337
|
var SubscriptionChargeTotal = function (_a) {
|
|
22910
23338
|
var charge = _a.charge, subscription = _a.subscription;
|
|
@@ -22992,7 +23420,7 @@ var SubscriptionsListCell = function (_a) {
|
|
|
22992
23420
|
return (jsx(Text$5, __assign({ className: "bunny-flex bunny-items-center bunny-text-sm bunny-whitespace-nowrap ".concat(className), style: __assign({ gridColumn: gridColumn, textAlign: right ? "right" : "left", justifyContent: right ? "flex-end" : "flex-start" }, style) }, { children: children })));
|
|
22993
23421
|
};
|
|
22994
23422
|
|
|
22995
|
-
var
|
|
23423
|
+
var NON_ADDON_CARD_COLUMNS = [
|
|
22996
23424
|
{
|
|
22997
23425
|
title: 'CHARGE',
|
|
22998
23426
|
width: 'minmax(min-content, 26%)',
|
|
@@ -23017,13 +23445,39 @@ var CARD_COLUMNS = [
|
|
|
23017
23445
|
width: "minmax(min-content, 18%)",
|
|
23018
23446
|
},
|
|
23019
23447
|
];
|
|
23448
|
+
var ADDON_CARD_COLUMNS = [
|
|
23449
|
+
{
|
|
23450
|
+
title: 'CHARGE',
|
|
23451
|
+
width: 'minmax(min-content, 21.6%)',
|
|
23452
|
+
},
|
|
23453
|
+
{
|
|
23454
|
+
title: 'PERIOD',
|
|
23455
|
+
width: 'minmax(min-content, 21.1%)',
|
|
23456
|
+
},
|
|
23457
|
+
{
|
|
23458
|
+
className: 'text-right',
|
|
23459
|
+
title: 'QUANTITY',
|
|
23460
|
+
width: "minmax(min-content, 19.1%)",
|
|
23461
|
+
},
|
|
23462
|
+
{
|
|
23463
|
+
className: 'text-right',
|
|
23464
|
+
title: 'UNIT PRICE',
|
|
23465
|
+
width: "minmax(min-content, 19.1%)",
|
|
23466
|
+
},
|
|
23467
|
+
{
|
|
23468
|
+
className: 'text-right',
|
|
23469
|
+
title: 'TOTAL',
|
|
23470
|
+
width: "minmax(min-content, 19.1%)",
|
|
23471
|
+
},
|
|
23472
|
+
];
|
|
23020
23473
|
var SubscriptionCardDesktop = function (_a) {
|
|
23021
23474
|
var _b;
|
|
23022
|
-
var onChangePlanClick = _a.onChangePlanClick, onCancelSubscriptionClick = _a.onCancelSubscriptionClick,
|
|
23475
|
+
var onChangePlanClick = _a.onChangePlanClick, onCancelSubscriptionClick = _a.onCancelSubscriptionClick, subscription = _a.subscription, isAddon = _a.isAddon;
|
|
23023
23476
|
var shadow = useContext(SubscriptionsContext).shadow;
|
|
23024
23477
|
// Derived state
|
|
23025
23478
|
var isTrial = ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState$1.TRIAL;
|
|
23026
|
-
|
|
23479
|
+
var CARD_COLUMNS = isAddon ? ADDON_CARD_COLUMNS : NON_ADDON_CARD_COLUMNS;
|
|
23480
|
+
return (jsxs(Card, __assign({ className: "p-4 ".concat(shadow ? "shadow-".concat(shadow) : '') }, { children: [jsx(SubscriptionCardHeader, { onChangePlanClick: onChangePlanClick, onCancelSubscriptionClick: onCancelSubscriptionClick, subscription: subscription }), jsx(Divider, { className: "bunny-my-4", style: {
|
|
23027
23481
|
gridColumn: '1 / 5',
|
|
23028
23482
|
width: 'calc(100% + 32px)',
|
|
23029
23483
|
transform: 'translateX(-16px)',
|
|
@@ -23075,6 +23529,20 @@ var SubscriptionCardDesktopRow = function (_a) {
|
|
|
23075
23529
|
: (_c = charge.quantity) === null || _c === void 0 ? void 0 : _c.toLocaleString() })), jsx(SubscriptionsListCell, __assign({ right: true }, { children: jsx(SubscriptionChargeUnitPrice, { charge: charge, currencyId: subscription.currencyId }) })), jsx(SubscriptionsListCell, __assign({ right: true }, { children: jsx(SubscriptionChargeTotal, { charge: charge, subscription: subscription }) }))] })));
|
|
23076
23530
|
};
|
|
23077
23531
|
|
|
23532
|
+
function AddonSubscriptionsCards(_a) {
|
|
23533
|
+
var onCancelSubscriptionClick = _a.onCancelSubscriptionClick, subscriptions = _a.subscriptions, subscription = _a.subscription, hideExpired = _a.hideExpired;
|
|
23534
|
+
var addonSubscriptions = findAddonSubscriptions(subscription, subscriptions);
|
|
23535
|
+
if (addonSubscriptions.length === 0) {
|
|
23536
|
+
return null;
|
|
23537
|
+
}
|
|
23538
|
+
return (jsx(Fragment, { children: addonSubscriptions.map(function (addonSubscription, addonSubscriptionIndex) {
|
|
23539
|
+
if (hideExpired && isSubscriptionNotActive(addonSubscription))
|
|
23540
|
+
return null;
|
|
23541
|
+
var isLast = addonSubscriptionIndex === addonSubscriptions.length - 1;
|
|
23542
|
+
return (jsxs("div", __assign({ className: "bunny-flex bunny-flex-row" }, { children: [jsx(AddonIndentation, { isLast: isLast, indentation: ADDON_INDENTATION, verticalMargin: "-1rem" }), jsx("div", __assign({ className: "bunny-flex-1" }, { children: jsx(SubscriptionCardDesktop, { onCancelSubscriptionClick: onCancelSubscriptionClick, subscription: addonSubscription, isAddon: true }) }))] })));
|
|
23543
|
+
}) }));
|
|
23544
|
+
}
|
|
23545
|
+
|
|
23078
23546
|
var Text$4 = Typography.Text;
|
|
23079
23547
|
var SubscriptionCardCellMobile = function (_a) {
|
|
23080
23548
|
var children = _a.children, className = _a.className, style = _a.style;
|
|
@@ -23124,36 +23592,54 @@ var SubscriptionCard = function (_a) {
|
|
|
23124
23592
|
};
|
|
23125
23593
|
|
|
23126
23594
|
var SubscriptionsList = function (_a) {
|
|
23127
|
-
var hideExpired = _a.hideExpired, onChangePlanClick = _a.onChangePlanClick, onCancelSubscriptionClick = _a.onCancelSubscriptionClick,
|
|
23595
|
+
var hideExpired = _a.hideExpired, onChangePlanClick = _a.onChangePlanClick, onCancelSubscriptionClick = _a.onCancelSubscriptionClick, subscriptions = _a.subscriptions;
|
|
23128
23596
|
var isMobile = useIsMobile();
|
|
23129
|
-
|
|
23597
|
+
var nonAddonSubscriptions = findNonAddonSubscriptions(subscriptions);
|
|
23598
|
+
return (jsx(Fragment, { children: nonAddonSubscriptions === null || nonAddonSubscriptions === void 0 ? void 0 : nonAddonSubscriptions.map(function (subscription, subscriptionIndex) {
|
|
23130
23599
|
if (hideExpired && isSubscriptionNotActive(subscription))
|
|
23131
23600
|
return null;
|
|
23132
23601
|
if (isMobile)
|
|
23133
|
-
return jsx(SubscriptionCard, { subscription: subscription }, subscriptionIndex);
|
|
23134
|
-
return (jsx(SubscriptionCardDesktop, { onChangePlanClick: onChangePlanClick, onCancelSubscriptionClick: onCancelSubscriptionClick,
|
|
23602
|
+
return (jsxs(Fragment, { children: [jsx(SubscriptionCard, { subscription: subscription }, subscriptionIndex), jsx(AddonSubscriptionsCards, { onCancelSubscriptionClick: onCancelSubscriptionClick, subscription: subscription, subscriptions: subscriptions, hideExpired: hideExpired })] }));
|
|
23603
|
+
return (jsxs(Fragment, { children: [jsx(SubscriptionCardDesktop, { onChangePlanClick: onChangePlanClick, onCancelSubscriptionClick: onCancelSubscriptionClick, subscription: subscription }, subscriptionIndex), jsx(AddonSubscriptionsCards, { onCancelSubscriptionClick: onCancelSubscriptionClick, subscription: subscription, subscriptions: subscriptions, hideExpired: hideExpired })] }));
|
|
23135
23604
|
}) }));
|
|
23136
23605
|
};
|
|
23137
23606
|
|
|
23138
|
-
// Extra props to pass in
|
|
23139
|
-
// - previewMode: boolean
|
|
23140
|
-
// - productId: string
|
|
23141
23607
|
var SubscriptionsListContainer = function (_a) {
|
|
23142
23608
|
var companyName = _a.companyName, _b = _a.hideExpired, hideExpired = _b === void 0 ? false : _b, onCancelSubscriptionClick = _a.onCancelSubscriptionClick, onChangePlanClick = _a.onChangePlanClick, noSubscriptionsComponent = _a.noSubscriptionsComponent, subscriptions = _a.subscriptions, subscriptionsAreLoading = _a.subscriptionsAreLoading;
|
|
23143
23609
|
// Context
|
|
23144
|
-
var apiHost = useContext(BunnyContext).apiHost;
|
|
23145
23610
|
var gap = useContext(SubscriptionsContext).gap;
|
|
23146
|
-
|
|
23147
|
-
// Queries
|
|
23148
|
-
var _c = useQuery({
|
|
23149
|
-
queryKey: QueryKeyFactory.default.planChangeOptionsKey({ token: token }),
|
|
23150
|
-
queryFn: function () { return getPriceListChangeOptions({ apiHost: apiHost, token: token }); },
|
|
23151
|
-
enabled: Boolean(onChangePlanClick),
|
|
23152
|
-
}), priceListChangeOptions = _c.data, arePriceListChangeOptionsLoading = _c.isLoading;
|
|
23153
|
-
if (subscriptionsAreLoading ||
|
|
23154
|
-
(Boolean(onChangePlanClick) ? arePriceListChangeOptionsLoading : false))
|
|
23611
|
+
if (subscriptionsAreLoading)
|
|
23155
23612
|
return jsx(Fragment, {});
|
|
23156
|
-
return (jsx(Fragment, { children: (subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.length) > 0 ? (jsx("div", __assign({ className: "bunny-flex bunny-flex-col bunny-gap-".concat(gap, " bunny-shrink bunny-overflow-auto") }, { children: jsx(SubscriptionsList, { hideExpired: hideExpired, onChangePlanClick: onChangePlanClick, onCancelSubscriptionClick: onCancelSubscriptionClick,
|
|
23613
|
+
return (jsx(Fragment, { children: (subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.length) > 0 ? (jsx("div", __assign({ className: "bunny-flex bunny-flex-col bunny-gap-".concat(gap, " bunny-shrink bunny-overflow-auto") }, { children: jsx(SubscriptionsList, { hideExpired: hideExpired, onChangePlanClick: onChangePlanClick, onCancelSubscriptionClick: onCancelSubscriptionClick, subscriptions: subscriptions }) }))) : (noSubscriptionsComponent || (jsx("div", __assign({ className: "bunny-flex bunny-flex-col bunny-items-center bunny-w-full" }, { children: jsx(ErrorView, { message: "You have no subscriptions with ".concat(companyName, " yet") }) })))) }));
|
|
23614
|
+
};
|
|
23615
|
+
|
|
23616
|
+
var HideExpiredToggle = function (_a) {
|
|
23617
|
+
var hideExpired = _a.hideExpired, setHideExpired = _a.setHideExpired;
|
|
23618
|
+
var isMobile = useIsMobile();
|
|
23619
|
+
var secondaryColor = useContext(BrandContext).secondaryColor;
|
|
23620
|
+
return (jsxs("div", __assign({ className: "bunny-flex bunny-items-center bunny-gap-4 bunny-pl-4" }, { children: [!isMobile && jsx(Divider, { className: "bunny-h-5", type: "vertical" }), jsx(StyledCheckbox, { children: jsx(Checkbox, __assign({ checked: hideExpired, onChange: function (e) { return setHideExpired(e.target.checked); }, style: {
|
|
23621
|
+
color: secondaryColor,
|
|
23622
|
+
} }, { children: isMobile ? 'Hide inactive' : 'Hide inactive subscriptions' })) })] })));
|
|
23623
|
+
};
|
|
23624
|
+
var StyledCheckbox = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n .ant-checkbox-wrapper span {\n padding-inline-end: 0 !important;\n }\n"], ["\n .ant-checkbox-wrapper span {\n padding-inline-end: 0 !important;\n }\n"])));
|
|
23625
|
+
var templateObject_1;
|
|
23626
|
+
|
|
23627
|
+
var ChangeQuantitiesButton = function (_a) {
|
|
23628
|
+
var setQuantityDrawerOpen = _a.setQuantityDrawerOpen;
|
|
23629
|
+
return (jsx(Button, __assign({ onClick: function () {
|
|
23630
|
+
setQuantityDrawerOpen(true);
|
|
23631
|
+
}, type: "default" }, { children: "Change quantities" })));
|
|
23632
|
+
};
|
|
23633
|
+
|
|
23634
|
+
var SubscriptionsNavigation = function (_a) {
|
|
23635
|
+
var expiredSwitchVisible = _a.expiredSwitchVisible, hideExpired = _a.hideExpired, setHideExpired = _a.setHideExpired, setQuantityDrawerOpen = _a.setQuantityDrawerOpen, subscriptions = _a.subscriptions;
|
|
23636
|
+
// Hooks
|
|
23637
|
+
var isMobile = useIsMobile();
|
|
23638
|
+
// Derived state
|
|
23639
|
+
var canShowChangeQuantitiesButton = canShowChangeQuantities({
|
|
23640
|
+
subscriptions: subscriptions,
|
|
23641
|
+
});
|
|
23642
|
+
return (jsxs(Fragment, { children: [!isMobile && expiredSwitchVisible && (jsx(HideExpiredToggle, { hideExpired: hideExpired, setHideExpired: setHideExpired })), jsx("div", __assign({ className: "bunny-flex bunny-grow bunny-gap-2 ".concat(isMobile ? 'bunny-flex-col' : 'bunny-justify-end') }, { children: canShowChangeQuantitiesButton && (jsx(ChangeQuantitiesButton, { setQuantityDrawerOpen: setQuantityDrawerOpen })) }))] }));
|
|
23157
23643
|
};
|
|
23158
23644
|
|
|
23159
23645
|
var Text$3 = Typography.Text;
|
|
@@ -23168,13 +23654,12 @@ var formatDateForApi = function (date) {
|
|
|
23168
23654
|
return date.format('YYYY-MM-DD');
|
|
23169
23655
|
};
|
|
23170
23656
|
var QuantityInput = function (_a) {
|
|
23171
|
-
var charge = _a.charge, chargeIndex = _a.chargeIndex, editingQuote = _a.editingQuote, setEditingQuoteData = _a.setEditingQuoteData, subscription = _a.subscription, subscriptionIndex = _a.subscriptionIndex, subscriptions = _a.subscriptions;
|
|
23657
|
+
var charge = _a.charge, chargeIndex = _a.chargeIndex, editingQuote = _a.editingQuote, setEditingQuoteData = _a.setEditingQuoteData, subscription = _a.subscription, subscriptionIndex = _a.subscriptionIndex, subscriptions = _a.subscriptions, setUpdatingChargeQuantityId = _a.setUpdatingChargeQuantityId, updatingChargeQuantityId = _a.updatingChargeQuantityId;
|
|
23172
23658
|
// Context
|
|
23173
23659
|
var token = useToken();
|
|
23174
23660
|
var apiHost = useContext(BunnyContext).apiHost;
|
|
23175
|
-
var _b = useContext(SubscriptionsContext), updatingChargeQuantityId = _b.updatingChargeQuantityId, setUpdatingChargeQuantityId = _b.setUpdatingChargeQuantityId;
|
|
23176
23661
|
// Local state
|
|
23177
|
-
var
|
|
23662
|
+
var _b = useState(), editedSubscription = _b[0], setEditedSubscription = _b[1];
|
|
23178
23663
|
// Hooks
|
|
23179
23664
|
var queryClient = useQueryClient();
|
|
23180
23665
|
var createSubscriptionQuote = useCreateSubscriptionQuote();
|
|
@@ -23258,7 +23743,8 @@ var QuantityInput = function (_a) {
|
|
|
23258
23743
|
return (editedSubscription === null || editedSubscription === void 0 ? void 0 : editedSubscription.quantity) !== undefined && editedSubscription.quantity <= quantity;
|
|
23259
23744
|
};
|
|
23260
23745
|
var onChangeQuantity = function (chargeIndex, value, priceListChargeId, subscription, subscriptionIndex) {
|
|
23261
|
-
|
|
23746
|
+
// Handle empty string - don't convert to 0, keep it as undefined
|
|
23747
|
+
var quantity = value === '' ? undefined : isNaN(parseInt(value)) ? 0 : parseInt(value);
|
|
23262
23748
|
setEditedSubscription({
|
|
23263
23749
|
chargeIndex: chargeIndex,
|
|
23264
23750
|
subscriptionIndex: subscriptionIndex,
|
|
@@ -23266,15 +23752,16 @@ var QuantityInput = function (_a) {
|
|
|
23266
23752
|
quantity: quantity,
|
|
23267
23753
|
subscription: subscription,
|
|
23268
23754
|
});
|
|
23269
|
-
if (quantity !== charge.quantity) {
|
|
23755
|
+
if (quantity !== undefined && quantity !== charge.quantity) {
|
|
23270
23756
|
setUpdatingChargeQuantityId(charge.id);
|
|
23271
23757
|
}
|
|
23272
23758
|
else {
|
|
23273
23759
|
setUpdatingChargeQuantityId(undefined);
|
|
23760
|
+
setEditingQuoteData(undefined);
|
|
23274
23761
|
}
|
|
23275
23762
|
};
|
|
23276
23763
|
var handleSubscriptionUpdate = function (editedSubscription) {
|
|
23277
|
-
if (!editedSubscription)
|
|
23764
|
+
if (!editedSubscription || editedSubscription.quantity === undefined)
|
|
23278
23765
|
return;
|
|
23279
23766
|
// If we are not editing a quote, we create a new one
|
|
23280
23767
|
if (!editingQuote) {
|
|
@@ -23292,7 +23779,7 @@ var QuantityInput = function (_a) {
|
|
|
23292
23779
|
else {
|
|
23293
23780
|
// If we are editing a quote, we update the quote change
|
|
23294
23781
|
var _a = createQuoteParams(editingQuote, charge.quantity, editedSubscription), charges = _a.charges, quoteChange = _a.quoteChange;
|
|
23295
|
-
if (quoteChange && charges[0].quantity > 0) {
|
|
23782
|
+
if (quoteChange && charges.length > 0 && charges[0].quantity > 0) {
|
|
23296
23783
|
updateQuote.mutate({
|
|
23297
23784
|
charges: charges,
|
|
23298
23785
|
quoteChangeId: quoteChange.id,
|
|
@@ -23345,10 +23832,11 @@ var QuantityInput = function (_a) {
|
|
|
23345
23832
|
var Text$2 = Typography.Text;
|
|
23346
23833
|
var QuantityChangeGridRow = function (_a) {
|
|
23347
23834
|
var _b;
|
|
23348
|
-
var chargeIndex = _a.chargeIndex, editingQuote = _a.editingQuote, subscriptions = _a.subscriptions, subscriptionIndex = _a.subscriptionIndex, setEditingQuoteData = _a.setEditingQuoteData, subscription = _a.subscription, subscriptionCharge = _a.subscriptionCharge;
|
|
23835
|
+
var chargeIndex = _a.chargeIndex, editingQuote = _a.editingQuote, subscriptions = _a.subscriptions, subscriptionIndex = _a.subscriptionIndex, setEditingQuoteData = _a.setEditingQuoteData, subscription = _a.subscription, subscriptionCharge = _a.subscriptionCharge, setUpdatingChargeQuantityId = _a.setUpdatingChargeQuantityId, updatingChargeQuantityId = _a.updatingChargeQuantityId;
|
|
23349
23836
|
if (!canShowQuantitiesInput(subscriptionCharge, subscription))
|
|
23350
23837
|
return null;
|
|
23351
|
-
|
|
23838
|
+
var brandColor = useContext(BrandContext).brandColor;
|
|
23839
|
+
return (jsxs(Fragment, { children: [jsx(Text$2, __assign({ className: "bunny-font-medium bunny-col-span-full", style: { fontSize: '11px', color: brandColor } }, { children: subscription.plan.name })), jsx(Text$2, __assign({ className: "bunny-font-medium bunny-text-base bunny-text-gray-900" }, { children: (_b = subscriptionCharge.name) === null || _b === void 0 ? void 0 : _b.toUpperCase() })), jsx(Text$2, __assign({ className: "bunny-flex bunny-items-center bunny-justify-end bunny-font-medium bunny-text-base bunny-text-gray-900" }, { children: subscriptionCharge.quantity })), jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-items-end" }, { children: [jsx(QuantityInput, { charge: subscriptionCharge, chargeIndex: chargeIndex, editingQuote: editingQuote, setEditingQuoteData: setEditingQuoteData, subscription: subscription, subscriptionIndex: subscriptionIndex, subscriptions: subscriptions, setUpdatingChargeQuantityId: setUpdatingChargeQuantityId, updatingChargeQuantityId: updatingChargeQuantityId }), jsx("div", {})] })), jsx(Divider, { className: "bunny-col-span-full bunny-my-2" })] }));
|
|
23352
23840
|
};
|
|
23353
23841
|
|
|
23354
23842
|
var QuantityChangeGridTitle = function (_a) {
|
|
@@ -23378,7 +23866,7 @@ var QuoteChangeSummarySection = function (_a) {
|
|
|
23378
23866
|
var QUANTITY_CHANGE_HEADER_TITLE = 'Update unit quantity';
|
|
23379
23867
|
var QUANTITY_CHANGE_HEADER_DESCRIPTION = 'Adjust quantities below. The change will take effect immediately after checkout has been completed.';
|
|
23380
23868
|
var QuantityChangeDrawerDesktop = function (_a) {
|
|
23381
|
-
var editingQuote = _a.editingQuote, editingQuoteData = _a.editingQuoteData, onClose = _a.onClose, open = _a.open, openCheckout = _a.openCheckout, setEditingQuoteData = _a.setEditingQuoteData, subscriptions = _a.subscriptions;
|
|
23869
|
+
var editingQuote = _a.editingQuote, editingQuoteData = _a.editingQuoteData, onClose = _a.onClose, open = _a.open, openCheckout = _a.openCheckout, setEditingQuoteData = _a.setEditingQuoteData, subscriptions = _a.subscriptions, setUpdatingChargeQuantityId = _a.setUpdatingChargeQuantityId, updatingChargeQuantityId = _a.updatingChargeQuantityId;
|
|
23382
23870
|
var _b = useState(open), openLocal = _b[0], setOpenLocal = _b[1];
|
|
23383
23871
|
var isMobile = useIsMobile();
|
|
23384
23872
|
useEffect(function () {
|
|
@@ -23410,11 +23898,11 @@ var QuantityChangeDrawerDesktop = function (_a) {
|
|
|
23410
23898
|
wrapper: {
|
|
23411
23899
|
minWidth: '600px',
|
|
23412
23900
|
},
|
|
23413
|
-
}, title: jsx(DrawerHeader, { description: QUANTITY_CHANGE_HEADER_DESCRIPTION, onClose: onClose, title: QUANTITY_CHANGE_HEADER_TITLE, closeButtonClassName: "ant-drawer-close" }) }, { children: [jsxs("div", __assign({ className: "bunny-grid bunny-pb-
|
|
23901
|
+
}, title: jsx(DrawerHeader, { description: QUANTITY_CHANGE_HEADER_DESCRIPTION, onClose: onClose, title: QUANTITY_CHANGE_HEADER_TITLE, closeButtonClassName: "ant-drawer-close" }) }, { children: [jsxs("div", __assign({ className: "bunny-grid bunny-pb-2", style: {
|
|
23414
23902
|
gridTemplateColumns: '2fr 1fr 1fr',
|
|
23415
|
-
rowGap: '0.
|
|
23903
|
+
rowGap: '0.25rem',
|
|
23416
23904
|
columnGap: '1rem',
|
|
23417
|
-
} }, { children: [jsx(QuantityChangeGridTitle, { children: "ACTIVE SUBSCRIPTIONS" }), jsx(QuantityChangeGridTitle, __assign({ right: true }, { children: "CURRENT QUANTITY" })), jsx(QuantityChangeGridTitle, __assign({ right: true }, { children: "NEW QUANTITY" })), jsx(Divider, { className: "bunny-col-span-full
|
|
23905
|
+
} }, { children: [jsx(QuantityChangeGridTitle, { children: "ACTIVE SUBSCRIPTIONS" }), jsx(QuantityChangeGridTitle, __assign({ right: true }, { children: "CURRENT QUANTITY" })), jsx(QuantityChangeGridTitle, __assign({ right: true }, { children: "NEW QUANTITY" })), jsx(Divider, { className: "bunny-col-span-full" }), subscriptions.map(function (subscription, index) {
|
|
23418
23906
|
var _a;
|
|
23419
23907
|
var isTrial = ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState$2.TRIAL;
|
|
23420
23908
|
return (jsx("div", __assign({ className: "bunny-contents" }, { children: subscription.charges.map(function (charge, chargeIndex) {
|
|
@@ -23423,40 +23911,67 @@ var QuantityChangeDrawerDesktop = function (_a) {
|
|
|
23423
23911
|
(!isTrial && charge.trial) ||
|
|
23424
23912
|
((_a = charge.chargeType) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === 'USAGE')
|
|
23425
23913
|
return null;
|
|
23426
|
-
return (jsx(QuantityChangeGridRow, { chargeIndex: chargeIndex, editingQuote: editingQuote, setEditingQuoteData: setEditingQuoteData, subscription: subscription, subscriptionCharge: charge, subscriptionIndex: index, subscriptions: subscriptions }, chargeIndex));
|
|
23914
|
+
return (jsx(QuantityChangeGridRow, { chargeIndex: chargeIndex, editingQuote: editingQuote, setEditingQuoteData: setEditingQuoteData, subscription: subscription, subscriptionCharge: charge, subscriptionIndex: index, subscriptions: subscriptions, setUpdatingChargeQuantityId: setUpdatingChargeQuantityId, updatingChargeQuantityId: updatingChargeQuantityId }, chargeIndex));
|
|
23427
23915
|
}) }), index));
|
|
23428
23916
|
})] })), jsx(QuoteChangeSummarySection, { editingQuote: editingQuote, editingQuoteData: editingQuoteData, openCheckout: openCheckout, setEditingQuoteData: setEditingQuoteData })] })));
|
|
23429
23917
|
};
|
|
23430
23918
|
|
|
23431
|
-
var
|
|
23432
|
-
var
|
|
23433
|
-
var
|
|
23434
|
-
var
|
|
23435
|
-
|
|
23436
|
-
|
|
23437
|
-
|
|
23438
|
-
|
|
23439
|
-
var
|
|
23440
|
-
var
|
|
23441
|
-
|
|
23442
|
-
var
|
|
23443
|
-
|
|
23444
|
-
|
|
23445
|
-
|
|
23446
|
-
|
|
23447
|
-
|
|
23448
|
-
|
|
23449
|
-
};
|
|
23450
|
-
|
|
23451
|
-
|
|
23452
|
-
|
|
23453
|
-
//
|
|
23454
|
-
var
|
|
23455
|
-
|
|
23456
|
-
|
|
23457
|
-
|
|
23458
|
-
|
|
23459
|
-
|
|
23919
|
+
var QuantityDrawerContainer = function (_a) {
|
|
23920
|
+
var subscriptions = _a.subscriptions, quantityDrawerOpen = _a.quantityDrawerOpen, setQuantityDrawerOpen = _a.setQuantityDrawerOpen, handlePortalErrors = _a.handlePortalErrors, setHideExpiredState = _a.setHideExpiredState;
|
|
23921
|
+
var apiHost = useContext(BunnyContext).apiHost;
|
|
23922
|
+
var token = useToken();
|
|
23923
|
+
var queryClient = useQueryClient();
|
|
23924
|
+
var showSuccessNotification = useSuccessNotification();
|
|
23925
|
+
// State management
|
|
23926
|
+
var _b = useState(), editingQuoteData = _b[0], setEditingQuoteData = _b[1];
|
|
23927
|
+
var _c = useState(false), payModalVisible = _c[0], setPayModalVisible = _c[1];
|
|
23928
|
+
var _d = useState(undefined), updatingChargeQuantityId = _d[0], setUpdatingChargeQuantityId = _d[1];
|
|
23929
|
+
// Quote query
|
|
23930
|
+
var quote = useQuery({
|
|
23931
|
+
queryKey: QueryKeyFactory.default.createObjectKey({
|
|
23932
|
+
id: editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.id,
|
|
23933
|
+
objectName: 'editingQuote',
|
|
23934
|
+
token: token,
|
|
23935
|
+
}),
|
|
23936
|
+
queryFn: function () {
|
|
23937
|
+
return (editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.id) ? getQuote({ token: token, id: editingQuoteData.id, apiHost: apiHost }) : undefined;
|
|
23938
|
+
},
|
|
23939
|
+
enabled: Boolean(editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.id),
|
|
23940
|
+
}).data;
|
|
23941
|
+
// Handlers
|
|
23942
|
+
var onSuccess = function () {
|
|
23943
|
+
setQuantityDrawerOpen(false);
|
|
23944
|
+
setEditingQuoteData(undefined);
|
|
23945
|
+
queryClient.invalidateQueries({
|
|
23946
|
+
queryKey: QueryKeyFactory.default.transactionsKey({ token: token }),
|
|
23947
|
+
});
|
|
23948
|
+
queryClient.invalidateQueries({
|
|
23949
|
+
queryKey: QueryKeyFactory.default.createTableKey({
|
|
23950
|
+
pluralType: 'subscriptions',
|
|
23951
|
+
token: token,
|
|
23952
|
+
}),
|
|
23953
|
+
});
|
|
23954
|
+
showSuccessNotification('Your plan has been updated', 'Payment successful');
|
|
23955
|
+
setPayModalVisible(false);
|
|
23956
|
+
setHideExpiredState(true);
|
|
23957
|
+
setUpdatingChargeQuantityId(undefined);
|
|
23958
|
+
};
|
|
23959
|
+
var onCancel = function () {
|
|
23960
|
+
setPayModalVisible(false);
|
|
23961
|
+
};
|
|
23962
|
+
var onFail = function (error) {
|
|
23963
|
+
handlePortalErrors === null || handlePortalErrors === void 0 ? void 0 : handlePortalErrors(error);
|
|
23964
|
+
};
|
|
23965
|
+
var handleDrawerClose = function () {
|
|
23966
|
+
if (updatingChargeQuantityId) {
|
|
23967
|
+
setUpdatingChargeQuantityId(undefined);
|
|
23968
|
+
}
|
|
23969
|
+
setQuantityDrawerOpen(false);
|
|
23970
|
+
};
|
|
23971
|
+
var handleOpenCheckout = function () {
|
|
23972
|
+
setPayModalVisible(true);
|
|
23973
|
+
};
|
|
23974
|
+
return (jsxs(Fragment, { children: [jsx(QuantityChangeDrawerDesktop, { editingQuote: quote, editingQuoteData: editingQuoteData, onClose: handleDrawerClose, open: quantityDrawerOpen, openCheckout: handleOpenCheckout, setEditingQuoteData: setEditingQuoteData, subscriptions: subscriptions, setUpdatingChargeQuantityId: setUpdatingChargeQuantityId, updatingChargeQuantityId: updatingChargeQuantityId }), jsx(Checkout, { onCancel: onCancel, onSuccess: onSuccess, onFail: onFail, open: payModalVisible, quote: quote, token: token, isUpdatingQuote: false })] }));
|
|
23460
23975
|
};
|
|
23461
23976
|
|
|
23462
23977
|
var Text$1 = Typography.Text;
|
|
@@ -23472,8 +23987,6 @@ var SubscriptionsWrapper = function (_a) {
|
|
|
23472
23987
|
};
|
|
23473
23988
|
var styles = __assign(__assign({}, defaultStyles), userStyles);
|
|
23474
23989
|
var _f = useState(undefined), upgradingSubscription = _f[0], setUpgradingSubscription = _f[1];
|
|
23475
|
-
var _g = useState(undefined), updatingChargeQuantityId = _g[0], setUpdatingChargeQuantityId = _g[1];
|
|
23476
|
-
var _h = useState(null), subscriptionUpgradeId = _h[0], setSubscriptionUpgradeId = _h[1];
|
|
23477
23990
|
return (jsx(SubscriptionsContext.Provider, __assign({ value: {
|
|
23478
23991
|
gap: styles.gap,
|
|
23479
23992
|
shadow: styles.shadow,
|
|
@@ -23484,55 +23997,34 @@ var SubscriptionsWrapper = function (_a) {
|
|
|
23484
23997
|
hideExpired: hideExpired,
|
|
23485
23998
|
upgradingSubscription: upgradingSubscription,
|
|
23486
23999
|
setUpgradingSubscription: setUpgradingSubscription,
|
|
23487
|
-
|
|
23488
|
-
setUpdatingChargeQuantityId: setUpdatingChargeQuantityId,
|
|
23489
|
-
subscriptionUpgradeId: subscriptionUpgradeId,
|
|
23490
|
-
setSubscriptionUpgradeId: setSubscriptionUpgradeId,
|
|
23491
|
-
} }, { children: jsx(QuotePreviewProvider, { children: jsx(Subscriptions, { handlePortalErrors: handlePortalErrors, companyName: companyName, noSubscriptionsComponent: noSubscriptionsComponent, hideTitle: hideTitle, hideExpiredToggle: hideExpiredToggle }) }) })));
|
|
24000
|
+
} }, { children: jsx(Subscriptions, { handlePortalErrors: handlePortalErrors, companyName: companyName, noSubscriptionsComponent: noSubscriptionsComponent, hideTitle: hideTitle, hideExpiredToggle: hideExpiredToggle }) })));
|
|
23492
24001
|
};
|
|
23493
24002
|
var Subscriptions = function (_a) {
|
|
23494
24003
|
var handlePortalErrors = _a.handlePortalErrors, companyName = _a.companyName, noSubscriptionsComponent = _a.noSubscriptionsComponent, hideTitle = _a.hideTitle, hideExpiredToggle = _a.hideExpiredToggle;
|
|
23495
24004
|
// Context
|
|
23496
24005
|
var token = useToken();
|
|
23497
24006
|
var apiHost = useContext(BunnyContext).apiHost;
|
|
23498
|
-
var _b = useContext(SubscriptionsContext), setUpgradingSubscription = _b.setUpgradingSubscription,
|
|
24007
|
+
var _b = useContext(SubscriptionsContext), setUpgradingSubscription = _b.setUpgradingSubscription, className = _b.className, isInPreviewMode = _b.isInPreviewMode, hideExpiredOverride = _b.hideExpired;
|
|
23499
24008
|
// Local state
|
|
23500
|
-
var _c = useState(),
|
|
23501
|
-
var _d = useState(false),
|
|
23502
|
-
var _e = useState(
|
|
24009
|
+
var _c = useState(true), hideExpiredState = _c[0], setHideExpiredState = _c[1];
|
|
24010
|
+
var _d = useState(false), expiredSwitchVisible = _d[0], setExpiredSwitchVisible = _d[1];
|
|
24011
|
+
var _e = useState(false), isChangingPlan = _e[0], setIsChangingPlan = _e[1];
|
|
23503
24012
|
var _f = useState(false), quantityDrawerOpen = _f[0], setQuantityDrawerOpen = _f[1];
|
|
23504
|
-
|
|
23505
|
-
var _h = useState(false), isChangingPlan = _h[0], setIsChangingPlan = _h[1];
|
|
24013
|
+
// Derived state
|
|
23506
24014
|
var hideExpired = hideExpiredOverride !== null && hideExpiredOverride !== void 0 ? hideExpiredOverride : hideExpiredState;
|
|
23507
24015
|
// Hooks
|
|
23508
24016
|
var queryClient = useQueryClient();
|
|
23509
24017
|
var showSuccessNotification = useSuccessNotification();
|
|
23510
|
-
var quoteDelete = useQuoteDelete();
|
|
23511
24018
|
var isMobile = useIsMobile();
|
|
23512
|
-
var defaultPaymentMethod = usePaymentMethod({
|
|
23513
|
-
token: token,
|
|
23514
|
-
apiHost: apiHost,
|
|
23515
|
-
}).defaultPaymentMethod;
|
|
23516
24019
|
var cancelSubscription = useCancelSubscription();
|
|
23517
24020
|
// Queries
|
|
23518
|
-
var
|
|
23519
|
-
queryKey: QueryKeyFactory.default.createObjectKey({
|
|
23520
|
-
id: editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.id,
|
|
23521
|
-
objectName: 'editingQuote',
|
|
23522
|
-
token: token,
|
|
23523
|
-
}),
|
|
23524
|
-
queryFn: function () {
|
|
23525
|
-
return (editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.id) ? getQuote({ token: token, id: editingQuoteData.id, apiHost: apiHost }) : undefined;
|
|
23526
|
-
},
|
|
23527
|
-
enabled: Boolean(editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.id),
|
|
23528
|
-
}).data;
|
|
23529
|
-
var _j = useQuery({
|
|
24021
|
+
var _g = useQuery({
|
|
23530
24022
|
queryKey: QueryKeyFactory.default.createTableKey({
|
|
23531
24023
|
pluralType: 'subscriptions',
|
|
23532
24024
|
token: token,
|
|
23533
24025
|
}),
|
|
23534
24026
|
queryFn: function () { return getSubscriptions({ token: token, apiHost: apiHost }); },
|
|
23535
|
-
}), subscriptions =
|
|
24027
|
+
}), subscriptions = _g.data, subscriptionsAreLoading = _g.isLoading;
|
|
23536
24028
|
// Mutations
|
|
23537
24029
|
var subscriptionCancel = useMutation({
|
|
23538
24030
|
mutationFn: function (subscription) {
|
|
@@ -23551,50 +24043,13 @@ var Subscriptions = function (_a) {
|
|
|
23551
24043
|
// Handlers
|
|
23552
24044
|
var onChangePlanClick = function (subscription) {
|
|
23553
24045
|
if (subscription) {
|
|
23554
|
-
setSubscriptionUpgradeId(subscription.id);
|
|
23555
24046
|
setUpgradingSubscription(subscription);
|
|
23556
24047
|
}
|
|
23557
|
-
else {
|
|
23558
|
-
setSubscriptionUpgradeId(null);
|
|
23559
|
-
setUpgradingSubscription(undefined);
|
|
23560
|
-
}
|
|
23561
24048
|
setIsChangingPlan(true);
|
|
23562
24049
|
};
|
|
23563
24050
|
var onCancelSubscriptionClick = function (subscription) {
|
|
23564
24051
|
subscriptionCancel.mutate(subscription);
|
|
23565
24052
|
};
|
|
23566
|
-
var onSuccess = function () {
|
|
23567
|
-
setQuantityDrawerOpen(false);
|
|
23568
|
-
setEditingQuoteData(undefined);
|
|
23569
|
-
queryClient.invalidateQueries({
|
|
23570
|
-
queryKey: QueryKeyFactory.default.transactionsKey({ token: token }),
|
|
23571
|
-
});
|
|
23572
|
-
queryClient.invalidateQueries({
|
|
23573
|
-
queryKey: QueryKeyFactory.default.createTableKey({
|
|
23574
|
-
pluralType: 'subscriptions',
|
|
23575
|
-
token: token,
|
|
23576
|
-
}),
|
|
23577
|
-
});
|
|
23578
|
-
showSuccessNotification('Your plan has been updated', 'Payment successful');
|
|
23579
|
-
setPayModalVisible(false);
|
|
23580
|
-
setHideExpiredState(true);
|
|
23581
|
-
};
|
|
23582
|
-
var onCancel = function () {
|
|
23583
|
-
setPayModalVisible(false);
|
|
23584
|
-
};
|
|
23585
|
-
var onFail = function (error) {
|
|
23586
|
-
handlePortalErrors === null || handlePortalErrors === void 0 ? void 0 : handlePortalErrors(error);
|
|
23587
|
-
};
|
|
23588
|
-
var onClose = function () {
|
|
23589
|
-
if (editingQuoteData) {
|
|
23590
|
-
quoteDelete(editingQuoteData.id, apiHost, token);
|
|
23591
|
-
setEditingQuoteData(undefined);
|
|
23592
|
-
}
|
|
23593
|
-
if (updatingChargeQuantityId) {
|
|
23594
|
-
setUpdatingChargeQuantityId(undefined);
|
|
23595
|
-
}
|
|
23596
|
-
setQuantityDrawerOpen(false);
|
|
23597
|
-
};
|
|
23598
24053
|
var allSubscriptionsExpired = subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.every(function (subscription) {
|
|
23599
24054
|
var _a, _b;
|
|
23600
24055
|
return ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState$2.EXPIRED ||
|
|
@@ -23614,11 +24069,11 @@ var Subscriptions = function (_a) {
|
|
|
23614
24069
|
setExpiredSwitchVisible(true);
|
|
23615
24070
|
}, [hasExpiredOrCanceledSubscriptions, subscriptions]);
|
|
23616
24071
|
if (isChangingPlan || isInPreviewMode) {
|
|
23617
|
-
return (jsx(PlanManager, { onChangePlanCancel: function () {
|
|
23618
|
-
|
|
23619
|
-
|
|
24072
|
+
return (jsx(QuoteProvider, { children: jsx(PlanManager, { onChangePlanCancel: function () {
|
|
24073
|
+
setIsChangingPlan(false);
|
|
24074
|
+
}, handlePortalErrors: handlePortalErrors }) }));
|
|
23620
24075
|
}
|
|
23621
|
-
return (jsxs("div", __assign({ className: className }, { children: [!hideTitle ? jsx(PageTitle, { title: 'Subscriptions' }) : null, jsx(PageHeaderWithActions, __assign({ title: jsx(Fragment, { children: !hideExpiredToggle && (jsxs(Text$1, __assign({ className: "bunny-flex bunny-items-center bunny-justify-between", style: { minWidth: '120px' } }, { children: [hideExpired ? 'Active subscriptions' : 'All subscriptions', isMobile && expiredSwitchVisible && (jsx(HideExpiredToggle, { hideExpired: hideExpired, setHideExpired: setHideExpiredState }))] }))) }) }, { children: !isMobile && (jsx(SubscriptionsNavigation, { expiredSwitchVisible: !hideExpiredToggle && expiredSwitchVisible, hideExpired: hideExpired, setHideExpired: setHideExpiredState, setQuantityDrawerOpen: setQuantityDrawerOpen, subscriptions: subscriptions })) })), jsx(SubscriptionsListContainer, { companyName: companyName, hideExpired: hideExpired, onCancelSubscriptionClick: onCancelSubscriptionClick, onChangePlanClick: onChangePlanClick, subscriptions: subscriptions, subscriptionsAreLoading: subscriptionsAreLoading, noSubscriptionsComponent: noSubscriptionsComponent }), isMobile && (jsx("div", __assign({ className: "bunny-pt-4 bunny-pb-2" }, { children: jsx(SubscriptionsNavigation, { expiredSwitchVisible: expiredSwitchVisible, hideExpired: hideExpired, setHideExpired: setHideExpiredState, setQuantityDrawerOpen: setQuantityDrawerOpen, subscriptions: subscriptions }) }))), jsx(
|
|
24076
|
+
return (jsxs("div", __assign({ className: className }, { children: [!hideTitle ? jsx(PageTitle, { title: 'Subscriptions' }) : null, jsx(PageHeaderWithActions, __assign({ title: jsx(Fragment, { children: !hideExpiredToggle && (jsxs(Text$1, __assign({ className: "bunny-flex bunny-items-center bunny-justify-between", style: { minWidth: '120px' } }, { children: [hideExpired ? 'Active subscriptions' : 'All subscriptions', isMobile && expiredSwitchVisible && (jsx(HideExpiredToggle, { hideExpired: hideExpired, setHideExpired: setHideExpiredState }))] }))) }) }, { children: !isMobile && (jsx(SubscriptionsNavigation, { expiredSwitchVisible: !hideExpiredToggle && expiredSwitchVisible, hideExpired: hideExpired, setHideExpired: setHideExpiredState, setQuantityDrawerOpen: setQuantityDrawerOpen, subscriptions: subscriptions })) })), jsx(SubscriptionsListContainer, { companyName: companyName, hideExpired: hideExpired, onCancelSubscriptionClick: onCancelSubscriptionClick, onChangePlanClick: onChangePlanClick, subscriptions: subscriptions, subscriptionsAreLoading: subscriptionsAreLoading, noSubscriptionsComponent: noSubscriptionsComponent }), isMobile && (jsx("div", __assign({ className: "bunny-pt-4 bunny-pb-2" }, { children: jsx(SubscriptionsNavigation, { expiredSwitchVisible: expiredSwitchVisible, hideExpired: hideExpired, setHideExpired: setHideExpiredState, setQuantityDrawerOpen: setQuantityDrawerOpen, subscriptions: subscriptions }) }))), jsx(QuantityDrawerContainer, { subscriptions: subscriptions, quantityDrawerOpen: quantityDrawerOpen, setQuantityDrawerOpen: setQuantityDrawerOpen, handlePortalErrors: handlePortalErrors, setHideExpiredState: setHideExpiredState })] })));
|
|
23622
24077
|
};
|
|
23623
24078
|
var PageHeaderWithActions = function (_a) {
|
|
23624
24079
|
var children = _a.children, title = _a.title;
|
|
@@ -23660,7 +24115,6 @@ var billingDetailsUpdate = function (_a) {
|
|
|
23660
24115
|
});
|
|
23661
24116
|
};
|
|
23662
24117
|
|
|
23663
|
-
// TODO: move this to common
|
|
23664
24118
|
var billingDetailsQuery = function () {
|
|
23665
24119
|
return "\nquery BillingDetails {\n billingDetails {\n billingCity\n billingContact {\n email\n }\n billingCountry\n billingState\n billingStreet\n billingZip\n name\n taxNumber\n currency {\n id\n }\n }\n}";
|
|
23666
24120
|
};
|
|
@@ -23865,9 +24319,6 @@ var PaymentFormSection = function (_a) {
|
|
|
23865
24319
|
var onTokenExpired = useContext(BunnyContext).onTokenExpired;
|
|
23866
24320
|
var handleAllErrorFormats = useAllErrorFormats(onTokenExpired);
|
|
23867
24321
|
var showSuccessNotification = useSuccessNotification();
|
|
23868
|
-
var token = useToken();
|
|
23869
|
-
var account = useCurrentUserData(token).account;
|
|
23870
|
-
var currencyId = account === null || account === void 0 ? void 0 : account.currencyId;
|
|
23871
24322
|
return (jsx("div", __assign({ className: "".concat(isMobile || hideBillingDetailsForm ? 'bunny-w-full' : 'bunny-w-1/2 bunny-pt-4', " bunny-flex bunny-justify-center") }, { children: jsx(PaymentForm, { onFail: function (error) {
|
|
23872
24323
|
handleAllErrorFormats(error);
|
|
23873
24324
|
}, onSavePaymentMethod: function (response) {
|
|
@@ -23877,7 +24328,7 @@ var PaymentFormSection = function (_a) {
|
|
|
23877
24328
|
// TODO: onSavePaymentMethod(response: any) should be cleaned up to have a response type (not any)
|
|
23878
24329
|
// and work with both stripe and demo pay requests
|
|
23879
24330
|
onSavePaymentMethod === null || onSavePaymentMethod === void 0 ? void 0 : onSavePaymentMethod(response);
|
|
23880
|
-
}
|
|
24331
|
+
} }) })));
|
|
23881
24332
|
};
|
|
23882
24333
|
|
|
23883
24334
|
export { BillingDetails, BunnyProvider, Footer, Invoice, MiniCreditCard, PaymentForm, Quote, Quotes, Signup, SubscriptionsWrapper as Subscriptions, Transactions };
|