@bunnyapp/components 1.0.7 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. package/dist/cjs/index.js +730 -1052
  2. package/dist/cjs/playground/main.d.ts +1 -1
  3. package/dist/cjs/src/ajax.d.ts +1 -0
  4. package/dist/cjs/src/components/BunnyProvider.d.ts +9 -5
  5. package/dist/cjs/src/components/Checkout/Checkout.d.ts +4 -2
  6. package/dist/cjs/src/components/Checkout/InvoiceCheckout.d.ts +2 -1
  7. package/dist/cjs/src/components/Checkout/QuoteCheckout.d.ts +2 -1
  8. package/dist/cjs/src/components/FeatureUsageGraph.d.ts +1 -1
  9. package/dist/cjs/src/components/Invoice/Invoice.d.ts +2 -2
  10. package/dist/cjs/src/components/Invoice/InvoiceQuoteView.d.ts +1 -2
  11. package/dist/cjs/src/components/LegacyInvoicePDF.d.ts +2 -2
  12. package/dist/cjs/src/components/PaymentForm/DemoPay/demoPayUtils.d.ts +1 -1
  13. package/dist/cjs/src/components/PaymentForm/Finix/FinixCardForm.d.ts +1 -1
  14. package/dist/cjs/src/components/PaymentForm/FinixAch.d.ts +1 -1
  15. package/dist/cjs/src/components/PaymentForm/PaymentForm.d.ts +1 -1
  16. package/dist/cjs/src/components/PaymentForm/PaymentFormTypes.d.ts +1 -0
  17. package/dist/cjs/src/components/PaymentForm/PaymentMethod/PaymentMethod.d.ts +2 -2
  18. package/dist/cjs/src/components/PaymentForm/PaymentMethod/PaymentMethodContext.d.ts +0 -1
  19. package/dist/cjs/src/components/PaymentForm/PaymentMethodForm.d.ts +1 -1
  20. package/dist/cjs/src/components/PaymentForm/Stripe/StripeForm.d.ts +1 -1
  21. package/dist/cjs/src/components/PaymentForm/Stripe/stripeUtils.d.ts +6 -6
  22. package/dist/cjs/src/components/PaymentForm/paymentUtils.d.ts +2 -2
  23. package/dist/cjs/src/components/Quote/Quote.d.ts +2 -2
  24. package/dist/cjs/src/components/Quotes/Quotes.d.ts +2 -1
  25. package/dist/cjs/src/components/Signup/PaymentForms.d.ts +2 -2
  26. package/dist/cjs/src/components/Signup/PaymentSuccess.d.ts +4 -3
  27. package/dist/cjs/src/components/Signup/Signup.d.ts +3 -1
  28. package/dist/cjs/src/components/Subscriptions/Subscriptions.d.ts +4 -2
  29. package/dist/cjs/src/components/Subscriptions/subscriptionsList/SubscriptionsList.d.ts +1 -1
  30. package/dist/cjs/src/components/Subscriptions/subscriptionsList/subscriptionCardDesktop/SubscriptionCardColumnHeaders.d.ts +1 -1
  31. package/dist/cjs/src/components/Subscriptions/subscriptionsList/subscriptionUtils.d.ts +1 -2
  32. package/dist/cjs/src/components/Transactions/Transactions.d.ts +3 -1
  33. package/dist/cjs/src/components/Transactions/TransactionsListContext.d.ts +1 -0
  34. package/dist/cjs/src/components/Transactions/transactionsList/TransactionDownload.d.ts +2 -2
  35. package/dist/cjs/src/components/Transactions/transactionsList/TransactionsListDesktop.d.ts +1 -11
  36. package/dist/cjs/src/contexts/NavigationContext.d.ts +1 -1
  37. package/dist/cjs/src/graphql/mutations/accountSignup.d.ts +2 -2
  38. package/dist/cjs/src/graphql/mutations/accountUpdate.d.ts +2 -1
  39. package/dist/cjs/src/graphql/mutations/checkout.d.ts +2 -2
  40. package/dist/cjs/src/graphql/mutations/portalSessionCreate.d.ts +2 -2
  41. package/dist/cjs/src/graphql/mutations/quoteAccountSignup.d.ts +2 -2
  42. package/dist/cjs/src/graphql/mutations/quoteAddCoupon.d.ts +2 -1
  43. package/dist/cjs/src/graphql/mutations/quoteCompose.d.ts +2 -2
  44. package/dist/cjs/src/graphql/mutations/quoteCreate.d.ts +2 -2
  45. package/dist/cjs/src/graphql/mutations/quoteRecalculateTaxes.d.ts +2 -1
  46. package/dist/cjs/src/graphql/mutations/quoteSubscriptionReinstate.d.ts +2 -2
  47. package/dist/cjs/src/graphql/queries/getAccount.d.ts +2 -2
  48. package/dist/cjs/src/graphql/queries/getBranding.d.ts +2 -2
  49. package/dist/cjs/src/graphql/queries/getCurrentUserData.d.ts +2 -2
  50. package/dist/cjs/src/graphql/queries/getFeatureUsage.d.ts +2 -1
  51. package/dist/cjs/src/graphql/queries/getFormattedQuote.d.ts +2 -2
  52. package/dist/cjs/src/graphql/queries/getInvoice.d.ts +2 -2
  53. package/dist/cjs/src/graphql/queries/getPlanChangeOptions.d.ts +2 -2
  54. package/dist/cjs/src/graphql/queries/getPriceList.d.ts +2 -2
  55. package/dist/cjs/src/graphql/queries/getQuote.d.ts +2 -2
  56. package/dist/cjs/src/graphql/queries/getQuotes.d.ts +2 -2
  57. package/dist/cjs/src/graphql/queries/getSubscription.d.ts +2 -2
  58. package/dist/cjs/src/graphql/queries/getSubscriptions.d.ts +2 -2
  59. package/dist/cjs/src/graphql/queries/getTaxationRequiredAccountFields.d.ts +6 -0
  60. package/dist/cjs/src/graphql/queries/getTransactions.d.ts +1 -1
  61. package/dist/cjs/src/hooks/quotes/useSendAcceptQuote.d.ts +7 -1
  62. package/dist/cjs/src/hooks/useHasTaxPlugin.d.ts +3 -2
  63. package/dist/cjs/src/hooks/usePaymentPlugins.d.ts +11 -0
  64. package/dist/cjs/src/hooks/usePlugins.d.ts +6 -0
  65. package/dist/cjs/src/hooks/useSigningPlugins.d.ts +5 -1
  66. package/dist/cjs/src/index.d.ts +1 -0
  67. package/dist/cjs/src/utils/GraphQLClient.d.ts +2 -0
  68. package/dist/cjs/src/utils/quoteInvoiceUtils.d.ts +6 -0
  69. package/dist/esm/index.js +722 -1043
  70. package/dist/esm/playground/main.d.ts +1 -1
  71. package/dist/esm/src/ajax.d.ts +1 -0
  72. package/dist/esm/src/components/BunnyProvider.d.ts +9 -5
  73. package/dist/esm/src/components/Checkout/Checkout.d.ts +4 -2
  74. package/dist/esm/src/components/Checkout/InvoiceCheckout.d.ts +2 -1
  75. package/dist/esm/src/components/Checkout/QuoteCheckout.d.ts +2 -1
  76. package/dist/esm/src/components/FeatureUsageGraph.d.ts +1 -1
  77. package/dist/esm/src/components/Invoice/Invoice.d.ts +2 -2
  78. package/dist/esm/src/components/Invoice/InvoiceQuoteView.d.ts +1 -2
  79. package/dist/esm/src/components/LegacyInvoicePDF.d.ts +2 -2
  80. package/dist/esm/src/components/PaymentForm/DemoPay/demoPayUtils.d.ts +1 -1
  81. package/dist/esm/src/components/PaymentForm/Finix/FinixCardForm.d.ts +1 -1
  82. package/dist/esm/src/components/PaymentForm/FinixAch.d.ts +1 -1
  83. package/dist/esm/src/components/PaymentForm/PaymentForm.d.ts +1 -1
  84. package/dist/esm/src/components/PaymentForm/PaymentFormTypes.d.ts +1 -0
  85. package/dist/esm/src/components/PaymentForm/PaymentMethod/PaymentMethod.d.ts +2 -2
  86. package/dist/esm/src/components/PaymentForm/PaymentMethod/PaymentMethodContext.d.ts +0 -1
  87. package/dist/esm/src/components/PaymentForm/PaymentMethodForm.d.ts +1 -1
  88. package/dist/esm/src/components/PaymentForm/Stripe/StripeForm.d.ts +1 -1
  89. package/dist/esm/src/components/PaymentForm/Stripe/stripeUtils.d.ts +6 -6
  90. package/dist/esm/src/components/PaymentForm/paymentUtils.d.ts +2 -2
  91. package/dist/esm/src/components/Quote/Quote.d.ts +2 -2
  92. package/dist/esm/src/components/Quotes/Quotes.d.ts +2 -1
  93. package/dist/esm/src/components/Signup/PaymentForms.d.ts +2 -2
  94. package/dist/esm/src/components/Signup/PaymentSuccess.d.ts +4 -3
  95. package/dist/esm/src/components/Signup/Signup.d.ts +3 -1
  96. package/dist/esm/src/components/Subscriptions/Subscriptions.d.ts +4 -2
  97. package/dist/esm/src/components/Subscriptions/subscriptionsList/SubscriptionsList.d.ts +1 -1
  98. package/dist/esm/src/components/Subscriptions/subscriptionsList/subscriptionCardDesktop/SubscriptionCardColumnHeaders.d.ts +1 -1
  99. package/dist/esm/src/components/Subscriptions/subscriptionsList/subscriptionUtils.d.ts +1 -2
  100. package/dist/esm/src/components/Transactions/Transactions.d.ts +3 -1
  101. package/dist/esm/src/components/Transactions/TransactionsListContext.d.ts +1 -0
  102. package/dist/esm/src/components/Transactions/transactionsList/TransactionDownload.d.ts +2 -2
  103. package/dist/esm/src/components/Transactions/transactionsList/TransactionsListDesktop.d.ts +1 -11
  104. package/dist/esm/src/contexts/NavigationContext.d.ts +1 -1
  105. package/dist/esm/src/graphql/mutations/accountSignup.d.ts +2 -2
  106. package/dist/esm/src/graphql/mutations/accountUpdate.d.ts +2 -1
  107. package/dist/esm/src/graphql/mutations/checkout.d.ts +2 -2
  108. package/dist/esm/src/graphql/mutations/portalSessionCreate.d.ts +2 -2
  109. package/dist/esm/src/graphql/mutations/quoteAccountSignup.d.ts +2 -2
  110. package/dist/esm/src/graphql/mutations/quoteAddCoupon.d.ts +2 -1
  111. package/dist/esm/src/graphql/mutations/quoteCompose.d.ts +2 -2
  112. package/dist/esm/src/graphql/mutations/quoteCreate.d.ts +2 -2
  113. package/dist/esm/src/graphql/mutations/quoteRecalculateTaxes.d.ts +2 -1
  114. package/dist/esm/src/graphql/mutations/quoteSubscriptionReinstate.d.ts +2 -2
  115. package/dist/esm/src/graphql/queries/getAccount.d.ts +2 -2
  116. package/dist/esm/src/graphql/queries/getBranding.d.ts +2 -2
  117. package/dist/esm/src/graphql/queries/getCurrentUserData.d.ts +2 -2
  118. package/dist/esm/src/graphql/queries/getFeatureUsage.d.ts +2 -1
  119. package/dist/esm/src/graphql/queries/getFormattedQuote.d.ts +2 -2
  120. package/dist/esm/src/graphql/queries/getInvoice.d.ts +2 -2
  121. package/dist/esm/src/graphql/queries/getPlanChangeOptions.d.ts +2 -2
  122. package/dist/esm/src/graphql/queries/getPriceList.d.ts +2 -2
  123. package/dist/esm/src/graphql/queries/getQuote.d.ts +2 -2
  124. package/dist/esm/src/graphql/queries/getQuotes.d.ts +2 -2
  125. package/dist/esm/src/graphql/queries/getSubscription.d.ts +2 -2
  126. package/dist/esm/src/graphql/queries/getSubscriptions.d.ts +2 -2
  127. package/dist/esm/src/graphql/queries/getTaxationRequiredAccountFields.d.ts +6 -0
  128. package/dist/esm/src/graphql/queries/getTransactions.d.ts +1 -1
  129. package/dist/esm/src/hooks/quotes/useSendAcceptQuote.d.ts +7 -1
  130. package/dist/esm/src/hooks/useHasTaxPlugin.d.ts +3 -2
  131. package/dist/esm/src/hooks/usePaymentPlugins.d.ts +11 -0
  132. package/dist/esm/src/hooks/usePlugins.d.ts +6 -0
  133. package/dist/esm/src/hooks/useSigningPlugins.d.ts +5 -1
  134. package/dist/esm/src/index.d.ts +1 -0
  135. package/dist/esm/src/utils/GraphQLClient.d.ts +2 -0
  136. package/dist/esm/src/utils/quoteInvoiceUtils.d.ts +6 -0
  137. package/dist/index.d.ts +28 -14
  138. package/package.json +10 -7
  139. package/dist/cjs/src/atoms/pageContentRefAtom.d.ts +0 -1
  140. package/dist/cjs/src/atoms/planPickerQuoteDataAtom.d.ts +0 -2
  141. package/dist/cjs/src/atoms/updatingChargeQuantityIdAtom.d.ts +0 -2
  142. package/dist/cjs/src/components/Footer.d.ts +0 -4
  143. package/dist/cjs/src/components/PageContent.d.ts +0 -7
  144. package/dist/cjs/src/features/quantityChangeDrawer/QuantityChangeGridRow.d.ts +0 -11
  145. package/dist/cjs/src/features/quantityChangeDrawer/QuantityChangeGridTitle.d.ts +0 -6
  146. package/dist/cjs/src/features/quantityChangeDrawer/QuantityInput.d.ts +0 -21
  147. package/dist/cjs/src/features/quantityChangeDrawer/QuoteChangeSummarySection.d.ts +0 -9
  148. package/dist/cjs/src/features/quantityChangeDrawer/quantityChangeDrawerDesktop/QuantityChangeDrawerDesktop.d.ts +0 -14
  149. package/dist/cjs/src/graphql/QuoteRequests.d.ts +0 -6
  150. package/dist/cjs/src/graphql/SubscriptionRequests.d.ts +0 -2
  151. package/dist/cjs/src/graphql/queries/getFormattedInvoice.d.ts +0 -7
  152. package/dist/cjs/src/hooks/useCurrentUserData.d.ts +0 -2
  153. package/dist/cjs/src/hooks/useIsMobile.d.ts +0 -10
  154. package/dist/cjs/src/utils.d.ts +0 -9
  155. package/dist/esm/src/atoms/pageContentRefAtom.d.ts +0 -1
  156. package/dist/esm/src/atoms/planPickerQuoteDataAtom.d.ts +0 -2
  157. package/dist/esm/src/atoms/updatingChargeQuantityIdAtom.d.ts +0 -2
  158. package/dist/esm/src/components/Footer.d.ts +0 -4
  159. package/dist/esm/src/components/PageContent.d.ts +0 -7
  160. package/dist/esm/src/features/quantityChangeDrawer/QuantityChangeGridRow.d.ts +0 -11
  161. package/dist/esm/src/features/quantityChangeDrawer/QuantityChangeGridTitle.d.ts +0 -6
  162. package/dist/esm/src/features/quantityChangeDrawer/QuantityInput.d.ts +0 -21
  163. package/dist/esm/src/features/quantityChangeDrawer/QuoteChangeSummarySection.d.ts +0 -9
  164. package/dist/esm/src/features/quantityChangeDrawer/quantityChangeDrawerDesktop/QuantityChangeDrawerDesktop.d.ts +0 -14
  165. package/dist/esm/src/graphql/QuoteRequests.d.ts +0 -6
  166. package/dist/esm/src/graphql/SubscriptionRequests.d.ts +0 -2
  167. package/dist/esm/src/graphql/queries/getFormattedInvoice.d.ts +0 -7
  168. package/dist/esm/src/hooks/useCurrentUserData.d.ts +0 -2
  169. package/dist/esm/src/hooks/useIsMobile.d.ts +0 -10
  170. package/dist/esm/src/utils.d.ts +0 -9
package/dist/cjs/index.js CHANGED
@@ -9,13 +9,13 @@ var antd = require('antd');
9
9
  var styled = require('styled-components');
10
10
  var common = require('@bunnyapp/common');
11
11
  var reactQuery = require('@tanstack/react-query');
12
- var recoil = require('recoil');
13
12
  var theme = require('antd/lib/theme');
13
+ var recoil = require('recoil');
14
+ var graphqlRequest = import('graphql-request');
14
15
  var reactHelmetAsync = require('react-helmet-async');
15
16
  var reactStripeJs = require('@stripe/react-stripe-js');
16
17
  var pure = require('@stripe/stripe-js/pure');
17
18
  var lodash = require('lodash');
18
- var request = import('graphql-request');
19
19
  var recharts = require('recharts');
20
20
 
21
21
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -42,7 +42,36 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
42
42
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
43
43
  var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
44
44
  var theme__default = /*#__PURE__*/_interopDefaultLegacy(theme);
