@bunnyapp/components 1.0.44 → 1.0.46

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.
Files changed (128) hide show
  1. package/dist/cjs/index.js +2360 -525
  2. package/dist/cjs/src/components/Footer/BunnyFooterIcon.d.ts +4 -0
  3. package/dist/cjs/src/components/Footer/Footer.d.ts +4 -0
  4. package/dist/cjs/src/components/Quote/Quote.stories.d.ts +10 -10
  5. package/dist/cjs/src/components/Subscriptions/CheckIcon.d.ts +5 -0
  6. package/dist/cjs/src/components/Subscriptions/PageTitle.d.ts +5 -0
  7. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanManager.d.ts +5 -0
  8. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/NextPriceListButton.d.ts +8 -0
  9. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/PlanPicker.d.ts +7 -0
  10. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/PriceListGrid.d.ts +15 -0
  11. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/PriceListSelector.d.ts +11 -0
  12. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/checkoutBar/CheckoutBarInput.d.ts +8 -0
  13. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/checkoutBar/CheckoutBarSummarySection.d.ts +12 -0
  14. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/checkoutBar/CheckoutButton.d.ts +6 -0
  15. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/checkoutBar/CheckoutPrice.d.ts +7 -0
  16. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/checkoutBar/PlanPickerCheckoutBar.d.ts +5 -0
  17. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/BillingPeriodSelector.d.ts +11 -0
  18. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/EverythingPlanFeatures.d.ts +6 -0
  19. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/FeatureGridCell.d.ts +7 -0
  20. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/PlanFeatures.d.ts +7 -0
  21. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/PlanPickerGridCell.d.ts +6 -0
  22. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/PriceListCardDesktop.d.ts +14 -0
  23. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/PriceListGridDesktop.d.ts +15 -0
  24. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/consts.d.ts +1 -0
  25. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/planManagerUtils.d.ts +2 -0
  26. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/planPickerMobile/PriceListCardMobile.d.ts +14 -0
  27. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/planPickerMobile/PriceListGridMobile.d.ts +11 -0
  28. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/planPickerUtils.d.ts +12 -0
  29. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCard.d.ts +10 -0
  30. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCardButton.d.ts +9 -0
  31. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCardDescription.d.ts +4 -0
  32. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCardFeature.d.ts +6 -0
  33. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCardPrice.d.ts +6 -0
  34. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCardPriceDescription.d.ts +7 -0
  35. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCardTitle.d.ts +7 -0
  36. package/dist/cjs/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/priceListCardUtils.d.ts +10 -0
  37. package/dist/cjs/src/components/Subscriptions/PlanManager/PreviewModeAdvisary.d.ts +4 -0
  38. package/dist/cjs/src/components/Subscriptions/SubscriptionRequests.d.ts +2 -0
  39. package/dist/cjs/src/components/Subscriptions/Subscriptions.d.ts +10 -12
  40. package/dist/cjs/src/components/Subscriptions/SubscriptionsContext.d.ts +13 -0
  41. package/dist/cjs/src/components/Subscriptions/SubscriptionsListContainer.d.ts +16 -0
  42. package/dist/cjs/src/components/Subscriptions/quantityChangeDrawer/QuantityChangeGridRow.d.ts +11 -0
  43. package/dist/cjs/src/components/Subscriptions/quantityChangeDrawer/QuantityChangeGridTitle.d.ts +6 -0
  44. package/dist/cjs/src/components/Subscriptions/quantityChangeDrawer/QuantityInput.d.ts +21 -0
  45. package/dist/cjs/src/components/Subscriptions/quantityChangeDrawer/QuoteChangeSummarySection.d.ts +9 -0
  46. package/dist/cjs/src/components/Subscriptions/quantityChangeDrawer/quantityChangeDrawerDesktop/QuantityChangeDrawerDesktop.d.ts +14 -0
  47. package/dist/cjs/src/components/Subscriptions/subscriptionsList/ChangeQuantitiesButton.d.ts +5 -0
  48. package/dist/cjs/src/components/Subscriptions/subscriptionsList/HideExpiredToggle.d.ts +6 -0
  49. package/dist/cjs/src/components/Subscriptions/subscriptionsList/SubscriptionsNavigation.d.ts +9 -0
  50. package/dist/cjs/src/components/Subscriptions/subscriptionsList/subscriptionUtils.d.ts +5 -2
  51. package/dist/cjs/src/components/index.d.ts +0 -1
  52. package/dist/cjs/src/graphql/QuoteRequests.d.ts +6 -0
  53. package/dist/cjs/src/graphql/mutations/quoteCompose.d.ts +1 -1
  54. package/dist/cjs/src/graphql/queries/getPortalPreviewQuery.d.ts +2 -0
  55. package/dist/cjs/src/graphql/queries/getQuote.d.ts +7 -0
  56. package/dist/cjs/src/hooks/useCurrentUserData.d.ts +2 -0
  57. package/dist/cjs/src/index.d.ts +0 -1
  58. package/dist/cjs/src/utils/apiUtils.d.ts +2 -0
  59. package/dist/cjs/src/utils/pricePickerUtils.d.ts +5 -0
  60. package/dist/esm/index.js +2363 -526
  61. package/dist/esm/src/components/Footer/BunnyFooterIcon.d.ts +4 -0
  62. package/dist/esm/src/components/Footer/Footer.d.ts +4 -0
  63. package/dist/esm/src/components/Quote/Quote.stories.d.ts +10 -10
  64. package/dist/esm/src/components/Subscriptions/CheckIcon.d.ts +5 -0
  65. package/dist/esm/src/components/Subscriptions/PageTitle.d.ts +5 -0
  66. package/dist/esm/src/components/Subscriptions/PlanManager/PlanManager.d.ts +5 -0
  67. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/NextPriceListButton.d.ts +8 -0
  68. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/PlanPicker.d.ts +7 -0
  69. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/PriceListGrid.d.ts +15 -0
  70. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/PriceListSelector.d.ts +11 -0
  71. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/checkoutBar/CheckoutBarInput.d.ts +8 -0
  72. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/checkoutBar/CheckoutBarSummarySection.d.ts +12 -0
  73. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/checkoutBar/CheckoutButton.d.ts +6 -0
  74. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/checkoutBar/CheckoutPrice.d.ts +7 -0
  75. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/checkoutBar/PlanPickerCheckoutBar.d.ts +5 -0
  76. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/BillingPeriodSelector.d.ts +11 -0
  77. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/EverythingPlanFeatures.d.ts +6 -0
  78. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/FeatureGridCell.d.ts +7 -0
  79. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/PlanFeatures.d.ts +7 -0
  80. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/PlanPickerGridCell.d.ts +6 -0
  81. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/PriceListCardDesktop.d.ts +14 -0
  82. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/PriceListGridDesktop.d.ts +15 -0
  83. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/consts.d.ts +1 -0
  84. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/planPickerDesktop/planManagerUtils.d.ts +2 -0
  85. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/planPickerMobile/PriceListCardMobile.d.ts +14 -0
  86. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/planPickerMobile/PriceListGridMobile.d.ts +11 -0
  87. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/planPickerUtils.d.ts +12 -0
  88. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCard.d.ts +10 -0
  89. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCardButton.d.ts +9 -0
  90. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCardDescription.d.ts +4 -0
  91. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCardFeature.d.ts +6 -0
  92. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCardPrice.d.ts +6 -0
  93. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCardPriceDescription.d.ts +7 -0
  94. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/PriceListCardTitle.d.ts +7 -0
  95. package/dist/esm/src/components/Subscriptions/PlanManager/PlanPicker/priceListCard/priceListCardUtils.d.ts +10 -0
  96. package/dist/esm/src/components/Subscriptions/PlanManager/PreviewModeAdvisary.d.ts +4 -0
  97. package/dist/esm/src/components/Subscriptions/SubscriptionRequests.d.ts +2 -0
  98. package/dist/esm/src/components/Subscriptions/Subscriptions.d.ts +10 -12
  99. package/dist/esm/src/components/Subscriptions/SubscriptionsContext.d.ts +13 -0
  100. package/dist/esm/src/components/Subscriptions/SubscriptionsListContainer.d.ts +16 -0
  101. package/dist/esm/src/components/Subscriptions/quantityChangeDrawer/QuantityChangeGridRow.d.ts +11 -0
  102. package/dist/esm/src/components/Subscriptions/quantityChangeDrawer/QuantityChangeGridTitle.d.ts +6 -0
  103. package/dist/esm/src/components/Subscriptions/quantityChangeDrawer/QuantityInput.d.ts +21 -0
  104. package/dist/esm/src/components/Subscriptions/quantityChangeDrawer/QuoteChangeSummarySection.d.ts +9 -0
  105. package/dist/esm/src/components/Subscriptions/quantityChangeDrawer/quantityChangeDrawerDesktop/QuantityChangeDrawerDesktop.d.ts +14 -0
  106. package/dist/esm/src/components/Subscriptions/subscriptionsList/ChangeQuantitiesButton.d.ts +5 -0
  107. package/dist/esm/src/components/Subscriptions/subscriptionsList/HideExpiredToggle.d.ts +6 -0
  108. package/dist/esm/src/components/Subscriptions/subscriptionsList/SubscriptionsNavigation.d.ts +9 -0
  109. package/dist/esm/src/components/Subscriptions/subscriptionsList/subscriptionUtils.d.ts +5 -2
  110. package/dist/esm/src/components/index.d.ts +0 -1
  111. package/dist/esm/src/graphql/QuoteRequests.d.ts +6 -0
  112. package/dist/esm/src/graphql/mutations/quoteCompose.d.ts +1 -1
  113. package/dist/esm/src/graphql/queries/getPortalPreviewQuery.d.ts +2 -0
  114. package/dist/esm/src/graphql/queries/getQuote.d.ts +7 -0
  115. package/dist/esm/src/hooks/useCurrentUserData.d.ts +2 -0
  116. package/dist/esm/src/index.d.ts +0 -1
  117. package/dist/esm/src/utils/apiUtils.d.ts +2 -0
  118. package/dist/esm/src/utils/pricePickerUtils.d.ts +5 -0
  119. package/dist/index.d.ts +10 -42
  120. package/package.json +2 -2
  121. package/dist/cjs/src/components/Checkout/index.d.ts +0 -2
  122. package/dist/cjs/src/graphql/mutations/quoteSubscriptionReinstate.d.ts +0 -7
  123. package/dist/cjs/src/hooks/index.d.ts +0 -1
  124. package/dist/cjs/src/utils/quoteInvoiceUtils.d.ts +0 -6
  125. package/dist/esm/src/components/Checkout/index.d.ts +0 -2
  126. package/dist/esm/src/graphql/mutations/quoteSubscriptionReinstate.d.ts +0 -7
  127. package/dist/esm/src/hooks/index.d.ts +0 -1
  128. package/dist/esm/src/utils/quoteInvoiceUtils.d.ts +0 -6
package/dist/esm/index.js CHANGED
@@ -1,17 +1,19 @@
1
1
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
2
  import { createContext, useEffect, useState, useContext, useMemo, useCallback, useRef } from 'react';
3
3
  import { Markup } from 'interweave';
4
- import { ConfigProvider, Button, Typography, Tag, Divider, Popconfirm, Input, Checkbox, Collapse, Skeleton, Modal, Form, Drawer, Card as Card$1, Select, Image, Dropdown } from 'antd';
5
- import { DownloadOutlined, CreditCardOutlined, BankOutlined, SearchOutlined, CloseOutlined, CheckCircleFilled } from '@ant-design/icons';
4
+ import { ConfigProvider, Button, Typography, Tag, Divider, Popconfirm, Input, Checkbox, Collapse, Skeleton, Modal, Form, Drawer, Card as Card$1, Image, Select, Tooltip, Radio, Space, Dropdown } from 'antd';
5
+ import { DownloadOutlined, CreditCardOutlined, BankOutlined, SearchOutlined, CloseOutlined, CheckCircleFilled, ArrowLeftOutlined } 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, QueryKeyFactory, useIsMobile, isColorTooDark, MARK_PRO, INPUT_BORDER_COLOR, SLATE_50, SLATE_400, SLATE_200, getPlugins, useAllErrorFormats, formatCurrency, invokePlugin, GRAY_500, GRAY_200, useErrorNotification, useSuccessNotification, getFormattedInvoice, PAYABLE_INVOICE_STATES, BreakpointNumbers, useGraphQLmutation, formatDate, FrontendTransaction, SLATE_600, WHITE, TransactionKind, Lists, getAccount, sortSubscriptionCharges, MODAL_MAX_HEIGHT, SLATE_500, DataInterval, SubscriptionState as SubscriptionState$2, TAG_COLORS, ChargeType, SubscriptionChargeKind, PricingModel } from '@bunnyapp/common';
7
+ import { DEFAULT_ACCENT_COLOR, DEFAULT_BRAND_COLOR, DEFAULT_SECONDARY_COLOR, DEFAULT_TOP_NAV_IMAGE_URL, gqlRequest, QueryKeyFactory, useIsMobile, isColorTooDark, MARK_PRO, INPUT_BORDER_COLOR, SLATE_50, SLATE_400, SLATE_200, getPlugins, useAllErrorFormats, formatCurrency, invokePlugin, GRAY_500, GRAY_200, useErrorNotification, useSuccessNotification, getFormattedInvoice, PAYABLE_INVOICE_STATES, BreakpointNumbers, useGraphQLmutation, formatDate, FrontendTransaction, SLATE_600, WHITE, TransactionKind, sortSubscriptionCharges, Lists, getAccount, SLATE_500, PRIMARY_COLOR, StringUtils, BillingPeriod, ChargeType, SubscriptionState as SubscriptionState$2, PERIOD_LABELS, PricingStyle, PricingModel, SLATE_100, useInfoNotification, MODAL_MAX_HEIGHT, DataInterval, TAG_COLORS, SubscriptionChargeKind } from '@bunnyapp/common';
8
8
  import { QueryClient, QueryClientProvider, useQuery, useQueryClient, keepPreviousData, useMutation } from '@tanstack/react-query';
9
9
  import theme from 'antd/lib/theme/index.js';
10
10
  import { RecoilRoot } from 'recoil';
11
- import { GraphQLClient } from 'graphql-request';
11
+ import request, { GraphQLClient } from 'graphql-request';
12
12
  import { useElements, useStripe, PaymentElement, Elements } from '@stripe/react-stripe-js';
13
13
  import { loadStripe } from '@stripe/stripe-js/pure/index.js';
14
- import { BarChart, ResponsiveContainer, XAxis, Tooltip, Bar, Rectangle } from 'recharts';
14
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
15
+ import { faChevronLeft, faChevronRight } from '@fortawesome/free-solid-svg-icons';
16
+ import { BarChart, ResponsiveContainer, XAxis, Tooltip as Tooltip$1, Bar, Rectangle } from 'recharts';
15
17
  import { omit } from 'lodash-es';
16
18
  import pkg from 'pluralize';
17
19
 
@@ -42,7 +44,7 @@ function styleInject(css, ref) {
42
44
  }
43
45
  }
44
46
 
45
- var css_248z = ".ant-divider-horizontal {\n margin: 0;\n}\n.ant-divider-horizontal {\n margin: 0;\n}\n.ant-tag {\n border: none;\n border-radius: 14px;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n font-weight: 500;\n white-space: nowrap;\n margin: 0;\n}\n.ant-tag-blue {\n color: #3b82f6 !important;\n background: #bfdbfe !important;\n}\n.ant-tag-green {\n color: #059669 !important;\n background: #a7f3d0 !important;\n}\n.ant-tag-red {\n color: #ef4444 !important;\n background: #fecaca !important;\n}\n.ant-tag-orange {\n color: #f97316 !important;\n background: #fed7aa !important;\n}\n.ant-tag-yellow {\n color: #f59e0b !important;\n background: #fde68a !important;\n}\n.ant-tag-purple {\n color: #8b5cf6 !important;\n background: #ddd6fe !important;\n}\n.ant-tag-black {\n color: white !important;\n background: black !important;\n}\n.ant-popover {\n z-index: 1050;\n}\n.ant-popover-inner-content {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n max-width: 300px;\n}\n.ant-popover-message-title {\n padding: 0;\n text-align: center;\n font-size: 1rem;\n}\n.ant-popover-buttons {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.ant-btn-link:disabled {\n color: #717d94 !important;\n}\n.ant-btn-link:disabled:hover {\n background-color: transparent !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 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 color: #232323 !important;\n font-size: 14px !important;\n word-break: break-all !important;\n overflow-wrap: break-word !important;\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: #ff6e1c !important;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji !important;\n font-weight: 500;\n}\n.ant-notification-notice-error .ant-notification-notice-icon {\n color: #ff6e1c;\n}\n.ant-notification-notice-success .ant-notification-notice-message {\n color: #00b76a !important;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji !important;\n font-weight: 500;\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.ant-menu-submenu-popup > .ant-menu .ant-menu-item {\n display: flex !important;\n align-items: center !important;\n}\n.ant-menu-submenu::after {\n display: none !important;\n}\n: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}\n.plan-step-line {\n height: 1px;\n min-width: 128px;\n background: #717d94;\n}\n.plan-step-number {\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 9999px;\n border: 1px solid #717d94;\n background: white;\n width: 24px;\n height: 24px;\n color: #717d94;\n}\n.plan-step-number.active {\n border: none;\n color: white;\n background: #ff6e1c;\n}\n.hidden {\n display: none;\n}\n.cardElement {\n padding: 8px 11px;\n border: 1px solid #e5e7eb;\n background-color: white;\n font-family: Inter !important;\n}\n.tooltip {\n visibility: hidden;\n position: absolute !important;\n}\n.has-tooltip:hover .tooltip {\n visibility: visible;\n z-index: 100;\n}\n.show-on-hover {\n opacity: 0;\n}\n.show-on-hover-container:hover .show-on-hover {\n opacity: 1;\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#form-element #finix-form-container .field-holder label {\n color: #717d94 !important;\n font-size: 12px !important;\n}\n#form-element #finix-form-container > *:first-child,\n#form-element #finix-form-container > *:last-child {\n margin-top: 0 !important;\n}\n#form-element #finix-form-container > *:not(:first-child):not(:last-child) {\n margin-top: 12px !important;\n}\n#form-element #finix-form-container .field-array > * {\n margin-top: 0 !important;\n}\n#form-element #finix-form-container .field-holder .field,\n#form-element #finix-form-container iframe {\n height: 34px !important;\n}\n#form-element #finix-form-container .field {\n margin-top: 0 !important;\n padding-top: 2px !important;\n}\n#form-element #finix-form-container .field-holder .validation {\n font-size: 11px !important;\n color: #ff4d4f !important;\n}\n.icon-path {\n transition: fill 0.3s;\n}\n.shadow-padding-x {\n padding-right: 1rem;\n padding-left: 1rem;\n}\n.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 .shadow-padding-x {\n padding-right: 2rem;\n padding-left: 2rem;\n }\n .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.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.bottom-0 {\n bottom: 0px;\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.m-0 {\n margin: 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-4 {\n margin-bottom: 1rem;\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-full {\n height: 100%;\n}\n.w-1\\/2 {\n width: 50%;\n}\n.w-1\\/3 {\n width: 33.333333%;\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.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-4 {\n gap: 1rem;\n}\n.gap-6 {\n gap: 1.5rem;\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-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-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.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-6 {\n padding-top: 1.5rem;\n}\n.pt-8 {\n padding-top: 2rem;\n}\n.pb-1 {\n padding-bottom: 0.25rem;\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-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-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-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.font-light {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n.font-medium {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n.font-bold {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\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@media (min-width: 768px) {\n .sm\\:flex {\n display: flex;\n }\n .sm\\:hidden {\n display: none;\n }\n}\n* {\n margin: 0;\n padding: 0;\n box-sizing: border-box !important;\n line-height: 1.15;\n}\nbody {\n color: #232323;\n background-color: #f8fafc;\n}\nth {\n font-weight: normal;\n}\ncode {\n font-family: source-code-pro, Menlo, Monaco, Consolas, \"Courier New\", monospace;\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";
47
+ var css_248z = ".ant-divider-horizontal {\n margin: 0;\n}\n.ant-divider-horizontal {\n margin: 0;\n}\n.ant-tag {\n border: none;\n border-radius: 14px;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n font-weight: 500;\n white-space: nowrap;\n margin: 0;\n}\n.ant-tag-blue {\n color: #3b82f6 !important;\n background: #bfdbfe !important;\n}\n.ant-tag-green {\n color: #059669 !important;\n background: #a7f3d0 !important;\n}\n.ant-tag-red {\n color: #ef4444 !important;\n background: #fecaca !important;\n}\n.ant-tag-orange {\n color: #f97316 !important;\n background: #fed7aa !important;\n}\n.ant-tag-yellow {\n color: #f59e0b !important;\n background: #fde68a !important;\n}\n.ant-tag-purple {\n color: #8b5cf6 !important;\n background: #ddd6fe !important;\n}\n.ant-tag-black {\n color: white !important;\n background: black !important;\n}\n.ant-popover {\n z-index: 1050;\n}\n.ant-popover-inner-content {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n max-width: 300px;\n}\n.ant-popover-message-title {\n padding: 0;\n text-align: center;\n font-size: 1rem;\n}\n.ant-popover-buttons {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.ant-btn-link:disabled {\n color: #717d94 !important;\n}\n.ant-btn-link:disabled:hover {\n background-color: transparent !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 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 color: #232323 !important;\n font-size: 14px !important;\n word-break: break-all !important;\n overflow-wrap: break-word !important;\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: #ff6e1c !important;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji !important;\n font-weight: 500;\n}\n.ant-notification-notice-error .ant-notification-notice-icon {\n color: #ff6e1c;\n}\n.ant-notification-notice-success .ant-notification-notice-message {\n color: #00b76a !important;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji !important;\n font-weight: 500;\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.ant-menu-submenu-popup > .ant-menu .ant-menu-item {\n display: flex !important;\n align-items: center !important;\n}\n.ant-menu-submenu::after {\n display: none !important;\n}\n: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}\n.plan-step-line {\n height: 1px;\n min-width: 128px;\n background: #717d94;\n}\n.plan-step-number {\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 9999px;\n border: 1px solid #717d94;\n background: white;\n width: 24px;\n height: 24px;\n color: #717d94;\n}\n.plan-step-number.active {\n border: none;\n color: white;\n background: #ff6e1c;\n}\n.hidden {\n display: none;\n}\n.cardElement {\n padding: 8px 11px;\n border: 1px solid #e5e7eb;\n background-color: white;\n font-family: Inter !important;\n}\n.tooltip {\n visibility: hidden;\n position: absolute !important;\n}\n.has-tooltip:hover .tooltip {\n visibility: visible;\n z-index: 100;\n}\n.show-on-hover {\n opacity: 0;\n}\n.show-on-hover-container:hover .show-on-hover {\n opacity: 1;\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#form-element #finix-form-container .field-holder label {\n color: #717d94 !important;\n font-size: 12px !important;\n}\n#form-element #finix-form-container > *:first-child,\n#form-element #finix-form-container > *:last-child {\n margin-top: 0 !important;\n}\n#form-element #finix-form-container > *:not(:first-child):not(:last-child) {\n margin-top: 12px !important;\n}\n#form-element #finix-form-container .field-array > * {\n margin-top: 0 !important;\n}\n#form-element #finix-form-container .field-holder .field,\n#form-element #finix-form-container iframe {\n height: 34px !important;\n}\n#form-element #finix-form-container .field {\n margin-top: 0 !important;\n padding-top: 2px !important;\n}\n#form-element #finix-form-container .field-holder .validation {\n font-size: 11px !important;\n color: #ff4d4f !important;\n}\n.icon-path {\n transition: fill 0.3s;\n}\n.shadow-padding-x {\n padding-right: 1rem;\n padding-left: 1rem;\n}\n.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 .shadow-padding-x {\n padding-right: 2rem;\n padding-left: 2rem;\n }\n .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.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.\\!container {\n width: 100% !important;\n}\n@media (min-width: 768px) {\n .container {\n max-width: 768px;\n }\n .\\!container {\n max-width: 768px !important;\n }\n}\n@media (min-width: 1024px) {\n .container {\n max-width: 1024px;\n }\n .\\!container {\n max-width: 1024px !important;\n }\n}\n@media (min-width: 1280px) {\n .container {\n max-width: 1280px;\n }\n .\\!container {\n max-width: 1280px !important;\n }\n}\n@media (min-width: 1536px) {\n .container {\n max-width: 1536px;\n }\n .\\!container {\n max-width: 1536px !important;\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.bottom-0 {\n bottom: 0px;\n}\n.left-0 {\n left: 0px;\n}\n.right-0 {\n right: 0px;\n}\n.top-0 {\n top: 0px;\n}\n.bottom-16 {\n bottom: 4rem;\n}\n.bottom-8 {\n bottom: 2rem;\n}\n.bottom-4 {\n bottom: 1rem;\n}\n.top-32 {\n top: 8rem;\n}\n.top-16 {\n top: 4rem;\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-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.mx-8 {\n margin-left: 2rem;\n margin-right: 2rem;\n}\n.mx-0 {\n margin-left: 0px;\n margin-right: 0px;\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.h-10 {\n height: 2.5rem;\n}\n.w-1\\/2 {\n width: 50%;\n}\n.w-1\\/3 {\n width: 33.333333%;\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.w-10 {\n width: 2.5rem;\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.border-gray-300 {\n --tw-border-opacity: 1;\n border-color: rgb(209 213 219 / 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.bg-blue-500 {\n --tw-bg-opacity: 1;\n background-color: rgb(59 130 246 / var(--tw-bg-opacity, 1));\n}\n.p-0 {\n padding: 0px;\n}\n.p-1 {\n padding: 0.25rem;\n}\n.p-16 {\n padding: 4rem;\n}\n.p-2 {\n padding: 0.5rem;\n}\n.p-4 {\n padding: 1rem;\n}\n.p-8 {\n padding: 2rem;\n}\n.p-48 {\n padding: 12rem;\n}\n.p-44 {\n padding: 11rem;\n}\n.px-12 {\n padding-left: 3rem;\n padding-right: 3rem;\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.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.px-16 {\n padding-left: 4rem;\n padding-right: 4rem;\n}\n.px-32 {\n padding-left: 8rem;\n padding-right: 8rem;\n}\n.px-48 {\n padding-left: 12rem;\n padding-right: 12rem;\n}\n.px-8 {\n padding-left: 2rem;\n padding-right: 2rem;\n}\n.px-0 {\n padding-left: 0px;\n padding-right: 0px;\n}\n.px-10 {\n padding-left: 2.5rem;\n padding-right: 2.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.pl-1 {\n padding-left: 0.25rem;\n}\n.pb-32 {\n padding-bottom: 8rem;\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-all {\n transition-property: all;\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.duration-200 {\n transition-duration: 200ms;\n}\n.duration-300 {\n transition-duration: 300ms;\n}\n.ease-in-out {\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n}\n.font-light {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n.font-medium {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n.font-bold {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\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@media (min-width: 768px) {\n .sm\\:flex {\n display: flex;\n }\n .sm\\:hidden {\n display: none;\n }\n}\n* {\n margin: 0;\n padding: 0;\n box-sizing: border-box !important;\n line-height: 1.15;\n}\nbody {\n color: #232323;\n background-color: #f8fafc;\n}\nth {\n font-weight: normal;\n}\ncode {\n font-family: source-code-pro, Menlo, Monaco, Consolas, \"Courier New\", monospace;\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";
46
48
  styleInject(css_248z);
47
49
 
48
50
  /******************************************************************************
@@ -139,7 +141,7 @@ var BrandContext = createContext({
139
141
  topNavImageUrl: DEFAULT_TOP_NAV_IMAGE_URL,
140
142
  });
141
143
 
142
- var MUTATION$8 = "\n query entityBranding {\n entityBranding {\n accentColor\n brandColor\n topNavImageUrl\n }\n }\n";
144
+ var MUTATION$9 = "\n query entityBranding {\n entityBranding {\n accentColor\n brandColor\n topNavImageUrl\n }\n }\n";
143
145
  var getBranding = function (_a) {
144
146
  var token = _a.token, apiHost = _a.apiHost;
145
147
  return __awaiter(void 0, void 0, void 0, function () {
@@ -147,7 +149,7 @@ var getBranding = function (_a) {
147
149
  return __generator(this, function (_b) {
148
150
  switch (_b.label) {
149
151
  case 0: return [4 /*yield*/, gqlRequest({
150
- query: MUTATION$8,
152
+ query: MUTATION$9,
151
153
  token: token,
152
154
  apiHost: apiHost,
153
155
  })];
@@ -204,7 +206,9 @@ function ContextualWrapper(_a) {
204
206
  var entityBranding = useMemo(function () {
205
207
  var _a;
206
208
  // This is to determine if the secondary color should be white or black
207
- var brandColor = (branding === null || branding === void 0 ? void 0 : branding.brandColor) ? "#" + ((_a = branding === null || branding === void 0 ? void 0 : branding.brandColor) === null || _a === void 0 ? void 0 : _a.toString(16)) : DEFAULT_BRAND_COLOR;
209
+ var brandColor = (branding === null || branding === void 0 ? void 0 : branding.brandColor)
210
+ ? "#" + ((_a = branding === null || branding === void 0 ? void 0 : branding.brandColor) === null || _a === void 0 ? void 0 : _a.toString(16))
211
+ : DEFAULT_BRAND_COLOR;
208
212
  var secondaryColor = DEFAULT_SECONDARY_COLOR;
209
213
  if (!isMobile && isColorTooDark(branding === null || branding === void 0 ? void 0 : branding.accentColor))
210
214
  secondaryColor = "#ffffff";
@@ -239,11 +243,17 @@ function ContextualWrapper(_a) {
239
243
  boxShadowSecondary: "none",
240
244
  fontWeight: "normal",
241
245
  contentFontSizeLG: 14,
242
- colorBgContainerDisabled: darkMode ? "var(--row-background-dark)" : "#eef0f2",
243
- borderColorDisabled: darkMode ? "var(--row-background-dark)" : "#eef0f2",
246
+ colorBgContainerDisabled: darkMode
247
+ ? "var(--row-background-dark)"
248
+ : "#eef0f2",
249
+ borderColorDisabled: darkMode
250
+ ? "var(--row-background-dark)"
251
+ : "#eef0f2",
244
252
  },
245
253
  Drawer: {
246
- colorBgElevated: darkMode ? "var(--row-background-dark)" : SLATE_50,
254
+ colorBgElevated: darkMode
255
+ ? "var(--row-background-dark)"
256
+ : SLATE_50,
247
257
  },
248
258
  Divider: {
249
259
  colorSplit: darkMode ? SLATE_400 : SLATE_200,
@@ -339,7 +349,7 @@ function useToken() {
339
349
  return overrideToken || tokenFromContext;
340
350
  }
341
351
 
342
- var MarkupContainer = defaultStyled.div(templateObject_1$7 || (templateObject_1$7 = __makeTemplateObject(["\n span {\n width: 100%;\n }\n"], ["\n span {\n width: 100%;\n }\n"])));
352
+ var MarkupContainer = defaultStyled.div(templateObject_1$b || (templateObject_1$b = __makeTemplateObject(["\n span {\n width: 100%;\n }\n"], ["\n span {\n width: 100%;\n }\n"])));
343
353
  var InvoiceQuoteView = function (_a) {
344
354
  var children = _a.children, formattedInvoice = _a.formattedInvoice, html = _a.html, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick, onDownloadError = _a.onDownloadError;
345
355
  var downloadFile = useDownloadFile(formattedInvoice === null || formattedInvoice === void 0 ? void 0 : formattedInvoice.id, onDownloadError);
@@ -357,7 +367,7 @@ var InvoiceQuoteView = function (_a) {
357
367
  minWidth: "750px",
358
368
  } }, { children: [jsx(Markup, { content: html }), children] })))] })));
359
369
  };
360
- var templateObject_1$7;
370
+ var templateObject_1$b;
361
371
 
