@bunnyapp/components 1.0.11 → 1.0.13
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 +1112 -1214
- 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 +1116 -1218
- 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 +2 -2
- 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,30 +1629,8 @@ 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
|
-
var isMobile = common.useIsMobile();
|
|
1617
|
-
var _c = React.useState(undefined), branding = _c[0], setBranding = _c[1];
|
|
1618
|
-
// ====== START - Copied straight from PageContainer.tsx ========
|
|
1619
|
-
var entityBranding = React.useMemo(function () {
|
|
1620
|
-
var _a;
|
|
1621
|
-
// This is to determine if the secondary color should be white or black
|
|
1622
|
-
var brandColor = (branding === null || branding === void 0 ? void 0 : branding.brandColor)
|
|
1623
|
-
? "#" + ((_a = branding === null || branding === void 0 ? void 0 : branding.brandColor) === null || _a === void 0 ? void 0 : _a.toString(16))
|
|
1624
|
-
: common.DEFAULT_BRAND_COLOR;
|
|
1625
|
-
var secondaryColor = common.DEFAULT_SECONDARY_COLOR;
|
|
1626
|
-
if (!isMobile && common.isColorTooDark(branding === null || branding === void 0 ? void 0 : branding.accentColor))
|
|
1627
|
-
secondaryColor = "#ffffff";
|
|
1628
|
-
var topNavImageUrl = (branding === null || branding === void 0 ? void 0 : branding.topNavImageUrl) || common.DEFAULT_TOP_NAV_IMAGE_URL;
|
|
1629
|
-
var accentColor = (branding === null || branding === void 0 ? void 0 : branding.accentColor) || common.DEFAULT_ACCENT_COLOR;
|
|
1630
|
-
return {
|
|
1631
|
-
accentColor: accentColor,
|
|
1632
|
-
brandColor: brandColor,
|
|
1633
|
-
secondaryColor: secondaryColor,
|
|
1634
|
-
topNavImageUrl: topNavImageUrl,
|
|
1635
|
-
};
|
|
1636
|
-
}, [branding, isMobile]);
|
|
1637
|
-
// ============================= END ==============================
|
|
1638
1634
|
React.useEffect(function () {
|
|
1639
1635
|
var script = document.createElement("script");
|
|
1640
1636
|
script.src = "https://js.finix.com/v/1/0/6/finix.js";
|
|
@@ -1648,48 +1644,39 @@ function BunnyProvider(_a) {
|
|
|
1648
1644
|
accountId: accountId,
|
|
1649
1645
|
darkMode: darkMode,
|
|
1650
1646
|
graphQLClient: graphQLClient,
|
|
1651
|
-
onErrorNavigate: onErrorNavigate,
|
|
1652
1647
|
apiHost: apiHost,
|
|
1653
1648
|
token: token,
|
|
1654
1649
|
window: window,
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
? theme__default["default"].darkAlgorithm
|
|
1658
|
-
: theme__default["default"].defaultAlgorithm,
|
|
1659
|
-
token: {
|
|
1660
|
-
borderRadius: 4,
|
|
1661
|
-
colorPrimary: entityBranding.brandColor,
|
|
1662
|
-
colorLink: entityBranding.brandColor,
|
|
1663
|
-
colorLinkActive: entityBranding.brandColor,
|
|
1664
|
-
colorLinkHover: entityBranding.brandColor,
|
|
1665
|
-
fontFamily: common.MARK_PRO,
|
|
1666
|
-
colorBorder: common.INPUT_BORDER_COLOR,
|
|
1667
|
-
},
|
|
1668
|
-
components: {
|
|
1669
|
-
Drawer: {
|
|
1670
|
-
colorBgElevated: darkMode
|
|
1671
|
-
? "var(--row-background-dark)"
|
|
1672
|
-
: common.SLATE_50,
|
|
1673
|
-
},
|
|
1674
|
-
Divider: {
|
|
1675
|
-
colorSplit: darkMode ? common.SLATE_400 : common.SLATE_200,
|
|
1676
|
-
},
|
|
1677
|
-
},
|
|
1678
|
-
} }, { children: jsxRuntime.jsx(SecondaryWrapper, __assign({ setBranding: setBranding }, { children: children })) })) })) }) }))] })));
|
|
1650
|
+
onTokenExpired: onTokenExpired,
|
|
1651
|
+
} }, { children: [jsxRuntime.jsx("div", __assign({ style: { position: "fixed", left: -2000000000 } }, { children: "test" })), jsxRuntime.jsx(reactQuery.QueryClientProvider, __assign({ client: queryClient || extraQueryClient }, { children: jsxRuntime.jsx(ContextualWrapper, __assign({ darkMode: darkMode }, { children: children })) }))] })));
|
|
1679
1652
|
}
|
|
1680
|
-
function
|
|
1681
|
-
var children = _a.children,
|
|
1653
|
+
function ContextualWrapper(_a) {
|
|
1654
|
+
var children = _a.children, darkMode = _a.darkMode;
|
|
1682
1655
|
var _b = React.useState(false), interFontLoaded = _b[0], setInterFontLoaded = _b[1];
|
|
1683
1656
|
var _c = React.useContext(BunnyContext), apiHost = _c.apiHost, token = _c.token;
|
|
1684
|
-
var
|
|
1657
|
+
var branding = reactQuery.useQuery({
|
|
1685
1658
|
queryKey: common.QueryKeyFactory.default.brandingKey,
|
|
1686
1659
|
queryFn: function () { return getBranding({ token: token, apiHost: apiHost }); },
|
|
1687
1660
|
}).data;
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1661
|
+
var isMobile = common.useIsMobile();
|
|
1662
|
+
var entityBranding = React.useMemo(function () {
|
|
1663
|
+
var _a;
|
|
1664
|
+
// This is to determine if the secondary color should be white or black
|
|
1665
|
+
var brandColor = (branding === null || branding === void 0 ? void 0 : branding.brandColor)
|
|
1666
|
+
? "#" + ((_a = branding === null || branding === void 0 ? void 0 : branding.brandColor) === null || _a === void 0 ? void 0 : _a.toString(16))
|
|
1667
|
+
: common.DEFAULT_BRAND_COLOR;
|
|
1668
|
+
var secondaryColor = common.DEFAULT_SECONDARY_COLOR;
|
|
1669
|
+
if (!isMobile && common.isColorTooDark(branding === null || branding === void 0 ? void 0 : branding.accentColor))
|
|
1670
|
+
secondaryColor = "#ffffff";
|
|
1671
|
+
var topNavImageUrl = (branding === null || branding === void 0 ? void 0 : branding.topNavImageUrl) || common.DEFAULT_TOP_NAV_IMAGE_URL;
|
|
1672
|
+
var accentColor = (branding === null || branding === void 0 ? void 0 : branding.accentColor) || common.DEFAULT_ACCENT_COLOR;
|
|
1673
|
+
return {
|
|
1674
|
+
accentColor: accentColor,
|
|
1675
|
+
brandColor: brandColor,
|
|
1676
|
+
secondaryColor: secondaryColor,
|
|
1677
|
+
topNavImageUrl: topNavImageUrl,
|
|
1678
|
+
};
|
|
1679
|
+
}, [branding, isMobile]);
|
|
1693
1680
|
// Check if Inter font is loaded
|
|
1694
1681
|
React.useEffect(function () {
|
|
1695
1682
|
document.fonts.ready.then(function () {
|
|
@@ -1698,7 +1685,28 @@ function SecondaryWrapper(_a) {
|
|
|
1698
1685
|
}, []);
|
|
1699
1686
|
if (!interFontLoaded)
|
|
1700
1687
|
return null;
|
|
1701
|
-
return jsxRuntime.jsx(
|
|
1688
|
+
return (jsxRuntime.jsx(recoil.RecoilRoot, { children: jsxRuntime.jsx(BrandContext.Provider, __assign({ value: entityBranding }, { children: jsxRuntime.jsx(antd.ConfigProvider, __assign({ theme: {
|
|
1689
|
+
algorithm: darkMode ? theme__default["default"].darkAlgorithm : theme__default["default"].defaultAlgorithm,
|
|
1690
|
+
token: {
|
|
1691
|
+
borderRadius: 4,
|
|
1692
|
+
colorPrimary: entityBranding.brandColor,
|
|
1693
|
+
colorLink: entityBranding.brandColor,
|
|
1694
|
+
colorLinkActive: entityBranding.brandColor,
|
|
1695
|
+
colorLinkHover: entityBranding.brandColor,
|
|
1696
|
+
fontFamily: common.MARK_PRO,
|
|
1697
|
+
colorBorder: common.INPUT_BORDER_COLOR,
|
|
1698
|
+
},
|
|
1699
|
+
components: {
|
|
1700
|
+
Drawer: {
|
|
1701
|
+
colorBgElevated: darkMode
|
|
1702
|
+
? "var(--row-background-dark)"
|
|
1703
|
+
: common.SLATE_50,
|
|
1704
|
+
},
|
|
1705
|
+
Divider: {
|
|
1706
|
+
colorSplit: darkMode ? common.SLATE_400 : common.SLATE_200,
|
|
1707
|
+
},
|
|
1708
|
+
},
|
|
1709
|
+
} }, { children: children })) })) }));
|
|
1702
1710
|
}
|
|
1703
1711
|
|
|
1704
1712
|
var useAjax = function (onError) {
|
|
@@ -1768,27 +1776,39 @@ var InvoiceQuoteView = function (_a) {
|
|
|
1768
1776
|
var children = _a.children, formattedInvoice = _a.formattedInvoice, html = _a.html, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick, onDownloadError = _a.onDownloadError;
|
|
1769
1777
|
var downloadFile = useDownloadFile(formattedInvoice === null || formattedInvoice === void 0 ? void 0 : formattedInvoice.id, onDownloadError);
|
|
1770
1778
|
var secondaryColor = React.useContext(BrandContext).secondaryColor;
|
|
1771
|
-
var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
|
|
1779
|
+
var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
|
|
1780
|
+
var _c = React.useContext(InvoiceQuoteContext), shadow = _c.shadow, hideDownloadButton = _c.hideDownloadButton;
|
|
1772
1781
|
var isMobile = common.useIsMobile();
|
|
1773
|
-
|
|
1782
|
+
var buttonsVisible = formattedInvoice && (!hideDownloadButton || onBackButtonClick);
|
|
1783
|
+
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
1784
|
color: secondaryColor,
|
|
1775
|
-
}, type: "link" }, { children: backButtonName || "Back" }))) : null }), jsxRuntime.jsx(antd.Button, __assign({ icon: jsxRuntime.jsx(DownloadOutlined$1, {}), onClick: function () {
|
|
1785
|
+
}, type: "link" }, { children: backButtonName || "Back" }))) : null }), !hideDownloadButton ? (jsxRuntime.jsx(antd.Button, __assign({ icon: jsxRuntime.jsx(DownloadOutlined$1, {}), onClick: function () {
|
|
1776
1786
|
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: {
|
|
1787
|
+
} }, { 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
1788
|
minWidth: "750px",
|
|
1779
1789
|
} }, { children: [jsxRuntime.jsx(interweave.Markup, { content: html }), children] })))] })));
|
|
1780
1790
|
};
|
|
1781
1791
|
var templateObject_1$8;
|
|
1782
1792
|
|
|
1793
|
+
var quoteMetaDescription = function (vendorName) {
|
|
1794
|
+
return "View this quote on the ".concat(vendorName, " customer portal. Powered by Bunny");
|
|
1795
|
+
};
|
|
1796
|
+
var quoteMetaTitle = function (_a) {
|
|
1797
|
+
var documentName = _a.documentName, vendorName = _a.vendorName;
|
|
1798
|
+
return vendorName + " " + documentName;
|
|
1799
|
+
};
|
|
1800
|
+
|
|
1801
|
+
var PaymentContext = React.createContext({});
|
|
1802
|
+
|
|
1783
1803
|
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) {
|
|
1804
|
+
var usePaymentMethod = function (graphQLClient, accountId) {
|
|
1785
1805
|
var result = reactQuery.useQuery({
|
|
1786
1806
|
queryKey: common.QueryKeyFactory.default.accountPaymentMethodKey,
|
|
1787
1807
|
queryFn: function () {
|
|
1788
1808
|
return graphQLClient
|
|
1789
1809
|
.request(paymentMethodsQuery, {
|
|
1790
1810
|
first: 1,
|
|
1791
|
-
filter: "disabled is false",
|
|
1811
|
+
filter: "disabled is false".concat(accountId ? " and accountId is ".concat(accountId) : ""),
|
|
1792
1812
|
})
|
|
1793
1813
|
.then(function (data) {
|
|
1794
1814
|
var _a, _b;
|
|
@@ -1801,40 +1821,151 @@ var usePaymentMethod = function (graphQLClient) {
|
|
|
1801
1821
|
return result;
|
|
1802
1822
|
};
|
|
1803
1823
|
|
|
1804
|
-
var
|
|
1805
|
-
|
|
1824
|
+
var usePlugins = function (_a) {
|
|
1825
|
+
var entityId = _a.entityId, apiHost = _a.apiHost, token = _a.token;
|
|
1826
|
+
var response = reactQuery.useQuery({
|
|
1827
|
+
queryKey: common.QueryKeyFactory.default.pluginsKey,
|
|
1828
|
+
queryFn: function () {
|
|
1829
|
+
var plugins = common.getPlugins({
|
|
1830
|
+
entityId: entityId,
|
|
1831
|
+
token: token,
|
|
1832
|
+
apiHost: apiHost,
|
|
1833
|
+
});
|
|
1834
|
+
return plugins;
|
|
1835
|
+
},
|
|
1836
|
+
enabled: Boolean(entityId),
|
|
1837
|
+
});
|
|
1838
|
+
return response;
|
|
1806
1839
|
};
|
|
1807
1840
|
|
|
1808
|
-
var
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1841
|
+
var filterPaymentPlugins = function (plugins) {
|
|
1842
|
+
return plugins === null || plugins === void 0 ? void 0 : plugins.filter(function (plugin) {
|
|
1843
|
+
var _a, _b, _c, _d;
|
|
1844
|
+
return ((_a = plugin.type) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === "payment" &&
|
|
1845
|
+
((_b = plugin.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === "valid" &&
|
|
1846
|
+
((_d = (_c = plugin.components) === null || _c === void 0 ? void 0 : _c.frontend) === null || _d === void 0 ? void 0 : _d.length);
|
|
1847
|
+
});
|
|
1848
|
+
};
|
|
1849
|
+
var usePaymentPlugins = function (_a) {
|
|
1850
|
+
var entityId = _a.entityId, apiHost = _a.apiHost, token = _a.token;
|
|
1851
|
+
var _b = usePlugins({
|
|
1852
|
+
entityId: entityId,
|
|
1853
|
+
apiHost: apiHost,
|
|
1854
|
+
token: token,
|
|
1855
|
+
}), plugins = _b.data, isFetched = _b.isFetched;
|
|
1856
|
+
var paymentPlugins = filterPaymentPlugins(Array.isArray(plugins) ? plugins : []);
|
|
1857
|
+
var paymentMethodAllowedPlugins = paymentPlugins === null || paymentPlugins === void 0 ? void 0 : paymentPlugins.filter(function (plugin) {
|
|
1858
|
+
var _a, _b;
|
|
1859
|
+
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"); });
|
|
1860
|
+
});
|
|
1861
|
+
return {
|
|
1862
|
+
paymentPlugins: paymentPlugins,
|
|
1863
|
+
paymentMethodAllowedPlugins: paymentMethodAllowedPlugins,
|
|
1864
|
+
isFetched: isFetched,
|
|
1865
|
+
};
|
|
1818
1866
|
};
|
|
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
1867
|
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
var
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1868
|
+
// Simulated payment creation and confirmation
|
|
1869
|
+
var confirmPayment = function (_a) {
|
|
1870
|
+
var amount = _a.amount, currency = _a.currency;
|
|
1871
|
+
return { token: "DemoPayTestToken", amount: amount, currency: currency };
|
|
1872
|
+
};
|
|
1873
|
+
var DIGIT_REGEX = /\d/;
|
|
1874
|
+
var isDigit = function (char) { return DIGIT_REGEX.test(char); };
|
|
1875
|
+
var isDeletion = function (char) { return [8, 46].includes(char); }; // Backspace or Delete
|
|
1876
|
+
var isNavigation = function (char) { return [9, 37, 38, 39, 40].includes(char); }; // Tab, Arrows
|
|
1877
|
+
var isModifier = function (char) { return [16, 17, 18].includes(char); }; // Shift, Ctrl, Alt
|
|
1878
|
+
var isValidKey = function (code) {
|
|
1879
|
+
return isDeletion(code) || isNavigation(code) || isModifier(code);
|
|
1880
|
+
};
|
|
1881
|
+
var isValidExpiry = function (expiry) {
|
|
1882
|
+
var month = parseInt(expiry.substring(0, 2), 10);
|
|
1883
|
+
var year = parseInt(expiry.substring(2, 4), 10) + 2000;
|
|
1884
|
+
if (isNaN(month) || isNaN(year))
|
|
1885
|
+
return false;
|
|
1886
|
+
if (month < 1 || month > 12)
|
|
1887
|
+
return false;
|
|
1888
|
+
return true;
|
|
1889
|
+
};
|
|
1890
|
+
var isCardExpired = function (expiry) {
|
|
1891
|
+
var month = parseInt(expiry.substring(0, 2), 10);
|
|
1892
|
+
var year = parseInt(expiry.substring(2, 4), 10) + 2000;
|
|
1893
|
+
var expiryDate = new Date(year, month, 1);
|
|
1894
|
+
return expiryDate < new Date();
|
|
1895
|
+
};
|
|
1896
|
+
var formatCardExpiry = function (cardExpiry) {
|
|
1897
|
+
if (cardExpiry.length <= 2)
|
|
1898
|
+
return cardExpiry;
|
|
1899
|
+
return cardExpiry.substring(0, 2) + "/" + cardExpiry.substring(2);
|
|
1900
|
+
};
|
|
1901
|
+
// removes spaces from a credit card number
|
|
1902
|
+
var unformatCardNumber = function (cardNumber) {
|
|
1903
|
+
var cardNumberArray = cardNumber.split("");
|
|
1904
|
+
var unformattedCardNumberArray = cardNumberArray.filter(function (character) { return character !== " "; });
|
|
1905
|
+
return unformattedCardNumberArray.join("");
|
|
1837
1906
|
};
|
|
1907
|
+
var storePayment = function (options, plugin, apiHost, accountId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1908
|
+
var testCreditCardNumber, testCreditCardCvc, testCreditCardExpirationDate, token, response;
|
|
1909
|
+
return __generator(this, function (_a) {
|
|
1910
|
+
switch (_a.label) {
|
|
1911
|
+
case 0:
|
|
1912
|
+
testCreditCardNumber = options.testCreditCardNumber, testCreditCardCvc = options.testCreditCardCvc, testCreditCardExpirationDate = options.testCreditCardExpirationDate, token = options.token;
|
|
1913
|
+
return [4 /*yield*/, common.invokePlugin({
|
|
1914
|
+
method: "store_payment_method",
|
|
1915
|
+
plugin: plugin,
|
|
1916
|
+
payload: {
|
|
1917
|
+
test_credit_card_number: testCreditCardNumber,
|
|
1918
|
+
test_credit_card_cvc: testCreditCardCvc,
|
|
1919
|
+
test_credit_card_expiration_date: testCreditCardExpirationDate,
|
|
1920
|
+
account_id: accountId,
|
|
1921
|
+
},
|
|
1922
|
+
token: token,
|
|
1923
|
+
apiHost: apiHost,
|
|
1924
|
+
})];
|
|
1925
|
+
case 1:
|
|
1926
|
+
response = _a.sent();
|
|
1927
|
+
if ((response === null || response === void 0 ? void 0 : response.status) !== "success")
|
|
1928
|
+
throw new Error(response === null || response === void 0 ? void 0 : response.message);
|
|
1929
|
+
return [2 /*return*/, response];
|
|
1930
|
+
}
|
|
1931
|
+
});
|
|
1932
|
+
}); };
|
|
1933
|
+
|
|
1934
|
+
function usePay$1(_a) {
|
|
1935
|
+
var _this = this;
|
|
1936
|
+
var onPaymentSuccess = _a.onPaymentSuccess, onPaymentError = _a.onPaymentError, quote = _a.quote, invoice = _a.invoice;
|
|
1937
|
+
var pay = function (_a) {
|
|
1938
|
+
var plugin = _a.plugin, savePaymentMethod = _a.savePaymentMethod;
|
|
1939
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
1940
|
+
var amountDue, currencyId, response;
|
|
1941
|
+
return __generator(this, function (_b) {
|
|
1942
|
+
amountDue = quote ? getQuoteAmountDue(quote) : invoice === null || invoice === void 0 ? void 0 : invoice.amountDue;
|
|
1943
|
+
currencyId = (quote === null || quote === void 0 ? void 0 : quote.currencyId) || (invoice === null || invoice === void 0 ? void 0 : invoice.currency);
|
|
1944
|
+
if (!amountDue || !currencyId) {
|
|
1945
|
+
throw new Error("No amount or currencyId");
|
|
1946
|
+
}
|
|
1947
|
+
try {
|
|
1948
|
+
response = confirmPayment({
|
|
1949
|
+
amount: amountDue,
|
|
1950
|
+
currency: currencyId,
|
|
1951
|
+
});
|
|
1952
|
+
onPaymentSuccess({
|
|
1953
|
+
pluginPaymentResponse: {
|
|
1954
|
+
plugin: plugin,
|
|
1955
|
+
token: response.token,
|
|
1956
|
+
savePaymentMethod: savePaymentMethod,
|
|
1957
|
+
},
|
|
1958
|
+
});
|
|
1959
|
+
}
|
|
1960
|
+
catch (error) {
|
|
1961
|
+
onPaymentError === null || onPaymentError === void 0 ? void 0 : onPaymentError(error);
|
|
1962
|
+
}
|
|
1963
|
+
return [2 /*return*/];
|
|
1964
|
+
});
|
|
1965
|
+
});
|
|
1966
|
+
};
|
|
1967
|
+
return { pay: pay };
|
|
1968
|
+
}
|
|
1838
1969
|
|
|
1839
1970
|
var createPaymentMethod = function (_a) {
|
|
1840
1971
|
var paymentMethodId = _a.paymentMethodId, plugin = _a.plugin, token = _a.token, apiHost = _a.apiHost, accountId = _a.accountId;
|
|
@@ -1873,7 +2004,7 @@ var createSetupIntent = function (plugin, token, apiHost, accountId) {
|
|
|
1873
2004
|
});
|
|
1874
2005
|
};
|
|
1875
2006
|
var createPaymentIntent = function (_a) {
|
|
1876
|
-
var payable = _a.payable, savePaymentMethod = _a.savePaymentMethod, memo = _a.memo, plugin = _a.plugin, token = _a.token, apiHost = _a.apiHost
|
|
2007
|
+
var payable = _a.payable, savePaymentMethod = _a.savePaymentMethod, memo = _a.memo, plugin = _a.plugin, token = _a.token, apiHost = _a.apiHost;
|
|
1877
2008
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
1878
2009
|
var payload, response;
|
|
1879
2010
|
return __generator(this, function (_b) {
|
|
@@ -1883,7 +2014,6 @@ var createPaymentIntent = function (_a) {
|
|
|
1883
2014
|
payable_id: payable.payableId,
|
|
1884
2015
|
save_payment_method: savePaymentMethod,
|
|
1885
2016
|
memo: memo,
|
|
1886
|
-
account_id: accountId,
|
|
1887
2017
|
};
|
|
1888
2018
|
return [4 /*yield*/, common.invokePlugin({
|
|
1889
2019
|
plugin: plugin,
|
|
@@ -1901,21 +2031,37 @@ var createPaymentIntent = function (_a) {
|
|
|
1901
2031
|
});
|
|
1902
2032
|
});
|
|
1903
2033
|
};
|
|
1904
|
-
var fetchStripeKey = function (plugin, token, apiHost, accountId) {
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
2034
|
+
var fetchStripeKey = function (plugin, token, apiHost, accountId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2035
|
+
var response;
|
|
2036
|
+
return __generator(this, function (_a) {
|
|
2037
|
+
switch (_a.label) {
|
|
2038
|
+
case 0: return [4 /*yield*/, common.invokePlugin({
|
|
2039
|
+
plugin: plugin,
|
|
2040
|
+
method: "retrieve_config",
|
|
2041
|
+
token: token,
|
|
2042
|
+
apiHost: apiHost,
|
|
2043
|
+
payload: {
|
|
2044
|
+
account_id: accountId,
|
|
2045
|
+
},
|
|
2046
|
+
})];
|
|
2047
|
+
case 1:
|
|
2048
|
+
response = _a.sent();
|
|
2049
|
+
return [2 /*return*/, response];
|
|
2050
|
+
}
|
|
1913
2051
|
});
|
|
1914
|
-
};
|
|
2052
|
+
}); };
|
|
1915
2053
|
pure.loadStripe.setLoadParameters({ advancedFraudSignals: false });
|
|
1916
2054
|
var useStripePlugin = function (plugin, token, apiHost, accountId) {
|
|
1917
2055
|
var _a = React.useState(null), stripe = _a[0], setStripe = _a[1];
|
|
1918
2056
|
var showErrorNotification = common.useErrorNotification();
|
|
2057
|
+
var options = {
|
|
2058
|
+
mode: "setup",
|
|
2059
|
+
// TODO: Fetch currency from the entity/account
|
|
2060
|
+
currency: "usd",
|
|
2061
|
+
setupFutureUsage: "off_session",
|
|
2062
|
+
};
|
|
2063
|
+
if (!plugin)
|
|
2064
|
+
return { stripe: null, options: options };
|
|
1919
2065
|
React.useEffect(function () {
|
|
1920
2066
|
fetchStripeKey(plugin, token, apiHost || "", accountId)
|
|
1921
2067
|
.then(function (_a) {
|
|
@@ -1928,293 +2074,253 @@ var useStripePlugin = function (plugin, token, apiHost, accountId) {
|
|
|
1928
2074
|
});
|
|
1929
2075
|
// eslint-disable-next-line
|
|
1930
2076
|
}, [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
|
-
: "") })) })));
|
|
2077
|
+
return { stripe: stripe, options: options };
|
|
1953
2078
|
};
|
|
1954
2079
|
|
|
1955
|
-
|
|
1956
|
-
var
|
|
2080
|
+
function usePay(_a) {
|
|
2081
|
+
var _this = this;
|
|
2082
|
+
var onPaymentSuccess = _a.onPaymentSuccess, onPaymentError = _a.onPaymentError, quote = _a.quote, invoice = _a.invoice;
|
|
1957
2083
|
// Hooks
|
|
1958
2084
|
var elements = reactStripeJs.useElements();
|
|
1959
2085
|
var stripe = reactStripeJs.useStripe();
|
|
1960
|
-
var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2086
|
+
var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
|
|
2087
|
+
var pay = function (_a) {
|
|
2088
|
+
var plugin = _a.plugin;
|
|
2089
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
2090
|
+
var payable, submitError, paymentIntent, clientSecret, response, paymentIntentId, error_1;
|
|
2091
|
+
var _b;
|
|
2092
|
+
return __generator(this, function (_c) {
|
|
2093
|
+
switch (_c.label) {
|
|
2094
|
+
case 0:
|
|
2095
|
+
payable = (quote || invoice);
|
|
2096
|
+
_c.label = 1;
|
|
2097
|
+
case 1:
|
|
2098
|
+
_c.trys.push([1, 5, , 6]);
|
|
2099
|
+
if (!stripe)
|
|
2100
|
+
throw new Error("Form is not ready");
|
|
2101
|
+
if (!elements)
|
|
2102
|
+
throw new Error("Elements couldn't be retrieved");
|
|
2103
|
+
return [4 /*yield*/, elements.submit()];
|
|
2104
|
+
case 2:
|
|
2105
|
+
submitError = (_c.sent()).error;
|
|
2106
|
+
if (submitError)
|
|
2107
|
+
throw new Error(submitError.message);
|
|
2108
|
+
return [4 /*yield*/, createPaymentIntent({
|
|
2109
|
+
payable: payable,
|
|
2110
|
+
savePaymentMethod: true,
|
|
2111
|
+
plugin: plugin,
|
|
2112
|
+
token: token,
|
|
2113
|
+
apiHost: apiHost || "",
|
|
2114
|
+
})];
|
|
2115
|
+
case 3:
|
|
2116
|
+
paymentIntent = _c.sent();
|
|
2117
|
+
clientSecret = paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.client_secret;
|
|
2118
|
+
return [4 /*yield*/, stripe.confirmPayment({
|
|
2119
|
+
elements: elements,
|
|
2120
|
+
clientSecret: clientSecret,
|
|
2121
|
+
redirect: "if_required",
|
|
2122
|
+
confirmParams: {
|
|
2123
|
+
return_url: window.location.href,
|
|
2124
|
+
},
|
|
2125
|
+
})];
|
|
2126
|
+
case 4:
|
|
2127
|
+
response = _c.sent();
|
|
2128
|
+
// See https://stripe.com/docs/payments/save-during-payment?platform=web#web-submit-payment
|
|
2129
|
+
if (response.error)
|
|
2130
|
+
throw new Error(response.error.message);
|
|
2131
|
+
paymentIntentId = (_b = response.paymentIntent) === null || _b === void 0 ? void 0 : _b.id;
|
|
2132
|
+
if (!paymentIntentId)
|
|
2133
|
+
throw new Error("Payment intent couldn't be retrieved");
|
|
2134
|
+
onPaymentSuccess === null || onPaymentSuccess === void 0 ? void 0 : onPaymentSuccess({
|
|
2135
|
+
pluginPaymentResponse: {
|
|
2136
|
+
plugin: plugin,
|
|
2137
|
+
token: paymentIntentId,
|
|
2138
|
+
savePaymentMethod: true,
|
|
2139
|
+
},
|
|
2140
|
+
});
|
|
2141
|
+
return [3 /*break*/, 6];
|
|
2142
|
+
case 5:
|
|
2143
|
+
error_1 = _c.sent();
|
|
2144
|
+
onPaymentError === null || onPaymentError === void 0 ? void 0 : onPaymentError(error_1);
|
|
2145
|
+
return [3 /*break*/, 6];
|
|
2146
|
+
case 6: return [2 /*return*/];
|
|
2147
|
+
}
|
|
2148
|
+
});
|
|
2022
2149
|
});
|
|
2023
|
-
}); };
|
|
2024
|
-
var options = {
|
|
2025
|
-
// defaultValues: {
|
|
2026
|
-
// billingDetails: {
|
|
2027
|
-
// email: currentUser.email,
|
|
2028
|
-
// name: currentUser.name,
|
|
2029
|
-
// phone: currentUser.phone,
|
|
2030
|
-
// },
|
|
2031
|
-
// },
|
|
2032
|
-
layout: { type: "accordion" },
|
|
2033
2150
|
};
|
|
2034
|
-
return
|
|
2035
|
-
}
|
|
2151
|
+
return { pay: pay };
|
|
2152
|
+
}
|
|
2036
2153
|
|
|
2037
|
-
var
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
var
|
|
2041
|
-
var
|
|
2042
|
-
var
|
|
2043
|
-
var
|
|
2044
|
-
//
|
|
2045
|
-
var
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2154
|
+
var showErrorNotification$1 = common.useErrorNotification();
|
|
2155
|
+
var ActualCheckoutFooter = function (_a) {
|
|
2156
|
+
var quote = _a.quote, invoice = _a.invoice, onPaymentSuccess = _a.onPaymentSuccess, noPadding = _a.noPadding, plugin = _a.plugin;
|
|
2157
|
+
var isMobile = common.useIsMobile();
|
|
2158
|
+
var _b = React.useState(false), isPaying = _b[0], setIsPaying = _b[1];
|
|
2159
|
+
var amountDue = quote ? getQuoteAmountDue(quote) : invoice === null || invoice === void 0 ? void 0 : invoice.amountDue;
|
|
2160
|
+
var currencyId = (quote === null || quote === void 0 ? void 0 : quote.currencyId) || (invoice === null || invoice === void 0 ? void 0 : invoice.currency);
|
|
2161
|
+
// Payment hooks
|
|
2162
|
+
var payDemoPay = usePay$1({
|
|
2163
|
+
onPaymentSuccess: function (response) {
|
|
2164
|
+
onPaymentSuccess(response);
|
|
2165
|
+
},
|
|
2166
|
+
onPaymentError: function (error) {
|
|
2167
|
+
setIsPaying(false);
|
|
2168
|
+
showErrorNotification$1(error);
|
|
2169
|
+
},
|
|
2170
|
+
quote: quote,
|
|
2171
|
+
invoice: invoice,
|
|
2172
|
+
}).pay;
|
|
2173
|
+
var payStripe = usePay({
|
|
2174
|
+
onPaymentSuccess: function (response) {
|
|
2175
|
+
onPaymentSuccess(response);
|
|
2176
|
+
},
|
|
2177
|
+
onPaymentError: function (error) {
|
|
2178
|
+
setIsPaying(false);
|
|
2179
|
+
showErrorNotification$1(error);
|
|
2180
|
+
},
|
|
2181
|
+
quote: quote,
|
|
2182
|
+
invoice: invoice,
|
|
2183
|
+
}).pay;
|
|
2184
|
+
var handlePaymentSubmit = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
2185
|
+
var _a;
|
|
2186
|
+
var _b, _c;
|
|
2187
|
+
return __generator(this, function (_d) {
|
|
2188
|
+
switch (_d.label) {
|
|
2050
2189
|
case 0:
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
return [4 /*yield*/, createSetupIntent(plugin, token, apiHost, accountId)];
|
|
2190
|
+
if (!plugin)
|
|
2191
|
+
return [2 /*return*/];
|
|
2192
|
+
_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;
|
|
2193
|
+
switch (_a) {
|
|
2194
|
+
case "StripePayment": return [3 /*break*/, 1];
|
|
2195
|
+
case "DemoPayPayment": return [3 /*break*/, 3];
|
|
2196
|
+
}
|
|
2197
|
+
return [3 /*break*/, 5];
|
|
2198
|
+
case 1: return [4 /*yield*/, payStripe({
|
|
2199
|
+
plugin: plugin,
|
|
2200
|
+
})];
|
|
2063
2201
|
case 2:
|
|
2064
|
-
|
|
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
|
-
});
|
|
2202
|
+
_d.sent();
|
|
2105
2203
|
return [3 /*break*/, 6];
|
|
2106
|
-
case
|
|
2107
|
-
|
|
2108
|
-
|
|
2204
|
+
case 3: return [4 /*yield*/, payDemoPay({
|
|
2205
|
+
plugin: plugin,
|
|
2206
|
+
savePaymentMethod: false,
|
|
2207
|
+
})];
|
|
2208
|
+
case 4:
|
|
2209
|
+
_d.sent();
|
|
2109
2210
|
return [3 /*break*/, 6];
|
|
2211
|
+
case 5: return [3 /*break*/, 6];
|
|
2110
2212
|
case 6: return [2 /*return*/];
|
|
2111
2213
|
}
|
|
2112
2214
|
});
|
|
2113
2215
|
}); };
|
|
2114
|
-
return (jsxRuntime.
|
|
2216
|
+
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 () {
|
|
2217
|
+
setIsPaying(true);
|
|
2218
|
+
handlePaymentSubmit();
|
|
2219
|
+
}, size: isMobile ? "large" : "middle", type: "primary" }, { children: "".concat(isPaying ? "Paying" : "Pay", " ").concat(amountDue && currencyId ? common.formatCurrency(amountDue, currencyId) : "") })) })));
|
|
2115
2220
|
};
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
var
|
|
2119
|
-
|
|
2120
|
-
var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
|
|
2121
|
-
var accountId = React.useContext(PaymentContext).accountId;
|
|
2122
|
-
var stripe = useStripePlugin(plugin, token, apiHost, accountId);
|
|
2123
|
-
var onlySavePaymentMethod = !payable;
|
|
2124
|
-
if (!stripe)
|
|
2221
|
+
var CheckoutFooter = function (_a) {
|
|
2222
|
+
var _b, _c;
|
|
2223
|
+
var quote = _a.quote, invoice = _a.invoice, onPaymentSuccess = _a.onPaymentSuccess, noPadding = _a.noPadding, plugin = _a.plugin;
|
|
2224
|
+
if (!plugin)
|
|
2125
2225
|
return null;
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
//
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
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
|
-
}
|
|
2226
|
+
var _d = React.useContext(BunnyContext), token = _d.token, apiHost = _d.apiHost;
|
|
2227
|
+
var accountId = React.useContext(PaymentContext).accountId;
|
|
2228
|
+
// If plugin is not stripe, pass undefined to prevent errors
|
|
2229
|
+
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"
|
|
2230
|
+
? plugin
|
|
2231
|
+
: undefined;
|
|
2232
|
+
var _e = useStripePlugin(stripePlugin, token, apiHost, accountId), stripe = _e.stripe, options = _e.options;
|
|
2233
|
+
return (jsxRuntime.jsx(reactStripeJs.Elements, __assign({ options: options, stripe: stripe }, { children: jsxRuntime.jsx(ActualCheckoutFooter, { plugin: plugin, invoice: invoice, quote: quote, onPaymentSuccess: onPaymentSuccess, noPadding: noPadding }) })));
|
|
2147
2234
|
};
|
|
2148
2235
|
|
|
2149
|
-
var
|
|
2150
|
-
|
|
2236
|
+
var dayjs_min = {exports: {}};
|
|
2237
|
+
|
|
2238
|
+
(function (module, exports) {
|
|
2239
|
+
!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}));
|
|
2240
|
+
}(dayjs_min));
|
|
2241
|
+
|
|
2242
|
+
var dayjs = dayjs_min.exports;
|
|
2243
|
+
|
|
2244
|
+
var Card = function (_a) {
|
|
2245
|
+
var children = _a.children, className = _a.className, style = _a.style;
|
|
2246
|
+
var darkMode = React.useContext(BunnyContext).darkMode;
|
|
2247
|
+
return (jsxRuntime.jsx("div", __assign({ className: "flex flex-col rounded-md shadow-md ".concat(className), style: __assign(__assign({}, style), { backgroundColor: darkMode
|
|
2248
|
+
? "var(--row-background-dark)"
|
|
2249
|
+
: "var(--row-background)" }) }, { children: children })));
|
|
2151
2250
|
};
|
|
2152
2251
|
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
var amount = _a.amount, currency = _a.currency, cardDetails = _a.cardDetails;
|
|
2156
|
-
return { token: "DemoPayTestToken", amount: amount, currency: currency, cardDetails: cardDetails };
|
|
2252
|
+
var LargeCardIcon = function () {
|
|
2253
|
+
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" }) })));
|
|
2157
2254
|
};
|
|
2158
|
-
|
|
2159
|
-
var
|
|
2160
|
-
var
|
|
2161
|
-
|
|
2162
|
-
var isModifier = function (char) { return [16, 17, 18].includes(char); }; // Shift, Ctrl, Alt
|
|
2163
|
-
var isValidKey = function (code) {
|
|
2164
|
-
return isDeletion(code) || isNavigation(code) || isModifier(code);
|
|
2255
|
+
|
|
2256
|
+
var PlusIcon = function (_a) {
|
|
2257
|
+
var color = _a.color;
|
|
2258
|
+
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" })] })));
|
|
2165
2259
|
};
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
return
|
|
2260
|
+
|
|
2261
|
+
var Text$f = antd.Typography.Text;
|
|
2262
|
+
var CreditCard = function (_a) {
|
|
2263
|
+
var _b;
|
|
2264
|
+
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;
|
|
2265
|
+
var isMobile = common.useIsMobile();
|
|
2266
|
+
var Wrapper = cardEnabled ? Card : "div";
|
|
2267
|
+
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 }))] }))] }))] })));
|
|
2174
2268
|
};
|
|
2175
|
-
var
|
|
2176
|
-
var
|
|
2177
|
-
var
|
|
2178
|
-
var
|
|
2179
|
-
|
|
2269
|
+
var MiniCreditCard = function (_a) {
|
|
2270
|
+
var _b;
|
|
2271
|
+
var _c = _a.hideRemoveButton, hideRemoveButton = _c === void 0 ? false : _c, onClickRemove = _a.onClickRemove, paymentMethodData = _a.paymentMethodData;
|
|
2272
|
+
var darkMode = React.useContext(BunnyContext).darkMode;
|
|
2273
|
+
var borderColor = React.useMemo(function () {
|
|
2274
|
+
return darkMode ? "border-slate-700" : "border-slate-200";
|
|
2275
|
+
}, [darkMode]);
|
|
2276
|
+
var backgroundColor = React.useMemo(function () {
|
|
2277
|
+
return darkMode ? "var(--row-background-alternate)" : "bg-slate-50";
|
|
2278
|
+
}, [darkMode]);
|
|
2279
|
+
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" })] }))) })));
|
|
2280
|
+
};
|
|
2281
|
+
var CardImage = function (_a) {
|
|
2282
|
+
var _b, _c;
|
|
2283
|
+
var paymentMethodData = _a.paymentMethodData;
|
|
2284
|
+
var apiHost = React.useContext(BunnyContext).apiHost;
|
|
2285
|
+
var darkMode = React.useContext(BunnyContext).darkMode;
|
|
2286
|
+
var getCardImage = function (issuer) {
|
|
2287
|
+
if (issuer === "visa")
|
|
2288
|
+
return "Visa_Brandmark_Blue_RGB_2021.png";
|
|
2289
|
+
else if (issuer === "mastercard")
|
|
2290
|
+
return "mc_symbol_opt_73_3x.png";
|
|
2291
|
+
};
|
|
2292
|
+
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: {
|
|
2293
|
+
color: darkMode ? "white" : "",
|
|
2294
|
+
} })) }));
|
|
2180
2295
|
};
|
|
2181
|
-
var
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
return cardExpiry.substring(0, 2) + "/" + cardExpiry.substring(2);
|
|
2296
|
+
var CardAttribute = function (_a) {
|
|
2297
|
+
var title = _a.title, value = _a.value;
|
|
2298
|
+
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 })] })));
|
|
2185
2299
|
};
|
|
2186
|
-
|
|
2187
|
-
var
|
|
2188
|
-
var
|
|
2189
|
-
|
|
2190
|
-
|
|
2300
|
+
var CardActions = function (_a) {
|
|
2301
|
+
var onClickRemove = _a.onClickRemove, onClickUpdate = _a.onClickUpdate;
|
|
2302
|
+
var isMobile = common.useIsMobile();
|
|
2303
|
+
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" }))] })));
|
|
2304
|
+
};
|
|
2305
|
+
var EmptyCard = function (_a) {
|
|
2306
|
+
var onClick = _a.onClick, _b = _a.shadow, shadow = _b === void 0 ? "shadow-md" : _b, _c = _a.cardEnabled, cardEnabled = _c === void 0 ? true : _c;
|
|
2307
|
+
var brandColor = React.useContext(BrandContext).brandColor;
|
|
2308
|
+
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"] })) }))] })));
|
|
2309
|
+
};
|
|
2310
|
+
var isExpired = function (paymentMethodData) {
|
|
2311
|
+
var expDate = dayjs(paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.expirationDate);
|
|
2312
|
+
return expDate.isBefore(dayjs());
|
|
2313
|
+
};
|
|
2314
|
+
var expirationDate = function (storedPaymentMethod) {
|
|
2315
|
+
return dayjs(storedPaymentMethod === null || storedPaymentMethod === void 0 ? void 0 : storedPaymentMethod.expirationDate).format("MM/YY");
|
|
2316
|
+
};
|
|
2317
|
+
|
|
2318
|
+
var SavePaymentMethodFooter = function (_a) {
|
|
2319
|
+
var isSaving = _a.isSaving, onSave = _a.onSave, noPadding = _a.noPadding;
|
|
2320
|
+
var isMobile = common.useIsMobile();
|
|
2321
|
+
var onClickCancel = React.useContext(PaymentContext).onClickCancel;
|
|
2322
|
+
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
2323
|
};
|
|
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
2324
|
|
|
2219
2325
|
var DemoPayCardCvc = function (_a) {
|
|
2220
2326
|
var autoFocus = _a.autoFocus, onChange = _a.onChange, placeholder = _a.placeholder, value = _a.value;
|
|
@@ -2259,83 +2365,95 @@ var DemoPayExpiry = function (_a) {
|
|
|
2259
2365
|
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
2366
|
};
|
|
2261
2367
|
|
|
2262
|
-
|
|
2368
|
+
function useSave$1(_a) {
|
|
2369
|
+
var _this = this;
|
|
2370
|
+
var onSaveSuccess = _a.onSaveSuccess, token = _a.token, apiHost = _a.apiHost, accountId = _a.accountId;
|
|
2371
|
+
var _b = React.useState(false), isSaving = _b[0], setIsSaving = _b[1];
|
|
2372
|
+
var save = function (_a) {
|
|
2373
|
+
var cardDetails = _a.cardDetails, plugin = _a.plugin, savePaymentMethod = _a.savePaymentMethod;
|
|
2374
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
2375
|
+
var response, paymentMethodId, error_1;
|
|
2376
|
+
return __generator(this, function (_b) {
|
|
2377
|
+
switch (_b.label) {
|
|
2378
|
+
case 0:
|
|
2379
|
+
_b.trys.push([0, 2, 3, 4]);
|
|
2380
|
+
setIsSaving(true);
|
|
2381
|
+
return [4 /*yield*/, storePayment({
|
|
2382
|
+
testCreditCardNumber: unformatCardNumber(cardDetails.number),
|
|
2383
|
+
testCreditCardCvc: cardDetails.cvc.toString(),
|
|
2384
|
+
testCreditCardExpirationDate: cardDetails.expiry,
|
|
2385
|
+
token: token,
|
|
2386
|
+
}, plugin, apiHost, accountId)];
|
|
2387
|
+
case 1:
|
|
2388
|
+
response = _b.sent();
|
|
2389
|
+
paymentMethodId = response.payload[0].id;
|
|
2390
|
+
if (response.status !== "success")
|
|
2391
|
+
throw new Error(response === null || response === void 0 ? void 0 : response.message);
|
|
2392
|
+
onSaveSuccess({
|
|
2393
|
+
pluginPaymentResponse: {
|
|
2394
|
+
plugin: plugin,
|
|
2395
|
+
token: response.token,
|
|
2396
|
+
savePaymentMethod: savePaymentMethod,
|
|
2397
|
+
},
|
|
2398
|
+
savedPaymentMethodResponse: {
|
|
2399
|
+
paymentMethodId: paymentMethodId,
|
|
2400
|
+
},
|
|
2401
|
+
});
|
|
2402
|
+
return [3 /*break*/, 4];
|
|
2403
|
+
case 2:
|
|
2404
|
+
error_1 = _b.sent();
|
|
2405
|
+
console.error("Payment failed", error_1);
|
|
2406
|
+
return [3 /*break*/, 4];
|
|
2407
|
+
case 3:
|
|
2408
|
+
setIsSaving(false);
|
|
2409
|
+
return [7 /*endfinally*/];
|
|
2410
|
+
case 4: return [2 /*return*/];
|
|
2411
|
+
}
|
|
2412
|
+
});
|
|
2413
|
+
});
|
|
2414
|
+
};
|
|
2415
|
+
return { save: save, isSaving: isSaving };
|
|
2416
|
+
}
|
|
2417
|
+
|
|
2418
|
+
var Text$e = antd.Typography.Text;
|
|
2263
2419
|
var TEST_CARD = "4242424242424242";
|
|
2264
2420
|
var DemoPayForm = function (_a) {
|
|
2265
|
-
var
|
|
2421
|
+
var onFail = _a.onFail, onSavePaymentMethod = _a.onSavePaymentMethod, plugin = _a.plugin;
|
|
2266
2422
|
// Context
|
|
2267
2423
|
var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, darkMode = _b.darkMode;
|
|
2268
2424
|
var accountId = React.useContext(PaymentContext).accountId;
|
|
2269
|
-
//
|
|
2270
|
-
var _c =
|
|
2425
|
+
// Hooks
|
|
2426
|
+
var _c = useSave$1({
|
|
2427
|
+
onSaveSuccess: onSavePaymentMethod,
|
|
2428
|
+
token: token,
|
|
2429
|
+
apiHost: apiHost,
|
|
2430
|
+
accountId: accountId,
|
|
2431
|
+
}), save = _c.save, isSaving = _c.isSaving;
|
|
2271
2432
|
var _d = React.useState({
|
|
2272
2433
|
number: "4242424242424242",
|
|
2273
2434
|
expiry: "",
|
|
2274
2435
|
cvc: "",
|
|
2275
2436
|
}), 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;
|
|
2437
|
+
var onSave = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
2438
|
+
var error_1;
|
|
2281
2439
|
return __generator(this, function (_a) {
|
|
2282
2440
|
switch (_a.label) {
|
|
2283
2441
|
case 0:
|
|
2284
|
-
_a.trys.push([0,
|
|
2285
|
-
if (!onlySavePaymentMethod) return [3 /*break*/, 2];
|
|
2442
|
+
_a.trys.push([0, 2, , 3]);
|
|
2286
2443
|
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,
|
|
2444
|
+
return [4 /*yield*/, save({
|
|
2317
2445
|
cardDetails: cardDetails,
|
|
2318
|
-
})];
|
|
2319
|
-
case 3:
|
|
2320
|
-
response = _a.sent();
|
|
2321
|
-
onPaymentSuccess({
|
|
2322
|
-
pluginPaymentResponse: {
|
|
2323
2446
|
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:
|
|
2447
|
+
savePaymentMethod: false,
|
|
2448
|
+
})];
|
|
2449
|
+
case 1:
|
|
2450
|
+
_a.sent();
|
|
2451
|
+
return [3 /*break*/, 3];
|
|
2452
|
+
case 2:
|
|
2335
2453
|
error_1 = _a.sent();
|
|
2336
2454
|
onFail(error_1);
|
|
2337
|
-
return [3 /*break*/,
|
|
2338
|
-
case
|
|
2455
|
+
return [3 /*break*/, 3];
|
|
2456
|
+
case 3: return [2 /*return*/];
|
|
2339
2457
|
}
|
|
2340
2458
|
});
|
|
2341
2459
|
}); };
|
|
@@ -2358,454 +2476,231 @@ var DemoPayForm = function (_a) {
|
|
|
2358
2476
|
var onCardCvcChange = function (cvc) {
|
|
2359
2477
|
setCardDetails(__assign(__assign({}, cardDetails), { cvc: cvc }));
|
|
2360
2478
|
};
|
|
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$
|
|
2479
|
+
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
2480
|
};
|
|
2363
|
-
var StyledInputs = styled__default["default"].div(templateObject_1$
|
|
2481
|
+
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
2482
|
var darkMode = _a.darkMode;
|
|
2365
2483
|
return darkMode ? "var(--row-background-dark)" : "white";
|
|
2366
2484
|
}, function (_a) {
|
|
2367
2485
|
var darkMode = _a.darkMode;
|
|
2368
2486
|
return darkMode ? common.GRAY_500 : common.GRAY_200;
|
|
2369
2487
|
});
|
|
2370
|
-
var templateObject_1$
|
|
2488
|
+
var templateObject_1$7;
|
|
2371
2489
|
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2490
|
+
function useSave(_a) {
|
|
2491
|
+
var _this = this;
|
|
2492
|
+
var onSaveSuccess = _a.onSaveSuccess;
|
|
2493
|
+
// Hooks
|
|
2494
|
+
var _b = React.useState(false), isSaving = _b[0], setIsSaving = _b[1];
|
|
2495
|
+
var elements = reactStripeJs.useElements();
|
|
2496
|
+
var stripe = reactStripeJs.useStripe();
|
|
2497
|
+
var _c = React.useContext(BunnyContext), token = _c.token, apiHost = _c.apiHost;
|
|
2498
|
+
var accountId = React.useContext(PaymentContext).accountId;
|
|
2499
|
+
var save = function (_a) {
|
|
2500
|
+
var plugin = _a.plugin;
|
|
2501
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
2502
|
+
var submitError, response, clientSecret, intentResponse, paymentMethodId, paymentMethodResponse, error_1;
|
|
2503
|
+
var _b, _c;
|
|
2504
|
+
return __generator(this, function (_d) {
|
|
2505
|
+
switch (_d.label) {
|
|
2506
|
+
case 0:
|
|
2507
|
+
_d.trys.push([0, 5, 6, 7]);
|
|
2508
|
+
if (!stripe)
|
|
2509
|
+
throw new Error("Form is not ready");
|
|
2510
|
+
if (!elements)
|
|
2511
|
+
throw new Error("Elements couldn't be retrieved");
|
|
2512
|
+
setIsSaving(true);
|
|
2513
|
+
return [4 /*yield*/, elements.submit()];
|
|
2514
|
+
case 1:
|
|
2515
|
+
submitError = (_d.sent()).error;
|
|
2516
|
+
if (submitError)
|
|
2517
|
+
throw new Error(submitError.message);
|
|
2518
|
+
return [4 /*yield*/, createSetupIntent(plugin, token, apiHost, accountId)];
|
|
2519
|
+
case 2:
|
|
2520
|
+
response = _d.sent();
|
|
2521
|
+
if (response.status !== "success")
|
|
2522
|
+
throw new Error(response === null || response === void 0 ? void 0 : response.message);
|
|
2523
|
+
clientSecret = (_b = response === null || response === void 0 ? void 0 : response.payload) === null || _b === void 0 ? void 0 : _b.client_secret;
|
|
2524
|
+
if (!clientSecret)
|
|
2525
|
+
throw new Error("Error retrieving client secret");
|
|
2526
|
+
return [4 /*yield*/, stripe.confirmSetup({
|
|
2527
|
+
elements: elements,
|
|
2528
|
+
clientSecret: clientSecret,
|
|
2529
|
+
redirect: "if_required",
|
|
2530
|
+
confirmParams: {
|
|
2531
|
+
return_url: window.location.href,
|
|
2532
|
+
},
|
|
2533
|
+
})];
|
|
2534
|
+
case 3:
|
|
2535
|
+
intentResponse = _d.sent();
|
|
2536
|
+
// See https://stripe.com/docs/payments/save-during-payment?platform=web#web-submit-payment
|
|
2537
|
+
if (intentResponse.error)
|
|
2538
|
+
throw new Error(intentResponse.error.message);
|
|
2539
|
+
paymentMethodId = (_c = intentResponse.setupIntent.payment_method) === null || _c === void 0 ? void 0 : _c.toString();
|
|
2540
|
+
if (!paymentMethodId)
|
|
2541
|
+
throw new Error("Payment method couldn't be retrieved");
|
|
2542
|
+
return [4 /*yield*/, createPaymentMethod({
|
|
2543
|
+
paymentMethodId: paymentMethodId,
|
|
2544
|
+
plugin: plugin,
|
|
2545
|
+
token: token,
|
|
2546
|
+
apiHost: apiHost,
|
|
2547
|
+
accountId: accountId,
|
|
2548
|
+
})];
|
|
2549
|
+
case 4:
|
|
2550
|
+
paymentMethodResponse = _d.sent();
|
|
2551
|
+
onSaveSuccess({
|
|
2552
|
+
pluginPaymentResponse: {
|
|
2553
|
+
savePaymentMethod: true,
|
|
2554
|
+
plugin: plugin,
|
|
2555
|
+
token: paymentMethodResponse.token,
|
|
2556
|
+
},
|
|
2557
|
+
savedPaymentMethodResponse: {
|
|
2558
|
+
paymentMethodId: paymentMethodResponse.payload[0].id,
|
|
2559
|
+
},
|
|
2560
|
+
});
|
|
2561
|
+
return [3 /*break*/, 7];
|
|
2562
|
+
case 5:
|
|
2563
|
+
error_1 = _d.sent();
|
|
2564
|
+
console.error(error_1);
|
|
2565
|
+
return [3 /*break*/, 7];
|
|
2566
|
+
case 6:
|
|
2567
|
+
setIsSaving(false);
|
|
2568
|
+
return [7 /*endfinally*/];
|
|
2569
|
+
case 7: return [2 /*return*/];
|
|
2570
|
+
}
|
|
2571
|
+
});
|
|
2572
|
+
});
|
|
2573
|
+
};
|
|
2574
|
+
return { save: save, isSaving: isSaving };
|
|
2575
|
+
}
|
|
2388
2576
|
|
|
2389
|
-
var
|
|
2390
|
-
var plugin = _a.plugin,
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
})];
|
|
2577
|
+
var PaymentMethodForm = function (_a) {
|
|
2578
|
+
var plugin = _a.plugin, onFail = _a.onFail, onSavePaymentMethod = _a.onSavePaymentMethod;
|
|
2579
|
+
// Hooks
|
|
2580
|
+
var _b = useSave({
|
|
2581
|
+
onSaveSuccess: onSavePaymentMethod,
|
|
2582
|
+
}), save = _b.save, isSaving = _b.isSaving;
|
|
2583
|
+
// Handlers
|
|
2584
|
+
var onSubmit = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
2585
|
+
var error_1;
|
|
2586
|
+
return __generator(this, function (_a) {
|
|
2587
|
+
switch (_a.label) {
|
|
2588
|
+
case 0:
|
|
2589
|
+
_a.trys.push([0, 2, , 3]);
|
|
2590
|
+
return [4 /*yield*/, save({ plugin: plugin })];
|
|
2404
2591
|
case 1:
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2592
|
+
_a.sent();
|
|
2593
|
+
return [3 /*break*/, 3];
|
|
2594
|
+
case 2:
|
|
2595
|
+
error_1 = _a.sent();
|
|
2596
|
+
onFail(error_1);
|
|
2597
|
+
return [3 /*break*/, 3];
|
|
2598
|
+
case 3: return [2 /*return*/];
|
|
2409
2599
|
}
|
|
2410
2600
|
});
|
|
2411
|
-
});
|
|
2601
|
+
}); };
|
|
2602
|
+
return (jsxRuntime.jsxs("form", { children: [jsxRuntime.jsx(reactStripeJs.PaymentElement, { options: { layout: { type: "accordion" } } }), jsxRuntime.jsx(SavePaymentMethodFooter, { isSaving: isSaving, onSave: onSubmit })] }));
|
|
2412
2603
|
};
|
|
2413
2604
|
|
|
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
|
|
2605
|
+
// This is just a wrapper to fetch the stripe object and pass it to the form
|
|
2606
|
+
var StripeForm = function (_a) {
|
|
2607
|
+
var plugin = _a.plugin, onFail = _a.onFail, onSavePaymentMethod = _a.onSavePaymentMethod;
|
|
2460
2608
|
var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
|
|
2461
2609
|
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)
|
|
2610
|
+
var _c = useStripePlugin(plugin, token, apiHost, accountId), stripe = _c.stripe, options = _c.options;
|
|
2611
|
+
if (!stripe)
|
|
2624
2612
|
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 })] }));
|
|
2613
|
+
return (jsxRuntime.jsx(reactStripeJs.Elements, __assign({ options: options, stripe: stripe }, { children: jsxRuntime.jsx(PaymentMethodForm, { plugin: plugin, onFail: onFail, onSavePaymentMethod: onSavePaymentMethod }) })));
|
|
2714
2614
|
};
|
|
2715
2615
|
|
|
2716
|
-
var
|
|
2616
|
+
var PaymentMethodDetails = function (_a) {
|
|
2717
2617
|
var _b, _c;
|
|
2718
|
-
var
|
|
2618
|
+
var onFail = _a.onFail, paymentMethod = _a.paymentMethod, onSavePaymentMethod = _a.onSavePaymentMethod;
|
|
2719
2619
|
if (!paymentMethod)
|
|
2720
2620
|
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
|
-
}
|
|
2621
|
+
paymentMethod = paymentMethod;
|
|
2622
|
+
switch ((_c = (_b = paymentMethod.components) === null || _b === void 0 ? void 0 : _b.frontend) === null || _c === void 0 ? void 0 : _c[0].name) {
|
|
2623
|
+
case "StripePayment":
|
|
2624
|
+
return (jsxRuntime.jsx(StripeForm, { onFail: onFail, onSavePaymentMethod: onSavePaymentMethod, plugin: paymentMethod }));
|
|
2625
|
+
case "DemoPayPayment":
|
|
2626
|
+
return (jsxRuntime.jsx(DemoPayForm, { onFail: onFail, onSavePaymentMethod: onSavePaymentMethod, plugin: paymentMethod }));
|
|
2627
|
+
default:
|
|
2628
|
+
return jsxRuntime.jsx("p", { children: "Can not find form for plugin" });
|
|
2736
2629
|
}
|
|
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
2630
|
};
|
|
2741
2631
|
|
|
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
|
-
});
|
|
2632
|
+
var CardIcon = function () {
|
|
2633
|
+
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
2634
|
};
|
|
2757
2635
|
|
|
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
|
-
});
|
|
2636
|
+
var Text$d = antd.Typography.Text;
|
|
2637
|
+
var PaymentMethodSelector = function (_a) {
|
|
2638
|
+
var paymentMethodAllowedPlugins = _a.paymentMethodAllowedPlugins, onSelect = _a.onSelect, value = _a.value;
|
|
2639
|
+
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
2640
|
};
|
|
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
|
-
};
|
|
2641
|
+
var PaymentOption = function (_a) {
|
|
2642
|
+
var selected = _a.selected, paymentOption = _a.paymentOption, onClick = _a.onClick, name = _a.name;
|
|
2643
|
+
var brandColor = React.useContext(BrandContext).brandColor;
|
|
2644
|
+
var darkMode = React.useContext(BunnyContext).darkMode;
|
|
2645
|
+
var isAch = name === null || name === void 0 ? void 0 : name.toLowerCase().includes("ach");
|
|
2646
|
+
var isCard = name === null || name === void 0 ? void 0 : name.toLowerCase().includes("card");
|
|
2647
|
+
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
|
|
2648
|
+
? "var(--row-background-dark) border-gray-500"
|
|
2649
|
+
: "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
2650
|
};
|
|
2651
|
+
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) {
|
|
2652
|
+
var $brandColor = _a.$brandColor, $selected = _a.$selected;
|
|
2653
|
+
return $selected &&
|
|
2654
|
+
"\n border-color: ".concat($brandColor, ";\n ");
|
|
2655
|
+
}, function (_a) {
|
|
2656
|
+
var $brandColor = _a.$brandColor;
|
|
2657
|
+
return $brandColor;
|
|
2658
|
+
});
|
|
2659
|
+
var templateObject_1$6;
|
|
2784
2660
|
|
|
2785
|
-
|
|
2786
|
-
var
|
|
2787
|
-
var
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2661
|
+
function useRemovePaymentMethod(paymentPlugins, token, apiHost, accountId) {
|
|
2662
|
+
var queryClient = reactQuery.useQueryClient();
|
|
2663
|
+
var showErrorNotification = common.useErrorNotification();
|
|
2664
|
+
var showSuccessNotification = common.useSuccessNotification();
|
|
2665
|
+
var removePaymentMethod = React.useCallback(function (data) {
|
|
2666
|
+
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); });
|
|
2667
|
+
if (data && plugin) {
|
|
2668
|
+
common.invokePlugin({
|
|
2669
|
+
plugin: plugin,
|
|
2670
|
+
method: "remove_payment_method",
|
|
2671
|
+
payload: {
|
|
2672
|
+
payment_method_id: data.id,
|
|
2673
|
+
account_id: accountId,
|
|
2674
|
+
},
|
|
2675
|
+
token: token,
|
|
2676
|
+
apiHost: apiHost,
|
|
2677
|
+
})
|
|
2678
|
+
.then(function () {
|
|
2679
|
+
showSuccessNotification("Payment method was removed", "Success");
|
|
2680
|
+
queryClient.setQueryData(common.QueryKeyFactory.default.accountPaymentMethodKey, null);
|
|
2681
|
+
})
|
|
2682
|
+
.catch(function (error) {
|
|
2683
|
+
showErrorNotification(error.message, "Error removing payment method");
|
|
2684
|
+
});
|
|
2685
|
+
}
|
|
2686
|
+
}, [paymentPlugins, token, apiHost, queryClient]);
|
|
2687
|
+
return removePaymentMethod;
|
|
2688
|
+
}
|
|
2689
|
+
|
|
2690
|
+
var Panel = antd.Collapse.Panel;
|
|
2691
|
+
var PaymentForm = function (_a) {
|
|
2692
|
+
var entityId = _a.entityId, invoice = _a.invoice, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, quote = _a.quote, accountId = _a.accountId, onSavePaymentMethod = _a.onSavePaymentMethod;
|
|
2798
2693
|
// Local state
|
|
2799
2694
|
var _b = React.useState(), selectedPaymentMethod = _b[0], setSelectedPaymentMethod = _b[1];
|
|
2800
|
-
var _c = React.
|
|
2801
|
-
var
|
|
2802
|
-
//
|
|
2695
|
+
var _c = React.useState(false), showPaymentMethodForm = _c[0], setShowPaymentMethodForm = _c[1];
|
|
2696
|
+
var paying = !!(quote || invoice);
|
|
2697
|
+
// Hooks
|
|
2698
|
+
var _d = React.useContext(BunnyContext), token = _d.token, apiHost = _d.apiHost, graphQLClient = _d.graphQLClient;
|
|
2699
|
+
var storedPaymentMethod = usePaymentMethod(graphQLClient, accountId).data;
|
|
2803
2700
|
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);
|
|
2701
|
+
var _e = usePaymentPlugins({ entityId: entityId, apiHost: apiHost, token: token }), paymentMethodAllowedPlugins = _e.paymentMethodAllowedPlugins, arePluginsFetched = _e.isFetched;
|
|
2702
|
+
var onClickRemove = useRemovePaymentMethod(paymentMethodAllowedPlugins || [], token, apiHost, accountId);
|
|
2703
|
+
var queryClient = reactQuery.useQueryClient();
|
|
2809
2704
|
// Set default plugin
|
|
2810
2705
|
React.useEffect(function () {
|
|
2811
2706
|
if (!arePluginsFetched ||
|
|
@@ -2813,34 +2708,53 @@ var ActualPaymentForm = function (_a) {
|
|
|
2813
2708
|
selectedPaymentMethod) {
|
|
2814
2709
|
return;
|
|
2815
2710
|
}
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2711
|
+
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); });
|
|
2712
|
+
if (pluginPaymentMethod) {
|
|
2713
|
+
setSelectedPaymentMethod(pluginPaymentMethod);
|
|
2714
|
+
}
|
|
2715
|
+
else if (paymentMethodAllowedPlugins === null || paymentMethodAllowedPlugins === void 0 ? void 0 : paymentMethodAllowedPlugins[0]) {
|
|
2716
|
+
setSelectedPaymentMethod(paymentMethodAllowedPlugins === null || paymentMethodAllowedPlugins === void 0 ? void 0 : paymentMethodAllowedPlugins[0]);
|
|
2717
|
+
}
|
|
2820
2718
|
}, [
|
|
2821
2719
|
arePluginsFetched,
|
|
2822
2720
|
isPaymentMethodFetched,
|
|
2823
2721
|
paymentMethodAllowedPlugins,
|
|
2824
2722
|
selectedPaymentMethod,
|
|
2825
2723
|
setSelectedPaymentMethod,
|
|
2826
|
-
showStoredPaymentMethodOption,
|
|
2827
2724
|
storedPaymentMethod,
|
|
2828
2725
|
]);
|
|
2829
2726
|
var showPaymentMethodSelector = React.useMemo(function () {
|
|
2830
2727
|
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
|
-
|
|
2728
|
+
return pluginCount > 1;
|
|
2729
|
+
}, [paymentMethodAllowedPlugins]);
|
|
2730
|
+
var handlePaymentSuccess = function (_a) {
|
|
2731
|
+
var pluginPaymentResponse = _a.pluginPaymentResponse, savedPaymentMethodResponse = _a.savedPaymentMethodResponse;
|
|
2732
|
+
// Hide payment method selector and form
|
|
2733
|
+
setShowPaymentMethodForm(false);
|
|
2734
|
+
// Set new selected payment method
|
|
2735
|
+
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); });
|
|
2736
|
+
setSelectedPaymentMethod(paymentMethod);
|
|
2737
|
+
// Handle success keeps going up component tree
|
|
2738
|
+
onPaymentSuccess === null || onPaymentSuccess === void 0 ? void 0 : onPaymentSuccess({
|
|
2739
|
+
pluginPaymentResponse: pluginPaymentResponse,
|
|
2740
|
+
savedPaymentMethodResponse: savedPaymentMethodResponse,
|
|
2741
|
+
});
|
|
2742
|
+
};
|
|
2743
|
+
var handleSavePaymentMethod = function () {
|
|
2744
|
+
queryClient.invalidateQueries({
|
|
2745
|
+
queryKey: common.QueryKeyFactory.default.accountPaymentMethodKey,
|
|
2746
|
+
});
|
|
2747
|
+
onSavePaymentMethod === null || onSavePaymentMethod === void 0 ? void 0 : onSavePaymentMethod();
|
|
2748
|
+
setShowPaymentMethodForm(false);
|
|
2749
|
+
};
|
|
2750
|
+
return (jsxRuntime.jsx(PaymentContext.Provider, __assign({ value: {
|
|
2751
|
+
onClickCancel: function () { return setShowPaymentMethodForm(false); },
|
|
2752
|
+
accountId: accountId,
|
|
2753
|
+
} }, { 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 })) : (
|
|
2754
|
+
//if not paying and payment method is saved, show Collapse
|
|
2755
|
+
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 () {
|
|
2756
|
+
setShowPaymentMethodForm(true);
|
|
2757
|
+
}, 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
2758
|
};
|
|
2845
2759
|
|
|
2846
2760
|
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 +2792,8 @@ var checkout = function (_a) {
|
|
|
2878
2792
|
});
|
|
2879
2793
|
};
|
|
2880
2794
|
|
|
2881
|
-
var InvoiceCheckoutContext = React.createContext({});
|
|
2882
2795
|
var InvoiceCheckout = function (_a) {
|
|
2883
|
-
var
|
|
2796
|
+
var onSuccess = _a.onSuccess, onFail = _a.onFail, invoice = _a.invoice, entityId = _a.entityId;
|
|
2884
2797
|
var _b = React.useContext(BunnyContext), apiHost = _b.apiHost, token = _b.token;
|
|
2885
2798
|
var checkoutMutation = reactQuery.useMutation({
|
|
2886
2799
|
mutationFn: function (_a) {
|
|
@@ -2944,14 +2857,7 @@ var InvoiceCheckout = function (_a) {
|
|
|
2944
2857
|
});
|
|
2945
2858
|
});
|
|
2946
2859
|
};
|
|
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 }) })));
|
|
2860
|
+
return (jsxRuntime.jsx("div", __assign({ className: "w-full pt-12" }, { children: jsxRuntime.jsx(PaymentForm, { entityId: entityId, onPaymentSuccess: handleCheckout, onFail: onFail, invoice: invoice }) })));
|
|
2955
2861
|
};
|
|
2956
2862
|
|
|
2957
2863
|
var fetchPDF = function (window, apiEndpoint, invoiceUuid) { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -2997,31 +2903,39 @@ function InvoicePDF(_a) {
|
|
|
2997
2903
|
}, title: "Invoice PDF", width: "100%" }));
|
|
2998
2904
|
}
|
|
2999
2905
|
|
|
3000
|
-
var
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
2906
|
+
var InvoiceQuoteContext = React.createContext({});
|
|
2907
|
+
function Invoice(_a) {
|
|
2908
|
+
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;
|
|
2909
|
+
return (jsxRuntime.jsx(reactHelmetAsync.HelmetProvider, { children: jsxRuntime.jsx(InvoiceQuoteContext.Provider, __assign({ value: {
|
|
2910
|
+
id: id,
|
|
2911
|
+
invoiceQuoteViewComponent: invoiceQuoteViewComponent,
|
|
2912
|
+
backButtonName: backButtonName,
|
|
2913
|
+
onBackButtonClick: onBackButtonClick,
|
|
2914
|
+
onInvoiceDownloadError: onInvoiceDownloadError,
|
|
2915
|
+
onPaymentSuccess: onPaymentSuccess,
|
|
2916
|
+
entityId: entityId,
|
|
2917
|
+
shadow: shadow,
|
|
2918
|
+
className: className,
|
|
2919
|
+
hideDownloadButton: hideDownloadButton,
|
|
2920
|
+
} }, { children: jsxRuntime.jsx(ActualInvoice, {}) })) }));
|
|
2921
|
+
}
|
|
2922
|
+
function ActualInvoice() {
|
|
2923
|
+
// Context
|
|
3013
2924
|
var queryClient = reactQuery.useQueryClient();
|
|
3014
|
-
var
|
|
2925
|
+
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;
|
|
2926
|
+
var _b = React.useContext(BunnyContext), apiHost = _b.apiHost, token = _b.token, onTokenExpired = _b.onTokenExpired;
|
|
2927
|
+
// Local state
|
|
2928
|
+
var isMobile = common.useIsMobile();
|
|
2929
|
+
// Hooks
|
|
3015
2930
|
var showSuccessNotification = common.useSuccessNotification();
|
|
3016
|
-
var handleAllErrorFormats = common.useAllErrorFormats(
|
|
3017
|
-
(function (url) {
|
|
3018
|
-
console.log("navigate to", url, " not implemented");
|
|
3019
|
-
}));
|
|
2931
|
+
var handleAllErrorFormats = common.useAllErrorFormats(onTokenExpired);
|
|
3020
2932
|
// Queries
|
|
3021
|
-
var
|
|
2933
|
+
var _c = reactQuery.useQuery({
|
|
3022
2934
|
queryKey: common.QueryKeyFactory.default.createFormattedInvoiceKey(token, id),
|
|
3023
2935
|
queryFn: function () { return common.getFormattedInvoice({ id: id, token: token, apiHost: apiHost }); },
|
|
3024
|
-
}), formattedInvoice =
|
|
2936
|
+
}), formattedInvoice = _c.data, error = _c.error;
|
|
2937
|
+
// Derived state
|
|
2938
|
+
var isInvoicePayable = common.PAYABLE_INVOICE_STATES.includes((formattedInvoice === null || formattedInvoice === void 0 ? void 0 : formattedInvoice.state) || "");
|
|
3025
2939
|
if (error) {
|
|
3026
2940
|
return jsxRuntime.jsxs("div", { children: ["Error loading invoice: ", error.message] });
|
|
3027
2941
|
}
|
|
@@ -3045,19 +2959,12 @@ function ActualInvoice(_a) {
|
|
|
3045
2959
|
var onFail = function (error) {
|
|
3046
2960
|
handleAllErrorFormats(error.message);
|
|
3047
2961
|
};
|
|
3048
|
-
// Derived state
|
|
3049
|
-
var isInvoicePayable = common.PAYABLE_INVOICE_STATES.includes((formattedInvoice === null || formattedInvoice === void 0 ? void 0 : formattedInvoice.state) || "");
|
|
3050
2962
|
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
2963
|
vendorName: formattedInvoice.vendorName,
|
|
3052
2964
|
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,
|
|
2965
|
+
}) }), 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
2966
|
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 }) }));
|
|
2967
|
+
}, onSuccess: onSuccess, entityId: entityId }))] }))] }));
|
|
3061
2968
|
}
|
|
3062
2969
|
|
|
3063
2970
|
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 +2982,9 @@ var getFormattedQuote = function (_a) {
|
|
|
3075
2982
|
})];
|
|
3076
2983
|
case 1:
|
|
3077
2984
|
response = _b.sent();
|
|
2985
|
+
if (response === null || response === void 0 ? void 0 : response.formattedQuote.error) {
|
|
2986
|
+
throw new Error(response === null || response === void 0 ? void 0 : response.formattedQuote.error);
|
|
2987
|
+
}
|
|
3078
2988
|
return [2 /*return*/, response === null || response === void 0 ? void 0 : response.formattedQuote];
|
|
3079
2989
|
}
|
|
3080
2990
|
});
|
|
@@ -3095,17 +3005,14 @@ var useSigningPlugins = function (_a) {
|
|
|
3095
3005
|
};
|
|
3096
3006
|
|
|
3097
3007
|
var useSendAcceptQuote = function (_a) {
|
|
3098
|
-
var entityId = _a.entityId,
|
|
3008
|
+
var entityId = _a.entityId, onTokenExpired = _a.onTokenExpired, quoteId = _a.quoteId, apiHost = _a.apiHost, token = _a.token;
|
|
3099
3009
|
// Hooks
|
|
3100
3010
|
var graphQLMutation = common.useGraphQLmutation(function () {
|
|
3101
3011
|
console.log("navigate in useGraphQLmutation in useSendAcceptQuote is not yet implemented");
|
|
3102
3012
|
}, apiHost || "", function () {
|
|
3103
3013
|
console.log("onError in useGraphQLmutation in useSendAcceptQuote is not yet implemented");
|
|
3104
3014
|
});
|
|
3105
|
-
var handleAllErrorFormats = common.useAllErrorFormats(
|
|
3106
|
-
(function (url) {
|
|
3107
|
-
console.log("navigate to", url, " not implemented");
|
|
3108
|
-
}));
|
|
3015
|
+
var handleAllErrorFormats = common.useAllErrorFormats(onTokenExpired);
|
|
3109
3016
|
var signingPlugins = useSigningPlugins({ entityId: entityId, apiHost: apiHost, token: token });
|
|
3110
3017
|
var queryClient = reactQuery.useQueryClient();
|
|
3111
3018
|
// Local state
|
|
@@ -3218,27 +3125,19 @@ var useSigningComplete = function (_a) {
|
|
|
3218
3125
|
}, [data, eventParam, queryClient, token]);
|
|
3219
3126
|
};
|
|
3220
3127
|
|
|
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
3128
|
var useIsExpired = function (expiresAt) {
|
|
3230
3129
|
return dayjs(expiresAt).diff(dayjs(dayjs().format("YYYY-MM-DD"))) < 0;
|
|
3231
3130
|
};
|
|
3232
3131
|
|
|
3233
3132
|
var PandadocPollingModal = function (_a) {
|
|
3234
3133
|
var isVisible = _a.isVisible, setVisible = _a.setVisible, id = _a.id;
|
|
3235
|
-
var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost,
|
|
3134
|
+
var _b = React.useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, onTokenExpired = _b.onTokenExpired;
|
|
3236
3135
|
var graphQLMutation = common.useGraphQLmutation(function () {
|
|
3237
3136
|
console.log("graphQLMutation navigateOnTokenExpired not yet implemented");
|
|
3238
3137
|
}, apiHost || "", function () {
|
|
3239
3138
|
console.log("graphQLMutation onError not yet implemented");
|
|
3240
3139
|
});
|
|
3241
|
-
var handleAllErrorFormats = common.useAllErrorFormats(
|
|
3140
|
+
var handleAllErrorFormats = common.useAllErrorFormats(onTokenExpired);
|
|
3242
3141
|
var _c = React.useState(0), numberOfPolls = _c[0], setNumberOfPolls = _c[1];
|
|
3243
3142
|
var _d = React.useState(""), infoMessage = _d[0], setInfoMessage = _d[1];
|
|
3244
3143
|
React.useEffect(function () {
|
|
@@ -3318,58 +3217,82 @@ var DOCUMENT_NAME;
|
|
|
3318
3217
|
DOCUMENT_NAME["QUOTE"] = "quote";
|
|
3319
3218
|
})(DOCUMENT_NAME || (DOCUMENT_NAME = {}));
|
|
3320
3219
|
|
|
3220
|
+
var Text$c = antd.Typography.Text;
|
|
3321
3221
|
var documentName = DOCUMENT_NAME.QUOTE;
|
|
3222
|
+
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"])));
|
|
3223
|
+
function Quote(_a) {
|
|
3224
|
+
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;
|
|
3225
|
+
return (jsxRuntime.jsx(reactHelmetAsync.HelmetProvider, { children: jsxRuntime.jsx(InvoiceQuoteContext.Provider, __assign({ value: {
|
|
3226
|
+
id: id,
|
|
3227
|
+
invoiceQuoteViewComponent: invoiceQuoteViewComponent,
|
|
3228
|
+
onInvoiceDownloadError: onInvoiceDownloadError,
|
|
3229
|
+
onPaymentSuccess: onPaymentSuccess,
|
|
3230
|
+
entityId: entityId,
|
|
3231
|
+
shadow: shadow,
|
|
3232
|
+
className: className,
|
|
3233
|
+
hideDownloadButton: hideDownloadButton,
|
|
3234
|
+
} }, { children: jsxRuntime.jsx(ActualQuote, { entityId: entityId }) })) }));
|
|
3235
|
+
}
|
|
3322
3236
|
function ActualQuote(_a) {
|
|
3237
|
+
var _this = this;
|
|
3323
3238
|
var _b, _c;
|
|
3324
|
-
var
|
|
3325
|
-
|
|
3239
|
+
var entityId = _a.entityId;
|
|
3240
|
+
// Context
|
|
3241
|
+
var _d = React.useContext(BunnyContext), token = _d.token, apiHost = _d.apiHost, onTokenExpired = _d.onTokenExpired;
|
|
3326
3242
|
var entityBranding = React.useContext(BrandContext);
|
|
3327
|
-
var
|
|
3243
|
+
var _e = React.useContext(InvoiceQuoteContext), className = _e.className, id = _e.id, hideDownloadButton = _e.hideDownloadButton;
|
|
3328
3244
|
// Queries
|
|
3329
|
-
var
|
|
3245
|
+
var _f = reactQuery.useQuery({
|
|
3330
3246
|
queryKey: common.QueryKeyFactory.default.createQuoteKey(token, id),
|
|
3331
|
-
queryFn: function () { return
|
|
3247
|
+
queryFn: function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3248
|
+
var error_1;
|
|
3249
|
+
return __generator(this, function (_a) {
|
|
3250
|
+
switch (_a.label) {
|
|
3251
|
+
case 0:
|
|
3252
|
+
_a.trys.push([0, 2, , 3]);
|
|
3253
|
+
return [4 /*yield*/, getFormattedQuote({ token: token, apiHost: apiHost, id: id })];
|
|
3254
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
3255
|
+
case 2:
|
|
3256
|
+
error_1 = _a.sent();
|
|
3257
|
+
showErrorNotification(error_1.message);
|
|
3258
|
+
return [3 /*break*/, 3];
|
|
3259
|
+
case 3: return [2 /*return*/];
|
|
3260
|
+
}
|
|
3261
|
+
});
|
|
3262
|
+
}); },
|
|
3332
3263
|
placeholderData: reactQuery.keepPreviousData,
|
|
3333
|
-
}), data =
|
|
3264
|
+
}), data = _f.data, isLoading = _f.isLoading;
|
|
3334
3265
|
var formattedQuote = data;
|
|
3335
3266
|
// Hooks
|
|
3336
3267
|
var downloadFile = useDownloadFile(id);
|
|
3337
3268
|
var isExpired = useIsExpired(formattedQuote === null || formattedQuote === void 0 ? void 0 : formattedQuote.expiresAt);
|
|
3338
|
-
var
|
|
3269
|
+
var _g = useSendAcceptQuote({
|
|
3339
3270
|
entityId: entityId,
|
|
3340
3271
|
token: token,
|
|
3341
|
-
|
|
3342
|
-
(function (url) {
|
|
3343
|
-
console.log("navigate to", url, " not implemented");
|
|
3344
|
-
}),
|
|
3272
|
+
onTokenExpired: onTokenExpired,
|
|
3345
3273
|
apiHost: apiHost,
|
|
3346
3274
|
quoteId: id,
|
|
3347
|
-
}), acceptBoxVisible =
|
|
3275
|
+
}), 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
3276
|
useSigningComplete({ data: formattedQuote, token: token });
|
|
3277
|
+
var isMobile = common.useIsMobile();
|
|
3278
|
+
var showErrorNotification = common.useErrorNotification();
|
|
3349
3279
|
if (!formattedQuote || isLoading) {
|
|
3350
3280
|
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
3351
3281
|
}
|
|
3282
|
+
// Derived state
|
|
3283
|
+
var isAccepted = formattedQuote.state === "ACCEPTED";
|
|
3352
3284
|
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
3285
|
vendorName: formattedQuote.vendorName,
|
|
3354
3286
|
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 }) }));
|
|
3287
|
+
}) }), 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: {
|
|
3288
|
+
color: entityBranding.secondaryColor,
|
|
3289
|
+
} }, { 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
|
|
3290
|
+
? "flex w-full justify-end gap-2"
|
|
3291
|
+
: "flex items-center justify-end gap-2" }, { children: [!isMobile && !hideDownloadButton ? (jsxRuntime.jsx(antd.Button, __assign({ icon: jsxRuntime.jsx(DownloadOutlined$1, {}), onClick: function () {
|
|
3292
|
+
return downloadFile(apiHost + "/api/pdf/quote", token);
|
|
3293
|
+
} }, { 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) {
|
|
3294
|
+
return (jsxRuntime.jsx(antd.Button, __assign({ download: doc.filename, href: doc.url, type: "link" }, { children: doc.filename }), index));
|
|
3295
|
+
}) }))) : null }))] })), jsxRuntime.jsx(AcceptQuoteModal, { acceptBoxVisible: acceptBoxVisible, formattedQuote: formattedQuote, setAcceptBoxVisible: setAcceptBoxVisible, setIsAccepting: setIsAccepting, sendAccept: sendAccept }), jsxRuntime.jsx(PandadocPollingModal, { isVisible: pandadocPollingModalVisible, setVisible: setPandadocPollingModalVisible, id: id })] }));
|
|
3373
3296
|
}
|
|
3374
3297
|
var templateObject_1$4;
|
|
3375
3298
|
|
|
@@ -3424,21 +3347,14 @@ var getTransactions = function (filter, token, apiHost, kindsToShow) { return __
|
|
|
3424
3347
|
});
|
|
3425
3348
|
}); };
|
|
3426
3349
|
|
|
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
|
-
};
|
|
3350
|
+
var TransactionsListContext = React.createContext({});
|
|
3439
3351
|
|
|
3440
3352
|
var StateTag = function (_a) {
|
|
3441
3353
|
var state = _a.state;
|
|
3354
|
+
var transactionStateRenderer = React.useContext(TransactionsListContext).transactionStateRenderer;
|
|
3355
|
+
if (transactionStateRenderer) {
|
|
3356
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, { children: transactionStateRenderer(state) });
|
|
3357
|
+
}
|
|
3442
3358
|
return jsxRuntime.jsx(antd.Tag, __assign({ color: getColor(state) }, { children: lodash.capitalize(lodash.startCase(state)) }));
|
|
3443
3359
|
};
|
|
3444
3360
|
var getColor = function (state) {
|
|
@@ -3467,12 +3383,10 @@ var getColor = function (state) {
|
|
|
3467
3383
|
}
|
|
3468
3384
|
};
|
|
3469
3385
|
|
|
3470
|
-
var
|
|
3471
|
-
|
|
3472
|
-
var Text$a = antd.Typography.Text;
|
|
3386
|
+
var Text$b = antd.Typography.Text;
|
|
3473
3387
|
var TransactionDate = function (_a) {
|
|
3474
3388
|
var date = _a.date;
|
|
3475
|
-
return jsxRuntime.jsx(Text$
|
|
3389
|
+
return jsxRuntime.jsx(Text$b, __assign({ className: "text-sm" }, { children: common.formatDate(date) }));
|
|
3476
3390
|
};
|
|
3477
3391
|
|
|
3478
3392
|
// TODO: delete
|
|
@@ -3506,10 +3420,10 @@ var TransactionGridCell = styled__default["default"].div.withConfig({
|
|
|
3506
3420
|
})(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
3421
|
var templateObject_1$3;
|
|
3508
3422
|
|
|
3509
|
-
var Text$
|
|
3423
|
+
var Text$a = antd.Typography.Text;
|
|
3510
3424
|
var TransactionsEmptyState = function () {
|
|
3511
3425
|
var noTransactionsMessage = React.useContext(TransactionsListContext).noTransactionsMessage;
|
|
3512
|
-
return (jsxRuntime.jsx(Text$
|
|
3426
|
+
return (jsxRuntime.jsx(Text$a, __assign({ className: "flex justify-center p-4 text-base" }, { children: noTransactionsMessage || "There are no transactions" })));
|
|
3513
3427
|
};
|
|
3514
3428
|
|
|
3515
3429
|
var isInvoice = function (transaction) {
|
|
@@ -3526,7 +3440,7 @@ var TransactionRowTitle = function (_a) {
|
|
|
3526
3440
|
return (jsxRuntime.jsx("span", __assign({ className: "text-slate-400", style: { fontSize: "11px" } }, { children: transaction.transactionable.number })));
|
|
3527
3441
|
};
|
|
3528
3442
|
|
|
3529
|
-
var Text$
|
|
3443
|
+
var Text$9 = antd.Typography.Text;
|
|
3530
3444
|
var TransactionsListDesktop = function (_a) {
|
|
3531
3445
|
var transactions = _a.transactions, onTransactionClick = _a.onTransactionClick;
|
|
3532
3446
|
var columns = React.useContext(TransactionsListContext).columns;
|
|
@@ -3546,11 +3460,11 @@ var TransactionsListDesktop = function (_a) {
|
|
|
3546
3460
|
backgroundColor: index % 2 === 0
|
|
3547
3461
|
? "var(--row-background".concat(darkMode ? "-dark" : "", ")")
|
|
3548
3462
|
: "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$
|
|
3463
|
+
} }, { 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
3464
|
});
|
|
3551
3465
|
};
|
|
3552
3466
|
|
|
3553
|
-
var Text$
|
|
3467
|
+
var Text$8 = antd.Typography.Text;
|
|
3554
3468
|
var TransactionsListMobile = function (_a) {
|
|
3555
3469
|
var transactions = _a.transactions, onTransactionClick = _a.onTransactionClick;
|
|
3556
3470
|
var columns = React.useContext(TransactionsListContext).columns;
|
|
@@ -3569,20 +3483,23 @@ var TransactionsListMobile = function (_a) {
|
|
|
3569
3483
|
backgroundColor: index % 2 === 0
|
|
3570
3484
|
? "var(--row-background".concat(darkMode ? "-dark" : "", ")")
|
|
3571
3485
|
: "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$
|
|
3486
|
+
} }, { 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
3487
|
});
|
|
3574
3488
|
};
|
|
3575
3489
|
|
|
3490
|
+
var Text$7 = antd.Typography.Text;
|
|
3491
|
+
var DISPLAY_WIDTH = 1200;
|
|
3576
3492
|
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 =
|
|
3493
|
+
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
3494
|
common.TransactionKind.INVOICE,
|
|
3579
3495
|
common.TransactionKind.PAYMENT,
|
|
3580
3496
|
common.TransactionKind.REFUND,
|
|
3581
3497
|
common.TransactionKind.WRITE_OFF,
|
|
3582
|
-
] :
|
|
3498
|
+
] : _j, style = _a.style, filter = _a.filter, noTransactionsMessage = _a.noTransactionsMessage, entityId = _a.entityId;
|
|
3583
3499
|
var contextValues = {
|
|
3584
3500
|
showSearchBar: showSearchBar,
|
|
3585
3501
|
showTitle: showTitle,
|
|
3502
|
+
title: title,
|
|
3586
3503
|
transactionComponent: transactionComponent,
|
|
3587
3504
|
columns: columns,
|
|
3588
3505
|
className: className,
|
|
@@ -3597,28 +3514,25 @@ function Transactions(_a) {
|
|
|
3597
3514
|
noTransactionsMessage: noTransactionsMessage,
|
|
3598
3515
|
entityId: entityId,
|
|
3599
3516
|
};
|
|
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;
|
|
3517
|
+
var _k = React.useContext(BunnyContext), token = _k.token, apiHost = _k.apiHost;
|
|
3605
3518
|
// Local state
|
|
3606
|
-
var
|
|
3607
|
-
var
|
|
3519
|
+
var _l = React.useState(""), search = _l[0], setSearch = _l[1];
|
|
3520
|
+
var filterValue = filter ||
|
|
3608
3521
|
(search ? "filter: \"transaction.transactionableId is ".concat(search, "\"") : "");
|
|
3609
3522
|
// Queries
|
|
3610
3523
|
var data = reactQuery.useQuery({
|
|
3611
3524
|
queryKey: ["transactions", token, filter],
|
|
3612
|
-
queryFn: function () { return getTransactions(
|
|
3525
|
+
queryFn: function () { return getTransactions(filterValue, token, apiHost, kindsToShow); },
|
|
3613
3526
|
placeholderData: reactQuery.keepPreviousData,
|
|
3614
3527
|
}).data;
|
|
3615
|
-
return (jsxRuntime.jsx(TransactionsDisplay, { transactions: data, onSearchValueChanged: setSearch, search: search }));
|
|
3528
|
+
return (jsxRuntime.jsx(TransactionsListContext.Provider, __assign({ value: contextValues }, { children: jsxRuntime.jsx(TransactionsDisplay, { transactions: data, onSearchValueChanged: setSearch, search: search }) })));
|
|
3616
3529
|
}
|
|
3617
3530
|
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;
|
|
3531
|
+
var transactions = _a.transactions, onSearchValueChanged = _a.onSearchValueChanged, search = _a.search;
|
|
3532
|
+
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
3533
|
var columns = React.useContext(TransactionsListContext).columns;
|
|
3621
3534
|
var darkMode = React.useContext(BunnyContext).darkMode;
|
|
3535
|
+
var secondaryColor = React.useContext(BrandContext).secondaryColor;
|
|
3622
3536
|
// Local state
|
|
3623
3537
|
var _c = React.useState(null), selectedTransaction = _c[0], setSelectedTransaction = _c[1];
|
|
3624
3538
|
var _d = React.useState(false), drawerOpen = _d[0], setDrawerOpen = _d[1];
|
|
@@ -3668,38 +3582,48 @@ function TransactionsDisplay(_a) {
|
|
|
3668
3582
|
var kind = selectedTransaction.kind.toLowerCase();
|
|
3669
3583
|
return kind.charAt(0).toUpperCase() + kind.slice(1);
|
|
3670
3584
|
};
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
}
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3585
|
+
function handleDisplayClose() {
|
|
3586
|
+
onTransactionDisplayClose === null || onTransactionDisplayClose === void 0 ? void 0 : onTransactionDisplayClose(selectedTransaction);
|
|
3587
|
+
setDrawerOpen(false);
|
|
3588
|
+
}
|
|
3589
|
+
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
|
|
3590
|
+
), showSearchBar && (jsxRuntime.jsx("div", __assign({ className: "".concat(isMobile ? "w-full" : "") }, { children: jsxRuntime.jsx(antd.Input, { className: searchBarClassName
|
|
3591
|
+
? searchBarClassName
|
|
3592
|
+
: "border border-slate-200", onChange: function (e) {
|
|
3593
|
+
if (isNaN(Number(e.target.value))) {
|
|
3594
|
+
return;
|
|
3595
|
+
}
|
|
3596
|
+
onSearchValueChanged(e.target.value);
|
|
3597
|
+
}, prefix: jsxRuntime.jsx(SearchOutlined$1, {}), placeholder: "Search by id #", style: {
|
|
3598
|
+
minWidth: "300px",
|
|
3599
|
+
}, value: search }) })))] }))) : null, jsxRuntime.jsx("div", __assign({ className: "grid w-full rounded-md overflow-auto ".concat(shadow), style: {
|
|
3600
|
+
gridTemplateColumns: gridTemplateColumns(),
|
|
3601
|
+
backgroundColor: "var(--row-background".concat(darkMode ? "-dark" : "", ")"),
|
|
3602
|
+
} }, { children: isMobile ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: TransactionsListMobile({
|
|
3603
|
+
transactions: transactions,
|
|
3604
|
+
onTransactionClick: handleTransactionClick,
|
|
3605
|
+
}) })) : (jsxRuntime.jsx(jsxRuntime.Fragment, { children: TransactionsListDesktop({
|
|
3606
|
+
transactions: transactions,
|
|
3607
|
+
onTransactionClick: handleTransactionClick,
|
|
3608
|
+
}) })) }))] })), 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
3609
|
}
|
|
3691
3610
|
|
|
3692
3611
|
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
|
|
3612
|
+
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
3613
|
var apiHost = React.useContext(BunnyContext).apiHost;
|
|
3695
|
-
var
|
|
3614
|
+
var _k = React.useState(null), component = _k[0], setComponent = _k[1];
|
|
3696
3615
|
var contextValues = {
|
|
3697
3616
|
columns: columns,
|
|
3698
3617
|
kindsToShow: [],
|
|
3699
3618
|
onTransactionClick: handleQuoteClick,
|
|
3619
|
+
onTransactionDisplayClose: function () {
|
|
3620
|
+
setComponent(jsxRuntime.jsx(jsxRuntime.Fragment, {}));
|
|
3621
|
+
},
|
|
3700
3622
|
transactionComponent: component,
|
|
3623
|
+
transactionStateRenderer: quoteStateRenderer,
|
|
3701
3624
|
showSearchBar: showSearchBar,
|
|
3702
3625
|
showTitle: showTitle,
|
|
3626
|
+
title: title,
|
|
3703
3627
|
className: className,
|
|
3704
3628
|
shadow: shadow,
|
|
3705
3629
|
searchBarClassName: searchBarClassName,
|
|
@@ -3711,7 +3635,29 @@ function Quotes(_a) {
|
|
|
3711
3635
|
downloadTransactionLink: function (id) { return "".concat(apiHost, "/api/pdf/quote/").concat(id); },
|
|
3712
3636
|
entityId: entityId,
|
|
3713
3637
|
};
|
|
3638
|
+
function quoteStateRenderer(state) {
|
|
3639
|
+
// "DRAFT" | "SHARED" | "VIEWED" | "ACCEPTED" | "IN_APPROVAL" | "APPROVED" | "REJECTED";
|
|
3640
|
+
var getColor = function (state) {
|
|
3641
|
+
switch (state) {
|
|
3642
|
+
case "ACCEPTED":
|
|
3643
|
+
return "green";
|
|
3644
|
+
case "IN_APPROVAL":
|
|
3645
|
+
return "orange";
|
|
3646
|
+
case "APPROVED":
|
|
3647
|
+
return "green";
|
|
3648
|
+
case "REJECTED":
|
|
3649
|
+
return "red";
|
|
3650
|
+
case "DRAFT":
|
|
3651
|
+
case "SHARED":
|
|
3652
|
+
case "VIEWED":
|
|
3653
|
+
default:
|
|
3654
|
+
return "blue";
|
|
3655
|
+
}
|
|
3656
|
+
};
|
|
3657
|
+
return jsxRuntime.jsx(antd.Tag, __assign({ color: getColor(state) }, { children: lodash.capitalize(lodash.startCase(state)) }));
|
|
3658
|
+
}
|
|
3714
3659
|
function handleQuoteClick(quote) {
|
|
3660
|
+
onQuoteClick === null || onQuoteClick === void 0 ? void 0 : onQuoteClick(quote);
|
|
3715
3661
|
if (quoteComponent) {
|
|
3716
3662
|
setComponent(quoteComponent);
|
|
3717
3663
|
}
|
|
@@ -3735,9 +3681,17 @@ function QuotesWrapper() {
|
|
|
3735
3681
|
}).data;
|
|
3736
3682
|
if (data === undefined)
|
|
3737
3683
|
return null;
|
|
3738
|
-
|
|
3684
|
+
// filter out quotes in draft state, they are not viewable
|
|
3685
|
+
var quotes = data.nodes
|
|
3686
|
+
.filter(function (quote) {
|
|
3687
|
+
return quote.state !== "DRAFT";
|
|
3688
|
+
})
|
|
3689
|
+
.sort(function (a, b) {
|
|
3690
|
+
return new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime();
|
|
3691
|
+
});
|
|
3692
|
+
var quotesAsTransactions = quotes.map(function (quote) { return ({
|
|
3739
3693
|
transactionableId: quote.id,
|
|
3740
|
-
state:
|
|
3694
|
+
state: quote.state,
|
|
3741
3695
|
amount: quote.amount || quote.amountDue,
|
|
3742
3696
|
kind: "QUOTE",
|
|
3743
3697
|
currencyId: quote.currencyId,
|
|
@@ -3746,7 +3700,7 @@ function QuotesWrapper() {
|
|
|
3746
3700
|
},
|
|
3747
3701
|
createdAt: quote.createdAt,
|
|
3748
3702
|
}); });
|
|
3749
|
-
return (jsxRuntime.jsx(TransactionsDisplay, { transactions: quotesAsTransactions, onSearchValueChanged: setSearch, search: search
|
|
3703
|
+
return (jsxRuntime.jsx(TransactionsDisplay, { transactions: quotesAsTransactions, onSearchValueChanged: setSearch, search: search }));
|
|
3750
3704
|
}
|
|
3751
3705
|
|
|
3752
3706
|
var DrawerHeader = function (_a) {
|
|
@@ -3754,96 +3708,19 @@ var DrawerHeader = function (_a) {
|
|
|
3754
3708
|
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
3709
|
};
|
|
3756
3710
|
|
|
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;
|
|
3711
|
+
var PaymentMethod = function (_a) {
|
|
3712
|
+
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;
|
|
3713
|
+
var _d = React.useContext(BunnyContext), token = _d.token, apiHost = _d.apiHost, graphQLClient = _d.graphQLClient, onTokenExpired = _d.onTokenExpired;
|
|
3814
3714
|
// Hooks
|
|
3815
3715
|
var queryClient = reactQuery.useQueryClient();
|
|
3816
3716
|
var paymentPlugins = usePaymentPlugins({ entityId: entityId, apiHost: apiHost, token: token }).paymentPlugins;
|
|
3817
|
-
var showErrorNotification = common.useErrorNotification();
|
|
3818
3717
|
var showSuccessNotification = common.useSuccessNotification();
|
|
3819
|
-
var handleAllErrorFormats = common.useAllErrorFormats(
|
|
3718
|
+
var handleAllErrorFormats = common.useAllErrorFormats(onTokenExpired);
|
|
3820
3719
|
var isMobile = common.useIsMobile();
|
|
3821
3720
|
var data = usePaymentMethod(graphQLClient).data;
|
|
3721
|
+
var onClickRemove = useRemovePaymentMethod(paymentPlugins || [], token, apiHost);
|
|
3822
3722
|
// 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
|
-
};
|
|
3723
|
+
var _e = React.useState(false), showModal = _e[0], setShowModal = _e[1];
|
|
3847
3724
|
var onSuccess = function () {
|
|
3848
3725
|
queryClient.invalidateQueries({
|
|
3849
3726
|
queryKey: common.QueryKeyFactory.default.accountPaymentMethodKey,
|
|
@@ -3853,25 +3730,18 @@ var ActualPaymentMethod = function (_a) {
|
|
|
3853
3730
|
};
|
|
3854
3731
|
if (data === undefined)
|
|
3855
3732
|
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
3856
|
-
return (jsxRuntime.jsxs(
|
|
3733
|
+
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
3734
|
body: isMobile
|
|
3858
3735
|
? {
|
|
3859
3736
|
padding: "1rem 0 0",
|
|
3860
3737
|
}
|
|
3861
3738
|
: {},
|
|
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) {
|
|
3739
|
+
}, title: jsxRuntime.jsx(DrawerHeader, { onClose: function () { return setShowModal(false); }, title: "New payment method" }) }, { children: jsxRuntime.jsx(PaymentForm, { entityId: entityId, onFail: function (error) {
|
|
3864
3740
|
handleAllErrorFormats(error);
|
|
3865
|
-
setIsSaving(false);
|
|
3866
3741
|
}, onPaymentSuccess: function () {
|
|
3867
3742
|
onSuccess();
|
|
3868
|
-
|
|
3869
|
-
}, setIsSaving: setIsSaving }) }))] }));
|
|
3743
|
+
} }) }))] })));
|
|
3870
3744
|
};
|
|
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
3745
|
|
|
3876
3746
|
var pageWrapperClassName = function (isMobile) {
|
|
3877
3747
|
return "flex flex-col grow pt-4 ".concat(isMobile ? "pb-4 overflow-hidden" : "pb-8", " ").concat("content-container");
|
|
@@ -3906,6 +3776,30 @@ var quoteRecalculateTaxes = function (_a) {
|
|
|
3906
3776
|
});
|
|
3907
3777
|
};
|
|
3908
3778
|
|
|
3779
|
+
var MUTATION$6 = "{\n currentUser {\n taxationRequiredAccountFields\n }\n}";
|
|
3780
|
+
var getTaxationRequiredAccountFields = function (_a) {
|
|
3781
|
+
var token = _a.token, apiHost = _a.apiHost;
|
|
3782
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
3783
|
+
var response;
|
|
3784
|
+
var _b, _c;
|
|
3785
|
+
return __generator(this, function (_d) {
|
|
3786
|
+
switch (_d.label) {
|
|
3787
|
+
case 0: return [4 /*yield*/, common.gqlRequest({
|
|
3788
|
+
query: MUTATION$6,
|
|
3789
|
+
token: token,
|
|
3790
|
+
apiHost: apiHost,
|
|
3791
|
+
})];
|
|
3792
|
+
case 1:
|
|
3793
|
+
response = _d.sent();
|
|
3794
|
+
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
|
|
3795
|
+
? response.currentUser
|
|
3796
|
+
.taxationRequiredAccountFields
|
|
3797
|
+
: null];
|
|
3798
|
+
}
|
|
3799
|
+
});
|
|
3800
|
+
});
|
|
3801
|
+
};
|
|
3802
|
+
|
|
3909
3803
|
var useHasTaxPlugin = function (_a) {
|
|
3910
3804
|
var entityId = _a.entityId, apiHost = _a.apiHost, token = _a.token;
|
|
3911
3805
|
var plugins = usePlugins({
|
|
@@ -3916,7 +3810,7 @@ var useHasTaxPlugin = function (_a) {
|
|
|
3916
3810
|
return Boolean(plugins === null || plugins === void 0 ? void 0 : plugins.some(function (plugin) { return plugin.type === "taxation"; }));
|
|
3917
3811
|
};
|
|
3918
3812
|
|
|
3919
|
-
var MUTATION$
|
|
3813
|
+
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
3814
|
var accountUpdate = function (_a) {
|
|
3921
3815
|
var accountId = _a.accountId, attributes = _a.attributes, token = _a.token, apiHost = _a.apiHost;
|
|
3922
3816
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -3927,7 +3821,7 @@ var accountUpdate = function (_a) {
|
|
|
3927
3821
|
case 0:
|
|
3928
3822
|
vars = { id: accountId, attributes: attributes };
|
|
3929
3823
|
return [4 /*yield*/, common.gqlRequest({
|
|
3930
|
-
query: MUTATION$
|
|
3824
|
+
query: MUTATION$5,
|
|
3931
3825
|
token: token,
|
|
3932
3826
|
vars: vars,
|
|
3933
3827
|
apiHost: apiHost,
|
|
@@ -3987,11 +3881,16 @@ var FormBillingState = function (_a) {
|
|
|
3987
3881
|
return (jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Billing state", name: "billingState", rules: [{ required: billingStateRequired }] }, { children: jsxRuntime.jsx(antd.Input, { placeholder: "State" }) })));
|
|
3988
3882
|
};
|
|
3989
3883
|
|
|
3884
|
+
var getQuoteAmountDue = function (quote) {
|
|
3885
|
+
return quote.amountDue;
|
|
3886
|
+
};
|
|
3887
|
+
|
|
3990
3888
|
var QuoteCheckout = function (_a) {
|
|
3991
|
-
var account = _a.account,
|
|
3889
|
+
var account = _a.account, onSuccess = _a.onSuccess, onFail = _a.onFail, quote = _a.quote, taxationRequiredAccountFields = _a.taxationRequiredAccountFields, entityId = _a.entityId;
|
|
3992
3890
|
// Context
|
|
3993
3891
|
var isMobile = common.useIsMobile();
|
|
3994
3892
|
var _b = React.useContext(BunnyContext), apiHost = _b.apiHost, token = _b.token;
|
|
3893
|
+
var _c = React.useState(false), isSaving = _c[0], setIsSaving = _c[1];
|
|
3995
3894
|
var paymentRequired = getQuoteAmountDue(quote) > 0;
|
|
3996
3895
|
var checkoutMutation = reactQuery.useMutation({
|
|
3997
3896
|
mutationFn: function (_a) {
|
|
@@ -4035,6 +3934,7 @@ var QuoteCheckout = function (_a) {
|
|
|
4035
3934
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
4036
3935
|
var token_1, plugin, savePaymentMethod, metadata, paymentMethodId;
|
|
4037
3936
|
return __generator(this, function (_b) {
|
|
3937
|
+
setIsSaving(true);
|
|
4038
3938
|
if (pluginPaymentResponse) {
|
|
4039
3939
|
token_1 = pluginPaymentResponse.token, plugin = pluginPaymentResponse.plugin, savePaymentMethod = pluginPaymentResponse.savePaymentMethod, metadata = pluginPaymentResponse.metadata;
|
|
4040
3940
|
checkoutMutation.mutate({
|
|
@@ -4057,48 +3957,34 @@ var QuoteCheckout = function (_a) {
|
|
|
4057
3957
|
else {
|
|
4058
3958
|
checkoutMutation.mutate({});
|
|
4059
3959
|
}
|
|
3960
|
+
setIsSaving(false);
|
|
4060
3961
|
return [2 /*return*/];
|
|
4061
3962
|
});
|
|
4062
3963
|
});
|
|
4063
3964
|
};
|
|
4064
3965
|
if (taxationRequiredAccountFields)
|
|
4065
3966
|
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);
|
|
3967
|
+
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
3968
|
handleCheckout({});
|
|
4069
3969
|
}, type: "primary" }, { children: isSaving ? "Processing..." : "Complete order" })), jsxRuntime.jsx("div", __assign({ className: "text-xs text-slate-500" }, { children: "No payment is required" }))] })) }))) }));
|
|
4070
3970
|
};
|
|
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
|
-
});
|
|
3971
|
+
var PaymentFormWrapper = function (_a) {
|
|
3972
|
+
var children = _a.children, setMaxHeight = _a.setMaxHeight, className = _a.className;
|
|
3973
|
+
var isMobile = common.useIsMobile();
|
|
3974
|
+
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
|
|
3975
|
+
? setMaxHeight
|
|
3976
|
+
? { maxHeight: "60vh" }
|
|
3977
|
+
: {}
|
|
3978
|
+
: {
|
|
3979
|
+
width: "350px",
|
|
3980
|
+
})) }, { children: children })));
|
|
4094
3981
|
};
|
|
4095
3982
|
|
|
4096
3983
|
var queryKeyFactory = common.QueryKeyFactory.default;
|
|
4097
3984
|
var Checkout = function (_a) {
|
|
4098
3985
|
var _b, _c;
|
|
4099
3986
|
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];
|
|
3987
|
+
var apiHost = React.useContext(BunnyContext).apiHost;
|
|
4102
3988
|
var isMobile = common.useIsMobile();
|
|
4103
3989
|
var hasTaxPlugin = useHasTaxPlugin({
|
|
4104
3990
|
entityId: entityId,
|
|
@@ -4107,20 +3993,20 @@ var Checkout = function (_a) {
|
|
|
4107
3993
|
});
|
|
4108
3994
|
var queryClient = reactQuery.useQueryClient();
|
|
4109
3995
|
// Queries
|
|
4110
|
-
var
|
|
3996
|
+
var _e = reactQuery.useQuery({
|
|
4111
3997
|
queryKey: ["getTaxationRequiredAccountFields", token],
|
|
4112
3998
|
queryFn: function () { return getTaxationRequiredAccountFields({ token: token, apiHost: apiHost }); },
|
|
4113
3999
|
enabled: Boolean(quote),
|
|
4114
4000
|
staleTime: 0,
|
|
4115
|
-
}), taxationRequiredAccountFields =
|
|
4116
|
-
var
|
|
4001
|
+
}), taxationRequiredAccountFields = _e.data, isLoadingTaxationRequiredAccountFields = _e.isLoading;
|
|
4002
|
+
var _f = reactQuery.useQuery({
|
|
4117
4003
|
queryKey: ["account", quote === null || quote === void 0 ? void 0 : quote.accountId],
|
|
4118
4004
|
queryFn: function () {
|
|
4119
4005
|
return (quote === null || quote === void 0 ? void 0 : quote.accountId) && common.getAccount({ id: quote.accountId, token: token, apiHost: apiHost });
|
|
4120
4006
|
},
|
|
4121
4007
|
enabled: Boolean(quote === null || quote === void 0 ? void 0 : quote.accountId) &&
|
|
4122
4008
|
((taxationRequiredAccountFields === null || taxationRequiredAccountFields === void 0 ? void 0 : taxationRequiredAccountFields.length) || 0) > 0,
|
|
4123
|
-
}), account =
|
|
4009
|
+
}), account = _f.data, isLoadingAccount = _f.isLoading;
|
|
4124
4010
|
reactQuery.useQuery({
|
|
4125
4011
|
queryKey: queryKeyFactory.createQuoteTaxCalculateKey(quote === null || quote === void 0 ? void 0 : quote.id),
|
|
4126
4012
|
queryFn: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -4157,30 +4043,24 @@ var Checkout = function (_a) {
|
|
|
4157
4043
|
return null;
|
|
4158
4044
|
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
4045
|
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,
|
|
4046
|
+
} }, { 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
4047
|
onFail(error);
|
|
4162
|
-
setIsSaving(false);
|
|
4163
4048
|
}, onSuccess: function (_a) {
|
|
4164
4049
|
var savePaymentMethod = _a.savePaymentMethod;
|
|
4165
4050
|
onSuccess({ savePaymentMethod: savePaymentMethod });
|
|
4166
|
-
|
|
4167
|
-
}, setIsSaving: setIsSaving, entityId: entityId })) : quote ? (jsxRuntime.jsx(QuoteCheckout, { account: account, entityId: entityId, isSaving: isSaving, onFail: function (error) {
|
|
4051
|
+
}, entityId: entityId })) : quote ? (jsxRuntime.jsx(QuoteCheckout, { account: account, entityId: entityId, onFail: function (error) {
|
|
4168
4052
|
onFail(error);
|
|
4169
|
-
setIsSaving(false);
|
|
4170
4053
|
}, onSuccess: function (_a) {
|
|
4171
4054
|
var savePaymentMethod = _a.savePaymentMethod;
|
|
4172
4055
|
onSuccess({ savePaymentMethod: savePaymentMethod });
|
|
4173
|
-
|
|
4174
|
-
}, quote: quote, setIsSaving: setIsSaving, taxationRequiredAccountFields: taxationRequiredAccountFields, token: token })) : (jsxRuntime.jsx(PaymentForm, { entityId: entityId, isSaving: isSaving, onFail: function (error) {
|
|
4056
|
+
}, quote: quote, taxationRequiredAccountFields: taxationRequiredAccountFields, token: token })) : (jsxRuntime.jsx(PaymentForm, { entityId: entityId, onFail: function (error) {
|
|
4175
4057
|
onFail(error);
|
|
4176
|
-
setIsSaving(false);
|
|
4177
4058
|
}, onPaymentSuccess: function (_a) {
|
|
4178
4059
|
var pluginPaymentResponse = _a.pluginPaymentResponse;
|
|
4179
4060
|
onSuccess({
|
|
4180
4061
|
savePaymentMethod: pluginPaymentResponse === null || pluginPaymentResponse === void 0 ? void 0 : pluginPaymentResponse.savePaymentMethod,
|
|
4181
4062
|
});
|
|
4182
|
-
|
|
4183
|
-
}, setIsSaving: setIsSaving }))] }))] })) })));
|
|
4063
|
+
} }))] }))] })) })));
|
|
4184
4064
|
};
|
|
4185
4065
|
|
|
4186
4066
|
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 +4098,32 @@ var accountSignup = function (_a) {
|
|
|
4218
4098
|
});
|
|
4219
4099
|
};
|
|
4220
4100
|
|
|
4221
|
-
var MUTATION$3 =
|
|
4101
|
+
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";
|
|
4102
|
+
var portalSessionCreate = function (_a) {
|
|
4103
|
+
var tenantCode = _a.tenantCode, expiry = _a.expiry, returnUrl = _a.returnUrl, token = _a.token, apiHost = _a.apiHost;
|
|
4104
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
4105
|
+
var response, errors;
|
|
4106
|
+
var _b;
|
|
4107
|
+
return __generator(this, function (_c) {
|
|
4108
|
+
switch (_c.label) {
|
|
4109
|
+
case 0: return [4 /*yield*/, common.gqlRequest({
|
|
4110
|
+
query: MUTATION$3,
|
|
4111
|
+
token: token,
|
|
4112
|
+
vars: { tenantCode: tenantCode, expiry: expiry, returnUrl: returnUrl },
|
|
4113
|
+
apiHost: apiHost,
|
|
4114
|
+
})];
|
|
4115
|
+
case 1:
|
|
4116
|
+
response = _c.sent();
|
|
4117
|
+
errors = (response === null || response === void 0 ? void 0 : response.portalSessionCreate).errors;
|
|
4118
|
+
if (errors)
|
|
4119
|
+
throw errors;
|
|
4120
|
+
return [2 /*return*/, (_b = response === null || response === void 0 ? void 0 : response.portalSessionCreate) === null || _b === void 0 ? void 0 : _b.token];
|
|
4121
|
+
}
|
|
4122
|
+
});
|
|
4123
|
+
});
|
|
4124
|
+
};
|
|
4125
|
+
|
|
4126
|
+
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
4127
|
var quoteAccountSignup = function (_a) {
|
|
4223
4128
|
var token = _a.token, apiHost = _a.apiHost, entityId = _a.entityId, priceListCode = _a.priceListCode, accountName = _a.accountName, billingContact = _a.billingContact;
|
|
4224
4129
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -4234,7 +4139,7 @@ var quoteAccountSignup = function (_a) {
|
|
|
4234
4139
|
billingContact: billingContact,
|
|
4235
4140
|
};
|
|
4236
4141
|
return [4 /*yield*/, common.gqlRequest({
|
|
4237
|
-
query: MUTATION$
|
|
4142
|
+
query: MUTATION$2(),
|
|
4238
4143
|
token: token,
|
|
4239
4144
|
vars: vars,
|
|
4240
4145
|
apiHost: apiHost,
|
|
@@ -4250,7 +4155,7 @@ var quoteAccountSignup = function (_a) {
|
|
|
4250
4155
|
});
|
|
4251
4156
|
};
|
|
4252
4157
|
|
|
4253
|
-
var MUTATION$
|
|
4158
|
+
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
4159
|
var getPriceList = function (_a) {
|
|
4255
4160
|
var token = _a.token, code = _a.code, apiHost = _a.apiHost;
|
|
4256
4161
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -4258,7 +4163,7 @@ var getPriceList = function (_a) {
|
|
|
4258
4163
|
return __generator(this, function (_b) {
|
|
4259
4164
|
switch (_b.label) {
|
|
4260
4165
|
case 0: return [4 /*yield*/, common.gqlRequest({
|
|
4261
|
-
query: MUTATION$
|
|
4166
|
+
query: MUTATION$1(),
|
|
4262
4167
|
token: token,
|
|
4263
4168
|
vars: { code: code },
|
|
4264
4169
|
apiHost: apiHost,
|
|
@@ -4272,8 +4177,8 @@ var getPriceList = function (_a) {
|
|
|
4272
4177
|
};
|
|
4273
4178
|
|
|
4274
4179
|
function PaymentForms(_a) {
|
|
4275
|
-
var quote = _a.quote,
|
|
4276
|
-
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: quote ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children:
|
|
4180
|
+
var quote = _a.quote, handlePaymentSaveSuccess = _a.handlePaymentSaveSuccess, handlePaymentFail = _a.handlePaymentFail, handleSubmit = _a.handleSubmit, proceedingToPayment = _a.proceedingToPayment, entityId = _a.entityId, accountId = _a.accountId;
|
|
4181
|
+
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
4182
|
}
|
|
4278
4183
|
function InitialSignupForm(_a) {
|
|
4279
4184
|
var onSubmit = _a.onSubmit, submitting = _a.submitting;
|
|
@@ -4288,7 +4193,7 @@ function InitialSignupForm(_a) {
|
|
|
4288
4193
|
var _b = e.target, name = _b.name, value = _b.value;
|
|
4289
4194
|
setFormData(__assign(__assign({}, formData), (_a = {}, _a[name] = value, _a)));
|
|
4290
4195
|
};
|
|
4291
|
-
return (jsxRuntime.jsxs(antd.Form, __assign({ className: "flex
|
|
4196
|
+
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
4197
|
handleInputChange(e);
|
|
4293
4198
|
setFormData(__assign(__assign({}, formData), { firstName: e.target.value }));
|
|
4294
4199
|
} }) })), 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 +4213,40 @@ function InitialSignupForm(_a) {
|
|
|
4308
4213
|
} }) }))] })), 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
4214
|
}
|
|
4310
4215
|
|
|
4311
|
-
var Title = antd.Typography.Title, Text$
|
|
4216
|
+
var Title = antd.Typography.Title, Text$6 = antd.Typography.Text;
|
|
4312
4217
|
function PaymentSuccessDisplay(_a) {
|
|
4313
4218
|
var amountPaid = _a.amountPaid, className = _a.className, companyName = _a.companyName, returnUrl = _a.returnUrl, style = _a.style;
|
|
4314
4219
|
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$
|
|
4220
|
+
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
4221
|
}
|
|
4317
4222
|
|
|
4318
|
-
var Text$
|
|
4223
|
+
var Text$5 = antd.Typography.Text;
|
|
4319
4224
|
function PriceListDisplay(_a) {
|
|
4320
4225
|
var priceListData = _a.priceListData, topNavImageUrl = _a.topNavImageUrl;
|
|
4321
4226
|
if (!priceListData)
|
|
4322
4227
|
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$
|
|
4228
|
+
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
4229
|
}
|
|
4325
4230
|
|
|
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
4231
|
var showErrorNotification = common.useErrorNotification();
|
|
4352
4232
|
function Signup(_a) {
|
|
4353
|
-
var companyName = _a.companyName, entityId = _a.entityId, priceListCode = _a.priceListCode, returnUrl = _a.returnUrl;
|
|
4233
|
+
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
4234
|
// Hooks
|
|
4355
|
-
var
|
|
4235
|
+
var _d = React.useContext(BunnyContext), apiHost = _d.apiHost, token = _d.token, graphQLClient = _d.graphQLClient;
|
|
4356
4236
|
var isMobile = common.useIsMobile();
|
|
4357
4237
|
var topNavImageUrl = React.useContext(BrandContext).topNavImageUrl;
|
|
4358
|
-
var
|
|
4359
|
-
var
|
|
4360
|
-
var
|
|
4361
|
-
var
|
|
4362
|
-
var
|
|
4363
|
-
var
|
|
4364
|
-
var
|
|
4365
|
-
var
|
|
4238
|
+
var _e = React.useState(undefined), quote = _e[0], setQuote = _e[1];
|
|
4239
|
+
var _f = React.useState(undefined), accountId = _f[0], setAccountId = _f[1];
|
|
4240
|
+
var _g = React.useState(undefined), quoteId = _g[0], setQuoteId = _g[1];
|
|
4241
|
+
var _h = React.useState(undefined), portalSessionToken = _h[0], setPortalSessionToken = _h[1];
|
|
4242
|
+
var _j = React.useState(undefined), formData = _j[0], setFormData = _j[1];
|
|
4243
|
+
var _k = React.useState(false), proceedingToPayment = _k[0], setProceedingToPayment = _k[1];
|
|
4244
|
+
var _l = React.useState(false), purchaseSucceeded = _l[0], setPurchaseSucceeded = _l[1];
|
|
4245
|
+
var _m = React.useState(undefined), paymentMethodGraphQLClient = _m[0], setPaymentMethodGraphQLClient = _m[1];
|
|
4246
|
+
var paymentMethod = usePaymentMethod(paymentMethodGraphQLClient || graphQLClient, accountId).data;
|
|
4247
|
+
var queryClient = reactQuery.useQueryClient();
|
|
4248
|
+
// console.log("signup paymentMethod", paymentMethod);
|
|
4249
|
+
console.log("signup accountId", accountId);
|
|
4366
4250
|
// Queries
|
|
4367
4251
|
var priceListData = reactQuery.useQuery({
|
|
4368
4252
|
queryKey: ["priceList", priceListCode],
|
|
@@ -4401,6 +4285,12 @@ function Signup(_a) {
|
|
|
4401
4285
|
case 2:
|
|
4402
4286
|
portalSessionToken = _a.sent();
|
|
4403
4287
|
setPortalSessionToken(portalSessionToken);
|
|
4288
|
+
setPaymentMethodGraphQLClient(createGraphQLClient(portalSessionToken, apiHost || ""));
|
|
4289
|
+
// We must invalidate the accountPaymentMethodKey query in order to clear payment methods from the provided api token,
|
|
4290
|
+
// to instead use paymentMethods from portalSessionToken.
|
|
4291
|
+
queryClient.invalidateQueries({
|
|
4292
|
+
queryKey: common.QueryKeyFactory.default.accountPaymentMethodKey,
|
|
4293
|
+
});
|
|
4404
4294
|
setQuoteId(data.quote.id);
|
|
4405
4295
|
setProceedingToPayment(false);
|
|
4406
4296
|
setQuote({
|
|
@@ -4413,11 +4303,10 @@ function Signup(_a) {
|
|
|
4413
4303
|
});
|
|
4414
4304
|
}
|
|
4415
4305
|
function handlePaymentSaveSuccess(paymentSuccess) {
|
|
4416
|
-
var _a;
|
|
4417
4306
|
return __awaiter(this, void 0, void 0, function () {
|
|
4418
4307
|
var response, plugin;
|
|
4419
|
-
return __generator(this, function (
|
|
4420
|
-
switch (
|
|
4308
|
+
return __generator(this, function (_a) {
|
|
4309
|
+
switch (_a.label) {
|
|
4421
4310
|
case 0:
|
|
4422
4311
|
if (!formData) {
|
|
4423
4312
|
throw new Error("Form data is required");
|
|
@@ -4438,14 +4327,13 @@ function Signup(_a) {
|
|
|
4438
4327
|
apiHost: apiHost,
|
|
4439
4328
|
entityId: entityId,
|
|
4440
4329
|
quoteId: quoteId,
|
|
4441
|
-
paymentMethodId:
|
|
4330
|
+
paymentMethodId: paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.id,
|
|
4442
4331
|
pluginId: plugin.id.toString(),
|
|
4443
4332
|
priceListCode: priceListCode,
|
|
4444
4333
|
accountId: accountId,
|
|
4445
4334
|
})];
|
|
4446
4335
|
case 1:
|
|
4447
|
-
|
|
4448
|
-
setIsPaying(false);
|
|
4336
|
+
_a.sent();
|
|
4449
4337
|
setPurchaseSucceeded(true);
|
|
4450
4338
|
return [2 /*return*/];
|
|
4451
4339
|
}
|
|
@@ -4454,14 +4342,14 @@ function Signup(_a) {
|
|
|
4454
4342
|
}
|
|
4455
4343
|
function handlePaymentFail(error) {
|
|
4456
4344
|
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
4345
|
}
|
|
4346
|
+
var WrapperComponent = function (_a) {
|
|
4347
|
+
var children = _a.children, className = _a.className, style = _a.style;
|
|
4348
|
+
return isCardEnabled ? (jsxRuntime.jsx(Card, __assign({ className: className, style: style }, { children: children }))) : (jsxRuntime.jsx("div", __assign({ className: className, style: style }, { children: children })));
|
|
4349
|
+
};
|
|
4350
|
+
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
|
|
4351
|
+
? "items-center justify-center my-12"
|
|
4352
|
+
: "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
4353
|
}
|
|
4466
4354
|
|
|
4467
4355
|
// WARNING: There is a preview button on APP that will need to be changed if this query is changed
|
|
@@ -4595,6 +4483,19 @@ var ErrorView = function (_a) {
|
|
|
4595
4483
|
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
4484
|
};
|
|
4597
4485
|
|
|
4486
|
+
var Text$4 = antd.Typography.Text;
|
|
4487
|
+
var PageHeaderWithActions = function (_a) {
|
|
4488
|
+
var children = _a.children, title = _a.title, className = _a.className;
|
|
4489
|
+
var isMobile = common.useIsMobile();
|
|
4490
|
+
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] })));
|
|
4491
|
+
};
|
|
4492
|
+
var PageSubTitle = function (_a) {
|
|
4493
|
+
var title = _a.title;
|
|
4494
|
+
var secondaryColor = React.useContext(BrandContext).secondaryColor;
|
|
4495
|
+
var darkMode = React.useContext(BunnyContext).darkMode;
|
|
4496
|
+
return (jsxRuntime.jsx(Text$4, __assign({ className: "shrink-0 font-medium", style: { color: darkMode ? undefined : secondaryColor } }, { children: title })));
|
|
4497
|
+
};
|
|
4498
|
+
|
|
4598
4499
|
var Text$3 = antd.Typography.Text;
|
|
4599
4500
|
var HideExpiredToggle = function (_a) {
|
|
4600
4501
|
var hideExpired = _a.hideExpired, setHideExpired = _a.setHideExpired, subscriptions = _a.subscriptions;
|
|
@@ -5184,9 +5085,9 @@ var SubscriptionsContext = React.createContext({});
|
|
|
5184
5085
|
// !!! This component is intended to be view only, however it still has lots of code for full functionality.
|
|
5185
5086
|
// !!! This must be refactored.
|
|
5186
5087
|
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;
|
|
5088
|
+
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
5089
|
// Context
|
|
5189
|
-
var _c = React.useContext(BunnyContext), token = _c.token, apiHost = _c.apiHost,
|
|
5090
|
+
var _c = React.useContext(BunnyContext), token = _c.token, apiHost = _c.apiHost, onTokenExpired = _c.onTokenExpired;
|
|
5190
5091
|
// Recoil state
|
|
5191
5092
|
// const [updatingChargeQuantityId, setUpdatingChargeQuantityId] =
|
|
5192
5093
|
// useRecoilState(updatingChargeQuantityIdState);
|
|
@@ -5196,10 +5097,7 @@ var Subscriptions = function (_a) {
|
|
|
5196
5097
|
var _f = React.useState(true), hideExpired = _f[0], setHideExpired = _f[1];
|
|
5197
5098
|
var _g = React.useState(false); _g[0]; var setQuantityDrawerOpen = _g[1];
|
|
5198
5099
|
// Hooks
|
|
5199
|
-
var handleAllErrorFormats = common.useAllErrorFormats(
|
|
5200
|
-
(function (url) {
|
|
5201
|
-
console.log("navigate to", url, " not implemented");
|
|
5202
|
-
}));
|
|
5100
|
+
var handleAllErrorFormats = common.useAllErrorFormats(onTokenExpired);
|
|
5203
5101
|
var queryClient = reactQuery.useQueryClient();
|
|
5204
5102
|
var showSuccessNotification = common.useSuccessNotification();
|
|
5205
5103
|
// const quoteDelete = useQuoteDelete();
|
|
@@ -5277,7 +5175,7 @@ var Subscriptions = function (_a) {
|
|
|
5277
5175
|
shadow: shadow,
|
|
5278
5176
|
gap: gap,
|
|
5279
5177
|
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: {
|
|
5178
|
+
} }, { 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
5179
|
flexShrink: 1,
|
|
5282
5180
|
} }, { 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
5181
|
};
|