@bunnyapp/components 1.0.6 → 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 (174) hide show
  1. package/dist/cjs/index.js +1208 -1449
  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/Quotes/index.d.ts +1 -0
  26. package/dist/cjs/src/components/Signup/PaymentForms.d.ts +2 -2
  27. package/dist/cjs/src/components/Signup/PaymentSuccess.d.ts +4 -3
  28. package/dist/cjs/src/components/Signup/Signup.d.ts +3 -1
  29. package/dist/cjs/src/components/Subscriptions/Subscriptions.d.ts +4 -2
  30. package/dist/cjs/src/components/Subscriptions/subscriptionsList/SubscriptionsList.d.ts +1 -1
  31. package/dist/cjs/src/components/Subscriptions/subscriptionsList/subscriptionCardDesktop/SubscriptionCardColumnHeaders.d.ts +1 -1
  32. package/dist/cjs/src/components/Subscriptions/subscriptionsList/subscriptionUtils.d.ts +1 -2
  33. package/dist/cjs/src/components/Transactions/Transactions.d.ts +3 -1
  34. package/dist/cjs/src/components/Transactions/TransactionsListContext.d.ts +1 -0
  35. package/dist/cjs/src/components/Transactions/transactionsList/TransactionDownload.d.ts +2 -2
  36. package/dist/cjs/src/components/Transactions/transactionsList/TransactionsListDesktop.d.ts +1 -11
  37. package/dist/cjs/src/components/index.d.ts +1 -0
  38. package/dist/cjs/src/contexts/NavigationContext.d.ts +1 -1
  39. package/dist/cjs/src/graphql/mutations/accountSignup.d.ts +2 -2
  40. package/dist/cjs/src/graphql/mutations/accountUpdate.d.ts +2 -1
  41. package/dist/cjs/src/graphql/mutations/checkout.d.ts +2 -2
  42. package/dist/cjs/src/graphql/mutations/portalSessionCreate.d.ts +2 -2
  43. package/dist/cjs/src/graphql/mutations/quoteAccountSignup.d.ts +2 -2
  44. package/dist/cjs/src/graphql/mutations/quoteAddCoupon.d.ts +2 -1
  45. package/dist/cjs/src/graphql/mutations/quoteCompose.d.ts +2 -2
  46. package/dist/cjs/src/graphql/mutations/quoteCreate.d.ts +2 -2
  47. package/dist/cjs/src/graphql/mutations/quoteRecalculateTaxes.d.ts +2 -1
  48. package/dist/cjs/src/graphql/mutations/quoteSubscriptionReinstate.d.ts +2 -2
  49. package/dist/cjs/src/graphql/queries/getAccount.d.ts +2 -2
  50. package/dist/cjs/src/graphql/queries/getBranding.d.ts +2 -2
  51. package/dist/cjs/src/graphql/queries/getCurrentUserData.d.ts +2 -2
  52. package/dist/cjs/src/graphql/queries/getFeatureUsage.d.ts +2 -1
  53. package/dist/cjs/src/graphql/queries/getFormattedQuote.d.ts +2 -2
  54. package/dist/cjs/src/graphql/queries/getInvoice.d.ts +2 -2
  55. package/dist/cjs/src/graphql/queries/getPlanChangeOptions.d.ts +2 -2
  56. package/dist/cjs/src/graphql/queries/getPriceList.d.ts +2 -2
  57. package/dist/cjs/src/graphql/queries/getQuote.d.ts +2 -2
  58. package/dist/cjs/src/graphql/queries/getQuotes.d.ts +2 -2
  59. package/dist/cjs/src/graphql/queries/getSubscription.d.ts +2 -2
  60. package/dist/cjs/src/graphql/queries/getSubscriptions.d.ts +2 -2
  61. package/dist/cjs/src/graphql/queries/getTaxationRequiredAccountFields.d.ts +6 -0
  62. package/dist/cjs/src/graphql/queries/getTransactions.d.ts +1 -1
  63. package/dist/cjs/src/hooks/quotes/useSendAcceptQuote.d.ts +7 -1
  64. package/dist/cjs/src/hooks/useHasTaxPlugin.d.ts +3 -2
  65. package/dist/cjs/src/hooks/usePaymentPlugins.d.ts +11 -0
  66. package/dist/cjs/src/hooks/usePlugins.d.ts +6 -0
  67. package/dist/cjs/src/hooks/useSigningPlugins.d.ts +5 -1
  68. package/dist/cjs/src/index.d.ts +1 -0
  69. package/dist/cjs/src/utils/GraphQLClient.d.ts +2 -0
  70. package/dist/cjs/src/utils/quoteInvoiceUtils.d.ts +6 -0
  71. package/dist/esm/index.js +1214 -1455
  72. package/dist/esm/playground/main.d.ts +1 -1
  73. package/dist/esm/src/ajax.d.ts +1 -0
  74. package/dist/esm/src/components/BunnyProvider.d.ts +9 -5
  75. package/dist/esm/src/components/Checkout/Checkout.d.ts +4 -2
  76. package/dist/esm/src/components/Checkout/InvoiceCheckout.d.ts +2 -1
  77. package/dist/esm/src/components/Checkout/QuoteCheckout.d.ts +2 -1
  78. package/dist/esm/src/components/FeatureUsageGraph.d.ts +1 -1
  79. package/dist/esm/src/components/Invoice/Invoice.d.ts +2 -2
  80. package/dist/esm/src/components/Invoice/InvoiceQuoteView.d.ts +1 -2
  81. package/dist/esm/src/components/LegacyInvoicePDF.d.ts +2 -2
  82. package/dist/esm/src/components/PaymentForm/DemoPay/demoPayUtils.d.ts +1 -1
  83. package/dist/esm/src/components/PaymentForm/Finix/FinixCardForm.d.ts +1 -1
  84. package/dist/esm/src/components/PaymentForm/FinixAch.d.ts +1 -1
  85. package/dist/esm/src/components/PaymentForm/PaymentForm.d.ts +1 -1
  86. package/dist/esm/src/components/PaymentForm/PaymentFormTypes.d.ts +1 -0
  87. package/dist/esm/src/components/PaymentForm/PaymentMethod/PaymentMethod.d.ts +2 -2
  88. package/dist/esm/src/components/PaymentForm/PaymentMethod/PaymentMethodContext.d.ts +0 -1
  89. package/dist/esm/src/components/PaymentForm/PaymentMethodForm.d.ts +1 -1
  90. package/dist/esm/src/components/PaymentForm/Stripe/StripeForm.d.ts +1 -1
  91. package/dist/esm/src/components/PaymentForm/Stripe/stripeUtils.d.ts +6 -6
  92. package/dist/esm/src/components/PaymentForm/paymentUtils.d.ts +2 -2
  93. package/dist/esm/src/components/Quote/Quote.d.ts +2 -2
  94. package/dist/esm/src/components/Quotes/Quotes.d.ts +2 -1
  95. package/dist/esm/src/components/Quotes/index.d.ts +1 -0
  96. package/dist/esm/src/components/Signup/PaymentForms.d.ts +2 -2
  97. package/dist/esm/src/components/Signup/PaymentSuccess.d.ts +4 -3
  98. package/dist/esm/src/components/Signup/Signup.d.ts +3 -1
  99. package/dist/esm/src/components/Subscriptions/Subscriptions.d.ts +4 -2
  100. package/dist/esm/src/components/Subscriptions/subscriptionsList/SubscriptionsList.d.ts +1 -1
  101. package/dist/esm/src/components/Subscriptions/subscriptionsList/subscriptionCardDesktop/SubscriptionCardColumnHeaders.d.ts +1 -1
  102. package/dist/esm/src/components/Subscriptions/subscriptionsList/subscriptionUtils.d.ts +1 -2
  103. package/dist/esm/src/components/Transactions/Transactions.d.ts +3 -1
  104. package/dist/esm/src/components/Transactions/TransactionsListContext.d.ts +1 -0
  105. package/dist/esm/src/components/Transactions/transactionsList/TransactionDownload.d.ts +2 -2
  106. package/dist/esm/src/components/Transactions/transactionsList/TransactionsListDesktop.d.ts +1 -11
  107. package/dist/esm/src/components/index.d.ts +1 -0
  108. package/dist/esm/src/contexts/NavigationContext.d.ts +1 -1
  109. package/dist/esm/src/graphql/mutations/accountSignup.d.ts +2 -2
  110. package/dist/esm/src/graphql/mutations/accountUpdate.d.ts +2 -1
  111. package/dist/esm/src/graphql/mutations/checkout.d.ts +2 -2
  112. package/dist/esm/src/graphql/mutations/portalSessionCreate.d.ts +2 -2
  113. package/dist/esm/src/graphql/mutations/quoteAccountSignup.d.ts +2 -2
  114. package/dist/esm/src/graphql/mutations/quoteAddCoupon.d.ts +2 -1
  115. package/dist/esm/src/graphql/mutations/quoteCompose.d.ts +2 -2
  116. package/dist/esm/src/graphql/mutations/quoteCreate.d.ts +2 -2
  117. package/dist/esm/src/graphql/mutations/quoteRecalculateTaxes.d.ts +2 -1
  118. package/dist/esm/src/graphql/mutations/quoteSubscriptionReinstate.d.ts +2 -2
  119. package/dist/esm/src/graphql/queries/getAccount.d.ts +2 -2
  120. package/dist/esm/src/graphql/queries/getBranding.d.ts +2 -2
  121. package/dist/esm/src/graphql/queries/getCurrentUserData.d.ts +2 -2
  122. package/dist/esm/src/graphql/queries/getFeatureUsage.d.ts +2 -1
  123. package/dist/esm/src/graphql/queries/getFormattedQuote.d.ts +2 -2
  124. package/dist/esm/src/graphql/queries/getInvoice.d.ts +2 -2
  125. package/dist/esm/src/graphql/queries/getPlanChangeOptions.d.ts +2 -2
  126. package/dist/esm/src/graphql/queries/getPriceList.d.ts +2 -2
  127. package/dist/esm/src/graphql/queries/getQuote.d.ts +2 -2
  128. package/dist/esm/src/graphql/queries/getQuotes.d.ts +2 -2
  129. package/dist/esm/src/graphql/queries/getSubscription.d.ts +2 -2
  130. package/dist/esm/src/graphql/queries/getSubscriptions.d.ts +2 -2
  131. package/dist/esm/src/graphql/queries/getTaxationRequiredAccountFields.d.ts +6 -0
  132. package/dist/esm/src/graphql/queries/getTransactions.d.ts +1 -1
  133. package/dist/esm/src/hooks/quotes/useSendAcceptQuote.d.ts +7 -1
  134. package/dist/esm/src/hooks/useHasTaxPlugin.d.ts +3 -2
  135. package/dist/esm/src/hooks/usePaymentPlugins.d.ts +11 -0
  136. package/dist/esm/src/hooks/usePlugins.d.ts +6 -0
  137. package/dist/esm/src/hooks/useSigningPlugins.d.ts +5 -1
  138. package/dist/esm/src/index.d.ts +1 -0
  139. package/dist/esm/src/utils/GraphQLClient.d.ts +2 -0
  140. package/dist/esm/src/utils/quoteInvoiceUtils.d.ts +6 -0
  141. package/dist/index.d.ts +58 -15
  142. package/package.json +10 -7
  143. package/dist/cjs/src/atoms/pageContentRefAtom.d.ts +0 -1
  144. package/dist/cjs/src/atoms/planPickerQuoteDataAtom.d.ts +0 -2
  145. package/dist/cjs/src/atoms/updatingChargeQuantityIdAtom.d.ts +0 -2
  146. package/dist/cjs/src/components/Footer.d.ts +0 -4
  147. package/dist/cjs/src/components/PageContent.d.ts +0 -7
  148. package/dist/cjs/src/features/quantityChangeDrawer/QuantityChangeGridRow.d.ts +0 -11
  149. package/dist/cjs/src/features/quantityChangeDrawer/QuantityChangeGridTitle.d.ts +0 -6
  150. package/dist/cjs/src/features/quantityChangeDrawer/QuantityInput.d.ts +0 -21
  151. package/dist/cjs/src/features/quantityChangeDrawer/QuoteChangeSummarySection.d.ts +0 -9
  152. package/dist/cjs/src/features/quantityChangeDrawer/quantityChangeDrawerDesktop/QuantityChangeDrawerDesktop.d.ts +0 -14
  153. package/dist/cjs/src/graphql/QuoteRequests.d.ts +0 -6
  154. package/dist/cjs/src/graphql/SubscriptionRequests.d.ts +0 -2
  155. package/dist/cjs/src/graphql/queries/getFormattedInvoice.d.ts +0 -7
  156. package/dist/cjs/src/hooks/useCurrentUserData.d.ts +0 -2
  157. package/dist/cjs/src/hooks/useIsMobile.d.ts +0 -10
  158. package/dist/cjs/src/utils.d.ts +0 -9
  159. package/dist/esm/src/atoms/pageContentRefAtom.d.ts +0 -1
  160. package/dist/esm/src/atoms/planPickerQuoteDataAtom.d.ts +0 -2
  161. package/dist/esm/src/atoms/updatingChargeQuantityIdAtom.d.ts +0 -2
  162. package/dist/esm/src/components/Footer.d.ts +0 -4
  163. package/dist/esm/src/components/PageContent.d.ts +0 -7
  164. package/dist/esm/src/features/quantityChangeDrawer/QuantityChangeGridRow.d.ts +0 -11
  165. package/dist/esm/src/features/quantityChangeDrawer/QuantityChangeGridTitle.d.ts +0 -6
  166. package/dist/esm/src/features/quantityChangeDrawer/QuantityInput.d.ts +0 -21
  167. package/dist/esm/src/features/quantityChangeDrawer/QuoteChangeSummarySection.d.ts +0 -9
  168. package/dist/esm/src/features/quantityChangeDrawer/quantityChangeDrawerDesktop/QuantityChangeDrawerDesktop.d.ts +0 -14
  169. package/dist/esm/src/graphql/QuoteRequests.d.ts +0 -6
  170. package/dist/esm/src/graphql/SubscriptionRequests.d.ts +0 -2
  171. package/dist/esm/src/graphql/queries/getFormattedInvoice.d.ts +0 -7
  172. package/dist/esm/src/hooks/useCurrentUserData.d.ts +0 -2
  173. package/dist/esm/src/hooks/useIsMobile.d.ts +0 -10
  174. package/dist/esm/src/utils.d.ts +0 -9
package/dist/esm/index.js CHANGED
@@ -2,19 +2,49 @@ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
3
  import React__default, { createContext, useContext, useEffect, useState, useMemo, useRef } from 'react';
4
4
  import { Markup } from 'interweave';
5
- import { ConfigProvider, Button, Typography, Checkbox, Input, Divider, Modal, Form, Tag, Popconfirm, Drawer, Select, Image, Card as Card$1, Dropdown } from 'antd';
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, Lists, getTaxationRequiredAccountFields, getAccount, useCurrentUserData, SLATE_500, PRIMARY_COLOR, FrontendTransaction, SLATE_600, WHITE, TransactionKind, 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, useRecoilValue, useSetRecoilState, 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,168 +3248,573 @@ 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
- var DrawerHeader = function (_a) {
3297
- var description = _a.description, onClose = _a.onClose, title = _a.title;
3298
- 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 }))] })));
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 }"); };
3352
+ var getQuotes = function (_a) {
3353
+ var token = _a.token, apiHost = _a.apiHost, filter = _a.filter;
3354
+ return __awaiter(void 0, void 0, void 0, function () {
3355
+ var response;
3356
+ return __generator(this, function (_b) {
3357
+ switch (_b.label) {
3358
+ case 0: return [4 /*yield*/, gqlRequest({
3359
+ query: QUOTES_QUERY(filter),
3360
+ token: token,
3361
+ vars: {},
3362
+ apiHost: apiHost,
3363
+ })];
3364
+ case 1:
3365
+ response = _b.sent();
3366
+ return [2 /*return*/, response === null || response === void 0 ? void 0 : response.quotes];
3367
+ }
3368
+ });
3369
+ });
3299
3370
  };
3300
3371
 
