@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/esm/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import React__default, { createContext, useContext, useEffect, useState, useMemo, useRef } from 'react';
|
|
3
|
+
import React__default, { createContext, useContext, useEffect, useState, useMemo, useCallback, useRef } from 'react';
|
|
4
4
|
import { Markup } from 'interweave';
|
|
5
|
-
import { ConfigProvider, Button, Typography,
|
|
5
|
+
import { ConfigProvider, Button, Typography, Tag, Divider, Popconfirm, Input, Checkbox, Collapse, Modal, Form, Drawer, Card as Card$1, Select, Image, Dropdown } from 'antd';
|
|
6
6
|
import styled from 'styled-components';
|
|
7
|
-
import { DEFAULT_ACCENT_COLOR, DEFAULT_BRAND_COLOR, DEFAULT_SECONDARY_COLOR, DEFAULT_TOP_NAV_IMAGE_URL, gqlRequest, useIsMobile, isColorTooDark, MARK_PRO, INPUT_BORDER_COLOR, SLATE_50, SLATE_400, SLATE_200,
|
|
8
|
-
import { QueryClient, QueryClientProvider, useQuery,
|
|
7
|
+
import { DEFAULT_ACCENT_COLOR, DEFAULT_BRAND_COLOR, DEFAULT_SECONDARY_COLOR, DEFAULT_TOP_NAV_IMAGE_URL, gqlRequest, QueryKeyFactory, useIsMobile, isColorTooDark, MARK_PRO, INPUT_BORDER_COLOR, SLATE_50, SLATE_400, SLATE_200, getPlugins, invokePlugin, useErrorNotification, formatCurrency, GRAY_500, GRAY_200, useSuccessNotification, useAllErrorFormats, getFormattedInvoice, PAYABLE_INVOICE_STATES, DOCUMENT_NAME as DOCUMENT_NAME$1, useGraphQLmutation, formatDate, FrontendTransaction, SLATE_600, WHITE, TransactionKind, Lists, getAccount, SubscriptionState as SubscriptionState$2, MODAL_MAX_HEIGHT, SLATE_500, StringUtils, DataInterval, TAG_COLORS, ChargeType } from '@bunnyapp/common';
|
|
8
|
+
import { QueryClient, QueryClientProvider, useQuery, useQueryClient, useMutation, keepPreviousData } from '@tanstack/react-query';
|
|
9
9
|
import theme from 'antd/lib/theme';
|
|
10
10
|
import { RecoilRoot } from 'recoil';
|
|
11
11
|
import { GraphQLClient } from 'graphql-request';
|
|
12
12
|
import { HelmetProvider, Helmet } from 'react-helmet-async';
|
|
13
|
-
import { useElements, useStripe, PaymentElement, Elements } from '@stripe/react-stripe-js';
|
|
14
|
-
import { loadStripe } from '@stripe/stripe-js/pure';
|
|
15
13
|
import { capitalize, startCase, cloneDeep, omit } from 'lodash';
|
|
16
14
|
import { BarChart, ResponsiveContainer, XAxis, Tooltip, Bar, Rectangle } from 'recharts';
|
|
15
|
+
import { useElements, useStripe, Elements, PaymentElement } from '@stripe/react-stripe-js';
|
|
16
|
+
import { loadStripe } from '@stripe/stripe-js/pure';
|
|
17
17
|
|
|
18
18
|
function styleInject(css, ref) {
|
|
19
19
|
if ( ref === void 0 ) ref = {};
|
|
@@ -42,7 +42,7 @@ function styleInject(css, ref) {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
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";
|
|
45
|
+
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";
|
|
46
46
|
styleInject(css_248z);
|
|
47
47
|
|
|
48
48
|
/******************************************************************************
|
|
@@ -1466,11 +1466,11 @@ var BankOutlined = function BankOutlined(props, ref) {
|
|
|
1466
1466
|
};
|
|
1467
1467
|
|
|
1468
1468
|
/** */
|
|
1469
|
-
var RefIcon$
|
|
1469
|
+
var RefIcon$5 = /*#__PURE__*/React.forwardRef(BankOutlined);
|
|
1470
1470
|
if (process.env.NODE_ENV !== 'production') {
|
|
1471
|
-
RefIcon$
|
|
1471
|
+
RefIcon$5.displayName = 'BankOutlined';
|
|
1472
1472
|
}
|
|
1473
|
-
var BankOutlined$1 = RefIcon$
|
|
1473
|
+
var BankOutlined$1 = RefIcon$5;
|
|
1474
1474
|
|
|
1475
1475
|
// This icon file is generated automatically.
|
|
1476
1476
|
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" };
|
|
@@ -1484,11 +1484,11 @@ var CheckCircleFilled = function CheckCircleFilled(props, ref) {
|
|
|
1484
1484
|
};
|
|
1485
1485
|
|
|
1486
1486
|
/** */
|
|
1487
|
-
var RefIcon$
|
|
1487
|
+
var RefIcon$4 = /*#__PURE__*/React.forwardRef(CheckCircleFilled);
|
|
1488
1488
|
if (process.env.NODE_ENV !== 'production') {
|
|
1489
|
-
RefIcon$
|
|
1489
|
+
RefIcon$4.displayName = 'CheckCircleFilled';
|
|
1490
1490
|
}
|
|
1491
|
-
var CheckCircleFilled$1 = RefIcon$
|
|
1491
|
+
var CheckCircleFilled$1 = RefIcon$4;
|
|
1492
1492
|
|
|
1493
1493
|
// This icon file is generated automatically.
|
|
1494
1494
|
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" };
|
|
@@ -1502,11 +1502,29 @@ var CloseOutlined = function CloseOutlined(props, ref) {
|
|
|
1502
1502
|
};
|
|
1503
1503
|
|
|
1504
1504
|
/** */
|
|
1505
|
-
var RefIcon$
|
|
1505
|
+
var RefIcon$3 = /*#__PURE__*/React.forwardRef(CloseOutlined);
|
|
1506
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1507
|
+
RefIcon$3.displayName = 'CloseOutlined';
|
|
1508
|
+
}
|
|
1509
|
+
var CloseOutlined$1 = RefIcon$3;
|
|
1510
|
+
|
|
1511
|
+
// This icon file is generated automatically.
|
|
1512
|
+
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" };
|
|
1513
|
+
var CreditCardOutlinedSvg = CreditCardOutlined$2;
|
|
1514
|
+
|
|
1515
|
+
var CreditCardOutlined = function CreditCardOutlined(props, ref) {
|
|
1516
|
+
return /*#__PURE__*/React.createElement(AntdIcon, _extends({}, props, {
|
|
1517
|
+
ref: ref,
|
|
1518
|
+
icon: CreditCardOutlinedSvg
|
|
1519
|
+
}));
|
|
1520
|
+
};
|
|
1521
|
+
|
|
1522
|
+
/** */
|
|
1523
|
+
var RefIcon$2 = /*#__PURE__*/React.forwardRef(CreditCardOutlined);
|
|
1506
1524
|
if (process.env.NODE_ENV !== 'production') {
|
|
1507
|
-
RefIcon$2.displayName = '
|
|
1525
|
+
RefIcon$2.displayName = 'CreditCardOutlined';
|
|
1508
1526
|
}
|
|
1509
|
-
var
|
|
1527
|
+
var CreditCardOutlined$1 = RefIcon$2;
|
|
1510
1528
|
|
|
1511
1529
|
// This icon file is generated automatically.
|
|
1512
1530
|
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" };
|
|
@@ -1551,7 +1569,7 @@ var BrandContext = createContext({
|
|
|
1551
1569
|
topNavImageUrl: DEFAULT_TOP_NAV_IMAGE_URL,
|
|
1552
1570
|
});
|
|
1553
1571
|
|
|
1554
|
-
var MUTATION$9 = "{\n entityBranding {\n accentColor\n brandColor\n topNavImageUrl\n }\n }";
|
|
1572
|
+
var MUTATION$9 = "\n query entityBranding {\n entityBranding {\n accentColor\n brandColor\n topNavImageUrl\n }\n }\n";
|
|
1555
1573
|
var getBranding = function (_a) {
|
|
1556
1574
|
var token = _a.token, apiHost = _a.apiHost;
|
|
1557
1575
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -1583,30 +1601,8 @@ var BunnyContext = createContext({});
|
|
|
1583
1601
|
var extraQueryClient = new QueryClient();
|
|
1584
1602
|
// Every component shares similar props and functionality, which this wrapper handles.
|
|
1585
1603
|
function BunnyProvider(_a) {
|
|
1586
|
-
var accountId = _a.accountId, children = _a.children, _b = _a.darkMode, darkMode = _b === void 0 ? false : _b,
|
|
1604
|
+
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;
|
|
1587
1605
|
var graphQLClient = createGraphQLClient(token, apiHost || "");
|
|
1588
|
-
var isMobile = useIsMobile();
|
|
1589
|
-
var _c = useState(undefined), branding = _c[0], setBranding = _c[1];
|
|
1590
|
-
// ====== START - Copied straight from PageContainer.tsx ========
|
|
1591
|
-
var entityBranding = useMemo(function () {
|
|
1592
|
-
var _a;
|
|
1593
|
-
// This is to determine if the secondary color should be white or black
|
|
1594
|
-
var brandColor = (branding === null || branding === void 0 ? void 0 : branding.brandColor)
|
|
1595
|
-
? "#" + ((_a = branding === null || branding === void 0 ? void 0 : branding.brandColor) === null || _a === void 0 ? void 0 : _a.toString(16))
|
|
1596
|
-
: DEFAULT_BRAND_COLOR;
|
|
1597
|
-
var secondaryColor = DEFAULT_SECONDARY_COLOR;
|
|
1598
|
-
if (!isMobile && isColorTooDark(branding === null || branding === void 0 ? void 0 : branding.accentColor))
|
|
1599
|
-
secondaryColor = "#ffffff";
|
|
1600
|
-
var topNavImageUrl = (branding === null || branding === void 0 ? void 0 : branding.topNavImageUrl) || DEFAULT_TOP_NAV_IMAGE_URL;
|
|
1601
|
-
var accentColor = (branding === null || branding === void 0 ? void 0 : branding.accentColor) || DEFAULT_ACCENT_COLOR;
|
|
1602
|
-
return {
|
|
1603
|
-
accentColor: accentColor,
|
|
1604
|
-
brandColor: brandColor,
|
|
1605
|
-
secondaryColor: secondaryColor,
|
|
1606
|
-
topNavImageUrl: topNavImageUrl,
|
|
1607
|
-
};
|
|
1608
|
-
}, [branding, isMobile]);
|
|
1609
|
-
// ============================= END ==============================
|
|
1610
1606
|
useEffect(function () {
|
|
1611
1607
|
var script = document.createElement("script");
|
|
1612
1608
|
script.src = "https://js.finix.com/v/1/0/6/finix.js";
|
|
@@ -1620,48 +1616,39 @@ function BunnyProvider(_a) {
|
|
|
1620
1616
|
accountId: accountId,
|
|
1621
1617
|
darkMode: darkMode,
|
|
1622
1618
|
graphQLClient: graphQLClient,
|
|
1623
|
-
onErrorNavigate: onErrorNavigate,
|
|
1624
1619
|
apiHost: apiHost,
|
|
1625
1620
|
token: token,
|
|
1626
1621
|
window: window,
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
? theme.darkAlgorithm
|
|
1630
|
-
: theme.defaultAlgorithm,
|
|
1631
|
-
token: {
|
|
1632
|
-
borderRadius: 4,
|
|
1633
|
-
colorPrimary: entityBranding.brandColor,
|
|
1634
|
-
colorLink: entityBranding.brandColor,
|
|
1635
|
-
colorLinkActive: entityBranding.brandColor,
|
|
1636
|
-
colorLinkHover: entityBranding.brandColor,
|
|
1637
|
-
fontFamily: MARK_PRO,
|
|
1638
|
-
colorBorder: INPUT_BORDER_COLOR,
|
|
1639
|
-
},
|
|
1640
|
-
components: {
|
|
1641
|
-
Drawer: {
|
|
1642
|
-
colorBgElevated: darkMode
|
|
1643
|
-
? "var(--row-background-dark)"
|
|
1644
|
-
: SLATE_50,
|
|
1645
|
-
},
|
|
1646
|
-
Divider: {
|
|
1647
|
-
colorSplit: darkMode ? SLATE_400 : SLATE_200,
|
|
1648
|
-
},
|
|
1649
|
-
},
|
|
1650
|
-
} }, { children: jsx(SecondaryWrapper, __assign({ setBranding: setBranding }, { children: children })) })) })) }) }))] })));
|
|
1622
|
+
onTokenExpired: onTokenExpired,
|
|
1623
|
+
} }, { children: [jsx("div", __assign({ style: { position: "fixed", left: -2000000000 } }, { children: "test" })), jsx(QueryClientProvider, __assign({ client: queryClient || extraQueryClient }, { children: jsx(ContextualWrapper, __assign({ darkMode: darkMode }, { children: children })) }))] })));
|
|
1651
1624
|
}
|
|
1652
|
-
function
|
|
1653
|
-
var children = _a.children,
|
|
1625
|
+
function ContextualWrapper(_a) {
|
|
1626
|
+
var children = _a.children, darkMode = _a.darkMode;
|
|
1654
1627
|
var _b = useState(false), interFontLoaded = _b[0], setInterFontLoaded = _b[1];
|
|
1655
1628
|
var _c = useContext(BunnyContext), apiHost = _c.apiHost, token = _c.token;
|
|
1656
|
-
var
|
|
1629
|
+
var branding = useQuery({
|
|
1657
1630
|
queryKey: QueryKeyFactory.default.brandingKey,
|
|
1658
1631
|
queryFn: function () { return getBranding({ token: token, apiHost: apiHost }); },
|
|
1659
1632
|
}).data;
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1633
|
+
var isMobile = useIsMobile();
|
|
1634
|
+
var entityBranding = useMemo(function () {
|
|
1635
|
+
var _a;
|
|
1636
|
+
// This is to determine if the secondary color should be white or black
|
|
1637
|
+
var brandColor = (branding === null || branding === void 0 ? void 0 : branding.brandColor)
|
|
1638
|
+
? "#" + ((_a = branding === null || branding === void 0 ? void 0 : branding.brandColor) === null || _a === void 0 ? void 0 : _a.toString(16))
|
|
1639
|
+
: DEFAULT_BRAND_COLOR;
|
|
1640
|
+
var secondaryColor = DEFAULT_SECONDARY_COLOR;
|
|
1641
|
+
if (!isMobile && isColorTooDark(branding === null || branding === void 0 ? void 0 : branding.accentColor))
|
|
1642
|
+
secondaryColor = "#ffffff";
|
|
1643
|
+
var topNavImageUrl = (branding === null || branding === void 0 ? void 0 : branding.topNavImageUrl) || DEFAULT_TOP_NAV_IMAGE_URL;
|
|
1644
|
+
var accentColor = (branding === null || branding === void 0 ? void 0 : branding.accentColor) || DEFAULT_ACCENT_COLOR;
|
|
1645
|
+
return {
|
|
1646
|
+
accentColor: accentColor,
|
|
1647
|
+
brandColor: brandColor,
|
|
1648
|
+
secondaryColor: secondaryColor,
|
|
1649
|
+
topNavImageUrl: topNavImageUrl,
|
|
1650
|
+
};
|
|
1651
|
+
}, [branding, isMobile]);
|
|
1665
1652
|
// Check if Inter font is loaded
|
|
1666
1653
|
useEffect(function () {
|
|
1667
1654
|
document.fonts.ready.then(function () {
|
|
@@ -1670,7 +1657,28 @@ function SecondaryWrapper(_a) {
|
|
|
1670
1657
|
}, []);
|
|
1671
1658
|
if (!interFontLoaded)
|
|
1672
1659
|
return null;
|
|
1673
|
-
return jsx(
|
|
1660
|
+
return (jsx(RecoilRoot, { children: jsx(BrandContext.Provider, __assign({ value: entityBranding }, { children: jsx(ConfigProvider, __assign({ theme: {
|
|
1661
|
+
algorithm: darkMode ? theme.darkAlgorithm : theme.defaultAlgorithm,
|
|
1662
|
+
token: {
|
|
1663
|
+
borderRadius: 4,
|
|
1664
|
+
colorPrimary: entityBranding.brandColor,
|
|
1665
|
+
colorLink: entityBranding.brandColor,
|
|
1666
|
+
colorLinkActive: entityBranding.brandColor,
|
|
1667
|
+
colorLinkHover: entityBranding.brandColor,
|
|
1668
|
+
fontFamily: MARK_PRO,
|
|
1669
|
+
colorBorder: INPUT_BORDER_COLOR,
|
|
1670
|
+
},
|
|
1671
|
+
components: {
|
|
1672
|
+
Drawer: {
|
|
1673
|
+
colorBgElevated: darkMode
|
|
1674
|
+
? "var(--row-background-dark)"
|
|
1675
|
+
: SLATE_50,
|
|
1676
|
+
},
|
|
1677
|
+
Divider: {
|
|
1678
|
+
colorSplit: darkMode ? SLATE_400 : SLATE_200,
|
|
1679
|
+
},
|
|
1680
|
+
},
|
|
1681
|
+
} }, { children: children })) })) }));
|
|
1674
1682
|
}
|
|
1675
1683
|
|
|
1676
1684
|
var useAjax = function (onError) {
|
|
@@ -1740,27 +1748,39 @@ var InvoiceQuoteView = function (_a) {
|
|
|
1740
1748
|
var children = _a.children, formattedInvoice = _a.formattedInvoice, html = _a.html, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick, onDownloadError = _a.onDownloadError;
|
|
1741
1749
|
var downloadFile = useDownloadFile(formattedInvoice === null || formattedInvoice === void 0 ? void 0 : formattedInvoice.id, onDownloadError);
|
|
1742
1750
|
var secondaryColor = useContext(BrandContext).secondaryColor;
|
|
1743
|
-
var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
|
|
1751
|
+
var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
|
|
1752
|
+
var _c = useContext(InvoiceQuoteContext), shadow = _c.shadow, hideDownloadButton = _c.hideDownloadButton;
|
|
1744
1753
|
var isMobile = useIsMobile();
|
|
1745
|
-
|
|
1754
|
+
var buttonsVisible = formattedInvoice && (!hideDownloadButton || onBackButtonClick);
|
|
1755
|
+
return (jsxs("div", __assign({ className: "flex flex-col w-full grow ".concat(isMobile ? "overflow-hidden" : "") }, { children: [buttonsVisible ? (jsxs("div", __assign({ className: "flex justify-between items-center pb-4 ".concat(isMobile ? "shadow-padding-x" : ""), id: "acceptance" }, { children: [jsx("div", { children: onBackButtonClick ? (jsx(Button, __assign({ className: "text-xs pl-0", onClick: onBackButtonClick, style: {
|
|
1746
1756
|
color: secondaryColor,
|
|
1747
|
-
}, type: "link" }, { children: backButtonName || "Back" }))) : null }), jsx(Button, __assign({ icon: jsx(DownloadOutlined$1, {}), onClick: function () {
|
|
1757
|
+
}, type: "link" }, { children: backButtonName || "Back" }))) : null }), !hideDownloadButton ? (jsx(Button, __assign({ icon: jsx(DownloadOutlined$1, {}), onClick: function () {
|
|
1748
1758
|
return downloadFile(apiHost + "/api/pdf/invoice/" + formattedInvoice.id, token);
|
|
1749
|
-
} }, { children: "Download" }))] }))) : null, isMobile ? (jsxs(MarkupContainer, __assign({ className: "flex flex-col gap-4 grow w-full shadow-padding-xb overflow-auto" }, { children: [jsx(Markup, { content: html }), children] }))) : (jsxs(MarkupContainer, __assign({ className: "flex flex-col gap-4 p-2 w-full bg-white shadow-md rounded-md", style: {
|
|
1759
|
+
} }, { children: "Download" }))) : null] }))) : null, isMobile ? (jsxs(MarkupContainer, __assign({ className: "flex flex-col gap-4 grow w-full shadow-padding-xb overflow-auto" }, { children: [jsx(Markup, { content: html }), children] }))) : (jsxs(MarkupContainer, __assign({ className: "flex flex-col gap-4 p-2 w-full bg-white ".concat(shadow ? shadow : "shadow-md", " rounded-md"), style: {
|
|
1750
1760
|
minWidth: "750px",
|
|
1751
1761
|
} }, { children: [jsx(Markup, { content: html }), children] })))] })));
|
|
1752
1762
|
};
|
|
1753
1763
|
var templateObject_1$8;
|
|
1754
1764
|
|
|
1765
|
+
var quoteMetaDescription = function (vendorName) {
|
|
1766
|
+
return "View this quote on the ".concat(vendorName, " customer portal. Powered by Bunny");
|
|
1767
|
+
};
|
|
1768
|
+
var quoteMetaTitle = function (_a) {
|
|
1769
|
+
var documentName = _a.documentName, vendorName = _a.vendorName;
|
|
1770
|
+
return vendorName + " " + documentName;
|
|
1771
|
+
};
|
|
1772
|
+
|
|
1773
|
+
var PaymentContext = createContext({});
|
|
1774
|
+
|
|
1755
1775
|
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}";
|
|
1756
|
-
var usePaymentMethod = function (graphQLClient) {
|
|
1776
|
+
var usePaymentMethod = function (graphQLClient, accountId) {
|
|
1757
1777
|
var result = useQuery({
|
|
1758
1778
|
queryKey: QueryKeyFactory.default.accountPaymentMethodKey,
|
|
1759
1779
|
queryFn: function () {
|
|
1760
1780
|
return graphQLClient
|
|
1761
1781
|
.request(paymentMethodsQuery, {
|
|
1762
1782
|
first: 1,
|
|
1763
|
-
filter: "disabled is false",
|
|
1783
|
+
filter: "disabled is false".concat(accountId ? " and accountId is ".concat(accountId) : ""),
|
|
1764
1784
|
})
|
|
1765
1785
|
.then(function (data) {
|
|
1766
1786
|
var _a, _b;
|
|
@@ -1773,40 +1793,151 @@ var usePaymentMethod = function (graphQLClient) {
|
|
|
1773
1793
|
return result;
|
|
1774
1794
|
};
|
|
1775
1795
|
|
|
1776
|
-
var
|
|
1777
|
-
|
|
1796
|
+
var usePlugins = function (_a) {
|
|
1797
|
+
var entityId = _a.entityId, apiHost = _a.apiHost, token = _a.token;
|
|
1798
|
+
var response = useQuery({
|
|
1799
|
+
queryKey: QueryKeyFactory.default.pluginsKey,
|
|
1800
|
+
queryFn: function () {
|
|
1801
|
+
var plugins = getPlugins({
|
|
1802
|
+
entityId: entityId,
|
|
1803
|
+
token: token,
|
|
1804
|
+
apiHost: apiHost,
|
|
1805
|
+
});
|
|
1806
|
+
return plugins;
|
|
1807
|
+
},
|
|
1808
|
+
enabled: Boolean(entityId),
|
|
1809
|
+
});
|
|
1810
|
+
return response;
|
|
1778
1811
|
};
|
|
1779
1812
|
|
|
1780
|
-
var
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1813
|
+
var filterPaymentPlugins = function (plugins) {
|
|
1814
|
+
return plugins === null || plugins === void 0 ? void 0 : plugins.filter(function (plugin) {
|
|
1815
|
+
var _a, _b, _c, _d;
|
|
1816
|
+
return ((_a = plugin.type) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === "payment" &&
|
|
1817
|
+
((_b = plugin.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === "valid" &&
|
|
1818
|
+
((_d = (_c = plugin.components) === null || _c === void 0 ? void 0 : _c.frontend) === null || _d === void 0 ? void 0 : _d.length);
|
|
1819
|
+
});
|
|
1820
|
+
};
|
|
1821
|
+
var usePaymentPlugins = function (_a) {
|
|
1822
|
+
var entityId = _a.entityId, apiHost = _a.apiHost, token = _a.token;
|
|
1823
|
+
var _b = usePlugins({
|
|
1824
|
+
entityId: entityId,
|
|
1825
|
+
apiHost: apiHost,
|
|
1826
|
+
token: token,
|
|
1827
|
+
}), plugins = _b.data, isFetched = _b.isFetched;
|
|
1828
|
+
var paymentPlugins = filterPaymentPlugins(Array.isArray(plugins) ? plugins : []);
|
|
1829
|
+
var paymentMethodAllowedPlugins = paymentPlugins === null || paymentPlugins === void 0 ? void 0 : paymentPlugins.filter(function (plugin) {
|
|
1830
|
+
var _a, _b;
|
|
1831
|
+
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"); });
|
|
1832
|
+
});
|
|
1833
|
+
return {
|
|
1834
|
+
paymentPlugins: paymentPlugins,
|
|
1835
|
+
paymentMethodAllowedPlugins: paymentMethodAllowedPlugins,
|
|
1836
|
+
isFetched: isFetched,
|
|
1837
|
+
};
|
|
1790
1838
|
};
|
|
1791
|
-
var PaymentOptionContainer = styled.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) {
|
|
1792
|
-
var $brandColor = _a.$brandColor, $selected = _a.$selected;
|
|
1793
|
-
return $selected &&
|
|
1794
|
-
"\n border-color: ".concat($brandColor, ";\n ");
|
|
1795
|
-
}, function (_a) {
|
|
1796
|
-
var $brandColor = _a.$brandColor;
|
|
1797
|
-
return $brandColor;
|
|
1798
|
-
});
|
|
1799
|
-
var templateObject_1$7;
|
|
1800
1839
|
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
var
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1840
|
+
// Simulated payment creation and confirmation
|
|
1841
|
+
var confirmPayment = function (_a) {
|
|
1842
|
+
var amount = _a.amount, currency = _a.currency;
|
|
1843
|
+
return { token: "DemoPayTestToken", amount: amount, currency: currency };
|
|
1844
|
+
};
|
|
1845
|
+
var DIGIT_REGEX = /\d/;
|
|
1846
|
+
var isDigit = function (char) { return DIGIT_REGEX.test(char); };
|
|
1847
|
+
var isDeletion = function (char) { return [8, 46].includes(char); }; // Backspace or Delete
|
|
1848
|
+
var isNavigation = function (char) { return [9, 37, 38, 39, 40].includes(char); }; // Tab, Arrows
|
|
1849
|
+
var isModifier = function (char) { return [16, 17, 18].includes(char); }; // Shift, Ctrl, Alt
|
|
1850
|
+
var isValidKey = function (code) {
|
|
1851
|
+
return isDeletion(code) || isNavigation(code) || isModifier(code);
|
|
1852
|
+
};
|
|
1853
|
+
var isValidExpiry = function (expiry) {
|
|
1854
|
+
var month = parseInt(expiry.substring(0, 2), 10);
|
|
1855
|
+
var year = parseInt(expiry.substring(2, 4), 10) + 2000;
|
|
1856
|
+
if (isNaN(month) || isNaN(year))
|
|
1857
|
+
return false;
|
|
1858
|
+
if (month < 1 || month > 12)
|
|
1859
|
+
return false;
|
|
1860
|
+
return true;
|
|
1861
|
+
};
|
|
1862
|
+
var isCardExpired = function (expiry) {
|
|
1863
|
+
var month = parseInt(expiry.substring(0, 2), 10);
|
|
1864
|
+
var year = parseInt(expiry.substring(2, 4), 10) + 2000;
|
|
1865
|
+
var expiryDate = new Date(year, month, 1);
|
|
1866
|
+
return expiryDate < new Date();
|
|
1867
|
+
};
|
|
1868
|
+
var formatCardExpiry = function (cardExpiry) {
|
|
1869
|
+
if (cardExpiry.length <= 2)
|
|
1870
|
+
return cardExpiry;
|
|
1871
|
+
return cardExpiry.substring(0, 2) + "/" + cardExpiry.substring(2);
|
|
1872
|
+
};
|
|
1873
|
+
// removes spaces from a credit card number
|
|
1874
|
+
var unformatCardNumber = function (cardNumber) {
|
|
1875
|
+
var cardNumberArray = cardNumber.split("");
|
|
1876
|
+
var unformattedCardNumberArray = cardNumberArray.filter(function (character) { return character !== " "; });
|
|
1877
|
+
return unformattedCardNumberArray.join("");
|
|
1809
1878
|
};
|
|
1879
|
+
var storePayment = function (options, plugin, apiHost, accountId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1880
|
+
var testCreditCardNumber, testCreditCardCvc, testCreditCardExpirationDate, token, response;
|
|
1881
|
+
return __generator(this, function (_a) {
|
|
1882
|
+
switch (_a.label) {
|
|
1883
|
+
case 0:
|
|
1884
|
+
testCreditCardNumber = options.testCreditCardNumber, testCreditCardCvc = options.testCreditCardCvc, testCreditCardExpirationDate = options.testCreditCardExpirationDate, token = options.token;
|
|
1885
|
+
return [4 /*yield*/, invokePlugin({
|
|
1886
|
+
method: "store_payment_method",
|
|
1887
|
+
plugin: plugin,
|
|
1888
|
+
payload: {
|
|
1889
|
+
test_credit_card_number: testCreditCardNumber,
|
|
1890
|
+
test_credit_card_cvc: testCreditCardCvc,
|
|
1891
|
+
test_credit_card_expiration_date: testCreditCardExpirationDate,
|
|
1892
|
+
account_id: accountId,
|
|
1893
|
+
},
|
|
1894
|
+
token: token,
|
|
1895
|
+
apiHost: apiHost,
|
|
1896
|
+
})];
|
|
1897
|
+
case 1:
|
|
1898
|
+
response = _a.sent();
|
|
1899
|
+
if ((response === null || response === void 0 ? void 0 : response.status) !== "success")
|
|
1900
|
+
throw new Error(response === null || response === void 0 ? void 0 : response.message);
|
|
1901
|
+
return [2 /*return*/, response];
|
|
1902
|
+
}
|
|
1903
|
+
});
|
|
1904
|
+
}); };
|
|
1905
|
+
|
|
1906
|
+
function usePay$1(_a) {
|
|
1907
|
+
var _this = this;
|
|
1908
|
+
var onPaymentSuccess = _a.onPaymentSuccess, onPaymentError = _a.onPaymentError, quote = _a.quote, invoice = _a.invoice;
|
|
1909
|
+
var pay = function (_a) {
|
|
1910
|
+
var plugin = _a.plugin, savePaymentMethod = _a.savePaymentMethod;
|
|
1911
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
1912
|
+
var amountDue, currencyId, response;
|
|
1913
|
+
return __generator(this, function (_b) {
|
|
1914
|
+
amountDue = quote ? getQuoteAmountDue(quote) : invoice === null || invoice === void 0 ? void 0 : invoice.amountDue;
|
|
1915
|
+
currencyId = (quote === null || quote === void 0 ? void 0 : quote.currencyId) || (invoice === null || invoice === void 0 ? void 0 : invoice.currency);
|
|
1916
|
+
if (!amountDue || !currencyId) {
|
|
1917
|
+
throw new Error("No amount or currencyId");
|
|
1918
|
+
}
|
|
1919
|
+
try {
|
|
1920
|
+
response = confirmPayment({
|
|
1921
|
+
amount: amountDue,
|
|
1922
|
+
currency: currencyId,
|
|
1923
|
+
});
|
|
1924
|
+
onPaymentSuccess({
|
|
1925
|
+
pluginPaymentResponse: {
|
|
1926
|
+
plugin: plugin,
|
|
1927
|
+
token: response.token,
|
|
1928
|
+
savePaymentMethod: savePaymentMethod,
|
|
1929
|
+
},
|
|
1930
|
+
});
|
|
1931
|
+
}
|
|
1932
|
+
catch (error) {
|
|
1933
|
+
onPaymentError === null || onPaymentError === void 0 ? void 0 : onPaymentError(error);
|
|
1934
|
+
}
|
|
1935
|
+
return [2 /*return*/];
|
|
1936
|
+
});
|
|
1937
|
+
});
|
|
1938
|
+
};
|
|
1939
|
+
return { pay: pay };
|
|
1940
|
+
}
|
|
1810
1941
|
|
|
1811
1942
|
var createPaymentMethod = function (_a) {
|
|
1812
1943
|
var paymentMethodId = _a.paymentMethodId, plugin = _a.plugin, token = _a.token, apiHost = _a.apiHost, accountId = _a.accountId;
|
|
@@ -1845,7 +1976,7 @@ var createSetupIntent = function (plugin, token, apiHost, accountId) {
|
|
|
1845
1976
|
});
|
|
1846
1977
|
};
|
|
1847
1978
|
var createPaymentIntent = function (_a) {
|
|
1848
|
-
var payable = _a.payable, savePaymentMethod = _a.savePaymentMethod, memo = _a.memo, plugin = _a.plugin, token = _a.token, apiHost = _a.apiHost
|
|
1979
|
+
var payable = _a.payable, savePaymentMethod = _a.savePaymentMethod, memo = _a.memo, plugin = _a.plugin, token = _a.token, apiHost = _a.apiHost;
|
|
1849
1980
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
1850
1981
|
var payload, response;
|
|
1851
1982
|
return __generator(this, function (_b) {
|
|
@@ -1855,7 +1986,6 @@ var createPaymentIntent = function (_a) {
|
|
|
1855
1986
|
payable_id: payable.payableId,
|
|
1856
1987
|
save_payment_method: savePaymentMethod,
|
|
1857
1988
|
memo: memo,
|
|
1858
|
-
account_id: accountId,
|
|
1859
1989
|
};
|
|
1860
1990
|
return [4 /*yield*/, invokePlugin({
|
|
1861
1991
|
plugin: plugin,
|
|
@@ -1873,21 +2003,37 @@ var createPaymentIntent = function (_a) {
|
|
|
1873
2003
|
});
|
|
1874
2004
|
});
|
|
1875
2005
|
};
|
|
1876
|
-
var fetchStripeKey = function (plugin, token, apiHost, accountId) {
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
2006
|
+
var fetchStripeKey = function (plugin, token, apiHost, accountId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2007
|
+
var response;
|
|
2008
|
+
return __generator(this, function (_a) {
|
|
2009
|
+
switch (_a.label) {
|
|
2010
|
+
case 0: return [4 /*yield*/, invokePlugin({
|
|
2011
|
+
plugin: plugin,
|
|
2012
|
+
method: "retrieve_config",
|
|
2013
|
+
token: token,
|
|
2014
|
+
apiHost: apiHost,
|
|
2015
|
+
payload: {
|
|
2016
|
+
account_id: accountId,
|
|
2017
|
+
},
|
|
2018
|
+
})];
|
|
2019
|
+
case 1:
|
|
2020
|
+
response = _a.sent();
|
|
2021
|
+
return [2 /*return*/, response];
|
|
2022
|
+
}
|
|
1885
2023
|
});
|
|
1886
|
-
};
|
|
2024
|
+
}); };
|
|
1887
2025
|
loadStripe.setLoadParameters({ advancedFraudSignals: false });
|
|
1888
2026
|
var useStripePlugin = function (plugin, token, apiHost, accountId) {
|
|
1889
2027
|
var _a = useState(null), stripe = _a[0], setStripe = _a[1];
|
|
1890
2028
|
var showErrorNotification = useErrorNotification();
|
|
2029
|
+
var options = {
|
|
2030
|
+
mode: "setup",
|
|
2031
|
+
// TODO: Fetch currency from the entity/account
|
|
2032
|
+
currency: "usd",
|
|
2033
|
+
setupFutureUsage: "off_session",
|
|
2034
|
+
};
|
|
2035
|
+
if (!plugin)
|
|
2036
|
+
return { stripe: null, options: options };
|
|
1891
2037
|
useEffect(function () {
|
|
1892
2038
|
fetchStripeKey(plugin, token, apiHost || "", accountId)
|
|
1893
2039
|
.then(function (_a) {
|
|
@@ -1900,293 +2046,253 @@ var useStripePlugin = function (plugin, token, apiHost, accountId) {
|
|
|
1900
2046
|
});
|
|
1901
2047
|
// eslint-disable-next-line
|
|
1902
2048
|
}, [plugin, token]);
|
|
1903
|
-
return stripe;
|
|
1904
|
-
};
|
|
1905
|
-
|
|
1906
|
-
var PaymentContext = createContext({});
|
|
1907
|
-
|
|
1908
|
-
var CheckoutFooter = function (_a) {
|
|
1909
|
-
var amountDue = _a.amountDue, currencyId = _a.currencyId, isSaving = _a.isSaving, onPaymentSubmit = _a.onPaymentSubmit, onlySavePaymentMethod = _a.onlySavePaymentMethod, noPadding = _a.noPadding;
|
|
1910
|
-
useContext(BunnyContext).window;
|
|
1911
|
-
var isMobile = useIsMobile();
|
|
1912
|
-
var displayPayButtonNameAnyways = useContext(PaymentContext).displayPayButtonNameAnyways;
|
|
1913
|
-
var buttonName = function () {
|
|
1914
|
-
return onlySavePaymentMethod && !displayPayButtonNameAnyways
|
|
1915
|
-
? isSaving
|
|
1916
|
-
? "Saving"
|
|
1917
|
-
: "Save"
|
|
1918
|
-
: isSaving
|
|
1919
|
-
? "Paying"
|
|
1920
|
-
: "Pay";
|
|
1921
|
-
};
|
|
1922
|
-
return (jsx("div", __assign({ className: "flex justify-end gap-2 ".concat(noPadding ? "" : "pt-6") }, { children: jsx(Button, __assign({ className: "w-full", disabled: isSaving, onClick: onPaymentSubmit, size: isMobile ? "large" : "middle", type: "primary" }, { children: "".concat(buttonName()).concat(amountDue && currencyId
|
|
1923
|
-
? " ".concat(formatCurrency(amountDue, currencyId))
|
|
1924
|
-
: "") })) })));
|
|
2049
|
+
return { stripe: stripe, options: options };
|
|
1925
2050
|
};
|
|
1926
2051
|
|
|
1927
|
-
|
|
1928
|
-
var
|
|
2052
|
+
function usePay(_a) {
|
|
2053
|
+
var _this = this;
|
|
2054
|
+
var onPaymentSuccess = _a.onPaymentSuccess, onPaymentError = _a.onPaymentError, quote = _a.quote, invoice = _a.invoice;
|
|
1929
2055
|
// Hooks
|
|
1930
2056
|
var elements = useElements();
|
|
1931
2057
|
var stripe = useStripe();
|
|
1932
|
-
var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
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
|
-
|
|
2058
|
+
var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
|
|
2059
|
+
var pay = function (_a) {
|
|
2060
|
+
var plugin = _a.plugin;
|
|
2061
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
2062
|
+
var payable, submitError, paymentIntent, clientSecret, response, paymentIntentId, error_1;
|
|
2063
|
+
var _b;
|
|
2064
|
+
return __generator(this, function (_c) {
|
|
2065
|
+
switch (_c.label) {
|
|
2066
|
+
case 0:
|
|
2067
|
+
payable = (quote || invoice);
|
|
2068
|
+
_c.label = 1;
|
|
2069
|
+
case 1:
|
|
2070
|
+
_c.trys.push([1, 5, , 6]);
|
|
2071
|
+
if (!stripe)
|
|
2072
|
+
throw new Error("Form is not ready");
|
|
2073
|
+
if (!elements)
|
|
2074
|
+
throw new Error("Elements couldn't be retrieved");
|
|
2075
|
+
return [4 /*yield*/, elements.submit()];
|
|
2076
|
+
case 2:
|
|
2077
|
+
submitError = (_c.sent()).error;
|
|
2078
|
+
if (submitError)
|
|
2079
|
+
throw new Error(submitError.message);
|
|
2080
|
+
return [4 /*yield*/, createPaymentIntent({
|
|
2081
|
+
payable: payable,
|
|
2082
|
+
savePaymentMethod: true,
|
|
2083
|
+
plugin: plugin,
|
|
2084
|
+
token: token,
|
|
2085
|
+
apiHost: apiHost || "",
|
|
2086
|
+
})];
|
|
2087
|
+
case 3:
|
|
2088
|
+
paymentIntent = _c.sent();
|
|
2089
|
+
clientSecret = paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.client_secret;
|
|
2090
|
+
return [4 /*yield*/, stripe.confirmPayment({
|
|
2091
|
+
elements: elements,
|
|
2092
|
+
clientSecret: clientSecret,
|
|
2093
|
+
redirect: "if_required",
|
|
2094
|
+
confirmParams: {
|
|
2095
|
+
return_url: window.location.href,
|
|
2096
|
+
},
|
|
2097
|
+
})];
|
|
2098
|
+
case 4:
|
|
2099
|
+
response = _c.sent();
|
|
2100
|
+
// See https://stripe.com/docs/payments/save-during-payment?platform=web#web-submit-payment
|
|
2101
|
+
if (response.error)
|
|
2102
|
+
throw new Error(response.error.message);
|
|
2103
|
+
paymentIntentId = (_b = response.paymentIntent) === null || _b === void 0 ? void 0 : _b.id;
|
|
2104
|
+
if (!paymentIntentId)
|
|
2105
|
+
throw new Error("Payment intent couldn't be retrieved");
|
|
2106
|
+
onPaymentSuccess === null || onPaymentSuccess === void 0 ? void 0 : onPaymentSuccess({
|
|
2107
|
+
pluginPaymentResponse: {
|
|
2108
|
+
plugin: plugin,
|
|
2109
|
+
token: paymentIntentId,
|
|
2110
|
+
savePaymentMethod: true,
|
|
2111
|
+
},
|
|
2112
|
+
});
|
|
2113
|
+
return [3 /*break*/, 6];
|
|
2114
|
+
case 5:
|
|
2115
|
+
error_1 = _c.sent();
|
|
2116
|
+
onPaymentError === null || onPaymentError === void 0 ? void 0 : onPaymentError(error_1);
|
|
2117
|
+
return [3 /*break*/, 6];
|
|
2118
|
+
case 6: return [2 /*return*/];
|
|
2119
|
+
}
|
|
2120
|
+
});
|
|
1994
2121
|
});
|
|
1995
|
-
}); };
|
|
1996
|
-
var options = {
|
|
1997
|
-
// defaultValues: {
|
|
1998
|
-
// billingDetails: {
|
|
1999
|
-
// email: currentUser.email,
|
|
2000
|
-
// name: currentUser.name,
|
|
2001
|
-
// phone: currentUser.phone,
|
|
2002
|
-
// },
|
|
2003
|
-
// },
|
|
2004
|
-
layout: { type: "accordion" },
|
|
2005
2122
|
};
|
|
2006
|
-
return
|
|
2007
|
-
}
|
|
2123
|
+
return { pay: pay };
|
|
2124
|
+
}
|
|
2008
2125
|
|
|
2009
|
-
var
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
var
|
|
2013
|
-
var
|
|
2014
|
-
var
|
|
2015
|
-
var
|
|
2016
|
-
//
|
|
2017
|
-
var
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2126
|
+
var showErrorNotification$1 = useErrorNotification();
|
|
2127
|
+
var ActualCheckoutFooter = function (_a) {
|
|
2128
|
+
var quote = _a.quote, invoice = _a.invoice, onPaymentSuccess = _a.onPaymentSuccess, noPadding = _a.noPadding, plugin = _a.plugin;
|
|
2129
|
+
var isMobile = useIsMobile();
|
|
2130
|
+
var _b = useState(false), isPaying = _b[0], setIsPaying = _b[1];
|
|
2131
|
+
var amountDue = quote ? getQuoteAmountDue(quote) : invoice === null || invoice === void 0 ? void 0 : invoice.amountDue;
|
|
2132
|
+
var currencyId = (quote === null || quote === void 0 ? void 0 : quote.currencyId) || (invoice === null || invoice === void 0 ? void 0 : invoice.currency);
|
|
2133
|
+
// Payment hooks
|
|
2134
|
+
var payDemoPay = usePay$1({
|
|
2135
|
+
onPaymentSuccess: function (response) {
|
|
2136
|
+
onPaymentSuccess(response);
|
|
2137
|
+
},
|
|
2138
|
+
onPaymentError: function (error) {
|
|
2139
|
+
setIsPaying(false);
|
|
2140
|
+
showErrorNotification$1(error);
|
|
2141
|
+
},
|
|
2142
|
+
quote: quote,
|
|
2143
|
+
invoice: invoice,
|
|
2144
|
+
}).pay;
|
|
2145
|
+
var payStripe = usePay({
|
|
2146
|
+
onPaymentSuccess: function (response) {
|
|
2147
|
+
onPaymentSuccess(response);
|
|
2148
|
+
},
|
|
2149
|
+
onPaymentError: function (error) {
|
|
2150
|
+
setIsPaying(false);
|
|
2151
|
+
showErrorNotification$1(error);
|
|
2152
|
+
},
|
|
2153
|
+
quote: quote,
|
|
2154
|
+
invoice: invoice,
|
|
2155
|
+
}).pay;
|
|
2156
|
+
var handlePaymentSubmit = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
2157
|
+
var _a;
|
|
2158
|
+
var _b, _c;
|
|
2159
|
+
return __generator(this, function (_d) {
|
|
2160
|
+
switch (_d.label) {
|
|
2022
2161
|
case 0:
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
return [4 /*yield*/, createSetupIntent(plugin, token, apiHost, accountId)];
|
|
2162
|
+
if (!plugin)
|
|
2163
|
+
return [2 /*return*/];
|
|
2164
|
+
_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;
|
|
2165
|
+
switch (_a) {
|
|
2166
|
+
case "StripePayment": return [3 /*break*/, 1];
|
|
2167
|
+
case "DemoPayPayment": return [3 /*break*/, 3];
|
|
2168
|
+
}
|
|
2169
|
+
return [3 /*break*/, 5];
|
|
2170
|
+
case 1: return [4 /*yield*/, payStripe({
|
|
2171
|
+
plugin: plugin,
|
|
2172
|
+
})];
|
|
2035
2173
|
case 2:
|
|
2036
|
-
|
|
2037
|
-
if (response.status !== "success")
|
|
2038
|
-
throw new Error(response === null || response === void 0 ? void 0 : response.message);
|
|
2039
|
-
clientSecret = (_a = response === null || response === void 0 ? void 0 : response.payload) === null || _a === void 0 ? void 0 : _a.client_secret;
|
|
2040
|
-
if (!clientSecret)
|
|
2041
|
-
throw new Error("Error retrieving client secret");
|
|
2042
|
-
return [4 /*yield*/, stripe.confirmSetup({
|
|
2043
|
-
elements: elements,
|
|
2044
|
-
clientSecret: clientSecret,
|
|
2045
|
-
redirect: "if_required",
|
|
2046
|
-
confirmParams: {
|
|
2047
|
-
return_url: window.location.href,
|
|
2048
|
-
},
|
|
2049
|
-
})];
|
|
2050
|
-
case 3:
|
|
2051
|
-
intentResponse = _c.sent();
|
|
2052
|
-
// See https://stripe.com/docs/payments/save-during-payment?platform=web#web-submit-payment
|
|
2053
|
-
if (intentResponse.error)
|
|
2054
|
-
throw new Error(intentResponse.error.message);
|
|
2055
|
-
paymentMethodId = (_b = intentResponse.setupIntent.payment_method) === null || _b === void 0 ? void 0 : _b.toString();
|
|
2056
|
-
if (!paymentMethodId)
|
|
2057
|
-
throw new Error("Payment method couldn't be retrieved");
|
|
2058
|
-
return [4 /*yield*/, createPaymentMethod({
|
|
2059
|
-
paymentMethodId: paymentMethodId,
|
|
2060
|
-
plugin: plugin,
|
|
2061
|
-
token: token,
|
|
2062
|
-
apiHost: apiHost,
|
|
2063
|
-
accountId: accountId,
|
|
2064
|
-
})];
|
|
2065
|
-
case 4:
|
|
2066
|
-
paymentMethodResponse = _c.sent();
|
|
2067
|
-
onPaymentSuccess({
|
|
2068
|
-
pluginPaymentResponse: {
|
|
2069
|
-
savePaymentMethod: true,
|
|
2070
|
-
plugin: plugin,
|
|
2071
|
-
token: paymentMethodResponse.token,
|
|
2072
|
-
},
|
|
2073
|
-
savedPaymentMethodResponse: {
|
|
2074
|
-
paymentMethodId: paymentMethodResponse.payload[0].id,
|
|
2075
|
-
},
|
|
2076
|
-
});
|
|
2174
|
+
_d.sent();
|
|
2077
2175
|
return [3 /*break*/, 6];
|
|
2078
|
-
case
|
|
2079
|
-
|
|
2080
|
-
|
|
2176
|
+
case 3: return [4 /*yield*/, payDemoPay({
|
|
2177
|
+
plugin: plugin,
|
|
2178
|
+
savePaymentMethod: false,
|
|
2179
|
+
})];
|
|
2180
|
+
case 4:
|
|
2181
|
+
_d.sent();
|
|
2081
2182
|
return [3 /*break*/, 6];
|
|
2183
|
+
case 5: return [3 /*break*/, 6];
|
|
2082
2184
|
case 6: return [2 /*return*/];
|
|
2083
2185
|
}
|
|
2084
2186
|
});
|
|
2085
2187
|
}); };
|
|
2086
|
-
return (
|
|
2188
|
+
return (jsx("div", __assign({ className: "flex justify-end gap-2 ".concat(noPadding ? "" : "pt-6") }, { children: jsx(Button, __assign({ className: "w-full", disabled: isPaying, onClick: function () {
|
|
2189
|
+
setIsPaying(true);
|
|
2190
|
+
handlePaymentSubmit();
|
|
2191
|
+
}, size: isMobile ? "large" : "middle", type: "primary" }, { children: "".concat(isPaying ? "Paying" : "Pay", " ").concat(amountDue && currencyId ? formatCurrency(amountDue, currencyId) : "") })) })));
|
|
2087
2192
|
};
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
var
|
|
2091
|
-
|
|
2092
|
-
var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
|
|
2093
|
-
var accountId = useContext(PaymentContext).accountId;
|
|
2094
|
-
var stripe = useStripePlugin(plugin, token, apiHost, accountId);
|
|
2095
|
-
var onlySavePaymentMethod = !payable;
|
|
2096
|
-
if (!stripe)
|
|
2193
|
+
var CheckoutFooter = function (_a) {
|
|
2194
|
+
var _b, _c;
|
|
2195
|
+
var quote = _a.quote, invoice = _a.invoice, onPaymentSuccess = _a.onPaymentSuccess, noPadding = _a.noPadding, plugin = _a.plugin;
|
|
2196
|
+
if (!plugin)
|
|
2097
2197
|
return null;
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
//
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
setupFutureUsage: "off_session",
|
|
2107
|
-
};
|
|
2108
|
-
return (jsx(Elements, __assign({ options: options, stripe: stripe }, { children: jsx(PaymentMethodForm$1, { entityId: entityId, isSaving: isSaving, setIsSaving: setIsSaving, plugin: plugin, onFail: onFail, onPaymentSuccess: onPaymentSuccess }) })));
|
|
2109
|
-
}
|
|
2110
|
-
else {
|
|
2111
|
-
var options = {
|
|
2112
|
-
mode: "payment",
|
|
2113
|
-
amount: payable === null || payable === void 0 ? void 0 : payable.smallUnitAmountDue,
|
|
2114
|
-
currency: payable === null || payable === void 0 ? void 0 : payable.currencyId.toLowerCase(),
|
|
2115
|
-
setupFutureUsage: "off_session",
|
|
2116
|
-
};
|
|
2117
|
-
return (jsx(Elements, __assign({ options: options, stripe: stripe }, { children: jsx(CheckoutForm, { entityId: entityId, payable: payable, plugin: plugin, isSaving: isSaving, setIsSaving: setIsSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess }) })));
|
|
2118
|
-
}
|
|
2198
|
+
var _d = useContext(BunnyContext), token = _d.token, apiHost = _d.apiHost;
|
|
2199
|
+
var accountId = useContext(PaymentContext).accountId;
|
|
2200
|
+
// If plugin is not stripe, pass undefined to prevent errors
|
|
2201
|
+
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"
|
|
2202
|
+
? plugin
|
|
2203
|
+
: undefined;
|
|
2204
|
+
var _e = useStripePlugin(stripePlugin, token, apiHost, accountId), stripe = _e.stripe, options = _e.options;
|
|
2205
|
+
return (jsx(Elements, __assign({ options: options, stripe: stripe }, { children: jsx(ActualCheckoutFooter, { plugin: plugin, invoice: invoice, quote: quote, onPaymentSuccess: onPaymentSuccess, noPadding: noPadding }) })));
|
|
2119
2206
|
};
|
|
2120
2207
|
|
|
2121
|
-
var
|
|
2122
|
-
|
|
2208
|
+
var dayjs_min = {exports: {}};
|
|
2209
|
+
|
|
2210
|
+
(function (module, exports) {
|
|
2211
|
+
!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}));
|
|
2212
|
+
}(dayjs_min));
|
|
2213
|
+
|
|
2214
|
+
var dayjs = dayjs_min.exports;
|
|
2215
|
+
|
|
2216
|
+
var Card = function (_a) {
|
|
2217
|
+
var children = _a.children, className = _a.className, style = _a.style;
|
|
2218
|
+
var darkMode = useContext(BunnyContext).darkMode;
|
|
2219
|
+
return (jsx("div", __assign({ className: "flex flex-col rounded-md shadow-md ".concat(className), style: __assign(__assign({}, style), { backgroundColor: darkMode
|
|
2220
|
+
? "var(--row-background-dark)"
|
|
2221
|
+
: "var(--row-background)" }) }, { children: children })));
|
|
2123
2222
|
};
|
|
2124
2223
|
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
var amount = _a.amount, currency = _a.currency, cardDetails = _a.cardDetails;
|
|
2128
|
-
return { token: "DemoPayTestToken", amount: amount, currency: currency, cardDetails: cardDetails };
|
|
2224
|
+
var LargeCardIcon = function () {
|
|
2225
|
+
return (jsx("svg", __assign({ width: "72", height: "56", viewBox: "0 0 72 56", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: 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" }) })));
|
|
2129
2226
|
};
|
|
2130
|
-
|
|
2131
|
-
var
|
|
2132
|
-
var
|
|
2133
|
-
|
|
2134
|
-
var isModifier = function (char) { return [16, 17, 18].includes(char); }; // Shift, Ctrl, Alt
|
|
2135
|
-
var isValidKey = function (code) {
|
|
2136
|
-
return isDeletion(code) || isNavigation(code) || isModifier(code);
|
|
2227
|
+
|
|
2228
|
+
var PlusIcon = function (_a) {
|
|
2229
|
+
var color = _a.color;
|
|
2230
|
+
return (jsxs("svg", __assign({ width: "14", height: "15", viewBox: "0 0 14 15", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: [jsx("path", { d: "M2.9165 7.5H11.0832", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), jsx("path", { d: "M7 3.41663V11.5833", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })] })));
|
|
2137
2231
|
};
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
return
|
|
2232
|
+
|
|
2233
|
+
var Text$f = Typography.Text;
|
|
2234
|
+
var CreditCard = function (_a) {
|
|
2235
|
+
var _b;
|
|
2236
|
+
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;
|
|
2237
|
+
var isMobile = useIsMobile();
|
|
2238
|
+
var Wrapper = cardEnabled ? Card : "div";
|
|
2239
|
+
return (jsxs(Wrapper, __assign({ className: "".concat(cardEnabled ? shadow : "", " m-0") }, { children: [jsxs("div", __assign({ className: "flex items-center justify-between gap-4 p-4" }, { children: [jsxs("div", __assign({ className: "flex items-center gap-4" }, { children: [jsxs("div", __assign({ className: "flex items-center gap-2" }, { children: [jsx(CardImage, { paymentMethodData: paymentMethodData }), jsx(Text$f, { children: (_b = paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.metadata) === null || _b === void 0 ? void 0 : _b.description })] })), jsx(Tag, __assign({ color: isExpired(paymentMethodData) ? "red" : "green" }, { children: isExpired(paymentMethodData) ? "Expired" : "Valid" }))] })), !isMobile && (jsx(CardActions, { onClickRemove: onClickRemove, onClickUpdate: onClickUpdate }))] })), dayjs(paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.expirationDate).isValid() && (jsxs(Fragment, { children: [jsx(Divider, {}), jsxs("div", __assign({ className: "flex flex-col p-4" }, { children: [jsx(CardAttribute, { title: "EXPIRATION", value: expirationDate(paymentMethodData) }), isMobile && (jsx(CardActions, { onClickRemove: onClickRemove, onClickUpdate: onClickUpdate }))] }))] }))] })));
|
|
2146
2240
|
};
|
|
2147
|
-
var
|
|
2148
|
-
var
|
|
2149
|
-
var
|
|
2150
|
-
var
|
|
2151
|
-
|
|
2241
|
+
var MiniCreditCard = function (_a) {
|
|
2242
|
+
var _b;
|
|
2243
|
+
var _c = _a.hideRemoveButton, hideRemoveButton = _c === void 0 ? false : _c, onClickRemove = _a.onClickRemove, paymentMethodData = _a.paymentMethodData;
|
|
2244
|
+
var darkMode = useContext(BunnyContext).darkMode;
|
|
2245
|
+
var borderColor = useMemo(function () {
|
|
2246
|
+
return darkMode ? "border-slate-700" : "border-slate-200";
|
|
2247
|
+
}, [darkMode]);
|
|
2248
|
+
var backgroundColor = useMemo(function () {
|
|
2249
|
+
return darkMode ? "var(--row-background-alternate)" : "bg-slate-50";
|
|
2250
|
+
}, [darkMode]);
|
|
2251
|
+
return (jsx("div", __assign({ className: "flex flex-row justify-between items-center p-1 border-solid ".concat(backgroundColor, " ").concat(borderColor, " rounded-md border") }, { children: paymentMethodData ? (jsxs(Fragment, { children: [jsxs("div", __assign({ className: "flex flex-row gap-4" }, { children: [jsxs("div", __assign({ className: "flex items-center gap-4" }, { children: [jsxs("div", __assign({ className: "flex items-center gap-2" }, { children: [jsx(CardImage, { paymentMethodData: paymentMethodData }), jsx(Text$f, { children: (_b = paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.metadata) === null || _b === void 0 ? void 0 : _b.description })] })), jsx(Tag, __assign({ color: isExpired(paymentMethodData) ? "red" : "green" }, { children: isExpired(paymentMethodData) ? "Expired" : "Valid" }))] })), jsx("div", __assign({ className: "flex flex-row gap-1 items-center" }, { children: dayjs(paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.expirationDate).isValid() && (jsxs(Fragment, { children: [jsx(Text$f, __assign({ className: "text-slate-400", style: { fontSize: "11px" } }, { children: "EXP" })), jsx(Text$f, { children: expirationDate(paymentMethodData) })] })) }))] })), !hideRemoveButton && (jsx(Popconfirm, __assign({ title: "Remove card?", onConfirm: onClickRemove }, { children: jsx(Button, __assign({ className: "font-normal p-0", type: "link" }, { children: "Remove" })) })))] })) : (jsxs("div", __assign({ className: "flex flex-row gap-2 items-center" }, { children: [jsx(CreditCardOutlined$1, {}), jsx(Text$f, __assign({ className: "text-slate-400", style: { fontSize: "11px" } }, { children: "No payment method selected" })), jsx(Button, { disabled: true, type: "link" })] }))) })));
|
|
2252
|
+
};
|
|
2253
|
+
var CardImage = function (_a) {
|
|
2254
|
+
var _b, _c;
|
|
2255
|
+
var paymentMethodData = _a.paymentMethodData;
|
|
2256
|
+
var apiHost = useContext(BunnyContext).apiHost;
|
|
2257
|
+
var darkMode = useContext(BunnyContext).darkMode;
|
|
2258
|
+
var getCardImage = function (issuer) {
|
|
2259
|
+
if (issuer === "visa")
|
|
2260
|
+
return "Visa_Brandmark_Blue_RGB_2021.png";
|
|
2261
|
+
else if (issuer === "mastercard")
|
|
2262
|
+
return "mc_symbol_opt_73_3x.png";
|
|
2263
|
+
};
|
|
2264
|
+
return (jsx(Fragment, { children: getCardImage((_b = paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.metadata) === null || _b === void 0 ? void 0 : _b.issuer) && (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: {
|
|
2265
|
+
color: darkMode ? "white" : "",
|
|
2266
|
+
} })) }));
|
|
2152
2267
|
};
|
|
2153
|
-
var
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
return cardExpiry.substring(0, 2) + "/" + cardExpiry.substring(2);
|
|
2268
|
+
var CardAttribute = function (_a) {
|
|
2269
|
+
var title = _a.title, value = _a.value;
|
|
2270
|
+
return (jsxs("div", __assign({ className: "flex flex-col gap-2" }, { children: [jsx("div", __assign({ className: "text-slate-400", style: { fontSize: "11px" } }, { children: title })), jsx(Text$f, { children: value })] })));
|
|
2157
2271
|
};
|
|
2158
|
-
|
|
2159
|
-
var
|
|
2160
|
-
var
|
|
2161
|
-
|
|
2162
|
-
|
|
2272
|
+
var CardActions = function (_a) {
|
|
2273
|
+
var onClickRemove = _a.onClickRemove, onClickUpdate = _a.onClickUpdate;
|
|
2274
|
+
var isMobile = useIsMobile();
|
|
2275
|
+
return (jsxs("div", __assign({ className: "flex items-center gap-6 ".concat(isMobile ? "justify-center mt-4" : "") }, { children: [jsx(Popconfirm, __assign({ title: "Remove card?", onConfirm: onClickRemove }, { children: jsx(Button, __assign({ className: "font-normal p-0", type: "link" }, { children: "Remove payment method" })) })), jsx(Divider, { style: { height: "24px" }, type: "vertical" }), jsx(Button, __assign({ onClick: onClickUpdate, type: "primary" }, { children: "Update" }))] })));
|
|
2276
|
+
};
|
|
2277
|
+
var EmptyCard = function (_a) {
|
|
2278
|
+
var onClick = _a.onClick, _b = _a.shadow, shadow = _b === void 0 ? "shadow-md" : _b, _c = _a.cardEnabled, cardEnabled = _c === void 0 ? true : _c;
|
|
2279
|
+
var brandColor = useContext(BrandContext).brandColor;
|
|
2280
|
+
return (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: [jsx(LargeCardIcon, {}), jsx("div", __assign({ className: "text-slate-400 pt-4 pb-8" }, { children: "No payment methods" })), jsx(Button, __assign({ type: "link" }, { children: jsxs("div", __assign({ className: "flex items-center gap-1" }, { children: [jsx(PlusIcon, { color: brandColor }), "Add payment method"] })) }))] })));
|
|
2281
|
+
};
|
|
2282
|
+
var isExpired = function (paymentMethodData) {
|
|
2283
|
+
var expDate = dayjs(paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.expirationDate);
|
|
2284
|
+
return expDate.isBefore(dayjs());
|
|
2285
|
+
};
|
|
2286
|
+
var expirationDate = function (storedPaymentMethod) {
|
|
2287
|
+
return dayjs(storedPaymentMethod === null || storedPaymentMethod === void 0 ? void 0 : storedPaymentMethod.expirationDate).format("MM/YY");
|
|
2288
|
+
};
|
|
2289
|
+
|
|
2290
|
+
var SavePaymentMethodFooter = function (_a) {
|
|
2291
|
+
var isSaving = _a.isSaving, onSave = _a.onSave, noPadding = _a.noPadding;
|
|
2292
|
+
var isMobile = useIsMobile();
|
|
2293
|
+
var onClickCancel = useContext(PaymentContext).onClickCancel;
|
|
2294
|
+
return (jsxs("div", __assign({ className: "flex justify-end gap-2 ".concat(noPadding ? "" : "pt-6") }, { children: [onClickCancel && (jsx(Button, __assign({ className: "w-full", size: isMobile ? "large" : "middle", onClick: function () { return onClickCancel(); } }, { children: "Cancel" }))), jsx(Button, __assign({ className: "w-full", disabled: isSaving, onClick: onSave, size: isMobile ? "large" : "middle", type: "primary" }, { children: isSaving ? "Saving" : "Save" }))] })));
|
|
2163
2295
|
};
|
|
2164
|
-
var storePayment = function (options, plugin, apiHost, accountId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2165
|
-
var testCreditCardNumber, testCreditCardCvc, testCreditCardExpirationDate, token, response;
|
|
2166
|
-
return __generator(this, function (_a) {
|
|
2167
|
-
switch (_a.label) {
|
|
2168
|
-
case 0:
|
|
2169
|
-
testCreditCardNumber = options.testCreditCardNumber, testCreditCardCvc = options.testCreditCardCvc, testCreditCardExpirationDate = options.testCreditCardExpirationDate, token = options.token;
|
|
2170
|
-
return [4 /*yield*/, invokePlugin({
|
|
2171
|
-
method: "store_payment_method",
|
|
2172
|
-
plugin: plugin,
|
|
2173
|
-
payload: {
|
|
2174
|
-
test_credit_card_number: testCreditCardNumber,
|
|
2175
|
-
test_credit_card_cvc: testCreditCardCvc,
|
|
2176
|
-
test_credit_card_expiration_date: testCreditCardExpirationDate,
|
|
2177
|
-
account_id: accountId,
|
|
2178
|
-
},
|
|
2179
|
-
token: token,
|
|
2180
|
-
apiHost: apiHost,
|
|
2181
|
-
})];
|
|
2182
|
-
case 1:
|
|
2183
|
-
response = _a.sent();
|
|
2184
|
-
if ((response === null || response === void 0 ? void 0 : response.status) !== "success")
|
|
2185
|
-
throw new Error(response === null || response === void 0 ? void 0 : response.message);
|
|
2186
|
-
return [2 /*return*/, response];
|
|
2187
|
-
}
|
|
2188
|
-
});
|
|
2189
|
-
}); };
|
|
2190
2296
|
|
|
2191
2297
|
var DemoPayCardCvc = function (_a) {
|
|
2192
2298
|
var autoFocus = _a.autoFocus, onChange = _a.onChange, placeholder = _a.placeholder, value = _a.value;
|
|
@@ -2231,83 +2337,95 @@ var DemoPayExpiry = function (_a) {
|
|
|
2231
2337
|
return (jsx("div", __assign({ className: "grow" }, { children: jsx(Input, { autoFocus: autoFocus, onKeyDown: onKeyPress, onKeyUp: onKeyPress, onChange: onNumberChange, value: formatCardExpiry(value), maxLength: 5, placeholder: placeholder || "MM/YY" }) })));
|
|
2232
2338
|
};
|
|
2233
2339
|
|
|
2234
|
-
|
|
2340
|
+
function useSave$1(_a) {
|
|
2341
|
+
var _this = this;
|
|
2342
|
+
var onSaveSuccess = _a.onSaveSuccess, token = _a.token, apiHost = _a.apiHost, accountId = _a.accountId;
|
|
2343
|
+
var _b = useState(false), isSaving = _b[0], setIsSaving = _b[1];
|
|
2344
|
+
var save = function (_a) {
|
|
2345
|
+
var cardDetails = _a.cardDetails, plugin = _a.plugin, savePaymentMethod = _a.savePaymentMethod;
|
|
2346
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
2347
|
+
var response, paymentMethodId, error_1;
|
|
2348
|
+
return __generator(this, function (_b) {
|
|
2349
|
+
switch (_b.label) {
|
|
2350
|
+
case 0:
|
|
2351
|
+
_b.trys.push([0, 2, 3, 4]);
|
|
2352
|
+
setIsSaving(true);
|
|
2353
|
+
return [4 /*yield*/, storePayment({
|
|
2354
|
+
testCreditCardNumber: unformatCardNumber(cardDetails.number),
|
|
2355
|
+
testCreditCardCvc: cardDetails.cvc.toString(),
|
|
2356
|
+
testCreditCardExpirationDate: cardDetails.expiry,
|
|
2357
|
+
token: token,
|
|
2358
|
+
}, plugin, apiHost, accountId)];
|
|
2359
|
+
case 1:
|
|
2360
|
+
response = _b.sent();
|
|
2361
|
+
paymentMethodId = response.payload[0].id;
|
|
2362
|
+
if (response.status !== "success")
|
|
2363
|
+
throw new Error(response === null || response === void 0 ? void 0 : response.message);
|
|
2364
|
+
onSaveSuccess({
|
|
2365
|
+
pluginPaymentResponse: {
|
|
2366
|
+
plugin: plugin,
|
|
2367
|
+
token: response.token,
|
|
2368
|
+
savePaymentMethod: savePaymentMethod,
|
|
2369
|
+
},
|
|
2370
|
+
savedPaymentMethodResponse: {
|
|
2371
|
+
paymentMethodId: paymentMethodId,
|
|
2372
|
+
},
|
|
2373
|
+
});
|
|
2374
|
+
return [3 /*break*/, 4];
|
|
2375
|
+
case 2:
|
|
2376
|
+
error_1 = _b.sent();
|
|
2377
|
+
console.error("Payment failed", error_1);
|
|
2378
|
+
return [3 /*break*/, 4];
|
|
2379
|
+
case 3:
|
|
2380
|
+
setIsSaving(false);
|
|
2381
|
+
return [7 /*endfinally*/];
|
|
2382
|
+
case 4: return [2 /*return*/];
|
|
2383
|
+
}
|
|
2384
|
+
});
|
|
2385
|
+
});
|
|
2386
|
+
};
|
|
2387
|
+
return { save: save, isSaving: isSaving };
|
|
2388
|
+
}
|
|
2389
|
+
|
|
2390
|
+
var Text$e = Typography.Text;
|
|
2235
2391
|
var TEST_CARD = "4242424242424242";
|
|
2236
2392
|
var DemoPayForm = function (_a) {
|
|
2237
|
-
var
|
|
2393
|
+
var onFail = _a.onFail, onSavePaymentMethod = _a.onSavePaymentMethod, plugin = _a.plugin;
|
|
2238
2394
|
// Context
|
|
2239
2395
|
var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, darkMode = _b.darkMode;
|
|
2240
2396
|
var accountId = useContext(PaymentContext).accountId;
|
|
2241
|
-
//
|
|
2242
|
-
var _c =
|
|
2397
|
+
// Hooks
|
|
2398
|
+
var _c = useSave$1({
|
|
2399
|
+
onSaveSuccess: onSavePaymentMethod,
|
|
2400
|
+
token: token,
|
|
2401
|
+
apiHost: apiHost,
|
|
2402
|
+
accountId: accountId,
|
|
2403
|
+
}), save = _c.save, isSaving = _c.isSaving;
|
|
2243
2404
|
var _d = useState({
|
|
2244
2405
|
number: "4242424242424242",
|
|
2245
2406
|
expiry: "",
|
|
2246
2407
|
cvc: "",
|
|
2247
2408
|
}), cardDetails = _d[0], setCardDetails = _d[1];
|
|
2248
|
-
var
|
|
2249
|
-
|
|
2250
|
-
var onlySavePaymentMethod = !quote && !invoice;
|
|
2251
|
-
var onPaymentSubmit = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
2252
|
-
var response, paymentMethodId, response, error_1;
|
|
2409
|
+
var onSave = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
2410
|
+
var error_1;
|
|
2253
2411
|
return __generator(this, function (_a) {
|
|
2254
2412
|
switch (_a.label) {
|
|
2255
2413
|
case 0:
|
|
2256
|
-
_a.trys.push([0,
|
|
2257
|
-
if (!onlySavePaymentMethod) return [3 /*break*/, 2];
|
|
2414
|
+
_a.trys.push([0, 2, , 3]);
|
|
2258
2415
|
validateCardDetails();
|
|
2259
|
-
|
|
2260
|
-
return [4 /*yield*/, storePayment({
|
|
2261
|
-
testCreditCardNumber: unformatCardNumber(cardDetails.number),
|
|
2262
|
-
testCreditCardCvc: cardDetails.cvc.toString(),
|
|
2263
|
-
testCreditCardExpirationDate: cardDetails.expiry,
|
|
2264
|
-
token: token,
|
|
2265
|
-
}, plugin, apiHost, accountId)];
|
|
2266
|
-
case 1:
|
|
2267
|
-
response = _a.sent();
|
|
2268
|
-
paymentMethodId = response.payload[0].id;
|
|
2269
|
-
if (response.status !== "success")
|
|
2270
|
-
throw new Error(response === null || response === void 0 ? void 0 : response.message);
|
|
2271
|
-
onPaymentSuccess({
|
|
2272
|
-
pluginPaymentResponse: {
|
|
2273
|
-
plugin: plugin,
|
|
2274
|
-
token: response.token,
|
|
2275
|
-
savePaymentMethod: savePaymentMethod,
|
|
2276
|
-
},
|
|
2277
|
-
savedPaymentMethodResponse: {
|
|
2278
|
-
paymentMethodId: paymentMethodId,
|
|
2279
|
-
},
|
|
2280
|
-
});
|
|
2281
|
-
return [3 /*break*/, 5];
|
|
2282
|
-
case 2:
|
|
2283
|
-
if (!(amountDue !== undefined && currencyId)) return [3 /*break*/, 4];
|
|
2284
|
-
validateCardDetails();
|
|
2285
|
-
setIsSaving(true);
|
|
2286
|
-
return [4 /*yield*/, confirmPayment({
|
|
2287
|
-
amount: amountDue,
|
|
2288
|
-
currency: currencyId,
|
|
2416
|
+
return [4 /*yield*/, save({
|
|
2289
2417
|
cardDetails: cardDetails,
|
|
2290
|
-
})];
|
|
2291
|
-
case 3:
|
|
2292
|
-
response = _a.sent();
|
|
2293
|
-
onPaymentSuccess({
|
|
2294
|
-
pluginPaymentResponse: {
|
|
2295
2418
|
plugin: plugin,
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
case 4:
|
|
2303
|
-
onFail(new Error("No amount or currencyId"));
|
|
2304
|
-
_a.label = 5;
|
|
2305
|
-
case 5: return [3 /*break*/, 7];
|
|
2306
|
-
case 6:
|
|
2419
|
+
savePaymentMethod: false,
|
|
2420
|
+
})];
|
|
2421
|
+
case 1:
|
|
2422
|
+
_a.sent();
|
|
2423
|
+
return [3 /*break*/, 3];
|
|
2424
|
+
case 2:
|
|
2307
2425
|
error_1 = _a.sent();
|
|
2308
2426
|
onFail(error_1);
|
|
2309
|
-
return [3 /*break*/,
|
|
2310
|
-
case
|
|
2427
|
+
return [3 /*break*/, 3];
|
|
2428
|
+
case 3: return [2 /*return*/];
|
|
2311
2429
|
}
|
|
2312
2430
|
});
|
|
2313
2431
|
}); };
|
|
@@ -2330,454 +2448,231 @@ var DemoPayForm = function (_a) {
|
|
|
2330
2448
|
var onCardCvcChange = function (cvc) {
|
|
2331
2449
|
setCardDetails(__assign(__assign({}, cardDetails), { cvc: cvc }));
|
|
2332
2450
|
};
|
|
2333
|
-
return (jsxs("div", __assign({ className: "flex flex-col gap-2" }, { children: [jsxs(StyledInputs, __assign({ className: "flex flex-col gap-2", darkMode: darkMode !== null && darkMode !== void 0 ? darkMode : false }, { children: [jsx(DemoPayCardNumber, { onChange: onCardNumberChange, value: cardDetails.number }), jsxs("div", __assign({ className: "flex gap-2" }, { children: [jsx(DemoPayExpiry, { onChange: onCardExpiryChange, value: cardDetails.expiry }), jsx(DemoPayCardCvc, { onChange: onCardCvcChange, value: cardDetails.cvc })] }))] })), jsx(Text$
|
|
2451
|
+
return (jsxs("div", __assign({ className: "flex flex-col gap-2" }, { children: [jsxs(StyledInputs, __assign({ className: "flex flex-col gap-2", darkMode: darkMode !== null && darkMode !== void 0 ? darkMode : false }, { children: [jsx(DemoPayCardNumber, { onChange: onCardNumberChange, value: cardDetails.number }), jsxs("div", __assign({ className: "flex gap-2" }, { children: [jsx(DemoPayExpiry, { onChange: onCardExpiryChange, value: cardDetails.expiry }), jsx(DemoPayCardCvc, { onChange: onCardCvcChange, value: cardDetails.cvc })] }))] })), jsx(Text$e, __assign({ className: "text-xs" }, { children: "DemoPay is for testing only." })), jsx(SavePaymentMethodFooter, { isSaving: isSaving, onSave: onSave })] })));
|
|
2334
2452
|
};
|
|
2335
|
-
var StyledInputs = styled.div(templateObject_1$
|
|
2453
|
+
var StyledInputs = styled.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) {
|
|
2336
2454
|
var darkMode = _a.darkMode;
|
|
2337
2455
|
return darkMode ? "var(--row-background-dark)" : "white";
|
|
2338
2456
|
}, function (_a) {
|
|
2339
2457
|
var darkMode = _a.darkMode;
|
|
2340
2458
|
return darkMode ? GRAY_500 : GRAY_200;
|
|
2341
2459
|
});
|
|
2342
|
-
var templateObject_1$
|
|
2460
|
+
var templateObject_1$7;
|
|
2343
2461
|
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2462
|
+
function useSave(_a) {
|
|
2463
|
+
var _this = this;
|
|
2464
|
+
var onSaveSuccess = _a.onSaveSuccess;
|
|
2465
|
+
// Hooks
|
|
2466
|
+
var _b = useState(false), isSaving = _b[0], setIsSaving = _b[1];
|
|
2467
|
+
var elements = useElements();
|
|
2468
|
+
var stripe = useStripe();
|
|
2469
|
+
var _c = useContext(BunnyContext), token = _c.token, apiHost = _c.apiHost;
|
|
2470
|
+
var accountId = useContext(PaymentContext).accountId;
|
|
2471
|
+
var save = function (_a) {
|
|
2472
|
+
var plugin = _a.plugin;
|
|
2473
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
2474
|
+
var submitError, response, clientSecret, intentResponse, paymentMethodId, paymentMethodResponse, error_1;
|
|
2475
|
+
var _b, _c;
|
|
2476
|
+
return __generator(this, function (_d) {
|
|
2477
|
+
switch (_d.label) {
|
|
2478
|
+
case 0:
|
|
2479
|
+
_d.trys.push([0, 5, 6, 7]);
|
|
2480
|
+
if (!stripe)
|
|
2481
|
+
throw new Error("Form is not ready");
|
|
2482
|
+
if (!elements)
|
|
2483
|
+
throw new Error("Elements couldn't be retrieved");
|
|
2484
|
+
setIsSaving(true);
|
|
2485
|
+
return [4 /*yield*/, elements.submit()];
|
|
2486
|
+
case 1:
|
|
2487
|
+
submitError = (_d.sent()).error;
|
|
2488
|
+
if (submitError)
|
|
2489
|
+
throw new Error(submitError.message);
|
|
2490
|
+
return [4 /*yield*/, createSetupIntent(plugin, token, apiHost, accountId)];
|
|
2491
|
+
case 2:
|
|
2492
|
+
response = _d.sent();
|
|
2493
|
+
if (response.status !== "success")
|
|
2494
|
+
throw new Error(response === null || response === void 0 ? void 0 : response.message);
|
|
2495
|
+
clientSecret = (_b = response === null || response === void 0 ? void 0 : response.payload) === null || _b === void 0 ? void 0 : _b.client_secret;
|
|
2496
|
+
if (!clientSecret)
|
|
2497
|
+
throw new Error("Error retrieving client secret");
|
|
2498
|
+
return [4 /*yield*/, stripe.confirmSetup({
|
|
2499
|
+
elements: elements,
|
|
2500
|
+
clientSecret: clientSecret,
|
|
2501
|
+
redirect: "if_required",
|
|
2502
|
+
confirmParams: {
|
|
2503
|
+
return_url: window.location.href,
|
|
2504
|
+
},
|
|
2505
|
+
})];
|
|
2506
|
+
case 3:
|
|
2507
|
+
intentResponse = _d.sent();
|
|
2508
|
+
// See https://stripe.com/docs/payments/save-during-payment?platform=web#web-submit-payment
|
|
2509
|
+
if (intentResponse.error)
|
|
2510
|
+
throw new Error(intentResponse.error.message);
|
|
2511
|
+
paymentMethodId = (_c = intentResponse.setupIntent.payment_method) === null || _c === void 0 ? void 0 : _c.toString();
|
|
2512
|
+
if (!paymentMethodId)
|
|
2513
|
+
throw new Error("Payment method couldn't be retrieved");
|
|
2514
|
+
return [4 /*yield*/, createPaymentMethod({
|
|
2515
|
+
paymentMethodId: paymentMethodId,
|
|
2516
|
+
plugin: plugin,
|
|
2517
|
+
token: token,
|
|
2518
|
+
apiHost: apiHost,
|
|
2519
|
+
accountId: accountId,
|
|
2520
|
+
})];
|
|
2521
|
+
case 4:
|
|
2522
|
+
paymentMethodResponse = _d.sent();
|
|
2523
|
+
onSaveSuccess({
|
|
2524
|
+
pluginPaymentResponse: {
|
|
2525
|
+
savePaymentMethod: true,
|
|
2526
|
+
plugin: plugin,
|
|
2527
|
+
token: paymentMethodResponse.token,
|
|
2528
|
+
},
|
|
2529
|
+
savedPaymentMethodResponse: {
|
|
2530
|
+
paymentMethodId: paymentMethodResponse.payload[0].id,
|
|
2531
|
+
},
|
|
2532
|
+
});
|
|
2533
|
+
return [3 /*break*/, 7];
|
|
2534
|
+
case 5:
|
|
2535
|
+
error_1 = _d.sent();
|
|
2536
|
+
console.error(error_1);
|
|
2537
|
+
return [3 /*break*/, 7];
|
|
2538
|
+
case 6:
|
|
2539
|
+
setIsSaving(false);
|
|
2540
|
+
return [7 /*endfinally*/];
|
|
2541
|
+
case 7: return [2 /*return*/];
|
|
2542
|
+
}
|
|
2543
|
+
});
|
|
2544
|
+
});
|
|
2545
|
+
};
|
|
2546
|
+
return { save: save, isSaving: isSaving };
|
|
2547
|
+
}
|
|
2360
2548
|
|
|
2361
|
-
var
|
|
2362
|
-
var plugin = _a.plugin,
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
})];
|
|
2549
|
+
var PaymentMethodForm = function (_a) {
|
|
2550
|
+
var plugin = _a.plugin, onFail = _a.onFail, onSavePaymentMethod = _a.onSavePaymentMethod;
|
|
2551
|
+
// Hooks
|
|
2552
|
+
var _b = useSave({
|
|
2553
|
+
onSaveSuccess: onSavePaymentMethod,
|
|
2554
|
+
}), save = _b.save, isSaving = _b.isSaving;
|
|
2555
|
+
// Handlers
|
|
2556
|
+
var onSubmit = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
2557
|
+
var error_1;
|
|
2558
|
+
return __generator(this, function (_a) {
|
|
2559
|
+
switch (_a.label) {
|
|
2560
|
+
case 0:
|
|
2561
|
+
_a.trys.push([0, 2, , 3]);
|
|
2562
|
+
return [4 /*yield*/, save({ plugin: plugin })];
|
|
2376
2563
|
case 1:
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2564
|
+
_a.sent();
|
|
2565
|
+
return [3 /*break*/, 3];
|
|
2566
|
+
case 2:
|
|
2567
|
+
error_1 = _a.sent();
|
|
2568
|
+
onFail(error_1);
|
|
2569
|
+
return [3 /*break*/, 3];
|
|
2570
|
+
case 3: return [2 /*return*/];
|
|
2381
2571
|
}
|
|
2382
2572
|
});
|
|
2383
|
-
});
|
|
2573
|
+
}); };
|
|
2574
|
+
return (jsxs("form", { children: [jsx(PaymentElement, { options: { layout: { type: "accordion" } } }), jsx(SavePaymentMethodFooter, { isSaving: isSaving, onSave: onSubmit })] }));
|
|
2384
2575
|
};
|
|
2385
2576
|
|
|
2386
|
-
|
|
2387
|
-
var
|
|
2388
|
-
|
|
2389
|
-
hideFields: [
|
|
2390
|
-
"address_line1",
|
|
2391
|
-
"address_line2",
|
|
2392
|
-
"address_city",
|
|
2393
|
-
"address_region",
|
|
2394
|
-
"address_state",
|
|
2395
|
-
"address_country",
|
|
2396
|
-
],
|
|
2397
|
-
labels: {
|
|
2398
|
-
number: "Card number",
|
|
2399
|
-
expiration_date: "Expiration date",
|
|
2400
|
-
security_code: "CVC",
|
|
2401
|
-
address_postal_code: "Postal code",
|
|
2402
|
-
},
|
|
2403
|
-
styles: finixStyles(isMobile),
|
|
2404
|
-
}); };
|
|
2405
|
-
var FINIX_FORM_ID$1 = "form-element";
|
|
2406
|
-
var FINIX_ERROR_CODE_MAPPINGS = {
|
|
2407
|
-
INVALID_FIELD: "Invalid field",
|
|
2408
|
-
};
|
|
2409
|
-
var FINIX_FIELD_NAME_MAPPINGS = {
|
|
2410
|
-
security_code: "CVC",
|
|
2411
|
-
number: "Card number",
|
|
2412
|
-
UNKNOWN: "Expiration date",
|
|
2413
|
-
NOT_SUPPORTED: "Address verification",
|
|
2414
|
-
NO_ADDRESS: "Address",
|
|
2415
|
-
};
|
|
2416
|
-
// Finix doesn't seem to return meaningful errors on their error object
|
|
2417
|
-
// they must be extracted from response.data._embedded.errors
|
|
2418
|
-
var formatFinixError = function (response) {
|
|
2419
|
-
var errors = response.data._embedded.errors;
|
|
2420
|
-
var formattedErrors = errors.map(function (error, index) {
|
|
2421
|
-
var code = error.code, field = error.field;
|
|
2422
|
-
var message = FINIX_ERROR_CODE_MAPPINGS[code] || error.message;
|
|
2423
|
-
var formattedField = FINIX_FIELD_NAME_MAPPINGS[field || ""] ||
|
|
2424
|
-
capitalize(snakeToSpaces(field || ""));
|
|
2425
|
-
return "".concat(index + 1, ". ").concat(formattedField, ": ").concat(message);
|
|
2426
|
-
});
|
|
2427
|
-
return formattedErrors.join("\n\n");
|
|
2428
|
-
};
|
|
2429
|
-
var FinixCardPaymentForm = function (_a) {
|
|
2430
|
-
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;
|
|
2431
|
-
// Context
|
|
2577
|
+
// This is just a wrapper to fetch the stripe object and pass it to the form
|
|
2578
|
+
var StripeForm = function (_a) {
|
|
2579
|
+
var plugin = _a.plugin, onFail = _a.onFail, onSavePaymentMethod = _a.onSavePaymentMethod;
|
|
2432
2580
|
var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
|
|
2433
2581
|
var accountId = useContext(PaymentContext).accountId;
|
|
2434
|
-
var
|
|
2435
|
-
|
|
2436
|
-
var _c = useState(false), savePaymentMethod = _c[0], setSavePaymentMethod = _c[1];
|
|
2437
|
-
var _d = useState(null), finixForm = _d[0], setFinixForm = _d[1];
|
|
2438
|
-
var _e = useState(null), finixAuth = _e[0], setFinixAuth = _e[1];
|
|
2439
|
-
var onlySavePaymentMethod = !quote && !invoice;
|
|
2440
|
-
var amountDue = quote ? getQuoteAmountDue(quote) : invoice === null || invoice === void 0 ? void 0 : invoice.amountDue;
|
|
2441
|
-
var currencyId = (quote === null || quote === void 0 ? void 0 : quote.currencyId) || (invoice === null || invoice === void 0 ? void 0 : invoice.currency);
|
|
2442
|
-
// Handlers
|
|
2443
|
-
var onPaymentSubmit = function () {
|
|
2444
|
-
setIsSaving(true);
|
|
2445
|
-
try {
|
|
2446
|
-
var fraud_session_id_1 = finixAuth.getSessionKey();
|
|
2447
|
-
// This is a callback, lets be careful with the scope of the errors and vars
|
|
2448
|
-
var finixFormCallback = function (error, response) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2449
|
-
var tokenData, finixToken, message, response_1, e_1;
|
|
2450
|
-
return __generator(this, function (_a) {
|
|
2451
|
-
switch (_a.label) {
|
|
2452
|
-
case 0:
|
|
2453
|
-
_a.trys.push([0, 3, , 4]);
|
|
2454
|
-
tokenData = response.data || {};
|
|
2455
|
-
finixToken = tokenData.id;
|
|
2456
|
-
if (error) {
|
|
2457
|
-
message = formatFinixError(response);
|
|
2458
|
-
throw new Error(message);
|
|
2459
|
-
}
|
|
2460
|
-
if (!finixToken)
|
|
2461
|
-
throw new Error("payment token couldn't be retrieved");
|
|
2462
|
-
if (!onlySavePaymentMethod) return [3 /*break*/, 2];
|
|
2463
|
-
if (!accountId)
|
|
2464
|
-
throw new Error("Account ID is required");
|
|
2465
|
-
return [4 /*yield*/, invokePlugin({
|
|
2466
|
-
plugin: plugin,
|
|
2467
|
-
method: "store_payment_method",
|
|
2468
|
-
payload: {
|
|
2469
|
-
finix_token: finixToken,
|
|
2470
|
-
fraud_session_id: fraud_session_id_1,
|
|
2471
|
-
account_id: accountId,
|
|
2472
|
-
},
|
|
2473
|
-
token: token,
|
|
2474
|
-
apiHost: apiHost,
|
|
2475
|
-
})];
|
|
2476
|
-
case 1:
|
|
2477
|
-
response_1 = _a.sent();
|
|
2478
|
-
if (response_1.status === "failed")
|
|
2479
|
-
throw new Error(response_1.message);
|
|
2480
|
-
return [2 /*return*/, onPaymentSuccess({})];
|
|
2481
|
-
case 2:
|
|
2482
|
-
onPaymentSuccess({
|
|
2483
|
-
pluginPaymentResponse: {
|
|
2484
|
-
token: finixToken,
|
|
2485
|
-
savePaymentMethod: savePaymentMethod,
|
|
2486
|
-
plugin: plugin,
|
|
2487
|
-
metadata: {
|
|
2488
|
-
fraud_session_id: fraud_session_id_1,
|
|
2489
|
-
},
|
|
2490
|
-
},
|
|
2491
|
-
});
|
|
2492
|
-
return [3 /*break*/, 4];
|
|
2493
|
-
case 3:
|
|
2494
|
-
e_1 = _a.sent();
|
|
2495
|
-
// Catch any errors during AFTER submission, during Callback
|
|
2496
|
-
onFail(e_1);
|
|
2497
|
-
return [3 /*break*/, 4];
|
|
2498
|
-
case 4: return [2 /*return*/];
|
|
2499
|
-
}
|
|
2500
|
-
});
|
|
2501
|
-
}); };
|
|
2502
|
-
finixForm.submit(finixConfig.environment, finixConfig.application_id, finixFormCallback);
|
|
2503
|
-
}
|
|
2504
|
-
catch (e) {
|
|
2505
|
-
// Catch any errors during configuration and submission
|
|
2506
|
-
onFail(e);
|
|
2507
|
-
}
|
|
2508
|
-
};
|
|
2509
|
-
useEffect(function () {
|
|
2510
|
-
if (!finixForm) {
|
|
2511
|
-
var form = window.Finix.CardTokenForm(FINIX_FORM_ID$1, finixOptions$1(isMobile));
|
|
2512
|
-
setFinixForm(form);
|
|
2513
|
-
}
|
|
2514
|
-
}, [finixForm, isMobile]);
|
|
2515
|
-
useEffect(function () {
|
|
2516
|
-
if (!finixAuth) {
|
|
2517
|
-
// It is recommended to retrieve the session key ONCE per checkout/payment
|
|
2518
|
-
var FinixAuth = window.Finix.Auth(finixConfig.environment, finixConfig.merchant_id);
|
|
2519
|
-
setFinixAuth(FinixAuth);
|
|
2520
|
-
}
|
|
2521
|
-
}, [finixAuth, finixConfig.environment, finixConfig.merchant_id]);
|
|
2522
|
-
return (jsxs(Fragment, { children: [jsx("div", { id: FINIX_FORM_ID$1 }), !onlySavePaymentMethod && (jsx(Checkbox, __assign({ className: "mt-2", onChange: function (e) { return setSavePaymentMethod(e.target.checked); } }, { children: "Save as primary payment method" }))), jsx(CheckoutFooter, { amountDue: amountDue, currencyId: currencyId, isSaving: isSaving, onPaymentSubmit: onPaymentSubmit, onlySavePaymentMethod: onlySavePaymentMethod })] }));
|
|
2523
|
-
};
|
|
2524
|
-
// This is just a wrapper to fetch the finix config, config its form and pass it to the paymentForm
|
|
2525
|
-
var FinixForm = function (_a) {
|
|
2526
|
-
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;
|
|
2527
|
-
var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, accountId = _b.accountId;
|
|
2528
|
-
var finixConfig = useQuery({
|
|
2529
|
-
queryKey: QueryKeyFactory.default.finixKey,
|
|
2530
|
-
queryFn: function () {
|
|
2531
|
-
return retrieveConfig({
|
|
2532
|
-
plugin: plugin,
|
|
2533
|
-
token: token,
|
|
2534
|
-
apiHost: apiHost,
|
|
2535
|
-
accountId: accountId,
|
|
2536
|
-
});
|
|
2537
|
-
},
|
|
2538
|
-
staleTime: 0,
|
|
2539
|
-
}).data;
|
|
2540
|
-
if (!finixConfig || !finixConfig.application_id)
|
|
2541
|
-
return null;
|
|
2542
|
-
return (jsx(FinixCardPaymentForm, { entityId: entityId, formData: finixConfig, invoice: invoice, isSaving: isSaving, setIsSaving: setIsSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, plugin: plugin, quote: quote }));
|
|
2543
|
-
};
|
|
2544
|
-
|
|
2545
|
-
var StoredPaymentMethodForm = function (_a) {
|
|
2546
|
-
var isSaving = _a.isSaving, invoice = _a.invoice, onPaymentSuccess = _a.onPaymentSuccess, paymentMethod = _a.paymentMethod, quote = _a.quote, setIsSaving = _a.setIsSaving;
|
|
2547
|
-
var amountDue = quote ? getQuoteAmountDue(quote) : invoice === null || invoice === void 0 ? void 0 : invoice.amountDue;
|
|
2548
|
-
var currencyId = (quote === null || quote === void 0 ? void 0 : quote.currencyId) || (invoice === null || invoice === void 0 ? void 0 : invoice.currency);
|
|
2549
|
-
var onPaymentSubmit = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
2550
|
-
return __generator(this, function (_a) {
|
|
2551
|
-
setIsSaving(true);
|
|
2552
|
-
onPaymentSuccess({
|
|
2553
|
-
savedPaymentMethodResponse: { paymentMethodId: paymentMethod.id },
|
|
2554
|
-
});
|
|
2555
|
-
return [2 /*return*/];
|
|
2556
|
-
});
|
|
2557
|
-
}); };
|
|
2558
|
-
return (jsx(CheckoutFooter, { amountDue: amountDue, currencyId: currencyId, isSaving: isSaving, onPaymentSubmit: onPaymentSubmit, noPadding: true }));
|
|
2559
|
-
};
|
|
2560
|
-
|
|
2561
|
-
var finixOptions = function (isMobile) { return ({
|
|
2562
|
-
showAddress: true,
|
|
2563
|
-
hideFields: [
|
|
2564
|
-
"address_line1",
|
|
2565
|
-
"address_line2",
|
|
2566
|
-
"address_city",
|
|
2567
|
-
"address_region",
|
|
2568
|
-
"address_state",
|
|
2569
|
-
"address_country",
|
|
2570
|
-
],
|
|
2571
|
-
labels: {
|
|
2572
|
-
account_number: "Account number",
|
|
2573
|
-
bank_code: "Routing number",
|
|
2574
|
-
account_type: "Account type",
|
|
2575
|
-
address_postal_code: "Postal code",
|
|
2576
|
-
},
|
|
2577
|
-
styles: finixStyles(isMobile),
|
|
2578
|
-
}); };
|
|
2579
|
-
var FINIX_FORM_ID = "form-element";
|
|
2580
|
-
var FinixAchPayment = function (_a) {
|
|
2581
|
-
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;
|
|
2582
|
-
var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, accountId = _b.accountId;
|
|
2583
|
-
var finixConfig = useQuery({
|
|
2584
|
-
queryKey: QueryKeyFactory.default.finixAchKey,
|
|
2585
|
-
queryFn: function () {
|
|
2586
|
-
return retrieveConfig({
|
|
2587
|
-
plugin: plugin,
|
|
2588
|
-
token: token,
|
|
2589
|
-
apiHost: apiHost,
|
|
2590
|
-
accountId: accountId,
|
|
2591
|
-
});
|
|
2592
|
-
},
|
|
2593
|
-
staleTime: 0,
|
|
2594
|
-
}).data;
|
|
2595
|
-
if (!finixConfig || !finixConfig.application_id)
|
|
2582
|
+
var _c = useStripePlugin(plugin, token, apiHost, accountId), stripe = _c.stripe, options = _c.options;
|
|
2583
|
+
if (!stripe)
|
|
2596
2584
|
return null;
|
|
2597
|
-
return (jsx(
|
|
2598
|
-
};
|
|
2599
|
-
var FinixAchPaymentForm = function (_a) {
|
|
2600
|
-
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;
|
|
2601
|
-
// Context
|
|
2602
|
-
var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, accountId = _b.accountId, window = _b.window;
|
|
2603
|
-
var isMobile = useIsMobile();
|
|
2604
|
-
// Local state
|
|
2605
|
-
var _c = useState(), finixForm = _c[0], setFinixForm = _c[1];
|
|
2606
|
-
var _d = useState(false), savePaymentMethod = _d[0], setSavePaymentMethod = _d[1];
|
|
2607
|
-
// Derived state
|
|
2608
|
-
var onlySavePaymentMethod = !quote && !invoice;
|
|
2609
|
-
var amountDue = quote ? getQuoteAmountDue(quote) : invoice === null || invoice === void 0 ? void 0 : invoice.amountDue;
|
|
2610
|
-
var currencyId = (quote === null || quote === void 0 ? void 0 : quote.currencyId) || (invoice === null || invoice === void 0 ? void 0 : invoice.currency);
|
|
2611
|
-
var onPaymentSubmit = function () {
|
|
2612
|
-
setIsSaving(true);
|
|
2613
|
-
try {
|
|
2614
|
-
var finixAchCallback_1 = function (error, response, fraud_session_id) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2615
|
-
var tokenData, finixToken, message, response_1, e_1;
|
|
2616
|
-
return __generator(this, function (_a) {
|
|
2617
|
-
switch (_a.label) {
|
|
2618
|
-
case 0:
|
|
2619
|
-
_a.trys.push([0, 3, , 4]);
|
|
2620
|
-
tokenData = response.data || {};
|
|
2621
|
-
finixToken = tokenData.id;
|
|
2622
|
-
if (error) {
|
|
2623
|
-
message = formatFinixError(response);
|
|
2624
|
-
throw new Error(message);
|
|
2625
|
-
}
|
|
2626
|
-
if (!finixToken) {
|
|
2627
|
-
throw new Error("payment token couldn't be retrieved");
|
|
2628
|
-
}
|
|
2629
|
-
if (!onlySavePaymentMethod) return [3 /*break*/, 2];
|
|
2630
|
-
return [4 /*yield*/, invokePlugin({
|
|
2631
|
-
plugin: plugin,
|
|
2632
|
-
method: "store_payment_method",
|
|
2633
|
-
payload: {
|
|
2634
|
-
finix_token: finixToken,
|
|
2635
|
-
fraud_session_id: fraud_session_id,
|
|
2636
|
-
account_id: accountId,
|
|
2637
|
-
},
|
|
2638
|
-
token: token,
|
|
2639
|
-
apiHost: apiHost,
|
|
2640
|
-
})];
|
|
2641
|
-
case 1:
|
|
2642
|
-
response_1 = _a.sent();
|
|
2643
|
-
if (response_1.status === "failed") {
|
|
2644
|
-
throw new Error(response_1.message);
|
|
2645
|
-
}
|
|
2646
|
-
return [2 /*return*/, onPaymentSuccess({})];
|
|
2647
|
-
case 2:
|
|
2648
|
-
onPaymentSuccess({
|
|
2649
|
-
pluginPaymentResponse: {
|
|
2650
|
-
token: finixToken,
|
|
2651
|
-
savePaymentMethod: savePaymentMethod,
|
|
2652
|
-
plugin: plugin,
|
|
2653
|
-
metadata: {
|
|
2654
|
-
fraud_session_id: fraud_session_id,
|
|
2655
|
-
},
|
|
2656
|
-
},
|
|
2657
|
-
});
|
|
2658
|
-
return [3 /*break*/, 4];
|
|
2659
|
-
case 3:
|
|
2660
|
-
e_1 = _a.sent();
|
|
2661
|
-
// Catch any errors during AFTER submission, during Callback
|
|
2662
|
-
onFail(e_1);
|
|
2663
|
-
return [3 /*break*/, 4];
|
|
2664
|
-
case 4: return [2 /*return*/];
|
|
2665
|
-
}
|
|
2666
|
-
});
|
|
2667
|
-
}); };
|
|
2668
|
-
window.Finix.Auth(finixConfig.environment, finixConfig.merchant_id, function (fraud_session_id) {
|
|
2669
|
-
finixForm === null || finixForm === void 0 ? void 0 : finixForm.submit(finixConfig.environment, finixConfig.application_id, function (error, response) {
|
|
2670
|
-
return finixAchCallback_1(error, response, fraud_session_id);
|
|
2671
|
-
});
|
|
2672
|
-
});
|
|
2673
|
-
}
|
|
2674
|
-
catch (e) {
|
|
2675
|
-
// Catch any errors during configuration and submission
|
|
2676
|
-
onFail(e);
|
|
2677
|
-
}
|
|
2678
|
-
};
|
|
2679
|
-
useEffect(function () {
|
|
2680
|
-
if (!finixForm) {
|
|
2681
|
-
var newFinixForm = window.Finix.BankTokenForm(FINIX_FORM_ID, finixOptions(isMobile));
|
|
2682
|
-
setFinixForm(newFinixForm);
|
|
2683
|
-
}
|
|
2684
|
-
}, [finixForm, isMobile]);
|
|
2685
|
-
return (jsxs(Fragment, { children: [jsx("div", { id: FINIX_FORM_ID }), !onlySavePaymentMethod && (jsx(Checkbox, __assign({ className: "mt-2", onChange: function (e) { return setSavePaymentMethod(e.target.checked); } }, { children: "Save as primary payment method" }))), jsx(CheckoutFooter, { amountDue: amountDue, currencyId: currencyId, onPaymentSubmit: onPaymentSubmit, isSaving: isSaving, onlySavePaymentMethod: onlySavePaymentMethod })] }));
|
|
2585
|
+
return (jsx(Elements, __assign({ options: options, stripe: stripe }, { children: jsx(PaymentMethodForm, { plugin: plugin, onFail: onFail, onSavePaymentMethod: onSavePaymentMethod }) })));
|
|
2686
2586
|
};
|
|
2687
2587
|
|
|
2688
|
-
var
|
|
2588
|
+
var PaymentMethodDetails = function (_a) {
|
|
2689
2589
|
var _b, _c;
|
|
2690
|
-
var
|
|
2590
|
+
var onFail = _a.onFail, paymentMethod = _a.paymentMethod, onSavePaymentMethod = _a.onSavePaymentMethod;
|
|
2691
2591
|
if (!paymentMethod)
|
|
2692
2592
|
return null;
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
case "FinixAchPayment":
|
|
2702
|
-
return (jsx(FinixAchPayment, { entityId: entityId, invoice: invoice, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, plugin: paymentMethod, quote: quote, setIsSaving: setIsSaving }));
|
|
2703
|
-
case "DemoPayPayment":
|
|
2704
|
-
return (jsx(DemoPayForm, { entityId: entityId, invoice: invoice, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, plugin: paymentMethod, quote: quote, setIsSaving: setIsSaving }));
|
|
2705
|
-
default:
|
|
2706
|
-
return jsx("p", { children: "Can not find form for plugin" });
|
|
2707
|
-
}
|
|
2593
|
+
paymentMethod = paymentMethod;
|
|
2594
|
+
switch ((_c = (_b = paymentMethod.components) === null || _b === void 0 ? void 0 : _b.frontend) === null || _c === void 0 ? void 0 : _c[0].name) {
|
|
2595
|
+
case "StripePayment":
|
|
2596
|
+
return (jsx(StripeForm, { onFail: onFail, onSavePaymentMethod: onSavePaymentMethod, plugin: paymentMethod }));
|
|
2597
|
+
case "DemoPayPayment":
|
|
2598
|
+
return (jsx(DemoPayForm, { onFail: onFail, onSavePaymentMethod: onSavePaymentMethod, plugin: paymentMethod }));
|
|
2599
|
+
default:
|
|
2600
|
+
return jsx("p", { children: "Can not find form for plugin" });
|
|
2708
2601
|
}
|
|
2709
|
-
else if (quote || invoice)
|
|
2710
|
-
return (jsx(StoredPaymentMethodForm, { entityId: entityId, invoice: invoice, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, paymentMethod: paymentMethod, quote: quote, setIsSaving: setIsSaving }));
|
|
2711
|
-
return null;
|
|
2712
2602
|
};
|
|
2713
2603
|
|
|
2714
|
-
var
|
|
2715
|
-
|
|
2716
|
-
return useQuery({
|
|
2717
|
-
queryKey: QueryKeyFactory.default.pluginsKey,
|
|
2718
|
-
queryFn: function () {
|
|
2719
|
-
var plugins = getPlugins({
|
|
2720
|
-
entityId: entityId,
|
|
2721
|
-
token: token,
|
|
2722
|
-
apiHost: apiHost,
|
|
2723
|
-
});
|
|
2724
|
-
return plugins;
|
|
2725
|
-
},
|
|
2726
|
-
enabled: Boolean(entityId),
|
|
2727
|
-
});
|
|
2604
|
+
var CardIcon = function () {
|
|
2605
|
+
return (jsxs("svg", __assign({ width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: [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: SLATE_400, strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), jsx("path", { d: "M1.5 7.5H16.5", stroke: SLATE_400, strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })] })));
|
|
2728
2606
|
};
|
|
2729
2607
|
|
|
2730
|
-
var
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
((_b = plugin.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === "valid" &&
|
|
2735
|
-
((_d = (_c = plugin.components) === null || _c === void 0 ? void 0 : _c.frontend) === null || _d === void 0 ? void 0 : _d.length);
|
|
2736
|
-
});
|
|
2608
|
+
var Text$d = Typography.Text;
|
|
2609
|
+
var PaymentMethodSelector = function (_a) {
|
|
2610
|
+
var paymentMethodAllowedPlugins = _a.paymentMethodAllowedPlugins, onSelect = _a.onSelect, value = _a.value;
|
|
2611
|
+
return (jsx("div", __assign({ className: "flex flex-col gap-2" }, { children: paymentMethodAllowedPlugins === null || paymentMethodAllowedPlugins === void 0 ? void 0 : paymentMethodAllowedPlugins.map(function (plugin, index) { return (jsx(PaymentOption, { name: plugin.name, onClick: onSelect, paymentOption: plugin, selected: (value === null || value === void 0 ? void 0 : value.id) === plugin.id }, index)); }) })));
|
|
2737
2612
|
};
|
|
2738
|
-
var
|
|
2739
|
-
var
|
|
2740
|
-
var
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
var _a, _b;
|
|
2748
|
-
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"); });
|
|
2749
|
-
});
|
|
2750
|
-
return {
|
|
2751
|
-
paymentPlugins: paymentPlugins,
|
|
2752
|
-
paymentMethodAllowedPlugins: paymentMethodAllowedPlugins,
|
|
2753
|
-
isFetched: isFetched,
|
|
2754
|
-
};
|
|
2613
|
+
var PaymentOption = function (_a) {
|
|
2614
|
+
var selected = _a.selected, paymentOption = _a.paymentOption, onClick = _a.onClick, name = _a.name;
|
|
2615
|
+
var brandColor = useContext(BrandContext).brandColor;
|
|
2616
|
+
var darkMode = useContext(BunnyContext).darkMode;
|
|
2617
|
+
var isAch = name === null || name === void 0 ? void 0 : name.toLowerCase().includes("ach");
|
|
2618
|
+
var isCard = name === null || name === void 0 ? void 0 : name.toLowerCase().includes("card");
|
|
2619
|
+
return (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
|
|
2620
|
+
? "var(--row-background-dark) border-gray-500"
|
|
2621
|
+
: "bg-slate-50 border-slate-200", " border"), onClick: function () { return onClick(paymentOption); } }, { children: [jsxs("div", __assign({ className: "flex gap-2 items-center" }, { children: [jsx(Checkbox, { checked: selected, className: darkMode ? "border-gray-400" : "" }), jsx(Text$d, { children: name })] })), isAch ? (jsx(BankOutlined$1, { className: "text-slate-400" })) : isCard ? (jsx(CardIcon, {})) : (jsx(CardIcon, {}))] })));
|
|
2755
2622
|
};
|
|
2623
|
+
var PaymentOptionContainer = styled.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) {
|
|
2624
|
+
var $brandColor = _a.$brandColor, $selected = _a.$selected;
|
|
2625
|
+
return $selected &&
|
|
2626
|
+
"\n border-color: ".concat($brandColor, ";\n ");
|
|
2627
|
+
}, function (_a) {
|
|
2628
|
+
var $brandColor = _a.$brandColor;
|
|
2629
|
+
return $brandColor;
|
|
2630
|
+
});
|
|
2631
|
+
var templateObject_1$6;
|
|
2756
2632
|
|
|
2757
|
-
|
|
2758
|
-
var
|
|
2759
|
-
var
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2633
|
+
function useRemovePaymentMethod(paymentPlugins, token, apiHost, accountId) {
|
|
2634
|
+
var queryClient = useQueryClient();
|
|
2635
|
+
var showErrorNotification = useErrorNotification();
|
|
2636
|
+
var showSuccessNotification = useSuccessNotification();
|
|
2637
|
+
var removePaymentMethod = useCallback(function (data) {
|
|
2638
|
+
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); });
|
|
2639
|
+
if (data && plugin) {
|
|
2640
|
+
invokePlugin({
|
|
2641
|
+
plugin: plugin,
|
|
2642
|
+
method: "remove_payment_method",
|
|
2643
|
+
payload: {
|
|
2644
|
+
payment_method_id: data.id,
|
|
2645
|
+
account_id: accountId,
|
|
2646
|
+
},
|
|
2647
|
+
token: token,
|
|
2648
|
+
apiHost: apiHost,
|
|
2649
|
+
})
|
|
2650
|
+
.then(function () {
|
|
2651
|
+
showSuccessNotification("Payment method was removed", "Success");
|
|
2652
|
+
queryClient.setQueryData(QueryKeyFactory.default.accountPaymentMethodKey, null);
|
|
2653
|
+
})
|
|
2654
|
+
.catch(function (error) {
|
|
2655
|
+
showErrorNotification(error.message, "Error removing payment method");
|
|
2656
|
+
});
|
|
2657
|
+
}
|
|
2658
|
+
}, [paymentPlugins, token, apiHost, queryClient]);
|
|
2659
|
+
return removePaymentMethod;
|
|
2660
|
+
}
|
|
2661
|
+
|
|
2662
|
+
var Panel = Collapse.Panel;
|
|
2663
|
+
var PaymentForm = function (_a) {
|
|
2664
|
+
var entityId = _a.entityId, invoice = _a.invoice, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, quote = _a.quote, accountId = _a.accountId, onSavePaymentMethod = _a.onSavePaymentMethod;
|
|
2770
2665
|
// Local state
|
|
2771
2666
|
var _b = useState(), selectedPaymentMethod = _b[0], setSelectedPaymentMethod = _b[1];
|
|
2772
|
-
var _c =
|
|
2773
|
-
var
|
|
2774
|
-
//
|
|
2667
|
+
var _c = useState(false), showPaymentMethodForm = _c[0], setShowPaymentMethodForm = _c[1];
|
|
2668
|
+
var paying = !!(quote || invoice);
|
|
2669
|
+
// Hooks
|
|
2670
|
+
var _d = useContext(BunnyContext), token = _d.token, apiHost = _d.apiHost, graphQLClient = _d.graphQLClient;
|
|
2671
|
+
var storedPaymentMethod = usePaymentMethod(graphQLClient, accountId).data;
|
|
2775
2672
|
var isPaymentMethodFetched = storedPaymentMethod !== undefined;
|
|
2776
|
-
var
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
var showStoredPaymentMethodOption = Boolean(quote || invoice);
|
|
2780
|
-
var isPlugin = !(selectedPaymentMethod === null || selectedPaymentMethod === void 0 ? void 0 : selectedPaymentMethod.metadata);
|
|
2673
|
+
var _e = usePaymentPlugins({ entityId: entityId, apiHost: apiHost, token: token }), paymentMethodAllowedPlugins = _e.paymentMethodAllowedPlugins, arePluginsFetched = _e.isFetched;
|
|
2674
|
+
var onClickRemove = useRemovePaymentMethod(paymentMethodAllowedPlugins || [], token, apiHost, accountId);
|
|
2675
|
+
var queryClient = useQueryClient();
|
|
2781
2676
|
// Set default plugin
|
|
2782
2677
|
useEffect(function () {
|
|
2783
2678
|
if (!arePluginsFetched ||
|
|
@@ -2785,34 +2680,53 @@ var ActualPaymentForm = function (_a) {
|
|
|
2785
2680
|
selectedPaymentMethod) {
|
|
2786
2681
|
return;
|
|
2787
2682
|
}
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2683
|
+
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); });
|
|
2684
|
+
if (pluginPaymentMethod) {
|
|
2685
|
+
setSelectedPaymentMethod(pluginPaymentMethod);
|
|
2686
|
+
}
|
|
2687
|
+
else if (paymentMethodAllowedPlugins === null || paymentMethodAllowedPlugins === void 0 ? void 0 : paymentMethodAllowedPlugins[0]) {
|
|
2688
|
+
setSelectedPaymentMethod(paymentMethodAllowedPlugins === null || paymentMethodAllowedPlugins === void 0 ? void 0 : paymentMethodAllowedPlugins[0]);
|
|
2689
|
+
}
|
|
2792
2690
|
}, [
|
|
2793
2691
|
arePluginsFetched,
|
|
2794
2692
|
isPaymentMethodFetched,
|
|
2795
2693
|
paymentMethodAllowedPlugins,
|
|
2796
2694
|
selectedPaymentMethod,
|
|
2797
2695
|
setSelectedPaymentMethod,
|
|
2798
|
-
showStoredPaymentMethodOption,
|
|
2799
2696
|
storedPaymentMethod,
|
|
2800
2697
|
]);
|
|
2801
2698
|
var showPaymentMethodSelector = useMemo(function () {
|
|
2802
2699
|
var pluginCount = (paymentMethodAllowedPlugins === null || paymentMethodAllowedPlugins === void 0 ? void 0 : paymentMethodAllowedPlugins.length) || 0;
|
|
2803
|
-
return
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2700
|
+
return pluginCount > 1;
|
|
2701
|
+
}, [paymentMethodAllowedPlugins]);
|
|
2702
|
+
var handlePaymentSuccess = function (_a) {
|
|
2703
|
+
var pluginPaymentResponse = _a.pluginPaymentResponse, savedPaymentMethodResponse = _a.savedPaymentMethodResponse;
|
|
2704
|
+
// Hide payment method selector and form
|
|
2705
|
+
setShowPaymentMethodForm(false);
|
|
2706
|
+
// Set new selected payment method
|
|
2707
|
+
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); });
|
|
2708
|
+
setSelectedPaymentMethod(paymentMethod);
|
|
2709
|
+
// Handle success keeps going up component tree
|
|
2710
|
+
onPaymentSuccess === null || onPaymentSuccess === void 0 ? void 0 : onPaymentSuccess({
|
|
2711
|
+
pluginPaymentResponse: pluginPaymentResponse,
|
|
2712
|
+
savedPaymentMethodResponse: savedPaymentMethodResponse,
|
|
2713
|
+
});
|
|
2714
|
+
};
|
|
2715
|
+
var handleSavePaymentMethod = function () {
|
|
2716
|
+
queryClient.invalidateQueries({
|
|
2717
|
+
queryKey: QueryKeyFactory.default.accountPaymentMethodKey,
|
|
2718
|
+
});
|
|
2719
|
+
onSavePaymentMethod === null || onSavePaymentMethod === void 0 ? void 0 : onSavePaymentMethod();
|
|
2720
|
+
setShowPaymentMethodForm(false);
|
|
2721
|
+
};
|
|
2722
|
+
return (jsx(PaymentContext.Provider, __assign({ value: {
|
|
2723
|
+
onClickCancel: function () { return setShowPaymentMethodForm(false); },
|
|
2724
|
+
accountId: accountId,
|
|
2725
|
+
} }, { children: jsx("div", __assign({ className: "flex flex-col gap-0 w-full" }, { children: jsxs(Fragment, { children: [jsx("div", __assign({ className: "".concat(!showPaymentMethodForm ? "px-0" : "px-4") }, { children: jsx(MiniCreditCard, { hideRemoveButton: paying, onClickRemove: function () { return onClickRemove(storedPaymentMethod); }, paymentMethodData: storedPaymentMethod }) })), paying && storedPaymentMethod ? (jsx(CheckoutFooter, { quote: quote, invoice: invoice, onPaymentSuccess: handlePaymentSuccess, plugin: selectedPaymentMethod })) : (
|
|
2726
|
+
//if not paying and payment method is saved, show Collapse
|
|
2727
|
+
jsx(Collapse, __assign({ bordered: false, activeKey: showPaymentMethodForm ? "1" : undefined, ghost: true, collapsible: "disabled", destroyInactivePanel: true }, { children: jsx(Panel, __assign({ header: jsx(Fragment, { children: !showPaymentMethodForm ? (jsx("div", __assign({ className: "pt-4" }, { children: jsxs(Button, __assign({ onClick: function () {
|
|
2728
|
+
setShowPaymentMethodForm(true);
|
|
2729
|
+
}, type: "default", className: "w-full" }, { children: [storedPaymentMethod ? "Update" : "Add", " payment method"] })) }))) : null }), showArrow: false }, { children: jsx("div", { children: selectedPaymentMethod ? (jsxs("div", __assign({ className: "flex flex-col gap-2 mt-2" }, { children: [showPaymentMethodSelector && (jsx(PaymentMethodSelector, { onSelect: setSelectedPaymentMethod, paymentMethodAllowedPlugins: paymentMethodAllowedPlugins, value: selectedPaymentMethod })), jsx("div", __assign({ className: "flex flex-col" }, { children: jsx(PaymentMethodDetails, { onFail: onFail, onSavePaymentMethod: handleSavePaymentMethod, paymentMethod: selectedPaymentMethod }) }))] }))) : (jsx("div", { children: "No payment method selected" })) }) }), "1") })))] }) })) })));
|
|
2816
2730
|
};
|
|
2817
2731
|
|
|
2818
2732
|
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";
|
|
@@ -2850,9 +2764,8 @@ var checkout = function (_a) {
|
|
|
2850
2764
|
});
|
|
2851
2765
|
};
|
|
2852
2766
|
|
|
2853
|
-
var InvoiceCheckoutContext = createContext({});
|
|
2854
2767
|
var InvoiceCheckout = function (_a) {
|
|
2855
|
-
var
|
|
2768
|
+
var onSuccess = _a.onSuccess, onFail = _a.onFail, invoice = _a.invoice, entityId = _a.entityId;
|
|
2856
2769
|
var _b = useContext(BunnyContext), apiHost = _b.apiHost, token = _b.token;
|
|
2857
2770
|
var checkoutMutation = useMutation({
|
|
2858
2771
|
mutationFn: function (_a) {
|
|
@@ -2916,14 +2829,7 @@ var InvoiceCheckout = function (_a) {
|
|
|
2916
2829
|
});
|
|
2917
2830
|
});
|
|
2918
2831
|
};
|
|
2919
|
-
return (jsx(
|
|
2920
|
-
preCheckout: preCheckout,
|
|
2921
|
-
payImmediatelyGivenInvoice: payImmediatelyGivenInvoice,
|
|
2922
|
-
checkoutButtonName: checkoutButtonName,
|
|
2923
|
-
invoice: invoice,
|
|
2924
|
-
setIsPreCheckoutLoading: setIsPreCheckoutLoading,
|
|
2925
|
-
isPreCheckoutLoading: isPreCheckoutLoading,
|
|
2926
|
-
} }, { children: jsx(PaymentForm, { entityId: entityId, isSaving: isSaving, onPaymentSuccess: handleCheckout, onFail: onFail, invoice: invoice, setIsSaving: setIsSaving }) })));
|
|
2832
|
+
return (jsx("div", __assign({ className: "w-full pt-12" }, { children: jsx(PaymentForm, { entityId: entityId, onPaymentSuccess: handleCheckout, onFail: onFail, invoice: invoice }) })));
|
|
2927
2833
|
};
|
|
2928
2834
|
|
|
2929
2835
|
var fetchPDF = function (window, apiEndpoint, invoiceUuid) { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -2969,31 +2875,39 @@ function InvoicePDF(_a) {
|
|
|
2969
2875
|
}, title: "Invoice PDF", width: "100%" }));
|
|
2970
2876
|
}
|
|
2971
2877
|
|
|
2972
|
-
var
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2878
|
+
var InvoiceQuoteContext = createContext({});
|
|
2879
|
+
function Invoice(_a) {
|
|
2880
|
+
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;
|
|
2881
|
+
return (jsx(HelmetProvider, { children: jsx(InvoiceQuoteContext.Provider, __assign({ value: {
|
|
2882
|
+
id: id,
|
|
2883
|
+
invoiceQuoteViewComponent: invoiceQuoteViewComponent,
|
|
2884
|
+
backButtonName: backButtonName,
|
|
2885
|
+
onBackButtonClick: onBackButtonClick,
|
|
2886
|
+
onInvoiceDownloadError: onInvoiceDownloadError,
|
|
2887
|
+
onPaymentSuccess: onPaymentSuccess,
|
|
2888
|
+
entityId: entityId,
|
|
2889
|
+
shadow: shadow,
|
|
2890
|
+
className: className,
|
|
2891
|
+
hideDownloadButton: hideDownloadButton,
|
|
2892
|
+
} }, { children: jsx(ActualInvoice, {}) })) }));
|
|
2893
|
+
}
|
|
2894
|
+
function ActualInvoice() {
|
|
2895
|
+
// Context
|
|
2985
2896
|
var queryClient = useQueryClient();
|
|
2986
|
-
var
|
|
2897
|
+
var _a = useContext(InvoiceQuoteContext), id = _a.id, invoiceQuoteViewComponent = _a.invoiceQuoteViewComponent, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick, onPaymentSuccess = _a.onPaymentSuccess, entityId = _a.entityId, className = _a.className;
|
|
2898
|
+
var _b = useContext(BunnyContext), apiHost = _b.apiHost, token = _b.token, onTokenExpired = _b.onTokenExpired;
|
|
2899
|
+
// Local state
|
|
2900
|
+
var isMobile = useIsMobile();
|
|
2901
|
+
// Hooks
|
|
2987
2902
|
var showSuccessNotification = useSuccessNotification();
|
|
2988
|
-
var handleAllErrorFormats = useAllErrorFormats(
|
|
2989
|
-
(function (url) {
|
|
2990
|
-
console.log("navigate to", url, " not implemented");
|
|
2991
|
-
}));
|
|
2903
|
+
var handleAllErrorFormats = useAllErrorFormats(onTokenExpired);
|
|
2992
2904
|
// Queries
|
|
2993
|
-
var
|
|
2905
|
+
var _c = useQuery({
|
|
2994
2906
|
queryKey: QueryKeyFactory.default.createFormattedInvoiceKey(token, id),
|
|
2995
2907
|
queryFn: function () { return getFormattedInvoice({ id: id, token: token, apiHost: apiHost }); },
|
|
2996
|
-
}), formattedInvoice =
|
|
2908
|
+
}), formattedInvoice = _c.data, error = _c.error;
|
|
2909
|
+
// Derived state
|
|
2910
|
+
var isInvoicePayable = PAYABLE_INVOICE_STATES.includes((formattedInvoice === null || formattedInvoice === void 0 ? void 0 : formattedInvoice.state) || "");
|
|
2997
2911
|
if (error) {
|
|
2998
2912
|
return jsxs("div", { children: ["Error loading invoice: ", error.message] });
|
|
2999
2913
|
}
|
|
@@ -3017,19 +2931,12 @@ function ActualInvoice(_a) {
|
|
|
3017
2931
|
var onFail = function (error) {
|
|
3018
2932
|
handleAllErrorFormats(error.message);
|
|
3019
2933
|
};
|
|
3020
|
-
// Derived state
|
|
3021
|
-
var isInvoicePayable = PAYABLE_INVOICE_STATES.includes((formattedInvoice === null || formattedInvoice === void 0 ? void 0 : formattedInvoice.state) || "");
|
|
3022
2934
|
return (jsxs(Fragment, { children: [jsxs(Helmet, { children: [jsxs("title", { children: [formattedInvoice.vendorName, " ", DOCUMENT_NAME$1.INVOICE] }), jsx("meta", { name: "description", content: quoteMetaDescription(formattedInvoice.vendorName) }), jsx("meta", { property: "og:type", content: "website" }), jsx("meta", { property: "og:title", content: quoteMetaTitle({
|
|
3023
2935
|
vendorName: formattedInvoice.vendorName,
|
|
3024
2936
|
documentName: DOCUMENT_NAME$1.INVOICE,
|
|
3025
|
-
}) }), jsx("meta", { property: "og:description", content: quoteMetaDescription(formattedInvoice.vendorName) })] }), jsxs("div", __assign({ className: "flex gap-6 ".concat(isMobile ? "flex-col w-full overflow-hidden" : "shadow-padding-xb") }, { children: [formattedInvoice.isLegacy ? (jsx("div", __assign({ className: "flex justify-center w-full" }, { children: jsx(InvoicePDF, { invoiceUuid: formattedInvoice.uuid, apiHost: apiHost }) }))) : (invoiceQuoteViewComponent || (jsx(InvoiceQuoteView, { html: formattedInvoice.html, formattedInvoice: formattedInvoice, backButtonName: backButtonName, onBackButtonClick: onBackButtonClick }))), !isMobile && isInvoicePayable && (jsx(Divider, { className: "h-full", type: "vertical" })), isInvoicePayable && (jsx(InvoiceCheckout, { invoice: formattedInvoice,
|
|
2937
|
+
}) }), jsx("meta", { property: "og:description", content: quoteMetaDescription(formattedInvoice.vendorName) })] }), jsxs("div", __assign({ className: "flex gap-6 ".concat(isMobile ? "flex-col w-full overflow-hidden" : "shadow-padding-xb", " ").concat(className) }, { children: [formattedInvoice.isLegacy ? (jsx("div", __assign({ className: "flex justify-center w-full" }, { children: jsx(InvoicePDF, { invoiceUuid: formattedInvoice.uuid, apiHost: apiHost }) }))) : (invoiceQuoteViewComponent || (jsx(InvoiceQuoteView, { html: formattedInvoice.html, formattedInvoice: formattedInvoice, backButtonName: backButtonName, onBackButtonClick: onBackButtonClick }))), !isMobile && isInvoicePayable && (jsx(Divider, { className: "h-full", type: "vertical" })), isInvoicePayable && (jsx(InvoiceCheckout, { invoice: formattedInvoice, onFail: function (error) {
|
|
3026
2938
|
onFail(error);
|
|
3027
|
-
|
|
3028
|
-
}, onSuccess: onSuccess, setIsSaving: setIsSaving, entityId: entityId }))] }))] }));
|
|
3029
|
-
}
|
|
3030
|
-
function Invoice(_a) {
|
|
3031
|
-
var id = _a.id, invoiceQuoteViewComponent = _a.invoiceQuoteViewComponent, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick; _a.onInvoiceDownloadError; var onPaymentSuccess = _a.onPaymentSuccess, entityId = _a.entityId;
|
|
3032
|
-
return (jsx(HelmetProvider, { children: jsx(ActualInvoice, { id: id, invoiceQuoteViewComponent: invoiceQuoteViewComponent, backButtonName: backButtonName, onBackButtonClick: onBackButtonClick, onPaymentSuccess: onPaymentSuccess, entityId: entityId }) }));
|
|
2939
|
+
}, onSuccess: onSuccess, entityId: entityId }))] }))] }));
|
|
3033
2940
|
}
|
|
3034
2941
|
|
|
3035
2942
|
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 }"; };
|
|
@@ -3047,6 +2954,9 @@ var getFormattedQuote = function (_a) {
|
|
|
3047
2954
|
})];
|
|
3048
2955
|
case 1:
|
|
3049
2956
|
response = _b.sent();
|
|
2957
|
+
if (response === null || response === void 0 ? void 0 : response.formattedQuote.error) {
|
|
2958
|
+
throw new Error(response === null || response === void 0 ? void 0 : response.formattedQuote.error);
|
|
2959
|
+
}
|
|
3050
2960
|
return [2 /*return*/, response === null || response === void 0 ? void 0 : response.formattedQuote];
|
|
3051
2961
|
}
|
|
3052
2962
|
});
|
|
@@ -3067,17 +2977,14 @@ var useSigningPlugins = function (_a) {
|
|
|
3067
2977
|
};
|
|
3068
2978
|
|
|
3069
2979
|
var useSendAcceptQuote = function (_a) {
|
|
3070
|
-
var entityId = _a.entityId,
|
|
2980
|
+
var entityId = _a.entityId, onTokenExpired = _a.onTokenExpired, quoteId = _a.quoteId, apiHost = _a.apiHost, token = _a.token;
|
|
3071
2981
|
// Hooks
|
|
3072
2982
|
var graphQLMutation = useGraphQLmutation(function () {
|
|
3073
2983
|
console.log("navigate in useGraphQLmutation in useSendAcceptQuote is not yet implemented");
|
|
3074
2984
|
}, apiHost || "", function () {
|
|
3075
2985
|
console.log("onError in useGraphQLmutation in useSendAcceptQuote is not yet implemented");
|
|
3076
2986
|
});
|
|
3077
|
-
var handleAllErrorFormats = useAllErrorFormats(
|
|
3078
|
-
(function (url) {
|
|
3079
|
-
console.log("navigate to", url, " not implemented");
|
|
3080
|
-
}));
|
|
2987
|
+
var handleAllErrorFormats = useAllErrorFormats(onTokenExpired);
|
|
3081
2988
|
var signingPlugins = useSigningPlugins({ entityId: entityId, apiHost: apiHost, token: token });
|
|
3082
2989
|
var queryClient = useQueryClient();
|
|
3083
2990
|
// Local state
|
|
@@ -3190,27 +3097,19 @@ var useSigningComplete = function (_a) {
|
|
|
3190
3097
|
}, [data, eventParam, queryClient, token]);
|
|
3191
3098
|
};
|
|
3192
3099
|
|
|
3193
|
-
var dayjs_min = {exports: {}};
|
|
3194
|
-
|
|
3195
|
-
(function (module, exports) {
|
|
3196
|
-
!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}));
|
|
3197
|
-
}(dayjs_min));
|
|
3198
|
-
|
|
3199
|
-
var dayjs = dayjs_min.exports;
|
|
3200
|
-
|
|
3201
3100
|
var useIsExpired = function (expiresAt) {
|
|
3202
3101
|
return dayjs(expiresAt).diff(dayjs(dayjs().format("YYYY-MM-DD"))) < 0;
|
|
3203
3102
|
};
|
|
3204
3103
|
|
|
3205
3104
|
var PandadocPollingModal = function (_a) {
|
|
3206
3105
|
var isVisible = _a.isVisible, setVisible = _a.setVisible, id = _a.id;
|
|
3207
|
-
var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost,
|
|
3106
|
+
var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, onTokenExpired = _b.onTokenExpired;
|
|
3208
3107
|
var graphQLMutation = useGraphQLmutation(function () {
|
|
3209
3108
|
console.log("graphQLMutation navigateOnTokenExpired not yet implemented");
|
|
3210
3109
|
}, apiHost || "", function () {
|
|
3211
3110
|
console.log("graphQLMutation onError not yet implemented");
|
|
3212
3111
|
});
|
|
3213
|
-
var handleAllErrorFormats = useAllErrorFormats(
|
|
3112
|
+
var handleAllErrorFormats = useAllErrorFormats(onTokenExpired);
|
|
3214
3113
|
var _c = useState(0), numberOfPolls = _c[0], setNumberOfPolls = _c[1];
|
|
3215
3114
|
var _d = useState(""), infoMessage = _d[0], setInfoMessage = _d[1];
|
|
3216
3115
|
useEffect(function () {
|
|
@@ -3290,58 +3189,82 @@ var DOCUMENT_NAME;
|
|
|
3290
3189
|
DOCUMENT_NAME["QUOTE"] = "quote";
|
|
3291
3190
|
})(DOCUMENT_NAME || (DOCUMENT_NAME = {}));
|
|
3292
3191
|
|
|
3192
|
+
var Text$c = Typography.Text;
|
|
3293
3193
|
var documentName = DOCUMENT_NAME.QUOTE;
|
|
3194
|
+
styled.div(templateObject_1$4 || (templateObject_1$4 = __makeTemplateObject(["\n span {\n width: 100%;\n }\n"], ["\n span {\n width: 100%;\n }\n"])));
|
|
3195
|
+
function Quote(_a) {
|
|
3196
|
+
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;
|
|
3197
|
+
return (jsx(HelmetProvider, { children: jsx(InvoiceQuoteContext.Provider, __assign({ value: {
|
|
3198
|
+
id: id,
|
|
3199
|
+
invoiceQuoteViewComponent: invoiceQuoteViewComponent,
|
|
3200
|
+
onInvoiceDownloadError: onInvoiceDownloadError,
|
|
3201
|
+
onPaymentSuccess: onPaymentSuccess,
|
|
3202
|
+
entityId: entityId,
|
|
3203
|
+
shadow: shadow,
|
|
3204
|
+
className: className,
|
|
3205
|
+
hideDownloadButton: hideDownloadButton,
|
|
3206
|
+
} }, { children: jsx(ActualQuote, { entityId: entityId }) })) }));
|
|
3207
|
+
}
|
|
3294
3208
|
function ActualQuote(_a) {
|
|
3209
|
+
var _this = this;
|
|
3295
3210
|
var _b, _c;
|
|
3296
|
-
var
|
|
3297
|
-
|
|
3211
|
+
var entityId = _a.entityId;
|
|
3212
|
+
// Context
|
|
3213
|
+
var _d = useContext(BunnyContext), token = _d.token, apiHost = _d.apiHost, onTokenExpired = _d.onTokenExpired;
|
|
3298
3214
|
var entityBranding = useContext(BrandContext);
|
|
3299
|
-
var
|
|
3215
|
+
var _e = useContext(InvoiceQuoteContext), className = _e.className, id = _e.id, hideDownloadButton = _e.hideDownloadButton;
|
|
3300
3216
|
// Queries
|
|
3301
|
-
var
|
|
3217
|
+
var _f = useQuery({
|
|
3302
3218
|
queryKey: QueryKeyFactory.default.createQuoteKey(token, id),
|
|
3303
|
-
queryFn: function () { return
|
|
3219
|
+
queryFn: function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3220
|
+
var error_1;
|
|
3221
|
+
return __generator(this, function (_a) {
|
|
3222
|
+
switch (_a.label) {
|
|
3223
|
+
case 0:
|
|
3224
|
+
_a.trys.push([0, 2, , 3]);
|
|
3225
|
+
return [4 /*yield*/, getFormattedQuote({ token: token, apiHost: apiHost, id: id })];
|
|
3226
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
3227
|
+
case 2:
|
|
3228
|
+
error_1 = _a.sent();
|
|
3229
|
+
showErrorNotification(error_1.message);
|
|
3230
|
+
return [3 /*break*/, 3];
|
|
3231
|
+
case 3: return [2 /*return*/];
|
|
3232
|
+
}
|
|
3233
|
+
});
|
|
3234
|
+
}); },
|
|
3304
3235
|
placeholderData: keepPreviousData,
|
|
3305
|
-
}), data =
|
|
3236
|
+
}), data = _f.data, isLoading = _f.isLoading;
|
|
3306
3237
|
var formattedQuote = data;
|
|
3307
3238
|
// Hooks
|
|
3308
3239
|
var downloadFile = useDownloadFile(id);
|
|
3309
3240
|
var isExpired = useIsExpired(formattedQuote === null || formattedQuote === void 0 ? void 0 : formattedQuote.expiresAt);
|
|
3310
|
-
var
|
|
3241
|
+
var _g = useSendAcceptQuote({
|
|
3311
3242
|
entityId: entityId,
|
|
3312
3243
|
token: token,
|
|
3313
|
-
|
|
3314
|
-
(function (url) {
|
|
3315
|
-
console.log("navigate to", url, " not implemented");
|
|
3316
|
-
}),
|
|
3244
|
+
onTokenExpired: onTokenExpired,
|
|
3317
3245
|
apiHost: apiHost,
|
|
3318
3246
|
quoteId: id,
|
|
3319
|
-
}), acceptBoxVisible =
|
|
3247
|
+
}), acceptBoxVisible = _g.acceptBoxVisible, isAccepting = _g.isAccepting, sendAccept = _g.sendAccept, setAcceptBoxVisible = _g.setAcceptBoxVisible, setIsAccepting = _g.setIsAccepting, startAcceptance = _g.startAcceptance, pandadocPollingModalVisible = _g.pandadocPollingModalVisible, setPandadocPollingModalVisible = _g.setPandadocPollingModalVisible;
|
|
3320
3248
|
useSigningComplete({ data: formattedQuote, token: token });
|
|
3249
|
+
var isMobile = useIsMobile();
|
|
3250
|
+
var showErrorNotification = useErrorNotification();
|
|
3321
3251
|
if (!formattedQuote || isLoading) {
|
|
3322
3252
|
return jsx(Fragment, {});
|
|
3323
3253
|
}
|
|
3254
|
+
// Derived state
|
|
3255
|
+
var isAccepted = formattedQuote.state === "ACCEPTED";
|
|
3324
3256
|
return (jsxs(Fragment, { children: [jsxs(Helmet, { children: [jsxs("title", { children: [formattedQuote.vendorName, " ", documentName] }), jsx("meta", { name: "description", content: quoteMetaDescription(formattedQuote.vendorName) }), jsx("meta", { property: "og:type", content: "website" }), jsx("meta", { property: "og:title", content: quoteMetaTitle({
|
|
3325
3257
|
vendorName: formattedQuote.vendorName,
|
|
3326
3258
|
documentName: documentName,
|
|
3327
|
-
}) }), jsx("meta", { property: "og:description", content: quoteMetaDescription(formattedQuote.vendorName) })] }), jsxs("div", __assign({ className: "flex
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
: "flex items-center justify-end gap-2" }, { children: [!isMobile ? (jsx(Button, __assign({ icon: jsx(DownloadOutlined$1, {}), onClick: function () { return downloadFile(apiHost + "/api/pdf/quote", token); } }, { children: "Download" }))) : null, formattedQuote.state !== "ACCEPTED" &&
|
|
3337
|
-
formattedQuote.state !== "APPLIED" ? (jsx(Button, __assign({ disabled: isExpired || isAccepting, onClick: function () { return startAcceptance(); }, type: "primary" }, { children: isExpired ? "Quote is expired" : "Accept quote" }))) : null] }))] })), jsx("div", __assign({ className: "flex ".concat(isMobile ? "flex-col w-full overflow-hidden" : "shadow-padding-xb") }, { children: 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 ? (jsx("div", __assign({ className: "flex flex-col items-end" }, { children: formattedQuote.object.documents.map(function (doc, index) {
|
|
3338
|
-
return (jsx(Button, __assign({ download: doc.filename, href: doc.url, type: "link" }, { children: doc.filename }), index));
|
|
3339
|
-
}) }))) : null })) })), jsx(AcceptQuoteModal, { acceptBoxVisible: acceptBoxVisible, formattedQuote: formattedQuote, setAcceptBoxVisible: setAcceptBoxVisible, setIsAccepting: setIsAccepting, sendAccept: sendAccept }), jsx(PandadocPollingModal, { isVisible: pandadocPollingModalVisible, setVisible: setPandadocPollingModalVisible, id: id })] }));
|
|
3340
|
-
}
|
|
3341
|
-
styled.div(templateObject_1$4 || (templateObject_1$4 = __makeTemplateObject(["\n span {\n width: 100%;\n }\n"], ["\n span {\n width: 100%;\n }\n"])));
|
|
3342
|
-
function Quote(_a) {
|
|
3343
|
-
var entityId = _a.entityId, id = _a.id;
|
|
3344
|
-
return (jsx(HelmetProvider, { children: jsx(ActualQuote, { entityId: entityId, id: id }) }));
|
|
3259
|
+
}) }), jsx("meta", { property: "og:description", content: quoteMetaDescription(formattedQuote.vendorName) })] }), jsxs("div", __assign({ className: "flex flex-col gap-4 ".concat(className) }, { children: [jsxs("div", __assign({ className: "flex flex-row justify-end items-center gap-4", id: "acceptance", style: {
|
|
3260
|
+
color: entityBranding.secondaryColor,
|
|
3261
|
+
} }, { children: [isAccepted && formattedQuote.acceptedAt ? (jsx(Text$c, { children: "Quote was accepted by ".concat(formattedQuote.acceptedByName, " on ").concat(formatDate(formattedQuote.acceptedAt)) })) : null, (!isMobile || !isAccepted) && (jsxs("div", __assign({ className: isMobile
|
|
3262
|
+
? "flex w-full justify-end gap-2"
|
|
3263
|
+
: "flex items-center justify-end gap-2" }, { children: [!isMobile && !hideDownloadButton ? (jsx(Button, __assign({ icon: jsx(DownloadOutlined$1, {}), onClick: function () {
|
|
3264
|
+
return downloadFile(apiHost + "/api/pdf/quote", token);
|
|
3265
|
+
} }, { children: "Download" }))) : null, !isAccepted ? (jsx(Button, __assign({ disabled: isExpired || isAccepting, onClick: function () { return startAcceptance(); }, type: "primary" }, { children: isExpired ? "Quote is expired" : "Accept quote" }))) : null] })))] })), 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 ? (jsx("div", __assign({ className: "flex flex-col items-end" }, { children: formattedQuote.object.documents.map(function (doc, index) {
|
|
3266
|
+
return (jsx(Button, __assign({ download: doc.filename, href: doc.url, type: "link" }, { children: doc.filename }), index));
|
|
3267
|
+
}) }))) : null }))] })), jsx(AcceptQuoteModal, { acceptBoxVisible: acceptBoxVisible, formattedQuote: formattedQuote, setAcceptBoxVisible: setAcceptBoxVisible, setIsAccepting: setIsAccepting, sendAccept: sendAccept }), jsx(PandadocPollingModal, { isVisible: pandadocPollingModalVisible, setVisible: setPandadocPollingModalVisible, id: id })] }));
|
|
3345
3268
|
}
|
|
3346
3269
|
var templateObject_1$4;
|
|
3347
3270
|
|
|
@@ -3396,21 +3319,14 @@ var getTransactions = function (filter, token, apiHost, kindsToShow) { return __
|
|
|
3396
3319
|
});
|
|
3397
3320
|
}); };
|
|
3398
3321
|
|
|
3399
|
-
var
|
|
3400
|
-
var PageHeaderWithActions = function (_a) {
|
|
3401
|
-
var children = _a.children, title = _a.title;
|
|
3402
|
-
var isMobile = useIsMobile();
|
|
3403
|
-
return (jsxs("div", __assign({ className: "flex pb-4 shadow-padding-x ".concat(isMobile ? "flex-col gap-2" : "items-center justify-between h-8") }, { children: [jsx(PageSubTitle, { title: title }), children] })));
|
|
3404
|
-
};
|
|
3405
|
-
var PageSubTitle = function (_a) {
|
|
3406
|
-
var title = _a.title;
|
|
3407
|
-
var secondaryColor = useContext(BrandContext).secondaryColor;
|
|
3408
|
-
var darkMode = useContext(BunnyContext).darkMode;
|
|
3409
|
-
return (jsx(Text$b, __assign({ className: "shrink-0 font-medium", style: { color: darkMode ? undefined : secondaryColor } }, { children: title })));
|
|
3410
|
-
};
|
|
3322
|
+
var TransactionsListContext = createContext({});
|
|
3411
3323
|
|
|
3412
3324
|
var StateTag = function (_a) {
|
|
3413
3325
|
var state = _a.state;
|
|
3326
|
+
var transactionStateRenderer = useContext(TransactionsListContext).transactionStateRenderer;
|
|
3327
|
+
if (transactionStateRenderer) {
|
|
3328
|
+
return jsx(Fragment, { children: transactionStateRenderer(state) });
|
|
3329
|
+
}
|
|
3414
3330
|
return jsx(Tag, __assign({ color: getColor(state) }, { children: capitalize(startCase(state)) }));
|
|
3415
3331
|
};
|
|
3416
3332
|
var getColor = function (state) {
|
|
@@ -3439,12 +3355,10 @@ var getColor = function (state) {
|
|
|
3439
3355
|
}
|
|
3440
3356
|
};
|
|
3441
3357
|
|
|
3442
|
-
var
|
|
3443
|
-
|
|
3444
|
-
var Text$a = Typography.Text;
|
|
3358
|
+
var Text$b = Typography.Text;
|
|
3445
3359
|
var TransactionDate = function (_a) {
|
|
3446
3360
|
var date = _a.date;
|
|
3447
|
-
return jsx(Text$
|
|
3361
|
+
return jsx(Text$b, __assign({ className: "text-sm" }, { children: formatDate(date) }));
|
|
3448
3362
|
};
|
|
3449
3363
|
|
|
3450
3364
|
// TODO: delete
|
|
@@ -3478,10 +3392,10 @@ var TransactionGridCell = styled.div.withConfig({
|
|
|
3478
3392
|
})(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"); }, SLATE_600);
|
|
3479
3393
|
var templateObject_1$3;
|
|
3480
3394
|
|
|
3481
|
-
var Text$
|
|
3395
|
+
var Text$a = Typography.Text;
|
|
3482
3396
|
var TransactionsEmptyState = function () {
|
|
3483
3397
|
var noTransactionsMessage = useContext(TransactionsListContext).noTransactionsMessage;
|
|
3484
|
-
return (jsx(Text$
|
|
3398
|
+
return (jsx(Text$a, __assign({ className: "flex justify-center p-4 text-base" }, { children: noTransactionsMessage || "There are no transactions" })));
|
|
3485
3399
|
};
|
|
3486
3400
|
|
|
3487
3401
|
var isInvoice = function (transaction) {
|
|
@@ -3498,7 +3412,7 @@ var TransactionRowTitle = function (_a) {
|
|
|
3498
3412
|
return (jsx("span", __assign({ className: "text-slate-400", style: { fontSize: "11px" } }, { children: transaction.transactionable.number })));
|
|
3499
3413
|
};
|
|
3500
3414
|
|
|
3501
|
-
var Text$
|
|
3415
|
+
var Text$9 = Typography.Text;
|
|
3502
3416
|
var TransactionsListDesktop = function (_a) {
|
|
3503
3417
|
var transactions = _a.transactions, onTransactionClick = _a.onTransactionClick;
|
|
3504
3418
|
var columns = useContext(TransactionsListContext).columns;
|
|
@@ -3518,11 +3432,11 @@ var TransactionsListDesktop = function (_a) {
|
|
|
3518
3432
|
backgroundColor: index % 2 === 0
|
|
3519
3433
|
? "var(--row-background".concat(darkMode ? "-dark" : "", ")")
|
|
3520
3434
|
: "var(--row-background-alternate".concat(darkMode ? "-dark" : "", ")"),
|
|
3521
|
-
} }, { children: [showDateAndTitle && (jsxs(Fragment, { children: [jsx(TransactionGridCell, __assign({ right: false }, { children: jsx(TransactionDate, { date: transaction.createdAt }) })), jsxs(TransactionGridCell, __assign({ right: false, className: "flex items-center gap-2" }, { children: [jsx(Text$
|
|
3435
|
+
} }, { children: [!showDateAndTitle && !showState && !showAmount && !showDownload && (jsx(TransactionGridCell, { children: jsx(Text$9, { children: "No columns selected" }) })), showDateAndTitle && (jsxs(Fragment, { children: [jsx(TransactionGridCell, __assign({ right: false }, { children: jsx(TransactionDate, { date: transaction.createdAt }) })), jsxs(TransactionGridCell, __assign({ right: false, className: "flex items-center gap-2" }, { children: [jsx(Text$9, { children: capitalize(transaction.kind.toLowerCase()) }), jsx(TransactionRowTitle, { transaction: transaction })] }))] })), showDownload && (jsx(TransactionGridCell, { children: jsx(TransactionDownload, { transaction: transaction, token: token, apiHost: apiHost }) })), showState ? (jsx(TransactionGridCell, __assign({ right: true }, { children: jsx(StateTag, { state: transaction.state }) }))) : null, showAmount && (jsx(TransactionGridCell, __assign({ right: true }, { children: jsx(Text$9, { children: formatCurrency(((_a = transaction === null || transaction === void 0 ? void 0 : transaction.transactionable) === null || _a === void 0 ? void 0 : _a.amount) || transaction.amount, transaction.currencyId) }) })))] }), index));
|
|
3522
3436
|
});
|
|
3523
3437
|
};
|
|
3524
3438
|
|
|
3525
|
-
var Text$
|
|
3439
|
+
var Text$8 = Typography.Text;
|
|
3526
3440
|
var TransactionsListMobile = function (_a) {
|
|
3527
3441
|
var transactions = _a.transactions, onTransactionClick = _a.onTransactionClick;
|
|
3528
3442
|
var columns = useContext(TransactionsListContext).columns;
|
|
@@ -3541,20 +3455,23 @@ var TransactionsListMobile = function (_a) {
|
|
|
3541
3455
|
backgroundColor: index % 2 === 0
|
|
3542
3456
|
? "var(--row-background".concat(darkMode ? "-dark" : "", ")")
|
|
3543
3457
|
: "var(--row-background-alternate".concat(darkMode ? "-dark" : "", ")"),
|
|
3544
|
-
} }, { children: [jsx(TransactionGridCell, { children: jsxs("div", __assign({ className: "flex flex-col gap-2" }, { children: [jsxs("div", __assign({ className: "flex items-center gap-2" }, { children: [showDateAndTitle && (jsxs(Fragment, { children: [jsx(Text$
|
|
3458
|
+
} }, { children: [jsx(TransactionGridCell, { children: jsxs("div", __assign({ className: "flex flex-col gap-2" }, { children: [jsxs("div", __assign({ className: "flex items-center gap-2" }, { children: [showDateAndTitle && (jsxs(Fragment, { children: [jsx(Text$8, { children: capitalize(transaction.kind.toLowerCase()) }), jsx(TransactionRowTitle, { transaction: transaction })] })), showState && jsx(StateTag, { state: transaction.state })] })), jsxs("div", __assign({ className: "flex items-center gap-2" }, { children: [showDateAndTitle && (jsx(TransactionDate, { date: transaction.createdAt })), showAmount && showDateAndTitle && jsx(Text$8, { children: "\u00B7" }), showAmount && (jsx(Text$8, { children: formatCurrency(transaction.transactionable.amount || transaction.amount, transaction.currencyId) }))] }))] })) }), showDownload && (jsx(TransactionGridCell, __assign({ right: true }, { children: jsx(TransactionDownload, { transaction: transaction, token: token, apiHost: apiHost }) })))] }), index));
|
|
3545
3459
|
});
|
|
3546
3460
|
};
|
|
3547
3461
|
|
|
3462
|
+
var Text$7 = Typography.Text;
|
|
3463
|
+
var DISPLAY_WIDTH = 1200;
|
|
3548
3464
|
function Transactions(_a) {
|
|
3549
|
-
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 =
|
|
3465
|
+
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 ? [
|
|
3550
3466
|
TransactionKind.INVOICE,
|
|
3551
3467
|
TransactionKind.PAYMENT,
|
|
3552
3468
|
TransactionKind.REFUND,
|
|
3553
3469
|
TransactionKind.WRITE_OFF,
|
|
3554
|
-
] :
|
|
3470
|
+
] : _j, style = _a.style, filter = _a.filter, noTransactionsMessage = _a.noTransactionsMessage, entityId = _a.entityId;
|
|
3555
3471
|
var contextValues = {
|
|
3556
3472
|
showSearchBar: showSearchBar,
|
|
3557
3473
|
showTitle: showTitle,
|
|
3474
|
+
title: title,
|
|
3558
3475
|
transactionComponent: transactionComponent,
|
|
3559
3476
|
columns: columns,
|
|
3560
3477
|
className: className,
|
|
@@ -3569,28 +3486,25 @@ function Transactions(_a) {
|
|
|
3569
3486
|
noTransactionsMessage: noTransactionsMessage,
|
|
3570
3487
|
entityId: entityId,
|
|
3571
3488
|
};
|
|
3572
|
-
|
|
3573
|
-
}
|
|
3574
|
-
function TransactionsWrapper() {
|
|
3575
|
-
var _a = useContext(TransactionsListContext), kindsToShow = _a.kindsToShow, filterFromContext = _a.filter;
|
|
3576
|
-
var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
|
|
3489
|
+
var _k = useContext(BunnyContext), token = _k.token, apiHost = _k.apiHost;
|
|
3577
3490
|
// Local state
|
|
3578
|
-
var
|
|
3579
|
-
var
|
|
3491
|
+
var _l = useState(""), search = _l[0], setSearch = _l[1];
|
|
3492
|
+
var filterValue = filter ||
|
|
3580
3493
|
(search ? "filter: \"transaction.transactionableId is ".concat(search, "\"") : "");
|
|
3581
3494
|
// Queries
|
|
3582
3495
|
var data = useQuery({
|
|
3583
3496
|
queryKey: ["transactions", token, filter],
|
|
3584
|
-
queryFn: function () { return getTransactions(
|
|
3497
|
+
queryFn: function () { return getTransactions(filterValue, token, apiHost, kindsToShow); },
|
|
3585
3498
|
placeholderData: keepPreviousData,
|
|
3586
3499
|
}).data;
|
|
3587
|
-
return (jsx(TransactionsDisplay, { transactions: data, onSearchValueChanged: setSearch, search: search }));
|
|
3500
|
+
return (jsx(TransactionsListContext.Provider, __assign({ value: contextValues }, { children: jsx(TransactionsDisplay, { transactions: data, onSearchValueChanged: setSearch, search: search }) })));
|
|
3588
3501
|
}
|
|
3589
3502
|
function TransactionsDisplay(_a) {
|
|
3590
|
-
var transactions = _a.transactions, onSearchValueChanged = _a.onSearchValueChanged, search = _a.search
|
|
3591
|
-
var _b = 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;
|
|
3503
|
+
var transactions = _a.transactions, onSearchValueChanged = _a.onSearchValueChanged, search = _a.search;
|
|
3504
|
+
var _b = 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;
|
|
3592
3505
|
var columns = useContext(TransactionsListContext).columns;
|
|
3593
3506
|
var darkMode = useContext(BunnyContext).darkMode;
|
|
3507
|
+
var secondaryColor = useContext(BrandContext).secondaryColor;
|
|
3594
3508
|
// Local state
|
|
3595
3509
|
var _c = useState(null), selectedTransaction = _c[0], setSelectedTransaction = _c[1];
|
|
3596
3510
|
var _d = useState(false), drawerOpen = _d[0], setDrawerOpen = _d[1];
|
|
@@ -3640,38 +3554,48 @@ function TransactionsDisplay(_a) {
|
|
|
3640
3554
|
var kind = selectedTransaction.kind.toLowerCase();
|
|
3641
3555
|
return kind.charAt(0).toUpperCase() + kind.slice(1);
|
|
3642
3556
|
};
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
}
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3557
|
+
function handleDisplayClose() {
|
|
3558
|
+
onTransactionDisplayClose === null || onTransactionDisplayClose === void 0 ? void 0 : onTransactionDisplayClose(selectedTransaction);
|
|
3559
|
+
setDrawerOpen(false);
|
|
3560
|
+
}
|
|
3561
|
+
return (jsxs("div", __assign({ style: style }, { children: [jsxs("div", __assign({ className: "flex flex-col w-full shadow-padding-xb gap-2 ".concat(isMobile ? "overflow-hidden" : "", " ").concat(className) }, { children: [showTitle || showSearchBar ? (jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col gap-1" : "flex-row items-center", " justify-between") }, { children: [showTitle ? (jsx(Text$7, __assign({ className: "shrink-0 font-medium", style: { color: darkMode ? undefined : secondaryColor } }, { children: title }))) : (jsx("div", {}) // Empty div so justify-between works
|
|
3562
|
+
), showSearchBar && (jsx("div", __assign({ className: "".concat(isMobile ? "w-full" : "") }, { children: jsx(Input, { className: searchBarClassName
|
|
3563
|
+
? searchBarClassName
|
|
3564
|
+
: "border border-slate-200", onChange: function (e) {
|
|
3565
|
+
if (isNaN(Number(e.target.value))) {
|
|
3566
|
+
return;
|
|
3567
|
+
}
|
|
3568
|
+
onSearchValueChanged(e.target.value);
|
|
3569
|
+
}, prefix: jsx(SearchOutlined$1, {}), placeholder: "Search by id #", style: {
|
|
3570
|
+
minWidth: "300px",
|
|
3571
|
+
}, value: search }) })))] }))) : null, jsx("div", __assign({ className: "grid w-full rounded-md overflow-auto ".concat(shadow), style: {
|
|
3572
|
+
gridTemplateColumns: gridTemplateColumns(),
|
|
3573
|
+
backgroundColor: "var(--row-background".concat(darkMode ? "-dark" : "", ")"),
|
|
3574
|
+
} }, { children: isMobile ? (jsx(Fragment, { children: TransactionsListMobile({
|
|
3575
|
+
transactions: transactions,
|
|
3576
|
+
onTransactionClick: handleTransactionClick,
|
|
3577
|
+
}) })) : (jsx(Fragment, { children: TransactionsListDesktop({
|
|
3578
|
+
transactions: transactions,
|
|
3579
|
+
onTransactionClick: handleTransactionClick,
|
|
3580
|
+
}) })) }))] })), useModal ? (jsx(Modal, __assign({ title: "Basic Modal", open: drawerOpen, onOk: handleDisplayClose, onCancel: handleDisplayClose, width: DISPLAY_WIDTH, footer: null }, { children: jsx(Invoice, { id: (selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.transactionableId) || "", entityId: entityId }) }))) : (jsx(Drawer, __assign({ title: drawerTitle(), onClose: handleDisplayClose, open: drawerOpen, width: DISPLAY_WIDTH }, { children: transactionComponent ? (transactionComponent) : (selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.kind) === "INVOICE" ? (jsx(Invoice, { id: selectedTransaction.transactionableId, entityId: entityId })) : (jsxs(Card$1, __assign({ className: "shadow-md" }, { children: [jsx(Typography.Title, __assign({ level: 2, className: "mb-4" }, { children: "Transaction Details" })), jsxs(Typography.Paragraph, { children: [jsx("strong", { children: "Amount:" }), " ", jsx(Typography.Text, { children: formatCurrency((selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.amount) || 0, (selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.currencyId) || "USD") })] }), jsxs(Typography.Paragraph, { children: [jsx("strong", { children: "Description:" }), " ", jsx(Typography.Text, { children: selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.description })] }), jsxs(Typography.Paragraph, { children: [jsx("strong", { children: "Kind:" }), " ", jsx(Typography.Text, { children: selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.kind })] }), jsxs(Typography.Paragraph, { children: [jsx("strong", { children: "State:" }), " ", jsx(Typography.Text, { children: selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.state })] })] }))) })))] })));
|
|
3662
3581
|
}
|
|
3663
3582
|
|
|
3664
3583
|
function Quotes(_a) {
|
|
3665
|
-
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
|
|
3584
|
+
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;
|
|
3666
3585
|
var apiHost = useContext(BunnyContext).apiHost;
|
|
3667
|
-
var
|
|
3586
|
+
var _k = useState(null), component = _k[0], setComponent = _k[1];
|
|
3668
3587
|
var contextValues = {
|
|
3669
3588
|
columns: columns,
|
|
3670
3589
|
kindsToShow: [],
|
|
3671
3590
|
onTransactionClick: handleQuoteClick,
|
|
3591
|
+
onTransactionDisplayClose: function () {
|
|
3592
|
+
setComponent(jsx(Fragment, {}));
|
|
3593
|
+
},
|
|
3672
3594
|
transactionComponent: component,
|
|
3595
|
+
transactionStateRenderer: quoteStateRenderer,
|
|
3673
3596
|
showSearchBar: showSearchBar,
|
|
3674
3597
|
showTitle: showTitle,
|
|
3598
|
+
title: title,
|
|
3675
3599
|
className: className,
|
|
3676
3600
|
shadow: shadow,
|
|
3677
3601
|
searchBarClassName: searchBarClassName,
|
|
@@ -3683,7 +3607,29 @@ function Quotes(_a) {
|
|
|
3683
3607
|
downloadTransactionLink: function (id) { return "".concat(apiHost, "/api/pdf/quote/").concat(id); },
|
|
3684
3608
|
entityId: entityId,
|
|
3685
3609
|
};
|
|
3610
|
+
function quoteStateRenderer(state) {
|
|
3611
|
+
// "DRAFT" | "SHARED" | "VIEWED" | "ACCEPTED" | "IN_APPROVAL" | "APPROVED" | "REJECTED";
|
|
3612
|
+
var getColor = function (state) {
|
|
3613
|
+
switch (state) {
|
|
3614
|
+
case "ACCEPTED":
|
|
3615
|
+
return "green";
|
|
3616
|
+
case "IN_APPROVAL":
|
|
3617
|
+
return "orange";
|
|
3618
|
+
case "APPROVED":
|
|
3619
|
+
return "green";
|
|
3620
|
+
case "REJECTED":
|
|
3621
|
+
return "red";
|
|
3622
|
+
case "DRAFT":
|
|
3623
|
+
case "SHARED":
|
|
3624
|
+
case "VIEWED":
|
|
3625
|
+
default:
|
|
3626
|
+
return "blue";
|
|
3627
|
+
}
|
|
3628
|
+
};
|
|
3629
|
+
return jsx(Tag, __assign({ color: getColor(state) }, { children: capitalize(startCase(state)) }));
|
|
3630
|
+
}
|
|
3686
3631
|
function handleQuoteClick(quote) {
|
|
3632
|
+
onQuoteClick === null || onQuoteClick === void 0 ? void 0 : onQuoteClick(quote);
|
|
3687
3633
|
if (quoteComponent) {
|
|
3688
3634
|
setComponent(quoteComponent);
|
|
3689
3635
|
}
|
|
@@ -3707,9 +3653,17 @@ function QuotesWrapper() {
|
|
|
3707
3653
|
}).data;
|
|
3708
3654
|
if (data === undefined)
|
|
3709
3655
|
return null;
|
|
3710
|
-
|
|
3656
|
+
// filter out quotes in draft state, they are not viewable
|
|
3657
|
+
var quotes = data.nodes
|
|
3658
|
+
.filter(function (quote) {
|
|
3659
|
+
return quote.state !== "DRAFT";
|
|
3660
|
+
})
|
|
3661
|
+
.sort(function (a, b) {
|
|
3662
|
+
return new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime();
|
|
3663
|
+
});
|
|
3664
|
+
var quotesAsTransactions = quotes.map(function (quote) { return ({
|
|
3711
3665
|
transactionableId: quote.id,
|
|
3712
|
-
state:
|
|
3666
|
+
state: quote.state,
|
|
3713
3667
|
amount: quote.amount || quote.amountDue,
|
|
3714
3668
|
kind: "QUOTE",
|
|
3715
3669
|
currencyId: quote.currencyId,
|
|
@@ -3718,7 +3672,7 @@ function QuotesWrapper() {
|
|
|
3718
3672
|
},
|
|
3719
3673
|
createdAt: quote.createdAt,
|
|
3720
3674
|
}); });
|
|
3721
|
-
return (jsx(TransactionsDisplay, { transactions: quotesAsTransactions, onSearchValueChanged: setSearch, search: search
|
|
3675
|
+
return (jsx(TransactionsDisplay, { transactions: quotesAsTransactions, onSearchValueChanged: setSearch, search: search }));
|
|
3722
3676
|
}
|
|
3723
3677
|
|
|
3724
3678
|
var DrawerHeader = function (_a) {
|
|
@@ -3726,96 +3680,19 @@ var DrawerHeader = function (_a) {
|
|
|
3726
3680
|
return (jsxs("div", __assign({ className: "flex flex-col gap-4" }, { children: [jsxs("div", __assign({ className: "flex items-center justify-between gap-2" }, { children: [jsx("div", __assign({ className: "text-xl" }, { children: title })), jsx("button", __assign({ onClick: onClose, className: "ant-drawer-close" }, { children: jsx(CloseOutlined$1, {}) }))] })), description && jsx("div", __assign({ className: "text-xs" }, { children: description }))] })));
|
|
3727
3681
|
};
|
|
3728
3682
|
|
|
3729
|
-
var
|
|
3730
|
-
var
|
|
3731
|
-
var
|
|
3732
|
-
return (jsx("div", __assign({ className: "flex flex-col rounded-md shadow-md ".concat(className), style: __assign(__assign({}, style), { backgroundColor: darkMode
|
|
3733
|
-
? "var(--row-background-dark)"
|
|
3734
|
-
: "var(--row-background)" }) }, { children: children })));
|
|
3735
|
-
};
|
|
3736
|
-
|
|
3737
|
-
var LargeCardIcon = function () {
|
|
3738
|
-
return (jsx("svg", __assign({ width: "72", height: "56", viewBox: "0 0 72 56", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: 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" }) })));
|
|
3739
|
-
};
|
|
3740
|
-
|
|
3741
|
-
var PlusIcon = function (_a) {
|
|
3742
|
-
var color = _a.color;
|
|
3743
|
-
return (jsxs("svg", __assign({ width: "14", height: "15", viewBox: "0 0 14 15", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: [jsx("path", { d: "M2.9165 7.5H11.0832", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), jsx("path", { d: "M7 3.41663V11.5833", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })] })));
|
|
3744
|
-
};
|
|
3745
|
-
|
|
3746
|
-
var Text$6 = Typography.Text;
|
|
3747
|
-
var CreditCard = function (_a) {
|
|
3748
|
-
var _b, _c, _d;
|
|
3749
|
-
var onClickRemove = _a.onClickRemove, onClickUpdate = _a.onClickUpdate, paymentMethodData = _a.paymentMethodData;
|
|
3750
|
-
var isExpired = function (paymentMethodData) {
|
|
3751
|
-
// paymentMethodData.expirationDate
|
|
3752
|
-
var expDate = dayjs(paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.expirationDate);
|
|
3753
|
-
return expDate.isBefore(dayjs());
|
|
3754
|
-
};
|
|
3755
|
-
var isMobile = useIsMobile();
|
|
3756
|
-
var apiHost = useContext(BunnyContext).apiHost;
|
|
3757
|
-
return (jsxs(Card, __assign({ className: "shadow-md m-0" }, { children: [jsxs("div", __assign({ className: "flex items-center justify-between gap-4 p-4" }, { children: [jsxs("div", __assign({ className: "flex items-center gap-4" }, { children: [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) && (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)) })), jsx(Text$6, { children: (_d = paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.metadata) === null || _d === void 0 ? void 0 : _d.description })] })), jsx(Tag, __assign({ color: isExpired(paymentMethodData) ? "red" : "green" }, { children: isExpired(paymentMethodData) ? "Expired" : "Valid" }))] })), !isMobile && (jsx(CardActions, { onClickRemove: onClickRemove, onClickUpdate: onClickUpdate }))] })), dayjs(paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.expirationDate).isValid() && (jsxs(Fragment, { children: [jsx(Divider, {}), jsxs("div", __assign({ className: "flex flex-col p-4" }, { children: [jsx(CardAttribute, { title: "EXPIRATION", value: dayjs(paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.expirationDate).format("MM/YY") }), isMobile && (jsx(CardActions, { onClickRemove: onClickRemove, onClickUpdate: onClickUpdate }))] }))] }))] })));
|
|
3758
|
-
};
|
|
3759
|
-
var CardAttribute = function (_a) {
|
|
3760
|
-
var title = _a.title, value = _a.value;
|
|
3761
|
-
return (jsxs("div", __assign({ className: "flex flex-col gap-2" }, { children: [jsx("div", __assign({ className: "text-slate-400", style: { fontSize: "11px" } }, { children: title })), jsx(Text$6, { children: value })] })));
|
|
3762
|
-
};
|
|
3763
|
-
var CardActions = function (_a) {
|
|
3764
|
-
var onClickRemove = _a.onClickRemove, onClickUpdate = _a.onClickUpdate;
|
|
3765
|
-
var isMobile = useIsMobile();
|
|
3766
|
-
return (jsxs("div", __assign({ className: "flex items-center gap-6 ".concat(isMobile ? "justify-center mt-4" : "") }, { children: [jsx(Popconfirm, __assign({ title: "Remove card?", onConfirm: onClickRemove }, { children: jsx(Button, __assign({ className: "font-normal p-0", type: "link" }, { children: "Remove payment method" })) })), jsx(Divider, { style: { height: "24px" }, type: "vertical" }), jsx(Button, __assign({ onClick: onClickUpdate, type: "primary" }, { children: "Update" }))] })));
|
|
3767
|
-
};
|
|
3768
|
-
var EmptyCard = function (_a) {
|
|
3769
|
-
var onClick = _a.onClick;
|
|
3770
|
-
var brandColor = useContext(BrandContext).brandColor;
|
|
3771
|
-
return (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: [jsx(LargeCardIcon, {}), jsx("div", __assign({ className: "text-slate-400 pt-4 pb-8" }, { children: "No payment methods" })), jsx(Button, __assign({ type: "link" }, { children: jsxs("div", __assign({ className: "flex items-center gap-1" }, { children: [jsx(PlusIcon, { color: brandColor }), "Add payment method"] })) }))] })));
|
|
3772
|
-
};
|
|
3773
|
-
var getCardImage = function (issuer) {
|
|
3774
|
-
if (issuer === "visa")
|
|
3775
|
-
return "Visa_Brandmark_Blue_RGB_2021.png";
|
|
3776
|
-
else if (issuer === "mastercard")
|
|
3777
|
-
return "mc_symbol_opt_73_3x.png";
|
|
3778
|
-
};
|
|
3779
|
-
|
|
3780
|
-
var PaymentMethodContext = createContext({});
|
|
3781
|
-
|
|
3782
|
-
var ActualPaymentMethod = function (_a) {
|
|
3783
|
-
var entityId = _a.entityId;
|
|
3784
|
-
var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, graphQLClient = _b.graphQLClient, onErrorNavigate = _b.onErrorNavigate;
|
|
3785
|
-
var accountId = useContext(PaymentContext).accountId;
|
|
3683
|
+
var PaymentMethod = function (_a) {
|
|
3684
|
+
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;
|
|
3685
|
+
var _d = useContext(BunnyContext), token = _d.token, apiHost = _d.apiHost, graphQLClient = _d.graphQLClient, onTokenExpired = _d.onTokenExpired;
|
|
3786
3686
|
// Hooks
|
|
3787
3687
|
var queryClient = useQueryClient();
|
|
3788
3688
|
var paymentPlugins = usePaymentPlugins({ entityId: entityId, apiHost: apiHost, token: token }).paymentPlugins;
|
|
3789
|
-
var showErrorNotification = useErrorNotification();
|
|
3790
3689
|
var showSuccessNotification = useSuccessNotification();
|
|
3791
|
-
var handleAllErrorFormats = useAllErrorFormats(
|
|
3690
|
+
var handleAllErrorFormats = useAllErrorFormats(onTokenExpired);
|
|
3792
3691
|
var isMobile = useIsMobile();
|
|
3793
3692
|
var data = usePaymentMethod(graphQLClient).data;
|
|
3693
|
+
var onClickRemove = useRemovePaymentMethod(paymentPlugins || [], token, apiHost);
|
|
3794
3694
|
// Local state
|
|
3795
|
-
var
|
|
3796
|
-
var _d = useState(false), isSaving = _d[0], setIsSaving = _d[1];
|
|
3797
|
-
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); });
|
|
3798
|
-
var onClickRemove = function () {
|
|
3799
|
-
if (data && plugin) {
|
|
3800
|
-
invokePlugin({
|
|
3801
|
-
plugin: plugin,
|
|
3802
|
-
method: "remove_payment_method",
|
|
3803
|
-
payload: {
|
|
3804
|
-
payment_method_id: data.id,
|
|
3805
|
-
account_id: accountId,
|
|
3806
|
-
},
|
|
3807
|
-
token: token,
|
|
3808
|
-
apiHost: apiHost,
|
|
3809
|
-
})
|
|
3810
|
-
.then(function () {
|
|
3811
|
-
showSuccessNotification("Payment method was removed", "Success");
|
|
3812
|
-
queryClient.setQueryData(QueryKeyFactory.default.accountPaymentMethodKey, null);
|
|
3813
|
-
})
|
|
3814
|
-
.catch(function (error) {
|
|
3815
|
-
showErrorNotification(error.message, "Error removing Payment Method");
|
|
3816
|
-
});
|
|
3817
|
-
}
|
|
3818
|
-
};
|
|
3695
|
+
var _e = useState(false), showModal = _e[0], setShowModal = _e[1];
|
|
3819
3696
|
var onSuccess = function () {
|
|
3820
3697
|
queryClient.invalidateQueries({
|
|
3821
3698
|
queryKey: QueryKeyFactory.default.accountPaymentMethodKey,
|
|
@@ -3825,25 +3702,18 @@ var ActualPaymentMethod = function (_a) {
|
|
|
3825
3702
|
};
|
|
3826
3703
|
if (data === undefined)
|
|
3827
3704
|
return jsx(Fragment, {});
|
|
3828
|
-
return (jsxs(
|
|
3705
|
+
return (jsxs("div", __assign({ className: "".concat(className) }, { children: [data ? (jsx(CreditCard, { onClickRemove: function () { return onClickRemove(data); }, onClickUpdate: function () { return setShowModal(true); }, paymentMethodData: data, shadow: shadow, cardEnabled: cardEnabled })) : (jsx(EmptyCard, { onClick: function () { return setShowModal(true); }, shadow: shadow, cardEnabled: cardEnabled })), jsx(Drawer, __assign({ closeIcon: null, onClose: function () { return setShowModal(false); }, open: showModal, styles: {
|
|
3829
3706
|
body: isMobile
|
|
3830
3707
|
? {
|
|
3831
3708
|
padding: "1rem 0 0",
|
|
3832
3709
|
}
|
|
3833
3710
|
: {},
|
|
3834
|
-
|
|
3835
|
-
}, title: jsx(DrawerHeader, { onClose: function () { return setShowModal(false); }, title: "New payment method" }) }, { children: jsx(PaymentForm, { entityId: entityId, isSaving: isSaving, onFail: function (error) {
|
|
3711
|
+
}, title: jsx(DrawerHeader, { onClose: function () { return setShowModal(false); }, title: "New payment method" }) }, { children: jsx(PaymentForm, { entityId: entityId, onFail: function (error) {
|
|
3836
3712
|
handleAllErrorFormats(error);
|
|
3837
|
-
setIsSaving(false);
|
|
3838
3713
|
}, onPaymentSuccess: function () {
|
|
3839
3714
|
onSuccess();
|
|
3840
|
-
|
|
3841
|
-
}, setIsSaving: setIsSaving }) }))] }));
|
|
3715
|
+
} }) }))] })));
|
|
3842
3716
|
};
|
|
3843
|
-
function PaymentMethod(_a) {
|
|
3844
|
-
var entityId = _a.entityId, footer = _a.footer;
|
|
3845
|
-
return (jsx(PaymentMethodContext.Provider, __assign({ value: { footer: footer } }, { children: jsx(ActualPaymentMethod, { entityId: entityId }) })));
|
|
3846
|
-
}
|
|
3847
3717
|
|
|
3848
3718
|
var pageWrapperClassName = function (isMobile) {
|
|
3849
3719
|
return "flex flex-col grow pt-4 ".concat(isMobile ? "pb-4 overflow-hidden" : "pb-8", " ").concat("content-container");
|
|
@@ -3878,6 +3748,30 @@ var quoteRecalculateTaxes = function (_a) {
|
|
|
3878
3748
|
});
|
|
3879
3749
|
};
|
|
3880
3750
|
|
|
3751
|
+
var MUTATION$6 = "{\n currentUser {\n taxationRequiredAccountFields\n }\n}";
|
|
3752
|
+
var getTaxationRequiredAccountFields = function (_a) {
|
|
3753
|
+
var token = _a.token, apiHost = _a.apiHost;
|
|
3754
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
3755
|
+
var response;
|
|
3756
|
+
var _b, _c;
|
|
3757
|
+
return __generator(this, function (_d) {
|
|
3758
|
+
switch (_d.label) {
|
|
3759
|
+
case 0: return [4 /*yield*/, gqlRequest({
|
|
3760
|
+
query: MUTATION$6,
|
|
3761
|
+
token: token,
|
|
3762
|
+
apiHost: apiHost,
|
|
3763
|
+
})];
|
|
3764
|
+
case 1:
|
|
3765
|
+
response = _d.sent();
|
|
3766
|
+
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
|
|
3767
|
+
? response.currentUser
|
|
3768
|
+
.taxationRequiredAccountFields
|
|
3769
|
+
: null];
|
|
3770
|
+
}
|
|
3771
|
+
});
|
|
3772
|
+
});
|
|
3773
|
+
};
|
|
3774
|
+
|
|
3881
3775
|
var useHasTaxPlugin = function (_a) {
|
|
3882
3776
|
var entityId = _a.entityId, apiHost = _a.apiHost, token = _a.token;
|
|
3883
3777
|
var plugins = usePlugins({
|
|
@@ -3888,7 +3782,7 @@ var useHasTaxPlugin = function (_a) {
|
|
|
3888
3782
|
return Boolean(plugins === null || plugins === void 0 ? void 0 : plugins.some(function (plugin) { return plugin.type === "taxation"; }));
|
|
3889
3783
|
};
|
|
3890
3784
|
|
|
3891
|
-
var MUTATION$
|
|
3785
|
+
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";
|
|
3892
3786
|
var accountUpdate = function (_a) {
|
|
3893
3787
|
var accountId = _a.accountId, attributes = _a.attributes, token = _a.token, apiHost = _a.apiHost;
|
|
3894
3788
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -3899,7 +3793,7 @@ var accountUpdate = function (_a) {
|
|
|
3899
3793
|
case 0:
|
|
3900
3794
|
vars = { id: accountId, attributes: attributes };
|
|
3901
3795
|
return [4 /*yield*/, gqlRequest({
|
|
3902
|
-
query: MUTATION$
|
|
3796
|
+
query: MUTATION$5,
|
|
3903
3797
|
token: token,
|
|
3904
3798
|
vars: vars,
|
|
3905
3799
|
apiHost: apiHost,
|
|
@@ -3959,11 +3853,16 @@ var FormBillingState = function (_a) {
|
|
|
3959
3853
|
return (jsx(Form.Item, __assign({ label: "Billing state", name: "billingState", rules: [{ required: billingStateRequired }] }, { children: jsx(Input, { placeholder: "State" }) })));
|
|
3960
3854
|
};
|
|
3961
3855
|
|
|
3856
|
+
var getQuoteAmountDue = function (quote) {
|
|
3857
|
+
return quote.amountDue;
|
|
3858
|
+
};
|
|
3859
|
+
|
|
3962
3860
|
var QuoteCheckout = function (_a) {
|
|
3963
|
-
var account = _a.account,
|
|
3861
|
+
var account = _a.account, onSuccess = _a.onSuccess, onFail = _a.onFail, quote = _a.quote, taxationRequiredAccountFields = _a.taxationRequiredAccountFields, entityId = _a.entityId;
|
|
3964
3862
|
// Context
|
|
3965
3863
|
var isMobile = useIsMobile();
|
|
3966
3864
|
var _b = useContext(BunnyContext), apiHost = _b.apiHost, token = _b.token;
|
|
3865
|
+
var _c = useState(false), isSaving = _c[0], setIsSaving = _c[1];
|
|
3967
3866
|
var paymentRequired = getQuoteAmountDue(quote) > 0;
|
|
3968
3867
|
var checkoutMutation = useMutation({
|
|
3969
3868
|
mutationFn: function (_a) {
|
|
@@ -4007,6 +3906,7 @@ var QuoteCheckout = function (_a) {
|
|
|
4007
3906
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
4008
3907
|
var token_1, plugin, savePaymentMethod, metadata, paymentMethodId;
|
|
4009
3908
|
return __generator(this, function (_b) {
|
|
3909
|
+
setIsSaving(true);
|
|
4010
3910
|
if (pluginPaymentResponse) {
|
|
4011
3911
|
token_1 = pluginPaymentResponse.token, plugin = pluginPaymentResponse.plugin, savePaymentMethod = pluginPaymentResponse.savePaymentMethod, metadata = pluginPaymentResponse.metadata;
|
|
4012
3912
|
checkoutMutation.mutate({
|
|
@@ -4029,48 +3929,34 @@ var QuoteCheckout = function (_a) {
|
|
|
4029
3929
|
else {
|
|
4030
3930
|
checkoutMutation.mutate({});
|
|
4031
3931
|
}
|
|
3932
|
+
setIsSaving(false);
|
|
4032
3933
|
return [2 /*return*/];
|
|
4033
3934
|
});
|
|
4034
3935
|
});
|
|
4035
3936
|
};
|
|
4036
3937
|
if (taxationRequiredAccountFields)
|
|
4037
3938
|
return (jsx(PaymentFormWrapper, __assign({ setMaxHeight: false }, { children: jsx(TaxationForm, { account: account, quote: quote }) })));
|
|
4038
|
-
return (jsx(Fragment, { children: paymentRequired ? (jsx(PaymentForm, { entityId: entityId,
|
|
4039
|
-
setIsSaving(true);
|
|
3939
|
+
return (jsx(Fragment, { children: paymentRequired ? (jsx(PaymentForm, { entityId: entityId, onFail: onFail, onPaymentSuccess: handleCheckout, quote: quote })) : (jsx(PaymentFormWrapper, __assign({ setMaxHeight: false }, { children: jsxs("div", __assign({ className: "flex flex-col gap-2 ".concat(isMobile ? "shadow-padding-x" : "") }, { children: [jsx(Button, __assign({ onClick: function () {
|
|
4040
3940
|
handleCheckout({});
|
|
4041
3941
|
}, type: "primary" }, { children: isSaving ? "Processing..." : "Complete order" })), jsx("div", __assign({ className: "text-xs text-slate-500" }, { children: "No payment is required" }))] })) }))) }));
|
|
4042
3942
|
};
|
|
4043
|
-
|
|
4044
|
-
var
|
|
4045
|
-
var
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
query: MUTATION$5,
|
|
4054
|
-
token: token,
|
|
4055
|
-
apiHost: apiHost,
|
|
4056
|
-
})];
|
|
4057
|
-
case 1:
|
|
4058
|
-
response = _d.sent();
|
|
4059
|
-
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
|
|
4060
|
-
? response.currentUser
|
|
4061
|
-
.taxationRequiredAccountFields
|
|
4062
|
-
: null];
|
|
4063
|
-
}
|
|
4064
|
-
});
|
|
4065
|
-
});
|
|
3943
|
+
var PaymentFormWrapper = function (_a) {
|
|
3944
|
+
var children = _a.children, setMaxHeight = _a.setMaxHeight, className = _a.className;
|
|
3945
|
+
var isMobile = useIsMobile();
|
|
3946
|
+
return (jsx("div", __assign({ className: "flex flex-col gap-6 shrink-0 ".concat(isMobile ? "w-full shadow-padding-xb" : "", " ").concat(className), style: __assign({}, (isMobile
|
|
3947
|
+
? setMaxHeight
|
|
3948
|
+
? { maxHeight: "60vh" }
|
|
3949
|
+
: {}
|
|
3950
|
+
: {
|
|
3951
|
+
width: "350px",
|
|
3952
|
+
})) }, { children: children })));
|
|
4066
3953
|
};
|
|
4067
3954
|
|
|
4068
3955
|
var queryKeyFactory = QueryKeyFactory.default;
|
|
4069
3956
|
var Checkout = function (_a) {
|
|
4070
3957
|
var _b, _c;
|
|
4071
3958
|
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;
|
|
4072
|
-
var
|
|
4073
|
-
var _f = useState(false), isSaving = _f[0], setIsSaving = _f[1];
|
|
3959
|
+
var apiHost = useContext(BunnyContext).apiHost;
|
|
4074
3960
|
var isMobile = useIsMobile();
|
|
4075
3961
|
var hasTaxPlugin = useHasTaxPlugin({
|
|
4076
3962
|
entityId: entityId,
|
|
@@ -4079,20 +3965,20 @@ var Checkout = function (_a) {
|
|
|
4079
3965
|
});
|
|
4080
3966
|
var queryClient = useQueryClient();
|
|
4081
3967
|
// Queries
|
|
4082
|
-
var
|
|
3968
|
+
var _e = useQuery({
|
|
4083
3969
|
queryKey: ["getTaxationRequiredAccountFields", token],
|
|
4084
3970
|
queryFn: function () { return getTaxationRequiredAccountFields({ token: token, apiHost: apiHost }); },
|
|
4085
3971
|
enabled: Boolean(quote),
|
|
4086
3972
|
staleTime: 0,
|
|
4087
|
-
}), taxationRequiredAccountFields =
|
|
4088
|
-
var
|
|
3973
|
+
}), taxationRequiredAccountFields = _e.data, isLoadingTaxationRequiredAccountFields = _e.isLoading;
|
|
3974
|
+
var _f = useQuery({
|
|
4089
3975
|
queryKey: ["account", quote === null || quote === void 0 ? void 0 : quote.accountId],
|
|
4090
3976
|
queryFn: function () {
|
|
4091
3977
|
return (quote === null || quote === void 0 ? void 0 : quote.accountId) && getAccount({ id: quote.accountId, token: token, apiHost: apiHost });
|
|
4092
3978
|
},
|
|
4093
3979
|
enabled: Boolean(quote === null || quote === void 0 ? void 0 : quote.accountId) &&
|
|
4094
3980
|
((taxationRequiredAccountFields === null || taxationRequiredAccountFields === void 0 ? void 0 : taxationRequiredAccountFields.length) || 0) > 0,
|
|
4095
|
-
}), account =
|
|
3981
|
+
}), account = _f.data, isLoadingAccount = _f.isLoading;
|
|
4096
3982
|
useQuery({
|
|
4097
3983
|
queryKey: queryKeyFactory.createQuoteTaxCalculateKey(quote === null || quote === void 0 ? void 0 : quote.id),
|
|
4098
3984
|
queryFn: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -4129,30 +4015,24 @@ var Checkout = function (_a) {
|
|
|
4129
4015
|
return null;
|
|
4130
4016
|
return (jsx("div", __assign({ className: "flex flex-col fixed top-0 left-0 right-0 bottom-0 bg-slate-50 overflow-auto", style: {
|
|
4131
4017
|
zIndex: 1001,
|
|
4132
|
-
} }, { children: jsxs("div", __assign({ className: pageWrapperClassName(isMobile) }, { children: [jsx("div", __assign({ className: "flex justify-end w-full" }, { children: jsx(CloseOutlined$1, { className: "text-base shadow-padding-xb", onClick: onCancel }) })), 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)) && (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)) && (jsx(Divider, { className: "h-full", type: "vertical" })), invoice ? (jsx(InvoiceCheckout, { invoice: invoice,
|
|
4018
|
+
} }, { children: jsxs("div", __assign({ className: pageWrapperClassName(isMobile) }, { children: [jsx("div", __assign({ className: "flex justify-end w-full" }, { children: jsx(CloseOutlined$1, { className: "text-base shadow-padding-xb", onClick: onCancel }) })), 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)) && (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)) && (jsx(Divider, { className: "h-full", type: "vertical" })), invoice ? (jsx(InvoiceCheckout, { invoice: invoice, onFail: function (error) {
|
|
4133
4019
|
onFail(error);
|
|
4134
|
-
setIsSaving(false);
|
|
4135
4020
|
}, onSuccess: function (_a) {
|
|
4136
4021
|
var savePaymentMethod = _a.savePaymentMethod;
|
|
4137
4022
|
onSuccess({ savePaymentMethod: savePaymentMethod });
|
|
4138
|
-
|
|
4139
|
-
}, setIsSaving: setIsSaving, entityId: entityId })) : quote ? (jsx(QuoteCheckout, { account: account, entityId: entityId, isSaving: isSaving, onFail: function (error) {
|
|
4023
|
+
}, entityId: entityId })) : quote ? (jsx(QuoteCheckout, { account: account, entityId: entityId, onFail: function (error) {
|
|
4140
4024
|
onFail(error);
|
|
4141
|
-
setIsSaving(false);
|
|
4142
4025
|
}, onSuccess: function (_a) {
|
|
4143
4026
|
var savePaymentMethod = _a.savePaymentMethod;
|
|
4144
4027
|
onSuccess({ savePaymentMethod: savePaymentMethod });
|
|
4145
|
-
|
|
4146
|
-
}, quote: quote, setIsSaving: setIsSaving, taxationRequiredAccountFields: taxationRequiredAccountFields, token: token })) : (jsx(PaymentForm, { entityId: entityId, isSaving: isSaving, onFail: function (error) {
|
|
4028
|
+
}, quote: quote, taxationRequiredAccountFields: taxationRequiredAccountFields, token: token })) : (jsx(PaymentForm, { entityId: entityId, onFail: function (error) {
|
|
4147
4029
|
onFail(error);
|
|
4148
|
-
setIsSaving(false);
|
|
4149
4030
|
}, onPaymentSuccess: function (_a) {
|
|
4150
4031
|
var pluginPaymentResponse = _a.pluginPaymentResponse;
|
|
4151
4032
|
onSuccess({
|
|
4152
4033
|
savePaymentMethod: pluginPaymentResponse === null || pluginPaymentResponse === void 0 ? void 0 : pluginPaymentResponse.savePaymentMethod,
|
|
4153
4034
|
});
|
|
4154
|
-
|
|
4155
|
-
}, setIsSaving: setIsSaving }))] }))] })) })));
|
|
4035
|
+
} }))] }))] })) })));
|
|
4156
4036
|
};
|
|
4157
4037
|
|
|
4158
4038
|
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}"; };
|
|
@@ -4190,7 +4070,32 @@ var accountSignup = function (_a) {
|
|
|
4190
4070
|
});
|
|
4191
4071
|
};
|
|
4192
4072
|
|
|
4193
|
-
var MUTATION$3 =
|
|
4073
|
+
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";
|
|
4074
|
+
var portalSessionCreate = function (_a) {
|
|
4075
|
+
var tenantCode = _a.tenantCode, expiry = _a.expiry, returnUrl = _a.returnUrl, token = _a.token, apiHost = _a.apiHost;
|
|
4076
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
4077
|
+
var response, errors;
|
|
4078
|
+
var _b;
|
|
4079
|
+
return __generator(this, function (_c) {
|
|
4080
|
+
switch (_c.label) {
|
|
4081
|
+
case 0: return [4 /*yield*/, gqlRequest({
|
|
4082
|
+
query: MUTATION$3,
|
|
4083
|
+
token: token,
|
|
4084
|
+
vars: { tenantCode: tenantCode, expiry: expiry, returnUrl: returnUrl },
|
|
4085
|
+
apiHost: apiHost,
|
|
4086
|
+
})];
|
|
4087
|
+
case 1:
|
|
4088
|
+
response = _c.sent();
|
|
4089
|
+
errors = (response === null || response === void 0 ? void 0 : response.portalSessionCreate).errors;
|
|
4090
|
+
if (errors)
|
|
4091
|
+
throw errors;
|
|
4092
|
+
return [2 /*return*/, (_b = response === null || response === void 0 ? void 0 : response.portalSessionCreate) === null || _b === void 0 ? void 0 : _b.token];
|
|
4093
|
+
}
|
|
4094
|
+
});
|
|
4095
|
+
});
|
|
4096
|
+
};
|
|
4097
|
+
|
|
4098
|
+
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}"; };
|
|
4194
4099
|
var quoteAccountSignup = function (_a) {
|
|
4195
4100
|
var token = _a.token, apiHost = _a.apiHost, entityId = _a.entityId, priceListCode = _a.priceListCode, accountName = _a.accountName, billingContact = _a.billingContact;
|
|
4196
4101
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -4206,7 +4111,7 @@ var quoteAccountSignup = function (_a) {
|
|
|
4206
4111
|
billingContact: billingContact,
|
|
4207
4112
|
};
|
|
4208
4113
|
return [4 /*yield*/, gqlRequest({
|
|
4209
|
-
query: MUTATION$
|
|
4114
|
+
query: MUTATION$2(),
|
|
4210
4115
|
token: token,
|
|
4211
4116
|
vars: vars,
|
|
4212
4117
|
apiHost: apiHost,
|
|
@@ -4222,7 +4127,7 @@ var quoteAccountSignup = function (_a) {
|
|
|
4222
4127
|
});
|
|
4223
4128
|
};
|
|
4224
4129
|
|
|
4225
|
-
var MUTATION$
|
|
4130
|
+
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}"; };
|
|
4226
4131
|
var getPriceList = function (_a) {
|
|
4227
4132
|
var token = _a.token, code = _a.code, apiHost = _a.apiHost;
|
|
4228
4133
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -4230,7 +4135,7 @@ var getPriceList = function (_a) {
|
|
|
4230
4135
|
return __generator(this, function (_b) {
|
|
4231
4136
|
switch (_b.label) {
|
|
4232
4137
|
case 0: return [4 /*yield*/, gqlRequest({
|
|
4233
|
-
query: MUTATION$
|
|
4138
|
+
query: MUTATION$1(),
|
|
4234
4139
|
token: token,
|
|
4235
4140
|
vars: { code: code },
|
|
4236
4141
|
apiHost: apiHost,
|
|
@@ -4244,8 +4149,8 @@ var getPriceList = function (_a) {
|
|
|
4244
4149
|
};
|
|
4245
4150
|
|
|
4246
4151
|
function PaymentForms(_a) {
|
|
4247
|
-
var quote = _a.quote,
|
|
4248
|
-
return (jsx(Fragment, { children: quote ? (jsx(Fragment, { children:
|
|
4152
|
+
var quote = _a.quote, handlePaymentSaveSuccess = _a.handlePaymentSaveSuccess, handlePaymentFail = _a.handlePaymentFail, handleSubmit = _a.handleSubmit, proceedingToPayment = _a.proceedingToPayment, entityId = _a.entityId, accountId = _a.accountId;
|
|
4153
|
+
return (jsx(Fragment, { children: quote ? (jsx(Fragment, { children: jsx(PaymentForm, { entityId: entityId, onFail: handlePaymentFail, onPaymentSuccess: handlePaymentSaveSuccess, accountId: accountId, quote: quote }) })) : (jsx(InitialSignupForm, { onSubmit: handleSubmit, submitting: proceedingToPayment })) }));
|
|
4249
4154
|
}
|
|
4250
4155
|
function InitialSignupForm(_a) {
|
|
4251
4156
|
var onSubmit = _a.onSubmit, submitting = _a.submitting;
|
|
@@ -4260,7 +4165,7 @@ function InitialSignupForm(_a) {
|
|
|
4260
4165
|
var _b = e.target, name = _b.name, value = _b.value;
|
|
4261
4166
|
setFormData(__assign(__assign({}, formData), (_a = {}, _a[name] = value, _a)));
|
|
4262
4167
|
};
|
|
4263
|
-
return (jsxs(Form, __assign({ className: "flex
|
|
4168
|
+
return (jsxs(Form, __assign({ className: "flex flex-col justify-between h-full w-full", onFinish: function () { return onSubmit(formData); } }, { children: [jsxs("div", __assign({ className: "flex flex-col space-y-2" }, { children: [jsx(Form.Item, __assign({ rules: [{ required: true, message: "Please input your first name!" }], initialValue: formData.firstName }, { children: jsx(Input, { placeholder: "First name", value: formData.firstName, onChange: function (e) {
|
|
4264
4169
|
handleInputChange(e);
|
|
4265
4170
|
setFormData(__assign(__assign({}, formData), { firstName: e.target.value }));
|
|
4266
4171
|
} }) })), jsx(Form.Item, __assign({ rules: [{ required: true, message: "Please input your last name!" }], initialValue: formData.lastName }, { children: jsx(Input, { placeholder: "Last name", value: formData.lastName, onChange: function (e) {
|
|
@@ -4280,61 +4185,40 @@ function InitialSignupForm(_a) {
|
|
|
4280
4185
|
} }) }))] })), jsx(Form.Item, { children: jsx(Button, __assign({ type: "primary", htmlType: "submit", loading: submitting, className: "w-full mt-4" }, { children: "Proceed to payment" })) })] })));
|
|
4281
4186
|
}
|
|
4282
4187
|
|
|
4283
|
-
var Title = Typography.Title, Text$
|
|
4188
|
+
var Title = Typography.Title, Text$6 = Typography.Text;
|
|
4284
4189
|
function PaymentSuccessDisplay(_a) {
|
|
4285
4190
|
var amountPaid = _a.amountPaid, className = _a.className, companyName = _a.companyName, returnUrl = _a.returnUrl, style = _a.style;
|
|
4286
4191
|
var window = useContext(BunnyContext).window;
|
|
4287
|
-
return (jsxs("div", __assign({ className: "flex flex-col items-center justify-center h-full ".concat(className), style: style }, { children: [jsx(CheckCircleFilled$1, { style: { fontSize: "48px", color: "rgb(52 211 153)" } }), jsxs(Title, __assign({ level: 3, className: "mt-2 m-0" }, { children: ["Payment of ", formatCurrency(amountPaid, "USD"), " successful"] })), returnUrl && (jsxs(Text$
|
|
4192
|
+
return (jsxs("div", __assign({ className: "flex flex-col items-center justify-center h-full ".concat(className), style: style }, { children: [jsx(CheckCircleFilled$1, { style: { fontSize: "48px", color: "rgb(52 211 153)" } }), jsxs(Title, __assign({ level: 3, className: "mt-2 m-0" }, { children: ["Payment of ", formatCurrency(amountPaid, "USD"), " successful"] })), returnUrl && (jsxs(Text$6, __assign({ className: "text-slate-500 cursor-pointer underline", onClick: function () { return (window.location.href = returnUrl); } }, { children: ["Back to ", companyName] })))] })));
|
|
4288
4193
|
}
|
|
4289
4194
|
|
|
4290
|
-
var Text$
|
|
4195
|
+
var Text$5 = Typography.Text;
|
|
4291
4196
|
function PriceListDisplay(_a) {
|
|
4292
4197
|
var priceListData = _a.priceListData, topNavImageUrl = _a.topNavImageUrl;
|
|
4293
4198
|
if (!priceListData)
|
|
4294
4199
|
return null;
|
|
4295
|
-
return (jsx(Fragment, { children: jsx("div", __assign({ className: "flex flex-col justify-between h-full my-12" }, { children: jsxs("div", __assign({ className: "flex flex-col space-y-8" }, { children: [jsx(Image, { width: 24, src: topNavImageUrl, alt: "Logo", preview: false }), jsxs("div", __assign({ className: "flex flex-col" }, { children: [jsx(Text$
|
|
4200
|
+
return (jsx(Fragment, { children: jsx("div", __assign({ className: "flex flex-col justify-between h-full my-12" }, { children: jsxs("div", __assign({ className: "flex flex-col space-y-8" }, { children: [jsx(Image, { width: 24, src: topNavImageUrl, alt: "Logo", preview: false }), jsxs("div", __assign({ className: "flex flex-col" }, { children: [jsx(Text$5, __assign({ className: "text-slate-500 font-bold text-lg" }, { children: priceListData.name })), jsxs(Text$5, __assign({ className: "font-bold text-xl" }, { children: [formatCurrency(priceListData.basePrice, priceListData.currencyId), " ", "/ month"] }))] })), jsxs("div", __assign({ className: "flex flex-col" }, { children: [jsxs(Text$5, __assign({ style: { fontSize: "16px" }, className: "text-slate-500" }, { children: [priceListData.trialLengthDays, " day trial"] })), jsx(Text$5, __assign({ className: "text-slate-500", style: { fontSize: "12px" } }, { children: "You will not be charged until the last day of the trial." }))] }))] })) })) }));
|
|
4296
4201
|
}
|
|
4297
4202
|
|
|
4298
|
-
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";
|
|
4299
|
-
var portalSessionCreate = function (_a) {
|
|
4300
|
-
var tenantCode = _a.tenantCode, expiry = _a.expiry, returnUrl = _a.returnUrl, token = _a.token, apiHost = _a.apiHost;
|
|
4301
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
4302
|
-
var response, errors;
|
|
4303
|
-
var _b;
|
|
4304
|
-
return __generator(this, function (_c) {
|
|
4305
|
-
switch (_c.label) {
|
|
4306
|
-
case 0: return [4 /*yield*/, gqlRequest({
|
|
4307
|
-
query: MUTATION$1,
|
|
4308
|
-
token: token,
|
|
4309
|
-
vars: { tenantCode: tenantCode, expiry: expiry, returnUrl: returnUrl },
|
|
4310
|
-
apiHost: apiHost,
|
|
4311
|
-
})];
|
|
4312
|
-
case 1:
|
|
4313
|
-
response = _c.sent();
|
|
4314
|
-
errors = (response === null || response === void 0 ? void 0 : response.portalSessionCreate).errors;
|
|
4315
|
-
if (errors)
|
|
4316
|
-
throw errors;
|
|
4317
|
-
return [2 /*return*/, (_b = response === null || response === void 0 ? void 0 : response.portalSessionCreate) === null || _b === void 0 ? void 0 : _b.token];
|
|
4318
|
-
}
|
|
4319
|
-
});
|
|
4320
|
-
});
|
|
4321
|
-
};
|
|
4322
|
-
|
|
4323
4203
|
var showErrorNotification = useErrorNotification();
|
|
4324
4204
|
function Signup(_a) {
|
|
4325
|
-
var companyName = _a.companyName, entityId = _a.entityId, priceListCode = _a.priceListCode, returnUrl = _a.returnUrl;
|
|
4205
|
+
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;
|
|
4326
4206
|
// Hooks
|
|
4327
|
-
var
|
|
4207
|
+
var _d = useContext(BunnyContext), apiHost = _d.apiHost, token = _d.token, graphQLClient = _d.graphQLClient;
|
|
4328
4208
|
var isMobile = useIsMobile();
|
|
4329
4209
|
var topNavImageUrl = useContext(BrandContext).topNavImageUrl;
|
|
4330
|
-
var
|
|
4331
|
-
var
|
|
4332
|
-
var
|
|
4333
|
-
var
|
|
4334
|
-
var
|
|
4335
|
-
var
|
|
4336
|
-
var
|
|
4337
|
-
var
|
|
4210
|
+
var _e = useState(undefined), quote = _e[0], setQuote = _e[1];
|
|
4211
|
+
var _f = useState(undefined), accountId = _f[0], setAccountId = _f[1];
|
|
4212
|
+
var _g = useState(undefined), quoteId = _g[0], setQuoteId = _g[1];
|
|
4213
|
+
var _h = useState(undefined), portalSessionToken = _h[0], setPortalSessionToken = _h[1];
|
|
4214
|
+
var _j = useState(undefined), formData = _j[0], setFormData = _j[1];
|
|
4215
|
+
var _k = useState(false), proceedingToPayment = _k[0], setProceedingToPayment = _k[1];
|
|
4216
|
+
var _l = useState(false), purchaseSucceeded = _l[0], setPurchaseSucceeded = _l[1];
|
|
4217
|
+
var _m = useState(undefined), paymentMethodGraphQLClient = _m[0], setPaymentMethodGraphQLClient = _m[1];
|
|
4218
|
+
var paymentMethod = usePaymentMethod(paymentMethodGraphQLClient || graphQLClient, accountId).data;
|
|
4219
|
+
var queryClient = useQueryClient();
|
|
4220
|
+
// console.log("signup paymentMethod", paymentMethod);
|
|
4221
|
+
console.log("signup accountId", accountId);
|
|
4338
4222
|
// Queries
|
|
4339
4223
|
var priceListData = useQuery({
|
|
4340
4224
|
queryKey: ["priceList", priceListCode],
|
|
@@ -4373,6 +4257,12 @@ function Signup(_a) {
|
|
|
4373
4257
|
case 2:
|
|
4374
4258
|
portalSessionToken = _a.sent();
|
|
4375
4259
|
setPortalSessionToken(portalSessionToken);
|
|
4260
|
+
setPaymentMethodGraphQLClient(createGraphQLClient(portalSessionToken, apiHost || ""));
|
|
4261
|
+
// We must invalidate the accountPaymentMethodKey query in order to clear payment methods from the provided api token,
|
|
4262
|
+
// to instead use paymentMethods from portalSessionToken.
|
|
4263
|
+
queryClient.invalidateQueries({
|
|
4264
|
+
queryKey: QueryKeyFactory.default.accountPaymentMethodKey,
|
|
4265
|
+
});
|
|
4376
4266
|
setQuoteId(data.quote.id);
|
|
4377
4267
|
setProceedingToPayment(false);
|
|
4378
4268
|
setQuote({
|
|
@@ -4385,11 +4275,10 @@ function Signup(_a) {
|
|
|
4385
4275
|
});
|
|
4386
4276
|
}
|
|
4387
4277
|
function handlePaymentSaveSuccess(paymentSuccess) {
|
|
4388
|
-
var _a;
|
|
4389
4278
|
return __awaiter(this, void 0, void 0, function () {
|
|
4390
4279
|
var response, plugin;
|
|
4391
|
-
return __generator(this, function (
|
|
4392
|
-
switch (
|
|
4280
|
+
return __generator(this, function (_a) {
|
|
4281
|
+
switch (_a.label) {
|
|
4393
4282
|
case 0:
|
|
4394
4283
|
if (!formData) {
|
|
4395
4284
|
throw new Error("Form data is required");
|
|
@@ -4410,14 +4299,13 @@ function Signup(_a) {
|
|
|
4410
4299
|
apiHost: apiHost,
|
|
4411
4300
|
entityId: entityId,
|
|
4412
4301
|
quoteId: quoteId,
|
|
4413
|
-
paymentMethodId:
|
|
4302
|
+
paymentMethodId: paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.id,
|
|
4414
4303
|
pluginId: plugin.id.toString(),
|
|
4415
4304
|
priceListCode: priceListCode,
|
|
4416
4305
|
accountId: accountId,
|
|
4417
4306
|
})];
|
|
4418
4307
|
case 1:
|
|
4419
|
-
|
|
4420
|
-
setIsPaying(false);
|
|
4308
|
+
_a.sent();
|
|
4421
4309
|
setPurchaseSucceeded(true);
|
|
4422
4310
|
return [2 /*return*/];
|
|
4423
4311
|
}
|
|
@@ -4426,14 +4314,14 @@ function Signup(_a) {
|
|
|
4426
4314
|
}
|
|
4427
4315
|
function handlePaymentFail(error) {
|
|
4428
4316
|
showErrorNotification(error.message);
|
|
4429
|
-
setIsPaying(false);
|
|
4430
|
-
}
|
|
4431
|
-
if (isMobile) {
|
|
4432
|
-
return (jsx(Card, __assign({ className: "p-4 flex flex-col" }, { children: purchaseSucceeded ? (jsx(PaymentSuccessDisplay, { amountPaid: (quote === null || quote === void 0 ? void 0 : quote.amountDue) || 0, className: "w-full", companyName: companyName, returnUrl: returnUrl })) : (jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col" : "flex-row", " h-full w-full") }, { children: [jsx("div", __assign({ className: "flex flex-col items-center" }, { children: jsx(PriceListDisplay, { priceListData: priceListData, topNavImageUrl: topNavImageUrl }) })), jsx("div", __assign({ className: "mx-8" }, { children: jsx(Divider, { className: "h-full" }) })), jsx("div", __assign({ className: "flex items-center justify-center my-12" }, { children: jsx(PaymentForms, { entityId: entityId, quote: quote, paying: paying, setIsPaying: setIsPaying, handlePaymentSaveSuccess: handlePaymentSaveSuccess, handlePaymentFail: handlePaymentFail, handleSubmit: handleSubmit, proceedingToPayment: proceedingToPayment, accountId: accountId || "" }) }))] }))) })));
|
|
4433
|
-
}
|
|
4434
|
-
else {
|
|
4435
|
-
return (jsx(Fragment, { children: jsx(Card, __assign({ className: "p-4 flex flex-col w-screen h-screen" }, { children: purchaseSucceeded ? (jsx(PaymentSuccessDisplay, { amountPaid: (quote === null || quote === void 0 ? void 0 : quote.amountDue) || 0, className: "w-full", companyName: companyName, returnUrl: returnUrl })) : (jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col" : "flex-row", " h-full w-full") }, { children: [jsx("div", __assign({ className: "flex flex-col w-1/2 items-center" }, { children: jsx(PriceListDisplay, { priceListData: priceListData, topNavImageUrl: topNavImageUrl }) })), jsx("div", __assign({ className: "my-4" }, { children: jsx(Divider, { className: "h-full", type: "vertical" }) })), jsx("div", __assign({ className: "flex w-1/2 items-center justify-center my-12" }, { children: jsx(PaymentForms, { entityId: entityId, quote: quote, paying: paying, setIsPaying: setIsPaying, handlePaymentSaveSuccess: handlePaymentSaveSuccess, handlePaymentFail: handlePaymentFail, handleSubmit: handleSubmit, proceedingToPayment: proceedingToPayment, accountId: accountId || "" }) }))] }))) })) }));
|
|
4436
4317
|
}
|
|
4318
|
+
var WrapperComponent = function (_a) {
|
|
4319
|
+
var children = _a.children, className = _a.className, style = _a.style;
|
|
4320
|
+
return isCardEnabled ? (jsx(Card, __assign({ className: className, style: style }, { children: children }))) : (jsx("div", __assign({ className: className, style: style }, { children: children })));
|
|
4321
|
+
};
|
|
4322
|
+
return (jsx(WrapperComponent, __assign({ className: "p-4 flex flex-col ".concat(shadow, " ").concat(className), style: style }, { children: purchaseSucceeded ? (jsx(PaymentSuccessDisplay, { amountPaid: (quote === null || quote === void 0 ? void 0 : quote.amountDue) || 0, className: "w-full", companyName: companyName, returnUrl: returnUrl })) : (jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col" : "flex-row", " h-full w-full") }, { children: [jsx("div", __assign({ className: "flex flex-col ".concat(isMobile ? "items-center" : "w-1/2 items-center") }, { children: jsx(PriceListDisplay, { priceListData: priceListData, topNavImageUrl: topNavImageUrl }) })), jsx("div", __assign({ className: "".concat(isMobile ? "h-full" : "my-4") }, { children: jsx(Divider, { className: "h-full", type: isMobile ? undefined : "vertical" }) })), jsx("div", __assign({ className: "flex ".concat(isMobile
|
|
4323
|
+
? "items-center justify-center my-12"
|
|
4324
|
+
: "w-1/2 items-center justify-center my-12") }, { children: jsx("div", __assign({ className: "".concat(isMobile ? "w-full" : "w-1/2") }, { children: jsx(PaymentForms, { entityId: entityId, quote: quote, handlePaymentSaveSuccess: handlePaymentSaveSuccess, handlePaymentFail: handlePaymentFail, handleSubmit: handleSubmit, proceedingToPayment: proceedingToPayment, accountId: accountId }) })) }))] }))) })));
|
|
4437
4325
|
}
|
|
4438
4326
|
|
|
4439
4327
|
// WARNING: There is a preview button on APP that will need to be changed if this query is changed
|
|
@@ -4567,6 +4455,19 @@ var ErrorView = function (_a) {
|
|
|
4567
4455
|
return (jsxs("div", __assign({ className: "flex flex-col w-full", style: { marginTop: "80px" } }, { children: [jsx("div", __assign({ style: { fontSize: "32px" } }, { children: message })), children] })));
|
|
4568
4456
|
};
|
|
4569
4457
|
|
|
4458
|
+
var Text$4 = Typography.Text;
|
|
4459
|
+
var PageHeaderWithActions = function (_a) {
|
|
4460
|
+
var children = _a.children, title = _a.title, className = _a.className;
|
|
4461
|
+
var isMobile = useIsMobile();
|
|
4462
|
+
return (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: [jsx(PageSubTitle, { title: title }), children] })));
|
|
4463
|
+
};
|
|
4464
|
+
var PageSubTitle = function (_a) {
|
|
4465
|
+
var title = _a.title;
|
|
4466
|
+
var secondaryColor = useContext(BrandContext).secondaryColor;
|
|
4467
|
+
var darkMode = useContext(BunnyContext).darkMode;
|
|
4468
|
+
return (jsx(Text$4, __assign({ className: "shrink-0 font-medium", style: { color: darkMode ? undefined : secondaryColor } }, { children: title })));
|
|
4469
|
+
};
|
|
4470
|
+
|
|
4570
4471
|
var Text$3 = Typography.Text;
|
|
4571
4472
|
var HideExpiredToggle = function (_a) {
|
|
4572
4473
|
var hideExpired = _a.hideExpired, setHideExpired = _a.setHideExpired, subscriptions = _a.subscriptions;
|
|
@@ -5156,9 +5057,9 @@ var SubscriptionsContext = createContext({});
|
|
|
5156
5057
|
// !!! This component is intended to be view only, however it still has lots of code for full functionality.
|
|
5157
5058
|
// !!! This must be refactored.
|
|
5158
5059
|
var Subscriptions = function (_a) {
|
|
5159
|
-
var companyName = _a.companyName, entityId = _a.entityId, gap = _a.gap, shadow = _a.shadow, _b = _a.showTitle, showTitle = _b === void 0 ? true : _b;
|
|
5060
|
+
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;
|
|
5160
5061
|
// Context
|
|
5161
|
-
var _c = useContext(BunnyContext), token = _c.token, apiHost = _c.apiHost,
|
|
5062
|
+
var _c = useContext(BunnyContext), token = _c.token, apiHost = _c.apiHost, onTokenExpired = _c.onTokenExpired;
|
|
5162
5063
|
// Recoil state
|
|
5163
5064
|
// const [updatingChargeQuantityId, setUpdatingChargeQuantityId] =
|
|
5164
5065
|
// useRecoilState(updatingChargeQuantityIdState);
|
|
@@ -5168,10 +5069,7 @@ var Subscriptions = function (_a) {
|
|
|
5168
5069
|
var _f = useState(true), hideExpired = _f[0], setHideExpired = _f[1];
|
|
5169
5070
|
var _g = useState(false); _g[0]; var setQuantityDrawerOpen = _g[1];
|
|
5170
5071
|
// Hooks
|
|
5171
|
-
var handleAllErrorFormats = useAllErrorFormats(
|
|
5172
|
-
(function (url) {
|
|
5173
|
-
console.log("navigate to", url, " not implemented");
|
|
5174
|
-
}));
|
|
5072
|
+
var handleAllErrorFormats = useAllErrorFormats(onTokenExpired);
|
|
5175
5073
|
var queryClient = useQueryClient();
|
|
5176
5074
|
var showSuccessNotification = useSuccessNotification();
|
|
5177
5075
|
// const quoteDelete = useQuoteDelete();
|
|
@@ -5249,7 +5147,7 @@ var Subscriptions = function (_a) {
|
|
|
5249
5147
|
shadow: shadow,
|
|
5250
5148
|
gap: gap,
|
|
5251
5149
|
showTitle: showTitle,
|
|
5252
|
-
} }, { children: [showTitle && (jsx(PageHeaderWithActions, __assign({ title: jsxs("div", __assign({ className: "flex items-center justify-between", style: { minWidth: "137px" } }, { children: [hideExpired ? "Active subscriptions" : "All subscriptions", isMobile && (jsx(HideExpiredToggle, { hideExpired: hideExpired, setHideExpired: setHideExpired, subscriptions: subscriptions }))] })) }, { children: !isMobile && (jsx(SubscriptionsNavigation, { hideExpired: hideExpired, setHideExpired: setHideExpired, setQuantityDrawerOpen: setQuantityDrawerOpen, subscriptions: subscriptions })) }))), jsx("div", __assign({ className: "flex flex-col gap-".concat(gap === undefined ? 4 : gap, " shadow-padding-xb overflow-auto"), style: {
|
|
5150
|
+
} }, { children: [showTitle && (jsx(PageHeaderWithActions, __assign({ className: className, title: jsxs("div", __assign({ className: "flex items-center justify-between", style: { minWidth: "137px" } }, { children: [hideExpired ? "Active subscriptions" : "All subscriptions", isMobile && (jsx(HideExpiredToggle, { hideExpired: hideExpired, setHideExpired: setHideExpired, subscriptions: subscriptions }))] })) }, { children: !isMobile && (jsx(SubscriptionsNavigation, { hideExpired: hideExpired, setHideExpired: setHideExpired, setQuantityDrawerOpen: setQuantityDrawerOpen, subscriptions: subscriptions })) }))), jsx("div", __assign({ className: "flex flex-col gap-".concat(gap === undefined ? 4 : gap, " shadow-padding-xb overflow-auto ").concat(className), style: {
|
|
5253
5151
|
flexShrink: 1,
|
|
5254
5152
|
} }, { children: (subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.length) > 0 ? (jsx(Fragment, { children: jsx(SubscriptionsList, { hideExpired: hideExpired, planChangeOptions: planChangeOptions, setEditingQuoteData: setEditingQuoteData, setPayModalVisible: setPayModalVisible, subscriptions: subscriptions }) })) : (jsx("div", __assign({ className: "flex flex-col items-center w-full" }, { children: jsx(ErrorView, { message: "You have no subscriptions with ".concat(companyName, " yet") }) }))) })), isMobile && (jsx("div", __assign({ className: "pt-4 pb-2" }, { children: jsx(SubscriptionsNavigation, { hideExpired: hideExpired, setHideExpired: setHideExpired, setQuantityDrawerOpen: setQuantityDrawerOpen, subscriptions: subscriptions }) }))), jsx(Checkout, { entityId: entityId, onCancel: onCancel, onSuccess: onSuccess, onFail: onFail, open: payModalVisible, quote: quote, token: token, isMobile: isMobile })] })));
|
|
5255
5153
|
};
|