@bunnyapp/components 1.0.5 → 1.0.7
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 +1153 -1077
- package/dist/cjs/src/components/Quotes/index.d.ts +1 -0
- package/dist/cjs/src/components/index.d.ts +1 -0
- package/dist/esm/index.js +1156 -1081
- package/dist/esm/src/components/Quotes/index.d.ts +1 -0
- package/dist/esm/src/components/index.d.ts +1 -0
- package/dist/index.d.ts +31 -2
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -11,10 +11,10 @@ var common = require('@bunnyapp/common');
|
|
|
11
11
|
var reactQuery = require('@tanstack/react-query');
|
|
12
12
|
var recoil = require('recoil');
|
|
13
13
|
var theme = require('antd/lib/theme');
|
|
14
|
+
var reactHelmetAsync = require('react-helmet-async');
|
|
14
15
|
var reactStripeJs = require('@stripe/react-stripe-js');
|
|
15
16
|
var pure = require('@stripe/stripe-js/pure');
|
|
16
17
|
var lodash = require('lodash');
|
|
17
|
-
var reactHelmetAsync = require('react-helmet-async');
|
|
18
18
|
var request = import('graphql-request');
|
|
19
19
|
var recharts = require('recharts');
|
|
20
20
|
|
|
@@ -117,6 +117,36 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
117
117
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
118
118
|
};
|
|
119
119
|
|
|
120
|
+
function styleInject(css, ref) {
|
|
121
|
+
if ( ref === void 0 ) ref = {};
|
|
122
|
+
var insertAt = ref.insertAt;
|
|
123
|
+
|
|
124
|
+
if (!css || typeof document === 'undefined') { return; }
|
|
125
|
+
|
|
126
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
|
127
|
+
var style = document.createElement('style');
|
|
128
|
+
style.type = 'text/css';
|
|
129
|
+
|
|
130
|
+
if (insertAt === 'top') {
|
|
131
|
+
if (head.firstChild) {
|
|
132
|
+
head.insertBefore(style, head.firstChild);
|
|
133
|
+
} else {
|
|
134
|
+
head.appendChild(style);
|
|
135
|
+
}
|
|
136
|
+
} else {
|
|
137
|
+
head.appendChild(style);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (style.styleSheet) {
|
|
141
|
+
style.styleSheet.cssText = css;
|
|
142
|
+
} else {
|
|
143
|
+
style.appendChild(document.createTextNode(css));
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
var css_248z = ".ant-tag {\n border: none;\n border-radius: 14px;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n font-weight: 500;\n white-space: nowrap;\n margin: 0;\n}\n.ant-tag-blue {\n color: #3b82f6 !important;\n background: #bfdbfe !important;\n}\n.ant-tag-green {\n color: #059669 !important;\n background: #a7f3d0 !important;\n}\n.ant-tag-red {\n color: #ef4444 !important;\n background: #fecaca !important;\n}\n.ant-tag-orange {\n color: #f97316 !important;\n background: #fed7aa !important;\n}\n.ant-tag-yellow {\n color: #f59e0b !important;\n background: #fde68a !important;\n}\n.ant-tag-purple {\n color: #8b5cf6 !important;\n background: #ddd6fe !important;\n}\n.ant-tag-black {\n color: white !important;\n background: black !important;\n}\n.ant-popover {\n z-index: 1050;\n}\n.ant-popover-inner-content {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n max-width: 300px;\n}\n.ant-popover-message-title {\n padding: 0;\n text-align: center;\n font-size: 1rem;\n}\n.ant-popover-buttons {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.ant-btn-primary:disabled {\n background: #eef0f2 !important;\n color: rgba(0, 0, 0, 0.25) !important;\n border: none;\n}\n.ant-btn {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n font-weight: 500;\n box-shadow: none;\n text-shadow: none;\n outline: none !important;\n line-height: 1;\n font-size: 0.875rem;\n font-weight: normal;\n}\n.ant-btn > span {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n.ant-btn-lg {\n height: 44px !important;\n}\n.ant-btn-default:disabled {\n border-color: rgba(113, 125, 148, 0.2) !important;\n}\n.ant-btn-link {\n border: none !important;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n.ant-btn-link > span {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n.ant-btn-link:disabled {\n background-color: transparent !important;\n color: #717d94 !important;\n}\n.ant-btn-link:disabled:hover {\n background-color: transparent !important;\n}\n.ant-input-affix-wrapper .ant-input-prefix {\n transition: color 0.3s;\n}\n.ant-select-selector {\n box-shadow: none !important;\n background-color: transparent !important;\n border: none !important;\n}\n.ant-form-item-label {\n text-transform: none !important;\n font-size: 0.75rem;\n padding-bottom: 2px !important;\n}\n.ant-form-item-label > label {\n width: 100%;\n color: #4b5563 !important;\n}\n.ant-form-item-explain-error {\n font-size: 11px;\n min-height: 11px;\n line-height: 11px;\n padding-top: 2px;\n}\n.ant-form-item {\n margin-bottom: 0;\n}\n.ant-notification {\n width: min-content;\n}\n.ant-notification-topRight {\n right: 0 !important;\n left: 0 !important;\n margin-left: auto !important;\n margin-right: auto !important;\n}\n.ant-notification-notice-wrapper {\n width: 350px !important;\n overflow: hidden !important;\n}\n.ant-notification-notice {\n padding: 16px !important;\n width: 350px !important;\n display: flex !important;\n box-shadow: 0px 6px 10px rgba(0, 0, 0, 0.08), 0px 1px 18px rgba(0, 0, 0, 0.08), 0px 3px 5px rgba(0, 0, 0, 0.16) !important;\n}\n.ant-notification-notice-description {\n padding: 0 14px 0 0 !important;\n color: #232323 !important;\n font-size: 14px !important;\n word-break: break-all !important;\n overflow-wrap: break-word !important;\n}\n.ant-notification-notice-success {\n background-color: #edfffa !important;\n}\n.ant-notification-notice-error {\n background-color: #fff8f4 !important;\n}\n.ant-notification-notice-error .ant-notification-notice-message {\n color: #ff6e1c !important;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji !important;\n font-weight: 500;\n}\n.ant-notification-notice-error .ant-notification-notice-icon {\n color: #ff6e1c;\n}\n.ant-notification-notice-success .ant-notification-notice-message {\n color: #00b76a !important;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji !important;\n font-weight: 500;\n}\n.ant-notification-notice-success .ant-notification-notice-icon {\n color: #00b76a !important;\n}\n.ant-notification-notice-message {\n margin-bottom: 0 !important;\n}\n.ant-notification-notice-close {\n top: 16px !important;\n right: 16px !important;\n}\n.ant-divider {\n margin: 0;\n}\n.ant-menu-submenu-popup > .ant-menu .ant-menu-item {\n display: flex !important;\n align-items: center !important;\n}\n.ant-menu-submenu::after {\n display: none !important;\n}\n.ant-drawer-title {\n font-weight: 400 !important;\n}\n.ant-drawer-header-title {\n flex-direction: row-reverse !important;\n align-items: start !important ;\n}\n.ant-drawer-close {\n margin-inline-end: 0 !important;\n}\n@media (min-width: 768px) {\n .ant-input,\n .ant-picker,\n .ant-select,\n .ant-input-affix-wrapper {\n font-size: 1rem !important;\n }\n .ant-drawer-header {\n padding-right: 1.5rem !important;\n padding-left: 1.5rem !important;\n }\n}\n:root {\n --row-background: #ffffff;\n --row-background-alternate: rgba(100, 116, 139, 0.04);\n --row-background-dark: #121212;\n --row-background-alternate-dark: #1e1e1e;\n}\n.plan-step-line {\n height: 1px;\n min-width: 128px;\n background: #717d94;\n}\n.plan-step-number {\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 9999px;\n border: 1px solid #717d94;\n background: white;\n width: 24px;\n height: 24px;\n color: #717d94;\n}\n.plan-step-number.active {\n border: none;\n color: white;\n background: #ff6e1c;\n}\n.hidden {\n display: none;\n}\n.cardElement {\n padding: 8px 11px;\n border: 1px solid #e5e7eb;\n background-color: white;\n font-family: Inter !important;\n}\n.tooltip {\n visibility: hidden;\n position: absolute !important;\n}\n.has-tooltip:hover .tooltip {\n visibility: visible;\n z-index: 100;\n}\n.show-on-hover {\n opacity: 0;\n}\n.show-on-hover-container:hover .show-on-hover {\n opacity: 1;\n}\n.pdf-only {\n display: none !important;\n}\n.notes p {\n margin: 0;\n padding: 0;\n padding-bottom: 0.25rem;\n}\n#form-element #finix-form-container .field-holder label {\n color: #717d94 !important;\n font-size: 12px !important;\n}\n#form-element #finix-form-container > *:first-child,\n#form-element #finix-form-container > *:last-child {\n margin-top: 0 !important;\n}\n#form-element #finix-form-container > *:not(:first-child):not(:last-child) {\n margin-top: 12px !important;\n}\n#form-element #finix-form-container .field-array > * {\n margin-top: 0 !important;\n}\n#form-element #finix-form-container .field-holder .field,\n#form-element #finix-form-container iframe {\n height: 34px !important;\n}\n#form-element #finix-form-container .field {\n margin-top: 0 !important;\n padding-top: 2px !important;\n}\n#form-element #finix-form-container .field-holder .validation {\n font-size: 11px !important;\n color: #ff4d4f !important;\n}\n.icon-path {\n transition: fill 0.3s;\n}\n.shadow-padding-x {\n padding-right: 1rem;\n padding-left: 1rem;\n}\n.shadow-padding-xb {\n padding-right: 1rem;\n padding-left: 1rem;\n padding-bottom: 0.5rem;\n}\n.content-container {\n width: 100%;\n margin: 0 auto;\n}\n@media (min-width: 1220px) {\n .content-container {\n width: 1220px !important;\n margin: 0 auto;\n }\n}\n@media (min-width: 768px) {\n .shadow-padding-x {\n padding-right: 2rem;\n padding-left: 2rem;\n }\n .shadow-padding-xb {\n padding-right: 2rem;\n padding-left: 2rem;\n padding-bottom: 0.5rem;\n }\n .sm\\:flex {\n display: flex !important;\n }\n .sm\\:hidden {\n display: none !important;\n }\n}\n.relative {\n position: relative;\n}\n.absolute {\n position: absolute;\n}\n.fixed {\n position: fixed;\n}\n.top-0 {\n top: 0;\n}\n.right-0 {\n right: 0;\n}\n.bottom-0 {\n bottom: 0;\n}\n.left-0 {\n left: 0;\n}\n.overflow-hidden {\n overflow: hidden !important;\n}\n.overflow-auto {\n overflow: auto;\n}\n.overflow-visible {\n overflow: visible;\n}\n.z-50 {\n z-index: 50;\n}\n.-top-1\\/10 {\n top: -10%;\n}\n.rounded {\n border-radius: 0.25rem;\n}\n.rounded-md {\n border-radius: 0.375rem;\n}\n.rounded-lg {\n border-radius: 0.5rem;\n}\n.rounded-xl {\n border-radius: 0.75rem;\n}\n.rounded-full {\n border-radius: 9999px;\n}\n.rounded-tr {\n border-top-right-radius: 0.25rem;\n}\n.rounded-br {\n border-bottom-right-radius: 0.25rem;\n}\n.rounded-bl {\n border-bottom-left-radius: 0.25rem;\n}\n.rounded-tl {\n border-top-left-radius: 0.25rem;\n}\n.rounded-t {\n border-top-right-radius: 0.25rem;\n border-top-left-radius: 0.25rem;\n}\n.grid {\n display: grid;\n}\n.contents {\n display: contents;\n}\n.flex {\n display: flex;\n}\n.flex-col {\n flex-direction: column;\n}\n.flex-wrap {\n flex-wrap: wrap;\n}\n.grow {\n flex-grow: 1;\n}\n.shrink {\n flex-shrink: 1;\n}\n.shrink-0 {\n flex-shrink: 0;\n}\n.basis-0 {\n flex-basis: 0;\n}\n.max-w-32 {\n max-width: 8rem;\n}\n.items-center {\n align-items: center;\n}\n.items-end {\n align-items: flex-end;\n}\n.items-start {\n align-items: flex-start;\n}\n.justify-center {\n justify-content: center;\n}\n.justify-between {\n justify-content: space-between;\n}\n.justify-end {\n justify-content: flex-end;\n}\n.justify-start {\n justify-content: flex-start;\n}\n.whitespace-nowrap {\n white-space: nowrap;\n}\n.underline {\n text-decoration: underline;\n}\n.no-underline {\n text-decoration: none;\n}\n.text-nowrap {\n white-space: nowrap;\n}\n.text-white {\n color: white;\n}\n.text-xxs {\n font-size: 0.625rem;\n}\n.text-xs {\n font-size: 0.75rem;\n}\n.text-sm {\n font-size: 0.875rem;\n}\n.text-base {\n font-size: 1rem;\n}\n.text-lg {\n font-size: 1.125rem;\n}\n.text-xl {\n font-size: 1.25rem;\n}\n.text-2xl {\n font-size: 1.5rem;\n}\n.text-3xl {\n font-size: 2rem;\n}\n.text-4xl {\n font-size: 2.5rem;\n}\n.text-5xl {\n font-size: 3rem;\n}\n.text-left {\n text-align: left;\n}\n.text-center {\n text-align: center;\n}\n.text-right {\n text-align: right;\n}\n.text-gray {\n color: #808080 !important;\n}\n.text-gray-400 {\n color: #9ca3af !important;\n}\n.text-gray-500 {\n color: #6b7280 !important;\n}\n.text-blue-gray {\n color: #717d94;\n}\n.text-primary {\n color: #ff6e1c;\n}\n.text-secondary {\n color: #4956dc;\n}\n.capitalize {\n text-transform: capitalize !important;\n}\n.font-normal {\n font-weight: 400;\n}\n.font-medium {\n font-weight: 500;\n}\n.font-bold {\n font-weight: 700;\n}\n.bg-transparent {\n background-color: transparent;\n}\n.bg-white {\n background-color: white;\n}\n.border-collapse {\n border-collapse: collapse;\n}\n.border-t-solid {\n border-top-style: solid;\n}\n.border-b-solid {\n border-bottom-style: solid;\n}\n.border-t-1 {\n border-top-width: 1px;\n}\n.border-b-1 {\n border-bottom-width: 1px;\n}\n.gap-0 {\n gap: 0 !important;\n}\n.gap-0\\.5 {\n gap: 0.125rem;\n}\n.gap-1 {\n gap: 0.25rem;\n}\n.gap-2 {\n gap: 0.5rem;\n}\n.gap-3 {\n gap: 0.75rem;\n}\n.gap-4 {\n gap: 1rem !important;\n}\n.gap-5 {\n gap: 1.25rem;\n}\n.gap-6 {\n gap: 1.5rem !important;\n}\n.gap-8 {\n gap: 2rem !important;\n}\n.gap-12 {\n gap: 3rem !important;\n}\n/* Padding Utilities */\n.p-0 {\n padding: 0;\n}\n.p-1 {\n padding: 0.25rem;\n}\n.p-2 {\n padding: 0.5rem;\n}\n.p-3 {\n padding: 0.75rem;\n}\n.p-4 {\n padding: 1rem;\n}\n.p-5 {\n padding: 1.25rem;\n}\n.p-6 {\n padding: 1.5rem;\n}\n.p-8 {\n padding: 2rem;\n}\n/* Padding X Utilities */\n.px-0 {\n padding-right: 0;\n padding-left: 0;\n}\n.px-1 {\n padding-right: 0.25rem;\n padding-left: 0.25rem;\n}\n.px-2 {\n padding-right: 0.5rem;\n padding-left: 0.5rem;\n}\n.px-3 {\n padding-right: 0.75rem;\n padding-left: 0.75rem;\n}\n.px-4 {\n padding-right: 1rem;\n padding-left: 1rem;\n}\n.px-5 {\n padding-right: 1.25rem;\n padding-left: 1.25rem;\n}\n.px-6 {\n padding-right: 1.5rem;\n padding-left: 1.5rem;\n}\n.px-8 {\n padding-right: 2rem;\n padding-left: 2rem;\n}\n.px-12 {\n padding-right: 3rem;\n padding-left: 3rem;\n}\n/* Padding Y Utilities */\n.py-0 {\n padding-top: 0;\n padding-bottom: 0;\n}\n.py-1 {\n padding-top: 0.25rem;\n padding-bottom: 0.25rem;\n}\n.py-2 {\n padding-top: 0.5rem;\n padding-bottom: 0.5rem;\n}\n.py-3 {\n padding-top: 0.75rem;\n padding-bottom: 0.75rem;\n}\n.py-4 {\n padding-top: 1rem;\n padding-bottom: 1rem;\n}\n.py-6 {\n padding-top: 1.5rem;\n padding-bottom: 1.5rem;\n}\n/* Padding Top Utilities */\n.pt-0 {\n padding-top: 0;\n}\n.pt-1 {\n padding-top: 0.25rem;\n}\n.pt-2 {\n padding-top: 0.5rem;\n}\n.pt-3 {\n padding-top: 0.75rem;\n}\n.pt-4 {\n padding-top: 1rem;\n}\n.pt-5 {\n padding-top: 1.25rem;\n}\n.pt-6 {\n padding-top: 1.5rem;\n}\n.pt-8 {\n padding-top: 2rem;\n}\n/* Padding Right Utilities */\n.pr-0 {\n padding-right: 0;\n}\n.pr-4 {\n padding-right: 1rem;\n}\n.pr-8 {\n padding-right: 2rem;\n}\n/* Padding Bottom Utilities */\n.pb-0 {\n padding-bottom: 0;\n}\n.pb-1 {\n padding-bottom: 0.25rem;\n}\n.pb-2 {\n padding-bottom: 0.5rem;\n}\n.pb-3 {\n padding-bottom: 0.75rem;\n}\n.pb-4 {\n padding-bottom: 1rem;\n}\n.pb-5 {\n padding-bottom: 1.25rem;\n}\n.pb-6 {\n padding-bottom: 1.5rem;\n}\n.pb-8 {\n padding-bottom: 2rem;\n}\n/* Padding Left Utilities */\n.pl-0 {\n padding-left: 0;\n}\n.pl-1 {\n padding-left: 0.25rem;\n}\n.pl-2 {\n padding-left: 0.5rem;\n}\n.pl-4 {\n padding-left: 1rem;\n}\n.pl-8 {\n padding-left: 2rem;\n}\n/* Space Utilities */\n.space-y-2 {\n gap: 0.5rem;\n}\n.space-y-4 {\n gap: 1rem;\n}\n.space-y-8 {\n gap: 2rem;\n}\n/* Margin Utilities */\n.ml-2 {\n margin-left: 0.5rem;\n}\n.ml-6 {\n margin-left: 1.5rem;\n}\n.ml-8 {\n margin-left: 2rem;\n}\n.mb-0 {\n margin-bottom: 0;\n}\n.mb-1 {\n margin-bottom: 0.25rem;\n}\n.mb-2 {\n margin-bottom: 0.5rem;\n}\n.mb-3 {\n margin-bottom: 0.75rem;\n}\n.mb-4 {\n margin-bottom: 1rem;\n}\n.mb-5 {\n margin-bottom: 1.25rem;\n}\n.mb-6 {\n margin-bottom: 1.5rem;\n}\n.mb-8 {\n margin-bottom: 2rem;\n}\n.mr-2 {\n margin-right: 0.5rem;\n}\n.mr-4 {\n margin-right: 1rem;\n}\n.mr-6 {\n margin-right: 1.5rem;\n}\n.mr-8 {\n margin-right: 2rem;\n}\n.mt-0 {\n margin-top: 0;\n}\n.mt-1 {\n margin-top: 0.25rem;\n}\n.mt-2 {\n margin-top: 0.5rem;\n}\n.mt-4 {\n margin-top: 1rem;\n}\n.mt-5 {\n margin-top: 1.25rem;\n}\n.mt-6 {\n margin-top: 1.5rem;\n}\n.mt-8 {\n margin-top: 2rem;\n}\n.my-1 {\n margin-top: 0.25rem;\n margin-bottom: 0.25rem;\n}\n.my-2 {\n margin-top: 0.5rem;\n margin-bottom: 0.5rem;\n}\n.my-4 {\n margin-top: 1rem;\n margin-bottom: 1rem;\n}\n.my-8 {\n margin-top: 2rem;\n margin-bottom: 2rem;\n}\n.my-12 {\n margin-top: 3rem;\n margin-bottom: 3rem;\n}\n.mx-2 {\n margin-left: 0.5rem;\n margin-right: 0.5rem;\n}\n.mx-4 {\n margin-left: 1rem;\n margin-right: 1rem;\n}\n.mx-8 {\n margin-left: 2rem;\n margin-right: 2rem;\n}\n.w-full {\n width: 100%;\n}\n.w-1\\/2 {\n width: 50%;\n}\n.w-1\\/3 {\n width: 33.333333%;\n}\n.w-2\\/3 {\n width: 66.666667%;\n}\n.w-4 {\n width: 1rem;\n}\n.w-14 {\n width: 3.5rem;\n /* 56px */\n}\n.w-20 {\n width: 5rem;\n /* 80px */\n}\n.h-full {\n height: 100%;\n}\n.h-4 {\n height: 1rem;\n}\n.h-5 {\n height: 1.25rem;\n}\n.h-6 {\n height: 1.5rem;\n}\n.h-8 {\n height: 2rem;\n}\n.h-14 {\n height: 3.5rem;\n /* 56px */\n}\n.h-80 {\n height: 20rem;\n}\n.h-96 {\n height: 24rem;\n}\n.cursor-pointer {\n cursor: pointer;\n}\n.cursor-not-allowed {\n cursor: not-allowed;\n}\n.grid-cols-2 {\n grid-template-columns: repeat(2, minmax(0, 1fr));\n}\n.grid-cols-3 {\n grid-template-columns: repeat(3, minmax(0, 1fr));\n}\n.grid-cols-4 {\n grid-template-columns: repeat(4, minMax(0, 1fr));\n}\n.col-span-2 {\n grid-column: span 2 / span 2;\n}\n.col-span-3 {\n grid-column: span 3 / span 3;\n}\n.col-span-4 {\n grid-column: span 4 / span 4;\n}\n.col-span-full {\n grid-column: 1 / -1;\n}\n/* Background colors */\n.bg-black {\n background-color: #000000;\n}\n.bg-slate-50 {\n background-color: #f8fafc;\n}\n.bg-slate-100 {\n background-color: #f1f5f9;\n}\n.bg-slate-200 {\n background-color: #e2e8f0;\n}\n.bg-slate-300 {\n background-color: #cbd5e1;\n}\n.bg-slate-400 {\n background-color: #94a3b8;\n}\n.bg-slate-500 {\n background-color: #64748b;\n}\n.bg-slate-600 {\n background-color: #475569;\n}\n.bg-slate-700 {\n background-color: #334155;\n}\n.bg-slate-800 {\n background-color: #1e293b;\n}\n.bg-slate-900 {\n background-color: #0f172a;\n}\n.bg-slate-950 {\n background-color: #020617;\n}\n.bg-gray-50 {\n background-color: #f9fafb;\n}\n.bg-gray-100 {\n background-color: #f3f4f6;\n}\n.bg-gray-200 {\n background-color: #e5e7eb;\n}\n.bg-gray-300 {\n background-color: #d1d5db;\n}\n.bg-gray-400 {\n background-color: #9ca3af;\n}\n.bg-gray-500 {\n background-color: #6b7280;\n}\n.bg-gray-600 {\n background-color: #4b5563;\n}\n.bg-gray-700 {\n background-color: #374151;\n}\n.bg-gray-800 {\n background-color: #1f2937;\n}\n.bg-gray-900 {\n background-color: #111827;\n}\n.bg-gray-950 {\n background-color: #030712;\n}\n.bg-green-200 {\n background-color: #a7f3d0;\n}\n.bg-green-500 {\n background-color: #10b981;\n}\n.bg-blue-50 {\n background-color: #eff6ff;\n}\n.bg-blue-100 {\n background-color: #dbeafe;\n}\n.bg-blue-200 {\n background-color: #bfdbfe;\n}\n.bg-blue-300 {\n background-color: #93c5fd;\n}\n.bg-blue-400 {\n background-color: #60a5fa;\n}\n.bg-blue-500 {\n background-color: #3b82f6;\n}\n.bg-blue-600 {\n background-color: #2563eb;\n}\n.bg-blue-700 {\n background-color: #1d4ed8;\n}\n.bg-blue-800 {\n background-color: #1e40af;\n}\n.bg-blue-900 {\n background-color: #1e3a8a;\n}\n.bg-blue-950 {\n background-color: #172554;\n}\n.bg-orange-50 {\n background-color: #fff7ed;\n}\n.bg-orange-100 {\n background-color: #ffedd5;\n}\n.bg-orange-200 {\n background-color: #fed7aa;\n}\n.bg-orange-300 {\n background-color: #fdba74;\n}\n.bg-orange-400 {\n background-color: #fb923c;\n}\n.bg-orange-500 {\n background-color: #f97316;\n}\n.bg-orange-600 {\n background-color: #ea580c;\n}\n.bg-orange-700 {\n background-color: #c2410c;\n}\n.bg-orange-800 {\n background-color: #9a3412;\n}\n.bg-orange-900 {\n background-color: #7c2d12;\n}\n.bg-orange-950 {\n background-color: #431407;\n}\n.bg-yellow-200 {\n background-color: #fde68a;\n}\n.bg-red-200 {\n background-color: #fecaca;\n}\n/* Text colors */\n.text-black {\n color: #000000;\n}\n.text-white {\n color: #ffffff;\n}\n.text-slate-50 {\n color: #f8fafc;\n}\n.text-slate-100 {\n color: #f1f5f9;\n}\n.text-slate-200 {\n color: #e2e8f0;\n}\n.text-slate-300 {\n color: #cbd5e1;\n}\n.text-slate-400 {\n color: #94a3b8;\n}\n.text-slate-500 {\n color: #64748b;\n}\n.text-slate-600 {\n color: #475569;\n}\n.text-slate-700 {\n color: #334155;\n}\n.text-slate-800 {\n color: #1e293b;\n}\n.text-slate-900 {\n color: #0f172a;\n}\n.text-slate-950 {\n color: #020617;\n}\n.text-gray-50 {\n color: #f9fafb;\n}\n.text-gray-100 {\n color: #f3f4f6;\n}\n.text-gray-200 {\n color: #e5e7eb;\n}\n.text-gray-300 {\n color: #d1d5db;\n}\n.text-gray-400 {\n color: #9ca3af;\n}\n.text-gray-500 {\n color: #6b7280;\n}\n.text-gray-600 {\n color: #4b5563;\n}\n.text-gray-700 {\n color: #374151;\n}\n.text-gray-800 {\n color: #1f2937;\n}\n.text-gray-900 {\n color: #111827;\n}\n.text-gray-950 {\n color: #030712;\n}\n.text-green-600 {\n color: #059669;\n}\n.text-green-700 {\n color: #047857;\n}\n.text-blue-50 {\n color: #eff6ff;\n}\n.text-blue-100 {\n color: #dbeafe;\n}\n.text-blue-200 {\n color: #bfdbfe;\n}\n.text-blue-300 {\n color: #93c5fd;\n}\n.text-blue-400 {\n color: #60a5fa;\n}\n.text-blue-500 {\n color: #3b82f6;\n}\n.text-blue-600 {\n color: #2563eb;\n}\n.text-blue-700 {\n color: #1d4ed8;\n}\n.text-blue-800 {\n color: #1e40af;\n}\n.text-blue-900 {\n color: #1e3a8a;\n}\n.text-blue-950 {\n color: #172554;\n}\n.text-orange-50 {\n color: #fff7ed;\n}\n.text-orange-100 {\n color: #ffedd5;\n}\n.text-orange-200 {\n color: #fed7aa;\n}\n.text-orange-300 {\n color: #fdba74;\n}\n.text-orange-400 {\n color: #fb923c;\n}\n.text-orange-500 {\n color: #f97316;\n}\n.text-orange-600 {\n color: #ea580c;\n}\n.text-orange-700 {\n color: #c2410c;\n}\n.text-orange-800 {\n color: #9a3412;\n}\n.text-orange-900 {\n color: #7c2d12;\n}\n.text-orange-950 {\n color: #431407;\n}\n.text-yellow-500 {\n color: #f59e0b;\n}\n.text-yellow-700 {\n color: #b45309;\n}\n.text-red-500 {\n color: #ef4444;\n}\n.text-red-700 {\n color: #b91c1c;\n}\n.border {\n border-width: 1px;\n}\n.border-2 {\n border-width: 2px;\n}\n.border-l {\n border-left-width: 1px;\n}\n.border-dashed {\n border-style: dashed;\n}\n.border-solid {\n border-style: solid;\n}\n.border-slate-50 {\n border-color: #f8fafc;\n}\n.border-slate-100 {\n border-color: #f1f5f9;\n}\n.border-slate-200 {\n border-color: #e2e8f0;\n}\n.border-slate-300 {\n border-color: #cbd5e1;\n}\n.border-slate-400 {\n border-color: #94a3b8;\n}\n.border-slate-500 {\n border-color: #64748b;\n}\n.border-slate-600 {\n border-color: #475569;\n}\n.border-slate-700 {\n border-color: #334155;\n}\n.border-slate-800 {\n border-color: #1e293b;\n}\n.border-slate-900 {\n border-color: #0f172a;\n}\n.border-slate-950 {\n border-color: #020617;\n}\n.border-gray-400 {\n border-color: #9ca3af;\n}\n.border-gray-500 {\n border-color: #6b7280;\n}\n.origin-center {\n transform-origin: center;\n}\n.rotate-45 {\n transform: rotate(45deg);\n}\n.translate-x-2\\/4 {\n transform: translateX(50%);\n}\n.-translate-x-2\\/4 {\n transform: translateX(-50%);\n}\n.translate-y-2\\/4 {\n transform: translateY(50%);\n}\n.translate-y-full {\n transform: translateY(100%);\n}\n.-translate-y-full {\n transform: translateY(-100%);\n}\n.shadow-sm {\n box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n}\n.shadow {\n box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);\n}\n.shadow-md {\n box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);\n}\n.shadow-lg {\n box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);\n}\n.shadow-xl {\n box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);\n}\n.shadow-2xl {\n box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);\n}\n.shadow-inner {\n box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.05);\n}\n.shadow-none {\n box-shadow: 0 0 #0000;\n}\n@media (min-width: 768px) {\n .sm\\:flex {\n display: flex !important;\n }\n .sm\\:hidden {\n display: none !important;\n }\n}\n* {\n margin: 0;\n padding: 0;\n box-sizing: border-box !important;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n line-height: 1.15;\n}\nbody {\n color: #232323;\n background-color: #f8fafc;\n}\nth {\n font-weight: normal;\n}\ncode {\n font-family: source-code-pro, Menlo, Monaco, Consolas, \"Courier New\", monospace;\n}\n@media only screen and (max-width: 768px) {\n select,\n textarea,\n input[type=\"text\"],\n input[type=\"password\"],\n input[type=\"datetime\"],\n input[type=\"datetime-local\"],\n input[type=\"date\"],\n input[type=\"month\"],\n input[type=\"time\"],\n input[type=\"week\"],\n input[type=\"number\"],\n input[type=\"email\"],\n input[type=\"url\"],\n input[type=\"search\"],\n input[type=\"tel\"],\n input[type=\"color\"] {\n font-size: 16px !important;\n }\n}\n@keyframes App-logo-spin {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}\n";
|
|
148
|
+
styleInject(css_248z);
|
|
149
|
+
|
|
120
150
|
var IconContext = /*#__PURE__*/React.createContext({});
|
|
121
151
|
var Context = IconContext;
|
|
122
152
|
|
|
@@ -1744,35 +1774,28 @@ var InvoiceQuoteView = function (_a) {
|
|
|
1744
1774
|
};
|
|
1745
1775
|
var templateObject_1$9;
|
|
1746
1776
|
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
} else {
|
|
1770
|
-
style.appendChild(document.createTextNode(css));
|
|
1771
|
-
}
|
|
1772
|
-
}
|
|
1773
|
-
|
|
1774
|
-
var css_248z = ".ant-tag {\n border: none;\n border-radius: 14px;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n font-weight: 500;\n white-space: nowrap;\n margin: 0;\n}\n.ant-tag-blue {\n color: #3b82f6 !important;\n background: #bfdbfe !important;\n}\n.ant-tag-green {\n color: #059669 !important;\n background: #a7f3d0 !important;\n}\n.ant-tag-red {\n color: #ef4444 !important;\n background: #fecaca !important;\n}\n.ant-tag-orange {\n color: #f97316 !important;\n background: #fed7aa !important;\n}\n.ant-tag-yellow {\n color: #f59e0b !important;\n background: #fde68a !important;\n}\n.ant-tag-purple {\n color: #8b5cf6 !important;\n background: #ddd6fe !important;\n}\n.ant-tag-black {\n color: white !important;\n background: black !important;\n}\n.ant-popover {\n z-index: 1050;\n}\n.ant-popover-inner-content {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n max-width: 300px;\n}\n.ant-popover-message-title {\n padding: 0;\n text-align: center;\n font-size: 1rem;\n}\n.ant-popover-buttons {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.ant-btn-primary:disabled {\n background: #eef0f2 !important;\n color: rgba(0, 0, 0, 0.25) !important;\n border: none;\n}\n.ant-btn {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n font-weight: 500;\n box-shadow: none;\n text-shadow: none;\n outline: none !important;\n line-height: 1;\n font-size: 0.875rem;\n font-weight: normal;\n}\n.ant-btn > span {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n.ant-btn-lg {\n height: 44px !important;\n}\n.ant-btn-default:disabled {\n border-color: rgba(113, 125, 148, 0.2) !important;\n}\n.ant-btn-link {\n border: none !important;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n.ant-btn-link > span {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n.ant-btn-link:disabled {\n background-color: transparent !important;\n color: #717d94 !important;\n}\n.ant-btn-link:disabled:hover {\n background-color: transparent !important;\n}\n.ant-input-affix-wrapper .ant-input-prefix {\n transition: color 0.3s;\n}\n.ant-select-selector {\n box-shadow: none !important;\n background-color: transparent !important;\n border: none !important;\n}\n.ant-form-item-label {\n text-transform: none !important;\n font-size: 0.75rem;\n padding-bottom: 2px !important;\n}\n.ant-form-item-label > label {\n width: 100%;\n color: #4b5563 !important;\n}\n.ant-form-item-explain-error {\n font-size: 11px;\n min-height: 11px;\n line-height: 11px;\n padding-top: 2px;\n}\n.ant-form-item {\n margin-bottom: 0;\n}\n.ant-notification {\n width: min-content;\n}\n.ant-notification-topRight {\n right: 0 !important;\n left: 0 !important;\n margin-left: auto !important;\n margin-right: auto !important;\n}\n.ant-notification-notice-wrapper {\n width: 350px !important;\n overflow: hidden !important;\n}\n.ant-notification-notice {\n padding: 16px !important;\n width: 350px !important;\n display: flex !important;\n box-shadow: 0px 6px 10px rgba(0, 0, 0, 0.08), 0px 1px 18px rgba(0, 0, 0, 0.08), 0px 3px 5px rgba(0, 0, 0, 0.16) !important;\n}\n.ant-notification-notice-description {\n padding: 0 14px 0 0 !important;\n color: #232323 !important;\n font-size: 14px !important;\n word-break: break-all !important;\n overflow-wrap: break-word !important;\n}\n.ant-notification-notice-success {\n background-color: #edfffa !important;\n}\n.ant-notification-notice-error {\n background-color: #fff8f4 !important;\n}\n.ant-notification-notice-error .ant-notification-notice-message {\n color: #ff6e1c !important;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji !important;\n font-weight: 500;\n}\n.ant-notification-notice-error .ant-notification-notice-icon {\n color: #ff6e1c;\n}\n.ant-notification-notice-success .ant-notification-notice-message {\n color: #00b76a !important;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji !important;\n font-weight: 500;\n}\n.ant-notification-notice-success .ant-notification-notice-icon {\n color: #00b76a !important;\n}\n.ant-notification-notice-message {\n margin-bottom: 0 !important;\n}\n.ant-notification-notice-close {\n top: 16px !important;\n right: 16px !important;\n}\n.ant-divider {\n margin: 0;\n}\n.ant-menu-submenu-popup > .ant-menu .ant-menu-item {\n display: flex !important;\n align-items: center !important;\n}\n.ant-menu-submenu::after {\n display: none !important;\n}\n.ant-drawer-title {\n font-weight: 400 !important;\n}\n.ant-drawer-header-title {\n flex-direction: row-reverse !important;\n align-items: start !important ;\n}\n.ant-drawer-close {\n margin-inline-end: 0 !important;\n}\n@media (min-width: 768px) {\n .ant-input,\n .ant-picker,\n .ant-select,\n .ant-input-affix-wrapper {\n font-size: 1rem !important;\n }\n .ant-drawer-header {\n padding-right: 1.5rem !important;\n padding-left: 1.5rem !important;\n }\n}\n:root {\n --row-background: #ffffff;\n --row-background-alternate: rgba(100, 116, 139, 0.04);\n --row-background-dark: #121212;\n --row-background-alternate-dark: #1e1e1e;\n}\n.plan-step-line {\n height: 1px;\n min-width: 128px;\n background: #717d94;\n}\n.plan-step-number {\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 9999px;\n border: 1px solid #717d94;\n background: white;\n width: 24px;\n height: 24px;\n color: #717d94;\n}\n.plan-step-number.active {\n border: none;\n color: white;\n background: #ff6e1c;\n}\n.hidden {\n display: none;\n}\n.cardElement {\n padding: 8px 11px;\n border: 1px solid #e5e7eb;\n background-color: white;\n font-family: Inter !important;\n}\n.tooltip {\n visibility: hidden;\n position: absolute !important;\n}\n.has-tooltip:hover .tooltip {\n visibility: visible;\n z-index: 100;\n}\n.show-on-hover {\n opacity: 0;\n}\n.show-on-hover-container:hover .show-on-hover {\n opacity: 1;\n}\n.pdf-only {\n display: none !important;\n}\n.notes p {\n margin: 0;\n padding: 0;\n padding-bottom: 0.25rem;\n}\n#form-element #finix-form-container .field-holder label {\n color: #717d94 !important;\n font-size: 12px !important;\n}\n#form-element #finix-form-container > *:first-child,\n#form-element #finix-form-container > *:last-child {\n margin-top: 0 !important;\n}\n#form-element #finix-form-container > *:not(:first-child):not(:last-child) {\n margin-top: 12px !important;\n}\n#form-element #finix-form-container .field-array > * {\n margin-top: 0 !important;\n}\n#form-element #finix-form-container .field-holder .field,\n#form-element #finix-form-container iframe {\n height: 34px !important;\n}\n#form-element #finix-form-container .field {\n margin-top: 0 !important;\n padding-top: 2px !important;\n}\n#form-element #finix-form-container .field-holder .validation {\n font-size: 11px !important;\n color: #ff4d4f !important;\n}\n.icon-path {\n transition: fill 0.3s;\n}\n.shadow-padding-x {\n padding-right: 1rem;\n padding-left: 1rem;\n}\n.shadow-padding-xb {\n padding-right: 1rem;\n padding-left: 1rem;\n padding-bottom: 0.5rem;\n}\n.content-container {\n width: 100%;\n margin: 0 auto;\n}\n@media (min-width: 1220px) {\n .content-container {\n width: 1220px !important;\n margin: 0 auto;\n }\n}\n@media (min-width: 768px) {\n .shadow-padding-x {\n padding-right: 2rem;\n padding-left: 2rem;\n }\n .shadow-padding-xb {\n padding-right: 2rem;\n padding-left: 2rem;\n padding-bottom: 0.5rem;\n }\n .sm\\:flex {\n display: flex !important;\n }\n .sm\\:hidden {\n display: none !important;\n }\n}\n.relative {\n position: relative;\n}\n.absolute {\n position: absolute;\n}\n.fixed {\n position: fixed;\n}\n.top-0 {\n top: 0;\n}\n.right-0 {\n right: 0;\n}\n.bottom-0 {\n bottom: 0;\n}\n.left-0 {\n left: 0;\n}\n.overflow-hidden {\n overflow: hidden !important;\n}\n.overflow-auto {\n overflow: auto;\n}\n.overflow-visible {\n overflow: visible;\n}\n.z-50 {\n z-index: 50;\n}\n.-top-1\\/10 {\n top: -10%;\n}\n.rounded {\n border-radius: 0.25rem;\n}\n.rounded-md {\n border-radius: 0.375rem;\n}\n.rounded-lg {\n border-radius: 0.5rem;\n}\n.rounded-xl {\n border-radius: 0.75rem;\n}\n.rounded-full {\n border-radius: 9999px;\n}\n.rounded-tr {\n border-top-right-radius: 0.25rem;\n}\n.rounded-br {\n border-bottom-right-radius: 0.25rem;\n}\n.rounded-bl {\n border-bottom-left-radius: 0.25rem;\n}\n.rounded-tl {\n border-top-left-radius: 0.25rem;\n}\n.rounded-t {\n border-top-right-radius: 0.25rem;\n border-top-left-radius: 0.25rem;\n}\n.grid {\n display: grid;\n}\n.contents {\n display: contents;\n}\n.flex {\n display: flex;\n}\n.flex-col {\n flex-direction: column;\n}\n.flex-wrap {\n flex-wrap: wrap;\n}\n.grow {\n flex-grow: 1;\n}\n.shrink {\n flex-shrink: 1;\n}\n.shrink-0 {\n flex-shrink: 0;\n}\n.basis-0 {\n flex-basis: 0;\n}\n.max-w-32 {\n max-width: 8rem;\n}\n.items-center {\n align-items: center;\n}\n.items-end {\n align-items: flex-end;\n}\n.items-start {\n align-items: flex-start;\n}\n.justify-center {\n justify-content: center;\n}\n.justify-between {\n justify-content: space-between;\n}\n.justify-end {\n justify-content: flex-end;\n}\n.justify-start {\n justify-content: flex-start;\n}\n.whitespace-nowrap {\n white-space: nowrap;\n}\n.underline {\n text-decoration: underline;\n}\n.no-underline {\n text-decoration: none;\n}\n.text-nowrap {\n white-space: nowrap;\n}\n.text-white {\n color: white;\n}\n.text-xxs {\n font-size: 0.625rem;\n}\n.text-xs {\n font-size: 0.75rem;\n}\n.text-sm {\n font-size: 0.875rem;\n}\n.text-base {\n font-size: 1rem;\n}\n.text-lg {\n font-size: 1.125rem;\n}\n.text-xl {\n font-size: 1.25rem;\n}\n.text-2xl {\n font-size: 1.5rem;\n}\n.text-3xl {\n font-size: 2rem;\n}\n.text-4xl {\n font-size: 2.5rem;\n}\n.text-5xl {\n font-size: 3rem;\n}\n.text-left {\n text-align: left;\n}\n.text-center {\n text-align: center;\n}\n.text-right {\n text-align: right;\n}\n.text-gray {\n color: #808080 !important;\n}\n.text-gray-400 {\n color: #9ca3af !important;\n}\n.text-gray-500 {\n color: #6b7280 !important;\n}\n.text-blue-gray {\n color: #717d94;\n}\n.text-primary {\n color: #ff6e1c;\n}\n.text-secondary {\n color: #4956dc;\n}\n.capitalize {\n text-transform: capitalize !important;\n}\n.font-normal {\n font-weight: 400;\n}\n.font-medium {\n font-weight: 500;\n}\n.font-bold {\n font-weight: 700;\n}\n.bg-transparent {\n background-color: transparent;\n}\n.bg-white {\n background-color: white;\n}\n.border-collapse {\n border-collapse: collapse;\n}\n.border-t-solid {\n border-top-style: solid;\n}\n.border-b-solid {\n border-bottom-style: solid;\n}\n.border-t-1 {\n border-top-width: 1px;\n}\n.border-b-1 {\n border-bottom-width: 1px;\n}\n.gap-0 {\n gap: 0 !important;\n}\n.gap-0\\.5 {\n gap: 0.125rem;\n}\n.gap-1 {\n gap: 0.25rem;\n}\n.gap-2 {\n gap: 0.5rem;\n}\n.gap-3 {\n gap: 0.75rem;\n}\n.gap-4 {\n gap: 1rem !important;\n}\n.gap-5 {\n gap: 1.25rem;\n}\n.gap-6 {\n gap: 1.5rem !important;\n}\n.gap-8 {\n gap: 2rem !important;\n}\n.gap-12 {\n gap: 3rem !important;\n}\n/* Padding Utilities */\n.p-0 {\n padding: 0;\n}\n.p-1 {\n padding: 0.25rem;\n}\n.p-2 {\n padding: 0.5rem;\n}\n.p-3 {\n padding: 0.75rem;\n}\n.p-4 {\n padding: 1rem;\n}\n.p-5 {\n padding: 1.25rem;\n}\n.p-6 {\n padding: 1.5rem;\n}\n.p-8 {\n padding: 2rem;\n}\n/* Padding X Utilities */\n.px-0 {\n padding-right: 0;\n padding-left: 0;\n}\n.px-1 {\n padding-right: 0.25rem;\n padding-left: 0.25rem;\n}\n.px-2 {\n padding-right: 0.5rem;\n padding-left: 0.5rem;\n}\n.px-3 {\n padding-right: 0.75rem;\n padding-left: 0.75rem;\n}\n.px-4 {\n padding-right: 1rem;\n padding-left: 1rem;\n}\n.px-5 {\n padding-right: 1.25rem;\n padding-left: 1.25rem;\n}\n.px-6 {\n padding-right: 1.5rem;\n padding-left: 1.5rem;\n}\n.px-8 {\n padding-right: 2rem;\n padding-left: 2rem;\n}\n.px-12 {\n padding-right: 3rem;\n padding-left: 3rem;\n}\n/* Padding Y Utilities */\n.py-0 {\n padding-top: 0;\n padding-bottom: 0;\n}\n.py-1 {\n padding-top: 0.25rem;\n padding-bottom: 0.25rem;\n}\n.py-2 {\n padding-top: 0.5rem;\n padding-bottom: 0.5rem;\n}\n.py-3 {\n padding-top: 0.75rem;\n padding-bottom: 0.75rem;\n}\n.py-4 {\n padding-top: 1rem;\n padding-bottom: 1rem;\n}\n.py-6 {\n padding-top: 1.5rem;\n padding-bottom: 1.5rem;\n}\n/* Padding Top Utilities */\n.pt-0 {\n padding-top: 0;\n}\n.pt-1 {\n padding-top: 0.25rem;\n}\n.pt-2 {\n padding-top: 0.5rem;\n}\n.pt-3 {\n padding-top: 0.75rem;\n}\n.pt-4 {\n padding-top: 1rem;\n}\n.pt-5 {\n padding-top: 1.25rem;\n}\n.pt-6 {\n padding-top: 1.5rem;\n}\n.pt-8 {\n padding-top: 2rem;\n}\n/* Padding Right Utilities */\n.pr-0 {\n padding-right: 0;\n}\n.pr-4 {\n padding-right: 1rem;\n}\n.pr-8 {\n padding-right: 2rem;\n}\n/* Padding Bottom Utilities */\n.pb-0 {\n padding-bottom: 0;\n}\n.pb-1 {\n padding-bottom: 0.25rem;\n}\n.pb-2 {\n padding-bottom: 0.5rem;\n}\n.pb-3 {\n padding-bottom: 0.75rem;\n}\n.pb-4 {\n padding-bottom: 1rem;\n}\n.pb-5 {\n padding-bottom: 1.25rem;\n}\n.pb-6 {\n padding-bottom: 1.5rem;\n}\n.pb-8 {\n padding-bottom: 2rem;\n}\n/* Padding Left Utilities */\n.pl-0 {\n padding-left: 0;\n}\n.pl-1 {\n padding-left: 0.25rem;\n}\n.pl-2 {\n padding-left: 0.5rem;\n}\n.pl-4 {\n padding-left: 1rem;\n}\n.pl-8 {\n padding-left: 2rem;\n}\n/* Space Utilities */\n.space-y-2 {\n gap: 0.5rem;\n}\n.space-y-4 {\n gap: 1rem;\n}\n.space-y-8 {\n gap: 2rem;\n}\n/* Margin Utilities */\n.ml-2 {\n margin-left: 0.5rem;\n}\n.ml-6 {\n margin-left: 1.5rem;\n}\n.ml-8 {\n margin-left: 2rem;\n}\n.mb-0 {\n margin-bottom: 0;\n}\n.mb-1 {\n margin-bottom: 0.25rem;\n}\n.mb-2 {\n margin-bottom: 0.5rem;\n}\n.mb-3 {\n margin-bottom: 0.75rem;\n}\n.mb-4 {\n margin-bottom: 1rem;\n}\n.mb-5 {\n margin-bottom: 1.25rem;\n}\n.mb-6 {\n margin-bottom: 1.5rem;\n}\n.mb-8 {\n margin-bottom: 2rem;\n}\n.mr-2 {\n margin-right: 0.5rem;\n}\n.mr-4 {\n margin-right: 1rem;\n}\n.mr-6 {\n margin-right: 1.5rem;\n}\n.mr-8 {\n margin-right: 2rem;\n}\n.mt-0 {\n margin-top: 0;\n}\n.mt-1 {\n margin-top: 0.25rem;\n}\n.mt-2 {\n margin-top: 0.5rem;\n}\n.mt-4 {\n margin-top: 1rem;\n}\n.mt-5 {\n margin-top: 1.25rem;\n}\n.mt-6 {\n margin-top: 1.5rem;\n}\n.mt-8 {\n margin-top: 2rem;\n}\n.my-1 {\n margin-top: 0.25rem;\n margin-bottom: 0.25rem;\n}\n.my-2 {\n margin-top: 0.5rem;\n margin-bottom: 0.5rem;\n}\n.my-4 {\n margin-top: 1rem;\n margin-bottom: 1rem;\n}\n.my-8 {\n margin-top: 2rem;\n margin-bottom: 2rem;\n}\n.my-12 {\n margin-top: 3rem;\n margin-bottom: 3rem;\n}\n.mx-2 {\n margin-left: 0.5rem;\n margin-right: 0.5rem;\n}\n.mx-4 {\n margin-left: 1rem;\n margin-right: 1rem;\n}\n.mx-8 {\n margin-left: 2rem;\n margin-right: 2rem;\n}\n.w-full {\n width: 100%;\n}\n.w-1\\/2 {\n width: 50%;\n}\n.w-1\\/3 {\n width: 33.333333%;\n}\n.w-2\\/3 {\n width: 66.666667%;\n}\n.w-4 {\n width: 1rem;\n}\n.w-14 {\n width: 3.5rem;\n /* 56px */\n}\n.w-20 {\n width: 5rem;\n /* 80px */\n}\n.h-full {\n height: 100%;\n}\n.h-4 {\n height: 1rem;\n}\n.h-5 {\n height: 1.25rem;\n}\n.h-6 {\n height: 1.5rem;\n}\n.h-8 {\n height: 2rem;\n}\n.h-14 {\n height: 3.5rem;\n /* 56px */\n}\n.h-80 {\n height: 20rem;\n}\n.h-96 {\n height: 24rem;\n}\n.cursor-pointer {\n cursor: pointer;\n}\n.cursor-not-allowed {\n cursor: not-allowed;\n}\n.grid-cols-2 {\n grid-template-columns: repeat(2, minmax(0, 1fr));\n}\n.grid-cols-3 {\n grid-template-columns: repeat(3, minmax(0, 1fr));\n}\n.grid-cols-4 {\n grid-template-columns: repeat(4, minMax(0, 1fr));\n}\n.col-span-2 {\n grid-column: span 2 / span 2;\n}\n.col-span-3 {\n grid-column: span 3 / span 3;\n}\n.col-span-4 {\n grid-column: span 4 / span 4;\n}\n.col-span-full {\n grid-column: 1 / -1;\n}\n/* Background colors */\n.bg-black {\n background-color: #000000;\n}\n.bg-slate-50 {\n background-color: #f8fafc;\n}\n.bg-slate-100 {\n background-color: #f1f5f9;\n}\n.bg-slate-200 {\n background-color: #e2e8f0;\n}\n.bg-slate-300 {\n background-color: #cbd5e1;\n}\n.bg-slate-400 {\n background-color: #94a3b8;\n}\n.bg-slate-500 {\n background-color: #64748b;\n}\n.bg-slate-600 {\n background-color: #475569;\n}\n.bg-slate-700 {\n background-color: #334155;\n}\n.bg-slate-800 {\n background-color: #1e293b;\n}\n.bg-slate-900 {\n background-color: #0f172a;\n}\n.bg-slate-950 {\n background-color: #020617;\n}\n.bg-gray-50 {\n background-color: #f9fafb;\n}\n.bg-gray-100 {\n background-color: #f3f4f6;\n}\n.bg-gray-200 {\n background-color: #e5e7eb;\n}\n.bg-gray-300 {\n background-color: #d1d5db;\n}\n.bg-gray-400 {\n background-color: #9ca3af;\n}\n.bg-gray-500 {\n background-color: #6b7280;\n}\n.bg-gray-600 {\n background-color: #4b5563;\n}\n.bg-gray-700 {\n background-color: #374151;\n}\n.bg-gray-800 {\n background-color: #1f2937;\n}\n.bg-gray-900 {\n background-color: #111827;\n}\n.bg-gray-950 {\n background-color: #030712;\n}\n.bg-green-200 {\n background-color: #a7f3d0;\n}\n.bg-green-500 {\n background-color: #10b981;\n}\n.bg-blue-50 {\n background-color: #eff6ff;\n}\n.bg-blue-100 {\n background-color: #dbeafe;\n}\n.bg-blue-200 {\n background-color: #bfdbfe;\n}\n.bg-blue-300 {\n background-color: #93c5fd;\n}\n.bg-blue-400 {\n background-color: #60a5fa;\n}\n.bg-blue-500 {\n background-color: #3b82f6;\n}\n.bg-blue-600 {\n background-color: #2563eb;\n}\n.bg-blue-700 {\n background-color: #1d4ed8;\n}\n.bg-blue-800 {\n background-color: #1e40af;\n}\n.bg-blue-900 {\n background-color: #1e3a8a;\n}\n.bg-blue-950 {\n background-color: #172554;\n}\n.bg-orange-50 {\n background-color: #fff7ed;\n}\n.bg-orange-100 {\n background-color: #ffedd5;\n}\n.bg-orange-200 {\n background-color: #fed7aa;\n}\n.bg-orange-300 {\n background-color: #fdba74;\n}\n.bg-orange-400 {\n background-color: #fb923c;\n}\n.bg-orange-500 {\n background-color: #f97316;\n}\n.bg-orange-600 {\n background-color: #ea580c;\n}\n.bg-orange-700 {\n background-color: #c2410c;\n}\n.bg-orange-800 {\n background-color: #9a3412;\n}\n.bg-orange-900 {\n background-color: #7c2d12;\n}\n.bg-orange-950 {\n background-color: #431407;\n}\n.bg-yellow-200 {\n background-color: #fde68a;\n}\n.bg-red-200 {\n background-color: #fecaca;\n}\n/* Text colors */\n.text-black {\n color: #000000;\n}\n.text-white {\n color: #ffffff;\n}\n.text-slate-50 {\n color: #f8fafc;\n}\n.text-slate-100 {\n color: #f1f5f9;\n}\n.text-slate-200 {\n color: #e2e8f0;\n}\n.text-slate-300 {\n color: #cbd5e1;\n}\n.text-slate-400 {\n color: #94a3b8;\n}\n.text-slate-500 {\n color: #64748b;\n}\n.text-slate-600 {\n color: #475569;\n}\n.text-slate-700 {\n color: #334155;\n}\n.text-slate-800 {\n color: #1e293b;\n}\n.text-slate-900 {\n color: #0f172a;\n}\n.text-slate-950 {\n color: #020617;\n}\n.text-gray-50 {\n color: #f9fafb;\n}\n.text-gray-100 {\n color: #f3f4f6;\n}\n.text-gray-200 {\n color: #e5e7eb;\n}\n.text-gray-300 {\n color: #d1d5db;\n}\n.text-gray-400 {\n color: #9ca3af;\n}\n.text-gray-500 {\n color: #6b7280;\n}\n.text-gray-600 {\n color: #4b5563;\n}\n.text-gray-700 {\n color: #374151;\n}\n.text-gray-800 {\n color: #1f2937;\n}\n.text-gray-900 {\n color: #111827;\n}\n.text-gray-950 {\n color: #030712;\n}\n.text-green-600 {\n color: #059669;\n}\n.text-green-700 {\n color: #047857;\n}\n.text-blue-50 {\n color: #eff6ff;\n}\n.text-blue-100 {\n color: #dbeafe;\n}\n.text-blue-200 {\n color: #bfdbfe;\n}\n.text-blue-300 {\n color: #93c5fd;\n}\n.text-blue-400 {\n color: #60a5fa;\n}\n.text-blue-500 {\n color: #3b82f6;\n}\n.text-blue-600 {\n color: #2563eb;\n}\n.text-blue-700 {\n color: #1d4ed8;\n}\n.text-blue-800 {\n color: #1e40af;\n}\n.text-blue-900 {\n color: #1e3a8a;\n}\n.text-blue-950 {\n color: #172554;\n}\n.text-orange-50 {\n color: #fff7ed;\n}\n.text-orange-100 {\n color: #ffedd5;\n}\n.text-orange-200 {\n color: #fed7aa;\n}\n.text-orange-300 {\n color: #fdba74;\n}\n.text-orange-400 {\n color: #fb923c;\n}\n.text-orange-500 {\n color: #f97316;\n}\n.text-orange-600 {\n color: #ea580c;\n}\n.text-orange-700 {\n color: #c2410c;\n}\n.text-orange-800 {\n color: #9a3412;\n}\n.text-orange-900 {\n color: #7c2d12;\n}\n.text-orange-950 {\n color: #431407;\n}\n.text-yellow-500 {\n color: #f59e0b;\n}\n.text-yellow-700 {\n color: #b45309;\n}\n.text-red-500 {\n color: #ef4444;\n}\n.text-red-700 {\n color: #b91c1c;\n}\n.border {\n border-width: 1px;\n}\n.border-2 {\n border-width: 2px;\n}\n.border-l {\n border-left-width: 1px;\n}\n.border-dashed {\n border-style: dashed;\n}\n.border-solid {\n border-style: solid;\n}\n.border-slate-50 {\n border-color: #f8fafc;\n}\n.border-slate-100 {\n border-color: #f1f5f9;\n}\n.border-slate-200 {\n border-color: #e2e8f0;\n}\n.border-slate-300 {\n border-color: #cbd5e1;\n}\n.border-slate-400 {\n border-color: #94a3b8;\n}\n.border-slate-500 {\n border-color: #64748b;\n}\n.border-slate-600 {\n border-color: #475569;\n}\n.border-slate-700 {\n border-color: #334155;\n}\n.border-slate-800 {\n border-color: #1e293b;\n}\n.border-slate-900 {\n border-color: #0f172a;\n}\n.border-slate-950 {\n border-color: #020617;\n}\n.border-gray-400 {\n border-color: #9ca3af;\n}\n.border-gray-500 {\n border-color: #6b7280;\n}\n.origin-center {\n transform-origin: center;\n}\n.rotate-45 {\n transform: rotate(45deg);\n}\n.translate-x-2\\/4 {\n transform: translateX(50%);\n}\n.-translate-x-2\\/4 {\n transform: translateX(-50%);\n}\n.translate-y-2\\/4 {\n transform: translateY(50%);\n}\n.translate-y-full {\n transform: translateY(100%);\n}\n.-translate-y-full {\n transform: translateY(-100%);\n}\n.shadow-sm {\n box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n}\n.shadow {\n box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);\n}\n.shadow-md {\n box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);\n}\n.shadow-lg {\n box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);\n}\n.shadow-xl {\n box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);\n}\n.shadow-2xl {\n box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);\n}\n.shadow-inner {\n box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.05);\n}\n.shadow-none {\n box-shadow: 0 0 #0000;\n}\n@media (min-width: 768px) {\n .sm\\:flex {\n display: flex !important;\n }\n .sm\\:hidden {\n display: none !important;\n }\n}\n* {\n margin: 0;\n padding: 0;\n box-sizing: border-box !important;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n line-height: 1.15;\n}\nbody {\n color: #232323;\n background-color: #f8fafc;\n}\nth {\n font-weight: normal;\n}\ncode {\n font-family: source-code-pro, Menlo, Monaco, Consolas, \"Courier New\", monospace;\n}\n@media only screen and (max-width: 768px) {\n select,\n textarea,\n input[type=\"text\"],\n input[type=\"password\"],\n input[type=\"datetime\"],\n input[type=\"datetime-local\"],\n input[type=\"date\"],\n input[type=\"month\"],\n input[type=\"time\"],\n input[type=\"week\"],\n input[type=\"number\"],\n input[type=\"email\"],\n input[type=\"url\"],\n input[type=\"search\"],\n input[type=\"tel\"],\n input[type=\"color\"] {\n font-size: 16px !important;\n }\n}\n@keyframes App-logo-spin {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}\n";
|
|
1775
|
-
styleInject(css_248z);
|
|
1777
|
+
var MUTATION$8 = "\nquery FormattedInvoice($id: ID) {\n formattedInvoice(id: $id) {\n amount\n amountDue\n amountPaid\n billingCity\n billingCountry\n billingState\n billingStreet\n billingZip\n createdAt\n credits\n currency\n currencyId\n currencySymbol\n customerBillingCity\n customerBillingContact\n customerBillingCountry\n customerBillingState\n customerBillingStreet\n customerBillingZip\n customerName\n dueAt\n html\n id\n isLegacy\n netPaymentDays\n number\n payableId\n poNumber\n printedState\n smallUnitAmountDue\n state\n subscriptionEndDate\n subscriptionStartDate\n subtotal\n taxAmount\n taxNumber\n uuid\n vendorName\n formattedLines {\n amount\n billingPeriodEnd\n billingPeriodStart\n chargeType\n discount\n frequency\n lineText\n position\n price\n priceDecimals\n priceListChargeId\n priceListChargeName\n priceListName\n prorationRate\n quantity\n unitOfMeasure\n priceTiers {\n price\n starts\n }\n }\n }\n}";
|
|
1778
|
+
var getFormattedInvoice = function (_a) {
|
|
1779
|
+
var id = _a.id, token = _a.token, subdomain = _a.subdomain;
|
|
1780
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
1781
|
+
var vars, response;
|
|
1782
|
+
return __generator(this, function (_b) {
|
|
1783
|
+
switch (_b.label) {
|
|
1784
|
+
case 0:
|
|
1785
|
+
vars = { id: id };
|
|
1786
|
+
return [4 /*yield*/, common.gqlRequest({
|
|
1787
|
+
query: MUTATION$8,
|
|
1788
|
+
token: token,
|
|
1789
|
+
vars: vars,
|
|
1790
|
+
subdomain: subdomain,
|
|
1791
|
+
})];
|
|
1792
|
+
case 1:
|
|
1793
|
+
response = _b.sent();
|
|
1794
|
+
return [2 /*return*/, response === null || response === void 0 ? void 0 : response.formattedInvoice];
|
|
1795
|
+
}
|
|
1796
|
+
});
|
|
1797
|
+
});
|
|
1798
|
+
};
|
|
1776
1799
|
|
|
1777
1800
|
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}";
|
|
1778
1801
|
var usePaymentMethod = function (graphQLClient) {
|
|
@@ -1930,7 +1953,6 @@ var PaymentContext = React.createContext({});
|
|
|
1930
1953
|
var CheckoutFooter = function (_a) {
|
|
1931
1954
|
var amountDue = _a.amountDue, currencyId = _a.currencyId, isSaving = _a.isSaving, onPaymentSubmit = _a.onPaymentSubmit, onlySavePaymentMethod = _a.onlySavePaymentMethod, noPadding = _a.noPadding;
|
|
1932
1955
|
var isMobile = common.useIsMobile();
|
|
1933
|
-
var invoice = React.useContext(InvoiceCheckoutContext).invoice;
|
|
1934
1956
|
var displayPayButtonNameAnyways = React.useContext(PaymentContext).displayPayButtonNameAnyways;
|
|
1935
1957
|
var buttonName = function () {
|
|
1936
1958
|
return onlySavePaymentMethod && !displayPayButtonNameAnyways
|
|
@@ -1941,11 +1963,6 @@ var CheckoutFooter = function (_a) {
|
|
|
1941
1963
|
? "Paying"
|
|
1942
1964
|
: "Pay";
|
|
1943
1965
|
};
|
|
1944
|
-
React.useEffect(function () {
|
|
1945
|
-
if (invoice) {
|
|
1946
|
-
onPaymentSubmit();
|
|
1947
|
-
}
|
|
1948
|
-
}, [invoice]);
|
|
1949
1966
|
return (jsxRuntime.jsx("div", __assign({ className: "flex justify-end gap-2 ".concat(noPadding ? "" : "pt-6") }, { children: jsxRuntime.jsx(antd.Button, __assign({ className: "w-full", disabled: isSaving, onClick: onPaymentSubmit, size: isMobile ? "large" : "middle", type: "primary" }, { children: "".concat(buttonName()).concat(amountDue && currencyId
|
|
1950
1967
|
? " ".concat(common.Misc.formatCurrency(amountDue, currencyId))
|
|
1951
1968
|
: "") })) })));
|
|
@@ -2281,8 +2298,8 @@ var DemoPayForm = function (_a) {
|
|
|
2281
2298
|
switch (_a.label) {
|
|
2282
2299
|
case 0:
|
|
2283
2300
|
_a.trys.push([0, 6, , 7]);
|
|
2284
|
-
validateCardDetails();
|
|
2285
2301
|
if (!onlySavePaymentMethod) return [3 /*break*/, 2];
|
|
2302
|
+
validateCardDetails();
|
|
2286
2303
|
setIsSaving(true);
|
|
2287
2304
|
return [4 /*yield*/, storePayment({
|
|
2288
2305
|
testCreditCardNumber: unformatCardNumber(cardDetails.number),
|
|
@@ -2308,6 +2325,7 @@ var DemoPayForm = function (_a) {
|
|
|
2308
2325
|
return [3 /*break*/, 5];
|
|
2309
2326
|
case 2:
|
|
2310
2327
|
if (!(amountDue !== undefined && currencyId)) return [3 /*break*/, 4];
|
|
2328
|
+
validateCardDetails();
|
|
2311
2329
|
setIsSaving(true);
|
|
2312
2330
|
return [4 /*yield*/, confirmPayment({
|
|
2313
2331
|
amount: amountDue,
|
|
@@ -2798,7 +2816,7 @@ var PaymentForm = function (_a) {
|
|
|
2798
2816
|
return (jsxRuntime.jsx(ActualPaymentForm, { invoice: invoice, isSaving: isSaving, onFail: onFail, onPaymentSuccess: onPaymentSuccess, quote: quote, setIsSaving: setIsSaving }));
|
|
2799
2817
|
};
|
|
2800
2818
|
|
|
2801
|
-
var MUTATION$
|
|
2819
|
+
var MUTATION$7 = "\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";
|
|
2802
2820
|
var checkout = function (_a) {
|
|
2803
2821
|
var quoteId = _a.quoteId, invoiceId = _a.invoiceId, paymentMethodId = _a.paymentMethodId, paymentMethodData = _a.paymentMethodData, token = _a.token, subdomain = _a.subdomain;
|
|
2804
2822
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -2815,7 +2833,7 @@ var checkout = function (_a) {
|
|
|
2815
2833
|
mutationVars.paymentMethodData = __assign(__assign({}, paymentMethodData), { metadata: paymentMethodData.metadata });
|
|
2816
2834
|
}
|
|
2817
2835
|
return [4 /*yield*/, common.gqlRequest({
|
|
2818
|
-
query: MUTATION$
|
|
2836
|
+
query: MUTATION$7,
|
|
2819
2837
|
token: token,
|
|
2820
2838
|
vars: mutationVars,
|
|
2821
2839
|
subdomain: subdomain,
|
|
@@ -2952,31 +2970,8 @@ function InvoicePDF(_a) {
|
|
|
2952
2970
|
}, title: "Invoice PDF", width: "100%" }));
|
|
2953
2971
|
}
|
|
2954
2972
|
|
|
2955
|
-
var MUTATION$7 = "\nquery FormattedInvoice($id: ID) {\n formattedInvoice(id: $id) {\n amount\n amountDue\n amountPaid\n billingCity\n billingCountry\n billingState\n billingStreet\n billingZip\n createdAt\n credits\n currency\n currencyId\n currencySymbol\n customerBillingCity\n customerBillingContact\n customerBillingCountry\n customerBillingState\n customerBillingStreet\n customerBillingZip\n customerName\n dueAt\n html\n id\n isLegacy\n netPaymentDays\n number\n payableId\n poNumber\n printedState\n smallUnitAmountDue\n state\n subscriptionEndDate\n subscriptionStartDate\n subtotal\n taxAmount\n taxNumber\n uuid\n vendorName\n formattedLines {\n amount\n billingPeriodEnd\n billingPeriodStart\n chargeType\n discount\n frequency\n lineText\n position\n price\n priceDecimals\n priceListChargeId\n priceListChargeName\n priceListName\n prorationRate\n quantity\n unitOfMeasure\n priceTiers {\n price\n starts\n }\n }\n }\n}";
|
|
2956
|
-
var getFormattedInvoice = function (_a) {
|
|
2957
|
-
var id = _a.id, token = _a.token, subdomain = _a.subdomain;
|
|
2958
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
2959
|
-
var vars, response;
|
|
2960
|
-
return __generator(this, function (_b) {
|
|
2961
|
-
switch (_b.label) {
|
|
2962
|
-
case 0:
|
|
2963
|
-
vars = { id: id };
|
|
2964
|
-
return [4 /*yield*/, common.gqlRequest({
|
|
2965
|
-
query: MUTATION$7,
|
|
2966
|
-
token: token,
|
|
2967
|
-
vars: vars,
|
|
2968
|
-
subdomain: subdomain,
|
|
2969
|
-
})];
|
|
2970
|
-
case 1:
|
|
2971
|
-
response = _b.sent();
|
|
2972
|
-
return [2 /*return*/, response === null || response === void 0 ? void 0 : response.formattedInvoice];
|
|
2973
|
-
}
|
|
2974
|
-
});
|
|
2975
|
-
});
|
|
2976
|
-
};
|
|
2977
|
-
|
|
2978
2973
|
function ActualInvoice(_a) {
|
|
2979
|
-
var id = _a.id, invoiceQuoteViewComponent = _a.invoiceQuoteViewComponent, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick, onPaymentSuccess = _a.onPaymentSuccess;
|
|
2974
|
+
var id = _a.id, invoiceQuoteViewComponent = _a.invoiceQuoteViewComponent, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick, onPaymentSuccess = _a.onPaymentSuccess;
|
|
2980
2975
|
var _b = React.useState(false), isSaving = _b[0], setIsSaving = _b[1];
|
|
2981
2976
|
var queryClient = reactQuery.useQueryClient();
|
|
2982
2977
|
var isMobile = common.useIsMobile();
|
|
@@ -3327,1095 +3322,1175 @@ function Quote(_a) {
|
|
|
3327
3322
|
}
|
|
3328
3323
|
var templateObject_1$5;
|
|
3329
3324
|
|
|
3330
|
-
var
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3325
|
+
var QUOTES_QUERY = function (filter) { return "\n query quotes {\n quotes ".concat(filter ? "(".concat(filter, ")") : "", " {\n pageInfo {\n startCursor\n endCursor\n hasNextPage\n hasPreviousPage\n }\n nodes {\n id\n name\n account {\n name\n id\n }\n applicationDate\n state\n createdAt\n expiresAt\n currencyId\n amount\n number\n }\n }\n }"); };
|
|
3326
|
+
var getQuotes = function (_a) {
|
|
3327
|
+
var token = _a.token, subdomain = _a.subdomain, filter = _a.filter;
|
|
3328
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
3329
|
+
var response;
|
|
3330
|
+
return __generator(this, function (_b) {
|
|
3331
|
+
switch (_b.label) {
|
|
3332
|
+
case 0: return [4 /*yield*/, common.gqlRequest({
|
|
3333
|
+
query: QUOTES_QUERY(filter),
|
|
3334
|
+
token: token,
|
|
3335
|
+
vars: {},
|
|
3336
|
+
subdomain: subdomain,
|
|
3337
|
+
})];
|
|
3338
|
+
case 1:
|
|
3339
|
+
response = _b.sent();
|
|
3340
|
+
return [2 /*return*/, response === null || response === void 0 ? void 0 : response.quotes];
|
|
3341
|
+
}
|
|
3342
|
+
});
|
|
3343
|
+
});
|
|
3337
3344
|
};
|
|
3338
3345
|
|
|
3339
|
-
var
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3346
|
+
var transactionMutation = function (filter) { return "\nquery transactions {\n transactions ".concat(filter ? "(".concat(filter, ")") : "", " {\n nodes {\n amount\n createdAt\n currencyId\n description\n id\n kind\n state\n transactionableId\n transactionable {\n ...on Payment { amount }\n ...on Invoice { amount number }\n }\n }\n }\n}"); };
|
|
3347
|
+
var getTransactions = function (filter, token, subdomain, kindsToShow) { return __awaiter(void 0, void 0, void 0, function () {
|
|
3348
|
+
var response, _a, data, errors, transactions;
|
|
3349
|
+
var _b, _c;
|
|
3350
|
+
return __generator(this, function (_d) {
|
|
3351
|
+
switch (_d.label) {
|
|
3352
|
+
case 0: return [4 /*yield*/, fetch(subdomain + "/graphql", {
|
|
3353
|
+
method: "POST",
|
|
3354
|
+
headers: {
|
|
3355
|
+
"Content-type": "application/json; charset=utf-8",
|
|
3356
|
+
Authorization: "Bearer ".concat(token),
|
|
3357
|
+
},
|
|
3358
|
+
body: JSON.stringify({
|
|
3359
|
+
query: transactionMutation(filter),
|
|
3360
|
+
}),
|
|
3361
|
+
})];
|
|
3362
|
+
case 1:
|
|
3363
|
+
response = _d.sent();
|
|
3364
|
+
return [4 /*yield*/, response.json()];
|
|
3365
|
+
case 2:
|
|
3366
|
+
_a = _d.sent(), data = _a.data, errors = _a.errors;
|
|
3367
|
+
if (errors) {
|
|
3368
|
+
throw new Error(errors[0].message);
|
|
3369
|
+
}
|
|
3370
|
+
transactions = (_c = (_b = data === null || data === void 0 ? void 0 : data.transactions) === null || _b === void 0 ? void 0 : _b.nodes) === null || _c === void 0 ? void 0 : _c.filter(function (transaction) { return kindsToShow.includes(transaction.kind); });
|
|
3371
|
+
return [2 /*return*/, transactions === null || transactions === void 0 ? void 0 : transactions.reverse()];
|
|
3372
|
+
}
|
|
3373
|
+
});
|
|
3374
|
+
}); };
|
|
3343
3375
|
|
|
3344
|
-
var
|
|
3376
|
+
var pageContentRefState = recoil.atom({
|
|
3377
|
+
key: "pageContentRefState",
|
|
3378
|
+
default: undefined,
|
|
3379
|
+
});
|
|
3345
3380
|
|
|
3346
|
-
var
|
|
3381
|
+
var PageContent = function (_a) {
|
|
3347
3382
|
var children = _a.children, className = _a.className, style = _a.style;
|
|
3348
|
-
var
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3383
|
+
var pageContentRef = React.useRef(null);
|
|
3384
|
+
var setPageContentRef = recoil.useSetRecoilState(pageContentRefState);
|
|
3385
|
+
React.useEffect(function () {
|
|
3386
|
+
setPageContentRef(pageContentRef === null || pageContentRef === void 0 ? void 0 : pageContentRef.current);
|
|
3387
|
+
}, [pageContentRef, setPageContentRef]);
|
|
3388
|
+
return (jsxRuntime.jsx("div", __assign({ className: className, ref: pageContentRef, style: style }, { children: children })));
|
|
3352
3389
|
};
|
|
3353
3390
|
|
|
3354
3391
|
var Text$b = antd.Typography.Text;
|
|
3355
|
-
var
|
|
3356
|
-
var
|
|
3357
|
-
var onClickRemove = _a.onClickRemove, onClickUpdate = _a.onClickUpdate, paymentMethodData = _a.paymentMethodData;
|
|
3358
|
-
var isExpired = function (paymentMethodData) {
|
|
3359
|
-
// paymentMethodData.expirationDate
|
|
3360
|
-
var expDate = dayjs(paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.expirationDate);
|
|
3361
|
-
return expDate.isBefore(dayjs());
|
|
3362
|
-
};
|
|
3392
|
+
var PageHeaderWithActions = function (_a) {
|
|
3393
|
+
var children = _a.children, title = _a.title;
|
|
3363
3394
|
var isMobile = common.useIsMobile();
|
|
3364
|
-
|
|
3365
|
-
return (jsxRuntime.jsxs(Card, __assign({ className: "shadow-md m-0" }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex items-center justify-between gap-4 p-4" }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex items-center gap-4" }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex items-center gap-2" }, { children: [getCardImage((_b = paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.metadata) === null || _b === void 0 ? void 0 : _b.issuer) && (jsxRuntime.jsx("img", { alt: "Card", width: "24px", src: "".concat(processPublicUrl, "/").concat(getCardImage((_c = paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.metadata) === null || _c === void 0 ? void 0 : _c.issuer)) })), jsxRuntime.jsx(Text$b, { children: (_d = paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.metadata) === null || _d === void 0 ? void 0 : _d.description })] })), jsxRuntime.jsx(antd.Tag, __assign({ color: isExpired(paymentMethodData) ? "red" : "green" }, { children: isExpired(paymentMethodData) ? "Expired" : "Valid" }))] })), !isMobile && (jsxRuntime.jsx(CardActions, { onClickRemove: onClickRemove, onClickUpdate: onClickUpdate }))] })), dayjs(paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.expirationDate).isValid() && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(antd.Divider, {}), jsxRuntime.jsxs("div", __assign({ className: "flex flex-col p-4" }, { children: [jsxRuntime.jsx(CardAttribute, { title: "EXPIRATION", value: dayjs(paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.expirationDate).format("MM/YY") }), isMobile && (jsxRuntime.jsx(CardActions, { onClickRemove: onClickRemove, onClickUpdate: onClickUpdate }))] }))] }))] })));
|
|
3395
|
+
return (jsxRuntime.jsxs("div", __assign({ className: "flex pb-4 shadow-padding-x ".concat(isMobile ? "flex-col gap-2" : "items-center justify-between h-8") }, { children: [jsxRuntime.jsx(PageSubTitle, { title: title }), children] })));
|
|
3366
3396
|
};
|
|
3367
|
-
var
|
|
3368
|
-
var title = _a.title
|
|
3369
|
-
|
|
3397
|
+
var PageSubTitle = function (_a) {
|
|
3398
|
+
var title = _a.title;
|
|
3399
|
+
var secondaryColor = React.useContext(BrandContext).secondaryColor;
|
|
3400
|
+
var darkMode = React.useContext(BunnyContext).darkMode;
|
|
3401
|
+
return (jsxRuntime.jsx(Text$b, __assign({ className: "shrink-0 font-medium", style: { color: darkMode ? undefined : secondaryColor } }, { children: title })));
|
|
3370
3402
|
};
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
var
|
|
3374
|
-
return
|
|
3403
|
+
|
|
3404
|
+
var StateTag = function (_a) {
|
|
3405
|
+
var state = _a.state;
|
|
3406
|
+
return jsxRuntime.jsx(antd.Tag, __assign({ color: getColor(state) }, { children: lodash.capitalize(lodash.startCase(state)) }));
|
|
3375
3407
|
};
|
|
3376
|
-
var
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3408
|
+
var getColor = function (state) {
|
|
3409
|
+
switch (state) {
|
|
3410
|
+
case common.FrontendTransaction.TransactionState.not_due:
|
|
3411
|
+
return "yellow";
|
|
3412
|
+
case common.FrontendTransaction.TransactionState.voided:
|
|
3413
|
+
return "black";
|
|
3414
|
+
case common.FrontendTransaction.TransactionState.ready:
|
|
3415
|
+
return "orange";
|
|
3416
|
+
case common.FrontendTransaction.TransactionState.preparing:
|
|
3417
|
+
return "purple";
|
|
3418
|
+
case common.FrontendTransaction.TransactionState.unapplied:
|
|
3419
|
+
case common.FrontendTransaction.TransactionState.partially_applied:
|
|
3420
|
+
case common.FrontendTransaction.TransactionState.applied:
|
|
3421
|
+
return "blue";
|
|
3422
|
+
case common.FrontendTransaction.TransactionState.due:
|
|
3423
|
+
case common.FrontendTransaction.TransactionState.unpaid:
|
|
3424
|
+
return "orange";
|
|
3425
|
+
case common.FrontendTransaction.TransactionState.failed:
|
|
3426
|
+
return "red";
|
|
3427
|
+
case common.FrontendTransaction.TransactionState.paid:
|
|
3428
|
+
return "green";
|
|
3429
|
+
default:
|
|
3430
|
+
return "blue";
|
|
3431
|
+
}
|
|
3380
3432
|
};
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3433
|
+
|
|
3434
|
+
var TransactionGridCell = styled__default["default"].div.withConfig({
|
|
3435
|
+
shouldForwardProp: function (prop) {
|
|
3436
|
+
return !["gridColumn", "padding", "right"].includes(prop);
|
|
3437
|
+
},
|
|
3438
|
+
})(templateObject_1$4 || (templateObject_1$4 = __makeTemplateObject(["\n ", "\n\n display: flex;\n align-items: center;\n justify-content: ", ";\n\n text-align: ", ";\n white-space: nowrap;\n font-size: 14px;\n color: ", ";\n\n background-color: inherit;\n\n padding: 1rem;\n min-width: 48px;\n"], ["\n ", "\n\n display: flex;\n align-items: center;\n justify-content: ", ";\n\n text-align: ", ";\n white-space: nowrap;\n font-size: 14px;\n color: ", ";\n\n background-color: inherit;\n\n padding: 1rem;\n min-width: 48px;\n"])), function (props) { return props.gridColumn && "grid-column: ".concat(props.gridColumn, ";"); }, function (props) { return (props.right ? "flex-end" : "flex-start"); }, function (props) { return (props.right ? "right" : "left"); }, common.SLATE_600);
|
|
3439
|
+
var templateObject_1$4;
|
|
3440
|
+
|
|
3441
|
+
var Text$a = antd.Typography.Text;
|
|
3442
|
+
var TransactionDate = function (_a) {
|
|
3443
|
+
var date = _a.date;
|
|
3444
|
+
return jsxRuntime.jsx(Text$a, __assign({ className: "text-sm" }, { children: common.Misc.formatDate(date) }));
|
|
3386
3445
|
};
|
|
3387
3446
|
|
|
3388
|
-
var
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
var
|
|
3396
|
-
|
|
3397
|
-
console.log("Navigation in PaymentMethod.tsx useAllErrorFormats not implemented");
|
|
3398
|
-
});
|
|
3399
|
-
var isMobile = common.useIsMobile();
|
|
3400
|
-
var data = usePaymentMethod(graphQLClient).data;
|
|
3401
|
-
// Local state
|
|
3402
|
-
var _b = React.useState(false), showModal = _b[0], setShowModal = _b[1];
|
|
3403
|
-
var _c = React.useState(false), isSaving = _c[0], setIsSaving = _c[1];
|
|
3404
|
-
// Queries
|
|
3405
|
-
reactQuery.useQuery({
|
|
3406
|
-
queryKey: common.QueryKeyFactory.default.currentUserKey,
|
|
3407
|
-
queryFn: function () { return getCurrentUserData({ token: token, subdomain: subdomain }); },
|
|
3408
|
-
});
|
|
3409
|
-
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); });
|
|
3410
|
-
var onClickRemove = function () {
|
|
3411
|
-
if (data && plugin) {
|
|
3412
|
-
common.invokePlugin({
|
|
3413
|
-
plugin: plugin,
|
|
3414
|
-
method: "remove_payment_method",
|
|
3415
|
-
payload: {
|
|
3416
|
-
payment_method_id: data.id,
|
|
3417
|
-
account_id: accountId,
|
|
3418
|
-
},
|
|
3419
|
-
token: token,
|
|
3420
|
-
subdomain: subdomain,
|
|
3421
|
-
})
|
|
3422
|
-
.then(function () {
|
|
3423
|
-
showSuccessNotification("Payment method was removed", "Success");
|
|
3424
|
-
queryClient.setQueryData(common.QueryKeyFactory.default.accountPaymentMethodKey, null);
|
|
3425
|
-
})
|
|
3426
|
-
.catch(function (error) {
|
|
3427
|
-
showErrorNotification(error.message, "Error removing Payment Method");
|
|
3428
|
-
});
|
|
3429
|
-
}
|
|
3430
|
-
};
|
|
3431
|
-
var onSuccess = function () {
|
|
3432
|
-
queryClient.invalidateQueries({
|
|
3433
|
-
queryKey: common.QueryKeyFactory.default.accountPaymentMethodKey,
|
|
3434
|
-
});
|
|
3435
|
-
setShowModal(false);
|
|
3436
|
-
showSuccessNotification("Your payment method has been saved");
|
|
3437
|
-
};
|
|
3438
|
-
if (data === undefined)
|
|
3447
|
+
var isInvoice = function (transaction) {
|
|
3448
|
+
return transaction.kind === "INVOICE";
|
|
3449
|
+
};
|
|
3450
|
+
var isQuote = function (transaction) {
|
|
3451
|
+
return transaction.kind === "QUOTE";
|
|
3452
|
+
};
|
|
3453
|
+
var TransactionRowTitle = function (_a) {
|
|
3454
|
+
var transaction = _a.transaction;
|
|
3455
|
+
if (!isInvoice(transaction) && !isQuote(transaction)) {
|
|
3439
3456
|
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
? {
|
|
3443
|
-
padding: "1rem 0 0",
|
|
3444
|
-
}
|
|
3445
|
-
: {},
|
|
3446
|
-
wrapper: isMobile ? { width: "100vw" } : { width: "min-content" },
|
|
3447
|
-
}, title: jsxRuntime.jsx(DrawerHeader, { onClose: function () { return setShowModal(false); }, title: "New payment method" }) }, { children: jsxRuntime.jsx(PaymentForm, { isSaving: isSaving, onFail: function (error) {
|
|
3448
|
-
handleAllErrorFormats(error);
|
|
3449
|
-
setIsSaving(false);
|
|
3450
|
-
}, onPaymentSuccess: function () {
|
|
3451
|
-
onSuccess();
|
|
3452
|
-
setIsSaving(false);
|
|
3453
|
-
}, setIsSaving: setIsSaving }) }))] }));
|
|
3457
|
+
}
|
|
3458
|
+
return (jsxRuntime.jsx("span", __assign({ className: "text-slate-400", style: { fontSize: "11px" } }, { children: transaction.transactionable.number })));
|
|
3454
3459
|
};
|
|
3455
|
-
function PaymentMethod(_a) {
|
|
3456
|
-
var footer = _a.footer, processPublicUrl = _a.processPublicUrl;
|
|
3457
|
-
return (jsxRuntime.jsx(PaymentMethodContext.Provider, __assign({ value: { footer: footer, processPublicUrl: processPublicUrl } }, { children: jsxRuntime.jsx(ActualPaymentMethod, {}) })));
|
|
3458
|
-
}
|
|
3459
3460
|
|
|
3460
|
-
|
|
3461
|
-
var
|
|
3462
|
-
var
|
|
3463
|
-
return
|
|
3464
|
-
var vars, response, errors;
|
|
3465
|
-
var _b;
|
|
3466
|
-
return __generator(this, function (_c) {
|
|
3467
|
-
switch (_c.label) {
|
|
3468
|
-
case 0:
|
|
3469
|
-
vars = { id: accountId, attributes: attributes };
|
|
3470
|
-
return [4 /*yield*/, common.gqlRequest({ query: MUTATION$5, token: token, vars: vars })];
|
|
3471
|
-
case 1:
|
|
3472
|
-
response = _c.sent();
|
|
3473
|
-
errors = (_b = response === null || response === void 0 ? void 0 : response.accountUpdate) === null || _b === void 0 ? void 0 : _b.errors;
|
|
3474
|
-
if (errors)
|
|
3475
|
-
throw errors;
|
|
3476
|
-
return [2 /*return*/, response.accountUpdate];
|
|
3477
|
-
}
|
|
3478
|
-
});
|
|
3479
|
-
});
|
|
3461
|
+
// TODO: delete
|
|
3462
|
+
var ArrowDownToLine = function (_a) {
|
|
3463
|
+
var className = _a.className, _b = _a.color, color = _b === void 0 ? common.SLATE_600 : _b;
|
|
3464
|
+
return (jsxRuntime.jsxs("svg", __assign({ className: className, fill: "none", height: "16", viewBox: "0 0 16 16", width: "16", xmlns: "http://www.w3.org/2000/svg" }, { children: [jsxRuntime.jsx("path", { d: "M8 11.3333V2", stroke: color, strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), jsxRuntime.jsx("path", { d: "M4 7.33301L8 11.333L12 7.33301", stroke: color, strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), jsxRuntime.jsx("path", { d: "M12.6654 14H3.33203", stroke: color, strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })] })));
|
|
3480
3465
|
};
|
|
3481
3466
|
|
|
3482
|
-
var
|
|
3483
|
-
var TaxationForm = function (_a) {
|
|
3484
|
-
var account = _a.account, quote = _a.quote;
|
|
3485
|
-
// Hooks
|
|
3486
|
-
var queryClient = reactQuery.useQueryClient();
|
|
3487
|
-
var token = React.useContext(BunnyContext).token;
|
|
3488
|
-
var form = antd.Form.useForm()[0];
|
|
3489
|
-
// Mutations
|
|
3490
|
-
var _b = reactQuery.useMutation({
|
|
3491
|
-
mutationFn: function (changedFormData) { return __awaiter(void 0, void 0, void 0, function () {
|
|
3492
|
-
var account;
|
|
3493
|
-
return __generator(this, function (_a) {
|
|
3494
|
-
switch (_a.label) {
|
|
3495
|
-
case 0: return [4 /*yield*/, accountUpdate({
|
|
3496
|
-
accountId: quote.accountId,
|
|
3497
|
-
attributes: changedFormData,
|
|
3498
|
-
token: token,
|
|
3499
|
-
})];
|
|
3500
|
-
case 1:
|
|
3501
|
-
account = _a.sent();
|
|
3502
|
-
return [2 /*return*/, account];
|
|
3503
|
-
}
|
|
3504
|
-
});
|
|
3505
|
-
}); },
|
|
3506
|
-
onSuccess: function () {
|
|
3507
|
-
queryClient.invalidateQueries({
|
|
3508
|
-
queryKey: ["getTaxationRequiredAccountFields", token],
|
|
3509
|
-
});
|
|
3510
|
-
},
|
|
3511
|
-
}), updateAccount = _b.mutate, isUpdatingAccount = _b.isPending;
|
|
3512
|
-
return (jsxRuntime.jsxs(antd.Form, __assign({ className: "flex flex-col gap-4", form: form, initialValues: account, layout: "vertical", onFinish: updateAccount }, { children: [jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Billing street", name: "billingStreet" }, { children: jsxRuntime.jsx(antd.Input, { placeholder: "Street" }) })), jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Billing city", name: "billingCity" }, { children: jsxRuntime.jsx(antd.Input, { placeholder: "City" }) })), jsxRuntime.jsx(FormBillingState, { form: form }), jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Billing country", name: "billingCountry", rules: [{ required: true }] }, { children: jsxRuntime.jsx(antd.Select, { options: common.Lists.COUNTRY_LIST, placeholder: "Select a country", showSearch: true, filterOption: function (input, option) {
|
|
3513
|
-
var _a, _b;
|
|
3514
|
-
return ((_a = option === null || option === void 0 ? void 0 : option.label) !== null && _a !== void 0 ? _a : "").toLowerCase().includes(input.toLowerCase()) ||
|
|
3515
|
-
((_b = option === null || option === void 0 ? void 0 : option.value) !== null && _b !== void 0 ? _b : "").toLowerCase().includes(input.toLowerCase());
|
|
3516
|
-
} }) })), jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Billing zip", name: "billingZip" }, { children: jsxRuntime.jsx(antd.Input, { placeholder: "Zip" }) })), jsxRuntime.jsx(antd.Form.Item, { children: jsxRuntime.jsx(antd.Button, __assign({ className: "w-full", disabled: isUpdatingAccount, htmlType: "submit", type: "primary" }, { children: "Submit" })) })] })));
|
|
3517
|
-
};
|
|
3518
|
-
var FormBillingState = function (_a) {
|
|
3519
|
-
_a.form;
|
|
3520
|
-
var billingCountry = antd.Form.useWatch("billingCountry");
|
|
3521
|
-
var billingStateRequired = COUNTRIES_REQUIRING_STATE.includes(billingCountry);
|
|
3522
|
-
return (jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Billing state", name: "billingState", rules: [{ required: billingStateRequired }] }, { children: jsxRuntime.jsx(antd.Input, { placeholder: "State" }) })));
|
|
3523
|
-
};
|
|
3467
|
+
var TransactionsListContext = React.createContext({});
|
|
3524
3468
|
|
|
3525
|
-
var
|
|
3526
|
-
var
|
|
3527
|
-
|
|
3469
|
+
var TransactionDownload = function (_a) {
|
|
3470
|
+
var transaction = _a.transaction, token = _a.token, subdomain = _a.subdomain;
|
|
3471
|
+
var darkMode = React.useContext(BunnyContext).darkMode;
|
|
3472
|
+
var downloadTransactionLink = React.useContext(TransactionsListContext).downloadTransactionLink;
|
|
3473
|
+
var downloadFile = common.useDownloadFile();
|
|
3528
3474
|
var isMobile = common.useIsMobile();
|
|
3529
|
-
var
|
|
3530
|
-
var
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
var paymentMethodId = savedPaymentMethod.paymentMethodId;
|
|
3540
|
-
return checkout({
|
|
3541
|
-
quoteId: quote.id,
|
|
3542
|
-
paymentMethodId: paymentMethodId,
|
|
3543
|
-
token: token,
|
|
3544
|
-
subdomain: subdomain,
|
|
3545
|
-
});
|
|
3546
|
-
}
|
|
3547
|
-
if (pluginPaymentMethod) {
|
|
3548
|
-
var plugin = pluginPaymentMethod.plugin, savePaymentMethod = pluginPaymentMethod.savePaymentMethod, metadata = pluginPaymentMethod.metadata;
|
|
3549
|
-
var paymentToken = pluginPaymentMethod.token;
|
|
3550
|
-
return checkout({
|
|
3551
|
-
quoteId: quote.id,
|
|
3552
|
-
paymentMethodData: {
|
|
3553
|
-
metadata: metadata,
|
|
3554
|
-
pluginGuid: plugin.guid,
|
|
3555
|
-
savePaymentMethod: savePaymentMethod,
|
|
3556
|
-
token: paymentToken,
|
|
3557
|
-
},
|
|
3558
|
-
token: token,
|
|
3559
|
-
subdomain: subdomain,
|
|
3560
|
-
});
|
|
3561
|
-
}
|
|
3562
|
-
throw new Error("Pay payment method provided");
|
|
3563
|
-
},
|
|
3564
|
-
onSuccess: onSuccess,
|
|
3565
|
-
onError: onFail,
|
|
3566
|
-
});
|
|
3567
|
-
// Handlers
|
|
3568
|
-
var handleCheckout = function (_a) {
|
|
3569
|
-
var pluginPaymentResponse = _a.pluginPaymentResponse, savedPaymentMethodResponse = _a.savedPaymentMethodResponse;
|
|
3570
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
3571
|
-
var token_1, plugin, savePaymentMethod, metadata, paymentMethodId;
|
|
3572
|
-
return __generator(this, function (_b) {
|
|
3573
|
-
if (pluginPaymentResponse) {
|
|
3574
|
-
token_1 = pluginPaymentResponse.token, plugin = pluginPaymentResponse.plugin, savePaymentMethod = pluginPaymentResponse.savePaymentMethod, metadata = pluginPaymentResponse.metadata;
|
|
3575
|
-
checkoutMutation.mutate({
|
|
3576
|
-
pluginPaymentMethod: {
|
|
3577
|
-
savePaymentMethod: savePaymentMethod,
|
|
3578
|
-
plugin: plugin,
|
|
3579
|
-
metadata: metadata,
|
|
3580
|
-
token: token_1,
|
|
3581
|
-
},
|
|
3582
|
-
});
|
|
3583
|
-
}
|
|
3584
|
-
else if (savedPaymentMethodResponse) {
|
|
3585
|
-
paymentMethodId = savedPaymentMethodResponse.paymentMethodId;
|
|
3586
|
-
checkoutMutation.mutate({
|
|
3587
|
-
storedPaymentMethod: {
|
|
3588
|
-
paymentMethodId: paymentMethodId,
|
|
3589
|
-
},
|
|
3590
|
-
});
|
|
3591
|
-
}
|
|
3592
|
-
else {
|
|
3593
|
-
checkoutMutation.mutate({});
|
|
3594
|
-
}
|
|
3595
|
-
return [2 /*return*/];
|
|
3596
|
-
});
|
|
3597
|
-
});
|
|
3598
|
-
};
|
|
3599
|
-
if (taxationRequiredAccountFields)
|
|
3600
|
-
return (jsxRuntime.jsx(PaymentFormWrapper, __assign({ setMaxHeight: false }, { children: jsxRuntime.jsx(TaxationForm, { account: account, quote: quote }) })));
|
|
3601
|
-
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: paymentRequired ? (jsxRuntime.jsx(PaymentForm, { isSaving: isSaving, onFail: onFail, onPaymentSuccess: handleCheckout, quote: quote, setIsSaving: setIsSaving })) : (jsxRuntime.jsx(PaymentFormWrapper, __assign({ setMaxHeight: false }, { children: jsxRuntime.jsxs("div", __assign({ className: "flex flex-col gap-2 ".concat(isMobile ? "shadow-padding-x" : "") }, { children: [jsxRuntime.jsx(antd.Button, __assign({ disabled: isSaving, onClick: function () {
|
|
3602
|
-
setIsSaving(true);
|
|
3603
|
-
handleCheckout({});
|
|
3604
|
-
}, type: "primary" }, { children: isSaving ? "Processing..." : "Complete order" })), jsxRuntime.jsx("div", __assign({ className: "text-xs text-slate-500" }, { children: "No payment is required" }))] })) }))) }));
|
|
3475
|
+
var isClickable = transaction.kind === "INVOICE" || downloadTransactionLink !== undefined;
|
|
3476
|
+
var downloadLink = downloadTransactionLink
|
|
3477
|
+
? downloadTransactionLink(transaction.transactionableId)
|
|
3478
|
+
: "".concat(subdomain, "/api/pdf/invoice/").concat(transaction.transactionableId);
|
|
3479
|
+
if (!isClickable)
|
|
3480
|
+
return null;
|
|
3481
|
+
return (jsxRuntime.jsx("div", __assign({ onClick: function (e) {
|
|
3482
|
+
e.stopPropagation();
|
|
3483
|
+
downloadFile(downloadLink, token);
|
|
3484
|
+
} }, { children: jsxRuntime.jsx(ArrowDownToLine, { className: "".concat(isMobile ? "" : "show-on-hover"), color: darkMode ? common.WHITE : common.SLATE_600 }) })));
|
|
3605
3485
|
};
|
|
3606
3486
|
|
|
3607
|
-
var
|
|
3608
|
-
|
|
3609
|
-
var
|
|
3610
|
-
|
|
3611
|
-
token: token,
|
|
3612
|
-
}).data;
|
|
3613
|
-
return Boolean(plugins === null || plugins === void 0 ? void 0 : plugins.some(function (plugin) { return plugin.type === "taxation"; }));
|
|
3487
|
+
var Text$9 = antd.Typography.Text;
|
|
3488
|
+
var TransactionsEmptyState = function () {
|
|
3489
|
+
var noTransactionsMessage = React.useContext(TransactionsListContext).noTransactionsMessage;
|
|
3490
|
+
return (jsxRuntime.jsx(Text$9, __assign({ className: "flex justify-center p-4 text-base" }, { children: noTransactionsMessage || "There are no transactions" })));
|
|
3614
3491
|
};
|
|
3615
3492
|
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
var
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
switch (_d.label) {
|
|
3626
|
-
case 0:
|
|
3627
|
-
vars = { id: quoteId };
|
|
3628
|
-
return [4 /*yield*/, common.gqlRequest({
|
|
3629
|
-
query: QUOTE_RECALCULATE_TAXES,
|
|
3630
|
-
token: token,
|
|
3631
|
-
vars: vars,
|
|
3632
|
-
})];
|
|
3633
|
-
case 1:
|
|
3634
|
-
response = _d.sent();
|
|
3635
|
-
errors = (_b = response === null || response === void 0 ? void 0 : response.quoteRecalculateTaxes) === null || _b === void 0 ? void 0 : _b.errors;
|
|
3636
|
-
if (errors)
|
|
3637
|
-
throw errors;
|
|
3638
|
-
return [2 /*return*/, (_c = response.quoteRecalculateTaxes) === null || _c === void 0 ? void 0 : _c.quote];
|
|
3639
|
-
}
|
|
3640
|
-
});
|
|
3641
|
-
});
|
|
3493
|
+
function capitalizeFirstLetter(string) {
|
|
3494
|
+
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
3495
|
+
}
|
|
3496
|
+
var WARREN_STATE_LS_KEY = "warrenState";
|
|
3497
|
+
var CURRENT_WARREN_ID_LS_KEY = "currentWarrenId";
|
|
3498
|
+
var getIsCapacitorApp = function () {
|
|
3499
|
+
var isAndroid = window.location.origin === "http://localhost";
|
|
3500
|
+
var isIOS = window.location.protocol === "capacitor:";
|
|
3501
|
+
return isAndroid || isIOS;
|
|
3642
3502
|
};
|
|
3643
|
-
|
|
3644
|
-
var
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
return
|
|
3503
|
+
var getLocalStorageSubdomain = function () {
|
|
3504
|
+
var warrenState = JSON.parse(window.localStorage.getItem(WARREN_STATE_LS_KEY) || "{}");
|
|
3505
|
+
var subdomain = warrenState[CURRENT_WARREN_ID_LS_KEY];
|
|
3506
|
+
if (!subdomain) {
|
|
3507
|
+
console.warn("ERROR_MESSAGE_NO_SUBDOMAIN_DEFINED");
|
|
3508
|
+
//throw new Error(ERROR_MESSAGE_NO_SUBDOMAIN_DEFINED);
|
|
3509
|
+
}
|
|
3510
|
+
return subdomain;
|
|
3511
|
+
};
|
|
3512
|
+
var getApiHost = function (subdomain) {
|
|
3513
|
+
var isLocalHost = window.location.href.indexOf(".internal") > 0;
|
|
3514
|
+
var sub = subdomain || getLocalStorageSubdomain();
|
|
3515
|
+
if (getIsCapacitorApp()) {
|
|
3516
|
+
return isLocalHost || process.env.REACT_APP_IS_INTERNAL === "true"
|
|
3517
|
+
? "https://".concat(sub, ".bunny.internal")
|
|
3518
|
+
: "https://".concat(sub, ".").concat(process.env.REACT_APP_ROOT_DOMAIN);
|
|
3519
|
+
}
|
|
3520
|
+
return "";
|
|
3651
3521
|
};
|
|
3522
|
+
var getGraphQLBase = function () {
|
|
3523
|
+
if (getIsCapacitorApp()) {
|
|
3524
|
+
return "".concat(getApiHost(), "/graphql");
|
|
3525
|
+
}
|
|
3526
|
+
return "/graphql";
|
|
3527
|
+
};
|
|
3528
|
+
var createRequestHeaders = function (token) {
|
|
3529
|
+
var bearerToken = "Bearer ".concat(token);
|
|
3530
|
+
var headers = {
|
|
3531
|
+
"Content-type": "application/json; charset=utf-8",
|
|
3532
|
+
};
|
|
3533
|
+
headers["Authorization"] = bearerToken;
|
|
3534
|
+
return headers;
|
|
3535
|
+
};
|
|
3536
|
+
var useGraphQLRequest = function () { return function (query, token, variables) { return __awaiter(void 0, void 0, void 0, function () {
|
|
3537
|
+
var error_1;
|
|
3538
|
+
return __generator(this, function (_a) {
|
|
3539
|
+
switch (_a.label) {
|
|
3540
|
+
case 0:
|
|
3541
|
+
_a.trys.push([0, 2, , 3]);
|
|
3542
|
+
return [4 /*yield*/, request__default["default"](getGraphQLBase(), query, variables, createRequestHeaders(token))];
|
|
3543
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
3544
|
+
case 2:
|
|
3545
|
+
error_1 = _a.sent();
|
|
3546
|
+
throw error_1;
|
|
3547
|
+
case 3: return [2 /*return*/];
|
|
3548
|
+
}
|
|
3549
|
+
});
|
|
3550
|
+
}); }; };
|
|
3652
3551
|
|
|
3653
|
-
var
|
|
3654
|
-
var
|
|
3655
|
-
var
|
|
3656
|
-
var
|
|
3657
|
-
var
|
|
3658
|
-
var
|
|
3659
|
-
var
|
|
3660
|
-
var
|
|
3661
|
-
var
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
enabled: Boolean(quote === null || quote === void 0 ? void 0 : quote.accountId) &&
|
|
3675
|
-
((taxationRequiredAccountFields === null || taxationRequiredAccountFields === void 0 ? void 0 : taxationRequiredAccountFields.length) || 0) > 0,
|
|
3676
|
-
}), account = _f.data, isLoadingAccount = _f.isLoading;
|
|
3677
|
-
reactQuery.useQuery({
|
|
3678
|
-
queryKey: queryKeyFactory.createQuoteTaxCalculateKey(quote === null || quote === void 0 ? void 0 : quote.id),
|
|
3679
|
-
queryFn: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
3680
|
-
var updatedQuote;
|
|
3681
|
-
return __generator(this, function (_a) {
|
|
3682
|
-
switch (_a.label) {
|
|
3683
|
-
case 0:
|
|
3684
|
-
if (!quote) return [3 /*break*/, 2];
|
|
3685
|
-
return [4 /*yield*/, quoteRecalculateTaxes({
|
|
3686
|
-
quoteId: quote.id,
|
|
3687
|
-
token: token,
|
|
3688
|
-
})];
|
|
3689
|
-
case 1:
|
|
3690
|
-
updatedQuote = _a.sent();
|
|
3691
|
-
if (updatedQuote) {
|
|
3692
|
-
queryClient.setQueryData(queryKeyFactory.createObjectKey("editingQuote", updatedQuote.id), updatedQuote);
|
|
3693
|
-
queryClient.setQueryData(queryKeyFactory.calculatedPricesKey((quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.quantity) || 0, selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id), updatedQuote);
|
|
3694
|
-
}
|
|
3695
|
-
_a.label = 2;
|
|
3696
|
-
case 2: return [2 /*return*/, {}];
|
|
3697
|
-
}
|
|
3698
|
-
});
|
|
3699
|
-
}); },
|
|
3700
|
-
// Recalculate taxes if the quote is open, has a tax plugin, and the taxation required account fields are not required
|
|
3701
|
-
enabled: Boolean(quote) &&
|
|
3702
|
-
open &&
|
|
3703
|
-
hasTaxPlugin &&
|
|
3704
|
-
!taxationRequiredAccountFields &&
|
|
3705
|
-
!isLoadingTaxationRequiredAccountFields,
|
|
3706
|
-
staleTime: 0,
|
|
3552
|
+
var Text$8 = antd.Typography.Text;
|
|
3553
|
+
var TransactionsListDesktop = function (_a) {
|
|
3554
|
+
var transactions = _a.transactions, onTransactionClick = _a.onTransactionClick;
|
|
3555
|
+
var columns = React.useContext(TransactionsListContext).columns;
|
|
3556
|
+
var _b = React.useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain, darkMode = _b.darkMode;
|
|
3557
|
+
var showAmount = columns.includes("amount");
|
|
3558
|
+
var showDateAndTitle = columns.includes("date-and-title");
|
|
3559
|
+
var showDownload = columns.includes("download");
|
|
3560
|
+
var showState = columns.includes("state");
|
|
3561
|
+
if ((transactions === null || transactions === void 0 ? void 0 : transactions.length) === 0)
|
|
3562
|
+
return jsxRuntime.jsx(TransactionsEmptyState, {});
|
|
3563
|
+
return transactions === null || transactions === void 0 ? void 0 : transactions.map(function (transaction, index) {
|
|
3564
|
+
var _a;
|
|
3565
|
+
var isClickable = onTransactionClick !== undefined;
|
|
3566
|
+
return (jsxRuntime.jsxs("div", __assign({ className: "contents ".concat(isClickable && "cursor-pointer", " show-on-hover-container"), onClick: function () {
|
|
3567
|
+
onTransactionClick === null || onTransactionClick === void 0 ? void 0 : onTransactionClick(transaction);
|
|
3568
|
+
}, style: {
|
|
3569
|
+
backgroundColor: index % 2 === 0
|
|
3570
|
+
? "var(--row-background".concat(darkMode ? "-dark" : "", ")")
|
|
3571
|
+
: "var(--row-background-alternate".concat(darkMode ? "-dark" : "", ")"),
|
|
3572
|
+
} }, { children: [showDateAndTitle && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(TransactionGridCell, __assign({ right: false }, { children: jsxRuntime.jsx(TransactionDate, { date: transaction.createdAt }) })), jsxRuntime.jsxs(TransactionGridCell, __assign({ right: false, className: "flex items-center gap-2" }, { children: [jsxRuntime.jsx(Text$8, { children: capitalizeFirstLetter(transaction.kind.toLowerCase()) }), jsxRuntime.jsx(TransactionRowTitle, { transaction: transaction })] }))] })), showDownload && (jsxRuntime.jsx(TransactionGridCell, { children: jsxRuntime.jsx(TransactionDownload, { transaction: transaction, token: token, subdomain: subdomain }) })), showState && (jsxRuntime.jsx(TransactionGridCell, __assign({ right: true }, { children: jsxRuntime.jsx(StateTag, { state: transaction.state }) }))), showAmount && (jsxRuntime.jsx(TransactionGridCell, __assign({ right: true }, { children: jsxRuntime.jsx(Text$8, { children: common.Misc.formatCurrency(((_a = transaction === null || transaction === void 0 ? void 0 : transaction.transactionable) === null || _a === void 0 ? void 0 : _a.amount) || transaction.amount, transaction.currencyId) }) })))] }), index));
|
|
3707
3573
|
});
|
|
3708
|
-
if (!open || isLoadingTaxationRequiredAccountFields || isLoadingAccount)
|
|
3709
|
-
return null;
|
|
3710
|
-
return (jsxRuntime.jsx("div", __assign({ className: "flex flex-col fixed top-0 left-0 right-0 bottom-0 bg-slate-50 overflow-auto", style: {
|
|
3711
|
-
zIndex: 1001,
|
|
3712
|
-
} }, { children: jsxRuntime.jsxs("div", __assign({ className: pageWrapperClassName(isMobile) }, { children: [jsxRuntime.jsx("div", __assign({ className: "flex justify-end w-full" }, { children: jsxRuntime.jsx(CloseOutlined$1, { className: "text-base shadow-padding-xb", onClick: onCancel }) })), jsxRuntime.jsxs("div", __assign({ className: "flex justify-end gap-6 pt-4 ".concat(isMobile ? "flex-col" : "shadow-padding-xb") }, { children: [((invoice === null || invoice === void 0 ? void 0 : invoice.html) || ((_b = quote === null || quote === void 0 ? void 0 : quote.formattedQuote) === null || _b === void 0 ? void 0 : _b.html)) && (jsxRuntime.jsx(InvoiceQuoteView, { html: invoice ? invoice.html : quote ? quote.formattedQuote.html : "", isMobile: isMobile })), !isMobile && ((invoice === null || invoice === void 0 ? void 0 : invoice.html) || ((_c = quote === null || quote === void 0 ? void 0 : quote.formattedQuote) === null || _c === void 0 ? void 0 : _c.html)) && (jsxRuntime.jsx(antd.Divider, { className: "h-full", type: "vertical" })), invoice ? (jsxRuntime.jsx(InvoiceCheckout, { invoice: invoice, isSaving: isSaving, onFail: function (error) {
|
|
3713
|
-
onFail(error);
|
|
3714
|
-
setIsSaving(false);
|
|
3715
|
-
}, onSuccess: function (_a) {
|
|
3716
|
-
var savePaymentMethod = _a.savePaymentMethod;
|
|
3717
|
-
onSuccess({ savePaymentMethod: savePaymentMethod });
|
|
3718
|
-
setIsSaving(false);
|
|
3719
|
-
}, setIsSaving: setIsSaving })) : quote ? (jsxRuntime.jsx(QuoteCheckout, { account: account, isSaving: isSaving, onFail: function (error) {
|
|
3720
|
-
onFail(error);
|
|
3721
|
-
setIsSaving(false);
|
|
3722
|
-
}, onSuccess: function (_a) {
|
|
3723
|
-
var savePaymentMethod = _a.savePaymentMethod;
|
|
3724
|
-
onSuccess({ savePaymentMethod: savePaymentMethod });
|
|
3725
|
-
setIsSaving(false);
|
|
3726
|
-
}, quote: quote, setIsSaving: setIsSaving, taxationRequiredAccountFields: taxationRequiredAccountFields, token: token, storedPaymentMethod: storedPaymentMethod })) : (jsxRuntime.jsx(PaymentForm, { isSaving: isSaving, onFail: function (error) {
|
|
3727
|
-
onFail(error);
|
|
3728
|
-
setIsSaving(false);
|
|
3729
|
-
}, onPaymentSuccess: function (_a) {
|
|
3730
|
-
var pluginPaymentResponse = _a.pluginPaymentResponse;
|
|
3731
|
-
onSuccess({
|
|
3732
|
-
savePaymentMethod: pluginPaymentResponse === null || pluginPaymentResponse === void 0 ? void 0 : pluginPaymentResponse.savePaymentMethod,
|
|
3733
|
-
});
|
|
3734
|
-
setIsSaving(false);
|
|
3735
|
-
}, setIsSaving: setIsSaving }))] }))] })) })));
|
|
3736
3574
|
};
|
|
3737
3575
|
|
|
3738
|
-
var
|
|
3739
|
-
var
|
|
3740
|
-
var
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
token: token,
|
|
3759
|
-
vars: vars,
|
|
3760
|
-
subdomain: subdomain,
|
|
3761
|
-
})];
|
|
3762
|
-
case 1:
|
|
3763
|
-
response = _c.sent();
|
|
3764
|
-
errors = (_b = response === null || response === void 0 ? void 0 : response.accountSignup) === null || _b === void 0 ? void 0 : _b.errors;
|
|
3765
|
-
if (errors)
|
|
3766
|
-
throw errors;
|
|
3767
|
-
return [2 /*return*/, response === null || response === void 0 ? void 0 : response.accountSignup];
|
|
3768
|
-
}
|
|
3769
|
-
});
|
|
3576
|
+
var Text$7 = antd.Typography.Text;
|
|
3577
|
+
var TransactionsListMobile = function (_a) {
|
|
3578
|
+
var transactions = _a.transactions, onTransactionClick = _a.onTransactionClick;
|
|
3579
|
+
var columns = React.useContext(TransactionsListContext).columns;
|
|
3580
|
+
var _b = React.useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain, darkMode = _b.darkMode;
|
|
3581
|
+
var showAmount = columns.includes("amount");
|
|
3582
|
+
var showDateAndTitle = columns.includes("date-and-title");
|
|
3583
|
+
var showDownload = columns.includes("download");
|
|
3584
|
+
var showState = columns.includes("state");
|
|
3585
|
+
if ((transactions === null || transactions === void 0 ? void 0 : transactions.length) === 0)
|
|
3586
|
+
return jsxRuntime.jsx(TransactionsEmptyState, {});
|
|
3587
|
+
return transactions === null || transactions === void 0 ? void 0 : transactions.map(function (transaction, index) {
|
|
3588
|
+
var isClickable = transaction.kind === "INVOICE";
|
|
3589
|
+
return (jsxRuntime.jsxs("div", __assign({ className: "contents ".concat(isClickable && "cursor-pointer", " show-on-hover-container"), onClick: function () {
|
|
3590
|
+
onTransactionClick(transaction);
|
|
3591
|
+
}, style: {
|
|
3592
|
+
backgroundColor: index % 2 === 0
|
|
3593
|
+
? "var(--row-background".concat(darkMode ? "-dark" : "", ")")
|
|
3594
|
+
: "var(--row-background-alternate".concat(darkMode ? "-dark" : "", ")"),
|
|
3595
|
+
} }, { children: [jsxRuntime.jsx(TransactionGridCell, { children: jsxRuntime.jsxs("div", __assign({ className: "flex flex-col gap-2" }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex items-center gap-2" }, { children: [showDateAndTitle && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Text$7, { children: capitalizeFirstLetter(transaction.kind.toLowerCase()) }), jsxRuntime.jsx(TransactionRowTitle, { transaction: transaction })] })), showState && jsxRuntime.jsx(StateTag, { state: transaction.state })] })), jsxRuntime.jsxs("div", __assign({ className: "flex items-center gap-2" }, { children: [showDateAndTitle && (jsxRuntime.jsx(TransactionDate, { date: transaction.createdAt })), showAmount && showDateAndTitle && jsxRuntime.jsx(Text$7, { children: "\u00B7" }), showAmount && (jsxRuntime.jsx(Text$7, { children: common.Misc.formatCurrency(transaction.transactionable.amount || transaction.amount, transaction.currencyId) }))] }))] })) }), showDownload && (jsxRuntime.jsx(TransactionGridCell, __assign({ right: true }, { children: jsxRuntime.jsx(TransactionDownload, { transaction: transaction, token: token, subdomain: subdomain }) })))] }), index));
|
|
3770
3596
|
});
|
|
3771
3597
|
};
|
|
3772
3598
|
|
|
3773
|
-
|
|
3774
|
-
var
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3599
|
+
// Create a client
|
|
3600
|
+
var queryClient = new reactQuery.QueryClient();
|
|
3601
|
+
function Transactions(_a) {
|
|
3602
|
+
var transactionComponent = _a.transactionComponent, _b = _a.showSearchBar, showSearchBar = _b === void 0 ? true : _b, _c = _a.showTitle, showTitle = _c === void 0 ? true : _c, _d = _a.columns, columns = _d === void 0 ? ["date-and-title", "state", "amount"] : _d, className = _a.className, _e = _a.shadow, shadow = _e === void 0 ? "md" : _e, searchBarClassName = _a.searchBarClassName, _f = _a.useModal, useModal = _f === void 0 ? false : _f, onTransactionClick = _a.onTransactionClick, _g = _a.suppressTransactionDisplay, suppressTransactionDisplay = _g === void 0 ? false : _g, _h = _a.kindsToShow, kindsToShow = _h === void 0 ? [
|
|
3603
|
+
common.TransactionKind.INVOICE,
|
|
3604
|
+
common.TransactionKind.PAYMENT,
|
|
3605
|
+
common.TransactionKind.REFUND,
|
|
3606
|
+
common.TransactionKind.WRITE_OFF,
|
|
3607
|
+
] : _h, style = _a.style, filter = _a.filter, noTransactionsMessage = _a.noTransactionsMessage;
|
|
3608
|
+
var contextValues = {
|
|
3609
|
+
showSearchBar: showSearchBar,
|
|
3610
|
+
showTitle: showTitle,
|
|
3611
|
+
transactionComponent: transactionComponent,
|
|
3612
|
+
columns: columns,
|
|
3613
|
+
className: className,
|
|
3614
|
+
searchBarClassName: searchBarClassName,
|
|
3615
|
+
shadow: shadow,
|
|
3616
|
+
useModal: useModal,
|
|
3617
|
+
onTransactionClick: onTransactionClick,
|
|
3618
|
+
suppressTransactionDisplay: suppressTransactionDisplay,
|
|
3619
|
+
kindsToShow: kindsToShow,
|
|
3620
|
+
style: style,
|
|
3621
|
+
filter: filter,
|
|
3622
|
+
noTransactionsMessage: noTransactionsMessage,
|
|
3623
|
+
};
|
|
3624
|
+
return (jsxRuntime.jsx(reactQuery.QueryClientProvider, __assign({ client: queryClient }, { children: jsxRuntime.jsx(TransactionsListContext.Provider, __assign({ value: contextValues }, { children: jsxRuntime.jsx(TransactionsWrapper, {}) })) })));
|
|
3625
|
+
}
|
|
3626
|
+
function TransactionsWrapper() {
|
|
3627
|
+
var _a = React.useContext(TransactionsListContext), kindsToShow = _a.kindsToShow, filterFromContext = _a.filter;
|
|
3628
|
+
var _b = React.useContext(BunnyContext), token = _b.token, subdomain = _b.subdomain;
|
|
3629
|
+
// Local state
|
|
3630
|
+
var _c = React.useState(""), search = _c[0], setSearch = _c[1];
|
|
3631
|
+
var filter = filterFromContext ||
|
|
3632
|
+
(search ? "filter: \"transaction.transactionableId is ".concat(search, "\"") : "");
|
|
3633
|
+
// Queries
|
|
3634
|
+
var data = reactQuery.useQuery({
|
|
3635
|
+
queryKey: ["transactions", token, filter],
|
|
3636
|
+
queryFn: function () { return getTransactions(filter, token, subdomain, kindsToShow); },
|
|
3637
|
+
placeholderData: reactQuery.keepPreviousData,
|
|
3638
|
+
}).data;
|
|
3639
|
+
return (jsxRuntime.jsx(TransactionsDisplay, { transactions: data, onSearchValueChanged: setSearch, search: search }));
|
|
3640
|
+
}
|
|
3641
|
+
function TransactionsDisplay(_a) {
|
|
3642
|
+
var transactions = _a.transactions, onSearchValueChanged = _a.onSearchValueChanged, search = _a.search, title = _a.title;
|
|
3643
|
+
var _b = React.useContext(TransactionsListContext), showSearchBar = _b.showSearchBar, showTitle = _b.showTitle, transactionComponent = _b.transactionComponent, useModal = _b.useModal, suppressTransactionDisplay = _b.suppressTransactionDisplay, className = _b.className, shadow = _b.shadow, searchBarClassName = _b.searchBarClassName, style = _b.style, onTransactionClick = _b.onTransactionClick;
|
|
3644
|
+
var columns = React.useContext(TransactionsListContext).columns;
|
|
3645
|
+
var darkMode = React.useContext(BunnyContext).darkMode;
|
|
3646
|
+
// Local state
|
|
3647
|
+
var _c = React.useState(null), selectedTransaction = _c[0], setSelectedTransaction = _c[1];
|
|
3648
|
+
var _d = React.useState(false), drawerOpen = _d[0], setDrawerOpen = _d[1];
|
|
3649
|
+
// Hooks
|
|
3650
|
+
var isMobile = common.useIsMobile();
|
|
3651
|
+
function handleTransactionClick(transaction) {
|
|
3652
|
+
if (onTransactionClick) {
|
|
3653
|
+
onTransactionClick(transaction);
|
|
3654
|
+
}
|
|
3655
|
+
if (!suppressTransactionDisplay) {
|
|
3656
|
+
setSelectedTransaction(transaction);
|
|
3657
|
+
setDrawerOpen(true);
|
|
3658
|
+
}
|
|
3659
|
+
}
|
|
3660
|
+
// Since the columns are dynamic, we need to calculate the grid template columns
|
|
3661
|
+
var gridTemplateColumns = function () {
|
|
3662
|
+
var templateColumns = [];
|
|
3663
|
+
if (isMobile) {
|
|
3664
|
+
if (columns.includes("date-and-title") ||
|
|
3665
|
+
columns.includes("state") ||
|
|
3666
|
+
columns.includes("amount")) {
|
|
3667
|
+
templateColumns.push("auto");
|
|
3800
3668
|
}
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
};
|
|
3804
|
-
|
|
3805
|
-
var MUTATION$2 = function () { return "\nquery PriceList($code: String!) {\n priceList (code: $code) {\n basePrice\n code\n createdAt\n currencyId\n id\n isVisible\n name\n periodMonths\n planId\n priceDescription\n productId\n sku\n trialAllowed\n trialLengthDays\n updatedAt\n }\n}"; };
|
|
3806
|
-
var getPriceList = function (_a) {
|
|
3807
|
-
var token = _a.token, code = _a.code, subdomain = _a.subdomain;
|
|
3808
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
3809
|
-
var response;
|
|
3810
|
-
return __generator(this, function (_b) {
|
|
3811
|
-
switch (_b.label) {
|
|
3812
|
-
case 0: return [4 /*yield*/, common.gqlRequest({
|
|
3813
|
-
query: MUTATION$2(),
|
|
3814
|
-
token: token,
|
|
3815
|
-
vars: { code: code },
|
|
3816
|
-
subdomain: subdomain,
|
|
3817
|
-
})];
|
|
3818
|
-
case 1:
|
|
3819
|
-
response = _b.sent();
|
|
3820
|
-
return [2 /*return*/, response === null || response === void 0 ? void 0 : response.priceList];
|
|
3669
|
+
if (columns.includes("download")) {
|
|
3670
|
+
templateColumns.push("auto");
|
|
3821
3671
|
}
|
|
3822
|
-
}
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
}
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
var handleInputChange = function (e) {
|
|
3839
|
-
var _a;
|
|
3840
|
-
var _b = e.target, name = _b.name, value = _b.value;
|
|
3841
|
-
setFormData(__assign(__assign({}, formData), (_a = {}, _a[name] = value, _a)));
|
|
3672
|
+
}
|
|
3673
|
+
else {
|
|
3674
|
+
if (columns.includes("date-and-title")) {
|
|
3675
|
+
templateColumns.push("auto 3fr");
|
|
3676
|
+
}
|
|
3677
|
+
if (columns.includes("download")) {
|
|
3678
|
+
templateColumns.push("auto");
|
|
3679
|
+
}
|
|
3680
|
+
if (columns.includes("state")) {
|
|
3681
|
+
templateColumns.push("auto");
|
|
3682
|
+
}
|
|
3683
|
+
if (columns.includes("amount")) {
|
|
3684
|
+
templateColumns.push("auto");
|
|
3685
|
+
}
|
|
3686
|
+
}
|
|
3687
|
+
return templateColumns.join(" ");
|
|
3842
3688
|
};
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3689
|
+
var drawerTitle = function () {
|
|
3690
|
+
if (!selectedTransaction)
|
|
3691
|
+
return "";
|
|
3692
|
+
var kind = selectedTransaction.kind.toLowerCase();
|
|
3693
|
+
return kind.charAt(0).toUpperCase() + kind.slice(1);
|
|
3694
|
+
};
|
|
3695
|
+
return (jsxRuntime.jsxs("div", __assign({ style: style }, { children: [jsxRuntime.jsx(PageHeaderWithActions, __assign({ title: title || (showTitle ? "Past transactions" : undefined) }, { children: showSearchBar && (jsxRuntime.jsx("div", { children: jsxRuntime.jsx(antd.Input, { className: searchBarClassName
|
|
3696
|
+
? searchBarClassName
|
|
3697
|
+
: "border border-slate-200", onChange: function (e) {
|
|
3698
|
+
if (isNaN(Number(e.target.value))) {
|
|
3699
|
+
return;
|
|
3700
|
+
}
|
|
3701
|
+
onSearchValueChanged(e.target.value);
|
|
3702
|
+
}, prefix: jsxRuntime.jsx(SearchOutlined$1, {}), placeholder: "Search by id #", style: {
|
|
3703
|
+
minWidth: "300px",
|
|
3704
|
+
}, value: search }) })) })), jsxRuntime.jsx(PageContent, __assign({ className: "flex w-full shadow-padding-xb ".concat(isMobile ? "overflow-hidden" : "", " ").concat(className) }, { children: jsxRuntime.jsx("div", __assign({ className: "grid w-full rounded-md overflow-auto ".concat("shadow-".concat(shadow)), style: {
|
|
3705
|
+
gridTemplateColumns: gridTemplateColumns(),
|
|
3706
|
+
backgroundColor: "var(--row-background".concat(darkMode ? "-dark" : "", ")"),
|
|
3707
|
+
} }, { children: isMobile ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: TransactionsListMobile({
|
|
3708
|
+
transactions: transactions,
|
|
3709
|
+
onTransactionClick: handleTransactionClick,
|
|
3710
|
+
}) })) : (jsxRuntime.jsx(jsxRuntime.Fragment, { children: TransactionsListDesktop({
|
|
3711
|
+
transactions: transactions,
|
|
3712
|
+
onTransactionClick: handleTransactionClick,
|
|
3713
|
+
}) })) })) })), useModal ? (jsxRuntime.jsx(antd.Modal, __assign({ title: "Basic Modal", open: drawerOpen, onOk: function () { return setDrawerOpen(false); }, onCancel: function () { return setDrawerOpen(false); }, width: 900, footer: null }, { children: jsxRuntime.jsx(Invoice, { id: (selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.transactionableId) || "" }) }))) : (jsxRuntime.jsx(antd.Drawer, __assign({ title: drawerTitle(), onClose: function () { return setDrawerOpen(false); }, open: drawerOpen, width: 900 }, { children: transactionComponent ? (transactionComponent) : (selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.kind) === "INVOICE" ? (jsxRuntime.jsx(Invoice, { id: selectedTransaction.transactionableId })) : (jsxRuntime.jsxs(antd.Card, __assign({ className: "shadow-md" }, { children: [jsxRuntime.jsx(antd.Typography.Title, __assign({ level: 2, className: "mb-4" }, { children: "Transaction Details" })), jsxRuntime.jsxs(antd.Typography.Paragraph, { children: [jsxRuntime.jsx("strong", { children: "Amount:" }), " ", jsxRuntime.jsx(antd.Typography.Text, { children: common.Misc.formatCurrency((selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.amount) || 0, (selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.currencyId) || "USD") })] }), jsxRuntime.jsxs(antd.Typography.Paragraph, { children: [jsxRuntime.jsx("strong", { children: "Description:" }), " ", jsxRuntime.jsx(antd.Typography.Text, { children: selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.description })] }), jsxRuntime.jsxs(antd.Typography.Paragraph, { children: [jsxRuntime.jsx("strong", { children: "Kind:" }), " ", jsxRuntime.jsx(antd.Typography.Text, { children: selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.kind })] }), jsxRuntime.jsxs(antd.Typography.Paragraph, { children: [jsxRuntime.jsx("strong", { children: "State:" }), " ", jsxRuntime.jsx(antd.Typography.Text, { children: selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.state })] })] }))) })))] })));
|
|
3861
3714
|
}
|
|
3862
3715
|
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
var
|
|
3866
|
-
var
|
|
3867
|
-
var
|
|
3868
|
-
|
|
3716
|
+
function Quotes(_a) {
|
|
3717
|
+
var filter = _a.filter, quoteComponent = _a.quoteComponent, _b = _a.showSearchBar, showSearchBar = _b === void 0 ? true : _b, _c = _a.showTitle, showTitle = _c === void 0 ? true : _c, _d = _a.columns, columns = _d === void 0 ? ["date-and-title", "amount", "download"] : _d, className = _a.className, _e = _a.shadow, shadow = _e === void 0 ? "md" : _e, searchBarClassName = _a.searchBarClassName, _f = _a.useModal, useModal = _f === void 0 ? false : _f; _a.onQuoteClick; var _g = _a.suppressQuoteDisplay, suppressQuoteDisplay = _g === void 0 ? false : _g, style = _a.style, _h = _a.noQuotesMessage, noQuotesMessage = _h === void 0 ? "There are no quotes" : _h;
|
|
3718
|
+
var subdomain = React.useContext(BunnyContext).subdomain;
|
|
3719
|
+
var _j = React.useState(null), component = _j[0], setComponent = _j[1];
|
|
3720
|
+
var contextValues = {
|
|
3721
|
+
columns: columns,
|
|
3722
|
+
kindsToShow: [],
|
|
3723
|
+
onTransactionClick: handleQuoteClick,
|
|
3724
|
+
transactionComponent: component,
|
|
3725
|
+
showSearchBar: showSearchBar,
|
|
3726
|
+
showTitle: showTitle,
|
|
3727
|
+
className: className,
|
|
3728
|
+
shadow: shadow,
|
|
3729
|
+
searchBarClassName: searchBarClassName,
|
|
3730
|
+
useModal: useModal,
|
|
3731
|
+
suppressTransactionDisplay: suppressQuoteDisplay,
|
|
3732
|
+
style: style,
|
|
3733
|
+
noTransactionsMessage: noQuotesMessage,
|
|
3734
|
+
filter: filter,
|
|
3735
|
+
downloadTransactionLink: function (id) { return "".concat(subdomain, "/api/pdf/quote/").concat(id); },
|
|
3736
|
+
};
|
|
3737
|
+
function handleQuoteClick(quote) {
|
|
3738
|
+
if (quoteComponent) {
|
|
3739
|
+
setComponent(quoteComponent);
|
|
3740
|
+
}
|
|
3741
|
+
else {
|
|
3742
|
+
setComponent(jsxRuntime.jsx(Quote, { id: quote === null || quote === void 0 ? void 0 : quote.transactionableId }));
|
|
3743
|
+
}
|
|
3744
|
+
}
|
|
3745
|
+
return (jsxRuntime.jsx(TransactionsListContext.Provider, __assign({ value: contextValues }, { children: jsxRuntime.jsx(QuotesWrapper, {}) })));
|
|
3869
3746
|
}
|
|
3870
|
-
|
|
3871
|
-
var
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3747
|
+
function QuotesWrapper() {
|
|
3748
|
+
var _a = React.useContext(BunnyContext), token = _a.token, subdomain = _a.subdomain;
|
|
3749
|
+
var filterFromContext = React.useContext(TransactionsListContext).filter;
|
|
3750
|
+
// Local state
|
|
3751
|
+
var _b = React.useState(""), search = _b[0], setSearch = _b[1];
|
|
3752
|
+
var filter = filterFromContext || (search ? "filter: \"quote.id is ".concat(search, "\"") : "");
|
|
3753
|
+
// Queries
|
|
3754
|
+
var data = reactQuery.useQuery({
|
|
3755
|
+
queryKey: ["quotes", token, filter],
|
|
3756
|
+
queryFn: function () { return getQuotes({ token: token, subdomain: subdomain, filter: filter }); },
|
|
3757
|
+
placeholderData: reactQuery.keepPreviousData,
|
|
3758
|
+
}).data;
|
|
3759
|
+
if (data === undefined)
|
|
3875
3760
|
return null;
|
|
3876
|
-
|
|
3761
|
+
var quotesAsTransactions = data.nodes.map(function (quote) { return ({
|
|
3762
|
+
transactionableId: quote.id,
|
|
3763
|
+
state: "unapplied",
|
|
3764
|
+
amount: quote.amount || quote.amountDue,
|
|
3765
|
+
kind: "QUOTE",
|
|
3766
|
+
currencyId: quote.currencyId,
|
|
3767
|
+
transactionable: {
|
|
3768
|
+
number: quote.number,
|
|
3769
|
+
},
|
|
3770
|
+
createdAt: quote.createdAt,
|
|
3771
|
+
}); });
|
|
3772
|
+
return (jsxRuntime.jsx(TransactionsDisplay, { transactions: quotesAsTransactions, onSearchValueChanged: setSearch, search: search, title: "Past quotes" }));
|
|
3877
3773
|
}
|
|
3878
3774
|
|
|
3879
|
-
var
|
|
3880
|
-
var
|
|
3881
|
-
return (jsxRuntime.jsxs("
|
|
3775
|
+
var DrawerHeader = function (_a) {
|
|
3776
|
+
var description = _a.description, onClose = _a.onClose, title = _a.title;
|
|
3777
|
+
return (jsxRuntime.jsxs("div", __assign({ className: "flex flex-col gap-4" }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex items-center justify-between gap-2" }, { children: [jsxRuntime.jsx("div", __assign({ className: "text-xl" }, { children: title })), jsxRuntime.jsx("button", __assign({ onClick: onClose, className: "ant-drawer-close" }, { children: jsxRuntime.jsx(CloseOutlined$1, {}) }))] })), description && jsxRuntime.jsx("div", __assign({ className: "text-xs" }, { children: description }))] })));
|
|
3882
3778
|
};
|
|
3883
3779
|
|
|
3884
|
-
var
|
|
3885
|
-
|
|
3886
|
-
var _b = common.useCurrentUserData(), privacyUrl = _b.privacyUrl, termsUrl = _b.termsUrl;
|
|
3887
|
-
var window = React.useContext(BunnyContext).window;
|
|
3888
|
-
var isMobile = useIsMobile(window);
|
|
3889
|
-
var quotePreviewData = recoil.useRecoilValue(planPickerQuoteDataState);
|
|
3890
|
-
var selectedPriceList = quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.priceList;
|
|
3891
|
-
if (selectedPriceList && isMobile)
|
|
3892
|
-
return null;
|
|
3893
|
-
return (jsxRuntime.jsxs("div", __assign({ className: "flex items-center justify-between shrink-0 ".concat(className, " ").concat(isMobile ? "flex-col gap-2 grow" : "") }, { children: [(termsUrl || privacyUrl) && (jsxRuntime.jsxs("div", __assign({ className: "flex items-center gap-3" }, { children: [termsUrl && (jsxRuntime.jsx(StyedLink, __assign({ className: "text-xs text-slate-400", href: termsUrl, rel: "noopener noreferrer", target: "_blank", type: "text" }, { children: "Terms" }))), privacyUrl && (jsxRuntime.jsx(StyedLink, __assign({ className: "text-xs text-slate-400", href: privacyUrl, rel: "noopener noreferrer", target: "_blank", type: "text" }, { children: "Privacy" })))] }))), jsxRuntime.jsx(BunnyMarketingLink, {})] })));
|
|
3894
|
-
};
|
|
3895
|
-
var BunnyMarketingLink = function () {
|
|
3896
|
-
var _a = React.useState(false), isHovered = _a[0], setIsHovered = _a[1];
|
|
3897
|
-
var window = React.useContext(BunnyContext).window;
|
|
3898
|
-
var isMobile = useIsMobile(window);
|
|
3899
|
-
return (jsxRuntime.jsx("div", __assign({ className: "flex items-end justify-end ".concat(isMobile ? "" : "grow") }, { children: jsxRuntime.jsx(StyledBunnyLink, __assign({ className: "flex items-end justify-end text-slate-400", href: "https://bunny.com/", rel: "noopener noreferrer", target: "_blank", type: "text" }, { children: jsxRuntime.jsxs("div", __assign({ className: "flex items-center", onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); } }, { children: ["Powered by\u00A0", jsxRuntime.jsx("div", __assign({ style: { paddingTop: "5px" } }, { children: jsxRuntime.jsx(BunnyFooterIcon, { color: isHovered ? common.PRIMARY_COLOR : common.SLATE_400 }) }))] })) })) })));
|
|
3780
|
+
var LargeCardIcon = function () {
|
|
3781
|
+
return (jsxRuntime.jsx("svg", __assign({ width: "72", height: "56", viewBox: "0 0 72 56", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: jsxRuntime.jsx("path", { d: "M8 0H64C68.375 0 72 3.625 72 8V12H0V8C0 3.625 3.5 0 8 0ZM72 24V48C72 52.5 68.375 56 64 56H8C3.5 56 0 52.5 0 48V24H72ZM14 40C12.875 40 12 41 12 42C12 43.125 12.875 44 14 44H22C23 44 24 43.125 24 42C24 41 23 40 22 40H14ZM28 42C28 43.125 28.875 44 30 44H46C47 44 48 43.125 48 42C48 41 47 40 46 40H30C28.875 40 28 41 28 42Z", fill: "#E2E8F0" }) })));
|
|
3900
3782
|
};
|
|
3901
|
-
var StyedLink = styled__default["default"].a(templateObject_1$4 || (templateObject_1$4 = __makeTemplateObject(["\n color: ", ";\n transition: color 0.3s;\n &:hover {\n color: ", ";\n }\n"], ["\n color: ", ";\n transition: color 0.3s;\n &:hover {\n color: ", ";\n }\n"])), common.SLATE_400, common.SLATE_500);
|
|
3902
|
-
var StyledBunnyLink = styled__default["default"](StyedLink)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n &:hover {\n color: ", " !important;\n }\n"], ["\n &:hover {\n color: ", " !important;\n }\n"])), common.PRIMARY_COLOR);
|
|
3903
|
-
var templateObject_1$4, templateObject_2;
|
|
3904
3783
|
|
|
3905
|
-
var
|
|
3906
|
-
var
|
|
3907
|
-
|
|
3908
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
3909
|
-
var response, errors;
|
|
3910
|
-
var _b;
|
|
3911
|
-
return __generator(this, function (_c) {
|
|
3912
|
-
switch (_c.label) {
|
|
3913
|
-
case 0: return [4 /*yield*/, common.gqlRequest({
|
|
3914
|
-
query: MUTATION$1,
|
|
3915
|
-
token: token,
|
|
3916
|
-
vars: { tenantCode: tenantCode, expiry: expiry, returnUrl: returnUrl },
|
|
3917
|
-
subdomain: subdomain,
|
|
3918
|
-
})];
|
|
3919
|
-
case 1:
|
|
3920
|
-
response = _c.sent();
|
|
3921
|
-
errors = (response === null || response === void 0 ? void 0 : response.portalSessionCreate).errors;
|
|
3922
|
-
if (errors)
|
|
3923
|
-
throw errors;
|
|
3924
|
-
return [2 /*return*/, (_b = response === null || response === void 0 ? void 0 : response.portalSessionCreate) === null || _b === void 0 ? void 0 : _b.token];
|
|
3925
|
-
}
|
|
3926
|
-
});
|
|
3927
|
-
});
|
|
3784
|
+
var PlusIcon = function (_a) {
|
|
3785
|
+
var color = _a.color;
|
|
3786
|
+
return (jsxRuntime.jsxs("svg", __assign({ width: "14", height: "15", viewBox: "0 0 14 15", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: [jsxRuntime.jsx("path", { d: "M2.9165 7.5H11.0832", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), jsxRuntime.jsx("path", { d: "M7 3.41663V11.5833", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })] })));
|
|
3928
3787
|
};
|
|
3929
3788
|
|
|
3930
|
-
var
|
|
3931
|
-
function Signup(_a) {
|
|
3932
|
-
var priceListCode = _a.priceListCode, returnUrl = _a.returnUrl;
|
|
3933
|
-
// Hooks
|
|
3934
|
-
var _b = React.useContext(BunnyContext), subdomain = _b.subdomain, token = _b.token, window = _b.window;
|
|
3935
|
-
reactQuery.useQuery({
|
|
3936
|
-
queryKey: common.QueryKeyFactory.default.currentUserKey,
|
|
3937
|
-
queryFn: function () { return getCurrentUserData({ token: token, subdomain: subdomain }); },
|
|
3938
|
-
});
|
|
3939
|
-
var isMobile = useIsMobile(window);
|
|
3940
|
-
var topNavImageUrl = React.useContext(BrandContext).topNavImageUrl;
|
|
3941
|
-
var entityId = common.useCurrentUserData().entityId;
|
|
3942
|
-
var _c = React.useState(undefined), quote = _c[0], setQuote = _c[1];
|
|
3943
|
-
var _d = React.useState(undefined), accountId = _d[0], setAccountId = _d[1];
|
|
3944
|
-
var _e = React.useState(undefined), quoteId = _e[0], setQuoteId = _e[1];
|
|
3945
|
-
var _f = React.useState(undefined), portalSessionToken = _f[0], setPortalSessionToken = _f[1];
|
|
3946
|
-
var _g = React.useState(undefined), formData = _g[0], setFormData = _g[1];
|
|
3947
|
-
var _h = React.useState(false), proceedingToPayment = _h[0], setProceedingToPayment = _h[1];
|
|
3948
|
-
var _j = React.useState(false), paying = _j[0], setIsPaying = _j[1];
|
|
3949
|
-
var _k = React.useState(false), purchaseSucceeded = _k[0], setPurchaseSucceeded = _k[1];
|
|
3950
|
-
// Queries
|
|
3951
|
-
var priceListData = reactQuery.useQuery({
|
|
3952
|
-
queryKey: ["priceList", priceListCode],
|
|
3953
|
-
queryFn: function () { return getPriceList({ token: token, subdomain: subdomain, code: priceListCode }); },
|
|
3954
|
-
}).data;
|
|
3955
|
-
function handleSubmit(formData) {
|
|
3956
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
3957
|
-
var data, portalSessionToken;
|
|
3958
|
-
return __generator(this, function (_a) {
|
|
3959
|
-
switch (_a.label) {
|
|
3960
|
-
case 0:
|
|
3961
|
-
setProceedingToPayment(true);
|
|
3962
|
-
setFormData(formData);
|
|
3963
|
-
return [4 /*yield*/, quoteAccountSignup({
|
|
3964
|
-
token: token,
|
|
3965
|
-
subdomain: subdomain,
|
|
3966
|
-
entityId: entityId,
|
|
3967
|
-
priceListCode: priceListCode,
|
|
3968
|
-
accountName: formData.accountName,
|
|
3969
|
-
billingContact: {
|
|
3970
|
-
firstName: formData.firstName,
|
|
3971
|
-
lastName: formData.lastName,
|
|
3972
|
-
email: formData.email,
|
|
3973
|
-
},
|
|
3974
|
-
})];
|
|
3975
|
-
case 1:
|
|
3976
|
-
data = _a.sent();
|
|
3977
|
-
setAccountId(data.account.id);
|
|
3978
|
-
return [4 /*yield*/, portalSessionCreate({
|
|
3979
|
-
token: token,
|
|
3980
|
-
subdomain: subdomain,
|
|
3981
|
-
tenantCode: data.tenant.code,
|
|
3982
|
-
expiry: 24,
|
|
3983
|
-
returnUrl: returnUrl || "",
|
|
3984
|
-
})];
|
|
3985
|
-
case 2:
|
|
3986
|
-
portalSessionToken = _a.sent();
|
|
3987
|
-
setPortalSessionToken(portalSessionToken);
|
|
3988
|
-
setQuoteId(data.quote.id);
|
|
3989
|
-
setProceedingToPayment(false);
|
|
3990
|
-
setQuote({
|
|
3991
|
-
amountDue: data.quote.amountDue,
|
|
3992
|
-
currencyId: data.quote.currencyId,
|
|
3993
|
-
});
|
|
3994
|
-
return [2 /*return*/];
|
|
3995
|
-
}
|
|
3996
|
-
});
|
|
3997
|
-
});
|
|
3998
|
-
}
|
|
3999
|
-
function handlePaymentSaveSuccess(paymentSuccess) {
|
|
4000
|
-
var _a;
|
|
4001
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
4002
|
-
var response, plugin;
|
|
4003
|
-
return __generator(this, function (_b) {
|
|
4004
|
-
switch (_b.label) {
|
|
4005
|
-
case 0:
|
|
4006
|
-
if (!formData) {
|
|
4007
|
-
throw new Error("Form data is required");
|
|
4008
|
-
}
|
|
4009
|
-
response = paymentSuccess.pluginPaymentResponse;
|
|
4010
|
-
plugin = response === null || response === void 0 ? void 0 : response.plugin;
|
|
4011
|
-
if (!(plugin === null || plugin === void 0 ? void 0 : plugin.id)) {
|
|
4012
|
-
throw new Error("Plugin ID is required");
|
|
4013
|
-
}
|
|
4014
|
-
if (!accountId) {
|
|
4015
|
-
throw new Error("Account ID is required");
|
|
4016
|
-
}
|
|
4017
|
-
if (!portalSessionToken) {
|
|
4018
|
-
throw new Error("Portal session token is required");
|
|
4019
|
-
}
|
|
4020
|
-
return [4 /*yield*/, accountSignup({
|
|
4021
|
-
token: portalSessionToken,
|
|
4022
|
-
subdomain: subdomain,
|
|
4023
|
-
entityId: entityId,
|
|
4024
|
-
quoteId: quoteId,
|
|
4025
|
-
paymentMethodId: (_a = paymentSuccess.savedPaymentMethodResponse) === null || _a === void 0 ? void 0 : _a.paymentMethodId.toString(),
|
|
4026
|
-
pluginId: plugin.id.toString(),
|
|
4027
|
-
priceListCode: priceListCode,
|
|
4028
|
-
accountId: accountId,
|
|
4029
|
-
})];
|
|
4030
|
-
case 1:
|
|
4031
|
-
_b.sent();
|
|
4032
|
-
setIsPaying(false);
|
|
4033
|
-
setPurchaseSucceeded(true);
|
|
4034
|
-
return [2 /*return*/];
|
|
4035
|
-
}
|
|
4036
|
-
});
|
|
4037
|
-
});
|
|
4038
|
-
}
|
|
4039
|
-
function handlePaymentFail(error) {
|
|
4040
|
-
showErrorNotification(error.message);
|
|
4041
|
-
setIsPaying(false);
|
|
4042
|
-
}
|
|
4043
|
-
if (isMobile) {
|
|
4044
|
-
return (jsxRuntime.jsx(Card, __assign({ className: "p-4 flex flex-col" }, { children: purchaseSucceeded ? (jsxRuntime.jsx(PaymentSuccessDisplay, { className: "w-full", amountPaid: (quote === null || quote === void 0 ? void 0 : quote.amountDue) || 0, returnUrl: returnUrl })) : (jsxRuntime.jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col" : "flex-row", " h-full w-full") }, { children: [jsxRuntime.jsx("div", __assign({ className: "flex flex-col items-center" }, { children: jsxRuntime.jsx(PriceListDisplay, { priceListData: priceListData, topNavImageUrl: topNavImageUrl }) })), jsxRuntime.jsx("div", __assign({ className: "mx-8" }, { children: jsxRuntime.jsx(antd.Divider, { className: "h-full" }) })), jsxRuntime.jsx("div", __assign({ className: "flex items-center justify-center my-12" }, { children: jsxRuntime.jsx(PaymentForms, { quote: quote, paying: paying, setIsPaying: setIsPaying, handlePaymentSaveSuccess: handlePaymentSaveSuccess, handlePaymentFail: handlePaymentFail, handleSubmit: handleSubmit, proceedingToPayment: proceedingToPayment, accountId: accountId || "" }) }))] }))) })));
|
|
4045
|
-
}
|
|
4046
|
-
else {
|
|
4047
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Card, __assign({ className: "p-4 flex flex-col w-screen h-screen" }, { children: purchaseSucceeded ? (jsxRuntime.jsx(PaymentSuccessDisplay, { className: "w-full", amountPaid: (quote === null || quote === void 0 ? void 0 : quote.amountDue) || 0, returnUrl: returnUrl })) : (jsxRuntime.jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col" : "flex-row", " h-full w-full") }, { children: [jsxRuntime.jsx("div", __assign({ className: "flex flex-col w-1/2 items-center" }, { children: jsxRuntime.jsx(PriceListDisplay, { priceListData: priceListData, topNavImageUrl: topNavImageUrl }) })), jsxRuntime.jsx("div", __assign({ className: "my-4" }, { children: jsxRuntime.jsx(antd.Divider, { className: "h-full", type: "vertical" }) })), jsxRuntime.jsx("div", __assign({ className: "flex w-1/2 items-center justify-center my-12" }, { children: jsxRuntime.jsx(PaymentForms, { quote: quote, paying: paying, setIsPaying: setIsPaying, handlePaymentSaveSuccess: handlePaymentSaveSuccess, handlePaymentFail: handlePaymentFail, handleSubmit: handleSubmit, proceedingToPayment: proceedingToPayment, accountId: accountId || "" }) }))] }))) })), jsxRuntime.jsx(Footer, {})] }));
|
|
4048
|
-
}
|
|
4049
|
-
}
|
|
4050
|
-
|
|
4051
|
-
var transactionMutation = function (filter) { return "\nquery transactions {\n transactions ".concat(filter ? "(".concat(filter, ")") : "", " {\n nodes {\n amount\n createdAt\n currencyId\n description\n id\n kind\n state\n transactionableId\n transactionable {\n ...on Payment { amount }\n ...on Invoice { amount number }\n }\n }\n }\n}"); };
|
|
4052
|
-
var getTransactions = function (filter, token, subdomain, kindsToShow) { return __awaiter(void 0, void 0, void 0, function () {
|
|
4053
|
-
var response, _a, data, errors, transactions;
|
|
4054
|
-
var _b, _c;
|
|
4055
|
-
return __generator(this, function (_d) {
|
|
4056
|
-
switch (_d.label) {
|
|
4057
|
-
case 0: return [4 /*yield*/, fetch(subdomain + "/graphql", {
|
|
4058
|
-
method: "POST",
|
|
4059
|
-
headers: {
|
|
4060
|
-
"Content-type": "application/json; charset=utf-8",
|
|
4061
|
-
Authorization: "Bearer ".concat(token),
|
|
4062
|
-
},
|
|
4063
|
-
body: JSON.stringify({
|
|
4064
|
-
query: transactionMutation(filter),
|
|
4065
|
-
}),
|
|
4066
|
-
})];
|
|
4067
|
-
case 1:
|
|
4068
|
-
response = _d.sent();
|
|
4069
|
-
return [4 /*yield*/, response.json()];
|
|
4070
|
-
case 2:
|
|
4071
|
-
_a = _d.sent(), data = _a.data, errors = _a.errors;
|
|
4072
|
-
if (errors) {
|
|
4073
|
-
throw new Error(errors[0].message);
|
|
4074
|
-
}
|
|
4075
|
-
transactions = (_c = (_b = data === null || data === void 0 ? void 0 : data.transactions) === null || _b === void 0 ? void 0 : _b.nodes) === null || _c === void 0 ? void 0 : _c.filter(function (transaction) { return kindsToShow.includes(transaction.kind); });
|
|
4076
|
-
return [2 /*return*/, transactions === null || transactions === void 0 ? void 0 : transactions.reverse()];
|
|
4077
|
-
}
|
|
4078
|
-
});
|
|
4079
|
-
}); };
|
|
4080
|
-
|
|
4081
|
-
var pageContentRefState = recoil.atom({
|
|
4082
|
-
key: "pageContentRefState",
|
|
4083
|
-
default: undefined,
|
|
4084
|
-
});
|
|
3789
|
+
var PaymentMethodContext = React.createContext({});
|
|
4085
3790
|
|
|
4086
|
-
var
|
|
3791
|
+
var Card = function (_a) {
|
|
4087
3792
|
var children = _a.children, className = _a.className, style = _a.style;
|
|
4088
|
-
var pageContentRef = React.useRef(null);
|
|
4089
|
-
var setPageContentRef = recoil.useSetRecoilState(pageContentRefState);
|
|
4090
|
-
React.useEffect(function () {
|
|
4091
|
-
setPageContentRef(pageContentRef === null || pageContentRef === void 0 ? void 0 : pageContentRef.current);
|
|
4092
|
-
}, [pageContentRef, setPageContentRef]);
|
|
4093
|
-
return (jsxRuntime.jsx("div", __assign({ className: className, ref: pageContentRef, style: style }, { children: children })));
|
|
4094
|
-
};
|
|
4095
|
-
|
|
4096
|
-
var Text$8 = antd.Typography.Text;
|
|
4097
|
-
var PageHeaderWithActions = function (_a) {
|
|
4098
|
-
var children = _a.children, title = _a.title;
|
|
4099
|
-
var isMobile = common.useIsMobile();
|
|
4100
|
-
return (jsxRuntime.jsxs("div", __assign({ className: "flex pb-4 shadow-padding-x ".concat(isMobile ? "flex-col gap-2" : "items-center justify-between h-8") }, { children: [jsxRuntime.jsx(PageSubTitle, { title: title }), children] })));
|
|
4101
|
-
};
|
|
4102
|
-
var PageSubTitle = function (_a) {
|
|
4103
|
-
var title = _a.title;
|
|
4104
|
-
var secondaryColor = React.useContext(BrandContext).secondaryColor;
|
|
4105
3793
|
var darkMode = React.useContext(BunnyContext).darkMode;
|
|
4106
|
-
return (jsxRuntime.jsx(
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
var StateTag = function (_a) {
|
|
4110
|
-
var state = _a.state;
|
|
4111
|
-
return jsxRuntime.jsx(antd.Tag, __assign({ color: getColor(state) }, { children: lodash.capitalize(lodash.startCase(state)) }));
|
|
4112
|
-
};
|
|
4113
|
-
var getColor = function (state) {
|
|
4114
|
-
switch (state) {
|
|
4115
|
-
case common.FrontendTransaction.TransactionState.not_due:
|
|
4116
|
-
return "yellow";
|
|
4117
|
-
case common.FrontendTransaction.TransactionState.voided:
|
|
4118
|
-
return "black";
|
|
4119
|
-
case common.FrontendTransaction.TransactionState.ready:
|
|
4120
|
-
return "orange";
|
|
4121
|
-
case common.FrontendTransaction.TransactionState.preparing:
|
|
4122
|
-
return "purple";
|
|
4123
|
-
case common.FrontendTransaction.TransactionState.unapplied:
|
|
4124
|
-
case common.FrontendTransaction.TransactionState.partially_applied:
|
|
4125
|
-
case common.FrontendTransaction.TransactionState.applied:
|
|
4126
|
-
return "blue";
|
|
4127
|
-
case common.FrontendTransaction.TransactionState.due:
|
|
4128
|
-
case common.FrontendTransaction.TransactionState.unpaid:
|
|
4129
|
-
return "orange";
|
|
4130
|
-
case common.FrontendTransaction.TransactionState.failed:
|
|
4131
|
-
return "red";
|
|
4132
|
-
case common.FrontendTransaction.TransactionState.paid:
|
|
4133
|
-
return "green";
|
|
4134
|
-
default:
|
|
4135
|
-
return "blue";
|
|
4136
|
-
}
|
|
3794
|
+
return (jsxRuntime.jsx("div", __assign({ className: "flex flex-col rounded-md shadow-md ".concat(className), style: __assign(__assign({}, style), { backgroundColor: darkMode
|
|
3795
|
+
? "var(--row-background-dark)"
|
|
3796
|
+
: "var(--row-background)" }) }, { children: children })));
|
|
4137
3797
|
};
|
|
4138
3798
|
|
|
4139
|
-
var
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
var
|
|
4149
|
-
|
|
3799
|
+
var Text$6 = antd.Typography.Text;
|
|
3800
|
+
var CreditCard = function (_a) {
|
|
3801
|
+
var _b, _c, _d;
|
|
3802
|
+
var onClickRemove = _a.onClickRemove, onClickUpdate = _a.onClickUpdate, paymentMethodData = _a.paymentMethodData;
|
|
3803
|
+
var isExpired = function (paymentMethodData) {
|
|
3804
|
+
// paymentMethodData.expirationDate
|
|
3805
|
+
var expDate = dayjs(paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.expirationDate);
|
|
3806
|
+
return expDate.isBefore(dayjs());
|
|
3807
|
+
};
|
|
3808
|
+
var isMobile = common.useIsMobile();
|
|
3809
|
+
var processPublicUrl = React.useContext(PaymentMethodContext).processPublicUrl;
|
|
3810
|
+
return (jsxRuntime.jsxs(Card, __assign({ className: "shadow-md m-0" }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex items-center justify-between gap-4 p-4" }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex items-center gap-4" }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex items-center gap-2" }, { children: [getCardImage((_b = paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.metadata) === null || _b === void 0 ? void 0 : _b.issuer) && (jsxRuntime.jsx("img", { alt: "Card", width: "24px", src: "".concat(processPublicUrl, "/").concat(getCardImage((_c = paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.metadata) === null || _c === void 0 ? void 0 : _c.issuer)) })), jsxRuntime.jsx(Text$6, { children: (_d = paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.metadata) === null || _d === void 0 ? void 0 : _d.description })] })), jsxRuntime.jsx(antd.Tag, __assign({ color: isExpired(paymentMethodData) ? "red" : "green" }, { children: isExpired(paymentMethodData) ? "Expired" : "Valid" }))] })), !isMobile && (jsxRuntime.jsx(CardActions, { onClickRemove: onClickRemove, onClickUpdate: onClickUpdate }))] })), dayjs(paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.expirationDate).isValid() && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(antd.Divider, {}), jsxRuntime.jsxs("div", __assign({ className: "flex flex-col p-4" }, { children: [jsxRuntime.jsx(CardAttribute, { title: "EXPIRATION", value: dayjs(paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.expirationDate).format("MM/YY") }), isMobile && (jsxRuntime.jsx(CardActions, { onClickRemove: onClickRemove, onClickUpdate: onClickUpdate }))] }))] }))] })));
|
|
4150
3811
|
};
|
|
4151
|
-
|
|
4152
|
-
var
|
|
4153
|
-
return
|
|
3812
|
+
var CardAttribute = function (_a) {
|
|
3813
|
+
var title = _a.title, value = _a.value;
|
|
3814
|
+
return (jsxRuntime.jsxs("div", __assign({ className: "flex flex-col gap-2" }, { children: [jsxRuntime.jsx("div", __assign({ className: "text-slate-400", style: { fontSize: "11px" } }, { children: title })), jsxRuntime.jsx(Text$6, { children: value })] })));
|
|
4154
3815
|
};
|
|
4155
|
-
var
|
|
4156
|
-
|
|
3816
|
+
var CardActions = function (_a) {
|
|
3817
|
+
var onClickRemove = _a.onClickRemove, onClickUpdate = _a.onClickUpdate;
|
|
3818
|
+
var isMobile = common.useIsMobile();
|
|
3819
|
+
return (jsxRuntime.jsxs("div", __assign({ className: "flex items-center gap-6 ".concat(isMobile ? "justify-center mt-4" : "") }, { children: [jsxRuntime.jsx(antd.Popconfirm, __assign({ title: "Remove card?", onConfirm: onClickRemove }, { children: jsxRuntime.jsx(antd.Button, __assign({ className: "font-normal p-0", type: "link" }, { children: "Remove payment method" })) })), jsxRuntime.jsx(antd.Divider, { style: { height: "24px" }, type: "vertical" }), jsxRuntime.jsx(antd.Button, __assign({ onClick: onClickUpdate, type: "primary" }, { children: "Update" }))] })));
|
|
4157
3820
|
};
|
|
4158
|
-
var
|
|
4159
|
-
var
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
}
|
|
4163
|
-
return (jsxRuntime.jsx("span", __assign({ className: "text-slate-400", style: { fontSize: "11px" } }, { children: transaction.transactionable.number })));
|
|
3821
|
+
var EmptyCard = function (_a) {
|
|
3822
|
+
var onClick = _a.onClick;
|
|
3823
|
+
var brandColor = React.useContext(BrandContext).brandColor;
|
|
3824
|
+
return (jsxRuntime.jsxs("div", __assign({ className: "flex flex-col items-center justify-center w-full pt-8 px-4 pb-6 cursor-pointer bg-white shadow-md rounded-md", onClick: onClick }, { children: [jsxRuntime.jsx(LargeCardIcon, {}), jsxRuntime.jsx("div", __assign({ className: "text-slate-400 pt-4 pb-8" }, { children: "No payment methods" })), jsxRuntime.jsx(antd.Button, __assign({ type: "link" }, { children: jsxRuntime.jsxs("div", __assign({ className: "flex items-center gap-1" }, { children: [jsxRuntime.jsx(PlusIcon, { color: brandColor }), "Add payment method"] })) }))] })));
|
|
4164
3825
|
};
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
3826
|
+
var getCardImage = function (issuer) {
|
|
3827
|
+
if (issuer === "visa")
|
|
3828
|
+
return "Visa_Brandmark_Blue_RGB_2021.png";
|
|
3829
|
+
else if (issuer === "mastercard")
|
|
3830
|
+
return "mc_symbol_opt_73_3x.png";
|
|
4170
3831
|
};
|
|
4171
3832
|
|
|
4172
|
-
var
|
|
4173
|
-
|
|
4174
|
-
var
|
|
4175
|
-
|
|
4176
|
-
var
|
|
4177
|
-
var
|
|
4178
|
-
var
|
|
3833
|
+
var ActualPaymentMethod = function () {
|
|
3834
|
+
var _a = React.useContext(BunnyContext), token = _a.token, subdomain = _a.subdomain, graphQLClient = _a.graphQLClient;
|
|
3835
|
+
var accountId = React.useContext(PaymentContext).accountId;
|
|
3836
|
+
// Hooks
|
|
3837
|
+
var queryClient = reactQuery.useQueryClient();
|
|
3838
|
+
var paymentPlugins = common.usePaymentPlugins({ subdomain: subdomain, token: token }).paymentPlugins;
|
|
3839
|
+
var showErrorNotification = common.NotificationUtils.useErrorNotification();
|
|
3840
|
+
var showSuccessNotification = common.NotificationUtils.useSuccessNotification();
|
|
3841
|
+
var handleAllErrorFormats = common.NotificationUtils.useAllErrorFormats(function () {
|
|
3842
|
+
console.log("Navigation in PaymentMethod.tsx useAllErrorFormats not implemented");
|
|
3843
|
+
});
|
|
4179
3844
|
var isMobile = common.useIsMobile();
|
|
4180
|
-
var
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
var subdomain = warrenState[CURRENT_WARREN_ID_LS_KEY];
|
|
4211
|
-
if (!subdomain) {
|
|
4212
|
-
console.warn("ERROR_MESSAGE_NO_SUBDOMAIN_DEFINED");
|
|
4213
|
-
//throw new Error(ERROR_MESSAGE_NO_SUBDOMAIN_DEFINED);
|
|
4214
|
-
}
|
|
4215
|
-
return subdomain;
|
|
4216
|
-
};
|
|
4217
|
-
var getApiHost = function (subdomain) {
|
|
4218
|
-
var isLocalHost = window.location.href.indexOf(".internal") > 0;
|
|
4219
|
-
var sub = subdomain || getLocalStorageSubdomain();
|
|
4220
|
-
if (getIsCapacitorApp()) {
|
|
4221
|
-
return isLocalHost || process.env.REACT_APP_IS_INTERNAL === "true"
|
|
4222
|
-
? "https://".concat(sub, ".bunny.internal")
|
|
4223
|
-
: "https://".concat(sub, ".").concat(process.env.REACT_APP_ROOT_DOMAIN);
|
|
4224
|
-
}
|
|
4225
|
-
return "";
|
|
4226
|
-
};
|
|
4227
|
-
var getGraphQLBase = function () {
|
|
4228
|
-
if (getIsCapacitorApp()) {
|
|
4229
|
-
return "".concat(getApiHost(), "/graphql");
|
|
4230
|
-
}
|
|
4231
|
-
return "/graphql";
|
|
4232
|
-
};
|
|
4233
|
-
var createRequestHeaders = function (token) {
|
|
4234
|
-
var bearerToken = "Bearer ".concat(token);
|
|
4235
|
-
var headers = {
|
|
4236
|
-
"Content-type": "application/json; charset=utf-8",
|
|
3845
|
+
var data = usePaymentMethod(graphQLClient).data;
|
|
3846
|
+
// Local state
|
|
3847
|
+
var _b = React.useState(false), showModal = _b[0], setShowModal = _b[1];
|
|
3848
|
+
var _c = React.useState(false), isSaving = _c[0], setIsSaving = _c[1];
|
|
3849
|
+
// Queries
|
|
3850
|
+
reactQuery.useQuery({
|
|
3851
|
+
queryKey: common.QueryKeyFactory.default.currentUserKey,
|
|
3852
|
+
queryFn: function () { return getCurrentUserData({ token: token, subdomain: subdomain }); },
|
|
3853
|
+
});
|
|
3854
|
+
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); });
|
|
3855
|
+
var onClickRemove = function () {
|
|
3856
|
+
if (data && plugin) {
|
|
3857
|
+
common.invokePlugin({
|
|
3858
|
+
plugin: plugin,
|
|
3859
|
+
method: "remove_payment_method",
|
|
3860
|
+
payload: {
|
|
3861
|
+
payment_method_id: data.id,
|
|
3862
|
+
account_id: accountId,
|
|
3863
|
+
},
|
|
3864
|
+
token: token,
|
|
3865
|
+
subdomain: subdomain,
|
|
3866
|
+
})
|
|
3867
|
+
.then(function () {
|
|
3868
|
+
showSuccessNotification("Payment method was removed", "Success");
|
|
3869
|
+
queryClient.setQueryData(common.QueryKeyFactory.default.accountPaymentMethodKey, null);
|
|
3870
|
+
})
|
|
3871
|
+
.catch(function (error) {
|
|
3872
|
+
showErrorNotification(error.message, "Error removing Payment Method");
|
|
3873
|
+
});
|
|
3874
|
+
}
|
|
4237
3875
|
};
|
|
4238
|
-
|
|
4239
|
-
|
|
3876
|
+
var onSuccess = function () {
|
|
3877
|
+
queryClient.invalidateQueries({
|
|
3878
|
+
queryKey: common.QueryKeyFactory.default.accountPaymentMethodKey,
|
|
3879
|
+
});
|
|
3880
|
+
setShowModal(false);
|
|
3881
|
+
showSuccessNotification("Your payment method has been saved");
|
|
3882
|
+
};
|
|
3883
|
+
if (data === undefined)
|
|
3884
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
3885
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [data ? (jsxRuntime.jsx(CreditCard, { onClickRemove: onClickRemove, onClickUpdate: function () { return setShowModal(true); }, paymentMethodData: data })) : (jsxRuntime.jsx(EmptyCard, { onClick: function () { return setShowModal(true); } })), jsxRuntime.jsx(antd.Drawer, __assign({ closeIcon: null, onClose: function () { return setShowModal(false); }, open: showModal, styles: {
|
|
3886
|
+
body: isMobile
|
|
3887
|
+
? {
|
|
3888
|
+
padding: "1rem 0 0",
|
|
3889
|
+
}
|
|
3890
|
+
: {},
|
|
3891
|
+
wrapper: isMobile ? { width: "100vw" } : { width: "min-content" },
|
|
3892
|
+
}, title: jsxRuntime.jsx(DrawerHeader, { onClose: function () { return setShowModal(false); }, title: "New payment method" }) }, { children: jsxRuntime.jsx(PaymentForm, { isSaving: isSaving, onFail: function (error) {
|
|
3893
|
+
handleAllErrorFormats(error);
|
|
3894
|
+
setIsSaving(false);
|
|
3895
|
+
}, onPaymentSuccess: function () {
|
|
3896
|
+
onSuccess();
|
|
3897
|
+
setIsSaving(false);
|
|
3898
|
+
}, setIsSaving: setIsSaving }) }))] }));
|
|
4240
3899
|
};
|
|
4241
|
-
|
|
4242
|
-
var
|
|
4243
|
-
return
|
|
4244
|
-
|
|
4245
|
-
case 0:
|
|
4246
|
-
_a.trys.push([0, 2, , 3]);
|
|
4247
|
-
return [4 /*yield*/, request__default["default"](getGraphQLBase(), query, variables, createRequestHeaders(token))];
|
|
4248
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
4249
|
-
case 2:
|
|
4250
|
-
error_1 = _a.sent();
|
|
4251
|
-
throw error_1;
|
|
4252
|
-
case 3: return [2 /*return*/];
|
|
4253
|
-
}
|
|
4254
|
-
});
|
|
4255
|
-
}); }; };
|
|
3900
|
+
function PaymentMethod(_a) {
|
|
3901
|
+
var footer = _a.footer, processPublicUrl = _a.processPublicUrl;
|
|
3902
|
+
return (jsxRuntime.jsx(PaymentMethodContext.Provider, __assign({ value: { footer: footer, processPublicUrl: processPublicUrl } }, { children: jsxRuntime.jsx(ActualPaymentMethod, {}) })));
|
|
3903
|
+
}
|
|
4256
3904
|
|
|
4257
|
-
var
|
|
4258
|
-
var
|
|
4259
|
-
var
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
: "var(--row-background-alternate".concat(darkMode ? "-dark" : "", ")"),
|
|
4277
|
-
} }, { children: [showDateAndTitle && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(TransactionGridCell, __assign({ right: false }, { children: jsxRuntime.jsx(TransactionDate, { date: transaction.createdAt }) })), jsxRuntime.jsxs(TransactionGridCell, __assign({ right: false, className: "flex items-center gap-2" }, { children: [jsxRuntime.jsx(Text$5, { children: capitalizeFirstLetter(transaction.kind.toLowerCase()) }), jsxRuntime.jsx(TransactionRowTitle, { transaction: transaction })] }))] })), showDownload && (jsxRuntime.jsx(TransactionGridCell, { children: jsxRuntime.jsx(TransactionDownload, { transaction: transaction, token: token, subdomain: subdomain }) })), showState && (jsxRuntime.jsx(TransactionGridCell, __assign({ right: true }, { children: jsxRuntime.jsx(StateTag, { state: transaction.state }) }))), showAmount && (jsxRuntime.jsx(TransactionGridCell, __assign({ right: true }, { children: jsxRuntime.jsx(Text$5, { children: common.Misc.formatCurrency(((_a = transaction === null || transaction === void 0 ? void 0 : transaction.transactionable) === null || _a === void 0 ? void 0 : _a.amount) || transaction.amount, transaction.currencyId) }) })))] }), index));
|
|
3905
|
+
var MUTATION$5 = "\nmutation accountUpdate(\n $id: ID!,\n $attributes: AccountAttributes!) {\n accountUpdate(\n id: $id,\n attributes: $attributes\n ) {\n account { id }\n errors\n }\n }\n";
|
|
3906
|
+
var accountUpdate = function (_a) {
|
|
3907
|
+
var accountId = _a.accountId, attributes = _a.attributes, token = _a.token;
|
|
3908
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
3909
|
+
var vars, response, errors;
|
|
3910
|
+
var _b;
|
|
3911
|
+
return __generator(this, function (_c) {
|
|
3912
|
+
switch (_c.label) {
|
|
3913
|
+
case 0:
|
|
3914
|
+
vars = { id: accountId, attributes: attributes };
|
|
3915
|
+
return [4 /*yield*/, common.gqlRequest({ query: MUTATION$5, token: token, vars: vars })];
|
|
3916
|
+
case 1:
|
|
3917
|
+
response = _c.sent();
|
|
3918
|
+
errors = (_b = response === null || response === void 0 ? void 0 : response.accountUpdate) === null || _b === void 0 ? void 0 : _b.errors;
|
|
3919
|
+
if (errors)
|
|
3920
|
+
throw errors;
|
|
3921
|
+
return [2 /*return*/, response.accountUpdate];
|
|
3922
|
+
}
|
|
3923
|
+
});
|
|
4278
3924
|
});
|
|
4279
3925
|
};
|
|
4280
3926
|
|
|
4281
|
-
var
|
|
4282
|
-
var
|
|
4283
|
-
var
|
|
4284
|
-
|
|
4285
|
-
var
|
|
4286
|
-
var
|
|
4287
|
-
var
|
|
4288
|
-
|
|
4289
|
-
var
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
3927
|
+
var COUNTRIES_REQUIRING_STATE = ["US", "CA"];
|
|
3928
|
+
var TaxationForm = function (_a) {
|
|
3929
|
+
var account = _a.account, quote = _a.quote;
|
|
3930
|
+
// Hooks
|
|
3931
|
+
var queryClient = reactQuery.useQueryClient();
|
|
3932
|
+
var token = React.useContext(BunnyContext).token;
|
|
3933
|
+
var form = antd.Form.useForm()[0];
|
|
3934
|
+
// Mutations
|
|
3935
|
+
var _b = reactQuery.useMutation({
|
|
3936
|
+
mutationFn: function (changedFormData) { return __awaiter(void 0, void 0, void 0, function () {
|
|
3937
|
+
var account;
|
|
3938
|
+
return __generator(this, function (_a) {
|
|
3939
|
+
switch (_a.label) {
|
|
3940
|
+
case 0: return [4 /*yield*/, accountUpdate({
|
|
3941
|
+
accountId: quote.accountId,
|
|
3942
|
+
attributes: changedFormData,
|
|
3943
|
+
token: token,
|
|
3944
|
+
})];
|
|
3945
|
+
case 1:
|
|
3946
|
+
account = _a.sent();
|
|
3947
|
+
return [2 /*return*/, account];
|
|
3948
|
+
}
|
|
3949
|
+
});
|
|
3950
|
+
}); },
|
|
3951
|
+
onSuccess: function () {
|
|
3952
|
+
queryClient.invalidateQueries({
|
|
3953
|
+
queryKey: ["getTaxationRequiredAccountFields", token],
|
|
3954
|
+
});
|
|
3955
|
+
},
|
|
3956
|
+
}), updateAccount = _b.mutate, isUpdatingAccount = _b.isPending;
|
|
3957
|
+
return (jsxRuntime.jsxs(antd.Form, __assign({ className: "flex flex-col gap-4", form: form, initialValues: account, layout: "vertical", onFinish: updateAccount }, { children: [jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Billing street", name: "billingStreet" }, { children: jsxRuntime.jsx(antd.Input, { placeholder: "Street" }) })), jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Billing city", name: "billingCity" }, { children: jsxRuntime.jsx(antd.Input, { placeholder: "City" }) })), jsxRuntime.jsx(FormBillingState, { form: form }), jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Billing country", name: "billingCountry", rules: [{ required: true }] }, { children: jsxRuntime.jsx(antd.Select, { options: common.Lists.COUNTRY_LIST, placeholder: "Select a country", showSearch: true, filterOption: function (input, option) {
|
|
3958
|
+
var _a, _b;
|
|
3959
|
+
return ((_a = option === null || option === void 0 ? void 0 : option.label) !== null && _a !== void 0 ? _a : "").toLowerCase().includes(input.toLowerCase()) ||
|
|
3960
|
+
((_b = option === null || option === void 0 ? void 0 : option.value) !== null && _b !== void 0 ? _b : "").toLowerCase().includes(input.toLowerCase());
|
|
3961
|
+
} }) })), jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Billing zip", name: "billingZip" }, { children: jsxRuntime.jsx(antd.Input, { placeholder: "Zip" }) })), jsxRuntime.jsx(antd.Form.Item, { children: jsxRuntime.jsx(antd.Button, __assign({ className: "w-full", disabled: isUpdatingAccount, htmlType: "submit", type: "primary" }, { children: "Submit" })) })] })));
|
|
3962
|
+
};
|
|
3963
|
+
var FormBillingState = function (_a) {
|
|
3964
|
+
_a.form;
|
|
3965
|
+
var billingCountry = antd.Form.useWatch("billingCountry");
|
|
3966
|
+
var billingStateRequired = COUNTRIES_REQUIRING_STATE.includes(billingCountry);
|
|
3967
|
+
return (jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Billing state", name: "billingState", rules: [{ required: billingStateRequired }] }, { children: jsxRuntime.jsx(antd.Input, { placeholder: "State" }) })));
|
|
4302
3968
|
};
|
|
4303
3969
|
|
|
4304
|
-
|
|
4305
|
-
var
|
|
4306
|
-
|
|
4307
|
-
var
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
3970
|
+
var QuoteCheckout = function (_a) {
|
|
3971
|
+
var account = _a.account, isSaving = _a.isSaving, onSuccess = _a.onSuccess, onFail = _a.onFail, quote = _a.quote, setIsSaving = _a.setIsSaving, taxationRequiredAccountFields = _a.taxationRequiredAccountFields; _a.storedPaymentMethod;
|
|
3972
|
+
// Context
|
|
3973
|
+
var isMobile = common.useIsMobile();
|
|
3974
|
+
var _b = React.useContext(BunnyContext), subdomain = _b.subdomain, token = _b.token;
|
|
3975
|
+
var paymentRequired = getQuoteAmountDue(quote) > 0;
|
|
3976
|
+
var checkoutMutation = reactQuery.useMutation({
|
|
3977
|
+
mutationFn: function (_a) {
|
|
3978
|
+
var pluginPaymentMethod = _a.pluginPaymentMethod, savedPaymentMethod = _a.storedPaymentMethod;
|
|
3979
|
+
if (!quote)
|
|
3980
|
+
throw new Error("Quote is required");
|
|
3981
|
+
if (!paymentRequired)
|
|
3982
|
+
return checkout({ quoteId: quote.id, token: token, subdomain: subdomain });
|
|
3983
|
+
if (savedPaymentMethod) {
|
|
3984
|
+
var paymentMethodId = savedPaymentMethod.paymentMethodId;
|
|
3985
|
+
return checkout({
|
|
3986
|
+
quoteId: quote.id,
|
|
3987
|
+
paymentMethodId: paymentMethodId,
|
|
3988
|
+
token: token,
|
|
3989
|
+
subdomain: subdomain,
|
|
3990
|
+
});
|
|
3991
|
+
}
|
|
3992
|
+
if (pluginPaymentMethod) {
|
|
3993
|
+
var plugin = pluginPaymentMethod.plugin, savePaymentMethod = pluginPaymentMethod.savePaymentMethod, metadata = pluginPaymentMethod.metadata;
|
|
3994
|
+
var paymentToken = pluginPaymentMethod.token;
|
|
3995
|
+
return checkout({
|
|
3996
|
+
quoteId: quote.id,
|
|
3997
|
+
paymentMethodData: {
|
|
3998
|
+
metadata: metadata,
|
|
3999
|
+
pluginGuid: plugin.guid,
|
|
4000
|
+
savePaymentMethod: savePaymentMethod,
|
|
4001
|
+
token: paymentToken,
|
|
4002
|
+
},
|
|
4003
|
+
token: token,
|
|
4004
|
+
subdomain: subdomain,
|
|
4005
|
+
});
|
|
4006
|
+
}
|
|
4007
|
+
throw new Error("Pay payment method provided");
|
|
4008
|
+
},
|
|
4009
|
+
onSuccess: onSuccess,
|
|
4010
|
+
onError: onFail,
|
|
4011
|
+
});
|
|
4012
|
+
// Handlers
|
|
4013
|
+
var handleCheckout = function (_a) {
|
|
4014
|
+
var pluginPaymentResponse = _a.pluginPaymentResponse, savedPaymentMethodResponse = _a.savedPaymentMethodResponse;
|
|
4015
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
4016
|
+
var token_1, plugin, savePaymentMethod, metadata, paymentMethodId;
|
|
4017
|
+
return __generator(this, function (_b) {
|
|
4018
|
+
if (pluginPaymentResponse) {
|
|
4019
|
+
token_1 = pluginPaymentResponse.token, plugin = pluginPaymentResponse.plugin, savePaymentMethod = pluginPaymentResponse.savePaymentMethod, metadata = pluginPaymentResponse.metadata;
|
|
4020
|
+
checkoutMutation.mutate({
|
|
4021
|
+
pluginPaymentMethod: {
|
|
4022
|
+
savePaymentMethod: savePaymentMethod,
|
|
4023
|
+
plugin: plugin,
|
|
4024
|
+
metadata: metadata,
|
|
4025
|
+
token: token_1,
|
|
4026
|
+
},
|
|
4027
|
+
});
|
|
4028
|
+
}
|
|
4029
|
+
else if (savedPaymentMethodResponse) {
|
|
4030
|
+
paymentMethodId = savedPaymentMethodResponse.paymentMethodId;
|
|
4031
|
+
checkoutMutation.mutate({
|
|
4032
|
+
storedPaymentMethod: {
|
|
4033
|
+
paymentMethodId: paymentMethodId,
|
|
4034
|
+
},
|
|
4035
|
+
});
|
|
4036
|
+
}
|
|
4037
|
+
else {
|
|
4038
|
+
checkoutMutation.mutate({});
|
|
4039
|
+
}
|
|
4040
|
+
return [2 /*return*/];
|
|
4041
|
+
});
|
|
4042
|
+
});
|
|
4328
4043
|
};
|
|
4329
|
-
|
|
4044
|
+
if (taxationRequiredAccountFields)
|
|
4045
|
+
return (jsxRuntime.jsx(PaymentFormWrapper, __assign({ setMaxHeight: false }, { children: jsxRuntime.jsx(TaxationForm, { account: account, quote: quote }) })));
|
|
4046
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: paymentRequired ? (jsxRuntime.jsx(PaymentForm, { isSaving: isSaving, onFail: onFail, onPaymentSuccess: handleCheckout, quote: quote, setIsSaving: setIsSaving })) : (jsxRuntime.jsx(PaymentFormWrapper, __assign({ setMaxHeight: false }, { children: jsxRuntime.jsxs("div", __assign({ className: "flex flex-col gap-2 ".concat(isMobile ? "shadow-padding-x" : "") }, { children: [jsxRuntime.jsx(antd.Button, __assign({ disabled: isSaving, onClick: function () {
|
|
4047
|
+
setIsSaving(true);
|
|
4048
|
+
handleCheckout({});
|
|
4049
|
+
}, type: "primary" }, { children: isSaving ? "Processing..." : "Complete order" })), jsxRuntime.jsx("div", __assign({ className: "text-xs text-slate-500" }, { children: "No payment is required" }))] })) }))) }));
|
|
4050
|
+
};
|
|
4051
|
+
|
|
4052
|
+
var useHasTaxPlugin = function (_a) {
|
|
4053
|
+
var subdomain = _a.subdomain, token = _a.token;
|
|
4054
|
+
var plugins = common.usePlugins({
|
|
4055
|
+
subdomain: subdomain,
|
|
4056
|
+
token: token,
|
|
4057
|
+
}).data;
|
|
4058
|
+
return Boolean(plugins === null || plugins === void 0 ? void 0 : plugins.some(function (plugin) { return plugin.type === "taxation"; }));
|
|
4059
|
+
};
|
|
4060
|
+
|
|
4061
|
+
var QUOTE_FIELDS = "quote {\n formattedQuote {\n html\n }\n acceptedByName\n acceptedByTitle\n accountId\n amount\n amountDue\n applicationDate\n applied\n billingDay\n contactId\n createdAt\n credits\n currencyId\n dealId\n discount\n discountValue\n endDate\n evergreen\n expiresAt\n id\n invoiceUntil\n isPendingApprovalRequest\n kind\n message\n name\n netPaymentDays\n notes\n ownerId\n periodAmount\n poNumber\n requiresApproval\n startDate\n state\n subtotal\n taxAmount\n updatedAt\n uuid\n amountsByPeriod {\n amount\n id\n name\n }\n endDateOptions {\n endDate\n label\n }\n invoiceUntilOptions {\n endDate\n label\n }\n quoteChanges {\n id\n priceListId\n charges {\n amount\n amountsByPeriod { amount startDate }\n billingPeriod\n billingPeriodAmounts { id amount prorationRate }\n chargeType\n couponId\n createdAt\n currencyId\n discount\n endDate\n feature { id name code isUnit unitName }\n id\n invoiceLineText\n name\n price\n priceDecimals\n priceTiers { starts price }\n pricingModel\n prorationRate\n quantity\n quantityMax\n quantityMin\n startDate\n tieredAveragePrice\n updatedAt\n }\n }\n}";
|
|
4062
|
+
|
|
4063
|
+
var QUOTE_RECALCULATE_TAXES = "\n mutation QuoteRecalculateTaxes($id: ID!) {\n quoteRecalculateTaxes(id: $id) {\n ".concat(QUOTE_FIELDS, "\n errors\n }\n }\n");
|
|
4064
|
+
var quoteRecalculateTaxes = function (_a) {
|
|
4065
|
+
var quoteId = _a.quoteId, token = _a.token;
|
|
4066
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
4067
|
+
var vars, response, errors;
|
|
4068
|
+
var _b, _c;
|
|
4069
|
+
return __generator(this, function (_d) {
|
|
4070
|
+
switch (_d.label) {
|
|
4071
|
+
case 0:
|
|
4072
|
+
vars = { id: quoteId };
|
|
4073
|
+
return [4 /*yield*/, common.gqlRequest({
|
|
4074
|
+
query: QUOTE_RECALCULATE_TAXES,
|
|
4075
|
+
token: token,
|
|
4076
|
+
vars: vars,
|
|
4077
|
+
})];
|
|
4078
|
+
case 1:
|
|
4079
|
+
response = _d.sent();
|
|
4080
|
+
errors = (_b = response === null || response === void 0 ? void 0 : response.quoteRecalculateTaxes) === null || _b === void 0 ? void 0 : _b.errors;
|
|
4081
|
+
if (errors)
|
|
4082
|
+
throw errors;
|
|
4083
|
+
return [2 /*return*/, (_c = response.quoteRecalculateTaxes) === null || _c === void 0 ? void 0 : _c.quote];
|
|
4084
|
+
}
|
|
4085
|
+
});
|
|
4086
|
+
});
|
|
4087
|
+
};
|
|
4088
|
+
|
|
4089
|
+
var planPickerQuoteDataState = recoil.atom({
|
|
4090
|
+
key: "planPickerQuoteDataState",
|
|
4091
|
+
default: undefined,
|
|
4092
|
+
});
|
|
4093
|
+
|
|
4094
|
+
var pageWrapperClassName = function (isMobile) {
|
|
4095
|
+
return "flex flex-col grow pt-4 ".concat(isMobile ? "pb-4 overflow-hidden" : "pb-8", " ").concat("content-container");
|
|
4096
|
+
};
|
|
4097
|
+
|
|
4098
|
+
var queryKeyFactory = common.QueryKeyFactory.default;
|
|
4099
|
+
var Checkout = function (_a) {
|
|
4100
|
+
var _b, _c;
|
|
4101
|
+
var onCancel = _a.onCancel, onSuccess = _a.onSuccess, onFail = _a.onFail, invoice = _a.invoice, open = _a.open, quote = _a.quote, selectedPriceList = _a.selectedPriceList, isMobile = _a.isMobile, token = _a.token, storedPaymentMethod = _a.storedPaymentMethod;
|
|
4102
|
+
var subdomain = React.useContext(BunnyContext).subdomain;
|
|
4103
|
+
var _d = React.useState(false), isSaving = _d[0], setIsSaving = _d[1];
|
|
4104
|
+
var hasTaxPlugin = useHasTaxPlugin({ subdomain: subdomain || "", token: token });
|
|
4105
|
+
var queryClient = reactQuery.useQueryClient();
|
|
4106
|
+
var quotePreviewData = recoil.useRecoilValue(planPickerQuoteDataState);
|
|
4107
|
+
// Queries
|
|
4108
|
+
var _e = reactQuery.useQuery({
|
|
4109
|
+
queryKey: ["getTaxationRequiredAccountFields", token],
|
|
4110
|
+
queryFn: function () { return common.getTaxationRequiredAccountFields({ token: token }); },
|
|
4111
|
+
enabled: Boolean(quote),
|
|
4112
|
+
staleTime: 0,
|
|
4113
|
+
}), taxationRequiredAccountFields = _e.data, isLoadingTaxationRequiredAccountFields = _e.isLoading;
|
|
4114
|
+
var _f = reactQuery.useQuery({
|
|
4115
|
+
queryKey: ["account", quote === null || quote === void 0 ? void 0 : quote.accountId],
|
|
4116
|
+
queryFn: function () {
|
|
4117
|
+
return (quote === null || quote === void 0 ? void 0 : quote.accountId) && common.getAccount({ id: quote.accountId, token: token });
|
|
4118
|
+
},
|
|
4119
|
+
enabled: Boolean(quote === null || quote === void 0 ? void 0 : quote.accountId) &&
|
|
4120
|
+
((taxationRequiredAccountFields === null || taxationRequiredAccountFields === void 0 ? void 0 : taxationRequiredAccountFields.length) || 0) > 0,
|
|
4121
|
+
}), account = _f.data, isLoadingAccount = _f.isLoading;
|
|
4122
|
+
reactQuery.useQuery({
|
|
4123
|
+
queryKey: queryKeyFactory.createQuoteTaxCalculateKey(quote === null || quote === void 0 ? void 0 : quote.id),
|
|
4124
|
+
queryFn: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
4125
|
+
var updatedQuote;
|
|
4126
|
+
return __generator(this, function (_a) {
|
|
4127
|
+
switch (_a.label) {
|
|
4128
|
+
case 0:
|
|
4129
|
+
if (!quote) return [3 /*break*/, 2];
|
|
4130
|
+
return [4 /*yield*/, quoteRecalculateTaxes({
|
|
4131
|
+
quoteId: quote.id,
|
|
4132
|
+
token: token,
|
|
4133
|
+
})];
|
|
4134
|
+
case 1:
|
|
4135
|
+
updatedQuote = _a.sent();
|
|
4136
|
+
if (updatedQuote) {
|
|
4137
|
+
queryClient.setQueryData(queryKeyFactory.createObjectKey("editingQuote", updatedQuote.id), updatedQuote);
|
|
4138
|
+
queryClient.setQueryData(queryKeyFactory.calculatedPricesKey((quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.quantity) || 0, selectedPriceList === null || selectedPriceList === void 0 ? void 0 : selectedPriceList.id), updatedQuote);
|
|
4139
|
+
}
|
|
4140
|
+
_a.label = 2;
|
|
4141
|
+
case 2: return [2 /*return*/, {}];
|
|
4142
|
+
}
|
|
4143
|
+
});
|
|
4144
|
+
}); },
|
|
4145
|
+
// Recalculate taxes if the quote is open, has a tax plugin, and the taxation required account fields are not required
|
|
4146
|
+
enabled: Boolean(quote) &&
|
|
4147
|
+
open &&
|
|
4148
|
+
hasTaxPlugin &&
|
|
4149
|
+
!taxationRequiredAccountFields &&
|
|
4150
|
+
!isLoadingTaxationRequiredAccountFields,
|
|
4151
|
+
staleTime: 0,
|
|
4152
|
+
});
|
|
4153
|
+
if (!open || isLoadingTaxationRequiredAccountFields || isLoadingAccount)
|
|
4154
|
+
return null;
|
|
4155
|
+
return (jsxRuntime.jsx("div", __assign({ className: "flex flex-col fixed top-0 left-0 right-0 bottom-0 bg-slate-50 overflow-auto", style: {
|
|
4156
|
+
zIndex: 1001,
|
|
4157
|
+
} }, { children: jsxRuntime.jsxs("div", __assign({ className: pageWrapperClassName(isMobile) }, { children: [jsxRuntime.jsx("div", __assign({ className: "flex justify-end w-full" }, { children: jsxRuntime.jsx(CloseOutlined$1, { className: "text-base shadow-padding-xb", onClick: onCancel }) })), jsxRuntime.jsxs("div", __assign({ className: "flex justify-end gap-6 pt-4 ".concat(isMobile ? "flex-col" : "shadow-padding-xb") }, { children: [((invoice === null || invoice === void 0 ? void 0 : invoice.html) || ((_b = quote === null || quote === void 0 ? void 0 : quote.formattedQuote) === null || _b === void 0 ? void 0 : _b.html)) && (jsxRuntime.jsx(InvoiceQuoteView, { html: invoice ? invoice.html : quote ? quote.formattedQuote.html : "", isMobile: isMobile })), !isMobile && ((invoice === null || invoice === void 0 ? void 0 : invoice.html) || ((_c = quote === null || quote === void 0 ? void 0 : quote.formattedQuote) === null || _c === void 0 ? void 0 : _c.html)) && (jsxRuntime.jsx(antd.Divider, { className: "h-full", type: "vertical" })), invoice ? (jsxRuntime.jsx(InvoiceCheckout, { invoice: invoice, isSaving: isSaving, onFail: function (error) {
|
|
4158
|
+
onFail(error);
|
|
4159
|
+
setIsSaving(false);
|
|
4160
|
+
}, onSuccess: function (_a) {
|
|
4161
|
+
var savePaymentMethod = _a.savePaymentMethod;
|
|
4162
|
+
onSuccess({ savePaymentMethod: savePaymentMethod });
|
|
4163
|
+
setIsSaving(false);
|
|
4164
|
+
}, setIsSaving: setIsSaving })) : quote ? (jsxRuntime.jsx(QuoteCheckout, { account: account, isSaving: isSaving, onFail: function (error) {
|
|
4165
|
+
onFail(error);
|
|
4166
|
+
setIsSaving(false);
|
|
4167
|
+
}, onSuccess: function (_a) {
|
|
4168
|
+
var savePaymentMethod = _a.savePaymentMethod;
|
|
4169
|
+
onSuccess({ savePaymentMethod: savePaymentMethod });
|
|
4170
|
+
setIsSaving(false);
|
|
4171
|
+
}, quote: quote, setIsSaving: setIsSaving, taxationRequiredAccountFields: taxationRequiredAccountFields, token: token, storedPaymentMethod: storedPaymentMethod })) : (jsxRuntime.jsx(PaymentForm, { isSaving: isSaving, onFail: function (error) {
|
|
4172
|
+
onFail(error);
|
|
4173
|
+
setIsSaving(false);
|
|
4174
|
+
}, onPaymentSuccess: function (_a) {
|
|
4175
|
+
var pluginPaymentResponse = _a.pluginPaymentResponse;
|
|
4176
|
+
onSuccess({
|
|
4177
|
+
savePaymentMethod: pluginPaymentResponse === null || pluginPaymentResponse === void 0 ? void 0 : pluginPaymentResponse.savePaymentMethod,
|
|
4178
|
+
});
|
|
4179
|
+
setIsSaving(false);
|
|
4180
|
+
}, setIsSaving: setIsSaving }))] }))] })) })));
|
|
4181
|
+
};
|
|
4182
|
+
|
|
4183
|
+
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}"; };
|
|
4184
|
+
var accountSignup = function (_a) {
|
|
4185
|
+
var token = _a.token, subdomain = _a.subdomain, entityId = _a.entityId, accountId = _a.accountId, quoteId = _a.quoteId, paymentToken = _a.paymentToken, paymentMethodId = _a.paymentMethodId, pluginId = _a.pluginId, priceListCode = _a.priceListCode;
|
|
4186
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
4187
|
+
var vars, response, errors;
|
|
4188
|
+
var _b;
|
|
4189
|
+
return __generator(this, function (_c) {
|
|
4190
|
+
switch (_c.label) {
|
|
4191
|
+
case 0:
|
|
4192
|
+
vars = {
|
|
4193
|
+
entityId: entityId,
|
|
4194
|
+
accountId: accountId,
|
|
4195
|
+
quoteId: quoteId,
|
|
4196
|
+
paymentToken: paymentToken,
|
|
4197
|
+
pluginId: pluginId,
|
|
4198
|
+
paymentMethodId: paymentMethodId,
|
|
4199
|
+
priceListCode: priceListCode,
|
|
4200
|
+
};
|
|
4201
|
+
return [4 /*yield*/, common.gqlRequest({
|
|
4202
|
+
query: MUTATION$4(),
|
|
4203
|
+
token: token,
|
|
4204
|
+
vars: vars,
|
|
4205
|
+
subdomain: subdomain,
|
|
4206
|
+
})];
|
|
4207
|
+
case 1:
|
|
4208
|
+
response = _c.sent();
|
|
4209
|
+
errors = (_b = response === null || response === void 0 ? void 0 : response.accountSignup) === null || _b === void 0 ? void 0 : _b.errors;
|
|
4210
|
+
if (errors)
|
|
4211
|
+
throw errors;
|
|
4212
|
+
return [2 /*return*/, response === null || response === void 0 ? void 0 : response.accountSignup];
|
|
4213
|
+
}
|
|
4214
|
+
});
|
|
4215
|
+
});
|
|
4216
|
+
};
|
|
4217
|
+
|
|
4218
|
+
var MUTATION$3 = function () { return "\nmutation QuoteAccountSignup (\n $accountName: String!,\n $billingContact: ContactAttributes!,\n $entityId: ID!,\n $priceListCode: String!\n) {\n quoteAccountSignup(\n entityId: $entityId,\n priceListCode: $priceListCode,\n accountName: $accountName,\n billingContact: $billingContact\n ) {\n account {\n id\n }\n amount\n currencyId\n quote {\n id\n }\n tenant {\n code\n }\n errors\n }\n}"; };
|
|
4219
|
+
var quoteAccountSignup = function (_a) {
|
|
4220
|
+
var token = _a.token, subdomain = _a.subdomain, entityId = _a.entityId, priceListCode = _a.priceListCode, accountName = _a.accountName, billingContact = _a.billingContact;
|
|
4221
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
4222
|
+
var vars, response, errors;
|
|
4223
|
+
var _b;
|
|
4224
|
+
return __generator(this, function (_c) {
|
|
4225
|
+
switch (_c.label) {
|
|
4226
|
+
case 0:
|
|
4227
|
+
vars = {
|
|
4228
|
+
entityId: entityId,
|
|
4229
|
+
priceListCode: priceListCode,
|
|
4230
|
+
accountName: accountName,
|
|
4231
|
+
billingContact: billingContact,
|
|
4232
|
+
};
|
|
4233
|
+
return [4 /*yield*/, common.gqlRequest({
|
|
4234
|
+
query: MUTATION$3(),
|
|
4235
|
+
token: token,
|
|
4236
|
+
vars: vars,
|
|
4237
|
+
subdomain: subdomain,
|
|
4238
|
+
})];
|
|
4239
|
+
case 1:
|
|
4240
|
+
response = _c.sent();
|
|
4241
|
+
errors = (_b = response === null || response === void 0 ? void 0 : response.quoteAccountSignup) === null || _b === void 0 ? void 0 : _b.errors;
|
|
4242
|
+
if (errors)
|
|
4243
|
+
throw errors;
|
|
4244
|
+
return [2 /*return*/, response === null || response === void 0 ? void 0 : response.quoteAccountSignup];
|
|
4245
|
+
}
|
|
4246
|
+
});
|
|
4247
|
+
});
|
|
4248
|
+
};
|
|
4249
|
+
|
|
4250
|
+
var MUTATION$2 = function () { return "\nquery PriceList($code: String!) {\n priceList (code: $code) {\n basePrice\n code\n createdAt\n currencyId\n id\n isVisible\n name\n periodMonths\n planId\n priceDescription\n productId\n sku\n trialAllowed\n trialLengthDays\n updatedAt\n }\n}"; };
|
|
4251
|
+
var getPriceList = function (_a) {
|
|
4252
|
+
var token = _a.token, code = _a.code, subdomain = _a.subdomain;
|
|
4253
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
4254
|
+
var response;
|
|
4255
|
+
return __generator(this, function (_b) {
|
|
4256
|
+
switch (_b.label) {
|
|
4257
|
+
case 0: return [4 /*yield*/, common.gqlRequest({
|
|
4258
|
+
query: MUTATION$2(),
|
|
4259
|
+
token: token,
|
|
4260
|
+
vars: { code: code },
|
|
4261
|
+
subdomain: subdomain,
|
|
4262
|
+
})];
|
|
4263
|
+
case 1:
|
|
4264
|
+
response = _b.sent();
|
|
4265
|
+
return [2 /*return*/, response === null || response === void 0 ? void 0 : response.priceList];
|
|
4266
|
+
}
|
|
4267
|
+
});
|
|
4268
|
+
});
|
|
4269
|
+
};
|
|
4270
|
+
|
|
4271
|
+
function PaymentForms(_a) {
|
|
4272
|
+
var quote = _a.quote, paying = _a.paying, setIsPaying = _a.setIsPaying, handlePaymentSaveSuccess = _a.handlePaymentSaveSuccess, handlePaymentFail = _a.handlePaymentFail, handleSubmit = _a.handleSubmit, proceedingToPayment = _a.proceedingToPayment, accountId = _a.accountId;
|
|
4273
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: quote ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: accountId && (jsxRuntime.jsx(PaymentContext.Provider, __assign({ value: { accountId: accountId, displayPayButtonNameAnyways: true } }, { children: jsxRuntime.jsx(PaymentForm, { isSaving: paying, setIsSaving: setIsPaying, onFail: handlePaymentFail, onPaymentSuccess: handlePaymentSaveSuccess }) }))) })) : (jsxRuntime.jsx(InitialSignupForm, { onSubmit: handleSubmit, submitting: proceedingToPayment })) }));
|
|
4274
|
+
}
|
|
4275
|
+
function InitialSignupForm(_a) {
|
|
4276
|
+
var onSubmit = _a.onSubmit, submitting = _a.submitting;
|
|
4277
|
+
var _b = React.useState({
|
|
4278
|
+
firstName: "",
|
|
4279
|
+
lastName: "",
|
|
4280
|
+
email: "",
|
|
4281
|
+
accountName: "",
|
|
4282
|
+
}), formData = _b[0], setFormData = _b[1];
|
|
4283
|
+
var handleInputChange = function (e) {
|
|
4284
|
+
var _a;
|
|
4285
|
+
var _b = e.target, name = _b.name, value = _b.value;
|
|
4286
|
+
setFormData(__assign(__assign({}, formData), (_a = {}, _a[name] = value, _a)));
|
|
4287
|
+
};
|
|
4288
|
+
return (jsxRuntime.jsxs(antd.Form, __assign({ className: "flex w-1/2 flex-col justify-between h-full", onFinish: function () { return onSubmit(formData); } }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex flex-col space-y-2" }, { children: [jsxRuntime.jsx(antd.Form.Item, __assign({ rules: [{ required: true, message: "Please input your first name!" }], initialValue: formData.firstName }, { children: jsxRuntime.jsx(antd.Input, { placeholder: "First name", value: formData.firstName, onChange: function (e) {
|
|
4289
|
+
handleInputChange(e);
|
|
4290
|
+
setFormData(__assign(__assign({}, formData), { firstName: e.target.value }));
|
|
4291
|
+
} }) })), jsxRuntime.jsx(antd.Form.Item, __assign({ rules: [{ required: true, message: "Please input your last name!" }], initialValue: formData.lastName }, { children: jsxRuntime.jsx(antd.Input, { placeholder: "Last name", value: formData.lastName, onChange: function (e) {
|
|
4292
|
+
handleInputChange(e);
|
|
4293
|
+
setFormData(__assign(__assign({}, formData), { lastName: e.target.value }));
|
|
4294
|
+
} }) })), jsxRuntime.jsx(antd.Form.Item, __assign({ rules: [
|
|
4295
|
+
{ required: true, message: "Please input your email!" },
|
|
4296
|
+
{ type: "email", message: "Please enter a valid email!" },
|
|
4297
|
+
], initialValue: formData.email }, { children: jsxRuntime.jsx(antd.Input, { placeholder: "Email", value: formData.email, onChange: function (e) {
|
|
4298
|
+
handleInputChange(e);
|
|
4299
|
+
setFormData(__assign(__assign({}, formData), { email: e.target.value }));
|
|
4300
|
+
} }) })), jsxRuntime.jsx(antd.Form.Item, __assign({ rules: [
|
|
4301
|
+
{ required: true, message: "Please input your account name!" },
|
|
4302
|
+
], initialValue: formData.accountName }, { children: jsxRuntime.jsx(antd.Input, { placeholder: "Account name", value: formData.accountName, onChange: function (e) {
|
|
4303
|
+
handleInputChange(e);
|
|
4304
|
+
setFormData(__assign(__assign({}, formData), { accountName: e.target.value }));
|
|
4305
|
+
} }) }))] })), jsxRuntime.jsx(antd.Form.Item, { children: jsxRuntime.jsx(antd.Button, __assign({ type: "primary", htmlType: "submit", loading: submitting, className: "w-full mt-4" }, { children: "Proceed to payment" })) })] })));
|
|
4306
|
+
}
|
|
4307
|
+
|
|
4308
|
+
var Title = antd.Typography.Title, Text$5 = antd.Typography.Text;
|
|
4309
|
+
function PaymentSuccessDisplay(_a) {
|
|
4310
|
+
var className = _a.className, amountPaid = _a.amountPaid, style = _a.style, returnUrl = _a.returnUrl;
|
|
4311
|
+
var window = React.useContext(BunnyContext).window;
|
|
4312
|
+
var companyName = common.useCurrentUserData().companyName;
|
|
4313
|
+
return (jsxRuntime.jsxs("div", __assign({ className: "flex flex-col items-center justify-center h-full ".concat(className), style: style }, { children: [jsxRuntime.jsx(CheckCircleFilled$1, { style: { fontSize: "48px", color: "rgb(52 211 153)" } }), jsxRuntime.jsxs(Title, __assign({ level: 3, className: "mt-2 m-0" }, { children: ["Payment of ", common.Misc.formatCurrency(amountPaid, "USD"), " successful"] })), returnUrl && (jsxRuntime.jsxs(Text$5, __assign({ className: "text-slate-500 cursor-pointer underline", onClick: function () { return (window.location.href = returnUrl); } }, { children: ["Back to ", companyName] })))] })));
|
|
4314
|
+
}
|
|
4315
|
+
|
|
4316
|
+
var Text$4 = antd.Typography.Text;
|
|
4317
|
+
function PriceListDisplay(_a) {
|
|
4318
|
+
var priceListData = _a.priceListData, topNavImageUrl = _a.topNavImageUrl;
|
|
4319
|
+
if (!priceListData)
|
|
4320
|
+
return null;
|
|
4321
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx("div", __assign({ className: "flex flex-col justify-between h-full my-12" }, { children: jsxRuntime.jsxs("div", __assign({ className: "flex flex-col space-y-8" }, { children: [jsxRuntime.jsx(antd.Image, { width: 24, src: topNavImageUrl, alt: "Logo", preview: false }), jsxRuntime.jsxs("div", __assign({ className: "flex flex-col" }, { children: [jsxRuntime.jsx(Text$4, __assign({ className: "text-slate-500 font-bold text-lg" }, { children: priceListData.name })), jsxRuntime.jsxs(Text$4, __assign({ className: "font-bold text-xl" }, { children: [common.Misc.formatCurrency(priceListData.basePrice, priceListData.currencyId), " ", "/ month"] }))] })), jsxRuntime.jsxs("div", __assign({ className: "flex flex-col" }, { children: [jsxRuntime.jsxs(Text$4, __assign({ style: { fontSize: "16px" }, className: "text-slate-500" }, { children: [priceListData.trialLengthDays, " day trial"] })), jsxRuntime.jsx(Text$4, __assign({ className: "text-slate-500", style: { fontSize: "12px" } }, { children: "You will not be charged until the last day of the trial." }))] }))] })) })) }));
|
|
4330
4322
|
}
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
var
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4323
|
+
|
|
4324
|
+
var BunnyFooterIcon = function (_a) {
|
|
4325
|
+
var color = _a.color;
|
|
4326
|
+
return (jsxRuntime.jsxs("svg", __assign({ width: "45", height: "15", viewBox: "0 0 39 13", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: [jsxRuntime.jsxs("g", __assign({ clipPath: "url(#clip0_6_851)" }, { children: [jsxRuntime.jsx("path", { className: "icon-path", d: "M14.5898 7.19708C14.5898 9.35053 13.0926 10.325 11.2495 10.325C9.39955 10.325 7.90234 9.35001 7.90234 7.18967V3.26221H10.1125V7.00052C10.1125 7.87719 10.5855 8.27725 11.2495 8.27725C11.9061 8.27725 12.3865 7.87719 12.3865 7.00052V3.26221H14.5898V7.19708Z", fill: color }), jsxRuntime.jsx("path", { className: "icon-path", d: "M31.8943 12.9625H29.4793L31.8523 8.62816L28.9355 3.26221H31.4708L33.0457 6.35524L34.5924 3.26221H37.0075L31.8943 12.9625Z", fill: color }), jsxRuntime.jsx("path", { className: "icon-path", d: "M15.1602 5.96827C15.1602 3.8148 16.6574 2.84033 18.5005 2.84033C20.3504 2.84033 21.8476 3.81533 21.8476 5.97568V10.1473H19.6374V6.16483C19.6374 5.28815 19.1645 4.8881 18.5005 4.8881C17.8439 4.8881 17.3634 5.28815 17.3634 6.16483V10.1473H15.1602V5.96827Z", fill: color }), jsxRuntime.jsx("path", { className: "icon-path", d: "M22.4316 5.96827C22.4316 3.8148 23.9289 2.84033 25.7719 2.84033C27.6219 2.84033 29.1191 3.81533 29.1191 5.97568V10.1473H26.9089V6.16483C26.9089 5.28815 26.4359 4.8881 25.7719 4.8881C25.1154 4.8881 24.6349 5.28815 24.6349 6.16483V10.1473H22.4316V5.96827Z", fill: color }), jsxRuntime.jsx("path", { className: "icon-path", d: "M7.40511 6.68957C7.40511 8.7236 6.02815 10.3227 4.17816 10.3227C3.23907 10.3227 2.61071 9.94378 2.19358 9.40371V10.1404H0.0605469V0.0405273H2.26381V3.91939C2.68041 3.42158 3.28802 3.07069 4.17763 3.07069C6.02759 3.07069 7.40511 4.66981 7.40511 6.68957ZM2.17229 6.69642C2.17229 7.60802 2.77937 8.2744 3.64823 8.2744C4.53783 8.2744 5.13107 7.59372 5.13107 6.69642C5.13107 5.79912 4.53783 5.11844 3.64823 5.11844C2.77937 5.11844 2.17229 5.78482 2.17229 6.69642Z", fill: color }), jsxRuntime.jsx("path", { className: "icon-path", d: "M38.966 8.94801C38.966 9.76181 38.2668 10.4631 37.4618 10.4631C36.6499 10.4631 35.9434 9.76181 35.9434 8.94801C35.9434 8.14846 36.6494 7.46094 37.4618 7.46094C38.2668 7.46094 38.966 8.14846 38.966 8.94801Z", fill: color })] })), jsxRuntime.jsx("defs", { children: jsxRuntime.jsx("clipPath", __assign({ id: "clip0_6_851" }, { children: jsxRuntime.jsx("rect", { width: "39", height: "13", fill: "white" }) })) })] })));
|
|
4327
|
+
};
|
|
4328
|
+
|
|
4329
|
+
var Footer = function (_a) {
|
|
4330
|
+
var className = _a.className;
|
|
4331
|
+
var _b = common.useCurrentUserData(), privacyUrl = _b.privacyUrl, termsUrl = _b.termsUrl;
|
|
4332
|
+
var window = React.useContext(BunnyContext).window;
|
|
4333
|
+
var isMobile = useIsMobile(window);
|
|
4334
|
+
var quotePreviewData = recoil.useRecoilValue(planPickerQuoteDataState);
|
|
4335
|
+
var selectedPriceList = quotePreviewData === null || quotePreviewData === void 0 ? void 0 : quotePreviewData.priceList;
|
|
4336
|
+
if (selectedPriceList && isMobile)
|
|
4337
|
+
return null;
|
|
4338
|
+
return (jsxRuntime.jsxs("div", __assign({ className: "flex items-center justify-between shrink-0 ".concat(className, " ").concat(isMobile ? "flex-col gap-2 grow" : "") }, { children: [(termsUrl || privacyUrl) && (jsxRuntime.jsxs("div", __assign({ className: "flex items-center gap-3" }, { children: [termsUrl && (jsxRuntime.jsx(StyedLink, __assign({ className: "text-xs text-slate-400", href: termsUrl, rel: "noopener noreferrer", target: "_blank", type: "text" }, { children: "Terms" }))), privacyUrl && (jsxRuntime.jsx(StyedLink, __assign({ className: "text-xs text-slate-400", href: privacyUrl, rel: "noopener noreferrer", target: "_blank", type: "text" }, { children: "Privacy" })))] }))), jsxRuntime.jsx(BunnyMarketingLink, {})] })));
|
|
4339
|
+
};
|
|
4340
|
+
var BunnyMarketingLink = function () {
|
|
4341
|
+
var _a = React.useState(false), isHovered = _a[0], setIsHovered = _a[1];
|
|
4342
|
+
var window = React.useContext(BunnyContext).window;
|
|
4343
|
+
var isMobile = useIsMobile(window);
|
|
4344
|
+
return (jsxRuntime.jsx("div", __assign({ className: "flex items-end justify-end ".concat(isMobile ? "" : "grow") }, { children: jsxRuntime.jsx(StyledBunnyLink, __assign({ className: "flex items-end justify-end text-slate-400", href: "https://bunny.com/", rel: "noopener noreferrer", target: "_blank", type: "text" }, { children: jsxRuntime.jsxs("div", __assign({ className: "flex items-center", onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); } }, { children: ["Powered by\u00A0", jsxRuntime.jsx("div", __assign({ style: { paddingTop: "5px" } }, { children: jsxRuntime.jsx(BunnyFooterIcon, { color: isHovered ? common.PRIMARY_COLOR : common.SLATE_400 }) }))] })) })) })));
|
|
4345
|
+
};
|
|
4346
|
+
var StyedLink = styled__default["default"].a(templateObject_1$3 || (templateObject_1$3 = __makeTemplateObject(["\n color: ", ";\n transition: color 0.3s;\n &:hover {\n color: ", ";\n }\n"], ["\n color: ", ";\n transition: color 0.3s;\n &:hover {\n color: ", ";\n }\n"])), common.SLATE_400, common.SLATE_500);
|
|
4347
|
+
var StyledBunnyLink = styled__default["default"](StyedLink)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n &:hover {\n color: ", " !important;\n }\n"], ["\n &:hover {\n color: ", " !important;\n }\n"])), common.PRIMARY_COLOR);
|
|
4348
|
+
var templateObject_1$3, templateObject_2;
|
|
4349
|
+
|
|
4350
|
+
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";
|
|
4351
|
+
var portalSessionCreate = function (_a) {
|
|
4352
|
+
var tenantCode = _a.tenantCode, expiry = _a.expiry, returnUrl = _a.returnUrl, token = _a.token, subdomain = _a.subdomain;
|
|
4353
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
4354
|
+
var response, errors;
|
|
4355
|
+
var _b;
|
|
4356
|
+
return __generator(this, function (_c) {
|
|
4357
|
+
switch (_c.label) {
|
|
4358
|
+
case 0: return [4 /*yield*/, common.gqlRequest({
|
|
4359
|
+
query: MUTATION$1,
|
|
4360
|
+
token: token,
|
|
4361
|
+
vars: { tenantCode: tenantCode, expiry: expiry, returnUrl: returnUrl },
|
|
4362
|
+
subdomain: subdomain,
|
|
4363
|
+
})];
|
|
4364
|
+
case 1:
|
|
4365
|
+
response = _c.sent();
|
|
4366
|
+
errors = (response === null || response === void 0 ? void 0 : response.portalSessionCreate).errors;
|
|
4367
|
+
if (errors)
|
|
4368
|
+
throw errors;
|
|
4369
|
+
return [2 /*return*/, (_b = response === null || response === void 0 ? void 0 : response.portalSessionCreate) === null || _b === void 0 ? void 0 : _b.token];
|
|
4370
|
+
}
|
|
4371
|
+
});
|
|
4372
|
+
});
|
|
4373
|
+
};
|
|
4374
|
+
|
|
4375
|
+
var showErrorNotification = common.NotificationUtils.useErrorNotification();
|
|
4376
|
+
function Signup(_a) {
|
|
4377
|
+
var priceListCode = _a.priceListCode, returnUrl = _a.returnUrl;
|
|
4378
|
+
// Hooks
|
|
4379
|
+
var _b = React.useContext(BunnyContext), subdomain = _b.subdomain, token = _b.token, window = _b.window;
|
|
4380
|
+
reactQuery.useQuery({
|
|
4381
|
+
queryKey: common.QueryKeyFactory.default.currentUserKey,
|
|
4382
|
+
queryFn: function () { return getCurrentUserData({ token: token, subdomain: subdomain }); },
|
|
4383
|
+
});
|
|
4384
|
+
var isMobile = useIsMobile(window);
|
|
4385
|
+
var topNavImageUrl = React.useContext(BrandContext).topNavImageUrl;
|
|
4386
|
+
var entityId = common.useCurrentUserData().entityId;
|
|
4387
|
+
var _c = React.useState(undefined), quote = _c[0], setQuote = _c[1];
|
|
4388
|
+
var _d = React.useState(undefined), accountId = _d[0], setAccountId = _d[1];
|
|
4389
|
+
var _e = React.useState(undefined), quoteId = _e[0], setQuoteId = _e[1];
|
|
4390
|
+
var _f = React.useState(undefined), portalSessionToken = _f[0], setPortalSessionToken = _f[1];
|
|
4391
|
+
var _g = React.useState(undefined), formData = _g[0], setFormData = _g[1];
|
|
4392
|
+
var _h = React.useState(false), proceedingToPayment = _h[0], setProceedingToPayment = _h[1];
|
|
4393
|
+
var _j = React.useState(false), paying = _j[0], setIsPaying = _j[1];
|
|
4394
|
+
var _k = React.useState(false), purchaseSucceeded = _k[0], setPurchaseSucceeded = _k[1];
|
|
4338
4395
|
// Queries
|
|
4339
|
-
var
|
|
4340
|
-
queryKey: ["
|
|
4341
|
-
queryFn: function () { return
|
|
4342
|
-
placeholderData: reactQuery.keepPreviousData,
|
|
4396
|
+
var priceListData = reactQuery.useQuery({
|
|
4397
|
+
queryKey: ["priceList", priceListCode],
|
|
4398
|
+
queryFn: function () { return getPriceList({ token: token, subdomain: subdomain, code: priceListCode }); },
|
|
4343
4399
|
}).data;
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4400
|
+
function handleSubmit(formData) {
|
|
4401
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4402
|
+
var data, portalSessionToken;
|
|
4403
|
+
return __generator(this, function (_a) {
|
|
4404
|
+
switch (_a.label) {
|
|
4405
|
+
case 0:
|
|
4406
|
+
setProceedingToPayment(true);
|
|
4407
|
+
setFormData(formData);
|
|
4408
|
+
return [4 /*yield*/, quoteAccountSignup({
|
|
4409
|
+
token: token,
|
|
4410
|
+
subdomain: subdomain,
|
|
4411
|
+
entityId: entityId,
|
|
4412
|
+
priceListCode: priceListCode,
|
|
4413
|
+
accountName: formData.accountName,
|
|
4414
|
+
billingContact: {
|
|
4415
|
+
firstName: formData.firstName,
|
|
4416
|
+
lastName: formData.lastName,
|
|
4417
|
+
email: formData.email,
|
|
4418
|
+
},
|
|
4419
|
+
})];
|
|
4420
|
+
case 1:
|
|
4421
|
+
data = _a.sent();
|
|
4422
|
+
setAccountId(data.account.id);
|
|
4423
|
+
return [4 /*yield*/, portalSessionCreate({
|
|
4424
|
+
token: token,
|
|
4425
|
+
subdomain: subdomain,
|
|
4426
|
+
tenantCode: data.tenant.code,
|
|
4427
|
+
expiry: 24,
|
|
4428
|
+
returnUrl: returnUrl || "",
|
|
4429
|
+
})];
|
|
4430
|
+
case 2:
|
|
4431
|
+
portalSessionToken = _a.sent();
|
|
4432
|
+
setPortalSessionToken(portalSessionToken);
|
|
4433
|
+
setQuoteId(data.quote.id);
|
|
4434
|
+
setProceedingToPayment(false);
|
|
4435
|
+
setQuote({
|
|
4436
|
+
amountDue: data.quote.amountDue,
|
|
4437
|
+
currencyId: data.quote.currencyId,
|
|
4438
|
+
});
|
|
4439
|
+
return [2 /*return*/];
|
|
4440
|
+
}
|
|
4441
|
+
});
|
|
4442
|
+
});
|
|
4443
|
+
}
|
|
4444
|
+
function handlePaymentSaveSuccess(paymentSuccess) {
|
|
4445
|
+
var _a;
|
|
4446
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4447
|
+
var response, plugin;
|
|
4448
|
+
return __generator(this, function (_b) {
|
|
4449
|
+
switch (_b.label) {
|
|
4450
|
+
case 0:
|
|
4451
|
+
if (!formData) {
|
|
4452
|
+
throw new Error("Form data is required");
|
|
4453
|
+
}
|
|
4454
|
+
response = paymentSuccess.pluginPaymentResponse;
|
|
4455
|
+
plugin = response === null || response === void 0 ? void 0 : response.plugin;
|
|
4456
|
+
if (!(plugin === null || plugin === void 0 ? void 0 : plugin.id)) {
|
|
4457
|
+
throw new Error("Plugin ID is required");
|
|
4458
|
+
}
|
|
4459
|
+
if (!accountId) {
|
|
4460
|
+
throw new Error("Account ID is required");
|
|
4461
|
+
}
|
|
4462
|
+
if (!portalSessionToken) {
|
|
4463
|
+
throw new Error("Portal session token is required");
|
|
4464
|
+
}
|
|
4465
|
+
return [4 /*yield*/, accountSignup({
|
|
4466
|
+
token: portalSessionToken,
|
|
4467
|
+
subdomain: subdomain,
|
|
4468
|
+
entityId: entityId,
|
|
4469
|
+
quoteId: quoteId,
|
|
4470
|
+
paymentMethodId: (_a = paymentSuccess.savedPaymentMethodResponse) === null || _a === void 0 ? void 0 : _a.paymentMethodId.toString(),
|
|
4471
|
+
pluginId: plugin.id.toString(),
|
|
4472
|
+
priceListCode: priceListCode,
|
|
4473
|
+
accountId: accountId,
|
|
4474
|
+
})];
|
|
4475
|
+
case 1:
|
|
4476
|
+
_b.sent();
|
|
4477
|
+
setIsPaying(false);
|
|
4478
|
+
setPurchaseSucceeded(true);
|
|
4479
|
+
return [2 /*return*/];
|
|
4480
|
+
}
|
|
4481
|
+
});
|
|
4482
|
+
});
|
|
4483
|
+
}
|
|
4484
|
+
function handlePaymentFail(error) {
|
|
4485
|
+
showErrorNotification(error.message);
|
|
4486
|
+
setIsPaying(false);
|
|
4487
|
+
}
|
|
4488
|
+
if (isMobile) {
|
|
4489
|
+
return (jsxRuntime.jsx(Card, __assign({ className: "p-4 flex flex-col" }, { children: purchaseSucceeded ? (jsxRuntime.jsx(PaymentSuccessDisplay, { className: "w-full", amountPaid: (quote === null || quote === void 0 ? void 0 : quote.amountDue) || 0, returnUrl: returnUrl })) : (jsxRuntime.jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col" : "flex-row", " h-full w-full") }, { children: [jsxRuntime.jsx("div", __assign({ className: "flex flex-col items-center" }, { children: jsxRuntime.jsx(PriceListDisplay, { priceListData: priceListData, topNavImageUrl: topNavImageUrl }) })), jsxRuntime.jsx("div", __assign({ className: "mx-8" }, { children: jsxRuntime.jsx(antd.Divider, { className: "h-full" }) })), jsxRuntime.jsx("div", __assign({ className: "flex items-center justify-center my-12" }, { children: jsxRuntime.jsx(PaymentForms, { quote: quote, paying: paying, setIsPaying: setIsPaying, handlePaymentSaveSuccess: handlePaymentSaveSuccess, handlePaymentFail: handlePaymentFail, handleSubmit: handleSubmit, proceedingToPayment: proceedingToPayment, accountId: accountId || "" }) }))] }))) })));
|
|
4490
|
+
}
|
|
4491
|
+
else {
|
|
4492
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Card, __assign({ className: "p-4 flex flex-col w-screen h-screen" }, { children: purchaseSucceeded ? (jsxRuntime.jsx(PaymentSuccessDisplay, { className: "w-full", amountPaid: (quote === null || quote === void 0 ? void 0 : quote.amountDue) || 0, returnUrl: returnUrl })) : (jsxRuntime.jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col" : "flex-row", " h-full w-full") }, { children: [jsxRuntime.jsx("div", __assign({ className: "flex flex-col w-1/2 items-center" }, { children: jsxRuntime.jsx(PriceListDisplay, { priceListData: priceListData, topNavImageUrl: topNavImageUrl }) })), jsxRuntime.jsx("div", __assign({ className: "my-4" }, { children: jsxRuntime.jsx(antd.Divider, { className: "h-full", type: "vertical" }) })), jsxRuntime.jsx("div", __assign({ className: "flex w-1/2 items-center justify-center my-12" }, { children: jsxRuntime.jsx(PaymentForms, { quote: quote, paying: paying, setIsPaying: setIsPaying, handlePaymentSaveSuccess: handlePaymentSaveSuccess, handlePaymentFail: handlePaymentFail, handleSubmit: handleSubmit, proceedingToPayment: proceedingToPayment, accountId: accountId || "" }) }))] }))) })), jsxRuntime.jsx(Footer, {})] }));
|
|
4364
4493
|
}
|
|
4365
|
-
// Since the columns are dynamic, we need to calculate the grid template columns
|
|
4366
|
-
var gridTemplateColumns = function () {
|
|
4367
|
-
var templateColumns = [];
|
|
4368
|
-
if (isMobile) {
|
|
4369
|
-
if (columns.includes("date-and-title") ||
|
|
4370
|
-
columns.includes("state") ||
|
|
4371
|
-
columns.includes("amount")) {
|
|
4372
|
-
templateColumns.push("auto");
|
|
4373
|
-
}
|
|
4374
|
-
if (columns.includes("download")) {
|
|
4375
|
-
templateColumns.push("auto");
|
|
4376
|
-
}
|
|
4377
|
-
}
|
|
4378
|
-
else {
|
|
4379
|
-
if (columns.includes("date-and-title")) {
|
|
4380
|
-
templateColumns.push("auto 3fr");
|
|
4381
|
-
}
|
|
4382
|
-
if (columns.includes("download")) {
|
|
4383
|
-
templateColumns.push("auto");
|
|
4384
|
-
}
|
|
4385
|
-
if (columns.includes("state")) {
|
|
4386
|
-
templateColumns.push("auto");
|
|
4387
|
-
}
|
|
4388
|
-
if (columns.includes("amount")) {
|
|
4389
|
-
templateColumns.push("auto");
|
|
4390
|
-
}
|
|
4391
|
-
}
|
|
4392
|
-
return templateColumns.join(" ");
|
|
4393
|
-
};
|
|
4394
|
-
var drawerTitle = function () {
|
|
4395
|
-
if (!selectedTransaction)
|
|
4396
|
-
return "";
|
|
4397
|
-
var kind = selectedTransaction.kind.toLowerCase();
|
|
4398
|
-
return kind.charAt(0).toUpperCase() + kind.slice(1);
|
|
4399
|
-
};
|
|
4400
|
-
return (jsxRuntime.jsxs("div", __assign({ style: style }, { children: [jsxRuntime.jsx(PageHeaderWithActions, __assign({ title: title || (showTitle ? "Past transactions" : undefined) }, { children: showSearchBar && (jsxRuntime.jsx("div", { children: jsxRuntime.jsx(antd.Input, { className: searchBarClassName
|
|
4401
|
-
? searchBarClassName
|
|
4402
|
-
: "border border-slate-200", onChange: function (e) {
|
|
4403
|
-
if (isNaN(Number(e.target.value))) {
|
|
4404
|
-
return;
|
|
4405
|
-
}
|
|
4406
|
-
onSearchValueChanged(e.target.value);
|
|
4407
|
-
}, prefix: jsxRuntime.jsx(SearchOutlined$1, {}), placeholder: "Search by id #", style: {
|
|
4408
|
-
minWidth: "300px",
|
|
4409
|
-
}, value: search }) })) })), jsxRuntime.jsx(PageContent, __assign({ className: "flex w-full shadow-padding-xb ".concat(isMobile ? "overflow-hidden" : "", " ").concat(className) }, { children: jsxRuntime.jsx("div", __assign({ className: "grid w-full rounded-md overflow-auto ".concat("shadow-".concat(shadow)), style: {
|
|
4410
|
-
gridTemplateColumns: gridTemplateColumns(),
|
|
4411
|
-
backgroundColor: "var(--row-background".concat(darkMode ? "-dark" : "", ")"),
|
|
4412
|
-
} }, { children: isMobile ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: TransactionsListMobile({
|
|
4413
|
-
transactions: transactions,
|
|
4414
|
-
onTransactionClick: handleTransactionClick,
|
|
4415
|
-
}) })) : (jsxRuntime.jsx(jsxRuntime.Fragment, { children: TransactionsListDesktop({
|
|
4416
|
-
transactions: transactions,
|
|
4417
|
-
onTransactionClick: handleTransactionClick,
|
|
4418
|
-
}) })) })) })), useModal ? (jsxRuntime.jsx(antd.Modal, __assign({ title: "Basic Modal", open: drawerOpen, onOk: function () { return setDrawerOpen(false); }, onCancel: function () { return setDrawerOpen(false); }, width: 900, footer: null }, { children: jsxRuntime.jsx(Invoice, { id: (selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.transactionableId) || "" }) }))) : (jsxRuntime.jsx(antd.Drawer, __assign({ title: drawerTitle(), onClose: function () { return setDrawerOpen(false); }, open: drawerOpen, width: 900 }, { children: transactionComponent ? (transactionComponent) : (selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.kind) === "INVOICE" ? (jsxRuntime.jsx(Invoice, { id: selectedTransaction.transactionableId })) : (jsxRuntime.jsxs(antd.Card, __assign({ className: "shadow-md" }, { children: [jsxRuntime.jsx(antd.Typography.Title, __assign({ level: 2, className: "mb-4" }, { children: "Transaction Details" })), jsxRuntime.jsxs(antd.Typography.Paragraph, { children: [jsxRuntime.jsx("strong", { children: "Amount:" }), " ", jsxRuntime.jsx(antd.Typography.Text, { children: common.Misc.formatCurrency((selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.amount) || 0, (selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.currencyId) || "USD") })] }), jsxRuntime.jsxs(antd.Typography.Paragraph, { children: [jsxRuntime.jsx("strong", { children: "Description:" }), " ", jsxRuntime.jsx(antd.Typography.Text, { children: selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.description })] }), jsxRuntime.jsxs(antd.Typography.Paragraph, { children: [jsxRuntime.jsx("strong", { children: "Kind:" }), " ", jsxRuntime.jsx(antd.Typography.Text, { children: selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.kind })] }), jsxRuntime.jsxs(antd.Typography.Paragraph, { children: [jsxRuntime.jsx("strong", { children: "State:" }), " ", jsxRuntime.jsx(antd.Typography.Text, { children: selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.state })] })] }))) })))] })));
|
|
4419
4494
|
}
|
|
4420
4495
|
|
|
4421
4496
|
var updatingChargeQuantityIdState = recoil.atom({
|
|
@@ -5543,6 +5618,7 @@ exports.Checkout = Checkout;
|
|
|
5543
5618
|
exports.Invoice = Invoice;
|
|
5544
5619
|
exports.PaymentMethod = PaymentMethod;
|
|
5545
5620
|
exports.Quote = Quote;
|
|
5621
|
+
exports.Quotes = Quotes;
|
|
5546
5622
|
exports.Signup = Signup;
|
|
5547
5623
|
exports.Subscriptions = Subscriptions;
|
|
5548
5624
|
exports.Transactions = Transactions;
|