3301
- var LargeCardIcon = function () {
3302
- 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" }) })));
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}"); };
3373
+ var getTransactions = function (filter, token, apiHost, kindsToShow) { return __awaiter(void 0, void 0, void 0, function () {
3374
+ var response, _a, data, errors, transactions;
3375
+ var _b, _c;
3376
+ return __generator(this, function (_d) {
3377
+ switch (_d.label) {
3378
+ case 0: return [4 /*yield*/, fetch(apiHost + "/graphql", {
3379
+ method: "POST",
3380
+ headers: {
3381
+ "Content-type": "application/json; charset=utf-8",
3382
+ Authorization: "Bearer ".concat(token),
3383
+ },
3384
+ body: JSON.stringify({
3385
+ query: transactionMutation(filter),
3386
+ }),
3387
+ })];
3388
+ case 1:
3389
+ response = _d.sent();
3390
+ return [4 /*yield*/, response.json()];
3391
+ case 2:
3392
+ _a = _d.sent(), data = _a.data, errors = _a.errors;
3393
+ if (errors) {
3394
+ throw new Error(errors[0].message);
3395
+ }
3396
+ transactions = (_c = (_b = data === null || data === void 0 ? void 0 : data.transactions) === null || _b === void 0 ? void 0 : _b.nodes) === null || _c === void 0 ? void 0 : _c.filter(function (transaction) { return kindsToShow.includes(transaction.kind); });
3397
+ return [2 /*return*/, transactions === null || transactions === void 0 ? void 0 : transactions.reverse()];
3398
+ }
3399
+ });
3400
+ }); };
3401
+
3402
+ var Text$b = Typography.Text;
3403
+ var PageHeaderWithActions = function (_a) {
3404
+ var children = _a.children, title = _a.title;
3405
+ var isMobile = useIsMobile(window);
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] })));
3407
+ };
3408
+ var PageSubTitle = function (_a) {
3409
+ var title = _a.title;
3410
+ var secondaryColor = useContext(BrandContext).secondaryColor;
3411
+ var darkMode = useContext(BunnyContext).darkMode;
3412
+ return (jsx(Text$b, __assign({ className: "shrink-0 font-medium", style: { color: darkMode ? undefined : secondaryColor } }, { children: title })));
3303
3413
  };
3304
3414
 
3305
- var PlusIcon = function (_a) {
3306
- var color = _a.color;
3307
- 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" })] })));
3415
+ var StateTag = function (_a) {
3416
+ var state = _a.state;
3417
+ return jsx(Tag, __assign({ color: getColor(state) }, { children: capitalize(startCase(state)) }));
3418
+ };
3419
+ var getColor = function (state) {
3420
+ switch (state) {
3421
+ case FrontendTransaction.TransactionState.not_due:
3422
+ return "yellow";
3423
+ case FrontendTransaction.TransactionState.voided:
3424
+ return "black";
3425
+ case FrontendTransaction.TransactionState.ready:
3426
+ return "orange";
3427
+ case FrontendTransaction.TransactionState.preparing:
3428
+ return "purple";
3429
+ case FrontendTransaction.TransactionState.unapplied:
3430
+ case FrontendTransaction.TransactionState.partially_applied:
3431
+ case FrontendTransaction.TransactionState.applied:
3432
+ return "blue";
3433
+ case FrontendTransaction.TransactionState.due:
3434
+ case FrontendTransaction.TransactionState.unpaid:
3435
+ return "orange";
3436
+ case FrontendTransaction.TransactionState.failed:
3437
+ return "red";
3438
+ case FrontendTransaction.TransactionState.paid:
3439
+ return "green";
3440
+ default:
3441
+ return "blue";
3442
+ }
3308
3443
  };
3309
3444
 
3310
- var PaymentMethodContext = createContext({});
3445
+ var TransactionsListContext = createContext({});
3311
3446
 
3312
- var Card = function (_a) {
3313
- var children = _a.children, className = _a.className, style = _a.style;
3314
- var darkMode = useContext(BunnyContext).darkMode;
3315
- return (jsx("div", __assign({ className: "flex flex-col rounded-md shadow-md ".concat(className), style: __assign(__assign({}, style), { backgroundColor: darkMode
3316
- ? "var(--row-background-dark)"
3317
- : "var(--row-background)" }) }, { children: children })));
3447
+ var Text$a = Typography.Text;
3448
+ var TransactionDate = function (_a) {
3449
+ var date = _a.date;
3450
+ return jsx(Text$a, __assign({ className: "text-sm" }, { children: formatDate(date) }));
3318
3451
  };
3319
3452
 
3320
- var Text$b = Typography.Text;
3321
- var CreditCard = function (_a) {
3322
- var _b, _c, _d;
3323
- var onClickRemove = _a.onClickRemove, onClickUpdate = _a.onClickUpdate, paymentMethodData = _a.paymentMethodData;
3324
- var isExpired = function (paymentMethodData) {
3325
- // paymentMethodData.expirationDate
3326
- var expDate = dayjs(paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.expirationDate);
3327
- return expDate.isBefore(dayjs());
3328
- };
3329
- var isMobile = useIsMobile$1();
3330
- var processPublicUrl = useContext(PaymentMethodContext).processPublicUrl;
3331
- 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$b, { 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 }))] }))] }))] })));
3453
+ // TODO: delete
3454
+ var ArrowDownToLine = function (_a) {
3455
+ var className = _a.className, _b = _a.color, color = _b === void 0 ? SLATE_600 : _b;
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" })] })));
3332
3457
  };
3333
- var CardAttribute = function (_a) {
3334
- var title = _a.title, value = _a.value;
3335
- return (jsxs("div", __assign({ className: "flex flex-col gap-2" }, { children: [jsx("div", __assign({ className: "text-slate-400", style: { fontSize: "11px" } }, { children: title })), jsx(Text$b, { children: value })] })));
3458
+
3459
+ var TransactionDownload = function (_a) {
3460
+ var transaction = _a.transaction, token = _a.token, apiHost = _a.apiHost;
3461
+ var darkMode = useContext(BunnyContext).darkMode;
3462
+ var downloadTransactionLink = useContext(TransactionsListContext).downloadTransactionLink;
3463
+ var downloadFile = useDownloadFile();
3464
+ var isMobile = useIsMobile(window);
3465
+ var isClickable = transaction.kind === "INVOICE" || downloadTransactionLink !== undefined;
3466
+ var downloadLink = downloadTransactionLink
3467
+ ? downloadTransactionLink(transaction.transactionableId)
3468
+ : "".concat(apiHost, "/api/pdf/invoice/").concat(transaction.transactionableId);
3469
+ if (!isClickable)
3470
+ return null;
3471
+ return (jsx("div", __assign({ onClick: function (e) {
3472
+ e.stopPropagation();
3473
+ downloadFile(downloadLink, token);
3474
+ } }, { children: jsx(ArrowDownToLine, { className: "".concat(isMobile ? "" : "show-on-hover"), color: darkMode ? WHITE : SLATE_600 }) })));
3336
3475
  };
3337
- var CardActions = function (_a) {
3338
- var onClickRemove = _a.onClickRemove, onClickUpdate = _a.onClickUpdate;
3339
- var isMobile = useIsMobile$1();
3340
- 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" }))] })));
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
+
3484
+ var Text$9 = Typography.Text;
3485
+ var TransactionsEmptyState = function () {
3486
+ var noTransactionsMessage = useContext(TransactionsListContext).noTransactionsMessage;
3487
+ return (jsx(Text$9, __assign({ className: "flex justify-center p-4 text-base" }, { children: noTransactionsMessage || "There are no transactions" })));
3341
3488
  };
3342
- var EmptyCard = function (_a) {
3343
- var onClick = _a.onClick;
3344
- var brandColor = useContext(BrandContext).brandColor;
3345
- return (jsxs("div", __assign({ className: "flex flex-col items-center justify-center w-full pt-8 px-4 pb-6 cursor-pointer bg-white shadow-md rounded-md", onClick: onClick }, { children: [jsx(LargeCardIcon, {}), jsx("div", __assign({ className: "text-slate-400 pt-4 pb-8" }, { children: "No payment methods" })), jsx(Button, __assign({ type: "link" }, { children: jsxs("div", __assign({ className: "flex items-center gap-1" }, { children: [jsx(PlusIcon, { color: brandColor }), "Add payment method"] })) }))] })));
3489
+
3490
+ var isInvoice = function (transaction) {
3491
+ return transaction.kind === "INVOICE";
3346
3492
  };
3347
- var getCardImage = function (issuer) {
3348
- if (issuer === "visa")
3349
- return "Visa_Brandmark_Blue_RGB_2021.png";
3350
- else if (issuer === "mastercard")
3351
- return "mc_symbol_opt_73_3x.png";
3493
+ var isQuote = function (transaction) {
3494
+ return transaction.kind === "QUOTE";
3495
+ };
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 })));
3352
3502
  };
3353
3503
 
