@bunnyapp/components 1.0.7 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. package/dist/cjs/index.js +706 -1031
  2. package/dist/cjs/playground/main.d.ts +1 -1
  3. package/dist/cjs/src/ajax.d.ts +1 -0
  4. package/dist/cjs/src/components/BunnyProvider.d.ts +9 -5
  5. package/dist/cjs/src/components/Checkout/Checkout.d.ts +4 -2
  6. package/dist/cjs/src/components/Checkout/InvoiceCheckout.d.ts +2 -1
  7. package/dist/cjs/src/components/Checkout/QuoteCheckout.d.ts +2 -1
  8. package/dist/cjs/src/components/FeatureUsageGraph.d.ts +1 -1
  9. package/dist/cjs/src/components/Invoice/Invoice.d.ts +2 -2
  10. package/dist/cjs/src/components/Invoice/InvoiceQuoteView.d.ts +1 -2
  11. package/dist/cjs/src/components/LegacyInvoicePDF.d.ts +2 -2
  12. package/dist/cjs/src/components/PaymentForm/DemoPay/demoPayUtils.d.ts +1 -1
  13. package/dist/cjs/src/components/PaymentForm/Finix/FinixCardForm.d.ts +1 -1
  14. package/dist/cjs/src/components/PaymentForm/FinixAch.d.ts +1 -1
  15. package/dist/cjs/src/components/PaymentForm/PaymentForm.d.ts +1 -1
  16. package/dist/cjs/src/components/PaymentForm/PaymentFormTypes.d.ts +1 -0
  17. package/dist/cjs/src/components/PaymentForm/PaymentMethod/PaymentMethod.d.ts +2 -2
  18. package/dist/cjs/src/components/PaymentForm/PaymentMethod/PaymentMethodContext.d.ts +0 -1
  19. package/dist/cjs/src/components/PaymentForm/PaymentMethodForm.d.ts +1 -1
  20. package/dist/cjs/src/components/PaymentForm/Stripe/StripeForm.d.ts +1 -1
  21. package/dist/cjs/src/components/PaymentForm/Stripe/stripeUtils.d.ts +6 -6
  22. package/dist/cjs/src/components/PaymentForm/paymentUtils.d.ts +2 -2
  23. package/dist/cjs/src/components/Quote/Quote.d.ts +2 -2
  24. package/dist/cjs/src/components/Quotes/Quotes.d.ts +2 -1
  25. package/dist/cjs/src/components/Signup/PaymentForms.d.ts +2 -2
  26. package/dist/cjs/src/components/Signup/PaymentSuccess.d.ts +4 -3
  27. package/dist/cjs/src/components/Signup/Signup.d.ts +3 -1
  28. package/dist/cjs/src/components/Subscriptions/Subscriptions.d.ts +4 -2
  29. package/dist/cjs/src/components/Subscriptions/subscriptionsList/SubscriptionsList.d.ts +1 -1
  30. package/dist/cjs/src/components/Subscriptions/subscriptionsList/subscriptionCardDesktop/SubscriptionCardColumnHeaders.d.ts +1 -1
  31. package/dist/cjs/src/components/Subscriptions/subscriptionsList/subscriptionUtils.d.ts +1 -2
  32. package/dist/cjs/src/components/Transactions/Transactions.d.ts +3 -1
  33. package/dist/cjs/src/components/Transactions/TransactionsListContext.d.ts +1 -0
  34. package/dist/cjs/src/components/Transactions/transactionsList/TransactionDownload.d.ts +2 -2
  35. package/dist/cjs/src/components/Transactions/transactionsList/TransactionsListDesktop.d.ts +1 -11
  36. package/dist/cjs/src/contexts/NavigationContext.d.ts +1 -1
  37. package/dist/cjs/src/graphql/mutations/accountSignup.d.ts +2 -2
  38. package/dist/cjs/src/graphql/mutations/accountUpdate.d.ts +2 -1
  39. package/dist/cjs/src/graphql/mutations/checkout.d.ts +2 -2
  40. package/dist/cjs/src/graphql/mutations/portalSessionCreate.d.ts +2 -2
  41. package/dist/cjs/src/graphql/mutations/quoteAccountSignup.d.ts +2 -2
  42. package/dist/cjs/src/graphql/mutations/quoteAddCoupon.d.ts +2 -1
  43. package/dist/cjs/src/graphql/mutations/quoteCompose.d.ts +2 -2
  44. package/dist/cjs/src/graphql/mutations/quoteCreate.d.ts +2 -2
  45. package/dist/cjs/src/graphql/mutations/quoteRecalculateTaxes.d.ts +2 -1
  46. package/dist/cjs/src/graphql/mutations/quoteSubscriptionReinstate.d.ts +2 -2
  47. package/dist/cjs/src/graphql/queries/getAccount.d.ts +2 -2
  48. package/dist/cjs/src/graphql/queries/getBranding.d.ts +2 -2
  49. package/dist/cjs/src/graphql/queries/getCurrentUserData.d.ts +2 -2
  50. package/dist/cjs/src/graphql/queries/getFeatureUsage.d.ts +2 -1
  51. package/dist/cjs/src/graphql/queries/getFormattedQuote.d.ts +2 -2
  52. package/dist/cjs/src/graphql/queries/getInvoice.d.ts +2 -2
  53. package/dist/cjs/src/graphql/queries/getPlanChangeOptions.d.ts +2 -2
  54. package/dist/cjs/src/graphql/queries/getPriceList.d.ts +2 -2
  55. package/dist/cjs/src/graphql/queries/getQuote.d.ts +2 -2
  56. package/dist/cjs/src/graphql/queries/getQuotes.d.ts +2 -2
  57. package/dist/cjs/src/graphql/queries/getSubscription.d.ts +2 -2
  58. package/dist/cjs/src/graphql/queries/getSubscriptions.d.ts +2 -2
  59. package/dist/cjs/src/graphql/queries/getTaxationRequiredAccountFields.d.ts +6 -0
  60. package/dist/cjs/src/graphql/queries/getTransactions.d.ts +1 -1
  61. package/dist/cjs/src/hooks/quotes/useSendAcceptQuote.d.ts +7 -1
  62. package/dist/cjs/src/hooks/useHasTaxPlugin.d.ts +3 -2
  63. package/dist/cjs/src/hooks/usePaymentPlugins.d.ts +11 -0
  64. package/dist/cjs/src/hooks/usePlugins.d.ts +6 -0
  65. package/dist/cjs/src/hooks/useSigningPlugins.d.ts +5 -1
  66. package/dist/cjs/src/index.d.ts +1 -0
  67. package/dist/cjs/src/utils/GraphQLClient.d.ts +2 -0
  68. package/dist/cjs/src/utils/quoteInvoiceUtils.d.ts +6 -0
  69. package/dist/esm/index.js +728 -1052
  70. package/dist/esm/playground/main.d.ts +1 -1
  71. package/dist/esm/src/ajax.d.ts +1 -0
  72. package/dist/esm/src/components/BunnyProvider.d.ts +9 -5
  73. package/dist/esm/src/components/Checkout/Checkout.d.ts +4 -2
  74. package/dist/esm/src/components/Checkout/InvoiceCheckout.d.ts +2 -1
  75. package/dist/esm/src/components/Checkout/QuoteCheckout.d.ts +2 -1
  76. package/dist/esm/src/components/FeatureUsageGraph.d.ts +1 -1
  77. package/dist/esm/src/components/Invoice/Invoice.d.ts +2 -2
  78. package/dist/esm/src/components/Invoice/InvoiceQuoteView.d.ts +1 -2
  79. package/dist/esm/src/components/LegacyInvoicePDF.d.ts +2 -2
  80. package/dist/esm/src/components/PaymentForm/DemoPay/demoPayUtils.d.ts +1 -1
  81. package/dist/esm/src/components/PaymentForm/Finix/FinixCardForm.d.ts +1 -1
  82. package/dist/esm/src/components/PaymentForm/FinixAch.d.ts +1 -1
  83. package/dist/esm/src/components/PaymentForm/PaymentForm.d.ts +1 -1
  84. package/dist/esm/src/components/PaymentForm/PaymentFormTypes.d.ts +1 -0
  85. package/dist/esm/src/components/PaymentForm/PaymentMethod/PaymentMethod.d.ts +2 -2
  86. package/dist/esm/src/components/PaymentForm/PaymentMethod/PaymentMethodContext.d.ts +0 -1
  87. package/dist/esm/src/components/PaymentForm/PaymentMethodForm.d.ts +1 -1
  88. package/dist/esm/src/components/PaymentForm/Stripe/StripeForm.d.ts +1 -1
  89. package/dist/esm/src/components/PaymentForm/Stripe/stripeUtils.d.ts +6 -6
  90. package/dist/esm/src/components/PaymentForm/paymentUtils.d.ts +2 -2
  91. package/dist/esm/src/components/Quote/Quote.d.ts +2 -2
  92. package/dist/esm/src/components/Quotes/Quotes.d.ts +2 -1
  93. package/dist/esm/src/components/Signup/PaymentForms.d.ts +2 -2
  94. package/dist/esm/src/components/Signup/PaymentSuccess.d.ts +4 -3
  95. package/dist/esm/src/components/Signup/Signup.d.ts +3 -1
  96. package/dist/esm/src/components/Subscriptions/Subscriptions.d.ts +4 -2
  97. package/dist/esm/src/components/Subscriptions/subscriptionsList/SubscriptionsList.d.ts +1 -1
  98. package/dist/esm/src/components/Subscriptions/subscriptionsList/subscriptionCardDesktop/SubscriptionCardColumnHeaders.d.ts +1 -1
  99. package/dist/esm/src/components/Subscriptions/subscriptionsList/subscriptionUtils.d.ts +1 -2
  100. package/dist/esm/src/components/Transactions/Transactions.d.ts +3 -1
  101. package/dist/esm/src/components/Transactions/TransactionsListContext.d.ts +1 -0
  102. package/dist/esm/src/components/Transactions/transactionsList/TransactionDownload.d.ts +2 -2
  103. package/dist/esm/src/components/Transactions/transactionsList/TransactionsListDesktop.d.ts +1 -11
  104. package/dist/esm/src/contexts/NavigationContext.d.ts +1 -1
  105. package/dist/esm/src/graphql/mutations/accountSignup.d.ts +2 -2
  106. package/dist/esm/src/graphql/mutations/accountUpdate.d.ts +2 -1
  107. package/dist/esm/src/graphql/mutations/checkout.d.ts +2 -2
  108. package/dist/esm/src/graphql/mutations/portalSessionCreate.d.ts +2 -2
  109. package/dist/esm/src/graphql/mutations/quoteAccountSignup.d.ts +2 -2
  110. package/dist/esm/src/graphql/mutations/quoteAddCoupon.d.ts +2 -1
  111. package/dist/esm/src/graphql/mutations/quoteCompose.d.ts +2 -2
  112. package/dist/esm/src/graphql/mutations/quoteCreate.d.ts +2 -2
  113. package/dist/esm/src/graphql/mutations/quoteRecalculateTaxes.d.ts +2 -1
  114. package/dist/esm/src/graphql/mutations/quoteSubscriptionReinstate.d.ts +2 -2
  115. package/dist/esm/src/graphql/queries/getAccount.d.ts +2 -2
  116. package/dist/esm/src/graphql/queries/getBranding.d.ts +2 -2
  117. package/dist/esm/src/graphql/queries/getCurrentUserData.d.ts +2 -2
  118. package/dist/esm/src/graphql/queries/getFeatureUsage.d.ts +2 -1
  119. package/dist/esm/src/graphql/queries/getFormattedQuote.d.ts +2 -2
  120. package/dist/esm/src/graphql/queries/getInvoice.d.ts +2 -2
  121. package/dist/esm/src/graphql/queries/getPlanChangeOptions.d.ts +2 -2
  122. package/dist/esm/src/graphql/queries/getPriceList.d.ts +2 -2
  123. package/dist/esm/src/graphql/queries/getQuote.d.ts +2 -2
  124. package/dist/esm/src/graphql/queries/getQuotes.d.ts +2 -2
  125. package/dist/esm/src/graphql/queries/getSubscription.d.ts +2 -2
  126. package/dist/esm/src/graphql/queries/getSubscriptions.d.ts +2 -2
  127. package/dist/esm/src/graphql/queries/getTaxationRequiredAccountFields.d.ts +6 -0
  128. package/dist/esm/src/graphql/queries/getTransactions.d.ts +1 -1
  129. package/dist/esm/src/hooks/quotes/useSendAcceptQuote.d.ts +7 -1
  130. package/dist/esm/src/hooks/useHasTaxPlugin.d.ts +3 -2
  131. package/dist/esm/src/hooks/usePaymentPlugins.d.ts +11 -0
  132. package/dist/esm/src/hooks/usePlugins.d.ts +6 -0
  133. package/dist/esm/src/hooks/useSigningPlugins.d.ts +5 -1
  134. package/dist/esm/src/index.d.ts +1 -0
  135. package/dist/esm/src/utils/GraphQLClient.d.ts +2 -0
  136. package/dist/esm/src/utils/quoteInvoiceUtils.d.ts +6 -0
  137. package/dist/index.d.ts +28 -14
  138. package/package.json +9 -6
  139. package/dist/cjs/src/atoms/pageContentRefAtom.d.ts +0 -1
  140. package/dist/cjs/src/atoms/planPickerQuoteDataAtom.d.ts +0 -2
  141. package/dist/cjs/src/atoms/updatingChargeQuantityIdAtom.d.ts +0 -2
  142. package/dist/cjs/src/components/Footer.d.ts +0 -4
  143. package/dist/cjs/src/components/PageContent.d.ts +0 -7
  144. package/dist/cjs/src/features/quantityChangeDrawer/QuantityChangeGridRow.d.ts +0 -11
  145. package/dist/cjs/src/features/quantityChangeDrawer/QuantityChangeGridTitle.d.ts +0 -6
  146. package/dist/cjs/src/features/quantityChangeDrawer/QuantityInput.d.ts +0 -21
  147. package/dist/cjs/src/features/quantityChangeDrawer/QuoteChangeSummarySection.d.ts +0 -9
  148. package/dist/cjs/src/features/quantityChangeDrawer/quantityChangeDrawerDesktop/QuantityChangeDrawerDesktop.d.ts +0 -14
  149. package/dist/cjs/src/graphql/QuoteRequests.d.ts +0 -6
  150. package/dist/cjs/src/graphql/SubscriptionRequests.d.ts +0 -2
  151. package/dist/cjs/src/graphql/queries/getFormattedInvoice.d.ts +0 -7
  152. package/dist/cjs/src/hooks/useCurrentUserData.d.ts +0 -2
  153. package/dist/cjs/src/hooks/useIsMobile.d.ts +0 -10
  154. package/dist/cjs/src/utils.d.ts +0 -9
  155. package/dist/esm/src/atoms/pageContentRefAtom.d.ts +0 -1
  156. package/dist/esm/src/atoms/planPickerQuoteDataAtom.d.ts +0 -2
  157. package/dist/esm/src/atoms/updatingChargeQuantityIdAtom.d.ts +0 -2
  158. package/dist/esm/src/components/Footer.d.ts +0 -4
  159. package/dist/esm/src/components/PageContent.d.ts +0 -7
  160. package/dist/esm/src/features/quantityChangeDrawer/QuantityChangeGridRow.d.ts +0 -11
  161. package/dist/esm/src/features/quantityChangeDrawer/QuantityChangeGridTitle.d.ts +0 -6
  162. package/dist/esm/src/features/quantityChangeDrawer/QuantityInput.d.ts +0 -21
  163. package/dist/esm/src/features/quantityChangeDrawer/QuoteChangeSummarySection.d.ts +0 -9
  164. package/dist/esm/src/features/quantityChangeDrawer/quantityChangeDrawerDesktop/QuantityChangeDrawerDesktop.d.ts +0 -14
  165. package/dist/esm/src/graphql/QuoteRequests.d.ts +0 -6
  166. package/dist/esm/src/graphql/SubscriptionRequests.d.ts +0 -2
  167. package/dist/esm/src/graphql/queries/getFormattedInvoice.d.ts +0 -7
  168. package/dist/esm/src/hooks/useCurrentUserData.d.ts +0 -2
  169. package/dist/esm/src/hooks/useIsMobile.d.ts +0 -10
  170. package/dist/esm/src/utils.d.ts +0 -9
  171. /package/dist/cjs/src/components/{Icons → icons}/ArrowDownToLine.d.ts +0 -0
  172. /package/dist/cjs/src/components/{Icons → icons}/BunnyFooterIcon.d.ts +0 -0
  173. /package/dist/cjs/src/components/{Icons → icons}/CardIcon.d.ts +0 -0
  174. /package/dist/esm/src/components/{Icons → icons}/ArrowDownToLine.d.ts +0 -0
  175. /package/dist/esm/src/components/{Icons → icons}/BunnyFooterIcon.d.ts +0 -0
  176. /package/dist/esm/src/components/{Icons → icons}/CardIcon.d.ts +0 -0