362
372
  var fetchPDF = function (apiEndpoint, invoiceUuid, token) { return __awaiter(void 0, void 0, void 0, function () {
363
373
  var response;
@@ -487,7 +497,7 @@ var getQuoteAmountDue = function (quote) {
487
497
  return quote.amountDue;
488
498
  };
489
499
 
490
- var MUTATION$7 = "\n mutation checkout(\n $invoiceId: ID,\n $quoteId: ID,\n $paymentMethodId: ID,\n $paymentMethodData: CheckoutPaymentMethodAttributes\n ) {\n checkout(\n invoiceId: $invoiceId,\n quoteId: $quoteId,\n paymentMethodId: $paymentMethodId,\n paymentMethodData: $paymentMethodData\n ) {\n invoice {\n id\n state\n amount\n amountDue\n }\n payment {\n id\n state\n amount\n }\n paymentApplication {\n id\n invoiceId\n paymentId\n }\n transaction {\n id\n amount\n }\n }\n }\n";
500
+ var MUTATION$8 = "\n mutation checkout(\n $invoiceId: ID,\n $quoteId: ID,\n $paymentMethodId: ID,\n $paymentMethodData: CheckoutPaymentMethodAttributes\n ) {\n checkout(\n invoiceId: $invoiceId,\n quoteId: $quoteId,\n paymentMethodId: $paymentMethodId,\n paymentMethodData: $paymentMethodData\n ) {\n invoice {\n id\n state\n amount\n amountDue\n }\n payment {\n id\n state\n amount\n }\n paymentApplication {\n id\n invoiceId\n paymentId\n }\n transaction {\n id\n amount\n }\n }\n }\n";
491
501
  var checkout = function (_a) {
492
502
  var quoteId = _a.quoteId, invoiceId = _a.invoiceId, paymentMethodId = _a.paymentMethodId, paymentMethodData = _a.paymentMethodData, token = _a.token, apiHost = _a.apiHost;
493
503
  return __awaiter(void 0, void 0, void 0, function () {
@@ -504,7 +514,7 @@ var checkout = function (_a) {
504
514
  mutationVars.paymentMethodData = __assign(__assign({}, paymentMethodData), { metadata: paymentMethodData.metadata });
505
515
  }
506
516
  return [4 /*yield*/, gqlRequest({
507
- query: MUTATION$7,
517
+ query: MUTATION$8,
508
518
  token: token,
509
519
  vars: mutationVars,
510
520
  apiHost: apiHost,
@@ -723,13 +733,13 @@ var PlusIcon = function (_a) {
723
733
  return (jsxs("svg", __assign({ width: "14", height: "15", viewBox: "0 0 14 15", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: [jsx("path", { d: "M2.9165 7.5H11.0832", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), jsx("path", { d: "M7 3.41663V11.5833", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })] })));
724
734
  };
725
735
 
726
- var Text$e = Typography.Text;
736
+ var Text$p = Typography.Text;
727
737
  var CreditCard = function (_a) {
728
738
  var _b;
729
739
  var onClickRemove = _a.onClickRemove, onClickUpdate = _a.onClickUpdate, paymentMethodData = _a.paymentMethodData, _c = _a.shadow, shadow = _c === void 0 ? "shadow-md" : _c, _d = _a.cardEnabled, cardEnabled = _d === void 0 ? true : _d;
730
740
  var isMobile = useIsMobile();
731
741
  var Wrapper = cardEnabled ? Card : "div";
732
- return (jsxs(Wrapper, __assign({ className: "".concat(cardEnabled ? shadow : "", " m-0") }, { children: [jsxs("div", __assign({ className: "flex items-center justify-between gap-4 p-4" }, { children: [jsxs("div", __assign({ className: "flex items-center gap-4" }, { children: [jsxs("div", __assign({ className: "flex items-center gap-2" }, { children: [jsx(CardImage, { paymentMethodData: paymentMethodData }), jsx(Text$e, { children: (_b = paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.metadata) === null || _b === void 0 ? void 0 : _b.identifier })] })), jsx(Tag, __assign({ color: isExpired(paymentMethodData) ? "red" : "green" }, { children: isExpired(paymentMethodData) ? "Expired" : "Valid" }))] })), !isMobile && (jsx(CardActions, { onClickRemove: onClickRemove, onClickUpdate: onClickUpdate }))] })), dayjs(paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.expirationDate).isValid() && (jsxs(Fragment, { children: [jsx(Divider, {}), jsxs("div", __assign({ className: "flex flex-col p-4" }, { children: [jsx(CardAttribute, { title: "EXPIRATION", value: expirationDate(paymentMethodData) }), isMobile && (jsx(CardActions, { onClickRemove: onClickRemove, onClickUpdate: onClickUpdate }))] }))] }))] })));
742
+ return (jsxs(Wrapper, __assign({ className: "".concat(cardEnabled ? shadow : "", " m-0") }, { children: [jsxs("div", __assign({ className: "flex items-center justify-between gap-4 p-4" }, { children: [jsxs("div", __assign({ className: "flex items-center gap-4" }, { children: [jsxs("div", __assign({ className: "flex items-center gap-2" }, { children: [jsx(CardImage, { paymentMethodData: paymentMethodData }), jsx(Text$p, { children: (_b = paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.metadata) === null || _b === void 0 ? void 0 : _b.identifier })] })), jsx(Tag, __assign({ color: isExpired(paymentMethodData) ? "red" : "green" }, { children: isExpired(paymentMethodData) ? "Expired" : "Valid" }))] })), !isMobile && (jsx(CardActions, { onClickRemove: onClickRemove, onClickUpdate: onClickUpdate }))] })), dayjs(paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.expirationDate).isValid() && (jsxs(Fragment, { children: [jsx(Divider, {}), jsxs("div", __assign({ className: "flex flex-col p-4" }, { children: [jsx(CardAttribute, { title: "EXPIRATION", value: expirationDate(paymentMethodData) }), isMobile && (jsx(CardActions, { onClickRemove: onClickRemove, onClickUpdate: onClickUpdate }))] }))] }))] })));
733
743
  };
734
744
  var MiniCreditCard = function (_a) {
735
745
  var _b;
@@ -741,7 +751,7 @@ var MiniCreditCard = function (_a) {
741
751
  var backgroundColor = useMemo(function () {
742
752
  return darkMode ? "var(--row-background-alternate)" : "bg-slate-50";
743
753
  }, [darkMode]);
744
- return (jsx("div", __assign({ className: "flex flex-row justify-between items-center p-1 px-3 border-solid ".concat(backgroundColor, " ").concat(borderColor, " rounded-md border") }, { children: paymentMethodData ? (jsxs(Fragment, { children: [jsx("div", __assign({ className: "flex flex-row gap-4" }, { children: jsxs("div", __assign({ className: "flex items-center gap-4 space-between w-full" }, { children: [jsx(CardImage, { paymentMethodData: paymentMethodData }), jsx(Text$e, { children: (_b = paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.metadata) === null || _b === void 0 ? void 0 : _b.identifier }), jsx(Tag, __assign({ color: isExpired(paymentMethodData) ? "red" : "green" }, { children: isExpired(paymentMethodData) ? "Expired" : "Valid" }))] })) })), !hideRemoveButton && (jsx(Popconfirm, __assign({ title: "Remove card?", onConfirm: onClickRemove }, { children: jsx(Button, __assign({ className: "font-normal p-0", type: "link" }, { children: "Remove" })) })))] })) : (jsxs("div", __assign({ className: "flex flex-row gap-2 items-center" }, { children: [jsx(CreditCardOutlined, {}), jsx(Text$e, __assign({ className: "text-slate-400", style: { fontSize: "11px" } }, { children: "No payment method selected" })), jsx(Button, { disabled: true, type: "link" })] }))) })));
754
+ return (jsx("div", __assign({ className: "flex flex-row justify-between items-center p-1 px-3 border-solid ".concat(backgroundColor, " ").concat(borderColor, " rounded-md border") }, { children: paymentMethodData ? (jsxs(Fragment, { children: [jsx("div", __assign({ className: "flex flex-row gap-4" }, { children: jsxs("div", __assign({ className: "flex items-center gap-4 space-between w-full" }, { children: [jsx(CardImage, { paymentMethodData: paymentMethodData }), jsx(Text$p, { children: (_b = paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.metadata) === null || _b === void 0 ? void 0 : _b.identifier }), jsx(Tag, __assign({ color: isExpired(paymentMethodData) ? "red" : "green" }, { children: isExpired(paymentMethodData) ? "Expired" : "Valid" }))] })) })), !hideRemoveButton && (jsx(Popconfirm, __assign({ title: "Remove card?", onConfirm: onClickRemove }, { children: jsx(Button, __assign({ className: "font-normal p-0", type: "link" }, { children: "Remove" })) })))] })) : (jsxs("div", __assign({ className: "flex flex-row gap-2 items-center" }, { children: [jsx(CreditCardOutlined, {}), jsx(Text$p, __assign({ className: "text-slate-400", style: { fontSize: "11px" } }, { children: "No payment method selected" })), jsx(Button, { disabled: true, type: "link" })] }))) })));
745
755
  };
746
756
  var CardImage = function (_a) {
747
757
  var _b, _c;
@@ -760,7 +770,7 @@ var CardImage = function (_a) {
760
770
  };
761
771
  var CardAttribute = function (_a) {
762
772
  var title = _a.title, value = _a.value;
763
- return (jsxs("div", __assign({ className: "flex flex-col gap-2" }, { children: [jsx("div", __assign({ className: "text-slate-400", style: { fontSize: "11px" } }, { children: title })), jsx(Text$e, { children: value })] })));
773
+ return (jsxs("div", __assign({ className: "flex flex-col gap-2" }, { children: [jsx("div", __assign({ className: "text-slate-400", style: { fontSize: "11px" } }, { children: title })), jsx(Text$p, { children: value })] })));
764
774
  };
765
775
  var CardActions = function (_a) {
766
776
  var onClickRemove = _a.onClickRemove, onClickUpdate = _a.onClickUpdate;
@@ -941,7 +951,7 @@ function useSave$1(_a) {
941
951
  return { save: save, isSaving: isSaving };
942
952
  }
943
953
 
944
- var Text$d = Typography.Text;
954
+ var Text$o = Typography.Text;
945
955
  var TEST_CARD = "4242424242424242";
946
956
  var DemoPayForm = function (_a) {
947
957
  var onFail = _a.onFail, onSavePaymentMethod = _a.onSavePaymentMethod, plugin = _a.plugin;
@@ -1002,16 +1012,16 @@ var DemoPayForm = function (_a) {
1002
1012
  var onCardCvcChange = function (cvc) {
1003
1013
  setCardDetails(__assign(__assign({}, cardDetails), { cvc: cvc }));
1004
1014
  };
1005
- return (jsxs("div", __assign({ className: "flex flex-col gap-2" }, { children: [jsxs(StyledInputs, __assign({ className: "flex flex-col gap-2", darkMode: darkMode !== null && darkMode !== void 0 ? darkMode : false }, { children: [jsx(DemoPayCardNumber, { onChange: onCardNumberChange, value: cardDetails.number }), jsxs("div", __assign({ className: "flex gap-2" }, { children: [jsx(DemoPayExpiry, { onChange: onCardExpiryChange, value: cardDetails.expiry }), jsx(DemoPayCardCvc, { onChange: onCardCvcChange, value: cardDetails.cvc })] }))] })), jsx(Text$d, __assign({ className: "text-xs" }, { children: "DemoPay is for testing only." })), jsx(SavePaymentMethodFooter, { isSaving: isSaving, onSave: onSave })] })));
1015
+ return (jsxs("div", __assign({ className: "flex flex-col gap-2" }, { children: [jsxs(StyledInputs, __assign({ className: "flex flex-col gap-2", darkMode: darkMode !== null && darkMode !== void 0 ? darkMode : false }, { children: [jsx(DemoPayCardNumber, { onChange: onCardNumberChange, value: cardDetails.number }), jsxs("div", __assign({ className: "flex gap-2" }, { children: [jsx(DemoPayExpiry, { onChange: onCardExpiryChange, value: cardDetails.expiry }), jsx(DemoPayCardCvc, { onChange: onCardCvcChange, value: cardDetails.cvc })] }))] })), jsx(Text$o, __assign({ className: "text-xs" }, { children: "DemoPay is for testing only." })), jsx(SavePaymentMethodFooter, { isSaving: isSaving, onSave: onSave })] })));
1006
1016
  };
1007
- var StyledInputs = defaultStyled.div(templateObject_1$6 || (templateObject_1$6 = __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) {
1017
+ 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) {
1008
1018
  var darkMode = _a.darkMode;
1009
1019
  return darkMode ? "var(--row-background-dark)" : "white";
1010
1020
  }, function (_a) {
1011
1021
  var darkMode = _a.darkMode;
1012
1022
  return darkMode ? GRAY_500 : GRAY_200;
1013
1023
  });
1014
- var templateObject_1$6;
1024
+ var templateObject_1$a;
1015
1025
 
1016
1026
  var createPaymentMethod = function (_a) {
1017
1027
  var paymentMethodId = _a.paymentMethodId, plugin = _a.plugin, token = _a.token, apiHost = _a.apiHost, accountId = _a.accountId;
@@ -1110,7 +1120,7 @@ function useSave(_a) {
1110
1120
  var save = function (_a) {
1111
1121
  var plugin = _a.plugin;
1112
1122
  return __awaiter(_this, void 0, void 0, function () {
1113
- var submitError, response, clientSecret, intentResponse, paymentMethodId, paymentMethodResponse;
1123
+ var submitError, response, clientSecret, intentResponse, paymentMethodId, paymentMethodResponse, error_1;
1114
1124
  var _b, _c;
1115
1125
  return __generator(this, function (_d) {
1116
1126
  switch (_d.label) {
@@ -1171,9 +1181,8 @@ function useSave(_a) {
1171
1181
  });
1172
1182
  return [3 /*break*/, 7];
1173
1183
  case 5:
1174
- _d.sent();
1175
- // console.error(error);
1176
- console.log("fancy error right here");
1184
+ error_1 = _d.sent();
1185
+ console.error(error_1);
1177
1186
  return [3 /*break*/, 7];
1178
1187
  case 6:
1179
1188
  setIsSaving(false);
@@ -1245,7 +1254,7 @@ var CardIcon = function () {
1245
1254
  return (jsxs("svg", __assign({ 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" })] })));
1246
1255
  };
1247
1256
 
1248
- var Text$c = Typography.Text;
1257
+ var Text$n = Typography.Text;
1249
1258
  var PaymentMethodSelector = function (_a) {
1250
1259
  var paymentMethodAllowedPlugins = _a.paymentMethodAllowedPlugins, onSelect = _a.onSelect, value = _a.value;
1251
1260
  return (jsx("div", __assign({ className: "flex flex-col 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)); }) })));
@@ -1258,9 +1267,9 @@ var PaymentOption = function (_a) {
1258
1267
  var isCard = name === null || name === void 0 ? void 0 : name.toLowerCase().includes("card");
1259
1268
  return (jsxs(PaymentOptionContainer, __assign({ "$brandColor": brandColor, "$selected": selected, className: "flex justify-between items-center w-full cursor-pointer py-2 px-4 rounded border-solid ".concat(darkMode
1260
1269
  ? "var(--row-background-dark) border-gray-500"
1261
- : "bg-slate-50 border-slate-200", " border"), onClick: function () { return onClick(paymentPlugin); } }, { children: [jsxs("div", __assign({ className: "flex gap-2 items-center" }, { children: [jsx(Checkbox, { checked: selected, className: darkMode ? "border-gray-400" : "" }), jsx(Text$c, { children: name })] })), isAch ? (jsx(BankOutlined, { className: "text-slate-400" })) : isCard ? (jsx(CardIcon, {})) : (jsx(CardIcon, {}))] })));
1270
+ : "bg-slate-50 border-slate-200", " border"), onClick: function () { return onClick(paymentPlugin); } }, { children: [jsxs("div", __assign({ className: "flex gap-2 items-center" }, { children: [jsx(Checkbox, { checked: selected, className: darkMode ? "border-gray-400" : "" }), jsx(Text$n, { children: name })] })), isAch ? (jsx(BankOutlined, { className: "text-slate-400" })) : isCard ? (jsx(CardIcon, {})) : (jsx(CardIcon, {}))] })));
1262
1271
  };
1263
- var PaymentOptionContainer = defaultStyled.div(templateObject_1$5 || (templateObject_1$5 = __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) {
1272
+ 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) {
1264
1273
  var $brandColor = _a.$brandColor, $selected = _a.$selected;
1265
1274
  return $selected &&
1266
1275
  "\n border-color: ".concat($brandColor, ";\n ");
@@ -1268,7 +1277,7 @@ var PaymentOptionContainer = defaultStyled.div(templateObject_1$5 || (templateOb
1268
1277
  var $brandColor = _a.$brandColor;
1269
1278
  return $brandColor;
1270
1279
  });
1271
- var templateObject_1$5;
1280
+ var templateObject_1$9;
1272
1281
 
1273
1282
  function useRemovePaymentMethod(paymentPlugins, apiHost, entityId, token, accountId) {
1274
1283
  var _this = this;
@@ -1453,7 +1462,7 @@ function ActualInvoice() {
1453
1462
  return (jsx(Fragment, { children: jsxs("div", __assign({ className: "flex gap-6 ".concat(isMobile ? "flex-col w-full overflow-hidden" : "shadow-padding-xb", " ").concat(className) }, { children: [formattedInvoice.isLegacy ? (jsx("div", __assign({ className: "flex justify-center w-full" }, { children: jsx(InvoicePDF, { invoiceUuid: formattedInvoice.uuid, apiHost: apiHost, token: token }) }))) : (invoiceQuoteViewComponent || (jsx(InvoiceQuoteView, { html: formattedInvoice.html, formattedInvoice: formattedInvoice, backButtonName: backButtonName, onBackButtonClick: onBackButtonClick }))), isInvoicePayable && (jsx("div", __assign({ className: "w-full ".concat(hideDownloadButton || formattedInvoice.isLegacy ? "" : "pt-12") }, { children: jsx(PaymentForm, { entityId: entityId, onPaymentSuccess: onSuccess, onFail: onFail, invoice: formattedInvoice, graphQLClient: graphQLClient }) })))] })) }));
1454
1463
  }
1455
1464
 
1456
- var MUTATION$6 = function (id) { return "\n query formattedQuote ($id: ID) {\n formattedQuote (id: $id) {\n payableId\n acceptedAt\n acceptedByName\n amount\n amountDue\n amountsByPeriod {\n id\n name\n amount\n }\n object { documents { id filename size date url } }\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 }"; };
1465
+ var MUTATION$7 = function (id) { return "\n query formattedQuote ($id: ID) {\n formattedQuote (id: $id) {\n payableId\n acceptedAt\n acceptedByName\n amount\n amountDue\n amountsByPeriod {\n id\n name\n amount\n }\n object { documents { id filename size date url } }\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 }"; };
1457
1466
  var getFormattedQuote = function (_a) {
1458
1467
  var id = _a.id, token = _a.token, apiHost = _a.apiHost;
1459
1468
  return __awaiter(void 0, void 0, void 0, function () {
@@ -1461,7 +1470,7 @@ var getFormattedQuote = function (_a) {
1461
1470
  return __generator(this, function (_b) {
1462
1471
  switch (_b.label) {
1463
1472
  case 0: return [4 /*yield*/, gqlRequest({
1464
- query: MUTATION$6(),
1473
+ query: MUTATION$7(),
1465
1474
  token: token,
1466
1475
  apiHost: apiHost,
1467
1476
  vars: { id: id },
@@ -1539,10 +1548,16 @@ var useSendAcceptQuote = function (_a) {
1539
1548
  });
1540
1549
  client.on("sign", function (data) {
1541
1550
  queryClient.refetchQueries({
1542
- queryKey: QueryKeyFactory.default.createQuoteKey({ id: quoteId, token: token }),
1551
+ queryKey: QueryKeyFactory.default.createQuoteKey({
1552
+ id: quoteId,
1553
+ token: token,
1554
+ }),
1543
1555
  });
1544
1556
  queryClient.refetchQueries({
1545
- queryKey: QueryKeyFactory.default.createQuoteKey({ id: quoteId, token: token }),
1557
+ queryKey: QueryKeyFactory.default.createQuoteKey({
1558
+ id: quoteId,
1559
+ token: token,
1560
+ }),
1546
1561
  });
1547
1562
  });
1548
1563
  // Open the DropboxSign modal
@@ -1563,10 +1578,16 @@ var useSendAcceptQuote = function (_a) {
1563
1578
  else {
1564
1579
  setAcceptBoxVisible(false);
1565
1580
  queryClient.invalidateQueries({
1566
- queryKey: QueryKeyFactory.default.createQuoteKey({ id: quoteId, token: token }),
1581
+ queryKey: QueryKeyFactory.default.createQuoteKey({
1582
+ id: quoteId,
1583
+ token: token,
1584
+ }),
1567
1585
  });
1568
1586
  queryClient.invalidateQueries({
1569
- queryKey: QueryKeyFactory.default.createQuoteKey({ id: quoteId, token: token }),
1587
+ queryKey: QueryKeyFactory.default.createQuoteKey({
1588
+ id: quoteId,
1589
+ token: token,
1590
+ }),
1570
1591
  });
1571
1592
  }
1572
1593
  }, token);
@@ -1656,11 +1677,11 @@ var PandadocPollingModal = function (_a) {
1656
1677
  return (jsxs(Modal, __assign({ title: "Uploading quote to Pandadoc", open: isVisible, closable: false, footer: null }, { children: [jsxs("div", __assign({ className: "py-4 text-center" }, { children: ["This may take a few seconds", ".".repeat(numberOfPolls)] })), jsx("div", __assign({ className: "text-center" }, { children: infoMessage }))] })));
1657
1678
  };
1658
1679
 
1659
- var ModalOverrideBrandStylings = defaultStyled(Modal)(templateObject_1$4 || (templateObject_1$4 = __makeTemplateObject(["\n .ant-modal-content {\n border-radius: 0.75rem;\n overflow: hidden;\n padding: 0 !important;\n }\n .ant-modal-title {\n font-family: ", ";\n }\n .ant-modal-header {\n border-bottom: none;\n padding: 1.5rem 1.5rem 0;\n margin: 0 !important;\n }\n .ant-modal-body {\n padding: 1rem 1.5rem 1.5rem;\n }\n .ant-modal-footer {\n border-top: none;\n padding: 0 1.5rem 1.5rem;\n margin: 0 !important;\n }\n"], ["\n .ant-modal-content {\n border-radius: 0.75rem;\n overflow: hidden;\n padding: 0 !important;\n }\n .ant-modal-title {\n font-family: ", ";\n }\n .ant-modal-header {\n border-bottom: none;\n padding: 1.5rem 1.5rem 0;\n margin: 0 !important;\n }\n .ant-modal-body {\n padding: 1rem 1.5rem 1.5rem;\n }\n .ant-modal-footer {\n border-top: none;\n padding: 0 1.5rem 1.5rem;\n margin: 0 !important;\n }\n"])), MARK_PRO);
1680
+ var ModalOverrideBrandStylings = defaultStyled(Modal)(templateObject_1$8 || (templateObject_1$8 = __makeTemplateObject(["\n .ant-modal-content {\n border-radius: 0.75rem;\n overflow: hidden;\n padding: 0 !important;\n }\n .ant-modal-title {\n font-family: ", ";\n }\n .ant-modal-header {\n border-bottom: none;\n padding: 1.5rem 1.5rem 0;\n margin: 0 !important;\n }\n .ant-modal-body {\n padding: 1rem 1.5rem 1.5rem;\n }\n .ant-modal-footer {\n border-top: none;\n padding: 0 1.5rem 1.5rem;\n margin: 0 !important;\n }\n"], ["\n .ant-modal-content {\n border-radius: 0.75rem;\n overflow: hidden;\n padding: 0 !important;\n }\n .ant-modal-title {\n font-family: ", ";\n }\n .ant-modal-header {\n border-bottom: none;\n padding: 1.5rem 1.5rem 0;\n margin: 0 !important;\n }\n .ant-modal-body {\n padding: 1rem 1.5rem 1.5rem;\n }\n .ant-modal-footer {\n border-top: none;\n padding: 0 1.5rem 1.5rem;\n margin: 0 !important;\n }\n"])), MARK_PRO);
1660
1681
  var StyledModal$1 = function (props) {
1661
1682
  return jsx(ModalOverrideBrandStylings, __assign({ closable: false }, props));
1662
1683
  };
1663
- var templateObject_1$4;
1684
+ var templateObject_1$8;
1664
1685
 
1665
1686
  var useFocusFirstInput = function (_a) {
1666
1687
  var firstInputRef = _a.firstInputRef, isVisible = _a.isVisible;
@@ -1695,8 +1716,8 @@ var AcceptQuoteModal = function (_a) {
1695
1716
  }, open: acceptBoxVisible, title: "Accept quote", width: 400 }, { children: jsxs(Form, __assign({ className: "flex flex-col gap-2", form: form, layout: "vertical" }, { children: [jsx(Form.Item, __assign({ label: "Your name", name: "name", rules: createRules(true, "Your name") }, { children: jsx(Input, { autoFocus: true, ref: firstInputRef }) })), jsx(Form.Item, __assign({ label: "Your job title", name: "title", rules: createRules(true, "Your job title") }, { children: jsx(Input, {}) })), jsx(Form.Item, __assign({ label: "Purchase order number", name: "poNumber", rules: createRules(poNumberRequired, "Purchase order number") }, { children: jsx(Input, {}) })), taxNumberRequired && (jsx(Form.Item, __assign({ name: "taxNumber", label: taxNumberLabel, rules: createRules(taxNumberRequired, taxNumberLabel) }, { children: jsx(Input, {}) })))] })) })));
1696
1717
  };
1697
1718
 
1698
- var Text$b = Typography.Text;
1699
- defaultStyled.div(templateObject_1$3 || (templateObject_1$3 = __makeTemplateObject(["\n span {\n width: 100%;\n }\n"], ["\n span {\n width: 100%;\n }\n"])));
1719
+ var Text$m = Typography.Text;
1720
+ defaultStyled.div(templateObject_1$7 || (templateObject_1$7 = __makeTemplateObject(["\n span {\n width: 100%;\n }\n"], ["\n span {\n width: 100%;\n }\n"])));
1700
1721
  function Quote(_a) {
1701
1722
  var id = _a.id, invoiceQuoteViewComponent = _a.invoiceQuoteViewComponent, onInvoiceDownloadError = _a.onInvoiceDownloadError, onPaymentSuccess = _a.onPaymentSuccess, entityId = _a.entityId, _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;
1702
1723
  return (jsx(InvoiceQuoteContext.Provider, __assign({ value: {
@@ -1767,11 +1788,15 @@ function ActualQuote(_a) {
1767
1788
  var isAccepted = formattedQuote.state === "ACCEPTED";
1768
1789
  return (jsxs(Fragment, { children: [jsxs("div", __assign({ className: "flex flex-col gap-4 ".concat(isMobile ? "w-full overflow-hidden" : "shadow-padding-xb", " ").concat(className) }, { children: [jsxs("div", __assign({ className: "flex flex-row justify-end items-center gap-4", id: "acceptance", style: {
1769
1790
  color: entityBranding.secondaryColor,
1770
- } }, { children: [isAccepted && formattedQuote.acceptedAt ? (jsx(Text$b, { 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: [!isMobile && !hideDownloadButton ? (jsx(Button, __assign({ icon: jsx(DownloadOutlined, {}), onClick: function () { return downloadFile(apiHost + "/api/pdf/quote", token); } }, { children: "Download" }))) : null, !isAccepted ? (jsx(Button, __assign({ disabled: isExpired || isAccepting, onClick: function () { return startAcceptance(); }, type: "primary" }, { children: isExpired ? "Quote is expired" : "Accept quote" }))) : null] })))] })), jsx(InvoiceQuoteView, __assign({ html: formattedQuote.html }, { children: ((_c = (_b = formattedQuote.object) === null || _b === void 0 ? void 0 : _b.documents) === null || _c === void 0 ? void 0 : _c.length) > 0 ? (jsx("div", __assign({ className: "flex flex-col items-end" }, { children: formattedQuote.object.documents.map(function (doc, index) {
1791
+ } }, { children: [isAccepted && formattedQuote.acceptedAt ? (jsx(Text$m, { children: "Quote was accepted by ".concat(formattedQuote.acceptedByName, " on ").concat(formatDate(formattedQuote.acceptedAt)) })) : null, (!isMobile || !isAccepted) && (jsxs("div", __assign({ className: isMobile
1792
+ ? "flex w-full justify-end gap-2"
1793
+ : "flex items-center justify-end gap-2" }, { children: [!isMobile && !hideDownloadButton ? (jsx(Button, __assign({ icon: jsx(DownloadOutlined, {}), onClick: function () {
1794
+ return downloadFile(apiHost + "/api/pdf/quote", token);
1795
+ } }, { children: "Download" }))) : null, !isAccepted ? (jsx(Button, __assign({ disabled: isExpired || isAccepting, onClick: function () { return startAcceptance(); }, type: "primary" }, { children: isExpired ? "Quote is expired" : "Accept quote" }))) : null] })))] })), jsx(InvoiceQuoteView, __assign({ html: formattedQuote.html }, { children: ((_c = (_b = formattedQuote.object) === null || _b === void 0 ? void 0 : _b.documents) === null || _c === void 0 ? void 0 : _c.length) > 0 ? (jsx("div", __assign({ className: "flex flex-col items-end" }, { children: formattedQuote.object.documents.map(function (doc, index) {
1771
1796
  return (jsx(Button, __assign({ download: doc.filename, href: doc.url, type: "link" }, { children: doc.filename }), index));
1772
1797
  }) }))) : null }))] })), jsx(AcceptQuoteModal, { acceptBoxVisible: acceptBoxVisible, formattedQuote: formattedQuote, setAcceptBoxVisible: setAcceptBoxVisible, setIsAccepting: setIsAccepting, sendAccept: sendAccept }), jsx(PandadocPollingModal, { isVisible: pandadocPollingModalVisible, setVisible: setPandadocPollingModalVisible, id: id })] }));
1773
1798
  }
1774
- var templateObject_1$3;
1799
+ var templateObject_1$7;
1775
1800
 
1776
1801
  var QUOTES_QUERY = function (filter) { return "\n query quotes {\n quotes ".concat(filter ? "(".concat(filter, ")") : "", " {\n pageInfo {\n startCursor\n endCursor\n hasNextPage\n hasPreviousPage\n }\n nodes {\n id\n name\n account {\n name\n id\n }\n applicationDate\n state\n createdAt\n expiresAt\n currencyId\n amount\n number\n }\n }\n }"); };
1777
1802
  var getQuotes = function (_a) {
@@ -19069,13 +19094,12 @@ var getColor = function (state) {
19069
19094
  }
19070
19095
  };
19071
19096
 
19072
- var Text$a = Typography.Text;
19097
+ var Text$l = Typography.Text;
19073
19098
  var TransactionDate = function (_a) {
19074
19099
  var date = _a.date;
19075
- return jsx(Text$a, __assign({ className: "text-sm" }, { children: formatDate(date) }));
19100
+ return jsx(Text$l, __assign({ className: "text-sm" }, { children: formatDate(date) }));
19076
19101
  };
19077
19102
 
19078
- // TODO: delete
19079
19103
  var ArrowDownToLine = function (_a) {
19080
19104
  var className = _a.className, _b = _a.color, color = _b === void 0 ? SLATE_600 : _b;
19081
19105
  return (jsxs("svg", __assign({ className: className, fill: "none", height: "16", viewBox: "0 0 16 16", width: "16", xmlns: "http://www.w3.org/2000/svg" }, { children: [jsx("path", { d: "M8 11.3333V2", stroke: color, strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), jsx("path", { d: "M4 7.33301L8 11.333L12 7.33301", stroke: color, strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), jsx("path", { d: "M12.6654 14H3.33203", stroke: color, strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })] })));
@@ -19103,17 +19127,17 @@ var TransactionGridCell = defaultStyled.div.withConfig({
19103
19127
  shouldForwardProp: function (prop) {
19104
19128
  return !["gridColumn", "padding", "right"].includes(prop);
19105
19129
  },
19106
- })(templateObject_1$2 || (templateObject_1$2 = __makeTemplateObject(["\n ", "\n\n display: flex;\n align-items: center;\n justify-content: ", ";\n\n text-align: ", ";\n white-space: nowrap;\n font-size: 14px;\n color: ", ";\n\n background-color: inherit;\n\n padding: 1rem;\n min-width: 48px;\n"], ["\n ", "\n\n display: flex;\n align-items: center;\n justify-content: ", ";\n\n text-align: ", ";\n white-space: nowrap;\n font-size: 14px;\n color: ", ";\n\n background-color: inherit;\n\n padding: 1rem;\n min-width: 48px;\n"])), function (props) { return props.gridColumn && "grid-column: ".concat(props.gridColumn, ";"); }, function (props) {
19130
+ })(templateObject_1$6 || (templateObject_1$6 = __makeTemplateObject(["\n ", "\n\n display: flex;\n align-items: center;\n justify-content: ", ";\n\n text-align: ", ";\n white-space: nowrap;\n font-size: 14px;\n color: ", ";\n\n background-color: inherit;\n\n padding: 1rem;\n min-width: 48px;\n"], ["\n ", "\n\n display: flex;\n align-items: center;\n justify-content: ", ";\n\n text-align: ", ";\n white-space: nowrap;\n font-size: 14px;\n color: ", ";\n\n background-color: inherit;\n\n padding: 1rem;\n min-width: 48px;\n"])), function (props) { return props.gridColumn && "grid-column: ".concat(props.gridColumn, ";"); }, function (props) {
19107
19131
  return props.right ? "flex-end" : "flex-start";
19108
19132
  }, function (props) {
19109
19133
  return props.right ? "right" : "left";
19110
19134
  }, SLATE_600);
19111
- var templateObject_1$2;
19135
+ var templateObject_1$6;
19112
19136
 
19113
- var Text$9 = Typography.Text;
19137
+ var Text$k = Typography.Text;
19114
19138
  var TransactionsEmptyState = function () {
19115
19139
  var noTransactionsMessage = useContext(TransactionsListContext).noTransactionsMessage;
19116
- return (jsx(Text$9, __assign({ className: "flex justify-center p-4 text-base" }, { children: noTransactionsMessage || "There are no transactions" })));
19140
+ return (jsx(Text$k, __assign({ className: "flex justify-center p-4 text-base" }, { children: noTransactionsMessage || "There are no transactions" })));
19117
19141
  };
19118
19142
 
19119
19143
  var isInvoice = function (transaction) {
@@ -19146,7 +19170,7 @@ function transactionDateToDisplay(transaction, transactionDateType) {
19146
19170
  }
19147
19171
  }
19148
19172
 
19149
- var Text$8 = Typography.Text;
19173
+ var Text$j = Typography.Text;
19150
19174
  var TransactionsListDesktop = function (_a) {
19151
19175
  var transactions = _a.transactions, onTransactionClick = _a.onTransactionClick;
19152
19176
  var _b = useContext(TransactionsListContext), columns = _b.columns, transactionDateType = _b.transactionDateType;
@@ -19175,11 +19199,11 @@ var TransactionsListDesktop = function (_a) {
19175
19199
  !showState &&
19176
19200
  !showAmount &&
19177
19201
  !showDownload &&
19178
- !showAccountName && (jsx(TransactionGridCell, { children: jsx(Text$8, { 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: "flex items-center gap-2" }, { children: [jsx(Text$8, { children: lodashExports.capitalize(transaction.kind.toLowerCase()) }), jsx(TransactionRowTitle, { transaction: transaction })] })) })), showAccountName && (jsx(TransactionGridCell, __assign({ right: false }, { children: jsx(Text$8, { 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$8, { 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));
19202
+ !showAccountName && (jsx(TransactionGridCell, { children: jsx(Text$j, { 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: "flex items-center gap-2" }, { children: [jsx(Text$j, { children: lodashExports.capitalize(transaction.kind.toLowerCase()) }), jsx(TransactionRowTitle, { transaction: transaction })] })) })), showAccountName && (jsx(TransactionGridCell, __assign({ right: false }, { children: jsx(Text$j, { 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$j, { 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));
19179
19203
  }) }));
19180
19204
  };
19181
19205
 
19182
- var Text$7 = Typography.Text;
19206
+ var Text$i = Typography.Text;
19183
19207
  var TransactionsListMobile = function (_a) {
19184
19208
  var transactions = _a.transactions, onTransactionClick = _a.onTransactionClick;
19185
19209
  var _b = useContext(TransactionsListContext), columns = _b.columns, transactionDateType = _b.transactionDateType;
@@ -19202,12 +19226,12 @@ var TransactionsListMobile = function (_a) {
19202
19226
  backgroundColor: index % 2 === 0
19203
19227
  ? "var(--row-background".concat(darkMode ? "-dark" : "", ")")
19204
19228
  : "var(--row-background-alternate".concat(darkMode ? "-dark" : "", ")"),
19205
- } }, { children: [jsx(TransactionGridCell, { children: jsxs("div", __assign({ className: "flex flex-col gap-2" }, { children: [(showTitle || showState) && (jsxs("div", __assign({ className: "flex items-center gap-2" }, { children: [showTitle && (jsxs(Fragment, { children: [jsx(Text$7, { children: lodashExports.capitalize(transaction.kind.toLowerCase()) }), jsx(TransactionRowTitle, { transaction: transaction })] })), showState && jsx(StateTag, { state: transaction.state })] }))), jsxs("div", __assign({ className: "flex items-center gap-2" }, { children: [showAccountName && jsx(Text$7, { children: (_a = transaction.account) === null || _a === void 0 ? void 0 : _a.name }), showAccountName && showDate && jsx(Text$7, { children: "\u00B7" }), showDate && (jsx(TransactionDate, { date: transactionDateToDisplay(transaction, transactionDateType) })), showDate && showAmount && jsx(Text$7, { children: "\u00B7" }), showAmount && (jsx(Text$7, { children: formatCurrency(transaction.transactionable.amount ||
19229
+ } }, { children: [jsx(TransactionGridCell, { children: jsxs("div", __assign({ className: "flex flex-col gap-2" }, { children: [(showTitle || showState) && (jsxs("div", __assign({ className: "flex items-center gap-2" }, { children: [showTitle && (jsxs(Fragment, { children: [jsx(Text$i, { children: lodashExports.capitalize(transaction.kind.toLowerCase()) }), jsx(TransactionRowTitle, { transaction: transaction })] })), showState && jsx(StateTag, { state: transaction.state })] }))), jsxs("div", __assign({ className: "flex items-center gap-2" }, { children: [showAccountName && jsx(Text$i, { children: (_a = transaction.account) === null || _a === void 0 ? void 0 : _a.name }), showAccountName && showDate && jsx(Text$i, { children: "\u00B7" }), showDate && (jsx(TransactionDate, { date: transactionDateToDisplay(transaction, transactionDateType) })), showDate && showAmount && jsx(Text$i, { children: "\u00B7" }), showAmount && (jsx(Text$i, { children: formatCurrency(transaction.transactionable.amount ||
19206
19230
  transaction.amount, transaction.currencyId) }))] }))] })) }), showDownload && (jsx(TransactionGridCell, __assign({ right: true }, { children: jsx(TransactionDownload, { transaction: transaction, token: token, apiHost: apiHost }) })))] }), index));
19207
19231
  }) }));
19208
19232
  };
19209
19233
 
19210
- var Text$6 = Typography.Text;
19234
+ var Text$h = Typography.Text;
19211
19235
  var DISPLAY_WIDTH = 1200;
19212
19236
  function Transactions(_a) {
19213
19237
  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 ? [
@@ -19321,7 +19345,7 @@ function TransactionsDisplay(_a) {
19321
19345
  onTransactionDisplayClose === null || onTransactionDisplayClose === void 0 ? void 0 : onTransactionDisplayClose(selectedTransaction);
19322
19346
  setDrawerOpen(false);
19323
19347
  }
19324
- return (jsxs("div", __assign({ style: style }, { children: [jsxs("div", __assign({ className: "flex flex-col w-full shadow-padding-xb gap-2 ".concat(isMobile ? "overflow-hidden" : "", " ").concat(className) }, { children: [showTitle || showSearchBar ? (jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col gap-1" : "flex-row items-center", " justify-between") }, { children: [showTitle ? (jsx(Text$6, __assign({ className: "shrink-0 font-medium", style: { color: darkMode ? undefined : secondaryColor } }, { children: title }))) : (jsx("div", {}) // Empty div so justify-between works
19348
+ return (jsxs("div", __assign({ style: style }, { children: [jsxs("div", __assign({ className: "flex flex-col w-full shadow-padding-xb gap-2 ".concat(isMobile ? "overflow-hidden" : "", " ").concat(className) }, { children: [showTitle || showSearchBar ? (jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col gap-1" : "flex-row items-center", " justify-between") }, { children: [showTitle ? (jsx(Text$h, __assign({ className: "shrink-0 font-medium", style: { color: darkMode ? undefined : secondaryColor } }, { children: title }))) : (jsx("div", {}) // Empty div so justify-between works
19325
19349
  ), showSearchBar && (jsx("div", __assign({ className: "".concat(isMobile ? "w-full" : "") }, { children: jsx(Input, { className: searchBarClassName
19326
19350
  ? searchBarClassName
19327
19351
  : "border border-slate-200", onChange: function (e) {
@@ -19467,10 +19491,10 @@ var getBillingDetails = function (_a) {
19467
19491
  });
19468
19492
  };
19469
19493
 
19470
- var Text$5 = Typography.Text;
19494
+ var Text$g = Typography.Text;
19471
19495
  var DrawerHeader = function (_a) {
19472
19496
  var description = _a.description, onClose = _a.onClose, title = _a.title, closeButtonClassName = _a.closeButtonClassName;
19473
- return (jsxs("div", __assign({ className: "flex flex-col gap-4" }, { children: [jsxs("div", __assign({ className: "flex items-center justify-between gap-2" }, { children: [jsx(Text$5, __assign({ className: "text-xl", style: { fontWeight: 400 } }, { children: title })), onClose ? (jsx("button", __assign({ id: "closePayment", onClick: onClose, className: closeButtonClassName }, { children: jsx(CloseOutlined, {}) }))) : null] })), description && jsx("div", __assign({ className: "text-xs" }, { children: description }))] })));
19497
+ return (jsxs("div", __assign({ className: "flex flex-col gap-4" }, { children: [jsxs("div", __assign({ className: "flex items-center justify-between gap-2" }, { children: [jsx(Text$g, __assign({ className: "text-xl", style: { fontWeight: 400 } }, { children: title })), onClose ? (jsx("button", __assign({ id: "closePayment", onClick: onClose, className: closeButtonClassName }, { children: jsx(CloseOutlined, {}) }))) : null] })), description && jsx("div", __assign({ className: "text-xs" }, { children: description }))] })));
19474
19498
  };
19475
19499
 
19476
19500
  var PaymentMethod = function (_a) {
@@ -19536,515 +19560,1100 @@ var PaymentMethodDisplay = function (_a) {
19536
19560
  }, title: jsx(DrawerHeader, { onClose: function () { return setShowModal(false); }, title: "New payment method", closeButtonClassName: "ant-drawer-close" }) }, { children: children })));
19537
19561
  };
19538
19562
 
19539
- var pageWrapperClassName = function (isMobile) {
19540
- return "flex flex-col grow pt-4 ".concat(isMobile ? "pb-4 overflow-hidden" : "pb-8", " ").concat("content-container");
19541
- };
19542
-
19543
- var QUOTE_FIELDS = "quote {\n formattedQuote {\n html\n }\n acceptedByName\n acceptedByTitle\n accountId\n amount\n amountDue\n applicationDate\n applied\n billingDay\n contactId\n createdAt\n credits\n currencyId\n dealId\n discount\n discountValue\n endDate\n evergreen\n expiresAt\n id\n invoiceUntil\n isPendingApprovalRequest\n kind\n message\n name\n netPaymentDays\n notes\n ownerId\n periodAmount\n poNumber\n requiresApproval\n startDate\n state\n subtotal\n taxAmount\n updatedAt\n uuid\n amountsByPeriod {\n amount\n id\n name\n }\n endDateOptions {\n endDate\n label\n }\n invoiceUntilOptions {\n endDate\n label\n }\n quoteChanges {\n id\n priceListId\n charges {\n amount\n amountsByPeriod { amount startDate }\n billingPeriod\n billingPeriodAmounts { id amount prorationRate }\n chargeType\n couponId\n createdAt\n currencyId\n discount\n endDate\n feature { id name code isUnit unitName }\n id\n invoiceLineText\n name\n price\n priceDecimals\n priceTiers { starts price }\n pricingModel\n prorationRate\n quantity\n quantityMax\n quantityMin\n startDate\n tieredAveragePrice\n updatedAt\n }\n }\n}";
19544
-
19545
- var QUOTE_RECALCULATE_TAXES = "\n mutation QuoteRecalculateTaxes($id: ID!) {\n quoteRecalculateTaxes(id: $id) {\n ".concat(QUOTE_FIELDS, "\n errors\n }\n }\n");
19546
- var quoteRecalculateTaxes = function (_a) {
19547
- var quoteId = _a.quoteId, token = _a.token, apiHost = _a.apiHost;
19563
+ var MUTATION$6 = function () { return "\nmutation AccountSignup (\n $entityId: ID!,\n $pluginId: String!,\n $paymentMethodId: String,\n $priceListCode: String!,\n $accountId: ID!,\n $quoteId: ID!\n) {\n accountSignup(\n entityId: $entityId,\n pluginId: $pluginId,\n paymentMethodId: $paymentMethodId,\n priceListCode: $priceListCode,\n accountId: $accountId,\n quoteId: $quoteId\n ) {\n errors\n quote {\n acceptedByName\n acceptedByTitle\n accountId\n amount\n amountDue\n applicationDate\n applied\n backdatedPeriods\n backdatedQuote\n billingDay\n contactId\n createdAt\n credits\n currencyId\n dealId\n discount\n discountValue\n endDate\n evergreen\n expiresAt\n id\n invoiceImmediately\n invoiceImmediatelyAvailable\n invoiceUntil\n isPendingApprovalRequest\n kind\n message\n name\n netPaymentDays\n notes\n number\n ownerId\n payableId\n periodAmount\n poNumber\n requiresApproval\n smallUnitAmountDue\n splitInvoice\n startDate\n state\n subtotal\n taxAmount\n taxCode\n updatedAt\n uuid\n }\n }\n}"; };
19564
+ var accountSignup = function (_a) {
19565
+ var token = _a.token, apiHost = _a.apiHost, entityId = _a.entityId, accountId = _a.accountId, quoteId = _a.quoteId, paymentToken = _a.paymentToken, paymentMethodId = _a.paymentMethodId, pluginId = _a.pluginId, priceListCode = _a.priceListCode;
19548
19566
  return __awaiter(void 0, void 0, void 0, function () {
19549
19567
  var vars, response, errors;
19550
- var _b, _c;
19551
- return __generator(this, function (_d) {
19552
- switch (_d.label) {
19568
+ var _b;
19569
+ return __generator(this, function (_c) {
19570
+ switch (_c.label) {
19553
19571
  case 0:
19554
- vars = { id: quoteId };
19572
+ vars = {
19573
+ entityId: entityId,
19574
+ accountId: accountId,
19575
+ quoteId: quoteId,
19576
+ paymentToken: paymentToken,
19577
+ pluginId: pluginId,
19578
+ paymentMethodId: paymentMethodId,
19579
+ priceListCode: priceListCode,
19580
+ };
19555
19581
  return [4 /*yield*/, gqlRequest({
19556
- query: QUOTE_RECALCULATE_TAXES,
19582
+ query: MUTATION$6(),
19557
19583
  token: token,
19558
19584
  vars: vars,
19559
19585
  apiHost: apiHost,
19560
19586
  })];
19561
19587
  case 1:
19562
- response = _d.sent();
19563
- errors = (_b = response === null || response === void 0 ? void 0 : response.quoteRecalculateTaxes) === null || _b === void 0 ? void 0 : _b.errors;
19588
+ response = _c.sent();
19589
+ errors = (_b = response === null || response === void 0 ? void 0 : response.accountSignup) === null || _b === void 0 ? void 0 : _b.errors;
19564
19590
  if (errors)
19565
19591
  throw errors;
19566
- return [2 /*return*/, (_c = response.quoteRecalculateTaxes) === null || _c === void 0 ? void 0 : _c.quote];
19567
- }
19568
- });
19569
- });
19570
- };
19571
-
19572
- var MUTATION$5 = "{\n currentUser {\n taxationRequiredAccountFields\n }\n}";
19573
- var getTaxationRequiredAccountFields = function (_a) {
19574
- var token = _a.token, apiHost = _a.apiHost;
19575
- return __awaiter(void 0, void 0, void 0, function () {
19576
- var response;
19577
- var _b, _c;
19578
- return __generator(this, function (_d) {
19579
- switch (_d.label) {
19580
- case 0: return [4 /*yield*/, gqlRequest({
19581
- query: MUTATION$5,
19582
- token: token,
19583
- apiHost: apiHost,
19584
- })];
19585
- case 1:
19586
- response = _d.sent();
19587
- 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
19588
- ? response.currentUser
19589
- .taxationRequiredAccountFields
19590
- : null];
19592
+ return [2 /*return*/, response === null || response === void 0 ? void 0 : response.accountSignup];
19591
19593
  }
19592
19594
  });
19593
19595
  });
19594
19596
  };
19595
19597
 
19596
- var useHasTaxPlugin = function (_a) {
19597
- var entityId = _a.entityId, apiHost = _a.apiHost, token = _a.token;
19598
- var plugins = usePlugins({
19599
- entityId: entityId,
19600
- apiHost: apiHost,
19601
- token: token,
19602
- }).data;
19603
- return Boolean(plugins === null || plugins === void 0 ? void 0 : plugins.some(function (plugin) { return plugin.type === "taxation"; }));
19604
- };
19605
-
19606
- var MUTATION$4 = "\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";
19607
- var accountUpdate = function (_a) {
19608
- var accountId = _a.accountId, attributes = _a.attributes, token = _a.token, apiHost = _a.apiHost;
19598
+ var MUTATION$5 = function () { return "\nmutation QuoteAccountSignup (\n $accountName: String!,\n $billingContact: ContactAttributes!,\n $entityId: ID!,\n $priceListCode: String!\n) {\n quoteAccountSignup(\n entityId: $entityId,\n priceListCode: $priceListCode,\n accountName: $accountName,\n billingContact: $billingContact\n ) {\n account {\n id\n }\n quote {\n acceptedByName\n acceptedByTitle\n accountId\n amount\n amountDue\n applicationDate\n applied\n backdatedPeriods\n backdatedQuote\n billingDay\n contactId\n createdAt\n credits\n currencyId\n dealId\n discount\n discountValue\n endDate\n evergreen\n expiresAt\n id\n invoiceImmediately\n invoiceImmediatelyAvailable\n invoiceUntil\n isPendingApprovalRequest\n kind\n message\n name\n netPaymentDays\n notes\n number\n ownerId\n payableId\n periodAmount\n poNumber\n requiresApproval\n smallUnitAmountDue\n splitInvoice\n startDate\n state\n subtotal\n taxAmount\n taxCode\n updatedAt\n uuid\n }\n tenant {\n code\n }\n portalSessionToken\n errors\n }\n}"; };
19599
+ var quoteAccountSignup = function (_a) {
19600
+ var token = _a.token, apiHost = _a.apiHost, entityId = _a.entityId, priceListCode = _a.priceListCode, accountName = _a.accountName, billingContact = _a.billingContact;
19609
19601
  return __awaiter(void 0, void 0, void 0, function () {
19610
19602
  var vars, response, errors;
19611
19603
  var _b;
19612
19604
  return __generator(this, function (_c) {
19613
19605
  switch (_c.label) {
19614
19606
  case 0:
19615
- vars = { id: accountId, attributes: attributes };
19607
+ vars = {
19608
+ entityId: entityId,
19609
+ priceListCode: priceListCode,
19610
+ accountName: accountName,
19611
+ billingContact: billingContact,
19612
+ };
19616
19613
  return [4 /*yield*/, gqlRequest({
19617
- query: MUTATION$4,
19614
+ query: MUTATION$5(),
19618
19615
  token: token,
19619
19616
  vars: vars,
19620
19617
  apiHost: apiHost,
19621
19618
  })];
19622
19619
  case 1:
19623
19620
  response = _c.sent();
19624
- errors = (_b = response === null || response === void 0 ? void 0 : response.accountUpdate) === null || _b === void 0 ? void 0 : _b.errors;
19621
+ errors = (_b = response === null || response === void 0 ? void 0 : response.quoteAccountSignup) === null || _b === void 0 ? void 0 : _b.errors;
19625
19622
  if (errors)
19626
19623
  throw errors;
19627
- return [2 /*return*/, response.accountUpdate];
19624
+ return [2 /*return*/, response === null || response === void 0 ? void 0 : response.quoteAccountSignup];
19628
19625
  }
19629
19626
  });
19630
19627
  });
19631
19628
  };
19632
19629
 
19633
- var COUNTRIES_REQUIRING_STATE = ["US", "CA"];
19634
- var TaxationForm = function (_a) {
19635
- var account = _a.account, quote = _a.quote;
19636
- // Hooks
19637
- var queryClient = useQueryClient();
19630
+ var MUTATION$4 = function () { return "\nquery PriceList($code: String!) {\n priceList (code: $code) {\n basePrice\n code\n createdAt\n currencyId\n id\n isVisible\n name\n periodMonths\n planId\n priceDescription\n productId\n sku\n trialAllowed\n trialLengthDays\n updatedAt\n }\n}"; };
19631
+ var getPriceList = function (_a) {
19632
+ var token = _a.token, code = _a.code, apiHost = _a.apiHost;
19633
+ return __awaiter(void 0, void 0, void 0, function () {
19634
+ var response;
19635
+ return __generator(this, function (_b) {
19636
+ switch (_b.label) {
19637
+ case 0: return [4 /*yield*/, gqlRequest({
19638
+ query: MUTATION$4(),
19639
+ token: token,
19640
+ vars: { code: code },
19641
+ apiHost: apiHost,
19642
+ })];
19643
+ case 1:
19644
+ response = _b.sent();
19645
+ return [2 /*return*/, response === null || response === void 0 ? void 0 : response.priceList];
19646
+ }
19647
+ });
19648
+ });
19649
+ };
19650
+
19651
+ function PaymentForms(_a) {
19652
+ var quote = _a.quote, handlePaymentSuccess = _a.handlePaymentSuccess, handlePaymentFail = _a.handlePaymentFail, handleSubmit = _a.handleSubmit, proceedingToPayment = _a.proceedingToPayment, entityId = _a.entityId, accountId = _a.accountId, overrideToken = _a.overrideToken, customCheckoutFunction = _a.customCheckoutFunction;
19638
19653
  var apiHost = useContext(BunnyContext).apiHost;
19639
- var token = useToken();
19654
+ return (jsx(Fragment, { children: quote ? (jsx(Fragment, { children: overrideToken ? (jsx(PaymentForm, { entityId: entityId, onFail: handlePaymentFail, onPaymentSuccess: handlePaymentSuccess, accountId: accountId, quote: quote, overrideToken: overrideToken, graphQLClient: createGraphQLClient(apiHost, overrideToken), customCheckoutFunction: customCheckoutFunction })) : null })) : (jsx(InitialSignupForm, { onSubmit: handleSubmit, submitting: proceedingToPayment })) }));
19655
+ }
19656
+ function InitialSignupForm(_a) {
19657
+ var onSubmit = _a.onSubmit, submitting = _a.submitting;
19640
19658
  var form = Form.useForm()[0];
19641
- // Mutations
19642
- var _b = useMutation({
19643
- mutationFn: function (changedFormData) { return __awaiter(void 0, void 0, void 0, function () {
19644
- var account;
19659
+ function handleSubmit() {
19660
+ form.validateFields({ validateOnly: false }).then(function () {
19661
+ onSubmit(form.getFieldsValue());
19662
+ });
19663
+ }
19664
+ return (jsxs(Form, __assign({ className: "flex flex-col justify-between h-full w-full", form: form, layout: "vertical", autoComplete: "off" }, { children: [jsxs("div", __assign({ className: "flex flex-col space-y-2" }, { children: [jsx(Form.Item, __assign({ name: "firstName", rules: [{ required: true, message: "Please input your first name!" }] }, { children: jsx(Input, { placeholder: "First name" }) })), jsx(Form.Item, __assign({ name: "lastName", rules: [{ required: true, message: "Please input your last name!" }] }, { children: jsx(Input, { placeholder: "Last name" }) })), jsx(Form.Item, __assign({ name: "email", rules: [
19665
+ { required: true, message: "Please input your email!" },
19666
+ { type: "email", message: "Please enter a valid email!" },
19667
+ ] }, { children: jsx(Input, { placeholder: "Email" }) })), jsx(Form.Item, __assign({ name: "accountName", rules: [
19668
+ { required: true, message: "Please input your company name!" },
19669
+ ] }, { children: jsx(Input, { placeholder: "Company name" }) }))] })), jsx(Form.Item, { children: jsx(Button, __assign({ type: "primary", onClick: handleSubmit, loading: submitting, className: "w-full mt-4" }, { children: "Proceed to payment" })) })] })));
19670
+ }
19671
+
19672
+ var Title = Typography.Title, Text$f = Typography.Text;
19673
+ function PaymentSuccessDisplay(_a) {
19674
+ var amountPaid = _a.amountPaid, className = _a.className, companyName = _a.companyName, returnUrl = _a.returnUrl, style = _a.style, currencyId = _a.currencyId;
19675
+ return (jsxs("div", __assign({ className: "flex flex-col items-center justify-center h-full ".concat(className), style: style }, { children: [jsx(CheckCircleFilled, { style: { fontSize: "48px", color: "rgb(52 211 153)" } }), jsxs(Title, __assign({ level: 3, className: "mt-2 m-0" }, { children: ["Payment of ", formatCurrency(amountPaid, currencyId), " successful"] })), returnUrl && (jsxs(Text$f, __assign({ className: "text-slate-500 cursor-pointer underline", onClick: function () { return (window.location.href = returnUrl); } }, { children: ["Back to ", companyName] })))] })));
19676
+ }
19677
+
19678
+ var Text$e = Typography.Text;
19679
+ function PriceListDisplay(_a) {
19680
+ var priceListData = _a.priceListData, topNavImageUrl = _a.topNavImageUrl;
19681
+ if (!priceListData)
19682
+ return null;
19683
+ return (jsx(Fragment, { children: jsx("div", __assign({ className: "flex flex-col justify-between h-full my-12" }, { children: jsxs("div", __assign({ className: "flex flex-col space-y-8" }, { children: [jsx(Image, { width: 24, src: topNavImageUrl, alt: "Logo", preview: false }), jsxs("div", __assign({ className: "flex flex-col" }, { children: [jsx(Text$e, __assign({ className: "text-slate-500 font-bold text-lg" }, { children: priceListData.name })), jsxs(Text$e, __assign({ className: "font-bold text-xl" }, { children: [formatCurrency(priceListData.basePrice, priceListData.currencyId), " ", "/ month"] }))] })), priceListData.trialAllowed ? (jsxs("div", __assign({ className: "flex flex-col" }, { children: [jsxs(Text$e, __assign({ style: { fontSize: "16px" }, className: "text-slate-500" }, { children: [priceListData.trialLengthDays, " day trial"] })), jsx(Text$e, __assign({ className: "text-slate-500", style: { fontSize: "12px" } }, { children: "You will not be charged until the last day of the trial." }))] }))) : null] })) })) }));
19684
+ }
19685
+
19686
+ var showErrorNotification = useErrorNotification();
19687
+ function Signup(_a) {
19688
+ var companyName = _a.companyName, entityId = _a.entityId, priceListCode = _a.priceListCode, returnUrl = _a.returnUrl, _b = _a.isCardEnabled, isCardEnabled = _b === void 0 ? true : _b, className = _a.className, _c = _a.shadow, shadow = _c === void 0 ? "shadow-md" : _c, style = _a.style;
19689
+ // Hooks
19690
+ var _d = useContext(BunnyContext), apiHost = _d.apiHost, graphQLClient = _d.graphQLClient;
19691
+ var tokenFromContexts = useToken();
19692
+ var isMobile = useIsMobile();
19693
+ var topNavImageUrl = useContext(BrandContext).topNavImageUrl;
19694
+ var _e = useState(undefined), quote = _e[0], setQuote = _e[1];
19695
+ var _f = useState(undefined), accountId = _f[0], setAccountId = _f[1];
19696
+ var _g = useState(undefined), portalSessionToken = _g[0], setPortalSessionToken = _g[1];
19697
+ var token = portalSessionToken || tokenFromContexts;
19698
+ var _h = useState(false), proceedingToPayment = _h[0], setProceedingToPayment = _h[1];
19699
+ var _j = useState(false), purchaseSucceeded = _j[0], setPurchaseSucceeded = _j[1];
19700
+ var _k = useState(undefined), paymentMethodGraphQLClient = _k[0], setPaymentMethodGraphQLClient = _k[1];
19701
+ var paymentMethod = usePaymentMethod({
19702
+ accountId: accountId,
19703
+ entityId: entityId,
19704
+ graphQLClient: paymentMethodGraphQLClient || graphQLClient,
19705
+ token: token,
19706
+ }).data;
19707
+ var queryClient = useQueryClient();
19708
+ // Queries
19709
+ var priceListData = useQuery({
19710
+ queryKey: ["priceList", priceListCode],
19711
+ queryFn: function () { return getPriceList({ token: token, apiHost: apiHost, code: priceListCode }); },
19712
+ }).data;
19713
+ function handleSubmit(formData) {
19714
+ return __awaiter(this, void 0, void 0, function () {
19715
+ var data, error_1;
19645
19716
  return __generator(this, function (_a) {
19646
19717
  switch (_a.label) {
19647
- case 0: return [4 /*yield*/, accountUpdate({
19648
- accountId: quote.accountId,
19649
- attributes: changedFormData,
19650
- token: token,
19651
- apiHost: apiHost,
19652
- })];
19718
+ case 0:
19719
+ _a.trys.push([0, 2, , 3]);
19720
+ setProceedingToPayment(true);
19721
+ return [4 /*yield*/, quoteAccountSignup({
19722
+ token: token,
19723
+ apiHost: apiHost,
19724
+ entityId: entityId,
19725
+ priceListCode: priceListCode,
19726
+ accountName: formData.accountName,
19727
+ billingContact: {
19728
+ firstName: formData.firstName,
19729
+ lastName: formData.lastName,
19730
+ email: formData.email,
19731
+ },
19732
+ })];
19653
19733
  case 1:
19654
- account = _a.sent();
19655
- return [2 /*return*/, account];
19734
+ data = _a.sent();
19735
+ setAccountId(data.account.id);
19736
+ setPortalSessionToken(data.portalSessionToken);
19737
+ setPaymentMethodGraphQLClient(createGraphQLClient(apiHost, data.portalSessionToken));
19738
+ // We must invalidate the accountPaymentMethodKey query in order to clear payment methods from the provided api token,
19739
+ // to instead use paymentMethods from portalSessionToken.
19740
+ queryClient.invalidateQueries({
19741
+ queryKey: QueryKeyFactory.default.accountPaymentMethodKey({
19742
+ entityId: entityId,
19743
+ token: token,
19744
+ }),
19745
+ });
19746
+ setProceedingToPayment(false);
19747
+ setQuote(data.quote);
19748
+ return [3 /*break*/, 3];
19749
+ case 2:
19750
+ error_1 = _a.sent();
19751
+ setProceedingToPayment(false);
19752
+ showErrorNotification(error_1.response.message);
19753
+ return [3 /*break*/, 3];
19754
+ case 3: return [2 /*return*/];
19656
19755
  }
19657
19756
  });
19658
- }); },
19659
- onSuccess: function () {
19660
- queryClient.invalidateQueries({
19661
- queryKey: ["getTaxationRequiredAccountFields", token],
19757
+ });
19758
+ }
19759
+ function handlePaymentSuccess() {
19760
+ return __awaiter(this, void 0, void 0, function () {
19761
+ return __generator(this, function (_a) {
19762
+ setPurchaseSucceeded(true);
19763
+ return [2 /*return*/];
19662
19764
  });
19663
- },
19664
- }), updateAccount = _b.mutate, isUpdatingAccount = _b.isPending;
19665
- return (jsxs(Form, __assign({ className: "flex flex-col gap-4", form: form, initialValues: account, layout: "vertical", onFinish: updateAccount }, { children: [jsx(Form.Item, __assign({ label: "Billing street", name: "billingStreet" }, { children: jsx(Input, { placeholder: "Street" }) })), jsx(Form.Item, __assign({ label: "Billing city", name: "billingCity" }, { children: jsx(Input, { placeholder: "City" }) })), jsx(FormBillingState, { form: form }), jsx(Form.Item, __assign({ label: "Billing country", name: "billingCountry", rules: [{ required: true }] }, { children: jsx(Select, { options: Lists.COUNTRY_LIST, placeholder: "Select a country", showSearch: true, filterOption: function (input, option) {
19666
- var _a, _b;
19667
- return ((_a = option === null || option === void 0 ? void 0 : option.label) !== null && _a !== void 0 ? _a : "").toLowerCase().includes(input.toLowerCase()) ||
19668
- ((_b = option === null || option === void 0 ? void 0 : option.value) !== null && _b !== void 0 ? _b : "").toLowerCase().includes(input.toLowerCase());
19669
- } }) })), jsx(Form.Item, __assign({ label: "Billing zip", name: "billingZip" }, { children: jsx(Input, { placeholder: "Zip" }) })), jsx(Form.Item, { children: jsx(Button, __assign({ className: "w-full", disabled: isUpdatingAccount, htmlType: "submit", type: "primary" }, { children: "Submit" })) })] })));
19670
- };
19671
- var FormBillingState = function (_a) {
19672
- _a.form;
19673
- var billingCountry = Form.useWatch("billingCountry");
19674
- var billingStateRequired = COUNTRIES_REQUIRING_STATE.includes(billingCountry);
19675
- return (jsx(Form.Item, __assign({ label: "Billing state", name: "billingState", rules: [{ required: billingStateRequired }] }, { children: jsx(Input, { placeholder: "State" }) })));
19676
- };
19677
-
19678
- var QuoteCheckout = function (_a) {
19679
- var account = _a.account, onSuccess = _a.onSuccess, onFail = _a.onFail, quote = _a.quote, taxationRequiredAccountFields = _a.taxationRequiredAccountFields, entityId = _a.entityId;
19680
- var _b = useContext(BunnyContext), apiHost = _b.apiHost, graphQLClient = _b.graphQLClient;
19681
- var token = useToken();
19682
- var isMobile = useIsMobile();
19683
- var _c = useState(false), isSaving = _c[0], setIsSaving = _c[1];
19684
- var paymentRequired = getQuoteAmountDue(quote) > 0;
19685
- var checkoutMutation = useMutation({
19686
- mutationFn: function () { return __awaiter(void 0, void 0, void 0, function () {
19765
+ });
19766
+ }
19767
+ function accountSignupFunction(plugin) {
19768
+ return __awaiter(this, void 0, void 0, function () {
19687
19769
  return __generator(this, function (_a) {
19688
19770
  switch (_a.label) {
19689
19771
  case 0:
19690
- if (!quote)
19691
- throw new Error("Quote is required");
19692
- if (paymentRequired)
19693
- throw new Error("Payment is required");
19694
- return [4 /*yield*/, checkout({ quoteId: quote.id, token: token, apiHost: apiHost })];
19772
+ if (!portalSessionToken) {
19773
+ throw new Error("Portal session token is required");
19774
+ }
19775
+ if (!accountId) {
19776
+ throw new Error("Account ID is required");
19777
+ }
19778
+ if (!(plugin === null || plugin === void 0 ? void 0 : plugin.id)) {
19779
+ throw new Error("Plugin ID is required");
19780
+ }
19781
+ if (!(paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.id)) {
19782
+ throw new Error("Payment method ID is required");
19783
+ }
19784
+ return [4 /*yield*/, accountSignup({
19785
+ token: portalSessionToken,
19786
+ apiHost: apiHost,
19787
+ entityId: entityId,
19788
+ quoteId: quote === null || quote === void 0 ? void 0 : quote.id,
19789
+ paymentMethodId: paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.id,
19790
+ pluginId: plugin === null || plugin === void 0 ? void 0 : plugin.id.toString(),
19791
+ priceListCode: priceListCode,
19792
+ accountId: accountId,
19793
+ })];
19695
19794
  case 1: return [2 /*return*/, _a.sent()];
19696
19795
  }
19697
19796
  });
19698
- }); },
19699
- onSuccess: onSuccess,
19700
- onError: onFail,
19701
- });
19702
- function handleCheckoutNoPayment() {
19703
- return __awaiter(this, void 0, void 0, function () {
19704
- return __generator(this, function (_a) {
19705
- setIsSaving(true);
19706
- checkoutMutation.mutate();
19707
- setIsSaving(false);
19708
- return [2 /*return*/];
19709
- });
19710
19797
  });
19711
19798
  }
19712
- if (taxationRequiredAccountFields)
19713
- return (jsx(PaymentFormWrapper, __assign({ setMaxHeight: false }, { children: jsx(TaxationForm, { account: account, quote: quote }) })));
19714
- return (jsx(Fragment, { children: paymentRequired ? (jsx(PaymentForm, { entityId: entityId, onFail: onFail, onPaymentSuccess: onSuccess, quote: quote, graphQLClient: graphQLClient })) : (jsx(PaymentFormWrapper, __assign({ setMaxHeight: false }, { children: jsxs("div", __assign({ className: "flex flex-col gap-2 ".concat(isMobile ? "shadow-padding-x" : "") }, { children: [jsx(Button, __assign({ onClick: handleCheckoutNoPayment, type: "primary" }, { children: isSaving ? "Processing..." : "Complete order" })), jsx("div", __assign({ className: "text-xs text-slate-500" }, { children: "No payment is required" }))] })) }))) }));
19799
+ function handlePaymentFail(error) {
19800
+ showErrorNotification(error.response.message);
19801
+ }
19802
+ var WrapperComponent = function (_a) {
19803
+ var children = _a.children, className = _a.className, style = _a.style;
19804
+ return isCardEnabled ? (jsx(Card, __assign({ className: className, style: style }, { children: children }))) : (jsx("div", __assign({ className: className, style: style }, { children: children })));
19805
+ };
19806
+ return (jsx(WrapperComponent, __assign({ className: "p-4 flex flex-col ".concat(shadow, " ").concat(className), style: style }, { children: purchaseSucceeded ? (jsx(Fragment, { children: (quote === null || quote === void 0 ? void 0 : quote.currencyId) !== undefined ? (jsx(PaymentSuccessDisplay, { amountPaid: (quote === null || quote === void 0 ? void 0 : quote.amountDue) || 0, className: "w-full", companyName: companyName, returnUrl: returnUrl, currencyId: quote === null || quote === void 0 ? void 0 : quote.currencyId })) : (jsx("div", { children: "No currency ID found from Quote" })) })) : (jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col" : "flex-row", " h-full w-full") }, { children: [jsx("div", __assign({ className: "flex flex-col ".concat(isMobile ? "items-center" : "w-1/2 items-center") }, { children: jsx(PriceListDisplay, { priceListData: priceListData, topNavImageUrl: topNavImageUrl }) })), jsx("div", __assign({ className: "".concat(isMobile ? "h-full" : "my-4") }, { children: jsx(Divider, { className: "h-full", type: isMobile ? undefined : "vertical" }) })), jsx("div", __assign({ className: "flex ".concat(isMobile
19807
+ ? "items-center justify-center my-12"
19808
+ : "w-1/2 items-center justify-center my-12") }, { children: jsx("div", __assign({ className: "".concat(isMobile ? "w-full" : "w-1/2") }, { children: jsx(PaymentForms, { entityId: entityId, quote: quote, handlePaymentSuccess: handlePaymentSuccess, handlePaymentFail: handlePaymentFail, handleSubmit: handleSubmit, proceedingToPayment: proceedingToPayment, accountId: accountId, overrideToken: portalSessionToken, customCheckoutFunction: accountSignupFunction }) })) }))] }))) })));
19809
+ }
19810
+
19811
+ var createRequestHeaders = function (token) {
19812
+ var bearerToken = "Bearer ".concat(token);
19813
+ var headers = {
19814
+ "Content-type": "application/json; charset=utf-8",
19815
+ };
19816
+ headers["Authorization"] = bearerToken;
19817
+ return headers;
19715
19818
  };
19716
- var PaymentFormWrapper = function (_a) {
19717
- var children = _a.children, setMaxHeight = _a.setMaxHeight, className = _a.className;
19718
- var isMobile = useIsMobile();
19719
- return (jsx("div", __assign({ className: "flex flex-col gap-6 shrink-0 ".concat(isMobile ? "w-full shadow-padding-xb" : "", " ").concat(className), style: __assign({}, (isMobile
19720
- ? setMaxHeight
19721
- ? { maxHeight: "60vh" }
19722
- : {}
19723
- : {
19724
- width: "350px",
19725
- })) }, { children: children })));
19819
+ var getGraphQLBaseURL = function (apiHost) {
19820
+ return "".concat(apiHost, "/graphql");
19726
19821
  };
19727
-
19728
- var queryKeyFactory = QueryKeyFactory.default;
19729
- var Checkout = function (_a) {
19730
- var _b, _c;
19731
- var entityId = _a.entityId, onCancel = _a.onCancel, onSuccess = _a.onSuccess, onFail = _a.onFail, invoice = _a.invoice, open = _a.open, quote = _a.quote, selectedPriceList = _a.selectedPriceList, token = _a.token, _d = _a.quantity, quantity = _d === void 0 ? 0 : _d;
19732
- var _e = useContext(BunnyContext), apiHost = _e.apiHost, graphQLClient = _e.graphQLClient;
19733
- var isMobile = useIsMobile();
19734
- var hasTaxPlugin = useHasTaxPlugin({
19735
- entityId: entityId,
19736
- apiHost: apiHost,
19737
- token: token,
19738
- });
19739
- var queryClient = useQueryClient();
19740
- // Queries
19741
- var _f = useQuery({
19742
- queryKey: ["getTaxationRequiredAccountFields", token],
19743
- queryFn: function () { return getTaxationRequiredAccountFields({ token: token, apiHost: apiHost }); },
19744
- enabled: Boolean(quote),
19745
- staleTime: 0,
19746
- }), taxationRequiredAccountFields = _f.data, isLoadingTaxationRequiredAccountFields = _f.isLoading;
19747
- var _g = useQuery({
19748
- queryKey: ["account", quote === null || quote === void 0 ? void 0 : quote.accountId],
19749
- queryFn: function () { return (quote === null || quote === void 0 ? void 0 : quote.accountId) && getAccount({ id: quote.accountId, token: token, apiHost: apiHost }); },
19750
- enabled: Boolean(quote === null || quote === void 0 ? void 0 : quote.accountId) && ((taxationRequiredAccountFields === null || taxationRequiredAccountFields === void 0 ? void 0 : taxationRequiredAccountFields.length) || 0) > 0,
19751
- }), account = _g.data, isLoadingAccount = _g.isLoading;
19752
- useQuery({
19753
- queryKey: queryKeyFactory.createQuoteTaxCalculateKey({ id: quote === null || quote === void 0 ? void 0 : quote.id, token: token }),
19754
- queryFn: function () { return __awaiter(void 0, void 0, void 0, function () {
19755
- var updatedQuote, quoteKey, calculatedPricesKey;
19756
- return __generator(this, function (_a) {
19757
- switch (_a.label) {
19758
- case 0:
19759
- if (!quote) return [3 /*break*/, 2];
19760
- return [4 /*yield*/, quoteRecalculateTaxes({
19761
- quoteId: quote.id,
19762
- token: token,
19763
- apiHost: apiHost,
19764
- })];
19765
- case 1:
19766
- updatedQuote = _a.sent();
19767
- if (updatedQuote) {
19768
- quoteKey = queryKeyFactory.createObjectKey({ objectName: "editingQuote", id: updatedQuote.id, token: token });
19769
- calculatedPricesKey = queryKeyFactory.calculatedPricesKey({
19770
- quantity: quantity,
19771
- priceListId: selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id,
19772
- token: token,
19773
- });
19774
- queryClient.setQueryData(quoteKey, updatedQuote);
19775
- queryClient.setQueryData(calculatedPricesKey, updatedQuote);
19776
- }
19777
- _a.label = 2;
19778
- case 2: return [2 /*return*/, {}];
19779
- }
19780
- });
19781
- }); },
19782
- // Recalculate taxes if the quote is open, has a tax plugin, and the taxation required account fields are not required
19783
- enabled: Boolean(quote) &&
19784
- open &&
19785
- hasTaxPlugin &&
19786
- !taxationRequiredAccountFields &&
19787
- !isLoadingTaxationRequiredAccountFields,
19788
- staleTime: 0,
19789
- });
19790
- if (!open || isLoadingTaxationRequiredAccountFields || isLoadingAccount)
19791
- return null;
19792
- return (jsx("div", __assign({ className: "flex flex-col fixed top-0 left-0 right-0 bottom-0 bg-slate-50 overflow-auto", style: {
19793
- zIndex: 1001,
19794
- } }, { children: jsxs("div", __assign({ className: pageWrapperClassName(isMobile) }, { children: [jsx("div", __assign({ className: "flex justify-end w-full" }, { children: jsx(CloseOutlined, { className: "text-base shadow-padding-xb", onClick: onCancel }) })), jsxs("div", __assign({ className: "flex justify-end gap-6 pt-4 ".concat(isMobile ? "flex-col" : "shadow-padding-xb") }, { children: [((invoice === null || invoice === void 0 ? void 0 : invoice.html) || ((_b = quote === null || quote === void 0 ? void 0 : quote.formattedQuote) === null || _b === void 0 ? void 0 : _b.html)) && (jsx(InvoiceQuoteView, { html: invoice ? invoice.html : quote ? quote.formattedQuote.html : "" })), !isMobile && ((invoice === null || invoice === void 0 ? void 0 : invoice.html) || ((_c = quote === null || quote === void 0 ? void 0 : quote.formattedQuote) === null || _c === void 0 ? void 0 : _c.html)) && (jsx(Divider, { className: "h-full", type: "vertical" })), invoice ? (jsx("div", __assign({ className: "w-full pt-12" }, { children: jsx(PaymentForm, { entityId: entityId, onPaymentSuccess: onSuccess, onFail: onFail, invoice: invoice, graphQLClient: graphQLClient }) }))) : quote ? (jsx(QuoteCheckout, { account: account, entityId: entityId, onFail: function (error) {
19795
- onFail(error);
19796
- }, onSuccess: onSuccess, quote: quote, taxationRequiredAccountFields: taxationRequiredAccountFields, token: token })) : (jsx(PaymentForm, { entityId: entityId, onFail: function (error) {
19797
- onFail(error);
19798
- }, onPaymentSuccess: onSuccess, graphQLClient: graphQLClient }))] }))] })) })));
19822
+ var useGraphQLRequest = function () {
19823
+ return function (query, token, apiHost, variables) { return __awaiter(void 0, void 0, void 0, function () {
19824
+ var error_1;
19825
+ return __generator(this, function (_a) {
19826
+ switch (_a.label) {
19827
+ case 0:
19828
+ _a.trys.push([0, 2, , 3]);
19829
+ return [4 /*yield*/, request(getGraphQLBaseURL(apiHost), query, variables, createRequestHeaders(token))];
19830
+ case 1: return [2 /*return*/, _a.sent()];
19831
+ case 2:
19832
+ error_1 = _a.sent();
19833
+ throw error_1;
19834
+ case 3: return [2 /*return*/];
19835
+ }
19836
+ });
19837
+ }); };
19799
19838
  };
19800
19839
 
19801
- var MUTATION$3 = function () { return "\nmutation AccountSignup (\n $entityId: ID!,\n $pluginId: String!,\n $paymentMethodId: String,\n $priceListCode: String!,\n $accountId: ID!,\n $quoteId: ID!\n) {\n accountSignup(\n entityId: $entityId,\n pluginId: $pluginId,\n paymentMethodId: $paymentMethodId,\n priceListCode: $priceListCode,\n accountId: $accountId,\n quoteId: $quoteId\n ) {\n errors\n quote {\n acceptedByName\n acceptedByTitle\n accountId\n amount\n amountDue\n applicationDate\n applied\n backdatedPeriods\n backdatedQuote\n billingDay\n contactId\n createdAt\n credits\n currencyId\n dealId\n discount\n discountValue\n endDate\n evergreen\n expiresAt\n id\n invoiceImmediately\n invoiceImmediatelyAvailable\n invoiceUntil\n isPendingApprovalRequest\n kind\n message\n name\n netPaymentDays\n notes\n number\n ownerId\n payableId\n periodAmount\n poNumber\n requiresApproval\n smallUnitAmountDue\n splitInvoice\n startDate\n state\n subtotal\n taxAmount\n taxCode\n updatedAt\n uuid\n }\n }\n}"; };
19802
- var accountSignup = function (_a) {
19803
- var token = _a.token, apiHost = _a.apiHost, entityId = _a.entityId, accountId = _a.accountId, quoteId = _a.quoteId, paymentToken = _a.paymentToken, paymentMethodId = _a.paymentMethodId, pluginId = _a.pluginId, priceListCode = _a.priceListCode;
19804
- return __awaiter(void 0, void 0, void 0, function () {
19805
- var vars, response, errors;
19806
- var _b;
19807
- return __generator(this, function (_c) {
19808
- switch (_c.label) {
19809
- case 0:
19810
- vars = {
19811
- entityId: entityId,
19812
- accountId: accountId,
19813
- quoteId: quoteId,
19814
- paymentToken: paymentToken,
19815
- pluginId: pluginId,
19816
- paymentMethodId: paymentMethodId,
19817
- priceListCode: priceListCode,
19818
- };
19819
- return [4 /*yield*/, gqlRequest({
19820
- query: MUTATION$3(),
19821
- token: token,
19822
- vars: vars,
19823
- apiHost: apiHost,
19824
- })];
19840
+ var useCreateSubscriptionQuote = function () {
19841
+ var graphQLRequest = useGraphQLRequest();
19842
+ return function (subscriptionIds, token, apiHost) { return __awaiter(void 0, void 0, void 0, function () {
19843
+ var data;
19844
+ return __generator(this, function (_a) {
19845
+ switch (_a.label) {
19846
+ case 0: return [4 /*yield*/, graphQLRequest("\n mutation quoteSubscriptionUpdate(\n $subscriptionIds: [ID!]!,\n ) {\n quoteSubscriptionUpdate(\n subscriptionIds: $subscriptionIds,\n ) {\n quote {\n id\n quoteChanges {\n id\n priceList {\n id\n }\n charges {\n id\n priceListCharge {\n id\n }\n }\n }\n }\n }\n }\n ", token, apiHost, {
19847
+ subscriptionIds: subscriptionIds,
19848
+ })];
19825
19849
  case 1:
19826
- response = _c.sent();
19827
- errors = (_b = response === null || response === void 0 ? void 0 : response.accountSignup) === null || _b === void 0 ? void 0 : _b.errors;
19828
- if (errors)
19829
- throw errors;
19830
- return [2 /*return*/, response === null || response === void 0 ? void 0 : response.accountSignup];
19850
+ data = _a.sent();
19851
+ return [2 /*return*/, data];
19831
19852
  }
19832
19853
  });
19833
- });
19854
+ }); };
19834
19855
  };
19835
-
19836
- var MUTATION$2 = function () { return "\nmutation QuoteAccountSignup (\n $accountName: String!,\n $billingContact: ContactAttributes!,\n $entityId: ID!,\n $priceListCode: String!\n) {\n quoteAccountSignup(\n entityId: $entityId,\n priceListCode: $priceListCode,\n accountName: $accountName,\n billingContact: $billingContact\n ) {\n account {\n id\n }\n quote {\n acceptedByName\n acceptedByTitle\n accountId\n amount\n amountDue\n applicationDate\n applied\n backdatedPeriods\n backdatedQuote\n billingDay\n contactId\n createdAt\n credits\n currencyId\n dealId\n discount\n discountValue\n endDate\n evergreen\n expiresAt\n id\n invoiceImmediately\n invoiceImmediatelyAvailable\n invoiceUntil\n isPendingApprovalRequest\n kind\n message\n name\n netPaymentDays\n notes\n number\n ownerId\n payableId\n periodAmount\n poNumber\n requiresApproval\n smallUnitAmountDue\n splitInvoice\n startDate\n state\n subtotal\n taxAmount\n taxCode\n updatedAt\n uuid\n }\n tenant {\n code\n }\n portalSessionToken\n errors\n }\n}"; };
19837
- var quoteAccountSignup = function (_a) {
19838
- var token = _a.token, apiHost = _a.apiHost, entityId = _a.entityId, priceListCode = _a.priceListCode, accountName = _a.accountName, billingContact = _a.billingContact;
19839
- return __awaiter(void 0, void 0, void 0, function () {
19840
- var vars, response, errors;
19841
- var _b;
19842
- return __generator(this, function (_c) {
19843
- switch (_c.label) {
19844
- case 0:
19845
- vars = {
19846
- entityId: entityId,
19847
- priceListCode: priceListCode,
19848
- accountName: accountName,
19849
- billingContact: billingContact,
19850
- };
19851
- return [4 /*yield*/, gqlRequest({
19852
- query: MUTATION$2(),
19853
- token: token,
19854
- vars: vars,
19855
- apiHost: apiHost,
19856
- })];
19856
+ var useQuoteChangeUpdate = function () {
19857
+ var graphQLRequest = useGraphQLRequest();
19858
+ return function (charges, quoteChangeId, token, apiHost) { return __awaiter(void 0, void 0, void 0, function () {
19859
+ var response;
19860
+ return __generator(this, function (_a) {
19861
+ switch (_a.label) {
19862
+ case 0: return [4 /*yield*/, graphQLRequest("mutation QuoteChangeUpdate($charges:[QuoteChargeAttributes!], $id:ID!) {\n quoteChangeUpdate(id:$id, charges:$charges) {\n quoteChange { id quoteId }\n errors\n }\n }", token, apiHost, { charges: charges, id: quoteChangeId })];
19857
19863
  case 1:
19858
- response = _c.sent();
19859
- errors = (_b = response === null || response === void 0 ? void 0 : response.quoteAccountSignup) === null || _b === void 0 ? void 0 : _b.errors;
19860
- if (errors)
19861
- throw errors;
19862
- return [2 /*return*/, response === null || response === void 0 ? void 0 : response.quoteAccountSignup];
19864
+ response = _a.sent();
19865
+ return [2 /*return*/, response];
19863
19866
  }
19864
19867
  });
19865
- });
19868
+ }); };
19869
+ };
19870
+ var useQuoteDelete = function () {
19871
+ var graphQLRequest = useGraphQLRequest();
19872
+ return function (quoteId, token, apiHost) { return __awaiter(void 0, void 0, void 0, function () {
19873
+ var response;
19874
+ return __generator(this, function (_a) {
19875
+ switch (_a.label) {
19876
+ case 0: return [4 /*yield*/, graphQLRequest("mutation QuoteDelete($id: ID!) {\n quoteDelete(id: $id) {\n errors\n }\n }", token, apiHost, { id: quoteId })];
19877
+ case 1:
19878
+ response = _a.sent();
19879
+ return [2 /*return*/, response];
19880
+ }
19881
+ });
19882
+ }); };
19866
19883
  };
19867
19884
 
19868
- var MUTATION$1 = function () { return "\nquery PriceList($code: String!) {\n priceList (code: $code) {\n basePrice\n code\n createdAt\n currencyId\n id\n isVisible\n name\n periodMonths\n planId\n priceDescription\n productId\n sku\n trialAllowed\n trialLengthDays\n updatedAt\n }\n}"; };
19869
- var getPriceList = function (_a) {
19870
- var token = _a.token, code = _a.code, apiHost = _a.apiHost;
19885
+ var QUOTE_QUERY = function (id) { return "\n query quote {\n quote(id: ".concat(id, ") {\n accountId\n amount\n amountDue\n smallUnitAmountDue\n currencyId\n formattedQuote {\n html\n }\n id\n payableId\n periodAmount\n subtotal\n taxAmount\n amountsByPeriod {\n amount\n startDate\n }\n quoteChanges {\n currencyId\n id\n charges {\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 quantity\n }\n priceList {\n id\n plan {\n name\n }\n product {\n name\n }\n }\n\n }\n }\n }"); };
19886
+ var getQuote = function (_a) {
19887
+ var id = _a.id, token = _a.token, apiHost = _a.apiHost;
19871
19888
  return __awaiter(void 0, void 0, void 0, function () {
19872
19889
  var response;
19873
19890
  return __generator(this, function (_b) {
19874
19891
  switch (_b.label) {
19875
19892
  case 0: return [4 /*yield*/, gqlRequest({
19876
- query: MUTATION$1(),
19893
+ query: QUOTE_QUERY(id),
19877
19894
  token: token,
19878
- vars: { code: code },
19895
+ vars: {},
19879
19896
  apiHost: apiHost,
19880
19897
  })];
19881
19898
  case 1:
19882
19899
  response = _b.sent();
19883
- return [2 /*return*/, response === null || response === void 0 ? void 0 : response.priceList];
19900
+ return [2 /*return*/, response === null || response === void 0 ? void 0 : response.quote];
19884
19901
  }
19885
19902
  });
19886
19903
  });
19887
19904
  };
19888
19905
 
19889
- function PaymentForms(_a) {
19890
- var quote = _a.quote, handlePaymentSuccess = _a.handlePaymentSuccess, handlePaymentFail = _a.handlePaymentFail, handleSubmit = _a.handleSubmit, proceedingToPayment = _a.proceedingToPayment, entityId = _a.entityId, accountId = _a.accountId, overrideToken = _a.overrideToken, customCheckoutFunction = _a.customCheckoutFunction;
19891
- var apiHost = useContext(BunnyContext).apiHost;
19892
- return (jsx(Fragment, { children: quote ? (jsx(Fragment, { children: overrideToken ? (jsx(PaymentForm, { entityId: entityId, onFail: handlePaymentFail, onPaymentSuccess: handlePaymentSuccess, accountId: accountId, quote: quote, overrideToken: overrideToken, graphQLClient: createGraphQLClient(apiHost, overrideToken), customCheckoutFunction: customCheckoutFunction })) : null })) : (jsx(InitialSignupForm, { onSubmit: handleSubmit, submitting: proceedingToPayment })) }));
19893
- }
19894
- function InitialSignupForm(_a) {
19895
- var onSubmit = _a.onSubmit, submitting = _a.submitting;
19896
- var form = Form.useForm()[0];
19897
- function handleSubmit() {
19898
- form.validateFields({ validateOnly: false }).then(function () {
19899
- onSubmit(form.getFieldsValue());
19906
+ 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 charges {\n priceListCharge {\n priceListChargeTiers {\n price\n starts\n }\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 }";
19907
+ var getSubscriptions = function (_a) {
19908
+ var apiHost = _a.apiHost, entityId = _a.entityId, isInPreviewMode = _a.isInPreviewMode, token = _a.token;
19909
+ return __awaiter(void 0, void 0, void 0, function () {
19910
+ var response, combinedSubscriptions;
19911
+ var _b, _c;
19912
+ return __generator(this, function (_d) {
19913
+ switch (_d.label) {
19914
+ case 0: return [4 /*yield*/, gqlRequest({
19915
+ isInPreviewMode: isInPreviewMode,
19916
+ query: SUBSCRIPTIONS_QUERY,
19917
+ token: token,
19918
+ vars: { entityId: entityId },
19919
+ apiHost: apiHost,
19920
+ })];
19921
+ case 1:
19922
+ response = _d.sent();
19923
+ 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) })); });
19924
+ return [2 /*return*/, combinedSubscriptions];
19925
+ }
19900
19926
  });
19901
- }
19902
- return (jsxs(Form, __assign({ className: "flex flex-col justify-between h-full w-full", form: form, layout: "vertical", autoComplete: "off" }, { children: [jsxs("div", __assign({ className: "flex flex-col space-y-2" }, { children: [jsx(Form.Item, __assign({ name: "firstName", rules: [{ required: true, message: "Please input your first name!" }] }, { children: jsx(Input, { placeholder: "First name" }) })), jsx(Form.Item, __assign({ name: "lastName", rules: [{ required: true, message: "Please input your last name!" }] }, { children: jsx(Input, { placeholder: "Last name" }) })), jsx(Form.Item, __assign({ name: "email", rules: [
19903
- { required: true, message: "Please input your email!" },
19904
- { type: "email", message: "Please enter a valid email!" },
19905
- ] }, { children: jsx(Input, { placeholder: "Email" }) })), jsx(Form.Item, __assign({ name: "accountName", rules: [
19906
- { required: true, message: "Please input your company name!" },
19907
- ] }, { children: jsx(Input, { placeholder: "Company name" }) }))] })), jsx(Form.Item, { children: jsx(Button, __assign({ type: "primary", onClick: handleSubmit, loading: submitting, className: "w-full mt-4" }, { children: "Proceed to payment" })) })] })));
19908
- }
19927
+ });
19928
+ };
19909
19929
 
19910
- var Title = Typography.Title, Text$4 = Typography.Text;
19911
- function PaymentSuccessDisplay(_a) {
19912
- var amountPaid = _a.amountPaid, className = _a.className, companyName = _a.companyName, returnUrl = _a.returnUrl, style = _a.style, currencyId = _a.currencyId;
19913
- return (jsxs("div", __assign({ className: "flex flex-col items-center justify-center h-full ".concat(className), style: style }, { children: [jsx(CheckCircleFilled, { style: { fontSize: "48px", color: "rgb(52 211 153)" } }), jsxs(Title, __assign({ level: 3, className: "mt-2 m-0" }, { children: ["Payment of ", formatCurrency(amountPaid, currencyId), " successful"] })), returnUrl && (jsxs(Text$4, __assign({ className: "text-slate-500 cursor-pointer underline", onClick: function () { return (window.location.href = returnUrl); } }, { children: ["Back to ", companyName] })))] })));
19914
- }
19930
+ var pageWrapperClassName = function (isMobile) {
19931
+ return "flex flex-col grow pt-4 ".concat(isMobile ? "pb-4 overflow-hidden" : "pb-8", " ").concat("content-container");
19932
+ };
19915
19933
 
19916
- var Text$3 = Typography.Text;
19917
- function PriceListDisplay(_a) {
19918
- var priceListData = _a.priceListData, topNavImageUrl = _a.topNavImageUrl;
19919
- if (!priceListData)
19920
- return null;
19921
- return (jsx(Fragment, { children: jsx("div", __assign({ className: "flex flex-col justify-between h-full my-12" }, { children: jsxs("div", __assign({ className: "flex flex-col space-y-8" }, { children: [jsx(Image, { width: 24, src: topNavImageUrl, alt: "Logo", preview: false }), jsxs("div", __assign({ className: "flex flex-col" }, { children: [jsx(Text$3, __assign({ className: "text-slate-500 font-bold text-lg" }, { children: priceListData.name })), jsxs(Text$3, __assign({ className: "font-bold text-xl" }, { children: [formatCurrency(priceListData.basePrice, priceListData.currencyId), " ", "/ month"] }))] })), priceListData.trialAllowed ? (jsxs("div", __assign({ className: "flex flex-col" }, { children: [jsxs(Text$3, __assign({ style: { fontSize: "16px" }, className: "text-slate-500" }, { children: [priceListData.trialLengthDays, " day trial"] })), jsx(Text$3, __assign({ className: "text-slate-500", style: { fontSize: "12px" } }, { children: "You will not be charged until the last day of the trial." }))] }))) : null] })) })) }));
19922
- }
19934
+ var QUOTE_FIELDS = "quote {\n formattedQuote {\n html\n }\n acceptedByName\n acceptedByTitle\n accountId\n amount\n amountDue\n applicationDate\n applied\n billingDay\n contactId\n createdAt\n credits\n currencyId\n dealId\n discount\n discountValue\n endDate\n evergreen\n expiresAt\n id\n invoiceUntil\n isPendingApprovalRequest\n kind\n message\n name\n netPaymentDays\n notes\n ownerId\n periodAmount\n poNumber\n requiresApproval\n startDate\n state\n subtotal\n taxAmount\n updatedAt\n uuid\n amountsByPeriod {\n amount\n id\n name\n }\n endDateOptions {\n endDate\n label\n }\n invoiceUntilOptions {\n endDate\n label\n }\n quoteChanges {\n id\n priceListId\n charges {\n amount\n amountsByPeriod { amount startDate }\n billingPeriod\n billingPeriodAmounts { id amount prorationRate }\n chargeType\n couponId\n createdAt\n currencyId\n discount\n endDate\n feature { id name code isUnit unitName }\n id\n invoiceLineText\n name\n price\n priceDecimals\n priceTiers { starts price }\n pricingModel\n prorationRate\n quantity\n quantityMax\n quantityMin\n startDate\n tieredAveragePrice\n updatedAt\n }\n }\n}";
19935
+ var MUTATION$3 = "\nmutation quoteCompose($quoteId: ID, $priceListId: ID, $subscriptionId: ID, $quantity: Int, $accountId: ID) {\n quoteCompose(quoteId: $quoteId, priceListId: $priceListId, subscriptionId: $subscriptionId, quantity: $quantity, accountId: $accountId) {\n ".concat(QUOTE_FIELDS, "\n }\n}\n");
19936
+ var quoteCompose = function (_a) {
19937
+ var quoteId = _a.quoteId, priceListId = _a.priceListId, subscriptionId = _a.subscriptionId, quantity = _a.quantity, accountId = _a.accountId, token = _a.token, apiHost = _a.apiHost;
19938
+ return __awaiter(void 0, void 0, void 0, function () {
19939
+ var vars, response, _b, errors, quote;
19940
+ return __generator(this, function (_c) {
19941
+ switch (_c.label) {
19942
+ case 0:
19943
+ vars = { quoteId: quoteId, priceListId: priceListId, subscriptionId: subscriptionId, quantity: quantity, accountId: accountId };
19944
+ return [4 /*yield*/, gqlRequest({
19945
+ query: MUTATION$3,
19946
+ token: token,
19947
+ vars: vars,
19948
+ apiHost: apiHost,
19949
+ })];
19950
+ case 1:
19951
+ response = _c.sent();
19952
+ _b = response === null || response === void 0 ? void 0 : response.quoteCompose, errors = _b.errors, quote = _b.quote;
19953
+ if (errors)
19954
+ throw errors;
19955
+ return [2 /*return*/, quote];
19956
+ }
19957
+ });
19958
+ });
19959
+ };
19923
19960
 
19924
- var showErrorNotification = useErrorNotification();
19925
- function Signup(_a) {
19926
- var companyName = _a.companyName, entityId = _a.entityId, priceListCode = _a.priceListCode, returnUrl = _a.returnUrl, _b = _a.isCardEnabled, isCardEnabled = _b === void 0 ? true : _b, className = _a.className, _c = _a.shadow, shadow = _c === void 0 ? "shadow-md" : _c, style = _a.style;
19927
- // Hooks
19928
- var _d = useContext(BunnyContext), apiHost = _d.apiHost, graphQLClient = _d.graphQLClient;
19929
- var tokenFromContexts = useToken();
19930
- var isMobile = useIsMobile();
19931
- var topNavImageUrl = useContext(BrandContext).topNavImageUrl;
19932
- var _e = useState(undefined), quote = _e[0], setQuote = _e[1];
19933
- var _f = useState(undefined), accountId = _f[0], setAccountId = _f[1];
19934
- var _g = useState(undefined), portalSessionToken = _g[0], setPortalSessionToken = _g[1];
19935
- var token = portalSessionToken || tokenFromContexts;
19936
- var _h = useState(false), proceedingToPayment = _h[0], setProceedingToPayment = _h[1];
19937
- var _j = useState(false), purchaseSucceeded = _j[0], setPurchaseSucceeded = _j[1];
19938
- var _k = useState(undefined), paymentMethodGraphQLClient = _k[0], setPaymentMethodGraphQLClient = _k[1];
19939
- var paymentMethod = usePaymentMethod({
19940
- accountId: accountId,
19961
+ var QUOTE_RECALCULATE_TAXES = "\n mutation QuoteRecalculateTaxes($id: ID!) {\n quoteRecalculateTaxes(id: $id) {\n ".concat(QUOTE_FIELDS, "\n errors\n }\n }\n");
19962
+ var quoteRecalculateTaxes = function (_a) {
19963
+ var quoteId = _a.quoteId, token = _a.token, apiHost = _a.apiHost;
19964
+ return __awaiter(void 0, void 0, void 0, function () {
19965
+ var vars, response, errors;
19966
+ var _b, _c;
19967
+ return __generator(this, function (_d) {
19968
+ switch (_d.label) {
19969
+ case 0:
19970
+ vars = { id: quoteId };
19971
+ return [4 /*yield*/, gqlRequest({
19972
+ query: QUOTE_RECALCULATE_TAXES,
19973
+ token: token,
19974
+ vars: vars,
19975
+ apiHost: apiHost,
19976
+ })];
19977
+ case 1:
19978
+ response = _d.sent();
19979
+ errors = (_b = response === null || response === void 0 ? void 0 : response.quoteRecalculateTaxes) === null || _b === void 0 ? void 0 : _b.errors;
19980
+ if (errors)
19981
+ throw errors;
19982
+ return [2 /*return*/, (_c = response.quoteRecalculateTaxes) === null || _c === void 0 ? void 0 : _c.quote];
19983
+ }
19984
+ });
19985
+ });
19986
+ };
19987
+
19988
+ var MUTATION$2 = "{\n currentUser {\n taxationRequiredAccountFields\n }\n}";
19989
+ var getTaxationRequiredAccountFields = function (_a) {
19990
+ var token = _a.token, apiHost = _a.apiHost;
19991
+ return __awaiter(void 0, void 0, void 0, function () {
19992
+ var response;
19993
+ var _b, _c;
19994
+ return __generator(this, function (_d) {
19995
+ switch (_d.label) {
19996
+ case 0: return [4 /*yield*/, gqlRequest({
19997
+ query: MUTATION$2,
19998
+ token: token,
19999
+ apiHost: apiHost,
20000
+ })];
20001
+ case 1:
20002
+ response = _d.sent();
20003
+ 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
20004
+ ? response.currentUser
20005
+ .taxationRequiredAccountFields
20006
+ : null];
20007
+ }
20008
+ });
20009
+ });
20010
+ };
20011
+
20012
+ var useHasTaxPlugin = function (_a) {
20013
+ var entityId = _a.entityId, apiHost = _a.apiHost, token = _a.token;
20014
+ var plugins = usePlugins({
19941
20015
  entityId: entityId,
19942
- graphQLClient: paymentMethodGraphQLClient || graphQLClient,
20016
+ apiHost: apiHost,
19943
20017
  token: token,
19944
20018
  }).data;
20019
+ return Boolean(plugins === null || plugins === void 0 ? void 0 : plugins.some(function (plugin) { return plugin.type === "taxation"; }));
20020
+ };
20021
+
20022
+ 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";
20023
+ var accountUpdate = function (_a) {
20024
+ var accountId = _a.accountId, attributes = _a.attributes, token = _a.token, apiHost = _a.apiHost;
20025
+ return __awaiter(void 0, void 0, void 0, function () {
20026
+ var vars, response, errors;
20027
+ var _b;
20028
+ return __generator(this, function (_c) {
20029
+ switch (_c.label) {
20030
+ case 0:
20031
+ vars = { id: accountId, attributes: attributes };
20032
+ return [4 /*yield*/, gqlRequest({
20033
+ query: MUTATION$1,
20034
+ token: token,
20035
+ vars: vars,
20036
+ apiHost: apiHost,
20037
+ })];
20038
+ case 1:
20039
+ response = _c.sent();
20040
+ errors = (_b = response === null || response === void 0 ? void 0 : response.accountUpdate) === null || _b === void 0 ? void 0 : _b.errors;
20041
+ if (errors)
20042
+ throw errors;
20043
+ return [2 /*return*/, response.accountUpdate];
20044
+ }
20045
+ });
20046
+ });
20047
+ };
20048
+
20049
+ var COUNTRIES_REQUIRING_STATE = ["US", "CA"];
20050
+ var TaxationForm = function (_a) {
20051
+ var account = _a.account, quote = _a.quote;
20052
+ // Hooks
19945
20053
  var queryClient = useQueryClient();
19946
- // Queries
19947
- var priceListData = useQuery({
19948
- queryKey: ["priceList", priceListCode],
19949
- queryFn: function () { return getPriceList({ token: token, apiHost: apiHost, code: priceListCode }); },
19950
- }).data;
19951
- function handleSubmit(formData) {
19952
- return __awaiter(this, void 0, void 0, function () {
19953
- var data, error_1;
20054
+ var apiHost = useContext(BunnyContext).apiHost;
20055
+ var token = useToken();
20056
+ var form = Form.useForm()[0];
20057
+ // Mutations
20058
+ var _b = useMutation({
20059
+ mutationFn: function (changedFormData) { return __awaiter(void 0, void 0, void 0, function () {
20060
+ var account;
19954
20061
  return __generator(this, function (_a) {
19955
20062
  switch (_a.label) {
19956
- case 0:
19957
- _a.trys.push([0, 2, , 3]);
19958
- setProceedingToPayment(true);
19959
- return [4 /*yield*/, quoteAccountSignup({
19960
- token: token,
19961
- apiHost: apiHost,
19962
- entityId: entityId,
19963
- priceListCode: priceListCode,
19964
- accountName: formData.accountName,
19965
- billingContact: {
19966
- firstName: formData.firstName,
19967
- lastName: formData.lastName,
19968
- email: formData.email,
19969
- },
19970
- })];
20063
+ case 0: return [4 /*yield*/, accountUpdate({
20064
+ accountId: quote.accountId,
20065
+ attributes: changedFormData,
20066
+ token: token,
20067
+ apiHost: apiHost,
20068
+ })];
19971
20069
  case 1:
19972
- data = _a.sent();
19973
- setAccountId(data.account.id);
19974
- setPortalSessionToken(data.portalSessionToken);
19975
- setPaymentMethodGraphQLClient(createGraphQLClient(apiHost, data.portalSessionToken));
19976
- // We must invalidate the accountPaymentMethodKey query in order to clear payment methods from the provided api token,
19977
- // to instead use paymentMethods from portalSessionToken.
19978
- queryClient.invalidateQueries({
19979
- queryKey: QueryKeyFactory.default.accountPaymentMethodKey({
19980
- entityId: entityId,
19981
- token: token,
19982
- }),
19983
- });
19984
- setProceedingToPayment(false);
19985
- setQuote(data.quote);
19986
- return [3 /*break*/, 3];
19987
- case 2:
19988
- error_1 = _a.sent();
19989
- setProceedingToPayment(false);
19990
- showErrorNotification(error_1.response.message);
19991
- return [3 /*break*/, 3];
19992
- case 3: return [2 /*return*/];
20070
+ account = _a.sent();
20071
+ return [2 /*return*/, account];
20072
+ }
20073
+ });
20074
+ }); },
20075
+ onSuccess: function () {
20076
+ queryClient.invalidateQueries({
20077
+ queryKey: ["getTaxationRequiredAccountFields", token],
20078
+ });
20079
+ },
20080
+ }), updateAccount = _b.mutate, isUpdatingAccount = _b.isPending;
20081
+ return (jsxs(Form, __assign({ className: "flex flex-col gap-4", form: form, initialValues: account, layout: "vertical", onFinish: updateAccount }, { children: [jsx(Form.Item, __assign({ label: "Billing street", name: "billingStreet" }, { children: jsx(Input, { placeholder: "Street" }) })), jsx(Form.Item, __assign({ label: "Billing city", name: "billingCity" }, { children: jsx(Input, { placeholder: "City" }) })), jsx(FormBillingState, { form: form }), jsx(Form.Item, __assign({ label: "Billing country", name: "billingCountry", rules: [{ required: true }] }, { children: jsx(Select, { options: Lists.COUNTRY_LIST, placeholder: "Select a country", showSearch: true, filterOption: function (input, option) {
20082
+ var _a, _b;
20083
+ return ((_a = option === null || option === void 0 ? void 0 : option.label) !== null && _a !== void 0 ? _a : "").toLowerCase().includes(input.toLowerCase()) ||
20084
+ ((_b = option === null || option === void 0 ? void 0 : option.value) !== null && _b !== void 0 ? _b : "").toLowerCase().includes(input.toLowerCase());
20085
+ } }) })), jsx(Form.Item, __assign({ label: "Billing zip", name: "billingZip" }, { children: jsx(Input, { placeholder: "Zip" }) })), jsx(Form.Item, { children: jsx(Button, __assign({ className: "w-full", disabled: isUpdatingAccount, htmlType: "submit", type: "primary" }, { children: "Submit" })) })] })));
20086
+ };
20087
+ var FormBillingState = function (_a) {
20088
+ _a.form;
20089
+ var billingCountry = Form.useWatch("billingCountry");
20090
+ var billingStateRequired = COUNTRIES_REQUIRING_STATE.includes(billingCountry);
20091
+ return (jsx(Form.Item, __assign({ label: "Billing state", name: "billingState", rules: [{ required: billingStateRequired }] }, { children: jsx(Input, { placeholder: "State" }) })));
20092
+ };
20093
+
20094
+ var QuoteCheckout = function (_a) {
20095
+ var account = _a.account, onSuccess = _a.onSuccess, onFail = _a.onFail, quote = _a.quote, taxationRequiredAccountFields = _a.taxationRequiredAccountFields, entityId = _a.entityId;
20096
+ var _b = useContext(BunnyContext), apiHost = _b.apiHost, graphQLClient = _b.graphQLClient;
20097
+ var token = useToken();
20098
+ var isMobile = useIsMobile();
20099
+ var _c = useState(false), isSaving = _c[0], setIsSaving = _c[1];
20100
+ var paymentRequired = getQuoteAmountDue(quote) > 0;
20101
+ var checkoutMutation = useMutation({
20102
+ mutationFn: function () { return __awaiter(void 0, void 0, void 0, function () {
20103
+ return __generator(this, function (_a) {
20104
+ switch (_a.label) {
20105
+ case 0:
20106
+ if (!quote)
20107
+ throw new Error("Quote is required");
20108
+ if (paymentRequired)
20109
+ throw new Error("Payment is required");
20110
+ return [4 /*yield*/, checkout({ quoteId: quote.id, token: token, apiHost: apiHost })];
20111
+ case 1: return [2 /*return*/, _a.sent()];
19993
20112
  }
19994
20113
  });
19995
- });
19996
- }
19997
- function handlePaymentSuccess() {
20114
+ }); },
20115
+ onSuccess: onSuccess,
20116
+ onError: onFail,
20117
+ });
20118
+ function handleCheckoutNoPayment() {
19998
20119
  return __awaiter(this, void 0, void 0, function () {
19999
20120
  return __generator(this, function (_a) {
20000
- setPurchaseSucceeded(true);
20121
+ setIsSaving(true);
20122
+ checkoutMutation.mutate();
20123
+ setIsSaving(false);
20001
20124
  return [2 /*return*/];
20002
20125
  });
20003
20126
  });
20004
20127
  }
20005
- function accountSignupFunction(plugin) {
20006
- return __awaiter(this, void 0, void 0, function () {
20128
+ if (taxationRequiredAccountFields)
20129
+ return (jsx(PaymentFormWrapper, __assign({ setMaxHeight: false }, { children: jsx(TaxationForm, { account: account, quote: quote }) })));
20130
+ return (jsx(Fragment, { children: paymentRequired ? (jsx(PaymentForm, { entityId: entityId, onFail: onFail, onPaymentSuccess: onSuccess, quote: quote, graphQLClient: graphQLClient })) : (jsx(PaymentFormWrapper, __assign({ setMaxHeight: false }, { children: jsxs("div", __assign({ className: "flex flex-col gap-2 ".concat(isMobile ? "shadow-padding-x" : "") }, { children: [jsx(Button, __assign({ onClick: handleCheckoutNoPayment, type: "primary" }, { children: isSaving ? "Processing..." : "Complete order" })), jsx("div", __assign({ className: "text-xs text-slate-500" }, { children: "No payment is required" }))] })) }))) }));
20131
+ };
20132
+ var PaymentFormWrapper = function (_a) {
20133
+ var children = _a.children, setMaxHeight = _a.setMaxHeight, className = _a.className;
20134
+ var isMobile = useIsMobile();
20135
+ return (jsx("div", __assign({ className: "flex flex-col gap-6 shrink-0 ".concat(isMobile ? "w-full shadow-padding-xb" : "", " ").concat(className), style: __assign({}, (isMobile
20136
+ ? setMaxHeight
20137
+ ? { maxHeight: "60vh" }
20138
+ : {}
20139
+ : {
20140
+ width: "350px",
20141
+ })) }, { children: children })));
20142
+ };
20143
+
20144
+ var queryKeyFactory = QueryKeyFactory.default;
20145
+ var Checkout = function (_a) {
20146
+ var _b, _c;
20147
+ var entityId = _a.entityId, onCancel = _a.onCancel, onSuccess = _a.onSuccess, onFail = _a.onFail, invoice = _a.invoice, open = _a.open, quote = _a.quote, selectedPriceList = _a.selectedPriceList, token = _a.token, _d = _a.quantity, quantity = _d === void 0 ? 0 : _d;
20148
+ var _e = useContext(BunnyContext), apiHost = _e.apiHost, graphQLClient = _e.graphQLClient;
20149
+ var isMobile = useIsMobile();
20150
+ var hasTaxPlugin = useHasTaxPlugin({
20151
+ entityId: entityId,
20152
+ apiHost: apiHost,
20153
+ token: token,
20154
+ });
20155
+ var queryClient = useQueryClient();
20156
+ // Queries
20157
+ var _f = useQuery({
20158
+ queryKey: ["getTaxationRequiredAccountFields", token],
20159
+ queryFn: function () { return getTaxationRequiredAccountFields({ token: token, apiHost: apiHost }); },
20160
+ enabled: Boolean(quote),
20161
+ staleTime: 0,
20162
+ }), taxationRequiredAccountFields = _f.data, isLoadingTaxationRequiredAccountFields = _f.isLoading;
20163
+ var _g = useQuery({
20164
+ queryKey: ["account", quote === null || quote === void 0 ? void 0 : quote.accountId],
20165
+ queryFn: function () {
20166
+ return (quote === null || quote === void 0 ? void 0 : quote.accountId) && getAccount({ id: quote.accountId, token: token, apiHost: apiHost });
20167
+ },
20168
+ enabled: Boolean(quote === null || quote === void 0 ? void 0 : quote.accountId) &&
20169
+ ((taxationRequiredAccountFields === null || taxationRequiredAccountFields === void 0 ? void 0 : taxationRequiredAccountFields.length) || 0) > 0,
20170
+ }), account = _g.data, isLoadingAccount = _g.isLoading;
20171
+ useQuery({
20172
+ queryKey: queryKeyFactory.createQuoteTaxCalculateKey({
20173
+ id: quote === null || quote === void 0 ? void 0 : quote.id,
20174
+ token: token,
20175
+ }),
20176
+ queryFn: function () { return __awaiter(void 0, void 0, void 0, function () {
20177
+ var updatedQuote, quoteKey, calculatedPricesKey;
20007
20178
  return __generator(this, function (_a) {
20008
20179
  switch (_a.label) {
20009
20180
  case 0:
20010
- if (!portalSessionToken) {
20011
- throw new Error("Portal session token is required");
20012
- }
20013
- if (!accountId) {
20014
- throw new Error("Account ID is required");
20015
- }
20016
- if (!(plugin === null || plugin === void 0 ? void 0 : plugin.id)) {
20017
- throw new Error("Plugin ID is required");
20018
- }
20019
- if (!(paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.id)) {
20020
- throw new Error("Payment method ID is required");
20021
- }
20022
- return [4 /*yield*/, accountSignup({
20023
- token: portalSessionToken,
20181
+ if (!quote) return [3 /*break*/, 2];
20182
+ return [4 /*yield*/, quoteRecalculateTaxes({
20183
+ quoteId: quote.id,
20184
+ token: token,
20024
20185
  apiHost: apiHost,
20025
- entityId: entityId,
20026
- quoteId: quote === null || quote === void 0 ? void 0 : quote.id,
20027
- paymentMethodId: paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.id,
20028
- pluginId: plugin === null || plugin === void 0 ? void 0 : plugin.id.toString(),
20029
- priceListCode: priceListCode,
20030
- accountId: accountId,
20031
20186
  })];
20032
- case 1: return [2 /*return*/, _a.sent()];
20187
+ case 1:
20188
+ updatedQuote = _a.sent();
20189
+ if (updatedQuote) {
20190
+ quoteKey = queryKeyFactory.createObjectKey({
20191
+ objectName: "editingQuote",
20192
+ id: updatedQuote.id,
20193
+ token: token,
20194
+ });
20195
+ calculatedPricesKey = queryKeyFactory.calculatedPricesKey({
20196
+ quantity: quantity,
20197
+ priceListId: selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id,
20198
+ token: token,
20199
+ });
20200
+ queryClient.setQueryData(quoteKey, updatedQuote);
20201
+ queryClient.setQueryData(calculatedPricesKey, updatedQuote);
20202
+ }
20203
+ _a.label = 2;
20204
+ case 2: return [2 /*return*/, {}];
20033
20205
  }
20034
20206
  });
20207
+ }); },
20208
+ // Recalculate taxes if the quote is open, has a tax plugin, and the taxation required account fields are not required
20209
+ enabled: Boolean(quote) &&
20210
+ open &&
20211
+ hasTaxPlugin &&
20212
+ !taxationRequiredAccountFields &&
20213
+ !isLoadingTaxationRequiredAccountFields,
20214
+ staleTime: 0,
20215
+ });
20216
+ if (!open || isLoadingTaxationRequiredAccountFields || isLoadingAccount)
20217
+ return null;
20218
+ return (jsx("div", __assign({ className: "flex flex-col fixed top-0 left-0 right-0 bottom-0 bg-slate-50 overflow-auto", style: {
20219
+ zIndex: 1001,
20220
+ } }, { children: jsxs("div", __assign({ className: pageWrapperClassName(isMobile) }, { children: [jsx("div", __assign({ className: "flex justify-end w-full" }, { children: jsx(CloseOutlined, { className: "text-base shadow-padding-xb", onClick: onCancel }) })), jsxs("div", __assign({ className: "flex justify-end gap-6 pt-4 ".concat(isMobile ? "flex-col" : "shadow-padding-xb") }, { children: [((invoice === null || invoice === void 0 ? void 0 : invoice.html) || ((_b = quote === null || quote === void 0 ? void 0 : quote.formattedQuote) === null || _b === void 0 ? void 0 : _b.html)) && (jsx(InvoiceQuoteView, { html: invoice ? invoice.html : quote ? quote.formattedQuote.html : "" })), !isMobile && ((invoice === null || invoice === void 0 ? void 0 : invoice.html) || ((_c = quote === null || quote === void 0 ? void 0 : quote.formattedQuote) === null || _c === void 0 ? void 0 : _c.html)) && (jsx(Divider, { className: "h-full", type: "vertical" })), invoice ? (jsx("div", __assign({ className: "w-full pt-12" }, { children: jsx(PaymentForm, { entityId: entityId, onPaymentSuccess: onSuccess, onFail: onFail, invoice: invoice, graphQLClient: graphQLClient }) }))) : quote ? (jsx(QuoteCheckout, { account: account, entityId: entityId, onFail: function (error) {
20221
+ onFail(error);
20222
+ }, onSuccess: onSuccess, quote: quote, taxationRequiredAccountFields: taxationRequiredAccountFields, token: token })) : (jsx(PaymentForm, { entityId: entityId, onFail: function (error) {
20223
+ onFail(error);
20224
+ }, onPaymentSuccess: onSuccess, graphQLClient: graphQLClient }))] }))] })) })));
20225
+ };
20226
+
20227
+ var useCurrentUserData = function () {
20228
+ var queryClient = useQueryClient();
20229
+ var token = useToken();
20230
+ var currentUser = queryClient.getQueryData(QueryKeyFactory.default.currentUserKey(token));
20231
+ if (!currentUser)
20232
+ return {};
20233
+ return currentUser;
20234
+ };
20235
+
20236
+ var BunnyFooterIcon = function (_a) {
20237
+ var color = _a.color;
20238
+ 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: "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: "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: "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: "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: "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: "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" }) })) })] })));
20239
+ };
20240
+
20241
+ var SubscriptionsContext = createContext({});
20242
+
20243
+ var Footer = function (_a) {
20244
+ var className = _a.className;
20245
+ // Context
20246
+ var quotePreviewData = useContext(SubscriptionsContext).quotePreviewData;
20247
+ var _b = useCurrentUserData(), privacyUrl = _b.privacyUrl, termsUrl = _b.termsUrl;
20248
+ var isMobile = useIsMobile();
20249
+ var selectedPriceList = quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.priceList;
20250
+ if (selectedPriceList && isMobile)
20251
+ return null;
20252
+ return (jsxs("div", __assign({ className: "flex items-center justify-between shrink-0 ".concat(isMobile ? "flex-col gap-2 grow" : "", " ").concat(className) }, { children: [(termsUrl || privacyUrl) && (jsxs("div", __assign({ className: "flex items-center gap-3" }, { children: [termsUrl && (jsx(StyedLink, __assign({ className: "text-xs text-slate-400", href: termsUrl, rel: "noopener noreferrer", target: "_blank", type: "text" }, { children: "Terms" }))), privacyUrl && (jsx(StyedLink, __assign({ className: "text-xs text-slate-400", href: privacyUrl, rel: "noopener noreferrer", target: "_blank", type: "text" }, { children: "Privacy" })))] }))), jsx(BunnyMarketingLink, {})] })));
20253
+ };
20254
+ var BunnyMarketingLink = function () {
20255
+ var _a = useState(false), isHovered = _a[0], setIsHovered = _a[1];
20256
+ var isMobile = useIsMobile();
20257
+ return (jsx("div", __assign({ className: "flex items-end justify-end ".concat(isMobile ? "" : "grow") }, { children: jsx(StyledBunnyLink, __assign({ className: "flex items-end justify-end text-slate-400", href: "https://bunny.com/", rel: "noopener noreferrer", target: "_blank" }, { children: jsxs("div", __assign({ className: "flex items-center", onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); } }, { children: ["Powered by\u00A0", jsx("div", __assign({ style: { paddingTop: "5px" } }, { children: jsx(BunnyFooterIcon, { color: isHovered ? PRIMARY_COLOR : SLATE_400 }) }))] })) })) })));
20258
+ };
20259
+ var StyedLink = styled.a(templateObject_1$5 || (templateObject_1$5 = __makeTemplateObject(["\n color: ", ";\n transition: color 0.3s;\n &:hover {\n color: ", ";\n }\n font-family: Inter;\n text-decoration: none;\n font-size: 14px;\n"], ["\n color: ", ";\n transition: color 0.3s;\n &:hover {\n color: ", ";\n }\n font-family: Inter;\n text-decoration: none;\n font-size: 14px;\n"])), SLATE_400, SLATE_500);
20260
+ 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);
20261
+ var templateObject_1$5, templateObject_2$1;
20262
+
20263
+ var PageTitle = function (_a) {
20264
+ var onGoBack = _a.onGoBack, title = _a.title;
20265
+ var isMobile = useIsMobile();
20266
+ var secondaryColor = useContext(BrandContext).secondaryColor;
20267
+ return (jsxs("div", __assign({ className: "flex items-center gap-3 font-medium", style: {
20268
+ fontSize: "28px",
20269
+ paddingBottom: isMobile ? "22px" : "56px",
20270
+ color: secondaryColor,
20271
+ } }, { children: [onGoBack && (jsx(ArrowLeftOutlined, { onClick: onGoBack, style: {
20272
+ fontSize: "20px",
20273
+ cursor: "pointer",
20274
+ } })), title] })));
20275
+ };
20276
+
20277
+ var calculateNewQuantity = function (priceList, currentQuantity) {
20278
+ if (currentQuantity === void 0) { currentQuantity = 1; }
20279
+ var priceListRecurringCharge = priceList === null || priceList === void 0 ? void 0 : priceList.charges.find(function (priceListCharge) {
20280
+ return priceListCharge.chargeType === "RECURRING" ||
20281
+ priceListCharge.chargeType === "USAGE";
20282
+ });
20283
+ var quantityMax = (priceListRecurringCharge === null || priceListRecurringCharge === void 0 ? void 0 : priceListRecurringCharge.quantityMax) || Number.POSITIVE_INFINITY;
20284
+ var quantityMin = (priceListRecurringCharge === null || priceListRecurringCharge === void 0 ? void 0 : priceListRecurringCharge.quantityMin) || Number.NEGATIVE_INFINITY;
20285
+ var selfServiceQuantity = priceListRecurringCharge === null || priceListRecurringCharge === void 0 ? void 0 : priceListRecurringCharge.selfServiceQuantity;
20286
+ // If self service quantity is disabled, return the min quantity
20287
+ if (!selfServiceQuantity && quantityMin) {
20288
+ return quantityMin;
20289
+ }
20290
+ // If the current quantity is greater than the max quantity, return the max quantity
20291
+ else if (currentQuantity > quantityMax) {
20292
+ return quantityMax;
20293
+ }
20294
+ // If the current quantity is less than the min quantity, return the min quantity
20295
+ else if (currentQuantity < quantityMin) {
20296
+ return quantityMin;
20297
+ }
20298
+ // If the current quantity is between the min and max quantity, return the current quantity
20299
+ else if (currentQuantity <= quantityMax && currentQuantity >= quantityMin) {
20300
+ return currentQuantity;
20301
+ }
20302
+ // If all else fails, return 1
20303
+ else {
20304
+ return 1;
20305
+ }
20306
+ };
20307
+
20308
+ var CheckoutBarInput = function (_a) {
20309
+ var charge = _a.charge, quantity = _a.quantity, selectedPriceList = _a.selectedPriceList, setQuantity = _a.setQuantity;
20310
+ var _b = useState(false), isTooltipOpen = _b[0], setIsTooltipOpen = _b[1];
20311
+ // Context
20312
+ var _c = useContext(SubscriptionsContext), setQuotePreviewData = _c.setQuotePreviewData, quotePreviewData = _c.quotePreviewData;
20313
+ // Hooks
20314
+ var isMobile = useIsMobile();
20315
+ // Handlers
20316
+ var onChangeQuantity = function (quantity) {
20317
+ if (quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.priceList) {
20318
+ setQuotePreviewData({
20319
+ priceList: quotePreviewData.priceList,
20320
+ quantity: calculateNewQuantity(quotePreviewData.priceList, quantity),
20321
+ });
20322
+ }
20323
+ else {
20324
+ console.error("No price list found in quote preview data");
20325
+ }
20326
+ };
20327
+ var onBlurUsers = function (e) {
20328
+ var amount = Number(e.target.value);
20329
+ if (!amount) {
20330
+ onChangeQuantity(1);
20331
+ }
20332
+ };
20333
+ // Quantity debounce
20334
+ // eslint-disable-next-line
20335
+ var quoteChangeDebounce = useCallback(lodashExports.debounce(function (newQuantity) { return __awaiter(void 0, void 0, void 0, function () {
20336
+ return __generator(this, function (_a) {
20337
+ onChangeQuantity(newQuantity);
20338
+ return [2 /*return*/];
20035
20339
  });
20340
+ }); }, 1000), []);
20341
+ useEffect(function () {
20342
+ setTimeout(function () {
20343
+ setIsTooltipOpen(true);
20344
+ }, 1000);
20345
+ setTimeout(function () {
20346
+ setIsTooltipOpen(false);
20347
+ }, 6000);
20348
+ }, []);
20349
+ if (!(charge === null || charge === void 0 ? void 0 : charge.feature))
20350
+ return null;
20351
+ return (jsxs("div", __assign({ className: "flex items-center gap-2 ".concat(isMobile ? "justify-between" : "") }, { children: [jsx(QuantityLabel, { activeCharge: charge }), jsx(Tooltip, __assign({ onOpenChange: setIsTooltipOpen, open: isTooltipOpen, title: "Change quantity here", styles: {
20352
+ body: {
20353
+ paddingTop: "0.75rem",
20354
+ paddingBottom: "0.75rem",
20355
+ },
20356
+ } }, { children: jsx(Input, { className: isMobile ? "text-right" : "", disabled: !selectedPriceList || !charge.selfServiceQuantity, onBlur: onBlurUsers, onChange: function (e) {
20357
+ var quantity = Number(e.target.value);
20358
+ setQuantity(quantity);
20359
+ quoteChangeDebounce(quantity);
20360
+ }, 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 }) }))] })));
20361
+ };
20362
+ var QuantityLabel = function (_a) {
20363
+ var _b;
20364
+ var activeCharge = _a.activeCharge;
20365
+ var featureName = (_b = activeCharge.feature) === null || _b === void 0 ? void 0 : _b.name;
20366
+ var pluralizedFeatureName = (StringUtils.isStringPluralized(featureName) || !featureName
20367
+ ? featureName
20368
+ : StringUtils.pluralizeEntityName(featureName)) || "";
20369
+ return (jsx("span", __assign({ className: "text-slate-500 font-medium", style: { fontSize: "11px" } }, { children: pluralizedFeatureName.toUpperCase() })));
20370
+ };
20371
+
20372
+ var periodMonthsConverter = function (period) {
20373
+ if (period === 0)
20374
+ return BillingPeriod.ONCE;
20375
+ else if (period === 1)
20376
+ return BillingPeriod.MONTHLY;
20377
+ else if (period === 3)
20378
+ return BillingPeriod.QUARTERLY;
20379
+ else if (period === 6)
20380
+ return BillingPeriod.SEMI_ANNUALLY;
20381
+ else
20382
+ return BillingPeriod.ANNUALLY;
20383
+ };
20384
+ var billingPeriodConverter = function (period) {
20385
+ if (period === BillingPeriod.ONCE)
20386
+ return 0;
20387
+ else if (period === BillingPeriod.MONTHLY)
20388
+ return 1;
20389
+ else if (period === BillingPeriod.QUARTERLY)
20390
+ return 3;
20391
+ else if (period === BillingPeriod.SEMI_ANNUALLY)
20392
+ return 6;
20393
+ else
20394
+ return 12;
20395
+ };
20396
+
20397
+ var removeHTMLTagsRegex = /<br>(?=(?:\s*<[^>]*>)*$)|(<br>)|<[^>]*>/gi;
20398
+ // Description is a string that can contain HTML tags. We want to remove all HTML tags except <br> tags.
20399
+ var createPlanDescription = function (plan) {
20400
+ return (plan.description || "").replace(removeHTMLTagsRegex, function (x, y) {
20401
+ return y ? " & " : "";
20402
+ });
20403
+ };
20404
+ var getActivePlanPriceData = function (plan, selectedPriceList) {
20405
+ if (!plan) {
20406
+ return;
20036
20407
  }
20037
- function handlePaymentFail(error) {
20038
- showErrorNotification(error.response.message);
20408
+ // If a period option is selected, return the charge that matches the selected period option
20409
+ var activeBillingPLCharge;
20410
+ // Default to first price list charge
20411
+ var lowestPLCharge;
20412
+ // Find the lowest price list charge with a billing period that matches the selected period option
20413
+ for (var i = 0; i < plan.priceLists.length; i++) {
20414
+ var priceList = plan.priceLists[i];
20415
+ if (priceList.id === (selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id)) {
20416
+ activeBillingPLCharge = priceList.charges[0];
20417
+ break;
20418
+ }
20419
+ for (var j = 0; j < priceList.charges.length; j++) {
20420
+ var charge = priceList.charges[j];
20421
+ if (charge.chargeType === ChargeType.USAGE)
20422
+ continue;
20423
+ if (activeBillingPLCharge) {
20424
+ // If we already found a charge with the same billing period check if this charge is lower
20425
+ if (charge.basePrice < activeBillingPLCharge.basePrice &&
20426
+ charge.billingPeriod === (activeBillingPLCharge === null || activeBillingPLCharge === void 0 ? void 0 : activeBillingPLCharge.billingPeriod)) {
20427
+ activeBillingPLCharge = charge;
20428
+ }
20429
+ }
20430
+ // If a period option is selected, only return the charge if it matches the selected period option
20431
+ else if (selectedPriceList &&
20432
+ charge.billingPeriod ===
20433
+ periodMonthsConverter(selectedPriceList.periodMonths)) {
20434
+ activeBillingPLCharge = charge;
20435
+ }
20436
+ // Otherwise, return the lowest price list charge
20437
+ else if (charge.basePrice < ((lowestPLCharge === null || lowestPLCharge === void 0 ? void 0 : lowestPLCharge.basePrice) || -1)) {
20438
+ lowestPLCharge = charge;
20439
+ }
20440
+ }
20039
20441
  }
20040
- var WrapperComponent = function (_a) {
20041
- var children = _a.children, className = _a.className, style = _a.style;
20042
- return isCardEnabled ? (jsx(Card, __assign({ className: className, style: style }, { children: children }))) : (jsx("div", __assign({ className: className, style: style }, { children: children })));
20442
+ return {
20443
+ activeCharge: activeBillingPLCharge || lowestPLCharge,
20444
+ };
20445
+ };
20446
+ var isPriceListDisabled = function (_a) {
20447
+ var priceList = _a.priceList, subscriptions = _a.subscriptions, upgradingSubscription = _a.upgradingSubscription;
20448
+ var disableOnClick = false;
20449
+ // Plan already has a subscription
20450
+ var subscriptionPlan = subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.find(function (subscription) {
20451
+ var _a, _b;
20452
+ return subscription.plan.id === priceList.plan.id &&
20453
+ ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) !== SubscriptionState$2.CANCELED &&
20454
+ ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) !== SubscriptionState$2.EXPIRED;
20455
+ });
20456
+ var isPriceListCurrentSubscription = (upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.priceList.id) === priceList.id;
20457
+ // Is this plan the one that the user is upgrading from
20458
+ var isUpgradingPlan = (upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.plan.id) === priceList.plan.id;
20459
+ if ((subscriptionPlan && !isUpgradingPlan) ||
20460
+ isPriceListCurrentSubscription) {
20461
+ disableOnClick = true;
20462
+ }
20463
+ return disableOnClick;
20464
+ };
20465
+
20466
+ var CheckoutButton = function (_a) {
20467
+ var checkoutButtonDisabled = _a.checkoutButtonDisabled, onClickCheckout = _a.onClickCheckout, loading = _a.loading;
20468
+ var isMobile = useIsMobile();
20469
+ return (jsx(Button, __assign({ className: isMobile ? "w-full" : "", disabled: checkoutButtonDisabled, onClick: onClickCheckout, size: isMobile ? "large" : "middle", type: "primary", loading: loading }, { children: "Proceed to checkout" })));
20470
+ };
20471
+
20472
+ var CheckoutPrice = function (_a) {
20473
+ var isUsage = _a.isUsage, quote = _a.quote, selectedPriceList = _a.selectedPriceList;
20474
+ var isMobile = useIsMobile();
20475
+ if (!isUsage && (!selectedPriceList || (quote === null || quote === void 0 ? void 0 : quote.periodAmount) === undefined))
20476
+ return null;
20477
+ return (jsx("div", __assign({ className: "font-medium ".concat(isMobile ? "text-2xl" : "") }, { children: isUsage
20478
+ ? "Usage based pricing"
20479
+ : selectedPriceList && (quote === null || quote === void 0 ? void 0 : quote.periodAmount) !== undefined
20480
+ ? "".concat(formatCurrency(quote.periodAmount, selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.currencyId, 0), " / ").concat(PERIOD_LABELS[periodMonthsConverter(selectedPriceList.periodMonths)])
20481
+ : "" })));
20482
+ };
20483
+
20484
+ var CheckoutBarSummarySection = function (_a) {
20485
+ var _b, _c;
20486
+ var open = _a.open, quantityLocal = _a.quantityLocal, quote = _a.quote, selectedPriceList = _a.selectedPriceList, onClickCheckout = _a.onClickCheckout, entityId = _a.entityId, upgradingSubscription = _a.upgradingSubscription, quotePreviewData = _a.quotePreviewData;
20487
+ // Context
20488
+ var apiHost = useContext(BunnyContext).apiHost;
20489
+ // Hooks
20490
+ var token = useToken();
20491
+ var paymentMethodAllowedPlugins = usePaymentPlugins({
20492
+ entityId: entityId,
20493
+ apiHost: apiHost,
20494
+ token: token,
20495
+ }).paymentMethodAllowedPlugins;
20496
+ var queryClient = useQueryClient();
20497
+ var isMobile = useIsMobile();
20498
+ // Derived state
20499
+ var isFetching = queryClient.isFetching({
20500
+ queryKey: QueryKeyFactory.default.planChangeOptionsKey({
20501
+ subscriptionId: upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id,
20502
+ token: token,
20503
+ }),
20504
+ });
20505
+ var checkoutButtonDisabled = Boolean(!(quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.quantity) ||
20506
+ !selectedPriceList ||
20507
+ quantityLocal !== quotePreviewData.quantity ||
20508
+ isFetching ||
20509
+ selectedPriceList.id === (upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.priceList.id) ||
20510
+ open);
20511
+ var planChangeOptions = queryClient.getQueryData(QueryKeyFactory.default.planChangeOptionsKey({
20512
+ subscriptionId: upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id,
20513
+ token: token,
20514
+ }));
20515
+ var selectedPlan = (_b = planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.plans) === null || _b === void 0 ? void 0 : _b.find(function (plan) { return plan.id === (selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.plan.id); });
20516
+ var activeCharge = (_c = getActivePlanPriceData(selectedPlan, selectedPriceList)) === null || _c === void 0 ? void 0 : _c.activeCharge;
20517
+ var isUsage = (activeCharge === null || activeCharge === void 0 ? void 0 : activeCharge.chargeType) === ChargeType.USAGE;
20518
+ var hasPaymentMethodsOrIsFree = Boolean(paymentMethodAllowedPlugins === null || paymentMethodAllowedPlugins === void 0 ? void 0 : paymentMethodAllowedPlugins.length) ||
20519
+ Boolean(quote && getQuoteAmountDue(quote) === 0);
20520
+ return (jsxs("div", __assign({ className: "flex items-center gap-4 ".concat(isMobile ? "flex-col" : "") }, { children: [quote && (jsxs("div", __assign({ className: "flex ".concat(isMobile ? "items-center justify-between w-full" : "flex-col") }, { children: [jsx("div", __assign({ className: "text-slate-500 font-medium text-right", style: { fontSize: "11px" } }, { children: "TOTAL" })), jsx(CheckoutPrice, { isUsage: isUsage, quote: quote, selectedPriceList: selectedPriceList })] }))), hasPaymentMethodsOrIsFree && (jsx(CheckoutButton, { checkoutButtonDisabled: checkoutButtonDisabled, onClickCheckout: onClickCheckout, loading: !quote }))] })));
20521
+ };
20522
+
20523
+ var PlanPickerCheckoutBarWrapper = function (_a) {
20524
+ var handlePortalErrors = _a.handlePortalErrors, onCheckoutSuccess = _a.onCheckoutSuccess;
20525
+ // Context
20526
+ var quotePreviewData = useContext(SubscriptionsContext).quotePreviewData;
20527
+ var selectedPriceList = quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.priceList;
20528
+ if (!selectedPriceList)
20529
+ return null;
20530
+ return (jsx(PlanPickerCheckoutBar, { handlePortalErrors: handlePortalErrors, selectedPriceList: selectedPriceList, onCheckoutSuccess: onCheckoutSuccess }));
20531
+ };
20532
+ var PlanPickerCheckoutBar = function (_a) {
20533
+ var _b;
20534
+ var selectedPriceList = _a.selectedPriceList, handlePortalErrors = _a.handlePortalErrors, onCheckoutSuccess = _a.onCheckoutSuccess;
20535
+ // Context
20536
+ var token = useToken();
20537
+ var _c = useContext(SubscriptionsContext), entityId = _c.entityId, quotePreviewData = _c.quotePreviewData, upgradingSubscription = _c.upgradingSubscription, shadow = _c.shadow;
20538
+ var _d = useContext(BunnyContext), apiHost = _d.apiHost, graphQLClient = _d.graphQLClient;
20539
+ // Local state
20540
+ var _e = useState(0), quantityLocal = _e[0], setQuantity = _e[1];
20541
+ var _f = useState(0), prevQuantity = _f[0], setPrevQuantity = _f[1];
20542
+ var _g = useState(false), payModalVisible = _g[0], setPayModalVisible = _g[1];
20543
+ // Hooks
20544
+ var showSuccessNotification = useSuccessNotification();
20545
+ var queryClient = useQueryClient();
20546
+ var isMobile = useIsMobile();
20547
+ var storedPaymentMethod = usePaymentMethod({
20548
+ graphQLClient: graphQLClient,
20549
+ token: token,
20550
+ }).data;
20551
+ // Quote ID ref
20552
+ var quoteIdRef = useRef();
20553
+ // Queries
20554
+ var _h = useQuery({
20555
+ queryKey: QueryKeyFactory.default.calculatedPricesKey({
20556
+ quantity: (quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.quantity) || 0,
20557
+ priceListId: selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id,
20558
+ token: token,
20559
+ }),
20560
+ queryFn: function () { return __awaiter(void 0, void 0, void 0, function () {
20561
+ var quote;
20562
+ var _a;
20563
+ return __generator(this, function (_b) {
20564
+ switch (_b.label) {
20565
+ case 0: return [4 /*yield*/, quoteCompose({
20566
+ priceListId: (_a = quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.priceList) === null || _a === void 0 ? void 0 : _a.id,
20567
+ quantity: quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.quantity,
20568
+ quoteId: quoteIdRef.current,
20569
+ subscriptionId: upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id,
20570
+ token: token,
20571
+ apiHost: apiHost,
20572
+ })];
20573
+ case 1:
20574
+ quote = _b.sent();
20575
+ quoteIdRef.current = quote === null || quote === void 0 ? void 0 : quote.id;
20576
+ return [2 /*return*/, quote];
20577
+ }
20578
+ });
20579
+ }); },
20580
+ // 'enabled' is commented out for HACKY FIX
20581
+ // enabled: Boolean(
20582
+ // quotePreviewData?.priceList?.id &&
20583
+ // selectedPriceList &&
20584
+ // selectedPriceList.id !== upgradingSubscription?.priceList.id
20585
+ // ),
20586
+ enabled: false,
20587
+ placeholderData: keepPreviousData,
20588
+ }), quote = _h.data, refetch = _h.refetch;
20589
+ // TODO: eventually solve this hacky fix
20590
+ // THIS IS NOT OKAY (we couldn't find any other solution on short notice)
20591
+ // HACKY FIX START
20592
+ // Essentially this useEffect is doing the work useQuery is supposed to do, but isn't doing properly.
20593
+ useEffect(function () {
20594
+ var _a;
20595
+ if (((_a = quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.priceList) === null || _a === void 0 ? void 0 : _a.id) &&
20596
+ selectedPriceList &&
20597
+ selectedPriceList.id !== (upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.priceList.id)) {
20598
+ refetch();
20599
+ }
20600
+ }, [
20601
+ (_b = quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.priceList) === null || _b === void 0 ? void 0 : _b.id,
20602
+ quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.quantity,
20603
+ refetch,
20604
+ selectedPriceList,
20605
+ selectedPriceList.id,
20606
+ upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.priceList.id,
20607
+ ]);
20608
+ // HACKY FIX END
20609
+ var handleCheckoutSuccess = function () {
20610
+ queryClient.invalidateQueries({
20611
+ queryKey: QueryKeyFactory.default.createTableKey({
20612
+ filterString: "entityId=".concat(entityId),
20613
+ pluralType: "subscriptions",
20614
+ token: token,
20615
+ }),
20616
+ });
20617
+ queryClient.invalidateQueries({
20618
+ queryKey: QueryKeyFactory.default.transactionsKey({ token: token }),
20619
+ });
20620
+ setPayModalVisible(false);
20621
+ showSuccessNotification("Your subscription has been created", "Checkout successful");
20622
+ onCheckoutSuccess();
20043
20623
  };
20044
- return (jsx(WrapperComponent, __assign({ className: "p-4 flex flex-col ".concat(shadow, " ").concat(className), style: style }, { children: purchaseSucceeded ? (jsx(Fragment, { children: (quote === null || quote === void 0 ? void 0 : quote.currencyId) !== undefined ? (jsx(PaymentSuccessDisplay, { amountPaid: (quote === null || quote === void 0 ? void 0 : quote.amountDue) || 0, className: "w-full", companyName: companyName, returnUrl: returnUrl, currencyId: quote === null || quote === void 0 ? void 0 : quote.currencyId })) : (jsx("div", { children: "No currency ID found from Quote" })) })) : (jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col" : "flex-row", " h-full w-full") }, { children: [jsx("div", __assign({ className: "flex flex-col ".concat(isMobile ? "items-center" : "w-1/2 items-center") }, { children: jsx(PriceListDisplay, { priceListData: priceListData, topNavImageUrl: topNavImageUrl }) })), jsx("div", __assign({ className: "".concat(isMobile ? "h-full" : "my-4") }, { children: jsx(Divider, { className: "h-full", type: isMobile ? undefined : "vertical" }) })), jsx("div", __assign({ className: "flex ".concat(isMobile
20045
- ? "items-center justify-center my-12"
20046
- : "w-1/2 items-center justify-center my-12") }, { children: jsx("div", __assign({ className: "".concat(isMobile ? "w-full" : "w-1/2") }, { children: jsx(PaymentForms, { entityId: entityId, quote: quote, handlePaymentSuccess: handlePaymentSuccess, handlePaymentFail: handlePaymentFail, handleSubmit: handleSubmit, proceedingToPayment: proceedingToPayment, accountId: accountId, overrideToken: portalSessionToken, customCheckoutFunction: accountSignupFunction }) })) }))] }))) })));
20047
- }
20624
+ var onCheckoutFail = function (error) {
20625
+ handlePortalErrors(error);
20626
+ };
20627
+ // Set quantity from quote preview data
20628
+ useEffect(function () {
20629
+ if ((quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.quantity) &&
20630
+ prevQuantity !== quotePreviewData.quantity) {
20631
+ setQuantity(quotePreviewData.quantity);
20632
+ setPrevQuantity(quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.quantity);
20633
+ }
20634
+ }, [
20635
+ prevQuantity,
20636
+ quantityLocal,
20637
+ quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.quantity,
20638
+ setPrevQuantity,
20639
+ setQuantity,
20640
+ ]);
20641
+ // Reset query key on unmount
20642
+ useEffect(function () {
20643
+ return function () {
20644
+ queryClient.invalidateQueries({
20645
+ queryKey: QueryKeyFactory.default.calculatedPricesKey({
20646
+ priceListId: selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id,
20647
+ quantity: (quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.quantity) || 0,
20648
+ token: token,
20649
+ }),
20650
+ });
20651
+ };
20652
+ }, [queryClient, selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id, quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.quantity, token]);
20653
+ return (jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col gap-4" : "flex-row", " my-2 p-4 justify-between bg-white rounded-md ").concat(shadow ? "shadow-".concat(shadow) : "") }, { children: [jsx("div", __assign({ className: "".concat(isMobile ? "flex flex-col" : "flex", " gap-4") }, { children: selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.charges.map(function (charge, index) {
20654
+ return (jsx(CheckoutBarInput, { charge: charge, quantity: quantityLocal || 0, selectedPriceList: selectedPriceList, setQuantity: setQuantity }, index));
20655
+ }) })), jsx(CheckoutBarSummarySection, { onClickCheckout: function () { return setPayModalVisible(true); }, open: payModalVisible, quantityLocal: quantityLocal, quote: quote, selectedPriceList: selectedPriceList, entityId: entityId, upgradingSubscription: upgradingSubscription, quotePreviewData: quotePreviewData }), jsx(Checkout, { entityId: entityId, isMobile: isMobile, onCancel: function () { return setPayModalVisible(false); }, onFail: onCheckoutFail, onSuccess: handleCheckoutSuccess, open: payModalVisible, quantity: quantityLocal, quote: quote, selectedPriceList: selectedPriceList, storedPaymentMethod: storedPaymentMethod, token: token })] })));
20656
+ };
20048
20657
 
20049
20658
  // WARNING: There is a preview button on APP that will need to be changed if this query is changed
20050
20659
  var PLAN_CHANGE_OPTIONS_QUERY = "\n query planChangeOptions($subscriptionId: ID) {\n planChangeOptions(subscriptionId: $subscriptionId) {\n products {\n everythingInPlus\n id\n name\n features(sort: \"position asc\") {\n description\n id\n isVisible\n kind\n name\n position\n }\n }\n plans {\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 priceLists {\n basePrice\n id\n currencyId\n periodMonths\n plan {\n id\n position\n }\n product {\n id\n }\n charges {\n basePrice\n billingPeriod\n chargeType\n id\n name\n priceDecimals\n pricingModel\n quantityMax\n quantityMin\n selfServiceQuantity\n feature {\n name\n unitName\n }\n }\n }\n productId\n }\n }\n }";
@@ -20073,40 +20682,786 @@ var getPlanChangeOptions = function (_a) {
20073
20682
  return [2 /*return*/, planChangeOptions];
20074
20683
  }
20075
20684
  });
20076
- });
20685
+ });
20686
+ };
20687
+
20688
+ var portalPreviewQuery = function (id) { return "\nquery portalPreviewQuery {\n product(id: ".concat(id, ") {\n everythingInPlus\n id\n name\n features(sort: \"position asc\") {\n description\n id\n isVisible\n kind\n name\n position\n }\n }\n plans(filter: \"plan.productId is ").concat(id, "\") {\n nodes {\n\t\t\tcode\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 priceLists {\n basePrice\n id\n currencyId\n periodMonths\n plan {\n id\n position\n }\n product {\n id\n }\n charges {\n basePrice\n billingPeriod\n chargeType\n id\n name\n priceDecimals\n pricingModel\n quantityMax\n quantityMin\n selfServiceQuantity\n feature {\n name\n unitName\n }\n }\n }\n }\n }\n}"); };
20689
+ var getPortalPreviewData = function (id, apiHost, token) { return __awaiter(void 0, void 0, void 0, function () {
20690
+ var response;
20691
+ return __generator(this, function (_a) {
20692
+ switch (_a.label) {
20693
+ case 0: return [4 /*yield*/, gqlRequest({
20694
+ isInPreviewMode: true,
20695
+ query: portalPreviewQuery(id),
20696
+ token: token || "",
20697
+ apiHost: apiHost,
20698
+ })];
20699
+ case 1:
20700
+ response = _a.sent();
20701
+ if (response.product && response.plans) {
20702
+ response.plans = response.plans.nodes;
20703
+ response.products = [response.product];
20704
+ delete response.product;
20705
+ // Sort plans by position
20706
+ if (response.plans) {
20707
+ response.plans.sort(function (a, b) { return a.position - b.position; });
20708
+ }
20709
+ return [2 /*return*/, response];
20710
+ }
20711
+ else
20712
+ throw response;
20713
+ }
20714
+ });
20715
+ }); };
20716
+
20717
+ var ErrorView = function (_a) {
20718
+ var children = _a.children, message = _a.message;
20719
+ return (jsxs("div", __assign({ className: "flex flex-col w-full", style: { marginTop: "80px" } }, { children: [jsx("div", __assign({ style: { fontSize: "32px" } }, { children: message })), children] })));
20720
+ };
20721
+
20722
+ var BillingPeriodSelector = function (_a) {
20723
+ var availableBillingPeriods = _a.availableBillingPeriods, onChangeBillingPeriod = _a.onChangeBillingPeriod, products = _a.products, selectedBillingPeriod = _a.selectedBillingPeriod, selectedProduct = _a.selectedProduct, onChangeProduct = _a.onChangeProduct;
20724
+ var _b = useContext(BrandContext), secondaryColor = _b.secondaryColor, brandColor = _b.brandColor;
20725
+ var isMobile = useIsMobile();
20726
+ if (!availableBillingPeriods || (availableBillingPeriods === null || availableBillingPeriods === void 0 ? void 0 : availableBillingPeriods.length) < 2)
20727
+ return null;
20728
+ return (jsxs("div", __assign({ className: "flex items-center gap-8 pb-6" }, { children: [(products === null || products === void 0 ? void 0 : products.length) && products.length > 1 && (jsxs("div", __assign({ className: "flex flex-col gap-2" }, { children: [jsx("div", __assign({ className: "font-medium text-xs", style: {
20729
+ color: secondaryColor,
20730
+ } }, { children: "Select product" })), jsx(ProductRadioStyled, __assign({ brandColor: brandColor }, { children: jsx(Radio.Group, __assign({ onChange: function (e) {
20731
+ onChangeProduct(products === null || products === void 0 ? void 0 : products.find(function (product) { return product.id === e.target.value; }));
20732
+ }, value: selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.id, buttonStyle: "solid" }, { children: jsx(Space, __assign({ className: "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: "flex flex-col w-full gap-2" }, { children: [!isMobile && (jsx("div", __assign({ className: "font-medium text-xs", style: {
20733
+ color: secondaryColor,
20734
+ } }, { children: "Subscription term" }))), jsx(StyledRadioGroup, __assign({ className: "w-full", "$isMobile": isMobile }, { children: jsx(Radio.Group, __assign({ onChange: function (e) {
20735
+ onChangeBillingPeriod(e.target.value);
20736
+ }, value: selectedBillingPeriod, size: "small", buttonStyle: "solid" }, { children: availableBillingPeriods === null || availableBillingPeriods === void 0 ? void 0 : availableBillingPeriods.map(function (periodMonth, index) {
20737
+ return (jsx(Radio.Button, __assign({ value: periodMonthsConverter(periodMonth) }, { children: periodMonthsConverter(periodMonth) }), index));
20738
+ }) })) }))] }))] })));
20739
+ };
20740
+ var ProductRadioStyled = styled.div.withConfig({
20741
+ shouldForwardProp: function (prop) { return !["brandColor"].includes(prop); },
20742
+ })(templateObject_1$4 || (templateObject_1$4 = __makeTemplateObject(["\n .ant-radio-button-wrapper:not(.ant-radio-button-wrapper-checked) {\n border-color: ", " !important;\n color: ", " !important;\n }\n"], ["\n .ant-radio-button-wrapper:not(.ant-radio-button-wrapper-checked) {\n border-color: ", " !important;\n color: ", " !important;\n }\n"])), function (props) {
20743
+ return props.brandColor ? props.brandColor : "black";
20744
+ }, function (props) {
20745
+ return props.brandColor ? props.brandColor : "black";
20746
+ });
20747
+ var StyledRadioGroup = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n .ant-radio-group {\n display: flex !important;\n align-items: center !important;\n padding: 4px !important;\n background-color: ", " !important;\n border-radius: 6px !important;\n width: ", " !important;\n border: none !important;\n }\n .ant-radio-button-wrapper {\n flex-grow: 1 !important;\n z-index: 0 !important;\n display: flex !important;\n align-items: center !important;\n justify-content: center !important;\n border-color: transparent !important;\n border-radius: 4px !important;\n > span {\n font-size: 11px !important;\n }\n }\n .ant-radio-button-wrapper:not(.ant-radio-button-wrapper-checked) {\n background: transparent !important;\n }\n .ant-radio-button-wrapper::before {\n display: none !important;\n }\n"], ["\n .ant-radio-group {\n display: flex !important;\n align-items: center !important;\n padding: 4px !important;\n background-color: ", " !important;\n border-radius: 6px !important;\n width: ", " !important;\n border: none !important;\n }\n .ant-radio-button-wrapper {\n flex-grow: 1 !important;\n z-index: 0 !important;\n display: flex !important;\n align-items: center !important;\n justify-content: center !important;\n border-color: transparent !important;\n border-radius: 4px !important;\n > span {\n font-size: 11px !important;\n }\n }\n .ant-radio-button-wrapper:not(.ant-radio-button-wrapper-checked) {\n background: transparent !important;\n }\n .ant-radio-button-wrapper::before {\n display: none !important;\n }\n"])), GRAY_200, function (_a) {
20748
+ var $isMobile = _a.$isMobile;
20749
+ return $isMobile ? "100%" : "min-content";
20750
+ });
20751
+ var templateObject_1$4, templateObject_2;
20752
+
20753
+ var NextPriceListButton = function (_a) {
20754
+ var availablePriceLists = _a.availablePriceLists, priceListStart = _a.priceListStart, setPriceListStart = _a.setPriceListStart;
20755
+ return (jsxs("div", __assign({ className: "absolute flex gap-1", style: { top: "12px", right: "8px", zIndex: 10 } }, { children: [priceListStart > 0 && (jsx("div", __assign({ className: "flex items-center justify-center rounded-full shadow p-1 cursor-pointer", onClick: function () {
20756
+ setPriceListStart(function (prev) {
20757
+ var newValue = prev - 1;
20758
+ if (newValue < 0) {
20759
+ return prev;
20760
+ }
20761
+ return newValue;
20762
+ });
20763
+ }, style: { width: "22px", height: "22px" } }, { children: jsx(FontAwesomeIcon, { icon: faChevronLeft }) }))), priceListStart < availablePriceLists.length - 3 && (jsx("div", __assign({ className: "flex items-center justify-center rounded-full shadow p-1 cursor-pointer", onClick: function () {
20764
+ return setPriceListStart(function (prev) {
20765
+ var newValue = prev + 1;
20766
+ if (newValue >= availablePriceLists.length) {
20767
+ return prev;
20768
+ }
20769
+ return newValue;
20770
+ });
20771
+ }, style: { width: "22px", height: "22px" } }, { children: jsx(FontAwesomeIcon, { icon: faChevronRight }) })))] })));
20772
+ };
20773
+
20774
+ var getAvailablePlansAndPriceLists = function (_a) {
20775
+ var availablePriceLists = _a.availablePriceLists, planChangeOptions = _a.planChangeOptions, priceListStart = _a.priceListStart;
20776
+ var displayPriceLists = availablePriceLists.slice(priceListStart, priceListStart + 3);
20777
+ var availablePlansArray = displayPriceLists === null || displayPriceLists === void 0 ? void 0 : displayPriceLists.map(function (priceList) {
20778
+ var _a;
20779
+ var plan = (_a = planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.plans) === null || _a === void 0 ? void 0 : _a.find(function (plan) { return plan.id === priceList.plan.id; });
20780
+ return plan;
20781
+ });
20782
+ return {
20783
+ availablePlansArray: availablePlansArray,
20784
+ displayPriceLists: displayPriceLists,
20785
+ };
20786
+ };
20787
+ var everythingInPlusString = function (_a) {
20788
+ var plan = _a.plan;
20789
+ return "Everything in ".concat(plan.name, ", plus");
20790
+ };
20791
+
20792
+ var PLAN_GRID_PADDING = 4;
20793
+ var PlanPickerGridCell = function (_a) {
20794
+ var children = _a.children, noBorder = _a.noBorder;
20795
+ var isMobile = useIsMobile();
20796
+ return (jsxs("div", __assign({ className: "flex flex-col", style: isMobile
20797
+ ? {}
20798
+ : __assign({}, (noBorder ? {} : { borderLeft: "1px solid ".concat(SLATE_200) })) }, { children: [jsx("div", __assign({ className: "grow" }, { children: children })), !isMobile && jsx(Divider, {})] })));
20799
+ };
20800
+
20801
+ var PriceListCardTitle = function (_a) {
20802
+ var plan = _a.plan, isPriceListCurrentSubscription = _a.isPriceListCurrentSubscription, trialRemainingDays = _a.trialRemainingDays;
20803
+ var isMobile = useIsMobile();
20804
+ return (jsxs("div", __assign({ className: "flex flex-col items-center gap-4" }, { children: [Boolean(trialRemainingDays) && (jsx("div", __assign({ className: "font-medium text-secondary", style: { height: "1rem" } }, { children: isPriceListCurrentSubscription
20805
+ ? "Trial ends in ".concat(trialRemainingDays, " day").concat(trialRemainingDays === 1 ? "" : "s")
20806
+ : " " }))), jsx("div", __assign({ className: "font-medium text-center ".concat(isMobile ? "text-slate-500" : "text-orange-600"), style: { fontSize: "20px" } }, { children: plan.name }))] })));
20807
+ };
20808
+
20809
+ var Text$d = Typography.Text;
20810
+ var PriceListCardDescription = function (_a) {
20811
+ var description = _a.description;
20812
+ if (!description)
20813
+ return null;
20814
+ return jsx(Text$d, __assign({ className: "text-center" }, { children: description }));
20815
+ };
20816
+
20817
+ var PriceListCardPrice = function (_a) {
20818
+ var plan = _a.plan, priceList = _a.priceList;
20819
+ return (jsx("div", __assign({ className: "font-medium text-center text-gray-900", style: { fontSize: "32px" } }, { children: !plan.pricingStyle || plan.pricingStyle === PricingStyle.PRICED
20820
+ ? formatCurrency(priceList.basePrice, priceList.currencyId, 0)
20821
+ : plan.pricingStyle === PricingStyle.CONTACT_US
20822
+ ? ""
20823
+ : "Free" })));
20824
+ };
20825
+
20826
+ var Text$c = Typography.Text;
20827
+ var PriceListCardPriceDescription = function (_a) {
20828
+ var feature = _a.feature, plan = _a.plan, priceList = _a.priceList;
20829
+ var isMobile = useIsMobile();
20830
+ var doesPlanHaveFlatFeeCharges = plan.priceLists.some(function (priceList) {
20831
+ return priceList.charges.some(function (charge) {
20832
+ return charge.pricingModel === PricingModel.FLAT && charge.basePrice > 0;
20833
+ });
20834
+ });
20835
+ if (priceList.periodMonths <= 0 || plan.pricingStyle !== PricingStyle.PRICED)
20836
+ return null;
20837
+ return (jsx(Text$c, __assign({ className: "text-center text-gray-900", style: {
20838
+ fontSize: isMobile ? "13px" : "12px",
20839
+ } }, { children: plan.pricingDescription
20840
+ ? plan.pricingDescription
20841
+ : "per ".concat((feature === null || feature === void 0 ? void 0 : feature.unitName) && !doesPlanHaveFlatFeeCharges
20842
+ ? "".concat(feature.unitName.toLowerCase(), " / ")
20843
+ : "").concat(PERIOD_LABELS[periodMonthsConverter(priceList.periodMonths)]) })));
20844
+ };
20845
+
20846
+ var PriceListCardButton = function (_a) {
20847
+ var disableOnClick = _a.disableOnClick, isPriceListCurrentSubscription = _a.isPriceListCurrentSubscription, isSelected = _a.isSelected, plan = _a.plan, subscriptionPlan = _a.subscriptionPlan;
20848
+ // Context
20849
+ var upgradingSubscription = useContext(SubscriptionsContext).upgradingSubscription;
20850
+ var isPriceListNonSubscribedCurrentPlan = (upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.plan.id) === plan.id &&
20851
+ !isPriceListCurrentSubscription;
20852
+ var createButtonText = function () {
20853
+ if (isPriceListCurrentSubscription)
20854
+ return "Current";
20855
+ if (isSelected)
20856
+ return "Selected";
20857
+ if (subscriptionPlan && !isPriceListNonSubscribedCurrentPlan)
20858
+ return "Subscribed";
20859
+ if (plan.pricingStyle === PricingStyle.CONTACT_US)
20860
+ return plan.contactUsLabel;
20861
+ return "Select";
20862
+ };
20863
+ return (jsx("div", __assign({ className: "flex flex-col grow w-full justify-end" }, { children: jsx(StyledCardButton, __assign({ className: "flex justify-center w-full" }, { children: jsx(Button, __assign({ className: "w-full", disabled: disableOnClick, style: {
20864
+ maxWidth: "240px",
20865
+ }, type: isSelected ? "primary" : "default" }, { children: createButtonText() })) })) })));
20866
+ };
20867
+ var StyledCardButton = styled.div(templateObject_1$3 || (templateObject_1$3 = __makeTemplateObject(["\n .ant-btn-primary {\n border-color: transparent !important;\n }\n .ant-btn-primary:disabled {\n background: ", ";\n color: ", ";\n }\n"], ["\n .ant-btn-primary {\n border-color: transparent !important;\n }\n .ant-btn-primary:disabled {\n background: ", ";\n color: ", ";\n }\n"])), SLATE_200, SLATE_600);
20868
+ var templateObject_1$3;
20869
+
20870
+ var PriceListCardDesktop = function (_a) {
20871
+ var description = _a.description, disableOnClick = _a.disableOnClick, feature = _a.feature, isPriceListCurrentSubscription = _a.isPriceListCurrentSubscription, isSelected = _a.isSelected, onClick = _a.onClick, plan = _a.plan, priceList = _a.priceList, subscriptionPlan = _a.subscriptionPlan, trialRemainingDays = _a.trialRemainingDays;
20872
+ return (jsx(PlanPickerGridCell, { children: jsxs("div", __assign({ className: "flex flex-col items-center justify-between w-full rounded-md gap-4 pt-6 px-4 pb-4 ".concat(disableOnClick ? "" : "cursor-pointer"), onClick: function () {
20873
+ if (!disableOnClick) {
20874
+ if (plan.pricingStyle === PricingStyle.CONTACT_US) {
20875
+ window.open(plan.contactUsUrl, "_blank");
20876
+ }
20877
+ else
20878
+ onClick(priceList);
20879
+ }
20880
+ }, style: {
20881
+ height: "100%",
20882
+ maxWidth: "440px",
20883
+ } }, { children: [jsxs("div", __assign({ className: "flex flex-col items-center gap-3" }, { children: [jsxs("div", __assign({ className: "flex flex-col items-center gap-2" }, { children: [jsx(PriceListCardTitle, { isPriceListCurrentSubscription: isPriceListCurrentSubscription, plan: plan, trialRemainingDays: trialRemainingDays }), jsx(PriceListCardDescription, { description: description })] })), jsxs("div", __assign({ className: "flex flex-col items-center gap-2" }, { children: [jsx(PriceListCardPrice, { plan: plan, priceList: priceList }), jsx(PriceListCardPriceDescription, { feature: feature, plan: plan, priceList: priceList })] }))] })), jsx(PriceListCardButton, { disableOnClick: disableOnClick, isPriceListCurrentSubscription: isPriceListCurrentSubscription, isSelected: isSelected, plan: plan, subscriptionPlan: subscriptionPlan })] })) }));
20884
+ };
20885
+
20886
+ var CheckIcon = function (_a) {
20887
+ var backgroundColor = _a.backgroundColor, size = _a.size;
20888
+ return (jsx("div", __assign({ className: "flex items-center justify-center rounded-full shrink-0", style: { width: size, height: size, backgroundColor: backgroundColor } }, { children: jsx("svg", __assign({ width: "8", height: "6", viewBox: "0 0 8 6", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: jsx("path", { d: "M1.5 2.99992L3.16667 4.66659L6.5 1.33325", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })) })));
20889
+ };
20890
+
20891
+ var PriceListCardMobile = function (_a) {
20892
+ var description = _a.description, disableOnClick = _a.disableOnClick, feature = _a.feature, isPriceListCurrentSubscription = _a.isPriceListCurrentSubscription, isSelected = _a.isSelected, onClick = _a.onClick, plan = _a.plan, priceList = _a.priceList, subscriptionPlan = _a.subscriptionPlan, trialRemainingDays = _a.trialRemainingDays;
20893
+ var brandColor = useContext(BrandContext).brandColor;
20894
+ return (jsxs("div", __assign({ className: "relative flex flex-col border-2 border-solid rounded-lg p-4", onClick: function () {
20895
+ if (!disableOnClick)
20896
+ onClick(priceList);
20897
+ }, style: {
20898
+ minWidth: "220px",
20899
+ borderColor: isSelected ? brandColor : SLATE_200,
20900
+ } }, { children: [isSelected && (jsx("div", __assign({ className: "absolute", style: {
20901
+ top: "10px",
20902
+ right: "10px",
20903
+ } }, { children: jsx(CheckIcon, { backgroundColor: brandColor, size: "20px" }) }))), jsxs("div", __assign({ className: "flex flex-col items-center grow gap-2" }, { children: [jsxs("div", __assign({ className: "flex flex-col items-center gap-2" }, { children: [jsx(PriceListCardTitle, { isPriceListCurrentSubscription: isPriceListCurrentSubscription, plan: plan, trialRemainingDays: trialRemainingDays }), jsx(PriceListCardDescription, { description: description })] })), jsxs("div", __assign({ className: "flex flex-col items-center gap-2" }, { children: [jsx(PriceListCardPrice, { plan: plan, priceList: priceList }), jsx(PriceListCardPriceDescription, { feature: feature, plan: plan, priceList: priceList })] })), jsx(PriceListCardButton, { disableOnClick: disableOnClick, isPriceListCurrentSubscription: isPriceListCurrentSubscription, isSelected: isSelected, plan: plan, subscriptionPlan: subscriptionPlan })] }))] })));
20904
+ };
20905
+
20906
+ var PriceListCard = function (_a) {
20907
+ var _b;
20908
+ var isSelected = _a.isSelected, onClick = _a.onClick, plan = _a.plan, priceList = _a.priceList, subscriptions = _a.subscriptions, trialRemainingDays = _a.trialRemainingDays;
20909
+ // Context
20910
+ var upgradingSubscription = useContext(SubscriptionsContext).upgradingSubscription;
20911
+ var isMobile = useIsMobile();
20912
+ if (!plan) {
20913
+ return null;
20914
+ }
20915
+ // Derived state
20916
+ var description = createPlanDescription(plan);
20917
+ // Get the active price list charge for this plan
20918
+ var activeCharge = (_b = getActivePlanPriceData(plan, priceList)) === null || _b === void 0 ? void 0 : _b.activeCharge;
20919
+ // Is the price list the current price list for the upgradingSubscription
20920
+ var isPriceListCurrentSubscription = (upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.priceList.id) === priceList.id;
20921
+ var disableOnClick = isPriceListDisabled({
20922
+ priceList: priceList,
20923
+ subscriptions: subscriptions,
20924
+ upgradingSubscription: upgradingSubscription,
20925
+ });
20926
+ var subscriptionPlan = subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.find(function (subscription) {
20927
+ var _a, _b;
20928
+ return subscription.plan.id === plan.id &&
20929
+ ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) !== SubscriptionState$2.CANCELED &&
20930
+ ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) !== SubscriptionState$2.EXPIRED;
20931
+ });
20932
+ if (!activeCharge) {
20933
+ return null;
20934
+ }
20935
+ var feature = activeCharge.feature;
20936
+ return isMobile ? (jsx(PriceListCardMobile, { description: description, disableOnClick: disableOnClick, feature: feature, isPriceListCurrentSubscription: isPriceListCurrentSubscription, isSelected: isSelected, onClick: onClick, plan: plan, priceList: priceList, trialRemainingDays: trialRemainingDays, subscriptionPlan: subscriptionPlan })) : (jsx(PriceListCardDesktop, { description: description, disableOnClick: disableOnClick, feature: feature, isPriceListCurrentSubscription: isPriceListCurrentSubscription, isSelected: isSelected, onClick: onClick, plan: plan, priceList: priceList, trialRemainingDays: trialRemainingDays, subscriptionPlan: subscriptionPlan }));
20937
+ };
20938
+
20939
+ var PLANS_TO_DISPLAY = 3;
20940
+
20941
+ var Text$b = Typography.Text;
20942
+ var filterUniqueFeatures = function (_a) {
20943
+ // Remove any features that in previous plans if everythingInPlus is true
20944
+ var availablePlansArray = _a.availablePlansArray;
20945
+ var uniqueFeatures = new Set();
20946
+ var updatedPlansArray = availablePlansArray.map(function (plan) {
20947
+ var _a;
20948
+ var updatedPlanFeatures = (_a = plan.planFeatures) === null || _a === void 0 ? void 0 : _a.filter(function (feature) {
20949
+ if (uniqueFeatures.has(feature.featureId)) {
20950
+ return false;
20951
+ }
20952
+ else {
20953
+ uniqueFeatures.add(feature.featureId);
20954
+ return true;
20955
+ }
20956
+ });
20957
+ return __assign(__assign({}, plan), { planFeatures: updatedPlanFeatures });
20958
+ });
20959
+ return updatedPlansArray;
20960
+ };
20961
+ var EverythingPlanFeatures = function (_a) {
20962
+ var availablePlansArray = _a.availablePlansArray, selectedProduct = _a.selectedProduct;
20963
+ var brandColor = useContext(BrandContext).brandColor;
20964
+ var uniquePlanFeatures = filterUniqueFeatures({ availablePlansArray: availablePlansArray });
20965
+ return (jsx(Fragment, { children: __spreadArray([], Array(PLANS_TO_DISPLAY), true).map(function (_, planIndex) {
20966
+ var plan = uniquePlanFeatures[planIndex];
20967
+ var prevPlan = availablePlansArray[planIndex - 1];
20968
+ if (!plan)
20969
+ return (jsx("div", { style: prevPlan ? { borderLeft: "1px solid ".concat(SLATE_200) } : {} }, planIndex));
20970
+ if (!plan.planFeatures)
20971
+ return jsx("div", {}, planIndex);
20972
+ return (jsx("div", __assign({ className: "flex flex-col gap-4 p-4", style: { borderLeft: "1px solid ".concat(SLATE_200) } }, { children: plan.planFeatures.map(function (planFeature, planFeatureIndex) {
20973
+ var everythingInPlus = selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.everythingInPlus;
20974
+ return (jsxs("div", __assign({ className: "contents" }, { children: [prevPlan &&
20975
+ everythingInPlus &&
20976
+ planIndex > 0 &&
20977
+ planFeatureIndex === 0 && (jsx(Text$b, __assign({ className: "font-medium", style: { fontSize: "13px" } }, { children: everythingInPlusString({ plan: prevPlan }) }))), jsxs("div", __assign({ className: "flex gap-1 text-gray-600", style: { fontSize: "13px" } }, { children: [jsx(CheckIcon, { backgroundColor: brandColor, size: "15px" }), jsx(Text$b, { children: planFeature.feature.name })] }))] }), planFeatureIndex));
20978
+ }) }), planIndex));
20979
+ }) }));
20980
+ };
20981
+
20982
+ var shouldColorRow = function (_a) {
20983
+ var isFeatureGroup = _a.isFeatureGroup, rowIndex = _a.rowIndex;
20984
+ return !isFeatureGroup && rowIndex % 2 === 1;
20985
+ };
20986
+ var FeatureGridCell = function (_a) {
20987
+ var children = _a.children, isFeatureGroup = _a.isFeatureGroup, noBorder = _a.noBorder, rowIndex = _a.rowIndex;
20988
+ return (jsx("div", __assign({ className: "px-".concat(PLAN_GRID_PADDING, " py-2"), style: __assign(__assign({}, (noBorder ? {} : { borderLeft: "1px solid ".concat(SLATE_200) })), (shouldColorRow({
20989
+ isFeatureGroup: isFeatureGroup,
20990
+ rowIndex: rowIndex,
20991
+ })
20992
+ ? { backgroundColor: SLATE_100 }
20993
+ : {})) }, { children: children })));
20994
+ };
20995
+
20996
+ var Text$a = Typography.Text;
20997
+ var PlanFeatures = function (_a) {
20998
+ var _b;
20999
+ var availablePlansArray = _a.availablePlansArray, plans = _a.plans, selectedProduct = _a.selectedProduct;
21000
+ var featureGroupCounter = useRef(0);
21001
+ var visibleFeatureCounter = useRef(1);
21002
+ var brandColor = useContext(BrandContext).brandColor;
21003
+ if (!plans)
21004
+ return null;
21005
+ return (jsx(Fragment, { children: (_b = selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.features) === null || _b === void 0 ? void 0 : _b.map(function (feature, featureIndex) {
21006
+ if (!selectedProduct.features)
21007
+ return null;
21008
+ var isFeatureGroup = (feature === null || feature === void 0 ? void 0 : feature.kind) === "GROUP";
21009
+ if (!feature.isVisible)
21010
+ return null;
21011
+ // Initialize the feature group counter and the visible feature counter
21012
+ if (featureIndex === 0) {
21013
+ featureGroupCounter.current = 0;
21014
+ visibleFeatureCounter.current = 1;
21015
+ }
21016
+ var rowIndex = visibleFeatureCounter.current;
21017
+ // Increment the feature group counter if the feature is a group
21018
+ if (isFeatureGroup) {
21019
+ if (rowIndex % 2 === 1)
21020
+ featureGroupCounter.current = featureGroupCounter.current + 1;
21021
+ }
21022
+ // Increment the row index by the feature group counter
21023
+ rowIndex = rowIndex + featureGroupCounter.current;
21024
+ // Increment the visible feature counter
21025
+ visibleFeatureCounter.current = visibleFeatureCounter.current + 1;
21026
+ return (jsxs("div", __assign({ className: "contents" }, { children: [jsx(FeatureGridCell, __assign({ isFeatureGroup: isFeatureGroup, noBorder: true, rowIndex: rowIndex }, { children: jsx(FeatureTitle, { isFeatureGroup: isFeatureGroup, feature: feature }) })), __spreadArray([], Array(PLANS_TO_DISPLAY), true).map(function (_, columnIndex) {
21027
+ var _a;
21028
+ var plan = availablePlansArray[columnIndex];
21029
+ var doesHavePrevPlan = availablePlansArray[columnIndex - 1];
21030
+ columnIndex = columnIndex + 1;
21031
+ // Check if the plan has the feature
21032
+ var planFeature = (_a = plan === null || plan === void 0 ? void 0 : plan.planFeatures) === null || _a === void 0 ? void 0 : _a.find(function (f) { return f.featureId === (feature === null || feature === void 0 ? void 0 : feature.id); });
21033
+ if (!plan)
21034
+ return (jsx(FeatureGridCell, { rowIndex: rowIndex, noBorder: !Boolean(doesHavePrevPlan) }, columnIndex));
21035
+ if (isFeatureGroup)
21036
+ return (jsx(FeatureGridCell, { isFeatureGroup: true, rowIndex: rowIndex }, columnIndex));
21037
+ return (jsx(FeatureGridCell, __assign({ rowIndex: rowIndex }, { children: jsx("div", __assign({ className: "flex justify-center text-center" }, { children: planFeature ? ((planFeature === null || planFeature === void 0 ? void 0 : planFeature.value) ? (planFeature.value) : (jsx(CheckIcon, { backgroundColor: brandColor, size: "15px" }))) : (jsx(Text$a, __assign({ className: "text-gray" }, { children: "-" }))) })) }), columnIndex));
21038
+ })] }), rowIndex));
21039
+ }) }));
21040
+ };
21041
+ var FeatureTitle = function (_a) {
21042
+ var _b;
21043
+ var isFeatureGroup = _a.isFeatureGroup, feature = _a.feature;
21044
+ return (jsx(Text$a, __assign({ className: " ".concat(isFeatureGroup ? "text-slate-500 font-medium 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 })));
21045
+ };
21046
+
21047
+ var PriceListGridDesktop = function (_a) {
21048
+ var availablePriceLists = _a.availablePriceLists, onChangePriceList = _a.onChangePriceList, planChangeOptions = _a.planChangeOptions, priceListStart = _a.priceListStart, selectedPlan = _a.selectedPlan, selectedProduct = _a.selectedProduct, setPriceListStart = _a.setPriceListStart, subscriptions = _a.subscriptions, trialRemainingDays = _a.trialRemainingDays;
21049
+ // Context
21050
+ var shadow = useContext(SubscriptionsContext).shadow;
21051
+ var _b = useMemo(function () {
21052
+ return getAvailablePlansAndPriceLists({
21053
+ availablePriceLists: availablePriceLists,
21054
+ planChangeOptions: planChangeOptions,
21055
+ priceListStart: priceListStart,
21056
+ });
21057
+ }, [availablePriceLists, planChangeOptions, priceListStart]), availablePlansArray = _b.availablePlansArray, displayPriceLists = _b.displayPriceLists;
21058
+ var everythingInPlus = selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.everythingInPlus;
21059
+ return (jsx("div", __assign({ className: "" }, { children: jsxs("div", __assign({ className: "relative flex flex-col h-full rounded-md overflow-hidden bg-white ".concat(shadow ? "shadow-".concat(shadow) : "") }, { children: [jsx(NextPriceListButton, { availablePriceLists: availablePriceLists, priceListStart: priceListStart, setPriceListStart: setPriceListStart }), jsxs("div", __assign({ className: "grid w-full", style: {
21060
+ gridTemplateColumns: everythingInPlus
21061
+ ? "repeat(3, minmax(120px, 1fr))"
21062
+ : "minmax(auto, 400px) repeat(3, minmax(120px, 1fr))",
21063
+ } }, { children: [!everythingInPlus && jsx(PlanPickerGridCell, { noBorder: true }), __spreadArray([], Array(PLANS_TO_DISPLAY), true).map(function (_, index) {
21064
+ var _a;
21065
+ var priceList = displayPriceLists[index];
21066
+ var doesPrevPriceListExist = displayPriceLists[index - 1];
21067
+ if (!priceList)
21068
+ return (jsx(PlanPickerGridCell, { noBorder: !Boolean(doesPrevPriceListExist) }, index));
21069
+ var plan = (_a = planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.plans) === null || _a === void 0 ? void 0 : _a.find(function (plan) { return plan.id === priceList.plan.id; });
21070
+ return (jsx(PriceListCard, { isSelected: priceList.plan.id === (selectedPlan === null || selectedPlan === void 0 ? void 0 : selectedPlan.id), onClick: onChangePriceList, plan: plan, priceList: priceList, subscriptions: subscriptions, trialRemainingDays: trialRemainingDays }, index));
21071
+ }), (selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.everythingInPlus) ? (jsx(EverythingPlanFeatures, { availablePlansArray: availablePlansArray, selectedProduct: selectedProduct })) : (jsx(PlanFeatures, { availablePlansArray: availablePlansArray, plans: planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.plans, selectedProduct: selectedProduct }))] }))] })) })));
21072
+ };
21073
+
21074
+ var Text$9 = Typography.Text;
21075
+ var PriceListCardFeature = function (_a) {
21076
+ var feature = _a.feature, index = _a.index;
21077
+ var brandColor = useContext(BrandContext).brandColor;
21078
+ if (feature.kind === "GROUP")
21079
+ return jsx(Text$9, __assign({ className: "font-medium base-text" }, { children: feature.name }));
21080
+ return (jsxs("div", __assign({ className: "flex items-center gap-2" }, { children: [jsx(CheckIcon, { backgroundColor: brandColor, size: "15px" }), jsx(Text$9, __assign({ className: "text-gray-600" }, { children: feature.name }))] }), index));
21081
+ };
21082
+
21083
+ var Text$8 = Typography.Text;
21084
+ var PriceListGridMobile = function (_a) {
21085
+ var _b, _c, _d;
21086
+ var availablePriceLists = _a.availablePriceLists, onChangePriceList = _a.onChangePriceList, planChangeOptions = _a.planChangeOptions, selectedPlan = _a.selectedPlan, selectedProduct = _a.selectedProduct, subscriptions = _a.subscriptions, trialRemainingDays = _a.trialRemainingDays;
21087
+ var everythingInPlus = selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.everythingInPlus;
21088
+ var prevPriceListIndex = availablePriceLists.findIndex(function (priceList) { return priceList.plan.id === (selectedPlan === null || selectedPlan === void 0 ? void 0 : selectedPlan.id); });
21089
+ var prevPlanId = (_b = availablePriceLists[prevPriceListIndex - 1]) === null || _b === void 0 ? void 0 : _b.plan.id;
21090
+ var prevPlan = (_c = planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.plans) === null || _c === void 0 ? void 0 : _c.find(function (plan) { return plan.id === prevPlanId; });
21091
+ return (jsxs(Fragment, { children: [jsx("div", __assign({ className: "flex gap-4 overflow-auto shadow-padding-xb", style: { flexShrink: 0 } }, { children: availablePriceLists.map(function (priceList, index) {
21092
+ var _a;
21093
+ var plan = (_a = planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.plans) === null || _a === void 0 ? void 0 : _a.find(function (plan) { return plan.id === priceList.plan.id; });
21094
+ return (jsx(PriceListCard, { isSelected: priceList.plan.id === (selectedPlan === null || selectedPlan === void 0 ? void 0 : selectedPlan.id), onClick: onChangePriceList, plan: plan, priceList: priceList, subscriptions: subscriptions, trialRemainingDays: trialRemainingDays }, index));
21095
+ }) })), jsx(Text$8, __assign({ className: "text-slate-500 pt-5 pb-4 shadow-padding-x" }, { children: everythingInPlus && prevPlan
21096
+ ? everythingInPlusString({ plan: prevPlan })
21097
+ : "Features" })), jsx("div", __assign({ className: "flex flex-col gap-4 overflow-auto shadow-padding-x" }, { children: (_d = selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.features) === null || _d === void 0 ? void 0 : _d.map(function (feature, index) { return (jsx(PriceListCardFeature, { feature: feature, index: index }, index)); }) }))] }));
21098
+ };
21099
+
21100
+ var PriceListGrid = function (_a) {
21101
+ var _b, _c;
21102
+ var availablePriceLists = _a.availablePriceLists, onChangePriceList = _a.onChangePriceList, planChangeOptions = _a.planChangeOptions, priceListStart = _a.priceListStart, selectedPriceList = _a.selectedPriceList, selectedProduct = _a.selectedProduct, setPriceListStart = _a.setPriceListStart, subscriptions = _a.subscriptions, upgradingSubscriptionState = _a.upgradingSubscriptionState;
21103
+ // Hooks
21104
+ var isMobile = useIsMobile();
21105
+ // Derived state
21106
+ var currentPlan = (_b = planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.plans) === null || _b === void 0 ? void 0 : _b.find(function (plan) { return plan.id === (upgradingSubscriptionState === null || upgradingSubscriptionState === void 0 ? void 0 : upgradingSubscriptionState.plan.id); });
21107
+ var selectedPlan = (_c = planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.plans) === null || _c === void 0 ? void 0 : _c.find(function (plan) { return plan.id === (selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.plan.id); });
21108
+ var trialRemainingDays = dayjs(currentPlan === null || currentPlan === void 0 ? void 0 : currentPlan.trialEndDate).diff(dayjs(), "days");
21109
+ return isMobile ? (jsx(PriceListGridMobile, { availablePriceLists: availablePriceLists, onChangePriceList: onChangePriceList, planChangeOptions: planChangeOptions, selectedPlan: selectedPlan, selectedProduct: selectedProduct, subscriptions: subscriptions, trialRemainingDays: trialRemainingDays })) : (jsx(PriceListGridDesktop, { availablePriceLists: availablePriceLists, onChangePriceList: onChangePriceList, planChangeOptions: planChangeOptions, priceListStart: priceListStart, selectedPlan: selectedPlan, selectedProduct: selectedProduct, setPriceListStart: setPriceListStart, subscriptions: subscriptions, trialRemainingDays: trialRemainingDays }));
21110
+ };
21111
+
21112
+ var createAvailableBillingPeriods = function (plans, selectedProduct) {
21113
+ return plans === null || plans === void 0 ? void 0 : plans.flatMap(function (plan) {
21114
+ return plan.priceLists
21115
+ .filter(function (priceList) { return priceList.product.id === (selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.id); })
21116
+ .map(function (priceList) { return priceList.periodMonths; });
21117
+ }).sort(function (a, b) { return a - b; }).filter(function (currentValue, index, array) { return index === array.indexOf(currentValue); });
21118
+ };
21119
+ var PriceListSelector = function (_a) {
21120
+ var arePlanChangeOptionsLoading = _a.arePlanChangeOptionsLoading, areSubscriptionsLoading = _a.areSubscriptionsLoading, onChangePriceList = _a.onChangePriceList, planChangeOptions = _a.planChangeOptions, selectedPriceList = _a.selectedPriceList, subscriptions = _a.subscriptions, upgradingSubscription = _a.upgradingSubscription;
21121
+ // Context
21122
+ var _b = useContext(SubscriptionsContext), isInPreviewMode = _b.isInPreviewMode, quotePreviewData = _b.quotePreviewData, setQuotePreviewData = _b.setQuotePreviewData;
21123
+ // Local state
21124
+ var _c = useState(), selectedProduct = _c[0], setSelectedProduct = _c[1];
21125
+ var _d = useState(), selectedBillingPeriod = _d[0], setSelectedBillingPeriod = _d[1];
21126
+ var _e = useState(0), priceListStart = _e[0], setPriceListStart = _e[1];
21127
+ // Derived state
21128
+ var availableBillingPeriods = useMemo(function () {
21129
+ return createAvailableBillingPeriods(planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.plans, selectedProduct);
21130
+ }, [planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.plans, selectedProduct]);
21131
+ var availablePriceLists = useMemo(function () {
21132
+ var _a;
21133
+ return (((_a = planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.plans) === null || _a === void 0 ? void 0 : _a.flatMap(function (plan) {
21134
+ return plan.priceLists.filter(function (priceList) {
21135
+ return periodMonthsConverter(priceList.periodMonths) ===
21136
+ selectedBillingPeriod &&
21137
+ priceList.product.id === (selectedProduct === null || selectedProduct === void 0 ? void 0 : selectedProduct.id);
21138
+ });
21139
+ })) || []);
21140
+ }, [planChangeOptions, selectedBillingPeriod, selectedProduct]);
21141
+ // Handlers
21142
+ var onChangeBillingPeriod = useCallback(function (billingPeriod) {
21143
+ var _a, _b;
21144
+ setSelectedBillingPeriod(billingPeriod);
21145
+ setPriceListStart(0);
21146
+ if ((quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.priceList) &&
21147
+ billingPeriod !==
21148
+ periodMonthsConverter((_a = quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.priceList) === null || _a === void 0 ? void 0 : _a.periodMonths)) {
21149
+ var availablePriceLists_1 = ((_b = planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.plans) === null || _b === void 0 ? void 0 : _b.flatMap(function (plan) {
21150
+ return plan.priceLists.filter(function (priceList) {
21151
+ return periodMonthsConverter(priceList.periodMonths) === billingPeriod;
21152
+ });
21153
+ })) || [];
21154
+ var newSelectedPriceList = availablePriceLists_1.find(function (priceList) {
21155
+ var _a;
21156
+ return periodMonthsConverter(priceList.periodMonths) === billingPeriod &&
21157
+ priceList.plan.id === ((_a = quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.priceList) === null || _a === void 0 ? void 0 : _a.plan.id) &&
21158
+ !isPriceListDisabled({
21159
+ priceList: priceList,
21160
+ subscriptions: subscriptions,
21161
+ upgradingSubscription: upgradingSubscription,
21162
+ });
21163
+ });
21164
+ var isPriceListCurrentSubscription = newSelectedPriceList &&
21165
+ (upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.priceList.id) === newSelectedPriceList.id;
21166
+ if (newSelectedPriceList && !isPriceListCurrentSubscription) {
21167
+ setQuotePreviewData({
21168
+ priceList: newSelectedPriceList,
21169
+ quantity: calculateNewQuantity(newSelectedPriceList, quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.quantity),
21170
+ });
21171
+ }
21172
+ else if (isPriceListCurrentSubscription) {
21173
+ setQuotePreviewData({
21174
+ quantity: quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.quantity,
21175
+ });
21176
+ }
21177
+ }
21178
+ }, [
21179
+ quotePreviewData,
21180
+ planChangeOptions,
21181
+ subscriptions,
21182
+ upgradingSubscription,
21183
+ setQuotePreviewData,
21184
+ ]);
21185
+ var onChangeProduct = useCallback(function (product) {
21186
+ var newAvailableBillingPeriods = createAvailableBillingPeriods(planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.plans, product);
21187
+ if (!(newAvailableBillingPeriods === null || newAvailableBillingPeriods === void 0 ? void 0 : newAvailableBillingPeriods.includes(billingPeriodConverter(selectedBillingPeriod)))) {
21188
+ onChangeBillingPeriod(periodMonthsConverter((newAvailableBillingPeriods === null || newAvailableBillingPeriods === void 0 ? void 0 : newAvailableBillingPeriods[0]) !== undefined
21189
+ ? newAvailableBillingPeriods[0]
21190
+ : 1));
21191
+ }
21192
+ setSelectedProduct(product);
21193
+ }, [planChangeOptions, selectedBillingPeriod, onChangeBillingPeriod]);
21194
+ // Default settings
21195
+ useEffect(function () {
21196
+ var _a, _b, _c, _d;
21197
+ if (arePlanChangeOptionsLoading ||
21198
+ areSubscriptionsLoading ||
21199
+ !planChangeOptions ||
21200
+ selectedBillingPeriod ||
21201
+ selectedProduct ||
21202
+ selectedPriceList)
21203
+ return;
21204
+ var initialProduct = (_a = planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.products) === null || _a === void 0 ? void 0 : _a[0];
21205
+ var initialAvailableBillingPeriods = createAvailableBillingPeriods(planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.plans, initialProduct);
21206
+ var initialBillingPeriod;
21207
+ if ((upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.priceList) &&
21208
+ (initialAvailableBillingPeriods === null || initialAvailableBillingPeriods === void 0 ? void 0 : initialAvailableBillingPeriods.includes(billingPeriodConverter(periodMonthsConverter(upgradingSubscription.priceList.periodMonths))))) {
21209
+ initialBillingPeriod = periodMonthsConverter(upgradingSubscription.priceList.periodMonths);
21210
+ }
21211
+ else {
21212
+ initialBillingPeriod = periodMonthsConverter((initialAvailableBillingPeriods === null || initialAvailableBillingPeriods === void 0 ? void 0 : initialAvailableBillingPeriods[0]) || 1);
21213
+ }
21214
+ var initialAvailablePriceLists = ((_b = planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.plans) === null || _b === void 0 ? void 0 : _b.flatMap(function (plan) {
21215
+ return plan.priceLists.filter(function (priceList) {
21216
+ return periodMonthsConverter(priceList.periodMonths) ===
21217
+ initialBillingPeriod &&
21218
+ priceList.product.id === (initialProduct === null || initialProduct === void 0 ? void 0 : initialProduct.id);
21219
+ });
21220
+ })) || [];
21221
+ var initialPriceList;
21222
+ 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;
21223
+ if (upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.priceList) {
21224
+ initialPriceList = initialAvailablePriceLists.find(function (priceList) { return priceList.id === upgradingSubscription.priceList.id; });
21225
+ }
21226
+ if (initialBillingPeriod)
21227
+ setSelectedBillingPeriod(initialBillingPeriod);
21228
+ if (initialProduct)
21229
+ setSelectedProduct(initialProduct);
21230
+ if (initialPriceList &&
21231
+ !isInPreviewMode &&
21232
+ !isPriceListDisabled({
21233
+ priceList: initialPriceList,
21234
+ subscriptions: subscriptions,
21235
+ upgradingSubscription: upgradingSubscription,
21236
+ })) {
21237
+ setQuotePreviewData({
21238
+ priceList: initialPriceList,
21239
+ quantity: calculateNewQuantity(initialPriceList, initialQuantity),
21240
+ });
21241
+ }
21242
+ }, [
21243
+ arePlanChangeOptionsLoading,
21244
+ areSubscriptionsLoading,
21245
+ isInPreviewMode,
21246
+ planChangeOptions,
21247
+ selectedBillingPeriod,
21248
+ selectedPriceList,
21249
+ selectedProduct,
21250
+ setQuotePreviewData,
21251
+ subscriptions,
21252
+ upgradingSubscription,
21253
+ ]);
21254
+ return (jsxs(Fragment, { children: [jsx(BillingPeriodSelector, { availableBillingPeriods: availableBillingPeriods, onChangeBillingPeriod: onChangeBillingPeriod, products: planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.products, selectedBillingPeriod: selectedBillingPeriod, selectedProduct: selectedProduct, onChangeProduct: onChangeProduct }), jsx(PriceListGrid, { availablePriceLists: availablePriceLists, onChangePriceList: onChangePriceList, planChangeOptions: planChangeOptions, priceListStart: priceListStart, selectedPriceList: selectedPriceList, selectedProduct: selectedProduct, setPriceListStart: setPriceListStart, subscriptions: subscriptions, upgradingSubscriptionState: upgradingSubscription })] }));
21255
+ };
21256
+
21257
+ var PlanPicker = function () {
21258
+ var _a;
21259
+ // Context
21260
+ var token = useToken();
21261
+ var apiHost = useContext(BunnyContext).apiHost;
21262
+ var _b = useContext(SubscriptionsContext), entityId = _b.entityId, isInPreviewMode = _b.isInPreviewMode, productId = _b.productId, quotePreviewData = _b.quotePreviewData, setQuotePreviewData = _b.setQuotePreviewData, upgradingSubscription = _b.upgradingSubscription;
21263
+ // Hooks
21264
+ var queryClient = useQueryClient();
21265
+ var showInfoNotification = useInfoNotification();
21266
+ // Queries
21267
+ var _c = useQuery({
21268
+ queryKey: QueryKeyFactory.default.createTableKey({
21269
+ filterString: "entityId=".concat(entityId),
21270
+ pluralType: "subscriptions",
21271
+ token: token,
21272
+ }),
21273
+ queryFn: function () {
21274
+ return getSubscriptions({ entityId: entityId, isInPreviewMode: isInPreviewMode, token: token, apiHost: apiHost });
21275
+ },
21276
+ enabled: Boolean(entityId),
21277
+ }), subscriptions = _c.data, areSubscriptionsLoading = _c.isLoading;
21278
+ var _d = useQuery({
21279
+ queryKey: QueryKeyFactory.default.planChangeOptionsKey({
21280
+ subscriptionId: upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id,
21281
+ token: token,
21282
+ }),
21283
+ queryFn: function () {
21284
+ return getPlanChangeOptions({
21285
+ isInPreviewMode: isInPreviewMode,
21286
+ token: token,
21287
+ upgradingSubscription: upgradingSubscription,
21288
+ apiHost: apiHost,
21289
+ });
21290
+ },
21291
+ enabled: !areSubscriptionsLoading,
21292
+ }), data = _d.data, arePlanChangeOptionsLoading = _d.isLoading;
21293
+ var previewDataQuery = useQuery({
21294
+ queryKey: QueryKeyFactory.default.createTableKey({
21295
+ pluralType: "portalPreview",
21296
+ filterString: productId || "",
21297
+ token: token,
21298
+ }),
21299
+ queryFn: function () { return getPortalPreviewData(productId || "", apiHost, token); },
21300
+ enabled: isInPreviewMode,
21301
+ });
21302
+ var planChangeOptions = useMemo(function () {
21303
+ return isInPreviewMode ? previewDataQuery.data : data;
21304
+ }, [isInPreviewMode, previewDataQuery.data, data]);
21305
+ // Handlers
21306
+ var onChangePriceList = useCallback(function (selectedPriceList) {
21307
+ if (isInPreviewMode)
21308
+ return showInfoNotification("You are in preview mode");
21309
+ return setQuotePreviewData({
21310
+ priceList: selectedPriceList,
21311
+ quantity: calculateNewQuantity(selectedPriceList, quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.quantity),
21312
+ });
21313
+ }, [isInPreviewMode, setQuotePreviewData, showInfoNotification]);
21314
+ // Reset quote preview data when the plan picker is unmounted
21315
+ useEffect(function () {
21316
+ return function () {
21317
+ setQuotePreviewData({});
21318
+ };
21319
+ }, [setQuotePreviewData]);
21320
+ if (queryClient.getQueryData(QueryKeyFactory.default.planChangeOptionsKey({
21321
+ subscriptionId: upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id,
21322
+ token: token,
21323
+ })) === undefined) {
21324
+ return jsx(Fragment, {});
21325
+ }
21326
+ else if (((_a = planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.plans) === null || _a === void 0 ? void 0 : _a.length) === 0) {
21327
+ return jsx(ErrorView, { message: "There are no plans available" });
21328
+ }
21329
+ return (jsx(PriceListSelector, { arePlanChangeOptionsLoading: arePlanChangeOptionsLoading, areSubscriptionsLoading: areSubscriptionsLoading, onChangePriceList: onChangePriceList, planChangeOptions: planChangeOptions, selectedPriceList: quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.priceList, subscriptions: subscriptions }));
21330
+ };
21331
+
21332
+ var Text$7 = Typography.Text;
21333
+ var PreviewModeAdvisary = function (_a) {
21334
+ var isInPreviewMode = _a.isInPreviewMode;
21335
+ if (!isInPreviewMode)
21336
+ return null;
21337
+ return (jsx("div", __assign({ className: "flex justify-center w-full rounded" }, { children: jsx(Text$7, { children: "You are in preview mode. Products, plans and price lists are shown regardless of visibility settings." }) })));
21338
+ };
21339
+
21340
+ var PlanManager = function (_a) {
21341
+ var onChangePlanCancel = _a.onChangePlanCancel, handlePortalErrors = _a.handlePortalErrors;
21342
+ // Context
21343
+ var token = useToken();
21344
+ var _b = useContext(BunnyContext), apiHost = _b.apiHost, graphQLClient = _b.graphQLClient;
21345
+ var _c = useContext(SubscriptionsContext), entityId = _c.entityId, isInPreviewMode = _c.isInPreviewMode, upgradingSubscription = _c.upgradingSubscription, setUpgradingSubscription = _c.setUpgradingSubscription, subscriptionUpgradeId = _c.subscriptionUpgradeId, setQuotePreviewData = _c.setQuotePreviewData, quotePreviewData = _c.quotePreviewData, className = _c.className;
21346
+ // Local state
21347
+ var _d = useState(), editingQuoteData = _d[0], setEditingQuoteData = _d[1];
21348
+ var _e = useState(false), payModalVisible = _e[0], setPayModalVisible = _e[1];
21349
+ var _f = useState(false), isSticky = _f[0], setIsSticky = _f[1];
21350
+ var stickyRef = useRef(null);
21351
+ // Hooks
21352
+ var queryClient = useQueryClient();
21353
+ var showSuccessNotification = useSuccessNotification();
21354
+ var showInfoNotification = useInfoNotification();
21355
+ var isMobile = useIsMobile();
21356
+ var storedPaymentMethod = usePaymentMethod({
21357
+ graphQLClient: graphQLClient,
21358
+ token: token,
21359
+ }).data;
21360
+ // Queries
21361
+ var _g = useQuery({
21362
+ queryKey: QueryKeyFactory.default.createTableKey({
21363
+ filterString: "entityId=".concat(entityId),
21364
+ pluralType: "subscriptions",
21365
+ token: token,
21366
+ }),
21367
+ queryFn: function () {
21368
+ return getSubscriptions({ entityId: entityId, isInPreviewMode: isInPreviewMode, token: token, apiHost: apiHost });
21369
+ },
21370
+ enabled: Boolean(entityId),
21371
+ }), subscriptions = _g.data, subscriptionsAreLoading = _g.isLoading;
21372
+ var quote = useQuery({
21373
+ queryKey: QueryKeyFactory.default.createObjectKey({
21374
+ id: editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.id,
21375
+ objectName: "editingQuote",
21376
+ token: token,
21377
+ }),
21378
+ queryFn: function () {
21379
+ return (editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.id)
21380
+ ? getQuote({ token: token, id: editingQuoteData.id, apiHost: apiHost })
21381
+ : undefined;
21382
+ },
21383
+ enabled: Boolean(editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.id),
21384
+ }).data;
21385
+ useEffect(function () {
21386
+ if (subscriptionUpgradeId && !upgradingSubscription) {
21387
+ var subscription = subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.find(function (subscription) {
21388
+ return subscription.id === subscriptionUpgradeId;
21389
+ });
21390
+ setUpgradingSubscription(subscription);
21391
+ }
21392
+ }, [
21393
+ setUpgradingSubscription,
21394
+ subscriptionUpgradeId,
21395
+ subscriptions,
21396
+ upgradingSubscription,
21397
+ ]);
21398
+ useEffect(function () {
21399
+ var observer = new IntersectionObserver(function (_a) {
21400
+ var entry = _a[0];
21401
+ setIsSticky(!entry.isIntersecting);
21402
+ }, {
21403
+ root: null,
21404
+ // 300px margin from top so that we don't transition to sticky when scrolling up to PlanPickerCheckoutBar from bottom of page
21405
+ // 20px margin from bottom so PlanPickerCheckoutBar resizes at the right time
21406
+ rootMargin: "300px 0px -20px 0px",
21407
+ threshold: 1.0,
21408
+ });
21409
+ var el = stickyRef.current;
21410
+ if (el)
21411
+ observer.observe(el);
21412
+ return function () {
21413
+ if (el)
21414
+ observer.unobserve(el);
21415
+ };
21416
+ }, []);
21417
+ // Handlers
21418
+ var onSuccess = function () {
21419
+ setEditingQuoteData(undefined);
21420
+ queryClient.invalidateQueries({
21421
+ queryKey: QueryKeyFactory.default.transactionsKey({ token: token }),
21422
+ });
21423
+ queryClient.invalidateQueries({
21424
+ queryKey: QueryKeyFactory.default.createTableKey({
21425
+ filterString: "entityId=".concat(entityId),
21426
+ pluralType: "subscriptions",
21427
+ token: token,
21428
+ }),
21429
+ });
21430
+ showSuccessNotification("Your plan has been updated", "Payment successful");
21431
+ setPayModalVisible(false);
21432
+ };
21433
+ var onCancel = function () {
21434
+ setPayModalVisible(false);
21435
+ };
21436
+ var onFail = function (error) {
21437
+ handlePortalErrors(error);
21438
+ };
21439
+ if (subscriptionsAreLoading && !isInPreviewMode)
21440
+ return jsx(Fragment, {});
21441
+ return (jsxs("div", __assign({ className: "".concat(className, " px-8") }, { children: [jsx(PreviewModeAdvisary, { isInPreviewMode: isInPreviewMode }), jsx(PageTitle, { onGoBack: function () {
21442
+ if (isInPreviewMode)
21443
+ return showInfoNotification("You are in preview mode");
21444
+ setQuotePreviewData(undefined);
21445
+ onChangePlanCancel();
21446
+ }, title: "Change plan" }), jsx(PlanPicker, {}), jsx(Checkout, { entityId: entityId, onCancel: onCancel, onSuccess: onSuccess, onFail: onFail, open: payModalVisible, quote: quote, token: token, isMobile: isMobile, storedPaymentMethod: storedPaymentMethod, selectedPriceList: quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.priceList, quantity: quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.quantity }), jsx("div", { ref: stickyRef }), jsx("div", __assign({ className: "sticky bottom-4 transition-[margin] duration-300 ".concat(isSticky ? "mx-4" : "mx-0") }, { children: jsx(PlanPickerCheckoutBarWrapper, { handlePortalErrors: handlePortalErrors, onCheckoutSuccess: function () { return onChangePlanCancel(); } }) })), jsx(Footer, {})] })));
20077
21447
  };
20078
21448
 
20079
- 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 charges {\n priceListCharge {\n priceListChargeTiers {\n price\n starts\n }\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 }";
20080
- var getSubscriptions = function (_a) {
20081
- var apiHost = _a.apiHost, entityId = _a.entityId, isInPreviewMode = _a.isInPreviewMode, token = _a.token;
20082
- return __awaiter(void 0, void 0, void 0, function () {
20083
- var response, combinedSubscriptions;
20084
- var _b, _c;
20085
- return __generator(this, function (_d) {
20086
- switch (_d.label) {
20087
- case 0: return [4 /*yield*/, gqlRequest({
20088
- isInPreviewMode: isInPreviewMode,
20089
- query: SUBSCRIPTIONS_QUERY,
20090
- token: token,
20091
- vars: { entityId: entityId },
20092
- apiHost: apiHost,
20093
- })];
21449
+ var useCancelSubscription = function () {
21450
+ var graphQLRequest = useGraphQLRequest();
21451
+ return function (subscriptionIds, token, apiHost) { return __awaiter(void 0, void 0, void 0, function () {
21452
+ var data;
21453
+ var _a;
21454
+ return __generator(this, function (_b) {
21455
+ switch (_b.label) {
21456
+ case 0: return [4 /*yield*/, graphQLRequest("\n mutation SubscriptionCancel($subscriptionIds: [ID!]!) {\n subscriptionCancel(ids: $subscriptionIds) {\n subscriptions {\n accountId\n state\n }\n }\n }", token, apiHost, { subscriptionIds: subscriptionIds })];
20094
21457
  case 1:
20095
- response = _d.sent();
20096
- 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) })); });
20097
- return [2 /*return*/, combinedSubscriptions];
21458
+ data = _b.sent();
21459
+ return [2 /*return*/, (_a = data === null || data === void 0 ? void 0 : data.subscriptions) === null || _a === void 0 ? void 0 : _a.nodes];
20098
21460
  }
20099
21461
  });
20100
- });
20101
- };
20102
-
20103
- var ErrorView = function (_a) {
20104
- var children = _a.children, message = _a.message;
20105
- return (jsxs("div", __assign({ className: "flex flex-col w-full", style: { marginTop: "80px" } }, { children: [jsx("div", __assign({ style: { fontSize: "32px" } }, { children: message })), children] })));
21462
+ }); };
20106
21463
  };
20107
21464
 
20108
- var SubscriptionsContext = createContext({});
20109
-
20110
21465
  var SubscriptionState;
20111
21466
  (function (SubscriptionState) {
20112
21467
  SubscriptionState["ACTIVE"] = "ACTIVE";
@@ -20146,7 +21501,7 @@ var getFeatureUsage = function (_a) {
20146
21501
  });
20147
21502
  };
20148
21503
 
20149
- var StyledModal = defaultStyled(Modal)(templateObject_1$1 || (templateObject_1$1 = __makeTemplateObject(["\n z-index: 2000;\n\n .ant-modal-content {\n overflow: hidden;\n padding: 0 !important;\n }\n .ant-modal-body {\n height: min-content;\n max-height: ", ";\n overflow: auto;\n display: flex;\n flex-direction: column;\n padding: 0;\n }\n .ant-modal-footer {\n padding: 0 1.5rem 1.5rem;\n }\n"], ["\n z-index: 2000;\n\n .ant-modal-content {\n overflow: hidden;\n padding: 0 !important;\n }\n .ant-modal-body {\n height: min-content;\n max-height: ", ";\n overflow: auto;\n display: flex;\n flex-direction: column;\n padding: 0;\n }\n .ant-modal-footer {\n padding: 0 1.5rem 1.5rem;\n }\n"])), MODAL_MAX_HEIGHT);
21504
+ var StyledModal = defaultStyled(Modal)(templateObject_1$2 || (templateObject_1$2 = __makeTemplateObject(["\n z-index: 2000;\n\n .ant-modal-content {\n overflow: hidden;\n padding: 0 !important;\n }\n .ant-modal-body {\n height: min-content;\n max-height: ", ";\n overflow: auto;\n display: flex;\n flex-direction: column;\n padding: 0;\n }\n .ant-modal-footer {\n padding: 0 1.5rem 1.5rem;\n }\n"], ["\n z-index: 2000;\n\n .ant-modal-content {\n overflow: hidden;\n padding: 0 !important;\n }\n .ant-modal-body {\n height: min-content;\n max-height: ", ";\n overflow: auto;\n display: flex;\n flex-direction: column;\n padding: 0;\n }\n .ant-modal-footer {\n padding: 0 1.5rem 1.5rem;\n }\n"])), MODAL_MAX_HEIGHT);
20150
21505
  var HeaderModalWrapper = function (props) {
20151
21506
  var children = props.children, description = props.description, title = props.title;
20152
21507
  var modalProps = useMemo(function () {
@@ -20158,7 +21513,7 @@ var HeaderModalWrapper = function (props) {
20158
21513
  width: "75%",
20159
21514
  } }, { children: description })))] }))), children] })));
20160
21515
  };
20161
- var templateObject_1$1;
21516
+ var templateObject_1$2;
20162
21517
 
20163
21518
  var isPlural = pkg.isPlural;
20164
21519
  var getDateFormat = function (dataInterval) {
@@ -20230,15 +21585,52 @@ var FeatureBarChart = function (_a) {
20230
21585
  tickLine: false,
20231
21586
  }), { height: displayXAxis ? undefined : 1, interval: "equidistantPreserveStart", style: {
20232
21587
  fill: SLATE_500,
20233
- } })), jsx(Tooltip, __assign({ cursor: { fill: SLATE_200 } }, (displayXAxis
21588
+ } })), jsx(Tooltip$1, __assign({ cursor: { fill: SLATE_200 } }, (displayXAxis
20234
21589
  ? {}
20235
21590
  : {
20236
21591
  position: { y: -62 },
20237
21592
  }))), jsx(Bar, { dataKey: featureName, fill: brandColor, activeBar: jsx(Rectangle, { fill: brandColor }) })] })));
20238
21593
  };
20239
- var StyledBarChart = defaultStyled(BarChart)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n .recharts-surface {\n overflow: visible;\n }\n"], ["\n .recharts-surface {\n overflow: visible;\n }\n"])));
20240
- var templateObject_1;
21594
+ var StyledBarChart = defaultStyled(BarChart)(templateObject_1$1 || (templateObject_1$1 = __makeTemplateObject(["\n .recharts-surface {\n overflow: visible;\n }\n"], ["\n .recharts-surface {\n overflow: visible;\n }\n"])));
21595
+ var templateObject_1$1;
20241
21596
 
21597
+ var canShowQuantitiesInput = function (charge, subscription) {
21598
+ // Check if the subscription is active, pending, or in trial,
21599
+ // the pricing model is not flat,
21600
+ // and if it's not a trial, also check if the current charge is the last one in the subscription.
21601
+ var _a, _b, _c;
21602
+ var isActiveSubscription = ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState$2.ACTIVE;
21603
+ var isPendingSubscription = ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState$2.PENDING;
21604
+ var isTrialSubscription = ((_c = subscription.state) === null || _c === void 0 ? void 0 : _c.toUpperCase()) === SubscriptionState$2.TRIAL;
21605
+ var isFlatPricing = charge.pricingModel === "FLAT";
21606
+ var shouldProcessCharge = (isActiveSubscription || isPendingSubscription || isTrialSubscription) &&
21607
+ !isFlatPricing &&
21608
+ charge.selfServiceQuantity &&
21609
+ !charge.expired;
21610
+ // Now you can use the value of shouldProcessCharge to determine whether to process the charge.
21611
+ return shouldProcessCharge;
21612
+ };
21613
+ var createQuoteParams = function (quote, subscriptionQuantity, editedSubscription) {
21614
+ var quoteChange = quote.quoteChanges.find(function (quoteChange) {
21615
+ return quoteChange.priceList.id === (editedSubscription === null || editedSubscription === void 0 ? void 0 : editedSubscription.subscription.priceList.id);
21616
+ });
21617
+ var quoteChangeCharge = quoteChange === null || quoteChange === void 0 ? void 0 : quoteChange.charges.find(function (charge) { return charge.priceListCharge.id === editedSubscription.chargeId; });
21618
+ var charges = [
21619
+ {
21620
+ id: quoteChangeCharge.id,
21621
+ quantity: editedSubscription.quantity - subscriptionQuantity,
21622
+ },
21623
+ ];
21624
+ return { charges: charges, quoteChange: quoteChange };
21625
+ };
21626
+ var canShowChangeQuantities = function (_a) {
21627
+ var subscriptions = _a.subscriptions;
21628
+ return subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.some(function (subscription) {
21629
+ return subscription.charges.some(function (charge, chargeIndex) {
21630
+ return canShowQuantitiesInput(charge, subscription);
21631
+ });
21632
+ });
21633
+ };
20242
21634
  var isSubscriptionNotActive = function (subscription) {
20243
21635
  var _a, _b;
20244
21636
  return ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState$2.EXPIRED ||
@@ -20261,7 +21653,7 @@ var SubscriptionCardActions = function (_a) {
20261
21653
  canShowSubscriptionActions(subscription) ? (jsxs(Fragment, { children: [canShowCancelButton && (jsx(Popconfirm, __assign({ icon: null, onConfirm: function () { return onCancelSubscriptionClick === null || onCancelSubscriptionClick === void 0 ? void 0 : onCancelSubscriptionClick(subscription); }, title: "Cancel subscription" }, { children: jsx(Button, __assign({ className: "p-0", type: "link" }, { children: "Cancel subscription" })) }))), canShowChangePlanButton && (jsx(Button, __assign({ onClick: function () { return onChangePlanClick(subscription); }, type: "primary" }, { children: "Change plan" })))] })) : ((_c = subscription.state) === null || _c === void 0 ? void 0 : _c.toUpperCase()) === SubscriptionState$2.TRIAL ? (jsx(Button, __assign({ onClick: function () { return onChangePlanClick(subscription); }, type: "primary" }, { children: "Upgrade" }))) : null;
20262
21654
  };
20263
21655
 
20264
- var Text$2 = Typography.Text;
21656
+ var Text$6 = Typography.Text;
20265
21657
  var getSubscriptionStatusText = function (subscription) {
20266
21658
  var cancellationDate = subscription.cancellationDate, state = subscription.state, evergreen = subscription.evergreen, endDate = subscription.endDate;
20267
21659
  if (cancellationDate &&
@@ -20290,7 +21682,7 @@ var SubscriptionCardHeader = function (_a) {
20290
21682
  var isTrial = ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState$2.TRIAL;
20291
21683
  return (jsxs("div", __assign({ className: "flex items-center justify-between", style: {
20292
21684
  backgroundColor: darkMode ? "var(--row-background-dark)" : "",
20293
- } }, { children: [jsxs("div", __assign({ className: "flex flex-col gap-2" }, { children: [((_c = subscription === null || subscription === void 0 ? void 0 : subscription.product) === null || _c === void 0 ? void 0 : _c.name) && (jsx("div", __assign({ style: __assign({ fontSize: "11px", fontWeight: 500, color: brandColor }, subscriptionProductNameStyle) }, { children: (_d = subscription.product.name) === null || _d === void 0 ? void 0 : _d.toUpperCase() }))), jsxs("div", __assign({ className: "flex grow items-center gap-2" }, { children: [((_e = subscription === null || subscription === void 0 ? void 0 : subscription.plan) === null || _e === void 0 ? void 0 : _e.name) && (jsx(Text$2, __assign({ className: "text-lg" }, { children: subscription.plan.name }))), jsxs(Tag, __assign({ className: "ant-tag-".concat(TAG_COLORS[(_f = subscription.state) === null || _f === void 0 ? void 0 : _f.toUpperCase()]) }, { children: [lodashExports.capitalize(subscription.state.toLowerCase()), isTrial ? " (".concat(trialDaysLeft, " days left)") : ""] }))] }))] })), jsxs("div", __assign({ className: "flex items-center gap-6" }, { children: [jsx(Text$2, __assign({ className: "grow text-xs" }, { children: getSubscriptionStatusText(subscription) })), !isMobile &&
21685
+ } }, { children: [jsxs("div", __assign({ className: "flex flex-col gap-2" }, { children: [((_c = subscription === null || subscription === void 0 ? void 0 : subscription.product) === null || _c === void 0 ? void 0 : _c.name) && (jsx(Text$6, __assign({ style: __assign({ fontSize: "11px", fontWeight: 500, color: brandColor }, subscriptionProductNameStyle) }, { children: (_d = subscription.product.name) === null || _d === void 0 ? void 0 : _d.toUpperCase() }))), jsxs("div", __assign({ className: "flex grow items-center gap-2" }, { children: [((_e = subscription === null || subscription === void 0 ? void 0 : subscription.plan) === null || _e === void 0 ? void 0 : _e.name) && (jsx(Text$6, __assign({ className: "text-lg" }, { children: subscription.plan.name }))), jsxs(Tag, __assign({ className: "ant-tag-".concat(TAG_COLORS[(_f = subscription.state) === null || _f === void 0 ? void 0 : _f.toUpperCase()]) }, { children: [lodashExports.capitalize(subscription.state.toLowerCase()), isTrial ? " (".concat(trialDaysLeft, " days left)") : ""] }))] }))] })), jsxs("div", __assign({ className: "flex items-center gap-6" }, { children: [jsx(Text$6, __assign({ className: "grow text-xs" }, { children: getSubscriptionStatusText(subscription) })), !isMobile &&
20294
21686
  planChangeOptions &&
20295
21687
  onChangePlanClick &&
20296
21688
  onCancelSubscriptionClick && (jsx(SubscriptionCardActions, { onChangePlanClick: onChangePlanClick, onCancelSubscriptionClick: onCancelSubscriptionClick, planChangeOptions: planChangeOptions, subscription: subscription }))] }))] })));
@@ -20318,6 +21710,7 @@ var SubscriptionChargeTotal = function (_a) {
20318
21710
  : "".concat(formattedPeriodPrice, " ").concat(billingPeriod) })));
20319
21711
  };
20320
21712
 
21713
+ var Text$5 = Typography.Text;
20321
21714
  var SubscriptionChargeUnitPrice = function (_a) {
20322
21715
  var charge = _a.charge, subscription = _a.subscription;
20323
21716
  var darkMode = useContext(BunnyContext).darkMode;
@@ -20340,22 +21733,23 @@ var SubscriptionChargeUnitPrice = function (_a) {
20340
21733
  }) })) })));
20341
21734
  }, onOpenChange: setShowPriceTiers, open: showPriceTiers, trigger: ["click"] }, { children: jsx("div", __assign({ className: "cursor-pointer underline", onClick: function () { return setShowPriceTiers(!showPriceTiers); } }, { children: showPriceTiers ? "Hide tiers" : "Show tiers" })) })));
20342
21735
  else if (charge.chargeType === ChargeType.USAGE || charge.trial)
20343
- return jsx(Fragment, { children: "-" });
21736
+ return jsx(Text$5, { children: "-" });
20344
21737
  else if (isDiscount)
20345
21738
  return (jsxs(Fragment, { children: ["-", formatCurrency(charge.discountedPrice, subscription.currencyId)] }));
20346
21739
  else
20347
21740
  return (jsx(Fragment, { children: formatCurrency(charge.discountedPrice, subscription.currencyId) }));
20348
21741
  };
20349
21742
 
21743
+ var Text$4 = Typography.Text;
20350
21744
  var SubscriptionCardColumnHeaders = function (_a) {
20351
21745
  var columns = _a.columns;
20352
- return (jsx(Fragment, { children: columns.map(function (subscriptionColumn, index) { return (jsx("div", __assign({ className: "text-slate-400 ".concat(subscriptionColumn.className), style: { fontSize: "11px" } }, { children: subscriptionColumn.title }), index)); }) }));
21746
+ return (jsx(Fragment, { children: columns.map(function (subscriptionColumn, index) { return (jsx(Text$4, __assign({ className: "text-slate-400 ".concat(subscriptionColumn.className), style: { fontSize: "11px" } }, { children: subscriptionColumn.title }), index)); }) }));
20353
21747
  };
20354
21748
 
20355
- var Text$1 = Typography.Text;
21749
+ var Text$3 = Typography.Text;
20356
21750
  var SubscriptionsListCell = function (_a) {
20357
21751
  var children = _a.children, className = _a.className, gridColumn = _a.gridColumn, right = _a.right, style = _a.style;
20358
- return (jsx(Text$1, __assign({ className: "flex items-center text-sm whitespace-nowrap ".concat(className), style: __assign({ gridColumn: gridColumn, textAlign: right ? "right" : "left", justifyContent: right ? "flex-end" : "flex-start" }, style) }, { children: children })));
21752
+ return (jsx(Text$3, __assign({ className: "flex items-center text-sm whitespace-nowrap ".concat(className), style: __assign({ gridColumn: gridColumn, textAlign: right ? "right" : "left", justifyContent: right ? "flex-end" : "flex-start" }, style) }, { children: children })));
20359
21753
  };
20360
21754
 
20361
21755
  var CARD_COLUMNS = [
@@ -20429,10 +21823,11 @@ var SubscriptionCardDesktopRow = function (_a) {
20429
21823
  }).data;
20430
21824
  var isRampFirstRow = isRamp && chargeIndex === 0;
20431
21825
  var isTrial = charge.trial;
21826
+ var isDiscount = charge.kind === SubscriptionChargeKind.DISCOUNT;
20432
21827
  var dontShowChargeName = (prevCharge === null || prevCharge === void 0 ? void 0 : prevCharge.priceListChargeId) === charge.priceListChargeId &&
21828
+ !isDiscount &&
20433
21829
  (!isTrial || prevCharge.trial) &&
20434
21830
  (isTrial || !prevCharge.trial);
20435
- var isDiscount = charge.kind === SubscriptionChargeKind.DISCOUNT;
20436
21831
  return (jsxs("div", __assign({ className: "contents" }, { children: [(isRampFirstRow || !isRamp) && (jsx(SubscriptionsListCell, __assign({ gridColumn: isRamp ? "1/-1" : "1" }, { children: jsx("div", __assign({ className: "flex items-center gap-2 ".concat(isDiscount ? "pl-4" : "") }, { children: jsx("div", { children: isRampFirstRow || (!isRamp && !dontShowChargeName) ? charge.name : "" }) })) }))), jsx(SubscriptionsListCell, __assign({ gridColumn: 2 }, { children: jsx("div", { children: chargePeriod }) })), jsx(SubscriptionsListCell, __assign({ right: true }, { children: charge.kind === SubscriptionChargeKind.DISCOUNT
20437
21832
  ? ""
20438
21833
  : charge.chargeType === ChargeType.USAGE
@@ -20442,10 +21837,10 @@ var SubscriptionCardDesktopRow = function (_a) {
20442
21837
  : (_c = charge.quantity) === null || _c === void 0 ? void 0 : _c.toLocaleString() })), jsx(SubscriptionsListCell, __assign({ right: true }, { children: jsx(SubscriptionChargeUnitPrice, { charge: charge, subscription: subscription }) })), jsx(SubscriptionsListCell, __assign({ right: true }, { children: jsx(SubscriptionChargeTotal, { charge: charge, subscription: subscription }) }))] })));
20443
21838
  };
20444
21839
 
20445
- var Text = Typography.Text;
21840
+ var Text$2 = Typography.Text;
20446
21841
  var SubscriptionCardCellMobile = function (_a) {
20447
21842
  var children = _a.children, className = _a.className, style = _a.style;
20448
- return (jsx(Text, __assign({ className: className, style: style }, { children: children })));
21843
+ return (jsx(Text$2, __assign({ className: className, style: style }, { children: children })));
20449
21844
  };
20450
21845
 
20451
21846
  var CHARGE_COLUMNS = [
@@ -20506,21 +21901,367 @@ var SubscriptionsList = function (_a) {
20506
21901
  }) }));
20507
21902
  };
20508
21903
 
20509
- var Subscriptions = function (_a) {
20510
- var className = _a.className, companyName = _a.companyName, entityId = _a.entityId, _b = _a.hideExpired, hideExpired = _b === void 0 ? false : _b, onCancelSubscriptionClick = _a.onCancelSubscriptionClick, onChangePlanClick = _a.onChangePlanClick, onSubscriptionsLoaded = _a.onSubscriptionsLoaded, _c = _a.styles, styles = _c === void 0 ? {
21904
+ // Extra props to pass in
21905
+ // - previewMode: boolean
21906
+ // - productId: string
21907
+ var SubscriptionsListContainer = function (_a) {
21908
+ 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;
21909
+ // Context
21910
+ var apiHost = useContext(BunnyContext).apiHost;
21911
+ var gap = useContext(SubscriptionsContext).gap;
21912
+ var token = useToken();
21913
+ // Queries
21914
+ var _c = useQuery({
21915
+ queryKey: QueryKeyFactory.default.planChangeOptionsKey({ token: token }),
21916
+ queryFn: function () { return getPlanChangeOptions({ token: token, apiHost: apiHost }); },
21917
+ enabled: Boolean(onChangePlanClick),
21918
+ }), planChangeOptions = _c.data, arePlanChangeOptionsLoading = _c.isLoading;
21919
+ if (subscriptionsAreLoading ||
21920
+ (Boolean(onChangePlanClick) ? arePlanChangeOptionsLoading : false))
21921
+ return jsx(Fragment, {});
21922
+ return (jsx("div", __assign({ className: "flex flex-col gap-".concat(gap, " shrink overflow-auto") }, { children: (subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.length) > 0 ? (jsx(SubscriptionsList, { hideExpired: hideExpired, onChangePlanClick: onChangePlanClick, onCancelSubscriptionClick: onCancelSubscriptionClick, planChangeOptions: planChangeOptions, subscriptions: subscriptions })) : (noSubscriptionsComponent || (jsx("div", __assign({ className: "flex flex-col items-center w-full" }, { children: jsx(ErrorView, { message: "You have no subscriptions with ".concat(companyName, " yet") }) })))) })));
21923
+ };
21924
+
21925
+ var QuantityInput = function (_a) {
21926
+ var charge = _a.charge, chargeIndex = _a.chargeIndex, editingQuote = _a.editingQuote, setEditingQuoteData = _a.setEditingQuoteData, subscription = _a.subscription, subscriptionIndex = _a.subscriptionIndex, subscriptions = _a.subscriptions;
21927
+ // Context
21928
+ var token = useToken();
21929
+ var apiHost = useContext(BunnyContext).apiHost;
21930
+ var _b = useContext(SubscriptionsContext), updatingChargeQuantityId = _b.updatingChargeQuantityId, setUpdatingChargeQuantityId = _b.setUpdatingChargeQuantityId;
21931
+ // Local state
21932
+ var _c = useState(), editedSubscription = _c[0], setEditedSubscription = _c[1];
21933
+ // Hooks
21934
+ var queryClient = useQueryClient();
21935
+ var createSubscriptionQuote = useCreateSubscriptionQuote();
21936
+ var quoteChangeUpdate = useQuoteChangeUpdate();
21937
+ var isMobile = useIsMobile();
21938
+ var showErrorNotification = useErrorNotification();
21939
+ var quantityDisabled =
21940
+ // If we are editing a quote, we disable the quantity input
21941
+ // If we don't have a editedSubscription, we disable the quantity input
21942
+ (updatingChargeQuantityId && updatingChargeQuantityId !== charge.id) ||
21943
+ // If the subscription is not self-service, we disable the quantity input
21944
+ !charge.selfServiceQuantity;
21945
+ var value = (editedSubscription === null || editedSubscription === void 0 ? void 0 : editedSubscription.quantity) === undefined
21946
+ ? ""
21947
+ : editedSubscription.quantity;
21948
+ // Mutations
21949
+ var createQuote = useMutation({
21950
+ mutationFn: function (subscriptionIds) {
21951
+ return createSubscriptionQuote(subscriptionIds, token, apiHost);
21952
+ },
21953
+ onSuccess: function (subscriptionUpdateData) {
21954
+ var _a;
21955
+ var quote = (_a = subscriptionUpdateData === null || subscriptionUpdateData === void 0 ? void 0 : subscriptionUpdateData.quoteSubscriptionUpdate) === null || _a === void 0 ? void 0 : _a.quote;
21956
+ var _b = createQuoteParams(quote, charge.quantity, editedSubscription), charges = _b.charges, quoteChange = _b.quoteChange;
21957
+ if (quoteChange && charges[0].quantity > 0) {
21958
+ updateQuote.mutate({
21959
+ charges: charges,
21960
+ quoteChangeId: quoteChange.id,
21961
+ });
21962
+ }
21963
+ },
21964
+ });
21965
+ var updateQuote = useMutation({
21966
+ mutationFn: function (_a) {
21967
+ var charges = _a.charges, quoteChangeId = _a.quoteChangeId;
21968
+ return quoteChangeUpdate(charges, quoteChangeId, token, apiHost);
21969
+ },
21970
+ onSuccess: function (response) {
21971
+ var _a, _b, _c, _d, _e, _f;
21972
+ if (!(editingQuote === null || editingQuote === void 0 ? void 0 : editingQuote.id)) {
21973
+ var isTrial = ((_b = (_a = editedSubscription === null || editedSubscription === void 0 ? void 0 : editedSubscription.subscription) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) ===
21974
+ SubscriptionState$2.TRIAL;
21975
+ setEditingQuoteData({
21976
+ id: (_d = (_c = response.quoteChangeUpdate) === null || _c === void 0 ? void 0 : _c.quoteChange) === null || _d === void 0 ? void 0 : _d.quoteId,
21977
+ isTrial: isTrial,
21978
+ });
21979
+ }
21980
+ queryClient.invalidateQueries({
21981
+ queryKey: QueryKeyFactory.default.createObjectKey({
21982
+ id: (_f = (_e = response.quoteChangeUpdate) === null || _e === void 0 ? void 0 : _e.quoteChange) === null || _f === void 0 ? void 0 : _f.quoteId,
21983
+ objectName: "editingQuote",
21984
+ token: token,
21985
+ }),
21986
+ });
21987
+ },
21988
+ });
21989
+ // Handlers
21990
+ var isQuantityLowerThanOriginal = function (quantity) {
21991
+ return (editedSubscription === null || editedSubscription === void 0 ? void 0 : editedSubscription.quantity) !== undefined &&
21992
+ editedSubscription.quantity <= quantity;
21993
+ };
21994
+ var onChangeQuantity = function (chargeIndex, value, priceListChargeId, subscription, subscriptionIndex) {
21995
+ var quantity = isNaN(parseInt(value)) ? 0 : parseInt(value);
21996
+ setEditedSubscription({
21997
+ chargeIndex: chargeIndex,
21998
+ subscriptionIndex: subscriptionIndex,
21999
+ chargeId: priceListChargeId,
22000
+ quantity: quantity,
22001
+ subscription: subscription,
22002
+ });
22003
+ if (quantity !== charge.quantity) {
22004
+ setUpdatingChargeQuantityId(charge.id);
22005
+ }
22006
+ else {
22007
+ setUpdatingChargeQuantityId(undefined);
22008
+ }
22009
+ };
22010
+ var handleSubscriptionUpdate = function (editedSubscription) {
22011
+ if (!editedSubscription)
22012
+ return;
22013
+ // If we are not editing a quote, we create a new one
22014
+ if (!editingQuote) {
22015
+ var subscriptionIds = [];
22016
+ var charge_1 = subscriptions[editedSubscription.subscriptionIndex].charges[editedSubscription.chargeIndex];
22017
+ if (isQuantityLowerThanOriginal(charge_1.quantity)) {
22018
+ // If the quantity is lower than the original, we remove the quote
22019
+ setEditingQuoteData(undefined);
22020
+ setUpdatingChargeQuantityId(undefined);
22021
+ return;
22022
+ }
22023
+ subscriptionIds.push(editedSubscription.subscription.id);
22024
+ createQuote.mutate(subscriptionIds);
22025
+ }
22026
+ else {
22027
+ // If we are editing a quote, we update the quote change
22028
+ var _a = createQuoteParams(editingQuote, charge.quantity, editedSubscription), charges = _a.charges, quoteChange = _a.quoteChange;
22029
+ if (quoteChange && charges[0].quantity > 0) {
22030
+ updateQuote.mutate({
22031
+ charges: charges,
22032
+ quoteChangeId: quoteChange.id,
22033
+ });
22034
+ }
22035
+ else {
22036
+ // Reset the editing quote data and the updating charge quantity ID to their initial states
22037
+ setEditingQuoteData(undefined);
22038
+ setUpdatingChargeQuantityId(undefined);
22039
+ }
22040
+ }
22041
+ };
22042
+ // Initial subscription quantity if is on mobile
22043
+ useEffect(function () {
22044
+ if (isMobile && !editedSubscription && !quantityDisabled) {
22045
+ setEditedSubscription({
22046
+ chargeIndex: chargeIndex,
22047
+ subscriptionIndex: subscriptionIndex,
22048
+ chargeId: charge.priceListChargeId,
22049
+ quantity: charge.quantity,
22050
+ subscription: subscription,
22051
+ });
22052
+ }
22053
+ }, [
22054
+ charge,
22055
+ chargeIndex,
22056
+ editedSubscription,
22057
+ isMobile,
22058
+ quantityDisabled,
22059
+ subscription,
22060
+ subscriptionIndex,
22061
+ ]);
22062
+ // Edit subscription debounce
22063
+ useEffect(function () {
22064
+ var debounce = setTimeout(function () {
22065
+ handleSubscriptionUpdate(editedSubscription);
22066
+ }, 1000);
22067
+ return function () { return clearTimeout(debounce); };
22068
+ // eslint-disable-next-line
22069
+ }, [editedSubscription]);
22070
+ return (jsx(Fragment, { children: jsx(Input, { className: "text-right", disabled: quantityDisabled, onBlur: function () {
22071
+ if (typeof value === "number" && value < charge.quantity) {
22072
+ showErrorNotification("New value is less than the original quantity. This is not allowed");
22073
+ }
22074
+ }, onChange: function (e) {
22075
+ onChangeQuantity(chargeIndex, e.target.value, charge.priceListChargeId, subscription, subscriptionIndex);
22076
+ }, status: isQuantityLowerThanOriginal(charge.quantity) ? "error" : "", style: { width: "96px" }, value: value }) }));
22077
+ };
22078
+
22079
+ var Text$1 = Typography.Text;
22080
+ var QuantityChangeGridRow = function (_a) {
22081
+ var _b;
22082
+ var chargeIndex = _a.chargeIndex, editingQuote = _a.editingQuote, subscriptions = _a.subscriptions, subscriptionIndex = _a.subscriptionIndex, setEditingQuoteData = _a.setEditingQuoteData, subscription = _a.subscription, subscriptionCharge = _a.subscriptionCharge;
22083
+ if (!canShowQuantitiesInput(subscriptionCharge, subscription))
22084
+ return null;
22085
+ return (jsxs(Fragment, { children: [jsx(Text$1, __assign({ className: "font-medium text-orange-600 col-span-full", style: { fontSize: "11px" } }, { children: subscription.plan.name })), jsx(Text$1, __assign({ className: "font-medium text-base text-gray-900" }, { children: (_b = subscriptionCharge.name) === null || _b === void 0 ? void 0 : _b.toUpperCase() })), jsx(Text$1, __assign({ className: "flex items-center justify-end font-medium text-base text-gray-900" }, { children: subscriptionCharge.quantity })), jsxs("div", __assign({ className: "flex flex-col items-end" }, { children: [jsx(QuantityInput, { charge: subscriptionCharge, chargeIndex: chargeIndex, editingQuote: editingQuote, setEditingQuoteData: setEditingQuoteData, subscription: subscription, subscriptionIndex: subscriptionIndex, subscriptions: subscriptions }), jsx("div", {})] })), jsx(Divider, { className: "col-span-full my-2" })] }));
22086
+ };
22087
+
22088
+ var QuantityChangeGridTitle = function (_a) {
22089
+ var children = _a.children, right = _a.right;
22090
+ return (jsx("div", __assign({ className: "font-medium text-slate-600 ".concat(right ? "text-right" : "text-left"), style: { fontSize: "11px" } }, { children: children })));
22091
+ };
22092
+
22093
+ var QuoteChangeSummarySection = function (_a) {
22094
+ var editingQuote = _a.editingQuote, editingQuoteData = _a.editingQuoteData, openCheckout = _a.openCheckout, setEditingQuoteData = _a.setEditingQuoteData;
22095
+ var apiHost = useContext(BunnyContext).apiHost;
22096
+ var isMobile = useIsMobile();
22097
+ var token = useToken();
22098
+ // const apiHost = getApiHost();
22099
+ var showSuccessNotification = useSuccessNotification();
22100
+ var trialUpgradeMutation = useMutation({
22101
+ mutationFn: function (quoteId) { return checkout({ quoteId: quoteId, token: token, apiHost: apiHost }); },
22102
+ onSuccess: function () {
22103
+ setEditingQuoteData(undefined);
22104
+ showSuccessNotification("Subscription updated successfully");
22105
+ },
22106
+ });
22107
+ return (jsxs("div", __assign({ className: "flex flex-col items-end" }, { children: [editingQuote && (jsxs("div", __assign({ className: "flex flex-col mb-8" }, { children: [jsx("div", __assign({ className: "text-slate-500 text-right text-xs mb-2" }, { children: "TOTAL" })), jsx("div", __assign({ className: "text-right ".concat(isMobile ? "text-2xl" : "text-xl") }, { children: formatCurrency(getQuoteAmountDue(editingQuote), (editingQuote === null || editingQuote === void 0 ? void 0 : editingQuote.currencyId) || "") }))] }))), jsx("div", __assign({ className: "flex items-center justify-end ".concat(isMobile ? "w-full" : "") }, { children: jsx(Button, __assign({ className: "w-full", onClick: (editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.isTrial)
22108
+ ? function () { return trialUpgradeMutation.mutate(editingQuoteData.id); }
22109
+ : openCheckout, disabled: !editingQuoteData, size: isMobile ? "large" : "middle", type: "primary" }, { children: (editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.isTrial) ? "Activate Trial" : "Proceed to checkout" })) }))] })));
22110
+ };
22111
+
22112
+ var QUANTITY_CHANGE_HEADER_TITLE = "Update unit quantity";
22113
+ var QUANTITY_CHANGE_HEADER_DESCRIPTION = "Adjust quantities below. The change will take effect immediately after checkout has been completed.";
22114
+ var QuantityChangeDrawerDesktop = function (_a) {
22115
+ var editingQuote = _a.editingQuote, editingQuoteData = _a.editingQuoteData, onClose = _a.onClose, open = _a.open, openCheckout = _a.openCheckout, setEditingQuoteData = _a.setEditingQuoteData, subscriptions = _a.subscriptions;
22116
+ var _b = useState(open), openLocal = _b[0], setOpenLocal = _b[1];
22117
+ var isMobile = useIsMobile();
22118
+ useEffect(function () {
22119
+ var timeoutId;
22120
+ if (!open) {
22121
+ timeoutId = setTimeout(function () {
22122
+ setOpenLocal(false);
22123
+ }, 300); // Delay to allow for close animation
22124
+ }
22125
+ else {
22126
+ setOpenLocal(true);
22127
+ }
22128
+ return function () { return clearTimeout(timeoutId); };
22129
+ }, [open]);
22130
+ if (!openLocal)
22131
+ return null;
22132
+ return (jsxs(Drawer, __assign({ closeIcon: null, destroyOnClose: true, onClose: onClose, open: open, styles: isMobile
22133
+ ? {
22134
+ body: {
22135
+ padding: "1rem",
22136
+ overflow: "hidden",
22137
+ background: SLATE_50,
22138
+ },
22139
+ wrapper: {
22140
+ width: "100vw",
22141
+ },
22142
+ }
22143
+ : {
22144
+ wrapper: {
22145
+ minWidth: "600px",
22146
+ },
22147
+ }, title: jsx(DrawerHeader, { description: QUANTITY_CHANGE_HEADER_DESCRIPTION, onClose: onClose, title: QUANTITY_CHANGE_HEADER_TITLE, closeButtonClassName: "ant-drawer-close" }) }, { children: [jsxs("div", __assign({ className: "grid pb-4", style: {
22148
+ gridTemplateColumns: "2fr 1fr 1fr",
22149
+ rowGap: "0.75rem",
22150
+ columnGap: "1rem",
22151
+ } }, { 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: "col-span-full py-2" }), subscriptions.map(function (subscription, index) {
22152
+ var _a;
22153
+ var isTrial = ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState$2.TRIAL;
22154
+ return (jsx("div", __assign({ className: "contents" }, { children: subscription.charges.map(function (charge, chargeIndex) {
22155
+ if ((isTrial && !charge.trial) || (!isTrial && charge.trial))
22156
+ return null;
22157
+ return (jsx(QuantityChangeGridRow, { chargeIndex: chargeIndex, editingQuote: editingQuote, setEditingQuoteData: setEditingQuoteData, subscription: subscription, subscriptionCharge: charge, subscriptionIndex: index, subscriptions: subscriptions }, chargeIndex));
22158
+ }) }), index));
22159
+ })] })), jsx(QuoteChangeSummarySection, { editingQuote: editingQuote, editingQuoteData: editingQuoteData, openCheckout: openCheckout, setEditingQuoteData: setEditingQuoteData })] })));
22160
+ };
22161
+
22162
+ var HideExpiredToggle = function (_a) {
22163
+ var hideExpired = _a.hideExpired, setHideExpired = _a.setHideExpired; _a.visible;
22164
+ var isMobile = useIsMobile();
22165
+ var secondaryColor = useContext(BrandContext).secondaryColor;
22166
+ return (jsxs("div", __assign({ className: "flex items-center gap-4 pl-4" }, { children: [!isMobile && jsx(Divider, { className: "h-5", type: "vertical" }), jsx(StyledCheckbox, { children: jsx(Checkbox, __assign({ checked: hideExpired, onChange: function (e) { return setHideExpired(e.target.checked); }, style: {
22167
+ color: secondaryColor,
22168
+ } }, { children: isMobile ? "Hide inactive" : "Hide inactive subscriptions" })) })] })));
22169
+ };
22170
+ 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"])));
22171
+ var templateObject_1;
22172
+
22173
+ var ChangeQuantitiesButton = function (_a) {
22174
+ var canShowChangeQuantitiesButton = _a.canShowChangeQuantitiesButton, setQuantityDrawerOpen = _a.setQuantityDrawerOpen;
22175
+ if (!canShowChangeQuantitiesButton)
22176
+ return null;
22177
+ return (jsx(Button, __assign({ onClick: function () {
22178
+ setQuantityDrawerOpen(true);
22179
+ }, type: "default" }, { children: "Change quantities" })));
22180
+ };
22181
+
22182
+ var SubscriptionsNavigation = function (_a) {
22183
+ var expiredSwitchVisible = _a.expiredSwitchVisible, hideExpired = _a.hideExpired, setHideExpired = _a.setHideExpired, setQuantityDrawerOpen = _a.setQuantityDrawerOpen, subscriptions = _a.subscriptions;
22184
+ // Hooks
22185
+ var isMobile = useIsMobile();
22186
+ // Derived state
22187
+ var canShowChangeQuantitiesButton = canShowChangeQuantities({
22188
+ subscriptions: subscriptions,
22189
+ });
22190
+ return (jsxs(Fragment, { children: [!isMobile && (jsx(HideExpiredToggle, { hideExpired: hideExpired, setHideExpired: setHideExpired, visible: expiredSwitchVisible })), jsx("div", __assign({ className: "flex grow gap-2 ".concat(isMobile ? "flex-col" : "justify-end") }, { children: canShowChangeQuantitiesButton && (jsx(ChangeQuantitiesButton, { canShowChangeQuantitiesButton: canShowChangeQuantitiesButton, setQuantityDrawerOpen: setQuantityDrawerOpen })) }))] }));
22191
+ };
22192
+
22193
+ var Text = Typography.Text;
22194
+ var SubscriptionsWrapper = function (_a) {
22195
+ var handlePortalErrors = _a.handlePortalErrors, entityId = _a.entityId, companyName = _a.companyName, _b = _a.isInPreviewMode, isInPreviewMode = _b === void 0 ? false : _b, productId = _a.productId, className = _a.className, _c = _a.styles, userStyles = _c === void 0 ? {} : _c, noSubscriptionsComponent = _a.noSubscriptionsComponent, _d = _a.hideTitle, hideTitle = _d === void 0 ? false : _d;
22196
+ var defaultStyles = {
20511
22197
  gap: 4,
20512
22198
  shadow: "sm",
20513
22199
  subscriptionProductNameStyle: {
20514
22200
  fontSize: "11px",
20515
22201
  fontWeight: 500,
20516
22202
  },
20517
- } : _c, noSubscriptionsComponent = _a.noSubscriptionsComponent;
20518
- var gap = styles.gap, shadow = styles.shadow;
22203
+ };
22204
+ var styles = __assign(__assign({}, defaultStyles), userStyles);
22205
+ var _e = useState(undefined), upgradingSubscription = _e[0], setUpgradingSubscription = _e[1];
22206
+ var _f = useState(undefined), updatingChargeQuantityId = _f[0], setUpdatingChargeQuantityId = _f[1];
22207
+ var _g = useState(undefined), quotePreviewData = _g[0], setQuotePreviewData = _g[1];
22208
+ var _h = useState(null), subscriptionUpgradeId = _h[0], setSubscriptionUpgradeId = _h[1];
22209
+ return (jsx(SubscriptionsContext.Provider, __assign({ value: {
22210
+ gap: styles.gap,
22211
+ shadow: styles.shadow,
22212
+ className: className,
22213
+ subscriptionProductNameStyle: styles.subscriptionProductNameStyle,
22214
+ productId: productId,
22215
+ entityId: entityId,
22216
+ isInPreviewMode: isInPreviewMode,
22217
+ upgradingSubscription: upgradingSubscription,
22218
+ setUpgradingSubscription: setUpgradingSubscription,
22219
+ updatingChargeQuantityId: updatingChargeQuantityId,
22220
+ setUpdatingChargeQuantityId: setUpdatingChargeQuantityId,
22221
+ quotePreviewData: quotePreviewData,
22222
+ setQuotePreviewData: setQuotePreviewData,
22223
+ subscriptionUpgradeId: subscriptionUpgradeId,
22224
+ setSubscriptionUpgradeId: setSubscriptionUpgradeId,
22225
+ } }, { children: jsx(Subscriptions, { handlePortalErrors: handlePortalErrors, companyName: companyName, noSubscriptionsComponent: noSubscriptionsComponent, hideTitle: hideTitle }) })));
22226
+ };
22227
+ var Subscriptions = function (_a) {
22228
+ var handlePortalErrors = _a.handlePortalErrors, companyName = _a.companyName, noSubscriptionsComponent = _a.noSubscriptionsComponent, hideTitle = _a.hideTitle;
20519
22229
  // Context
20520
- var apiHost = useContext(BunnyContext).apiHost;
20521
22230
  var token = useToken();
22231
+ var _b = useContext(BunnyContext), apiHost = _b.apiHost, graphQLClient = _b.graphQLClient;
22232
+ var _c = useContext(SubscriptionsContext), entityId = _c.entityId, setUpgradingSubscription = _c.setUpgradingSubscription, updatingChargeQuantityId = _c.updatingChargeQuantityId, setUpdatingChargeQuantityId = _c.setUpdatingChargeQuantityId, setSubscriptionUpgradeId = _c.setSubscriptionUpgradeId, className = _c.className, isInPreviewMode = _c.isInPreviewMode;
22233
+ // Local state
22234
+ var _d = useState(), editingQuoteData = _d[0], setEditingQuoteData = _d[1];
22235
+ var _e = useState(false), payModalVisible = _e[0], setPayModalVisible = _e[1];
22236
+ var _f = useState(true), hideExpired = _f[0], setHideExpired = _f[1];
22237
+ var _g = useState(false), quantityDrawerOpen = _g[0], setQuantityDrawerOpen = _g[1];
22238
+ var _h = useState(false), expiredSwitchVisible = _h[0], setExpiredSwitchVisible = _h[1];
22239
+ var _j = useState(false), isChangingPlan = _j[0], setIsChangingPlan = _j[1];
22240
+ // Hooks
22241
+ var queryClient = useQueryClient();
22242
+ var showSuccessNotification = useSuccessNotification();
22243
+ var quoteDelete = useQuoteDelete();
22244
+ var isMobile = useIsMobile();
22245
+ var storedPaymentMethod = usePaymentMethod({
22246
+ graphQLClient: graphQLClient,
22247
+ token: token,
22248
+ }).data;
22249
+ var cancelSubscription = useCancelSubscription();
20522
22250
  // Queries
20523
- var _d = useQuery({
22251
+ var quote = useQuery({
22252
+ queryKey: QueryKeyFactory.default.createObjectKey({
22253
+ id: editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.id,
22254
+ objectName: "editingQuote",
22255
+ token: token,
22256
+ }),
22257
+ queryFn: function () {
22258
+ return (editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.id)
22259
+ ? getQuote({ token: token, id: editingQuoteData.id, apiHost: apiHost })
22260
+ : undefined;
22261
+ },
22262
+ enabled: Boolean(editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.id),
22263
+ }).data;
22264
+ var _k = useQuery({
20524
22265
  queryKey: QueryKeyFactory.default.createTableKey({
20525
22266
  filterString: "entityId=".concat(entityId),
20526
22267
  pluralType: "subscriptions",
@@ -20528,23 +22269,110 @@ var Subscriptions = function (_a) {
20528
22269
  }),
20529
22270
  queryFn: function () { return getSubscriptions({ entityId: entityId, token: token, apiHost: apiHost }); },
20530
22271
  enabled: Boolean(entityId),
20531
- }), subscriptions = _d.data, subscriptionsAreLoading = _d.isLoading;
20532
- var _e = useQuery({
20533
- queryKey: QueryKeyFactory.default.planChangeOptionsKey({ token: token }),
20534
- queryFn: function () { return getPlanChangeOptions({ token: token, apiHost: apiHost }); },
20535
- enabled: Boolean(onChangePlanClick),
20536
- }), planChangeOptions = _e.data, arePlanChangeOptionsLoading = _e.isLoading;
22272
+ }), subscriptions = _k.data, subscriptionsAreLoading = _k.isLoading;
22273
+ // Mutations
22274
+ var subscriptionCancel = useMutation({
22275
+ mutationFn: function (subscription) {
22276
+ return cancelSubscription([subscription.id], token, apiHost);
22277
+ },
22278
+ onSuccess: function () {
22279
+ queryClient.invalidateQueries({
22280
+ queryKey: QueryKeyFactory.default.createTableKey({
22281
+ filterString: "entityId=".concat(entityId),
22282
+ pluralType: "subscriptions",
22283
+ token: token,
22284
+ }),
22285
+ });
22286
+ showSuccessNotification("Subscription canceled");
22287
+ },
22288
+ });
22289
+ // Handlers
22290
+ var onChangePlanClick = function (subscription) {
22291
+ if (subscription) {
22292
+ setSubscriptionUpgradeId(subscription.id);
22293
+ setUpgradingSubscription(subscription);
22294
+ }
22295
+ else {
22296
+ setSubscriptionUpgradeId(null);
22297
+ setUpgradingSubscription(undefined);
22298
+ }
22299
+ console.log("setIsChangingPlan true");
22300
+ setIsChangingPlan(true);
22301
+ };
22302
+ var onCancelSubscriptionClick = function (subscription) {
22303
+ subscriptionCancel.mutate(subscription);
22304
+ };
22305
+ var onSuccess = function () {
22306
+ setQuantityDrawerOpen(false);
22307
+ setEditingQuoteData(undefined);
22308
+ queryClient.invalidateQueries({
22309
+ queryKey: QueryKeyFactory.default.transactionsKey({ token: token }),
22310
+ });
22311
+ queryClient.invalidateQueries({
22312
+ queryKey: QueryKeyFactory.default.createTableKey({
22313
+ filterString: "entityId=".concat(entityId),
22314
+ pluralType: "subscriptions",
22315
+ token: token,
22316
+ }),
22317
+ });
22318
+ showSuccessNotification("Your plan has been updated", "Payment successful");
22319
+ setPayModalVisible(false);
22320
+ setHideExpired(true);
22321
+ };
22322
+ var onCancel = function () {
22323
+ setPayModalVisible(false);
22324
+ };
22325
+ var onFail = function (error) {
22326
+ handlePortalErrors(error);
22327
+ };
22328
+ var onClose = function () {
22329
+ if (editingQuoteData) {
22330
+ quoteDelete(editingQuoteData.id, token, apiHost);
22331
+ setEditingQuoteData(undefined);
22332
+ }
22333
+ if (updatingChargeQuantityId) {
22334
+ setUpdatingChargeQuantityId(undefined);
22335
+ }
22336
+ setQuantityDrawerOpen(false);
22337
+ };
22338
+ var allSubscriptionsExpired = subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.every(function (subscription) {
22339
+ var _a, _b;
22340
+ return ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState$2.EXPIRED ||
22341
+ ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState$2.CANCELED;
22342
+ });
22343
+ var hasExpiredOrCanceledSubscriptions = subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.some(function (subscription) {
22344
+ var _a, _b;
22345
+ return ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState$2.EXPIRED ||
22346
+ ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState$2.CANCELED;
22347
+ });
20537
22348
  useEffect(function () {
20538
- if (subscriptions)
20539
- onSubscriptionsLoaded === null || onSubscriptionsLoaded === void 0 ? void 0 : onSubscriptionsLoaded(subscriptions);
20540
- }, [subscriptions]);
20541
- if (subscriptionsAreLoading || (Boolean(onChangePlanClick) ? arePlanChangeOptionsLoading : false))
20542
- return jsx(Fragment, {});
20543
- return (jsx(SubscriptionsContext.Provider, __assign({ value: {
20544
- gap: gap,
20545
- shadow: shadow,
20546
- subscriptionProductNameStyle: styles.subscriptionProductNameStyle,
20547
- } }, { children: jsx("div", __assign({ className: "flex flex-col gap-".concat(gap, " shrink shadow-padding-xb overflow-auto ").concat(className) }, { children: (subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.length) > 0 ? (jsx(SubscriptionsList, { hideExpired: hideExpired, onChangePlanClick: onChangePlanClick, onCancelSubscriptionClick: onCancelSubscriptionClick, planChangeOptions: planChangeOptions, subscriptions: subscriptions })) : (noSubscriptionsComponent || (jsx("div", __assign({ className: "flex flex-col items-center w-full" }, { children: jsx(ErrorView, { message: "You have no subscriptions with ".concat(companyName, " yet") }) })))) })) })));
22349
+ if (allSubscriptionsExpired && subscriptions.length > 0)
22350
+ setHideExpired(false);
22351
+ }, [allSubscriptionsExpired, subscriptions]);
22352
+ useEffect(function () {
22353
+ if (hasExpiredOrCanceledSubscriptions && subscriptions.length > 0)
22354
+ setExpiredSwitchVisible(true);
22355
+ }, [hasExpiredOrCanceledSubscriptions, subscriptions]);
22356
+ useEffect(function () {
22357
+ console.log("isChangingPlan", isChangingPlan);
22358
+ }, [isChangingPlan]);
22359
+ if (isChangingPlan || isInPreviewMode) {
22360
+ return (jsx(PlanManager, { onChangePlanCancel: function () {
22361
+ console.log("setIsChangingPlan false");
22362
+ setIsChangingPlan(false);
22363
+ }, handlePortalErrors: handlePortalErrors }));
22364
+ }
22365
+ return (jsxs("div", __assign({ className: "".concat(className, " px-8") }, { children: [!hideTitle ? jsx(PageTitle, { title: "Subscriptions" }) : null, jsx(PageHeaderWithActions, __assign({ title: jsxs(Text, __assign({ className: "flex items-center justify-between", style: { minWidth: "137px" } }, { children: [hideExpired ? "Active subscriptions" : "All subscriptions", isMobile && (jsx(HideExpiredToggle, { hideExpired: hideExpired, setHideExpired: setHideExpired, visible: expiredSwitchVisible }))] })) }, { children: !isMobile && (jsx(SubscriptionsNavigation, { expiredSwitchVisible: expiredSwitchVisible, hideExpired: hideExpired, setHideExpired: setHideExpired, 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: "pt-4 pb-2" }, { children: jsx(SubscriptionsNavigation, { expiredSwitchVisible: expiredSwitchVisible, hideExpired: hideExpired, setHideExpired: setHideExpired, setQuantityDrawerOpen: setQuantityDrawerOpen, subscriptions: subscriptions }) }))), jsx(Footer, {}), jsx(QuantityChangeDrawerDesktop, { editingQuote: quote, editingQuoteData: editingQuoteData, onClose: onClose, open: quantityDrawerOpen, openCheckout: function () { return setPayModalVisible(true); }, setEditingQuoteData: setEditingQuoteData, subscriptions: subscriptions }), jsx(Checkout, { entityId: entityId, onCancel: onCancel, onSuccess: onSuccess, onFail: onFail, open: payModalVisible, quote: quote, token: token, isMobile: isMobile, storedPaymentMethod: storedPaymentMethod })] })));
22366
+ };
22367
+ var PageHeaderWithActions = function (_a) {
22368
+ var children = _a.children, title = _a.title;
22369
+ var isMobile = useIsMobile();
22370
+ return (jsxs("div", __assign({ className: "flex pb-4 ".concat(isMobile ? "flex-col gap-2" : "items-center justify-between h-8") }, { children: [jsx(PageSubTitle, { title: title }), children] })));
22371
+ };
22372
+ var PageSubTitle = function (_a) {
22373
+ var title = _a.title;
22374
+ var secondaryColor = useContext(BrandContext).secondaryColor;
22375
+ return (jsx("div", __assign({ className: "shrink-0 font-medium", style: { color: secondaryColor } }, { children: title })));
20548
22376
  };
20549
22377
 
20550
22378
  var MUTATION = "\nmutation BillingDetailsUpdate(\n $attributes: BillingDetailsAttributes!) {\n billingDetailsUpdate(\n attributes: $attributes\n ) {\n billingDetails {\n billingCity\n billingContact {\n email\n }\n billingCountry\n billingState\n billingStreet\n billingZip\n name\n taxNumber\n }\n errors\n }\n }\n";
@@ -20626,7 +22454,10 @@ function BillingDetailsSection(_a) {
20626
22454
  onSuccess: function () {
20627
22455
  showSuccessNotification("Your account details have been saved");
20628
22456
  queryClient.invalidateQueries({
20629
- queryKey: QueryKeyFactory.default.taxationRequiredAccountFieldsKey({ entityId: entityId, token: token }),
22457
+ queryKey: QueryKeyFactory.default.taxationRequiredAccountFieldsKey({
22458
+ entityId: entityId,
22459
+ token: token,
22460
+ }),
20630
22461
  });
20631
22462
  },
20632
22463
  }), updateBillingDetails = _e.mutate, isUpdatingBillingDetails = _e.isPending;
@@ -20707,7 +22538,9 @@ function BillingDetailsSection(_a) {
20707
22538
  });
20708
22539
  }); };
20709
22540
  var filteredCountryList = useMemo(function () {
20710
- return countryListFilter ? Lists.COUNTRY_LIST.filter(countryListFilter) : Lists.COUNTRY_LIST;
22541
+ return countryListFilter
22542
+ ? Lists.COUNTRY_LIST.filter(countryListFilter)
22543
+ : Lists.COUNTRY_LIST;
20711
22544
  }, [countryListFilter]);
20712
22545
  return (jsxs("div", __assign({ className: "".concat(isMobile || hidePaymentMethodForm ? "w-full" : "w-1/2", " px-4") }, { children: [jsx(Skeleton, __assign({ loading: isLoadingBillingDetails }, { children: jsxs(Form, __assign({ className: "flex flex-col gap-2", form: form, layout: "vertical", disabled: isUpdatingBillingDetails, autoComplete: "off" }, { children: [jsx(Form.Item, __assign({ label: "Account name", name: "name", rules: [{ required: true, message: "Account name is required" }] }, { children: jsx(Input, {}) })), jsx(Form.Item, __assign({ label: "Street address", name: "billingStreet", rules: [{ required: true, message: "Street address is required" }] }, { children: jsx(Input, {}) })), jsxs("div", __assign({ className: "flex gap-4" }, { children: [jsx(Form.Item, __assign({ label: "City", name: "billingCity", rules: [{ required: true, message: "City is required" }], className: "flex-1" }, { children: jsx(Input, {}) })), jsx(Form.Item, __assign({ label: "Zipcode", name: "billingZip", rules: [{ required: true, message: "Zipcode is required" }], className: "flex-1" }, { children: jsx(Input, {}) }))] })), jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col pb-2" : "flex-row", " gap-4") }, { children: [jsx(Form.Item, __assign({ label: "State", name: "billingState", className: "flex-1", rules: [
20713
22546
  {
@@ -20715,8 +22548,12 @@ function BillingDetailsSection(_a) {
20715
22548
  },
20716
22549
  ] }, { children: jsx(Input, {}) })), jsx(Form.Item, __assign({ label: "Country", name: "billingCountry", className: "flex-1", rules: [{ required: true, message: "Country is required" }] }, { children: jsx(Select, { options: filteredCountryList, placeholder: "Select a country", showSearch: true, filterOption: function (input, option) {
20717
22550
  var _a, _b;
20718
- return ((_a = option === null || option === void 0 ? void 0 : option.label) !== null && _a !== void 0 ? _a : "").toLowerCase().includes(input.toLowerCase()) ||
20719
- ((_b = option === null || option === void 0 ? void 0 : option.value) !== null && _b !== void 0 ? _b : "").toLowerCase().includes(input.toLowerCase());
22551
+ return ((_a = option === null || option === void 0 ? void 0 : option.label) !== null && _a !== void 0 ? _a : "")
22552
+ .toLowerCase()
22553
+ .includes(input.toLowerCase()) ||
22554
+ ((_b = option === null || option === void 0 ? void 0 : option.value) !== null && _b !== void 0 ? _b : "")
22555
+ .toLowerCase()
22556
+ .includes(input.toLowerCase());
20720
22557
  } }) }))] })), jsx(Form.Item, __assign({ label: "Email", name: "billingContactEmail", rules: [
20721
22558
  {
20722
22559
  required: true,
@@ -20753,4 +22590,4 @@ var PaymentFormSection = function (_a) {
20753
22590
  }, graphQLClient: graphQLClient }) })));
20754
22591
  };
20755
22592
 
20756
- export { BillingDetails, BunnyProvider, Checkout, Invoice, PaymentForm, PaymentMethod, Quote, Quotes, Signup, Subscriptions, Transactions, getQuoteAmountDue, usePaymentMethod };
22593
+ export { BillingDetails, BunnyProvider, Invoice, PaymentForm, PaymentMethod, Quote, Quotes, Signup, SubscriptionsWrapper as Subscriptions, Transactions };