3354
- var ActualPaymentMethod = function () {
3355
- var _a = useContext(BunnyContext), token = _a.token, subdomain = _a.subdomain, graphQLClient = _a.graphQLClient;
3356
- var accountId = useContext(PaymentContext).accountId;
3357
- // Hooks
3358
- var queryClient = useQueryClient();
3359
- var paymentPlugins = usePaymentPlugins({ subdomain: subdomain, token: token }).paymentPlugins;
3360
- var showErrorNotification = NotificationUtils.useErrorNotification();
3361
- var showSuccessNotification = NotificationUtils.useSuccessNotification();
3362
- var handleAllErrorFormats = NotificationUtils.useAllErrorFormats(function () {
3363
- console.log("Navigation in PaymentMethod.tsx useAllErrorFormats not implemented");
3504
+ var Text$8 = Typography.Text;
3505
+ var TransactionsListDesktop = function (_a) {
3506
+ var transactions = _a.transactions, onTransactionClick = _a.onTransactionClick;
3507
+ var columns = useContext(TransactionsListContext).columns;
3508
+ var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, darkMode = _b.darkMode;
3509
+ var showAmount = columns.includes("amount");
3510
+ var showDateAndTitle = columns.includes("date-and-title");
3511
+ var showDownload = columns.includes("download");
3512
+ var showState = columns.includes("state");
3513
+ if ((transactions === null || transactions === void 0 ? void 0 : transactions.length) === 0)
3514
+ return jsx(TransactionsEmptyState, {});
3515
+ return transactions === null || transactions === void 0 ? void 0 : transactions.map(function (transaction, index) {
3516
+ var _a;
3517
+ var isClickable = onTransactionClick !== undefined;
3518
+ return (jsxs("div", __assign({ className: "contents ".concat(isClickable && "cursor-pointer", " show-on-hover-container"), onClick: function () {
3519
+ onTransactionClick === null || onTransactionClick === void 0 ? void 0 : onTransactionClick(transaction);
3520
+ }, style: {
3521
+ backgroundColor: index % 2 === 0
3522
+ ? "var(--row-background".concat(darkMode ? "-dark" : "", ")")
3523
+ : "var(--row-background-alternate".concat(darkMode ? "-dark" : "", ")"),
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));
3364
3525
  });
3365
- var isMobile = useIsMobile$1();
3366
- var data = usePaymentMethod(graphQLClient).data;
3367
- // Local state
3368
- var _b = useState(false), showModal = _b[0], setShowModal = _b[1];
3369
- var _c = useState(false), isSaving = _c[0], setIsSaving = _c[1];
3370
- // Queries
3371
- useQuery({
3372
- queryKey: QueryKeyFactory.default.currentUserKey,
3373
- queryFn: function () { return getCurrentUserData({ token: token, subdomain: subdomain }); },
3526
+ };
3527
+
3528
+ var Text$7 = Typography.Text;
3529
+ var TransactionsListMobile = function (_a) {
3530
+ var transactions = _a.transactions, onTransactionClick = _a.onTransactionClick;
3531
+ var columns = useContext(TransactionsListContext).columns;
3532
+ var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, darkMode = _b.darkMode;
3533
+ var showAmount = columns.includes("amount");
3534
+ var showDateAndTitle = columns.includes("date-and-title");
3535
+ var showDownload = columns.includes("download");
3536
+ var showState = columns.includes("state");
3537
+ if ((transactions === null || transactions === void 0 ? void 0 : transactions.length) === 0)
3538
+ return jsx(TransactionsEmptyState, {});
3539
+ return transactions === null || transactions === void 0 ? void 0 : transactions.map(function (transaction, index) {
3540
+ var isClickable = transaction.kind === "INVOICE";
3541
+ return (jsxs("div", __assign({ className: "contents ".concat(isClickable && "cursor-pointer", " show-on-hover-container"), onClick: function () {
3542
+ onTransactionClick(transaction);
3543
+ }, style: {
3544
+ backgroundColor: index % 2 === 0
3545
+ ? "var(--row-background".concat(darkMode ? "-dark" : "", ")")
3546
+ : "var(--row-background-alternate".concat(darkMode ? "-dark" : "", ")"),
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));
3374
3548
  });
3375
- 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); });
3376
- var onClickRemove = function () {
3377
- if (data && plugin) {
3378
- invokePlugin({
3379
- plugin: plugin,
3549
+ };
3550
+
3551
+ function Transactions(_a) {
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 ? [
3553
+ TransactionKind.INVOICE,
3554
+ TransactionKind.PAYMENT,
3555
+ TransactionKind.REFUND,
3556
+ TransactionKind.WRITE_OFF,
3557
+ ] : _h, style = _a.style, filter = _a.filter, noTransactionsMessage = _a.noTransactionsMessage, entityId = _a.entityId;
3558
+ var contextValues = {
3559
+ showSearchBar: showSearchBar,
3560
+ showTitle: showTitle,
3561
+ transactionComponent: transactionComponent,
3562
+ columns: columns,
3563
+ className: className,
3564
+ searchBarClassName: searchBarClassName,
3565
+ shadow: shadow,
3566
+ useModal: useModal,
3567
+ onTransactionClick: onTransactionClick,
3568
+ suppressTransactionDisplay: suppressTransactionDisplay,
3569
+ kindsToShow: kindsToShow,
3570
+ style: style,
3571
+ filter: filter,
3572
+ noTransactionsMessage: noTransactionsMessage,
3573
+ entityId: entityId,
3574
+ };
3575
+ return (jsx(TransactionsListContext.Provider, __assign({ value: contextValues }, { children: jsx(TransactionsWrapper, {}) })));
3576
+ }
3577
+ function TransactionsWrapper() {
3578
+ var _a = useContext(TransactionsListContext), kindsToShow = _a.kindsToShow, filterFromContext = _a.filter;
3579
+ var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
3580
+ // Local state
3581
+ var _c = useState(""), search = _c[0], setSearch = _c[1];
3582
+ var filter = filterFromContext ||
3583
+ (search ? "filter: \"transaction.transactionableId is ".concat(search, "\"") : "");
3584
+ // Queries
3585
+ var data = useQuery({
3586
+ queryKey: ["transactions", token, filter],
3587
+ queryFn: function () { return getTransactions(filter, token, apiHost, kindsToShow); },
3588
+ placeholderData: keepPreviousData,
3589
+ }).data;
3590
+ return (jsx(TransactionsDisplay, { transactions: data, onSearchValueChanged: setSearch, search: search }));
3591
+ }
3592
+ function TransactionsDisplay(_a) {
3593
+ var transactions = _a.transactions, onSearchValueChanged = _a.onSearchValueChanged, search = _a.search, title = _a.title;
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;
3595
+ var columns = useContext(TransactionsListContext).columns;
3596
+ var darkMode = useContext(BunnyContext).darkMode;
3597
+ // Local state
3598
+ var _c = useState(null), selectedTransaction = _c[0], setSelectedTransaction = _c[1];
3599
+ var _d = useState(false), drawerOpen = _d[0], setDrawerOpen = _d[1];
3600
+ // Hooks
3601
+ var isMobile = useIsMobile(window);
3602
+ function handleTransactionClick(transaction) {
3603
+ if (onTransactionClick) {
3604
+ onTransactionClick(transaction);
3605
+ }
3606
+ if (!suppressTransactionDisplay) {
3607
+ setSelectedTransaction(transaction);
3608
+ setDrawerOpen(true);
3609
+ }
3610
+ }
3611
+ // Since the columns are dynamic, we need to calculate the grid template columns
3612
+ var gridTemplateColumns = function () {
3613
+ var templateColumns = [];
3614
+ if (isMobile) {
3615
+ if (columns.includes("date-and-title") ||
3616
+ columns.includes("state") ||
3617
+ columns.includes("amount")) {
3618
+ templateColumns.push("auto");
3619
+ }
3620
+ if (columns.includes("download")) {
3621
+ templateColumns.push("auto");
3622
+ }
3623
+ }
3624
+ else {
3625
+ if (columns.includes("date-and-title")) {
3626
+ templateColumns.push("auto 3fr");
3627
+ }
3628
+ if (columns.includes("download")) {
3629
+ templateColumns.push("auto");
3630
+ }
3631
+ if (columns.includes("state")) {
3632
+ templateColumns.push("auto");
3633
+ }
3634
+ if (columns.includes("amount")) {
3635
+ templateColumns.push("auto");
3636
+ }
3637
+ }
3638
+ return templateColumns.join(" ");
3639
+ };
3640
+ var drawerTitle = function () {
3641
+ if (!selectedTransaction)
3642
+ return "";
3643
+ var kind = selectedTransaction.kind.toLowerCase();
3644
+ return kind.charAt(0).toUpperCase() + kind.slice(1);
3645
+ };
3646
+ return (jsxs("div", __assign({ style: style }, { children: [jsx(PageHeaderWithActions, __assign({ title: title || (showTitle ? "Past transactions" : undefined) }, { children: showSearchBar && (jsx("div", { children: jsx(Input, { className: searchBarClassName
3647
+ ? searchBarClassName
3648
+ : "border border-slate-200", onChange: function (e) {
3649
+ if (isNaN(Number(e.target.value))) {
3650
+ return;
3651
+ }
3652
+ onSearchValueChanged(e.target.value);
3653
+ }, prefix: jsx(SearchOutlined$1, {}), placeholder: "Search by id #", style: {
3654
+ minWidth: "300px",
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: {
3656
+ gridTemplateColumns: gridTemplateColumns(),
3657
+ backgroundColor: "var(--row-background".concat(darkMode ? "-dark" : "", ")"),
3658
+ } }, { children: isMobile ? (jsx(Fragment, { children: TransactionsListMobile({
3659
+ transactions: transactions,
3660
+ onTransactionClick: handleTransactionClick,
3661
+ }) })) : (jsx(Fragment, { children: TransactionsListDesktop({
3662
+ transactions: transactions,
3663
+ onTransactionClick: handleTransactionClick,
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 })] })] }))) })))] })));
3665
+ }
3666
+
3667
+ function Quotes(_a) {
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;
3670
+ var _j = useState(null), component = _j[0], setComponent = _j[1];
3671
+ var contextValues = {
3672
+ columns: columns,
3673
+ kindsToShow: [],
3674
+ onTransactionClick: handleQuoteClick,
3675
+ transactionComponent: component,
3676
+ showSearchBar: showSearchBar,
3677
+ showTitle: showTitle,
3678
+ className: className,
3679
+ shadow: shadow,
3680
+ searchBarClassName: searchBarClassName,
3681
+ useModal: useModal,
3682
+ suppressTransactionDisplay: suppressQuoteDisplay,
3683
+ style: style,
3684
+ noTransactionsMessage: noQuotesMessage,
3685
+ filter: filter,
3686
+ downloadTransactionLink: function (id) { return "".concat(apiHost, "/api/pdf/quote/").concat(id); },
3687
+ entityId: entityId,
3688
+ };
3689
+ function handleQuoteClick(quote) {
3690
+ if (quoteComponent) {
3691
+ setComponent(quoteComponent);
3692
+ }
3693
+ else {
3694
+ setComponent(jsx(Quote, { entityId: entityId, id: quote === null || quote === void 0 ? void 0 : quote.transactionableId }));
3695
+ }
3696
+ }
3697
+ return (jsx(TransactionsListContext.Provider, __assign({ value: contextValues }, { children: jsx(QuotesWrapper, {}) })));
3698
+ }
3699
+ function QuotesWrapper() {
3700
+ var _a = useContext(BunnyContext), token = _a.token, apiHost = _a.apiHost;
3701
+ var filterFromContext = useContext(TransactionsListContext).filter;
3702
+ // Local state
3703
+ var _b = useState(""), search = _b[0], setSearch = _b[1];
3704
+ var filter = filterFromContext || (search ? "filter: \"quote.id is ".concat(search, "\"") : "");
3705
+ // Queries
3706
+ var data = useQuery({
3707
+ queryKey: ["quotes", token, filter],
3708
+ queryFn: function () { return getQuotes({ token: token, apiHost: apiHost, filter: filter }); },
3709
+ placeholderData: keepPreviousData,
3710
+ }).data;
3711
+ if (data === undefined)
3712
+ return null;
3713
+ var quotesAsTransactions = data.nodes.map(function (quote) { return ({
3714
+ transactionableId: quote.id,
3715
+ state: "unapplied",
3716
+ amount: quote.amount || quote.amountDue,
3717
+ kind: "QUOTE",
3718
+ currencyId: quote.currencyId,
3719
+ transactionable: {
3720
+ number: quote.number,
3721
+ },
3722
+ createdAt: quote.createdAt,
3723
+ }); });
3724
+ return (jsx(TransactionsDisplay, { transactions: quotesAsTransactions, onSearchValueChanged: setSearch, search: search, title: "Past quotes" }));
3725
+ }
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
+
3730
+ var DrawerHeader = function (_a) {
3731
+ var description = _a.description, onClose = _a.onClose, title = _a.title;
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 }))] })));
3733
+ };
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
+
3743
+ var LargeCardIcon = function () {
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" }) })));
3745
+ };
3746
+
3747
+ var PlusIcon = function (_a) {
3748
+ var color = _a.color;
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" })] })));
3750
+ };
3751
+
3752
+ var Text$6 = Typography.Text;
3753
+ var CreditCard = function (_a) {
3754
+ var _b, _c, _d;
3755
+ var onClickRemove = _a.onClickRemove, onClickUpdate = _a.onClickUpdate, paymentMethodData = _a.paymentMethodData;
3756
+ var isExpired = function (paymentMethodData) {
3757
+ // paymentMethodData.expirationDate
3758
+ var expDate = dayjs(paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.expirationDate);
3759
+ return expDate.isBefore(dayjs());
3760
+ };
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 }))] }))] }))] })));
3764
+ };
3765
+ var CardAttribute = function (_a) {
3766
+ var title = _a.title, value = _a.value;
3767
+ return (jsxs("div", __assign({ className: "flex flex-col gap-2" }, { children: [jsx("div", __assign({ className: "text-slate-400", style: { fontSize: "11px" } }, { children: title })), jsx(Text$6, { children: value })] })));
3768
+ };
3769
+ var CardActions = function (_a) {
3770
+ var onClickRemove = _a.onClickRemove, onClickUpdate = _a.onClickUpdate;
3771
+ var isMobile = useIsMobile(window);
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" }))] })));
3773
+ };
3774
+ var EmptyCard = function (_a) {
3775
+ var onClick = _a.onClick;
3776
+ var brandColor = useContext(BrandContext).brandColor;
3777
+ return (jsxs("div", __assign({ className: "flex flex-col items-center justify-center w-full pt-8 px-4 pb-6 cursor-pointer bg-white shadow-md rounded-md", onClick: onClick }, { children: [jsx(LargeCardIcon, {}), jsx("div", __assign({ className: "text-slate-400 pt-4 pb-8" }, { children: "No payment methods" })), jsx(Button, __assign({ type: "link" }, { children: jsxs("div", __assign({ className: "flex items-center gap-1" }, { children: [jsx(PlusIcon, { color: brandColor }), "Add payment method"] })) }))] })));
3778
+ };
3779
+ var getCardImage = function (issuer) {
3780
+ if (issuer === "visa")
3781
+ return "Visa_Brandmark_Blue_RGB_2021.png";
3782
+ else if (issuer === "mastercard")
3783
+ return "mc_symbol_opt_73_3x.png";
3784
+ };
3785
+
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;
3791
+ var accountId = useContext(PaymentContext).accountId;
3792
+ // Hooks
3793
+ var queryClient = useQueryClient();
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);
3802
+ var data = usePaymentMethod(graphQLClient).data;
3803
+ // Local state
3804
+ var _c = useState(false), showModal = _c[0], setShowModal = _c[1];
3805
+ var _d = useState(false), isSaving = _d[0], setIsSaving = _d[1];
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); });
3807
+ var onClickRemove = function () {
3808
+ if (data && plugin) {
3809
+ invokePlugin({
3810
+ plugin: plugin,
3380
3811
  method: "remove_payment_method",
3381
3812
  payload: {
3382
3813
  payment_method_id: data.id,
3383
3814
  account_id: accountId,
3384
3815
  },
3385
3816
  token: token,
3386
- subdomain: subdomain,
3817
+ apiHost: apiHost,
3387
3818
  })
3388
3819
  .then(function () {
3389
3820
  showSuccessNotification("Payment method was removed", "Success");
@@ -3410,7 +3841,7 @@ var ActualPaymentMethod = function () {
3410
3841
  }
3411
3842
  : {},
3412
3843
  wrapper: isMobile ? { width: "100vw" } : { width: "min-content" },
3413
- }, 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) {
3414
3845
  handleAllErrorFormats(error);
3415
3846
  setIsSaving(false);
3416
3847
  }, onPaymentSuccess: function () {
@@ -3419,13 +3850,56 @@ var ActualPaymentMethod = function () {
3419
3850
  }, setIsSaving: setIsSaving }) }))] }));
3420
3851
  };
3421
3852
  function PaymentMethod(_a) {
3422
- var footer = _a.footer, processPublicUrl = _a.processPublicUrl;
3423
- 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 }) })));
3424
3855
  }
3425
3856
 
3426
- 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";
3427
3901
  var accountUpdate = function (_a) {
3428
- var accountId = _a.accountId, attributes = _a.attributes, token = _a.token;
3902
+ var accountId = _a.accountId, attributes = _a.attributes, token = _a.token, apiHost = _a.apiHost;
3429
3903
  return __awaiter(void 0, void 0, void 0, function () {
3430
3904
  var vars, response, errors;
3431
3905
  var _b;
@@ -3433,7 +3907,12 @@ var accountUpdate = function (_a) {
3433
3907
  switch (_c.label) {
3434
3908
  case 0:
3435
3909
  vars = { id: accountId, attributes: attributes };
3436
- 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
+ })];
3437
3916
  case 1:
3438
3917
  response = _c.sent();
3439
3918
  errors = (_b = response === null || response === void 0 ? void 0 : response.accountUpdate) === null || _b === void 0 ? void 0 : _b.errors;
@@ -3450,10 +3929,10 @@ var TaxationForm = function (_a) {
3450
3929
  var account = _a.account, quote = _a.quote;
3451
3930
  // Hooks
3452
3931
  var queryClient = useQueryClient();
3453
- var token = useContext(BunnyContext).token;
3932
+ var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
3454
3933
  var form = Form.useForm()[0];
3455
3934
  // Mutations
3456
- var _b = useMutation({
3935
+ var _c = useMutation({
3457
3936
  mutationFn: function (changedFormData) { return __awaiter(void 0, void 0, void 0, function () {
3458
3937
  var account;
3459
3938
  return __generator(this, function (_a) {
@@ -3462,6 +3941,7 @@ var TaxationForm = function (_a) {
3462
3941
  accountId: quote.accountId,
3463
3942
  attributes: changedFormData,
3464
3943
  token: token,
3944
+ apiHost: apiHost,
3465
3945
  })];
3466
3946
  case 1:
3467
3947
  account = _a.sent();
@@ -3474,7 +3954,7 @@ var TaxationForm = function (_a) {
3474
3954
  queryKey: ["getTaxationRequiredAccountFields", token],
3475
3955
  });
3476
3956
  },
3477
- }), updateAccount = _b.mutate, isUpdatingAccount = _b.isPending;
3957
+ }), updateAccount = _c.mutate, isUpdatingAccount = _c.isPending;
3478
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) {
3479
3959
  var _a, _b;
3480
3960
  return ((_a = option === null || option === void 0 ? void 0 : option.label) !== null && _a !== void 0 ? _a : "").toLowerCase().includes(input.toLowerCase()) ||
@@ -3489,10 +3969,10 @@ var FormBillingState = function (_a) {
3489
3969
  };
3490
3970
 
3491
3971
  var QuoteCheckout = function (_a) {
3492
- 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;
3493
3973
  // Context
3494
- var isMobile = useIsMobile$1();
3495
- 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;
3496
3976
  var paymentRequired = getQuoteAmountDue(quote) > 0;
3497
3977
  var checkoutMutation = useMutation({
3498
3978
  mutationFn: function (_a) {
@@ -3500,14 +3980,14 @@ var QuoteCheckout = function (_a) {
3500
3980
  if (!quote)
3501
3981
  throw new Error("Quote is required");
3502
3982
  if (!paymentRequired)
3503
- return checkout({ quoteId: quote.id, token: token, subdomain: subdomain });
3983
+ return checkout({ quoteId: quote.id, token: token, apiHost: apiHost });
3504
3984
  if (savedPaymentMethod) {
3505
3985
  var paymentMethodId = savedPaymentMethod.paymentMethodId;
3506
3986
  return checkout({
3507
3987
  quoteId: quote.id,
3508
3988
  paymentMethodId: paymentMethodId,
3509
3989
  token: token,
3510
- subdomain: subdomain,
3990
+ apiHost: apiHost,
3511
3991
  });
3512
3992
  }
3513
3993
  if (pluginPaymentMethod) {
@@ -3522,7 +4002,7 @@ var QuoteCheckout = function (_a) {
3522
4002
  token: paymentToken,
3523
4003
  },
3524
4004
  token: token,
3525
- subdomain: subdomain,
4005
+ apiHost: apiHost,
3526
4006
  });
3527
4007
  }
3528
4008
  throw new Error("Pay payment method provided");
@@ -3564,82 +4044,64 @@ var QuoteCheckout = function (_a) {
3564
4044
  };
3565
4045
  if (taxationRequiredAccountFields)
3566
4046
  return (jsx(PaymentFormWrapper, __assign({ setMaxHeight: false }, { children: jsx(TaxationForm, { account: account, quote: quote }) })));
3567
- 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 () {
3568
4048
  setIsSaving(true);
3569
4049
  handleCheckout({});
3570
4050
  }, type: "primary" }, { children: isSaving ? "Processing..." : "Complete order" })), jsx("div", __assign({ className: "text-xs text-slate-500" }, { children: "No payment is required" }))] })) }))) }));
3571
4051
  };
3572
4052
 
3573
- var useHasTaxPlugin = function (_a) {
3574
- var subdomain = _a.subdomain, token = _a.token;
3575
- var plugins = usePlugins({
3576
- subdomain: subdomain,
3577
- token: token,
3578
- }).data;
3579
- return Boolean(plugins === null || plugins === void 0 ? void 0 : plugins.some(function (plugin) { return plugin.type === "taxation"; }));
3580
- };
3581
-
3582
- 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}";
3583
-
3584
- var QUOTE_RECALCULATE_TAXES = "\n mutation QuoteRecalculateTaxes($id: ID!) {\n quoteRecalculateTaxes(id: $id) {\n ".concat(QUOTE_FIELDS, "\n errors\n }\n }\n");
3585
- var quoteRecalculateTaxes = function (_a) {
3586
- 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;
3587
4056
  return __awaiter(void 0, void 0, void 0, function () {
3588
- var vars, response, errors;
4057
+ var response;
3589
4058
  var _b, _c;
3590
4059
  return __generator(this, function (_d) {
3591
4060
  switch (_d.label) {
3592
- case 0:
3593
- vars = { id: quoteId };
3594
- return [4 /*yield*/, gqlRequest({
3595
- query: QUOTE_RECALCULATE_TAXES,
3596
- token: token,
3597
- vars: vars,
3598
- })];
4061
+ case 0: return [4 /*yield*/, gqlRequest({
4062
+ query: MUTATION$5,
4063
+ token: token,
4064
+ apiHost: apiHost,
4065
+ })];
3599
4066
  case 1:
3600
4067
  response = _d.sent();
3601
- errors = (_b = response === null || response === void 0 ? void 0 : response.quoteRecalculateTaxes) === null || _b === void 0 ? void 0 : _b.errors;
3602
- if (errors)
3603
- throw errors;
3604
- 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];
3605
4072
  }
3606
4073
  });
3607
4074
  });