45
- var request__default = /*#__PURE__*/_interopDefaultLegacy(request);
45
+
46
+ function styleInject(css, ref) {
47
+ if ( ref === void 0 ) ref = {};
48
+ var insertAt = ref.insertAt;
49
+
50
+ if (!css || typeof document === 'undefined') { return; }
51
+
52
+ var head = document.head || document.getElementsByTagName('head')[0];
53
+ var style = document.createElement('style');
54
+ style.type = 'text/css';
55
+
56
+ if (insertAt === 'top') {
57
+ if (head.firstChild) {
58
+ head.insertBefore(style, head.firstChild);
59
+ } else {
60
+ head.appendChild(style);
61
+ }
62
+ } else {
63
+ head.appendChild(style);
64
+ }
65
+
66
+ if (style.styleSheet) {
67
+ style.styleSheet.cssText = css;
68
+ } else {
69
+ style.appendChild(document.createTextNode(css));
70
+ }
71
+ }
72
+
73
+ var css_248z$1 = "/*! tailwindcss v4.0.0 | MIT License | https://tailwindcss.com */\n@import url(./global-vars.less);\n@tailwind base;\n@tailwind components;\n.\\@container {\n container-type: inline-size;\n}\n.\\!visible {\n visibility: visible !important;\n}\n.collapse {\n visibility: collapse;\n}\n.invisible {\n visibility: hidden;\n}\n.visible {\n visibility: visible;\n}\n.sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n}\n.\\!fixed {\n position: fixed !important;\n}\n.\\!relative {\n position: relative !important;\n}\n.absolute {\n position: absolute;\n}\n.fixed {\n position: fixed;\n}\n.relative {\n position: relative;\n}\n.static {\n position: static;\n}\n.sticky {\n position: sticky;\n}\n.-top-1 {\n top: calc(var(--spacing) * -1);\n}\n.top-0 {\n top: calc(var(--spacing) * 0);\n}\n.right-0 {\n right: calc(var(--spacing) * 0);\n}\n.bottom-0 {\n bottom: calc(var(--spacing) * 0);\n}\n.left-0 {\n left: calc(var(--spacing) * 0);\n}\n.isolate {\n isolation: isolate;\n}\n.z-50 {\n z-index: 50;\n}\n.col-span-2 {\n grid-column: span 2 / span 2;\n}\n.col-span-3 {\n grid-column: span 3 / span 3;\n}\n.col-span-full {\n grid-column: 1 / -1;\n}\n.float-left {\n float: left;\n}\n.float-right {\n float: right;\n}\n.\\!container {\n width: 100% !important;\n @media (width >= 40rem) {\n max-width: 40rem !important;\n }\n @media (width >= 48rem) {\n max-width: 48rem !important;\n }\n @media (width >= 64rem) {\n max-width: 64rem !important;\n }\n @media (width >= 80rem) {\n max-width: 80rem !important;\n }\n @media (width >= 96rem) {\n max-width: 96rem !important;\n }\n}\n.container {\n width: 100%;\n @media (width >= 40rem) {\n max-width: 40rem;\n }\n @media (width >= 48rem) {\n max-width: 48rem;\n }\n @media (width >= 64rem) {\n max-width: 64rem;\n }\n @media (width >= 80rem) {\n max-width: 80rem;\n }\n @media (width >= 96rem) {\n max-width: 96rem;\n }\n}\n.m-0 {\n margin: calc(var(--spacing) * 0);\n}\n.m-1 {\n margin: calc(var(--spacing) * 1);\n}\n.m-2 {\n margin: calc(var(--spacing) * 2);\n}\n.m-25 {\n margin: calc(var(--spacing) * 25);\n}\n.m-55296 {\n margin: calc(var(--spacing) * 55296);\n}\n.mx-8 {\n margin-inline: calc(var(--spacing) * 8);\n}\n.mx-auto {\n margin-inline: auto;\n}\n.my-2 {\n margin-block: calc(var(--spacing) * 2);\n}\n.my-4 {\n margin-block: calc(var(--spacing) * 4);\n}\n.my-12 {\n margin-block: calc(var(--spacing) * 12);\n}\n.me-1 {\n margin-inline-end: calc(var(--spacing) * 1);\n}\n.mt-1 {\n margin-top: calc(var(--spacing) * 1);\n}\n.mt-2 {\n margin-top: calc(var(--spacing) * 2);\n}\n.mt-4 {\n margin-top: calc(var(--spacing) * 4);\n}\n.mt-6 {\n margin-top: calc(var(--spacing) * 6);\n}\n.mt-8 {\n margin-top: calc(var(--spacing) * 8);\n}\n.mr-8 {\n margin-right: calc(var(--spacing) * 8);\n}\n.mb-2 {\n margin-bottom: calc(var(--spacing) * 2);\n}\n.mb-4 {\n margin-bottom: calc(var(--spacing) * 4);\n}\n.mb-8 {\n margin-bottom: calc(var(--spacing) * 8);\n}\n.ml-2 {\n margin-left: calc(var(--spacing) * 2);\n}\n.\\!block {\n display: block !important;\n}\n.\\!grid {\n display: grid !important;\n}\n.\\!hidden {\n display: none !important;\n}\n.\\!table {\n display: table !important;\n}\n.block {\n display: block;\n}\n.contents {\n display: contents;\n}\n.flex {\n display: flex;\n}\n.grid {\n display: grid;\n}\n.hidden {\n display: none;\n}\n.inline {\n display: inline;\n}\n.inline-block {\n display: inline-block;\n}\n.inline-flex {\n display: inline-flex;\n}\n.inline-grid {\n display: inline-grid;\n}\n.list-item {\n display: list-item;\n}\n.table {\n display: table;\n}\n.table-caption {\n display: table-caption;\n}\n.table-cell {\n display: table-cell;\n}\n.table-column {\n display: table-column;\n}\n.table-column-group {\n display: table-column-group;\n}\n.table-footer-group {\n display: table-footer-group;\n}\n.table-header-group {\n display: table-header-group;\n}\n.table-row {\n display: table-row;\n}\n.table-row-group {\n display: table-row-group;\n}\n.size-1 {\n width: calc(var(--spacing) * 1);\n height: calc(var(--spacing) * 1);\n}\n.size-4 {\n width: calc(var(--spacing) * 4);\n height: calc(var(--spacing) * 4);\n}\n.size-7 {\n width: calc(var(--spacing) * 7);\n height: calc(var(--spacing) * 7);\n}\n.size-8 {\n width: calc(var(--spacing) * 8);\n height: calc(var(--spacing) * 8);\n}\n.size-11 {\n width: calc(var(--spacing) * 11);\n height: calc(var(--spacing) * 11);\n}\n.size-15 {\n width: calc(var(--spacing) * 15);\n height: calc(var(--spacing) * 15);\n}\n.h-1 {\n height: calc(var(--spacing) * 1);\n}\n.h-3 {\n height: calc(var(--spacing) * 3);\n}\n.h-4 {\n height: calc(var(--spacing) * 4);\n}\n.h-5 {\n height: calc(var(--spacing) * 5);\n}\n.h-8 {\n height: calc(var(--spacing) * 8);\n}\n.h-100 {\n height: calc(var(--spacing) * 100);\n}\n.h-16 {\n height: calc(var(--spacing) * 16);\n}\n.h-16\\/116 {\n height: calc(16/116 * 100%);\n}\n.h-full {\n height: 100%;\n}\n.h-screen {\n height: 100vh;\n}\n.w-1 {\n width: calc(var(--spacing) * 1);\n}\n.w-1\\/2 {\n width: calc(1/2 * 100%);\n}\n.w-4 {\n width: calc(var(--spacing) * 4);\n}\n.w-12 {\n width: calc(var(--spacing) * 12);\n}\n.w-full {\n width: 100%;\n}\n.w-px {\n width: 1px;\n}\n.w-screen {\n width: 100vw;\n}\n.max-w-32 {\n max-width: calc(var(--spacing) * 32);\n}\n.flex-shrink {\n flex-shrink: 1;\n}\n.shrink {\n flex-shrink: 1;\n}\n.shrink-0 {\n flex-shrink: 0;\n}\n.flex-grow {\n flex-grow: 1;\n}\n.grow {\n flex-grow: 1;\n}\n.border-collapse {\n border-collapse: collapse;\n}\n.rotate-45 {\n rotate: 45deg;\n}\n.\\!transform {\n transform: var(--tw-rotate-x) var(--tw-rotate-y) var(--tw-rotate-z) var(--tw-skew-x) var(--tw-skew-y) !important;\n}\n.transform {\n transform: var(--tw-rotate-x) var(--tw-rotate-y) var(--tw-rotate-z) var(--tw-skew-x) var(--tw-skew-y);\n}\n.transform\\! {\n transform: var(--tw-rotate-x) var(--tw-rotate-y) var(--tw-rotate-z) var(--tw-skew-x) var(--tw-skew-y) !important;\n}\n.cursor-pointer {\n cursor: pointer;\n}\n.resize {\n resize: both;\n}\n.grid-cols-2 {\n grid-template-columns: repeat(2, minmax(0, 1fr));\n}\n.grid-cols-3 {\n grid-template-columns: repeat(3, minmax(0, 1fr));\n}\n.flex-col {\n flex-direction: column;\n}\n.flex-row {\n flex-direction: row;\n}\n.flex-wrap {\n flex-wrap: wrap;\n}\n.items-center {\n align-items: center;\n}\n.items-end {\n align-items: flex-end;\n}\n.justify-between {\n justify-content: space-between;\n}\n.justify-center {\n justify-content: center;\n}\n.justify-end {\n justify-content: flex-end;\n}\n.justify-start {\n justify-content: flex-start;\n}\n.gap-0 {\n gap: calc(var(--spacing) * 0);\n}\n.gap-1 {\n gap: calc(var(--spacing) * 1);\n}\n.gap-2 {\n gap: calc(var(--spacing) * 2);\n}\n.gap-3 {\n gap: calc(var(--spacing) * 3);\n}\n.gap-4 {\n gap: calc(var(--spacing) * 4);\n}\n.gap-6 {\n gap: calc(var(--spacing) * 6);\n}\n.space-y-2 {\n :where(& > :not(:last-child)) {\n --tw-space-y-reverse: 0;\n margin-block-start: calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));\n margin-block-end: calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)));\n }\n}\n.space-y-8 {\n :where(& > :not(:last-child)) {\n --tw-space-y-reverse: 0;\n margin-block-start: calc(calc(var(--spacing) * 8) * var(--tw-space-y-reverse));\n margin-block-end: calc(calc(var(--spacing) * 8) * calc(1 - var(--tw-space-y-reverse)));\n }\n}\n.gap-y-0 {\n row-gap: calc(var(--spacing) * 0);\n}\n.self-end {\n align-self: flex-end;\n}\n.self-start {\n align-self: flex-start;\n}\n.truncate {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.overflow-auto {\n overflow: auto;\n}\n.overflow-hidden {\n overflow: hidden;\n}\n.overflow-visible {\n overflow: visible;\n}\n.rounded {\n border-radius: 0.25rem;\n}\n.rounded-full {\n border-radius: calc(infinity * 1px);\n}\n.rounded-lg {\n border-radius: var(--radius-lg);\n}\n.rounded-md {\n border-radius: var(--radius-md);\n}\n.border {\n border-style: var(--tw-border-style);\n border-width: 1px;\n}\n.border-t-1 {\n border-top-style: var(--tw-border-style);\n border-top-width: 1px;\n}\n.border-b-1 {\n border-bottom-style: var(--tw-border-style);\n border-bottom-width: 1px;\n}\n.border-solid {\n --tw-border-style: solid;\n border-style: solid;\n}\n.border-gray-400 {\n border-color: var(--color-gray-400);\n}\n.border-gray-500 {\n border-color: var(--color-gray-500);\n}\n.border-slate-200 {\n border-color: var(--color-slate-200);\n}\n.bg-black {\n background-color: var(--color-black);\n}\n.bg-emerald-200 {\n background-color: var(--color-emerald-200);\n}\n.bg-gray-200 {\n background-color: var(--color-gray-200);\n}\n.bg-green-200 {\n background-color: var(--color-green-200);\n}\n.bg-red-500 {\n background-color: var(--color-red-500);\n}\n.bg-slate-50 {\n background-color: var(--color-slate-50);\n}\n.bg-white {\n background-color: var(--color-white);\n}\n.p-0 {\n padding: calc(var(--spacing) * 0);\n}\n.p-1 {\n padding: calc(var(--spacing) * 1);\n}\n.p-2 {\n padding: calc(var(--spacing) * 2);\n}\n.p-4 {\n padding: calc(var(--spacing) * 4);\n}\n.px-2 {\n padding-inline: calc(var(--spacing) * 2);\n}\n.px-4 {\n padding-inline: calc(var(--spacing) * 4);\n}\n.px-6 {\n padding-inline: calc(var(--spacing) * 6);\n}\n.py-1 {\n padding-block: calc(var(--spacing) * 1);\n}\n.py-2 {\n padding-block: calc(var(--spacing) * 2);\n}\n.py-4 {\n padding-block: calc(var(--spacing) * 4);\n}\n.py-6 {\n padding-block: calc(var(--spacing) * 6);\n}\n.pt-1 {\n padding-top: calc(var(--spacing) * 1);\n}\n.pt-2 {\n padding-top: calc(var(--spacing) * 2);\n}\n.pt-4 {\n padding-top: calc(var(--spacing) * 4);\n}\n.pt-5 {\n padding-top: calc(var(--spacing) * 5);\n}\n.pt-6 {\n padding-top: calc(var(--spacing) * 6);\n}\n.pt-8 {\n padding-top: calc(var(--spacing) * 8);\n}\n.pb-2 {\n padding-bottom: calc(var(--spacing) * 2);\n}\n.pb-4 {\n padding-bottom: calc(var(--spacing) * 4);\n}\n.pb-6 {\n padding-bottom: calc(var(--spacing) * 6);\n}\n.pb-8 {\n padding-bottom: calc(var(--spacing) * 8);\n}\n.pl-0 {\n padding-left: calc(var(--spacing) * 0);\n}\n.pl-2 {\n padding-left: calc(var(--spacing) * 2);\n}\n.pl-4 {\n padding-left: calc(var(--spacing) * 4);\n}\n.text-center {\n text-align: center;\n}\n.text-left {\n text-align: left;\n}\n.text-right {\n text-align: right;\n}\n.align-middle {\n vertical-align: middle;\n}\n.text-2xl {\n font-size: var(--text-2xl);\n line-height: var(--tw-leading, var(--text-2xl--line-height));\n}\n.text-base {\n font-size: var(--text-base);\n line-height: var(--tw-leading, var(--text-base--line-height));\n}\n.text-lg {\n font-size: var(--text-lg);\n line-height: var(--tw-leading, var(--text-lg--line-height));\n}\n.text-sm {\n font-size: var(--text-sm);\n line-height: var(--tw-leading, var(--text-sm--line-height));\n}\n.text-xl {\n font-size: var(--text-xl);\n line-height: var(--tw-leading, var(--text-xl--line-height));\n}\n.text-xs {\n font-size: var(--text-xs);\n line-height: var(--tw-leading, var(--text-xs--line-height));\n}\n.font-bold {\n --tw-font-weight: var(--font-weight-bold);\n font-weight: var(--font-weight-bold);\n}\n.font-light {\n --tw-font-weight: var(--font-weight-light);\n font-weight: var(--font-weight-light);\n}\n.font-medium {\n --tw-font-weight: var(--font-weight-medium);\n font-weight: var(--font-weight-medium);\n}\n.font-normal {\n --tw-font-weight: var(--font-weight-normal);\n font-weight: var(--font-weight-normal);\n}\n.text-nowrap {\n text-wrap: nowrap;\n}\n.text-wrap {\n text-wrap: wrap;\n}\n.break-all {\n word-break: break-all;\n}\n.whitespace-nowrap {\n white-space: nowrap;\n}\n.text-emerald-700 {\n color: var(--color-emerald-700);\n}\n.text-gray-600 {\n color: var(--color-gray-600);\n}\n.text-gray-900 {\n color: var(--color-gray-900);\n}\n.text-green-600 {\n color: var(--color-green-600);\n}\n.text-orange-500 {\n color: var(--color-orange-500);\n}\n.text-orange-600 {\n color: var(--color-orange-600);\n}\n.text-slate-400 {\n color: var(--color-slate-400);\n}\n.text-slate-500 {\n color: var(--color-slate-500);\n}\n.text-slate-600 {\n color: var(--color-slate-600);\n}\n.text-white {\n color: var(--color-white);\n}\n.capitalize {\n text-transform: capitalize;\n}\n.lowercase {\n text-transform: lowercase;\n}\n.lowercase\\! {\n text-transform: lowercase !important;\n}\n.uppercase {\n text-transform: uppercase;\n}\n.italic {\n font-style: italic;\n}\n.ordinal {\n --tw-ordinal: ordinal;\n font-variant-numeric: var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,);\n}\n.tabular-nums {\n --tw-numeric-spacing: tabular-nums;\n font-variant-numeric: var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,);\n}\n.line-through {\n text-decoration-line: line-through;\n}\n.overline {\n text-decoration-line: overline;\n}\n.underline {\n text-decoration-line: underline;\n}\n.antialiased {\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n.ring {\n --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentColor);\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n}\n.shadow {\n --tw-shadow: 0 1px 3px 0 var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 1px 2px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1));\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n}\n.shadow-md {\n --tw-shadow: 0 4px 6px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 2px 4px -2px var(--tw-shadow-color, rgb(0 0 0 / 0.1));\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n}\n.shadow\\/gap {\n --tw-shadow: 0 1px 3px 0 var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 1px 2px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1));\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n}\n.outline {\n outline-style: var(--tw-outline-style);\n outline-width: 1px;\n}\n.blur {\n --tw-blur: blur(8px);\n filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);\n}\n.drop-shadow {\n --tw-drop-shadow: drop-shadow(0 1px 2px rgb(0 0 0 / 0.1)) drop-shadow( 0 1px 1px rgb(0 0 0 / 0.06));\n filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);\n}\n.grayscale {\n --tw-grayscale: grayscale(100%);\n filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);\n}\n.invert {\n --tw-invert: invert(100%);\n filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);\n}\n.\\!filter {\n filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,) !important;\n}\n.filter {\n filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);\n}\n.filter\\! {\n filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,) !important;\n}\n.backdrop-filter {\n -webkit-backdrop-filter: var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);\n backdrop-filter: var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);\n}\n.\\!transition {\n transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, -webkit-backdrop-filter, backdrop-filter !important;\n transition-timing-function: var(--tw-ease, var(--default-transition-timing-function)) !important;\n transition-duration: var(--tw-duration, var(--default-transition-duration)) !important;\n}\n.transition {\n transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, -webkit-backdrop-filter, backdrop-filter;\n transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));\n transition-duration: var(--tw-duration, var(--default-transition-duration));\n}\n.transition\\! {\n transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, -webkit-backdrop-filter, backdrop-filter !important;\n transition-timing-function: var(--tw-ease, var(--default-transition-timing-function)) !important;\n transition-duration: var(--tw-duration, var(--default-transition-duration)) !important;\n}\n.ease-in {\n --tw-ease: var(--ease-in);\n transition-timing-function: var(--ease-in);\n}\n.ease-in-out {\n --tw-ease: var(--ease-in-out);\n transition-timing-function: var(--ease-in-out);\n}\n.ease-out {\n --tw-ease: var(--ease-out);\n transition-timing-function: var(--ease-out);\n}\n.\\[vite\\:css\\] {\n vite: css;\n}\n.\\[vite\\:html\\] {\n vite: html;\n}\n.select-all {\n -webkit-user-select: all;\n user-select: all;\n}\n.sm\\:flex {\n @media (width >= 40rem) {\n display: flex;\n }\n}\n.sm\\:hidden {\n @media (width >= 40rem) {\n display: none;\n }\n}\n.dark\\:bg-gray-900 {\n @media (prefers-color-scheme: dark) {\n background-color: var(--color-gray-900);\n }\n}\n@layer theme, base, components, utilities;\n@layer theme {\n :root {\n --font-sans: ui-sans-serif, system-ui, sans-serif, \"Apple Color Emoji\",\n \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\";\n --font-serif: ui-serif, Georgia, Cambria, \"Times New Roman\", Times, serif;\n --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,\n \"Liberation Mono\", \"Courier New\", monospace;\n --color-red-50: oklch(0.971 0.013 17.38);\n --color-red-100: oklch(0.936 0.032 17.717);\n --color-red-200: oklch(0.885 0.062 18.334);\n --color-red-300: oklch(0.808 0.114 19.571);\n --color-red-400: oklch(0.704 0.191 22.216);\n --color-red-500: oklch(0.637 0.237 25.331);\n --color-red-600: oklch(0.577 0.245 27.325);\n --color-red-700: oklch(0.505 0.213 27.518);\n --color-red-800: oklch(0.444 0.177 26.899);\n --color-red-900: oklch(0.396 0.141 25.723);\n --color-red-950: oklch(0.258 0.092 26.042);\n --color-orange-50: oklch(0.98 0.016 73.684);\n --color-orange-100: oklch(0.954 0.038 75.164);\n --color-orange-200: oklch(0.901 0.076 70.697);\n --color-orange-300: oklch(0.837 0.128 66.29);\n --color-orange-400: oklch(0.75 0.183 55.934);\n --color-orange-500: oklch(0.705 0.213 47.604);\n --color-orange-600: oklch(0.646 0.222 41.116);\n --color-orange-700: oklch(0.553 0.195 38.402);\n --color-orange-800: oklch(0.47 0.157 37.304);\n --color-orange-900: oklch(0.408 0.123 38.172);\n --color-orange-950: oklch(0.266 0.079 36.259);\n --color-amber-50: oklch(0.987 0.022 95.277);\n --color-amber-100: oklch(0.962 0.059 95.617);\n --color-amber-200: oklch(0.924 0.12 95.746);\n --color-amber-300: oklch(0.879 0.169 91.605);\n --color-amber-400: oklch(0.828 0.189 84.429);\n --color-amber-500: oklch(0.769 0.188 70.08);\n --color-amber-600: oklch(0.666 0.179 58.318);\n --color-amber-700: oklch(0.555 0.163 48.998);\n --color-amber-800: oklch(0.473 0.137 46.201);\n --color-amber-900: oklch(0.414 0.112 45.904);\n --color-amber-950: oklch(0.279 0.077 45.635);\n --color-yellow-50: oklch(0.987 0.026 102.212);\n --color-yellow-100: oklch(0.973 0.071 103.193);\n --color-yellow-200: oklch(0.945 0.129 101.54);\n --color-yellow-300: oklch(0.905 0.182 98.111);\n --color-yellow-400: oklch(0.852 0.199 91.936);\n --color-yellow-500: oklch(0.795 0.184 86.047);\n --color-yellow-600: oklch(0.681 0.162 75.834);\n --color-yellow-700: oklch(0.554 0.135 66.442);\n --color-yellow-800: oklch(0.476 0.114 61.907);\n --color-yellow-900: oklch(0.421 0.095 57.708);\n --color-yellow-950: oklch(0.286 0.066 53.813);\n --color-lime-50: oklch(0.986 0.031 120.757);\n --color-lime-100: oklch(0.967 0.067 122.328);\n --color-lime-200: oklch(0.938 0.127 124.321);\n --color-lime-300: oklch(0.897 0.196 126.665);\n --color-lime-400: oklch(0.841 0.238 128.85);\n --color-lime-500: oklch(0.768 0.233 130.85);\n --color-lime-600: oklch(0.648 0.2 131.684);\n --color-lime-700: oklch(0.532 0.157 131.589);\n --color-lime-800: oklch(0.453 0.124 130.933);\n --color-lime-900: oklch(0.405 0.101 131.063);\n --color-lime-950: oklch(0.274 0.072 132.109);\n --color-green-50: oklch(0.982 0.018 155.826);\n --color-green-100: oklch(0.962 0.044 156.743);\n --color-green-200: oklch(0.925 0.084 155.995);\n --color-green-300: oklch(0.871 0.15 154.449);\n --color-green-400: oklch(0.792 0.209 151.711);\n --color-green-500: oklch(0.723 0.219 149.579);\n --color-green-600: oklch(0.627 0.194 149.214);\n --color-green-700: oklch(0.527 0.154 150.069);\n --color-green-800: oklch(0.448 0.119 151.328);\n --color-green-900: oklch(0.393 0.095 152.535);\n --color-green-950: oklch(0.266 0.065 152.934);\n --color-emerald-50: oklch(0.979 0.021 166.113);\n --color-emerald-100: oklch(0.95 0.052 163.051);\n --color-emerald-200: oklch(0.905 0.093 164.15);\n --color-emerald-300: oklch(0.845 0.143 164.978);\n --color-emerald-400: oklch(0.765 0.177 163.223);\n --color-emerald-500: oklch(0.696 0.17 162.48);\n --color-emerald-600: oklch(0.596 0.145 163.225);\n --color-emerald-700: oklch(0.508 0.118 165.612);\n --color-emerald-800: oklch(0.432 0.095 166.913);\n --color-emerald-900: oklch(0.378 0.077 168.94);\n --color-emerald-950: oklch(0.262 0.051 172.552);\n --color-teal-50: oklch(0.984 0.014 180.72);\n --color-teal-100: oklch(0.953 0.051 180.801);\n --color-teal-200: oklch(0.91 0.096 180.426);\n --color-teal-300: oklch(0.855 0.138 181.071);\n --color-teal-400: oklch(0.777 0.152 181.912);\n --color-teal-500: oklch(0.704 0.14 182.503);\n --color-teal-600: oklch(0.6 0.118 184.704);\n --color-teal-700: oklch(0.511 0.096 186.391);\n --color-teal-800: oklch(0.437 0.078 188.216);\n --color-teal-900: oklch(0.386 0.063 188.416);\n --color-teal-950: oklch(0.277 0.046 192.524);\n --color-cyan-50: oklch(0.984 0.019 200.873);\n --color-cyan-100: oklch(0.956 0.045 203.388);\n --color-cyan-200: oklch(0.917 0.08 205.041);\n --color-cyan-300: oklch(0.865 0.127 207.078);\n --color-cyan-400: oklch(0.789 0.154 211.53);\n --color-cyan-500: oklch(0.715 0.143 215.221);\n --color-cyan-600: oklch(0.609 0.126 221.723);\n --color-cyan-700: oklch(0.52 0.105 223.128);\n --color-cyan-800: oklch(0.45 0.085 224.283);\n --color-cyan-900: oklch(0.398 0.07 227.392);\n --color-cyan-950: oklch(0.302 0.056 229.695);\n --color-sky-50: oklch(0.977 0.013 236.62);\n --color-sky-100: oklch(0.951 0.026 236.824);\n --color-sky-200: oklch(0.901 0.058 230.902);\n --color-sky-300: oklch(0.828 0.111 230.318);\n --color-sky-400: oklch(0.746 0.16 232.661);\n --color-sky-500: oklch(0.685 0.169 237.323);\n --color-sky-600: oklch(0.588 0.158 241.966);\n --color-sky-700: oklch(0.5 0.134 242.749);\n --color-sky-800: oklch(0.443 0.11 240.79);\n --color-sky-900: oklch(0.391 0.09 240.876);\n --color-sky-950: oklch(0.293 0.066 243.157);\n --color-blue-50: oklch(0.97 0.014 254.604);\n --color-blue-100: oklch(0.932 0.032 255.585);\n --color-blue-200: oklch(0.882 0.059 254.128);\n --color-blue-300: oklch(0.809 0.105 251.813);\n --color-blue-400: oklch(0.707 0.165 254.624);\n --color-blue-500: oklch(0.623 0.214 259.815);\n --color-blue-600: oklch(0.546 0.245 262.881);\n --color-blue-700: oklch(0.488 0.243 264.376);\n --color-blue-800: oklch(0.424 0.199 265.638);\n --color-blue-900: oklch(0.379 0.146 265.522);\n --color-blue-950: oklch(0.282 0.091 267.935);\n --color-indigo-50: oklch(0.962 0.018 272.314);\n --color-indigo-100: oklch(0.93 0.034 272.788);\n --color-indigo-200: oklch(0.87 0.065 274.039);\n --color-indigo-300: oklch(0.785 0.115 274.713);\n --color-indigo-400: oklch(0.673 0.182 276.935);\n --color-indigo-500: oklch(0.585 0.233 277.117);\n --color-indigo-600: oklch(0.511 0.262 276.966);\n --color-indigo-700: oklch(0.457 0.24 277.023);\n --color-indigo-800: oklch(0.398 0.195 277.366);\n --color-indigo-900: oklch(0.359 0.144 278.697);\n --color-indigo-950: oklch(0.257 0.09 281.288);\n --color-violet-50: oklch(0.969 0.016 293.756);\n --color-violet-100: oklch(0.943 0.029 294.588);\n --color-violet-200: oklch(0.894 0.057 293.283);\n --color-violet-300: oklch(0.811 0.111 293.571);\n --color-violet-400: oklch(0.702 0.183 293.541);\n --color-violet-500: oklch(0.606 0.25 292.717);\n --color-violet-600: oklch(0.541 0.281 293.009);\n --color-violet-700: oklch(0.491 0.27 292.581);\n --color-violet-800: oklch(0.432 0.232 292.759);\n --color-violet-900: oklch(0.38 0.189 293.745);\n --color-violet-950: oklch(0.283 0.141 291.089);\n --color-purple-50: oklch(0.977 0.014 308.299);\n --color-purple-100: oklch(0.946 0.033 307.174);\n --color-purple-200: oklch(0.902 0.063 306.703);\n --color-purple-300: oklch(0.827 0.119 306.383);\n --color-purple-400: oklch(0.714 0.203 305.504);\n --color-purple-500: oklch(0.627 0.265 303.9);\n --color-purple-600: oklch(0.558 0.288 302.321);\n --color-purple-700: oklch(0.496 0.265 301.924);\n --color-purple-800: oklch(0.438 0.218 303.724);\n --color-purple-900: oklch(0.381 0.176 304.987);\n --color-purple-950: oklch(0.291 0.149 302.717);\n --color-fuchsia-50: oklch(0.977 0.017 320.058);\n --color-fuchsia-100: oklch(0.952 0.037 318.852);\n --color-fuchsia-200: oklch(0.903 0.076 319.62);\n --color-fuchsia-300: oklch(0.833 0.145 321.434);\n --color-fuchsia-400: oklch(0.74 0.238 322.16);\n --color-fuchsia-500: oklch(0.667 0.295 322.15);\n --color-fuchsia-600: oklch(0.591 0.293 322.896);\n --color-fuchsia-700: oklch(0.518 0.253 323.949);\n --color-fuchsia-800: oklch(0.452 0.211 324.591);\n --color-fuchsia-900: oklch(0.401 0.17 325.612);\n --color-fuchsia-950: oklch(0.293 0.136 325.661);\n --color-pink-50: oklch(0.971 0.014 343.198);\n --color-pink-100: oklch(0.948 0.028 342.258);\n --color-pink-200: oklch(0.899 0.061 343.231);\n --color-pink-300: oklch(0.823 0.12 346.018);\n --color-pink-400: oklch(0.718 0.202 349.761);\n --color-pink-500: oklch(0.656 0.241 354.308);\n --color-pink-600: oklch(0.592 0.249 0.584);\n --color-pink-700: oklch(0.525 0.223 3.958);\n --color-pink-800: oklch(0.459 0.187 3.815);\n --color-pink-900: oklch(0.408 0.153 2.432);\n --color-pink-950: oklch(0.284 0.109 3.907);\n --color-rose-50: oklch(0.969 0.015 12.422);\n --color-rose-100: oklch(0.941 0.03 12.58);\n --color-rose-200: oklch(0.892 0.058 10.001);\n --color-rose-300: oklch(0.81 0.117 11.638);\n --color-rose-400: oklch(0.712 0.194 13.428);\n --color-rose-500: oklch(0.645 0.246 16.439);\n --color-rose-600: oklch(0.586 0.253 17.585);\n --color-rose-700: oklch(0.514 0.222 16.935);\n --color-rose-800: oklch(0.455 0.188 13.697);\n --color-rose-900: oklch(0.41 0.159 10.272);\n --color-rose-950: oklch(0.271 0.105 12.094);\n --color-slate-50: oklch(0.984 0.003 247.858);\n --color-slate-100: oklch(0.968 0.007 247.896);\n --color-slate-200: oklch(0.929 0.013 255.508);\n --color-slate-300: oklch(0.869 0.022 252.894);\n --color-slate-400: oklch(0.704 0.04 256.788);\n --color-slate-500: oklch(0.554 0.046 257.417);\n --color-slate-600: oklch(0.446 0.043 257.281);\n --color-slate-700: oklch(0.372 0.044 257.287);\n --color-slate-800: oklch(0.279 0.041 260.031);\n --color-slate-900: oklch(0.208 0.042 265.755);\n --color-slate-950: oklch(0.129 0.042 264.695);\n --color-gray-50: oklch(0.985 0.002 247.839);\n --color-gray-100: oklch(0.967 0.003 264.542);\n --color-gray-200: oklch(0.928 0.006 264.531);\n --color-gray-300: oklch(0.872 0.01 258.338);\n --color-gray-400: oklch(0.707 0.022 261.325);\n --color-gray-500: oklch(0.551 0.027 264.364);\n --color-gray-600: oklch(0.446 0.03 256.802);\n --color-gray-700: oklch(0.373 0.034 259.733);\n --color-gray-800: oklch(0.278 0.033 256.848);\n --color-gray-900: oklch(0.21 0.034 264.665);\n --color-gray-950: oklch(0.13 0.028 261.692);\n --color-zinc-50: oklch(0.985 0 0);\n --color-zinc-100: oklch(0.967 0.001 286.375);\n --color-zinc-200: oklch(0.92 0.004 286.32);\n --color-zinc-300: oklch(0.871 0.006 286.286);\n --color-zinc-400: oklch(0.705 0.015 286.067);\n --color-zinc-500: oklch(0.552 0.016 285.938);\n --color-zinc-600: oklch(0.442 0.017 285.786);\n --color-zinc-700: oklch(0.37 0.013 285.805);\n --color-zinc-800: oklch(0.274 0.006 286.033);\n --color-zinc-900: oklch(0.21 0.006 285.885);\n --color-zinc-950: oklch(0.141 0.005 285.823);\n --color-neutral-50: oklch(0.985 0 0);\n --color-neutral-100: oklch(0.97 0 0);\n --color-neutral-200: oklch(0.922 0 0);\n --color-neutral-300: oklch(0.87 0 0);\n --color-neutral-400: oklch(0.708 0 0);\n --color-neutral-500: oklch(0.556 0 0);\n --color-neutral-600: oklch(0.439 0 0);\n --color-neutral-700: oklch(0.371 0 0);\n --color-neutral-800: oklch(0.269 0 0);\n --color-neutral-900: oklch(0.205 0 0);\n --color-neutral-950: oklch(0.145 0 0);\n --color-stone-50: oklch(0.985 0.001 106.423);\n --color-stone-100: oklch(0.97 0.001 106.424);\n --color-stone-200: oklch(0.923 0.003 48.717);\n --color-stone-300: oklch(0.869 0.005 56.366);\n --color-stone-400: oklch(0.709 0.01 56.259);\n --color-stone-500: oklch(0.553 0.013 58.071);\n --color-stone-600: oklch(0.444 0.011 73.639);\n --color-stone-700: oklch(0.374 0.01 67.558);\n --color-stone-800: oklch(0.268 0.007 34.298);\n --color-stone-900: oklch(0.216 0.006 56.043);\n --color-stone-950: oklch(0.147 0.004 49.25);\n --color-black: #000;\n --color-white: #fff;\n --spacing: 0.25rem;\n --breakpoint-sm: 40rem;\n --breakpoint-md: 48rem;\n --breakpoint-lg: 64rem;\n --breakpoint-xl: 80rem;\n --breakpoint-2xl: 96rem;\n --container-3xs: 16rem;\n --container-2xs: 18rem;\n --container-xs: 20rem;\n --container-sm: 24rem;\n --container-md: 28rem;\n --container-lg: 32rem;\n --container-xl: 36rem;\n --container-2xl: 42rem;\n --container-3xl: 48rem;\n --container-4xl: 56rem;\n --container-5xl: 64rem;\n --container-6xl: 72rem;\n --container-7xl: 80rem;\n --text-xs: 0.75rem;\n --text-xs--line-height: calc(1 / 0.75);\n --text-sm: 0.875rem;\n --text-sm--line-height: calc(1.25 / 0.875);\n --text-base: 1rem;\n --text-base--line-height: calc(1.5 / 1);\n --text-lg: 1.125rem;\n --text-lg--line-height: calc(1.75 / 1.125);\n --text-xl: 1.25rem;\n --text-xl--line-height: calc(1.75 / 1.25);\n --text-2xl: 1.5rem;\n --text-2xl--line-height: calc(2 / 1.5);\n --text-3xl: 1.875rem;\n --text-3xl--line-height: calc(2.25 / 1.875);\n --text-4xl: 2.25rem;\n --text-4xl--line-height: calc(2.5 / 2.25);\n --text-5xl: 3rem;\n --text-5xl--line-height: 1;\n --text-6xl: 3.75rem;\n --text-6xl--line-height: 1;\n --text-7xl: 4.5rem;\n --text-7xl--line-height: 1;\n --text-8xl: 6rem;\n --text-8xl--line-height: 1;\n --text-9xl: 8rem;\n --text-9xl--line-height: 1;\n --font-weight-thin: 100;\n --font-weight-extralight: 200;\n --font-weight-light: 300;\n --font-weight-normal: 400;\n --font-weight-medium: 500;\n --font-weight-semibold: 600;\n --font-weight-bold: 700;\n --font-weight-extrabold: 800;\n --font-weight-black: 900;\n --tracking-tighter: -0.05em;\n --tracking-tight: -0.025em;\n --tracking-normal: 0em;\n --tracking-wide: 0.025em;\n --tracking-wider: 0.05em;\n --tracking-widest: 0.1em;\n --leading-tight: 1.25;\n --leading-snug: 1.375;\n --leading-normal: 1.5;\n --leading-relaxed: 1.625;\n --leading-loose: 2;\n --radius-xs: 0.125rem;\n --radius-sm: 0.25rem;\n --radius-md: 0.375rem;\n --radius-lg: 0.5rem;\n --radius-xl: 0.75rem;\n --radius-2xl: 1rem;\n --radius-3xl: 1.5rem;\n --radius-4xl: 2rem;\n --shadow-2xs: 0 1px rgb(0 0 0 / 0.05);\n --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);\n --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);\n --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1),\n 0 2px 4px -2px rgb(0 0 0 / 0.1);\n --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1),\n 0 4px 6px -4px rgb(0 0 0 / 0.1);\n --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1),\n 0 8px 10px -6px rgb(0 0 0 / 0.1);\n --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);\n --inset-shadow-2xs: inset 0 1px rgb(0 0 0 / 0.05);\n --inset-shadow-xs: inset 0 1px 1px rgb(0 0 0 / 0.05);\n --inset-shadow-sm: inset 0 2px 4px rgb(0 0 0 / 0.05);\n --drop-shadow-xs: 0 1px 1px rgb(0 0 0 / 0.05);\n --drop-shadow-sm: 0 1px 2px rgb(0 0 0 / 0.15);\n --drop-shadow-md: 0 3px 3px rgb(0 0 0 / 0.12);\n --drop-shadow-lg: 0 4px 4px rgb(0 0 0 / 0.15);\n --drop-shadow-xl: 0 9px 7px rgb(0 0 0 / 0.1);\n --drop-shadow-2xl: 0 25px 25px rgb(0 0 0 / 0.15);\n --ease-in: cubic-bezier(0.4, 0, 1, 1);\n --ease-out: cubic-bezier(0, 0, 0.2, 1);\n --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);\n --animate-spin: spin 1s linear infinite;\n --animate-ping: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;\n --animate-pulse: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;\n --animate-bounce: bounce 1s infinite;\n --blur-xs: 4px;\n --blur-sm: 8px;\n --blur-md: 12px;\n --blur-lg: 16px;\n --blur-xl: 24px;\n --blur-2xl: 40px;\n --blur-3xl: 64px;\n --perspective-dramatic: 100px;\n --perspective-near: 300px;\n --perspective-normal: 500px;\n --perspective-midrange: 800px;\n --perspective-distant: 1200px;\n --aspect-video: 16 / 9;\n --default-transition-duration: 150ms;\n --default-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n --default-font-family: var(--font-sans);\n --default-font-feature-settings: var(--font-sans--font-feature-settings);\n --default-font-variation-settings: var(\n --font-sans--font-variation-settings\n );\n --default-mono-font-family: var(--font-mono);\n --default-mono-font-feature-settings: var(\n --font-mono--font-feature-settings\n );\n --default-mono-font-variation-settings: var(\n --font-mono--font-variation-settings\n );\n }\n}\n@layer base {\n *, ::after, ::before, ::backdrop, ::file-selector-button {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n border: 0 solid;\n }\n html, :host {\n line-height: 1.5;\n -webkit-text-size-adjust: 100%;\n tab-size: 4;\n font-family: var( --default-font-family, ui-sans-serif, system-ui, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\" );\n font-feature-settings: var(--default-font-feature-settings, normal);\n font-variation-settings: var( --default-font-variation-settings, normal );\n -webkit-tap-highlight-color: transparent;\n }\n body {\n line-height: inherit;\n }\n hr {\n height: 0;\n color: inherit;\n border-top-width: 1px;\n }\n abbr:where([title]) {\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n }\n h1, h2, h3, h4, h5, h6 {\n font-size: inherit;\n font-weight: inherit;\n }\n a {\n color: inherit;\n -webkit-text-decoration: inherit;\n text-decoration: inherit;\n }\n b, strong {\n font-weight: bolder;\n }\n code, kbd, samp, pre {\n font-family: var( --default-mono-font-family, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace );\n font-feature-settings: var( --default-mono-font-feature-settings, normal );\n font-variation-settings: var( --default-mono-font-variation-settings, normal );\n font-size: 1em;\n }\n small {\n font-size: 80%;\n }\n sub, sup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n }\n sub {\n bottom: -0.25em;\n }\n sup {\n top: -0.5em;\n }\n table {\n text-indent: 0;\n border-color: inherit;\n border-collapse: collapse;\n }\n :-moz-focusring {\n outline: auto;\n }\n progress {\n vertical-align: baseline;\n }\n summary {\n display: list-item;\n }\n ol, ul, menu {\n list-style: none;\n }\n img, svg, video, canvas, audio, iframe, embed, object {\n display: block;\n vertical-align: middle;\n }\n img, video {\n max-width: 100%;\n height: auto;\n }\n button, input, select, optgroup, textarea, ::file-selector-button {\n font: inherit;\n font-feature-settings: inherit;\n font-variation-settings: inherit;\n letter-spacing: inherit;\n color: inherit;\n border-radius: 0;\n background-color: transparent;\n opacity: 1;\n }\n :where(select:is([multiple], [size])) optgroup {\n font-weight: bolder;\n }\n :where(select:is([multiple], [size])) optgroup option {\n padding-inline-start: 20px;\n }\n ::file-selector-button {\n margin-inline-end: 4px;\n }\n ::placeholder {\n opacity: 1;\n color: color-mix(in oklab, currentColor 50%, transparent);\n }\n textarea {\n resize: vertical;\n }\n ::-webkit-search-decoration {\n -webkit-appearance: none;\n }\n ::-webkit-date-and-time-value {\n min-height: 1lh;\n text-align: inherit;\n }\n ::-webkit-datetime-edit {\n display: inline-flex;\n }\n ::-webkit-datetime-edit-fields-wrapper {\n padding: 0;\n }\n ::-webkit-datetime-edit, ::-webkit-datetime-edit-year-field, ::-webkit-datetime-edit-month-field, ::-webkit-datetime-edit-day-field, ::-webkit-datetime-edit-hour-field, ::-webkit-datetime-edit-minute-field, ::-webkit-datetime-edit-second-field, ::-webkit-datetime-edit-millisecond-field, ::-webkit-datetime-edit-meridiem-field {\n padding-block: 0;\n }\n :-moz-ui-invalid {\n box-shadow: none;\n }\n button, input:where([type=\"button\"], [type=\"reset\"], [type=\"submit\"]), ::file-selector-button {\n appearance: button;\n }\n ::-webkit-inner-spin-button, ::-webkit-outer-spin-button {\n height: auto;\n }\n [hidden]:where(:not([hidden=\"until-found\"])) {\n display: none !important;\n }\n}\n@layer utilities;\n@media (min-width: 768px) {\n .sm\\:hidden {\n display: none !important;\n }\n .sm\\:flex {\n display: flex !important;\n }\n}\n.text-xxs {\n font-size: 0.625rem;\n}\n.w-1\\/2 {\n width: 50%;\n}\n.border-t-1 {\n border-top-width: 1px;\n}\n.border-b-1 {\n border-bottom-width: 1px;\n}\n.border-t-solid {\n border-top-style: solid;\n}\n.border-b-solid {\n border-bottom-style: solid;\n}\n.text-nowrap {\n white-space: nowrap;\n}\n.max-w-32 {\n max-width: 8rem;\n}\n// Used to hide sections from UI but remain in PDFs .pdf-only {\n display: none !important;\n}\n.font-light {\n font-family: @mark-pro-light;\n}\n.font-medium {\n font-family: @mark-pro-medium;\n}\n.font-bold {\n font-family: @mark-pro-bold;\n}\n.gap-y-0 {\n row-gap: 0px !important;\n}\n.gap-0 {\n gap: 0px !important;\n}\n.grow {\n flex-grow: 1;\n}\n.rounded-md {\n border-radius: 0.375rem;\n}\n.shadow-md {\n box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);\n}\n.text-slate-400 {\n --tw-text-opacity: 1;\n color: rgb(148 163 184 / var(--tw-text-opacity, 1));\n}\n.text-gray-600 {\n --tw-text-opacity: 1;\n color: rgb(75 85 99 / var(--tw-text-opacity, 1));\n}\n.text-gray-900 {\n --tw-text-opacity: 1;\n color: rgb(17 24 39 / var(--tw-text-opacity, 1));\n}\n.text-emerald-700 {\n --tw-text-opacity: 1;\n color: rgb(22 163 74 / var(--tw-text-opacity, 1));\n}\n.bg-emerald-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(187 247 208 / var(--tw-bg-opacity, 1));\n}\n.border-slate-200 {\n --tw-border-opacity: 1;\n border-color: rgb(226 232 240 / var(--tw-border-opacity, 1));\n}\n.text-2xl {\n font-size: 1.5rem;\n line-height: 2rem;\n}\n.border-collapse {\n border-collapse: collapse;\n}\n.align-middle {\n vertical-align: middle;\n}\n.has-tooltip {\n position: relative;\n}\n.ui-only {\n display: none;\n}\n.tooltip {\n position: absolute;\n z-index: 10;\n background-color: black;\n color: white;\n padding: 0.5rem;\n border-radius: 0.25rem;\n}\n.relative {\n position: relative;\n}\n.tootip-arrow {\n width: 0;\n height: 0;\n border-left: 0.5rem solid transparent;\n border-right: 0.5rem solid transparent;\n border-bottom: 0.5rem solid black;\n position: absolute;\n top: -0.5rem;\n}\n.absolute {\n position: absolute;\n}\n.rotate-45 {\n transform: rotate(45deg);\n}\n.-top-1\\/10 {\n top: -10%;\n}\n.bg-black {\n background-color: black;\n}\n.w-4 {\n width: 1rem;\n}\n.h-4 {\n height: 1rem;\n}\n.text-white {\n color: white;\n}\n.p-2 {\n padding: 0.5rem;\n}\n.rounded-md {\n border-radius: 0.375rem;\n}\n.z-50 {\n z-index: 50;\n}\n.mr-8 {\n margin-right: 2rem;\n}\n.notes {\n font-style: italic;\n}\n.mt-8 {\n margin-top: 2rem;\n}\n@property --tw-rotate-x {\n syntax: \"*\";\n inherits: false;\n initial-value: rotateX(0);\n}\n@property --tw-rotate-y {\n syntax: \"*\";\n inherits: false;\n initial-value: rotateY(0);\n}\n@property --tw-rotate-z {\n syntax: \"*\";\n inherits: false;\n initial-value: rotateZ(0);\n}\n@property --tw-skew-x {\n syntax: \"*\";\n inherits: false;\n initial-value: skewX(0);\n}\n@property --tw-skew-y {\n syntax: \"*\";\n inherits: false;\n initial-value: skewY(0);\n}\n@property --tw-space-y-reverse {\n syntax: \"*\";\n inherits: false;\n initial-value: 0;\n}\n@property --tw-border-style {\n syntax: \"*\";\n inherits: false;\n initial-value: solid;\n}\n@property --tw-font-weight {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-ordinal {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-slashed-zero {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-numeric-figure {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-numeric-spacing {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-numeric-fraction {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-shadow {\n syntax: \"*\";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n@property --tw-shadow-color {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-inset-shadow {\n syntax: \"*\";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n@property --tw-inset-shadow-color {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-ring-color {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-ring-shadow {\n syntax: \"*\";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n@property --tw-inset-ring-color {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-inset-ring-shadow {\n syntax: \"*\";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n@property --tw-ring-inset {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-ring-offset-width {\n syntax: \"<length>\";\n inherits: false;\n initial-value: 0px;\n}\n@property --tw-ring-offset-color {\n syntax: \"*\";\n inherits: false;\n initial-value: #fff;\n}\n@property --tw-ring-offset-shadow {\n syntax: \"*\";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n@property --tw-outline-style {\n syntax: \"*\";\n inherits: false;\n initial-value: solid;\n}\n@property --tw-blur {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-brightness {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-contrast {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-grayscale {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-hue-rotate {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-invert {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-opacity {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-saturate {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-sepia {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-backdrop-blur {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-backdrop-brightness {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-backdrop-contrast {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-backdrop-grayscale {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-backdrop-hue-rotate {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-backdrop-invert {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-backdrop-opacity {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-backdrop-saturate {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-backdrop-sepia {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-ease {\n syntax: \"*\";\n inherits: false;\n}\n@keyframes spin {\n to {\n transform: rotate(360deg);\n }\n}\n@keyframes ping {\n 75%, 100% {\n transform: scale(2);\n opacity: 0;\n }\n}\n@keyframes pulse {\n 50% {\n opacity: 0.5;\n }\n}\n@keyframes bounce {\n 0%, 100% {\n transform: translateY(-25%);\n animation-timing-function: cubic-bezier(0.8, 0, 1, 1);\n }\n 50% {\n transform: none;\n animation-timing-function: cubic-bezier(0, 0, 0.2, 1);\n }\n}\n";
74
+ styleInject(css_248z$1);
46
75
 
47
76
  /******************************************************************************
48
77
  Copyright (c) Microsoft Corporation.
@@ -117,36 +146,6 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
117
146
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
118
147
  };
119
148
 
120
- function styleInject(css, ref) {
121
- if ( ref === void 0 ) ref = {};
122
- var insertAt = ref.insertAt;
123
-
124
- if (!css || typeof document === 'undefined') { return; }
125
-
126
- var head = document.head || document.getElementsByTagName('head')[0];
127
- var style = document.createElement('style');
128
- style.type = 'text/css';
129
-
130
- if (insertAt === 'top') {
131
- if (head.firstChild) {
132
- head.insertBefore(style, head.firstChild);
133
- } else {
134
- head.appendChild(style);
135
- }
136
- } else {
137
- head.appendChild(style);
138
- }
139
-
140
- if (style.styleSheet) {
141
- style.styleSheet.cssText = css;
142
- } else {
143
- style.appendChild(document.createTextNode(css));
144
- }
145
- }
146
-
147
- 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";
148
- styleInject(css_248z);
149
-
150
149
  var IconContext = /*#__PURE__*/React.createContext({});
151
150
  var Context = IconContext;
152
151
 