package/dist/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 = ".ant-tag {\n border: none;\n border-radius: 14px;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n font-weight: 500;\n white-space: nowrap;\n margin: 0;\n}\n.ant-tag-blue {\n color: #3b82f6 !important;\n background: #bfdbfe !important;\n}\n.ant-tag-green {\n color: #059669 !important;\n background: #a7f3d0 !important;\n}\n.ant-tag-red {\n color: #ef4444 !important;\n background: #fecaca !important;\n}\n.ant-tag-orange {\n color: #f97316 !important;\n background: #fed7aa !important;\n}\n.ant-tag-yellow {\n color: #f59e0b !important;\n background: #fde68a !important;\n}\n.ant-tag-purple {\n color: #8b5cf6 !important;\n background: #ddd6fe !important;\n}\n.ant-tag-black {\n color: white !important;\n background: black !important;\n}\n.ant-popover {\n z-index: 1050;\n}\n.ant-popover-inner-content {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n max-width: 300px;\n}\n.ant-popover-message-title {\n padding: 0;\n text-align: center;\n font-size: 1rem;\n}\n.ant-popover-buttons {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.ant-btn-primary:disabled {\n background: #eef0f2 !important;\n color: rgba(0, 0, 0, 0.25) !important;\n border: none;\n}\n.ant-btn {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n font-weight: 500;\n box-shadow: none;\n text-shadow: none;\n outline: none !important;\n line-height: 1;\n font-size: 0.875rem;\n font-weight: normal;\n}\n.ant-btn > span {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n.ant-btn-lg {\n height: 44px !important;\n}\n.ant-btn-default:disabled {\n border-color: rgba(113, 125, 148, 0.2) !important;\n}\n.ant-btn-link {\n border: none !important;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n.ant-btn-link > span {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n.ant-btn-link:disabled {\n background-color: transparent !important;\n color: #717d94 !important;\n}\n.ant-btn-link:disabled:hover {\n background-color: transparent !important;\n}\n.ant-input-affix-wrapper .ant-input-prefix {\n transition: color 0.3s;\n}\n.ant-select-selector {\n box-shadow: none !important;\n background-color: transparent !important;\n border: none !important;\n}\n.ant-form-item-label {\n text-transform: none !important;\n font-size: 0.75rem;\n padding-bottom: 2px !important;\n}\n.ant-form-item-label > label {\n width: 100%;\n color: #4b5563 !important;\n}\n.ant-form-item-explain-error {\n font-size: 11px;\n min-height: 11px;\n line-height: 11px;\n padding-top: 2px;\n}\n.ant-form-item {\n margin-bottom: 0;\n}\n.ant-notification {\n width: min-content;\n}\n.ant-notification-topRight {\n right: 0 !important;\n left: 0 !important;\n margin-left: auto !important;\n margin-right: auto !important;\n}\n.ant-notification-notice-wrapper {\n width: 350px !important;\n overflow: hidden !important;\n}\n.ant-notification-notice {\n padding: 16px !important;\n width: 350px !important;\n display: flex !important;\n box-shadow: 0px 6px 10px rgba(0, 0, 0, 0.08), 0px 1px 18px rgba(0, 0, 0, 0.08), 0px 3px 5px rgba(0, 0, 0, 0.16) !important;\n}\n.ant-notification-notice-description {\n padding: 0 14px 0 0 !important;\n color: #232323 !important;\n font-size: 14px !important;\n word-break: break-all !important;\n overflow-wrap: break-word !important;\n}\n.ant-notification-notice-success {\n background-color: #edfffa !important;\n}\n.ant-notification-notice-error {\n background-color: #fff8f4 !important;\n}\n.ant-notification-notice-error .ant-notification-notice-message {\n color: #ff6e1c !important;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji !important;\n font-weight: 500;\n}\n.ant-notification-notice-error .ant-notification-notice-icon {\n color: #ff6e1c;\n}\n.ant-notification-notice-success .ant-notification-notice-message {\n color: #00b76a !important;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji !important;\n font-weight: 500;\n}\n.ant-notification-notice-success .ant-notification-notice-icon {\n color: #00b76a !important;\n}\n.ant-notification-notice-message {\n margin-bottom: 0 !important;\n}\n.ant-notification-notice-close {\n top: 16px !important;\n right: 16px !important;\n}\n.ant-divider {\n margin: 0;\n}\n.ant-menu-submenu-popup > .ant-menu .ant-menu-item {\n display: flex !important;\n align-items: center !important;\n}\n.ant-menu-submenu::after {\n display: none !important;\n}\n.ant-drawer-title {\n font-weight: 400 !important;\n}\n.ant-drawer-header-title {\n flex-direction: row-reverse !important;\n align-items: start !important ;\n}\n.ant-drawer-close {\n margin-inline-end: 0 !important;\n}\n@media (min-width: 768px) {\n .ant-input,\n .ant-picker,\n .ant-select,\n .ant-input-affix-wrapper {\n font-size: 1rem !important;\n }\n .ant-drawer-header {\n padding-right: 1.5rem !important;\n padding-left: 1.5rem !important;\n }\n}\n:root {\n --row-background: #ffffff;\n --row-background-alternate: rgba(100, 116, 139, 0.04);\n --row-background-dark: #121212;\n --row-background-alternate-dark: #1e1e1e;\n}\n.plan-step-line {\n height: 1px;\n min-width: 128px;\n background: #717d94;\n}\n.plan-step-number {\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 9999px;\n border: 1px solid #717d94;\n background: white;\n width: 24px;\n height: 24px;\n color: #717d94;\n}\n.plan-step-number.active {\n border: none;\n color: white;\n background: #ff6e1c;\n}\n.hidden {\n display: none;\n}\n.cardElement {\n padding: 8px 11px;\n border: 1px solid #e5e7eb;\n background-color: white;\n font-family: Inter !important;\n}\n.tooltip {\n visibility: hidden;\n position: absolute !important;\n}\n.has-tooltip:hover .tooltip {\n visibility: visible;\n z-index: 100;\n}\n.show-on-hover {\n opacity: 0;\n}\n.show-on-hover-container:hover .show-on-hover {\n opacity: 1;\n}\n.pdf-only {\n display: none !important;\n}\n.notes p {\n margin: 0;\n padding: 0;\n padding-bottom: 0.25rem;\n}\n#form-element #finix-form-container .field-holder label {\n color: #717d94 !important;\n font-size: 12px !important;\n}\n#form-element #finix-form-container > *:first-child,\n#form-element #finix-form-container > *:last-child {\n margin-top: 0 !important;\n}\n#form-element #finix-form-container > *:not(:first-child):not(:last-child) {\n margin-top: 12px !important;\n}\n#form-element #finix-form-container .field-array > * {\n margin-top: 0 !important;\n}\n#form-element #finix-form-container .field-holder .field,\n#form-element #finix-form-container iframe {\n height: 34px !important;\n}\n#form-element #finix-form-container .field {\n margin-top: 0 !important;\n padding-top: 2px !important;\n}\n#form-element #finix-form-container .field-holder .validation {\n font-size: 11px !important;\n color: #ff4d4f !important;\n}\n.icon-path {\n transition: fill 0.3s;\n}\n.shadow-padding-x {\n padding-right: 1rem;\n padding-left: 1rem;\n}\n.shadow-padding-xb {\n padding-right: 1rem;\n padding-left: 1rem;\n padding-bottom: 0.5rem;\n}\n.content-container {\n width: 100%;\n margin: 0 auto;\n}\n@media (min-width: 1220px) {\n .content-container {\n width: 1220px !important;\n margin: 0 auto;\n }\n}\n@media (min-width: 768px) {\n .shadow-padding-x {\n padding-right: 2rem;\n padding-left: 2rem;\n }\n .shadow-padding-xb {\n padding-right: 2rem;\n padding-left: 2rem;\n padding-bottom: 0.5rem;\n }\n .sm\\:flex {\n display: flex !important;\n }\n .sm\\:hidden {\n display: none !important;\n }\n}\n.rotate-45,\n.transform {\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n}\n.shadow,\n.shadow-md {\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n}\n.container {\n width: 100%;\n}\n@media (min-width: 768px) {\n .container {\n max-width: 768px;\n }\n}\n@media (min-width: 1024px) {\n .container {\n max-width: 1024px;\n }\n}\n@media (min-width: 1280px) {\n .container {\n max-width: 1280px;\n }\n}\n@media (min-width: 1536px) {\n .container {\n max-width: 1536px;\n }\n}\n.visible {\n visibility: visible;\n}\n.fixed {\n position: fixed;\n}\n.absolute {\n position: absolute;\n}\n.relative {\n position: relative;\n}\n.bottom-0 {\n bottom: 0px;\n}\n.left-0 {\n left: 0px;\n}\n.right-0 {\n right: 0px;\n}\n.top-0 {\n top: 0px;\n}\n.z-50 {\n z-index: 50;\n}\n.col-span-2 {\n grid-column: span 2 / span 2;\n}\n.col-span-3 {\n grid-column: span 3 / span 3;\n}\n.m-0 {\n margin: 0px;\n}\n.mx-8 {\n margin-left: 2rem;\n margin-right: 2rem;\n}\n.my-12 {\n margin-top: 3rem;\n margin-bottom: 3rem;\n}\n.my-4 {\n margin-top: 1rem;\n margin-bottom: 1rem;\n}\n.mb-4 {\n margin-bottom: 1rem;\n}\n.ml-2 {\n margin-left: 0.5rem;\n}\n.mr-8 {\n margin-right: 2rem;\n}\n.mt-1 {\n margin-top: 0.25rem;\n}\n.mt-2 {\n margin-top: 0.5rem;\n}\n.mt-4 {\n margin-top: 1rem;\n}\n.mt-6 {\n margin-top: 1.5rem;\n}\n.mt-8 {\n margin-top: 2rem;\n}\n.block {\n display: block;\n}\n.flex {\n display: flex;\n}\n.table {\n display: table;\n}\n.grid {\n display: grid;\n}\n.contents {\n display: contents;\n}\n.hidden {\n display: none;\n}\n.h-4 {\n height: 1rem;\n}\n.h-5 {\n height: 1.25rem;\n}\n.h-8 {\n height: 2rem;\n}\n.h-full {\n height: 100%;\n}\n.h-screen {\n height: 100vh;\n}\n.w-1\\/2 {\n width: 50%;\n}\n.w-1\\/3 {\n width: 33.333333%;\n}\n.w-2\\/3 {\n width: 66.666667%;\n}\n.w-4 {\n width: 1rem;\n}\n.w-full {\n width: 100%;\n}\n.w-screen {\n width: 100vw;\n}\n.max-w-32 {\n max-width: 8rem;\n}\n.shrink-0 {\n flex-shrink: 0;\n}\n.grow {\n flex-grow: 1;\n}\n.border-collapse {\n border-collapse: collapse;\n}\n.rotate-45 {\n --tw-rotate: 45deg;\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.transform {\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.cursor-pointer {\n cursor: pointer;\n}\n.grid-cols-2 {\n grid-template-columns: repeat(2, minmax(0, 1fr));\n}\n.grid-cols-3 {\n grid-template-columns: repeat(3, minmax(0, 1fr));\n}\n.flex-row {\n flex-direction: row;\n}\n.flex-col {\n flex-direction: column;\n}\n.items-end {\n align-items: flex-end;\n}\n.items-center {\n align-items: center;\n}\n.justify-start {\n justify-content: flex-start;\n}\n.justify-end {\n justify-content: flex-end;\n}\n.justify-center {\n justify-content: center;\n}\n.justify-between {\n justify-content: space-between;\n}\n.gap-1 {\n gap: 0.25rem;\n}\n.gap-2 {\n gap: 0.5rem;\n}\n.gap-4 {\n gap: 1rem;\n}\n.gap-6 {\n gap: 1.5rem;\n}\n.space-y-2 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(0.5rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(0.5rem * var(--tw-space-y-reverse));\n}\n.space-y-8 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(2rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(2rem * var(--tw-space-y-reverse));\n}\n.overflow-auto {\n overflow: auto;\n}\n.overflow-hidden {\n overflow: hidden;\n}\n.overflow-visible {\n overflow: visible;\n}\n.whitespace-nowrap {\n white-space: nowrap;\n}\n.text-nowrap {\n text-wrap: nowrap;\n}\n.rounded {\n border-radius: 0.25rem;\n}\n.rounded-full {\n border-radius: 9999px;\n}\n.rounded-md {\n border-radius: 0.375rem;\n}\n.border {\n border-width: 1px;\n}\n.border-solid {\n border-style: solid;\n}\n.border-gray-400 {\n --tw-border-opacity: 1;\n border-color: rgb(156 163 175 / var(--tw-border-opacity, 1));\n}\n.border-gray-500 {\n --tw-border-opacity: 1;\n border-color: rgb(107 114 128 / var(--tw-border-opacity, 1));\n}\n.border-slate-200 {\n --tw-border-opacity: 1;\n border-color: rgb(226 232 240 / var(--tw-border-opacity, 1));\n}\n.border-slate-300 {\n --tw-border-opacity: 1;\n border-color: rgb(203 213 225 / var(--tw-border-opacity, 1));\n}\n.bg-black {\n --tw-bg-opacity: 1;\n background-color: rgb(0 0 0 / var(--tw-bg-opacity, 1));\n}\n.bg-emerald-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(167 243 208 / var(--tw-bg-opacity, 1));\n}\n.bg-green-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(187 247 208 / var(--tw-bg-opacity, 1));\n}\n.bg-orange-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(254 215 170 / var(--tw-bg-opacity, 1));\n}\n.bg-red-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(254 202 202 / var(--tw-bg-opacity, 1));\n}\n.bg-slate-50 {\n --tw-bg-opacity: 1;\n background-color: rgb(248 250 252 / var(--tw-bg-opacity, 1));\n}\n.bg-white {\n --tw-bg-opacity: 1;\n background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));\n}\n.bg-yellow-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(254 240 138 / var(--tw-bg-opacity, 1));\n}\n.p-0 {\n padding: 0px;\n}\n.p-2 {\n padding: 0.5rem;\n}\n.p-4 {\n padding: 1rem;\n}\n.px-2 {\n padding-left: 0.5rem;\n padding-right: 0.5rem;\n}\n.px-4 {\n padding-left: 1rem;\n padding-right: 1rem;\n}\n.px-6 {\n padding-left: 1.5rem;\n padding-right: 1.5rem;\n}\n.py-1 {\n padding-top: 0.25rem;\n padding-bottom: 0.25rem;\n}\n.py-2 {\n padding-top: 0.5rem;\n padding-bottom: 0.5rem;\n}\n.py-4 {\n padding-top: 1rem;\n padding-bottom: 1rem;\n}\n.py-6 {\n padding-top: 1.5rem;\n padding-bottom: 1.5rem;\n}\n.pb-2 {\n padding-bottom: 0.5rem;\n}\n.pb-4 {\n padding-bottom: 1rem;\n}\n.pb-6 {\n padding-bottom: 1.5rem;\n}\n.pb-8 {\n padding-bottom: 2rem;\n}\n.pl-0 {\n padding-left: 0px;\n}\n.pl-2 {\n padding-left: 0.5rem;\n}\n.pl-4 {\n padding-left: 1rem;\n}\n.pt-1 {\n padding-top: 0.25rem;\n}\n.pt-2 {\n padding-top: 0.5rem;\n}\n.pt-4 {\n padding-top: 1rem;\n}\n.pt-5 {\n padding-top: 1.25rem;\n}\n.pt-6 {\n padding-top: 1.5rem;\n}\n.pt-8 {\n padding-top: 2rem;\n}\n.text-left {\n text-align: left;\n}\n.text-center {\n text-align: center;\n}\n.text-right {\n text-align: right;\n}\n.align-middle {\n vertical-align: middle;\n}\n.text-2xl {\n font-size: 1.5rem;\n line-height: 2rem;\n}\n.text-base {\n font-size: 1rem;\n line-height: 1.5rem;\n}\n.text-lg {\n font-size: 1.125rem;\n line-height: 1.75rem;\n}\n.text-sm {\n font-size: 0.875rem;\n line-height: 1.25rem;\n}\n.text-xl {\n font-size: 1.25rem;\n line-height: 1.75rem;\n}\n.text-xs {\n font-size: 0.75rem;\n line-height: 1rem;\n}\n.font-bold {\n font-weight: 700;\n}\n.font-medium {\n font-weight: 500;\n}\n.font-normal {\n font-weight: 400;\n}\n.capitalize {\n text-transform: capitalize;\n}\n.text-emerald-600 {\n --tw-text-opacity: 1;\n color: rgb(5 150 105 / var(--tw-text-opacity, 1));\n}\n.text-emerald-700 {\n --tw-text-opacity: 1;\n color: rgb(4 120 87 / var(--tw-text-opacity, 1));\n}\n.text-gray-600 {\n --tw-text-opacity: 1;\n color: rgb(75 85 99 / var(--tw-text-opacity, 1));\n}\n.text-gray-900 {\n --tw-text-opacity: 1;\n color: rgb(17 24 39 / var(--tw-text-opacity, 1));\n}\n.text-green-600 {\n --tw-text-opacity: 1;\n color: rgb(22 163 74 / var(--tw-text-opacity, 1));\n}\n.text-orange-500 {\n --tw-text-opacity: 1;\n color: rgb(249 115 22 / var(--tw-text-opacity, 1));\n}\n.text-red-500 {\n --tw-text-opacity: 1;\n color: rgb(239 68 68 / var(--tw-text-opacity, 1));\n}\n.text-slate-400 {\n --tw-text-opacity: 1;\n color: rgb(148 163 184 / var(--tw-text-opacity, 1));\n}\n.text-slate-500 {\n --tw-text-opacity: 1;\n color: rgb(100 116 139 / var(--tw-text-opacity, 1));\n}\n.text-white {\n --tw-text-opacity: 1;\n color: rgb(255 255 255 / var(--tw-text-opacity, 1));\n}\n.text-yellow-500 {\n --tw-text-opacity: 1;\n color: rgb(234 179 8 / var(--tw-text-opacity, 1));\n}\n.underline {\n text-decoration-line: underline;\n}\n.shadow {\n --tw-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);\n --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.shadow-md {\n --tw-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);\n --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.transition {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n.font-light {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n.font-medium {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n.font-bold {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n@media (min-width: 768px) {\n .sm\\:flex {\n display: flex;\n }\n .sm\\:hidden {\n display: none;\n }\n}\n* {\n margin: 0;\n padding: 0;\n box-sizing: border-box !important;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n line-height: 1.15;\n}\nbody {\n color: #232323;\n background-color: #f8fafc;\n}\nth {\n font-weight: normal;\n}\ncode {\n font-family: source-code-pro, Menlo, Monaco, Consolas, \"Courier New\", monospace;\n}\n@media only screen and (max-width: 768px) {\n select,\n textarea,\n input[type=\"text\"],\n input[type=\"password\"],\n input[type=\"datetime\"],\n input[type=\"datetime-local\"],\n input[type=\"date\"],\n input[type=\"month\"],\n input[type=\"time\"],\n input[type=\"week\"],\n input[type=\"number\"],\n input[type=\"email\"],\n input[type=\"url\"],\n input[type=\"search\"],\n input[type=\"tel\"],\n input[type=\"color\"] {\n font-size: 16px !important;\n }\n}\n@keyframes App-logo-spin {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}\n";
74
+ styleInject(css_248z);
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();
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; _b.window;
1772
+ var isMobile = common.useIsMobile();
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,6 +1935,7 @@ 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;
1938
+ React.useContext(BunnyContext).window;
1955
1939
  var isMobile = common.useIsMobile();
