@bunnyapp/components 1.0.0 → 1.0.2

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 (332) hide show
  1. package/dist/cjs/index.js +1293 -975
  2. package/dist/cjs/playground/main.d.ts +1 -0
  3. package/dist/cjs/{types/src → src}/components/BunnyProvider.d.ts +5 -3
  4. package/dist/cjs/src/components/Card.d.ts +7 -0
  5. package/dist/cjs/src/components/Checkout/InvoiceCheckout.d.ts +27 -0
  6. package/dist/cjs/src/components/Footer.d.ts +4 -0
  7. package/dist/cjs/src/components/Icons/ArrowDownToLine.d.ts +5 -0
  8. package/dist/{esm/types → cjs}/src/components/PaymentForm/PaymentMethod/PaymentMethod.d.ts +1 -0
  9. package/dist/cjs/{types/src → src}/components/PaymentForm/PaymentOption.d.ts +1 -1
  10. package/dist/cjs/src/components/Signup/PaymentForms.d.ts +19 -0
  11. package/dist/cjs/src/components/Signup/PaymentSuccess.d.ts +7 -0
  12. package/dist/cjs/src/components/Signup/PriceListDisplay.d.ts +6 -0
  13. package/dist/cjs/src/components/Signup/Signup.d.ts +5 -0
  14. package/dist/cjs/src/components/Signup/Signup.stories.d.ts +8 -0
  15. package/dist/cjs/src/components/Signup/index.d.ts +1 -0
  16. package/dist/cjs/{types/src → src}/components/Subscriptions/Subscriptions.d.ts +1 -1
  17. package/dist/cjs/{types/src → src}/components/Transactions/Transactions.d.ts +4 -3
  18. package/dist/{esm/types → cjs}/src/components/Transactions/TransactionsListContext.d.ts +1 -0
  19. package/dist/cjs/{types/src → src}/components/index.d.ts +1 -0
  20. package/dist/cjs/src/contexts/PaymentContext.d.ts +6 -0
  21. package/dist/cjs/src/graphql/mutations/accountSignup.d.ts +12 -0
  22. package/dist/cjs/src/graphql/mutations/portalSessionCreate.d.ts +8 -0
  23. package/dist/cjs/src/graphql/mutations/quoteAccountSignup.d.ts +14 -0
  24. package/dist/{esm/types → cjs}/src/graphql/mutations/quoteCompose.d.ts +5 -3
  25. package/dist/cjs/src/graphql/mutations/quoteCreate.d.ts +9 -0
  26. package/dist/cjs/src/graphql/queries/getAccount.d.ts +7 -0
  27. package/dist/cjs/src/graphql/queries/getFormattedQuote.d.ts +7 -0
  28. package/dist/cjs/src/graphql/queries/getPriceList.d.ts +7 -0
  29. package/dist/cjs/src/graphql/queries/getSubscription.d.ts +12 -0
  30. package/dist/cjs/{types/src → src}/mocks/handlers.d.ts +1 -1
  31. package/dist/esm/index.js +1294 -978
  32. package/dist/esm/playground/main.d.ts +1 -0
  33. package/dist/esm/{types/src → src}/components/BunnyProvider.d.ts +5 -3
  34. package/dist/esm/src/components/Card.d.ts +7 -0
  35. package/dist/esm/src/components/Checkout/InvoiceCheckout.d.ts +27 -0
  36. package/dist/esm/src/components/Footer.d.ts +4 -0
  37. package/dist/esm/src/components/Icons/ArrowDownToLine.d.ts +5 -0
  38. package/dist/{cjs/types → esm}/src/components/PaymentForm/PaymentMethod/PaymentMethod.d.ts +1 -0
  39. package/dist/esm/{types/src → src}/components/PaymentForm/PaymentOption.d.ts +1 -1
  40. package/dist/esm/src/components/Signup/PaymentForms.d.ts +19 -0
  41. package/dist/esm/src/components/Signup/PaymentSuccess.d.ts +7 -0
  42. package/dist/esm/src/components/Signup/PriceListDisplay.d.ts +6 -0
  43. package/dist/esm/src/components/Signup/Signup.d.ts +5 -0
  44. package/dist/esm/src/components/Signup/Signup.stories.d.ts +8 -0
  45. package/dist/esm/src/components/Signup/index.d.ts +1 -0
  46. package/dist/esm/{types/src → src}/components/Subscriptions/Subscriptions.d.ts +1 -1
  47. package/dist/esm/{types/src → src}/components/Transactions/Transactions.d.ts +4 -3
  48. package/dist/{cjs/types → esm}/src/components/Transactions/TransactionsListContext.d.ts +1 -0
  49. package/dist/esm/{types/src → src}/components/index.d.ts +1 -0
  50. package/dist/esm/src/contexts/PaymentContext.d.ts +6 -0
  51. package/dist/esm/src/graphql/mutations/accountSignup.d.ts +12 -0
  52. package/dist/esm/src/graphql/mutations/portalSessionCreate.d.ts +8 -0
  53. package/dist/esm/src/graphql/mutations/quoteAccountSignup.d.ts +14 -0
  54. package/dist/{cjs/types → esm}/src/graphql/mutations/quoteCompose.d.ts +5 -3
  55. package/dist/esm/src/graphql/mutations/quoteCreate.d.ts +9 -0
  56. package/dist/esm/src/graphql/queries/getAccount.d.ts +7 -0
  57. package/dist/esm/src/graphql/queries/getFormattedQuote.d.ts +7 -0
  58. package/dist/esm/src/graphql/queries/getPriceList.d.ts +7 -0
  59. package/dist/esm/src/graphql/queries/getSubscription.d.ts +12 -0
  60. package/dist/esm/{types/src → src}/mocks/handlers.d.ts +1 -1
  61. package/dist/index.d.ts +14 -9
  62. package/package.json +16 -10
  63. package/dist/cjs/types/playground/main.d.ts +0 -1
  64. package/dist/cjs/types/src/components/Card.d.ts +0 -5
  65. package/dist/cjs/types/src/components/Checkout/InvoiceCheckout.d.ts +0 -7
  66. package/dist/cjs/types/src/components/Footer.d.ts +0 -2
  67. package/dist/cjs/types/src/components/Quote/QuoteContext.d.ts +0 -5
  68. package/dist/cjs/types/src/graphql/queries/getFormattedQuote.d.ts +0 -3
  69. package/dist/esm/types/playground/main.d.ts +0 -1
  70. package/dist/esm/types/src/components/Card.d.ts +0 -5
  71. package/dist/esm/types/src/components/Checkout/InvoiceCheckout.d.ts +0 -7
  72. package/dist/esm/types/src/components/Footer.d.ts +0 -2
  73. package/dist/esm/types/src/components/Quote/QuoteContext.d.ts +0 -5
  74. package/dist/esm/types/src/graphql/queries/getFormattedQuote.d.ts +0 -3
  75. /package/dist/cjs/{types/src → src}/atoms/pageContentRefAtom.d.ts +0 -0
  76. /package/dist/cjs/{types/src → src}/atoms/planPickerQuoteDataAtom.d.ts +0 -0
  77. /package/dist/cjs/{types/src → src}/atoms/updatingChargeQuantityIdAtom.d.ts +0 -0
  78. /package/dist/cjs/{types/src → src}/components/Checkout/Checkout.d.ts +0 -0
  79. /package/dist/cjs/{types/src → src}/components/Checkout/CouponComponent.d.ts +0 -0
  80. /package/dist/cjs/{types/src → src}/components/Checkout/QuoteCheckout.d.ts +0 -0
  81. /package/dist/cjs/{types/src → src}/components/Checkout/checkoutUtils.d.ts +0 -0
  82. /package/dist/cjs/{types/src → src}/components/Checkout/index.d.ts +0 -0
  83. /package/dist/cjs/{types/src → src}/components/DrawerHeader.d.ts +0 -0
  84. /package/dist/cjs/{types/src → src}/components/Error.d.ts +0 -0
  85. /package/dist/cjs/{types/src → src}/components/FeatureUsageGraph.d.ts +0 -0
  86. /package/dist/cjs/{types/src → src}/components/HeaderModalWrapper.d.ts +0 -0
  87. /package/dist/cjs/{types/src → src}/components/Icons/BunnyFooterIcon.d.ts +0 -0
  88. /package/dist/cjs/{types/src → src}/components/Icons/CardIcon.d.ts +0 -0
  89. /package/dist/cjs/{types/src → src}/components/Invoice/Invoice.d.ts +0 -0
  90. /package/dist/cjs/{types/src → src}/components/Invoice/Invoice.stories.d.ts +0 -0
  91. /package/dist/cjs/{types/src → src}/components/Invoice/InvoiceQuoteView.d.ts +0 -0
  92. /package/dist/cjs/{types/src → src}/components/Invoice/index.d.ts +0 -0
  93. /package/dist/cjs/{types/src → src}/components/LegacyInvoicePDF.d.ts +0 -0
  94. /package/dist/cjs/{types/src → src}/components/PageContent.d.ts +0 -0
  95. /package/dist/cjs/{types/src → src}/components/PageHeaderWithActions.d.ts +0 -0
  96. /package/dist/cjs/{types/src → src}/components/PageWrapper.d.ts +0 -0
  97. /package/dist/cjs/{types/src → src}/components/PandadocPollingModal.d.ts +0 -0
  98. /package/dist/cjs/{types/src → src}/components/PaymentForm/CheckoutFooter.d.ts +0 -0
  99. /package/dist/cjs/{types/src → src}/components/PaymentForm/DemoPay/DemoPayCardCvc.d.ts +0 -0
  100. /package/dist/cjs/{types/src → src}/components/PaymentForm/DemoPay/DemoPayCardNumber.d.ts +0 -0
  101. /package/dist/cjs/{types/src → src}/components/PaymentForm/DemoPay/DemoPayExpiry.d.ts +0 -0
  102. /package/dist/cjs/{types/src → src}/components/PaymentForm/DemoPay/DemoPayForm.d.ts +0 -0
  103. /package/dist/cjs/{types/src → src}/components/PaymentForm/DemoPay/demoPayUtils.d.ts +0 -0
  104. /package/dist/cjs/{types/src → src}/components/PaymentForm/DemoPay/index.d.ts +0 -0
  105. /package/dist/cjs/{types/src → src}/components/PaymentForm/Finix/FinixCardForm.d.ts +0 -0
  106. /package/dist/cjs/{types/src → src}/components/PaymentForm/Finix/index.d.ts +0 -0
  107. /package/dist/cjs/{types/src → src}/components/PaymentForm/FinixAch.d.ts +0 -0
  108. /package/dist/cjs/{types/src → src}/components/PaymentForm/PaymentForm.d.ts +0 -0
  109. /package/dist/cjs/{types/src → src}/components/PaymentForm/PaymentFormTypes.d.ts +0 -0
  110. /package/dist/cjs/{types/src → src}/components/PaymentForm/PaymentMethod/CreditCard/CreditCard.d.ts +0 -0
  111. /package/dist/cjs/{types/src → src}/components/PaymentForm/PaymentMethod/CreditCard/LargCardIcon.d.ts +0 -0
  112. /package/dist/cjs/{types/src → src}/components/PaymentForm/PaymentMethod/CreditCard/PlusIcon.d.ts +0 -0
  113. /package/dist/cjs/{types/src → src}/components/PaymentForm/PaymentMethod/PaymentMethodContext.d.ts +0 -0
  114. /package/dist/cjs/{types/src → src}/components/PaymentForm/PaymentMethod/index.d.ts +0 -0
  115. /package/dist/cjs/{types/src → src}/components/PaymentForm/PaymentMethodForm.d.ts +0 -0
  116. /package/dist/cjs/{types/src → src}/components/PaymentForm/PaymentMethodSelector.d.ts +0 -0
  117. /package/dist/cjs/{types/src → src}/components/PaymentForm/StoredPaymentMethod/StoredPaymentMethodForm.d.ts +0 -0
  118. /package/dist/cjs/{types/src → src}/components/PaymentForm/Stripe/CheckoutForm.d.ts +0 -0
  119. /package/dist/cjs/{types/src → src}/components/PaymentForm/Stripe/PaymentMethodForm.d.ts +0 -0
  120. /package/dist/cjs/{types/src → src}/components/PaymentForm/Stripe/StripeForm.d.ts +0 -0
  121. /package/dist/cjs/{types/src → src}/components/PaymentForm/Stripe/index.d.ts +0 -0
  122. /package/dist/cjs/{types/src → src}/components/PaymentForm/Stripe/stripeUtils.d.ts +0 -0
  123. /package/dist/cjs/{types/src → src}/components/PaymentForm/index.d.ts +0 -0
  124. /package/dist/cjs/{types/src → src}/components/PaymentForm/paymentUtils.d.ts +0 -0
  125. /package/dist/cjs/{types/src → src}/components/Quote/AcceptQuoteModal.d.ts +0 -0
  126. /package/dist/cjs/{types/src → src}/components/Quote/DocumentNameEnum.d.ts +0 -0
  127. /package/dist/cjs/{types/src → src}/components/Quote/Quote.d.ts +0 -0
  128. /package/dist/cjs/{types/src → src}/components/Quote/Quote.stories.d.ts +0 -0
  129. /package/dist/cjs/{types/src → src}/components/Quote/StyledModal.d.ts +0 -0
  130. /package/dist/cjs/{types/src → src}/components/Quote/index.d.ts +0 -0
  131. /package/dist/cjs/{types/src → src}/components/StateTag.d.ts +0 -0
  132. /package/dist/cjs/{types/src → src}/components/Subscriptions/index.d.ts +0 -0
  133. /package/dist/cjs/{types/src → src}/components/Subscriptions/subscriptionsList/ChangeQuantitiesButton.d.ts +0 -0
  134. /package/dist/cjs/{types/src → src}/components/Subscriptions/subscriptionsList/HideExpiredToggle.d.ts +0 -0
  135. /package/dist/cjs/{types/src → src}/components/Subscriptions/subscriptionsList/SubscriptionCardActions.d.ts +0 -0
  136. /package/dist/cjs/{types/src → src}/components/Subscriptions/subscriptionsList/SubscriptionCardHeader.d.ts +0 -0
  137. /package/dist/cjs/{types/src → src}/components/Subscriptions/subscriptionsList/SubscriptionChargeTotal.d.ts +0 -0
  138. /package/dist/cjs/{types/src → src}/components/Subscriptions/subscriptionsList/SubscriptionChargeUnitPrice.d.ts +0 -0
  139. /package/dist/cjs/{types/src → src}/components/Subscriptions/subscriptionsList/SubscriptionsList.d.ts +0 -0
  140. /package/dist/cjs/{types/src → src}/components/Subscriptions/subscriptionsList/SubscriptionsNavigation.d.ts +0 -0
  141. /package/dist/cjs/{types/src → src}/components/Subscriptions/subscriptionsList/subscriptionCardDesktop/SubscriptionCardColumnHeaders.d.ts +0 -0
  142. /package/dist/cjs/{types/src → src}/components/Subscriptions/subscriptionsList/subscriptionCardDesktop/SubscriptionCardDesktop.d.ts +0 -0
  143. /package/dist/cjs/{types/src → src}/components/Subscriptions/subscriptionsList/subscriptionCardDesktop/SubscriptionsCardCell.d.ts +0 -0
  144. /package/dist/cjs/{types/src → src}/components/Subscriptions/subscriptionsList/subscriptionCardMobile/SubscriptionCardCellMobile.d.ts +0 -0
  145. /package/dist/cjs/{types/src → src}/components/Subscriptions/subscriptionsList/subscriptionCardMobile/SubscriptionCardMobile.d.ts +0 -0
  146. /package/dist/cjs/{types/src → src}/components/Subscriptions/subscriptionsList/subscriptionUtils.d.ts +0 -0
  147. /package/dist/cjs/{types/src → src}/components/TaxationForm.d.ts +0 -0
  148. /package/dist/cjs/{types/src → src}/components/Transactions/DocumentNameEnum.d.ts +0 -0
  149. /package/dist/cjs/{types/src → src}/components/Transactions/Transactions.stories.d.ts +0 -0
  150. /package/dist/cjs/{types/src → src}/components/Transactions/index.d.ts +0 -0
  151. /package/dist/cjs/{types/src → src}/components/Transactions/transactionsList/TransactionDate.d.ts +0 -0
  152. /package/dist/cjs/{types/src → src}/components/Transactions/transactionsList/TransactionDownload.d.ts +0 -0
  153. /package/dist/cjs/{types/src → src}/components/Transactions/transactionsList/TransactionGridCell.d.ts +0 -0
  154. /package/dist/cjs/{types/src → src}/components/Transactions/transactionsList/TransactionTitle.d.ts +0 -0
  155. /package/dist/cjs/{types/src → src}/components/Transactions/transactionsList/TransactionsEmptyState.d.ts +0 -0
  156. /package/dist/cjs/{types/src → src}/components/Transactions/transactionsList/TransactionsListDesktop.d.ts +0 -0
  157. /package/dist/cjs/{types/src → src}/components/Transactions/transactionsList/TransactionsListMobile.d.ts +0 -0
  158. /package/dist/cjs/{types/src → src}/consts/paymentConsts.d.ts +0 -0
  159. /package/dist/cjs/{types/src → src}/contexts/BrandContext.d.ts +0 -0
  160. /package/dist/cjs/{types/src → src}/contexts/NavigationContext.d.ts +0 -0
  161. /package/dist/cjs/{types/src → src}/enums/SubscriptionState.d.ts +0 -0
  162. /package/dist/cjs/{types/src → src}/features/quantityChangeDrawer/QuantityChangeGridRow.d.ts +0 -0
  163. /package/dist/cjs/{types/src → src}/features/quantityChangeDrawer/QuantityChangeGridTitle.d.ts +0 -0
  164. /package/dist/cjs/{types/src → src}/features/quantityChangeDrawer/QuantityInput.d.ts +0 -0
  165. /package/dist/cjs/{types/src → src}/features/quantityChangeDrawer/QuoteChangeSummarySection.d.ts +0 -0
  166. /package/dist/cjs/{types/src → src}/features/quantityChangeDrawer/quantityChangeDrawerDesktop/QuantityChangeDrawerDesktop.d.ts +0 -0
  167. /package/dist/cjs/{types/src → src}/graphql/QuoteRequests.d.ts +0 -0
  168. /package/dist/cjs/{types/src → src}/graphql/SubscriptionRequests.d.ts +0 -0
  169. /package/dist/cjs/{types/src → src}/graphql/mutations/accountUpdate.d.ts +0 -0
  170. /package/dist/cjs/{types/src → src}/graphql/mutations/checkout.d.ts +0 -0
  171. /package/dist/cjs/{types/src → src}/graphql/mutations/quoteAddCoupon.d.ts +0 -0
  172. /package/dist/cjs/{types/src → src}/graphql/mutations/quoteRecalculateTaxes.d.ts +0 -0
  173. /package/dist/cjs/{types/src → src}/graphql/mutations/quoteSubscriptionReinstate.d.ts +0 -0
  174. /package/dist/cjs/{types/src → src}/graphql/queries/getBranding.d.ts +0 -0
  175. /package/dist/cjs/{types/src → src}/graphql/queries/getCurrentUserData.d.ts +0 -0
  176. /package/dist/cjs/{types/src → src}/graphql/queries/getFeatureUsage.d.ts +0 -0
  177. /package/dist/cjs/{types/src → src}/graphql/queries/getFormattedInvoice.d.ts +0 -0
  178. /package/dist/cjs/{types/src → src}/graphql/queries/getInvoice.d.ts +0 -0
  179. /package/dist/cjs/{types/src → src}/graphql/queries/getPlanChangeOptions.d.ts +0 -0
  180. /package/dist/cjs/{types/src → src}/graphql/queries/getQuote.d.ts +0 -0
  181. /package/dist/cjs/{types/src → src}/graphql/queries/getSubscriptions.d.ts +0 -0
  182. /package/dist/cjs/{types/src → src}/graphql/queries/getTransactions.d.ts +0 -0
  183. /package/dist/cjs/{types/src → src}/hooks/index.d.ts +0 -0
  184. /package/dist/cjs/{types/src → src}/hooks/quotes/useSendAcceptQuote.d.ts +0 -0
  185. /package/dist/cjs/{types/src → src}/hooks/quotes/useSigningComplete.d.ts +0 -0
  186. /package/dist/cjs/{types/src → src}/hooks/subscriptions/useSubscriptions.d.ts +0 -0
  187. /package/dist/cjs/{types/src → src}/hooks/useCurrentUserData.d.ts +0 -0
  188. /package/dist/cjs/{types/src → src}/hooks/useFocusFirstInput.d.ts +0 -0
  189. /package/dist/cjs/{types/src → src}/hooks/useHasTaxPlugin.d.ts +0 -0
  190. /package/dist/cjs/{types/src → src}/hooks/useIsExpired.d.ts +0 -0
  191. /package/dist/cjs/{types/src → src}/hooks/useIsMobile.d.ts +0 -0
  192. /package/dist/cjs/{types/src → src}/hooks/usePaymentMethod.d.ts +0 -0
  193. /package/dist/cjs/{types/src → src}/hooks/useSigningPlugins.d.ts +0 -0
  194. /package/dist/cjs/{types/src → src}/index.d.ts +0 -0
  195. /package/dist/cjs/{types/src → src}/mocks/browser.d.ts +0 -0
  196. /package/dist/cjs/{types/src → src}/stories/Button.d.ts +0 -0
  197. /package/dist/cjs/{types/src → src}/stories/Button.stories.d.ts +0 -0
  198. /package/dist/cjs/{types/src → src}/stories/Header.d.ts +0 -0
  199. /package/dist/cjs/{types/src → src}/stories/Header.stories.d.ts +0 -0
  200. /package/dist/cjs/{types/src → src}/stories/Page.d.ts +0 -0
  201. /package/dist/cjs/{types/src → src}/stories/Page.stories.d.ts +0 -0
  202. /package/dist/cjs/{types/src → src}/utils.d.ts +0 -0
  203. /package/dist/cjs/{types/vite.config.d.ts → vite.config.d.ts} +0 -0
  204. /package/dist/esm/{types/src → src}/atoms/pageContentRefAtom.d.ts +0 -0
  205. /package/dist/esm/{types/src → src}/atoms/planPickerQuoteDataAtom.d.ts +0 -0
  206. /package/dist/esm/{types/src → src}/atoms/updatingChargeQuantityIdAtom.d.ts +0 -0
  207. /package/dist/esm/{types/src → src}/components/Checkout/Checkout.d.ts +0 -0
  208. /package/dist/esm/{types/src → src}/components/Checkout/CouponComponent.d.ts +0 -0
  209. /package/dist/esm/{types/src → src}/components/Checkout/QuoteCheckout.d.ts +0 -0
  210. /package/dist/esm/{types/src → src}/components/Checkout/checkoutUtils.d.ts +0 -0
  211. /package/dist/esm/{types/src → src}/components/Checkout/index.d.ts +0 -0
  212. /package/dist/esm/{types/src → src}/components/DrawerHeader.d.ts +0 -0
  213. /package/dist/esm/{types/src → src}/components/Error.d.ts +0 -0
  214. /package/dist/esm/{types/src → src}/components/FeatureUsageGraph.d.ts +0 -0
  215. /package/dist/esm/{types/src → src}/components/HeaderModalWrapper.d.ts +0 -0
  216. /package/dist/esm/{types/src → src}/components/Icons/BunnyFooterIcon.d.ts +0 -0
  217. /package/dist/esm/{types/src → src}/components/Icons/CardIcon.d.ts +0 -0
  218. /package/dist/esm/{types/src → src}/components/Invoice/Invoice.d.ts +0 -0
  219. /package/dist/esm/{types/src → src}/components/Invoice/Invoice.stories.d.ts +0 -0
  220. /package/dist/esm/{types/src → src}/components/Invoice/InvoiceQuoteView.d.ts +0 -0
  221. /package/dist/esm/{types/src → src}/components/Invoice/index.d.ts +0 -0
  222. /package/dist/esm/{types/src → src}/components/LegacyInvoicePDF.d.ts +0 -0
  223. /package/dist/esm/{types/src → src}/components/PageContent.d.ts +0 -0
  224. /package/dist/esm/{types/src → src}/components/PageHeaderWithActions.d.ts +0 -0
  225. /package/dist/esm/{types/src → src}/components/PageWrapper.d.ts +0 -0
  226. /package/dist/esm/{types/src → src}/components/PandadocPollingModal.d.ts +0 -0
  227. /package/dist/esm/{types/src → src}/components/PaymentForm/CheckoutFooter.d.ts +0 -0
  228. /package/dist/esm/{types/src → src}/components/PaymentForm/DemoPay/DemoPayCardCvc.d.ts +0 -0
  229. /package/dist/esm/{types/src → src}/components/PaymentForm/DemoPay/DemoPayCardNumber.d.ts +0 -0
  230. /package/dist/esm/{types/src → src}/components/PaymentForm/DemoPay/DemoPayExpiry.d.ts +0 -0
  231. /package/dist/esm/{types/src → src}/components/PaymentForm/DemoPay/DemoPayForm.d.ts +0 -0
  232. /package/dist/esm/{types/src → src}/components/PaymentForm/DemoPay/demoPayUtils.d.ts +0 -0
  233. /package/dist/esm/{types/src → src}/components/PaymentForm/DemoPay/index.d.ts +0 -0
  234. /package/dist/esm/{types/src → src}/components/PaymentForm/Finix/FinixCardForm.d.ts +0 -0
  235. /package/dist/esm/{types/src → src}/components/PaymentForm/Finix/index.d.ts +0 -0
  236. /package/dist/esm/{types/src → src}/components/PaymentForm/FinixAch.d.ts +0 -0
  237. /package/dist/esm/{types/src → src}/components/PaymentForm/PaymentForm.d.ts +0 -0
  238. /package/dist/esm/{types/src → src}/components/PaymentForm/PaymentFormTypes.d.ts +0 -0
  239. /package/dist/esm/{types/src → src}/components/PaymentForm/PaymentMethod/CreditCard/CreditCard.d.ts +0 -0
  240. /package/dist/esm/{types/src → src}/components/PaymentForm/PaymentMethod/CreditCard/LargCardIcon.d.ts +0 -0
  241. /package/dist/esm/{types/src → src}/components/PaymentForm/PaymentMethod/CreditCard/PlusIcon.d.ts +0 -0
  242. /package/dist/esm/{types/src → src}/components/PaymentForm/PaymentMethod/PaymentMethodContext.d.ts +0 -0
  243. /package/dist/esm/{types/src → src}/components/PaymentForm/PaymentMethod/index.d.ts +0 -0
  244. /package/dist/esm/{types/src → src}/components/PaymentForm/PaymentMethodForm.d.ts +0 -0
  245. /package/dist/esm/{types/src → src}/components/PaymentForm/PaymentMethodSelector.d.ts +0 -0
  246. /package/dist/esm/{types/src → src}/components/PaymentForm/StoredPaymentMethod/StoredPaymentMethodForm.d.ts +0 -0
  247. /package/dist/esm/{types/src → src}/components/PaymentForm/Stripe/CheckoutForm.d.ts +0 -0
  248. /package/dist/esm/{types/src → src}/components/PaymentForm/Stripe/PaymentMethodForm.d.ts +0 -0
  249. /package/dist/esm/{types/src → src}/components/PaymentForm/Stripe/StripeForm.d.ts +0 -0
  250. /package/dist/esm/{types/src → src}/components/PaymentForm/Stripe/index.d.ts +0 -0
  251. /package/dist/esm/{types/src → src}/components/PaymentForm/Stripe/stripeUtils.d.ts +0 -0
  252. /package/dist/esm/{types/src → src}/components/PaymentForm/index.d.ts +0 -0
  253. /package/dist/esm/{types/src → src}/components/PaymentForm/paymentUtils.d.ts +0 -0
  254. /package/dist/esm/{types/src → src}/components/Quote/AcceptQuoteModal.d.ts +0 -0
  255. /package/dist/esm/{types/src → src}/components/Quote/DocumentNameEnum.d.ts +0 -0
  256. /package/dist/esm/{types/src → src}/components/Quote/Quote.d.ts +0 -0
  257. /package/dist/esm/{types/src → src}/components/Quote/Quote.stories.d.ts +0 -0
  258. /package/dist/esm/{types/src → src}/components/Quote/StyledModal.d.ts +0 -0
  259. /package/dist/esm/{types/src → src}/components/Quote/index.d.ts +0 -0
  260. /package/dist/esm/{types/src → src}/components/StateTag.d.ts +0 -0
  261. /package/dist/esm/{types/src → src}/components/Subscriptions/index.d.ts +0 -0
  262. /package/dist/esm/{types/src → src}/components/Subscriptions/subscriptionsList/ChangeQuantitiesButton.d.ts +0 -0
  263. /package/dist/esm/{types/src → src}/components/Subscriptions/subscriptionsList/HideExpiredToggle.d.ts +0 -0
  264. /package/dist/esm/{types/src → src}/components/Subscriptions/subscriptionsList/SubscriptionCardActions.d.ts +0 -0
  265. /package/dist/esm/{types/src → src}/components/Subscriptions/subscriptionsList/SubscriptionCardHeader.d.ts +0 -0
  266. /package/dist/esm/{types/src → src}/components/Subscriptions/subscriptionsList/SubscriptionChargeTotal.d.ts +0 -0
  267. /package/dist/esm/{types/src → src}/components/Subscriptions/subscriptionsList/SubscriptionChargeUnitPrice.d.ts +0 -0
  268. /package/dist/esm/{types/src → src}/components/Subscriptions/subscriptionsList/SubscriptionsList.d.ts +0 -0
  269. /package/dist/esm/{types/src → src}/components/Subscriptions/subscriptionsList/SubscriptionsNavigation.d.ts +0 -0
  270. /package/dist/esm/{types/src → src}/components/Subscriptions/subscriptionsList/subscriptionCardDesktop/SubscriptionCardColumnHeaders.d.ts +0 -0
  271. /package/dist/esm/{types/src → src}/components/Subscriptions/subscriptionsList/subscriptionCardDesktop/SubscriptionCardDesktop.d.ts +0 -0
  272. /package/dist/esm/{types/src → src}/components/Subscriptions/subscriptionsList/subscriptionCardDesktop/SubscriptionsCardCell.d.ts +0 -0
  273. /package/dist/esm/{types/src → src}/components/Subscriptions/subscriptionsList/subscriptionCardMobile/SubscriptionCardCellMobile.d.ts +0 -0
  274. /package/dist/esm/{types/src → src}/components/Subscriptions/subscriptionsList/subscriptionCardMobile/SubscriptionCardMobile.d.ts +0 -0
  275. /package/dist/esm/{types/src → src}/components/Subscriptions/subscriptionsList/subscriptionUtils.d.ts +0 -0
  276. /package/dist/esm/{types/src → src}/components/TaxationForm.d.ts +0 -0
  277. /package/dist/esm/{types/src → src}/components/Transactions/DocumentNameEnum.d.ts +0 -0
  278. /package/dist/esm/{types/src → src}/components/Transactions/Transactions.stories.d.ts +0 -0
  279. /package/dist/esm/{types/src → src}/components/Transactions/index.d.ts +0 -0
  280. /package/dist/esm/{types/src → src}/components/Transactions/transactionsList/TransactionDate.d.ts +0 -0
  281. /package/dist/esm/{types/src → src}/components/Transactions/transactionsList/TransactionDownload.d.ts +0 -0
  282. /package/dist/esm/{types/src → src}/components/Transactions/transactionsList/TransactionGridCell.d.ts +0 -0
  283. /package/dist/esm/{types/src → src}/components/Transactions/transactionsList/TransactionTitle.d.ts +0 -0
  284. /package/dist/esm/{types/src → src}/components/Transactions/transactionsList/TransactionsEmptyState.d.ts +0 -0
  285. /package/dist/esm/{types/src → src}/components/Transactions/transactionsList/TransactionsListDesktop.d.ts +0 -0
  286. /package/dist/esm/{types/src → src}/components/Transactions/transactionsList/TransactionsListMobile.d.ts +0 -0
  287. /package/dist/esm/{types/src → src}/consts/paymentConsts.d.ts +0 -0
  288. /package/dist/esm/{types/src → src}/contexts/BrandContext.d.ts +0 -0
  289. /package/dist/esm/{types/src → src}/contexts/NavigationContext.d.ts +0 -0
  290. /package/dist/esm/{types/src → src}/enums/SubscriptionState.d.ts +0 -0
  291. /package/dist/esm/{types/src → src}/features/quantityChangeDrawer/QuantityChangeGridRow.d.ts +0 -0
  292. /package/dist/esm/{types/src → src}/features/quantityChangeDrawer/QuantityChangeGridTitle.d.ts +0 -0
  293. /package/dist/esm/{types/src → src}/features/quantityChangeDrawer/QuantityInput.d.ts +0 -0
  294. /package/dist/esm/{types/src → src}/features/quantityChangeDrawer/QuoteChangeSummarySection.d.ts +0 -0
  295. /package/dist/esm/{types/src → src}/features/quantityChangeDrawer/quantityChangeDrawerDesktop/QuantityChangeDrawerDesktop.d.ts +0 -0
  296. /package/dist/esm/{types/src → src}/graphql/QuoteRequests.d.ts +0 -0
  297. /package/dist/esm/{types/src → src}/graphql/SubscriptionRequests.d.ts +0 -0
  298. /package/dist/esm/{types/src → src}/graphql/mutations/accountUpdate.d.ts +0 -0
  299. /package/dist/esm/{types/src → src}/graphql/mutations/checkout.d.ts +0 -0
  300. /package/dist/esm/{types/src → src}/graphql/mutations/quoteAddCoupon.d.ts +0 -0
  301. /package/dist/esm/{types/src → src}/graphql/mutations/quoteRecalculateTaxes.d.ts +0 -0
  302. /package/dist/esm/{types/src → src}/graphql/mutations/quoteSubscriptionReinstate.d.ts +0 -0
  303. /package/dist/esm/{types/src → src}/graphql/queries/getBranding.d.ts +0 -0
  304. /package/dist/esm/{types/src → src}/graphql/queries/getCurrentUserData.d.ts +0 -0
  305. /package/dist/esm/{types/src → src}/graphql/queries/getFeatureUsage.d.ts +0 -0
  306. /package/dist/esm/{types/src → src}/graphql/queries/getFormattedInvoice.d.ts +0 -0
  307. /package/dist/esm/{types/src → src}/graphql/queries/getInvoice.d.ts +0 -0
  308. /package/dist/esm/{types/src → src}/graphql/queries/getPlanChangeOptions.d.ts +0 -0
  309. /package/dist/esm/{types/src → src}/graphql/queries/getQuote.d.ts +0 -0
  310. /package/dist/esm/{types/src → src}/graphql/queries/getSubscriptions.d.ts +0 -0
  311. /package/dist/esm/{types/src → src}/graphql/queries/getTransactions.d.ts +0 -0
  312. /package/dist/esm/{types/src → src}/hooks/index.d.ts +0 -0
  313. /package/dist/esm/{types/src → src}/hooks/quotes/useSendAcceptQuote.d.ts +0 -0
  314. /package/dist/esm/{types/src → src}/hooks/quotes/useSigningComplete.d.ts +0 -0
  315. /package/dist/esm/{types/src → src}/hooks/subscriptions/useSubscriptions.d.ts +0 -0
  316. /package/dist/esm/{types/src → src}/hooks/useCurrentUserData.d.ts +0 -0
  317. /package/dist/esm/{types/src → src}/hooks/useFocusFirstInput.d.ts +0 -0
  318. /package/dist/esm/{types/src → src}/hooks/useHasTaxPlugin.d.ts +0 -0
  319. /package/dist/esm/{types/src → src}/hooks/useIsExpired.d.ts +0 -0
  320. /package/dist/esm/{types/src → src}/hooks/useIsMobile.d.ts +0 -0
  321. /package/dist/esm/{types/src → src}/hooks/usePaymentMethod.d.ts +0 -0
  322. /package/dist/esm/{types/src → src}/hooks/useSigningPlugins.d.ts +0 -0
  323. /package/dist/esm/{types/src → src}/index.d.ts +0 -0
  324. /package/dist/esm/{types/src → src}/mocks/browser.d.ts +0 -0
  325. /package/dist/esm/{types/src → src}/stories/Button.d.ts +0 -0
  326. /package/dist/esm/{types/src → src}/stories/Button.stories.d.ts +0 -0
  327. /package/dist/esm/{types/src → src}/stories/Header.d.ts +0 -0
  328. /package/dist/esm/{types/src → src}/stories/Header.stories.d.ts +0 -0
  329. /package/dist/esm/{types/src → src}/stories/Page.d.ts +0 -0
  330. /package/dist/esm/{types/src → src}/stories/Page.stories.d.ts +0 -0
  331. /package/dist/esm/{types/src → src}/utils.d.ts +0 -0
  332. /package/dist/esm/{types/vite.config.d.ts → vite.config.d.ts} +0 -0