@@ -1582,12 +1581,16 @@ var BrandContext = React.createContext({
1582
1581
 
1583
1582
  var MUTATION$9 = "{\n entityBranding {\n accentColor\n brandColor\n topNavImageUrl\n }\n }";
1584
1583
  var getBranding = function (_a) {
1585
- var token = _a.token, subdomain = _a.subdomain;
1584
+ var token = _a.token, apiHost = _a.apiHost;
1586
1585
  return __awaiter(void 0, void 0, void 0, function () {
1587
1586
  var response;
1588
1587
  return __generator(this, function (_b) {
1589
1588
  switch (_b.label) {
1590
- case 0: return [4 /*yield*/, common.gqlRequest({ query: MUTATION$9, token: token, subdomain: subdomain })];
1589
+ case 0: return [4 /*yield*/, common.gqlRequest({
1590
+ query: MUTATION$9,
1591
+ token: token,
1592
+ apiHost: apiHost,
1593
+ })];
1591
1594
  case 1:
1592
1595
  response = _b.sent();
1593
1596
  return [2 /*return*/, response === null || response === void 0 ? void 0 : response.entityBranding];
@@ -1596,78 +1599,21 @@ var getBranding = function (_a) {
1596
1599
  });
1597
1600
  };
1598
1601
 
1599
- var BreakpointNumbers;
1600
- (function (BreakpointNumbers) {
1601
- BreakpointNumbers[BreakpointNumbers["xs"] = 480] = "xs";
1602
- BreakpointNumbers[BreakpointNumbers["sm"] = 768] = "sm";
1603
- BreakpointNumbers[BreakpointNumbers["md"] = 992] = "md";
1604
- BreakpointNumbers[BreakpointNumbers["lg"] = 1200] = "lg";
1605
- BreakpointNumbers[BreakpointNumbers["xl"] = 1400] = "xl";
1606
- BreakpointNumbers[BreakpointNumbers["xxl"] = 2000] = "xxl";
1607
- })(BreakpointNumbers || (BreakpointNumbers = {}));
1608
- [
1609
- BreakpointNumbers.xs,
1610
- BreakpointNumbers.sm,
1611
- BreakpointNumbers.md,
1612
- BreakpointNumbers.lg,
1613
- BreakpointNumbers.xl,
1614
- BreakpointNumbers.xxl,
1615
- ];
1616
- var useIsMobile = function (window) {
1617
- var _a = React.useState({
1618
- width: window.innerWidth,
1619
- height: window.innerHeight,
1620
- }), windowSize = _a[0], setWindowSize = _a[1];
1621
- React.useEffect(function () {
1622
- var handleResize = function () {
1623
- setWindowSize({
1624
- width: window.innerWidth,
1625
- height: window.innerHeight,
1626
- });
1627
- };
1628
- window.addEventListener("resize", handleResize);
1629
- handleResize();
1630
- return function () { return window.removeEventListener("resize", handleResize); };
1631
- }, []);
1632
- return windowSize.width < BreakpointNumbers.sm;
1633
- };
1634
-
1635
- 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 }";
1636
- var getCurrentUserData = function (_a) {
1637
- var token = _a.token, subdomain = _a.subdomain;
1638
- return __awaiter(void 0, void 0, void 0, function () {
1639
- var response;
1640
- var _b, _c, _d, _e, _f, _g, _h;
1641
- return __generator(this, function (_j) {
1642
- switch (_j.label) {
1643
- case 0: return [4 /*yield*/, common.gqlRequest({
1644
- query: CURRENT_USER_DATA_QUERY,
1645
- token: token,
1646
- subdomain: subdomain,
1647
- })];
1648
- case 1:
1649
- response = _j.sent();
1650
- return [2 /*return*/, {
1651
- authObjectName: (_b = response === null || response === void 0 ? void 0 : response.currentUser) === null || _b === void 0 ? void 0 : _b.authObjectName,
1652
- companyName: (_c = response === null || response === void 0 ? void 0 : response.company) === null || _c === void 0 ? void 0 : _c.name,
1653
- entityId: (_d = response === null || response === void 0 ? void 0 : response.currentUser) === null || _d === void 0 ? void 0 : _d.entityId,
1654
- 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,
1655
- privacyUrl: (_g = response === null || response === void 0 ? void 0 : response.currentUser) === null || _g === void 0 ? void 0 : _g.privacyUrl,
1656
- termsUrl: (_h = response === null || response === void 0 ? void 0 : response.currentUser) === null || _h === void 0 ? void 0 : _h.termsUrl,
1657
- }];
1658
- }
1659
- });
1602
+ var createGraphQLClient = function (token, apiHost) {
1603
+ return new graphqlRequest.GraphQLClient(apiHost + "/graphql", {
1604
+ headers: {
1605
+ Authorization: token,
1606
+ },
1660
1607
  });
1661
1608
  };
1662
1609
 
1663
1610
  var BunnyContext = React.createContext({});
1664
- // Important that this is created here, not within a function
1665
- var queryClient$1 = new reactQuery.QueryClient();
1611
+ var extraQueryClient = new reactQuery.QueryClient();
1666
1612
  // Every component shares similar props and functionality, which this wrapper handles.
1667
1613
  function BunnyProvider(_a) {
1668
- 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;
1669
- var graphQLClient = common.createGraphQLClient(subdomain || "", window, token);
1670
- var isMobile = useIsMobile(window);
1614
+ 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;
1615
+ var graphQLClient = createGraphQLClient(token, apiHost || "");
1616
+ var isMobile = common.useIsMobile(window);
1671
1617
  var _c = React.useState(undefined), branding = _c[0], setBranding = _c[1];
1672
1618
  // ====== START - Copied straight from PageContainer.tsx ========
1673
1619
  var entityBranding = React.useMemo(function () {
@@ -1677,7 +1623,7 @@ function BunnyProvider(_a) {
1677
1623
  ? "#" + ((_a = branding === null || branding === void 0 ? void 0 : branding.brandColor) === null || _a === void 0 ? void 0 : _a.toString(16))
1678
1624
  : common.DEFAULT_BRAND_COLOR;
1679
1625
  var secondaryColor = common.DEFAULT_SECONDARY_COLOR;
1680
- if (!isMobile && common.Misc.isColorTooDark(branding === null || branding === void 0 ? void 0 : branding.accentColor))
1626
+ if (!isMobile && common.isColorTooDark(branding === null || branding === void 0 ? void 0 : branding.accentColor))
1681
1627
  secondaryColor = "#ffffff";
1682
1628
  var topNavImageUrl = (branding === null || branding === void 0 ? void 0 : branding.topNavImageUrl) || common.DEFAULT_TOP_NAV_IMAGE_URL;
1683
1629
  var accentColor = (branding === null || branding === void 0 ? void 0 : branding.accentColor) || common.DEFAULT_ACCENT_COLOR;
@@ -1699,13 +1645,14 @@ function BunnyProvider(_a) {
1699
1645
  };
1700
1646
  }, []);
1701
1647
  return (jsxRuntime.jsxs(BunnyContext.Provider, __assign({ value: {
1702
- subdomain: subdomain,
1703
- graphQLClient: graphQLClient,
1704
- window: window,
1705
- token: token,
1706
1648
  accountId: accountId,
1707
1649
  darkMode: darkMode,
1708
- } }, { children: [jsxRuntime.jsx("div", __assign({ style: { position: "fixed", left: -2000000000 } }, { children: "test" })), jsxRuntime.jsx(reactQuery.QueryClientProvider, __assign({ client: queryClient$1 }, { children: jsxRuntime.jsx(recoil.RecoilRoot, { children: jsxRuntime.jsx(BrandContext.Provider, __assign({ value: entityBranding }, { children: jsxRuntime.jsx(antd.ConfigProvider, __assign({ theme: {
1650
+ graphQLClient: graphQLClient,
1651
+ onErrorNavigate: onErrorNavigate,
1652
+ apiHost: apiHost,
1653
+ token: token,
1654
+ window: window,
1655
+ } }, { children: [jsxRuntime.jsx("div", __assign({ style: { position: "fixed", left: -2000000000 } }, { children: "test" })), jsxRuntime.jsx(reactQuery.QueryClientProvider, __assign({ client: queryClient || extraQueryClient }, { children: jsxRuntime.jsx(recoil.RecoilRoot, { children: jsxRuntime.jsx(BrandContext.Provider, __assign({ value: entityBranding }, { children: jsxRuntime.jsx(antd.ConfigProvider, __assign({ theme: {
1709
1656
  algorithm: darkMode
1710
1657
  ? theme__default["default"].darkAlgorithm
1711
1658
  : theme__default["default"].defaultAlgorithm,
@@ -1733,15 +1680,11 @@ function BunnyProvider(_a) {
1733
1680
  function SecondaryWrapper(_a) {
1734
1681
  var children = _a.children, setBranding = _a.setBranding;
1735
1682
  var _b = React.useState(false), interFontLoaded = _b[0], setInterFontLoaded = _b[1];
1736
- var _c = React.useContext(BunnyContext), subdomain = _c.subdomain, token = _c.token;
1683
+ var _c = React.useContext(BunnyContext), apiHost = _c.apiHost, token = _c.token;
1737
1684
  var brandingData = reactQuery.useQuery({
1738
1685
  queryKey: common.QueryKeyFactory.default.brandingKey,
1739
- queryFn: function () { return getBranding({ token: token, subdomain: subdomain }); },
1686
+ queryFn: function () { return getBranding({ token: token, apiHost: apiHost }); },
1740
1687
  }).data;
1741
- var _d = reactQuery.useQuery({
1742
- queryKey: common.QueryKeyFactory.default.currentUserKey,
1743
- queryFn: function () { return getCurrentUserData({ token: token }); },
1744
- }); _d.data; _d.isLoading;
1745
1688
  React.useEffect(function () {
1746
1689
  if (brandingData) {
1747
1690
  setBranding(brandingData);
@@ -1758,44 +1701,84 @@ function SecondaryWrapper(_a) {
1758
1701
  return jsxRuntime.jsx(jsxRuntime.Fragment, { children: children });
1759
1702
  }
1760
1703
 
1761
- var MarkupContainer = styled__default["default"].div(templateObject_1$9 || (templateObject_1$9 = __makeTemplateObject(["\n span {\n width: 100%;\n }\n"], ["\n span {\n width: 100%;\n }\n"])));
1704
+ var useAjax = function (onError) {
1705
+ return function (url, method, callback, token, bodyData) { return __awaiter(void 0, void 0, void 0, function () {
1706
+ var response;
1707
+ return __generator(this, function (_a) {
1708
+ switch (_a.label) {
1709
+ case 0: return [4 /*yield*/, fetch(url, {
1710
+ method: method,
1711
+ body: bodyData,
1712
+ headers: {
1713
+ "Content-type": "application/json; charset=utf-8",
1714
+ Authorization: "Bearer ".concat(token),
1715
+ },
1716
+ })];
1717
+ case 1:
1718
+ response = _a.sent();
1719
+ if (response.status !== 200 && response.status !== 201) {
1720
+ return [2 /*return*/, response.json().then(function (data) {
1721
+ if (response.status === 401) {
1722
+ console.error("expired token");
1723
+ onError === null || onError === void 0 ? void 0 : onError("expired token");
1724
+ }
1725
+ else {
1726
+ throw new Error(data === null || data === void 0 ? void 0 : data.message);
1727
+ }
1728
+ return;
1729
+ })];
1730
+ }
1731
+ return [2 /*return*/, callback(response)];
1732
+ }
1733
+ });
1734
+ }); };
1735
+ };
1736
+ var useDownloadFile = function (id, onError) {
1737
+ var ajax = useAjax(onError);
1738
+ return function (url, token) {
1739
+ return ajax(url + (id ? "?id=".concat(id) : ""), "GET", function (rsp) { return __awaiter(void 0, void 0, void 0, function () {
1740
+ var blob, file, contentDisposition, anchor, filenameRegex, matches;
1741
+ return __generator(this, function (_a) {
1742
+ switch (_a.label) {
1743
+ case 0: return [4 /*yield*/, rsp.blob()];
1744
+ case 1:
1745
+ blob = _a.sent();
1746
+ file = window.URL.createObjectURL(blob);
1747
+ contentDisposition = rsp.headers.get("content-disposition");
1748
+ anchor = document.createElement("a");
1749
+ anchor.href = file;
1750
+ if (contentDisposition &&
1751
+ contentDisposition.indexOf("attachment") !== -1) {
1752
+ filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
1753
+ matches = filenameRegex.exec(contentDisposition);
1754
+ if (matches != null && matches[1]) {
1755
+ anchor.setAttribute("download", matches[1].replace(/['"]/g, ""));
1756
+ }
1757
+ }
1758
+ anchor.click();
1759
+ return [2 /*return*/];
1760
+ }
1761
+ });
1762
+ }); }, token);
1763
+ };
1764
+ };
1765
+
1766
+ var MarkupContainer = styled__default["default"].div(templateObject_1$8 || (templateObject_1$8 = __makeTemplateObject(["\n span {\n width: 100%;\n }\n"], ["\n span {\n width: 100%;\n }\n"])));
1762
1767
  var InvoiceQuoteView = function (_a) {
1763
- var children = _a.children, formattedInvoice = _a.formattedInvoice, html = _a.html, isMobile = _a.isMobile, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick, onDownloadError = _a.onDownloadError;
1764
- var downloadFile = common.useDownloadFile(formattedInvoice === null || formattedInvoice === void 0 ? void 0 : formattedInvoice.id, onDownloadError);
1768
+ var children = _a.children, formattedInvoice = _a.formattedInvoice, html = _a.html, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick, onDownloadError = _a.onDownloadError;
1769
+ var downloadFile = useDownloadFile(formattedInvoice === null || formattedInvoice === void 0 ? void 0 : formattedInvoice.id, onDownloadError);
1765
1770
  var secondaryColor = React.useContext(BrandContext).secondaryColor;
1766
- var _b = React.useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain;
1771
+ var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, window = _b.window;
1772
+ var isMobile = common.useIsMobile(window);
1767
1773
  return (jsxRuntime.jsxs("div", __assign({ className: "flex flex-col w-full grow ".concat(isMobile ? "overflow-hidden" : "") }, { children: [formattedInvoice ? (jsxRuntime.jsxs("div", __assign({ className: "flex justify-between items-center pb-4 ".concat(isMobile ? "shadow-padding-x" : ""), id: "acceptance" }, { children: [jsxRuntime.jsx("div", { children: onBackButtonClick ? (jsxRuntime.jsx(antd.Button, __assign({ className: "text-xs pl-0", onClick: onBackButtonClick, style: {
1768
1774
  color: secondaryColor,
1769
1775
  }, type: "link" }, { children: backButtonName || "Back" }))) : null }), jsxRuntime.jsx(antd.Button, __assign({ icon: jsxRuntime.jsx(DownloadOutlined$1, {}), onClick: function () {
1770
- return downloadFile(subdomain + "/api/pdf/invoice/" + formattedInvoice.id, token);
1776
+ return downloadFile(apiHost + "/api/pdf/invoice/" + formattedInvoice.id, token);
1771
1777
  } }, { children: "Download" }))] }))) : null, isMobile ? (jsxRuntime.jsxs(MarkupContainer, __assign({ className: "flex flex-col gap-4 grow w-full shadow-padding-xb overflow-auto" }, { children: [jsxRuntime.jsx(interweave.Markup, { content: html }), children] }))) : (jsxRuntime.jsxs(MarkupContainer, __assign({ className: "flex flex-col gap-4 p-2 w-full bg-white shadow-md rounded-md", style: {
1772
1778
  minWidth: "750px",
1773
1779
  } }, { children: [jsxRuntime.jsx(interweave.Markup, { content: html }), children] })))] })));
1774
1780
  };
1775
- var templateObject_1$9;
1776
-
1777
- 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}";
1778
- var getFormattedInvoice = function (_a) {
1779
- var id = _a.id, token = _a.token, subdomain = _a.subdomain;
1780
- return __awaiter(void 0, void 0, void 0, function () {
1781
- var vars, response;
1782
- return __generator(this, function (_b) {
1783
- switch (_b.label) {
1784
- case 0:
1785
- vars = { id: id };
1786
- return [4 /*yield*/, common.gqlRequest({
1787
- query: MUTATION$8,
1788
- token: token,
1789
- vars: vars,
1790
- subdomain: subdomain,
1791
- })];
1792
- case 1:
1793
- response = _b.sent();
1794
- return [2 /*return*/, response === null || response === void 0 ? void 0 : response.formattedInvoice];
1795
- }
1796
- });
1797
- });
1798
- };
1781
+ var templateObject_1$8;
1799
1782
 
1800
1783
  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}";
1801
1784
  var usePaymentMethod = function (graphQLClient) {
@@ -1833,7 +1816,7 @@ var PaymentOption = function (_a) {
1833
1816
  ? "var(--row-background-dark) border-gray-500"
1834
1817
  : "bg-slate-50 border-slate-200", " border"), onClick: function () { return onClick(paymentOption); } }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex gap-2 items-center" }, { children: [jsxRuntime.jsx(antd.Checkbox, { checked: selected, className: darkMode ? "border-gray-400" : "" }), jsxRuntime.jsx(Text$d, { children: name })] })), isAch ? (jsxRuntime.jsx(BankOutlined$1, { className: "text-slate-400" })) : isCard ? (jsxRuntime.jsx(CardIcon, {})) : (jsxRuntime.jsx(CardIcon, {}))] })));
1835
1818
  };
1836
- var PaymentOptionContainer = styled__default["default"].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) {
1819
+ var PaymentOptionContainer = styled__default["default"].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) {
1837
1820
  var $brandColor = _a.$brandColor, $selected = _a.$selected;
1838
1821
  return $selected &&
1839
1822
  "\n border-color: ".concat($brandColor, ";\n ");
@@ -1841,7 +1824,7 @@ var PaymentOptionContainer = styled__default["default"].div(templateObject_1$8 |
1841
1824
  var $brandColor = _a.$brandColor;
1842
1825
  return $brandColor;
1843
1826
  });
1844
- var templateObject_1$8;
1827
+ var templateObject_1$7;
1845
1828
 
1846
1829
  var PaymentMethodSelector = function (_a) {
1847
1830
  var _b, _c;
@@ -1854,7 +1837,7 @@ var PaymentMethodSelector = function (_a) {
1854
1837
  };
1855
1838
 
1856
1839
  var createPaymentMethod = function (_a) {
1857
- var paymentMethodId = _a.paymentMethodId, plugin = _a.plugin, token = _a.token, subdomain = _a.subdomain, accountId = _a.accountId;
1840
+ var paymentMethodId = _a.paymentMethodId, plugin = _a.plugin, token = _a.token, apiHost = _a.apiHost, accountId = _a.accountId;
1858
1841
  return __awaiter(void 0, void 0, void 0, function () {
1859
1842
  var response;
1860
1843
  return __generator(this, function (_b) {
@@ -1867,7 +1850,7 @@ var createPaymentMethod = function (_a) {
1867
1850
  account_id: accountId,
1868
1851
  },
1869
1852
  token: token,
1870
- subdomain: subdomain,
1853
+ apiHost: apiHost,
1871
1854
  })];
1872
1855
  case 1:
1873
1856
  response = _b.sent();
@@ -1878,19 +1861,19 @@ var createPaymentMethod = function (_a) {
1878
1861
  });
1879
1862
  });
1880
1863
  };
1881
- var createSetupIntent = function (plugin, token, accountId, subdomain) {
1864
+ var createSetupIntent = function (plugin, token, apiHost, accountId) {
1882
1865
  return common.invokePlugin({
1883
1866
  plugin: plugin,
1884
1867
  method: "create_setup_intent",
1885
1868
  token: token,
1886
- subdomain: subdomain,
1869
+ apiHost: apiHost,
1887
1870
  payload: {
1888
1871
  account_id: accountId,
1889
1872
  },
1890
1873
  });
1891
1874
  };
1892
1875
  var createPaymentIntent = function (_a) {
1893
- var payable = _a.payable, savePaymentMethod = _a.savePaymentMethod, memo = _a.memo, plugin = _a.plugin, token = _a.token, subdomain = _a.subdomain, accountId = _a.accountId;
1876
+ var payable = _a.payable, savePaymentMethod = _a.savePaymentMethod, memo = _a.memo, plugin = _a.plugin, token = _a.token, apiHost = _a.apiHost, accountId = _a.accountId;
1894
1877
  return __awaiter(void 0, void 0, void 0, function () {
1895
1878
  var payload, response;
1896
1879
  return __generator(this, function (_b) {
@@ -1907,7 +1890,7 @@ var createPaymentIntent = function (_a) {
1907
1890
  method: "create_payment_intent",
1908
1891
  payload: payload,
1909
1892
  token: token,
1910
- subdomain: subdomain,
1893
+ apiHost: apiHost,
1911
1894
  })];
1912
1895
  case 1:
1913
1896
  response = _b.sent();
@@ -1918,23 +1901,23 @@ var createPaymentIntent = function (_a) {
1918
1901
  });
1919
1902
  });
1920
1903
  };
1921
- var fetchStripeKey = function (plugin, token, subdomain, accountId) {
1904
+ var fetchStripeKey = function (plugin, token, apiHost, accountId) {
1922
1905
  return common.invokePlugin({
1923
1906
  plugin: plugin,
1924
1907
  method: "retrieve_config",
1925
1908
  token: token,
1926
- subdomain: subdomain,
1909
+ apiHost: apiHost,
1927
1910
  payload: {
1928
1911
  account_id: accountId,
1929
1912
  },
1930
1913
  });
1931
1914
  };
1932
1915
  pure.loadStripe.setLoadParameters({ advancedFraudSignals: false });
1933
- var useStripePlugin = function (plugin, token, subdomain, accountId) {
1916
+ var useStripePlugin = function (plugin, token, apiHost, accountId) {
1934
1917
  var _a = React.useState(null), stripe = _a[0], setStripe = _a[1];
1935
- var showErrorNotification = common.NotificationUtils.useErrorNotification();
1918
+ var showErrorNotification = common.useErrorNotification();
1936
1919
  React.useEffect(function () {
1937
- fetchStripeKey(plugin, token, subdomain || "", accountId)
1920
+ fetchStripeKey(plugin, token, apiHost || "", accountId)
1938
1921
  .then(function (_a) {
1939
1922
  var payload = _a.payload;
1940
1923
  return pure.loadStripe(payload.publishable_key).then(setStripe);
@@ -1952,7 +1935,8 @@ var PaymentContext = React.createContext({});
1952
1935
 
1953
1936
  var CheckoutFooter = function (_a) {
1954
1937
  var amountDue = _a.amountDue, currencyId = _a.currencyId, isSaving = _a.isSaving, onPaymentSubmit = _a.onPaymentSubmit, onlySavePaymentMethod = _a.onlySavePaymentMethod, noPadding = _a.noPadding;
1955
- var isMobile = common.useIsMobile();
1938
+ var window = React.useContext(BunnyContext).window;
1939
+ var isMobile = common.useIsMobile(window);
1956
1940
  var displayPayButtonNameAnyways = React.useContext(PaymentContext).displayPayButtonNameAnyways;
1957
1941
  var buttonName = function () {
1958
1942
  return onlySavePaymentMethod && !displayPayButtonNameAnyways
@@ -1964,7 +1948,7 @@ var CheckoutFooter = function (_a) {
1964
1948
  : "Pay";
1965
1949
  };
1966
1950
  return (jsxRuntime.jsx("div", __assign({ className: "flex justify-end gap-2 ".concat(noPadding ? "" : "pt-6") }, { children: jsxRuntime.jsx(antd.Button, __assign({ className: "w-full", disabled: isSaving, onClick: onPaymentSubmit, size: isMobile ? "large" : "middle", type: "primary" }, { children: "".concat(buttonName()).concat(amountDue && currencyId
1967
- ? " ".concat(common.Misc.formatCurrency(amountDue, currencyId))
1951
+ ? " ".concat(common.formatCurrency(amountDue, currencyId))
1968
1952
  : "") })) })));
1969
1953
  };
1970
1954
 
@@ -1973,7 +1957,7 @@ var CheckoutForm = function (_a) {
1973
1957
  // Hooks
1974
1958
  var elements = reactStripeJs.useElements();
1975
1959
  var stripe = reactStripeJs.useStripe();
1976
- var _b = React.useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain, accountId = _b.accountId;
1960
+ var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, accountId = _b.accountId;
1977
1961
  if (!payable)
1978
1962
  throw new Error("A Payable is required to start checkout");
1979
1963
  // Handlers
@@ -1999,7 +1983,7 @@ var CheckoutForm = function (_a) {
1999
1983
  savePaymentMethod: true,
2000
1984
  plugin: plugin,
2001
1985
  token: token,
2002
- subdomain: subdomain || "",
1986
+ apiHost: apiHost || "",
2003
1987
  accountId: accountId,
2004
1988
  })];
2005
1989
  case 2:
@@ -2055,7 +2039,7 @@ var PaymentMethodForm$1 = function (_a) {
2055
2039
  // Hooks
2056
2040
  var elements = reactStripeJs.useElements();
2057
2041
  var stripe = reactStripeJs.useStripe();
2058
- var _b = React.useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain;
2042
+ var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
2059
2043
  var accountId = React.useContext(PaymentContext).accountId;
2060
2044
  // Handlers
2061
2045
  var onSubmit = function () { return __awaiter(void 0, void 0, void 0, function () {
@@ -2075,7 +2059,7 @@ var PaymentMethodForm$1 = function (_a) {
2075
2059
  submitError = (_c.sent()).error;
2076
2060
  if (submitError)
2077
2061
  throw new Error(submitError.message);
2078
- return [4 /*yield*/, createSetupIntent(plugin, token, accountId, subdomain)];
2062
+ return [4 /*yield*/, createSetupIntent(plugin, token, apiHost, accountId)];
2079
2063
  case 2:
2080
2064
  response = _c.sent();
2081
2065
  if (response.status !== "success")
@@ -2103,7 +2087,7 @@ var PaymentMethodForm$1 = function (_a) {
2103
2087
  paymentMethodId: paymentMethodId,
2104
2088
  plugin: plugin,
2105
2089
  token: token,
2106
- subdomain: subdomain,
2090
+ apiHost: apiHost,
2107
2091
  accountId: accountId,
2108
2092
  })];
2109
2093
  case 4:
@@ -2132,10 +2116,10 @@ var PaymentMethodForm$1 = function (_a) {
2132
2116
 
2133
2117
  // This is just a wrapper to fetch the stripe object and pass it to the form
2134
2118
  var StripeForm = function (_a) {
2135
- var payable = _a.payable, plugin = _a.plugin, isSaving = _a.isSaving, setIsSaving = _a.setIsSaving, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess;
2136
- var _b = React.useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain;
2119
+ var entityId = _a.entityId, payable = _a.payable, plugin = _a.plugin, isSaving = _a.isSaving, setIsSaving = _a.setIsSaving, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess;
2120
+ var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
2137
2121
  var accountId = React.useContext(PaymentContext).accountId;
2138
- var stripe = useStripePlugin(plugin, token, subdomain, accountId);
2122
+ var stripe = useStripePlugin(plugin, token, apiHost, accountId);
2139
2123
  var onlySavePaymentMethod = !payable;
2140
2124
  if (!stripe)
2141
2125
  return null;
@@ -2149,7 +2133,7 @@ var StripeForm = function (_a) {
2149
2133
  currency: "usd",
2150
2134
  setupFutureUsage: "off_session",
2151
2135
  };
2152
- return (jsxRuntime.jsx(reactStripeJs.Elements, __assign({ options: options, stripe: stripe }, { children: jsxRuntime.jsx(PaymentMethodForm$1, { isSaving: isSaving, setIsSaving: setIsSaving, plugin: plugin, onFail: onFail, onPaymentSuccess: onPaymentSuccess }) })));
2136
+ return (jsxRuntime.jsx(reactStripeJs.Elements, __assign({ options: options, stripe: stripe }, { children: jsxRuntime.jsx(PaymentMethodForm$1, { entityId: entityId, isSaving: isSaving, setIsSaving: setIsSaving, plugin: plugin, onFail: onFail, onPaymentSuccess: onPaymentSuccess }) })));
2153
2137
  }
2154
2138
  else {
2155
2139
  var options = {
@@ -2158,7 +2142,7 @@ var StripeForm = function (_a) {
2158
2142
  currency: payable === null || payable === void 0 ? void 0 : payable.currencyId.toLowerCase(),
2159
2143
  setupFutureUsage: "off_session",
2160
2144
  };
2161
- return (jsxRuntime.jsx(reactStripeJs.Elements, __assign({ options: options, stripe: stripe }, { children: jsxRuntime.jsx(CheckoutForm, { payable: payable, plugin: plugin, isSaving: isSaving, setIsSaving: setIsSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess }) })));
2145
+ return (jsxRuntime.jsx(reactStripeJs.Elements, __assign({ options: options, stripe: stripe }, { children: jsxRuntime.jsx(CheckoutForm, { entityId: entityId, payable: payable, plugin: plugin, isSaving: isSaving, setIsSaving: setIsSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess }) })));
2162
2146
  }
2163
2147
  };
2164
2148
 
@@ -2205,7 +2189,7 @@ var unformatCardNumber = function (cardNumber) {
2205
2189
  var unformattedCardNumberArray = cardNumberArray.filter(function (character) { return character !== " "; });
2206
2190
  return unformattedCardNumberArray.join("");
2207
2191
  };
2208
- var storePayment = function (options, plugin, accountId, subdomain) { return __awaiter(void 0, void 0, void 0, function () {
2192
+ var storePayment = function (options, plugin, apiHost, accountId) { return __awaiter(void 0, void 0, void 0, function () {
2209
2193
  var testCreditCardNumber, testCreditCardCvc, testCreditCardExpirationDate, token, response;
2210
2194
  return __generator(this, function (_a) {
2211
2195
  switch (_a.label) {
@@ -2221,7 +2205,7 @@ var storePayment = function (options, plugin, accountId, subdomain) { return __a
2221
2205
  account_id: accountId,
2222
2206
  },
2223
2207
  token: token,
2224
- subdomain: subdomain,
2208
+ apiHost: apiHost,
2225
2209
  })];
2226
2210
  case 1:
2227
2211
  response = _a.sent();
@@ -2280,7 +2264,7 @@ var TEST_CARD = "4242424242424242";
2280
2264
  var DemoPayForm = function (_a) {
2281
2265
  var isSaving = _a.isSaving, invoice = _a.invoice, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, plugin = _a.plugin, quote = _a.quote, setIsSaving = _a.setIsSaving;
2282
2266
  // Context
2283
- var _b = React.useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain, darkMode = _b.darkMode;
2267
+ var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, darkMode = _b.darkMode;
2284
2268
  var accountId = React.useContext(PaymentContext).accountId;
2285
2269
  // Local state
2286
2270
  var _c = React.useState(false), savePaymentMethod = _c[0], setSavePaymentMethod = _c[1];
@@ -2306,7 +2290,7 @@ var DemoPayForm = function (_a) {
2306
2290
  testCreditCardCvc: cardDetails.cvc.toString(),
2307
2291
  testCreditCardExpirationDate: cardDetails.expiry,
2308
2292
  token: token,
2309
- }, plugin, accountId, subdomain)];
2293
+ }, plugin, apiHost, accountId)];
2310
2294
  case 1:
2311
2295
  response = _a.sent();
2312
2296
  paymentMethodId = response.payload[0].id;
@@ -2376,14 +2360,14 @@ var DemoPayForm = function (_a) {
2376
2360
  };
2377
2361
  return (jsxRuntime.jsxs("div", __assign({ className: "flex flex-col gap-2" }, { children: [jsxRuntime.jsxs(StyledInputs, __assign({ className: "flex flex-col gap-2", darkMode: darkMode !== null && darkMode !== void 0 ? darkMode : false }, { children: [jsxRuntime.jsx(DemoPayCardNumber, { onChange: onCardNumberChange, value: cardDetails.number }), jsxRuntime.jsxs("div", __assign({ className: "flex gap-2" }, { children: [jsxRuntime.jsx(DemoPayExpiry, { onChange: onCardExpiryChange, value: cardDetails.expiry }), jsxRuntime.jsx(DemoPayCardCvc, { onChange: onCardCvcChange, value: cardDetails.cvc })] }))] })), jsxRuntime.jsx(Text$c, __assign({ className: "text-xs" }, { children: "DemoPay is for testing only." })), !onlySavePaymentMethod && (jsxRuntime.jsx(antd.Checkbox, __assign({ className: "mt-2", onChange: function (e) { return setSavePaymentMethod(e.target.checked); } }, { children: "Save as primary payment method" }))), jsxRuntime.jsx(CheckoutFooter, { amountDue: amountDue, currencyId: currencyId, isSaving: isSaving, onPaymentSubmit: onPaymentSubmit, onlySavePaymentMethod: onlySavePaymentMethod })] })));
2378
2362
  };
2379
- var StyledInputs = styled__default["default"].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) {
2363
+ var StyledInputs = styled__default["default"].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) {
2380
2364
  var darkMode = _a.darkMode;
2381
2365
  return darkMode ? "var(--row-background-dark)" : "white";
2382
2366
  }, function (_a) {
2383
2367
  var darkMode = _a.darkMode;
2384
2368
  return darkMode ? common.GRAY_500 : common.GRAY_200;
2385
2369
  });
2386
- var templateObject_1$7;
2370
+ var templateObject_1$6;
2387
2371
 
2388
2372
  var finixStyles = function (isMobile) { return ({
2389
2373
  default: {
@@ -2403,7 +2387,7 @@ var finixStyles = function (isMobile) { return ({
2403
2387
  }); };
2404
2388
 
2405
2389
  var retrieveConfig = function (_a) {
2406
- var plugin = _a.plugin, token = _a.token, subdomain = _a.subdomain, accountId = _a.accountId;
2390
+ var plugin = _a.plugin, token = _a.token, apiHost = _a.apiHost, accountId = _a.accountId;
2407
2391
  return __awaiter(void 0, void 0, void 0, function () {
2408
2392
  var response;
2409
2393
  return __generator(this, function (_b) {
@@ -2412,7 +2396,7 @@ var retrieveConfig = function (_a) {
2412
2396
  plugin: plugin,
2413
2397
  method: "retrieve_config",
2414
2398
  token: token,
2415
- subdomain: subdomain,
2399
+ apiHost: apiHost,
2416
2400
  payload: {
2417
2401
  account_id: accountId,
2418
2402
  },
@@ -2473,9 +2457,9 @@ var formatFinixError = function (response) {
2473
2457
  var FinixCardPaymentForm = function (_a) {
2474
2458
  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;
2475
2459
  // Context
2476
- var _b = React.useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain;
2460
+ var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
2477
2461
  var accountId = React.useContext(PaymentContext).accountId;
2478
- var isMobile = common.useIsMobile();
2462
+ var isMobile = common.useIsMobile(window);
2479
2463
  // Local state
2480
2464
  var _c = React.useState(false), savePaymentMethod = _c[0], setSavePaymentMethod = _c[1];
2481
2465
  var _d = React.useState(null), finixForm = _d[0], setFinixForm = _d[1];
@@ -2515,7 +2499,7 @@ var FinixCardPaymentForm = function (_a) {
2515
2499
  account_id: accountId,
2516
2500
  },
2517
2501
  token: token,
2518
- subdomain: subdomain,
2502
+ apiHost: apiHost,
2519
2503
  })];
2520
2504
  case 1:
2521
2505
  response_1 = _a.sent();
@@ -2567,15 +2551,15 @@ var FinixCardPaymentForm = function (_a) {
2567
2551
  };
2568
2552
  // This is just a wrapper to fetch the finix config, config its form and pass it to the paymentForm
2569
2553
  var FinixForm = function (_a) {
2570
- var invoice = _a.invoice, isSaving = _a.isSaving, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, plugin = _a.plugin, quote = _a.quote, setIsSaving = _a.setIsSaving;
2571
- var _b = React.useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain, accountId = _b.accountId;
2554
+ 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;
2555
+ var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, accountId = _b.accountId;
2572
2556
  var finixConfig = reactQuery.useQuery({
2573
2557
  queryKey: common.QueryKeyFactory.default.finixKey,
2574
2558
  queryFn: function () {
2575
2559
  return retrieveConfig({
2576
2560
  plugin: plugin,
2577
2561
  token: token,
2578
- subdomain: subdomain,
2562
+ apiHost: apiHost,
2579
2563
  accountId: accountId,
2580
2564
  });
2581
2565
  },
@@ -2583,7 +2567,7 @@ var FinixForm = function (_a) {
2583
2567
  }).data;
2584
2568
  if (!finixConfig || !finixConfig.application_id)
2585
2569
  return null;
2586
- return (jsxRuntime.jsx(FinixCardPaymentForm, { formData: finixConfig, invoice: invoice, isSaving: isSaving, setIsSaving: setIsSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, plugin: plugin, quote: quote }));
2570
+ return (jsxRuntime.jsx(FinixCardPaymentForm, { entityId: entityId, formData: finixConfig, invoice: invoice, isSaving: isSaving, setIsSaving: setIsSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, plugin: plugin, quote: quote }));
2587
2571
  };
2588
2572
 
2589
2573
  var StoredPaymentMethodForm = function (_a) {
@@ -2622,15 +2606,15 @@ var finixOptions = function (isMobile) { return ({
2622
2606
  }); };
2623
2607
  var FINIX_FORM_ID = "form-element";
2624
2608
  var FinixAchPayment = function (_a) {
2625
- var invoice = _a.invoice, isSaving = _a.isSaving, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, plugin = _a.plugin, quote = _a.quote, setIsSaving = _a.setIsSaving;
2626
- var _b = React.useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain, accountId = _b.accountId;
2609
+ 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;
2610
+ var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, accountId = _b.accountId;
2627
2611
  var finixConfig = reactQuery.useQuery({
2628
2612
  queryKey: common.QueryKeyFactory.default.finixAchKey,
2629
2613
  queryFn: function () {
2630
2614
  return retrieveConfig({
2631
2615
  plugin: plugin,
2632
2616
  token: token,
2633
- subdomain: subdomain,
2617
+ apiHost: apiHost,
2634
2618
  accountId: accountId,
2635
2619
  });
2636
2620
  },
@@ -2638,13 +2622,13 @@ var FinixAchPayment = function (_a) {
2638
2622
  }).data;
2639
2623
  if (!finixConfig || !finixConfig.application_id)
2640
2624
  return null;
2641
- return (jsxRuntime.jsx(FinixAchPaymentForm, { isSaving: isSaving, formData: finixConfig, invoice: invoice, onFail: onFail, onPaymentSuccess: onPaymentSuccess, plugin: plugin, quote: quote, setIsSaving: setIsSaving }));
2625
+ return (jsxRuntime.jsx(FinixAchPaymentForm, { entityId: entityId, isSaving: isSaving, formData: finixConfig, invoice: invoice, onFail: onFail, onPaymentSuccess: onPaymentSuccess, plugin: plugin, quote: quote, setIsSaving: setIsSaving }));
2642
2626
  };
2643
2627
  var FinixAchPaymentForm = function (_a) {
2644
2628
  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;
2645
2629
  // Context
2646
- var isMobile = common.useIsMobile();
2647
- var _b = React.useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain, accountId = _b.accountId, window = _b.window;
2630
+ var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, accountId = _b.accountId, window = _b.window;
2631
+ var isMobile = common.useIsMobile(window);
2648
2632
  // Local state
2649
2633
  var _c = React.useState(), finixForm = _c[0], setFinixForm = _c[1];
2650
2634
  var _d = React.useState(false), savePaymentMethod = _d[0], setSavePaymentMethod = _d[1];
@@ -2680,7 +2664,7 @@ var FinixAchPaymentForm = function (_a) {
2680
2664
  account_id: accountId,
2681
2665
  },
2682
2666
  token: token,
2683
- subdomain: subdomain,
2667
+ apiHost: apiHost,
2684
2668
  })];
2685
2669
  case 1:
2686
2670
  response_1 = _a.sent();
@@ -2731,7 +2715,7 @@ var FinixAchPaymentForm = function (_a) {
2731
2715
 
2732
2716
  var PaymentMethodForm = function (_a) {
2733
2717
  var _b, _c;
2734
- 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;
2718
+ 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;
2735
2719
  if (!paymentMethod)
2736
2720
  return null;
2737
2721
  if (isPlugin) {
@@ -2739,25 +2723,68 @@ var PaymentMethodForm = function (_a) {
2739
2723
  var payable = (quote || invoice);
2740
2724
  switch ((_c = (_b = paymentMethod.components) === null || _b === void 0 ? void 0 : _b.frontend) === null || _c === void 0 ? void 0 : _c[0].name) {
2741
2725
  case "StripePayment":
2742
- return (jsxRuntime.jsx(StripeForm, { payable: payable, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, plugin: paymentMethod, setIsSaving: setIsSaving }));
2726
+ return (jsxRuntime.jsx(StripeForm, { entityId: entityId, payable: payable, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, plugin: paymentMethod, setIsSaving: setIsSaving }));
2743
2727
  case "FinixPayment":
2744
- return (jsxRuntime.jsx(FinixForm, { invoice: invoice, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, plugin: paymentMethod, quote: quote, setIsSaving: setIsSaving }));
2728
+ return (jsxRuntime.jsx(FinixForm, { entityId: entityId, invoice: invoice, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, plugin: paymentMethod, quote: quote, setIsSaving: setIsSaving }));
2745
2729
  case "FinixAchPayment":
2746
- return (jsxRuntime.jsx(FinixAchPayment, { invoice: invoice, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, plugin: paymentMethod, quote: quote, setIsSaving: setIsSaving }));
2730
+ return (jsxRuntime.jsx(FinixAchPayment, { entityId: entityId, invoice: invoice, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, plugin: paymentMethod, quote: quote, setIsSaving: setIsSaving }));
2747
2731
  case "DemoPayPayment":
2748
- return (jsxRuntime.jsx(DemoPayForm, { invoice: invoice, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, plugin: paymentMethod, quote: quote, setIsSaving: setIsSaving }));
2732
+ return (jsxRuntime.jsx(DemoPayForm, { entityId: entityId, invoice: invoice, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, plugin: paymentMethod, quote: quote, setIsSaving: setIsSaving }));
2749
2733
  default:
2750
2734
  return jsxRuntime.jsx("p", { children: "Can not find form for plugin" });
2751
2735
  }
2752
2736
  }
2753
2737
  else if (quote || invoice)
2754
- return (jsxRuntime.jsx(StoredPaymentMethodForm, { invoice: invoice, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, paymentMethod: paymentMethod, quote: quote, setIsSaving: setIsSaving }));
2738
+ return (jsxRuntime.jsx(StoredPaymentMethodForm, { entityId: entityId, invoice: invoice, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, paymentMethod: paymentMethod, quote: quote, setIsSaving: setIsSaving }));
2755
2739
  return null;
2756
2740
  };
2757
2741
 
2742
+ var usePlugins = function (_a) {
2743
+ var entityId = _a.entityId, apiHost = _a.apiHost, token = _a.token;
2744
+ return reactQuery.useQuery({
2745
+ queryKey: common.QueryKeyFactory.default.pluginsKey,
2746
+ queryFn: function () {
2747
+ var plugins = common.getPlugins({
2748
+ entityId: entityId,
2749
+ token: token,
2750
+ apiHost: apiHost,
2751
+ });
2752
+ return plugins;
2753
+ },
2754
+ enabled: Boolean(entityId),
2755
+ });
2756
+ };
2757
+
2758
+ var filterPaymentPlugins = function (plugins) {
2759
+ return plugins === null || plugins === void 0 ? void 0 : plugins.filter(function (plugin) {
2760
+ var _a, _b, _c, _d;
2761
+ return ((_a = plugin.type) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === "payment" &&
2762
+ ((_b = plugin.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === "valid" &&
2763
+ ((_d = (_c = plugin.components) === null || _c === void 0 ? void 0 : _c.frontend) === null || _d === void 0 ? void 0 : _d.length);
2764
+ });
2765
+ };
2766
+ var usePaymentPlugins = function (_a) {
2767
+ var entityId = _a.entityId, apiHost = _a.apiHost, token = _a.token;
2768
+ var _b = usePlugins({
2769
+ entityId: entityId,
2770
+ apiHost: apiHost,
2771
+ token: token,
2772
+ }), plugins = _b.data, isFetched = _b.isFetched;
2773
+ var paymentPlugins = filterPaymentPlugins(Array.isArray(plugins) ? plugins : []);
2774
+ var paymentMethodAllowedPlugins = paymentPlugins === null || paymentPlugins === void 0 ? void 0 : paymentPlugins.filter(function (plugin) {
2775
+ var _a, _b;
2776
+ 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"); });
2777
+ });
2778
+ return {
2779
+ paymentPlugins: paymentPlugins,
2780
+ paymentMethodAllowedPlugins: paymentMethodAllowedPlugins,
2781
+ isFetched: isFetched,
2782
+ };
2783
+ };
2784
+
2758
2785
  var PaymentFormWrapper = function (_a) {
2759
2786
  var children = _a.children, setMaxHeight = _a.setMaxHeight;
2760
- var isMobile = common.useIsMobile();
2787
+ var isMobile = common.useIsMobile(window);
2761
2788
  return (jsxRuntime.jsx("div", __assign({ className: "flex flex-col gap-6 shrink-0 ".concat(isMobile ? "w-full shadow-padding-xb" : ""), style: __assign({}, (isMobile
2762
2789
  ? setMaxHeight
2763
2790
  ? { maxHeight: "60vh" }
@@ -2767,14 +2794,14 @@ var PaymentFormWrapper = function (_a) {
2767
2794
  })) }, { children: children })));
2768
2795
  };
2769
2796
  var ActualPaymentForm = function (_a) {
2770
- var invoice = _a.invoice, isSaving = _a.isSaving, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, quote = _a.quote, setIsSaving = _a.setIsSaving;
2797
+ var entityId = _a.entityId, invoice = _a.invoice, isSaving = _a.isSaving, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, quote = _a.quote, setIsSaving = _a.setIsSaving;
2771
2798
  // Local state
2772
2799
  var _b = React.useState(), selectedPaymentMethod = _b[0], setSelectedPaymentMethod = _b[1];
2773
- var _c = React.useContext(BunnyContext), token = _c.token, subdomain = _c.subdomain, graphQLClient = _c.graphQLClient;
2800
+ var _c = React.useContext(BunnyContext), token = _c.token, apiHost = _c.apiHost, graphQLClient = _c.graphQLClient;
2774
2801
  var storedPaymentMethod = usePaymentMethod(graphQLClient).data;
2775
2802
  // Queries
2776
2803
  var isPaymentMethodFetched = storedPaymentMethod !== undefined;
2777
- var _d = common.usePaymentPlugins({ subdomain: subdomain, token: token }), paymentMethodAllowedPlugins = _d.paymentMethodAllowedPlugins, arePluginsFetched = _d.isFetched;
2804
+ var _d = usePaymentPlugins({ entityId: entityId, apiHost: apiHost, token: token }), paymentMethodAllowedPlugins = _d.paymentMethodAllowedPlugins, arePluginsFetched = _d.isFetched;
2778
2805
  // Derived state
2779
2806
  // If there is a quote or invoice, we are just saving a payment method and not processing a payment
2780
2807
  var showStoredPaymentMethodOption = Boolean(quote || invoice);
@@ -2809,16 +2836,16 @@ var ActualPaymentForm = function (_a) {
2809
2836
  showStoredPaymentMethodOption,
2810
2837
  storedPaymentMethod,
2811
2838
  ]);
2812
- return (jsxRuntime.jsxs(PaymentFormWrapper, __assign({ setMaxHeight: isPlugin }, { children: [showPaymentMethodSelector && (jsxRuntime.jsx(PaymentMethodSelector, { onSelect: setSelectedPaymentMethod, paymentMethodAllowedPlugins: paymentMethodAllowedPlugins, showStoredPaymentMethodOption: showStoredPaymentMethodOption, value: selectedPaymentMethod })), selectedPaymentMethod && (jsxRuntime.jsx("div", __assign({ className: "flex flex-col" }, { children: jsxRuntime.jsx(PaymentMethodForm, { invoice: invoice, isPlugin: isPlugin, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, paymentMethod: selectedPaymentMethod, quote: quote, setIsSaving: setIsSaving }) })))] })));
2839
+ return (jsxRuntime.jsxs(PaymentFormWrapper, __assign({ setMaxHeight: isPlugin }, { children: [showPaymentMethodSelector && (jsxRuntime.jsx(PaymentMethodSelector, { onSelect: setSelectedPaymentMethod, paymentMethodAllowedPlugins: paymentMethodAllowedPlugins, showStoredPaymentMethodOption: showStoredPaymentMethodOption, value: selectedPaymentMethod })), selectedPaymentMethod && (jsxRuntime.jsx("div", __assign({ className: "flex flex-col" }, { children: jsxRuntime.jsx(PaymentMethodForm, { entityId: entityId, invoice: invoice, isPlugin: isPlugin, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, paymentMethod: selectedPaymentMethod, quote: quote, setIsSaving: setIsSaving }) })))] })));
2813
2840
  };
2814
2841
  var PaymentForm = function (_a) {
2815
- var invoice = _a.invoice, isSaving = _a.isSaving, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, quote = _a.quote, setIsSaving = _a.setIsSaving;
2816
- return (jsxRuntime.jsx(ActualPaymentForm, { invoice: invoice, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, quote: quote, setIsSaving: setIsSaving }));
2842
+ var entityId = _a.entityId, invoice = _a.invoice, isSaving = _a.isSaving, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, quote = _a.quote, setIsSaving = _a.setIsSaving;
2843
+ return (jsxRuntime.jsx(ActualPaymentForm, { entityId: entityId, invoice: invoice, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, quote: quote, setIsSaving: setIsSaving }));
2817
2844
  };
2818
2845
 
2819
- 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";
2846
+ 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";
2820
2847
  var checkout = function (_a) {
2821
- var quoteId = _a.quoteId, invoiceId = _a.invoiceId, paymentMethodId = _a.paymentMethodId, paymentMethodData = _a.paymentMethodData, token = _a.token, subdomain = _a.subdomain;
2848
+ var quoteId = _a.quoteId, invoiceId = _a.invoiceId, paymentMethodId = _a.paymentMethodId, paymentMethodData = _a.paymentMethodData, token = _a.token, apiHost = _a.apiHost;
2822
2849
  return __awaiter(void 0, void 0, void 0, function () {
2823
2850
  var mutationVars, response, errors;
2824
2851
  return __generator(this, function (_b) {
@@ -2833,10 +2860,10 @@ var checkout = function (_a) {
2833
2860
  mutationVars.paymentMethodData = __assign(__assign({}, paymentMethodData), { metadata: paymentMethodData.metadata });
2834
2861
  }
2835
2862
  return [4 /*yield*/, common.gqlRequest({
2836
- query: MUTATION$7,
2863
+ query: MUTATION$8,
2837
2864
  token: token,
2838
2865
  vars: mutationVars,
2839
- subdomain: subdomain,
2866
+ apiHost: apiHost,
2840
2867
  })];
2841
2868
  case 1:
2842
2869
  response = _b.sent();
@@ -2853,8 +2880,8 @@ var checkout = function (_a) {
2853
2880
 
2854
2881
  var InvoiceCheckoutContext = React.createContext({});
2855
2882
  var InvoiceCheckout = function (_a) {
2856
- 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;
2857
- var _b = React.useContext(BunnyContext), subdomain = _b.subdomain, token = _b.token;
2883
+ 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;
2884
+ var _b = React.useContext(BunnyContext), apiHost = _b.apiHost, token = _b.token;
2858
2885
  var checkoutMutation = reactQuery.useMutation({
2859
2886
  mutationFn: function (_a) {
2860
2887
  var pluginPaymentMethod = _a.pluginPaymentMethod, savedPaymentMethod = _a.savedPaymentMethod;
@@ -2864,7 +2891,7 @@ var InvoiceCheckout = function (_a) {
2864
2891
  invoiceId: invoice === null || invoice === void 0 ? void 0 : invoice.id,
2865
2892
  paymentMethodId: paymentMethodId,
2866
2893
  token: token,
2867
- subdomain: subdomain,
2894
+ apiHost: apiHost,
2868
2895
  });
2869
2896
  }
2870
2897
  else if (pluginPaymentMethod) {
@@ -2879,7 +2906,7 @@ var InvoiceCheckout = function (_a) {
2879
2906
  token: paymentToken,
2880
2907
  },
2881
2908
  token: token,
2882
- subdomain: subdomain,
2909
+ apiHost: apiHost,
2883
2910
  });
2884
2911
  }
2885
2912
  else
@@ -2924,7 +2951,7 @@ var InvoiceCheckout = function (_a) {
2924
2951
  invoice: invoice,
2925
2952
  setIsPreCheckoutLoading: setIsPreCheckoutLoading,
2926
2953
  isPreCheckoutLoading: isPreCheckoutLoading,
2927
- } }, { children: jsxRuntime.jsx(PaymentForm, { isSaving: isSaving, onPaymentSuccess: handleCheckout, onFail: onFail, invoice: invoice, setIsSaving: setIsSaving }) })));
2954
+ } }, { children: jsxRuntime.jsx(PaymentForm, { entityId: entityId, isSaving: isSaving, onPaymentSuccess: handleCheckout, onFail: onFail, invoice: invoice, setIsSaving: setIsSaving }) })));
2928
2955
  };
2929
2956
 
2930
2957
  var fetchPDF = function (window, apiEndpoint, invoiceUuid) { return __awaiter(void 0, void 0, void 0, function () {
@@ -2935,7 +2962,7 @@ var fetchPDF = function (window, apiEndpoint, invoiceUuid) { return __awaiter(vo
2935
2962
  if (!invoiceUuid) {
2936
2963
  throw new Error("Invoice ID is required to fetch PDF");
2937
2964
  }
2938
- return [4 /*yield*/, fetch("".concat(common.ApiUtils.getApiBase(window, apiEndpoint), "/legacy_invoices/").concat(invoiceUuid))];
2965
+ return [4 /*yield*/, fetch("".concat(apiEndpoint, "/api/legacy_invoices/").concat(invoiceUuid))];
2939
2966
  case 1:
2940
2967
  response = _a.sent();
2941
2968
  if (!response.ok)
@@ -2945,12 +2972,12 @@ var fetchPDF = function (window, apiEndpoint, invoiceUuid) { return __awaiter(vo
2945
2972
  });
2946
2973
  }); };
2947
2974
  function InvoicePDF(_a) {
2948
- var invoiceUuid = _a.invoiceUuid, subdomain = _a.subdomain;
2975
+ var invoiceUuid = _a.invoiceUuid, apiHost = _a.apiHost;
2949
2976
  var window = React.useContext(BunnyContext).window;
2950
2977
  var _b = React.useState(undefined), pdfUrl = _b[0], setPdfUrl = _b[1];
2951
2978
  var _c = reactQuery.useQuery({
2952
2979
  queryKey: ["invoicePDF", invoiceUuid],
2953
- queryFn: function () { return fetchPDF(window, subdomain || "", invoiceUuid); },
2980
+ queryFn: function () { return fetchPDF(window, apiHost || "", invoiceUuid); },
2954
2981
  enabled: Boolean(invoiceUuid),
2955
2982
  }), pdfBlob = _c.data, isLoading = _c.isLoading;
2956
2983
  React.useEffect(function () {
@@ -2970,20 +2997,30 @@ function InvoicePDF(_a) {
2970
2997
  }, title: "Invoice PDF", width: "100%" }));
2971
2998
  }
2972
2999
 
3000
+ var quoteMetaDescription = function (vendorName) {
3001
+ return "View this quote on the ".concat(vendorName, " customer portal. Powered by Bunny");
3002
+ };
3003
+ var quoteMetaTitle = function (_a) {
3004
+ var documentName = _a.documentName, vendorName = _a.vendorName;
3005
+ return vendorName + " " + documentName;
3006
+ };
3007
+
2973
3008
  function ActualInvoice(_a) {
2974
- var id = _a.id, invoiceQuoteViewComponent = _a.invoiceQuoteViewComponent, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick, onPaymentSuccess = _a.onPaymentSuccess;
3009
+ var id = _a.id, invoiceQuoteViewComponent = _a.invoiceQuoteViewComponent, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick, onPaymentSuccess = _a.onPaymentSuccess, entityId = _a.entityId;
3010
+ var window = React.useContext(BunnyContext).window;
3011
+ var isMobile = common.useIsMobile(window);
2975
3012
  var _b = React.useState(false), isSaving = _b[0], setIsSaving = _b[1];
2976
3013
  var queryClient = reactQuery.useQueryClient();
2977
- var isMobile = common.useIsMobile();
2978
- var showSuccessNotification = common.NotificationUtils.useSuccessNotification();
2979
- var handleAllErrorFormats = common.NotificationUtils.useAllErrorFormats(function (url) {
2980
- console.log("navigate to", url);
2981
- });
2982
- var _c = React.useContext(BunnyContext), subdomain = _c.subdomain, token = _c.token;
3014
+ var _c = React.useContext(BunnyContext), apiHost = _c.apiHost, token = _c.token, onErrorNavigate = _c.onErrorNavigate;
3015
+ var showSuccessNotification = common.useSuccessNotification();
3016
+ var handleAllErrorFormats = common.useAllErrorFormats(onErrorNavigate ||
3017
+ (function (url) {
3018
+ console.log("navigate to", url, " not implemented");
3019
+ }));
2983
3020
  // Queries
2984
3021
  var _d = reactQuery.useQuery({
2985
3022
  queryKey: common.QueryKeyFactory.default.createFormattedInvoiceKey(token, id),
2986
- queryFn: function () { return getFormattedInvoice({ id: id, token: token, subdomain: subdomain }); },
3023
+ queryFn: function () { return common.getFormattedInvoice({ id: id, token: token, apiHost: apiHost }); },
2987
3024
  }), formattedInvoice = _d.data, error = _d.error;
2988
3025
  if (error) {
2989
3026
  return jsxRuntime.jsxs("div", { children: ["Error loading invoice: ", error.message] });
@@ -3010,24 +3047,39 @@ function ActualInvoice(_a) {
3010
3047
  };
3011
3048
  // Derived state
3012
3049
  var isInvoicePayable = common.PAYABLE_INVOICE_STATES.includes((formattedInvoice === null || formattedInvoice === void 0 ? void 0 : formattedInvoice.state) || "");
3013
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(reactHelmetAsync.Helmet, { children: [jsxRuntime.jsxs("title", { children: [formattedInvoice.vendorName, " ", common.DOCUMENT_NAME.INVOICE] }), jsxRuntime.jsx("meta", { name: "description", content: common.QuoteInvoiceUtils.quoteMetaDescription(formattedInvoice.vendorName) }), jsxRuntime.jsx("meta", { property: "og:type", content: "website" }), jsxRuntime.jsx("meta", { property: "og:title", content: common.QuoteInvoiceUtils.quoteMetaTitle({
3050
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(reactHelmetAsync.Helmet, { children: [jsxRuntime.jsxs("title", { children: [formattedInvoice.vendorName, " ", common.DOCUMENT_NAME.INVOICE] }), jsxRuntime.jsx("meta", { name: "description", content: quoteMetaDescription(formattedInvoice.vendorName) }), jsxRuntime.jsx("meta", { property: "og:type", content: "website" }), jsxRuntime.jsx("meta", { property: "og:title", content: quoteMetaTitle({
3014
3051
  vendorName: formattedInvoice.vendorName,
3015
3052
  documentName: common.DOCUMENT_NAME.INVOICE,
3016
- }) }), jsxRuntime.jsx("meta", { property: "og:description", content: common.QuoteInvoiceUtils.quoteMetaDescription(formattedInvoice.vendorName) })] }), jsxRuntime.jsxs("div", __assign({ className: "flex gap-6 ".concat(isMobile ? "flex-col w-full overflow-hidden" : "shadow-padding-xb") }, { children: [formattedInvoice.isLegacy ? (jsxRuntime.jsx("div", __assign({ className: "flex justify-center w-full" }, { children: jsxRuntime.jsx(InvoicePDF, { invoiceUuid: formattedInvoice.uuid, subdomain: subdomain }) }))) : (invoiceQuoteViewComponent || (jsxRuntime.jsx(InvoiceQuoteView, { html: formattedInvoice.html, isMobile: isMobile, formattedInvoice: formattedInvoice, backButtonName: backButtonName, onBackButtonClick: onBackButtonClick }))), !isMobile && isInvoicePayable && (jsxRuntime.jsx(antd.Divider, { className: "h-full", type: "vertical" })), isInvoicePayable && (jsxRuntime.jsx(InvoiceCheckout, { invoice: formattedInvoice, isSaving: isSaving, onFail: function (error) {
3053
+ }) }), jsxRuntime.jsx("meta", { property: "og:description", content: quoteMetaDescription(formattedInvoice.vendorName) })] }), jsxRuntime.jsxs("div", __assign({ className: "flex gap-6 ".concat(isMobile ? "flex-col w-full overflow-hidden" : "shadow-padding-xb") }, { children: [formattedInvoice.isLegacy ? (jsxRuntime.jsx("div", __assign({ className: "flex justify-center w-full" }, { children: jsxRuntime.jsx(InvoicePDF, { invoiceUuid: formattedInvoice.uuid, apiHost: apiHost }) }))) : (invoiceQuoteViewComponent || (jsxRuntime.jsx(InvoiceQuoteView, { html: formattedInvoice.html, formattedInvoice: formattedInvoice, backButtonName: backButtonName, onBackButtonClick: onBackButtonClick }))), !isMobile && isInvoicePayable && (jsxRuntime.jsx(antd.Divider, { className: "h-full", type: "vertical" })), isInvoicePayable && (jsxRuntime.jsx(InvoiceCheckout, { invoice: formattedInvoice, isSaving: isSaving, onFail: function (error) {
3017
3054
  onFail(error);
3018
3055
  setIsSaving(false);
3019
- }, onSuccess: onSuccess, setIsSaving: setIsSaving }))] }))] }));
3056
+ }, onSuccess: onSuccess, setIsSaving: setIsSaving, entityId: entityId }))] }))] }));
3020
3057
  }
3021
3058
  function Invoice(_a) {
3022
- var id = _a.id, invoiceQuoteViewComponent = _a.invoiceQuoteViewComponent, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick; _a.onInvoiceDownloadError; var onPaymentSuccess = _a.onPaymentSuccess;
3023
- return (jsxRuntime.jsx(reactHelmetAsync.HelmetProvider, { children: jsxRuntime.jsx(ActualInvoice, { id: id, invoiceQuoteViewComponent: invoiceQuoteViewComponent, backButtonName: backButtonName, onBackButtonClick: onBackButtonClick, onPaymentSuccess: onPaymentSuccess }) }));
3059
+ var id = _a.id, invoiceQuoteViewComponent = _a.invoiceQuoteViewComponent, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick; _a.onInvoiceDownloadError; var onPaymentSuccess = _a.onPaymentSuccess, entityId = _a.entityId;
3060
+ return (jsxRuntime.jsx(reactHelmetAsync.HelmetProvider, { children: jsxRuntime.jsx(ActualInvoice, { id: id, invoiceQuoteViewComponent: invoiceQuoteViewComponent, backButtonName: backButtonName, onBackButtonClick: onBackButtonClick, onPaymentSuccess: onPaymentSuccess, entityId: entityId }) }));
3024
3061
  }
3025
3062
 
3026
- var DOCUMENT_NAME;
3027
- (function (DOCUMENT_NAME) {
3028
- DOCUMENT_NAME["INVOICE"] = "invoice";
3029
- DOCUMENT_NAME["QUOTE"] = "quote";
3030
- })(DOCUMENT_NAME || (DOCUMENT_NAME = {}));
3063
+ 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 }"; };
3064
+ var getFormattedQuote = function (_a) {
3065
+ var id = _a.id, token = _a.token, apiHost = _a.apiHost;
3066
+ return __awaiter(void 0, void 0, void 0, function () {
3067
+ var response;
3068
+ return __generator(this, function (_b) {
3069
+ switch (_b.label) {
3070
+ case 0: return [4 /*yield*/, common.gqlRequest({
3071
+ query: MUTATION$7(),
3072
+ token: token,
3073
+ apiHost: apiHost,
3074
+ vars: { id: id },
3075
+ })];
3076
+ case 1:
3077
+ response = _b.sent();
3078
+ return [2 /*return*/, response === null || response === void 0 ? void 0 : response.formattedQuote];
3079
+ }
3080
+ });
3081
+ });
3082
+ };
3031
3083
 
3032
3084
  var filterSigningPlugins = function (plugins) {
3033
3085
  return plugins === null || plugins === void 0 ? void 0 : plugins.filter(function (plugin) {
@@ -3036,27 +3088,31 @@ var filterSigningPlugins = function (plugins) {
3036
3088
  ((_b = plugin.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === "valid";
3037
3089
  });
3038
3090
  };
3039
- var useSigningPlugins = function (token, subdomain) {
3040
- var plugins = common.usePlugins({ token: token, subdomain: subdomain });
3091
+ var useSigningPlugins = function (_a) {
3092
+ var entityId = _a.entityId, apiHost = _a.apiHost, token = _a.token;
3093
+ var plugins = usePlugins({ entityId: entityId, apiHost: apiHost, token: token });
3041
3094
  return filterSigningPlugins(plugins.data);
3042
3095
  };
3043
3096
 
3044
- var useSendAcceptQuote = function (token, subdomain, quoteId) {
3097
+ var useSendAcceptQuote = function (_a) {
3098
+ var entityId = _a.entityId, onErrorNavigate = _a.onErrorNavigate, quoteId = _a.quoteId, apiHost = _a.apiHost, token = _a.token;
3045
3099
  // Hooks
3046
- var graphQLMutation = common.GraphqlUtils.useGraphQLmutation(function () {
3100
+ var graphQLMutation = common.useGraphQLmutation(function () {
3047
3101
  console.log("navigate in useGraphQLmutation in useSendAcceptQuote is not yet implemented");
3048
- }, subdomain || "", function () {
3102
+ }, apiHost || "", function () {
3049
3103
  console.log("onError in useGraphQLmutation in useSendAcceptQuote is not yet implemented");
3050
3104
  });
3051
- // const handleAllErrorFormats = useAllErrorFormats();
3052
- var signingPlugins = useSigningPlugins(token, subdomain);
3053
- console.log("signingPlugins in useSendAcceptQuote: ", signingPlugins);
3105
+ var handleAllErrorFormats = common.useAllErrorFormats(onErrorNavigate ||
3106
+ (function (url) {
3107
+ console.log("navigate to", url, " not implemented");
3108
+ }));
3109
+ var signingPlugins = useSigningPlugins({ entityId: entityId, apiHost: apiHost, token: token });
3054
3110
  var queryClient = reactQuery.useQueryClient();
3055
3111
  // Local state
3056
- var _a = React.useState(false), acceptBoxVisible = _a[0], setAcceptBoxVisible = _a[1];
3057
- var _b = React.useState(false), isAccepting = _b[0], setIsAccepting = _b[1];
3112
+ var _b = React.useState(false), acceptBoxVisible = _b[0], setAcceptBoxVisible = _b[1];
3113
+ var _c = React.useState(false), isAccepting = _c[0], setIsAccepting = _c[1];
3058
3114
  // Pandadoc polling modal state
3059
- var _c = React.useState(false), pandadocPollingModalVisible = _c[0], setPandadocPollingModalVisible = _c[1];
3115
+ var _d = React.useState(false), pandadocPollingModalVisible = _d[0], setPandadocPollingModalVisible = _d[1];
3060
3116
  var redirectForSigning = function () {
3061
3117
  var mutation = "mutation quoteSigningUrlCreate($quoteId: ID) {\n quoteSigningUrlCreate(quoteId: $quoteId) {\n redirectUri\n pluginClientId\n pluginShortName\n errors\n }\n }";
3062
3118
  var variables = {
@@ -3069,10 +3125,7 @@ var useSendAcceptQuote = function (token, subdomain, quoteId) {
3069
3125
  console.log("rsp.data.quoteSigningUrlCreate.pluginShortName === 'pandadoc'", rsp.data.quoteSigningUrlCreate.pluginShortName === "pandadoc");
3070
3126
  console.log("rsp", rsp);
3071
3127
  if (rsp.data.quoteSigningUrlCreate.pluginShortName === "dropbox_sign") {
3072
- // openDropboxSignModal(
3073
- // rsp.data.quoteSigningUrlCreate.pluginClientId,
3074
- // rsp.data.quoteSigningUrlCreate.redirectUri
3075
- // );
3128
+ openDropboxSignModal(rsp.data.quoteSigningUrlCreate.pluginClientId, rsp.data.quoteSigningUrlCreate.redirectUri);
3076
3129
  console.log("dropbox sign is not implemented");
3077
3130
  }
3078
3131
  else if (rsp.data.quoteSigningUrlCreate.pluginShortName === "pandadoc") {
@@ -3087,31 +3140,39 @@ var useSendAcceptQuote = function (token, subdomain, quoteId) {
3087
3140
  });
3088
3141
  };
3089
3142
  // TODO: Fix hellosign-embedded window is undefined bug
3090
- // const openDropboxSignModal = async (clientId: string, url: string) => {
3091
- // if (typeof window === "undefined") {
3092
- // return;
3093
- // }
3094
- // const { default: HelloSign } = await import("hellosign-embedded");
3095
- // const client = new HelloSign({
3096
- // clientId: clientId,
3097
- // });
3098
- // client.on("sign", (data: any) => {
3099
- // // Change the UI to show accepted?
3100
- // });
3101
- // // Open the DropboxSign modal
3102
- // client.open(url, {
3103
- // clientId: clientId,
3104
- // skipDomainVerification: false, // Set true for development testing
3105
- // });
3106
- // };
3143
+ var openDropboxSignModal = function (clientId, url) { return __awaiter(void 0, void 0, void 0, function () {
3144
+ var HelloSign, client;
3145
+ return __generator(this, function (_a) {
3146
+ switch (_a.label) {
3147
+ case 0:
3148
+ if (typeof window === "undefined") {
3149
+ return [2 /*return*/];
3150
+ }
3151
+ return [4 /*yield*/, Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('hellosign-embedded')); })];
3152
+ case 1:
3153
+ HelloSign = (_a.sent()).default;
3154
+ client = new HelloSign({
3155
+ clientId: clientId,
3156
+ });
3157
+ client.on("sign", function (data) {
3158
+ // Change the UI to show accepted?
3159
+ });
3160
+ // Open the DropboxSign modal
3161
+ client.open(url, {
3162
+ clientId: clientId,
3163
+ skipDomainVerification: false, // Set true for development testing
3164
+ });
3165
+ return [2 /*return*/];
3166
+ }
3167
+ });
3168
+ }); };
3107
3169
  // TODO: update useing fetch
3108
3170
  var sendAccept = function (changedFormItems) {
3109
3171
  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 }";
3110
3172
  var variables = __assign(__assign({}, changedFormItems), { quoteId: quoteId });
3111
3173
  graphQLMutation(token, mutation, variables, function (rsp) {
3112
- // if (rsp.errors) handleAllErrorFormats(rsp.errors);
3113
3174
  if (rsp.errors)
3114
- console.log("rsp.errors", rsp.errors);
3175
+ handleAllErrorFormats(rsp.errors);
3115
3176
  else {
3116
3177
  setAcceptBoxVisible(false);
3117
3178
  queryClient.invalidateQueries({
@@ -3157,45 +3218,6 @@ var useSigningComplete = function (_a) {
3157
3218
  }, [data, eventParam, queryClient, token]);
3158
3219
  };
3159
3220
 
3160
- var ModalOverrideBrandStylings = styled__default["default"](antd.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"])), common.MARK_PRO);
3161
- var StyledModal$1 = function (props) {
3162
- return jsxRuntime.jsx(ModalOverrideBrandStylings, __assign({ closable: false }, props));
3163
- };
3164
- var templateObject_1$6;
3165
-
3166
- var useFocusFirstInput = function (_a) {
3167
- var firstInputRef = _a.firstInputRef, isVisible = _a.isVisible;
3168
- React.useEffect(function () {
3169
- var _a;
3170
- (_a = firstInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
3171
- }, [isVisible, firstInputRef]);
3172
- };
3173
-
3174
- var AcceptQuoteModal = function (_a) {
3175
- var acceptBoxVisible = _a.acceptBoxVisible, formattedQuote = _a.formattedQuote, sendAccept = _a.sendAccept, setAcceptBoxVisible = _a.setAcceptBoxVisible, setIsAccepting = _a.setIsAccepting;
3176
- // Refs
3177
- var firstInputRef = React.useRef(null);
3178
- // Hooks
3179
- var form = antd.Form.useForm()[0];
3180
- useFocusFirstInput({ firstInputRef: firstInputRef, isVisible: acceptBoxVisible });
3181
- // Derived state
3182
- var poNumberRequired = formattedQuote.poNumberRequired, taxNumberRequired = formattedQuote.taxNumberRequired, taxNumberLabel = formattedQuote.taxNumberLabel;
3183
- var createRules = function (required, title) {
3184
- return required ? [{ required: true, message: "".concat(title, " is required") }] : [];
3185
- };
3186
- return (jsxRuntime.jsx(StyledModal$1, __assign({ centered: true, okText: "Accept", onCancel: function () {
3187
- setAcceptBoxVisible(false);
3188
- setIsAccepting(false);
3189
- }, onOk: function () {
3190
- form
3191
- .validateFields()
3192
- .then(function (changedFields) {
3193
- sendAccept(changedFields);
3194
- })
3195
- .catch(function () { });
3196
- }, open: acceptBoxVisible, title: "Accept quote", width: 400 }, { children: jsxRuntime.jsxs(antd.Form, __assign({ className: "flex flex-col gap-2", form: form, layout: "vertical" }, { children: [jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Your name", name: "name", rules: createRules(true, "Your name") }, { children: jsxRuntime.jsx(antd.Input, { autoFocus: true, ref: firstInputRef }) })), jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Your job title", name: "title", rules: createRules(true, "Your job title") }, { children: jsxRuntime.jsx(antd.Input, {}) })), jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Purchase order number", name: "poNumber", rules: createRules(poNumberRequired, "Purchase order number") }, { children: jsxRuntime.jsx(antd.Input, {}) })), taxNumberRequired && (jsxRuntime.jsx(antd.Form.Item, __assign({ name: "taxNumber", label: taxNumberLabel, rules: createRules(taxNumberRequired, taxNumberLabel) }, { children: jsxRuntime.jsx(antd.Input, {}) })))] })) })));
3197
- };
3198
-
3199
3221
  var dayjs_min = {exports: {}};
3200
3222
 
3201
3223
  (function (module, exports) {
@@ -3210,13 +3232,16 @@ var useIsExpired = function (expiresAt) {
3210
3232
 
3211
3233
  var PandadocPollingModal = function (_a) {
3212
3234
  var isVisible = _a.isVisible, setVisible = _a.setVisible, id = _a.id;
3213
- var _b = React.useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain;
3214
- var graphQLMutation = common.GraphqlUtils.useGraphQLmutation(function () {
3235
+ var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, onErrorNavigate = _b.onErrorNavigate;
3236
+ var graphQLMutation = common.useGraphQLmutation(function () {
3215
3237
  console.log("graphQLMutation navigateOnTokenExpired not yet implemented");
3216
- }, subdomain || "", function () {
3238
+ }, apiHost || "", function () {
3217
3239
  console.log("graphQLMutation onError not yet implemented");
3218
3240
  });
3219
- var handleAllErrorFormats = common.NotificationUtils.useAllErrorFormats(function () { });
3241
+ var handleAllErrorFormats = common.useAllErrorFormats(onErrorNavigate ||
3242
+ (function (url) {
3243
+ console.log("navigate to", url, " not implemented");
3244
+ }));
3220
3245
  var _c = React.useState(0), numberOfPolls = _c[0], setNumberOfPolls = _c[1];
3221
3246
  var _d = React.useState(""), infoMessage = _d[0], setInfoMessage = _d[1];
3222
3247
  React.useEffect(function () {
@@ -3251,80 +3276,109 @@ var PandadocPollingModal = function (_a) {
3251
3276
  return (jsxRuntime.jsxs(antd.Modal, __assign({ title: "Uploading quote to Pandadoc", open: isVisible, closable: false, footer: null }, { children: [jsxRuntime.jsxs("div", __assign({ className: "py-4 text-center" }, { children: ["This may take a few seconds", ".".repeat(numberOfPolls)] })), jsxRuntime.jsx("div", __assign({ className: "text-center" }, { children: infoMessage }))] })));
3252
3277
  };
3253
3278
 
3254
- 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 }"; };
3255
- var getFormattedQuote = function (_a) {
3256
- var id = _a.id, token = _a.token, subdomain = _a.subdomain;
3257
- return __awaiter(void 0, void 0, void 0, function () {
3258
- var response;
3259
- return __generator(this, function (_b) {
3260
- switch (_b.label) {
3261
- case 0: return [4 /*yield*/, common.gqlRequest({
3262
- query: MUTATION$6(),
3263
- token: token,
3264
- subdomain: subdomain,
3265
- vars: { id: id },
3266
- })];
3267
- case 1:
3268
- response = _b.sent();
3269
- return [2 /*return*/, response === null || response === void 0 ? void 0 : response.formattedQuote];
3270
- }
3271
- });
3272
- });
3279
+ var ModalOverrideBrandStylings = styled__default["default"](antd.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"])), common.MARK_PRO);
3280
+ var StyledModal$1 = function (props) {
3281
+ return jsxRuntime.jsx(ModalOverrideBrandStylings, __assign({ closable: false }, props));
3273
3282
  };
3283
+ var templateObject_1$5;
3274
3284
 
3275
- var documentName = DOCUMENT_NAME.QUOTE;
3276
- function ActualQuote(_a) {
3277
- var _b, _c;
3278
- var id = _a.id;
3279
- var _d = React.useContext(BunnyContext), token = _d.token, subdomain = _d.subdomain;
3280
- var entityBranding = React.useContext(BrandContext);
3281
- var isMobile = common.useIsMobile();
3285
+ var useFocusFirstInput = function (_a) {
3286
+ var firstInputRef = _a.firstInputRef, isVisible = _a.isVisible;
3287
+ React.useEffect(function () {
3288
+ var _a;
3289
+ (_a = firstInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
3290
+ }, [isVisible, firstInputRef]);
3291
+ };
3292
+
3293
+ var AcceptQuoteModal = function (_a) {
3294
+ var acceptBoxVisible = _a.acceptBoxVisible, formattedQuote = _a.formattedQuote, sendAccept = _a.sendAccept, setAcceptBoxVisible = _a.setAcceptBoxVisible, setIsAccepting = _a.setIsAccepting;
3295
+ // Refs
3296
+ var firstInputRef = React.useRef(null);
3297
+ // Hooks
3298
+ var form = antd.Form.useForm()[0];
3299
+ useFocusFirstInput({ firstInputRef: firstInputRef, isVisible: acceptBoxVisible });
3300
+ // Derived state
3301
+ var poNumberRequired = formattedQuote.poNumberRequired, taxNumberRequired = formattedQuote.taxNumberRequired, taxNumberLabel = formattedQuote.taxNumberLabel;
3302
+ var createRules = function (required, title) {
3303
+ return required ? [{ required: true, message: "".concat(title, " is required") }] : [];
3304
+ };
3305
+ return (jsxRuntime.jsx(StyledModal$1, __assign({ centered: true, okText: "Accept", onCancel: function () {
3306
+ setAcceptBoxVisible(false);
3307
+ setIsAccepting(false);
3308
+ }, onOk: function () {
3309
+ form
3310
+ .validateFields()
3311
+ .then(function (changedFields) {
3312
+ sendAccept(changedFields);
3313
+ })
3314
+ .catch(function () { });
3315
+ }, open: acceptBoxVisible, title: "Accept quote", width: 400 }, { children: jsxRuntime.jsxs(antd.Form, __assign({ className: "flex flex-col gap-2", form: form, layout: "vertical" }, { children: [jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Your name", name: "name", rules: createRules(true, "Your name") }, { children: jsxRuntime.jsx(antd.Input, { autoFocus: true, ref: firstInputRef }) })), jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Your job title", name: "title", rules: createRules(true, "Your job title") }, { children: jsxRuntime.jsx(antd.Input, {}) })), jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Purchase order number", name: "poNumber", rules: createRules(poNumberRequired, "Purchase order number") }, { children: jsxRuntime.jsx(antd.Input, {}) })), taxNumberRequired && (jsxRuntime.jsx(antd.Form.Item, __assign({ name: "taxNumber", label: taxNumberLabel, rules: createRules(taxNumberRequired, taxNumberLabel) }, { children: jsxRuntime.jsx(antd.Input, {}) })))] })) })));
3316
+ };
3317
+
3318
+ var DOCUMENT_NAME;
3319
+ (function (DOCUMENT_NAME) {
3320
+ DOCUMENT_NAME["INVOICE"] = "invoice";
3321
+ DOCUMENT_NAME["QUOTE"] = "quote";
3322
+ })(DOCUMENT_NAME || (DOCUMENT_NAME = {}));
3323
+
3324
+ var documentName = DOCUMENT_NAME.QUOTE;
3325
+ function ActualQuote(_a) {
3326
+ var _b, _c;
3327
+ var id = _a.id, entityId = _a.entityId;
3328
+ var _d = React.useContext(BunnyContext), token = _d.token, apiHost = _d.apiHost, onErrorNavigate = _d.onErrorNavigate;
3329
+ var entityBranding = React.useContext(BrandContext);
3330
+ var isMobile = common.useIsMobile(window);
3282
3331
  // Queries
3283
3332
  var _e = reactQuery.useQuery({
3284
3333
  queryKey: common.QueryKeyFactory.default.createQuoteKey(token, id),
3285
- queryFn: function () { return getFormattedQuote({ token: token, subdomain: subdomain, id: id }); },
3334
+ queryFn: function () { return getFormattedQuote({ token: token, apiHost: apiHost, id: id }); },
3286
3335
  placeholderData: reactQuery.keepPreviousData,
3287
3336
  }), data = _e.data, isLoading = _e.isLoading;
3288
- reactQuery.useQuery({
3289
- queryKey: common.QueryKeyFactory.default.currentUserKey,
3290
- queryFn: function () { return getCurrentUserData({ token: token, subdomain: subdomain }); },
3291
- });
3292
3337
  var formattedQuote = data;
3293
3338
  // Hooks
3294
- var downloadFile = common.useDownloadFile(id);
3339
+ var downloadFile = useDownloadFile(id);
3295
3340
  var isExpired = useIsExpired(formattedQuote === null || formattedQuote === void 0 ? void 0 : formattedQuote.expiresAt);
3296
- 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;
3341
+ var _f = useSendAcceptQuote({
3342
+ entityId: entityId,
3343
+ token: token,
3344
+ onErrorNavigate: onErrorNavigate ||
3345
+ (function (url) {
3346
+ console.log("navigate to", url, " not implemented");
3347
+ }),
3348
+ apiHost: apiHost,
3349
+ quoteId: id,
3350
+ }), acceptBoxVisible = _f.acceptBoxVisible, isAccepting = _f.isAccepting, sendAccept = _f.sendAccept, setAcceptBoxVisible = _f.setAcceptBoxVisible, setIsAccepting = _f.setIsAccepting, startAcceptance = _f.startAcceptance, pandadocPollingModalVisible = _f.pandadocPollingModalVisible, setPandadocPollingModalVisible = _f.setPandadocPollingModalVisible;
3297
3351
  useSigningComplete({ data: formattedQuote, token: token });
3298
3352
  if (!formattedQuote || isLoading) {
3299
3353
  return jsxRuntime.jsx(jsxRuntime.Fragment, {});
3300
3354
  }
3301
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(reactHelmetAsync.Helmet, { children: [jsxRuntime.jsxs("title", { children: [formattedQuote.vendorName, " ", documentName] }), jsxRuntime.jsx("meta", { name: "description", content: common.QuoteInvoiceUtils.quoteMetaDescription(formattedQuote.vendorName) }), jsxRuntime.jsx("meta", { property: "og:type", content: "website" }), jsxRuntime.jsx("meta", { property: "og:title", content: common.QuoteInvoiceUtils.quoteMetaTitle({
3355
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(reactHelmetAsync.Helmet, { children: [jsxRuntime.jsxs("title", { children: [formattedQuote.vendorName, " ", documentName] }), jsxRuntime.jsx("meta", { name: "description", content: quoteMetaDescription(formattedQuote.vendorName) }), jsxRuntime.jsx("meta", { property: "og:type", content: "website" }), jsxRuntime.jsx("meta", { property: "og:title", content: quoteMetaTitle({
3302
3356
  vendorName: formattedQuote.vendorName,
3303
3357
  documentName: documentName,
3304
- }) }), jsxRuntime.jsx("meta", { property: "og:description", content: common.QuoteInvoiceUtils.quoteMetaDescription(formattedQuote.vendorName) })] }), jsxRuntime.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: {
3358
+ }) }), jsxRuntime.jsx("meta", { property: "og:description", content: quoteMetaDescription(formattedQuote.vendorName) })] }), jsxRuntime.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: {
3305
3359
  color: entityBranding.secondaryColor,
3306
3360
  } }, { children: [formattedQuote.state === "ACCEPTED" ||
3307
3361
  formattedQuote.state === "APPLIED" ? (jsxRuntime.jsxs("div", { children: [formattedQuote.state === "ACCEPTED" &&
3308
3362
  formattedQuote.acceptedAt &&
3309
- "Quote was accepted by ".concat(formattedQuote.acceptedByName, " on ").concat(common.Misc.formatDate(formattedQuote.acceptedAt)), formattedQuote.state === "APPLIED" &&
3363
+ "Quote was accepted by ".concat(formattedQuote.acceptedByName, " on ").concat(common.formatDate(formattedQuote.acceptedAt)), formattedQuote.state === "APPLIED" &&
3310
3364
  formattedQuote.acceptedAt &&
3311
- "Quote is now applied. Accepted by ".concat(formattedQuote.acceptedByName, " on ").concat(common.Misc.formatDate(formattedQuote.acceptedAt))] })) : null, jsxRuntime.jsxs("div", __assign({ className: isMobile
3365
+ "Quote is now applied. Accepted by ".concat(formattedQuote.acceptedByName, " on ").concat(common.formatDate(formattedQuote.acceptedAt))] })) : null, jsxRuntime.jsxs("div", __assign({ className: isMobile
3312
3366
  ? "flex w-full justify-between gap-2"
3313
- : "flex items-center justify-end gap-2" }, { children: [!isMobile ? (jsxRuntime.jsx(antd.Button, __assign({ icon: jsxRuntime.jsx(DownloadOutlined$1, {}), onClick: function () { return downloadFile(subdomain + "/api/pdf/quote", token); } }, { children: "Download" }))) : null, formattedQuote.state !== "ACCEPTED" &&
3314
- formattedQuote.state !== "APPLIED" ? (jsxRuntime.jsx(antd.Button, __assign({ disabled: isExpired || isAccepting, onClick: function () { return startAcceptance(); }, type: "primary" }, { children: isExpired ? "Quote is expired" : "Accept quote" }))) : null] }))] })), jsxRuntime.jsx("div", __assign({ className: "flex ".concat(isMobile ? "flex-col w-full overflow-hidden" : "shadow-padding-xb") }, { children: jsxRuntime.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 ? (jsxRuntime.jsx("div", __assign({ className: "flex flex-col items-end" }, { children: formattedQuote.object.documents.map(function (doc, index) {
3367
+ : "flex items-center justify-end gap-2" }, { children: [!isMobile ? (jsxRuntime.jsx(antd.Button, __assign({ icon: jsxRuntime.jsx(DownloadOutlined$1, {}), onClick: function () { return downloadFile(apiHost + "/api/pdf/quote", token); } }, { children: "Download" }))) : null, formattedQuote.state !== "ACCEPTED" &&
3368
+ formattedQuote.state !== "APPLIED" ? (jsxRuntime.jsx(antd.Button, __assign({ disabled: isExpired || isAccepting, onClick: function () { return startAcceptance(); }, type: "primary" }, { children: isExpired ? "Quote is expired" : "Accept quote" }))) : null] }))] })), jsxRuntime.jsx("div", __assign({ className: "flex ".concat(isMobile ? "flex-col w-full overflow-hidden" : "shadow-padding-xb") }, { children: jsxRuntime.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 ? (jsxRuntime.jsx("div", __assign({ className: "flex flex-col items-end" }, { children: formattedQuote.object.documents.map(function (doc, index) {
3315
3369
  return (jsxRuntime.jsx(antd.Button, __assign({ download: doc.filename, href: doc.url, type: "link" }, { children: doc.filename }), index));
3316
3370
  }) }))) : null })) })), jsxRuntime.jsx(AcceptQuoteModal, { acceptBoxVisible: acceptBoxVisible, formattedQuote: formattedQuote, setAcceptBoxVisible: setAcceptBoxVisible, setIsAccepting: setIsAccepting, sendAccept: sendAccept }), jsxRuntime.jsx(PandadocPollingModal, { isVisible: pandadocPollingModalVisible, setVisible: setPandadocPollingModalVisible, id: id })] }));
3317
3371
  }
3318
- styled__default["default"].div(templateObject_1$5 || (templateObject_1$5 = __makeTemplateObject(["\n span {\n width: 100%;\n }\n"], ["\n span {\n width: 100%;\n }\n"])));
3372
+ styled__default["default"].div(templateObject_1$4 || (templateObject_1$4 = __makeTemplateObject(["\n span {\n width: 100%;\n }\n"], ["\n span {\n width: 100%;\n }\n"])));
3319
3373
  function Quote(_a) {
3320
- var id = _a.id;
3321
- return (jsxRuntime.jsx(reactHelmetAsync.HelmetProvider, { children: jsxRuntime.jsx(ActualQuote, { id: id }) }));
3374
+ var entityId = _a.entityId, id = _a.id;
3375
+ return (jsxRuntime.jsx(reactHelmetAsync.HelmetProvider, { children: jsxRuntime.jsx(ActualQuote, { entityId: entityId, id: id }) }));
3322
3376
  }
3323
- var templateObject_1$5;
3377
+ var templateObject_1$4;
3324
3378
 
3325
3379
  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 }"); };
3326
3380
  var getQuotes = function (_a) {
3327
- var token = _a.token, subdomain = _a.subdomain, filter = _a.filter;
3381
+ var token = _a.token, apiHost = _a.apiHost, filter = _a.filter;
3328
3382
  return __awaiter(void 0, void 0, void 0, function () {
3329
3383
  var response;
3330
3384
  return __generator(this, function (_b) {
@@ -3333,7 +3387,7 @@ var getQuotes = function (_a) {
3333
3387
  query: QUOTES_QUERY(filter),
3334
3388
  token: token,
3335
3389
  vars: {},
3336
- subdomain: subdomain,
3390
+ apiHost: apiHost,
3337
3391
  })];
3338
3392
  case 1:
3339
3393
  response = _b.sent();
@@ -3344,12 +3398,12 @@ var getQuotes = function (_a) {
3344
3398
  };
3345
3399
 
3346
3400
  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}"); };
3347
- var getTransactions = function (filter, token, subdomain, kindsToShow) { return __awaiter(void 0, void 0, void 0, function () {
3401
+ var getTransactions = function (filter, token, apiHost, kindsToShow) { return __awaiter(void 0, void 0, void 0, function () {
3348
3402
  var response, _a, data, errors, transactions;
3349
3403
  var _b, _c;
3350
3404
  return __generator(this, function (_d) {
3351
3405
  switch (_d.label) {
3352
- case 0: return [4 /*yield*/, fetch(subdomain + "/graphql", {
3406
+ case 0: return [4 /*yield*/, fetch(apiHost + "/graphql", {
3353
3407
  method: "POST",
3354
3408
  headers: {
3355
3409
  "Content-type": "application/json; charset=utf-8",
@@ -3373,25 +3427,10 @@ var getTransactions = function (filter, token, subdomain, kindsToShow) { return
3373
3427
  });
3374
3428
  }); };
3375
3429
 
3376
- var pageContentRefState = recoil.atom({
3377
- key: "pageContentRefState",
3378
- default: undefined,
3379
- });
3380
-
3381
- var PageContent = function (_a) {
3382
- var children = _a.children, className = _a.className, style = _a.style;
3383
- var pageContentRef = React.useRef(null);
3384
- var setPageContentRef = recoil.useSetRecoilState(pageContentRefState);
3385
- React.useEffect(function () {
3386
- setPageContentRef(pageContentRef === null || pageContentRef === void 0 ? void 0 : pageContentRef.current);
3387
- }, [pageContentRef, setPageContentRef]);
3388
- return (jsxRuntime.jsx("div", __assign({ className: className, ref: pageContentRef, style: style }, { children: children })));
3389
- };
3390
-
3391
3430
  var Text$b = antd.Typography.Text;
3392
3431
  var PageHeaderWithActions = function (_a) {
3393
3432
  var children = _a.children, title = _a.title;
3394
- var isMobile = common.useIsMobile();
3433
+ var isMobile = common.useIsMobile(window);
3395
3434
  return (jsxRuntime.jsxs("div", __assign({ className: "flex pb-4 shadow-padding-x ".concat(isMobile ? "flex-col gap-2" : "items-center justify-between h-8") }, { children: [jsxRuntime.jsx(PageSubTitle, { title: title }), children] })));
3396
3435
  };
3397
3436
  var PageSubTitle = function (_a) {
@@ -3431,31 +3470,12 @@ var getColor = function (state) {
3431
3470
  }
3432
3471
  };
3433
3472
 
3434
- var TransactionGridCell = styled__default["default"].div.withConfig({
3435
- shouldForwardProp: function (prop) {
3436
- return !["gridColumn", "padding", "right"].includes(prop);
3437
- },
3438
- })(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"); }, common.SLATE_600);
3439
- var templateObject_1$4;
3473
+ var TransactionsListContext = React.createContext({});
3440
3474
 
3441
3475
  var Text$a = antd.Typography.Text;
3442
3476
  var TransactionDate = function (_a) {
3443
3477
  var date = _a.date;
3444
- return jsxRuntime.jsx(Text$a, __assign({ className: "text-sm" }, { children: common.Misc.formatDate(date) }));
3445
- };
3446
-
3447
- var isInvoice = function (transaction) {
3448
- return transaction.kind === "INVOICE";
3449
- };
3450
- var isQuote = function (transaction) {
3451
- return transaction.kind === "QUOTE";
3452
- };
3453
- var TransactionRowTitle = function (_a) {
3454
- var transaction = _a.transaction;
3455
- if (!isInvoice(transaction) && !isQuote(transaction)) {
3456
- return jsxRuntime.jsx(jsxRuntime.Fragment, {});
3457
- }
3458
- return (jsxRuntime.jsx("span", __assign({ className: "text-slate-400", style: { fontSize: "11px" } }, { children: transaction.transactionable.number })));
3478
+ return jsxRuntime.jsx(Text$a, __assign({ className: "text-sm" }, { children: common.formatDate(date) }));
3459
3479
  };
3460
3480
 
3461
3481
  // TODO: delete
@@ -3464,18 +3484,16 @@ var ArrowDownToLine = function (_a) {
3464
3484
  return (jsxRuntime.jsxs("svg", __assign({ className: className, fill: "none", height: "16", viewBox: "0 0 16 16", width: "16", xmlns: "http://www.w3.org/2000/svg" }, { children: [jsxRuntime.jsx("path", { d: "M8 11.3333V2", stroke: color, strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), jsxRuntime.jsx("path", { d: "M4 7.33301L8 11.333L12 7.33301", stroke: color, strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), jsxRuntime.jsx("path", { d: "M12.6654 14H3.33203", stroke: color, strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })] })));
3465
3485
  };
3466
3486
 
3467
- var TransactionsListContext = React.createContext({});
3468
-
3469
3487
  var TransactionDownload = function (_a) {
3470
- var transaction = _a.transaction, token = _a.token, subdomain = _a.subdomain;
3488
+ var transaction = _a.transaction, token = _a.token, apiHost = _a.apiHost;
3471
3489
  var darkMode = React.useContext(BunnyContext).darkMode;
3472
3490
  var downloadTransactionLink = React.useContext(TransactionsListContext).downloadTransactionLink;
3473
- var downloadFile = common.useDownloadFile();
3474
- var isMobile = common.useIsMobile();
3491
+ var downloadFile = useDownloadFile();
3492
+ var isMobile = common.useIsMobile(window);
3475
3493
  var isClickable = transaction.kind === "INVOICE" || downloadTransactionLink !== undefined;
3476
3494
  var downloadLink = downloadTransactionLink
3477
3495
  ? downloadTransactionLink(transaction.transactionableId)
3478
- : "".concat(subdomain, "/api/pdf/invoice/").concat(transaction.transactionableId);
3496
+ : "".concat(apiHost, "/api/pdf/invoice/").concat(transaction.transactionableId);
3479
3497
  if (!isClickable)
3480
3498
  return null;
3481
3499
  return (jsxRuntime.jsx("div", __assign({ onClick: function (e) {
@@ -3484,76 +3502,38 @@ var TransactionDownload = function (_a) {
3484
3502
  } }, { children: jsxRuntime.jsx(ArrowDownToLine, { className: "".concat(isMobile ? "" : "show-on-hover"), color: darkMode ? common.WHITE : common.SLATE_600 }) })));
3485
3503
  };
3486
3504
 
3505
+ var TransactionGridCell = styled__default["default"].div.withConfig({
3506
+ shouldForwardProp: function (prop) {
3507
+ return !["gridColumn", "padding", "right"].includes(prop);
3508
+ },
3509
+ })(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"); }, common.SLATE_600);
3510
+ var templateObject_1$3;
3511
+
3487
3512
  var Text$9 = antd.Typography.Text;
3488
3513
  var TransactionsEmptyState = function () {
3489
3514
  var noTransactionsMessage = React.useContext(TransactionsListContext).noTransactionsMessage;
3490
3515
  return (jsxRuntime.jsx(Text$9, __assign({ className: "flex justify-center p-4 text-base" }, { children: noTransactionsMessage || "There are no transactions" })));
3491
3516
  };
3492
3517
 
3493
- function capitalizeFirstLetter(string) {
3494
- return string.charAt(0).toUpperCase() + string.slice(1);
3495
- }
3496
- var WARREN_STATE_LS_KEY = "warrenState";
3497
- var CURRENT_WARREN_ID_LS_KEY = "currentWarrenId";
3498
- var getIsCapacitorApp = function () {
3499
- var isAndroid = window.location.origin === "http://localhost";
3500
- var isIOS = window.location.protocol === "capacitor:";
3501
- return isAndroid || isIOS;
3502
- };
3503
- var getLocalStorageSubdomain = function () {
3504
- var warrenState = JSON.parse(window.localStorage.getItem(WARREN_STATE_LS_KEY) || "{}");
3505
- var subdomain = warrenState[CURRENT_WARREN_ID_LS_KEY];
3506
- if (!subdomain) {
3507
- console.warn("ERROR_MESSAGE_NO_SUBDOMAIN_DEFINED");
3508
- //throw new Error(ERROR_MESSAGE_NO_SUBDOMAIN_DEFINED);
3509
- }
3510
- return subdomain;
3511
- };
3512
- var getApiHost = function (subdomain) {
3513
- var isLocalHost = window.location.href.indexOf(".internal") > 0;
3514
- var sub = subdomain || getLocalStorageSubdomain();
3515
- if (getIsCapacitorApp()) {
3516
- return isLocalHost || process.env.REACT_APP_IS_INTERNAL === "true"
3517
- ? "https://".concat(sub, ".bunny.internal")
3518
- : "https://".concat(sub, ".").concat(process.env.REACT_APP_ROOT_DOMAIN);
3519
- }
3520
- return "";
3518
+ var isInvoice = function (transaction) {
3519
+ return transaction.kind === "INVOICE";
3521
3520
  };
3522
- var getGraphQLBase = function () {
3523
- if (getIsCapacitorApp()) {
3524
- return "".concat(getApiHost(), "/graphql");
3525
- }
3526
- return "/graphql";
3521
+ var isQuote = function (transaction) {
3522
+ return transaction.kind === "QUOTE";
3527
3523
  };
3528
- var createRequestHeaders = function (token) {
3529
- var bearerToken = "Bearer ".concat(token);
3530
- var headers = {
3531
- "Content-type": "application/json; charset=utf-8",
3532
- };
3533
- headers["Authorization"] = bearerToken;
3534
- return headers;
3524
+ var TransactionRowTitle = function (_a) {
3525
+ var transaction = _a.transaction;
3526
+ if (!isInvoice(transaction) && !isQuote(transaction)) {
3527
+ return jsxRuntime.jsx(jsxRuntime.Fragment, {});
3528
+ }
3529
+ return (jsxRuntime.jsx("span", __assign({ className: "text-slate-400", style: { fontSize: "11px" } }, { children: transaction.transactionable.number })));
3535
3530
  };
3536
- var useGraphQLRequest = function () { return function (query, token, variables) { return __awaiter(void 0, void 0, void 0, function () {
3537
- var error_1;
3538
- return __generator(this, function (_a) {
3539
- switch (_a.label) {
3540
- case 0:
3541
- _a.trys.push([0, 2, , 3]);
3542
- return [4 /*yield*/, request__default["default"](getGraphQLBase(), query, variables, createRequestHeaders(token))];
3543
- case 1: return [2 /*return*/, _a.sent()];
3544
- case 2:
3545
- error_1 = _a.sent();
3546
- throw error_1;
3547
- case 3: return [2 /*return*/];
3548
- }
3549
- });
3550
- }); }; };
3551
3531
 
3552
3532
  var Text$8 = antd.Typography.Text;
3553
3533
  var TransactionsListDesktop = function (_a) {
3554
3534
  var transactions = _a.transactions, onTransactionClick = _a.onTransactionClick;
3555
3535
  var columns = React.useContext(TransactionsListContext).columns;
3556
- var _b = React.useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain, darkMode = _b.darkMode;
3536
+ var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, darkMode = _b.darkMode;
3557
3537
  var showAmount = columns.includes("amount");
3558
3538
  var showDateAndTitle = columns.includes("date-and-title");
3559
3539
  var showDownload = columns.includes("download");
@@ -3569,7 +3549,7 @@ var TransactionsListDesktop = function (_a) {
3569
3549
  backgroundColor: index % 2 === 0
3570
3550
  ? "var(--row-background".concat(darkMode ? "-dark" : "", ")")
3571
3551
  : "var(--row-background-alternate".concat(darkMode ? "-dark" : "", ")"),
3572
- } }, { children: [showDateAndTitle && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(TransactionGridCell, __assign({ right: false }, { children: jsxRuntime.jsx(TransactionDate, { date: transaction.createdAt }) })), jsxRuntime.jsxs(TransactionGridCell, __assign({ right: false, className: "flex items-center gap-2" }, { children: [jsxRuntime.jsx(Text$8, { children: capitalizeFirstLetter(transaction.kind.toLowerCase()) }), jsxRuntime.jsx(TransactionRowTitle, { transaction: transaction })] }))] })), showDownload && (jsxRuntime.jsx(TransactionGridCell, { children: jsxRuntime.jsx(TransactionDownload, { transaction: transaction, token: token, subdomain: subdomain }) })), showState && (jsxRuntime.jsx(TransactionGridCell, __assign({ right: true }, { children: jsxRuntime.jsx(StateTag, { state: transaction.state }) }))), showAmount && (jsxRuntime.jsx(TransactionGridCell, __assign({ right: true }, { children: jsxRuntime.jsx(Text$8, { children: common.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));
3552
+ } }, { children: [showDateAndTitle && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(TransactionGridCell, __assign({ right: false }, { children: jsxRuntime.jsx(TransactionDate, { date: transaction.createdAt }) })), jsxRuntime.jsxs(TransactionGridCell, __assign({ right: false, className: "flex items-center gap-2" }, { children: [jsxRuntime.jsx(Text$8, { children: lodash.capitalize(transaction.kind.toLowerCase()) }), jsxRuntime.jsx(TransactionRowTitle, { transaction: transaction })] }))] })), showDownload && (jsxRuntime.jsx(TransactionGridCell, { children: jsxRuntime.jsx(TransactionDownload, { transaction: transaction, token: token, apiHost: apiHost }) })), showState && (jsxRuntime.jsx(TransactionGridCell, __assign({ right: true }, { children: jsxRuntime.jsx(StateTag, { state: transaction.state }) }))), showAmount && (jsxRuntime.jsx(TransactionGridCell, __assign({ right: true }, { children: jsxRuntime.jsx(Text$8, { children: common.formatCurrency(((_a = transaction === null || transaction === void 0 ? void 0 : transaction.transactionable) === null || _a === void 0 ? void 0 : _a.amount) || transaction.amount, transaction.currencyId) }) })))] }), index));
3573
3553
  });
3574
3554
  };
3575
3555
 
@@ -3577,7 +3557,7 @@ var Text$7 = antd.Typography.Text;
3577
3557
  var TransactionsListMobile = function (_a) {
3578
3558
  var transactions = _a.transactions, onTransactionClick = _a.onTransactionClick;
3579
3559
  var columns = React.useContext(TransactionsListContext).columns;
3580
- var _b = React.useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain, darkMode = _b.darkMode;
3560
+ var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, darkMode = _b.darkMode;
3581
3561
  var showAmount = columns.includes("amount");
3582
3562
  var showDateAndTitle = columns.includes("date-and-title");
3583
3563
  var showDownload = columns.includes("download");
@@ -3592,19 +3572,17 @@ var TransactionsListMobile = function (_a) {
3592
3572
  backgroundColor: index % 2 === 0
3593
3573
  ? "var(--row-background".concat(darkMode ? "-dark" : "", ")")
3594
3574
  : "var(--row-background-alternate".concat(darkMode ? "-dark" : "", ")"),
3595
- } }, { children: [jsxRuntime.jsx(TransactionGridCell, { children: jsxRuntime.jsxs("div", __assign({ className: "flex flex-col gap-2" }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex items-center gap-2" }, { children: [showDateAndTitle && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Text$7, { children: capitalizeFirstLetter(transaction.kind.toLowerCase()) }), jsxRuntime.jsx(TransactionRowTitle, { transaction: transaction })] })), showState && jsxRuntime.jsx(StateTag, { state: transaction.state })] })), jsxRuntime.jsxs("div", __assign({ className: "flex items-center gap-2" }, { children: [showDateAndTitle && (jsxRuntime.jsx(TransactionDate, { date: transaction.createdAt })), showAmount && showDateAndTitle && jsxRuntime.jsx(Text$7, { children: "\u00B7" }), showAmount && (jsxRuntime.jsx(Text$7, { children: common.Misc.formatCurrency(transaction.transactionable.amount || transaction.amount, transaction.currencyId) }))] }))] })) }), showDownload && (jsxRuntime.jsx(TransactionGridCell, __assign({ right: true }, { children: jsxRuntime.jsx(TransactionDownload, { transaction: transaction, token: token, subdomain: subdomain }) })))] }), index));
3575
+ } }, { children: [jsxRuntime.jsx(TransactionGridCell, { children: jsxRuntime.jsxs("div", __assign({ className: "flex flex-col gap-2" }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex items-center gap-2" }, { children: [showDateAndTitle && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Text$7, { children: lodash.capitalize(transaction.kind.toLowerCase()) }), jsxRuntime.jsx(TransactionRowTitle, { transaction: transaction })] })), showState && jsxRuntime.jsx(StateTag, { state: transaction.state })] })), jsxRuntime.jsxs("div", __assign({ className: "flex items-center gap-2" }, { children: [showDateAndTitle && (jsxRuntime.jsx(TransactionDate, { date: transaction.createdAt })), showAmount && showDateAndTitle && jsxRuntime.jsx(Text$7, { children: "\u00B7" }), showAmount && (jsxRuntime.jsx(Text$7, { children: common.formatCurrency(transaction.transactionable.amount || transaction.amount, transaction.currencyId) }))] }))] })) }), showDownload && (jsxRuntime.jsx(TransactionGridCell, __assign({ right: true }, { children: jsxRuntime.jsx(TransactionDownload, { transaction: transaction, token: token, apiHost: apiHost }) })))] }), index));
3596
3576
  });
3597
3577
  };
3598
3578
 
3599
- // Create a client
3600
- var queryClient = new reactQuery.QueryClient();
3601
3579
  function Transactions(_a) {
3602
3580
  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 ? [
3603
3581
  common.TransactionKind.INVOICE,
3604
3582
  common.TransactionKind.PAYMENT,
3605
3583
  common.TransactionKind.REFUND,
3606
3584
  common.TransactionKind.WRITE_OFF,
3607
- ] : _h, style = _a.style, filter = _a.filter, noTransactionsMessage = _a.noTransactionsMessage;
3585
+ ] : _h, style = _a.style, filter = _a.filter, noTransactionsMessage = _a.noTransactionsMessage, entityId = _a.entityId;
3608
3586
  var contextValues = {
3609
3587
  showSearchBar: showSearchBar,
3610
3588
  showTitle: showTitle,
@@ -3620,12 +3598,13 @@ function Transactions(_a) {
3620
3598
  style: style,
3621
3599
  filter: filter,
3622
3600
  noTransactionsMessage: noTransactionsMessage,
3601
+ entityId: entityId,
3623
3602
  };
3624
- return (jsxRuntime.jsx(reactQuery.QueryClientProvider, __assign({ client: queryClient }, { children: jsxRuntime.jsx(TransactionsListContext.Provider, __assign({ value: contextValues }, { children: jsxRuntime.jsx(TransactionsWrapper, {}) })) })));
3603
+ return (jsxRuntime.jsx(TransactionsListContext.Provider, __assign({ value: contextValues }, { children: jsxRuntime.jsx(TransactionsWrapper, {}) })));
3625
3604
  }
3626
3605
  function TransactionsWrapper() {
3627
3606
  var _a = React.useContext(TransactionsListContext), kindsToShow = _a.kindsToShow, filterFromContext = _a.filter;
3628
- var _b = React.useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain;
3607
+ var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
3629
3608
  // Local state
3630
3609
  var _c = React.useState(""), search = _c[0], setSearch = _c[1];
3631
3610
  var filter = filterFromContext ||
@@ -3633,21 +3612,21 @@ function TransactionsWrapper() {
3633
3612
  // Queries
3634
3613
  var data = reactQuery.useQuery({
3635
3614
  queryKey: ["transactions", token, filter],
3636
- queryFn: function () { return getTransactions(filter, token, subdomain, kindsToShow); },
3615
+ queryFn: function () { return getTransactions(filter, token, apiHost, kindsToShow); },
3637
3616
  placeholderData: reactQuery.keepPreviousData,
3638
3617
  }).data;
3639
3618
  return (jsxRuntime.jsx(TransactionsDisplay, { transactions: data, onSearchValueChanged: setSearch, search: search }));
3640
3619
  }
3641
3620
  function TransactionsDisplay(_a) {
3642
3621
  var transactions = _a.transactions, onSearchValueChanged = _a.onSearchValueChanged, search = _a.search, title = _a.title;
3643
- var _b = React.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;
3622
+ var _b = React.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;
3644
3623
  var columns = React.useContext(TransactionsListContext).columns;
3645
3624
  var darkMode = React.useContext(BunnyContext).darkMode;
3646
3625
  // Local state
3647
3626
  var _c = React.useState(null), selectedTransaction = _c[0], setSelectedTransaction = _c[1];
3648
3627
  var _d = React.useState(false), drawerOpen = _d[0], setDrawerOpen = _d[1];
3649
3628
  // Hooks
3650
- var isMobile = common.useIsMobile();
3629
+ var isMobile = common.useIsMobile(window);
3651
3630
  function handleTransactionClick(transaction) {
3652
3631
  if (onTransactionClick) {
3653
3632
  onTransactionClick(transaction);
@@ -3701,7 +3680,7 @@ function TransactionsDisplay(_a) {
3701
3680
  onSearchValueChanged(e.target.value);
3702
3681
  }, prefix: jsxRuntime.jsx(SearchOutlined$1, {}), placeholder: "Search by id #", style: {
3703
3682
  minWidth: "300px",
3704
- }, value: search }) })) })), jsxRuntime.jsx(PageContent, __assign({ className: "flex w-full shadow-padding-xb ".concat(isMobile ? "overflow-hidden" : "", " ").concat(className) }, { children: jsxRuntime.jsx("div", __assign({ className: "grid w-full rounded-md overflow-auto ".concat("shadow-".concat(shadow)), style: {
3683
+ }, value: search }) })) })), jsxRuntime.jsx("div", __assign({ className: "flex w-full shadow-padding-xb ".concat(isMobile ? "overflow-hidden" : "", " ").concat(className) }, { children: jsxRuntime.jsx("div", __assign({ className: "grid w-full rounded-md overflow-auto ".concat("shadow-".concat(shadow)), style: {
3705
3684
  gridTemplateColumns: gridTemplateColumns(),
3706
3685
  backgroundColor: "var(--row-background".concat(darkMode ? "-dark" : "", ")"),
3707
3686
  } }, { children: isMobile ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: TransactionsListMobile({
@@ -3710,12 +3689,12 @@ function TransactionsDisplay(_a) {
3710
3689
  }) })) : (jsxRuntime.jsx(jsxRuntime.Fragment, { children: TransactionsListDesktop({
3711
3690
  transactions: transactions,
3712
3691
  onTransactionClick: handleTransactionClick,
3713
- }) })) })) })), useModal ? (jsxRuntime.jsx(antd.Modal, __assign({ title: "Basic Modal", open: drawerOpen, onOk: function () { return setDrawerOpen(false); }, onCancel: function () { return setDrawerOpen(false); }, width: 900, footer: null }, { children: jsxRuntime.jsx(Invoice, { id: (selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.transactionableId) || "" }) }))) : (jsxRuntime.jsx(antd.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" ? (jsxRuntime.jsx(Invoice, { id: selectedTransaction.transactionableId })) : (jsxRuntime.jsxs(antd.Card, __assign({ className: "shadow-md" }, { children: [jsxRuntime.jsx(antd.Typography.Title, __assign({ level: 2, className: "mb-4" }, { children: "Transaction Details" })), jsxRuntime.jsxs(antd.Typography.Paragraph, { children: [jsxRuntime.jsx("strong", { children: "Amount:" }), " ", jsxRuntime.jsx(antd.Typography.Text, { children: common.Misc.formatCurrency((selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.amount) || 0, (selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.currencyId) || "USD") })] }), jsxRuntime.jsxs(antd.Typography.Paragraph, { children: [jsxRuntime.jsx("strong", { children: "Description:" }), " ", jsxRuntime.jsx(antd.Typography.Text, { children: selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.description })] }), jsxRuntime.jsxs(antd.Typography.Paragraph, { children: [jsxRuntime.jsx("strong", { children: "Kind:" }), " ", jsxRuntime.jsx(antd.Typography.Text, { children: selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.kind })] }), jsxRuntime.jsxs(antd.Typography.Paragraph, { children: [jsxRuntime.jsx("strong", { children: "State:" }), " ", jsxRuntime.jsx(antd.Typography.Text, { children: selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.state })] })] }))) })))] })));
3692
+ }) })) })) })), useModal ? (jsxRuntime.jsx(antd.Modal, __assign({ title: "Basic Modal", open: drawerOpen, onOk: function () { return setDrawerOpen(false); }, onCancel: function () { return setDrawerOpen(false); }, width: 900, footer: null }, { children: jsxRuntime.jsx(Invoice, { id: (selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.transactionableId) || "", entityId: entityId }) }))) : (jsxRuntime.jsx(antd.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" ? (jsxRuntime.jsx(Invoice, { id: selectedTransaction.transactionableId, entityId: entityId })) : (jsxRuntime.jsxs(antd.Card, __assign({ className: "shadow-md" }, { children: [jsxRuntime.jsx(antd.Typography.Title, __assign({ level: 2, className: "mb-4" }, { children: "Transaction Details" })), jsxRuntime.jsxs(antd.Typography.Paragraph, { children: [jsxRuntime.jsx("strong", { children: "Amount:" }), " ", jsxRuntime.jsx(antd.Typography.Text, { children: common.formatCurrency((selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.amount) || 0, (selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.currencyId) || "USD") })] }), jsxRuntime.jsxs(antd.Typography.Paragraph, { children: [jsxRuntime.jsx("strong", { children: "Description:" }), " ", jsxRuntime.jsx(antd.Typography.Text, { children: selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.description })] }), jsxRuntime.jsxs(antd.Typography.Paragraph, { children: [jsxRuntime.jsx("strong", { children: "Kind:" }), " ", jsxRuntime.jsx(antd.Typography.Text, { children: selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.kind })] }), jsxRuntime.jsxs(antd.Typography.Paragraph, { children: [jsxRuntime.jsx("strong", { children: "State:" }), " ", jsxRuntime.jsx(antd.Typography.Text, { children: selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.state })] })] }))) })))] })));
3714
3693
  }
3715
3694
 
3716
3695
  function Quotes(_a) {
3717
- 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;
3718
- var subdomain = React.useContext(BunnyContext).subdomain;
3696
+ 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;
3697
+ var apiHost = React.useContext(BunnyContext).apiHost;
3719
3698
  var _j = React.useState(null), component = _j[0], setComponent = _j[1];
3720
3699
  var contextValues = {
3721
3700
  columns: columns,
@@ -3732,20 +3711,21 @@ function Quotes(_a) {
3732
3711
  style: style,
3733
3712
  noTransactionsMessage: noQuotesMessage,
3734
3713
  filter: filter,
3735
- downloadTransactionLink: function (id) { return "".concat(subdomain, "/api/pdf/quote/").concat(id); },
3714
+ downloadTransactionLink: function (id) { return "".concat(apiHost, "/api/pdf/quote/").concat(id); },
3715
+ entityId: entityId,
3736
3716
  };
3737
3717
  function handleQuoteClick(quote) {
3738
3718
  if (quoteComponent) {
3739
3719
  setComponent(quoteComponent);
3740
3720
  }
3741
3721
  else {
3742
- setComponent(jsxRuntime.jsx(Quote, { id: quote === null || quote === void 0 ? void 0 : quote.transactionableId }));
3722
+ setComponent(jsxRuntime.jsx(Quote, { entityId: entityId, id: quote === null || quote === void 0 ? void 0 : quote.transactionableId }));
3743
3723
  }
3744
3724
  }
3745
3725
  return (jsxRuntime.jsx(TransactionsListContext.Provider, __assign({ value: contextValues }, { children: jsxRuntime.jsx(QuotesWrapper, {}) })));
3746
3726
  }
3747
3727
  function QuotesWrapper() {
3748
- var _a = React.useContext(BunnyContext), token = _a.token, subdomain = _a.subdomain;
3728
+ var _a = React.useContext(BunnyContext), token = _a.token, apiHost = _a.apiHost;
3749
3729
  var filterFromContext = React.useContext(TransactionsListContext).filter;
3750
3730
  // Local state
3751
3731
  var _b = React.useState(""), search = _b[0], setSearch = _b[1];
@@ -3753,7 +3733,7 @@ function QuotesWrapper() {
3753
3733
  // Queries
3754
3734
  var data = reactQuery.useQuery({
3755
3735
  queryKey: ["quotes", token, filter],
3756
- queryFn: function () { return getQuotes({ token: token, subdomain: subdomain, filter: filter }); },
3736
+ queryFn: function () { return getQuotes({ token: token, apiHost: apiHost, filter: filter }); },
3757
3737
  placeholderData: reactQuery.keepPreviousData,
3758
3738
  }).data;
3759
3739
  if (data === undefined)
@@ -3772,11 +3752,22 @@ function QuotesWrapper() {
3772
3752
  return (jsxRuntime.jsx(TransactionsDisplay, { transactions: quotesAsTransactions, onSearchValueChanged: setSearch, search: search, title: "Past quotes" }));
3773
3753
  }
3774
3754
 
3755
+ var css_248z = ".ant-tag {\n border: none;\n border-radius: 14px;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n font-weight: 500;\n white-space: nowrap;\n margin: 0;\n}\n.ant-tag-blue {\n color: #3b82f6 !important;\n background: #bfdbfe !important;\n}\n.ant-tag-green {\n color: #059669 !important;\n background: #a7f3d0 !important;\n}\n.ant-tag-red {\n color: #ef4444 !important;\n background: #fecaca !important;\n}\n.ant-tag-orange {\n color: #f97316 !important;\n background: #fed7aa !important;\n}\n.ant-tag-yellow {\n color: #f59e0b !important;\n background: #fde68a !important;\n}\n.ant-tag-purple {\n color: #8b5cf6 !important;\n background: #ddd6fe !important;\n}\n.ant-tag-black {\n color: white !important;\n background: black !important;\n}\n.ant-popover {\n z-index: 1050;\n}\n.ant-popover-inner-content {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n max-width: 300px;\n}\n.ant-popover-message-title {\n padding: 0;\n text-align: center;\n font-size: 1rem;\n}\n.ant-popover-buttons {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.ant-btn-primary:disabled {\n background: #eef0f2 !important;\n color: rgba(0, 0, 0, 0.25) !important;\n border: none;\n}\n.ant-btn {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n font-weight: 500;\n box-shadow: none;\n text-shadow: none;\n outline: none !important;\n line-height: 1;\n font-size: 0.875rem;\n font-weight: normal;\n}\n.ant-btn > span {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n.ant-btn-lg {\n height: 44px !important;\n}\n.ant-btn-default:disabled {\n border-color: rgba(113, 125, 148, 0.2) !important;\n}\n.ant-btn-link {\n border: none !important;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n.ant-btn-link > span {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n.ant-btn-link:disabled {\n background-color: transparent !important;\n color: #717d94 !important;\n}\n.ant-btn-link:disabled:hover {\n background-color: transparent !important;\n}\n.ant-input-affix-wrapper .ant-input-prefix {\n transition: color 0.3s;\n}\n.ant-select-selector {\n box-shadow: none !important;\n background-color: transparent !important;\n border: none !important;\n}\n.ant-form-item-label {\n text-transform: none !important;\n font-size: 0.75rem;\n padding-bottom: 2px !important;\n}\n.ant-form-item-label > label {\n width: 100%;\n color: #4b5563 !important;\n}\n.ant-form-item-explain-error {\n font-size: 11px;\n min-height: 11px;\n line-height: 11px;\n padding-top: 2px;\n}\n.ant-form-item {\n margin-bottom: 0;\n}\n.ant-notification {\n width: min-content;\n}\n.ant-notification-topRight {\n right: 0 !important;\n left: 0 !important;\n margin-left: auto !important;\n margin-right: auto !important;\n}\n.ant-notification-notice-wrapper {\n width: 350px !important;\n overflow: hidden !important;\n}\n.ant-notification-notice {\n padding: 16px !important;\n width: 350px !important;\n display: flex !important;\n box-shadow: 0px 6px 10px rgba(0, 0, 0, 0.08), 0px 1px 18px rgba(0, 0, 0, 0.08), 0px 3px 5px rgba(0, 0, 0, 0.16) !important;\n}\n.ant-notification-notice-description {\n padding: 0 14px 0 0 !important;\n color: #232323 !important;\n font-size: 14px !important;\n word-break: break-all !important;\n overflow-wrap: break-word !important;\n}\n.ant-notification-notice-success {\n background-color: #edfffa !important;\n}\n.ant-notification-notice-error {\n background-color: #fff8f4 !important;\n}\n.ant-notification-notice-error .ant-notification-notice-message {\n color: #ff6e1c !important;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji !important;\n font-weight: 500;\n}\n.ant-notification-notice-error .ant-notification-notice-icon {\n color: #ff6e1c;\n}\n.ant-notification-notice-success .ant-notification-notice-message {\n color: #00b76a !important;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji !important;\n font-weight: 500;\n}\n.ant-notification-notice-success .ant-notification-notice-icon {\n color: #00b76a !important;\n}\n.ant-notification-notice-message {\n margin-bottom: 0 !important;\n}\n.ant-notification-notice-close {\n top: 16px !important;\n right: 16px !important;\n}\n.ant-divider {\n margin: 0;\n}\n.ant-menu-submenu-popup > .ant-menu .ant-menu-item {\n display: flex !important;\n align-items: center !important;\n}\n.ant-menu-submenu::after {\n display: none !important;\n}\n.ant-drawer-title {\n font-weight: 400 !important;\n}\n.ant-drawer-header-title {\n flex-direction: row-reverse !important;\n align-items: start !important ;\n}\n.ant-drawer-close {\n margin-inline-end: 0 !important;\n}\n@media (min-width: 768px) {\n .ant-input,\n .ant-picker,\n .ant-select,\n .ant-input-affix-wrapper {\n font-size: 1rem !important;\n }\n .ant-drawer-header {\n padding-right: 1.5rem !important;\n padding-left: 1.5rem !important;\n }\n}\n:root {\n --row-background: #ffffff;\n --row-background-alternate: rgba(100, 116, 139, 0.04);\n --row-background-dark: #121212;\n --row-background-alternate-dark: #1e1e1e;\n}\n.plan-step-line {\n height: 1px;\n min-width: 128px;\n background: #717d94;\n}\n.plan-step-number {\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 9999px;\n border: 1px solid #717d94;\n background: white;\n width: 24px;\n height: 24px;\n color: #717d94;\n}\n.plan-step-number.active {\n border: none;\n color: white;\n background: #ff6e1c;\n}\n.hidden {\n display: none;\n}\n.cardElement {\n padding: 8px 11px;\n border: 1px solid #e5e7eb;\n background-color: white;\n font-family: Inter !important;\n}\n.tooltip {\n visibility: hidden;\n position: absolute !important;\n}\n.has-tooltip:hover .tooltip {\n visibility: visible;\n z-index: 100;\n}\n.show-on-hover {\n opacity: 0;\n}\n.show-on-hover-container:hover .show-on-hover {\n opacity: 1;\n}\n.pdf-only {\n display: none !important;\n}\n.notes p {\n margin: 0;\n padding: 0;\n padding-bottom: 0.25rem;\n}\n#form-element #finix-form-container .field-holder label {\n color: #717d94 !important;\n font-size: 12px !important;\n}\n#form-element #finix-form-container > *:first-child,\n#form-element #finix-form-container > *:last-child {\n margin-top: 0 !important;\n}\n#form-element #finix-form-container > *:not(:first-child):not(:last-child) {\n margin-top: 12px !important;\n}\n#form-element #finix-form-container .field-array > * {\n margin-top: 0 !important;\n}\n#form-element #finix-form-container .field-holder .field,\n#form-element #finix-form-container iframe {\n height: 34px !important;\n}\n#form-element #finix-form-container .field {\n margin-top: 0 !important;\n padding-top: 2px !important;\n}\n#form-element #finix-form-container .field-holder .validation {\n font-size: 11px !important;\n color: #ff4d4f !important;\n}\n.icon-path {\n transition: fill 0.3s;\n}\n.shadow-padding-x {\n padding-right: 1rem;\n padding-left: 1rem;\n}\n.shadow-padding-xb {\n padding-right: 1rem;\n padding-left: 1rem;\n padding-bottom: 0.5rem;\n}\n.content-container {\n width: 100%;\n margin: 0 auto;\n}\n@media (min-width: 1220px) {\n .content-container {\n width: 1220px !important;\n margin: 0 auto;\n }\n}\n@media (min-width: 768px) {\n .shadow-padding-x {\n padding-right: 2rem;\n padding-left: 2rem;\n }\n .shadow-padding-xb {\n padding-right: 2rem;\n padding-left: 2rem;\n padding-bottom: 0.5rem;\n }\n .sm\\:flex {\n display: flex !important;\n }\n .sm\\:hidden {\n display: none !important;\n }\n}\n* {\n margin: 0;\n padding: 0;\n box-sizing: border-box !important;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n line-height: 1.15;\n}\nbody {\n color: #232323;\n background-color: #f8fafc;\n}\nth {\n font-weight: normal;\n}\ncode {\n font-family: source-code-pro, Menlo, Monaco, Consolas, \"Courier New\", monospace;\n}\n@media only screen and (max-width: 768px) {\n select,\n textarea,\n input[type=\"text\"],\n input[type=\"password\"],\n input[type=\"datetime\"],\n input[type=\"datetime-local\"],\n input[type=\"date\"],\n input[type=\"month\"],\n input[type=\"time\"],\n input[type=\"week\"],\n input[type=\"number\"],\n input[type=\"email\"],\n input[type=\"url\"],\n input[type=\"search\"],\n input[type=\"tel\"],\n input[type=\"color\"] {\n font-size: 16px !important;\n }\n}\n@keyframes App-logo-spin {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}\n";
3756
+ styleInject(css_248z);
3757
+
3775
3758
  var DrawerHeader = function (_a) {
3776
3759
  var description = _a.description, onClose = _a.onClose, title = _a.title;
3777
3760
  return (jsxRuntime.jsxs("div", __assign({ className: "flex flex-col gap-4" }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex items-center justify-between gap-2" }, { children: [jsxRuntime.jsx("div", __assign({ className: "text-xl" }, { children: title })), jsxRuntime.jsx("button", __assign({ onClick: onClose, className: "ant-drawer-close" }, { children: jsxRuntime.jsx(CloseOutlined$1, {}) }))] })), description && jsxRuntime.jsx("div", __assign({ className: "text-xs" }, { children: description }))] })));
3778
3761
  };
3779
3762
 
3763
+ var Card = function (_a) {
3764
+ var children = _a.children, className = _a.className, style = _a.style;
3765
+ var darkMode = React.useContext(BunnyContext).darkMode;
3766
+ return (jsxRuntime.jsx("div", __assign({ className: "flex flex-col rounded-md shadow-md ".concat(className), style: __assign(__assign({}, style), { backgroundColor: darkMode
3767
+ ? "var(--row-background-dark)"
3768
+ : "var(--row-background)" }) }, { children: children })));
3769
+ };
3770
+
3780
3771
  var LargeCardIcon = function () {
3781
3772
  return (jsxRuntime.jsx("svg", __assign({ width: "72", height: "56", viewBox: "0 0 72 56", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: jsxRuntime.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" }) })));
3782
3773
  };
@@ -3786,16 +3777,6 @@ var PlusIcon = function (_a) {
3786
3777
  return (jsxRuntime.jsxs("svg", __assign({ width: "14", height: "15", viewBox: "0 0 14 15", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: [jsxRuntime.jsx("path", { d: "M2.9165 7.5H11.0832", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), jsxRuntime.jsx("path", { d: "M7 3.41663V11.5833", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })] })));
3787
3778
  };
3788
3779
 
3789
- var PaymentMethodContext = React.createContext({});
3790
-
3791
- var Card = function (_a) {
3792
- var children = _a.children, className = _a.className, style = _a.style;
3793
- var darkMode = React.useContext(BunnyContext).darkMode;
3794
- return (jsxRuntime.jsx("div", __assign({ className: "flex flex-col rounded-md shadow-md ".concat(className), style: __assign(__assign({}, style), { backgroundColor: darkMode
3795
- ? "var(--row-background-dark)"
3796
- : "var(--row-background)" }) }, { children: children })));
3797
- };
3798
-
3799
3780
  var Text$6 = antd.Typography.Text;
3800
3781
  var CreditCard = function (_a) {
3801
3782
  var _b, _c, _d;
@@ -3805,9 +3786,9 @@ var CreditCard = function (_a) {
3805
3786
  var expDate = dayjs(paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.expirationDate);
3806
3787
  return expDate.isBefore(dayjs());
3807
3788
  };
3808
- var isMobile = common.useIsMobile();
3809
- var processPublicUrl = React.useContext(PaymentMethodContext).processPublicUrl;
3810
- return (jsxRuntime.jsxs(Card, __assign({ className: "shadow-md m-0" }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex items-center justify-between gap-4 p-4" }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex items-center gap-4" }, { children: [jsxRuntime.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) && (jsxRuntime.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)) })), jsxRuntime.jsx(Text$6, { children: (_d = paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.metadata) === null || _d === void 0 ? void 0 : _d.description })] })), jsxRuntime.jsx(antd.Tag, __assign({ color: isExpired(paymentMethodData) ? "red" : "green" }, { children: isExpired(paymentMethodData) ? "Expired" : "Valid" }))] })), !isMobile && (jsxRuntime.jsx(CardActions, { onClickRemove: onClickRemove, onClickUpdate: onClickUpdate }))] })), dayjs(paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.expirationDate).isValid() && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(antd.Divider, {}), jsxRuntime.jsxs("div", __assign({ className: "flex flex-col p-4" }, { children: [jsxRuntime.jsx(CardAttribute, { title: "EXPIRATION", value: dayjs(paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.expirationDate).format("MM/YY") }), isMobile && (jsxRuntime.jsx(CardActions, { onClickRemove: onClickRemove, onClickUpdate: onClickUpdate }))] }))] }))] })));
3789
+ var isMobile = common.useIsMobile(window);
3790
+ var apiHost = React.useContext(BunnyContext).apiHost;
3791
+ return (jsxRuntime.jsxs(Card, __assign({ className: "shadow-md m-0" }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex items-center justify-between gap-4 p-4" }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex items-center gap-4" }, { children: [jsxRuntime.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) && (jsxRuntime.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)) })), jsxRuntime.jsx(Text$6, { children: (_d = paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.metadata) === null || _d === void 0 ? void 0 : _d.description })] })), jsxRuntime.jsx(antd.Tag, __assign({ color: isExpired(paymentMethodData) ? "red" : "green" }, { children: isExpired(paymentMethodData) ? "Expired" : "Valid" }))] })), !isMobile && (jsxRuntime.jsx(CardActions, { onClickRemove: onClickRemove, onClickUpdate: onClickUpdate }))] })), dayjs(paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.expirationDate).isValid() && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(antd.Divider, {}), jsxRuntime.jsxs("div", __assign({ className: "flex flex-col p-4" }, { children: [jsxRuntime.jsx(CardAttribute, { title: "EXPIRATION", value: dayjs(paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.expirationDate).format("MM/YY") }), isMobile && (jsxRuntime.jsx(CardActions, { onClickRemove: onClickRemove, onClickUpdate: onClickUpdate }))] }))] }))] })));
3811
3792
  };
3812
3793
  var CardAttribute = function (_a) {
3813
3794
  var title = _a.title, value = _a.value;
@@ -3815,7 +3796,7 @@ var CardAttribute = function (_a) {
3815
3796
  };
3816
3797
  var CardActions = function (_a) {
3817
3798
  var onClickRemove = _a.onClickRemove, onClickUpdate = _a.onClickUpdate;
3818
- var isMobile = common.useIsMobile();
3799
+ var isMobile = common.useIsMobile(window);
3819
3800
  return (jsxRuntime.jsxs("div", __assign({ className: "flex items-center gap-6 ".concat(isMobile ? "justify-center mt-4" : "") }, { children: [jsxRuntime.jsx(antd.Popconfirm, __assign({ title: "Remove card?", onConfirm: onClickRemove }, { children: jsxRuntime.jsx(antd.Button, __assign({ className: "font-normal p-0", type: "link" }, { children: "Remove payment method" })) })), jsxRuntime.jsx(antd.Divider, { style: { height: "24px" }, type: "vertical" }), jsxRuntime.jsx(antd.Button, __assign({ onClick: onClickUpdate, type: "primary" }, { children: "Update" }))] })));
3820
3801
  };
3821
3802
  var EmptyCard = function (_a) {
@@ -3830,27 +3811,26 @@ var getCardImage = function (issuer) {
3830
3811
  return "mc_symbol_opt_73_3x.png";
3831
3812
  };
3832
3813
 
3833
- var ActualPaymentMethod = function () {
3834
- var _a = React.useContext(BunnyContext), token = _a.token, subdomain = _a.subdomain, graphQLClient = _a.graphQLClient;
3814
+ var PaymentMethodContext = React.createContext({});
3815
+
3816
+ var ActualPaymentMethod = function (_a) {
3817
+ var entityId = _a.entityId;
3818
+ var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, graphQLClient = _b.graphQLClient, onErrorNavigate = _b.onErrorNavigate;
3835
3819
  var accountId = React.useContext(PaymentContext).accountId;
3836
3820
  // Hooks
3837
3821
  var queryClient = reactQuery.useQueryClient();
3838
- var paymentPlugins = common.usePaymentPlugins({ subdomain: subdomain, token: token }).paymentPlugins;
3839
- var showErrorNotification = common.NotificationUtils.useErrorNotification();
3840
- var showSuccessNotification = common.NotificationUtils.useSuccessNotification();
3841
- var handleAllErrorFormats = common.NotificationUtils.useAllErrorFormats(function () {
3842
- console.log("Navigation in PaymentMethod.tsx useAllErrorFormats not implemented");
3843
- });
3844
- var isMobile = common.useIsMobile();
3822
+ var paymentPlugins = usePaymentPlugins({ entityId: entityId, apiHost: apiHost, token: token }).paymentPlugins;
3823
+ var showErrorNotification = common.useErrorNotification();
3824
+ var showSuccessNotification = common.useSuccessNotification();
3825
+ var handleAllErrorFormats = common.useAllErrorFormats(onErrorNavigate ||
3826
+ (function (url) {
3827
+ console.log("navigate to", url, " not implemented");
3828
+ }));
3829
+ var isMobile = common.useIsMobile(window);
3845
3830
  var data = usePaymentMethod(graphQLClient).data;
3846
3831
  // Local state
3847
- var _b = React.useState(false), showModal = _b[0], setShowModal = _b[1];
3848
- var _c = React.useState(false), isSaving = _c[0], setIsSaving = _c[1];
3849
- // Queries
3850
- reactQuery.useQuery({
3851
- queryKey: common.QueryKeyFactory.default.currentUserKey,
3852
- queryFn: function () { return getCurrentUserData({ token: token, subdomain: subdomain }); },
3853
- });
3832
+ var _c = React.useState(false), showModal = _c[0], setShowModal = _c[1];
3833
+ var _d = React.useState(false), isSaving = _d[0], setIsSaving = _d[1];
3854
3834
  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); });
3855
3835
  var onClickRemove = function () {
3856
3836
  if (data && plugin) {
@@ -3862,7 +3842,7 @@ var ActualPaymentMethod = function () {
3862
3842
  account_id: accountId,
3863
3843
  },
3864
3844
  token: token,
3865
- subdomain: subdomain,
3845
+ apiHost: apiHost,
3866
3846
  })
3867
3847
  .then(function () {
3868
3848
  showSuccessNotification("Payment method was removed", "Success");
@@ -3889,7 +3869,7 @@ var ActualPaymentMethod = function () {
3889
3869
  }
3890
3870
  : {},
3891
3871
  wrapper: isMobile ? { width: "100vw" } : { width: "min-content" },
3892
- }, title: jsxRuntime.jsx(DrawerHeader, { onClose: function () { return setShowModal(false); }, title: "New payment method" }) }, { children: jsxRuntime.jsx(PaymentForm, { isSaving: isSaving, onFail: function (error) {
3872
+ }, title: jsxRuntime.jsx(DrawerHeader, { onClose: function () { return setShowModal(false); }, title: "New payment method" }) }, { children: jsxRuntime.jsx(PaymentForm, { entityId: entityId, isSaving: isSaving, onFail: function (error) {
3893
3873
  handleAllErrorFormats(error);
3894
3874
  setIsSaving(false);
3895
3875
  }, onPaymentSuccess: function () {
@@ -3898,13 +3878,56 @@ var ActualPaymentMethod = function () {
3898
3878
  }, setIsSaving: setIsSaving }) }))] }));
3899
3879
  };
3900
3880
  function PaymentMethod(_a) {
3901
- var footer = _a.footer, processPublicUrl = _a.processPublicUrl;
3902
- return (jsxRuntime.jsx(PaymentMethodContext.Provider, __assign({ value: { footer: footer, processPublicUrl: processPublicUrl } }, { children: jsxRuntime.jsx(ActualPaymentMethod, {}) })));
3881
+ var entityId = _a.entityId, footer = _a.footer;
3882
+ return (jsxRuntime.jsx(PaymentMethodContext.Provider, __assign({ value: { footer: footer } }, { children: jsxRuntime.jsx(ActualPaymentMethod, { entityId: entityId }) })));
3903
3883
  }
3904
3884
 
3905
- 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";
3885
+ var pageWrapperClassName = function (isMobile) {
3886
+ return "flex flex-col grow pt-4 ".concat(isMobile ? "pb-4 overflow-hidden" : "pb-8", " ").concat("content-container");
3887
+ };
3888
+
3889
+ 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}";
3890
+
3891
+ var QUOTE_RECALCULATE_TAXES = "\n mutation QuoteRecalculateTaxes($id: ID!) {\n quoteRecalculateTaxes(id: $id) {\n ".concat(QUOTE_FIELDS, "\n errors\n }\n }\n");
3892
+ var quoteRecalculateTaxes = function (_a) {
3893
+ var quoteId = _a.quoteId, token = _a.token, apiHost = _a.apiHost;
3894
+ return __awaiter(void 0, void 0, void 0, function () {
3895
+ var vars, response, errors;
3896
+ var _b, _c;
3897
+ return __generator(this, function (_d) {
3898
+ switch (_d.label) {
3899
+ case 0:
3900
+ vars = { id: quoteId };
3901
+ return [4 /*yield*/, common.gqlRequest({
3902
+ query: QUOTE_RECALCULATE_TAXES,
3903
+ token: token,
3904
+ vars: vars,
3905
+ apiHost: apiHost,
3906
+ })];
3907
+ case 1:
3908
+ response = _d.sent();
3909
+ errors = (_b = response === null || response === void 0 ? void 0 : response.quoteRecalculateTaxes) === null || _b === void 0 ? void 0 : _b.errors;
3910
+ if (errors)
3911
+ throw errors;
3912
+ return [2 /*return*/, (_c = response.quoteRecalculateTaxes) === null || _c === void 0 ? void 0 : _c.quote];
3913
+ }
3914
+ });
3915
+ });
3916
+ };
3917
+
3918
+ var useHasTaxPlugin = function (_a) {
3919
+ var entityId = _a.entityId, apiHost = _a.apiHost, token = _a.token;
3920
+ var plugins = usePlugins({
3921
+ entityId: entityId,
3922
+ apiHost: apiHost,
3923
+ token: token,
3924
+ }).data;
3925
+ return Boolean(plugins === null || plugins === void 0 ? void 0 : plugins.some(function (plugin) { return plugin.type === "taxation"; }));
3926
+ };
3927
+
3928
+ 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";
3906
3929
  var accountUpdate = function (_a) {
3907
- var accountId = _a.accountId, attributes = _a.attributes, token = _a.token;
3930
+ var accountId = _a.accountId, attributes = _a.attributes, token = _a.token, apiHost = _a.apiHost;
3908
3931
  return __awaiter(void 0, void 0, void 0, function () {
3909
3932
  var vars, response, errors;
3910
3933
  var _b;
@@ -3912,7 +3935,12 @@ var accountUpdate = function (_a) {
3912
3935
  switch (_c.label) {
3913
3936
  case 0:
3914
3937
  vars = { id: accountId, attributes: attributes };
3915
- return [4 /*yield*/, common.gqlRequest({ query: MUTATION$5, token: token, vars: vars })];
3938
+ return [4 /*yield*/, common.gqlRequest({
3939
+ query: MUTATION$6,
3940
+ token: token,
3941
+ vars: vars,
3942
+ apiHost: apiHost,
3943
+ })];
3916
3944
  case 1:
3917
3945
  response = _c.sent();
3918
3946
  errors = (_b = response === null || response === void 0 ? void 0 : response.accountUpdate) === null || _b === void 0 ? void 0 : _b.errors;
@@ -3929,10 +3957,10 @@ var TaxationForm = function (_a) {
3929
3957
  var account = _a.account, quote = _a.quote;
3930
3958
  // Hooks
3931
3959
  var queryClient = reactQuery.useQueryClient();
3932
- var token = React.useContext(BunnyContext).token;
3960
+ var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
3933
3961
  var form = antd.Form.useForm()[0];
3934
3962
  // Mutations
3935
- var _b = reactQuery.useMutation({
3963
+ var _c = reactQuery.useMutation({
3936
3964
  mutationFn: function (changedFormData) { return __awaiter(void 0, void 0, void 0, function () {
3937
3965
  var account;
3938
3966
  return __generator(this, function (_a) {
@@ -3941,6 +3969,7 @@ var TaxationForm = function (_a) {
3941
3969
  accountId: quote.accountId,
3942
3970
  attributes: changedFormData,
3943
3971
  token: token,
3972
+ apiHost: apiHost,
3944
3973
  })];
3945
3974
  case 1:
3946
3975
  account = _a.sent();
@@ -3953,7 +3982,7 @@ var TaxationForm = function (_a) {
3953
3982
  queryKey: ["getTaxationRequiredAccountFields", token],
3954
3983
  });
3955
3984
  },
3956
- }), updateAccount = _b.mutate, isUpdatingAccount = _b.isPending;
3985
+ }), updateAccount = _c.mutate, isUpdatingAccount = _c.isPending;
3957
3986
  return (jsxRuntime.jsxs(antd.Form, __assign({ className: "flex flex-col gap-4", form: form, initialValues: account, layout: "vertical", onFinish: updateAccount }, { children: [jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Billing street", name: "billingStreet" }, { children: jsxRuntime.jsx(antd.Input, { placeholder: "Street" }) })), jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Billing city", name: "billingCity" }, { children: jsxRuntime.jsx(antd.Input, { placeholder: "City" }) })), jsxRuntime.jsx(FormBillingState, { form: form }), jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Billing country", name: "billingCountry", rules: [{ required: true }] }, { children: jsxRuntime.jsx(antd.Select, { options: common.Lists.COUNTRY_LIST, placeholder: "Select a country", showSearch: true, filterOption: function (input, option) {
3958
3987
  var _a, _b;
3959
3988
  return ((_a = option === null || option === void 0 ? void 0 : option.label) !== null && _a !== void 0 ? _a : "").toLowerCase().includes(input.toLowerCase()) ||
@@ -3968,10 +3997,10 @@ var FormBillingState = function (_a) {
3968
3997
  };
3969
3998
 
3970
3999
  var QuoteCheckout = function (_a) {
3971
- var account = _a.account, isSaving = _a.isSaving, onSuccess = _a.onSuccess, onFail = _a.onFail, quote = _a.quote, setIsSaving = _a.setIsSaving, taxationRequiredAccountFields = _a.taxationRequiredAccountFields; _a.storedPaymentMethod;
4000
+ 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;
3972
4001
  // Context
3973
- var isMobile = common.useIsMobile();
3974
- var _b = React.useContext(BunnyContext), subdomain = _b.subdomain, token = _b.token;
4002
+ var isMobile = common.useIsMobile(window);
4003
+ var _b = React.useContext(BunnyContext), apiHost = _b.apiHost, token = _b.token;
3975
4004
  var paymentRequired = getQuoteAmountDue(quote) > 0;
3976
4005
  var checkoutMutation = reactQuery.useMutation({
3977
4006
  mutationFn: function (_a) {
@@ -3979,14 +4008,14 @@ var QuoteCheckout = function (_a) {
3979
4008
  if (!quote)
3980
4009
  throw new Error("Quote is required");
3981
4010
  if (!paymentRequired)
3982
- return checkout({ quoteId: quote.id, token: token, subdomain: subdomain });
4011
+ return checkout({ quoteId: quote.id, token: token, apiHost: apiHost });
3983
4012
  if (savedPaymentMethod) {
3984
4013
  var paymentMethodId = savedPaymentMethod.paymentMethodId;
3985
4014
  return checkout({
3986
4015
  quoteId: quote.id,
3987
4016
  paymentMethodId: paymentMethodId,
3988
4017
  token: token,
3989
- subdomain: subdomain,
4018
+ apiHost: apiHost,
3990
4019
  });
3991
4020
  }
3992
4021
  if (pluginPaymentMethod) {
@@ -4001,7 +4030,7 @@ var QuoteCheckout = function (_a) {
4001
4030
  token: paymentToken,
4002
4031
  },
4003
4032
  token: token,
4004
- subdomain: subdomain,
4033
+ apiHost: apiHost,
4005
4034
  });
4006
4035
  }
4007
4036
  throw new Error("Pay payment method provided");
@@ -4043,82 +4072,64 @@ var QuoteCheckout = function (_a) {
4043
4072
  };
4044
4073
  if (taxationRequiredAccountFields)
4045
4074
  return (jsxRuntime.jsx(PaymentFormWrapper, __assign({ setMaxHeight: false }, { children: jsxRuntime.jsx(TaxationForm, { account: account, quote: quote }) })));
4046
- return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: paymentRequired ? (jsxRuntime.jsx(PaymentForm, { isSaving: isSaving, onFail: onFail, onPaymentSuccess: handleCheckout, quote: quote, setIsSaving: setIsSaving })) : (jsxRuntime.jsx(PaymentFormWrapper, __assign({ setMaxHeight: false }, { children: jsxRuntime.jsxs("div", __assign({ className: "flex flex-col gap-2 ".concat(isMobile ? "shadow-padding-x" : "") }, { children: [jsxRuntime.jsx(antd.Button, __assign({ disabled: isSaving, onClick: function () {
4075
+ return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: paymentRequired ? (jsxRuntime.jsx(PaymentForm, { entityId: entityId, isSaving: isSaving, onFail: onFail, onPaymentSuccess: handleCheckout, quote: quote, setIsSaving: setIsSaving })) : (jsxRuntime.jsx(PaymentFormWrapper, __assign({ setMaxHeight: false }, { children: jsxRuntime.jsxs("div", __assign({ className: "flex flex-col gap-2 ".concat(isMobile ? "shadow-padding-x" : "") }, { children: [jsxRuntime.jsx(antd.Button, __assign({ disabled: isSaving, onClick: function () {
4047
4076
  setIsSaving(true);
4048
4077
  handleCheckout({});
4049
4078
  }, type: "primary" }, { children: isSaving ? "Processing..." : "Complete order" })), jsxRuntime.jsx("div", __assign({ className: "text-xs text-slate-500" }, { children: "No payment is required" }))] })) }))) }));
4050
4079
  };
4051
4080
 
4052
- var useHasTaxPlugin = function (_a) {
4053
- var subdomain = _a.subdomain, token = _a.token;
4054
- var plugins = common.usePlugins({
4055
- subdomain: subdomain,
4056
- token: token,
4057
- }).data;
4058
- return Boolean(plugins === null || plugins === void 0 ? void 0 : plugins.some(function (plugin) { return plugin.type === "taxation"; }));
4059
- };
4060
-
4061
- 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}";
4062
-
4063
- var QUOTE_RECALCULATE_TAXES = "\n mutation QuoteRecalculateTaxes($id: ID!) {\n quoteRecalculateTaxes(id: $id) {\n ".concat(QUOTE_FIELDS, "\n errors\n }\n }\n");
4064
- var quoteRecalculateTaxes = function (_a) {
4065
- var quoteId = _a.quoteId, token = _a.token;
4081
+ var MUTATION$5 = "{\n currentUser {\n taxationRequiredAccountFields\n }\n}";
4082
+ var getTaxationRequiredAccountFields = function (_a) {
4083
+ var token = _a.token, apiHost = _a.apiHost;
4066
4084
  return __awaiter(void 0, void 0, void 0, function () {
4067
- var vars, response, errors;
4085
+ var response;
4068
4086
  var _b, _c;
4069
4087
  return __generator(this, function (_d) {
4070
4088
  switch (_d.label) {
4071
- case 0:
4072
- vars = { id: quoteId };
4073
- return [4 /*yield*/, common.gqlRequest({
4074
- query: QUOTE_RECALCULATE_TAXES,
4075
- token: token,
4076
- vars: vars,
4077
- })];
4089
+ case 0: return [4 /*yield*/, common.gqlRequest({
4090
+ query: MUTATION$5,
4091
+ token: token,
4092
+ apiHost: apiHost,
4093
+ })];
4078
4094
  case 1:
4079
4095
  response = _d.sent();
4080
- errors = (_b = response === null || response === void 0 ? void 0 : response.quoteRecalculateTaxes) === null || _b === void 0 ? void 0 : _b.errors;
4081
- if (errors)
4082
- throw errors;
4083
- return [2 /*return*/, (_c = response.quoteRecalculateTaxes) === null || _c === void 0 ? void 0 : _c.quote];
4096
+ 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
4097
+ ? response.currentUser
4098
+ .taxationRequiredAccountFields
4099
+ : null];
4084
4100
  }
4085
4101
  });
4086
4102
  });
4087
4103
  };
4088
4104
 
4089
- var planPickerQuoteDataState = recoil.atom({
4090
- key: "planPickerQuoteDataState",
4091
- default: undefined,
4092
- });
4093
-
4094
- var pageWrapperClassName = function (isMobile) {
4095
- return "flex flex-col grow pt-4 ".concat(isMobile ? "pb-4 overflow-hidden" : "pb-8", " ").concat("content-container");
4096
- };
4097
-
4098
4105
  var queryKeyFactory = common.QueryKeyFactory.default;
4099
4106
  var Checkout = function (_a) {
4100
4107
  var _b, _c;
4101
- 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;
4102
- var subdomain = React.useContext(BunnyContext).subdomain;
4103
- var _d = React.useState(false), isSaving = _d[0], setIsSaving = _d[1];
4104
- var hasTaxPlugin = useHasTaxPlugin({ subdomain: subdomain || "", token: token });
4108
+ 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;
4109
+ var _e = React.useContext(BunnyContext), apiHost = _e.apiHost, window = _e.window;
4110
+ var _f = React.useState(false), isSaving = _f[0], setIsSaving = _f[1];
4111
+ var isMobile = common.useIsMobile(window);
4112
+ var hasTaxPlugin = useHasTaxPlugin({
4113
+ entityId: entityId,
4114
+ apiHost: apiHost,
4115
+ token: token,
4116
+ });
4105
4117
  var queryClient = reactQuery.useQueryClient();
4106
- var quotePreviewData = recoil.useRecoilValue(planPickerQuoteDataState);
4107
4118
  // Queries
4108
- var _e = reactQuery.useQuery({
4119
+ var _g = reactQuery.useQuery({
4109
4120
  queryKey: ["getTaxationRequiredAccountFields", token],
4110
- queryFn: function () { return common.getTaxationRequiredAccountFields({ token: token }); },
4121
+ queryFn: function () { return getTaxationRequiredAccountFields({ token: token, apiHost: apiHost }); },
4111
4122
  enabled: Boolean(quote),
4112
4123
  staleTime: 0,
4113
- }), taxationRequiredAccountFields = _e.data, isLoadingTaxationRequiredAccountFields = _e.isLoading;
4114
- var _f = reactQuery.useQuery({
4124
+ }), taxationRequiredAccountFields = _g.data, isLoadingTaxationRequiredAccountFields = _g.isLoading;
4125
+ var _h = reactQuery.useQuery({
4115
4126
  queryKey: ["account", quote === null || quote === void 0 ? void 0 : quote.accountId],
4116
4127
  queryFn: function () {
4117
- return (quote === null || quote === void 0 ? void 0 : quote.accountId) && common.getAccount({ id: quote.accountId, token: token });
4128
+ return (quote === null || quote === void 0 ? void 0 : quote.accountId) && common.getAccount({ id: quote.accountId, token: token, apiHost: apiHost });
4118
4129
  },
4119
4130
  enabled: Boolean(quote === null || quote === void 0 ? void 0 : quote.accountId) &&
4120
4131
  ((taxationRequiredAccountFields === null || taxationRequiredAccountFields === void 0 ? void 0 : taxationRequiredAccountFields.length) || 0) > 0,
4121
- }), account = _f.data, isLoadingAccount = _f.isLoading;
4132
+ }), account = _h.data, isLoadingAccount = _h.isLoading;
4122
4133
  reactQuery.useQuery({
4123
4134
  queryKey: queryKeyFactory.createQuoteTaxCalculateKey(quote === null || quote === void 0 ? void 0 : quote.id),
4124
4135
  queryFn: function () { return __awaiter(void 0, void 0, void 0, function () {
@@ -4130,12 +4141,13 @@ var Checkout = function (_a) {
4130
4141
  return [4 /*yield*/, quoteRecalculateTaxes({
4131
4142
  quoteId: quote.id,
4132
4143
  token: token,
4144
+ apiHost: apiHost,
4133
4145
  })];
4134
4146
  case 1:
4135
4147
  updatedQuote = _a.sent();
4136
4148
  if (updatedQuote) {
4137
4149
  queryClient.setQueryData(queryKeyFactory.createObjectKey("editingQuote", updatedQuote.id), updatedQuote);
4138
- queryClient.setQueryData(queryKeyFactory.calculatedPricesKey((quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.quantity) || 0, selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id), updatedQuote);
4150
+ queryClient.setQueryData(queryKeyFactory.calculatedPricesKey(quantity, selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id), updatedQuote);
4139
4151
  }
4140
4152
  _a.label = 2;
4141
4153
  case 2: return [2 /*return*/, {}];
@@ -4154,21 +4166,21 @@ var Checkout = function (_a) {
4154
4166
  return null;
4155
4167
  return (jsxRuntime.jsx("div", __assign({ className: "flex flex-col fixed top-0 left-0 right-0 bottom-0 bg-slate-50 overflow-auto", style: {
4156
4168
  zIndex: 1001,
4157
- } }, { children: jsxRuntime.jsxs("div", __assign({ className: pageWrapperClassName(isMobile) }, { children: [jsxRuntime.jsx("div", __assign({ className: "flex justify-end w-full" }, { children: jsxRuntime.jsx(CloseOutlined$1, { className: "text-base shadow-padding-xb", onClick: onCancel }) })), jsxRuntime.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)) && (jsxRuntime.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)) && (jsxRuntime.jsx(antd.Divider, { className: "h-full", type: "vertical" })), invoice ? (jsxRuntime.jsx(InvoiceCheckout, { invoice: invoice, isSaving: isSaving, onFail: function (error) {
4169
+ } }, { children: jsxRuntime.jsxs("div", __assign({ className: pageWrapperClassName(isMobile) }, { children: [jsxRuntime.jsx("div", __assign({ className: "flex justify-end w-full" }, { children: jsxRuntime.jsx(CloseOutlined$1, { className: "text-base shadow-padding-xb", onClick: onCancel }) })), jsxRuntime.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)) && (jsxRuntime.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)) && (jsxRuntime.jsx(antd.Divider, { className: "h-full", type: "vertical" })), invoice ? (jsxRuntime.jsx(InvoiceCheckout, { invoice: invoice, isSaving: isSaving, onFail: function (error) {
4158
4170
  onFail(error);
4159
4171
  setIsSaving(false);
4160
4172
  }, onSuccess: function (_a) {
4161
4173
  var savePaymentMethod = _a.savePaymentMethod;
4162
4174
  onSuccess({ savePaymentMethod: savePaymentMethod });
4163
4175
  setIsSaving(false);
4164
- }, setIsSaving: setIsSaving })) : quote ? (jsxRuntime.jsx(QuoteCheckout, { account: account, isSaving: isSaving, onFail: function (error) {
4176
+ }, setIsSaving: setIsSaving, entityId: entityId })) : quote ? (jsxRuntime.jsx(QuoteCheckout, { account: account, entityId: entityId, isSaving: isSaving, onFail: function (error) {
4165
4177
  onFail(error);
4166
4178
  setIsSaving(false);
4167
4179
  }, onSuccess: function (_a) {
4168
4180
  var savePaymentMethod = _a.savePaymentMethod;
4169
4181
  onSuccess({ savePaymentMethod: savePaymentMethod });
4170
4182
  setIsSaving(false);
4171
- }, quote: quote, setIsSaving: setIsSaving, taxationRequiredAccountFields: taxationRequiredAccountFields, token: token, storedPaymentMethod: storedPaymentMethod })) : (jsxRuntime.jsx(PaymentForm, { isSaving: isSaving, onFail: function (error) {
4183
+ }, quote: quote, setIsSaving: setIsSaving, taxationRequiredAccountFields: taxationRequiredAccountFields, token: token })) : (jsxRuntime.jsx(PaymentForm, { entityId: entityId, isSaving: isSaving, onFail: function (error) {
4172
4184
  onFail(error);
4173
4185
  setIsSaving(false);
4174
4186
  }, onPaymentSuccess: function (_a) {
@@ -4182,7 +4194,7 @@ var Checkout = function (_a) {
4182
4194
 
4183
4195
  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}"; };
4184
4196
  var accountSignup = function (_a) {
4185
- 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;
4197
+ 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;
4186
4198
  return __awaiter(void 0, void 0, void 0, function () {
4187
4199
  var vars, response, errors;
4188
4200
  var _b;
@@ -4202,7 +4214,7 @@ var accountSignup = function (_a) {
4202
4214
  query: MUTATION$4(),
4203
4215
  token: token,
4204
4216
  vars: vars,
4205
- subdomain: subdomain,
4217
+ apiHost: apiHost,
4206
4218
  })];
4207
4219
  case 1:
4208
4220
  response = _c.sent();
@@ -4217,7 +4229,7 @@ var accountSignup = function (_a) {
4217
4229
 
4218
4230
  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}"; };
4219
4231
  var quoteAccountSignup = function (_a) {
4220
- var token = _a.token, subdomain = _a.subdomain, entityId = _a.entityId, priceListCode = _a.priceListCode, accountName = _a.accountName, billingContact = _a.billingContact;
4232
+ var token = _a.token, apiHost = _a.apiHost, entityId = _a.entityId, priceListCode = _a.priceListCode, accountName = _a.accountName, billingContact = _a.billingContact;
4221
4233
  return __awaiter(void 0, void 0, void 0, function () {
4222
4234
  var vars, response, errors;
4223
4235
  var _b;
@@ -4234,7 +4246,7 @@ var quoteAccountSignup = function (_a) {
4234
4246
  query: MUTATION$3(),
4235
4247
  token: token,
4236
4248
  vars: vars,
4237
- subdomain: subdomain,
4249
+ apiHost: apiHost,
4238
4250
  })];
4239
4251
  case 1:
4240
4252
  response = _c.sent();
@@ -4249,7 +4261,7 @@ var quoteAccountSignup = function (_a) {
4249
4261
 
4250
4262
  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}"; };
4251
4263
  var getPriceList = function (_a) {
4252
- var token = _a.token, code = _a.code, subdomain = _a.subdomain;
4264
+ var token = _a.token, code = _a.code, apiHost = _a.apiHost;
4253
4265
  return __awaiter(void 0, void 0, void 0, function () {
4254
4266
  var response;
4255
4267
  return __generator(this, function (_b) {
@@ -4258,7 +4270,7 @@ var getPriceList = function (_a) {
4258
4270
  query: MUTATION$2(),
4259
4271
  token: token,
4260
4272
  vars: { code: code },
4261
- subdomain: subdomain,
4273
+ apiHost: apiHost,
4262
4274
  })];
4263
4275
  case 1:
4264
4276
  response = _b.sent();
@@ -4269,8 +4281,8 @@ var getPriceList = function (_a) {
4269
4281
  };
4270
4282
 
4271
4283
  function PaymentForms(_a) {
4272
- 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;
4273
- return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: quote ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: accountId && (jsxRuntime.jsx(PaymentContext.Provider, __assign({ value: { accountId: accountId, displayPayButtonNameAnyways: true } }, { children: jsxRuntime.jsx(PaymentForm, { isSaving: paying, setIsSaving: setIsPaying, onFail: handlePaymentFail, onPaymentSuccess: handlePaymentSaveSuccess }) }))) })) : (jsxRuntime.jsx(InitialSignupForm, { onSubmit: handleSubmit, submitting: proceedingToPayment })) }));
4284
+ 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;
4285
+ return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: quote ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: accountId && (jsxRuntime.jsx(PaymentContext.Provider, __assign({ value: { accountId: accountId, displayPayButtonNameAnyways: true } }, { children: jsxRuntime.jsx(PaymentForm, { entityId: entityId, isSaving: paying, setIsSaving: setIsPaying, onFail: handlePaymentFail, onPaymentSuccess: handlePaymentSaveSuccess }) }))) })) : (jsxRuntime.jsx(InitialSignupForm, { onSubmit: handleSubmit, submitting: proceedingToPayment })) }));
4274
4286
  }
4275
4287
  function InitialSignupForm(_a) {
4276
4288
  var onSubmit = _a.onSubmit, submitting = _a.submitting;
@@ -4307,10 +4319,9 @@ function InitialSignupForm(_a) {
4307
4319
 
4308
4320
  var Title = antd.Typography.Title, Text$5 = antd.Typography.Text;
4309
4321
  function PaymentSuccessDisplay(_a) {
4310
- var className = _a.className, amountPaid = _a.amountPaid, style = _a.style, returnUrl = _a.returnUrl;
4322
+ var amountPaid = _a.amountPaid, className = _a.className, companyName = _a.companyName, returnUrl = _a.returnUrl, style = _a.style;
4311
4323
  var window = React.useContext(BunnyContext).window;
4312
- var companyName = common.useCurrentUserData().companyName;
4313
- return (jsxRuntime.jsxs("div", __assign({ className: "flex flex-col items-center justify-center h-full ".concat(className), style: style }, { children: [jsxRuntime.jsx(CheckCircleFilled$1, { style: { fontSize: "48px", color: "rgb(52 211 153)" } }), jsxRuntime.jsxs(Title, __assign({ level: 3, className: "mt-2 m-0" }, { children: ["Payment of ", common.Misc.formatCurrency(amountPaid, "USD"), " successful"] })), returnUrl && (jsxRuntime.jsxs(Text$5, __assign({ className: "text-slate-500 cursor-pointer underline", onClick: function () { return (window.location.href = returnUrl); } }, { children: ["Back to ", companyName] })))] })));
4324
+ return (jsxRuntime.jsxs("div", __assign({ className: "flex flex-col items-center justify-center h-full ".concat(className), style: style }, { children: [jsxRuntime.jsx(CheckCircleFilled$1, { style: { fontSize: "48px", color: "rgb(52 211 153)" } }), jsxRuntime.jsxs(Title, __assign({ level: 3, className: "mt-2 m-0" }, { children: ["Payment of ", common.formatCurrency(amountPaid, "USD"), " successful"] })), returnUrl && (jsxRuntime.jsxs(Text$5, __assign({ className: "text-slate-500 cursor-pointer underline", onClick: function () { return (window.location.href = returnUrl); } }, { children: ["Back to ", companyName] })))] })));
4314
4325
  }
4315
4326
 
4316
4327
  var Text$4 = antd.Typography.Text;
@@ -4318,38 +4329,12 @@ function PriceListDisplay(_a) {
4318
4329
  var priceListData = _a.priceListData, topNavImageUrl = _a.topNavImageUrl;
4319
4330
  if (!priceListData)
4320
4331
  return null;
4321
- return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx("div", __assign({ className: "flex flex-col justify-between h-full my-12" }, { children: jsxRuntime.jsxs("div", __assign({ className: "flex flex-col space-y-8" }, { children: [jsxRuntime.jsx(antd.Image, { width: 24, src: topNavImageUrl, alt: "Logo", preview: false }), jsxRuntime.jsxs("div", __assign({ className: "flex flex-col" }, { children: [jsxRuntime.jsx(Text$4, __assign({ className: "text-slate-500 font-bold text-lg" }, { children: priceListData.name })), jsxRuntime.jsxs(Text$4, __assign({ className: "font-bold text-xl" }, { children: [common.Misc.formatCurrency(priceListData.basePrice, priceListData.currencyId), " ", "/ month"] }))] })), jsxRuntime.jsxs("div", __assign({ className: "flex flex-col" }, { children: [jsxRuntime.jsxs(Text$4, __assign({ style: { fontSize: "16px" }, className: "text-slate-500" }, { children: [priceListData.trialLengthDays, " day trial"] })), jsxRuntime.jsx(Text$4, __assign({ className: "text-slate-500", style: { fontSize: "12px" } }, { children: "You will not be charged until the last day of the trial." }))] }))] })) })) }));
4332
+ return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx("div", __assign({ className: "flex flex-col justify-between h-full my-12" }, { children: jsxRuntime.jsxs("div", __assign({ className: "flex flex-col space-y-8" }, { children: [jsxRuntime.jsx(antd.Image, { width: 24, src: topNavImageUrl, alt: "Logo", preview: false }), jsxRuntime.jsxs("div", __assign({ className: "flex flex-col" }, { children: [jsxRuntime.jsx(Text$4, __assign({ className: "text-slate-500 font-bold text-lg" }, { children: priceListData.name })), jsxRuntime.jsxs(Text$4, __assign({ className: "font-bold text-xl" }, { children: [common.formatCurrency(priceListData.basePrice, priceListData.currencyId), " ", "/ month"] }))] })), jsxRuntime.jsxs("div", __assign({ className: "flex flex-col" }, { children: [jsxRuntime.jsxs(Text$4, __assign({ style: { fontSize: "16px" }, className: "text-slate-500" }, { children: [priceListData.trialLengthDays, " day trial"] })), jsxRuntime.jsx(Text$4, __assign({ className: "text-slate-500", style: { fontSize: "12px" } }, { children: "You will not be charged until the last day of the trial." }))] }))] })) })) }));
4322
4333
  }
4323
4334
 
4324
- var BunnyFooterIcon = function (_a) {
4325
- var color = _a.color;
4326
- return (jsxRuntime.jsxs("svg", __assign({ width: "45", height: "15", viewBox: "0 0 39 13", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: [jsxRuntime.jsxs("g", __assign({ clipPath: "url(#clip0_6_851)" }, { children: [jsxRuntime.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 }), jsxRuntime.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 }), jsxRuntime.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 }), jsxRuntime.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 }), jsxRuntime.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 }), jsxRuntime.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 })] })), jsxRuntime.jsx("defs", { children: jsxRuntime.jsx("clipPath", __assign({ id: "clip0_6_851" }, { children: jsxRuntime.jsx("rect", { width: "39", height: "13", fill: "white" }) })) })] })));
4327
- };
4328
-
4329
- var Footer = function (_a) {
4330
- var className = _a.className;
4331
- var _b = common.useCurrentUserData(), privacyUrl = _b.privacyUrl, termsUrl = _b.termsUrl;
4332
- var window = React.useContext(BunnyContext).window;
4333
- var isMobile = useIsMobile(window);
4334
- var quotePreviewData = recoil.useRecoilValue(planPickerQuoteDataState);
4335
- var selectedPriceList = quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.priceList;
4336
- if (selectedPriceList && isMobile)
4337
- return null;
4338
- return (jsxRuntime.jsxs("div", __assign({ className: "flex items-center justify-between shrink-0 ".concat(className, " ").concat(isMobile ? "flex-col gap-2 grow" : "") }, { children: [(termsUrl || privacyUrl) && (jsxRuntime.jsxs("div", __assign({ className: "flex items-center gap-3" }, { children: [termsUrl && (jsxRuntime.jsx(StyedLink, __assign({ className: "text-xs text-slate-400", href: termsUrl, rel: "noopener noreferrer", target: "_blank", type: "text" }, { children: "Terms" }))), privacyUrl && (jsxRuntime.jsx(StyedLink, __assign({ className: "text-xs text-slate-400", href: privacyUrl, rel: "noopener noreferrer", target: "_blank", type: "text" }, { children: "Privacy" })))] }))), jsxRuntime.jsx(BunnyMarketingLink, {})] })));
4339
- };
4340
- var BunnyMarketingLink = function () {
4341
- var _a = React.useState(false), isHovered = _a[0], setIsHovered = _a[1];
4342
- var window = React.useContext(BunnyContext).window;
4343
- var isMobile = useIsMobile(window);
4344
- return (jsxRuntime.jsx("div", __assign({ className: "flex items-end justify-end ".concat(isMobile ? "" : "grow") }, { children: jsxRuntime.jsx(StyledBunnyLink, __assign({ className: "flex items-end justify-end text-slate-400", href: "https://bunny.com/", rel: "noopener noreferrer", target: "_blank", type: "text" }, { children: jsxRuntime.jsxs("div", __assign({ className: "flex items-center", onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); } }, { children: ["Powered by\u00A0", jsxRuntime.jsx("div", __assign({ style: { paddingTop: "5px" } }, { children: jsxRuntime.jsx(BunnyFooterIcon, { color: isHovered ? common.PRIMARY_COLOR : common.SLATE_400 }) }))] })) })) })));
4345
- };
4346
- var StyedLink = styled__default["default"].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"])), common.SLATE_400, common.SLATE_500);
4347
- var StyledBunnyLink = styled__default["default"](StyedLink)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n &:hover {\n color: ", " !important;\n }\n"], ["\n &:hover {\n color: ", " !important;\n }\n"])), common.PRIMARY_COLOR);
4348
- var templateObject_1$3, templateObject_2;
4349
-
4350
4335
  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";
4351
4336
  var portalSessionCreate = function (_a) {
4352
- var tenantCode = _a.tenantCode, expiry = _a.expiry, returnUrl = _a.returnUrl, token = _a.token, subdomain = _a.subdomain;
4337
+ var tenantCode = _a.tenantCode, expiry = _a.expiry, returnUrl = _a.returnUrl, token = _a.token, apiHost = _a.apiHost;
4353
4338
  return __awaiter(void 0, void 0, void 0, function () {
4354
4339
  var response, errors;
4355
4340
  var _b;
@@ -4359,7 +4344,7 @@ var portalSessionCreate = function (_a) {
4359
4344
  query: MUTATION$1,
4360
4345
  token: token,
4361
4346
  vars: { tenantCode: tenantCode, expiry: expiry, returnUrl: returnUrl },
4362
- subdomain: subdomain,
4347
+ apiHost: apiHost,
4363
4348
  })];
4364
4349
  case 1:
4365
4350
  response = _c.sent();
@@ -4372,18 +4357,13 @@ var portalSessionCreate = function (_a) {
4372
4357
  });
4373
4358
  };
4374
4359
 
4375
- var showErrorNotification = common.NotificationUtils.useErrorNotification();
4360
+ var showErrorNotification = common.useErrorNotification();
4376
4361
  function Signup(_a) {
4377
- var priceListCode = _a.priceListCode, returnUrl = _a.returnUrl;
4362
+ var companyName = _a.companyName, entityId = _a.entityId, priceListCode = _a.priceListCode, returnUrl = _a.returnUrl;
4378
4363
  // Hooks
4379
- var _b = React.useContext(BunnyContext), subdomain = _b.subdomain, token = _b.token, window = _b.window;
4380
- reactQuery.useQuery({
4381
- queryKey: common.QueryKeyFactory.default.currentUserKey,
4382
- queryFn: function () { return getCurrentUserData({ token: token, subdomain: subdomain }); },
4383
- });
4384
- var isMobile = useIsMobile(window);
4364
+ var _b = React.useContext(BunnyContext), apiHost = _b.apiHost, token = _b.token, window = _b.window;
4365
+ var isMobile = common.useIsMobile(window);
4385
4366
  var topNavImageUrl = React.useContext(BrandContext).topNavImageUrl;
4386
- var entityId = common.useCurrentUserData().entityId;
4387
4367
  var _c = React.useState(undefined), quote = _c[0], setQuote = _c[1];
4388
4368
  var _d = React.useState(undefined), accountId = _d[0], setAccountId = _d[1];
4389
4369
  var _e = React.useState(undefined), quoteId = _e[0], setQuoteId = _e[1];
@@ -4395,7 +4375,7 @@ function Signup(_a) {
4395
4375
  // Queries
4396
4376
  var priceListData = reactQuery.useQuery({
4397
4377
  queryKey: ["priceList", priceListCode],
4398
- queryFn: function () { return getPriceList({ token: token, subdomain: subdomain, code: priceListCode }); },
4378
+ queryFn: function () { return getPriceList({ token: token, apiHost: apiHost, code: priceListCode }); },
4399
4379
  }).data;
4400
4380
  function handleSubmit(formData) {
4401
4381
  return __awaiter(this, void 0, void 0, function () {
@@ -4407,7 +4387,7 @@ function Signup(_a) {
4407
4387
  setFormData(formData);
4408
4388
  return [4 /*yield*/, quoteAccountSignup({
4409
4389
  token: token,
4410
- subdomain: subdomain,
4390
+ apiHost: apiHost,
4411
4391
  entityId: entityId,
4412
4392
  priceListCode: priceListCode,
4413
4393
  accountName: formData.accountName,
@@ -4422,7 +4402,7 @@ function Signup(_a) {
4422
4402
  setAccountId(data.account.id);
4423
4403
  return [4 /*yield*/, portalSessionCreate({
4424
4404
  token: token,
4425
- subdomain: subdomain,
4405
+ apiHost: apiHost,
4426
4406
  tenantCode: data.tenant.code,
4427
4407
  expiry: 24,
4428
4408
  returnUrl: returnUrl || "",
@@ -4464,7 +4444,7 @@ function Signup(_a) {
4464
4444
  }
4465
4445
  return [4 /*yield*/, accountSignup({
4466
4446
  token: portalSessionToken,
4467
- subdomain: subdomain,
4447
+ apiHost: apiHost,
4468
4448
  entityId: entityId,
4469
4449
  quoteId: quoteId,
4470
4450
  paymentMethodId: (_a = paymentSuccess.savedPaymentMethodResponse) === null || _a === void 0 ? void 0 : _a.paymentMethodId.toString(),
@@ -4486,347 +4466,17 @@ function Signup(_a) {
4486
4466
  setIsPaying(false);
4487
4467
  }
4488
4468
  if (isMobile) {
4489
- return (jsxRuntime.jsx(Card, __assign({ className: "p-4 flex flex-col" }, { children: purchaseSucceeded ? (jsxRuntime.jsx(PaymentSuccessDisplay, { className: "w-full", amountPaid: (quote === null || quote === void 0 ? void 0 : quote.amountDue) || 0, returnUrl: returnUrl })) : (jsxRuntime.jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col" : "flex-row", " h-full w-full") }, { children: [jsxRuntime.jsx("div", __assign({ className: "flex flex-col items-center" }, { children: jsxRuntime.jsx(PriceListDisplay, { priceListData: priceListData, topNavImageUrl: topNavImageUrl }) })), jsxRuntime.jsx("div", __assign({ className: "mx-8" }, { children: jsxRuntime.jsx(antd.Divider, { className: "h-full" }) })), jsxRuntime.jsx("div", __assign({ className: "flex items-center justify-center my-12" }, { children: jsxRuntime.jsx(PaymentForms, { quote: quote, paying: paying, setIsPaying: setIsPaying, handlePaymentSaveSuccess: handlePaymentSaveSuccess, handlePaymentFail: handlePaymentFail, handleSubmit: handleSubmit, proceedingToPayment: proceedingToPayment, accountId: accountId || "" }) }))] }))) })));
4469
+ return (jsxRuntime.jsx(Card, __assign({ className: "p-4 flex flex-col" }, { children: purchaseSucceeded ? (jsxRuntime.jsx(PaymentSuccessDisplay, { amountPaid: (quote === null || quote === void 0 ? void 0 : quote.amountDue) || 0, className: "w-full", companyName: companyName, returnUrl: returnUrl })) : (jsxRuntime.jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col" : "flex-row", " h-full w-full") }, { children: [jsxRuntime.jsx("div", __assign({ className: "flex flex-col items-center" }, { children: jsxRuntime.jsx(PriceListDisplay, { priceListData: priceListData, topNavImageUrl: topNavImageUrl }) })), jsxRuntime.jsx("div", __assign({ className: "mx-8" }, { children: jsxRuntime.jsx(antd.Divider, { className: "h-full" }) })), jsxRuntime.jsx("div", __assign({ className: "flex items-center justify-center my-12" }, { children: jsxRuntime.jsx(PaymentForms, { entityId: entityId, quote: quote, paying: paying, setIsPaying: setIsPaying, handlePaymentSaveSuccess: handlePaymentSaveSuccess, handlePaymentFail: handlePaymentFail, handleSubmit: handleSubmit, proceedingToPayment: proceedingToPayment, accountId: accountId || "" }) }))] }))) })));
4490
4470
  }
4491
4471
  else {
4492
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Card, __assign({ className: "p-4 flex flex-col w-screen h-screen" }, { children: purchaseSucceeded ? (jsxRuntime.jsx(PaymentSuccessDisplay, { className: "w-full", amountPaid: (quote === null || quote === void 0 ? void 0 : quote.amountDue) || 0, returnUrl: returnUrl })) : (jsxRuntime.jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col" : "flex-row", " h-full w-full") }, { children: [jsxRuntime.jsx("div", __assign({ className: "flex flex-col w-1/2 items-center" }, { children: jsxRuntime.jsx(PriceListDisplay, { priceListData: priceListData, topNavImageUrl: topNavImageUrl }) })), jsxRuntime.jsx("div", __assign({ className: "my-4" }, { children: jsxRuntime.jsx(antd.Divider, { className: "h-full", type: "vertical" }) })), jsxRuntime.jsx("div", __assign({ className: "flex w-1/2 items-center justify-center my-12" }, { children: jsxRuntime.jsx(PaymentForms, { quote: quote, paying: paying, setIsPaying: setIsPaying, handlePaymentSaveSuccess: handlePaymentSaveSuccess, handlePaymentFail: handlePaymentFail, handleSubmit: handleSubmit, proceedingToPayment: proceedingToPayment, accountId: accountId || "" }) }))] }))) })), jsxRuntime.jsx(Footer, {})] }));
4472
+ return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx(Card, __assign({ className: "p-4 flex flex-col w-screen h-screen" }, { children: purchaseSucceeded ? (jsxRuntime.jsx(PaymentSuccessDisplay, { amountPaid: (quote === null || quote === void 0 ? void 0 : quote.amountDue) || 0, className: "w-full", companyName: companyName, returnUrl: returnUrl })) : (jsxRuntime.jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col" : "flex-row", " h-full w-full") }, { children: [jsxRuntime.jsx("div", __assign({ className: "flex flex-col w-1/2 items-center" }, { children: jsxRuntime.jsx(PriceListDisplay, { priceListData: priceListData, topNavImageUrl: topNavImageUrl }) })), jsxRuntime.jsx("div", __assign({ className: "my-4" }, { children: jsxRuntime.jsx(antd.Divider, { className: "h-full", type: "vertical" }) })), jsxRuntime.jsx("div", __assign({ className: "flex w-1/2 items-center justify-center my-12" }, { children: jsxRuntime.jsx(PaymentForms, { entityId: entityId, quote: quote, paying: paying, setIsPaying: setIsPaying, handlePaymentSaveSuccess: handlePaymentSaveSuccess, handlePaymentFail: handlePaymentFail, handleSubmit: handleSubmit, proceedingToPayment: proceedingToPayment, accountId: accountId || "" }) }))] }))) })) }));
4493
4473
  }
4494
4474
  }
4495
4475
 
4496
- var updatingChargeQuantityIdState = recoil.atom({
4497
- key: "updatingChargeQuantityIdState",
4498
- default: undefined,
4499
- });
4500
-
4501
- var canShowQuantitiesInput = function (charge, subscription) {
4502
- // Check if the subscription is active, pending, or in trial,
4503
- // the pricing model is not flat,
4504
- // and if it's not a trial, also check if the current charge is the last one in the subscription.
4505
- var _a, _b, _c;
4506
- var isActiveSubscription = ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === common.SubscriptionState.ACTIVE;
4507
- var isPendingSubscription = ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === common.SubscriptionState.PENDING;
4508
- var isTrialSubscription = ((_c = subscription.state) === null || _c === void 0 ? void 0 : _c.toUpperCase()) === common.SubscriptionState.TRIAL;
4509
- var isFlatPricing = charge.pricingModel === "FLAT";
4510
- var shouldProcessCharge = (isActiveSubscription || isPendingSubscription || isTrialSubscription) &&
4511
- !isFlatPricing &&
4512
- charge.selfServiceQuantity &&
4513
- !charge.expired;
4514
- // Now you can use the value of shouldProcessCharge to determine whether to process the charge.
4515
- return shouldProcessCharge;
4516
- };
4517
- var createQuoteParams = function (quote, subscriptionQuantity, editedSubscription) {
4518
- var quoteChange = quote.quoteChanges.find(function (quoteChange) {
4519
- return quoteChange.priceList.id === (editedSubscription === null || editedSubscription === void 0 ? void 0 : editedSubscription.subscription.priceList.id);
4520
- });
4521
- var quoteChangeCharge = quoteChange === null || quoteChange === void 0 ? void 0 : quoteChange.charges.find(function (charge) { return charge.priceListCharge.id === editedSubscription.chargeId; });
4522
- var charges = [
4523
- {
4524
- id: quoteChangeCharge.id,
4525
- quantity: editedSubscription.quantity - subscriptionQuantity,
4526
- },
4527
- ];
4528
- return { charges: charges, quoteChange: quoteChange };
4529
- };
4530
- var canShowChangeQuantities = function (_a) {
4531
- var subscriptions = _a.subscriptions;
4532
- return subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.some(function (subscription) {
4533
- return subscription.charges.some(function (charge, chargeIndex) {
4534
- return canShowQuantitiesInput(charge, subscription);
4535
- });
4536
- });
4537
- };
4538
- var isSubscriptionNotActive = function (subscription) {
4539
- var _a, _b;
4540
- return ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === common.SubscriptionState.EXPIRED ||
4541
- ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === common.SubscriptionState.CANCELED;
4542
- };
4543
- var canShowSubscriptionActions = function (subscription) {
4544
- var _a, _b;
4545
- return ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === common.SubscriptionState.ACTIVE ||
4546
- ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === common.SubscriptionState.PENDING;
4547
- };
4548
-
4549
- var useCreateSubscriptionQuote = function () {
4550
- var graphQLRequest = useGraphQLRequest();
4551
- return function (subscriptionIds, token) { return __awaiter(void 0, void 0, void 0, function () {
4552
- var data;
4553
- return __generator(this, function (_a) {
4554
- switch (_a.label) {
4555
- 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, {
4556
- subscriptionIds: subscriptionIds,
4557
- })];
4558
- case 1:
4559
- data = _a.sent();
4560
- return [2 /*return*/, data];
4561
- }
4562
- });
4563
- }); };
4564
- };
4565
- var useQuoteChangeUpdate = function () {
4566
- var graphQLRequest = useGraphQLRequest();
4567
- return function (charges, quoteChangeId, token) { return __awaiter(void 0, void 0, void 0, function () {
4568
- var response;
4569
- return __generator(this, function (_a) {
4570
- switch (_a.label) {
4571
- 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 })];
4572
- case 1:
4573
- response = _a.sent();
4574
- return [2 /*return*/, response];
4575
- }
4576
- });
4577
- }); };
4578
- };
4579
- var useQuoteDelete = function () {
4580
- var graphQLRequest = useGraphQLRequest();
4581
- return function (quoteId, token) { return __awaiter(void 0, void 0, void 0, function () {
4582
- var response;
4583
- return __generator(this, function (_a) {
4584
- switch (_a.label) {
4585
- case 0: return [4 /*yield*/, graphQLRequest("mutation QuoteDelete($id: ID!) {\n quoteDelete(id: $id) {\n errors\n }\n }", token, { id: quoteId })];
4586
- case 1:
4587
- response = _a.sent();
4588
- return [2 /*return*/, response];
4589
- }
4590
- });
4591
- }); };
4592
- };
4593
-
4594
- var QuantityInput = function (_a) {
4595
- var charge = _a.charge, chargeIndex = _a.chargeIndex, editingQuote = _a.editingQuote, setEditingQuoteData = _a.setEditingQuoteData, subscription = _a.subscription, subscriptionIndex = _a.subscriptionIndex, subscriptions = _a.subscriptions;
4596
- // Context
4597
- var token = React.useContext(BunnyContext).token;
4598
- // Recoil state
4599
- var _b = recoil.useRecoilState(updatingChargeQuantityIdState), updatingChargeQuantityId = _b[0], setUpdatingChargeQuantityId = _b[1];
4600
- // Local state
4601
- var _c = React.useState(), editedSubscription = _c[0], setEditedSubscription = _c[1];
4602
- // Hooks
4603
- var queryClient = reactQuery.useQueryClient();
4604
- var handleAllErrorFormats = common.NotificationUtils.useAllErrorFormats(function () { });
4605
- var createSubscriptionQuote = useCreateSubscriptionQuote();
4606
- var quoteChangeUpdate = useQuoteChangeUpdate();
4607
- var isMobile = common.useIsMobile();
4608
- var showErrorNotification = common.NotificationUtils.useErrorNotification();
4609
- var quantityDisabled =
4610
- // If we are editing a quote, we disable the quantity input
4611
- // If we don't have a editedSubscription, we disable the quantity input
4612
- (updatingChargeQuantityId && updatingChargeQuantityId !== charge.id) ||
4613
- // If the subscription is not self-service, we disable the quantity input
4614
- !charge.selfServiceQuantity;
4615
- var value = (editedSubscription === null || editedSubscription === void 0 ? void 0 : editedSubscription.quantity) === undefined
4616
- ? ""
4617
- : editedSubscription.quantity;
4618
- // Mutations
4619
- var createQuote = reactQuery.useMutation({
4620
- mutationFn: function (subscriptionIds) {
4621
- return createSubscriptionQuote(subscriptionIds, token);
4622
- },
4623
- onError: handleAllErrorFormats,
4624
- onSuccess: function (subscriptionUpdateData) {
4625
- var _a;
4626
- var quote = (_a = subscriptionUpdateData === null || subscriptionUpdateData === void 0 ? void 0 : subscriptionUpdateData.quoteSubscriptionUpdate) === null || _a === void 0 ? void 0 : _a.quote;
4627
- var _b = createQuoteParams(quote, charge.quantity, editedSubscription), charges = _b.charges, quoteChange = _b.quoteChange;
4628
- if (quoteChange && charges[0].quantity > 0) {
4629
- updateQuote.mutate({
4630
- charges: charges,
4631
- quoteChangeId: quoteChange.id,
4632
- });
4633
- }
4634
- },
4635
- });
4636
- var updateQuote = reactQuery.useMutation({
4637
- mutationFn: function (_a) {
4638
- var charges = _a.charges, quoteChangeId = _a.quoteChangeId;
4639
- return quoteChangeUpdate(charges, quoteChangeId, token);
4640
- },
4641
- onSuccess: function (response) {
4642
- var _a, _b, _c, _d, _e, _f;
4643
- if (!(editingQuote === null || editingQuote === void 0 ? void 0 : editingQuote.id)) {
4644
- 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()) ===
4645
- common.SubscriptionState.TRIAL;
4646
- setEditingQuoteData({
4647
- id: (_d = (_c = response.quoteChangeUpdate) === null || _c === void 0 ? void 0 : _c.quoteChange) === null || _d === void 0 ? void 0 : _d.quoteId,
4648
- isTrial: isTrial,
4649
- });
4650
- }
4651
- queryClient.invalidateQueries({
4652
- queryKey: common.QueryKeyFactory.default.createObjectKey("editingQuote", (_f = (_e = response.quoteChangeUpdate) === null || _e === void 0 ? void 0 : _e.quoteChange) === null || _f === void 0 ? void 0 : _f.quoteId),
4653
- });
4654
- },
4655
- });
4656
- // Handlers
4657
- var isQuantityLowerThanOriginal = function (quantity) {
4658
- return (editedSubscription === null || editedSubscription === void 0 ? void 0 : editedSubscription.quantity) !== undefined &&
4659
- editedSubscription.quantity <= quantity;
4660
- };
4661
- var onChangeQuantity = function (chargeIndex, value, priceListChargeId, subscription, subscriptionIndex) {
4662
- var quantity = isNaN(parseInt(value)) ? 0 : parseInt(value);
4663
- setEditedSubscription({
4664
- chargeIndex: chargeIndex,
4665
- subscriptionIndex: subscriptionIndex,
4666
- chargeId: priceListChargeId,
4667
- quantity: quantity,
4668
- subscription: subscription,
4669
- });
4670
- if (quantity !== charge.quantity) {
4671
- setUpdatingChargeQuantityId(charge.id);
4672
- }
4673
- else {
4674
- setUpdatingChargeQuantityId(undefined);
4675
- }
4676
- };
4677
- var handleSubscriptionUpdate = function (editedSubscription) {
4678
- if (!editedSubscription)
4679
- return;
4680
- // If we are not editing a quote, we create a new one
4681
- if (!editingQuote) {
4682
- var subscriptionIds = [];
4683
- var charge_1 = subscriptions[editedSubscription.subscriptionIndex].charges[editedSubscription.chargeIndex];
4684
- if (isQuantityLowerThanOriginal(charge_1.quantity)) {
4685
- // If the quantity is lower than the original, we remove the quote
4686
- setEditingQuoteData(undefined);
4687
- setUpdatingChargeQuantityId(undefined);
4688
- return;
4689
- }
4690
- subscriptionIds.push(editedSubscription.subscription.id);
4691
- createQuote.mutate(subscriptionIds);
4692
- }
4693
- else {
4694
- // If we are editing a quote, we update the quote change
4695
- var _a = createQuoteParams(editingQuote, charge.quantity, editedSubscription), charges = _a.charges, quoteChange = _a.quoteChange;
4696
- if (quoteChange && charges[0].quantity > 0) {
4697
- updateQuote.mutate({
4698
- charges: charges,
4699
- quoteChangeId: quoteChange.id,
4700
- });
4701
- }
4702
- else {
4703
- // Reset the editing quote data and the updating charge quantity ID to their initial states
4704
- setEditingQuoteData(undefined);
4705
- setUpdatingChargeQuantityId(undefined);
4706
- }
4707
- }
4708
- };
4709
- // Initial subscription quantity if is on mobile
4710
- React.useEffect(function () {
4711
- if (isMobile && !editedSubscription && !quantityDisabled) {
4712
- setEditedSubscription({
4713
- chargeIndex: chargeIndex,
4714
- subscriptionIndex: subscriptionIndex,
4715
- chargeId: charge.priceListChargeId,
4716
- quantity: charge.quantity,
4717
- subscription: subscription,
4718
- });
4719
- }
4720
- }, [
4721
- charge,
4722
- chargeIndex,
4723
- editedSubscription,
4724
- isMobile,
4725
- quantityDisabled,
4726
- subscription,
4727
- subscriptionIndex,
4728
- ]);
4729
- // Edit subscription debounce
4730
- React.useEffect(function () {
4731
- var debounce = setTimeout(function () {
4732
- handleSubscriptionUpdate(editedSubscription);
4733
- }, 1000);
4734
- return function () { return clearTimeout(debounce); };
4735
- // eslint-disable-next-line
4736
- }, [editedSubscription]);
4737
- return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx(antd.Input, { className: "text-right", disabled: quantityDisabled, onBlur: function () {
4738
- if (typeof value === "number" && value < charge.quantity) {
4739
- showErrorNotification("New value is less than the original quantity. This is not allowed");
4740
- }
4741
- }, onChange: function (e) {
4742
- onChangeQuantity(chargeIndex, e.target.value, charge.priceListChargeId, subscription, subscriptionIndex);
4743
- }, status: isQuantityLowerThanOriginal(charge.quantity) ? "error" : "", style: { width: "96px" }, value: value }) }));
4744
- };
4745
-
4746
- var QuantityChangeGridRow = function (_a) {
4747
- var _b;
4748
- var chargeIndex = _a.chargeIndex, editingQuote = _a.editingQuote, subscriptions = _a.subscriptions, subscriptionIndex = _a.subscriptionIndex, setEditingQuoteData = _a.setEditingQuoteData, subscription = _a.subscription, subscriptionCharge = _a.subscriptionCharge;
4749
- if (!canShowQuantitiesInput(subscriptionCharge, subscription))
4750
- return null;
4751
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", __assign({ className: "font-medium text-orange-600 col-span-full", style: { fontSize: "11px" } }, { children: subscription.plan.name })), jsxRuntime.jsx("div", __assign({ className: "font-medium text-base text-gray-900" }, { children: (_b = subscriptionCharge.name) === null || _b === void 0 ? void 0 : _b.toUpperCase() })), jsxRuntime.jsx("div", __assign({ className: "flex items-center justify-end font-medium text-base text-gray-900" }, { children: subscriptionCharge.quantity })), jsxRuntime.jsxs("div", __assign({ className: "flex flex-col items-end" }, { children: [jsxRuntime.jsx(QuantityInput, { charge: subscriptionCharge, chargeIndex: chargeIndex, editingQuote: editingQuote, setEditingQuoteData: setEditingQuoteData, subscription: subscription, subscriptionIndex: subscriptionIndex, subscriptions: subscriptions }), jsxRuntime.jsx("div", {})] })), jsxRuntime.jsx(antd.Divider, { className: "col-span-full my-2" })] }));
4752
- };
4753
-
4754
- var QuantityChangeGridTitle = function (_a) {
4755
- var children = _a.children, right = _a.right;
4756
- return (jsxRuntime.jsx("div", __assign({ className: "font-medium text-slate-600 ".concat(right ? "text-right" : "text-left"), style: { fontSize: "11px" } }, { children: children })));
4757
- };
4758
-
4759
- var QuoteChangeSummarySection = function (_a) {
4760
- var editingQuote = _a.editingQuote, editingQuoteData = _a.editingQuoteData, openCheckout = _a.openCheckout, setEditingQuoteData = _a.setEditingQuoteData;
4761
- var isMobile = common.useIsMobile();
4762
- var token = React.useContext(BunnyContext).token;
4763
- var showSuccessNotification = common.NotificationUtils.useSuccessNotification();
4764
- var trialUpgradeMutation = reactQuery.useMutation({
4765
- mutationFn: function (quoteId) { return checkout({ quoteId: quoteId, token: token }); },
4766
- onSuccess: function () {
4767
- setEditingQuoteData(undefined);
4768
- showSuccessNotification("Subscription updated successfully");
4769
- },
4770
- });
4771
- return (jsxRuntime.jsxs("div", __assign({ className: "flex flex-col items-end" }, { children: [editingQuote && (jsxRuntime.jsxs("div", __assign({ className: "flex flex-col mb-8" }, { children: [jsxRuntime.jsx("div", __assign({ className: "text-slate-500 text-right text-xs mb-2" }, { children: "TOTAL" })), jsxRuntime.jsx("div", __assign({ className: "text-right ".concat(isMobile ? "text-2xl" : "text-xl") }, { children: common.Misc.formatCurrency(getQuoteAmountDue(editingQuote), (editingQuote === null || editingQuote === void 0 ? void 0 : editingQuote.currencyId) || "") }))] }))), jsxRuntime.jsx("div", __assign({ className: "flex items-center justify-end ".concat(isMobile ? "w-full" : "") }, { children: jsxRuntime.jsx(antd.Button, __assign({ className: "w-full", onClick: (editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.isTrial)
4772
- ? function () { return trialUpgradeMutation.mutate(editingQuoteData.id); }
4773
- : openCheckout, disabled: !editingQuoteData, size: isMobile ? "large" : "middle", type: "primary" }, { children: (editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.isTrial) ? "Activate Trial" : "Proceed to checkout" })) }))] })));
4774
- };
4775
-
4776
- var QUANTITY_CHANGE_HEADER_TITLE = "Update unit quantity";
4777
- var QUANTITY_CHANGE_HEADER_DESCRIPTION = "Adjust quantities below. The change will take effect immediately after checkout has been completed.";
4778
- var QuantityChangeDrawerDesktop = function (_a) {
4779
- var editingQuote = _a.editingQuote, editingQuoteData = _a.editingQuoteData, onClose = _a.onClose, open = _a.open, openCheckout = _a.openCheckout, setEditingQuoteData = _a.setEditingQuoteData, subscriptions = _a.subscriptions;
4780
- var _b = React.useState(open), openLocal = _b[0], setOpenLocal = _b[1];
4781
- var isMobile = common.useIsMobile();
4782
- React.useEffect(function () {
4783
- var timeoutId;
4784
- if (!open) {
4785
- timeoutId = setTimeout(function () {
4786
- setOpenLocal(false);
4787
- }, 300); // Delay to allow for close animation
4788
- }
4789
- else {
4790
- setOpenLocal(true);
4791
- }
4792
- return function () { return clearTimeout(timeoutId); };
4793
- }, [open]);
4794
- if (!openLocal)
4795
- return null;
4796
- return (jsxRuntime.jsxs(antd.Drawer, __assign({ closeIcon: null, destroyOnClose: true, onClose: onClose, open: open, styles: isMobile
4797
- ? {
4798
- body: {
4799
- padding: "1rem",
4800
- overflow: "hidden",
4801
- background: common.SLATE_50,
4802
- },
4803
- wrapper: {
4804
- width: "100vw",
4805
- },
4806
- }
4807
- : {
4808
- wrapper: {
4809
- minWidth: "600px",
4810
- },
4811
- }, title: jsxRuntime.jsx(DrawerHeader, { description: QUANTITY_CHANGE_HEADER_DESCRIPTION, onClose: onClose, title: QUANTITY_CHANGE_HEADER_TITLE }) }, { children: [jsxRuntime.jsxs("div", __assign({ className: "grid pb-4", style: {
4812
- gridTemplateColumns: "2fr 1fr 1fr",
4813
- rowGap: "0.75rem",
4814
- columnGap: "1rem",
4815
- } }, { children: [jsxRuntime.jsx(QuantityChangeGridTitle, { children: "ACTIVE SUBSCRIPTIONS" }), jsxRuntime.jsx(QuantityChangeGridTitle, __assign({ right: true }, { children: "CURRENT QUANTITY" })), jsxRuntime.jsx(QuantityChangeGridTitle, __assign({ right: true }, { children: "NEW QUANTITY" })), jsxRuntime.jsx(antd.Divider, { className: "col-span-full py-2" }), subscriptions.map(function (subscription, index) {
4816
- var _a;
4817
- var isTrial = ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === common.SubscriptionState.TRIAL;
4818
- return (jsxRuntime.jsx("div", __assign({ className: "contents" }, { children: subscription.charges.map(function (charge, chargeIndex) {
4819
- if ((isTrial && !charge.trial) || (!isTrial && charge.trial))
4820
- return null;
4821
- return (jsxRuntime.jsx(QuantityChangeGridRow, { chargeIndex: chargeIndex, editingQuote: editingQuote, setEditingQuoteData: setEditingQuoteData, subscription: subscription, subscriptionCharge: charge, subscriptionIndex: index, subscriptions: subscriptions }, chargeIndex));
4822
- }) }), index));
4823
- })] })), jsxRuntime.jsx(QuoteChangeSummarySection, { editingQuote: editingQuote, editingQuoteData: editingQuoteData, openCheckout: openCheckout, setEditingQuoteData: setEditingQuoteData })] })));
4824
- };
4825
-
4826
4476
  // WARNING: There is a preview button on APP that will need to be changed if this query is changed
4827
4477
  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 }";
4828
4478
  var getPlanChangeOptions = function (_a) {
4829
- var isInPreviewMode = _a.isInPreviewMode, token = _a.token, upgradingSubscription = _a.upgradingSubscription, subdomain = _a.subdomain;
4479
+ var isInPreviewMode = _a.isInPreviewMode, token = _a.token, upgradingSubscription = _a.upgradingSubscription, apiHost = _a.apiHost;
4830
4480
  return __awaiter(void 0, void 0, void 0, function () {
4831
4481
  var response, planChangeOptions;
4832
4482
  return __generator(this, function (_b) {
@@ -4836,7 +4486,7 @@ var getPlanChangeOptions = function (_a) {
4836
4486
  query: PLAN_CHANGE_OPTIONS_QUERY,
4837
4487
  vars: { subscriptionId: upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id },
4838
4488
  token: token,
4839
- subdomain: subdomain,
4489
+ apiHost: apiHost,
4840
4490
  })];
4841
4491
  case 1:
4842
4492
  response = _b.sent();
@@ -4855,7 +4505,7 @@ var getPlanChangeOptions = function (_a) {
4855
4505
 
4856
4506
  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 }"; };
4857
4507
  var getQuote = function (_a) {
4858
- var id = _a.id, token = _a.token, subdomain = _a.subdomain;
4508
+ var id = _a.id, token = _a.token, apiHost = _a.apiHost;
4859
4509
  return __awaiter(void 0, void 0, void 0, function () {
4860
4510
  var response;
4861
4511
  return __generator(this, function (_b) {
@@ -4864,7 +4514,7 @@ var getQuote = function (_a) {
4864
4514
  query: QUOTE_QUERY(),
4865
4515
  token: token,
4866
4516
  vars: { id: id },
4867
- subdomain: subdomain,
4517
+ apiHost: apiHost,
4868
4518
  })];
4869
4519
  case 1:
4870
4520
  response = _b.sent();
@@ -4876,7 +4526,7 @@ var getQuote = function (_a) {
4876
4526
 
4877
4527
  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 }";
4878
4528
  var getSubscriptions = function (_a) {
4879
- var entityId = _a.entityId, isInPreviewMode = _a.isInPreviewMode, token = _a.token, subdomain = _a.subdomain;
4529
+ var entityId = _a.entityId, isInPreviewMode = _a.isInPreviewMode, token = _a.token, apiHost = _a.apiHost;
4880
4530
  return __awaiter(void 0, void 0, void 0, function () {
4881
4531
  var response;
4882
4532
  var _b;
@@ -4887,7 +4537,7 @@ var getSubscriptions = function (_a) {
4887
4537
  query: SUBSCRIPTIONS_QUERY,
4888
4538
  token: token,
4889
4539
  vars: { entityId: entityId },
4890
- subdomain: subdomain,
4540
+ apiHost: apiHost,
4891
4541
  })];
4892
4542
  case 1:
4893
4543
  response = _c.sent();
@@ -4957,7 +4607,7 @@ var ErrorView = function (_a) {
4957
4607
  var Text$3 = antd.Typography.Text;
4958
4608
  var HideExpiredToggle = function (_a) {
4959
4609
  var hideExpired = _a.hideExpired, setHideExpired = _a.setHideExpired, subscriptions = _a.subscriptions;
4960
- var isMobile = common.useIsMobile();
4610
+ var isMobile = common.useIsMobile(window);
4961
4611
  var secondaryColor = React.useContext(BrandContext).secondaryColor;
4962
4612
  var hasExpiredOrCanceledSubscriptions = subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.some(function (subscription) {
4963
4613
  var _a, _b;
@@ -4973,6 +4623,42 @@ var HideExpiredToggle = function (_a) {
4973
4623
  var StyledCheckbox = styled__default["default"].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"])));
4974
4624
  var templateObject_1$2;
4975
4625
 
4626
+ // import { EditingSubscriptionType } from "../../../features/quantityChangeDrawer/QuantityInput";
4627
+ var canShowQuantitiesInput = function (charge, subscription) {
4628
+ // Check if the subscription is active, pending, or in trial,
4629
+ // the pricing model is not flat,
4630
+ // and if it's not a trial, also check if the current charge is the last one in the subscription.
4631
+ var _a, _b, _c;
4632
+ var isActiveSubscription = ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === common.SubscriptionState.ACTIVE;
4633
+ var isPendingSubscription = ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === common.SubscriptionState.PENDING;
4634
+ var isTrialSubscription = ((_c = subscription.state) === null || _c === void 0 ? void 0 : _c.toUpperCase()) === common.SubscriptionState.TRIAL;
4635
+ var isFlatPricing = charge.pricingModel === "FLAT";
4636
+ var shouldProcessCharge = (isActiveSubscription || isPendingSubscription || isTrialSubscription) &&
4637
+ !isFlatPricing &&
4638
+ charge.selfServiceQuantity &&
4639
+ !charge.expired;
4640
+ // Now you can use the value of shouldProcessCharge to determine whether to process the charge.
4641
+ return shouldProcessCharge;
4642
+ };
4643
+ var canShowChangeQuantities = function (_a) {
4644
+ var subscriptions = _a.subscriptions;
4645
+ return subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.some(function (subscription) {
4646
+ return subscription.charges.some(function (charge, chargeIndex) {
4647
+ return canShowQuantitiesInput(charge, subscription);
4648
+ });
4649
+ });
4650
+ };
4651
+ var isSubscriptionNotActive = function (subscription) {
4652
+ var _a, _b;
4653
+ return ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === common.SubscriptionState.EXPIRED ||
4654
+ ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === common.SubscriptionState.CANCELED;
4655
+ };
4656
+ var canShowSubscriptionActions = function (subscription) {
4657
+ var _a, _b;
4658
+ return ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === common.SubscriptionState.ACTIVE ||
4659
+ ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === common.SubscriptionState.PENDING;
4660
+ };
4661
+
4976
4662
  var SubscriptionState;
4977
4663
  (function (SubscriptionState) {
4978
4664
  SubscriptionState["ACTIVE"] = "ACTIVE";
@@ -4985,7 +4671,7 @@ var SubscriptionState$1 = SubscriptionState;
4985
4671
 
4986
4672
  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";
4987
4673
  var getFeatureUsage = function (_a) {
4988
- var subscriptionChargeId = _a.subscriptionChargeId; _a.startDate; _a.endDate; _a.dataInterval; var token = _a.token;
4674
+ var subscriptionChargeId = _a.subscriptionChargeId; _a.startDate; _a.endDate; _a.dataInterval; var token = _a.token, apiHost = _a.apiHost;
4989
4675
  return __awaiter(void 0, void 0, void 0, function () {
4990
4676
  var vars, response;
4991
4677
  var _b;
@@ -4999,6 +4685,7 @@ var getFeatureUsage = function (_a) {
4999
4685
  query: FEATURE_USAGE_MUTATION,
5000
4686
  token: token,
5001
4687
  vars: vars,
4688
+ apiHost: apiHost,
5002
4689
  })];
5003
4690
  case 1:
5004
4691
  response = _c.sent();
@@ -5137,7 +4824,7 @@ var FeatureUsageGraph = function (_a) {
5137
4824
  }
5138
4825
  return false;
5139
4826
  }))
5140
- return "no usage";
4827
+ return jsxRuntime.jsx("div", { children: "no usage" });
5141
4828
  return (jsxRuntime.jsxs("div", __assign({ onClick: function () {
5142
4829
  setIsModalOpen(true);
5143
4830
  } }, { children: [jsxRuntime.jsx("div", __assign({ style: {
@@ -5169,7 +4856,7 @@ var templateObject_1;
5169
4856
 
5170
4857
  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";
5171
4858
  var getGuoteSubscriptionReinstate = function (_a) {
5172
- var ids = _a.ids, token = _a.token, subdomain = _a.subdomain;
4859
+ var ids = _a.ids, token = _a.token, apiHost = _a.apiHost;
5173
4860
  return __awaiter(void 0, void 0, void 0, function () {
5174
4861
  var vars, response, _b, errors, quote;
5175
4862
  return __generator(this, function (_c) {
@@ -5180,7 +4867,7 @@ var getGuoteSubscriptionReinstate = function (_a) {
5180
4867
  query: MUTATION,
5181
4868
  token: token,
5182
4869
  vars: vars,
5183
- subdomain: subdomain,
4870
+ apiHost: apiHost,
5184
4871
  })];
5185
4872
  case 1:
5186
4873
  response = _c.sent();
@@ -5193,32 +4880,16 @@ var getGuoteSubscriptionReinstate = function (_a) {
5193
4880
  });
5194
4881
  };
5195
4882
 
5196
- var useCancelSubscription = function () {
5197
- var graphQLRequest = useGraphQLRequest();
5198
- return function (subscriptionIds, token) { return __awaiter(void 0, void 0, void 0, function () {
5199
- var data;
5200
- var _a;
5201
- return __generator(this, function (_b) {
5202
- switch (_b.label) {
5203
- 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 })];
5204
- case 1:
5205
- data = _b.sent();
5206
- return [2 /*return*/, (_a = data === null || data === void 0 ? void 0 : data.subscriptions) === null || _a === void 0 ? void 0 : _a.nodes];
5207
- }
5208
- });
5209
- }); };
5210
- };
5211
-
5212
4883
  var SubscriptionCardActions = function (_a) {
5213
4884
  var _b, _c;
5214
4885
  var planChangeOptions = _a.planChangeOptions, subscription = _a.subscription, setEditingQuoteData = _a.setEditingQuoteData, setPayModalVisible = _a.setPayModalVisible;
5215
4886
  // Context
5216
- var _d = React.useContext(BunnyContext), token = _d.token, subdomain = _d.subdomain;
4887
+ var _d = React.useContext(BunnyContext), token = _d.token, apiHost = _d.apiHost;
5217
4888
  var _e = React.useContext(SubscriptionsContext), onChangePlanClick = _e.onChangePlanClick, onClickUpgrade = _e.onClickUpgrade, isTempViewOnly = _e.isTempViewOnly;
5218
4889
  // Hooks
5219
- var showSuccessNotification = common.NotificationUtils.useSuccessNotification();
5220
- var cancelSubscription = useCancelSubscription();
5221
- var queryClient = reactQuery.useQueryClient();
4890
+ common.useSuccessNotification();
4891
+ // const cancelSubscription = useCancelSubscription();
4892
+ reactQuery.useQueryClient();
5222
4893
  // const navigate = usePortalNavigate();
5223
4894
  // const handleUpgradingSubscriptionChange =
5224
4895
  // useHandleUpgradingSubscriptionChange();
@@ -5227,21 +4898,21 @@ var SubscriptionCardActions = function (_a) {
5227
4898
  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; });
5228
4899
  var canShowChangePlanButton = ((productPlans === null || productPlans === void 0 ? void 0 : productPlans.length) || 0) > 0;
5229
4900
  // Mutations
5230
- var subscriptionCancel = reactQuery.useMutation({
5231
- mutationFn: function () { return cancelSubscription([subscription.id], token); },
5232
- onSuccess: function () {
5233
- queryClient.invalidateQueries({
5234
- queryKey: common.QueryKeyFactory.default.createTableKey("subscriptions"),
5235
- });
5236
- showSuccessNotification("Subscription canceled");
5237
- },
5238
- });
4901
+ // const subscriptionCancel = useMutation({
4902
+ // mutationFn: () => cancelSubscription([subscription.id], token),
4903
+ // onSuccess: () => {
4904
+ // queryClient.invalidateQueries({
4905
+ // queryKey: QueryKeyFactory.default.createTableKey("subscriptions"),
4906
+ // });
4907
+ // showSuccessNotification("Subscription canceled");
4908
+ // },
4909
+ // });
5239
4910
  reactQuery.useMutation({
5240
4911
  mutationFn: function () {
5241
4912
  return getGuoteSubscriptionReinstate({
5242
4913
  ids: [subscription.id],
5243
4914
  token: token,
5244
- subdomain: subdomain,
4915
+ apiHost: apiHost,
5245
4916
  });
5246
4917
  },
5247
4918
  onSuccess: function (quote) {
@@ -5261,7 +4932,9 @@ var SubscriptionCardActions = function (_a) {
5261
4932
  onChangePlanClick();
5262
4933
  };
5263
4934
  return (canShowChangePlanButton || canShowCancelButton) &&
5264
- canShowSubscriptionActions(subscription) ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!isTempViewOnly && canShowCancelButton && (jsxRuntime.jsx(antd.Popconfirm, __assign({ icon: null, onConfirm: function () { return subscriptionCancel.mutate(); }, title: "Cancel subscription" }, { children: jsxRuntime.jsx(antd.Button, __assign({ className: "p-0", type: "link" }, { children: "Cancel subscription" })) }))), !isTempViewOnly && canShowChangePlanButton && (jsxRuntime.jsx(antd.Button, __assign({ onClick: function () { return handleChangePlanClick(); }, type: "primary" }, { children: "Change plan" })))] })) : ((_c = subscription.state) === null || _c === void 0 ? void 0 : _c.toUpperCase()) === common.SubscriptionState.TRIAL ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: !isTempViewOnly && (jsxRuntime.jsx(antd.Button, __assign({ onClick: function () {
4935
+ canShowSubscriptionActions(subscription) ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!isTempViewOnly && canShowCancelButton && (jsxRuntime.jsx(antd.Popconfirm, __assign({ icon: null,
4936
+ // onConfirm={() => subscriptionCancel.mutate()}
4937
+ title: "Cancel subscription" }, { children: jsxRuntime.jsx(antd.Button, __assign({ className: "p-0", type: "link" }, { children: "Cancel subscription" })) }))), !isTempViewOnly && canShowChangePlanButton && (jsxRuntime.jsx(antd.Button, __assign({ onClick: function () { return handleChangePlanClick(); }, type: "primary" }, { children: "Change plan" })))] })) : ((_c = subscription.state) === null || _c === void 0 ? void 0 : _c.toUpperCase()) === common.SubscriptionState.TRIAL ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: !isTempViewOnly && (jsxRuntime.jsx(antd.Button, __assign({ onClick: function () {
5265
4938
  // handleUpgradingSubscriptionChange({
5266
4939
  // subscription,
5267
4940
  // });
@@ -5279,22 +4952,22 @@ var getSubscriptionStatusText = function (subscription) {
5279
4952
  if (cancellationDate &&
5280
4953
  (state === null || state === void 0 ? void 0 : state.toUpperCase()) !== common.SubscriptionState.CANCELED &&
5281
4954
  (state === null || state === void 0 ? void 0 : state.toUpperCase()) !== common.SubscriptionState.EXPIRED) {
5282
- return (jsxRuntime.jsxs(antd.Tag, __assign({ color: "red" }, { children: ["Canceled - ends on ", common.Misc.formatDate(cancellationDate)] })));
4955
+ return (jsxRuntime.jsxs(antd.Tag, __assign({ color: "red" }, { children: ["Canceled - ends on ", common.formatDate(cancellationDate)] })));
5283
4956
  }
5284
4957
  if (evergreen) {
5285
- return "Renews on ".concat(common.Misc.formatDate(endDate));
4958
+ return "Renews on ".concat(common.formatDate(endDate));
5286
4959
  }
5287
4960
  if ((state === null || state === void 0 ? void 0 : state.toUpperCase()) === common.SubscriptionState.CANCELED ||
5288
4961
  (state === null || state === void 0 ? void 0 : state.toUpperCase()) === common.SubscriptionState.EXPIRED) {
5289
- return "Ended on ".concat(common.Misc.formatDate(endDate));
4962
+ return "Ended on ".concat(common.formatDate(endDate));
5290
4963
  }
5291
- return "Ends on ".concat(common.Misc.formatDate(endDate));
4964
+ return "Ends on ".concat(common.formatDate(endDate));
5292
4965
  };
5293
4966
  var SubscriptionCardHeader = function (_a) {
5294
4967
  var _b, _c, _d, _e, _f;
5295
4968
  var planChangeOptions = _a.planChangeOptions, setEditingQuoteData = _a.setEditingQuoteData, setPayModalVisible = _a.setPayModalVisible, subscription = _a.subscription;
5296
4969
  var darkMode = React.useContext(BunnyContext).darkMode;
5297
- var isMobile = common.useIsMobile();
4970
+ var isMobile = common.useIsMobile(window);
5298
4971
  // Derived state
5299
4972
  var trialDaysLeft = dayjs(subscription.trialEndDate).diff(dayjs(), "days");
5300
4973
  var isTrial = ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === common.SubscriptionState.TRIAL;
@@ -5313,8 +4986,8 @@ var BillingPeriodConverter;
5313
4986
  })(BillingPeriodConverter || (BillingPeriodConverter = {}));
5314
4987
  var SubscriptionChargeTotal = function (_a) {
5315
4988
  var charge = _a.charge, subscription = _a.subscription;
5316
- var isMobile = common.useIsMobile();
5317
- return (jsxRuntime.jsxs("div", __assign({ className: "flex gap-1 ".concat(isMobile ? "flex-col" : "") }, { children: [jsxRuntime.jsx("div", { children: common.Misc.formatCurrency(Number(charge.periodPrice), subscription.currencyId) }), charge.billingPeriod && (jsxRuntime.jsx("div", { children: BillingPeriodConverter[charge.billingPeriod] }))] })));
4989
+ var isMobile = common.useIsMobile(window);
4990
+ return (jsxRuntime.jsxs("div", __assign({ className: "flex gap-1 ".concat(isMobile ? "flex-col" : "") }, { children: [jsxRuntime.jsx("div", { children: common.formatCurrency(Number(charge.periodPrice), subscription.currencyId) }), charge.billingPeriod && (jsxRuntime.jsx("div", { children: BillingPeriodConverter[charge.billingPeriod] }))] })));
5318
4991
  };
5319
4992
 
5320
4993
  var SubscriptionChargeUnitPrice = function (_a) {
@@ -5334,16 +5007,16 @@ var SubscriptionChargeUnitPrice = function (_a) {
5334
5007
  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)
5335
5008
  ? ((_e = (_d = charge.priceListCharge) === null || _d === void 0 ? void 0 : _d.priceListChargeTiers[index + 1]) === null || _e === void 0 ? void 0 : _e.starts) - 1
5336
5009
  : "∞";
5337
- return (jsxRuntime.jsxs("div", __assign({ className: "contents" }, { children: [jsxRuntime.jsxs("div", __assign({ className: "whitespace-nowrap" }, { children: [tier.starts.toLocaleString(), " - ", ends.toLocaleString(), " ", ":"] })), jsxRuntime.jsx("div", __assign({ className: "whitespace-nowrap text-right" }, { children: common.Misc.formatCurrency(tier.price, subscription.currencyId, charge.priceDecimals) }))] }), index));
5010
+ return (jsxRuntime.jsxs("div", __assign({ className: "contents" }, { children: [jsxRuntime.jsxs("div", __assign({ className: "whitespace-nowrap" }, { children: [tier.starts.toLocaleString(), " - ", ends.toLocaleString(), " ", ":"] })), jsxRuntime.jsx("div", __assign({ className: "whitespace-nowrap text-right" }, { children: common.formatCurrency(tier.price, subscription.currencyId, charge.priceDecimals) }))] }), index));
5338
5011
  }) })) })));
5339
5012
  }, onOpenChange: setShowPriceTiers, open: showPriceTiers, trigger: ["click"] }, { children: jsxRuntime.jsx("div", __assign({ className: "cursor-pointer underline", onClick: function () { return setShowPriceTiers(!showPriceTiers); } }, { children: showPriceTiers ? "hide details" : "show details" })) })));
5340
5013
  }
5341
- return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: common.Misc.formatCurrency(charge.discountedPrice, subscription.currencyId) }));
5014
+ return jsxRuntime.jsx(jsxRuntime.Fragment, { children: common.formatCurrency(charge.discountedPrice, subscription.currencyId) });
5342
5015
  };
5343
5016
 
5344
5017
  var SubscriptionCardColumnHeaders = function (_a) {
5345
5018
  var columns = _a.columns;
5346
- return columns.map(function (subscriptionColumn, index) { return (jsxRuntime.jsx("div", __assign({ className: "text-slate-400 ".concat(subscriptionColumn.className), style: { fontSize: "11px" } }, { children: subscriptionColumn.title }), index)); });
5019
+ return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: columns.map(function (subscriptionColumn, index) { return (jsxRuntime.jsx("div", __assign({ className: "text-slate-400 ".concat(subscriptionColumn.className), style: { fontSize: "11px" } }, { children: subscriptionColumn.title }), index)); }) }));
5347
5020
  };
5348
5021
 
5349
5022
  var Text$1 = antd.Typography.Text;
@@ -5400,13 +5073,13 @@ var SubscriptionCardDesktop = function (_a) {
5400
5073
  var SubscriptionCardDesktopRow = function (_a) {
5401
5074
  var charge = _a.charge, chargeIndex = _a.chargeIndex, subscription = _a.subscription;
5402
5075
  // Context
5403
- var token = React.useContext(BunnyContext).token;
5076
+ var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
5404
5077
  // Derived state
5405
5078
  var isRamp = charge.isRamp;
5406
5079
  var prevCharge = subscription.charges[chargeIndex - 1];
5407
5080
  var isFirstRampRow = chargeIndex === 0 ||
5408
5081
  (prevCharge === null || prevCharge === void 0 ? void 0 : prevCharge.priceListChargeId) !== charge.priceListChargeId;
5409
- var chargePeriod = "".concat(common.Misc.formatDate(charge.startDate), " - ").concat(common.Misc.formatDate(charge.endDate));
5082
+ var chargePeriod = "".concat(common.formatDate(charge.startDate), " - ").concat(common.formatDate(charge.endDate));
5410
5083
  // Queries
5411
5084
  var data = reactQuery.useQuery({
5412
5085
  queryKey: ["getFeatureUsage", charge.id, charge.startDate, charge.endDate],
@@ -5416,6 +5089,7 @@ var SubscriptionCardDesktopRow = function (_a) {
5416
5089
  startDate: charge.startDate,
5417
5090
  subscriptionChargeId: charge.id,
5418
5091
  token: token,
5092
+ apiHost: apiHost,
5419
5093
  });
5420
5094
  },
5421
5095
  enabled: (!isRamp || (isRamp && isFirstRampRow)) &&
@@ -5475,7 +5149,7 @@ var SubscriptionCard = function (_a) {
5475
5149
  if ((isTrial && !charge.trial) || (!isTrial && charge.trial))
5476
5150
  return null;
5477
5151
  var isRamp = charge.isRamp;
5478
- var chargePeriod = "".concat(common.Misc.formatDate(charge.startDate), " - ").concat(common.Misc.formatDate(charge.endDate));
5152
+ var chargePeriod = "".concat(common.formatDate(charge.startDate), " - ").concat(common.formatDate(charge.endDate));
5479
5153
  return (jsxRuntime.jsxs("div", __assign({ className: "contents" }, { children: [((isRamp && chargeIndex === 0) || !isRamp) && (jsxRuntime.jsxs(SubscriptionCardCellMobile, __assign({ className: CHARGE_COLUMNS[0].className, style: { gridColumn: isRamp ? "1/-1" : "1" } }, { children: [jsxRuntime.jsx("span", { children: charge.name }), !isRamp ? " - ".concat(chargePeriod) : ""] }))), isRamp && (jsxRuntime.jsx(SubscriptionCardCellMobile, __assign({ className: CHARGE_COLUMNS[0].className }, { children: "- ".concat(chargePeriod) }))), jsxRuntime.jsx(SubscriptionCardCellMobile, __assign({ className: CHARGE_COLUMNS[1].className }, { children: charge.quantity })), jsxRuntime.jsx(SubscriptionCardCellMobile, __assign({ className: CHARGE_COLUMNS[2].className }, { children: jsxRuntime.jsx(SubscriptionChargeUnitPrice, { charge: charge, subscription: subscription }) })), jsxRuntime.jsx(SubscriptionCardCellMobile, __assign({ className: CHARGE_COLUMNS[3].className }, { children: jsxRuntime.jsx(SubscriptionChargeTotal, { charge: charge, subscription: subscription }) }))] }), chargeIndex));
5480
5154
  })] })), jsxRuntime.jsx("div", __assign({ className: "flex gap-2 pt-5", style: {
5481
5155
  flexDirection: "column-reverse",
@@ -5484,14 +5158,14 @@ var SubscriptionCard = function (_a) {
5484
5158
 
5485
5159
  var SubscriptionsList = function (_a) {
5486
5160
  var hideExpired = _a.hideExpired, planChangeOptions = _a.planChangeOptions, setEditingQuoteData = _a.setEditingQuoteData, setPayModalVisible = _a.setPayModalVisible, subscriptions = _a.subscriptions;
5487
- var isMobile = common.useIsMobile();
5488
- return subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.map(function (subscription, subscriptionIndex) {
5489
- if (hideExpired && isSubscriptionNotActive(subscription))
5490
- return null;
5491
- if (isMobile)
5492
- return (jsxRuntime.jsx(SubscriptionCard, { planChangeOptions: planChangeOptions, setEditingQuoteData: setEditingQuoteData, setPayModalVisible: setPayModalVisible, subscription: subscription }, subscriptionIndex));
5493
- return (jsxRuntime.jsx(SubscriptionCardDesktop, { planChangeOptions: planChangeOptions, setEditingQuoteData: setEditingQuoteData, setPayModalVisible: setPayModalVisible, subscription: subscription }, subscriptionIndex));
5494
- });
5161
+ var isMobile = common.useIsMobile(window);
5162
+ return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.map(function (subscription, subscriptionIndex) {
5163
+ if (hideExpired && isSubscriptionNotActive(subscription))
5164
+ return null;
5165
+ if (isMobile)
5166
+ return (jsxRuntime.jsx(SubscriptionCard, { planChangeOptions: planChangeOptions, setEditingQuoteData: setEditingQuoteData, setPayModalVisible: setPayModalVisible, subscription: subscription }, subscriptionIndex));
5167
+ return (jsxRuntime.jsx(SubscriptionCardDesktop, { planChangeOptions: planChangeOptions, setEditingQuoteData: setEditingQuoteData, setPayModalVisible: setPayModalVisible, subscription: subscription }, subscriptionIndex));
5168
+ }) }));
5495
5169
  };
5496
5170
 
5497
5171
  var ChangeQuantitiesButton = function (_a) {
@@ -5507,7 +5181,7 @@ var SubscriptionsNavigation = function (_a) {
5507
5181
  var hideExpired = _a.hideExpired, setHideExpired = _a.setHideExpired, setQuantityDrawerOpen = _a.setQuantityDrawerOpen, subscriptions = _a.subscriptions;
5508
5182
  var isTempViewOnly = React.useContext(SubscriptionsContext).isTempViewOnly;
5509
5183
  // Hooks
5510
- var isMobile = common.useIsMobile();
5184
+ var isMobile = common.useIsMobile(window);
5511
5185
  // Derived state
5512
5186
  var canShowChangeQuantitiesButton = canShowChangeQuantities({
5513
5187
  subscriptions: subscriptions,
@@ -5516,44 +5190,48 @@ var SubscriptionsNavigation = function (_a) {
5516
5190
  };
5517
5191
 
5518
5192
  var SubscriptionsContext = React.createContext({});
5193
+ // !!! This component is intended to be view only, however it still has lots of code for full functionality.
5194
+ // !!! This must be refactored.
5519
5195
  var Subscriptions = function (_a) {
5520
- var shadow = _a.shadow, gap = _a.gap, _b = _a.showTitle, showTitle = _b === void 0 ? true : _b;
5196
+ var companyName = _a.companyName, entityId = _a.entityId, gap = _a.gap, shadow = _a.shadow, _b = _a.showTitle, showTitle = _b === void 0 ? true : _b;
5521
5197
  // Context
5522
- var _c = React.useContext(BunnyContext), token = _c.token, subdomain = _c.subdomain;
5198
+ var _c = React.useContext(BunnyContext), token = _c.token, apiHost = _c.apiHost, onErrorNavigate = _c.onErrorNavigate;
5523
5199
  // Recoil state
5524
- var _d = recoil.useRecoilState(updatingChargeQuantityIdState), updatingChargeQuantityId = _d[0], setUpdatingChargeQuantityId = _d[1];
5200
+ // const [updatingChargeQuantityId, setUpdatingChargeQuantityId] =
5201
+ // useRecoilState(updatingChargeQuantityIdState);
5525
5202
  // Local state
5526
- var _e = React.useState(), editingQuoteData = _e[0], setEditingQuoteData = _e[1];
5527
- var _f = React.useState(false), payModalVisible = _f[0], setPayModalVisible = _f[1];
5528
- var _g = React.useState(true), hideExpired = _g[0], setHideExpired = _g[1];
5529
- var _h = React.useState(false), quantityDrawerOpen = _h[0], setQuantityDrawerOpen = _h[1];
5203
+ var _d = React.useState(), editingQuoteData = _d[0], setEditingQuoteData = _d[1];
5204
+ var _e = React.useState(false), payModalVisible = _e[0], setPayModalVisible = _e[1];
5205
+ var _f = React.useState(true), hideExpired = _f[0], setHideExpired = _f[1];
5206
+ var _g = React.useState(false); _g[0]; var setQuantityDrawerOpen = _g[1];
5530
5207
  // Hooks
5531
- var handleAllErrorFormats = common.NotificationUtils.useAllErrorFormats(function () { });
5208
+ var handleAllErrorFormats = common.useAllErrorFormats(onErrorNavigate ||
5209
+ (function (url) {
5210
+ console.log("navigate to", url, " not implemented");
5211
+ }));
5532
5212
  var queryClient = reactQuery.useQueryClient();
5533
- var showSuccessNotification = common.NotificationUtils.useSuccessNotification();
5534
- var quoteDelete = useQuoteDelete();
5535
- var isMobile = common.useIsMobile();
5536
- var entityId = common.useCurrentUserData().entityId;
5537
- var companyName = common.useCurrentUserData().companyName;
5213
+ var showSuccessNotification = common.useSuccessNotification();
5214
+ // const quoteDelete = useQuoteDelete();
5215
+ var isMobile = common.useIsMobile(window);
5538
5216
  // Queries
5539
- var _j = reactQuery.useQuery({
5217
+ var _h = reactQuery.useQuery({
5540
5218
  queryKey: common.QueryKeyFactory.default.createTableKey("subscriptions"),
5541
- queryFn: function () { return getSubscriptions({ entityId: entityId, token: token, subdomain: subdomain }); },
5219
+ queryFn: function () { return getSubscriptions({ entityId: entityId, token: token, apiHost: apiHost }); },
5542
5220
  enabled: Boolean(entityId),
5543
- }), rawSubscriptions = _j.data, subscriptionsAreLoading = _j.isLoading;
5221
+ }), rawSubscriptions = _h.data, subscriptionsAreLoading = _h.isLoading;
5544
5222
  var quote = reactQuery.useQuery({
5545
5223
  queryKey: common.QueryKeyFactory.default.createObjectKey("editingQuote", editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.id),
5546
5224
  queryFn: function () {
5547
5225
  return (editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.id)
5548
- ? getQuote({ token: token, id: editingQuoteData.id, subdomain: subdomain })
5226
+ ? getQuote({ token: token, id: editingQuoteData.id, apiHost: apiHost })
5549
5227
  : undefined;
5550
5228
  },
5551
5229
  enabled: Boolean(editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.id),
5552
5230
  }).data;
5553
- var _k = reactQuery.useQuery({
5231
+ var _j = reactQuery.useQuery({
5554
5232
  queryKey: common.QueryKeyFactory.default.planChangeOptionsKey(),
5555
- queryFn: function () { return getPlanChangeOptions({ token: token, subdomain: subdomain }); },
5556
- }), planChangeOptions = _k.data, arePlanChangeOptionsLoading = _k.isLoading;
5233
+ queryFn: function () { return getPlanChangeOptions({ token: token, apiHost: apiHost }); },
5234
+ }), planChangeOptions = _j.data, arePlanChangeOptionsLoading = _j.isLoading;
5557
5235
  // Derived state
5558
5236
  var subscriptions = useSubscriptions({ data: rawSubscriptions });
5559
5237
  var allSubscriptionsExpired = subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.every(function (subscription) {
@@ -5585,16 +5263,16 @@ var Subscriptions = function (_a) {
5585
5263
  var onFail = function (error) {
5586
5264
  handleAllErrorFormats(error);
5587
5265
  };
5588
- var onClose = function () {
5589
- if (editingQuoteData) {
5590
- quoteDelete(editingQuoteData.id, token);
5591
- setEditingQuoteData(undefined);
5592
- }
5593
- if (updatingChargeQuantityId) {
5594
- setUpdatingChargeQuantityId(undefined);
5595
- }
5596
- setQuantityDrawerOpen(false);
5597
- };
5266
+ // const onClose = () => {
5267
+ // if (editingQuoteData) {
5268
+ // quoteDelete(editingQuoteData.id, token);
5269
+ // setEditingQuoteData(undefined);
5270
+ // }
5271
+ // // if (updatingChargeQuantityId) {
5272
+ // // setUpdatingChargeQuantityId(undefined);
5273
+ // // }
5274
+ // setQuantityDrawerOpen(false);
5275
+ // };
5598
5276
  if (subscriptionsAreLoading || arePlanChangeOptionsLoading)
5599
5277
  return jsxRuntime.jsx(jsxRuntime.Fragment, {});
5600
5278
  return (jsxRuntime.jsxs(SubscriptionsContext.Provider, __assign({ value: {
@@ -5608,9 +5286,9 @@ var Subscriptions = function (_a) {
5608
5286
  shadow: shadow,
5609
5287
  gap: gap,
5610
5288
  showTitle: showTitle,
5611
- } }, { children: [showTitle && (jsxRuntime.jsx(PageHeaderWithActions, __assign({ title: jsxRuntime.jsxs("div", __assign({ className: "flex items-center justify-between", style: { minWidth: "137px" } }, { children: [hideExpired ? "Active subscriptions" : "All subscriptions", isMobile && (jsxRuntime.jsx(HideExpiredToggle, { hideExpired: hideExpired, setHideExpired: setHideExpired, subscriptions: subscriptions }))] })) }, { children: !isMobile && (jsxRuntime.jsx(SubscriptionsNavigation, { hideExpired: hideExpired, setHideExpired: setHideExpired, setQuantityDrawerOpen: setQuantityDrawerOpen, subscriptions: subscriptions })) }))), jsxRuntime.jsx(PageContent, __assign({ className: "flex flex-col gap-".concat(gap === undefined ? 4 : gap, " shadow-padding-xb overflow-auto"), style: {
5289
+ } }, { children: [showTitle && (jsxRuntime.jsx(PageHeaderWithActions, __assign({ title: jsxRuntime.jsxs("div", __assign({ className: "flex items-center justify-between", style: { minWidth: "137px" } }, { children: [hideExpired ? "Active subscriptions" : "All subscriptions", isMobile && (jsxRuntime.jsx(HideExpiredToggle, { hideExpired: hideExpired, setHideExpired: setHideExpired, subscriptions: subscriptions }))] })) }, { children: !isMobile && (jsxRuntime.jsx(SubscriptionsNavigation, { hideExpired: hideExpired, setHideExpired: setHideExpired, setQuantityDrawerOpen: setQuantityDrawerOpen, subscriptions: subscriptions })) }))), jsxRuntime.jsx("div", __assign({ className: "flex flex-col gap-".concat(gap === undefined ? 4 : gap, " shadow-padding-xb overflow-auto"), style: {
5612
5290
  flexShrink: 1,
5613
- } }, { children: (subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.length) > 0 ? (jsxRuntime.jsx(SubscriptionsList, { hideExpired: hideExpired, planChangeOptions: planChangeOptions, setEditingQuoteData: setEditingQuoteData, setPayModalVisible: setPayModalVisible, subscriptions: subscriptions })) : (jsxRuntime.jsx("div", __assign({ className: "flex flex-col items-center w-full" }, { children: jsxRuntime.jsx(ErrorView, { message: "You have no subscriptions with ".concat(companyName, " yet") }) }))) })), isMobile && (jsxRuntime.jsx("div", __assign({ className: "pt-4 pb-2" }, { children: jsxRuntime.jsx(SubscriptionsNavigation, { hideExpired: hideExpired, setHideExpired: setHideExpired, setQuantityDrawerOpen: setQuantityDrawerOpen, subscriptions: subscriptions }) }))), jsxRuntime.jsx(Footer, {}), jsxRuntime.jsx(QuantityChangeDrawerDesktop, { editingQuote: quote, editingQuoteData: editingQuoteData, onClose: onClose, open: quantityDrawerOpen, openCheckout: function () { return setPayModalVisible(true); }, setEditingQuoteData: setEditingQuoteData, subscriptions: subscriptions }), jsxRuntime.jsx(Checkout, { onCancel: onCancel, onSuccess: onSuccess, onFail: onFail, open: payModalVisible, quote: quote, token: token, isMobile: isMobile })] })));
5291
+ } }, { children: (subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.length) > 0 ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx(SubscriptionsList, { hideExpired: hideExpired, planChangeOptions: planChangeOptions, setEditingQuoteData: setEditingQuoteData, setPayModalVisible: setPayModalVisible, subscriptions: subscriptions }) })) : (jsxRuntime.jsx("div", __assign({ className: "flex flex-col items-center w-full" }, { children: jsxRuntime.jsx(ErrorView, { message: "You have no subscriptions with ".concat(companyName, " yet") }) }))) })), isMobile && (jsxRuntime.jsx("div", __assign({ className: "pt-4 pb-2" }, { children: jsxRuntime.jsx(SubscriptionsNavigation, { hideExpired: hideExpired, setHideExpired: setHideExpired, setQuantityDrawerOpen: setQuantityDrawerOpen, subscriptions: subscriptions }) }))), jsxRuntime.jsx(Checkout, { entityId: entityId, onCancel: onCancel, onSuccess: onSuccess, onFail: onFail, open: payModalVisible, quote: quote, token: token, isMobile: isMobile })] })));
5614
5292
  };
5615
5293
 
5616
5294
  exports.BunnyProvider = BunnyProvider;