@bunnyapp/components 1.0.7 → 1.0.10

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 (176) hide show
  1. package/dist/cjs/index.js +706 -1031
  2. package/dist/cjs/playground/main.d.ts +1 -1
  3. package/dist/cjs/src/ajax.d.ts +1 -0
  4. package/dist/cjs/src/components/BunnyProvider.d.ts +9 -5
  5. package/dist/cjs/src/components/Checkout/Checkout.d.ts +4 -2
  6. package/dist/cjs/src/components/Checkout/InvoiceCheckout.d.ts +2 -1
  7. package/dist/cjs/src/components/Checkout/QuoteCheckout.d.ts +2 -1
  8. package/dist/cjs/src/components/FeatureUsageGraph.d.ts +1 -1
  9. package/dist/cjs/src/components/Invoice/Invoice.d.ts +2 -2
  10. package/dist/cjs/src/components/Invoice/InvoiceQuoteView.d.ts +1 -2
  11. package/dist/cjs/src/components/LegacyInvoicePDF.d.ts +2 -2
  12. package/dist/cjs/src/components/PaymentForm/DemoPay/demoPayUtils.d.ts +1 -1
  13. package/dist/cjs/src/components/PaymentForm/Finix/FinixCardForm.d.ts +1 -1
  14. package/dist/cjs/src/components/PaymentForm/FinixAch.d.ts +1 -1
  15. package/dist/cjs/src/components/PaymentForm/PaymentForm.d.ts +1 -1
  16. package/dist/cjs/src/components/PaymentForm/PaymentFormTypes.d.ts +1 -0
  17. package/dist/cjs/src/components/PaymentForm/PaymentMethod/PaymentMethod.d.ts +2 -2
  18. package/dist/cjs/src/components/PaymentForm/PaymentMethod/PaymentMethodContext.d.ts +0 -1
  19. package/dist/cjs/src/components/PaymentForm/PaymentMethodForm.d.ts +1 -1
  20. package/dist/cjs/src/components/PaymentForm/Stripe/StripeForm.d.ts +1 -1
  21. package/dist/cjs/src/components/PaymentForm/Stripe/stripeUtils.d.ts +6 -6
  22. package/dist/cjs/src/components/PaymentForm/paymentUtils.d.ts +2 -2
  23. package/dist/cjs/src/components/Quote/Quote.d.ts +2 -2
  24. package/dist/cjs/src/components/Quotes/Quotes.d.ts +2 -1
  25. package/dist/cjs/src/components/Signup/PaymentForms.d.ts +2 -2
  26. package/dist/cjs/src/components/Signup/PaymentSuccess.d.ts +4 -3
  27. package/dist/cjs/src/components/Signup/Signup.d.ts +3 -1
  28. package/dist/cjs/src/components/Subscriptions/Subscriptions.d.ts +4 -2
  29. package/dist/cjs/src/components/Subscriptions/subscriptionsList/SubscriptionsList.d.ts +1 -1
  30. package/dist/cjs/src/components/Subscriptions/subscriptionsList/subscriptionCardDesktop/SubscriptionCardColumnHeaders.d.ts +1 -1
  31. package/dist/cjs/src/components/Subscriptions/subscriptionsList/subscriptionUtils.d.ts +1 -2
  32. package/dist/cjs/src/components/Transactions/Transactions.d.ts +3 -1
  33. package/dist/cjs/src/components/Transactions/TransactionsListContext.d.ts +1 -0
  34. package/dist/cjs/src/components/Transactions/transactionsList/TransactionDownload.d.ts +2 -2
  35. package/dist/cjs/src/components/Transactions/transactionsList/TransactionsListDesktop.d.ts +1 -11
  36. package/dist/cjs/src/contexts/NavigationContext.d.ts +1 -1
  37. package/dist/cjs/src/graphql/mutations/accountSignup.d.ts +2 -2
  38. package/dist/cjs/src/graphql/mutations/accountUpdate.d.ts +2 -1
  39. package/dist/cjs/src/graphql/mutations/checkout.d.ts +2 -2
  40. package/dist/cjs/src/graphql/mutations/portalSessionCreate.d.ts +2 -2
  41. package/dist/cjs/src/graphql/mutations/quoteAccountSignup.d.ts +2 -2
  42. package/dist/cjs/src/graphql/mutations/quoteAddCoupon.d.ts +2 -1
  43. package/dist/cjs/src/graphql/mutations/quoteCompose.d.ts +2 -2
  44. package/dist/cjs/src/graphql/mutations/quoteCreate.d.ts +2 -2
  45. package/dist/cjs/src/graphql/mutations/quoteRecalculateTaxes.d.ts +2 -1
  46. package/dist/cjs/src/graphql/mutations/quoteSubscriptionReinstate.d.ts +2 -2
  47. package/dist/cjs/src/graphql/queries/getAccount.d.ts +2 -2
  48. package/dist/cjs/src/graphql/queries/getBranding.d.ts +2 -2
  49. package/dist/cjs/src/graphql/queries/getCurrentUserData.d.ts +2 -2
  50. package/dist/cjs/src/graphql/queries/getFeatureUsage.d.ts +2 -1
  51. package/dist/cjs/src/graphql/queries/getFormattedQuote.d.ts +2 -2
  52. package/dist/cjs/src/graphql/queries/getInvoice.d.ts +2 -2
  53. package/dist/cjs/src/graphql/queries/getPlanChangeOptions.d.ts +2 -2
  54. package/dist/cjs/src/graphql/queries/getPriceList.d.ts +2 -2
  55. package/dist/cjs/src/graphql/queries/getQuote.d.ts +2 -2
  56. package/dist/cjs/src/graphql/queries/getQuotes.d.ts +2 -2
  57. package/dist/cjs/src/graphql/queries/getSubscription.d.ts +2 -2
  58. package/dist/cjs/src/graphql/queries/getSubscriptions.d.ts +2 -2
  59. package/dist/cjs/src/graphql/queries/getTaxationRequiredAccountFields.d.ts +6 -0
  60. package/dist/cjs/src/graphql/queries/getTransactions.d.ts +1 -1
  61. package/dist/cjs/src/hooks/quotes/useSendAcceptQuote.d.ts +7 -1
  62. package/dist/cjs/src/hooks/useHasTaxPlugin.d.ts +3 -2
  63. package/dist/cjs/src/hooks/usePaymentPlugins.d.ts +11 -0
  64. package/dist/cjs/src/hooks/usePlugins.d.ts +6 -0
  65. package/dist/cjs/src/hooks/useSigningPlugins.d.ts +5 -1
  66. package/dist/cjs/src/index.d.ts +1 -0
  67. package/dist/cjs/src/utils/GraphQLClient.d.ts +2 -0
  68. package/dist/cjs/src/utils/quoteInvoiceUtils.d.ts +6 -0
  69. package/dist/esm/index.js +728 -1052
  70. package/dist/esm/playground/main.d.ts +1 -1
  71. package/dist/esm/src/ajax.d.ts +1 -0
  72. package/dist/esm/src/components/BunnyProvider.d.ts +9 -5
  73. package/dist/esm/src/components/Checkout/Checkout.d.ts +4 -2
  74. package/dist/esm/src/components/Checkout/InvoiceCheckout.d.ts +2 -1
  75. package/dist/esm/src/components/Checkout/QuoteCheckout.d.ts +2 -1
  76. package/dist/esm/src/components/FeatureUsageGraph.d.ts +1 -1
  77. package/dist/esm/src/components/Invoice/Invoice.d.ts +2 -2
  78. package/dist/esm/src/components/Invoice/InvoiceQuoteView.d.ts +1 -2
  79. package/dist/esm/src/components/LegacyInvoicePDF.d.ts +2 -2
  80. package/dist/esm/src/components/PaymentForm/DemoPay/demoPayUtils.d.ts +1 -1
  81. package/dist/esm/src/components/PaymentForm/Finix/FinixCardForm.d.ts +1 -1
  82. package/dist/esm/src/components/PaymentForm/FinixAch.d.ts +1 -1
  83. package/dist/esm/src/components/PaymentForm/PaymentForm.d.ts +1 -1
  84. package/dist/esm/src/components/PaymentForm/PaymentFormTypes.d.ts +1 -0
  85. package/dist/esm/src/components/PaymentForm/PaymentMethod/PaymentMethod.d.ts +2 -2
  86. package/dist/esm/src/components/PaymentForm/PaymentMethod/PaymentMethodContext.d.ts +0 -1
  87. package/dist/esm/src/components/PaymentForm/PaymentMethodForm.d.ts +1 -1
  88. package/dist/esm/src/components/PaymentForm/Stripe/StripeForm.d.ts +1 -1
  89. package/dist/esm/src/components/PaymentForm/Stripe/stripeUtils.d.ts +6 -6
  90. package/dist/esm/src/components/PaymentForm/paymentUtils.d.ts +2 -2
  91. package/dist/esm/src/components/Quote/Quote.d.ts +2 -2
  92. package/dist/esm/src/components/Quotes/Quotes.d.ts +2 -1
  93. package/dist/esm/src/components/Signup/PaymentForms.d.ts +2 -2
  94. package/dist/esm/src/components/Signup/PaymentSuccess.d.ts +4 -3
  95. package/dist/esm/src/components/Signup/Signup.d.ts +3 -1
  96. package/dist/esm/src/components/Subscriptions/Subscriptions.d.ts +4 -2
  97. package/dist/esm/src/components/Subscriptions/subscriptionsList/SubscriptionsList.d.ts +1 -1
  98. package/dist/esm/src/components/Subscriptions/subscriptionsList/subscriptionCardDesktop/SubscriptionCardColumnHeaders.d.ts +1 -1
  99. package/dist/esm/src/components/Subscriptions/subscriptionsList/subscriptionUtils.d.ts +1 -2
  100. package/dist/esm/src/components/Transactions/Transactions.d.ts +3 -1
  101. package/dist/esm/src/components/Transactions/TransactionsListContext.d.ts +1 -0
  102. package/dist/esm/src/components/Transactions/transactionsList/TransactionDownload.d.ts +2 -2
  103. package/dist/esm/src/components/Transactions/transactionsList/TransactionsListDesktop.d.ts +1 -11
  104. package/dist/esm/src/contexts/NavigationContext.d.ts +1 -1
  105. package/dist/esm/src/graphql/mutations/accountSignup.d.ts +2 -2
  106. package/dist/esm/src/graphql/mutations/accountUpdate.d.ts +2 -1
  107. package/dist/esm/src/graphql/mutations/checkout.d.ts +2 -2
  108. package/dist/esm/src/graphql/mutations/portalSessionCreate.d.ts +2 -2
  109. package/dist/esm/src/graphql/mutations/quoteAccountSignup.d.ts +2 -2
  110. package/dist/esm/src/graphql/mutations/quoteAddCoupon.d.ts +2 -1
  111. package/dist/esm/src/graphql/mutations/quoteCompose.d.ts +2 -2
  112. package/dist/esm/src/graphql/mutations/quoteCreate.d.ts +2 -2
  113. package/dist/esm/src/graphql/mutations/quoteRecalculateTaxes.d.ts +2 -1
  114. package/dist/esm/src/graphql/mutations/quoteSubscriptionReinstate.d.ts +2 -2
  115. package/dist/esm/src/graphql/queries/getAccount.d.ts +2 -2
  116. package/dist/esm/src/graphql/queries/getBranding.d.ts +2 -2
  117. package/dist/esm/src/graphql/queries/getCurrentUserData.d.ts +2 -2
  118. package/dist/esm/src/graphql/queries/getFeatureUsage.d.ts +2 -1
  119. package/dist/esm/src/graphql/queries/getFormattedQuote.d.ts +2 -2
  120. package/dist/esm/src/graphql/queries/getInvoice.d.ts +2 -2
  121. package/dist/esm/src/graphql/queries/getPlanChangeOptions.d.ts +2 -2
  122. package/dist/esm/src/graphql/queries/getPriceList.d.ts +2 -2
  123. package/dist/esm/src/graphql/queries/getQuote.d.ts +2 -2
  124. package/dist/esm/src/graphql/queries/getQuotes.d.ts +2 -2
  125. package/dist/esm/src/graphql/queries/getSubscription.d.ts +2 -2
  126. package/dist/esm/src/graphql/queries/getSubscriptions.d.ts +2 -2
  127. package/dist/esm/src/graphql/queries/getTaxationRequiredAccountFields.d.ts +6 -0
  128. package/dist/esm/src/graphql/queries/getTransactions.d.ts +1 -1
  129. package/dist/esm/src/hooks/quotes/useSendAcceptQuote.d.ts +7 -1
  130. package/dist/esm/src/hooks/useHasTaxPlugin.d.ts +3 -2
  131. package/dist/esm/src/hooks/usePaymentPlugins.d.ts +11 -0
  132. package/dist/esm/src/hooks/usePlugins.d.ts +6 -0
  133. package/dist/esm/src/hooks/useSigningPlugins.d.ts +5 -1
  134. package/dist/esm/src/index.d.ts +1 -0
  135. package/dist/esm/src/utils/GraphQLClient.d.ts +2 -0
  136. package/dist/esm/src/utils/quoteInvoiceUtils.d.ts +6 -0
  137. package/dist/index.d.ts +28 -14
  138. package/package.json +9 -6
  139. package/dist/cjs/src/atoms/pageContentRefAtom.d.ts +0 -1
  140. package/dist/cjs/src/atoms/planPickerQuoteDataAtom.d.ts +0 -2
  141. package/dist/cjs/src/atoms/updatingChargeQuantityIdAtom.d.ts +0 -2
  142. package/dist/cjs/src/components/Footer.d.ts +0 -4
  143. package/dist/cjs/src/components/PageContent.d.ts +0 -7
  144. package/dist/cjs/src/features/quantityChangeDrawer/QuantityChangeGridRow.d.ts +0 -11
  145. package/dist/cjs/src/features/quantityChangeDrawer/QuantityChangeGridTitle.d.ts +0 -6
  146. package/dist/cjs/src/features/quantityChangeDrawer/QuantityInput.d.ts +0 -21
  147. package/dist/cjs/src/features/quantityChangeDrawer/QuoteChangeSummarySection.d.ts +0 -9
  148. package/dist/cjs/src/features/quantityChangeDrawer/quantityChangeDrawerDesktop/QuantityChangeDrawerDesktop.d.ts +0 -14
  149. package/dist/cjs/src/graphql/QuoteRequests.d.ts +0 -6
  150. package/dist/cjs/src/graphql/SubscriptionRequests.d.ts +0 -2
  151. package/dist/cjs/src/graphql/queries/getFormattedInvoice.d.ts +0 -7
  152. package/dist/cjs/src/hooks/useCurrentUserData.d.ts +0 -2
  153. package/dist/cjs/src/hooks/useIsMobile.d.ts +0 -10
  154. package/dist/cjs/src/utils.d.ts +0 -9
  155. package/dist/esm/src/atoms/pageContentRefAtom.d.ts +0 -1
  156. package/dist/esm/src/atoms/planPickerQuoteDataAtom.d.ts +0 -2
  157. package/dist/esm/src/atoms/updatingChargeQuantityIdAtom.d.ts +0 -2
  158. package/dist/esm/src/components/Footer.d.ts +0 -4
  159. package/dist/esm/src/components/PageContent.d.ts +0 -7
  160. package/dist/esm/src/features/quantityChangeDrawer/QuantityChangeGridRow.d.ts +0 -11
  161. package/dist/esm/src/features/quantityChangeDrawer/QuantityChangeGridTitle.d.ts +0 -6
  162. package/dist/esm/src/features/quantityChangeDrawer/QuantityInput.d.ts +0 -21
  163. package/dist/esm/src/features/quantityChangeDrawer/QuoteChangeSummarySection.d.ts +0 -9
  164. package/dist/esm/src/features/quantityChangeDrawer/quantityChangeDrawerDesktop/QuantityChangeDrawerDesktop.d.ts +0 -14
  165. package/dist/esm/src/graphql/QuoteRequests.d.ts +0 -6
  166. package/dist/esm/src/graphql/SubscriptionRequests.d.ts +0 -2
  167. package/dist/esm/src/graphql/queries/getFormattedInvoice.d.ts +0 -7
  168. package/dist/esm/src/hooks/useCurrentUserData.d.ts +0 -2
  169. package/dist/esm/src/hooks/useIsMobile.d.ts +0 -10
  170. package/dist/esm/src/utils.d.ts +0 -9
  171. /package/dist/cjs/src/components/{Icons → icons}/ArrowDownToLine.d.ts +0 -0
  172. /package/dist/cjs/src/components/{Icons → icons}/BunnyFooterIcon.d.ts +0 -0
  173. /package/dist/cjs/src/components/{Icons → icons}/CardIcon.d.ts +0 -0
  174. /package/dist/esm/src/components/{Icons → icons}/ArrowDownToLine.d.ts +0 -0
  175. /package/dist/esm/src/components/{Icons → icons}/BunnyFooterIcon.d.ts +0 -0
  176. /package/dist/esm/src/components/{Icons → icons}/CardIcon.d.ts +0 -0
package/dist/esm/index.js CHANGED
@@ -4,17 +4,47 @@ import React__default, { createContext, useContext, useEffect, useState, useMemo
4
4
  import { Markup } from 'interweave';
5
5
  import { ConfigProvider, Button, Typography, Checkbox, Input, Divider, Modal, Form, Tag, Drawer, Card as Card$1, Popconfirm, Select, Image, Dropdown } from 'antd';
6
6
  import styled from 'styled-components';
7
- import { DEFAULT_ACCENT_COLOR, DEFAULT_BRAND_COLOR, DEFAULT_SECONDARY_COLOR, DEFAULT_TOP_NAV_IMAGE_URL, gqlRequest, createGraphQLClient, Misc, MARK_PRO, INPUT_BORDER_COLOR, SLATE_50, SLATE_400, SLATE_200, QueryKeyFactory, useDownloadFile, NotificationUtils, invokePlugin, useIsMobile as useIsMobile$1, GRAY_500, GRAY_200, CHARCOAL_GRAY, StringUtils, usePaymentPlugins, ApiUtils, PAYABLE_INVOICE_STATES, DOCUMENT_NAME as DOCUMENT_NAME$1, QuoteInvoiceUtils, usePlugins, GraphqlUtils, FrontendTransaction, SLATE_600, WHITE, TransactionKind, Lists, getTaxationRequiredAccountFields, getAccount, useCurrentUserData, SLATE_500, PRIMARY_COLOR, SubscriptionState as SubscriptionState$2, MODAL_MAX_HEIGHT, DataInterval, TAG_COLORS, ChargeType } from '@bunnyapp/common';
7
+ import { DEFAULT_ACCENT_COLOR, DEFAULT_BRAND_COLOR, DEFAULT_SECONDARY_COLOR, DEFAULT_TOP_NAV_IMAGE_URL, gqlRequest, useIsMobile, isColorTooDark, MARK_PRO, INPUT_BORDER_COLOR, SLATE_50, SLATE_400, SLATE_200, QueryKeyFactory, useErrorNotification, invokePlugin, formatCurrency, GRAY_500, GRAY_200, CHARCOAL_GRAY, StringUtils, getPlugins, useSuccessNotification, useAllErrorFormats, getFormattedInvoice, PAYABLE_INVOICE_STATES, DOCUMENT_NAME as DOCUMENT_NAME$1, useGraphQLmutation, formatDate, FrontendTransaction, SLATE_600, WHITE, TransactionKind, Lists, getAccount, SubscriptionState as SubscriptionState$2, MODAL_MAX_HEIGHT, SLATE_500, DataInterval, TAG_COLORS, ChargeType } from '@bunnyapp/common';
8
8
  import { QueryClient, QueryClientProvider, useQuery, useMutation, useQueryClient, keepPreviousData } from '@tanstack/react-query';
9
- import { RecoilRoot, atom, useSetRecoilState, useRecoilValue, useRecoilState } from 'recoil';
10
9
  import theme from 'antd/lib/theme';
10
+ import { RecoilRoot } from 'recoil';
11
+ import { GraphQLClient } from 'graphql-request';
11
12
  import { HelmetProvider, Helmet } from 'react-helmet-async';
12
13
  import { useElements, useStripe, PaymentElement, Elements } from '@stripe/react-stripe-js';
13
14
  import { loadStripe } from '@stripe/stripe-js/pure';
14
15
  import { capitalize, startCase, cloneDeep, omit } from 'lodash';
15
- import request from 'graphql-request';
16
16
  import { BarChart, ResponsiveContainer, XAxis, Tooltip, Bar, Rectangle } from 'recharts';
17
17
 
18
+ function styleInject(css, ref) {
19
+ if ( ref === void 0 ) ref = {};
20
+ var insertAt = ref.insertAt;
21
+
22
+ if (!css || typeof document === 'undefined') { return; }
23
+
24
+ var head = document.head || document.getElementsByTagName('head')[0];
25
+ var style = document.createElement('style');
26
+ style.type = 'text/css';
27
+
28
+ if (insertAt === 'top') {
29
+ if (head.firstChild) {
30
+ head.insertBefore(style, head.firstChild);
31
+ } else {
32
+ head.appendChild(style);
33
+ }
34
+ } else {
35
+ head.appendChild(style);
36
+ }
37
+
38
+ if (style.styleSheet) {
39
+ style.styleSheet.cssText = css;
40
+ } else {
41
+ style.appendChild(document.createTextNode(css));
42
+ }
43
+ }
44
+
45
+ var css_248z = ".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.rotate-45,\n.transform {\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n}\n.shadow,\n.shadow-md {\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n}\n.container {\n width: 100%;\n}\n@media (min-width: 768px) {\n .container {\n max-width: 768px;\n }\n}\n@media (min-width: 1024px) {\n .container {\n max-width: 1024px;\n }\n}\n@media (min-width: 1280px) {\n .container {\n max-width: 1280px;\n }\n}\n@media (min-width: 1536px) {\n .container {\n max-width: 1536px;\n }\n}\n.visible {\n visibility: visible;\n}\n.fixed {\n position: fixed;\n}\n.absolute {\n position: absolute;\n}\n.relative {\n position: relative;\n}\n.bottom-0 {\n bottom: 0px;\n}\n.left-0 {\n left: 0px;\n}\n.right-0 {\n right: 0px;\n}\n.top-0 {\n top: 0px;\n}\n.z-50 {\n z-index: 50;\n}\n.col-span-2 {\n grid-column: span 2 / span 2;\n}\n.col-span-3 {\n grid-column: span 3 / span 3;\n}\n.m-0 {\n margin: 0px;\n}\n.mx-8 {\n margin-left: 2rem;\n margin-right: 2rem;\n}\n.my-12 {\n margin-top: 3rem;\n margin-bottom: 3rem;\n}\n.my-4 {\n margin-top: 1rem;\n margin-bottom: 1rem;\n}\n.mb-4 {\n margin-bottom: 1rem;\n}\n.ml-2 {\n margin-left: 0.5rem;\n}\n.mr-8 {\n margin-right: 2rem;\n}\n.mt-1 {\n margin-top: 0.25rem;\n}\n.mt-2 {\n margin-top: 0.5rem;\n}\n.mt-4 {\n margin-top: 1rem;\n}\n.mt-6 {\n margin-top: 1.5rem;\n}\n.mt-8 {\n margin-top: 2rem;\n}\n.block {\n display: block;\n}\n.flex {\n display: flex;\n}\n.table {\n display: table;\n}\n.grid {\n display: grid;\n}\n.contents {\n display: contents;\n}\n.hidden {\n display: none;\n}\n.h-4 {\n height: 1rem;\n}\n.h-5 {\n height: 1.25rem;\n}\n.h-8 {\n height: 2rem;\n}\n.h-full {\n height: 100%;\n}\n.h-screen {\n height: 100vh;\n}\n.w-1\\/2 {\n width: 50%;\n}\n.w-1\\/3 {\n width: 33.333333%;\n}\n.w-2\\/3 {\n width: 66.666667%;\n}\n.w-4 {\n width: 1rem;\n}\n.w-full {\n width: 100%;\n}\n.w-screen {\n width: 100vw;\n}\n.max-w-32 {\n max-width: 8rem;\n}\n.shrink-0 {\n flex-shrink: 0;\n}\n.grow {\n flex-grow: 1;\n}\n.border-collapse {\n border-collapse: collapse;\n}\n.rotate-45 {\n --tw-rotate: 45deg;\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.transform {\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.cursor-pointer {\n cursor: pointer;\n}\n.grid-cols-2 {\n grid-template-columns: repeat(2, minmax(0, 1fr));\n}\n.grid-cols-3 {\n grid-template-columns: repeat(3, minmax(0, 1fr));\n}\n.flex-row {\n flex-direction: row;\n}\n.flex-col {\n flex-direction: column;\n}\n.items-end {\n align-items: flex-end;\n}\n.items-center {\n align-items: center;\n}\n.justify-start {\n justify-content: flex-start;\n}\n.justify-end {\n justify-content: flex-end;\n}\n.justify-center {\n justify-content: center;\n}\n.justify-between {\n justify-content: space-between;\n}\n.gap-1 {\n gap: 0.25rem;\n}\n.gap-2 {\n gap: 0.5rem;\n}\n.gap-4 {\n gap: 1rem;\n}\n.gap-6 {\n gap: 1.5rem;\n}\n.space-y-2 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(0.5rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(0.5rem * var(--tw-space-y-reverse));\n}\n.space-y-8 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(2rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(2rem * var(--tw-space-y-reverse));\n}\n.overflow-auto {\n overflow: auto;\n}\n.overflow-hidden {\n overflow: hidden;\n}\n.overflow-visible {\n overflow: visible;\n}\n.whitespace-nowrap {\n white-space: nowrap;\n}\n.text-nowrap {\n text-wrap: nowrap;\n}\n.rounded {\n border-radius: 0.25rem;\n}\n.rounded-full {\n border-radius: 9999px;\n}\n.rounded-md {\n border-radius: 0.375rem;\n}\n.border {\n border-width: 1px;\n}\n.border-solid {\n border-style: solid;\n}\n.border-gray-400 {\n --tw-border-opacity: 1;\n border-color: rgb(156 163 175 / var(--tw-border-opacity, 1));\n}\n.border-gray-500 {\n --tw-border-opacity: 1;\n border-color: rgb(107 114 128 / var(--tw-border-opacity, 1));\n}\n.border-slate-200 {\n --tw-border-opacity: 1;\n border-color: rgb(226 232 240 / var(--tw-border-opacity, 1));\n}\n.border-slate-300 {\n --tw-border-opacity: 1;\n border-color: rgb(203 213 225 / var(--tw-border-opacity, 1));\n}\n.bg-black {\n --tw-bg-opacity: 1;\n background-color: rgb(0 0 0 / var(--tw-bg-opacity, 1));\n}\n.bg-emerald-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(167 243 208 / var(--tw-bg-opacity, 1));\n}\n.bg-green-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(187 247 208 / var(--tw-bg-opacity, 1));\n}\n.bg-orange-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(254 215 170 / var(--tw-bg-opacity, 1));\n}\n.bg-red-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(254 202 202 / var(--tw-bg-opacity, 1));\n}\n.bg-slate-50 {\n --tw-bg-opacity: 1;\n background-color: rgb(248 250 252 / var(--tw-bg-opacity, 1));\n}\n.bg-white {\n --tw-bg-opacity: 1;\n background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));\n}\n.bg-yellow-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(254 240 138 / var(--tw-bg-opacity, 1));\n}\n.p-0 {\n padding: 0px;\n}\n.p-2 {\n padding: 0.5rem;\n}\n.p-4 {\n padding: 1rem;\n}\n.px-2 {\n padding-left: 0.5rem;\n padding-right: 0.5rem;\n}\n.px-4 {\n padding-left: 1rem;\n padding-right: 1rem;\n}\n.px-6 {\n padding-left: 1.5rem;\n padding-right: 1.5rem;\n}\n.py-1 {\n padding-top: 0.25rem;\n padding-bottom: 0.25rem;\n}\n.py-2 {\n padding-top: 0.5rem;\n padding-bottom: 0.5rem;\n}\n.py-4 {\n padding-top: 1rem;\n padding-bottom: 1rem;\n}\n.py-6 {\n padding-top: 1.5rem;\n padding-bottom: 1.5rem;\n}\n.pb-2 {\n padding-bottom: 0.5rem;\n}\n.pb-4 {\n padding-bottom: 1rem;\n}\n.pb-6 {\n padding-bottom: 1.5rem;\n}\n.pb-8 {\n padding-bottom: 2rem;\n}\n.pl-0 {\n padding-left: 0px;\n}\n.pl-2 {\n padding-left: 0.5rem;\n}\n.pl-4 {\n padding-left: 1rem;\n}\n.pt-1 {\n padding-top: 0.25rem;\n}\n.pt-2 {\n padding-top: 0.5rem;\n}\n.pt-4 {\n padding-top: 1rem;\n}\n.pt-5 {\n padding-top: 1.25rem;\n}\n.pt-6 {\n padding-top: 1.5rem;\n}\n.pt-8 {\n padding-top: 2rem;\n}\n.text-left {\n text-align: left;\n}\n.text-center {\n text-align: center;\n}\n.text-right {\n text-align: right;\n}\n.align-middle {\n vertical-align: middle;\n}\n.text-2xl {\n font-size: 1.5rem;\n line-height: 2rem;\n}\n.text-base {\n font-size: 1rem;\n line-height: 1.5rem;\n}\n.text-lg {\n font-size: 1.125rem;\n line-height: 1.75rem;\n}\n.text-sm {\n font-size: 0.875rem;\n line-height: 1.25rem;\n}\n.text-xl {\n font-size: 1.25rem;\n line-height: 1.75rem;\n}\n.text-xs {\n font-size: 0.75rem;\n line-height: 1rem;\n}\n.font-bold {\n font-weight: 700;\n}\n.font-medium {\n font-weight: 500;\n}\n.font-normal {\n font-weight: 400;\n}\n.capitalize {\n text-transform: capitalize;\n}\n.text-emerald-600 {\n --tw-text-opacity: 1;\n color: rgb(5 150 105 / var(--tw-text-opacity, 1));\n}\n.text-emerald-700 {\n --tw-text-opacity: 1;\n color: rgb(4 120 87 / var(--tw-text-opacity, 1));\n}\n.text-gray-600 {\n --tw-text-opacity: 1;\n color: rgb(75 85 99 / var(--tw-text-opacity, 1));\n}\n.text-gray-900 {\n --tw-text-opacity: 1;\n color: rgb(17 24 39 / var(--tw-text-opacity, 1));\n}\n.text-green-600 {\n --tw-text-opacity: 1;\n color: rgb(22 163 74 / var(--tw-text-opacity, 1));\n}\n.text-orange-500 {\n --tw-text-opacity: 1;\n color: rgb(249 115 22 / var(--tw-text-opacity, 1));\n}\n.text-red-500 {\n --tw-text-opacity: 1;\n color: rgb(239 68 68 / var(--tw-text-opacity, 1));\n}\n.text-slate-400 {\n --tw-text-opacity: 1;\n color: rgb(148 163 184 / var(--tw-text-opacity, 1));\n}\n.text-slate-500 {\n --tw-text-opacity: 1;\n color: rgb(100 116 139 / var(--tw-text-opacity, 1));\n}\n.text-white {\n --tw-text-opacity: 1;\n color: rgb(255 255 255 / var(--tw-text-opacity, 1));\n}\n.text-yellow-500 {\n --tw-text-opacity: 1;\n color: rgb(234 179 8 / var(--tw-text-opacity, 1));\n}\n.underline {\n text-decoration-line: underline;\n}\n.shadow {\n --tw-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);\n --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.shadow-md {\n --tw-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);\n --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.transition {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n.font-light {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n.font-medium {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n.font-bold {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n@media (min-width: 768px) {\n .sm\\:flex {\n display: flex;\n }\n .sm\\:hidden {\n display: none;\n }\n}\n* {\n margin: 0;\n padding: 0;\n box-sizing: border-box !important;\n 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";
46
+ styleInject(css_248z);
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,78 +1571,21 @@ 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);
1641
- var isMobile = useIsMobile(window);
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 || "");
1588
+ var isMobile = useIsMobile();
1642
1589
  var _c = useState(undefined), branding = _c[0], setBranding = _c[1];