package/dist/cjs/index.js CHANGED
@@ -10,6 +10,7 @@ var styled = require('styled-components');
10
10
  var common = require('@bunnyapp/common');
11
11
  var reactQuery = require('@tanstack/react-query');
12
12
  var recoil = require('recoil');
13
+ var theme = require('antd/lib/theme');
13
14
  var reactStripeJs = require('@stripe/react-stripe-js');
14
15
  var pure = require('@stripe/stripe-js/pure');
15
16
  var lodash = require('lodash');
@@ -40,6 +41,7 @@ function _interopNamespace(e) {
40
41
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
41
42
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
42
43
  var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
44
+ var theme__default = /*#__PURE__*/_interopDefaultLegacy(theme);
43
45
  var request__default = /*#__PURE__*/_interopDefaultLegacy(request);
44
46
 
45
47
  /******************************************************************************
@@ -79,8 +81,8 @@ function __awaiter(thisArg, _arguments, P, generator) {
79
81
  }
80
82
 
81
83
  function __generator(thisArg, body) {
82
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
83
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
84
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
85
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
84
86
  function verb(n) { return function (v) { return step([n, v]); }; }
85
87
  function step(op) {
86
88
  if (f) throw new TypeError("Generator is already executing.");
@@ -320,563 +322,535 @@ var classnames = {exports: {}};
320
322
 
321
323
  var classNames = classnames.exports;
322
324
 
325
+ const round = Math.round;
326
+
323
327
  /**
324
- * Take input from [0, n] and return it as [0, 1]
325
- * @hidden
326
- */
327
- function bound01(n, max) {
328
- if (isOnePointZero(n)) {
329
- n = '100%';
330
- }
331
- var isPercent = isPercentage(n);
332
- n = max === 360 ? n : Math.min(max, Math.max(0, parseFloat(n)));
333
- // Automatically convert percentage into number
334
- if (isPercent) {
335
- n = parseInt(String(n * max), 10) / 100;
336
- }
337
- // Handle floating point rounding errors
338
- if (Math.abs(n - max) < 0.000001) {
339
- return 1;
340
- }
341
- // Convert into [0, 1] range if it isn't already
342
- if (max === 360) {
343
- // If n is a hue given in degrees,
344
- // wrap around out-of-range values into [0, 360] range
345
- // then convert into [0, 1].
346
- n = (n < 0 ? (n % max) + max : n % max) / parseFloat(String(max));
347
- }
348
- else {
349
- // If n not a hue given in degrees
350
- // Convert into [0, 1] range if it isn't already.
351
- n = (n % max) / parseFloat(String(max));
352
- }
353
- return n;
354
- }
355
- /**
356
- * Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1
357
- * <http://stackoverflow.com/questions/7422072/javascript-how-to-detect-number-as-a-decimal-including-1-0>
358
- * @hidden
359
- */
360
- function isOnePointZero(n) {
361
- return typeof n === 'string' && n.indexOf('.') !== -1 && parseFloat(n) === 1;
362
- }
363
- /**
364
- * Check to see if string passed in is a percentage
365
- * @hidden
366
- */
367
- function isPercentage(n) {
368
- return typeof n === 'string' && n.indexOf('%') !== -1;
369
- }
370
- /**
371
- * Return a valid alpha value [0,1] with all invalid values being set to 1
372
- * @hidden
373
- */
374
- function boundAlpha(a) {
375
- a = parseFloat(a);
376
- if (isNaN(a) || a < 0 || a > 1) {
377
- a = 1;
378
- }
379
- return a;
380
- }
381
- /**
382
- * Replace a decimal with it's percentage value
383
- * @hidden
384
- */
385
- function convertToPercentage(n) {
386
- if (n <= 1) {
387
- return "".concat(Number(n) * 100, "%");
388
- }
389
- return n;
390
- }
391
- /**
392
- * Force a hex value to have 2 characters
393
- * @hidden
328
+ * Support format, alpha unit will check the % mark:
329
+ * - rgba(102, 204, 255, .5) -> [102, 204, 255, 0.5]
330
+ * - rgb(102 204 255 / .5) -> [102, 204, 255, 0.5]
331
+ * - rgb(100%, 50%, 0% / 50%) -> [255, 128, 0, 0.5]
332
+ * - hsl(270, 60, 40, .5) -> [270, 60, 40, 0.5]
333
+ * - hsl(270deg 60% 40% / 50%) -> [270, 60, 40, 0.5]
334
+ *
335
+ * When `base` is provided, the percentage value will be divided by `base`.
394
336
  */
395
- function pad2(c) {
396
- return c.length === 1 ? '0' + c : String(c);
337
+ function splitColorStr(str, parseNum) {
338
+ const match = str
339
+ // Remove str before `(`
340
+ .replace(/^[^(]*\((.*)/, '$1')
341
+ // Remove str after `)`
342
+ .replace(/\).*/, '').match(/\d*\.?\d+%?/g) || [];
343
+ const numList = match.map(item => parseFloat(item));
344
+ for (let i = 0; i < 3; i += 1) {
345
+ numList[i] = parseNum(numList[i] || 0, match[i] || '', i);
346
+ }
347
+
348
+ // For alpha. 50% should be 0.5
349
+ if (match[3]) {
350
+ numList[3] = match[3].includes('%') ? numList[3] / 100 : numList[3];
351
+ } else {
352
+ // By default, alpha is 1
353
+ numList[3] = 1;
354
+ }
355
+ return numList;
397
356
  }
357
+ const parseHSVorHSL = (num, _, index) => index === 0 ? num : num / 100;
398
358
 
399
- // `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from:
400
- // <http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript>
401
- /**
402
- * Handle bounds / percentage checking to conform to CSS color spec
403
- * <http://www.w3.org/TR/css3-color/>
404
- * *Assumes:* r, g, b in [0, 255] or [0, 1]
405
- * *Returns:* { r, g, b } in [0, 255]
406
- */
407
- function rgbToRgb(r, g, b) {
408
- return {
409
- r: bound01(r, 255) * 255,
410
- g: bound01(g, 255) * 255,
411
- b: bound01(b, 255) * 255,
412
- };
359
+ /** round and limit number to integer between 0-255 */
360
+ function limitRange(value, max) {
361
+ const mergedMax = max || 255;
362
+ if (value > mergedMax) {
363
+ return mergedMax;
364
+ }
365
+ if (value < 0) {
366
+ return 0;
367
+ }
368
+ return value;
413
369
  }
414
- function hue2rgb(p, q, t) {
415
- if (t < 0) {
416
- t += 1;
370
+ class FastColor {
371
+ constructor(input) {
372
+ /**
373
+ * All FastColor objects are valid. So isValid is always true. This property is kept to be compatible with TinyColor.
374
+ */
375
+ _defineProperty(this, "isValid", true);
376
+ /**
377
+ * Red, R in RGB
378
+ */
379
+ _defineProperty(this, "r", 0);
380
+ /**
381
+ * Green, G in RGB
382
+ */
383
+ _defineProperty(this, "g", 0);
384
+ /**
385
+ * Blue, B in RGB
386
+ */
387
+ _defineProperty(this, "b", 0);
388
+ /**
389
+ * Alpha/Opacity, A in RGBA/HSLA
390
+ */
391
+ _defineProperty(this, "a", 1);
392
+ // HSV privates
393
+ _defineProperty(this, "_h", void 0);
394
+ _defineProperty(this, "_s", void 0);
395
+ _defineProperty(this, "_l", void 0);
396
+ _defineProperty(this, "_v", void 0);
397
+ // intermediate variables to calculate HSL/HSV
398
+ _defineProperty(this, "_max", void 0);
399
+ _defineProperty(this, "_min", void 0);
400
+ _defineProperty(this, "_brightness", void 0);
401
+ /**
402
+ * Always check 3 char in the object to determine the format.
403
+ * We not use function in check to save bundle size.
404
+ * e.g. 'rgb' -> { r: 0, g: 0, b: 0 }.
405
+ */
406
+ function matchFormat(str) {
407
+ return str[0] in input && str[1] in input && str[2] in input;
417
408
  }
418
- if (t > 1) {
419
- t -= 1;
409
+ if (!input) ; else if (typeof input === 'string') {
410
+ const trimStr = input.trim();
411
+ function matchPrefix(prefix) {
412
+ return trimStr.startsWith(prefix);
413
+ }
414
+ if (/^#?[A-F\d]{3,8}$/i.test(trimStr)) {
415
+ this.fromHexString(trimStr);
416
+ } else if (matchPrefix('rgb')) {
417
+ this.fromRgbString(trimStr);
418
+ } else if (matchPrefix('hsl')) {
419
+ this.fromHslString(trimStr);
420
+ } else if (matchPrefix('hsv') || matchPrefix('hsb')) {
421
+ this.fromHsvString(trimStr);
422
+ }
423
+ } else if (input instanceof FastColor) {
424
+ this.r = input.r;
425
+ this.g = input.g;
426
+ this.b = input.b;
427
+ this.a = input.a;
428
+ this._h = input._h;
429
+ this._s = input._s;
430
+ this._l = input._l;
431
+ this._v = input._v;
432
+ } else if (matchFormat('rgb')) {
433
+ this.r = limitRange(input.r);
434
+ this.g = limitRange(input.g);
435
+ this.b = limitRange(input.b);
436
+ this.a = typeof input.a === 'number' ? limitRange(input.a, 1) : 1;
437
+ } else if (matchFormat('hsl')) {
438
+ this.fromHsl(input);
439
+ } else if (matchFormat('hsv')) {
440
+ this.fromHsv(input);
441
+ } else {
442
+ throw new Error('@ant-design/fast-color: unsupported input ' + JSON.stringify(input));
420
443
  }
421
- if (t < 1 / 6) {
422
- return p + (q - p) * (6 * t);
444
+ }
445
+
446
+ // ======================= Setter =======================
447
+
448
+ setR(value) {
449
+ return this._sc('r', value);
450
+ }
451
+ setG(value) {
452
+ return this._sc('g', value);
453
+ }
454
+ setB(value) {
455
+ return this._sc('b', value);
456
+ }
457
+ setA(value) {
458
+ return this._sc('a', value, 1);
459
+ }
460
+ setHue(value) {
461
+ const hsv = this.toHsv();
462
+ hsv.h = value;
463
+ return this._c(hsv);
464
+ }
465
+
466
+ // ======================= Getter =======================
467
+ /**
468
+ * Returns the perceived luminance of a color, from 0-1.
469
+ * @see http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
470
+ */
471
+ getLuminance() {
472
+ function adjustGamma(raw) {
473
+ const val = raw / 255;
474
+ return val <= 0.03928 ? val / 12.92 : Math.pow((val + 0.055) / 1.055, 2.4);
423
475
  }
424
- if (t < 1 / 2) {
425
- return q;
476
+ const R = adjustGamma(this.r);
477
+ const G = adjustGamma(this.g);
478
+ const B = adjustGamma(this.b);
479
+ return 0.2126 * R + 0.7152 * G + 0.0722 * B;
480
+ }
481
+ getHue() {
482
+ if (typeof this._h === 'undefined') {
483
+ const delta = this.getMax() - this.getMin();
484
+ if (delta === 0) {
485
+ this._h = 0;
486
+ } else {
487
+ this._h = round(60 * (this.r === this.getMax() ? (this.g - this.b) / delta + (this.g < this.b ? 6 : 0) : this.g === this.getMax() ? (this.b - this.r) / delta + 2 : (this.r - this.g) / delta + 4));
488
+ }
426
489
  }
427
- if (t < 2 / 3) {
428
- return p + (q - p) * (2 / 3 - t) * 6;
490
+ return this._h;
491
+ }
492
+ getSaturation() {
493
+ if (typeof this._s === 'undefined') {
494
+ const delta = this.getMax() - this.getMin();
495
+ if (delta === 0) {
496
+ this._s = 0;
497
+ } else {
498
+ this._s = delta / this.getMax();
499
+ }
429
500
  }
430
- return p;
431
- }
432
- /**
433
- * Converts an HSL color value to RGB.
434
- *
435
- * *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100]
436
- * *Returns:* { r, g, b } in the set [0, 255]
437
- */
438
- function hslToRgb(h, s, l) {
439
- var r;
440
- var g;
441
- var b;
442
- h = bound01(h, 360);
443
- s = bound01(s, 100);
444
- l = bound01(l, 100);
445
- if (s === 0) {
446
- // achromatic
447
- g = l;
448
- b = l;
449
- r = l;
501
+ return this._s;
502
+ }
503
+ getLightness() {
504
+ if (typeof this._l === 'undefined') {
505
+ this._l = (this.getMax() + this.getMin()) / 510;
450
506
  }
451
- else {
452
- var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
453
- var p = 2 * l - q;
454
- r = hue2rgb(p, q, h + 1 / 3);
455
- g = hue2rgb(p, q, h);
456
- b = hue2rgb(p, q, h - 1 / 3);
507
+ return this._l;
508
+ }
509
+ getValue() {
510
+ if (typeof this._v === 'undefined') {
511
+ this._v = this.getMax() / 255;
457
512
  }
458
- return { r: r * 255, g: g * 255, b: b * 255 };
459
- }
460
- /**
461
- * Converts an RGB color value to HSV
462
- *
463
- * *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]
464
- * *Returns:* { h, s, v } in [0,1]
465
- */
466
- function rgbToHsv(r, g, b) {
467
- r = bound01(r, 255);
468
- g = bound01(g, 255);
469
- b = bound01(b, 255);
470
- var max = Math.max(r, g, b);
471
- var min = Math.min(r, g, b);
472
- var h = 0;
473
- var v = max;
474
- var d = max - min;
475
- var s = max === 0 ? 0 : d / max;
476
- if (max === min) {
477
- h = 0; // achromatic
513
+ return this._v;
514
+ }
515
+
516
+ /**
517
+ * Returns the perceived brightness of the color, from 0-255.
518
+ * Note: this is not the b of HSB
519
+ * @see http://www.w3.org/TR/AERT#color-contrast
520
+ */
521
+ getBrightness() {
522
+ if (typeof this._brightness === 'undefined') {
523
+ this._brightness = (this.r * 299 + this.g * 587 + this.b * 114) / 1000;
478
524
  }
479
- else {
480
- switch (max) {
481
- case r:
482
- h = (g - b) / d + (g < b ? 6 : 0);
483
- break;
484
- case g:
485
- h = (b - r) / d + 2;
486
- break;
487
- case b:
488
- h = (r - g) / d + 4;
489
- break;
490
- }
491
- h /= 6;
525
+ return this._brightness;
526
+ }
527
+
528
+ // ======================== Func ========================
529
+
530
+ darken(amount = 10) {
531
+ const h = this.getHue();
532
+ const s = this.getSaturation();
533
+ let l = this.getLightness() - amount / 100;
534
+ if (l < 0) {
535
+ l = 0;
492
536
  }
493
- return { h: h, s: s, v: v };
494
- }
495
- /**
496
- * Converts an HSV color value to RGB.
497
- *
498
- * *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100]
499
- * *Returns:* { r, g, b } in the set [0, 255]
500
- */
501
- function hsvToRgb(h, s, v) {
502
- h = bound01(h, 360) * 6;
503
- s = bound01(s, 100);
504
- v = bound01(v, 100);
505
- var i = Math.floor(h);
506
- var f = h - i;
507
- var p = v * (1 - s);
508
- var q = v * (1 - f * s);
509
- var t = v * (1 - (1 - f) * s);
510
- var mod = i % 6;
511
- var r = [v, q, p, p, t, v][mod];
512
- var g = [t, v, v, q, p, p][mod];
513
- var b = [p, p, t, v, v, q][mod];
514
- return { r: r * 255, g: g * 255, b: b * 255 };
515
- }
516
- /**
517
- * Converts an RGB color to hex
518
- *
519
- * Assumes r, g, and b are contained in the set [0, 255]
520
- * Returns a 3 or 6 character hex
521
- */
522
- function rgbToHex(r, g, b, allow3Char) {
523
- var hex = [
524
- pad2(Math.round(r).toString(16)),
525
- pad2(Math.round(g).toString(16)),
526
- pad2(Math.round(b).toString(16)),
527
- ];
528
- // Return a 3 character hex if possible
529
- if (allow3Char &&
530
- hex[0].startsWith(hex[0].charAt(1)) &&
531
- hex[1].startsWith(hex[1].charAt(1)) &&
532
- hex[2].startsWith(hex[2].charAt(1))) {
533
- return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
537
+ return this._c({
538
+ h,
539
+ s,
540
+ l,
541
+ a: this.a
542
+ });
543
+ }
544
+ lighten(amount = 10) {
545
+ const h = this.getHue();
546
+ const s = this.getSaturation();
547
+ let l = this.getLightness() + amount / 100;
548
+ if (l > 1) {
549
+ l = 1;
534
550
  }
535
- return hex.join('');
536
- }
537
- /** Converts a hex value to a decimal */
538
- function convertHexToDecimal(h) {
539
- return parseIntFromHex(h) / 255;
540
- }
541
- /** Parse a base-16 hex value into a base-10 integer */
542
- function parseIntFromHex(val) {
543
- return parseInt(val, 16);
544
- }
551
+ return this._c({
552
+ h,
553
+ s,
554
+ l,
555
+ a: this.a
556
+ });
557
+ }
545
558
 
546
- // https://github.com/bahamas10/css-color-names/blob/master/css-color-names.json
547
- /**
548
- * @hidden
549
- */
550
- var names = {
551
- aliceblue: '#f0f8ff',
552
- antiquewhite: '#faebd7',
553
- aqua: '#00ffff',
554
- aquamarine: '#7fffd4',
555
- azure: '#f0ffff',
556
- beige: '#f5f5dc',
557
- bisque: '#ffe4c4',
558
- black: '#000000',
559
- blanchedalmond: '#ffebcd',
560
- blue: '#0000ff',
561
- blueviolet: '#8a2be2',
562
- brown: '#a52a2a',
563
- burlywood: '#deb887',
564
- cadetblue: '#5f9ea0',
565
- chartreuse: '#7fff00',
566
- chocolate: '#d2691e',
567
- coral: '#ff7f50',
568
- cornflowerblue: '#6495ed',
569
- cornsilk: '#fff8dc',
570
- crimson: '#dc143c',
571
- cyan: '#00ffff',
572
- darkblue: '#00008b',
573
- darkcyan: '#008b8b',
574
- darkgoldenrod: '#b8860b',
575
- darkgray: '#a9a9a9',
576
- darkgreen: '#006400',
577
- darkgrey: '#a9a9a9',
578
- darkkhaki: '#bdb76b',
579
- darkmagenta: '#8b008b',
580
- darkolivegreen: '#556b2f',
581
- darkorange: '#ff8c00',
582
- darkorchid: '#9932cc',
583
- darkred: '#8b0000',
584
- darksalmon: '#e9967a',
585
- darkseagreen: '#8fbc8f',
586
- darkslateblue: '#483d8b',
587
- darkslategray: '#2f4f4f',
588
- darkslategrey: '#2f4f4f',
589
- darkturquoise: '#00ced1',
590
- darkviolet: '#9400d3',
591
- deeppink: '#ff1493',
592
- deepskyblue: '#00bfff',
593
- dimgray: '#696969',
594
- dimgrey: '#696969',
595
- dodgerblue: '#1e90ff',
596
- firebrick: '#b22222',
597
- floralwhite: '#fffaf0',
598
- forestgreen: '#228b22',
599
- fuchsia: '#ff00ff',
600
- gainsboro: '#dcdcdc',
601
- ghostwhite: '#f8f8ff',
602
- goldenrod: '#daa520',
603
- gold: '#ffd700',
604
- gray: '#808080',
605
- green: '#008000',
606
- greenyellow: '#adff2f',
607
- grey: '#808080',
608
- honeydew: '#f0fff0',
609
- hotpink: '#ff69b4',
610
- indianred: '#cd5c5c',
611
- indigo: '#4b0082',
612
- ivory: '#fffff0',
613
- khaki: '#f0e68c',
614
- lavenderblush: '#fff0f5',
615
- lavender: '#e6e6fa',
616
- lawngreen: '#7cfc00',
617
- lemonchiffon: '#fffacd',
618
- lightblue: '#add8e6',
619
- lightcoral: '#f08080',
620
- lightcyan: '#e0ffff',
621
- lightgoldenrodyellow: '#fafad2',
622
- lightgray: '#d3d3d3',
623
- lightgreen: '#90ee90',
624
- lightgrey: '#d3d3d3',
625
- lightpink: '#ffb6c1',
626
- lightsalmon: '#ffa07a',
627
- lightseagreen: '#20b2aa',
628
- lightskyblue: '#87cefa',
629
- lightslategray: '#778899',
630
- lightslategrey: '#778899',
631
- lightsteelblue: '#b0c4de',
632
- lightyellow: '#ffffe0',
633
- lime: '#00ff00',
634
- limegreen: '#32cd32',
635
- linen: '#faf0e6',
636
- magenta: '#ff00ff',
637
- maroon: '#800000',
638
- mediumaquamarine: '#66cdaa',
639
- mediumblue: '#0000cd',
640
- mediumorchid: '#ba55d3',
641
- mediumpurple: '#9370db',
642
- mediumseagreen: '#3cb371',
643
- mediumslateblue: '#7b68ee',
644
- mediumspringgreen: '#00fa9a',
645
- mediumturquoise: '#48d1cc',
646
- mediumvioletred: '#c71585',
647
- midnightblue: '#191970',
648
- mintcream: '#f5fffa',
649
- mistyrose: '#ffe4e1',
650
- moccasin: '#ffe4b5',
651
- navajowhite: '#ffdead',
652
- navy: '#000080',
653
- oldlace: '#fdf5e6',
654
- olive: '#808000',
655
- olivedrab: '#6b8e23',
656
- orange: '#ffa500',
657
- orangered: '#ff4500',
658
- orchid: '#da70d6',
659
- palegoldenrod: '#eee8aa',
660
- palegreen: '#98fb98',
661
- paleturquoise: '#afeeee',
662
- palevioletred: '#db7093',
663
- papayawhip: '#ffefd5',
664
- peachpuff: '#ffdab9',
665
- peru: '#cd853f',
666
- pink: '#ffc0cb',
667
- plum: '#dda0dd',
668
- powderblue: '#b0e0e6',
669
- purple: '#800080',
670
- rebeccapurple: '#663399',
671
- red: '#ff0000',
672
- rosybrown: '#bc8f8f',
673
- royalblue: '#4169e1',
674
- saddlebrown: '#8b4513',
675
- salmon: '#fa8072',
676
- sandybrown: '#f4a460',
677
- seagreen: '#2e8b57',
678
- seashell: '#fff5ee',
679
- sienna: '#a0522d',
680
- silver: '#c0c0c0',
681
- skyblue: '#87ceeb',
682
- slateblue: '#6a5acd',
683
- slategray: '#708090',
684
- slategrey: '#708090',
685
- snow: '#fffafa',
686
- springgreen: '#00ff7f',
687
- steelblue: '#4682b4',
688
- tan: '#d2b48c',
689
- teal: '#008080',
690
- thistle: '#d8bfd8',
691
- tomato: '#ff6347',
692
- turquoise: '#40e0d0',
693
- violet: '#ee82ee',
694
- wheat: '#f5deb3',
695
- white: '#ffffff',
696
- whitesmoke: '#f5f5f5',
697
- yellow: '#ffff00',
698
- yellowgreen: '#9acd32',
699
- };
700
-
701
- /* eslint-disable @typescript-eslint/no-redundant-type-constituents */
702
- /**
703
- * Given a string or object, convert that input to RGB
704
- *
705
- * Possible string inputs:
706
- * ```
707
- * "red"
708
- * "#f00" or "f00"
709
- * "#ff0000" or "ff0000"
710
- * "#ff000000" or "ff000000"
711
- * "rgb 255 0 0" or "rgb (255, 0, 0)"
712
- * "rgb 1.0 0 0" or "rgb (1, 0, 0)"
713
- * "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1"
714
- * "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1"
715
- * "hsl(0, 100%, 50%)" or "hsl 0 100% 50%"
716
- * "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1"
717
- * "hsv(0, 100%, 100%)" or "hsv 0 100% 100%"
718
- * ```
719
- */
720
- function inputToRGB(color) {
721
- var rgb = { r: 0, g: 0, b: 0 };
722
- var a = 1;
723
- var s = null;
724
- var v = null;
725
- var l = null;
726
- var ok = false;
727
- var format = false;
728
- if (typeof color === 'string') {
729
- color = stringInputToObject(color);
730
- }
731
- if (typeof color === 'object') {
732
- if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
733
- rgb = rgbToRgb(color.r, color.g, color.b);
734
- ok = true;
735
- format = String(color.r).substr(-1) === '%' ? 'prgb' : 'rgb';
736
- }
737
- else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
738
- s = convertToPercentage(color.s);
739
- v = convertToPercentage(color.v);
740
- rgb = hsvToRgb(color.h, s, v);
741
- ok = true;
742
- format = 'hsv';
743
- }
744
- else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
745
- s = convertToPercentage(color.s);
746
- l = convertToPercentage(color.l);
747
- rgb = hslToRgb(color.h, s, l);
748
- ok = true;
749
- format = 'hsl';
750
- }
751
- if (Object.prototype.hasOwnProperty.call(color, 'a')) {
752
- a = color.a;
753
- }
559
+ /**
560
+ * Mix the current color a given amount with another color, from 0 to 100.
561
+ * 0 means no mixing (return current color).
562
+ */
563
+ mix(input, amount = 50) {
564
+ const color = this._c(input);
565
+ const p = amount / 100;
566
+ const calc = key => (color[key] - this[key]) * p + this[key];
567
+ const rgba = {
568
+ r: round(calc('r')),
569
+ g: round(calc('g')),
570
+ b: round(calc('b')),
571
+ a: round(calc('a') * 100) / 100
572
+ };
573
+ return this._c(rgba);
574
+ }
575
+
576
+ /**
577
+ * Mix the color with pure white, from 0 to 100.
578
+ * Providing 0 will do nothing, providing 100 will always return white.
579
+ */
580
+ tint(amount = 10) {
581
+ return this.mix({
582
+ r: 255,
583
+ g: 255,
584
+ b: 255,
585
+ a: 1
586
+ }, amount);
587
+ }
588
+
589
+ /**
590
+ * Mix the color with pure black, from 0 to 100.
591
+ * Providing 0 will do nothing, providing 100 will always return black.
592
+ */
593
+ shade(amount = 10) {
594
+ return this.mix({
595
+ r: 0,
596
+ g: 0,
597
+ b: 0,
598
+ a: 1
599
+ }, amount);
600
+ }
601
+ onBackground(background) {
602
+ const bg = this._c(background);
603
+ const alpha = this.a + bg.a * (1 - this.a);
604
+ const calc = key => {
605
+ return round((this[key] * this.a + bg[key] * bg.a * (1 - this.a)) / alpha);
606
+ };
607
+ return this._c({
608
+ r: calc('r'),
609
+ g: calc('g'),
610
+ b: calc('b'),
611
+ a: alpha
612
+ });
613
+ }
614
+
615
+ // ======================= Status =======================
616
+ isDark() {
617
+ return this.getBrightness() < 128;
618
+ }
619
+ isLight() {
620
+ return this.getBrightness() >= 128;
621
+ }
622
+
623
+ // ======================== MISC ========================
624
+ equals(other) {
625
+ return this.r === other.r && this.g === other.g && this.b === other.b && this.a === other.a;
626
+ }
627
+ clone() {
628
+ return this._c(this);
629
+ }
630
+
631
+ // ======================= Format =======================
632
+ toHexString() {
633
+ let hex = '#';
634
+ const rHex = (this.r || 0).toString(16);
635
+ hex += rHex.length === 2 ? rHex : '0' + rHex;
636
+ const gHex = (this.g || 0).toString(16);
637
+ hex += gHex.length === 2 ? gHex : '0' + gHex;
638
+ const bHex = (this.b || 0).toString(16);
639
+ hex += bHex.length === 2 ? bHex : '0' + bHex;
640
+ if (typeof this.a === 'number' && this.a >= 0 && this.a < 1) {
641
+ const aHex = round(this.a * 255).toString(16);
642
+ hex += aHex.length === 2 ? aHex : '0' + aHex;
754
643
  }
755
- a = boundAlpha(a);
644
+ return hex;
645
+ }
646
+
647
+ /** CSS support color pattern */
648
+ toHsl() {
756
649
  return {
757
- ok: ok,
758
- format: color.format || format,
759
- r: Math.min(255, Math.max(rgb.r, 0)),
760
- g: Math.min(255, Math.max(rgb.g, 0)),
761
- b: Math.min(255, Math.max(rgb.b, 0)),
762
- a: a,
650
+ h: this.getHue(),
651
+ s: this.getSaturation(),
652
+ l: this.getLightness(),
653
+ a: this.a
763
654
  };
764
- }
765
- // <http://www.w3.org/TR/css3-values/#integers>
766
- var CSS_INTEGER = '[-\\+]?\\d+%?';
767
- // <http://www.w3.org/TR/css3-values/#number-value>
768
- var CSS_NUMBER = '[-\\+]?\\d*\\.\\d+%?';
769
- // Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome.
770
- var CSS_UNIT = "(?:".concat(CSS_NUMBER, ")|(?:").concat(CSS_INTEGER, ")");
771
- // Actual matching.
772
- // Parentheses and commas are optional, but not required.
773
- // Whitespace can take the place of commas or opening paren
774
- var PERMISSIVE_MATCH3 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
775
- var PERMISSIVE_MATCH4 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
776
- var matchers = {
777
- CSS_UNIT: new RegExp(CSS_UNIT),
778
- rgb: new RegExp('rgb' + PERMISSIVE_MATCH3),
779
- rgba: new RegExp('rgba' + PERMISSIVE_MATCH4),
780
- hsl: new RegExp('hsl' + PERMISSIVE_MATCH3),
781
- hsla: new RegExp('hsla' + PERMISSIVE_MATCH4),
782
- hsv: new RegExp('hsv' + PERMISSIVE_MATCH3),
783
- hsva: new RegExp('hsva' + PERMISSIVE_MATCH4),
784
- hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
785
- hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
786
- hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
787
- hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
788
- };
789
- /**
790
- * Permissive string parsing. Take in a number of formats, and output an object
791
- * based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}`
792
- */
793
- function stringInputToObject(color) {
794
- color = color.trim().toLowerCase();
795
- if (color.length === 0) {
796
- return false;
797
- }
798
- var named = false;
799
- if (names[color]) {
800
- color = names[color];
801
- named = true;
802
- }
803
- else if (color === 'transparent') {
804
- return { r: 0, g: 0, b: 0, a: 0, format: 'name' };
805
- }
806
- // Try to match string input using regular expressions.
807
- // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360]
808
- // Just return an object and let the conversion functions handle that.
809
- // This way the result will be the same whether the tinycolor is initialized with string or object.
810
- var match = matchers.rgb.exec(color);
811
- if (match) {
812
- return { r: match[1], g: match[2], b: match[3] };
813
- }
814
- match = matchers.rgba.exec(color);
815
- if (match) {
816
- return { r: match[1], g: match[2], b: match[3], a: match[4] };
817
- }
818
- match = matchers.hsl.exec(color);
819
- if (match) {
820
- return { h: match[1], s: match[2], l: match[3] };
655
+ }
656
+
657
+ /** CSS support color pattern */
658
+ toHslString() {
659
+ const h = this.getHue();
660
+ const s = round(this.getSaturation() * 100);
661
+ const l = round(this.getLightness() * 100);
662
+ return this.a !== 1 ? `hsla(${h},${s}%,${l}%,${this.a})` : `hsl(${h},${s}%,${l}%)`;
663
+ }
664
+
665
+ /** Same as toHsb */
666
+ toHsv() {
667
+ return {
668
+ h: this.getHue(),
669
+ s: this.getSaturation(),
670
+ v: this.getValue(),
671
+ a: this.a
672
+ };
673
+ }
674
+ toRgb() {
675
+ return {
676
+ r: this.r,
677
+ g: this.g,
678
+ b: this.b,
679
+ a: this.a
680
+ };
681
+ }
682
+ toRgbString() {
683
+ return this.a !== 1 ? `rgba(${this.r},${this.g},${this.b},${this.a})` : `rgb(${this.r},${this.g},${this.b})`;
684
+ }
685
+ toString() {
686
+ return this.toRgbString();
687
+ }
688
+
689
+ // ====================== Privates ======================
690
+ /** Return a new FastColor object with one channel changed */
691
+ _sc(rgb, value, max) {
692
+ const clone = this.clone();
693
+ clone[rgb] = limitRange(value, max);
694
+ return clone;
695
+ }
696
+ _c(input) {
697
+ return new this.constructor(input);
698
+ }
699
+ getMax() {
700
+ if (typeof this._max === 'undefined') {
701
+ this._max = Math.max(this.r, this.g, this.b);
821
702
  }
822
- match = matchers.hsla.exec(color);
823
- if (match) {
824
- return { h: match[1], s: match[2], l: match[3], a: match[4] };
703
+ return this._max;
704
+ }
705
+ getMin() {
706
+ if (typeof this._min === 'undefined') {
707
+ this._min = Math.min(this.r, this.g, this.b);
825
708
  }
826
- match = matchers.hsv.exec(color);
827
- if (match) {
828
- return { h: match[1], s: match[2], v: match[3] };
709
+ return this._min;
710
+ }
711
+ fromHexString(trimStr) {
712
+ const withoutPrefix = trimStr.replace('#', '');
713
+ function connectNum(index1, index2) {
714
+ return parseInt(withoutPrefix[index1] + withoutPrefix[index2 || index1], 16);
829
715
  }
830
- match = matchers.hsva.exec(color);
831
- if (match) {
832
- return { h: match[1], s: match[2], v: match[3], a: match[4] };
716
+ if (withoutPrefix.length < 6) {
717
+ // #rgb or #rgba
718
+ this.r = connectNum(0);
719
+ this.g = connectNum(1);
720
+ this.b = connectNum(2);
721
+ this.a = withoutPrefix[3] ? connectNum(3) / 255 : 1;
722
+ } else {
723
+ // #rrggbb or #rrggbbaa
724
+ this.r = connectNum(0, 1);
725
+ this.g = connectNum(2, 3);
726
+ this.b = connectNum(4, 5);
727
+ this.a = withoutPrefix[6] ? connectNum(6, 7) / 255 : 1;
833
728
  }
834
- match = matchers.hex8.exec(color);
835
- if (match) {
836
- return {
837
- r: parseIntFromHex(match[1]),
838
- g: parseIntFromHex(match[2]),
839
- b: parseIntFromHex(match[3]),
840
- a: convertHexToDecimal(match[4]),
841
- format: named ? 'name' : 'hex8',
842
- };
729
+ }
730
+ fromHsl({
731
+ h,
732
+ s,
733
+ l,
734
+ a
735
+ }) {
736
+ this._h = h % 360;
737
+ this._s = s;
738
+ this._l = l;
739
+ this.a = typeof a === 'number' ? a : 1;
740
+ if (s <= 0) {
741
+ const rgb = round(l * 255);
742
+ this.r = rgb;
743
+ this.g = rgb;
744
+ this.b = rgb;
843
745
  }
844
- match = matchers.hex6.exec(color);
845
- if (match) {
846
- return {
847
- r: parseIntFromHex(match[1]),
848
- g: parseIntFromHex(match[2]),
849
- b: parseIntFromHex(match[3]),
850
- format: named ? 'name' : 'hex',
851
- };
746
+ let r = 0,
747
+ g = 0,
748
+ b = 0;
749
+ const huePrime = h / 60;
750
+ const chroma = (1 - Math.abs(2 * l - 1)) * s;
751
+ const secondComponent = chroma * (1 - Math.abs(huePrime % 2 - 1));
752
+ if (huePrime >= 0 && huePrime < 1) {
753
+ r = chroma;
754
+ g = secondComponent;
755
+ } else if (huePrime >= 1 && huePrime < 2) {
756
+ r = secondComponent;
757
+ g = chroma;
758
+ } else if (huePrime >= 2 && huePrime < 3) {
759
+ g = chroma;
760
+ b = secondComponent;
761
+ } else if (huePrime >= 3 && huePrime < 4) {
762
+ g = secondComponent;
763
+ b = chroma;
764
+ } else if (huePrime >= 4 && huePrime < 5) {
765
+ r = secondComponent;
766
+ b = chroma;
767
+ } else if (huePrime >= 5 && huePrime < 6) {
768
+ r = chroma;
769
+ b = secondComponent;
852
770
  }
853
- match = matchers.hex4.exec(color);
854
- if (match) {
855
- return {
856
- r: parseIntFromHex(match[1] + match[1]),
857
- g: parseIntFromHex(match[2] + match[2]),
858
- b: parseIntFromHex(match[3] + match[3]),
859
- a: convertHexToDecimal(match[4] + match[4]),
860
- format: named ? 'name' : 'hex8',
861
- };
771
+ const lightnessModification = l - chroma / 2;
772
+ this.r = round((r + lightnessModification) * 255);
773
+ this.g = round((g + lightnessModification) * 255);
774
+ this.b = round((b + lightnessModification) * 255);
775
+ }
776
+ fromHsv({
777
+ h,
778
+ s,
779
+ v,
780
+ a
781
+ }) {
782
+ this._h = h % 360;
783
+ this._s = s;
784
+ this._v = v;
785
+ this.a = typeof a === 'number' ? a : 1;
786
+ const vv = round(v * 255);
787
+ this.r = vv;
788
+ this.g = vv;
789
+ this.b = vv;
790
+ if (s <= 0) {
791
+ return;
862
792
  }
863
- match = matchers.hex3.exec(color);
864
- if (match) {
865
- return {
866
- r: parseIntFromHex(match[1] + match[1]),
867
- g: parseIntFromHex(match[2] + match[2]),
868
- b: parseIntFromHex(match[3] + match[3]),
869
- format: named ? 'name' : 'hex',
870
- };
793
+ const hh = h / 60;
794
+ const i = Math.floor(hh);
795
+ const ff = hh - i;
796
+ const p = round(v * (1.0 - s) * 255);
797
+ const q = round(v * (1.0 - s * ff) * 255);
798
+ const t = round(v * (1.0 - s * (1.0 - ff)) * 255);
799
+ switch (i) {
800
+ case 0:
801
+ this.g = t;
802
+ this.b = p;
803
+ break;
804
+ case 1:
805
+ this.r = q;
806
+ this.b = p;
807
+ break;
808
+ case 2:
809
+ this.r = p;
810
+ this.b = t;
811
+ break;
812
+ case 3:
813
+ this.r = p;
814
+ this.g = q;
815
+ break;
816
+ case 4:
817
+ this.r = t;
818
+ this.g = p;
819
+ break;
820
+ case 5:
821
+ default:
822
+ this.g = p;
823
+ this.b = q;
824
+ break;
871
825
  }
872
- return false;
873
- }
874
- /**
875
- * Check to see if it looks like a CSS unit
876
- * (see `matchers` above for definition).
877
- */
878
- function isValidCSSUnit(color) {
879
- return Boolean(matchers.CSS_UNIT.exec(String(color)));
826
+ }
827
+ fromHsvString(trimStr) {
828
+ const cells = splitColorStr(trimStr, parseHSVorHSL);
829
+ this.fromHsv({
830
+ h: cells[0],
831
+ s: cells[1],
832
+ v: cells[2],
833
+ a: cells[3]
834
+ });
835
+ }
836
+ fromHslString(trimStr) {
837
+ const cells = splitColorStr(trimStr, parseHSVorHSL);
838
+ this.fromHsl({
839
+ h: cells[0],
840
+ s: cells[1],
841
+ l: cells[2],
842
+ a: cells[3]
843
+ });
844
+ }
845
+ fromRgbString(trimStr) {
846
+ const cells = splitColorStr(trimStr, (num, txt) =>
847
+ // Convert percentage to number. e.g. 50% -> 128
848
+ txt.includes('%') ? round(num / 100 * 255) : num);
849
+ this.r = cells[0];
850
+ this.g = cells[1];
851
+ this.b = cells[2];
852
+ this.a = cells[3];
853
+ }
880
854
  }
881
855
 
882
856
  var hueStep = 2; // 色相阶梯
@@ -886,73 +860,39 @@ var brightnessStep1 = 0.05; // 亮度阶梯,浅色部分
886
860
  var brightnessStep2 = 0.15; // 亮度阶梯,深色部分
887
861
  var lightColorCount = 5; // 浅色数量,主色上
888
862
  var darkColorCount = 4; // 深色数量,主色下
863
+
889
864
  // 暗色主题颜色映射关系表
890
865
  var darkColorMap = [{
891
866
  index: 7,
892
- opacity: 0.15
867
+ amount: 15
893
868
  }, {
894
869
  index: 6,
895
- opacity: 0.25
870
+ amount: 25
896
871
  }, {
897
872
  index: 5,
898
- opacity: 0.3
873
+ amount: 30
899
874
  }, {
900
875
  index: 5,
901
- opacity: 0.45
876
+ amount: 45
902
877
  }, {
903
878
  index: 5,
904
- opacity: 0.65
879
+ amount: 65
905
880
  }, {
906
881
  index: 5,
907
- opacity: 0.85
882
+ amount: 85
908
883
  }, {
909
884
  index: 4,
910
- opacity: 0.9
885
+ amount: 90
911
886
  }, {
912
887
  index: 3,
913
- opacity: 0.95
888
+ amount: 95
914
889
  }, {
915
890
  index: 2,
916
- opacity: 0.97
891
+ amount: 97
917
892
  }, {
918
893
  index: 1,
919
- opacity: 0.98
894
+ amount: 98
920
895
  }];
921
- // Wrapper function ported from TinyColor.prototype.toHsv
922
- // Keep it here because of `hsv.h * 360`
923
- function toHsv(_ref) {
924
- var r = _ref.r,
925
- g = _ref.g,
926
- b = _ref.b;
927
- var hsv = rgbToHsv(r, g, b);
928
- return {
929
- h: hsv.h * 360,
930
- s: hsv.s,
931
- v: hsv.v
932
- };
933
- }
934
-
935
- // Wrapper function ported from TinyColor.prototype.toHexString
936
- // Keep it here because of the prefix `#`
937
- function toHex(_ref2) {
938
- var r = _ref2.r,
939
- g = _ref2.g,
940
- b = _ref2.b;
941
- return "#".concat(rgbToHex(r, g, b, false));
942
- }
943
-
944
- // Wrapper function ported from TinyColor.prototype.mix, not treeshakable.
945
- // Amount in range [0, 1]
946
- // Assume color1 & color2 has no alpha, since the following src code did so.
947
- function mix(rgb1, rgb2, amount) {
948
- var p = amount / 100;
949
- var rgb = {
950
- r: (rgb2.r - rgb1.r) * p + rgb1.r,
951
- g: (rgb2.g - rgb1.g) * p + rgb1.g,
952
- b: (rgb2.b - rgb1.b) * p + rgb1.b
953
- };
954
- return rgb;
955
- }
956
896
  function getHue(hsv, i, light) {
957
897
  var hue;
958
898
  // 根据色相不同,色相转向不同
@@ -992,7 +932,7 @@ function getSaturation(hsv, i, light) {
992
932
  if (saturation < 0.06) {
993
933
  saturation = 0.06;
994
934
  }
995
- return Number(saturation.toFixed(2));
935
+ return Math.round(saturation * 100) / 100;
996
936
  }
997
937
  function getValue(hsv, i, light) {
998
938
  var value;
@@ -1001,45 +941,44 @@ function getValue(hsv, i, light) {
1001
941
  } else {
1002
942
  value = hsv.v - brightnessStep2 * i;
1003
943
  }
1004
- if (value > 1) {
1005
- value = 1;
1006
- }
1007
- return Number(value.toFixed(2));
944
+ // Clamp value between 0 and 1
945
+ value = Math.max(0, Math.min(1, value));
946
+ return Math.round(value * 100) / 100;
1008
947
  }
1009
948
  function generate$1(color) {
1010
949
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1011
950
  var patterns = [];
1012
- var pColor = inputToRGB(color);
951
+ var pColor = new FastColor(color);
952
+ var hsv = pColor.toHsv();
1013
953
  for (var i = lightColorCount; i > 0; i -= 1) {
1014
- var hsv = toHsv(pColor);
1015
- var colorString = toHex(inputToRGB({
954
+ var c = new FastColor({
1016
955
  h: getHue(hsv, i, true),
1017
956
  s: getSaturation(hsv, i, true),
1018
957
  v: getValue(hsv, i, true)
1019
- }));
1020
- patterns.push(colorString);
958
+ });
959
+ patterns.push(c);
1021
960
  }
1022
- patterns.push(toHex(pColor));
961
+ patterns.push(pColor);
1023
962
  for (var _i = 1; _i <= darkColorCount; _i += 1) {
1024
- var _hsv = toHsv(pColor);
1025
- var _colorString = toHex(inputToRGB({
1026
- h: getHue(_hsv, _i),
1027
- s: getSaturation(_hsv, _i),
1028
- v: getValue(_hsv, _i)
1029
- }));
1030
- patterns.push(_colorString);
963
+ var _c = new FastColor({
964
+ h: getHue(hsv, _i),
965
+ s: getSaturation(hsv, _i),
966
+ v: getValue(hsv, _i)
967
+ });
968
+ patterns.push(_c);
1031
969
  }
1032
970
 
1033
971
  // dark theme patterns
1034
972
  if (opts.theme === 'dark') {
1035
- return darkColorMap.map(function (_ref3) {
1036
- var index = _ref3.index,
1037
- opacity = _ref3.opacity;
1038
- var darkColorString = toHex(mix(inputToRGB(opts.backgroundColor || '#141414'), inputToRGB(patterns[index]), opacity * 100));
1039
- return darkColorString;
973
+ return darkColorMap.map(function (_ref) {
974
+ var index = _ref.index,
975
+ amount = _ref.amount;
976
+ return new FastColor(opts.backgroundColor || '#141414').mix(patterns[index], amount).toHexString();
1040
977
  });
1041
978
  }
1042
- return patterns;
979
+ return patterns.map(function (c) {
980
+ return c.toHexString();
981
+ });
1043
982
  }
1044
983
 
1045
984
  // Generated by script. Do NOT modify!
@@ -1526,11 +1465,29 @@ var BankOutlined = function BankOutlined(props, ref) {
1526
1465
  };
1527
1466
 
1528
1467
  /**![bank](data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAiIGhlaWdodD0iNTAiIGZpbGw9IiNjYWNhY2EiIHZpZXdCb3g9IjY0IDY0IDg5NiA4OTYiIGZvY3VzYWJsZT0iZmFsc2UiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTg5NCA0NjJjMzAuOSAwIDQzLjgtMzkuNyAxOC43LTU4TDUzMC44IDEyNi4yYTMxLjgxIDMxLjgxIDAgMDAtMzcuNiAwTDExMS4zIDQwNGMtMjUuMSAxOC4yLTEyLjIgNTggMTguOCA1OEgxOTJ2Mzc0aC03MmMtNC40IDAtOCAzLjYtOCA4djUyYzAgNC40IDMuNiA4IDggOGg3ODRjNC40IDAgOC0zLjYgOC04di01MmMwLTQuNC0zLjYtOC04LThoLTcyVjQ2Mmg2MnpNNTEyIDE5Ni43bDI3MS4xIDE5Ny4ySDI0MC45TDUxMiAxOTYuN3pNMjY0IDQ2MmgxMTd2Mzc0SDI2NFY0NjJ6bTE4OSAwaDExN3YzNzRINDUzVjQ2MnptMzA3IDM3NEg2NDJWNDYyaDExOHYzNzR6IiAvPjwvc3ZnPg==) */
1529
- var RefIcon$3 = /*#__PURE__*/React__namespace.forwardRef(BankOutlined);
1468
+ var RefIcon$4 = /*#__PURE__*/React__namespace.forwardRef(BankOutlined);
1469
+ if (process.env.NODE_ENV !== 'production') {
1470
+ RefIcon$4.displayName = 'BankOutlined';
1471
+ }
1472
+ var BankOutlined$1 = RefIcon$4;
1473
+
1474
+ // This icon file is generated automatically.
1475
+ var CheckCircleFilled$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 01-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z" } }] }, "name": "check-circle", "theme": "filled" };
1476
+ var CheckCircleFilledSvg = CheckCircleFilled$2;
1477
+
1478
+ var CheckCircleFilled = function CheckCircleFilled(props, ref) {
1479
+ return /*#__PURE__*/React__namespace.createElement(AntdIcon, _extends({}, props, {
1480
+ ref: ref,
1481
+ icon: CheckCircleFilledSvg
1482
+ }));
1483
+ };
1484
+
1485
+ /**![check-circle](data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAiIGhlaWdodD0iNTAiIGZpbGw9IiNjYWNhY2EiIHZpZXdCb3g9IjY0IDY0IDg5NiA4OTYiIGZvY3VzYWJsZT0iZmFsc2UiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTUxMiA2NEMyNjQuNiA2NCA2NCAyNjQuNiA2NCA1MTJzMjAwLjYgNDQ4IDQ0OCA0NDggNDQ4LTIwMC42IDQ0OC00NDhTNzU5LjQgNjQgNTEyIDY0em0xOTMuNSAzMDEuN2wtMjEwLjYgMjkyYTMxLjggMzEuOCAwIDAxLTUxLjcgMEwzMTguNSA0ODQuOWMtMy44LTUuMyAwLTEyLjcgNi41LTEyLjdoNDYuOWMxMC4yIDAgMTkuOSA0LjkgMjUuOSAxMy4zbDcxLjIgOTguOCAxNTcuMi0yMThjNi04LjMgMTUuNi0xMy4zIDI1LjktMTMuM0g2OTljNi41IDAgMTAuMyA3LjQgNi41IDEyLjd6IiAvPjwvc3ZnPg==) */
1486
+ var RefIcon$3 = /*#__PURE__*/React__namespace.forwardRef(CheckCircleFilled);
1530
1487
  if (process.env.NODE_ENV !== 'production') {
1531
- RefIcon$3.displayName = 'BankOutlined';
1488
+ RefIcon$3.displayName = 'CheckCircleFilled';
1532
1489
  }
1533
- var BankOutlined$1 = RefIcon$3;
1490
+ var CheckCircleFilled$1 = RefIcon$3;
1534
1491
 
1535
1492
  // This icon file is generated automatically.
1536
1493
  var CloseOutlined$2 = { "icon": { "tag": "svg", "attrs": { "fill-rule": "evenodd", "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M799.86 166.31c.02 0 .04.02.08.06l57.69 57.7c.04.03.05.05.06.08a.12.12 0 010 .06c0 .03-.02.05-.06.09L569.93 512l287.7 287.7c.04.04.05.06.06.09a.12.12 0 010 .07c0 .02-.02.04-.06.08l-57.7 57.69c-.03.04-.05.05-.07.06a.12.12 0 01-.07 0c-.03 0-.05-.02-.09-.06L512 569.93l-287.7 287.7c-.04.04-.06.05-.09.06a.12.12 0 01-.07 0c-.02 0-.04-.02-.08-.06l-57.69-57.7c-.04-.03-.05-.05-.06-.07a.12.12 0 010-.07c0-.03.02-.05.06-.09L454.07 512l-287.7-287.7c-.04-.04-.05-.06-.06-.09a.12.12 0 010-.07c0-.02.02-.04.06-.08l57.7-57.69c.03-.04.05-.05.07-.06a.12.12 0 01.07 0c.03 0 .05.02.09.06L512 454.07l287.7-287.7c.04-.04.06-.05.09-.06a.12.12 0 01.07 0z" } }] }, "name": "close", "theme": "outlined" };
@@ -1593,14 +1550,14 @@ var BrandContext = React.createContext({
1593
1550
  topNavImageUrl: common.DEFAULT_TOP_NAV_IMAGE_URL,
1594
1551
  });
1595
1552
 
1596
- var MUTATION$4 = "{\n entityBranding {\n accentColor\n brandColor\n topNavImageUrl\n }\n }";
1553
+ var MUTATION$8 = "{\n entityBranding {\n accentColor\n brandColor\n topNavImageUrl\n }\n }";
1597
1554
  var getBranding = function (_a) {
1598
1555
  var token = _a.token, subdomain = _a.subdomain;
1599
1556
  return __awaiter(void 0, void 0, void 0, function () {
1600
1557
  var response;
1601
1558
  return __generator(this, function (_b) {
1602
1559
  switch (_b.label) {
1603
- case 0: return [4 /*yield*/, common.gqlRequest({ query: MUTATION$4, token: token, subdomain: subdomain })];
1560
+ case 0: return [4 /*yield*/, common.gqlRequest({ query: MUTATION$8, token: token, subdomain: subdomain })];
1604
1561
  case 1:
1605
1562
  response = _b.sent();
1606
1563
  return [2 /*return*/, response === null || response === void 0 ? void 0 : response.entityBranding];
@@ -1678,10 +1635,10 @@ var BunnyContext = React.createContext({});
1678
1635
  var queryClient$1 = new reactQuery.QueryClient();
1679
1636
  // Every component shares similar props and functionality, which this wrapper handles.
1680
1637
  function BunnyProvider(_a) {
1681
- var children = _a.children, token = _a.token, subdomain = _a.subdomain, window = _a.window, accountId = _a.accountId;
1638
+ 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;
1682
1639
  var graphQLClient = common.createGraphQLClient(subdomain || "", window, token);
1683
1640
  var isMobile = useIsMobile(window);
1684
- var _b = React.useState(undefined), branding = _b[0], setBranding = _b[1];
1641
+ var _c = React.useState(undefined), branding = _c[0], setBranding = _c[1];
1685
1642
  // ====== START - Copied straight from PageContainer.tsx ========
1686
1643
  var entityBranding = React.useMemo(function () {
1687
1644
  var _a;
@@ -1711,16 +1668,36 @@ function BunnyProvider(_a) {
1711
1668
  document.getElementsByTagName("head")[0].removeChild(script);
1712
1669
  };
1713
1670
  }, []);
1714
- return (jsxRuntime.jsx(BunnyContext.Provider, __assign({ value: { subdomain: subdomain, graphQLClient: graphQLClient, window: window, token: token, accountId: accountId } }, { children: 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: {
1671
+ return (jsxRuntime.jsx(BunnyContext.Provider, __assign({ value: {
1672
+ subdomain: subdomain,
1673
+ graphQLClient: graphQLClient,
1674
+ window: window,
1675
+ token: token,
1676
+ accountId: accountId,
1677
+ darkMode: darkMode,
1678
+ } }, { children: 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: {
1679
+ algorithm: darkMode
1680
+ ? theme__default["default"].darkAlgorithm
1681
+ : theme__default["default"].defaultAlgorithm,
1715
1682
  token: {
1716
1683
  borderRadius: 4,
1717
1684
  colorPrimary: entityBranding.brandColor,
1718
1685
  colorLink: entityBranding.brandColor,
1719
1686
  colorLinkActive: entityBranding.brandColor,
1720
1687
  colorLinkHover: entityBranding.brandColor,
1721
- fontFamily: common.MARK_PRO,
1688
+ fontFamily: "Inter",
1722
1689
  colorBorder: common.INPUT_BORDER_COLOR,
1723
1690
  },
1691
+ components: {
1692
+ Drawer: {
1693
+ colorBgElevated: darkMode
1694
+ ? "var(--row-background-dark)"
1695
+ : common.SLATE_50,
1696
+ },
1697
+ Divider: {
1698
+ colorSplit: darkMode ? common.SLATE_400 : common.SLATE_200,
1699
+ },
1700
+ },
1724
1701
  } }, { children: jsxRuntime.jsx(SecondaryWrapper, __assign({ setBranding: setBranding }, { children: children })) })) })) }) })) })));
1725
1702
  }
1726
1703
  function SecondaryWrapper(_a) {
@@ -1730,10 +1707,10 @@ function SecondaryWrapper(_a) {
1730
1707
  queryKey: common.QueryKeyFactory.default.brandingKey,
1731
1708
  queryFn: function () { return getBranding({ token: token, subdomain: subdomain }); },
1732
1709
  }).data;
1733
- reactQuery.useQuery({
1710
+ var _c = reactQuery.useQuery({
1734
1711
  queryKey: common.QueryKeyFactory.default.currentUserKey,
1735
- queryFn: function () { return getCurrentUserData({ token: token, subdomain: subdomain }); },
1736
- });
1712
+ queryFn: function () { return getCurrentUserData({ token: token }); },
1713
+ }); _c.data; _c.isLoading;
1737
1714
  React.useEffect(function () {
1738
1715
  if (brandingData) {
1739
1716
  setBranding(brandingData);
@@ -1748,11 +1725,11 @@ var InvoiceQuoteView = function (_a) {
1748
1725
  var downloadFile = common.useDownloadFile(formattedInvoice === null || formattedInvoice === void 0 ? void 0 : formattedInvoice.id, onDownloadError);
1749
1726
  var secondaryColor = React.useContext(BrandContext).secondaryColor;
1750
1727
  var _b = React.useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain;
1751
- 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: {
1728
+ 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: {
1752
1729
  color: secondaryColor,
1753
- }, type: "link" }, { children: backButtonName || "Back" }))) }), jsxRuntime.jsx(antd.Button, __assign({ icon: jsxRuntime.jsx(DownloadOutlined$1, {}), onClick: function () {
1730
+ }, type: "link" }, { children: backButtonName || "Back" }))) : null }), jsxRuntime.jsx(antd.Button, __assign({ icon: jsxRuntime.jsx(DownloadOutlined$1, {}), onClick: function () {
1754
1731
  return downloadFile(subdomain + "/api/pdf/invoice/" + formattedInvoice.id, token);
1755
- } }, { children: "Download" }))] }))), 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: {
1732
+ } }, { 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: {
1756
1733
  minWidth: "750px",
1757
1734
  } }, { children: [jsxRuntime.jsx(interweave.Markup, { content: html }), children] })))] })));
1758
1735
  };
@@ -1785,7 +1762,7 @@ function styleInject(css, ref) {
1785
1762
  }
1786
1763
  }
1787
1764
 
1788
- 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,\n.ant-picker,\n.ant-select,\n.ant-input-affix-wrapper {\n font-size: 0.875rem;\n color: #232323;\n background: white;\n box-shadow: none !important;\n border: 1px solid #e2e8f0;\n}\n.ant-input:not(:focus) {\n border-color: #e2e8f0 !important;\n}\n.ant-input-affix-wrapper:not(.ant-input-affix-wrapper-focused) .ant-input-prefix {\n color: rgba(0, 0, 0, 0.25) !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 border-block-color: #e2e8f0 !important;\n border-inline-color: #e2e8f0 !important;\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-body {\n background-color: #f8fafc !important;\n}\n.ant-drawer-header {\n padding-right: 1rem !important;\n padding-left: 1rem !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.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-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/* 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-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.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-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.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";
1765
+ var css_248z = "@font-face {\n font-family: 'Inter';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/inter/v18/UcCO3FwrK3iLTeHuS_nVMrMxCp50SjIw2boKoduKmMEVuLyfMZg.ttf) format('truetype');\n}\n@font-face {\n font-family: 'Inter';\n font-style: normal;\n font-weight: 600;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/inter/v18/UcCO3FwrK3iLTeHuS_nVMrMxCp50SjIw2boKoduKmMEVuGKYMZg.ttf) format('truetype');\n}\n.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";
1789
1766
  styleInject(css_248z);
1790
1767
 
1791
1768
  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}";
@@ -1813,12 +1790,16 @@ var CardIcon = function () {
1813
1790
  return (jsxRuntime.jsxs("svg", __assign({ width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: [jsxRuntime.jsx("path", { d: "M15 3.75H3C2.17157 3.75 1.5 4.42157 1.5 5.25V12.75C1.5 13.5784 2.17157 14.25 3 14.25H15C15.8284 14.25 16.5 13.5784 16.5 12.75V5.25C16.5 4.42157 15.8284 3.75 15 3.75Z", stroke: common.SLATE_400, strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), jsxRuntime.jsx("path", { d: "M1.5 7.5H16.5", stroke: common.SLATE_400, strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })] })));
1814
1791
  };
1815
1792
 
1793
+ var Text$d = antd.Typography.Text;
1816
1794
  var PaymentOption = function (_a) {
1817
1795
  var selected = _a.selected, paymentOption = _a.paymentOption, onClick = _a.onClick, name = _a.name;
1818
1796
  var brandColor = React.useContext(BrandContext).brandColor;
1797
+ var darkMode = React.useContext(BunnyContext).darkMode;
1819
1798
  var isAch = name === null || name === void 0 ? void 0 : name.toLowerCase().includes("ach");
1820
1799
  var isCard = name === null || name === void 0 ? void 0 : name.toLowerCase().includes("card");
1821
- return (jsxRuntime.jsxs(PaymentOptionContainer, __assign({ "$brandColor": brandColor, "$selected": selected, className: "flex justify-between items-center w-full cursor-pointer py-2 px-4 rounded border-solid border-slate-200 bg-slate-50 border", onClick: function () { return onClick(paymentOption); } }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex gap-2 items-center" }, { children: [jsxRuntime.jsx(antd.Checkbox, { checked: selected }), jsxRuntime.jsx("div", __assign({ className: "text-gray-900" }, { children: name }))] })), isAch ? (jsxRuntime.jsx(BankOutlined$1, { className: "text-slate-400" })) : isCard ? (jsxRuntime.jsx(CardIcon, {})) : (jsxRuntime.jsx(CardIcon, {}))] })));
1800
+ return (jsxRuntime.jsxs(PaymentOptionContainer, __assign({ "$brandColor": brandColor, "$selected": selected, className: "flex justify-between items-center w-full cursor-pointer py-2 px-4 rounded border-solid ".concat(darkMode
1801
+ ? "var(--row-background-dark) border-gray-500"
1802
+ : "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, {}))] })));
1822
1803
  };
1823
1804
  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) {
1824
1805
  var $brandColor = _a.$brandColor, $selected = _a.$selected;
@@ -1935,16 +1916,28 @@ var useStripePlugin = function (plugin, token, subdomain, accountId) {
1935
1916
  return stripe;
1936
1917
  };
1937
1918
 
1919
+ var PaymentContext = React.createContext({});
1920
+
1938
1921
  var CheckoutFooter = function (_a) {
1939
1922
  var amountDue = _a.amountDue, currencyId = _a.currencyId, isSaving = _a.isSaving, onPaymentSubmit = _a.onPaymentSubmit, onlySavePaymentMethod = _a.onlySavePaymentMethod, noPadding = _a.noPadding;
1940
1923
  var isMobile = common.useIsMobile();
1941
- 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(onlySavePaymentMethod
1942
- ? isSaving
1943
- ? "Saving"
1944
- : "Save"
1945
- : isSaving
1946
- ? "Paying"
1947
- : "Pay").concat(amountDue && currencyId
1924
+ var invoice = React.useContext(InvoiceCheckoutContext).invoice;
1925
+ var displayPayButtonNameAnyways = React.useContext(PaymentContext).displayPayButtonNameAnyways;
1926
+ var buttonName = function () {
1927
+ return onlySavePaymentMethod && !displayPayButtonNameAnyways
1928
+ ? isSaving
1929
+ ? "Saving"
1930
+ : "Save"
1931
+ : isSaving
1932
+ ? "Paying"
1933
+ : "Pay";
1934
+ };
1935
+ React.useEffect(function () {
1936
+ if (invoice) {
1937
+ onPaymentSubmit();
1938
+ }
1939
+ }, [invoice]);
1940
+ 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
1948
1941
  ? " ".concat(common.Misc.formatCurrency(amountDue, currencyId))
1949
1942
  : "") })) })));
1950
1943
  };
@@ -2036,10 +2029,11 @@ var PaymentMethodForm$1 = function (_a) {
2036
2029
  // Hooks
2037
2030
  var elements = reactStripeJs.useElements();
2038
2031
  var stripe = reactStripeJs.useStripe();
2039
- var _b = React.useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain, accountId = _b.accountId;
2032
+ var _b = React.useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain;
2033
+ var accountId = React.useContext(PaymentContext).accountId;
2040
2034
  // Handlers
2041
2035
  var onSubmit = function () { return __awaiter(void 0, void 0, void 0, function () {
2042
- var submitError, response, clientSecret, intentResponse, paymentMethodId, error_1;
2036
+ var submitError, response, clientSecret, intentResponse, paymentMethodId, paymentMethodResponse, error_1;
2043
2037
  var _a, _b;
2044
2038
  return __generator(this, function (_c) {
2045
2039
  switch (_c.label) {
@@ -2087,8 +2081,17 @@ var PaymentMethodForm$1 = function (_a) {
2087
2081
  accountId: accountId,
2088
2082
  })];
2089
2083
  case 4:
2090
- _c.sent();
2091
- onPaymentSuccess({});
2084
+ paymentMethodResponse = _c.sent();
2085
+ onPaymentSuccess({
2086
+ pluginPaymentResponse: {
2087
+ savePaymentMethod: true,
2088
+ plugin: plugin,
2089
+ token: paymentMethodResponse.token,
2090
+ },
2091
+ savedPaymentMethodResponse: {
2092
+ paymentMethodId: paymentMethodResponse.payload[0].id,
2093
+ },
2094
+ });
2092
2095
  return [3 /*break*/, 6];
2093
2096
  case 5:
2094
2097
  error_1 = _c.sent();
@@ -2104,7 +2107,8 @@ var PaymentMethodForm$1 = function (_a) {
2104
2107
  // This is just a wrapper to fetch the stripe object and pass it to the form
2105
2108
  var StripeForm = function (_a) {
2106
2109
  var payable = _a.payable, plugin = _a.plugin, isSaving = _a.isSaving, setIsSaving = _a.setIsSaving, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess;
2107
- var _b = React.useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain, accountId = _b.accountId;
2110
+ var _b = React.useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain;
2111
+ var accountId = React.useContext(PaymentContext).accountId;
2108
2112
  var stripe = useStripePlugin(plugin, token, subdomain, accountId);
2109
2113
  var onlySavePaymentMethod = !payable;
2110
2114
  if (!stripe)
@@ -2132,6 +2136,10 @@ var StripeForm = function (_a) {
2132
2136
  }
2133
2137
  };
2134
2138
 
2139
+ var getQuoteAmountDue = function (quote) {
2140
+ return quote.amountDue;
2141
+ };
2142
+
2135
2143
  // Simulated payment creation and confirmation
2136
2144
  var confirmPayment = function (_a) {
2137
2145
  var amount = _a.amount, currency = _a.currency, cardDetails = _a.cardDetails;
@@ -2198,34 +2206,34 @@ var storePayment = function (options, plugin, accountId, subdomain) { return __a
2198
2206
  });
2199
2207
  }); };
2200
2208
 
2201
- var CARD_NUMBER_MAX_LENGTH = 19; // Why 19 instead of 16? Because we add spaces
2202
- var formatCardNumber = function (cardNumber) {
2203
- return cardNumber.replace(/(\d{4})(?=\d)/g, "$1 ");
2204
- };
2205
- var DemoPayCardNumber = function (_a) {
2209
+ var DemoPayCardCvc = function (_a) {
2206
2210
  var autoFocus = _a.autoFocus, onChange = _a.onChange, placeholder = _a.placeholder, value = _a.value;
2207
2211
  var onKeyPress = function (event) {
2208
2212
  if (!isDigit(event.key) && !isValidKey(event.keyCode))
2209
2213
  event.preventDefault();
2210
2214
  };
2211
2215
  var onNumberChange = function (event) {
2212
- var number = event.target.value.replace(/\s/g, "");
2213
- onChange(number);
2216
+ var cvc = event.target.value.replace(/\D/g, "");
2217
+ onChange(cvc);
2214
2218
  };
2215
- return (jsxRuntime.jsx("div", __assign({ className: "grow" }, { children: jsxRuntime.jsx(antd.Input, { autoFocus: autoFocus, maxLength: CARD_NUMBER_MAX_LENGTH, onKeyDown: onKeyPress, onKeyUp: onKeyPress, onChange: onNumberChange, placeholder: placeholder || "Card Number", value: formatCardNumber(value) }) })));
2219
+ return (jsxRuntime.jsx("div", __assign({ className: "grow" }, { children: jsxRuntime.jsx(antd.Input, { autoFocus: autoFocus, onKeyDown: onKeyPress, onKeyUp: onKeyPress, onChange: onNumberChange, value: value, maxLength: 3, placeholder: placeholder || "CVC" }) })));
2216
2220
  };
2217
2221
 
2218
- var DemoPayCardCvc = function (_a) {
2222
+ var CARD_NUMBER_MAX_LENGTH = 19; // Why 19 instead of 16? Because we add spaces
2223
+ var formatCardNumber = function (cardNumber) {
2224
+ return cardNumber.replace(/(\d{4})(?=\d)/g, "$1 ");
2225
+ };
2226
+ var DemoPayCardNumber = function (_a) {
2219
2227
  var autoFocus = _a.autoFocus, onChange = _a.onChange, placeholder = _a.placeholder, value = _a.value;
2220
2228
  var onKeyPress = function (event) {
2221
2229
  if (!isDigit(event.key) && !isValidKey(event.keyCode))
2222
2230
  event.preventDefault();
2223
2231
  };
2224
2232
  var onNumberChange = function (event) {
2225
- var cvc = event.target.value.replace(/\D/g, "");
2226
- onChange(cvc);
2233
+ var number = event.target.value.replace(/\s/g, "");
2234
+ onChange(number);
2227
2235
  };
2228
- return (jsxRuntime.jsx("div", __assign({ className: "grow" }, { children: jsxRuntime.jsx(antd.Input, { autoFocus: autoFocus, onKeyDown: onKeyPress, onKeyUp: onKeyPress, onChange: onNumberChange, value: value, maxLength: 3, placeholder: placeholder || "CVC" }) })));
2236
+ return (jsxRuntime.jsx("div", __assign({ className: "grow" }, { children: jsxRuntime.jsx(antd.Input, { autoFocus: autoFocus, maxLength: CARD_NUMBER_MAX_LENGTH, onKeyDown: onKeyPress, onKeyUp: onKeyPress, onChange: onNumberChange, placeholder: placeholder || "Card Number", value: formatCardNumber(value) }) })));
2229
2237
  };
2230
2238
 
2231
2239
  var DemoPayExpiry = function (_a) {
@@ -2241,15 +2249,13 @@ var DemoPayExpiry = function (_a) {
2241
2249
  return (jsxRuntime.jsx("div", __assign({ className: "grow" }, { children: jsxRuntime.jsx(antd.Input, { autoFocus: autoFocus, onKeyDown: onKeyPress, onKeyUp: onKeyPress, onChange: onNumberChange, value: formatCardExpiry(value), maxLength: 5, placeholder: placeholder || "MM/YY" }) })));
2242
2250
  };
2243
2251
 
2244
- var getQuoteAmountDue = function (quote) {
2245
- return quote.amountDue;
2246
- };
2247
-
2252
+ var Text$c = antd.Typography.Text;
2248
2253
  var TEST_CARD = "4242424242424242";
2249
2254
  var DemoPayForm = function (_a) {
2250
2255
  var isSaving = _a.isSaving, invoice = _a.invoice, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, plugin = _a.plugin, quote = _a.quote, setIsSaving = _a.setIsSaving;
2251
2256
  // Context
2252
- var _b = React.useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain, accountId = _b.accountId;
2257
+ var _b = React.useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain, darkMode = _b.darkMode;
2258
+ var accountId = React.useContext(PaymentContext).accountId;
2253
2259
  // Local state
2254
2260
  var _c = React.useState(false), savePaymentMethod = _c[0], setSavePaymentMethod = _c[1];
2255
2261
  var _d = React.useState({
@@ -2261,12 +2267,14 @@ var DemoPayForm = function (_a) {
2261
2267
  var currencyId = (quote === null || quote === void 0 ? void 0 : quote.currencyId) || (invoice === null || invoice === void 0 ? void 0 : invoice.currency);
2262
2268
  var onlySavePaymentMethod = !quote && !invoice;
2263
2269
  var onPaymentSubmit = function () { return __awaiter(void 0, void 0, void 0, function () {
2264
- var response, response, error_1;
2270
+ var response, paymentMethodId, response, error_1;
2265
2271
  return __generator(this, function (_a) {
2266
2272
  switch (_a.label) {
2267
2273
  case 0:
2268
2274
  _a.trys.push([0, 6, , 7]);
2275
+ validateCardDetails();
2269
2276
  if (!onlySavePaymentMethod) return [3 /*break*/, 2];
2277
+ setIsSaving(true);
2270
2278
  return [4 /*yield*/, storePayment({
2271
2279
  testCreditCardNumber: unformatCardNumber(cardDetails.number),
2272
2280
  testCreditCardCvc: cardDetails.cvc.toString(),
@@ -2275,21 +2283,23 @@ var DemoPayForm = function (_a) {
2275
2283
  }, plugin, accountId, subdomain)];
2276
2284
  case 1:
2277
2285
  response = _a.sent();
2286
+ paymentMethodId = response.payload[0].id;
2278
2287
  if (response.status !== "success")
2279
2288
  throw new Error(response === null || response === void 0 ? void 0 : response.message);
2280
- onPaymentSuccess({});
2281
- return [3 /*break*/, 5];
2282
- case 2:
2283
- if (!(amountDue !== undefined && currencyId)) return [3 /*break*/, 4];
2289
+ onPaymentSuccess({
2290
+ pluginPaymentResponse: {
2291
+ plugin: plugin,
2292
+ token: response.token,
2293
+ savePaymentMethod: savePaymentMethod,
2294
+ },
2295
+ savedPaymentMethodResponse: {
2296
+ paymentMethodId: paymentMethodId,
2297
+ },
2298
+ });
2299
+ return [3 /*break*/, 5];
2300
+ case 2:
2301
+ if (!(amountDue !== undefined && currencyId)) return [3 /*break*/, 4];
2284
2302
  setIsSaving(true);
2285
- if (cardDetails.number !== TEST_CARD)
2286
- throw new Error("Only the card number 4242 4242 4242 4242 will be accepted.");
2287
- if (!isValidExpiry(cardDetails.expiry))
2288
- throw new Error("Invalid expiry date");
2289
- if (isCardExpired(cardDetails.expiry))
2290
- throw new Error("Card is expired");
2291
- if (cardDetails.cvc.length !== 3)
2292
- throw new Error("Invalid CVC");
2293
2303
  return [4 /*yield*/, confirmPayment({
2294
2304
  amount: amountDue,
2295
2305
  currency: currencyId,
@@ -2304,6 +2314,7 @@ var DemoPayForm = function (_a) {
2304
2314
  savePaymentMethod: savePaymentMethod,
2305
2315
  },
2306
2316
  });
2317
+ setIsSaving(false);
2307
2318
  return [3 /*break*/, 5];
2308
2319
  case 4:
2309
2320
  onFail(new Error("No amount or currencyId"));
@@ -2317,6 +2328,16 @@ var DemoPayForm = function (_a) {
2317
2328
  }
2318
2329
  });
2319
2330
  }); };
2331
+ function validateCardDetails() {
2332
+ if (cardDetails.number !== TEST_CARD)
2333
+ throw new Error("Only the card number 4242 4242 4242 4242 will be accepted.");
2334
+ if (!isValidExpiry(cardDetails.expiry))
2335
+ throw new Error("Invalid expiry date");
2336
+ if (isCardExpired(cardDetails.expiry))
2337
+ throw new Error("Card is expired");
2338
+ if (cardDetails.cvc.length !== 3)
2339
+ throw new Error("Invalid CVC");
2340
+ }
2320
2341
  var onCardNumberChange = function (number) {
2321
2342
  setCardDetails(__assign(__assign({}, cardDetails), { number: number }));
2322
2343
  };
@@ -2326,9 +2347,15 @@ var DemoPayForm = function (_a) {
2326
2347
  var onCardCvcChange = function (cvc) {
2327
2348
  setCardDetails(__assign(__assign({}, cardDetails), { cvc: cvc }));
2328
2349
  };
2329
- return (jsxRuntime.jsxs("div", __assign({ className: "flex flex-col gap-2" }, { children: [jsxRuntime.jsxs(StyledInputs, __assign({ className: "flex flex-col gap-2" }, { 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("div", __assign({ className: "text-xs text-gray-700" }, { 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 })] })));
2350
+ 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 })] })));
2330
2351
  };
2331
- var StyledInputs = styled__default["default"].div(templateObject_1$7 || (templateObject_1$7 = __makeTemplateObject(["\n .ant-input {\n background-color: white !important;\n }\n .ant-input:not(:focus) {\n border-color: ", " !important;\n }\n"], ["\n .ant-input {\n background-color: white !important;\n }\n .ant-input:not(:focus) {\n border-color: ", " !important;\n }\n"])), common.GRAY_200);
2352
+ 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) {
2353
+ var darkMode = _a.darkMode;
2354
+ return darkMode ? "var(--row-background-dark)" : "white";
2355
+ }, function (_a) {
2356
+ var darkMode = _a.darkMode;
2357
+ return darkMode ? common.GRAY_500 : common.GRAY_200;
2358
+ });
2332
2359
  var templateObject_1$7;
2333
2360
 
2334
2361
  var finixStyles = function (isMobile) { return ({
@@ -2419,7 +2446,8 @@ var formatFinixError = function (response) {
2419
2446
  var FinixCardPaymentForm = function (_a) {
2420
2447
  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;
2421
2448
  // Context
2422
- var _b = React.useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain, accountId = _b.accountId;
2449
+ var _b = React.useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain;
2450
+ var accountId = React.useContext(PaymentContext).accountId;
2423
2451
  var isMobile = common.useIsMobile();
2424
2452
  // Local state
2425
2453
  var _c = React.useState(false), savePaymentMethod = _c[0], setSavePaymentMethod = _c[1];
@@ -2761,7 +2789,7 @@ var PaymentForm = function (_a) {
2761
2789
  return (jsxRuntime.jsx(ActualPaymentForm, { invoice: invoice, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, quote: quote, setIsSaving: setIsSaving }));
2762
2790
  };
2763
2791
 
2764
- var MUTATION$3 = "\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";
2792
+ 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";
2765
2793
  var checkout = function (_a) {
2766
2794
  var quoteId = _a.quoteId, invoiceId = _a.invoiceId, paymentMethodId = _a.paymentMethodId, paymentMethodData = _a.paymentMethodData, token = _a.token, subdomain = _a.subdomain;
2767
2795
  return __awaiter(void 0, void 0, void 0, function () {
@@ -2778,7 +2806,7 @@ var checkout = function (_a) {
2778
2806
  mutationVars.paymentMethodData = __assign(__assign({}, paymentMethodData), { metadata: paymentMethodData.metadata });
2779
2807
  }
2780
2808
  return [4 /*yield*/, common.gqlRequest({
2781
- query: MUTATION$3,
2809
+ query: MUTATION$7,
2782
2810
  token: token,
2783
2811
  vars: mutationVars,
2784
2812
  subdomain: subdomain,
@@ -2796,8 +2824,9 @@ var checkout = function (_a) {
2796
2824
  });
2797
2825
  };
2798
2826
 
2827
+ var InvoiceCheckoutContext = React.createContext({});
2799
2828
  var InvoiceCheckout = function (_a) {
2800
- var isSaving = _a.isSaving, onSuccess = _a.onSuccess, onFail = _a.onFail, invoice = _a.invoice, setIsSaving = _a.setIsSaving;
2829
+ 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;
2801
2830
  var _b = React.useContext(BunnyContext), subdomain = _b.subdomain, token = _b.token;
2802
2831
  var checkoutMutation = reactQuery.useMutation({
2803
2832
  mutationFn: function (_a) {
@@ -2805,7 +2834,7 @@ var InvoiceCheckout = function (_a) {
2805
2834
  if (savedPaymentMethod) {
2806
2835
  var paymentMethodId = savedPaymentMethod.paymentMethodId;
2807
2836
  return checkout({
2808
- invoiceId: invoice.id,
2837
+ invoiceId: invoice === null || invoice === void 0 ? void 0 : invoice.id,
2809
2838
  paymentMethodId: paymentMethodId,
2810
2839
  token: token,
2811
2840
  subdomain: subdomain,
@@ -2815,7 +2844,7 @@ var InvoiceCheckout = function (_a) {
2815
2844
  var plugin = pluginPaymentMethod.plugin, savePaymentMethod = pluginPaymentMethod.savePaymentMethod, metadata = pluginPaymentMethod.metadata;
2816
2845
  var paymentToken = pluginPaymentMethod.token;
2817
2846
  return checkout({
2818
- invoiceId: invoice.id,
2847
+ invoiceId: invoice === null || invoice === void 0 ? void 0 : invoice.id,
2819
2848
  paymentMethodData: {
2820
2849
  metadata: metadata,
2821
2850
  pluginGuid: plugin.guid,
@@ -2861,7 +2890,14 @@ var InvoiceCheckout = function (_a) {
2861
2890
  });
2862
2891
  });
2863
2892
  };
2864
- return (jsxRuntime.jsx(PaymentForm, { isSaving: isSaving, onPaymentSuccess: handleCheckout, onFail: onFail, invoice: invoice, setIsSaving: setIsSaving }));
2893
+ return (jsxRuntime.jsx(InvoiceCheckoutContext.Provider, __assign({ value: {
2894
+ preCheckout: preCheckout,
2895
+ payImmediatelyGivenInvoice: payImmediatelyGivenInvoice,
2896
+ checkoutButtonName: checkoutButtonName,
2897
+ invoice: invoice,
2898
+ setIsPreCheckoutLoading: setIsPreCheckoutLoading,
2899
+ isPreCheckoutLoading: isPreCheckoutLoading,
2900
+ } }, { children: jsxRuntime.jsx(PaymentForm, { isSaving: isSaving, onPaymentSuccess: handleCheckout, onFail: onFail, invoice: invoice, setIsSaving: setIsSaving }) })));
2865
2901
  };
2866
2902
 
2867
2903
  var fetchPDF = function (window, apiEndpoint, invoiceUuid) { return __awaiter(void 0, void 0, void 0, function () {
@@ -2907,7 +2943,7 @@ function InvoicePDF(_a) {
2907
2943
  }, title: "Invoice PDF", width: "100%" }));
2908
2944
  }
2909
2945
 
2910
- var MUTATION$2 = "\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}";
2946
+ var MUTATION$6 = "\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}";
2911
2947
  var getFormattedInvoice = function (_a) {
2912
2948
  var id = _a.id, token = _a.token, subdomain = _a.subdomain;
2913
2949
  return __awaiter(void 0, void 0, void 0, function () {
@@ -2917,7 +2953,7 @@ var getFormattedInvoice = function (_a) {
2917
2953
  case 0:
2918
2954
  vars = { id: id };
2919
2955
  return [4 /*yield*/, common.gqlRequest({
2920
- query: MUTATION$2,
2956
+ query: MUTATION$6,
2921
2957
  token: token,
2922
2958
  vars: vars,
2923
2959
  subdomain: subdomain,
@@ -2973,7 +3009,7 @@ function ActualInvoice(_a) {
2973
3009
  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({
2974
3010
  vendorName: formattedInvoice.vendorName,
2975
3011
  documentName: common.DOCUMENT_NAME.INVOICE,
2976
- }) }), 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 bg-red-500" }, { 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) {
3012
+ }) }), 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) {
2977
3013
  onFail(error);
2978
3014
  setIsSaving(false);
2979
3015
  }, onSuccess: onSuccess, setIsSaving: setIsSaving }))] }))] }));
@@ -2983,8 +3019,6 @@ function Invoice(_a) {
2983
3019
  return (jsxRuntime.jsx(reactHelmetAsync.HelmetProvider, { children: jsxRuntime.jsx(ActualInvoice, { id: id, invoiceQuoteViewComponent: invoiceQuoteViewComponent, backButtonName: backButtonName, onBackButtonClick: onBackButtonClick, onPaymentSuccess: onPaymentSuccess }) }));
2984
3020
  }
2985
3021
 
2986
- var QuoteContext = React.createContext({});
2987
-
2988
3022
  var DOCUMENT_NAME;
2989
3023
  (function (DOCUMENT_NAME) {
2990
3024
  DOCUMENT_NAME["INVOICE"] = "invoice";
@@ -3110,7 +3144,7 @@ var useSigningComplete = function (_a) {
3110
3144
  var queryClient = reactQuery.useQueryClient();
3111
3145
  var searchParams = React.useContext(NavigationContext).searchParams;
3112
3146
  // Check for return param from docusign and show cosmetic quote acceptance
3113
- var eventParam = searchParams.get("event");
3147
+ var eventParam = searchParams ? searchParams.get("event") : null;
3114
3148
  React.useEffect(function () {
3115
3149
  if (data && eventParam === "signing_complete") {
3116
3150
  data.state = "ACCEPTED";
@@ -3194,8 +3228,6 @@ var PandadocPollingModal = function (_a) {
3194
3228
  handleAllErrorFormats(rsp.errors);
3195
3229
  else if (rsp.data.quotePollSigningUrl.status === "document.sent") {
3196
3230
  setVisible(false);
3197
- console.log("rsp", rsp);
3198
- console.log("rsp.data.quotePollSigningUrl.redirectUri", rsp.data.quotePollSigningUrl.redirectUri);
3199
3231
  window.location.href = rsp.data.quotePollSigningUrl.redirectUri;
3200
3232
  }
3201
3233
  setInfoMessage(rsp.data.quotePollSigningUrl.infoMessage || "");
@@ -3215,55 +3247,42 @@ var PandadocPollingModal = function (_a) {
3215
3247
  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 }))] })));
3216
3248
  };
3217
3249
 
3218
- var formattedQuoteMutation = function () { 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 }"; };
3219
- var getFormattedQuote = function (token, apiEndpoint, id) { return __awaiter(void 0, void 0, void 0, function () {
3220
- var response, _a, data, errors, formattedLines, decimals;
3221
- return __generator(this, function (_b) {
3222
- switch (_b.label) {
3223
- case 0: return [4 /*yield*/, fetch(apiEndpoint + "/graphql", {
3224
- method: "POST",
3225
- headers: {
3226
- "Content-type": "application/json; charset=utf-8",
3227
- Authorization: "Bearer ".concat(token),
3228
- },
3229
- body: JSON.stringify({
3230
- query: formattedQuoteMutation(),
3231
- variables: {
3232
- id: id,
3233
- },
3234
- }),
3235
- })];
3236
- case 1:
3237
- response = _b.sent();
3238
- return [4 /*yield*/, response.json()];
3239
- case 2:
3240
- _a = _b.sent(), data = _a.data, errors = _a.errors;
3241
- if (errors) {
3242
- throw new Error(errors[0].message);
3243
- }
3244
- formattedLines = data.formattedQuote.formattedLines;
3245
- decimals = Math.max.apply(Math, formattedLines.map(function (x) { return x.priceDecimals; }));
3246
- formattedLines.forEach(function (line) {
3247
- line.priceDecimals = decimals;
3248
- });
3249
- return [2 /*return*/, data === null || data === void 0 ? void 0 : data.formattedQuote];
3250
- }
3250
+ var MUTATION$5 = "\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 }";
3251
+ var getFormattedQuote = function (_a) {
3252
+ var id = _a.id, token = _a.token, subdomain = _a.subdomain;
3253
+ return __awaiter(void 0, void 0, void 0, function () {
3254
+ var vars, response;
3255
+ return __generator(this, function (_b) {
3256
+ switch (_b.label) {
3257
+ case 0:
3258
+ vars = { id: id };
3259
+ return [4 /*yield*/, common.gqlRequest({
3260
+ query: MUTATION$5,
3261
+ token: token,
3262
+ vars: vars,
3263
+ subdomain: subdomain,
3264
+ })];
3265
+ case 1:
3266
+ response = _b.sent();
3267
+ return [2 /*return*/, response === null || response === void 0 ? void 0 : response.formattedQuote];
3268
+ }
3269
+ });
3251
3270
  });
3252
- }); };
3271
+ };
3253
3272
 
3254
3273
  var documentName = DOCUMENT_NAME.QUOTE;
3255
- function ActualQuote() {
3256
- var _a, _b;
3257
- var id = React.useContext(QuoteContext).id;
3258
- var _c = React.useContext(BunnyContext), token = _c.token, subdomain = _c.subdomain;
3274
+ function ActualQuote(_a) {
3275
+ var _b, _c;
3276
+ var id = _a.id;
3277
+ var _d = React.useContext(BunnyContext), token = _d.token, subdomain = _d.subdomain;
3259
3278
  var entityBranding = React.useContext(BrandContext);
3260
3279
  var isMobile = common.useIsMobile();
3261
3280
  // Queries
3262
- var data = reactQuery.useQuery({
3281
+ var _e = reactQuery.useQuery({
3263
3282
  queryKey: common.QueryKeyFactory.default.createQuoteKey(token),
3264
- queryFn: function () { return getFormattedQuote(token, subdomain, id); },
3283
+ queryFn: function () { return getFormattedQuote({ token: token, subdomain: subdomain, id: id }); },
3265
3284
  placeholderData: reactQuery.keepPreviousData,
3266
- }).data;
3285
+ }), data = _e.data; _e.isLoading; _e.isError; _e.error;
3267
3286
  reactQuery.useQuery({
3268
3287
  queryKey: common.QueryKeyFactory.default.currentUserKey,
3269
3288
  queryFn: function () { return getCurrentUserData({ token: token, subdomain: subdomain }); },
@@ -3272,7 +3291,7 @@ function ActualQuote() {
3272
3291
  // Hooks
3273
3292
  var downloadFile = common.useDownloadFile(id);
3274
3293
  var isExpired = useIsExpired(formattedQuote === null || formattedQuote === void 0 ? void 0 : formattedQuote.expiresAt);
3275
- var _d = useSendAcceptQuote(token, subdomain, id), acceptBoxVisible = _d.acceptBoxVisible, isAccepting = _d.isAccepting, sendAccept = _d.sendAccept, setAcceptBoxVisible = _d.setAcceptBoxVisible, setIsAccepting = _d.setIsAccepting, startAcceptance = _d.startAcceptance, pandadocPollingModalVisible = _d.pandadocPollingModalVisible, setPandadocPollingModalVisible = _d.setPandadocPollingModalVisible;
3294
+ 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;
3276
3295
  useSigningComplete({ data: formattedQuote, token: token });
3277
3296
  if (!formattedQuote) {
3278
3297
  return jsxRuntime.jsx(jsxRuntime.Fragment, {});
@@ -3282,25 +3301,30 @@ function ActualQuote() {
3282
3301
  documentName: documentName,
3283
3302
  }) }), 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: {
3284
3303
  color: entityBranding.secondaryColor,
3285
- } }, { children: [(formattedQuote.state === "ACCEPTED" ||
3286
- formattedQuote.state === "APPLIED") && (jsxRuntime.jsxs("div", { children: [formattedQuote.state === "ACCEPTED" &&
3304
+ } }, { children: [formattedQuote.state === "ACCEPTED" ||
3305
+ formattedQuote.state === "APPLIED" ? (jsxRuntime.jsxs("div", { children: [formattedQuote.state === "ACCEPTED" &&
3287
3306
  formattedQuote.acceptedAt &&
3288
3307
  "Quote was accepted by ".concat(formattedQuote.acceptedByName, " on ").concat(common.Misc.formatDate(formattedQuote.acceptedAt)), formattedQuote.state === "APPLIED" &&
3289
3308
  formattedQuote.acceptedAt &&
3290
- "Quote is now applied. Accepted by ".concat(formattedQuote.acceptedByName, " on ").concat(common.Misc.formatDate(formattedQuote.acceptedAt))] })), jsxRuntime.jsxs("div", __assign({ className: isMobile
3309
+ "Quote is now applied. Accepted by ".concat(formattedQuote.acceptedByName, " on ").concat(common.Misc.formatDate(formattedQuote.acceptedAt))] })) : null, jsxRuntime.jsxs("div", __assign({ className: isMobile
3291
3310
  ? "flex w-full justify-between gap-2"
3292
- : "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" }))), formattedQuote.state !== "ACCEPTED" &&
3293
- formattedQuote.state !== "APPLIED" && (jsxRuntime.jsx(antd.Button, __assign({ disabled: isExpired || isAccepting, onClick: function () { return startAcceptance(); }, type: "primary" }, { children: isExpired ? "Quote is expired" : "Accept quote" })))] }))] })), 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: ((_b = (_a = formattedQuote.object) === null || _a === void 0 ? void 0 : _a.documents) === null || _b === void 0 ? void 0 : _b.length) > 0 && (jsxRuntime.jsx("div", __assign({ className: "flex flex-col items-end" }, { children: formattedQuote.object.documents.map(function (doc, index) {
3311
+ : "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" &&
3312
+ 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) {
3294
3313
  return (jsxRuntime.jsx(antd.Button, __assign({ download: doc.filename, href: doc.url, type: "link" }, { children: doc.filename }), index));
3295
- }) }))) })) })), jsxRuntime.jsx(AcceptQuoteModal, { acceptBoxVisible: acceptBoxVisible, formattedQuote: formattedQuote, setAcceptBoxVisible: setAcceptBoxVisible, setIsAccepting: setIsAccepting, sendAccept: sendAccept }), jsxRuntime.jsx(PandadocPollingModal, { isVisible: pandadocPollingModalVisible, setVisible: setPandadocPollingModalVisible, id: id })] }));
3314
+ }) }))) : null })) })), jsxRuntime.jsx(AcceptQuoteModal, { acceptBoxVisible: acceptBoxVisible, formattedQuote: formattedQuote, setAcceptBoxVisible: setAcceptBoxVisible, setIsAccepting: setIsAccepting, sendAccept: sendAccept }), jsxRuntime.jsx(PandadocPollingModal, { isVisible: pandadocPollingModalVisible, setVisible: setPandadocPollingModalVisible, id: id })] }));
3296
3315
  }