3608
4075
  };
3609
4076
 
3610
- var planPickerQuoteDataState = atom({
3611
- key: "planPickerQuoteDataState",
3612
- default: undefined,
3613
- });
3614
-
3615
- var pageWrapperClassName = function (isMobile) {
3616
- return "flex flex-col grow pt-4 ".concat(isMobile ? "pb-4 overflow-hidden" : "pb-8", " ").concat("content-container");
3617
- };
3618
-
3619
4077
  var queryKeyFactory = QueryKeyFactory.default;
3620
4078
  var Checkout = function (_a) {
3621
4079
  var _b, _c;
3622
- 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;
3623
- var subdomain = useContext(BunnyContext).subdomain;
3624
- var _d = useState(false), isSaving = _d[0], setIsSaving = _d[1];
3625
- 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
+ });
3626
4089
  var queryClient = useQueryClient();
3627
- var quotePreviewData = useRecoilValue(planPickerQuoteDataState);
3628
4090
  // Queries
3629
- var _e = useQuery({
4091
+ var _g = useQuery({
3630
4092
  queryKey: ["getTaxationRequiredAccountFields", token],
3631
- queryFn: function () { return getTaxationRequiredAccountFields({ token: token }); },
4093
+ queryFn: function () { return getTaxationRequiredAccountFields({ token: token, apiHost: apiHost }); },
3632
4094
  enabled: Boolean(quote),
3633
4095
  staleTime: 0,
3634
- }), taxationRequiredAccountFields = _e.data, isLoadingTaxationRequiredAccountFields = _e.isLoading;
3635
- var _f = useQuery({
4096
+ }), taxationRequiredAccountFields = _g.data, isLoadingTaxationRequiredAccountFields = _g.isLoading;
4097
+ var _h = useQuery({
3636
4098
  queryKey: ["account", quote === null || quote === void 0 ? void 0 : quote.accountId],
3637
4099
  queryFn: function () {
3638
- 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 });
3639
4101
  },
3640
4102
  enabled: Boolean(quote === null || quote === void 0 ? void 0 : quote.accountId) &&
3641
4103
  ((taxationRequiredAccountFields === null || taxationRequiredAccountFields === void 0 ? void 0 : taxationRequiredAccountFields.length) || 0) > 0,
3642
- }), account = _f.data, isLoadingAccount = _f.isLoading;
4104
+ }), account = _h.data, isLoadingAccount = _h.isLoading;
3643
4105
  useQuery({
3644
4106
  queryKey: queryKeyFactory.createQuoteTaxCalculateKey(quote === null || quote === void 0 ? void 0 : quote.id),
3645
4107
  queryFn: function () { return __awaiter(void 0, void 0, void 0, function () {
@@ -3651,12 +4113,13 @@ var Checkout = function (_a) {
3651
4113
  return [4 /*yield*/, quoteRecalculateTaxes({
3652
4114
  quoteId: quote.id,
3653
4115
  token: token,
4116
+ apiHost: apiHost,
3654
4117
  })];
3655
4118
  case 1:
3656
4119
  updatedQuote = _a.sent();
3657
4120
  if (updatedQuote) {
3658
4121
  queryClient.setQueryData(queryKeyFactory.createObjectKey("editingQuote", updatedQuote.id), updatedQuote);
3659
- 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);
3660
4123
  }
3661
4124
  _a.label = 2;
3662
4125
  case 2: return [2 /*return*/, {}];
@@ -3675,21 +4138,21 @@ var Checkout = function (_a) {
3675
4138
  return null;
3676
4139
  return (jsx("div", __assign({ className: "flex flex-col fixed top-0 left-0 right-0 bottom-0 bg-slate-50 overflow-auto", style: {
3677
4140
  zIndex: 1001,
3678
- } }, { 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) {
3679
4142
  onFail(error);
3680
4143
  setIsSaving(false);
3681
4144
  }, onSuccess: function (_a) {
3682
4145
  var savePaymentMethod = _a.savePaymentMethod;
3683
4146
  onSuccess({ savePaymentMethod: savePaymentMethod });
3684
4147
  setIsSaving(false);
3685
- }, 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) {
3686
4149
  onFail(error);
3687
4150
  setIsSaving(false);
3688
4151
  }, onSuccess: function (_a) {
3689
4152
  var savePaymentMethod = _a.savePaymentMethod;
3690
4153
  onSuccess({ savePaymentMethod: savePaymentMethod });
3691
4154
  setIsSaving(false);
3692
- }, 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) {
3693
4156
  onFail(error);
3694
4157
  setIsSaving(false);
3695
4158
  }, onPaymentSuccess: function (_a) {
@@ -3703,7 +4166,7 @@ var Checkout = function (_a) {
3703
4166
 
3704
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}"; };
3705
4168
  var accountSignup = function (_a) {
3706
- 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;
3707
4170
  return __awaiter(void 0, void 0, void 0, function () {
3708
4171
  var vars, response, errors;
3709
4172
  var _b;
@@ -3723,7 +4186,7 @@ var accountSignup = function (_a) {
3723
4186
  query: MUTATION$4(),
3724
4187
  token: token,
3725
4188
  vars: vars,
3726
- subdomain: subdomain,
4189
+ apiHost: apiHost,
3727
4190
  })];
3728
4191
  case 1:
3729
4192
  response = _c.sent();
@@ -3738,7 +4201,7 @@ var accountSignup = function (_a) {
3738
4201
 
3739
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}"; };
3740
4203
  var quoteAccountSignup = function (_a) {
3741
- 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;
3742
4205
  return __awaiter(void 0, void 0, void 0, function () {
3743
4206
  var vars, response, errors;
3744
4207
  var _b;
@@ -3755,7 +4218,7 @@ var quoteAccountSignup = function (_a) {
3755
4218
  query: MUTATION$3(),
3756
4219
  token: token,
3757
4220
  vars: vars,
3758
- subdomain: subdomain,
4221
+ apiHost: apiHost,
3759
4222
  })];
3760
4223
  case 1:
3761
4224
  response = _c.sent();
@@ -3770,7 +4233,7 @@ var quoteAccountSignup = function (_a) {
3770
4233
 
3771
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}"; };
3772
4235
  var getPriceList = function (_a) {
3773
- var token = _a.token, code = _a.code, subdomain = _a.subdomain;
4236
+ var token = _a.token, code = _a.code, apiHost = _a.apiHost;
3774
4237
  return __awaiter(void 0, void 0, void 0, function () {
3775
4238
  var response;
3776
4239
  return __generator(this, function (_b) {
@@ -3779,7 +4242,7 @@ var getPriceList = function (_a) {
3779
4242
  query: MUTATION$2(),
3780
4243
  token: token,
3781
4244
  vars: { code: code },
3782
- subdomain: subdomain,
4245
+ apiHost: apiHost,
3783
4246
  })];
3784
4247
  case 1:
3785
4248
  response = _b.sent();
@@ -3790,8 +4253,8 @@ var getPriceList = function (_a) {
3790
4253
  };
3791
4254
 
3792
4255
  function PaymentForms(_a) {
3793
- 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;
3794
- 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 })) }));
3795
4258
  }
3796
4259
  function InitialSignupForm(_a) {
3797
4260
  var onSubmit = _a.onSubmit, submitting = _a.submitting;
@@ -3826,898 +4289,166 @@ function InitialSignupForm(_a) {
3826
4289
  } }) }))] })), jsx(Form.Item, { children: jsx(Button, __assign({ type: "primary", htmlType: "submit", loading: submitting, className: "w-full mt-4" }, { children: "Proceed to payment" })) })] })));
3827
4290
  }
3828
4291
 
3829
- var Title = Typography.Title, Text$a = Typography.Text;
4292
+ var Title = Typography.Title, Text$5 = Typography.Text;
3830
4293
  function PaymentSuccessDisplay(_a) {
3831
- 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;
3832
4295
  var window = useContext(BunnyContext).window;
3833
- var companyName = useCurrentUserData().companyName;
3834
- 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$a, __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] })))] })));
3835
4297
  }
3836
4298
 