1643
1590
  // ====== START - Copied straight from PageContainer.tsx ========
1644
1591
  var entityBranding = useMemo(function () {
@@ -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; _b.window;
1744
+ var isMobile = useIsMobile();
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
+ useContext(BunnyContext).window;
1911
+ var isMobile = useIsMobile();
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();
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();
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();
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
+ useContext(BunnyContext).window;
2983
+ var isMobile = useIsMobile();
2946
2984
  var _b = useState(false), isSaving = _b[0], setIsSaving = _b[1];
2947
2985
  var queryClient = useQueryClient();
2948
- var isMobile = useIsMobile$1();
2949
- var showSuccessNotification = NotificationUtils.useSuccessNotification();
2950
- var handleAllErrorFormats = NotificationUtils.useAllErrorFormats(function (url) {
2951
- console.log("navigate to", url);
2952
- });
2953
- var _c = useContext(BunnyContext), subdomain = _c.subdomain, token = _c.token;
2986
+ var _c = useContext(BunnyContext), apiHost = _c.apiHost, token = _c.token, onErrorNavigate = _c.onErrorNavigate;
2987
+ var showSuccessNotification = useSuccessNotification();
2988
+ var handleAllErrorFormats = useAllErrorFormats(onErrorNavigate ||
2989
+ (function (url) {
2990
+ console.log("navigate to", url, " not implemented");
2991
+ }));
2954
2992
  // Queries
2955
2993
  var _d = useQuery({
2956
2994
  queryKey: QueryKeyFactory.default.createFormattedInvoiceKey(token, id),
2957
- queryFn: function () { return getFormattedInvoice({ id: id, token: token, subdomain: subdomain }); },
2995
+ queryFn: function () { return getFormattedInvoice({ id: id, token: token, apiHost: apiHost }); },
2958
2996
  }), formattedInvoice = _d.data, error = _d.error;
2959
2997
  if (error) {
2960
2998
  return jsxs("div", { children: ["Error loading invoice: ", error.message] });
@@ -2981,24 +3019,39 @@ function ActualInvoice(_a) {
2981
3019
  };
2982
3020
  // Derived state
2983
3021
  var isInvoicePayable = PAYABLE_INVOICE_STATES.includes((formattedInvoice === null || formattedInvoice === void 0 ? void 0 : formattedInvoice.state) || "");
2984
- return (jsxs(Fragment, { children: [jsxs(Helmet, { children: [jsxs("title", { children: [formattedInvoice.vendorName, " ", DOCUMENT_NAME$1.INVOICE] }), jsx("meta", { name: "description", content: QuoteInvoiceUtils.quoteMetaDescription(formattedInvoice.vendorName) }), jsx("meta", { property: "og:type", content: "website" }), jsx("meta", { property: "og:title", content: QuoteInvoiceUtils.quoteMetaTitle({
3022
+ return (jsxs(Fragment, { children: [jsxs(Helmet, { children: [jsxs("title", { children: [formattedInvoice.vendorName, " ", DOCUMENT_NAME$1.INVOICE] }), jsx("meta", { name: "description", content: quoteMetaDescription(formattedInvoice.vendorName) }), jsx("meta", { property: "og:type", content: "website" }), jsx("meta", { property: "og:title", content: quoteMetaTitle({
2985
3023
  vendorName: formattedInvoice.vendorName,
2986
3024
  documentName: DOCUMENT_NAME$1.INVOICE,
2987
- }) }), jsx("meta", { property: "og:description", content: QuoteInvoiceUtils.quoteMetaDescription(formattedInvoice.vendorName) })] }), jsxs("div", __assign({ className: "flex gap-6 ".concat(isMobile ? "flex-col w-full overflow-hidden" : "shadow-padding-xb") }, { children: [formattedInvoice.isLegacy ? (jsx("div", __assign({ className: "flex justify-center w-full" }, { children: jsx(InvoicePDF, { invoiceUuid: formattedInvoice.uuid, subdomain: subdomain }) }))) : (invoiceQuoteViewComponent || (jsx(InvoiceQuoteView, { html: formattedInvoice.html, isMobile: isMobile, formattedInvoice: formattedInvoice, backButtonName: backButtonName, onBackButtonClick: onBackButtonClick }))), !isMobile && isInvoicePayable && (jsx(Divider, { className: "h-full", type: "vertical" })), isInvoicePayable && (jsx(InvoiceCheckout, { invoice: formattedInvoice, isSaving: isSaving, onFail: function (error) {
3025
+ }) }), jsx("meta", { property: "og:description", content: quoteMetaDescription(formattedInvoice.vendorName) })] }), jsxs("div", __assign({ className: "flex gap-6 ".concat(isMobile ? "flex-col w-full overflow-hidden" : "shadow-padding-xb") }, { children: [formattedInvoice.isLegacy ? (jsx("div", __assign({ className: "flex justify-center w-full" }, { children: jsx(InvoicePDF, { invoiceUuid: formattedInvoice.uuid, apiHost: apiHost }) }))) : (invoiceQuoteViewComponent || (jsx(InvoiceQuoteView, { html: formattedInvoice.html, formattedInvoice: formattedInvoice, backButtonName: backButtonName, onBackButtonClick: onBackButtonClick }))), !isMobile && isInvoicePayable && (jsx(Divider, { className: "h-full", type: "vertical" })), isInvoicePayable && (jsx(InvoiceCheckout, { invoice: formattedInvoice, isSaving: isSaving, onFail: function (error) {
2988
3026
  onFail(error);
2989
3027
  setIsSaving(false);
2990
- }, onSuccess: onSuccess, setIsSaving: setIsSaving }))] }))] }));
3028
+ }, onSuccess: onSuccess, setIsSaving: setIsSaving, entityId: entityId }))] }))] }));
2991
3029
  }
2992
3030
  function Invoice(_a) {
2993
- var id = _a.id, invoiceQuoteViewComponent = _a.invoiceQuoteViewComponent, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick; _a.onInvoiceDownloadError; var onPaymentSuccess = _a.onPaymentSuccess;
2994
- return (jsx(HelmetProvider, { children: jsx(ActualInvoice, { id: id, invoiceQuoteViewComponent: invoiceQuoteViewComponent, backButtonName: backButtonName, onBackButtonClick: onBackButtonClick, onPaymentSuccess: onPaymentSuccess }) }));
3031
+ var id = _a.id, invoiceQuoteViewComponent = _a.invoiceQuoteViewComponent, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick; _a.onInvoiceDownloadError; var onPaymentSuccess = _a.onPaymentSuccess, entityId = _a.entityId;
3032
+ return (jsx(HelmetProvider, { children: jsx(ActualInvoice, { id: id, invoiceQuoteViewComponent: invoiceQuoteViewComponent, backButtonName: backButtonName, onBackButtonClick: onBackButtonClick, onPaymentSuccess: onPaymentSuccess, entityId: entityId }) }));
2995
3033
  }
2996
3034
 
2997
- var DOCUMENT_NAME;
2998
- (function (DOCUMENT_NAME) {
2999
- DOCUMENT_NAME["INVOICE"] = "invoice";
3000
- DOCUMENT_NAME["QUOTE"] = "quote";
3001
- })(DOCUMENT_NAME || (DOCUMENT_NAME = {}));
3035
+ var MUTATION$7 = function (id) { return "\n query formattedQuote ($id: ID) {\n formattedQuote (id: $id) {\n payableId\n acceptedAt\n acceptedByName\n amount\n amountDue\n amountsByPeriod {\n id\n name\n amount\n }\n object { documents { id filename size date url } }\n billingCity\n billingCountry\n billingState\n billingStreet\n billingZip\n contactName\n currency\n customerBillingCity\n customerBillingCountry\n customerBillingState\n customerBillingStreet\n customerBillingZip\n customerName\n discount\n discountValue\n duration\n endDate\n expiresAt\n html\n formattedLines {\n amount\n amountsByPeriod {\n quantity\n id\n name\n startDate\n endDate\n amount\n amountsByTier {\n id\n tier {\n starts\n ends\n price\n }\n quantity\n amount\n }\n prorationRate\n }\n billingPeriodEnd\n billingPeriodStart\n chargeType\n discount\n frequency\n isRamp\n periods\n planName\n position\n price\n priceDecimals\n priceListChargeId\n priceListChargeName\n priceListId\n priceListName\n priceTiers {\n price\n starts\n }\n pricingModel\n productName\n prorationRate\n quantity\n showProductNameOnLineItem\n taxCode\n trialEndDate\n trialStartDate\n unitOfMeasure\n vatCode\n }\n netPaymentDays\n notes\n number\n poNumberRequired\n salesContactEmail\n sharedAt\n startDate\n state\n subtotal\n taxAmount\n taxNumberLabel\n taxNumberRequired\n vendorName\n }\n }"; };
3036
+ var getFormattedQuote = function (_a) {
3037
+ var id = _a.id, token = _a.token, apiHost = _a.apiHost;
3038
+ return __awaiter(void 0, void 0, void 0, function () {
3039
+ var response;
3040
+ return __generator(this, function (_b) {
3041
+ switch (_b.label) {
3042
+ case 0: return [4 /*yield*/, gqlRequest({
3043
+ query: MUTATION$7(),
3044
+ token: token,
3045
+ apiHost: apiHost,
3046
+ vars: { id: id },
3047
+ })];
3048
+ case 1:
3049
+ response = _b.sent();
3050
+ return [2 /*return*/, response === null || response === void 0 ? void 0 : response.formattedQuote];
3051
+ }
3052
+ });
3053
+ });
3054
+ };
3002
3055
 
3003
3056
  var filterSigningPlugins = function (plugins) {
3004
3057
  return plugins === null || plugins === void 0 ? void 0 : plugins.filter(function (plugin) {
@@ -3007,27 +3060,31 @@ var filterSigningPlugins = function (plugins) {
3007
3060
  ((_b = plugin.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === "valid";
3008
3061
  });
3009
3062
  };
3010
- var useSigningPlugins = function (token, subdomain) {
3011
- var plugins = usePlugins({ token: token, subdomain: subdomain });
3063
+ var useSigningPlugins = function (_a) {
3064
+ var entityId = _a.entityId, apiHost = _a.apiHost, token = _a.token;
3065
+ var plugins = usePlugins({ entityId: entityId, apiHost: apiHost, token: token });
3012
3066
  return filterSigningPlugins(plugins.data);
3013
3067
  };
3014
3068
 
3015
- var useSendAcceptQuote = function (token, subdomain, quoteId) {
3069
+ var useSendAcceptQuote = function (_a) {
3070
+ var entityId = _a.entityId, onErrorNavigate = _a.onErrorNavigate, quoteId = _a.quoteId, apiHost = _a.apiHost, token = _a.token;
3016
3071
  // Hooks
3017
- var graphQLMutation = GraphqlUtils.useGraphQLmutation(function () {
3072
+ var graphQLMutation = useGraphQLmutation(function () {
3018
3073
  console.log("navigate in useGraphQLmutation in useSendAcceptQuote is not yet implemented");
3019
- }, subdomain || "", function () {
3074
+ }, apiHost || "", function () {
3020
3075
  console.log("onError in useGraphQLmutation in useSendAcceptQuote is not yet implemented");
3021
3076
  });
3022
- // const handleAllErrorFormats = useAllErrorFormats();
3023
- var signingPlugins = useSigningPlugins(token, subdomain);
3024
- console.log("signingPlugins in useSendAcceptQuote: ", signingPlugins);
3077
+ var handleAllErrorFormats = useAllErrorFormats(onErrorNavigate ||
3078
+ (function (url) {
3079
+ console.log("navigate to", url, " not implemented");
3080
+ }));
3081
+ var signingPlugins = useSigningPlugins({ entityId: entityId, apiHost: apiHost, token: token });
3025
3082
  var queryClient = useQueryClient();
3026
3083
  // Local state
3027
- var _a = useState(false), acceptBoxVisible = _a[0], setAcceptBoxVisible = _a[1];
3028
- var _b = useState(false), isAccepting = _b[0], setIsAccepting = _b[1];
3084
+ var _b = useState(false), acceptBoxVisible = _b[0], setAcceptBoxVisible = _b[1];
3085
+ var _c = useState(false), isAccepting = _c[0], setIsAccepting = _c[1];
3029
3086
  // Pandadoc polling modal state
3030
- var _c = useState(false), pandadocPollingModalVisible = _c[0], setPandadocPollingModalVisible = _c[1];
3087
+ var _d = useState(false), pandadocPollingModalVisible = _d[0], setPandadocPollingModalVisible = _d[1];
3031
3088
  var redirectForSigning = function () {
3032
3089
  var mutation = "mutation quoteSigningUrlCreate($quoteId: ID) {\n quoteSigningUrlCreate(quoteId: $quoteId) {\n redirectUri\n pluginClientId\n pluginShortName\n errors\n }\n }";
3033
3090
  var variables = {
@@ -3040,10 +3097,7 @@ var useSendAcceptQuote = function (token, subdomain, quoteId) {
3040
3097
  console.log("rsp.data.quoteSigningUrlCreate.pluginShortName === 'pandadoc'", rsp.data.quoteSigningUrlCreate.pluginShortName === "pandadoc");
3041
3098
  console.log("rsp", rsp);
3042
3099
  if (rsp.data.quoteSigningUrlCreate.pluginShortName === "dropbox_sign") {
3043
- // openDropboxSignModal(
3044
- // rsp.data.quoteSigningUrlCreate.pluginClientId,
3045
- // rsp.data.quoteSigningUrlCreate.redirectUri
3046
- // );
3100
+ openDropboxSignModal(rsp.data.quoteSigningUrlCreate.pluginClientId, rsp.data.quoteSigningUrlCreate.redirectUri);
3047
3101
  console.log("dropbox sign is not implemented");
3048
3102
  }
3049
3103
  else if (rsp.data.quoteSigningUrlCreate.pluginShortName === "pandadoc") {
@@ -3058,31 +3112,39 @@ var useSendAcceptQuote = function (token, subdomain, quoteId) {
3058
3112
  });
3059
3113
  };
3060
3114
  // TODO: Fix hellosign-embedded window is undefined bug
3061
- // const openDropboxSignModal = async (clientId: string, url: string) => {
3062
- // if (typeof window === "undefined") {
3063
- // return;
3064
- // }
3065
- // const { default: HelloSign } = await import("hellosign-embedded");
3066
- // const client = new HelloSign({
3067
- // clientId: clientId,
3068
- // });
3069
- // client.on("sign", (data: any) => {
3070
- // // Change the UI to show accepted?
3071
- // });
3072
- // // Open the DropboxSign modal
3073
- // client.open(url, {
3074
- // clientId: clientId,
3075
- // skipDomainVerification: false, // Set true for development testing
3076
- // });
3077
- // };
3115
+ var openDropboxSignModal = function (clientId, url) { return __awaiter(void 0, void 0, void 0, function () {
3116
+ var HelloSign, client;
3117
+ return __generator(this, function (_a) {
3118
+ switch (_a.label) {
3119
+ case 0:
3120
+ if (typeof window === "undefined") {
3121
+ return [2 /*return*/];
3122
+ }
3123
+ return [4 /*yield*/, import('hellosign-embedded')];
3124
+ case 1:
3125
+ HelloSign = (_a.sent()).default;
3126
+ client = new HelloSign({
3127
+ clientId: clientId,
3128
+ });
3129
+ client.on("sign", function (data) {
3130
+ // Change the UI to show accepted?
3131
+ });
3132
+ // Open the DropboxSign modal
3133
+ client.open(url, {
3134
+ clientId: clientId,
3135
+ skipDomainVerification: false, // Set true for development testing
3136
+ });
3137
+ return [2 /*return*/];
3138
+ }
3139
+ });
3140
+ }); };
3078
3141
  // TODO: update useing fetch
3079
3142
  var sendAccept = function (changedFormItems) {
3080
3143
  var mutation = "mutation quoteAccept($name: String!, $title: String!, $poNumber: String, $taxNumber: String, $quoteId: ID) {\n quoteAccept(name: $name, title: $title, poNumber: $poNumber, taxNumber: $taxNumber, quoteId: $quoteId) {\n errors\n }\n }";
3081
3144
  var variables = __assign(__assign({}, changedFormItems), { quoteId: quoteId });
3082
3145
  graphQLMutation(token, mutation, variables, function (rsp) {
3083
- // if (rsp.errors) handleAllErrorFormats(rsp.errors);
3084
3146
  if (rsp.errors)
3085
- console.log("rsp.errors", rsp.errors);
3147
+ handleAllErrorFormats(rsp.errors);
3086
3148
  else {
3087
3149
  setAcceptBoxVisible(false);
3088
3150
  queryClient.invalidateQueries({
@@ -3128,45 +3190,6 @@ var useSigningComplete = function (_a) {
3128
3190
  }, [data, eventParam, queryClient, token]);
3129
3191
  };
3130
3192
 
3131
- var ModalOverrideBrandStylings = styled(Modal)(templateObject_1$6 || (templateObject_1$6 = __makeTemplateObject(["\n .ant-modal-content {\n border-radius: 0.75rem;\n overflow: hidden;\n padding: 0 !important;\n }\n .ant-modal-title {\n font-family: ", ";\n }\n .ant-modal-header {\n border-bottom: none;\n padding: 1.5rem 1.5rem 0;\n margin: 0 !important;\n }\n .ant-modal-body {\n padding: 1rem 1.5rem 1.5rem;\n }\n .ant-modal-footer {\n border-top: none;\n padding: 0 1.5rem 1.5rem;\n margin: 0 !important;\n }\n"], ["\n .ant-modal-content {\n border-radius: 0.75rem;\n overflow: hidden;\n padding: 0 !important;\n }\n .ant-modal-title {\n font-family: ", ";\n }\n .ant-modal-header {\n border-bottom: none;\n padding: 1.5rem 1.5rem 0;\n margin: 0 !important;\n }\n .ant-modal-body {\n padding: 1rem 1.5rem 1.5rem;\n }\n .ant-modal-footer {\n border-top: none;\n padding: 0 1.5rem 1.5rem;\n margin: 0 !important;\n }\n"])), MARK_PRO);
3132
- var StyledModal$1 = function (props) {
3133
- return jsx(ModalOverrideBrandStylings, __assign({ closable: false }, props));
3134
- };
3135
- var templateObject_1$6;
3136
-
3137
- var useFocusFirstInput = function (_a) {
3138
- var firstInputRef = _a.firstInputRef, isVisible = _a.isVisible;
3139
- useEffect(function () {
3140
- var _a;
3141
- (_a = firstInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
3142
- }, [isVisible, firstInputRef]);
3143
- };
3144
-
3145
- var AcceptQuoteModal = function (_a) {
3146
- var acceptBoxVisible = _a.acceptBoxVisible, formattedQuote = _a.formattedQuote, sendAccept = _a.sendAccept, setAcceptBoxVisible = _a.setAcceptBoxVisible, setIsAccepting = _a.setIsAccepting;
3147
- // Refs
3148
- var firstInputRef = useRef(null);
3149
- // Hooks
3150
- var form = Form.useForm()[0];
3151
- useFocusFirstInput({ firstInputRef: firstInputRef, isVisible: acceptBoxVisible });
3152
- // Derived state
3153
- var poNumberRequired = formattedQuote.poNumberRequired, taxNumberRequired = formattedQuote.taxNumberRequired, taxNumberLabel = formattedQuote.taxNumberLabel;
3154
- var createRules = function (required, title) {
3155
- return required ? [{ required: true, message: "".concat(title, " is required") }] : [];
3156
- };
3157
- return (jsx(StyledModal$1, __assign({ centered: true, okText: "Accept", onCancel: function () {
3158
- setAcceptBoxVisible(false);
3159
- setIsAccepting(false);
3160
- }, onOk: function () {
3161
- form
3162
- .validateFields()
3163
- .then(function (changedFields) {
3164
- sendAccept(changedFields);
3165
- })
3166
- .catch(function () { });
3167
- }, open: acceptBoxVisible, title: "Accept quote", width: 400 }, { children: jsxs(Form, __assign({ className: "flex flex-col gap-2", form: form, layout: "vertical" }, { children: [jsx(Form.Item, __assign({ label: "Your name", name: "name", rules: createRules(true, "Your name") }, { children: jsx(Input, { autoFocus: true, ref: firstInputRef }) })), jsx(Form.Item, __assign({ label: "Your job title", name: "title", rules: createRules(true, "Your job title") }, { children: jsx(Input, {}) })), jsx(Form.Item, __assign({ label: "Purchase order number", name: "poNumber", rules: createRules(poNumberRequired, "Purchase order number") }, { children: jsx(Input, {}) })), taxNumberRequired && (jsx(Form.Item, __assign({ name: "taxNumber", label: taxNumberLabel, rules: createRules(taxNumberRequired, taxNumberLabel) }, { children: jsx(Input, {}) })))] })) })));
3168
- };
3169
-
3170
3193
  var dayjs_min = {exports: {}};
3171
3194
 
3172
3195
  (function (module, exports) {
@@ -3181,13 +3204,16 @@ var useIsExpired = function (expiresAt) {
3181
3204
 
3182
3205
  var PandadocPollingModal = function (_a) {
3183
3206
  var isVisible = _a.isVisible, setVisible = _a.setVisible, id = _a.id;
3184
- var _b = useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain;
3185
- var graphQLMutation = GraphqlUtils.useGraphQLmutation(function () {
3207
+ var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, onErrorNavigate = _b.onErrorNavigate;
3208
+ var graphQLMutation = useGraphQLmutation(function () {
3186
3209
  console.log("graphQLMutation navigateOnTokenExpired not yet implemented");
3187
- }, subdomain || "", function () {
3210
+ }, apiHost || "", function () {
3188
3211
  console.log("graphQLMutation onError not yet implemented");
3189
3212
  });
3190
- var handleAllErrorFormats = NotificationUtils.useAllErrorFormats(function () { });
3213
+ var handleAllErrorFormats = useAllErrorFormats(onErrorNavigate ||
3214
+ (function (url) {
3215
+ console.log("navigate to", url, " not implemented");
3216
+ }));
3191
3217
  var _c = useState(0), numberOfPolls = _c[0], setNumberOfPolls = _c[1];
3192
3218
  var _d = useState(""), infoMessage = _d[0], setInfoMessage = _d[1];
3193
3219
  useEffect(function () {
@@ -3222,80 +3248,109 @@ var PandadocPollingModal = function (_a) {
3222
3248
  return (jsxs(Modal, __assign({ title: "Uploading quote to Pandadoc", open: isVisible, closable: false, footer: null }, { children: [jsxs("div", __assign({ className: "py-4 text-center" }, { children: ["This may take a few seconds", ".".repeat(numberOfPolls)] })), jsx("div", __assign({ className: "text-center" }, { children: infoMessage }))] })));
3223
3249
  };
3224
3250
 
3225
- var MUTATION$6 = function (id) { return "\n query formattedQuote ($id: ID) {\n formattedQuote (id: $id) {\n payableId\n acceptedAt\n acceptedByName\n amount\n amountDue\n amountsByPeriod {\n id\n name\n amount\n }\n object { documents { id filename size date url } }\n billingCity\n billingCountry\n billingState\n billingStreet\n billingZip\n contactName\n currency\n customerBillingCity\n customerBillingCountry\n customerBillingState\n customerBillingStreet\n customerBillingZip\n customerName\n discount\n discountValue\n duration\n endDate\n expiresAt\n html\n formattedLines {\n amount\n amountsByPeriod {\n quantity\n id\n name\n startDate\n endDate\n amount\n amountsByTier {\n id\n tier {\n starts\n ends\n price\n }\n quantity\n amount\n }\n prorationRate\n }\n billingPeriodEnd\n billingPeriodStart\n chargeType\n discount\n frequency\n isRamp\n periods\n planName\n position\n price\n priceDecimals\n priceListChargeId\n priceListChargeName\n priceListId\n priceListName\n priceTiers {\n price\n starts\n }\n pricingModel\n productName\n prorationRate\n quantity\n showProductNameOnLineItem\n taxCode\n trialEndDate\n trialStartDate\n unitOfMeasure\n vatCode\n }\n netPaymentDays\n notes\n number\n poNumberRequired\n salesContactEmail\n sharedAt\n startDate\n state\n subtotal\n taxAmount\n taxNumberLabel\n taxNumberRequired\n vendorName\n }\n }"; };
3226
- var getFormattedQuote = function (_a) {
3227
- var id = _a.id, token = _a.token, subdomain = _a.subdomain;
3228
- return __awaiter(void 0, void 0, void 0, function () {
3229
- var response;
3230
- return __generator(this, function (_b) {
3231
- switch (_b.label) {
3232
- case 0: return [4 /*yield*/, gqlRequest({
3233
- query: MUTATION$6(),
3234
- token: token,
3235
- subdomain: subdomain,
3236
- vars: { id: id },
3237
- })];
3238
- case 1:
3239
- response = _b.sent();
3240
- return [2 /*return*/, response === null || response === void 0 ? void 0 : response.formattedQuote];
3241
- }
3242
- });
3243
- });
3251
+ var ModalOverrideBrandStylings = styled(Modal)(templateObject_1$5 || (templateObject_1$5 = __makeTemplateObject(["\n .ant-modal-content {\n border-radius: 0.75rem;\n overflow: hidden;\n padding: 0 !important;\n }\n .ant-modal-title {\n font-family: ", ";\n }\n .ant-modal-header {\n border-bottom: none;\n padding: 1.5rem 1.5rem 0;\n margin: 0 !important;\n }\n .ant-modal-body {\n padding: 1rem 1.5rem 1.5rem;\n }\n .ant-modal-footer {\n border-top: none;\n padding: 0 1.5rem 1.5rem;\n margin: 0 !important;\n }\n"], ["\n .ant-modal-content {\n border-radius: 0.75rem;\n overflow: hidden;\n padding: 0 !important;\n }\n .ant-modal-title {\n font-family: ", ";\n }\n .ant-modal-header {\n border-bottom: none;\n padding: 1.5rem 1.5rem 0;\n margin: 0 !important;\n }\n .ant-modal-body {\n padding: 1rem 1.5rem 1.5rem;\n }\n .ant-modal-footer {\n border-top: none;\n padding: 0 1.5rem 1.5rem;\n margin: 0 !important;\n }\n"])), MARK_PRO);
3252
+ var StyledModal$1 = function (props) {
3253
+ return jsx(ModalOverrideBrandStylings, __assign({ closable: false }, props));
3244
3254
  };
3255
+ var templateObject_1$5;
3245
3256
 
3246
- var documentName = DOCUMENT_NAME.QUOTE;
3247
- function ActualQuote(_a) {
3248
- var _b, _c;
3249
- var id = _a.id;
3250
- var _d = useContext(BunnyContext), token = _d.token, subdomain = _d.subdomain;
3251
- var entityBranding = useContext(BrandContext);
3252
- var isMobile = useIsMobile$1();
3253
- // Queries
3254
- var _e = useQuery({
3255
- queryKey: QueryKeyFactory.default.createQuoteKey(token, id),
3256
- queryFn: function () { return getFormattedQuote({ token: token, subdomain: subdomain, id: id }); },
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 = {}));
3295
+
3296
+ var documentName = DOCUMENT_NAME.QUOTE;
3297
+ function ActualQuote(_a) {
3298
+ var _b, _c;
3299
+ var id = _a.id, entityId = _a.entityId;
3300
+ var _d = useContext(BunnyContext), token = _d.token, apiHost = _d.apiHost, onErrorNavigate = _d.onErrorNavigate;
3301
+ var entityBranding = useContext(BrandContext);
3302
+ var isMobile = useIsMobile();
3303
+ // Queries
3304
+ var _e = useQuery({
3305
+ queryKey: QueryKeyFactory.default.createQuoteKey(token, id),
3306
+ queryFn: function () { return getFormattedQuote({ token: token, apiHost: apiHost, id: id }); },
3257
3307
  placeholderData: keepPreviousData,
3258
3308
  }), data = _e.data, isLoading = _e.isLoading;
3259
- useQuery({
3260
- queryKey: QueryKeyFactory.default.currentUserKey,
3261
- queryFn: function () { return getCurrentUserData({ token: token, subdomain: subdomain }); },
3262
- });
3263
3309
  var formattedQuote = data;
3264
3310
  // Hooks
3265
3311
  var downloadFile = useDownloadFile(id);
3266
3312
  var isExpired = useIsExpired(formattedQuote === null || formattedQuote === void 0 ? void 0 : formattedQuote.expiresAt);
3267
- var _f = useSendAcceptQuote(token, subdomain, id), acceptBoxVisible = _f.acceptBoxVisible, isAccepting = _f.isAccepting, sendAccept = _f.sendAccept, setAcceptBoxVisible = _f.setAcceptBoxVisible, setIsAccepting = _f.setIsAccepting, startAcceptance = _f.startAcceptance, pandadocPollingModalVisible = _f.pandadocPollingModalVisible, setPandadocPollingModalVisible = _f.setPandadocPollingModalVisible;
3313
+ var _f = useSendAcceptQuote({
3314
+ entityId: entityId,
3315
+ token: token,
3316
+ onErrorNavigate: onErrorNavigate ||
3317
+ (function (url) {
3318
+ console.log("navigate to", url, " not implemented");
3319
+ }),
3320
+ apiHost: apiHost,
3321
+ quoteId: id,
3322
+ }), acceptBoxVisible = _f.acceptBoxVisible, isAccepting = _f.isAccepting, sendAccept = _f.sendAccept, setAcceptBoxVisible = _f.setAcceptBoxVisible, setIsAccepting = _f.setIsAccepting, startAcceptance = _f.startAcceptance, pandadocPollingModalVisible = _f.pandadocPollingModalVisible, setPandadocPollingModalVisible = _f.setPandadocPollingModalVisible;
3268
3323
  useSigningComplete({ data: formattedQuote, token: token });
3269
3324
  if (!formattedQuote || isLoading) {
3270
3325
  return jsx(Fragment, {});
3271
3326
  }
3272
- return (jsxs(Fragment, { children: [jsxs(Helmet, { children: [jsxs("title", { children: [formattedQuote.vendorName, " ", documentName] }), jsx("meta", { name: "description", content: QuoteInvoiceUtils.quoteMetaDescription(formattedQuote.vendorName) }), jsx("meta", { property: "og:type", content: "website" }), jsx("meta", { property: "og:title", content: QuoteInvoiceUtils.quoteMetaTitle({
3327
+ return (jsxs(Fragment, { children: [jsxs(Helmet, { children: [jsxs("title", { children: [formattedQuote.vendorName, " ", documentName] }), jsx("meta", { name: "description", content: quoteMetaDescription(formattedQuote.vendorName) }), jsx("meta", { property: "og:type", content: "website" }), jsx("meta", { property: "og:title", content: quoteMetaTitle({
3273
3328
  vendorName: formattedQuote.vendorName,
3274
3329
  documentName: documentName,
3275
- }) }), jsx("meta", { property: "og:description", content: QuoteInvoiceUtils.quoteMetaDescription(formattedQuote.vendorName) })] }), jsxs("div", __assign({ className: "flex shadow-padding-x ".concat(isMobile ? "flex-col gap-1" : "items-center gap-2", " justify-end pb-4"), id: "acceptance", style: {
3330
+ }) }), jsx("meta", { property: "og:description", content: quoteMetaDescription(formattedQuote.vendorName) })] }), jsxs("div", __assign({ className: "flex shadow-padding-x ".concat(isMobile ? "flex-col gap-1" : "items-center gap-2", " justify-end pb-4"), id: "acceptance", style: {
3276
3331
  color: entityBranding.secondaryColor,
3277
3332
  } }, { children: [formattedQuote.state === "ACCEPTED" ||
3278
3333
  formattedQuote.state === "APPLIED" ? (jsxs("div", { children: [formattedQuote.state === "ACCEPTED" &&
3279
3334
  formattedQuote.acceptedAt &&
3280
- "Quote was accepted by ".concat(formattedQuote.acceptedByName, " on ").concat(Misc.formatDate(formattedQuote.acceptedAt)), formattedQuote.state === "APPLIED" &&
3335
+ "Quote was accepted by ".concat(formattedQuote.acceptedByName, " on ").concat(formatDate(formattedQuote.acceptedAt)), formattedQuote.state === "APPLIED" &&
3281
3336
  formattedQuote.acceptedAt &&
3282
- "Quote is now applied. Accepted by ".concat(formattedQuote.acceptedByName, " on ").concat(Misc.formatDate(formattedQuote.acceptedAt))] })) : null, jsxs("div", __assign({ className: isMobile
3337
+ "Quote is now applied. Accepted by ".concat(formattedQuote.acceptedByName, " on ").concat(formatDate(formattedQuote.acceptedAt))] })) : null, jsxs("div", __assign({ className: isMobile
3283
3338
  ? "flex w-full justify-between gap-2"
3284
- : "flex items-center justify-end gap-2" }, { children: [!isMobile ? (jsx(Button, __assign({ icon: jsx(DownloadOutlined$1, {}), onClick: function () { return downloadFile(subdomain + "/api/pdf/quote", token); } }, { children: "Download" }))) : null, formattedQuote.state !== "ACCEPTED" &&
3285
- formattedQuote.state !== "APPLIED" ? (jsx(Button, __assign({ disabled: isExpired || isAccepting, onClick: function () { return startAcceptance(); }, type: "primary" }, { children: isExpired ? "Quote is expired" : "Accept quote" }))) : null] }))] })), jsx("div", __assign({ className: "flex ".concat(isMobile ? "flex-col w-full overflow-hidden" : "shadow-padding-xb") }, { children: jsx(InvoiceQuoteView, __assign({ html: formattedQuote.html, isMobile: isMobile }, { children: ((_c = (_b = formattedQuote.object) === null || _b === void 0 ? void 0 : _b.documents) === null || _c === void 0 ? void 0 : _c.length) > 0 ? (jsx("div", __assign({ className: "flex flex-col items-end" }, { children: formattedQuote.object.documents.map(function (doc, index) {
3339
+ : "flex items-center justify-end gap-2" }, { children: [!isMobile ? (jsx(Button, __assign({ icon: jsx(DownloadOutlined$1, {}), onClick: function () { return downloadFile(apiHost + "/api/pdf/quote", token); } }, { children: "Download" }))) : null, formattedQuote.state !== "ACCEPTED" &&
3340
+ formattedQuote.state !== "APPLIED" ? (jsx(Button, __assign({ disabled: isExpired || isAccepting, onClick: function () { return startAcceptance(); }, type: "primary" }, { children: isExpired ? "Quote is expired" : "Accept quote" }))) : null] }))] })), jsx("div", __assign({ className: "flex ".concat(isMobile ? "flex-col w-full overflow-hidden" : "shadow-padding-xb") }, { children: jsx(InvoiceQuoteView, __assign({ html: formattedQuote.html }, { children: ((_c = (_b = formattedQuote.object) === null || _b === void 0 ? void 0 : _b.documents) === null || _c === void 0 ? void 0 : _c.length) > 0 ? (jsx("div", __assign({ className: "flex flex-col items-end" }, { children: formattedQuote.object.documents.map(function (doc, index) {
3286
3341
  return (jsx(Button, __assign({ download: doc.filename, href: doc.url, type: "link" }, { children: doc.filename }), index));
3287
3342
  }) }))) : null })) })), jsx(AcceptQuoteModal, { acceptBoxVisible: acceptBoxVisible, formattedQuote: formattedQuote, setAcceptBoxVisible: setAcceptBoxVisible, setIsAccepting: setIsAccepting, sendAccept: sendAccept }), jsx(PandadocPollingModal, { isVisible: pandadocPollingModalVisible, setVisible: setPandadocPollingModalVisible, id: id })] }));
3288
3343
  }
3289
- styled.div(templateObject_1$5 || (templateObject_1$5 = __makeTemplateObject(["\n span {\n width: 100%;\n }\n"], ["\n span {\n width: 100%;\n }\n"])));
3344
+ styled.div(templateObject_1$4 || (templateObject_1$4 = __makeTemplateObject(["\n span {\n width: 100%;\n }\n"], ["\n span {\n width: 100%;\n }\n"])));
3290
3345
  function Quote(_a) {
3291
- var id = _a.id;
3292
- return (jsx(HelmetProvider, { children: jsx(ActualQuote, { id: id }) }));
3346
+ var entityId = _a.entityId, id = _a.id;
3347
+ return (jsx(HelmetProvider, { children: jsx(ActualQuote, { entityId: entityId, id: id }) }));
3293
3348
  }
3294
- var templateObject_1$5;
3349
+ var templateObject_1$4;
3295
3350
 
3296
3351
  var QUOTES_QUERY = function (filter) { return "\n query quotes {\n quotes ".concat(filter ? "(".concat(filter, ")") : "", " {\n pageInfo {\n startCursor\n endCursor\n hasNextPage\n hasPreviousPage\n }\n nodes {\n id\n name\n account {\n name\n id\n }\n applicationDate\n state\n createdAt\n expiresAt\n currencyId\n amount\n number\n }\n }\n }"); };
3297
3352
  var getQuotes = function (_a) {
3298
- var token = _a.token, subdomain = _a.subdomain, filter = _a.filter;
3353
+ var token = _a.token, apiHost = _a.apiHost, filter = _a.filter;
3299
3354
  return __awaiter(void 0, void 0, void 0, function () {
3300
3355
  var response;
3301
3356
  return __generator(this, function (_b) {
@@ -3304,7 +3359,7 @@ var getQuotes = function (_a) {
3304
3359
  query: QUOTES_QUERY(filter),
3305
3360
  token: token,
3306
3361
  vars: {},
3307
- subdomain: subdomain,
3362
+ apiHost: apiHost,
3308
3363
  })];
3309
3364
  case 1:
3310
3365
  response = _b.sent();
@@ -3315,12 +3370,12 @@ var getQuotes = function (_a) {
3315
3370
  };
3316
3371
 
3317
3372
  var transactionMutation = function (filter) { return "\nquery transactions {\n transactions ".concat(filter ? "(".concat(filter, ")") : "", " {\n nodes {\n amount\n createdAt\n currencyId\n description\n id\n kind\n state\n transactionableId\n transactionable {\n ...on Payment { amount }\n ...on Invoice { amount number }\n }\n }\n }\n}"); };
3318
- var getTransactions = function (filter, token, subdomain, kindsToShow) { return __awaiter(void 0, void 0, void 0, function () {
3373
+ var getTransactions = function (filter, token, apiHost, kindsToShow) { return __awaiter(void 0, void 0, void 0, function () {
3319
3374
  var response, _a, data, errors, transactions;
3320
3375
  var _b, _c;
3321
3376
  return __generator(this, function (_d) {
3322
3377
  switch (_d.label) {
3323
- case 0: return [4 /*yield*/, fetch(subdomain + "/graphql", {
3378
+ case 0: return [4 /*yield*/, fetch(apiHost + "/graphql", {
3324
3379
  method: "POST",
3325
3380
  headers: {
3326
3381
  "Content-type": "application/json; charset=utf-8",
@@ -3344,25 +3399,10 @@ var getTransactions = function (filter, token, subdomain, kindsToShow) { return
3344
3399
  });
3345
3400
  }); };
3346
3401
 
3347
- var pageContentRefState = atom({
3348
- key: "pageContentRefState",
3349
- default: undefined,
3350
- });
3351
-
3352
- var PageContent = function (_a) {
3353
- var children = _a.children, className = _a.className, style = _a.style;
3354
- var pageContentRef = useRef(null);
3355
- var setPageContentRef = useSetRecoilState(pageContentRefState);
3356
- useEffect(function () {
3357
- setPageContentRef(pageContentRef === null || pageContentRef === void 0 ? void 0 : pageContentRef.current);
3358
- }, [pageContentRef, setPageContentRef]);
3359
- return (jsx("div", __assign({ className: className, ref: pageContentRef, style: style }, { children: children })));
3360
- };
3361
-
3362
3402
  var Text$b = Typography.Text;
3363
3403
  var PageHeaderWithActions = function (_a) {
3364
3404
  var children = _a.children, title = _a.title;
3365
- var isMobile = useIsMobile$1();
3405
+ var isMobile = useIsMobile();
3366
3406
  return (jsxs("div", __assign({ className: "flex pb-4 shadow-padding-x ".concat(isMobile ? "flex-col gap-2" : "items-center justify-between h-8") }, { children: [jsx(PageSubTitle, { title: title }), children] })));
3367
3407
  };
3368
3408
  var PageSubTitle = function (_a) {
@@ -3402,31 +3442,12 @@ var getColor = function (state) {
3402
3442
  }
3403
3443
  };
3404
3444
 
3405
- var TransactionGridCell = styled.div.withConfig({
3406
- shouldForwardProp: function (prop) {
3407
- return !["gridColumn", "padding", "right"].includes(prop);
3408
- },
3409
- })(templateObject_1$4 || (templateObject_1$4 = __makeTemplateObject(["\n ", "\n\n display: flex;\n align-items: center;\n justify-content: ", ";\n\n text-align: ", ";\n white-space: nowrap;\n font-size: 14px;\n color: ", ";\n\n background-color: inherit;\n\n padding: 1rem;\n min-width: 48px;\n"], ["\n ", "\n\n display: flex;\n align-items: center;\n justify-content: ", ";\n\n text-align: ", ";\n white-space: nowrap;\n font-size: 14px;\n color: ", ";\n\n background-color: inherit;\n\n padding: 1rem;\n min-width: 48px;\n"])), function (props) { return props.gridColumn && "grid-column: ".concat(props.gridColumn, ";"); }, function (props) { return (props.right ? "flex-end" : "flex-start"); }, function (props) { return (props.right ? "right" : "left"); }, SLATE_600);
3410
- var templateObject_1$4;
3445
+ var TransactionsListContext = createContext({});
3411
3446
 
3412
3447
  var Text$a = Typography.Text;
3413
3448
  var TransactionDate = function (_a) {
3414
3449
  var date = _a.date;
3415
- return jsx(Text$a, __assign({ className: "text-sm" }, { children: Misc.formatDate(date) }));
3416
- };
3417
-
3418
- var isInvoice = function (transaction) {
3419
- return transaction.kind === "INVOICE";
3420
- };
3421
- var isQuote = function (transaction) {
3422
- return transaction.kind === "QUOTE";
3423
- };
3424
- var TransactionRowTitle = function (_a) {
3425
- var transaction = _a.transaction;
3426
- if (!isInvoice(transaction) && !isQuote(transaction)) {
3427
- return jsx(Fragment, {});
3428
- }
3429
- return (jsx("span", __assign({ className: "text-slate-400", style: { fontSize: "11px" } }, { children: transaction.transactionable.number })));
3450
+ return jsx(Text$a, __assign({ className: "text-sm" }, { children: formatDate(date) }));
3430
3451
  };
3431
3452
 
3432
3453
  // TODO: delete
@@ -3435,18 +3456,16 @@ var ArrowDownToLine = function (_a) {
3435
3456
  return (jsxs("svg", __assign({ className: className, fill: "none", height: "16", viewBox: "0 0 16 16", width: "16", xmlns: "http://www.w3.org/2000/svg" }, { children: [jsx("path", { d: "M8 11.3333V2", stroke: color, strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), jsx("path", { d: "M4 7.33301L8 11.333L12 7.33301", stroke: color, strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), jsx("path", { d: "M12.6654 14H3.33203", stroke: color, strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })] })));
3436
3457
  };
3437
3458
 
3438
- var TransactionsListContext = createContext({});
3439
-
3440
3459
  var TransactionDownload = function (_a) {
3441
- var transaction = _a.transaction, token = _a.token, subdomain = _a.subdomain;
3460
+ var transaction = _a.transaction, token = _a.token, apiHost = _a.apiHost;
3442
3461
  var darkMode = useContext(BunnyContext).darkMode;
3443
3462
  var downloadTransactionLink = useContext(TransactionsListContext).downloadTransactionLink;
3444
3463
  var downloadFile = useDownloadFile();
3445
- var isMobile = useIsMobile$1();
3464
+ var isMobile = useIsMobile();
3446
3465
  var isClickable = transaction.kind === "INVOICE" || downloadTransactionLink !== undefined;
3447
3466
  var downloadLink = downloadTransactionLink
3448
3467
  ? downloadTransactionLink(transaction.transactionableId)
3449
- : "".concat(subdomain, "/api/pdf/invoice/").concat(transaction.transactionableId);
3468
+ : "".concat(apiHost, "/api/pdf/invoice/").concat(transaction.transactionableId);
3450
3469
  if (!isClickable)
3451
3470
  return null;
3452
3471
  return (jsx("div", __assign({ onClick: function (e) {
@@ -3455,76 +3474,38 @@ var TransactionDownload = function (_a) {
3455
3474
  } }, { children: jsx(ArrowDownToLine, { className: "".concat(isMobile ? "" : "show-on-hover"), color: darkMode ? WHITE : SLATE_600 }) })));
3456
3475
  };
3457
3476
 
3477
+ var TransactionGridCell = styled.div.withConfig({
3478
+ shouldForwardProp: function (prop) {
3479
+ return !["gridColumn", "padding", "right"].includes(prop);
3480
+ },
3481
+ })(templateObject_1$3 || (templateObject_1$3 = __makeTemplateObject(["\n ", "\n\n display: flex;\n align-items: center;\n justify-content: ", ";\n\n text-align: ", ";\n white-space: nowrap;\n font-size: 14px;\n color: ", ";\n\n background-color: inherit;\n\n padding: 1rem;\n min-width: 48px;\n"], ["\n ", "\n\n display: flex;\n align-items: center;\n justify-content: ", ";\n\n text-align: ", ";\n white-space: nowrap;\n font-size: 14px;\n color: ", ";\n\n background-color: inherit;\n\n padding: 1rem;\n min-width: 48px;\n"])), function (props) { return props.gridColumn && "grid-column: ".concat(props.gridColumn, ";"); }, function (props) { return (props.right ? "flex-end" : "flex-start"); }, function (props) { return (props.right ? "right" : "left"); }, SLATE_600);
3482
+ var templateObject_1$3;
3483
+
3458
3484
  var Text$9 = Typography.Text;
3459
3485
  var TransactionsEmptyState = function () {
3460
3486
  var noTransactionsMessage = useContext(TransactionsListContext).noTransactionsMessage;
3461
3487
  return (jsx(Text$9, __assign({ className: "flex justify-center p-4 text-base" }, { children: noTransactionsMessage || "There are no transactions" })));
3462
3488
  };
3463
3489
 
3464
- function capitalizeFirstLetter(string) {
3465
- return string.charAt(0).toUpperCase() + string.slice(1);
3466
- }
3467
- var WARREN_STATE_LS_KEY = "warrenState";
3468
- var CURRENT_WARREN_ID_LS_KEY = "currentWarrenId";
3469
- var getIsCapacitorApp = function () {
3470
- var isAndroid = window.location.origin === "http://localhost";
3471
- var isIOS = window.location.protocol === "capacitor:";
3472
- return isAndroid || isIOS;
3473
- };
3474
- var getLocalStorageSubdomain = function () {
3475
- var warrenState = JSON.parse(window.localStorage.getItem(WARREN_STATE_LS_KEY) || "{}");
3476
- var subdomain = warrenState[CURRENT_WARREN_ID_LS_KEY];
3477
- if (!subdomain) {
3478
- console.warn("ERROR_MESSAGE_NO_SUBDOMAIN_DEFINED");
3479
- //throw new Error(ERROR_MESSAGE_NO_SUBDOMAIN_DEFINED);
3480
- }
3481
- return subdomain;
3482
- };
3483
- var getApiHost = function (subdomain) {
3484
- var isLocalHost = window.location.href.indexOf(".internal") > 0;
3485
- var sub = subdomain || getLocalStorageSubdomain();
3486
- if (getIsCapacitorApp()) {
3487
- return isLocalHost || process.env.REACT_APP_IS_INTERNAL === "true"
3488
- ? "https://".concat(sub, ".bunny.internal")
3489
- : "https://".concat(sub, ".").concat(process.env.REACT_APP_ROOT_DOMAIN);
3490
- }
3491
- return "";
3490
+ var isInvoice = function (transaction) {
3491
+ return transaction.kind === "INVOICE";
3492
3492
  };
3493
- var getGraphQLBase = function () {
3494
- if (getIsCapacitorApp()) {
3495
- return "".concat(getApiHost(), "/graphql");
3496
- }
3497
- return "/graphql";
3493
+ var isQuote = function (transaction) {
3494
+ return transaction.kind === "QUOTE";
3498
3495
  };
3499
- var createRequestHeaders = function (token) {
3500
- var bearerToken = "Bearer ".concat(token);
3501
- var headers = {
3502
- "Content-type": "application/json; charset=utf-8",
3503
- };
3504
- headers["Authorization"] = bearerToken;
3505
- return headers;
3496
+ var TransactionRowTitle = function (_a) {
3497
+ var transaction = _a.transaction;
3498
+ if (!isInvoice(transaction) && !isQuote(transaction)) {
3499
+ return jsx(Fragment, {});
3500
+ }
3501
+ return (jsx("span", __assign({ className: "text-slate-400", style: { fontSize: "11px" } }, { children: transaction.transactionable.number })));
3506
3502
  };
3507
- var useGraphQLRequest = function () { return function (query, token, variables) { return __awaiter(void 0, void 0, void 0, function () {
3508
- var error_1;
3509
- return __generator(this, function (_a) {
3510
- switch (_a.label) {
3511
- case 0:
3512
- _a.trys.push([0, 2, , 3]);
3513
- return [4 /*yield*/, request(getGraphQLBase(), query, variables, createRequestHeaders(token))];
3514
- case 1: return [2 /*return*/, _a.sent()];
3515
- case 2:
3516
- error_1 = _a.sent();
3517
- throw error_1;
3518
- case 3: return [2 /*return*/];
3519
- }
3520
- });
3521
- }); }; };
3522
3503
 
3523
3504
  var Text$8 = Typography.Text;
3524
3505
  var TransactionsListDesktop = function (_a) {
3525
3506
  var transactions = _a.transactions, onTransactionClick = _a.onTransactionClick;
3526
3507
  var columns = useContext(TransactionsListContext).columns;
3527
- var _b = useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain, darkMode = _b.darkMode;
3508
+ var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, darkMode = _b.darkMode;
3528
3509
  var showAmount = columns.includes("amount");
3529
3510
  var showDateAndTitle = columns.includes("date-and-title");
3530
3511
  var showDownload = columns.includes("download");
@@ -3540,7 +3521,7 @@ var TransactionsListDesktop = function (_a) {
3540
3521
  backgroundColor: index % 2 === 0
3541
3522
  ? "var(--row-background".concat(darkMode ? "-dark" : "", ")")
3542
3523
  : "var(--row-background-alternate".concat(darkMode ? "-dark" : "", ")"),
3543
- } }, { children: [showDateAndTitle && (jsxs(Fragment, { children: [jsx(TransactionGridCell, __assign({ right: false }, { children: jsx(TransactionDate, { date: transaction.createdAt }) })), jsxs(TransactionGridCell, __assign({ right: false, className: "flex items-center gap-2" }, { children: [jsx(Text$8, { children: capitalizeFirstLetter(transaction.kind.toLowerCase()) }), jsx(TransactionRowTitle, { transaction: transaction })] }))] })), showDownload && (jsx(TransactionGridCell, { children: jsx(TransactionDownload, { transaction: transaction, token: token, subdomain: subdomain }) })), showState && (jsx(TransactionGridCell, __assign({ right: true }, { children: jsx(StateTag, { state: transaction.state }) }))), showAmount && (jsx(TransactionGridCell, __assign({ right: true }, { children: jsx(Text$8, { children: Misc.formatCurrency(((_a = transaction === null || transaction === void 0 ? void 0 : transaction.transactionable) === null || _a === void 0 ? void 0 : _a.amount) || transaction.amount, transaction.currencyId) }) })))] }), index));
3524
+ } }, { children: [showDateAndTitle && (jsxs(Fragment, { children: [jsx(TransactionGridCell, __assign({ right: false }, { children: jsx(TransactionDate, { date: transaction.createdAt }) })), jsxs(TransactionGridCell, __assign({ right: false, className: "flex items-center gap-2" }, { children: [jsx(Text$8, { children: capitalize(transaction.kind.toLowerCase()) }), jsx(TransactionRowTitle, { transaction: transaction })] }))] })), showDownload && (jsx(TransactionGridCell, { children: jsx(TransactionDownload, { transaction: transaction, token: token, apiHost: apiHost }) })), showState && (jsx(TransactionGridCell, __assign({ right: true }, { children: jsx(StateTag, { state: transaction.state }) }))), showAmount && (jsx(TransactionGridCell, __assign({ right: true }, { children: jsx(Text$8, { children: formatCurrency(((_a = transaction === null || transaction === void 0 ? void 0 : transaction.transactionable) === null || _a === void 0 ? void 0 : _a.amount) || transaction.amount, transaction.currencyId) }) })))] }), index));
3544
3525
  });
3545
3526
  };
3546
3527
 
@@ -3548,7 +3529,7 @@ var Text$7 = Typography.Text;
3548
3529
  var TransactionsListMobile = function (_a) {
3549
3530
  var transactions = _a.transactions, onTransactionClick = _a.onTransactionClick;
3550
3531
  var columns = useContext(TransactionsListContext).columns;
3551
- var _b = useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain, darkMode = _b.darkMode;
3532
+ var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, darkMode = _b.darkMode;
3552
3533
  var showAmount = columns.includes("amount");
3553
3534
  var showDateAndTitle = columns.includes("date-and-title");
3554
3535
  var showDownload = columns.includes("download");
@@ -3563,19 +3544,17 @@ var TransactionsListMobile = function (_a) {
3563
3544
  backgroundColor: index % 2 === 0
3564
3545
  ? "var(--row-background".concat(darkMode ? "-dark" : "", ")")
3565
3546
  : "var(--row-background-alternate".concat(darkMode ? "-dark" : "", ")"),
3566
- } }, { children: [jsx(TransactionGridCell, { children: jsxs("div", __assign({ className: "flex flex-col gap-2" }, { children: [jsxs("div", __assign({ className: "flex items-center gap-2" }, { children: [showDateAndTitle && (jsxs(Fragment, { children: [jsx(Text$7, { children: capitalizeFirstLetter(transaction.kind.toLowerCase()) }), jsx(TransactionRowTitle, { transaction: transaction })] })), showState && jsx(StateTag, { state: transaction.state })] })), jsxs("div", __assign({ className: "flex items-center gap-2" }, { children: [showDateAndTitle && (jsx(TransactionDate, { date: transaction.createdAt })), showAmount && showDateAndTitle && jsx(Text$7, { children: "\u00B7" }), showAmount && (jsx(Text$7, { children: Misc.formatCurrency(transaction.transactionable.amount || transaction.amount, transaction.currencyId) }))] }))] })) }), showDownload && (jsx(TransactionGridCell, __assign({ right: true }, { children: jsx(TransactionDownload, { transaction: transaction, token: token, subdomain: subdomain }) })))] }), index));
3547
+ } }, { children: [jsx(TransactionGridCell, { children: jsxs("div", __assign({ className: "flex flex-col gap-2" }, { children: [jsxs("div", __assign({ className: "flex items-center gap-2" }, { children: [showDateAndTitle && (jsxs(Fragment, { children: [jsx(Text$7, { children: capitalize(transaction.kind.toLowerCase()) }), jsx(TransactionRowTitle, { transaction: transaction })] })), showState && jsx(StateTag, { state: transaction.state })] })), jsxs("div", __assign({ className: "flex items-center gap-2" }, { children: [showDateAndTitle && (jsx(TransactionDate, { date: transaction.createdAt })), showAmount && showDateAndTitle && jsx(Text$7, { children: "\u00B7" }), showAmount && (jsx(Text$7, { children: formatCurrency(transaction.transactionable.amount || transaction.amount, transaction.currencyId) }))] }))] })) }), showDownload && (jsx(TransactionGridCell, __assign({ right: true }, { children: jsx(TransactionDownload, { transaction: transaction, token: token, apiHost: apiHost }) })))] }), index));
3567
3548
  });
3568
3549
  };
3569
3550
 
3570
- // Create a client
3571
- var queryClient = new QueryClient();
3572
3551
  function Transactions(_a) {
3573
3552
  var transactionComponent = _a.transactionComponent, _b = _a.showSearchBar, showSearchBar = _b === void 0 ? true : _b, _c = _a.showTitle, showTitle = _c === void 0 ? true : _c, _d = _a.columns, columns = _d === void 0 ? ["date-and-title", "state", "amount"] : _d, className = _a.className, _e = _a.shadow, shadow = _e === void 0 ? "md" : _e, searchBarClassName = _a.searchBarClassName, _f = _a.useModal, useModal = _f === void 0 ? false : _f, onTransactionClick = _a.onTransactionClick, _g = _a.suppressTransactionDisplay, suppressTransactionDisplay = _g === void 0 ? false : _g, _h = _a.kindsToShow, kindsToShow = _h === void 0 ? [
3574
3553
  TransactionKind.INVOICE,
3575
3554
  TransactionKind.PAYMENT,
3576
3555
  TransactionKind.REFUND,
3577
3556
  TransactionKind.WRITE_OFF,
3578
- ] : _h, style = _a.style, filter = _a.filter, noTransactionsMessage = _a.noTransactionsMessage;
3557
+ ] : _h, style = _a.style, filter = _a.filter, noTransactionsMessage = _a.noTransactionsMessage, entityId = _a.entityId;
3579
3558
  var contextValues = {
3580
3559
  showSearchBar: showSearchBar,
3581
3560
  showTitle: showTitle,
@@ -3591,12 +3570,13 @@ function Transactions(_a) {
3591
3570
  style: style,
3592
3571
  filter: filter,
3593
3572
  noTransactionsMessage: noTransactionsMessage,
3573
+ entityId: entityId,
3594
3574
  };
3595
- return (jsx(QueryClientProvider, __assign({ client: queryClient }, { children: jsx(TransactionsListContext.Provider, __assign({ value: contextValues }, { children: jsx(TransactionsWrapper, {}) })) })));
3575
+ return (jsx(TransactionsListContext.Provider, __assign({ value: contextValues }, { children: jsx(TransactionsWrapper, {}) })));
3596
3576
  }
3597
3577
  function TransactionsWrapper() {
3598
3578
  var _a = useContext(TransactionsListContext), kindsToShow = _a.kindsToShow, filterFromContext = _a.filter;
3599
- var _b = useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain;
3579
+ var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
3600
3580
  // Local state
3601
3581
  var _c = useState(""), search = _c[0], setSearch = _c[1];
3602
3582
  var filter = filterFromContext ||
@@ -3604,21 +3584,21 @@ function TransactionsWrapper() {
3604
3584
  // Queries
3605
3585
  var data = useQuery({
3606
3586
  queryKey: ["transactions", token, filter],
3607
- queryFn: function () { return getTransactions(filter, token, subdomain, kindsToShow); },
3587
+ queryFn: function () { return getTransactions(filter, token, apiHost, kindsToShow); },
3608
3588
  placeholderData: keepPreviousData,
3609
3589
  }).data;
3610
3590
  return (jsx(TransactionsDisplay, { transactions: data, onSearchValueChanged: setSearch, search: search }));
3611
3591
  }
3612
3592
  function TransactionsDisplay(_a) {
3613
3593
  var transactions = _a.transactions, onSearchValueChanged = _a.onSearchValueChanged, search = _a.search, title = _a.title;
3614
- var _b = useContext(TransactionsListContext), showSearchBar = _b.showSearchBar, showTitle = _b.showTitle, transactionComponent = _b.transactionComponent, useModal = _b.useModal, suppressTransactionDisplay = _b.suppressTransactionDisplay, className = _b.className, shadow = _b.shadow, searchBarClassName = _b.searchBarClassName, style = _b.style, onTransactionClick = _b.onTransactionClick;
3594
+ var _b = useContext(TransactionsListContext), showSearchBar = _b.showSearchBar, showTitle = _b.showTitle, transactionComponent = _b.transactionComponent, useModal = _b.useModal, suppressTransactionDisplay = _b.suppressTransactionDisplay, className = _b.className, shadow = _b.shadow, searchBarClassName = _b.searchBarClassName, style = _b.style, onTransactionClick = _b.onTransactionClick, entityId = _b.entityId;
3615
3595
  var columns = useContext(TransactionsListContext).columns;
3616
3596
  var darkMode = useContext(BunnyContext).darkMode;
3617
3597
  // Local state
3618
3598
  var _c = useState(null), selectedTransaction = _c[0], setSelectedTransaction = _c[1];
3619
3599
  var _d = useState(false), drawerOpen = _d[0], setDrawerOpen = _d[1];
3620
3600
  // Hooks
3621
- var isMobile = useIsMobile$1();
3601
+ var isMobile = useIsMobile();
3622
3602
  function handleTransactionClick(transaction) {
3623
3603
  if (onTransactionClick) {
3624
3604
  onTransactionClick(transaction);
@@ -3672,7 +3652,7 @@ function TransactionsDisplay(_a) {
3672
3652
  onSearchValueChanged(e.target.value);
3673
3653
  }, prefix: jsx(SearchOutlined$1, {}), placeholder: "Search by id #", style: {
3674
3654
  minWidth: "300px",
3675
- }, value: search }) })) })), jsx(PageContent, __assign({ className: "flex w-full shadow-padding-xb ".concat(isMobile ? "overflow-hidden" : "", " ").concat(className) }, { children: jsx("div", __assign({ className: "grid w-full rounded-md overflow-auto ".concat("shadow-".concat(shadow)), style: {
3655
+ }, value: search }) })) })), jsx("div", __assign({ className: "flex w-full shadow-padding-xb ".concat(isMobile ? "overflow-hidden" : "", " ").concat(className) }, { children: jsx("div", __assign({ className: "grid w-full rounded-md overflow-auto ".concat("shadow-".concat(shadow)), style: {
3676
3656
  gridTemplateColumns: gridTemplateColumns(),
3677
3657
  backgroundColor: "var(--row-background".concat(darkMode ? "-dark" : "", ")"),
3678
3658
  } }, { children: isMobile ? (jsx(Fragment, { children: TransactionsListMobile({
@@ -3681,12 +3661,12 @@ function TransactionsDisplay(_a) {
3681
3661
  }) })) : (jsx(Fragment, { children: TransactionsListDesktop({
3682
3662
  transactions: transactions,
3683
3663
  onTransactionClick: handleTransactionClick,
3684
- }) })) })) })), useModal ? (jsx(Modal, __assign({ title: "Basic Modal", open: drawerOpen, onOk: function () { return setDrawerOpen(false); }, onCancel: function () { return setDrawerOpen(false); }, width: 900, footer: null }, { children: jsx(Invoice, { id: (selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.transactionableId) || "" }) }))) : (jsx(Drawer, __assign({ title: drawerTitle(), onClose: function () { return setDrawerOpen(false); }, open: drawerOpen, width: 900 }, { children: transactionComponent ? (transactionComponent) : (selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.kind) === "INVOICE" ? (jsx(Invoice, { id: selectedTransaction.transactionableId })) : (jsxs(Card$1, __assign({ className: "shadow-md" }, { children: [jsx(Typography.Title, __assign({ level: 2, className: "mb-4" }, { children: "Transaction Details" })), jsxs(Typography.Paragraph, { children: [jsx("strong", { children: "Amount:" }), " ", jsx(Typography.Text, { children: Misc.formatCurrency((selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.amount) || 0, (selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.currencyId) || "USD") })] }), jsxs(Typography.Paragraph, { children: [jsx("strong", { children: "Description:" }), " ", jsx(Typography.Text, { children: selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.description })] }), jsxs(Typography.Paragraph, { children: [jsx("strong", { children: "Kind:" }), " ", jsx(Typography.Text, { children: selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.kind })] }), jsxs(Typography.Paragraph, { children: [jsx("strong", { children: "State:" }), " ", jsx(Typography.Text, { children: selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.state })] })] }))) })))] })));
3664
+ }) })) })) })), useModal ? (jsx(Modal, __assign({ title: "Basic Modal", open: drawerOpen, onOk: function () { return setDrawerOpen(false); }, onCancel: function () { return setDrawerOpen(false); }, width: 900, footer: null }, { children: jsx(Invoice, { id: (selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.transactionableId) || "", entityId: entityId }) }))) : (jsx(Drawer, __assign({ title: drawerTitle(), onClose: function () { return setDrawerOpen(false); }, open: drawerOpen, width: 900 }, { children: transactionComponent ? (transactionComponent) : (selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.kind) === "INVOICE" ? (jsx(Invoice, { id: selectedTransaction.transactionableId, entityId: entityId })) : (jsxs(Card$1, __assign({ className: "shadow-md" }, { children: [jsx(Typography.Title, __assign({ level: 2, className: "mb-4" }, { children: "Transaction Details" })), jsxs(Typography.Paragraph, { children: [jsx("strong", { children: "Amount:" }), " ", jsx(Typography.Text, { children: formatCurrency((selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.amount) || 0, (selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.currencyId) || "USD") })] }), jsxs(Typography.Paragraph, { children: [jsx("strong", { children: "Description:" }), " ", jsx(Typography.Text, { children: selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.description })] }), jsxs(Typography.Paragraph, { children: [jsx("strong", { children: "Kind:" }), " ", jsx(Typography.Text, { children: selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.kind })] }), jsxs(Typography.Paragraph, { children: [jsx("strong", { children: "State:" }), " ", jsx(Typography.Text, { children: selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.state })] })] }))) })))] })));
3685
3665
  }
3686
3666
 
3687
3667
  function Quotes(_a) {
3688
- var filter = _a.filter, quoteComponent = _a.quoteComponent, _b = _a.showSearchBar, showSearchBar = _b === void 0 ? true : _b, _c = _a.showTitle, showTitle = _c === void 0 ? true : _c, _d = _a.columns, columns = _d === void 0 ? ["date-and-title", "amount", "download"] : _d, className = _a.className, _e = _a.shadow, shadow = _e === void 0 ? "md" : _e, searchBarClassName = _a.searchBarClassName, _f = _a.useModal, useModal = _f === void 0 ? false : _f; _a.onQuoteClick; var _g = _a.suppressQuoteDisplay, suppressQuoteDisplay = _g === void 0 ? false : _g, style = _a.style, _h = _a.noQuotesMessage, noQuotesMessage = _h === void 0 ? "There are no quotes" : _h;
3689
- var subdomain = useContext(BunnyContext).subdomain;
3668
+ var className = _a.className, _b = _a.columns, columns = _b === void 0 ? ["date-and-title", "amount", "download"] : _b, entityId = _a.entityId, filter = _a.filter, _c = _a.noQuotesMessage, noQuotesMessage = _c === void 0 ? "There are no quotes" : _c; _a.onQuoteClick; var quoteComponent = _a.quoteComponent, searchBarClassName = _a.searchBarClassName, _d = _a.shadow, shadow = _d === void 0 ? "md" : _d, _e = _a.showSearchBar, showSearchBar = _e === void 0 ? true : _e, _f = _a.showTitle, showTitle = _f === void 0 ? true : _f, style = _a.style, _g = _a.suppressQuoteDisplay, suppressQuoteDisplay = _g === void 0 ? false : _g, _h = _a.useModal, useModal = _h === void 0 ? false : _h;
3669
+ var apiHost = useContext(BunnyContext).apiHost;
3690
3670
  var _j = useState(null), component = _j[0], setComponent = _j[1];
3691
3671
  var contextValues = {
3692
3672
  columns: columns,
@@ -3703,20 +3683,21 @@ function Quotes(_a) {
3703
3683
  style: style,
3704
3684
  noTransactionsMessage: noQuotesMessage,
3705
3685
  filter: filter,
3706
- downloadTransactionLink: function (id) { return "".concat(subdomain, "/api/pdf/quote/").concat(id); },
3686
+ downloadTransactionLink: function (id) { return "".concat(apiHost, "/api/pdf/quote/").concat(id); },
3687
+ entityId: entityId,
3707
3688
  };
3708
3689
  function handleQuoteClick(quote) {
3709
3690
  if (quoteComponent) {
3710
3691
  setComponent(quoteComponent);
3711
3692
  }
3712
3693
  else {
3713
- setComponent(jsx(Quote, { id: quote === null || quote === void 0 ? void 0 : quote.transactionableId }));
3694
+ setComponent(jsx(Quote, { entityId: entityId, id: quote === null || quote === void 0 ? void 0 : quote.transactionableId }));
3714
3695
  }
3715
3696
  }
3716
3697
  return (jsx(TransactionsListContext.Provider, __assign({ value: contextValues }, { children: jsx(QuotesWrapper, {}) })));
3717
3698
  }
3718
3699
  function QuotesWrapper() {
3719
- var _a = useContext(BunnyContext), token = _a.token, subdomain = _a.subdomain;
3700
+ var _a = useContext(BunnyContext), token = _a.token, apiHost = _a.apiHost;
3720
3701
  var filterFromContext = useContext(TransactionsListContext).filter;
3721
3702
  // Local state
3722
3703
  var _b = useState(""), search = _b[0], setSearch = _b[1];
@@ -3724,7 +3705,7 @@ function QuotesWrapper() {
3724
3705
  // Queries
3725
3706
  var data = useQuery({
3726
3707
  queryKey: ["quotes", token, filter],
3727
- queryFn: function () { return getQuotes({ token: token, subdomain: subdomain, filter: filter }); },
3708
+ queryFn: function () { return getQuotes({ token: token, apiHost: apiHost, filter: filter }); },
3728
3709
  placeholderData: keepPreviousData,
3729
3710
  }).data;
3730
3711
  if (data === undefined)
@@ -3748,6 +3729,14 @@ var DrawerHeader = function (_a) {
3748
3729
  return (jsxs("div", __assign({ className: "flex flex-col gap-4" }, { children: [jsxs("div", __assign({ className: "flex items-center justify-between gap-2" }, { children: [jsx("div", __assign({ className: "text-xl" }, { children: title })), jsx("button", __assign({ onClick: onClose, className: "ant-drawer-close" }, { children: jsx(CloseOutlined$1, {}) }))] })), description && jsx("div", __assign({ className: "text-xs" }, { children: description }))] })));
3749
3730
  };
3750
3731
 
3732
+ var Card = function (_a) {
3733
+ var children = _a.children, className = _a.className, style = _a.style;
3734
+ var darkMode = useContext(BunnyContext).darkMode;
3735
+ return (jsx("div", __assign({ className: "flex flex-col rounded-md shadow-md ".concat(className), style: __assign(__assign({}, style), { backgroundColor: darkMode
3736
+ ? "var(--row-background-dark)"
3737
+ : "var(--row-background)" }) }, { children: children })));
3738
+ };
3739
+
3751
3740
  var LargeCardIcon = function () {
3752
3741
  return (jsx("svg", __assign({ width: "72", height: "56", viewBox: "0 0 72 56", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: jsx("path", { d: "M8 0H64C68.375 0 72 3.625 72 8V12H0V8C0 3.625 3.5 0 8 0ZM72 24V48C72 52.5 68.375 56 64 56H8C3.5 56 0 52.5 0 48V24H72ZM14 40C12.875 40 12 41 12 42C12 43.125 12.875 44 14 44H22C23 44 24 43.125 24 42C24 41 23 40 22 40H14ZM28 42C28 43.125 28.875 44 30 44H46C47 44 48 43.125 48 42C48 41 47 40 46 40H30C28.875 40 28 41 28 42Z", fill: "#E2E8F0" }) })));
3753
3742
  };
@@ -3757,16 +3746,6 @@ var PlusIcon = function (_a) {
3757
3746
  return (jsxs("svg", __assign({ width: "14", height: "15", viewBox: "0 0 14 15", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: [jsx("path", { d: "M2.9165 7.5H11.0832", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), jsx("path", { d: "M7 3.41663V11.5833", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })] })));
3758
3747
  };
3759
3748
 
3760
- var PaymentMethodContext = createContext({});
3761
-
3762
- var Card = function (_a) {
3763
- var children = _a.children, className = _a.className, style = _a.style;
3764
- var darkMode = useContext(BunnyContext).darkMode;
3765
- return (jsx("div", __assign({ className: "flex flex-col rounded-md shadow-md ".concat(className), style: __assign(__assign({}, style), { backgroundColor: darkMode
3766
- ? "var(--row-background-dark)"
3767
- : "var(--row-background)" }) }, { children: children })));
3768
- };
3769
-
3770
3749
  var Text$6 = Typography.Text;
3771
3750
  var CreditCard = function (_a) {
3772
3751
  var _b, _c, _d;
@@ -3776,9 +3755,9 @@ var CreditCard = function (_a) {
3776
3755
  var expDate = dayjs(paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.expirationDate);
3777
3756
  return expDate.isBefore(dayjs());
3778
3757
  };
3779
- var isMobile = useIsMobile$1();
3780
- var processPublicUrl = useContext(PaymentMethodContext).processPublicUrl;
3781
- return (jsxs(Card, __assign({ className: "shadow-md m-0" }, { children: [jsxs("div", __assign({ className: "flex items-center justify-between gap-4 p-4" }, { children: [jsxs("div", __assign({ className: "flex items-center gap-4" }, { children: [jsxs("div", __assign({ className: "flex items-center gap-2" }, { children: [getCardImage((_b = paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.metadata) === null || _b === void 0 ? void 0 : _b.issuer) && (jsx("img", { alt: "Card", width: "24px", src: "".concat(processPublicUrl, "/").concat(getCardImage((_c = paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.metadata) === null || _c === void 0 ? void 0 : _c.issuer)) })), jsx(Text$6, { children: (_d = paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.metadata) === null || _d === void 0 ? void 0 : _d.description })] })), jsx(Tag, __assign({ color: isExpired(paymentMethodData) ? "red" : "green" }, { children: isExpired(paymentMethodData) ? "Expired" : "Valid" }))] })), !isMobile && (jsx(CardActions, { onClickRemove: onClickRemove, onClickUpdate: onClickUpdate }))] })), dayjs(paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.expirationDate).isValid() && (jsxs(Fragment, { children: [jsx(Divider, {}), jsxs("div", __assign({ className: "flex flex-col p-4" }, { children: [jsx(CardAttribute, { title: "EXPIRATION", value: dayjs(paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.expirationDate).format("MM/YY") }), isMobile && (jsx(CardActions, { onClickRemove: onClickRemove, onClickUpdate: onClickUpdate }))] }))] }))] })));
3758
+ var isMobile = useIsMobile();
3759
+ var apiHost = useContext(BunnyContext).apiHost;
3760
+ return (jsxs(Card, __assign({ className: "shadow-md m-0" }, { children: [jsxs("div", __assign({ className: "flex items-center justify-between gap-4 p-4" }, { children: [jsxs("div", __assign({ className: "flex items-center gap-4" }, { children: [jsxs("div", __assign({ className: "flex items-center gap-2" }, { children: [getCardImage((_b = paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.metadata) === null || _b === void 0 ? void 0 : _b.issuer) && (jsx("img", { alt: "Card", width: "24px", src: "".concat(apiHost, "/portal/").concat(getCardImage((_c = paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.metadata) === null || _c === void 0 ? void 0 : _c.issuer)) })), jsx(Text$6, { children: (_d = paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.metadata) === null || _d === void 0 ? void 0 : _d.description })] })), jsx(Tag, __assign({ color: isExpired(paymentMethodData) ? "red" : "green" }, { children: isExpired(paymentMethodData) ? "Expired" : "Valid" }))] })), !isMobile && (jsx(CardActions, { onClickRemove: onClickRemove, onClickUpdate: onClickUpdate }))] })), dayjs(paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.expirationDate).isValid() && (jsxs(Fragment, { children: [jsx(Divider, {}), jsxs("div", __assign({ className: "flex flex-col p-4" }, { children: [jsx(CardAttribute, { title: "EXPIRATION", value: dayjs(paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.expirationDate).format("MM/YY") }), isMobile && (jsx(CardActions, { onClickRemove: onClickRemove, onClickUpdate: onClickUpdate }))] }))] }))] })));
3782
3761
  };
3783
3762
  var CardAttribute = function (_a) {
3784
3763
  var title = _a.title, value = _a.value;
@@ -3786,7 +3765,7 @@ var CardAttribute = function (_a) {
3786
3765
  };
3787
3766
  var CardActions = function (_a) {
3788
3767
  var onClickRemove = _a.onClickRemove, onClickUpdate = _a.onClickUpdate;
3789
- var isMobile = useIsMobile$1();
3768
+ var isMobile = useIsMobile();
3790
3769
  return (jsxs("div", __assign({ className: "flex items-center gap-6 ".concat(isMobile ? "justify-center mt-4" : "") }, { children: [jsx(Popconfirm, __assign({ title: "Remove card?", onConfirm: onClickRemove }, { children: jsx(Button, __assign({ className: "font-normal p-0", type: "link" }, { children: "Remove payment method" })) })), jsx(Divider, { style: { height: "24px" }, type: "vertical" }), jsx(Button, __assign({ onClick: onClickUpdate, type: "primary" }, { children: "Update" }))] })));
3791
3770
  };
3792
3771
  var EmptyCard = function (_a) {
@@ -3801,27 +3780,26 @@ var getCardImage = function (issuer) {
3801
3780
  return "mc_symbol_opt_73_3x.png";
3802
3781
  };
3803
3782
 
3804
- var ActualPaymentMethod = function () {
3805
- var _a = useContext(BunnyContext), token = _a.token, subdomain = _a.subdomain, graphQLClient = _a.graphQLClient;
3783
+ var PaymentMethodContext = createContext({});
3784
+
3785
+ var ActualPaymentMethod = function (_a) {
3786
+ var entityId = _a.entityId;
3787
+ var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, graphQLClient = _b.graphQLClient, onErrorNavigate = _b.onErrorNavigate;
3806
3788
  var accountId = useContext(PaymentContext).accountId;
3807
3789
  // Hooks
3808
3790
  var queryClient = useQueryClient();
3809
- var paymentPlugins = usePaymentPlugins({ subdomain: subdomain, token: token }).paymentPlugins;
3810
- var showErrorNotification = NotificationUtils.useErrorNotification();
3811
- var showSuccessNotification = NotificationUtils.useSuccessNotification();
3812
- var handleAllErrorFormats = NotificationUtils.useAllErrorFormats(function () {
3813
- console.log("Navigation in PaymentMethod.tsx useAllErrorFormats not implemented");
3814
- });
3815
- var isMobile = useIsMobile$1();
3791
+ var paymentPlugins = usePaymentPlugins({ entityId: entityId, apiHost: apiHost, token: token }).paymentPlugins;
3792
+ var showErrorNotification = useErrorNotification();
3793
+ var showSuccessNotification = useSuccessNotification();
3794
+ var handleAllErrorFormats = useAllErrorFormats(onErrorNavigate ||
3795
+ (function (url) {
3796
+ console.log("navigate to", url, " not implemented");
3797
+ }));
3798
+ var isMobile = useIsMobile();
3816
3799
  var data = usePaymentMethod(graphQLClient).data;
3817
3800
  // Local state
3818
- var _b = useState(false), showModal = _b[0], setShowModal = _b[1];
3819
- var _c = useState(false), isSaving = _c[0], setIsSaving = _c[1];
3820
- // Queries
3821
- useQuery({
3822
- queryKey: QueryKeyFactory.default.currentUserKey,
3823
- queryFn: function () { return getCurrentUserData({ token: token, subdomain: subdomain }); },
3824
- });
3801
+ var _c = useState(false), showModal = _c[0], setShowModal = _c[1];
3802
+ var _d = useState(false), isSaving = _d[0], setIsSaving = _d[1];
3825
3803
  var plugin = paymentPlugins === null || paymentPlugins === void 0 ? void 0 : paymentPlugins.find(function (paymentPlugin) { var _a; return String(paymentPlugin.id) === ((_a = data === null || data === void 0 ? void 0 : data.plugin) === null || _a === void 0 ? void 0 : _a.id); });
3826
3804
  var onClickRemove = function () {
3827
3805
  if (data && plugin) {
@@ -3833,7 +3811,7 @@ var ActualPaymentMethod = function () {
3833
3811
  account_id: accountId,
3834
3812
  },
3835
3813
  token: token,
3836
- subdomain: subdomain,
3814
+ apiHost: apiHost,
3837
3815
  })
3838
3816
  .then(function () {
3839
3817
  showSuccessNotification("Payment method was removed", "Success");
@@ -3860,7 +3838,7 @@ var ActualPaymentMethod = function () {
3860
3838
  }
3861
3839
  : {},
3862
3840
  wrapper: isMobile ? { width: "100vw" } : { width: "min-content" },
3863
- }, title: jsx(DrawerHeader, { onClose: function () { return setShowModal(false); }, title: "New payment method" }) }, { children: jsx(PaymentForm, { isSaving: isSaving, onFail: function (error) {
3841
+ }, title: jsx(DrawerHeader, { onClose: function () { return setShowModal(false); }, title: "New payment method" }) }, { children: jsx(PaymentForm, { entityId: entityId, isSaving: isSaving, onFail: function (error) {
3864
3842
  handleAllErrorFormats(error);
3865
3843
  setIsSaving(false);
3866
3844
  }, onPaymentSuccess: function () {
@@ -3869,13 +3847,56 @@ var ActualPaymentMethod = function () {
3869
3847
  }, setIsSaving: setIsSaving }) }))] }));
3870
3848
  };
3871
3849
  function PaymentMethod(_a) {
3872
- var footer = _a.footer, processPublicUrl = _a.processPublicUrl;
3873
- return (jsx(PaymentMethodContext.Provider, __assign({ value: { footer: footer, processPublicUrl: processPublicUrl } }, { children: jsx(ActualPaymentMethod, {}) })));
3850
+ var entityId = _a.entityId, footer = _a.footer;
3851
+ return (jsx(PaymentMethodContext.Provider, __assign({ value: { footer: footer } }, { children: jsx(ActualPaymentMethod, { entityId: entityId }) })));
3874
3852
  }
3875
3853
 
3876
- var MUTATION$5 = "\nmutation accountUpdate(\n $id: ID!,\n $attributes: AccountAttributes!) {\n accountUpdate(\n id: $id,\n attributes: $attributes\n ) {\n account { id }\n errors\n }\n }\n";
3854
+ var pageWrapperClassName = function (isMobile) {
3855
+ return "flex flex-col grow pt-4 ".concat(isMobile ? "pb-4 overflow-hidden" : "pb-8", " ").concat("content-container");
3856
+ };
3857
+
3858
+ 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}";
3859
+
3860
+ var QUOTE_RECALCULATE_TAXES = "\n mutation QuoteRecalculateTaxes($id: ID!) {\n quoteRecalculateTaxes(id: $id) {\n ".concat(QUOTE_FIELDS, "\n errors\n }\n }\n");
3861
+ var quoteRecalculateTaxes = function (_a) {
3862
+ var quoteId = _a.quoteId, token = _a.token, apiHost = _a.apiHost;
3863
+ return __awaiter(void 0, void 0, void 0, function () {
3864
+ var vars, response, errors;
3865
+ var _b, _c;
3866
+ return __generator(this, function (_d) {
3867
+ switch (_d.label) {
3868
+ case 0:
3869
+ vars = { id: quoteId };
3870
+ return [4 /*yield*/, gqlRequest({
3871
+ query: QUOTE_RECALCULATE_TAXES,
3872
+ token: token,
3873
+ vars: vars,
3874
+ apiHost: apiHost,
3875
+ })];
3876
+ case 1:
3877
+ response = _d.sent();
3878
+ errors = (_b = response === null || response === void 0 ? void 0 : response.quoteRecalculateTaxes) === null || _b === void 0 ? void 0 : _b.errors;
3879
+ if (errors)
3880
+ throw errors;
3881
+ return [2 /*return*/, (_c = response.quoteRecalculateTaxes) === null || _c === void 0 ? void 0 : _c.quote];
3882
+ }
3883
+ });
3884
+ });
3885
+ };
3886
+
3887
+ var useHasTaxPlugin = function (_a) {
3888
+ var entityId = _a.entityId, apiHost = _a.apiHost, token = _a.token;
3889
+ var plugins = usePlugins({
3890
+ entityId: entityId,
3891
+ apiHost: apiHost,
3892
+ token: token,
3893
+ }).data;
3894
+ return Boolean(plugins === null || plugins === void 0 ? void 0 : plugins.some(function (plugin) { return plugin.type === "taxation"; }));
3895
+ };
3896
+
3897
+ var MUTATION$6 = "\nmutation accountUpdate(\n $id: ID!,\n $attributes: AccountAttributes!) {\n accountUpdate(\n id: $id,\n attributes: $attributes\n ) {\n account { id }\n errors\n }\n }\n";
3877
3898
  var accountUpdate = function (_a) {
3878
- var accountId = _a.accountId, attributes = _a.attributes, token = _a.token;
3899
+ var accountId = _a.accountId, attributes = _a.attributes, token = _a.token, apiHost = _a.apiHost;
3879
3900
  return __awaiter(void 0, void 0, void 0, function () {
3880
3901
  var vars, response, errors;
3881
3902
  var _b;
@@ -3883,7 +3904,12 @@ var accountUpdate = function (_a) {
3883
3904
  switch (_c.label) {
3884
3905
  case 0:
3885
3906
  vars = { id: accountId, attributes: attributes };
3886
- return [4 /*yield*/, gqlRequest({ query: MUTATION$5, token: token, vars: vars })];
3907
+ return [4 /*yield*/, gqlRequest({
3908
+ query: MUTATION$6,
3909
+ token: token,
3910
+ vars: vars,
3911
+ apiHost: apiHost,
3912
+ })];
3887
3913
  case 1:
3888
3914
  response = _c.sent();
3889
3915
  errors = (_b = response === null || response === void 0 ? void 0 : response.accountUpdate) === null || _b === void 0 ? void 0 : _b.errors;
@@ -3900,10 +3926,10 @@ var TaxationForm = function (_a) {
3900
3926
  var account = _a.account, quote = _a.quote;
3901
3927
  // Hooks
3902
3928
  var queryClient = useQueryClient();
3903
- var token = useContext(BunnyContext).token;
3929
+ var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
3904
3930
  var form = Form.useForm()[0];
3905
3931
  // Mutations
3906
- var _b = useMutation({
3932
+ var _c = useMutation({
3907
3933
  mutationFn: function (changedFormData) { return __awaiter(void 0, void 0, void 0, function () {
3908
3934
  var account;
3909
3935
  return __generator(this, function (_a) {
@@ -3912,6 +3938,7 @@ var TaxationForm = function (_a) {
3912
3938
  accountId: quote.accountId,
3913
3939
  attributes: changedFormData,
3914
3940
  token: token,
3941
+ apiHost: apiHost,
3915
3942
  })];
3916
3943
  case 1:
3917
3944
  account = _a.sent();
@@ -3924,7 +3951,7 @@ var TaxationForm = function (_a) {
3924
3951
  queryKey: ["getTaxationRequiredAccountFields", token],
3925
3952
  });
3926
3953
  },
3927
- }), updateAccount = _b.mutate, isUpdatingAccount = _b.isPending;
3954
+ }), updateAccount = _c.mutate, isUpdatingAccount = _c.isPending;
3928
3955
  return (jsxs(Form, __assign({ className: "flex flex-col gap-4", form: form, initialValues: account, layout: "vertical", onFinish: updateAccount }, { children: [jsx(Form.Item, __assign({ label: "Billing street", name: "billingStreet" }, { children: jsx(Input, { placeholder: "Street" }) })), jsx(Form.Item, __assign({ label: "Billing city", name: "billingCity" }, { children: jsx(Input, { placeholder: "City" }) })), jsx(FormBillingState, { form: form }), jsx(Form.Item, __assign({ label: "Billing country", name: "billingCountry", rules: [{ required: true }] }, { children: jsx(Select, { options: Lists.COUNTRY_LIST, placeholder: "Select a country", showSearch: true, filterOption: function (input, option) {
3929
3956
  var _a, _b;
3930
3957
  return ((_a = option === null || option === void 0 ? void 0 : option.label) !== null && _a !== void 0 ? _a : "").toLowerCase().includes(input.toLowerCase()) ||
@@ -3939,10 +3966,10 @@ var FormBillingState = function (_a) {
3939
3966
  };
3940
3967
 
3941
3968
  var QuoteCheckout = function (_a) {
3942
- var account = _a.account, isSaving = _a.isSaving, onSuccess = _a.onSuccess, onFail = _a.onFail, quote = _a.quote, setIsSaving = _a.setIsSaving, taxationRequiredAccountFields = _a.taxationRequiredAccountFields; _a.storedPaymentMethod;
3969
+ var account = _a.account, isSaving = _a.isSaving, onSuccess = _a.onSuccess, onFail = _a.onFail, quote = _a.quote, setIsSaving = _a.setIsSaving, taxationRequiredAccountFields = _a.taxationRequiredAccountFields, entityId = _a.entityId;
3943
3970
  // Context
3944
- var isMobile = useIsMobile$1();
3945
- var _b = useContext(BunnyContext), subdomain = _b.subdomain, token = _b.token;
3971
+ var isMobile = useIsMobile();
3972
+ var _b = useContext(BunnyContext), apiHost = _b.apiHost, token = _b.token;
3946
3973
  var paymentRequired = getQuoteAmountDue(quote) > 0;
3947
3974
  var checkoutMutation = useMutation({
3948
3975
  mutationFn: function (_a) {
@@ -3950,14 +3977,14 @@ var QuoteCheckout = function (_a) {
3950
3977
  if (!quote)
3951
3978
  throw new Error("Quote is required");
3952
3979
  if (!paymentRequired)
3953
- return checkout({ quoteId: quote.id, token: token, subdomain: subdomain });
3980
+ return checkout({ quoteId: quote.id, token: token, apiHost: apiHost });
3954
3981
  if (savedPaymentMethod) {
3955
3982
  var paymentMethodId = savedPaymentMethod.paymentMethodId;
3956
3983
  return checkout({
3957
3984
  quoteId: quote.id,
3958
3985
  paymentMethodId: paymentMethodId,
3959
3986
  token: token,
3960
- subdomain: subdomain,
3987
+ apiHost: apiHost,
3961
3988
  });
3962
3989
  }
3963
3990
  if (pluginPaymentMethod) {
@@ -3972,7 +3999,7 @@ var QuoteCheckout = function (_a) {
3972
3999
  token: paymentToken,
3973
4000
  },
3974
4001
  token: token,
3975
- subdomain: subdomain,
4002
+ apiHost: apiHost,
3976
4003
  });
3977
4004
  }
3978
4005
  throw new Error("Pay payment method provided");
@@ -4014,82 +4041,64 @@ var QuoteCheckout = function (_a) {
4014
4041
  };
4015
4042
  if (taxationRequiredAccountFields)
4016
4043
  return (jsx(PaymentFormWrapper, __assign({ setMaxHeight: false }, { children: jsx(TaxationForm, { account: account, quote: quote }) })));
4017
- return (jsx(Fragment, { children: paymentRequired ? (jsx(PaymentForm, { isSaving: isSaving, onFail: onFail, onPaymentSuccess: handleCheckout, quote: quote, setIsSaving: setIsSaving })) : (jsx(PaymentFormWrapper, __assign({ setMaxHeight: false }, { children: jsxs("div", __assign({ className: "flex flex-col gap-2 ".concat(isMobile ? "shadow-padding-x" : "") }, { children: [jsx(Button, __assign({ disabled: isSaving, onClick: function () {
4044
+ return (jsx(Fragment, { children: paymentRequired ? (jsx(PaymentForm, { entityId: entityId, isSaving: isSaving, onFail: onFail, onPaymentSuccess: handleCheckout, quote: quote, setIsSaving: setIsSaving })) : (jsx(PaymentFormWrapper, __assign({ setMaxHeight: false }, { children: jsxs("div", __assign({ className: "flex flex-col gap-2 ".concat(isMobile ? "shadow-padding-x" : "") }, { children: [jsx(Button, __assign({ disabled: isSaving, onClick: function () {
4018
4045
  setIsSaving(true);
4019
4046
  handleCheckout({});
4020
4047
  }, type: "primary" }, { children: isSaving ? "Processing..." : "Complete order" })), jsx("div", __assign({ className: "text-xs text-slate-500" }, { children: "No payment is required" }))] })) }))) }));
4021
4048
  };
4022
4049
 
4023
- var useHasTaxPlugin = function (_a) {
4024
- var subdomain = _a.subdomain, token = _a.token;
4025
- var plugins = usePlugins({
4026
- subdomain: subdomain,
4027
- token: token,
4028
- }).data;
4029
- return Boolean(plugins === null || plugins === void 0 ? void 0 : plugins.some(function (plugin) { return plugin.type === "taxation"; }));
4030
- };
4031
-
4032
- var QUOTE_FIELDS = "quote {\n formattedQuote {\n html\n }\n acceptedByName\n acceptedByTitle\n accountId\n amount\n amountDue\n applicationDate\n applied\n billingDay\n contactId\n createdAt\n credits\n currencyId\n dealId\n discount\n discountValue\n endDate\n evergreen\n expiresAt\n id\n invoiceUntil\n isPendingApprovalRequest\n kind\n message\n name\n netPaymentDays\n notes\n ownerId\n periodAmount\n poNumber\n requiresApproval\n startDate\n state\n subtotal\n taxAmount\n updatedAt\n uuid\n amountsByPeriod {\n amount\n id\n name\n }\n endDateOptions {\n endDate\n label\n }\n invoiceUntilOptions {\n endDate\n label\n }\n quoteChanges {\n id\n priceListId\n charges {\n amount\n amountsByPeriod { amount startDate }\n billingPeriod\n billingPeriodAmounts { id amount prorationRate }\n chargeType\n couponId\n createdAt\n currencyId\n discount\n endDate\n feature { id name code isUnit unitName }\n id\n invoiceLineText\n name\n price\n priceDecimals\n priceTiers { starts price }\n pricingModel\n prorationRate\n quantity\n quantityMax\n quantityMin\n startDate\n tieredAveragePrice\n updatedAt\n }\n }\n}";
4033
-
4034
- var QUOTE_RECALCULATE_TAXES = "\n mutation QuoteRecalculateTaxes($id: ID!) {\n quoteRecalculateTaxes(id: $id) {\n ".concat(QUOTE_FIELDS, "\n errors\n }\n }\n");
4035
- var quoteRecalculateTaxes = function (_a) {
4036
- var quoteId = _a.quoteId, token = _a.token;
4050
+ var MUTATION$5 = "{\n currentUser {\n taxationRequiredAccountFields\n }\n}";
4051
+ var getTaxationRequiredAccountFields = function (_a) {
4052
+ var token = _a.token, apiHost = _a.apiHost;
4037
4053
  return __awaiter(void 0, void 0, void 0, function () {
4038
- var vars, response, errors;
4054
+ var response;
4039
4055
  var _b, _c;
4040
4056
  return __generator(this, function (_d) {
4041
4057
  switch (_d.label) {
4042
- case 0:
4043
- vars = { id: quoteId };
4044
- return [4 /*yield*/, gqlRequest({
4045
- query: QUOTE_RECALCULATE_TAXES,
4046
- token: token,
4047
- vars: vars,
4048
- })];
4058
+ case 0: return [4 /*yield*/, gqlRequest({
4059
+ query: MUTATION$5,
4060
+ token: token,
4061
+ apiHost: apiHost,
4062
+ })];
4049
4063
  case 1:
4050
4064
  response = _d.sent();
4051
- errors = (_b = response === null || response === void 0 ? void 0 : response.quoteRecalculateTaxes) === null || _b === void 0 ? void 0 : _b.errors;
4052
- if (errors)
4053
- throw errors;
4054
- return [2 /*return*/, (_c = response.quoteRecalculateTaxes) === null || _c === void 0 ? void 0 : _c.quote];
4065
+ 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
4066
+ ? response.currentUser
4067
+ .taxationRequiredAccountFields
4068
+ : null];
4055
4069
  }
4056
4070
  });
4057
4071
  });
4058
4072
  };
4059
4073
 
4060
- var planPickerQuoteDataState = atom({
4061
- key: "planPickerQuoteDataState",
4062
- default: undefined,
4063
- });
4064
-
4065
- var pageWrapperClassName = function (isMobile) {
4066
- return "flex flex-col grow pt-4 ".concat(isMobile ? "pb-4 overflow-hidden" : "pb-8", " ").concat("content-container");
4067
- };
4068
-
4069
4074
  var queryKeyFactory = QueryKeyFactory.default;
4070
4075
  var Checkout = function (_a) {
4071
4076
  var _b, _c;
4072
- var onCancel = _a.onCancel, onSuccess = _a.onSuccess, onFail = _a.onFail, invoice = _a.invoice, open = _a.open, quote = _a.quote, selectedPriceList = _a.selectedPriceList, isMobile = _a.isMobile, token = _a.token, storedPaymentMethod = _a.storedPaymentMethod;
4073
- var subdomain = useContext(BunnyContext).subdomain;
4074
- var _d = useState(false), isSaving = _d[0], setIsSaving = _d[1];
4075
- var hasTaxPlugin = useHasTaxPlugin({ subdomain: subdomain || "", token: token });
4077
+ 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;
4078
+ var _e = useContext(BunnyContext), apiHost = _e.apiHost; _e.window;
4079
+ var _f = useState(false), isSaving = _f[0], setIsSaving = _f[1];
4080
+ var isMobile = useIsMobile();
4081
+ var hasTaxPlugin = useHasTaxPlugin({
4082
+ entityId: entityId,
4083
+ apiHost: apiHost,
4084
+ token: token,
4085
+ });
4076
4086
  var queryClient = useQueryClient();
4077
- var quotePreviewData = useRecoilValue(planPickerQuoteDataState);
4078
4087
  // Queries
4079
- var _e = useQuery({
4088
+ var _g = useQuery({
4080
4089
  queryKey: ["getTaxationRequiredAccountFields", token],
4081
- queryFn: function () { return getTaxationRequiredAccountFields({ token: token }); },
4090
+ queryFn: function () { return getTaxationRequiredAccountFields({ token: token, apiHost: apiHost }); },
4082
4091
  enabled: Boolean(quote),
4083
4092
  staleTime: 0,
4084
- }), taxationRequiredAccountFields = _e.data, isLoadingTaxationRequiredAccountFields = _e.isLoading;
4085
- var _f = useQuery({
4093
+ }), taxationRequiredAccountFields = _g.data, isLoadingTaxationRequiredAccountFields = _g.isLoading;
4094
+ var _h = useQuery({
4086
4095
  queryKey: ["account", quote === null || quote === void 0 ? void 0 : quote.accountId],
4087
4096
  queryFn: function () {
4088
- return (quote === null || quote === void 0 ? void 0 : quote.accountId) && getAccount({ id: quote.accountId, token: token });
4097
+ return (quote === null || quote === void 0 ? void 0 : quote.accountId) && getAccount({ id: quote.accountId, token: token, apiHost: apiHost });
4089
4098
  },
4090
4099
  enabled: Boolean(quote === null || quote === void 0 ? void 0 : quote.accountId) &&
4091
4100
  ((taxationRequiredAccountFields === null || taxationRequiredAccountFields === void 0 ? void 0 : taxationRequiredAccountFields.length) || 0) > 0,
4092
- }), account = _f.data, isLoadingAccount = _f.isLoading;
4101
+ }), account = _h.data, isLoadingAccount = _h.isLoading;
4093
4102
  useQuery({
4094
4103
  queryKey: queryKeyFactory.createQuoteTaxCalculateKey(quote === null || quote === void 0 ? void 0 : quote.id),
4095
4104
  queryFn: function () { return __awaiter(void 0, void 0, void 0, function () {
@@ -4101,12 +4110,13 @@ var Checkout = function (_a) {
4101
4110
  return [4 /*yield*/, quoteRecalculateTaxes({
4102
4111
  quoteId: quote.id,
4103
4112
  token: token,
4113
+ apiHost: apiHost,
4104
4114
  })];
4105
4115
  case 1:
4106
4116
  updatedQuote = _a.sent();
4107
4117
  if (updatedQuote) {
4108
4118
  queryClient.setQueryData(queryKeyFactory.createObjectKey("editingQuote", updatedQuote.id), updatedQuote);
4109
- queryClient.setQueryData(queryKeyFactory.calculatedPricesKey((quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.quantity) || 0, selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id), updatedQuote);
4119
+ queryClient.setQueryData(queryKeyFactory.calculatedPricesKey(quantity, selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id), updatedQuote);
4110
4120
  }
4111
4121
  _a.label = 2;
4112
4122
  case 2: return [2 /*return*/, {}];
@@ -4125,21 +4135,21 @@ var Checkout = function (_a) {
4125
4135
  return null;
4126
4136
  return (jsx("div", __assign({ className: "flex flex-col fixed top-0 left-0 right-0 bottom-0 bg-slate-50 overflow-auto", style: {
4127
4137
  zIndex: 1001,
4128
- } }, { children: jsxs("div", __assign({ className: pageWrapperClassName(isMobile) }, { children: [jsx("div", __assign({ className: "flex justify-end w-full" }, { children: jsx(CloseOutlined$1, { className: "text-base shadow-padding-xb", onClick: onCancel }) })), jsxs("div", __assign({ className: "flex justify-end gap-6 pt-4 ".concat(isMobile ? "flex-col" : "shadow-padding-xb") }, { children: [((invoice === null || invoice === void 0 ? void 0 : invoice.html) || ((_b = quote === null || quote === void 0 ? void 0 : quote.formattedQuote) === null || _b === void 0 ? void 0 : _b.html)) && (jsx(InvoiceQuoteView, { html: invoice ? invoice.html : quote ? quote.formattedQuote.html : "", isMobile: isMobile })), !isMobile && ((invoice === null || invoice === void 0 ? void 0 : invoice.html) || ((_c = quote === null || quote === void 0 ? void 0 : quote.formattedQuote) === null || _c === void 0 ? void 0 : _c.html)) && (jsx(Divider, { className: "h-full", type: "vertical" })), invoice ? (jsx(InvoiceCheckout, { invoice: invoice, isSaving: isSaving, onFail: function (error) {
4138
+ } }, { children: jsxs("div", __assign({ className: pageWrapperClassName(isMobile) }, { children: [jsx("div", __assign({ className: "flex justify-end w-full" }, { children: jsx(CloseOutlined$1, { className: "text-base shadow-padding-xb", onClick: onCancel }) })), jsxs("div", __assign({ className: "flex justify-end gap-6 pt-4 ".concat(isMobile ? "flex-col" : "shadow-padding-xb") }, { children: [((invoice === null || invoice === void 0 ? void 0 : invoice.html) || ((_b = quote === null || quote === void 0 ? void 0 : quote.formattedQuote) === null || _b === void 0 ? void 0 : _b.html)) && (jsx(InvoiceQuoteView, { html: invoice ? invoice.html : quote ? quote.formattedQuote.html : "" })), !isMobile && ((invoice === null || invoice === void 0 ? void 0 : invoice.html) || ((_c = quote === null || quote === void 0 ? void 0 : quote.formattedQuote) === null || _c === void 0 ? void 0 : _c.html)) && (jsx(Divider, { className: "h-full", type: "vertical" })), invoice ? (jsx(InvoiceCheckout, { invoice: invoice, isSaving: isSaving, onFail: function (error) {
4129
4139
  onFail(error);
4130
4140
  setIsSaving(false);
4131
4141
  }, onSuccess: function (_a) {
4132
4142
  var savePaymentMethod = _a.savePaymentMethod;
4133
4143
  onSuccess({ savePaymentMethod: savePaymentMethod });
4134
4144
  setIsSaving(false);
4135
- }, setIsSaving: setIsSaving })) : quote ? (jsx(QuoteCheckout, { account: account, isSaving: isSaving, onFail: function (error) {
4145
+ }, setIsSaving: setIsSaving, entityId: entityId })) : quote ? (jsx(QuoteCheckout, { account: account, entityId: entityId, isSaving: isSaving, onFail: function (error) {
4136
4146
  onFail(error);
4137
4147
  setIsSaving(false);
4138
4148
  }, onSuccess: function (_a) {
4139
4149
  var savePaymentMethod = _a.savePaymentMethod;
4140
4150
  onSuccess({ savePaymentMethod: savePaymentMethod });
4141
4151
  setIsSaving(false);
4142
- }, quote: quote, setIsSaving: setIsSaving, taxationRequiredAccountFields: taxationRequiredAccountFields, token: token, storedPaymentMethod: storedPaymentMethod })) : (jsx(PaymentForm, { isSaving: isSaving, onFail: function (error) {
4152
+ }, quote: quote, setIsSaving: setIsSaving, taxationRequiredAccountFields: taxationRequiredAccountFields, token: token })) : (jsx(PaymentForm, { entityId: entityId, isSaving: isSaving, onFail: function (error) {
4143
4153
  onFail(error);
4144
4154
  setIsSaving(false);
4145
4155
  }, onPaymentSuccess: function (_a) {
@@ -4153,7 +4163,7 @@ var Checkout = function (_a) {
4153
4163
 
4154
4164
  var MUTATION$4 = function () { return "\nmutation AccountSignup (\n $entityId: ID!,\n $pluginId: String!,\n $paymentMethodId: String,\n $priceListCode: String!,\n $accountId: ID!,\n $quoteId: ID!\n) {\n accountSignup(\n entityId: $entityId,\n pluginId: $pluginId,\n paymentMethodId: $paymentMethodId,\n priceListCode: $priceListCode,\n accountId: $accountId,\n quoteId: $quoteId\n ) {\n errors\n quote {\n acceptedByName\n acceptedByTitle\n accountId\n amount\n amountDue\n applicationDate\n applied\n backdatedPeriods\n backdatedQuote\n billingDay\n contactId\n createdAt\n credits\n currencyId\n dealId\n discount\n discountValue\n endDate\n evergreen\n expiresAt\n id\n invoiceImmediately\n invoiceImmediatelyAvailable\n invoiceUntil\n isPendingApprovalRequest\n kind\n message\n name\n netPaymentDays\n notes\n number\n ownerId\n payableId\n periodAmount\n poNumber\n requiresApproval\n smallUnitAmountDue\n splitInvoice\n startDate\n state\n subtotal\n taxAmount\n taxCode\n updatedAt\n uuid\n }\n }\n}"; };
4155
4165
  var accountSignup = function (_a) {
4156
- var token = _a.token, subdomain = _a.subdomain, entityId = _a.entityId, accountId = _a.accountId, quoteId = _a.quoteId, paymentToken = _a.paymentToken, paymentMethodId = _a.paymentMethodId, pluginId = _a.pluginId, priceListCode = _a.priceListCode;
4166
+ var token = _a.token, apiHost = _a.apiHost, entityId = _a.entityId, accountId = _a.accountId, quoteId = _a.quoteId, paymentToken = _a.paymentToken, paymentMethodId = _a.paymentMethodId, pluginId = _a.pluginId, priceListCode = _a.priceListCode;
4157
4167
  return __awaiter(void 0, void 0, void 0, function () {
4158
4168
  var vars, response, errors;
4159
4169
  var _b;
@@ -4173,7 +4183,7 @@ var accountSignup = function (_a) {
4173
4183
  query: MUTATION$4(),
4174
4184
  token: token,
4175
4185
  vars: vars,
4176
- subdomain: subdomain,
4186
+ apiHost: apiHost,
4177
4187
  })];
4178
4188
  case 1:
4179
4189
  response = _c.sent();
@@ -4188,7 +4198,7 @@ var accountSignup = function (_a) {
4188
4198
 
4189
4199
  var MUTATION$3 = function () { return "\nmutation QuoteAccountSignup (\n $accountName: String!,\n $billingContact: ContactAttributes!,\n $entityId: ID!,\n $priceListCode: String!\n) {\n quoteAccountSignup(\n entityId: $entityId,\n priceListCode: $priceListCode,\n accountName: $accountName,\n billingContact: $billingContact\n ) {\n account {\n id\n }\n amount\n currencyId\n quote {\n id\n }\n tenant {\n code\n }\n errors\n }\n}"; };
4190
4200
  var quoteAccountSignup = function (_a) {
4191
- var token = _a.token, subdomain = _a.subdomain, entityId = _a.entityId, priceListCode = _a.priceListCode, accountName = _a.accountName, billingContact = _a.billingContact;
4201
+ var token = _a.token, apiHost = _a.apiHost, entityId = _a.entityId, priceListCode = _a.priceListCode, accountName = _a.accountName, billingContact = _a.billingContact;
4192
4202
  return __awaiter(void 0, void 0, void 0, function () {
4193
4203
  var vars, response, errors;
4194
4204
  var _b;
@@ -4205,7 +4215,7 @@ var quoteAccountSignup = function (_a) {
4205
4215
  query: MUTATION$3(),
4206
4216
  token: token,
4207
4217
  vars: vars,
4208
- subdomain: subdomain,
4218
+ apiHost: apiHost,
4209
4219
  })];
4210
4220
  case 1:
4211
4221
  response = _c.sent();
@@ -4220,7 +4230,7 @@ var quoteAccountSignup = function (_a) {
4220
4230
 
4221
4231
  var MUTATION$2 = function () { return "\nquery PriceList($code: String!) {\n priceList (code: $code) {\n basePrice\n code\n createdAt\n currencyId\n id\n isVisible\n name\n periodMonths\n planId\n priceDescription\n productId\n sku\n trialAllowed\n trialLengthDays\n updatedAt\n }\n}"; };
4222
4232
  var getPriceList = function (_a) {
4223
- var token = _a.token, code = _a.code, subdomain = _a.subdomain;
4233
+ var token = _a.token, code = _a.code, apiHost = _a.apiHost;
4224
4234
  return __awaiter(void 0, void 0, void 0, function () {
4225
4235
  var response;
4226
4236
  return __generator(this, function (_b) {
@@ -4229,7 +4239,7 @@ var getPriceList = function (_a) {
4229
4239
  query: MUTATION$2(),
4230
4240
  token: token,
4231
4241
  vars: { code: code },
4232
- subdomain: subdomain,
4242
+ apiHost: apiHost,
4233
4243
  })];
4234
4244
  case 1:
4235
4245
  response = _b.sent();
@@ -4240,8 +4250,8 @@ var getPriceList = function (_a) {
4240
4250
  };
4241
4251
 
4242
4252
  function PaymentForms(_a) {
4243
- var quote = _a.quote, paying = _a.paying, setIsPaying = _a.setIsPaying, handlePaymentSaveSuccess = _a.handlePaymentSaveSuccess, handlePaymentFail = _a.handlePaymentFail, handleSubmit = _a.handleSubmit, proceedingToPayment = _a.proceedingToPayment, accountId = _a.accountId;
4244
- return (jsx(Fragment, { children: quote ? (jsx(Fragment, { children: accountId && (jsx(PaymentContext.Provider, __assign({ value: { accountId: accountId, displayPayButtonNameAnyways: true } }, { children: jsx(PaymentForm, { isSaving: paying, setIsSaving: setIsPaying, onFail: handlePaymentFail, onPaymentSuccess: handlePaymentSaveSuccess }) }))) })) : (jsx(InitialSignupForm, { onSubmit: handleSubmit, submitting: proceedingToPayment })) }));
4253
+ 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;
4254
+ return (jsx(Fragment, { children: quote ? (jsx(Fragment, { children: accountId && (jsx(PaymentContext.Provider, __assign({ value: { accountId: accountId, displayPayButtonNameAnyways: true } }, { children: jsx(PaymentForm, { entityId: entityId, isSaving: paying, setIsSaving: setIsPaying, onFail: handlePaymentFail, onPaymentSuccess: handlePaymentSaveSuccess }) }))) })) : (jsx(InitialSignupForm, { onSubmit: handleSubmit, submitting: proceedingToPayment })) }));
4245
4255
  }
4246
4256
  function InitialSignupForm(_a) {
4247
4257
  var onSubmit = _a.onSubmit, submitting = _a.submitting;
@@ -4278,10 +4288,9 @@ function InitialSignupForm(_a) {
4278
4288
 
4279
4289
  var Title = Typography.Title, Text$5 = Typography.Text;
4280
4290
  function PaymentSuccessDisplay(_a) {
4281
- var className = _a.className, amountPaid = _a.amountPaid, style = _a.style, returnUrl = _a.returnUrl;
4291
+ var amountPaid = _a.amountPaid, className = _a.className, companyName = _a.companyName, returnUrl = _a.returnUrl, style = _a.style;
4282
4292
  var window = useContext(BunnyContext).window;
4283
- var companyName = useCurrentUserData().companyName;
4284
- return (jsxs("div", __assign({ className: "flex flex-col items-center justify-center h-full ".concat(className), style: style }, { children: [jsx(CheckCircleFilled$1, { style: { fontSize: "48px", color: "rgb(52 211 153)" } }), jsxs(Title, __assign({ level: 3, className: "mt-2 m-0" }, { children: ["Payment of ", Misc.formatCurrency(amountPaid, "USD"), " successful"] })), returnUrl && (jsxs(Text$5, __assign({ className: "text-slate-500 cursor-pointer underline", onClick: function () { return (window.location.href = returnUrl); } }, { children: ["Back to ", companyName] })))] })));
4293
+ return (jsxs("div", __assign({ className: "flex flex-col items-center justify-center h-full ".concat(className), style: style }, { children: [jsx(CheckCircleFilled$1, { style: { fontSize: "48px", color: "rgb(52 211 153)" } }), jsxs(Title, __assign({ level: 3, className: "mt-2 m-0" }, { children: ["Payment of ", formatCurrency(amountPaid, "USD"), " successful"] })), returnUrl && (jsxs(Text$5, __assign({ className: "text-slate-500 cursor-pointer underline", onClick: function () { return (window.location.href = returnUrl); } }, { children: ["Back to ", companyName] })))] })));
4285
4294
  }
4286
4295
 
4287
4296
  var Text$4 = Typography.Text;
@@ -4289,38 +4298,12 @@ function PriceListDisplay(_a) {
4289
4298
  var priceListData = _a.priceListData, topNavImageUrl = _a.topNavImageUrl;
4290
4299
  if (!priceListData)
4291
4300
  return null;
4292
- return (jsx(Fragment, { children: jsx("div", __assign({ className: "flex flex-col justify-between h-full my-12" }, { children: jsxs("div", __assign({ className: "flex flex-col space-y-8" }, { children: [jsx(Image, { width: 24, src: topNavImageUrl, alt: "Logo", preview: false }), jsxs("div", __assign({ className: "flex flex-col" }, { children: [jsx(Text$4, __assign({ className: "text-slate-500 font-bold text-lg" }, { children: priceListData.name })), jsxs(Text$4, __assign({ className: "font-bold text-xl" }, { children: [Misc.formatCurrency(priceListData.basePrice, priceListData.currencyId), " ", "/ month"] }))] })), jsxs("div", __assign({ className: "flex flex-col" }, { children: [jsxs(Text$4, __assign({ style: { fontSize: "16px" }, className: "text-slate-500" }, { children: [priceListData.trialLengthDays, " day trial"] })), jsx(Text$4, __assign({ className: "text-slate-500", style: { fontSize: "12px" } }, { children: "You will not be charged until the last day of the trial." }))] }))] })) })) }));
4301
+ return (jsx(Fragment, { children: jsx("div", __assign({ className: "flex flex-col justify-between h-full my-12" }, { children: jsxs("div", __assign({ className: "flex flex-col space-y-8" }, { children: [jsx(Image, { width: 24, src: topNavImageUrl, alt: "Logo", preview: false }), jsxs("div", __assign({ className: "flex flex-col" }, { children: [jsx(Text$4, __assign({ className: "text-slate-500 font-bold text-lg" }, { children: priceListData.name })), jsxs(Text$4, __assign({ className: "font-bold text-xl" }, { children: [formatCurrency(priceListData.basePrice, priceListData.currencyId), " ", "/ month"] }))] })), jsxs("div", __assign({ className: "flex flex-col" }, { children: [jsxs(Text$4, __assign({ style: { fontSize: "16px" }, className: "text-slate-500" }, { children: [priceListData.trialLengthDays, " day trial"] })), jsx(Text$4, __assign({ className: "text-slate-500", style: { fontSize: "12px" } }, { children: "You will not be charged until the last day of the trial." }))] }))] })) })) }));
4293
4302
  }
4294
4303
 
4295
- var BunnyFooterIcon = function (_a) {
4296
- var color = _a.color;
4297
- return (jsxs("svg", __assign({ width: "45", height: "15", viewBox: "0 0 39 13", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: [jsxs("g", __assign({ clipPath: "url(#clip0_6_851)" }, { children: [jsx("path", { className: "icon-path", d: "M14.5898 7.19708C14.5898 9.35053 13.0926 10.325 11.2495 10.325C9.39955 10.325 7.90234 9.35001 7.90234 7.18967V3.26221H10.1125V7.00052C10.1125 7.87719 10.5855 8.27725 11.2495 8.27725C11.9061 8.27725 12.3865 7.87719 12.3865 7.00052V3.26221H14.5898V7.19708Z", fill: color }), jsx("path", { className: "icon-path", d: "M31.8943 12.9625H29.4793L31.8523 8.62816L28.9355 3.26221H31.4708L33.0457 6.35524L34.5924 3.26221H37.0075L31.8943 12.9625Z", fill: color }), jsx("path", { className: "icon-path", d: "M15.1602 5.96827C15.1602 3.8148 16.6574 2.84033 18.5005 2.84033C20.3504 2.84033 21.8476 3.81533 21.8476 5.97568V10.1473H19.6374V6.16483C19.6374 5.28815 19.1645 4.8881 18.5005 4.8881C17.8439 4.8881 17.3634 5.28815 17.3634 6.16483V10.1473H15.1602V5.96827Z", fill: color }), jsx("path", { className: "icon-path", d: "M22.4316 5.96827C22.4316 3.8148 23.9289 2.84033 25.7719 2.84033C27.6219 2.84033 29.1191 3.81533 29.1191 5.97568V10.1473H26.9089V6.16483C26.9089 5.28815 26.4359 4.8881 25.7719 4.8881C25.1154 4.8881 24.6349 5.28815 24.6349 6.16483V10.1473H22.4316V5.96827Z", fill: color }), jsx("path", { className: "icon-path", d: "M7.40511 6.68957C7.40511 8.7236 6.02815 10.3227 4.17816 10.3227C3.23907 10.3227 2.61071 9.94378 2.19358 9.40371V10.1404H0.0605469V0.0405273H2.26381V3.91939C2.68041 3.42158 3.28802 3.07069 4.17763 3.07069C6.02759 3.07069 7.40511 4.66981 7.40511 6.68957ZM2.17229 6.69642C2.17229 7.60802 2.77937 8.2744 3.64823 8.2744C4.53783 8.2744 5.13107 7.59372 5.13107 6.69642C5.13107 5.79912 4.53783 5.11844 3.64823 5.11844C2.77937 5.11844 2.17229 5.78482 2.17229 6.69642Z", fill: color }), jsx("path", { className: "icon-path", d: "M38.966 8.94801C38.966 9.76181 38.2668 10.4631 37.4618 10.4631C36.6499 10.4631 35.9434 9.76181 35.9434 8.94801C35.9434 8.14846 36.6494 7.46094 37.4618 7.46094C38.2668 7.46094 38.966 8.14846 38.966 8.94801Z", fill: color })] })), jsx("defs", { children: jsx("clipPath", __assign({ id: "clip0_6_851" }, { children: jsx("rect", { width: "39", height: "13", fill: "white" }) })) })] })));
4298
- };
4299
-
4300
- var Footer = function (_a) {
4301
- var className = _a.className;
4302
- var _b = useCurrentUserData(), privacyUrl = _b.privacyUrl, termsUrl = _b.termsUrl;
4303
- var window = useContext(BunnyContext).window;
4304
- var isMobile = useIsMobile(window);
4305
- var quotePreviewData = useRecoilValue(planPickerQuoteDataState);
4306
- var selectedPriceList = quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.priceList;
4307
- if (selectedPriceList && isMobile)
4308
- return null;
4309
- return (jsxs("div", __assign({ className: "flex items-center justify-between shrink-0 ".concat(className, " ").concat(isMobile ? "flex-col gap-2 grow" : "") }, { children: [(termsUrl || privacyUrl) && (jsxs("div", __assign({ className: "flex items-center gap-3" }, { children: [termsUrl && (jsx(StyedLink, __assign({ className: "text-xs text-slate-400", href: termsUrl, rel: "noopener noreferrer", target: "_blank", type: "text" }, { children: "Terms" }))), privacyUrl && (jsx(StyedLink, __assign({ className: "text-xs text-slate-400", href: privacyUrl, rel: "noopener noreferrer", target: "_blank", type: "text" }, { children: "Privacy" })))] }))), jsx(BunnyMarketingLink, {})] })));
4310
- };
4311
- var BunnyMarketingLink = function () {
4312
- var _a = useState(false), isHovered = _a[0], setIsHovered = _a[1];
4313
- var window = useContext(BunnyContext).window;
4314
- var isMobile = useIsMobile(window);
4315
- return (jsx("div", __assign({ className: "flex items-end justify-end ".concat(isMobile ? "" : "grow") }, { children: jsx(StyledBunnyLink, __assign({ className: "flex items-end justify-end text-slate-400", href: "https://bunny.com/", rel: "noopener noreferrer", target: "_blank", type: "text" }, { children: jsxs("div", __assign({ className: "flex items-center", onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); } }, { children: ["Powered by\u00A0", jsx("div", __assign({ style: { paddingTop: "5px" } }, { children: jsx(BunnyFooterIcon, { color: isHovered ? PRIMARY_COLOR : SLATE_400 }) }))] })) })) })));
4316
- };
4317
- var StyedLink = styled.a(templateObject_1$3 || (templateObject_1$3 = __makeTemplateObject(["\n color: ", ";\n transition: color 0.3s;\n &:hover {\n color: ", ";\n }\n"], ["\n color: ", ";\n transition: color 0.3s;\n &:hover {\n color: ", ";\n }\n"])), SLATE_400, SLATE_500);
4318
- var StyledBunnyLink = styled(StyedLink)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n &:hover {\n color: ", " !important;\n }\n"], ["\n &:hover {\n color: ", " !important;\n }\n"])), PRIMARY_COLOR);
4319
- var templateObject_1$3, templateObject_2;
4320
-
4321
4304
  var MUTATION$1 = "\n mutation portalSessionCreate ($tenantCode: String!, $expiry: Int!, $returnUrl: String!) {\n portalSessionCreate (tenantCode: $tenantCode, expiry: $expiry, returnUrl: $returnUrl) {\n errors\n token\n }\n }\n";
4322
4305
  var portalSessionCreate = function (_a) {
4323
- var tenantCode = _a.tenantCode, expiry = _a.expiry, returnUrl = _a.returnUrl, token = _a.token, subdomain = _a.subdomain;
4306
+ var tenantCode = _a.tenantCode, expiry = _a.expiry, returnUrl = _a.returnUrl, token = _a.token, apiHost = _a.apiHost;
4324
4307
  return __awaiter(void 0, void 0, void 0, function () {
4325
4308
  var response, errors;
4326
4309
  var _b;
@@ -4330,7 +4313,7 @@ var portalSessionCreate = function (_a) {
4330
4313
  query: MUTATION$1,
4331
4314
  token: token,
4332
4315
  vars: { tenantCode: tenantCode, expiry: expiry, returnUrl: returnUrl },
4333
- subdomain: subdomain,
4316
+ apiHost: apiHost,
4334
4317
  })];
4335
4318
  case 1:
4336
4319
  response = _c.sent();
@@ -4343,18 +4326,13 @@ var portalSessionCreate = function (_a) {
4343
4326
  });
4344
4327
  };
4345
4328
 
4346
- var showErrorNotification = NotificationUtils.useErrorNotification();
4329
+ var showErrorNotification = useErrorNotification();
4347
4330
  function Signup(_a) {
4348
- var priceListCode = _a.priceListCode, returnUrl = _a.returnUrl;
4331
+ var companyName = _a.companyName, entityId = _a.entityId, priceListCode = _a.priceListCode, returnUrl = _a.returnUrl;
4349
4332
  // Hooks
4350
- var _b = useContext(BunnyContext), subdomain = _b.subdomain, token = _b.token, window = _b.window;
4351
- useQuery({
4352
- queryKey: QueryKeyFactory.default.currentUserKey,
4353
- queryFn: function () { return getCurrentUserData({ token: token, subdomain: subdomain }); },
4354
- });
4355
- var isMobile = useIsMobile(window);
4333
+ var _b = useContext(BunnyContext), apiHost = _b.apiHost, token = _b.token; _b.window;
4334
+ var isMobile = useIsMobile();
4356
4335
  var topNavImageUrl = useContext(BrandContext).topNavImageUrl;
4357
- var entityId = useCurrentUserData().entityId;
4358
4336
  var _c = useState(undefined), quote = _c[0], setQuote = _c[1];
4359
4337
  var _d = useState(undefined), accountId = _d[0], setAccountId = _d[1];
4360
4338
  var _e = useState(undefined), quoteId = _e[0], setQuoteId = _e[1];
@@ -4366,7 +4344,7 @@ function Signup(_a) {
4366
4344
  // Queries
4367
4345
  var priceListData = useQuery({
4368
4346
  queryKey: ["priceList", priceListCode],
4369
- queryFn: function () { return getPriceList({ token: token, subdomain: subdomain, code: priceListCode }); },
4347
+ queryFn: function () { return getPriceList({ token: token, apiHost: apiHost, code: priceListCode }); },
4370
4348
  }).data;
4371
4349
  function handleSubmit(formData) {
4372
4350
  return __awaiter(this, void 0, void 0, function () {
@@ -4378,7 +4356,7 @@ function Signup(_a) {
4378
4356
  setFormData(formData);
4379
4357
  return [4 /*yield*/, quoteAccountSignup({
4380
4358
  token: token,
4381
- subdomain: subdomain,
4359
+ apiHost: apiHost,
4382
4360
  entityId: entityId,
4383
4361
  priceListCode: priceListCode,
4384
4362
  accountName: formData.accountName,
@@ -4393,7 +4371,7 @@ function Signup(_a) {
4393
4371
  setAccountId(data.account.id);
4394
4372
  return [4 /*yield*/, portalSessionCreate({
4395
4373
  token: token,
4396
- subdomain: subdomain,
4374
+ apiHost: apiHost,
4397
4375
  tenantCode: data.tenant.code,
4398
4376
  expiry: 24,
4399
4377
  returnUrl: returnUrl || "",
@@ -4435,7 +4413,7 @@ function Signup(_a) {
4435
4413
  }
4436
4414
  return [4 /*yield*/, accountSignup({
4437
4415
  token: portalSessionToken,
4438
- subdomain: subdomain,
4416
+ apiHost: apiHost,
4439
4417
  entityId: entityId,
4440
4418
  quoteId: quoteId,
4441
4419
  paymentMethodId: (_a = paymentSuccess.savedPaymentMethodResponse) === null || _a === void 0 ? void 0 : _a.paymentMethodId.toString(),
@@ -4457,347 +4435,17 @@ function Signup(_a) {
4457
4435
  setIsPaying(false);
4458
4436
  }
4459
4437
  if (isMobile) {
4460
- return (jsx(Card, __assign({ className: "p-4 flex flex-col" }, { children: purchaseSucceeded ? (jsx(PaymentSuccessDisplay, { className: "w-full", amountPaid: (quote === null || quote === void 0 ? void 0 : quote.amountDue) || 0, returnUrl: returnUrl })) : (jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col" : "flex-row", " h-full w-full") }, { children: [jsx("div", __assign({ className: "flex flex-col items-center" }, { children: jsx(PriceListDisplay, { priceListData: priceListData, topNavImageUrl: topNavImageUrl }) })), jsx("div", __assign({ className: "mx-8" }, { children: jsx(Divider, { className: "h-full" }) })), jsx("div", __assign({ className: "flex items-center justify-center my-12" }, { children: jsx(PaymentForms, { quote: quote, paying: paying, setIsPaying: setIsPaying, handlePaymentSaveSuccess: handlePaymentSaveSuccess, handlePaymentFail: handlePaymentFail, handleSubmit: handleSubmit, proceedingToPayment: proceedingToPayment, accountId: accountId || "" }) }))] }))) })));
4438
+ return (jsx(Card, __assign({ className: "p-4 flex flex-col" }, { children: purchaseSucceeded ? (jsx(PaymentSuccessDisplay, { amountPaid: (quote === null || quote === void 0 ? void 0 : quote.amountDue) || 0, className: "w-full", companyName: companyName, returnUrl: returnUrl })) : (jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col" : "flex-row", " h-full w-full") }, { children: [jsx("div", __assign({ className: "flex flex-col items-center" }, { children: jsx(PriceListDisplay, { priceListData: priceListData, topNavImageUrl: topNavImageUrl }) })), jsx("div", __assign({ className: "mx-8" }, { children: jsx(Divider, { className: "h-full" }) })), jsx("div", __assign({ className: "flex items-center justify-center my-12" }, { children: jsx(PaymentForms, { entityId: entityId, quote: quote, paying: paying, setIsPaying: setIsPaying, handlePaymentSaveSuccess: handlePaymentSaveSuccess, handlePaymentFail: handlePaymentFail, handleSubmit: handleSubmit, proceedingToPayment: proceedingToPayment, accountId: accountId || "" }) }))] }))) })));
4461
4439
  }
4462
4440
  else {
4463
- return (jsxs(Fragment, { children: [jsx(Card, __assign({ className: "p-4 flex flex-col w-screen h-screen" }, { children: purchaseSucceeded ? (jsx(PaymentSuccessDisplay, { className: "w-full", amountPaid: (quote === null || quote === void 0 ? void 0 : quote.amountDue) || 0, returnUrl: returnUrl })) : (jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col" : "flex-row", " h-full w-full") }, { children: [jsx("div", __assign({ className: "flex flex-col w-1/2 items-center" }, { children: jsx(PriceListDisplay, { priceListData: priceListData, topNavImageUrl: topNavImageUrl }) })), jsx("div", __assign({ className: "my-4" }, { children: jsx(Divider, { className: "h-full", type: "vertical" }) })), jsx("div", __assign({ className: "flex w-1/2 items-center justify-center my-12" }, { children: jsx(PaymentForms, { quote: quote, paying: paying, setIsPaying: setIsPaying, handlePaymentSaveSuccess: handlePaymentSaveSuccess, handlePaymentFail: handlePaymentFail, handleSubmit: handleSubmit, proceedingToPayment: proceedingToPayment, accountId: accountId || "" }) }))] }))) })), jsx(Footer, {})] }));
4441
+ return (jsx(Fragment, { children: jsx(Card, __assign({ className: "p-4 flex flex-col w-screen h-screen" }, { children: purchaseSucceeded ? (jsx(PaymentSuccessDisplay, { amountPaid: (quote === null || quote === void 0 ? void 0 : quote.amountDue) || 0, className: "w-full", companyName: companyName, returnUrl: returnUrl })) : (jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col" : "flex-row", " h-full w-full") }, { children: [jsx("div", __assign({ className: "flex flex-col w-1/2 items-center" }, { children: jsx(PriceListDisplay, { priceListData: priceListData, topNavImageUrl: topNavImageUrl }) })), jsx("div", __assign({ className: "my-4" }, { children: jsx(Divider, { className: "h-full", type: "vertical" }) })), jsx("div", __assign({ className: "flex w-1/2 items-center justify-center my-12" }, { children: jsx(PaymentForms, { entityId: entityId, quote: quote, paying: paying, setIsPaying: setIsPaying, handlePaymentSaveSuccess: handlePaymentSaveSuccess, handlePaymentFail: handlePaymentFail, handleSubmit: handleSubmit, proceedingToPayment: proceedingToPayment, accountId: accountId || "" }) }))] }))) })) }));
4464
4442
  }
4465
4443
  }
4466
4444
 
4467
- var updatingChargeQuantityIdState = atom({
4468
- key: "updatingChargeQuantityIdState",
4469
- default: undefined,
4470
- });
4471
-
4472
- var canShowQuantitiesInput = function (charge, subscription) {
4473
- // Check if the subscription is active, pending, or in trial,
4474
- // the pricing model is not flat,
4475
- // and if it's not a trial, also check if the current charge is the last one in the subscription.
4476
- var _a, _b, _c;
4477
- var isActiveSubscription = ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState$2.ACTIVE;
4478
- var isPendingSubscription = ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState$2.PENDING;
4479
- var isTrialSubscription = ((_c = subscription.state) === null || _c === void 0 ? void 0 : _c.toUpperCase()) === SubscriptionState$2.TRIAL;
4480
- var isFlatPricing = charge.pricingModel === "FLAT";
4481
- var shouldProcessCharge = (isActiveSubscription || isPendingSubscription || isTrialSubscription) &&
4482
- !isFlatPricing &&
4483
- charge.selfServiceQuantity &&
4484
- !charge.expired;
4485
- // Now you can use the value of shouldProcessCharge to determine whether to process the charge.
4486
- return shouldProcessCharge;
4487
- };
4488
- var createQuoteParams = function (quote, subscriptionQuantity, editedSubscription) {
4489
- var quoteChange = quote.quoteChanges.find(function (quoteChange) {
4490
- return quoteChange.priceList.id === (editedSubscription === null || editedSubscription === void 0 ? void 0 : editedSubscription.subscription.priceList.id);
4491
- });
4492
- var quoteChangeCharge = quoteChange === null || quoteChange === void 0 ? void 0 : quoteChange.charges.find(function (charge) { return charge.priceListCharge.id === editedSubscription.chargeId; });
4493
- var charges = [
4494
- {
4495
- id: quoteChangeCharge.id,
4496
- quantity: editedSubscription.quantity - subscriptionQuantity,
4497
- },
4498
- ];
4499
- return { charges: charges, quoteChange: quoteChange };
4500
- };
4501
- var canShowChangeQuantities = function (_a) {
4502
- var subscriptions = _a.subscriptions;
4503
- return subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.some(function (subscription) {
4504
- return subscription.charges.some(function (charge, chargeIndex) {
4505
- return canShowQuantitiesInput(charge, subscription);
4506
- });
4507
- });
4508
- };
4509
- var isSubscriptionNotActive = function (subscription) {
4510
- var _a, _b;
4511
- return ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState$2.EXPIRED ||
4512
- ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState$2.CANCELED;
4513
- };
4514
- var canShowSubscriptionActions = function (subscription) {
4515
- var _a, _b;
4516
- return ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState$2.ACTIVE ||
4517
- ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState$2.PENDING;
4518
- };
4519
-
4520
- var useCreateSubscriptionQuote = function () {
4521
- var graphQLRequest = useGraphQLRequest();
4522
- return function (subscriptionIds, token) { return __awaiter(void 0, void 0, void 0, function () {
4523
- var data;
4524
- return __generator(this, function (_a) {
4525
- switch (_a.label) {
4526
- case 0: return [4 /*yield*/, graphQLRequest("\n mutation quoteSubscriptionUpdate(\n $subscriptionIds: [ID!]!,\n ) {\n quoteSubscriptionUpdate(\n subscriptionIds: $subscriptionIds,\n ) {\n quote {\n id\n quoteChanges {\n id\n priceList {\n id\n }\n charges {\n id\n priceListCharge {\n id\n }\n }\n }\n }\n }\n }\n ", token, {
4527
- subscriptionIds: subscriptionIds,
4528
- })];
4529
- case 1:
4530
- data = _a.sent();
4531
- return [2 /*return*/, data];
4532
- }
4533
- });
4534
- }); };
4535
- };
4536
- var useQuoteChangeUpdate = function () {
4537
- var graphQLRequest = useGraphQLRequest();
4538
- return function (charges, quoteChangeId, token) { return __awaiter(void 0, void 0, void 0, function () {
4539
- var response;
4540
- return __generator(this, function (_a) {
4541
- switch (_a.label) {
4542
- case 0: return [4 /*yield*/, graphQLRequest("mutation QuoteChangeUpdate($charges:[QuoteChargeAttributes!], $id:ID!) {\n quoteChangeUpdate(id:$id, charges:$charges) {\n quoteChange { id quoteId }\n errors\n }\n }", token, { charges: charges, id: quoteChangeId })];
4543
- case 1:
4544
- response = _a.sent();
4545
- return [2 /*return*/, response];
4546
- }
4547
- });
4548
- }); };
4549
- };
4550
- var useQuoteDelete = function () {
4551
- var graphQLRequest = useGraphQLRequest();
4552
- return function (quoteId, token) { return __awaiter(void 0, void 0, void 0, function () {
4553
- var response;
4554
- return __generator(this, function (_a) {
4555
- switch (_a.label) {
4556
- case 0: return [4 /*yield*/, graphQLRequest("mutation QuoteDelete($id: ID!) {\n quoteDelete(id: $id) {\n errors\n }\n }", token, { id: quoteId })];
4557
- case 1:
4558
- response = _a.sent();
4559
- return [2 /*return*/, response];
4560
- }
4561
- });
4562
- }); };
4563
- };
4564
-
4565
- var QuantityInput = function (_a) {
4566
- var charge = _a.charge, chargeIndex = _a.chargeIndex, editingQuote = _a.editingQuote, setEditingQuoteData = _a.setEditingQuoteData, subscription = _a.subscription, subscriptionIndex = _a.subscriptionIndex, subscriptions = _a.subscriptions;
4567
- // Context
4568
- var token = useContext(BunnyContext).token;
4569
- // Recoil state
4570
- var _b = useRecoilState(updatingChargeQuantityIdState), updatingChargeQuantityId = _b[0], setUpdatingChargeQuantityId = _b[1];
4571
- // Local state
4572
- var _c = useState(), editedSubscription = _c[0], setEditedSubscription = _c[1];
4573
- // Hooks
4574
- var queryClient = useQueryClient();
4575
- var handleAllErrorFormats = NotificationUtils.useAllErrorFormats(function () { });
4576
- var createSubscriptionQuote = useCreateSubscriptionQuote();
4577
- var quoteChangeUpdate = useQuoteChangeUpdate();
4578
- var isMobile = useIsMobile$1();
4579
- var showErrorNotification = NotificationUtils.useErrorNotification();
4580
- var quantityDisabled =
4581
- // If we are editing a quote, we disable the quantity input
4582
- // If we don't have a editedSubscription, we disable the quantity input
4583
- (updatingChargeQuantityId && updatingChargeQuantityId !== charge.id) ||
4584
- // If the subscription is not self-service, we disable the quantity input
4585
- !charge.selfServiceQuantity;
4586
- var value = (editedSubscription === null || editedSubscription === void 0 ? void 0 : editedSubscription.quantity) === undefined
4587
- ? ""
4588
- : editedSubscription.quantity;
4589
- // Mutations
4590
- var createQuote = useMutation({
4591
- mutationFn: function (subscriptionIds) {
4592
- return createSubscriptionQuote(subscriptionIds, token);
4593
- },
4594
- onError: handleAllErrorFormats,
4595
- onSuccess: function (subscriptionUpdateData) {
4596
- var _a;
4597
- var quote = (_a = subscriptionUpdateData === null || subscriptionUpdateData === void 0 ? void 0 : subscriptionUpdateData.quoteSubscriptionUpdate) === null || _a === void 0 ? void 0 : _a.quote;
4598
- var _b = createQuoteParams(quote, charge.quantity, editedSubscription), charges = _b.charges, quoteChange = _b.quoteChange;
4599
- if (quoteChange && charges[0].quantity > 0) {
4600
- updateQuote.mutate({
4601
- charges: charges,
4602
- quoteChangeId: quoteChange.id,
4603
- });
4604
- }
4605
- },
4606
- });
4607
- var updateQuote = useMutation({
4608
- mutationFn: function (_a) {
4609
- var charges = _a.charges, quoteChangeId = _a.quoteChangeId;
4610
- return quoteChangeUpdate(charges, quoteChangeId, token);
4611
- },
4612
- onSuccess: function (response) {
4613
- var _a, _b, _c, _d, _e, _f;
4614
- if (!(editingQuote === null || editingQuote === void 0 ? void 0 : editingQuote.id)) {
4615
- var isTrial = ((_b = (_a = editedSubscription === null || editedSubscription === void 0 ? void 0 : editedSubscription.subscription) === null || _a === void 0 ? void 0 : _a.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) ===
4616
- SubscriptionState$2.TRIAL;
4617
- setEditingQuoteData({
4618
- id: (_d = (_c = response.quoteChangeUpdate) === null || _c === void 0 ? void 0 : _c.quoteChange) === null || _d === void 0 ? void 0 : _d.quoteId,
4619
- isTrial: isTrial,
4620
- });
4621
- }
4622
- queryClient.invalidateQueries({
4623
- queryKey: QueryKeyFactory.default.createObjectKey("editingQuote", (_f = (_e = response.quoteChangeUpdate) === null || _e === void 0 ? void 0 : _e.quoteChange) === null || _f === void 0 ? void 0 : _f.quoteId),
4624
- });
4625
- },
4626
- });
4627
- // Handlers
4628
- var isQuantityLowerThanOriginal = function (quantity) {
4629
- return (editedSubscription === null || editedSubscription === void 0 ? void 0 : editedSubscription.quantity) !== undefined &&
4630
- editedSubscription.quantity <= quantity;
4631
- };
4632
- var onChangeQuantity = function (chargeIndex, value, priceListChargeId, subscription, subscriptionIndex) {
4633
- var quantity = isNaN(parseInt(value)) ? 0 : parseInt(value);
4634
- setEditedSubscription({
4635
- chargeIndex: chargeIndex,
4636
- subscriptionIndex: subscriptionIndex,
4637
- chargeId: priceListChargeId,
4638
- quantity: quantity,
4639
- subscription: subscription,
4640
- });
4641
- if (quantity !== charge.quantity) {
4642
- setUpdatingChargeQuantityId(charge.id);
4643
- }
4644
- else {
4645
- setUpdatingChargeQuantityId(undefined);
4646
- }
4647
- };
4648
- var handleSubscriptionUpdate = function (editedSubscription) {
4649
- if (!editedSubscription)
4650
- return;
4651
- // If we are not editing a quote, we create a new one
4652
- if (!editingQuote) {
4653
- var subscriptionIds = [];
4654
- var charge_1 = subscriptions[editedSubscription.subscriptionIndex].charges[editedSubscription.chargeIndex];
4655
- if (isQuantityLowerThanOriginal(charge_1.quantity)) {
4656
- // If the quantity is lower than the original, we remove the quote
4657
- setEditingQuoteData(undefined);
4658
- setUpdatingChargeQuantityId(undefined);
4659
- return;
4660
- }
4661
- subscriptionIds.push(editedSubscription.subscription.id);
4662
- createQuote.mutate(subscriptionIds);
4663
- }
4664
- else {
4665
- // If we are editing a quote, we update the quote change
4666
- var _a = createQuoteParams(editingQuote, charge.quantity, editedSubscription), charges = _a.charges, quoteChange = _a.quoteChange;
4667
- if (quoteChange && charges[0].quantity > 0) {
4668
- updateQuote.mutate({
4669
- charges: charges,
4670
- quoteChangeId: quoteChange.id,
4671
- });
4672
- }
4673
- else {
4674
- // Reset the editing quote data and the updating charge quantity ID to their initial states
4675
- setEditingQuoteData(undefined);
4676
- setUpdatingChargeQuantityId(undefined);
4677
- }
4678
- }
4679
- };
4680
- // Initial subscription quantity if is on mobile
4681
- useEffect(function () {
4682
- if (isMobile && !editedSubscription && !quantityDisabled) {
4683
- setEditedSubscription({
4684
- chargeIndex: chargeIndex,
4685
- subscriptionIndex: subscriptionIndex,
4686
- chargeId: charge.priceListChargeId,
4687
- quantity: charge.quantity,
4688
- subscription: subscription,
4689
- });
4690
- }
4691
- }, [
4692
- charge,
4693
- chargeIndex,
4694
- editedSubscription,
4695
- isMobile,
4696
- quantityDisabled,
4697
- subscription,
4698
- subscriptionIndex,
4699
- ]);
4700
- // Edit subscription debounce
4701
- useEffect(function () {
4702
- var debounce = setTimeout(function () {
4703
- handleSubscriptionUpdate(editedSubscription);
4704
- }, 1000);
4705
- return function () { return clearTimeout(debounce); };
4706
- // eslint-disable-next-line
4707
- }, [editedSubscription]);
4708
- return (jsx(Fragment, { children: jsx(Input, { className: "text-right", disabled: quantityDisabled, onBlur: function () {
4709
- if (typeof value === "number" && value < charge.quantity) {
4710
- showErrorNotification("New value is less than the original quantity. This is not allowed");
4711
- }
4712
- }, onChange: function (e) {
4713
- onChangeQuantity(chargeIndex, e.target.value, charge.priceListChargeId, subscription, subscriptionIndex);
4714
- }, status: isQuantityLowerThanOriginal(charge.quantity) ? "error" : "", style: { width: "96px" }, value: value }) }));
4715
- };
4716
-
4717
- var QuantityChangeGridRow = function (_a) {
4718
- var _b;
4719
- var chargeIndex = _a.chargeIndex, editingQuote = _a.editingQuote, subscriptions = _a.subscriptions, subscriptionIndex = _a.subscriptionIndex, setEditingQuoteData = _a.setEditingQuoteData, subscription = _a.subscription, subscriptionCharge = _a.subscriptionCharge;
4720
- if (!canShowQuantitiesInput(subscriptionCharge, subscription))
4721
- return null;
4722
- return (jsxs(Fragment, { children: [jsx("div", __assign({ className: "font-medium text-orange-600 col-span-full", style: { fontSize: "11px" } }, { children: subscription.plan.name })), jsx("div", __assign({ className: "font-medium text-base text-gray-900" }, { children: (_b = subscriptionCharge.name) === null || _b === void 0 ? void 0 : _b.toUpperCase() })), jsx("div", __assign({ className: "flex items-center justify-end font-medium text-base text-gray-900" }, { children: subscriptionCharge.quantity })), jsxs("div", __assign({ className: "flex flex-col items-end" }, { children: [jsx(QuantityInput, { charge: subscriptionCharge, chargeIndex: chargeIndex, editingQuote: editingQuote, setEditingQuoteData: setEditingQuoteData, subscription: subscription, subscriptionIndex: subscriptionIndex, subscriptions: subscriptions }), jsx("div", {})] })), jsx(Divider, { className: "col-span-full my-2" })] }));
4723
- };
4724
-
4725
- var QuantityChangeGridTitle = function (_a) {
4726
- var children = _a.children, right = _a.right;
4727
- return (jsx("div", __assign({ className: "font-medium text-slate-600 ".concat(right ? "text-right" : "text-left"), style: { fontSize: "11px" } }, { children: children })));
4728
- };
4729
-
4730
- var QuoteChangeSummarySection = function (_a) {
4731
- var editingQuote = _a.editingQuote, editingQuoteData = _a.editingQuoteData, openCheckout = _a.openCheckout, setEditingQuoteData = _a.setEditingQuoteData;
4732
- var isMobile = useIsMobile$1();
4733
- var token = useContext(BunnyContext).token;
4734
- var showSuccessNotification = NotificationUtils.useSuccessNotification();
4735
- var trialUpgradeMutation = useMutation({
4736
- mutationFn: function (quoteId) { return checkout({ quoteId: quoteId, token: token }); },
4737
- onSuccess: function () {
4738
- setEditingQuoteData(undefined);
4739
- showSuccessNotification("Subscription updated successfully");
4740
- },
4741
- });
4742
- return (jsxs("div", __assign({ className: "flex flex-col items-end" }, { children: [editingQuote && (jsxs("div", __assign({ className: "flex flex-col mb-8" }, { children: [jsx("div", __assign({ className: "text-slate-500 text-right text-xs mb-2" }, { children: "TOTAL" })), jsx("div", __assign({ className: "text-right ".concat(isMobile ? "text-2xl" : "text-xl") }, { children: Misc.formatCurrency(getQuoteAmountDue(editingQuote), (editingQuote === null || editingQuote === void 0 ? void 0 : editingQuote.currencyId) || "") }))] }))), jsx("div", __assign({ className: "flex items-center justify-end ".concat(isMobile ? "w-full" : "") }, { children: jsx(Button, __assign({ className: "w-full", onClick: (editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.isTrial)
4743
- ? function () { return trialUpgradeMutation.mutate(editingQuoteData.id); }
4744
- : openCheckout, disabled: !editingQuoteData, size: isMobile ? "large" : "middle", type: "primary" }, { children: (editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.isTrial) ? "Activate Trial" : "Proceed to checkout" })) }))] })));
4745
- };
4746
-
4747
- var QUANTITY_CHANGE_HEADER_TITLE = "Update unit quantity";
4748
- var QUANTITY_CHANGE_HEADER_DESCRIPTION = "Adjust quantities below. The change will take effect immediately after checkout has been completed.";
4749
- var QuantityChangeDrawerDesktop = function (_a) {
4750
- var editingQuote = _a.editingQuote, editingQuoteData = _a.editingQuoteData, onClose = _a.onClose, open = _a.open, openCheckout = _a.openCheckout, setEditingQuoteData = _a.setEditingQuoteData, subscriptions = _a.subscriptions;
4751
- var _b = useState(open), openLocal = _b[0], setOpenLocal = _b[1];
4752
- var isMobile = useIsMobile$1();
4753
- useEffect(function () {
4754
- var timeoutId;
4755
- if (!open) {
4756
- timeoutId = setTimeout(function () {
4757
- setOpenLocal(false);
4758
- }, 300); // Delay to allow for close animation
4759
- }
4760
- else {
4761
- setOpenLocal(true);
4762
- }
4763
- return function () { return clearTimeout(timeoutId); };
4764
- }, [open]);
4765
- if (!openLocal)
4766
- return null;
4767
- return (jsxs(Drawer, __assign({ closeIcon: null, destroyOnClose: true, onClose: onClose, open: open, styles: isMobile
4768
- ? {
4769
- body: {
4770
- padding: "1rem",
4771
- overflow: "hidden",
4772
- background: SLATE_50,
4773
- },
4774
- wrapper: {
4775
- width: "100vw",
4776
- },
4777
- }
4778
- : {
4779
- wrapper: {
4780
- minWidth: "600px",
4781
- },
4782
- }, title: jsx(DrawerHeader, { description: QUANTITY_CHANGE_HEADER_DESCRIPTION, onClose: onClose, title: QUANTITY_CHANGE_HEADER_TITLE }) }, { children: [jsxs("div", __assign({ className: "grid pb-4", style: {
4783
- gridTemplateColumns: "2fr 1fr 1fr",
4784
- rowGap: "0.75rem",
4785
- columnGap: "1rem",
4786
- } }, { children: [jsx(QuantityChangeGridTitle, { children: "ACTIVE SUBSCRIPTIONS" }), jsx(QuantityChangeGridTitle, __assign({ right: true }, { children: "CURRENT QUANTITY" })), jsx(QuantityChangeGridTitle, __assign({ right: true }, { children: "NEW QUANTITY" })), jsx(Divider, { className: "col-span-full py-2" }), subscriptions.map(function (subscription, index) {
4787
- var _a;
4788
- var isTrial = ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState$2.TRIAL;
4789
- return (jsx("div", __assign({ className: "contents" }, { children: subscription.charges.map(function (charge, chargeIndex) {
4790
- if ((isTrial && !charge.trial) || (!isTrial && charge.trial))
4791
- return null;
4792
- return (jsx(QuantityChangeGridRow, { chargeIndex: chargeIndex, editingQuote: editingQuote, setEditingQuoteData: setEditingQuoteData, subscription: subscription, subscriptionCharge: charge, subscriptionIndex: index, subscriptions: subscriptions }, chargeIndex));
4793
- }) }), index));
4794
- })] })), jsx(QuoteChangeSummarySection, { editingQuote: editingQuote, editingQuoteData: editingQuoteData, openCheckout: openCheckout, setEditingQuoteData: setEditingQuoteData })] })));
4795
- };
4796
-
4797
4445
  // WARNING: There is a preview button on APP that will need to be changed if this query is changed
4798
4446
  var PLAN_CHANGE_OPTIONS_QUERY = "\n query planChangeOptions($subscriptionId: ID) {\n planChangeOptions(subscriptionId: $subscriptionId) {\n products {\n everythingInPlus\n id\n name\n features(sort: \"position asc\") {\n description\n id\n isVisible\n kind\n name\n position\n }\n }\n plans {\n code\n contactUsLabel\n contactUsUrl\n description\n id\n name\n position\n pricingDescription\n pricingStyle\n planFeatures {\n featureId\n value\n feature {\n name\n }\n }\n priceLists {\n basePrice\n id\n currencyId\n periodMonths\n plan {\n id\n position\n }\n product {\n id\n }\n charges {\n basePrice\n billingPeriod\n chargeType\n id\n name\n priceDecimals\n pricingModel\n quantityMax\n quantityMin\n selfServiceQuantity\n feature {\n name\n unitName\n }\n }\n }\n productId\n }\n }\n }";
4799
4447
  var getPlanChangeOptions = function (_a) {
4800
- var isInPreviewMode = _a.isInPreviewMode, token = _a.token, upgradingSubscription = _a.upgradingSubscription, subdomain = _a.subdomain;
4448
+ var isInPreviewMode = _a.isInPreviewMode, token = _a.token, upgradingSubscription = _a.upgradingSubscription, apiHost = _a.apiHost;
4801
4449
  return __awaiter(void 0, void 0, void 0, function () {
4802
4450
  var response, planChangeOptions;
4803
4451
  return __generator(this, function (_b) {
@@ -4807,7 +4455,7 @@ var getPlanChangeOptions = function (_a) {
4807
4455
  query: PLAN_CHANGE_OPTIONS_QUERY,
4808
4456
  vars: { subscriptionId: upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id },
4809
4457
  token: token,
4810
- subdomain: subdomain,
4458
+ apiHost: apiHost,
4811
4459
  })];
4812
4460
  case 1:
4813
4461
  response = _b.sent();
@@ -4826,7 +4474,7 @@ var getPlanChangeOptions = function (_a) {
4826
4474
 
4827
4475
  var QUOTE_QUERY = function () { return "\n query quote($id: ID) {\n quote(id: $id) {\n accountId\n amount\n amountDue\n smallUnitAmountDue\n currencyId\n formattedQuote {\n html\n }\n id\n payableId\n periodAmount\n subtotal\n taxAmount\n amountsByPeriod {\n amount\n startDate\n }\n quoteChanges {\n currencyId\n id\n charges {\n amountsByPeriod {\n amount\n startDate\n }\n amount\n billingPeriod\n currencyId\n feature {\n unitName\n }\n id\n name\n priceListCharge {\n id\n }\n quantity\n }\n priceList {\n id\n plan {\n name\n }\n product {\n name\n }\n }\n\n }\n }\n }"; };
4828
4476
  var getQuote = function (_a) {
4829
- var id = _a.id, token = _a.token, subdomain = _a.subdomain;
4477
+ var id = _a.id, token = _a.token, apiHost = _a.apiHost;
4830
4478
  return __awaiter(void 0, void 0, void 0, function () {
4831
4479
  var response;
4832
4480
  return __generator(this, function (_b) {
@@ -4835,7 +4483,7 @@ var getQuote = function (_a) {
4835
4483
  query: QUOTE_QUERY(),
4836
4484
  token: token,
4837
4485
  vars: { id: id },
4838
- subdomain: subdomain,
4486
+ apiHost: apiHost,
4839
4487
  })];
4840
4488
  case 1:
4841
4489
  response = _b.sent();
@@ -4847,7 +4495,7 @@ var getQuote = function (_a) {
4847
4495
 
4848
4496
  var SUBSCRIPTIONS_QUERY = "query subscriptions {\n subscriptions {\n nodes {\n cancellationDate\n currencyId\n endDate\n evergreen\n id\n period\n plan { id name selfServiceBuy selfServiceCancel selfServiceRenew }\n priceList { id periodMonths }\n product { id name showProductNameOnLineItem }\n startDate\n state\n trialEndDate\n trialPeriod\n trialStartDate\n charges {\n priceListCharge {\n priceListChargeTiers {\n price\n starts\n }\n }\n amount\n billingPeriod\n chargeType\n discount\n discountedPrice\n endDate\n expired\n feature { name }\n id\n isRamp\n name\n periodPrice\n price\n priceDecimals\n priceListChargeId\n priceTiers { starts price }\n pricingModel\n quantity\n selfServiceQuantity\n startDate\n trial\n }\n }\n }\n }";
4849
4497
  var getSubscriptions = function (_a) {
4850
- var entityId = _a.entityId, isInPreviewMode = _a.isInPreviewMode, token = _a.token, subdomain = _a.subdomain;
4498
+ var entityId = _a.entityId, isInPreviewMode = _a.isInPreviewMode, token = _a.token, apiHost = _a.apiHost;
4851
4499
  return __awaiter(void 0, void 0, void 0, function () {
4852
4500
  var response;
4853
4501
  var _b;
@@ -4858,7 +4506,7 @@ var getSubscriptions = function (_a) {
4858
4506
  query: SUBSCRIPTIONS_QUERY,
4859
4507
  token: token,
4860
4508
  vars: { entityId: entityId },
4861
- subdomain: subdomain,
4509
+ apiHost: apiHost,
4862
4510
  })];
4863
4511
  case 1:
4864
4512
  response = _c.sent();
@@ -4928,7 +4576,7 @@ var ErrorView = function (_a) {
4928
4576
  var Text$3 = Typography.Text;
4929
4577
  var HideExpiredToggle = function (_a) {
4930
4578
  var hideExpired = _a.hideExpired, setHideExpired = _a.setHideExpired, subscriptions = _a.subscriptions;
4931
- var isMobile = useIsMobile$1();
4579
+ var isMobile = useIsMobile();
4932
4580
  var secondaryColor = useContext(BrandContext).secondaryColor;
4933
4581
  var hasExpiredOrCanceledSubscriptions = subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.some(function (subscription) {
4934
4582
  var _a, _b;
@@ -4944,6 +4592,42 @@ var HideExpiredToggle = function (_a) {
4944
4592
  var StyledCheckbox = styled.div(templateObject_1$2 || (templateObject_1$2 = __makeTemplateObject(["\n .ant-checkbox-wrapper span {\n padding-inline-end: 0 !important;\n }\n"], ["\n .ant-checkbox-wrapper span {\n padding-inline-end: 0 !important;\n }\n"])));
4945
4593
  var templateObject_1$2;
4946
4594
 
4595
+ // import { EditingSubscriptionType } from "../../../features/quantityChangeDrawer/QuantityInput";
4596
+ var canShowQuantitiesInput = function (charge, subscription) {
4597
+ // Check if the subscription is active, pending, or in trial,
4598
+ // the pricing model is not flat,
4599
+ // and if it's not a trial, also check if the current charge is the last one in the subscription.
4600
+ var _a, _b, _c;
4601
+ var isActiveSubscription = ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState$2.ACTIVE;
4602
+ var isPendingSubscription = ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState$2.PENDING;
4603
+ var isTrialSubscription = ((_c = subscription.state) === null || _c === void 0 ? void 0 : _c.toUpperCase()) === SubscriptionState$2.TRIAL;
4604
+ var isFlatPricing = charge.pricingModel === "FLAT";
4605
+ var shouldProcessCharge = (isActiveSubscription || isPendingSubscription || isTrialSubscription) &&
4606
+ !isFlatPricing &&
4607
+ charge.selfServiceQuantity &&
4608
+ !charge.expired;
4609
+ // Now you can use the value of shouldProcessCharge to determine whether to process the charge.
4610
+ return shouldProcessCharge;
4611
+ };
4612
+ var canShowChangeQuantities = function (_a) {
4613
+ var subscriptions = _a.subscriptions;
4614
+ return subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.some(function (subscription) {
4615
+ return subscription.charges.some(function (charge, chargeIndex) {
4616
+ return canShowQuantitiesInput(charge, subscription);
4617
+ });
4618
+ });
4619
+ };
4620
+ var isSubscriptionNotActive = function (subscription) {
4621
+ var _a, _b;
4622
+ return ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState$2.EXPIRED ||
4623
+ ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState$2.CANCELED;
4624
+ };
4625
+ var canShowSubscriptionActions = function (subscription) {
4626
+ var _a, _b;
4627
+ return ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === SubscriptionState$2.ACTIVE ||
4628
+ ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState$2.PENDING;
4629
+ };
4630
+
4947
4631
  var SubscriptionState;
4948
4632
  (function (SubscriptionState) {
4949
4633
  SubscriptionState["ACTIVE"] = "ACTIVE";
@@ -4956,7 +4640,7 @@ var SubscriptionState$1 = SubscriptionState;
4956
4640
 
4957
4641
  var FEATURE_USAGE_MUTATION = "\nquery GetFeatureUsage($id: ID!) {\n featureUsageHistogram(subscriptionChargeId: $id) {\n subscriptionCharge { \n id\n name\n amount\n currentPeriodPriceByTiers { \n tier { starts price } \n quantity\n amount\n }\n }\n feature { id name }\n periodRange\n dataInterval\n data {\n periodStart\n periodEnd\n intervals {\n intervalStart\n intervalUsage\n }\n intervalsTotal\n }\n }\n}\n";
4958
4642
  var getFeatureUsage = function (_a) {
4959
- var subscriptionChargeId = _a.subscriptionChargeId; _a.startDate; _a.endDate; _a.dataInterval; var token = _a.token;
4643
+ var subscriptionChargeId = _a.subscriptionChargeId; _a.startDate; _a.endDate; _a.dataInterval; var token = _a.token, apiHost = _a.apiHost;
4960
4644
  return __awaiter(void 0, void 0, void 0, function () {
4961
4645
  var vars, response;
4962
4646
  var _b;
@@ -4970,6 +4654,7 @@ var getFeatureUsage = function (_a) {
4970
4654
  query: FEATURE_USAGE_MUTATION,
4971
4655
  token: token,
4972
4656
  vars: vars,
4657
+ apiHost: apiHost,
4973
4658
  })];
4974
4659
  case 1:
4975
4660
  response = _c.sent();
@@ -5108,7 +4793,7 @@ var FeatureUsageGraph = function (_a) {
5108
4793
  }
5109
4794
  return false;
5110
4795
  }))
5111
- return "no usage";
4796
+ return jsx("div", { children: "no usage" });
5112
4797
  return (jsxs("div", __assign({ onClick: function () {
5113
4798
  setIsModalOpen(true);
5114
4799
  } }, { children: [jsx("div", __assign({ style: {
@@ -5140,7 +4825,7 @@ var templateObject_1;
5140
4825
 
5141
4826
  var MUTATION = "\nmutation quoteSubscriptionReinstate($ids: [ID!]!) {\n quoteSubscriptionReinstate(ids: $ids) {\n quote {\n id\n uuid\n accountId\n dealId\n name\n amount\n taxAmount\n discount\n netPaymentDays\n acceptedByName\n acceptedByTitle\n state\n billingDay\n evergreen\n requiresApproval\n isPendingApprovalRequest\n poNumber\n kind\n currencyId\n ownerId\n contactId\n quoteChanges {\n id\n priceListId\n charges {\n id\n pricingModel\n chargeType\n billingPeriod\n price\n priceDecimals\n tieredAveragePrice\n quantity\n quantityMin\n quantityMax\n discount\n amount\n prorationRate\n name\n invoiceLineText\n createdAt\n updatedAt\n startDate\n endDate\n billingPeriodAmounts { id amount prorationRate }\n currencyId\n couponId\n feature { id name code isUnit unitName }\n priceTiers { starts price }\n }\n }\n expiresAt\n createdAt\n updatedAt\n startDate\n endDate\n invoiceUntil\n applicationDate\n applied\n endDateOptions {\n endDate\n label\n }\n invoiceUntilOptions {\n endDate\n label\n }\n notes\n message\n amountsByPeriod {\n id\n name\n amount\n }\n subtotal\n credits\n discountValue\n }\n }\n}\n";
5142
4827
  var getGuoteSubscriptionReinstate = function (_a) {
5143
- var ids = _a.ids, token = _a.token, subdomain = _a.subdomain;
4828
+ var ids = _a.ids, token = _a.token, apiHost = _a.apiHost;
5144
4829
  return __awaiter(void 0, void 0, void 0, function () {
5145
4830
  var vars, response, _b, errors, quote;
5146
4831
  return __generator(this, function (_c) {
@@ -5151,7 +4836,7 @@ var getGuoteSubscriptionReinstate = function (_a) {
5151
4836
  query: MUTATION,
5152
4837
  token: token,
5153
4838
  vars: vars,
5154
- subdomain: subdomain,
4839
+ apiHost: apiHost,
5155
4840
  })];
5156
4841
  case 1:
5157
4842
  response = _c.sent();
@@ -5164,32 +4849,16 @@ var getGuoteSubscriptionReinstate = function (_a) {
5164
4849
  });
5165
4850
  };
5166
4851
 
5167
- var useCancelSubscription = function () {
5168
- var graphQLRequest = useGraphQLRequest();
5169
- return function (subscriptionIds, token) { return __awaiter(void 0, void 0, void 0, function () {
5170
- var data;
5171
- var _a;
5172
- return __generator(this, function (_b) {
5173
- switch (_b.label) {
5174
- case 0: return [4 /*yield*/, graphQLRequest("\n mutation SubscriptionCancel($subscriptionIds: [ID!]!) {\n subscriptionCancel(ids: $subscriptionIds) {\n subscriptions {\n accountId\n state\n }\n }\n }", token, { subscriptionIds: subscriptionIds })];
5175
- case 1:
5176
- data = _b.sent();
5177
- return [2 /*return*/, (_a = data === null || data === void 0 ? void 0 : data.subscriptions) === null || _a === void 0 ? void 0 : _a.nodes];
5178
- }
5179
- });
5180
- }); };
5181
- };
5182
-
5183
4852
  var SubscriptionCardActions = function (_a) {
5184
4853
  var _b, _c;
5185
4854
  var planChangeOptions = _a.planChangeOptions, subscription = _a.subscription, setEditingQuoteData = _a.setEditingQuoteData, setPayModalVisible = _a.setPayModalVisible;
5186
4855
  // Context
5187
- var _d = useContext(BunnyContext), token = _d.token, subdomain = _d.subdomain;
4856
+ var _d = useContext(BunnyContext), token = _d.token, apiHost = _d.apiHost;
5188
4857
  var _e = useContext(SubscriptionsContext), onChangePlanClick = _e.onChangePlanClick, onClickUpgrade = _e.onClickUpgrade, isTempViewOnly = _e.isTempViewOnly;
5189
4858
  // Hooks
5190
- var showSuccessNotification = NotificationUtils.useSuccessNotification();
5191
- var cancelSubscription = useCancelSubscription();
5192
- var queryClient = useQueryClient();
4859
+ useSuccessNotification();
4860
+ // const cancelSubscription = useCancelSubscription();
4861
+ useQueryClient();
5193
4862
  // const navigate = usePortalNavigate();
5194
4863
  // const handleUpgradingSubscriptionChange =
5195
4864
  // useHandleUpgradingSubscriptionChange();
@@ -5198,21 +4867,21 @@ var SubscriptionCardActions = function (_a) {
5198
4867
  var productPlans = (_b = planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.plans) === null || _b === void 0 ? void 0 : _b.filter(function (plan) { var _a; return ((_a = plan.priceLists) === null || _a === void 0 ? void 0 : _a.length) > 0 && plan.productId === subscription.product.id; });
5199
4868
  var canShowChangePlanButton = ((productPlans === null || productPlans === void 0 ? void 0 : productPlans.length) || 0) > 0;
5200
4869
  // Mutations
5201
- var subscriptionCancel = useMutation({
5202
- mutationFn: function () { return cancelSubscription([subscription.id], token); },
5203
- onSuccess: function () {
5204
- queryClient.invalidateQueries({
5205
- queryKey: QueryKeyFactory.default.createTableKey("subscriptions"),
5206
- });
5207
- showSuccessNotification("Subscription canceled");
5208
- },
5209
- });
4870
+ // const subscriptionCancel = useMutation({
4871
+ // mutationFn: () => cancelSubscription([subscription.id], token),
4872
+ // onSuccess: () => {
4873
+ // queryClient.invalidateQueries({
4874
+ // queryKey: QueryKeyFactory.default.createTableKey("subscriptions"),
4875
+ // });
4876
+ // showSuccessNotification("Subscription canceled");
4877
+ // },
4878
+ // });
5210
4879
  useMutation({
5211
4880
  mutationFn: function () {
5212
4881
  return getGuoteSubscriptionReinstate({
5213
4882
  ids: [subscription.id],
5214
4883
  token: token,
5215
- subdomain: subdomain,
4884
+ apiHost: apiHost,
5216
4885
  });
5217
4886
  },
5218
4887
  onSuccess: function (quote) {
@@ -5232,7 +4901,9 @@ var SubscriptionCardActions = function (_a) {
5232
4901
  onChangePlanClick();
5233
4902
  };
5234
4903
  return (canShowChangePlanButton || canShowCancelButton) &&
5235
- canShowSubscriptionActions(subscription) ? (jsxs(Fragment, { children: [!isTempViewOnly && canShowCancelButton && (jsx(Popconfirm, __assign({ icon: null, onConfirm: function () { return subscriptionCancel.mutate(); }, title: "Cancel subscription" }, { children: jsx(Button, __assign({ className: "p-0", type: "link" }, { children: "Cancel subscription" })) }))), !isTempViewOnly && canShowChangePlanButton && (jsx(Button, __assign({ onClick: function () { return handleChangePlanClick(); }, type: "primary" }, { children: "Change plan" })))] })) : ((_c = subscription.state) === null || _c === void 0 ? void 0 : _c.toUpperCase()) === SubscriptionState$2.TRIAL ? (jsx(Fragment, { children: !isTempViewOnly && (jsx(Button, __assign({ onClick: function () {
4904
+ canShowSubscriptionActions(subscription) ? (jsxs(Fragment, { children: [!isTempViewOnly && canShowCancelButton && (jsx(Popconfirm, __assign({ icon: null,
4905
+ // onConfirm={() => subscriptionCancel.mutate()}
4906
+ title: "Cancel subscription" }, { children: jsx(Button, __assign({ className: "p-0", type: "link" }, { children: "Cancel subscription" })) }))), !isTempViewOnly && canShowChangePlanButton && (jsx(Button, __assign({ onClick: function () { return handleChangePlanClick(); }, type: "primary" }, { children: "Change plan" })))] })) : ((_c = subscription.state) === null || _c === void 0 ? void 0 : _c.toUpperCase()) === SubscriptionState$2.TRIAL ? (jsx(Fragment, { children: !isTempViewOnly && (jsx(Button, __assign({ onClick: function () {
5236
4907
  // handleUpgradingSubscriptionChange({
5237
4908
  // subscription,
5238
4909
  // });
@@ -5250,22 +4921,22 @@ var getSubscriptionStatusText = function (subscription) {
5250
4921
  if (cancellationDate &&
5251
4922
  (state === null || state === void 0 ? void 0 : state.toUpperCase()) !== SubscriptionState$2.CANCELED &&
5252
4923
  (state === null || state === void 0 ? void 0 : state.toUpperCase()) !== SubscriptionState$2.EXPIRED) {
5253
- return (jsxs(Tag, __assign({ color: "red" }, { children: ["Canceled - ends on ", Misc.formatDate(cancellationDate)] })));
4924
+ return (jsxs(Tag, __assign({ color: "red" }, { children: ["Canceled - ends on ", formatDate(cancellationDate)] })));
5254
4925
  }
5255
4926
  if (evergreen) {
5256
- return "Renews on ".concat(Misc.formatDate(endDate));
4927
+ return "Renews on ".concat(formatDate(endDate));
5257
4928
  }
5258
4929
  if ((state === null || state === void 0 ? void 0 : state.toUpperCase()) === SubscriptionState$2.CANCELED ||
5259
4930
  (state === null || state === void 0 ? void 0 : state.toUpperCase()) === SubscriptionState$2.EXPIRED) {
5260
- return "Ended on ".concat(Misc.formatDate(endDate));
4931
+ return "Ended on ".concat(formatDate(endDate));
5261
4932
  }
5262
- return "Ends on ".concat(Misc.formatDate(endDate));
4933
+ return "Ends on ".concat(formatDate(endDate));
5263
4934
  };
5264
4935
  var SubscriptionCardHeader = function (_a) {
5265
4936
  var _b, _c, _d, _e, _f;
5266
4937
  var planChangeOptions = _a.planChangeOptions, setEditingQuoteData = _a.setEditingQuoteData, setPayModalVisible = _a.setPayModalVisible, subscription = _a.subscription;
5267
4938
  var darkMode = useContext(BunnyContext).darkMode;
5268
- var isMobile = useIsMobile$1();
4939
+ var isMobile = useIsMobile();
5269
4940
  // Derived state
5270
4941
  var trialDaysLeft = dayjs(subscription.trialEndDate).diff(dayjs(), "days");
5271
4942
  var isTrial = ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState$2.TRIAL;
@@ -5284,8 +4955,8 @@ var BillingPeriodConverter;
5284
4955
  })(BillingPeriodConverter || (BillingPeriodConverter = {}));
5285
4956
  var SubscriptionChargeTotal = function (_a) {
5286
4957
  var charge = _a.charge, subscription = _a.subscription;
5287
- var isMobile = useIsMobile$1();
5288
- return (jsxs("div", __assign({ className: "flex gap-1 ".concat(isMobile ? "flex-col" : "") }, { children: [jsx("div", { children: Misc.formatCurrency(Number(charge.periodPrice), subscription.currencyId) }), charge.billingPeriod && (jsx("div", { children: BillingPeriodConverter[charge.billingPeriod] }))] })));
4958
+ var isMobile = useIsMobile();
4959
+ return (jsxs("div", __assign({ className: "flex gap-1 ".concat(isMobile ? "flex-col" : "") }, { children: [jsx("div", { children: formatCurrency(Number(charge.periodPrice), subscription.currencyId) }), charge.billingPeriod && (jsx("div", { children: BillingPeriodConverter[charge.billingPeriod] }))] })));
5289
4960
  };
5290
4961
 
5291
4962
  var SubscriptionChargeUnitPrice = function (_a) {
@@ -5305,16 +4976,16 @@ var SubscriptionChargeUnitPrice = function (_a) {
5305
4976
  var ends = ((_c = (_b = (_a = charge.priceListCharge) === null || _a === void 0 ? void 0 : _a.priceListChargeTiers) === null || _b === void 0 ? void 0 : _b[index + 1]) === null || _c === void 0 ? void 0 : _c.starts)
5306
4977
  ? ((_e = (_d = charge.priceListCharge) === null || _d === void 0 ? void 0 : _d.priceListChargeTiers[index + 1]) === null || _e === void 0 ? void 0 : _e.starts) - 1
5307
4978
  : "∞";
5308
- return (jsxs("div", __assign({ className: "contents" }, { children: [jsxs("div", __assign({ className: "whitespace-nowrap" }, { children: [tier.starts.toLocaleString(), " - ", ends.toLocaleString(), " ", ":"] })), jsx("div", __assign({ className: "whitespace-nowrap text-right" }, { children: Misc.formatCurrency(tier.price, subscription.currencyId, charge.priceDecimals) }))] }), index));
4979
+ return (jsxs("div", __assign({ className: "contents" }, { children: [jsxs("div", __assign({ className: "whitespace-nowrap" }, { children: [tier.starts.toLocaleString(), " - ", ends.toLocaleString(), " ", ":"] })), jsx("div", __assign({ className: "whitespace-nowrap text-right" }, { children: formatCurrency(tier.price, subscription.currencyId, charge.priceDecimals) }))] }), index));
5309
4980
  }) })) })));
5310
4981
  }, onOpenChange: setShowPriceTiers, open: showPriceTiers, trigger: ["click"] }, { children: jsx("div", __assign({ className: "cursor-pointer underline", onClick: function () { return setShowPriceTiers(!showPriceTiers); } }, { children: showPriceTiers ? "hide details" : "show details" })) })));
5311
4982
  }
5312
- return (jsx(Fragment, { children: Misc.formatCurrency(charge.discountedPrice, subscription.currencyId) }));
4983
+ return jsx(Fragment, { children: formatCurrency(charge.discountedPrice, subscription.currencyId) });
5313
4984
  };
5314
4985
 
5315
4986
  var SubscriptionCardColumnHeaders = function (_a) {
5316
4987
  var columns = _a.columns;
5317
- return columns.map(function (subscriptionColumn, index) { return (jsx("div", __assign({ className: "text-slate-400 ".concat(subscriptionColumn.className), style: { fontSize: "11px" } }, { children: subscriptionColumn.title }), index)); });
4988
+ return (jsx(Fragment, { children: columns.map(function (subscriptionColumn, index) { return (jsx("div", __assign({ className: "text-slate-400 ".concat(subscriptionColumn.className), style: { fontSize: "11px" } }, { children: subscriptionColumn.title }), index)); }) }));
5318
4989
  };
5319
4990
 
5320
4991
  var Text$1 = Typography.Text;
@@ -5371,13 +5042,13 @@ var SubscriptionCardDesktop = function (_a) {
5371
5042
  var SubscriptionCardDesktopRow = function (_a) {
5372
5043
  var charge = _a.charge, chargeIndex = _a.chargeIndex, subscription = _a.subscription;
5373
5044
  // Context
5374
- var token = useContext(BunnyContext).token;
5045
+ var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
5375
5046
  // Derived state
5376
5047
  var isRamp = charge.isRamp;
5377
5048
  var prevCharge = subscription.charges[chargeIndex - 1];
5378
5049
  var isFirstRampRow = chargeIndex === 0 ||
5379
5050
  (prevCharge === null || prevCharge === void 0 ? void 0 : prevCharge.priceListChargeId) !== charge.priceListChargeId;
5380
- var chargePeriod = "".concat(Misc.formatDate(charge.startDate), " - ").concat(Misc.formatDate(charge.endDate));
5051
+ var chargePeriod = "".concat(formatDate(charge.startDate), " - ").concat(formatDate(charge.endDate));
5381
5052
  // Queries
5382
5053
  var data = useQuery({
5383
5054
  queryKey: ["getFeatureUsage", charge.id, charge.startDate, charge.endDate],
@@ -5387,6 +5058,7 @@ var SubscriptionCardDesktopRow = function (_a) {
5387
5058
  startDate: charge.startDate,
5388
5059
  subscriptionChargeId: charge.id,
5389
5060
  token: token,
5061
+ apiHost: apiHost,
5390
5062
  });
5391
5063
  },
5392
5064
  enabled: (!isRamp || (isRamp && isFirstRampRow)) &&
@@ -5446,7 +5118,7 @@ var SubscriptionCard = function (_a) {
5446
5118
  if ((isTrial && !charge.trial) || (!isTrial && charge.trial))
5447
5119
  return null;
5448
5120
  var isRamp = charge.isRamp;
5449
- var chargePeriod = "".concat(Misc.formatDate(charge.startDate), " - ").concat(Misc.formatDate(charge.endDate));
5121
+ var chargePeriod = "".concat(formatDate(charge.startDate), " - ").concat(formatDate(charge.endDate));
5450
5122
  return (jsxs("div", __assign({ className: "contents" }, { children: [((isRamp && chargeIndex === 0) || !isRamp) && (jsxs(SubscriptionCardCellMobile, __assign({ className: CHARGE_COLUMNS[0].className, style: { gridColumn: isRamp ? "1/-1" : "1" } }, { children: [jsx("span", { children: charge.name }), !isRamp ? " - ".concat(chargePeriod) : ""] }))), isRamp && (jsx(SubscriptionCardCellMobile, __assign({ className: CHARGE_COLUMNS[0].className }, { children: "- ".concat(chargePeriod) }))), jsx(SubscriptionCardCellMobile, __assign({ className: CHARGE_COLUMNS[1].className }, { children: charge.quantity })), jsx(SubscriptionCardCellMobile, __assign({ className: CHARGE_COLUMNS[2].className }, { children: jsx(SubscriptionChargeUnitPrice, { charge: charge, subscription: subscription }) })), jsx(SubscriptionCardCellMobile, __assign({ className: CHARGE_COLUMNS[3].className }, { children: jsx(SubscriptionChargeTotal, { charge: charge, subscription: subscription }) }))] }), chargeIndex));
5451
5123
  })] })), jsx("div", __assign({ className: "flex gap-2 pt-5", style: {
5452
5124
  flexDirection: "column-reverse",
@@ -5455,14 +5127,14 @@ var SubscriptionCard = function (_a) {
5455
5127
 
5456
5128
  var SubscriptionsList = function (_a) {
5457
5129
  var hideExpired = _a.hideExpired, planChangeOptions = _a.planChangeOptions, setEditingQuoteData = _a.setEditingQuoteData, setPayModalVisible = _a.setPayModalVisible, subscriptions = _a.subscriptions;
5458
- var isMobile = useIsMobile$1();
5459
- return subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.map(function (subscription, subscriptionIndex) {
5460
- if (hideExpired && isSubscriptionNotActive(subscription))
5461
- return null;
5462
- if (isMobile)
5463
- return (jsx(SubscriptionCard, { planChangeOptions: planChangeOptions, setEditingQuoteData: setEditingQuoteData, setPayModalVisible: setPayModalVisible, subscription: subscription }, subscriptionIndex));
5464
- return (jsx(SubscriptionCardDesktop, { planChangeOptions: planChangeOptions, setEditingQuoteData: setEditingQuoteData, setPayModalVisible: setPayModalVisible, subscription: subscription }, subscriptionIndex));
5465
- });
5130
+ var isMobile = useIsMobile();
5131
+ return (jsx(Fragment, { children: subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.map(function (subscription, subscriptionIndex) {
5132
+ if (hideExpired && isSubscriptionNotActive(subscription))
5133
+ return null;
5134
+ if (isMobile)
5135
+ return (jsx(SubscriptionCard, { planChangeOptions: planChangeOptions, setEditingQuoteData: setEditingQuoteData, setPayModalVisible: setPayModalVisible, subscription: subscription }, subscriptionIndex));
5136
+ return (jsx(SubscriptionCardDesktop, { planChangeOptions: planChangeOptions, setEditingQuoteData: setEditingQuoteData, setPayModalVisible: setPayModalVisible, subscription: subscription }, subscriptionIndex));
5137
+ }) }));
5466
5138
  };
5467
5139
 
5468
5140
  var ChangeQuantitiesButton = function (_a) {
@@ -5478,7 +5150,7 @@ var SubscriptionsNavigation = function (_a) {
5478
5150
  var hideExpired = _a.hideExpired, setHideExpired = _a.setHideExpired, setQuantityDrawerOpen = _a.setQuantityDrawerOpen, subscriptions = _a.subscriptions;
5479
5151
  var isTempViewOnly = useContext(SubscriptionsContext).isTempViewOnly;
5480
5152
  // Hooks
5481
- var isMobile = useIsMobile$1();
5153
+ var isMobile = useIsMobile();
5482
5154
  // Derived state
5483
5155
  var canShowChangeQuantitiesButton = canShowChangeQuantities({
5484
5156
  subscriptions: subscriptions,
@@ -5487,44 +5159,48 @@ var SubscriptionsNavigation = function (_a) {
5487
5159
  };
5488
5160
 
5489
5161
  var SubscriptionsContext = createContext({});
5162
+ // !!! This component is intended to be view only, however it still has lots of code for full functionality.
5163
+ // !!! This must be refactored.
5490
5164
  var Subscriptions = function (_a) {
5491
- var shadow = _a.shadow, gap = _a.gap, _b = _a.showTitle, showTitle = _b === void 0 ? true : _b;
5165
+ var companyName = _a.companyName, entityId = _a.entityId, gap = _a.gap, shadow = _a.shadow, _b = _a.showTitle, showTitle = _b === void 0 ? true : _b;
5492
5166
  // Context
5493
- var _c = useContext(BunnyContext), token = _c.token, subdomain = _c.subdomain;
5167
+ var _c = useContext(BunnyContext), token = _c.token, apiHost = _c.apiHost, onErrorNavigate = _c.onErrorNavigate;
5494
5168
  // Recoil state
5495
- var _d = useRecoilState(updatingChargeQuantityIdState), updatingChargeQuantityId = _d[0], setUpdatingChargeQuantityId = _d[1];
5169
+ // const [updatingChargeQuantityId, setUpdatingChargeQuantityId] =
5170
+ // useRecoilState(updatingChargeQuantityIdState);
5496
5171
  // Local state
5497
- var _e = useState(), editingQuoteData = _e[0], setEditingQuoteData = _e[1];
5498
- var _f = useState(false), payModalVisible = _f[0], setPayModalVisible = _f[1];
5499
- var _g = useState(true), hideExpired = _g[0], setHideExpired = _g[1];
5500
- var _h = useState(false), quantityDrawerOpen = _h[0], setQuantityDrawerOpen = _h[1];
5172
+ var _d = useState(), editingQuoteData = _d[0], setEditingQuoteData = _d[1];
5173
+ var _e = useState(false), payModalVisible = _e[0], setPayModalVisible = _e[1];
5174
+ var _f = useState(true), hideExpired = _f[0], setHideExpired = _f[1];
5175
+ var _g = useState(false); _g[0]; var setQuantityDrawerOpen = _g[1];
5501
5176
  // Hooks
5502
- var handleAllErrorFormats = NotificationUtils.useAllErrorFormats(function () { });
5177
+ var handleAllErrorFormats = useAllErrorFormats(onErrorNavigate ||
5178
+ (function (url) {
5179
+ console.log("navigate to", url, " not implemented");
5180
+ }));
5503
5181
  var queryClient = useQueryClient();
5504
- var showSuccessNotification = NotificationUtils.useSuccessNotification();
5505
- var quoteDelete = useQuoteDelete();
5506
- var isMobile = useIsMobile$1();
5507
- var entityId = useCurrentUserData().entityId;
5508
- var companyName = useCurrentUserData().companyName;
5182
+ var showSuccessNotification = useSuccessNotification();
5183
+ // const quoteDelete = useQuoteDelete();
5184
+ var isMobile = useIsMobile();
5509
5185
  // Queries
5510
- var _j = useQuery({
5186
+ var _h = useQuery({
5511
5187
  queryKey: QueryKeyFactory.default.createTableKey("subscriptions"),
5512
- queryFn: function () { return getSubscriptions({ entityId: entityId, token: token, subdomain: subdomain }); },
5188
+ queryFn: function () { return getSubscriptions({ entityId: entityId, token: token, apiHost: apiHost }); },
5513
5189
  enabled: Boolean(entityId),
5514
- }), rawSubscriptions = _j.data, subscriptionsAreLoading = _j.isLoading;
5190
+ }), rawSubscriptions = _h.data, subscriptionsAreLoading = _h.isLoading;
5515
5191
  var quote = useQuery({
5516
5192
  queryKey: QueryKeyFactory.default.createObjectKey("editingQuote", editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.id),
5517
5193
  queryFn: function () {
5518
5194
  return (editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.id)
5519
- ? getQuote({ token: token, id: editingQuoteData.id, subdomain: subdomain })
5195
+ ? getQuote({ token: token, id: editingQuoteData.id, apiHost: apiHost })
5520
5196
  : undefined;
5521
5197
  },
5522
5198
  enabled: Boolean(editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.id),
5523
5199
  }).data;
5524
- var _k = useQuery({
5200
+ var _j = useQuery({
5525
5201
  queryKey: QueryKeyFactory.default.planChangeOptionsKey(),
5526
- queryFn: function () { return getPlanChangeOptions({ token: token, subdomain: subdomain }); },
5527
- }), planChangeOptions = _k.data, arePlanChangeOptionsLoading = _k.isLoading;
5202
+ queryFn: function () { return getPlanChangeOptions({ token: token, apiHost: apiHost }); },
5203
+ }), planChangeOptions = _j.data, arePlanChangeOptionsLoading = _j.isLoading;
5528
5204
  // Derived state
5529
5205
  var subscriptions = useSubscriptions({ data: rawSubscriptions });
5530
5206
  var allSubscriptionsExpired = subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.every(function (subscription) {
@@ -5556,16 +5232,16 @@ var Subscriptions = function (_a) {
5556
5232
  var onFail = function (error) {
5557
5233
  handleAllErrorFormats(error);
5558
5234
  };
5559
- var onClose = function () {
5560
- if (editingQuoteData) {
5561
- quoteDelete(editingQuoteData.id, token);
5562
- setEditingQuoteData(undefined);
5563
- }
5564
- if (updatingChargeQuantityId) {
5565
- setUpdatingChargeQuantityId(undefined);
5566
- }
5567
- setQuantityDrawerOpen(false);
5568
- };
5235
+ // const onClose = () => {
5236
+ // if (editingQuoteData) {
5237
+ // quoteDelete(editingQuoteData.id, token);
5238
+ // setEditingQuoteData(undefined);
5239
+ // }
5240
+ // // if (updatingChargeQuantityId) {
5241
+ // // setUpdatingChargeQuantityId(undefined);
5242
+ // // }
5243
+ // setQuantityDrawerOpen(false);
5244
+ // };
5569
5245
  if (subscriptionsAreLoading || arePlanChangeOptionsLoading)
5570
5246
  return jsx(Fragment, {});
5571
5247
  return (jsxs(SubscriptionsContext.Provider, __assign({ value: {
@@ -5579,9 +5255,9 @@ var Subscriptions = function (_a) {
5579
5255
  shadow: shadow,
5580
5256
  gap: gap,
5581
5257
  showTitle: showTitle,
5582
- } }, { children: [showTitle && (jsx(PageHeaderWithActions, __assign({ title: jsxs("div", __assign({ className: "flex items-center justify-between", style: { minWidth: "137px" } }, { children: [hideExpired ? "Active subscriptions" : "All subscriptions", isMobile && (jsx(HideExpiredToggle, { hideExpired: hideExpired, setHideExpired: setHideExpired, subscriptions: subscriptions }))] })) }, { children: !isMobile && (jsx(SubscriptionsNavigation, { hideExpired: hideExpired, setHideExpired: setHideExpired, setQuantityDrawerOpen: setQuantityDrawerOpen, subscriptions: subscriptions })) }))), jsx(PageContent, __assign({ className: "flex flex-col gap-".concat(gap === undefined ? 4 : gap, " shadow-padding-xb overflow-auto"), style: {
5258
+ } }, { children: [showTitle && (jsx(PageHeaderWithActions, __assign({ title: jsxs("div", __assign({ className: "flex items-center justify-between", style: { minWidth: "137px" } }, { children: [hideExpired ? "Active subscriptions" : "All subscriptions", isMobile && (jsx(HideExpiredToggle, { hideExpired: hideExpired, setHideExpired: setHideExpired, subscriptions: subscriptions }))] })) }, { children: !isMobile && (jsx(SubscriptionsNavigation, { hideExpired: hideExpired, setHideExpired: setHideExpired, setQuantityDrawerOpen: setQuantityDrawerOpen, subscriptions: subscriptions })) }))), jsx("div", __assign({ className: "flex flex-col gap-".concat(gap === undefined ? 4 : gap, " shadow-padding-xb overflow-auto"), style: {
5583
5259
  flexShrink: 1,
5584
- } }, { children: (subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.length) > 0 ? (jsx(SubscriptionsList, { hideExpired: hideExpired, planChangeOptions: planChangeOptions, setEditingQuoteData: setEditingQuoteData, setPayModalVisible: setPayModalVisible, subscriptions: subscriptions })) : (jsx("div", __assign({ className: "flex flex-col items-center w-full" }, { children: jsx(ErrorView, { message: "You have no subscriptions with ".concat(companyName, " yet") }) }))) })), isMobile && (jsx("div", __assign({ className: "pt-4 pb-2" }, { children: jsx(SubscriptionsNavigation, { hideExpired: hideExpired, setHideExpired: setHideExpired, setQuantityDrawerOpen: setQuantityDrawerOpen, subscriptions: subscriptions }) }))), jsx(Footer, {}), jsx(QuantityChangeDrawerDesktop, { editingQuote: quote, editingQuoteData: editingQuoteData, onClose: onClose, open: quantityDrawerOpen, openCheckout: function () { return setPayModalVisible(true); }, setEditingQuoteData: setEditingQuoteData, subscriptions: subscriptions }), jsx(Checkout, { onCancel: onCancel, onSuccess: onSuccess, onFail: onFail, open: payModalVisible, quote: quote, token: token, isMobile: isMobile })] })));
5260
+ } }, { children: (subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.length) > 0 ? (jsx(Fragment, { children: jsx(SubscriptionsList, { hideExpired: hideExpired, planChangeOptions: planChangeOptions, setEditingQuoteData: setEditingQuoteData, setPayModalVisible: setPayModalVisible, subscriptions: subscriptions }) })) : (jsx("div", __assign({ className: "flex flex-col items-center w-full" }, { children: jsx(ErrorView, { message: "You have no subscriptions with ".concat(companyName, " yet") }) }))) })), isMobile && (jsx("div", __assign({ className: "pt-4 pb-2" }, { children: jsx(SubscriptionsNavigation, { hideExpired: hideExpired, setHideExpired: setHideExpired, setQuantityDrawerOpen: setQuantityDrawerOpen, subscriptions: subscriptions }) }))), jsx(Checkout, { entityId: entityId, onCancel: onCancel, onSuccess: onSuccess, onFail: onFail, open: payModalVisible, quote: quote, token: token, isMobile: isMobile })] })));
5585
5261
  };
5586
5262
 
5587
5263
  export { BunnyProvider, Checkout, Invoice, PaymentMethod, Quote, Quotes, Signup, Subscriptions, Transactions, getQuoteAmountDue, usePaymentMethod };