3297
3316
  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"])));
3298
3317
  function Quote(_a) {
3299
3318
  var id = _a.id;
3300
- return (jsxRuntime.jsx(reactHelmetAsync.HelmetProvider, { children: jsxRuntime.jsx(QuoteContext.Provider, __assign({ value: { id: id } }, { children: jsxRuntime.jsx(ActualQuote, {}) })) }));
3319
+ return (jsxRuntime.jsx(reactHelmetAsync.HelmetProvider, { children: jsxRuntime.jsx(ActualQuote, { id: id }) }));
3301
3320
  }
3302
3321
  var templateObject_1$5;
3303
3322
 
3323
+ var DrawerHeader = function (_a) {
3324
+ var description = _a.description, onClose = _a.onClose, title = _a.title;
3325
+ 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 }))] })));
3326
+ };
3327
+
3304
3328
  var LargeCardIcon = function () {
3305
3329
  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" }) })));
3306
3330
  };
@@ -3312,11 +3336,15 @@ var PlusIcon = function (_a) {
3312
3336
 
3313
3337
  var PaymentMethodContext = React.createContext({});
3314
3338
 
3315
- // TODO: remove this eventually
3316
- var Card$1 = function (_a) {
3317
- var children = _a.children, className = _a.className;
3318
- return (jsxRuntime.jsx("div", __assign({ className: "flex flex-col bg-white rounded-md shadow-md ".concat(className) }, { children: children })));
3339
+ var Card = function (_a) {
3340
+ var children = _a.children, className = _a.className, style = _a.style;
3341
+ var darkMode = React.useContext(BunnyContext).darkMode;
3342
+ return (jsxRuntime.jsx("div", __assign({ className: "flex flex-col rounded-md shadow-md ".concat(className), style: __assign(__assign({}, style), { backgroundColor: darkMode
3343
+ ? "var(--row-background-dark)"
3344
+ : "var(--row-background)" }) }, { children: children })));
3319
3345
  };
3346
+
3347
+ var Text$b = antd.Typography.Text;
3320
3348
  var CreditCard = function (_a) {
3321
3349
  var _b, _c, _d;
3322
3350
  var onClickRemove = _a.onClickRemove, onClickUpdate = _a.onClickUpdate, paymentMethodData = _a.paymentMethodData;
@@ -3327,11 +3355,11 @@ var CreditCard = function (_a) {
3327
3355
  };
3328
3356
  var isMobile = common.useIsMobile();
3329
3357
  var processPublicUrl = React.useContext(PaymentMethodContext).processPublicUrl;
3330
- return (jsxRuntime.jsxs(Card$1, __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("div", { 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 }))] }))] }))] })));
3358
+ 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$b, { 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 }))] }))] }))] })));
3331
3359
  };