1956
1940
  var displayPayButtonNameAnyways = React.useContext(PaymentContext).displayPayButtonNameAnyways;
1957
1941
  var buttonName = function () {
@@ -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,7 +2457,7 @@ 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
2462
  var isMobile = common.useIsMobile();
2479
2463
  // Local state
@@ -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
2630
+ var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, accountId = _b.accountId, window = _b.window;
2646
2631
  var isMobile = common.useIsMobile();
2647
- var _b = React.useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain, accountId = _b.accountId, window = _b.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,22 +2723,65 @@ 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
2787
  var isMobile = common.useIsMobile();
@@ -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
+ React.useContext(BunnyContext).window;
3011
+ var isMobile = common.useIsMobile();
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;
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;
3276
3325
  function ActualQuote(_a) {
3277
3326
  var _b, _c;
3278
- var id = _a.id;
3279
- var _d = React.useContext(BunnyContext), token = _d.token, subdomain = _d.subdomain;
3327
+ var id = _a.id, entityId = _a.entityId;
3328
+ var _d = React.useContext(BunnyContext), token = _d.token, apiHost = _d.apiHost, onErrorNavigate = _d.onErrorNavigate;
3280
3329
  var entityBranding = React.useContext(BrandContext);
3281
3330
  var isMobile = common.useIsMobile();
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,21 +3427,6 @@ 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;
@@ -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();
3491
+ var downloadFile = useDownloadFile();
3474
3492
  var isMobile = common.useIsMobile();
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,14 +3612,14 @@ 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
@@ -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)
@@ -3777,6 +3757,14 @@ var DrawerHeader = function (_a) {
3777
3757
  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
3758
  };
3779
3759
 
3760
+ var Card = function (_a) {
3761
+ var children = _a.children, className = _a.className, style = _a.style;
3762
+ var darkMode = React.useContext(BunnyContext).darkMode;
3763
+ return (jsxRuntime.jsx("div", __assign({ className: "flex flex-col rounded-md shadow-md ".concat(className), style: __assign(__assign({}, style), { backgroundColor: darkMode
3764
+ ? "var(--row-background-dark)"
3765
+ : "var(--row-background)" }) }, { children: children })));
3766
+ };
3767
+
3780
3768
  var LargeCardIcon = function () {
3781
3769
  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
3770
  };
@@ -3786,16 +3774,6 @@ var PlusIcon = function (_a) {
3786
3774
  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
3775
  };
3788
3776
 
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
3777
  var Text$6 = antd.Typography.Text;
3800
3778
  var CreditCard = function (_a) {
3801
3779
  var _b, _c, _d;
@@ -3806,8 +3784,8 @@ var CreditCard = function (_a) {
3806
3784
  return expDate.isBefore(dayjs());
3807
3785
  };
3808
3786
  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 }))] }))] }))] })));