3837
- var Text$9 = Typography.Text;
4299
+ var Text$4 = Typography.Text;
3838
4300
  function PriceListDisplay(_a) {
3839
4301
  var priceListData = _a.priceListData, topNavImageUrl = _a.topNavImageUrl;
3840
4302
  if (!priceListData)
3841
4303
  return null;
3842
- 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$9, __assign({ className: "text-slate-500 font-bold text-lg" }, { children: priceListData.name })), jsxs(Text$9, __assign({ className: "font-bold text-xl" }, { children: [Misc.formatCurrency(priceListData.basePrice, priceListData.currencyId), " ", "/ month"] }))] })), jsxs("div", __assign({ className: "flex flex-col" }, { children: [jsxs(Text$9, __assign({ style: { fontSize: "16px" }, className: "text-slate-500" }, { children: [priceListData.trialLengthDays, " day trial"] })), jsx(Text$9, __assign({ className: "text-slate-500", style: { fontSize: "12px" } }, { children: "You will not be charged until the last day of the trial." }))] }))] })) })) }));
3843
- }
3844
-
3845
- var BunnyFooterIcon = function (_a) {
3846
- var color = _a.color;
3847
- 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" }) })) })] })));
3848
- };
3849
-
3850
- var Footer = function (_a) {
3851
- var className = _a.className;
3852
- var _b = useCurrentUserData(), privacyUrl = _b.privacyUrl, termsUrl = _b.termsUrl;
3853
- var window = useContext(BunnyContext).window;
3854
- var isMobile = useIsMobile(window);
3855
- var quotePreviewData = useRecoilValue(planPickerQuoteDataState);
3856
- var selectedPriceList = quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.priceList;
3857
- if (selectedPriceList && isMobile)
3858
- return null;
3859
- 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, {})] })));
3860
- };
3861
- var BunnyMarketingLink = function () {
3862
- var _a = useState(false), isHovered = _a[0], setIsHovered = _a[1];
3863
- var window = useContext(BunnyContext).window;
3864
- var isMobile = useIsMobile(window);
3865
- 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 }) }))] })) })) })));
3866
- };
3867
- var StyedLink = styled.a(templateObject_1$4 || (templateObject_1$4 = __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);
3868
- 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);
3869
- var templateObject_1$4, templateObject_2;
3870
-
3871
- 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";
3872
- var portalSessionCreate = function (_a) {
3873
- var tenantCode = _a.tenantCode, expiry = _a.expiry, returnUrl = _a.returnUrl, token = _a.token, subdomain = _a.subdomain;
3874
- return __awaiter(void 0, void 0, void 0, function () {
3875
- var response, errors;
3876
- var _b;
3877
- return __generator(this, function (_c) {
3878
- switch (_c.label) {
3879
- case 0: return [4 /*yield*/, gqlRequest({
3880
- query: MUTATION$1,
3881
- token: token,
3882
- vars: { tenantCode: tenantCode, expiry: expiry, returnUrl: returnUrl },
3883
- subdomain: subdomain,
3884
- })];
3885
- case 1:
3886
- response = _c.sent();
3887
- errors = (response === null || response === void 0 ? void 0 : response.portalSessionCreate).errors;
3888
- if (errors)
3889
- throw errors;
3890
- return [2 /*return*/, (_b = response === null || response === void 0 ? void 0 : response.portalSessionCreate) === null || _b === void 0 ? void 0 : _b.token];
3891
- }
3892
- });
3893
- });
3894
- };
3895
-
3896
- var showErrorNotification = NotificationUtils.useErrorNotification();
3897
- function Signup(_a) {
3898
- var priceListCode = _a.priceListCode, returnUrl = _a.returnUrl;
3899
- // Hooks
3900
- var _b = useContext(BunnyContext), subdomain = _b.subdomain, token = _b.token, window = _b.window;
3901
- useQuery({
3902
- queryKey: QueryKeyFactory.default.currentUserKey,
3903
- queryFn: function () { return getCurrentUserData({ token: token, subdomain: subdomain }); },
3904
- });
3905
- var isMobile = useIsMobile(window);
3906
- var topNavImageUrl = useContext(BrandContext).topNavImageUrl;
3907
- var entityId = useCurrentUserData().entityId;
3908
- var _c = useState(undefined), quote = _c[0], setQuote = _c[1];
3909
- var _d = useState(undefined), accountId = _d[0], setAccountId = _d[1];
3910
- var _e = useState(undefined), quoteId = _e[0], setQuoteId = _e[1];
3911
- var _f = useState(undefined), portalSessionToken = _f[0], setPortalSessionToken = _f[1];
3912
- var _g = useState(undefined), formData = _g[0], setFormData = _g[1];
3913
- var _h = useState(false), proceedingToPayment = _h[0], setProceedingToPayment = _h[1];
3914
- var _j = useState(false), paying = _j[0], setIsPaying = _j[1];
3915
- var _k = useState(false), purchaseSucceeded = _k[0], setPurchaseSucceeded = _k[1];
3916
- // Queries
3917
- var priceListData = useQuery({
3918
- queryKey: ["priceList", priceListCode],
3919
- queryFn: function () { return getPriceList({ token: token, subdomain: subdomain, code: priceListCode }); },
3920
- }).data;
3921
- function handleSubmit(formData) {
3922
- return __awaiter(this, void 0, void 0, function () {
3923
- var data, portalSessionToken;
3924
- return __generator(this, function (_a) {
3925
- switch (_a.label) {
3926
- case 0:
3927
- setProceedingToPayment(true);
3928
- setFormData(formData);
3929
- return [4 /*yield*/, quoteAccountSignup({
3930
- token: token,
3931
- subdomain: subdomain,
3932
- entityId: entityId,
3933
- priceListCode: priceListCode,
3934
- accountName: formData.accountName,
3935
- billingContact: {
3936
- firstName: formData.firstName,
3937
- lastName: formData.lastName,
3938
- email: formData.email,
3939
- },
3940
- })];
3941
- case 1:
3942
- data = _a.sent();
3943
- setAccountId(data.account.id);
3944
- return [4 /*yield*/, portalSessionCreate({
3945
- token: token,
3946
- subdomain: subdomain,
3947
- tenantCode: data.tenant.code,
3948
- expiry: 24,
3949
- returnUrl: returnUrl || "",
3950
- })];
3951
- case 2:
3952
- portalSessionToken = _a.sent();
3953
- setPortalSessionToken(portalSessionToken);
3954
- setQuoteId(data.quote.id);
3955
- setProceedingToPayment(false);
3956
- setQuote({
3957
- amountDue: data.quote.amountDue,
3958
- currencyId: data.quote.currencyId,
3959
- });
3960
- return [2 /*return*/];
3961
- }
3962
- });
3963
- });
3964
- }
3965
- function handlePaymentSaveSuccess(paymentSuccess) {
3966
- var _a;
3967
- return __awaiter(this, void 0, void 0, function () {
3968
- var response, plugin;
3969
- return __generator(this, function (_b) {
3970
- switch (_b.label) {
3971
- case 0:
3972
- if (!formData) {
3973
- throw new Error("Form data is required");
3974
- }
3975
- response = paymentSuccess.pluginPaymentResponse;
3976
- plugin = response === null || response === void 0 ? void 0 : response.plugin;
3977
- if (!(plugin === null || plugin === void 0 ? void 0 : plugin.id)) {
3978
- throw new Error("Plugin ID is required");
3979
- }
3980
- if (!accountId) {
3981
- throw new Error("Account ID is required");
3982
- }
3983
- if (!portalSessionToken) {
3984
- throw new Error("Portal session token is required");
3985
- }
3986
- return [4 /*yield*/, accountSignup({
3987
- token: portalSessionToken,
3988
- subdomain: subdomain,
3989
- entityId: entityId,
3990
- quoteId: quoteId,
3991
- paymentMethodId: (_a = paymentSuccess.savedPaymentMethodResponse) === null || _a === void 0 ? void 0 : _a.paymentMethodId.toString(),
3992
- pluginId: plugin.id.toString(),
3993
- priceListCode: priceListCode,
3994
- accountId: accountId,
3995
- })];
3996
- case 1:
3997
- _b.sent();
3998
- setIsPaying(false);
3999
- setPurchaseSucceeded(true);
4000
- return [2 /*return*/];
4001
- }
4002
- });
4003
- });
4004
- }
4005
- function handlePaymentFail(error) {
4006
- showErrorNotification(error.message);
4007
- setIsPaying(false);
4008
- }
4009
- if (isMobile) {
4010
- 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 || "" }) }))] }))) })));
4011
- }
4012
- else {
4013
- 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, {})] }));
4014
- }
4015
- }
4016
-
4017
- 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}"); };
4018
- var getTransactions = function (filter, token, subdomain, kindsToShow) { return __awaiter(void 0, void 0, void 0, function () {
4019
- var response, _a, data, errors, transactions;
4020
- var _b, _c;
4021
- return __generator(this, function (_d) {
4022
- switch (_d.label) {
4023
- case 0: return [4 /*yield*/, fetch(subdomain + "/graphql", {
4024
- method: "POST",
4025
- headers: {
4026
- "Content-type": "application/json; charset=utf-8",
4027
- Authorization: "Bearer ".concat(token),
4028
- },
4029
- body: JSON.stringify({
4030
- query: transactionMutation(filter),
4031
- }),
4032
- })];
4033
- case 1:
4034
- response = _d.sent();
4035
- return [4 /*yield*/, response.json()];
4036
- case 2:
4037
- _a = _d.sent(), data = _a.data, errors = _a.errors;
4038
- if (errors) {
4039
- throw new Error(errors[0].message);
4040
- }
4041
- transactions = (_c = (_b = data === null || data === void 0 ? void 0 : data.transactions) === null || _b === void 0 ? void 0 : _b.nodes) === null || _c === void 0 ? void 0 : _c.filter(function (transaction) { return kindsToShow.includes(transaction.kind); });
4042
- return [2 /*return*/, transactions === null || transactions === void 0 ? void 0 : transactions.reverse()];
4043
- }
4044
- });
4045
- }); };
4046
-
4047
- var pageContentRefState = atom({
4048
- key: "pageContentRefState",
4049
- default: undefined,
4050
- });
4051
-
4052
- var PageContent = function (_a) {
4053
- var children = _a.children, className = _a.className, style = _a.style;
4054
- var pageContentRef = useRef(null);
4055
- var setPageContentRef = useSetRecoilState(pageContentRefState);
4056
- useEffect(function () {
4057
- setPageContentRef(pageContentRef === null || pageContentRef === void 0 ? void 0 : pageContentRef.current);
4058
- }, [pageContentRef, setPageContentRef]);
4059
- return (jsx("div", __assign({ className: className, ref: pageContentRef, style: style }, { children: children })));
4060
- };
4061
-
4062
- var Text$8 = Typography.Text;
4063
- var PageHeaderWithActions = function (_a) {
4064
- var children = _a.children, title = _a.title;
4065
- var isMobile = useIsMobile$1();
4066
- 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] })));
4067
- };
4068
- var PageSubTitle = function (_a) {
4069
- var title = _a.title;
4070
- var secondaryColor = useContext(BrandContext).secondaryColor;
4071
- var darkMode = useContext(BunnyContext).darkMode;
4072
- return (jsx(Text$8, __assign({ className: "shrink-0 font-medium", style: { color: darkMode ? undefined : secondaryColor } }, { children: title })));
4073
- };
4074
-
4075
- var StateTag = function (_a) {
4076
- var state = _a.state;
4077
- return jsx(Tag, __assign({ color: getColor(state) }, { children: capitalize(startCase(state)) }));
4078
- };
4079
- var getColor = function (state) {
4080
- switch (state) {
4081
- case FrontendTransaction.TransactionState.not_due:
4082
- return "yellow";
4083
- case FrontendTransaction.TransactionState.voided:
4084
- return "black";
4085
- case FrontendTransaction.TransactionState.ready:
4086
- return "orange";
4087
- case FrontendTransaction.TransactionState.preparing:
4088
- return "purple";
4089
- case FrontendTransaction.TransactionState.unapplied:
4090
- case FrontendTransaction.TransactionState.partially_applied:
4091
- case FrontendTransaction.TransactionState.applied:
4092
- return "blue";
4093
- case FrontendTransaction.TransactionState.due:
4094
- case FrontendTransaction.TransactionState.unpaid:
4095
- return "orange";
4096
- case FrontendTransaction.TransactionState.failed:
4097
- return "red";
4098
- case FrontendTransaction.TransactionState.paid:
4099
- return "green";
4100
- default:
4101
- return "blue";
4102
- }
4103
- };
4104
-
4105
- var TransactionGridCell = styled.div.withConfig({
4106
- shouldForwardProp: function (prop) {
4107
- return !["gridColumn", "padding", "right"].includes(prop);
4108
- },
4109
- })(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);
4110
- var templateObject_1$3;
4111
-
4112
- var Text$7 = Typography.Text;
4113
- var TransactionDate = function (_a) {
4114
- var date = _a.date;
4115
- return jsx(Text$7, __assign({ className: "text-sm" }, { children: Misc.formatDate(date) }));
4116
- };
4117
-
4118
- var isInvoice = function (transaction) {
4119
- return transaction.kind === "INVOICE";
4120
- };
4121
- var isQuote = function (transaction) {
4122
- return transaction.kind === "QUOTE";
4123
- };
4124
- var TransactionRowTitle = function (_a) {
4125
- var transaction = _a.transaction;
4126
- if (!isInvoice(transaction) && !isQuote(transaction)) {
4127
- return jsx(Fragment, {});
4128
- }
4129
- return (jsx("span", __assign({ className: "text-slate-400", style: { fontSize: "11px" } }, { children: transaction.transactionable.number })));
4130
- };
4131
-
4132
- // TODO: delete
4133
- var ArrowDownToLine = function (_a) {
4134
- var className = _a.className, _b = _a.color, color = _b === void 0 ? SLATE_600 : _b;
4135
- 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" })] })));
4136
- };
4137
-
4138
- var TransactionsListContext = createContext({});
4139
-
4140
- var TransactionDownload = function (_a) {
4141
- var transaction = _a.transaction, token = _a.token, subdomain = _a.subdomain;
4142
- var darkMode = useContext(BunnyContext).darkMode;
4143
- var downloadTransactionLink = useContext(TransactionsListContext).downloadTransactionLink;
4144
- var downloadFile = useDownloadFile();
4145
- var isMobile = useIsMobile$1();
4146
- var isClickable = transaction.kind === "INVOICE" || downloadTransactionLink !== undefined;
4147
- var downloadLink = downloadTransactionLink
4148
- ? downloadTransactionLink(transaction.transactionableId)
4149
- : "".concat(subdomain, "/api/pdf/invoice/").concat(transaction.transactionableId);
4150
- if (!isClickable)
4151
- return null;
4152
- return (jsx("div", __assign({ onClick: function (e) {
4153
- e.stopPropagation();
4154
- downloadFile(downloadLink, token);
4155
- } }, { children: jsx(ArrowDownToLine, { className: "".concat(isMobile ? "" : "show-on-hover"), color: darkMode ? WHITE : SLATE_600 }) })));
4156
- };
4157
-
4158
- var Text$6 = Typography.Text;
4159
- var TransactionsEmptyState = function () {
4160
- var noTransactionsMessage = useContext(TransactionsListContext).noTransactionsMessage;
4161
- return (jsx(Text$6, __assign({ className: "flex justify-center p-4 text-base" }, { children: noTransactionsMessage || "There are no transactions" })));
4162
- };
4163
-
4164
- function capitalizeFirstLetter(string) {
4165
- return string.charAt(0).toUpperCase() + string.slice(1);
4166
- }
4167
- var WARREN_STATE_LS_KEY = "warrenState";
4168
- var CURRENT_WARREN_ID_LS_KEY = "currentWarrenId";
4169
- var getIsCapacitorApp = function () {
4170
- var isAndroid = window.location.origin === "http://localhost";
4171
- var isIOS = window.location.protocol === "capacitor:";
4172
- return isAndroid || isIOS;
4173
- };
4174
- var getLocalStorageSubdomain = function () {
4175
- var warrenState = JSON.parse(window.localStorage.getItem(WARREN_STATE_LS_KEY) || "{}");
4176
- var subdomain = warrenState[CURRENT_WARREN_ID_LS_KEY];
4177
- if (!subdomain) {
4178
- console.warn("ERROR_MESSAGE_NO_SUBDOMAIN_DEFINED");
4179
- //throw new Error(ERROR_MESSAGE_NO_SUBDOMAIN_DEFINED);
4180
- }
4181
- return subdomain;
4182
- };
4183
- var getApiHost = function (subdomain) {
4184
- var isLocalHost = window.location.href.indexOf(".internal") > 0;
4185
- var sub = subdomain || getLocalStorageSubdomain();
4186
- if (getIsCapacitorApp()) {
4187
- return isLocalHost || process.env.REACT_APP_IS_INTERNAL === "true"
4188
- ? "https://".concat(sub, ".bunny.internal")
4189
- : "https://".concat(sub, ".").concat(process.env.REACT_APP_ROOT_DOMAIN);
4190
- }
4191
- return "";
4192
- };
4193
- var getGraphQLBase = function () {
4194
- if (getIsCapacitorApp()) {
4195
- return "".concat(getApiHost(), "/graphql");
4196
- }
4197
- return "/graphql";
4198
- };
4199
- var createRequestHeaders = function (token) {
4200
- var bearerToken = "Bearer ".concat(token);
4201
- var headers = {
4202
- "Content-type": "application/json; charset=utf-8",
4203
- };
4204
- headers["Authorization"] = bearerToken;
4205
- return headers;
4206
- };
4207
- var useGraphQLRequest = function () { return function (query, token, variables) { return __awaiter(void 0, void 0, void 0, function () {
4208
- var error_1;
4209
- return __generator(this, function (_a) {
4210
- switch (_a.label) {
4211
- case 0:
4212
- _a.trys.push([0, 2, , 3]);
4213
- return [4 /*yield*/, request(getGraphQLBase(), query, variables, createRequestHeaders(token))];
4214
- case 1: return [2 /*return*/, _a.sent()];
4215
- case 2:
4216
- error_1 = _a.sent();
4217
- throw error_1;
4218
- case 3: return [2 /*return*/];
4219
- }
4220
- });
4221
- }); }; };
4222
-
4223
- var Text$5 = Typography.Text;
4224
- var TransactionsListDesktop = function (_a) {
4225
- var transactions = _a.transactions, onTransactionClick = _a.onTransactionClick;
4226
- var columns = useContext(TransactionsListContext).columns;
4227
- var _b = useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain, darkMode = _b.darkMode;
4228
- var showAmount = columns.includes("amount");
4229
- var showDateAndTitle = columns.includes("date-and-title");
4230
- var showDownload = columns.includes("download");
4231
- var showState = columns.includes("state");
4232
- if ((transactions === null || transactions === void 0 ? void 0 : transactions.length) === 0)
4233
- return jsx(TransactionsEmptyState, {});
4234
- return transactions === null || transactions === void 0 ? void 0 : transactions.map(function (transaction, index) {
4235
- var _a;
4236
- var isClickable = onTransactionClick !== undefined;
4237
- return (jsxs("div", __assign({ className: "contents ".concat(isClickable && "cursor-pointer", " show-on-hover-container"), onClick: function () {
4238
- onTransactionClick === null || onTransactionClick === void 0 ? void 0 : onTransactionClick(transaction);
4239
- }, style: {
4240
- backgroundColor: index % 2 === 0
4241
- ? "var(--row-background".concat(darkMode ? "-dark" : "", ")")
4242
- : "var(--row-background-alternate".concat(darkMode ? "-dark" : "", ")"),
4243
- } }, { 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$5, { 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$5, { 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));
4244
- });
4245
- };
4246
-
4247
- var Text$4 = Typography.Text;
4248
- var TransactionsListMobile = function (_a) {
4249
- var transactions = _a.transactions, onTransactionClick = _a.onTransactionClick;
4250
- var columns = useContext(TransactionsListContext).columns;
4251
- var _b = useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain, darkMode = _b.darkMode;
4252
- var showAmount = columns.includes("amount");
4253
- var showDateAndTitle = columns.includes("date-and-title");
4254
- var showDownload = columns.includes("download");
4255
- var showState = columns.includes("state");
4256
- if ((transactions === null || transactions === void 0 ? void 0 : transactions.length) === 0)
4257
- return jsx(TransactionsEmptyState, {});
4258
- return transactions === null || transactions === void 0 ? void 0 : transactions.map(function (transaction, index) {
4259
- var isClickable = transaction.kind === "INVOICE";
4260
- return (jsxs("div", __assign({ className: "contents ".concat(isClickable && "cursor-pointer", " show-on-hover-container"), onClick: function () {
4261
- onTransactionClick(transaction);
4262
- }, style: {
4263
- backgroundColor: index % 2 === 0
4264
- ? "var(--row-background".concat(darkMode ? "-dark" : "", ")")
4265
- : "var(--row-background-alternate".concat(darkMode ? "-dark" : "", ")"),
4266
- } }, { 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$4, { 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$4, { children: "\u00B7" }), showAmount && (jsx(Text$4, { 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));
4267
- });
4268
- };
4269
-
4270
- // Create a client
4271
- var queryClient = new QueryClient();
4272
- function Transactions(_a) {
4273
- 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 ? [
4274
- TransactionKind.INVOICE,
4275
- TransactionKind.PAYMENT,
4276
- TransactionKind.REFUND,
4277
- TransactionKind.WRITE_OFF,
4278
- ] : _h, style = _a.style, filter = _a.filter, noTransactionsMessage = _a.noTransactionsMessage;
4279
- var contextValues = {
4280
- showSearchBar: showSearchBar,
4281
- showTitle: showTitle,
4282
- transactionComponent: transactionComponent,
4283
- columns: columns,
4284
- className: className,
4285
- searchBarClassName: searchBarClassName,
4286
- shadow: shadow,
4287
- useModal: useModal,
4288
- onTransactionClick: onTransactionClick,
4289
- suppressTransactionDisplay: suppressTransactionDisplay,
4290
- kindsToShow: kindsToShow,
4291
- style: style,
4292
- filter: filter,
4293
- noTransactionsMessage: noTransactionsMessage,
4294
- };
4295
- return (jsx(QueryClientProvider, __assign({ client: queryClient }, { children: jsx(TransactionsListContext.Provider, __assign({ value: contextValues }, { children: jsx(TransactionsWrapper, {}) })) })));
4296
- }
4297
- function TransactionsWrapper() {
4298
- var _a = useContext(TransactionsListContext), kindsToShow = _a.kindsToShow, filterFromContext = _a.filter;
4299
- var _b = useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain;
4300
- // Local state
4301
- var _c = useState(""), search = _c[0], setSearch = _c[1];
4302
- var filter = filterFromContext ||
4303
- (search ? "filter: \"transaction.transactionableId is ".concat(search, "\"") : "");
4304
- // Queries
4305
- var data = useQuery({
4306
- queryKey: ["transactions", token, filter],
4307
- queryFn: function () { return getTransactions(filter, token, subdomain, kindsToShow); },
4308
- placeholderData: keepPreviousData,
4309
- }).data;
4310
- return (jsx(TransactionsDisplay, { transactions: data, onSearchValueChanged: setSearch, search: search }));
4311
- }
4312
- function TransactionsDisplay(_a) {
4313
- var transactions = _a.transactions, onSearchValueChanged = _a.onSearchValueChanged, search = _a.search, title = _a.title;
4314
- 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;
4315
- var columns = useContext(TransactionsListContext).columns;
4316
- var darkMode = useContext(BunnyContext).darkMode;
4317
- // Local state
4318
- var _c = useState(null), selectedTransaction = _c[0], setSelectedTransaction = _c[1];
4319
- var _d = useState(false), drawerOpen = _d[0], setDrawerOpen = _d[1];
4320
- // Hooks
4321
- var isMobile = useIsMobile$1();
4322
- function handleTransactionClick(transaction) {
4323
- if (onTransactionClick) {
4324
- onTransactionClick(transaction);
4325
- }
4326
- if (!suppressTransactionDisplay) {
4327
- setSelectedTransaction(transaction);
4328
- setDrawerOpen(true);
4329
- }
4330
- }
4331
- // Since the columns are dynamic, we need to calculate the grid template columns
4332
- var gridTemplateColumns = function () {
4333
- var templateColumns = [];
4334
- if (isMobile) {
4335
- if (columns.includes("date-and-title") ||
4336
- columns.includes("state") ||
4337
- columns.includes("amount")) {
4338
- templateColumns.push("auto");
4339
- }
4340
- if (columns.includes("download")) {
4341
- templateColumns.push("auto");
4342
- }
4343
- }
4344
- else {
4345
- if (columns.includes("date-and-title")) {
4346
- templateColumns.push("auto 3fr");
4347
- }
4348
- if (columns.includes("download")) {
4349
- templateColumns.push("auto");
4350
- }
4351
- if (columns.includes("state")) {
4352
- templateColumns.push("auto");
4353
- }
4354
- if (columns.includes("amount")) {
4355
- templateColumns.push("auto");
4356
- }
4357
- }
4358
- return templateColumns.join(" ");
4359
- };
4360
- var drawerTitle = function () {
4361
- if (!selectedTransaction)
4362
- return "";
4363
- var kind = selectedTransaction.kind.toLowerCase();
4364
- return kind.charAt(0).toUpperCase() + kind.slice(1);
4365
- };
4366
- return (jsxs("div", __assign({ style: style }, { children: [jsx(PageHeaderWithActions, __assign({ title: title || (showTitle ? "Past transactions" : undefined) }, { children: showSearchBar && (jsx("div", { children: jsx(Input, { className: searchBarClassName
4367
- ? searchBarClassName
4368
- : "border border-slate-200", onChange: function (e) {
4369
- if (isNaN(Number(e.target.value))) {
4370
- return;
4371
- }
4372
- onSearchValueChanged(e.target.value);
4373
- }, prefix: jsx(SearchOutlined$1, {}), placeholder: "Search by id #", style: {
4374
- minWidth: "300px",
4375
- }, 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: {
4376
- gridTemplateColumns: gridTemplateColumns(),
4377
- backgroundColor: "var(--row-background".concat(darkMode ? "-dark" : "", ")"),
4378
- } }, { children: isMobile ? (jsx(Fragment, { children: TransactionsListMobile({
4379
- transactions: transactions,
4380
- onTransactionClick: handleTransactionClick,
4381
- }) })) : (jsx(Fragment, { children: TransactionsListDesktop({
4382
- transactions: transactions,
4383
- onTransactionClick: handleTransactionClick,
4384
- }) })) })) })), 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 })] })] }))) })))] })));
4385
- }
4386
-
4387
- var updatingChargeQuantityIdState = atom({
4388
- key: "updatingChargeQuantityIdState",
4389
- default: undefined,
4390
- });
4391
-
4392
- var canShowQuantitiesInput = function (charge, subscription) {
4393
- // Check if the subscription is active, pending, or in trial,
4394
- // the pricing model is not flat,
4395
- // and if it's not a trial, also check if the current charge is the last one in the subscription.
4396
- var _a, _b, _c;
4397
- var isActiveSubscription = ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState$2.ACTIVE;
4398
- var isPendingSubscription = ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState$2.PENDING;
4399
- var isTrialSubscription = ((_c = subscription.state) === null || _c === void 0 ? void 0 : _c.toUpperCase()) === SubscriptionState$2.TRIAL;
4400
- var isFlatPricing = charge.pricingModel === "FLAT";
4401
- var shouldProcessCharge = (isActiveSubscription || isPendingSubscription || isTrialSubscription) &&
4402
- !isFlatPricing &&
4403
- charge.selfServiceQuantity &&
4404
- !charge.expired;
4405
- // Now you can use the value of shouldProcessCharge to determine whether to process the charge.
4406
- return shouldProcessCharge;
4407
- };
4408
- var createQuoteParams = function (quote, subscriptionQuantity, editedSubscription) {
4409
- var quoteChange = quote.quoteChanges.find(function (quoteChange) {
4410
- return quoteChange.priceList.id === (editedSubscription === null || editedSubscription === void 0 ? void 0 : editedSubscription.subscription.priceList.id);
4411
- });
4412
- var quoteChangeCharge = quoteChange === null || quoteChange === void 0 ? void 0 : quoteChange.charges.find(function (charge) { return charge.priceListCharge.id === editedSubscription.chargeId; });
4413
- var charges = [
4414
- {
4415
- id: quoteChangeCharge.id,
4416
- quantity: editedSubscription.quantity - subscriptionQuantity,
4417
- },
4418
- ];
4419
- return { charges: charges, quoteChange: quoteChange };
4420
- };
4421
- var canShowChangeQuantities = function (_a) {
4422
- var subscriptions = _a.subscriptions;
4423
- return subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.some(function (subscription) {
4424
- return subscription.charges.some(function (charge, chargeIndex) {
4425
- return canShowQuantitiesInput(charge, subscription);
4426
- });
4427
- });
4428
- };
4429
- var isSubscriptionNotActive = function (subscription) {
4430
- var _a, _b;
4431
- return ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState$2.EXPIRED ||
4432
- ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState$2.CANCELED;
4433
- };
4434
- var canShowSubscriptionActions = function (subscription) {
4435
- var _a, _b;
4436
- return ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState$2.ACTIVE ||
4437
- ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState$2.PENDING;
4438
- };
4439
-
4440
- var useCreateSubscriptionQuote = function () {
4441
- var graphQLRequest = useGraphQLRequest();
4442
- return function (subscriptionIds, token) { return __awaiter(void 0, void 0, void 0, function () {
4443
- var data;
4444
- return __generator(this, function (_a) {
4445
- switch (_a.label) {
4446
- 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, {
4447
- subscriptionIds: subscriptionIds,
4448
- })];
4449
- case 1:
4450
- data = _a.sent();
4451
- return [2 /*return*/, data];
4452
- }
4453
- });
4454
- }); };
4455
- };
4456
- var useQuoteChangeUpdate = function () {
4457
- var graphQLRequest = useGraphQLRequest();
4458
- return function (charges, quoteChangeId, token) { return __awaiter(void 0, void 0, void 0, function () {
4459
- var response;
4460
- return __generator(this, function (_a) {
4461
- switch (_a.label) {
4462
- 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 })];
4463
- case 1:
4464
- response = _a.sent();
4465
- return [2 /*return*/, response];
4466
- }
4467
- });
4468
- }); };
4469
- };
4470
- var useQuoteDelete = function () {
4471
- var graphQLRequest = useGraphQLRequest();
4472
- return function (quoteId, token) { return __awaiter(void 0, void 0, void 0, function () {
4473
- var response;
4474
- return __generator(this, function (_a) {
4475
- switch (_a.label) {
4476
- case 0: return [4 /*yield*/, graphQLRequest("mutation QuoteDelete($id: ID!) {\n quoteDelete(id: $id) {\n errors\n }\n }", token, { id: quoteId })];
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." }))] }))] })) })) }));
4305
+ }
4306
+
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";
4308
+ var portalSessionCreate = function (_a) {
4309
+ var tenantCode = _a.tenantCode, expiry = _a.expiry, returnUrl = _a.returnUrl, token = _a.token, apiHost = _a.apiHost;
4310
+ return __awaiter(void 0, void 0, void 0, function () {
4311
+ var response, errors;
4312
+ var _b;
4313
+ return __generator(this, function (_c) {
4314
+ switch (_c.label) {
4315
+ case 0: return [4 /*yield*/, gqlRequest({
4316
+ query: MUTATION$1,
4317
+ token: token,
4318
+ vars: { tenantCode: tenantCode, expiry: expiry, returnUrl: returnUrl },
4319
+ apiHost: apiHost,
4320
+ })];
4477
4321
  case 1:
4478
- response = _a.sent();
4479
- return [2 /*return*/, response];
4322
+ response = _c.sent();
4323
+ errors = (response === null || response === void 0 ? void 0 : response.portalSessionCreate).errors;
4324
+ if (errors)
4325
+ throw errors;
4326
+ return [2 /*return*/, (_b = response === null || response === void 0 ? void 0 : response.portalSessionCreate) === null || _b === void 0 ? void 0 : _b.token];
4480
4327
  }
4481
4328
  });
4482
- }); };
4329
+ });
4483
4330
  };
4484
4331
 
4485
- var QuantityInput = function (_a) {
4486
- var charge = _a.charge, chargeIndex = _a.chargeIndex, editingQuote = _a.editingQuote, setEditingQuoteData = _a.setEditingQuoteData, subscription = _a.subscription, subscriptionIndex = _a.subscriptionIndex, subscriptions = _a.subscriptions;
4487
- // Context
4488
- var token = useContext(BunnyContext).token;
4489
- // Recoil state
4490
- var _b = useRecoilState(updatingChargeQuantityIdState), updatingChargeQuantityId = _b[0], setUpdatingChargeQuantityId = _b[1];
4491
- // Local state
4492
- var _c = useState(), editedSubscription = _c[0], setEditedSubscription = _c[1];
4332
+ var showErrorNotification = useErrorNotification();
4333
+ function Signup(_a) {
4334
+ var companyName = _a.companyName, entityId = _a.entityId, priceListCode = _a.priceListCode, returnUrl = _a.returnUrl;
4493
4335
  // Hooks
4494
- var queryClient = useQueryClient();
4495
- var handleAllErrorFormats = NotificationUtils.useAllErrorFormats(function () { });
4496
- var createSubscriptionQuote = useCreateSubscriptionQuote();
4497
- var quoteChangeUpdate = useQuoteChangeUpdate();
4498
- var isMobile = useIsMobile$1();
4499
- var showErrorNotification = NotificationUtils.useErrorNotification();
4500
- var quantityDisabled =
4501
- // If we are editing a quote, we disable the quantity input
4502
- // If we don't have a editedSubscription, we disable the quantity input
4503
- (updatingChargeQuantityId && updatingChargeQuantityId !== charge.id) ||
4504
- // If the subscription is not self-service, we disable the quantity input
4505
- !charge.selfServiceQuantity;
4506
- var value = (editedSubscription === null || editedSubscription === void 0 ? void 0 : editedSubscription.quantity) === undefined
4507
- ? ""
4508
- : editedSubscription.quantity;
4509
- // Mutations
4510
- var createQuote = useMutation({
4511
- mutationFn: function (subscriptionIds) {
4512
- return createSubscriptionQuote(subscriptionIds, token);
4513
- },
4514
- onError: handleAllErrorFormats,
4515
- onSuccess: function (subscriptionUpdateData) {
4516
- var _a;
4517
- var quote = (_a = subscriptionUpdateData === null || subscriptionUpdateData === void 0 ? void 0 : subscriptionUpdateData.quoteSubscriptionUpdate) === null || _a === void 0 ? void 0 : _a.quote;
4518
- var _b = createQuoteParams(quote, charge.quantity, editedSubscription), charges = _b.charges, quoteChange = _b.quoteChange;
4519
- if (quoteChange && charges[0].quantity > 0) {
4520
- updateQuote.mutate({
4521
- charges: charges,
4522
- quoteChangeId: quoteChange.id,
4523
- });
4524
- }
4525
- },
4526
- });
4527
- var updateQuote = useMutation({
4528
- mutationFn: function (_a) {
4529
- var charges = _a.charges, quoteChangeId = _a.quoteChangeId;
4530
- return quoteChangeUpdate(charges, quoteChangeId, token);
4531
- },
4532
- onSuccess: function (response) {
4533
- var _a, _b, _c, _d, _e, _f;
4534
- if (!(editingQuote === null || editingQuote === void 0 ? void 0 : editingQuote.id)) {
4535
- 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()) ===
4536
- SubscriptionState$2.TRIAL;
4537
- setEditingQuoteData({
4538
- id: (_d = (_c = response.quoteChangeUpdate) === null || _c === void 0 ? void 0 : _c.quoteChange) === null || _d === void 0 ? void 0 : _d.quoteId,
4539
- isTrial: isTrial,
4540
- });
4541
- }
4542
- queryClient.invalidateQueries({
4543
- 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),
4336
+ var _b = useContext(BunnyContext), apiHost = _b.apiHost, token = _b.token, window = _b.window;
4337
+ var isMobile = useIsMobile(window);
4338
+ var topNavImageUrl = useContext(BrandContext).topNavImageUrl;
4339
+ var _c = useState(undefined), quote = _c[0], setQuote = _c[1];
4340
+ var _d = useState(undefined), accountId = _d[0], setAccountId = _d[1];
4341
+ var _e = useState(undefined), quoteId = _e[0], setQuoteId = _e[1];
4342
+ var _f = useState(undefined), portalSessionToken = _f[0], setPortalSessionToken = _f[1];
4343
+ var _g = useState(undefined), formData = _g[0], setFormData = _g[1];
4344
+ var _h = useState(false), proceedingToPayment = _h[0], setProceedingToPayment = _h[1];
4345
+ var _j = useState(false), paying = _j[0], setIsPaying = _j[1];
4346
+ var _k = useState(false), purchaseSucceeded = _k[0], setPurchaseSucceeded = _k[1];
4347
+ // Queries
4348
+ var priceListData = useQuery({
4349
+ queryKey: ["priceList", priceListCode],
4350
+ queryFn: function () { return getPriceList({ token: token, apiHost: apiHost, code: priceListCode }); },
4351
+ }).data;
4352
+ function handleSubmit(formData) {
4353
+ return __awaiter(this, void 0, void 0, function () {
4354
+ var data, portalSessionToken;
4355
+ return __generator(this, function (_a) {
4356
+ switch (_a.label) {
4357
+ case 0:
4358
+ setProceedingToPayment(true);
4359
+ setFormData(formData);
4360
+ return [4 /*yield*/, quoteAccountSignup({
4361
+ token: token,
4362
+ apiHost: apiHost,
4363
+ entityId: entityId,
4364
+ priceListCode: priceListCode,
4365
+ accountName: formData.accountName,
4366
+ billingContact: {
4367
+ firstName: formData.firstName,
4368
+ lastName: formData.lastName,
4369
+ email: formData.email,
4370
+ },
4371
+ })];
4372
+ case 1:
4373
+ data = _a.sent();
4374
+ setAccountId(data.account.id);
4375
+ return [4 /*yield*/, portalSessionCreate({
4376
+ token: token,
4377
+ apiHost: apiHost,
4378
+ tenantCode: data.tenant.code,
4379
+ expiry: 24,
4380
+ returnUrl: returnUrl || "",
4381
+ })];
4382
+ case 2:
4383
+ portalSessionToken = _a.sent();
4384
+ setPortalSessionToken(portalSessionToken);
4385
+ setQuoteId(data.quote.id);
4386
+ setProceedingToPayment(false);
4387
+ setQuote({
4388
+ amountDue: data.quote.amountDue,
4389
+ currencyId: data.quote.currencyId,
4390
+ });
4391
+ return [2 /*return*/];
4392
+ }
4544
4393
  });
4545
- },
4546
- });
4547
- // Handlers
4548
- var isQuantityLowerThanOriginal = function (quantity) {
4549
- return (editedSubscription === null || editedSubscription === void 0 ? void 0 : editedSubscription.quantity) !== undefined &&
4550
- editedSubscription.quantity <= quantity;
4551
- };
4552
- var onChangeQuantity = function (chargeIndex, value, priceListChargeId, subscription, subscriptionIndex) {
4553
- var quantity = isNaN(parseInt(value)) ? 0 : parseInt(value);
4554
- setEditedSubscription({
4555
- chargeIndex: chargeIndex,
4556
- subscriptionIndex: subscriptionIndex,
4557
- chargeId: priceListChargeId,
4558
- quantity: quantity,
4559
- subscription: subscription,
4560
4394
  });
4561
- if (quantity !== charge.quantity) {
4562
- setUpdatingChargeQuantityId(charge.id);
4563
- }
4564
- else {
4565
- setUpdatingChargeQuantityId(undefined);
4566
- }
4567
- };
4568
- var handleSubscriptionUpdate = function (editedSubscription) {
4569
- if (!editedSubscription)
4570
- return;
4571
- // If we are not editing a quote, we create a new one
4572
- if (!editingQuote) {
4573
- var subscriptionIds = [];
4574
- var charge_1 = subscriptions[editedSubscription.subscriptionIndex].charges[editedSubscription.chargeIndex];
4575
- if (isQuantityLowerThanOriginal(charge_1.quantity)) {
4576
- // If the quantity is lower than the original, we remove the quote
4577
- setEditingQuoteData(undefined);
4578
- setUpdatingChargeQuantityId(undefined);
4579
- return;
4580
- }
4581
- subscriptionIds.push(editedSubscription.subscription.id);
4582
- createQuote.mutate(subscriptionIds);
4583
- }
4584
- else {
4585
- // If we are editing a quote, we update the quote change
4586
- var _a = createQuoteParams(editingQuote, charge.quantity, editedSubscription), charges = _a.charges, quoteChange = _a.quoteChange;
4587
- if (quoteChange && charges[0].quantity > 0) {
4588
- updateQuote.mutate({
4589
- charges: charges,
4590
- quoteChangeId: quoteChange.id,
4591
- });
4592
- }
4593
- else {
4594
- // Reset the editing quote data and the updating charge quantity ID to their initial states
4595
- setEditingQuoteData(undefined);
4596
- setUpdatingChargeQuantityId(undefined);
4597
- }
4598
- }
4599
- };
4600
- // Initial subscription quantity if is on mobile
4601
- useEffect(function () {
4602
- if (isMobile && !editedSubscription && !quantityDisabled) {
4603
- setEditedSubscription({
4604
- chargeIndex: chargeIndex,
4605
- subscriptionIndex: subscriptionIndex,
4606
- chargeId: charge.priceListChargeId,
4607
- quantity: charge.quantity,
4608
- subscription: subscription,
4609
- });
4610
- }
4611
- }, [
4612
- charge,
4613
- chargeIndex,
4614
- editedSubscription,
4615
- isMobile,
4616
- quantityDisabled,
4617
- subscription,
4618
- subscriptionIndex,
4619
- ]);
4620
- // Edit subscription debounce
4621
- useEffect(function () {
4622
- var debounce = setTimeout(function () {
4623
- handleSubscriptionUpdate(editedSubscription);
4624
- }, 1000);
4625
- return function () { return clearTimeout(debounce); };
4626
- // eslint-disable-next-line
4627
- }, [editedSubscription]);
4628
- return (jsx(Fragment, { children: jsx(Input, { className: "text-right", disabled: quantityDisabled, onBlur: function () {
4629
- if (typeof value === "number" && value < charge.quantity) {
4630
- showErrorNotification("New value is less than the original quantity. This is not allowed");
4395
+ }
4396
+ function handlePaymentSaveSuccess(paymentSuccess) {
4397
+ var _a;
4398
+ return __awaiter(this, void 0, void 0, function () {
4399
+ var response, plugin;
4400
+ return __generator(this, function (_b) {
4401
+ switch (_b.label) {
4402
+ case 0:
4403
+ if (!formData) {
4404
+ throw new Error("Form data is required");
4405
+ }
4406
+ response = paymentSuccess.pluginPaymentResponse;
4407
+ plugin = response === null || response === void 0 ? void 0 : response.plugin;
4408
+ if (!(plugin === null || plugin === void 0 ? void 0 : plugin.id)) {
4409
+ throw new Error("Plugin ID is required");
4410
+ }
4411
+ if (!accountId) {
4412
+ throw new Error("Account ID is required");
4413
+ }
4414
+ if (!portalSessionToken) {
4415
+ throw new Error("Portal session token is required");
4416
+ }
4417
+ return [4 /*yield*/, accountSignup({
4418
+ token: portalSessionToken,
4419
+ apiHost: apiHost,
4420
+ entityId: entityId,
4421
+ quoteId: quoteId,
4422
+ paymentMethodId: (_a = paymentSuccess.savedPaymentMethodResponse) === null || _a === void 0 ? void 0 : _a.paymentMethodId.toString(),
4423
+ pluginId: plugin.id.toString(),
4424
+ priceListCode: priceListCode,
4425
+ accountId: accountId,
4426
+ })];
4427
+ case 1:
4428
+ _b.sent();
4429
+ setIsPaying(false);
4430
+ setPurchaseSucceeded(true);
4431
+ return [2 /*return*/];
4631
4432
  }
4632
- }, onChange: function (e) {
4633
- onChangeQuantity(chargeIndex, e.target.value, charge.priceListChargeId, subscription, subscriptionIndex);
4634
- }, status: isQuantityLowerThanOriginal(charge.quantity) ? "error" : "", style: { width: "96px" }, value: value }) }));
4635
- };
4636
-
4637
- var QuantityChangeGridRow = function (_a) {
4638
- var _b;
4639
- var chargeIndex = _a.chargeIndex, editingQuote = _a.editingQuote, subscriptions = _a.subscriptions, subscriptionIndex = _a.subscriptionIndex, setEditingQuoteData = _a.setEditingQuoteData, subscription = _a.subscription, subscriptionCharge = _a.subscriptionCharge;
4640
- if (!canShowQuantitiesInput(subscriptionCharge, subscription))
4641
- return null;
4642
- 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" })] }));
4643
- };
4644
-
4645
- var QuantityChangeGridTitle = function (_a) {
4646
- var children = _a.children, right = _a.right;
4647
- return (jsx("div", __assign({ className: "font-medium text-slate-600 ".concat(right ? "text-right" : "text-left"), style: { fontSize: "11px" } }, { children: children })));
4648
- };
4649
-
4650
- var QuoteChangeSummarySection = function (_a) {
4651
- var editingQuote = _a.editingQuote, editingQuoteData = _a.editingQuoteData, openCheckout = _a.openCheckout, setEditingQuoteData = _a.setEditingQuoteData;
4652
- var isMobile = useIsMobile$1();
4653
- var token = useContext(BunnyContext).token;
4654
- var showSuccessNotification = NotificationUtils.useSuccessNotification();
4655
- var trialUpgradeMutation = useMutation({
4656
- mutationFn: function (quoteId) { return checkout({ quoteId: quoteId, token: token }); },
4657
- onSuccess: function () {
4658
- setEditingQuoteData(undefined);
4659
- showSuccessNotification("Subscription updated successfully");
4660
- },
4661
- });
4662
- 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)
4663
- ? function () { return trialUpgradeMutation.mutate(editingQuoteData.id); }
4664
- : openCheckout, disabled: !editingQuoteData, size: isMobile ? "large" : "middle", type: "primary" }, { children: (editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.isTrial) ? "Activate Trial" : "Proceed to checkout" })) }))] })));
4665
- };
4666
-
4667
- var QUANTITY_CHANGE_HEADER_TITLE = "Update unit quantity";
4668
- var QUANTITY_CHANGE_HEADER_DESCRIPTION = "Adjust quantities below. The change will take effect immediately after checkout has been completed.";
4669
- var QuantityChangeDrawerDesktop = function (_a) {
4670
- var editingQuote = _a.editingQuote, editingQuoteData = _a.editingQuoteData, onClose = _a.onClose, open = _a.open, openCheckout = _a.openCheckout, setEditingQuoteData = _a.setEditingQuoteData, subscriptions = _a.subscriptions;
4671
- var _b = useState(open), openLocal = _b[0], setOpenLocal = _b[1];
4672
- var isMobile = useIsMobile$1();
4673
- useEffect(function () {
4674
- var timeoutId;
4675
- if (!open) {
4676
- timeoutId = setTimeout(function () {
4677
- setOpenLocal(false);
4678
- }, 300); // Delay to allow for close animation
4679
- }
4680
- else {
4681
- setOpenLocal(true);
4682
- }
4683
- return function () { return clearTimeout(timeoutId); };
4684
- }, [open]);
4685
- if (!openLocal)
4686
- return null;
4687
- return (jsxs(Drawer, __assign({ closeIcon: null, destroyOnClose: true, onClose: onClose, open: open, styles: isMobile
4688
- ? {
4689
- body: {
4690
- padding: "1rem",
4691
- overflow: "hidden",
4692
- background: SLATE_50,
4693
- },
4694
- wrapper: {
4695
- width: "100vw",
4696
- },
4697
- }
4698
- : {
4699
- wrapper: {
4700
- minWidth: "600px",
4701
- },
4702
- }, title: jsx(DrawerHeader, { description: QUANTITY_CHANGE_HEADER_DESCRIPTION, onClose: onClose, title: QUANTITY_CHANGE_HEADER_TITLE }) }, { children: [jsxs("div", __assign({ className: "grid pb-4", style: {
4703
- gridTemplateColumns: "2fr 1fr 1fr",
4704
- rowGap: "0.75rem",
4705
- columnGap: "1rem",
4706
- } }, { 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) {
4707
- var _a;
4708
- var isTrial = ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState$2.TRIAL;
4709
- return (jsx("div", __assign({ className: "contents" }, { children: subscription.charges.map(function (charge, chargeIndex) {
4710
- if ((isTrial && !charge.trial) || (!isTrial && charge.trial))
4711
- return null;
4712
- return (jsx(QuantityChangeGridRow, { chargeIndex: chargeIndex, editingQuote: editingQuote, setEditingQuoteData: setEditingQuoteData, subscription: subscription, subscriptionCharge: charge, subscriptionIndex: index, subscriptions: subscriptions }, chargeIndex));
4713
- }) }), index));
4714
- })] })), jsx(QuoteChangeSummarySection, { editingQuote: editingQuote, editingQuoteData: editingQuoteData, openCheckout: openCheckout, setEditingQuoteData: setEditingQuoteData })] })));
4715
- };
4433
+ });
4434
+ });
4435
+ }
4436
+ function handlePaymentFail(error) {
4437
+ showErrorNotification(error.message);
4438
+ setIsPaying(false);
4439
+ }
4440
+ if (isMobile) {
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 || "" }) }))] }))) })));
4442
+ }
4443
+ else {
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 || "" }) }))] }))) })) }));
4445
+ }
4446
+ }
4716
4447
 