3332
3360
  var CardAttribute = function (_a) {
3333
3361
  var title = _a.title, value = _a.value;
3334
- return (jsxRuntime.jsxs("div", __assign({ className: "flex flex-col gap-2" }, { children: [jsxRuntime.jsx("div", __assign({ className: "text-slate-400", style: { fontSize: "11px" } }, { children: title })), jsxRuntime.jsx("div", { children: value })] })));
3362
+ return (jsxRuntime.jsxs("div", __assign({ className: "flex flex-col gap-2" }, { children: [jsxRuntime.jsx("div", __assign({ className: "text-slate-400", style: { fontSize: "11px" } }, { children: title })), jsxRuntime.jsx(Text$b, { children: value })] })));
3335
3363
  };
3336
3364
  var CardActions = function (_a) {
3337
3365
  var onClickRemove = _a.onClickRemove, onClickUpdate = _a.onClickUpdate;
@@ -3350,14 +3378,9 @@ var getCardImage = function (issuer) {
3350
3378
  return "mc_symbol_opt_73_3x.png";
3351
3379
  };
3352
3380
 
3353
- var DrawerHeader = function (_a) {
3354
- var description = _a.description, onClose = _a.onClose, title = _a.title;
3355
- 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 }))] })));
3356
- };
3357
-
3358
3381
  var ActualPaymentMethod = function () {
3359
- var _a = React.useContext(BunnyContext), token = _a.token, subdomain = _a.subdomain, graphQLClient = _a.graphQLClient, accountId = _a.accountId;
3360
- var footer = React.useContext(PaymentMethodContext).footer;
3382
+ var _a = React.useContext(BunnyContext), token = _a.token, subdomain = _a.subdomain, graphQLClient = _a.graphQLClient;
3383
+ var accountId = React.useContext(PaymentContext).accountId;
3361
3384
  // Hooks
3362
3385
  var queryClient = reactQuery.useQueryClient();
3363
3386
  var paymentPlugins = common.usePaymentPlugins({ subdomain: subdomain, token: token }).paymentPlugins;
@@ -3407,7 +3430,7 @@ var ActualPaymentMethod = function () {
3407
3430
  };
3408
3431
  if (data === undefined)
3409
3432
  return jsxRuntime.jsx(jsxRuntime.Fragment, {});
3410
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [data ? (jsxRuntime.jsx(CreditCard, { onClickRemove: onClickRemove, onClickUpdate: function () { return setShowModal(true); }, paymentMethodData: data })) : (jsxRuntime.jsx(EmptyCard, { onClick: function () { return setShowModal(true); } })), footer, jsxRuntime.jsx(antd.Drawer, __assign({ closeIcon: null, onClose: function () { return setShowModal(false); }, open: showModal, styles: {
3433
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [data ? (jsxRuntime.jsx(CreditCard, { onClickRemove: onClickRemove, onClickUpdate: function () { return setShowModal(true); }, paymentMethodData: data })) : (jsxRuntime.jsx(EmptyCard, { onClick: function () { return setShowModal(true); } })), jsxRuntime.jsx(antd.Drawer, __assign({ closeIcon: null, onClose: function () { return setShowModal(false); }, open: showModal, styles: {
3411
3434
  body: isMobile
3412
3435
  ? {
3413
3436
  padding: "1rem 0 0",
@@ -3427,7 +3450,7 @@ function PaymentMethod(_a) {
3427
3450
  return (jsxRuntime.jsx(PaymentMethodContext.Provider, __assign({ value: { footer: footer, processPublicUrl: processPublicUrl } }, { children: jsxRuntime.jsx(ActualPaymentMethod, {}) })));
3428
3451
  }
3429
3452
 
3430
- var MUTATION$1 = "\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";
3453
+ var MUTATION$4 = "\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";
3431
3454
  var accountUpdate = function (_a) {
3432
3455
  var accountId = _a.accountId, attributes = _a.attributes, token = _a.token;
3433
3456
  return __awaiter(void 0, void 0, void 0, function () {
@@ -3437,7 +3460,7 @@ var accountUpdate = function (_a) {
3437
3460
  switch (_c.label) {
3438
3461
  case 0:
3439
3462
  vars = { id: accountId, attributes: attributes };
3440
- return [4 /*yield*/, common.gqlRequest({ query: MUTATION$1, token: token, vars: vars })];
3463
+ return [4 /*yield*/, common.gqlRequest({ query: MUTATION$4, token: token, vars: vars })];
3441
3464
  case 1:
3442
3465
  response = _c.sent();
3443
3466
  errors = (_b = response === null || response === void 0 ? void 0 : response.accountUpdate) === null || _b === void 0 ? void 0 : _b.errors;
@@ -3501,6 +3524,8 @@ var QuoteCheckout = function (_a) {
3501
3524
  var checkoutMutation = reactQuery.useMutation({
3502
3525
  mutationFn: function (_a) {
3503
3526
  var pluginPaymentMethod = _a.pluginPaymentMethod, savedPaymentMethod = _a.storedPaymentMethod;
3527
+ if (!quote)
3528
+ throw new Error("Quote is required");
3504
3529
  if (!paymentRequired)
3505
3530
  return checkout({ quoteId: quote.id, token: token, subdomain: subdomain });
3506
3531
  if (savedPaymentMethod) {
@@ -3703,6 +3728,280 @@ var Checkout = function (_a) {
3703
3728
  }, setIsSaving: setIsSaving }))] }))] })) })));
3704
3729
  };
3705
3730
 
3731
+ var MUTATION$3 = 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}"; };
3732
+ var accountSignup = function (_a) {
3733
+ 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;
3734
+ return __awaiter(void 0, void 0, void 0, function () {
3735
+ var vars, response, errors;
3736
+ var _b;
3737
+ return __generator(this, function (_c) {
3738
+ switch (_c.label) {
3739
+ case 0:
3740
+ vars = {
3741
+ entityId: entityId,
3742
+ accountId: accountId,
3743
+ quoteId: quoteId,
3744
+ paymentToken: paymentToken,
3745
+ pluginId: pluginId,
3746
+ paymentMethodId: paymentMethodId,
3747
+ priceListCode: priceListCode,
3748
+ };
3749
+ return [4 /*yield*/, common.gqlRequest({
3750
+ query: MUTATION$3(),
3751
+ token: token,
3752
+ vars: vars,
3753
+ subdomain: subdomain,
3754
+ })];
3755
+ case 1:
3756
+ response = _c.sent();
3757
+ errors = (_b = response === null || response === void 0 ? void 0 : response.accountSignup) === null || _b === void 0 ? void 0 : _b.errors;
3758
+ if (errors)
3759
+ throw errors;
3760
+ return [2 /*return*/, response === null || response === void 0 ? void 0 : response.accountSignup];
3761
+ }
3762
+ });
3763
+ });
3764
+ };
3765
+
3766
+ var MUTATION$2 = 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 quoteId\n errors\n }\n}"; };
3767
+ var quoteAccountSignup = function (_a) {
3768
+ var token = _a.token, subdomain = _a.subdomain, entityId = _a.entityId, priceListCode = _a.priceListCode, accountName = _a.accountName, billingContact = _a.billingContact;
3769
+ return __awaiter(void 0, void 0, void 0, function () {
3770
+ var vars, response, errors;
3771
+ var _b;
3772
+ return __generator(this, function (_c) {
3773
+ switch (_c.label) {
3774
+ case 0:
3775
+ vars = {
3776
+ entityId: entityId,
3777
+ priceListCode: priceListCode,
3778
+ accountName: accountName,
3779
+ billingContact: billingContact,
3780
+ };
3781
+ return [4 /*yield*/, common.gqlRequest({
3782
+ query: MUTATION$2(),
3783
+ token: token,
3784
+ vars: vars,
3785
+ subdomain: subdomain,
3786
+ })];
3787
+ case 1:
3788
+ response = _c.sent();
3789
+ errors = (_b = response === null || response === void 0 ? void 0 : response.quoteAccountSignup) === null || _b === void 0 ? void 0 : _b.errors;
3790
+ if (errors)
3791
+ throw errors;
3792
+ return [2 /*return*/, response === null || response === void 0 ? void 0 : response.quoteAccountSignup];
3793
+ }
3794
+ });
3795
+ });
3796
+ };
3797
+
3798
+ var MUTATION$1 = 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}"; };
3799
+ var getPriceList = function (_a) {
3800
+ var token = _a.token, code = _a.code, subdomain = _a.subdomain;
3801
+ return __awaiter(void 0, void 0, void 0, function () {
3802
+ var response;
3803
+ return __generator(this, function (_b) {
3804
+ switch (_b.label) {
3805
+ case 0: return [4 /*yield*/, common.gqlRequest({
3806
+ query: MUTATION$1(),
3807
+ token: token,
3808
+ vars: { code: code },
3809
+ subdomain: subdomain,
3810
+ })];
3811
+ case 1:
3812
+ response = _b.sent();
3813
+ return [2 /*return*/, response === null || response === void 0 ? void 0 : response.priceList];
3814
+ }
3815
+ });
3816
+ });
3817
+ };
3818
+
3819
+ function PaymentForms(_a) {
3820
+ 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;
3821
+ 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 })) }));
3822
+ }
3823
+ function InitialSignupForm(_a) {
3824
+ var onSubmit = _a.onSubmit, submitting = _a.submitting;
3825
+ var _b = React.useState({
3826
+ firstName: "",
3827
+ lastName: "",
3828
+ email: "",
3829
+ accountName: "",
3830
+ }), formData = _b[0], setFormData = _b[1];
3831
+ var handleInputChange = function (e) {
3832
+ var _a;
3833
+ var _b = e.target, name = _b.name, value = _b.value;
3834
+ setFormData(__assign(__assign({}, formData), (_a = {}, _a[name] = value, _a)));
3835
+ };
3836
+ return (jsxRuntime.jsxs(antd.Form, __assign({ className: "flex w-1/2 flex-col justify-between h-full", onFinish: function () { return onSubmit(formData); } }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex flex-col space-y-2" }, { children: [jsxRuntime.jsx(antd.Form.Item, __assign({ rules: [{ required: true, message: "Please input your first name!" }], initialValue: formData.firstName }, { children: jsxRuntime.jsx(antd.Input, { placeholder: "First name", value: formData.firstName, onChange: function (e) {
3837
+ handleInputChange(e);
3838
+ setFormData(__assign(__assign({}, formData), { firstName: e.target.value }));
3839
+ } }) })), jsxRuntime.jsx(antd.Form.Item, __assign({ rules: [{ required: true, message: "Please input your last name!" }], initialValue: formData.lastName }, { children: jsxRuntime.jsx(antd.Input, { placeholder: "Last name", value: formData.lastName, onChange: function (e) {
3840
+ handleInputChange(e);
3841
+ setFormData(__assign(__assign({}, formData), { lastName: e.target.value }));
3842
+ } }) })), jsxRuntime.jsx(antd.Form.Item, __assign({ rules: [
3843
+ { required: true, message: "Please input your email!" },
3844
+ { type: "email", message: "Please enter a valid email!" },
3845
+ ], initialValue: formData.email }, { children: jsxRuntime.jsx(antd.Input, { placeholder: "Email", value: formData.email, onChange: function (e) {
3846
+ handleInputChange(e);
3847
+ setFormData(__assign(__assign({}, formData), { email: e.target.value }));
3848
+ } }) })), jsxRuntime.jsx(antd.Form.Item, __assign({ rules: [
3849
+ { required: true, message: "Please input your account name!" },
3850
+ ], initialValue: formData.accountName }, { children: jsxRuntime.jsx(antd.Input, { placeholder: "Account name", value: formData.accountName, onChange: function (e) {
3851
+ handleInputChange(e);
3852
+ setFormData(__assign(__assign({}, formData), { accountName: e.target.value }));
3853
+ } }) }))] })), jsxRuntime.jsx(antd.Form.Item, { children: jsxRuntime.jsx(antd.Button, __assign({ type: "primary", htmlType: "submit", loading: submitting, className: "w-full mt-4" }, { children: "Proceed to payment" })) })] })));
3854
+ }
3855
+
3856
+ var Title = antd.Typography.Title, Text$a = antd.Typography.Text;
3857
+ function PaymentSuccessDisplay(_a) {
3858
+ var className = _a.className, amountPaid = _a.amountPaid, style = _a.style, returnUrl = _a.returnUrl;
3859
+ var window = React.useContext(BunnyContext).window;
3860
+ var companyName = common.useCurrentUserData().companyName;
3861
+ 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$a, __assign({ className: "text-slate-500 cursor-pointer underline", onClick: function () { return (window.location.href = returnUrl); } }, { children: ["Back to ", companyName] })))] })));
3862
+ }
3863
+
3864
+ var Text$9 = antd.Typography.Text;
3865
+ function PriceListDisplay(_a) {
3866
+ var priceListData = _a.priceListData, topNavImageUrl = _a.topNavImageUrl;
3867
+ if (!priceListData)
3868
+ return null;
3869
+ 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$9, __assign({ className: "text-slate-500 font-bold text-lg" }, { children: priceListData.name })), jsxRuntime.jsxs(Text$9, __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$9, __assign({ style: { fontSize: "16px" }, className: "text-slate-500" }, { children: [priceListData.trialLengthDays, " day trial"] })), jsxRuntime.jsx(Text$9, __assign({ className: "text-slate-500", style: { fontSize: "12px" } }, { children: "You will not be charged until the last day of the trial." }))] }))] })) })) }));
3870
+ }
3871
+
3872
+ var BunnyFooterIcon = function (_a) {
3873
+ var color = _a.color;
3874
+ 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" }) })) })] })));
3875
+ };
3876
+
3877
+ var Footer = function (_a) {
3878
+ var className = _a.className;
3879
+ var _b = common.useCurrentUserData(), privacyUrl = _b.privacyUrl, termsUrl = _b.termsUrl;
3880
+ var window = React.useContext(BunnyContext).window;
3881
+ var isMobile = useIsMobile(window);
3882
+ var quotePreviewData = recoil.useRecoilValue(planPickerQuoteDataState);
3883
+ var selectedPriceList = quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.priceList;
3884
+ if (selectedPriceList && isMobile)
3885
+ return null;
3886
+ 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, {})] })));
3887
+ };
3888
+ var BunnyMarketingLink = function () {
3889
+ var _a = React.useState(false), isHovered = _a[0], setIsHovered = _a[1];
3890
+ var window = React.useContext(BunnyContext).window;
3891
+ var isMobile = useIsMobile(window);
3892
+ 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 }) }))] })) })) })));
3893
+ };
3894
+ var StyedLink = styled__default["default"].a(templateObject_1$4 || (templateObject_1$4 = __makeTemplateObject(["\n color: ", ";\n transition: color 0.3s;\n &:hover {\n color: ", ";\n }\n"], ["\n color: ", ";\n transition: color 0.3s;\n &:hover {\n color: ", ";\n }\n"])), common.SLATE_400, common.SLATE_500);
3895
+ 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);
3896
+ var templateObject_1$4, templateObject_2;
3897
+
3898
+ var showErrorNotification = common.NotificationUtils.useErrorNotification();
3899
+ function Signup(_a) {
3900
+ var priceListCode = _a.priceListCode, returnUrl = _a.returnUrl;
3901
+ // Hooks
3902
+ var _b = React.useContext(BunnyContext), subdomain = _b.subdomain, token = _b.token, window = _b.window;
3903
+ reactQuery.useQuery({
3904
+ queryKey: common.QueryKeyFactory.default.currentUserKey,
3905
+ queryFn: function () { return getCurrentUserData({ token: token, subdomain: subdomain }); },
3906
+ });
3907
+ var isMobile = useIsMobile(window);
3908
+ var topNavImageUrl = React.useContext(BrandContext).topNavImageUrl;
3909
+ var entityId = common.useCurrentUserData().entityId;
3910
+ var _c = React.useState(undefined), quote = _c[0], setQuote = _c[1];
3911
+ var _d = React.useState(undefined), accountId = _d[0], setAccountId = _d[1];
3912
+ var _e = React.useState(undefined), quoteId = _e[0], setQuoteId = _e[1];
3913
+ var _f = React.useState(undefined), formData = _f[0], setFormData = _f[1];
3914
+ var _g = React.useState(false), proceedingToPayment = _g[0], setProceedingToPayment = _g[1];
3915
+ var _h = React.useState(false), paying = _h[0], setIsPaying = _h[1];
3916
+ var _j = React.useState(false), purchaseSucceeded = _j[0], setPurchaseSucceeded = _j[1];
3917
+ // Queries
3918
+ var priceListData = reactQuery.useQuery({
3919
+ queryKey: ["priceList", priceListCode],
3920
+ queryFn: function () { return getPriceList({ token: token, subdomain: subdomain, code: priceListCode }); },
3921
+ }).data;
3922
+ function handleSubmit(formData) {
3923
+ return __awaiter(this, void 0, void 0, function () {
3924
+ var data;
3925
+ return __generator(this, function (_a) {
3926
+ switch (_a.label) {
3927
+ case 0:
3928
+ setProceedingToPayment(true);
3929
+ setFormData(formData);
3930
+ return [4 /*yield*/, quoteAccountSignup({
3931
+ token: token,
3932
+ subdomain: subdomain,
3933
+ entityId: entityId,
3934
+ priceListCode: priceListCode,
3935
+ accountName: formData.accountName,
3936
+ billingContact: {
3937
+ firstName: formData.firstName,
3938
+ lastName: formData.lastName,
3939
+ email: formData.email,
3940
+ },
3941
+ })];
3942
+ case 1:
3943
+ data = _a.sent();
3944
+ setAccountId(data.account.id);
3945
+ setQuoteId(data.quoteId);
3946
+ setProceedingToPayment(false);
3947
+ setQuote({
3948
+ amountDue: data.amount,
3949
+ currencyId: data.currencyId,
3950
+ });
3951
+ return [2 /*return*/];
3952
+ }
3953
+ });
3954
+ });
3955
+ }
3956
+ function handlePaymentSaveSuccess(paymentSuccess) {
3957
+ var _a;
3958
+ return __awaiter(this, void 0, void 0, function () {
3959
+ var response, plugin;
3960
+ return __generator(this, function (_b) {
3961
+ switch (_b.label) {
3962
+ case 0:
3963
+ if (!formData) {
3964
+ throw new Error("Form data is required");
3965
+ }
3966
+ response = paymentSuccess.pluginPaymentResponse;
3967
+ plugin = response === null || response === void 0 ? void 0 : response.plugin;
3968
+ if (!(plugin === null || plugin === void 0 ? void 0 : plugin.id)) {
3969
+ throw new Error("Plugin ID is required");
3970
+ }
3971
+ if (!accountId) {
3972
+ throw new Error("Account ID is required");
3973
+ }
3974
+ return [4 /*yield*/, accountSignup({
3975
+ token: token,
3976
+ subdomain: subdomain,
3977
+ entityId: entityId,
3978
+ quoteId: quoteId,
3979
+ paymentMethodId: (_a = paymentSuccess.savedPaymentMethodResponse) === null || _a === void 0 ? void 0 : _a.paymentMethodId.toString(),
3980
+ pluginId: plugin.id.toString(),
3981
+ priceListCode: priceListCode,
3982
+ accountId: accountId,
3983
+ })];
3984
+ case 1:
3985
+ _b.sent();
3986
+ setIsPaying(false);
3987
+ setPurchaseSucceeded(true);
3988
+ return [2 /*return*/];
3989
+ }
3990
+ });
3991
+ });
3992
+ }
3993
+ function handlePaymentFail(error) {
3994
+ showErrorNotification(error.message);
3995
+ setIsPaying(false);
3996
+ }
3997
+ if (isMobile) {
3998
+ 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 || "" }) }))] }))) })));
3999
+ }
4000
+ else {
4001
+ 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, {})] }));
4002
+ }
4003
+ }
4004
+
3706
4005
  var StateTag = function (_a) {
3707
4006
  var state = _a.state;
3708
4007
  return jsxRuntime.jsx(antd.Tag, __assign({ color: getColor(state) }, { children: lodash.capitalize(lodash.startCase(state)) }));
@@ -3737,12 +4036,13 @@ var TransactionGridCell = styled__default["default"].div.withConfig({
3737
4036
  shouldForwardProp: function (prop) {
3738
4037
  return !["gridColumn", "padding", "right"].includes(prop);
3739
4038
  },
3740
- })(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);
3741
- var templateObject_1$4;
4039
+ })(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);
4040
+ var templateObject_1$3;
3742
4041
 
