@bunnyapp/components 1.0.6 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +1208 -1449
- package/dist/cjs/playground/main.d.ts +1 -1
- package/dist/cjs/src/ajax.d.ts +1 -0
- package/dist/cjs/src/components/BunnyProvider.d.ts +9 -5
- package/dist/cjs/src/components/Checkout/Checkout.d.ts +4 -2
- package/dist/cjs/src/components/Checkout/InvoiceCheckout.d.ts +2 -1
- package/dist/cjs/src/components/Checkout/QuoteCheckout.d.ts +2 -1
- package/dist/cjs/src/components/FeatureUsageGraph.d.ts +1 -1
- package/dist/cjs/src/components/Invoice/Invoice.d.ts +2 -2
- package/dist/cjs/src/components/Invoice/InvoiceQuoteView.d.ts +1 -2
- package/dist/cjs/src/components/LegacyInvoicePDF.d.ts +2 -2
- package/dist/cjs/src/components/PaymentForm/DemoPay/demoPayUtils.d.ts +1 -1
- package/dist/cjs/src/components/PaymentForm/Finix/FinixCardForm.d.ts +1 -1
- package/dist/cjs/src/components/PaymentForm/FinixAch.d.ts +1 -1
- package/dist/cjs/src/components/PaymentForm/PaymentForm.d.ts +1 -1
- package/dist/cjs/src/components/PaymentForm/PaymentFormTypes.d.ts +1 -0
- package/dist/cjs/src/components/PaymentForm/PaymentMethod/PaymentMethod.d.ts +2 -2
- package/dist/cjs/src/components/PaymentForm/PaymentMethod/PaymentMethodContext.d.ts +0 -1
- package/dist/cjs/src/components/PaymentForm/PaymentMethodForm.d.ts +1 -1
- package/dist/cjs/src/components/PaymentForm/Stripe/StripeForm.d.ts +1 -1
- package/dist/cjs/src/components/PaymentForm/Stripe/stripeUtils.d.ts +6 -6
- package/dist/cjs/src/components/PaymentForm/paymentUtils.d.ts +2 -2
- package/dist/cjs/src/components/Quote/Quote.d.ts +2 -2
- package/dist/cjs/src/components/Quotes/Quotes.d.ts +2 -1
- package/dist/cjs/src/components/Quotes/index.d.ts +1 -0
- package/dist/cjs/src/components/Signup/PaymentForms.d.ts +2 -2
- package/dist/cjs/src/components/Signup/PaymentSuccess.d.ts +4 -3
- package/dist/cjs/src/components/Signup/Signup.d.ts +3 -1
- package/dist/cjs/src/components/Subscriptions/Subscriptions.d.ts +4 -2
- package/dist/cjs/src/components/Subscriptions/subscriptionsList/SubscriptionsList.d.ts +1 -1
- package/dist/cjs/src/components/Subscriptions/subscriptionsList/subscriptionCardDesktop/SubscriptionCardColumnHeaders.d.ts +1 -1
- package/dist/cjs/src/components/Subscriptions/subscriptionsList/subscriptionUtils.d.ts +1 -2
- package/dist/cjs/src/components/Transactions/Transactions.d.ts +3 -1
- package/dist/cjs/src/components/Transactions/TransactionsListContext.d.ts +1 -0
- package/dist/cjs/src/components/Transactions/transactionsList/TransactionDownload.d.ts +2 -2
- package/dist/cjs/src/components/Transactions/transactionsList/TransactionsListDesktop.d.ts +1 -11
- package/dist/cjs/src/components/index.d.ts +1 -0
- package/dist/cjs/src/contexts/NavigationContext.d.ts +1 -1
- package/dist/cjs/src/graphql/mutations/accountSignup.d.ts +2 -2
- package/dist/cjs/src/graphql/mutations/accountUpdate.d.ts +2 -1
- package/dist/cjs/src/graphql/mutations/checkout.d.ts +2 -2
- package/dist/cjs/src/graphql/mutations/portalSessionCreate.d.ts +2 -2
- package/dist/cjs/src/graphql/mutations/quoteAccountSignup.d.ts +2 -2
- package/dist/cjs/src/graphql/mutations/quoteAddCoupon.d.ts +2 -1
- package/dist/cjs/src/graphql/mutations/quoteCompose.d.ts +2 -2
- package/dist/cjs/src/graphql/mutations/quoteCreate.d.ts +2 -2
- package/dist/cjs/src/graphql/mutations/quoteRecalculateTaxes.d.ts +2 -1
- package/dist/cjs/src/graphql/mutations/quoteSubscriptionReinstate.d.ts +2 -2
- package/dist/cjs/src/graphql/queries/getAccount.d.ts +2 -2
- package/dist/cjs/src/graphql/queries/getBranding.d.ts +2 -2
- package/dist/cjs/src/graphql/queries/getCurrentUserData.d.ts +2 -2
- package/dist/cjs/src/graphql/queries/getFeatureUsage.d.ts +2 -1
- package/dist/cjs/src/graphql/queries/getFormattedQuote.d.ts +2 -2
- package/dist/cjs/src/graphql/queries/getInvoice.d.ts +2 -2
- package/dist/cjs/src/graphql/queries/getPlanChangeOptions.d.ts +2 -2
- package/dist/cjs/src/graphql/queries/getPriceList.d.ts +2 -2
- package/dist/cjs/src/graphql/queries/getQuote.d.ts +2 -2
- package/dist/cjs/src/graphql/queries/getQuotes.d.ts +2 -2
- package/dist/cjs/src/graphql/queries/getSubscription.d.ts +2 -2
- package/dist/cjs/src/graphql/queries/getSubscriptions.d.ts +2 -2
- package/dist/cjs/src/graphql/queries/getTaxationRequiredAccountFields.d.ts +6 -0
- package/dist/cjs/src/graphql/queries/getTransactions.d.ts +1 -1
- package/dist/cjs/src/hooks/quotes/useSendAcceptQuote.d.ts +7 -1
- package/dist/cjs/src/hooks/useHasTaxPlugin.d.ts +3 -2
- package/dist/cjs/src/hooks/usePaymentPlugins.d.ts +11 -0
- package/dist/cjs/src/hooks/usePlugins.d.ts +6 -0
- package/dist/cjs/src/hooks/useSigningPlugins.d.ts +5 -1
- package/dist/cjs/src/index.d.ts +1 -0
- package/dist/cjs/src/utils/GraphQLClient.d.ts +2 -0
- package/dist/cjs/src/utils/quoteInvoiceUtils.d.ts +6 -0
- package/dist/esm/index.js +1214 -1455
- package/dist/esm/playground/main.d.ts +1 -1
- package/dist/esm/src/ajax.d.ts +1 -0
- package/dist/esm/src/components/BunnyProvider.d.ts +9 -5
- package/dist/esm/src/components/Checkout/Checkout.d.ts +4 -2
- package/dist/esm/src/components/Checkout/InvoiceCheckout.d.ts +2 -1
- package/dist/esm/src/components/Checkout/QuoteCheckout.d.ts +2 -1
- package/dist/esm/src/components/FeatureUsageGraph.d.ts +1 -1
- package/dist/esm/src/components/Invoice/Invoice.d.ts +2 -2
- package/dist/esm/src/components/Invoice/InvoiceQuoteView.d.ts +1 -2
- package/dist/esm/src/components/LegacyInvoicePDF.d.ts +2 -2
- package/dist/esm/src/components/PaymentForm/DemoPay/demoPayUtils.d.ts +1 -1
- package/dist/esm/src/components/PaymentForm/Finix/FinixCardForm.d.ts +1 -1
- package/dist/esm/src/components/PaymentForm/FinixAch.d.ts +1 -1
- package/dist/esm/src/components/PaymentForm/PaymentForm.d.ts +1 -1
- package/dist/esm/src/components/PaymentForm/PaymentFormTypes.d.ts +1 -0
- package/dist/esm/src/components/PaymentForm/PaymentMethod/PaymentMethod.d.ts +2 -2
- package/dist/esm/src/components/PaymentForm/PaymentMethod/PaymentMethodContext.d.ts +0 -1
- package/dist/esm/src/components/PaymentForm/PaymentMethodForm.d.ts +1 -1
- package/dist/esm/src/components/PaymentForm/Stripe/StripeForm.d.ts +1 -1
- package/dist/esm/src/components/PaymentForm/Stripe/stripeUtils.d.ts +6 -6
- package/dist/esm/src/components/PaymentForm/paymentUtils.d.ts +2 -2
- package/dist/esm/src/components/Quote/Quote.d.ts +2 -2
- package/dist/esm/src/components/Quotes/Quotes.d.ts +2 -1
- package/dist/esm/src/components/Quotes/index.d.ts +1 -0
- package/dist/esm/src/components/Signup/PaymentForms.d.ts +2 -2
- package/dist/esm/src/components/Signup/PaymentSuccess.d.ts +4 -3
- package/dist/esm/src/components/Signup/Signup.d.ts +3 -1
- package/dist/esm/src/components/Subscriptions/Subscriptions.d.ts +4 -2
- package/dist/esm/src/components/Subscriptions/subscriptionsList/SubscriptionsList.d.ts +1 -1
- package/dist/esm/src/components/Subscriptions/subscriptionsList/subscriptionCardDesktop/SubscriptionCardColumnHeaders.d.ts +1 -1
- package/dist/esm/src/components/Subscriptions/subscriptionsList/subscriptionUtils.d.ts +1 -2
- package/dist/esm/src/components/Transactions/Transactions.d.ts +3 -1
- package/dist/esm/src/components/Transactions/TransactionsListContext.d.ts +1 -0
- package/dist/esm/src/components/Transactions/transactionsList/TransactionDownload.d.ts +2 -2
- package/dist/esm/src/components/Transactions/transactionsList/TransactionsListDesktop.d.ts +1 -11
- package/dist/esm/src/components/index.d.ts +1 -0
- package/dist/esm/src/contexts/NavigationContext.d.ts +1 -1
- package/dist/esm/src/graphql/mutations/accountSignup.d.ts +2 -2
- package/dist/esm/src/graphql/mutations/accountUpdate.d.ts +2 -1
- package/dist/esm/src/graphql/mutations/checkout.d.ts +2 -2
- package/dist/esm/src/graphql/mutations/portalSessionCreate.d.ts +2 -2
- package/dist/esm/src/graphql/mutations/quoteAccountSignup.d.ts +2 -2
- package/dist/esm/src/graphql/mutations/quoteAddCoupon.d.ts +2 -1
- package/dist/esm/src/graphql/mutations/quoteCompose.d.ts +2 -2
- package/dist/esm/src/graphql/mutations/quoteCreate.d.ts +2 -2
- package/dist/esm/src/graphql/mutations/quoteRecalculateTaxes.d.ts +2 -1
- package/dist/esm/src/graphql/mutations/quoteSubscriptionReinstate.d.ts +2 -2
- package/dist/esm/src/graphql/queries/getAccount.d.ts +2 -2
- package/dist/esm/src/graphql/queries/getBranding.d.ts +2 -2
- package/dist/esm/src/graphql/queries/getCurrentUserData.d.ts +2 -2
- package/dist/esm/src/graphql/queries/getFeatureUsage.d.ts +2 -1
- package/dist/esm/src/graphql/queries/getFormattedQuote.d.ts +2 -2
- package/dist/esm/src/graphql/queries/getInvoice.d.ts +2 -2
- package/dist/esm/src/graphql/queries/getPlanChangeOptions.d.ts +2 -2
- package/dist/esm/src/graphql/queries/getPriceList.d.ts +2 -2
- package/dist/esm/src/graphql/queries/getQuote.d.ts +2 -2
- package/dist/esm/src/graphql/queries/getQuotes.d.ts +2 -2
- package/dist/esm/src/graphql/queries/getSubscription.d.ts +2 -2
- package/dist/esm/src/graphql/queries/getSubscriptions.d.ts +2 -2
- package/dist/esm/src/graphql/queries/getTaxationRequiredAccountFields.d.ts +6 -0
- package/dist/esm/src/graphql/queries/getTransactions.d.ts +1 -1
- package/dist/esm/src/hooks/quotes/useSendAcceptQuote.d.ts +7 -1
- package/dist/esm/src/hooks/useHasTaxPlugin.d.ts +3 -2
- package/dist/esm/src/hooks/usePaymentPlugins.d.ts +11 -0
- package/dist/esm/src/hooks/usePlugins.d.ts +6 -0
- package/dist/esm/src/hooks/useSigningPlugins.d.ts +5 -1
- package/dist/esm/src/index.d.ts +1 -0
- package/dist/esm/src/utils/GraphQLClient.d.ts +2 -0
- package/dist/esm/src/utils/quoteInvoiceUtils.d.ts +6 -0
- package/dist/index.d.ts +58 -15
- package/package.json +10 -7
- package/dist/cjs/src/atoms/pageContentRefAtom.d.ts +0 -1
- package/dist/cjs/src/atoms/planPickerQuoteDataAtom.d.ts +0 -2
- package/dist/cjs/src/atoms/updatingChargeQuantityIdAtom.d.ts +0 -2
- package/dist/cjs/src/components/Footer.d.ts +0 -4
- package/dist/cjs/src/components/PageContent.d.ts +0 -7
- package/dist/cjs/src/features/quantityChangeDrawer/QuantityChangeGridRow.d.ts +0 -11
- package/dist/cjs/src/features/quantityChangeDrawer/QuantityChangeGridTitle.d.ts +0 -6
- package/dist/cjs/src/features/quantityChangeDrawer/QuantityInput.d.ts +0 -21
- package/dist/cjs/src/features/quantityChangeDrawer/QuoteChangeSummarySection.d.ts +0 -9
- package/dist/cjs/src/features/quantityChangeDrawer/quantityChangeDrawerDesktop/QuantityChangeDrawerDesktop.d.ts +0 -14
- package/dist/cjs/src/graphql/QuoteRequests.d.ts +0 -6
- package/dist/cjs/src/graphql/SubscriptionRequests.d.ts +0 -2
- package/dist/cjs/src/graphql/queries/getFormattedInvoice.d.ts +0 -7
- package/dist/cjs/src/hooks/useCurrentUserData.d.ts +0 -2
- package/dist/cjs/src/hooks/useIsMobile.d.ts +0 -10
- package/dist/cjs/src/utils.d.ts +0 -9
- package/dist/esm/src/atoms/pageContentRefAtom.d.ts +0 -1
- package/dist/esm/src/atoms/planPickerQuoteDataAtom.d.ts +0 -2
- package/dist/esm/src/atoms/updatingChargeQuantityIdAtom.d.ts +0 -2
- package/dist/esm/src/components/Footer.d.ts +0 -4
- package/dist/esm/src/components/PageContent.d.ts +0 -7
- package/dist/esm/src/features/quantityChangeDrawer/QuantityChangeGridRow.d.ts +0 -11
- package/dist/esm/src/features/quantityChangeDrawer/QuantityChangeGridTitle.d.ts +0 -6
- package/dist/esm/src/features/quantityChangeDrawer/QuantityInput.d.ts +0 -21
- package/dist/esm/src/features/quantityChangeDrawer/QuoteChangeSummarySection.d.ts +0 -9
- package/dist/esm/src/features/quantityChangeDrawer/quantityChangeDrawerDesktop/QuantityChangeDrawerDesktop.d.ts +0 -14
- package/dist/esm/src/graphql/QuoteRequests.d.ts +0 -6
- package/dist/esm/src/graphql/SubscriptionRequests.d.ts +0 -2
- package/dist/esm/src/graphql/queries/getFormattedInvoice.d.ts +0 -7
- package/dist/esm/src/hooks/useCurrentUserData.d.ts +0 -2
- package/dist/esm/src/hooks/useIsMobile.d.ts +0 -10
- package/dist/esm/src/utils.d.ts +0 -9
package/dist/cjs/index.js
CHANGED
|
@@ -9,13 +9,13 @@ var antd = require('antd');
|
|
|
9
9
|
var styled = require('styled-components');
|
|
10
10
|
var common = require('@bunnyapp/common');
|
|
11
11
|
var reactQuery = require('@tanstack/react-query');
|
|
12
|
-
var recoil = require('recoil');
|
|
13
12
|
var theme = require('antd/lib/theme');
|
|
13
|
+
var recoil = require('recoil');
|
|
14
|
+
var graphqlRequest = import('graphql-request');
|
|
14
15
|
var reactHelmetAsync = require('react-helmet-async');
|
|
15
16
|
var reactStripeJs = require('@stripe/react-stripe-js');
|
|
16
17
|
var pure = require('@stripe/stripe-js/pure');
|
|
17
18
|
var lodash = require('lodash');
|
|
18
|
-
var request = import('graphql-request');
|
|
19
19
|
var recharts = require('recharts');
|
|
20
20
|
|
|
21
21
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -42,7 +42,36 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
42
42
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
43
43
|
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
44
44
|
var theme__default = /*#__PURE__*/_interopDefaultLegacy(theme);
|
|
45
|
-
|
|
45
|
+
|
|
46
|
+
function styleInject(css, ref) {
|
|
47
|
+
if ( ref === void 0 ) ref = {};
|
|
48
|
+
var insertAt = ref.insertAt;
|
|
49
|
+
|
|
50
|
+
if (!css || typeof document === 'undefined') { return; }
|
|
51
|
+
|
|
52
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
|
53
|
+
var style = document.createElement('style');
|
|
54
|
+
style.type = 'text/css';
|
|
55
|
+
|
|
56
|
+
if (insertAt === 'top') {
|
|
57
|
+
if (head.firstChild) {
|
|
58
|
+
head.insertBefore(style, head.firstChild);
|
|
59
|
+
} else {
|
|
60
|
+
head.appendChild(style);
|
|
61
|
+
}
|
|
62
|
+
} else {
|
|
63
|
+
head.appendChild(style);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (style.styleSheet) {
|
|
67
|
+
style.styleSheet.cssText = css;
|
|
68
|
+
} else {
|
|
69
|
+
style.appendChild(document.createTextNode(css));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
var css_248z$1 = "/*! tailwindcss v4.0.0 | MIT License | https://tailwindcss.com */\n@import url(./global-vars.less);\n@tailwind base;\n@tailwind components;\n.\\@container {\n container-type: inline-size;\n}\n.\\!visible {\n visibility: visible !important;\n}\n.collapse {\n visibility: collapse;\n}\n.invisible {\n visibility: hidden;\n}\n.visible {\n visibility: visible;\n}\n.sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n}\n.\\!fixed {\n position: fixed !important;\n}\n.\\!relative {\n position: relative !important;\n}\n.absolute {\n position: absolute;\n}\n.fixed {\n position: fixed;\n}\n.relative {\n position: relative;\n}\n.static {\n position: static;\n}\n.sticky {\n position: sticky;\n}\n.-top-1 {\n top: calc(var(--spacing) * -1);\n}\n.top-0 {\n top: calc(var(--spacing) * 0);\n}\n.right-0 {\n right: calc(var(--spacing) * 0);\n}\n.bottom-0 {\n bottom: calc(var(--spacing) * 0);\n}\n.left-0 {\n left: calc(var(--spacing) * 0);\n}\n.isolate {\n isolation: isolate;\n}\n.z-50 {\n z-index: 50;\n}\n.col-span-2 {\n grid-column: span 2 / span 2;\n}\n.col-span-3 {\n grid-column: span 3 / span 3;\n}\n.col-span-full {\n grid-column: 1 / -1;\n}\n.float-left {\n float: left;\n}\n.float-right {\n float: right;\n}\n.\\!container {\n width: 100% !important;\n @media (width >= 40rem) {\n max-width: 40rem !important;\n }\n @media (width >= 48rem) {\n max-width: 48rem !important;\n }\n @media (width >= 64rem) {\n max-width: 64rem !important;\n }\n @media (width >= 80rem) {\n max-width: 80rem !important;\n }\n @media (width >= 96rem) {\n max-width: 96rem !important;\n }\n}\n.container {\n width: 100%;\n @media (width >= 40rem) {\n max-width: 40rem;\n }\n @media (width >= 48rem) {\n max-width: 48rem;\n }\n @media (width >= 64rem) {\n max-width: 64rem;\n }\n @media (width >= 80rem) {\n max-width: 80rem;\n }\n @media (width >= 96rem) {\n max-width: 96rem;\n }\n}\n.m-0 {\n margin: calc(var(--spacing) * 0);\n}\n.m-1 {\n margin: calc(var(--spacing) * 1);\n}\n.m-2 {\n margin: calc(var(--spacing) * 2);\n}\n.m-25 {\n margin: calc(var(--spacing) * 25);\n}\n.m-55296 {\n margin: calc(var(--spacing) * 55296);\n}\n.mx-8 {\n margin-inline: calc(var(--spacing) * 8);\n}\n.mx-auto {\n margin-inline: auto;\n}\n.my-2 {\n margin-block: calc(var(--spacing) * 2);\n}\n.my-4 {\n margin-block: calc(var(--spacing) * 4);\n}\n.my-12 {\n margin-block: calc(var(--spacing) * 12);\n}\n.me-1 {\n margin-inline-end: calc(var(--spacing) * 1);\n}\n.mt-1 {\n margin-top: calc(var(--spacing) * 1);\n}\n.mt-2 {\n margin-top: calc(var(--spacing) * 2);\n}\n.mt-4 {\n margin-top: calc(var(--spacing) * 4);\n}\n.mt-6 {\n margin-top: calc(var(--spacing) * 6);\n}\n.mt-8 {\n margin-top: calc(var(--spacing) * 8);\n}\n.mr-8 {\n margin-right: calc(var(--spacing) * 8);\n}\n.mb-2 {\n margin-bottom: calc(var(--spacing) * 2);\n}\n.mb-4 {\n margin-bottom: calc(var(--spacing) * 4);\n}\n.mb-8 {\n margin-bottom: calc(var(--spacing) * 8);\n}\n.ml-2 {\n margin-left: calc(var(--spacing) * 2);\n}\n.\\!block {\n display: block !important;\n}\n.\\!grid {\n display: grid !important;\n}\n.\\!hidden {\n display: none !important;\n}\n.\\!table {\n display: table !important;\n}\n.block {\n display: block;\n}\n.contents {\n display: contents;\n}\n.flex {\n display: flex;\n}\n.grid {\n display: grid;\n}\n.hidden {\n display: none;\n}\n.inline {\n display: inline;\n}\n.inline-block {\n display: inline-block;\n}\n.inline-flex {\n display: inline-flex;\n}\n.inline-grid {\n display: inline-grid;\n}\n.list-item {\n display: list-item;\n}\n.table {\n display: table;\n}\n.table-caption {\n display: table-caption;\n}\n.table-cell {\n display: table-cell;\n}\n.table-column {\n display: table-column;\n}\n.table-column-group {\n display: table-column-group;\n}\n.table-footer-group {\n display: table-footer-group;\n}\n.table-header-group {\n display: table-header-group;\n}\n.table-row {\n display: table-row;\n}\n.table-row-group {\n display: table-row-group;\n}\n.size-1 {\n width: calc(var(--spacing) * 1);\n height: calc(var(--spacing) * 1);\n}\n.size-4 {\n width: calc(var(--spacing) * 4);\n height: calc(var(--spacing) * 4);\n}\n.size-7 {\n width: calc(var(--spacing) * 7);\n height: calc(var(--spacing) * 7);\n}\n.size-8 {\n width: calc(var(--spacing) * 8);\n height: calc(var(--spacing) * 8);\n}\n.size-11 {\n width: calc(var(--spacing) * 11);\n height: calc(var(--spacing) * 11);\n}\n.size-15 {\n width: calc(var(--spacing) * 15);\n height: calc(var(--spacing) * 15);\n}\n.h-1 {\n height: calc(var(--spacing) * 1);\n}\n.h-3 {\n height: calc(var(--spacing) * 3);\n}\n.h-4 {\n height: calc(var(--spacing) * 4);\n}\n.h-5 {\n height: calc(var(--spacing) * 5);\n}\n.h-8 {\n height: calc(var(--spacing) * 8);\n}\n.h-100 {\n height: calc(var(--spacing) * 100);\n}\n.h-16 {\n height: calc(var(--spacing) * 16);\n}\n.h-16\\/116 {\n height: calc(16/116 * 100%);\n}\n.h-full {\n height: 100%;\n}\n.h-screen {\n height: 100vh;\n}\n.w-1 {\n width: calc(var(--spacing) * 1);\n}\n.w-1\\/2 {\n width: calc(1/2 * 100%);\n}\n.w-4 {\n width: calc(var(--spacing) * 4);\n}\n.w-12 {\n width: calc(var(--spacing) * 12);\n}\n.w-full {\n width: 100%;\n}\n.w-px {\n width: 1px;\n}\n.w-screen {\n width: 100vw;\n}\n.max-w-32 {\n max-width: calc(var(--spacing) * 32);\n}\n.flex-shrink {\n flex-shrink: 1;\n}\n.shrink {\n flex-shrink: 1;\n}\n.shrink-0 {\n flex-shrink: 0;\n}\n.flex-grow {\n flex-grow: 1;\n}\n.grow {\n flex-grow: 1;\n}\n.border-collapse {\n border-collapse: collapse;\n}\n.rotate-45 {\n rotate: 45deg;\n}\n.\\!transform {\n transform: var(--tw-rotate-x) var(--tw-rotate-y) var(--tw-rotate-z) var(--tw-skew-x) var(--tw-skew-y) !important;\n}\n.transform {\n transform: var(--tw-rotate-x) var(--tw-rotate-y) var(--tw-rotate-z) var(--tw-skew-x) var(--tw-skew-y);\n}\n.transform\\! {\n transform: var(--tw-rotate-x) var(--tw-rotate-y) var(--tw-rotate-z) var(--tw-skew-x) var(--tw-skew-y) !important;\n}\n.cursor-pointer {\n cursor: pointer;\n}\n.resize {\n resize: both;\n}\n.grid-cols-2 {\n grid-template-columns: repeat(2, minmax(0, 1fr));\n}\n.grid-cols-3 {\n grid-template-columns: repeat(3, minmax(0, 1fr));\n}\n.flex-col {\n flex-direction: column;\n}\n.flex-row {\n flex-direction: row;\n}\n.flex-wrap {\n flex-wrap: wrap;\n}\n.items-center {\n align-items: center;\n}\n.items-end {\n align-items: flex-end;\n}\n.justify-between {\n justify-content: space-between;\n}\n.justify-center {\n justify-content: center;\n}\n.justify-end {\n justify-content: flex-end;\n}\n.justify-start {\n justify-content: flex-start;\n}\n.gap-0 {\n gap: calc(var(--spacing) * 0);\n}\n.gap-1 {\n gap: calc(var(--spacing) * 1);\n}\n.gap-2 {\n gap: calc(var(--spacing) * 2);\n}\n.gap-3 {\n gap: calc(var(--spacing) * 3);\n}\n.gap-4 {\n gap: calc(var(--spacing) * 4);\n}\n.gap-6 {\n gap: calc(var(--spacing) * 6);\n}\n.space-y-2 {\n :where(& > :not(:last-child)) {\n --tw-space-y-reverse: 0;\n margin-block-start: calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));\n margin-block-end: calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)));\n }\n}\n.space-y-8 {\n :where(& > :not(:last-child)) {\n --tw-space-y-reverse: 0;\n margin-block-start: calc(calc(var(--spacing) * 8) * var(--tw-space-y-reverse));\n margin-block-end: calc(calc(var(--spacing) * 8) * calc(1 - var(--tw-space-y-reverse)));\n }\n}\n.gap-y-0 {\n row-gap: calc(var(--spacing) * 0);\n}\n.self-end {\n align-self: flex-end;\n}\n.self-start {\n align-self: flex-start;\n}\n.truncate {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.overflow-auto {\n overflow: auto;\n}\n.overflow-hidden {\n overflow: hidden;\n}\n.overflow-visible {\n overflow: visible;\n}\n.rounded {\n border-radius: 0.25rem;\n}\n.rounded-full {\n border-radius: calc(infinity * 1px);\n}\n.rounded-lg {\n border-radius: var(--radius-lg);\n}\n.rounded-md {\n border-radius: var(--radius-md);\n}\n.border {\n border-style: var(--tw-border-style);\n border-width: 1px;\n}\n.border-t-1 {\n border-top-style: var(--tw-border-style);\n border-top-width: 1px;\n}\n.border-b-1 {\n border-bottom-style: var(--tw-border-style);\n border-bottom-width: 1px;\n}\n.border-solid {\n --tw-border-style: solid;\n border-style: solid;\n}\n.border-gray-400 {\n border-color: var(--color-gray-400);\n}\n.border-gray-500 {\n border-color: var(--color-gray-500);\n}\n.border-slate-200 {\n border-color: var(--color-slate-200);\n}\n.bg-black {\n background-color: var(--color-black);\n}\n.bg-emerald-200 {\n background-color: var(--color-emerald-200);\n}\n.bg-gray-200 {\n background-color: var(--color-gray-200);\n}\n.bg-green-200 {\n background-color: var(--color-green-200);\n}\n.bg-red-500 {\n background-color: var(--color-red-500);\n}\n.bg-slate-50 {\n background-color: var(--color-slate-50);\n}\n.bg-white {\n background-color: var(--color-white);\n}\n.p-0 {\n padding: calc(var(--spacing) * 0);\n}\n.p-1 {\n padding: calc(var(--spacing) * 1);\n}\n.p-2 {\n padding: calc(var(--spacing) * 2);\n}\n.p-4 {\n padding: calc(var(--spacing) * 4);\n}\n.px-2 {\n padding-inline: calc(var(--spacing) * 2);\n}\n.px-4 {\n padding-inline: calc(var(--spacing) * 4);\n}\n.px-6 {\n padding-inline: calc(var(--spacing) * 6);\n}\n.py-1 {\n padding-block: calc(var(--spacing) * 1);\n}\n.py-2 {\n padding-block: calc(var(--spacing) * 2);\n}\n.py-4 {\n padding-block: calc(var(--spacing) * 4);\n}\n.py-6 {\n padding-block: calc(var(--spacing) * 6);\n}\n.pt-1 {\n padding-top: calc(var(--spacing) * 1);\n}\n.pt-2 {\n padding-top: calc(var(--spacing) * 2);\n}\n.pt-4 {\n padding-top: calc(var(--spacing) * 4);\n}\n.pt-5 {\n padding-top: calc(var(--spacing) * 5);\n}\n.pt-6 {\n padding-top: calc(var(--spacing) * 6);\n}\n.pt-8 {\n padding-top: calc(var(--spacing) * 8);\n}\n.pb-2 {\n padding-bottom: calc(var(--spacing) * 2);\n}\n.pb-4 {\n padding-bottom: calc(var(--spacing) * 4);\n}\n.pb-6 {\n padding-bottom: calc(var(--spacing) * 6);\n}\n.pb-8 {\n padding-bottom: calc(var(--spacing) * 8);\n}\n.pl-0 {\n padding-left: calc(var(--spacing) * 0);\n}\n.pl-2 {\n padding-left: calc(var(--spacing) * 2);\n}\n.pl-4 {\n padding-left: calc(var(--spacing) * 4);\n}\n.text-center {\n text-align: center;\n}\n.text-left {\n text-align: left;\n}\n.text-right {\n text-align: right;\n}\n.align-middle {\n vertical-align: middle;\n}\n.text-2xl {\n font-size: var(--text-2xl);\n line-height: var(--tw-leading, var(--text-2xl--line-height));\n}\n.text-base {\n font-size: var(--text-base);\n line-height: var(--tw-leading, var(--text-base--line-height));\n}\n.text-lg {\n font-size: var(--text-lg);\n line-height: var(--tw-leading, var(--text-lg--line-height));\n}\n.text-sm {\n font-size: var(--text-sm);\n line-height: var(--tw-leading, var(--text-sm--line-height));\n}\n.text-xl {\n font-size: var(--text-xl);\n line-height: var(--tw-leading, var(--text-xl--line-height));\n}\n.text-xs {\n font-size: var(--text-xs);\n line-height: var(--tw-leading, var(--text-xs--line-height));\n}\n.font-bold {\n --tw-font-weight: var(--font-weight-bold);\n font-weight: var(--font-weight-bold);\n}\n.font-light {\n --tw-font-weight: var(--font-weight-light);\n font-weight: var(--font-weight-light);\n}\n.font-medium {\n --tw-font-weight: var(--font-weight-medium);\n font-weight: var(--font-weight-medium);\n}\n.font-normal {\n --tw-font-weight: var(--font-weight-normal);\n font-weight: var(--font-weight-normal);\n}\n.text-nowrap {\n text-wrap: nowrap;\n}\n.text-wrap {\n text-wrap: wrap;\n}\n.break-all {\n word-break: break-all;\n}\n.whitespace-nowrap {\n white-space: nowrap;\n}\n.text-emerald-700 {\n color: var(--color-emerald-700);\n}\n.text-gray-600 {\n color: var(--color-gray-600);\n}\n.text-gray-900 {\n color: var(--color-gray-900);\n}\n.text-green-600 {\n color: var(--color-green-600);\n}\n.text-orange-500 {\n color: var(--color-orange-500);\n}\n.text-orange-600 {\n color: var(--color-orange-600);\n}\n.text-slate-400 {\n color: var(--color-slate-400);\n}\n.text-slate-500 {\n color: var(--color-slate-500);\n}\n.text-slate-600 {\n color: var(--color-slate-600);\n}\n.text-white {\n color: var(--color-white);\n}\n.capitalize {\n text-transform: capitalize;\n}\n.lowercase {\n text-transform: lowercase;\n}\n.lowercase\\! {\n text-transform: lowercase !important;\n}\n.uppercase {\n text-transform: uppercase;\n}\n.italic {\n font-style: italic;\n}\n.ordinal {\n --tw-ordinal: ordinal;\n font-variant-numeric: var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,);\n}\n.tabular-nums {\n --tw-numeric-spacing: tabular-nums;\n font-variant-numeric: var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,);\n}\n.line-through {\n text-decoration-line: line-through;\n}\n.overline {\n text-decoration-line: overline;\n}\n.underline {\n text-decoration-line: underline;\n}\n.antialiased {\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n.ring {\n --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentColor);\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n}\n.shadow {\n --tw-shadow: 0 1px 3px 0 var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 1px 2px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1));\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n}\n.shadow-md {\n --tw-shadow: 0 4px 6px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 2px 4px -2px var(--tw-shadow-color, rgb(0 0 0 / 0.1));\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n}\n.shadow\\/gap {\n --tw-shadow: 0 1px 3px 0 var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 1px 2px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1));\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n}\n.outline {\n outline-style: var(--tw-outline-style);\n outline-width: 1px;\n}\n.blur {\n --tw-blur: blur(8px);\n filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);\n}\n.drop-shadow {\n --tw-drop-shadow: drop-shadow(0 1px 2px rgb(0 0 0 / 0.1)) drop-shadow( 0 1px 1px rgb(0 0 0 / 0.06));\n filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);\n}\n.grayscale {\n --tw-grayscale: grayscale(100%);\n filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);\n}\n.invert {\n --tw-invert: invert(100%);\n filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);\n}\n.\\!filter {\n filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,) !important;\n}\n.filter {\n filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);\n}\n.filter\\! {\n filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,) !important;\n}\n.backdrop-filter {\n -webkit-backdrop-filter: var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);\n backdrop-filter: var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);\n}\n.\\!transition {\n transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, -webkit-backdrop-filter, backdrop-filter !important;\n transition-timing-function: var(--tw-ease, var(--default-transition-timing-function)) !important;\n transition-duration: var(--tw-duration, var(--default-transition-duration)) !important;\n}\n.transition {\n transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, -webkit-backdrop-filter, backdrop-filter;\n transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));\n transition-duration: var(--tw-duration, var(--default-transition-duration));\n}\n.transition\\! {\n transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, -webkit-backdrop-filter, backdrop-filter !important;\n transition-timing-function: var(--tw-ease, var(--default-transition-timing-function)) !important;\n transition-duration: var(--tw-duration, var(--default-transition-duration)) !important;\n}\n.ease-in {\n --tw-ease: var(--ease-in);\n transition-timing-function: var(--ease-in);\n}\n.ease-in-out {\n --tw-ease: var(--ease-in-out);\n transition-timing-function: var(--ease-in-out);\n}\n.ease-out {\n --tw-ease: var(--ease-out);\n transition-timing-function: var(--ease-out);\n}\n.\\[vite\\:css\\] {\n vite: css;\n}\n.\\[vite\\:html\\] {\n vite: html;\n}\n.select-all {\n -webkit-user-select: all;\n user-select: all;\n}\n.sm\\:flex {\n @media (width >= 40rem) {\n display: flex;\n }\n}\n.sm\\:hidden {\n @media (width >= 40rem) {\n display: none;\n }\n}\n.dark\\:bg-gray-900 {\n @media (prefers-color-scheme: dark) {\n background-color: var(--color-gray-900);\n }\n}\n@layer theme, base, components, utilities;\n@layer theme {\n :root {\n --font-sans: ui-sans-serif, system-ui, sans-serif, \"Apple Color Emoji\",\n \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\";\n --font-serif: ui-serif, Georgia, Cambria, \"Times New Roman\", Times, serif;\n --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,\n \"Liberation Mono\", \"Courier New\", monospace;\n --color-red-50: oklch(0.971 0.013 17.38);\n --color-red-100: oklch(0.936 0.032 17.717);\n --color-red-200: oklch(0.885 0.062 18.334);\n --color-red-300: oklch(0.808 0.114 19.571);\n --color-red-400: oklch(0.704 0.191 22.216);\n --color-red-500: oklch(0.637 0.237 25.331);\n --color-red-600: oklch(0.577 0.245 27.325);\n --color-red-700: oklch(0.505 0.213 27.518);\n --color-red-800: oklch(0.444 0.177 26.899);\n --color-red-900: oklch(0.396 0.141 25.723);\n --color-red-950: oklch(0.258 0.092 26.042);\n --color-orange-50: oklch(0.98 0.016 73.684);\n --color-orange-100: oklch(0.954 0.038 75.164);\n --color-orange-200: oklch(0.901 0.076 70.697);\n --color-orange-300: oklch(0.837 0.128 66.29);\n --color-orange-400: oklch(0.75 0.183 55.934);\n --color-orange-500: oklch(0.705 0.213 47.604);\n --color-orange-600: oklch(0.646 0.222 41.116);\n --color-orange-700: oklch(0.553 0.195 38.402);\n --color-orange-800: oklch(0.47 0.157 37.304);\n --color-orange-900: oklch(0.408 0.123 38.172);\n --color-orange-950: oklch(0.266 0.079 36.259);\n --color-amber-50: oklch(0.987 0.022 95.277);\n --color-amber-100: oklch(0.962 0.059 95.617);\n --color-amber-200: oklch(0.924 0.12 95.746);\n --color-amber-300: oklch(0.879 0.169 91.605);\n --color-amber-400: oklch(0.828 0.189 84.429);\n --color-amber-500: oklch(0.769 0.188 70.08);\n --color-amber-600: oklch(0.666 0.179 58.318);\n --color-amber-700: oklch(0.555 0.163 48.998);\n --color-amber-800: oklch(0.473 0.137 46.201);\n --color-amber-900: oklch(0.414 0.112 45.904);\n --color-amber-950: oklch(0.279 0.077 45.635);\n --color-yellow-50: oklch(0.987 0.026 102.212);\n --color-yellow-100: oklch(0.973 0.071 103.193);\n --color-yellow-200: oklch(0.945 0.129 101.54);\n --color-yellow-300: oklch(0.905 0.182 98.111);\n --color-yellow-400: oklch(0.852 0.199 91.936);\n --color-yellow-500: oklch(0.795 0.184 86.047);\n --color-yellow-600: oklch(0.681 0.162 75.834);\n --color-yellow-700: oklch(0.554 0.135 66.442);\n --color-yellow-800: oklch(0.476 0.114 61.907);\n --color-yellow-900: oklch(0.421 0.095 57.708);\n --color-yellow-950: oklch(0.286 0.066 53.813);\n --color-lime-50: oklch(0.986 0.031 120.757);\n --color-lime-100: oklch(0.967 0.067 122.328);\n --color-lime-200: oklch(0.938 0.127 124.321);\n --color-lime-300: oklch(0.897 0.196 126.665);\n --color-lime-400: oklch(0.841 0.238 128.85);\n --color-lime-500: oklch(0.768 0.233 130.85);\n --color-lime-600: oklch(0.648 0.2 131.684);\n --color-lime-700: oklch(0.532 0.157 131.589);\n --color-lime-800: oklch(0.453 0.124 130.933);\n --color-lime-900: oklch(0.405 0.101 131.063);\n --color-lime-950: oklch(0.274 0.072 132.109);\n --color-green-50: oklch(0.982 0.018 155.826);\n --color-green-100: oklch(0.962 0.044 156.743);\n --color-green-200: oklch(0.925 0.084 155.995);\n --color-green-300: oklch(0.871 0.15 154.449);\n --color-green-400: oklch(0.792 0.209 151.711);\n --color-green-500: oklch(0.723 0.219 149.579);\n --color-green-600: oklch(0.627 0.194 149.214);\n --color-green-700: oklch(0.527 0.154 150.069);\n --color-green-800: oklch(0.448 0.119 151.328);\n --color-green-900: oklch(0.393 0.095 152.535);\n --color-green-950: oklch(0.266 0.065 152.934);\n --color-emerald-50: oklch(0.979 0.021 166.113);\n --color-emerald-100: oklch(0.95 0.052 163.051);\n --color-emerald-200: oklch(0.905 0.093 164.15);\n --color-emerald-300: oklch(0.845 0.143 164.978);\n --color-emerald-400: oklch(0.765 0.177 163.223);\n --color-emerald-500: oklch(0.696 0.17 162.48);\n --color-emerald-600: oklch(0.596 0.145 163.225);\n --color-emerald-700: oklch(0.508 0.118 165.612);\n --color-emerald-800: oklch(0.432 0.095 166.913);\n --color-emerald-900: oklch(0.378 0.077 168.94);\n --color-emerald-950: oklch(0.262 0.051 172.552);\n --color-teal-50: oklch(0.984 0.014 180.72);\n --color-teal-100: oklch(0.953 0.051 180.801);\n --color-teal-200: oklch(0.91 0.096 180.426);\n --color-teal-300: oklch(0.855 0.138 181.071);\n --color-teal-400: oklch(0.777 0.152 181.912);\n --color-teal-500: oklch(0.704 0.14 182.503);\n --color-teal-600: oklch(0.6 0.118 184.704);\n --color-teal-700: oklch(0.511 0.096 186.391);\n --color-teal-800: oklch(0.437 0.078 188.216);\n --color-teal-900: oklch(0.386 0.063 188.416);\n --color-teal-950: oklch(0.277 0.046 192.524);\n --color-cyan-50: oklch(0.984 0.019 200.873);\n --color-cyan-100: oklch(0.956 0.045 203.388);\n --color-cyan-200: oklch(0.917 0.08 205.041);\n --color-cyan-300: oklch(0.865 0.127 207.078);\n --color-cyan-400: oklch(0.789 0.154 211.53);\n --color-cyan-500: oklch(0.715 0.143 215.221);\n --color-cyan-600: oklch(0.609 0.126 221.723);\n --color-cyan-700: oklch(0.52 0.105 223.128);\n --color-cyan-800: oklch(0.45 0.085 224.283);\n --color-cyan-900: oklch(0.398 0.07 227.392);\n --color-cyan-950: oklch(0.302 0.056 229.695);\n --color-sky-50: oklch(0.977 0.013 236.62);\n --color-sky-100: oklch(0.951 0.026 236.824);\n --color-sky-200: oklch(0.901 0.058 230.902);\n --color-sky-300: oklch(0.828 0.111 230.318);\n --color-sky-400: oklch(0.746 0.16 232.661);\n --color-sky-500: oklch(0.685 0.169 237.323);\n --color-sky-600: oklch(0.588 0.158 241.966);\n --color-sky-700: oklch(0.5 0.134 242.749);\n --color-sky-800: oklch(0.443 0.11 240.79);\n --color-sky-900: oklch(0.391 0.09 240.876);\n --color-sky-950: oklch(0.293 0.066 243.157);\n --color-blue-50: oklch(0.97 0.014 254.604);\n --color-blue-100: oklch(0.932 0.032 255.585);\n --color-blue-200: oklch(0.882 0.059 254.128);\n --color-blue-300: oklch(0.809 0.105 251.813);\n --color-blue-400: oklch(0.707 0.165 254.624);\n --color-blue-500: oklch(0.623 0.214 259.815);\n --color-blue-600: oklch(0.546 0.245 262.881);\n --color-blue-700: oklch(0.488 0.243 264.376);\n --color-blue-800: oklch(0.424 0.199 265.638);\n --color-blue-900: oklch(0.379 0.146 265.522);\n --color-blue-950: oklch(0.282 0.091 267.935);\n --color-indigo-50: oklch(0.962 0.018 272.314);\n --color-indigo-100: oklch(0.93 0.034 272.788);\n --color-indigo-200: oklch(0.87 0.065 274.039);\n --color-indigo-300: oklch(0.785 0.115 274.713);\n --color-indigo-400: oklch(0.673 0.182 276.935);\n --color-indigo-500: oklch(0.585 0.233 277.117);\n --color-indigo-600: oklch(0.511 0.262 276.966);\n --color-indigo-700: oklch(0.457 0.24 277.023);\n --color-indigo-800: oklch(0.398 0.195 277.366);\n --color-indigo-900: oklch(0.359 0.144 278.697);\n --color-indigo-950: oklch(0.257 0.09 281.288);\n --color-violet-50: oklch(0.969 0.016 293.756);\n --color-violet-100: oklch(0.943 0.029 294.588);\n --color-violet-200: oklch(0.894 0.057 293.283);\n --color-violet-300: oklch(0.811 0.111 293.571);\n --color-violet-400: oklch(0.702 0.183 293.541);\n --color-violet-500: oklch(0.606 0.25 292.717);\n --color-violet-600: oklch(0.541 0.281 293.009);\n --color-violet-700: oklch(0.491 0.27 292.581);\n --color-violet-800: oklch(0.432 0.232 292.759);\n --color-violet-900: oklch(0.38 0.189 293.745);\n --color-violet-950: oklch(0.283 0.141 291.089);\n --color-purple-50: oklch(0.977 0.014 308.299);\n --color-purple-100: oklch(0.946 0.033 307.174);\n --color-purple-200: oklch(0.902 0.063 306.703);\n --color-purple-300: oklch(0.827 0.119 306.383);\n --color-purple-400: oklch(0.714 0.203 305.504);\n --color-purple-500: oklch(0.627 0.265 303.9);\n --color-purple-600: oklch(0.558 0.288 302.321);\n --color-purple-700: oklch(0.496 0.265 301.924);\n --color-purple-800: oklch(0.438 0.218 303.724);\n --color-purple-900: oklch(0.381 0.176 304.987);\n --color-purple-950: oklch(0.291 0.149 302.717);\n --color-fuchsia-50: oklch(0.977 0.017 320.058);\n --color-fuchsia-100: oklch(0.952 0.037 318.852);\n --color-fuchsia-200: oklch(0.903 0.076 319.62);\n --color-fuchsia-300: oklch(0.833 0.145 321.434);\n --color-fuchsia-400: oklch(0.74 0.238 322.16);\n --color-fuchsia-500: oklch(0.667 0.295 322.15);\n --color-fuchsia-600: oklch(0.591 0.293 322.896);\n --color-fuchsia-700: oklch(0.518 0.253 323.949);\n --color-fuchsia-800: oklch(0.452 0.211 324.591);\n --color-fuchsia-900: oklch(0.401 0.17 325.612);\n --color-fuchsia-950: oklch(0.293 0.136 325.661);\n --color-pink-50: oklch(0.971 0.014 343.198);\n --color-pink-100: oklch(0.948 0.028 342.258);\n --color-pink-200: oklch(0.899 0.061 343.231);\n --color-pink-300: oklch(0.823 0.12 346.018);\n --color-pink-400: oklch(0.718 0.202 349.761);\n --color-pink-500: oklch(0.656 0.241 354.308);\n --color-pink-600: oklch(0.592 0.249 0.584);\n --color-pink-700: oklch(0.525 0.223 3.958);\n --color-pink-800: oklch(0.459 0.187 3.815);\n --color-pink-900: oklch(0.408 0.153 2.432);\n --color-pink-950: oklch(0.284 0.109 3.907);\n --color-rose-50: oklch(0.969 0.015 12.422);\n --color-rose-100: oklch(0.941 0.03 12.58);\n --color-rose-200: oklch(0.892 0.058 10.001);\n --color-rose-300: oklch(0.81 0.117 11.638);\n --color-rose-400: oklch(0.712 0.194 13.428);\n --color-rose-500: oklch(0.645 0.246 16.439);\n --color-rose-600: oklch(0.586 0.253 17.585);\n --color-rose-700: oklch(0.514 0.222 16.935);\n --color-rose-800: oklch(0.455 0.188 13.697);\n --color-rose-900: oklch(0.41 0.159 10.272);\n --color-rose-950: oklch(0.271 0.105 12.094);\n --color-slate-50: oklch(0.984 0.003 247.858);\n --color-slate-100: oklch(0.968 0.007 247.896);\n --color-slate-200: oklch(0.929 0.013 255.508);\n --color-slate-300: oklch(0.869 0.022 252.894);\n --color-slate-400: oklch(0.704 0.04 256.788);\n --color-slate-500: oklch(0.554 0.046 257.417);\n --color-slate-600: oklch(0.446 0.043 257.281);\n --color-slate-700: oklch(0.372 0.044 257.287);\n --color-slate-800: oklch(0.279 0.041 260.031);\n --color-slate-900: oklch(0.208 0.042 265.755);\n --color-slate-950: oklch(0.129 0.042 264.695);\n --color-gray-50: oklch(0.985 0.002 247.839);\n --color-gray-100: oklch(0.967 0.003 264.542);\n --color-gray-200: oklch(0.928 0.006 264.531);\n --color-gray-300: oklch(0.872 0.01 258.338);\n --color-gray-400: oklch(0.707 0.022 261.325);\n --color-gray-500: oklch(0.551 0.027 264.364);\n --color-gray-600: oklch(0.446 0.03 256.802);\n --color-gray-700: oklch(0.373 0.034 259.733);\n --color-gray-800: oklch(0.278 0.033 256.848);\n --color-gray-900: oklch(0.21 0.034 264.665);\n --color-gray-950: oklch(0.13 0.028 261.692);\n --color-zinc-50: oklch(0.985 0 0);\n --color-zinc-100: oklch(0.967 0.001 286.375);\n --color-zinc-200: oklch(0.92 0.004 286.32);\n --color-zinc-300: oklch(0.871 0.006 286.286);\n --color-zinc-400: oklch(0.705 0.015 286.067);\n --color-zinc-500: oklch(0.552 0.016 285.938);\n --color-zinc-600: oklch(0.442 0.017 285.786);\n --color-zinc-700: oklch(0.37 0.013 285.805);\n --color-zinc-800: oklch(0.274 0.006 286.033);\n --color-zinc-900: oklch(0.21 0.006 285.885);\n --color-zinc-950: oklch(0.141 0.005 285.823);\n --color-neutral-50: oklch(0.985 0 0);\n --color-neutral-100: oklch(0.97 0 0);\n --color-neutral-200: oklch(0.922 0 0);\n --color-neutral-300: oklch(0.87 0 0);\n --color-neutral-400: oklch(0.708 0 0);\n --color-neutral-500: oklch(0.556 0 0);\n --color-neutral-600: oklch(0.439 0 0);\n --color-neutral-700: oklch(0.371 0 0);\n --color-neutral-800: oklch(0.269 0 0);\n --color-neutral-900: oklch(0.205 0 0);\n --color-neutral-950: oklch(0.145 0 0);\n --color-stone-50: oklch(0.985 0.001 106.423);\n --color-stone-100: oklch(0.97 0.001 106.424);\n --color-stone-200: oklch(0.923 0.003 48.717);\n --color-stone-300: oklch(0.869 0.005 56.366);\n --color-stone-400: oklch(0.709 0.01 56.259);\n --color-stone-500: oklch(0.553 0.013 58.071);\n --color-stone-600: oklch(0.444 0.011 73.639);\n --color-stone-700: oklch(0.374 0.01 67.558);\n --color-stone-800: oklch(0.268 0.007 34.298);\n --color-stone-900: oklch(0.216 0.006 56.043);\n --color-stone-950: oklch(0.147 0.004 49.25);\n --color-black: #000;\n --color-white: #fff;\n --spacing: 0.25rem;\n --breakpoint-sm: 40rem;\n --breakpoint-md: 48rem;\n --breakpoint-lg: 64rem;\n --breakpoint-xl: 80rem;\n --breakpoint-2xl: 96rem;\n --container-3xs: 16rem;\n --container-2xs: 18rem;\n --container-xs: 20rem;\n --container-sm: 24rem;\n --container-md: 28rem;\n --container-lg: 32rem;\n --container-xl: 36rem;\n --container-2xl: 42rem;\n --container-3xl: 48rem;\n --container-4xl: 56rem;\n --container-5xl: 64rem;\n --container-6xl: 72rem;\n --container-7xl: 80rem;\n --text-xs: 0.75rem;\n --text-xs--line-height: calc(1 / 0.75);\n --text-sm: 0.875rem;\n --text-sm--line-height: calc(1.25 / 0.875);\n --text-base: 1rem;\n --text-base--line-height: calc(1.5 / 1);\n --text-lg: 1.125rem;\n --text-lg--line-height: calc(1.75 / 1.125);\n --text-xl: 1.25rem;\n --text-xl--line-height: calc(1.75 / 1.25);\n --text-2xl: 1.5rem;\n --text-2xl--line-height: calc(2 / 1.5);\n --text-3xl: 1.875rem;\n --text-3xl--line-height: calc(2.25 / 1.875);\n --text-4xl: 2.25rem;\n --text-4xl--line-height: calc(2.5 / 2.25);\n --text-5xl: 3rem;\n --text-5xl--line-height: 1;\n --text-6xl: 3.75rem;\n --text-6xl--line-height: 1;\n --text-7xl: 4.5rem;\n --text-7xl--line-height: 1;\n --text-8xl: 6rem;\n --text-8xl--line-height: 1;\n --text-9xl: 8rem;\n --text-9xl--line-height: 1;\n --font-weight-thin: 100;\n --font-weight-extralight: 200;\n --font-weight-light: 300;\n --font-weight-normal: 400;\n --font-weight-medium: 500;\n --font-weight-semibold: 600;\n --font-weight-bold: 700;\n --font-weight-extrabold: 800;\n --font-weight-black: 900;\n --tracking-tighter: -0.05em;\n --tracking-tight: -0.025em;\n --tracking-normal: 0em;\n --tracking-wide: 0.025em;\n --tracking-wider: 0.05em;\n --tracking-widest: 0.1em;\n --leading-tight: 1.25;\n --leading-snug: 1.375;\n --leading-normal: 1.5;\n --leading-relaxed: 1.625;\n --leading-loose: 2;\n --radius-xs: 0.125rem;\n --radius-sm: 0.25rem;\n --radius-md: 0.375rem;\n --radius-lg: 0.5rem;\n --radius-xl: 0.75rem;\n --radius-2xl: 1rem;\n --radius-3xl: 1.5rem;\n --radius-4xl: 2rem;\n --shadow-2xs: 0 1px rgb(0 0 0 / 0.05);\n --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);\n --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);\n --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1),\n 0 2px 4px -2px rgb(0 0 0 / 0.1);\n --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1),\n 0 4px 6px -4px rgb(0 0 0 / 0.1);\n --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1),\n 0 8px 10px -6px rgb(0 0 0 / 0.1);\n --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);\n --inset-shadow-2xs: inset 0 1px rgb(0 0 0 / 0.05);\n --inset-shadow-xs: inset 0 1px 1px rgb(0 0 0 / 0.05);\n --inset-shadow-sm: inset 0 2px 4px rgb(0 0 0 / 0.05);\n --drop-shadow-xs: 0 1px 1px rgb(0 0 0 / 0.05);\n --drop-shadow-sm: 0 1px 2px rgb(0 0 0 / 0.15);\n --drop-shadow-md: 0 3px 3px rgb(0 0 0 / 0.12);\n --drop-shadow-lg: 0 4px 4px rgb(0 0 0 / 0.15);\n --drop-shadow-xl: 0 9px 7px rgb(0 0 0 / 0.1);\n --drop-shadow-2xl: 0 25px 25px rgb(0 0 0 / 0.15);\n --ease-in: cubic-bezier(0.4, 0, 1, 1);\n --ease-out: cubic-bezier(0, 0, 0.2, 1);\n --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);\n --animate-spin: spin 1s linear infinite;\n --animate-ping: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;\n --animate-pulse: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;\n --animate-bounce: bounce 1s infinite;\n --blur-xs: 4px;\n --blur-sm: 8px;\n --blur-md: 12px;\n --blur-lg: 16px;\n --blur-xl: 24px;\n --blur-2xl: 40px;\n --blur-3xl: 64px;\n --perspective-dramatic: 100px;\n --perspective-near: 300px;\n --perspective-normal: 500px;\n --perspective-midrange: 800px;\n --perspective-distant: 1200px;\n --aspect-video: 16 / 9;\n --default-transition-duration: 150ms;\n --default-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n --default-font-family: var(--font-sans);\n --default-font-feature-settings: var(--font-sans--font-feature-settings);\n --default-font-variation-settings: var(\n --font-sans--font-variation-settings\n );\n --default-mono-font-family: var(--font-mono);\n --default-mono-font-feature-settings: var(\n --font-mono--font-feature-settings\n );\n --default-mono-font-variation-settings: var(\n --font-mono--font-variation-settings\n );\n }\n}\n@layer base {\n *, ::after, ::before, ::backdrop, ::file-selector-button {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n border: 0 solid;\n }\n html, :host {\n line-height: 1.5;\n -webkit-text-size-adjust: 100%;\n tab-size: 4;\n font-family: var( --default-font-family, ui-sans-serif, system-ui, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\" );\n font-feature-settings: var(--default-font-feature-settings, normal);\n font-variation-settings: var( --default-font-variation-settings, normal );\n -webkit-tap-highlight-color: transparent;\n }\n body {\n line-height: inherit;\n }\n hr {\n height: 0;\n color: inherit;\n border-top-width: 1px;\n }\n abbr:where([title]) {\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n }\n h1, h2, h3, h4, h5, h6 {\n font-size: inherit;\n font-weight: inherit;\n }\n a {\n color: inherit;\n -webkit-text-decoration: inherit;\n text-decoration: inherit;\n }\n b, strong {\n font-weight: bolder;\n }\n code, kbd, samp, pre {\n font-family: var( --default-mono-font-family, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace );\n font-feature-settings: var( --default-mono-font-feature-settings, normal );\n font-variation-settings: var( --default-mono-font-variation-settings, normal );\n font-size: 1em;\n }\n small {\n font-size: 80%;\n }\n sub, sup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n }\n sub {\n bottom: -0.25em;\n }\n sup {\n top: -0.5em;\n }\n table {\n text-indent: 0;\n border-color: inherit;\n border-collapse: collapse;\n }\n :-moz-focusring {\n outline: auto;\n }\n progress {\n vertical-align: baseline;\n }\n summary {\n display: list-item;\n }\n ol, ul, menu {\n list-style: none;\n }\n img, svg, video, canvas, audio, iframe, embed, object {\n display: block;\n vertical-align: middle;\n }\n img, video {\n max-width: 100%;\n height: auto;\n }\n button, input, select, optgroup, textarea, ::file-selector-button {\n font: inherit;\n font-feature-settings: inherit;\n font-variation-settings: inherit;\n letter-spacing: inherit;\n color: inherit;\n border-radius: 0;\n background-color: transparent;\n opacity: 1;\n }\n :where(select:is([multiple], [size])) optgroup {\n font-weight: bolder;\n }\n :where(select:is([multiple], [size])) optgroup option {\n padding-inline-start: 20px;\n }\n ::file-selector-button {\n margin-inline-end: 4px;\n }\n ::placeholder {\n opacity: 1;\n color: color-mix(in oklab, currentColor 50%, transparent);\n }\n textarea {\n resize: vertical;\n }\n ::-webkit-search-decoration {\n -webkit-appearance: none;\n }\n ::-webkit-date-and-time-value {\n min-height: 1lh;\n text-align: inherit;\n }\n ::-webkit-datetime-edit {\n display: inline-flex;\n }\n ::-webkit-datetime-edit-fields-wrapper {\n padding: 0;\n }\n ::-webkit-datetime-edit, ::-webkit-datetime-edit-year-field, ::-webkit-datetime-edit-month-field, ::-webkit-datetime-edit-day-field, ::-webkit-datetime-edit-hour-field, ::-webkit-datetime-edit-minute-field, ::-webkit-datetime-edit-second-field, ::-webkit-datetime-edit-millisecond-field, ::-webkit-datetime-edit-meridiem-field {\n padding-block: 0;\n }\n :-moz-ui-invalid {\n box-shadow: none;\n }\n button, input:where([type=\"button\"], [type=\"reset\"], [type=\"submit\"]), ::file-selector-button {\n appearance: button;\n }\n ::-webkit-inner-spin-button, ::-webkit-outer-spin-button {\n height: auto;\n }\n [hidden]:where(:not([hidden=\"until-found\"])) {\n display: none !important;\n }\n}\n@layer utilities;\n@media (min-width: 768px) {\n .sm\\:hidden {\n display: none !important;\n }\n .sm\\:flex {\n display: flex !important;\n }\n}\n.text-xxs {\n font-size: 0.625rem;\n}\n.w-1\\/2 {\n width: 50%;\n}\n.border-t-1 {\n border-top-width: 1px;\n}\n.border-b-1 {\n border-bottom-width: 1px;\n}\n.border-t-solid {\n border-top-style: solid;\n}\n.border-b-solid {\n border-bottom-style: solid;\n}\n.text-nowrap {\n white-space: nowrap;\n}\n.max-w-32 {\n max-width: 8rem;\n}\n// Used to hide sections from UI but remain in PDFs .pdf-only {\n display: none !important;\n}\n.font-light {\n font-family: @mark-pro-light;\n}\n.font-medium {\n font-family: @mark-pro-medium;\n}\n.font-bold {\n font-family: @mark-pro-bold;\n}\n.gap-y-0 {\n row-gap: 0px !important;\n}\n.gap-0 {\n gap: 0px !important;\n}\n.grow {\n flex-grow: 1;\n}\n.rounded-md {\n border-radius: 0.375rem;\n}\n.shadow-md {\n box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);\n}\n.text-slate-400 {\n --tw-text-opacity: 1;\n color: rgb(148 163 184 / var(--tw-text-opacity, 1));\n}\n.text-gray-600 {\n --tw-text-opacity: 1;\n color: rgb(75 85 99 / var(--tw-text-opacity, 1));\n}\n.text-gray-900 {\n --tw-text-opacity: 1;\n color: rgb(17 24 39 / var(--tw-text-opacity, 1));\n}\n.text-emerald-700 {\n --tw-text-opacity: 1;\n color: rgb(22 163 74 / var(--tw-text-opacity, 1));\n}\n.bg-emerald-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(187 247 208 / var(--tw-bg-opacity, 1));\n}\n.border-slate-200 {\n --tw-border-opacity: 1;\n border-color: rgb(226 232 240 / var(--tw-border-opacity, 1));\n}\n.text-2xl {\n font-size: 1.5rem;\n line-height: 2rem;\n}\n.border-collapse {\n border-collapse: collapse;\n}\n.align-middle {\n vertical-align: middle;\n}\n.has-tooltip {\n position: relative;\n}\n.ui-only {\n display: none;\n}\n.tooltip {\n position: absolute;\n z-index: 10;\n background-color: black;\n color: white;\n padding: 0.5rem;\n border-radius: 0.25rem;\n}\n.relative {\n position: relative;\n}\n.tootip-arrow {\n width: 0;\n height: 0;\n border-left: 0.5rem solid transparent;\n border-right: 0.5rem solid transparent;\n border-bottom: 0.5rem solid black;\n position: absolute;\n top: -0.5rem;\n}\n.absolute {\n position: absolute;\n}\n.rotate-45 {\n transform: rotate(45deg);\n}\n.-top-1\\/10 {\n top: -10%;\n}\n.bg-black {\n background-color: black;\n}\n.w-4 {\n width: 1rem;\n}\n.h-4 {\n height: 1rem;\n}\n.text-white {\n color: white;\n}\n.p-2 {\n padding: 0.5rem;\n}\n.rounded-md {\n border-radius: 0.375rem;\n}\n.z-50 {\n z-index: 50;\n}\n.mr-8 {\n margin-right: 2rem;\n}\n.notes {\n font-style: italic;\n}\n.mt-8 {\n margin-top: 2rem;\n}\n@property --tw-rotate-x {\n syntax: \"*\";\n inherits: false;\n initial-value: rotateX(0);\n}\n@property --tw-rotate-y {\n syntax: \"*\";\n inherits: false;\n initial-value: rotateY(0);\n}\n@property --tw-rotate-z {\n syntax: \"*\";\n inherits: false;\n initial-value: rotateZ(0);\n}\n@property --tw-skew-x {\n syntax: \"*\";\n inherits: false;\n initial-value: skewX(0);\n}\n@property --tw-skew-y {\n syntax: \"*\";\n inherits: false;\n initial-value: skewY(0);\n}\n@property --tw-space-y-reverse {\n syntax: \"*\";\n inherits: false;\n initial-value: 0;\n}\n@property --tw-border-style {\n syntax: \"*\";\n inherits: false;\n initial-value: solid;\n}\n@property --tw-font-weight {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-ordinal {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-slashed-zero {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-numeric-figure {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-numeric-spacing {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-numeric-fraction {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-shadow {\n syntax: \"*\";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n@property --tw-shadow-color {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-inset-shadow {\n syntax: \"*\";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n@property --tw-inset-shadow-color {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-ring-color {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-ring-shadow {\n syntax: \"*\";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n@property --tw-inset-ring-color {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-inset-ring-shadow {\n syntax: \"*\";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n@property --tw-ring-inset {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-ring-offset-width {\n syntax: \"<length>\";\n inherits: false;\n initial-value: 0px;\n}\n@property --tw-ring-offset-color {\n syntax: \"*\";\n inherits: false;\n initial-value: #fff;\n}\n@property --tw-ring-offset-shadow {\n syntax: \"*\";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n@property --tw-outline-style {\n syntax: \"*\";\n inherits: false;\n initial-value: solid;\n}\n@property --tw-blur {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-brightness {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-contrast {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-grayscale {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-hue-rotate {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-invert {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-opacity {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-saturate {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-sepia {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-backdrop-blur {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-backdrop-brightness {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-backdrop-contrast {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-backdrop-grayscale {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-backdrop-hue-rotate {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-backdrop-invert {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-backdrop-opacity {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-backdrop-saturate {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-backdrop-sepia {\n syntax: \"*\";\n inherits: false;\n}\n@property --tw-ease {\n syntax: \"*\";\n inherits: false;\n}\n@keyframes spin {\n to {\n transform: rotate(360deg);\n }\n}\n@keyframes ping {\n 75%, 100% {\n transform: scale(2);\n opacity: 0;\n }\n}\n@keyframes pulse {\n 50% {\n opacity: 0.5;\n }\n}\n@keyframes bounce {\n 0%, 100% {\n transform: translateY(-25%);\n animation-timing-function: cubic-bezier(0.8, 0, 1, 1);\n }\n 50% {\n transform: none;\n animation-timing-function: cubic-bezier(0, 0, 0.2, 1);\n }\n}\n";
|
|
74
|
+
styleInject(css_248z$1);
|
|
46
75
|
|
|
47
76
|
/******************************************************************************
|
|
48
77
|
Copyright (c) Microsoft Corporation.
|
|
@@ -117,36 +146,6 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
117
146
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
118
147
|
};
|
|
119
148
|
|
|
120
|
-
function styleInject(css, ref) {
|
|
121
|
-
if ( ref === void 0 ) ref = {};
|
|
122
|
-
var insertAt = ref.insertAt;
|
|
123
|
-
|
|
124
|
-
if (!css || typeof document === 'undefined') { return; }
|
|
125
|
-
|
|
126
|
-
var head = document.head || document.getElementsByTagName('head')[0];
|
|
127
|
-
var style = document.createElement('style');
|
|
128
|
-
style.type = 'text/css';
|
|
129
|
-
|
|
130
|
-
if (insertAt === 'top') {
|
|
131
|
-
if (head.firstChild) {
|
|
132
|
-
head.insertBefore(style, head.firstChild);
|
|
133
|
-
} else {
|
|
134
|
-
head.appendChild(style);
|
|
135
|
-
}
|
|
136
|
-
} else {
|
|
137
|
-
head.appendChild(style);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
if (style.styleSheet) {
|
|
141
|
-
style.styleSheet.cssText = css;
|
|
142
|
-
} else {
|
|
143
|
-
style.appendChild(document.createTextNode(css));
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
var css_248z = ".ant-tag {\n border: none;\n border-radius: 14px;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n font-weight: 500;\n white-space: nowrap;\n margin: 0;\n}\n.ant-tag-blue {\n color: #3b82f6 !important;\n background: #bfdbfe !important;\n}\n.ant-tag-green {\n color: #059669 !important;\n background: #a7f3d0 !important;\n}\n.ant-tag-red {\n color: #ef4444 !important;\n background: #fecaca !important;\n}\n.ant-tag-orange {\n color: #f97316 !important;\n background: #fed7aa !important;\n}\n.ant-tag-yellow {\n color: #f59e0b !important;\n background: #fde68a !important;\n}\n.ant-tag-purple {\n color: #8b5cf6 !important;\n background: #ddd6fe !important;\n}\n.ant-tag-black {\n color: white !important;\n background: black !important;\n}\n.ant-popover {\n z-index: 1050;\n}\n.ant-popover-inner-content {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n max-width: 300px;\n}\n.ant-popover-message-title {\n padding: 0;\n text-align: center;\n font-size: 1rem;\n}\n.ant-popover-buttons {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.ant-btn-primary:disabled {\n background: #eef0f2 !important;\n color: rgba(0, 0, 0, 0.25) !important;\n border: none;\n}\n.ant-btn {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n font-weight: 500;\n box-shadow: none;\n text-shadow: none;\n outline: none !important;\n line-height: 1;\n font-size: 0.875rem;\n font-weight: normal;\n}\n.ant-btn > span {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n.ant-btn-lg {\n height: 44px !important;\n}\n.ant-btn-default:disabled {\n border-color: rgba(113, 125, 148, 0.2) !important;\n}\n.ant-btn-link {\n border: none !important;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n.ant-btn-link > span {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n.ant-btn-link:disabled {\n background-color: transparent !important;\n color: #717d94 !important;\n}\n.ant-btn-link:disabled:hover {\n background-color: transparent !important;\n}\n.ant-input-affix-wrapper .ant-input-prefix {\n transition: color 0.3s;\n}\n.ant-select-selector {\n box-shadow: none !important;\n background-color: transparent !important;\n border: none !important;\n}\n.ant-form-item-label {\n text-transform: none !important;\n font-size: 0.75rem;\n padding-bottom: 2px !important;\n}\n.ant-form-item-label > label {\n width: 100%;\n color: #4b5563 !important;\n}\n.ant-form-item-explain-error {\n font-size: 11px;\n min-height: 11px;\n line-height: 11px;\n padding-top: 2px;\n}\n.ant-form-item {\n margin-bottom: 0;\n}\n.ant-notification {\n width: min-content;\n}\n.ant-notification-topRight {\n right: 0 !important;\n left: 0 !important;\n margin-left: auto !important;\n margin-right: auto !important;\n}\n.ant-notification-notice-wrapper {\n width: 350px !important;\n overflow: hidden !important;\n}\n.ant-notification-notice {\n padding: 16px !important;\n width: 350px !important;\n display: flex !important;\n box-shadow: 0px 6px 10px rgba(0, 0, 0, 0.08), 0px 1px 18px rgba(0, 0, 0, 0.08), 0px 3px 5px rgba(0, 0, 0, 0.16) !important;\n}\n.ant-notification-notice-description {\n padding: 0 14px 0 0 !important;\n color: #232323 !important;\n font-size: 14px !important;\n word-break: break-all !important;\n overflow-wrap: break-word !important;\n}\n.ant-notification-notice-success {\n background-color: #edfffa !important;\n}\n.ant-notification-notice-error {\n background-color: #fff8f4 !important;\n}\n.ant-notification-notice-error .ant-notification-notice-message {\n color: #ff6e1c !important;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji !important;\n font-weight: 500;\n}\n.ant-notification-notice-error .ant-notification-notice-icon {\n color: #ff6e1c;\n}\n.ant-notification-notice-success .ant-notification-notice-message {\n color: #00b76a !important;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji !important;\n font-weight: 500;\n}\n.ant-notification-notice-success .ant-notification-notice-icon {\n color: #00b76a !important;\n}\n.ant-notification-notice-message {\n margin-bottom: 0 !important;\n}\n.ant-notification-notice-close {\n top: 16px !important;\n right: 16px !important;\n}\n.ant-divider {\n margin: 0;\n}\n.ant-menu-submenu-popup > .ant-menu .ant-menu-item {\n display: flex !important;\n align-items: center !important;\n}\n.ant-menu-submenu::after {\n display: none !important;\n}\n.ant-drawer-title {\n font-weight: 400 !important;\n}\n.ant-drawer-header-title {\n flex-direction: row-reverse !important;\n align-items: start !important ;\n}\n.ant-drawer-close {\n margin-inline-end: 0 !important;\n}\n@media (min-width: 768px) {\n .ant-input,\n .ant-picker,\n .ant-select,\n .ant-input-affix-wrapper {\n font-size: 1rem !important;\n }\n .ant-drawer-header {\n padding-right: 1.5rem !important;\n padding-left: 1.5rem !important;\n }\n}\n:root {\n --row-background: #ffffff;\n --row-background-alternate: rgba(100, 116, 139, 0.04);\n --row-background-dark: #121212;\n --row-background-alternate-dark: #1e1e1e;\n}\n.plan-step-line {\n height: 1px;\n min-width: 128px;\n background: #717d94;\n}\n.plan-step-number {\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 9999px;\n border: 1px solid #717d94;\n background: white;\n width: 24px;\n height: 24px;\n color: #717d94;\n}\n.plan-step-number.active {\n border: none;\n color: white;\n background: #ff6e1c;\n}\n.hidden {\n display: none;\n}\n.cardElement {\n padding: 8px 11px;\n border: 1px solid #e5e7eb;\n background-color: white;\n font-family: Inter !important;\n}\n.tooltip {\n visibility: hidden;\n position: absolute !important;\n}\n.has-tooltip:hover .tooltip {\n visibility: visible;\n z-index: 100;\n}\n.show-on-hover {\n opacity: 0;\n}\n.show-on-hover-container:hover .show-on-hover {\n opacity: 1;\n}\n.pdf-only {\n display: none !important;\n}\n.notes p {\n margin: 0;\n padding: 0;\n padding-bottom: 0.25rem;\n}\n#form-element #finix-form-container .field-holder label {\n color: #717d94 !important;\n font-size: 12px !important;\n}\n#form-element #finix-form-container > *:first-child,\n#form-element #finix-form-container > *:last-child {\n margin-top: 0 !important;\n}\n#form-element #finix-form-container > *:not(:first-child):not(:last-child) {\n margin-top: 12px !important;\n}\n#form-element #finix-form-container .field-array > * {\n margin-top: 0 !important;\n}\n#form-element #finix-form-container .field-holder .field,\n#form-element #finix-form-container iframe {\n height: 34px !important;\n}\n#form-element #finix-form-container .field {\n margin-top: 0 !important;\n padding-top: 2px !important;\n}\n#form-element #finix-form-container .field-holder .validation {\n font-size: 11px !important;\n color: #ff4d4f !important;\n}\n.icon-path {\n transition: fill 0.3s;\n}\n.shadow-padding-x {\n padding-right: 1rem;\n padding-left: 1rem;\n}\n.shadow-padding-xb {\n padding-right: 1rem;\n padding-left: 1rem;\n padding-bottom: 0.5rem;\n}\n.content-container {\n width: 100%;\n margin: 0 auto;\n}\n@media (min-width: 1220px) {\n .content-container {\n width: 1220px !important;\n margin: 0 auto;\n }\n}\n@media (min-width: 768px) {\n .shadow-padding-x {\n padding-right: 2rem;\n padding-left: 2rem;\n }\n .shadow-padding-xb {\n padding-right: 2rem;\n padding-left: 2rem;\n padding-bottom: 0.5rem;\n }\n .sm\\:flex {\n display: flex !important;\n }\n .sm\\:hidden {\n display: none !important;\n }\n}\n.relative {\n position: relative;\n}\n.absolute {\n position: absolute;\n}\n.fixed {\n position: fixed;\n}\n.top-0 {\n top: 0;\n}\n.right-0 {\n right: 0;\n}\n.bottom-0 {\n bottom: 0;\n}\n.left-0 {\n left: 0;\n}\n.overflow-hidden {\n overflow: hidden !important;\n}\n.overflow-auto {\n overflow: auto;\n}\n.overflow-visible {\n overflow: visible;\n}\n.z-50 {\n z-index: 50;\n}\n.-top-1\\/10 {\n top: -10%;\n}\n.rounded {\n border-radius: 0.25rem;\n}\n.rounded-md {\n border-radius: 0.375rem;\n}\n.rounded-lg {\n border-radius: 0.5rem;\n}\n.rounded-xl {\n border-radius: 0.75rem;\n}\n.rounded-full {\n border-radius: 9999px;\n}\n.rounded-tr {\n border-top-right-radius: 0.25rem;\n}\n.rounded-br {\n border-bottom-right-radius: 0.25rem;\n}\n.rounded-bl {\n border-bottom-left-radius: 0.25rem;\n}\n.rounded-tl {\n border-top-left-radius: 0.25rem;\n}\n.rounded-t {\n border-top-right-radius: 0.25rem;\n border-top-left-radius: 0.25rem;\n}\n.grid {\n display: grid;\n}\n.contents {\n display: contents;\n}\n.flex {\n display: flex;\n}\n.flex-col {\n flex-direction: column;\n}\n.flex-wrap {\n flex-wrap: wrap;\n}\n.grow {\n flex-grow: 1;\n}\n.shrink {\n flex-shrink: 1;\n}\n.shrink-0 {\n flex-shrink: 0;\n}\n.basis-0 {\n flex-basis: 0;\n}\n.max-w-32 {\n max-width: 8rem;\n}\n.items-center {\n align-items: center;\n}\n.items-end {\n align-items: flex-end;\n}\n.items-start {\n align-items: flex-start;\n}\n.justify-center {\n justify-content: center;\n}\n.justify-between {\n justify-content: space-between;\n}\n.justify-end {\n justify-content: flex-end;\n}\n.justify-start {\n justify-content: flex-start;\n}\n.whitespace-nowrap {\n white-space: nowrap;\n}\n.underline {\n text-decoration: underline;\n}\n.no-underline {\n text-decoration: none;\n}\n.text-nowrap {\n white-space: nowrap;\n}\n.text-white {\n color: white;\n}\n.text-xxs {\n font-size: 0.625rem;\n}\n.text-xs {\n font-size: 0.75rem;\n}\n.text-sm {\n font-size: 0.875rem;\n}\n.text-base {\n font-size: 1rem;\n}\n.text-lg {\n font-size: 1.125rem;\n}\n.text-xl {\n font-size: 1.25rem;\n}\n.text-2xl {\n font-size: 1.5rem;\n}\n.text-3xl {\n font-size: 2rem;\n}\n.text-4xl {\n font-size: 2.5rem;\n}\n.text-5xl {\n font-size: 3rem;\n}\n.text-left {\n text-align: left;\n}\n.text-center {\n text-align: center;\n}\n.text-right {\n text-align: right;\n}\n.text-gray {\n color: #808080 !important;\n}\n.text-gray-400 {\n color: #9ca3af !important;\n}\n.text-gray-500 {\n color: #6b7280 !important;\n}\n.text-blue-gray {\n color: #717d94;\n}\n.text-primary {\n color: #ff6e1c;\n}\n.text-secondary {\n color: #4956dc;\n}\n.capitalize {\n text-transform: capitalize !important;\n}\n.font-normal {\n font-weight: 400;\n}\n.font-medium {\n font-weight: 500;\n}\n.font-bold {\n font-weight: 700;\n}\n.bg-transparent {\n background-color: transparent;\n}\n.bg-white {\n background-color: white;\n}\n.border-collapse {\n border-collapse: collapse;\n}\n.border-t-solid {\n border-top-style: solid;\n}\n.border-b-solid {\n border-bottom-style: solid;\n}\n.border-t-1 {\n border-top-width: 1px;\n}\n.border-b-1 {\n border-bottom-width: 1px;\n}\n.gap-0 {\n gap: 0 !important;\n}\n.gap-0\\.5 {\n gap: 0.125rem;\n}\n.gap-1 {\n gap: 0.25rem;\n}\n.gap-2 {\n gap: 0.5rem;\n}\n.gap-3 {\n gap: 0.75rem;\n}\n.gap-4 {\n gap: 1rem !important;\n}\n.gap-5 {\n gap: 1.25rem;\n}\n.gap-6 {\n gap: 1.5rem !important;\n}\n.gap-8 {\n gap: 2rem !important;\n}\n.gap-12 {\n gap: 3rem !important;\n}\n/* Padding Utilities */\n.p-0 {\n padding: 0;\n}\n.p-1 {\n padding: 0.25rem;\n}\n.p-2 {\n padding: 0.5rem;\n}\n.p-3 {\n padding: 0.75rem;\n}\n.p-4 {\n padding: 1rem;\n}\n.p-5 {\n padding: 1.25rem;\n}\n.p-6 {\n padding: 1.5rem;\n}\n.p-8 {\n padding: 2rem;\n}\n/* Padding X Utilities */\n.px-0 {\n padding-right: 0;\n padding-left: 0;\n}\n.px-1 {\n padding-right: 0.25rem;\n padding-left: 0.25rem;\n}\n.px-2 {\n padding-right: 0.5rem;\n padding-left: 0.5rem;\n}\n.px-3 {\n padding-right: 0.75rem;\n padding-left: 0.75rem;\n}\n.px-4 {\n padding-right: 1rem;\n padding-left: 1rem;\n}\n.px-5 {\n padding-right: 1.25rem;\n padding-left: 1.25rem;\n}\n.px-6 {\n padding-right: 1.5rem;\n padding-left: 1.5rem;\n}\n.px-8 {\n padding-right: 2rem;\n padding-left: 2rem;\n}\n.px-12 {\n padding-right: 3rem;\n padding-left: 3rem;\n}\n/* Padding Y Utilities */\n.py-0 {\n padding-top: 0;\n padding-bottom: 0;\n}\n.py-1 {\n padding-top: 0.25rem;\n padding-bottom: 0.25rem;\n}\n.py-2 {\n padding-top: 0.5rem;\n padding-bottom: 0.5rem;\n}\n.py-3 {\n padding-top: 0.75rem;\n padding-bottom: 0.75rem;\n}\n.py-4 {\n padding-top: 1rem;\n padding-bottom: 1rem;\n}\n.py-6 {\n padding-top: 1.5rem;\n padding-bottom: 1.5rem;\n}\n/* Padding Top Utilities */\n.pt-0 {\n padding-top: 0;\n}\n.pt-1 {\n padding-top: 0.25rem;\n}\n.pt-2 {\n padding-top: 0.5rem;\n}\n.pt-3 {\n padding-top: 0.75rem;\n}\n.pt-4 {\n padding-top: 1rem;\n}\n.pt-5 {\n padding-top: 1.25rem;\n}\n.pt-6 {\n padding-top: 1.5rem;\n}\n.pt-8 {\n padding-top: 2rem;\n}\n/* Padding Right Utilities */\n.pr-0 {\n padding-right: 0;\n}\n.pr-4 {\n padding-right: 1rem;\n}\n.pr-8 {\n padding-right: 2rem;\n}\n/* Padding Bottom Utilities */\n.pb-0 {\n padding-bottom: 0;\n}\n.pb-1 {\n padding-bottom: 0.25rem;\n}\n.pb-2 {\n padding-bottom: 0.5rem;\n}\n.pb-3 {\n padding-bottom: 0.75rem;\n}\n.pb-4 {\n padding-bottom: 1rem;\n}\n.pb-5 {\n padding-bottom: 1.25rem;\n}\n.pb-6 {\n padding-bottom: 1.5rem;\n}\n.pb-8 {\n padding-bottom: 2rem;\n}\n/* Padding Left Utilities */\n.pl-0 {\n padding-left: 0;\n}\n.pl-1 {\n padding-left: 0.25rem;\n}\n.pl-2 {\n padding-left: 0.5rem;\n}\n.pl-4 {\n padding-left: 1rem;\n}\n.pl-8 {\n padding-left: 2rem;\n}\n/* Space Utilities */\n.space-y-2 {\n gap: 0.5rem;\n}\n.space-y-4 {\n gap: 1rem;\n}\n.space-y-8 {\n gap: 2rem;\n}\n/* Margin Utilities */\n.ml-2 {\n margin-left: 0.5rem;\n}\n.ml-6 {\n margin-left: 1.5rem;\n}\n.ml-8 {\n margin-left: 2rem;\n}\n.mb-0 {\n margin-bottom: 0;\n}\n.mb-1 {\n margin-bottom: 0.25rem;\n}\n.mb-2 {\n margin-bottom: 0.5rem;\n}\n.mb-3 {\n margin-bottom: 0.75rem;\n}\n.mb-4 {\n margin-bottom: 1rem;\n}\n.mb-5 {\n margin-bottom: 1.25rem;\n}\n.mb-6 {\n margin-bottom: 1.5rem;\n}\n.mb-8 {\n margin-bottom: 2rem;\n}\n.mr-2 {\n margin-right: 0.5rem;\n}\n.mr-4 {\n margin-right: 1rem;\n}\n.mr-6 {\n margin-right: 1.5rem;\n}\n.mr-8 {\n margin-right: 2rem;\n}\n.mt-0 {\n margin-top: 0;\n}\n.mt-1 {\n margin-top: 0.25rem;\n}\n.mt-2 {\n margin-top: 0.5rem;\n}\n.mt-4 {\n margin-top: 1rem;\n}\n.mt-5 {\n margin-top: 1.25rem;\n}\n.mt-6 {\n margin-top: 1.5rem;\n}\n.mt-8 {\n margin-top: 2rem;\n}\n.my-1 {\n margin-top: 0.25rem;\n margin-bottom: 0.25rem;\n}\n.my-2 {\n margin-top: 0.5rem;\n margin-bottom: 0.5rem;\n}\n.my-4 {\n margin-top: 1rem;\n margin-bottom: 1rem;\n}\n.my-8 {\n margin-top: 2rem;\n margin-bottom: 2rem;\n}\n.my-12 {\n margin-top: 3rem;\n margin-bottom: 3rem;\n}\n.mx-2 {\n margin-left: 0.5rem;\n margin-right: 0.5rem;\n}\n.mx-4 {\n margin-left: 1rem;\n margin-right: 1rem;\n}\n.mx-8 {\n margin-left: 2rem;\n margin-right: 2rem;\n}\n.w-full {\n width: 100%;\n}\n.w-1\\/2 {\n width: 50%;\n}\n.w-1\\/3 {\n width: 33.333333%;\n}\n.w-2\\/3 {\n width: 66.666667%;\n}\n.w-4 {\n width: 1rem;\n}\n.w-14 {\n width: 3.5rem;\n /* 56px */\n}\n.w-20 {\n width: 5rem;\n /* 80px */\n}\n.h-full {\n height: 100%;\n}\n.h-4 {\n height: 1rem;\n}\n.h-5 {\n height: 1.25rem;\n}\n.h-6 {\n height: 1.5rem;\n}\n.h-8 {\n height: 2rem;\n}\n.h-14 {\n height: 3.5rem;\n /* 56px */\n}\n.h-80 {\n height: 20rem;\n}\n.h-96 {\n height: 24rem;\n}\n.cursor-pointer {\n cursor: pointer;\n}\n.cursor-not-allowed {\n cursor: not-allowed;\n}\n.grid-cols-2 {\n grid-template-columns: repeat(2, minmax(0, 1fr));\n}\n.grid-cols-3 {\n grid-template-columns: repeat(3, minmax(0, 1fr));\n}\n.grid-cols-4 {\n grid-template-columns: repeat(4, minMax(0, 1fr));\n}\n.col-span-2 {\n grid-column: span 2 / span 2;\n}\n.col-span-3 {\n grid-column: span 3 / span 3;\n}\n.col-span-4 {\n grid-column: span 4 / span 4;\n}\n.col-span-full {\n grid-column: 1 / -1;\n}\n/* Background colors */\n.bg-black {\n background-color: #000000;\n}\n.bg-slate-50 {\n background-color: #f8fafc;\n}\n.bg-slate-100 {\n background-color: #f1f5f9;\n}\n.bg-slate-200 {\n background-color: #e2e8f0;\n}\n.bg-slate-300 {\n background-color: #cbd5e1;\n}\n.bg-slate-400 {\n background-color: #94a3b8;\n}\n.bg-slate-500 {\n background-color: #64748b;\n}\n.bg-slate-600 {\n background-color: #475569;\n}\n.bg-slate-700 {\n background-color: #334155;\n}\n.bg-slate-800 {\n background-color: #1e293b;\n}\n.bg-slate-900 {\n background-color: #0f172a;\n}\n.bg-slate-950 {\n background-color: #020617;\n}\n.bg-gray-50 {\n background-color: #f9fafb;\n}\n.bg-gray-100 {\n background-color: #f3f4f6;\n}\n.bg-gray-200 {\n background-color: #e5e7eb;\n}\n.bg-gray-300 {\n background-color: #d1d5db;\n}\n.bg-gray-400 {\n background-color: #9ca3af;\n}\n.bg-gray-500 {\n background-color: #6b7280;\n}\n.bg-gray-600 {\n background-color: #4b5563;\n}\n.bg-gray-700 {\n background-color: #374151;\n}\n.bg-gray-800 {\n background-color: #1f2937;\n}\n.bg-gray-900 {\n background-color: #111827;\n}\n.bg-gray-950 {\n background-color: #030712;\n}\n.bg-green-200 {\n background-color: #a7f3d0;\n}\n.bg-green-500 {\n background-color: #10b981;\n}\n.bg-blue-50 {\n background-color: #eff6ff;\n}\n.bg-blue-100 {\n background-color: #dbeafe;\n}\n.bg-blue-200 {\n background-color: #bfdbfe;\n}\n.bg-blue-300 {\n background-color: #93c5fd;\n}\n.bg-blue-400 {\n background-color: #60a5fa;\n}\n.bg-blue-500 {\n background-color: #3b82f6;\n}\n.bg-blue-600 {\n background-color: #2563eb;\n}\n.bg-blue-700 {\n background-color: #1d4ed8;\n}\n.bg-blue-800 {\n background-color: #1e40af;\n}\n.bg-blue-900 {\n background-color: #1e3a8a;\n}\n.bg-blue-950 {\n background-color: #172554;\n}\n.bg-orange-50 {\n background-color: #fff7ed;\n}\n.bg-orange-100 {\n background-color: #ffedd5;\n}\n.bg-orange-200 {\n background-color: #fed7aa;\n}\n.bg-orange-300 {\n background-color: #fdba74;\n}\n.bg-orange-400 {\n background-color: #fb923c;\n}\n.bg-orange-500 {\n background-color: #f97316;\n}\n.bg-orange-600 {\n background-color: #ea580c;\n}\n.bg-orange-700 {\n background-color: #c2410c;\n}\n.bg-orange-800 {\n background-color: #9a3412;\n}\n.bg-orange-900 {\n background-color: #7c2d12;\n}\n.bg-orange-950 {\n background-color: #431407;\n}\n.bg-yellow-200 {\n background-color: #fde68a;\n}\n.bg-red-200 {\n background-color: #fecaca;\n}\n/* Text colors */\n.text-black {\n color: #000000;\n}\n.text-white {\n color: #ffffff;\n}\n.text-slate-50 {\n color: #f8fafc;\n}\n.text-slate-100 {\n color: #f1f5f9;\n}\n.text-slate-200 {\n color: #e2e8f0;\n}\n.text-slate-300 {\n color: #cbd5e1;\n}\n.text-slate-400 {\n color: #94a3b8;\n}\n.text-slate-500 {\n color: #64748b;\n}\n.text-slate-600 {\n color: #475569;\n}\n.text-slate-700 {\n color: #334155;\n}\n.text-slate-800 {\n color: #1e293b;\n}\n.text-slate-900 {\n color: #0f172a;\n}\n.text-slate-950 {\n color: #020617;\n}\n.text-gray-50 {\n color: #f9fafb;\n}\n.text-gray-100 {\n color: #f3f4f6;\n}\n.text-gray-200 {\n color: #e5e7eb;\n}\n.text-gray-300 {\n color: #d1d5db;\n}\n.text-gray-400 {\n color: #9ca3af;\n}\n.text-gray-500 {\n color: #6b7280;\n}\n.text-gray-600 {\n color: #4b5563;\n}\n.text-gray-700 {\n color: #374151;\n}\n.text-gray-800 {\n color: #1f2937;\n}\n.text-gray-900 {\n color: #111827;\n}\n.text-gray-950 {\n color: #030712;\n}\n.text-green-600 {\n color: #059669;\n}\n.text-green-700 {\n color: #047857;\n}\n.text-blue-50 {\n color: #eff6ff;\n}\n.text-blue-100 {\n color: #dbeafe;\n}\n.text-blue-200 {\n color: #bfdbfe;\n}\n.text-blue-300 {\n color: #93c5fd;\n}\n.text-blue-400 {\n color: #60a5fa;\n}\n.text-blue-500 {\n color: #3b82f6;\n}\n.text-blue-600 {\n color: #2563eb;\n}\n.text-blue-700 {\n color: #1d4ed8;\n}\n.text-blue-800 {\n color: #1e40af;\n}\n.text-blue-900 {\n color: #1e3a8a;\n}\n.text-blue-950 {\n color: #172554;\n}\n.text-orange-50 {\n color: #fff7ed;\n}\n.text-orange-100 {\n color: #ffedd5;\n}\n.text-orange-200 {\n color: #fed7aa;\n}\n.text-orange-300 {\n color: #fdba74;\n}\n.text-orange-400 {\n color: #fb923c;\n}\n.text-orange-500 {\n color: #f97316;\n}\n.text-orange-600 {\n color: #ea580c;\n}\n.text-orange-700 {\n color: #c2410c;\n}\n.text-orange-800 {\n color: #9a3412;\n}\n.text-orange-900 {\n color: #7c2d12;\n}\n.text-orange-950 {\n color: #431407;\n}\n.text-yellow-500 {\n color: #f59e0b;\n}\n.text-yellow-700 {\n color: #b45309;\n}\n.text-red-500 {\n color: #ef4444;\n}\n.text-red-700 {\n color: #b91c1c;\n}\n.border {\n border-width: 1px;\n}\n.border-2 {\n border-width: 2px;\n}\n.border-l {\n border-left-width: 1px;\n}\n.border-dashed {\n border-style: dashed;\n}\n.border-solid {\n border-style: solid;\n}\n.border-slate-50 {\n border-color: #f8fafc;\n}\n.border-slate-100 {\n border-color: #f1f5f9;\n}\n.border-slate-200 {\n border-color: #e2e8f0;\n}\n.border-slate-300 {\n border-color: #cbd5e1;\n}\n.border-slate-400 {\n border-color: #94a3b8;\n}\n.border-slate-500 {\n border-color: #64748b;\n}\n.border-slate-600 {\n border-color: #475569;\n}\n.border-slate-700 {\n border-color: #334155;\n}\n.border-slate-800 {\n border-color: #1e293b;\n}\n.border-slate-900 {\n border-color: #0f172a;\n}\n.border-slate-950 {\n border-color: #020617;\n}\n.border-gray-400 {\n border-color: #9ca3af;\n}\n.border-gray-500 {\n border-color: #6b7280;\n}\n.origin-center {\n transform-origin: center;\n}\n.rotate-45 {\n transform: rotate(45deg);\n}\n.translate-x-2\\/4 {\n transform: translateX(50%);\n}\n.-translate-x-2\\/4 {\n transform: translateX(-50%);\n}\n.translate-y-2\\/4 {\n transform: translateY(50%);\n}\n.translate-y-full {\n transform: translateY(100%);\n}\n.-translate-y-full {\n transform: translateY(-100%);\n}\n.shadow-sm {\n box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n}\n.shadow {\n box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);\n}\n.shadow-md {\n box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);\n}\n.shadow-lg {\n box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);\n}\n.shadow-xl {\n box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);\n}\n.shadow-2xl {\n box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);\n}\n.shadow-inner {\n box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.05);\n}\n.shadow-none {\n box-shadow: 0 0 #0000;\n}\n@media (min-width: 768px) {\n .sm\\:flex {\n display: flex !important;\n }\n .sm\\:hidden {\n display: none !important;\n }\n}\n* {\n margin: 0;\n padding: 0;\n box-sizing: border-box !important;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n line-height: 1.15;\n}\nbody {\n color: #232323;\n background-color: #f8fafc;\n}\nth {\n font-weight: normal;\n}\ncode {\n font-family: source-code-pro, Menlo, Monaco, Consolas, \"Courier New\", monospace;\n}\n@media only screen and (max-width: 768px) {\n select,\n textarea,\n input[type=\"text\"],\n input[type=\"password\"],\n input[type=\"datetime\"],\n input[type=\"datetime-local\"],\n input[type=\"date\"],\n input[type=\"month\"],\n input[type=\"time\"],\n input[type=\"week\"],\n input[type=\"number\"],\n input[type=\"email\"],\n input[type=\"url\"],\n input[type=\"search\"],\n input[type=\"tel\"],\n input[type=\"color\"] {\n font-size: 16px !important;\n }\n}\n@keyframes App-logo-spin {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}\n";
|
|
148
|
-
styleInject(css_248z);
|
|
149
|
-
|
|
150
149
|
var IconContext = /*#__PURE__*/React.createContext({});
|
|
151
150
|
var Context = IconContext;
|
|
152
151
|
|
|
@@ -1582,12 +1581,16 @@ var BrandContext = React.createContext({
|
|
|
1582
1581
|
|
|
1583
1582
|
var MUTATION$9 = "{\n entityBranding {\n accentColor\n brandColor\n topNavImageUrl\n }\n }";
|
|
1584
1583
|
var getBranding = function (_a) {
|
|
1585
|
-
var token = _a.token,
|
|
1584
|
+
var token = _a.token, apiHost = _a.apiHost;
|
|
1586
1585
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
1587
1586
|
var response;
|
|
1588
1587
|
return __generator(this, function (_b) {
|
|
1589
1588
|
switch (_b.label) {
|
|
1590
|
-
case 0: return [4 /*yield*/, common.gqlRequest({
|
|
1589
|
+
case 0: return [4 /*yield*/, common.gqlRequest({
|
|
1590
|
+
query: MUTATION$9,
|
|
1591
|
+
token: token,
|
|
1592
|
+
apiHost: apiHost,
|
|
1593
|
+
})];
|
|
1591
1594
|
case 1:
|
|
1592
1595
|
response = _b.sent();
|
|
1593
1596
|
return [2 /*return*/, response === null || response === void 0 ? void 0 : response.entityBranding];
|
|
@@ -1596,78 +1599,21 @@ var getBranding = function (_a) {
|
|
|
1596
1599
|
});
|
|
1597
1600
|
};
|
|
1598
1601
|
|
|
1599
|
-
var
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
BreakpointNumbers[BreakpointNumbers["lg"] = 1200] = "lg";
|
|
1605
|
-
BreakpointNumbers[BreakpointNumbers["xl"] = 1400] = "xl";
|
|
1606
|
-
BreakpointNumbers[BreakpointNumbers["xxl"] = 2000] = "xxl";
|
|
1607
|
-
})(BreakpointNumbers || (BreakpointNumbers = {}));
|
|
1608
|
-
[
|
|
1609
|
-
BreakpointNumbers.xs,
|
|
1610
|
-
BreakpointNumbers.sm,
|
|
1611
|
-
BreakpointNumbers.md,
|
|
1612
|
-
BreakpointNumbers.lg,
|
|
1613
|
-
BreakpointNumbers.xl,
|
|
1614
|
-
BreakpointNumbers.xxl,
|
|
1615
|
-
];
|
|
1616
|
-
var useIsMobile = function (window) {
|
|
1617
|
-
var _a = React.useState({
|
|
1618
|
-
width: window.innerWidth,
|
|
1619
|
-
height: window.innerHeight,
|
|
1620
|
-
}), windowSize = _a[0], setWindowSize = _a[1];
|
|
1621
|
-
React.useEffect(function () {
|
|
1622
|
-
var handleResize = function () {
|
|
1623
|
-
setWindowSize({
|
|
1624
|
-
width: window.innerWidth,
|
|
1625
|
-
height: window.innerHeight,
|
|
1626
|
-
});
|
|
1627
|
-
};
|
|
1628
|
-
window.addEventListener("resize", handleResize);
|
|
1629
|
-
handleResize();
|
|
1630
|
-
return function () { return window.removeEventListener("resize", handleResize); };
|
|
1631
|
-
}, []);
|
|
1632
|
-
return windowSize.width < BreakpointNumbers.sm;
|
|
1633
|
-
};
|
|
1634
|
-
|
|
1635
|
-
var CURRENT_USER_DATA_QUERY = "{\n company {\n name\n }\n currentUser {\n authObjectName\n entityId\n payload {\n returnUrl\n }\n privacyUrl\n termsUrl\n }\n }";
|
|
1636
|
-
var getCurrentUserData = function (_a) {
|
|
1637
|
-
var token = _a.token, subdomain = _a.subdomain;
|
|
1638
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
1639
|
-
var response;
|
|
1640
|
-
var _b, _c, _d, _e, _f, _g, _h;
|
|
1641
|
-
return __generator(this, function (_j) {
|
|
1642
|
-
switch (_j.label) {
|
|
1643
|
-
case 0: return [4 /*yield*/, common.gqlRequest({
|
|
1644
|
-
query: CURRENT_USER_DATA_QUERY,
|
|
1645
|
-
token: token,
|
|
1646
|
-
subdomain: subdomain,
|
|
1647
|
-
})];
|
|
1648
|
-
case 1:
|
|
1649
|
-
response = _j.sent();
|
|
1650
|
-
return [2 /*return*/, {
|
|
1651
|
-
authObjectName: (_b = response === null || response === void 0 ? void 0 : response.currentUser) === null || _b === void 0 ? void 0 : _b.authObjectName,
|
|
1652
|
-
companyName: (_c = response === null || response === void 0 ? void 0 : response.company) === null || _c === void 0 ? void 0 : _c.name,
|
|
1653
|
-
entityId: (_d = response === null || response === void 0 ? void 0 : response.currentUser) === null || _d === void 0 ? void 0 : _d.entityId,
|
|
1654
|
-
returnUrl: (_f = (_e = response === null || response === void 0 ? void 0 : response.currentUser) === null || _e === void 0 ? void 0 : _e.payload) === null || _f === void 0 ? void 0 : _f.returnUrl,
|
|
1655
|
-
privacyUrl: (_g = response === null || response === void 0 ? void 0 : response.currentUser) === null || _g === void 0 ? void 0 : _g.privacyUrl,
|
|
1656
|
-
termsUrl: (_h = response === null || response === void 0 ? void 0 : response.currentUser) === null || _h === void 0 ? void 0 : _h.termsUrl,
|
|
1657
|
-
}];
|
|
1658
|
-
}
|
|
1659
|
-
});
|
|
1602
|
+
var createGraphQLClient = function (token, apiHost) {
|
|
1603
|
+
return new graphqlRequest.GraphQLClient(apiHost + "/graphql", {
|
|
1604
|
+
headers: {
|
|
1605
|
+
Authorization: token,
|
|
1606
|
+
},
|
|
1660
1607
|
});
|
|
1661
1608
|
};
|
|
1662
1609
|
|
|
1663
1610
|
var BunnyContext = React.createContext({});
|
|
1664
|
-
|
|
1665
|
-
var queryClient$1 = new reactQuery.QueryClient();
|
|
1611
|
+
var extraQueryClient = new reactQuery.QueryClient();
|
|
1666
1612
|
// Every component shares similar props and functionality, which this wrapper handles.
|
|
1667
1613
|
function BunnyProvider(_a) {
|
|
1668
|
-
var
|
|
1669
|
-
var graphQLClient =
|
|
1670
|
-
var isMobile = useIsMobile(window);
|
|
1614
|
+
var accountId = _a.accountId, children = _a.children, _b = _a.darkMode, darkMode = _b === void 0 ? false : _b, onErrorNavigate = _a.onErrorNavigate, queryClient = _a.queryClient, apiHost = _a.apiHost, token = _a.token, window = _a.window;
|
|
1615
|
+
var graphQLClient = createGraphQLClient(token, apiHost || "");
|
|
1616
|
+
var isMobile = common.useIsMobile(window);
|
|
1671
1617
|
var _c = React.useState(undefined), branding = _c[0], setBranding = _c[1];
|
|
1672
1618
|
// ====== START - Copied straight from PageContainer.tsx ========
|
|
1673
1619
|
var entityBranding = React.useMemo(function () {
|
|
@@ -1677,7 +1623,7 @@ function BunnyProvider(_a) {
|
|
|
1677
1623
|
? "#" + ((_a = branding === null || branding === void 0 ? void 0 : branding.brandColor) === null || _a === void 0 ? void 0 : _a.toString(16))
|
|
1678
1624
|
: common.DEFAULT_BRAND_COLOR;
|
|
1679
1625
|
var secondaryColor = common.DEFAULT_SECONDARY_COLOR;
|
|
1680
|
-
if (!isMobile && common.
|
|
1626
|
+
if (!isMobile && common.isColorTooDark(branding === null || branding === void 0 ? void 0 : branding.accentColor))
|
|
1681
1627
|
secondaryColor = "#ffffff";
|
|
1682
1628
|
var topNavImageUrl = (branding === null || branding === void 0 ? void 0 : branding.topNavImageUrl) || common.DEFAULT_TOP_NAV_IMAGE_URL;
|
|
1683
1629
|
var accentColor = (branding === null || branding === void 0 ? void 0 : branding.accentColor) || common.DEFAULT_ACCENT_COLOR;
|
|
@@ -1699,13 +1645,14 @@ function BunnyProvider(_a) {
|
|
|
1699
1645
|
};
|
|
1700
1646
|
}, []);
|
|
1701
1647
|
return (jsxRuntime.jsxs(BunnyContext.Provider, __assign({ value: {
|
|
1702
|
-
subdomain: subdomain,
|
|
1703
|
-
graphQLClient: graphQLClient,
|
|
1704
|
-
window: window,
|
|
1705
|
-
token: token,
|
|
1706
1648
|
accountId: accountId,
|
|
1707
1649
|
darkMode: darkMode,
|
|
1708
|
-
|
|
1650
|
+
graphQLClient: graphQLClient,
|
|
1651
|
+
onErrorNavigate: onErrorNavigate,
|
|
1652
|
+
apiHost: apiHost,
|
|
1653
|
+
token: token,
|
|
1654
|
+
window: window,
|
|
1655
|
+
} }, { children: [jsxRuntime.jsx("div", __assign({ style: { position: "fixed", left: -2000000000 } }, { children: "test" })), jsxRuntime.jsx(reactQuery.QueryClientProvider, __assign({ client: queryClient || extraQueryClient }, { children: jsxRuntime.jsx(recoil.RecoilRoot, { children: jsxRuntime.jsx(BrandContext.Provider, __assign({ value: entityBranding }, { children: jsxRuntime.jsx(antd.ConfigProvider, __assign({ theme: {
|
|
1709
1656
|
algorithm: darkMode
|
|
1710
1657
|
? theme__default["default"].darkAlgorithm
|
|
1711
1658
|
: theme__default["default"].defaultAlgorithm,
|
|
@@ -1733,15 +1680,11 @@ function BunnyProvider(_a) {
|
|
|
1733
1680
|
function SecondaryWrapper(_a) {
|
|
1734
1681
|
var children = _a.children, setBranding = _a.setBranding;
|
|
1735
1682
|
var _b = React.useState(false), interFontLoaded = _b[0], setInterFontLoaded = _b[1];
|
|
1736
|
-
var _c = React.useContext(BunnyContext),
|
|
1683
|
+
var _c = React.useContext(BunnyContext), apiHost = _c.apiHost, token = _c.token;
|
|
1737
1684
|
var brandingData = reactQuery.useQuery({
|
|
1738
1685
|
queryKey: common.QueryKeyFactory.default.brandingKey,
|
|
1739
|
-
queryFn: function () { return getBranding({ token: token,
|
|
1686
|
+
queryFn: function () { return getBranding({ token: token, apiHost: apiHost }); },
|
|
1740
1687
|
}).data;
|
|
1741
|
-
var _d = reactQuery.useQuery({
|
|
1742
|
-
queryKey: common.QueryKeyFactory.default.currentUserKey,
|
|
1743
|
-
queryFn: function () { return getCurrentUserData({ token: token }); },
|
|
1744
|
-
}); _d.data; _d.isLoading;
|
|
1745
1688
|
React.useEffect(function () {
|
|
1746
1689
|
if (brandingData) {
|
|
1747
1690
|
setBranding(brandingData);
|
|
@@ -1758,44 +1701,84 @@ function SecondaryWrapper(_a) {
|
|
|
1758
1701
|
return jsxRuntime.jsx(jsxRuntime.Fragment, { children: children });
|
|
1759
1702
|
}
|
|
1760
1703
|
|
|
1761
|
-
var
|
|
1704
|
+
var useAjax = function (onError) {
|
|
1705
|
+
return function (url, method, callback, token, bodyData) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1706
|
+
var response;
|
|
1707
|
+
return __generator(this, function (_a) {
|
|
1708
|
+
switch (_a.label) {
|
|
1709
|
+
case 0: return [4 /*yield*/, fetch(url, {
|
|
1710
|
+
method: method,
|
|
1711
|
+
body: bodyData,
|
|
1712
|
+
headers: {
|
|
1713
|
+
"Content-type": "application/json; charset=utf-8",
|
|
1714
|
+
Authorization: "Bearer ".concat(token),
|
|
1715
|
+
},
|
|
1716
|
+
})];
|
|
1717
|
+
case 1:
|
|
1718
|
+
response = _a.sent();
|
|
1719
|
+
if (response.status !== 200 && response.status !== 201) {
|
|
1720
|
+
return [2 /*return*/, response.json().then(function (data) {
|
|
1721
|
+
if (response.status === 401) {
|
|
1722
|
+
console.error("expired token");
|
|
1723
|
+
onError === null || onError === void 0 ? void 0 : onError("expired token");
|
|
1724
|
+
}
|
|
1725
|
+
else {
|
|
1726
|
+
throw new Error(data === null || data === void 0 ? void 0 : data.message);
|
|
1727
|
+
}
|
|
1728
|
+
return;
|
|
1729
|
+
})];
|
|
1730
|
+
}
|
|
1731
|
+
return [2 /*return*/, callback(response)];
|
|
1732
|
+
}
|
|
1733
|
+
});
|
|
1734
|
+
}); };
|
|
1735
|
+
};
|
|
1736
|
+
var useDownloadFile = function (id, onError) {
|
|
1737
|
+
var ajax = useAjax(onError);
|
|
1738
|
+
return function (url, token) {
|
|
1739
|
+
return ajax(url + (id ? "?id=".concat(id) : ""), "GET", function (rsp) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1740
|
+
var blob, file, contentDisposition, anchor, filenameRegex, matches;
|
|
1741
|
+
return __generator(this, function (_a) {
|
|
1742
|
+
switch (_a.label) {
|
|
1743
|
+
case 0: return [4 /*yield*/, rsp.blob()];
|
|
1744
|
+
case 1:
|
|
1745
|
+
blob = _a.sent();
|
|
1746
|
+
file = window.URL.createObjectURL(blob);
|
|
1747
|
+
contentDisposition = rsp.headers.get("content-disposition");
|
|
1748
|
+
anchor = document.createElement("a");
|
|
1749
|
+
anchor.href = file;
|
|
1750
|
+
if (contentDisposition &&
|
|
1751
|
+
contentDisposition.indexOf("attachment") !== -1) {
|
|
1752
|
+
filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
|
|
1753
|
+
matches = filenameRegex.exec(contentDisposition);
|
|
1754
|
+
if (matches != null && matches[1]) {
|
|
1755
|
+
anchor.setAttribute("download", matches[1].replace(/['"]/g, ""));
|
|
1756
|
+
}
|
|
1757
|
+
}
|
|
1758
|
+
anchor.click();
|
|
1759
|
+
return [2 /*return*/];
|
|
1760
|
+
}
|
|
1761
|
+
});
|
|
1762
|
+
}); }, token);
|
|
1763
|
+
};
|
|
1764
|
+
};
|
|
1765
|
+
|
|
1766
|
+
var MarkupContainer = styled__default["default"].div(templateObject_1$8 || (templateObject_1$8 = __makeTemplateObject(["\n span {\n width: 100%;\n }\n"], ["\n span {\n width: 100%;\n }\n"])));
|
|
1762
1767
|
var InvoiceQuoteView = function (_a) {
|
|
1763
|
-
var children = _a.children, formattedInvoice = _a.formattedInvoice, html = _a.html,
|
|
1764
|
-
var downloadFile =
|
|
1768
|
+
var children = _a.children, formattedInvoice = _a.formattedInvoice, html = _a.html, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick, onDownloadError = _a.onDownloadError;
|
|
1769
|
+
var downloadFile = useDownloadFile(formattedInvoice === null || formattedInvoice === void 0 ? void 0 : formattedInvoice.id, onDownloadError);
|
|
1765
1770
|
var secondaryColor = React.useContext(BrandContext).secondaryColor;
|
|
1766
|
-
var _b = React.useContext(BunnyContext), token = _b.token,
|
|
1771
|
+
var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, window = _b.window;
|
|
1772
|
+
var isMobile = common.useIsMobile(window);
|
|
1767
1773
|
return (jsxRuntime.jsxs("div", __assign({ className: "flex flex-col w-full grow ".concat(isMobile ? "overflow-hidden" : "") }, { children: [formattedInvoice ? (jsxRuntime.jsxs("div", __assign({ className: "flex justify-between items-center pb-4 ".concat(isMobile ? "shadow-padding-x" : ""), id: "acceptance" }, { children: [jsxRuntime.jsx("div", { children: onBackButtonClick ? (jsxRuntime.jsx(antd.Button, __assign({ className: "text-xs pl-0", onClick: onBackButtonClick, style: {
|
|
1768
1774
|
color: secondaryColor,
|
|
1769
1775
|
}, type: "link" }, { children: backButtonName || "Back" }))) : null }), jsxRuntime.jsx(antd.Button, __assign({ icon: jsxRuntime.jsx(DownloadOutlined$1, {}), onClick: function () {
|
|
1770
|
-
return downloadFile(
|
|
1776
|
+
return downloadFile(apiHost + "/api/pdf/invoice/" + formattedInvoice.id, token);
|
|
1771
1777
|
} }, { children: "Download" }))] }))) : null, isMobile ? (jsxRuntime.jsxs(MarkupContainer, __assign({ className: "flex flex-col gap-4 grow w-full shadow-padding-xb overflow-auto" }, { children: [jsxRuntime.jsx(interweave.Markup, { content: html }), children] }))) : (jsxRuntime.jsxs(MarkupContainer, __assign({ className: "flex flex-col gap-4 p-2 w-full bg-white shadow-md rounded-md", style: {
|
|
1772
1778
|
minWidth: "750px",
|
|
1773
1779
|
} }, { children: [jsxRuntime.jsx(interweave.Markup, { content: html }), children] })))] })));
|
|
1774
1780
|
};
|
|
1775
|
-
var templateObject_1$
|
|
1776
|
-
|
|
1777
|
-
var MUTATION$8 = "\nquery FormattedInvoice($id: ID) {\n formattedInvoice(id: $id) {\n amount\n amountDue\n amountPaid\n billingCity\n billingCountry\n billingState\n billingStreet\n billingZip\n createdAt\n credits\n currency\n currencyId\n currencySymbol\n customerBillingCity\n customerBillingContact\n customerBillingCountry\n customerBillingState\n customerBillingStreet\n customerBillingZip\n customerName\n dueAt\n html\n id\n isLegacy\n netPaymentDays\n number\n payableId\n poNumber\n printedState\n smallUnitAmountDue\n state\n subscriptionEndDate\n subscriptionStartDate\n subtotal\n taxAmount\n taxNumber\n uuid\n vendorName\n formattedLines {\n amount\n billingPeriodEnd\n billingPeriodStart\n chargeType\n discount\n frequency\n lineText\n position\n price\n priceDecimals\n priceListChargeId\n priceListChargeName\n priceListName\n prorationRate\n quantity\n unitOfMeasure\n priceTiers {\n price\n starts\n }\n }\n }\n}";
|
|
1778
|
-
var getFormattedInvoice = function (_a) {
|
|
1779
|
-
var id = _a.id, token = _a.token, subdomain = _a.subdomain;
|
|
1780
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
1781
|
-
var vars, response;
|
|
1782
|
-
return __generator(this, function (_b) {
|
|
1783
|
-
switch (_b.label) {
|
|
1784
|
-
case 0:
|
|
1785
|
-
vars = { id: id };
|
|
1786
|
-
return [4 /*yield*/, common.gqlRequest({
|
|
1787
|
-
query: MUTATION$8,
|
|
1788
|
-
token: token,
|
|
1789
|
-
vars: vars,
|
|
1790
|
-
subdomain: subdomain,
|
|
1791
|
-
})];
|
|
1792
|
-
case 1:
|
|
1793
|
-
response = _b.sent();
|
|
1794
|
-
return [2 /*return*/, response === null || response === void 0 ? void 0 : response.formattedInvoice];
|
|
1795
|
-
}
|
|
1796
|
-
});
|
|
1797
|
-
});
|
|
1798
|
-
};
|
|
1781
|
+
var templateObject_1$8;
|
|
1799
1782
|
|
|
1800
1783
|
var paymentMethodsQuery = "query paymentMethods ($filter: String, $first: Int, $sort: String) {\n paymentMethods (filter: $filter, first: $first, sort: $sort) {\n nodes {\n id\n disabled\n pluginId\n accountId\n expirationDate\n plugin {\n guid\n id\n }\n state\n metadata {\n issuer\n identifier\n kind\n description\n icon\n }\n }\n }\n}";
|
|
1801
1784
|
var usePaymentMethod = function (graphQLClient) {
|
|
@@ -1833,7 +1816,7 @@ var PaymentOption = function (_a) {
|
|
|
1833
1816
|
? "var(--row-background-dark) border-gray-500"
|
|
1834
1817
|
: "bg-slate-50 border-slate-200", " border"), onClick: function () { return onClick(paymentOption); } }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex gap-2 items-center" }, { children: [jsxRuntime.jsx(antd.Checkbox, { checked: selected, className: darkMode ? "border-gray-400" : "" }), jsxRuntime.jsx(Text$d, { children: name })] })), isAch ? (jsxRuntime.jsx(BankOutlined$1, { className: "text-slate-400" })) : isCard ? (jsxRuntime.jsx(CardIcon, {})) : (jsxRuntime.jsx(CardIcon, {}))] })));
|
|
1835
1818
|
};
|
|
1836
|
-
var PaymentOptionContainer = styled__default["default"].div(templateObject_1$
|
|
1819
|
+
var PaymentOptionContainer = styled__default["default"].div(templateObject_1$7 || (templateObject_1$7 = __makeTemplateObject(["\n transition: border 0.3s ease;\n\n ", "\n\n &:hover {\n border-color: ", ";\n }\n"], ["\n transition: border 0.3s ease;\n\n ", "\n\n &:hover {\n border-color: ", ";\n }\n"])), function (_a) {
|
|
1837
1820
|
var $brandColor = _a.$brandColor, $selected = _a.$selected;
|
|
1838
1821
|
return $selected &&
|
|
1839
1822
|
"\n border-color: ".concat($brandColor, ";\n ");
|
|
@@ -1841,7 +1824,7 @@ var PaymentOptionContainer = styled__default["default"].div(templateObject_1$8 |
|
|
|
1841
1824
|
var $brandColor = _a.$brandColor;
|
|
1842
1825
|
return $brandColor;
|
|
1843
1826
|
});
|
|
1844
|
-
var templateObject_1$
|
|
1827
|
+
var templateObject_1$7;
|
|
1845
1828
|
|
|
1846
1829
|
var PaymentMethodSelector = function (_a) {
|
|
1847
1830
|
var _b, _c;
|
|
@@ -1854,7 +1837,7 @@ var PaymentMethodSelector = function (_a) {
|
|
|
1854
1837
|
};
|
|
1855
1838
|
|
|
1856
1839
|
var createPaymentMethod = function (_a) {
|
|
1857
|
-
var paymentMethodId = _a.paymentMethodId, plugin = _a.plugin, token = _a.token,
|
|
1840
|
+
var paymentMethodId = _a.paymentMethodId, plugin = _a.plugin, token = _a.token, apiHost = _a.apiHost, accountId = _a.accountId;
|
|
1858
1841
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
1859
1842
|
var response;
|
|
1860
1843
|
return __generator(this, function (_b) {
|
|
@@ -1867,7 +1850,7 @@ var createPaymentMethod = function (_a) {
|
|
|
1867
1850
|
account_id: accountId,
|
|
1868
1851
|
},
|
|
1869
1852
|
token: token,
|
|
1870
|
-
|
|
1853
|
+
apiHost: apiHost,
|
|
1871
1854
|
})];
|
|
1872
1855
|
case 1:
|
|
1873
1856
|
response = _b.sent();
|
|
@@ -1878,19 +1861,19 @@ var createPaymentMethod = function (_a) {
|
|
|
1878
1861
|
});
|
|
1879
1862
|
});
|
|
1880
1863
|
};
|
|
1881
|
-
var createSetupIntent = function (plugin, token,
|
|
1864
|
+
var createSetupIntent = function (plugin, token, apiHost, accountId) {
|
|
1882
1865
|
return common.invokePlugin({
|
|
1883
1866
|
plugin: plugin,
|
|
1884
1867
|
method: "create_setup_intent",
|
|
1885
1868
|
token: token,
|
|
1886
|
-
|
|
1869
|
+
apiHost: apiHost,
|
|
1887
1870
|
payload: {
|
|
1888
1871
|
account_id: accountId,
|
|
1889
1872
|
},
|
|
1890
1873
|
});
|
|
1891
1874
|
};
|
|
1892
1875
|
var createPaymentIntent = function (_a) {
|
|
1893
|
-
var payable = _a.payable, savePaymentMethod = _a.savePaymentMethod, memo = _a.memo, plugin = _a.plugin, token = _a.token,
|
|
1876
|
+
var payable = _a.payable, savePaymentMethod = _a.savePaymentMethod, memo = _a.memo, plugin = _a.plugin, token = _a.token, apiHost = _a.apiHost, accountId = _a.accountId;
|
|
1894
1877
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
1895
1878
|
var payload, response;
|
|
1896
1879
|
return __generator(this, function (_b) {
|
|
@@ -1907,7 +1890,7 @@ var createPaymentIntent = function (_a) {
|
|
|
1907
1890
|
method: "create_payment_intent",
|
|
1908
1891
|
payload: payload,
|
|
1909
1892
|
token: token,
|
|
1910
|
-
|
|
1893
|
+
apiHost: apiHost,
|
|
1911
1894
|
})];
|
|
1912
1895
|
case 1:
|
|
1913
1896
|
response = _b.sent();
|
|
@@ -1918,23 +1901,23 @@ var createPaymentIntent = function (_a) {
|
|
|
1918
1901
|
});
|
|
1919
1902
|
});
|
|
1920
1903
|
};
|
|
1921
|
-
var fetchStripeKey = function (plugin, token,
|
|
1904
|
+
var fetchStripeKey = function (plugin, token, apiHost, accountId) {
|
|
1922
1905
|
return common.invokePlugin({
|
|
1923
1906
|
plugin: plugin,
|
|
1924
1907
|
method: "retrieve_config",
|
|
1925
1908
|
token: token,
|
|
1926
|
-
|
|
1909
|
+
apiHost: apiHost,
|
|
1927
1910
|
payload: {
|
|
1928
1911
|
account_id: accountId,
|
|
1929
1912
|
},
|
|
1930
1913
|
});
|
|
1931
1914
|
};
|
|
1932
1915
|
pure.loadStripe.setLoadParameters({ advancedFraudSignals: false });
|
|
1933
|
-
var useStripePlugin = function (plugin, token,
|
|
1916
|
+
var useStripePlugin = function (plugin, token, apiHost, accountId) {
|
|
1934
1917
|
var _a = React.useState(null), stripe = _a[0], setStripe = _a[1];
|
|
1935
|
-
var showErrorNotification = common.
|
|
1918
|
+
var showErrorNotification = common.useErrorNotification();
|
|
1936
1919
|
React.useEffect(function () {
|
|
1937
|
-
fetchStripeKey(plugin, token,
|
|
1920
|
+
fetchStripeKey(plugin, token, apiHost || "", accountId)
|
|
1938
1921
|
.then(function (_a) {
|
|
1939
1922
|
var payload = _a.payload;
|
|
1940
1923
|
return pure.loadStripe(payload.publishable_key).then(setStripe);
|
|
@@ -1952,7 +1935,8 @@ var PaymentContext = React.createContext({});
|
|
|
1952
1935
|
|
|
1953
1936
|
var CheckoutFooter = function (_a) {
|
|
1954
1937
|
var amountDue = _a.amountDue, currencyId = _a.currencyId, isSaving = _a.isSaving, onPaymentSubmit = _a.onPaymentSubmit, onlySavePaymentMethod = _a.onlySavePaymentMethod, noPadding = _a.noPadding;
|
|
1955
|
-
var
|
|
1938
|
+
var window = React.useContext(BunnyContext).window;
|
|
1939
|
+
var isMobile = common.useIsMobile(window);
|
|
1956
1940
|
var displayPayButtonNameAnyways = React.useContext(PaymentContext).displayPayButtonNameAnyways;
|
|
1957
1941
|
var buttonName = function () {
|
|
1958
1942
|
return onlySavePaymentMethod && !displayPayButtonNameAnyways
|
|
@@ -1964,7 +1948,7 @@ var CheckoutFooter = function (_a) {
|
|
|
1964
1948
|
: "Pay";
|
|
1965
1949
|
};
|
|
1966
1950
|
return (jsxRuntime.jsx("div", __assign({ className: "flex justify-end gap-2 ".concat(noPadding ? "" : "pt-6") }, { children: jsxRuntime.jsx(antd.Button, __assign({ className: "w-full", disabled: isSaving, onClick: onPaymentSubmit, size: isMobile ? "large" : "middle", type: "primary" }, { children: "".concat(buttonName()).concat(amountDue && currencyId
|
|
1967
|
-
? " ".concat(common.
|
|
1951
|
+
? " ".concat(common.formatCurrency(amountDue, currencyId))
|
|
1968
1952
|
: "") })) })));
|
|
1969
1953
|
};
|
|
1970
1954
|
|
|
@@ -1973,7 +1957,7 @@ var CheckoutForm = function (_a) {
|
|
|
1973
1957
|
// Hooks
|
|
1974
1958
|
var elements = reactStripeJs.useElements();
|
|
1975
1959
|
var stripe = reactStripeJs.useStripe();
|
|
1976
|
-
var _b = React.useContext(BunnyContext), token = _b.token,
|
|
1960
|
+
var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, accountId = _b.accountId;
|
|
1977
1961
|
if (!payable)
|
|
1978
1962
|
throw new Error("A Payable is required to start checkout");
|
|
1979
1963
|
// Handlers
|
|
@@ -1999,7 +1983,7 @@ var CheckoutForm = function (_a) {
|
|
|
1999
1983
|
savePaymentMethod: true,
|
|
2000
1984
|
plugin: plugin,
|
|
2001
1985
|
token: token,
|
|
2002
|
-
|
|
1986
|
+
apiHost: apiHost || "",
|
|
2003
1987
|
accountId: accountId,
|
|
2004
1988
|
})];
|
|
2005
1989
|
case 2:
|
|
@@ -2055,7 +2039,7 @@ var PaymentMethodForm$1 = function (_a) {
|
|
|
2055
2039
|
// Hooks
|
|
2056
2040
|
var elements = reactStripeJs.useElements();
|
|
2057
2041
|
var stripe = reactStripeJs.useStripe();
|
|
2058
|
-
var _b = React.useContext(BunnyContext), token = _b.token,
|
|
2042
|
+
var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
|
|
2059
2043
|
var accountId = React.useContext(PaymentContext).accountId;
|
|
2060
2044
|
// Handlers
|
|
2061
2045
|
var onSubmit = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -2075,7 +2059,7 @@ var PaymentMethodForm$1 = function (_a) {
|
|
|
2075
2059
|
submitError = (_c.sent()).error;
|
|
2076
2060
|
if (submitError)
|
|
2077
2061
|
throw new Error(submitError.message);
|
|
2078
|
-
return [4 /*yield*/, createSetupIntent(plugin, token,
|
|
2062
|
+
return [4 /*yield*/, createSetupIntent(plugin, token, apiHost, accountId)];
|
|
2079
2063
|
case 2:
|
|
2080
2064
|
response = _c.sent();
|
|
2081
2065
|
if (response.status !== "success")
|
|
@@ -2103,7 +2087,7 @@ var PaymentMethodForm$1 = function (_a) {
|
|
|
2103
2087
|
paymentMethodId: paymentMethodId,
|
|
2104
2088
|
plugin: plugin,
|
|
2105
2089
|
token: token,
|
|
2106
|
-
|
|
2090
|
+
apiHost: apiHost,
|
|
2107
2091
|
accountId: accountId,
|
|
2108
2092
|
})];
|
|
2109
2093
|
case 4:
|
|
@@ -2132,10 +2116,10 @@ var PaymentMethodForm$1 = function (_a) {
|
|
|
2132
2116
|
|
|
2133
2117
|
// This is just a wrapper to fetch the stripe object and pass it to the form
|
|
2134
2118
|
var StripeForm = function (_a) {
|
|
2135
|
-
var payable = _a.payable, plugin = _a.plugin, isSaving = _a.isSaving, setIsSaving = _a.setIsSaving, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess;
|
|
2136
|
-
var _b = React.useContext(BunnyContext), token = _b.token,
|
|
2119
|
+
var entityId = _a.entityId, payable = _a.payable, plugin = _a.plugin, isSaving = _a.isSaving, setIsSaving = _a.setIsSaving, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess;
|
|
2120
|
+
var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
|
|
2137
2121
|
var accountId = React.useContext(PaymentContext).accountId;
|
|
2138
|
-
var stripe = useStripePlugin(plugin, token,
|
|
2122
|
+
var stripe = useStripePlugin(plugin, token, apiHost, accountId);
|
|
2139
2123
|
var onlySavePaymentMethod = !payable;
|
|
2140
2124
|
if (!stripe)
|
|
2141
2125
|
return null;
|
|
@@ -2149,7 +2133,7 @@ var StripeForm = function (_a) {
|
|
|
2149
2133
|
currency: "usd",
|
|
2150
2134
|
setupFutureUsage: "off_session",
|
|
2151
2135
|
};
|
|
2152
|
-
return (jsxRuntime.jsx(reactStripeJs.Elements, __assign({ options: options, stripe: stripe }, { children: jsxRuntime.jsx(PaymentMethodForm$1, { isSaving: isSaving, setIsSaving: setIsSaving, plugin: plugin, onFail: onFail, onPaymentSuccess: onPaymentSuccess }) })));
|
|
2136
|
+
return (jsxRuntime.jsx(reactStripeJs.Elements, __assign({ options: options, stripe: stripe }, { children: jsxRuntime.jsx(PaymentMethodForm$1, { entityId: entityId, isSaving: isSaving, setIsSaving: setIsSaving, plugin: plugin, onFail: onFail, onPaymentSuccess: onPaymentSuccess }) })));
|
|
2153
2137
|
}
|
|
2154
2138
|
else {
|
|
2155
2139
|
var options = {
|
|
@@ -2158,7 +2142,7 @@ var StripeForm = function (_a) {
|
|
|
2158
2142
|
currency: payable === null || payable === void 0 ? void 0 : payable.currencyId.toLowerCase(),
|
|
2159
2143
|
setupFutureUsage: "off_session",
|
|
2160
2144
|
};
|
|
2161
|
-
return (jsxRuntime.jsx(reactStripeJs.Elements, __assign({ options: options, stripe: stripe }, { children: jsxRuntime.jsx(CheckoutForm, { payable: payable, plugin: plugin, isSaving: isSaving, setIsSaving: setIsSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess }) })));
|
|
2145
|
+
return (jsxRuntime.jsx(reactStripeJs.Elements, __assign({ options: options, stripe: stripe }, { children: jsxRuntime.jsx(CheckoutForm, { entityId: entityId, payable: payable, plugin: plugin, isSaving: isSaving, setIsSaving: setIsSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess }) })));
|
|
2162
2146
|
}
|
|
2163
2147
|
};
|
|
2164
2148
|
|
|
@@ -2205,7 +2189,7 @@ var unformatCardNumber = function (cardNumber) {
|
|
|
2205
2189
|
var unformattedCardNumberArray = cardNumberArray.filter(function (character) { return character !== " "; });
|
|
2206
2190
|
return unformattedCardNumberArray.join("");
|
|
2207
2191
|
};
|
|
2208
|
-
var storePayment = function (options, plugin,
|
|
2192
|
+
var storePayment = function (options, plugin, apiHost, accountId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2209
2193
|
var testCreditCardNumber, testCreditCardCvc, testCreditCardExpirationDate, token, response;
|
|
2210
2194
|
return __generator(this, function (_a) {
|
|
2211
2195
|
switch (_a.label) {
|
|
@@ -2221,7 +2205,7 @@ var storePayment = function (options, plugin, accountId, subdomain) { return __a
|
|
|
2221
2205
|
account_id: accountId,
|
|
2222
2206
|
},
|
|
2223
2207
|
token: token,
|
|
2224
|
-
|
|
2208
|
+
apiHost: apiHost,
|
|
2225
2209
|
})];
|
|
2226
2210
|
case 1:
|
|
2227
2211
|
response = _a.sent();
|
|
@@ -2280,7 +2264,7 @@ var TEST_CARD = "4242424242424242";
|
|
|
2280
2264
|
var DemoPayForm = function (_a) {
|
|
2281
2265
|
var isSaving = _a.isSaving, invoice = _a.invoice, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, plugin = _a.plugin, quote = _a.quote, setIsSaving = _a.setIsSaving;
|
|
2282
2266
|
// Context
|
|
2283
|
-
var _b = React.useContext(BunnyContext), token = _b.token,
|
|
2267
|
+
var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, darkMode = _b.darkMode;
|
|
2284
2268
|
var accountId = React.useContext(PaymentContext).accountId;
|
|
2285
2269
|
// Local state
|
|
2286
2270
|
var _c = React.useState(false), savePaymentMethod = _c[0], setSavePaymentMethod = _c[1];
|
|
@@ -2306,7 +2290,7 @@ var DemoPayForm = function (_a) {
|
|
|
2306
2290
|
testCreditCardCvc: cardDetails.cvc.toString(),
|
|
2307
2291
|
testCreditCardExpirationDate: cardDetails.expiry,
|
|
2308
2292
|
token: token,
|
|
2309
|
-
}, plugin,
|
|
2293
|
+
}, plugin, apiHost, accountId)];
|
|
2310
2294
|
case 1:
|
|
2311
2295
|
response = _a.sent();
|
|
2312
2296
|
paymentMethodId = response.payload[0].id;
|
|
@@ -2376,14 +2360,14 @@ var DemoPayForm = function (_a) {
|
|
|
2376
2360
|
};
|
|
2377
2361
|
return (jsxRuntime.jsxs("div", __assign({ className: "flex flex-col gap-2" }, { children: [jsxRuntime.jsxs(StyledInputs, __assign({ className: "flex flex-col gap-2", darkMode: darkMode !== null && darkMode !== void 0 ? darkMode : false }, { children: [jsxRuntime.jsx(DemoPayCardNumber, { onChange: onCardNumberChange, value: cardDetails.number }), jsxRuntime.jsxs("div", __assign({ className: "flex gap-2" }, { children: [jsxRuntime.jsx(DemoPayExpiry, { onChange: onCardExpiryChange, value: cardDetails.expiry }), jsxRuntime.jsx(DemoPayCardCvc, { onChange: onCardCvcChange, value: cardDetails.cvc })] }))] })), jsxRuntime.jsx(Text$c, __assign({ className: "text-xs" }, { children: "DemoPay is for testing only." })), !onlySavePaymentMethod && (jsxRuntime.jsx(antd.Checkbox, __assign({ className: "mt-2", onChange: function (e) { return setSavePaymentMethod(e.target.checked); } }, { children: "Save as primary payment method" }))), jsxRuntime.jsx(CheckoutFooter, { amountDue: amountDue, currencyId: currencyId, isSaving: isSaving, onPaymentSubmit: onPaymentSubmit, onlySavePaymentMethod: onlySavePaymentMethod })] })));
|
|
2378
2362
|
};
|
|
2379
|
-
var StyledInputs = styled__default["default"].div(templateObject_1$
|
|
2363
|
+
var StyledInputs = styled__default["default"].div(templateObject_1$6 || (templateObject_1$6 = __makeTemplateObject(["\n .ant-input {\n background-color: ", " !important;\n }\n .ant-input:not(:focus) {\n border-color: ", " !important;\n }\n"], ["\n .ant-input {\n background-color: ", " !important;\n }\n .ant-input:not(:focus) {\n border-color: ", " !important;\n }\n"])), function (_a) {
|
|
2380
2364
|
var darkMode = _a.darkMode;
|
|
2381
2365
|
return darkMode ? "var(--row-background-dark)" : "white";
|
|
2382
2366
|
}, function (_a) {
|
|
2383
2367
|
var darkMode = _a.darkMode;
|
|
2384
2368
|
return darkMode ? common.GRAY_500 : common.GRAY_200;
|
|
2385
2369
|
});
|
|
2386
|
-
var templateObject_1$
|
|
2370
|
+
var templateObject_1$6;
|
|
2387
2371
|
|
|
2388
2372
|
var finixStyles = function (isMobile) { return ({
|
|
2389
2373
|
default: {
|
|
@@ -2403,7 +2387,7 @@ var finixStyles = function (isMobile) { return ({
|
|
|
2403
2387
|
}); };
|
|
2404
2388
|
|
|
2405
2389
|
var retrieveConfig = function (_a) {
|
|
2406
|
-
var plugin = _a.plugin, token = _a.token,
|
|
2390
|
+
var plugin = _a.plugin, token = _a.token, apiHost = _a.apiHost, accountId = _a.accountId;
|
|
2407
2391
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
2408
2392
|
var response;
|
|
2409
2393
|
return __generator(this, function (_b) {
|
|
@@ -2412,7 +2396,7 @@ var retrieveConfig = function (_a) {
|
|
|
2412
2396
|
plugin: plugin,
|
|
2413
2397
|
method: "retrieve_config",
|
|
2414
2398
|
token: token,
|
|
2415
|
-
|
|
2399
|
+
apiHost: apiHost,
|
|
2416
2400
|
payload: {
|
|
2417
2401
|
account_id: accountId,
|
|
2418
2402
|
},
|
|
@@ -2473,9 +2457,9 @@ var formatFinixError = function (response) {
|
|
|
2473
2457
|
var FinixCardPaymentForm = function (_a) {
|
|
2474
2458
|
var finixConfig = _a.formData, invoice = _a.invoice, isSaving = _a.isSaving, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, plugin = _a.plugin, quote = _a.quote, setIsSaving = _a.setIsSaving;
|
|
2475
2459
|
// Context
|
|
2476
|
-
var _b = React.useContext(BunnyContext), token = _b.token,
|
|
2460
|
+
var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
|
|
2477
2461
|
var accountId = React.useContext(PaymentContext).accountId;
|
|
2478
|
-
var isMobile = common.useIsMobile();
|
|
2462
|
+
var isMobile = common.useIsMobile(window);
|
|
2479
2463
|
// Local state
|
|
2480
2464
|
var _c = React.useState(false), savePaymentMethod = _c[0], setSavePaymentMethod = _c[1];
|
|
2481
2465
|
var _d = React.useState(null), finixForm = _d[0], setFinixForm = _d[1];
|
|
@@ -2515,7 +2499,7 @@ var FinixCardPaymentForm = function (_a) {
|
|
|
2515
2499
|
account_id: accountId,
|
|
2516
2500
|
},
|
|
2517
2501
|
token: token,
|
|
2518
|
-
|
|
2502
|
+
apiHost: apiHost,
|
|
2519
2503
|
})];
|
|
2520
2504
|
case 1:
|
|
2521
2505
|
response_1 = _a.sent();
|
|
@@ -2567,15 +2551,15 @@ var FinixCardPaymentForm = function (_a) {
|
|
|
2567
2551
|
};
|
|
2568
2552
|
// This is just a wrapper to fetch the finix config, config its form and pass it to the paymentForm
|
|
2569
2553
|
var FinixForm = function (_a) {
|
|
2570
|
-
var invoice = _a.invoice, isSaving = _a.isSaving, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, plugin = _a.plugin, quote = _a.quote, setIsSaving = _a.setIsSaving;
|
|
2571
|
-
var _b = React.useContext(BunnyContext), token = _b.token,
|
|
2554
|
+
var invoice = _a.invoice, isSaving = _a.isSaving, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, plugin = _a.plugin, quote = _a.quote, setIsSaving = _a.setIsSaving, entityId = _a.entityId;
|
|
2555
|
+
var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, accountId = _b.accountId;
|
|
2572
2556
|
var finixConfig = reactQuery.useQuery({
|
|
2573
2557
|
queryKey: common.QueryKeyFactory.default.finixKey,
|
|
2574
2558
|
queryFn: function () {
|
|
2575
2559
|
return retrieveConfig({
|
|
2576
2560
|
plugin: plugin,
|
|
2577
2561
|
token: token,
|
|
2578
|
-
|
|
2562
|
+
apiHost: apiHost,
|
|
2579
2563
|
accountId: accountId,
|
|
2580
2564
|
});
|
|
2581
2565
|
},
|
|
@@ -2583,7 +2567,7 @@ var FinixForm = function (_a) {
|
|
|
2583
2567
|
}).data;
|
|
2584
2568
|
if (!finixConfig || !finixConfig.application_id)
|
|
2585
2569
|
return null;
|
|
2586
|
-
return (jsxRuntime.jsx(FinixCardPaymentForm, { formData: finixConfig, invoice: invoice, isSaving: isSaving, setIsSaving: setIsSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, plugin: plugin, quote: quote }));
|
|
2570
|
+
return (jsxRuntime.jsx(FinixCardPaymentForm, { entityId: entityId, formData: finixConfig, invoice: invoice, isSaving: isSaving, setIsSaving: setIsSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, plugin: plugin, quote: quote }));
|
|
2587
2571
|
};
|
|
2588
2572
|
|
|
2589
2573
|
var StoredPaymentMethodForm = function (_a) {
|
|
@@ -2622,15 +2606,15 @@ var finixOptions = function (isMobile) { return ({
|
|
|
2622
2606
|
}); };
|
|
2623
2607
|
var FINIX_FORM_ID = "form-element";
|
|
2624
2608
|
var FinixAchPayment = function (_a) {
|
|
2625
|
-
var invoice = _a.invoice, isSaving = _a.isSaving, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, plugin = _a.plugin, quote = _a.quote, setIsSaving = _a.setIsSaving;
|
|
2626
|
-
var _b = React.useContext(BunnyContext), token = _b.token,
|
|
2609
|
+
var invoice = _a.invoice, isSaving = _a.isSaving, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, plugin = _a.plugin, quote = _a.quote, setIsSaving = _a.setIsSaving, entityId = _a.entityId;
|
|
2610
|
+
var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, accountId = _b.accountId;
|
|
2627
2611
|
var finixConfig = reactQuery.useQuery({
|
|
2628
2612
|
queryKey: common.QueryKeyFactory.default.finixAchKey,
|
|
2629
2613
|
queryFn: function () {
|
|
2630
2614
|
return retrieveConfig({
|
|
2631
2615
|
plugin: plugin,
|
|
2632
2616
|
token: token,
|
|
2633
|
-
|
|
2617
|
+
apiHost: apiHost,
|
|
2634
2618
|
accountId: accountId,
|
|
2635
2619
|
});
|
|
2636
2620
|
},
|
|
@@ -2638,13 +2622,13 @@ var FinixAchPayment = function (_a) {
|
|
|
2638
2622
|
}).data;
|
|
2639
2623
|
if (!finixConfig || !finixConfig.application_id)
|
|
2640
2624
|
return null;
|
|
2641
|
-
return (jsxRuntime.jsx(FinixAchPaymentForm, { isSaving: isSaving, formData: finixConfig, invoice: invoice, onFail: onFail, onPaymentSuccess: onPaymentSuccess, plugin: plugin, quote: quote, setIsSaving: setIsSaving }));
|
|
2625
|
+
return (jsxRuntime.jsx(FinixAchPaymentForm, { entityId: entityId, isSaving: isSaving, formData: finixConfig, invoice: invoice, onFail: onFail, onPaymentSuccess: onPaymentSuccess, plugin: plugin, quote: quote, setIsSaving: setIsSaving }));
|
|
2642
2626
|
};
|
|
2643
2627
|
var FinixAchPaymentForm = function (_a) {
|
|
2644
2628
|
var finixConfig = _a.formData, invoice = _a.invoice, isSaving = _a.isSaving, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, plugin = _a.plugin, quote = _a.quote, setIsSaving = _a.setIsSaving;
|
|
2645
2629
|
// Context
|
|
2646
|
-
var
|
|
2647
|
-
var
|
|
2630
|
+
var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, accountId = _b.accountId, window = _b.window;
|
|
2631
|
+
var isMobile = common.useIsMobile(window);
|
|
2648
2632
|
// Local state
|
|
2649
2633
|
var _c = React.useState(), finixForm = _c[0], setFinixForm = _c[1];
|
|
2650
2634
|
var _d = React.useState(false), savePaymentMethod = _d[0], setSavePaymentMethod = _d[1];
|
|
@@ -2680,7 +2664,7 @@ var FinixAchPaymentForm = function (_a) {
|
|
|
2680
2664
|
account_id: accountId,
|
|
2681
2665
|
},
|
|
2682
2666
|
token: token,
|
|
2683
|
-
|
|
2667
|
+
apiHost: apiHost,
|
|
2684
2668
|
})];
|
|
2685
2669
|
case 1:
|
|
2686
2670
|
response_1 = _a.sent();
|
|
@@ -2731,7 +2715,7 @@ var FinixAchPaymentForm = function (_a) {
|
|
|
2731
2715
|
|
|
2732
2716
|
var PaymentMethodForm = function (_a) {
|
|
2733
2717
|
var _b, _c;
|
|
2734
|
-
var invoice = _a.invoice, isPlugin = _a.isPlugin, isSaving = _a.isSaving, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, paymentMethod = _a.paymentMethod, quote = _a.quote, setIsSaving = _a.setIsSaving;
|
|
2718
|
+
var entityId = _a.entityId, invoice = _a.invoice, isPlugin = _a.isPlugin, isSaving = _a.isSaving, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, paymentMethod = _a.paymentMethod, quote = _a.quote, setIsSaving = _a.setIsSaving;
|
|
2735
2719
|
if (!paymentMethod)
|
|
2736
2720
|
return null;
|
|
2737
2721
|
if (isPlugin) {
|
|
@@ -2739,25 +2723,68 @@ var PaymentMethodForm = function (_a) {
|
|
|
2739
2723
|
var payable = (quote || invoice);
|
|
2740
2724
|
switch ((_c = (_b = paymentMethod.components) === null || _b === void 0 ? void 0 : _b.frontend) === null || _c === void 0 ? void 0 : _c[0].name) {
|
|
2741
2725
|
case "StripePayment":
|
|
2742
|
-
return (jsxRuntime.jsx(StripeForm, { payable: payable, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, plugin: paymentMethod, setIsSaving: setIsSaving }));
|
|
2726
|
+
return (jsxRuntime.jsx(StripeForm, { entityId: entityId, payable: payable, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, plugin: paymentMethod, setIsSaving: setIsSaving }));
|
|
2743
2727
|
case "FinixPayment":
|
|
2744
|
-
return (jsxRuntime.jsx(FinixForm, { invoice: invoice, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, plugin: paymentMethod, quote: quote, setIsSaving: setIsSaving }));
|
|
2728
|
+
return (jsxRuntime.jsx(FinixForm, { entityId: entityId, invoice: invoice, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, plugin: paymentMethod, quote: quote, setIsSaving: setIsSaving }));
|
|
2745
2729
|
case "FinixAchPayment":
|
|
2746
|
-
return (jsxRuntime.jsx(FinixAchPayment, { invoice: invoice, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, plugin: paymentMethod, quote: quote, setIsSaving: setIsSaving }));
|
|
2730
|
+
return (jsxRuntime.jsx(FinixAchPayment, { entityId: entityId, invoice: invoice, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, plugin: paymentMethod, quote: quote, setIsSaving: setIsSaving }));
|
|
2747
2731
|
case "DemoPayPayment":
|
|
2748
|
-
return (jsxRuntime.jsx(DemoPayForm, { invoice: invoice, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, plugin: paymentMethod, quote: quote, setIsSaving: setIsSaving }));
|
|
2732
|
+
return (jsxRuntime.jsx(DemoPayForm, { entityId: entityId, invoice: invoice, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, plugin: paymentMethod, quote: quote, setIsSaving: setIsSaving }));
|
|
2749
2733
|
default:
|
|
2750
2734
|
return jsxRuntime.jsx("p", { children: "Can not find form for plugin" });
|
|
2751
2735
|
}
|
|
2752
2736
|
}
|
|
2753
2737
|
else if (quote || invoice)
|
|
2754
|
-
return (jsxRuntime.jsx(StoredPaymentMethodForm, { invoice: invoice, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, paymentMethod: paymentMethod, quote: quote, setIsSaving: setIsSaving }));
|
|
2738
|
+
return (jsxRuntime.jsx(StoredPaymentMethodForm, { entityId: entityId, invoice: invoice, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, paymentMethod: paymentMethod, quote: quote, setIsSaving: setIsSaving }));
|
|
2755
2739
|
return null;
|
|
2756
2740
|
};
|
|
2757
2741
|
|
|
2742
|
+
var usePlugins = function (_a) {
|
|
2743
|
+
var entityId = _a.entityId, apiHost = _a.apiHost, token = _a.token;
|
|
2744
|
+
return reactQuery.useQuery({
|
|
2745
|
+
queryKey: common.QueryKeyFactory.default.pluginsKey,
|
|
2746
|
+
queryFn: function () {
|
|
2747
|
+
var plugins = common.getPlugins({
|
|
2748
|
+
entityId: entityId,
|
|
2749
|
+
token: token,
|
|
2750
|
+
apiHost: apiHost,
|
|
2751
|
+
});
|
|
2752
|
+
return plugins;
|
|
2753
|
+
},
|
|
2754
|
+
enabled: Boolean(entityId),
|
|
2755
|
+
});
|
|
2756
|
+
};
|
|
2757
|
+
|
|
2758
|
+
var filterPaymentPlugins = function (plugins) {
|
|
2759
|
+
return plugins === null || plugins === void 0 ? void 0 : plugins.filter(function (plugin) {
|
|
2760
|
+
var _a, _b, _c, _d;
|
|
2761
|
+
return ((_a = plugin.type) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === "payment" &&
|
|
2762
|
+
((_b = plugin.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === "valid" &&
|
|
2763
|
+
((_d = (_c = plugin.components) === null || _c === void 0 ? void 0 : _c.frontend) === null || _d === void 0 ? void 0 : _d.length);
|
|
2764
|
+
});
|
|
2765
|
+
};
|
|
2766
|
+
var usePaymentPlugins = function (_a) {
|
|
2767
|
+
var entityId = _a.entityId, apiHost = _a.apiHost, token = _a.token;
|
|
2768
|
+
var _b = usePlugins({
|
|
2769
|
+
entityId: entityId,
|
|
2770
|
+
apiHost: apiHost,
|
|
2771
|
+
token: token,
|
|
2772
|
+
}), plugins = _b.data, isFetched = _b.isFetched;
|
|
2773
|
+
var paymentPlugins = filterPaymentPlugins(Array.isArray(plugins) ? plugins : []);
|
|
2774
|
+
var paymentMethodAllowedPlugins = paymentPlugins === null || paymentPlugins === void 0 ? void 0 : paymentPlugins.filter(function (plugin) {
|
|
2775
|
+
var _a, _b;
|
|
2776
|
+
return (_b = (_a = plugin.components) === null || _a === void 0 ? void 0 : _a.frontend) === null || _b === void 0 ? void 0 : _b.some(function (component) { var _a; return (_a = component === null || component === void 0 ? void 0 : component.scenarios) === null || _a === void 0 ? void 0 : _a.includes("admin-payment_method"); });
|
|
2777
|
+
});
|
|
2778
|
+
return {
|
|
2779
|
+
paymentPlugins: paymentPlugins,
|
|
2780
|
+
paymentMethodAllowedPlugins: paymentMethodAllowedPlugins,
|
|
2781
|
+
isFetched: isFetched,
|
|
2782
|
+
};
|
|
2783
|
+
};
|
|
2784
|
+
|
|
2758
2785
|
var PaymentFormWrapper = function (_a) {
|
|
2759
2786
|
var children = _a.children, setMaxHeight = _a.setMaxHeight;
|
|
2760
|
-
var isMobile = common.useIsMobile();
|
|
2787
|
+
var isMobile = common.useIsMobile(window);
|
|
2761
2788
|
return (jsxRuntime.jsx("div", __assign({ className: "flex flex-col gap-6 shrink-0 ".concat(isMobile ? "w-full shadow-padding-xb" : ""), style: __assign({}, (isMobile
|
|
2762
2789
|
? setMaxHeight
|
|
2763
2790
|
? { maxHeight: "60vh" }
|
|
@@ -2767,14 +2794,14 @@ var PaymentFormWrapper = function (_a) {
|
|
|
2767
2794
|
})) }, { children: children })));
|
|
2768
2795
|
};
|
|
2769
2796
|
var ActualPaymentForm = function (_a) {
|
|
2770
|
-
var invoice = _a.invoice, isSaving = _a.isSaving, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, quote = _a.quote, setIsSaving = _a.setIsSaving;
|
|
2797
|
+
var entityId = _a.entityId, invoice = _a.invoice, isSaving = _a.isSaving, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, quote = _a.quote, setIsSaving = _a.setIsSaving;
|
|
2771
2798
|
// Local state
|
|
2772
2799
|
var _b = React.useState(), selectedPaymentMethod = _b[0], setSelectedPaymentMethod = _b[1];
|
|
2773
|
-
var _c = React.useContext(BunnyContext), token = _c.token,
|
|
2800
|
+
var _c = React.useContext(BunnyContext), token = _c.token, apiHost = _c.apiHost, graphQLClient = _c.graphQLClient;
|
|
2774
2801
|
var storedPaymentMethod = usePaymentMethod(graphQLClient).data;
|
|
2775
2802
|
// Queries
|
|
2776
2803
|
var isPaymentMethodFetched = storedPaymentMethod !== undefined;
|
|
2777
|
-
var _d =
|
|
2804
|
+
var _d = usePaymentPlugins({ entityId: entityId, apiHost: apiHost, token: token }), paymentMethodAllowedPlugins = _d.paymentMethodAllowedPlugins, arePluginsFetched = _d.isFetched;
|
|
2778
2805
|
// Derived state
|
|
2779
2806
|
// If there is a quote or invoice, we are just saving a payment method and not processing a payment
|
|
2780
2807
|
var showStoredPaymentMethodOption = Boolean(quote || invoice);
|
|
@@ -2809,16 +2836,16 @@ var ActualPaymentForm = function (_a) {
|
|
|
2809
2836
|
showStoredPaymentMethodOption,
|
|
2810
2837
|
storedPaymentMethod,
|
|
2811
2838
|
]);
|
|
2812
|
-
return (jsxRuntime.jsxs(PaymentFormWrapper, __assign({ setMaxHeight: isPlugin }, { children: [showPaymentMethodSelector && (jsxRuntime.jsx(PaymentMethodSelector, { onSelect: setSelectedPaymentMethod, paymentMethodAllowedPlugins: paymentMethodAllowedPlugins, showStoredPaymentMethodOption: showStoredPaymentMethodOption, value: selectedPaymentMethod })), selectedPaymentMethod && (jsxRuntime.jsx("div", __assign({ className: "flex flex-col" }, { children: jsxRuntime.jsx(PaymentMethodForm, { invoice: invoice, isPlugin: isPlugin, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, paymentMethod: selectedPaymentMethod, quote: quote, setIsSaving: setIsSaving }) })))] })));
|
|
2839
|
+
return (jsxRuntime.jsxs(PaymentFormWrapper, __assign({ setMaxHeight: isPlugin }, { children: [showPaymentMethodSelector && (jsxRuntime.jsx(PaymentMethodSelector, { onSelect: setSelectedPaymentMethod, paymentMethodAllowedPlugins: paymentMethodAllowedPlugins, showStoredPaymentMethodOption: showStoredPaymentMethodOption, value: selectedPaymentMethod })), selectedPaymentMethod && (jsxRuntime.jsx("div", __assign({ className: "flex flex-col" }, { children: jsxRuntime.jsx(PaymentMethodForm, { entityId: entityId, invoice: invoice, isPlugin: isPlugin, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, paymentMethod: selectedPaymentMethod, quote: quote, setIsSaving: setIsSaving }) })))] })));
|
|
2813
2840
|
};
|
|
2814
2841
|
var PaymentForm = function (_a) {
|
|
2815
|
-
var invoice = _a.invoice, isSaving = _a.isSaving, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, quote = _a.quote, setIsSaving = _a.setIsSaving;
|
|
2816
|
-
return (jsxRuntime.jsx(ActualPaymentForm, { invoice: invoice, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, quote: quote, setIsSaving: setIsSaving }));
|
|
2842
|
+
var entityId = _a.entityId, invoice = _a.invoice, isSaving = _a.isSaving, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, quote = _a.quote, setIsSaving = _a.setIsSaving;
|
|
2843
|
+
return (jsxRuntime.jsx(ActualPaymentForm, { entityId: entityId, invoice: invoice, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, quote: quote, setIsSaving: setIsSaving }));
|
|
2817
2844
|
};
|
|
2818
2845
|
|
|
2819
|
-
var MUTATION$
|
|
2846
|
+
var MUTATION$8 = "\n mutation checkout(\n $invoiceId: ID,\n $quoteId: ID,\n $paymentMethodId: ID,\n $paymentMethodData: CheckoutPaymentMethodAttributes\n ) {\n checkout(\n invoiceId: $invoiceId,\n quoteId: $quoteId,\n paymentMethodId: $paymentMethodId,\n paymentMethodData: $paymentMethodData\n ) {\n invoice {\n id\n state\n amount\n amountDue\n }\n payment {\n id\n state\n amount\n }\n paymentApplication {\n id\n invoiceId\n paymentId\n }\n transaction {\n id\n amount\n }\n }\n }\n";
|
|
2820
2847
|
var checkout = function (_a) {
|
|
2821
|
-
var quoteId = _a.quoteId, invoiceId = _a.invoiceId, paymentMethodId = _a.paymentMethodId, paymentMethodData = _a.paymentMethodData, token = _a.token,
|
|
2848
|
+
var quoteId = _a.quoteId, invoiceId = _a.invoiceId, paymentMethodId = _a.paymentMethodId, paymentMethodData = _a.paymentMethodData, token = _a.token, apiHost = _a.apiHost;
|
|
2822
2849
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
2823
2850
|
var mutationVars, response, errors;
|
|
2824
2851
|
return __generator(this, function (_b) {
|
|
@@ -2833,10 +2860,10 @@ var checkout = function (_a) {
|
|
|
2833
2860
|
mutationVars.paymentMethodData = __assign(__assign({}, paymentMethodData), { metadata: paymentMethodData.metadata });
|
|
2834
2861
|
}
|
|
2835
2862
|
return [4 /*yield*/, common.gqlRequest({
|
|
2836
|
-
query: MUTATION$
|
|
2863
|
+
query: MUTATION$8,
|
|
2837
2864
|
token: token,
|
|
2838
2865
|
vars: mutationVars,
|
|
2839
|
-
|
|
2866
|
+
apiHost: apiHost,
|
|
2840
2867
|
})];
|
|
2841
2868
|
case 1:
|
|
2842
2869
|
response = _b.sent();
|
|
@@ -2853,8 +2880,8 @@ var checkout = function (_a) {
|
|
|
2853
2880
|
|
|
2854
2881
|
var InvoiceCheckoutContext = React.createContext({});
|
|
2855
2882
|
var InvoiceCheckout = function (_a) {
|
|
2856
|
-
var isSaving = _a.isSaving, onSuccess = _a.onSuccess, onFail = _a.onFail, invoice = _a.invoice, setIsSaving = _a.setIsSaving, preCheckout = _a.preCheckout, setIsPreCheckoutLoading = _a.setIsPreCheckoutLoading, isPreCheckoutLoading = _a.isPreCheckoutLoading, payImmediatelyGivenInvoice = _a.payImmediatelyGivenInvoice, checkoutButtonName = _a.checkoutButtonName;
|
|
2857
|
-
var _b = React.useContext(BunnyContext),
|
|
2883
|
+
var isSaving = _a.isSaving, onSuccess = _a.onSuccess, onFail = _a.onFail, invoice = _a.invoice, setIsSaving = _a.setIsSaving, preCheckout = _a.preCheckout, setIsPreCheckoutLoading = _a.setIsPreCheckoutLoading, isPreCheckoutLoading = _a.isPreCheckoutLoading, payImmediatelyGivenInvoice = _a.payImmediatelyGivenInvoice, checkoutButtonName = _a.checkoutButtonName, entityId = _a.entityId;
|
|
2884
|
+
var _b = React.useContext(BunnyContext), apiHost = _b.apiHost, token = _b.token;
|
|
2858
2885
|
var checkoutMutation = reactQuery.useMutation({
|
|
2859
2886
|
mutationFn: function (_a) {
|
|
2860
2887
|
var pluginPaymentMethod = _a.pluginPaymentMethod, savedPaymentMethod = _a.savedPaymentMethod;
|
|
@@ -2864,7 +2891,7 @@ var InvoiceCheckout = function (_a) {
|
|
|
2864
2891
|
invoiceId: invoice === null || invoice === void 0 ? void 0 : invoice.id,
|
|
2865
2892
|
paymentMethodId: paymentMethodId,
|
|
2866
2893
|
token: token,
|
|
2867
|
-
|
|
2894
|
+
apiHost: apiHost,
|
|
2868
2895
|
});
|
|
2869
2896
|
}
|
|
2870
2897
|
else if (pluginPaymentMethod) {
|
|
@@ -2879,7 +2906,7 @@ var InvoiceCheckout = function (_a) {
|
|
|
2879
2906
|
token: paymentToken,
|
|
2880
2907
|
},
|
|
2881
2908
|
token: token,
|
|
2882
|
-
|
|
2909
|
+
apiHost: apiHost,
|
|
2883
2910
|
});
|
|
2884
2911
|
}
|
|
2885
2912
|
else
|
|
@@ -2924,7 +2951,7 @@ var InvoiceCheckout = function (_a) {
|
|
|
2924
2951
|
invoice: invoice,
|
|
2925
2952
|
setIsPreCheckoutLoading: setIsPreCheckoutLoading,
|
|
2926
2953
|
isPreCheckoutLoading: isPreCheckoutLoading,
|
|
2927
|
-
} }, { children: jsxRuntime.jsx(PaymentForm, { isSaving: isSaving, onPaymentSuccess: handleCheckout, onFail: onFail, invoice: invoice, setIsSaving: setIsSaving }) })));
|
|
2954
|
+
} }, { children: jsxRuntime.jsx(PaymentForm, { entityId: entityId, isSaving: isSaving, onPaymentSuccess: handleCheckout, onFail: onFail, invoice: invoice, setIsSaving: setIsSaving }) })));
|
|
2928
2955
|
};
|
|
2929
2956
|
|
|
2930
2957
|
var fetchPDF = function (window, apiEndpoint, invoiceUuid) { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -2935,7 +2962,7 @@ var fetchPDF = function (window, apiEndpoint, invoiceUuid) { return __awaiter(vo
|
|
|
2935
2962
|
if (!invoiceUuid) {
|
|
2936
2963
|
throw new Error("Invoice ID is required to fetch PDF");
|
|
2937
2964
|
}
|
|
2938
|
-
return [4 /*yield*/, fetch("".concat(
|
|
2965
|
+
return [4 /*yield*/, fetch("".concat(apiEndpoint, "/api/legacy_invoices/").concat(invoiceUuid))];
|
|
2939
2966
|
case 1:
|
|
2940
2967
|
response = _a.sent();
|
|
2941
2968
|
if (!response.ok)
|
|
@@ -2945,12 +2972,12 @@ var fetchPDF = function (window, apiEndpoint, invoiceUuid) { return __awaiter(vo
|
|
|
2945
2972
|
});
|
|
2946
2973
|
}); };
|
|
2947
2974
|
function InvoicePDF(_a) {
|
|
2948
|
-
var invoiceUuid = _a.invoiceUuid,
|
|
2975
|
+
var invoiceUuid = _a.invoiceUuid, apiHost = _a.apiHost;
|
|
2949
2976
|
var window = React.useContext(BunnyContext).window;
|
|
2950
2977
|
var _b = React.useState(undefined), pdfUrl = _b[0], setPdfUrl = _b[1];
|
|
2951
2978
|
var _c = reactQuery.useQuery({
|
|
2952
2979
|
queryKey: ["invoicePDF", invoiceUuid],
|
|
2953
|
-
queryFn: function () { return fetchPDF(window,
|
|
2980
|
+
queryFn: function () { return fetchPDF(window, apiHost || "", invoiceUuid); },
|
|
2954
2981
|
enabled: Boolean(invoiceUuid),
|
|
2955
2982
|
}), pdfBlob = _c.data, isLoading = _c.isLoading;
|
|
2956
2983
|
React.useEffect(function () {
|
|
@@ -2970,20 +2997,30 @@ function InvoicePDF(_a) {
|
|
|
2970
2997
|
}, title: "Invoice PDF", width: "100%" }));
|
|
2971
2998
|
}
|
|
2972
2999
|
|
|
3000
|
+
var quoteMetaDescription = function (vendorName) {
|
|
3001
|
+
return "View this quote on the ".concat(vendorName, " customer portal. Powered by Bunny");
|
|
3002
|
+
};
|
|
3003
|
+
var quoteMetaTitle = function (_a) {
|
|
3004
|
+
var documentName = _a.documentName, vendorName = _a.vendorName;
|
|
3005
|
+
return vendorName + " " + documentName;
|
|
3006
|
+
};
|
|
3007
|
+
|
|
2973
3008
|
function ActualInvoice(_a) {
|
|
2974
|
-
var id = _a.id, invoiceQuoteViewComponent = _a.invoiceQuoteViewComponent, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick, onPaymentSuccess = _a.onPaymentSuccess;
|
|
3009
|
+
var id = _a.id, invoiceQuoteViewComponent = _a.invoiceQuoteViewComponent, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick, onPaymentSuccess = _a.onPaymentSuccess, entityId = _a.entityId;
|
|
3010
|
+
var window = React.useContext(BunnyContext).window;
|
|
3011
|
+
var isMobile = common.useIsMobile(window);
|
|
2975
3012
|
var _b = React.useState(false), isSaving = _b[0], setIsSaving = _b[1];
|
|
2976
3013
|
var queryClient = reactQuery.useQueryClient();
|
|
2977
|
-
var
|
|
2978
|
-
var showSuccessNotification = common.
|
|
2979
|
-
var handleAllErrorFormats = common.
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
3014
|
+
var _c = React.useContext(BunnyContext), apiHost = _c.apiHost, token = _c.token, onErrorNavigate = _c.onErrorNavigate;
|
|
3015
|
+
var showSuccessNotification = common.useSuccessNotification();
|
|
3016
|
+
var handleAllErrorFormats = common.useAllErrorFormats(onErrorNavigate ||
|
|
3017
|
+
(function (url) {
|
|
3018
|
+
console.log("navigate to", url, " not implemented");
|
|
3019
|
+
}));
|
|
2983
3020
|
// Queries
|
|
2984
3021
|
var _d = reactQuery.useQuery({
|
|
2985
3022
|
queryKey: common.QueryKeyFactory.default.createFormattedInvoiceKey(token, id),
|
|
2986
|
-
queryFn: function () { return getFormattedInvoice({ id: id, token: token,
|
|
3023
|
+
queryFn: function () { return common.getFormattedInvoice({ id: id, token: token, apiHost: apiHost }); },
|
|
2987
3024
|
}), formattedInvoice = _d.data, error = _d.error;
|
|
2988
3025
|
if (error) {
|
|
2989
3026
|
return jsxRuntime.jsxs("div", { children: ["Error loading invoice: ", error.message] });
|
|
@@ -3010,24 +3047,39 @@ function ActualInvoice(_a) {
|
|
|
3010
3047
|
};
|
|
3011
3048
|
// Derived state
|
|
3012
3049
|
var isInvoicePayable = common.PAYABLE_INVOICE_STATES.includes((formattedInvoice === null || formattedInvoice === void 0 ? void 0 : formattedInvoice.state) || "");
|
|
3013
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(reactHelmetAsync.Helmet, { children: [jsxRuntime.jsxs("title", { children: [formattedInvoice.vendorName, " ", common.DOCUMENT_NAME.INVOICE] }), jsxRuntime.jsx("meta", { name: "description", content:
|
|
3050
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(reactHelmetAsync.Helmet, { children: [jsxRuntime.jsxs("title", { children: [formattedInvoice.vendorName, " ", common.DOCUMENT_NAME.INVOICE] }), jsxRuntime.jsx("meta", { name: "description", content: quoteMetaDescription(formattedInvoice.vendorName) }), jsxRuntime.jsx("meta", { property: "og:type", content: "website" }), jsxRuntime.jsx("meta", { property: "og:title", content: quoteMetaTitle({
|
|
3014
3051
|
vendorName: formattedInvoice.vendorName,
|
|
3015
3052
|
documentName: common.DOCUMENT_NAME.INVOICE,
|
|
3016
|
-
}) }), jsxRuntime.jsx("meta", { property: "og:description", content:
|
|
3053
|
+
}) }), jsxRuntime.jsx("meta", { property: "og:description", content: quoteMetaDescription(formattedInvoice.vendorName) })] }), jsxRuntime.jsxs("div", __assign({ className: "flex gap-6 ".concat(isMobile ? "flex-col w-full overflow-hidden" : "shadow-padding-xb") }, { children: [formattedInvoice.isLegacy ? (jsxRuntime.jsx("div", __assign({ className: "flex justify-center w-full" }, { children: jsxRuntime.jsx(InvoicePDF, { invoiceUuid: formattedInvoice.uuid, apiHost: apiHost }) }))) : (invoiceQuoteViewComponent || (jsxRuntime.jsx(InvoiceQuoteView, { html: formattedInvoice.html, formattedInvoice: formattedInvoice, backButtonName: backButtonName, onBackButtonClick: onBackButtonClick }))), !isMobile && isInvoicePayable && (jsxRuntime.jsx(antd.Divider, { className: "h-full", type: "vertical" })), isInvoicePayable && (jsxRuntime.jsx(InvoiceCheckout, { invoice: formattedInvoice, isSaving: isSaving, onFail: function (error) {
|
|
3017
3054
|
onFail(error);
|
|
3018
3055
|
setIsSaving(false);
|
|
3019
|
-
}, onSuccess: onSuccess, setIsSaving: setIsSaving }))] }))] }));
|
|
3056
|
+
}, onSuccess: onSuccess, setIsSaving: setIsSaving, entityId: entityId }))] }))] }));
|
|
3020
3057
|
}
|
|
3021
3058
|
function Invoice(_a) {
|
|
3022
|
-
var id = _a.id, invoiceQuoteViewComponent = _a.invoiceQuoteViewComponent, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick; _a.onInvoiceDownloadError; var onPaymentSuccess = _a.onPaymentSuccess;
|
|
3023
|
-
return (jsxRuntime.jsx(reactHelmetAsync.HelmetProvider, { children: jsxRuntime.jsx(ActualInvoice, { id: id, invoiceQuoteViewComponent: invoiceQuoteViewComponent, backButtonName: backButtonName, onBackButtonClick: onBackButtonClick, onPaymentSuccess: onPaymentSuccess }) }));
|
|
3059
|
+
var id = _a.id, invoiceQuoteViewComponent = _a.invoiceQuoteViewComponent, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick; _a.onInvoiceDownloadError; var onPaymentSuccess = _a.onPaymentSuccess, entityId = _a.entityId;
|
|
3060
|
+
return (jsxRuntime.jsx(reactHelmetAsync.HelmetProvider, { children: jsxRuntime.jsx(ActualInvoice, { id: id, invoiceQuoteViewComponent: invoiceQuoteViewComponent, backButtonName: backButtonName, onBackButtonClick: onBackButtonClick, onPaymentSuccess: onPaymentSuccess, entityId: entityId }) }));
|
|
3024
3061
|
}
|
|
3025
3062
|
|
|
3026
|
-
var
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3063
|
+
var MUTATION$7 = function (id) { return "\n query formattedQuote ($id: ID) {\n formattedQuote (id: $id) {\n payableId\n acceptedAt\n acceptedByName\n amount\n amountDue\n amountsByPeriod {\n id\n name\n amount\n }\n object { documents { id filename size date url } }\n billingCity\n billingCountry\n billingState\n billingStreet\n billingZip\n contactName\n currency\n customerBillingCity\n customerBillingCountry\n customerBillingState\n customerBillingStreet\n customerBillingZip\n customerName\n discount\n discountValue\n duration\n endDate\n expiresAt\n html\n formattedLines {\n amount\n amountsByPeriod {\n quantity\n id\n name\n startDate\n endDate\n amount\n amountsByTier {\n id\n tier {\n starts\n ends\n price\n }\n quantity\n amount\n }\n prorationRate\n }\n billingPeriodEnd\n billingPeriodStart\n chargeType\n discount\n frequency\n isRamp\n periods\n planName\n position\n price\n priceDecimals\n priceListChargeId\n priceListChargeName\n priceListId\n priceListName\n priceTiers {\n price\n starts\n }\n pricingModel\n productName\n prorationRate\n quantity\n showProductNameOnLineItem\n taxCode\n trialEndDate\n trialStartDate\n unitOfMeasure\n vatCode\n }\n netPaymentDays\n notes\n number\n poNumberRequired\n salesContactEmail\n sharedAt\n startDate\n state\n subtotal\n taxAmount\n taxNumberLabel\n taxNumberRequired\n vendorName\n }\n }"; };
|
|
3064
|
+
var getFormattedQuote = function (_a) {
|
|
3065
|
+
var id = _a.id, token = _a.token, apiHost = _a.apiHost;
|
|
3066
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
3067
|
+
var response;
|
|
3068
|
+
return __generator(this, function (_b) {
|
|
3069
|
+
switch (_b.label) {
|
|
3070
|
+
case 0: return [4 /*yield*/, common.gqlRequest({
|
|
3071
|
+
query: MUTATION$7(),
|
|
3072
|
+
token: token,
|
|
3073
|
+
apiHost: apiHost,
|
|
3074
|
+
vars: { id: id },
|
|
3075
|
+
})];
|
|
3076
|
+
case 1:
|
|
3077
|
+
response = _b.sent();
|
|
3078
|
+
return [2 /*return*/, response === null || response === void 0 ? void 0 : response.formattedQuote];
|
|
3079
|
+
}
|
|
3080
|
+
});
|
|
3081
|
+
});
|
|
3082
|
+
};
|
|
3031
3083
|
|
|
3032
3084
|
var filterSigningPlugins = function (plugins) {
|
|
3033
3085
|
return plugins === null || plugins === void 0 ? void 0 : plugins.filter(function (plugin) {
|
|
@@ -3036,27 +3088,31 @@ var filterSigningPlugins = function (plugins) {
|
|
|
3036
3088
|
((_b = plugin.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === "valid";
|
|
3037
3089
|
});
|
|
3038
3090
|
};
|
|
3039
|
-
var useSigningPlugins = function (
|
|
3040
|
-
var
|
|
3091
|
+
var useSigningPlugins = function (_a) {
|
|
3092
|
+
var entityId = _a.entityId, apiHost = _a.apiHost, token = _a.token;
|
|
3093
|
+
var plugins = usePlugins({ entityId: entityId, apiHost: apiHost, token: token });
|
|
3041
3094
|
return filterSigningPlugins(plugins.data);
|
|
3042
3095
|
};
|
|
3043
3096
|
|
|
3044
|
-
var useSendAcceptQuote = function (
|
|
3097
|
+
var useSendAcceptQuote = function (_a) {
|
|
3098
|
+
var entityId = _a.entityId, onErrorNavigate = _a.onErrorNavigate, quoteId = _a.quoteId, apiHost = _a.apiHost, token = _a.token;
|
|
3045
3099
|
// Hooks
|
|
3046
|
-
var graphQLMutation = common.
|
|
3100
|
+
var graphQLMutation = common.useGraphQLmutation(function () {
|
|
3047
3101
|
console.log("navigate in useGraphQLmutation in useSendAcceptQuote is not yet implemented");
|
|
3048
|
-
},
|
|
3102
|
+
}, apiHost || "", function () {
|
|
3049
3103
|
console.log("onError in useGraphQLmutation in useSendAcceptQuote is not yet implemented");
|
|
3050
3104
|
});
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3105
|
+
var handleAllErrorFormats = common.useAllErrorFormats(onErrorNavigate ||
|
|
3106
|
+
(function (url) {
|
|
3107
|
+
console.log("navigate to", url, " not implemented");
|
|
3108
|
+
}));
|
|
3109
|
+
var signingPlugins = useSigningPlugins({ entityId: entityId, apiHost: apiHost, token: token });
|
|
3054
3110
|
var queryClient = reactQuery.useQueryClient();
|
|
3055
3111
|
// Local state
|
|
3056
|
-
var
|
|
3057
|
-
var
|
|
3112
|
+
var _b = React.useState(false), acceptBoxVisible = _b[0], setAcceptBoxVisible = _b[1];
|
|
3113
|
+
var _c = React.useState(false), isAccepting = _c[0], setIsAccepting = _c[1];
|
|
3058
3114
|
// Pandadoc polling modal state
|
|
3059
|
-
var
|
|
3115
|
+
var _d = React.useState(false), pandadocPollingModalVisible = _d[0], setPandadocPollingModalVisible = _d[1];
|
|
3060
3116
|
var redirectForSigning = function () {
|
|
3061
3117
|
var mutation = "mutation quoteSigningUrlCreate($quoteId: ID) {\n quoteSigningUrlCreate(quoteId: $quoteId) {\n redirectUri\n pluginClientId\n pluginShortName\n errors\n }\n }";
|
|
3062
3118
|
var variables = {
|
|
@@ -3069,10 +3125,7 @@ var useSendAcceptQuote = function (token, subdomain, quoteId) {
|
|
|
3069
3125
|
console.log("rsp.data.quoteSigningUrlCreate.pluginShortName === 'pandadoc'", rsp.data.quoteSigningUrlCreate.pluginShortName === "pandadoc");
|
|
3070
3126
|
console.log("rsp", rsp);
|
|
3071
3127
|
if (rsp.data.quoteSigningUrlCreate.pluginShortName === "dropbox_sign") {
|
|
3072
|
-
|
|
3073
|
-
// rsp.data.quoteSigningUrlCreate.pluginClientId,
|
|
3074
|
-
// rsp.data.quoteSigningUrlCreate.redirectUri
|
|
3075
|
-
// );
|
|
3128
|
+
openDropboxSignModal(rsp.data.quoteSigningUrlCreate.pluginClientId, rsp.data.quoteSigningUrlCreate.redirectUri);
|
|
3076
3129
|
console.log("dropbox sign is not implemented");
|
|
3077
3130
|
}
|
|
3078
3131
|
else if (rsp.data.quoteSigningUrlCreate.pluginShortName === "pandadoc") {
|
|
@@ -3087,31 +3140,39 @@ var useSendAcceptQuote = function (token, subdomain, quoteId) {
|
|
|
3087
3140
|
});
|
|
3088
3141
|
};
|
|
3089
3142
|
// TODO: Fix hellosign-embedded window is undefined bug
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3143
|
+
var openDropboxSignModal = function (clientId, url) { return __awaiter(void 0, void 0, void 0, function () {
|
|
3144
|
+
var HelloSign, client;
|
|
3145
|
+
return __generator(this, function (_a) {
|
|
3146
|
+
switch (_a.label) {
|
|
3147
|
+
case 0:
|
|
3148
|
+
if (typeof window === "undefined") {
|
|
3149
|
+
return [2 /*return*/];
|
|
3150
|
+
}
|
|
3151
|
+
return [4 /*yield*/, Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('hellosign-embedded')); })];
|
|
3152
|
+
case 1:
|
|
3153
|
+
HelloSign = (_a.sent()).default;
|
|
3154
|
+
client = new HelloSign({
|
|
3155
|
+
clientId: clientId,
|
|
3156
|
+
});
|
|
3157
|
+
client.on("sign", function (data) {
|
|
3158
|
+
// Change the UI to show accepted?
|
|
3159
|
+
});
|
|
3160
|
+
// Open the DropboxSign modal
|
|
3161
|
+
client.open(url, {
|
|
3162
|
+
clientId: clientId,
|
|
3163
|
+
skipDomainVerification: false, // Set true for development testing
|
|
3164
|
+
});
|
|
3165
|
+
return [2 /*return*/];
|
|
3166
|
+
}
|
|
3167
|
+
});
|
|
3168
|
+
}); };
|
|
3107
3169
|
// TODO: update useing fetch
|
|
3108
3170
|
var sendAccept = function (changedFormItems) {
|
|
3109
3171
|
var mutation = "mutation quoteAccept($name: String!, $title: String!, $poNumber: String, $taxNumber: String, $quoteId: ID) {\n quoteAccept(name: $name, title: $title, poNumber: $poNumber, taxNumber: $taxNumber, quoteId: $quoteId) {\n errors\n }\n }";
|
|
3110
3172
|
var variables = __assign(__assign({}, changedFormItems), { quoteId: quoteId });
|
|
3111
3173
|
graphQLMutation(token, mutation, variables, function (rsp) {
|
|
3112
|
-
// if (rsp.errors) handleAllErrorFormats(rsp.errors);
|
|
3113
3174
|
if (rsp.errors)
|
|
3114
|
-
|
|
3175
|
+
handleAllErrorFormats(rsp.errors);
|
|
3115
3176
|
else {
|
|
3116
3177
|
setAcceptBoxVisible(false);
|
|
3117
3178
|
queryClient.invalidateQueries({
|
|
@@ -3157,45 +3218,6 @@ var useSigningComplete = function (_a) {
|
|
|
3157
3218
|
}, [data, eventParam, queryClient, token]);
|
|
3158
3219
|
};
|
|
3159
3220
|
|
|
3160
|
-
var ModalOverrideBrandStylings = styled__default["default"](antd.Modal)(templateObject_1$6 || (templateObject_1$6 = __makeTemplateObject(["\n .ant-modal-content {\n border-radius: 0.75rem;\n overflow: hidden;\n padding: 0 !important;\n }\n .ant-modal-title {\n font-family: ", ";\n }\n .ant-modal-header {\n border-bottom: none;\n padding: 1.5rem 1.5rem 0;\n margin: 0 !important;\n }\n .ant-modal-body {\n padding: 1rem 1.5rem 1.5rem;\n }\n .ant-modal-footer {\n border-top: none;\n padding: 0 1.5rem 1.5rem;\n margin: 0 !important;\n }\n"], ["\n .ant-modal-content {\n border-radius: 0.75rem;\n overflow: hidden;\n padding: 0 !important;\n }\n .ant-modal-title {\n font-family: ", ";\n }\n .ant-modal-header {\n border-bottom: none;\n padding: 1.5rem 1.5rem 0;\n margin: 0 !important;\n }\n .ant-modal-body {\n padding: 1rem 1.5rem 1.5rem;\n }\n .ant-modal-footer {\n border-top: none;\n padding: 0 1.5rem 1.5rem;\n margin: 0 !important;\n }\n"])), common.MARK_PRO);
|
|
3161
|
-
var StyledModal$1 = function (props) {
|
|
3162
|
-
return jsxRuntime.jsx(ModalOverrideBrandStylings, __assign({ closable: false }, props));
|
|
3163
|
-
};
|
|
3164
|
-
var templateObject_1$6;
|
|
3165
|
-
|
|
3166
|
-
var useFocusFirstInput = function (_a) {
|
|
3167
|
-
var firstInputRef = _a.firstInputRef, isVisible = _a.isVisible;
|
|
3168
|
-
React.useEffect(function () {
|
|
3169
|
-
var _a;
|
|
3170
|
-
(_a = firstInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
3171
|
-
}, [isVisible, firstInputRef]);
|
|
3172
|
-
};
|
|
3173
|
-
|
|
3174
|
-
var AcceptQuoteModal = function (_a) {
|
|
3175
|
-
var acceptBoxVisible = _a.acceptBoxVisible, formattedQuote = _a.formattedQuote, sendAccept = _a.sendAccept, setAcceptBoxVisible = _a.setAcceptBoxVisible, setIsAccepting = _a.setIsAccepting;
|
|
3176
|
-
// Refs
|
|
3177
|
-
var firstInputRef = React.useRef(null);
|
|
3178
|
-
// Hooks
|
|
3179
|
-
var form = antd.Form.useForm()[0];
|
|
3180
|
-
useFocusFirstInput({ firstInputRef: firstInputRef, isVisible: acceptBoxVisible });
|
|
3181
|
-
// Derived state
|
|
3182
|
-
var poNumberRequired = formattedQuote.poNumberRequired, taxNumberRequired = formattedQuote.taxNumberRequired, taxNumberLabel = formattedQuote.taxNumberLabel;
|
|
3183
|
-
var createRules = function (required, title) {
|
|
3184
|
-
return required ? [{ required: true, message: "".concat(title, " is required") }] : [];
|
|
3185
|
-
};
|
|
3186
|
-
return (jsxRuntime.jsx(StyledModal$1, __assign({ centered: true, okText: "Accept", onCancel: function () {
|
|
3187
|
-
setAcceptBoxVisible(false);
|
|
3188
|
-
setIsAccepting(false);
|
|
3189
|
-
}, onOk: function () {
|
|
3190
|
-
form
|
|
3191
|
-
.validateFields()
|
|
3192
|
-
.then(function (changedFields) {
|
|
3193
|
-
sendAccept(changedFields);
|
|
3194
|
-
})
|
|
3195
|
-
.catch(function () { });
|
|
3196
|
-
}, open: acceptBoxVisible, title: "Accept quote", width: 400 }, { children: jsxRuntime.jsxs(antd.Form, __assign({ className: "flex flex-col gap-2", form: form, layout: "vertical" }, { children: [jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Your name", name: "name", rules: createRules(true, "Your name") }, { children: jsxRuntime.jsx(antd.Input, { autoFocus: true, ref: firstInputRef }) })), jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Your job title", name: "title", rules: createRules(true, "Your job title") }, { children: jsxRuntime.jsx(antd.Input, {}) })), jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Purchase order number", name: "poNumber", rules: createRules(poNumberRequired, "Purchase order number") }, { children: jsxRuntime.jsx(antd.Input, {}) })), taxNumberRequired && (jsxRuntime.jsx(antd.Form.Item, __assign({ name: "taxNumber", label: taxNumberLabel, rules: createRules(taxNumberRequired, taxNumberLabel) }, { children: jsxRuntime.jsx(antd.Input, {}) })))] })) })));
|
|
3197
|
-
};
|
|
3198
|
-
|
|
3199
3221
|
var dayjs_min = {exports: {}};
|
|
3200
3222
|
|
|
3201
3223
|
(function (module, exports) {
|
|
@@ -3210,13 +3232,16 @@ var useIsExpired = function (expiresAt) {
|
|
|
3210
3232
|
|
|
3211
3233
|
var PandadocPollingModal = function (_a) {
|
|
3212
3234
|
var isVisible = _a.isVisible, setVisible = _a.setVisible, id = _a.id;
|
|
3213
|
-
var _b = React.useContext(BunnyContext), token = _b.token,
|
|
3214
|
-
var graphQLMutation = common.
|
|
3235
|
+
var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, onErrorNavigate = _b.onErrorNavigate;
|
|
3236
|
+
var graphQLMutation = common.useGraphQLmutation(function () {
|
|
3215
3237
|
console.log("graphQLMutation navigateOnTokenExpired not yet implemented");
|
|
3216
|
-
},
|
|
3238
|
+
}, apiHost || "", function () {
|
|
3217
3239
|
console.log("graphQLMutation onError not yet implemented");
|
|
3218
3240
|
});
|
|
3219
|
-
var handleAllErrorFormats = common.
|
|
3241
|
+
var handleAllErrorFormats = common.useAllErrorFormats(onErrorNavigate ||
|
|
3242
|
+
(function (url) {
|
|
3243
|
+
console.log("navigate to", url, " not implemented");
|
|
3244
|
+
}));
|
|
3220
3245
|
var _c = React.useState(0), numberOfPolls = _c[0], setNumberOfPolls = _c[1];
|
|
3221
3246
|
var _d = React.useState(""), infoMessage = _d[0], setInfoMessage = _d[1];
|
|
3222
3247
|
React.useEffect(function () {
|
|
@@ -3251,168 +3276,573 @@ var PandadocPollingModal = function (_a) {
|
|
|
3251
3276
|
return (jsxRuntime.jsxs(antd.Modal, __assign({ title: "Uploading quote to Pandadoc", open: isVisible, closable: false, footer: null }, { children: [jsxRuntime.jsxs("div", __assign({ className: "py-4 text-center" }, { children: ["This may take a few seconds", ".".repeat(numberOfPolls)] })), jsxRuntime.jsx("div", __assign({ className: "text-center" }, { children: infoMessage }))] })));
|
|
3252
3277
|
};
|
|
3253
3278
|
|
|
3254
|
-
var
|
|
3255
|
-
var
|
|
3256
|
-
|
|
3257
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
3258
|
-
var response;
|
|
3259
|
-
return __generator(this, function (_b) {
|
|
3260
|
-
switch (_b.label) {
|
|
3261
|
-
case 0: return [4 /*yield*/, common.gqlRequest({
|
|
3262
|
-
query: MUTATION$6(),
|
|
3263
|
-
token: token,
|
|
3264
|
-
subdomain: subdomain,
|
|
3265
|
-
vars: { id: id },
|
|
3266
|
-
})];
|
|
3267
|
-
case 1:
|
|
3268
|
-
response = _b.sent();
|
|
3269
|
-
return [2 /*return*/, response === null || response === void 0 ? void 0 : response.formattedQuote];
|
|
3270
|
-
}
|
|
3271
|
-
});
|
|
3272
|
-
});
|
|
3279
|
+
var ModalOverrideBrandStylings = styled__default["default"](antd.Modal)(templateObject_1$5 || (templateObject_1$5 = __makeTemplateObject(["\n .ant-modal-content {\n border-radius: 0.75rem;\n overflow: hidden;\n padding: 0 !important;\n }\n .ant-modal-title {\n font-family: ", ";\n }\n .ant-modal-header {\n border-bottom: none;\n padding: 1.5rem 1.5rem 0;\n margin: 0 !important;\n }\n .ant-modal-body {\n padding: 1rem 1.5rem 1.5rem;\n }\n .ant-modal-footer {\n border-top: none;\n padding: 0 1.5rem 1.5rem;\n margin: 0 !important;\n }\n"], ["\n .ant-modal-content {\n border-radius: 0.75rem;\n overflow: hidden;\n padding: 0 !important;\n }\n .ant-modal-title {\n font-family: ", ";\n }\n .ant-modal-header {\n border-bottom: none;\n padding: 1.5rem 1.5rem 0;\n margin: 0 !important;\n }\n .ant-modal-body {\n padding: 1rem 1.5rem 1.5rem;\n }\n .ant-modal-footer {\n border-top: none;\n padding: 0 1.5rem 1.5rem;\n margin: 0 !important;\n }\n"])), common.MARK_PRO);
|
|
3280
|
+
var StyledModal$1 = function (props) {
|
|
3281
|
+
return jsxRuntime.jsx(ModalOverrideBrandStylings, __assign({ closable: false }, props));
|
|
3273
3282
|
};
|
|
3283
|
+
var templateObject_1$5;
|
|
3274
3284
|
|
|
3275
|
-
var
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3285
|
+
var useFocusFirstInput = function (_a) {
|
|
3286
|
+
var firstInputRef = _a.firstInputRef, isVisible = _a.isVisible;
|
|
3287
|
+
React.useEffect(function () {
|
|
3288
|
+
var _a;
|
|
3289
|
+
(_a = firstInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
3290
|
+
}, [isVisible, firstInputRef]);
|
|
3291
|
+
};
|
|
3292
|
+
|
|
3293
|
+
var AcceptQuoteModal = function (_a) {
|
|
3294
|
+
var acceptBoxVisible = _a.acceptBoxVisible, formattedQuote = _a.formattedQuote, sendAccept = _a.sendAccept, setAcceptBoxVisible = _a.setAcceptBoxVisible, setIsAccepting = _a.setIsAccepting;
|
|
3295
|
+
// Refs
|
|
3296
|
+
var firstInputRef = React.useRef(null);
|
|
3297
|
+
// Hooks
|
|
3298
|
+
var form = antd.Form.useForm()[0];
|
|
3299
|
+
useFocusFirstInput({ firstInputRef: firstInputRef, isVisible: acceptBoxVisible });
|
|
3300
|
+
// Derived state
|
|
3301
|
+
var poNumberRequired = formattedQuote.poNumberRequired, taxNumberRequired = formattedQuote.taxNumberRequired, taxNumberLabel = formattedQuote.taxNumberLabel;
|
|
3302
|
+
var createRules = function (required, title) {
|
|
3303
|
+
return required ? [{ required: true, message: "".concat(title, " is required") }] : [];
|
|
3304
|
+
};
|
|
3305
|
+
return (jsxRuntime.jsx(StyledModal$1, __assign({ centered: true, okText: "Accept", onCancel: function () {
|
|
3306
|
+
setAcceptBoxVisible(false);
|
|
3307
|
+
setIsAccepting(false);
|
|
3308
|
+
}, onOk: function () {
|
|
3309
|
+
form
|
|
3310
|
+
.validateFields()
|
|
3311
|
+
.then(function (changedFields) {
|
|
3312
|
+
sendAccept(changedFields);
|
|
3313
|
+
})
|
|
3314
|
+
.catch(function () { });
|
|
3315
|
+
}, open: acceptBoxVisible, title: "Accept quote", width: 400 }, { children: jsxRuntime.jsxs(antd.Form, __assign({ className: "flex flex-col gap-2", form: form, layout: "vertical" }, { children: [jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Your name", name: "name", rules: createRules(true, "Your name") }, { children: jsxRuntime.jsx(antd.Input, { autoFocus: true, ref: firstInputRef }) })), jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Your job title", name: "title", rules: createRules(true, "Your job title") }, { children: jsxRuntime.jsx(antd.Input, {}) })), jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Purchase order number", name: "poNumber", rules: createRules(poNumberRequired, "Purchase order number") }, { children: jsxRuntime.jsx(antd.Input, {}) })), taxNumberRequired && (jsxRuntime.jsx(antd.Form.Item, __assign({ name: "taxNumber", label: taxNumberLabel, rules: createRules(taxNumberRequired, taxNumberLabel) }, { children: jsxRuntime.jsx(antd.Input, {}) })))] })) })));
|
|
3316
|
+
};
|
|
3317
|
+
|
|
3318
|
+
var DOCUMENT_NAME;
|
|
3319
|
+
(function (DOCUMENT_NAME) {
|
|
3320
|
+
DOCUMENT_NAME["INVOICE"] = "invoice";
|
|
3321
|
+
DOCUMENT_NAME["QUOTE"] = "quote";
|
|
3322
|
+
})(DOCUMENT_NAME || (DOCUMENT_NAME = {}));
|
|
3323
|
+
|
|
3324
|
+
var documentName = DOCUMENT_NAME.QUOTE;
|
|
3325
|
+
function ActualQuote(_a) {
|
|
3326
|
+
var _b, _c;
|
|
3327
|
+
var id = _a.id, entityId = _a.entityId;
|
|
3328
|
+
var _d = React.useContext(BunnyContext), token = _d.token, apiHost = _d.apiHost, onErrorNavigate = _d.onErrorNavigate;
|
|
3329
|
+
var entityBranding = React.useContext(BrandContext);
|
|
3330
|
+
var isMobile = common.useIsMobile(window);
|
|
3282
3331
|
// Queries
|
|
3283
3332
|
var _e = reactQuery.useQuery({
|
|
3284
3333
|
queryKey: common.QueryKeyFactory.default.createQuoteKey(token, id),
|
|
3285
|
-
queryFn: function () { return getFormattedQuote({ token: token,
|
|
3334
|
+
queryFn: function () { return getFormattedQuote({ token: token, apiHost: apiHost, id: id }); },
|
|
3286
3335
|
placeholderData: reactQuery.keepPreviousData,
|
|
3287
3336
|
}), data = _e.data, isLoading = _e.isLoading;
|
|
3288
|
-
reactQuery.useQuery({
|
|
3289
|
-
queryKey: common.QueryKeyFactory.default.currentUserKey,
|
|
3290
|
-
queryFn: function () { return getCurrentUserData({ token: token, subdomain: subdomain }); },
|
|
3291
|
-
});
|
|
3292
3337
|
var formattedQuote = data;
|
|
3293
3338
|
// Hooks
|
|
3294
|
-
var downloadFile =
|
|
3339
|
+
var downloadFile = useDownloadFile(id);
|
|
3295
3340
|
var isExpired = useIsExpired(formattedQuote === null || formattedQuote === void 0 ? void 0 : formattedQuote.expiresAt);
|
|
3296
|
-
var _f = useSendAcceptQuote(
|
|
3341
|
+
var _f = useSendAcceptQuote({
|
|
3342
|
+
entityId: entityId,
|
|
3343
|
+
token: token,
|
|
3344
|
+
onErrorNavigate: onErrorNavigate ||
|
|
3345
|
+
(function (url) {
|
|
3346
|
+
console.log("navigate to", url, " not implemented");
|
|
3347
|
+
}),
|
|
3348
|
+
apiHost: apiHost,
|
|
3349
|
+
quoteId: id,
|
|
3350
|
+
}), acceptBoxVisible = _f.acceptBoxVisible, isAccepting = _f.isAccepting, sendAccept = _f.sendAccept, setAcceptBoxVisible = _f.setAcceptBoxVisible, setIsAccepting = _f.setIsAccepting, startAcceptance = _f.startAcceptance, pandadocPollingModalVisible = _f.pandadocPollingModalVisible, setPandadocPollingModalVisible = _f.setPandadocPollingModalVisible;
|
|
3297
3351
|
useSigningComplete({ data: formattedQuote, token: token });
|
|
3298
3352
|
if (!formattedQuote || isLoading) {
|
|
3299
3353
|
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
3300
3354
|
}
|
|
3301
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(reactHelmetAsync.Helmet, { children: [jsxRuntime.jsxs("title", { children: [formattedQuote.vendorName, " ", documentName] }), jsxRuntime.jsx("meta", { name: "description", content:
|
|
3355
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(reactHelmetAsync.Helmet, { children: [jsxRuntime.jsxs("title", { children: [formattedQuote.vendorName, " ", documentName] }), jsxRuntime.jsx("meta", { name: "description", content: quoteMetaDescription(formattedQuote.vendorName) }), jsxRuntime.jsx("meta", { property: "og:type", content: "website" }), jsxRuntime.jsx("meta", { property: "og:title", content: quoteMetaTitle({
|
|
3302
3356
|
vendorName: formattedQuote.vendorName,
|
|
3303
3357
|
documentName: documentName,
|
|
3304
|
-
}) }), jsxRuntime.jsx("meta", { property: "og:description", content:
|
|
3358
|
+
}) }), jsxRuntime.jsx("meta", { property: "og:description", content: quoteMetaDescription(formattedQuote.vendorName) })] }), jsxRuntime.jsxs("div", __assign({ className: "flex shadow-padding-x ".concat(isMobile ? "flex-col gap-1" : "items-center gap-2", " justify-end pb-4"), id: "acceptance", style: {
|
|
3305
3359
|
color: entityBranding.secondaryColor,
|
|
3306
3360
|
} }, { children: [formattedQuote.state === "ACCEPTED" ||
|
|
3307
3361
|
formattedQuote.state === "APPLIED" ? (jsxRuntime.jsxs("div", { children: [formattedQuote.state === "ACCEPTED" &&
|
|
3308
3362
|
formattedQuote.acceptedAt &&
|
|
3309
|
-
"Quote was accepted by ".concat(formattedQuote.acceptedByName, " on ").concat(common.
|
|
3363
|
+
"Quote was accepted by ".concat(formattedQuote.acceptedByName, " on ").concat(common.formatDate(formattedQuote.acceptedAt)), formattedQuote.state === "APPLIED" &&
|
|
3310
3364
|
formattedQuote.acceptedAt &&
|
|
3311
|
-
"Quote is now applied. Accepted by ".concat(formattedQuote.acceptedByName, " on ").concat(common.
|
|
3365
|
+
"Quote is now applied. Accepted by ".concat(formattedQuote.acceptedByName, " on ").concat(common.formatDate(formattedQuote.acceptedAt))] })) : null, jsxRuntime.jsxs("div", __assign({ className: isMobile
|
|
3312
3366
|
? "flex w-full justify-between gap-2"
|
|
3313
|
-
: "flex items-center justify-end gap-2" }, { children: [!isMobile ? (jsxRuntime.jsx(antd.Button, __assign({ icon: jsxRuntime.jsx(DownloadOutlined$1, {}), onClick: function () { return downloadFile(
|
|
3314
|
-
formattedQuote.state !== "APPLIED" ? (jsxRuntime.jsx(antd.Button, __assign({ disabled: isExpired || isAccepting, onClick: function () { return startAcceptance(); }, type: "primary" }, { children: isExpired ? "Quote is expired" : "Accept quote" }))) : null] }))] })), jsxRuntime.jsx("div", __assign({ className: "flex ".concat(isMobile ? "flex-col w-full overflow-hidden" : "shadow-padding-xb") }, { children: jsxRuntime.jsx(InvoiceQuoteView, __assign({ html: formattedQuote.html
|
|
3367
|
+
: "flex items-center justify-end gap-2" }, { children: [!isMobile ? (jsxRuntime.jsx(antd.Button, __assign({ icon: jsxRuntime.jsx(DownloadOutlined$1, {}), onClick: function () { return downloadFile(apiHost + "/api/pdf/quote", token); } }, { children: "Download" }))) : null, formattedQuote.state !== "ACCEPTED" &&
|
|
3368
|
+
formattedQuote.state !== "APPLIED" ? (jsxRuntime.jsx(antd.Button, __assign({ disabled: isExpired || isAccepting, onClick: function () { return startAcceptance(); }, type: "primary" }, { children: isExpired ? "Quote is expired" : "Accept quote" }))) : null] }))] })), jsxRuntime.jsx("div", __assign({ className: "flex ".concat(isMobile ? "flex-col w-full overflow-hidden" : "shadow-padding-xb") }, { children: jsxRuntime.jsx(InvoiceQuoteView, __assign({ html: formattedQuote.html }, { children: ((_c = (_b = formattedQuote.object) === null || _b === void 0 ? void 0 : _b.documents) === null || _c === void 0 ? void 0 : _c.length) > 0 ? (jsxRuntime.jsx("div", __assign({ className: "flex flex-col items-end" }, { children: formattedQuote.object.documents.map(function (doc, index) {
|
|
3315
3369
|
return (jsxRuntime.jsx(antd.Button, __assign({ download: doc.filename, href: doc.url, type: "link" }, { children: doc.filename }), index));
|
|
3316
3370
|
}) }))) : null })) })), jsxRuntime.jsx(AcceptQuoteModal, { acceptBoxVisible: acceptBoxVisible, formattedQuote: formattedQuote, setAcceptBoxVisible: setAcceptBoxVisible, setIsAccepting: setIsAccepting, sendAccept: sendAccept }), jsxRuntime.jsx(PandadocPollingModal, { isVisible: pandadocPollingModalVisible, setVisible: setPandadocPollingModalVisible, id: id })] }));
|
|
3317
3371
|
}
|
|
3318
|
-
styled__default["default"].div(templateObject_1$
|
|
3372
|
+
styled__default["default"].div(templateObject_1$4 || (templateObject_1$4 = __makeTemplateObject(["\n span {\n width: 100%;\n }\n"], ["\n span {\n width: 100%;\n }\n"])));
|
|
3319
3373
|
function Quote(_a) {
|
|
3320
|
-
var id = _a.id;
|
|
3321
|
-
return (jsxRuntime.jsx(reactHelmetAsync.HelmetProvider, { children: jsxRuntime.jsx(ActualQuote, { id: id }) }));
|
|
3374
|
+
var entityId = _a.entityId, id = _a.id;
|
|
3375
|
+
return (jsxRuntime.jsx(reactHelmetAsync.HelmetProvider, { children: jsxRuntime.jsx(ActualQuote, { entityId: entityId, id: id }) }));
|
|
3322
3376
|
}
|
|
3323
|
-
var templateObject_1$
|
|
3377
|
+
var templateObject_1$4;
|
|
3324
3378
|
|
|
3325
|
-
var
|
|
3326
|
-
|
|
3327
|
-
|
|
3379
|
+
var QUOTES_QUERY = function (filter) { return "\n query quotes {\n quotes ".concat(filter ? "(".concat(filter, ")") : "", " {\n pageInfo {\n startCursor\n endCursor\n hasNextPage\n hasPreviousPage\n }\n nodes {\n id\n name\n account {\n name\n id\n }\n applicationDate\n state\n createdAt\n expiresAt\n currencyId\n amount\n number\n }\n }\n }"); };
|
|
3380
|
+
var getQuotes = function (_a) {
|
|
3381
|
+
var token = _a.token, apiHost = _a.apiHost, filter = _a.filter;
|
|
3382
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
3383
|
+
var response;
|
|
3384
|
+
return __generator(this, function (_b) {
|
|
3385
|
+
switch (_b.label) {
|
|
3386
|
+
case 0: return [4 /*yield*/, common.gqlRequest({
|
|
3387
|
+
query: QUOTES_QUERY(filter),
|
|
3388
|
+
token: token,
|
|
3389
|
+
vars: {},
|
|
3390
|
+
apiHost: apiHost,
|
|
3391
|
+
})];
|
|
3392
|
+
case 1:
|
|
3393
|
+
response = _b.sent();
|
|
3394
|
+
return [2 /*return*/, response === null || response === void 0 ? void 0 : response.quotes];
|
|
3395
|
+
}
|
|
3396
|
+
});
|
|
3397
|
+
});
|
|
3328
3398
|
};
|
|
3329
3399
|
|
|
3330
|
-
var
|
|
3331
|
-
|
|
3400
|
+
var transactionMutation = function (filter) { return "\nquery transactions {\n transactions ".concat(filter ? "(".concat(filter, ")") : "", " {\n nodes {\n amount\n createdAt\n currencyId\n description\n id\n kind\n state\n transactionableId\n transactionable {\n ...on Payment { amount }\n ...on Invoice { amount number }\n }\n }\n }\n}"); };
|
|
3401
|
+
var getTransactions = function (filter, token, apiHost, kindsToShow) { return __awaiter(void 0, void 0, void 0, function () {
|
|
3402
|
+
var response, _a, data, errors, transactions;
|
|
3403
|
+
var _b, _c;
|
|
3404
|
+
return __generator(this, function (_d) {
|
|
3405
|
+
switch (_d.label) {
|
|
3406
|
+
case 0: return [4 /*yield*/, fetch(apiHost + "/graphql", {
|
|
3407
|
+
method: "POST",
|
|
3408
|
+
headers: {
|
|
3409
|
+
"Content-type": "application/json; charset=utf-8",
|
|
3410
|
+
Authorization: "Bearer ".concat(token),
|
|
3411
|
+
},
|
|
3412
|
+
body: JSON.stringify({
|
|
3413
|
+
query: transactionMutation(filter),
|
|
3414
|
+
}),
|
|
3415
|
+
})];
|
|
3416
|
+
case 1:
|
|
3417
|
+
response = _d.sent();
|
|
3418
|
+
return [4 /*yield*/, response.json()];
|
|
3419
|
+
case 2:
|
|
3420
|
+
_a = _d.sent(), data = _a.data, errors = _a.errors;
|
|
3421
|
+
if (errors) {
|
|
3422
|
+
throw new Error(errors[0].message);
|
|
3423
|
+
}
|
|
3424
|
+
transactions = (_c = (_b = data === null || data === void 0 ? void 0 : data.transactions) === null || _b === void 0 ? void 0 : _b.nodes) === null || _c === void 0 ? void 0 : _c.filter(function (transaction) { return kindsToShow.includes(transaction.kind); });
|
|
3425
|
+
return [2 /*return*/, transactions === null || transactions === void 0 ? void 0 : transactions.reverse()];
|
|
3426
|
+
}
|
|
3427
|
+
});
|
|
3428
|
+
}); };
|
|
3429
|
+
|
|
3430
|
+
var Text$b = antd.Typography.Text;
|
|
3431
|
+
var PageHeaderWithActions = function (_a) {
|
|
3432
|
+
var children = _a.children, title = _a.title;
|
|
3433
|
+
var isMobile = common.useIsMobile(window);
|
|
3434
|
+
return (jsxRuntime.jsxs("div", __assign({ className: "flex pb-4 shadow-padding-x ".concat(isMobile ? "flex-col gap-2" : "items-center justify-between h-8") }, { children: [jsxRuntime.jsx(PageSubTitle, { title: title }), children] })));
|
|
3435
|
+
};
|
|
3436
|
+
var PageSubTitle = function (_a) {
|
|
3437
|
+
var title = _a.title;
|
|
3438
|
+
var secondaryColor = React.useContext(BrandContext).secondaryColor;
|
|
3439
|
+
var darkMode = React.useContext(BunnyContext).darkMode;
|
|
3440
|
+
return (jsxRuntime.jsx(Text$b, __assign({ className: "shrink-0 font-medium", style: { color: darkMode ? undefined : secondaryColor } }, { children: title })));
|
|
3332
3441
|
};
|
|
3333
3442
|
|
|
3334
|
-
var
|
|
3335
|
-
var
|
|
3336
|
-
return
|
|
3443
|
+
var StateTag = function (_a) {
|
|
3444
|
+
var state = _a.state;
|
|
3445
|
+
return jsxRuntime.jsx(antd.Tag, __assign({ color: getColor(state) }, { children: lodash.capitalize(lodash.startCase(state)) }));
|
|
3446
|
+
};
|
|
3447
|
+
var getColor = function (state) {
|
|
3448
|
+
switch (state) {
|
|
3449
|
+
case common.FrontendTransaction.TransactionState.not_due:
|
|
3450
|
+
return "yellow";
|
|
3451
|
+
case common.FrontendTransaction.TransactionState.voided:
|
|
3452
|
+
return "black";
|
|
3453
|
+
case common.FrontendTransaction.TransactionState.ready:
|
|
3454
|
+
return "orange";
|
|
3455
|
+
case common.FrontendTransaction.TransactionState.preparing:
|
|
3456
|
+
return "purple";
|
|
3457
|
+
case common.FrontendTransaction.TransactionState.unapplied:
|
|
3458
|
+
case common.FrontendTransaction.TransactionState.partially_applied:
|
|
3459
|
+
case common.FrontendTransaction.TransactionState.applied:
|
|
3460
|
+
return "blue";
|
|
3461
|
+
case common.FrontendTransaction.TransactionState.due:
|
|
3462
|
+
case common.FrontendTransaction.TransactionState.unpaid:
|
|
3463
|
+
return "orange";
|
|
3464
|
+
case common.FrontendTransaction.TransactionState.failed:
|
|
3465
|
+
return "red";
|
|
3466
|
+
case common.FrontendTransaction.TransactionState.paid:
|
|
3467
|
+
return "green";
|
|
3468
|
+
default:
|
|
3469
|
+
return "blue";
|
|
3470
|
+
}
|
|
3337
3471
|
};
|
|
3338
3472
|
|
|
3339
|
-
var
|
|
3473
|
+
var TransactionsListContext = React.createContext({});
|
|
3340
3474
|
|
|
3341
|
-
var
|
|
3342
|
-
|
|
3343
|
-
var
|
|
3344
|
-
return
|
|
3345
|
-
? "var(--row-background-dark)"
|
|
3346
|
-
: "var(--row-background)" }) }, { children: children })));
|
|
3475
|
+
var Text$a = antd.Typography.Text;
|
|
3476
|
+
var TransactionDate = function (_a) {
|
|
3477
|
+
var date = _a.date;
|
|
3478
|
+
return jsxRuntime.jsx(Text$a, __assign({ className: "text-sm" }, { children: common.formatDate(date) }));
|
|
3347
3479
|
};
|
|
3348
3480
|
|
|
3349
|
-
|
|
3350
|
-
var
|
|
3351
|
-
var
|
|
3352
|
-
|
|
3353
|
-
var isExpired = function (paymentMethodData) {
|
|
3354
|
-
// paymentMethodData.expirationDate
|
|
3355
|
-
var expDate = dayjs(paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.expirationDate);
|
|
3356
|
-
return expDate.isBefore(dayjs());
|
|
3357
|
-
};
|
|
3358
|
-
var isMobile = common.useIsMobile();
|
|
3359
|
-
var processPublicUrl = React.useContext(PaymentMethodContext).processPublicUrl;
|
|
3360
|
-
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 }))] }))] }))] })));
|
|
3481
|
+
// TODO: delete
|
|
3482
|
+
var ArrowDownToLine = function (_a) {
|
|
3483
|
+
var className = _a.className, _b = _a.color, color = _b === void 0 ? common.SLATE_600 : _b;
|
|
3484
|
+
return (jsxRuntime.jsxs("svg", __assign({ className: className, fill: "none", height: "16", viewBox: "0 0 16 16", width: "16", xmlns: "http://www.w3.org/2000/svg" }, { children: [jsxRuntime.jsx("path", { d: "M8 11.3333V2", stroke: color, strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), jsxRuntime.jsx("path", { d: "M4 7.33301L8 11.333L12 7.33301", stroke: color, strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), jsxRuntime.jsx("path", { d: "M12.6654 14H3.33203", stroke: color, strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })] })));
|
|
3361
3485
|
};
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3486
|
+
|
|
3487
|
+
var TransactionDownload = function (_a) {
|
|
3488
|
+
var transaction = _a.transaction, token = _a.token, apiHost = _a.apiHost;
|
|
3489
|
+
var darkMode = React.useContext(BunnyContext).darkMode;
|
|
3490
|
+
var downloadTransactionLink = React.useContext(TransactionsListContext).downloadTransactionLink;
|
|
3491
|
+
var downloadFile = useDownloadFile();
|
|
3492
|
+
var isMobile = common.useIsMobile(window);
|
|
3493
|
+
var isClickable = transaction.kind === "INVOICE" || downloadTransactionLink !== undefined;
|
|
3494
|
+
var downloadLink = downloadTransactionLink
|
|
3495
|
+
? downloadTransactionLink(transaction.transactionableId)
|
|
3496
|
+
: "".concat(apiHost, "/api/pdf/invoice/").concat(transaction.transactionableId);
|
|
3497
|
+
if (!isClickable)
|
|
3498
|
+
return null;
|
|
3499
|
+
return (jsxRuntime.jsx("div", __assign({ onClick: function (e) {
|
|
3500
|
+
e.stopPropagation();
|
|
3501
|
+
downloadFile(downloadLink, token);
|
|
3502
|
+
} }, { children: jsxRuntime.jsx(ArrowDownToLine, { className: "".concat(isMobile ? "" : "show-on-hover"), color: darkMode ? common.WHITE : common.SLATE_600 }) })));
|
|
3365
3503
|
};
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3504
|
+
|
|
3505
|
+
var TransactionGridCell = styled__default["default"].div.withConfig({
|
|
3506
|
+
shouldForwardProp: function (prop) {
|
|
3507
|
+
return !["gridColumn", "padding", "right"].includes(prop);
|
|
3508
|
+
},
|
|
3509
|
+
})(templateObject_1$3 || (templateObject_1$3 = __makeTemplateObject(["\n ", "\n\n display: flex;\n align-items: center;\n justify-content: ", ";\n\n text-align: ", ";\n white-space: nowrap;\n font-size: 14px;\n color: ", ";\n\n background-color: inherit;\n\n padding: 1rem;\n min-width: 48px;\n"], ["\n ", "\n\n display: flex;\n align-items: center;\n justify-content: ", ";\n\n text-align: ", ";\n white-space: nowrap;\n font-size: 14px;\n color: ", ";\n\n background-color: inherit;\n\n padding: 1rem;\n min-width: 48px;\n"])), function (props) { return props.gridColumn && "grid-column: ".concat(props.gridColumn, ";"); }, function (props) { return (props.right ? "flex-end" : "flex-start"); }, function (props) { return (props.right ? "right" : "left"); }, common.SLATE_600);
|
|
3510
|
+
var templateObject_1$3;
|
|
3511
|
+
|
|
3512
|
+
var Text$9 = antd.Typography.Text;
|
|
3513
|
+
var TransactionsEmptyState = function () {
|
|
3514
|
+
var noTransactionsMessage = React.useContext(TransactionsListContext).noTransactionsMessage;
|
|
3515
|
+
return (jsxRuntime.jsx(Text$9, __assign({ className: "flex justify-center p-4 text-base" }, { children: noTransactionsMessage || "There are no transactions" })));
|
|
3370
3516
|
};
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
return (jsxRuntime.jsxs("div", __assign({ className: "flex flex-col items-center justify-center w-full pt-8 px-4 pb-6 cursor-pointer bg-white shadow-md rounded-md", onClick: onClick }, { children: [jsxRuntime.jsx(LargeCardIcon, {}), jsxRuntime.jsx("div", __assign({ className: "text-slate-400 pt-4 pb-8" }, { children: "No payment methods" })), jsxRuntime.jsx(antd.Button, __assign({ type: "link" }, { children: jsxRuntime.jsxs("div", __assign({ className: "flex items-center gap-1" }, { children: [jsxRuntime.jsx(PlusIcon, { color: brandColor }), "Add payment method"] })) }))] })));
|
|
3517
|
+
|
|
3518
|
+
var isInvoice = function (transaction) {
|
|
3519
|
+
return transaction.kind === "INVOICE";
|
|
3375
3520
|
};
|
|
3376
|
-
var
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3521
|
+
var isQuote = function (transaction) {
|
|
3522
|
+
return transaction.kind === "QUOTE";
|
|
3523
|
+
};
|
|
3524
|
+
var TransactionRowTitle = function (_a) {
|
|
3525
|
+
var transaction = _a.transaction;
|
|
3526
|
+
if (!isInvoice(transaction) && !isQuote(transaction)) {
|
|
3527
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
3528
|
+
}
|
|
3529
|
+
return (jsxRuntime.jsx("span", __assign({ className: "text-slate-400", style: { fontSize: "11px" } }, { children: transaction.transactionable.number })));
|
|
3381
3530
|
};
|
|
3382
3531
|
|
|
3383
|
-
var
|
|
3384
|
-
|
|
3385
|
-
var
|
|
3386
|
-
|
|
3387
|
-
var
|
|
3388
|
-
var
|
|
3389
|
-
var
|
|
3390
|
-
var
|
|
3391
|
-
var
|
|
3392
|
-
|
|
3532
|
+
var Text$8 = antd.Typography.Text;
|
|
3533
|
+
var TransactionsListDesktop = function (_a) {
|
|
3534
|
+
var transactions = _a.transactions, onTransactionClick = _a.onTransactionClick;
|
|
3535
|
+
var columns = React.useContext(TransactionsListContext).columns;
|
|
3536
|
+
var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, darkMode = _b.darkMode;
|
|
3537
|
+
var showAmount = columns.includes("amount");
|
|
3538
|
+
var showDateAndTitle = columns.includes("date-and-title");
|
|
3539
|
+
var showDownload = columns.includes("download");
|
|
3540
|
+
var showState = columns.includes("state");
|
|
3541
|
+
if ((transactions === null || transactions === void 0 ? void 0 : transactions.length) === 0)
|
|
3542
|
+
return jsxRuntime.jsx(TransactionsEmptyState, {});
|
|
3543
|
+
return transactions === null || transactions === void 0 ? void 0 : transactions.map(function (transaction, index) {
|
|
3544
|
+
var _a;
|
|
3545
|
+
var isClickable = onTransactionClick !== undefined;
|
|
3546
|
+
return (jsxRuntime.jsxs("div", __assign({ className: "contents ".concat(isClickable && "cursor-pointer", " show-on-hover-container"), onClick: function () {
|
|
3547
|
+
onTransactionClick === null || onTransactionClick === void 0 ? void 0 : onTransactionClick(transaction);
|
|
3548
|
+
}, style: {
|
|
3549
|
+
backgroundColor: index % 2 === 0
|
|
3550
|
+
? "var(--row-background".concat(darkMode ? "-dark" : "", ")")
|
|
3551
|
+
: "var(--row-background-alternate".concat(darkMode ? "-dark" : "", ")"),
|
|
3552
|
+
} }, { children: [showDateAndTitle && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(TransactionGridCell, __assign({ right: false }, { children: jsxRuntime.jsx(TransactionDate, { date: transaction.createdAt }) })), jsxRuntime.jsxs(TransactionGridCell, __assign({ right: false, className: "flex items-center gap-2" }, { children: [jsxRuntime.jsx(Text$8, { children: lodash.capitalize(transaction.kind.toLowerCase()) }), jsxRuntime.jsx(TransactionRowTitle, { transaction: transaction })] }))] })), showDownload && (jsxRuntime.jsx(TransactionGridCell, { children: jsxRuntime.jsx(TransactionDownload, { transaction: transaction, token: token, apiHost: apiHost }) })), showState && (jsxRuntime.jsx(TransactionGridCell, __assign({ right: true }, { children: jsxRuntime.jsx(StateTag, { state: transaction.state }) }))), showAmount && (jsxRuntime.jsx(TransactionGridCell, __assign({ right: true }, { children: jsxRuntime.jsx(Text$8, { children: common.formatCurrency(((_a = transaction === null || transaction === void 0 ? void 0 : transaction.transactionable) === null || _a === void 0 ? void 0 : _a.amount) || transaction.amount, transaction.currencyId) }) })))] }), index));
|
|
3393
3553
|
});
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
var
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3554
|
+
};
|
|
3555
|
+
|
|
3556
|
+
var Text$7 = antd.Typography.Text;
|
|
3557
|
+
var TransactionsListMobile = function (_a) {
|
|
3558
|
+
var transactions = _a.transactions, onTransactionClick = _a.onTransactionClick;
|
|
3559
|
+
var columns = React.useContext(TransactionsListContext).columns;
|
|
3560
|
+
var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, darkMode = _b.darkMode;
|
|
3561
|
+
var showAmount = columns.includes("amount");
|
|
3562
|
+
var showDateAndTitle = columns.includes("date-and-title");
|
|
3563
|
+
var showDownload = columns.includes("download");
|
|
3564
|
+
var showState = columns.includes("state");
|
|
3565
|
+
if ((transactions === null || transactions === void 0 ? void 0 : transactions.length) === 0)
|
|
3566
|
+
return jsxRuntime.jsx(TransactionsEmptyState, {});
|
|
3567
|
+
return transactions === null || transactions === void 0 ? void 0 : transactions.map(function (transaction, index) {
|
|
3568
|
+
var isClickable = transaction.kind === "INVOICE";
|
|
3569
|
+
return (jsxRuntime.jsxs("div", __assign({ className: "contents ".concat(isClickable && "cursor-pointer", " show-on-hover-container"), onClick: function () {
|
|
3570
|
+
onTransactionClick(transaction);
|
|
3571
|
+
}, style: {
|
|
3572
|
+
backgroundColor: index % 2 === 0
|
|
3573
|
+
? "var(--row-background".concat(darkMode ? "-dark" : "", ")")
|
|
3574
|
+
: "var(--row-background-alternate".concat(darkMode ? "-dark" : "", ")"),
|
|
3575
|
+
} }, { children: [jsxRuntime.jsx(TransactionGridCell, { children: jsxRuntime.jsxs("div", __assign({ className: "flex flex-col gap-2" }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex items-center gap-2" }, { children: [showDateAndTitle && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Text$7, { children: lodash.capitalize(transaction.kind.toLowerCase()) }), jsxRuntime.jsx(TransactionRowTitle, { transaction: transaction })] })), showState && jsxRuntime.jsx(StateTag, { state: transaction.state })] })), jsxRuntime.jsxs("div", __assign({ className: "flex items-center gap-2" }, { children: [showDateAndTitle && (jsxRuntime.jsx(TransactionDate, { date: transaction.createdAt })), showAmount && showDateAndTitle && jsxRuntime.jsx(Text$7, { children: "\u00B7" }), showAmount && (jsxRuntime.jsx(Text$7, { children: common.formatCurrency(transaction.transactionable.amount || transaction.amount, transaction.currencyId) }))] }))] })) }), showDownload && (jsxRuntime.jsx(TransactionGridCell, __assign({ right: true }, { children: jsxRuntime.jsx(TransactionDownload, { transaction: transaction, token: token, apiHost: apiHost }) })))] }), index));
|
|
3403
3576
|
});
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3577
|
+
};
|
|
3578
|
+
|
|
3579
|
+
function Transactions(_a) {
|
|
3580
|
+
var transactionComponent = _a.transactionComponent, _b = _a.showSearchBar, showSearchBar = _b === void 0 ? true : _b, _c = _a.showTitle, showTitle = _c === void 0 ? true : _c, _d = _a.columns, columns = _d === void 0 ? ["date-and-title", "state", "amount"] : _d, className = _a.className, _e = _a.shadow, shadow = _e === void 0 ? "md" : _e, searchBarClassName = _a.searchBarClassName, _f = _a.useModal, useModal = _f === void 0 ? false : _f, onTransactionClick = _a.onTransactionClick, _g = _a.suppressTransactionDisplay, suppressTransactionDisplay = _g === void 0 ? false : _g, _h = _a.kindsToShow, kindsToShow = _h === void 0 ? [
|
|
3581
|
+
common.TransactionKind.INVOICE,
|
|
3582
|
+
common.TransactionKind.PAYMENT,
|
|
3583
|
+
common.TransactionKind.REFUND,
|
|
3584
|
+
common.TransactionKind.WRITE_OFF,
|
|
3585
|
+
] : _h, style = _a.style, filter = _a.filter, noTransactionsMessage = _a.noTransactionsMessage, entityId = _a.entityId;
|
|
3586
|
+
var contextValues = {
|
|
3587
|
+
showSearchBar: showSearchBar,
|
|
3588
|
+
showTitle: showTitle,
|
|
3589
|
+
transactionComponent: transactionComponent,
|
|
3590
|
+
columns: columns,
|
|
3591
|
+
className: className,
|
|
3592
|
+
searchBarClassName: searchBarClassName,
|
|
3593
|
+
shadow: shadow,
|
|
3594
|
+
useModal: useModal,
|
|
3595
|
+
onTransactionClick: onTransactionClick,
|
|
3596
|
+
suppressTransactionDisplay: suppressTransactionDisplay,
|
|
3597
|
+
kindsToShow: kindsToShow,
|
|
3598
|
+
style: style,
|
|
3599
|
+
filter: filter,
|
|
3600
|
+
noTransactionsMessage: noTransactionsMessage,
|
|
3601
|
+
entityId: entityId,
|
|
3602
|
+
};
|
|
3603
|
+
return (jsxRuntime.jsx(TransactionsListContext.Provider, __assign({ value: contextValues }, { children: jsxRuntime.jsx(TransactionsWrapper, {}) })));
|
|
3604
|
+
}
|
|
3605
|
+
function TransactionsWrapper() {
|
|
3606
|
+
var _a = React.useContext(TransactionsListContext), kindsToShow = _a.kindsToShow, filterFromContext = _a.filter;
|
|
3607
|
+
var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
|
|
3608
|
+
// Local state
|
|
3609
|
+
var _c = React.useState(""), search = _c[0], setSearch = _c[1];
|
|
3610
|
+
var filter = filterFromContext ||
|
|
3611
|
+
(search ? "filter: \"transaction.transactionableId is ".concat(search, "\"") : "");
|
|
3612
|
+
// Queries
|
|
3613
|
+
var data = reactQuery.useQuery({
|
|
3614
|
+
queryKey: ["transactions", token, filter],
|
|
3615
|
+
queryFn: function () { return getTransactions(filter, token, apiHost, kindsToShow); },
|
|
3616
|
+
placeholderData: reactQuery.keepPreviousData,
|
|
3617
|
+
}).data;
|
|
3618
|
+
return (jsxRuntime.jsx(TransactionsDisplay, { transactions: data, onSearchValueChanged: setSearch, search: search }));
|
|
3619
|
+
}
|
|
3620
|
+
function TransactionsDisplay(_a) {
|
|
3621
|
+
var transactions = _a.transactions, onSearchValueChanged = _a.onSearchValueChanged, search = _a.search, title = _a.title;
|
|
3622
|
+
var _b = React.useContext(TransactionsListContext), showSearchBar = _b.showSearchBar, showTitle = _b.showTitle, transactionComponent = _b.transactionComponent, useModal = _b.useModal, suppressTransactionDisplay = _b.suppressTransactionDisplay, className = _b.className, shadow = _b.shadow, searchBarClassName = _b.searchBarClassName, style = _b.style, onTransactionClick = _b.onTransactionClick, entityId = _b.entityId;
|
|
3623
|
+
var columns = React.useContext(TransactionsListContext).columns;
|
|
3624
|
+
var darkMode = React.useContext(BunnyContext).darkMode;
|
|
3625
|
+
// Local state
|
|
3626
|
+
var _c = React.useState(null), selectedTransaction = _c[0], setSelectedTransaction = _c[1];
|
|
3627
|
+
var _d = React.useState(false), drawerOpen = _d[0], setDrawerOpen = _d[1];
|
|
3628
|
+
// Hooks
|
|
3629
|
+
var isMobile = common.useIsMobile(window);
|
|
3630
|
+
function handleTransactionClick(transaction) {
|
|
3631
|
+
if (onTransactionClick) {
|
|
3632
|
+
onTransactionClick(transaction);
|
|
3633
|
+
}
|
|
3634
|
+
if (!suppressTransactionDisplay) {
|
|
3635
|
+
setSelectedTransaction(transaction);
|
|
3636
|
+
setDrawerOpen(true);
|
|
3637
|
+
}
|
|
3638
|
+
}
|
|
3639
|
+
// Since the columns are dynamic, we need to calculate the grid template columns
|
|
3640
|
+
var gridTemplateColumns = function () {
|
|
3641
|
+
var templateColumns = [];
|
|
3642
|
+
if (isMobile) {
|
|
3643
|
+
if (columns.includes("date-and-title") ||
|
|
3644
|
+
columns.includes("state") ||
|
|
3645
|
+
columns.includes("amount")) {
|
|
3646
|
+
templateColumns.push("auto");
|
|
3647
|
+
}
|
|
3648
|
+
if (columns.includes("download")) {
|
|
3649
|
+
templateColumns.push("auto");
|
|
3650
|
+
}
|
|
3651
|
+
}
|
|
3652
|
+
else {
|
|
3653
|
+
if (columns.includes("date-and-title")) {
|
|
3654
|
+
templateColumns.push("auto 3fr");
|
|
3655
|
+
}
|
|
3656
|
+
if (columns.includes("download")) {
|
|
3657
|
+
templateColumns.push("auto");
|
|
3658
|
+
}
|
|
3659
|
+
if (columns.includes("state")) {
|
|
3660
|
+
templateColumns.push("auto");
|
|
3661
|
+
}
|
|
3662
|
+
if (columns.includes("amount")) {
|
|
3663
|
+
templateColumns.push("auto");
|
|
3664
|
+
}
|
|
3665
|
+
}
|
|
3666
|
+
return templateColumns.join(" ");
|
|
3667
|
+
};
|
|
3668
|
+
var drawerTitle = function () {
|
|
3669
|
+
if (!selectedTransaction)
|
|
3670
|
+
return "";
|
|
3671
|
+
var kind = selectedTransaction.kind.toLowerCase();
|
|
3672
|
+
return kind.charAt(0).toUpperCase() + kind.slice(1);
|
|
3673
|
+
};
|
|
3674
|
+
return (jsxRuntime.jsxs("div", __assign({ style: style }, { children: [jsxRuntime.jsx(PageHeaderWithActions, __assign({ title: title || (showTitle ? "Past transactions" : undefined) }, { children: showSearchBar && (jsxRuntime.jsx("div", { children: jsxRuntime.jsx(antd.Input, { className: searchBarClassName
|
|
3675
|
+
? searchBarClassName
|
|
3676
|
+
: "border border-slate-200", onChange: function (e) {
|
|
3677
|
+
if (isNaN(Number(e.target.value))) {
|
|
3678
|
+
return;
|
|
3679
|
+
}
|
|
3680
|
+
onSearchValueChanged(e.target.value);
|
|
3681
|
+
}, prefix: jsxRuntime.jsx(SearchOutlined$1, {}), placeholder: "Search by id #", style: {
|
|
3682
|
+
minWidth: "300px",
|
|
3683
|
+
}, value: search }) })) })), jsxRuntime.jsx("div", __assign({ className: "flex w-full shadow-padding-xb ".concat(isMobile ? "overflow-hidden" : "", " ").concat(className) }, { children: jsxRuntime.jsx("div", __assign({ className: "grid w-full rounded-md overflow-auto ".concat("shadow-".concat(shadow)), style: {
|
|
3684
|
+
gridTemplateColumns: gridTemplateColumns(),
|
|
3685
|
+
backgroundColor: "var(--row-background".concat(darkMode ? "-dark" : "", ")"),
|
|
3686
|
+
} }, { children: isMobile ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: TransactionsListMobile({
|
|
3687
|
+
transactions: transactions,
|
|
3688
|
+
onTransactionClick: handleTransactionClick,
|
|
3689
|
+
}) })) : (jsxRuntime.jsx(jsxRuntime.Fragment, { children: TransactionsListDesktop({
|
|
3690
|
+
transactions: transactions,
|
|
3691
|
+
onTransactionClick: handleTransactionClick,
|
|
3692
|
+
}) })) })) })), useModal ? (jsxRuntime.jsx(antd.Modal, __assign({ title: "Basic Modal", open: drawerOpen, onOk: function () { return setDrawerOpen(false); }, onCancel: function () { return setDrawerOpen(false); }, width: 900, footer: null }, { children: jsxRuntime.jsx(Invoice, { id: (selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.transactionableId) || "", entityId: entityId }) }))) : (jsxRuntime.jsx(antd.Drawer, __assign({ title: drawerTitle(), onClose: function () { return setDrawerOpen(false); }, open: drawerOpen, width: 900 }, { children: transactionComponent ? (transactionComponent) : (selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.kind) === "INVOICE" ? (jsxRuntime.jsx(Invoice, { id: selectedTransaction.transactionableId, entityId: entityId })) : (jsxRuntime.jsxs(antd.Card, __assign({ className: "shadow-md" }, { children: [jsxRuntime.jsx(antd.Typography.Title, __assign({ level: 2, className: "mb-4" }, { children: "Transaction Details" })), jsxRuntime.jsxs(antd.Typography.Paragraph, { children: [jsxRuntime.jsx("strong", { children: "Amount:" }), " ", jsxRuntime.jsx(antd.Typography.Text, { children: common.formatCurrency((selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.amount) || 0, (selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.currencyId) || "USD") })] }), jsxRuntime.jsxs(antd.Typography.Paragraph, { children: [jsxRuntime.jsx("strong", { children: "Description:" }), " ", jsxRuntime.jsx(antd.Typography.Text, { children: selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.description })] }), jsxRuntime.jsxs(antd.Typography.Paragraph, { children: [jsxRuntime.jsx("strong", { children: "Kind:" }), " ", jsxRuntime.jsx(antd.Typography.Text, { children: selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.kind })] }), jsxRuntime.jsxs(antd.Typography.Paragraph, { children: [jsxRuntime.jsx("strong", { children: "State:" }), " ", jsxRuntime.jsx(antd.Typography.Text, { children: selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.state })] })] }))) })))] })));
|
|
3693
|
+
}
|
|
3694
|
+
|
|
3695
|
+
function Quotes(_a) {
|
|
3696
|
+
var className = _a.className, _b = _a.columns, columns = _b === void 0 ? ["date-and-title", "amount", "download"] : _b, entityId = _a.entityId, filter = _a.filter, _c = _a.noQuotesMessage, noQuotesMessage = _c === void 0 ? "There are no quotes" : _c; _a.onQuoteClick; var quoteComponent = _a.quoteComponent, searchBarClassName = _a.searchBarClassName, _d = _a.shadow, shadow = _d === void 0 ? "md" : _d, _e = _a.showSearchBar, showSearchBar = _e === void 0 ? true : _e, _f = _a.showTitle, showTitle = _f === void 0 ? true : _f, style = _a.style, _g = _a.suppressQuoteDisplay, suppressQuoteDisplay = _g === void 0 ? false : _g, _h = _a.useModal, useModal = _h === void 0 ? false : _h;
|
|
3697
|
+
var apiHost = React.useContext(BunnyContext).apiHost;
|
|
3698
|
+
var _j = React.useState(null), component = _j[0], setComponent = _j[1];
|
|
3699
|
+
var contextValues = {
|
|
3700
|
+
columns: columns,
|
|
3701
|
+
kindsToShow: [],
|
|
3702
|
+
onTransactionClick: handleQuoteClick,
|
|
3703
|
+
transactionComponent: component,
|
|
3704
|
+
showSearchBar: showSearchBar,
|
|
3705
|
+
showTitle: showTitle,
|
|
3706
|
+
className: className,
|
|
3707
|
+
shadow: shadow,
|
|
3708
|
+
searchBarClassName: searchBarClassName,
|
|
3709
|
+
useModal: useModal,
|
|
3710
|
+
suppressTransactionDisplay: suppressQuoteDisplay,
|
|
3711
|
+
style: style,
|
|
3712
|
+
noTransactionsMessage: noQuotesMessage,
|
|
3713
|
+
filter: filter,
|
|
3714
|
+
downloadTransactionLink: function (id) { return "".concat(apiHost, "/api/pdf/quote/").concat(id); },
|
|
3715
|
+
entityId: entityId,
|
|
3716
|
+
};
|
|
3717
|
+
function handleQuoteClick(quote) {
|
|
3718
|
+
if (quoteComponent) {
|
|
3719
|
+
setComponent(quoteComponent);
|
|
3720
|
+
}
|
|
3721
|
+
else {
|
|
3722
|
+
setComponent(jsxRuntime.jsx(Quote, { entityId: entityId, id: quote === null || quote === void 0 ? void 0 : quote.transactionableId }));
|
|
3723
|
+
}
|
|
3724
|
+
}
|
|
3725
|
+
return (jsxRuntime.jsx(TransactionsListContext.Provider, __assign({ value: contextValues }, { children: jsxRuntime.jsx(QuotesWrapper, {}) })));
|
|
3726
|
+
}
|
|
3727
|
+
function QuotesWrapper() {
|
|
3728
|
+
var _a = React.useContext(BunnyContext), token = _a.token, apiHost = _a.apiHost;
|
|
3729
|
+
var filterFromContext = React.useContext(TransactionsListContext).filter;
|
|
3730
|
+
// Local state
|
|
3731
|
+
var _b = React.useState(""), search = _b[0], setSearch = _b[1];
|
|
3732
|
+
var filter = filterFromContext || (search ? "filter: \"quote.id is ".concat(search, "\"") : "");
|
|
3733
|
+
// Queries
|
|
3734
|
+
var data = reactQuery.useQuery({
|
|
3735
|
+
queryKey: ["quotes", token, filter],
|
|
3736
|
+
queryFn: function () { return getQuotes({ token: token, apiHost: apiHost, filter: filter }); },
|
|
3737
|
+
placeholderData: reactQuery.keepPreviousData,
|
|
3738
|
+
}).data;
|
|
3739
|
+
if (data === undefined)
|
|
3740
|
+
return null;
|
|
3741
|
+
var quotesAsTransactions = data.nodes.map(function (quote) { return ({
|
|
3742
|
+
transactionableId: quote.id,
|
|
3743
|
+
state: "unapplied",
|
|
3744
|
+
amount: quote.amount || quote.amountDue,
|
|
3745
|
+
kind: "QUOTE",
|
|
3746
|
+
currencyId: quote.currencyId,
|
|
3747
|
+
transactionable: {
|
|
3748
|
+
number: quote.number,
|
|
3749
|
+
},
|
|
3750
|
+
createdAt: quote.createdAt,
|
|
3751
|
+
}); });
|
|
3752
|
+
return (jsxRuntime.jsx(TransactionsDisplay, { transactions: quotesAsTransactions, onSearchValueChanged: setSearch, search: search, title: "Past quotes" }));
|
|
3753
|
+
}
|
|
3754
|
+
|
|
3755
|
+
var css_248z = ".ant-tag {\n border: none;\n border-radius: 14px;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n font-weight: 500;\n white-space: nowrap;\n margin: 0;\n}\n.ant-tag-blue {\n color: #3b82f6 !important;\n background: #bfdbfe !important;\n}\n.ant-tag-green {\n color: #059669 !important;\n background: #a7f3d0 !important;\n}\n.ant-tag-red {\n color: #ef4444 !important;\n background: #fecaca !important;\n}\n.ant-tag-orange {\n color: #f97316 !important;\n background: #fed7aa !important;\n}\n.ant-tag-yellow {\n color: #f59e0b !important;\n background: #fde68a !important;\n}\n.ant-tag-purple {\n color: #8b5cf6 !important;\n background: #ddd6fe !important;\n}\n.ant-tag-black {\n color: white !important;\n background: black !important;\n}\n.ant-popover {\n z-index: 1050;\n}\n.ant-popover-inner-content {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n max-width: 300px;\n}\n.ant-popover-message-title {\n padding: 0;\n text-align: center;\n font-size: 1rem;\n}\n.ant-popover-buttons {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.ant-btn-primary:disabled {\n background: #eef0f2 !important;\n color: rgba(0, 0, 0, 0.25) !important;\n border: none;\n}\n.ant-btn {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n font-weight: 500;\n box-shadow: none;\n text-shadow: none;\n outline: none !important;\n line-height: 1;\n font-size: 0.875rem;\n font-weight: normal;\n}\n.ant-btn > span {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n.ant-btn-lg {\n height: 44px !important;\n}\n.ant-btn-default:disabled {\n border-color: rgba(113, 125, 148, 0.2) !important;\n}\n.ant-btn-link {\n border: none !important;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n.ant-btn-link > span {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n.ant-btn-link:disabled {\n background-color: transparent !important;\n color: #717d94 !important;\n}\n.ant-btn-link:disabled:hover {\n background-color: transparent !important;\n}\n.ant-input-affix-wrapper .ant-input-prefix {\n transition: color 0.3s;\n}\n.ant-select-selector {\n box-shadow: none !important;\n background-color: transparent !important;\n border: none !important;\n}\n.ant-form-item-label {\n text-transform: none !important;\n font-size: 0.75rem;\n padding-bottom: 2px !important;\n}\n.ant-form-item-label > label {\n width: 100%;\n color: #4b5563 !important;\n}\n.ant-form-item-explain-error {\n font-size: 11px;\n min-height: 11px;\n line-height: 11px;\n padding-top: 2px;\n}\n.ant-form-item {\n margin-bottom: 0;\n}\n.ant-notification {\n width: min-content;\n}\n.ant-notification-topRight {\n right: 0 !important;\n left: 0 !important;\n margin-left: auto !important;\n margin-right: auto !important;\n}\n.ant-notification-notice-wrapper {\n width: 350px !important;\n overflow: hidden !important;\n}\n.ant-notification-notice {\n padding: 16px !important;\n width: 350px !important;\n display: flex !important;\n box-shadow: 0px 6px 10px rgba(0, 0, 0, 0.08), 0px 1px 18px rgba(0, 0, 0, 0.08), 0px 3px 5px rgba(0, 0, 0, 0.16) !important;\n}\n.ant-notification-notice-description {\n padding: 0 14px 0 0 !important;\n color: #232323 !important;\n font-size: 14px !important;\n word-break: break-all !important;\n overflow-wrap: break-word !important;\n}\n.ant-notification-notice-success {\n background-color: #edfffa !important;\n}\n.ant-notification-notice-error {\n background-color: #fff8f4 !important;\n}\n.ant-notification-notice-error .ant-notification-notice-message {\n color: #ff6e1c !important;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji !important;\n font-weight: 500;\n}\n.ant-notification-notice-error .ant-notification-notice-icon {\n color: #ff6e1c;\n}\n.ant-notification-notice-success .ant-notification-notice-message {\n color: #00b76a !important;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji !important;\n font-weight: 500;\n}\n.ant-notification-notice-success .ant-notification-notice-icon {\n color: #00b76a !important;\n}\n.ant-notification-notice-message {\n margin-bottom: 0 !important;\n}\n.ant-notification-notice-close {\n top: 16px !important;\n right: 16px !important;\n}\n.ant-divider {\n margin: 0;\n}\n.ant-menu-submenu-popup > .ant-menu .ant-menu-item {\n display: flex !important;\n align-items: center !important;\n}\n.ant-menu-submenu::after {\n display: none !important;\n}\n.ant-drawer-title {\n font-weight: 400 !important;\n}\n.ant-drawer-header-title {\n flex-direction: row-reverse !important;\n align-items: start !important ;\n}\n.ant-drawer-close {\n margin-inline-end: 0 !important;\n}\n@media (min-width: 768px) {\n .ant-input,\n .ant-picker,\n .ant-select,\n .ant-input-affix-wrapper {\n font-size: 1rem !important;\n }\n .ant-drawer-header {\n padding-right: 1.5rem !important;\n padding-left: 1.5rem !important;\n }\n}\n:root {\n --row-background: #ffffff;\n --row-background-alternate: rgba(100, 116, 139, 0.04);\n --row-background-dark: #121212;\n --row-background-alternate-dark: #1e1e1e;\n}\n.plan-step-line {\n height: 1px;\n min-width: 128px;\n background: #717d94;\n}\n.plan-step-number {\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 9999px;\n border: 1px solid #717d94;\n background: white;\n width: 24px;\n height: 24px;\n color: #717d94;\n}\n.plan-step-number.active {\n border: none;\n color: white;\n background: #ff6e1c;\n}\n.hidden {\n display: none;\n}\n.cardElement {\n padding: 8px 11px;\n border: 1px solid #e5e7eb;\n background-color: white;\n font-family: Inter !important;\n}\n.tooltip {\n visibility: hidden;\n position: absolute !important;\n}\n.has-tooltip:hover .tooltip {\n visibility: visible;\n z-index: 100;\n}\n.show-on-hover {\n opacity: 0;\n}\n.show-on-hover-container:hover .show-on-hover {\n opacity: 1;\n}\n.pdf-only {\n display: none !important;\n}\n.notes p {\n margin: 0;\n padding: 0;\n padding-bottom: 0.25rem;\n}\n#form-element #finix-form-container .field-holder label {\n color: #717d94 !important;\n font-size: 12px !important;\n}\n#form-element #finix-form-container > *:first-child,\n#form-element #finix-form-container > *:last-child {\n margin-top: 0 !important;\n}\n#form-element #finix-form-container > *:not(:first-child):not(:last-child) {\n margin-top: 12px !important;\n}\n#form-element #finix-form-container .field-array > * {\n margin-top: 0 !important;\n}\n#form-element #finix-form-container .field-holder .field,\n#form-element #finix-form-container iframe {\n height: 34px !important;\n}\n#form-element #finix-form-container .field {\n margin-top: 0 !important;\n padding-top: 2px !important;\n}\n#form-element #finix-form-container .field-holder .validation {\n font-size: 11px !important;\n color: #ff4d4f !important;\n}\n.icon-path {\n transition: fill 0.3s;\n}\n.shadow-padding-x {\n padding-right: 1rem;\n padding-left: 1rem;\n}\n.shadow-padding-xb {\n padding-right: 1rem;\n padding-left: 1rem;\n padding-bottom: 0.5rem;\n}\n.content-container {\n width: 100%;\n margin: 0 auto;\n}\n@media (min-width: 1220px) {\n .content-container {\n width: 1220px !important;\n margin: 0 auto;\n }\n}\n@media (min-width: 768px) {\n .shadow-padding-x {\n padding-right: 2rem;\n padding-left: 2rem;\n }\n .shadow-padding-xb {\n padding-right: 2rem;\n padding-left: 2rem;\n padding-bottom: 0.5rem;\n }\n .sm\\:flex {\n display: flex !important;\n }\n .sm\\:hidden {\n display: none !important;\n }\n}\n* {\n margin: 0;\n padding: 0;\n box-sizing: border-box !important;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n line-height: 1.15;\n}\nbody {\n color: #232323;\n background-color: #f8fafc;\n}\nth {\n font-weight: normal;\n}\ncode {\n font-family: source-code-pro, Menlo, Monaco, Consolas, \"Courier New\", monospace;\n}\n@media only screen and (max-width: 768px) {\n select,\n textarea,\n input[type=\"text\"],\n input[type=\"password\"],\n input[type=\"datetime\"],\n input[type=\"datetime-local\"],\n input[type=\"date\"],\n input[type=\"month\"],\n input[type=\"time\"],\n input[type=\"week\"],\n input[type=\"number\"],\n input[type=\"email\"],\n input[type=\"url\"],\n input[type=\"search\"],\n input[type=\"tel\"],\n input[type=\"color\"] {\n font-size: 16px !important;\n }\n}\n@keyframes App-logo-spin {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}\n";
|
|
3756
|
+
styleInject(css_248z);
|
|
3757
|
+
|
|
3758
|
+
var DrawerHeader = function (_a) {
|
|
3759
|
+
var description = _a.description, onClose = _a.onClose, title = _a.title;
|
|
3760
|
+
return (jsxRuntime.jsxs("div", __assign({ className: "flex flex-col gap-4" }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex items-center justify-between gap-2" }, { children: [jsxRuntime.jsx("div", __assign({ className: "text-xl" }, { children: title })), jsxRuntime.jsx("button", __assign({ onClick: onClose, className: "ant-drawer-close" }, { children: jsxRuntime.jsx(CloseOutlined$1, {}) }))] })), description && jsxRuntime.jsx("div", __assign({ className: "text-xs" }, { children: description }))] })));
|
|
3761
|
+
};
|
|
3762
|
+
|
|
3763
|
+
var Card = function (_a) {
|
|
3764
|
+
var children = _a.children, className = _a.className, style = _a.style;
|
|
3765
|
+
var darkMode = React.useContext(BunnyContext).darkMode;
|
|
3766
|
+
return (jsxRuntime.jsx("div", __assign({ className: "flex flex-col rounded-md shadow-md ".concat(className), style: __assign(__assign({}, style), { backgroundColor: darkMode
|
|
3767
|
+
? "var(--row-background-dark)"
|
|
3768
|
+
: "var(--row-background)" }) }, { children: children })));
|
|
3769
|
+
};
|
|
3770
|
+
|
|
3771
|
+
var LargeCardIcon = function () {
|
|
3772
|
+
return (jsxRuntime.jsx("svg", __assign({ width: "72", height: "56", viewBox: "0 0 72 56", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: jsxRuntime.jsx("path", { d: "M8 0H64C68.375 0 72 3.625 72 8V12H0V8C0 3.625 3.5 0 8 0ZM72 24V48C72 52.5 68.375 56 64 56H8C3.5 56 0 52.5 0 48V24H72ZM14 40C12.875 40 12 41 12 42C12 43.125 12.875 44 14 44H22C23 44 24 43.125 24 42C24 41 23 40 22 40H14ZM28 42C28 43.125 28.875 44 30 44H46C47 44 48 43.125 48 42C48 41 47 40 46 40H30C28.875 40 28 41 28 42Z", fill: "#E2E8F0" }) })));
|
|
3773
|
+
};
|
|
3774
|
+
|
|
3775
|
+
var PlusIcon = function (_a) {
|
|
3776
|
+
var color = _a.color;
|
|
3777
|
+
return (jsxRuntime.jsxs("svg", __assign({ width: "14", height: "15", viewBox: "0 0 14 15", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: [jsxRuntime.jsx("path", { d: "M2.9165 7.5H11.0832", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), jsxRuntime.jsx("path", { d: "M7 3.41663V11.5833", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })] })));
|
|
3778
|
+
};
|
|
3779
|
+
|
|
3780
|
+
var Text$6 = antd.Typography.Text;
|
|
3781
|
+
var CreditCard = function (_a) {
|
|
3782
|
+
var _b, _c, _d;
|
|
3783
|
+
var onClickRemove = _a.onClickRemove, onClickUpdate = _a.onClickUpdate, paymentMethodData = _a.paymentMethodData;
|
|
3784
|
+
var isExpired = function (paymentMethodData) {
|
|
3785
|
+
// paymentMethodData.expirationDate
|
|
3786
|
+
var expDate = dayjs(paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.expirationDate);
|
|
3787
|
+
return expDate.isBefore(dayjs());
|
|
3788
|
+
};
|
|
3789
|
+
var isMobile = common.useIsMobile(window);
|
|
3790
|
+
var apiHost = React.useContext(BunnyContext).apiHost;
|
|
3791
|
+
return (jsxRuntime.jsxs(Card, __assign({ className: "shadow-md m-0" }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex items-center justify-between gap-4 p-4" }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex items-center gap-4" }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex items-center gap-2" }, { children: [getCardImage((_b = paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.metadata) === null || _b === void 0 ? void 0 : _b.issuer) && (jsxRuntime.jsx("img", { alt: "Card", width: "24px", src: "".concat(apiHost, "/portal/").concat(getCardImage((_c = paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.metadata) === null || _c === void 0 ? void 0 : _c.issuer)) })), jsxRuntime.jsx(Text$6, { children: (_d = paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.metadata) === null || _d === void 0 ? void 0 : _d.description })] })), jsxRuntime.jsx(antd.Tag, __assign({ color: isExpired(paymentMethodData) ? "red" : "green" }, { children: isExpired(paymentMethodData) ? "Expired" : "Valid" }))] })), !isMobile && (jsxRuntime.jsx(CardActions, { onClickRemove: onClickRemove, onClickUpdate: onClickUpdate }))] })), dayjs(paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.expirationDate).isValid() && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(antd.Divider, {}), jsxRuntime.jsxs("div", __assign({ className: "flex flex-col p-4" }, { children: [jsxRuntime.jsx(CardAttribute, { title: "EXPIRATION", value: dayjs(paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.expirationDate).format("MM/YY") }), isMobile && (jsxRuntime.jsx(CardActions, { onClickRemove: onClickRemove, onClickUpdate: onClickUpdate }))] }))] }))] })));
|
|
3792
|
+
};
|
|
3793
|
+
var CardAttribute = function (_a) {
|
|
3794
|
+
var title = _a.title, value = _a.value;
|
|
3795
|
+
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$6, { children: value })] })));
|
|
3796
|
+
};
|
|
3797
|
+
var CardActions = function (_a) {
|
|
3798
|
+
var onClickRemove = _a.onClickRemove, onClickUpdate = _a.onClickUpdate;
|
|
3799
|
+
var isMobile = common.useIsMobile(window);
|
|
3800
|
+
return (jsxRuntime.jsxs("div", __assign({ className: "flex items-center gap-6 ".concat(isMobile ? "justify-center mt-4" : "") }, { children: [jsxRuntime.jsx(antd.Popconfirm, __assign({ title: "Remove card?", onConfirm: onClickRemove }, { children: jsxRuntime.jsx(antd.Button, __assign({ className: "font-normal p-0", type: "link" }, { children: "Remove payment method" })) })), jsxRuntime.jsx(antd.Divider, { style: { height: "24px" }, type: "vertical" }), jsxRuntime.jsx(antd.Button, __assign({ onClick: onClickUpdate, type: "primary" }, { children: "Update" }))] })));
|
|
3801
|
+
};
|
|
3802
|
+
var EmptyCard = function (_a) {
|
|
3803
|
+
var onClick = _a.onClick;
|
|
3804
|
+
var brandColor = React.useContext(BrandContext).brandColor;
|
|
3805
|
+
return (jsxRuntime.jsxs("div", __assign({ className: "flex flex-col items-center justify-center w-full pt-8 px-4 pb-6 cursor-pointer bg-white shadow-md rounded-md", onClick: onClick }, { children: [jsxRuntime.jsx(LargeCardIcon, {}), jsxRuntime.jsx("div", __assign({ className: "text-slate-400 pt-4 pb-8" }, { children: "No payment methods" })), jsxRuntime.jsx(antd.Button, __assign({ type: "link" }, { children: jsxRuntime.jsxs("div", __assign({ className: "flex items-center gap-1" }, { children: [jsxRuntime.jsx(PlusIcon, { color: brandColor }), "Add payment method"] })) }))] })));
|
|
3806
|
+
};
|
|
3807
|
+
var getCardImage = function (issuer) {
|
|
3808
|
+
if (issuer === "visa")
|
|
3809
|
+
return "Visa_Brandmark_Blue_RGB_2021.png";
|
|
3810
|
+
else if (issuer === "mastercard")
|
|
3811
|
+
return "mc_symbol_opt_73_3x.png";
|
|
3812
|
+
};
|
|
3813
|
+
|
|
3814
|
+
var PaymentMethodContext = React.createContext({});
|
|
3815
|
+
|
|
3816
|
+
var ActualPaymentMethod = function (_a) {
|
|
3817
|
+
var entityId = _a.entityId;
|
|
3818
|
+
var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, graphQLClient = _b.graphQLClient, onErrorNavigate = _b.onErrorNavigate;
|
|
3819
|
+
var accountId = React.useContext(PaymentContext).accountId;
|
|
3820
|
+
// Hooks
|
|
3821
|
+
var queryClient = reactQuery.useQueryClient();
|
|
3822
|
+
var paymentPlugins = usePaymentPlugins({ entityId: entityId, apiHost: apiHost, token: token }).paymentPlugins;
|
|
3823
|
+
var showErrorNotification = common.useErrorNotification();
|
|
3824
|
+
var showSuccessNotification = common.useSuccessNotification();
|
|
3825
|
+
var handleAllErrorFormats = common.useAllErrorFormats(onErrorNavigate ||
|
|
3826
|
+
(function (url) {
|
|
3827
|
+
console.log("navigate to", url, " not implemented");
|
|
3828
|
+
}));
|
|
3829
|
+
var isMobile = common.useIsMobile(window);
|
|
3830
|
+
var data = usePaymentMethod(graphQLClient).data;
|
|
3831
|
+
// Local state
|
|
3832
|
+
var _c = React.useState(false), showModal = _c[0], setShowModal = _c[1];
|
|
3833
|
+
var _d = React.useState(false), isSaving = _d[0], setIsSaving = _d[1];
|
|
3834
|
+
var plugin = paymentPlugins === null || paymentPlugins === void 0 ? void 0 : paymentPlugins.find(function (paymentPlugin) { var _a; return String(paymentPlugin.id) === ((_a = data === null || data === void 0 ? void 0 : data.plugin) === null || _a === void 0 ? void 0 : _a.id); });
|
|
3835
|
+
var onClickRemove = function () {
|
|
3836
|
+
if (data && plugin) {
|
|
3837
|
+
common.invokePlugin({
|
|
3838
|
+
plugin: plugin,
|
|
3409
3839
|
method: "remove_payment_method",
|
|
3410
3840
|
payload: {
|
|
3411
3841
|
payment_method_id: data.id,
|
|
3412
3842
|
account_id: accountId,
|
|
3413
3843
|
},
|
|
3414
3844
|
token: token,
|
|
3415
|
-
|
|
3845
|
+
apiHost: apiHost,
|
|
3416
3846
|
})
|
|
3417
3847
|
.then(function () {
|
|
3418
3848
|
showSuccessNotification("Payment method was removed", "Success");
|
|
@@ -3439,7 +3869,7 @@ var ActualPaymentMethod = function () {
|
|
|
3439
3869
|
}
|
|
3440
3870
|
: {},
|
|
3441
3871
|
wrapper: isMobile ? { width: "100vw" } : { width: "min-content" },
|
|
3442
|
-
}, title: jsxRuntime.jsx(DrawerHeader, { onClose: function () { return setShowModal(false); }, title: "New payment method" }) }, { children: jsxRuntime.jsx(PaymentForm, { isSaving: isSaving, onFail: function (error) {
|
|
3872
|
+
}, title: jsxRuntime.jsx(DrawerHeader, { onClose: function () { return setShowModal(false); }, title: "New payment method" }) }, { children: jsxRuntime.jsx(PaymentForm, { entityId: entityId, isSaving: isSaving, onFail: function (error) {
|
|
3443
3873
|
handleAllErrorFormats(error);
|
|
3444
3874
|
setIsSaving(false);
|
|
3445
3875
|
}, onPaymentSuccess: function () {
|
|
@@ -3448,13 +3878,56 @@ var ActualPaymentMethod = function () {
|
|
|
3448
3878
|
}, setIsSaving: setIsSaving }) }))] }));
|
|
3449
3879
|
};
|
|
3450
3880
|
function PaymentMethod(_a) {
|
|
3451
|
-
var
|
|
3452
|
-
return (jsxRuntime.jsx(PaymentMethodContext.Provider, __assign({ value: { footer: footer
|
|
3881
|
+
var entityId = _a.entityId, footer = _a.footer;
|
|
3882
|
+
return (jsxRuntime.jsx(PaymentMethodContext.Provider, __assign({ value: { footer: footer } }, { children: jsxRuntime.jsx(ActualPaymentMethod, { entityId: entityId }) })));
|
|
3453
3883
|
}
|
|
3454
3884
|
|
|
3455
|
-
var
|
|
3885
|
+
var pageWrapperClassName = function (isMobile) {
|
|
3886
|
+
return "flex flex-col grow pt-4 ".concat(isMobile ? "pb-4 overflow-hidden" : "pb-8", " ").concat("content-container");
|
|
3887
|
+
};
|
|
3888
|
+
|
|
3889
|
+
var QUOTE_FIELDS = "quote {\n formattedQuote {\n html\n }\n acceptedByName\n acceptedByTitle\n accountId\n amount\n amountDue\n applicationDate\n applied\n billingDay\n contactId\n createdAt\n credits\n currencyId\n dealId\n discount\n discountValue\n endDate\n evergreen\n expiresAt\n id\n invoiceUntil\n isPendingApprovalRequest\n kind\n message\n name\n netPaymentDays\n notes\n ownerId\n periodAmount\n poNumber\n requiresApproval\n startDate\n state\n subtotal\n taxAmount\n updatedAt\n uuid\n amountsByPeriod {\n amount\n id\n name\n }\n endDateOptions {\n endDate\n label\n }\n invoiceUntilOptions {\n endDate\n label\n }\n quoteChanges {\n id\n priceListId\n charges {\n amount\n amountsByPeriod { amount startDate }\n billingPeriod\n billingPeriodAmounts { id amount prorationRate }\n chargeType\n couponId\n createdAt\n currencyId\n discount\n endDate\n feature { id name code isUnit unitName }\n id\n invoiceLineText\n name\n price\n priceDecimals\n priceTiers { starts price }\n pricingModel\n prorationRate\n quantity\n quantityMax\n quantityMin\n startDate\n tieredAveragePrice\n updatedAt\n }\n }\n}";
|
|
3890
|
+
|
|
3891
|
+
var QUOTE_RECALCULATE_TAXES = "\n mutation QuoteRecalculateTaxes($id: ID!) {\n quoteRecalculateTaxes(id: $id) {\n ".concat(QUOTE_FIELDS, "\n errors\n }\n }\n");
|
|
3892
|
+
var quoteRecalculateTaxes = function (_a) {
|
|
3893
|
+
var quoteId = _a.quoteId, token = _a.token, apiHost = _a.apiHost;
|
|
3894
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
3895
|
+
var vars, response, errors;
|
|
3896
|
+
var _b, _c;
|
|
3897
|
+
return __generator(this, function (_d) {
|
|
3898
|
+
switch (_d.label) {
|
|
3899
|
+
case 0:
|
|
3900
|
+
vars = { id: quoteId };
|
|
3901
|
+
return [4 /*yield*/, common.gqlRequest({
|
|
3902
|
+
query: QUOTE_RECALCULATE_TAXES,
|
|
3903
|
+
token: token,
|
|
3904
|
+
vars: vars,
|
|
3905
|
+
apiHost: apiHost,
|
|
3906
|
+
})];
|
|
3907
|
+
case 1:
|
|
3908
|
+
response = _d.sent();
|
|
3909
|
+
errors = (_b = response === null || response === void 0 ? void 0 : response.quoteRecalculateTaxes) === null || _b === void 0 ? void 0 : _b.errors;
|
|
3910
|
+
if (errors)
|
|
3911
|
+
throw errors;
|
|
3912
|
+
return [2 /*return*/, (_c = response.quoteRecalculateTaxes) === null || _c === void 0 ? void 0 : _c.quote];
|
|
3913
|
+
}
|
|
3914
|
+
});
|
|
3915
|
+
});
|
|
3916
|
+
};
|
|
3917
|
+
|
|
3918
|
+
var useHasTaxPlugin = function (_a) {
|
|
3919
|
+
var entityId = _a.entityId, apiHost = _a.apiHost, token = _a.token;
|
|
3920
|
+
var plugins = usePlugins({
|
|
3921
|
+
entityId: entityId,
|
|
3922
|
+
apiHost: apiHost,
|
|
3923
|
+
token: token,
|
|
3924
|
+
}).data;
|
|
3925
|
+
return Boolean(plugins === null || plugins === void 0 ? void 0 : plugins.some(function (plugin) { return plugin.type === "taxation"; }));
|
|
3926
|
+
};
|
|
3927
|
+
|
|
3928
|
+
var MUTATION$6 = "\nmutation accountUpdate(\n $id: ID!,\n $attributes: AccountAttributes!) {\n accountUpdate(\n id: $id,\n attributes: $attributes\n ) {\n account { id }\n errors\n }\n }\n";
|
|
3456
3929
|
var accountUpdate = function (_a) {
|
|
3457
|
-
var accountId = _a.accountId, attributes = _a.attributes, token = _a.token;
|
|
3930
|
+
var accountId = _a.accountId, attributes = _a.attributes, token = _a.token, apiHost = _a.apiHost;
|
|
3458
3931
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
3459
3932
|
var vars, response, errors;
|
|
3460
3933
|
var _b;
|
|
@@ -3462,7 +3935,12 @@ var accountUpdate = function (_a) {
|
|
|
3462
3935
|
switch (_c.label) {
|
|
3463
3936
|
case 0:
|
|
3464
3937
|
vars = { id: accountId, attributes: attributes };
|
|
3465
|
-
return [4 /*yield*/, common.gqlRequest({
|
|
3938
|
+
return [4 /*yield*/, common.gqlRequest({
|
|
3939
|
+
query: MUTATION$6,
|
|
3940
|
+
token: token,
|
|
3941
|
+
vars: vars,
|
|
3942
|
+
apiHost: apiHost,
|
|
3943
|
+
})];
|
|
3466
3944
|
case 1:
|
|
3467
3945
|
response = _c.sent();
|
|
3468
3946
|
errors = (_b = response === null || response === void 0 ? void 0 : response.accountUpdate) === null || _b === void 0 ? void 0 : _b.errors;
|
|
@@ -3479,10 +3957,10 @@ var TaxationForm = function (_a) {
|
|
|
3479
3957
|
var account = _a.account, quote = _a.quote;
|
|
3480
3958
|
// Hooks
|
|
3481
3959
|
var queryClient = reactQuery.useQueryClient();
|
|
3482
|
-
var
|
|
3960
|
+
var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
|
|
3483
3961
|
var form = antd.Form.useForm()[0];
|
|
3484
3962
|
// Mutations
|
|
3485
|
-
var
|
|
3963
|
+
var _c = reactQuery.useMutation({
|
|
3486
3964
|
mutationFn: function (changedFormData) { return __awaiter(void 0, void 0, void 0, function () {
|
|
3487
3965
|
var account;
|
|
3488
3966
|
return __generator(this, function (_a) {
|
|
@@ -3491,6 +3969,7 @@ var TaxationForm = function (_a) {
|
|
|
3491
3969
|
accountId: quote.accountId,
|
|
3492
3970
|
attributes: changedFormData,
|
|
3493
3971
|
token: token,
|
|
3972
|
+
apiHost: apiHost,
|
|
3494
3973
|
})];
|
|
3495
3974
|
case 1:
|
|
3496
3975
|
account = _a.sent();
|
|
@@ -3503,7 +3982,7 @@ var TaxationForm = function (_a) {
|
|
|
3503
3982
|
queryKey: ["getTaxationRequiredAccountFields", token],
|
|
3504
3983
|
});
|
|
3505
3984
|
},
|
|
3506
|
-
}), updateAccount =
|
|
3985
|
+
}), updateAccount = _c.mutate, isUpdatingAccount = _c.isPending;
|
|
3507
3986
|
return (jsxRuntime.jsxs(antd.Form, __assign({ className: "flex flex-col gap-4", form: form, initialValues: account, layout: "vertical", onFinish: updateAccount }, { children: [jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Billing street", name: "billingStreet" }, { children: jsxRuntime.jsx(antd.Input, { placeholder: "Street" }) })), jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Billing city", name: "billingCity" }, { children: jsxRuntime.jsx(antd.Input, { placeholder: "City" }) })), jsxRuntime.jsx(FormBillingState, { form: form }), jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Billing country", name: "billingCountry", rules: [{ required: true }] }, { children: jsxRuntime.jsx(antd.Select, { options: common.Lists.COUNTRY_LIST, placeholder: "Select a country", showSearch: true, filterOption: function (input, option) {
|
|
3508
3987
|
var _a, _b;
|
|
3509
3988
|
return ((_a = option === null || option === void 0 ? void 0 : option.label) !== null && _a !== void 0 ? _a : "").toLowerCase().includes(input.toLowerCase()) ||
|
|
@@ -3518,10 +3997,10 @@ var FormBillingState = function (_a) {
|
|
|
3518
3997
|
};
|
|
3519
3998
|
|
|
3520
3999
|
var QuoteCheckout = function (_a) {
|
|
3521
|
-
var account = _a.account, isSaving = _a.isSaving, onSuccess = _a.onSuccess, onFail = _a.onFail, quote = _a.quote, setIsSaving = _a.setIsSaving, taxationRequiredAccountFields = _a.taxationRequiredAccountFields
|
|
4000
|
+
var account = _a.account, isSaving = _a.isSaving, onSuccess = _a.onSuccess, onFail = _a.onFail, quote = _a.quote, setIsSaving = _a.setIsSaving, taxationRequiredAccountFields = _a.taxationRequiredAccountFields, entityId = _a.entityId;
|
|
3522
4001
|
// Context
|
|
3523
|
-
var isMobile = common.useIsMobile();
|
|
3524
|
-
var _b = React.useContext(BunnyContext),
|
|
4002
|
+
var isMobile = common.useIsMobile(window);
|
|
4003
|
+
var _b = React.useContext(BunnyContext), apiHost = _b.apiHost, token = _b.token;
|
|
3525
4004
|
var paymentRequired = getQuoteAmountDue(quote) > 0;
|
|
3526
4005
|
var checkoutMutation = reactQuery.useMutation({
|
|
3527
4006
|
mutationFn: function (_a) {
|
|
@@ -3529,14 +4008,14 @@ var QuoteCheckout = function (_a) {
|
|
|
3529
4008
|
if (!quote)
|
|
3530
4009
|
throw new Error("Quote is required");
|
|
3531
4010
|
if (!paymentRequired)
|
|
3532
|
-
return checkout({ quoteId: quote.id, token: token,
|
|
4011
|
+
return checkout({ quoteId: quote.id, token: token, apiHost: apiHost });
|
|
3533
4012
|
if (savedPaymentMethod) {
|
|
3534
4013
|
var paymentMethodId = savedPaymentMethod.paymentMethodId;
|
|
3535
4014
|
return checkout({
|
|
3536
4015
|
quoteId: quote.id,
|
|
3537
4016
|
paymentMethodId: paymentMethodId,
|
|
3538
4017
|
token: token,
|
|
3539
|
-
|
|
4018
|
+
apiHost: apiHost,
|
|
3540
4019
|
});
|
|
3541
4020
|
}
|
|
3542
4021
|
if (pluginPaymentMethod) {
|
|
@@ -3551,7 +4030,7 @@ var QuoteCheckout = function (_a) {
|
|
|
3551
4030
|
token: paymentToken,
|
|
3552
4031
|
},
|
|
3553
4032
|
token: token,
|
|
3554
|
-
|
|
4033
|
+
apiHost: apiHost,
|
|
3555
4034
|
});
|
|
3556
4035
|
}
|
|
3557
4036
|
throw new Error("Pay payment method provided");
|
|
@@ -3593,82 +4072,64 @@ var QuoteCheckout = function (_a) {
|
|
|
3593
4072
|
};
|
|
3594
4073
|
if (taxationRequiredAccountFields)
|
|
3595
4074
|
return (jsxRuntime.jsx(PaymentFormWrapper, __assign({ setMaxHeight: false }, { children: jsxRuntime.jsx(TaxationForm, { account: account, quote: quote }) })));
|
|
3596
|
-
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: paymentRequired ? (jsxRuntime.jsx(PaymentForm, { isSaving: isSaving, onFail: onFail, onPaymentSuccess: handleCheckout, quote: quote, setIsSaving: setIsSaving })) : (jsxRuntime.jsx(PaymentFormWrapper, __assign({ setMaxHeight: false }, { children: jsxRuntime.jsxs("div", __assign({ className: "flex flex-col gap-2 ".concat(isMobile ? "shadow-padding-x" : "") }, { children: [jsxRuntime.jsx(antd.Button, __assign({ disabled: isSaving, onClick: function () {
|
|
4075
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: paymentRequired ? (jsxRuntime.jsx(PaymentForm, { entityId: entityId, isSaving: isSaving, onFail: onFail, onPaymentSuccess: handleCheckout, quote: quote, setIsSaving: setIsSaving })) : (jsxRuntime.jsx(PaymentFormWrapper, __assign({ setMaxHeight: false }, { children: jsxRuntime.jsxs("div", __assign({ className: "flex flex-col gap-2 ".concat(isMobile ? "shadow-padding-x" : "") }, { children: [jsxRuntime.jsx(antd.Button, __assign({ disabled: isSaving, onClick: function () {
|
|
3597
4076
|
setIsSaving(true);
|
|
3598
4077
|
handleCheckout({});
|
|
3599
4078
|
}, type: "primary" }, { children: isSaving ? "Processing..." : "Complete order" })), jsxRuntime.jsx("div", __assign({ className: "text-xs text-slate-500" }, { children: "No payment is required" }))] })) }))) }));
|
|
3600
4079
|
};
|
|
3601
4080
|
|
|
3602
|
-
var
|
|
3603
|
-
|
|
3604
|
-
var
|
|
3605
|
-
subdomain: subdomain,
|
|
3606
|
-
token: token,
|
|
3607
|
-
}).data;
|
|
3608
|
-
return Boolean(plugins === null || plugins === void 0 ? void 0 : plugins.some(function (plugin) { return plugin.type === "taxation"; }));
|
|
3609
|
-
};
|
|
3610
|
-
|
|
3611
|
-
var QUOTE_FIELDS = "quote {\n formattedQuote {\n html\n }\n acceptedByName\n acceptedByTitle\n accountId\n amount\n amountDue\n applicationDate\n applied\n billingDay\n contactId\n createdAt\n credits\n currencyId\n dealId\n discount\n discountValue\n endDate\n evergreen\n expiresAt\n id\n invoiceUntil\n isPendingApprovalRequest\n kind\n message\n name\n netPaymentDays\n notes\n ownerId\n periodAmount\n poNumber\n requiresApproval\n startDate\n state\n subtotal\n taxAmount\n updatedAt\n uuid\n amountsByPeriod {\n amount\n id\n name\n }\n endDateOptions {\n endDate\n label\n }\n invoiceUntilOptions {\n endDate\n label\n }\n quoteChanges {\n id\n priceListId\n charges {\n amount\n amountsByPeriod { amount startDate }\n billingPeriod\n billingPeriodAmounts { id amount prorationRate }\n chargeType\n couponId\n createdAt\n currencyId\n discount\n endDate\n feature { id name code isUnit unitName }\n id\n invoiceLineText\n name\n price\n priceDecimals\n priceTiers { starts price }\n pricingModel\n prorationRate\n quantity\n quantityMax\n quantityMin\n startDate\n tieredAveragePrice\n updatedAt\n }\n }\n}";
|
|
3612
|
-
|
|
3613
|
-
var QUOTE_RECALCULATE_TAXES = "\n mutation QuoteRecalculateTaxes($id: ID!) {\n quoteRecalculateTaxes(id: $id) {\n ".concat(QUOTE_FIELDS, "\n errors\n }\n }\n");
|
|
3614
|
-
var quoteRecalculateTaxes = function (_a) {
|
|
3615
|
-
var quoteId = _a.quoteId, token = _a.token;
|
|
4081
|
+
var MUTATION$5 = "{\n currentUser {\n taxationRequiredAccountFields\n }\n}";
|
|
4082
|
+
var getTaxationRequiredAccountFields = function (_a) {
|
|
4083
|
+
var token = _a.token, apiHost = _a.apiHost;
|
|
3616
4084
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
3617
|
-
var
|
|
4085
|
+
var response;
|
|
3618
4086
|
var _b, _c;
|
|
3619
4087
|
return __generator(this, function (_d) {
|
|
3620
4088
|
switch (_d.label) {
|
|
3621
|
-
case 0:
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
vars: vars,
|
|
3627
|
-
})];
|
|
4089
|
+
case 0: return [4 /*yield*/, common.gqlRequest({
|
|
4090
|
+
query: MUTATION$5,
|
|
4091
|
+
token: token,
|
|
4092
|
+
apiHost: apiHost,
|
|
4093
|
+
})];
|
|
3628
4094
|
case 1:
|
|
3629
4095
|
response = _d.sent();
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
4096
|
+
return [2 /*return*/, ((_c = (_b = response === null || response === void 0 ? void 0 : response.currentUser) === null || _b === void 0 ? void 0 : _b.taxationRequiredAccountFields) === null || _c === void 0 ? void 0 : _c.length) > 0
|
|
4097
|
+
? response.currentUser
|
|
4098
|
+
.taxationRequiredAccountFields
|
|
4099
|
+
: null];
|
|
3634
4100
|
}
|
|
3635
4101
|
});
|
|
3636
4102
|
});
|
|
3637
4103
|
};
|
|
3638
4104
|
|
|
3639
|
-
var planPickerQuoteDataState = recoil.atom({
|
|
3640
|
-
key: "planPickerQuoteDataState",
|
|
3641
|
-
default: undefined,
|
|
3642
|
-
});
|
|
3643
|
-
|
|
3644
|
-
var pageWrapperClassName = function (isMobile) {
|
|
3645
|
-
return "flex flex-col grow pt-4 ".concat(isMobile ? "pb-4 overflow-hidden" : "pb-8", " ").concat("content-container");
|
|
3646
|
-
};
|
|
3647
|
-
|
|
3648
4105
|
var queryKeyFactory = common.QueryKeyFactory.default;
|
|
3649
4106
|
var Checkout = function (_a) {
|
|
3650
4107
|
var _b, _c;
|
|
3651
|
-
var onCancel = _a.onCancel, onSuccess = _a.onSuccess, onFail = _a.onFail, invoice = _a.invoice, open = _a.open, quote = _a.quote, selectedPriceList = _a.selectedPriceList,
|
|
3652
|
-
var
|
|
3653
|
-
var
|
|
3654
|
-
var
|
|
4108
|
+
var entityId = _a.entityId, onCancel = _a.onCancel, onSuccess = _a.onSuccess, onFail = _a.onFail, invoice = _a.invoice, open = _a.open, quote = _a.quote, selectedPriceList = _a.selectedPriceList, token = _a.token, _d = _a.quantity, quantity = _d === void 0 ? 0 : _d;
|
|
4109
|
+
var _e = React.useContext(BunnyContext), apiHost = _e.apiHost, window = _e.window;
|
|
4110
|
+
var _f = React.useState(false), isSaving = _f[0], setIsSaving = _f[1];
|
|
4111
|
+
var isMobile = common.useIsMobile(window);
|
|
4112
|
+
var hasTaxPlugin = useHasTaxPlugin({
|
|
4113
|
+
entityId: entityId,
|
|
4114
|
+
apiHost: apiHost,
|
|
4115
|
+
token: token,
|
|
4116
|
+
});
|
|
3655
4117
|
var queryClient = reactQuery.useQueryClient();
|
|
3656
|
-
var quotePreviewData = recoil.useRecoilValue(planPickerQuoteDataState);
|
|
3657
4118
|
// Queries
|
|
3658
|
-
var
|
|
4119
|
+
var _g = reactQuery.useQuery({
|
|
3659
4120
|
queryKey: ["getTaxationRequiredAccountFields", token],
|
|
3660
|
-
queryFn: function () { return
|
|
4121
|
+
queryFn: function () { return getTaxationRequiredAccountFields({ token: token, apiHost: apiHost }); },
|
|
3661
4122
|
enabled: Boolean(quote),
|
|
3662
4123
|
staleTime: 0,
|
|
3663
|
-
}), taxationRequiredAccountFields =
|
|
3664
|
-
var
|
|
4124
|
+
}), taxationRequiredAccountFields = _g.data, isLoadingTaxationRequiredAccountFields = _g.isLoading;
|
|
4125
|
+
var _h = reactQuery.useQuery({
|
|
3665
4126
|
queryKey: ["account", quote === null || quote === void 0 ? void 0 : quote.accountId],
|
|
3666
4127
|
queryFn: function () {
|
|
3667
|
-
return (quote === null || quote === void 0 ? void 0 : quote.accountId) && common.getAccount({ id: quote.accountId, token: token });
|
|
4128
|
+
return (quote === null || quote === void 0 ? void 0 : quote.accountId) && common.getAccount({ id: quote.accountId, token: token, apiHost: apiHost });
|
|
3668
4129
|
},
|
|
3669
4130
|
enabled: Boolean(quote === null || quote === void 0 ? void 0 : quote.accountId) &&
|
|
3670
4131
|
((taxationRequiredAccountFields === null || taxationRequiredAccountFields === void 0 ? void 0 : taxationRequiredAccountFields.length) || 0) > 0,
|
|
3671
|
-
}), account =
|
|
4132
|
+
}), account = _h.data, isLoadingAccount = _h.isLoading;
|
|
3672
4133
|
reactQuery.useQuery({
|
|
3673
4134
|
queryKey: queryKeyFactory.createQuoteTaxCalculateKey(quote === null || quote === void 0 ? void 0 : quote.id),
|
|
3674
4135
|
queryFn: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -3680,12 +4141,13 @@ var Checkout = function (_a) {
|
|
|
3680
4141
|
return [4 /*yield*/, quoteRecalculateTaxes({
|
|
3681
4142
|
quoteId: quote.id,
|
|
3682
4143
|
token: token,
|
|
4144
|
+
apiHost: apiHost,
|
|
3683
4145
|
})];
|
|
3684
4146
|
case 1:
|
|
3685
4147
|
updatedQuote = _a.sent();
|
|
3686
4148
|
if (updatedQuote) {
|
|
3687
4149
|
queryClient.setQueryData(queryKeyFactory.createObjectKey("editingQuote", updatedQuote.id), updatedQuote);
|
|
3688
|
-
queryClient.setQueryData(queryKeyFactory.calculatedPricesKey(
|
|
4150
|
+
queryClient.setQueryData(queryKeyFactory.calculatedPricesKey(quantity, selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id), updatedQuote);
|
|
3689
4151
|
}
|
|
3690
4152
|
_a.label = 2;
|
|
3691
4153
|
case 2: return [2 /*return*/, {}];
|
|
@@ -3704,21 +4166,21 @@ var Checkout = function (_a) {
|
|
|
3704
4166
|
return null;
|
|
3705
4167
|
return (jsxRuntime.jsx("div", __assign({ className: "flex flex-col fixed top-0 left-0 right-0 bottom-0 bg-slate-50 overflow-auto", style: {
|
|
3706
4168
|
zIndex: 1001,
|
|
3707
|
-
} }, { children: jsxRuntime.jsxs("div", __assign({ className: pageWrapperClassName(isMobile) }, { children: [jsxRuntime.jsx("div", __assign({ className: "flex justify-end w-full" }, { children: jsxRuntime.jsx(CloseOutlined$1, { className: "text-base shadow-padding-xb", onClick: onCancel }) })), jsxRuntime.jsxs("div", __assign({ className: "flex justify-end gap-6 pt-4 ".concat(isMobile ? "flex-col" : "shadow-padding-xb") }, { children: [((invoice === null || invoice === void 0 ? void 0 : invoice.html) || ((_b = quote === null || quote === void 0 ? void 0 : quote.formattedQuote) === null || _b === void 0 ? void 0 : _b.html)) && (jsxRuntime.jsx(InvoiceQuoteView, { html: invoice ? invoice.html : quote ? quote.formattedQuote.html : ""
|
|
4169
|
+
} }, { children: jsxRuntime.jsxs("div", __assign({ className: pageWrapperClassName(isMobile) }, { children: [jsxRuntime.jsx("div", __assign({ className: "flex justify-end w-full" }, { children: jsxRuntime.jsx(CloseOutlined$1, { className: "text-base shadow-padding-xb", onClick: onCancel }) })), jsxRuntime.jsxs("div", __assign({ className: "flex justify-end gap-6 pt-4 ".concat(isMobile ? "flex-col" : "shadow-padding-xb") }, { children: [((invoice === null || invoice === void 0 ? void 0 : invoice.html) || ((_b = quote === null || quote === void 0 ? void 0 : quote.formattedQuote) === null || _b === void 0 ? void 0 : _b.html)) && (jsxRuntime.jsx(InvoiceQuoteView, { html: invoice ? invoice.html : quote ? quote.formattedQuote.html : "" })), !isMobile && ((invoice === null || invoice === void 0 ? void 0 : invoice.html) || ((_c = quote === null || quote === void 0 ? void 0 : quote.formattedQuote) === null || _c === void 0 ? void 0 : _c.html)) && (jsxRuntime.jsx(antd.Divider, { className: "h-full", type: "vertical" })), invoice ? (jsxRuntime.jsx(InvoiceCheckout, { invoice: invoice, isSaving: isSaving, onFail: function (error) {
|
|
3708
4170
|
onFail(error);
|
|
3709
4171
|
setIsSaving(false);
|
|
3710
4172
|
}, onSuccess: function (_a) {
|
|
3711
4173
|
var savePaymentMethod = _a.savePaymentMethod;
|
|
3712
4174
|
onSuccess({ savePaymentMethod: savePaymentMethod });
|
|
3713
4175
|
setIsSaving(false);
|
|
3714
|
-
}, setIsSaving: setIsSaving })) : quote ? (jsxRuntime.jsx(QuoteCheckout, { account: account, isSaving: isSaving, onFail: function (error) {
|
|
4176
|
+
}, setIsSaving: setIsSaving, entityId: entityId })) : quote ? (jsxRuntime.jsx(QuoteCheckout, { account: account, entityId: entityId, isSaving: isSaving, onFail: function (error) {
|
|
3715
4177
|
onFail(error);
|
|
3716
4178
|
setIsSaving(false);
|
|
3717
4179
|
}, onSuccess: function (_a) {
|
|
3718
4180
|
var savePaymentMethod = _a.savePaymentMethod;
|
|
3719
4181
|
onSuccess({ savePaymentMethod: savePaymentMethod });
|
|
3720
4182
|
setIsSaving(false);
|
|
3721
|
-
}, quote: quote, setIsSaving: setIsSaving, taxationRequiredAccountFields: taxationRequiredAccountFields, token: token
|
|
4183
|
+
}, quote: quote, setIsSaving: setIsSaving, taxationRequiredAccountFields: taxationRequiredAccountFields, token: token })) : (jsxRuntime.jsx(PaymentForm, { entityId: entityId, isSaving: isSaving, onFail: function (error) {
|
|
3722
4184
|
onFail(error);
|
|
3723
4185
|
setIsSaving(false);
|
|
3724
4186
|
}, onPaymentSuccess: function (_a) {
|
|
@@ -3732,7 +4194,7 @@ var Checkout = function (_a) {
|
|
|
3732
4194
|
|
|
3733
4195
|
var MUTATION$4 = function () { return "\nmutation AccountSignup (\n $entityId: ID!,\n $pluginId: String!,\n $paymentMethodId: String,\n $priceListCode: String!,\n $accountId: ID!,\n $quoteId: ID!\n) {\n accountSignup(\n entityId: $entityId,\n pluginId: $pluginId,\n paymentMethodId: $paymentMethodId,\n priceListCode: $priceListCode,\n accountId: $accountId,\n quoteId: $quoteId\n ) {\n errors\n quote {\n acceptedByName\n acceptedByTitle\n accountId\n amount\n amountDue\n applicationDate\n applied\n backdatedPeriods\n backdatedQuote\n billingDay\n contactId\n createdAt\n credits\n currencyId\n dealId\n discount\n discountValue\n endDate\n evergreen\n expiresAt\n id\n invoiceImmediately\n invoiceImmediatelyAvailable\n invoiceUntil\n isPendingApprovalRequest\n kind\n message\n name\n netPaymentDays\n notes\n number\n ownerId\n payableId\n periodAmount\n poNumber\n requiresApproval\n smallUnitAmountDue\n splitInvoice\n startDate\n state\n subtotal\n taxAmount\n taxCode\n updatedAt\n uuid\n }\n }\n}"; };
|
|
3734
4196
|
var accountSignup = function (_a) {
|
|
3735
|
-
var token = _a.token,
|
|
4197
|
+
var token = _a.token, apiHost = _a.apiHost, entityId = _a.entityId, accountId = _a.accountId, quoteId = _a.quoteId, paymentToken = _a.paymentToken, paymentMethodId = _a.paymentMethodId, pluginId = _a.pluginId, priceListCode = _a.priceListCode;
|
|
3736
4198
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
3737
4199
|
var vars, response, errors;
|
|
3738
4200
|
var _b;
|
|
@@ -3752,7 +4214,7 @@ var accountSignup = function (_a) {
|
|
|
3752
4214
|
query: MUTATION$4(),
|
|
3753
4215
|
token: token,
|
|
3754
4216
|
vars: vars,
|
|
3755
|
-
|
|
4217
|
+
apiHost: apiHost,
|
|
3756
4218
|
})];
|
|
3757
4219
|
case 1:
|
|
3758
4220
|
response = _c.sent();
|
|
@@ -3767,7 +4229,7 @@ var accountSignup = function (_a) {
|
|
|
3767
4229
|
|
|
3768
4230
|
var MUTATION$3 = function () { return "\nmutation QuoteAccountSignup (\n $accountName: String!,\n $billingContact: ContactAttributes!,\n $entityId: ID!,\n $priceListCode: String!\n) {\n quoteAccountSignup(\n entityId: $entityId,\n priceListCode: $priceListCode,\n accountName: $accountName,\n billingContact: $billingContact\n ) {\n account {\n id\n }\n amount\n currencyId\n quote {\n id\n }\n tenant {\n code\n }\n errors\n }\n}"; };
|
|
3769
4231
|
var quoteAccountSignup = function (_a) {
|
|
3770
|
-
var token = _a.token,
|
|
4232
|
+
var token = _a.token, apiHost = _a.apiHost, entityId = _a.entityId, priceListCode = _a.priceListCode, accountName = _a.accountName, billingContact = _a.billingContact;
|
|
3771
4233
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
3772
4234
|
var vars, response, errors;
|
|
3773
4235
|
var _b;
|
|
@@ -3784,7 +4246,7 @@ var quoteAccountSignup = function (_a) {
|
|
|
3784
4246
|
query: MUTATION$3(),
|
|
3785
4247
|
token: token,
|
|
3786
4248
|
vars: vars,
|
|
3787
|
-
|
|
4249
|
+
apiHost: apiHost,
|
|
3788
4250
|
})];
|
|
3789
4251
|
case 1:
|
|
3790
4252
|
response = _c.sent();
|
|
@@ -3799,7 +4261,7 @@ var quoteAccountSignup = function (_a) {
|
|
|
3799
4261
|
|
|
3800
4262
|
var MUTATION$2 = function () { return "\nquery PriceList($code: String!) {\n priceList (code: $code) {\n basePrice\n code\n createdAt\n currencyId\n id\n isVisible\n name\n periodMonths\n planId\n priceDescription\n productId\n sku\n trialAllowed\n trialLengthDays\n updatedAt\n }\n}"; };
|
|
3801
4263
|
var getPriceList = function (_a) {
|
|
3802
|
-
var token = _a.token, code = _a.code,
|
|
4264
|
+
var token = _a.token, code = _a.code, apiHost = _a.apiHost;
|
|
3803
4265
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
3804
4266
|
var response;
|
|
3805
4267
|
return __generator(this, function (_b) {
|
|
@@ -3808,7 +4270,7 @@ var getPriceList = function (_a) {
|
|
|
3808
4270
|
query: MUTATION$2(),
|
|
3809
4271
|
token: token,
|
|
3810
4272
|
vars: { code: code },
|
|
3811
|
-
|
|
4273
|
+
apiHost: apiHost,
|
|
3812
4274
|
})];
|
|
3813
4275
|
case 1:
|
|
3814
4276
|
response = _b.sent();
|
|
@@ -3819,8 +4281,8 @@ var getPriceList = function (_a) {
|
|
|
3819
4281
|
};
|
|
3820
4282
|
|
|
3821
4283
|
function PaymentForms(_a) {
|
|
3822
|
-
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;
|
|
3823
|
-
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: quote ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: accountId && (jsxRuntime.jsx(PaymentContext.Provider, __assign({ value: { accountId: accountId, displayPayButtonNameAnyways: true } }, { children: jsxRuntime.jsx(PaymentForm, { isSaving: paying, setIsSaving: setIsPaying, onFail: handlePaymentFail, onPaymentSuccess: handlePaymentSaveSuccess }) }))) })) : (jsxRuntime.jsx(InitialSignupForm, { onSubmit: handleSubmit, submitting: proceedingToPayment })) }));
|
|
4284
|
+
var quote = _a.quote, paying = _a.paying, setIsPaying = _a.setIsPaying, handlePaymentSaveSuccess = _a.handlePaymentSaveSuccess, handlePaymentFail = _a.handlePaymentFail, handleSubmit = _a.handleSubmit, proceedingToPayment = _a.proceedingToPayment, accountId = _a.accountId, entityId = _a.entityId;
|
|
4285
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: quote ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: accountId && (jsxRuntime.jsx(PaymentContext.Provider, __assign({ value: { accountId: accountId, displayPayButtonNameAnyways: true } }, { children: jsxRuntime.jsx(PaymentForm, { entityId: entityId, isSaving: paying, setIsSaving: setIsPaying, onFail: handlePaymentFail, onPaymentSuccess: handlePaymentSaveSuccess }) }))) })) : (jsxRuntime.jsx(InitialSignupForm, { onSubmit: handleSubmit, submitting: proceedingToPayment })) }));
|
|
3824
4286
|
}
|
|
3825
4287
|
function InitialSignupForm(_a) {
|
|
3826
4288
|
var onSubmit = _a.onSubmit, submitting = _a.submitting;
|
|
@@ -3855,898 +4317,166 @@ function InitialSignupForm(_a) {
|
|
|
3855
4317
|
} }) }))] })), 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" })) })] })));
|
|
3856
4318
|
}
|
|
3857
4319
|
|
|
3858
|
-
var Title = antd.Typography.Title, Text$
|
|
4320
|
+
var Title = antd.Typography.Title, Text$5 = antd.Typography.Text;
|
|
3859
4321
|
function PaymentSuccessDisplay(_a) {
|
|
3860
|
-
var className = _a.className,
|
|
4322
|
+
var amountPaid = _a.amountPaid, className = _a.className, companyName = _a.companyName, returnUrl = _a.returnUrl, style = _a.style;
|
|
3861
4323
|
var window = React.useContext(BunnyContext).window;
|
|
3862
|
-
|
|
3863
|
-
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] })))] })));
|
|
4324
|
+
return (jsxRuntime.jsxs("div", __assign({ className: "flex flex-col items-center justify-center h-full ".concat(className), style: style }, { children: [jsxRuntime.jsx(CheckCircleFilled$1, { style: { fontSize: "48px", color: "rgb(52 211 153)" } }), jsxRuntime.jsxs(Title, __assign({ level: 3, className: "mt-2 m-0" }, { children: ["Payment of ", common.formatCurrency(amountPaid, "USD"), " successful"] })), returnUrl && (jsxRuntime.jsxs(Text$5, __assign({ className: "text-slate-500 cursor-pointer underline", onClick: function () { return (window.location.href = returnUrl); } }, { children: ["Back to ", companyName] })))] })));
|
|
3864
4325
|
}
|
|
3865
4326
|
|
|
3866
|
-
var Text$
|
|
4327
|
+
var Text$4 = antd.Typography.Text;
|
|
3867
4328
|
function PriceListDisplay(_a) {
|
|
3868
4329
|
var priceListData = _a.priceListData, topNavImageUrl = _a.topNavImageUrl;
|
|
3869
4330
|
if (!priceListData)
|
|
3870
4331
|
return null;
|
|
3871
|
-
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$
|
|
4332
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx("div", __assign({ className: "flex flex-col justify-between h-full my-12" }, { children: jsxRuntime.jsxs("div", __assign({ className: "flex flex-col space-y-8" }, { children: [jsxRuntime.jsx(antd.Image, { width: 24, src: topNavImageUrl, alt: "Logo", preview: false }), jsxRuntime.jsxs("div", __assign({ className: "flex flex-col" }, { children: [jsxRuntime.jsx(Text$4, __assign({ className: "text-slate-500 font-bold text-lg" }, { children: priceListData.name })), jsxRuntime.jsxs(Text$4, __assign({ className: "font-bold text-xl" }, { children: [common.formatCurrency(priceListData.basePrice, priceListData.currencyId), " ", "/ month"] }))] })), jsxRuntime.jsxs("div", __assign({ className: "flex flex-col" }, { children: [jsxRuntime.jsxs(Text$4, __assign({ style: { fontSize: "16px" }, className: "text-slate-500" }, { children: [priceListData.trialLengthDays, " day trial"] })), jsxRuntime.jsx(Text$4, __assign({ className: "text-slate-500", style: { fontSize: "12px" } }, { children: "You will not be charged until the last day of the trial." }))] }))] })) })) }));
|
|
3872
4333
|
}
|
|
3873
4334
|
|
|
3874
|
-
var BunnyFooterIcon = function (_a) {
|
|
3875
|
-
var color = _a.color;
|
|
3876
|
-
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" }) })) })] })));
|
|
3877
|
-
};
|
|
3878
|
-
|
|
3879
|
-
var Footer = function (_a) {
|
|
3880
|
-
var className = _a.className;
|
|
3881
|
-
var _b = common.useCurrentUserData(), privacyUrl = _b.privacyUrl, termsUrl = _b.termsUrl;
|
|
3882
|
-
var window = React.useContext(BunnyContext).window;
|
|
3883
|
-
var isMobile = useIsMobile(window);
|
|
3884
|
-
var quotePreviewData = recoil.useRecoilValue(planPickerQuoteDataState);
|
|
3885
|
-
var selectedPriceList = quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.priceList;
|
|
3886
|
-
if (selectedPriceList && isMobile)
|
|
3887
|
-
return null;
|
|
3888
|
-
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, {})] })));
|
|
3889
|
-
};
|
|
3890
|
-
var BunnyMarketingLink = function () {
|
|
3891
|
-
var _a = React.useState(false), isHovered = _a[0], setIsHovered = _a[1];
|
|
3892
|
-
var window = React.useContext(BunnyContext).window;
|
|
3893
|
-
var isMobile = useIsMobile(window);
|
|
3894
|
-
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 }) }))] })) })) })));
|
|
3895
|
-
};
|
|
3896
|
-
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);
|
|
3897
|
-
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);
|
|
3898
|
-
var templateObject_1$4, templateObject_2;
|
|
3899
|
-
|
|
3900
4335
|
var MUTATION$1 = "\n mutation portalSessionCreate ($tenantCode: String!, $expiry: Int!, $returnUrl: String!) {\n portalSessionCreate (tenantCode: $tenantCode, expiry: $expiry, returnUrl: $returnUrl) {\n errors\n token\n }\n }\n";
|
|
3901
4336
|
var portalSessionCreate = function (_a) {
|
|
3902
|
-
var tenantCode = _a.tenantCode, expiry = _a.expiry, returnUrl = _a.returnUrl, token = _a.token,
|
|
4337
|
+
var tenantCode = _a.tenantCode, expiry = _a.expiry, returnUrl = _a.returnUrl, token = _a.token, apiHost = _a.apiHost;
|
|
3903
4338
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
3904
4339
|
var response, errors;
|
|
3905
4340
|
var _b;
|
|
3906
4341
|
return __generator(this, function (_c) {
|
|
3907
4342
|
switch (_c.label) {
|
|
3908
4343
|
case 0: return [4 /*yield*/, common.gqlRequest({
|
|
3909
|
-
query: MUTATION$1,
|
|
3910
|
-
token: token,
|
|
3911
|
-
vars: { tenantCode: tenantCode, expiry: expiry, returnUrl: returnUrl },
|
|
3912
|
-
|
|
3913
|
-
})];
|
|
3914
|
-
case 1:
|
|
3915
|
-
response = _c.sent();
|
|
3916
|
-
errors = (response === null || response === void 0 ? void 0 : response.portalSessionCreate).errors;
|
|
3917
|
-
if (errors)
|
|
3918
|
-
throw errors;
|
|
3919
|
-
return [2 /*return*/, (_b = response === null || response === void 0 ? void 0 : response.portalSessionCreate) === null || _b === void 0 ? void 0 : _b.token];
|
|
3920
|
-
}
|
|
3921
|
-
});
|
|
3922
|
-
});
|
|
3923
|
-
};
|
|
3924
|
-
|
|
3925
|
-
var showErrorNotification = common.NotificationUtils.useErrorNotification();
|
|
3926
|
-
function Signup(_a) {
|
|
3927
|
-
var priceListCode = _a.priceListCode, returnUrl = _a.returnUrl;
|
|
3928
|
-
// Hooks
|
|
3929
|
-
var _b = React.useContext(BunnyContext), subdomain = _b.subdomain, token = _b.token, window = _b.window;
|
|
3930
|
-
reactQuery.useQuery({
|
|
3931
|
-
queryKey: common.QueryKeyFactory.default.currentUserKey,
|
|
3932
|
-
queryFn: function () { return getCurrentUserData({ token: token, subdomain: subdomain }); },
|
|
3933
|
-
});
|
|
3934
|
-
var isMobile = useIsMobile(window);
|
|
3935
|
-
var topNavImageUrl = React.useContext(BrandContext).topNavImageUrl;
|
|
3936
|
-
var entityId = common.useCurrentUserData().entityId;
|
|
3937
|
-
var _c = React.useState(undefined), quote = _c[0], setQuote = _c[1];
|
|
3938
|
-
var _d = React.useState(undefined), accountId = _d[0], setAccountId = _d[1];
|
|
3939
|
-
var _e = React.useState(undefined), quoteId = _e[0], setQuoteId = _e[1];
|
|
3940
|
-
var _f = React.useState(undefined), portalSessionToken = _f[0], setPortalSessionToken = _f[1];
|
|
3941
|
-
var _g = React.useState(undefined), formData = _g[0], setFormData = _g[1];
|
|
3942
|
-
var _h = React.useState(false), proceedingToPayment = _h[0], setProceedingToPayment = _h[1];
|
|
3943
|
-
var _j = React.useState(false), paying = _j[0], setIsPaying = _j[1];
|
|
3944
|
-
var _k = React.useState(false), purchaseSucceeded = _k[0], setPurchaseSucceeded = _k[1];
|
|
3945
|
-
// Queries
|
|
3946
|
-
var priceListData = reactQuery.useQuery({
|
|
3947
|
-
queryKey: ["priceList", priceListCode],
|
|
3948
|
-
queryFn: function () { return getPriceList({ token: token, subdomain: subdomain, code: priceListCode }); },
|
|
3949
|
-
}).data;
|
|
3950
|
-
function handleSubmit(formData) {
|
|
3951
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
3952
|
-
var data, portalSessionToken;
|
|
3953
|
-
return __generator(this, function (_a) {
|
|
3954
|
-
switch (_a.label) {
|
|
3955
|
-
case 0:
|
|
3956
|
-
setProceedingToPayment(true);
|
|
3957
|
-
setFormData(formData);
|
|
3958
|
-
return [4 /*yield*/, quoteAccountSignup({
|
|
3959
|
-
token: token,
|
|
3960
|
-
subdomain: subdomain,
|
|
3961
|
-
entityId: entityId,
|
|
3962
|
-
priceListCode: priceListCode,
|
|
3963
|
-
accountName: formData.accountName,
|
|
3964
|
-
billingContact: {
|
|
3965
|
-
firstName: formData.firstName,
|
|
3966
|
-
lastName: formData.lastName,
|
|
3967
|
-
email: formData.email,
|
|
3968
|
-
},
|
|
3969
|
-
})];
|
|
3970
|
-
case 1:
|
|
3971
|
-
data = _a.sent();
|
|
3972
|
-
setAccountId(data.account.id);
|
|
3973
|
-
return [4 /*yield*/, portalSessionCreate({
|
|
3974
|
-
token: token,
|
|
3975
|
-
subdomain: subdomain,
|
|
3976
|
-
tenantCode: data.tenant.code,
|
|
3977
|
-
expiry: 24,
|
|
3978
|
-
returnUrl: returnUrl || "",
|
|
3979
|
-
})];
|
|
3980
|
-
case 2:
|
|
3981
|
-
portalSessionToken = _a.sent();
|
|
3982
|
-
setPortalSessionToken(portalSessionToken);
|
|
3983
|
-
setQuoteId(data.quote.id);
|
|
3984
|
-
setProceedingToPayment(false);
|
|
3985
|
-
setQuote({
|
|
3986
|
-
amountDue: data.quote.amountDue,
|
|
3987
|
-
currencyId: data.quote.currencyId,
|
|
3988
|
-
});
|
|
3989
|
-
return [2 /*return*/];
|
|
3990
|
-
}
|
|
3991
|
-
});
|
|
3992
|
-
});
|
|
3993
|
-
}
|
|
3994
|
-
function handlePaymentSaveSuccess(paymentSuccess) {
|
|
3995
|
-
var _a;
|
|
3996
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
3997
|
-
var response, plugin;
|
|
3998
|
-
return __generator(this, function (_b) {
|
|
3999
|
-
switch (_b.label) {
|
|
4000
|
-
case 0:
|
|
4001
|
-
if (!formData) {
|
|
4002
|
-
throw new Error("Form data is required");
|
|
4003
|
-
}
|
|
4004
|
-
response = paymentSuccess.pluginPaymentResponse;
|
|
4005
|
-
plugin = response === null || response === void 0 ? void 0 : response.plugin;
|
|
4006
|
-
if (!(plugin === null || plugin === void 0 ? void 0 : plugin.id)) {
|
|
4007
|
-
throw new Error("Plugin ID is required");
|
|
4008
|
-
}
|
|
4009
|
-
if (!accountId) {
|
|
4010
|
-
throw new Error("Account ID is required");
|
|
4011
|
-
}
|
|
4012
|
-
if (!portalSessionToken) {
|
|
4013
|
-
throw new Error("Portal session token is required");
|
|
4014
|
-
}
|
|
4015
|
-
return [4 /*yield*/, accountSignup({
|
|
4016
|
-
token: portalSessionToken,
|
|
4017
|
-
subdomain: subdomain,
|
|
4018
|
-
entityId: entityId,
|
|
4019
|
-
quoteId: quoteId,
|
|
4020
|
-
paymentMethodId: (_a = paymentSuccess.savedPaymentMethodResponse) === null || _a === void 0 ? void 0 : _a.paymentMethodId.toString(),
|
|
4021
|
-
pluginId: plugin.id.toString(),
|
|
4022
|
-
priceListCode: priceListCode,
|
|
4023
|
-
accountId: accountId,
|
|
4024
|
-
})];
|
|
4025
|
-
case 1:
|
|
4026
|
-
_b.sent();
|
|
4027
|
-
setIsPaying(false);
|
|
4028
|
-
setPurchaseSucceeded(true);
|
|
4029
|
-
return [2 /*return*/];
|
|
4030
|
-
}
|
|
4031
|
-
});
|
|
4032
|
-
});
|
|
4033
|
-
}
|
|
4034
|
-
function handlePaymentFail(error) {
|
|
4035
|
-
showErrorNotification(error.message);
|
|
4036
|
-
setIsPaying(false);
|
|
4037
|
-
}
|
|
4038
|
-
if (isMobile) {
|
|
4039
|
-
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 || "" }) }))] }))) })));
|
|
4040
|
-
}
|
|
4041
|
-
else {
|
|
4042
|
-
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, {})] }));
|
|
4043
|
-
}
|
|
4044
|
-
}
|
|
4045
|
-
|
|
4046
|
-
var transactionMutation = function (filter) { return "\nquery transactions {\n transactions ".concat(filter ? "(".concat(filter, ")") : "", " {\n nodes {\n amount\n createdAt\n currencyId\n description\n id\n kind\n state\n transactionableId\n transactionable {\n ...on Payment { amount }\n ...on Invoice { amount number }\n }\n }\n }\n}"); };
|
|
4047
|
-
var getTransactions = function (filter, token, subdomain, kindsToShow) { return __awaiter(void 0, void 0, void 0, function () {
|
|
4048
|
-
var response, _a, data, errors, transactions;
|
|
4049
|
-
var _b, _c;
|
|
4050
|
-
return __generator(this, function (_d) {
|
|
4051
|
-
switch (_d.label) {
|
|
4052
|
-
case 0: return [4 /*yield*/, fetch(subdomain + "/graphql", {
|
|
4053
|
-
method: "POST",
|
|
4054
|
-
headers: {
|
|
4055
|
-
"Content-type": "application/json; charset=utf-8",
|
|
4056
|
-
Authorization: "Bearer ".concat(token),
|
|
4057
|
-
},
|
|
4058
|
-
body: JSON.stringify({
|
|
4059
|
-
query: transactionMutation(filter),
|
|
4060
|
-
}),
|
|
4061
|
-
})];
|
|
4062
|
-
case 1:
|
|
4063
|
-
response = _d.sent();
|
|
4064
|
-
return [4 /*yield*/, response.json()];
|
|
4065
|
-
case 2:
|
|
4066
|
-
_a = _d.sent(), data = _a.data, errors = _a.errors;
|
|
4067
|
-
if (errors) {
|
|
4068
|
-
throw new Error(errors[0].message);
|
|
4069
|
-
}
|
|
4070
|
-
transactions = (_c = (_b = data === null || data === void 0 ? void 0 : data.transactions) === null || _b === void 0 ? void 0 : _b.nodes) === null || _c === void 0 ? void 0 : _c.filter(function (transaction) { return kindsToShow.includes(transaction.kind); });
|
|
4071
|
-
return [2 /*return*/, transactions === null || transactions === void 0 ? void 0 : transactions.reverse()];
|
|
4072
|
-
}
|
|
4073
|
-
});
|
|
4074
|
-
}); };
|
|
4075
|
-
|
|
4076
|
-
var pageContentRefState = recoil.atom({
|
|
4077
|
-
key: "pageContentRefState",
|
|
4078
|
-
default: undefined,
|
|
4079
|
-
});
|
|
4080
|
-
|
|
4081
|
-
var PageContent = function (_a) {
|
|
4082
|
-
var children = _a.children, className = _a.className, style = _a.style;
|
|
4083
|
-
var pageContentRef = React.useRef(null);
|
|
4084
|
-
var setPageContentRef = recoil.useSetRecoilState(pageContentRefState);
|
|
4085
|
-
React.useEffect(function () {
|
|
4086
|
-
setPageContentRef(pageContentRef === null || pageContentRef === void 0 ? void 0 : pageContentRef.current);
|
|
4087
|
-
}, [pageContentRef, setPageContentRef]);
|
|
4088
|
-
return (jsxRuntime.jsx("div", __assign({ className: className, ref: pageContentRef, style: style }, { children: children })));
|
|
4089
|
-
};
|
|
4090
|
-
|
|
4091
|
-
var Text$8 = antd.Typography.Text;
|
|
4092
|
-
var PageHeaderWithActions = function (_a) {
|
|
4093
|
-
var children = _a.children, title = _a.title;
|
|
4094
|
-
var isMobile = common.useIsMobile();
|
|
4095
|
-
return (jsxRuntime.jsxs("div", __assign({ className: "flex pb-4 shadow-padding-x ".concat(isMobile ? "flex-col gap-2" : "items-center justify-between h-8") }, { children: [jsxRuntime.jsx(PageSubTitle, { title: title }), children] })));
|
|
4096
|
-
};
|
|
4097
|
-
var PageSubTitle = function (_a) {
|
|
4098
|
-
var title = _a.title;
|
|
4099
|
-
var secondaryColor = React.useContext(BrandContext).secondaryColor;
|
|
4100
|
-
var darkMode = React.useContext(BunnyContext).darkMode;
|
|
4101
|
-
return (jsxRuntime.jsx(Text$8, __assign({ className: "shrink-0 font-medium", style: { color: darkMode ? undefined : secondaryColor } }, { children: title })));
|
|
4102
|
-
};
|
|
4103
|
-
|
|
4104
|
-
var StateTag = function (_a) {
|
|
4105
|
-
var state = _a.state;
|
|
4106
|
-
return jsxRuntime.jsx(antd.Tag, __assign({ color: getColor(state) }, { children: lodash.capitalize(lodash.startCase(state)) }));
|
|
4107
|
-
};
|
|
4108
|
-
var getColor = function (state) {
|
|
4109
|
-
switch (state) {
|
|
4110
|
-
case common.FrontendTransaction.TransactionState.not_due:
|
|
4111
|
-
return "yellow";
|
|
4112
|
-
case common.FrontendTransaction.TransactionState.voided:
|
|
4113
|
-
return "black";
|
|
4114
|
-
case common.FrontendTransaction.TransactionState.ready:
|
|
4115
|
-
return "orange";
|
|
4116
|
-
case common.FrontendTransaction.TransactionState.preparing:
|
|
4117
|
-
return "purple";
|
|
4118
|
-
case common.FrontendTransaction.TransactionState.unapplied:
|
|
4119
|
-
case common.FrontendTransaction.TransactionState.partially_applied:
|
|
4120
|
-
case common.FrontendTransaction.TransactionState.applied:
|
|
4121
|
-
return "blue";
|
|
4122
|
-
case common.FrontendTransaction.TransactionState.due:
|
|
4123
|
-
case common.FrontendTransaction.TransactionState.unpaid:
|
|
4124
|
-
return "orange";
|
|
4125
|
-
case common.FrontendTransaction.TransactionState.failed:
|
|
4126
|
-
return "red";
|
|
4127
|
-
case common.FrontendTransaction.TransactionState.paid:
|
|
4128
|
-
return "green";
|
|
4129
|
-
default:
|
|
4130
|
-
return "blue";
|
|
4131
|
-
}
|
|
4132
|
-
};
|
|
4133
|
-
|
|
4134
|
-
var TransactionGridCell = styled__default["default"].div.withConfig({
|
|
4135
|
-
shouldForwardProp: function (prop) {
|
|
4136
|
-
return !["gridColumn", "padding", "right"].includes(prop);
|
|
4137
|
-
},
|
|
4138
|
-
})(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);
|
|
4139
|
-
var templateObject_1$3;
|
|
4140
|
-
|
|
4141
|
-
var Text$7 = antd.Typography.Text;
|
|
4142
|
-
var TransactionDate = function (_a) {
|
|
4143
|
-
var date = _a.date;
|
|
4144
|
-
return jsxRuntime.jsx(Text$7, __assign({ className: "text-sm" }, { children: common.Misc.formatDate(date) }));
|
|
4145
|
-
};
|
|
4146
|
-
|
|
4147
|
-
var isInvoice = function (transaction) {
|
|
4148
|
-
return transaction.kind === "INVOICE";
|
|
4149
|
-
};
|
|
4150
|
-
var isQuote = function (transaction) {
|
|
4151
|
-
return transaction.kind === "QUOTE";
|
|
4152
|
-
};
|
|
4153
|
-
var TransactionRowTitle = function (_a) {
|
|
4154
|
-
var transaction = _a.transaction;
|
|
4155
|
-
if (!isInvoice(transaction) && !isQuote(transaction)) {
|
|
4156
|
-
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
4157
|
-
}
|
|
4158
|
-
return (jsxRuntime.jsx("span", __assign({ className: "text-slate-400", style: { fontSize: "11px" } }, { children: transaction.transactionable.number })));
|
|
4159
|
-
};
|
|
4160
|
-
|
|
4161
|
-
// TODO: delete
|
|
4162
|
-
var ArrowDownToLine = function (_a) {
|
|
4163
|
-
var className = _a.className, _b = _a.color, color = _b === void 0 ? common.SLATE_600 : _b;
|
|
4164
|
-
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" })] })));
|
|
4165
|
-
};
|
|
4166
|
-
|
|
4167
|
-
var TransactionsListContext = React.createContext({});
|
|
4168
|
-
|
|
4169
|
-
var TransactionDownload = function (_a) {
|
|
4170
|
-
var transaction = _a.transaction, token = _a.token, subdomain = _a.subdomain;
|
|
4171
|
-
var darkMode = React.useContext(BunnyContext).darkMode;
|
|
4172
|
-
var downloadTransactionLink = React.useContext(TransactionsListContext).downloadTransactionLink;
|
|
4173
|
-
var downloadFile = common.useDownloadFile();
|
|
4174
|
-
var isMobile = common.useIsMobile();
|
|
4175
|
-
var isClickable = transaction.kind === "INVOICE" || downloadTransactionLink !== undefined;
|
|
4176
|
-
var downloadLink = downloadTransactionLink
|
|
4177
|
-
? downloadTransactionLink(transaction.transactionableId)
|
|
4178
|
-
: "".concat(subdomain, "/api/pdf/invoice/").concat(transaction.transactionableId);
|
|
4179
|
-
if (!isClickable)
|
|
4180
|
-
return null;
|
|
4181
|
-
return (jsxRuntime.jsx("div", __assign({ onClick: function (e) {
|
|
4182
|
-
e.stopPropagation();
|
|
4183
|
-
downloadFile(downloadLink, token);
|
|
4184
|
-
} }, { children: jsxRuntime.jsx(ArrowDownToLine, { className: "".concat(isMobile ? "" : "show-on-hover"), color: darkMode ? common.WHITE : common.SLATE_600 }) })));
|
|
4185
|
-
};
|
|
4186
|
-
|
|
4187
|
-
var Text$6 = antd.Typography.Text;
|
|
4188
|
-
var TransactionsEmptyState = function () {
|
|
4189
|
-
var noTransactionsMessage = React.useContext(TransactionsListContext).noTransactionsMessage;
|
|
4190
|
-
return (jsxRuntime.jsx(Text$6, __assign({ className: "flex justify-center p-4 text-base" }, { children: noTransactionsMessage || "There are no transactions" })));
|
|
4191
|
-
};
|
|
4192
|
-
|
|
4193
|
-
function capitalizeFirstLetter(string) {
|
|
4194
|
-
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
4195
|
-
}
|
|
4196
|
-
var WARREN_STATE_LS_KEY = "warrenState";
|
|
4197
|
-
var CURRENT_WARREN_ID_LS_KEY = "currentWarrenId";
|
|
4198
|
-
var getIsCapacitorApp = function () {
|
|
4199
|
-
var isAndroid = window.location.origin === "http://localhost";
|
|
4200
|
-
var isIOS = window.location.protocol === "capacitor:";
|
|
4201
|
-
return isAndroid || isIOS;
|
|
4202
|
-
};
|
|
4203
|
-
var getLocalStorageSubdomain = function () {
|
|
4204
|
-
var warrenState = JSON.parse(window.localStorage.getItem(WARREN_STATE_LS_KEY) || "{}");
|
|
4205
|
-
var subdomain = warrenState[CURRENT_WARREN_ID_LS_KEY];
|
|
4206
|
-
if (!subdomain) {
|
|
4207
|
-
console.warn("ERROR_MESSAGE_NO_SUBDOMAIN_DEFINED");
|
|
4208
|
-
//throw new Error(ERROR_MESSAGE_NO_SUBDOMAIN_DEFINED);
|
|
4209
|
-
}
|
|
4210
|
-
return subdomain;
|
|
4211
|
-
};
|
|
4212
|
-
var getApiHost = function (subdomain) {
|
|
4213
|
-
var isLocalHost = window.location.href.indexOf(".internal") > 0;
|
|
4214
|
-
var sub = subdomain || getLocalStorageSubdomain();
|
|
4215
|
-
if (getIsCapacitorApp()) {
|
|
4216
|
-
return isLocalHost || process.env.REACT_APP_IS_INTERNAL === "true"
|
|
4217
|
-
? "https://".concat(sub, ".bunny.internal")
|
|
4218
|
-
: "https://".concat(sub, ".").concat(process.env.REACT_APP_ROOT_DOMAIN);
|
|
4219
|
-
}
|
|
4220
|
-
return "";
|
|
4221
|
-
};
|
|
4222
|
-
var getGraphQLBase = function () {
|
|
4223
|
-
if (getIsCapacitorApp()) {
|
|
4224
|
-
return "".concat(getApiHost(), "/graphql");
|
|
4225
|
-
}
|
|
4226
|
-
return "/graphql";
|
|
4227
|
-
};
|
|
4228
|
-
var createRequestHeaders = function (token) {
|
|
4229
|
-
var bearerToken = "Bearer ".concat(token);
|
|
4230
|
-
var headers = {
|
|
4231
|
-
"Content-type": "application/json; charset=utf-8",
|
|
4232
|
-
};
|
|
4233
|
-
headers["Authorization"] = bearerToken;
|
|
4234
|
-
return headers;
|
|
4235
|
-
};
|
|
4236
|
-
var useGraphQLRequest = function () { return function (query, token, variables) { return __awaiter(void 0, void 0, void 0, function () {
|
|
4237
|
-
var error_1;
|
|
4238
|
-
return __generator(this, function (_a) {
|
|
4239
|
-
switch (_a.label) {
|
|
4240
|
-
case 0:
|
|
4241
|
-
_a.trys.push([0, 2, , 3]);
|
|
4242
|
-
return [4 /*yield*/, request__default["default"](getGraphQLBase(), query, variables, createRequestHeaders(token))];
|
|
4243
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
4244
|
-
case 2:
|
|
4245
|
-
error_1 = _a.sent();
|
|
4246
|
-
throw error_1;
|
|
4247
|
-
case 3: return [2 /*return*/];
|
|
4248
|
-
}
|
|
4249
|
-
});
|
|
4250
|
-
}); }; };
|
|
4251
|
-
|
|
4252
|
-
var Text$5 = antd.Typography.Text;
|
|
4253
|
-
var TransactionsListDesktop = function (_a) {
|
|
4254
|
-
var transactions = _a.transactions, onTransactionClick = _a.onTransactionClick;
|
|
4255
|
-
var columns = React.useContext(TransactionsListContext).columns;
|
|
4256
|
-
var _b = React.useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain, darkMode = _b.darkMode;
|
|
4257
|
-
var showAmount = columns.includes("amount");
|
|
4258
|
-
var showDateAndTitle = columns.includes("date-and-title");
|
|
4259
|
-
var showDownload = columns.includes("download");
|
|
4260
|
-
var showState = columns.includes("state");
|
|
4261
|
-
if ((transactions === null || transactions === void 0 ? void 0 : transactions.length) === 0)
|
|
4262
|
-
return jsxRuntime.jsx(TransactionsEmptyState, {});
|
|
4263
|
-
return transactions === null || transactions === void 0 ? void 0 : transactions.map(function (transaction, index) {
|
|
4264
|
-
var _a;
|
|
4265
|
-
var isClickable = onTransactionClick !== undefined;
|
|
4266
|
-
return (jsxRuntime.jsxs("div", __assign({ className: "contents ".concat(isClickable && "cursor-pointer", " show-on-hover-container"), onClick: function () {
|
|
4267
|
-
onTransactionClick === null || onTransactionClick === void 0 ? void 0 : onTransactionClick(transaction);
|
|
4268
|
-
}, style: {
|
|
4269
|
-
backgroundColor: index % 2 === 0
|
|
4270
|
-
? "var(--row-background".concat(darkMode ? "-dark" : "", ")")
|
|
4271
|
-
: "var(--row-background-alternate".concat(darkMode ? "-dark" : "", ")"),
|
|
4272
|
-
} }, { 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$5, { 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$5, { children: common.Misc.formatCurrency(((_a = transaction === null || transaction === void 0 ? void 0 : transaction.transactionable) === null || _a === void 0 ? void 0 : _a.amount) || transaction.amount, transaction.currencyId) }) })))] }), index));
|
|
4273
|
-
});
|
|
4274
|
-
};
|
|
4275
|
-
|
|
4276
|
-
var Text$4 = antd.Typography.Text;
|
|
4277
|
-
var TransactionsListMobile = function (_a) {
|
|
4278
|
-
var transactions = _a.transactions, onTransactionClick = _a.onTransactionClick;
|
|
4279
|
-
var columns = React.useContext(TransactionsListContext).columns;
|
|
4280
|
-
var _b = React.useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain, darkMode = _b.darkMode;
|
|
4281
|
-
var showAmount = columns.includes("amount");
|
|
4282
|
-
var showDateAndTitle = columns.includes("date-and-title");
|
|
4283
|
-
var showDownload = columns.includes("download");
|
|
4284
|
-
var showState = columns.includes("state");
|
|
4285
|
-
if ((transactions === null || transactions === void 0 ? void 0 : transactions.length) === 0)
|
|
4286
|
-
return jsxRuntime.jsx(TransactionsEmptyState, {});
|
|
4287
|
-
return transactions === null || transactions === void 0 ? void 0 : transactions.map(function (transaction, index) {
|
|
4288
|
-
var isClickable = transaction.kind === "INVOICE";
|
|
4289
|
-
return (jsxRuntime.jsxs("div", __assign({ className: "contents ".concat(isClickable && "cursor-pointer", " show-on-hover-container"), onClick: function () {
|
|
4290
|
-
onTransactionClick(transaction);
|
|
4291
|
-
}, style: {
|
|
4292
|
-
backgroundColor: index % 2 === 0
|
|
4293
|
-
? "var(--row-background".concat(darkMode ? "-dark" : "", ")")
|
|
4294
|
-
: "var(--row-background-alternate".concat(darkMode ? "-dark" : "", ")"),
|
|
4295
|
-
} }, { 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$4, { 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$4, { children: "\u00B7" }), showAmount && (jsxRuntime.jsx(Text$4, { children: common.Misc.formatCurrency(transaction.transactionable.amount || transaction.amount, transaction.currencyId) }))] }))] })) }), showDownload && (jsxRuntime.jsx(TransactionGridCell, __assign({ right: true }, { children: jsxRuntime.jsx(TransactionDownload, { transaction: transaction, token: token, subdomain: subdomain }) })))] }), index));
|
|
4296
|
-
});
|
|
4297
|
-
};
|
|
4298
|
-
|
|
4299
|
-
// Create a client
|
|
4300
|
-
var queryClient = new reactQuery.QueryClient();
|
|
4301
|
-
function Transactions(_a) {
|
|
4302
|
-
var transactionComponent = _a.transactionComponent, _b = _a.showSearchBar, showSearchBar = _b === void 0 ? true : _b, _c = _a.showTitle, showTitle = _c === void 0 ? true : _c, _d = _a.columns, columns = _d === void 0 ? ["date-and-title", "state", "amount"] : _d, className = _a.className, _e = _a.shadow, shadow = _e === void 0 ? "md" : _e, searchBarClassName = _a.searchBarClassName, _f = _a.useModal, useModal = _f === void 0 ? false : _f, onTransactionClick = _a.onTransactionClick, _g = _a.suppressTransactionDisplay, suppressTransactionDisplay = _g === void 0 ? false : _g, _h = _a.kindsToShow, kindsToShow = _h === void 0 ? [
|
|
4303
|
-
common.TransactionKind.INVOICE,
|
|
4304
|
-
common.TransactionKind.PAYMENT,
|
|
4305
|
-
common.TransactionKind.REFUND,
|
|
4306
|
-
common.TransactionKind.WRITE_OFF,
|
|
4307
|
-
] : _h, style = _a.style, filter = _a.filter, noTransactionsMessage = _a.noTransactionsMessage;
|
|
4308
|
-
var contextValues = {
|
|
4309
|
-
showSearchBar: showSearchBar,
|
|
4310
|
-
showTitle: showTitle,
|
|
4311
|
-
transactionComponent: transactionComponent,
|
|
4312
|
-
columns: columns,
|
|
4313
|
-
className: className,
|
|
4314
|
-
searchBarClassName: searchBarClassName,
|
|
4315
|
-
shadow: shadow,
|
|
4316
|
-
useModal: useModal,
|
|
4317
|
-
onTransactionClick: onTransactionClick,
|
|
4318
|
-
suppressTransactionDisplay: suppressTransactionDisplay,
|
|
4319
|
-
kindsToShow: kindsToShow,
|
|
4320
|
-
style: style,
|
|
4321
|
-
filter: filter,
|
|
4322
|
-
noTransactionsMessage: noTransactionsMessage,
|
|
4323
|
-
};
|
|
4324
|
-
return (jsxRuntime.jsx(reactQuery.QueryClientProvider, __assign({ client: queryClient }, { children: jsxRuntime.jsx(TransactionsListContext.Provider, __assign({ value: contextValues }, { children: jsxRuntime.jsx(TransactionsWrapper, {}) })) })));
|
|
4325
|
-
}
|
|
4326
|
-
function TransactionsWrapper() {
|
|
4327
|
-
var _a = React.useContext(TransactionsListContext), kindsToShow = _a.kindsToShow, filterFromContext = _a.filter;
|
|
4328
|
-
var _b = React.useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain;
|
|
4329
|
-
// Local state
|
|
4330
|
-
var _c = React.useState(""), search = _c[0], setSearch = _c[1];
|
|
4331
|
-
var filter = filterFromContext ||
|
|
4332
|
-
(search ? "filter: \"transaction.transactionableId is ".concat(search, "\"") : "");
|
|
4333
|
-
// Queries
|
|
4334
|
-
var data = reactQuery.useQuery({
|
|
4335
|
-
queryKey: ["transactions", token, filter],
|
|
4336
|
-
queryFn: function () { return getTransactions(filter, token, subdomain, kindsToShow); },
|
|
4337
|
-
placeholderData: reactQuery.keepPreviousData,
|
|
4338
|
-
}).data;
|
|
4339
|
-
return (jsxRuntime.jsx(TransactionsDisplay, { transactions: data, onSearchValueChanged: setSearch, search: search }));
|
|
4340
|
-
}
|
|
4341
|
-
function TransactionsDisplay(_a) {
|
|
4342
|
-
var transactions = _a.transactions, onSearchValueChanged = _a.onSearchValueChanged, search = _a.search, title = _a.title;
|
|
4343
|
-
var _b = React.useContext(TransactionsListContext), showSearchBar = _b.showSearchBar, showTitle = _b.showTitle, transactionComponent = _b.transactionComponent, useModal = _b.useModal, suppressTransactionDisplay = _b.suppressTransactionDisplay, className = _b.className, shadow = _b.shadow, searchBarClassName = _b.searchBarClassName, style = _b.style, onTransactionClick = _b.onTransactionClick;
|
|
4344
|
-
var columns = React.useContext(TransactionsListContext).columns;
|
|
4345
|
-
var darkMode = React.useContext(BunnyContext).darkMode;
|
|
4346
|
-
// Local state
|
|
4347
|
-
var _c = React.useState(null), selectedTransaction = _c[0], setSelectedTransaction = _c[1];
|
|
4348
|
-
var _d = React.useState(false), drawerOpen = _d[0], setDrawerOpen = _d[1];
|
|
4349
|
-
// Hooks
|
|
4350
|
-
var isMobile = common.useIsMobile();
|
|
4351
|
-
function handleTransactionClick(transaction) {
|
|
4352
|
-
if (onTransactionClick) {
|
|
4353
|
-
onTransactionClick(transaction);
|
|
4354
|
-
}
|
|
4355
|
-
if (!suppressTransactionDisplay) {
|
|
4356
|
-
setSelectedTransaction(transaction);
|
|
4357
|
-
setDrawerOpen(true);
|
|
4358
|
-
}
|
|
4359
|
-
}
|
|
4360
|
-
// Since the columns are dynamic, we need to calculate the grid template columns
|
|
4361
|
-
var gridTemplateColumns = function () {
|
|
4362
|
-
var templateColumns = [];
|
|
4363
|
-
if (isMobile) {
|
|
4364
|
-
if (columns.includes("date-and-title") ||
|
|
4365
|
-
columns.includes("state") ||
|
|
4366
|
-
columns.includes("amount")) {
|
|
4367
|
-
templateColumns.push("auto");
|
|
4368
|
-
}
|
|
4369
|
-
if (columns.includes("download")) {
|
|
4370
|
-
templateColumns.push("auto");
|
|
4371
|
-
}
|
|
4372
|
-
}
|
|
4373
|
-
else {
|
|
4374
|
-
if (columns.includes("date-and-title")) {
|
|
4375
|
-
templateColumns.push("auto 3fr");
|
|
4376
|
-
}
|
|
4377
|
-
if (columns.includes("download")) {
|
|
4378
|
-
templateColumns.push("auto");
|
|
4379
|
-
}
|
|
4380
|
-
if (columns.includes("state")) {
|
|
4381
|
-
templateColumns.push("auto");
|
|
4382
|
-
}
|
|
4383
|
-
if (columns.includes("amount")) {
|
|
4384
|
-
templateColumns.push("auto");
|
|
4385
|
-
}
|
|
4386
|
-
}
|
|
4387
|
-
return templateColumns.join(" ");
|
|
4388
|
-
};
|
|
4389
|
-
var drawerTitle = function () {
|
|
4390
|
-
if (!selectedTransaction)
|
|
4391
|
-
return "";
|
|
4392
|
-
var kind = selectedTransaction.kind.toLowerCase();
|
|
4393
|
-
return kind.charAt(0).toUpperCase() + kind.slice(1);
|
|
4394
|
-
};
|
|
4395
|
-
return (jsxRuntime.jsxs("div", __assign({ style: style }, { children: [jsxRuntime.jsx(PageHeaderWithActions, __assign({ title: title || (showTitle ? "Past transactions" : undefined) }, { children: showSearchBar && (jsxRuntime.jsx("div", { children: jsxRuntime.jsx(antd.Input, { className: searchBarClassName
|
|
4396
|
-
? searchBarClassName
|
|
4397
|
-
: "border border-slate-200", onChange: function (e) {
|
|
4398
|
-
if (isNaN(Number(e.target.value))) {
|
|
4399
|
-
return;
|
|
4400
|
-
}
|
|
4401
|
-
onSearchValueChanged(e.target.value);
|
|
4402
|
-
}, prefix: jsxRuntime.jsx(SearchOutlined$1, {}), placeholder: "Search by id #", style: {
|
|
4403
|
-
minWidth: "300px",
|
|
4404
|
-
}, 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: {
|
|
4405
|
-
gridTemplateColumns: gridTemplateColumns(),
|
|
4406
|
-
backgroundColor: "var(--row-background".concat(darkMode ? "-dark" : "", ")"),
|
|
4407
|
-
} }, { children: isMobile ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: TransactionsListMobile({
|
|
4408
|
-
transactions: transactions,
|
|
4409
|
-
onTransactionClick: handleTransactionClick,
|
|
4410
|
-
}) })) : (jsxRuntime.jsx(jsxRuntime.Fragment, { children: TransactionsListDesktop({
|
|
4411
|
-
transactions: transactions,
|
|
4412
|
-
onTransactionClick: handleTransactionClick,
|
|
4413
|
-
}) })) })) })), useModal ? (jsxRuntime.jsx(antd.Modal, __assign({ title: "Basic Modal", open: drawerOpen, onOk: function () { return setDrawerOpen(false); }, onCancel: function () { return setDrawerOpen(false); }, width: 900, footer: null }, { children: jsxRuntime.jsx(Invoice, { id: (selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.transactionableId) || "" }) }))) : (jsxRuntime.jsx(antd.Drawer, __assign({ title: drawerTitle(), onClose: function () { return setDrawerOpen(false); }, open: drawerOpen, width: 900 }, { children: transactionComponent ? (transactionComponent) : (selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.kind) === "INVOICE" ? (jsxRuntime.jsx(Invoice, { id: selectedTransaction.transactionableId })) : (jsxRuntime.jsxs(antd.Card, __assign({ className: "shadow-md" }, { children: [jsxRuntime.jsx(antd.Typography.Title, __assign({ level: 2, className: "mb-4" }, { children: "Transaction Details" })), jsxRuntime.jsxs(antd.Typography.Paragraph, { children: [jsxRuntime.jsx("strong", { children: "Amount:" }), " ", jsxRuntime.jsx(antd.Typography.Text, { children: common.Misc.formatCurrency((selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.amount) || 0, (selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.currencyId) || "USD") })] }), jsxRuntime.jsxs(antd.Typography.Paragraph, { children: [jsxRuntime.jsx("strong", { children: "Description:" }), " ", jsxRuntime.jsx(antd.Typography.Text, { children: selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.description })] }), jsxRuntime.jsxs(antd.Typography.Paragraph, { children: [jsxRuntime.jsx("strong", { children: "Kind:" }), " ", jsxRuntime.jsx(antd.Typography.Text, { children: selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.kind })] }), jsxRuntime.jsxs(antd.Typography.Paragraph, { children: [jsxRuntime.jsx("strong", { children: "State:" }), " ", jsxRuntime.jsx(antd.Typography.Text, { children: selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.state })] })] }))) })))] })));
|
|
4414
|
-
}
|
|
4415
|
-
|
|
4416
|
-
var updatingChargeQuantityIdState = recoil.atom({
|
|
4417
|
-
key: "updatingChargeQuantityIdState",
|
|
4418
|
-
default: undefined,
|
|
4419
|
-
});
|
|
4420
|
-
|
|
4421
|
-
var canShowQuantitiesInput = function (charge, subscription) {
|
|
4422
|
-
// Check if the subscription is active, pending, or in trial,
|
|
4423
|
-
// the pricing model is not flat,
|
|
4424
|
-
// and if it's not a trial, also check if the current charge is the last one in the subscription.
|
|
4425
|
-
var _a, _b, _c;
|
|
4426
|
-
var isActiveSubscription = ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === common.SubscriptionState.ACTIVE;
|
|
4427
|
-
var isPendingSubscription = ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === common.SubscriptionState.PENDING;
|
|
4428
|
-
var isTrialSubscription = ((_c = subscription.state) === null || _c === void 0 ? void 0 : _c.toUpperCase()) === common.SubscriptionState.TRIAL;
|
|
4429
|
-
var isFlatPricing = charge.pricingModel === "FLAT";
|
|
4430
|
-
var shouldProcessCharge = (isActiveSubscription || isPendingSubscription || isTrialSubscription) &&
|
|
4431
|
-
!isFlatPricing &&
|
|
4432
|
-
charge.selfServiceQuantity &&
|
|
4433
|
-
!charge.expired;
|
|
4434
|
-
// Now you can use the value of shouldProcessCharge to determine whether to process the charge.
|
|
4435
|
-
return shouldProcessCharge;
|
|
4436
|
-
};
|
|
4437
|
-
var createQuoteParams = function (quote, subscriptionQuantity, editedSubscription) {
|
|
4438
|
-
var quoteChange = quote.quoteChanges.find(function (quoteChange) {
|
|
4439
|
-
return quoteChange.priceList.id === (editedSubscription === null || editedSubscription === void 0 ? void 0 : editedSubscription.subscription.priceList.id);
|
|
4440
|
-
});
|
|
4441
|
-
var quoteChangeCharge = quoteChange === null || quoteChange === void 0 ? void 0 : quoteChange.charges.find(function (charge) { return charge.priceListCharge.id === editedSubscription.chargeId; });
|
|
4442
|
-
var charges = [
|
|
4443
|
-
{
|
|
4444
|
-
id: quoteChangeCharge.id,
|
|
4445
|
-
quantity: editedSubscription.quantity - subscriptionQuantity,
|
|
4446
|
-
},
|
|
4447
|
-
];
|
|
4448
|
-
return { charges: charges, quoteChange: quoteChange };
|
|
4449
|
-
};
|
|
4450
|
-
var canShowChangeQuantities = function (_a) {
|
|
4451
|
-
var subscriptions = _a.subscriptions;
|
|
4452
|
-
return subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.some(function (subscription) {
|
|
4453
|
-
return subscription.charges.some(function (charge, chargeIndex) {
|
|
4454
|
-
return canShowQuantitiesInput(charge, subscription);
|
|
4455
|
-
});
|
|
4456
|
-
});
|
|
4457
|
-
};
|
|
4458
|
-
var isSubscriptionNotActive = function (subscription) {
|
|
4459
|
-
var _a, _b;
|
|
4460
|
-
return ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === common.SubscriptionState.EXPIRED ||
|
|
4461
|
-
((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === common.SubscriptionState.CANCELED;
|
|
4462
|
-
};
|
|
4463
|
-
var canShowSubscriptionActions = function (subscription) {
|
|
4464
|
-
var _a, _b;
|
|
4465
|
-
return ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === common.SubscriptionState.ACTIVE ||
|
|
4466
|
-
((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === common.SubscriptionState.PENDING;
|
|
4467
|
-
};
|
|
4468
|
-
|
|
4469
|
-
var useCreateSubscriptionQuote = function () {
|
|
4470
|
-
var graphQLRequest = useGraphQLRequest();
|
|
4471
|
-
return function (subscriptionIds, token) { return __awaiter(void 0, void 0, void 0, function () {
|
|
4472
|
-
var data;
|
|
4473
|
-
return __generator(this, function (_a) {
|
|
4474
|
-
switch (_a.label) {
|
|
4475
|
-
case 0: return [4 /*yield*/, graphQLRequest("\n mutation quoteSubscriptionUpdate(\n $subscriptionIds: [ID!]!,\n ) {\n quoteSubscriptionUpdate(\n subscriptionIds: $subscriptionIds,\n ) {\n quote {\n id\n quoteChanges {\n id\n priceList {\n id\n }\n charges {\n id\n priceListCharge {\n id\n }\n }\n }\n }\n }\n }\n ", token, {
|
|
4476
|
-
subscriptionIds: subscriptionIds,
|
|
4344
|
+
query: MUTATION$1,
|
|
4345
|
+
token: token,
|
|
4346
|
+
vars: { tenantCode: tenantCode, expiry: expiry, returnUrl: returnUrl },
|
|
4347
|
+
apiHost: apiHost,
|
|
4477
4348
|
})];
|
|
4478
4349
|
case 1:
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
};
|
|
4485
|
-
var useQuoteChangeUpdate = function () {
|
|
4486
|
-
var graphQLRequest = useGraphQLRequest();
|
|
4487
|
-
return function (charges, quoteChangeId, token) { return __awaiter(void 0, void 0, void 0, function () {
|
|
4488
|
-
var response;
|
|
4489
|
-
return __generator(this, function (_a) {
|
|
4490
|
-
switch (_a.label) {
|
|
4491
|
-
case 0: return [4 /*yield*/, graphQLRequest("mutation QuoteChangeUpdate($charges:[QuoteChargeAttributes!], $id:ID!) {\n quoteChangeUpdate(id:$id, charges:$charges) {\n quoteChange { id quoteId }\n errors\n }\n }", token, { charges: charges, id: quoteChangeId })];
|
|
4492
|
-
case 1:
|
|
4493
|
-
response = _a.sent();
|
|
4494
|
-
return [2 /*return*/, response];
|
|
4495
|
-
}
|
|
4496
|
-
});
|
|
4497
|
-
}); };
|
|
4498
|
-
};
|
|
4499
|
-
var useQuoteDelete = function () {
|
|
4500
|
-
var graphQLRequest = useGraphQLRequest();
|
|
4501
|
-
return function (quoteId, token) { return __awaiter(void 0, void 0, void 0, function () {
|
|
4502
|
-
var response;
|
|
4503
|
-
return __generator(this, function (_a) {
|
|
4504
|
-
switch (_a.label) {
|
|
4505
|
-
case 0: return [4 /*yield*/, graphQLRequest("mutation QuoteDelete($id: ID!) {\n quoteDelete(id: $id) {\n errors\n }\n }", token, { id: quoteId })];
|
|
4506
|
-
case 1:
|
|
4507
|
-
response = _a.sent();
|
|
4508
|
-
return [2 /*return*/, response];
|
|
4350
|
+
response = _c.sent();
|
|
4351
|
+
errors = (response === null || response === void 0 ? void 0 : response.portalSessionCreate).errors;
|
|
4352
|
+
if (errors)
|
|
4353
|
+
throw errors;
|
|
4354
|
+
return [2 /*return*/, (_b = response === null || response === void 0 ? void 0 : response.portalSessionCreate) === null || _b === void 0 ? void 0 : _b.token];
|
|
4509
4355
|
}
|
|
4510
4356
|
});
|
|
4511
|
-
});
|
|
4357
|
+
});
|
|
4512
4358
|
};
|
|
4513
4359
|
|
|
4514
|
-
var
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
var token = React.useContext(BunnyContext).token;
|
|
4518
|
-
// Recoil state
|
|
4519
|
-
var _b = recoil.useRecoilState(updatingChargeQuantityIdState), updatingChargeQuantityId = _b[0], setUpdatingChargeQuantityId = _b[1];
|
|
4520
|
-
// Local state
|
|
4521
|
-
var _c = React.useState(), editedSubscription = _c[0], setEditedSubscription = _c[1];
|
|
4360
|
+
var showErrorNotification = common.useErrorNotification();
|
|
4361
|
+
function Signup(_a) {
|
|
4362
|
+
var companyName = _a.companyName, entityId = _a.entityId, priceListCode = _a.priceListCode, returnUrl = _a.returnUrl;
|
|
4522
4363
|
// Hooks
|
|
4523
|
-
var
|
|
4524
|
-
var
|
|
4525
|
-
var
|
|
4526
|
-
var
|
|
4527
|
-
var
|
|
4528
|
-
var
|
|
4529
|
-
var
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
var
|
|
4536
|
-
|
|
4537
|
-
:
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4364
|
+
var _b = React.useContext(BunnyContext), apiHost = _b.apiHost, token = _b.token, window = _b.window;
|
|
4365
|
+
var isMobile = common.useIsMobile(window);
|
|
4366
|
+
var topNavImageUrl = React.useContext(BrandContext).topNavImageUrl;
|
|
4367
|
+
var _c = React.useState(undefined), quote = _c[0], setQuote = _c[1];
|
|
4368
|
+
var _d = React.useState(undefined), accountId = _d[0], setAccountId = _d[1];
|
|
4369
|
+
var _e = React.useState(undefined), quoteId = _e[0], setQuoteId = _e[1];
|
|
4370
|
+
var _f = React.useState(undefined), portalSessionToken = _f[0], setPortalSessionToken = _f[1];
|
|
4371
|
+
var _g = React.useState(undefined), formData = _g[0], setFormData = _g[1];
|
|
4372
|
+
var _h = React.useState(false), proceedingToPayment = _h[0], setProceedingToPayment = _h[1];
|
|
4373
|
+
var _j = React.useState(false), paying = _j[0], setIsPaying = _j[1];
|
|
4374
|
+
var _k = React.useState(false), purchaseSucceeded = _k[0], setPurchaseSucceeded = _k[1];
|
|
4375
|
+
// Queries
|
|
4376
|
+
var priceListData = reactQuery.useQuery({
|
|
4377
|
+
queryKey: ["priceList", priceListCode],
|
|
4378
|
+
queryFn: function () { return getPriceList({ token: token, apiHost: apiHost, code: priceListCode }); },
|
|
4379
|
+
}).data;
|
|
4380
|
+
function handleSubmit(formData) {
|
|
4381
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4382
|
+
var data, portalSessionToken;
|
|
4383
|
+
return __generator(this, function (_a) {
|
|
4384
|
+
switch (_a.label) {
|
|
4385
|
+
case 0:
|
|
4386
|
+
setProceedingToPayment(true);
|
|
4387
|
+
setFormData(formData);
|
|
4388
|
+
return [4 /*yield*/, quoteAccountSignup({
|
|
4389
|
+
token: token,
|
|
4390
|
+
apiHost: apiHost,
|
|
4391
|
+
entityId: entityId,
|
|
4392
|
+
priceListCode: priceListCode,
|
|
4393
|
+
accountName: formData.accountName,
|
|
4394
|
+
billingContact: {
|
|
4395
|
+
firstName: formData.firstName,
|
|
4396
|
+
lastName: formData.lastName,
|
|
4397
|
+
email: formData.email,
|
|
4398
|
+
},
|
|
4399
|
+
})];
|
|
4400
|
+
case 1:
|
|
4401
|
+
data = _a.sent();
|
|
4402
|
+
setAccountId(data.account.id);
|
|
4403
|
+
return [4 /*yield*/, portalSessionCreate({
|
|
4404
|
+
token: token,
|
|
4405
|
+
apiHost: apiHost,
|
|
4406
|
+
tenantCode: data.tenant.code,
|
|
4407
|
+
expiry: 24,
|
|
4408
|
+
returnUrl: returnUrl || "",
|
|
4409
|
+
})];
|
|
4410
|
+
case 2:
|
|
4411
|
+
portalSessionToken = _a.sent();
|
|
4412
|
+
setPortalSessionToken(portalSessionToken);
|
|
4413
|
+
setQuoteId(data.quote.id);
|
|
4414
|
+
setProceedingToPayment(false);
|
|
4415
|
+
setQuote({
|
|
4416
|
+
amountDue: data.quote.amountDue,
|
|
4417
|
+
currencyId: data.quote.currencyId,
|
|
4418
|
+
});
|
|
4419
|
+
return [2 /*return*/];
|
|
4420
|
+
}
|
|
4573
4421
|
});
|
|
4574
|
-
},
|
|
4575
|
-
});
|
|
4576
|
-
// Handlers
|
|
4577
|
-
var isQuantityLowerThanOriginal = function (quantity) {
|
|
4578
|
-
return (editedSubscription === null || editedSubscription === void 0 ? void 0 : editedSubscription.quantity) !== undefined &&
|
|
4579
|
-
editedSubscription.quantity <= quantity;
|
|
4580
|
-
};
|
|
4581
|
-
var onChangeQuantity = function (chargeIndex, value, priceListChargeId, subscription, subscriptionIndex) {
|
|
4582
|
-
var quantity = isNaN(parseInt(value)) ? 0 : parseInt(value);
|
|
4583
|
-
setEditedSubscription({
|
|
4584
|
-
chargeIndex: chargeIndex,
|
|
4585
|
-
subscriptionIndex: subscriptionIndex,
|
|
4586
|
-
chargeId: priceListChargeId,
|
|
4587
|
-
quantity: quantity,
|
|
4588
|
-
subscription: subscription,
|
|
4589
4422
|
});
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
|
|
4605
|
-
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
|
|
4609
|
-
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
|
|
4616
|
-
|
|
4617
|
-
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
|
|
4627
|
-
}
|
|
4628
|
-
};
|
|
4629
|
-
// Initial subscription quantity if is on mobile
|
|
4630
|
-
React.useEffect(function () {
|
|
4631
|
-
if (isMobile && !editedSubscription && !quantityDisabled) {
|
|
4632
|
-
setEditedSubscription({
|
|
4633
|
-
chargeIndex: chargeIndex,
|
|
4634
|
-
subscriptionIndex: subscriptionIndex,
|
|
4635
|
-
chargeId: charge.priceListChargeId,
|
|
4636
|
-
quantity: charge.quantity,
|
|
4637
|
-
subscription: subscription,
|
|
4638
|
-
});
|
|
4639
|
-
}
|
|
4640
|
-
}, [
|
|
4641
|
-
charge,
|
|
4642
|
-
chargeIndex,
|
|
4643
|
-
editedSubscription,
|
|
4644
|
-
isMobile,
|
|
4645
|
-
quantityDisabled,
|
|
4646
|
-
subscription,
|
|
4647
|
-
subscriptionIndex,
|
|
4648
|
-
]);
|
|
4649
|
-
// Edit subscription debounce
|
|
4650
|
-
React.useEffect(function () {
|
|
4651
|
-
var debounce = setTimeout(function () {
|
|
4652
|
-
handleSubscriptionUpdate(editedSubscription);
|
|
4653
|
-
}, 1000);
|
|
4654
|
-
return function () { return clearTimeout(debounce); };
|
|
4655
|
-
// eslint-disable-next-line
|
|
4656
|
-
}, [editedSubscription]);
|
|
4657
|
-
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx(antd.Input, { className: "text-right", disabled: quantityDisabled, onBlur: function () {
|
|
4658
|
-
if (typeof value === "number" && value < charge.quantity) {
|
|
4659
|
-
showErrorNotification("New value is less than the original quantity. This is not allowed");
|
|
4423
|
+
}
|
|
4424
|
+
function handlePaymentSaveSuccess(paymentSuccess) {
|
|
4425
|
+
var _a;
|
|
4426
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4427
|
+
var response, plugin;
|
|
4428
|
+
return __generator(this, function (_b) {
|
|
4429
|
+
switch (_b.label) {
|
|
4430
|
+
case 0:
|
|
4431
|
+
if (!formData) {
|
|
4432
|
+
throw new Error("Form data is required");
|
|
4433
|
+
}
|
|
4434
|
+
response = paymentSuccess.pluginPaymentResponse;
|
|
4435
|
+
plugin = response === null || response === void 0 ? void 0 : response.plugin;
|
|
4436
|
+
if (!(plugin === null || plugin === void 0 ? void 0 : plugin.id)) {
|
|
4437
|
+
throw new Error("Plugin ID is required");
|
|
4438
|
+
}
|
|
4439
|
+
if (!accountId) {
|
|
4440
|
+
throw new Error("Account ID is required");
|
|
4441
|
+
}
|
|
4442
|
+
if (!portalSessionToken) {
|
|
4443
|
+
throw new Error("Portal session token is required");
|
|
4444
|
+
}
|
|
4445
|
+
return [4 /*yield*/, accountSignup({
|
|
4446
|
+
token: portalSessionToken,
|
|
4447
|
+
apiHost: apiHost,
|
|
4448
|
+
entityId: entityId,
|
|
4449
|
+
quoteId: quoteId,
|
|
4450
|
+
paymentMethodId: (_a = paymentSuccess.savedPaymentMethodResponse) === null || _a === void 0 ? void 0 : _a.paymentMethodId.toString(),
|
|
4451
|
+
pluginId: plugin.id.toString(),
|
|
4452
|
+
priceListCode: priceListCode,
|
|
4453
|
+
accountId: accountId,
|
|
4454
|
+
})];
|
|
4455
|
+
case 1:
|
|
4456
|
+
_b.sent();
|
|
4457
|
+
setIsPaying(false);
|
|
4458
|
+
setPurchaseSucceeded(true);
|
|
4459
|
+
return [2 /*return*/];
|
|
4660
4460
|
}
|
|
4661
|
-
}
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
};
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
var children = _a.children, right = _a.right;
|
|
4676
|
-
return (jsxRuntime.jsx("div", __assign({ className: "font-medium text-slate-600 ".concat(right ? "text-right" : "text-left"), style: { fontSize: "11px" } }, { children: children })));
|
|
4677
|
-
};
|
|
4678
|
-
|
|
4679
|
-
var QuoteChangeSummarySection = function (_a) {
|
|
4680
|
-
var editingQuote = _a.editingQuote, editingQuoteData = _a.editingQuoteData, openCheckout = _a.openCheckout, setEditingQuoteData = _a.setEditingQuoteData;
|
|
4681
|
-
var isMobile = common.useIsMobile();
|
|
4682
|
-
var token = React.useContext(BunnyContext).token;
|
|
4683
|
-
var showSuccessNotification = common.NotificationUtils.useSuccessNotification();
|
|
4684
|
-
var trialUpgradeMutation = reactQuery.useMutation({
|
|
4685
|
-
mutationFn: function (quoteId) { return checkout({ quoteId: quoteId, token: token }); },
|
|
4686
|
-
onSuccess: function () {
|
|
4687
|
-
setEditingQuoteData(undefined);
|
|
4688
|
-
showSuccessNotification("Subscription updated successfully");
|
|
4689
|
-
},
|
|
4690
|
-
});
|
|
4691
|
-
return (jsxRuntime.jsxs("div", __assign({ className: "flex flex-col items-end" }, { children: [editingQuote && (jsxRuntime.jsxs("div", __assign({ className: "flex flex-col mb-8" }, { children: [jsxRuntime.jsx("div", __assign({ className: "text-slate-500 text-right text-xs mb-2" }, { children: "TOTAL" })), jsxRuntime.jsx("div", __assign({ className: "text-right ".concat(isMobile ? "text-2xl" : "text-xl") }, { children: common.Misc.formatCurrency(getQuoteAmountDue(editingQuote), (editingQuote === null || editingQuote === void 0 ? void 0 : editingQuote.currencyId) || "") }))] }))), jsxRuntime.jsx("div", __assign({ className: "flex items-center justify-end ".concat(isMobile ? "w-full" : "") }, { children: jsxRuntime.jsx(antd.Button, __assign({ className: "w-full", onClick: (editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.isTrial)
|
|
4692
|
-
? function () { return trialUpgradeMutation.mutate(editingQuoteData.id); }
|
|
4693
|
-
: openCheckout, disabled: !editingQuoteData, size: isMobile ? "large" : "middle", type: "primary" }, { children: (editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.isTrial) ? "Activate Trial" : "Proceed to checkout" })) }))] })));
|
|
4694
|
-
};
|
|
4695
|
-
|
|
4696
|
-
var QUANTITY_CHANGE_HEADER_TITLE = "Update unit quantity";
|
|
4697
|
-
var QUANTITY_CHANGE_HEADER_DESCRIPTION = "Adjust quantities below. The change will take effect immediately after checkout has been completed.";
|
|
4698
|
-
var QuantityChangeDrawerDesktop = function (_a) {
|
|
4699
|
-
var editingQuote = _a.editingQuote, editingQuoteData = _a.editingQuoteData, onClose = _a.onClose, open = _a.open, openCheckout = _a.openCheckout, setEditingQuoteData = _a.setEditingQuoteData, subscriptions = _a.subscriptions;
|
|
4700
|
-
var _b = React.useState(open), openLocal = _b[0], setOpenLocal = _b[1];
|
|
4701
|
-
var isMobile = common.useIsMobile();
|
|
4702
|
-
React.useEffect(function () {
|
|
4703
|
-
var timeoutId;
|
|
4704
|
-
if (!open) {
|
|
4705
|
-
timeoutId = setTimeout(function () {
|
|
4706
|
-
setOpenLocal(false);
|
|
4707
|
-
}, 300); // Delay to allow for close animation
|
|
4708
|
-
}
|
|
4709
|
-
else {
|
|
4710
|
-
setOpenLocal(true);
|
|
4711
|
-
}
|
|
4712
|
-
return function () { return clearTimeout(timeoutId); };
|
|
4713
|
-
}, [open]);
|
|
4714
|
-
if (!openLocal)
|
|
4715
|
-
return null;
|
|
4716
|
-
return (jsxRuntime.jsxs(antd.Drawer, __assign({ closeIcon: null, destroyOnClose: true, onClose: onClose, open: open, styles: isMobile
|
|
4717
|
-
? {
|
|
4718
|
-
body: {
|
|
4719
|
-
padding: "1rem",
|
|
4720
|
-
overflow: "hidden",
|
|
4721
|
-
background: common.SLATE_50,
|
|
4722
|
-
},
|
|
4723
|
-
wrapper: {
|
|
4724
|
-
width: "100vw",
|
|
4725
|
-
},
|
|
4726
|
-
}
|
|
4727
|
-
: {
|
|
4728
|
-
wrapper: {
|
|
4729
|
-
minWidth: "600px",
|
|
4730
|
-
},
|
|
4731
|
-
}, title: jsxRuntime.jsx(DrawerHeader, { description: QUANTITY_CHANGE_HEADER_DESCRIPTION, onClose: onClose, title: QUANTITY_CHANGE_HEADER_TITLE }) }, { children: [jsxRuntime.jsxs("div", __assign({ className: "grid pb-4", style: {
|
|
4732
|
-
gridTemplateColumns: "2fr 1fr 1fr",
|
|
4733
|
-
rowGap: "0.75rem",
|
|
4734
|
-
columnGap: "1rem",
|
|
4735
|
-
} }, { children: [jsxRuntime.jsx(QuantityChangeGridTitle, { children: "ACTIVE SUBSCRIPTIONS" }), jsxRuntime.jsx(QuantityChangeGridTitle, __assign({ right: true }, { children: "CURRENT QUANTITY" })), jsxRuntime.jsx(QuantityChangeGridTitle, __assign({ right: true }, { children: "NEW QUANTITY" })), jsxRuntime.jsx(antd.Divider, { className: "col-span-full py-2" }), subscriptions.map(function (subscription, index) {
|
|
4736
|
-
var _a;
|
|
4737
|
-
var isTrial = ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === common.SubscriptionState.TRIAL;
|
|
4738
|
-
return (jsxRuntime.jsx("div", __assign({ className: "contents" }, { children: subscription.charges.map(function (charge, chargeIndex) {
|
|
4739
|
-
if ((isTrial && !charge.trial) || (!isTrial && charge.trial))
|
|
4740
|
-
return null;
|
|
4741
|
-
return (jsxRuntime.jsx(QuantityChangeGridRow, { chargeIndex: chargeIndex, editingQuote: editingQuote, setEditingQuoteData: setEditingQuoteData, subscription: subscription, subscriptionCharge: charge, subscriptionIndex: index, subscriptions: subscriptions }, chargeIndex));
|
|
4742
|
-
}) }), index));
|
|
4743
|
-
})] })), jsxRuntime.jsx(QuoteChangeSummarySection, { editingQuote: editingQuote, editingQuoteData: editingQuoteData, openCheckout: openCheckout, setEditingQuoteData: setEditingQuoteData })] })));
|
|
4744
|
-
};
|
|
4461
|
+
});
|
|
4462
|
+
});
|
|
4463
|
+
}
|
|
4464
|
+
function handlePaymentFail(error) {
|
|
4465
|
+
showErrorNotification(error.message);
|
|
4466
|
+
setIsPaying(false);
|
|
4467
|
+
}
|
|
4468
|
+
if (isMobile) {
|
|
4469
|
+
return (jsxRuntime.jsx(Card, __assign({ className: "p-4 flex flex-col" }, { children: purchaseSucceeded ? (jsxRuntime.jsx(PaymentSuccessDisplay, { amountPaid: (quote === null || quote === void 0 ? void 0 : quote.amountDue) || 0, className: "w-full", companyName: companyName, returnUrl: returnUrl })) : (jsxRuntime.jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col" : "flex-row", " h-full w-full") }, { children: [jsxRuntime.jsx("div", __assign({ className: "flex flex-col items-center" }, { children: jsxRuntime.jsx(PriceListDisplay, { priceListData: priceListData, topNavImageUrl: topNavImageUrl }) })), jsxRuntime.jsx("div", __assign({ className: "mx-8" }, { children: jsxRuntime.jsx(antd.Divider, { className: "h-full" }) })), jsxRuntime.jsx("div", __assign({ className: "flex items-center justify-center my-12" }, { children: jsxRuntime.jsx(PaymentForms, { entityId: entityId, quote: quote, paying: paying, setIsPaying: setIsPaying, handlePaymentSaveSuccess: handlePaymentSaveSuccess, handlePaymentFail: handlePaymentFail, handleSubmit: handleSubmit, proceedingToPayment: proceedingToPayment, accountId: accountId || "" }) }))] }))) })));
|
|
4470
|
+
}
|
|
4471
|
+
else {
|
|
4472
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx(Card, __assign({ className: "p-4 flex flex-col w-screen h-screen" }, { children: purchaseSucceeded ? (jsxRuntime.jsx(PaymentSuccessDisplay, { amountPaid: (quote === null || quote === void 0 ? void 0 : quote.amountDue) || 0, className: "w-full", companyName: companyName, returnUrl: returnUrl })) : (jsxRuntime.jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col" : "flex-row", " h-full w-full") }, { children: [jsxRuntime.jsx("div", __assign({ className: "flex flex-col w-1/2 items-center" }, { children: jsxRuntime.jsx(PriceListDisplay, { priceListData: priceListData, topNavImageUrl: topNavImageUrl }) })), jsxRuntime.jsx("div", __assign({ className: "my-4" }, { children: jsxRuntime.jsx(antd.Divider, { className: "h-full", type: "vertical" }) })), jsxRuntime.jsx("div", __assign({ className: "flex w-1/2 items-center justify-center my-12" }, { children: jsxRuntime.jsx(PaymentForms, { entityId: entityId, quote: quote, paying: paying, setIsPaying: setIsPaying, handlePaymentSaveSuccess: handlePaymentSaveSuccess, handlePaymentFail: handlePaymentFail, handleSubmit: handleSubmit, proceedingToPayment: proceedingToPayment, accountId: accountId || "" }) }))] }))) })) }));
|
|
4473
|
+
}
|
|
4474
|
+
}
|
|
4745
4475
|
|
|
4746
4476
|
// WARNING: There is a preview button on APP that will need to be changed if this query is changed
|
|
4747
4477
|
var PLAN_CHANGE_OPTIONS_QUERY = "\n query planChangeOptions($subscriptionId: ID) {\n planChangeOptions(subscriptionId: $subscriptionId) {\n products {\n everythingInPlus\n id\n name\n features(sort: \"position asc\") {\n description\n id\n isVisible\n kind\n name\n position\n }\n }\n plans {\n code\n contactUsLabel\n contactUsUrl\n description\n id\n name\n position\n pricingDescription\n pricingStyle\n planFeatures {\n featureId\n value\n feature {\n name\n }\n }\n priceLists {\n basePrice\n id\n currencyId\n periodMonths\n plan {\n id\n position\n }\n product {\n id\n }\n charges {\n basePrice\n billingPeriod\n chargeType\n id\n name\n priceDecimals\n pricingModel\n quantityMax\n quantityMin\n selfServiceQuantity\n feature {\n name\n unitName\n }\n }\n }\n productId\n }\n }\n }";
|
|
4748
4478
|
var getPlanChangeOptions = function (_a) {
|
|
4749
|
-
var isInPreviewMode = _a.isInPreviewMode, token = _a.token, upgradingSubscription = _a.upgradingSubscription,
|
|
4479
|
+
var isInPreviewMode = _a.isInPreviewMode, token = _a.token, upgradingSubscription = _a.upgradingSubscription, apiHost = _a.apiHost;
|
|
4750
4480
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
4751
4481
|
var response, planChangeOptions;
|
|
4752
4482
|
return __generator(this, function (_b) {
|
|
@@ -4756,7 +4486,7 @@ var getPlanChangeOptions = function (_a) {
|
|
|
4756
4486
|
query: PLAN_CHANGE_OPTIONS_QUERY,
|
|
4757
4487
|
vars: { subscriptionId: upgradingSubscription === null || upgradingSubscription === void 0 ? void 0 : upgradingSubscription.id },
|
|
4758
4488
|
token: token,
|
|
4759
|
-
|
|
4489
|
+
apiHost: apiHost,
|
|
4760
4490
|
})];
|
|
4761
4491
|
case 1:
|
|
4762
4492
|
response = _b.sent();
|
|
@@ -4775,7 +4505,7 @@ var getPlanChangeOptions = function (_a) {
|
|
|
4775
4505
|
|
|
4776
4506
|
var QUOTE_QUERY = function () { return "\n query quote($id: ID) {\n quote(id: $id) {\n accountId\n amount\n amountDue\n smallUnitAmountDue\n currencyId\n formattedQuote {\n html\n }\n id\n payableId\n periodAmount\n subtotal\n taxAmount\n amountsByPeriod {\n amount\n startDate\n }\n quoteChanges {\n currencyId\n id\n charges {\n amountsByPeriod {\n amount\n startDate\n }\n amount\n billingPeriod\n currencyId\n feature {\n unitName\n }\n id\n name\n priceListCharge {\n id\n }\n quantity\n }\n priceList {\n id\n plan {\n name\n }\n product {\n name\n }\n }\n\n }\n }\n }"; };
|
|
4777
4507
|
var getQuote = function (_a) {
|
|
4778
|
-
var id = _a.id, token = _a.token,
|
|
4508
|
+
var id = _a.id, token = _a.token, apiHost = _a.apiHost;
|
|
4779
4509
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
4780
4510
|
var response;
|
|
4781
4511
|
return __generator(this, function (_b) {
|
|
@@ -4784,7 +4514,7 @@ var getQuote = function (_a) {
|
|
|
4784
4514
|
query: QUOTE_QUERY(),
|
|
4785
4515
|
token: token,
|
|
4786
4516
|
vars: { id: id },
|
|
4787
|
-
|
|
4517
|
+
apiHost: apiHost,
|
|
4788
4518
|
})];
|
|
4789
4519
|
case 1:
|
|
4790
4520
|
response = _b.sent();
|
|
@@ -4796,7 +4526,7 @@ var getQuote = function (_a) {
|
|
|
4796
4526
|
|
|
4797
4527
|
var SUBSCRIPTIONS_QUERY = "query subscriptions {\n subscriptions {\n nodes {\n cancellationDate\n currencyId\n endDate\n evergreen\n id\n period\n plan { id name selfServiceBuy selfServiceCancel selfServiceRenew }\n priceList { id periodMonths }\n product { id name showProductNameOnLineItem }\n startDate\n state\n trialEndDate\n trialPeriod\n trialStartDate\n charges {\n priceListCharge {\n priceListChargeTiers {\n price\n starts\n }\n }\n amount\n billingPeriod\n chargeType\n discount\n discountedPrice\n endDate\n expired\n feature { name }\n id\n isRamp\n name\n periodPrice\n price\n priceDecimals\n priceListChargeId\n priceTiers { starts price }\n pricingModel\n quantity\n selfServiceQuantity\n startDate\n trial\n }\n }\n }\n }";
|
|
4798
4528
|
var getSubscriptions = function (_a) {
|
|
4799
|
-
var entityId = _a.entityId, isInPreviewMode = _a.isInPreviewMode, token = _a.token,
|
|
4529
|
+
var entityId = _a.entityId, isInPreviewMode = _a.isInPreviewMode, token = _a.token, apiHost = _a.apiHost;
|
|
4800
4530
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
4801
4531
|
var response;
|
|
4802
4532
|
var _b;
|
|
@@ -4807,7 +4537,7 @@ var getSubscriptions = function (_a) {
|
|
|
4807
4537
|
query: SUBSCRIPTIONS_QUERY,
|
|
4808
4538
|
token: token,
|
|
4809
4539
|
vars: { entityId: entityId },
|
|
4810
|
-
|
|
4540
|
+
apiHost: apiHost,
|
|
4811
4541
|
})];
|
|
4812
4542
|
case 1:
|
|
4813
4543
|
response = _c.sent();
|
|
@@ -4877,7 +4607,7 @@ var ErrorView = function (_a) {
|
|
|
4877
4607
|
var Text$3 = antd.Typography.Text;
|
|
4878
4608
|
var HideExpiredToggle = function (_a) {
|
|
4879
4609
|
var hideExpired = _a.hideExpired, setHideExpired = _a.setHideExpired, subscriptions = _a.subscriptions;
|
|
4880
|
-
var isMobile = common.useIsMobile();
|
|
4610
|
+
var isMobile = common.useIsMobile(window);
|
|
4881
4611
|
var secondaryColor = React.useContext(BrandContext).secondaryColor;
|
|
4882
4612
|
var hasExpiredOrCanceledSubscriptions = subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.some(function (subscription) {
|
|
4883
4613
|
var _a, _b;
|
|
@@ -4893,6 +4623,42 @@ var HideExpiredToggle = function (_a) {
|
|
|
4893
4623
|
var StyledCheckbox = styled__default["default"].div(templateObject_1$2 || (templateObject_1$2 = __makeTemplateObject(["\n .ant-checkbox-wrapper span {\n padding-inline-end: 0 !important;\n }\n"], ["\n .ant-checkbox-wrapper span {\n padding-inline-end: 0 !important;\n }\n"])));
|
|
4894
4624
|
var templateObject_1$2;
|
|
4895
4625
|
|
|
4626
|
+
// import { EditingSubscriptionType } from "../../../features/quantityChangeDrawer/QuantityInput";
|
|
4627
|
+
var canShowQuantitiesInput = function (charge, subscription) {
|
|
4628
|
+
// Check if the subscription is active, pending, or in trial,
|
|
4629
|
+
// the pricing model is not flat,
|
|
4630
|
+
// and if it's not a trial, also check if the current charge is the last one in the subscription.
|
|
4631
|
+
var _a, _b, _c;
|
|
4632
|
+
var isActiveSubscription = ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === common.SubscriptionState.ACTIVE;
|
|
4633
|
+
var isPendingSubscription = ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === common.SubscriptionState.PENDING;
|
|
4634
|
+
var isTrialSubscription = ((_c = subscription.state) === null || _c === void 0 ? void 0 : _c.toUpperCase()) === common.SubscriptionState.TRIAL;
|
|
4635
|
+
var isFlatPricing = charge.pricingModel === "FLAT";
|
|
4636
|
+
var shouldProcessCharge = (isActiveSubscription || isPendingSubscription || isTrialSubscription) &&
|
|
4637
|
+
!isFlatPricing &&
|
|
4638
|
+
charge.selfServiceQuantity &&
|
|
4639
|
+
!charge.expired;
|
|
4640
|
+
// Now you can use the value of shouldProcessCharge to determine whether to process the charge.
|
|
4641
|
+
return shouldProcessCharge;
|
|
4642
|
+
};
|
|
4643
|
+
var canShowChangeQuantities = function (_a) {
|
|
4644
|
+
var subscriptions = _a.subscriptions;
|
|
4645
|
+
return subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.some(function (subscription) {
|
|
4646
|
+
return subscription.charges.some(function (charge, chargeIndex) {
|
|
4647
|
+
return canShowQuantitiesInput(charge, subscription);
|
|
4648
|
+
});
|
|
4649
|
+
});
|
|
4650
|
+
};
|
|
4651
|
+
var isSubscriptionNotActive = function (subscription) {
|
|
4652
|
+
var _a, _b;
|
|
4653
|
+
return ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === common.SubscriptionState.EXPIRED ||
|
|
4654
|
+
((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === common.SubscriptionState.CANCELED;
|
|
4655
|
+
};
|
|
4656
|
+
var canShowSubscriptionActions = function (subscription) {
|
|
4657
|
+
var _a, _b;
|
|
4658
|
+
return ((_a = subscription.state) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === common.SubscriptionState.ACTIVE ||
|
|
4659
|
+
((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === common.SubscriptionState.PENDING;
|
|
4660
|
+
};
|
|
4661
|
+
|
|
4896
4662
|
var SubscriptionState;
|
|
4897
4663
|
(function (SubscriptionState) {
|
|
4898
4664
|
SubscriptionState["ACTIVE"] = "ACTIVE";
|
|
@@ -4905,7 +4671,7 @@ var SubscriptionState$1 = SubscriptionState;
|
|
|
4905
4671
|
|
|
4906
4672
|
var FEATURE_USAGE_MUTATION = "\nquery GetFeatureUsage($id: ID!) {\n featureUsageHistogram(subscriptionChargeId: $id) {\n subscriptionCharge { \n id\n name\n amount\n currentPeriodPriceByTiers { \n tier { starts price } \n quantity\n amount\n }\n }\n feature { id name }\n periodRange\n dataInterval\n data {\n periodStart\n periodEnd\n intervals {\n intervalStart\n intervalUsage\n }\n intervalsTotal\n }\n }\n}\n";
|
|
4907
4673
|
var getFeatureUsage = function (_a) {
|
|
4908
|
-
var subscriptionChargeId = _a.subscriptionChargeId; _a.startDate; _a.endDate; _a.dataInterval; var token = _a.token;
|
|
4674
|
+
var subscriptionChargeId = _a.subscriptionChargeId; _a.startDate; _a.endDate; _a.dataInterval; var token = _a.token, apiHost = _a.apiHost;
|
|
4909
4675
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
4910
4676
|
var vars, response;
|
|
4911
4677
|
var _b;
|
|
@@ -4919,6 +4685,7 @@ var getFeatureUsage = function (_a) {
|
|
|
4919
4685
|
query: FEATURE_USAGE_MUTATION,
|
|
4920
4686
|
token: token,
|
|
4921
4687
|
vars: vars,
|
|
4688
|
+
apiHost: apiHost,
|
|
4922
4689
|
})];
|
|
4923
4690
|
case 1:
|
|
4924
4691
|
response = _c.sent();
|
|
@@ -5057,7 +4824,7 @@ var FeatureUsageGraph = function (_a) {
|
|
|
5057
4824
|
}
|
|
5058
4825
|
return false;
|
|
5059
4826
|
}))
|
|
5060
|
-
return "no usage";
|
|
4827
|
+
return jsxRuntime.jsx("div", { children: "no usage" });
|
|
5061
4828
|
return (jsxRuntime.jsxs("div", __assign({ onClick: function () {
|
|
5062
4829
|
setIsModalOpen(true);
|
|
5063
4830
|
} }, { children: [jsxRuntime.jsx("div", __assign({ style: {
|
|
@@ -5089,7 +4856,7 @@ var templateObject_1;
|
|
|
5089
4856
|
|
|
5090
4857
|
var MUTATION = "\nmutation quoteSubscriptionReinstate($ids: [ID!]!) {\n quoteSubscriptionReinstate(ids: $ids) {\n quote {\n id\n uuid\n accountId\n dealId\n name\n amount\n taxAmount\n discount\n netPaymentDays\n acceptedByName\n acceptedByTitle\n state\n billingDay\n evergreen\n requiresApproval\n isPendingApprovalRequest\n poNumber\n kind\n currencyId\n ownerId\n contactId\n quoteChanges {\n id\n priceListId\n charges {\n id\n pricingModel\n chargeType\n billingPeriod\n price\n priceDecimals\n tieredAveragePrice\n quantity\n quantityMin\n quantityMax\n discount\n amount\n prorationRate\n name\n invoiceLineText\n createdAt\n updatedAt\n startDate\n endDate\n billingPeriodAmounts { id amount prorationRate }\n currencyId\n couponId\n feature { id name code isUnit unitName }\n priceTiers { starts price }\n }\n }\n expiresAt\n createdAt\n updatedAt\n startDate\n endDate\n invoiceUntil\n applicationDate\n applied\n endDateOptions {\n endDate\n label\n }\n invoiceUntilOptions {\n endDate\n label\n }\n notes\n message\n amountsByPeriod {\n id\n name\n amount\n }\n subtotal\n credits\n discountValue\n }\n }\n}\n";
|
|
5091
4858
|
var getGuoteSubscriptionReinstate = function (_a) {
|
|
5092
|
-
var ids = _a.ids, token = _a.token,
|
|
4859
|
+
var ids = _a.ids, token = _a.token, apiHost = _a.apiHost;
|
|
5093
4860
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
5094
4861
|
var vars, response, _b, errors, quote;
|
|
5095
4862
|
return __generator(this, function (_c) {
|
|
@@ -5100,7 +4867,7 @@ var getGuoteSubscriptionReinstate = function (_a) {
|
|
|
5100
4867
|
query: MUTATION,
|
|
5101
4868
|
token: token,
|
|
5102
4869
|
vars: vars,
|
|
5103
|
-
|
|
4870
|
+
apiHost: apiHost,
|
|
5104
4871
|
})];
|
|
5105
4872
|
case 1:
|
|
5106
4873
|
response = _c.sent();
|
|
@@ -5113,32 +4880,16 @@ var getGuoteSubscriptionReinstate = function (_a) {
|
|
|
5113
4880
|
});
|
|
5114
4881
|
};
|
|
5115
4882
|
|
|
5116
|
-
var useCancelSubscription = function () {
|
|
5117
|
-
var graphQLRequest = useGraphQLRequest();
|
|
5118
|
-
return function (subscriptionIds, token) { return __awaiter(void 0, void 0, void 0, function () {
|
|
5119
|
-
var data;
|
|
5120
|
-
var _a;
|
|
5121
|
-
return __generator(this, function (_b) {
|
|
5122
|
-
switch (_b.label) {
|
|
5123
|
-
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 })];
|
|
5124
|
-
case 1:
|
|
5125
|
-
data = _b.sent();
|
|
5126
|
-
return [2 /*return*/, (_a = data === null || data === void 0 ? void 0 : data.subscriptions) === null || _a === void 0 ? void 0 : _a.nodes];
|
|
5127
|
-
}
|
|
5128
|
-
});
|
|
5129
|
-
}); };
|
|
5130
|
-
};
|
|
5131
|
-
|
|
5132
4883
|
var SubscriptionCardActions = function (_a) {
|
|
5133
4884
|
var _b, _c;
|
|
5134
4885
|
var planChangeOptions = _a.planChangeOptions, subscription = _a.subscription, setEditingQuoteData = _a.setEditingQuoteData, setPayModalVisible = _a.setPayModalVisible;
|
|
5135
4886
|
// Context
|
|
5136
|
-
var _d = React.useContext(BunnyContext), token = _d.token,
|
|
4887
|
+
var _d = React.useContext(BunnyContext), token = _d.token, apiHost = _d.apiHost;
|
|
5137
4888
|
var _e = React.useContext(SubscriptionsContext), onChangePlanClick = _e.onChangePlanClick, onClickUpgrade = _e.onClickUpgrade, isTempViewOnly = _e.isTempViewOnly;
|
|
5138
4889
|
// Hooks
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
|
|
4890
|
+
common.useSuccessNotification();
|
|
4891
|
+
// const cancelSubscription = useCancelSubscription();
|
|
4892
|
+
reactQuery.useQueryClient();
|
|
5142
4893
|
// const navigate = usePortalNavigate();
|
|
5143
4894
|
// const handleUpgradingSubscriptionChange =
|
|
5144
4895
|
// useHandleUpgradingSubscriptionChange();
|
|
@@ -5147,21 +4898,21 @@ var SubscriptionCardActions = function (_a) {
|
|
|
5147
4898
|
var productPlans = (_b = planChangeOptions === null || planChangeOptions === void 0 ? void 0 : planChangeOptions.plans) === null || _b === void 0 ? void 0 : _b.filter(function (plan) { var _a; return ((_a = plan.priceLists) === null || _a === void 0 ? void 0 : _a.length) > 0 && plan.productId === subscription.product.id; });
|
|
5148
4899
|
var canShowChangePlanButton = ((productPlans === null || productPlans === void 0 ? void 0 : productPlans.length) || 0) > 0;
|
|
5149
4900
|
// Mutations
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5155
|
-
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
});
|
|
4901
|
+
// const subscriptionCancel = useMutation({
|
|
4902
|
+
// mutationFn: () => cancelSubscription([subscription.id], token),
|
|
4903
|
+
// onSuccess: () => {
|
|
4904
|
+
// queryClient.invalidateQueries({
|
|
4905
|
+
// queryKey: QueryKeyFactory.default.createTableKey("subscriptions"),
|
|
4906
|
+
// });
|
|
4907
|
+
// showSuccessNotification("Subscription canceled");
|
|
4908
|
+
// },
|
|
4909
|
+
// });
|
|
5159
4910
|
reactQuery.useMutation({
|
|
5160
4911
|
mutationFn: function () {
|
|
5161
4912
|
return getGuoteSubscriptionReinstate({
|
|
5162
4913
|
ids: [subscription.id],
|
|
5163
4914
|
token: token,
|
|
5164
|
-
|
|
4915
|
+
apiHost: apiHost,
|
|
5165
4916
|
});
|
|
5166
4917
|
},
|
|
5167
4918
|
onSuccess: function (quote) {
|
|
@@ -5181,7 +4932,9 @@ var SubscriptionCardActions = function (_a) {
|
|
|
5181
4932
|
onChangePlanClick();
|
|
5182
4933
|
};
|
|
5183
4934
|
return (canShowChangePlanButton || canShowCancelButton) &&
|
|
5184
|
-
canShowSubscriptionActions(subscription) ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!isTempViewOnly && canShowCancelButton && (jsxRuntime.jsx(antd.Popconfirm, __assign({ icon: null,
|
|
4935
|
+
canShowSubscriptionActions(subscription) ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!isTempViewOnly && canShowCancelButton && (jsxRuntime.jsx(antd.Popconfirm, __assign({ icon: null,
|
|
4936
|
+
// onConfirm={() => subscriptionCancel.mutate()}
|
|
4937
|
+
title: "Cancel subscription" }, { children: jsxRuntime.jsx(antd.Button, __assign({ className: "p-0", type: "link" }, { children: "Cancel subscription" })) }))), !isTempViewOnly && canShowChangePlanButton && (jsxRuntime.jsx(antd.Button, __assign({ onClick: function () { return handleChangePlanClick(); }, type: "primary" }, { children: "Change plan" })))] })) : ((_c = subscription.state) === null || _c === void 0 ? void 0 : _c.toUpperCase()) === common.SubscriptionState.TRIAL ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: !isTempViewOnly && (jsxRuntime.jsx(antd.Button, __assign({ onClick: function () {
|
|
5185
4938
|
// handleUpgradingSubscriptionChange({
|
|
5186
4939
|
// subscription,
|
|
5187
4940
|
// });
|
|
@@ -5199,22 +4952,22 @@ var getSubscriptionStatusText = function (subscription) {
|
|
|
5199
4952
|
if (cancellationDate &&
|
|
5200
4953
|
(state === null || state === void 0 ? void 0 : state.toUpperCase()) !== common.SubscriptionState.CANCELED &&
|
|
5201
4954
|
(state === null || state === void 0 ? void 0 : state.toUpperCase()) !== common.SubscriptionState.EXPIRED) {
|
|
5202
|
-
return (jsxRuntime.jsxs(antd.Tag, __assign({ color: "red" }, { children: ["Canceled - ends on ", common.
|
|
4955
|
+
return (jsxRuntime.jsxs(antd.Tag, __assign({ color: "red" }, { children: ["Canceled - ends on ", common.formatDate(cancellationDate)] })));
|
|
5203
4956
|
}
|
|
5204
4957
|
if (evergreen) {
|
|
5205
|
-
return "Renews on ".concat(common.
|
|
4958
|
+
return "Renews on ".concat(common.formatDate(endDate));
|
|
5206
4959
|
}
|
|
5207
4960
|
if ((state === null || state === void 0 ? void 0 : state.toUpperCase()) === common.SubscriptionState.CANCELED ||
|
|
5208
4961
|
(state === null || state === void 0 ? void 0 : state.toUpperCase()) === common.SubscriptionState.EXPIRED) {
|
|
5209
|
-
return "Ended on ".concat(common.
|
|
4962
|
+
return "Ended on ".concat(common.formatDate(endDate));
|
|
5210
4963
|
}
|
|
5211
|
-
return "Ends on ".concat(common.
|
|
4964
|
+
return "Ends on ".concat(common.formatDate(endDate));
|
|
5212
4965
|
};
|
|
5213
4966
|
var SubscriptionCardHeader = function (_a) {
|
|
5214
4967
|
var _b, _c, _d, _e, _f;
|
|
5215
4968
|
var planChangeOptions = _a.planChangeOptions, setEditingQuoteData = _a.setEditingQuoteData, setPayModalVisible = _a.setPayModalVisible, subscription = _a.subscription;
|
|
5216
4969
|
var darkMode = React.useContext(BunnyContext).darkMode;
|
|
5217
|
-
var isMobile = common.useIsMobile();
|
|
4970
|
+
var isMobile = common.useIsMobile(window);
|
|
5218
4971
|
// Derived state
|
|
5219
4972
|
var trialDaysLeft = dayjs(subscription.trialEndDate).diff(dayjs(), "days");
|
|
5220
4973
|
var isTrial = ((_b = subscription.state) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === common.SubscriptionState.TRIAL;
|
|
@@ -5233,8 +4986,8 @@ var BillingPeriodConverter;
|
|
|
5233
4986
|
})(BillingPeriodConverter || (BillingPeriodConverter = {}));
|
|
5234
4987
|
var SubscriptionChargeTotal = function (_a) {
|
|
5235
4988
|
var charge = _a.charge, subscription = _a.subscription;
|
|
5236
|
-
var isMobile = common.useIsMobile();
|
|
5237
|
-
return (jsxRuntime.jsxs("div", __assign({ className: "flex gap-1 ".concat(isMobile ? "flex-col" : "") }, { children: [jsxRuntime.jsx("div", { children: common.
|
|
4989
|
+
var isMobile = common.useIsMobile(window);
|
|
4990
|
+
return (jsxRuntime.jsxs("div", __assign({ className: "flex gap-1 ".concat(isMobile ? "flex-col" : "") }, { children: [jsxRuntime.jsx("div", { children: common.formatCurrency(Number(charge.periodPrice), subscription.currencyId) }), charge.billingPeriod && (jsxRuntime.jsx("div", { children: BillingPeriodConverter[charge.billingPeriod] }))] })));
|
|
5238
4991
|
};
|
|
5239
4992
|
|
|
5240
4993
|
var SubscriptionChargeUnitPrice = function (_a) {
|
|
@@ -5254,16 +5007,16 @@ var SubscriptionChargeUnitPrice = function (_a) {
|
|
|
5254
5007
|
var ends = ((_c = (_b = (_a = charge.priceListCharge) === null || _a === void 0 ? void 0 : _a.priceListChargeTiers) === null || _b === void 0 ? void 0 : _b[index + 1]) === null || _c === void 0 ? void 0 : _c.starts)
|
|
5255
5008
|
? ((_e = (_d = charge.priceListCharge) === null || _d === void 0 ? void 0 : _d.priceListChargeTiers[index + 1]) === null || _e === void 0 ? void 0 : _e.starts) - 1
|
|
5256
5009
|
: "∞";
|
|
5257
|
-
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.
|
|
5010
|
+
return (jsxRuntime.jsxs("div", __assign({ className: "contents" }, { children: [jsxRuntime.jsxs("div", __assign({ className: "whitespace-nowrap" }, { children: [tier.starts.toLocaleString(), " - ", ends.toLocaleString(), " ", ":"] })), jsxRuntime.jsx("div", __assign({ className: "whitespace-nowrap text-right" }, { children: common.formatCurrency(tier.price, subscription.currencyId, charge.priceDecimals) }))] }), index));
|
|
5258
5011
|
}) })) })));
|
|
5259
5012
|
}, onOpenChange: setShowPriceTiers, open: showPriceTiers, trigger: ["click"] }, { children: jsxRuntime.jsx("div", __assign({ className: "cursor-pointer underline", onClick: function () { return setShowPriceTiers(!showPriceTiers); } }, { children: showPriceTiers ? "hide details" : "show details" })) })));
|
|
5260
5013
|
}
|
|
5261
|
-
return
|
|
5014
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, { children: common.formatCurrency(charge.discountedPrice, subscription.currencyId) });
|
|
5262
5015
|
};
|
|
5263
5016
|
|
|
5264
5017
|
var SubscriptionCardColumnHeaders = function (_a) {
|
|
5265
5018
|
var columns = _a.columns;
|
|
5266
|
-
return columns.map(function (subscriptionColumn, index) { return (jsxRuntime.jsx("div", __assign({ className: "text-slate-400 ".concat(subscriptionColumn.className), style: { fontSize: "11px" } }, { children: subscriptionColumn.title }), index)); });
|
|
5019
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: columns.map(function (subscriptionColumn, index) { return (jsxRuntime.jsx("div", __assign({ className: "text-slate-400 ".concat(subscriptionColumn.className), style: { fontSize: "11px" } }, { children: subscriptionColumn.title }), index)); }) }));
|
|
5267
5020
|
};
|
|
5268
5021
|
|
|
5269
5022
|
var Text$1 = antd.Typography.Text;
|
|
@@ -5320,13 +5073,13 @@ var SubscriptionCardDesktop = function (_a) {
|
|
|
5320
5073
|
var SubscriptionCardDesktopRow = function (_a) {
|
|
5321
5074
|
var charge = _a.charge, chargeIndex = _a.chargeIndex, subscription = _a.subscription;
|
|
5322
5075
|
// Context
|
|
5323
|
-
var
|
|
5076
|
+
var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
|
|
5324
5077
|
// Derived state
|
|
5325
5078
|
var isRamp = charge.isRamp;
|
|
5326
5079
|
var prevCharge = subscription.charges[chargeIndex - 1];
|
|
5327
5080
|
var isFirstRampRow = chargeIndex === 0 ||
|
|
5328
5081
|
(prevCharge === null || prevCharge === void 0 ? void 0 : prevCharge.priceListChargeId) !== charge.priceListChargeId;
|
|
5329
|
-
var chargePeriod = "".concat(common.
|
|
5082
|
+
var chargePeriod = "".concat(common.formatDate(charge.startDate), " - ").concat(common.formatDate(charge.endDate));
|
|
5330
5083
|
// Queries
|
|
5331
5084
|
var data = reactQuery.useQuery({
|
|
5332
5085
|
queryKey: ["getFeatureUsage", charge.id, charge.startDate, charge.endDate],
|
|
@@ -5336,6 +5089,7 @@ var SubscriptionCardDesktopRow = function (_a) {
|
|
|
5336
5089
|
startDate: charge.startDate,
|
|
5337
5090
|
subscriptionChargeId: charge.id,
|
|
5338
5091
|
token: token,
|
|
5092
|
+
apiHost: apiHost,
|
|
5339
5093
|
});
|
|
5340
5094
|
},
|
|
5341
5095
|
enabled: (!isRamp || (isRamp && isFirstRampRow)) &&
|
|
@@ -5395,7 +5149,7 @@ var SubscriptionCard = function (_a) {
|
|
|
5395
5149
|
if ((isTrial && !charge.trial) || (!isTrial && charge.trial))
|
|
5396
5150
|
return null;
|
|
5397
5151
|
var isRamp = charge.isRamp;
|
|
5398
|
-
var chargePeriod = "".concat(common.
|
|
5152
|
+
var chargePeriod = "".concat(common.formatDate(charge.startDate), " - ").concat(common.formatDate(charge.endDate));
|
|
5399
5153
|
return (jsxRuntime.jsxs("div", __assign({ className: "contents" }, { children: [((isRamp && chargeIndex === 0) || !isRamp) && (jsxRuntime.jsxs(SubscriptionCardCellMobile, __assign({ className: CHARGE_COLUMNS[0].className, style: { gridColumn: isRamp ? "1/-1" : "1" } }, { children: [jsxRuntime.jsx("span", { children: charge.name }), !isRamp ? " - ".concat(chargePeriod) : ""] }))), isRamp && (jsxRuntime.jsx(SubscriptionCardCellMobile, __assign({ className: CHARGE_COLUMNS[0].className }, { children: "- ".concat(chargePeriod) }))), jsxRuntime.jsx(SubscriptionCardCellMobile, __assign({ className: CHARGE_COLUMNS[1].className }, { children: charge.quantity })), jsxRuntime.jsx(SubscriptionCardCellMobile, __assign({ className: CHARGE_COLUMNS[2].className }, { children: jsxRuntime.jsx(SubscriptionChargeUnitPrice, { charge: charge, subscription: subscription }) })), jsxRuntime.jsx(SubscriptionCardCellMobile, __assign({ className: CHARGE_COLUMNS[3].className }, { children: jsxRuntime.jsx(SubscriptionChargeTotal, { charge: charge, subscription: subscription }) }))] }), chargeIndex));
|
|
5400
5154
|
})] })), jsxRuntime.jsx("div", __assign({ className: "flex gap-2 pt-5", style: {
|
|
5401
5155
|
flexDirection: "column-reverse",
|
|
@@ -5404,14 +5158,14 @@ var SubscriptionCard = function (_a) {
|
|
|
5404
5158
|
|
|
5405
5159
|
var SubscriptionsList = function (_a) {
|
|
5406
5160
|
var hideExpired = _a.hideExpired, planChangeOptions = _a.planChangeOptions, setEditingQuoteData = _a.setEditingQuoteData, setPayModalVisible = _a.setPayModalVisible, subscriptions = _a.subscriptions;
|
|
5407
|
-
var isMobile = common.useIsMobile();
|
|
5408
|
-
return subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.map(function (subscription, subscriptionIndex) {
|
|
5409
|
-
|
|
5410
|
-
|
|
5411
|
-
|
|
5412
|
-
|
|
5413
|
-
|
|
5414
|
-
|
|
5161
|
+
var isMobile = common.useIsMobile(window);
|
|
5162
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.map(function (subscription, subscriptionIndex) {
|
|
5163
|
+
if (hideExpired && isSubscriptionNotActive(subscription))
|
|
5164
|
+
return null;
|
|
5165
|
+
if (isMobile)
|
|
5166
|
+
return (jsxRuntime.jsx(SubscriptionCard, { planChangeOptions: planChangeOptions, setEditingQuoteData: setEditingQuoteData, setPayModalVisible: setPayModalVisible, subscription: subscription }, subscriptionIndex));
|
|
5167
|
+
return (jsxRuntime.jsx(SubscriptionCardDesktop, { planChangeOptions: planChangeOptions, setEditingQuoteData: setEditingQuoteData, setPayModalVisible: setPayModalVisible, subscription: subscription }, subscriptionIndex));
|
|
5168
|
+
}) }));
|
|
5415
5169
|
};
|
|
5416
5170
|
|
|
5417
5171
|
var ChangeQuantitiesButton = function (_a) {
|
|
@@ -5427,7 +5181,7 @@ var SubscriptionsNavigation = function (_a) {
|
|
|
5427
5181
|
var hideExpired = _a.hideExpired, setHideExpired = _a.setHideExpired, setQuantityDrawerOpen = _a.setQuantityDrawerOpen, subscriptions = _a.subscriptions;
|
|
5428
5182
|
var isTempViewOnly = React.useContext(SubscriptionsContext).isTempViewOnly;
|
|
5429
5183
|
// Hooks
|
|
5430
|
-
var isMobile = common.useIsMobile();
|
|
5184
|
+
var isMobile = common.useIsMobile(window);
|
|
5431
5185
|
// Derived state
|
|
5432
5186
|
var canShowChangeQuantitiesButton = canShowChangeQuantities({
|
|
5433
5187
|
subscriptions: subscriptions,
|
|
@@ -5436,44 +5190,48 @@ var SubscriptionsNavigation = function (_a) {
|
|
|
5436
5190
|
};
|
|
5437
5191
|
|
|
5438
5192
|
var SubscriptionsContext = React.createContext({});
|
|
5193
|
+
// !!! This component is intended to be view only, however it still has lots of code for full functionality.
|
|
5194
|
+
// !!! This must be refactored.
|
|
5439
5195
|
var Subscriptions = function (_a) {
|
|
5440
|
-
var
|
|
5196
|
+
var companyName = _a.companyName, entityId = _a.entityId, gap = _a.gap, shadow = _a.shadow, _b = _a.showTitle, showTitle = _b === void 0 ? true : _b;
|
|
5441
5197
|
// Context
|
|
5442
|
-
var _c = React.useContext(BunnyContext), token = _c.token,
|
|
5198
|
+
var _c = React.useContext(BunnyContext), token = _c.token, apiHost = _c.apiHost, onErrorNavigate = _c.onErrorNavigate;
|
|
5443
5199
|
// Recoil state
|
|
5444
|
-
|
|
5200
|
+
// const [updatingChargeQuantityId, setUpdatingChargeQuantityId] =
|
|
5201
|
+
// useRecoilState(updatingChargeQuantityIdState);
|
|
5445
5202
|
// Local state
|
|
5446
|
-
var
|
|
5447
|
-
var
|
|
5448
|
-
var
|
|
5449
|
-
var
|
|
5203
|
+
var _d = React.useState(), editingQuoteData = _d[0], setEditingQuoteData = _d[1];
|
|
5204
|
+
var _e = React.useState(false), payModalVisible = _e[0], setPayModalVisible = _e[1];
|
|
5205
|
+
var _f = React.useState(true), hideExpired = _f[0], setHideExpired = _f[1];
|
|
5206
|
+
var _g = React.useState(false); _g[0]; var setQuantityDrawerOpen = _g[1];
|
|
5450
5207
|
// Hooks
|
|
5451
|
-
var handleAllErrorFormats = common.
|
|
5208
|
+
var handleAllErrorFormats = common.useAllErrorFormats(onErrorNavigate ||
|
|
5209
|
+
(function (url) {
|
|
5210
|
+
console.log("navigate to", url, " not implemented");
|
|
5211
|
+
}));
|
|
5452
5212
|
var queryClient = reactQuery.useQueryClient();
|
|
5453
|
-
var showSuccessNotification = common.
|
|
5454
|
-
|
|
5455
|
-
var isMobile = common.useIsMobile();
|
|
5456
|
-
var entityId = common.useCurrentUserData().entityId;
|
|
5457
|
-
var companyName = common.useCurrentUserData().companyName;
|
|
5213
|
+
var showSuccessNotification = common.useSuccessNotification();
|
|
5214
|
+
// const quoteDelete = useQuoteDelete();
|
|
5215
|
+
var isMobile = common.useIsMobile(window);
|
|
5458
5216
|
// Queries
|
|
5459
|
-
var
|
|
5217
|
+
var _h = reactQuery.useQuery({
|
|
5460
5218
|
queryKey: common.QueryKeyFactory.default.createTableKey("subscriptions"),
|
|
5461
|
-
queryFn: function () { return getSubscriptions({ entityId: entityId, token: token,
|
|
5219
|
+
queryFn: function () { return getSubscriptions({ entityId: entityId, token: token, apiHost: apiHost }); },
|
|
5462
5220
|
enabled: Boolean(entityId),
|
|
5463
|
-
}), rawSubscriptions =
|
|
5221
|
+
}), rawSubscriptions = _h.data, subscriptionsAreLoading = _h.isLoading;
|
|
5464
5222
|
var quote = reactQuery.useQuery({
|
|
5465
5223
|
queryKey: common.QueryKeyFactory.default.createObjectKey("editingQuote", editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.id),
|
|
5466
5224
|
queryFn: function () {
|
|
5467
5225
|
return (editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.id)
|
|
5468
|
-
? getQuote({ token: token, id: editingQuoteData.id,
|
|
5226
|
+
? getQuote({ token: token, id: editingQuoteData.id, apiHost: apiHost })
|
|
5469
5227
|
: undefined;
|
|
5470
5228
|
},
|
|
5471
5229
|
enabled: Boolean(editingQuoteData === null || editingQuoteData === void 0 ? void 0 : editingQuoteData.id),
|
|
5472
5230
|
}).data;
|
|
5473
|
-
var
|
|
5231
|
+
var _j = reactQuery.useQuery({
|
|
5474
5232
|
queryKey: common.QueryKeyFactory.default.planChangeOptionsKey(),
|
|
5475
|
-
queryFn: function () { return getPlanChangeOptions({ token: token,
|
|
5476
|
-
}), planChangeOptions =
|
|
5233
|
+
queryFn: function () { return getPlanChangeOptions({ token: token, apiHost: apiHost }); },
|
|
5234
|
+
}), planChangeOptions = _j.data, arePlanChangeOptionsLoading = _j.isLoading;
|
|
5477
5235
|
// Derived state
|
|
5478
5236
|
var subscriptions = useSubscriptions({ data: rawSubscriptions });
|
|
5479
5237
|
var allSubscriptionsExpired = subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.every(function (subscription) {
|
|
@@ -5505,16 +5263,16 @@ var Subscriptions = function (_a) {
|
|
|
5505
5263
|
var onFail = function (error) {
|
|
5506
5264
|
handleAllErrorFormats(error);
|
|
5507
5265
|
};
|
|
5508
|
-
|
|
5509
|
-
|
|
5510
|
-
|
|
5511
|
-
|
|
5512
|
-
|
|
5513
|
-
|
|
5514
|
-
|
|
5515
|
-
|
|
5516
|
-
|
|
5517
|
-
};
|
|
5266
|
+
// const onClose = () => {
|
|
5267
|
+
// if (editingQuoteData) {
|
|
5268
|
+
// quoteDelete(editingQuoteData.id, token);
|
|
5269
|
+
// setEditingQuoteData(undefined);
|
|
5270
|
+
// }
|
|
5271
|
+
// // if (updatingChargeQuantityId) {
|
|
5272
|
+
// // setUpdatingChargeQuantityId(undefined);
|
|
5273
|
+
// // }
|
|
5274
|
+
// setQuantityDrawerOpen(false);
|
|
5275
|
+
// };
|
|
5518
5276
|
if (subscriptionsAreLoading || arePlanChangeOptionsLoading)
|
|
5519
5277
|
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
5520
5278
|
return (jsxRuntime.jsxs(SubscriptionsContext.Provider, __assign({ value: {
|
|
@@ -5528,9 +5286,9 @@ var Subscriptions = function (_a) {
|
|
|
5528
5286
|
shadow: shadow,
|
|
5529
5287
|
gap: gap,
|
|
5530
5288
|
showTitle: showTitle,
|
|
5531
|
-
} }, { children: [showTitle && (jsxRuntime.jsx(PageHeaderWithActions, __assign({ title: jsxRuntime.jsxs("div", __assign({ className: "flex items-center justify-between", style: { minWidth: "137px" } }, { children: [hideExpired ? "Active subscriptions" : "All subscriptions", isMobile && (jsxRuntime.jsx(HideExpiredToggle, { hideExpired: hideExpired, setHideExpired: setHideExpired, subscriptions: subscriptions }))] })) }, { children: !isMobile && (jsxRuntime.jsx(SubscriptionsNavigation, { hideExpired: hideExpired, setHideExpired: setHideExpired, setQuantityDrawerOpen: setQuantityDrawerOpen, subscriptions: subscriptions })) }))), jsxRuntime.jsx(
|
|
5289
|
+
} }, { children: [showTitle && (jsxRuntime.jsx(PageHeaderWithActions, __assign({ title: jsxRuntime.jsxs("div", __assign({ className: "flex items-center justify-between", style: { minWidth: "137px" } }, { children: [hideExpired ? "Active subscriptions" : "All subscriptions", isMobile && (jsxRuntime.jsx(HideExpiredToggle, { hideExpired: hideExpired, setHideExpired: setHideExpired, subscriptions: subscriptions }))] })) }, { children: !isMobile && (jsxRuntime.jsx(SubscriptionsNavigation, { hideExpired: hideExpired, setHideExpired: setHideExpired, setQuantityDrawerOpen: setQuantityDrawerOpen, subscriptions: subscriptions })) }))), jsxRuntime.jsx("div", __assign({ className: "flex flex-col gap-".concat(gap === undefined ? 4 : gap, " shadow-padding-xb overflow-auto"), style: {
|
|
5532
5290
|
flexShrink: 1,
|
|
5533
|
-
} }, { children: (subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.length) > 0 ? (jsxRuntime.jsx(SubscriptionsList, { hideExpired: hideExpired, planChangeOptions: planChangeOptions, setEditingQuoteData: setEditingQuoteData, setPayModalVisible: setPayModalVisible, subscriptions: subscriptions })) : (jsxRuntime.jsx("div", __assign({ className: "flex flex-col items-center w-full" }, { children: jsxRuntime.jsx(ErrorView, { message: "You have no subscriptions with ".concat(companyName, " yet") }) }))) })), isMobile && (jsxRuntime.jsx("div", __assign({ className: "pt-4 pb-2" }, { children: jsxRuntime.jsx(SubscriptionsNavigation, { hideExpired: hideExpired, setHideExpired: setHideExpired, setQuantityDrawerOpen: setQuantityDrawerOpen, subscriptions: subscriptions }) }))), jsxRuntime.jsx(
|
|
5291
|
+
} }, { children: (subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.length) > 0 ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx(SubscriptionsList, { hideExpired: hideExpired, planChangeOptions: planChangeOptions, setEditingQuoteData: setEditingQuoteData, setPayModalVisible: setPayModalVisible, subscriptions: subscriptions }) })) : (jsxRuntime.jsx("div", __assign({ className: "flex flex-col items-center w-full" }, { children: jsxRuntime.jsx(ErrorView, { message: "You have no subscriptions with ".concat(companyName, " yet") }) }))) })), isMobile && (jsxRuntime.jsx("div", __assign({ className: "pt-4 pb-2" }, { children: jsxRuntime.jsx(SubscriptionsNavigation, { hideExpired: hideExpired, setHideExpired: setHideExpired, setQuantityDrawerOpen: setQuantityDrawerOpen, subscriptions: subscriptions }) }))), jsxRuntime.jsx(Checkout, { entityId: entityId, onCancel: onCancel, onSuccess: onSuccess, onFail: onFail, open: payModalVisible, quote: quote, token: token, isMobile: isMobile })] })));
|
|
5534
5292
|
};
|
|
5535
5293
|
|
|
5536
5294
|
exports.BunnyProvider = BunnyProvider;
|
|
@@ -5538,6 +5296,7 @@ exports.Checkout = Checkout;
|
|
|
5538
5296
|
exports.Invoice = Invoice;
|
|
5539
5297
|
exports.PaymentMethod = PaymentMethod;
|
|
5540
5298
|
exports.Quote = Quote;
|
|
5299
|
+
exports.Quotes = Quotes;
|
|
5541
5300
|
exports.Signup = Signup;
|
|
5542
5301
|
exports.Subscriptions = Subscriptions;
|
|
5543
5302
|
exports.Transactions = Transactions;
|