@bunnyapp/components 1.0.11 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +1069 -1161
- package/dist/cjs/src/components/BillingDetails/BillingDetails.d.ts +10 -0
- package/dist/cjs/src/components/BillingDetails/BillingDetails.stories.d.ts +11 -0
- package/dist/cjs/src/components/BillingDetails/index.d.ts +1 -0
- package/dist/cjs/src/components/BunnyProvider.d.ts +3 -3
- package/dist/cjs/src/components/Checkout/InvoiceCheckout.d.ts +1 -21
- package/dist/cjs/src/components/Checkout/QuoteCheckout.d.ts +1 -1
- package/dist/cjs/src/components/Invoice/Invoice.d.ts +8 -2
- package/dist/cjs/src/components/Invoice/Invoice.stories.d.ts +14 -5
- package/dist/cjs/src/components/PageHeaderWithActions.d.ts +2 -1
- package/dist/cjs/src/components/PaymentForm/CheckoutFooter.d.ts +8 -7
- package/dist/cjs/src/components/PaymentForm/DemoPay/DemoPayForm.d.ts +6 -2
- package/dist/cjs/src/components/PaymentForm/DemoPay/demoPayUtils.d.ts +1 -3
- package/dist/cjs/src/components/PaymentForm/DemoPay/hooks/usePay.d.ts +13 -0
- package/dist/cjs/src/components/PaymentForm/DemoPay/hooks/useSave.d.ts +21 -0
- package/dist/cjs/src/components/PaymentForm/PaymentForm.d.ts +10 -6
- package/dist/cjs/src/components/PaymentForm/PaymentFormTypes.d.ts +0 -8
- package/dist/cjs/src/components/PaymentForm/PaymentMethod/CreditCard/CreditCard.d.ts +12 -2
- package/dist/cjs/src/components/PaymentForm/PaymentMethod/PaymentMethod.d.ts +6 -4
- package/dist/cjs/src/components/PaymentForm/PaymentMethod/PaymentMethod.stories.d.ts +11 -0
- package/dist/cjs/src/components/PaymentForm/PaymentMethodDetails.d.ts +8 -0
- package/dist/cjs/src/components/PaymentForm/PaymentMethodSelector.d.ts +2 -3
- package/dist/cjs/src/components/PaymentForm/SavePaymentMethodFooter.d.ts +6 -0
- package/dist/cjs/src/components/PaymentForm/Stripe/PaymentMethodForm.d.ts +6 -2
- package/dist/cjs/src/components/PaymentForm/Stripe/StripeForm.d.ts +6 -2
- package/dist/cjs/src/components/PaymentForm/Stripe/hooks/usePay.d.ts +12 -0
- package/dist/cjs/src/components/PaymentForm/Stripe/hooks/useSave.d.ts +10 -0
- package/dist/cjs/src/components/PaymentForm/Stripe/stripeUtils.d.ts +9 -3
- package/dist/cjs/src/components/PaymentForm/useRemovePaymentMethod.d.ts +3 -0
- package/dist/cjs/src/components/Quote/Quote.d.ts +2 -4
- package/dist/cjs/src/components/Quote/Quote.stories.d.ts +122 -6
- package/dist/cjs/src/components/Quotes/Quotes.d.ts +8 -4
- package/dist/cjs/src/components/Quotes/Quotes.stories.d.ts +22 -0
- package/dist/cjs/src/components/Signup/PaymentForms.d.ts +2 -4
- package/dist/cjs/src/components/Signup/Signup.d.ts +11 -1
- package/dist/cjs/src/components/Signup/Signup.stories.d.ts +6 -4
- package/dist/cjs/src/components/StateTag.d.ts +3 -5
- package/dist/cjs/src/components/Subscriptions/Subscriptions.d.ts +2 -1
- package/dist/cjs/src/components/Subscriptions/Subscriptions.stories.d.ts +10 -0
- package/dist/cjs/src/components/Transactions/Transactions.d.ts +7 -5
- package/dist/cjs/src/components/Transactions/Transactions.stories.d.ts +15 -6
- package/dist/cjs/src/components/Transactions/TransactionsListContext.d.ts +5 -1
- package/dist/cjs/src/components/Transactions/transactionsList/TransactionsListDesktop.d.ts +1 -1
- package/dist/cjs/src/contexts/PaymentContext.d.ts +2 -2
- package/dist/cjs/src/graphql/queries/getAccount.d.ts +1 -1
- package/dist/cjs/src/hooks/quotes/useSendAcceptQuote.d.ts +2 -2
- package/dist/cjs/src/hooks/usePaymentMethod.d.ts +1 -1
- package/dist/cjs/src/mocks/handlers.d.ts +1 -1
- package/dist/cjs/src/storybook-utils.d.ts +10 -0
- package/dist/cjs/src/types/shadowType.d.ts +1 -0
- package/dist/esm/index.js +1073 -1165
- package/dist/esm/src/components/BillingDetails/BillingDetails.d.ts +10 -0
- package/dist/esm/src/components/BillingDetails/BillingDetails.stories.d.ts +11 -0
- package/dist/esm/src/components/BillingDetails/index.d.ts +1 -0
- package/dist/esm/src/components/BunnyProvider.d.ts +3 -3
- package/dist/esm/src/components/Checkout/InvoiceCheckout.d.ts +1 -21
- package/dist/esm/src/components/Checkout/QuoteCheckout.d.ts +1 -1
- package/dist/esm/src/components/Invoice/Invoice.d.ts +8 -2
- package/dist/esm/src/components/Invoice/Invoice.stories.d.ts +14 -5
- package/dist/esm/src/components/PageHeaderWithActions.d.ts +2 -1
- package/dist/esm/src/components/PaymentForm/CheckoutFooter.d.ts +8 -7
- package/dist/esm/src/components/PaymentForm/DemoPay/DemoPayForm.d.ts +6 -2
- package/dist/esm/src/components/PaymentForm/DemoPay/demoPayUtils.d.ts +1 -3
- package/dist/esm/src/components/PaymentForm/DemoPay/hooks/usePay.d.ts +13 -0
- package/dist/esm/src/components/PaymentForm/DemoPay/hooks/useSave.d.ts +21 -0
- package/dist/esm/src/components/PaymentForm/PaymentForm.d.ts +10 -6
- package/dist/esm/src/components/PaymentForm/PaymentFormTypes.d.ts +0 -8
- package/dist/esm/src/components/PaymentForm/PaymentMethod/CreditCard/CreditCard.d.ts +12 -2
- package/dist/esm/src/components/PaymentForm/PaymentMethod/PaymentMethod.d.ts +6 -4
- package/dist/esm/src/components/PaymentForm/PaymentMethod/PaymentMethod.stories.d.ts +11 -0
- package/dist/esm/src/components/PaymentForm/PaymentMethodDetails.d.ts +8 -0
- package/dist/esm/src/components/PaymentForm/PaymentMethodSelector.d.ts +2 -3
- package/dist/esm/src/components/PaymentForm/SavePaymentMethodFooter.d.ts +6 -0
- package/dist/esm/src/components/PaymentForm/Stripe/PaymentMethodForm.d.ts +6 -2
- package/dist/esm/src/components/PaymentForm/Stripe/StripeForm.d.ts +6 -2
- package/dist/esm/src/components/PaymentForm/Stripe/hooks/usePay.d.ts +12 -0
- package/dist/esm/src/components/PaymentForm/Stripe/hooks/useSave.d.ts +10 -0
- package/dist/esm/src/components/PaymentForm/Stripe/stripeUtils.d.ts +9 -3
- package/dist/esm/src/components/PaymentForm/useRemovePaymentMethod.d.ts +3 -0
- package/dist/esm/src/components/Quote/Quote.d.ts +2 -4
- package/dist/esm/src/components/Quote/Quote.stories.d.ts +122 -6
- package/dist/esm/src/components/Quotes/Quotes.d.ts +8 -4
- package/dist/esm/src/components/Quotes/Quotes.stories.d.ts +22 -0
- package/dist/esm/src/components/Signup/PaymentForms.d.ts +2 -4
- package/dist/esm/src/components/Signup/Signup.d.ts +11 -1
- package/dist/esm/src/components/Signup/Signup.stories.d.ts +6 -4
- package/dist/esm/src/components/StateTag.d.ts +3 -5
- package/dist/esm/src/components/Subscriptions/Subscriptions.d.ts +2 -1
- package/dist/esm/src/components/Subscriptions/Subscriptions.stories.d.ts +10 -0
- package/dist/esm/src/components/Transactions/Transactions.d.ts +7 -5
- package/dist/esm/src/components/Transactions/Transactions.stories.d.ts +15 -6
- package/dist/esm/src/components/Transactions/TransactionsListContext.d.ts +5 -1
- package/dist/esm/src/components/Transactions/transactionsList/TransactionsListDesktop.d.ts +1 -1
- package/dist/esm/src/contexts/PaymentContext.d.ts +2 -2
- package/dist/esm/src/graphql/queries/getAccount.d.ts +1 -1
- package/dist/esm/src/hooks/quotes/useSendAcceptQuote.d.ts +2 -2
- package/dist/esm/src/hooks/usePaymentMethod.d.ts +1 -1
- package/dist/esm/src/mocks/handlers.d.ts +1 -1
- package/dist/esm/src/storybook-utils.d.ts +10 -0
- package/dist/esm/src/types/shadowType.d.ts +1 -0
- package/dist/index.d.ts +45 -25
- package/package.json +1 -1
- package/dist/cjs/src/components/PaymentForm/Finix/FinixCardForm.d.ts +0 -4
- package/dist/cjs/src/components/PaymentForm/Finix/index.d.ts +0 -2
- package/dist/cjs/src/components/PaymentForm/FinixAch.d.ts +0 -3
- package/dist/cjs/src/components/PaymentForm/PaymentMethod/PaymentMethodContext.d.ts +0 -5
- package/dist/cjs/src/components/PaymentForm/PaymentMethodForm.d.ts +0 -3
- package/dist/cjs/src/components/PaymentForm/PaymentOption.d.ts +0 -8
- package/dist/cjs/src/components/PaymentForm/StoredPaymentMethod/StoredPaymentMethodForm.d.ts +0 -3
- package/dist/cjs/src/components/PaymentForm/Stripe/CheckoutForm.d.ts +0 -3
- package/dist/cjs/src/components/PaymentForm/Stripe/index.d.ts +0 -1
- package/dist/cjs/src/components/PaymentForm/paymentUtils.d.ts +0 -7
- package/dist/cjs/src/stories/Button.d.ts +0 -15
- package/dist/cjs/src/stories/Button.stories.d.ts +0 -9
- package/dist/cjs/src/stories/Header.d.ts +0 -12
- package/dist/cjs/src/stories/Header.stories.d.ts +0 -7
- package/dist/cjs/src/stories/Page.d.ts +0 -3
- package/dist/cjs/src/stories/Page.stories.d.ts +0 -7
- package/dist/esm/src/components/PaymentForm/Finix/FinixCardForm.d.ts +0 -4
- package/dist/esm/src/components/PaymentForm/Finix/index.d.ts +0 -2
- package/dist/esm/src/components/PaymentForm/FinixAch.d.ts +0 -3
- package/dist/esm/src/components/PaymentForm/PaymentMethod/PaymentMethodContext.d.ts +0 -5
- package/dist/esm/src/components/PaymentForm/PaymentMethodForm.d.ts +0 -3
- package/dist/esm/src/components/PaymentForm/PaymentOption.d.ts +0 -8
- package/dist/esm/src/components/PaymentForm/StoredPaymentMethod/StoredPaymentMethodForm.d.ts +0 -3
- package/dist/esm/src/components/PaymentForm/Stripe/CheckoutForm.d.ts +0 -3
- package/dist/esm/src/components/PaymentForm/Stripe/index.d.ts +0 -1
- package/dist/esm/src/components/PaymentForm/paymentUtils.d.ts +0 -7
- package/dist/esm/src/stories/Button.d.ts +0 -15
- package/dist/esm/src/stories/Button.stories.d.ts +0 -9
- package/dist/esm/src/stories/Header.d.ts +0 -12
- package/dist/esm/src/stories/Header.stories.d.ts +0 -7
- package/dist/esm/src/stories/Page.d.ts +0 -3
- package/dist/esm/src/stories/Page.stories.d.ts +0 -7
package/dist/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, QueryKeyFactory,
|
|
8
|
-
import { QueryClient, QueryClientProvider, useQuery,
|
|
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, QueryKeyFactory, 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,7 +1601,7 @@ 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
1606
|
var isMobile = useIsMobile();
|
|
1589
1607
|
var _c = useState(undefined), branding = _c[0], setBranding = _c[1];
|
|
@@ -1620,10 +1638,10 @@ function BunnyProvider(_a) {
|
|
|
1620
1638
|
accountId: accountId,
|
|
1621
1639
|
darkMode: darkMode,
|
|
1622
1640
|
graphQLClient: graphQLClient,
|
|
1623
|
-
onErrorNavigate: onErrorNavigate,
|
|
1624
1641
|
apiHost: apiHost,
|
|
1625
1642
|
token: token,
|
|
1626
1643
|
window: window,
|
|
1644
|
+
onTokenExpired: onTokenExpired,
|
|
1627
1645
|
} }, { children: [jsx("div", __assign({ style: { position: "fixed", left: -2000000000 } }, { children: "test" })), jsx(QueryClientProvider, __assign({ client: queryClient || extraQueryClient }, { children: jsx(RecoilRoot, { children: jsx(BrandContext.Provider, __assign({ value: entityBranding }, { children: jsx(ConfigProvider, __assign({ theme: {
|
|
1628
1646
|
algorithm: darkMode
|
|
1629
1647
|
? theme.darkAlgorithm
|
|
@@ -1740,27 +1758,39 @@ var InvoiceQuoteView = function (_a) {
|
|
|
1740
1758
|
var children = _a.children, formattedInvoice = _a.formattedInvoice, html = _a.html, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick, onDownloadError = _a.onDownloadError;
|
|
1741
1759
|
var downloadFile = useDownloadFile(formattedInvoice === null || formattedInvoice === void 0 ? void 0 : formattedInvoice.id, onDownloadError);
|
|
1742
1760
|
var secondaryColor = useContext(BrandContext).secondaryColor;
|
|
1743
|
-
var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
|
|
1761
|
+
var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
|
|
1762
|
+
var _c = useContext(InvoiceQuoteContext), shadow = _c.shadow, hideDownloadButton = _c.hideDownloadButton;
|
|
1744
1763
|
var isMobile = useIsMobile();
|
|
1745
|
-
|
|
1764
|
+
var buttonsVisible = formattedInvoice && (!hideDownloadButton || onBackButtonClick);
|
|
1765
|
+
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
1766
|
color: secondaryColor,
|
|
1747
|
-
}, type: "link" }, { children: backButtonName || "Back" }))) : null }), jsx(Button, __assign({ icon: jsx(DownloadOutlined$1, {}), onClick: function () {
|
|
1767
|
+
}, type: "link" }, { children: backButtonName || "Back" }))) : null }), !hideDownloadButton ? (jsx(Button, __assign({ icon: jsx(DownloadOutlined$1, {}), onClick: function () {
|
|
1748
1768
|
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: {
|
|
1769
|
+
} }, { 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
1770
|
minWidth: "750px",
|
|
1751
1771
|
} }, { children: [jsx(Markup, { content: html }), children] })))] })));
|
|
1752
1772
|
};
|
|
1753
1773
|
var templateObject_1$8;
|
|
1754
1774
|
|
|
1775
|
+
var quoteMetaDescription = function (vendorName) {
|
|
1776
|
+
return "View this quote on the ".concat(vendorName, " customer portal. Powered by Bunny");
|
|
1777
|
+
};
|
|
1778
|
+
var quoteMetaTitle = function (_a) {
|
|
1779
|
+
var documentName = _a.documentName, vendorName = _a.vendorName;
|
|
1780
|
+
return vendorName + " " + documentName;
|
|
1781
|
+
};
|
|
1782
|
+
|
|
1783
|
+
var PaymentContext = createContext({});
|
|
1784
|
+
|
|
1755
1785
|
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) {
|
|
1786
|
+
var usePaymentMethod = function (graphQLClient, accountId) {
|
|
1757
1787
|
var result = useQuery({
|
|
1758
1788
|
queryKey: QueryKeyFactory.default.accountPaymentMethodKey,
|
|
1759
1789
|
queryFn: function () {
|
|
1760
1790
|
return graphQLClient
|
|
1761
1791
|
.request(paymentMethodsQuery, {
|
|
1762
1792
|
first: 1,
|
|
1763
|
-
filter: "disabled is false",
|
|
1793
|
+
filter: "disabled is false".concat(accountId ? " and accountId is ".concat(accountId) : ""),
|
|
1764
1794
|
})
|
|
1765
1795
|
.then(function (data) {
|
|
1766
1796
|
var _a, _b;
|
|
@@ -1773,40 +1803,151 @@ var usePaymentMethod = function (graphQLClient) {
|
|
|
1773
1803
|
return result;
|
|
1774
1804
|
};
|
|
1775
1805
|
|
|
1776
|
-
var
|
|
1777
|
-
|
|
1806
|
+
var usePlugins = function (_a) {
|
|
1807
|
+
var entityId = _a.entityId, apiHost = _a.apiHost, token = _a.token;
|
|
1808
|
+
var response = useQuery({
|
|
1809
|
+
queryKey: QueryKeyFactory.default.pluginsKey,
|
|
1810
|
+
queryFn: function () {
|
|
1811
|
+
var plugins = getPlugins({
|
|
1812
|
+
entityId: entityId,
|
|
1813
|
+
token: token,
|
|
1814
|
+
apiHost: apiHost,
|
|
1815
|
+
});
|
|
1816
|
+
return plugins;
|
|
1817
|
+
},
|
|
1818
|
+
enabled: Boolean(entityId),
|
|
1819
|
+
});
|
|
1820
|
+
return response;
|
|
1778
1821
|
};
|
|
1779
1822
|
|
|
1780
|
-
var
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1823
|
+
var filterPaymentPlugins = function (plugins) {
|
|
1824
|
+
return plugins === null || plugins === void 0 ? void 0 : plugins.filter(function (plugin) {
|
|
1825
|
+
var _a, _b, _c, _d;
|
|
1826
|
+
return ((_a = plugin.type) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === "payment" &&
|
|
1827
|
+
((_b = plugin.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === "valid" &&
|
|
1828
|
+
((_d = (_c = plugin.components) === null || _c === void 0 ? void 0 : _c.frontend) === null || _d === void 0 ? void 0 : _d.length);
|
|
1829
|
+
});
|
|
1830
|
+
};
|
|
1831
|
+
var usePaymentPlugins = function (_a) {
|
|
1832
|
+
var entityId = _a.entityId, apiHost = _a.apiHost, token = _a.token;
|
|
1833
|
+
var _b = usePlugins({
|
|
1834
|
+
entityId: entityId,
|
|
1835
|
+
apiHost: apiHost,
|
|
1836
|
+
token: token,
|
|
1837
|
+
}), plugins = _b.data, isFetched = _b.isFetched;
|
|
1838
|
+
var paymentPlugins = filterPaymentPlugins(Array.isArray(plugins) ? plugins : []);
|
|
1839
|
+
var paymentMethodAllowedPlugins = paymentPlugins === null || paymentPlugins === void 0 ? void 0 : paymentPlugins.filter(function (plugin) {
|
|
1840
|
+
var _a, _b;
|
|
1841
|
+
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"); });
|
|
1842
|
+
});
|
|
1843
|
+
return {
|
|
1844
|
+
paymentPlugins: paymentPlugins,
|
|
1845
|
+
paymentMethodAllowedPlugins: paymentMethodAllowedPlugins,
|
|
1846
|
+
isFetched: isFetched,
|
|
1847
|
+
};
|
|
1790
1848
|
};
|
|
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
1849
|
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
var
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1850
|
+
// Simulated payment creation and confirmation
|
|
1851
|
+
var confirmPayment = function (_a) {
|
|
1852
|
+
var amount = _a.amount, currency = _a.currency;
|
|
1853
|
+
return { token: "DemoPayTestToken", amount: amount, currency: currency };
|
|
1854
|
+
};
|
|
1855
|
+
var DIGIT_REGEX = /\d/;
|
|
1856
|
+
var isDigit = function (char) { return DIGIT_REGEX.test(char); };
|
|
1857
|
+
var isDeletion = function (char) { return [8, 46].includes(char); }; // Backspace or Delete
|
|
1858
|
+
var isNavigation = function (char) { return [9, 37, 38, 39, 40].includes(char); }; // Tab, Arrows
|
|
1859
|
+
var isModifier = function (char) { return [16, 17, 18].includes(char); }; // Shift, Ctrl, Alt
|
|
1860
|
+
var isValidKey = function (code) {
|
|
1861
|
+
return isDeletion(code) || isNavigation(code) || isModifier(code);
|
|
1862
|
+
};
|
|
1863
|
+
var isValidExpiry = function (expiry) {
|
|
1864
|
+
var month = parseInt(expiry.substring(0, 2), 10);
|
|
1865
|
+
var year = parseInt(expiry.substring(2, 4), 10) + 2000;
|
|
1866
|
+
if (isNaN(month) || isNaN(year))
|
|
1867
|
+
return false;
|
|
1868
|
+
if (month < 1 || month > 12)
|
|
1869
|
+
return false;
|
|
1870
|
+
return true;
|
|
1871
|
+
};
|
|
1872
|
+
var isCardExpired = function (expiry) {
|
|
1873
|
+
var month = parseInt(expiry.substring(0, 2), 10);
|
|
1874
|
+
var year = parseInt(expiry.substring(2, 4), 10) + 2000;
|
|
1875
|
+
var expiryDate = new Date(year, month, 1);
|
|
1876
|
+
return expiryDate < new Date();
|
|
1877
|
+
};
|
|
1878
|
+
var formatCardExpiry = function (cardExpiry) {
|
|
1879
|
+
if (cardExpiry.length <= 2)
|
|
1880
|
+
return cardExpiry;
|
|
1881
|
+
return cardExpiry.substring(0, 2) + "/" + cardExpiry.substring(2);
|
|
1882
|
+
};
|
|
1883
|
+
// removes spaces from a credit card number
|
|
1884
|
+
var unformatCardNumber = function (cardNumber) {
|
|
1885
|
+
var cardNumberArray = cardNumber.split("");
|
|
1886
|
+
var unformattedCardNumberArray = cardNumberArray.filter(function (character) { return character !== " "; });
|
|
1887
|
+
return unformattedCardNumberArray.join("");
|
|
1809
1888
|
};
|
|
1889
|
+
var storePayment = function (options, plugin, apiHost, accountId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1890
|
+
var testCreditCardNumber, testCreditCardCvc, testCreditCardExpirationDate, token, response;
|
|
1891
|
+
return __generator(this, function (_a) {
|
|
1892
|
+
switch (_a.label) {
|
|
1893
|
+
case 0:
|
|
1894
|
+
testCreditCardNumber = options.testCreditCardNumber, testCreditCardCvc = options.testCreditCardCvc, testCreditCardExpirationDate = options.testCreditCardExpirationDate, token = options.token;
|
|
1895
|
+
return [4 /*yield*/, invokePlugin({
|
|
1896
|
+
method: "store_payment_method",
|
|
1897
|
+
plugin: plugin,
|
|
1898
|
+
payload: {
|
|
1899
|
+
test_credit_card_number: testCreditCardNumber,
|
|
1900
|
+
test_credit_card_cvc: testCreditCardCvc,
|
|
1901
|
+
test_credit_card_expiration_date: testCreditCardExpirationDate,
|
|
1902
|
+
account_id: accountId,
|
|
1903
|
+
},
|
|
1904
|
+
token: token,
|
|
1905
|
+
apiHost: apiHost,
|
|
1906
|
+
})];
|
|
1907
|
+
case 1:
|
|
1908
|
+
response = _a.sent();
|
|
1909
|
+
if ((response === null || response === void 0 ? void 0 : response.status) !== "success")
|
|
1910
|
+
throw new Error(response === null || response === void 0 ? void 0 : response.message);
|
|
1911
|
+
return [2 /*return*/, response];
|
|
1912
|
+
}
|
|
1913
|
+
});
|
|
1914
|
+
}); };
|
|
1915
|
+
|
|
1916
|
+
function usePay$1(_a) {
|
|
1917
|
+
var _this = this;
|
|
1918
|
+
var onPaymentSuccess = _a.onPaymentSuccess, onPaymentError = _a.onPaymentError, quote = _a.quote, invoice = _a.invoice;
|
|
1919
|
+
var pay = function (_a) {
|
|
1920
|
+
var plugin = _a.plugin, savePaymentMethod = _a.savePaymentMethod;
|
|
1921
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
1922
|
+
var amountDue, currencyId, response;
|
|
1923
|
+
return __generator(this, function (_b) {
|
|
1924
|
+
amountDue = quote ? getQuoteAmountDue(quote) : invoice === null || invoice === void 0 ? void 0 : invoice.amountDue;
|
|
1925
|
+
currencyId = (quote === null || quote === void 0 ? void 0 : quote.currencyId) || (invoice === null || invoice === void 0 ? void 0 : invoice.currency);
|
|
1926
|
+
if (!amountDue || !currencyId) {
|
|
1927
|
+
throw new Error("No amount or currencyId");
|
|
1928
|
+
}
|
|
1929
|
+
try {
|
|
1930
|
+
response = confirmPayment({
|
|
1931
|
+
amount: amountDue,
|
|
1932
|
+
currency: currencyId,
|
|
1933
|
+
});
|
|
1934
|
+
onPaymentSuccess({
|
|
1935
|
+
pluginPaymentResponse: {
|
|
1936
|
+
plugin: plugin,
|
|
1937
|
+
token: response.token,
|
|
1938
|
+
savePaymentMethod: savePaymentMethod,
|
|
1939
|
+
},
|
|
1940
|
+
});
|
|
1941
|
+
}
|
|
1942
|
+
catch (error) {
|
|
1943
|
+
onPaymentError === null || onPaymentError === void 0 ? void 0 : onPaymentError(error);
|
|
1944
|
+
}
|
|
1945
|
+
return [2 /*return*/];
|
|
1946
|
+
});
|
|
1947
|
+
});
|
|
1948
|
+
};
|
|
1949
|
+
return { pay: pay };
|
|
1950
|
+
}
|
|
1810
1951
|
|
|
1811
1952
|
var createPaymentMethod = function (_a) {
|
|
1812
1953
|
var paymentMethodId = _a.paymentMethodId, plugin = _a.plugin, token = _a.token, apiHost = _a.apiHost, accountId = _a.accountId;
|
|
@@ -1845,7 +1986,7 @@ var createSetupIntent = function (plugin, token, apiHost, accountId) {
|
|
|
1845
1986
|
});
|
|
1846
1987
|
};
|
|
1847
1988
|
var createPaymentIntent = function (_a) {
|
|
1848
|
-
var payable = _a.payable, savePaymentMethod = _a.savePaymentMethod, memo = _a.memo, plugin = _a.plugin, token = _a.token, apiHost = _a.apiHost
|
|
1989
|
+
var payable = _a.payable, savePaymentMethod = _a.savePaymentMethod, memo = _a.memo, plugin = _a.plugin, token = _a.token, apiHost = _a.apiHost;
|
|
1849
1990
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
1850
1991
|
var payload, response;
|
|
1851
1992
|
return __generator(this, function (_b) {
|
|
@@ -1855,7 +1996,6 @@ var createPaymentIntent = function (_a) {
|
|
|
1855
1996
|
payable_id: payable.payableId,
|
|
1856
1997
|
save_payment_method: savePaymentMethod,
|
|
1857
1998
|
memo: memo,
|
|
1858
|
-
account_id: accountId,
|
|
1859
1999
|
};
|
|
1860
2000
|
return [4 /*yield*/, invokePlugin({
|
|
1861
2001
|
plugin: plugin,
|
|
@@ -1873,21 +2013,37 @@ var createPaymentIntent = function (_a) {
|
|
|
1873
2013
|
});
|
|
1874
2014
|
});
|
|
1875
2015
|
};
|
|
1876
|
-
var fetchStripeKey = function (plugin, token, apiHost, accountId) {
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
2016
|
+
var fetchStripeKey = function (plugin, token, apiHost, accountId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2017
|
+
var response;
|
|
2018
|
+
return __generator(this, function (_a) {
|
|
2019
|
+
switch (_a.label) {
|
|
2020
|
+
case 0: return [4 /*yield*/, invokePlugin({
|
|
2021
|
+
plugin: plugin,
|
|
2022
|
+
method: "retrieve_config",
|
|
2023
|
+
token: token,
|
|
2024
|
+
apiHost: apiHost,
|
|
2025
|
+
payload: {
|
|
2026
|
+
account_id: accountId,
|
|
2027
|
+
},
|
|
2028
|
+
})];
|
|
2029
|
+
case 1:
|
|
2030
|
+
response = _a.sent();
|
|
2031
|
+
return [2 /*return*/, response];
|
|
2032
|
+
}
|
|
1885
2033
|
});
|
|
1886
|
-
};
|
|
2034
|
+
}); };
|
|
1887
2035
|
loadStripe.setLoadParameters({ advancedFraudSignals: false });
|
|
1888
2036
|
var useStripePlugin = function (plugin, token, apiHost, accountId) {
|
|
1889
2037
|
var _a = useState(null), stripe = _a[0], setStripe = _a[1];
|
|
1890
2038
|
var showErrorNotification = useErrorNotification();
|
|
2039
|
+
var options = {
|
|
2040
|
+
mode: "setup",
|
|
2041
|
+
// TODO: Fetch currency from the entity/account
|
|
2042
|
+
currency: "usd",
|
|
2043
|
+
setupFutureUsage: "off_session",
|
|
2044
|
+
};
|
|
2045
|
+
if (!plugin)
|
|
2046
|
+
return { stripe: null, options: options };
|
|
1891
2047
|
useEffect(function () {
|
|
1892
2048
|
fetchStripeKey(plugin, token, apiHost || "", accountId)
|
|
1893
2049
|
.then(function (_a) {
|
|
@@ -1900,293 +2056,253 @@ var useStripePlugin = function (plugin, token, apiHost, accountId) {
|
|
|
1900
2056
|
});
|
|
1901
2057
|
// eslint-disable-next-line
|
|
1902
2058
|
}, [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
|
-
: "") })) })));
|
|
2059
|
+
return { stripe: stripe, options: options };
|
|
1925
2060
|
};
|
|
1926
2061
|
|
|
1927
|
-
|
|
1928
|
-
var
|
|
2062
|
+
function usePay(_a) {
|
|
2063
|
+
var _this = this;
|
|
2064
|
+
var onPaymentSuccess = _a.onPaymentSuccess, onPaymentError = _a.onPaymentError, quote = _a.quote, invoice = _a.invoice;
|
|
1929
2065
|
// Hooks
|
|
1930
2066
|
var elements = useElements();
|
|
1931
2067
|
var stripe = useStripe();
|
|
1932
|
-
var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
2068
|
+
var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
|
|
2069
|
+
var pay = function (_a) {
|
|
2070
|
+
var plugin = _a.plugin;
|
|
2071
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
2072
|
+
var payable, submitError, paymentIntent, clientSecret, response, paymentIntentId, error_1;
|
|
2073
|
+
var _b;
|
|
2074
|
+
return __generator(this, function (_c) {
|
|
2075
|
+
switch (_c.label) {
|
|
2076
|
+
case 0:
|
|
2077
|
+
payable = (quote || invoice);
|
|
2078
|
+
_c.label = 1;
|
|
2079
|
+
case 1:
|
|
2080
|
+
_c.trys.push([1, 5, , 6]);
|
|
2081
|
+
if (!stripe)
|
|
2082
|
+
throw new Error("Form is not ready");
|
|
2083
|
+
if (!elements)
|
|
2084
|
+
throw new Error("Elements couldn't be retrieved");
|
|
2085
|
+
return [4 /*yield*/, elements.submit()];
|
|
2086
|
+
case 2:
|
|
2087
|
+
submitError = (_c.sent()).error;
|
|
2088
|
+
if (submitError)
|
|
2089
|
+
throw new Error(submitError.message);
|
|
2090
|
+
return [4 /*yield*/, createPaymentIntent({
|
|
2091
|
+
payable: payable,
|
|
2092
|
+
savePaymentMethod: true,
|
|
2093
|
+
plugin: plugin,
|
|
2094
|
+
token: token,
|
|
2095
|
+
apiHost: apiHost || "",
|
|
2096
|
+
})];
|
|
2097
|
+
case 3:
|
|
2098
|
+
paymentIntent = _c.sent();
|
|
2099
|
+
clientSecret = paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.client_secret;
|
|
2100
|
+
return [4 /*yield*/, stripe.confirmPayment({
|
|
2101
|
+
elements: elements,
|
|
2102
|
+
clientSecret: clientSecret,
|
|
2103
|
+
redirect: "if_required",
|
|
2104
|
+
confirmParams: {
|
|
2105
|
+
return_url: window.location.href,
|
|
2106
|
+
},
|
|
2107
|
+
})];
|
|
2108
|
+
case 4:
|
|
2109
|
+
response = _c.sent();
|
|
2110
|
+
// See https://stripe.com/docs/payments/save-during-payment?platform=web#web-submit-payment
|
|
2111
|
+
if (response.error)
|
|
2112
|
+
throw new Error(response.error.message);
|
|
2113
|
+
paymentIntentId = (_b = response.paymentIntent) === null || _b === void 0 ? void 0 : _b.id;
|
|
2114
|
+
if (!paymentIntentId)
|
|
2115
|
+
throw new Error("Payment intent couldn't be retrieved");
|
|
2116
|
+
onPaymentSuccess === null || onPaymentSuccess === void 0 ? void 0 : onPaymentSuccess({
|
|
2117
|
+
pluginPaymentResponse: {
|
|
2118
|
+
plugin: plugin,
|
|
2119
|
+
token: paymentIntentId,
|
|
2120
|
+
savePaymentMethod: true,
|
|
2121
|
+
},
|
|
2122
|
+
});
|
|
2123
|
+
return [3 /*break*/, 6];
|
|
2124
|
+
case 5:
|
|
2125
|
+
error_1 = _c.sent();
|
|
2126
|
+
onPaymentError === null || onPaymentError === void 0 ? void 0 : onPaymentError(error_1);
|
|
2127
|
+
return [3 /*break*/, 6];
|
|
2128
|
+
case 6: return [2 /*return*/];
|
|
2129
|
+
}
|
|
2130
|
+
});
|
|
2131
|
+
});
|
|
2132
|
+
};
|
|
2133
|
+
return { pay: pay };
|
|
2134
|
+
}
|
|
2135
|
+
|
|
2136
|
+
var showErrorNotification$1 = useErrorNotification();
|
|
2137
|
+
var ActualCheckoutFooter = function (_a) {
|
|
2138
|
+
var quote = _a.quote, invoice = _a.invoice, onPaymentSuccess = _a.onPaymentSuccess, noPadding = _a.noPadding, plugin = _a.plugin;
|
|
2139
|
+
var isMobile = useIsMobile();
|
|
2140
|
+
var _b = useState(false), isPaying = _b[0], setIsPaying = _b[1];
|
|
2141
|
+
var amountDue = quote ? getQuoteAmountDue(quote) : invoice === null || invoice === void 0 ? void 0 : invoice.amountDue;
|
|
2142
|
+
var currencyId = (quote === null || quote === void 0 ? void 0 : quote.currencyId) || (invoice === null || invoice === void 0 ? void 0 : invoice.currency);
|
|
2143
|
+
// Payment hooks
|
|
2144
|
+
var payDemoPay = usePay$1({
|
|
2145
|
+
onPaymentSuccess: function (response) {
|
|
2146
|
+
onPaymentSuccess(response);
|
|
2147
|
+
},
|
|
2148
|
+
onPaymentError: function (error) {
|
|
2149
|
+
setIsPaying(false);
|
|
2150
|
+
showErrorNotification$1(error);
|
|
2151
|
+
},
|
|
2152
|
+
quote: quote,
|
|
2153
|
+
invoice: invoice,
|
|
2154
|
+
}).pay;
|
|
2155
|
+
var payStripe = usePay({
|
|
2156
|
+
onPaymentSuccess: function (response) {
|
|
2157
|
+
onPaymentSuccess(response);
|
|
2158
|
+
},
|
|
2159
|
+
onPaymentError: function (error) {
|
|
2160
|
+
setIsPaying(false);
|
|
2161
|
+
showErrorNotification$1(error);
|
|
2162
|
+
},
|
|
2163
|
+
quote: quote,
|
|
2164
|
+
invoice: invoice,
|
|
2165
|
+
}).pay;
|
|
2166
|
+
var handlePaymentSubmit = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
1938
2167
|
var _a;
|
|
1939
|
-
|
|
1940
|
-
|
|
2168
|
+
var _b, _c;
|
|
2169
|
+
return __generator(this, function (_d) {
|
|
2170
|
+
switch (_d.label) {
|
|
1941
2171
|
case 0:
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
case 1:
|
|
1950
|
-
submitError = (_b.sent()).error;
|
|
1951
|
-
if (submitError)
|
|
1952
|
-
throw new Error(submitError.message);
|
|
1953
|
-
return [4 /*yield*/, createPaymentIntent({
|
|
1954
|
-
payable: payable,
|
|
1955
|
-
savePaymentMethod: true,
|
|
1956
|
-
plugin: plugin,
|
|
1957
|
-
token: token,
|
|
1958
|
-
apiHost: apiHost || "",
|
|
1959
|
-
accountId: accountId,
|
|
1960
|
-
})];
|
|
1961
|
-
case 2:
|
|
1962
|
-
paymentIntent = _b.sent();
|
|
1963
|
-
clientSecret = paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.client_secret;
|
|
1964
|
-
return [4 /*yield*/, stripe.confirmPayment({
|
|
1965
|
-
elements: elements,
|
|
1966
|
-
clientSecret: clientSecret,
|
|
1967
|
-
redirect: "if_required",
|
|
1968
|
-
confirmParams: {
|
|
1969
|
-
return_url: window.location.href,
|
|
1970
|
-
},
|
|
1971
|
-
})];
|
|
1972
|
-
case 3:
|
|
1973
|
-
response = _b.sent();
|
|
1974
|
-
// See https://stripe.com/docs/payments/save-during-payment?platform=web#web-submit-payment
|
|
1975
|
-
if (response.error)
|
|
1976
|
-
throw new Error(response.error.message);
|
|
1977
|
-
paymentIntentId = (_a = response.paymentIntent) === null || _a === void 0 ? void 0 : _a.id;
|
|
1978
|
-
if (!paymentIntentId)
|
|
1979
|
-
throw new Error("Payment intent couldn't be retrieved");
|
|
1980
|
-
onPaymentSuccess({
|
|
1981
|
-
pluginPaymentResponse: {
|
|
1982
|
-
plugin: plugin,
|
|
1983
|
-
token: paymentIntentId,
|
|
1984
|
-
savePaymentMethod: true,
|
|
1985
|
-
},
|
|
1986
|
-
});
|
|
2172
|
+
if (!plugin)
|
|
2173
|
+
return [2 /*return*/];
|
|
2174
|
+
_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;
|
|
2175
|
+
switch (_a) {
|
|
2176
|
+
case "StripePayment": return [3 /*break*/, 1];
|
|
2177
|
+
case "DemoPayPayment": return [3 /*break*/, 3];
|
|
2178
|
+
}
|
|
1987
2179
|
return [3 /*break*/, 5];
|
|
2180
|
+
case 1: return [4 /*yield*/, payStripe({
|
|
2181
|
+
plugin: plugin,
|
|
2182
|
+
})];
|
|
2183
|
+
case 2:
|
|
2184
|
+
_d.sent();
|
|
2185
|
+
return [3 /*break*/, 6];
|
|
2186
|
+
case 3: return [4 /*yield*/, payDemoPay({
|
|
2187
|
+
plugin: plugin,
|
|
2188
|
+
savePaymentMethod: false,
|
|
2189
|
+
})];
|
|
1988
2190
|
case 4:
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
case
|
|
2191
|
+
_d.sent();
|
|
2192
|
+
return [3 /*break*/, 6];
|
|
2193
|
+
case 5: return [3 /*break*/, 6];
|
|
2194
|
+
case 6: return [2 /*return*/];
|
|
1993
2195
|
}
|
|
1994
2196
|
});
|
|
1995
2197
|
}); };
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2198
|
+
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 () {
|
|
2199
|
+
setIsPaying(true);
|
|
2200
|
+
handlePaymentSubmit();
|
|
2201
|
+
}, size: isMobile ? "large" : "middle", type: "primary" }, { children: "".concat(isPaying ? "Paying" : "Pay", " ").concat(amountDue && currencyId ? formatCurrency(amountDue, currencyId) : "") })) })));
|
|
2202
|
+
};
|
|
2203
|
+
var CheckoutFooter = function (_a) {
|
|
2204
|
+
var _b, _c;
|
|
2205
|
+
var quote = _a.quote, invoice = _a.invoice, onPaymentSuccess = _a.onPaymentSuccess, noPadding = _a.noPadding, plugin = _a.plugin;
|
|
2206
|
+
if (!plugin)
|
|
2207
|
+
return null;
|
|
2208
|
+
var _d = useContext(BunnyContext), token = _d.token, apiHost = _d.apiHost;
|
|
2209
|
+
var accountId = useContext(PaymentContext).accountId;
|
|
2210
|
+
// If plugin is not stripe, pass undefined to prevent errors
|
|
2211
|
+
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"
|
|
2212
|
+
? plugin
|
|
2213
|
+
: undefined;
|
|
2214
|
+
var _e = useStripePlugin(stripePlugin, token, apiHost, accountId), stripe = _e.stripe, options = _e.options;
|
|
2215
|
+
return (jsx(Elements, __assign({ options: options, stripe: stripe }, { children: jsx(ActualCheckoutFooter, { plugin: plugin, invoice: invoice, quote: quote, onPaymentSuccess: onPaymentSuccess, noPadding: noPadding }) })));
|
|
2007
2216
|
};
|
|
2008
2217
|
|
|
2009
|
-
var
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
_c.trys.push([0, 5, , 6]);
|
|
2024
|
-
if (!stripe)
|
|
2025
|
-
throw new Error("Form is not ready");
|
|
2026
|
-
if (!elements)
|
|
2027
|
-
throw new Error("Elements couldn't be retrieved");
|
|
2028
|
-
setIsSaving(true);
|
|
2029
|
-
return [4 /*yield*/, elements.submit()];
|
|
2030
|
-
case 1:
|
|
2031
|
-
submitError = (_c.sent()).error;
|
|
2032
|
-
if (submitError)
|
|
2033
|
-
throw new Error(submitError.message);
|
|
2034
|
-
return [4 /*yield*/, createSetupIntent(plugin, token, apiHost, accountId)];
|
|
2035
|
-
case 2:
|
|
2036
|
-
response = _c.sent();
|
|
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
|
-
});
|
|
2077
|
-
return [3 /*break*/, 6];
|
|
2078
|
-
case 5:
|
|
2079
|
-
error_1 = _c.sent();
|
|
2080
|
-
onFail(error_1);
|
|
2081
|
-
return [3 /*break*/, 6];
|
|
2082
|
-
case 6: return [2 /*return*/];
|
|
2083
|
-
}
|
|
2084
|
-
});
|
|
2085
|
-
}); };
|
|
2086
|
-
return (jsxs("form", { children: [jsx(PaymentElement, { options: { layout: { type: "accordion" } } }), jsx(CheckoutFooter, { isSaving: isSaving, onPaymentSubmit: onSubmit, onlySavePaymentMethod: true })] }));
|
|
2218
|
+
var dayjs_min = {exports: {}};
|
|
2219
|
+
|
|
2220
|
+
(function (module, exports) {
|
|
2221
|
+
!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}));
|
|
2222
|
+
}(dayjs_min));
|
|
2223
|
+
|
|
2224
|
+
var dayjs = dayjs_min.exports;
|
|
2225
|
+
|
|
2226
|
+
var Card = function (_a) {
|
|
2227
|
+
var children = _a.children, className = _a.className, style = _a.style;
|
|
2228
|
+
var darkMode = useContext(BunnyContext).darkMode;
|
|
2229
|
+
return (jsx("div", __assign({ className: "flex flex-col rounded-md shadow-md ".concat(className), style: __assign(__assign({}, style), { backgroundColor: darkMode
|
|
2230
|
+
? "var(--row-background-dark)"
|
|
2231
|
+
: "var(--row-background)" }) }, { children: children })));
|
|
2087
2232
|
};
|
|
2088
2233
|
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
var entityId = _a.entityId, payable = _a.payable, plugin = _a.plugin, isSaving = _a.isSaving, setIsSaving = _a.setIsSaving, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess;
|
|
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)
|
|
2097
|
-
return null;
|
|
2098
|
-
// Ideally this choice should be made way up in the chain,
|
|
2099
|
-
// were we enter into either PaymentMethod Management or Payable Checkout
|
|
2100
|
-
// Probably around Pages/PaymentMethodForm.tsx and Checkout.tsx
|
|
2101
|
-
if (onlySavePaymentMethod) {
|
|
2102
|
-
var options = {
|
|
2103
|
-
mode: "setup",
|
|
2104
|
-
// TODO: Fetch currency from the entity/account
|
|
2105
|
-
currency: "usd",
|
|
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
|
-
}
|
|
2234
|
+
var LargeCardIcon = function () {
|
|
2235
|
+
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" }) })));
|
|
2119
2236
|
};
|
|
2120
2237
|
|
|
2121
|
-
var
|
|
2122
|
-
|
|
2238
|
+
var PlusIcon = function (_a) {
|
|
2239
|
+
var color = _a.color;
|
|
2240
|
+
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" })] })));
|
|
2123
2241
|
};
|
|
2124
2242
|
|
|
2125
|
-
|
|
2126
|
-
var
|
|
2127
|
-
var
|
|
2128
|
-
|
|
2243
|
+
var Text$f = Typography.Text;
|
|
2244
|
+
var CreditCard = function (_a) {
|
|
2245
|
+
var _b;
|
|
2246
|
+
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;
|
|
2247
|
+
var isMobile = useIsMobile();
|
|
2248
|
+
var Wrapper = cardEnabled ? Card : "div";
|
|
2249
|
+
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 }))] }))] }))] })));
|
|
2129
2250
|
};
|
|
2130
|
-
var
|
|
2131
|
-
var
|
|
2132
|
-
var
|
|
2133
|
-
var
|
|
2134
|
-
var
|
|
2135
|
-
|
|
2136
|
-
|
|
2251
|
+
var MiniCreditCard = function (_a) {
|
|
2252
|
+
var _b;
|
|
2253
|
+
var _c = _a.hideRemoveButton, hideRemoveButton = _c === void 0 ? false : _c, onClickRemove = _a.onClickRemove, paymentMethodData = _a.paymentMethodData;
|
|
2254
|
+
var darkMode = useContext(BunnyContext).darkMode;
|
|
2255
|
+
var borderColor = useMemo(function () {
|
|
2256
|
+
return darkMode ? "border-slate-700" : "border-slate-200";
|
|
2257
|
+
}, [darkMode]);
|
|
2258
|
+
var backgroundColor = useMemo(function () {
|
|
2259
|
+
return darkMode ? "var(--row-background-alternate)" : "bg-slate-50";
|
|
2260
|
+
}, [darkMode]);
|
|
2261
|
+
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" })] }))) })));
|
|
2262
|
+
};
|
|
2263
|
+
var CardImage = function (_a) {
|
|
2264
|
+
var _b, _c;
|
|
2265
|
+
var paymentMethodData = _a.paymentMethodData;
|
|
2266
|
+
var apiHost = useContext(BunnyContext).apiHost;
|
|
2267
|
+
var darkMode = useContext(BunnyContext).darkMode;
|
|
2268
|
+
var getCardImage = function (issuer) {
|
|
2269
|
+
if (issuer === "visa")
|
|
2270
|
+
return "Visa_Brandmark_Blue_RGB_2021.png";
|
|
2271
|
+
else if (issuer === "mastercard")
|
|
2272
|
+
return "mc_symbol_opt_73_3x.png";
|
|
2273
|
+
};
|
|
2274
|
+
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: {
|
|
2275
|
+
color: darkMode ? "white" : "",
|
|
2276
|
+
} })) }));
|
|
2137
2277
|
};
|
|
2138
|
-
var
|
|
2139
|
-
var
|
|
2140
|
-
|
|
2141
|
-
if (isNaN(month) || isNaN(year))
|
|
2142
|
-
return false;
|
|
2143
|
-
if (month < 1 || month > 12)
|
|
2144
|
-
return false;
|
|
2145
|
-
return true;
|
|
2278
|
+
var CardAttribute = function (_a) {
|
|
2279
|
+
var title = _a.title, value = _a.value;
|
|
2280
|
+
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 })] })));
|
|
2146
2281
|
};
|
|
2147
|
-
var
|
|
2148
|
-
var
|
|
2149
|
-
var
|
|
2150
|
-
|
|
2151
|
-
return expiryDate < new Date();
|
|
2282
|
+
var CardActions = function (_a) {
|
|
2283
|
+
var onClickRemove = _a.onClickRemove, onClickUpdate = _a.onClickUpdate;
|
|
2284
|
+
var isMobile = useIsMobile();
|
|
2285
|
+
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" }))] })));
|
|
2152
2286
|
};
|
|
2153
|
-
var
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
return
|
|
2287
|
+
var EmptyCard = function (_a) {
|
|
2288
|
+
var onClick = _a.onClick, _b = _a.shadow, shadow = _b === void 0 ? "shadow-md" : _b, _c = _a.cardEnabled, cardEnabled = _c === void 0 ? true : _c;
|
|
2289
|
+
var brandColor = useContext(BrandContext).brandColor;
|
|
2290
|
+
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"] })) }))] })));
|
|
2157
2291
|
};
|
|
2158
|
-
|
|
2159
|
-
var
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2292
|
+
var isExpired = function (paymentMethodData) {
|
|
2293
|
+
var expDate = dayjs(paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.expirationDate);
|
|
2294
|
+
return expDate.isBefore(dayjs());
|
|
2295
|
+
};
|
|
2296
|
+
var expirationDate = function (storedPaymentMethod) {
|
|
2297
|
+
return dayjs(storedPaymentMethod === null || storedPaymentMethod === void 0 ? void 0 : storedPaymentMethod.expirationDate).format("MM/YY");
|
|
2298
|
+
};
|
|
2299
|
+
|
|
2300
|
+
var SavePaymentMethodFooter = function (_a) {
|
|
2301
|
+
var isSaving = _a.isSaving, onSave = _a.onSave, noPadding = _a.noPadding;
|
|
2302
|
+
var isMobile = useIsMobile();
|
|
2303
|
+
var onClickCancel = useContext(PaymentContext).onClickCancel;
|
|
2304
|
+
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
2305
|
};
|
|
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
2306
|
|
|
2191
2307
|
var DemoPayCardCvc = function (_a) {
|
|
2192
2308
|
var autoFocus = _a.autoFocus, onChange = _a.onChange, placeholder = _a.placeholder, value = _a.value;
|
|
@@ -2231,83 +2347,95 @@ var DemoPayExpiry = function (_a) {
|
|
|
2231
2347
|
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
2348
|
};
|
|
2233
2349
|
|
|
2234
|
-
|
|
2350
|
+
function useSave$1(_a) {
|
|
2351
|
+
var _this = this;
|
|
2352
|
+
var onSaveSuccess = _a.onSaveSuccess, token = _a.token, apiHost = _a.apiHost, accountId = _a.accountId;
|
|
2353
|
+
var _b = useState(false), isSaving = _b[0], setIsSaving = _b[1];
|
|
2354
|
+
var save = function (_a) {
|
|
2355
|
+
var cardDetails = _a.cardDetails, plugin = _a.plugin, savePaymentMethod = _a.savePaymentMethod;
|
|
2356
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
2357
|
+
var response, paymentMethodId, error_1;
|
|
2358
|
+
return __generator(this, function (_b) {
|
|
2359
|
+
switch (_b.label) {
|
|
2360
|
+
case 0:
|
|
2361
|
+
_b.trys.push([0, 2, 3, 4]);
|
|
2362
|
+
setIsSaving(true);
|
|
2363
|
+
return [4 /*yield*/, storePayment({
|
|
2364
|
+
testCreditCardNumber: unformatCardNumber(cardDetails.number),
|
|
2365
|
+
testCreditCardCvc: cardDetails.cvc.toString(),
|
|
2366
|
+
testCreditCardExpirationDate: cardDetails.expiry,
|
|
2367
|
+
token: token,
|
|
2368
|
+
}, plugin, apiHost, accountId)];
|
|
2369
|
+
case 1:
|
|
2370
|
+
response = _b.sent();
|
|
2371
|
+
paymentMethodId = response.payload[0].id;
|
|
2372
|
+
if (response.status !== "success")
|
|
2373
|
+
throw new Error(response === null || response === void 0 ? void 0 : response.message);
|
|
2374
|
+
onSaveSuccess({
|
|
2375
|
+
pluginPaymentResponse: {
|
|
2376
|
+
plugin: plugin,
|
|
2377
|
+
token: response.token,
|
|
2378
|
+
savePaymentMethod: savePaymentMethod,
|
|
2379
|
+
},
|
|
2380
|
+
savedPaymentMethodResponse: {
|
|
2381
|
+
paymentMethodId: paymentMethodId,
|
|
2382
|
+
},
|
|
2383
|
+
});
|
|
2384
|
+
return [3 /*break*/, 4];
|
|
2385
|
+
case 2:
|
|
2386
|
+
error_1 = _b.sent();
|
|
2387
|
+
console.error("Payment failed", error_1);
|
|
2388
|
+
return [3 /*break*/, 4];
|
|
2389
|
+
case 3:
|
|
2390
|
+
setIsSaving(false);
|
|
2391
|
+
return [7 /*endfinally*/];
|
|
2392
|
+
case 4: return [2 /*return*/];
|
|
2393
|
+
}
|
|
2394
|
+
});
|
|
2395
|
+
});
|
|
2396
|
+
};
|
|
2397
|
+
return { save: save, isSaving: isSaving };
|
|
2398
|
+
}
|
|
2399
|
+
|
|
2400
|
+
var Text$e = Typography.Text;
|
|
2235
2401
|
var TEST_CARD = "4242424242424242";
|
|
2236
2402
|
var DemoPayForm = function (_a) {
|
|
2237
|
-
var
|
|
2403
|
+
var onFail = _a.onFail, onSavePaymentMethod = _a.onSavePaymentMethod, plugin = _a.plugin;
|
|
2238
2404
|
// Context
|
|
2239
2405
|
var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, darkMode = _b.darkMode;
|
|
2240
2406
|
var accountId = useContext(PaymentContext).accountId;
|
|
2241
|
-
//
|
|
2242
|
-
var _c =
|
|
2407
|
+
// Hooks
|
|
2408
|
+
var _c = useSave$1({
|
|
2409
|
+
onSaveSuccess: onSavePaymentMethod,
|
|
2410
|
+
token: token,
|
|
2411
|
+
apiHost: apiHost,
|
|
2412
|
+
accountId: accountId,
|
|
2413
|
+
}), save = _c.save, isSaving = _c.isSaving;
|
|
2243
2414
|
var _d = useState({
|
|
2244
2415
|
number: "4242424242424242",
|
|
2245
2416
|
expiry: "",
|
|
2246
2417
|
cvc: "",
|
|
2247
2418
|
}), 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;
|
|
2419
|
+
var onSave = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
2420
|
+
var error_1;
|
|
2253
2421
|
return __generator(this, function (_a) {
|
|
2254
2422
|
switch (_a.label) {
|
|
2255
2423
|
case 0:
|
|
2256
|
-
_a.trys.push([0,
|
|
2257
|
-
if (!onlySavePaymentMethod) return [3 /*break*/, 2];
|
|
2258
|
-
validateCardDetails();
|
|
2259
|
-
setIsSaving(true);
|
|
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];
|
|
2424
|
+
_a.trys.push([0, 2, , 3]);
|
|
2284
2425
|
validateCardDetails();
|
|
2285
|
-
|
|
2286
|
-
return [4 /*yield*/, confirmPayment({
|
|
2287
|
-
amount: amountDue,
|
|
2288
|
-
currency: currencyId,
|
|
2426
|
+
return [4 /*yield*/, save({
|
|
2289
2427
|
cardDetails: cardDetails,
|
|
2290
|
-
})];
|
|
2291
|
-
case 3:
|
|
2292
|
-
response = _a.sent();
|
|
2293
|
-
onPaymentSuccess({
|
|
2294
|
-
pluginPaymentResponse: {
|
|
2295
2428
|
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:
|
|
2429
|
+
savePaymentMethod: false,
|
|
2430
|
+
})];
|
|
2431
|
+
case 1:
|
|
2432
|
+
_a.sent();
|
|
2433
|
+
return [3 /*break*/, 3];
|
|
2434
|
+
case 2:
|
|
2307
2435
|
error_1 = _a.sent();
|
|
2308
2436
|
onFail(error_1);
|
|
2309
|
-
return [3 /*break*/,
|
|
2310
|
-
case
|
|
2437
|
+
return [3 /*break*/, 3];
|
|
2438
|
+
case 3: return [2 /*return*/];
|
|
2311
2439
|
}
|
|
2312
2440
|
});
|
|
2313
2441
|
}); };
|
|
@@ -2330,454 +2458,231 @@ var DemoPayForm = function (_a) {
|
|
|
2330
2458
|
var onCardCvcChange = function (cvc) {
|
|
2331
2459
|
setCardDetails(__assign(__assign({}, cardDetails), { cvc: cvc }));
|
|
2332
2460
|
};
|
|
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$
|
|
2461
|
+
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
2462
|
};
|
|
2335
|
-
var StyledInputs = styled.div(templateObject_1$
|
|
2463
|
+
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
2464
|
var darkMode = _a.darkMode;
|
|
2337
2465
|
return darkMode ? "var(--row-background-dark)" : "white";
|
|
2338
2466
|
}, function (_a) {
|
|
2339
2467
|
var darkMode = _a.darkMode;
|
|
2340
2468
|
return darkMode ? GRAY_500 : GRAY_200;
|
|
2341
2469
|
});
|
|
2342
|
-
var templateObject_1$
|
|
2470
|
+
var templateObject_1$7;
|
|
2343
2471
|
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2472
|
+
function useSave(_a) {
|
|
2473
|
+
var _this = this;
|
|
2474
|
+
var onSaveSuccess = _a.onSaveSuccess;
|
|
2475
|
+
// Hooks
|
|
2476
|
+
var _b = useState(false), isSaving = _b[0], setIsSaving = _b[1];
|
|
2477
|
+
var elements = useElements();
|
|
2478
|
+
var stripe = useStripe();
|
|
2479
|
+
var _c = useContext(BunnyContext), token = _c.token, apiHost = _c.apiHost;
|
|
2480
|
+
var accountId = useContext(PaymentContext).accountId;
|
|
2481
|
+
var save = function (_a) {
|
|
2482
|
+
var plugin = _a.plugin;
|
|
2483
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
2484
|
+
var submitError, response, clientSecret, intentResponse, paymentMethodId, paymentMethodResponse, error_1;
|
|
2485
|
+
var _b, _c;
|
|
2486
|
+
return __generator(this, function (_d) {
|
|
2487
|
+
switch (_d.label) {
|
|
2488
|
+
case 0:
|
|
2489
|
+
_d.trys.push([0, 5, 6, 7]);
|
|
2490
|
+
if (!stripe)
|
|
2491
|
+
throw new Error("Form is not ready");
|
|
2492
|
+
if (!elements)
|
|
2493
|
+
throw new Error("Elements couldn't be retrieved");
|
|
2494
|
+
setIsSaving(true);
|
|
2495
|
+
return [4 /*yield*/, elements.submit()];
|
|
2496
|
+
case 1:
|
|
2497
|
+
submitError = (_d.sent()).error;
|
|
2498
|
+
if (submitError)
|
|
2499
|
+
throw new Error(submitError.message);
|
|
2500
|
+
return [4 /*yield*/, createSetupIntent(plugin, token, apiHost, accountId)];
|
|
2501
|
+
case 2:
|
|
2502
|
+
response = _d.sent();
|
|
2503
|
+
if (response.status !== "success")
|
|
2504
|
+
throw new Error(response === null || response === void 0 ? void 0 : response.message);
|
|
2505
|
+
clientSecret = (_b = response === null || response === void 0 ? void 0 : response.payload) === null || _b === void 0 ? void 0 : _b.client_secret;
|
|
2506
|
+
if (!clientSecret)
|
|
2507
|
+
throw new Error("Error retrieving client secret");
|
|
2508
|
+
return [4 /*yield*/, stripe.confirmSetup({
|
|
2509
|
+
elements: elements,
|
|
2510
|
+
clientSecret: clientSecret,
|
|
2511
|
+
redirect: "if_required",
|
|
2512
|
+
confirmParams: {
|
|
2513
|
+
return_url: window.location.href,
|
|
2514
|
+
},
|
|
2515
|
+
})];
|
|
2516
|
+
case 3:
|
|
2517
|
+
intentResponse = _d.sent();
|
|
2518
|
+
// See https://stripe.com/docs/payments/save-during-payment?platform=web#web-submit-payment
|
|
2519
|
+
if (intentResponse.error)
|
|
2520
|
+
throw new Error(intentResponse.error.message);
|
|
2521
|
+
paymentMethodId = (_c = intentResponse.setupIntent.payment_method) === null || _c === void 0 ? void 0 : _c.toString();
|
|
2522
|
+
if (!paymentMethodId)
|
|
2523
|
+
throw new Error("Payment method couldn't be retrieved");
|
|
2524
|
+
return [4 /*yield*/, createPaymentMethod({
|
|
2525
|
+
paymentMethodId: paymentMethodId,
|
|
2526
|
+
plugin: plugin,
|
|
2527
|
+
token: token,
|
|
2528
|
+
apiHost: apiHost,
|
|
2529
|
+
accountId: accountId,
|
|
2530
|
+
})];
|
|
2531
|
+
case 4:
|
|
2532
|
+
paymentMethodResponse = _d.sent();
|
|
2533
|
+
onSaveSuccess({
|
|
2534
|
+
pluginPaymentResponse: {
|
|
2535
|
+
savePaymentMethod: true,
|
|
2536
|
+
plugin: plugin,
|
|
2537
|
+
token: paymentMethodResponse.token,
|
|
2538
|
+
},
|
|
2539
|
+
savedPaymentMethodResponse: {
|
|
2540
|
+
paymentMethodId: paymentMethodResponse.payload[0].id,
|
|
2541
|
+
},
|
|
2542
|
+
});
|
|
2543
|
+
return [3 /*break*/, 7];
|
|
2544
|
+
case 5:
|
|
2545
|
+
error_1 = _d.sent();
|
|
2546
|
+
console.error(error_1);
|
|
2547
|
+
return [3 /*break*/, 7];
|
|
2548
|
+
case 6:
|
|
2549
|
+
setIsSaving(false);
|
|
2550
|
+
return [7 /*endfinally*/];
|
|
2551
|
+
case 7: return [2 /*return*/];
|
|
2552
|
+
}
|
|
2553
|
+
});
|
|
2554
|
+
});
|
|
2555
|
+
};
|
|
2556
|
+
return { save: save, isSaving: isSaving };
|
|
2557
|
+
}
|
|
2360
2558
|
|
|
2361
|
-
var
|
|
2362
|
-
var plugin = _a.plugin,
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
})];
|
|
2559
|
+
var PaymentMethodForm = function (_a) {
|
|
2560
|
+
var plugin = _a.plugin, onFail = _a.onFail, onSavePaymentMethod = _a.onSavePaymentMethod;
|
|
2561
|
+
// Hooks
|
|
2562
|
+
var _b = useSave({
|
|
2563
|
+
onSaveSuccess: onSavePaymentMethod,
|
|
2564
|
+
}), save = _b.save, isSaving = _b.isSaving;
|
|
2565
|
+
// Handlers
|
|
2566
|
+
var onSubmit = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
2567
|
+
var error_1;
|
|
2568
|
+
return __generator(this, function (_a) {
|
|
2569
|
+
switch (_a.label) {
|
|
2570
|
+
case 0:
|
|
2571
|
+
_a.trys.push([0, 2, , 3]);
|
|
2572
|
+
return [4 /*yield*/, save({ plugin: plugin })];
|
|
2376
2573
|
case 1:
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2574
|
+
_a.sent();
|
|
2575
|
+
return [3 /*break*/, 3];
|
|
2576
|
+
case 2:
|
|
2577
|
+
error_1 = _a.sent();
|
|
2578
|
+
onFail(error_1);
|
|
2579
|
+
return [3 /*break*/, 3];
|
|
2580
|
+
case 3: return [2 /*return*/];
|
|
2381
2581
|
}
|
|
2382
2582
|
});
|
|
2383
|
-
});
|
|
2583
|
+
}); };
|
|
2584
|
+
return (jsxs("form", { children: [jsx(PaymentElement, { options: { layout: { type: "accordion" } } }), jsx(SavePaymentMethodFooter, { isSaving: isSaving, onSave: onSubmit })] }));
|
|
2384
2585
|
};
|
|
2385
2586
|
|
|
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
|
|
2587
|
+
// This is just a wrapper to fetch the stripe object and pass it to the form
|
|
2588
|
+
var StripeForm = function (_a) {
|
|
2589
|
+
var plugin = _a.plugin, onFail = _a.onFail, onSavePaymentMethod = _a.onSavePaymentMethod;
|
|
2432
2590
|
var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost;
|
|
2433
2591
|
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)
|
|
2592
|
+
var _c = useStripePlugin(plugin, token, apiHost, accountId), stripe = _c.stripe, options = _c.options;
|
|
2593
|
+
if (!stripe)
|
|
2596
2594
|
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 })] }));
|
|
2595
|
+
return (jsx(Elements, __assign({ options: options, stripe: stripe }, { children: jsx(PaymentMethodForm, { plugin: plugin, onFail: onFail, onSavePaymentMethod: onSavePaymentMethod }) })));
|
|
2686
2596
|
};
|
|
2687
2597
|
|
|
2688
|
-
var
|
|
2598
|
+
var PaymentMethodDetails = function (_a) {
|
|
2689
2599
|
var _b, _c;
|
|
2690
|
-
var
|
|
2600
|
+
var onFail = _a.onFail, paymentMethod = _a.paymentMethod, onSavePaymentMethod = _a.onSavePaymentMethod;
|
|
2691
2601
|
if (!paymentMethod)
|
|
2692
2602
|
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
|
-
}
|
|
2603
|
+
paymentMethod = paymentMethod;
|
|
2604
|
+
switch ((_c = (_b = paymentMethod.components) === null || _b === void 0 ? void 0 : _b.frontend) === null || _c === void 0 ? void 0 : _c[0].name) {
|
|
2605
|
+
case "StripePayment":
|
|
2606
|
+
return (jsx(StripeForm, { onFail: onFail, onSavePaymentMethod: onSavePaymentMethod, plugin: paymentMethod }));
|
|
2607
|
+
case "DemoPayPayment":
|
|
2608
|
+
return (jsx(DemoPayForm, { onFail: onFail, onSavePaymentMethod: onSavePaymentMethod, plugin: paymentMethod }));
|
|
2609
|
+
default:
|
|
2610
|
+
return jsx("p", { children: "Can not find form for plugin" });
|
|
2708
2611
|
}
|
|
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
2612
|
};
|
|
2713
2613
|
|
|
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
|
-
});
|
|
2614
|
+
var CardIcon = function () {
|
|
2615
|
+
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
2616
|
};
|
|
2729
2617
|
|
|
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
|
-
});
|
|
2618
|
+
var Text$d = Typography.Text;
|
|
2619
|
+
var PaymentMethodSelector = function (_a) {
|
|
2620
|
+
var paymentMethodAllowedPlugins = _a.paymentMethodAllowedPlugins, onSelect = _a.onSelect, value = _a.value;
|
|
2621
|
+
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
2622
|
};
|
|
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
|
-
};
|
|
2623
|
+
var PaymentOption = function (_a) {
|
|
2624
|
+
var selected = _a.selected, paymentOption = _a.paymentOption, onClick = _a.onClick, name = _a.name;
|
|
2625
|
+
var brandColor = useContext(BrandContext).brandColor;
|
|
2626
|
+
var darkMode = useContext(BunnyContext).darkMode;
|
|
2627
|
+
var isAch = name === null || name === void 0 ? void 0 : name.toLowerCase().includes("ach");
|
|
2628
|
+
var isCard = name === null || name === void 0 ? void 0 : name.toLowerCase().includes("card");
|
|
2629
|
+
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
|
|
2630
|
+
? "var(--row-background-dark) border-gray-500"
|
|
2631
|
+
: "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
2632
|
};
|
|
2633
|
+
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) {
|
|
2634
|
+
var $brandColor = _a.$brandColor, $selected = _a.$selected;
|
|
2635
|
+
return $selected &&
|
|
2636
|
+
"\n border-color: ".concat($brandColor, ";\n ");
|
|
2637
|
+
}, function (_a) {
|
|
2638
|
+
var $brandColor = _a.$brandColor;
|
|
2639
|
+
return $brandColor;
|
|
2640
|
+
});
|
|
2641
|
+
var templateObject_1$6;
|
|
2756
2642
|
|
|
2757
|
-
|
|
2758
|
-
var
|
|
2759
|
-
var
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2643
|
+
function useRemovePaymentMethod(paymentPlugins, token, apiHost, accountId) {
|
|
2644
|
+
var queryClient = useQueryClient();
|
|
2645
|
+
var showErrorNotification = useErrorNotification();
|
|
2646
|
+
var showSuccessNotification = useSuccessNotification();
|
|
2647
|
+
var removePaymentMethod = useCallback(function (data) {
|
|
2648
|
+
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); });
|
|
2649
|
+
if (data && plugin) {
|
|
2650
|
+
invokePlugin({
|
|
2651
|
+
plugin: plugin,
|
|
2652
|
+
method: "remove_payment_method",
|
|
2653
|
+
payload: {
|
|
2654
|
+
payment_method_id: data.id,
|
|
2655
|
+
account_id: accountId,
|
|
2656
|
+
},
|
|
2657
|
+
token: token,
|
|
2658
|
+
apiHost: apiHost,
|
|
2659
|
+
})
|
|
2660
|
+
.then(function () {
|
|
2661
|
+
showSuccessNotification("Payment method was removed", "Success");
|
|
2662
|
+
queryClient.setQueryData(QueryKeyFactory.default.accountPaymentMethodKey, null);
|
|
2663
|
+
})
|
|
2664
|
+
.catch(function (error) {
|
|
2665
|
+
showErrorNotification(error.message, "Error removing payment method");
|
|
2666
|
+
});
|
|
2667
|
+
}
|
|
2668
|
+
}, [paymentPlugins, token, apiHost, queryClient]);
|
|
2669
|
+
return removePaymentMethod;
|
|
2670
|
+
}
|
|
2671
|
+
|
|
2672
|
+
var Panel = Collapse.Panel;
|
|
2673
|
+
var PaymentForm = function (_a) {
|
|
2674
|
+
var entityId = _a.entityId, invoice = _a.invoice, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, quote = _a.quote, accountId = _a.accountId, onSavePaymentMethod = _a.onSavePaymentMethod;
|
|
2770
2675
|
// Local state
|
|
2771
2676
|
var _b = useState(), selectedPaymentMethod = _b[0], setSelectedPaymentMethod = _b[1];
|
|
2772
|
-
var _c =
|
|
2773
|
-
var
|
|
2774
|
-
//
|
|
2677
|
+
var _c = useState(false), showPaymentMethodForm = _c[0], setShowPaymentMethodForm = _c[1];
|
|
2678
|
+
var paying = !!(quote || invoice);
|
|
2679
|
+
// Hooks
|
|
2680
|
+
var _d = useContext(BunnyContext), token = _d.token, apiHost = _d.apiHost, graphQLClient = _d.graphQLClient;
|
|
2681
|
+
var storedPaymentMethod = usePaymentMethod(graphQLClient, accountId).data;
|
|
2775
2682
|
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);
|
|
2683
|
+
var _e = usePaymentPlugins({ entityId: entityId, apiHost: apiHost, token: token }), paymentMethodAllowedPlugins = _e.paymentMethodAllowedPlugins, arePluginsFetched = _e.isFetched;
|
|
2684
|
+
var onClickRemove = useRemovePaymentMethod(paymentMethodAllowedPlugins || [], token, apiHost, accountId);
|
|
2685
|
+
var queryClient = useQueryClient();
|
|
2781
2686
|
// Set default plugin
|
|
2782
2687
|
useEffect(function () {
|
|
2783
2688
|
if (!arePluginsFetched ||
|
|
@@ -2785,34 +2690,53 @@ var ActualPaymentForm = function (_a) {
|
|
|
2785
2690
|
selectedPaymentMethod) {
|
|
2786
2691
|
return;
|
|
2787
2692
|
}
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2693
|
+
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); });
|
|
2694
|
+
if (pluginPaymentMethod) {
|
|
2695
|
+
setSelectedPaymentMethod(pluginPaymentMethod);
|
|
2696
|
+
}
|
|
2697
|
+
else if (paymentMethodAllowedPlugins === null || paymentMethodAllowedPlugins === void 0 ? void 0 : paymentMethodAllowedPlugins[0]) {
|
|
2698
|
+
setSelectedPaymentMethod(paymentMethodAllowedPlugins === null || paymentMethodAllowedPlugins === void 0 ? void 0 : paymentMethodAllowedPlugins[0]);
|
|
2699
|
+
}
|
|
2792
2700
|
}, [
|
|
2793
2701
|
arePluginsFetched,
|
|
2794
2702
|
isPaymentMethodFetched,
|
|
2795
2703
|
paymentMethodAllowedPlugins,
|
|
2796
2704
|
selectedPaymentMethod,
|
|
2797
2705
|
setSelectedPaymentMethod,
|
|
2798
|
-
showStoredPaymentMethodOption,
|
|
2799
2706
|
storedPaymentMethod,
|
|
2800
2707
|
]);
|
|
2801
2708
|
var showPaymentMethodSelector = useMemo(function () {
|
|
2802
2709
|
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
|
-
|
|
2710
|
+
return pluginCount > 1;
|
|
2711
|
+
}, [paymentMethodAllowedPlugins]);
|
|
2712
|
+
var handlePaymentSuccess = function (_a) {
|
|
2713
|
+
var pluginPaymentResponse = _a.pluginPaymentResponse, savedPaymentMethodResponse = _a.savedPaymentMethodResponse;
|
|
2714
|
+
// Hide payment method selector and form
|
|
2715
|
+
setShowPaymentMethodForm(false);
|
|
2716
|
+
// Set new selected payment method
|
|
2717
|
+
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); });
|
|
2718
|
+
setSelectedPaymentMethod(paymentMethod);
|
|
2719
|
+
// Handle success keeps going up component tree
|
|
2720
|
+
onPaymentSuccess === null || onPaymentSuccess === void 0 ? void 0 : onPaymentSuccess({
|
|
2721
|
+
pluginPaymentResponse: pluginPaymentResponse,
|
|
2722
|
+
savedPaymentMethodResponse: savedPaymentMethodResponse,
|
|
2723
|
+
});
|
|
2724
|
+
};
|
|
2725
|
+
var handleSavePaymentMethod = function () {
|
|
2726
|
+
queryClient.invalidateQueries({
|
|
2727
|
+
queryKey: QueryKeyFactory.default.accountPaymentMethodKey,
|
|
2728
|
+
});
|
|
2729
|
+
onSavePaymentMethod === null || onSavePaymentMethod === void 0 ? void 0 : onSavePaymentMethod();
|
|
2730
|
+
setShowPaymentMethodForm(false);
|
|
2731
|
+
};
|
|
2732
|
+
return (jsx(PaymentContext.Provider, __assign({ value: {
|
|
2733
|
+
onClickCancel: function () { return setShowPaymentMethodForm(false); },
|
|
2734
|
+
accountId: accountId,
|
|
2735
|
+
} }, { 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 })) : (
|
|
2736
|
+
//if not paying and payment method is saved, show Collapse
|
|
2737
|
+
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 () {
|
|
2738
|
+
setShowPaymentMethodForm(true);
|
|
2739
|
+
}, 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
2740
|
};
|
|
2817
2741
|
|
|
2818
2742
|
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 +2774,8 @@ var checkout = function (_a) {
|
|
|
2850
2774
|
});
|
|
2851
2775
|
};
|
|
2852
2776
|
|
|
2853
|
-
var InvoiceCheckoutContext = createContext({});
|
|
2854
2777
|
var InvoiceCheckout = function (_a) {
|
|
2855
|
-
var
|
|
2778
|
+
var onSuccess = _a.onSuccess, onFail = _a.onFail, invoice = _a.invoice, entityId = _a.entityId;
|
|
2856
2779
|
var _b = useContext(BunnyContext), apiHost = _b.apiHost, token = _b.token;
|
|
2857
2780
|
var checkoutMutation = useMutation({
|
|
2858
2781
|
mutationFn: function (_a) {
|
|
@@ -2916,14 +2839,7 @@ var InvoiceCheckout = function (_a) {
|
|
|
2916
2839
|
});
|
|
2917
2840
|
});
|
|
2918
2841
|
};
|
|
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 }) })));
|
|
2842
|
+
return (jsx("div", __assign({ className: "w-full pt-12" }, { children: jsx(PaymentForm, { entityId: entityId, onPaymentSuccess: handleCheckout, onFail: onFail, invoice: invoice }) })));
|
|
2927
2843
|
};
|
|
2928
2844
|
|
|
2929
2845
|
var fetchPDF = function (window, apiEndpoint, invoiceUuid) { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -2969,31 +2885,39 @@ function InvoicePDF(_a) {
|
|
|
2969
2885
|
}, title: "Invoice PDF", width: "100%" }));
|
|
2970
2886
|
}
|
|
2971
2887
|
|
|
2972
|
-
var
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2888
|
+
var InvoiceQuoteContext = createContext({});
|
|
2889
|
+
function Invoice(_a) {
|
|
2890
|
+
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;
|
|
2891
|
+
return (jsx(HelmetProvider, { children: jsx(InvoiceQuoteContext.Provider, __assign({ value: {
|
|
2892
|
+
id: id,
|
|
2893
|
+
invoiceQuoteViewComponent: invoiceQuoteViewComponent,
|
|
2894
|
+
backButtonName: backButtonName,
|
|
2895
|
+
onBackButtonClick: onBackButtonClick,
|
|
2896
|
+
onInvoiceDownloadError: onInvoiceDownloadError,
|
|
2897
|
+
onPaymentSuccess: onPaymentSuccess,
|
|
2898
|
+
entityId: entityId,
|
|
2899
|
+
shadow: shadow,
|
|
2900
|
+
className: className,
|
|
2901
|
+
hideDownloadButton: hideDownloadButton,
|
|
2902
|
+
} }, { children: jsx(ActualInvoice, {}) })) }));
|
|
2903
|
+
}
|
|
2904
|
+
function ActualInvoice() {
|
|
2905
|
+
// Context
|
|
2985
2906
|
var queryClient = useQueryClient();
|
|
2986
|
-
var
|
|
2907
|
+
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;
|
|
2908
|
+
var _b = useContext(BunnyContext), apiHost = _b.apiHost, token = _b.token, onTokenExpired = _b.onTokenExpired;
|
|
2909
|
+
// Local state
|
|
2910
|
+
var isMobile = useIsMobile();
|
|
2911
|
+
// Hooks
|
|
2987
2912
|
var showSuccessNotification = useSuccessNotification();
|
|
2988
|
-
var handleAllErrorFormats = useAllErrorFormats(
|
|
2989
|
-
(function (url) {
|
|
2990
|
-
console.log("navigate to", url, " not implemented");
|
|
2991
|
-
}));
|
|
2913
|
+
var handleAllErrorFormats = useAllErrorFormats(onTokenExpired);
|
|
2992
2914
|
// Queries
|
|
2993
|
-
var
|
|
2915
|
+
var _c = useQuery({
|
|
2994
2916
|
queryKey: QueryKeyFactory.default.createFormattedInvoiceKey(token, id),
|
|
2995
2917
|
queryFn: function () { return getFormattedInvoice({ id: id, token: token, apiHost: apiHost }); },
|
|
2996
|
-
}), formattedInvoice =
|
|
2918
|
+
}), formattedInvoice = _c.data, error = _c.error;
|
|
2919
|
+
// Derived state
|
|
2920
|
+
var isInvoicePayable = PAYABLE_INVOICE_STATES.includes((formattedInvoice === null || formattedInvoice === void 0 ? void 0 : formattedInvoice.state) || "");
|
|
2997
2921
|
if (error) {
|
|
2998
2922
|
return jsxs("div", { children: ["Error loading invoice: ", error.message] });
|
|
2999
2923
|
}
|
|
@@ -3017,19 +2941,12 @@ function ActualInvoice(_a) {
|
|
|
3017
2941
|
var onFail = function (error) {
|
|
3018
2942
|
handleAllErrorFormats(error.message);
|
|
3019
2943
|
};
|
|
3020
|
-
// Derived state
|
|
3021
|
-
var isInvoicePayable = PAYABLE_INVOICE_STATES.includes((formattedInvoice === null || formattedInvoice === void 0 ? void 0 : formattedInvoice.state) || "");
|
|
3022
2944
|
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
2945
|
vendorName: formattedInvoice.vendorName,
|
|
3024
2946
|
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,
|
|
2947
|
+
}) }), 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
2948
|
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 }) }));
|
|
2949
|
+
}, onSuccess: onSuccess, entityId: entityId }))] }))] }));
|
|
3033
2950
|
}
|
|
3034
2951
|
|
|
3035
2952
|
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 +2964,9 @@ var getFormattedQuote = function (_a) {
|
|
|
3047
2964
|
})];
|
|
3048
2965
|
case 1:
|
|
3049
2966
|
response = _b.sent();
|
|
2967
|
+
if (response === null || response === void 0 ? void 0 : response.formattedQuote.error) {
|
|
2968
|
+
throw new Error(response === null || response === void 0 ? void 0 : response.formattedQuote.error);
|
|
2969
|
+
}
|
|
3050
2970
|
return [2 /*return*/, response === null || response === void 0 ? void 0 : response.formattedQuote];
|
|
3051
2971
|
}
|
|
3052
2972
|
});
|
|
@@ -3067,17 +2987,14 @@ var useSigningPlugins = function (_a) {
|
|
|
3067
2987
|
};
|
|
3068
2988
|
|
|
3069
2989
|
var useSendAcceptQuote = function (_a) {
|
|
3070
|
-
var entityId = _a.entityId,
|
|
2990
|
+
var entityId = _a.entityId, onTokenExpired = _a.onTokenExpired, quoteId = _a.quoteId, apiHost = _a.apiHost, token = _a.token;
|
|
3071
2991
|
// Hooks
|
|
3072
2992
|
var graphQLMutation = useGraphQLmutation(function () {
|
|
3073
2993
|
console.log("navigate in useGraphQLmutation in useSendAcceptQuote is not yet implemented");
|
|
3074
2994
|
}, apiHost || "", function () {
|
|
3075
2995
|
console.log("onError in useGraphQLmutation in useSendAcceptQuote is not yet implemented");
|
|
3076
2996
|
});
|
|
3077
|
-
var handleAllErrorFormats = useAllErrorFormats(
|
|
3078
|
-
(function (url) {
|
|
3079
|
-
console.log("navigate to", url, " not implemented");
|
|
3080
|
-
}));
|
|
2997
|
+
var handleAllErrorFormats = useAllErrorFormats(onTokenExpired);
|
|
3081
2998
|
var signingPlugins = useSigningPlugins({ entityId: entityId, apiHost: apiHost, token: token });
|
|
3082
2999
|
var queryClient = useQueryClient();
|
|
3083
3000
|
// Local state
|
|
@@ -3190,27 +3107,19 @@ var useSigningComplete = function (_a) {
|
|
|
3190
3107
|
}, [data, eventParam, queryClient, token]);
|
|
3191
3108
|
};
|
|
3192
3109
|
|
|
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
3110
|
var useIsExpired = function (expiresAt) {
|
|
3202
3111
|
return dayjs(expiresAt).diff(dayjs(dayjs().format("YYYY-MM-DD"))) < 0;
|
|
3203
3112
|
};
|
|
3204
3113
|
|
|
3205
3114
|
var PandadocPollingModal = function (_a) {
|
|
3206
3115
|
var isVisible = _a.isVisible, setVisible = _a.setVisible, id = _a.id;
|
|
3207
|
-
var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost,
|
|
3116
|
+
var _b = useContext(BunnyContext), token = _b.token, apiHost = _b.apiHost, onTokenExpired = _b.onTokenExpired;
|
|
3208
3117
|
var graphQLMutation = useGraphQLmutation(function () {
|
|
3209
3118
|
console.log("graphQLMutation navigateOnTokenExpired not yet implemented");
|
|
3210
3119
|
}, apiHost || "", function () {
|
|
3211
3120
|
console.log("graphQLMutation onError not yet implemented");
|
|
3212
3121
|
});
|
|
3213
|
-
var handleAllErrorFormats = useAllErrorFormats(
|
|
3122
|
+
var handleAllErrorFormats = useAllErrorFormats(onTokenExpired);
|
|
3214
3123
|
var _c = useState(0), numberOfPolls = _c[0], setNumberOfPolls = _c[1];
|
|
3215
3124
|
var _d = useState(""), infoMessage = _d[0], setInfoMessage = _d[1];
|
|
3216
3125
|
useEffect(function () {
|
|
@@ -3290,58 +3199,82 @@ var DOCUMENT_NAME;
|
|
|
3290
3199
|
DOCUMENT_NAME["QUOTE"] = "quote";
|
|
3291
3200
|
})(DOCUMENT_NAME || (DOCUMENT_NAME = {}));
|
|
3292
3201
|
|
|
3202
|
+
var Text$c = Typography.Text;
|
|
3293
3203
|
var documentName = DOCUMENT_NAME.QUOTE;
|
|
3204
|
+
styled.div(templateObject_1$4 || (templateObject_1$4 = __makeTemplateObject(["\n span {\n width: 100%;\n }\n"], ["\n span {\n width: 100%;\n }\n"])));
|
|
3205
|
+
function Quote(_a) {
|
|
3206
|
+
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;
|
|
3207
|
+
return (jsx(HelmetProvider, { children: jsx(InvoiceQuoteContext.Provider, __assign({ value: {
|
|
3208
|
+
id: id,
|
|
3209
|
+
invoiceQuoteViewComponent: invoiceQuoteViewComponent,
|
|
3210
|
+
onInvoiceDownloadError: onInvoiceDownloadError,
|
|
3211
|
+
onPaymentSuccess: onPaymentSuccess,
|
|
3212
|
+
entityId: entityId,
|
|
3213
|
+
shadow: shadow,
|
|
3214
|
+
className: className,
|
|
3215
|
+
hideDownloadButton: hideDownloadButton,
|
|
3216
|
+
} }, { children: jsx(ActualQuote, { entityId: entityId }) })) }));
|
|
3217
|
+
}
|
|
3294
3218
|
function ActualQuote(_a) {
|
|
3219
|
+
var _this = this;
|
|
3295
3220
|
var _b, _c;
|
|
3296
|
-
var
|
|
3297
|
-
|
|
3221
|
+
var entityId = _a.entityId;
|
|
3222
|
+
// Context
|
|
3223
|
+
var _d = useContext(BunnyContext), token = _d.token, apiHost = _d.apiHost, onTokenExpired = _d.onTokenExpired;
|
|
3298
3224
|
var entityBranding = useContext(BrandContext);
|
|
3299
|
-
var
|
|
3225
|
+
var _e = useContext(InvoiceQuoteContext), className = _e.className, id = _e.id, hideDownloadButton = _e.hideDownloadButton;
|
|
3300
3226
|
// Queries
|
|
3301
|
-
var
|
|
3227
|
+
var _f = useQuery({
|
|
3302
3228
|
queryKey: QueryKeyFactory.default.createQuoteKey(token, id),
|
|
3303
|
-
queryFn: function () { return
|
|
3229
|
+
queryFn: function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3230
|
+
var error_1;
|
|
3231
|
+
return __generator(this, function (_a) {
|
|
3232
|
+
switch (_a.label) {
|
|
3233
|
+
case 0:
|
|
3234
|
+
_a.trys.push([0, 2, , 3]);
|
|
3235
|
+
return [4 /*yield*/, getFormattedQuote({ token: token, apiHost: apiHost, id: id })];
|
|
3236
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
3237
|
+
case 2:
|
|
3238
|
+
error_1 = _a.sent();
|
|
3239
|
+
showErrorNotification(error_1.message);
|
|
3240
|
+
return [3 /*break*/, 3];
|
|
3241
|
+
case 3: return [2 /*return*/];
|
|
3242
|
+
}
|
|
3243
|
+
});
|
|
3244
|
+
}); },
|
|
3304
3245
|
placeholderData: keepPreviousData,
|
|
3305
|
-
}), data =
|
|
3246
|
+
}), data = _f.data, isLoading = _f.isLoading;
|
|
3306
3247
|
var formattedQuote = data;
|
|
3307
3248
|
// Hooks
|
|
3308
3249
|
var downloadFile = useDownloadFile(id);
|
|
3309
3250
|
var isExpired = useIsExpired(formattedQuote === null || formattedQuote === void 0 ? void 0 : formattedQuote.expiresAt);
|
|
3310
|
-
var
|
|
3251
|
+
var _g = useSendAcceptQuote({
|
|
3311
3252
|
entityId: entityId,
|
|
3312
3253
|
token: token,
|
|
3313
|
-
|
|
3314
|
-
(function (url) {
|
|
3315
|
-
console.log("navigate to", url, " not implemented");
|
|
3316
|
-
}),
|
|
3254
|
+
onTokenExpired: onTokenExpired,
|
|
3317
3255
|
apiHost: apiHost,
|
|
3318
3256
|
quoteId: id,
|
|
3319
|
-
}), acceptBoxVisible =
|
|
3257
|
+
}), 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
3258
|
useSigningComplete({ data: formattedQuote, token: token });
|
|
3259
|
+
var isMobile = useIsMobile();
|
|
3260
|
+
var showErrorNotification = useErrorNotification();
|
|
3321
3261
|
if (!formattedQuote || isLoading) {
|
|
3322
3262
|
return jsx(Fragment, {});
|
|
3323
3263
|
}
|
|
3264
|
+
// Derived state
|
|
3265
|
+
var isAccepted = formattedQuote.state === "ACCEPTED";
|
|
3324
3266
|
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
3267
|
vendorName: formattedQuote.vendorName,
|
|
3326
3268
|
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 }) }));
|
|
3269
|
+
}) }), 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: {
|
|
3270
|
+
color: entityBranding.secondaryColor,
|
|
3271
|
+
} }, { 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
|
|
3272
|
+
? "flex w-full justify-end gap-2"
|
|
3273
|
+
: "flex items-center justify-end gap-2" }, { children: [!isMobile && !hideDownloadButton ? (jsx(Button, __assign({ icon: jsx(DownloadOutlined$1, {}), onClick: function () {
|
|
3274
|
+
return downloadFile(apiHost + "/api/pdf/quote", token);
|
|
3275
|
+
} }, { 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) {
|
|
3276
|
+
return (jsx(Button, __assign({ download: doc.filename, href: doc.url, type: "link" }, { children: doc.filename }), index));
|
|
3277
|
+
}) }))) : null }))] })), jsx(AcceptQuoteModal, { acceptBoxVisible: acceptBoxVisible, formattedQuote: formattedQuote, setAcceptBoxVisible: setAcceptBoxVisible, setIsAccepting: setIsAccepting, sendAccept: sendAccept }), jsx(PandadocPollingModal, { isVisible: pandadocPollingModalVisible, setVisible: setPandadocPollingModalVisible, id: id })] }));
|
|
3345
3278
|
}
|
|
3346
3279
|
var templateObject_1$4;
|
|
3347
3280
|
|
|
@@ -3396,21 +3329,14 @@ var getTransactions = function (filter, token, apiHost, kindsToShow) { return __
|
|
|
3396
3329
|
});
|
|
3397
3330
|
}); };
|
|
3398
3331
|
|
|
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
|
-
};
|
|
3332
|
+
var TransactionsListContext = createContext({});
|
|
3411
3333
|
|
|
3412
3334
|
var StateTag = function (_a) {
|
|
3413
3335
|
var state = _a.state;
|
|
3336
|
+
var transactionStateRenderer = useContext(TransactionsListContext).transactionStateRenderer;
|
|
3337
|
+
if (transactionStateRenderer) {
|
|
3338
|
+
return jsx(Fragment, { children: transactionStateRenderer(state) });
|
|
3339
|
+
}
|
|
3414
3340
|
return jsx(Tag, __assign({ color: getColor(state) }, { children: capitalize(startCase(state)) }));
|
|
3415
3341
|
};
|
|
3416
3342
|
var getColor = function (state) {
|
|
@@ -3439,12 +3365,10 @@ var getColor = function (state) {
|
|
|
3439
3365
|
}
|
|
3440
3366
|
};
|
|
3441
3367
|
|
|
3442
|
-
var
|
|
3443
|
-
|
|
3444
|
-
var Text$a = Typography.Text;
|
|
3368
|
+
var Text$b = Typography.Text;
|
|
3445
3369
|
var TransactionDate = function (_a) {
|
|
3446
3370
|
var date = _a.date;
|
|
3447
|
-
return jsx(Text$
|
|
3371
|
+
return jsx(Text$b, __assign({ className: "text-sm" }, { children: formatDate(date) }));
|
|
3448
3372
|
};
|
|
3449
3373
|
|
|
3450
3374
|
// TODO: delete
|
|
@@ -3478,10 +3402,10 @@ var TransactionGridCell = styled.div.withConfig({
|
|
|
3478
3402
|
})(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
3403
|
var templateObject_1$3;
|
|
3480
3404
|
|
|
3481
|
-
var Text$
|
|
3405
|
+
var Text$a = Typography.Text;
|
|
3482
3406
|
var TransactionsEmptyState = function () {
|
|
3483
3407
|
var noTransactionsMessage = useContext(TransactionsListContext).noTransactionsMessage;
|
|
3484
|
-
return (jsx(Text$
|
|
3408
|
+
return (jsx(Text$a, __assign({ className: "flex justify-center p-4 text-base" }, { children: noTransactionsMessage || "There are no transactions" })));
|
|
3485
3409
|
};
|
|
3486
3410
|
|
|
3487
3411
|
var isInvoice = function (transaction) {
|
|
@@ -3498,7 +3422,7 @@ var TransactionRowTitle = function (_a) {
|
|
|
3498
3422
|
return (jsx("span", __assign({ className: "text-slate-400", style: { fontSize: "11px" } }, { children: transaction.transactionable.number })));
|
|
3499
3423
|
};
|
|
3500
3424
|
|
|
3501
|
-
var Text$
|
|
3425
|
+
var Text$9 = Typography.Text;
|
|
3502
3426
|
var TransactionsListDesktop = function (_a) {
|
|
3503
3427
|
var transactions = _a.transactions, onTransactionClick = _a.onTransactionClick;
|
|
3504
3428
|
var columns = useContext(TransactionsListContext).columns;
|
|
@@ -3518,11 +3442,11 @@ var TransactionsListDesktop = function (_a) {
|
|
|
3518
3442
|
backgroundColor: index % 2 === 0
|
|
3519
3443
|
? "var(--row-background".concat(darkMode ? "-dark" : "", ")")
|
|
3520
3444
|
: "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$
|
|
3445
|
+
} }, { 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
3446
|
});
|
|
3523
3447
|
};
|
|
3524
3448
|
|
|
3525
|
-
var Text$
|
|
3449
|
+
var Text$8 = Typography.Text;
|
|
3526
3450
|
var TransactionsListMobile = function (_a) {
|
|
3527
3451
|
var transactions = _a.transactions, onTransactionClick = _a.onTransactionClick;
|
|
3528
3452
|
var columns = useContext(TransactionsListContext).columns;
|
|
@@ -3541,20 +3465,23 @@ var TransactionsListMobile = function (_a) {
|
|
|
3541
3465
|
backgroundColor: index % 2 === 0
|
|
3542
3466
|
? "var(--row-background".concat(darkMode ? "-dark" : "", ")")
|
|
3543
3467
|
: "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$
|
|
3468
|
+
} }, { 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
3469
|
});
|
|
3546
3470
|
};
|
|
3547
3471
|
|
|
3472
|
+
var Text$7 = Typography.Text;
|
|
3473
|
+
var DISPLAY_WIDTH = 1200;
|
|
3548
3474
|
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 =
|
|
3475
|
+
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
3476
|
TransactionKind.INVOICE,
|
|
3551
3477
|
TransactionKind.PAYMENT,
|
|
3552
3478
|
TransactionKind.REFUND,
|
|
3553
3479
|
TransactionKind.WRITE_OFF,
|
|
3554
|
-
] :
|
|
3480
|
+
] : _j, style = _a.style, filter = _a.filter, noTransactionsMessage = _a.noTransactionsMessage, entityId = _a.entityId;
|
|
3555
3481
|
var contextValues = {
|
|
3556
3482
|
showSearchBar: showSearchBar,
|
|
3557
3483
|
showTitle: showTitle,
|
|
3484
|
+
title: title,
|
|
3558
3485
|
transactionComponent: transactionComponent,
|
|
3559
3486
|
columns: columns,
|
|
3560
3487
|
className: className,
|
|
@@ -3569,28 +3496,25 @@ function Transactions(_a) {
|
|
|
3569
3496
|
noTransactionsMessage: noTransactionsMessage,
|
|
3570
3497
|
entityId: entityId,
|
|
3571
3498
|
};
|
|
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;
|
|
3499
|
+
var _k = useContext(BunnyContext), token = _k.token, apiHost = _k.apiHost;
|
|
3577
3500
|
// Local state
|
|
3578
|
-
var
|
|
3579
|
-
var
|
|
3501
|
+
var _l = useState(""), search = _l[0], setSearch = _l[1];
|
|
3502
|
+
var filterValue = filter ||
|
|
3580
3503
|
(search ? "filter: \"transaction.transactionableId is ".concat(search, "\"") : "");
|
|
3581
3504
|
// Queries
|
|
3582
3505
|
var data = useQuery({
|
|
3583
3506
|
queryKey: ["transactions", token, filter],
|
|
3584
|
-
queryFn: function () { return getTransactions(
|
|
3507
|
+
queryFn: function () { return getTransactions(filterValue, token, apiHost, kindsToShow); },
|
|
3585
3508
|
placeholderData: keepPreviousData,
|
|
3586
3509
|
}).data;
|
|
3587
|
-
return (jsx(TransactionsDisplay, { transactions: data, onSearchValueChanged: setSearch, search: search }));
|
|
3510
|
+
return (jsx(TransactionsListContext.Provider, __assign({ value: contextValues }, { children: jsx(TransactionsDisplay, { transactions: data, onSearchValueChanged: setSearch, search: search }) })));
|
|
3588
3511
|
}
|
|
3589
3512
|
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;
|
|
3513
|
+
var transactions = _a.transactions, onSearchValueChanged = _a.onSearchValueChanged, search = _a.search;
|
|
3514
|
+
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
3515
|
var columns = useContext(TransactionsListContext).columns;
|
|
3593
3516
|
var darkMode = useContext(BunnyContext).darkMode;
|
|
3517
|
+
var secondaryColor = useContext(BrandContext).secondaryColor;
|
|
3594
3518
|
// Local state
|
|
3595
3519
|
var _c = useState(null), selectedTransaction = _c[0], setSelectedTransaction = _c[1];
|
|
3596
3520
|
var _d = useState(false), drawerOpen = _d[0], setDrawerOpen = _d[1];
|
|
@@ -3640,38 +3564,48 @@ function TransactionsDisplay(_a) {
|
|
|
3640
3564
|
var kind = selectedTransaction.kind.toLowerCase();
|
|
3641
3565
|
return kind.charAt(0).toUpperCase() + kind.slice(1);
|
|
3642
3566
|
};
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
}
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3567
|
+
function handleDisplayClose() {
|
|
3568
|
+
onTransactionDisplayClose === null || onTransactionDisplayClose === void 0 ? void 0 : onTransactionDisplayClose(selectedTransaction);
|
|
3569
|
+
setDrawerOpen(false);
|
|
3570
|
+
}
|
|
3571
|
+
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
|
|
3572
|
+
), showSearchBar && (jsx("div", __assign({ className: "".concat(isMobile ? "w-full" : "") }, { children: jsx(Input, { className: searchBarClassName
|
|
3573
|
+
? searchBarClassName
|
|
3574
|
+
: "border border-slate-200", onChange: function (e) {
|
|
3575
|
+
if (isNaN(Number(e.target.value))) {
|
|
3576
|
+
return;
|
|
3577
|
+
}
|
|
3578
|
+
onSearchValueChanged(e.target.value);
|
|
3579
|
+
}, prefix: jsx(SearchOutlined$1, {}), placeholder: "Search by id #", style: {
|
|
3580
|
+
minWidth: "300px",
|
|
3581
|
+
}, value: search }) })))] }))) : null, jsx("div", __assign({ className: "grid w-full rounded-md overflow-auto ".concat(shadow), style: {
|
|
3582
|
+
gridTemplateColumns: gridTemplateColumns(),
|
|
3583
|
+
backgroundColor: "var(--row-background".concat(darkMode ? "-dark" : "", ")"),
|
|
3584
|
+
} }, { children: isMobile ? (jsx(Fragment, { children: TransactionsListMobile({
|
|
3585
|
+
transactions: transactions,
|
|
3586
|
+
onTransactionClick: handleTransactionClick,
|
|
3587
|
+
}) })) : (jsx(Fragment, { children: TransactionsListDesktop({
|
|
3588
|
+
transactions: transactions,
|
|
3589
|
+
onTransactionClick: handleTransactionClick,
|
|
3590
|
+
}) })) }))] })), 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
3591
|
}
|
|
3663
3592
|
|
|
3664
3593
|
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
|
|
3594
|
+
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
3595
|
var apiHost = useContext(BunnyContext).apiHost;
|
|
3667
|
-
var
|
|
3596
|
+
var _k = useState(null), component = _k[0], setComponent = _k[1];
|
|
3668
3597
|
var contextValues = {
|
|
3669
3598
|
columns: columns,
|
|
3670
3599
|
kindsToShow: [],
|
|
3671
3600
|
onTransactionClick: handleQuoteClick,
|
|
3601
|
+
onTransactionDisplayClose: function () {
|
|
3602
|
+
setComponent(jsx(Fragment, {}));
|
|
3603
|
+
},
|
|
3672
3604
|
transactionComponent: component,
|
|
3605
|
+
transactionStateRenderer: quoteStateRenderer,
|
|
3673
3606
|
showSearchBar: showSearchBar,
|
|
3674
3607
|
showTitle: showTitle,
|
|
3608
|
+
title: title,
|
|
3675
3609
|
className: className,
|
|
3676
3610
|
shadow: shadow,
|
|
3677
3611
|
searchBarClassName: searchBarClassName,
|
|
@@ -3683,7 +3617,29 @@ function Quotes(_a) {
|
|
|
3683
3617
|
downloadTransactionLink: function (id) { return "".concat(apiHost, "/api/pdf/quote/").concat(id); },
|
|
3684
3618
|
entityId: entityId,
|
|
3685
3619
|
};
|
|
3620
|
+
function quoteStateRenderer(state) {
|
|
3621
|
+
// "DRAFT" | "SHARED" | "VIEWED" | "ACCEPTED" | "IN_APPROVAL" | "APPROVED" | "REJECTED";
|
|
3622
|
+
var getColor = function (state) {
|
|
3623
|
+
switch (state) {
|
|
3624
|
+
case "ACCEPTED":
|
|
3625
|
+
return "green";
|
|
3626
|
+
case "IN_APPROVAL":
|
|
3627
|
+
return "orange";
|
|
3628
|
+
case "APPROVED":
|
|
3629
|
+
return "green";
|
|
3630
|
+
case "REJECTED":
|
|
3631
|
+
return "red";
|
|
3632
|
+
case "DRAFT":
|
|
3633
|
+
case "SHARED":
|
|
3634
|
+
case "VIEWED":
|
|
3635
|
+
default:
|
|
3636
|
+
return "blue";
|
|
3637
|
+
}
|
|
3638
|
+
};
|
|
3639
|
+
return jsx(Tag, __assign({ color: getColor(state) }, { children: capitalize(startCase(state)) }));
|
|
3640
|
+
}
|
|
3686
3641
|
function handleQuoteClick(quote) {
|
|
3642
|
+
onQuoteClick === null || onQuoteClick === void 0 ? void 0 : onQuoteClick(quote);
|
|
3687
3643
|
if (quoteComponent) {
|
|
3688
3644
|
setComponent(quoteComponent);
|
|
3689
3645
|
}
|
|
@@ -3707,9 +3663,17 @@ function QuotesWrapper() {
|
|
|
3707
3663
|
}).data;
|
|
3708
3664
|
if (data === undefined)
|
|
3709
3665
|
return null;
|
|
3710
|
-
|
|
3666
|
+
// filter out quotes in draft state, they are not viewable
|
|
3667
|
+
var quotes = data.nodes
|
|
3668
|
+
.filter(function (quote) {
|
|
3669
|
+
return quote.state !== "DRAFT";
|
|
3670
|
+
})
|
|
3671
|
+
.sort(function (a, b) {
|
|
3672
|
+
return new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime();
|
|
3673
|
+
});
|
|
3674
|
+
var quotesAsTransactions = quotes.map(function (quote) { return ({
|
|
3711
3675
|
transactionableId: quote.id,
|
|
3712
|
-
state:
|
|
3676
|
+
state: quote.state,
|
|
3713
3677
|
amount: quote.amount || quote.amountDue,
|
|
3714
3678
|
kind: "QUOTE",
|
|
3715
3679
|
currencyId: quote.currencyId,
|
|
@@ -3718,7 +3682,7 @@ function QuotesWrapper() {
|
|
|
3718
3682
|
},
|
|
3719
3683
|
createdAt: quote.createdAt,
|
|
3720
3684
|
}); });
|
|
3721
|
-
return (jsx(TransactionsDisplay, { transactions: quotesAsTransactions, onSearchValueChanged: setSearch, search: search
|
|
3685
|
+
return (jsx(TransactionsDisplay, { transactions: quotesAsTransactions, onSearchValueChanged: setSearch, search: search }));
|
|
3722
3686
|
}
|
|
3723
3687
|
|
|
3724
3688
|
var DrawerHeader = function (_a) {
|
|
@@ -3726,96 +3690,19 @@ var DrawerHeader = function (_a) {
|
|
|
3726
3690
|
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
3691
|
};
|
|
3728
3692
|
|
|
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;
|
|
3693
|
+
var PaymentMethod = function (_a) {
|
|
3694
|
+
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;
|
|
3695
|
+
var _d = useContext(BunnyContext), token = _d.token, apiHost = _d.apiHost, graphQLClient = _d.graphQLClient, onTokenExpired = _d.onTokenExpired;
|
|
3786
3696
|
// Hooks
|
|
3787
3697
|
var queryClient = useQueryClient();
|
|
3788
3698
|
var paymentPlugins = usePaymentPlugins({ entityId: entityId, apiHost: apiHost, token: token }).paymentPlugins;
|
|
3789
|
-
var showErrorNotification = useErrorNotification();
|
|
3790
3699
|
var showSuccessNotification = useSuccessNotification();
|
|
3791
|
-
var handleAllErrorFormats = useAllErrorFormats(
|
|
3700
|
+
var handleAllErrorFormats = useAllErrorFormats(onTokenExpired);
|
|
3792
3701
|
var isMobile = useIsMobile();
|
|
3793
3702
|
var data = usePaymentMethod(graphQLClient).data;
|
|
3703
|
+
var onClickRemove = useRemovePaymentMethod(paymentPlugins || [], token, apiHost);
|
|
3794
3704
|
// 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
|
-
};
|
|
3705
|
+
var _e = useState(false), showModal = _e[0], setShowModal = _e[1];
|
|
3819
3706
|
var onSuccess = function () {
|
|
3820
3707
|
queryClient.invalidateQueries({
|
|
3821
3708
|
queryKey: QueryKeyFactory.default.accountPaymentMethodKey,
|
|
@@ -3825,25 +3712,18 @@ var ActualPaymentMethod = function (_a) {
|
|
|
3825
3712
|
};
|
|
3826
3713
|
if (data === undefined)
|
|
3827
3714
|
return jsx(Fragment, {});
|
|
3828
|
-
return (jsxs(
|
|
3715
|
+
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
3716
|
body: isMobile
|
|
3830
3717
|
? {
|
|
3831
3718
|
padding: "1rem 0 0",
|
|
3832
3719
|
}
|
|
3833
3720
|
: {},
|
|
3834
|
-
|
|
3835
|
-
}, title: jsx(DrawerHeader, { onClose: function () { return setShowModal(false); }, title: "New payment method" }) }, { children: jsx(PaymentForm, { entityId: entityId, isSaving: isSaving, onFail: function (error) {
|
|
3721
|
+
}, title: jsx(DrawerHeader, { onClose: function () { return setShowModal(false); }, title: "New payment method" }) }, { children: jsx(PaymentForm, { entityId: entityId, onFail: function (error) {
|
|
3836
3722
|
handleAllErrorFormats(error);
|
|
3837
|
-
setIsSaving(false);
|
|
3838
3723
|
}, onPaymentSuccess: function () {
|
|
3839
3724
|
onSuccess();
|
|
3840
|
-
|
|
3841
|
-
}, setIsSaving: setIsSaving }) }))] }));
|
|
3725
|
+
} }) }))] })));
|
|
3842
3726
|
};
|
|
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
3727
|
|
|
3848
3728
|
var pageWrapperClassName = function (isMobile) {
|
|
3849
3729
|
return "flex flex-col grow pt-4 ".concat(isMobile ? "pb-4 overflow-hidden" : "pb-8", " ").concat("content-container");
|
|
@@ -3878,6 +3758,30 @@ var quoteRecalculateTaxes = function (_a) {
|
|
|
3878
3758
|
});
|
|
3879
3759
|
};
|
|
3880
3760
|
|
|
3761
|
+
var MUTATION$6 = "{\n currentUser {\n taxationRequiredAccountFields\n }\n}";
|
|
3762
|
+
var getTaxationRequiredAccountFields = function (_a) {
|
|
3763
|
+
var token = _a.token, apiHost = _a.apiHost;
|
|
3764
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
3765
|
+
var response;
|
|
3766
|
+
var _b, _c;
|
|
3767
|
+
return __generator(this, function (_d) {
|
|
3768
|
+
switch (_d.label) {
|
|
3769
|
+
case 0: return [4 /*yield*/, gqlRequest({
|
|
3770
|
+
query: MUTATION$6,
|
|
3771
|
+
token: token,
|
|
3772
|
+
apiHost: apiHost,
|
|
3773
|
+
})];
|
|
3774
|
+
case 1:
|
|
3775
|
+
response = _d.sent();
|
|
3776
|
+
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
|
|
3777
|
+
? response.currentUser
|
|
3778
|
+
.taxationRequiredAccountFields
|
|
3779
|
+
: null];
|
|
3780
|
+
}
|
|
3781
|
+
});
|
|
3782
|
+
});
|
|
3783
|
+
};
|
|
3784
|
+
|
|
3881
3785
|
var useHasTaxPlugin = function (_a) {
|
|
3882
3786
|
var entityId = _a.entityId, apiHost = _a.apiHost, token = _a.token;
|
|
3883
3787
|
var plugins = usePlugins({
|
|
@@ -3888,7 +3792,7 @@ var useHasTaxPlugin = function (_a) {
|
|
|
3888
3792
|
return Boolean(plugins === null || plugins === void 0 ? void 0 : plugins.some(function (plugin) { return plugin.type === "taxation"; }));
|
|
3889
3793
|
};
|
|
3890
3794
|
|
|
3891
|
-
var MUTATION$
|
|
3795
|
+
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
3796
|
var accountUpdate = function (_a) {
|
|
3893
3797
|
var accountId = _a.accountId, attributes = _a.attributes, token = _a.token, apiHost = _a.apiHost;
|
|
3894
3798
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -3899,7 +3803,7 @@ var accountUpdate = function (_a) {
|
|
|
3899
3803
|
case 0:
|
|
3900
3804
|
vars = { id: accountId, attributes: attributes };
|
|
3901
3805
|
return [4 /*yield*/, gqlRequest({
|
|
3902
|
-
query: MUTATION$
|
|
3806
|
+
query: MUTATION$5,
|
|
3903
3807
|
token: token,
|
|
3904
3808
|
vars: vars,
|
|
3905
3809
|
apiHost: apiHost,
|
|
@@ -3959,11 +3863,16 @@ var FormBillingState = function (_a) {
|
|
|
3959
3863
|
return (jsx(Form.Item, __assign({ label: "Billing state", name: "billingState", rules: [{ required: billingStateRequired }] }, { children: jsx(Input, { placeholder: "State" }) })));
|
|
3960
3864
|
};
|
|
3961
3865
|
|
|
3866
|
+
var getQuoteAmountDue = function (quote) {
|
|
3867
|
+
return quote.amountDue;
|
|
3868
|
+
};
|
|
3869
|
+
|
|
3962
3870
|
var QuoteCheckout = function (_a) {
|
|
3963
|
-
var account = _a.account,
|
|
3871
|
+
var account = _a.account, onSuccess = _a.onSuccess, onFail = _a.onFail, quote = _a.quote, taxationRequiredAccountFields = _a.taxationRequiredAccountFields, entityId = _a.entityId;
|
|
3964
3872
|
// Context
|
|
3965
3873
|
var isMobile = useIsMobile();
|
|
3966
3874
|
var _b = useContext(BunnyContext), apiHost = _b.apiHost, token = _b.token;
|
|
3875
|
+
var _c = useState(false), isSaving = _c[0], setIsSaving = _c[1];
|
|
3967
3876
|
var paymentRequired = getQuoteAmountDue(quote) > 0;
|
|
3968
3877
|
var checkoutMutation = useMutation({
|
|
3969
3878
|
mutationFn: function (_a) {
|
|
@@ -4007,6 +3916,7 @@ var QuoteCheckout = function (_a) {
|
|
|
4007
3916
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
4008
3917
|
var token_1, plugin, savePaymentMethod, metadata, paymentMethodId;
|
|
4009
3918
|
return __generator(this, function (_b) {
|
|
3919
|
+
setIsSaving(true);
|
|
4010
3920
|
if (pluginPaymentResponse) {
|
|
4011
3921
|
token_1 = pluginPaymentResponse.token, plugin = pluginPaymentResponse.plugin, savePaymentMethod = pluginPaymentResponse.savePaymentMethod, metadata = pluginPaymentResponse.metadata;
|
|
4012
3922
|
checkoutMutation.mutate({
|
|
@@ -4029,48 +3939,34 @@ var QuoteCheckout = function (_a) {
|
|
|
4029
3939
|
else {
|
|
4030
3940
|
checkoutMutation.mutate({});
|
|
4031
3941
|
}
|
|
3942
|
+
setIsSaving(false);
|
|
4032
3943
|
return [2 /*return*/];
|
|
4033
3944
|
});
|
|
4034
3945
|
});
|
|
4035
3946
|
};
|
|
4036
3947
|
if (taxationRequiredAccountFields)
|
|
4037
3948
|
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);
|
|
3949
|
+
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
3950
|
handleCheckout({});
|
|
4041
3951
|
}, type: "primary" }, { children: isSaving ? "Processing..." : "Complete order" })), jsx("div", __assign({ className: "text-xs text-slate-500" }, { children: "No payment is required" }))] })) }))) }));
|
|
4042
3952
|
};
|
|
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
|
-
});
|
|
3953
|
+
var PaymentFormWrapper = function (_a) {
|
|
3954
|
+
var children = _a.children, setMaxHeight = _a.setMaxHeight, className = _a.className;
|
|
3955
|
+
var isMobile = useIsMobile();
|
|
3956
|
+
return (jsx("div", __assign({ className: "flex flex-col gap-6 shrink-0 ".concat(isMobile ? "w-full shadow-padding-xb" : "", " ").concat(className), style: __assign({}, (isMobile
|
|
3957
|
+
? setMaxHeight
|
|
3958
|
+
? { maxHeight: "60vh" }
|
|
3959
|
+
: {}
|
|
3960
|
+
: {
|
|
3961
|
+
width: "350px",
|
|
3962
|
+
})) }, { children: children })));
|
|
4066
3963
|
};
|
|
4067
3964
|
|
|
4068
3965
|
var queryKeyFactory = QueryKeyFactory.default;
|
|
4069
3966
|
var Checkout = function (_a) {
|
|
4070
3967
|
var _b, _c;
|
|
4071
3968
|
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];
|
|
3969
|
+
var apiHost = useContext(BunnyContext).apiHost;
|
|
4074
3970
|
var isMobile = useIsMobile();
|
|
4075
3971
|
var hasTaxPlugin = useHasTaxPlugin({
|
|
4076
3972
|
entityId: entityId,
|
|
@@ -4079,20 +3975,20 @@ var Checkout = function (_a) {
|
|
|
4079
3975
|
});
|
|
4080
3976
|
var queryClient = useQueryClient();
|
|
4081
3977
|
// Queries
|
|
4082
|
-
var
|
|
3978
|
+
var _e = useQuery({
|
|
4083
3979
|
queryKey: ["getTaxationRequiredAccountFields", token],
|
|
4084
3980
|
queryFn: function () { return getTaxationRequiredAccountFields({ token: token, apiHost: apiHost }); },
|
|
4085
3981
|
enabled: Boolean(quote),
|
|
4086
3982
|
staleTime: 0,
|
|
4087
|
-
}), taxationRequiredAccountFields =
|
|
4088
|
-
var
|
|
3983
|
+
}), taxationRequiredAccountFields = _e.data, isLoadingTaxationRequiredAccountFields = _e.isLoading;
|
|
3984
|
+
var _f = useQuery({
|
|
4089
3985
|
queryKey: ["account", quote === null || quote === void 0 ? void 0 : quote.accountId],
|
|
4090
3986
|
queryFn: function () {
|
|
4091
3987
|
return (quote === null || quote === void 0 ? void 0 : quote.accountId) && getAccount({ id: quote.accountId, token: token, apiHost: apiHost });
|
|
4092
3988
|
},
|
|
4093
3989
|
enabled: Boolean(quote === null || quote === void 0 ? void 0 : quote.accountId) &&
|
|
4094
3990
|
((taxationRequiredAccountFields === null || taxationRequiredAccountFields === void 0 ? void 0 : taxationRequiredAccountFields.length) || 0) > 0,
|
|
4095
|
-
}), account =
|
|
3991
|
+
}), account = _f.data, isLoadingAccount = _f.isLoading;
|
|
4096
3992
|
useQuery({
|
|
4097
3993
|
queryKey: queryKeyFactory.createQuoteTaxCalculateKey(quote === null || quote === void 0 ? void 0 : quote.id),
|
|
4098
3994
|
queryFn: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -4129,30 +4025,24 @@ var Checkout = function (_a) {
|
|
|
4129
4025
|
return null;
|
|
4130
4026
|
return (jsx("div", __assign({ className: "flex flex-col fixed top-0 left-0 right-0 bottom-0 bg-slate-50 overflow-auto", style: {
|
|
4131
4027
|
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,
|
|
4028
|
+
} }, { 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
4029
|
onFail(error);
|
|
4134
|
-
setIsSaving(false);
|
|
4135
4030
|
}, onSuccess: function (_a) {
|
|
4136
4031
|
var savePaymentMethod = _a.savePaymentMethod;
|
|
4137
4032
|
onSuccess({ savePaymentMethod: savePaymentMethod });
|
|
4138
|
-
|
|
4139
|
-
}, setIsSaving: setIsSaving, entityId: entityId })) : quote ? (jsx(QuoteCheckout, { account: account, entityId: entityId, isSaving: isSaving, onFail: function (error) {
|
|
4033
|
+
}, entityId: entityId })) : quote ? (jsx(QuoteCheckout, { account: account, entityId: entityId, onFail: function (error) {
|
|
4140
4034
|
onFail(error);
|
|
4141
|
-
setIsSaving(false);
|
|
4142
4035
|
}, onSuccess: function (_a) {
|
|
4143
4036
|
var savePaymentMethod = _a.savePaymentMethod;
|
|
4144
4037
|
onSuccess({ savePaymentMethod: savePaymentMethod });
|
|
4145
|
-
|
|
4146
|
-
}, quote: quote, setIsSaving: setIsSaving, taxationRequiredAccountFields: taxationRequiredAccountFields, token: token })) : (jsx(PaymentForm, { entityId: entityId, isSaving: isSaving, onFail: function (error) {
|
|
4038
|
+
}, quote: quote, taxationRequiredAccountFields: taxationRequiredAccountFields, token: token })) : (jsx(PaymentForm, { entityId: entityId, onFail: function (error) {
|
|
4147
4039
|
onFail(error);
|
|
4148
|
-
setIsSaving(false);
|
|
4149
4040
|
}, onPaymentSuccess: function (_a) {
|
|
4150
4041
|
var pluginPaymentResponse = _a.pluginPaymentResponse;
|
|
4151
4042
|
onSuccess({
|
|
4152
4043
|
savePaymentMethod: pluginPaymentResponse === null || pluginPaymentResponse === void 0 ? void 0 : pluginPaymentResponse.savePaymentMethod,
|
|
4153
4044
|
});
|
|
4154
|
-
|
|
4155
|
-
}, setIsSaving: setIsSaving }))] }))] })) })));
|
|
4045
|
+
} }))] }))] })) })));
|
|
4156
4046
|
};
|
|
4157
4047
|
|
|
4158
4048
|
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 +4080,32 @@ var accountSignup = function (_a) {
|
|
|
4190
4080
|
});
|
|
4191
4081
|
};
|
|
4192
4082
|
|
|
4193
|
-
var MUTATION$3 =
|
|
4083
|
+
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";
|
|
4084
|
+
var portalSessionCreate = function (_a) {
|
|
4085
|
+
var tenantCode = _a.tenantCode, expiry = _a.expiry, returnUrl = _a.returnUrl, token = _a.token, apiHost = _a.apiHost;
|
|
4086
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
4087
|
+
var response, errors;
|
|
4088
|
+
var _b;
|
|
4089
|
+
return __generator(this, function (_c) {
|
|
4090
|
+
switch (_c.label) {
|
|
4091
|
+
case 0: return [4 /*yield*/, gqlRequest({
|
|
4092
|
+
query: MUTATION$3,
|
|
4093
|
+
token: token,
|
|
4094
|
+
vars: { tenantCode: tenantCode, expiry: expiry, returnUrl: returnUrl },
|
|
4095
|
+
apiHost: apiHost,
|
|
4096
|
+
})];
|
|
4097
|
+
case 1:
|
|
4098
|
+
response = _c.sent();
|
|
4099
|
+
errors = (response === null || response === void 0 ? void 0 : response.portalSessionCreate).errors;
|
|
4100
|
+
if (errors)
|
|
4101
|
+
throw errors;
|
|
4102
|
+
return [2 /*return*/, (_b = response === null || response === void 0 ? void 0 : response.portalSessionCreate) === null || _b === void 0 ? void 0 : _b.token];
|
|
4103
|
+
}
|
|
4104
|
+
});
|
|
4105
|
+
});
|
|
4106
|
+
};
|
|
4107
|
+
|
|
4108
|
+
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
4109
|
var quoteAccountSignup = function (_a) {
|
|
4195
4110
|
var token = _a.token, apiHost = _a.apiHost, entityId = _a.entityId, priceListCode = _a.priceListCode, accountName = _a.accountName, billingContact = _a.billingContact;
|
|
4196
4111
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -4206,7 +4121,7 @@ var quoteAccountSignup = function (_a) {
|
|
|
4206
4121
|
billingContact: billingContact,
|
|
4207
4122
|
};
|
|
4208
4123
|
return [4 /*yield*/, gqlRequest({
|
|
4209
|
-
query: MUTATION$
|
|
4124
|
+
query: MUTATION$2(),
|
|
4210
4125
|
token: token,
|
|
4211
4126
|
vars: vars,
|
|
4212
4127
|
apiHost: apiHost,
|
|
@@ -4222,7 +4137,7 @@ var quoteAccountSignup = function (_a) {
|
|
|
4222
4137
|
});
|
|
4223
4138
|
};
|
|
4224
4139
|
|
|
4225
|
-
var MUTATION$
|
|
4140
|
+
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
4141
|
var getPriceList = function (_a) {
|
|
4227
4142
|
var token = _a.token, code = _a.code, apiHost = _a.apiHost;
|
|
4228
4143
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -4230,7 +4145,7 @@ var getPriceList = function (_a) {
|
|
|
4230
4145
|
return __generator(this, function (_b) {
|
|
4231
4146
|
switch (_b.label) {
|
|
4232
4147
|
case 0: return [4 /*yield*/, gqlRequest({
|
|
4233
|
-
query: MUTATION$
|
|
4148
|
+
query: MUTATION$1(),
|
|
4234
4149
|
token: token,
|
|
4235
4150
|
vars: { code: code },
|
|
4236
4151
|
apiHost: apiHost,
|
|
@@ -4244,8 +4159,8 @@ var getPriceList = function (_a) {
|
|
|
4244
4159
|
};
|
|
4245
4160
|
|
|
4246
4161
|
function PaymentForms(_a) {
|
|
4247
|
-
var quote = _a.quote,
|
|
4248
|
-
return (jsx(Fragment, { children: quote ? (jsx(Fragment, { children:
|
|
4162
|
+
var quote = _a.quote, handlePaymentSaveSuccess = _a.handlePaymentSaveSuccess, handlePaymentFail = _a.handlePaymentFail, handleSubmit = _a.handleSubmit, proceedingToPayment = _a.proceedingToPayment, entityId = _a.entityId, accountId = _a.accountId;
|
|
4163
|
+
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
4164
|
}
|
|
4250
4165
|
function InitialSignupForm(_a) {
|
|
4251
4166
|
var onSubmit = _a.onSubmit, submitting = _a.submitting;
|
|
@@ -4260,7 +4175,7 @@ function InitialSignupForm(_a) {
|
|
|
4260
4175
|
var _b = e.target, name = _b.name, value = _b.value;
|
|
4261
4176
|
setFormData(__assign(__assign({}, formData), (_a = {}, _a[name] = value, _a)));
|
|
4262
4177
|
};
|
|
4263
|
-
return (jsxs(Form, __assign({ className: "flex
|
|
4178
|
+
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
4179
|
handleInputChange(e);
|
|
4265
4180
|
setFormData(__assign(__assign({}, formData), { firstName: e.target.value }));
|
|
4266
4181
|
} }) })), 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 +4195,40 @@ function InitialSignupForm(_a) {
|
|
|
4280
4195
|
} }) }))] })), jsx(Form.Item, { children: jsx(Button, __assign({ type: "primary", htmlType: "submit", loading: submitting, className: "w-full mt-4" }, { children: "Proceed to payment" })) })] })));
|
|
4281
4196
|
}
|
|
4282
4197
|
|
|
4283
|
-
var Title = Typography.Title, Text$
|
|
4198
|
+
var Title = Typography.Title, Text$6 = Typography.Text;
|
|
4284
4199
|
function PaymentSuccessDisplay(_a) {
|
|
4285
4200
|
var amountPaid = _a.amountPaid, className = _a.className, companyName = _a.companyName, returnUrl = _a.returnUrl, style = _a.style;
|
|
4286
4201
|
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$
|
|
4202
|
+
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
4203
|
}
|
|
4289
4204
|
|
|
4290
|
-
var Text$
|
|
4205
|
+
var Text$5 = Typography.Text;
|
|
4291
4206
|
function PriceListDisplay(_a) {
|
|
4292
4207
|
var priceListData = _a.priceListData, topNavImageUrl = _a.topNavImageUrl;
|
|
4293
4208
|
if (!priceListData)
|
|
4294
4209
|
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$
|
|
4210
|
+
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
4211
|
}
|
|
4297
4212
|
|
|
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
4213
|
var showErrorNotification = useErrorNotification();
|
|
4324
4214
|
function Signup(_a) {
|
|
4325
|
-
var companyName = _a.companyName, entityId = _a.entityId, priceListCode = _a.priceListCode, returnUrl = _a.returnUrl;
|
|
4215
|
+
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
4216
|
// Hooks
|
|
4327
|
-
var
|
|
4217
|
+
var _d = useContext(BunnyContext), apiHost = _d.apiHost, token = _d.token, graphQLClient = _d.graphQLClient;
|
|
4328
4218
|
var isMobile = useIsMobile();
|
|
4329
4219
|
var topNavImageUrl = useContext(BrandContext).topNavImageUrl;
|
|
4330
|
-
var
|
|
4331
|
-
var
|
|
4332
|
-
var
|
|
4333
|
-
var
|
|
4334
|
-
var
|
|
4335
|
-
var
|
|
4336
|
-
var
|
|
4337
|
-
var
|
|
4220
|
+
var _e = useState(undefined), quote = _e[0], setQuote = _e[1];
|
|
4221
|
+
var _f = useState(undefined), accountId = _f[0], setAccountId = _f[1];
|
|
4222
|
+
var _g = useState(undefined), quoteId = _g[0], setQuoteId = _g[1];
|
|
4223
|
+
var _h = useState(undefined), portalSessionToken = _h[0], setPortalSessionToken = _h[1];
|
|
4224
|
+
var _j = useState(undefined), formData = _j[0], setFormData = _j[1];
|
|
4225
|
+
var _k = useState(false), proceedingToPayment = _k[0], setProceedingToPayment = _k[1];
|
|
4226
|
+
var _l = useState(false), purchaseSucceeded = _l[0], setPurchaseSucceeded = _l[1];
|
|
4227
|
+
var _m = useState(undefined), paymentMethodGraphQLClient = _m[0], setPaymentMethodGraphQLClient = _m[1];
|
|
4228
|
+
var paymentMethod = usePaymentMethod(paymentMethodGraphQLClient || graphQLClient, accountId).data;
|
|
4229
|
+
var queryClient = useQueryClient();
|
|
4230
|
+
// console.log("signup paymentMethod", paymentMethod);
|
|
4231
|
+
console.log("signup accountId", accountId);
|
|
4338
4232
|
// Queries
|
|
4339
4233
|
var priceListData = useQuery({
|
|
4340
4234
|
queryKey: ["priceList", priceListCode],
|
|
@@ -4373,6 +4267,12 @@ function Signup(_a) {
|
|
|
4373
4267
|
case 2:
|
|
4374
4268
|
portalSessionToken = _a.sent();
|
|
4375
4269
|
setPortalSessionToken(portalSessionToken);
|
|
4270
|
+
setPaymentMethodGraphQLClient(createGraphQLClient(portalSessionToken, apiHost || ""));
|
|
4271
|
+
// We must invalidate the accountPaymentMethodKey query in order to clear payment methods from the provided api token,
|
|
4272
|
+
// to instead use paymentMethods from portalSessionToken.
|
|
4273
|
+
queryClient.invalidateQueries({
|
|
4274
|
+
queryKey: QueryKeyFactory.default.accountPaymentMethodKey,
|
|
4275
|
+
});
|
|
4376
4276
|
setQuoteId(data.quote.id);
|
|
4377
4277
|
setProceedingToPayment(false);
|
|
4378
4278
|
setQuote({
|
|
@@ -4385,11 +4285,10 @@ function Signup(_a) {
|
|
|
4385
4285
|
});
|
|
4386
4286
|
}
|
|
4387
4287
|
function handlePaymentSaveSuccess(paymentSuccess) {
|
|
4388
|
-
var _a;
|
|
4389
4288
|
return __awaiter(this, void 0, void 0, function () {
|
|
4390
4289
|
var response, plugin;
|
|
4391
|
-
return __generator(this, function (
|
|
4392
|
-
switch (
|
|
4290
|
+
return __generator(this, function (_a) {
|
|
4291
|
+
switch (_a.label) {
|
|
4393
4292
|
case 0:
|
|
4394
4293
|
if (!formData) {
|
|
4395
4294
|
throw new Error("Form data is required");
|
|
@@ -4410,14 +4309,13 @@ function Signup(_a) {
|
|
|
4410
4309
|
apiHost: apiHost,
|
|
4411
4310
|
entityId: entityId,
|
|
4412
4311
|
quoteId: quoteId,
|
|
4413
|
-
paymentMethodId:
|
|
4312
|
+
paymentMethodId: paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.id,
|
|
4414
4313
|
pluginId: plugin.id.toString(),
|
|
4415
4314
|
priceListCode: priceListCode,
|
|
4416
4315
|
accountId: accountId,
|
|
4417
4316
|
})];
|
|
4418
4317
|
case 1:
|
|
4419
|
-
|
|
4420
|
-
setIsPaying(false);
|
|
4318
|
+
_a.sent();
|
|
4421
4319
|
setPurchaseSucceeded(true);
|
|
4422
4320
|
return [2 /*return*/];
|
|
4423
4321
|
}
|
|
@@ -4426,14 +4324,14 @@ function Signup(_a) {
|
|
|
4426
4324
|
}
|
|
4427
4325
|
function handlePaymentFail(error) {
|
|
4428
4326
|
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
4327
|
}
|
|
4328
|
+
var WrapperComponent = function (_a) {
|
|
4329
|
+
var children = _a.children, className = _a.className, style = _a.style;
|
|
4330
|
+
return isCardEnabled ? (jsx(Card, __assign({ className: className, style: style }, { children: children }))) : (jsx("div", __assign({ className: className, style: style }, { children: children })));
|
|
4331
|
+
};
|
|
4332
|
+
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
|
|
4333
|
+
? "items-center justify-center my-12"
|
|
4334
|
+
: "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
4335
|
}
|
|
4438
4336
|
|
|
4439
4337
|
// WARNING: There is a preview button on APP that will need to be changed if this query is changed
|
|
@@ -4567,6 +4465,19 @@ var ErrorView = function (_a) {
|
|
|
4567
4465
|
return (jsxs("div", __assign({ className: "flex flex-col w-full", style: { marginTop: "80px" } }, { children: [jsx("div", __assign({ style: { fontSize: "32px" } }, { children: message })), children] })));
|
|
4568
4466
|
};
|
|
4569
4467
|
|
|
4468
|
+
var Text$4 = Typography.Text;
|
|
4469
|
+
var PageHeaderWithActions = function (_a) {
|
|
4470
|
+
var children = _a.children, title = _a.title, className = _a.className;
|
|
4471
|
+
var isMobile = useIsMobile();
|
|
4472
|
+
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] })));
|
|
4473
|
+
};
|
|
4474
|
+
var PageSubTitle = function (_a) {
|
|
4475
|
+
var title = _a.title;
|
|
4476
|
+
var secondaryColor = useContext(BrandContext).secondaryColor;
|
|
4477
|
+
var darkMode = useContext(BunnyContext).darkMode;
|
|
4478
|
+
return (jsx(Text$4, __assign({ className: "shrink-0 font-medium", style: { color: darkMode ? undefined : secondaryColor } }, { children: title })));
|
|
4479
|
+
};
|
|
4480
|
+
|
|
4570
4481
|
var Text$3 = Typography.Text;
|
|
4571
4482
|
var HideExpiredToggle = function (_a) {
|
|
4572
4483
|
var hideExpired = _a.hideExpired, setHideExpired = _a.setHideExpired, subscriptions = _a.subscriptions;
|
|
@@ -5156,9 +5067,9 @@ var SubscriptionsContext = createContext({});
|
|
|
5156
5067
|
// !!! This component is intended to be view only, however it still has lots of code for full functionality.
|
|
5157
5068
|
// !!! This must be refactored.
|
|
5158
5069
|
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;
|
|
5070
|
+
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
5071
|
// Context
|
|
5161
|
-
var _c = useContext(BunnyContext), token = _c.token, apiHost = _c.apiHost,
|
|
5072
|
+
var _c = useContext(BunnyContext), token = _c.token, apiHost = _c.apiHost, onTokenExpired = _c.onTokenExpired;
|
|
5162
5073
|
// Recoil state
|
|
5163
5074
|
// const [updatingChargeQuantityId, setUpdatingChargeQuantityId] =
|
|
5164
5075
|
// useRecoilState(updatingChargeQuantityIdState);
|
|
@@ -5168,10 +5079,7 @@ var Subscriptions = function (_a) {
|
|
|
5168
5079
|
var _f = useState(true), hideExpired = _f[0], setHideExpired = _f[1];
|
|
5169
5080
|
var _g = useState(false); _g[0]; var setQuantityDrawerOpen = _g[1];
|
|
5170
5081
|
// Hooks
|
|
5171
|
-
var handleAllErrorFormats = useAllErrorFormats(
|
|
5172
|
-
(function (url) {
|
|
5173
|
-
console.log("navigate to", url, " not implemented");
|
|
5174
|
-
}));
|
|
5082
|
+
var handleAllErrorFormats = useAllErrorFormats(onTokenExpired);
|
|
5175
5083
|
var queryClient = useQueryClient();
|
|
5176
5084
|
var showSuccessNotification = useSuccessNotification();
|
|
5177
5085
|
// const quoteDelete = useQuoteDelete();
|
|
@@ -5249,7 +5157,7 @@ var Subscriptions = function (_a) {
|
|
|
5249
5157
|
shadow: shadow,
|
|
5250
5158
|
gap: gap,
|
|
5251
5159
|
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: {
|
|
5160
|
+
} }, { 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
5161
|
flexShrink: 1,
|
|
5254
5162
|
} }, { 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
5163
|
};
|