4042
+ var Text$8 = antd.Typography.Text;
3743
4043
  var TransactionDate = function (_a) {
3744
4044
  var date = _a.date;
3745
- return jsxRuntime.jsx("div", { children: common.Misc.formatDate(date) });
4045
+ return jsxRuntime.jsx(Text$8, __assign({ className: "text-sm" }, { children: common.Misc.formatDate(date) }));
3746
4046
  };
3747
4047
 
3748
4048
  var isInvoice = function (transaction) {
@@ -3757,8 +4057,15 @@ var TransactionRowTitle = function (_a) {
3757
4057
  return (jsxRuntime.jsx("span", __assign({ className: "text-slate-400", style: { fontSize: "11px" } }, { children: invoice.number })));
3758
4058
  };
3759
4059
 
4060
+ // TODO: delete
4061
+ var ArrowDownToLine = function (_a) {
4062
+ var className = _a.className, _b = _a.color, color = _b === void 0 ? common.SLATE_600 : _b;
4063
+ 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" })] })));
4064
+ };
4065
+
3760
4066
  var TransactionDownload = function (_a) {
3761
4067
  var transaction = _a.transaction, token = _a.token, subdomain = _a.subdomain;
4068
+ var darkMode = React.useContext(BunnyContext).darkMode;
3762
4069
  var downloadFile = common.useDownloadFile();
3763
4070
  var isMobile = common.useIsMobile();
3764
4071
  var isClickable = transaction.kind === "INVOICE";
@@ -3767,11 +4074,12 @@ var TransactionDownload = function (_a) {
3767
4074
  return (jsxRuntime.jsx("div", __assign({ onClick: function (e) {
3768
4075
  e.stopPropagation();
3769
4076
  downloadFile("".concat(subdomain, "/api/pdf/invoice/").concat(transaction.transactionableId), token);
3770
- } }, { children: jsxRuntime.jsx(common.ArrowDownToLine, { className: isMobile ? "" : "show-on-hover" }) })));
4077
+ } }, { children: jsxRuntime.jsx(ArrowDownToLine, { className: "".concat(isMobile ? "" : "show-on-hover"), color: darkMode ? common.WHITE : common.SLATE_600 }) })));
3771
4078
  };
