@bunnyapp/components 1.0.11 → 1.0.12
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 +1069 -1161
- package/dist/cjs/src/components/BillingDetails/BillingDetails.d.ts +10 -0
- package/dist/cjs/src/components/BillingDetails/BillingDetails.stories.d.ts +11 -0
- package/dist/cjs/src/components/BillingDetails/index.d.ts +1 -0
- package/dist/cjs/src/components/BunnyProvider.d.ts +3 -3
- package/dist/cjs/src/components/Checkout/InvoiceCheckout.d.ts +1 -21
- package/dist/cjs/src/components/Checkout/QuoteCheckout.d.ts +1 -1
- package/dist/cjs/src/components/Invoice/Invoice.d.ts +8 -2
- package/dist/cjs/src/components/Invoice/Invoice.stories.d.ts +14 -5
- package/dist/cjs/src/components/PageHeaderWithActions.d.ts +2 -1
- package/dist/cjs/src/components/PaymentForm/CheckoutFooter.d.ts +8 -7
- package/dist/cjs/src/components/PaymentForm/DemoPay/DemoPayForm.d.ts +6 -2
- package/dist/cjs/src/components/PaymentForm/DemoPay/demoPayUtils.d.ts +1 -3
- package/dist/cjs/src/components/PaymentForm/DemoPay/hooks/usePay.d.ts +13 -0
- package/dist/cjs/src/components/PaymentForm/DemoPay/hooks/useSave.d.ts +21 -0
- package/dist/cjs/src/components/PaymentForm/PaymentForm.d.ts +10 -6
- package/dist/cjs/src/components/PaymentForm/PaymentFormTypes.d.ts +0 -8
- package/dist/cjs/src/components/PaymentForm/PaymentMethod/CreditCard/CreditCard.d.ts +12 -2
- package/dist/cjs/src/components/PaymentForm/PaymentMethod/PaymentMethod.d.ts +6 -4
- package/dist/cjs/src/components/PaymentForm/PaymentMethod/PaymentMethod.stories.d.ts +11 -0
- package/dist/cjs/src/components/PaymentForm/PaymentMethodDetails.d.ts +8 -0
- package/dist/cjs/src/components/PaymentForm/PaymentMethodSelector.d.ts +2 -3
- package/dist/cjs/src/components/PaymentForm/SavePaymentMethodFooter.d.ts +6 -0
- package/dist/cjs/src/components/PaymentForm/Stripe/PaymentMethodForm.d.ts +6 -2
- package/dist/cjs/src/components/PaymentForm/Stripe/StripeForm.d.ts +6 -2
- package/dist/cjs/src/components/PaymentForm/Stripe/hooks/usePay.d.ts +12 -0
- package/dist/cjs/src/components/PaymentForm/Stripe/hooks/useSave.d.ts +10 -0
- package/dist/cjs/src/components/PaymentForm/Stripe/stripeUtils.d.ts +9 -3
- package/dist/cjs/src/components/PaymentForm/useRemovePaymentMethod.d.ts +3 -0
- package/dist/cjs/src/components/Quote/Quote.d.ts +2 -4
- package/dist/cjs/src/components/Quote/Quote.stories.d.ts +122 -6
- package/dist/cjs/src/components/Quotes/Quotes.d.ts +8 -4
- package/dist/cjs/src/components/Quotes/Quotes.stories.d.ts +22 -0
- package/dist/cjs/src/components/Signup/PaymentForms.d.ts +2 -4
- package/dist/cjs/src/components/Signup/Signup.d.ts +11 -1
- package/dist/cjs/src/components/Signup/Signup.stories.d.ts +6 -4
- package/dist/cjs/src/components/StateTag.d.ts +3 -5
- package/dist/cjs/src/components/Subscriptions/Subscriptions.d.ts +2 -1
- package/dist/cjs/src/components/Subscriptions/Subscriptions.stories.d.ts +10 -0
- package/dist/cjs/src/components/Transactions/Transactions.d.ts +7 -5
- package/dist/cjs/src/components/Transactions/Transactions.stories.d.ts +15 -6
- package/dist/cjs/src/components/Transactions/TransactionsListContext.d.ts +5 -1
- package/dist/cjs/src/components/Transactions/transactionsList/TransactionsListDesktop.d.ts +1 -1
- package/dist/cjs/src/contexts/PaymentContext.d.ts +2 -2
- package/dist/cjs/src/graphql/queries/getAccount.d.ts +1 -1
- package/dist/cjs/src/hooks/quotes/useSendAcceptQuote.d.ts +2 -2
- package/dist/cjs/src/hooks/usePaymentMethod.d.ts +1 -1
- package/dist/cjs/src/mocks/handlers.d.ts +1 -1
- package/dist/cjs/src/storybook-utils.d.ts +10 -0
- package/dist/cjs/src/types/shadowType.d.ts +1 -0
- package/dist/esm/index.js +1073 -1165
- package/dist/esm/src/components/BillingDetails/BillingDetails.d.ts +10 -0
- package/dist/esm/src/components/BillingDetails/BillingDetails.stories.d.ts +11 -0
- package/dist/esm/src/components/BillingDetails/index.d.ts +1 -0
- package/dist/esm/src/components/BunnyProvider.d.ts +3 -3
- package/dist/esm/src/components/Checkout/InvoiceCheckout.d.ts +1 -21
- package/dist/esm/src/components/Checkout/QuoteCheckout.d.ts +1 -1
- package/dist/esm/src/components/Invoice/Invoice.d.ts +8 -2
- package/dist/esm/src/components/Invoice/Invoice.stories.d.ts +14 -5
- package/dist/esm/src/components/PageHeaderWithActions.d.ts +2 -1
- package/dist/esm/src/components/PaymentForm/CheckoutFooter.d.ts +8 -7
- package/dist/esm/src/components/PaymentForm/DemoPay/DemoPayForm.d.ts +6 -2
- package/dist/esm/src/components/PaymentForm/DemoPay/demoPayUtils.d.ts +1 -3
- package/dist/esm/src/components/PaymentForm/DemoPay/hooks/usePay.d.ts +13 -0
- package/dist/esm/src/components/PaymentForm/DemoPay/hooks/useSave.d.ts +21 -0
- package/dist/esm/src/components/PaymentForm/PaymentForm.d.ts +10 -6
- package/dist/esm/src/components/PaymentForm/PaymentFormTypes.d.ts +0 -8
- package/dist/esm/src/components/PaymentForm/PaymentMethod/CreditCard/CreditCard.d.ts +12 -2
- package/dist/esm/src/components/PaymentForm/PaymentMethod/PaymentMethod.d.ts +6 -4
- package/dist/esm/src/components/PaymentForm/PaymentMethod/PaymentMethod.stories.d.ts +11 -0
- package/dist/esm/src/components/PaymentForm/PaymentMethodDetails.d.ts +8 -0
- package/dist/esm/src/components/PaymentForm/PaymentMethodSelector.d.ts +2 -3
- package/dist/esm/src/components/PaymentForm/SavePaymentMethodFooter.d.ts +6 -0
- package/dist/esm/src/components/PaymentForm/Stripe/PaymentMethodForm.d.ts +6 -2
- package/dist/esm/src/components/PaymentForm/Stripe/StripeForm.d.ts +6 -2
- package/dist/esm/src/components/PaymentForm/Stripe/hooks/usePay.d.ts +12 -0
- package/dist/esm/src/components/PaymentForm/Stripe/hooks/useSave.d.ts +10 -0
- package/dist/esm/src/components/PaymentForm/Stripe/stripeUtils.d.ts +9 -3
- package/dist/esm/src/components/PaymentForm/useRemovePaymentMethod.d.ts +3 -0
- package/dist/esm/src/components/Quote/Quote.d.ts +2 -4
- package/dist/esm/src/components/Quote/Quote.stories.d.ts +122 -6
- package/dist/esm/src/components/Quotes/Quotes.d.ts +8 -4
- package/dist/esm/src/components/Quotes/Quotes.stories.d.ts +22 -0
- package/dist/esm/src/components/Signup/PaymentForms.d.ts +2 -4
- package/dist/esm/src/components/Signup/Signup.d.ts +11 -1
- package/dist/esm/src/components/Signup/Signup.stories.d.ts +6 -4
- package/dist/esm/src/components/StateTag.d.ts +3 -5
- package/dist/esm/src/components/Subscriptions/Subscriptions.d.ts +2 -1
- package/dist/esm/src/components/Subscriptions/Subscriptions.stories.d.ts +10 -0
- package/dist/esm/src/components/Transactions/Transactions.d.ts +7 -5
- package/dist/esm/src/components/Transactions/Transactions.stories.d.ts +15 -6
- package/dist/esm/src/components/Transactions/TransactionsListContext.d.ts +5 -1
- package/dist/esm/src/components/Transactions/transactionsList/TransactionsListDesktop.d.ts +1 -1
- package/dist/esm/src/contexts/PaymentContext.d.ts +2 -2
- package/dist/esm/src/graphql/queries/getAccount.d.ts +1 -1
- package/dist/esm/src/hooks/quotes/useSendAcceptQuote.d.ts +2 -2
- package/dist/esm/src/hooks/usePaymentMethod.d.ts +1 -1
- package/dist/esm/src/mocks/handlers.d.ts +1 -1
- package/dist/esm/src/storybook-utils.d.ts +10 -0
- package/dist/esm/src/types/shadowType.d.ts +1 -0
- package/dist/index.d.ts +45 -25
- package/package.json +1 -1
- package/dist/cjs/src/components/PaymentForm/Finix/FinixCardForm.d.ts +0 -4
- package/dist/cjs/src/components/PaymentForm/Finix/index.d.ts +0 -2
- package/dist/cjs/src/components/PaymentForm/FinixAch.d.ts +0 -3
- package/dist/cjs/src/components/PaymentForm/PaymentMethod/PaymentMethodContext.d.ts +0 -5
- package/dist/cjs/src/components/PaymentForm/PaymentMethodForm.d.ts +0 -3
- package/dist/cjs/src/components/PaymentForm/PaymentOption.d.ts +0 -8
- package/dist/cjs/src/components/PaymentForm/StoredPaymentMethod/StoredPaymentMethodForm.d.ts +0 -3
- package/dist/cjs/src/components/PaymentForm/Stripe/CheckoutForm.d.ts +0 -3
- package/dist/cjs/src/components/PaymentForm/Stripe/index.d.ts +0 -1
- package/dist/cjs/src/components/PaymentForm/paymentUtils.d.ts +0 -7
- package/dist/cjs/src/stories/Button.d.ts +0 -15
- package/dist/cjs/src/stories/Button.stories.d.ts +0 -9
- package/dist/cjs/src/stories/Header.d.ts +0 -12
- package/dist/cjs/src/stories/Header.stories.d.ts +0 -7
- package/dist/cjs/src/stories/Page.d.ts +0 -3
- package/dist/cjs/src/stories/Page.stories.d.ts +0 -7
- package/dist/esm/src/components/PaymentForm/Finix/FinixCardForm.d.ts +0 -4
- package/dist/esm/src/components/PaymentForm/Finix/index.d.ts +0 -2
- package/dist/esm/src/components/PaymentForm/FinixAch.d.ts +0 -3
- package/dist/esm/src/components/PaymentForm/PaymentMethod/PaymentMethodContext.d.ts +0 -5
- package/dist/esm/src/components/PaymentForm/PaymentMethodForm.d.ts +0 -3
- package/dist/esm/src/components/PaymentForm/PaymentOption.d.ts +0 -8
- package/dist/esm/src/components/PaymentForm/StoredPaymentMethod/StoredPaymentMethodForm.d.ts +0 -3
- package/dist/esm/src/components/PaymentForm/Stripe/CheckoutForm.d.ts +0 -3
- package/dist/esm/src/components/PaymentForm/Stripe/index.d.ts +0 -1
- package/dist/esm/src/components/PaymentForm/paymentUtils.d.ts +0 -7
- package/dist/esm/src/stories/Button.d.ts +0 -15
- package/dist/esm/src/stories/Button.stories.d.ts +0 -9
- package/dist/esm/src/stories/Header.d.ts +0 -12
- package/dist/esm/src/stories/Header.stories.d.ts +0 -7
- package/dist/esm/src/stories/Page.d.ts +0 -3
- package/dist/esm/src/stories/Page.stories.d.ts +0 -7
package/dist/cjs/index.js
CHANGED
|
@@ -13,10 +13,10 @@ var theme = require('antd/lib/theme');
|
|
|
13
13
|
var recoil = require('recoil');
|
|
14
14
|
var graphqlRequest = import('graphql-request');
|
|
15
15
|
var reactHelmetAsync = require('react-helmet-async');
|
|
16
|
-
var reactStripeJs = require('@stripe/react-stripe-js');
|
|
17
|
-
var pure = require('@stripe/stripe-js/pure');
|
|
18
16
|
var lodash = require('lodash');
|
|
19
17
|
var recharts = require('recharts');
|
|
18
|
+
var reactStripeJs = require('@stripe/react-stripe-js');
|
|
19
|
+
var pure = require('@stripe/stripe-js/pure');
|
|
20
20
|
|
|
21
21
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
22
22
|
|
|
@@ -70,7 +70,7 @@ function styleInject(css, ref) {
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
var css_248z = ".ant-tag {\n border: none;\n border-radius: 14px;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n font-weight: 500;\n white-space: nowrap;\n margin: 0;\n}\n.ant-tag-blue {\n color: #3b82f6 !important;\n background: #bfdbfe !important;\n}\n.ant-tag-green {\n color: #059669 !important;\n background: #a7f3d0 !important;\n}\n.ant-tag-red {\n color: #ef4444 !important;\n background: #fecaca !important;\n}\n.ant-tag-orange {\n color: #f97316 !important;\n background: #fed7aa !important;\n}\n.ant-tag-yellow {\n color: #f59e0b !important;\n background: #fde68a !important;\n}\n.ant-tag-purple {\n color: #8b5cf6 !important;\n background: #ddd6fe !important;\n}\n.ant-tag-black {\n color: white !important;\n background: black !important;\n}\n.ant-popover {\n z-index: 1050;\n}\n.ant-popover-inner-content {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n max-width: 300px;\n}\n.ant-popover-message-title {\n padding: 0;\n text-align: center;\n font-size: 1rem;\n}\n.ant-popover-buttons {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.ant-btn-primary:disabled {\n background: #eef0f2 !important;\n color: rgba(0, 0, 0, 0.25) !important;\n border: none;\n}\n.ant-btn {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n font-weight: 500;\n box-shadow: none;\n text-shadow: none;\n outline: none !important;\n line-height: 1;\n font-size: 0.875rem;\n font-weight: normal;\n}\n.ant-btn > span {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n.ant-btn-lg {\n height: 44px !important;\n}\n.ant-btn-default:disabled {\n border-color: rgba(113, 125, 148, 0.2) !important;\n}\n.ant-btn-link {\n border: none !important;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n.ant-btn-link > span {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n.ant-btn-link:disabled {\n background-color: transparent !important;\n color: #717d94 !important;\n}\n.ant-btn-link:disabled:hover {\n background-color: transparent !important;\n}\n.ant-input-affix-wrapper .ant-input-prefix {\n transition: color 0.3s;\n}\n.ant-select-selector {\n box-shadow: none !important;\n background-color: transparent !important;\n border: none !important;\n}\n.ant-form-item-label {\n text-transform: none !important;\n font-size: 0.75rem;\n padding-bottom: 2px !important;\n}\n.ant-form-item-label > label {\n width: 100%;\n color: #4b5563 !important;\n}\n.ant-form-item-explain-error {\n font-size: 11px;\n min-height: 11px;\n line-height: 11px;\n padding-top: 2px;\n}\n.ant-form-item {\n margin-bottom: 0;\n}\n.ant-notification {\n width: min-content;\n}\n.ant-notification-topRight {\n right: 0 !important;\n left: 0 !important;\n margin-left: auto !important;\n margin-right: auto !important;\n}\n.ant-notification-notice-wrapper {\n width: 350px !important;\n overflow: hidden !important;\n}\n.ant-notification-notice {\n padding: 16px !important;\n width: 350px !important;\n display: flex !important;\n box-shadow: 0px 6px 10px rgba(0, 0, 0, 0.08), 0px 1px 18px rgba(0, 0, 0, 0.08), 0px 3px 5px rgba(0, 0, 0, 0.16) !important;\n}\n.ant-notification-notice-description {\n padding: 0 14px 0 0 !important;\n color: #232323 !important;\n font-size: 14px !important;\n word-break: break-all !important;\n overflow-wrap: break-word !important;\n}\n.ant-notification-notice-success {\n background-color: #edfffa !important;\n}\n.ant-notification-notice-error {\n background-color: #fff8f4 !important;\n}\n.ant-notification-notice-error .ant-notification-notice-message {\n color: #ff6e1c !important;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji !important;\n font-weight: 500;\n}\n.ant-notification-notice-error .ant-notification-notice-icon {\n color: #ff6e1c;\n}\n.ant-notification-notice-success .ant-notification-notice-message {\n color: #00b76a !important;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji !important;\n font-weight: 500;\n}\n.ant-notification-notice-success .ant-notification-notice-icon {\n color: #00b76a !important;\n}\n.ant-notification-notice-message {\n margin-bottom: 0 !important;\n}\n.ant-notification-notice-close {\n top: 16px !important;\n right: 16px !important;\n}\n.ant-divider {\n margin: 0;\n}\n.ant-menu-submenu-popup > .ant-menu .ant-menu-item {\n display: flex !important;\n align-items: center !important;\n}\n.ant-menu-submenu::after {\n display: none !important;\n}\n.ant-drawer-title {\n font-weight: 400 !important;\n}\n.ant-drawer-header-title {\n flex-direction: row-reverse !important;\n align-items: start !important ;\n}\n.ant-drawer-close {\n margin-inline-end: 0 !important;\n}\n@media (min-width: 768px) {\n .ant-input,\n .ant-picker,\n .ant-select,\n .ant-input-affix-wrapper {\n font-size: 1rem !important;\n }\n .ant-drawer-header {\n padding-right: 1.5rem !important;\n padding-left: 1.5rem !important;\n }\n}\n:root {\n --row-background: #ffffff;\n --row-background-alternate: rgba(100, 116, 139, 0.04);\n --row-background-dark: #121212;\n --row-background-alternate-dark: #1e1e1e;\n}\n.plan-step-line {\n height: 1px;\n min-width: 128px;\n background: #717d94;\n}\n.plan-step-number {\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 9999px;\n border: 1px solid #717d94;\n background: white;\n width: 24px;\n height: 24px;\n color: #717d94;\n}\n.plan-step-number.active {\n border: none;\n color: white;\n background: #ff6e1c;\n}\n.hidden {\n display: none;\n}\n.cardElement {\n padding: 8px 11px;\n border: 1px solid #e5e7eb;\n background-color: white;\n font-family: Inter !important;\n}\n.tooltip {\n visibility: hidden;\n position: absolute !important;\n}\n.has-tooltip:hover .tooltip {\n visibility: visible;\n z-index: 100;\n}\n.show-on-hover {\n opacity: 0;\n}\n.show-on-hover-container:hover .show-on-hover {\n opacity: 1;\n}\n.pdf-only {\n display: none !important;\n}\n.notes p {\n margin: 0;\n padding: 0;\n padding-bottom: 0.25rem;\n}\n#form-element #finix-form-container .field-holder label {\n color: #717d94 !important;\n font-size: 12px !important;\n}\n#form-element #finix-form-container > *:first-child,\n#form-element #finix-form-container > *:last-child {\n margin-top: 0 !important;\n}\n#form-element #finix-form-container > *:not(:first-child):not(:last-child) {\n margin-top: 12px !important;\n}\n#form-element #finix-form-container .field-array > * {\n margin-top: 0 !important;\n}\n#form-element #finix-form-container .field-holder .field,\n#form-element #finix-form-container iframe {\n height: 34px !important;\n}\n#form-element #finix-form-container .field {\n margin-top: 0 !important;\n padding-top: 2px !important;\n}\n#form-element #finix-form-container .field-holder .validation {\n font-size: 11px !important;\n color: #ff4d4f !important;\n}\n.icon-path {\n transition: fill 0.3s;\n}\n.shadow-padding-x {\n padding-right: 1rem;\n padding-left: 1rem;\n}\n.shadow-padding-xb {\n padding-right: 1rem;\n padding-left: 1rem;\n padding-bottom: 0.5rem;\n}\n.content-container {\n width: 100%;\n margin: 0 auto;\n}\n@media (min-width: 1220px) {\n .content-container {\n width: 1220px !important;\n margin: 0 auto;\n }\n}\n@media (min-width: 768px) {\n .shadow-padding-x {\n padding-right: 2rem;\n padding-left: 2rem;\n }\n .shadow-padding-xb {\n padding-right: 2rem;\n padding-left: 2rem;\n padding-bottom: 0.5rem;\n }\n .sm\\:flex {\n display: flex !important;\n }\n .sm\\:hidden {\n display: none !important;\n }\n}\n.rotate-45,\n.transform {\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n}\n.shadow,\n.shadow-md {\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n}\n.container {\n width: 100%;\n}\n@media (min-width: 768px) {\n .container {\n max-width: 768px;\n }\n}\n@media (min-width: 1024px) {\n .container {\n max-width: 1024px;\n }\n}\n@media (min-width: 1280px) {\n .container {\n max-width: 1280px;\n }\n}\n@media (min-width: 1536px) {\n .container {\n max-width: 1536px;\n }\n}\n.visible {\n visibility: visible;\n}\n.fixed {\n position: fixed;\n}\n.absolute {\n position: absolute;\n}\n.relative {\n position: relative;\n}\n.bottom-0 {\n bottom: 0px;\n}\n.left-0 {\n left: 0px;\n}\n.right-0 {\n right: 0px;\n}\n.top-0 {\n top: 0px;\n}\n.z-50 {\n z-index: 50;\n}\n.col-span-2 {\n grid-column: span 2 / span 2;\n}\n.col-span-3 {\n grid-column: span 3 / span 3;\n}\n.m-0 {\n margin: 0px;\n}\n.mx-8 {\n margin-left: 2rem;\n margin-right: 2rem;\n}\n.my-12 {\n margin-top: 3rem;\n margin-bottom: 3rem;\n}\n.my-4 {\n margin-top: 1rem;\n margin-bottom: 1rem;\n}\n.mb-4 {\n margin-bottom: 1rem;\n}\n.ml-2 {\n margin-left: 0.5rem;\n}\n.mr-8 {\n margin-right: 2rem;\n}\n.mt-1 {\n margin-top: 0.25rem;\n}\n.mt-2 {\n margin-top: 0.5rem;\n}\n.mt-4 {\n margin-top: 1rem;\n}\n.mt-6 {\n margin-top: 1.5rem;\n}\n.mt-8 {\n margin-top: 2rem;\n}\n.block {\n display: block;\n}\n.flex {\n display: flex;\n}\n.table {\n display: table;\n}\n.grid {\n display: grid;\n}\n.contents {\n display: contents;\n}\n.hidden {\n display: none;\n}\n.h-4 {\n height: 1rem;\n}\n.h-5 {\n height: 1.25rem;\n}\n.h-8 {\n height: 2rem;\n}\n.h-full {\n height: 100%;\n}\n.h-screen {\n height: 100vh;\n}\n.w-1\\/2 {\n width: 50%;\n}\n.w-1\\/3 {\n width: 33.333333%;\n}\n.w-2\\/3 {\n width: 66.666667%;\n}\n.w-4 {\n width: 1rem;\n}\n.w-full {\n width: 100%;\n}\n.w-screen {\n width: 100vw;\n}\n.max-w-32 {\n max-width: 8rem;\n}\n.shrink-0 {\n flex-shrink: 0;\n}\n.grow {\n flex-grow: 1;\n}\n.border-collapse {\n border-collapse: collapse;\n}\n.rotate-45 {\n --tw-rotate: 45deg;\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.transform {\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.cursor-pointer {\n cursor: pointer;\n}\n.grid-cols-2 {\n grid-template-columns: repeat(2, minmax(0, 1fr));\n}\n.grid-cols-3 {\n grid-template-columns: repeat(3, minmax(0, 1fr));\n}\n.flex-row {\n flex-direction: row;\n}\n.flex-col {\n flex-direction: column;\n}\n.items-end {\n align-items: flex-end;\n}\n.items-center {\n align-items: center;\n}\n.justify-start {\n justify-content: flex-start;\n}\n.justify-end {\n justify-content: flex-end;\n}\n.justify-center {\n justify-content: center;\n}\n.justify-between {\n justify-content: space-between;\n}\n.gap-1 {\n gap: 0.25rem;\n}\n.gap-2 {\n gap: 0.5rem;\n}\n.gap-4 {\n gap: 1rem;\n}\n.gap-6 {\n gap: 1.5rem;\n}\n.space-y-2 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(0.5rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(0.5rem * var(--tw-space-y-reverse));\n}\n.space-y-8 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(2rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(2rem * var(--tw-space-y-reverse));\n}\n.overflow-auto {\n overflow: auto;\n}\n.overflow-hidden {\n overflow: hidden;\n}\n.overflow-visible {\n overflow: visible;\n}\n.whitespace-nowrap {\n white-space: nowrap;\n}\n.text-nowrap {\n text-wrap: nowrap;\n}\n.rounded {\n border-radius: 0.25rem;\n}\n.rounded-full {\n border-radius: 9999px;\n}\n.rounded-md {\n border-radius: 0.375rem;\n}\n.border {\n border-width: 1px;\n}\n.border-solid {\n border-style: solid;\n}\n.border-gray-400 {\n --tw-border-opacity: 1;\n border-color: rgb(156 163 175 / var(--tw-border-opacity, 1));\n}\n.border-gray-500 {\n --tw-border-opacity: 1;\n border-color: rgb(107 114 128 / var(--tw-border-opacity, 1));\n}\n.border-slate-200 {\n --tw-border-opacity: 1;\n border-color: rgb(226 232 240 / var(--tw-border-opacity, 1));\n}\n.border-slate-300 {\n --tw-border-opacity: 1;\n border-color: rgb(203 213 225 / var(--tw-border-opacity, 1));\n}\n.bg-black {\n --tw-bg-opacity: 1;\n background-color: rgb(0 0 0 / var(--tw-bg-opacity, 1));\n}\n.bg-emerald-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(167 243 208 / var(--tw-bg-opacity, 1));\n}\n.bg-green-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(187 247 208 / var(--tw-bg-opacity, 1));\n}\n.bg-orange-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(254 215 170 / var(--tw-bg-opacity, 1));\n}\n.bg-red-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(254 202 202 / var(--tw-bg-opacity, 1));\n}\n.bg-slate-50 {\n --tw-bg-opacity: 1;\n background-color: rgb(248 250 252 / var(--tw-bg-opacity, 1));\n}\n.bg-white {\n --tw-bg-opacity: 1;\n background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));\n}\n.bg-yellow-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(254 240 138 / var(--tw-bg-opacity, 1));\n}\n.p-0 {\n padding: 0px;\n}\n.p-2 {\n padding: 0.5rem;\n}\n.p-4 {\n padding: 1rem;\n}\n.px-2 {\n padding-left: 0.5rem;\n padding-right: 0.5rem;\n}\n.px-4 {\n padding-left: 1rem;\n padding-right: 1rem;\n}\n.px-6 {\n padding-left: 1.5rem;\n padding-right: 1.5rem;\n}\n.py-1 {\n padding-top: 0.25rem;\n padding-bottom: 0.25rem;\n}\n.py-2 {\n padding-top: 0.5rem;\n padding-bottom: 0.5rem;\n}\n.py-4 {\n padding-top: 1rem;\n padding-bottom: 1rem;\n}\n.py-6 {\n padding-top: 1.5rem;\n padding-bottom: 1.5rem;\n}\n.pb-2 {\n padding-bottom: 0.5rem;\n}\n.pb-4 {\n padding-bottom: 1rem;\n}\n.pb-6 {\n padding-bottom: 1.5rem;\n}\n.pb-8 {\n padding-bottom: 2rem;\n}\n.pl-0 {\n padding-left: 0px;\n}\n.pl-2 {\n padding-left: 0.5rem;\n}\n.pl-4 {\n padding-left: 1rem;\n}\n.pt-1 {\n padding-top: 0.25rem;\n}\n.pt-2 {\n padding-top: 0.5rem;\n}\n.pt-4 {\n padding-top: 1rem;\n}\n.pt-5 {\n padding-top: 1.25rem;\n}\n.pt-6 {\n padding-top: 1.5rem;\n}\n.pt-8 {\n padding-top: 2rem;\n}\n.text-left {\n text-align: left;\n}\n.text-center {\n text-align: center;\n}\n.text-right {\n text-align: right;\n}\n.align-middle {\n vertical-align: middle;\n}\n.text-2xl {\n font-size: 1.5rem;\n line-height: 2rem;\n}\n.text-base {\n font-size: 1rem;\n line-height: 1.5rem;\n}\n.text-lg {\n font-size: 1.125rem;\n line-height: 1.75rem;\n}\n.text-sm {\n font-size: 0.875rem;\n line-height: 1.25rem;\n}\n.text-xl {\n font-size: 1.25rem;\n line-height: 1.75rem;\n}\n.text-xs {\n font-size: 0.75rem;\n line-height: 1rem;\n}\n.font-bold {\n font-weight: 700;\n}\n.font-medium {\n font-weight: 500;\n}\n.font-normal {\n font-weight: 400;\n}\n.capitalize {\n text-transform: capitalize;\n}\n.text-emerald-600 {\n --tw-text-opacity: 1;\n color: rgb(5 150 105 / var(--tw-text-opacity, 1));\n}\n.text-emerald-700 {\n --tw-text-opacity: 1;\n color: rgb(4 120 87 / var(--tw-text-opacity, 1));\n}\n.text-gray-600 {\n --tw-text-opacity: 1;\n color: rgb(75 85 99 / var(--tw-text-opacity, 1));\n}\n.text-gray-900 {\n --tw-text-opacity: 1;\n color: rgb(17 24 39 / var(--tw-text-opacity, 1));\n}\n.text-green-600 {\n --tw-text-opacity: 1;\n color: rgb(22 163 74 / var(--tw-text-opacity, 1));\n}\n.text-orange-500 {\n --tw-text-opacity: 1;\n color: rgb(249 115 22 / var(--tw-text-opacity, 1));\n}\n.text-red-500 {\n --tw-text-opacity: 1;\n color: rgb(239 68 68 / var(--tw-text-opacity, 1));\n}\n.text-slate-400 {\n --tw-text-opacity: 1;\n color: rgb(148 163 184 / var(--tw-text-opacity, 1));\n}\n.text-slate-500 {\n --tw-text-opacity: 1;\n color: rgb(100 116 139 / var(--tw-text-opacity, 1));\n}\n.text-white {\n --tw-text-opacity: 1;\n color: rgb(255 255 255 / var(--tw-text-opacity, 1));\n}\n.text-yellow-500 {\n --tw-text-opacity: 1;\n color: rgb(234 179 8 / var(--tw-text-opacity, 1));\n}\n.underline {\n text-decoration-line: underline;\n}\n.shadow {\n --tw-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);\n --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.shadow-md {\n --tw-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);\n --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.transition {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n.font-light {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n.font-medium {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n.font-bold {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n@media (min-width: 768px) {\n .sm\\:flex {\n display: flex;\n }\n .sm\\:hidden {\n display: none;\n }\n}\n* {\n margin: 0;\n padding: 0;\n box-sizing: border-box !important;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n line-height: 1.15;\n}\nbody {\n color: #232323;\n background-color: #f8fafc;\n}\nth {\n font-weight: normal;\n}\ncode {\n font-family: source-code-pro, Menlo, Monaco, Consolas, \"Courier New\", monospace;\n}\n@media only screen and (max-width: 768px) {\n select,\n textarea,\n input[type=\"text\"],\n input[type=\"password\"],\n input[type=\"datetime\"],\n input[type=\"datetime-local\"],\n input[type=\"date\"],\n input[type=\"month\"],\n input[type=\"time\"],\n input[type=\"week\"],\n input[type=\"number\"],\n input[type=\"email\"],\n input[type=\"url\"],\n input[type=\"search\"],\n input[type=\"tel\"],\n input[type=\"color\"] {\n font-size: 16px !important;\n }\n}\n@keyframes App-logo-spin {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}\n";
|
|
73
|
+
var css_248z = ".ant-collapse-header {\n cursor: default !important;\n padding: 0 !important;\n}\n.ant-tag {\n border: none;\n border-radius: 14px;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n font-weight: 500;\n white-space: nowrap;\n margin: 0;\n}\n.ant-tag-blue {\n color: #3b82f6 !important;\n background: #bfdbfe !important;\n}\n.ant-tag-green {\n color: #059669 !important;\n background: #a7f3d0 !important;\n}\n.ant-tag-red {\n color: #ef4444 !important;\n background: #fecaca !important;\n}\n.ant-tag-orange {\n color: #f97316 !important;\n background: #fed7aa !important;\n}\n.ant-tag-yellow {\n color: #f59e0b !important;\n background: #fde68a !important;\n}\n.ant-tag-purple {\n color: #8b5cf6 !important;\n background: #ddd6fe !important;\n}\n.ant-tag-black {\n color: white !important;\n background: black !important;\n}\n.ant-popover {\n z-index: 1050;\n}\n.ant-popover-inner-content {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n max-width: 300px;\n}\n.ant-popover-message-title {\n padding: 0;\n text-align: center;\n font-size: 1rem;\n}\n.ant-popover-buttons {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.ant-btn-primary:disabled {\n background: #eef0f2 !important;\n color: rgba(0, 0, 0, 0.25) !important;\n border: none;\n}\n.ant-btn {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n font-weight: 500;\n box-shadow: none;\n text-shadow: none;\n outline: none !important;\n line-height: 1;\n font-size: 0.875rem;\n font-weight: normal;\n}\n.ant-btn > span {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n.ant-btn-lg {\n height: 44px !important;\n}\n.ant-btn-default:disabled {\n border-color: rgba(113, 125, 148, 0.2) !important;\n}\n.ant-btn-link {\n border: none !important;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n.ant-btn-link > span {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n.ant-btn-link:disabled {\n background-color: transparent !important;\n color: #717d94 !important;\n}\n.ant-btn-link:disabled:hover {\n background-color: transparent !important;\n}\n.ant-input-affix-wrapper .ant-input-prefix {\n transition: color 0.3s;\n}\n.ant-form-item-label {\n text-transform: none !important;\n font-size: 0.75rem;\n padding-bottom: 2px !important;\n}\n.ant-form-item-label > label {\n width: 100%;\n color: #4b5563 !important;\n}\n.ant-form-item-explain-error {\n font-size: 11px;\n min-height: 11px;\n line-height: 11px;\n padding-top: 2px;\n}\n.ant-form-item {\n margin-bottom: 0;\n}\n.ant-notification {\n width: min-content;\n}\n.ant-notification-topRight {\n right: 0 !important;\n left: 0 !important;\n margin-left: auto !important;\n margin-right: auto !important;\n}\n.ant-notification-notice-wrapper {\n width: 350px !important;\n overflow: hidden !important;\n}\n.ant-notification-notice {\n padding: 16px !important;\n width: 350px !important;\n display: flex !important;\n box-shadow: 0px 6px 10px rgba(0, 0, 0, 0.08), 0px 1px 18px rgba(0, 0, 0, 0.08), 0px 3px 5px rgba(0, 0, 0, 0.16) !important;\n}\n.ant-notification-notice-description {\n padding: 0 14px 0 0 !important;\n color: #232323 !important;\n font-size: 14px !important;\n word-break: break-all !important;\n overflow-wrap: break-word !important;\n}\n.ant-notification-notice-success {\n background-color: #edfffa !important;\n}\n.ant-notification-notice-error {\n background-color: #fff8f4 !important;\n}\n.ant-notification-notice-error .ant-notification-notice-message {\n color: #ff6e1c !important;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji !important;\n font-weight: 500;\n}\n.ant-notification-notice-error .ant-notification-notice-icon {\n color: #ff6e1c;\n}\n.ant-notification-notice-success .ant-notification-notice-message {\n color: #00b76a !important;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji !important;\n font-weight: 500;\n}\n.ant-notification-notice-success .ant-notification-notice-icon {\n color: #00b76a !important;\n}\n.ant-notification-notice-message {\n margin-bottom: 0 !important;\n}\n.ant-notification-notice-close {\n top: 16px !important;\n right: 16px !important;\n}\n.ant-divider {\n margin: 0;\n}\n.ant-menu-submenu-popup > .ant-menu .ant-menu-item {\n display: flex !important;\n align-items: center !important;\n}\n.ant-menu-submenu::after {\n display: none !important;\n}\n.ant-drawer-title {\n font-weight: 400 !important;\n}\n.ant-drawer-header-title {\n flex-direction: row-reverse !important;\n align-items: start !important ;\n}\n.ant-drawer-close {\n margin-inline-end: 0 !important;\n}\n@media (min-width: 768px) {\n .ant-input,\n .ant-picker,\n .ant-select,\n .ant-input-affix-wrapper {\n font-size: 1rem !important;\n }\n .ant-drawer-header {\n padding-right: 1.5rem !important;\n padding-left: 1.5rem !important;\n }\n}\n:root {\n --row-background: #ffffff;\n --row-background-alternate: rgba(100, 116, 139, 0.04);\n --row-background-dark: #121212;\n --row-background-alternate-dark: #1e1e1e;\n}\n.plan-step-line {\n height: 1px;\n min-width: 128px;\n background: #717d94;\n}\n.plan-step-number {\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 9999px;\n border: 1px solid #717d94;\n background: white;\n width: 24px;\n height: 24px;\n color: #717d94;\n}\n.plan-step-number.active {\n border: none;\n color: white;\n background: #ff6e1c;\n}\n.hidden {\n display: none;\n}\n.cardElement {\n padding: 8px 11px;\n border: 1px solid #e5e7eb;\n background-color: white;\n font-family: Inter !important;\n}\n.tooltip {\n visibility: hidden;\n position: absolute !important;\n}\n.has-tooltip:hover .tooltip {\n visibility: visible;\n z-index: 100;\n}\n.show-on-hover {\n opacity: 0;\n}\n.show-on-hover-container:hover .show-on-hover {\n opacity: 1;\n}\n.pdf-only {\n display: none !important;\n}\n.notes p {\n margin: 0;\n padding: 0;\n padding-bottom: 0.25rem;\n}\n#form-element #finix-form-container .field-holder label {\n color: #717d94 !important;\n font-size: 12px !important;\n}\n#form-element #finix-form-container > *:first-child,\n#form-element #finix-form-container > *:last-child {\n margin-top: 0 !important;\n}\n#form-element #finix-form-container > *:not(:first-child):not(:last-child) {\n margin-top: 12px !important;\n}\n#form-element #finix-form-container .field-array > * {\n margin-top: 0 !important;\n}\n#form-element #finix-form-container .field-holder .field,\n#form-element #finix-form-container iframe {\n height: 34px !important;\n}\n#form-element #finix-form-container .field {\n margin-top: 0 !important;\n padding-top: 2px !important;\n}\n#form-element #finix-form-container .field-holder .validation {\n font-size: 11px !important;\n color: #ff4d4f !important;\n}\n.icon-path {\n transition: fill 0.3s;\n}\n.shadow-padding-x {\n padding-right: 1rem;\n padding-left: 1rem;\n}\n.shadow-padding-xb {\n padding-right: 1rem;\n padding-left: 1rem;\n padding-bottom: 0.5rem;\n}\n.content-container {\n width: 100%;\n margin: 0 auto;\n}\n@media (min-width: 1220px) {\n .content-container {\n width: 1220px !important;\n margin: 0 auto;\n }\n}\n@media (min-width: 768px) {\n .shadow-padding-x {\n padding-right: 2rem;\n padding-left: 2rem;\n }\n .shadow-padding-xb {\n padding-right: 2rem;\n padding-left: 2rem;\n padding-bottom: 0.5rem;\n }\n .sm\\:flex {\n display: flex !important;\n }\n .sm\\:hidden {\n display: none !important;\n }\n}\n.rotate-45,\n.transform {\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n}\n.shadow,\n.shadow-lg,\n.shadow-md,\n.shadow-none,\n.shadow-sm,\n.shadow-xl {\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n}\n.container {\n width: 100%;\n}\n@media (min-width: 768px) {\n .container {\n max-width: 768px;\n }\n}\n@media (min-width: 1024px) {\n .container {\n max-width: 1024px;\n }\n}\n@media (min-width: 1280px) {\n .container {\n max-width: 1280px;\n }\n}\n@media (min-width: 1536px) {\n .container {\n max-width: 1536px;\n }\n}\n.visible {\n visibility: visible;\n}\n.fixed {\n position: fixed;\n}\n.absolute {\n position: absolute;\n}\n.relative {\n position: relative;\n}\n.bottom-0 {\n bottom: 0px;\n}\n.left-0 {\n left: 0px;\n}\n.right-0 {\n right: 0px;\n}\n.top-0 {\n top: 0px;\n}\n.z-50 {\n z-index: 50;\n}\n.col-span-2 {\n grid-column: span 2 / span 2;\n}\n.col-span-3 {\n grid-column: span 3 / span 3;\n}\n.m-0 {\n margin: 0px;\n}\n.mx-4 {\n margin-left: 1rem;\n margin-right: 1rem;\n}\n.my-12 {\n margin-top: 3rem;\n margin-bottom: 3rem;\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.mb-4 {\n margin-bottom: 1rem;\n}\n.ml-2 {\n margin-left: 0.5rem;\n}\n.mr-8 {\n margin-right: 2rem;\n}\n.mt-1 {\n margin-top: 0.25rem;\n}\n.mt-2 {\n margin-top: 0.5rem;\n}\n.mt-4 {\n margin-top: 1rem;\n}\n.mt-6 {\n margin-top: 1.5rem;\n}\n.mt-8 {\n margin-top: 2rem;\n}\n.block {\n display: block;\n}\n.flex {\n display: flex;\n}\n.table {\n display: table;\n}\n.grid {\n display: grid;\n}\n.contents {\n display: contents;\n}\n.hidden {\n display: none;\n}\n.h-4 {\n height: 1rem;\n}\n.h-5 {\n height: 1.25rem;\n}\n.h-8 {\n height: 2rem;\n}\n.h-full {\n height: 100%;\n}\n.w-1\\/2 {\n width: 50%;\n}\n.w-1\\/3 {\n width: 33.333333%;\n}\n.w-2\\/3 {\n width: 66.666667%;\n}\n.w-4 {\n width: 1rem;\n}\n.w-full {\n width: 100%;\n}\n.max-w-32 {\n max-width: 8rem;\n}\n.flex-1 {\n flex: 1 1 0%;\n}\n.shrink-0 {\n flex-shrink: 0;\n}\n.grow {\n flex-grow: 1;\n}\n.border-collapse {\n border-collapse: collapse;\n}\n.rotate-45 {\n --tw-rotate: 45deg;\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.transform {\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.cursor-pointer {\n cursor: pointer;\n}\n.grid-cols-2 {\n grid-template-columns: repeat(2, minmax(0, 1fr));\n}\n.grid-cols-3 {\n grid-template-columns: repeat(3, minmax(0, 1fr));\n}\n.flex-row {\n flex-direction: row;\n}\n.flex-col {\n flex-direction: column;\n}\n.items-end {\n align-items: flex-end;\n}\n.items-center {\n align-items: center;\n}\n.justify-start {\n justify-content: flex-start;\n}\n.justify-end {\n justify-content: flex-end;\n}\n.justify-center {\n justify-content: center;\n}\n.justify-between {\n justify-content: space-between;\n}\n.gap-0 {\n gap: 0px;\n}\n.gap-1 {\n gap: 0.25rem;\n}\n.gap-2 {\n gap: 0.5rem;\n}\n.gap-4 {\n gap: 1rem;\n}\n.gap-6 {\n gap: 1.5rem;\n}\n.space-y-2 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(0.5rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(0.5rem * var(--tw-space-y-reverse));\n}\n.space-y-4 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(1rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(1rem * var(--tw-space-y-reverse));\n}\n.space-y-8 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(2rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(2rem * var(--tw-space-y-reverse));\n}\n.overflow-auto {\n overflow: auto;\n}\n.overflow-hidden {\n overflow: hidden;\n}\n.overflow-visible {\n overflow: visible;\n}\n.whitespace-nowrap {\n white-space: nowrap;\n}\n.text-nowrap {\n text-wrap: nowrap;\n}\n.rounded {\n border-radius: 0.25rem;\n}\n.rounded-full {\n border-radius: 9999px;\n}\n.rounded-md {\n border-radius: 0.375rem;\n}\n.border {\n border-width: 1px;\n}\n.border-solid {\n border-style: solid;\n}\n.border-gray-400 {\n --tw-border-opacity: 1;\n border-color: rgb(156 163 175 / var(--tw-border-opacity, 1));\n}\n.border-gray-500 {\n --tw-border-opacity: 1;\n border-color: rgb(107 114 128 / var(--tw-border-opacity, 1));\n}\n.border-slate-200 {\n --tw-border-opacity: 1;\n border-color: rgb(226 232 240 / var(--tw-border-opacity, 1));\n}\n.border-slate-300 {\n --tw-border-opacity: 1;\n border-color: rgb(203 213 225 / var(--tw-border-opacity, 1));\n}\n.border-slate-700 {\n --tw-border-opacity: 1;\n border-color: rgb(51 65 85 / var(--tw-border-opacity, 1));\n}\n.bg-black {\n --tw-bg-opacity: 1;\n background-color: rgb(0 0 0 / var(--tw-bg-opacity, 1));\n}\n.bg-emerald-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(167 243 208 / var(--tw-bg-opacity, 1));\n}\n.bg-green-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(187 247 208 / var(--tw-bg-opacity, 1));\n}\n.bg-orange-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(254 215 170 / var(--tw-bg-opacity, 1));\n}\n.bg-red-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(254 202 202 / var(--tw-bg-opacity, 1));\n}\n.bg-red-500 {\n --tw-bg-opacity: 1;\n background-color: rgb(239 68 68 / var(--tw-bg-opacity, 1));\n}\n.bg-slate-50 {\n --tw-bg-opacity: 1;\n background-color: rgb(248 250 252 / var(--tw-bg-opacity, 1));\n}\n.bg-white {\n --tw-bg-opacity: 1;\n background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));\n}\n.bg-yellow-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(254 240 138 / var(--tw-bg-opacity, 1));\n}\n.p-0 {\n padding: 0px;\n}\n.p-1 {\n padding: 0.25rem;\n}\n.p-2 {\n padding: 0.5rem;\n}\n.p-4 {\n padding: 1rem;\n}\n.p-8 {\n padding: 2rem;\n}\n.px-0 {\n padding-left: 0px;\n padding-right: 0px;\n}\n.px-2 {\n padding-left: 0.5rem;\n padding-right: 0.5rem;\n}\n.px-4 {\n padding-left: 1rem;\n padding-right: 1rem;\n}\n.px-6 {\n padding-left: 1.5rem;\n padding-right: 1.5rem;\n}\n.py-1 {\n padding-top: 0.25rem;\n padding-bottom: 0.25rem;\n}\n.py-2 {\n padding-top: 0.5rem;\n padding-bottom: 0.5rem;\n}\n.py-4 {\n padding-top: 1rem;\n padding-bottom: 1rem;\n}\n.py-6 {\n padding-top: 1.5rem;\n padding-bottom: 1.5rem;\n}\n.pb-2 {\n padding-bottom: 0.5rem;\n}\n.pb-4 {\n padding-bottom: 1rem;\n}\n.pb-6 {\n padding-bottom: 1.5rem;\n}\n.pb-8 {\n padding-bottom: 2rem;\n}\n.pl-0 {\n padding-left: 0px;\n}\n.pl-2 {\n padding-left: 0.5rem;\n}\n.pl-4 {\n padding-left: 1rem;\n}\n.pt-1 {\n padding-top: 0.25rem;\n}\n.pt-12 {\n padding-top: 3rem;\n}\n.pt-2 {\n padding-top: 0.5rem;\n}\n.pt-4 {\n padding-top: 1rem;\n}\n.pt-5 {\n padding-top: 1.25rem;\n}\n.pt-6 {\n padding-top: 1.5rem;\n}\n.pt-8 {\n padding-top: 2rem;\n}\n.text-left {\n text-align: left;\n}\n.text-center {\n text-align: center;\n}\n.text-right {\n text-align: right;\n}\n.align-middle {\n vertical-align: middle;\n}\n.text-2xl {\n font-size: 1.5rem;\n line-height: 2rem;\n}\n.text-base {\n font-size: 1rem;\n line-height: 1.5rem;\n}\n.text-lg {\n font-size: 1.125rem;\n line-height: 1.75rem;\n}\n.text-sm {\n font-size: 0.875rem;\n line-height: 1.25rem;\n}\n.text-xl {\n font-size: 1.25rem;\n line-height: 1.75rem;\n}\n.text-xs {\n font-size: 0.75rem;\n line-height: 1rem;\n}\n.font-bold {\n font-weight: 700;\n}\n.font-medium {\n font-weight: 500;\n}\n.font-normal {\n font-weight: 400;\n}\n.capitalize {\n text-transform: capitalize;\n}\n.text-emerald-600 {\n --tw-text-opacity: 1;\n color: rgb(5 150 105 / var(--tw-text-opacity, 1));\n}\n.text-emerald-700 {\n --tw-text-opacity: 1;\n color: rgb(4 120 87 / var(--tw-text-opacity, 1));\n}\n.text-gray-600 {\n --tw-text-opacity: 1;\n color: rgb(75 85 99 / var(--tw-text-opacity, 1));\n}\n.text-gray-900 {\n --tw-text-opacity: 1;\n color: rgb(17 24 39 / var(--tw-text-opacity, 1));\n}\n.text-green-600 {\n --tw-text-opacity: 1;\n color: rgb(22 163 74 / var(--tw-text-opacity, 1));\n}\n.text-orange-500 {\n --tw-text-opacity: 1;\n color: rgb(249 115 22 / var(--tw-text-opacity, 1));\n}\n.text-red-500 {\n --tw-text-opacity: 1;\n color: rgb(239 68 68 / var(--tw-text-opacity, 1));\n}\n.text-slate-400 {\n --tw-text-opacity: 1;\n color: rgb(148 163 184 / var(--tw-text-opacity, 1));\n}\n.text-slate-500 {\n --tw-text-opacity: 1;\n color: rgb(100 116 139 / var(--tw-text-opacity, 1));\n}\n.text-white {\n --tw-text-opacity: 1;\n color: rgb(255 255 255 / var(--tw-text-opacity, 1));\n}\n.text-yellow-500 {\n --tw-text-opacity: 1;\n color: rgb(234 179 8 / var(--tw-text-opacity, 1));\n}\n.underline {\n text-decoration-line: underline;\n}\n.shadow {\n --tw-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);\n --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.shadow-lg {\n --tw-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);\n --tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.shadow-md {\n --tw-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);\n --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.shadow-none {\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.shadow-sm {\n --tw-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n --tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.shadow-xl {\n --tw-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);\n --tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.transition {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n.font-light {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n.font-medium {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n.font-bold {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n@media (min-width: 768px) {\n .sm\\:flex {\n display: flex;\n }\n .sm\\:hidden {\n display: none;\n }\n}\n* {\n margin: 0;\n padding: 0;\n box-sizing: border-box !important;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n line-height: 1.15;\n}\nbody {\n color: #232323;\n background-color: #f8fafc;\n}\nth {\n font-weight: normal;\n}\ncode {\n font-family: source-code-pro, Menlo, Monaco, Consolas, \"Courier New\", monospace;\n}\n@media only screen and (max-width: 768px) {\n select,\n textarea,\n input[type=\"text\"],\n input[type=\"password\"],\n input[type=\"datetime\"],\n input[type=\"datetime-local\"],\n input[type=\"date\"],\n input[type=\"month\"],\n input[type=\"time\"],\n input[type=\"week\"],\n input[type=\"number\"],\n input[type=\"email\"],\n input[type=\"url\"],\n input[type=\"search\"],\n input[type=\"tel\"],\n input[type=\"color\"] {\n font-size: 16px !important;\n }\n}\n@keyframes App-logo-spin {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}\n";
|
|
74
74
|
styleInject(css_248z);
|
|
75
75
|
|
|
76
76
|
/******************************************************************************
|
|
@@ -1494,11 +1494,11 @@ var BankOutlined = function BankOutlined(props, ref) {
|
|
|
1494
1494
|
};
|
|
1495
1495
|
|
|
1496
1496
|
/** */
|
|
1497
|
-
var RefIcon$
|
|
1497
|
+
var RefIcon$5 = /*#__PURE__*/React__namespace.forwardRef(BankOutlined);
|
|
1498
1498
|
if (process.env.NODE_ENV !== 'production') {
|
|
1499
|
-
RefIcon$
|
|
1499
|
+
RefIcon$5.displayName = 'BankOutlined';
|
|
1500
1500
|
}
|
|
1501
|
-
var BankOutlined$1 = RefIcon$
|
|
1501
|
+
var BankOutlined$1 = RefIcon$5;
|
|
1502
1502
|
|
|
1503
1503
|
// This icon file is generated automatically.
|
|
1504
1504
|
var CheckCircleFilled$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 01-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z" } }] }, "name": "check-circle", "theme": "filled" };
|
|
@@ -1512,11 +1512,11 @@ var CheckCircleFilled = function CheckCircleFilled(props, ref) {
|
|
|
1512
1512
|
};
|
|
1513
1513
|
|
|
1514
1514
|
/** */
|
|
1515
|
-
var RefIcon$
|
|
1515
|
+
var RefIcon$4 = /*#__PURE__*/React__namespace.forwardRef(CheckCircleFilled);
|
|
1516
1516
|
if (process.env.NODE_ENV !== 'production') {
|
|
1517
|
-
RefIcon$
|
|
1517
|
+
RefIcon$4.displayName = 'CheckCircleFilled';
|
|
1518
1518
|
}
|
|
1519
|
-
var CheckCircleFilled$1 = RefIcon$
|
|
1519
|
+
var CheckCircleFilled$1 = RefIcon$4;
|
|
1520
1520
|
|
|
1521
1521
|
// This icon file is generated automatically.
|
|
1522
1522
|
var CloseOutlined$2 = { "icon": { "tag": "svg", "attrs": { "fill-rule": "evenodd", "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M799.86 166.31c.02 0 .04.02.08.06l57.69 57.7c.04.03.05.05.06.08a.12.12 0 010 .06c0 .03-.02.05-.06.09L569.93 512l287.7 287.7c.04.04.05.06.06.09a.12.12 0 010 .07c0 .02-.02.04-.06.08l-57.7 57.69c-.03.04-.05.05-.07.06a.12.12 0 01-.07 0c-.03 0-.05-.02-.09-.06L512 569.93l-287.7 287.7c-.04.04-.06.05-.09.06a.12.12 0 01-.07 0c-.02 0-.04-.02-.08-.06l-57.69-57.7c-.04-.03-.05-.05-.06-.07a.12.12 0 010-.07c0-.03.02-.05.06-.09L454.07 512l-287.7-287.7c-.04-.04-.05-.06-.06-.09a.12.12 0 010-.07c0-.02.02-.04.06-.08l57.7-57.69c.03-.04.05-.05.07-.06a.12.12 0 01.07 0c.03 0 .05.02.09.06L512 454.07l287.7-287.7c.04-.04.06-.05.09-.06a.12.12 0 01.07 0z" } }] }, "name": "close", "theme": "outlined" };
|
|
@@ -1530,11 +1530,29 @@ var CloseOutlined = function CloseOutlined(props, ref) {
|
|
|
1530
1530
|
};
|
|
1531
1531
|
|
|
1532
1532
|
/** */
|
|
1533
|
-
var RefIcon$
|
|
1533
|
+
var RefIcon$3 = /*#__PURE__*/React__namespace.forwardRef(CloseOutlined);
|
|
1534
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1535
|
+
RefIcon$3.displayName = 'CloseOutlined';
|
|
1536
|
+
}
|
|
1537
|
+
var CloseOutlined$1 = RefIcon$3;
|
|
1538
|
+
|
|
1539
|
+
// This icon file is generated automatically.
|
|
1540
|
+
var CreditCardOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zm-792 72h752v120H136V232zm752 560H136V440h752v352zm-237-64h165c4.4 0 8-3.6 8-8v-72c0-4.4-3.6-8-8-8H651c-4.4 0-8 3.6-8 8v72c0 4.4 3.6 8 8 8z" } }] }, "name": "credit-card", "theme": "outlined" };
|
|
1541
|
+
var CreditCardOutlinedSvg = CreditCardOutlined$2;
|
|
1542
|
+
|
|
1543
|
+
var CreditCardOutlined = function CreditCardOutlined(props, ref) {
|
|
1544
|
+
return /*#__PURE__*/React__namespace.createElement(AntdIcon, _extends({}, props, {
|
|
1545
|
+
ref: ref,
|
|
1546
|
+
icon: CreditCardOutlinedSvg
|
|
1547
|
+
}));
|
|
1548
|
+
};
|
|
1549
|
+
|
|
1550
|
+
/** */
|
|
1551
|
+
var RefIcon$2 = /*#__PURE__*/React__namespace.forwardRef(CreditCardOutlined);
|
|
1534
1552
|
if (process.env.NODE_ENV !== 'production') {
|
|
1535
|
-
RefIcon$2.displayName = '
|
|
1553
|
+
RefIcon$2.displayName = 'CreditCardOutlined';
|
|
1536
1554
|
}
|
|
1537
|
-
var
|
|
1555
|
+
var CreditCardOutlined$1 = RefIcon$2;
|
|
1538
1556
|
|
|
1539
1557
|
// This icon file is generated automatically.
|
|
1540
1558
|
var DownloadOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M505.7 661a8 8 0 0012.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z" } }] }, "name": "download", "theme": "outlined" };
|
|
@@ -1579,7 +1597,7 @@ var BrandContext = React.createContext({
|
|
|
1579
1597
|
topNavImageUrl: common.DEFAULT_TOP_NAV_IMAGE_URL,
|
|
1580
1598
|
});
|
|
1581
1599
|
|
|
1582
|
-
var MUTATION$9 = "{\n entityBranding {\n accentColor\n brandColor\n topNavImageUrl\n }\n }";
|
|
1600
|
+
var MUTATION$9 = "\n query entityBranding {\n entityBranding {\n accentColor\n brandColor\n topNavImageUrl\n }\n }\n";
|
|
1583
1601
|
var getBranding = function (_a) {
|
|
1584
1602
|
var token = _a.token, apiHost = _a.apiHost;
|
|
1585
1603
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -1611,7 +1629,7 @@ var BunnyContext = React.createContext({});
|
|
|
1611
1629
|
var extraQueryClient = new reactQuery.QueryClient();
|
|
1612
1630
|
// Every component shares similar props and functionality, which this wrapper handles.
|
|
1613
1631
|
function BunnyProvider(_a) {
|
|
1614
|
-
var accountId = _a.accountId, children = _a.children, _b = _a.darkMode, darkMode = _b === void 0 ? false : _b,
|
|
1632
|
+
var accountId = _a.accountId, children = _a.children, _b = _a.darkMode, darkMode = _b === void 0 ? false : _b, queryClient = _a.queryClient, apiHost = _a.apiHost, token = _a.token, window = _a.window, onTokenExpired = _a.onTokenExpired;
|
|
1615
1633
|
var graphQLClient = createGraphQLClient(token, apiHost || "");
|
|
1616
1634
|
var isMobile = common.useIsMobile();
|
|
1617
1635
|
var _c = React.useState(undefined), branding = _c[0], setBranding = _c[1];
|
|
@@ -1648,10 +1666,10 @@ function BunnyProvider(_a) {
|
|
|
1648
1666
|
accountId: accountId,
|
|
1649
1667
|
darkMode: darkMode,
|
|
1650
1668
|
graphQLClient: graphQLClient,
|
|
1651
|
-
onErrorNavigate: onErrorNavigate,
|
|
1652
1669
|
apiHost: apiHost,
|
|
1653
1670
|
token: token,
|
|
1654
1671
|
window: window,
|
|
1672
|
+
onTokenExpired: onTokenExpired,
|
|
1655
1673
|
} }, { 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: {
|
|
1656
1674
|
algorithm: darkMode
|
|
1657
1675
|
? theme__default["default"].darkAlgorithm
|
|
@@ -1768,27 +1786,39 @@ var InvoiceQuoteView = function (_a) {
|
|
|
1768
1786
|
var children = _a.children, formattedInvoice = _a.formattedInvoice, html = _a.html, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick, onDownloadError = _a.onDownloadError;
|
|
1769
1787
|
var downloadFile = useDownloadFile(formattedInvoice === null || formattedInvoice === void 0 ? void 0 : formattedInvoice.id, onDownloadError);
|
|
1770
1788
|
var secondaryColor = React.useContext(BrandContext).secondaryColor;
|
|
1771
|
-
var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
|
|
1789
|
+
var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
|
|
1790
|
+
var _c = React.useContext(InvoiceQuoteContext), shadow = _c.shadow, hideDownloadButton = _c.hideDownloadButton;
|
|
1772
1791
|
var isMobile = common.useIsMobile();
|
|
1773
|
-
|
|
1792
|
+
var buttonsVisible = formattedInvoice && (!hideDownloadButton || onBackButtonClick);
|
|
1793
|
+
return (jsxRuntime.jsxs("div", __assign({ className: "flex flex-col w-full grow ".concat(isMobile ? "overflow-hidden" : "") }, { children: [buttonsVisible ? (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: {
|
|
1774
1794
|
color: secondaryColor,
|
|
1775
|
-
}, type: "link" }, { children: backButtonName || "Back" }))) : null }), jsxRuntime.jsx(antd.Button, __assign({ icon: jsxRuntime.jsx(DownloadOutlined$1, {}), onClick: function () {
|
|
1795
|
+
}, type: "link" }, { children: backButtonName || "Back" }))) : null }), !hideDownloadButton ? (jsxRuntime.jsx(antd.Button, __assign({ icon: jsxRuntime.jsx(DownloadOutlined$1, {}), onClick: function () {
|
|
1776
1796
|
return downloadFile(apiHost + "/api/pdf/invoice/" + formattedInvoice.id, token);
|
|
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: {
|
|
1797
|
+
} }, { children: "Download" }))) : null] }))) : 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 ".concat(shadow ? shadow : "shadow-md", " rounded-md"), style: {
|
|
1778
1798
|
minWidth: "750px",
|
|
1779
1799
|
} }, { children: [jsxRuntime.jsx(interweave.Markup, { content: html }), children] })))] })));
|
|
1780
1800
|
};
|
|
1781
1801
|
var templateObject_1$8;
|
|
1782
1802
|
|
|
1803
|
+
var quoteMetaDescription = function (vendorName) {
|
|
1804
|
+
return "View this quote on the ".concat(vendorName, " customer portal. Powered by Bunny");
|
|
1805
|
+
};
|
|
1806
|
+
var quoteMetaTitle = function (_a) {
|
|
1807
|
+
var documentName = _a.documentName, vendorName = _a.vendorName;
|
|
1808
|
+
return vendorName + " " + documentName;
|
|
1809
|
+
};
|
|
1810
|
+
|
|
1811
|
+
var PaymentContext = React.createContext({});
|
|
1812
|
+
|
|
1783
1813
|
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}";
|
|
1784
|
-
var usePaymentMethod = function (graphQLClient) {
|
|
1814
|
+
var usePaymentMethod = function (graphQLClient, accountId) {
|
|
1785
1815
|
var result = reactQuery.useQuery({
|
|
1786
1816
|
queryKey: common.QueryKeyFactory.default.accountPaymentMethodKey,
|
|
1787
1817
|
queryFn: function () {
|
|
1788
1818
|
return graphQLClient
|
|
1789
1819
|
.request(paymentMethodsQuery, {
|
|
1790
1820
|
first: 1,
|
|
1791
|
-
filter: "disabled is false",
|
|
1821
|
+
filter: "disabled is false".concat(accountId ? " and accountId is ".concat(accountId) : ""),
|
|
1792
1822
|
})
|
|
1793
1823
|
.then(function (data) {
|
|
1794
1824
|
var _a, _b;
|
|
@@ -1801,40 +1831,151 @@ var usePaymentMethod = function (graphQLClient) {
|
|
|
1801
1831
|
return result;
|
|
1802
1832
|
};
|
|
1803
1833
|
|
|
1804
|
-
var
|
|
1805
|
-
|
|
1834
|
+
var usePlugins = function (_a) {
|
|
1835
|
+
var entityId = _a.entityId, apiHost = _a.apiHost, token = _a.token;
|
|
1836
|
+
var response = reactQuery.useQuery({
|
|
1837
|
+
queryKey: common.QueryKeyFactory.default.pluginsKey,
|
|
1838
|
+
queryFn: function () {
|
|
1839
|
+
var plugins = common.getPlugins({
|
|
1840
|
+
entityId: entityId,
|
|
1841
|
+
token: token,
|
|
1842
|
+
apiHost: apiHost,
|
|
1843
|
+
});
|
|
1844
|
+
return plugins;
|
|
1845
|
+
},
|
|
1846
|
+
enabled: Boolean(entityId),
|
|
1847
|
+
});
|
|
1848
|
+
return response;
|
|
1806
1849
|
};
|
|
1807
1850
|
|
|
1808
|
-
var
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1851
|
+
var filterPaymentPlugins = function (plugins) {
|
|
1852
|
+
return plugins === null || plugins === void 0 ? void 0 : plugins.filter(function (plugin) {
|
|
1853
|
+
var _a, _b, _c, _d;
|
|
1854
|
+
return ((_a = plugin.type) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === "payment" &&
|
|
1855
|
+
((_b = plugin.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === "valid" &&
|
|
1856
|
+
((_d = (_c = plugin.components) === null || _c === void 0 ? void 0 : _c.frontend) === null || _d === void 0 ? void 0 : _d.length);
|
|
1857
|
+
});
|
|
1858
|
+
};
|
|
1859
|
+
var usePaymentPlugins = function (_a) {
|
|
1860
|
+
var entityId = _a.entityId, apiHost = _a.apiHost, token = _a.token;
|
|
1861
|
+
var _b = usePlugins({
|
|
1862
|
+
entityId: entityId,
|
|
1863
|
+
apiHost: apiHost,
|
|
1864
|
+
token: token,
|
|
1865
|
+
}), plugins = _b.data, isFetched = _b.isFetched;
|
|
1866
|
+
var paymentPlugins = filterPaymentPlugins(Array.isArray(plugins) ? plugins : []);
|
|
1867
|
+
var paymentMethodAllowedPlugins = paymentPlugins === null || paymentPlugins === void 0 ? void 0 : paymentPlugins.filter(function (plugin) {
|
|
1868
|
+
var _a, _b;
|
|
1869
|
+
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"); });
|
|
1870
|
+
});
|
|
1871
|
+
return {
|
|
1872
|
+
paymentPlugins: paymentPlugins,
|
|
1873
|
+
paymentMethodAllowedPlugins: paymentMethodAllowedPlugins,
|
|
1874
|
+
isFetched: isFetched,
|
|
1875
|
+
};
|
|
1818
1876
|
};
|
|
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) {
|
|
1820
|
-
var $brandColor = _a.$brandColor, $selected = _a.$selected;
|
|
1821
|
-
return $selected &&
|
|
1822
|
-
"\n border-color: ".concat($brandColor, ";\n ");
|
|
1823
|
-
}, function (_a) {
|
|
1824
|
-
var $brandColor = _a.$brandColor;
|
|
1825
|
-
return $brandColor;
|
|
1826
|
-
});
|
|
1827
|
-
var templateObject_1$7;
|
|
1828
1877
|
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
var
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1878
|
+
// Simulated payment creation and confirmation
|
|
1879
|
+
var confirmPayment = function (_a) {
|
|
1880
|
+
var amount = _a.amount, currency = _a.currency;
|
|
1881
|
+
return { token: "DemoPayTestToken", amount: amount, currency: currency };
|
|
1882
|
+
};
|
|
1883
|
+
var DIGIT_REGEX = /\d/;
|
|
1884
|
+
var isDigit = function (char) { return DIGIT_REGEX.test(char); };
|
|
1885
|
+
var isDeletion = function (char) { return [8, 46].includes(char); }; // Backspace or Delete
|
|
1886
|
+
var isNavigation = function (char) { return [9, 37, 38, 39, 40].includes(char); }; // Tab, Arrows
|
|
1887
|
+
var isModifier = function (char) { return [16, 17, 18].includes(char); }; // Shift, Ctrl, Alt
|
|
1888
|
+
var isValidKey = function (code) {
|
|
1889
|
+
return isDeletion(code) || isNavigation(code) || isModifier(code);
|
|
1890
|
+
};
|
|
1891
|
+
var isValidExpiry = function (expiry) {
|
|
1892
|
+
var month = parseInt(expiry.substring(0, 2), 10);
|
|
1893
|
+
var year = parseInt(expiry.substring(2, 4), 10) + 2000;
|
|
1894
|
+
if (isNaN(month) || isNaN(year))
|
|
1895
|
+
return false;
|
|
1896
|
+
if (month < 1 || month > 12)
|
|
1897
|
+
return false;
|
|
1898
|
+
return true;
|
|
1899
|
+
};
|
|
1900
|
+
var isCardExpired = function (expiry) {
|
|
1901
|
+
var month = parseInt(expiry.substring(0, 2), 10);
|
|
1902
|
+
var year = parseInt(expiry.substring(2, 4), 10) + 2000;
|
|
1903
|
+
var expiryDate = new Date(year, month, 1);
|
|
1904
|
+
return expiryDate < new Date();
|
|
1905
|
+
};
|
|
1906
|
+
var formatCardExpiry = function (cardExpiry) {
|
|
1907
|
+
if (cardExpiry.length <= 2)
|
|
1908
|
+
return cardExpiry;
|
|
1909
|
+
return cardExpiry.substring(0, 2) + "/" + cardExpiry.substring(2);
|
|
1910
|
+
};
|
|
1911
|
+
// removes spaces from a credit card number
|
|
1912
|
+
var unformatCardNumber = function (cardNumber) {
|
|
1913
|
+
var cardNumberArray = cardNumber.split("");
|
|
1914
|
+
var unformattedCardNumberArray = cardNumberArray.filter(function (character) { return character !== " "; });
|
|
1915
|
+
return unformattedCardNumberArray.join("");
|
|
1837
1916
|
};
|
|
1917
|
+
var storePayment = function (options, plugin, apiHost, accountId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1918
|
+
var testCreditCardNumber, testCreditCardCvc, testCreditCardExpirationDate, token, response;
|
|
1919
|
+
return __generator(this, function (_a) {
|
|
1920
|
+
switch (_a.label) {
|
|
1921
|
+
case 0:
|
|
1922
|
+
testCreditCardNumber = options.testCreditCardNumber, testCreditCardCvc = options.testCreditCardCvc, testCreditCardExpirationDate = options.testCreditCardExpirationDate, token = options.token;
|
|
1923
|
+
return [4 /*yield*/, common.invokePlugin({
|
|
1924
|
+
method: "store_payment_method",
|
|
1925
|
+
plugin: plugin,
|
|
1926
|
+
payload: {
|
|
1927
|
+
test_credit_card_number: testCreditCardNumber,
|
|
1928
|
+
test_credit_card_cvc: testCreditCardCvc,
|
|
1929
|
+
test_credit_card_expiration_date: testCreditCardExpirationDate,
|
|
1930
|
+
account_id: accountId,
|
|
1931
|
+
},
|
|
1932
|
+
token: token,
|
|
1933
|
+
apiHost: apiHost,
|
|
1934
|
+
})];
|
|
1935
|
+
case 1:
|
|
1936
|
+
response = _a.sent();
|
|
1937
|
+
if ((response === null || response === void 0 ? void 0 : response.status) !== "success")
|
|
1938
|
+
throw new Error(response === null || response === void 0 ? void 0 : response.message);
|
|
1939
|
+
return [2 /*return*/, response];
|
|
1940
|
+
}
|
|
1941
|
+
});
|
|
1942
|
+
}); };
|
|
1943
|
+
|
|
1944
|
+
function usePay$1(_a) {
|
|
1945
|
+
var _this = this;
|
|
1946
|
+
var onPaymentSuccess = _a.onPaymentSuccess, onPaymentError = _a.onPaymentError, quote = _a.quote, invoice = _a.invoice;
|
|
1947
|
+
var pay = function (_a) {
|
|
1948
|
+
var plugin = _a.plugin, savePaymentMethod = _a.savePaymentMethod;
|
|
1949
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
1950
|
+
var amountDue, currencyId, response;
|
|
1951
|
+
return __generator(this, function (_b) {
|
|
1952
|
+
amountDue = quote ? getQuoteAmountDue(quote) : invoice === null || invoice === void 0 ? void 0 : invoice.amountDue;
|
|
1953
|
+
currencyId = (quote === null || quote === void 0 ? void 0 : quote.currencyId) || (invoice === null || invoice === void 0 ? void 0 : invoice.currency);
|
|
1954
|
+
if (!amountDue || !currencyId) {
|
|
1955
|
+
throw new Error("No amount or currencyId");
|
|
1956
|
+
}
|
|
1957
|
+
try {
|
|
1958
|
+
response = confirmPayment({
|
|
1959
|
+
amount: amountDue,
|
|
1960
|
+
currency: currencyId,
|
|
1961
|
+
});
|
|
1962
|
+
onPaymentSuccess({
|
|
1963
|
+
pluginPaymentResponse: {
|
|
1964
|
+
plugin: plugin,
|
|
1965
|
+
token: response.token,
|
|
1966
|
+
savePaymentMethod: savePaymentMethod,
|
|
1967
|
+
},
|
|
1968
|
+
});
|
|
1969
|
+
}
|
|
1970
|
+
catch (error) {
|
|
1971
|
+
onPaymentError === null || onPaymentError === void 0 ? void 0 : onPaymentError(error);
|
|
1972
|
+
}
|
|
1973
|
+
return [2 /*return*/];
|
|
1974
|
+
});
|
|
1975
|
+
});
|
|
1976
|
+
};
|
|
1977
|
+
return { pay: pay };
|
|
1978
|
+
}
|
|
1838
1979
|
|
|
1839
1980
|
var createPaymentMethod = function (_a) {
|
|
1840
1981
|
var paymentMethodId = _a.paymentMethodId, plugin = _a.plugin, token = _a.token, apiHost = _a.apiHost, accountId = _a.accountId;
|
|
@@ -1873,7 +2014,7 @@ var createSetupIntent = function (plugin, token, apiHost, accountId) {
|
|
|
1873
2014
|
});
|
|
1874
2015
|
};
|
|
1875
2016
|
var createPaymentIntent = function (_a) {
|
|
1876
|
-
var payable = _a.payable, savePaymentMethod = _a.savePaymentMethod, memo = _a.memo, plugin = _a.plugin, token = _a.token, apiHost = _a.apiHost
|
|
2017
|
+
var payable = _a.payable, savePaymentMethod = _a.savePaymentMethod, memo = _a.memo, plugin = _a.plugin, token = _a.token, apiHost = _a.apiHost;
|
|
1877
2018
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
1878
2019
|
var payload, response;
|
|
1879
2020
|
return __generator(this, function (_b) {
|
|
@@ -1883,7 +2024,6 @@ var createPaymentIntent = function (_a) {
|
|
|
1883
2024
|
payable_id: payable.payableId,
|
|
1884
2025
|
save_payment_method: savePaymentMethod,
|
|
1885
2026
|
memo: memo,
|
|
1886
|
-
account_id: accountId,
|
|
1887
2027
|
};
|
|
1888
2028
|
return [4 /*yield*/, common.invokePlugin({
|
|
1889
2029
|
plugin: plugin,
|
|
@@ -1901,21 +2041,37 @@ var createPaymentIntent = function (_a) {
|
|
|
1901
2041
|
});
|
|
1902
2042
|
});
|
|
1903
2043
|
};
|
|
1904
|
-
var fetchStripeKey = function (plugin, token, apiHost, accountId) {
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
2044
|
+
var fetchStripeKey = function (plugin, token, apiHost, accountId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2045
|
+
var response;
|
|
2046
|
+
return __generator(this, function (_a) {
|
|
2047
|
+
switch (_a.label) {
|
|
2048
|
+
case 0: return [4 /*yield*/, common.invokePlugin({
|
|
2049
|
+
plugin: plugin,
|
|
2050
|
+
method: "retrieve_config",
|
|
2051
|
+
token: token,
|
|
2052
|
+
apiHost: apiHost,
|
|
2053
|
+
payload: {
|
|
2054
|
+
account_id: accountId,
|
|
2055
|
+
},
|
|
2056
|
+
})];
|
|
2057
|
+
case 1:
|
|
2058
|
+
response = _a.sent();
|
|
2059
|
+
return [2 /*return*/, response];
|
|
2060
|
+
}
|
|
1913
2061
|
});
|
|
1914
|
-
};
|
|
2062
|
+
}); };
|
|
1915
2063
|
pure.loadStripe.setLoadParameters({ advancedFraudSignals: false });
|
|
1916
2064
|
var useStripePlugin = function (plugin, token, apiHost, accountId) {
|
|
1917
2065
|
var _a = React.useState(null), stripe = _a[0], setStripe = _a[1];
|
|
1918
2066
|
var showErrorNotification = common.useErrorNotification();
|
|
2067
|
+
var options = {
|
|
2068
|
+
mode: "setup",
|
|
2069
|
+
// TODO: Fetch currency from the entity/account
|
|
2070
|
+
currency: "usd",
|
|
2071
|
+
setupFutureUsage: "off_session",
|
|
2072
|
+
};
|
|
2073
|
+
if (!plugin)
|
|
2074
|
+
return { stripe: null, options: options };
|
|
1919
2075
|
React.useEffect(function () {
|
|
1920
2076
|
fetchStripeKey(plugin, token, apiHost || "", accountId)
|
|
1921
2077
|
.then(function (_a) {
|
|
@@ -1928,293 +2084,253 @@ var useStripePlugin = function (plugin, token, apiHost, accountId) {
|
|
|
1928
2084
|
});
|
|
1929
2085
|
// eslint-disable-next-line
|
|
1930
2086
|
}, [plugin, token]);
|
|
1931
|
-
return stripe;
|
|
1932
|
-
};
|
|
1933
|
-
|
|
1934
|
-
var PaymentContext = React.createContext({});
|
|
1935
|
-
|
|
1936
|
-
var CheckoutFooter = function (_a) {
|
|
1937
|
-
var amountDue = _a.amountDue, currencyId = _a.currencyId, isSaving = _a.isSaving, onPaymentSubmit = _a.onPaymentSubmit, onlySavePaymentMethod = _a.onlySavePaymentMethod, noPadding = _a.noPadding;
|
|
1938
|
-
React.useContext(BunnyContext).window;
|
|
1939
|
-
var isMobile = common.useIsMobile();
|
|
1940
|
-
var displayPayButtonNameAnyways = React.useContext(PaymentContext).displayPayButtonNameAnyways;
|
|
1941
|
-
var buttonName = function () {
|
|
1942
|
-
return onlySavePaymentMethod && !displayPayButtonNameAnyways
|
|
1943
|
-
? isSaving
|
|
1944
|
-
? "Saving"
|
|
1945
|
-
: "Save"
|
|
1946
|
-
: isSaving
|
|
1947
|
-
? "Paying"
|
|
1948
|
-
: "Pay";
|
|
1949
|
-
};
|
|
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
|
|
1951
|
-
? " ".concat(common.formatCurrency(amountDue, currencyId))
|
|
1952
|
-
: "") })) })));
|
|
2087
|
+
return { stripe: stripe, options: options };
|
|
1953
2088
|
};
|
|
1954
2089
|
|
|
1955
|
-
|
|
1956
|
-
var
|
|
2090
|
+
function usePay(_a) {
|
|
2091
|
+
var _this = this;
|
|
2092
|
+
var onPaymentSuccess = _a.onPaymentSuccess, onPaymentError = _a.onPaymentError, quote = _a.quote, invoice = _a.invoice;
|
|
1957
2093
|
// Hooks
|
|
1958
2094
|
var elements = reactStripeJs.useElements();
|
|
1959
2095
|
var stripe = reactStripeJs.useStripe();
|
|
1960
|
-
var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
2096
|
+
var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
|
|
2097
|
+
var pay = function (_a) {
|
|
2098
|
+
var plugin = _a.plugin;
|
|
2099
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
2100
|
+
var payable, submitError, paymentIntent, clientSecret, response, paymentIntentId, error_1;
|
|
2101
|
+
var _b;
|
|
2102
|
+
return __generator(this, function (_c) {
|
|
2103
|
+
switch (_c.label) {
|
|
2104
|
+
case 0:
|
|
2105
|
+
payable = (quote || invoice);
|
|
2106
|
+
_c.label = 1;
|
|
2107
|
+
case 1:
|
|
2108
|
+
_c.trys.push([1, 5, , 6]);
|
|
2109
|
+
if (!stripe)
|
|
2110
|
+
throw new Error("Form is not ready");
|
|
2111
|
+
if (!elements)
|
|
2112
|
+
throw new Error("Elements couldn't be retrieved");
|
|
2113
|
+
return [4 /*yield*/, elements.submit()];
|
|
2114
|
+
case 2:
|
|
2115
|
+
submitError = (_c.sent()).error;
|
|
2116
|
+
if (submitError)
|
|
2117
|
+
throw new Error(submitError.message);
|
|
2118
|
+
return [4 /*yield*/, createPaymentIntent({
|
|
2119
|
+
payable: payable,
|
|
2120
|
+
savePaymentMethod: true,
|
|
2121
|
+
plugin: plugin,
|
|
2122
|
+
token: token,
|
|
2123
|
+
apiHost: apiHost || "",
|
|
2124
|
+
})];
|
|
2125
|
+
case 3:
|
|
2126
|
+
paymentIntent = _c.sent();
|
|
2127
|
+
clientSecret = paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.client_secret;
|
|
2128
|
+
return [4 /*yield*/, stripe.confirmPayment({
|
|
2129
|
+
elements: elements,
|
|
2130
|
+
clientSecret: clientSecret,
|
|
2131
|
+
redirect: "if_required",
|
|
2132
|
+
confirmParams: {
|
|
2133
|
+
return_url: window.location.href,
|
|
2134
|
+
},
|
|
2135
|
+
})];
|
|
2136
|
+
case 4:
|
|
2137
|
+
response = _c.sent();
|
|
2138
|
+
// See https://stripe.com/docs/payments/save-during-payment?platform=web#web-submit-payment
|
|
2139
|
+
if (response.error)
|
|
2140
|
+
throw new Error(response.error.message);
|
|
2141
|
+
paymentIntentId = (_b = response.paymentIntent) === null || _b === void 0 ? void 0 : _b.id;
|
|
2142
|
+
if (!paymentIntentId)
|
|
2143
|
+
throw new Error("Payment intent couldn't be retrieved");
|
|
2144
|
+
onPaymentSuccess === null || onPaymentSuccess === void 0 ? void 0 : onPaymentSuccess({
|
|
2145
|
+
pluginPaymentResponse: {
|
|
2146
|
+
plugin: plugin,
|
|
2147
|
+
token: paymentIntentId,
|
|
2148
|
+
savePaymentMethod: true,
|
|
2149
|
+
},
|
|
2150
|
+
});
|
|
2151
|
+
return [3 /*break*/, 6];
|
|
2152
|
+
case 5:
|
|
2153
|
+
error_1 = _c.sent();
|
|
2154
|
+
onPaymentError === null || onPaymentError === void 0 ? void 0 : onPaymentError(error_1);
|
|
2155
|
+
return [3 /*break*/, 6];
|
|
2156
|
+
case 6: return [2 /*return*/];
|
|
2157
|
+
}
|
|
2158
|
+
});
|
|
2159
|
+
});
|
|
2160
|
+
};
|
|
2161
|
+
return { pay: pay };
|
|
2162
|
+
}
|
|
2163
|
+
|
|
2164
|
+
var showErrorNotification$1 = common.useErrorNotification();
|
|
2165
|
+
var ActualCheckoutFooter = function (_a) {
|
|
2166
|
+
var quote = _a.quote, invoice = _a.invoice, onPaymentSuccess = _a.onPaymentSuccess, noPadding = _a.noPadding, plugin = _a.plugin;
|
|
2167
|
+
var isMobile = common.useIsMobile();
|
|
2168
|
+
var _b = React.useState(false), isPaying = _b[0], setIsPaying = _b[1];
|
|
2169
|
+
var amountDue = quote ? getQuoteAmountDue(quote) : invoice === null || invoice === void 0 ? void 0 : invoice.amountDue;
|
|
2170
|
+
var currencyId = (quote === null || quote === void 0 ? void 0 : quote.currencyId) || (invoice === null || invoice === void 0 ? void 0 : invoice.currency);
|
|
2171
|
+
// Payment hooks
|
|
2172
|
+
var payDemoPay = usePay$1({
|
|
2173
|
+
onPaymentSuccess: function (response) {
|
|
2174
|
+
onPaymentSuccess(response);
|
|
2175
|
+
},
|
|
2176
|
+
onPaymentError: function (error) {
|
|
2177
|
+
setIsPaying(false);
|
|
2178
|
+
showErrorNotification$1(error);
|
|
2179
|
+
},
|
|
2180
|
+
quote: quote,
|
|
2181
|
+
invoice: invoice,
|
|
2182
|
+
}).pay;
|
|
2183
|
+
var payStripe = usePay({
|
|
2184
|
+
onPaymentSuccess: function (response) {
|
|
2185
|
+
onPaymentSuccess(response);
|
|
2186
|
+
},
|
|
2187
|
+
onPaymentError: function (error) {
|
|
2188
|
+
setIsPaying(false);
|
|
2189
|
+
showErrorNotification$1(error);
|
|
2190
|
+
},
|
|
2191
|
+
quote: quote,
|
|
2192
|
+
invoice: invoice,
|
|
2193
|
+
}).pay;
|
|
2194
|
+
var handlePaymentSubmit = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
1966
2195
|
var _a;
|
|
1967
|
-
|
|
1968
|
-
|
|
2196
|
+
var _b, _c;
|
|
2197
|
+
return __generator(this, function (_d) {
|
|
2198
|
+
switch (_d.label) {
|
|
1969
2199
|
case 0:
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
case 1:
|
|
1978
|
-
submitError = (_b.sent()).error;
|
|
1979
|
-
if (submitError)
|
|
1980
|
-
throw new Error(submitError.message);
|
|
1981
|
-
return [4 /*yield*/, createPaymentIntent({
|
|
1982
|
-
payable: payable,
|
|
1983
|
-
savePaymentMethod: true,
|
|
1984
|
-
plugin: plugin,
|
|
1985
|
-
token: token,
|
|
1986
|
-
apiHost: apiHost || "",
|
|
1987
|
-
accountId: accountId,
|
|
1988
|
-
})];
|
|
1989
|
-
case 2:
|
|
1990
|
-
paymentIntent = _b.sent();
|
|
1991
|
-
clientSecret = paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.client_secret;
|
|
1992
|
-
return [4 /*yield*/, stripe.confirmPayment({
|
|
1993
|
-
elements: elements,
|
|
1994
|
-
clientSecret: clientSecret,
|
|
1995
|
-
redirect: "if_required",
|
|
1996
|
-
confirmParams: {
|
|
1997
|
-
return_url: window.location.href,
|
|
1998
|
-
},
|
|
1999
|
-
})];
|
|
2000
|
-
case 3:
|
|
2001
|
-
response = _b.sent();
|
|
2002
|
-
// See https://stripe.com/docs/payments/save-during-payment?platform=web#web-submit-payment
|
|
2003
|
-
if (response.error)
|
|
2004
|
-
throw new Error(response.error.message);
|
|
2005
|
-
paymentIntentId = (_a = response.paymentIntent) === null || _a === void 0 ? void 0 : _a.id;
|
|
2006
|
-
if (!paymentIntentId)
|
|
2007
|
-
throw new Error("Payment intent couldn't be retrieved");
|
|
2008
|
-
onPaymentSuccess({
|
|
2009
|
-
pluginPaymentResponse: {
|
|
2010
|
-
plugin: plugin,
|
|
2011
|
-
token: paymentIntentId,
|
|
2012
|
-
savePaymentMethod: true,
|
|
2013
|
-
},
|
|
2014
|
-
});
|
|
2200
|
+
if (!plugin)
|
|
2201
|
+
return [2 /*return*/];
|
|
2202
|
+
_a = (_c = (_b = plugin === null || plugin === void 0 ? void 0 : plugin.components) === null || _b === void 0 ? void 0 : _b.frontend) === null || _c === void 0 ? void 0 : _c[0].name;
|
|
2203
|
+
switch (_a) {
|
|
2204
|
+
case "StripePayment": return [3 /*break*/, 1];
|
|
2205
|
+
case "DemoPayPayment": return [3 /*break*/, 3];
|
|
2206
|
+
}
|
|
2015
2207
|
return [3 /*break*/, 5];
|
|
2208
|
+
case 1: return [4 /*yield*/, payStripe({
|
|
2209
|
+
plugin: plugin,
|
|
2210
|
+
})];
|
|
2211
|
+
case 2:
|
|
2212
|
+
_d.sent();
|
|
2213
|
+
return [3 /*break*/, 6];
|
|
2214
|
+
case 3: return [4 /*yield*/, payDemoPay({
|
|
2215
|
+
plugin: plugin,
|
|
2216
|
+
savePaymentMethod: false,
|
|
2217
|
+
})];
|
|
2016
2218
|
case 4:
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
case
|
|
2219
|
+
_d.sent();
|
|
2220
|
+
return [3 /*break*/, 6];
|
|
2221
|
+
case 5: return [3 /*break*/, 6];
|
|
2222
|
+
case 6: return [2 /*return*/];
|
|
2021
2223
|
}
|
|
2022
2224
|
});
|
|
2023
2225
|
}); };
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
// name: currentUser.name,
|
|
2029
|
-
// phone: currentUser.phone,
|
|
2030
|
-
// },
|
|
2031
|
-
// },
|
|
2032
|
-
layout: { type: "accordion" },
|
|
2033
|
-
};
|
|
2034
|
-
return (jsxRuntime.jsxs("form", { children: [jsxRuntime.jsx(reactStripeJs.PaymentElement, { options: options }), jsxRuntime.jsx(CheckoutFooter, { amountDue: payable.amountDue, currencyId: payable.currencyId.toLowerCase(), isSaving: isSaving, onPaymentSubmit: onPaymentSubmit, onlySavePaymentMethod: false })] }));
|
|
2226
|
+
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: isPaying, onClick: function () {
|
|
2227
|
+
setIsPaying(true);
|
|
2228
|
+
handlePaymentSubmit();
|
|
2229
|
+
}, size: isMobile ? "large" : "middle", type: "primary" }, { children: "".concat(isPaying ? "Paying" : "Pay", " ").concat(amountDue && currencyId ? common.formatCurrency(amountDue, currencyId) : "") })) })));
|
|
2035
2230
|
};
|
|
2036
|
-
|
|
2037
|
-
var
|
|
2038
|
-
var
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
var
|
|
2042
|
-
var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
|
|
2231
|
+
var CheckoutFooter = function (_a) {
|
|
2232
|
+
var _b, _c;
|
|
2233
|
+
var quote = _a.quote, invoice = _a.invoice, onPaymentSuccess = _a.onPaymentSuccess, noPadding = _a.noPadding, plugin = _a.plugin;
|
|
2234
|
+
if (!plugin)
|
|
2235
|
+
return null;
|
|
2236
|
+
var _d = React.useContext(BunnyContext), token = _d.token, apiHost = _d.apiHost;
|
|
2043
2237
|
var accountId = React.useContext(PaymentContext).accountId;
|
|
2044
|
-
//
|
|
2045
|
-
var
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
case 0:
|
|
2051
|
-
_c.trys.push([0, 5, , 6]);
|
|
2052
|
-
if (!stripe)
|
|
2053
|
-
throw new Error("Form is not ready");
|
|
2054
|
-
if (!elements)
|
|
2055
|
-
throw new Error("Elements couldn't be retrieved");
|
|
2056
|
-
setIsSaving(true);
|
|
2057
|
-
return [4 /*yield*/, elements.submit()];
|
|
2058
|
-
case 1:
|
|
2059
|
-
submitError = (_c.sent()).error;
|
|
2060
|
-
if (submitError)
|
|
2061
|
-
throw new Error(submitError.message);
|
|
2062
|
-
return [4 /*yield*/, createSetupIntent(plugin, token, apiHost, accountId)];
|
|
2063
|
-
case 2:
|
|
2064
|
-
response = _c.sent();
|
|
2065
|
-
if (response.status !== "success")
|
|
2066
|
-
throw new Error(response === null || response === void 0 ? void 0 : response.message);
|
|
2067
|
-
clientSecret = (_a = response === null || response === void 0 ? void 0 : response.payload) === null || _a === void 0 ? void 0 : _a.client_secret;
|
|
2068
|
-
if (!clientSecret)
|
|
2069
|
-
throw new Error("Error retrieving client secret");
|
|
2070
|
-
return [4 /*yield*/, stripe.confirmSetup({
|
|
2071
|
-
elements: elements,
|
|
2072
|
-
clientSecret: clientSecret,
|
|
2073
|
-
redirect: "if_required",
|
|
2074
|
-
confirmParams: {
|
|
2075
|
-
return_url: window.location.href,
|
|
2076
|
-
},
|
|
2077
|
-
})];
|
|
2078
|
-
case 3:
|
|
2079
|
-
intentResponse = _c.sent();
|
|
2080
|
-
// See https://stripe.com/docs/payments/save-during-payment?platform=web#web-submit-payment
|
|
2081
|
-
if (intentResponse.error)
|
|
2082
|
-
throw new Error(intentResponse.error.message);
|
|
2083
|
-
paymentMethodId = (_b = intentResponse.setupIntent.payment_method) === null || _b === void 0 ? void 0 : _b.toString();
|
|
2084
|
-
if (!paymentMethodId)
|
|
2085
|
-
throw new Error("Payment method couldn't be retrieved");
|
|
2086
|
-
return [4 /*yield*/, createPaymentMethod({
|
|
2087
|
-
paymentMethodId: paymentMethodId,
|
|
2088
|
-
plugin: plugin,
|
|
2089
|
-
token: token,
|
|
2090
|
-
apiHost: apiHost,
|
|
2091
|
-
accountId: accountId,
|
|
2092
|
-
})];
|
|
2093
|
-
case 4:
|
|
2094
|
-
paymentMethodResponse = _c.sent();
|
|
2095
|
-
onPaymentSuccess({
|
|
2096
|
-
pluginPaymentResponse: {
|
|
2097
|
-
savePaymentMethod: true,
|
|
2098
|
-
plugin: plugin,
|
|
2099
|
-
token: paymentMethodResponse.token,
|
|
2100
|
-
},
|
|
2101
|
-
savedPaymentMethodResponse: {
|
|
2102
|
-
paymentMethodId: paymentMethodResponse.payload[0].id,
|
|
2103
|
-
},
|
|
2104
|
-
});
|
|
2105
|
-
return [3 /*break*/, 6];
|
|
2106
|
-
case 5:
|
|
2107
|
-
error_1 = _c.sent();
|
|
2108
|
-
onFail(error_1);
|
|
2109
|
-
return [3 /*break*/, 6];
|
|
2110
|
-
case 6: return [2 /*return*/];
|
|
2111
|
-
}
|
|
2112
|
-
});
|
|
2113
|
-
}); };
|
|
2114
|
-
return (jsxRuntime.jsxs("form", { children: [jsxRuntime.jsx(reactStripeJs.PaymentElement, { options: { layout: { type: "accordion" } } }), jsxRuntime.jsx(CheckoutFooter, { isSaving: isSaving, onPaymentSubmit: onSubmit, onlySavePaymentMethod: true })] }));
|
|
2238
|
+
// If plugin is not stripe, pass undefined to prevent errors
|
|
2239
|
+
var stripePlugin = ((_c = (_b = plugin === null || plugin === void 0 ? void 0 : plugin.components) === null || _b === void 0 ? void 0 : _b.frontend) === null || _c === void 0 ? void 0 : _c[0].name) === "StripePayment"
|
|
2240
|
+
? plugin
|
|
2241
|
+
: undefined;
|
|
2242
|
+
var _e = useStripePlugin(stripePlugin, token, apiHost, accountId), stripe = _e.stripe, options = _e.options;
|
|
2243
|
+
return (jsxRuntime.jsx(reactStripeJs.Elements, __assign({ options: options, stripe: stripe }, { children: jsxRuntime.jsx(ActualCheckoutFooter, { plugin: plugin, invoice: invoice, quote: quote, onPaymentSuccess: onPaymentSuccess, noPadding: noPadding }) })));
|
|
2115
2244
|
};
|
|
2116
2245
|
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
mode: "setup",
|
|
2132
|
-
// TODO: Fetch currency from the entity/account
|
|
2133
|
-
currency: "usd",
|
|
2134
|
-
setupFutureUsage: "off_session",
|
|
2135
|
-
};
|
|
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 }) })));
|
|
2137
|
-
}
|
|
2138
|
-
else {
|
|
2139
|
-
var options = {
|
|
2140
|
-
mode: "payment",
|
|
2141
|
-
amount: payable === null || payable === void 0 ? void 0 : payable.smallUnitAmountDue,
|
|
2142
|
-
currency: payable === null || payable === void 0 ? void 0 : payable.currencyId.toLowerCase(),
|
|
2143
|
-
setupFutureUsage: "off_session",
|
|
2144
|
-
};
|
|
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 }) })));
|
|
2146
|
-
}
|
|
2246
|
+
var dayjs_min = {exports: {}};
|
|
2247
|
+
|
|
2248
|
+
(function (module, exports) {
|
|
2249
|
+
!function(t,e){module.exports=e();}(commonjsGlobal,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p="$isDayjsObject",S=function(t){return t instanceof _||!(!t||!t[p])},w=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[p]=!0;}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return b},m.isValid=function(){return !(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<O(t)},m.$g=function(t,e,n){return b.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!b.u(e)||e,f=b.p(t),l=function(t,e){var i=b.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return b.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=b.p(t),f="set"+(this.$u?"UTC":""),l=(n={},n[a]=f+"Date",n[d]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[u]=f+"Hours",n[s]=f+"Minutes",n[i]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[b.p(t)]()},m.add=function(r,f){var d,l=this;r=Number(r);var $=b.p(f),y=function(t){var e=O(l);return b.w(e.date(e.date()+Math.round(t*r)),l)};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return b.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=b.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return b.s(s%12||12,t,"0")},$=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(y,(function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return b.s(e.$y,4,"0");case"M":return a+1;case"MM":return b.s(a+1,2,"0");case"MMM":return h(n.monthsShort,a,c,3);case"MMMM":return h(c,a);case"D":return e.$D;case"DD":return b.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return h(n.weekdaysMin,e.$W,o,2);case"ddd":return h(n.weekdaysShort,e.$W,o,3);case"dddd":return o[e.$W];case"H":return String(s);case"HH":return b.s(s,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return $(s,u,!0);case"A":return $(s,u,!1);case"m":return String(u);case"mm":return b.s(u,2,"0");case"s":return String(e.$s);case"ss":return b.s(e.$s,2,"0");case"SSS":return b.s(e.$ms,3,"0");case"Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=this,M=b.p(d),m=O(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return b.m(y,m)};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g;}return l?$:b.a($)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=w(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return b.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),k=_.prototype;return O.prototype=k,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach((function(t){k[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),O.extend=function(t,e){return t.$i||(t(e,_,O),t.$i=!0),O},O.locale=w,O.isDayjs=S,O.unix=function(t){return O(1e3*t)},O.en=D[g],O.Ls=D,O.p={},O}));
|
|
2250
|
+
}(dayjs_min));
|
|
2251
|
+
|
|
2252
|
+
var dayjs = dayjs_min.exports;
|
|
2253
|
+
|
|
2254
|
+
var Card = function (_a) {
|
|
2255
|
+
var children = _a.children, className = _a.className, style = _a.style;
|
|
2256
|
+
var darkMode = React.useContext(BunnyContext).darkMode;
|
|
2257
|
+
return (jsxRuntime.jsx("div", __assign({ className: "flex flex-col rounded-md shadow-md ".concat(className), style: __assign(__assign({}, style), { backgroundColor: darkMode
|
|
2258
|
+
? "var(--row-background-dark)"
|
|
2259
|
+
: "var(--row-background)" }) }, { children: children })));
|
|
2147
2260
|
};
|
|
2148
2261
|
|
|
2149
|
-
var
|
|
2150
|
-
return
|
|
2262
|
+
var LargeCardIcon = function () {
|
|
2263
|
+
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" }) })));
|
|
2151
2264
|
};
|
|
2152
2265
|
|
|
2153
|
-
|
|
2154
|
-
var
|
|
2155
|
-
|
|
2156
|
-
return { token: "DemoPayTestToken", amount: amount, currency: currency, cardDetails: cardDetails };
|
|
2266
|
+
var PlusIcon = function (_a) {
|
|
2267
|
+
var color = _a.color;
|
|
2268
|
+
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" })] })));
|
|
2157
2269
|
};
|
|
2158
|
-
|
|
2159
|
-
var
|
|
2160
|
-
var
|
|
2161
|
-
var
|
|
2162
|
-
var
|
|
2163
|
-
var
|
|
2164
|
-
|
|
2270
|
+
|
|
2271
|
+
var Text$f = antd.Typography.Text;
|
|
2272
|
+
var CreditCard = function (_a) {
|
|
2273
|
+
var _b;
|
|
2274
|
+
var onClickRemove = _a.onClickRemove, onClickUpdate = _a.onClickUpdate, paymentMethodData = _a.paymentMethodData, _c = _a.shadow, shadow = _c === void 0 ? "shadow-md" : _c, _d = _a.cardEnabled, cardEnabled = _d === void 0 ? true : _d;
|
|
2275
|
+
var isMobile = common.useIsMobile();
|
|
2276
|
+
var Wrapper = cardEnabled ? Card : "div";
|
|
2277
|
+
return (jsxRuntime.jsxs(Wrapper, __assign({ className: "".concat(cardEnabled ? shadow : "", " 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: [jsxRuntime.jsx(CardImage, { paymentMethodData: paymentMethodData }), jsxRuntime.jsx(Text$f, { children: (_b = paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.metadata) === null || _b === void 0 ? void 0 : _b.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: expirationDate(paymentMethodData) }), isMobile && (jsxRuntime.jsx(CardActions, { onClickRemove: onClickRemove, onClickUpdate: onClickUpdate }))] }))] }))] })));
|
|
2165
2278
|
};
|
|
2166
|
-
var
|
|
2167
|
-
var
|
|
2168
|
-
var
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2279
|
+
var MiniCreditCard = function (_a) {
|
|
2280
|
+
var _b;
|
|
2281
|
+
var _c = _a.hideRemoveButton, hideRemoveButton = _c === void 0 ? false : _c, onClickRemove = _a.onClickRemove, paymentMethodData = _a.paymentMethodData;
|
|
2282
|
+
var darkMode = React.useContext(BunnyContext).darkMode;
|
|
2283
|
+
var borderColor = React.useMemo(function () {
|
|
2284
|
+
return darkMode ? "border-slate-700" : "border-slate-200";
|
|
2285
|
+
}, [darkMode]);
|
|
2286
|
+
var backgroundColor = React.useMemo(function () {
|
|
2287
|
+
return darkMode ? "var(--row-background-alternate)" : "bg-slate-50";
|
|
2288
|
+
}, [darkMode]);
|
|
2289
|
+
return (jsxRuntime.jsx("div", __assign({ className: "flex flex-row justify-between items-center p-1 border-solid ".concat(backgroundColor, " ").concat(borderColor, " rounded-md border") }, { children: paymentMethodData ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex flex-row gap-4" }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex items-center gap-4" }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex items-center gap-2" }, { children: [jsxRuntime.jsx(CardImage, { paymentMethodData: paymentMethodData }), jsxRuntime.jsx(Text$f, { children: (_b = paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.metadata) === null || _b === void 0 ? void 0 : _b.description })] })), jsxRuntime.jsx(antd.Tag, __assign({ color: isExpired(paymentMethodData) ? "red" : "green" }, { children: isExpired(paymentMethodData) ? "Expired" : "Valid" }))] })), jsxRuntime.jsx("div", __assign({ className: "flex flex-row gap-1 items-center" }, { children: dayjs(paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.expirationDate).isValid() && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Text$f, __assign({ className: "text-slate-400", style: { fontSize: "11px" } }, { children: "EXP" })), jsxRuntime.jsx(Text$f, { children: expirationDate(paymentMethodData) })] })) }))] })), !hideRemoveButton && (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" })) })))] })) : (jsxRuntime.jsxs("div", __assign({ className: "flex flex-row gap-2 items-center" }, { children: [jsxRuntime.jsx(CreditCardOutlined$1, {}), jsxRuntime.jsx(Text$f, __assign({ className: "text-slate-400", style: { fontSize: "11px" } }, { children: "No payment method selected" })), jsxRuntime.jsx(antd.Button, { disabled: true, type: "link" })] }))) })));
|
|
2290
|
+
};
|
|
2291
|
+
var CardImage = function (_a) {
|
|
2292
|
+
var _b, _c;
|
|
2293
|
+
var paymentMethodData = _a.paymentMethodData;
|
|
2294
|
+
var apiHost = React.useContext(BunnyContext).apiHost;
|
|
2295
|
+
var darkMode = React.useContext(BunnyContext).darkMode;
|
|
2296
|
+
var getCardImage = function (issuer) {
|
|
2297
|
+
if (issuer === "visa")
|
|
2298
|
+
return "Visa_Brandmark_Blue_RGB_2021.png";
|
|
2299
|
+
else if (issuer === "mastercard")
|
|
2300
|
+
return "mc_symbol_opt_73_3x.png";
|
|
2301
|
+
};
|
|
2302
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { 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)), style: {
|
|
2303
|
+
color: darkMode ? "white" : "",
|
|
2304
|
+
} })) }));
|
|
2174
2305
|
};
|
|
2175
|
-
var
|
|
2176
|
-
var
|
|
2177
|
-
|
|
2178
|
-
var expiryDate = new Date(year, month, 1);
|
|
2179
|
-
return expiryDate < new Date();
|
|
2306
|
+
var CardAttribute = function (_a) {
|
|
2307
|
+
var title = _a.title, value = _a.value;
|
|
2308
|
+
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$f, { children: value })] })));
|
|
2180
2309
|
};
|
|
2181
|
-
var
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
return
|
|
2310
|
+
var CardActions = function (_a) {
|
|
2311
|
+
var onClickRemove = _a.onClickRemove, onClickUpdate = _a.onClickUpdate;
|
|
2312
|
+
var isMobile = common.useIsMobile();
|
|
2313
|
+
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" }))] })));
|
|
2185
2314
|
};
|
|
2186
|
-
|
|
2187
|
-
var
|
|
2188
|
-
var
|
|
2189
|
-
|
|
2190
|
-
|
|
2315
|
+
var EmptyCard = function (_a) {
|
|
2316
|
+
var onClick = _a.onClick, _b = _a.shadow, shadow = _b === void 0 ? "shadow-md" : _b, _c = _a.cardEnabled, cardEnabled = _c === void 0 ? true : _c;
|
|
2317
|
+
var brandColor = React.useContext(BrandContext).brandColor;
|
|
2318
|
+
return (jsxRuntime.jsxs("div", __assign({ className: "flex flex-col items-center justify-center w-full pt-8 px-4 pb-6 cursor-pointer ".concat(cardEnabled ? "bg-white ".concat(shadow, " 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"] })) }))] })));
|
|
2319
|
+
};
|
|
2320
|
+
var isExpired = function (paymentMethodData) {
|
|
2321
|
+
var expDate = dayjs(paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.expirationDate);
|
|
2322
|
+
return expDate.isBefore(dayjs());
|
|
2323
|
+
};
|
|
2324
|
+
var expirationDate = function (storedPaymentMethod) {
|
|
2325
|
+
return dayjs(storedPaymentMethod === null || storedPaymentMethod === void 0 ? void 0 : storedPaymentMethod.expirationDate).format("MM/YY");
|
|
2326
|
+
};
|
|
2327
|
+
|
|
2328
|
+
var SavePaymentMethodFooter = function (_a) {
|
|
2329
|
+
var isSaving = _a.isSaving, onSave = _a.onSave, noPadding = _a.noPadding;
|
|
2330
|
+
var isMobile = common.useIsMobile();
|
|
2331
|
+
var onClickCancel = React.useContext(PaymentContext).onClickCancel;
|
|
2332
|
+
return (jsxRuntime.jsxs("div", __assign({ className: "flex justify-end gap-2 ".concat(noPadding ? "" : "pt-6") }, { children: [onClickCancel && (jsxRuntime.jsx(antd.Button, __assign({ className: "w-full", size: isMobile ? "large" : "middle", onClick: function () { return onClickCancel(); } }, { children: "Cancel" }))), jsxRuntime.jsx(antd.Button, __assign({ className: "w-full", disabled: isSaving, onClick: onSave, size: isMobile ? "large" : "middle", type: "primary" }, { children: isSaving ? "Saving" : "Save" }))] })));
|
|
2191
2333
|
};
|
|
2192
|
-
var storePayment = function (options, plugin, apiHost, accountId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2193
|
-
var testCreditCardNumber, testCreditCardCvc, testCreditCardExpirationDate, token, response;
|
|
2194
|
-
return __generator(this, function (_a) {
|
|
2195
|
-
switch (_a.label) {
|
|
2196
|
-
case 0:
|
|
2197
|
-
testCreditCardNumber = options.testCreditCardNumber, testCreditCardCvc = options.testCreditCardCvc, testCreditCardExpirationDate = options.testCreditCardExpirationDate, token = options.token;
|
|
2198
|
-
return [4 /*yield*/, common.invokePlugin({
|
|
2199
|
-
method: "store_payment_method",
|
|
2200
|
-
plugin: plugin,
|
|
2201
|
-
payload: {
|
|
2202
|
-
test_credit_card_number: testCreditCardNumber,
|
|
2203
|
-
test_credit_card_cvc: testCreditCardCvc,
|
|
2204
|
-
test_credit_card_expiration_date: testCreditCardExpirationDate,
|
|
2205
|
-
account_id: accountId,
|
|
2206
|
-
},
|
|
2207
|
-
token: token,
|
|
2208
|
-
apiHost: apiHost,
|
|
2209
|
-
})];
|
|
2210
|
-
case 1:
|
|
2211
|
-
response = _a.sent();
|
|
2212
|
-
if ((response === null || response === void 0 ? void 0 : response.status) !== "success")
|
|
2213
|
-
throw new Error(response === null || response === void 0 ? void 0 : response.message);
|
|
2214
|
-
return [2 /*return*/, response];
|
|
2215
|
-
}
|
|
2216
|
-
});
|
|
2217
|
-
}); };
|
|
2218
2334
|
|
|
2219
2335
|
var DemoPayCardCvc = function (_a) {
|
|
2220
2336
|
var autoFocus = _a.autoFocus, onChange = _a.onChange, placeholder = _a.placeholder, value = _a.value;
|
|
@@ -2259,83 +2375,95 @@ var DemoPayExpiry = function (_a) {
|
|
|
2259
2375
|
return (jsxRuntime.jsx("div", __assign({ className: "grow" }, { children: jsxRuntime.jsx(antd.Input, { autoFocus: autoFocus, onKeyDown: onKeyPress, onKeyUp: onKeyPress, onChange: onNumberChange, value: formatCardExpiry(value), maxLength: 5, placeholder: placeholder || "MM/YY" }) })));
|
|
2260
2376
|
};
|
|
2261
2377
|
|
|
2262
|
-
|
|
2378
|
+
function useSave$1(_a) {
|
|
2379
|
+
var _this = this;
|
|
2380
|
+
var onSaveSuccess = _a.onSaveSuccess, token = _a.token, apiHost = _a.apiHost, accountId = _a.accountId;
|
|
2381
|
+
var _b = React.useState(false), isSaving = _b[0], setIsSaving = _b[1];
|
|
2382
|
+
var save = function (_a) {
|
|
2383
|
+
var cardDetails = _a.cardDetails, plugin = _a.plugin, savePaymentMethod = _a.savePaymentMethod;
|
|
2384
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
2385
|
+
var response, paymentMethodId, error_1;
|
|
2386
|
+
return __generator(this, function (_b) {
|
|
2387
|
+
switch (_b.label) {
|
|
2388
|
+
case 0:
|
|
2389
|
+
_b.trys.push([0, 2, 3, 4]);
|
|
2390
|
+
setIsSaving(true);
|
|
2391
|
+
return [4 /*yield*/, storePayment({
|
|
2392
|
+
testCreditCardNumber: unformatCardNumber(cardDetails.number),
|
|
2393
|
+
testCreditCardCvc: cardDetails.cvc.toString(),
|
|
2394
|
+
testCreditCardExpirationDate: cardDetails.expiry,
|
|
2395
|
+
token: token,
|
|
2396
|
+
}, plugin, apiHost, accountId)];
|
|
2397
|
+
case 1:
|
|
2398
|
+
response = _b.sent();
|
|
2399
|
+
paymentMethodId = response.payload[0].id;
|
|
2400
|
+
if (response.status !== "success")
|
|
2401
|
+
throw new Error(response === null || response === void 0 ? void 0 : response.message);
|
|
2402
|
+
onSaveSuccess({
|
|
2403
|
+
pluginPaymentResponse: {
|
|
2404
|
+
plugin: plugin,
|
|
2405
|
+
token: response.token,
|
|
2406
|
+
savePaymentMethod: savePaymentMethod,
|
|
2407
|
+
},
|
|
2408
|
+
savedPaymentMethodResponse: {
|
|
2409
|
+
paymentMethodId: paymentMethodId,
|
|
2410
|
+
},
|
|
2411
|
+
});
|
|
2412
|
+
return [3 /*break*/, 4];
|
|
2413
|
+
case 2:
|
|
2414
|
+
error_1 = _b.sent();
|
|
2415
|
+
console.error("Payment failed", error_1);
|
|
2416
|
+
return [3 /*break*/, 4];
|
|
2417
|
+
case 3:
|
|
2418
|
+
setIsSaving(false);
|
|
2419
|
+
return [7 /*endfinally*/];
|
|
2420
|
+
case 4: return [2 /*return*/];
|
|
2421
|
+
}
|
|
2422
|
+
});
|
|
2423
|
+
});
|
|
2424
|
+
};
|
|
2425
|
+
return { save: save, isSaving: isSaving };
|
|
2426
|
+
}
|
|
2427
|
+
|
|
2428
|
+
var Text$e = antd.Typography.Text;
|
|
2263
2429
|
var TEST_CARD = "4242424242424242";
|
|
2264
2430
|
var DemoPayForm = function (_a) {
|
|
2265
|
-
var
|
|
2431
|
+
var onFail = _a.onFail, onSavePaymentMethod = _a.onSavePaymentMethod, plugin = _a.plugin;
|
|
2266
2432
|
// Context
|
|
2267
2433
|
var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, darkMode = _b.darkMode;
|
|
2268
2434
|
var accountId = React.useContext(PaymentContext).accountId;
|
|
2269
|
-
//
|
|
2270
|
-
var _c =
|
|
2435
|
+
// Hooks
|
|
2436
|
+
var _c = useSave$1({
|
|
2437
|
+
onSaveSuccess: onSavePaymentMethod,
|
|
2438
|
+
token: token,
|
|
2439
|
+
apiHost: apiHost,
|
|
2440
|
+
accountId: accountId,
|
|
2441
|
+
}), save = _c.save, isSaving = _c.isSaving;
|
|
2271
2442
|
var _d = React.useState({
|
|
2272
2443
|
number: "4242424242424242",
|
|
2273
2444
|
expiry: "",
|
|
2274
2445
|
cvc: "",
|
|
2275
2446
|
}), cardDetails = _d[0], setCardDetails = _d[1];
|
|
2276
|
-
var
|
|
2277
|
-
|
|
2278
|
-
var onlySavePaymentMethod = !quote && !invoice;
|
|
2279
|
-
var onPaymentSubmit = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
2280
|
-
var response, paymentMethodId, response, error_1;
|
|
2447
|
+
var onSave = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
2448
|
+
var error_1;
|
|
2281
2449
|
return __generator(this, function (_a) {
|
|
2282
2450
|
switch (_a.label) {
|
|
2283
2451
|
case 0:
|
|
2284
|
-
_a.trys.push([0,
|
|
2285
|
-
if (!onlySavePaymentMethod) return [3 /*break*/, 2];
|
|
2452
|
+
_a.trys.push([0, 2, , 3]);
|
|
2286
2453
|
validateCardDetails();
|
|
2287
|
-
|
|
2288
|
-
return [4 /*yield*/, storePayment({
|
|
2289
|
-
testCreditCardNumber: unformatCardNumber(cardDetails.number),
|
|
2290
|
-
testCreditCardCvc: cardDetails.cvc.toString(),
|
|
2291
|
-
testCreditCardExpirationDate: cardDetails.expiry,
|
|
2292
|
-
token: token,
|
|
2293
|
-
}, plugin, apiHost, accountId)];
|
|
2294
|
-
case 1:
|
|
2295
|
-
response = _a.sent();
|
|
2296
|
-
paymentMethodId = response.payload[0].id;
|
|
2297
|
-
if (response.status !== "success")
|
|
2298
|
-
throw new Error(response === null || response === void 0 ? void 0 : response.message);
|
|
2299
|
-
onPaymentSuccess({
|
|
2300
|
-
pluginPaymentResponse: {
|
|
2301
|
-
plugin: plugin,
|
|
2302
|
-
token: response.token,
|
|
2303
|
-
savePaymentMethod: savePaymentMethod,
|
|
2304
|
-
},
|
|
2305
|
-
savedPaymentMethodResponse: {
|
|
2306
|
-
paymentMethodId: paymentMethodId,
|
|
2307
|
-
},
|
|
2308
|
-
});
|
|
2309
|
-
return [3 /*break*/, 5];
|
|
2310
|
-
case 2:
|
|
2311
|
-
if (!(amountDue !== undefined && currencyId)) return [3 /*break*/, 4];
|
|
2312
|
-
validateCardDetails();
|
|
2313
|
-
setIsSaving(true);
|
|
2314
|
-
return [4 /*yield*/, confirmPayment({
|
|
2315
|
-
amount: amountDue,
|
|
2316
|
-
currency: currencyId,
|
|
2454
|
+
return [4 /*yield*/, save({
|
|
2317
2455
|
cardDetails: cardDetails,
|
|
2318
|
-
})];
|
|
2319
|
-
case 3:
|
|
2320
|
-
response = _a.sent();
|
|
2321
|
-
onPaymentSuccess({
|
|
2322
|
-
pluginPaymentResponse: {
|
|
2323
2456
|
plugin: plugin,
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
case 4:
|
|
2331
|
-
onFail(new Error("No amount or currencyId"));
|
|
2332
|
-
_a.label = 5;
|
|
2333
|
-
case 5: return [3 /*break*/, 7];
|
|
2334
|
-
case 6:
|
|
2457
|
+
savePaymentMethod: false,
|
|
2458
|
+
})];
|
|
2459
|
+
case 1:
|
|
2460
|
+
_a.sent();
|
|
2461
|
+
return [3 /*break*/, 3];
|
|
2462
|
+
case 2:
|
|
2335
2463
|
error_1 = _a.sent();
|
|
2336
2464
|
onFail(error_1);
|
|
2337
|
-
return [3 /*break*/,
|
|
2338
|
-
case
|
|
2465
|
+
return [3 /*break*/, 3];
|
|
2466
|
+
case 3: return [2 /*return*/];
|
|
2339
2467
|
}
|
|
2340
2468
|
});
|
|
2341
2469
|
}); };
|
|
@@ -2358,454 +2486,231 @@ var DemoPayForm = function (_a) {
|
|
|
2358
2486
|
var onCardCvcChange = function (cvc) {
|
|
2359
2487
|
setCardDetails(__assign(__assign({}, cardDetails), { cvc: cvc }));
|
|
2360
2488
|
};
|
|
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$
|
|
2489
|
+
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$e, __assign({ className: "text-xs" }, { children: "DemoPay is for testing only." })), jsxRuntime.jsx(SavePaymentMethodFooter, { isSaving: isSaving, onSave: onSave })] })));
|
|
2362
2490
|
};
|
|
2363
|
-
var StyledInputs = styled__default["default"].div(templateObject_1$
|
|
2491
|
+
var StyledInputs = styled__default["default"].div(templateObject_1$7 || (templateObject_1$7 = __makeTemplateObject(["\n .ant-input {\n background-color: ", " !important;\n }\n .ant-input:not(:focus) {\n border-color: ", " !important;\n }\n"], ["\n .ant-input {\n background-color: ", " !important;\n }\n .ant-input:not(:focus) {\n border-color: ", " !important;\n }\n"])), function (_a) {
|
|
2364
2492
|
var darkMode = _a.darkMode;
|
|
2365
2493
|
return darkMode ? "var(--row-background-dark)" : "white";
|
|
2366
2494
|
}, function (_a) {
|
|
2367
2495
|
var darkMode = _a.darkMode;
|
|
2368
2496
|
return darkMode ? common.GRAY_500 : common.GRAY_200;
|
|
2369
2497
|
});
|
|
2370
|
-
var templateObject_1$
|
|
2498
|
+
var templateObject_1$7;
|
|
2371
2499
|
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2500
|
+
function useSave(_a) {
|
|
2501
|
+
var _this = this;
|
|
2502
|
+
var onSaveSuccess = _a.onSaveSuccess;
|
|
2503
|
+
// Hooks
|
|
2504
|
+
var _b = React.useState(false), isSaving = _b[0], setIsSaving = _b[1];
|
|
2505
|
+
var elements = reactStripeJs.useElements();
|
|
2506
|
+
var stripe = reactStripeJs.useStripe();
|
|
2507
|
+
var _c = React.useContext(BunnyContext), token = _c.token, apiHost = _c.apiHost;
|
|
2508
|
+
var accountId = React.useContext(PaymentContext).accountId;
|
|
2509
|
+
var save = function (_a) {
|
|
2510
|
+
var plugin = _a.plugin;
|
|
2511
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
2512
|
+
var submitError, response, clientSecret, intentResponse, paymentMethodId, paymentMethodResponse, error_1;
|
|
2513
|
+
var _b, _c;
|
|
2514
|
+
return __generator(this, function (_d) {
|
|
2515
|
+
switch (_d.label) {
|
|
2516
|
+
case 0:
|
|
2517
|
+
_d.trys.push([0, 5, 6, 7]);
|
|
2518
|
+
if (!stripe)
|
|
2519
|
+
throw new Error("Form is not ready");
|
|
2520
|
+
if (!elements)
|
|
2521
|
+
throw new Error("Elements couldn't be retrieved");
|
|
2522
|
+
setIsSaving(true);
|
|
2523
|
+
return [4 /*yield*/, elements.submit()];
|
|
2524
|
+
case 1:
|
|
2525
|
+
submitError = (_d.sent()).error;
|
|
2526
|
+
if (submitError)
|
|
2527
|
+
throw new Error(submitError.message);
|
|
2528
|
+
return [4 /*yield*/, createSetupIntent(plugin, token, apiHost, accountId)];
|
|
2529
|
+
case 2:
|
|
2530
|
+
response = _d.sent();
|
|
2531
|
+
if (response.status !== "success")
|
|
2532
|
+
throw new Error(response === null || response === void 0 ? void 0 : response.message);
|
|
2533
|
+
clientSecret = (_b = response === null || response === void 0 ? void 0 : response.payload) === null || _b === void 0 ? void 0 : _b.client_secret;
|
|
2534
|
+
if (!clientSecret)
|
|
2535
|
+
throw new Error("Error retrieving client secret");
|
|
2536
|
+
return [4 /*yield*/, stripe.confirmSetup({
|
|
2537
|
+
elements: elements,
|
|
2538
|
+
clientSecret: clientSecret,
|
|
2539
|
+
redirect: "if_required",
|
|
2540
|
+
confirmParams: {
|
|
2541
|
+
return_url: window.location.href,
|
|
2542
|
+
},
|
|
2543
|
+
})];
|
|
2544
|
+
case 3:
|
|
2545
|
+
intentResponse = _d.sent();
|
|
2546
|
+
// See https://stripe.com/docs/payments/save-during-payment?platform=web#web-submit-payment
|
|
2547
|
+
if (intentResponse.error)
|
|
2548
|
+
throw new Error(intentResponse.error.message);
|
|
2549
|
+
paymentMethodId = (_c = intentResponse.setupIntent.payment_method) === null || _c === void 0 ? void 0 : _c.toString();
|
|
2550
|
+
if (!paymentMethodId)
|
|
2551
|
+
throw new Error("Payment method couldn't be retrieved");
|
|
2552
|
+
return [4 /*yield*/, createPaymentMethod({
|
|
2553
|
+
paymentMethodId: paymentMethodId,
|
|
2554
|
+
plugin: plugin,
|
|
2555
|
+
token: token,
|
|
2556
|
+
apiHost: apiHost,
|
|
2557
|
+
accountId: accountId,
|
|
2558
|
+
})];
|
|
2559
|
+
case 4:
|
|
2560
|
+
paymentMethodResponse = _d.sent();
|
|
2561
|
+
onSaveSuccess({
|
|
2562
|
+
pluginPaymentResponse: {
|
|
2563
|
+
savePaymentMethod: true,
|
|
2564
|
+
plugin: plugin,
|
|
2565
|
+
token: paymentMethodResponse.token,
|
|
2566
|
+
},
|
|
2567
|
+
savedPaymentMethodResponse: {
|
|
2568
|
+
paymentMethodId: paymentMethodResponse.payload[0].id,
|
|
2569
|
+
},
|
|
2570
|
+
});
|
|
2571
|
+
return [3 /*break*/, 7];
|
|
2572
|
+
case 5:
|
|
2573
|
+
error_1 = _d.sent();
|
|
2574
|
+
console.error(error_1);
|
|
2575
|
+
return [3 /*break*/, 7];
|
|
2576
|
+
case 6:
|
|
2577
|
+
setIsSaving(false);
|
|
2578
|
+
return [7 /*endfinally*/];
|
|
2579
|
+
case 7: return [2 /*return*/];
|
|
2580
|
+
}
|
|
2581
|
+
});
|
|
2582
|
+
});
|
|
2583
|
+
};
|
|
2584
|
+
return { save: save, isSaving: isSaving };
|
|
2585
|
+
}
|
|
2388
2586
|
|
|
2389
|
-
var
|
|
2390
|
-
var plugin = _a.plugin,
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
})];
|
|
2587
|
+
var PaymentMethodForm = function (_a) {
|
|
2588
|
+
var plugin = _a.plugin, onFail = _a.onFail, onSavePaymentMethod = _a.onSavePaymentMethod;
|
|
2589
|
+
// Hooks
|
|
2590
|
+
var _b = useSave({
|
|
2591
|
+
onSaveSuccess: onSavePaymentMethod,
|
|
2592
|
+
}), save = _b.save, isSaving = _b.isSaving;
|
|
2593
|
+
// Handlers
|
|
2594
|
+
var onSubmit = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
2595
|
+
var error_1;
|
|
2596
|
+
return __generator(this, function (_a) {
|
|
2597
|
+
switch (_a.label) {
|
|
2598
|
+
case 0:
|
|
2599
|
+
_a.trys.push([0, 2, , 3]);
|
|
2600
|
+
return [4 /*yield*/, save({ plugin: plugin })];
|
|
2404
2601
|
case 1:
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2602
|
+
_a.sent();
|
|
2603
|
+
return [3 /*break*/, 3];
|
|
2604
|
+
case 2:
|
|
2605
|
+
error_1 = _a.sent();
|
|
2606
|
+
onFail(error_1);
|
|
2607
|
+
return [3 /*break*/, 3];
|
|
2608
|
+
case 3: return [2 /*return*/];
|
|
2409
2609
|
}
|
|
2410
2610
|
});
|
|
2411
|
-
});
|
|
2611
|
+
}); };
|
|
2612
|
+
return (jsxRuntime.jsxs("form", { children: [jsxRuntime.jsx(reactStripeJs.PaymentElement, { options: { layout: { type: "accordion" } } }), jsxRuntime.jsx(SavePaymentMethodFooter, { isSaving: isSaving, onSave: onSubmit })] }));
|
|
2412
2613
|
};
|
|
2413
2614
|
|
|
2414
|
-
|
|
2415
|
-
var
|
|
2416
|
-
|
|
2417
|
-
hideFields: [
|
|
2418
|
-
"address_line1",
|
|
2419
|
-
"address_line2",
|
|
2420
|
-
"address_city",
|
|
2421
|
-
"address_region",
|
|
2422
|
-
"address_state",
|
|
2423
|
-
"address_country",
|
|
2424
|
-
],
|
|
2425
|
-
labels: {
|
|
2426
|
-
number: "Card number",
|
|
2427
|
-
expiration_date: "Expiration date",
|
|
2428
|
-
security_code: "CVC",
|
|
2429
|
-
address_postal_code: "Postal code",
|
|
2430
|
-
},
|
|
2431
|
-
styles: finixStyles(isMobile),
|
|
2432
|
-
}); };
|
|
2433
|
-
var FINIX_FORM_ID$1 = "form-element";
|
|
2434
|
-
var FINIX_ERROR_CODE_MAPPINGS = {
|
|
2435
|
-
INVALID_FIELD: "Invalid field",
|
|
2436
|
-
};
|
|
2437
|
-
var FINIX_FIELD_NAME_MAPPINGS = {
|
|
2438
|
-
security_code: "CVC",
|
|
2439
|
-
number: "Card number",
|
|
2440
|
-
UNKNOWN: "Expiration date",
|
|
2441
|
-
NOT_SUPPORTED: "Address verification",
|
|
2442
|
-
NO_ADDRESS: "Address",
|
|
2443
|
-
};
|
|
2444
|
-
// Finix doesn't seem to return meaningful errors on their error object
|
|
2445
|
-
// they must be extracted from response.data._embedded.errors
|
|
2446
|
-
var formatFinixError = function (response) {
|
|
2447
|
-
var errors = response.data._embedded.errors;
|
|
2448
|
-
var formattedErrors = errors.map(function (error, index) {
|
|
2449
|
-
var code = error.code, field = error.field;
|
|
2450
|
-
var message = FINIX_ERROR_CODE_MAPPINGS[code] || error.message;
|
|
2451
|
-
var formattedField = FINIX_FIELD_NAME_MAPPINGS[field || ""] ||
|
|
2452
|
-
lodash.capitalize(snakeToSpaces(field || ""));
|
|
2453
|
-
return "".concat(index + 1, ". ").concat(formattedField, ": ").concat(message);
|
|
2454
|
-
});
|
|
2455
|
-
return formattedErrors.join("\n\n");
|
|
2456
|
-
};
|
|
2457
|
-
var FinixCardPaymentForm = function (_a) {
|
|
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;
|
|
2459
|
-
// Context
|
|
2615
|
+
// This is just a wrapper to fetch the stripe object and pass it to the form
|
|
2616
|
+
var StripeForm = function (_a) {
|
|
2617
|
+
var plugin = _a.plugin, onFail = _a.onFail, onSavePaymentMethod = _a.onSavePaymentMethod;
|
|
2460
2618
|
var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
|
|
2461
2619
|
var accountId = React.useContext(PaymentContext).accountId;
|
|
2462
|
-
var
|
|
2463
|
-
|
|
2464
|
-
var _c = React.useState(false), savePaymentMethod = _c[0], setSavePaymentMethod = _c[1];
|
|
2465
|
-
var _d = React.useState(null), finixForm = _d[0], setFinixForm = _d[1];
|
|
2466
|
-
var _e = React.useState(null), finixAuth = _e[0], setFinixAuth = _e[1];
|
|
2467
|
-
var onlySavePaymentMethod = !quote && !invoice;
|
|
2468
|
-
var amountDue = quote ? getQuoteAmountDue(quote) : invoice === null || invoice === void 0 ? void 0 : invoice.amountDue;
|
|
2469
|
-
var currencyId = (quote === null || quote === void 0 ? void 0 : quote.currencyId) || (invoice === null || invoice === void 0 ? void 0 : invoice.currency);
|
|
2470
|
-
// Handlers
|
|
2471
|
-
var onPaymentSubmit = function () {
|
|
2472
|
-
setIsSaving(true);
|
|
2473
|
-
try {
|
|
2474
|
-
var fraud_session_id_1 = finixAuth.getSessionKey();
|
|
2475
|
-
// This is a callback, lets be careful with the scope of the errors and vars
|
|
2476
|
-
var finixFormCallback = function (error, response) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2477
|
-
var tokenData, finixToken, message, response_1, e_1;
|
|
2478
|
-
return __generator(this, function (_a) {
|
|
2479
|
-
switch (_a.label) {
|
|
2480
|
-
case 0:
|
|
2481
|
-
_a.trys.push([0, 3, , 4]);
|
|
2482
|
-
tokenData = response.data || {};
|
|
2483
|
-
finixToken = tokenData.id;
|
|
2484
|
-
if (error) {
|
|
2485
|
-
message = formatFinixError(response);
|
|
2486
|
-
throw new Error(message);
|
|
2487
|
-
}
|
|
2488
|
-
if (!finixToken)
|
|
2489
|
-
throw new Error("payment token couldn't be retrieved");
|
|
2490
|
-
if (!onlySavePaymentMethod) return [3 /*break*/, 2];
|
|
2491
|
-
if (!accountId)
|
|
2492
|
-
throw new Error("Account ID is required");
|
|
2493
|
-
return [4 /*yield*/, common.invokePlugin({
|
|
2494
|
-
plugin: plugin,
|
|
2495
|
-
method: "store_payment_method",
|
|
2496
|
-
payload: {
|
|
2497
|
-
finix_token: finixToken,
|
|
2498
|
-
fraud_session_id: fraud_session_id_1,
|
|
2499
|
-
account_id: accountId,
|
|
2500
|
-
},
|
|
2501
|
-
token: token,
|
|
2502
|
-
apiHost: apiHost,
|
|
2503
|
-
})];
|
|
2504
|
-
case 1:
|
|
2505
|
-
response_1 = _a.sent();
|
|
2506
|
-
if (response_1.status === "failed")
|
|
2507
|
-
throw new Error(response_1.message);
|
|
2508
|
-
return [2 /*return*/, onPaymentSuccess({})];
|
|
2509
|
-
case 2:
|
|
2510
|
-
onPaymentSuccess({
|
|
2511
|
-
pluginPaymentResponse: {
|
|
2512
|
-
token: finixToken,
|
|
2513
|
-
savePaymentMethod: savePaymentMethod,
|
|
2514
|
-
plugin: plugin,
|
|
2515
|
-
metadata: {
|
|
2516
|
-
fraud_session_id: fraud_session_id_1,
|
|
2517
|
-
},
|
|
2518
|
-
},
|
|
2519
|
-
});
|
|
2520
|
-
return [3 /*break*/, 4];
|
|
2521
|
-
case 3:
|
|
2522
|
-
e_1 = _a.sent();
|
|
2523
|
-
// Catch any errors during AFTER submission, during Callback
|
|
2524
|
-
onFail(e_1);
|
|
2525
|
-
return [3 /*break*/, 4];
|
|
2526
|
-
case 4: return [2 /*return*/];
|
|
2527
|
-
}
|
|
2528
|
-
});
|
|
2529
|
-
}); };
|
|
2530
|
-
finixForm.submit(finixConfig.environment, finixConfig.application_id, finixFormCallback);
|
|
2531
|
-
}
|
|
2532
|
-
catch (e) {
|
|
2533
|
-
// Catch any errors during configuration and submission
|
|
2534
|
-
onFail(e);
|
|
2535
|
-
}
|
|
2536
|
-
};
|
|
2537
|
-
React.useEffect(function () {
|
|
2538
|
-
if (!finixForm) {
|
|
2539
|
-
var form = window.Finix.CardTokenForm(FINIX_FORM_ID$1, finixOptions$1(isMobile));
|
|
2540
|
-
setFinixForm(form);
|
|
2541
|
-
}
|
|
2542
|
-
}, [finixForm, isMobile]);
|
|
2543
|
-
React.useEffect(function () {
|
|
2544
|
-
if (!finixAuth) {
|
|
2545
|
-
// It is recommended to retrieve the session key ONCE per checkout/payment
|
|
2546
|
-
var FinixAuth = window.Finix.Auth(finixConfig.environment, finixConfig.merchant_id);
|
|
2547
|
-
setFinixAuth(FinixAuth);
|
|
2548
|
-
}
|
|
2549
|
-
}, [finixAuth, finixConfig.environment, finixConfig.merchant_id]);
|
|
2550
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { id: FINIX_FORM_ID$1 }), !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 })] }));
|
|
2551
|
-
};
|
|
2552
|
-
// This is just a wrapper to fetch the finix config, config its form and pass it to the paymentForm
|
|
2553
|
-
var FinixForm = function (_a) {
|
|
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;
|
|
2556
|
-
var finixConfig = reactQuery.useQuery({
|
|
2557
|
-
queryKey: common.QueryKeyFactory.default.finixKey,
|
|
2558
|
-
queryFn: function () {
|
|
2559
|
-
return retrieveConfig({
|
|
2560
|
-
plugin: plugin,
|
|
2561
|
-
token: token,
|
|
2562
|
-
apiHost: apiHost,
|
|
2563
|
-
accountId: accountId,
|
|
2564
|
-
});
|
|
2565
|
-
},
|
|
2566
|
-
staleTime: 0,
|
|
2567
|
-
}).data;
|
|
2568
|
-
if (!finixConfig || !finixConfig.application_id)
|
|
2569
|
-
return null;
|
|
2570
|
-
return (jsxRuntime.jsx(FinixCardPaymentForm, { entityId: entityId, formData: finixConfig, invoice: invoice, isSaving: isSaving, setIsSaving: setIsSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, plugin: plugin, quote: quote }));
|
|
2571
|
-
};
|
|
2572
|
-
|
|
2573
|
-
var StoredPaymentMethodForm = function (_a) {
|
|
2574
|
-
var isSaving = _a.isSaving, invoice = _a.invoice, onPaymentSuccess = _a.onPaymentSuccess, paymentMethod = _a.paymentMethod, quote = _a.quote, setIsSaving = _a.setIsSaving;
|
|
2575
|
-
var amountDue = quote ? getQuoteAmountDue(quote) : invoice === null || invoice === void 0 ? void 0 : invoice.amountDue;
|
|
2576
|
-
var currencyId = (quote === null || quote === void 0 ? void 0 : quote.currencyId) || (invoice === null || invoice === void 0 ? void 0 : invoice.currency);
|
|
2577
|
-
var onPaymentSubmit = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
2578
|
-
return __generator(this, function (_a) {
|
|
2579
|
-
setIsSaving(true);
|
|
2580
|
-
onPaymentSuccess({
|
|
2581
|
-
savedPaymentMethodResponse: { paymentMethodId: paymentMethod.id },
|
|
2582
|
-
});
|
|
2583
|
-
return [2 /*return*/];
|
|
2584
|
-
});
|
|
2585
|
-
}); };
|
|
2586
|
-
return (jsxRuntime.jsx(CheckoutFooter, { amountDue: amountDue, currencyId: currencyId, isSaving: isSaving, onPaymentSubmit: onPaymentSubmit, noPadding: true }));
|
|
2587
|
-
};
|
|
2588
|
-
|
|
2589
|
-
var finixOptions = function (isMobile) { return ({
|
|
2590
|
-
showAddress: true,
|
|
2591
|
-
hideFields: [
|
|
2592
|
-
"address_line1",
|
|
2593
|
-
"address_line2",
|
|
2594
|
-
"address_city",
|
|
2595
|
-
"address_region",
|
|
2596
|
-
"address_state",
|
|
2597
|
-
"address_country",
|
|
2598
|
-
],
|
|
2599
|
-
labels: {
|
|
2600
|
-
account_number: "Account number",
|
|
2601
|
-
bank_code: "Routing number",
|
|
2602
|
-
account_type: "Account type",
|
|
2603
|
-
address_postal_code: "Postal code",
|
|
2604
|
-
},
|
|
2605
|
-
styles: finixStyles(isMobile),
|
|
2606
|
-
}); };
|
|
2607
|
-
var FINIX_FORM_ID = "form-element";
|
|
2608
|
-
var FinixAchPayment = function (_a) {
|
|
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;
|
|
2611
|
-
var finixConfig = reactQuery.useQuery({
|
|
2612
|
-
queryKey: common.QueryKeyFactory.default.finixAchKey,
|
|
2613
|
-
queryFn: function () {
|
|
2614
|
-
return retrieveConfig({
|
|
2615
|
-
plugin: plugin,
|
|
2616
|
-
token: token,
|
|
2617
|
-
apiHost: apiHost,
|
|
2618
|
-
accountId: accountId,
|
|
2619
|
-
});
|
|
2620
|
-
},
|
|
2621
|
-
staleTime: 0,
|
|
2622
|
-
}).data;
|
|
2623
|
-
if (!finixConfig || !finixConfig.application_id)
|
|
2620
|
+
var _c = useStripePlugin(plugin, token, apiHost, accountId), stripe = _c.stripe, options = _c.options;
|
|
2621
|
+
if (!stripe)
|
|
2624
2622
|
return null;
|
|
2625
|
-
return (jsxRuntime.jsx(
|
|
2626
|
-
};
|
|
2627
|
-
var FinixAchPaymentForm = function (_a) {
|
|
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;
|
|
2629
|
-
// Context
|
|
2630
|
-
var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, accountId = _b.accountId, window = _b.window;
|
|
2631
|
-
var isMobile = common.useIsMobile();
|
|
2632
|
-
// Local state
|
|
2633
|
-
var _c = React.useState(), finixForm = _c[0], setFinixForm = _c[1];
|
|
2634
|
-
var _d = React.useState(false), savePaymentMethod = _d[0], setSavePaymentMethod = _d[1];
|
|
2635
|
-
// Derived state
|
|
2636
|
-
var onlySavePaymentMethod = !quote && !invoice;
|
|
2637
|
-
var amountDue = quote ? getQuoteAmountDue(quote) : invoice === null || invoice === void 0 ? void 0 : invoice.amountDue;
|
|
2638
|
-
var currencyId = (quote === null || quote === void 0 ? void 0 : quote.currencyId) || (invoice === null || invoice === void 0 ? void 0 : invoice.currency);
|
|
2639
|
-
var onPaymentSubmit = function () {
|
|
2640
|
-
setIsSaving(true);
|
|
2641
|
-
try {
|
|
2642
|
-
var finixAchCallback_1 = function (error, response, fraud_session_id) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2643
|
-
var tokenData, finixToken, message, response_1, e_1;
|
|
2644
|
-
return __generator(this, function (_a) {
|
|
2645
|
-
switch (_a.label) {
|
|
2646
|
-
case 0:
|
|
2647
|
-
_a.trys.push([0, 3, , 4]);
|
|
2648
|
-
tokenData = response.data || {};
|
|
2649
|
-
finixToken = tokenData.id;
|
|
2650
|
-
if (error) {
|
|
2651
|
-
message = formatFinixError(response);
|
|
2652
|
-
throw new Error(message);
|
|
2653
|
-
}
|
|
2654
|
-
if (!finixToken) {
|
|
2655
|
-
throw new Error("payment token couldn't be retrieved");
|
|
2656
|
-
}
|
|
2657
|
-
if (!onlySavePaymentMethod) return [3 /*break*/, 2];
|
|
2658
|
-
return [4 /*yield*/, common.invokePlugin({
|
|
2659
|
-
plugin: plugin,
|
|
2660
|
-
method: "store_payment_method",
|
|
2661
|
-
payload: {
|
|
2662
|
-
finix_token: finixToken,
|
|
2663
|
-
fraud_session_id: fraud_session_id,
|
|
2664
|
-
account_id: accountId,
|
|
2665
|
-
},
|
|
2666
|
-
token: token,
|
|
2667
|
-
apiHost: apiHost,
|
|
2668
|
-
})];
|
|
2669
|
-
case 1:
|
|
2670
|
-
response_1 = _a.sent();
|
|
2671
|
-
if (response_1.status === "failed") {
|
|
2672
|
-
throw new Error(response_1.message);
|
|
2673
|
-
}
|
|
2674
|
-
return [2 /*return*/, onPaymentSuccess({})];
|
|
2675
|
-
case 2:
|
|
2676
|
-
onPaymentSuccess({
|
|
2677
|
-
pluginPaymentResponse: {
|
|
2678
|
-
token: finixToken,
|
|
2679
|
-
savePaymentMethod: savePaymentMethod,
|
|
2680
|
-
plugin: plugin,
|
|
2681
|
-
metadata: {
|
|
2682
|
-
fraud_session_id: fraud_session_id,
|
|
2683
|
-
},
|
|
2684
|
-
},
|
|
2685
|
-
});
|
|
2686
|
-
return [3 /*break*/, 4];
|
|
2687
|
-
case 3:
|
|
2688
|
-
e_1 = _a.sent();
|
|
2689
|
-
// Catch any errors during AFTER submission, during Callback
|
|
2690
|
-
onFail(e_1);
|
|
2691
|
-
return [3 /*break*/, 4];
|
|
2692
|
-
case 4: return [2 /*return*/];
|
|
2693
|
-
}
|
|
2694
|
-
});
|
|
2695
|
-
}); };
|
|
2696
|
-
window.Finix.Auth(finixConfig.environment, finixConfig.merchant_id, function (fraud_session_id) {
|
|
2697
|
-
finixForm === null || finixForm === void 0 ? void 0 : finixForm.submit(finixConfig.environment, finixConfig.application_id, function (error, response) {
|
|
2698
|
-
return finixAchCallback_1(error, response, fraud_session_id);
|
|
2699
|
-
});
|
|
2700
|
-
});
|
|
2701
|
-
}
|
|
2702
|
-
catch (e) {
|
|
2703
|
-
// Catch any errors during configuration and submission
|
|
2704
|
-
onFail(e);
|
|
2705
|
-
}
|
|
2706
|
-
};
|
|
2707
|
-
React.useEffect(function () {
|
|
2708
|
-
if (!finixForm) {
|
|
2709
|
-
var newFinixForm = window.Finix.BankTokenForm(FINIX_FORM_ID, finixOptions(isMobile));
|
|
2710
|
-
setFinixForm(newFinixForm);
|
|
2711
|
-
}
|
|
2712
|
-
}, [finixForm, isMobile]);
|
|
2713
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { id: FINIX_FORM_ID }), !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, onPaymentSubmit: onPaymentSubmit, isSaving: isSaving, onlySavePaymentMethod: onlySavePaymentMethod })] }));
|
|
2623
|
+
return (jsxRuntime.jsx(reactStripeJs.Elements, __assign({ options: options, stripe: stripe }, { children: jsxRuntime.jsx(PaymentMethodForm, { plugin: plugin, onFail: onFail, onSavePaymentMethod: onSavePaymentMethod }) })));
|
|
2714
2624
|
};
|
|
2715
2625
|
|
|
2716
|
-
var
|
|
2626
|
+
var PaymentMethodDetails = function (_a) {
|
|
2717
2627
|
var _b, _c;
|
|
2718
|
-
var
|
|
2628
|
+
var onFail = _a.onFail, paymentMethod = _a.paymentMethod, onSavePaymentMethod = _a.onSavePaymentMethod;
|
|
2719
2629
|
if (!paymentMethod)
|
|
2720
2630
|
return null;
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
case "FinixAchPayment":
|
|
2730
|
-
return (jsxRuntime.jsx(FinixAchPayment, { entityId: entityId, invoice: invoice, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, plugin: paymentMethod, quote: quote, setIsSaving: setIsSaving }));
|
|
2731
|
-
case "DemoPayPayment":
|
|
2732
|
-
return (jsxRuntime.jsx(DemoPayForm, { entityId: entityId, invoice: invoice, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, plugin: paymentMethod, quote: quote, setIsSaving: setIsSaving }));
|
|
2733
|
-
default:
|
|
2734
|
-
return jsxRuntime.jsx("p", { children: "Can not find form for plugin" });
|
|
2735
|
-
}
|
|
2631
|
+
paymentMethod = paymentMethod;
|
|
2632
|
+
switch ((_c = (_b = paymentMethod.components) === null || _b === void 0 ? void 0 : _b.frontend) === null || _c === void 0 ? void 0 : _c[0].name) {
|
|
2633
|
+
case "StripePayment":
|
|
2634
|
+
return (jsxRuntime.jsx(StripeForm, { onFail: onFail, onSavePaymentMethod: onSavePaymentMethod, plugin: paymentMethod }));
|
|
2635
|
+
case "DemoPayPayment":
|
|
2636
|
+
return (jsxRuntime.jsx(DemoPayForm, { onFail: onFail, onSavePaymentMethod: onSavePaymentMethod, plugin: paymentMethod }));
|
|
2637
|
+
default:
|
|
2638
|
+
return jsxRuntime.jsx("p", { children: "Can not find form for plugin" });
|
|
2736
2639
|
}
|
|
2737
|
-
else if (quote || invoice)
|
|
2738
|
-
return (jsxRuntime.jsx(StoredPaymentMethodForm, { entityId: entityId, invoice: invoice, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, paymentMethod: paymentMethod, quote: quote, setIsSaving: setIsSaving }));
|
|
2739
|
-
return null;
|
|
2740
2640
|
};
|
|
2741
2641
|
|
|
2742
|
-
var
|
|
2743
|
-
|
|
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
|
-
});
|
|
2642
|
+
var CardIcon = function () {
|
|
2643
|
+
return (jsxRuntime.jsxs("svg", __assign({ width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: [jsxRuntime.jsx("path", { d: "M15 3.75H3C2.17157 3.75 1.5 4.42157 1.5 5.25V12.75C1.5 13.5784 2.17157 14.25 3 14.25H15C15.8284 14.25 16.5 13.5784 16.5 12.75V5.25C16.5 4.42157 15.8284 3.75 15 3.75Z", stroke: common.SLATE_400, strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), jsxRuntime.jsx("path", { d: "M1.5 7.5H16.5", stroke: common.SLATE_400, strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })] })));
|
|
2756
2644
|
};
|
|
2757
2645
|
|
|
2758
|
-
var
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
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
|
-
});
|
|
2646
|
+
var Text$d = antd.Typography.Text;
|
|
2647
|
+
var PaymentMethodSelector = function (_a) {
|
|
2648
|
+
var paymentMethodAllowedPlugins = _a.paymentMethodAllowedPlugins, onSelect = _a.onSelect, value = _a.value;
|
|
2649
|
+
return (jsxRuntime.jsx("div", __assign({ className: "flex flex-col gap-2" }, { children: paymentMethodAllowedPlugins === null || paymentMethodAllowedPlugins === void 0 ? void 0 : paymentMethodAllowedPlugins.map(function (plugin, index) { return (jsxRuntime.jsx(PaymentOption, { name: plugin.name, onClick: onSelect, paymentOption: plugin, selected: (value === null || value === void 0 ? void 0 : value.id) === plugin.id }, index)); }) })));
|
|
2765
2650
|
};
|
|
2766
|
-
var
|
|
2767
|
-
var
|
|
2768
|
-
var
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
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
|
-
};
|
|
2651
|
+
var PaymentOption = function (_a) {
|
|
2652
|
+
var selected = _a.selected, paymentOption = _a.paymentOption, onClick = _a.onClick, name = _a.name;
|
|
2653
|
+
var brandColor = React.useContext(BrandContext).brandColor;
|
|
2654
|
+
var darkMode = React.useContext(BunnyContext).darkMode;
|
|
2655
|
+
var isAch = name === null || name === void 0 ? void 0 : name.toLowerCase().includes("ach");
|
|
2656
|
+
var isCard = name === null || name === void 0 ? void 0 : name.toLowerCase().includes("card");
|
|
2657
|
+
return (jsxRuntime.jsxs(PaymentOptionContainer, __assign({ "$brandColor": brandColor, "$selected": selected, className: "flex justify-between items-center w-full cursor-pointer py-2 px-4 rounded border-solid ".concat(darkMode
|
|
2658
|
+
? "var(--row-background-dark) border-gray-500"
|
|
2659
|
+
: "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, {}))] })));
|
|
2783
2660
|
};
|
|
2661
|
+
var PaymentOptionContainer = styled__default["default"].div(templateObject_1$6 || (templateObject_1$6 = __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) {
|
|
2662
|
+
var $brandColor = _a.$brandColor, $selected = _a.$selected;
|
|
2663
|
+
return $selected &&
|
|
2664
|
+
"\n border-color: ".concat($brandColor, ";\n ");
|
|
2665
|
+
}, function (_a) {
|
|
2666
|
+
var $brandColor = _a.$brandColor;
|
|
2667
|
+
return $brandColor;
|
|
2668
|
+
});
|
|
2669
|
+
var templateObject_1$6;
|
|
2784
2670
|
|
|
2785
|
-
|
|
2786
|
-
var
|
|
2787
|
-
var
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2671
|
+
function useRemovePaymentMethod(paymentPlugins, token, apiHost, accountId) {
|
|
2672
|
+
var queryClient = reactQuery.useQueryClient();
|
|
2673
|
+
var showErrorNotification = common.useErrorNotification();
|
|
2674
|
+
var showSuccessNotification = common.useSuccessNotification();
|
|
2675
|
+
var removePaymentMethod = React.useCallback(function (data) {
|
|
2676
|
+
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); });
|
|
2677
|
+
if (data && plugin) {
|
|
2678
|
+
common.invokePlugin({
|
|
2679
|
+
plugin: plugin,
|
|
2680
|
+
method: "remove_payment_method",
|
|
2681
|
+
payload: {
|
|
2682
|
+
payment_method_id: data.id,
|
|
2683
|
+
account_id: accountId,
|
|
2684
|
+
},
|
|
2685
|
+
token: token,
|
|
2686
|
+
apiHost: apiHost,
|
|
2687
|
+
})
|
|
2688
|
+
.then(function () {
|
|
2689
|
+
showSuccessNotification("Payment method was removed", "Success");
|
|
2690
|
+
queryClient.setQueryData(common.QueryKeyFactory.default.accountPaymentMethodKey, null);
|
|
2691
|
+
})
|
|
2692
|
+
.catch(function (error) {
|
|
2693
|
+
showErrorNotification(error.message, "Error removing payment method");
|
|
2694
|
+
});
|
|
2695
|
+
}
|
|
2696
|
+
}, [paymentPlugins, token, apiHost, queryClient]);
|
|
2697
|
+
return removePaymentMethod;
|
|
2698
|
+
}
|
|
2699
|
+
|
|
2700
|
+
var Panel = antd.Collapse.Panel;
|
|
2701
|
+
var PaymentForm = function (_a) {
|
|
2702
|
+
var entityId = _a.entityId, invoice = _a.invoice, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, quote = _a.quote, accountId = _a.accountId, onSavePaymentMethod = _a.onSavePaymentMethod;
|
|
2798
2703
|
// Local state
|
|
2799
2704
|
var _b = React.useState(), selectedPaymentMethod = _b[0], setSelectedPaymentMethod = _b[1];
|
|
2800
|
-
var _c = React.
|
|
2801
|
-
var
|
|
2802
|
-
//
|
|
2705
|
+
var _c = React.useState(false), showPaymentMethodForm = _c[0], setShowPaymentMethodForm = _c[1];
|
|
2706
|
+
var paying = !!(quote || invoice);
|
|
2707
|
+
// Hooks
|
|
2708
|
+
var _d = React.useContext(BunnyContext), token = _d.token, apiHost = _d.apiHost, graphQLClient = _d.graphQLClient;
|
|
2709
|
+
var storedPaymentMethod = usePaymentMethod(graphQLClient, accountId).data;
|
|
2803
2710
|
var isPaymentMethodFetched = storedPaymentMethod !== undefined;
|
|
2804
|
-
var
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
var showStoredPaymentMethodOption = Boolean(quote || invoice);
|
|
2808
|
-
var isPlugin = !(selectedPaymentMethod === null || selectedPaymentMethod === void 0 ? void 0 : selectedPaymentMethod.metadata);
|
|
2711
|
+
var _e = usePaymentPlugins({ entityId: entityId, apiHost: apiHost, token: token }), paymentMethodAllowedPlugins = _e.paymentMethodAllowedPlugins, arePluginsFetched = _e.isFetched;
|
|
2712
|
+
var onClickRemove = useRemovePaymentMethod(paymentMethodAllowedPlugins || [], token, apiHost, accountId);
|
|
2713
|
+
var queryClient = reactQuery.useQueryClient();
|
|
2809
2714
|
// Set default plugin
|
|
2810
2715
|
React.useEffect(function () {
|
|
2811
2716
|
if (!arePluginsFetched ||
|
|
@@ -2813,34 +2718,53 @@ var ActualPaymentForm = function (_a) {
|
|
|
2813
2718
|
selectedPaymentMethod) {
|
|
2814
2719
|
return;
|
|
2815
2720
|
}
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2721
|
+
var pluginPaymentMethod = paymentMethodAllowedPlugins === null || paymentMethodAllowedPlugins === void 0 ? void 0 : paymentMethodAllowedPlugins.find(function (plugin) { var _a; return plugin.name === ((_a = storedPaymentMethod === null || storedPaymentMethod === void 0 ? void 0 : storedPaymentMethod.metadata) === null || _a === void 0 ? void 0 : _a.issuer); });
|
|
2722
|
+
if (pluginPaymentMethod) {
|
|
2723
|
+
setSelectedPaymentMethod(pluginPaymentMethod);
|
|
2724
|
+
}
|
|
2725
|
+
else if (paymentMethodAllowedPlugins === null || paymentMethodAllowedPlugins === void 0 ? void 0 : paymentMethodAllowedPlugins[0]) {
|
|
2726
|
+
setSelectedPaymentMethod(paymentMethodAllowedPlugins === null || paymentMethodAllowedPlugins === void 0 ? void 0 : paymentMethodAllowedPlugins[0]);
|
|
2727
|
+
}
|
|
2820
2728
|
}, [
|
|
2821
2729
|
arePluginsFetched,
|
|
2822
2730
|
isPaymentMethodFetched,
|
|
2823
2731
|
paymentMethodAllowedPlugins,
|
|
2824
2732
|
selectedPaymentMethod,
|
|
2825
2733
|
setSelectedPaymentMethod,
|
|
2826
|
-
showStoredPaymentMethodOption,
|
|
2827
2734
|
storedPaymentMethod,
|
|
2828
2735
|
]);
|
|
2829
2736
|
var showPaymentMethodSelector = React.useMemo(function () {
|
|
2830
2737
|
var pluginCount = (paymentMethodAllowedPlugins === null || paymentMethodAllowedPlugins === void 0 ? void 0 : paymentMethodAllowedPlugins.length) || 0;
|
|
2831
|
-
return
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2738
|
+
return pluginCount > 1;
|
|
2739
|
+
}, [paymentMethodAllowedPlugins]);
|
|
2740
|
+
var handlePaymentSuccess = function (_a) {
|
|
2741
|
+
var pluginPaymentResponse = _a.pluginPaymentResponse, savedPaymentMethodResponse = _a.savedPaymentMethodResponse;
|
|
2742
|
+
// Hide payment method selector and form
|
|
2743
|
+
setShowPaymentMethodForm(false);
|
|
2744
|
+
// Set new selected payment method
|
|
2745
|
+
var paymentMethod = paymentMethodAllowedPlugins === null || paymentMethodAllowedPlugins === void 0 ? void 0 : paymentMethodAllowedPlugins.find(function (plugin) { var _a; return plugin.id === ((_a = pluginPaymentResponse === null || pluginPaymentResponse === void 0 ? void 0 : pluginPaymentResponse.plugin) === null || _a === void 0 ? void 0 : _a.id); });
|
|
2746
|
+
setSelectedPaymentMethod(paymentMethod);
|
|
2747
|
+
// Handle success keeps going up component tree
|
|
2748
|
+
onPaymentSuccess === null || onPaymentSuccess === void 0 ? void 0 : onPaymentSuccess({
|
|
2749
|
+
pluginPaymentResponse: pluginPaymentResponse,
|
|
2750
|
+
savedPaymentMethodResponse: savedPaymentMethodResponse,
|
|
2751
|
+
});
|
|
2752
|
+
};
|
|
2753
|
+
var handleSavePaymentMethod = function () {
|
|
2754
|
+
queryClient.invalidateQueries({
|
|
2755
|
+
queryKey: common.QueryKeyFactory.default.accountPaymentMethodKey,
|
|
2756
|
+
});
|
|
2757
|
+
onSavePaymentMethod === null || onSavePaymentMethod === void 0 ? void 0 : onSavePaymentMethod();
|
|
2758
|
+
setShowPaymentMethodForm(false);
|
|
2759
|
+
};
|
|
2760
|
+
return (jsxRuntime.jsx(PaymentContext.Provider, __assign({ value: {
|
|
2761
|
+
onClickCancel: function () { return setShowPaymentMethodForm(false); },
|
|
2762
|
+
accountId: accountId,
|
|
2763
|
+
} }, { children: jsxRuntime.jsx("div", __assign({ className: "flex flex-col gap-0 w-full" }, { children: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", __assign({ className: "".concat(!showPaymentMethodForm ? "px-0" : "px-4") }, { children: jsxRuntime.jsx(MiniCreditCard, { hideRemoveButton: paying, onClickRemove: function () { return onClickRemove(storedPaymentMethod); }, paymentMethodData: storedPaymentMethod }) })), paying && storedPaymentMethod ? (jsxRuntime.jsx(CheckoutFooter, { quote: quote, invoice: invoice, onPaymentSuccess: handlePaymentSuccess, plugin: selectedPaymentMethod })) : (
|
|
2764
|
+
//if not paying and payment method is saved, show Collapse
|
|
2765
|
+
jsxRuntime.jsx(antd.Collapse, __assign({ bordered: false, activeKey: showPaymentMethodForm ? "1" : undefined, ghost: true, collapsible: "disabled", destroyInactivePanel: true }, { children: jsxRuntime.jsx(Panel, __assign({ header: jsxRuntime.jsx(jsxRuntime.Fragment, { children: !showPaymentMethodForm ? (jsxRuntime.jsx("div", __assign({ className: "pt-4" }, { children: jsxRuntime.jsxs(antd.Button, __assign({ onClick: function () {
|
|
2766
|
+
setShowPaymentMethodForm(true);
|
|
2767
|
+
}, type: "default", className: "w-full" }, { children: [storedPaymentMethod ? "Update" : "Add", " payment method"] })) }))) : null }), showArrow: false }, { children: jsxRuntime.jsx("div", { children: selectedPaymentMethod ? (jsxRuntime.jsxs("div", __assign({ className: "flex flex-col gap-2 mt-2" }, { children: [showPaymentMethodSelector && (jsxRuntime.jsx(PaymentMethodSelector, { onSelect: setSelectedPaymentMethod, paymentMethodAllowedPlugins: paymentMethodAllowedPlugins, value: selectedPaymentMethod })), jsxRuntime.jsx("div", __assign({ className: "flex flex-col" }, { children: jsxRuntime.jsx(PaymentMethodDetails, { onFail: onFail, onSavePaymentMethod: handleSavePaymentMethod, paymentMethod: selectedPaymentMethod }) }))] }))) : (jsxRuntime.jsx("div", { children: "No payment method selected" })) }) }), "1") })))] }) })) })));
|
|
2844
2768
|
};
|
|
2845
2769
|
|
|
2846
2770
|
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";
|
|
@@ -2878,9 +2802,8 @@ var checkout = function (_a) {
|
|
|
2878
2802
|
});
|
|
2879
2803
|
};
|
|
2880
2804
|
|
|
2881
|
-
var InvoiceCheckoutContext = React.createContext({});
|
|
2882
2805
|
var InvoiceCheckout = function (_a) {
|
|
2883
|
-
var
|
|
2806
|
+
var onSuccess = _a.onSuccess, onFail = _a.onFail, invoice = _a.invoice, entityId = _a.entityId;
|
|
2884
2807
|
var _b = React.useContext(BunnyContext), apiHost = _b.apiHost, token = _b.token;
|
|
2885
2808
|
var checkoutMutation = reactQuery.useMutation({
|
|
2886
2809
|
mutationFn: function (_a) {
|
|
@@ -2944,14 +2867,7 @@ var InvoiceCheckout = function (_a) {
|
|
|
2944
2867
|
});
|
|
2945
2868
|
});
|
|
2946
2869
|
};
|
|
2947
|
-
return (jsxRuntime.jsx(
|
|
2948
|
-
preCheckout: preCheckout,
|
|
2949
|
-
payImmediatelyGivenInvoice: payImmediatelyGivenInvoice,
|
|
2950
|
-
checkoutButtonName: checkoutButtonName,
|
|
2951
|
-
invoice: invoice,
|
|
2952
|
-
setIsPreCheckoutLoading: setIsPreCheckoutLoading,
|
|
2953
|
-
isPreCheckoutLoading: isPreCheckoutLoading,
|
|
2954
|
-
} }, { children: jsxRuntime.jsx(PaymentForm, { entityId: entityId, isSaving: isSaving, onPaymentSuccess: handleCheckout, onFail: onFail, invoice: invoice, setIsSaving: setIsSaving }) })));
|
|
2870
|
+
return (jsxRuntime.jsx("div", __assign({ className: "w-full pt-12" }, { children: jsxRuntime.jsx(PaymentForm, { entityId: entityId, onPaymentSuccess: handleCheckout, onFail: onFail, invoice: invoice }) })));
|
|
2955
2871
|
};
|
|
2956
2872
|
|
|
2957
2873
|
var fetchPDF = function (window, apiEndpoint, invoiceUuid) { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -2997,31 +2913,39 @@ function InvoicePDF(_a) {
|
|
|
2997
2913
|
}, title: "Invoice PDF", width: "100%" }));
|
|
2998
2914
|
}
|
|
2999
2915
|
|
|
3000
|
-
var
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
2916
|
+
var InvoiceQuoteContext = React.createContext({});
|
|
2917
|
+
function Invoice(_a) {
|
|
2918
|
+
var id = _a.id, invoiceQuoteViewComponent = _a.invoiceQuoteViewComponent, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick, onInvoiceDownloadError = _a.onInvoiceDownloadError, onPaymentSuccess = _a.onPaymentSuccess, entityId = _a.entityId, _b = _a.shadow, shadow = _b === void 0 ? "shadow-md" : _b, className = _a.className, _c = _a.hideDownloadButton, hideDownloadButton = _c === void 0 ? false : _c;
|
|
2919
|
+
return (jsxRuntime.jsx(reactHelmetAsync.HelmetProvider, { children: jsxRuntime.jsx(InvoiceQuoteContext.Provider, __assign({ value: {
|
|
2920
|
+
id: id,
|
|
2921
|
+
invoiceQuoteViewComponent: invoiceQuoteViewComponent,
|
|
2922
|
+
backButtonName: backButtonName,
|
|
2923
|
+
onBackButtonClick: onBackButtonClick,
|
|
2924
|
+
onInvoiceDownloadError: onInvoiceDownloadError,
|
|
2925
|
+
onPaymentSuccess: onPaymentSuccess,
|
|
2926
|
+
entityId: entityId,
|
|
2927
|
+
shadow: shadow,
|
|
2928
|
+
className: className,
|
|
2929
|
+
hideDownloadButton: hideDownloadButton,
|
|
2930
|
+
} }, { children: jsxRuntime.jsx(ActualInvoice, {}) })) }));
|
|
2931
|
+
}
|
|
2932
|
+
function ActualInvoice() {
|
|
2933
|
+
// Context
|
|
3013
2934
|
var queryClient = reactQuery.useQueryClient();
|
|
3014
|
-
var
|
|
2935
|
+
var _a = React.useContext(InvoiceQuoteContext), id = _a.id, invoiceQuoteViewComponent = _a.invoiceQuoteViewComponent, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick, onPaymentSuccess = _a.onPaymentSuccess, entityId = _a.entityId, className = _a.className;
|
|
2936
|
+
var _b = React.useContext(BunnyContext), apiHost = _b.apiHost, token = _b.token, onTokenExpired = _b.onTokenExpired;
|
|
2937
|
+
// Local state
|
|
2938
|
+
var isMobile = common.useIsMobile();
|
|
2939
|
+
// Hooks
|
|
3015
2940
|
var showSuccessNotification = common.useSuccessNotification();
|
|
3016
|
-
var handleAllErrorFormats = common.useAllErrorFormats(
|
|
3017
|
-
(function (url) {
|
|
3018
|
-
console.log("navigate to", url, " not implemented");
|
|
3019
|
-
}));
|
|
2941
|
+
var handleAllErrorFormats = common.useAllErrorFormats(onTokenExpired);
|
|
3020
2942
|
// Queries
|
|
3021
|
-
var
|
|
2943
|
+
var _c = reactQuery.useQuery({
|
|
3022
2944
|
queryKey: common.QueryKeyFactory.default.createFormattedInvoiceKey(token, id),
|
|
3023
2945
|
queryFn: function () { return common.getFormattedInvoice({ id: id, token: token, apiHost: apiHost }); },
|
|
3024
|
-
}), formattedInvoice =
|
|
2946
|
+
}), formattedInvoice = _c.data, error = _c.error;
|
|
2947
|
+
// Derived state
|
|
2948
|
+
var isInvoicePayable = common.PAYABLE_INVOICE_STATES.includes((formattedInvoice === null || formattedInvoice === void 0 ? void 0 : formattedInvoice.state) || "");
|
|
3025
2949
|
if (error) {
|
|
3026
2950
|
return jsxRuntime.jsxs("div", { children: ["Error loading invoice: ", error.message] });
|
|
3027
2951
|
}
|
|
@@ -3045,19 +2969,12 @@ function ActualInvoice(_a) {
|
|
|
3045
2969
|
var onFail = function (error) {
|
|
3046
2970
|
handleAllErrorFormats(error.message);
|
|
3047
2971
|
};
|
|
3048
|
-
// Derived state
|
|
3049
|
-
var isInvoicePayable = common.PAYABLE_INVOICE_STATES.includes((formattedInvoice === null || formattedInvoice === void 0 ? void 0 : formattedInvoice.state) || "");
|
|
3050
2972
|
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({
|
|
3051
2973
|
vendorName: formattedInvoice.vendorName,
|
|
3052
2974
|
documentName: common.DOCUMENT_NAME.INVOICE,
|
|
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,
|
|
2975
|
+
}) }), 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", " ").concat(className) }, { 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, onFail: function (error) {
|
|
3054
2976
|
onFail(error);
|
|
3055
|
-
|
|
3056
|
-
}, onSuccess: onSuccess, setIsSaving: setIsSaving, entityId: entityId }))] }))] }));
|
|
3057
|
-
}
|
|
3058
|
-
function Invoice(_a) {
|
|
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 }) }));
|
|
2977
|
+
}, onSuccess: onSuccess, entityId: entityId }))] }))] }));
|
|
3061
2978
|
}
|
|
3062
2979
|
|
|
3063
2980
|
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 }"; };
|
|
@@ -3075,6 +2992,9 @@ var getFormattedQuote = function (_a) {
|
|
|
3075
2992
|
})];
|
|
3076
2993
|
case 1:
|
|
3077
2994
|
response = _b.sent();
|
|
2995
|
+
if (response === null || response === void 0 ? void 0 : response.formattedQuote.error) {
|
|
2996
|
+
throw new Error(response === null || response === void 0 ? void 0 : response.formattedQuote.error);
|
|
2997
|
+
}
|
|
3078
2998
|
return [2 /*return*/, response === null || response === void 0 ? void 0 : response.formattedQuote];
|
|
3079
2999
|
}
|
|
3080
3000
|
});
|
|
@@ -3095,17 +3015,14 @@ var useSigningPlugins = function (_a) {
|
|
|
3095
3015
|
};
|
|
3096
3016
|
|
|
3097
3017
|
var useSendAcceptQuote = function (_a) {
|
|
3098
|
-
var entityId = _a.entityId,
|
|
3018
|
+
var entityId = _a.entityId, onTokenExpired = _a.onTokenExpired, quoteId = _a.quoteId, apiHost = _a.apiHost, token = _a.token;
|
|
3099
3019
|
// Hooks
|
|
3100
3020
|
var graphQLMutation = common.useGraphQLmutation(function () {
|
|
3101
3021
|
console.log("navigate in useGraphQLmutation in useSendAcceptQuote is not yet implemented");
|
|
3102
3022
|
}, apiHost || "", function () {
|
|
3103
3023
|
console.log("onError in useGraphQLmutation in useSendAcceptQuote is not yet implemented");
|
|
3104
3024
|
});
|
|
3105
|
-
var handleAllErrorFormats = common.useAllErrorFormats(
|
|
3106
|
-
(function (url) {
|
|
3107
|
-
console.log("navigate to", url, " not implemented");
|
|
3108
|
-
}));
|
|
3025
|
+
var handleAllErrorFormats = common.useAllErrorFormats(onTokenExpired);
|
|
3109
3026
|
var signingPlugins = useSigningPlugins({ entityId: entityId, apiHost: apiHost, token: token });
|
|
3110
3027
|
var queryClient = reactQuery.useQueryClient();
|
|
3111
3028
|
// Local state
|
|
@@ -3218,27 +3135,19 @@ var useSigningComplete = function (_a) {
|
|
|
3218
3135
|
}, [data, eventParam, queryClient, token]);
|
|
3219
3136
|
};
|
|
3220
3137
|
|
|
3221
|
-
var dayjs_min = {exports: {}};
|
|
3222
|
-
|
|
3223
|
-
(function (module, exports) {
|
|
3224
|
-
!function(t,e){module.exports=e();}(commonjsGlobal,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p="$isDayjsObject",S=function(t){return t instanceof _||!(!t||!t[p])},w=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[p]=!0;}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return b},m.isValid=function(){return !(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<O(t)},m.$g=function(t,e,n){return b.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!b.u(e)||e,f=b.p(t),l=function(t,e){var i=b.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return b.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=b.p(t),f="set"+(this.$u?"UTC":""),l=(n={},n[a]=f+"Date",n[d]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[u]=f+"Hours",n[s]=f+"Minutes",n[i]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[b.p(t)]()},m.add=function(r,f){var d,l=this;r=Number(r);var $=b.p(f),y=function(t){var e=O(l);return b.w(e.date(e.date()+Math.round(t*r)),l)};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return b.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=b.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return b.s(s%12||12,t,"0")},$=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(y,(function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return b.s(e.$y,4,"0");case"M":return a+1;case"MM":return b.s(a+1,2,"0");case"MMM":return h(n.monthsShort,a,c,3);case"MMMM":return h(c,a);case"D":return e.$D;case"DD":return b.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return h(n.weekdaysMin,e.$W,o,2);case"ddd":return h(n.weekdaysShort,e.$W,o,3);case"dddd":return o[e.$W];case"H":return String(s);case"HH":return b.s(s,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return $(s,u,!0);case"A":return $(s,u,!1);case"m":return String(u);case"mm":return b.s(u,2,"0");case"s":return String(e.$s);case"ss":return b.s(e.$s,2,"0");case"SSS":return b.s(e.$ms,3,"0");case"Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=this,M=b.p(d),m=O(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return b.m(y,m)};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g;}return l?$:b.a($)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=w(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return b.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),k=_.prototype;return O.prototype=k,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach((function(t){k[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),O.extend=function(t,e){return t.$i||(t(e,_,O),t.$i=!0),O},O.locale=w,O.isDayjs=S,O.unix=function(t){return O(1e3*t)},O.en=D[g],O.Ls=D,O.p={},O}));
|
|
3225
|
-
}(dayjs_min));
|
|
3226
|
-
|
|
3227
|
-
var dayjs = dayjs_min.exports;
|
|
3228
|
-
|
|
3229
3138
|
var useIsExpired = function (expiresAt) {
|
|
3230
3139
|
return dayjs(expiresAt).diff(dayjs(dayjs().format("YYYY-MM-DD"))) < 0;
|
|
3231
3140
|
};
|
|
3232
3141
|
|
|
3233
3142
|
var PandadocPollingModal = function (_a) {
|
|
3234
3143
|
var isVisible = _a.isVisible, setVisible = _a.setVisible, id = _a.id;
|
|
3235
|
-
var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost,
|
|
3144
|
+
var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, onTokenExpired = _b.onTokenExpired;
|
|
3236
3145
|
var graphQLMutation = common.useGraphQLmutation(function () {
|
|
3237
3146
|
console.log("graphQLMutation navigateOnTokenExpired not yet implemented");
|
|
3238
3147
|
}, apiHost || "", function () {
|
|
3239
3148
|
console.log("graphQLMutation onError not yet implemented");
|
|
3240
3149
|
});
|
|
3241
|
-
var handleAllErrorFormats = common.useAllErrorFormats(
|
|
3150
|
+
var handleAllErrorFormats = common.useAllErrorFormats(onTokenExpired);
|
|
3242
3151
|
var _c = React.useState(0), numberOfPolls = _c[0], setNumberOfPolls = _c[1];
|
|
3243
3152
|
var _d = React.useState(""), infoMessage = _d[0], setInfoMessage = _d[1];
|
|
3244
3153
|
React.useEffect(function () {
|
|
@@ -3318,58 +3227,82 @@ var DOCUMENT_NAME;
|
|
|
3318
3227
|
DOCUMENT_NAME["QUOTE"] = "quote";
|
|
3319
3228
|
})(DOCUMENT_NAME || (DOCUMENT_NAME = {}));
|
|
3320
3229
|
|
|
3230
|
+
var Text$c = antd.Typography.Text;
|
|
3321
3231
|
var documentName = DOCUMENT_NAME.QUOTE;
|
|
3232
|
+
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"])));
|
|
3233
|
+
function Quote(_a) {
|
|
3234
|
+
var id = _a.id, invoiceQuoteViewComponent = _a.invoiceQuoteViewComponent, onInvoiceDownloadError = _a.onInvoiceDownloadError, onPaymentSuccess = _a.onPaymentSuccess, entityId = _a.entityId, _b = _a.shadow, shadow = _b === void 0 ? "shadow-md" : _b, className = _a.className, _c = _a.hideDownloadButton, hideDownloadButton = _c === void 0 ? false : _c;
|
|
3235
|
+
return (jsxRuntime.jsx(reactHelmetAsync.HelmetProvider, { children: jsxRuntime.jsx(InvoiceQuoteContext.Provider, __assign({ value: {
|
|
3236
|
+
id: id,
|
|
3237
|
+
invoiceQuoteViewComponent: invoiceQuoteViewComponent,
|
|
3238
|
+
onInvoiceDownloadError: onInvoiceDownloadError,
|
|
3239
|
+
onPaymentSuccess: onPaymentSuccess,
|
|
3240
|
+
entityId: entityId,
|
|
3241
|
+
shadow: shadow,
|
|
3242
|
+
className: className,
|
|
3243
|
+
hideDownloadButton: hideDownloadButton,
|
|
3244
|
+
} }, { children: jsxRuntime.jsx(ActualQuote, { entityId: entityId }) })) }));
|
|
3245
|
+
}
|
|
3322
3246
|
function ActualQuote(_a) {
|
|
3247
|
+
var _this = this;
|
|
3323
3248
|
var _b, _c;
|
|
3324
|
-
var
|
|
3325
|
-
|
|
3249
|
+
var entityId = _a.entityId;
|
|
3250
|
+
// Context
|
|
3251
|
+
var _d = React.useContext(BunnyContext), token = _d.token, apiHost = _d.apiHost, onTokenExpired = _d.onTokenExpired;
|
|
3326
3252
|
var entityBranding = React.useContext(BrandContext);
|
|
3327
|
-
var
|
|
3253
|
+
var _e = React.useContext(InvoiceQuoteContext), className = _e.className, id = _e.id, hideDownloadButton = _e.hideDownloadButton;
|
|
3328
3254
|
// Queries
|
|
3329
|
-
var
|
|
3255
|
+
var _f = reactQuery.useQuery({
|
|
3330
3256
|
queryKey: common.QueryKeyFactory.default.createQuoteKey(token, id),
|
|
3331
|
-
queryFn: function () { return
|
|
3257
|
+
queryFn: function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3258
|
+
var error_1;
|
|
3259
|
+
return __generator(this, function (_a) {
|
|
3260
|
+
switch (_a.label) {
|
|
3261
|
+
case 0:
|
|
3262
|
+
_a.trys.push([0, 2, , 3]);
|
|
3263
|
+
return [4 /*yield*/, getFormattedQuote({ token: token, apiHost: apiHost, id: id })];
|
|
3264
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
3265
|
+
case 2:
|
|
3266
|
+
error_1 = _a.sent();
|
|
3267
|
+
showErrorNotification(error_1.message);
|
|
3268
|
+
return [3 /*break*/, 3];
|
|
3269
|
+
case 3: return [2 /*return*/];
|
|
3270
|
+
}
|
|
3271
|
+
});
|
|
3272
|
+
}); },
|
|
3332
3273
|
placeholderData: reactQuery.keepPreviousData,
|
|
3333
|
-
}), data =
|
|
3274
|
+
}), data = _f.data, isLoading = _f.isLoading;
|
|
3334
3275
|
var formattedQuote = data;
|
|
3335
3276
|
// Hooks
|
|
3336
3277
|
var downloadFile = useDownloadFile(id);
|
|
3337
3278
|
var isExpired = useIsExpired(formattedQuote === null || formattedQuote === void 0 ? void 0 : formattedQuote.expiresAt);
|
|
3338
|
-
var
|
|
3279
|
+
var _g = useSendAcceptQuote({
|
|
3339
3280
|
entityId: entityId,
|
|
3340
3281
|
token: token,
|
|
3341
|
-
|
|
3342
|
-
(function (url) {
|
|
3343
|
-
console.log("navigate to", url, " not implemented");
|
|
3344
|
-
}),
|
|
3282
|
+
onTokenExpired: onTokenExpired,
|
|
3345
3283
|
apiHost: apiHost,
|
|
3346
3284
|
quoteId: id,
|
|
3347
|
-
}), acceptBoxVisible =
|
|
3285
|
+
}), acceptBoxVisible = _g.acceptBoxVisible, isAccepting = _g.isAccepting, sendAccept = _g.sendAccept, setAcceptBoxVisible = _g.setAcceptBoxVisible, setIsAccepting = _g.setIsAccepting, startAcceptance = _g.startAcceptance, pandadocPollingModalVisible = _g.pandadocPollingModalVisible, setPandadocPollingModalVisible = _g.setPandadocPollingModalVisible;
|
|
3348
3286
|
useSigningComplete({ data: formattedQuote, token: token });
|
|
3287
|
+
var isMobile = common.useIsMobile();
|
|
3288
|
+
var showErrorNotification = common.useErrorNotification();
|
|
3349
3289
|
if (!formattedQuote || isLoading) {
|
|
3350
3290
|
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
3351
3291
|
}
|
|
3292
|
+
// Derived state
|
|
3293
|
+
var isAccepted = formattedQuote.state === "ACCEPTED";
|
|
3352
3294
|
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({
|
|
3353
3295
|
vendorName: formattedQuote.vendorName,
|
|
3354
3296
|
documentName: documentName,
|
|
3355
|
-
}) }), jsxRuntime.jsx("meta", { property: "og:description", content: quoteMetaDescription(formattedQuote.vendorName) })] }), jsxRuntime.jsxs("div", __assign({ className: "flex
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
: "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" &&
|
|
3365
|
-
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) {
|
|
3366
|
-
return (jsxRuntime.jsx(antd.Button, __assign({ download: doc.filename, href: doc.url, type: "link" }, { children: doc.filename }), index));
|
|
3367
|
-
}) }))) : null })) })), jsxRuntime.jsx(AcceptQuoteModal, { acceptBoxVisible: acceptBoxVisible, formattedQuote: formattedQuote, setAcceptBoxVisible: setAcceptBoxVisible, setIsAccepting: setIsAccepting, sendAccept: sendAccept }), jsxRuntime.jsx(PandadocPollingModal, { isVisible: pandadocPollingModalVisible, setVisible: setPandadocPollingModalVisible, id: id })] }));
|
|
3368
|
-
}
|
|
3369
|
-
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"])));
|
|
3370
|
-
function Quote(_a) {
|
|
3371
|
-
var entityId = _a.entityId, id = _a.id;
|
|
3372
|
-
return (jsxRuntime.jsx(reactHelmetAsync.HelmetProvider, { children: jsxRuntime.jsx(ActualQuote, { entityId: entityId, id: id }) }));
|
|
3297
|
+
}) }), jsxRuntime.jsx("meta", { property: "og:description", content: quoteMetaDescription(formattedQuote.vendorName) })] }), jsxRuntime.jsxs("div", __assign({ className: "flex flex-col gap-4 ".concat(className) }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex flex-row justify-end items-center gap-4", id: "acceptance", style: {
|
|
3298
|
+
color: entityBranding.secondaryColor,
|
|
3299
|
+
} }, { children: [isAccepted && formattedQuote.acceptedAt ? (jsxRuntime.jsx(Text$c, { children: "Quote was accepted by ".concat(formattedQuote.acceptedByName, " on ").concat(common.formatDate(formattedQuote.acceptedAt)) })) : null, (!isMobile || !isAccepted) && (jsxRuntime.jsxs("div", __assign({ className: isMobile
|
|
3300
|
+
? "flex w-full justify-end gap-2"
|
|
3301
|
+
: "flex items-center justify-end gap-2" }, { children: [!isMobile && !hideDownloadButton ? (jsxRuntime.jsx(antd.Button, __assign({ icon: jsxRuntime.jsx(DownloadOutlined$1, {}), onClick: function () {
|
|
3302
|
+
return downloadFile(apiHost + "/api/pdf/quote", token);
|
|
3303
|
+
} }, { children: "Download" }))) : null, !isAccepted ? (jsxRuntime.jsx(antd.Button, __assign({ disabled: isExpired || isAccepting, onClick: function () { return startAcceptance(); }, type: "primary" }, { children: isExpired ? "Quote is expired" : "Accept quote" }))) : null] })))] })), 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) {
|
|
3304
|
+
return (jsxRuntime.jsx(antd.Button, __assign({ download: doc.filename, href: doc.url, type: "link" }, { children: doc.filename }), index));
|
|
3305
|
+
}) }))) : null }))] })), jsxRuntime.jsx(AcceptQuoteModal, { acceptBoxVisible: acceptBoxVisible, formattedQuote: formattedQuote, setAcceptBoxVisible: setAcceptBoxVisible, setIsAccepting: setIsAccepting, sendAccept: sendAccept }), jsxRuntime.jsx(PandadocPollingModal, { isVisible: pandadocPollingModalVisible, setVisible: setPandadocPollingModalVisible, id: id })] }));
|
|
3373
3306
|
}
|
|
3374
3307
|
var templateObject_1$4;
|
|
3375
3308
|
|
|
@@ -3424,21 +3357,14 @@ var getTransactions = function (filter, token, apiHost, kindsToShow) { return __
|
|
|
3424
3357
|
});
|
|
3425
3358
|
}); };
|
|
3426
3359
|
|
|
3427
|
-
var
|
|
3428
|
-
var PageHeaderWithActions = function (_a) {
|
|
3429
|
-
var children = _a.children, title = _a.title;
|
|
3430
|
-
var isMobile = common.useIsMobile();
|
|
3431
|
-
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] })));
|
|
3432
|
-
};
|
|
3433
|
-
var PageSubTitle = function (_a) {
|
|
3434
|
-
var title = _a.title;
|
|
3435
|
-
var secondaryColor = React.useContext(BrandContext).secondaryColor;
|
|
3436
|
-
var darkMode = React.useContext(BunnyContext).darkMode;
|
|
3437
|
-
return (jsxRuntime.jsx(Text$b, __assign({ className: "shrink-0 font-medium", style: { color: darkMode ? undefined : secondaryColor } }, { children: title })));
|
|
3438
|
-
};
|
|
3360
|
+
var TransactionsListContext = React.createContext({});
|
|
3439
3361
|
|
|
3440
3362
|
var StateTag = function (_a) {
|
|
3441
3363
|
var state = _a.state;
|
|
3364
|
+
var transactionStateRenderer = React.useContext(TransactionsListContext).transactionStateRenderer;
|
|
3365
|
+
if (transactionStateRenderer) {
|
|
3366
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, { children: transactionStateRenderer(state) });
|
|
3367
|
+
}
|
|
3442
3368
|
return jsxRuntime.jsx(antd.Tag, __assign({ color: getColor(state) }, { children: lodash.capitalize(lodash.startCase(state)) }));
|
|
3443
3369
|
};
|
|
3444
3370
|
var getColor = function (state) {
|
|
@@ -3467,12 +3393,10 @@ var getColor = function (state) {
|
|
|
3467
3393
|
}
|
|
3468
3394
|
};
|
|
3469
3395
|
|
|
3470
|
-
var
|
|
3471
|
-
|
|
3472
|
-
var Text$a = antd.Typography.Text;
|
|
3396
|
+
var Text$b = antd.Typography.Text;
|
|
3473
3397
|
var TransactionDate = function (_a) {
|
|
3474
3398
|
var date = _a.date;
|
|
3475
|
-
return jsxRuntime.jsx(Text$
|
|
3399
|
+
return jsxRuntime.jsx(Text$b, __assign({ className: "text-sm" }, { children: common.formatDate(date) }));
|
|
3476
3400
|
};
|
|
3477
3401
|
|
|
3478
3402
|
// TODO: delete
|
|
@@ -3506,10 +3430,10 @@ var TransactionGridCell = styled__default["default"].div.withConfig({
|
|
|
3506
3430
|
})(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);
|
|
3507
3431
|
var templateObject_1$3;
|
|
3508
3432
|
|
|
3509
|
-
var Text$
|
|
3433
|
+
var Text$a = antd.Typography.Text;
|
|
3510
3434
|
var TransactionsEmptyState = function () {
|
|
3511
3435
|
var noTransactionsMessage = React.useContext(TransactionsListContext).noTransactionsMessage;
|
|
3512
|
-
return (jsxRuntime.jsx(Text$
|
|
3436
|
+
return (jsxRuntime.jsx(Text$a, __assign({ className: "flex justify-center p-4 text-base" }, { children: noTransactionsMessage || "There are no transactions" })));
|
|
3513
3437
|
};
|
|
3514
3438
|
|
|
3515
3439
|
var isInvoice = function (transaction) {
|
|
@@ -3526,7 +3450,7 @@ var TransactionRowTitle = function (_a) {
|
|
|
3526
3450
|
return (jsxRuntime.jsx("span", __assign({ className: "text-slate-400", style: { fontSize: "11px" } }, { children: transaction.transactionable.number })));
|
|
3527
3451
|
};
|
|
3528
3452
|
|
|
3529
|
-
var Text$
|
|
3453
|
+
var Text$9 = antd.Typography.Text;
|
|
3530
3454
|
var TransactionsListDesktop = function (_a) {
|
|
3531
3455
|
var transactions = _a.transactions, onTransactionClick = _a.onTransactionClick;
|
|
3532
3456
|
var columns = React.useContext(TransactionsListContext).columns;
|
|
@@ -3546,11 +3470,11 @@ var TransactionsListDesktop = function (_a) {
|
|
|
3546
3470
|
backgroundColor: index % 2 === 0
|
|
3547
3471
|
? "var(--row-background".concat(darkMode ? "-dark" : "", ")")
|
|
3548
3472
|
: "var(--row-background-alternate".concat(darkMode ? "-dark" : "", ")"),
|
|
3549
|
-
} }, { 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$
|
|
3473
|
+
} }, { children: [!showDateAndTitle && !showState && !showAmount && !showDownload && (jsxRuntime.jsx(TransactionGridCell, { children: jsxRuntime.jsx(Text$9, { children: "No columns selected" }) })), 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$9, { 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 }) }))) : null, showAmount && (jsxRuntime.jsx(TransactionGridCell, __assign({ right: true }, { children: jsxRuntime.jsx(Text$9, { 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));
|
|
3550
3474
|
});
|
|
3551
3475
|
};
|
|
3552
3476
|
|
|
3553
|
-
var Text$
|
|
3477
|
+
var Text$8 = antd.Typography.Text;
|
|
3554
3478
|
var TransactionsListMobile = function (_a) {
|
|
3555
3479
|
var transactions = _a.transactions, onTransactionClick = _a.onTransactionClick;
|
|
3556
3480
|
var columns = React.useContext(TransactionsListContext).columns;
|
|
@@ -3569,20 +3493,23 @@ var TransactionsListMobile = function (_a) {
|
|
|
3569
3493
|
backgroundColor: index % 2 === 0
|
|
3570
3494
|
? "var(--row-background".concat(darkMode ? "-dark" : "", ")")
|
|
3571
3495
|
: "var(--row-background-alternate".concat(darkMode ? "-dark" : "", ")"),
|
|
3572
|
-
} }, { 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$
|
|
3496
|
+
} }, { 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$8, { 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$8, { children: "\u00B7" }), showAmount && (jsxRuntime.jsx(Text$8, { 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));
|
|
3573
3497
|
});
|
|
3574
3498
|
};
|
|
3575
3499
|
|
|
3500
|
+
var Text$7 = antd.Typography.Text;
|
|
3501
|
+
var DISPLAY_WIDTH = 1200;
|
|
3576
3502
|
function Transactions(_a) {
|
|
3577
|
-
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 =
|
|
3503
|
+
var transactionComponent = _a.transactionComponent, _b = _a.showSearchBar, showSearchBar = _b === void 0 ? true : _b, _c = _a.showTitle, showTitle = _c === void 0 ? true : _c, _d = _a.title, title = _d === void 0 ? "Past transactions" : _d, _e = _a.columns, columns = _e === void 0 ? ["date-and-title", "state", "amount"] : _e, className = _a.className, _f = _a.shadow, shadow = _f === void 0 ? "shadow-md" : _f, searchBarClassName = _a.searchBarClassName, _g = _a.useModal, useModal = _g === void 0 ? false : _g, onTransactionClick = _a.onTransactionClick, _h = _a.suppressTransactionDisplay, suppressTransactionDisplay = _h === void 0 ? false : _h, _j = _a.kindsToShow, kindsToShow = _j === void 0 ? [
|
|
3578
3504
|
common.TransactionKind.INVOICE,
|
|
3579
3505
|
common.TransactionKind.PAYMENT,
|
|
3580
3506
|
common.TransactionKind.REFUND,
|
|
3581
3507
|
common.TransactionKind.WRITE_OFF,
|
|
3582
|
-
] :
|
|
3508
|
+
] : _j, style = _a.style, filter = _a.filter, noTransactionsMessage = _a.noTransactionsMessage, entityId = _a.entityId;
|
|
3583
3509
|
var contextValues = {
|
|
3584
3510
|
showSearchBar: showSearchBar,
|
|
3585
3511
|
showTitle: showTitle,
|
|
3512
|
+
title: title,
|
|
3586
3513
|
transactionComponent: transactionComponent,
|
|
3587
3514
|
columns: columns,
|
|
3588
3515
|
className: className,
|
|
@@ -3597,28 +3524,25 @@ function Transactions(_a) {
|
|
|
3597
3524
|
noTransactionsMessage: noTransactionsMessage,
|
|
3598
3525
|
entityId: entityId,
|
|
3599
3526
|
};
|
|
3600
|
-
|
|
3601
|
-
}
|
|
3602
|
-
function TransactionsWrapper() {
|
|
3603
|
-
var _a = React.useContext(TransactionsListContext), kindsToShow = _a.kindsToShow, filterFromContext = _a.filter;
|
|
3604
|
-
var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
|
|
3527
|
+
var _k = React.useContext(BunnyContext), token = _k.token, apiHost = _k.apiHost;
|
|
3605
3528
|
// Local state
|
|
3606
|
-
var
|
|
3607
|
-
var
|
|
3529
|
+
var _l = React.useState(""), search = _l[0], setSearch = _l[1];
|
|
3530
|
+
var filterValue = filter ||
|
|
3608
3531
|
(search ? "filter: \"transaction.transactionableId is ".concat(search, "\"") : "");
|
|
3609
3532
|
// Queries
|
|
3610
3533
|
var data = reactQuery.useQuery({
|
|
3611
3534
|
queryKey: ["transactions", token, filter],
|
|
3612
|
-
queryFn: function () { return getTransactions(
|
|
3535
|
+
queryFn: function () { return getTransactions(filterValue, token, apiHost, kindsToShow); },
|
|
3613
3536
|
placeholderData: reactQuery.keepPreviousData,
|
|
3614
3537
|
}).data;
|
|
3615
|
-
return (jsxRuntime.jsx(TransactionsDisplay, { transactions: data, onSearchValueChanged: setSearch, search: search }));
|
|
3538
|
+
return (jsxRuntime.jsx(TransactionsListContext.Provider, __assign({ value: contextValues }, { children: jsxRuntime.jsx(TransactionsDisplay, { transactions: data, onSearchValueChanged: setSearch, search: search }) })));
|
|
3616
3539
|
}
|
|
3617
3540
|
function TransactionsDisplay(_a) {
|
|
3618
|
-
var transactions = _a.transactions, onSearchValueChanged = _a.onSearchValueChanged, search = _a.search
|
|
3619
|
-
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;
|
|
3541
|
+
var transactions = _a.transactions, onSearchValueChanged = _a.onSearchValueChanged, search = _a.search;
|
|
3542
|
+
var _b = React.useContext(TransactionsListContext), showSearchBar = _b.showSearchBar, showTitle = _b.showTitle, title = _b.title, 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, onTransactionDisplayClose = _b.onTransactionDisplayClose;
|
|
3620
3543
|
var columns = React.useContext(TransactionsListContext).columns;
|
|
3621
3544
|
var darkMode = React.useContext(BunnyContext).darkMode;
|
|
3545
|
+
var secondaryColor = React.useContext(BrandContext).secondaryColor;
|
|
3622
3546
|
// Local state
|
|
3623
3547
|
var _c = React.useState(null), selectedTransaction = _c[0], setSelectedTransaction = _c[1];
|
|
3624
3548
|
var _d = React.useState(false), drawerOpen = _d[0], setDrawerOpen = _d[1];
|
|
@@ -3668,38 +3592,48 @@ function TransactionsDisplay(_a) {
|
|
|
3668
3592
|
var kind = selectedTransaction.kind.toLowerCase();
|
|
3669
3593
|
return kind.charAt(0).toUpperCase() + kind.slice(1);
|
|
3670
3594
|
};
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
}
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3595
|
+
function handleDisplayClose() {
|
|
3596
|
+
onTransactionDisplayClose === null || onTransactionDisplayClose === void 0 ? void 0 : onTransactionDisplayClose(selectedTransaction);
|
|
3597
|
+
setDrawerOpen(false);
|
|
3598
|
+
}
|
|
3599
|
+
return (jsxRuntime.jsxs("div", __assign({ style: style }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex flex-col w-full shadow-padding-xb gap-2 ".concat(isMobile ? "overflow-hidden" : "", " ").concat(className) }, { children: [showTitle || showSearchBar ? (jsxRuntime.jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col gap-1" : "flex-row items-center", " justify-between") }, { children: [showTitle ? (jsxRuntime.jsx(Text$7, __assign({ className: "shrink-0 font-medium", style: { color: darkMode ? undefined : secondaryColor } }, { children: title }))) : (jsxRuntime.jsx("div", {}) // Empty div so justify-between works
|
|
3600
|
+
), showSearchBar && (jsxRuntime.jsx("div", __assign({ className: "".concat(isMobile ? "w-full" : "") }, { children: jsxRuntime.jsx(antd.Input, { className: searchBarClassName
|
|
3601
|
+
? searchBarClassName
|
|
3602
|
+
: "border border-slate-200", onChange: function (e) {
|
|
3603
|
+
if (isNaN(Number(e.target.value))) {
|
|
3604
|
+
return;
|
|
3605
|
+
}
|
|
3606
|
+
onSearchValueChanged(e.target.value);
|
|
3607
|
+
}, prefix: jsxRuntime.jsx(SearchOutlined$1, {}), placeholder: "Search by id #", style: {
|
|
3608
|
+
minWidth: "300px",
|
|
3609
|
+
}, value: search }) })))] }))) : null, jsxRuntime.jsx("div", __assign({ className: "grid w-full rounded-md overflow-auto ".concat(shadow), style: {
|
|
3610
|
+
gridTemplateColumns: gridTemplateColumns(),
|
|
3611
|
+
backgroundColor: "var(--row-background".concat(darkMode ? "-dark" : "", ")"),
|
|
3612
|
+
} }, { children: isMobile ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: TransactionsListMobile({
|
|
3613
|
+
transactions: transactions,
|
|
3614
|
+
onTransactionClick: handleTransactionClick,
|
|
3615
|
+
}) })) : (jsxRuntime.jsx(jsxRuntime.Fragment, { children: TransactionsListDesktop({
|
|
3616
|
+
transactions: transactions,
|
|
3617
|
+
onTransactionClick: handleTransactionClick,
|
|
3618
|
+
}) })) }))] })), useModal ? (jsxRuntime.jsx(antd.Modal, __assign({ title: "Basic Modal", open: drawerOpen, onOk: handleDisplayClose, onCancel: handleDisplayClose, width: DISPLAY_WIDTH, 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: handleDisplayClose, open: drawerOpen, width: DISPLAY_WIDTH }, { 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 })] })] }))) })))] })));
|
|
3690
3619
|
}
|
|
3691
3620
|
|
|
3692
3621
|
function Quotes(_a) {
|
|
3693
|
-
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
|
|
3622
|
+
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, onQuoteClick = _a.onQuoteClick, quoteComponent = _a.quoteComponent, searchBarClassName = _a.searchBarClassName, _d = _a.shadow, shadow = _d === void 0 ? "shadow-md" : _d, _e = _a.showSearchBar, showSearchBar = _e === void 0 ? true : _e, _f = _a.showTitle, showTitle = _f === void 0 ? true : _f, _g = _a.title, title = _g === void 0 ? "Past quotes" : _g, style = _a.style, _h = _a.suppressQuoteDisplay, suppressQuoteDisplay = _h === void 0 ? false : _h, _j = _a.useModal, useModal = _j === void 0 ? false : _j;
|
|
3694
3623
|
var apiHost = React.useContext(BunnyContext).apiHost;
|
|
3695
|
-
var
|
|
3624
|
+
var _k = React.useState(null), component = _k[0], setComponent = _k[1];
|
|
3696
3625
|
var contextValues = {
|
|
3697
3626
|
columns: columns,
|
|
3698
3627
|
kindsToShow: [],
|
|
3699
3628
|
onTransactionClick: handleQuoteClick,
|
|
3629
|
+
onTransactionDisplayClose: function () {
|
|
3630
|
+
setComponent(jsxRuntime.jsx(jsxRuntime.Fragment, {}));
|
|
3631
|
+
},
|
|
3700
3632
|
transactionComponent: component,
|
|
3633
|
+
transactionStateRenderer: quoteStateRenderer,
|
|
3701
3634
|
showSearchBar: showSearchBar,
|
|
3702
3635
|
showTitle: showTitle,
|
|
3636
|
+
title: title,
|
|
3703
3637
|
className: className,
|
|
3704
3638
|
shadow: shadow,
|
|
3705
3639
|
searchBarClassName: searchBarClassName,
|
|
@@ -3711,7 +3645,29 @@ function Quotes(_a) {
|
|
|
3711
3645
|
downloadTransactionLink: function (id) { return "".concat(apiHost, "/api/pdf/quote/").concat(id); },
|
|
3712
3646
|
entityId: entityId,
|
|
3713
3647
|
};
|
|
3648
|
+
function quoteStateRenderer(state) {
|
|
3649
|
+
// "DRAFT" | "SHARED" | "VIEWED" | "ACCEPTED" | "IN_APPROVAL" | "APPROVED" | "REJECTED";
|
|
3650
|
+
var getColor = function (state) {
|
|
3651
|
+
switch (state) {
|
|
3652
|
+
case "ACCEPTED":
|
|
3653
|
+
return "green";
|
|
3654
|
+
case "IN_APPROVAL":
|
|
3655
|
+
return "orange";
|
|
3656
|
+
case "APPROVED":
|
|
3657
|
+
return "green";
|
|
3658
|
+
case "REJECTED":
|
|
3659
|
+
return "red";
|
|
3660
|
+
case "DRAFT":
|
|
3661
|
+
case "SHARED":
|
|
3662
|
+
case "VIEWED":
|
|
3663
|
+
default:
|
|
3664
|
+
return "blue";
|
|
3665
|
+
}
|
|
3666
|
+
};
|
|
3667
|
+
return jsxRuntime.jsx(antd.Tag, __assign({ color: getColor(state) }, { children: lodash.capitalize(lodash.startCase(state)) }));
|
|
3668
|
+
}
|
|
3714
3669
|
function handleQuoteClick(quote) {
|
|
3670
|
+
onQuoteClick === null || onQuoteClick === void 0 ? void 0 : onQuoteClick(quote);
|
|
3715
3671
|
if (quoteComponent) {
|
|
3716
3672
|
setComponent(quoteComponent);
|
|
3717
3673
|
}
|
|
@@ -3735,9 +3691,17 @@ function QuotesWrapper() {
|
|
|
3735
3691
|
}).data;
|
|
3736
3692
|
if (data === undefined)
|
|
3737
3693
|
return null;
|
|
3738
|
-
|
|
3694
|
+
// filter out quotes in draft state, they are not viewable
|
|
3695
|
+
var quotes = data.nodes
|
|
3696
|
+
.filter(function (quote) {
|
|
3697
|
+
return quote.state !== "DRAFT";
|
|
3698
|
+
})
|
|
3699
|
+
.sort(function (a, b) {
|
|
3700
|
+
return new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime();
|
|
3701
|
+
});
|
|
3702
|
+
var quotesAsTransactions = quotes.map(function (quote) { return ({
|
|
3739
3703
|
transactionableId: quote.id,
|
|
3740
|
-
state:
|
|
3704
|
+
state: quote.state,
|
|
3741
3705
|
amount: quote.amount || quote.amountDue,
|
|
3742
3706
|
kind: "QUOTE",
|
|
3743
3707
|
currencyId: quote.currencyId,
|
|
@@ -3746,7 +3710,7 @@ function QuotesWrapper() {
|
|
|
3746
3710
|
},
|
|
3747
3711
|
createdAt: quote.createdAt,
|
|
3748
3712
|
}); });
|
|
3749
|
-
return (jsxRuntime.jsx(TransactionsDisplay, { transactions: quotesAsTransactions, onSearchValueChanged: setSearch, search: search
|
|
3713
|
+
return (jsxRuntime.jsx(TransactionsDisplay, { transactions: quotesAsTransactions, onSearchValueChanged: setSearch, search: search }));
|
|
3750
3714
|
}
|
|
3751
3715
|
|
|
3752
3716
|
var DrawerHeader = function (_a) {
|
|
@@ -3754,96 +3718,19 @@ var DrawerHeader = function (_a) {
|
|
|
3754
3718
|
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 }))] })));
|
|
3755
3719
|
};
|
|
3756
3720
|
|
|
3757
|
-
var
|
|
3758
|
-
var
|
|
3759
|
-
var
|
|
3760
|
-
return (jsxRuntime.jsx("div", __assign({ className: "flex flex-col rounded-md shadow-md ".concat(className), style: __assign(__assign({}, style), { backgroundColor: darkMode
|
|
3761
|
-
? "var(--row-background-dark)"
|
|
3762
|
-
: "var(--row-background)" }) }, { children: children })));
|
|
3763
|
-
};
|
|
3764
|
-
|
|
3765
|
-
var LargeCardIcon = function () {
|
|
3766
|
-
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" }) })));
|
|
3767
|
-
};
|
|
3768
|
-
|
|
3769
|
-
var PlusIcon = function (_a) {
|
|
3770
|
-
var color = _a.color;
|
|
3771
|
-
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" })] })));
|
|
3772
|
-
};
|
|
3773
|
-
|
|
3774
|
-
var Text$6 = antd.Typography.Text;
|
|
3775
|
-
var CreditCard = function (_a) {
|
|
3776
|
-
var _b, _c, _d;
|
|
3777
|
-
var onClickRemove = _a.onClickRemove, onClickUpdate = _a.onClickUpdate, paymentMethodData = _a.paymentMethodData;
|
|
3778
|
-
var isExpired = function (paymentMethodData) {
|
|
3779
|
-
// paymentMethodData.expirationDate
|
|
3780
|
-
var expDate = dayjs(paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.expirationDate);
|
|
3781
|
-
return expDate.isBefore(dayjs());
|
|
3782
|
-
};
|
|
3783
|
-
var isMobile = common.useIsMobile();
|
|
3784
|
-
var apiHost = React.useContext(BunnyContext).apiHost;
|
|
3785
|
-
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 }))] }))] }))] })));
|
|
3786
|
-
};
|
|
3787
|
-
var CardAttribute = function (_a) {
|
|
3788
|
-
var title = _a.title, value = _a.value;
|
|
3789
|
-
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 })] })));
|
|
3790
|
-
};
|
|
3791
|
-
var CardActions = function (_a) {
|
|
3792
|
-
var onClickRemove = _a.onClickRemove, onClickUpdate = _a.onClickUpdate;
|
|
3793
|
-
var isMobile = common.useIsMobile();
|
|
3794
|
-
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" }))] })));
|
|
3795
|
-
};
|
|
3796
|
-
var EmptyCard = function (_a) {
|
|
3797
|
-
var onClick = _a.onClick;
|
|
3798
|
-
var brandColor = React.useContext(BrandContext).brandColor;
|
|
3799
|
-
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"] })) }))] })));
|
|
3800
|
-
};
|
|
3801
|
-
var getCardImage = function (issuer) {
|
|
3802
|
-
if (issuer === "visa")
|
|
3803
|
-
return "Visa_Brandmark_Blue_RGB_2021.png";
|
|
3804
|
-
else if (issuer === "mastercard")
|
|
3805
|
-
return "mc_symbol_opt_73_3x.png";
|
|
3806
|
-
};
|
|
3807
|
-
|
|
3808
|
-
var PaymentMethodContext = React.createContext({});
|
|
3809
|
-
|
|
3810
|
-
var ActualPaymentMethod = function (_a) {
|
|
3811
|
-
var entityId = _a.entityId;
|
|
3812
|
-
var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, graphQLClient = _b.graphQLClient, onErrorNavigate = _b.onErrorNavigate;
|
|
3813
|
-
var accountId = React.useContext(PaymentContext).accountId;
|
|
3721
|
+
var PaymentMethod = function (_a) {
|
|
3722
|
+
var entityId = _a.entityId, className = _a.className, _b = _a.shadow, shadow = _b === void 0 ? "shadow-md" : _b, _c = _a.cardEnabled, cardEnabled = _c === void 0 ? true : _c;
|
|
3723
|
+
var _d = React.useContext(BunnyContext), token = _d.token, apiHost = _d.apiHost, graphQLClient = _d.graphQLClient, onTokenExpired = _d.onTokenExpired;
|
|
3814
3724
|
// Hooks
|
|
3815
3725
|
var queryClient = reactQuery.useQueryClient();
|
|
3816
3726
|
var paymentPlugins = usePaymentPlugins({ entityId: entityId, apiHost: apiHost, token: token }).paymentPlugins;
|
|
3817
|
-
var showErrorNotification = common.useErrorNotification();
|
|
3818
3727
|
var showSuccessNotification = common.useSuccessNotification();
|
|
3819
|
-
var handleAllErrorFormats = common.useAllErrorFormats(
|
|
3728
|
+
var handleAllErrorFormats = common.useAllErrorFormats(onTokenExpired);
|
|
3820
3729
|
var isMobile = common.useIsMobile();
|
|
3821
3730
|
var data = usePaymentMethod(graphQLClient).data;
|
|
3731
|
+
var onClickRemove = useRemovePaymentMethod(paymentPlugins || [], token, apiHost);
|
|
3822
3732
|
// Local state
|
|
3823
|
-
var
|
|
3824
|
-
var _d = React.useState(false), isSaving = _d[0], setIsSaving = _d[1];
|
|
3825
|
-
var plugin = paymentPlugins === null || paymentPlugins === void 0 ? void 0 : paymentPlugins.find(function (paymentPlugin) { var _a; return String(paymentPlugin.id) === ((_a = data === null || data === void 0 ? void 0 : data.plugin) === null || _a === void 0 ? void 0 : _a.id); });
|
|
3826
|
-
var onClickRemove = function () {
|
|
3827
|
-
if (data && plugin) {
|
|
3828
|
-
common.invokePlugin({
|
|
3829
|
-
plugin: plugin,
|
|
3830
|
-
method: "remove_payment_method",
|
|
3831
|
-
payload: {
|
|
3832
|
-
payment_method_id: data.id,
|
|
3833
|
-
account_id: accountId,
|
|
3834
|
-
},
|
|
3835
|
-
token: token,
|
|
3836
|
-
apiHost: apiHost,
|
|
3837
|
-
})
|
|
3838
|
-
.then(function () {
|
|
3839
|
-
showSuccessNotification("Payment method was removed", "Success");
|
|
3840
|
-
queryClient.setQueryData(common.QueryKeyFactory.default.accountPaymentMethodKey, null);
|
|
3841
|
-
})
|
|
3842
|
-
.catch(function (error) {
|
|
3843
|
-
showErrorNotification(error.message, "Error removing Payment Method");
|
|
3844
|
-
});
|
|
3845
|
-
}
|
|
3846
|
-
};
|
|
3733
|
+
var _e = React.useState(false), showModal = _e[0], setShowModal = _e[1];
|
|
3847
3734
|
var onSuccess = function () {
|
|
3848
3735
|
queryClient.invalidateQueries({
|
|
3849
3736
|
queryKey: common.QueryKeyFactory.default.accountPaymentMethodKey,
|
|
@@ -3853,25 +3740,18 @@ var ActualPaymentMethod = function (_a) {
|
|
|
3853
3740
|
};
|
|
3854
3741
|
if (data === undefined)
|
|
3855
3742
|
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
3856
|
-
return (jsxRuntime.jsxs(
|
|
3743
|
+
return (jsxRuntime.jsxs("div", __assign({ className: "".concat(className) }, { children: [data ? (jsxRuntime.jsx(CreditCard, { onClickRemove: function () { return onClickRemove(data); }, onClickUpdate: function () { return setShowModal(true); }, paymentMethodData: data, shadow: shadow, cardEnabled: cardEnabled })) : (jsxRuntime.jsx(EmptyCard, { onClick: function () { return setShowModal(true); }, shadow: shadow, cardEnabled: cardEnabled })), jsxRuntime.jsx(antd.Drawer, __assign({ closeIcon: null, onClose: function () { return setShowModal(false); }, open: showModal, styles: {
|
|
3857
3744
|
body: isMobile
|
|
3858
3745
|
? {
|
|
3859
3746
|
padding: "1rem 0 0",
|
|
3860
3747
|
}
|
|
3861
3748
|
: {},
|
|
3862
|
-
|
|
3863
|
-
}, title: jsxRuntime.jsx(DrawerHeader, { onClose: function () { return setShowModal(false); }, title: "New payment method" }) }, { children: jsxRuntime.jsx(PaymentForm, { entityId: entityId, isSaving: isSaving, onFail: function (error) {
|
|
3749
|
+
}, title: jsxRuntime.jsx(DrawerHeader, { onClose: function () { return setShowModal(false); }, title: "New payment method" }) }, { children: jsxRuntime.jsx(PaymentForm, { entityId: entityId, onFail: function (error) {
|
|
3864
3750
|
handleAllErrorFormats(error);
|
|
3865
|
-
setIsSaving(false);
|
|
3866
3751
|
}, onPaymentSuccess: function () {
|
|
3867
3752
|
onSuccess();
|
|
3868
|
-
|
|
3869
|
-
}, setIsSaving: setIsSaving }) }))] }));
|
|
3753
|
+
} }) }))] })));
|
|
3870
3754
|
};
|
|
3871
|
-
function PaymentMethod(_a) {
|
|
3872
|
-
var entityId = _a.entityId, footer = _a.footer;
|
|
3873
|
-
return (jsxRuntime.jsx(PaymentMethodContext.Provider, __assign({ value: { footer: footer } }, { children: jsxRuntime.jsx(ActualPaymentMethod, { entityId: entityId }) })));
|
|
3874
|
-
}
|
|
3875
3755
|
|
|
3876
3756
|
var pageWrapperClassName = function (isMobile) {
|
|
3877
3757
|
return "flex flex-col grow pt-4 ".concat(isMobile ? "pb-4 overflow-hidden" : "pb-8", " ").concat("content-container");
|
|
@@ -3906,6 +3786,30 @@ var quoteRecalculateTaxes = function (_a) {
|
|
|
3906
3786
|
});
|
|
3907
3787
|
};
|
|
3908
3788
|
|
|
3789
|
+
var MUTATION$6 = "{\n currentUser {\n taxationRequiredAccountFields\n }\n}";
|
|
3790
|
+
var getTaxationRequiredAccountFields = function (_a) {
|
|
3791
|
+
var token = _a.token, apiHost = _a.apiHost;
|
|
3792
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
3793
|
+
var response;
|
|
3794
|
+
var _b, _c;
|
|
3795
|
+
return __generator(this, function (_d) {
|
|
3796
|
+
switch (_d.label) {
|
|
3797
|
+
case 0: return [4 /*yield*/, common.gqlRequest({
|
|
3798
|
+
query: MUTATION$6,
|
|
3799
|
+
token: token,
|
|
3800
|
+
apiHost: apiHost,
|
|
3801
|
+
})];
|
|
3802
|
+
case 1:
|
|
3803
|
+
response = _d.sent();
|
|
3804
|
+
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
|
|
3805
|
+
? response.currentUser
|
|
3806
|
+
.taxationRequiredAccountFields
|
|
3807
|
+
: null];
|
|
3808
|
+
}
|
|
3809
|
+
});
|
|
3810
|
+
});
|
|
3811
|
+
};
|
|
3812
|
+
|
|
3909
3813
|
var useHasTaxPlugin = function (_a) {
|
|
3910
3814
|
var entityId = _a.entityId, apiHost = _a.apiHost, token = _a.token;
|
|
3911
3815
|
var plugins = usePlugins({
|
|
@@ -3916,7 +3820,7 @@ var useHasTaxPlugin = function (_a) {
|
|
|
3916
3820
|
return Boolean(plugins === null || plugins === void 0 ? void 0 : plugins.some(function (plugin) { return plugin.type === "taxation"; }));
|
|
3917
3821
|
};
|
|
3918
3822
|
|
|
3919
|
-
var MUTATION$
|
|
3823
|
+
var MUTATION$5 = "\nmutation accountUpdate(\n $id: ID!,\n $attributes: AccountAttributes!) {\n accountUpdate(\n id: $id,\n attributes: $attributes\n ) {\n account {\n id\n billingCountry\n billingState\n billingStreet\n billingCity\n billingZip\n name\n }\n errors\n }\n }\n";
|
|
3920
3824
|
var accountUpdate = function (_a) {
|
|
3921
3825
|
var accountId = _a.accountId, attributes = _a.attributes, token = _a.token, apiHost = _a.apiHost;
|
|
3922
3826
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -3927,7 +3831,7 @@ var accountUpdate = function (_a) {
|
|
|
3927
3831
|
case 0:
|
|
3928
3832
|
vars = { id: accountId, attributes: attributes };
|
|
3929
3833
|
return [4 /*yield*/, common.gqlRequest({
|
|
3930
|
-
query: MUTATION$
|
|
3834
|
+
query: MUTATION$5,
|
|
3931
3835
|
token: token,
|
|
3932
3836
|
vars: vars,
|
|
3933
3837
|
apiHost: apiHost,
|
|
@@ -3987,11 +3891,16 @@ var FormBillingState = function (_a) {
|
|
|
3987
3891
|
return (jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Billing state", name: "billingState", rules: [{ required: billingStateRequired }] }, { children: jsxRuntime.jsx(antd.Input, { placeholder: "State" }) })));
|
|
3988
3892
|
};
|
|
3989
3893
|
|
|
3894
|
+
var getQuoteAmountDue = function (quote) {
|
|
3895
|
+
return quote.amountDue;
|
|
3896
|
+
};
|
|
3897
|
+
|
|
3990
3898
|
var QuoteCheckout = function (_a) {
|
|
3991
|
-
var account = _a.account,
|
|
3899
|
+
var account = _a.account, onSuccess = _a.onSuccess, onFail = _a.onFail, quote = _a.quote, taxationRequiredAccountFields = _a.taxationRequiredAccountFields, entityId = _a.entityId;
|
|
3992
3900
|
// Context
|
|
3993
3901
|
var isMobile = common.useIsMobile();
|
|
3994
3902
|
var _b = React.useContext(BunnyContext), apiHost = _b.apiHost, token = _b.token;
|
|
3903
|
+
var _c = React.useState(false), isSaving = _c[0], setIsSaving = _c[1];
|
|
3995
3904
|
var paymentRequired = getQuoteAmountDue(quote) > 0;
|
|
3996
3905
|
var checkoutMutation = reactQuery.useMutation({
|
|
3997
3906
|
mutationFn: function (_a) {
|
|
@@ -4035,6 +3944,7 @@ var QuoteCheckout = function (_a) {
|
|
|
4035
3944
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
4036
3945
|
var token_1, plugin, savePaymentMethod, metadata, paymentMethodId;
|
|
4037
3946
|
return __generator(this, function (_b) {
|
|
3947
|
+
setIsSaving(true);
|
|
4038
3948
|
if (pluginPaymentResponse) {
|
|
4039
3949
|
token_1 = pluginPaymentResponse.token, plugin = pluginPaymentResponse.plugin, savePaymentMethod = pluginPaymentResponse.savePaymentMethod, metadata = pluginPaymentResponse.metadata;
|
|
4040
3950
|
checkoutMutation.mutate({
|
|
@@ -4057,48 +3967,34 @@ var QuoteCheckout = function (_a) {
|
|
|
4057
3967
|
else {
|
|
4058
3968
|
checkoutMutation.mutate({});
|
|
4059
3969
|
}
|
|
3970
|
+
setIsSaving(false);
|
|
4060
3971
|
return [2 /*return*/];
|
|
4061
3972
|
});
|
|
4062
3973
|
});
|
|
4063
3974
|
};
|
|
4064
3975
|
if (taxationRequiredAccountFields)
|
|
4065
3976
|
return (jsxRuntime.jsx(PaymentFormWrapper, __assign({ setMaxHeight: false }, { children: jsxRuntime.jsx(TaxationForm, { account: account, quote: quote }) })));
|
|
4066
|
-
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: paymentRequired ? (jsxRuntime.jsx(PaymentForm, { entityId: entityId,
|
|
4067
|
-
setIsSaving(true);
|
|
3977
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: paymentRequired ? (jsxRuntime.jsx(PaymentForm, { entityId: entityId, onFail: onFail, onPaymentSuccess: handleCheckout, quote: quote })) : (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({ onClick: function () {
|
|
4068
3978
|
handleCheckout({});
|
|
4069
3979
|
}, type: "primary" }, { children: isSaving ? "Processing..." : "Complete order" })), jsxRuntime.jsx("div", __assign({ className: "text-xs text-slate-500" }, { children: "No payment is required" }))] })) }))) }));
|
|
4070
3980
|
};
|
|
4071
|
-
|
|
4072
|
-
var
|
|
4073
|
-
var
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
query: MUTATION$5,
|
|
4082
|
-
token: token,
|
|
4083
|
-
apiHost: apiHost,
|
|
4084
|
-
})];
|
|
4085
|
-
case 1:
|
|
4086
|
-
response = _d.sent();
|
|
4087
|
-
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
|
|
4088
|
-
? response.currentUser
|
|
4089
|
-
.taxationRequiredAccountFields
|
|
4090
|
-
: null];
|
|
4091
|
-
}
|
|
4092
|
-
});
|
|
4093
|
-
});
|
|
3981
|
+
var PaymentFormWrapper = function (_a) {
|
|
3982
|
+
var children = _a.children, setMaxHeight = _a.setMaxHeight, className = _a.className;
|
|
3983
|
+
var isMobile = common.useIsMobile();
|
|
3984
|
+
return (jsxRuntime.jsx("div", __assign({ className: "flex flex-col gap-6 shrink-0 ".concat(isMobile ? "w-full shadow-padding-xb" : "", " ").concat(className), style: __assign({}, (isMobile
|
|
3985
|
+
? setMaxHeight
|
|
3986
|
+
? { maxHeight: "60vh" }
|
|
3987
|
+
: {}
|
|
3988
|
+
: {
|
|
3989
|
+
width: "350px",
|
|
3990
|
+
})) }, { children: children })));
|
|
4094
3991
|
};
|
|
4095
3992
|
|
|
4096
3993
|
var queryKeyFactory = common.QueryKeyFactory.default;
|
|
4097
3994
|
var Checkout = function (_a) {
|
|
4098
3995
|
var _b, _c;
|
|
4099
3996
|
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;
|
|
4100
|
-
var
|
|
4101
|
-
var _f = React.useState(false), isSaving = _f[0], setIsSaving = _f[1];
|
|
3997
|
+
var apiHost = React.useContext(BunnyContext).apiHost;
|
|
4102
3998
|
var isMobile = common.useIsMobile();
|
|
4103
3999
|
var hasTaxPlugin = useHasTaxPlugin({
|
|
4104
4000
|
entityId: entityId,
|
|
@@ -4107,20 +4003,20 @@ var Checkout = function (_a) {
|
|
|
4107
4003
|
});
|
|
4108
4004
|
var queryClient = reactQuery.useQueryClient();
|
|
4109
4005
|
// Queries
|
|
4110
|
-
var
|
|
4006
|
+
var _e = reactQuery.useQuery({
|
|
4111
4007
|
queryKey: ["getTaxationRequiredAccountFields", token],
|
|
4112
4008
|
queryFn: function () { return getTaxationRequiredAccountFields({ token: token, apiHost: apiHost }); },
|
|
4113
4009
|
enabled: Boolean(quote),
|
|
4114
4010
|
staleTime: 0,
|
|
4115
|
-
}), taxationRequiredAccountFields =
|
|
4116
|
-
var
|
|
4011
|
+
}), taxationRequiredAccountFields = _e.data, isLoadingTaxationRequiredAccountFields = _e.isLoading;
|
|
4012
|
+
var _f = reactQuery.useQuery({
|
|
4117
4013
|
queryKey: ["account", quote === null || quote === void 0 ? void 0 : quote.accountId],
|
|
4118
4014
|
queryFn: function () {
|
|
4119
4015
|
return (quote === null || quote === void 0 ? void 0 : quote.accountId) && common.getAccount({ id: quote.accountId, token: token, apiHost: apiHost });
|
|
4120
4016
|
},
|
|
4121
4017
|
enabled: Boolean(quote === null || quote === void 0 ? void 0 : quote.accountId) &&
|
|
4122
4018
|
((taxationRequiredAccountFields === null || taxationRequiredAccountFields === void 0 ? void 0 : taxationRequiredAccountFields.length) || 0) > 0,
|
|
4123
|
-
}), account =
|
|
4019
|
+
}), account = _f.data, isLoadingAccount = _f.isLoading;
|
|
4124
4020
|
reactQuery.useQuery({
|
|
4125
4021
|
queryKey: queryKeyFactory.createQuoteTaxCalculateKey(quote === null || quote === void 0 ? void 0 : quote.id),
|
|
4126
4022
|
queryFn: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -4157,30 +4053,24 @@ var Checkout = function (_a) {
|
|
|
4157
4053
|
return null;
|
|
4158
4054
|
return (jsxRuntime.jsx("div", __assign({ className: "flex flex-col fixed top-0 left-0 right-0 bottom-0 bg-slate-50 overflow-auto", style: {
|
|
4159
4055
|
zIndex: 1001,
|
|
4160
|
-
} }, { 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,
|
|
4056
|
+
} }, { 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, onFail: function (error) {
|
|
4161
4057
|
onFail(error);
|
|
4162
|
-
setIsSaving(false);
|
|
4163
4058
|
}, onSuccess: function (_a) {
|
|
4164
4059
|
var savePaymentMethod = _a.savePaymentMethod;
|
|
4165
4060
|
onSuccess({ savePaymentMethod: savePaymentMethod });
|
|
4166
|
-
|
|
4167
|
-
}, setIsSaving: setIsSaving, entityId: entityId })) : quote ? (jsxRuntime.jsx(QuoteCheckout, { account: account, entityId: entityId, isSaving: isSaving, onFail: function (error) {
|
|
4061
|
+
}, entityId: entityId })) : quote ? (jsxRuntime.jsx(QuoteCheckout, { account: account, entityId: entityId, onFail: function (error) {
|
|
4168
4062
|
onFail(error);
|
|
4169
|
-
setIsSaving(false);
|
|
4170
4063
|
}, onSuccess: function (_a) {
|
|
4171
4064
|
var savePaymentMethod = _a.savePaymentMethod;
|
|
4172
4065
|
onSuccess({ savePaymentMethod: savePaymentMethod });
|
|
4173
|
-
|
|
4174
|
-
}, quote: quote, setIsSaving: setIsSaving, taxationRequiredAccountFields: taxationRequiredAccountFields, token: token })) : (jsxRuntime.jsx(PaymentForm, { entityId: entityId, isSaving: isSaving, onFail: function (error) {
|
|
4066
|
+
}, quote: quote, taxationRequiredAccountFields: taxationRequiredAccountFields, token: token })) : (jsxRuntime.jsx(PaymentForm, { entityId: entityId, onFail: function (error) {
|
|
4175
4067
|
onFail(error);
|
|
4176
|
-
setIsSaving(false);
|
|
4177
4068
|
}, onPaymentSuccess: function (_a) {
|
|
4178
4069
|
var pluginPaymentResponse = _a.pluginPaymentResponse;
|
|
4179
4070
|
onSuccess({
|
|
4180
4071
|
savePaymentMethod: pluginPaymentResponse === null || pluginPaymentResponse === void 0 ? void 0 : pluginPaymentResponse.savePaymentMethod,
|
|
4181
4072
|
});
|
|
4182
|
-
|
|
4183
|
-
}, setIsSaving: setIsSaving }))] }))] })) })));
|
|
4073
|
+
} }))] }))] })) })));
|
|
4184
4074
|
};
|
|
4185
4075
|
|
|
4186
4076
|
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}"; };
|
|
@@ -4218,7 +4108,32 @@ var accountSignup = function (_a) {
|
|
|
4218
4108
|
});
|
|
4219
4109
|
};
|
|
4220
4110
|
|
|
4221
|
-
var MUTATION$3 =
|
|
4111
|
+
var MUTATION$3 = "\n mutation portalSessionCreate ($tenantCode: String!, $expiry: Int!, $returnUrl: String!) {\n portalSessionCreate (tenantCode: $tenantCode, expiry: $expiry, returnUrl: $returnUrl) {\n errors\n token\n }\n }\n";
|
|
4112
|
+
var portalSessionCreate = function (_a) {
|
|
4113
|
+
var tenantCode = _a.tenantCode, expiry = _a.expiry, returnUrl = _a.returnUrl, token = _a.token, apiHost = _a.apiHost;
|
|
4114
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
4115
|
+
var response, errors;
|
|
4116
|
+
var _b;
|
|
4117
|
+
return __generator(this, function (_c) {
|
|
4118
|
+
switch (_c.label) {
|
|
4119
|
+
case 0: return [4 /*yield*/, common.gqlRequest({
|
|
4120
|
+
query: MUTATION$3,
|
|
4121
|
+
token: token,
|
|
4122
|
+
vars: { tenantCode: tenantCode, expiry: expiry, returnUrl: returnUrl },
|
|
4123
|
+
apiHost: apiHost,
|
|
4124
|
+
})];
|
|
4125
|
+
case 1:
|
|
4126
|
+
response = _c.sent();
|
|
4127
|
+
errors = (response === null || response === void 0 ? void 0 : response.portalSessionCreate).errors;
|
|
4128
|
+
if (errors)
|
|
4129
|
+
throw errors;
|
|
4130
|
+
return [2 /*return*/, (_b = response === null || response === void 0 ? void 0 : response.portalSessionCreate) === null || _b === void 0 ? void 0 : _b.token];
|
|
4131
|
+
}
|
|
4132
|
+
});
|
|
4133
|
+
});
|
|
4134
|
+
};
|
|
4135
|
+
|
|
4136
|
+
var MUTATION$2 = function () { return "\nmutation QuoteAccountSignup (\n $accountName: String!,\n $billingContact: ContactAttributes!,\n $entityId: ID!,\n $priceListCode: String!\n) {\n quoteAccountSignup(\n entityId: $entityId,\n priceListCode: $priceListCode,\n accountName: $accountName,\n billingContact: $billingContact\n ) {\n account {\n id\n }\n 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 tenant {\n code\n }\n errors\n }\n}"; };
|
|
4222
4137
|
var quoteAccountSignup = function (_a) {
|
|
4223
4138
|
var token = _a.token, apiHost = _a.apiHost, entityId = _a.entityId, priceListCode = _a.priceListCode, accountName = _a.accountName, billingContact = _a.billingContact;
|
|
4224
4139
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -4234,7 +4149,7 @@ var quoteAccountSignup = function (_a) {
|
|
|
4234
4149
|
billingContact: billingContact,
|
|
4235
4150
|
};
|
|
4236
4151
|
return [4 /*yield*/, common.gqlRequest({
|
|
4237
|
-
query: MUTATION$
|
|
4152
|
+
query: MUTATION$2(),
|
|
4238
4153
|
token: token,
|
|
4239
4154
|
vars: vars,
|
|
4240
4155
|
apiHost: apiHost,
|
|
@@ -4250,7 +4165,7 @@ var quoteAccountSignup = function (_a) {
|
|
|
4250
4165
|
});
|
|
4251
4166
|
};
|
|
4252
4167
|
|
|
4253
|
-
var MUTATION$
|
|
4168
|
+
var MUTATION$1 = function () { return "\nquery PriceList($code: String!) {\n priceList (code: $code) {\n basePrice\n code\n createdAt\n currencyId\n id\n isVisible\n name\n periodMonths\n planId\n priceDescription\n productId\n sku\n trialAllowed\n trialLengthDays\n updatedAt\n }\n}"; };
|
|
4254
4169
|
var getPriceList = function (_a) {
|
|
4255
4170
|
var token = _a.token, code = _a.code, apiHost = _a.apiHost;
|
|
4256
4171
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -4258,7 +4173,7 @@ var getPriceList = function (_a) {
|
|
|
4258
4173
|
return __generator(this, function (_b) {
|
|
4259
4174
|
switch (_b.label) {
|
|
4260
4175
|
case 0: return [4 /*yield*/, common.gqlRequest({
|
|
4261
|
-
query: MUTATION$
|
|
4176
|
+
query: MUTATION$1(),
|
|
4262
4177
|
token: token,
|
|
4263
4178
|
vars: { code: code },
|
|
4264
4179
|
apiHost: apiHost,
|
|
@@ -4272,8 +4187,8 @@ var getPriceList = function (_a) {
|
|
|
4272
4187
|
};
|
|
4273
4188
|
|
|
4274
4189
|
function PaymentForms(_a) {
|
|
4275
|
-
var quote = _a.quote,
|
|
4276
|
-
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: quote ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children:
|
|
4190
|
+
var quote = _a.quote, handlePaymentSaveSuccess = _a.handlePaymentSaveSuccess, handlePaymentFail = _a.handlePaymentFail, handleSubmit = _a.handleSubmit, proceedingToPayment = _a.proceedingToPayment, entityId = _a.entityId, accountId = _a.accountId;
|
|
4191
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: quote ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx(PaymentForm, { entityId: entityId, onFail: handlePaymentFail, onPaymentSuccess: handlePaymentSaveSuccess, accountId: accountId, quote: quote }) })) : (jsxRuntime.jsx(InitialSignupForm, { onSubmit: handleSubmit, submitting: proceedingToPayment })) }));
|
|
4277
4192
|
}
|
|
4278
4193
|
function InitialSignupForm(_a) {
|
|
4279
4194
|
var onSubmit = _a.onSubmit, submitting = _a.submitting;
|
|
@@ -4288,7 +4203,7 @@ function InitialSignupForm(_a) {
|
|
|
4288
4203
|
var _b = e.target, name = _b.name, value = _b.value;
|
|
4289
4204
|
setFormData(__assign(__assign({}, formData), (_a = {}, _a[name] = value, _a)));
|
|
4290
4205
|
};
|
|
4291
|
-
return (jsxRuntime.jsxs(antd.Form, __assign({ className: "flex
|
|
4206
|
+
return (jsxRuntime.jsxs(antd.Form, __assign({ className: "flex flex-col justify-between h-full w-full", onFinish: function () { return onSubmit(formData); } }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex flex-col space-y-2" }, { children: [jsxRuntime.jsx(antd.Form.Item, __assign({ rules: [{ required: true, message: "Please input your first name!" }], initialValue: formData.firstName }, { children: jsxRuntime.jsx(antd.Input, { placeholder: "First name", value: formData.firstName, onChange: function (e) {
|
|
4292
4207
|
handleInputChange(e);
|
|
4293
4208
|
setFormData(__assign(__assign({}, formData), { firstName: e.target.value }));
|
|
4294
4209
|
} }) })), jsxRuntime.jsx(antd.Form.Item, __assign({ rules: [{ required: true, message: "Please input your last name!" }], initialValue: formData.lastName }, { children: jsxRuntime.jsx(antd.Input, { placeholder: "Last name", value: formData.lastName, onChange: function (e) {
|
|
@@ -4308,61 +4223,40 @@ function InitialSignupForm(_a) {
|
|
|
4308
4223
|
} }) }))] })), 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" })) })] })));
|
|
4309
4224
|
}
|
|
4310
4225
|
|
|
4311
|
-
var Title = antd.Typography.Title, Text$
|
|
4226
|
+
var Title = antd.Typography.Title, Text$6 = antd.Typography.Text;
|
|
4312
4227
|
function PaymentSuccessDisplay(_a) {
|
|
4313
4228
|
var amountPaid = _a.amountPaid, className = _a.className, companyName = _a.companyName, returnUrl = _a.returnUrl, style = _a.style;
|
|
4314
4229
|
var window = React.useContext(BunnyContext).window;
|
|
4315
|
-
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$
|
|
4230
|
+
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$6, __assign({ className: "text-slate-500 cursor-pointer underline", onClick: function () { return (window.location.href = returnUrl); } }, { children: ["Back to ", companyName] })))] })));
|
|
4316
4231
|
}
|
|
4317
4232
|
|
|
4318
|
-
var Text$
|
|
4233
|
+
var Text$5 = antd.Typography.Text;
|
|
4319
4234
|
function PriceListDisplay(_a) {
|
|
4320
4235
|
var priceListData = _a.priceListData, topNavImageUrl = _a.topNavImageUrl;
|
|
4321
4236
|
if (!priceListData)
|
|
4322
4237
|
return null;
|
|
4323
|
-
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$
|
|
4238
|
+
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$5, __assign({ className: "text-slate-500 font-bold text-lg" }, { children: priceListData.name })), jsxRuntime.jsxs(Text$5, __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$5, __assign({ style: { fontSize: "16px" }, className: "text-slate-500" }, { children: [priceListData.trialLengthDays, " day trial"] })), jsxRuntime.jsx(Text$5, __assign({ className: "text-slate-500", style: { fontSize: "12px" } }, { children: "You will not be charged until the last day of the trial." }))] }))] })) })) }));
|
|
4324
4239
|
}
|
|
4325
4240
|
|
|
4326
|
-
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";
|
|
4327
|
-
var portalSessionCreate = function (_a) {
|
|
4328
|
-
var tenantCode = _a.tenantCode, expiry = _a.expiry, returnUrl = _a.returnUrl, token = _a.token, apiHost = _a.apiHost;
|
|
4329
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
4330
|
-
var response, errors;
|
|
4331
|
-
var _b;
|
|
4332
|
-
return __generator(this, function (_c) {
|
|
4333
|
-
switch (_c.label) {
|
|
4334
|
-
case 0: return [4 /*yield*/, common.gqlRequest({
|
|
4335
|
-
query: MUTATION$1,
|
|
4336
|
-
token: token,
|
|
4337
|
-
vars: { tenantCode: tenantCode, expiry: expiry, returnUrl: returnUrl },
|
|
4338
|
-
apiHost: apiHost,
|
|
4339
|
-
})];
|
|
4340
|
-
case 1:
|
|
4341
|
-
response = _c.sent();
|
|
4342
|
-
errors = (response === null || response === void 0 ? void 0 : response.portalSessionCreate).errors;
|
|
4343
|
-
if (errors)
|
|
4344
|
-
throw errors;
|
|
4345
|
-
return [2 /*return*/, (_b = response === null || response === void 0 ? void 0 : response.portalSessionCreate) === null || _b === void 0 ? void 0 : _b.token];
|
|
4346
|
-
}
|
|
4347
|
-
});
|
|
4348
|
-
});
|
|
4349
|
-
};
|
|
4350
|
-
|
|
4351
4241
|
var showErrorNotification = common.useErrorNotification();
|
|
4352
4242
|
function Signup(_a) {
|
|
4353
|
-
var companyName = _a.companyName, entityId = _a.entityId, priceListCode = _a.priceListCode, returnUrl = _a.returnUrl;
|
|
4243
|
+
var companyName = _a.companyName, entityId = _a.entityId, priceListCode = _a.priceListCode, returnUrl = _a.returnUrl, _b = _a.isCardEnabled, isCardEnabled = _b === void 0 ? true : _b, className = _a.className, _c = _a.shadow, shadow = _c === void 0 ? "shadow-md" : _c, style = _a.style;
|
|
4354
4244
|
// Hooks
|
|
4355
|
-
var
|
|
4245
|
+
var _d = React.useContext(BunnyContext), apiHost = _d.apiHost, token = _d.token, graphQLClient = _d.graphQLClient;
|
|
4356
4246
|
var isMobile = common.useIsMobile();
|
|
4357
4247
|
var topNavImageUrl = React.useContext(BrandContext).topNavImageUrl;
|
|
4358
|
-
var
|
|
4359
|
-
var
|
|
4360
|
-
var
|
|
4361
|
-
var
|
|
4362
|
-
var
|
|
4363
|
-
var
|
|
4364
|
-
var
|
|
4365
|
-
var
|
|
4248
|
+
var _e = React.useState(undefined), quote = _e[0], setQuote = _e[1];
|
|
4249
|
+
var _f = React.useState(undefined), accountId = _f[0], setAccountId = _f[1];
|
|
4250
|
+
var _g = React.useState(undefined), quoteId = _g[0], setQuoteId = _g[1];
|
|
4251
|
+
var _h = React.useState(undefined), portalSessionToken = _h[0], setPortalSessionToken = _h[1];
|
|
4252
|
+
var _j = React.useState(undefined), formData = _j[0], setFormData = _j[1];
|
|
4253
|
+
var _k = React.useState(false), proceedingToPayment = _k[0], setProceedingToPayment = _k[1];
|
|
4254
|
+
var _l = React.useState(false), purchaseSucceeded = _l[0], setPurchaseSucceeded = _l[1];
|
|
4255
|
+
var _m = React.useState(undefined), paymentMethodGraphQLClient = _m[0], setPaymentMethodGraphQLClient = _m[1];
|
|
4256
|
+
var paymentMethod = usePaymentMethod(paymentMethodGraphQLClient || graphQLClient, accountId).data;
|
|
4257
|
+
var queryClient = reactQuery.useQueryClient();
|
|
4258
|
+
// console.log("signup paymentMethod", paymentMethod);
|
|
4259
|
+
console.log("signup accountId", accountId);
|
|
4366
4260
|
// Queries
|
|
4367
4261
|
var priceListData = reactQuery.useQuery({
|
|
4368
4262
|
queryKey: ["priceList", priceListCode],
|
|
@@ -4401,6 +4295,12 @@ function Signup(_a) {
|
|
|
4401
4295
|
case 2:
|
|
4402
4296
|
portalSessionToken = _a.sent();
|
|
4403
4297
|
setPortalSessionToken(portalSessionToken);
|
|
4298
|
+
setPaymentMethodGraphQLClient(createGraphQLClient(portalSessionToken, apiHost || ""));
|
|
4299
|
+
// We must invalidate the accountPaymentMethodKey query in order to clear payment methods from the provided api token,
|
|
4300
|
+
// to instead use paymentMethods from portalSessionToken.
|
|
4301
|
+
queryClient.invalidateQueries({
|
|
4302
|
+
queryKey: common.QueryKeyFactory.default.accountPaymentMethodKey,
|
|
4303
|
+
});
|
|
4404
4304
|
setQuoteId(data.quote.id);
|
|
4405
4305
|
setProceedingToPayment(false);
|
|
4406
4306
|
setQuote({
|
|
@@ -4413,11 +4313,10 @@ function Signup(_a) {
|
|
|
4413
4313
|
});
|
|
4414
4314
|
}
|
|
4415
4315
|
function handlePaymentSaveSuccess(paymentSuccess) {
|
|
4416
|
-
var _a;
|
|
4417
4316
|
return __awaiter(this, void 0, void 0, function () {
|
|
4418
4317
|
var response, plugin;
|
|
4419
|
-
return __generator(this, function (
|
|
4420
|
-
switch (
|
|
4318
|
+
return __generator(this, function (_a) {
|
|
4319
|
+
switch (_a.label) {
|
|
4421
4320
|
case 0:
|
|
4422
4321
|
if (!formData) {
|
|
4423
4322
|
throw new Error("Form data is required");
|
|
@@ -4438,14 +4337,13 @@ function Signup(_a) {
|
|
|
4438
4337
|
apiHost: apiHost,
|
|
4439
4338
|
entityId: entityId,
|
|
4440
4339
|
quoteId: quoteId,
|
|
4441
|
-
paymentMethodId:
|
|
4340
|
+
paymentMethodId: paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.id,
|
|
4442
4341
|
pluginId: plugin.id.toString(),
|
|
4443
4342
|
priceListCode: priceListCode,
|
|
4444
4343
|
accountId: accountId,
|
|
4445
4344
|
})];
|
|
4446
4345
|
case 1:
|
|
4447
|
-
|
|
4448
|
-
setIsPaying(false);
|
|
4346
|
+
_a.sent();
|
|
4449
4347
|
setPurchaseSucceeded(true);
|
|
4450
4348
|
return [2 /*return*/];
|
|
4451
4349
|
}
|
|
@@ -4454,14 +4352,14 @@ function Signup(_a) {
|
|
|
4454
4352
|
}
|
|
4455
4353
|
function handlePaymentFail(error) {
|
|
4456
4354
|
showErrorNotification(error.message);
|
|
4457
|
-
setIsPaying(false);
|
|
4458
|
-
}
|
|
4459
|
-
if (isMobile) {
|
|
4460
|
-
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 || "" }) }))] }))) })));
|
|
4461
|
-
}
|
|
4462
|
-
else {
|
|
4463
|
-
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 || "" }) }))] }))) })) }));
|
|
4464
4355
|
}
|
|
4356
|
+
var WrapperComponent = function (_a) {
|
|
4357
|
+
var children = _a.children, className = _a.className, style = _a.style;
|
|
4358
|
+
return isCardEnabled ? (jsxRuntime.jsx(Card, __assign({ className: className, style: style }, { children: children }))) : (jsxRuntime.jsx("div", __assign({ className: className, style: style }, { children: children })));
|
|
4359
|
+
};
|
|
4360
|
+
return (jsxRuntime.jsx(WrapperComponent, __assign({ className: "p-4 flex flex-col ".concat(shadow, " ").concat(className), style: style }, { 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 ".concat(isMobile ? "items-center" : "w-1/2 items-center") }, { children: jsxRuntime.jsx(PriceListDisplay, { priceListData: priceListData, topNavImageUrl: topNavImageUrl }) })), jsxRuntime.jsx("div", __assign({ className: "".concat(isMobile ? "h-full" : "my-4") }, { children: jsxRuntime.jsx(antd.Divider, { className: "h-full", type: isMobile ? undefined : "vertical" }) })), jsxRuntime.jsx("div", __assign({ className: "flex ".concat(isMobile
|
|
4361
|
+
? "items-center justify-center my-12"
|
|
4362
|
+
: "w-1/2 items-center justify-center my-12") }, { children: jsxRuntime.jsx("div", __assign({ className: "".concat(isMobile ? "w-full" : "w-1/2") }, { children: jsxRuntime.jsx(PaymentForms, { entityId: entityId, quote: quote, handlePaymentSaveSuccess: handlePaymentSaveSuccess, handlePaymentFail: handlePaymentFail, handleSubmit: handleSubmit, proceedingToPayment: proceedingToPayment, accountId: accountId }) })) }))] }))) })));
|
|
4465
4363
|
}
|
|
4466
4364
|
|
|
4467
4365
|
// WARNING: There is a preview button on APP that will need to be changed if this query is changed
|
|
@@ -4595,6 +4493,19 @@ var ErrorView = function (_a) {
|
|
|
4595
4493
|
return (jsxRuntime.jsxs("div", __assign({ className: "flex flex-col w-full", style: { marginTop: "80px" } }, { children: [jsxRuntime.jsx("div", __assign({ style: { fontSize: "32px" } }, { children: message })), children] })));
|
|
4596
4494
|
};
|
|
4597
4495
|
|
|
4496
|
+
var Text$4 = antd.Typography.Text;
|
|
4497
|
+
var PageHeaderWithActions = function (_a) {
|
|
4498
|
+
var children = _a.children, title = _a.title, className = _a.className;
|
|
4499
|
+
var isMobile = common.useIsMobile();
|
|
4500
|
+
return (jsxRuntime.jsxs("div", __assign({ className: "flex pb-4 shadow-padding-x ".concat(className, " ").concat(isMobile ? "flex-col gap-2" : "items-center justify-between h-8") }, { children: [jsxRuntime.jsx(PageSubTitle, { title: title }), children] })));
|
|
4501
|
+
};
|
|
4502
|
+
var PageSubTitle = function (_a) {
|
|
4503
|
+
var title = _a.title;
|
|
4504
|
+
var secondaryColor = React.useContext(BrandContext).secondaryColor;
|
|
4505
|
+
var darkMode = React.useContext(BunnyContext).darkMode;
|
|
4506
|
+
return (jsxRuntime.jsx(Text$4, __assign({ className: "shrink-0 font-medium", style: { color: darkMode ? undefined : secondaryColor } }, { children: title })));
|
|
4507
|
+
};
|
|
4508
|
+
|
|
4598
4509
|
var Text$3 = antd.Typography.Text;
|
|
4599
4510
|
var HideExpiredToggle = function (_a) {
|
|
4600
4511
|
var hideExpired = _a.hideExpired, setHideExpired = _a.setHideExpired, subscriptions = _a.subscriptions;
|
|
@@ -5184,9 +5095,9 @@ var SubscriptionsContext = React.createContext({});
|
|
|
5184
5095
|
// !!! This component is intended to be view only, however it still has lots of code for full functionality.
|
|
5185
5096
|
// !!! This must be refactored.
|
|
5186
5097
|
var Subscriptions = function (_a) {
|
|
5187
|
-
var companyName = _a.companyName, entityId = _a.entityId, gap = _a.gap, shadow = _a.shadow, _b = _a.showTitle, showTitle = _b === void 0 ? true : _b;
|
|
5098
|
+
var companyName = _a.companyName, entityId = _a.entityId, gap = _a.gap, shadow = _a.shadow, _b = _a.showTitle, showTitle = _b === void 0 ? true : _b, className = _a.className;
|
|
5188
5099
|
// Context
|
|
5189
|
-
var _c = React.useContext(BunnyContext), token = _c.token, apiHost = _c.apiHost,
|
|
5100
|
+
var _c = React.useContext(BunnyContext), token = _c.token, apiHost = _c.apiHost, onTokenExpired = _c.onTokenExpired;
|
|
5190
5101
|
// Recoil state
|
|
5191
5102
|
// const [updatingChargeQuantityId, setUpdatingChargeQuantityId] =
|
|
5192
5103
|
// useRecoilState(updatingChargeQuantityIdState);
|
|
@@ -5196,10 +5107,7 @@ var Subscriptions = function (_a) {
|
|
|
5196
5107
|
var _f = React.useState(true), hideExpired = _f[0], setHideExpired = _f[1];
|
|
5197
5108
|
var _g = React.useState(false); _g[0]; var setQuantityDrawerOpen = _g[1];
|
|
5198
5109
|
// Hooks
|
|
5199
|
-
var handleAllErrorFormats = common.useAllErrorFormats(
|
|
5200
|
-
(function (url) {
|
|
5201
|
-
console.log("navigate to", url, " not implemented");
|
|
5202
|
-
}));
|
|
5110
|
+
var handleAllErrorFormats = common.useAllErrorFormats(onTokenExpired);
|
|
5203
5111
|
var queryClient = reactQuery.useQueryClient();
|
|
5204
5112
|
var showSuccessNotification = common.useSuccessNotification();
|
|
5205
5113
|
// const quoteDelete = useQuoteDelete();
|
|
@@ -5277,7 +5185,7 @@ var Subscriptions = function (_a) {
|
|
|
5277
5185
|
shadow: shadow,
|
|
5278
5186
|
gap: gap,
|
|
5279
5187
|
showTitle: showTitle,
|
|
5280
|
-
} }, { 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: {
|
|
5188
|
+
} }, { children: [showTitle && (jsxRuntime.jsx(PageHeaderWithActions, __assign({ className: className, 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 ").concat(className), style: {
|
|
5281
5189
|
flexShrink: 1,
|
|
5282
5190
|
} }, { 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 })] })));
|
|
5283
5191
|
};
|