3787
+ var apiHost = React.useContext(BunnyContext).apiHost;
3788
+ 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
3789
  };
3812
3790
  var CardAttribute = function (_a) {
3813
3791
  var title = _a.title, value = _a.value;
@@ -3830,27 +3808,26 @@ var getCardImage = function (issuer) {
3830
3808
  return "mc_symbol_opt_73_3x.png";
3831
3809
  };
3832
3810
 
3833
- var ActualPaymentMethod = function () {
3834
- var _a = React.useContext(BunnyContext), token = _a.token, subdomain = _a.subdomain, graphQLClient = _a.graphQLClient;
3811
+ var PaymentMethodContext = React.createContext({});
3812
+
3813
+ var ActualPaymentMethod = function (_a) {
3814
+ var entityId = _a.entityId;
3815
+ var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, graphQLClient = _b.graphQLClient, onErrorNavigate = _b.onErrorNavigate;
3835
3816
  var accountId = React.useContext(PaymentContext).accountId;
3836
3817
  // Hooks
3837
3818
  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
- });
3819
+ var paymentPlugins = usePaymentPlugins({ entityId: entityId, apiHost: apiHost, token: token }).paymentPlugins;
3820
+ var showErrorNotification = common.useErrorNotification();
3821
+ var showSuccessNotification = common.useSuccessNotification();
3822
+ var handleAllErrorFormats = common.useAllErrorFormats(onErrorNavigate ||
3823
+ (function (url) {
3824
+ console.log("navigate to", url, " not implemented");
3825
+ }));
3844
3826
  var isMobile = common.useIsMobile();
3845
3827
  var data = usePaymentMethod(graphQLClient).data;
3846
3828
  // 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
- });
3829
+ var _c = React.useState(false), showModal = _c[0], setShowModal = _c[1];
3830
+ var _d = React.useState(false), isSaving = _d[0], setIsSaving = _d[1];
3854
3831
  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
3832
  var onClickRemove = function () {
3856
3833
  if (data && plugin) {
@@ -3862,7 +3839,7 @@ var ActualPaymentMethod = function () {
3862
3839
  account_id: accountId,
3863
3840
  },
3864
3841
  token: token,
3865
- subdomain: subdomain,
3842
+ apiHost: apiHost,
3866
3843
  })
3867
3844
  .then(function () {
3868
3845
  showSuccessNotification("Payment method was removed", "Success");
@@ -3889,7 +3866,7 @@ var ActualPaymentMethod = function () {
3889
3866
  }
3890
3867
  : {},
3891
3868
  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) {
3869
+ }, 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
3870
  handleAllErrorFormats(error);
3894
3871
  setIsSaving(false);
3895
3872
  }, onPaymentSuccess: function () {
@@ -3898,13 +3875,56 @@ var ActualPaymentMethod = function () {
3898
3875
  }, setIsSaving: setIsSaving }) }))] }));
3899
3876
  };
3900
3877
  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, {}) })));
3878
+ var entityId = _a.entityId, footer = _a.footer;
3879
+ return (jsxRuntime.jsx(PaymentMethodContext.Provider, __assign({ value: { footer: footer } }, { children: jsxRuntime.jsx(ActualPaymentMethod, { entityId: entityId }) })));
3903
3880
  }