3772
4079
 
4080
+ var Text$7 = antd.Typography.Text;
3773
4081
  var TransactionsEmptyState = function () {
3774
- return (jsxRuntime.jsx("div", __assign({ className: "flex justify-center p-4 text-base" }, { children: "There are no invoices" })));
4082
+ return (jsxRuntime.jsx(Text$7, __assign({ className: "flex justify-center p-4 text-base" }, { children: "There are no invoices" })));
3775
4083
  };
3776
4084
 
3777
4085
  var TransactionsListContext = React.createContext({});
@@ -3835,10 +4143,11 @@ var useGraphQLRequest = function () { return function (query, token, variables)
3835
4143
  });
3836
4144
  }); }; };
3837
4145
 
4146
+ var Text$6 = antd.Typography.Text;
3838
4147
  var TransactionsListDesktop = function (_a) {
3839
4148
  var transactions = _a.transactions, onTransactionClick = _a.onTransactionClick;
3840
4149
  var columns = React.useContext(TransactionsListContext).columns;
3841
- var _b = React.useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain;
4150
+ var _b = React.useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain, darkMode = _b.darkMode;
3842
4151
  var showAmount = columns.includes("amount");
3843
4152
  var showDateAndTitle = columns.includes("date-and-title");
3844
4153
  var showDownload = columns.includes("download");
@@ -3850,15 +4159,18 @@ var TransactionsListDesktop = function (_a) {
3850
4159
  return (jsxRuntime.jsxs("div", __assign({ className: "contents ".concat(isClickable && "cursor-pointer", " show-on-hover-container"), onClick: function () {
3851
4160
  onTransactionClick(transaction);
3852
4161
  }, style: {
3853
- backgroundColor: index % 2 === 0 ? "white" : "rgba(100, 116, 139, 0.04)",
3854
- } }, { 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("div", { 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: common.Misc.formatCurrency(transaction.transactionable.amount || transaction.amount, transaction.currencyId) })))] }), index));
4162
+ backgroundColor: index % 2 === 0
4163
+ ? "var(--row-background".concat(darkMode ? "-dark" : "", ")")
4164
+ : "var(--row-background-alternate".concat(darkMode ? "-dark" : "", ")"),
4165
+ } }, { 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$6, { 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$6, { children: common.Misc.formatCurrency(transaction.transactionable.amount || transaction.amount, transaction.currencyId) }) })))] }), index));
3855
4166
  });