4717
4448
  // WARNING: There is a preview button on APP that will need to be changed if this query is changed
4718
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 }";
4719
4450
  var getPlanChangeOptions = function (_a) {
4720
- 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;
4721
4452
  return __awaiter(void 0, void 0, void 0, function () {
4722
4453
  var response, planChangeOptions;
4723
4454
  return __generator(this, function (_b) {
@@ -4727,7 +4458,7 @@ var getPlanChangeOptions = function (_a) {
4727
4458
  query: PLAN_CHANGE_OPTIONS_QUERY,
4728
4459
  vars: { subscriptionId: upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id },
4729
4460
  token: token,
4730
- subdomain: subdomain,
4461
+ apiHost: apiHost,
4731
4462
  })];
4732
4463
  case 1:
4733
4464
  response = _b.sent();
@@ -4746,7 +4477,7 @@ var getPlanChangeOptions = function (_a) {
4746
4477
 
4747
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 }"; };
4748
4479
  var getQuote = function (_a) {
4749
- var id = _a.id, token = _a.token, subdomain = _a.subdomain;
4480
+ var id = _a.id, token = _a.token, apiHost = _a.apiHost;
4750
4481
  return __awaiter(void 0, void 0, void 0, function () {
4751
4482
  var response;
4752
4483
  return __generator(this, function (_b) {
@@ -4755,7 +4486,7 @@ var getQuote = function (_a) {
4755
4486
  query: QUOTE_QUERY(),
4756
4487
  token: token,
4757
4488
  vars: { id: id },
4758
- subdomain: subdomain,
4489
+ apiHost: apiHost,
4759
4490
  })];
4760
4491
  case 1:
4761
4492
  response = _b.sent();
@@ -4767,7 +4498,7 @@ var getQuote = function (_a) {
4767
4498
 
4768
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 }";
4769
4500
  var getSubscriptions = function (_a) {
4770
- 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;
4771
4502
  return __awaiter(void 0, void 0, void 0, function () {
4772
4503
  var response;
4773
4504
  var _b;
@@ -4778,7 +4509,7 @@ var getSubscriptions = function (_a) {
4778
4509
  query: SUBSCRIPTIONS_QUERY,
4779
4510
  token: token,
4780
4511
  vars: { entityId: entityId },
4781
- subdomain: subdomain,
4512
+ apiHost: apiHost,
4782
4513
  })];
4783
4514
  case 1:
4784
4515
  response = _c.sent();
@@ -4848,7 +4579,7 @@ var ErrorView = function (_a) {
4848
4579
  var Text$3 = Typography.Text;
4849
4580
  var HideExpiredToggle = function (_a) {
4850
4581
  var hideExpired = _a.hideExpired, setHideExpired = _a.setHideExpired, subscriptions = _a.subscriptions;
4851
- var isMobile = useIsMobile$1();
4582
+ var isMobile = useIsMobile(window);
4852
4583
  var secondaryColor = useContext(BrandContext).secondaryColor;
4853
4584
  var hasExpiredOrCanceledSubscriptions = subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.some(function (subscription) {
4854
4585
  var _a, _b;
@@ -4864,6 +4595,42 @@ var HideExpiredToggle = function (_a) {
4864
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"])));
4865
4596
  var templateObject_1$2;
4866
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
+
4867
4634
  var SubscriptionState;
4868
4635
  (function (SubscriptionState) {
4869
4636
  SubscriptionState["ACTIVE"] = "ACTIVE";
@@ -4876,7 +4643,7 @@ var SubscriptionState$1 = SubscriptionState;
4876
4643
 
4877
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";
4878
4645
  var getFeatureUsage = function (_a) {
4879
- 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;
4880
4647
  return __awaiter(void 0, void 0, void 0, function () {
4881
4648
  var vars, response;
4882
4649
  var _b;
@@ -4890,6 +4657,7 @@ var getFeatureUsage = function (_a) {
4890
4657
  query: FEATURE_USAGE_MUTATION,
4891
4658
  token: token,
4892
4659
  vars: vars,
4660
+ apiHost: apiHost,
4893
4661
  })];
4894
4662
  case 1:
4895
4663
  response = _c.sent();
@@ -5028,7 +4796,7 @@ var FeatureUsageGraph = function (_a) {
5028
4796
  }
5029
4797
  return false;
5030
4798
  }))
5031
- return "no usage";
4799
+ return jsx("div", { children: "no usage" });
5032
4800
  return (jsxs("div", __assign({ onClick: function () {
5033
4801
  setIsModalOpen(true);
5034
4802
  } }, { children: [jsx("div", __assign({ style: {
@@ -5060,7 +4828,7 @@ var templateObject_1;
5060
4828
 
5061
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";
5062
4830
  var getGuoteSubscriptionReinstate = function (_a) {
5063
- var ids = _a.ids, token = _a.token, subdomain = _a.subdomain;
4831
+ var ids = _a.ids, token = _a.token, apiHost = _a.apiHost;
5064
4832
  return __awaiter(void 0, void 0, void 0, function () {
5065
4833
  var vars, response, _b, errors, quote;
5066
4834
  return __generator(this, function (_c) {
@@ -5071,7 +4839,7 @@ var getGuoteSubscriptionReinstate = function (_a) {
5071
4839
  query: MUTATION,
5072
4840
  token: token,
5073
4841
  vars: vars,
5074
- subdomain: subdomain,
4842
+ apiHost: apiHost,
5075
4843
  })];
5076
4844
  case 1:
5077
4845
  response = _c.sent();
@@ -5084,32 +4852,16 @@ var getGuoteSubscriptionReinstate = function (_a) {
5084
4852
  });
5085
4853
  };
5086
4854
 
5087
- var useCancelSubscription = function () {
5088
- var graphQLRequest = useGraphQLRequest();
5089
- return function (subscriptionIds, token) { return __awaiter(void 0, void 0, void 0, function () {
5090
- var data;
5091
- var _a;
5092
- return __generator(this, function (_b) {
5093
- switch (_b.label) {
5094
- 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 })];
5095
- case 1:
5096
- data = _b.sent();
5097
- return [2 /*return*/, (_a = data === null || data === void 0 ? void 0 : data.subscriptions) === null || _a === void 0 ? void 0 : _a.nodes];
5098
- }
5099
- });
5100
- }); };
5101
- };
5102
-
5103
4855
  var SubscriptionCardActions = function (_a) {
5104
4856
  var _b, _c;
5105
4857
  var planChangeOptions = _a.planChangeOptions, subscription = _a.subscription, setEditingQuoteData = _a.setEditingQuoteData, setPayModalVisible = _a.setPayModalVisible;
5106
4858
  // Context
5107
- var _d = useContext(BunnyContext), token = _d.token, subdomain = _d.subdomain;
4859
+ var _d = useContext(BunnyContext), token = _d.token, apiHost = _d.apiHost;
5108
4860
  var _e = useContext(SubscriptionsContext), onChangePlanClick = _e.onChangePlanClick, onClickUpgrade = _e.onClickUpgrade, isTempViewOnly = _e.isTempViewOnly;
5109
4861
  // Hooks
5110
- var showSuccessNotification = NotificationUtils.useSuccessNotification();
5111
- var cancelSubscription = useCancelSubscription();
5112
- var queryClient = useQueryClient();
4862
+ useSuccessNotification();
4863
+ // const cancelSubscription = useCancelSubscription();
4864
+ useQueryClient();
5113
4865
  // const navigate = usePortalNavigate();
5114
4866
  // const handleUpgradingSubscriptionChange =
5115
4867
  // useHandleUpgradingSubscriptionChange();
@@ -5118,21 +4870,21 @@ var SubscriptionCardActions = function (_a) {
5118
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; });
5119
4871
  var canShowChangePlanButton = ((productPlans === null || productPlans === void 0 ? void 0 : productPlans.length) || 0) > 0;
5120
4872
  // Mutations
5121
- var subscriptionCancel = useMutation({
5122
- mutationFn: function () { return cancelSubscription([subscription.id], token); },
5123
- onSuccess: function () {
5124
- queryClient.invalidateQueries({
5125
- queryKey: QueryKeyFactory.default.createTableKey("subscriptions"),
5126
- });
5127
- showSuccessNotification("Subscription canceled");
5128
- },
5129
- });
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
+ // });
5130
4882
  useMutation({
5131
4883
  mutationFn: function () {
5132
4884
  return getGuoteSubscriptionReinstate({
5133
4885
  ids: [subscription.id],
5134
4886
  token: token,
5135
- subdomain: subdomain,
4887
+ apiHost: apiHost,
5136
4888
  });
5137
4889
  },
5138
4890
  onSuccess: function (quote) {
@@ -5152,7 +4904,9 @@ var SubscriptionCardActions = function (_a) {
5152
4904
  onChangePlanClick();
5153
4905
  };
5154
4906
  return (canShowChangePlanButton || canShowCancelButton) &&
5155
- 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 () {
5156
4910
  // handleUpgradingSubscriptionChange({
5157
4911
  // subscription,
5158
4912
  // });
@@ -5170,22 +4924,22 @@ var getSubscriptionStatusText = function (subscription) {
5170
4924
  if (cancellationDate &&
5171
4925
  (state === null || state === void 0 ? void 0 : state.toUpperCase()) !== SubscriptionState$2.CANCELED &&
5172
4926
  (state === null || state === void 0 ? void 0 : state.toUpperCase()) !== SubscriptionState$2.EXPIRED) {
5173
- 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)] })));
5174
4928
  }
5175
4929
  if (evergreen) {
5176
- return "Renews on ".concat(Misc.formatDate(endDate));
4930
+ return "Renews on ".concat(formatDate(endDate));
5177
4931
  }
5178
4932
  if ((state === null || state === void 0 ? void 0 : state.toUpperCase()) === SubscriptionState$2.CANCELED ||
5179
4933
  (state === null || state === void 0 ? void 0 : state.toUpperCase()) === SubscriptionState$2.EXPIRED) {
5180
- return "Ended on ".concat(Misc.formatDate(endDate));
4934
+ return "Ended on ".concat(formatDate(endDate));
5181
4935
  }
5182
- return "Ends on ".concat(Misc.formatDate(endDate));
4936
+ return "Ends on ".concat(formatDate(endDate));
5183
4937
  };
5184
4938
  var SubscriptionCardHeader = function (_a) {
5185
4939
  var _b, _c, _d, _e, _f;
5186
4940
  var planChangeOptions = _a.planChangeOptions, setEditingQuoteData = _a.setEditingQuoteData, setPayModalVisible = _a.setPayModalVisible, subscription = _a.subscription;
5187
4941
  var darkMode = useContext(BunnyContext).darkMode;
5188
- var isMobile = useIsMobile$1();
4942
+ var isMobile = useIsMobile(window);
5189
4943
  // Derived state
5190
4944
  var trialDaysLeft = dayjs(subscription.trialEndDate).diff(dayjs(), "days");
5191
4945
  var isTrial = ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState$2.TRIAL;
@@ -5204,8 +4958,8 @@ var BillingPeriodConverter;
5204
4958
  })(BillingPeriodConverter || (BillingPeriodConverter = {}));
5205
4959
  var SubscriptionChargeTotal = function (_a) {
5206
4960
  var charge = _a.charge, subscription = _a.subscription;
5207
- var isMobile = useIsMobile$1();
5208
- 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] }))] })));
5209
4963
  };
5210
4964
 
5211
4965
  var SubscriptionChargeUnitPrice = function (_a) {
@@ -5225,16 +4979,16 @@ var SubscriptionChargeUnitPrice = function (_a) {
5225
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)
5226
4980
  ? ((_e = (_d = charge.priceListCharge) === null || _d === void 0 ? void 0 : _d.priceListChargeTiers[index + 1]) === null || _e === void 0 ? void 0 : _e.starts) - 1
5227
4981
  : "∞";
5228
- 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));
5229
4983
  }) })) })));