3904
3881
 
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";
3882
+ var pageWrapperClassName = function (isMobile) {
3883
+ return "flex flex-col grow pt-4 ".concat(isMobile ? "pb-4 overflow-hidden" : "pb-8", " ").concat("content-container");
3884
+ };
3885
+
3886
+ 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}";
3887
+
3888
+ var QUOTE_RECALCULATE_TAXES = "\n mutation QuoteRecalculateTaxes($id: ID!) {\n quoteRecalculateTaxes(id: $id) {\n ".concat(QUOTE_FIELDS, "\n errors\n }\n }\n");
3889
+ var quoteRecalculateTaxes = function (_a) {
3890
+ var quoteId = _a.quoteId, token = _a.token, apiHost = _a.apiHost;
3891
+ return __awaiter(void 0, void 0, void 0, function () {
3892
+ var vars, response, errors;
3893
+ var _b, _c;
3894
+ return __generator(this, function (_d) {
3895
+ switch (_d.label) {
3896
+ case 0:
3897
+ vars = { id: quoteId };
3898
+ return [4 /*yield*/, common.gqlRequest({
3899
+ query: QUOTE_RECALCULATE_TAXES,
3900
+ token: token,
3901
+ vars: vars,
3902
+ apiHost: apiHost,
3903
+ })];
3904
+ case 1:
3905
+ response = _d.sent();
3906
+ errors = (_b = response === null || response === void 0 ? void 0 : response.quoteRecalculateTaxes) === null || _b === void 0 ? void 0 : _b.errors;
3907
+ if (errors)
3908
+ throw errors;
3909
+ return [2 /*return*/, (_c = response.quoteRecalculateTaxes) === null || _c === void 0 ? void 0 : _c.quote];
3910
+ }
3911
+ });
3912
+ });
3913
+ };
3914
+
3915
+ var useHasTaxPlugin = function (_a) {
3916
+ var entityId = _a.entityId, apiHost = _a.apiHost, token = _a.token;
3917
+ var plugins = usePlugins({
3918
+ entityId: entityId,
3919
+ apiHost: apiHost,
3920
+ token: token,
3921
+ }).data;
3922
+ return Boolean(plugins === null || plugins === void 0 ? void 0 : plugins.some(function (plugin) { return plugin.type === "taxation"; }));
3923
+ };
3924
+
3925
+ 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
3926
  var accountUpdate = function (_a) {
3907
- var accountId = _a.accountId, attributes = _a.attributes, token = _a.token;
3927
+ var accountId = _a.accountId, attributes = _a.attributes, token = _a.token, apiHost = _a.apiHost;
3908
3928
  return __awaiter(void 0, void 0, void 0, function () {
3909
3929
  var vars, response, errors;
3910
3930
  var _b;
@@ -3912,7 +3932,12 @@ var accountUpdate = function (_a) {
3912
3932
  switch (_c.label) {
3913
3933
  case 0:
3914
3934
  vars = { id: accountId, attributes: attributes };
3915
- return [4 /*yield*/, common.gqlRequest({ query: MUTATION$5, token: token, vars: vars })];
3935
+ return [4 /*yield*/, common.gqlRequest({
3936
+ query: MUTATION$6,
3937
+ token: token,
3938
+ vars: vars,
3939
+ apiHost: apiHost,
3940
+ })];
3916
3941
  case 1:
3917
3942
  response = _c.sent();
3918
3943
  errors = (_b = response === null || response === void 0 ? void 0 : response.accountUpdate) === null || _b === void 0 ? void 0 : _b.errors;
@@ -3929,10 +3954,10 @@ var TaxationForm = function (_a) {
3929
3954
  var account = _a.account, quote = _a.quote;
3930
3955
  // Hooks
3931
3956
  var queryClient = reactQuery.useQueryClient();
3932
- var token = React.useContext(BunnyContext).token;
3957
+ var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
3933
3958
  var form = antd.Form.useForm()[0];
3934
3959
  // Mutations
3935
- var _b = reactQuery.useMutation({
3960
+ var _c = reactQuery.useMutation({
3936
3961
  mutationFn: function (changedFormData) { return __awaiter(void 0, void 0, void 0, function () {
3937
3962
  var account;
3938
3963
  return __generator(this, function (_a) {
@@ -3941,6 +3966,7 @@ var TaxationForm = function (_a) {
3941
3966
  accountId: quote.accountId,
3942
3967
  attributes: changedFormData,
3943
3968
  token: token,
3969
+ apiHost: apiHost,
3944
3970
  })];
3945
3971
  case 1:
3946
3972
  account = _a.sent();
@@ -3953,7 +3979,7 @@ var TaxationForm = function (_a) {
3953
3979
  queryKey: ["getTaxationRequiredAccountFields", token],
3954
3980
  });
3955
3981
  },
3956
- }), updateAccount = _b.mutate, isUpdatingAccount = _b.isPending;
3982
+ }), updateAccount = _c.mutate, isUpdatingAccount = _c.isPending;
3957
3983
  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
3984
  var _a, _b;
3959
3985
  return ((_a = option === null || option === void 0 ? void 0 : option.label) !== null && _a !== void 0 ? _a : "").toLowerCase().includes(input.toLowerCase()) ||
@@ -3968,10 +3994,10 @@ var FormBillingState = function (_a) {
3968
3994
  };
3969
3995
 
3970
3996
  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;
3997
+ 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
3998
  // Context
3973
3999
  var isMobile = common.useIsMobile();
3974
- var _b = React.useContext(BunnyContext), subdomain = _b.subdomain, token = _b.token;
4000
+ var _b = React.useContext(BunnyContext), apiHost = _b.apiHost, token = _b.token;
3975
4001
  var paymentRequired = getQuoteAmountDue(quote) > 0;
3976
4002
  var checkoutMutation = reactQuery.useMutation({
3977
4003
  mutationFn: function (_a) {
@@ -3979,14 +4005,14 @@ var QuoteCheckout = function (_a) {
3979
4005
  if (!quote)
3980
4006
  throw new Error("Quote is required");
3981
4007
  if (!paymentRequired)
3982
- return checkout({ quoteId: quote.id, token: token, subdomain: subdomain });
4008
+ return checkout({ quoteId: quote.id, token: token, apiHost: apiHost });
3983
4009
  if (savedPaymentMethod) {
3984
4010
  var paymentMethodId = savedPaymentMethod.paymentMethodId;
3985
4011
  return checkout({
3986
4012
  quoteId: quote.id,
3987
4013
  paymentMethodId: paymentMethodId,
3988
4014
  token: token,
3989
- subdomain: subdomain,
4015
+ apiHost: apiHost,
3990
4016
  });
3991
4017
  }
3992
4018
  if (pluginPaymentMethod) {
@@ -4001,7 +4027,7 @@ var QuoteCheckout = function (_a) {
4001
4027
  token: paymentToken,
4002
4028
  },
4003
4029
  token: token,
4004
- subdomain: subdomain,
4030
+ apiHost: apiHost,
4005
4031
  });
4006
4032
  }
4007
4033
  throw new Error("Pay payment method provided");
@@ -4043,82 +4069,64 @@ var QuoteCheckout = function (_a) {
4043
4069
  };
4044
4070
  if (taxationRequiredAccountFields)
4045
4071
  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 () {
4072
+ 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
4073
  setIsSaving(true);
4048
4074
  handleCheckout({});
4049
4075
  }, type: "primary" }, { children: isSaving ? "Processing..." : "Complete order" })), jsxRuntime.jsx("div", __assign({ className: "text-xs text-slate-500" }, { children: "No payment is required" }))] })) }))) }));
4050
4076
  };
4051
4077
 
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;
4078
+ var MUTATION$5 = "{\n currentUser {\n taxationRequiredAccountFields\n }\n}";
4079
+ var getTaxationRequiredAccountFields = function (_a) {
4080
+ var token = _a.token, apiHost = _a.apiHost;
4066
4081
  return __awaiter(void 0, void 0, void 0, function () {
4067
- var vars, response, errors;
4082
+ var response;
4068
4083
  var _b, _c;
4069
4084
  return __generator(this, function (_d) {
4070
4085
  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
- })];
4086
+ case 0: return [4 /*yield*/, common.gqlRequest({
4087
+ query: MUTATION$5,
4088
+ token: token,
4089
+ apiHost: apiHost,
4090
+ })];
4078
4091
  case 1:
4079
4092
  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];
4093
+ 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
4094
+ ? response.currentUser
4095
+ .taxationRequiredAccountFields
4096
+ : null];
4084
4097
  }
4085
4098
  });
4086
4099
  });
4087
4100
  };
4088
4101
 
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
4102
  var queryKeyFactory = common.QueryKeyFactory.default;
4099
4103
  var Checkout = function (_a) {
4100
4104
  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 });
4105
+ 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;
4106
+ var _e = React.useContext(BunnyContext), apiHost = _e.apiHost; _e.window;
4107
+ var _f = React.useState(false), isSaving = _f[0], setIsSaving = _f[1];
4108
+ var isMobile = common.useIsMobile();
4109
+ var hasTaxPlugin = useHasTaxPlugin({
4110
+ entityId: entityId,
4111
+ apiHost: apiHost,
4112
+ token: token,
4113
+ });
4105
4114
  var queryClient = reactQuery.useQueryClient();
4106
- var quotePreviewData = recoil.useRecoilValue(planPickerQuoteDataState);
4107
4115
  // Queries