3856
4167
  };
3857
4168
 
4169
+ var Text$5 = antd.Typography.Text;
3858
4170
  var TransactionsListMobile = function (_a) {
3859
4171
  var transactions = _a.transactions, onTransactionClick = _a.onTransactionClick;
3860
4172
  var columns = React.useContext(TransactionsListContext).columns;
3861
- var _b = React.useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain;
4173
+ var _b = React.useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain, darkMode = _b.darkMode;
3862
4174
  var showAmount = columns.includes("amount");
3863
4175
  var showDateAndTitle = columns.includes("date-and-title");
3864
4176
  var showDownload = columns.includes("download");
@@ -3870,8 +4182,10 @@ var TransactionsListMobile = function (_a) {
3870
4182
  return (jsxRuntime.jsxs("div", __assign({ className: "contents ".concat(isClickable && "cursor-pointer", " show-on-hover-container"), onClick: function () {
3871
4183
  onTransactionClick(transaction);
3872
4184
  }, style: {
3873
- backgroundColor: index % 2 === 0 ? "white" : "rgba(100, 116, 139, 0.04)",
3874
- } }, { 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("div", { 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("div", { children: "\u00B7" }), showAmount && (jsxRuntime.jsx("div", { children: common.Misc.formatCurrency(transaction.transactionable.amount, transaction.currencyId) }))] }))] })) }), showDownload && (jsxRuntime.jsx(TransactionGridCell, __assign({ right: true }, { children: jsxRuntime.jsx(TransactionDownload, { transaction: transaction, token: token, subdomain: subdomain }) })))] }), index));
4185
+ backgroundColor: index % 2 === 0
4186
+ ? "var(--row-background".concat(darkMode ? "-dark" : "", ")")
4187
+ : "var(--row-background-alternate".concat(darkMode ? "-dark" : "", ")"),
4188
+ } }, { 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$5, { 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$5, { children: "\u00B7" }), showAmount && (jsxRuntime.jsx(Text$5, { children: common.Misc.formatCurrency(transaction.transactionable.amount, transaction.currencyId) }))] }))] })) }), showDownload && (jsxRuntime.jsx(TransactionGridCell, __assign({ right: true }, { children: jsxRuntime.jsx(TransactionDownload, { transaction: transaction, token: token, subdomain: subdomain }) })))] }), index));
3875
4189
  });
3876
4190
  };
3877
4191
 
@@ -3893,6 +4207,7 @@ var getTransactions = function (filter, token, subdomain, kindsToShow) { return
3893
4207
  })];
3894
4208
  case 1:
3895
4209
  response = _d.sent();
4210
+ console.log("response", response);
3896
4211
  return [4 /*yield*/, response.json()];
3897
4212
  case 2:
3898
4213
  _a = _d.sent(), data = _a.data, errors = _a.errors;
@@ -3920,6 +4235,7 @@ var PageContent = function (_a) {
3920
4235
  return (jsxRuntime.jsx("div", __assign({ className: className, ref: pageContentRef, style: style }, { children: children })));
3921
4236
  };
3922
4237
 
4238
+ var Text$4 = antd.Typography.Text;
3923
4239
  var PageHeaderWithActions = function (_a) {
3924
4240
  var children = _a.children, title = _a.title;
3925
4241
  var isMobile = common.useIsMobile();
@@ -3928,11 +4244,12 @@ var PageHeaderWithActions = function (_a) {
3928
4244
  var PageSubTitle = function (_a) {
3929
4245
  var title = _a.title;
3930
4246
  var secondaryColor = React.useContext(BrandContext).secondaryColor;
3931
- return (jsxRuntime.jsx("div", __assign({ className: "shrink-0 font-medium", style: { color: secondaryColor } }, { children: title })));
4247
+ var darkMode = React.useContext(BunnyContext).darkMode;
4248
+ return (jsxRuntime.jsx(Text$4, __assign({ className: "shrink-0 font-medium", style: { color: darkMode ? undefined : secondaryColor } }, { children: title })));
3932
4249
  };
3933
4250
 
3934
4251
  function ActualTransactions() {
3935
- var _a = React.useContext(TransactionsListContext), showSearchBar = _a.showSearchBar, showTitle = _a.showTitle, transactionComponent = _a.transactionComponent, useModal = _a.useModal, onTransactionClick = _a.onTransactionClick, suppressTransactionDisplay = _a.suppressTransactionDisplay, kindsToShow = _a.kindsToShow, className = _a.className, shadow = _a.shadow, searchBarClassName = _a.searchBarClassName;
4252
+ var _a = React.useContext(TransactionsListContext), showSearchBar = _a.showSearchBar, showTitle = _a.showTitle, transactionComponent = _a.transactionComponent, useModal = _a.useModal, onTransactionClick = _a.onTransactionClick, suppressTransactionDisplay = _a.suppressTransactionDisplay, kindsToShow = _a.kindsToShow, className = _a.className, shadow = _a.shadow; _a.searchBarClassName; var style = _a.style;
3936
4253
  // Context
3937
4254
  var columns = React.useContext(TransactionsListContext).columns;
3938
4255
  var _b = React.useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain;
@@ -3993,16 +4310,26 @@ function ActualTransactions() {
3993
4310
  }
3994
4311
  return templateColumns.join(" ");
3995
4312
  };
3996
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(PageHeaderWithActions, __assign({ title: showTitle ? "Past transactions" : undefined }, { children: showSearchBar && (jsxRuntime.jsx("div", { children: jsxRuntime.jsx(antd.Input, { className: searchBarClassName
3997
- ? searchBarClassName
3998
- : "bg-white border border-slate-200", onChange: function (e) {
4313
+ return (jsxRuntime.jsxs("div", __assign({ style: style }, { children: [jsxRuntime.jsx(PageHeaderWithActions, __assign({ title: showTitle ? "Past transactions" : undefined }, { children: showSearchBar && (jsxRuntime.jsx("div", { children: jsxRuntime.jsx(antd.Input
4314
+ // className={
4315
+ // searchBarClassName
4316
+ // ? searchBarClassName
4317
+ // : "border border-slate-200"
4318
+ // }
4319
+ , {
4320
+ // className={
4321
+ // searchBarClassName
4322
+ // ? searchBarClassName
4323
+ // : "border border-slate-200"
4324
+ // }
4325
+ onChange: function (e) {
3999
4326
  if (isNaN(Number(e.target.value))) {
4000
4327
  return;
4001
4328
  }
4002
4329
  setSearch(e.target.value);
4003
4330
  }, prefix: jsxRuntime.jsx(SearchOutlined$1, {}), placeholder: "Search by id #", style: {
4004
4331
  minWidth: "300px",
4005
- }, 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 bg-white rounded-md overflow-auto ".concat("shadow-".concat(shadow)), style: {
4332
+ }, 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: {
4006
4333
  gridTemplateColumns: gridTemplateColumns(),
4007
4334
  } }, { children: isMobile ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: TransactionsListMobile({
4008
4335
  transactions: transactions,
@@ -4010,7 +4337,7 @@ function ActualTransactions() {
4010
4337
  }) })) : (jsxRuntime.jsx(jsxRuntime.Fragment, { children: TransactionsListDesktop({
4011
4338
  transactions: transactions,
4012
4339
  onTransactionClick: handleTransactionClick,
4013
- }) })) })) })), 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: "Invoice", 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.jsx("div", { children: "Not an invoice, or no transaction selected" })) })))] }));
4340
+ }) })) })) })), 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: "Invoice", 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.jsx("div", { children: "Not an invoice, or no transaction selected" })) })))] })));
4014
4341
  }
4015
4342
  // Create a client
4016
4343
  var queryClient = new reactQuery.QueryClient();
@@ -4020,7 +4347,7 @@ function Transactions(_a) {
4020
4347
  common.TransactionKind.PAYMENT,
4021
4348
  common.TransactionKind.REFUND,
4022
4349
  common.TransactionKind.WRITE_OFF,
4023
- ] : _h;
4350
+ ] : _h, style = _a.style;
4024
4351
  var contextValues = {
4025
4352
  showSearchBar: showSearchBar,
4026
4353
  showTitle: showTitle,
@@ -4033,6 +4360,7 @@ function Transactions(_a) {
4033
4360
  onTransactionClick: onTransactionClick,
4034
4361
  suppressTransactionDisplay: suppressTransactionDisplay,
4035
4362
  kindsToShow: kindsToShow,
4363
+ style: style,
4036
4364
  };
4037
4365
  return (jsxRuntime.jsx(reactQuery.QueryClientProvider, __assign({ client: queryClient }, { children: jsxRuntime.jsx(TransactionsListContext.Provider, __assign({ value: contextValues }, { children: jsxRuntime.jsx(ActualTransactions, {}) })) })));
4038
4366
  }
@@ -4498,29 +4826,7 @@ var ErrorView = function (_a) {
4498
4826
  return (jsxRuntime.jsxs("div", __assign({ className: "flex flex-col w-full", style: { marginTop: "80px" } }, { children: [jsxRuntime.jsx("div", __assign({ style: { fontSize: "32px" } }, { children: message })), children] })));
4499
4827
  };
4500
4828
 
4501
- var BunnyFooterIcon = function (_a) {
4502
- var color = _a.color;
4503
- 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" }) })) })] })));
4504
- };
4505
-
4506
- var Footer = function () {
4507
- var _a = common.useCurrentUserData(), privacyUrl = _a.privacyUrl, termsUrl = _a.termsUrl;
4508
- var isMobile = common.useIsMobile();
4509
- var quotePreviewData = recoil.useRecoilValue(planPickerQuoteDataState);
4510
- var selectedPriceList = quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.priceList;
4511
- if (selectedPriceList && isMobile)
4512
- return null;
4513
- return (jsxRuntime.jsxs("div", __assign({ className: "flex items-center justify-between shrink-0 ".concat(isMobile ? "flex-col gap-2 grow" : "px-12") }, { 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, {})] })));
4514
- };
4515
- var BunnyMarketingLink = function () {
4516
- var _a = React.useState(false), isHovered = _a[0], setIsHovered = _a[1];
4517
- var isMobile = common.useIsMobile();
4518
- 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 }) }))] })) })) })));
4519
- };
4520
- 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);
4521
- 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);
4522
- var templateObject_1$3, templateObject_2;
4523
-
4829
+ var Text$3 = antd.Typography.Text;
4524
4830
  var HideExpiredToggle = function (_a) {
4525
4831
  var hideExpired = _a.hideExpired, setHideExpired = _a.setHideExpired, subscriptions = _a.subscriptions;
4526
4832
  var isMobile = common.useIsMobile();
@@ -4534,16 +4840,11 @@ var HideExpiredToggle = function (_a) {
4534
4840
  return null;
4535
4841
  return (jsxRuntime.jsxs("div", __assign({ className: "flex items-center gap-4 pl-4" }, { children: [!isMobile && jsxRuntime.jsx(antd.Divider, { className: "h-5", type: "vertical" }), jsxRuntime.jsx(StyledCheckbox, { children: jsxRuntime.jsx(antd.Checkbox, __assign({ checked: hideExpired, onChange: function (e) { return setHideExpired(e.target.checked); }, style: {
4536
4842
  color: secondaryColor,
4537
- } }, { children: isMobile ? "Hide inactive" : "Hide inactive subscriptions" })) })] })));
4843
+ } }, { children: jsxRuntime.jsx(Text$3, { children: isMobile ? "Hide inactive" : "Hide inactive subscriptions" }) })) })] })));
4538
4844
  };
4539
4845
  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"])));
4540
4846
  var templateObject_1$2;
4541
4847
 
4542
- var SubscriptionsListCell = function (_a) {
4543
- var children = _a.children, className = _a.className, gridColumn = _a.gridColumn, right = _a.right, style = _a.style;
4544
- return (jsxRuntime.jsx("div", __assign({ className: "flex items-center text-sm whitespace-nowrap ".concat(className), style: __assign({ gridColumn: gridColumn, textAlign: right ? "right" : "left", justifyContent: right ? "flex-end" : "flex-start" }, style) }, { children: children })));
4545
- };
4546
-
4547
4848
  var SubscriptionState;
4548
4849
  (function (SubscriptionState) {
4549
4850
  SubscriptionState["ACTIVE"] = "ACTIVE";
@@ -4554,195 +4855,20 @@ var SubscriptionState;
4554
4855
  })(SubscriptionState || (SubscriptionState = {}));
4555
4856
  var SubscriptionState$1 = SubscriptionState;
4556
4857
 