5230
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" })) })));
5231
4985
  }
5232
- return (jsx(Fragment, { children: Misc.formatCurrency(charge.discountedPrice, subscription.currencyId) }));
4986
+ return jsx(Fragment, { children: formatCurrency(charge.discountedPrice, subscription.currencyId) });
5233
4987
  };
5234
4988
 
5235
4989
  var SubscriptionCardColumnHeaders = function (_a) {
5236
4990
  var columns = _a.columns;
5237
- 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)); }) }));
5238
4992
  };
5239
4993
 
5240
4994
  var Text$1 = Typography.Text;
@@ -5291,13 +5045,13 @@ var SubscriptionCardDesktop = function (_a) {
5291
5045
  var SubscriptionCardDesktopRow = function (_a) {
5292
5046
  var charge = _a.charge, chargeIndex = _a.chargeIndex, subscription = _a.subscription;
5293
5047
  // Context
5294
- var token = useContext(BunnyContext).token;
5048
+ var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
5295
5049
  // Derived state
5296
5050
  var isRamp = charge.isRamp;
5297
5051
  var prevCharge = subscription.charges[chargeIndex - 1];
5298
5052
  var isFirstRampRow = chargeIndex === 0 ||
5299
5053
  (prevCharge === null || prevCharge === void 0 ? void 0 : prevCharge.priceListChargeId) !== charge.priceListChargeId;
5300
- var chargePeriod = "".concat(Misc.formatDate(charge.startDate), " - ").concat(Misc.formatDate(charge.endDate));
5054
+ var chargePeriod = "".concat(formatDate(charge.startDate), " - ").concat(formatDate(charge.endDate));
5301
5055
  // Queries
5302
5056
  var data = useQuery({
5303
5057
  queryKey: ["getFeatureUsage", charge.id, charge.startDate, charge.endDate],
@@ -5307,6 +5061,7 @@ var SubscriptionCardDesktopRow = function (_a) {
5307
5061
  startDate: charge.startDate,
5308
5062
  subscriptionChargeId: charge.id,
5309
5063
  token: token,
5064
+ apiHost: apiHost,
5310
5065
  });
5311
5066
  },
5312
5067
  enabled: (!isRamp || (isRamp && isFirstRampRow)) &&
@@ -5366,7 +5121,7 @@ var SubscriptionCard = function (_a) {
5366
5121
  if ((isTrial && !charge.trial) || (!isTrial && charge.trial))
5367
5122
  return null;
5368
5123
  var isRamp = charge.isRamp;
5369
- var chargePeriod = "".concat(Misc.formatDate(charge.startDate), " - ").concat(Misc.formatDate(charge.endDate));
5124
+ var chargePeriod = "".concat(formatDate(charge.startDate), " - ").concat(formatDate(charge.endDate));
5370
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));
5371
5126
  })] })), jsx("div", __assign({ className: "flex gap-2 pt-5", style: {
5372
5127
  flexDirection: "column-reverse",
@@ -5375,14 +5130,14 @@ var SubscriptionCard = function (_a) {
5375
5130
 
5376
5131
  var SubscriptionsList = function (_a) {
5377
5132
  var hideExpired = _a.hideExpired, planChangeOptions = _a.planChangeOptions, setEditingQuoteData = _a.setEditingQuoteData, setPayModalVisible = _a.setPayModalVisible, subscriptions = _a.subscriptions;
5378
- var isMobile = useIsMobile$1();
5379
- return subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.map(function (subscription, subscriptionIndex) {
5380
- if (hideExpired && isSubscriptionNotActive(subscription))
5381
- return null;
5382
- if (isMobile)
5383
- return (jsx(SubscriptionCard, { planChangeOptions: planChangeOptions, setEditingQuoteData: setEditingQuoteData, setPayModalVisible: setPayModalVisible, subscription: subscription }, subscriptionIndex));
5384
- return (jsx(SubscriptionCardDesktop, { planChangeOptions: planChangeOptions, setEditingQuoteData: setEditingQuoteData, setPayModalVisible: setPayModalVisible, subscription: subscription }, subscriptionIndex));
5385
- });
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
+ }) }));
5386
5141
  };
