@bunnyapp/components 1.0.7 → 1.0.8

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 (170) hide show
  1. package/dist/cjs/index.js +730 -1052
  2. package/dist/cjs/playground/main.d.ts +1 -1
  3. package/dist/cjs/src/ajax.d.ts +1 -0
  4. package/dist/cjs/src/components/BunnyProvider.d.ts +9 -5
  5. package/dist/cjs/src/components/Checkout/Checkout.d.ts +4 -2
  6. package/dist/cjs/src/components/Checkout/InvoiceCheckout.d.ts +2 -1
  7. package/dist/cjs/src/components/Checkout/QuoteCheckout.d.ts +2 -1
  8. package/dist/cjs/src/components/FeatureUsageGraph.d.ts +1 -1
  9. package/dist/cjs/src/components/Invoice/Invoice.d.ts +2 -2
  10. package/dist/cjs/src/components/Invoice/InvoiceQuoteView.d.ts +1 -2
  11. package/dist/cjs/src/components/LegacyInvoicePDF.d.ts +2 -2
  12. package/dist/cjs/src/components/PaymentForm/DemoPay/demoPayUtils.d.ts +1 -1
  13. package/dist/cjs/src/components/PaymentForm/Finix/FinixCardForm.d.ts +1 -1
  14. package/dist/cjs/src/components/PaymentForm/FinixAch.d.ts +1 -1
  15. package/dist/cjs/src/components/PaymentForm/PaymentForm.d.ts +1 -1
  16. package/dist/cjs/src/components/PaymentForm/PaymentFormTypes.d.ts +1 -0
  17. package/dist/cjs/src/components/PaymentForm/PaymentMethod/PaymentMethod.d.ts +2 -2
  18. package/dist/cjs/src/components/PaymentForm/PaymentMethod/PaymentMethodContext.d.ts +0 -1
  19. package/dist/cjs/src/components/PaymentForm/PaymentMethodForm.d.ts +1 -1
  20. package/dist/cjs/src/components/PaymentForm/Stripe/StripeForm.d.ts +1 -1
  21. package/dist/cjs/src/components/PaymentForm/Stripe/stripeUtils.d.ts +6 -6
  22. package/dist/cjs/src/components/PaymentForm/paymentUtils.d.ts +2 -2
  23. package/dist/cjs/src/components/Quote/Quote.d.ts +2 -2
  24. package/dist/cjs/src/components/Quotes/Quotes.d.ts +2 -1
  25. package/dist/cjs/src/components/Signup/PaymentForms.d.ts +2 -2
  26. package/dist/cjs/src/components/Signup/PaymentSuccess.d.ts +4 -3
  27. package/dist/cjs/src/components/Signup/Signup.d.ts +3 -1
  28. package/dist/cjs/src/components/Subscriptions/Subscriptions.d.ts +4 -2
  29. package/dist/cjs/src/components/Subscriptions/subscriptionsList/SubscriptionsList.d.ts +1 -1
  30. package/dist/cjs/src/components/Subscriptions/subscriptionsList/subscriptionCardDesktop/SubscriptionCardColumnHeaders.d.ts +1 -1
  31. package/dist/cjs/src/components/Subscriptions/subscriptionsList/subscriptionUtils.d.ts +1 -2
  32. package/dist/cjs/src/components/Transactions/Transactions.d.ts +3 -1
  33. package/dist/cjs/src/components/Transactions/TransactionsListContext.d.ts +1 -0
  34. package/dist/cjs/src/components/Transactions/transactionsList/TransactionDownload.d.ts +2 -2
  35. package/dist/cjs/src/components/Transactions/transactionsList/TransactionsListDesktop.d.ts +1 -11
  36. package/dist/cjs/src/contexts/NavigationContext.d.ts +1 -1
  37. package/dist/cjs/src/graphql/mutations/accountSignup.d.ts +2 -2
  38. package/dist/cjs/src/graphql/mutations/accountUpdate.d.ts +2 -1
  39. package/dist/cjs/src/graphql/mutations/checkout.d.ts +2 -2
  40. package/dist/cjs/src/graphql/mutations/portalSessionCreate.d.ts +2 -2
  41. package/dist/cjs/src/graphql/mutations/quoteAccountSignup.d.ts +2 -2
  42. package/dist/cjs/src/graphql/mutations/quoteAddCoupon.d.ts +2 -1
  43. package/dist/cjs/src/graphql/mutations/quoteCompose.d.ts +2 -2
  44. package/dist/cjs/src/graphql/mutations/quoteCreate.d.ts +2 -2
  45. package/dist/cjs/src/graphql/mutations/quoteRecalculateTaxes.d.ts +2 -1
  46. package/dist/cjs/src/graphql/mutations/quoteSubscriptionReinstate.d.ts +2 -2
  47. package/dist/cjs/src/graphql/queries/getAccount.d.ts +2 -2
  48. package/dist/cjs/src/graphql/queries/getBranding.d.ts +2 -2
  49. package/dist/cjs/src/graphql/queries/getCurrentUserData.d.ts +2 -2
  50. package/dist/cjs/src/graphql/queries/getFeatureUsage.d.ts +2 -1
  51. package/dist/cjs/src/graphql/queries/getFormattedQuote.d.ts +2 -2
  52. package/dist/cjs/src/graphql/queries/getInvoice.d.ts +2 -2
  53. package/dist/cjs/src/graphql/queries/getPlanChangeOptions.d.ts +2 -2
  54. package/dist/cjs/src/graphql/queries/getPriceList.d.ts +2 -2
  55. package/dist/cjs/src/graphql/queries/getQuote.d.ts +2 -2
  56. package/dist/cjs/src/graphql/queries/getQuotes.d.ts +2 -2
  57. package/dist/cjs/src/graphql/queries/getSubscription.d.ts +2 -2
  58. package/dist/cjs/src/graphql/queries/getSubscriptions.d.ts +2 -2
  59. package/dist/cjs/src/graphql/queries/getTaxationRequiredAccountFields.d.ts +6 -0
  60. package/dist/cjs/src/graphql/queries/getTransactions.d.ts +1 -1
  61. package/dist/cjs/src/hooks/quotes/useSendAcceptQuote.d.ts +7 -1
  62. package/dist/cjs/src/hooks/useHasTaxPlugin.d.ts +3 -2
  63. package/dist/cjs/src/hooks/usePaymentPlugins.d.ts +11 -0
  64. package/dist/cjs/src/hooks/usePlugins.d.ts +6 -0
  65. package/dist/cjs/src/hooks/useSigningPlugins.d.ts +5 -1
  66. package/dist/cjs/src/index.d.ts +1 -0
  67. package/dist/cjs/src/utils/GraphQLClient.d.ts +2 -0
  68. package/dist/cjs/src/utils/quoteInvoiceUtils.d.ts +6 -0
  69. package/dist/esm/index.js +722 -1043
  70. package/dist/esm/playground/main.d.ts +1 -1
  71. package/dist/esm/src/ajax.d.ts +1 -0
  72. package/dist/esm/src/components/BunnyProvider.d.ts +9 -5
  73. package/dist/esm/src/components/Checkout/Checkout.d.ts +4 -2
  74. package/dist/esm/src/components/Checkout/InvoiceCheckout.d.ts +2 -1
  75. package/dist/esm/src/components/Checkout/QuoteCheckout.d.ts +2 -1
  76. package/dist/esm/src/components/FeatureUsageGraph.d.ts +1 -1
  77. package/dist/esm/src/components/Invoice/Invoice.d.ts +2 -2
  78. package/dist/esm/src/components/Invoice/InvoiceQuoteView.d.ts +1 -2
  79. package/dist/esm/src/components/LegacyInvoicePDF.d.ts +2 -2
  80. package/dist/esm/src/components/PaymentForm/DemoPay/demoPayUtils.d.ts +1 -1
  81. package/dist/esm/src/components/PaymentForm/Finix/FinixCardForm.d.ts +1 -1
  82. package/dist/esm/src/components/PaymentForm/FinixAch.d.ts +1 -1
  83. package/dist/esm/src/components/PaymentForm/PaymentForm.d.ts +1 -1
  84. package/dist/esm/src/components/PaymentForm/PaymentFormTypes.d.ts +1 -0
  85. package/dist/esm/src/components/PaymentForm/PaymentMethod/PaymentMethod.d.ts +2 -2
  86. package/dist/esm/src/components/PaymentForm/PaymentMethod/PaymentMethodContext.d.ts +0 -1
  87. package/dist/esm/src/components/PaymentForm/PaymentMethodForm.d.ts +1 -1
  88. package/dist/esm/src/components/PaymentForm/Stripe/StripeForm.d.ts +1 -1
  89. package/dist/esm/src/components/PaymentForm/Stripe/stripeUtils.d.ts +6 -6
  90. package/dist/esm/src/components/PaymentForm/paymentUtils.d.ts +2 -2
  91. package/dist/esm/src/components/Quote/Quote.d.ts +2 -2
  92. package/dist/esm/src/components/Quotes/Quotes.d.ts +2 -1
  93. package/dist/esm/src/components/Signup/PaymentForms.d.ts +2 -2
  94. package/dist/esm/src/components/Signup/PaymentSuccess.d.ts +4 -3
  95. package/dist/esm/src/components/Signup/Signup.d.ts +3 -1
  96. package/dist/esm/src/components/Subscriptions/Subscriptions.d.ts +4 -2
  97. package/dist/esm/src/components/Subscriptions/subscriptionsList/SubscriptionsList.d.ts +1 -1
  98. package/dist/esm/src/components/Subscriptions/subscriptionsList/subscriptionCardDesktop/SubscriptionCardColumnHeaders.d.ts +1 -1
  99. package/dist/esm/src/components/Subscriptions/subscriptionsList/subscriptionUtils.d.ts +1 -2
  100. package/dist/esm/src/components/Transactions/Transactions.d.ts +3 -1
  101. package/dist/esm/src/components/Transactions/TransactionsListContext.d.ts +1 -0
  102. package/dist/esm/src/components/Transactions/transactionsList/TransactionDownload.d.ts +2 -2
  103. package/dist/esm/src/components/Transactions/transactionsList/TransactionsListDesktop.d.ts +1 -11
  104. package/dist/esm/src/contexts/NavigationContext.d.ts +1 -1
  105. package/dist/esm/src/graphql/mutations/accountSignup.d.ts +2 -2
  106. package/dist/esm/src/graphql/mutations/accountUpdate.d.ts +2 -1
  107. package/dist/esm/src/graphql/mutations/checkout.d.ts +2 -2
  108. package/dist/esm/src/graphql/mutations/portalSessionCreate.d.ts +2 -2
  109. package/dist/esm/src/graphql/mutations/quoteAccountSignup.d.ts +2 -2
  110. package/dist/esm/src/graphql/mutations/quoteAddCoupon.d.ts +2 -1
  111. package/dist/esm/src/graphql/mutations/quoteCompose.d.ts +2 -2
  112. package/dist/esm/src/graphql/mutations/quoteCreate.d.ts +2 -2
  113. package/dist/esm/src/graphql/mutations/quoteRecalculateTaxes.d.ts +2 -1
  114. package/dist/esm/src/graphql/mutations/quoteSubscriptionReinstate.d.ts +2 -2
  115. package/dist/esm/src/graphql/queries/getAccount.d.ts +2 -2
  116. package/dist/esm/src/graphql/queries/getBranding.d.ts +2 -2
  117. package/dist/esm/src/graphql/queries/getCurrentUserData.d.ts +2 -2
  118. package/dist/esm/src/graphql/queries/getFeatureUsage.d.ts +2 -1
  119. package/dist/esm/src/graphql/queries/getFormattedQuote.d.ts +2 -2
  120. package/dist/esm/src/graphql/queries/getInvoice.d.ts +2 -2
  121. package/dist/esm/src/graphql/queries/getPlanChangeOptions.d.ts +2 -2
  122. package/dist/esm/src/graphql/queries/getPriceList.d.ts +2 -2
  123. package/dist/esm/src/graphql/queries/getQuote.d.ts +2 -2
  124. package/dist/esm/src/graphql/queries/getQuotes.d.ts +2 -2
  125. package/dist/esm/src/graphql/queries/getSubscription.d.ts +2 -2
  126. package/dist/esm/src/graphql/queries/getSubscriptions.d.ts +2 -2
  127. package/dist/esm/src/graphql/queries/getTaxationRequiredAccountFields.d.ts +6 -0
  128. package/dist/esm/src/graphql/queries/getTransactions.d.ts +1 -1
  129. package/dist/esm/src/hooks/quotes/useSendAcceptQuote.d.ts +7 -1
  130. package/dist/esm/src/hooks/useHasTaxPlugin.d.ts +3 -2
  131. package/dist/esm/src/hooks/usePaymentPlugins.d.ts +11 -0
  132. package/dist/esm/src/hooks/usePlugins.d.ts +6 -0
  133. package/dist/esm/src/hooks/useSigningPlugins.d.ts +5 -1
  134. package/dist/esm/src/index.d.ts +1 -0
  135. package/dist/esm/src/utils/GraphQLClient.d.ts +2 -0
  136. package/dist/esm/src/utils/quoteInvoiceUtils.d.ts +6 -0
  137. package/dist/index.d.ts +28 -14
  138. package/package.json +10 -7
  139. package/dist/cjs/src/atoms/pageContentRefAtom.d.ts +0 -1
  140. package/dist/cjs/src/atoms/planPickerQuoteDataAtom.d.ts +0 -2
  141. package/dist/cjs/src/atoms/updatingChargeQuantityIdAtom.d.ts +0 -2
  142. package/dist/cjs/src/components/Footer.d.ts +0 -4
  143. package/dist/cjs/src/components/PageContent.d.ts +0 -7
  144. package/dist/cjs/src/features/quantityChangeDrawer/QuantityChangeGridRow.d.ts +0 -11
  145. package/dist/cjs/src/features/quantityChangeDrawer/QuantityChangeGridTitle.d.ts +0 -6
  146. package/dist/cjs/src/features/quantityChangeDrawer/QuantityInput.d.ts +0 -21
  147. package/dist/cjs/src/features/quantityChangeDrawer/QuoteChangeSummarySection.d.ts +0 -9
  148. package/dist/cjs/src/features/quantityChangeDrawer/quantityChangeDrawerDesktop/QuantityChangeDrawerDesktop.d.ts +0 -14
  149. package/dist/cjs/src/graphql/QuoteRequests.d.ts +0 -6
  150. package/dist/cjs/src/graphql/SubscriptionRequests.d.ts +0 -2
  151. package/dist/cjs/src/graphql/queries/getFormattedInvoice.d.ts +0 -7
  152. package/dist/cjs/src/hooks/useCurrentUserData.d.ts +0 -2
  153. package/dist/cjs/src/hooks/useIsMobile.d.ts +0 -10
  154. package/dist/cjs/src/utils.d.ts +0 -9
  155. package/dist/esm/src/atoms/pageContentRefAtom.d.ts +0 -1
  156. package/dist/esm/src/atoms/planPickerQuoteDataAtom.d.ts +0 -2
  157. package/dist/esm/src/atoms/updatingChargeQuantityIdAtom.d.ts +0 -2
  158. package/dist/esm/src/components/Footer.d.ts +0 -4
  159. package/dist/esm/src/components/PageContent.d.ts +0 -7
  160. package/dist/esm/src/features/quantityChangeDrawer/QuantityChangeGridRow.d.ts +0 -11
  161. package/dist/esm/src/features/quantityChangeDrawer/QuantityChangeGridTitle.d.ts +0 -6
  162. package/dist/esm/src/features/quantityChangeDrawer/QuantityInput.d.ts +0 -21
  163. package/dist/esm/src/features/quantityChangeDrawer/QuoteChangeSummarySection.d.ts +0 -9
  164. package/dist/esm/src/features/quantityChangeDrawer/quantityChangeDrawerDesktop/QuantityChangeDrawerDesktop.d.ts +0 -14
  165. package/dist/esm/src/graphql/QuoteRequests.d.ts +0 -6
  166. package/dist/esm/src/graphql/SubscriptionRequests.d.ts +0 -2
  167. package/dist/esm/src/graphql/queries/getFormattedInvoice.d.ts +0 -7
  168. package/dist/esm/src/hooks/useCurrentUserData.d.ts +0 -2
  169. package/dist/esm/src/hooks/useIsMobile.d.ts +0 -10
  170. package/dist/esm/src/utils.d.ts +0 -9
package/dist/esm/index.js CHANGED
@@ -4,17 +4,47 @@ import React__default, { createContext, useContext, useEffect, useState, useMemo
4
4
  import { Markup } from 'interweave';
5
5
  import { ConfigProvider, Button, Typography, Checkbox, Input, Divider, Modal, Form, Tag, Drawer, Card as Card$1, Popconfirm, Select, Image, Dropdown } from 'antd';
6
6
  import styled from 'styled-components';
7
- import { DEFAULT_ACCENT_COLOR, DEFAULT_BRAND_COLOR, DEFAULT_SECONDARY_COLOR, DEFAULT_TOP_NAV_IMAGE_URL, gqlRequest, createGraphQLClient, Misc, MARK_PRO, INPUT_BORDER_COLOR, SLATE_50, SLATE_400, SLATE_200, QueryKeyFactory, useDownloadFile, NotificationUtils, invokePlugin, useIsMobile as useIsMobile$1, GRAY_500, GRAY_200, CHARCOAL_GRAY, StringUtils, usePaymentPlugins, ApiUtils, PAYABLE_INVOICE_STATES, DOCUMENT_NAME as DOCUMENT_NAME$1, QuoteInvoiceUtils, usePlugins, GraphqlUtils, FrontendTransaction, SLATE_600, WHITE, TransactionKind, Lists, getTaxationRequiredAccountFields, getAccount, useCurrentUserData, SLATE_500, PRIMARY_COLOR, SubscriptionState as SubscriptionState$2, MODAL_MAX_HEIGHT, DataInterval, TAG_COLORS, ChargeType } from '@bunnyapp/common';
7
+ import { DEFAULT_ACCENT_COLOR, DEFAULT_BRAND_COLOR, DEFAULT_SECONDARY_COLOR, DEFAULT_TOP_NAV_IMAGE_URL, gqlRequest, useIsMobile, isColorTooDark, MARK_PRO, INPUT_BORDER_COLOR, SLATE_50, SLATE_400, SLATE_200, QueryKeyFactory, useErrorNotification, invokePlugin, formatCurrency, GRAY_500, GRAY_200, CHARCOAL_GRAY, StringUtils, getPlugins, useSuccessNotification, useAllErrorFormats, getFormattedInvoice, PAYABLE_INVOICE_STATES, DOCUMENT_NAME as DOCUMENT_NAME$1, useGraphQLmutation, formatDate, FrontendTransaction, SLATE_600, WHITE, TransactionKind, Lists, getAccount, SubscriptionState as SubscriptionState$2, MODAL_MAX_HEIGHT, SLATE_500, DataInterval, TAG_COLORS, ChargeType } from '@bunnyapp/common';
8
8
  import { QueryClient, QueryClientProvider, useQuery, useMutation, useQueryClient, keepPreviousData } from '@tanstack/react-query';
9
- import { RecoilRoot, atom, useSetRecoilState, useRecoilValue, useRecoilState } from 'recoil';
10
9
  import theme from 'antd/lib/theme';
10
+ import { RecoilRoot } from 'recoil';
11
+ import { GraphQLClient } from 'graphql-request';
11
12
  import { HelmetProvider, Helmet } from 'react-helmet-async';
12
13
  import { useElements, useStripe, PaymentElement, Elements } from '@stripe/react-stripe-js';
13
14
  import { loadStripe } from '@stripe/stripe-js/pure';
14
15
  import { capitalize, startCase, cloneDeep, omit } from 'lodash';
15
- import request from 'graphql-request';
16
16
  import { BarChart, ResponsiveContainer, XAxis, Tooltip, Bar, Rectangle } from 'recharts';
17
17
 
18
+ function styleInject(css, ref) {
19
+ if ( ref === void 0 ) ref = {};
20
+ var insertAt = ref.insertAt;
21
+
22
+ if (!css || typeof document === 'undefined') { return; }
23
+
24
+ var head = document.head || document.getElementsByTagName('head')[0];
25
+ var style = document.createElement('style');
26
+ style.type = 'text/css';
27
+
28
+ if (insertAt === 'top') {
29
+ if (head.firstChild) {
30
+ head.insertBefore(style, head.firstChild);
31
+ } else {
32
+ head.appendChild(style);
33
+ }
34
+ } else {
35
+ head.appendChild(style);
36
+ }
37
+
38
+ if (style.styleSheet) {
39
+ style.styleSheet.cssText = css;
40
+ } else {
41
+ style.appendChild(document.createTextNode(css));
42
+ }
43
+ }
44
+
45
+ var css_248z$1 = "/*! tailwindcss v4.0.0 | MIT License | https://tailwindcss.com */\n@import url(./global-vars.less);\n@tailwind base;\n@tailwind components;\n.\\@container {\n container-type: inline-size;\n}\n.\\!visible {\n visibility: visible !important;\n}\n.collapse {\n visibility: collapse;\n}\n.invisible {\n visibility: hidden;\n}\n.visible {\n visibility: visible;\n}\n.sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n}\n.\\!fixed {\n position: fixed !important;\n}\n.\\!relative {\n position: relative !important;\n}\n.absolute {\n position: absolute;\n}\n.fixed {\n position: fixed;\n}\n.relative {\n position: relative;\n}\n.static {\n position: static;\n}\n.sticky {\n position: sticky;\n}\n.-top-1 {\n top: calc(var(--spacing) * -1);\n}\n.top-0 {\n top: calc(var(--spacing) * 0);\n}\n.right-0 {\n right: calc(var(--spacing) * 0);\n}\n.bottom-0 {\n bottom: calc(var(--spacing) * 0);\n}\n.left-0 {\n left: calc(var(--spacing) * 0);\n}\n.isolate {\n isolation: isolate;\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.float-left {\n float: left;\n}\n.float-right {\n float: right;\n}\n.\\!container {\n width: 100% !important;\n @media (width >= 40rem) {\n max-width: 40rem !important;\n }\n @media (width >= 48rem) {\n max-width: 48rem !important;\n }\n @media (width >= 64rem) {\n max-width: 64rem !important;\n }\n @media (width >= 80rem) {\n max-width: 80rem !important;\n }\n @media (width >= 96rem) {\n max-width: 96rem !important;\n }\n}\n.container {\n width: 100%;\n @media (width >= 40rem) {\n max-width: 40rem;\n }\n @media (width >= 48rem) {\n max-width: 48rem;\n }\n @media (width >= 64rem) {\n max-width: 64rem;\n }\n @media (width >= 80rem) {\n max-width: 80rem;\n }\n @media (width >= 96rem) {\n max-width: 96rem;\n }\n}\n.m-0 {\n margin: calc(var(--spacing) * 0);\n}\n.m-1 {\n margin: calc(var(--spacing) * 1);\n}\n.m-2 {\n margin: calc(var(--spacing) * 2);\n}\n.m-25 {\n margin: calc(var(--spacing) * 25);\n}\n.m-55296 {\n margin: calc(var(--spacing) * 55296);\n}\n.mx-8 {\n margin-inline: calc(var(--spacing) * 8);\n}\n.mx-auto {\n margin-inline: auto;\n}\n.my-2 {\n margin-block: calc(var(--spacing) * 2);\n}\n.my-4 {\n margin-block: calc(var(--spacing) * 4);\n}\n.my-12 {\n margin-block: calc(var(--spacing) * 12);\n}\n.me-1 {\n margin-inline-end: calc(var(--spacing) * 1);\n}\n.mt-1 {\n margin-top: calc(var(--spacing) * 1);\n}\n.mt-2 {\n margin-top: calc(var(--spacing) * 2);\n}\n.mt-4 {\n margin-top: calc(var(--spacing) * 4);\n}\n.mt-6 {\n margin-top: calc(var(--spacing) * 6);\n}\n.mt-8 {\n margin-top: calc(var(--spacing) * 8);\n}\n.mr-8 {\n margin-right: calc(var(--spacing) * 8);\n}\n.mb-2 {\n margin-bottom: calc(var(--spacing) * 2);\n}\n.mb-4 {\n margin-bottom: calc(var(--spacing) * 4);\n}\n.mb-8 {\n margin-bottom: calc(var(--spacing) * 8);\n}\n.ml-2 {\n margin-left: calc(var(--spacing) * 2);\n}\n.\\!block {\n display: block !important;\n}\n.\\!grid {\n display: grid !important;\n}\n.\\!hidden {\n display: none !important;\n}\n.\\!table {\n display: table !important;\n}\n.block {\n display: block;\n}\n.contents {\n display: contents;\n}\n.flex {\n display: flex;\n}\n.grid {\n display: grid;\n}\n.hidden {\n display: none;\n}\n.inline {\n display: inline;\n}\n.inline-block {\n display: inline-block;\n}\n.inline-flex {\n display: inline-flex;\n}\n.inline-grid {\n display: inline-grid;\n}\n.list-item {\n display: list-item;\n}\n.table {\n display: table;\n}\n.table-caption {\n display: table-caption;\n}\n.table-cell {\n display: table-cell;\n}\n.table-column {\n display: table-column;\n}\n.table-column-group {\n display: table-column-group;\n}\n.table-footer-group {\n display: table-footer-group;\n}\n.table-header-group {\n display: table-header-group;\n}\n.table-row {\n display: table-row;\n}\n.table-row-group {\n display: table-row-group;\n}\n.size-1 {\n width: calc(var(--spacing) * 1);\n height: calc(var(--spacing) * 1);\n}\n.size-4 {\n width: calc(var(--spacing) * 4);\n height: calc(var(--spacing) * 4);\n}\n.size-7 {\n width: calc(var(--spacing) * 7);\n height: calc(var(--spacing) * 7);\n}\n.size-8 {\n width: calc(var(--spacing) * 8);\n height: calc(var(--spacing) * 8);\n}\n.size-11 {\n width: calc(var(--spacing) * 11);\n height: calc(var(--spacing) * 11);\n}\n.size-15 {\n width: calc(var(--spacing) * 15);\n height: calc(var(--spacing) * 15);\n}\n.h-1 {\n height: calc(var(--spacing) * 1);\n}\n.h-3 {\n height: calc(var(--spacing) * 3);\n}\n.h-4 {\n height: calc(var(--spacing) * 4);\n}\n.h-5 {\n height: calc(var(--spacing) * 5);\n}\n.h-8 {\n height: calc(var(--spacing) * 8);\n}\n.h-100 {\n height: calc(var(--spacing) * 100);\n}\n.h-16 {\n height: calc(var(--spacing) * 16);\n}\n.h-16\\/116 {\n height: calc(16/116 * 100%);\n}\n.h-full {\n height: 100%;\n}\n.h-screen {\n height: 100vh;\n}\n.w-1 {\n width: calc(var(--spacing) * 1);\n}\n.w-1\\/2 {\n width: calc(1/2 * 100%);\n}\n.w-4 {\n width: calc(var(--spacing) * 4);\n}\n.w-12 {\n width: calc(var(--spacing) * 12);\n}\n.w-full {\n width: 100%;\n}\n.w-px {\n width: 1px;\n}\n.w-screen {\n width: 100vw;\n}\n.max-w-32 {\n max-width: calc(var(--spacing) * 32);\n}\n.flex-shrink {\n flex-shrink: 1;\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 rotate: 45deg;\n}\n.\\!transform {\n transform: var(--tw-rotate-x) var(--tw-rotate-y) var(--tw-rotate-z) var(--tw-skew-x) var(--tw-skew-y) !important;\n}\n.transform {\n transform: var(--tw-rotate-x) var(--tw-rotate-y) var(--tw-rotate-z) var(--tw-skew-x) var(--tw-skew-y);\n}\n.transform\\! {\n transform: var(--tw-rotate-x) var(--tw-rotate-y) var(--tw-rotate-z) var(--tw-skew-x) var(--tw-skew-y) !important;\n}\n.cursor-pointer {\n cursor: pointer;\n}\n.resize {\n resize: both;\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-col {\n flex-direction: column;\n}\n.flex-row {\n flex-direction: row;\n}\n.flex-wrap {\n flex-wrap: wrap;\n}\n.items-center {\n align-items: center;\n}\n.items-end {\n align-items: flex-end;\n}\n.justify-between {\n justify-content: space-between;\n}\n.justify-center {\n justify-content: center;\n}\n.justify-end {\n justify-content: flex-end;\n}\n.justify-start {\n justify-content: flex-start;\n}\n.gap-0 {\n gap: calc(var(--spacing) * 0);\n}\n.gap-1 {\n gap: calc(var(--spacing) * 1);\n}\n.gap-2 {\n gap: calc(var(--spacing) * 2);\n}\n.gap-3 {\n gap: calc(var(--spacing) * 3);\n}\n.gap-4 {\n gap: calc(var(--spacing) * 4);\n}\n.gap-6 {\n gap: calc(var(--spacing) * 6);\n}\n.space-y-2 {\n :where(& > :not(:last-child)) {\n --tw-space-y-reverse: 0;\n margin-block-start: calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));\n margin-block-end: calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)));\n }\n}\n.space-y-8 {\n :where(& > :not(:last-child)) {\n --tw-space-y-reverse: 0;\n margin-block-start: calc(calc(var(--spacing) * 8) * var(--tw-space-y-reverse));\n margin-block-end: calc(calc(var(--spacing) * 8) * calc(1 - var(--tw-space-y-reverse)));\n }\n}\n.gap-y-0 {\n row-gap: calc(var(--spacing) * 0);\n}\n.self-end {\n align-self: flex-end;\n}\n.self-start {\n align-self: flex-start;\n}\n.truncate {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.overflow-auto {\n overflow: auto;\n}\n.overflow-hidden {\n overflow: hidden;\n}\n.overflow-visible {\n overflow: visible;\n}\n.rounded {\n border-radius: 0.25rem;\n}\n.rounded-full {\n border-radius: calc(infinity * 1px);\n}\n.rounded-lg {\n border-radius: var(--radius-lg);\n}\n.rounded-md {\n border-radius: var(--radius-md);\n}\n.border {\n border-style: var(--tw-border-style);\n border-width: 1px;\n}\n.border-t-1 {\n border-top-style: var(--tw-border-style);\n border-top-width: 1px;\n}\n.border-b-1 {\n border-bottom-style: var(--tw-border-style);\n border-bottom-width: 1px;\n}\n.border-solid {\n --tw-border-style: solid;\n border-style: solid;\n}\n.border-gray-400 {\n border-color: var(--color-gray-400);\n}\n.border-gray-500 {\n border-color: var(--color-gray-500);\n}\n.border-slate-200 {\n border-color: var(--color-slate-200);\n}\n.bg-black {\n background-color: var(--color-black);\n}\n.bg-emerald-200 {\n background-color: var(--color-emerald-200);\n}\n.bg-gray-200 {\n background-color: var(--color-gray-200);\n}\n.bg-green-200 {\n background-color: var(--color-green-200);\n}\n.bg-red-500 {\n background-color: var(--color-red-500);\n}\n.bg-slate-50 {\n background-color: var(--color-slate-50);\n}\n.bg-white {\n background-color: var(--color-white);\n}\n.p-0 {\n padding: calc(var(--spacing) * 0);\n}\n.p-1 {\n padding: calc(var(--spacing) * 1);\n}\n.p-2 {\n padding: calc(var(--spacing) * 2);\n}\n.p-4 {\n padding: calc(var(--spacing) * 4);\n}\n.px-2 {\n padding-inline: calc(var(--spacing) * 2);\n}\n.px-4 {\n padding-inline: calc(var(--spacing) * 4);\n}\n.px-6 {\n padding-inline: calc(var(--spacing) * 6);\n}\n.py-1 {\n padding-block: calc(var(--spacing) * 1);\n}\n.py-2 {\n padding-block: calc(var(--spacing) * 2);\n}\n.py-4 {\n padding-block: calc(var(--spacing) * 4);\n}\n.py-6 {\n padding-block: calc(var(--spacing) * 6);\n}\n.pt-1 {\n padding-top: calc(var(--spacing) * 1);\n}\n.pt-2 {\n padding-top: calc(var(--spacing) * 2);\n}\n.pt-4 {\n padding-top: calc(var(--spacing) * 4);\n}\n.pt-5 {\n padding-top: calc(var(--spacing) * 5);\n}\n.pt-6 {\n padding-top: calc(var(--spacing) * 6);\n}\n.pt-8 {\n padding-top: calc(var(--spacing) * 8);\n}\n.pb-2 {\n padding-bottom: calc(var(--spacing) * 2);\n}\n.pb-4 {\n padding-bottom: calc(var(--spacing) * 4);\n}\n.pb-6 {\n padding-bottom: calc(var(--spacing) * 6);\n}\n.pb-8 {\n padding-bottom: calc(var(--spacing) * 8);\n}\n.pl-0 {\n padding-left: calc(var(--spacing) * 0);\n}\n.pl-2 {\n padding-left: calc(var(--spacing) * 2);\n}\n.pl-4 {\n padding-left: calc(var(--spacing) * 4);\n}\n.text-center {\n text-align: center;\n}\n.text-left {\n text-align: left;\n}\n.text-right {\n text-align: right;\n}\n.align-middle {\n vertical-align: middle;\n}\n.text-2xl {\n font-size: var(--text-2xl);\n line-height: var(--tw-leading, var(--text-2xl--line-height));\n}\n.text-base {\n font-size: var(--text-base);\n line-height: var(--tw-leading, var(--text-base--line-height));\n}\n.text-lg {\n font-size: var(--text-lg);\n line-height: var(--tw-leading, var(--text-lg--line-height));\n}\n.text-sm {\n font-size: var(--text-sm);\n line-height: var(--tw-leading, var(--text-sm--line-height));\n}\n.text-xl {\n font-size: var(--text-xl);\n line-height: var(--tw-leading, var(--text-xl--line-height));\n}\n.text-xs {\n font-size: var(--text-xs);\n line-height: var(--tw-leading, var(--text-xs--line-height));\n}\n.font-bold {\n --tw-font-weight: var(--font-weight-bold);\n font-weight: var(--font-weight-bold);\n}\n.font-light {\n --tw-font-weight: var(--font-weight-light);\n font-weight: var(--font-weight-light);\n}\n.font-medium {\n --tw-font-weight: var(--font-weight-medium);\n font-weight: var(--font-weight-medium);\n}\n.font-normal {\n --tw-font-weight: var(--font-weight-normal);\n font-weight: var(--font-weight-normal);\n}\n.text-nowrap {\n text-wrap: nowrap;\n}\n.text-wrap {\n text-wrap: wrap;\n}\n.break-all {\n word-break: break-all;\n}\n.whitespace-nowrap {\n white-space: nowrap;\n}\n.text-emerald-700 {\n color: var(--color-emerald-700);\n}\n.text-gray-600 {\n color: var(--color-gray-600);\n}\n.text-gray-900 {\n color: var(--color-gray-900);\n}\n.text-green-600 {\n color: var(--color-green-600);\n}\n.text-orange-500 {\n color: var(--color-orange-500);\n}\n.text-orange-600 {\n color: var(--color-orange-600);\n}\n.text-slate-400 {\n color: var(--color-slate-400);\n}\n.text-slate-500 {\n color: var(--color-slate-500);\n}\n.text-slate-600 {\n color: var(--color-slate-600);\n}\n.text-white {\n color: var(--color-white);\n}\n.capitalize {\n text-transform: capitalize;\n}\n.lowercase {\n text-transform: lowercase;\n}\n.lowercase\\! {\n text-transform: lowercase !important;\n}\n.uppercase {\n text-transform: uppercase;\n}\n.italic {\n font-style: italic;\n}\n.ordinal {\n --tw-ordinal: ordinal;\n font-variant-numeric: var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,);\n}\n.tabular-nums {\n --tw-numeric-spacing: tabular-nums;\n font-variant-numeric: var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,);\n}\n.line-through {\n text-decoration-line: line-through;\n}\n.overline {\n text-decoration-line: overline;\n}\n.underline {\n text-decoration-line: underline;\n}\n.antialiased {\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n.ring {\n --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentColor);\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n}\n.shadow {\n --tw-shadow: 0 1px 3px 0 var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 1px 2px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1));\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n}\n.shadow-md {\n --tw-shadow: 0 4px 6px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 2px 4px -2px var(--tw-shadow-color, rgb(0 0 0 / 0.1));\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n}\n.shadow\\/gap {\n --tw-shadow: 0 1px 3px 0 var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 1px 2px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1));\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n}\n.outline {\n outline-style: var(--tw-outline-style);\n outline-width: 1px;\n}\n.blur {\n --tw-blur: blur(8px);\n filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);\n}\n.drop-shadow {\n --tw-drop-shadow: drop-shadow(0 1px 2px rgb(0 0 0 / 0.1)) drop-shadow( 0 1px 1px rgb(0 0 0 / 0.06));\n filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);\n}\n.grayscale {\n --tw-grayscale: grayscale(100%);\n filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);\n}\n.invert {\n --tw-invert: invert(100%);\n filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);\n}\n.\\!filter {\n filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,) !important;\n}\n.filter {\n filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);\n}\n.filter\\! {\n filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,) !important;\n}\n.backdrop-filter {\n -webkit-backdrop-filter: var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);\n backdrop-filter: var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);\n}\n.\\!transition {\n transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, -webkit-backdrop-filter, backdrop-filter !important;\n transition-timing-function: var(--tw-ease, var(--default-transition-timing-function)) !important;\n transition-duration: var(--tw-duration, var(--default-transition-duration)) !important;\n}\n.transition {\n transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, -webkit-backdrop-filter, backdrop-filter;\n transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));\n transition-duration: var(--tw-duration, var(--default-transition-duration));\n}\n.transition\\! {\n transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, -webkit-backdrop-filter, backdrop-filter !important;\n transition-timing-function: var(--tw-ease, var(--default-transition-timing-function)) !important;\n transition-duration: var(--tw-duration, var(--default-transition-duration)) !important;\n}\n.ease-in {\n --tw-ease: var(--ease-in);\n transition-timing-function: var(--ease-in);\n}\n.ease-in-out {\n --tw-ease: var(--ease-in-out);\n transition-timing-function: var(--ease-in-out);\n}\n.ease-out {\n --tw-ease: var(--ease-out);\n transition-timing-function: var(--ease-out);\n}\n.\\[vite\\:css\\] {\n vite: css;\n}\n.\\[vite\\:html\\] {\n vite: html;\n}\n.select-all {\n -webkit-user-select: all;\n user-select: all;\n}\n.sm\\:flex {\n @media (width >= 40rem) {\n display: flex;\n }\n}\n.sm\\:hidden {\n @media (width >= 40rem) {\n display: none;\n }\n}\n.dark\\:bg-gray-900 {\n @media (prefers-color-scheme: dark) {\n background-color: var(--color-gray-900);\n }\n}\n@layer theme, base, components, utilities;\n@layer theme {\n :root {\n --font-sans: ui-sans-serif, system-ui, sans-serif, \"Apple Color Emoji\",\n \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\";\n --font-serif: ui-serif, Georgia, Cambria, \"Times New Roman\", Times, serif;\n --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,\n \"Liberation Mono\", \"Courier New\", monospace;\n --color-red-50: oklch(0.971 0.013 17.38);\n --color-red-100: oklch(0.936 0.032 17.717);\n --color-red-200: oklch(0.885 0.062 18.334);\n --color-red-300: oklch(0.808 0.114 19.571);\n --color-red-400: oklch(0.704 0.191 22.216);\n --color-red-500: oklch(0.637 0.237 25.331);\n --color-red-600: oklch(0.577 0.245 27.325);\n --color-red-700: oklch(0.505 0.213 27.518);\n --color-red-800: oklch(0.444 0.177 26.899);\n --color-red-900: oklch(0.396 0.141 25.723);\n --color-red-950: oklch(0.258 0.092 26.042);\n --color-orange-50: oklch(0.98 0.016 73.684);\n --color-orange-100: oklch(0.954 0.038 75.164);\n --color-orange-200: oklch(0.901 0.076 70.697);\n --color-orange-300: oklch(0.837 0.128 66.29);\n --color-orange-400: oklch(0.75 0.183 55.934);\n --color-orange-500: oklch(0.705 0.213 47.604);\n --color-orange-600: oklch(0.646 0.222 41.116);\n --color-orange-700: oklch(0.553 0.195 38.402);\n --color-orange-800: oklch(0.47 0.157 37.304);\n --color-orange-900: oklch(0.408 0.123 38.172);\n --color-orange-950: oklch(0.266 0.079 36.259);\n --color-amber-50: oklch(0.987 0.022 95.277);\n --color-amber-100: oklch(0.962 0.059 95.617);\n --color-amber-200: oklch(0.924 0.12 95.746);\n --color-amber-300: oklch(0.879 0.169 91.605);\n --color-amber-400: oklch(0.828 0.189 84.429);\n --color-amber-500: oklch(0.769 0.188 70.08);\n --color-amber-600: oklch(0.666 0.179 58.318);\n --color-amber-700: oklch(0.555 0.163 48.998);\n --color-amber-800: oklch(0.473 0.137 46.201);\n --color-amber-900: oklch(0.414 0.112 45.904);\n --color-amber-950: oklch(0.279 0.077 45.635);\n --color-yellow-50: oklch(0.987 0.026 102.212);\n --color-yellow-100: oklch(0.973 0.071 103.193);\n --color-yellow-200: oklch(0.945 0.129 101.54);\n --color-yellow-300: oklch(0.905 0.182 98.111);\n --color-yellow-400: oklch(0.852 0.199 91.936);\n --color-yellow-500: oklch(0.795 0.184 86.047);\n --color-yellow-600: oklch(0.681 0.162 75.834);\n --color-yellow-700: oklch(0.554 0.135 66.442);\n --color-yellow-800: oklch(0.476 0.114 61.907);\n --color-yellow-900: oklch(0.421 0.095 57.708);\n --color-yellow-950: oklch(0.286 0.066 53.813);\n --color-lime-50: oklch(0.986 0.031 120.757);\n --color-lime-100: oklch(0.967 0.067 122.328);\n --color-lime-200: oklch(0.938 0.127 124.321);\n --color-lime-300: oklch(0.897 0.196 126.665);\n --color-lime-400: oklch(0.841 0.238 128.85);\n --color-lime-500: oklch(0.768 0.233 130.85);\n --color-lime-600: oklch(0.648 0.2 131.684);\n --color-lime-700: oklch(0.532 0.157 131.589);\n --color-lime-800: oklch(0.453 0.124 130.933);\n --color-lime-900: oklch(0.405 0.101 131.063);\n --color-lime-950: oklch(0.274 0.072 132.109);\n --color-green-50: oklch(0.982 0.018 155.826);\n --color-green-100: oklch(0.962 0.044 156.743);\n --color-green-200: oklch(0.925 0.084 155.995);\n --color-green-300: oklch(0.871 0.15 154.449);\n --color-green-400: oklch(0.792 0.209 151.711);\n --color-green-500: oklch(0.723 0.219 149.579);\n --color-green-600: oklch(0.627 0.194 149.214);\n --color-green-700: oklch(0.527 0.154 150.069);\n --color-green-800: oklch(0.448 0.119 151.328);\n --color-green-900: oklch(0.393 0.095 152.535);\n --color-green-950: oklch(0.266 0.065 152.934);\n --color-emerald-50: oklch(0.979 0.021 166.113);\n --color-emerald-100: oklch(0.95 0.052 163.051);\n --color-emerald-200: oklch(0.905 0.093 164.15);\n --color-emerald-300: oklch(0.845 0.143 164.978);\n --color-emerald-400: oklch(0.765 0.177 163.223);\n --color-emerald-500: oklch(0.696 0.17 162.48);\n --color-emerald-600: oklch(0.596 0.145 163.225);\n --color-emerald-700: oklch(0.508 0.118 165.612);\n --color-emerald-800: oklch(0.432 0.095 166.913);\n --color-emerald-900: oklch(0.378 0.077 168.94);\n --color-emerald-950: oklch(0.262 0.051 172.552);\n --color-teal-50: oklch(0.984 0.014 180.72);\n --color-teal-100: oklch(0.953 0.051 180.801);\n --color-teal-200: oklch(0.91 0.096 180.426);\n --color-teal-300: oklch(0.855 0.138 181.071);\n --color-teal-400: oklch(0.777 0.152 181.912);\n --color-teal-500: oklch(0.704 0.14 182.503);\n --color-teal-600: oklch(0.6 0.118 184.704);\n --color-teal-700: oklch(0.511 0.096 186.391);\n --color-teal-800: oklch(0.437 0.078 188.216);\n --color-teal-900: oklch(0.386 0.063 188.416);\n --color-teal-950: oklch(0.277 0.046 192.524);\n --color-cyan-50: oklch(0.984 0.019 200.873);\n --color-cyan-100: oklch(0.956 0.045 203.388);\n --color-cyan-200: oklch(0.917 0.08 205.041);\n --color-cyan-300: oklch(0.865 0.127 207.078);\n --color-cyan-400: oklch(0.789 0.154 211.53);\n --color-cyan-500: oklch(0.715 0.143 215.221);\n --color-cyan-600: oklch(0.609 0.126 221.723);\n --color-cyan-700: oklch(0.52 0.105 223.128);\n --color-cyan-800: oklch(0.45 0.085 224.283);\n --color-cyan-900: oklch(0.398 0.07 227.392);\n --color-cyan-950: oklch(0.302 0.056 229.695);\n --color-sky-50: oklch(0.977 0.013 236.62);\n --color-sky-100: oklch(0.951 0.026 236.824);\n --color-sky-200: oklch(0.901 0.058 230.902);\n --color-sky-300: oklch(0.828 0.111 230.318);\n --color-sky-400: oklch(0.746 0.16 232.661);\n --color-sky-500: oklch(0.685 0.169 237.323);\n --color-sky-600: oklch(0.588 0.158 241.966);\n --color-sky-700: oklch(0.5 0.134 242.749);\n --color-sky-800: oklch(0.443 0.11 240.79);\n --color-sky-900: oklch(0.391 0.09 240.876);\n --color-sky-950: oklch(0.293 0.066 243.157);\n --color-blue-50: oklch(0.97 0.014 254.604);\n --color-blue-100: oklch(0.932 0.032 255.585);\n --color-blue-200: oklch(0.882 0.059 254.128);\n --color-blue-300: oklch(0.809 0.105 251.813);\n --color-blue-400: oklch(0.707 0.165 254.624);\n --color-blue-500: oklch(0.623 0.214 259.815);\n --color-blue-600: oklch(0.546 0.245 262.881);\n --color-blue-700: oklch(0.488 0.243 264.376);\n --color-blue-800: oklch(0.424 0.199 265.638);\n --color-blue-900: oklch(0.379 0.146 265.522);\n --color-blue-950: oklch(0.282 0.091 267.935);\n --color-indigo-50: oklch(0.962 0.018 272.314);\n --color-indigo-100: oklch(0.93 0.034 272.788);\n --color-indigo-200: oklch(0.87 0.065 274.039);\n --color-indigo-300: oklch(0.785 0.115 274.713);\n --color-indigo-400: oklch(0.673 0.182 276.935);\n --color-indigo-500: oklch(0.585 0.233 277.117);\n --color-indigo-600: oklch(0.511 0.262 276.966);\n --color-indigo-700: oklch(0.457 0.24 277.023);\n --color-indigo-800: oklch(0.398 0.195 277.366);\n --color-indigo-900: oklch(0.359 0.144 278.697);\n --color-indigo-950: oklch(0.257 0.09 281.288);\n --color-violet-50: oklch(0.969 0.016 293.756);\n --color-violet-100: oklch(0.943 0.029 294.588);\n --color-violet-200: oklch(0.894 0.057 293.283);\n --color-violet-300: oklch(0.811 0.111 293.571);\n --color-violet-400: oklch(0.702 0.183 293.541);\n --color-violet-500: oklch(0.606 0.25 292.717);\n --color-violet-600: oklch(0.541 0.281 293.009);\n --color-violet-700: oklch(0.491 0.27 292.581);\n --color-violet-800: oklch(0.432 0.232 292.759);\n --color-violet-900: oklch(0.38 0.189 293.745);\n --color-violet-950: oklch(0.283 0.141 291.089);\n --color-purple-50: oklch(0.977 0.014 308.299);\n --color-purple-100: oklch(0.946 0.033 307.174);\n --color-purple-200: oklch(0.902 0.063 306.703);\n --color-purple-300: oklch(0.827 0.119 306.383);\n --color-purple-400: oklch(0.714 0.203 305.504);\n --color-purple-500: oklch(0.627 0.265 303.9);\n --color-purple-600: oklch(0.558 0.288 302.321);\n --color-purple-700: oklch(0.496 0.265 301.924);\n --color-purple-800: oklch(0.438 0.218 303.724);\n --color-purple-900: oklch(0.381 0.176 304.987);\n --color-purple-950: oklch(0.291 0.149 302.717);\n --color-fuchsia-50: oklch(0.977 0.017 320.058);\n --color-fuchsia-100: oklch(0.952 0.037 318.852);\n --color-fuchsia-200: oklch(0.903 0.076 319.62);\n --color-fuchsia-300: oklch(0.833 0.145 321.434);\n --color-fuchsia-400: oklch(0.74 0.238 322.16);\n --color-fuchsia-500: oklch(0.667 0.295 322.15);\n --color-fuchsia-600: oklch(0.591 0.293 322.896);\n --color-fuchsia-700: oklch(0.518 0.253 323.949);\n --color-fuchsia-800: oklch(0.452 0.211 324.591);\n --color-fuchsia-900: oklch(0.401 0.17 325.612);\n --color-fuchsia-950: oklch(0.293 0.136 325.661);\n --color-pink-50: oklch(0.971 0.014 343.198);\n --color-pink-100: oklch(0.948 0.028 342.258);\n --color-pink-200: oklch(0.899 0.061 343.231);\n --color-pink-300: oklch(0.823 0.12 346.018);\n --color-pink-400: oklch(0.718 0.202 349.761);\n --color-pink-500: oklch(0.656 0.241 354.308);\n --color-pink-600: oklch(0.592 0.249 0.584);\n --color-pink-700: oklch(0.525 0.223 3.958);\n --color-pink-800: oklch(0.459 0.187 3.815);\n --color-pink-900: oklch(0.408 0.153 2.432);\n --color-pink-950: oklch(0.284 0.109 3.907);\n --color-rose-50: oklch(0.969 0.015 12.422);\n --color-rose-100: oklch(0.941 0.03 12.58);\n --color-rose-200: oklch(0.892 0.058 10.001);\n --color-rose-300: oklch(0.81 0.117 11.638);\n --color-rose-400: oklch(0.712 0.194 13.428);\n --color-rose-500: oklch(0.645 0.246 16.439);\n --color-rose-600: oklch(0.586 0.253 17.585);\n --color-rose-700: oklch(0.514 0.222 16.935);\n --color-rose-800: oklch(0.455 0.188 13.697);\n --color-rose-900: oklch(0.41 0.159 10.272);\n --color-rose-950: oklch(0.271 0.105 12.094);\n --color-slate-50: oklch(0.984 0.003 247.858);\n --color-slate-100: oklch(0.968 0.007 247.896);\n --color-slate-200: oklch(0.929 0.013 255.508);\n --color-slate-300: oklch(0.869 0.022 252.894);\n --color-slate-400: oklch(0.704 0.04 256.788);\n --color-slate-500: oklch(0.554 0.046 257.417);\n --color-slate-600: oklch(0.446 0.043 257.281);\n --color-slate-700: oklch(0.372 0.044 257.287);\n --color-slate-800: oklch(0.279 0.041 260.031);\n --color-slate-900: oklch(0.208 0.042 265.755);\n --color-slate-950: oklch(0.129 0.042 264.695);\n --color-gray-50: oklch(0.985 0.002 247.839);\n --color-gray-100: oklch(0.967 0.003 264.542);\n --color-gray-200: oklch(0.928 0.006 264.531);\n --color-gray-300: oklch(0.872 0.01 258.338);\n --color-gray-400: oklch(0.707 0.022 261.325);\n --color-gray-500: oklch(0.551 0.027 264.364);\n --color-gray-600: oklch(0.446 0.03 256.802);\n --color-gray-700: oklch(0.373 0.034 259.733);\n --color-gray-800: oklch(0.278 0.033 256.848);\n --color-gray-900: oklch(0.21 0.034 264.665);\n --color-gray-950: oklch(0.13 0.028 261.692);\n --color-zinc-50: oklch(0.985 0 0);\n --color-zinc-100: oklch(0.967 0.001 286.375);\n --color-zinc-200: oklch(0.92 0.004 286.32);\n --color-zinc-300: oklch(0.871 0.006 286.286);\n --color-zinc-400: oklch(0.705 0.015 286.067);\n --color-zinc-500: oklch(0.552 0.016 285.938);\n --color-zinc-600: oklch(0.442 0.017 285.786);\n --color-zinc-700: oklch(0.37 0.013 285.805);\n --color-zinc-800: oklch(0.274 0.006 286.033);\n --color-zinc-900: oklch(0.21 0.006 285.885);\n --color-zinc-950: oklch(0.141 0.005 285.823);\n --color-neutral-50: oklch(0.985 0 0);\n --color-neutral-100: oklch(0.97 0 0);\n --color-neutral-200: oklch(0.922 0 0);\n --color-neutral-300: oklch(0.87 0 0);\n --color-neutral-400: oklch(0.708 0 0);\n --color-neutral-500: oklch(0.556 0 0);\n --color-neutral-600: oklch(0.439 0 0);\n --color-neutral-700: oklch(0.371 0 0);\n --color-neutral-800: oklch(0.269 0 0);\n --color-neutral-900: oklch(0.205 0 0);\n --color-neutral-950: oklch(0.145 0 0);\n --color-stone-50: oklch(0.985 0.001 106.423);\n --color-stone-100: oklch(0.97 0.001 106.424);\n --color-stone-200: oklch(0.923 0.003 48.717);\n --color-stone-300: oklch(0.869 0.005 56.366);\n --color-stone-400: oklch(0.709 0.01 56.259);\n --color-stone-500: oklch(0.553 0.013 58.071);\n --color-stone-600: oklch(0.444 0.011 73.639);\n --color-stone-700: oklch(0.374 0.01 67.558);\n --color-stone-800: oklch(0.268 0.007 34.298);\n --color-stone-900: oklch(0.216 0.006 56.043);\n --color-stone-950: oklch(0.147 0.004 49.25);\n --color-black: #000;\n --color-white: #fff;\n --spacing: 0.25rem;\n --breakpoint-sm: 40rem;\n --breakpoint-md: 48rem;\n --breakpoint-lg: 64rem;\n --breakpoint-xl: 80rem;\n --breakpoint-2xl: 96rem;\n --container-3xs: 16rem;\n --container-2xs: 18rem;\n --container-xs: 20rem;\n --container-sm: 24rem;\n --container-md: 28rem;\n --container-lg: 32rem;\n --container-xl: 36rem;\n --container-2xl: 42rem;\n --container-3xl: 48rem;\n --container-4xl: 56rem;\n --container-5xl: 64rem;\n --container-6xl: 72rem;\n --container-7xl: 80rem;\n --text-xs: 0.75rem;\n --text-xs--line-height: calc(1 / 0.75);\n --text-sm: 0.875rem;\n --text-sm--line-height: calc(1.25 / 0.875);\n --text-base: 1rem;\n --text-base--line-height: calc(1.5 / 1);\n --text-lg: 1.125rem;\n --text-lg--line-height: calc(1.75 / 1.125);\n --text-xl: 1.25rem;\n --text-xl--line-height: calc(1.75 / 1.25);\n --text-2xl: 1.5rem;\n --text-2xl--line-height: calc(2 / 1.5);\n --text-3xl: 1.875rem;\n --text-3xl--line-height: calc(2.25 / 1.875);\n --text-4xl: 2.25rem;\n --text-4xl--line-height: calc(2.5 / 2.25);\n --text-5xl: 3rem;\n --text-5xl--line-height: 1;\n --text-6xl: 3.75rem;\n --text-6xl--line-height: 1;\n --text-7xl: 4.5rem;\n --text-7xl--line-height: 1;\n --text-8xl: 6rem;\n --text-8xl--line-height: 1;\n --text-9xl: 8rem;\n --text-9xl--line-height: 1;\n --font-weight-thin: 100;\n --font-weight-extralight: 200;\n --font-weight-light: 300;\n --font-weight-normal: 400;\n --font-weight-medium: 500;\n --font-weight-semibold: 600;\n --font-weight-bold: 700;\n --font-weight-extrabold: 800;\n --font-weight-black: 900;\n --tracking-tighter: -0.05em;\n --tracking-tight: -0.025em;\n --tracking-normal: 0em;\n --tracking-wide: 0.025em;\n --tracking-wider: 0.05em;\n --tracking-widest: 0.1em;\n --leading-tight: 1.25;\n --leading-snug: 1.375;\n --leading-normal: 1.5;\n --leading-relaxed: 1.625;\n --leading-loose: 2;\n --radius-xs: 0.125rem;\n --radius-sm: 0.25rem;\n --radius-md: 0.375rem;\n --radius-lg: 0.5rem;\n --radius-xl: 0.75rem;\n --radius-2xl: 1rem;\n --radius-3xl: 1.5rem;\n --radius-4xl: 2rem;\n --shadow-2xs: 0 1px rgb(0 0 0 / 0.05);\n --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);\n --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);\n --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1),\n 0 2px 4px -2px rgb(0 0 0 / 0.1);\n --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1),\n 0 4px 6px -4px rgb(0 0 0 / 0.1);\n --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1),\n 0 8px 10px -6px rgb(0 0 0 / 0.1);\n --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);\n --inset-shadow-2xs: inset 0 1px rgb(0 0 0 / 0.05);\n --inset-shadow-xs: inset 0 1px 1px rgb(0 0 0 / 0.05);\n --inset-shadow-sm: inset 0 2px 4px rgb(0 0 0 / 0.05);\n --drop-shadow-xs: 0 1px 1px rgb(0 0 0 / 0.05);\n --drop-shadow-sm: 0 1px 2px rgb(0 0 0 / 0.15);\n --drop-shadow-md: 0 3px 3px rgb(0 0 0 / 0.12);\n --drop-shadow-lg: 0 4px 4px rgb(0 0 0 / 0.15);\n --drop-shadow-xl: 0 9px 7px rgb(0 0 0 / 0.1);\n --drop-shadow-2xl: 0 25px 25px rgb(0 0 0 / 0.15);\n --ease-in: cubic-bezier(0.4, 0, 1, 1);\n --ease-out: cubic-bezier(0, 0, 0.2, 1);\n --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);\n --animate-spin: spin 1s linear infinite;\n --animate-ping: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;\n --animate-pulse: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;\n --animate-bounce: bounce 1s infinite;\n --blur-xs: 4px;\n --blur-sm: 8px;\n --blur-md: 12px;\n --blur-lg: 16px;\n --blur-xl: 24px;\n --blur-2xl: 40px;\n --blur-3xl: 64px;\n --perspective-dramatic: 100px;\n --perspective-near: 300px;\n --perspective-normal: 500px;\n --perspective-midrange: 800px;\n --perspective-distant: 1200px;\n --aspect-video: 16 / 9;\n --default-transition-duration: 150ms;\n --default-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n --default-font-family: var(--font-sans);\n --default-font-feature-settings: var(--font-sans--font-feature-settings);\n --default-font-variation-settings: var(\n --font-sans--font-variation-settings\n );\n --default-mono-font-family: var(--font-mono);\n --default-mono-font-feature-settings: var(\n --font-mono--font-feature-settings\n );\n --default-mono-font-variation-settings: var(\n --font-mono--font-variation-settings\n );\n }\n}\n@layer base {\n *, ::after, ::before, ::backdrop, ::file-selector-button {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n border: 0 solid;\n }\n html, :host {\n line-height: 1.5;\n -webkit-text-size-adjust: 100%;\n tab-size: 4;\n font-family: var( --default-font-family, ui-sans-serif, system-ui, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\" );\n font-feature-settings: var(--default-font-feature-settings, normal);\n font-variation-settings: var( --default-font-variation-settings, normal );\n -webkit-tap-highlight-color: transparent;\n }\n body {\n line-height: inherit;\n }\n hr {\n height: 0;\n color: inherit;\n border-top-width: 1px;\n }\n abbr:where([title]) {\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n }\n h1, h2, h3, h4, h5, h6 {\n font-size: inherit;\n font-weight: inherit;\n }\n a {\n color: inherit;\n -webkit-text-decoration: inherit;\n text-decoration: inherit;\n }\n b, strong {\n font-weight: bolder;\n }\n code, kbd, samp, pre {\n font-family: var( --default-mono-font-family, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace );\n font-feature-settings: var( --default-mono-font-feature-settings, normal );\n font-variation-settings: var( --default-mono-font-variation-settings, normal );\n font-size: 1em;\n }\n small {\n font-size: 80%;\n }\n sub, sup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n }\n sub {\n bottom: -0.25em;\n }\n sup {\n top: -0.5em;\n }\n table {\n text-indent: 0;\n border-color: inherit;\n border-collapse: collapse;\n }\n :-moz-focusring {\n outline: auto;\n }\n progress {\n vertical-align: baseline;\n }\n summary {\n display: list-item;\n }\n ol, ul, menu {\n list-style: none;\n }\n img, svg, video, canvas, audio, iframe, embed, object {\n display: block;\n vertical-align: middle;\n }\n img, video {\n max-width: 100%;\n height: auto;\n }\n button, input, select, optgroup, textarea, ::file-selector-button {\n font: inherit;\n font-feature-settings: inherit;\n font-variation-settings: inherit;\n letter-spacing: inherit;\n color: inherit;\n border-radius: 0;\n background-color: transparent;\n opacity: 1;\n }\n :where(select:is([multiple], [size])) optgroup {\n font-weight: bolder;\n }\n :where(select:is([multiple], [size])) optgroup option {\n padding-inline-start: 20px;\n }\n ::file-selector-button {\n margin-inline-end: 4px;\n }\n ::placeholder {\n opacity: 1;\n color: color-mix(in oklab, currentColor 50%, transparent);\n }\n textarea {\n resize: vertical;\n }\n ::-webkit-search-decoration {\n -webkit-appearance: none;\n }\n ::-webkit-date-and-time-value {\n min-height: 1lh;\n text-align: inherit;\n }\n ::-webkit-datetime-edit {\n display: inline-flex;\n }\n ::-webkit-datetime-edit-fields-wrapper {\n padding: 0;\n }\n ::-webkit-datetime-edit, ::-webkit-datetime-edit-year-field, ::-webkit-datetime-edit-month-field, ::-webkit-datetime-edit-day-field, ::-webkit-datetime-edit-hour-field, ::-webkit-datetime-edit-minute-field, ::-webkit-datetime-edit-second-field, ::-webkit-datetime-edit-millisecond-field, ::-webkit-datetime-edit-meridiem-field {\n padding-block: 0;\n }\n :-moz-ui-invalid {\n box-shadow: none;\n }\n button, input:where([type=\"button\"], [type=\"reset\"], [type=\"submit\"]), ::file-selector-button {\n appearance: button;\n }\n ::-webkit-inner-spin-button, ::-webkit-outer-spin-button {\n height: auto;\n }\n [hidden]:where(:not([hidden=\"until-found\"])) {\n display: none !important;\n }\n}\n@layer utilities;\n@media (min-width: 768px) {\n .sm\\:hidden {\n display: none !important;\n }\n .sm\\:flex {\n display: flex !important;\n }\n}\n.text-xxs {\n font-size: 0.625rem;\n}\n.w-1\\/2 {\n width: 50%;\n}\n.border-t-1 {\n border-top-width: 1px;\n}\n.border-b-1 {\n border-bottom-width: 1px;\n}\n.border-t-solid {\n border-top-style: solid;\n}\n.border-b-solid {\n border-bottom-style: solid;\n}\n.text-nowrap {\n white-space: nowrap;\n}\n.max-w-32 {\n max-width: 8rem;\n}\n// Used to hide sections from UI but remain in PDFs .pdf-only {\n display: none !important;\n}\n.font-light {\n font-family: @mark-pro-light;\n}\n.font-medium {\n font-family: @mark-pro-medium;\n}\n.font-bold {\n font-family: @mark-pro-bold;\n}\n.gap-y-0 {\n row-gap: 0px !important;\n}\n.gap-0 {\n gap: 0px !important;\n}\n.grow {\n flex-grow: 1;\n}\n.rounded-md {\n border-radius: 0.375rem;\n}\n.shadow-md {\n box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);\n}\n.text-slate-400 {\n --tw-text-opacity: 1;\n color: rgb(148 163 184 / 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-emerald-700 {\n --tw-text-opacity: 1;\n color: rgb(22 163 74 / var(--tw-text-opacity, 1));\n}\n.bg-emerald-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(187 247 208 / var(--tw-bg-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.text-2xl {\n font-size: 1.5rem;\n line-height: 2rem;\n}\n.border-collapse {\n border-collapse: collapse;\n}\n.align-middle {\n vertical-align: middle;\n}\n.has-tooltip {\n position: relative;\n}\n.ui-only {\n display: none;\n}\n.tooltip {\n position: absolute;\n z-index: 10;\n background-color: black;\n color: white;\n padding: 0.5rem;\n border-radius: 0.25rem;\n}\n.relative {\n position: relative;\n}\n.tootip-arrow {\n width: 0;\n height: 0;\n border-left: 0.5rem solid transparent;\n border-right: 0.5rem solid transparent;\n border-bottom: 0.5rem solid black;\n position: absolute;\n top: -0.5rem;\n}\n.absolute {\n position: absolute;\n}\n.rotate-45 {\n transform: rotate(45deg);\n}\n.-top-1\\/10 {\n top: -10%;\n}\n.bg-black {\n background-color: black;\n}\n.w-4 {\n width: 1rem;\n}\n.h-4 {\n height: 1rem;\n}\n.text-white {\n color: white;\n}\n.p-2 {\n padding: 0.5rem;\n}\n.rounded-md {\n border-radius: 0.375rem;\n}\n.z-50 {\n z-index: 50;\n}\n.mr-8 {\n margin-right: 2rem;\n}\n.notes {\n font-style: italic;\n}\n.mt-8 {\n margin-top: 2rem;\n}\n@property --tw-rotate-x {\n syntax: \"*\";\n inherits: false;\n initial-value: rotateX(0);\n}\n@property --tw-rotate-y {\n syntax: \"*\";\n inherits: false;\n initial-value: rotateY(0);\n}\n@property --tw-rotate-z {\n syntax: \"*\";\n inherits: false;\n initial-value: rotateZ(0);\n}\n@property --tw-skew-x {\n syntax: \"*\";\n inherits: false;\n initial-value: skewX(0);\n}\n@property --tw-skew-y {\n syntax: \"*\";\n inherits: false;\n initial-value: skewY(0);\n}\n@property --tw-space-y-reverse {\n syntax: \"*\";\n inherits: false;\n initial-value: 0;\n}\n@property --tw-border-style {\n syntax: \"*\";\n inherits: false;\n initial-value: solid;\n}\n@property --tw-font-weight {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-ordinal {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-slashed-zero {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-numeric-figure {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-numeric-spacing {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-numeric-fraction {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-shadow {\n syntax: \"*\";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n@property --tw-shadow-color {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-inset-shadow {\n syntax: \"*\";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n@property --tw-inset-shadow-color {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-ring-color {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-ring-shadow {\n syntax: \"*\";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n@property --tw-inset-ring-color {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-inset-ring-shadow {\n syntax: \"*\";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n@property --tw-ring-inset {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-ring-offset-width {\n syntax: \"<length>\";\n inherits: false;\n initial-value: 0px;\n}\n@property --tw-ring-offset-color {\n syntax: \"*\";\n inherits: false;\n initial-value: #fff;\n}\n@property --tw-ring-offset-shadow {\n syntax: \"*\";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n@property --tw-outline-style {\n syntax: \"*\";\n inherits: false;\n initial-value: solid;\n}\n@property --tw-blur {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-brightness {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-contrast {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-grayscale {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-hue-rotate {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-invert {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-opacity {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-saturate {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-sepia {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-backdrop-blur {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-backdrop-brightness {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-backdrop-contrast {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-backdrop-grayscale {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-backdrop-hue-rotate {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-backdrop-invert {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-backdrop-opacity {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-backdrop-saturate {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-backdrop-sepia {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-ease {\n syntax: \"*\";\n inherits: false;\n}\n@keyframes spin {\n to {\n transform: rotate(360deg);\n }\n}\n@keyframes ping {\n 75%, 100% {\n transform: scale(2);\n opacity: 0;\n }\n}\n@keyframes pulse {\n 50% {\n opacity: 0.5;\n }\n}\n@keyframes bounce {\n 0%, 100% {\n transform: translateY(-25%);\n animation-timing-function: cubic-bezier(0.8, 0, 1, 1);\n }\n 50% {\n transform: none;\n animation-timing-function: cubic-bezier(0, 0, 0.2, 1);\n }\n}\n";
46
+ styleInject(css_248z$1);
47
+
18
48
  /******************************************************************************
19
49
  Copyright (c) Microsoft Corporation.
20
50
 
@@ -88,36 +118,6 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
88
118
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
89
119
  };
90
120
 
91
- function styleInject(css, ref) {
92
- if ( ref === void 0 ) ref = {};
93
- var insertAt = ref.insertAt;
94
-
95
- if (!css || typeof document === 'undefined') { return; }
96
-
97
- var head = document.head || document.getElementsByTagName('head')[0];
98
- var style = document.createElement('style');
99
- style.type = 'text/css';
100
-
101
- if (insertAt === 'top') {
102
- if (head.firstChild) {
103
- head.insertBefore(style, head.firstChild);
104
- } else {
105
- head.appendChild(style);
106
- }
107
- } else {
108
- head.appendChild(style);
109
- }
110
-
111
- if (style.styleSheet) {
112
- style.styleSheet.cssText = css;
113
- } else {
114
- style.appendChild(document.createTextNode(css));
115
- }
116
- }
117
-
118
- var css_248z = ".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-primary:disabled {\n background: #eef0f2 !important;\n color: rgba(0, 0, 0, 0.25) !important;\n border: none;\n}\n.ant-btn {\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 box-shadow: none;\n text-shadow: none;\n outline: none !important;\n line-height: 1;\n font-size: 0.875rem;\n font-weight: normal;\n}\n.ant-btn > span {\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.ant-btn-lg {\n height: 44px !important;\n}\n.ant-btn-default:disabled {\n border-color: rgba(113, 125, 148, 0.2) !important;\n}\n.ant-btn-link {\n border: none !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;\n}\n.ant-btn-link > span {\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.ant-btn-link:disabled {\n background-color: transparent !important;\n color: #717d94 !important;\n}\n.ant-btn-link:disabled:hover {\n background-color: transparent !important;\n}\n.ant-input-affix-wrapper .ant-input-prefix {\n transition: color 0.3s;\n}\n.ant-select-selector {\n box-shadow: none !important;\n background-color: transparent !important;\n border: none !important;\n}\n.ant-form-item-label {\n text-transform: none !important;\n font-size: 0.75rem;\n padding-bottom: 2px !important;\n}\n.ant-form-item-label > label {\n width: 100%;\n color: #4b5563 !important;\n}\n.ant-form-item-explain-error {\n font-size: 11px;\n min-height: 11px;\n line-height: 11px;\n padding-top: 2px;\n}\n.ant-form-item {\n margin-bottom: 0;\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-divider {\n margin: 0;\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.ant-drawer-title {\n font-weight: 400 !important;\n}\n.ant-drawer-header-title {\n flex-direction: row-reverse !important;\n align-items: start !important ;\n}\n.ant-drawer-close {\n margin-inline-end: 0 !important;\n}\n@media (min-width: 768px) {\n .ant-input,\n .ant-picker,\n .ant-select,\n .ant-input-affix-wrapper {\n font-size: 1rem !important;\n }\n .ant-drawer-header {\n padding-right: 1.5rem !important;\n padding-left: 1.5rem !important;\n }\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.relative {\n position: relative;\n}\n.absolute {\n position: absolute;\n}\n.fixed {\n position: fixed;\n}\n.top-0 {\n top: 0;\n}\n.right-0 {\n right: 0;\n}\n.bottom-0 {\n bottom: 0;\n}\n.left-0 {\n left: 0;\n}\n.overflow-hidden {\n overflow: hidden !important;\n}\n.overflow-auto {\n overflow: auto;\n}\n.overflow-visible {\n overflow: visible;\n}\n.z-50 {\n z-index: 50;\n}\n.-top-1\\/10 {\n top: -10%;\n}\n.rounded {\n border-radius: 0.25rem;\n}\n.rounded-md {\n border-radius: 0.375rem;\n}\n.rounded-lg {\n border-radius: 0.5rem;\n}\n.rounded-xl {\n border-radius: 0.75rem;\n}\n.rounded-full {\n border-radius: 9999px;\n}\n.rounded-tr {\n border-top-right-radius: 0.25rem;\n}\n.rounded-br {\n border-bottom-right-radius: 0.25rem;\n}\n.rounded-bl {\n border-bottom-left-radius: 0.25rem;\n}\n.rounded-tl {\n border-top-left-radius: 0.25rem;\n}\n.rounded-t {\n border-top-right-radius: 0.25rem;\n border-top-left-radius: 0.25rem;\n}\n.grid {\n display: grid;\n}\n.contents {\n display: contents;\n}\n.flex {\n display: flex;\n}\n.flex-col {\n flex-direction: column;\n}\n.flex-wrap {\n flex-wrap: wrap;\n}\n.grow {\n flex-grow: 1;\n}\n.shrink {\n flex-shrink: 1;\n}\n.shrink-0 {\n flex-shrink: 0;\n}\n.basis-0 {\n flex-basis: 0;\n}\n.max-w-32 {\n max-width: 8rem;\n}\n.items-center {\n align-items: center;\n}\n.items-end {\n align-items: flex-end;\n}\n.items-start {\n align-items: flex-start;\n}\n.justify-center {\n justify-content: center;\n}\n.justify-between {\n justify-content: space-between;\n}\n.justify-end {\n justify-content: flex-end;\n}\n.justify-start {\n justify-content: flex-start;\n}\n.whitespace-nowrap {\n white-space: nowrap;\n}\n.underline {\n text-decoration: underline;\n}\n.no-underline {\n text-decoration: none;\n}\n.text-nowrap {\n white-space: nowrap;\n}\n.text-white {\n color: white;\n}\n.text-xxs {\n font-size: 0.625rem;\n}\n.text-xs {\n font-size: 0.75rem;\n}\n.text-sm {\n font-size: 0.875rem;\n}\n.text-base {\n font-size: 1rem;\n}\n.text-lg {\n font-size: 1.125rem;\n}\n.text-xl {\n font-size: 1.25rem;\n}\n.text-2xl {\n font-size: 1.5rem;\n}\n.text-3xl {\n font-size: 2rem;\n}\n.text-4xl {\n font-size: 2.5rem;\n}\n.text-5xl {\n font-size: 3rem;\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.text-gray {\n color: #808080 !important;\n}\n.text-gray-400 {\n color: #9ca3af !important;\n}\n.text-gray-500 {\n color: #6b7280 !important;\n}\n.text-blue-gray {\n color: #717d94;\n}\n.text-primary {\n color: #ff6e1c;\n}\n.text-secondary {\n color: #4956dc;\n}\n.capitalize {\n text-transform: capitalize !important;\n}\n.font-normal {\n font-weight: 400;\n}\n.font-medium {\n font-weight: 500;\n}\n.font-bold {\n font-weight: 700;\n}\n.bg-transparent {\n background-color: transparent;\n}\n.bg-white {\n background-color: white;\n}\n.border-collapse {\n border-collapse: collapse;\n}\n.border-t-solid {\n border-top-style: solid;\n}\n.border-b-solid {\n border-bottom-style: solid;\n}\n.border-t-1 {\n border-top-width: 1px;\n}\n.border-b-1 {\n border-bottom-width: 1px;\n}\n.gap-0 {\n gap: 0 !important;\n}\n.gap-0\\.5 {\n gap: 0.125rem;\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 !important;\n}\n.gap-5 {\n gap: 1.25rem;\n}\n.gap-6 {\n gap: 1.5rem !important;\n}\n.gap-8 {\n gap: 2rem !important;\n}\n.gap-12 {\n gap: 3rem !important;\n}\n/* Padding Utilities */\n.p-0 {\n padding: 0;\n}\n.p-1 {\n padding: 0.25rem;\n}\n.p-2 {\n padding: 0.5rem;\n}\n.p-3 {\n padding: 0.75rem;\n}\n.p-4 {\n padding: 1rem;\n}\n.p-5 {\n padding: 1.25rem;\n}\n.p-6 {\n padding: 1.5rem;\n}\n.p-8 {\n padding: 2rem;\n}\n/* Padding X Utilities */\n.px-0 {\n padding-right: 0;\n padding-left: 0;\n}\n.px-1 {\n padding-right: 0.25rem;\n padding-left: 0.25rem;\n}\n.px-2 {\n padding-right: 0.5rem;\n padding-left: 0.5rem;\n}\n.px-3 {\n padding-right: 0.75rem;\n padding-left: 0.75rem;\n}\n.px-4 {\n padding-right: 1rem;\n padding-left: 1rem;\n}\n.px-5 {\n padding-right: 1.25rem;\n padding-left: 1.25rem;\n}\n.px-6 {\n padding-right: 1.5rem;\n padding-left: 1.5rem;\n}\n.px-8 {\n padding-right: 2rem;\n padding-left: 2rem;\n}\n.px-12 {\n padding-right: 3rem;\n padding-left: 3rem;\n}\n/* Padding Y Utilities */\n.py-0 {\n padding-top: 0;\n padding-bottom: 0;\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-3 {\n padding-top: 0.75rem;\n padding-bottom: 0.75rem;\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/* Padding Top Utilities */\n.pt-0 {\n padding-top: 0;\n}\n.pt-1 {\n padding-top: 0.25rem;\n}\n.pt-2 {\n padding-top: 0.5rem;\n}\n.pt-3 {\n padding-top: 0.75rem;\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/* Padding Right Utilities */\n.pr-0 {\n padding-right: 0;\n}\n.pr-4 {\n padding-right: 1rem;\n}\n.pr-8 {\n padding-right: 2rem;\n}\n/* Padding Bottom Utilities */\n.pb-0 {\n padding-bottom: 0;\n}\n.pb-1 {\n padding-bottom: 0.25rem;\n}\n.pb-2 {\n padding-bottom: 0.5rem;\n}\n.pb-3 {\n padding-bottom: 0.75rem;\n}\n.pb-4 {\n padding-bottom: 1rem;\n}\n.pb-5 {\n padding-bottom: 1.25rem;\n}\n.pb-6 {\n padding-bottom: 1.5rem;\n}\n.pb-8 {\n padding-bottom: 2rem;\n}\n/* Padding Left Utilities */\n.pl-0 {\n padding-left: 0;\n}\n.pl-1 {\n padding-left: 0.25rem;\n}\n.pl-2 {\n padding-left: 0.5rem;\n}\n.pl-4 {\n padding-left: 1rem;\n}\n.pl-8 {\n padding-left: 2rem;\n}\n/* Space Utilities */\n.space-y-2 {\n gap: 0.5rem;\n}\n.space-y-4 {\n gap: 1rem;\n}\n.space-y-8 {\n gap: 2rem;\n}\n/* Margin Utilities */\n.ml-2 {\n margin-left: 0.5rem;\n}\n.ml-6 {\n margin-left: 1.5rem;\n}\n.ml-8 {\n margin-left: 2rem;\n}\n.mb-0 {\n margin-bottom: 0;\n}\n.mb-1 {\n margin-bottom: 0.25rem;\n}\n.mb-2 {\n margin-bottom: 0.5rem;\n}\n.mb-3 {\n margin-bottom: 0.75rem;\n}\n.mb-4 {\n margin-bottom: 1rem;\n}\n.mb-5 {\n margin-bottom: 1.25rem;\n}\n.mb-6 {\n margin-bottom: 1.5rem;\n}\n.mb-8 {\n margin-bottom: 2rem;\n}\n.mr-2 {\n margin-right: 0.5rem;\n}\n.mr-4 {\n margin-right: 1rem;\n}\n.mr-6 {\n margin-right: 1.5rem;\n}\n.mr-8 {\n margin-right: 2rem;\n}\n.mt-0 {\n margin-top: 0;\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-5 {\n margin-top: 1.25rem;\n}\n.mt-6 {\n margin-top: 1.5rem;\n}\n.mt-8 {\n margin-top: 2rem;\n}\n.my-1 {\n margin-top: 0.25rem;\n margin-bottom: 0.25rem;\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.my-8 {\n margin-top: 2rem;\n margin-bottom: 2rem;\n}\n.my-12 {\n margin-top: 3rem;\n margin-bottom: 3rem;\n}\n.mx-2 {\n margin-left: 0.5rem;\n margin-right: 0.5rem;\n}\n.mx-4 {\n margin-left: 1rem;\n margin-right: 1rem;\n}\n.mx-8 {\n margin-left: 2rem;\n margin-right: 2rem;\n}\n.w-full {\n width: 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-14 {\n width: 3.5rem;\n /* 56px */\n}\n.w-20 {\n width: 5rem;\n /* 80px */\n}\n.h-full {\n height: 100%;\n}\n.h-4 {\n height: 1rem;\n}\n.h-5 {\n height: 1.25rem;\n}\n.h-6 {\n height: 1.5rem;\n}\n.h-8 {\n height: 2rem;\n}\n.h-14 {\n height: 3.5rem;\n /* 56px */\n}\n.h-80 {\n height: 20rem;\n}\n.h-96 {\n height: 24rem;\n}\n.cursor-pointer {\n cursor: pointer;\n}\n.cursor-not-allowed {\n cursor: not-allowed;\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.grid-cols-4 {\n grid-template-columns: repeat(4, minMax(0, 1fr));\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-4 {\n grid-column: span 4 / span 4;\n}\n.col-span-full {\n grid-column: 1 / -1;\n}\n/* Background colors */\n.bg-black {\n background-color: #000000;\n}\n.bg-slate-50 {\n background-color: #f8fafc;\n}\n.bg-slate-100 {\n background-color: #f1f5f9;\n}\n.bg-slate-200 {\n background-color: #e2e8f0;\n}\n.bg-slate-300 {\n background-color: #cbd5e1;\n}\n.bg-slate-400 {\n background-color: #94a3b8;\n}\n.bg-slate-500 {\n background-color: #64748b;\n}\n.bg-slate-600 {\n background-color: #475569;\n}\n.bg-slate-700 {\n background-color: #334155;\n}\n.bg-slate-800 {\n background-color: #1e293b;\n}\n.bg-slate-900 {\n background-color: #0f172a;\n}\n.bg-slate-950 {\n background-color: #020617;\n}\n.bg-gray-50 {\n background-color: #f9fafb;\n}\n.bg-gray-100 {\n background-color: #f3f4f6;\n}\n.bg-gray-200 {\n background-color: #e5e7eb;\n}\n.bg-gray-300 {\n background-color: #d1d5db;\n}\n.bg-gray-400 {\n background-color: #9ca3af;\n}\n.bg-gray-500 {\n background-color: #6b7280;\n}\n.bg-gray-600 {\n background-color: #4b5563;\n}\n.bg-gray-700 {\n background-color: #374151;\n}\n.bg-gray-800 {\n background-color: #1f2937;\n}\n.bg-gray-900 {\n background-color: #111827;\n}\n.bg-gray-950 {\n background-color: #030712;\n}\n.bg-green-200 {\n background-color: #a7f3d0;\n}\n.bg-green-500 {\n background-color: #10b981;\n}\n.bg-blue-50 {\n background-color: #eff6ff;\n}\n.bg-blue-100 {\n background-color: #dbeafe;\n}\n.bg-blue-200 {\n background-color: #bfdbfe;\n}\n.bg-blue-300 {\n background-color: #93c5fd;\n}\n.bg-blue-400 {\n background-color: #60a5fa;\n}\n.bg-blue-500 {\n background-color: #3b82f6;\n}\n.bg-blue-600 {\n background-color: #2563eb;\n}\n.bg-blue-700 {\n background-color: #1d4ed8;\n}\n.bg-blue-800 {\n background-color: #1e40af;\n}\n.bg-blue-900 {\n background-color: #1e3a8a;\n}\n.bg-blue-950 {\n background-color: #172554;\n}\n.bg-orange-50 {\n background-color: #fff7ed;\n}\n.bg-orange-100 {\n background-color: #ffedd5;\n}\n.bg-orange-200 {\n background-color: #fed7aa;\n}\n.bg-orange-300 {\n background-color: #fdba74;\n}\n.bg-orange-400 {\n background-color: #fb923c;\n}\n.bg-orange-500 {\n background-color: #f97316;\n}\n.bg-orange-600 {\n background-color: #ea580c;\n}\n.bg-orange-700 {\n background-color: #c2410c;\n}\n.bg-orange-800 {\n background-color: #9a3412;\n}\n.bg-orange-900 {\n background-color: #7c2d12;\n}\n.bg-orange-950 {\n background-color: #431407;\n}\n.bg-yellow-200 {\n background-color: #fde68a;\n}\n.bg-red-200 {\n background-color: #fecaca;\n}\n/* Text colors */\n.text-black {\n color: #000000;\n}\n.text-white {\n color: #ffffff;\n}\n.text-slate-50 {\n color: #f8fafc;\n}\n.text-slate-100 {\n color: #f1f5f9;\n}\n.text-slate-200 {\n color: #e2e8f0;\n}\n.text-slate-300 {\n color: #cbd5e1;\n}\n.text-slate-400 {\n color: #94a3b8;\n}\n.text-slate-500 {\n color: #64748b;\n}\n.text-slate-600 {\n color: #475569;\n}\n.text-slate-700 {\n color: #334155;\n}\n.text-slate-800 {\n color: #1e293b;\n}\n.text-slate-900 {\n color: #0f172a;\n}\n.text-slate-950 {\n color: #020617;\n}\n.text-gray-50 {\n color: #f9fafb;\n}\n.text-gray-100 {\n color: #f3f4f6;\n}\n.text-gray-200 {\n color: #e5e7eb;\n}\n.text-gray-300 {\n color: #d1d5db;\n}\n.text-gray-400 {\n color: #9ca3af;\n}\n.text-gray-500 {\n color: #6b7280;\n}\n.text-gray-600 {\n color: #4b5563;\n}\n.text-gray-700 {\n color: #374151;\n}\n.text-gray-800 {\n color: #1f2937;\n}\n.text-gray-900 {\n color: #111827;\n}\n.text-gray-950 {\n color: #030712;\n}\n.text-green-600 {\n color: #059669;\n}\n.text-green-700 {\n color: #047857;\n}\n.text-blue-50 {\n color: #eff6ff;\n}\n.text-blue-100 {\n color: #dbeafe;\n}\n.text-blue-200 {\n color: #bfdbfe;\n}\n.text-blue-300 {\n color: #93c5fd;\n}\n.text-blue-400 {\n color: #60a5fa;\n}\n.text-blue-500 {\n color: #3b82f6;\n}\n.text-blue-600 {\n color: #2563eb;\n}\n.text-blue-700 {\n color: #1d4ed8;\n}\n.text-blue-800 {\n color: #1e40af;\n}\n.text-blue-900 {\n color: #1e3a8a;\n}\n.text-blue-950 {\n color: #172554;\n}\n.text-orange-50 {\n color: #fff7ed;\n}\n.text-orange-100 {\n color: #ffedd5;\n}\n.text-orange-200 {\n color: #fed7aa;\n}\n.text-orange-300 {\n color: #fdba74;\n}\n.text-orange-400 {\n color: #fb923c;\n}\n.text-orange-500 {\n color: #f97316;\n}\n.text-orange-600 {\n color: #ea580c;\n}\n.text-orange-700 {\n color: #c2410c;\n}\n.text-orange-800 {\n color: #9a3412;\n}\n.text-orange-900 {\n color: #7c2d12;\n}\n.text-orange-950 {\n color: #431407;\n}\n.text-yellow-500 {\n color: #f59e0b;\n}\n.text-yellow-700 {\n color: #b45309;\n}\n.text-red-500 {\n color: #ef4444;\n}\n.text-red-700 {\n color: #b91c1c;\n}\n.border {\n border-width: 1px;\n}\n.border-2 {\n border-width: 2px;\n}\n.border-l {\n border-left-width: 1px;\n}\n.border-dashed {\n border-style: dashed;\n}\n.border-solid {\n border-style: solid;\n}\n.border-slate-50 {\n border-color: #f8fafc;\n}\n.border-slate-100 {\n border-color: #f1f5f9;\n}\n.border-slate-200 {\n border-color: #e2e8f0;\n}\n.border-slate-300 {\n border-color: #cbd5e1;\n}\n.border-slate-400 {\n border-color: #94a3b8;\n}\n.border-slate-500 {\n border-color: #64748b;\n}\n.border-slate-600 {\n border-color: #475569;\n}\n.border-slate-700 {\n border-color: #334155;\n}\n.border-slate-800 {\n border-color: #1e293b;\n}\n.border-slate-900 {\n border-color: #0f172a;\n}\n.border-slate-950 {\n border-color: #020617;\n}\n.border-gray-400 {\n border-color: #9ca3af;\n}\n.border-gray-500 {\n border-color: #6b7280;\n}\n.origin-center {\n transform-origin: center;\n}\n.rotate-45 {\n transform: rotate(45deg);\n}\n.translate-x-2\\/4 {\n transform: translateX(50%);\n}\n.-translate-x-2\\/4 {\n transform: translateX(-50%);\n}\n.translate-y-2\\/4 {\n transform: translateY(50%);\n}\n.translate-y-full {\n transform: translateY(100%);\n}\n.-translate-y-full {\n transform: translateY(-100%);\n}\n.shadow-sm {\n box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n}\n.shadow {\n box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);\n}\n.shadow-md {\n box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);\n}\n.shadow-lg {\n box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);\n}\n.shadow-xl {\n box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);\n}\n.shadow-2xl {\n box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);\n}\n.shadow-inner {\n box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.05);\n}\n.shadow-none {\n box-shadow: 0 0 #0000;\n}\n@media (min-width: 768px) {\n .sm\\:flex {\n display: flex !important;\n }\n .sm\\:hidden {\n display: none !important;\n }\n}\n* {\n margin: 0;\n padding: 0;\n box-sizing: border-box !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;\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";
119
- styleInject(css_248z);
120
-
121
121
  var IconContext = /*#__PURE__*/createContext({});
122
122
  var Context = IconContext;
123
123
 
@@ -1553,12 +1553,16 @@ var BrandContext = createContext({
1553
1553
 
1554
1554
  var MUTATION$9 = "{\n entityBranding {\n accentColor\n brandColor\n topNavImageUrl\n }\n }";
1555
1555
  var getBranding = function (_a) {
1556
- var token = _a.token, subdomain = _a.subdomain;
1556
+ var token = _a.token, apiHost = _a.apiHost;
1557
1557
  return __awaiter(void 0, void 0, void 0, function () {
1558
1558
  var response;
1559
1559
  return __generator(this, function (_b) {
1560
1560
  switch (_b.label) {
1561
- case 0: return [4 /*yield*/, gqlRequest({ query: MUTATION$9, token: token, subdomain: subdomain })];
1561
+ case 0: return [4 /*yield*/, gqlRequest({
1562
+ query: MUTATION$9,
1563
+ token: token,
1564
+ apiHost: apiHost,
1565
+ })];
1562
1566
  case 1:
1563
1567
  response = _b.sent();
1564
1568
  return [2 /*return*/, response === null || response === void 0 ? void 0 : response.entityBranding];
@@ -1567,77 +1571,20 @@ var getBranding = function (_a) {
1567
1571
  });
1568
1572
  };
1569
1573
 
1570
- var BreakpointNumbers;
1571
- (function (BreakpointNumbers) {
1572
- BreakpointNumbers[BreakpointNumbers["xs"] = 480] = "xs";
1573
- BreakpointNumbers[BreakpointNumbers["sm"] = 768] = "sm";
1574
- BreakpointNumbers[BreakpointNumbers["md"] = 992] = "md";
1575
- BreakpointNumbers[BreakpointNumbers["lg"] = 1200] = "lg";
1576
- BreakpointNumbers[BreakpointNumbers["xl"] = 1400] = "xl";
1577
- BreakpointNumbers[BreakpointNumbers["xxl"] = 2000] = "xxl";
1578
- })(BreakpointNumbers || (BreakpointNumbers = {}));
1579
- [
1580
- BreakpointNumbers.xs,
1581
- BreakpointNumbers.sm,
1582
- BreakpointNumbers.md,
1583
- BreakpointNumbers.lg,
1584
- BreakpointNumbers.xl,
1585
- BreakpointNumbers.xxl,
1586
- ];
1587
- var useIsMobile = function (window) {
1588
- var _a = useState({
1589
- width: window.innerWidth,
1590
- height: window.innerHeight,
1591
- }), windowSize = _a[0], setWindowSize = _a[1];
1592
- useEffect(function () {
1593
- var handleResize = function () {
1594
- setWindowSize({
1595
- width: window.innerWidth,
1596
- height: window.innerHeight,
1597
- });
1598
- };
1599
- window.addEventListener("resize", handleResize);
1600
- handleResize();
1601
- return function () { return window.removeEventListener("resize", handleResize); };
1602
- }, []);
1603
- return windowSize.width < BreakpointNumbers.sm;
1604
- };
1605
-
1606
- var CURRENT_USER_DATA_QUERY = "{\n company {\n name\n }\n currentUser {\n authObjectName\n entityId\n payload {\n returnUrl\n }\n privacyUrl\n termsUrl\n }\n }";
1607
- var getCurrentUserData = function (_a) {
1608
- var token = _a.token, subdomain = _a.subdomain;
1609
- return __awaiter(void 0, void 0, void 0, function () {
1610
- var response;
1611
- var _b, _c, _d, _e, _f, _g, _h;
1612
- return __generator(this, function (_j) {
1613
- switch (_j.label) {
1614
- case 0: return [4 /*yield*/, gqlRequest({
1615
- query: CURRENT_USER_DATA_QUERY,
1616
- token: token,
1617
- subdomain: subdomain,
1618
- })];
1619
- case 1:
1620
- response = _j.sent();
1621
- return [2 /*return*/, {
1622
- authObjectName: (_b = response === null || response === void 0 ? void 0 : response.currentUser) === null || _b === void 0 ? void 0 : _b.authObjectName,
1623
- companyName: (_c = response === null || response === void 0 ? void 0 : response.company) === null || _c === void 0 ? void 0 : _c.name,
1624
- entityId: (_d = response === null || response === void 0 ? void 0 : response.currentUser) === null || _d === void 0 ? void 0 : _d.entityId,
1625
- returnUrl: (_f = (_e = response === null || response === void 0 ? void 0 : response.currentUser) === null || _e === void 0 ? void 0 : _e.payload) === null || _f === void 0 ? void 0 : _f.returnUrl,
1626
- privacyUrl: (_g = response === null || response === void 0 ? void 0 : response.currentUser) === null || _g === void 0 ? void 0 : _g.privacyUrl,
1627
- termsUrl: (_h = response === null || response === void 0 ? void 0 : response.currentUser) === null || _h === void 0 ? void 0 : _h.termsUrl,
1628
- }];
1629
- }
1630
- });
1574
+ var createGraphQLClient = function (token, apiHost) {
1575
+ return new GraphQLClient(apiHost + "/graphql", {
1576
+ headers: {
1577
+ Authorization: token,
1578
+ },
1631
1579
  });
1632
1580
  };
1633
1581
 
1634
1582
  var BunnyContext = createContext({});
1635
- // Important that this is created here, not within a function
1636
- var queryClient$1 = new QueryClient();
1583
+ var extraQueryClient = new QueryClient();
1637
1584
  // Every component shares similar props and functionality, which this wrapper handles.
1638
1585
  function BunnyProvider(_a) {
1639
- var children = _a.children, token = _a.token, subdomain = _a.subdomain, window = _a.window, accountId = _a.accountId, _b = _a.darkMode, darkMode = _b === void 0 ? false : _b;
1640
- var graphQLClient = createGraphQLClient(subdomain || "", window, token);
1586
+ var accountId = _a.accountId, children = _a.children, _b = _a.darkMode, darkMode = _b === void 0 ? false : _b, onErrorNavigate = _a.onErrorNavigate, queryClient = _a.queryClient, apiHost = _a.apiHost, token = _a.token, window = _a.window;
1587
+ var graphQLClient = createGraphQLClient(token, apiHost || "");
1641
1588
  var isMobile = useIsMobile(window);
1642
1589
  var _c = useState(undefined), branding = _c[0], setBranding = _c[1];
1643
1590
  // ====== START - Copied straight from PageContainer.tsx ========
@@ -1648,7 +1595,7 @@ function BunnyProvider(_a) {
1648
1595
  ? "#" + ((_a = branding === null || branding === void 0 ? void 0 : branding.brandColor) === null || _a === void 0 ? void 0 : _a.toString(16))
1649
1596
  : DEFAULT_BRAND_COLOR;
1650
1597
  var secondaryColor = DEFAULT_SECONDARY_COLOR;
1651
- if (!isMobile && Misc.isColorTooDark(branding === null || branding === void 0 ? void 0 : branding.accentColor))
1598
+ if (!isMobile && isColorTooDark(branding === null || branding === void 0 ? void 0 : branding.accentColor))
1652
1599
  secondaryColor = "#ffffff";
1653
1600
  var topNavImageUrl = (branding === null || branding === void 0 ? void 0 : branding.topNavImageUrl) || DEFAULT_TOP_NAV_IMAGE_URL;
1654
1601
  var accentColor = (branding === null || branding === void 0 ? void 0 : branding.accentColor) || DEFAULT_ACCENT_COLOR;
@@ -1670,13 +1617,14 @@ function BunnyProvider(_a) {
1670
1617
  };
1671
1618
  }, []);
1672
1619
  return (jsxs(BunnyContext.Provider, __assign({ value: {
1673
- subdomain: subdomain,
1674
- graphQLClient: graphQLClient,
1675
- window: window,
1676
- token: token,
1677
1620
  accountId: accountId,
1678
1621
  darkMode: darkMode,
1679
- } }, { children: [jsx("div", __assign({ style: { position: "fixed", left: -2000000000 } }, { children: "test" })), jsx(QueryClientProvider, __assign({ client: queryClient$1 }, { children: jsx(RecoilRoot, { children: jsx(BrandContext.Provider, __assign({ value: entityBranding }, { children: jsx(ConfigProvider, __assign({ theme: {
1622
+ graphQLClient: graphQLClient,
1623
+ onErrorNavigate: onErrorNavigate,
1624
+ apiHost: apiHost,
1625
+ token: token,
1626
+ window: window,
1627
+ } }, { children: [jsx("div", __assign({ style: { position: "fixed", left: -2000000000 } }, { children: "test" })), jsx(QueryClientProvider, __assign({ client: queryClient || extraQueryClient }, { children: jsx(RecoilRoot, { children: jsx(BrandContext.Provider, __assign({ value: entityBranding }, { children: jsx(ConfigProvider, __assign({ theme: {
1680
1628
  algorithm: darkMode
1681
1629
  ? theme.darkAlgorithm
1682
1630
  : theme.defaultAlgorithm,
@@ -1704,15 +1652,11 @@ function BunnyProvider(_a) {
1704
1652
  function SecondaryWrapper(_a) {
1705
1653
  var children = _a.children, setBranding = _a.setBranding;
1706
1654
  var _b = useState(false), interFontLoaded = _b[0], setInterFontLoaded = _b[1];
1707
- var _c = useContext(BunnyContext), subdomain = _c.subdomain, token = _c.token;
1655
+ var _c = useContext(BunnyContext), apiHost = _c.apiHost, token = _c.token;
1708
1656
  var brandingData = useQuery({
1709
1657
  queryKey: QueryKeyFactory.default.brandingKey,
1710
- queryFn: function () { return getBranding({ token: token, subdomain: subdomain }); },
1658
+ queryFn: function () { return getBranding({ token: token, apiHost: apiHost }); },
1711
1659
  }).data;
1712
- var _d = useQuery({
1713
- queryKey: QueryKeyFactory.default.currentUserKey,
1714
- queryFn: function () { return getCurrentUserData({ token: token }); },
1715
- }); _d.data; _d.isLoading;
1716
1660
  useEffect(function () {
1717
1661
  if (brandingData) {
1718
1662
  setBranding(brandingData);
@@ -1729,44 +1673,84 @@ function SecondaryWrapper(_a) {
1729
1673
  return jsx(Fragment, { children: children });
1730
1674
  }
1731
1675
 
1732
- var MarkupContainer = styled.div(templateObject_1$9 || (templateObject_1$9 = __makeTemplateObject(["\n span {\n width: 100%;\n }\n"], ["\n span {\n width: 100%;\n }\n"])));
1676
+ var useAjax = function (onError) {
1677
+ return function (url, method, callback, token, bodyData) { return __awaiter(void 0, void 0, void 0, function () {
1678
+ var response;
1679
+ return __generator(this, function (_a) {
1680
+ switch (_a.label) {
1681
+ case 0: return [4 /*yield*/, fetch(url, {
1682
+ method: method,
1683
+ body: bodyData,
1684
+ headers: {
1685
+ "Content-type": "application/json; charset=utf-8",
1686
+ Authorization: "Bearer ".concat(token),
1687
+ },
1688
+ })];
1689
+ case 1:
1690
+ response = _a.sent();
1691
+ if (response.status !== 200 && response.status !== 201) {
1692
+ return [2 /*return*/, response.json().then(function (data) {
1693
+ if (response.status === 401) {
1694
+ console.error("expired token");
1695
+ onError === null || onError === void 0 ? void 0 : onError("expired token");
1696
+ }
1697
+ else {
1698
+ throw new Error(data === null || data === void 0 ? void 0 : data.message);
1699
+ }
1700
+ return;
1701
+ })];
1702
+ }
1703
+ return [2 /*return*/, callback(response)];
1704
+ }
1705
+ });
1706
+ }); };
1707
+ };
1708
+ var useDownloadFile = function (id, onError) {
1709
+ var ajax = useAjax(onError);
1710
+ return function (url, token) {
1711
+ return ajax(url + (id ? "?id=".concat(id) : ""), "GET", function (rsp) { return __awaiter(void 0, void 0, void 0, function () {
1712
+ var blob, file, contentDisposition, anchor, filenameRegex, matches;
1713
+ return __generator(this, function (_a) {
1714
+ switch (_a.label) {
1715
+ case 0: return [4 /*yield*/, rsp.blob()];
1716
+ case 1:
1717
+ blob = _a.sent();
1718
+ file = window.URL.createObjectURL(blob);
1719
+ contentDisposition = rsp.headers.get("content-disposition");
1720
+ anchor = document.createElement("a");
1721
+ anchor.href = file;
1722
+ if (contentDisposition &&
1723
+ contentDisposition.indexOf("attachment") !== -1) {
1724
+ filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
1725
+ matches = filenameRegex.exec(contentDisposition);
1726
+ if (matches != null && matches[1]) {
1727
+ anchor.setAttribute("download", matches[1].replace(/['"]/g, ""));
1728
+ }
1729
+ }
1730
+ anchor.click();
1731
+ return [2 /*return*/];
1732
+ }
1733
+ });
1734
+ }); }, token);
1735
+ };
1736
+ };
1737
+
1738
+ var MarkupContainer = styled.div(templateObject_1$8 || (templateObject_1$8 = __makeTemplateObject(["\n span {\n width: 100%;\n }\n"], ["\n span {\n width: 100%;\n }\n"])));
1733
1739
  var InvoiceQuoteView = function (_a) {
1734
- var children = _a.children, formattedInvoice = _a.formattedInvoice, html = _a.html, isMobile = _a.isMobile, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick, onDownloadError = _a.onDownloadError;
1740
+ var children = _a.children, formattedInvoice = _a.formattedInvoice, html = _a.html, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick, onDownloadError = _a.onDownloadError;
1735
1741
  var downloadFile = useDownloadFile(formattedInvoice === null || formattedInvoice === void 0 ? void 0 : formattedInvoice.id, onDownloadError);
1736
1742
  var secondaryColor = useContext(BrandContext).secondaryColor;
1737
- var _b = useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain;
1743
+ var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, window = _b.window;
1744
+ var isMobile = useIsMobile(window);
1738
1745
  return (jsxs("div", __assign({ className: "flex flex-col w-full grow ".concat(isMobile ? "overflow-hidden" : "") }, { children: [formattedInvoice ? (jsxs("div", __assign({ className: "flex justify-between items-center pb-4 ".concat(isMobile ? "shadow-padding-x" : ""), id: "acceptance" }, { children: [jsx("div", { children: onBackButtonClick ? (jsx(Button, __assign({ className: "text-xs pl-0", onClick: onBackButtonClick, style: {
1739
1746
  color: secondaryColor,
1740
1747
  }, type: "link" }, { children: backButtonName || "Back" }))) : null }), jsx(Button, __assign({ icon: jsx(DownloadOutlined$1, {}), onClick: function () {
1741
- return downloadFile(subdomain + "/api/pdf/invoice/" + formattedInvoice.id, token);
1748
+ return downloadFile(apiHost + "/api/pdf/invoice/" + formattedInvoice.id, token);
1742
1749
  } }, { children: "Download" }))] }))) : null, isMobile ? (jsxs(MarkupContainer, __assign({ className: "flex flex-col gap-4 grow w-full shadow-padding-xb overflow-auto" }, { children: [jsx(Markup, { content: html }), children] }))) : (jsxs(MarkupContainer, __assign({ className: "flex flex-col gap-4 p-2 w-full bg-white shadow-md rounded-md", style: {
1743
1750
  minWidth: "750px",
1744
1751
  } }, { children: [jsx(Markup, { content: html }), children] })))] })));
1745
1752
  };
1746
- var templateObject_1$9;
1747
-
1748
- var MUTATION$8 = "\nquery FormattedInvoice($id: ID) {\n formattedInvoice(id: $id) {\n amount\n amountDue\n amountPaid\n billingCity\n billingCountry\n billingState\n billingStreet\n billingZip\n createdAt\n credits\n currency\n currencyId\n currencySymbol\n customerBillingCity\n customerBillingContact\n customerBillingCountry\n customerBillingState\n customerBillingStreet\n customerBillingZip\n customerName\n dueAt\n html\n id\n isLegacy\n netPaymentDays\n number\n payableId\n poNumber\n printedState\n smallUnitAmountDue\n state\n subscriptionEndDate\n subscriptionStartDate\n subtotal\n taxAmount\n taxNumber\n uuid\n vendorName\n formattedLines {\n amount\n billingPeriodEnd\n billingPeriodStart\n chargeType\n discount\n frequency\n lineText\n position\n price\n priceDecimals\n priceListChargeId\n priceListChargeName\n priceListName\n prorationRate\n quantity\n unitOfMeasure\n priceTiers {\n price\n starts\n }\n }\n }\n}";
1749
- var getFormattedInvoice = function (_a) {
1750
- var id = _a.id, token = _a.token, subdomain = _a.subdomain;
1751
- return __awaiter(void 0, void 0, void 0, function () {
1752
- var vars, response;
1753
- return __generator(this, function (_b) {
1754
- switch (_b.label) {
1755
- case 0:
1756
- vars = { id: id };
1757
- return [4 /*yield*/, gqlRequest({
1758
- query: MUTATION$8,
1759
- token: token,
1760
- vars: vars,
1761
- subdomain: subdomain,
1762
- })];
1763
- case 1:
1764
- response = _b.sent();
1765
- return [2 /*return*/, response === null || response === void 0 ? void 0 : response.formattedInvoice];
1766
- }
1767
- });
1768
- });
1769
- };
1753
+ var templateObject_1$8;
1770
1754
 
1771
1755
  var paymentMethodsQuery = "query paymentMethods ($filter: String, $first: Int, $sort: String) {\n paymentMethods (filter: $filter, first: $first, sort: $sort) {\n nodes {\n id\n disabled\n pluginId\n accountId\n expirationDate\n plugin {\n guid\n id\n }\n state\n metadata {\n issuer\n identifier\n kind\n description\n icon\n }\n }\n }\n}";
1772
1756
  var usePaymentMethod = function (graphQLClient) {
@@ -1804,7 +1788,7 @@ var PaymentOption = function (_a) {
1804
1788
  ? "var(--row-background-dark) border-gray-500"
1805
1789
  : "bg-slate-50 border-slate-200", " border"), onClick: function () { return onClick(paymentOption); } }, { children: [jsxs("div", __assign({ className: "flex gap-2 items-center" }, { children: [jsx(Checkbox, { checked: selected, className: darkMode ? "border-gray-400" : "" }), jsx(Text$d, { children: name })] })), isAch ? (jsx(BankOutlined$1, { className: "text-slate-400" })) : isCard ? (jsx(CardIcon, {})) : (jsx(CardIcon, {}))] })));
1806
1790
  };
1807
- var PaymentOptionContainer = styled.div(templateObject_1$8 || (templateObject_1$8 = __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) {
1791
+ var PaymentOptionContainer = styled.div(templateObject_1$7 || (templateObject_1$7 = __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) {
1808
1792
  var $brandColor = _a.$brandColor, $selected = _a.$selected;
1809
1793
  return $selected &&
1810
1794
  "\n border-color: ".concat($brandColor, ";\n ");
@@ -1812,7 +1796,7 @@ var PaymentOptionContainer = styled.div(templateObject_1$8 || (templateObject_1$
1812
1796
  var $brandColor = _a.$brandColor;
1813
1797
  return $brandColor;
1814
1798
  });
1815
- var templateObject_1$8;
1799
+ var templateObject_1$7;
1816
1800
 
1817
1801
  var PaymentMethodSelector = function (_a) {
1818
1802
  var _b, _c;
@@ -1825,7 +1809,7 @@ var PaymentMethodSelector = function (_a) {
1825
1809
  };
1826
1810
 
1827
1811
  var createPaymentMethod = function (_a) {
1828
- var paymentMethodId = _a.paymentMethodId, plugin = _a.plugin, token = _a.token, subdomain = _a.subdomain, accountId = _a.accountId;
1812
+ var paymentMethodId = _a.paymentMethodId, plugin = _a.plugin, token = _a.token, apiHost = _a.apiHost, accountId = _a.accountId;
1829
1813
  return __awaiter(void 0, void 0, void 0, function () {
1830
1814
  var response;
1831
1815
  return __generator(this, function (_b) {
@@ -1838,7 +1822,7 @@ var createPaymentMethod = function (_a) {
1838
1822
  account_id: accountId,
1839
1823
  },
1840
1824
  token: token,
1841
- subdomain: subdomain,
1825
+ apiHost: apiHost,
1842
1826
  })];
1843
1827
  case 1:
1844
1828
  response = _b.sent();
@@ -1849,19 +1833,19 @@ var createPaymentMethod = function (_a) {
1849
1833
  });
1850
1834
  });
1851
1835
  };
1852
- var createSetupIntent = function (plugin, token, accountId, subdomain) {
1836
+ var createSetupIntent = function (plugin, token, apiHost, accountId) {
1853
1837
  return invokePlugin({
1854
1838
  plugin: plugin,
1855
1839
  method: "create_setup_intent",
1856
1840
  token: token,
1857
- subdomain: subdomain,
1841
+ apiHost: apiHost,
1858
1842
  payload: {
1859
1843
  account_id: accountId,
1860
1844
  },
1861
1845
  });
1862
1846
  };
1863
1847
  var createPaymentIntent = function (_a) {
1864
- var payable = _a.payable, savePaymentMethod = _a.savePaymentMethod, memo = _a.memo, plugin = _a.plugin, token = _a.token, subdomain = _a.subdomain, accountId = _a.accountId;
1848
+ var payable = _a.payable, savePaymentMethod = _a.savePaymentMethod, memo = _a.memo, plugin = _a.plugin, token = _a.token, apiHost = _a.apiHost, accountId = _a.accountId;
1865
1849
  return __awaiter(void 0, void 0, void 0, function () {
1866
1850
  var payload, response;
1867
1851
  return __generator(this, function (_b) {
@@ -1878,7 +1862,7 @@ var createPaymentIntent = function (_a) {
1878
1862
  method: "create_payment_intent",
1879
1863
  payload: payload,
1880
1864
  token: token,
1881
- subdomain: subdomain,
1865
+ apiHost: apiHost,
1882
1866
  })];
1883
1867
  case 1:
1884
1868
  response = _b.sent();
@@ -1889,23 +1873,23 @@ var createPaymentIntent = function (_a) {
1889
1873
  });
1890
1874
  });
1891
1875
  };
1892
- var fetchStripeKey = function (plugin, token, subdomain, accountId) {
1876
+ var fetchStripeKey = function (plugin, token, apiHost, accountId) {
1893
1877
  return invokePlugin({
1894
1878
  plugin: plugin,
1895
1879
  method: "retrieve_config",
1896
1880
  token: token,
1897
- subdomain: subdomain,
1881
+ apiHost: apiHost,
1898
1882
  payload: {
1899
1883
  account_id: accountId,
1900
1884
  },
1901
1885
  });
1902
1886
  };
1903
1887
  loadStripe.setLoadParameters({ advancedFraudSignals: false });
1904
- var useStripePlugin = function (plugin, token, subdomain, accountId) {
1888
+ var useStripePlugin = function (plugin, token, apiHost, accountId) {
1905
1889
  var _a = useState(null), stripe = _a[0], setStripe = _a[1];
1906
- var showErrorNotification = NotificationUtils.useErrorNotification();
1890
+ var showErrorNotification = useErrorNotification();
1907
1891
  useEffect(function () {
1908
- fetchStripeKey(plugin, token, subdomain || "", accountId)
1892
+ fetchStripeKey(plugin, token, apiHost || "", accountId)
1909
1893
  .then(function (_a) {
1910
1894
  var payload = _a.payload;
1911
1895
  return loadStripe(payload.publishable_key).then(setStripe);
@@ -1923,7 +1907,8 @@ var PaymentContext = createContext({});
1923
1907
 
1924
1908
  var CheckoutFooter = function (_a) {
1925
1909
  var amountDue = _a.amountDue, currencyId = _a.currencyId, isSaving = _a.isSaving, onPaymentSubmit = _a.onPaymentSubmit, onlySavePaymentMethod = _a.onlySavePaymentMethod, noPadding = _a.noPadding;
1926
- var isMobile = useIsMobile$1();
1910
+ var window = useContext(BunnyContext).window;
1911
+ var isMobile = useIsMobile(window);
1927
1912
  var displayPayButtonNameAnyways = useContext(PaymentContext).displayPayButtonNameAnyways;
1928
1913
  var buttonName = function () {
1929
1914
  return onlySavePaymentMethod && !displayPayButtonNameAnyways
@@ -1935,7 +1920,7 @@ var CheckoutFooter = function (_a) {
1935
1920
  : "Pay";
1936
1921
  };
1937
1922
  return (jsx("div", __assign({ className: "flex justify-end gap-2 ".concat(noPadding ? "" : "pt-6") }, { children: jsx(Button, __assign({ className: "w-full", disabled: isSaving, onClick: onPaymentSubmit, size: isMobile ? "large" : "middle", type: "primary" }, { children: "".concat(buttonName()).concat(amountDue && currencyId
1938
- ? " ".concat(Misc.formatCurrency(amountDue, currencyId))
1923
+ ? " ".concat(formatCurrency(amountDue, currencyId))
1939
1924
  : "") })) })));
1940
1925
  };
1941
1926
 
@@ -1944,7 +1929,7 @@ var CheckoutForm = function (_a) {
1944
1929
  // Hooks
1945
1930
  var elements = useElements();
1946
1931
  var stripe = useStripe();
1947
- var _b = useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain, accountId = _b.accountId;
1932
+ var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, accountId = _b.accountId;
1948
1933
  if (!payable)
1949
1934
  throw new Error("A Payable is required to start checkout");
1950
1935
  // Handlers
@@ -1970,7 +1955,7 @@ var CheckoutForm = function (_a) {
1970
1955
  savePaymentMethod: true,
1971
1956
  plugin: plugin,
1972
1957
  token: token,
1973
- subdomain: subdomain || "",
1958
+ apiHost: apiHost || "",
1974
1959
  accountId: accountId,
1975
1960
  })];
1976
1961
  case 2:
@@ -2026,7 +2011,7 @@ var PaymentMethodForm$1 = function (_a) {
2026
2011
  // Hooks
2027
2012
  var elements = useElements();
2028
2013
  var stripe = useStripe();
2029
- var _b = useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain;
2014
+ var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
2030
2015
  var accountId = useContext(PaymentContext).accountId;
2031
2016
  // Handlers
2032
2017
  var onSubmit = function () { return __awaiter(void 0, void 0, void 0, function () {
@@ -2046,7 +2031,7 @@ var PaymentMethodForm$1 = function (_a) {
2046
2031
  submitError = (_c.sent()).error;
2047
2032
  if (submitError)
2048
2033
  throw new Error(submitError.message);
2049
- return [4 /*yield*/, createSetupIntent(plugin, token, accountId, subdomain)];
2034
+ return [4 /*yield*/, createSetupIntent(plugin, token, apiHost, accountId)];
2050
2035
  case 2:
2051
2036
  response = _c.sent();
2052
2037
  if (response.status !== "success")
@@ -2074,7 +2059,7 @@ var PaymentMethodForm$1 = function (_a) {
2074
2059
  paymentMethodId: paymentMethodId,
2075
2060
  plugin: plugin,
2076
2061
  token: token,
2077
- subdomain: subdomain,
2062
+ apiHost: apiHost,
2078
2063
  accountId: accountId,
2079
2064
  })];
2080
2065
  case 4:
@@ -2103,10 +2088,10 @@ var PaymentMethodForm$1 = function (_a) {
2103
2088
 
2104
2089
  // This is just a wrapper to fetch the stripe object and pass it to the form
2105
2090
  var StripeForm = function (_a) {
2106
- var payable = _a.payable, plugin = _a.plugin, isSaving = _a.isSaving, setIsSaving = _a.setIsSaving, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess;
2107
- var _b = useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain;
2091
+ var entityId = _a.entityId, payable = _a.payable, plugin = _a.plugin, isSaving = _a.isSaving, setIsSaving = _a.setIsSaving, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess;
2092
+ var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
2108
2093
  var accountId = useContext(PaymentContext).accountId;
2109
- var stripe = useStripePlugin(plugin, token, subdomain, accountId);
2094
+ var stripe = useStripePlugin(plugin, token, apiHost, accountId);
2110
2095
  var onlySavePaymentMethod = !payable;
2111
2096
  if (!stripe)
2112
2097
  return null;
@@ -2120,7 +2105,7 @@ var StripeForm = function (_a) {
2120
2105
  currency: "usd",
2121
2106
  setupFutureUsage: "off_session",
2122
2107
  };
2123
- return (jsx(Elements, __assign({ options: options, stripe: stripe }, { children: jsx(PaymentMethodForm$1, { isSaving: isSaving, setIsSaving: setIsSaving, plugin: plugin, onFail: onFail, onPaymentSuccess: onPaymentSuccess }) })));
2108
+ return (jsx(Elements, __assign({ options: options, stripe: stripe }, { children: jsx(PaymentMethodForm$1, { entityId: entityId, isSaving: isSaving, setIsSaving: setIsSaving, plugin: plugin, onFail: onFail, onPaymentSuccess: onPaymentSuccess }) })));
2124
2109
  }
2125
2110
  else {
2126
2111
  var options = {
@@ -2129,7 +2114,7 @@ var StripeForm = function (_a) {
2129
2114
  currency: payable === null || payable === void 0 ? void 0 : payable.currencyId.toLowerCase(),
2130
2115
  setupFutureUsage: "off_session",
2131
2116
  };
2132
- return (jsx(Elements, __assign({ options: options, stripe: stripe }, { children: jsx(CheckoutForm, { payable: payable, plugin: plugin, isSaving: isSaving, setIsSaving: setIsSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess }) })));
2117
+ return (jsx(Elements, __assign({ options: options, stripe: stripe }, { children: jsx(CheckoutForm, { entityId: entityId, payable: payable, plugin: plugin, isSaving: isSaving, setIsSaving: setIsSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess }) })));
2133
2118
  }
2134
2119
  };
2135
2120
 
@@ -2176,7 +2161,7 @@ var unformatCardNumber = function (cardNumber) {
2176
2161
  var unformattedCardNumberArray = cardNumberArray.filter(function (character) { return character !== " "; });
2177
2162
  return unformattedCardNumberArray.join("");
2178
2163
  };
2179
- var storePayment = function (options, plugin, accountId, subdomain) { return __awaiter(void 0, void 0, void 0, function () {
2164
+ var storePayment = function (options, plugin, apiHost, accountId) { return __awaiter(void 0, void 0, void 0, function () {
2180
2165
  var testCreditCardNumber, testCreditCardCvc, testCreditCardExpirationDate, token, response;
2181
2166
  return __generator(this, function (_a) {
2182
2167
  switch (_a.label) {
@@ -2192,7 +2177,7 @@ var storePayment = function (options, plugin, accountId, subdomain) { return __a
2192
2177
  account_id: accountId,
2193
2178
  },
2194
2179
  token: token,
2195
- subdomain: subdomain,
2180
+ apiHost: apiHost,
2196
2181
  })];
2197
2182
  case 1:
2198
2183
  response = _a.sent();
@@ -2251,7 +2236,7 @@ var TEST_CARD = "4242424242424242";
2251
2236
  var DemoPayForm = function (_a) {
2252
2237
  var isSaving = _a.isSaving, invoice = _a.invoice, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, plugin = _a.plugin, quote = _a.quote, setIsSaving = _a.setIsSaving;
2253
2238
  // Context
2254
- var _b = useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain, darkMode = _b.darkMode;
2239
+ var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, darkMode = _b.darkMode;
2255
2240
  var accountId = useContext(PaymentContext).accountId;
2256
2241
  // Local state
2257
2242
  var _c = useState(false), savePaymentMethod = _c[0], setSavePaymentMethod = _c[1];
@@ -2277,7 +2262,7 @@ var DemoPayForm = function (_a) {
2277
2262
  testCreditCardCvc: cardDetails.cvc.toString(),
2278
2263
  testCreditCardExpirationDate: cardDetails.expiry,
2279
2264
  token: token,
2280
- }, plugin, accountId, subdomain)];
2265
+ }, plugin, apiHost, accountId)];
2281
2266
  case 1:
2282
2267
  response = _a.sent();
2283
2268
  paymentMethodId = response.payload[0].id;
@@ -2347,14 +2332,14 @@ var DemoPayForm = function (_a) {
2347
2332
  };
2348
2333
  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$c, __assign({ className: "text-xs" }, { children: "DemoPay is for testing only." })), !onlySavePaymentMethod && (jsx(Checkbox, __assign({ className: "mt-2", onChange: function (e) { return setSavePaymentMethod(e.target.checked); } }, { children: "Save as primary payment method" }))), jsx(CheckoutFooter, { amountDue: amountDue, currencyId: currencyId, isSaving: isSaving, onPaymentSubmit: onPaymentSubmit, onlySavePaymentMethod: onlySavePaymentMethod })] })));
2349
2334
  };
2350
- var StyledInputs = styled.div(templateObject_1$7 || (templateObject_1$7 = __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) {
2335
+ var StyledInputs = styled.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) {
2351
2336
  var darkMode = _a.darkMode;
2352
2337
  return darkMode ? "var(--row-background-dark)" : "white";
2353
2338
  }, function (_a) {
2354
2339
  var darkMode = _a.darkMode;
2355
2340
  return darkMode ? GRAY_500 : GRAY_200;
2356
2341
  });
2357
- var templateObject_1$7;
2342
+ var templateObject_1$6;
2358
2343
 
2359
2344
  var finixStyles = function (isMobile) { return ({
2360
2345
  default: {
@@ -2374,7 +2359,7 @@ var finixStyles = function (isMobile) { return ({
2374
2359
  }); };
2375
2360
 
2376
2361
  var retrieveConfig = function (_a) {
2377
- var plugin = _a.plugin, token = _a.token, subdomain = _a.subdomain, accountId = _a.accountId;
2362
+ var plugin = _a.plugin, token = _a.token, apiHost = _a.apiHost, accountId = _a.accountId;
2378
2363
  return __awaiter(void 0, void 0, void 0, function () {
2379
2364
  var response;
2380
2365
  return __generator(this, function (_b) {
@@ -2383,7 +2368,7 @@ var retrieveConfig = function (_a) {
2383
2368
  plugin: plugin,
2384
2369
  method: "retrieve_config",
2385
2370
  token: token,
2386
- subdomain: subdomain,
2371
+ apiHost: apiHost,
2387
2372
  payload: {
2388
2373
  account_id: accountId,
2389
2374
  },
@@ -2444,9 +2429,9 @@ var formatFinixError = function (response) {
2444
2429
  var FinixCardPaymentForm = function (_a) {
2445
2430
  var finixConfig = _a.formData, invoice = _a.invoice, isSaving = _a.isSaving, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, plugin = _a.plugin, quote = _a.quote, setIsSaving = _a.setIsSaving;
2446
2431
  // Context
2447
- var _b = useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain;
2432
+ var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
2448
2433
  var accountId = useContext(PaymentContext).accountId;
2449
- var isMobile = useIsMobile$1();
2434
+ var isMobile = useIsMobile(window);
2450
2435
  // Local state
2451
2436
  var _c = useState(false), savePaymentMethod = _c[0], setSavePaymentMethod = _c[1];
2452
2437
  var _d = useState(null), finixForm = _d[0], setFinixForm = _d[1];
@@ -2486,7 +2471,7 @@ var FinixCardPaymentForm = function (_a) {
2486
2471
  account_id: accountId,
2487
2472
  },
2488
2473
  token: token,
2489
- subdomain: subdomain,
2474
+ apiHost: apiHost,
2490
2475
  })];
2491
2476
  case 1:
2492
2477
  response_1 = _a.sent();
@@ -2538,15 +2523,15 @@ var FinixCardPaymentForm = function (_a) {
2538
2523
  };
2539
2524
  // This is just a wrapper to fetch the finix config, config its form and pass it to the paymentForm
2540
2525
  var FinixForm = function (_a) {
2541
- var invoice = _a.invoice, isSaving = _a.isSaving, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, plugin = _a.plugin, quote = _a.quote, setIsSaving = _a.setIsSaving;
2542
- var _b = useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain, accountId = _b.accountId;
2526
+ var invoice = _a.invoice, isSaving = _a.isSaving, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, plugin = _a.plugin, quote = _a.quote, setIsSaving = _a.setIsSaving, entityId = _a.entityId;
2527
+ var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, accountId = _b.accountId;
2543
2528
  var finixConfig = useQuery({
2544
2529
  queryKey: QueryKeyFactory.default.finixKey,
2545
2530
  queryFn: function () {
2546
2531
  return retrieveConfig({
2547
2532
  plugin: plugin,
2548
2533
  token: token,
2549
- subdomain: subdomain,
2534
+ apiHost: apiHost,
2550
2535
  accountId: accountId,
2551
2536
  });
2552
2537
  },
@@ -2554,7 +2539,7 @@ var FinixForm = function (_a) {
2554
2539
  }).data;
2555
2540
  if (!finixConfig || !finixConfig.application_id)
2556
2541
  return null;
2557
- return (jsx(FinixCardPaymentForm, { formData: finixConfig, invoice: invoice, isSaving: isSaving, setIsSaving: setIsSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, plugin: plugin, quote: quote }));
2542
+ return (jsx(FinixCardPaymentForm, { entityId: entityId, formData: finixConfig, invoice: invoice, isSaving: isSaving, setIsSaving: setIsSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, plugin: plugin, quote: quote }));
2558
2543
  };
2559
2544
 
2560
2545
  var StoredPaymentMethodForm = function (_a) {
@@ -2593,15 +2578,15 @@ var finixOptions = function (isMobile) { return ({
2593
2578
  }); };
2594
2579
  var FINIX_FORM_ID = "form-element";
2595
2580
  var FinixAchPayment = function (_a) {
2596
- var invoice = _a.invoice, isSaving = _a.isSaving, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, plugin = _a.plugin, quote = _a.quote, setIsSaving = _a.setIsSaving;
2597
- var _b = useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain, accountId = _b.accountId;
2581
+ var invoice = _a.invoice, isSaving = _a.isSaving, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, plugin = _a.plugin, quote = _a.quote, setIsSaving = _a.setIsSaving, entityId = _a.entityId;
2582
+ var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, accountId = _b.accountId;
2598
2583
  var finixConfig = useQuery({
2599
2584
  queryKey: QueryKeyFactory.default.finixAchKey,
2600
2585
  queryFn: function () {
2601
2586
  return retrieveConfig({
2602
2587
  plugin: plugin,
2603
2588
  token: token,
2604
- subdomain: subdomain,
2589
+ apiHost: apiHost,
2605
2590
  accountId: accountId,
2606
2591
  });
2607
2592
  },
@@ -2609,13 +2594,13 @@ var FinixAchPayment = function (_a) {
2609
2594
  }).data;
2610
2595
  if (!finixConfig || !finixConfig.application_id)
2611
2596
  return null;
2612
- return (jsx(FinixAchPaymentForm, { isSaving: isSaving, formData: finixConfig, invoice: invoice, onFail: onFail, onPaymentSuccess: onPaymentSuccess, plugin: plugin, quote: quote, setIsSaving: setIsSaving }));
2597
+ return (jsx(FinixAchPaymentForm, { entityId: entityId, isSaving: isSaving, formData: finixConfig, invoice: invoice, onFail: onFail, onPaymentSuccess: onPaymentSuccess, plugin: plugin, quote: quote, setIsSaving: setIsSaving }));
2613
2598
  };
2614
2599
  var FinixAchPaymentForm = function (_a) {
2615
2600
  var finixConfig = _a.formData, invoice = _a.invoice, isSaving = _a.isSaving, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, plugin = _a.plugin, quote = _a.quote, setIsSaving = _a.setIsSaving;
2616
2601
  // Context
2617
- var isMobile = useIsMobile$1();
2618
- var _b = useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain, accountId = _b.accountId, window = _b.window;
2602
+ var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, accountId = _b.accountId, window = _b.window;
2603
+ var isMobile = useIsMobile(window);
2619
2604
  // Local state
2620
2605
  var _c = useState(), finixForm = _c[0], setFinixForm = _c[1];
2621
2606
  var _d = useState(false), savePaymentMethod = _d[0], setSavePaymentMethod = _d[1];
@@ -2651,7 +2636,7 @@ var FinixAchPaymentForm = function (_a) {
2651
2636
  account_id: accountId,
2652
2637
  },
2653
2638
  token: token,
2654
- subdomain: subdomain,
2639
+ apiHost: apiHost,
2655
2640
  })];
2656
2641
  case 1:
2657
2642
  response_1 = _a.sent();
@@ -2702,7 +2687,7 @@ var FinixAchPaymentForm = function (_a) {
2702
2687
 
2703
2688
  var PaymentMethodForm = function (_a) {
2704
2689
  var _b, _c;
2705
- var invoice = _a.invoice, isPlugin = _a.isPlugin, isSaving = _a.isSaving, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, paymentMethod = _a.paymentMethod, quote = _a.quote, setIsSaving = _a.setIsSaving;
2690
+ var entityId = _a.entityId, invoice = _a.invoice, isPlugin = _a.isPlugin, isSaving = _a.isSaving, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, paymentMethod = _a.paymentMethod, quote = _a.quote, setIsSaving = _a.setIsSaving;
2706
2691
  if (!paymentMethod)
2707
2692
  return null;
2708
2693
  if (isPlugin) {
@@ -2710,25 +2695,68 @@ var PaymentMethodForm = function (_a) {
2710
2695
  var payable = (quote || invoice);
2711
2696
  switch ((_c = (_b = paymentMethod.components) === null || _b === void 0 ? void 0 : _b.frontend) === null || _c === void 0 ? void 0 : _c[0].name) {
2712
2697
  case "StripePayment":
2713
- return (jsx(StripeForm, { payable: payable, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, plugin: paymentMethod, setIsSaving: setIsSaving }));
2698
+ return (jsx(StripeForm, { entityId: entityId, payable: payable, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, plugin: paymentMethod, setIsSaving: setIsSaving }));
2714
2699
  case "FinixPayment":
2715
- return (jsx(FinixForm, { invoice: invoice, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, plugin: paymentMethod, quote: quote, setIsSaving: setIsSaving }));
2700
+ return (jsx(FinixForm, { entityId: entityId, invoice: invoice, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, plugin: paymentMethod, quote: quote, setIsSaving: setIsSaving }));
2716
2701
  case "FinixAchPayment":
2717
- return (jsx(FinixAchPayment, { invoice: invoice, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, plugin: paymentMethod, quote: quote, setIsSaving: setIsSaving }));
2702
+ return (jsx(FinixAchPayment, { entityId: entityId, invoice: invoice, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, plugin: paymentMethod, quote: quote, setIsSaving: setIsSaving }));
2718
2703
  case "DemoPayPayment":
2719
- return (jsx(DemoPayForm, { invoice: invoice, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, plugin: paymentMethod, quote: quote, setIsSaving: setIsSaving }));
2704
+ return (jsx(DemoPayForm, { entityId: entityId, invoice: invoice, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, plugin: paymentMethod, quote: quote, setIsSaving: setIsSaving }));
2720
2705
  default:
2721
2706
  return jsx("p", { children: "Can not find form for plugin" });
2722
2707
  }
2723
2708
  }
2724
2709
  else if (quote || invoice)
2725
- return (jsx(StoredPaymentMethodForm, { invoice: invoice, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, paymentMethod: paymentMethod, quote: quote, setIsSaving: setIsSaving }));
2710
+ return (jsx(StoredPaymentMethodForm, { entityId: entityId, invoice: invoice, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, paymentMethod: paymentMethod, quote: quote, setIsSaving: setIsSaving }));
2726
2711
  return null;
2727
2712
  };
2728
2713
 
2714
+ var usePlugins = function (_a) {
2715
+ var entityId = _a.entityId, apiHost = _a.apiHost, token = _a.token;
2716
+ return useQuery({
2717
+ queryKey: QueryKeyFactory.default.pluginsKey,
2718
+ queryFn: function () {
2719
+ var plugins = getPlugins({
2720
+ entityId: entityId,
2721
+ token: token,
2722
+ apiHost: apiHost,
2723
+ });
2724
+ return plugins;
2725
+ },
2726
+ enabled: Boolean(entityId),
2727
+ });
2728
+ };
2729
+
2730
+ var filterPaymentPlugins = function (plugins) {
2731
+ return plugins === null || plugins === void 0 ? void 0 : plugins.filter(function (plugin) {
2732
+ var _a, _b, _c, _d;
2733
+ return ((_a = plugin.type) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === "payment" &&
2734
+ ((_b = plugin.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === "valid" &&
2735
+ ((_d = (_c = plugin.components) === null || _c === void 0 ? void 0 : _c.frontend) === null || _d === void 0 ? void 0 : _d.length);
2736
+ });
2737
+ };
2738
+ var usePaymentPlugins = function (_a) {
2739
+ var entityId = _a.entityId, apiHost = _a.apiHost, token = _a.token;
2740
+ var _b = usePlugins({
2741
+ entityId: entityId,
2742
+ apiHost: apiHost,
2743
+ token: token,
2744
+ }), plugins = _b.data, isFetched = _b.isFetched;
2745
+ var paymentPlugins = filterPaymentPlugins(Array.isArray(plugins) ? plugins : []);
2746
+ var paymentMethodAllowedPlugins = paymentPlugins === null || paymentPlugins === void 0 ? void 0 : paymentPlugins.filter(function (plugin) {
2747
+ var _a, _b;
2748
+ return (_b = (_a = plugin.components) === null || _a === void 0 ? void 0 : _a.frontend) === null || _b === void 0 ? void 0 : _b.some(function (component) { var _a; return (_a = component === null || component === void 0 ? void 0 : component.scenarios) === null || _a === void 0 ? void 0 : _a.includes("admin-payment_method"); });
2749
+ });
2750
+ return {
2751
+ paymentPlugins: paymentPlugins,
2752
+ paymentMethodAllowedPlugins: paymentMethodAllowedPlugins,
2753
+ isFetched: isFetched,
2754
+ };
2755
+ };
2756
+
2729
2757
  var PaymentFormWrapper = function (_a) {
2730
2758
  var children = _a.children, setMaxHeight = _a.setMaxHeight;
2731
- var isMobile = useIsMobile$1();
2759
+ var isMobile = useIsMobile(window);
2732
2760
  return (jsx("div", __assign({ className: "flex flex-col gap-6 shrink-0 ".concat(isMobile ? "w-full shadow-padding-xb" : ""), style: __assign({}, (isMobile
2733
2761
  ? setMaxHeight
2734
2762
  ? { maxHeight: "60vh" }
@@ -2738,14 +2766,14 @@ var PaymentFormWrapper = function (_a) {
2738
2766
  })) }, { children: children })));
2739
2767
  };
2740
2768
  var ActualPaymentForm = function (_a) {
2741
- var invoice = _a.invoice, isSaving = _a.isSaving, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, quote = _a.quote, setIsSaving = _a.setIsSaving;
2769
+ var entityId = _a.entityId, invoice = _a.invoice, isSaving = _a.isSaving, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, quote = _a.quote, setIsSaving = _a.setIsSaving;
2742
2770
  // Local state
2743
2771
  var _b = useState(), selectedPaymentMethod = _b[0], setSelectedPaymentMethod = _b[1];
2744
- var _c = useContext(BunnyContext), token = _c.token, subdomain = _c.subdomain, graphQLClient = _c.graphQLClient;
2772
+ var _c = useContext(BunnyContext), token = _c.token, apiHost = _c.apiHost, graphQLClient = _c.graphQLClient;
2745
2773
  var storedPaymentMethod = usePaymentMethod(graphQLClient).data;
2746
2774
  // Queries
2747
2775
  var isPaymentMethodFetched = storedPaymentMethod !== undefined;
2748
- var _d = usePaymentPlugins({ subdomain: subdomain, token: token }), paymentMethodAllowedPlugins = _d.paymentMethodAllowedPlugins, arePluginsFetched = _d.isFetched;
2776
+ var _d = usePaymentPlugins({ entityId: entityId, apiHost: apiHost, token: token }), paymentMethodAllowedPlugins = _d.paymentMethodAllowedPlugins, arePluginsFetched = _d.isFetched;
2749
2777
  // Derived state
2750
2778
  // If there is a quote or invoice, we are just saving a payment method and not processing a payment
2751
2779
  var showStoredPaymentMethodOption = Boolean(quote || invoice);
@@ -2780,16 +2808,16 @@ var ActualPaymentForm = function (_a) {
2780
2808
  showStoredPaymentMethodOption,
2781
2809
  storedPaymentMethod,
2782
2810
  ]);
2783
- return (jsxs(PaymentFormWrapper, __assign({ setMaxHeight: isPlugin }, { children: [showPaymentMethodSelector && (jsx(PaymentMethodSelector, { onSelect: setSelectedPaymentMethod, paymentMethodAllowedPlugins: paymentMethodAllowedPlugins, showStoredPaymentMethodOption: showStoredPaymentMethodOption, value: selectedPaymentMethod })), selectedPaymentMethod && (jsx("div", __assign({ className: "flex flex-col" }, { children: jsx(PaymentMethodForm, { invoice: invoice, isPlugin: isPlugin, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, paymentMethod: selectedPaymentMethod, quote: quote, setIsSaving: setIsSaving }) })))] })));
2811
+ return (jsxs(PaymentFormWrapper, __assign({ setMaxHeight: isPlugin }, { children: [showPaymentMethodSelector && (jsx(PaymentMethodSelector, { onSelect: setSelectedPaymentMethod, paymentMethodAllowedPlugins: paymentMethodAllowedPlugins, showStoredPaymentMethodOption: showStoredPaymentMethodOption, value: selectedPaymentMethod })), selectedPaymentMethod && (jsx("div", __assign({ className: "flex flex-col" }, { children: jsx(PaymentMethodForm, { entityId: entityId, invoice: invoice, isPlugin: isPlugin, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, paymentMethod: selectedPaymentMethod, quote: quote, setIsSaving: setIsSaving }) })))] })));
2784
2812
  };
2785
2813
  var PaymentForm = function (_a) {
2786
- var invoice = _a.invoice, isSaving = _a.isSaving, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, quote = _a.quote, setIsSaving = _a.setIsSaving;
2787
- return (jsx(ActualPaymentForm, { invoice: invoice, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, quote: quote, setIsSaving: setIsSaving }));
2814
+ var entityId = _a.entityId, invoice = _a.invoice, isSaving = _a.isSaving, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, quote = _a.quote, setIsSaving = _a.setIsSaving;
2815
+ return (jsx(ActualPaymentForm, { entityId: entityId, invoice: invoice, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, quote: quote, setIsSaving: setIsSaving }));
2788
2816
  };
2789
2817
 
2790
- 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";
2818
+ 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";
2791
2819
  var checkout = function (_a) {
2792
- var quoteId = _a.quoteId, invoiceId = _a.invoiceId, paymentMethodId = _a.paymentMethodId, paymentMethodData = _a.paymentMethodData, token = _a.token, subdomain = _a.subdomain;
2820
+ var quoteId = _a.quoteId, invoiceId = _a.invoiceId, paymentMethodId = _a.paymentMethodId, paymentMethodData = _a.paymentMethodData, token = _a.token, apiHost = _a.apiHost;
2793
2821
  return __awaiter(void 0, void 0, void 0, function () {
2794
2822
  var mutationVars, response, errors;
2795
2823
  return __generator(this, function (_b) {
@@ -2804,10 +2832,10 @@ var checkout = function (_a) {
2804
2832
  mutationVars.paymentMethodData = __assign(__assign({}, paymentMethodData), { metadata: paymentMethodData.metadata });
2805
2833
  }
2806
2834
  return [4 /*yield*/, gqlRequest({
2807
- query: MUTATION$7,
2835
+ query: MUTATION$8,
2808
2836
  token: token,
2809
2837
  vars: mutationVars,
2810
- subdomain: subdomain,
2838
+ apiHost: apiHost,
2811
2839
  })];
2812
2840
  case 1:
2813
2841
  response = _b.sent();
@@ -2824,8 +2852,8 @@ var checkout = function (_a) {
2824
2852
 
2825
2853
  var InvoiceCheckoutContext = createContext({});
2826
2854
  var InvoiceCheckout = function (_a) {
2827
- var isSaving = _a.isSaving, onSuccess = _a.onSuccess, onFail = _a.onFail, invoice = _a.invoice, setIsSaving = _a.setIsSaving, preCheckout = _a.preCheckout, setIsPreCheckoutLoading = _a.setIsPreCheckoutLoading, isPreCheckoutLoading = _a.isPreCheckoutLoading, payImmediatelyGivenInvoice = _a.payImmediatelyGivenInvoice, checkoutButtonName = _a.checkoutButtonName;
2828
- var _b = useContext(BunnyContext), subdomain = _b.subdomain, token = _b.token;
2855
+ var isSaving = _a.isSaving, onSuccess = _a.onSuccess, onFail = _a.onFail, invoice = _a.invoice, setIsSaving = _a.setIsSaving, preCheckout = _a.preCheckout, setIsPreCheckoutLoading = _a.setIsPreCheckoutLoading, isPreCheckoutLoading = _a.isPreCheckoutLoading, payImmediatelyGivenInvoice = _a.payImmediatelyGivenInvoice, checkoutButtonName = _a.checkoutButtonName, entityId = _a.entityId;
2856
+ var _b = useContext(BunnyContext), apiHost = _b.apiHost, token = _b.token;
2829
2857
  var checkoutMutation = useMutation({
2830
2858
  mutationFn: function (_a) {
2831
2859
  var pluginPaymentMethod = _a.pluginPaymentMethod, savedPaymentMethod = _a.savedPaymentMethod;
@@ -2835,7 +2863,7 @@ var InvoiceCheckout = function (_a) {
2835
2863
  invoiceId: invoice === null || invoice === void 0 ? void 0 : invoice.id,
2836
2864
  paymentMethodId: paymentMethodId,
2837
2865
  token: token,
2838
- subdomain: subdomain,
2866
+ apiHost: apiHost,
2839
2867
  });
2840
2868
  }
2841
2869
  else if (pluginPaymentMethod) {
@@ -2850,7 +2878,7 @@ var InvoiceCheckout = function (_a) {
2850
2878
  token: paymentToken,
2851
2879
  },
2852
2880
  token: token,
2853
- subdomain: subdomain,
2881
+ apiHost: apiHost,
2854
2882
  });
2855
2883
  }
2856
2884
  else
@@ -2895,7 +2923,7 @@ var InvoiceCheckout = function (_a) {
2895
2923
  invoice: invoice,
2896
2924
  setIsPreCheckoutLoading: setIsPreCheckoutLoading,
2897
2925
  isPreCheckoutLoading: isPreCheckoutLoading,
2898
- } }, { children: jsx(PaymentForm, { isSaving: isSaving, onPaymentSuccess: handleCheckout, onFail: onFail, invoice: invoice, setIsSaving: setIsSaving }) })));
2926
+ } }, { children: jsx(PaymentForm, { entityId: entityId, isSaving: isSaving, onPaymentSuccess: handleCheckout, onFail: onFail, invoice: invoice, setIsSaving: setIsSaving }) })));
2899
2927
  };
2900
2928
 
2901
2929
  var fetchPDF = function (window, apiEndpoint, invoiceUuid) { return __awaiter(void 0, void 0, void 0, function () {
@@ -2906,7 +2934,7 @@ var fetchPDF = function (window, apiEndpoint, invoiceUuid) { return __awaiter(vo
2906
2934
  if (!invoiceUuid) {
2907
2935
  throw new Error("Invoice ID is required to fetch PDF");
2908
2936
  }
2909
- return [4 /*yield*/, fetch("".concat(ApiUtils.getApiBase(window, apiEndpoint), "/legacy_invoices/").concat(invoiceUuid))];
2937
+ return [4 /*yield*/, fetch("".concat(apiEndpoint, "/api/legacy_invoices/").concat(invoiceUuid))];
2910
2938
  case 1:
2911
2939
  response = _a.sent();
2912
2940
  if (!response.ok)
@@ -2916,12 +2944,12 @@ var fetchPDF = function (window, apiEndpoint, invoiceUuid) { return __awaiter(vo
2916
2944
  });
2917
2945
  }); };
2918
2946
  function InvoicePDF(_a) {
2919
- var invoiceUuid = _a.invoiceUuid, subdomain = _a.subdomain;
2947
+ var invoiceUuid = _a.invoiceUuid, apiHost = _a.apiHost;
2920
2948
  var window = useContext(BunnyContext).window;
2921
2949
  var _b = useState(undefined), pdfUrl = _b[0], setPdfUrl = _b[1];
2922
2950
  var _c = useQuery({
2923
2951
  queryKey: ["invoicePDF", invoiceUuid],
2924
- queryFn: function () { return fetchPDF(window, subdomain || "", invoiceUuid); },
2952
+ queryFn: function () { return fetchPDF(window, apiHost || "", invoiceUuid); },
2925
2953
  enabled: Boolean(invoiceUuid),
2926
2954
  }), pdfBlob = _c.data, isLoading = _c.isLoading;
2927
2955
  useEffect(function () {
@@ -2941,20 +2969,30 @@ function InvoicePDF(_a) {
2941
2969
  }, title: "Invoice PDF", width: "100%" }));
2942
2970
  }
2943
2971
 
2972
+ var quoteMetaDescription = function (vendorName) {
2973
+ return "View this quote on the ".concat(vendorName, " customer portal. Powered by Bunny");
2974
+ };
2975
+ var quoteMetaTitle = function (_a) {
2976
+ var documentName = _a.documentName, vendorName = _a.vendorName;
2977
+ return vendorName + " " + documentName;
2978
+ };
2979
+
2944
2980
  function ActualInvoice(_a) {
2945
- var id = _a.id, invoiceQuoteViewComponent = _a.invoiceQuoteViewComponent, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick, onPaymentSuccess = _a.onPaymentSuccess;
2981
+ var id = _a.id, invoiceQuoteViewComponent = _a.invoiceQuoteViewComponent, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick, onPaymentSuccess = _a.onPaymentSuccess, entityId = _a.entityId;
2982
+ var window = useContext(BunnyContext).window;
2983
+ var isMobile = useIsMobile(window);
2946
2984
  var _b = useState(false), isSaving = _b[0], setIsSaving = _b[1];
2947
2985
  var queryClient = useQueryClient();
2948
- var isMobile = useIsMobile$1();
2949
- var showSuccessNotification = NotificationUtils.useSuccessNotification();
2950
- var handleAllErrorFormats = NotificationUtils.useAllErrorFormats(function (url) {
2951
- console.log("navigate to", url);
2952
- });
2953
- var _c = useContext(BunnyContext), subdomain = _c.subdomain, token = _c.token;
2986
+ var _c = useContext(BunnyContext), apiHost = _c.apiHost, token = _c.token, onErrorNavigate = _c.onErrorNavigate;
2987
+ var showSuccessNotification = useSuccessNotification();
2988
+ var handleAllErrorFormats = useAllErrorFormats(onErrorNavigate ||
2989
+ (function (url) {
2990
+ console.log("navigate to", url, " not implemented");
2991
+ }));
2954
2992
  // Queries
2955
2993
  var _d = useQuery({
2956
2994
  queryKey: QueryKeyFactory.default.createFormattedInvoiceKey(token, id),
2957
- queryFn: function () { return getFormattedInvoice({ id: id, token: token, subdomain: subdomain }); },
2995
+ queryFn: function () { return getFormattedInvoice({ id: id, token: token, apiHost: apiHost }); },
2958
2996
  }), formattedInvoice = _d.data, error = _d.error;
2959
2997
  if (error) {
2960
2998
  return jsxs("div", { children: ["Error loading invoice: ", error.message] });
@@ -2981,24 +3019,39 @@ function ActualInvoice(_a) {
2981
3019
  };
2982
3020
  // Derived state
2983
3021
  var isInvoicePayable = PAYABLE_INVOICE_STATES.includes((formattedInvoice === null || formattedInvoice === void 0 ? void 0 : formattedInvoice.state) || "");
2984
- return (jsxs(Fragment, { children: [jsxs(Helmet, { children: [jsxs("title", { children: [formattedInvoice.vendorName, " ", DOCUMENT_NAME$1.INVOICE] }), jsx("meta", { name: "description", content: QuoteInvoiceUtils.quoteMetaDescription(formattedInvoice.vendorName) }), jsx("meta", { property: "og:type", content: "website" }), jsx("meta", { property: "og:title", content: QuoteInvoiceUtils.quoteMetaTitle({
3022
+ return (jsxs(Fragment, { children: [jsxs(Helmet, { children: [jsxs("title", { children: [formattedInvoice.vendorName, " ", DOCUMENT_NAME$1.INVOICE] }), jsx("meta", { name: "description", content: quoteMetaDescription(formattedInvoice.vendorName) }), jsx("meta", { property: "og:type", content: "website" }), jsx("meta", { property: "og:title", content: quoteMetaTitle({
2985
3023
  vendorName: formattedInvoice.vendorName,
2986
3024
  documentName: DOCUMENT_NAME$1.INVOICE,
2987
- }) }), jsx("meta", { property: "og:description", content: QuoteInvoiceUtils.quoteMetaDescription(formattedInvoice.vendorName) })] }), jsxs("div", __assign({ className: "flex gap-6 ".concat(isMobile ? "flex-col w-full overflow-hidden" : "shadow-padding-xb") }, { children: [formattedInvoice.isLegacy ? (jsx("div", __assign({ className: "flex justify-center w-full" }, { children: jsx(InvoicePDF, { invoiceUuid: formattedInvoice.uuid, subdomain: subdomain }) }))) : (invoiceQuoteViewComponent || (jsx(InvoiceQuoteView, { html: formattedInvoice.html, isMobile: isMobile, formattedInvoice: formattedInvoice, backButtonName: backButtonName, onBackButtonClick: onBackButtonClick }))), !isMobile && isInvoicePayable && (jsx(Divider, { className: "h-full", type: "vertical" })), isInvoicePayable && (jsx(InvoiceCheckout, { invoice: formattedInvoice, isSaving: isSaving, onFail: function (error) {
3025
+ }) }), jsx("meta", { property: "og:description", content: quoteMetaDescription(formattedInvoice.vendorName) })] }), jsxs("div", __assign({ className: "flex gap-6 ".concat(isMobile ? "flex-col w-full overflow-hidden" : "shadow-padding-xb") }, { children: [formattedInvoice.isLegacy ? (jsx("div", __assign({ className: "flex justify-center w-full" }, { children: jsx(InvoicePDF, { invoiceUuid: formattedInvoice.uuid, apiHost: apiHost }) }))) : (invoiceQuoteViewComponent || (jsx(InvoiceQuoteView, { html: formattedInvoice.html, formattedInvoice: formattedInvoice, backButtonName: backButtonName, onBackButtonClick: onBackButtonClick }))), !isMobile && isInvoicePayable && (jsx(Divider, { className: "h-full", type: "vertical" })), isInvoicePayable && (jsx(InvoiceCheckout, { invoice: formattedInvoice, isSaving: isSaving, onFail: function (error) {
2988
3026
  onFail(error);
2989
3027
  setIsSaving(false);
2990
- }, onSuccess: onSuccess, setIsSaving: setIsSaving }))] }))] }));
3028
+ }, onSuccess: onSuccess, setIsSaving: setIsSaving, entityId: entityId }))] }))] }));
2991
3029
  }
2992
3030
  function Invoice(_a) {
2993
- var id = _a.id, invoiceQuoteViewComponent = _a.invoiceQuoteViewComponent, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick; _a.onInvoiceDownloadError; var onPaymentSuccess = _a.onPaymentSuccess;
2994
- return (jsx(HelmetProvider, { children: jsx(ActualInvoice, { id: id, invoiceQuoteViewComponent: invoiceQuoteViewComponent, backButtonName: backButtonName, onBackButtonClick: onBackButtonClick, onPaymentSuccess: onPaymentSuccess }) }));
3031
+ var id = _a.id, invoiceQuoteViewComponent = _a.invoiceQuoteViewComponent, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick; _a.onInvoiceDownloadError; var onPaymentSuccess = _a.onPaymentSuccess, entityId = _a.entityId;
3032
+ return (jsx(HelmetProvider, { children: jsx(ActualInvoice, { id: id, invoiceQuoteViewComponent: invoiceQuoteViewComponent, backButtonName: backButtonName, onBackButtonClick: onBackButtonClick, onPaymentSuccess: onPaymentSuccess, entityId: entityId }) }));
2995
3033
  }
2996
3034
 
2997
- var DOCUMENT_NAME;
2998
- (function (DOCUMENT_NAME) {
2999
- DOCUMENT_NAME["INVOICE"] = "invoice";
3000
- DOCUMENT_NAME["QUOTE"] = "quote";
3001
- })(DOCUMENT_NAME || (DOCUMENT_NAME = {}));
3035
+ 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 }"; };
3036
+ var getFormattedQuote = function (_a) {
3037
+ var id = _a.id, token = _a.token, apiHost = _a.apiHost;
3038
+ return __awaiter(void 0, void 0, void 0, function () {
3039
+ var response;
3040
+ return __generator(this, function (_b) {
3041
+ switch (_b.label) {
3042
+ case 0: return [4 /*yield*/, gqlRequest({
3043
+ query: MUTATION$7(),
3044
+ token: token,
3045
+ apiHost: apiHost,
3046
+ vars: { id: id },
3047
+ })];
3048
+ case 1:
3049
+ response = _b.sent();
3050
+ return [2 /*return*/, response === null || response === void 0 ? void 0 : response.formattedQuote];
3051
+ }
3052
+ });
3053
+ });
3054
+ };
3002
3055
 
3003
3056
  var filterSigningPlugins = function (plugins) {
3004
3057
  return plugins === null || plugins === void 0 ? void 0 : plugins.filter(function (plugin) {
@@ -3007,27 +3060,31 @@ var filterSigningPlugins = function (plugins) {
3007
3060
  ((_b = plugin.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === "valid";
3008
3061
  });
3009
3062
  };
3010
- var useSigningPlugins = function (token, subdomain) {
3011
- var plugins = usePlugins({ token: token, subdomain: subdomain });
3063
+ var useSigningPlugins = function (_a) {
3064
+ var entityId = _a.entityId, apiHost = _a.apiHost, token = _a.token;
3065
+ var plugins = usePlugins({ entityId: entityId, apiHost: apiHost, token: token });
3012
3066
  return filterSigningPlugins(plugins.data);
3013
3067
  };
3014
3068
 
3015
- var useSendAcceptQuote = function (token, subdomain, quoteId) {
3069
+ var useSendAcceptQuote = function (_a) {
3070
+ var entityId = _a.entityId, onErrorNavigate = _a.onErrorNavigate, quoteId = _a.quoteId, apiHost = _a.apiHost, token = _a.token;
3016
3071
  // Hooks
3017
- var graphQLMutation = GraphqlUtils.useGraphQLmutation(function () {
3072
+ var graphQLMutation = useGraphQLmutation(function () {
3018
3073
  console.log("navigate in useGraphQLmutation in useSendAcceptQuote is not yet implemented");
3019
- }, subdomain || "", function () {
3074
+ }, apiHost || "", function () {
3020
3075
  console.log("onError in useGraphQLmutation in useSendAcceptQuote is not yet implemented");
3021
3076
  });
3022
- // const handleAllErrorFormats = useAllErrorFormats();
3023
- var signingPlugins = useSigningPlugins(token, subdomain);
3024
- console.log("signingPlugins in useSendAcceptQuote: ", signingPlugins);
3077
+ var handleAllErrorFormats = useAllErrorFormats(onErrorNavigate ||
3078
+ (function (url) {
3079
+ console.log("navigate to", url, " not implemented");
3080
+ }));
3081
+ var signingPlugins = useSigningPlugins({ entityId: entityId, apiHost: apiHost, token: token });
3025
3082
  var queryClient = useQueryClient();
3026
3083
  // Local state
3027
- var _a = useState(false), acceptBoxVisible = _a[0], setAcceptBoxVisible = _a[1];
3028
- var _b = useState(false), isAccepting = _b[0], setIsAccepting = _b[1];
3084
+ var _b = useState(false), acceptBoxVisible = _b[0], setAcceptBoxVisible = _b[1];
3085
+ var _c = useState(false), isAccepting = _c[0], setIsAccepting = _c[1];
3029
3086
  // Pandadoc polling modal state
3030
- var _c = useState(false), pandadocPollingModalVisible = _c[0], setPandadocPollingModalVisible = _c[1];
3087
+ var _d = useState(false), pandadocPollingModalVisible = _d[0], setPandadocPollingModalVisible = _d[1];
3031
3088
  var redirectForSigning = function () {
3032
3089
  var mutation = "mutation quoteSigningUrlCreate($quoteId: ID) {\n quoteSigningUrlCreate(quoteId: $quoteId) {\n redirectUri\n pluginClientId\n pluginShortName\n errors\n }\n }";
3033
3090
  var variables = {
@@ -3040,10 +3097,7 @@ var useSendAcceptQuote = function (token, subdomain, quoteId) {
3040
3097
  console.log("rsp.data.quoteSigningUrlCreate.pluginShortName === 'pandadoc'", rsp.data.quoteSigningUrlCreate.pluginShortName === "pandadoc");
3041
3098
  console.log("rsp", rsp);
3042
3099
  if (rsp.data.quoteSigningUrlCreate.pluginShortName === "dropbox_sign") {
3043
- // openDropboxSignModal(
3044
- // rsp.data.quoteSigningUrlCreate.pluginClientId,
3045
- // rsp.data.quoteSigningUrlCreate.redirectUri
3046
- // );
3100
+ openDropboxSignModal(rsp.data.quoteSigningUrlCreate.pluginClientId, rsp.data.quoteSigningUrlCreate.redirectUri);
3047
3101
  console.log("dropbox sign is not implemented");
3048
3102
  }
3049
3103
  else if (rsp.data.quoteSigningUrlCreate.pluginShortName === "pandadoc") {
@@ -3058,31 +3112,39 @@ var useSendAcceptQuote = function (token, subdomain, quoteId) {
3058
3112
  });
3059
3113
  };
3060
3114
  // TODO: Fix hellosign-embedded window is undefined bug
3061
- // const openDropboxSignModal = async (clientId: string, url: string) => {
3062
- // if (typeof window === "undefined") {
3063
- // return;
3064
- // }
3065
- // const { default: HelloSign } = await import("hellosign-embedded");
3066
- // const client = new HelloSign({
3067
- // clientId: clientId,
3068
- // });
3069
- // client.on("sign", (data: any) => {
3070
- // // Change the UI to show accepted?
3071
- // });
3072
- // // Open the DropboxSign modal
3073
- // client.open(url, {
3074
- // clientId: clientId,
3075
- // skipDomainVerification: false, // Set true for development testing
3076
- // });
3077
- // };
3115
+ var openDropboxSignModal = function (clientId, url) { return __awaiter(void 0, void 0, void 0, function () {
3116
+ var HelloSign, client;
3117
+ return __generator(this, function (_a) {
3118
+ switch (_a.label) {
3119
+ case 0:
3120
+ if (typeof window === "undefined") {
3121
+ return [2 /*return*/];
3122
+ }
3123
+ return [4 /*yield*/, import('hellosign-embedded')];
3124
+ case 1:
3125
+ HelloSign = (_a.sent()).default;
3126
+ client = new HelloSign({
3127
+ clientId: clientId,
3128
+ });
3129
+ client.on("sign", function (data) {
3130
+ // Change the UI to show accepted?
3131
+ });
3132
+ // Open the DropboxSign modal
3133
+ client.open(url, {
3134
+ clientId: clientId,
3135
+ skipDomainVerification: false, // Set true for development testing
3136
+ });
3137
+ return [2 /*return*/];
3138
+ }
3139
+ });
3140
+ }); };
3078
3141
  // TODO: update useing fetch
3079
3142
  var sendAccept = function (changedFormItems) {
3080
3143
  var mutation = "mutation quoteAccept($name: String!, $title: String!, $poNumber: String, $taxNumber: String, $quoteId: ID) {\n quoteAccept(name: $name, title: $title, poNumber: $poNumber, taxNumber: $taxNumber, quoteId: $quoteId) {\n errors\n }\n }";
3081
3144
  var variables = __assign(__assign({}, changedFormItems), { quoteId: quoteId });
3082
3145
  graphQLMutation(token, mutation, variables, function (rsp) {
3083
- // if (rsp.errors) handleAllErrorFormats(rsp.errors);
3084
3146
  if (rsp.errors)
3085
- console.log("rsp.errors", rsp.errors);
3147
+ handleAllErrorFormats(rsp.errors);
3086
3148
  else {
3087
3149
  setAcceptBoxVisible(false);
3088
3150
  queryClient.invalidateQueries({
@@ -3128,45 +3190,6 @@ var useSigningComplete = function (_a) {
3128
3190
  }, [data, eventParam, queryClient, token]);
3129
3191
  };
3130
3192
 
3131
- var ModalOverrideBrandStylings = styled(Modal)(templateObject_1$6 || (templateObject_1$6 = __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);
3132
- var StyledModal$1 = function (props) {
3133
- return jsx(ModalOverrideBrandStylings, __assign({ closable: false }, props));
3134
- };
3135
- var templateObject_1$6;
3136
-
3137
- var useFocusFirstInput = function (_a) {
3138
- var firstInputRef = _a.firstInputRef, isVisible = _a.isVisible;
3139
- useEffect(function () {
3140
- var _a;
3141
- (_a = firstInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
3142
- }, [isVisible, firstInputRef]);
3143
- };
3144
-
3145
- var AcceptQuoteModal = function (_a) {
3146
- var acceptBoxVisible = _a.acceptBoxVisible, formattedQuote = _a.formattedQuote, sendAccept = _a.sendAccept, setAcceptBoxVisible = _a.setAcceptBoxVisible, setIsAccepting = _a.setIsAccepting;
3147
- // Refs
3148
- var firstInputRef = useRef(null);
3149
- // Hooks
3150
- var form = Form.useForm()[0];
3151
- useFocusFirstInput({ firstInputRef: firstInputRef, isVisible: acceptBoxVisible });
3152
- // Derived state
3153
- var poNumberRequired = formattedQuote.poNumberRequired, taxNumberRequired = formattedQuote.taxNumberRequired, taxNumberLabel = formattedQuote.taxNumberLabel;
3154
- var createRules = function (required, title) {
3155
- return required ? [{ required: true, message: "".concat(title, " is required") }] : [];
3156
- };
3157
- return (jsx(StyledModal$1, __assign({ centered: true, okText: "Accept", onCancel: function () {
3158
- setAcceptBoxVisible(false);
3159
- setIsAccepting(false);
3160
- }, onOk: function () {
3161
- form
3162
- .validateFields()
3163
- .then(function (changedFields) {
3164
- sendAccept(changedFields);
3165
- })
3166
- .catch(function () { });
3167
- }, 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, {}) })))] })) })));
3168
- };
3169
-
3170
3193
  var dayjs_min = {exports: {}};
3171
3194
 
3172
3195
  (function (module, exports) {
@@ -3181,13 +3204,16 @@ var useIsExpired = function (expiresAt) {
3181
3204
 
3182
3205
  var PandadocPollingModal = function (_a) {
3183
3206
  var isVisible = _a.isVisible, setVisible = _a.setVisible, id = _a.id;
3184
- var _b = useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain;
3185
- var graphQLMutation = GraphqlUtils.useGraphQLmutation(function () {
3207
+ var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, onErrorNavigate = _b.onErrorNavigate;
3208
+ var graphQLMutation = useGraphQLmutation(function () {
3186
3209
  console.log("graphQLMutation navigateOnTokenExpired not yet implemented");
3187
- }, subdomain || "", function () {
3210
+ }, apiHost || "", function () {
3188
3211
  console.log("graphQLMutation onError not yet implemented");
3189
3212
  });
3190
- var handleAllErrorFormats = NotificationUtils.useAllErrorFormats(function () { });
3213
+ var handleAllErrorFormats = useAllErrorFormats(onErrorNavigate ||
3214
+ (function (url) {
3215
+ console.log("navigate to", url, " not implemented");
3216
+ }));
3191
3217
  var _c = useState(0), numberOfPolls = _c[0], setNumberOfPolls = _c[1];
3192
3218
  var _d = useState(""), infoMessage = _d[0], setInfoMessage = _d[1];
3193
3219
  useEffect(function () {
@@ -3222,80 +3248,109 @@ var PandadocPollingModal = function (_a) {
3222
3248
  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 }))] })));
3223
3249
  };
3224
3250
 
3225
- 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 }"; };
3226
- var getFormattedQuote = function (_a) {
3227
- var id = _a.id, token = _a.token, subdomain = _a.subdomain;
3228
- return __awaiter(void 0, void 0, void 0, function () {
3229
- var response;
3230
- return __generator(this, function (_b) {
3231
- switch (_b.label) {
3232
- case 0: return [4 /*yield*/, gqlRequest({
3233
- query: MUTATION$6(),
3234
- token: token,
3235
- subdomain: subdomain,
3236
- vars: { id: id },
3237
- })];
3238
- case 1:
3239
- response = _b.sent();
3240
- return [2 /*return*/, response === null || response === void 0 ? void 0 : response.formattedQuote];
3241
- }
3242
- });
3243
- });
3251
+ var ModalOverrideBrandStylings = styled(Modal)(templateObject_1$5 || (templateObject_1$5 = __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);
3252
+ var StyledModal$1 = function (props) {
3253
+ return jsx(ModalOverrideBrandStylings, __assign({ closable: false }, props));
3244
3254
  };
3255
+ var templateObject_1$5;
3256
+
3257
+ var useFocusFirstInput = function (_a) {
3258
+ var firstInputRef = _a.firstInputRef, isVisible = _a.isVisible;
3259
+ useEffect(function () {
3260
+ var _a;
3261
+ (_a = firstInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
3262
+ }, [isVisible, firstInputRef]);
3263
+ };
3264
+
3265
+ var AcceptQuoteModal = function (_a) {
3266
+ var acceptBoxVisible = _a.acceptBoxVisible, formattedQuote = _a.formattedQuote, sendAccept = _a.sendAccept, setAcceptBoxVisible = _a.setAcceptBoxVisible, setIsAccepting = _a.setIsAccepting;
3267
+ // Refs
3268
+ var firstInputRef = useRef(null);
3269
+ // Hooks
3270
+ var form = Form.useForm()[0];
3271
+ useFocusFirstInput({ firstInputRef: firstInputRef, isVisible: acceptBoxVisible });
3272
+ // Derived state
3273
+ var poNumberRequired = formattedQuote.poNumberRequired, taxNumberRequired = formattedQuote.taxNumberRequired, taxNumberLabel = formattedQuote.taxNumberLabel;
3274
+ var createRules = function (required, title) {
3275
+ return required ? [{ required: true, message: "".concat(title, " is required") }] : [];
3276
+ };
3277
+ return (jsx(StyledModal$1, __assign({ centered: true, okText: "Accept", onCancel: function () {
3278
+ setAcceptBoxVisible(false);
3279
+ setIsAccepting(false);
3280
+ }, onOk: function () {
3281
+ form
3282
+ .validateFields()
3283
+ .then(function (changedFields) {
3284
+ sendAccept(changedFields);
3285
+ })
3286
+ .catch(function () { });
3287
+ }, 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, {}) })))] })) })));
3288
+ };
3289
+
3290
+ var DOCUMENT_NAME;
3291
+ (function (DOCUMENT_NAME) {
3292
+ DOCUMENT_NAME["INVOICE"] = "invoice";
3293
+ DOCUMENT_NAME["QUOTE"] = "quote";
3294
+ })(DOCUMENT_NAME || (DOCUMENT_NAME = {}));
3245
3295
 
3246
3296
  var documentName = DOCUMENT_NAME.QUOTE;
3247
3297
  function ActualQuote(_a) {
3248
3298
  var _b, _c;
3249
- var id = _a.id;
3250
- var _d = useContext(BunnyContext), token = _d.token, subdomain = _d.subdomain;
3299
+ var id = _a.id, entityId = _a.entityId;
3300
+ var _d = useContext(BunnyContext), token = _d.token, apiHost = _d.apiHost, onErrorNavigate = _d.onErrorNavigate;
3251
3301
  var entityBranding = useContext(BrandContext);
3252
- var isMobile = useIsMobile$1();
3302
+ var isMobile = useIsMobile(window);
3253
3303
  // Queries
3254
3304
  var _e = useQuery({
3255
3305
  queryKey: QueryKeyFactory.default.createQuoteKey(token, id),
3256
- queryFn: function () { return getFormattedQuote({ token: token, subdomain: subdomain, id: id }); },
3306
+ queryFn: function () { return getFormattedQuote({ token: token, apiHost: apiHost, id: id }); },
3257
3307
  placeholderData: keepPreviousData,
3258
3308
  }), data = _e.data, isLoading = _e.isLoading;
3259
- useQuery({
3260
- queryKey: QueryKeyFactory.default.currentUserKey,
3261
- queryFn: function () { return getCurrentUserData({ token: token, subdomain: subdomain }); },
3262
- });
3263
3309
  var formattedQuote = data;
3264
3310
  // Hooks
3265
3311
  var downloadFile = useDownloadFile(id);
3266
3312
  var isExpired = useIsExpired(formattedQuote === null || formattedQuote === void 0 ? void 0 : formattedQuote.expiresAt);
3267
- var _f = useSendAcceptQuote(token, subdomain, id), acceptBoxVisible = _f.acceptBoxVisible, isAccepting = _f.isAccepting, sendAccept = _f.sendAccept, setAcceptBoxVisible = _f.setAcceptBoxVisible, setIsAccepting = _f.setIsAccepting, startAcceptance = _f.startAcceptance, pandadocPollingModalVisible = _f.pandadocPollingModalVisible, setPandadocPollingModalVisible = _f.setPandadocPollingModalVisible;
3313
+ var _f = useSendAcceptQuote({
3314
+ entityId: entityId,
3315
+ token: token,
3316
+ onErrorNavigate: onErrorNavigate ||
3317
+ (function (url) {
3318
+ console.log("navigate to", url, " not implemented");
3319
+ }),
3320
+ apiHost: apiHost,
3321
+ quoteId: id,
3322
+ }), acceptBoxVisible = _f.acceptBoxVisible, isAccepting = _f.isAccepting, sendAccept = _f.sendAccept, setAcceptBoxVisible = _f.setAcceptBoxVisible, setIsAccepting = _f.setIsAccepting, startAcceptance = _f.startAcceptance, pandadocPollingModalVisible = _f.pandadocPollingModalVisible, setPandadocPollingModalVisible = _f.setPandadocPollingModalVisible;
3268
3323
  useSigningComplete({ data: formattedQuote, token: token });
3269
3324
  if (!formattedQuote || isLoading) {
3270
3325
  return jsx(Fragment, {});
3271
3326
  }
3272
- return (jsxs(Fragment, { children: [jsxs(Helmet, { children: [jsxs("title", { children: [formattedQuote.vendorName, " ", documentName] }), jsx("meta", { name: "description", content: QuoteInvoiceUtils.quoteMetaDescription(formattedQuote.vendorName) }), jsx("meta", { property: "og:type", content: "website" }), jsx("meta", { property: "og:title", content: QuoteInvoiceUtils.quoteMetaTitle({
3327
+ return (jsxs(Fragment, { children: [jsxs(Helmet, { children: [jsxs("title", { children: [formattedQuote.vendorName, " ", documentName] }), jsx("meta", { name: "description", content: quoteMetaDescription(formattedQuote.vendorName) }), jsx("meta", { property: "og:type", content: "website" }), jsx("meta", { property: "og:title", content: quoteMetaTitle({
3273
3328
  vendorName: formattedQuote.vendorName,
3274
3329
  documentName: documentName,
3275
- }) }), jsx("meta", { property: "og:description", content: QuoteInvoiceUtils.quoteMetaDescription(formattedQuote.vendorName) })] }), jsxs("div", __assign({ className: "flex shadow-padding-x ".concat(isMobile ? "flex-col gap-1" : "items-center gap-2", " justify-end pb-4"), id: "acceptance", style: {
3330
+ }) }), jsx("meta", { property: "og:description", content: quoteMetaDescription(formattedQuote.vendorName) })] }), jsxs("div", __assign({ className: "flex shadow-padding-x ".concat(isMobile ? "flex-col gap-1" : "items-center gap-2", " justify-end pb-4"), id: "acceptance", style: {
3276
3331
  color: entityBranding.secondaryColor,
3277
3332
  } }, { children: [formattedQuote.state === "ACCEPTED" ||
3278
3333
  formattedQuote.state === "APPLIED" ? (jsxs("div", { children: [formattedQuote.state === "ACCEPTED" &&
3279
3334
  formattedQuote.acceptedAt &&
3280
- "Quote was accepted by ".concat(formattedQuote.acceptedByName, " on ").concat(Misc.formatDate(formattedQuote.acceptedAt)), formattedQuote.state === "APPLIED" &&
3335
+ "Quote was accepted by ".concat(formattedQuote.acceptedByName, " on ").concat(formatDate(formattedQuote.acceptedAt)), formattedQuote.state === "APPLIED" &&
3281
3336
  formattedQuote.acceptedAt &&
3282
- "Quote is now applied. Accepted by ".concat(formattedQuote.acceptedByName, " on ").concat(Misc.formatDate(formattedQuote.acceptedAt))] })) : null, jsxs("div", __assign({ className: isMobile
3337
+ "Quote is now applied. Accepted by ".concat(formattedQuote.acceptedByName, " on ").concat(formatDate(formattedQuote.acceptedAt))] })) : null, jsxs("div", __assign({ className: isMobile
3283
3338
  ? "flex w-full justify-between gap-2"
3284
- : "flex items-center justify-end gap-2" }, { children: [!isMobile ? (jsx(Button, __assign({ icon: jsx(DownloadOutlined$1, {}), onClick: function () { return downloadFile(subdomain + "/api/pdf/quote", token); } }, { children: "Download" }))) : null, formattedQuote.state !== "ACCEPTED" &&
3285
- formattedQuote.state !== "APPLIED" ? (jsx(Button, __assign({ disabled: isExpired || isAccepting, onClick: function () { return startAcceptance(); }, type: "primary" }, { children: isExpired ? "Quote is expired" : "Accept quote" }))) : null] }))] })), jsx("div", __assign({ className: "flex ".concat(isMobile ? "flex-col w-full overflow-hidden" : "shadow-padding-xb") }, { children: jsx(InvoiceQuoteView, __assign({ html: formattedQuote.html, isMobile: isMobile }, { 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) {
3339
+ : "flex items-center justify-end gap-2" }, { children: [!isMobile ? (jsx(Button, __assign({ icon: jsx(DownloadOutlined$1, {}), onClick: function () { return downloadFile(apiHost + "/api/pdf/quote", token); } }, { children: "Download" }))) : null, formattedQuote.state !== "ACCEPTED" &&
3340
+ formattedQuote.state !== "APPLIED" ? (jsx(Button, __assign({ disabled: isExpired || isAccepting, onClick: function () { return startAcceptance(); }, type: "primary" }, { children: isExpired ? "Quote is expired" : "Accept quote" }))) : null] }))] })), jsx("div", __assign({ className: "flex ".concat(isMobile ? "flex-col w-full overflow-hidden" : "shadow-padding-xb") }, { children: 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) {
3286
3341
  return (jsx(Button, __assign({ download: doc.filename, href: doc.url, type: "link" }, { children: doc.filename }), index));
3287
3342
  }) }))) : null })) })), jsx(AcceptQuoteModal, { acceptBoxVisible: acceptBoxVisible, formattedQuote: formattedQuote, setAcceptBoxVisible: setAcceptBoxVisible, setIsAccepting: setIsAccepting, sendAccept: sendAccept }), jsx(PandadocPollingModal, { isVisible: pandadocPollingModalVisible, setVisible: setPandadocPollingModalVisible, id: id })] }));
3288
3343
  }
3289
- styled.div(templateObject_1$5 || (templateObject_1$5 = __makeTemplateObject(["\n span {\n width: 100%;\n }\n"], ["\n span {\n width: 100%;\n }\n"])));
3344
+ styled.div(templateObject_1$4 || (templateObject_1$4 = __makeTemplateObject(["\n span {\n width: 100%;\n }\n"], ["\n span {\n width: 100%;\n }\n"])));
3290
3345
  function Quote(_a) {
3291
- var id = _a.id;
3292
- return (jsx(HelmetProvider, { children: jsx(ActualQuote, { id: id }) }));
3346
+ var entityId = _a.entityId, id = _a.id;
3347
+ return (jsx(HelmetProvider, { children: jsx(ActualQuote, { entityId: entityId, id: id }) }));
3293
3348
  }
3294
- var templateObject_1$5;
3349
+ var templateObject_1$4;
3295
3350
 
3296
3351
  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 }"); };
3297
3352
  var getQuotes = function (_a) {
3298
- var token = _a.token, subdomain = _a.subdomain, filter = _a.filter;
3353
+ var token = _a.token, apiHost = _a.apiHost, filter = _a.filter;
3299
3354
  return __awaiter(void 0, void 0, void 0, function () {
3300
3355
  var response;
3301
3356
  return __generator(this, function (_b) {
@@ -3304,7 +3359,7 @@ var getQuotes = function (_a) {
3304
3359
  query: QUOTES_QUERY(filter),
3305
3360
  token: token,
3306
3361
  vars: {},
3307
- subdomain: subdomain,
3362
+ apiHost: apiHost,
3308
3363
  })];
3309
3364
  case 1:
3310
3365
  response = _b.sent();
@@ -3315,12 +3370,12 @@ var getQuotes = function (_a) {
3315
3370
  };
3316
3371
 
3317
3372
  var transactionMutation = function (filter) { return "\nquery transactions {\n transactions ".concat(filter ? "(".concat(filter, ")") : "", " {\n nodes {\n amount\n createdAt\n currencyId\n description\n id\n kind\n state\n transactionableId\n transactionable {\n ...on Payment { amount }\n ...on Invoice { amount number }\n }\n }\n }\n}"); };
3318
- var getTransactions = function (filter, token, subdomain, kindsToShow) { return __awaiter(void 0, void 0, void 0, function () {
3373
+ var getTransactions = function (filter, token, apiHost, kindsToShow) { return __awaiter(void 0, void 0, void 0, function () {
3319
3374
  var response, _a, data, errors, transactions;
3320
3375
  var _b, _c;
3321
3376
  return __generator(this, function (_d) {
3322
3377
  switch (_d.label) {
3323
- case 0: return [4 /*yield*/, fetch(subdomain + "/graphql", {
3378
+ case 0: return [4 /*yield*/, fetch(apiHost + "/graphql", {
3324
3379
  method: "POST",
3325
3380
  headers: {
3326
3381
  "Content-type": "application/json; charset=utf-8",
@@ -3344,25 +3399,10 @@ var getTransactions = function (filter, token, subdomain, kindsToShow) { return
3344
3399
  });
3345
3400
  }); };
3346
3401
 
3347
- var pageContentRefState = atom({
3348
- key: "pageContentRefState",
3349
- default: undefined,
3350
- });
3351
-
3352
- var PageContent = function (_a) {
3353
- var children = _a.children, className = _a.className, style = _a.style;
3354
- var pageContentRef = useRef(null);
3355
- var setPageContentRef = useSetRecoilState(pageContentRefState);
3356
- useEffect(function () {
3357
- setPageContentRef(pageContentRef === null || pageContentRef === void 0 ? void 0 : pageContentRef.current);
3358
- }, [pageContentRef, setPageContentRef]);
3359
- return (jsx("div", __assign({ className: className, ref: pageContentRef, style: style }, { children: children })));
3360
- };
3361
-
3362
3402
  var Text$b = Typography.Text;
3363
3403
  var PageHeaderWithActions = function (_a) {
3364
3404
  var children = _a.children, title = _a.title;
3365
- var isMobile = useIsMobile$1();
3405
+ var isMobile = useIsMobile(window);
3366
3406
  return (jsxs("div", __assign({ className: "flex pb-4 shadow-padding-x ".concat(isMobile ? "flex-col gap-2" : "items-center justify-between h-8") }, { children: [jsx(PageSubTitle, { title: title }), children] })));
3367
3407
  };
3368
3408
  var PageSubTitle = function (_a) {
@@ -3402,31 +3442,12 @@ var getColor = function (state) {
3402
3442
  }
3403
3443
  };
3404
3444
 
3405
- var TransactionGridCell = styled.div.withConfig({
3406
- shouldForwardProp: function (prop) {
3407
- return !["gridColumn", "padding", "right"].includes(prop);
3408
- },
3409
- })(templateObject_1$4 || (templateObject_1$4 = __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) { return (props.right ? "flex-end" : "flex-start"); }, function (props) { return (props.right ? "right" : "left"); }, SLATE_600);
3410
- var templateObject_1$4;
3445
+ var TransactionsListContext = createContext({});
3411
3446
 
3412
3447
  var Text$a = Typography.Text;
3413
3448
  var TransactionDate = function (_a) {
3414
3449
  var date = _a.date;
3415
- return jsx(Text$a, __assign({ className: "text-sm" }, { children: Misc.formatDate(date) }));
3416
- };
3417
-
3418
- var isInvoice = function (transaction) {
3419
- return transaction.kind === "INVOICE";
3420
- };
3421
- var isQuote = function (transaction) {
3422
- return transaction.kind === "QUOTE";
3423
- };
3424
- var TransactionRowTitle = function (_a) {
3425
- var transaction = _a.transaction;
3426
- if (!isInvoice(transaction) && !isQuote(transaction)) {
3427
- return jsx(Fragment, {});
3428
- }
3429
- return (jsx("span", __assign({ className: "text-slate-400", style: { fontSize: "11px" } }, { children: transaction.transactionable.number })));
3450
+ return jsx(Text$a, __assign({ className: "text-sm" }, { children: formatDate(date) }));
3430
3451
  };
3431
3452
 
3432
3453
  // TODO: delete
@@ -3435,18 +3456,16 @@ var ArrowDownToLine = function (_a) {
3435
3456
  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" })] })));
3436
3457
  };
3437
3458
 
3438
- var TransactionsListContext = createContext({});
3439
-
3440
3459
  var TransactionDownload = function (_a) {
3441
- var transaction = _a.transaction, token = _a.token, subdomain = _a.subdomain;
3460
+ var transaction = _a.transaction, token = _a.token, apiHost = _a.apiHost;
3442
3461
  var darkMode = useContext(BunnyContext).darkMode;
3443
3462
  var downloadTransactionLink = useContext(TransactionsListContext).downloadTransactionLink;
3444
3463
  var downloadFile = useDownloadFile();
3445
- var isMobile = useIsMobile$1();
3464
+ var isMobile = useIsMobile(window);
3446
3465
  var isClickable = transaction.kind === "INVOICE" || downloadTransactionLink !== undefined;
3447
3466
  var downloadLink = downloadTransactionLink
3448
3467
  ? downloadTransactionLink(transaction.transactionableId)
3449
- : "".concat(subdomain, "/api/pdf/invoice/").concat(transaction.transactionableId);
3468
+ : "".concat(apiHost, "/api/pdf/invoice/").concat(transaction.transactionableId);
3450
3469
  if (!isClickable)
3451
3470
  return null;
3452
3471
  return (jsx("div", __assign({ onClick: function (e) {
@@ -3455,76 +3474,38 @@ var TransactionDownload = function (_a) {
3455
3474
  } }, { children: jsx(ArrowDownToLine, { className: "".concat(isMobile ? "" : "show-on-hover"), color: darkMode ? WHITE : SLATE_600 }) })));
3456
3475
  };
3457
3476
 
3477
+ var TransactionGridCell = styled.div.withConfig({
3478
+ shouldForwardProp: function (prop) {
3479
+ return !["gridColumn", "padding", "right"].includes(prop);
3480
+ },
3481
+ })(templateObject_1$3 || (templateObject_1$3 = __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) { return (props.right ? "flex-end" : "flex-start"); }, function (props) { return (props.right ? "right" : "left"); }, SLATE_600);
3482
+ var templateObject_1$3;
3483
+
3458
3484
  var Text$9 = Typography.Text;
3459
3485
  var TransactionsEmptyState = function () {
3460
3486
  var noTransactionsMessage = useContext(TransactionsListContext).noTransactionsMessage;
3461
3487
  return (jsx(Text$9, __assign({ className: "flex justify-center p-4 text-base" }, { children: noTransactionsMessage || "There are no transactions" })));
3462
3488
  };
3463
3489
 
3464
- function capitalizeFirstLetter(string) {
3465
- return string.charAt(0).toUpperCase() + string.slice(1);
3466
- }
3467
- var WARREN_STATE_LS_KEY = "warrenState";
3468
- var CURRENT_WARREN_ID_LS_KEY = "currentWarrenId";
3469
- var getIsCapacitorApp = function () {
3470
- var isAndroid = window.location.origin === "http://localhost";
3471
- var isIOS = window.location.protocol === "capacitor:";
3472
- return isAndroid || isIOS;
3473
- };
3474
- var getLocalStorageSubdomain = function () {
3475
- var warrenState = JSON.parse(window.localStorage.getItem(WARREN_STATE_LS_KEY) || "{}");
3476
- var subdomain = warrenState[CURRENT_WARREN_ID_LS_KEY];
3477
- if (!subdomain) {
3478
- console.warn("ERROR_MESSAGE_NO_SUBDOMAIN_DEFINED");
3479
- //throw new Error(ERROR_MESSAGE_NO_SUBDOMAIN_DEFINED);
3480
- }
3481
- return subdomain;
3482
- };
3483
- var getApiHost = function (subdomain) {
3484
- var isLocalHost = window.location.href.indexOf(".internal") > 0;
3485
- var sub = subdomain || getLocalStorageSubdomain();
3486
- if (getIsCapacitorApp()) {
3487
- return isLocalHost || process.env.REACT_APP_IS_INTERNAL === "true"
3488
- ? "https://".concat(sub, ".bunny.internal")
3489
- : "https://".concat(sub, ".").concat(process.env.REACT_APP_ROOT_DOMAIN);
3490
- }
3491
- return "";
3490
+ var isInvoice = function (transaction) {
3491
+ return transaction.kind === "INVOICE";
3492
3492
  };
3493
- var getGraphQLBase = function () {
3494
- if (getIsCapacitorApp()) {
3495
- return "".concat(getApiHost(), "/graphql");
3496
- }
3497
- return "/graphql";
3493
+ var isQuote = function (transaction) {
3494
+ return transaction.kind === "QUOTE";
3498
3495
  };
3499
- var createRequestHeaders = function (token) {
3500
- var bearerToken = "Bearer ".concat(token);
3501
- var headers = {
3502
- "Content-type": "application/json; charset=utf-8",
3503
- };
3504
- headers["Authorization"] = bearerToken;
3505
- return headers;
3496
+ var TransactionRowTitle = function (_a) {
3497
+ var transaction = _a.transaction;
3498
+ if (!isInvoice(transaction) && !isQuote(transaction)) {
3499
+ return jsx(Fragment, {});
3500
+ }
3501
+ return (jsx("span", __assign({ className: "text-slate-400", style: { fontSize: "11px" } }, { children: transaction.transactionable.number })));
3506
3502
  };
3507
- var useGraphQLRequest = function () { return function (query, token, variables) { return __awaiter(void 0, void 0, void 0, function () {
3508
- var error_1;
3509
- return __generator(this, function (_a) {
3510
- switch (_a.label) {
3511
- case 0:
3512
- _a.trys.push([0, 2, , 3]);
3513
- return [4 /*yield*/, request(getGraphQLBase(), query, variables, createRequestHeaders(token))];
3514
- case 1: return [2 /*return*/, _a.sent()];
3515
- case 2:
3516
- error_1 = _a.sent();
3517
- throw error_1;
3518
- case 3: return [2 /*return*/];
3519
- }
3520
- });
3521
- }); }; };
3522
3503
 
3523
3504
  var Text$8 = Typography.Text;
3524
3505
  var TransactionsListDesktop = function (_a) {
3525
3506
  var transactions = _a.transactions, onTransactionClick = _a.onTransactionClick;
3526
3507
  var columns = useContext(TransactionsListContext).columns;
3527
- var _b = useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain, darkMode = _b.darkMode;
3508
+ var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, darkMode = _b.darkMode;
3528
3509
  var showAmount = columns.includes("amount");
3529
3510
  var showDateAndTitle = columns.includes("date-and-title");
3530
3511
  var showDownload = columns.includes("download");
@@ -3540,7 +3521,7 @@ var TransactionsListDesktop = function (_a) {
3540
3521
  backgroundColor: index % 2 === 0
3541
3522
  ? "var(--row-background".concat(darkMode ? "-dark" : "", ")")
3542
3523
  : "var(--row-background-alternate".concat(darkMode ? "-dark" : "", ")"),
3543
- } }, { children: [showDateAndTitle && (jsxs(Fragment, { children: [jsx(TransactionGridCell, __assign({ right: false }, { children: jsx(TransactionDate, { date: transaction.createdAt }) })), jsxs(TransactionGridCell, __assign({ right: false, className: "flex items-center gap-2" }, { children: [jsx(Text$8, { children: capitalizeFirstLetter(transaction.kind.toLowerCase()) }), jsx(TransactionRowTitle, { transaction: transaction })] }))] })), showDownload && (jsx(TransactionGridCell, { children: jsx(TransactionDownload, { transaction: transaction, token: token, subdomain: subdomain }) })), showState && (jsx(TransactionGridCell, __assign({ right: true }, { children: jsx(StateTag, { state: transaction.state }) }))), showAmount && (jsx(TransactionGridCell, __assign({ right: true }, { children: jsx(Text$8, { children: Misc.formatCurrency(((_a = transaction === null || transaction === void 0 ? void 0 : transaction.transactionable) === null || _a === void 0 ? void 0 : _a.amount) || transaction.amount, transaction.currencyId) }) })))] }), index));
3524
+ } }, { children: [showDateAndTitle && (jsxs(Fragment, { children: [jsx(TransactionGridCell, __assign({ right: false }, { children: jsx(TransactionDate, { date: transaction.createdAt }) })), jsxs(TransactionGridCell, __assign({ right: false, className: "flex items-center gap-2" }, { children: [jsx(Text$8, { children: capitalize(transaction.kind.toLowerCase()) }), jsx(TransactionRowTitle, { transaction: transaction })] }))] })), showDownload && (jsx(TransactionGridCell, { children: jsx(TransactionDownload, { transaction: transaction, token: token, apiHost: apiHost }) })), showState && (jsx(TransactionGridCell, __assign({ right: true }, { children: jsx(StateTag, { state: transaction.state }) }))), showAmount && (jsx(TransactionGridCell, __assign({ right: true }, { children: jsx(Text$8, { children: formatCurrency(((_a = transaction === null || transaction === void 0 ? void 0 : transaction.transactionable) === null || _a === void 0 ? void 0 : _a.amount) || transaction.amount, transaction.currencyId) }) })))] }), index));
3544
3525
  });
3545
3526
  };
3546
3527
 
@@ -3548,7 +3529,7 @@ var Text$7 = Typography.Text;
3548
3529
  var TransactionsListMobile = function (_a) {
3549
3530
  var transactions = _a.transactions, onTransactionClick = _a.onTransactionClick;
3550
3531
  var columns = useContext(TransactionsListContext).columns;
3551
- var _b = useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain, darkMode = _b.darkMode;
3532
+ var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, darkMode = _b.darkMode;
3552
3533
  var showAmount = columns.includes("amount");
3553
3534
  var showDateAndTitle = columns.includes("date-and-title");
3554
3535
  var showDownload = columns.includes("download");
@@ -3563,19 +3544,17 @@ var TransactionsListMobile = function (_a) {
3563
3544
  backgroundColor: index % 2 === 0
3564
3545
  ? "var(--row-background".concat(darkMode ? "-dark" : "", ")")
3565
3546
  : "var(--row-background-alternate".concat(darkMode ? "-dark" : "", ")"),
3566
- } }, { children: [jsx(TransactionGridCell, { children: jsxs("div", __assign({ className: "flex flex-col gap-2" }, { children: [jsxs("div", __assign({ className: "flex items-center gap-2" }, { children: [showDateAndTitle && (jsxs(Fragment, { children: [jsx(Text$7, { children: capitalizeFirstLetter(transaction.kind.toLowerCase()) }), jsx(TransactionRowTitle, { transaction: transaction })] })), showState && jsx(StateTag, { state: transaction.state })] })), jsxs("div", __assign({ className: "flex items-center gap-2" }, { children: [showDateAndTitle && (jsx(TransactionDate, { date: transaction.createdAt })), showAmount && showDateAndTitle && jsx(Text$7, { children: "\u00B7" }), showAmount && (jsx(Text$7, { children: Misc.formatCurrency(transaction.transactionable.amount || transaction.amount, transaction.currencyId) }))] }))] })) }), showDownload && (jsx(TransactionGridCell, __assign({ right: true }, { children: jsx(TransactionDownload, { transaction: transaction, token: token, subdomain: subdomain }) })))] }), index));
3547
+ } }, { children: [jsx(TransactionGridCell, { children: jsxs("div", __assign({ className: "flex flex-col gap-2" }, { children: [jsxs("div", __assign({ className: "flex items-center gap-2" }, { children: [showDateAndTitle && (jsxs(Fragment, { children: [jsx(Text$7, { children: capitalize(transaction.kind.toLowerCase()) }), jsx(TransactionRowTitle, { transaction: transaction })] })), showState && jsx(StateTag, { state: transaction.state })] })), jsxs("div", __assign({ className: "flex items-center gap-2" }, { children: [showDateAndTitle && (jsx(TransactionDate, { date: transaction.createdAt })), showAmount && showDateAndTitle && jsx(Text$7, { children: "\u00B7" }), showAmount && (jsx(Text$7, { children: formatCurrency(transaction.transactionable.amount || transaction.amount, transaction.currencyId) }))] }))] })) }), showDownload && (jsx(TransactionGridCell, __assign({ right: true }, { children: jsx(TransactionDownload, { transaction: transaction, token: token, apiHost: apiHost }) })))] }), index));
3567
3548
  });
3568
3549
  };
3569
3550
 
3570
- // Create a client
3571
- var queryClient = new QueryClient();
3572
3551
  function Transactions(_a) {
3573
3552
  var transactionComponent = _a.transactionComponent, _b = _a.showSearchBar, showSearchBar = _b === void 0 ? true : _b, _c = _a.showTitle, showTitle = _c === void 0 ? true : _c, _d = _a.columns, columns = _d === void 0 ? ["date-and-title", "state", "amount"] : _d, className = _a.className, _e = _a.shadow, shadow = _e === void 0 ? "md" : _e, searchBarClassName = _a.searchBarClassName, _f = _a.useModal, useModal = _f === void 0 ? false : _f, onTransactionClick = _a.onTransactionClick, _g = _a.suppressTransactionDisplay, suppressTransactionDisplay = _g === void 0 ? false : _g, _h = _a.kindsToShow, kindsToShow = _h === void 0 ? [
3574
3553
  TransactionKind.INVOICE,
3575
3554
  TransactionKind.PAYMENT,
3576
3555
  TransactionKind.REFUND,
3577
3556
  TransactionKind.WRITE_OFF,
3578
- ] : _h, style = _a.style, filter = _a.filter, noTransactionsMessage = _a.noTransactionsMessage;
3557
+ ] : _h, style = _a.style, filter = _a.filter, noTransactionsMessage = _a.noTransactionsMessage, entityId = _a.entityId;
3579
3558
  var contextValues = {
3580
3559
  showSearchBar: showSearchBar,
3581
3560
  showTitle: showTitle,
@@ -3591,12 +3570,13 @@ function Transactions(_a) {
3591
3570
  style: style,
3592
3571
  filter: filter,
3593
3572
  noTransactionsMessage: noTransactionsMessage,
3573
+ entityId: entityId,
3594
3574
  };
3595
- return (jsx(QueryClientProvider, __assign({ client: queryClient }, { children: jsx(TransactionsListContext.Provider, __assign({ value: contextValues }, { children: jsx(TransactionsWrapper, {}) })) })));
3575
+ return (jsx(TransactionsListContext.Provider, __assign({ value: contextValues }, { children: jsx(TransactionsWrapper, {}) })));
3596
3576
  }
3597
3577
  function TransactionsWrapper() {
3598
3578
  var _a = useContext(TransactionsListContext), kindsToShow = _a.kindsToShow, filterFromContext = _a.filter;
3599
- var _b = useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain;
3579
+ var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
3600
3580
  // Local state
3601
3581
  var _c = useState(""), search = _c[0], setSearch = _c[1];
3602
3582
  var filter = filterFromContext ||
@@ -3604,21 +3584,21 @@ function TransactionsWrapper() {
3604
3584
  // Queries
3605
3585
  var data = useQuery({
3606
3586
  queryKey: ["transactions", token, filter],
3607
- queryFn: function () { return getTransactions(filter, token, subdomain, kindsToShow); },
3587
+ queryFn: function () { return getTransactions(filter, token, apiHost, kindsToShow); },
3608
3588
  placeholderData: keepPreviousData,
3609
3589
  }).data;
3610
3590
  return (jsx(TransactionsDisplay, { transactions: data, onSearchValueChanged: setSearch, search: search }));
3611
3591
  }
3612
3592
  function TransactionsDisplay(_a) {
3613
3593
  var transactions = _a.transactions, onSearchValueChanged = _a.onSearchValueChanged, search = _a.search, title = _a.title;
3614
- var _b = useContext(TransactionsListContext), showSearchBar = _b.showSearchBar, showTitle = _b.showTitle, transactionComponent = _b.transactionComponent, useModal = _b.useModal, suppressTransactionDisplay = _b.suppressTransactionDisplay, className = _b.className, shadow = _b.shadow, searchBarClassName = _b.searchBarClassName, style = _b.style, onTransactionClick = _b.onTransactionClick;
3594
+ var _b = useContext(TransactionsListContext), showSearchBar = _b.showSearchBar, showTitle = _b.showTitle, transactionComponent = _b.transactionComponent, useModal = _b.useModal, suppressTransactionDisplay = _b.suppressTransactionDisplay, className = _b.className, shadow = _b.shadow, searchBarClassName = _b.searchBarClassName, style = _b.style, onTransactionClick = _b.onTransactionClick, entityId = _b.entityId;
3615
3595
  var columns = useContext(TransactionsListContext).columns;
3616
3596
  var darkMode = useContext(BunnyContext).darkMode;
3617
3597
  // Local state
3618
3598
  var _c = useState(null), selectedTransaction = _c[0], setSelectedTransaction = _c[1];
3619
3599
  var _d = useState(false), drawerOpen = _d[0], setDrawerOpen = _d[1];
3620
3600
  // Hooks
3621
- var isMobile = useIsMobile$1();
3601
+ var isMobile = useIsMobile(window);
3622
3602
  function handleTransactionClick(transaction) {
3623
3603
  if (onTransactionClick) {
3624
3604
  onTransactionClick(transaction);
@@ -3672,7 +3652,7 @@ function TransactionsDisplay(_a) {
3672
3652
  onSearchValueChanged(e.target.value);
3673
3653
  }, prefix: jsx(SearchOutlined$1, {}), placeholder: "Search by id #", style: {
3674
3654
  minWidth: "300px",
3675
- }, value: search }) })) })), jsx(PageContent, __assign({ className: "flex w-full shadow-padding-xb ".concat(isMobile ? "overflow-hidden" : "", " ").concat(className) }, { children: jsx("div", __assign({ className: "grid w-full rounded-md overflow-auto ".concat("shadow-".concat(shadow)), style: {
3655
+ }, value: search }) })) })), jsx("div", __assign({ className: "flex w-full shadow-padding-xb ".concat(isMobile ? "overflow-hidden" : "", " ").concat(className) }, { children: jsx("div", __assign({ className: "grid w-full rounded-md overflow-auto ".concat("shadow-".concat(shadow)), style: {
3676
3656
  gridTemplateColumns: gridTemplateColumns(),
3677
3657
  backgroundColor: "var(--row-background".concat(darkMode ? "-dark" : "", ")"),
3678
3658
  } }, { children: isMobile ? (jsx(Fragment, { children: TransactionsListMobile({
@@ -3681,12 +3661,12 @@ function TransactionsDisplay(_a) {
3681
3661
  }) })) : (jsx(Fragment, { children: TransactionsListDesktop({
3682
3662
  transactions: transactions,
3683
3663
  onTransactionClick: handleTransactionClick,
3684
- }) })) })) })), useModal ? (jsx(Modal, __assign({ title: "Basic Modal", open: drawerOpen, onOk: function () { return setDrawerOpen(false); }, onCancel: function () { return setDrawerOpen(false); }, width: 900, footer: null }, { children: jsx(Invoice, { id: (selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.transactionableId) || "" }) }))) : (jsx(Drawer, __assign({ title: drawerTitle(), onClose: function () { return setDrawerOpen(false); }, open: drawerOpen, width: 900 }, { children: transactionComponent ? (transactionComponent) : (selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.kind) === "INVOICE" ? (jsx(Invoice, { id: selectedTransaction.transactionableId })) : (jsxs(Card$1, __assign({ className: "shadow-md" }, { children: [jsx(Typography.Title, __assign({ level: 2, className: "mb-4" }, { children: "Transaction Details" })), jsxs(Typography.Paragraph, { children: [jsx("strong", { children: "Amount:" }), " ", jsx(Typography.Text, { children: Misc.formatCurrency((selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.amount) || 0, (selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.currencyId) || "USD") })] }), jsxs(Typography.Paragraph, { children: [jsx("strong", { children: "Description:" }), " ", jsx(Typography.Text, { children: selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.description })] }), jsxs(Typography.Paragraph, { children: [jsx("strong", { children: "Kind:" }), " ", jsx(Typography.Text, { children: selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.kind })] }), jsxs(Typography.Paragraph, { children: [jsx("strong", { children: "State:" }), " ", jsx(Typography.Text, { children: selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.state })] })] }))) })))] })));
3664
+ }) })) })) })), useModal ? (jsx(Modal, __assign({ title: "Basic Modal", open: drawerOpen, onOk: function () { return setDrawerOpen(false); }, onCancel: function () { return setDrawerOpen(false); }, width: 900, footer: null }, { children: jsx(Invoice, { id: (selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.transactionableId) || "", entityId: entityId }) }))) : (jsx(Drawer, __assign({ title: drawerTitle(), onClose: function () { return setDrawerOpen(false); }, open: drawerOpen, width: 900 }, { children: transactionComponent ? (transactionComponent) : (selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.kind) === "INVOICE" ? (jsx(Invoice, { id: selectedTransaction.transactionableId, entityId: entityId })) : (jsxs(Card$1, __assign({ className: "shadow-md" }, { children: [jsx(Typography.Title, __assign({ level: 2, className: "mb-4" }, { children: "Transaction Details" })), jsxs(Typography.Paragraph, { children: [jsx("strong", { children: "Amount:" }), " ", jsx(Typography.Text, { children: formatCurrency((selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.amount) || 0, (selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.currencyId) || "USD") })] }), jsxs(Typography.Paragraph, { children: [jsx("strong", { children: "Description:" }), " ", jsx(Typography.Text, { children: selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.description })] }), jsxs(Typography.Paragraph, { children: [jsx("strong", { children: "Kind:" }), " ", jsx(Typography.Text, { children: selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.kind })] }), jsxs(Typography.Paragraph, { children: [jsx("strong", { children: "State:" }), " ", jsx(Typography.Text, { children: selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.state })] })] }))) })))] })));
3685
3665
  }
3686
3666
 
3687
3667
  function Quotes(_a) {
3688
- var filter = _a.filter, quoteComponent = _a.quoteComponent, _b = _a.showSearchBar, showSearchBar = _b === void 0 ? true : _b, _c = _a.showTitle, showTitle = _c === void 0 ? true : _c, _d = _a.columns, columns = _d === void 0 ? ["date-and-title", "amount", "download"] : _d, className = _a.className, _e = _a.shadow, shadow = _e === void 0 ? "md" : _e, searchBarClassName = _a.searchBarClassName, _f = _a.useModal, useModal = _f === void 0 ? false : _f; _a.onQuoteClick; var _g = _a.suppressQuoteDisplay, suppressQuoteDisplay = _g === void 0 ? false : _g, style = _a.style, _h = _a.noQuotesMessage, noQuotesMessage = _h === void 0 ? "There are no quotes" : _h;
3689
- var subdomain = useContext(BunnyContext).subdomain;
3668
+ var className = _a.className, _b = _a.columns, columns = _b === void 0 ? ["date-and-title", "amount", "download"] : _b, entityId = _a.entityId, filter = _a.filter, _c = _a.noQuotesMessage, noQuotesMessage = _c === void 0 ? "There are no quotes" : _c; _a.onQuoteClick; var quoteComponent = _a.quoteComponent, searchBarClassName = _a.searchBarClassName, _d = _a.shadow, shadow = _d === void 0 ? "md" : _d, _e = _a.showSearchBar, showSearchBar = _e === void 0 ? true : _e, _f = _a.showTitle, showTitle = _f === void 0 ? true : _f, style = _a.style, _g = _a.suppressQuoteDisplay, suppressQuoteDisplay = _g === void 0 ? false : _g, _h = _a.useModal, useModal = _h === void 0 ? false : _h;
3669
+ var apiHost = useContext(BunnyContext).apiHost;
3690
3670
  var _j = useState(null), component = _j[0], setComponent = _j[1];
3691
3671
  var contextValues = {
3692
3672
  columns: columns,
@@ -3703,20 +3683,21 @@ function Quotes(_a) {
3703
3683
  style: style,
3704
3684
  noTransactionsMessage: noQuotesMessage,
3705
3685
  filter: filter,
3706
- downloadTransactionLink: function (id) { return "".concat(subdomain, "/api/pdf/quote/").concat(id); },
3686
+ downloadTransactionLink: function (id) { return "".concat(apiHost, "/api/pdf/quote/").concat(id); },
3687
+ entityId: entityId,
3707
3688
  };
3708
3689
  function handleQuoteClick(quote) {
3709
3690
  if (quoteComponent) {
3710
3691
  setComponent(quoteComponent);
3711
3692
  }
3712
3693
  else {
3713
- setComponent(jsx(Quote, { id: quote === null || quote === void 0 ? void 0 : quote.transactionableId }));
3694
+ setComponent(jsx(Quote, { entityId: entityId, id: quote === null || quote === void 0 ? void 0 : quote.transactionableId }));
3714
3695
  }
3715
3696
  }
3716
3697
  return (jsx(TransactionsListContext.Provider, __assign({ value: contextValues }, { children: jsx(QuotesWrapper, {}) })));
3717
3698
  }
3718
3699
  function QuotesWrapper() {
3719
- var _a = useContext(BunnyContext), token = _a.token, subdomain = _a.subdomain;
3700
+ var _a = useContext(BunnyContext), token = _a.token, apiHost = _a.apiHost;
3720
3701
  var filterFromContext = useContext(TransactionsListContext).filter;
3721
3702
  // Local state
3722
3703
  var _b = useState(""), search = _b[0], setSearch = _b[1];
@@ -3724,7 +3705,7 @@ function QuotesWrapper() {
3724
3705
  // Queries
3725
3706
  var data = useQuery({
3726
3707
  queryKey: ["quotes", token, filter],
3727
- queryFn: function () { return getQuotes({ token: token, subdomain: subdomain, filter: filter }); },
3708
+ queryFn: function () { return getQuotes({ token: token, apiHost: apiHost, filter: filter }); },
3728
3709
  placeholderData: keepPreviousData,
3729
3710
  }).data;
3730
3711
  if (data === undefined)
@@ -3743,11 +3724,22 @@ function QuotesWrapper() {
3743
3724
  return (jsx(TransactionsDisplay, { transactions: quotesAsTransactions, onSearchValueChanged: setSearch, search: search, title: "Past quotes" }));
3744
3725
  }
3745
3726
 
3727
+ var css_248z = ".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-primary:disabled {\n background: #eef0f2 !important;\n color: rgba(0, 0, 0, 0.25) !important;\n border: none;\n}\n.ant-btn {\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 box-shadow: none;\n text-shadow: none;\n outline: none !important;\n line-height: 1;\n font-size: 0.875rem;\n font-weight: normal;\n}\n.ant-btn > span {\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.ant-btn-lg {\n height: 44px !important;\n}\n.ant-btn-default:disabled {\n border-color: rgba(113, 125, 148, 0.2) !important;\n}\n.ant-btn-link {\n border: none !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;\n}\n.ant-btn-link > span {\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.ant-btn-link:disabled {\n background-color: transparent !important;\n color: #717d94 !important;\n}\n.ant-btn-link:disabled:hover {\n background-color: transparent !important;\n}\n.ant-input-affix-wrapper .ant-input-prefix {\n transition: color 0.3s;\n}\n.ant-select-selector {\n box-shadow: none !important;\n background-color: transparent !important;\n border: none !important;\n}\n.ant-form-item-label {\n text-transform: none !important;\n font-size: 0.75rem;\n padding-bottom: 2px !important;\n}\n.ant-form-item-label > label {\n width: 100%;\n color: #4b5563 !important;\n}\n.ant-form-item-explain-error {\n font-size: 11px;\n min-height: 11px;\n line-height: 11px;\n padding-top: 2px;\n}\n.ant-form-item {\n margin-bottom: 0;\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-divider {\n margin: 0;\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.ant-drawer-title {\n font-weight: 400 !important;\n}\n.ant-drawer-header-title {\n flex-direction: row-reverse !important;\n align-items: start !important ;\n}\n.ant-drawer-close {\n margin-inline-end: 0 !important;\n}\n@media (min-width: 768px) {\n .ant-input,\n .ant-picker,\n .ant-select,\n .ant-input-affix-wrapper {\n font-size: 1rem !important;\n }\n .ant-drawer-header {\n padding-right: 1.5rem !important;\n padding-left: 1.5rem !important;\n }\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* {\n margin: 0;\n padding: 0;\n box-sizing: border-box !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;\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";
3728
+ styleInject(css_248z);
3729
+
3746
3730
  var DrawerHeader = function (_a) {
3747
3731
  var description = _a.description, onClose = _a.onClose, title = _a.title;
3748
3732
  return (jsxs("div", __assign({ className: "flex flex-col gap-4" }, { children: [jsxs("div", __assign({ className: "flex items-center justify-between gap-2" }, { children: [jsx("div", __assign({ className: "text-xl" }, { children: title })), jsx("button", __assign({ onClick: onClose, className: "ant-drawer-close" }, { children: jsx(CloseOutlined$1, {}) }))] })), description && jsx("div", __assign({ className: "text-xs" }, { children: description }))] })));
3749
3733
  };
3750
3734
 
3735
+ var Card = function (_a) {
3736
+ var children = _a.children, className = _a.className, style = _a.style;
3737
+ var darkMode = useContext(BunnyContext).darkMode;
3738
+ return (jsx("div", __assign({ className: "flex flex-col rounded-md shadow-md ".concat(className), style: __assign(__assign({}, style), { backgroundColor: darkMode
3739
+ ? "var(--row-background-dark)"
3740
+ : "var(--row-background)" }) }, { children: children })));
3741
+ };
3742
+
3751
3743
  var LargeCardIcon = function () {
3752
3744
  return (jsx("svg", __assign({ width: "72", height: "56", viewBox: "0 0 72 56", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: jsx("path", { d: "M8 0H64C68.375 0 72 3.625 72 8V12H0V8C0 3.625 3.5 0 8 0ZM72 24V48C72 52.5 68.375 56 64 56H8C3.5 56 0 52.5 0 48V24H72ZM14 40C12.875 40 12 41 12 42C12 43.125 12.875 44 14 44H22C23 44 24 43.125 24 42C24 41 23 40 22 40H14ZM28 42C28 43.125 28.875 44 30 44H46C47 44 48 43.125 48 42C48 41 47 40 46 40H30C28.875 40 28 41 28 42Z", fill: "#E2E8F0" }) })));
3753
3745
  };
@@ -3757,16 +3749,6 @@ var PlusIcon = function (_a) {
3757
3749
  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" })] })));
3758
3750
  };
3759
3751
 
3760
- var PaymentMethodContext = createContext({});
3761
-
3762
- var Card = function (_a) {
3763
- var children = _a.children, className = _a.className, style = _a.style;
3764
- var darkMode = useContext(BunnyContext).darkMode;
3765
- return (jsx("div", __assign({ className: "flex flex-col rounded-md shadow-md ".concat(className), style: __assign(__assign({}, style), { backgroundColor: darkMode
3766
- ? "var(--row-background-dark)"
3767
- : "var(--row-background)" }) }, { children: children })));
3768
- };
3769
-
3770
3752
  var Text$6 = Typography.Text;
3771
3753
  var CreditCard = function (_a) {
3772
3754
  var _b, _c, _d;
@@ -3776,9 +3758,9 @@ var CreditCard = function (_a) {
3776
3758
  var expDate = dayjs(paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.expirationDate);
3777
3759
  return expDate.isBefore(dayjs());
3778
3760
  };
3779
- var isMobile = useIsMobile$1();
3780
- var processPublicUrl = useContext(PaymentMethodContext).processPublicUrl;
3781
- return (jsxs(Card, __assign({ className: "shadow-md 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: [getCardImage((_b = paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.metadata) === null || _b === void 0 ? void 0 : _b.issuer) && (jsx("img", { alt: "Card", width: "24px", src: "".concat(processPublicUrl, "/").concat(getCardImage((_c = paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.metadata) === null || _c === void 0 ? void 0 : _c.issuer)) })), jsx(Text$6, { children: (_d = paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.metadata) === null || _d === void 0 ? void 0 : _d.description })] })), 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: dayjs(paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.expirationDate).format("MM/YY") }), isMobile && (jsx(CardActions, { onClickRemove: onClickRemove, onClickUpdate: onClickUpdate }))] }))] }))] })));
3761
+ var isMobile = useIsMobile(window);
3762
+ var apiHost = useContext(BunnyContext).apiHost;
3763
+ return (jsxs(Card, __assign({ className: "shadow-md 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: [getCardImage((_b = paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.metadata) === null || _b === void 0 ? void 0 : _b.issuer) && (jsx("img", { alt: "Card", width: "24px", src: "".concat(apiHost, "/portal/").concat(getCardImage((_c = paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.metadata) === null || _c === void 0 ? void 0 : _c.issuer)) })), jsx(Text$6, { children: (_d = paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.metadata) === null || _d === void 0 ? void 0 : _d.description })] })), 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: dayjs(paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.expirationDate).format("MM/YY") }), isMobile && (jsx(CardActions, { onClickRemove: onClickRemove, onClickUpdate: onClickUpdate }))] }))] }))] })));
3782
3764
  };
3783
3765
  var CardAttribute = function (_a) {
3784
3766
  var title = _a.title, value = _a.value;
@@ -3786,7 +3768,7 @@ var CardAttribute = function (_a) {
3786
3768
  };
3787
3769
  var CardActions = function (_a) {
3788
3770
  var onClickRemove = _a.onClickRemove, onClickUpdate = _a.onClickUpdate;
3789
- var isMobile = useIsMobile$1();
3771
+ var isMobile = useIsMobile(window);
3790
3772
  return (jsxs("div", __assign({ className: "flex items-center gap-6 ".concat(isMobile ? "justify-center mt-4" : "") }, { children: [jsx(Popconfirm, __assign({ title: "Remove card?", onConfirm: onClickRemove }, { children: jsx(Button, __assign({ className: "font-normal p-0", type: "link" }, { children: "Remove payment method" })) })), jsx(Divider, { style: { height: "24px" }, type: "vertical" }), jsx(Button, __assign({ onClick: onClickUpdate, type: "primary" }, { children: "Update" }))] })));
3791
3773
  };
3792
3774
  var EmptyCard = function (_a) {
@@ -3801,27 +3783,26 @@ var getCardImage = function (issuer) {
3801
3783
  return "mc_symbol_opt_73_3x.png";
3802
3784
  };
3803
3785
 
3804
- var ActualPaymentMethod = function () {
3805
- var _a = useContext(BunnyContext), token = _a.token, subdomain = _a.subdomain, graphQLClient = _a.graphQLClient;
3786
+ var PaymentMethodContext = createContext({});
3787
+
3788
+ var ActualPaymentMethod = function (_a) {
3789
+ var entityId = _a.entityId;
3790
+ var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, graphQLClient = _b.graphQLClient, onErrorNavigate = _b.onErrorNavigate;
3806
3791
  var accountId = useContext(PaymentContext).accountId;
3807
3792
  // Hooks
3808
3793
  var queryClient = useQueryClient();
3809
- var paymentPlugins = usePaymentPlugins({ subdomain: subdomain, token: token }).paymentPlugins;
3810
- var showErrorNotification = NotificationUtils.useErrorNotification();
3811
- var showSuccessNotification = NotificationUtils.useSuccessNotification();
3812
- var handleAllErrorFormats = NotificationUtils.useAllErrorFormats(function () {
3813
- console.log("Navigation in PaymentMethod.tsx useAllErrorFormats not implemented");
3814
- });
3815
- var isMobile = useIsMobile$1();
3794
+ var paymentPlugins = usePaymentPlugins({ entityId: entityId, apiHost: apiHost, token: token }).paymentPlugins;
3795
+ var showErrorNotification = useErrorNotification();
3796
+ var showSuccessNotification = useSuccessNotification();
3797
+ var handleAllErrorFormats = useAllErrorFormats(onErrorNavigate ||
3798
+ (function (url) {
3799
+ console.log("navigate to", url, " not implemented");
3800
+ }));
3801
+ var isMobile = useIsMobile(window);
3816
3802
  var data = usePaymentMethod(graphQLClient).data;
3817
3803
  // Local state
3818
- var _b = useState(false), showModal = _b[0], setShowModal = _b[1];
3819
- var _c = useState(false), isSaving = _c[0], setIsSaving = _c[1];
3820
- // Queries
3821
- useQuery({
3822
- queryKey: QueryKeyFactory.default.currentUserKey,
3823
- queryFn: function () { return getCurrentUserData({ token: token, subdomain: subdomain }); },
3824
- });
3804
+ var _c = useState(false), showModal = _c[0], setShowModal = _c[1];
3805
+ var _d = useState(false), isSaving = _d[0], setIsSaving = _d[1];
3825
3806
  var plugin = paymentPlugins === null || paymentPlugins === void 0 ? void 0 : paymentPlugins.find(function (paymentPlugin) { var _a; return String(paymentPlugin.id) === ((_a = data === null || data === void 0 ? void 0 : data.plugin) === null || _a === void 0 ? void 0 : _a.id); });
3826
3807
  var onClickRemove = function () {
3827
3808
  if (data && plugin) {
@@ -3833,7 +3814,7 @@ var ActualPaymentMethod = function () {
3833
3814
  account_id: accountId,
3834
3815
  },
3835
3816
  token: token,
3836
- subdomain: subdomain,
3817
+ apiHost: apiHost,
3837
3818
  })
3838
3819
  .then(function () {
3839
3820
  showSuccessNotification("Payment method was removed", "Success");
@@ -3860,7 +3841,7 @@ var ActualPaymentMethod = function () {
3860
3841
  }
3861
3842
  : {},
3862
3843
  wrapper: isMobile ? { width: "100vw" } : { width: "min-content" },
3863
- }, title: jsx(DrawerHeader, { onClose: function () { return setShowModal(false); }, title: "New payment method" }) }, { children: jsx(PaymentForm, { isSaving: isSaving, onFail: function (error) {
3844
+ }, title: jsx(DrawerHeader, { onClose: function () { return setShowModal(false); }, title: "New payment method" }) }, { children: jsx(PaymentForm, { entityId: entityId, isSaving: isSaving, onFail: function (error) {
3864
3845
  handleAllErrorFormats(error);
3865
3846
  setIsSaving(false);
3866
3847
  }, onPaymentSuccess: function () {
@@ -3869,13 +3850,56 @@ var ActualPaymentMethod = function () {
3869
3850
  }, setIsSaving: setIsSaving }) }))] }));
3870
3851
  };
3871
3852
  function PaymentMethod(_a) {
3872
- var footer = _a.footer, processPublicUrl = _a.processPublicUrl;
3873
- return (jsx(PaymentMethodContext.Provider, __assign({ value: { footer: footer, processPublicUrl: processPublicUrl } }, { children: jsx(ActualPaymentMethod, {}) })));
3853
+ var entityId = _a.entityId, footer = _a.footer;
3854
+ return (jsx(PaymentMethodContext.Provider, __assign({ value: { footer: footer } }, { children: jsx(ActualPaymentMethod, { entityId: entityId }) })));
3874
3855
  }
3875
3856
 
3876
- var MUTATION$5 = "\nmutation accountUpdate(\n $id: ID!,\n $attributes: AccountAttributes!) {\n accountUpdate(\n id: $id,\n attributes: $attributes\n ) {\n account { id }\n errors\n }\n }\n";
3857
+ var pageWrapperClassName = function (isMobile) {
3858
+ return "flex flex-col grow pt-4 ".concat(isMobile ? "pb-4 overflow-hidden" : "pb-8", " ").concat("content-container");
3859
+ };
3860
+
3861
+ 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}";
3862
+
3863
+ var QUOTE_RECALCULATE_TAXES = "\n mutation QuoteRecalculateTaxes($id: ID!) {\n quoteRecalculateTaxes(id: $id) {\n ".concat(QUOTE_FIELDS, "\n errors\n }\n }\n");
3864
+ var quoteRecalculateTaxes = function (_a) {
3865
+ var quoteId = _a.quoteId, token = _a.token, apiHost = _a.apiHost;
3866
+ return __awaiter(void 0, void 0, void 0, function () {
3867
+ var vars, response, errors;
3868
+ var _b, _c;
3869
+ return __generator(this, function (_d) {
3870
+ switch (_d.label) {
3871
+ case 0:
3872
+ vars = { id: quoteId };
3873
+ return [4 /*yield*/, gqlRequest({
3874
+ query: QUOTE_RECALCULATE_TAXES,
3875
+ token: token,
3876
+ vars: vars,
3877
+ apiHost: apiHost,
3878
+ })];
3879
+ case 1:
3880
+ response = _d.sent();
3881
+ errors = (_b = response === null || response === void 0 ? void 0 : response.quoteRecalculateTaxes) === null || _b === void 0 ? void 0 : _b.errors;
3882
+ if (errors)
3883
+ throw errors;
3884
+ return [2 /*return*/, (_c = response.quoteRecalculateTaxes) === null || _c === void 0 ? void 0 : _c.quote];
3885
+ }
3886
+ });
3887
+ });
3888
+ };
3889
+
3890
+ var useHasTaxPlugin = function (_a) {
3891
+ var entityId = _a.entityId, apiHost = _a.apiHost, token = _a.token;
3892
+ var plugins = usePlugins({
3893
+ entityId: entityId,
3894
+ apiHost: apiHost,
3895
+ token: token,
3896
+ }).data;
3897
+ return Boolean(plugins === null || plugins === void 0 ? void 0 : plugins.some(function (plugin) { return plugin.type === "taxation"; }));
3898
+ };
3899
+
3900
+ var MUTATION$6 = "\nmutation accountUpdate(\n $id: ID!,\n $attributes: AccountAttributes!) {\n accountUpdate(\n id: $id,\n attributes: $attributes\n ) {\n account { id }\n errors\n }\n }\n";
3877
3901
  var accountUpdate = function (_a) {
3878
- var accountId = _a.accountId, attributes = _a.attributes, token = _a.token;
3902
+ var accountId = _a.accountId, attributes = _a.attributes, token = _a.token, apiHost = _a.apiHost;
3879
3903
  return __awaiter(void 0, void 0, void 0, function () {
3880
3904
  var vars, response, errors;
3881
3905
  var _b;
@@ -3883,7 +3907,12 @@ var accountUpdate = function (_a) {
3883
3907
  switch (_c.label) {
3884
3908
  case 0:
3885
3909
  vars = { id: accountId, attributes: attributes };
3886
- return [4 /*yield*/, gqlRequest({ query: MUTATION$5, token: token, vars: vars })];
3910
+ return [4 /*yield*/, gqlRequest({
3911
+ query: MUTATION$6,
3912
+ token: token,
3913
+ vars: vars,
3914
+ apiHost: apiHost,
3915
+ })];
3887
3916
  case 1:
3888
3917
  response = _c.sent();
3889
3918
  errors = (_b = response === null || response === void 0 ? void 0 : response.accountUpdate) === null || _b === void 0 ? void 0 : _b.errors;
@@ -3900,10 +3929,10 @@ var TaxationForm = function (_a) {
3900
3929
  var account = _a.account, quote = _a.quote;
3901
3930
  // Hooks
3902
3931
  var queryClient = useQueryClient();
3903
- var token = useContext(BunnyContext).token;
3932
+ var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
3904
3933
  var form = Form.useForm()[0];
3905
3934
  // Mutations
3906
- var _b = useMutation({
3935
+ var _c = useMutation({
3907
3936
  mutationFn: function (changedFormData) { return __awaiter(void 0, void 0, void 0, function () {
3908
3937
  var account;
3909
3938
  return __generator(this, function (_a) {
@@ -3912,6 +3941,7 @@ var TaxationForm = function (_a) {
3912
3941
  accountId: quote.accountId,
3913
3942
  attributes: changedFormData,
3914
3943
  token: token,
3944
+ apiHost: apiHost,
3915
3945
  })];
3916
3946
  case 1:
3917
3947
  account = _a.sent();
@@ -3924,7 +3954,7 @@ var TaxationForm = function (_a) {
3924
3954
  queryKey: ["getTaxationRequiredAccountFields", token],
3925
3955
  });
3926
3956
  },
3927
- }), updateAccount = _b.mutate, isUpdatingAccount = _b.isPending;
3957
+ }), updateAccount = _c.mutate, isUpdatingAccount = _c.isPending;
3928
3958
  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) {
3929
3959
  var _a, _b;
3930
3960
  return ((_a = option === null || option === void 0 ? void 0 : option.label) !== null && _a !== void 0 ? _a : "").toLowerCase().includes(input.toLowerCase()) ||
@@ -3939,10 +3969,10 @@ var FormBillingState = function (_a) {
3939
3969
  };
3940
3970
 
3941
3971
  var QuoteCheckout = function (_a) {
3942
- var account = _a.account, isSaving = _a.isSaving, onSuccess = _a.onSuccess, onFail = _a.onFail, quote = _a.quote, setIsSaving = _a.setIsSaving, taxationRequiredAccountFields = _a.taxationRequiredAccountFields; _a.storedPaymentMethod;
3972
+ var account = _a.account, isSaving = _a.isSaving, onSuccess = _a.onSuccess, onFail = _a.onFail, quote = _a.quote, setIsSaving = _a.setIsSaving, taxationRequiredAccountFields = _a.taxationRequiredAccountFields, entityId = _a.entityId;
3943
3973
  // Context
3944
- var isMobile = useIsMobile$1();
3945
- var _b = useContext(BunnyContext), subdomain = _b.subdomain, token = _b.token;
3974
+ var isMobile = useIsMobile(window);
3975
+ var _b = useContext(BunnyContext), apiHost = _b.apiHost, token = _b.token;
3946
3976
  var paymentRequired = getQuoteAmountDue(quote) > 0;
3947
3977
  var checkoutMutation = useMutation({
3948
3978
  mutationFn: function (_a) {
@@ -3950,14 +3980,14 @@ var QuoteCheckout = function (_a) {
3950
3980
  if (!quote)
3951
3981
  throw new Error("Quote is required");
3952
3982
  if (!paymentRequired)
3953
- return checkout({ quoteId: quote.id, token: token, subdomain: subdomain });
3983
+ return checkout({ quoteId: quote.id, token: token, apiHost: apiHost });
3954
3984
  if (savedPaymentMethod) {
3955
3985
  var paymentMethodId = savedPaymentMethod.paymentMethodId;
3956
3986
  return checkout({
3957
3987
  quoteId: quote.id,
3958
3988
  paymentMethodId: paymentMethodId,
3959
3989
  token: token,
3960
- subdomain: subdomain,
3990
+ apiHost: apiHost,
3961
3991
  });
3962
3992
  }
3963
3993
  if (pluginPaymentMethod) {
@@ -3972,7 +4002,7 @@ var QuoteCheckout = function (_a) {
3972
4002
  token: paymentToken,
3973
4003
  },
3974
4004
  token: token,
3975
- subdomain: subdomain,
4005
+ apiHost: apiHost,
3976
4006
  });
3977
4007
  }
3978
4008
  throw new Error("Pay payment method provided");
@@ -4014,82 +4044,64 @@ var QuoteCheckout = function (_a) {
4014
4044
  };
4015
4045
  if (taxationRequiredAccountFields)
4016
4046
  return (jsx(PaymentFormWrapper, __assign({ setMaxHeight: false }, { children: jsx(TaxationForm, { account: account, quote: quote }) })));
4017
- return (jsx(Fragment, { children: paymentRequired ? (jsx(PaymentForm, { isSaving: isSaving, onFail: onFail, onPaymentSuccess: handleCheckout, quote: quote, setIsSaving: setIsSaving })) : (jsx(PaymentFormWrapper, __assign({ setMaxHeight: false }, { children: jsxs("div", __assign({ className: "flex flex-col gap-2 ".concat(isMobile ? "shadow-padding-x" : "") }, { children: [jsx(Button, __assign({ disabled: isSaving, onClick: function () {
4047
+ return (jsx(Fragment, { children: paymentRequired ? (jsx(PaymentForm, { entityId: entityId, isSaving: isSaving, onFail: onFail, onPaymentSuccess: handleCheckout, quote: quote, setIsSaving: setIsSaving })) : (jsx(PaymentFormWrapper, __assign({ setMaxHeight: false }, { children: jsxs("div", __assign({ className: "flex flex-col gap-2 ".concat(isMobile ? "shadow-padding-x" : "") }, { children: [jsx(Button, __assign({ disabled: isSaving, onClick: function () {
4018
4048
  setIsSaving(true);
4019
4049
  handleCheckout({});
4020
4050
  }, type: "primary" }, { children: isSaving ? "Processing..." : "Complete order" })), jsx("div", __assign({ className: "text-xs text-slate-500" }, { children: "No payment is required" }))] })) }))) }));
4021
4051
  };
4022
4052
 
4023
- var useHasTaxPlugin = function (_a) {
4024
- var subdomain = _a.subdomain, token = _a.token;
4025
- var plugins = usePlugins({
4026
- subdomain: subdomain,
4027
- token: token,
4028
- }).data;
4029
- return Boolean(plugins === null || plugins === void 0 ? void 0 : plugins.some(function (plugin) { return plugin.type === "taxation"; }));
4030
- };
4031
-
4032
- 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}";
4033
-
4034
- var QUOTE_RECALCULATE_TAXES = "\n mutation QuoteRecalculateTaxes($id: ID!) {\n quoteRecalculateTaxes(id: $id) {\n ".concat(QUOTE_FIELDS, "\n errors\n }\n }\n");
4035
- var quoteRecalculateTaxes = function (_a) {
4036
- var quoteId = _a.quoteId, token = _a.token;
4053
+ var MUTATION$5 = "{\n currentUser {\n taxationRequiredAccountFields\n }\n}";
4054
+ var getTaxationRequiredAccountFields = function (_a) {
4055
+ var token = _a.token, apiHost = _a.apiHost;
4037
4056
  return __awaiter(void 0, void 0, void 0, function () {
4038
- var vars, response, errors;
4057
+ var response;
4039
4058
  var _b, _c;
4040
4059
  return __generator(this, function (_d) {
4041
4060
  switch (_d.label) {
4042
- case 0:
4043
- vars = { id: quoteId };
4044
- return [4 /*yield*/, gqlRequest({
4045
- query: QUOTE_RECALCULATE_TAXES,
4046
- token: token,
4047
- vars: vars,
4048
- })];
4061
+ case 0: return [4 /*yield*/, gqlRequest({
4062
+ query: MUTATION$5,
4063
+ token: token,
4064
+ apiHost: apiHost,
4065
+ })];
4049
4066
  case 1:
4050
4067
  response = _d.sent();
4051
- errors = (_b = response === null || response === void 0 ? void 0 : response.quoteRecalculateTaxes) === null || _b === void 0 ? void 0 : _b.errors;
4052
- if (errors)
4053
- throw errors;
4054
- return [2 /*return*/, (_c = response.quoteRecalculateTaxes) === null || _c === void 0 ? void 0 : _c.quote];
4068
+ 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
4069
+ ? response.currentUser
4070
+ .taxationRequiredAccountFields
4071
+ : null];
4055
4072
  }
4056
4073
  });
4057
4074
  });
4058
4075
  };
4059
4076
 
4060
- var planPickerQuoteDataState = atom({
4061
- key: "planPickerQuoteDataState",
4062
- default: undefined,
4063
- });
4064
-
4065
- var pageWrapperClassName = function (isMobile) {
4066
- return "flex flex-col grow pt-4 ".concat(isMobile ? "pb-4 overflow-hidden" : "pb-8", " ").concat("content-container");
4067
- };
4068
-
4069
4077
  var queryKeyFactory = QueryKeyFactory.default;
4070
4078
  var Checkout = function (_a) {
4071
4079
  var _b, _c;
4072
- var onCancel = _a.onCancel, onSuccess = _a.onSuccess, onFail = _a.onFail, invoice = _a.invoice, open = _a.open, quote = _a.quote, selectedPriceList = _a.selectedPriceList, isMobile = _a.isMobile, token = _a.token, storedPaymentMethod = _a.storedPaymentMethod;
4073
- var subdomain = useContext(BunnyContext).subdomain;
4074
- var _d = useState(false), isSaving = _d[0], setIsSaving = _d[1];
4075
- var hasTaxPlugin = useHasTaxPlugin({ subdomain: subdomain || "", token: token });
4080
+ 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;
4081
+ var _e = useContext(BunnyContext), apiHost = _e.apiHost, window = _e.window;
4082
+ var _f = useState(false), isSaving = _f[0], setIsSaving = _f[1];
4083
+ var isMobile = useIsMobile(window);
4084
+ var hasTaxPlugin = useHasTaxPlugin({
4085
+ entityId: entityId,
4086
+ apiHost: apiHost,
4087
+ token: token,
4088
+ });
4076
4089
  var queryClient = useQueryClient();
4077
- var quotePreviewData = useRecoilValue(planPickerQuoteDataState);
4078
4090
  // Queries
4079
- var _e = useQuery({
4091
+ var _g = useQuery({
4080
4092
  queryKey: ["getTaxationRequiredAccountFields", token],
4081
- queryFn: function () { return getTaxationRequiredAccountFields({ token: token }); },
4093
+ queryFn: function () { return getTaxationRequiredAccountFields({ token: token, apiHost: apiHost }); },
4082
4094
  enabled: Boolean(quote),
4083
4095
  staleTime: 0,
4084
- }), taxationRequiredAccountFields = _e.data, isLoadingTaxationRequiredAccountFields = _e.isLoading;
4085
- var _f = useQuery({
4096
+ }), taxationRequiredAccountFields = _g.data, isLoadingTaxationRequiredAccountFields = _g.isLoading;
4097
+ var _h = useQuery({
4086
4098
  queryKey: ["account", quote === null || quote === void 0 ? void 0 : quote.accountId],
4087
4099
  queryFn: function () {
4088
- return (quote === null || quote === void 0 ? void 0 : quote.accountId) && getAccount({ id: quote.accountId, token: token });
4100
+ return (quote === null || quote === void 0 ? void 0 : quote.accountId) && getAccount({ id: quote.accountId, token: token, apiHost: apiHost });
4089
4101
  },
4090
4102
  enabled: Boolean(quote === null || quote === void 0 ? void 0 : quote.accountId) &&
4091
4103
  ((taxationRequiredAccountFields === null || taxationRequiredAccountFields === void 0 ? void 0 : taxationRequiredAccountFields.length) || 0) > 0,
4092
- }), account = _f.data, isLoadingAccount = _f.isLoading;
4104
+ }), account = _h.data, isLoadingAccount = _h.isLoading;
4093
4105
  useQuery({
4094
4106
  queryKey: queryKeyFactory.createQuoteTaxCalculateKey(quote === null || quote === void 0 ? void 0 : quote.id),
4095
4107
  queryFn: function () { return __awaiter(void 0, void 0, void 0, function () {
@@ -4101,12 +4113,13 @@ var Checkout = function (_a) {
4101
4113
  return [4 /*yield*/, quoteRecalculateTaxes({
4102
4114
  quoteId: quote.id,
4103
4115
  token: token,
4116
+ apiHost: apiHost,
4104
4117
  })];
4105
4118
  case 1:
4106
4119
  updatedQuote = _a.sent();
4107
4120
  if (updatedQuote) {
4108
4121
  queryClient.setQueryData(queryKeyFactory.createObjectKey("editingQuote", updatedQuote.id), updatedQuote);
4109
- queryClient.setQueryData(queryKeyFactory.calculatedPricesKey((quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.quantity) || 0, selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id), updatedQuote);
4122
+ queryClient.setQueryData(queryKeyFactory.calculatedPricesKey(quantity, selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id), updatedQuote);
4110
4123
  }
4111
4124
  _a.label = 2;
4112
4125
  case 2: return [2 /*return*/, {}];
@@ -4125,21 +4138,21 @@ var Checkout = function (_a) {
4125
4138
  return null;
4126
4139
  return (jsx("div", __assign({ className: "flex flex-col fixed top-0 left-0 right-0 bottom-0 bg-slate-50 overflow-auto", style: {
4127
4140
  zIndex: 1001,
4128
- } }, { children: jsxs("div", __assign({ className: pageWrapperClassName(isMobile) }, { children: [jsx("div", __assign({ className: "flex justify-end w-full" }, { children: jsx(CloseOutlined$1, { 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: isMobile })), !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(InvoiceCheckout, { invoice: invoice, isSaving: isSaving, onFail: function (error) {
4141
+ } }, { children: jsxs("div", __assign({ className: pageWrapperClassName(isMobile) }, { children: [jsx("div", __assign({ className: "flex justify-end w-full" }, { children: jsx(CloseOutlined$1, { 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(InvoiceCheckout, { invoice: invoice, isSaving: isSaving, onFail: function (error) {
4129
4142
  onFail(error);
4130
4143
  setIsSaving(false);
4131
4144
  }, onSuccess: function (_a) {
4132
4145
  var savePaymentMethod = _a.savePaymentMethod;
4133
4146
  onSuccess({ savePaymentMethod: savePaymentMethod });
4134
4147
  setIsSaving(false);
4135
- }, setIsSaving: setIsSaving })) : quote ? (jsx(QuoteCheckout, { account: account, isSaving: isSaving, onFail: function (error) {
4148
+ }, setIsSaving: setIsSaving, entityId: entityId })) : quote ? (jsx(QuoteCheckout, { account: account, entityId: entityId, isSaving: isSaving, onFail: function (error) {
4136
4149
  onFail(error);
4137
4150
  setIsSaving(false);
4138
4151
  }, onSuccess: function (_a) {
4139
4152
  var savePaymentMethod = _a.savePaymentMethod;
4140
4153
  onSuccess({ savePaymentMethod: savePaymentMethod });
4141
4154
  setIsSaving(false);
4142
- }, quote: quote, setIsSaving: setIsSaving, taxationRequiredAccountFields: taxationRequiredAccountFields, token: token, storedPaymentMethod: storedPaymentMethod })) : (jsx(PaymentForm, { isSaving: isSaving, onFail: function (error) {
4155
+ }, quote: quote, setIsSaving: setIsSaving, taxationRequiredAccountFields: taxationRequiredAccountFields, token: token })) : (jsx(PaymentForm, { entityId: entityId, isSaving: isSaving, onFail: function (error) {
4143
4156
  onFail(error);
4144
4157
  setIsSaving(false);
4145
4158
  }, onPaymentSuccess: function (_a) {
@@ -4153,7 +4166,7 @@ var Checkout = function (_a) {
4153
4166
 
4154
4167
  var MUTATION$4 = 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}"; };
4155
4168
  var accountSignup = function (_a) {
4156
- var token = _a.token, subdomain = _a.subdomain, entityId = _a.entityId, accountId = _a.accountId, quoteId = _a.quoteId, paymentToken = _a.paymentToken, paymentMethodId = _a.paymentMethodId, pluginId = _a.pluginId, priceListCode = _a.priceListCode;
4169
+ 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;
4157
4170
  return __awaiter(void 0, void 0, void 0, function () {
4158
4171
  var vars, response, errors;
4159
4172
  var _b;
@@ -4173,7 +4186,7 @@ var accountSignup = function (_a) {
4173
4186
  query: MUTATION$4(),
4174
4187
  token: token,
4175
4188
  vars: vars,
4176
- subdomain: subdomain,
4189
+ apiHost: apiHost,
4177
4190
  })];
4178
4191
  case 1:
4179
4192
  response = _c.sent();
@@ -4188,7 +4201,7 @@ var accountSignup = function (_a) {
4188
4201
 
4189
4202
  var MUTATION$3 = 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 amount\n currencyId\n quote {\n id\n }\n tenant {\n code\n }\n errors\n }\n}"; };
4190
4203
  var quoteAccountSignup = function (_a) {
4191
- var token = _a.token, subdomain = _a.subdomain, entityId = _a.entityId, priceListCode = _a.priceListCode, accountName = _a.accountName, billingContact = _a.billingContact;
4204
+ var token = _a.token, apiHost = _a.apiHost, entityId = _a.entityId, priceListCode = _a.priceListCode, accountName = _a.accountName, billingContact = _a.billingContact;
4192
4205
  return __awaiter(void 0, void 0, void 0, function () {
4193
4206
  var vars, response, errors;
4194
4207
  var _b;
@@ -4205,7 +4218,7 @@ var quoteAccountSignup = function (_a) {
4205
4218
  query: MUTATION$3(),
4206
4219
  token: token,
4207
4220
  vars: vars,
4208
- subdomain: subdomain,
4221
+ apiHost: apiHost,
4209
4222
  })];
4210
4223
  case 1:
4211
4224
  response = _c.sent();
@@ -4220,7 +4233,7 @@ var quoteAccountSignup = function (_a) {
4220
4233
 
4221
4234
  var MUTATION$2 = 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}"; };
4222
4235
  var getPriceList = function (_a) {
4223
- var token = _a.token, code = _a.code, subdomain = _a.subdomain;
4236
+ var token = _a.token, code = _a.code, apiHost = _a.apiHost;
4224
4237
  return __awaiter(void 0, void 0, void 0, function () {
4225
4238
  var response;
4226
4239
  return __generator(this, function (_b) {
@@ -4229,7 +4242,7 @@ var getPriceList = function (_a) {
4229
4242
  query: MUTATION$2(),
4230
4243
  token: token,
4231
4244
  vars: { code: code },
4232
- subdomain: subdomain,
4245
+ apiHost: apiHost,
4233
4246
  })];
4234
4247
  case 1:
4235
4248
  response = _b.sent();
@@ -4240,8 +4253,8 @@ var getPriceList = function (_a) {
4240
4253
  };
4241
4254
 
4242
4255
  function PaymentForms(_a) {
4243
- var quote = _a.quote, paying = _a.paying, setIsPaying = _a.setIsPaying, handlePaymentSaveSuccess = _a.handlePaymentSaveSuccess, handlePaymentFail = _a.handlePaymentFail, handleSubmit = _a.handleSubmit, proceedingToPayment = _a.proceedingToPayment, accountId = _a.accountId;
4244
- return (jsx(Fragment, { children: quote ? (jsx(Fragment, { children: accountId && (jsx(PaymentContext.Provider, __assign({ value: { accountId: accountId, displayPayButtonNameAnyways: true } }, { children: jsx(PaymentForm, { isSaving: paying, setIsSaving: setIsPaying, onFail: handlePaymentFail, onPaymentSuccess: handlePaymentSaveSuccess }) }))) })) : (jsx(InitialSignupForm, { onSubmit: handleSubmit, submitting: proceedingToPayment })) }));
4256
+ var quote = _a.quote, paying = _a.paying, setIsPaying = _a.setIsPaying, handlePaymentSaveSuccess = _a.handlePaymentSaveSuccess, handlePaymentFail = _a.handlePaymentFail, handleSubmit = _a.handleSubmit, proceedingToPayment = _a.proceedingToPayment, accountId = _a.accountId, entityId = _a.entityId;
4257
+ return (jsx(Fragment, { children: quote ? (jsx(Fragment, { children: accountId && (jsx(PaymentContext.Provider, __assign({ value: { accountId: accountId, displayPayButtonNameAnyways: true } }, { children: jsx(PaymentForm, { entityId: entityId, isSaving: paying, setIsSaving: setIsPaying, onFail: handlePaymentFail, onPaymentSuccess: handlePaymentSaveSuccess }) }))) })) : (jsx(InitialSignupForm, { onSubmit: handleSubmit, submitting: proceedingToPayment })) }));
4245
4258
  }
4246
4259
  function InitialSignupForm(_a) {
4247
4260
  var onSubmit = _a.onSubmit, submitting = _a.submitting;
@@ -4278,10 +4291,9 @@ function InitialSignupForm(_a) {
4278
4291
 
4279
4292
  var Title = Typography.Title, Text$5 = Typography.Text;
4280
4293
  function PaymentSuccessDisplay(_a) {
4281
- var className = _a.className, amountPaid = _a.amountPaid, style = _a.style, returnUrl = _a.returnUrl;
4294
+ var amountPaid = _a.amountPaid, className = _a.className, companyName = _a.companyName, returnUrl = _a.returnUrl, style = _a.style;
4282
4295
  var window = useContext(BunnyContext).window;
4283
- var companyName = useCurrentUserData().companyName;
4284
- return (jsxs("div", __assign({ className: "flex flex-col items-center justify-center h-full ".concat(className), style: style }, { children: [jsx(CheckCircleFilled$1, { style: { fontSize: "48px", color: "rgb(52 211 153)" } }), jsxs(Title, __assign({ level: 3, className: "mt-2 m-0" }, { children: ["Payment of ", Misc.formatCurrency(amountPaid, "USD"), " successful"] })), returnUrl && (jsxs(Text$5, __assign({ className: "text-slate-500 cursor-pointer underline", onClick: function () { return (window.location.href = returnUrl); } }, { children: ["Back to ", companyName] })))] })));
4296
+ return (jsxs("div", __assign({ className: "flex flex-col items-center justify-center h-full ".concat(className), style: style }, { children: [jsx(CheckCircleFilled$1, { style: { fontSize: "48px", color: "rgb(52 211 153)" } }), jsxs(Title, __assign({ level: 3, className: "mt-2 m-0" }, { children: ["Payment of ", formatCurrency(amountPaid, "USD"), " successful"] })), returnUrl && (jsxs(Text$5, __assign({ className: "text-slate-500 cursor-pointer underline", onClick: function () { return (window.location.href = returnUrl); } }, { children: ["Back to ", companyName] })))] })));
4285
4297
  }
4286
4298
 
4287
4299
  var Text$4 = Typography.Text;
@@ -4289,38 +4301,12 @@ function PriceListDisplay(_a) {
4289
4301
  var priceListData = _a.priceListData, topNavImageUrl = _a.topNavImageUrl;
4290
4302
  if (!priceListData)
4291
4303
  return null;
4292
- 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$4, __assign({ className: "text-slate-500 font-bold text-lg" }, { children: priceListData.name })), jsxs(Text$4, __assign({ className: "font-bold text-xl" }, { children: [Misc.formatCurrency(priceListData.basePrice, priceListData.currencyId), " ", "/ month"] }))] })), jsxs("div", __assign({ className: "flex flex-col" }, { children: [jsxs(Text$4, __assign({ style: { fontSize: "16px" }, className: "text-slate-500" }, { children: [priceListData.trialLengthDays, " day trial"] })), jsx(Text$4, __assign({ className: "text-slate-500", style: { fontSize: "12px" } }, { children: "You will not be charged until the last day of the trial." }))] }))] })) })) }));
4304
+ 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$4, __assign({ className: "text-slate-500 font-bold text-lg" }, { children: priceListData.name })), jsxs(Text$4, __assign({ className: "font-bold text-xl" }, { children: [formatCurrency(priceListData.basePrice, priceListData.currencyId), " ", "/ month"] }))] })), jsxs("div", __assign({ className: "flex flex-col" }, { children: [jsxs(Text$4, __assign({ style: { fontSize: "16px" }, className: "text-slate-500" }, { children: [priceListData.trialLengthDays, " day trial"] })), jsx(Text$4, __assign({ className: "text-slate-500", style: { fontSize: "12px" } }, { children: "You will not be charged until the last day of the trial." }))] }))] })) })) }));
4293
4305
  }
4294
4306
 
4295
- var BunnyFooterIcon = function (_a) {
4296
- var color = _a.color;
4297
- 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" }) })) })] })));
4298
- };
4299
-
4300
- var Footer = function (_a) {
4301
- var className = _a.className;
4302
- var _b = useCurrentUserData(), privacyUrl = _b.privacyUrl, termsUrl = _b.termsUrl;
4303
- var window = useContext(BunnyContext).window;
4304
- var isMobile = useIsMobile(window);
4305
- var quotePreviewData = useRecoilValue(planPickerQuoteDataState);
4306
- var selectedPriceList = quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.priceList;
4307
- if (selectedPriceList && isMobile)
4308
- return null;
4309
- return (jsxs("div", __assign({ className: "flex items-center justify-between shrink-0 ".concat(className, " ").concat(isMobile ? "flex-col gap-2 grow" : "") }, { 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, {})] })));
4310
- };
4311
- var BunnyMarketingLink = function () {
4312
- var _a = useState(false), isHovered = _a[0], setIsHovered = _a[1];
4313
- var window = useContext(BunnyContext).window;
4314
- var isMobile = useIsMobile(window);
4315
- 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", type: "text" }, { 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 }) }))] })) })) })));
4316
- };
4317
- var StyedLink = styled.a(templateObject_1$3 || (templateObject_1$3 = __makeTemplateObject(["\n color: ", ";\n transition: color 0.3s;\n &:hover {\n color: ", ";\n }\n"], ["\n color: ", ";\n transition: color 0.3s;\n &:hover {\n color: ", ";\n }\n"])), SLATE_400, SLATE_500);
4318
- var StyledBunnyLink = styled(StyedLink)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n &:hover {\n color: ", " !important;\n }\n"], ["\n &:hover {\n color: ", " !important;\n }\n"])), PRIMARY_COLOR);
4319
- var templateObject_1$3, templateObject_2;
4320
-
4321
4307
  var MUTATION$1 = "\n mutation portalSessionCreate ($tenantCode: String!, $expiry: Int!, $returnUrl: String!) {\n portalSessionCreate (tenantCode: $tenantCode, expiry: $expiry, returnUrl: $returnUrl) {\n errors\n token\n }\n }\n";
4322
4308
  var portalSessionCreate = function (_a) {
4323
- var tenantCode = _a.tenantCode, expiry = _a.expiry, returnUrl = _a.returnUrl, token = _a.token, subdomain = _a.subdomain;
4309
+ var tenantCode = _a.tenantCode, expiry = _a.expiry, returnUrl = _a.returnUrl, token = _a.token, apiHost = _a.apiHost;
4324
4310
  return __awaiter(void 0, void 0, void 0, function () {
4325
4311
  var response, errors;
4326
4312
  var _b;
@@ -4330,7 +4316,7 @@ var portalSessionCreate = function (_a) {
4330
4316
  query: MUTATION$1,
4331
4317
  token: token,
4332
4318
  vars: { tenantCode: tenantCode, expiry: expiry, returnUrl: returnUrl },
4333
- subdomain: subdomain,
4319
+ apiHost: apiHost,
4334
4320
  })];
4335
4321
  case 1:
4336
4322
  response = _c.sent();
@@ -4343,18 +4329,13 @@ var portalSessionCreate = function (_a) {
4343
4329
  });
4344
4330
  };
4345
4331
 
4346
- var showErrorNotification = NotificationUtils.useErrorNotification();
4332
+ var showErrorNotification = useErrorNotification();
4347
4333
  function Signup(_a) {
4348
- var priceListCode = _a.priceListCode, returnUrl = _a.returnUrl;
4334
+ var companyName = _a.companyName, entityId = _a.entityId, priceListCode = _a.priceListCode, returnUrl = _a.returnUrl;
4349
4335
  // Hooks
4350
- var _b = useContext(BunnyContext), subdomain = _b.subdomain, token = _b.token, window = _b.window;
4351
- useQuery({
4352
- queryKey: QueryKeyFactory.default.currentUserKey,
4353
- queryFn: function () { return getCurrentUserData({ token: token, subdomain: subdomain }); },
4354
- });
4336
+ var _b = useContext(BunnyContext), apiHost = _b.apiHost, token = _b.token, window = _b.window;
4355
4337
  var isMobile = useIsMobile(window);
4356
4338
  var topNavImageUrl = useContext(BrandContext).topNavImageUrl;
4357
- var entityId = useCurrentUserData().entityId;
4358
4339
  var _c = useState(undefined), quote = _c[0], setQuote = _c[1];
4359
4340
  var _d = useState(undefined), accountId = _d[0], setAccountId = _d[1];
4360
4341
  var _e = useState(undefined), quoteId = _e[0], setQuoteId = _e[1];
@@ -4366,7 +4347,7 @@ function Signup(_a) {
4366
4347
  // Queries
4367
4348
  var priceListData = useQuery({
4368
4349
  queryKey: ["priceList", priceListCode],
4369
- queryFn: function () { return getPriceList({ token: token, subdomain: subdomain, code: priceListCode }); },
4350
+ queryFn: function () { return getPriceList({ token: token, apiHost: apiHost, code: priceListCode }); },
4370
4351
  }).data;
4371
4352
  function handleSubmit(formData) {
4372
4353
  return __awaiter(this, void 0, void 0, function () {
@@ -4378,7 +4359,7 @@ function Signup(_a) {
4378
4359
  setFormData(formData);
4379
4360
  return [4 /*yield*/, quoteAccountSignup({
4380
4361
  token: token,
4381
- subdomain: subdomain,
4362
+ apiHost: apiHost,
4382
4363
  entityId: entityId,
4383
4364
  priceListCode: priceListCode,
4384
4365
  accountName: formData.accountName,
@@ -4393,7 +4374,7 @@ function Signup(_a) {
4393
4374
  setAccountId(data.account.id);
4394
4375
  return [4 /*yield*/, portalSessionCreate({
4395
4376
  token: token,
4396
- subdomain: subdomain,
4377
+ apiHost: apiHost,
4397
4378
  tenantCode: data.tenant.code,
4398
4379
  expiry: 24,
4399
4380
  returnUrl: returnUrl || "",
@@ -4435,7 +4416,7 @@ function Signup(_a) {
4435
4416
  }
4436
4417
  return [4 /*yield*/, accountSignup({
4437
4418
  token: portalSessionToken,
4438
- subdomain: subdomain,
4419
+ apiHost: apiHost,
4439
4420
  entityId: entityId,
4440
4421
  quoteId: quoteId,
4441
4422
  paymentMethodId: (_a = paymentSuccess.savedPaymentMethodResponse) === null || _a === void 0 ? void 0 : _a.paymentMethodId.toString(),
@@ -4457,347 +4438,17 @@ function Signup(_a) {
4457
4438
  setIsPaying(false);
4458
4439
  }
4459
4440
  if (isMobile) {
4460
- return (jsx(Card, __assign({ className: "p-4 flex flex-col" }, { children: purchaseSucceeded ? (jsx(PaymentSuccessDisplay, { className: "w-full", amountPaid: (quote === null || quote === void 0 ? void 0 : quote.amountDue) || 0, returnUrl: returnUrl })) : (jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col" : "flex-row", " h-full w-full") }, { children: [jsx("div", __assign({ className: "flex flex-col items-center" }, { children: jsx(PriceListDisplay, { priceListData: priceListData, topNavImageUrl: topNavImageUrl }) })), jsx("div", __assign({ className: "mx-8" }, { children: jsx(Divider, { className: "h-full" }) })), jsx("div", __assign({ className: "flex items-center justify-center my-12" }, { children: jsx(PaymentForms, { quote: quote, paying: paying, setIsPaying: setIsPaying, handlePaymentSaveSuccess: handlePaymentSaveSuccess, handlePaymentFail: handlePaymentFail, handleSubmit: handleSubmit, proceedingToPayment: proceedingToPayment, accountId: accountId || "" }) }))] }))) })));
4441
+ return (jsx(Card, __assign({ className: "p-4 flex flex-col" }, { children: purchaseSucceeded ? (jsx(PaymentSuccessDisplay, { amountPaid: (quote === null || quote === void 0 ? void 0 : quote.amountDue) || 0, className: "w-full", companyName: companyName, returnUrl: returnUrl })) : (jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col" : "flex-row", " h-full w-full") }, { children: [jsx("div", __assign({ className: "flex flex-col items-center" }, { children: jsx(PriceListDisplay, { priceListData: priceListData, topNavImageUrl: topNavImageUrl }) })), jsx("div", __assign({ className: "mx-8" }, { children: jsx(Divider, { className: "h-full" }) })), jsx("div", __assign({ className: "flex items-center justify-center my-12" }, { children: jsx(PaymentForms, { entityId: entityId, quote: quote, paying: paying, setIsPaying: setIsPaying, handlePaymentSaveSuccess: handlePaymentSaveSuccess, handlePaymentFail: handlePaymentFail, handleSubmit: handleSubmit, proceedingToPayment: proceedingToPayment, accountId: accountId || "" }) }))] }))) })));
4461
4442
  }
4462
4443
  else {
4463
- return (jsxs(Fragment, { children: [jsx(Card, __assign({ className: "p-4 flex flex-col w-screen h-screen" }, { children: purchaseSucceeded ? (jsx(PaymentSuccessDisplay, { className: "w-full", amountPaid: (quote === null || quote === void 0 ? void 0 : quote.amountDue) || 0, returnUrl: returnUrl })) : (jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col" : "flex-row", " h-full w-full") }, { children: [jsx("div", __assign({ className: "flex flex-col w-1/2 items-center" }, { children: jsx(PriceListDisplay, { priceListData: priceListData, topNavImageUrl: topNavImageUrl }) })), jsx("div", __assign({ className: "my-4" }, { children: jsx(Divider, { className: "h-full", type: "vertical" }) })), jsx("div", __assign({ className: "flex w-1/2 items-center justify-center my-12" }, { children: jsx(PaymentForms, { quote: quote, paying: paying, setIsPaying: setIsPaying, handlePaymentSaveSuccess: handlePaymentSaveSuccess, handlePaymentFail: handlePaymentFail, handleSubmit: handleSubmit, proceedingToPayment: proceedingToPayment, accountId: accountId || "" }) }))] }))) })), jsx(Footer, {})] }));
4444
+ return (jsx(Fragment, { children: jsx(Card, __assign({ className: "p-4 flex flex-col w-screen h-screen" }, { children: purchaseSucceeded ? (jsx(PaymentSuccessDisplay, { amountPaid: (quote === null || quote === void 0 ? void 0 : quote.amountDue) || 0, className: "w-full", companyName: companyName, returnUrl: returnUrl })) : (jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col" : "flex-row", " h-full w-full") }, { children: [jsx("div", __assign({ className: "flex flex-col w-1/2 items-center" }, { children: jsx(PriceListDisplay, { priceListData: priceListData, topNavImageUrl: topNavImageUrl }) })), jsx("div", __assign({ className: "my-4" }, { children: jsx(Divider, { className: "h-full", type: "vertical" }) })), jsx("div", __assign({ className: "flex w-1/2 items-center justify-center my-12" }, { children: jsx(PaymentForms, { entityId: entityId, quote: quote, paying: paying, setIsPaying: setIsPaying, handlePaymentSaveSuccess: handlePaymentSaveSuccess, handlePaymentFail: handlePaymentFail, handleSubmit: handleSubmit, proceedingToPayment: proceedingToPayment, accountId: accountId || "" }) }))] }))) })) }));
4464
4445
  }
4465
4446
  }
4466
4447
 
4467
- var updatingChargeQuantityIdState = atom({
4468
- key: "updatingChargeQuantityIdState",
4469
- default: undefined,
4470
- });
4471
-
4472
- var canShowQuantitiesInput = function (charge, subscription) {
4473
- // Check if the subscription is active, pending, or in trial,
4474
- // the pricing model is not flat,
4475
- // and if it's not a trial, also check if the current charge is the last one in the subscription.
4476
- var _a, _b, _c;
4477
- var isActiveSubscription = ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState$2.ACTIVE;
4478
- var isPendingSubscription = ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState$2.PENDING;
4479
- var isTrialSubscription = ((_c = subscription.state) === null || _c === void 0 ? void 0 : _c.toUpperCase()) === SubscriptionState$2.TRIAL;
4480
- var isFlatPricing = charge.pricingModel === "FLAT";
4481
- var shouldProcessCharge = (isActiveSubscription || isPendingSubscription || isTrialSubscription) &&
4482
- !isFlatPricing &&
4483
- charge.selfServiceQuantity &&
4484
- !charge.expired;
4485
- // Now you can use the value of shouldProcessCharge to determine whether to process the charge.
4486
- return shouldProcessCharge;
4487
- };
4488
- var createQuoteParams = function (quote, subscriptionQuantity, editedSubscription) {
4489
- var quoteChange = quote.quoteChanges.find(function (quoteChange) {
4490
- return quoteChange.priceList.id === (editedSubscription === null || editedSubscription === void 0 ? void 0 : editedSubscription.subscription.priceList.id);
4491
- });
4492
- var quoteChangeCharge = quoteChange === null || quoteChange === void 0 ? void 0 : quoteChange.charges.find(function (charge) { return charge.priceListCharge.id === editedSubscription.chargeId; });
4493
- var charges = [
4494
- {
4495
- id: quoteChangeCharge.id,
4496
- quantity: editedSubscription.quantity - subscriptionQuantity,
4497
- },
4498
- ];
4499
- return { charges: charges, quoteChange: quoteChange };
4500
- };
4501
- var canShowChangeQuantities = function (_a) {
4502
- var subscriptions = _a.subscriptions;
4503
- return subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.some(function (subscription) {
4504
- return subscription.charges.some(function (charge, chargeIndex) {
4505
- return canShowQuantitiesInput(charge, subscription);
4506
- });
4507
- });
4508
- };
4509
- var isSubscriptionNotActive = function (subscription) {
4510
- var _a, _b;
4511
- return ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState$2.EXPIRED ||
4512
- ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState$2.CANCELED;
4513
- };
4514
- var canShowSubscriptionActions = function (subscription) {
4515
- var _a, _b;
4516
- return ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState$2.ACTIVE ||
4517
- ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState$2.PENDING;
4518
- };
4519
-
4520
- var useCreateSubscriptionQuote = function () {
4521
- var graphQLRequest = useGraphQLRequest();
4522
- return function (subscriptionIds, token) { return __awaiter(void 0, void 0, void 0, function () {
4523
- var data;
4524
- return __generator(this, function (_a) {
4525
- switch (_a.label) {
4526
- 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, {
4527
- subscriptionIds: subscriptionIds,
4528
- })];
4529
- case 1:
4530
- data = _a.sent();
4531
- return [2 /*return*/, data];
4532
- }
4533
- });
4534
- }); };
4535
- };
4536
- var useQuoteChangeUpdate = function () {
4537
- var graphQLRequest = useGraphQLRequest();
4538
- return function (charges, quoteChangeId, token) { return __awaiter(void 0, void 0, void 0, function () {
4539
- var response;
4540
- return __generator(this, function (_a) {
4541
- switch (_a.label) {
4542
- 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, { charges: charges, id: quoteChangeId })];
4543
- case 1:
4544
- response = _a.sent();
4545
- return [2 /*return*/, response];
4546
- }
4547
- });
4548
- }); };
4549
- };
4550
- var useQuoteDelete = function () {
4551
- var graphQLRequest = useGraphQLRequest();
4552
- return function (quoteId, token) { return __awaiter(void 0, void 0, void 0, function () {
4553
- var response;
4554
- return __generator(this, function (_a) {
4555
- switch (_a.label) {
4556
- case 0: return [4 /*yield*/, graphQLRequest("mutation QuoteDelete($id: ID!) {\n quoteDelete(id: $id) {\n errors\n }\n }", token, { id: quoteId })];
4557
- case 1:
4558
- response = _a.sent();
4559
- return [2 /*return*/, response];
4560
- }
4561
- });
4562
- }); };
4563
- };
4564
-
4565
- var QuantityInput = function (_a) {
4566
- var charge = _a.charge, chargeIndex = _a.chargeIndex, editingQuote = _a.editingQuote, setEditingQuoteData = _a.setEditingQuoteData, subscription = _a.subscription, subscriptionIndex = _a.subscriptionIndex, subscriptions = _a.subscriptions;
4567
- // Context
4568
- var token = useContext(BunnyContext).token;
4569
- // Recoil state
4570
- var _b = useRecoilState(updatingChargeQuantityIdState), updatingChargeQuantityId = _b[0], setUpdatingChargeQuantityId = _b[1];
4571
- // Local state
4572
- var _c = useState(), editedSubscription = _c[0], setEditedSubscription = _c[1];
4573
- // Hooks
4574
- var queryClient = useQueryClient();
4575
- var handleAllErrorFormats = NotificationUtils.useAllErrorFormats(function () { });
4576
- var createSubscriptionQuote = useCreateSubscriptionQuote();
4577
- var quoteChangeUpdate = useQuoteChangeUpdate();
4578
- var isMobile = useIsMobile$1();
4579
- var showErrorNotification = NotificationUtils.useErrorNotification();
4580
- var quantityDisabled =
4581
- // If we are editing a quote, we disable the quantity input
4582
- // If we don't have a editedSubscription, we disable the quantity input
4583
- (updatingChargeQuantityId && updatingChargeQuantityId !== charge.id) ||
4584
- // If the subscription is not self-service, we disable the quantity input
4585
- !charge.selfServiceQuantity;
4586
- var value = (editedSubscription === null || editedSubscription === void 0 ? void 0 : editedSubscription.quantity) === undefined
4587
- ? ""
4588
- : editedSubscription.quantity;
4589
- // Mutations
4590
- var createQuote = useMutation({
4591
- mutationFn: function (subscriptionIds) {
4592
- return createSubscriptionQuote(subscriptionIds, token);
4593
- },
4594
- onError: handleAllErrorFormats,
4595
- onSuccess: function (subscriptionUpdateData) {
4596
- var _a;
4597
- var quote = (_a = subscriptionUpdateData === null || subscriptionUpdateData === void 0 ? void 0 : subscriptionUpdateData.quoteSubscriptionUpdate) === null || _a === void 0 ? void 0 : _a.quote;
4598
- var _b = createQuoteParams(quote, charge.quantity, editedSubscription), charges = _b.charges, quoteChange = _b.quoteChange;
4599
- if (quoteChange && charges[0].quantity > 0) {
4600
- updateQuote.mutate({
4601
- charges: charges,
4602
- quoteChangeId: quoteChange.id,
4603
- });
4604
- }
4605
- },
4606
- });
4607
- var updateQuote = useMutation({
4608
- mutationFn: function (_a) {
4609
- var charges = _a.charges, quoteChangeId = _a.quoteChangeId;
4610
- return quoteChangeUpdate(charges, quoteChangeId, token);
4611
- },
4612
- onSuccess: function (response) {
4613
- var _a, _b, _c, _d, _e, _f;
4614
- if (!(editingQuote === null || editingQuote === void 0 ? void 0 : editingQuote.id)) {
4615
- 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()) ===
4616
- SubscriptionState$2.TRIAL;
4617
- setEditingQuoteData({
4618
- id: (_d = (_c = response.quoteChangeUpdate) === null || _c === void 0 ? void 0 : _c.quoteChange) === null || _d === void 0 ? void 0 : _d.quoteId,
4619
- isTrial: isTrial,
4620
- });
4621
- }
4622
- queryClient.invalidateQueries({
4623
- queryKey: QueryKeyFactory.default.createObjectKey("editingQuote", (_f = (_e = response.quoteChangeUpdate) === null || _e === void 0 ? void 0 : _e.quoteChange) === null || _f === void 0 ? void 0 : _f.quoteId),
4624
- });
4625
- },
4626
- });
4627
- // Handlers
4628
- var isQuantityLowerThanOriginal = function (quantity) {
4629
- return (editedSubscription === null || editedSubscription === void 0 ? void 0 : editedSubscription.quantity) !== undefined &&
4630
- editedSubscription.quantity <= quantity;
4631
- };
4632
- var onChangeQuantity = function (chargeIndex, value, priceListChargeId, subscription, subscriptionIndex) {
4633
- var quantity = isNaN(parseInt(value)) ? 0 : parseInt(value);
4634
- setEditedSubscription({
4635
- chargeIndex: chargeIndex,
4636
- subscriptionIndex: subscriptionIndex,
4637
- chargeId: priceListChargeId,
4638
- quantity: quantity,
4639
- subscription: subscription,
4640
- });
4641
- if (quantity !== charge.quantity) {
4642
- setUpdatingChargeQuantityId(charge.id);
4643
- }
4644
- else {
4645
- setUpdatingChargeQuantityId(undefined);
4646
- }
4647
- };
4648
- var handleSubscriptionUpdate = function (editedSubscription) {
4649
- if (!editedSubscription)
4650
- return;
4651
- // If we are not editing a quote, we create a new one
4652
- if (!editingQuote) {
4653
- var subscriptionIds = [];
4654
- var charge_1 = subscriptions[editedSubscription.subscriptionIndex].charges[editedSubscription.chargeIndex];
4655
- if (isQuantityLowerThanOriginal(charge_1.quantity)) {
4656
- // If the quantity is lower than the original, we remove the quote
4657
- setEditingQuoteData(undefined);
4658
- setUpdatingChargeQuantityId(undefined);
4659
- return;
4660
- }
4661
- subscriptionIds.push(editedSubscription.subscription.id);
4662
- createQuote.mutate(subscriptionIds);
4663
- }
4664
- else {
4665
- // If we are editing a quote, we update the quote change
4666
- var _a = createQuoteParams(editingQuote, charge.quantity, editedSubscription), charges = _a.charges, quoteChange = _a.quoteChange;
4667
- if (quoteChange && charges[0].quantity > 0) {
4668
- updateQuote.mutate({
4669
- charges: charges,
4670
- quoteChangeId: quoteChange.id,
4671
- });
4672
- }
4673
- else {
4674
- // Reset the editing quote data and the updating charge quantity ID to their initial states
4675
- setEditingQuoteData(undefined);
4676
- setUpdatingChargeQuantityId(undefined);
4677
- }
4678
- }
4679
- };
4680
- // Initial subscription quantity if is on mobile
4681
- useEffect(function () {
4682
- if (isMobile && !editedSubscription && !quantityDisabled) {
4683
- setEditedSubscription({
4684
- chargeIndex: chargeIndex,
4685
- subscriptionIndex: subscriptionIndex,
4686
- chargeId: charge.priceListChargeId,
4687
- quantity: charge.quantity,
4688
- subscription: subscription,
4689
- });
4690
- }
4691
- }, [
4692
- charge,
4693
- chargeIndex,
4694
- editedSubscription,
4695
- isMobile,
4696
- quantityDisabled,
4697
- subscription,
4698
- subscriptionIndex,
4699
- ]);
4700
- // Edit subscription debounce
4701
- useEffect(function () {
4702
- var debounce = setTimeout(function () {
4703
- handleSubscriptionUpdate(editedSubscription);
4704
- }, 1000);
4705
- return function () { return clearTimeout(debounce); };
4706
- // eslint-disable-next-line
4707
- }, [editedSubscription]);
4708
- return (jsx(Fragment, { children: jsx(Input, { className: "text-right", disabled: quantityDisabled, onBlur: function () {
4709
- if (typeof value === "number" && value < charge.quantity) {
4710
- showErrorNotification("New value is less than the original quantity. This is not allowed");
4711
- }
4712
- }, onChange: function (e) {
4713
- onChangeQuantity(chargeIndex, e.target.value, charge.priceListChargeId, subscription, subscriptionIndex);
4714
- }, status: isQuantityLowerThanOriginal(charge.quantity) ? "error" : "", style: { width: "96px" }, value: value }) }));
4715
- };
4716
-
4717
- var QuantityChangeGridRow = function (_a) {
4718
- var _b;
4719
- var chargeIndex = _a.chargeIndex, editingQuote = _a.editingQuote, subscriptions = _a.subscriptions, subscriptionIndex = _a.subscriptionIndex, setEditingQuoteData = _a.setEditingQuoteData, subscription = _a.subscription, subscriptionCharge = _a.subscriptionCharge;
4720
- if (!canShowQuantitiesInput(subscriptionCharge, subscription))
4721
- return null;
4722
- return (jsxs(Fragment, { children: [jsx("div", __assign({ className: "font-medium text-orange-600 col-span-full", style: { fontSize: "11px" } }, { children: subscription.plan.name })), jsx("div", __assign({ className: "font-medium text-base text-gray-900" }, { children: (_b = subscriptionCharge.name) === null || _b === void 0 ? void 0 : _b.toUpperCase() })), jsx("div", __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" })] }));
4723
- };
4724
-
4725
- var QuantityChangeGridTitle = function (_a) {
4726
- var children = _a.children, right = _a.right;
4727
- return (jsx("div", __assign({ className: "font-medium text-slate-600 ".concat(right ? "text-right" : "text-left"), style: { fontSize: "11px" } }, { children: children })));
4728
- };
4729
-
4730
- var QuoteChangeSummarySection = function (_a) {
4731
- var editingQuote = _a.editingQuote, editingQuoteData = _a.editingQuoteData, openCheckout = _a.openCheckout, setEditingQuoteData = _a.setEditingQuoteData;
4732
- var isMobile = useIsMobile$1();
4733
- var token = useContext(BunnyContext).token;
4734
- var showSuccessNotification = NotificationUtils.useSuccessNotification();
4735
- var trialUpgradeMutation = useMutation({
4736
- mutationFn: function (quoteId) { return checkout({ quoteId: quoteId, token: token }); },
4737
- onSuccess: function () {
4738
- setEditingQuoteData(undefined);
4739
- showSuccessNotification("Subscription updated successfully");
4740
- },
4741
- });
4742
- 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: Misc.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)
4743
- ? function () { return trialUpgradeMutation.mutate(editingQuoteData.id); }
4744
- : openCheckout, disabled: !editingQuoteData, size: isMobile ? "large" : "middle", type: "primary" }, { children: (editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.isTrial) ? "Activate Trial" : "Proceed to checkout" })) }))] })));
4745
- };
4746
-
4747
- var QUANTITY_CHANGE_HEADER_TITLE = "Update unit quantity";
4748
- var QUANTITY_CHANGE_HEADER_DESCRIPTION = "Adjust quantities below. The change will take effect immediately after checkout has been completed.";
4749
- var QuantityChangeDrawerDesktop = function (_a) {
4750
- var editingQuote = _a.editingQuote, editingQuoteData = _a.editingQuoteData, onClose = _a.onClose, open = _a.open, openCheckout = _a.openCheckout, setEditingQuoteData = _a.setEditingQuoteData, subscriptions = _a.subscriptions;
4751
- var _b = useState(open), openLocal = _b[0], setOpenLocal = _b[1];
4752
- var isMobile = useIsMobile$1();
4753
- useEffect(function () {
4754
- var timeoutId;
4755
- if (!open) {
4756
- timeoutId = setTimeout(function () {
4757
- setOpenLocal(false);
4758
- }, 300); // Delay to allow for close animation
4759
- }
4760
- else {
4761
- setOpenLocal(true);
4762
- }
4763
- return function () { return clearTimeout(timeoutId); };
4764
- }, [open]);
4765
- if (!openLocal)
4766
- return null;
4767
- return (jsxs(Drawer, __assign({ closeIcon: null, destroyOnClose: true, onClose: onClose, open: open, styles: isMobile
4768
- ? {
4769
- body: {
4770
- padding: "1rem",
4771
- overflow: "hidden",
4772
- background: SLATE_50,
4773
- },
4774
- wrapper: {
4775
- width: "100vw",
4776
- },
4777
- }
4778
- : {
4779
- wrapper: {
4780
- minWidth: "600px",
4781
- },
4782
- }, title: jsx(DrawerHeader, { description: QUANTITY_CHANGE_HEADER_DESCRIPTION, onClose: onClose, title: QUANTITY_CHANGE_HEADER_TITLE }) }, { children: [jsxs("div", __assign({ className: "grid pb-4", style: {
4783
- gridTemplateColumns: "2fr 1fr 1fr",
4784
- rowGap: "0.75rem",
4785
- columnGap: "1rem",
4786
- } }, { 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) {
4787
- var _a;
4788
- var isTrial = ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState$2.TRIAL;
4789
- return (jsx("div", __assign({ className: "contents" }, { children: subscription.charges.map(function (charge, chargeIndex) {
4790
- if ((isTrial && !charge.trial) || (!isTrial && charge.trial))
4791
- return null;
4792
- return (jsx(QuantityChangeGridRow, { chargeIndex: chargeIndex, editingQuote: editingQuote, setEditingQuoteData: setEditingQuoteData, subscription: subscription, subscriptionCharge: charge, subscriptionIndex: index, subscriptions: subscriptions }, chargeIndex));
4793
- }) }), index));
4794
- })] })), jsx(QuoteChangeSummarySection, { editingQuote: editingQuote, editingQuoteData: editingQuoteData, openCheckout: openCheckout, setEditingQuoteData: setEditingQuoteData })] })));
4795
- };
4796
-
4797
4448
  // WARNING: There is a preview button on APP that will need to be changed if this query is changed
4798
4449
  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 }";
4799
4450
  var getPlanChangeOptions = function (_a) {
4800
- var isInPreviewMode = _a.isInPreviewMode, token = _a.token, upgradingSubscription = _a.upgradingSubscription, subdomain = _a.subdomain;
4451
+ var isInPreviewMode = _a.isInPreviewMode, token = _a.token, upgradingSubscription = _a.upgradingSubscription, apiHost = _a.apiHost;
4801
4452
  return __awaiter(void 0, void 0, void 0, function () {
4802
4453
  var response, planChangeOptions;
4803
4454
  return __generator(this, function (_b) {
@@ -4807,7 +4458,7 @@ var getPlanChangeOptions = function (_a) {
4807
4458
  query: PLAN_CHANGE_OPTIONS_QUERY,
4808
4459
  vars: { subscriptionId: upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id },
4809
4460
  token: token,
4810
- subdomain: subdomain,
4461
+ apiHost: apiHost,
4811
4462
  })];
4812
4463
  case 1:
4813
4464
  response = _b.sent();
@@ -4826,7 +4477,7 @@ var getPlanChangeOptions = function (_a) {
4826
4477
 
4827
4478
  var QUOTE_QUERY = function () { return "\n query quote($id: ID) {\n quote(id: $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 }"; };
4828
4479
  var getQuote = function (_a) {
4829
- var id = _a.id, token = _a.token, subdomain = _a.subdomain;
4480
+ var id = _a.id, token = _a.token, apiHost = _a.apiHost;
4830
4481
  return __awaiter(void 0, void 0, void 0, function () {
4831
4482
  var response;
4832
4483
  return __generator(this, function (_b) {
@@ -4835,7 +4486,7 @@ var getQuote = function (_a) {
4835
4486
  query: QUOTE_QUERY(),
4836
4487
  token: token,
4837
4488
  vars: { id: id },
4838
- subdomain: subdomain,
4489
+ apiHost: apiHost,
4839
4490
  })];
4840
4491
  case 1:
4841
4492
  response = _b.sent();
@@ -4847,7 +4498,7 @@ var getQuote = function (_a) {
4847
4498
 
4848
4499
  var SUBSCRIPTIONS_QUERY = "query 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 isRamp\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 }";
4849
4500
  var getSubscriptions = function (_a) {
4850
- var entityId = _a.entityId, isInPreviewMode = _a.isInPreviewMode, token = _a.token, subdomain = _a.subdomain;
4501
+ var entityId = _a.entityId, isInPreviewMode = _a.isInPreviewMode, token = _a.token, apiHost = _a.apiHost;
4851
4502
  return __awaiter(void 0, void 0, void 0, function () {
4852
4503
  var response;
4853
4504
  var _b;
@@ -4858,7 +4509,7 @@ var getSubscriptions = function (_a) {
4858
4509
  query: SUBSCRIPTIONS_QUERY,
4859
4510
  token: token,
4860
4511
  vars: { entityId: entityId },
4861
- subdomain: subdomain,
4512
+ apiHost: apiHost,
4862
4513
  })];
4863
4514
  case 1:
4864
4515
  response = _c.sent();
@@ -4928,7 +4579,7 @@ var ErrorView = function (_a) {
4928
4579
  var Text$3 = Typography.Text;
4929
4580
  var HideExpiredToggle = function (_a) {
4930
4581
  var hideExpired = _a.hideExpired, setHideExpired = _a.setHideExpired, subscriptions = _a.subscriptions;
4931
- var isMobile = useIsMobile$1();
4582
+ var isMobile = useIsMobile(window);
4932
4583
  var secondaryColor = useContext(BrandContext).secondaryColor;
4933
4584
  var hasExpiredOrCanceledSubscriptions = subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.some(function (subscription) {
4934
4585
  var _a, _b;
@@ -4944,6 +4595,42 @@ var HideExpiredToggle = function (_a) {
4944
4595
  var StyledCheckbox = styled.div(templateObject_1$2 || (templateObject_1$2 = __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"])));
4945
4596
  var templateObject_1$2;
4946
4597
 
4598
+ // import { EditingSubscriptionType } from "../../../features/quantityChangeDrawer/QuantityInput";
4599
+ var canShowQuantitiesInput = function (charge, subscription) {
4600
+ // Check if the subscription is active, pending, or in trial,
4601
+ // the pricing model is not flat,
4602
+ // and if it's not a trial, also check if the current charge is the last one in the subscription.
4603
+ var _a, _b, _c;
4604
+ var isActiveSubscription = ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState$2.ACTIVE;
4605
+ var isPendingSubscription = ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState$2.PENDING;
4606
+ var isTrialSubscription = ((_c = subscription.state) === null || _c === void 0 ? void 0 : _c.toUpperCase()) === SubscriptionState$2.TRIAL;
4607
+ var isFlatPricing = charge.pricingModel === "FLAT";
4608
+ var shouldProcessCharge = (isActiveSubscription || isPendingSubscription || isTrialSubscription) &&
4609
+ !isFlatPricing &&
4610
+ charge.selfServiceQuantity &&
4611
+ !charge.expired;
4612
+ // Now you can use the value of shouldProcessCharge to determine whether to process the charge.
4613
+ return shouldProcessCharge;
4614
+ };
4615
+ var canShowChangeQuantities = function (_a) {
4616
+ var subscriptions = _a.subscriptions;
4617
+ return subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.some(function (subscription) {
4618
+ return subscription.charges.some(function (charge, chargeIndex) {
4619
+ return canShowQuantitiesInput(charge, subscription);
4620
+ });
4621
+ });
4622
+ };
4623
+ var isSubscriptionNotActive = function (subscription) {
4624
+ var _a, _b;
4625
+ return ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState$2.EXPIRED ||
4626
+ ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState$2.CANCELED;
4627
+ };
4628
+ var canShowSubscriptionActions = function (subscription) {
4629
+ var _a, _b;
4630
+ return ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState$2.ACTIVE ||
4631
+ ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState$2.PENDING;
4632
+ };
4633
+
4947
4634
  var SubscriptionState;
4948
4635
  (function (SubscriptionState) {
4949
4636
  SubscriptionState["ACTIVE"] = "ACTIVE";
@@ -4956,7 +4643,7 @@ var SubscriptionState$1 = SubscriptionState;
4956
4643
 
4957
4644
  var FEATURE_USAGE_MUTATION = "\nquery GetFeatureUsage($id: ID!) {\n featureUsageHistogram(subscriptionChargeId: $id) {\n subscriptionCharge { \n id\n name\n amount\n currentPeriodPriceByTiers { \n tier { starts price } \n quantity\n amount\n }\n }\n feature { id name }\n periodRange\n dataInterval\n data {\n periodStart\n periodEnd\n intervals {\n intervalStart\n intervalUsage\n }\n intervalsTotal\n }\n }\n}\n";
4958
4645
  var getFeatureUsage = function (_a) {
4959
- var subscriptionChargeId = _a.subscriptionChargeId; _a.startDate; _a.endDate; _a.dataInterval; var token = _a.token;
4646
+ var subscriptionChargeId = _a.subscriptionChargeId; _a.startDate; _a.endDate; _a.dataInterval; var token = _a.token, apiHost = _a.apiHost;
4960
4647
  return __awaiter(void 0, void 0, void 0, function () {
4961
4648
  var vars, response;
4962
4649
  var _b;
@@ -4970,6 +4657,7 @@ var getFeatureUsage = function (_a) {
4970
4657
  query: FEATURE_USAGE_MUTATION,
4971
4658
  token: token,
4972
4659
  vars: vars,
4660
+ apiHost: apiHost,
4973
4661
  })];
4974
4662
  case 1:
4975
4663
  response = _c.sent();
@@ -5108,7 +4796,7 @@ var FeatureUsageGraph = function (_a) {
5108
4796
  }
5109
4797
  return false;
5110
4798
  }))
5111
- return "no usage";
4799
+ return jsx("div", { children: "no usage" });
5112
4800
  return (jsxs("div", __assign({ onClick: function () {
5113
4801
  setIsModalOpen(true);
5114
4802
  } }, { children: [jsx("div", __assign({ style: {
@@ -5140,7 +4828,7 @@ var templateObject_1;
5140
4828
 
5141
4829
  var MUTATION = "\nmutation quoteSubscriptionReinstate($ids: [ID!]!) {\n quoteSubscriptionReinstate(ids: $ids) {\n quote {\n id\n uuid\n accountId\n dealId\n name\n amount\n taxAmount\n discount\n netPaymentDays\n acceptedByName\n acceptedByTitle\n state\n billingDay\n evergreen\n requiresApproval\n isPendingApprovalRequest\n poNumber\n kind\n currencyId\n ownerId\n contactId\n quoteChanges {\n id\n priceListId\n charges {\n id\n pricingModel\n chargeType\n billingPeriod\n price\n priceDecimals\n tieredAveragePrice\n quantity\n quantityMin\n quantityMax\n discount\n amount\n prorationRate\n name\n invoiceLineText\n createdAt\n updatedAt\n startDate\n endDate\n billingPeriodAmounts { id amount prorationRate }\n currencyId\n couponId\n feature { id name code isUnit unitName }\n priceTiers { starts price }\n }\n }\n expiresAt\n createdAt\n updatedAt\n startDate\n endDate\n invoiceUntil\n applicationDate\n applied\n endDateOptions {\n endDate\n label\n }\n invoiceUntilOptions {\n endDate\n label\n }\n notes\n message\n amountsByPeriod {\n id\n name\n amount\n }\n subtotal\n credits\n discountValue\n }\n }\n}\n";
5142
4830
  var getGuoteSubscriptionReinstate = function (_a) {
5143
- var ids = _a.ids, token = _a.token, subdomain = _a.subdomain;
4831
+ var ids = _a.ids, token = _a.token, apiHost = _a.apiHost;
5144
4832
  return __awaiter(void 0, void 0, void 0, function () {
5145
4833
  var vars, response, _b, errors, quote;
5146
4834
  return __generator(this, function (_c) {
@@ -5151,7 +4839,7 @@ var getGuoteSubscriptionReinstate = function (_a) {
5151
4839
  query: MUTATION,
5152
4840
  token: token,
5153
4841
  vars: vars,
5154
- subdomain: subdomain,
4842
+ apiHost: apiHost,
5155
4843
  })];
5156
4844
  case 1:
5157
4845
  response = _c.sent();
@@ -5164,32 +4852,16 @@ var getGuoteSubscriptionReinstate = function (_a) {
5164
4852
  });
5165
4853
  };
5166
4854
 
5167
- var useCancelSubscription = function () {
5168
- var graphQLRequest = useGraphQLRequest();
5169
- return function (subscriptionIds, token) { return __awaiter(void 0, void 0, void 0, function () {
5170
- var data;
5171
- var _a;
5172
- return __generator(this, function (_b) {
5173
- switch (_b.label) {
5174
- 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, { subscriptionIds: subscriptionIds })];
5175
- case 1:
5176
- data = _b.sent();
5177
- return [2 /*return*/, (_a = data === null || data === void 0 ? void 0 : data.subscriptions) === null || _a === void 0 ? void 0 : _a.nodes];
5178
- }
5179
- });
5180
- }); };
5181
- };
5182
-
5183
4855
  var SubscriptionCardActions = function (_a) {
5184
4856
  var _b, _c;
5185
4857
  var planChangeOptions = _a.planChangeOptions, subscription = _a.subscription, setEditingQuoteData = _a.setEditingQuoteData, setPayModalVisible = _a.setPayModalVisible;
5186
4858
  // Context
5187
- var _d = useContext(BunnyContext), token = _d.token, subdomain = _d.subdomain;
4859
+ var _d = useContext(BunnyContext), token = _d.token, apiHost = _d.apiHost;
5188
4860
  var _e = useContext(SubscriptionsContext), onChangePlanClick = _e.onChangePlanClick, onClickUpgrade = _e.onClickUpgrade, isTempViewOnly = _e.isTempViewOnly;
5189
4861
  // Hooks
5190
- var showSuccessNotification = NotificationUtils.useSuccessNotification();
5191
- var cancelSubscription = useCancelSubscription();
5192
- var queryClient = useQueryClient();
4862
+ useSuccessNotification();
4863
+ // const cancelSubscription = useCancelSubscription();
4864
+ useQueryClient();
5193
4865
  // const navigate = usePortalNavigate();
5194
4866
  // const handleUpgradingSubscriptionChange =
5195
4867
  // useHandleUpgradingSubscriptionChange();
@@ -5198,21 +4870,21 @@ var SubscriptionCardActions = function (_a) {
5198
4870
  var productPlans = (_b = planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.plans) === null || _b === void 0 ? void 0 : _b.filter(function (plan) { var _a; return ((_a = plan.priceLists) === null || _a === void 0 ? void 0 : _a.length) > 0 && plan.productId === subscription.product.id; });
5199
4871
  var canShowChangePlanButton = ((productPlans === null || productPlans === void 0 ? void 0 : productPlans.length) || 0) > 0;
5200
4872
  // Mutations
5201
- var subscriptionCancel = useMutation({
5202
- mutationFn: function () { return cancelSubscription([subscription.id], token); },
5203
- onSuccess: function () {
5204
- queryClient.invalidateQueries({
5205
- queryKey: QueryKeyFactory.default.createTableKey("subscriptions"),
5206
- });
5207
- showSuccessNotification("Subscription canceled");
5208
- },
5209
- });
4873
+ // const subscriptionCancel = useMutation({
4874
+ // mutationFn: () => cancelSubscription([subscription.id], token),
4875
+ // onSuccess: () => {
4876
+ // queryClient.invalidateQueries({
4877
+ // queryKey: QueryKeyFactory.default.createTableKey("subscriptions"),
4878
+ // });
4879
+ // showSuccessNotification("Subscription canceled");
4880
+ // },
4881
+ // });
5210
4882
  useMutation({
5211
4883
  mutationFn: function () {
5212
4884
  return getGuoteSubscriptionReinstate({
5213
4885
  ids: [subscription.id],
5214
4886
  token: token,
5215
- subdomain: subdomain,
4887
+ apiHost: apiHost,
5216
4888
  });
5217
4889
  },
5218
4890
  onSuccess: function (quote) {
@@ -5232,7 +4904,9 @@ var SubscriptionCardActions = function (_a) {
5232
4904
  onChangePlanClick();
5233
4905
  };
5234
4906
  return (canShowChangePlanButton || canShowCancelButton) &&
5235
- canShowSubscriptionActions(subscription) ? (jsxs(Fragment, { children: [!isTempViewOnly && canShowCancelButton && (jsx(Popconfirm, __assign({ icon: null, onConfirm: function () { return subscriptionCancel.mutate(); }, title: "Cancel subscription" }, { children: jsx(Button, __assign({ className: "p-0", type: "link" }, { children: "Cancel subscription" })) }))), !isTempViewOnly && canShowChangePlanButton && (jsx(Button, __assign({ onClick: function () { return handleChangePlanClick(); }, type: "primary" }, { children: "Change plan" })))] })) : ((_c = subscription.state) === null || _c === void 0 ? void 0 : _c.toUpperCase()) === SubscriptionState$2.TRIAL ? (jsx(Fragment, { children: !isTempViewOnly && (jsx(Button, __assign({ onClick: function () {
4907
+ canShowSubscriptionActions(subscription) ? (jsxs(Fragment, { children: [!isTempViewOnly && canShowCancelButton && (jsx(Popconfirm, __assign({ icon: null,
4908
+ // onConfirm={() => subscriptionCancel.mutate()}
4909
+ title: "Cancel subscription" }, { children: jsx(Button, __assign({ className: "p-0", type: "link" }, { children: "Cancel subscription" })) }))), !isTempViewOnly && canShowChangePlanButton && (jsx(Button, __assign({ onClick: function () { return handleChangePlanClick(); }, type: "primary" }, { children: "Change plan" })))] })) : ((_c = subscription.state) === null || _c === void 0 ? void 0 : _c.toUpperCase()) === SubscriptionState$2.TRIAL ? (jsx(Fragment, { children: !isTempViewOnly && (jsx(Button, __assign({ onClick: function () {
5236
4910
  // handleUpgradingSubscriptionChange({
5237
4911
  // subscription,
5238
4912
  // });
@@ -5250,22 +4924,22 @@ var getSubscriptionStatusText = function (subscription) {
5250
4924
  if (cancellationDate &&
5251
4925
  (state === null || state === void 0 ? void 0 : state.toUpperCase()) !== SubscriptionState$2.CANCELED &&
5252
4926
  (state === null || state === void 0 ? void 0 : state.toUpperCase()) !== SubscriptionState$2.EXPIRED) {
5253
- return (jsxs(Tag, __assign({ color: "red" }, { children: ["Canceled - ends on ", Misc.formatDate(cancellationDate)] })));
4927
+ return (jsxs(Tag, __assign({ color: "red" }, { children: ["Canceled - ends on ", formatDate(cancellationDate)] })));
5254
4928
  }
5255
4929
  if (evergreen) {
5256
- return "Renews on ".concat(Misc.formatDate(endDate));
4930
+ return "Renews on ".concat(formatDate(endDate));
5257
4931
  }
5258
4932
  if ((state === null || state === void 0 ? void 0 : state.toUpperCase()) === SubscriptionState$2.CANCELED ||
5259
4933
  (state === null || state === void 0 ? void 0 : state.toUpperCase()) === SubscriptionState$2.EXPIRED) {
5260
- return "Ended on ".concat(Misc.formatDate(endDate));
4934
+ return "Ended on ".concat(formatDate(endDate));
5261
4935
  }
5262
- return "Ends on ".concat(Misc.formatDate(endDate));
4936
+ return "Ends on ".concat(formatDate(endDate));
5263
4937
  };
5264
4938
  var SubscriptionCardHeader = function (_a) {
5265
4939
  var _b, _c, _d, _e, _f;
5266
4940
  var planChangeOptions = _a.planChangeOptions, setEditingQuoteData = _a.setEditingQuoteData, setPayModalVisible = _a.setPayModalVisible, subscription = _a.subscription;
5267
4941
  var darkMode = useContext(BunnyContext).darkMode;
5268
- var isMobile = useIsMobile$1();
4942
+ var isMobile = useIsMobile(window);
5269
4943
  // Derived state
5270
4944
  var trialDaysLeft = dayjs(subscription.trialEndDate).diff(dayjs(), "days");
5271
4945
  var isTrial = ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState$2.TRIAL;
@@ -5284,8 +4958,8 @@ var BillingPeriodConverter;
5284
4958
  })(BillingPeriodConverter || (BillingPeriodConverter = {}));
5285
4959
  var SubscriptionChargeTotal = function (_a) {
5286
4960
  var charge = _a.charge, subscription = _a.subscription;
5287
- var isMobile = useIsMobile$1();
5288
- return (jsxs("div", __assign({ className: "flex gap-1 ".concat(isMobile ? "flex-col" : "") }, { children: [jsx("div", { children: Misc.formatCurrency(Number(charge.periodPrice), subscription.currencyId) }), charge.billingPeriod && (jsx("div", { children: BillingPeriodConverter[charge.billingPeriod] }))] })));
4961
+ var isMobile = useIsMobile(window);
4962
+ return (jsxs("div", __assign({ className: "flex gap-1 ".concat(isMobile ? "flex-col" : "") }, { children: [jsx("div", { children: formatCurrency(Number(charge.periodPrice), subscription.currencyId) }), charge.billingPeriod && (jsx("div", { children: BillingPeriodConverter[charge.billingPeriod] }))] })));
5289
4963
  };
5290
4964
 
5291
4965
  var SubscriptionChargeUnitPrice = function (_a) {
@@ -5305,16 +4979,16 @@ var SubscriptionChargeUnitPrice = function (_a) {
5305
4979
  var ends = ((_c = (_b = (_a = charge.priceListCharge) === null || _a === void 0 ? void 0 : _a.priceListChargeTiers) === null || _b === void 0 ? void 0 : _b[index + 1]) === null || _c === void 0 ? void 0 : _c.starts)
5306
4980
  ? ((_e = (_d = charge.priceListCharge) === null || _d === void 0 ? void 0 : _d.priceListChargeTiers[index + 1]) === null || _e === void 0 ? void 0 : _e.starts) - 1
5307
4981
  : "∞";
5308
- return (jsxs("div", __assign({ className: "contents" }, { children: [jsxs("div", __assign({ className: "whitespace-nowrap" }, { children: [tier.starts.toLocaleString(), " - ", ends.toLocaleString(), " ", ":"] })), jsx("div", __assign({ className: "whitespace-nowrap text-right" }, { children: Misc.formatCurrency(tier.price, subscription.currencyId, charge.priceDecimals) }))] }), index));
4982
+ return (jsxs("div", __assign({ className: "contents" }, { children: [jsxs("div", __assign({ className: "whitespace-nowrap" }, { children: [tier.starts.toLocaleString(), " - ", ends.toLocaleString(), " ", ":"] })), jsx("div", __assign({ className: "whitespace-nowrap text-right" }, { children: formatCurrency(tier.price, subscription.currencyId, charge.priceDecimals) }))] }), index));
5309
4983
  }) })) })));
5310
4984
  }, onOpenChange: setShowPriceTiers, open: showPriceTiers, trigger: ["click"] }, { children: jsx("div", __assign({ className: "cursor-pointer underline", onClick: function () { return setShowPriceTiers(!showPriceTiers); } }, { children: showPriceTiers ? "hide details" : "show details" })) })));
5311
4985
  }
5312
- return (jsx(Fragment, { children: Misc.formatCurrency(charge.discountedPrice, subscription.currencyId) }));
4986
+ return jsx(Fragment, { children: formatCurrency(charge.discountedPrice, subscription.currencyId) });
5313
4987
  };
5314
4988
 
5315
4989
  var SubscriptionCardColumnHeaders = function (_a) {
5316
4990
  var columns = _a.columns;
5317
- return columns.map(function (subscriptionColumn, index) { return (jsx("div", __assign({ className: "text-slate-400 ".concat(subscriptionColumn.className), style: { fontSize: "11px" } }, { children: subscriptionColumn.title }), index)); });
4991
+ 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)); }) }));
5318
4992
  };
5319
4993
 
5320
4994
  var Text$1 = Typography.Text;
@@ -5371,13 +5045,13 @@ var SubscriptionCardDesktop = function (_a) {
5371
5045
  var SubscriptionCardDesktopRow = function (_a) {
5372
5046
  var charge = _a.charge, chargeIndex = _a.chargeIndex, subscription = _a.subscription;
5373
5047
  // Context
5374
- var token = useContext(BunnyContext).token;
5048
+ var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
5375
5049
  // Derived state
5376
5050
  var isRamp = charge.isRamp;
5377
5051
  var prevCharge = subscription.charges[chargeIndex - 1];
5378
5052
  var isFirstRampRow = chargeIndex === 0 ||
5379
5053
  (prevCharge === null || prevCharge === void 0 ? void 0 : prevCharge.priceListChargeId) !== charge.priceListChargeId;
5380
- var chargePeriod = "".concat(Misc.formatDate(charge.startDate), " - ").concat(Misc.formatDate(charge.endDate));
5054
+ var chargePeriod = "".concat(formatDate(charge.startDate), " - ").concat(formatDate(charge.endDate));
5381
5055
  // Queries
5382
5056
  var data = useQuery({
5383
5057
  queryKey: ["getFeatureUsage", charge.id, charge.startDate, charge.endDate],
@@ -5387,6 +5061,7 @@ var SubscriptionCardDesktopRow = function (_a) {
5387
5061
  startDate: charge.startDate,
5388
5062
  subscriptionChargeId: charge.id,
5389
5063
  token: token,
5064
+ apiHost: apiHost,
5390
5065
  });
5391
5066
  },
5392
5067
  enabled: (!isRamp || (isRamp && isFirstRampRow)) &&
@@ -5446,7 +5121,7 @@ var SubscriptionCard = function (_a) {
5446
5121
  if ((isTrial && !charge.trial) || (!isTrial && charge.trial))
5447
5122
  return null;
5448
5123
  var isRamp = charge.isRamp;
5449
- var chargePeriod = "".concat(Misc.formatDate(charge.startDate), " - ").concat(Misc.formatDate(charge.endDate));
5124
+ var chargePeriod = "".concat(formatDate(charge.startDate), " - ").concat(formatDate(charge.endDate));
5450
5125
  return (jsxs("div", __assign({ className: "contents" }, { children: [((isRamp && chargeIndex === 0) || !isRamp) && (jsxs(SubscriptionCardCellMobile, __assign({ className: CHARGE_COLUMNS[0].className, style: { gridColumn: isRamp ? "1/-1" : "1" } }, { children: [jsx("span", { children: charge.name }), !isRamp ? " - ".concat(chargePeriod) : ""] }))), isRamp && (jsx(SubscriptionCardCellMobile, __assign({ className: CHARGE_COLUMNS[0].className }, { children: "- ".concat(chargePeriod) }))), jsx(SubscriptionCardCellMobile, __assign({ className: CHARGE_COLUMNS[1].className }, { children: charge.quantity })), jsx(SubscriptionCardCellMobile, __assign({ className: CHARGE_COLUMNS[2].className }, { children: jsx(SubscriptionChargeUnitPrice, { charge: charge, subscription: subscription }) })), jsx(SubscriptionCardCellMobile, __assign({ className: CHARGE_COLUMNS[3].className }, { children: jsx(SubscriptionChargeTotal, { charge: charge, subscription: subscription }) }))] }), chargeIndex));
5451
5126
  })] })), jsx("div", __assign({ className: "flex gap-2 pt-5", style: {
5452
5127
  flexDirection: "column-reverse",
@@ -5455,14 +5130,14 @@ var SubscriptionCard = function (_a) {
5455
5130
 
5456
5131
  var SubscriptionsList = function (_a) {
5457
5132
  var hideExpired = _a.hideExpired, planChangeOptions = _a.planChangeOptions, setEditingQuoteData = _a.setEditingQuoteData, setPayModalVisible = _a.setPayModalVisible, subscriptions = _a.subscriptions;
5458
- var isMobile = useIsMobile$1();
5459
- return subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.map(function (subscription, subscriptionIndex) {
5460
- if (hideExpired && isSubscriptionNotActive(subscription))
5461
- return null;
5462
- if (isMobile)
5463
- return (jsx(SubscriptionCard, { planChangeOptions: planChangeOptions, setEditingQuoteData: setEditingQuoteData, setPayModalVisible: setPayModalVisible, subscription: subscription }, subscriptionIndex));
5464
- return (jsx(SubscriptionCardDesktop, { planChangeOptions: planChangeOptions, setEditingQuoteData: setEditingQuoteData, setPayModalVisible: setPayModalVisible, subscription: subscription }, subscriptionIndex));
5465
- });
5133
+ var isMobile = useIsMobile(window);
5134
+ return (jsx(Fragment, { children: subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.map(function (subscription, subscriptionIndex) {
5135
+ if (hideExpired && isSubscriptionNotActive(subscription))
5136
+ return null;
5137
+ if (isMobile)
5138
+ return (jsx(SubscriptionCard, { planChangeOptions: planChangeOptions, setEditingQuoteData: setEditingQuoteData, setPayModalVisible: setPayModalVisible, subscription: subscription }, subscriptionIndex));
5139
+ return (jsx(SubscriptionCardDesktop, { planChangeOptions: planChangeOptions, setEditingQuoteData: setEditingQuoteData, setPayModalVisible: setPayModalVisible, subscription: subscription }, subscriptionIndex));
5140
+ }) }));
5466
5141
  };
5467
5142
 
5468
5143
  var ChangeQuantitiesButton = function (_a) {
@@ -5478,7 +5153,7 @@ var SubscriptionsNavigation = function (_a) {
5478
5153
  var hideExpired = _a.hideExpired, setHideExpired = _a.setHideExpired, setQuantityDrawerOpen = _a.setQuantityDrawerOpen, subscriptions = _a.subscriptions;
5479
5154
  var isTempViewOnly = useContext(SubscriptionsContext).isTempViewOnly;
5480
5155
  // Hooks
5481
- var isMobile = useIsMobile$1();
5156
+ var isMobile = useIsMobile(window);
5482
5157
  // Derived state
5483
5158
  var canShowChangeQuantitiesButton = canShowChangeQuantities({
5484
5159
  subscriptions: subscriptions,
@@ -5487,44 +5162,48 @@ var SubscriptionsNavigation = function (_a) {
5487
5162
  };
5488
5163
 
5489
5164
  var SubscriptionsContext = createContext({});
5165
+ // !!! This component is intended to be view only, however it still has lots of code for full functionality.
5166
+ // !!! This must be refactored.
5490
5167
  var Subscriptions = function (_a) {
5491
- var shadow = _a.shadow, gap = _a.gap, _b = _a.showTitle, showTitle = _b === void 0 ? true : _b;
5168
+ var companyName = _a.companyName, entityId = _a.entityId, gap = _a.gap, shadow = _a.shadow, _b = _a.showTitle, showTitle = _b === void 0 ? true : _b;
5492
5169
  // Context
5493
- var _c = useContext(BunnyContext), token = _c.token, subdomain = _c.subdomain;
5170
+ var _c = useContext(BunnyContext), token = _c.token, apiHost = _c.apiHost, onErrorNavigate = _c.onErrorNavigate;
5494
5171
  // Recoil state
5495
- var _d = useRecoilState(updatingChargeQuantityIdState), updatingChargeQuantityId = _d[0], setUpdatingChargeQuantityId = _d[1];
5172
+ // const [updatingChargeQuantityId, setUpdatingChargeQuantityId] =
5173
+ // useRecoilState(updatingChargeQuantityIdState);
5496
5174
  // Local state
5497
- var _e = useState(), editingQuoteData = _e[0], setEditingQuoteData = _e[1];
5498
- var _f = useState(false), payModalVisible = _f[0], setPayModalVisible = _f[1];
5499
- var _g = useState(true), hideExpired = _g[0], setHideExpired = _g[1];
5500
- var _h = useState(false), quantityDrawerOpen = _h[0], setQuantityDrawerOpen = _h[1];
5175
+ var _d = useState(), editingQuoteData = _d[0], setEditingQuoteData = _d[1];
5176
+ var _e = useState(false), payModalVisible = _e[0], setPayModalVisible = _e[1];
5177
+ var _f = useState(true), hideExpired = _f[0], setHideExpired = _f[1];
5178
+ var _g = useState(false); _g[0]; var setQuantityDrawerOpen = _g[1];
5501
5179
  // Hooks
5502
- var handleAllErrorFormats = NotificationUtils.useAllErrorFormats(function () { });
5180
+ var handleAllErrorFormats = useAllErrorFormats(onErrorNavigate ||
5181
+ (function (url) {
5182
+ console.log("navigate to", url, " not implemented");
5183
+ }));
5503
5184
  var queryClient = useQueryClient();
5504
- var showSuccessNotification = NotificationUtils.useSuccessNotification();
5505
- var quoteDelete = useQuoteDelete();
5506
- var isMobile = useIsMobile$1();
5507
- var entityId = useCurrentUserData().entityId;
5508
- var companyName = useCurrentUserData().companyName;
5185
+ var showSuccessNotification = useSuccessNotification();
5186
+ // const quoteDelete = useQuoteDelete();
5187
+ var isMobile = useIsMobile(window);
5509
5188
  // Queries
5510
- var _j = useQuery({
5189
+ var _h = useQuery({
5511
5190
  queryKey: QueryKeyFactory.default.createTableKey("subscriptions"),
5512
- queryFn: function () { return getSubscriptions({ entityId: entityId, token: token, subdomain: subdomain }); },
5191
+ queryFn: function () { return getSubscriptions({ entityId: entityId, token: token, apiHost: apiHost }); },
5513
5192
  enabled: Boolean(entityId),
5514
- }), rawSubscriptions = _j.data, subscriptionsAreLoading = _j.isLoading;
5193
+ }), rawSubscriptions = _h.data, subscriptionsAreLoading = _h.isLoading;
5515
5194
  var quote = useQuery({
5516
5195
  queryKey: QueryKeyFactory.default.createObjectKey("editingQuote", editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.id),
5517
5196
  queryFn: function () {
5518
5197
  return (editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.id)
5519
- ? getQuote({ token: token, id: editingQuoteData.id, subdomain: subdomain })
5198
+ ? getQuote({ token: token, id: editingQuoteData.id, apiHost: apiHost })
5520
5199
  : undefined;
5521
5200
  },
5522
5201
  enabled: Boolean(editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.id),
5523
5202
  }).data;
5524
- var _k = useQuery({
5203
+ var _j = useQuery({
5525
5204
  queryKey: QueryKeyFactory.default.planChangeOptionsKey(),
5526
- queryFn: function () { return getPlanChangeOptions({ token: token, subdomain: subdomain }); },
5527
- }), planChangeOptions = _k.data, arePlanChangeOptionsLoading = _k.isLoading;
5205
+ queryFn: function () { return getPlanChangeOptions({ token: token, apiHost: apiHost }); },
5206
+ }), planChangeOptions = _j.data, arePlanChangeOptionsLoading = _j.isLoading;
5528
5207
  // Derived state
5529
5208
  var subscriptions = useSubscriptions({ data: rawSubscriptions });
5530
5209
  var allSubscriptionsExpired = subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.every(function (subscription) {
@@ -5556,16 +5235,16 @@ var Subscriptions = function (_a) {
5556
5235
  var onFail = function (error) {
5557
5236
  handleAllErrorFormats(error);
5558
5237
  };
5559
- var onClose = function () {
5560
- if (editingQuoteData) {
5561
- quoteDelete(editingQuoteData.id, token);
5562
- setEditingQuoteData(undefined);
5563
- }
5564
- if (updatingChargeQuantityId) {
5565
- setUpdatingChargeQuantityId(undefined);
5566
- }
5567
- setQuantityDrawerOpen(false);
5568
- };
5238
+ // const onClose = () => {
5239
+ // if (editingQuoteData) {
5240
+ // quoteDelete(editingQuoteData.id, token);
5241
+ // setEditingQuoteData(undefined);
5242
+ // }
5243
+ // // if (updatingChargeQuantityId) {
5244
+ // // setUpdatingChargeQuantityId(undefined);
5245
+ // // }
5246
+ // setQuantityDrawerOpen(false);
5247
+ // };
5569
5248
  if (subscriptionsAreLoading || arePlanChangeOptionsLoading)
5570
5249
  return jsx(Fragment, {});
5571
5250
  return (jsxs(SubscriptionsContext.Provider, __assign({ value: {
@@ -5579,9 +5258,9 @@ var Subscriptions = function (_a) {
5579
5258
  shadow: shadow,
5580
5259
  gap: gap,
5581
5260
  showTitle: showTitle,
5582
- } }, { children: [showTitle && (jsx(PageHeaderWithActions, __assign({ title: jsxs("div", __assign({ className: "flex items-center justify-between", style: { minWidth: "137px" } }, { children: [hideExpired ? "Active subscriptions" : "All subscriptions", isMobile && (jsx(HideExpiredToggle, { hideExpired: hideExpired, setHideExpired: setHideExpired, subscriptions: subscriptions }))] })) }, { children: !isMobile && (jsx(SubscriptionsNavigation, { hideExpired: hideExpired, setHideExpired: setHideExpired, setQuantityDrawerOpen: setQuantityDrawerOpen, subscriptions: subscriptions })) }))), jsx(PageContent, __assign({ className: "flex flex-col gap-".concat(gap === undefined ? 4 : gap, " shadow-padding-xb overflow-auto"), style: {
5261
+ } }, { children: [showTitle && (jsx(PageHeaderWithActions, __assign({ title: jsxs("div", __assign({ className: "flex items-center justify-between", style: { minWidth: "137px" } }, { children: [hideExpired ? "Active subscriptions" : "All subscriptions", isMobile && (jsx(HideExpiredToggle, { hideExpired: hideExpired, setHideExpired: setHideExpired, subscriptions: subscriptions }))] })) }, { children: !isMobile && (jsx(SubscriptionsNavigation, { hideExpired: hideExpired, setHideExpired: setHideExpired, setQuantityDrawerOpen: setQuantityDrawerOpen, subscriptions: subscriptions })) }))), jsx("div", __assign({ className: "flex flex-col gap-".concat(gap === undefined ? 4 : gap, " shadow-padding-xb overflow-auto"), style: {
5583
5262
  flexShrink: 1,
5584
- } }, { children: (subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.length) > 0 ? (jsx(SubscriptionsList, { hideExpired: hideExpired, planChangeOptions: planChangeOptions, setEditingQuoteData: setEditingQuoteData, setPayModalVisible: setPayModalVisible, subscriptions: subscriptions })) : (jsx("div", __assign({ className: "flex flex-col items-center w-full" }, { children: jsx(ErrorView, { message: "You have no subscriptions with ".concat(companyName, " yet") }) }))) })), isMobile && (jsx("div", __assign({ className: "pt-4 pb-2" }, { children: jsx(SubscriptionsNavigation, { 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, { onCancel: onCancel, onSuccess: onSuccess, onFail: onFail, open: payModalVisible, quote: quote, token: token, isMobile: isMobile })] })));
5263
+ } }, { children: (subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.length) > 0 ? (jsx(Fragment, { children: jsx(SubscriptionsList, { hideExpired: hideExpired, planChangeOptions: planChangeOptions, setEditingQuoteData: setEditingQuoteData, setPayModalVisible: setPayModalVisible, subscriptions: subscriptions }) })) : (jsx("div", __assign({ className: "flex flex-col items-center w-full" }, { children: jsx(ErrorView, { message: "You have no subscriptions with ".concat(companyName, " yet") }) }))) })), isMobile && (jsx("div", __assign({ className: "pt-4 pb-2" }, { children: jsx(SubscriptionsNavigation, { hideExpired: hideExpired, setHideExpired: setHideExpired, setQuantityDrawerOpen: setQuantityDrawerOpen, subscriptions: subscriptions }) }))), jsx(Checkout, { entityId: entityId, onCancel: onCancel, onSuccess: onSuccess, onFail: onFail, open: payModalVisible, quote: quote, token: token, isMobile: isMobile })] })));
5585
5264
  };
5586
5265
 
5587
5266
  export { BunnyProvider, Checkout, Invoice, PaymentMethod, Quote, Quotes, Signup, Subscriptions, Transactions, getQuoteAmountDue, usePaymentMethod };