4557
- var Card = function (_a) {
4558
- var children = _a.children, className = _a.className;
4559
- return (jsxRuntime.jsx("div", __assign({ className: "flex flex-col bg-white rounded-md shadow-md ".concat(className) }, { children: children })));
4560
- };
4561
-
4562
- 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";
4563
- var getGuoteSubscriptionReinstate = function (_a) {
4564
- var ids = _a.ids, token = _a.token, subdomain = _a.subdomain;
4858
+ 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";
4859
+ var getFeatureUsage = function (_a) {
4860
+ var subscriptionChargeId = _a.subscriptionChargeId; _a.startDate; _a.endDate; _a.dataInterval; var token = _a.token;
4565
4861
  return __awaiter(void 0, void 0, void 0, function () {
4566
- var vars, response, _b, errors, quote;
4862
+ var vars, response;
4863
+ var _b;
4567
4864
  return __generator(this, function (_c) {
4568
4865
  switch (_c.label) {
4569
4866
  case 0:
4570
- vars = { ids: ids };
4867
+ vars = {
4868
+ id: subscriptionChargeId,
4869
+ };
4571
4870
  return [4 /*yield*/, common.gqlRequest({
4572
- query: MUTATION,
4573
- token: token,
4574
- vars: vars,
4575
- subdomain: subdomain,
4576
- })];
4577
- case 1:
4578
- response = _c.sent();
4579
- _b = response === null || response === void 0 ? void 0 : response.quoteSubscriptionReinstate, errors = _b.errors, quote = _b.quote;
4580
- if (errors)
4581
- throw errors;
4582
- return [2 /*return*/, quote];
4583
- }
4584
- });
4585
- });
4586
- };
4587
-
4588
- var useCancelSubscription = function () {
4589
- var graphQLRequest = useGraphQLRequest();
4590
- return function (subscriptionIds, token) { return __awaiter(void 0, void 0, void 0, function () {
4591
- var data;
4592
- var _a;
4593
- return __generator(this, function (_b) {
4594
- switch (_b.label) {
4595
- 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 })];
4596
- case 1:
4597
- data = _b.sent();
4598
- return [2 /*return*/, (_a = data === null || data === void 0 ? void 0 : data.subscriptions) === null || _a === void 0 ? void 0 : _a.nodes];
4599
- }
4600
- });
4601
- }); };
4602
- };
4603
-
4604
- var SubscriptionCardActions = function (_a) {
4605
- var _b, _c;
4606
- var planChangeOptions = _a.planChangeOptions, subscription = _a.subscription, setEditingQuoteData = _a.setEditingQuoteData, setPayModalVisible = _a.setPayModalVisible;
4607
- // Context
4608
- var _d = React.useContext(BunnyContext), token = _d.token, subdomain = _d.subdomain;
4609
- var _e = React.useContext(SubscriptionsContext), onChangePlanClick = _e.onChangePlanClick, onClickUpgrade = _e.onClickUpgrade, isTempViewOnly = _e.isTempViewOnly;
4610
- // Hooks
4611
- var showSuccessNotification = common.NotificationUtils.useSuccessNotification();
4612
- var cancelSubscription = useCancelSubscription();
4613
- var queryClient = reactQuery.useQueryClient();
4614
- // const navigate = usePortalNavigate();
4615
- // const handleUpgradingSubscriptionChange =
4616
- // useHandleUpgradingSubscriptionChange();
4617
- // Derived state
4618
- var canShowCancelButton = subscription.plan.selfServiceCancel;
4619
- 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; });
4620
- var canShowChangePlanButton = ((productPlans === null || productPlans === void 0 ? void 0 : productPlans.length) || 0) > 0;
4621
- // Mutations
4622
- var subscriptionCancel = reactQuery.useMutation({
4623
- mutationFn: function () { return cancelSubscription([subscription.id], token); },
4624
- onSuccess: function () {
4625
- queryClient.invalidateQueries({
4626
- queryKey: common.QueryKeyFactory.default.createTableKey("subscriptions"),
4627
- });
4628
- showSuccessNotification("Subscription canceled");
4629
- },
4630
- });
4631
- reactQuery.useMutation({
4632
- mutationFn: function () {
4633
- return getGuoteSubscriptionReinstate({
4634
- ids: [subscription.id],
4635
- token: token,
4636
- subdomain: subdomain,
4637
- });
4638
- },
4639
- onSuccess: function (quote) {
4640
- setEditingQuoteData({ id: quote.id, isTrial: false });
4641
- setPayModalVisible(true);
4642
- },
4643
- });
4644
- // Handlers
4645
- var handleChangePlanClick = function () {
4646
- // handleUpgradingSubscriptionChange({
4647
- // subscription,
4648
- // });
4649
- console.log("handleChangePlanClick handleUpgradingSubscriptionChange not implemented");
4650
- // navigate("plan-manager", {
4651
- // subscriptionUpgradeId: subscription.id,
4652
- // });
4653
- onChangePlanClick();
4654
- };
4655
- return (canShowChangePlanButton || canShowCancelButton) &&
4656
- 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 () {
4657
- // handleUpgradingSubscriptionChange({
4658
- // subscription,
4659
- // });
4660
- console.log("onClickUpgrade handleUpgradingSubscriptionChange not implemented");
4661
- // navigate("plan-manager", {
4662
- // subscriptionUpgradeId: subscription.id,
4663
- // });
4664
- onClickUpgrade();
4665
- }, type: "primary" }, { children: "Upgrade" }))) })) : null;
4666
- };
4667
-
4668
- var getSubscriptionStatusText = function (subscription) {
4669
- var cancellationDate = subscription.cancellationDate, state = subscription.state, evergreen = subscription.evergreen, endDate = subscription.endDate;
4670
- if (cancellationDate &&
4671
- (state === null || state === void 0 ? void 0 : state.toUpperCase()) !== common.SubscriptionState.CANCELED &&
4672
- (state === null || state === void 0 ? void 0 : state.toUpperCase()) !== common.SubscriptionState.EXPIRED) {
4673
- return (jsxRuntime.jsxs(antd.Tag, __assign({ color: "red" }, { children: ["Canceled - ends on ", common.Misc.formatDate(cancellationDate)] })));
4674
- }
4675
- if (evergreen) {
4676
- return "Renews on ".concat(common.Misc.formatDate(endDate));
4677
- }
4678
- if ((state === null || state === void 0 ? void 0 : state.toUpperCase()) === common.SubscriptionState.CANCELED ||
4679
- (state === null || state === void 0 ? void 0 : state.toUpperCase()) === common.SubscriptionState.EXPIRED) {
4680
- return "Ended on ".concat(common.Misc.formatDate(endDate));
4681
- }
4682
- return "Ends on ".concat(common.Misc.formatDate(endDate));
4683
- };
4684
- var SubscriptionCardHeader = function (_a) {
4685
- var _b, _c, _d, _e, _f;
4686
- var planChangeOptions = _a.planChangeOptions, setEditingQuoteData = _a.setEditingQuoteData, setPayModalVisible = _a.setPayModalVisible, subscription = _a.subscription;
4687
- var isMobile = common.useIsMobile();
4688
- // Derived state
4689
- var trialDaysLeft = dayjs(subscription.trialEndDate).diff(dayjs(), "days");
4690
- var isTrial = ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === common.SubscriptionState.TRIAL;
4691
- return (jsxRuntime.jsxs("div", __assign({ className: "flex items-center justify-between" }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex flex-col gap-2" }, { children: [((_c = subscription === null || subscription === void 0 ? void 0 : subscription.product) === null || _c === void 0 ? void 0 : _c.name) && (jsxRuntime.jsx("div", __assign({ className: "font-medium text-orange-500", style: { fontSize: "11px" } }, { children: (_d = subscription.product.name) === null || _d === void 0 ? void 0 : _d.toUpperCase() }))), jsxRuntime.jsxs("div", __assign({ className: "flex grow items-center gap-2" }, { children: [((_e = subscription === null || subscription === void 0 ? void 0 : subscription.plan) === null || _e === void 0 ? void 0 : _e.name) && (jsxRuntime.jsx("span", __assign({ className: "text-lg" }, { children: subscription.plan.name }))), jsxRuntime.jsxs(antd.Tag, __assign({ className: "ant-tag-".concat(common.TAG_COLORS[(_f = subscription.state) === null || _f === void 0 ? void 0 : _f.toUpperCase()]) }, { children: [lodash.capitalize(subscription.state.toLowerCase()), isTrial ? " (".concat(trialDaysLeft, " days left)") : ""] }))] }))] })), jsxRuntime.jsxs("div", __assign({ className: "flex items-center gap-6" }, { children: [jsxRuntime.jsx("div", __assign({ className: "grow text-xs" }, { children: getSubscriptionStatusText(subscription) })), !isMobile && (jsxRuntime.jsx(SubscriptionCardActions, { planChangeOptions: planChangeOptions, subscription: subscription, setEditingQuoteData: setEditingQuoteData, setPayModalVisible: setPayModalVisible }))] }))] })));
4692
- };
4693
-
4694
- var SubscriptionCardColumnHeaders = function (_a) {
4695
- var columns = _a.columns;
4696
- 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)); });
4697
- };
4698
-
4699
- var BillingPeriodConverter;
4700
- (function (BillingPeriodConverter) {
4701
- BillingPeriodConverter["ONCE"] = "once";
4702
- BillingPeriodConverter["MONTHLY"] = "monthly";
4703
- BillingPeriodConverter["ANNUAL"] = "annually";
4704
- BillingPeriodConverter["SEMI_ANNUAL"] = "semi annually";
4705
- BillingPeriodConverter["QUARTERLY"] = "quarterly";
4706
- })(BillingPeriodConverter || (BillingPeriodConverter = {}));
4707
- var SubscriptionChargeTotal = function (_a) {
4708
- var charge = _a.charge, subscription = _a.subscription;
4709
- var isMobile = common.useIsMobile();
4710
- 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] }))] })));
4711
- };
4712
-
4713
- var SubscriptionChargeUnitPrice = function (_a) {
4714
- var _b, _c;
4715
- var charge = _a.charge, subscription = _a.subscription;
4716
- var _d = React.useState(false), showPriceTiers = _d[0], setShowPriceTiers = _d[1];
4717
- if ((_c = (_b = charge.priceListCharge) === null || _b === void 0 ? void 0 : _b.priceListChargeTiers) === null || _c === void 0 ? void 0 : _c.length) {
4718
- return (jsxRuntime.jsx(antd.Dropdown, __assign({ dropdownRender: function () {
4719
- var _a, _b;
4720
- return (jsxRuntime.jsx("div", __assign({ className: "flex flex-col rounded border border-solid border-slate-200 bg-white p-2" }, { children: jsxRuntime.jsx("div", __assign({ className: "grid grid-cols-2", style: { columnGap: "0.5rem" } }, { children: (_b = (_a = charge.priceListCharge) === null || _a === void 0 ? void 0 : _a.priceListChargeTiers) === null || _b === void 0 ? void 0 : _b.map(function (tier, index) {
4721
- var _a, _b, _c, _d, _e;
4722
- 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)
4723
- ? ((_e = (_d = charge.priceListCharge) === null || _d === void 0 ? void 0 : _d.priceListChargeTiers[index + 1]) === null || _e === void 0 ? void 0 : _e.starts) - 1
4724
- : "∞";
4725
- 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));
4726
- }) })) })));
4727
- }, 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" })) })));
4728
- }
4729
- return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: common.Misc.formatCurrency(charge.discountedPrice, subscription.currencyId) }));
4730
- };
4731
-
4732
- 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";
4733
- var getFeatureUsage = function (_a) {
4734
- var subscriptionChargeId = _a.subscriptionChargeId; _a.startDate; _a.endDate; _a.dataInterval; var token = _a.token;
4735
- return __awaiter(void 0, void 0, void 0, function () {
4736
- var vars, response;
4737
- var _b;
4738
- return __generator(this, function (_c) {
4739
- switch (_c.label) {
4740
- case 0:
4741
- vars = {
4742
- id: subscriptionChargeId,
4743
- };
4744
- return [4 /*yield*/, common.gqlRequest({
4745
- query: FEATURE_USAGE_MUTATION,
4871
+ query: FEATURE_USAGE_MUTATION,
4746
4872
  token: token,
4747
4873
  vars: vars,
4748
4874
  })];
@@ -4913,6 +5039,191 @@ var FeatureBarChart = function (_a) {
4913
5039
  var StyledBarChart = styled__default["default"](recharts.BarChart)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n .recharts-surface {\n overflow: visible;\n }\n"], ["\n .recharts-surface {\n overflow: visible;\n }\n"])));
4914
5040
  var templateObject_1;
4915
5041
 
5042
+ 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";
5043
+ var getGuoteSubscriptionReinstate = function (_a) {
5044
+ var ids = _a.ids, token = _a.token, subdomain = _a.subdomain;
5045
+ return __awaiter(void 0, void 0, void 0, function () {
5046
+ var vars, response, _b, errors, quote;
5047
+ return __generator(this, function (_c) {
5048
+ switch (_c.label) {
5049
+ case 0:
5050
+ vars = { ids: ids };
5051
+ return [4 /*yield*/, common.gqlRequest({
5052
+ query: MUTATION,
5053
+ token: token,
5054
+ vars: vars,
5055
+ subdomain: subdomain,
5056
+ })];
5057
+ case 1:
5058
+ response = _c.sent();
5059
+ _b = response === null || response === void 0 ? void 0 : response.quoteSubscriptionReinstate, errors = _b.errors, quote = _b.quote;
5060
+ if (errors)
5061
+ throw errors;
5062
+ return [2 /*return*/, quote];
5063
+ }
5064
+ });
5065
+ });
5066
+ };
5067
+
5068
+ var useCancelSubscription = function () {
5069
+ var graphQLRequest = useGraphQLRequest();
5070
+ return function (subscriptionIds, token) { return __awaiter(void 0, void 0, void 0, function () {
5071
+ var data;
5072
+ var _a;
5073
+ return __generator(this, function (_b) {
5074
+ switch (_b.label) {
5075
+ 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 })];
5076
+ case 1:
5077
+ data = _b.sent();
5078
+ return [2 /*return*/, (_a = data === null || data === void 0 ? void 0 : data.subscriptions) === null || _a === void 0 ? void 0 : _a.nodes];
5079
+ }
5080
+ });
5081
+ }); };
5082
+ };
5083
+
5084
+ var SubscriptionCardActions = function (_a) {
5085
+ var _b, _c;
5086
+ var planChangeOptions = _a.planChangeOptions, subscription = _a.subscription, setEditingQuoteData = _a.setEditingQuoteData, setPayModalVisible = _a.setPayModalVisible;
5087
+ // Context
5088
+ var _d = React.useContext(BunnyContext), token = _d.token, subdomain = _d.subdomain;
5089
+ var _e = React.useContext(SubscriptionsContext), onChangePlanClick = _e.onChangePlanClick, onClickUpgrade = _e.onClickUpgrade, isTempViewOnly = _e.isTempViewOnly;
5090
+ // Hooks
5091
+ var showSuccessNotification = common.NotificationUtils.useSuccessNotification();
5092
+ var cancelSubscription = useCancelSubscription();
5093
+ var queryClient = reactQuery.useQueryClient();
5094
+ // const navigate = usePortalNavigate();
5095
+ // const handleUpgradingSubscriptionChange =
5096
+ // useHandleUpgradingSubscriptionChange();
5097
+ // Derived state
5098
+ var canShowCancelButton = subscription.plan.selfServiceCancel;
5099
+ 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; });
5100
+ var canShowChangePlanButton = ((productPlans === null || productPlans === void 0 ? void 0 : productPlans.length) || 0) > 0;
5101
+ // Mutations
5102
+ var subscriptionCancel = reactQuery.useMutation({
5103
+ mutationFn: function () { return cancelSubscription([subscription.id], token); },
5104
+ onSuccess: function () {
5105
+ queryClient.invalidateQueries({
5106
+ queryKey: common.QueryKeyFactory.default.createTableKey("subscriptions"),
5107
+ });
5108
+ showSuccessNotification("Subscription canceled");
5109
+ },
5110
+ });
5111
+ reactQuery.useMutation({
5112
+ mutationFn: function () {
5113
+ return getGuoteSubscriptionReinstate({
5114
+ ids: [subscription.id],
5115
+ token: token,
5116
+ subdomain: subdomain,
5117
+ });
5118
+ },
5119
+ onSuccess: function (quote) {
5120
+ setEditingQuoteData({ id: quote.id, isTrial: false });
5121
+ setPayModalVisible(true);
5122
+ },
5123
+ });
5124
+ // Handlers
5125
+ var handleChangePlanClick = function () {
5126
+ // handleUpgradingSubscriptionChange({
5127
+ // subscription,
5128
+ // });
5129
+ console.log("handleChangePlanClick handleUpgradingSubscriptionChange not implemented");
5130
+ // navigate("plan-manager", {
5131
+ // subscriptionUpgradeId: subscription.id,
5132
+ // });
5133
+ onChangePlanClick();
5134
+ };
5135
+ return (canShowChangePlanButton || canShowCancelButton) &&
5136
+ 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 () {
5137
+ // handleUpgradingSubscriptionChange({
5138
+ // subscription,
5139
+ // });
5140
+ console.log("onClickUpgrade handleUpgradingSubscriptionChange not implemented");
5141
+ // navigate("plan-manager", {
5142
+ // subscriptionUpgradeId: subscription.id,
5143
+ // });
5144
+ onClickUpgrade();
5145
+ }, type: "primary" }, { children: "Upgrade" }))) })) : null;
5146
+ };
5147
+
5148
+ var Text$2 = antd.Typography.Text;
5149
+ var getSubscriptionStatusText = function (subscription) {
5150
+ var cancellationDate = subscription.cancellationDate, state = subscription.state, evergreen = subscription.evergreen, endDate = subscription.endDate;
5151
+ if (cancellationDate &&
5152
+ (state === null || state === void 0 ? void 0 : state.toUpperCase()) !== common.SubscriptionState.CANCELED &&
5153
+ (state === null || state === void 0 ? void 0 : state.toUpperCase()) !== common.SubscriptionState.EXPIRED) {
5154
+ return (jsxRuntime.jsxs(antd.Tag, __assign({ color: "red" }, { children: ["Canceled - ends on ", common.Misc.formatDate(cancellationDate)] })));
5155
+ }
5156
+ if (evergreen) {
5157
+ return "Renews on ".concat(common.Misc.formatDate(endDate));
5158
+ }
5159
+ if ((state === null || state === void 0 ? void 0 : state.toUpperCase()) === common.SubscriptionState.CANCELED ||
5160
+ (state === null || state === void 0 ? void 0 : state.toUpperCase()) === common.SubscriptionState.EXPIRED) {
5161
+ return "Ended on ".concat(common.Misc.formatDate(endDate));
5162
+ }
5163
+ return "Ends on ".concat(common.Misc.formatDate(endDate));
5164
+ };
5165
+ var SubscriptionCardHeader = function (_a) {
5166
+ var _b, _c, _d, _e, _f;
5167
+ var planChangeOptions = _a.planChangeOptions, setEditingQuoteData = _a.setEditingQuoteData, setPayModalVisible = _a.setPayModalVisible, subscription = _a.subscription;
5168
+ var darkMode = React.useContext(BunnyContext).darkMode;
5169
+ var isMobile = common.useIsMobile();
5170
+ // Derived state
5171
+ var trialDaysLeft = dayjs(subscription.trialEndDate).diff(dayjs(), "days");
5172
+ var isTrial = ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === common.SubscriptionState.TRIAL;
5173
+ return (jsxRuntime.jsxs("div", __assign({ className: "flex items-center justify-between", style: {
5174
+ backgroundColor: darkMode ? "var(--row-background-dark)" : "",
5175
+ } }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex flex-col gap-2" }, { children: [((_c = subscription === null || subscription === void 0 ? void 0 : subscription.product) === null || _c === void 0 ? void 0 : _c.name) && (jsxRuntime.jsx("div", __assign({ className: "font-medium text-orange-500", style: { fontSize: "11px" } }, { children: (_d = subscription.product.name) === null || _d === void 0 ? void 0 : _d.toUpperCase() }))), jsxRuntime.jsxs("div", __assign({ className: "flex grow items-center gap-2" }, { children: [((_e = subscription === null || subscription === void 0 ? void 0 : subscription.plan) === null || _e === void 0 ? void 0 : _e.name) && (jsxRuntime.jsx(Text$2, __assign({ className: "text-lg" }, { children: subscription.plan.name }))), jsxRuntime.jsxs(antd.Tag, __assign({ className: "ant-tag-".concat(common.TAG_COLORS[(_f = subscription.state) === null || _f === void 0 ? void 0 : _f.toUpperCase()]) }, { children: [lodash.capitalize(subscription.state.toLowerCase()), isTrial ? " (".concat(trialDaysLeft, " days left)") : ""] }))] }))] })), jsxRuntime.jsxs("div", __assign({ className: "flex items-center gap-6" }, { children: [jsxRuntime.jsx(Text$2, __assign({ className: "grow text-xs" }, { children: getSubscriptionStatusText(subscription) })), !isMobile && (jsxRuntime.jsx(SubscriptionCardActions, { planChangeOptions: planChangeOptions, subscription: subscription, setEditingQuoteData: setEditingQuoteData, setPayModalVisible: setPayModalVisible }))] }))] })));
5176
+ };
5177
+
5178
+ var BillingPeriodConverter;
5179
+ (function (BillingPeriodConverter) {
5180
+ BillingPeriodConverter["ONCE"] = "once";
5181
+ BillingPeriodConverter["MONTHLY"] = "monthly";
5182
+ BillingPeriodConverter["ANNUAL"] = "annually";
5183
+ BillingPeriodConverter["SEMI_ANNUAL"] = "semi annually";
5184
+ BillingPeriodConverter["QUARTERLY"] = "quarterly";
5185
+ })(BillingPeriodConverter || (BillingPeriodConverter = {}));
5186
+ var SubscriptionChargeTotal = function (_a) {
5187
+ var charge = _a.charge, subscription = _a.subscription;
5188
+ var isMobile = common.useIsMobile();
5189
+ 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] }))] })));
5190
+ };
5191
+
5192
+ var SubscriptionChargeUnitPrice = function (_a) {
5193
+ var _b, _c;
5194
+ var charge = _a.charge, subscription = _a.subscription;
5195
+ var darkMode = React.useContext(BunnyContext).darkMode;
5196
+ var _d = React.useState(false), showPriceTiers = _d[0], setShowPriceTiers = _d[1];
5197
+ if ((_c = (_b = charge.priceListCharge) === null || _b === void 0 ? void 0 : _b.priceListChargeTiers) === null || _c === void 0 ? void 0 : _c.length) {
5198
+ return (jsxRuntime.jsx(antd.Dropdown, __assign({ dropdownRender: function () {
5199
+ var _a, _b;
5200
+ return (jsxRuntime.jsx("div", __assign({ className: "flex flex-col rounded border border-solid border-slate-200 p-2", style: {
5201
+ backgroundColor: darkMode
5202
+ ? "var(--row-background-dark)"
5203
+ : "var(--row-background)",
5204
+ } }, { children: jsxRuntime.jsx("div", __assign({ className: "grid grid-cols-2", style: { columnGap: "0.5rem" } }, { children: (_b = (_a = charge.priceListCharge) === null || _a === void 0 ? void 0 : _a.priceListChargeTiers) === null || _b === void 0 ? void 0 : _b.map(function (tier, index) {
5205
+ var _a, _b, _c, _d, _e;
5206
+ 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)
5207
+ ? ((_e = (_d = charge.priceListCharge) === null || _d === void 0 ? void 0 : _d.priceListChargeTiers[index + 1]) === null || _e === void 0 ? void 0 : _e.starts) - 1
5208
+ : "∞";
5209
+ 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));
5210
+ }) })) })));
5211
+ }, 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" })) })));
5212
+ }
5213
+ return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: common.Misc.formatCurrency(charge.discountedPrice, subscription.currencyId) }));
5214
+ };
5215
+
5216
+ var SubscriptionCardColumnHeaders = function (_a) {
5217
+ var columns = _a.columns;
5218
+ 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)); });
5219
+ };
5220
+
5221
+ var Text$1 = antd.Typography.Text;
5222
+ var SubscriptionsListCell = function (_a) {
5223
+ var children = _a.children, className = _a.className, gridColumn = _a.gridColumn, right = _a.right, style = _a.style;
5224
+ return (jsxRuntime.jsx(Text$1, __assign({ className: "flex items-center text-sm whitespace-nowrap ".concat(className), style: __assign({ gridColumn: gridColumn, textAlign: right ? "right" : "left", justifyContent: right ? "flex-end" : "flex-start" }, style) }, { children: children })));
5225
+ };
5226
+
4916
5227
  var createCardColumns = function () { return [
4917
5228
  {
4918
5229
  title: "CHARGE",
@@ -4991,9 +5302,10 @@ var SubscriptionCardDesktopRow = function (_a) {
4991
5302
  : charge.quantity })), jsxRuntime.jsx(SubscriptionsListCell, __assign({ right: true }, { children: jsxRuntime.jsx(SubscriptionChargeUnitPrice, { charge: charge, subscription: subscription }) })), jsxRuntime.jsx(SubscriptionsListCell, __assign({ right: true }, { children: jsxRuntime.jsx(SubscriptionChargeTotal, { charge: charge, subscription: subscription }) }))] })));
4992
5303
  };
4993
5304
 
5305
+ var Text = antd.Typography.Text;
4994
5306
  var SubscriptionCardCellMobile = function (_a) {
4995
5307
  var children = _a.children, className = _a.className, style = _a.style;
4996
- return (jsxRuntime.jsx("div", __assign({ className: className, style: style }, { children: children })));
5308
+ return (jsxRuntime.jsx(Text, __assign({ className: className, style: style }, { children: children })));
4997
5309
  };
4998
5310
 
4999
5311
  var CHARGE_COLUMNS = [
@@ -5016,8 +5328,12 @@ var CHARGE_COLUMNS = [
5016
5328
  var SubscriptionCard = function (_a) {
5017
5329
  var _b;
5018
5330
  var planChangeOptions = _a.planChangeOptions, setEditingQuoteData = _a.setEditingQuoteData, setPayModalVisible = _a.setPayModalVisible, subscription = _a.subscription;
5331
+ var darkMode = React.useContext(BunnyContext).darkMode;
5019
5332
  // Derived state
5020
5333
  var isTrial = ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === SubscriptionState$1.TRIAL;
5334
+ var backgroundColor = darkMode
5335
+ ? "var(--row-background-dark)"
5336
+ : "var(--row-background)";
5021
5337
  return (jsxRuntime.jsx(Card, { children: jsxRuntime.jsxs("div", __assign({ className: "flex flex-col p-4" }, { children: [jsxRuntime.jsx(SubscriptionCardHeader, { planChangeOptions: planChangeOptions, setEditingQuoteData: setEditingQuoteData, setPayModalVisible: setPayModalVisible, subscription: subscription }), jsxRuntime.jsx(antd.Divider, { className: "my-4", style: {
5022
5338
  gridColumn: "1 / -1",
5023
5339
  width: "calc(100% + 32px)",
@@ -5026,6 +5342,7 @@ var SubscriptionCard = function (_a) {
5026
5342
  columnGap: "0.5rem",
5027
5343
  gridTemplateColumns: "1fr auto auto auto",
5028
5344
  rowGap: "0.75rem",
5345
+ backgroundColor: backgroundColor,
5029
5346
  } }, { children: [CHARGE_COLUMNS.map(function (subscriptionColumn, index) { return (jsxRuntime.jsx(SubscriptionCardCellMobile, __assign({ className: "text-slate-400 ".concat(subscriptionColumn.className), style: { fontSize: "11px" } }, { children: subscriptionColumn.title }), index)); }), subscription.charges.map(function (charge, chargeIndex) {
5030
5347
  if ((isTrial && !charge.trial) || (!isTrial && charge.trial))
5031
5348
  return null;
@@ -5173,6 +5490,7 @@ exports.Checkout = Checkout;
5173
5490
  exports.Invoice = Invoice;
5174
5491
  exports.PaymentMethod = PaymentMethod;
5175
5492
  exports.Quote = Quote;
5493
+ exports.Signup = Signup;
5176
5494
  exports.Subscriptions = Subscriptions;
5177
5495
  exports.Transactions = Transactions;
5178
5496
  exports.getQuoteAmountDue = getQuoteAmountDue;