5387
5142
 
5388
5143
  var ChangeQuantitiesButton = function (_a) {
@@ -5398,7 +5153,7 @@ var SubscriptionsNavigation = function (_a) {
5398
5153
  var hideExpired = _a.hideExpired, setHideExpired = _a.setHideExpired, setQuantityDrawerOpen = _a.setQuantityDrawerOpen, subscriptions = _a.subscriptions;
5399
5154
  var isTempViewOnly = useContext(SubscriptionsContext).isTempViewOnly;
5400
5155
  // Hooks
5401
- var isMobile = useIsMobile$1();
5156
+ var isMobile = useIsMobile(window);
5402
5157
  // Derived state
5403
5158
  var canShowChangeQuantitiesButton = canShowChangeQuantities({
5404
5159
  subscriptions: subscriptions,
@@ -5407,44 +5162,48 @@ var SubscriptionsNavigation = function (_a) {
5407
5162
  };
5408
5163
 
5409
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.
5410
5167
  var Subscriptions = function (_a) {
5411
- 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;
5412
5169
  // Context
5413
- var _c = useContext(BunnyContext), token = _c.token, subdomain = _c.subdomain;
5170
+ var _c = useContext(BunnyContext), token = _c.token, apiHost = _c.apiHost, onErrorNavigate = _c.onErrorNavigate;
5414
5171
  // Recoil state
5415
- var _d = useRecoilState(updatingChargeQuantityIdState), updatingChargeQuantityId = _d[0], setUpdatingChargeQuantityId = _d[1];
5172
+ // const [updatingChargeQuantityId, setUpdatingChargeQuantityId] =
5173
+ // useRecoilState(updatingChargeQuantityIdState);
5416
5174
  // Local state
5417
- var _e = useState(), editingQuoteData = _e[0], setEditingQuoteData = _e[1];
5418
- var _f = useState(false), payModalVisible = _f[0], setPayModalVisible = _f[1];
5419
- var _g = useState(true), hideExpired = _g[0], setHideExpired = _g[1];
5420
- 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];
5421
5179
  // Hooks
5422
- var handleAllErrorFormats = NotificationUtils.useAllErrorFormats(function () { });
5180
+ var handleAllErrorFormats = useAllErrorFormats(onErrorNavigate ||
5181
+ (function (url) {
5182
+ console.log("navigate to", url, " not implemented");
5183
+ }));
5423
5184
  var queryClient = useQueryClient();
5424
- var showSuccessNotification = NotificationUtils.useSuccessNotification();
5425
- var quoteDelete = useQuoteDelete();
5426
- var isMobile = useIsMobile$1();
5427
- var entityId = useCurrentUserData().entityId;
5428
- var companyName = useCurrentUserData().companyName;
5185
+ var showSuccessNotification = useSuccessNotification();
5186
+ // const quoteDelete = useQuoteDelete();
5187
+ var isMobile = useIsMobile(window);
5429
5188
  // Queries
5430
- var _j = useQuery({
5189
+ var _h = useQuery({
5431
5190
  queryKey: QueryKeyFactory.default.createTableKey("subscriptions"),
5432
- queryFn: function () { return getSubscriptions({ entityId: entityId, token: token, subdomain: subdomain }); },
5191
+ queryFn: function () { return getSubscriptions({ entityId: entityId, token: token, apiHost: apiHost }); },
5433
5192
  enabled: Boolean(entityId),
5434
- }), rawSubscriptions = _j.data, subscriptionsAreLoading = _j.isLoading;
5193
+ }), rawSubscriptions = _h.data, subscriptionsAreLoading = _h.isLoading;
5435
5194
  var quote = useQuery({
5436
5195
  queryKey: QueryKeyFactory.default.createObjectKey("editingQuote", editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.id),
5437
5196
  queryFn: function () {
5438
5197
  return (editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.id)
5439
- ? getQuote({ token: token, id: editingQuoteData.id, subdomain: subdomain })
5198
+ ? getQuote({ token: token, id: editingQuoteData.id, apiHost: apiHost })
5440
5199
  : undefined;
5441
5200
  },
5442
5201
  enabled: Boolean(editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.id),
5443
5202
  }).data;
5444
- var _k = useQuery({
5203
+ var _j = useQuery({
5445
5204
  queryKey: QueryKeyFactory.default.planChangeOptionsKey(),
5446
- queryFn: function () { return getPlanChangeOptions({ token: token, subdomain: subdomain }); },
5447
- }), planChangeOptions = _k.data, arePlanChangeOptionsLoading = _k.isLoading;
5205
+ queryFn: function () { return getPlanChangeOptions({ token: token, apiHost: apiHost }); },
5206
+ }), planChangeOptions = _j.data, arePlanChangeOptionsLoading = _j.isLoading;
5448
5207
  // Derived state
5449
5208
  var subscriptions = useSubscriptions({ data: rawSubscriptions });
5450
5209
  var allSubscriptionsExpired = subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.every(function (subscription) {
@@ -5476,16 +5235,16 @@ var Subscriptions = function (_a) {
5476
5235
  var onFail = function (error) {
5477
5236
  handleAllErrorFormats(error);
5478
5237
  };
5479
- var onClose = function () {
5480
- if (editingQuoteData) {
5481
- quoteDelete(editingQuoteData.id, token);
5482
- setEditingQuoteData(undefined);
5483
- }
5484
- if (updatingChargeQuantityId) {
5485
- setUpdatingChargeQuantityId(undefined);
5486
- }
5487
- setQuantityDrawerOpen(false);
5488
- };
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
+ // };
5489
5248
  if (subscriptionsAreLoading || arePlanChangeOptionsLoading)
5490
5249
  return jsx(Fragment, {});
5491
5250
  return (jsxs(SubscriptionsContext.Provider, __assign({ value: {
@@ -5499,9 +5258,9 @@ var Subscriptions = function (_a) {
5499
5258
  shadow: shadow,
5500
5259
  gap: gap,
5501
5260
  showTitle: showTitle,
5502
- } }, { 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: {
5503
5262
  flexShrink: 1,
5504
- } }, { 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 })] })));
5505
5264
  };
5506
5265
 
5507
- export { BunnyProvider, Checkout, Invoice, PaymentMethod, Quote, Signup, Subscriptions, Transactions, getQuoteAmountDue, usePaymentMethod };
5266
+ export { BunnyProvider, Checkout, Invoice, PaymentMethod, Quote, Quotes, Signup, Subscriptions, Transactions, getQuoteAmountDue, usePaymentMethod };