4108
- var _e = reactQuery.useQuery({
4116
+ var _g = reactQuery.useQuery({
4109
4117
  queryKey: ["getTaxationRequiredAccountFields", token],
4110
- queryFn: function () { return common.getTaxationRequiredAccountFields({ token: token }); },
4118
+ queryFn: function () { return getTaxationRequiredAccountFields({ token: token, apiHost: apiHost }); },
4111
4119
  enabled: Boolean(quote),
4112
4120
  staleTime: 0,
4113
- }), taxationRequiredAccountFields = _e.data, isLoadingTaxationRequiredAccountFields = _e.isLoading;
4114
- var _f = reactQuery.useQuery({
4121
+ }), taxationRequiredAccountFields = _g.data, isLoadingTaxationRequiredAccountFields = _g.isLoading;
4122
+ var _h = reactQuery.useQuery({
4115
4123
  queryKey: ["account", quote === null || quote === void 0 ? void 0 : quote.accountId],
4116
4124
  queryFn: function () {
4117
- return (quote === null || quote === void 0 ? void 0 : quote.accountId) && common.getAccount({ id: quote.accountId, token: token });
4125
+ return (quote === null || quote === void 0 ? void 0 : quote.accountId) && common.getAccount({ id: quote.accountId, token: token, apiHost: apiHost });
4118
4126
  },
4119
4127
  enabled: Boolean(quote === null || quote === void 0 ? void 0 : quote.accountId) &&
4120
4128
  ((taxationRequiredAccountFields === null || taxationRequiredAccountFields === void 0 ? void 0 : taxationRequiredAccountFields.length) || 0) > 0,
4121
- }), account = _f.data, isLoadingAccount = _f.isLoading;
4129
+ }), account = _h.data, isLoadingAccount = _h.isLoading;
4122
4130
  reactQuery.useQuery({
4123
4131
  queryKey: queryKeyFactory.createQuoteTaxCalculateKey(quote === null || quote === void 0 ? void 0 : quote.id),
4124
4132
  queryFn: function () { return __awaiter(void 0, void 0, void 0, function () {
@@ -4130,12 +4138,13 @@ var Checkout = function (_a) {
4130
4138
  return [4 /*yield*/, quoteRecalculateTaxes({
4131
4139
  quoteId: quote.id,
4132
4140
  token: token,
4141
+ apiHost: apiHost,
4133
4142
  })];
4134
4143
  case 1:
4135
4144
  updatedQuote = _a.sent();
4136
4145
  if (updatedQuote) {
4137
4146
  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);
4147
+ queryClient.setQueryData(queryKeyFactory.calculatedPricesKey(quantity, selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id), updatedQuote);
4139
4148
  }
4140
4149
  _a.label = 2;
4141
4150
  case 2: return [2 /*return*/, {}];
@@ -4154,21 +4163,21 @@ var Checkout = function (_a) {
4154
4163
  return null;
4155
4164
  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
4165
  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) {
4166
+ } }, { 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
4167
  onFail(error);
4159
4168
  setIsSaving(false);
4160
4169
  }, onSuccess: function (_a) {
4161
4170
  var savePaymentMethod = _a.savePaymentMethod;
4162
4171
  onSuccess({ savePaymentMethod: savePaymentMethod });
4163
4172
  setIsSaving(false);
4164
- }, setIsSaving: setIsSaving })) : quote ? (jsxRuntime.jsx(QuoteCheckout, { account: account, isSaving: isSaving, onFail: function (error) {
4173
+ }, setIsSaving: setIsSaving, entityId: entityId })) : quote ? (jsxRuntime.jsx(QuoteCheckout, { account: account, entityId: entityId, isSaving: isSaving, onFail: function (error) {
4165
4174
  onFail(error);
4166
4175
  setIsSaving(false);
4167
4176
  }, onSuccess: function (_a) {
4168
4177
  var savePaymentMethod = _a.savePaymentMethod;
4169
4178
  onSuccess({ savePaymentMethod: savePaymentMethod });
4170
4179
  setIsSaving(false);
4171
- }, quote: quote, setIsSaving: setIsSaving, taxationRequiredAccountFields: taxationRequiredAccountFields, token: token, storedPaymentMethod: storedPaymentMethod })) : (jsxRuntime.jsx(PaymentForm, { isSaving: isSaving, onFail: function (error) {
4180
+ }, quote: quote, setIsSaving: setIsSaving, taxationRequiredAccountFields: taxationRequiredAccountFields, token: token })) : (jsxRuntime.jsx(PaymentForm, { entityId: entityId, isSaving: isSaving, onFail: function (error) {
4172
4181
  onFail(error);
4173
4182
  setIsSaving(false);
4174
4183
  }, onPaymentSuccess: function (_a) {
@@ -4182,7 +4191,7 @@ var Checkout = function (_a) {
4182
4191
 
4183
4192
  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
4193
  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;
4194
+ 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
4195
  return __awaiter(void 0, void 0, void 0, function () {
4187
4196
  var vars, response, errors;
4188
4197
  var _b;
@@ -4202,7 +4211,7 @@ var accountSignup = function (_a) {
4202
4211
  query: MUTATION$4(),
4203
4212
  token: token,
4204
4213
  vars: vars,
4205
- subdomain: subdomain,
4214
+ apiHost: apiHost,
4206
4215
  })];
4207
4216
  case 1:
4208
4217
  response = _c.sent();
@@ -4217,7 +4226,7 @@ var accountSignup = function (_a) {
4217
4226
 
4218
4227
  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
4228
  var quoteAccountSignup = function (_a) {
4220
- var token = _a.token, subdomain = _a.subdomain, entityId = _a.entityId, priceListCode = _a.priceListCode, accountName = _a.accountName, billingContact = _a.billingContact;
4229
+ var token = _a.token, apiHost = _a.apiHost, entityId = _a.entityId, priceListCode = _a.priceListCode, accountName = _a.accountName, billingContact = _a.billingContact;
4221
4230
  return __awaiter(void 0, void 0, void 0, function () {
4222
4231
  var vars, response, errors;
4223
4232
  var _b;
@@ -4234,7 +4243,7 @@ var quoteAccountSignup = function (_a) {
4234
4243
  query: MUTATION$3(),
4235
4244
  token: token,
4236
4245
  vars: vars,
4237
- subdomain: subdomain,
4246
+ apiHost: apiHost,
4238
4247
  })];
4239
4248
  case 1:
4240
4249
  response = _c.sent();
@@ -4249,7 +4258,7 @@ var quoteAccountSignup = function (_a) {
4249
4258
 
4250
4259
  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
4260
  var getPriceList = function (_a) {
4252
- var token = _a.token, code = _a.code, subdomain = _a.subdomain;
4261
+ var token = _a.token, code = _a.code, apiHost = _a.apiHost;
4253
4262
  return __awaiter(void 0, void 0, void 0, function () {
4254
4263
  var response;
4255
4264
  return __generator(this, function (_b) {
@@ -4258,7 +4267,7 @@ var getPriceList = function (_a) {
4258
4267
  query: MUTATION$2(),
4259
4268
  token: token,
4260
4269
  vars: { code: code },
4261
- subdomain: subdomain,
4270
+ apiHost: apiHost,
4262
4271
  })];
4263
4272
  case 1:
4264
4273
  response = _b.sent();
@@ -4269,8 +4278,8 @@ var getPriceList = function (_a) {
4269
4278
  };
4270
4279
 
4271
4280
  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 })) }));
4281
+ 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;
4282
+ 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
4283
  }
4275
4284
  function InitialSignupForm(_a) {
4276
4285
  var onSubmit = _a.onSubmit, submitting = _a.submitting;
@@ -4307,10 +4316,9 @@ function InitialSignupForm(_a) {
4307
4316
 
4308
4317
  var Title = antd.Typography.Title, Text$5 = antd.Typography.Text;
4309
4318
  function PaymentSuccessDisplay(_a) {
4310
- var className = _a.className, amountPaid = _a.amountPaid, style = _a.style, returnUrl = _a.returnUrl;
4319
+ var amountPaid = _a.amountPaid, className = _a.className, companyName = _a.companyName, returnUrl = _a.returnUrl, style = _a.style;
4311
4320
  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] })))] })));
4321
+ 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
4322
  }
4315
4323
 
4316
4324
  var Text$4 = antd.Typography.Text;
@@ -4318,38 +4326,12 @@ function PriceListDisplay(_a) {
4318
4326
  var priceListData = _a.priceListData, topNavImageUrl = _a.topNavImageUrl;
4319
4327
  if (!priceListData)
4320
4328
  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." }))] }))] })) })) }));
4329
+ 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
4330
  }
4323
4331
 
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
4332
  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
4333
  var portalSessionCreate = function (_a) {
4352
- var tenantCode = _a.tenantCode, expiry = _a.expiry, returnUrl = _a.returnUrl, token = _a.token, subdomain = _a.subdomain;
4334
+ var tenantCode = _a.tenantCode, expiry = _a.expiry, returnUrl = _a.returnUrl, token = _a.token, apiHost = _a.apiHost;
4353
4335
  return __awaiter(void 0, void 0, void 0, function () {
4354
4336
  var response, errors;
4355
4337
  var _b;
@@ -4359,7 +4341,7 @@ var portalSessionCreate = function (_a) {
4359
4341
  query: MUTATION$1,
4360
4342
  token: token,
4361
4343
  vars: { tenantCode: tenantCode, expiry: expiry, returnUrl: returnUrl },
4362
- subdomain: subdomain,
4344
+ apiHost: apiHost,
4363
4345
  })];
4364
4346
  case 1:
4365
4347
  response = _c.sent();
@@ -4372,18 +4354,13 @@ var portalSessionCreate = function (_a) {
4372
4354
  });
4373
4355
  };
4374
4356
 
4375
- var showErrorNotification = common.NotificationUtils.useErrorNotification();
4357
+ var showErrorNotification = common.useErrorNotification();
4376
4358
  function Signup(_a) {
4377
- var priceListCode = _a.priceListCode, returnUrl = _a.returnUrl;
4359
+ var companyName = _a.companyName, entityId = _a.entityId, priceListCode = _a.priceListCode, returnUrl = _a.returnUrl;
4378
4360
  // 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);
4361
+ var _b = React.useContext(BunnyContext), apiHost = _b.apiHost, token = _b.token; _b.window;
4362
+ var isMobile = common.useIsMobile();
4385
4363
  var topNavImageUrl = React.useContext(BrandContext).topNavImageUrl;
4386
- var entityId = common.useCurrentUserData().entityId;
4387
4364
  var _c = React.useState(undefined), quote = _c[0], setQuote = _c[1];
4388
4365
  var _d = React.useState(undefined), accountId = _d[0], setAccountId = _d[1];
4389
4366
  var _e = React.useState(undefined), quoteId = _e[0], setQuoteId = _e[1];
@@ -4395,7 +4372,7 @@ function Signup(_a) {
4395
4372
  // Queries
4396
4373
  var priceListData = reactQuery.useQuery({
4397
4374
  queryKey: ["priceList", priceListCode],
4398
- queryFn: function () { return getPriceList({ token: token, subdomain: subdomain, code: priceListCode }); },
4375
+ queryFn: function () { return getPriceList({ token: token, apiHost: apiHost, code: priceListCode }); },
4399
4376
  }).data;
4400
4377
  function handleSubmit(formData) {
4401
4378
  return __awaiter(this, void 0, void 0, function () {
@@ -4407,7 +4384,7 @@ function Signup(_a) {
4407
4384
  setFormData(formData);
4408
4385
  return [4 /*yield*/, quoteAccountSignup({
4409
4386
  token: token,
4410
- subdomain: subdomain,
4387
+ apiHost: apiHost,
4411
4388
  entityId: entityId,
4412
4389
  priceListCode: priceListCode,
4413
4390
  accountName: formData.accountName,
@@ -4422,7 +4399,7 @@ function Signup(_a) {
4422
4399
  setAccountId(data.account.id);
4423
4400
  return [4 /*yield*/, portalSessionCreate({
4424
4401
  token: token,
4425
- subdomain: subdomain,
4402
+ apiHost: apiHost,
4426
4403
  tenantCode: data.tenant.code,
4427
4404
  expiry: 24,
4428
4405
  returnUrl: returnUrl || "",
@@ -4464,7 +4441,7 @@ function Signup(_a) {
4464
4441
  }
4465
4442
  return [4 /*yield*/, accountSignup({
4466
4443
  token: portalSessionToken,
4467
- subdomain: subdomain,
4444
+ apiHost: apiHost,
4468
4445
  entityId: entityId,
4469
4446
  quoteId: quoteId,
4470
4447
  paymentMethodId: (_a = paymentSuccess.savedPaymentMethodResponse) === null || _a === void 0 ? void 0 : _a.paymentMethodId.toString(),
@@ -4486,347 +4463,17 @@ function Signup(_a) {
4486
4463
  setIsPaying(false);
4487
4464
  }
4488
4465
  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 || "" }) }))] }))) })));
4466
+ 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
4467
  }
4491
4468
  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, {})] }));
4469
+ 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
4470
  }
4494
4471
  }
4495
4472
 
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
4473
  // WARNING: There is a preview button on APP that will need to be changed if this query is changed
4827
4474
  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
4475
  var getPlanChangeOptions = function (_a) {
4829
- var isInPreviewMode = _a.isInPreviewMode, token = _a.token, upgradingSubscription = _a.upgradingSubscription, subdomain = _a.subdomain;
4476
+ var isInPreviewMode = _a.isInPreviewMode, token = _a.token, upgradingSubscription = _a.upgradingSubscription, apiHost = _a.apiHost;
4830
4477
  return __awaiter(void 0, void 0, void 0, function () {
4831
4478
  var response, planChangeOptions;
4832
4479
  return __generator(this, function (_b) {
@@ -4836,7 +4483,7 @@ var getPlanChangeOptions = function (_a) {
4836
4483
  query: PLAN_CHANGE_OPTIONS_QUERY,
4837
4484
  vars: { subscriptionId: upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id },
4838
4485
  token: token,
4839
- subdomain: subdomain,
4486
+ apiHost: apiHost,
4840
4487
  })];
4841
4488
  case 1:
4842
4489
  response = _b.sent();
@@ -4855,7 +4502,7 @@ var getPlanChangeOptions = function (_a) {
4855
4502
 
4856
4503
  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
4504
  var getQuote = function (_a) {
4858
- var id = _a.id, token = _a.token, subdomain = _a.subdomain;
4505
+ var id = _a.id, token = _a.token, apiHost = _a.apiHost;
4859
4506
  return __awaiter(void 0, void 0, void 0, function () {
4860
4507
  var response;
4861
4508
  return __generator(this, function (_b) {
@@ -4864,7 +4511,7 @@ var getQuote = function (_a) {
4864
4511
  query: QUOTE_QUERY(),
4865
4512
  token: token,
4866
4513
  vars: { id: id },
4867
- subdomain: subdomain,
4514
+ apiHost: apiHost,
4868
4515
  })];
4869
4516
  case 1:
4870
4517
  response = _b.sent();
@@ -4876,7 +4523,7 @@ var getQuote = function (_a) {
4876
4523
 
4877
4524
  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
4525
  var getSubscriptions = function (_a) {
4879
- var entityId = _a.entityId, isInPreviewMode = _a.isInPreviewMode, token = _a.token, subdomain = _a.subdomain;
4526
+ var entityId = _a.entityId, isInPreviewMode = _a.isInPreviewMode, token = _a.token, apiHost = _a.apiHost;
4880
4527
  return __awaiter(void 0, void 0, void 0, function () {
4881
4528
  var response;
4882
4529
  var _b;
@@ -4887,7 +4534,7 @@ var getSubscriptions = function (_a) {
4887
4534
  query: SUBSCRIPTIONS_QUERY,
4888
4535
  token: token,
4889
4536
  vars: { entityId: entityId },
4890
- subdomain: subdomain,
4537
+ apiHost: apiHost,
4891
4538
  })];
4892
4539
  case 1:
4893
4540
  response = _c.sent();
@@ -4973,6 +4620,42 @@ var HideExpiredToggle = function (_a) {
4973
4620
  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
4621
  var templateObject_1$2;
4975
4622
 
4623
+ // import { EditingSubscriptionType } from "../../../features/quantityChangeDrawer/QuantityInput";
4624
+ var canShowQuantitiesInput = function (charge, subscription) {
4625
+ // Check if the subscription is active, pending, or in trial,
4626
+ // the pricing model is not flat,
4627
+ // and if it's not a trial, also check if the current charge is the last one in the subscription.
4628
+ var _a, _b, _c;
4629
+ var isActiveSubscription = ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === common.SubscriptionState.ACTIVE;
4630
+ var isPendingSubscription = ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === common.SubscriptionState.PENDING;
4631
+ var isTrialSubscription = ((_c = subscription.state) === null || _c === void 0 ? void 0 : _c.toUpperCase()) === common.SubscriptionState.TRIAL;
4632
+ var isFlatPricing = charge.pricingModel === "FLAT";
4633
+ var shouldProcessCharge = (isActiveSubscription || isPendingSubscription || isTrialSubscription) &&
4634
+ !isFlatPricing &&
4635
+ charge.selfServiceQuantity &&
4636
+ !charge.expired;
4637
+ // Now you can use the value of shouldProcessCharge to determine whether to process the charge.
4638
+ return shouldProcessCharge;
4639
+ };
4640
+ var canShowChangeQuantities = function (_a) {
4641
+ var subscriptions = _a.subscriptions;
4642
+ return subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.some(function (subscription) {
4643
+ return subscription.charges.some(function (charge, chargeIndex) {
4644
+ return canShowQuantitiesInput(charge, subscription);
4645
+ });
4646
+ });
4647
+ };
4648
+ var isSubscriptionNotActive = function (subscription) {
4649
+ var _a, _b;
4650
+ return ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === common.SubscriptionState.EXPIRED ||
4651
+ ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === common.SubscriptionState.CANCELED;
4652
+ };
4653
+ var canShowSubscriptionActions = function (subscription) {
4654
+ var _a, _b;
4655
+ return ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === common.SubscriptionState.ACTIVE ||
4656
+ ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === common.SubscriptionState.PENDING;
4657
+ };
4658
+
4976
4659
  var SubscriptionState;
4977
4660
  (function (SubscriptionState) {
4978
4661
  SubscriptionState["ACTIVE"] = "ACTIVE";
@@ -4985,7 +4668,7 @@ var SubscriptionState$1 = SubscriptionState;
4985
4668
 
4986
4669
  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
4670
  var getFeatureUsage = function (_a) {
4988
- var subscriptionChargeId = _a.subscriptionChargeId; _a.startDate; _a.endDate; _a.dataInterval; var token = _a.token;
4671
+ var subscriptionChargeId = _a.subscriptionChargeId; _a.startDate; _a.endDate; _a.dataInterval; var token = _a.token, apiHost = _a.apiHost;
4989
4672
  return __awaiter(void 0, void 0, void 0, function () {
4990
4673
  var vars, response;
4991
4674
  var _b;
@@ -4999,6 +4682,7 @@ var getFeatureUsage = function (_a) {
4999
4682
  query: FEATURE_USAGE_MUTATION,
5000
4683
  token: token,
5001
4684
  vars: vars,
4685
+ apiHost: apiHost,
5002
4686
  })];
5003
4687
  case 1:
5004
4688
  response = _c.sent();
@@ -5137,7 +4821,7 @@ var FeatureUsageGraph = function (_a) {
5137
4821
  }
5138
4822
  return false;
5139
4823
  }))
5140
- return "no usage";
4824
+ return jsxRuntime.jsx("div", { children: "no usage" });
5141
4825
  return (jsxRuntime.jsxs("div", __assign({ onClick: function () {
5142
4826
  setIsModalOpen(true);
5143
4827
  } }, { children: [jsxRuntime.jsx("div", __assign({ style: {
@@ -5169,7 +4853,7 @@ var templateObject_1;
5169
4853
 
5170
4854
  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
4855
  var getGuoteSubscriptionReinstate = function (_a) {
5172
- var ids = _a.ids, token = _a.token, subdomain = _a.subdomain;
4856
+ var ids = _a.ids, token = _a.token, apiHost = _a.apiHost;
5173
4857
  return __awaiter(void 0, void 0, void 0, function () {
5174
4858
  var vars, response, _b, errors, quote;
5175
4859
  return __generator(this, function (_c) {
@@ -5180,7 +4864,7 @@ var getGuoteSubscriptionReinstate = function (_a) {
5180
4864
  query: MUTATION,
5181
4865
  token: token,
5182
4866
  vars: vars,
5183
- subdomain: subdomain,
4867
+ apiHost: apiHost,
5184
4868
  })];
5185
4869
  case 1:
5186
4870
  response = _c.sent();
@@ -5193,32 +4877,16 @@ var getGuoteSubscriptionReinstate = function (_a) {
5193
4877
  });
5194
4878
  };
5195
4879
 
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
4880
  var SubscriptionCardActions = function (_a) {
5213
4881
  var _b, _c;
5214
4882
  var planChangeOptions = _a.planChangeOptions, subscription = _a.subscription, setEditingQuoteData = _a.setEditingQuoteData, setPayModalVisible = _a.setPayModalVisible;
5215
4883
  // Context
5216
- var _d = React.useContext(BunnyContext), token = _d.token, subdomain = _d.subdomain;
4884
+ var _d = React.useContext(BunnyContext), token = _d.token, apiHost = _d.apiHost;
5217
4885
  var _e = React.useContext(SubscriptionsContext), onChangePlanClick = _e.onChangePlanClick, onClickUpgrade = _e.onClickUpgrade, isTempViewOnly = _e.isTempViewOnly;
5218
4886
  // Hooks
5219
- var showSuccessNotification = common.NotificationUtils.useSuccessNotification();
5220
- var cancelSubscription = useCancelSubscription();
5221
- var queryClient = reactQuery.useQueryClient();
4887
+ common.useSuccessNotification();
4888
+ // const cancelSubscription = useCancelSubscription();
4889
+ reactQuery.useQueryClient();
5222
4890
  // const navigate = usePortalNavigate();
5223
4891
  // const handleUpgradingSubscriptionChange =
5224
4892
  // useHandleUpgradingSubscriptionChange();
@@ -5227,21 +4895,21 @@ var SubscriptionCardActions = function (_a) {
5227
4895
  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
4896
  var canShowChangePlanButton = ((productPlans === null || productPlans === void 0 ? void 0 : productPlans.length) || 0) > 0;
5229
4897
  // 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
- });
4898
+ // const subscriptionCancel = useMutation({
4899
+ // mutationFn: () => cancelSubscription([subscription.id], token),
4900
+ // onSuccess: () => {
4901
+ // queryClient.invalidateQueries({
4902
+ // queryKey: QueryKeyFactory.default.createTableKey("subscriptions"),
4903
+ // });
4904
+ // showSuccessNotification("Subscription canceled");
4905
+ // },
4906
+ // });
5239
4907
  reactQuery.useMutation({
5240
4908
  mutationFn: function () {
5241
4909
  return getGuoteSubscriptionReinstate({
5242
4910
  ids: [subscription.id],
5243
4911
  token: token,
5244
- subdomain: subdomain,
4912
+ apiHost: apiHost,
5245
4913
  });
5246
4914
  },
5247
4915
  onSuccess: function (quote) {
@@ -5261,7 +4929,9 @@ var SubscriptionCardActions = function (_a) {
5261
4929
  onChangePlanClick();
5262
4930
  };
5263
4931
  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 () {
4932
+ canShowSubscriptionActions(subscription) ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!isTempViewOnly && canShowCancelButton && (jsxRuntime.jsx(antd.Popconfirm, __assign({ icon: null,
4933
+ // onConfirm={() => subscriptionCancel.mutate()}
4934
+ 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
4935
  // handleUpgradingSubscriptionChange({
5266
4936
  // subscription,
5267
4937
  // });
@@ -5279,16 +4949,16 @@ var getSubscriptionStatusText = function (subscription) {
5279
4949
  if (cancellationDate &&
5280
4950
  (state === null || state === void 0 ? void 0 : state.toUpperCase()) !== common.SubscriptionState.CANCELED &&
5281
4951
  (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)] })));
4952
+ return (jsxRuntime.jsxs(antd.Tag, __assign({ color: "red" }, { children: ["Canceled - ends on ", common.formatDate(cancellationDate)] })));
5283
4953
  }
5284
4954
  if (evergreen) {
5285
- return "Renews on ".concat(common.Misc.formatDate(endDate));
4955
+ return "Renews on ".concat(common.formatDate(endDate));
5286
4956
  }
5287
4957
  if ((state === null || state === void 0 ? void 0 : state.toUpperCase()) === common.SubscriptionState.CANCELED ||
5288
4958
  (state === null || state === void 0 ? void 0 : state.toUpperCase()) === common.SubscriptionState.EXPIRED) {
5289
- return "Ended on ".concat(common.Misc.formatDate(endDate));
4959
+ return "Ended on ".concat(common.formatDate(endDate));
5290
4960
  }
5291
- return "Ends on ".concat(common.Misc.formatDate(endDate));
4961
+ return "Ends on ".concat(common.formatDate(endDate));
5292
4962
  };
5293
4963
  var SubscriptionCardHeader = function (_a) {
5294
4964
  var _b, _c, _d, _e, _f;
@@ -5314,7 +4984,7 @@ var BillingPeriodConverter;
5314
4984
  var SubscriptionChargeTotal = function (_a) {
5315
4985
  var charge = _a.charge, subscription = _a.subscription;
5316
4986
  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] }))] })));
4987
+ 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
4988
  };
5319
4989
 
5320
4990
  var SubscriptionChargeUnitPrice = function (_a) {
@@ -5334,16 +5004,16 @@ var SubscriptionChargeUnitPrice = function (_a) {
5334
5004
  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
5005
  ? ((_e = (_d = charge.priceListCharge) === null || _d === void 0 ? void 0 : _d.priceListChargeTiers[index + 1]) === null || _e === void 0 ? void 0 : _e.starts) - 1
5336
5006
  : "∞";
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));
5007
+ 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
5008
  }) })) })));
5339
5009
  }, 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
5010
  }
5341
- return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: common.Misc.formatCurrency(charge.discountedPrice, subscription.currencyId) }));
5011
+ return jsxRuntime.jsx(jsxRuntime.Fragment, { children: common.formatCurrency(charge.discountedPrice, subscription.currencyId) });
5342
5012
  };
5343
5013
 
5344
5014
  var SubscriptionCardColumnHeaders = function (_a) {
5345
5015
  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)); });
5016
+ 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
5017
  };
5348
5018
 
5349
5019
  var Text$1 = antd.Typography.Text;
@@ -5400,13 +5070,13 @@ var SubscriptionCardDesktop = function (_a) {
5400
5070
  var SubscriptionCardDesktopRow = function (_a) {
5401
5071
  var charge = _a.charge, chargeIndex = _a.chargeIndex, subscription = _a.subscription;
5402
5072
  // Context
5403
- var token = React.useContext(BunnyContext).token;
5073
+ var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
5404
5074
  // Derived state
5405
5075
  var isRamp = charge.isRamp;
5406
5076
  var prevCharge = subscription.charges[chargeIndex - 1];
5407
5077
  var isFirstRampRow = chargeIndex === 0 ||
5408
5078
  (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));
5079
+ var chargePeriod = "".concat(common.formatDate(charge.startDate), " - ").concat(common.formatDate(charge.endDate));
5410
5080
  // Queries
5411
5081
  var data = reactQuery.useQuery({
5412
5082
  queryKey: ["getFeatureUsage", charge.id, charge.startDate, charge.endDate],
@@ -5416,6 +5086,7 @@ var SubscriptionCardDesktopRow = function (_a) {
5416
5086
  startDate: charge.startDate,
5417
5087
  subscriptionChargeId: charge.id,
5418
5088
  token: token,
5089
+ apiHost: apiHost,
5419
5090
  });
5420
5091
  },
5421
5092
  enabled: (!isRamp || (isRamp && isFirstRampRow)) &&
@@ -5475,7 +5146,7 @@ var SubscriptionCard = function (_a) {
5475
5146
  if ((isTrial && !charge.trial) || (!isTrial && charge.trial))
5476
5147
  return null;
5477
5148
  var isRamp = charge.isRamp;
5478
- var chargePeriod = "".concat(common.Misc.formatDate(charge.startDate), " - ").concat(common.Misc.formatDate(charge.endDate));
5149
+ var chargePeriod = "".concat(common.formatDate(charge.startDate), " - ").concat(common.formatDate(charge.endDate));
5479
5150
  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
5151
  })] })), jsxRuntime.jsx("div", __assign({ className: "flex gap-2 pt-5", style: {
5481
5152
  flexDirection: "column-reverse",
@@ -5485,13 +5156,13 @@ var SubscriptionCard = function (_a) {
5485
5156
  var SubscriptionsList = function (_a) {
5486
5157
  var hideExpired = _a.hideExpired, planChangeOptions = _a.planChangeOptions, setEditingQuoteData = _a.setEditingQuoteData, setPayModalVisible = _a.setPayModalVisible, subscriptions = _a.subscriptions;
5487
5158
  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
- });
5159
+ return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.map(function (subscription, subscriptionIndex) {
5160
+ if (hideExpired && isSubscriptionNotActive(subscription))
5161
+ return null;
5162
+ if (isMobile)
5163
+ return (jsxRuntime.jsx(SubscriptionCard, { planChangeOptions: planChangeOptions, setEditingQuoteData: setEditingQuoteData, setPayModalVisible: setPayModalVisible, subscription: subscription }, subscriptionIndex));
5164
+ return (jsxRuntime.jsx(SubscriptionCardDesktop, { planChangeOptions: planChangeOptions, setEditingQuoteData: setEditingQuoteData, setPayModalVisible: setPayModalVisible, subscription: subscription }, subscriptionIndex));
5165
+ }) }));
5495
5166
  };
5496
5167
 
5497
5168
  var ChangeQuantitiesButton = function (_a) {
@@ -5516,44 +5187,48 @@ var SubscriptionsNavigation = function (_a) {
5516
5187
  };
5517
5188
 
5518
5189
  var SubscriptionsContext = React.createContext({});
5190
+ // !!! This component is intended to be view only, however it still has lots of code for full functionality.
5191
+ // !!! This must be refactored.
5519
5192
  var Subscriptions = function (_a) {
5520
- var shadow = _a.shadow, gap = _a.gap, _b = _a.showTitle, showTitle = _b === void 0 ? true : _b;
5193
+ var companyName = _a.companyName, entityId = _a.entityId, gap = _a.gap, shadow = _a.shadow, _b = _a.showTitle, showTitle = _b === void 0 ? true : _b;
5521
5194
  // Context
5522
- var _c = React.useContext(BunnyContext), token = _c.token, subdomain = _c.subdomain;
5195
+ var _c = React.useContext(BunnyContext), token = _c.token, apiHost = _c.apiHost, onErrorNavigate = _c.onErrorNavigate;
5523
5196
  // Recoil state
5524
- var _d = recoil.useRecoilState(updatingChargeQuantityIdState), updatingChargeQuantityId = _d[0], setUpdatingChargeQuantityId = _d[1];
5197
+ // const [updatingChargeQuantityId, setUpdatingChargeQuantityId] =
5198
+ // useRecoilState(updatingChargeQuantityIdState);
5525
5199
  // 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];
5200
+ var _d = React.useState(), editingQuoteData = _d[0], setEditingQuoteData = _d[1];
5201
+ var _e = React.useState(false), payModalVisible = _e[0], setPayModalVisible = _e[1];
5202
+ var _f = React.useState(true), hideExpired = _f[0], setHideExpired = _f[1];
5203
+ var _g = React.useState(false); _g[0]; var setQuantityDrawerOpen = _g[1];
5530
5204
  // Hooks
5531
- var handleAllErrorFormats = common.NotificationUtils.useAllErrorFormats(function () { });
5205
+ var handleAllErrorFormats = common.useAllErrorFormats(onErrorNavigate ||
5206
+ (function (url) {
5207
+ console.log("navigate to", url, " not implemented");
5208
+ }));
5532
5209
  var queryClient = reactQuery.useQueryClient();
5533
- var showSuccessNotification = common.NotificationUtils.useSuccessNotification();
5534
- var quoteDelete = useQuoteDelete();
5210
+ var showSuccessNotification = common.useSuccessNotification();
5211
+ // const quoteDelete = useQuoteDelete();
5535
5212
  var isMobile = common.useIsMobile();
5536
- var entityId = common.useCurrentUserData().entityId;
5537
- var companyName = common.useCurrentUserData().companyName;
5538
5213
  // Queries
5539
- var _j = reactQuery.useQuery({
5214
+ var _h = reactQuery.useQuery({
5540
5215
  queryKey: common.QueryKeyFactory.default.createTableKey("subscriptions"),
5541
- queryFn: function () { return getSubscriptions({ entityId: entityId, token: token, subdomain: subdomain }); },
5216
+ queryFn: function () { return getSubscriptions({ entityId: entityId, token: token, apiHost: apiHost }); },
5542
5217
  enabled: Boolean(entityId),
5543
- }), rawSubscriptions = _j.data, subscriptionsAreLoading = _j.isLoading;
5218
+ }), rawSubscriptions = _h.data, subscriptionsAreLoading = _h.isLoading;
5544
5219
  var quote = reactQuery.useQuery({
5545
5220
  queryKey: common.QueryKeyFactory.default.createObjectKey("editingQuote", editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.id),
5546
5221
  queryFn: function () {
5547
5222
  return (editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.id)
5548
- ? getQuote({ token: token, id: editingQuoteData.id, subdomain: subdomain })
5223
+ ? getQuote({ token: token, id: editingQuoteData.id, apiHost: apiHost })
5549
5224
  : undefined;
5550
5225
  },
5551
5226
  enabled: Boolean(editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.id),
5552
5227
  }).data;
5553
- var _k = reactQuery.useQuery({
5228
+ var _j = reactQuery.useQuery({
5554
5229
  queryKey: common.QueryKeyFactory.default.planChangeOptionsKey(),
5555
- queryFn: function () { return getPlanChangeOptions({ token: token, subdomain: subdomain }); },
5556
- }), planChangeOptions = _k.data, arePlanChangeOptionsLoading = _k.isLoading;
5230
+ queryFn: function () { return getPlanChangeOptions({ token: token, apiHost: apiHost }); },
5231
+ }), planChangeOptions = _j.data, arePlanChangeOptionsLoading = _j.isLoading;
5557
5232
  // Derived state
5558
5233
  var subscriptions = useSubscriptions({ data: rawSubscriptions });
5559
5234
  var allSubscriptionsExpired = subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.every(function (subscription) {
@@ -5585,16 +5260,16 @@ var Subscriptions = function (_a) {
5585
5260
  var onFail = function (error) {
5586
5261
  handleAllErrorFormats(error);
5587
5262
  };
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
- };
5263
+ // const onClose = () => {
5264
+ // if (editingQuoteData) {
5265
+ // quoteDelete(editingQuoteData.id, token);
5266
+ // setEditingQuoteData(undefined);
5267
+ // }
5268
+ // // if (updatingChargeQuantityId) {
5269
+ // // setUpdatingChargeQuantityId(undefined);
5270
+ // // }
5271
+ // setQuantityDrawerOpen(false);
5272
+ // };
5598
5273
  if (subscriptionsAreLoading || arePlanChangeOptionsLoading)
5599
5274
  return jsxRuntime.jsx(jsxRuntime.Fragment, {});
5600
5275
  return (jsxRuntime.jsxs(SubscriptionsContext.Provider, __assign({ value: {
@@ -5608,9 +5283,9 @@ var Subscriptions = function (_a) {
5608
5283
  shadow: shadow,
5609
5284
  gap: gap,
5610
5285
  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: {
5286
+ } }, { 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
5287
  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 })] })));
5288
+ } }, { 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
5289
  };
5615
5290
 
5616
5291
  exports.BunnyProvider = BunnyProvider;