@bunnyapp/components 1.0.14 → 1.0.16
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 +649 -814
- package/dist/cjs/src/components/BillingDetails/BillingDetails.d.ts +7 -2
- package/dist/cjs/src/components/PaymentForm/CheckoutFooter.d.ts +3 -4
- package/dist/cjs/src/components/PaymentForm/DemoPay/hooks/usePay.d.ts +5 -6
- package/dist/cjs/src/components/PaymentForm/PaymentForm.d.ts +4 -4
- package/dist/cjs/src/components/PaymentForm/PaymentFormTypes.d.ts +3 -28
- package/dist/cjs/src/components/PaymentForm/PaymentMethodDetails.d.ts +1 -2
- package/dist/cjs/src/components/PaymentForm/PaymentMethodSelector.d.ts +3 -3
- package/dist/cjs/src/components/PaymentForm/Stripe/StripeForm.d.ts +1 -1
- package/dist/cjs/src/components/PaymentForm/Stripe/hooks/usePay.d.ts +5 -5
- package/dist/cjs/src/components/Signup/PaymentForms.d.ts +4 -4
- package/dist/cjs/src/components/Signup/Signup.d.ts +1 -3
- package/dist/cjs/src/contexts/PaymentContext.d.ts +3 -0
- package/dist/cjs/src/hooks/usePaymentMethod.d.ts +1 -1
- package/dist/cjs/src/hooks/useToken.d.ts +2 -0
- package/dist/esm/index.js +652 -817
- package/dist/esm/src/components/BillingDetails/BillingDetails.d.ts +7 -2
- package/dist/esm/src/components/PaymentForm/CheckoutFooter.d.ts +3 -4
- package/dist/esm/src/components/PaymentForm/DemoPay/hooks/usePay.d.ts +5 -6
- package/dist/esm/src/components/PaymentForm/PaymentForm.d.ts +4 -4
- package/dist/esm/src/components/PaymentForm/PaymentFormTypes.d.ts +3 -28
- package/dist/esm/src/components/PaymentForm/PaymentMethodDetails.d.ts +1 -2
- package/dist/esm/src/components/PaymentForm/PaymentMethodSelector.d.ts +3 -3
- package/dist/esm/src/components/PaymentForm/Stripe/StripeForm.d.ts +1 -1
- package/dist/esm/src/components/PaymentForm/Stripe/hooks/usePay.d.ts +5 -5
- package/dist/esm/src/components/Signup/PaymentForms.d.ts +4 -4
- package/dist/esm/src/components/Signup/Signup.d.ts +1 -3
- package/dist/esm/src/contexts/PaymentContext.d.ts +3 -0
- package/dist/esm/src/hooks/usePaymentMethod.d.ts +1 -1
- package/dist/esm/src/hooks/useToken.d.ts +2 -0
- package/dist/index.d.ts +10 -9
- package/package.json +4 -3
- package/dist/cjs/src/components/Checkout/InvoiceCheckout.d.ts +0 -8
- package/dist/cjs/src/components/Transactions/DocumentNameEnum.d.ts +0 -4
- package/dist/cjs/src/components/icons/BunnyFooterIcon.d.ts +0 -4
- package/dist/cjs/src/consts/paymentConsts.d.ts +0 -16
- package/dist/cjs/src/graphql/mutations/quoteCreate.d.ts +0 -9
- package/dist/cjs/src/graphql/queries/getInvoice.d.ts +0 -7
- package/dist/cjs/src/graphql/queries/getSubscription.d.ts +0 -12
- package/dist/esm/src/components/Checkout/InvoiceCheckout.d.ts +0 -8
- package/dist/esm/src/components/Transactions/DocumentNameEnum.d.ts +0 -4
- package/dist/esm/src/components/icons/BunnyFooterIcon.d.ts +0 -4
- package/dist/esm/src/consts/paymentConsts.d.ts +0 -16
- package/dist/esm/src/graphql/mutations/quoteCreate.d.ts +0 -9
- package/dist/esm/src/graphql/queries/getInvoice.d.ts +0 -7
- package/dist/esm/src/graphql/queries/getSubscription.d.ts +0 -12
package/dist/cjs/index.js
CHANGED
|
@@ -71,7 +71,7 @@ function styleInject(css, ref) {
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
var css_248z = ".ant-collapse-header {\n cursor: default !important;\n padding: 0 !important;\n}\n.ant-tag {\n border: none;\n border-radius: 14px;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n font-weight: 500;\n white-space: nowrap;\n margin: 0;\n}\n.ant-tag-blue {\n color: #3b82f6 !important;\n background: #bfdbfe !important;\n}\n.ant-tag-green {\n color: #059669 !important;\n background: #a7f3d0 !important;\n}\n.ant-tag-red {\n color: #ef4444 !important;\n background: #fecaca !important;\n}\n.ant-tag-orange {\n color: #f97316 !important;\n background: #fed7aa !important;\n}\n.ant-tag-yellow {\n color: #f59e0b !important;\n background: #fde68a !important;\n}\n.ant-tag-purple {\n color: #8b5cf6 !important;\n background: #ddd6fe !important;\n}\n.ant-tag-black {\n color: white !important;\n background: black !important;\n}\n.ant-popover {\n z-index: 1050;\n}\n.ant-popover-inner-content {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n max-width: 300px;\n}\n.ant-popover-message-title {\n padding: 0;\n text-align: center;\n font-size: 1rem;\n}\n.ant-popover-buttons {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.ant-btn-link:disabled {\n color: #717d94 !important;\n}\n.ant-btn-link:disabled:hover {\n background-color: transparent !important;\n}\n.ant-input-affix-wrapper .ant-input-prefix {\n transition: color 0.3s;\n}\n.ant-form-item-label {\n text-transform: none !important;\n font-size: 0.75rem;\n padding-bottom: 2px !important;\n}\n.ant-form-item-label > label {\n width: 100%;\n color: #4b5563 !important;\n}\n.ant-form-item-explain-error {\n font-size: 11px;\n min-height: 11px;\n line-height: 11px;\n padding-top: 2px;\n}\n.ant-form-item {\n margin-bottom: 0;\n}\n.ant-notification {\n width: min-content;\n}\n.ant-notification-topRight {\n right: 0 !important;\n left: 0 !important;\n margin-left: auto !important;\n margin-right: auto !important;\n}\n.ant-notification-notice-wrapper {\n width: 350px !important;\n overflow: hidden !important;\n}\n.ant-notification-notice {\n padding: 16px !important;\n width: 350px !important;\n display: flex !important;\n box-shadow: 0px 6px 10px rgba(0, 0, 0, 0.08), 0px 1px 18px rgba(0, 0, 0, 0.08), 0px 3px 5px rgba(0, 0, 0, 0.16) !important;\n}\n.ant-notification-notice-description {\n padding: 0 14px 0 0 !important;\n color: #232323 !important;\n font-size: 14px !important;\n word-break: break-all !important;\n overflow-wrap: break-word !important;\n}\n.ant-notification-notice-success {\n background-color: #edfffa !important;\n}\n.ant-notification-notice-error {\n background-color: #fff8f4 !important;\n}\n.ant-notification-notice-error .ant-notification-notice-message {\n color: #ff6e1c !important;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji !important;\n font-weight: 500;\n}\n.ant-notification-notice-error .ant-notification-notice-icon {\n color: #ff6e1c;\n}\n.ant-notification-notice-success .ant-notification-notice-message {\n color: #00b76a !important;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji !important;\n font-weight: 500;\n}\n.ant-notification-notice-success .ant-notification-notice-icon {\n color: #00b76a !important;\n}\n.ant-notification-notice-message {\n margin-bottom: 0 !important;\n}\n.ant-notification-notice-close {\n top: 16px !important;\n right: 16px !important;\n}\n.ant-menu-submenu-popup > .ant-menu .ant-menu-item {\n display: flex !important;\n align-items: center !important;\n}\n.ant-menu-submenu::after {\n display: none !important;\n}\n.ant-drawer-title {\n font-weight: 400 !important;\n}\n.ant-drawer-header-title {\n flex-direction: row-reverse !important;\n align-items: start !important ;\n}\n.ant-drawer-close {\n margin-inline-end: 0 !important;\n}\n@media (min-width: 768px) {\n .ant-input,\n .ant-picker,\n .ant-select,\n .ant-input-affix-wrapper {\n font-size: 1rem !important;\n }\n .ant-drawer-header {\n padding-right: 1.5rem !important;\n padding-left: 1.5rem !important;\n }\n}\n:root {\n --row-background: #ffffff;\n --row-background-alternate: rgba(100, 116, 139, 0.04);\n --row-background-dark: #121212;\n --row-background-alternate-dark: #1e1e1e;\n}\n.plan-step-line {\n height: 1px;\n min-width: 128px;\n background: #717d94;\n}\n.plan-step-number {\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 9999px;\n border: 1px solid #717d94;\n background: white;\n width: 24px;\n height: 24px;\n color: #717d94;\n}\n.plan-step-number.active {\n border: none;\n color: white;\n background: #ff6e1c;\n}\n.hidden {\n display: none;\n}\n.cardElement {\n padding: 8px 11px;\n border: 1px solid #e5e7eb;\n background-color: white;\n font-family: Inter !important;\n}\n.tooltip {\n visibility: hidden;\n position: absolute !important;\n}\n.has-tooltip:hover .tooltip {\n visibility: visible;\n z-index: 100;\n}\n.show-on-hover {\n opacity: 0;\n}\n.show-on-hover-container:hover .show-on-hover {\n opacity: 1;\n}\n.pdf-only {\n display: none !important;\n}\n.notes p {\n margin: 0;\n padding: 0;\n padding-bottom: 0.25rem;\n}\n#form-element #finix-form-container .field-holder label {\n color: #717d94 !important;\n font-size: 12px !important;\n}\n#form-element #finix-form-container > *:first-child,\n#form-element #finix-form-container > *:last-child {\n margin-top: 0 !important;\n}\n#form-element #finix-form-container > *:not(:first-child):not(:last-child) {\n margin-top: 12px !important;\n}\n#form-element #finix-form-container .field-array > * {\n margin-top: 0 !important;\n}\n#form-element #finix-form-container .field-holder .field,\n#form-element #finix-form-container iframe {\n height: 34px !important;\n}\n#form-element #finix-form-container .field {\n margin-top: 0 !important;\n padding-top: 2px !important;\n}\n#form-element #finix-form-container .field-holder .validation {\n font-size: 11px !important;\n color: #ff4d4f !important;\n}\n.icon-path {\n transition: fill 0.3s;\n}\n.shadow-padding-x {\n padding-right: 1rem;\n padding-left: 1rem;\n}\n.shadow-padding-xb {\n padding-right: 1rem;\n padding-left: 1rem;\n padding-bottom: 0.5rem;\n}\n.content-container {\n width: 100%;\n margin: 0 auto;\n}\n@media (min-width: 1220px) {\n .content-container {\n width: 1220px !important;\n margin: 0 auto;\n }\n}\n@media (min-width: 768px) {\n .shadow-padding-x {\n padding-right: 2rem;\n padding-left: 2rem;\n }\n .shadow-padding-xb {\n padding-right: 2rem;\n padding-left: 2rem;\n padding-bottom: 0.5rem;\n }\n .sm\\:flex {\n display: flex !important;\n }\n .sm\\:hidden {\n display: none !important;\n }\n}\n.rotate-45,\n.transform {\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n}\n.shadow,\n.shadow-lg,\n.shadow-md,\n.shadow-none,\n.shadow-sm,\n.shadow-xl {\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n}\n.container {\n width: 100%;\n}\n@media (min-width: 768px) {\n .container {\n max-width: 768px;\n }\n}\n@media (min-width: 1024px) {\n .container {\n max-width: 1024px;\n }\n}\n@media (min-width: 1280px) {\n .container {\n max-width: 1280px;\n }\n}\n@media (min-width: 1536px) {\n .container {\n max-width: 1536px;\n }\n}\n.visible {\n visibility: visible;\n}\n.fixed {\n position: fixed;\n}\n.absolute {\n position: absolute;\n}\n.relative {\n position: relative;\n}\n.bottom-0 {\n bottom: 0px;\n}\n.left-0 {\n left: 0px;\n}\n.right-0 {\n right: 0px;\n}\n.top-0 {\n top: 0px;\n}\n.z-50 {\n z-index: 50;\n}\n.col-span-2 {\n grid-column: span 2 / span 2;\n}\n.col-span-3 {\n grid-column: span 3 / span 3;\n}\n.m-0 {\n margin: 0px;\n}\n.mx-4 {\n margin-left: 1rem;\n margin-right: 1rem;\n}\n.my-12 {\n margin-top: 3rem;\n margin-bottom: 3rem;\n}\n.my-2 {\n margin-top: 0.5rem;\n margin-bottom: 0.5rem;\n}\n.my-4 {\n margin-top: 1rem;\n margin-bottom: 1rem;\n}\n.mb-4 {\n margin-bottom: 1rem;\n}\n.ml-2 {\n margin-left: 0.5rem;\n}\n.mr-8 {\n margin-right: 2rem;\n}\n.mt-1 {\n margin-top: 0.25rem;\n}\n.mt-2 {\n margin-top: 0.5rem;\n}\n.mt-4 {\n margin-top: 1rem;\n}\n.mt-6 {\n margin-top: 1.5rem;\n}\n.mt-8 {\n margin-top: 2rem;\n}\n.block {\n display: block;\n}\n.flex {\n display: flex;\n}\n.table {\n display: table;\n}\n.grid {\n display: grid;\n}\n.contents {\n display: contents;\n}\n.hidden {\n display: none;\n}\n.h-4 {\n height: 1rem;\n}\n.h-5 {\n height: 1.25rem;\n}\n.h-8 {\n height: 2rem;\n}\n.h-full {\n height: 100%;\n}\n.w-1\\/2 {\n width: 50%;\n}\n.w-1\\/3 {\n width: 33.333333%;\n}\n.w-2\\/3 {\n width: 66.666667%;\n}\n.w-4 {\n width: 1rem;\n}\n.w-full {\n width: 100%;\n}\n.max-w-32 {\n max-width: 8rem;\n}\n.flex-1 {\n flex: 1 1 0%;\n}\n.shrink-0 {\n flex-shrink: 0;\n}\n.grow {\n flex-grow: 1;\n}\n.border-collapse {\n border-collapse: collapse;\n}\n.rotate-45 {\n --tw-rotate: 45deg;\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.transform {\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.cursor-pointer {\n cursor: pointer;\n}\n.grid-cols-2 {\n grid-template-columns: repeat(2, minmax(0, 1fr));\n}\n.grid-cols-3 {\n grid-template-columns: repeat(3, minmax(0, 1fr));\n}\n.flex-row {\n flex-direction: row;\n}\n.flex-col {\n flex-direction: column;\n}\n.items-end {\n align-items: flex-end;\n}\n.items-center {\n align-items: center;\n}\n.justify-start {\n justify-content: flex-start;\n}\n.justify-end {\n justify-content: flex-end;\n}\n.justify-center {\n justify-content: center;\n}\n.justify-between {\n justify-content: space-between;\n}\n.gap-0 {\n gap: 0px;\n}\n.gap-1 {\n gap: 0.25rem;\n}\n.gap-2 {\n gap: 0.5rem;\n}\n.gap-4 {\n gap: 1rem;\n}\n.gap-6 {\n gap: 1.5rem;\n}\n.space-y-2 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(0.5rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(0.5rem * var(--tw-space-y-reverse));\n}\n.space-y-4 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(1rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(1rem * var(--tw-space-y-reverse));\n}\n.space-y-8 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(2rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(2rem * var(--tw-space-y-reverse));\n}\n.overflow-auto {\n overflow: auto;\n}\n.overflow-hidden {\n overflow: hidden;\n}\n.overflow-visible {\n overflow: visible;\n}\n.whitespace-nowrap {\n white-space: nowrap;\n}\n.text-nowrap {\n text-wrap: nowrap;\n}\n.rounded {\n border-radius: 0.25rem;\n}\n.rounded-full {\n border-radius: 9999px;\n}\n.rounded-md {\n border-radius: 0.375rem;\n}\n.border {\n border-width: 1px;\n}\n.border-solid {\n border-style: solid;\n}\n.border-gray-400 {\n --tw-border-opacity: 1;\n border-color: rgb(156 163 175 / var(--tw-border-opacity, 1));\n}\n.border-gray-500 {\n --tw-border-opacity: 1;\n border-color: rgb(107 114 128 / var(--tw-border-opacity, 1));\n}\n.border-slate-200 {\n --tw-border-opacity: 1;\n border-color: rgb(226 232 240 / var(--tw-border-opacity, 1));\n}\n.border-slate-300 {\n --tw-border-opacity: 1;\n border-color: rgb(203 213 225 / var(--tw-border-opacity, 1));\n}\n.border-slate-700 {\n --tw-border-opacity: 1;\n border-color: rgb(51 65 85 / var(--tw-border-opacity, 1));\n}\n.bg-black {\n --tw-bg-opacity: 1;\n background-color: rgb(0 0 0 / var(--tw-bg-opacity, 1));\n}\n.bg-emerald-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(167 243 208 / var(--tw-bg-opacity, 1));\n}\n.bg-green-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(187 247 208 / var(--tw-bg-opacity, 1));\n}\n.bg-orange-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(254 215 170 / var(--tw-bg-opacity, 1));\n}\n.bg-red-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(254 202 202 / var(--tw-bg-opacity, 1));\n}\n.bg-red-500 {\n --tw-bg-opacity: 1;\n background-color: rgb(239 68 68 / var(--tw-bg-opacity, 1));\n}\n.bg-slate-50 {\n --tw-bg-opacity: 1;\n background-color: rgb(248 250 252 / var(--tw-bg-opacity, 1));\n}\n.bg-white {\n --tw-bg-opacity: 1;\n background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));\n}\n.bg-yellow-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(254 240 138 / var(--tw-bg-opacity, 1));\n}\n.p-0 {\n padding: 0px;\n}\n.p-1 {\n padding: 0.25rem;\n}\n.p-2 {\n padding: 0.5rem;\n}\n.p-4 {\n padding: 1rem;\n}\n.p-8 {\n padding: 2rem;\n}\n.px-0 {\n padding-left: 0px;\n padding-right: 0px;\n}\n.px-2 {\n padding-left: 0.5rem;\n padding-right: 0.5rem;\n}\n.px-4 {\n padding-left: 1rem;\n padding-right: 1rem;\n}\n.px-6 {\n padding-left: 1.5rem;\n padding-right: 1.5rem;\n}\n.py-1 {\n padding-top: 0.25rem;\n padding-bottom: 0.25rem;\n}\n.py-2 {\n padding-top: 0.5rem;\n padding-bottom: 0.5rem;\n}\n.py-4 {\n padding-top: 1rem;\n padding-bottom: 1rem;\n}\n.py-6 {\n padding-top: 1.5rem;\n padding-bottom: 1.5rem;\n}\n.px-3 {\n padding-left: 0.75rem;\n padding-right: 0.75rem;\n}\n.pb-2 {\n padding-bottom: 0.5rem;\n}\n.pb-4 {\n padding-bottom: 1rem;\n}\n.pb-6 {\n padding-bottom: 1.5rem;\n}\n.pb-8 {\n padding-bottom: 2rem;\n}\n.pl-0 {\n padding-left: 0px;\n}\n.pl-2 {\n padding-left: 0.5rem;\n}\n.pl-4 {\n padding-left: 1rem;\n}\n.pt-1 {\n padding-top: 0.25rem;\n}\n.pt-12 {\n padding-top: 3rem;\n}\n.pt-2 {\n padding-top: 0.5rem;\n}\n.pt-4 {\n padding-top: 1rem;\n}\n.pt-5 {\n padding-top: 1.25rem;\n}\n.pt-6 {\n padding-top: 1.5rem;\n}\n.pt-8 {\n padding-top: 2rem;\n}\n.text-left {\n text-align: left;\n}\n.text-center {\n text-align: center;\n}\n.text-right {\n text-align: right;\n}\n.align-middle {\n vertical-align: middle;\n}\n.text-2xl {\n font-size: 1.5rem;\n line-height: 2rem;\n}\n.text-base {\n font-size: 1rem;\n line-height: 1.5rem;\n}\n.text-lg {\n font-size: 1.125rem;\n line-height: 1.75rem;\n}\n.text-sm {\n font-size: 0.875rem;\n line-height: 1.25rem;\n}\n.text-xl {\n font-size: 1.25rem;\n line-height: 1.75rem;\n}\n.text-xs {\n font-size: 0.75rem;\n line-height: 1rem;\n}\n.font-bold {\n font-weight: 700;\n}\n.font-medium {\n font-weight: 500;\n}\n.font-normal {\n font-weight: 400;\n}\n.capitalize {\n text-transform: capitalize;\n}\n.text-emerald-600 {\n --tw-text-opacity: 1;\n color: rgb(5 150 105 / var(--tw-text-opacity, 1));\n}\n.text-emerald-700 {\n --tw-text-opacity: 1;\n color: rgb(4 120 87 / var(--tw-text-opacity, 1));\n}\n.text-gray-600 {\n --tw-text-opacity: 1;\n color: rgb(75 85 99 / var(--tw-text-opacity, 1));\n}\n.text-gray-900 {\n --tw-text-opacity: 1;\n color: rgb(17 24 39 / var(--tw-text-opacity, 1));\n}\n.text-green-600 {\n --tw-text-opacity: 1;\n color: rgb(22 163 74 / var(--tw-text-opacity, 1));\n}\n.text-orange-500 {\n --tw-text-opacity: 1;\n color: rgb(249 115 22 / var(--tw-text-opacity, 1));\n}\n.text-red-500 {\n --tw-text-opacity: 1;\n color: rgb(239 68 68 / var(--tw-text-opacity, 1));\n}\n.text-slate-400 {\n --tw-text-opacity: 1;\n color: rgb(148 163 184 / var(--tw-text-opacity, 1));\n}\n.text-slate-500 {\n --tw-text-opacity: 1;\n color: rgb(100 116 139 / var(--tw-text-opacity, 1));\n}\n.text-white {\n --tw-text-opacity: 1;\n color: rgb(255 255 255 / var(--tw-text-opacity, 1));\n}\n.text-yellow-500 {\n --tw-text-opacity: 1;\n color: rgb(234 179 8 / var(--tw-text-opacity, 1));\n}\n.underline {\n text-decoration-line: underline;\n}\n.shadow {\n --tw-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);\n --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.shadow-lg {\n --tw-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);\n --tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.shadow-md {\n --tw-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);\n --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.shadow-none {\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.shadow-sm {\n --tw-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n --tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.shadow-xl {\n --tw-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);\n --tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.transition {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n.font-light {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n.font-medium {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n.font-bold {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n@media (min-width: 768px) {\n .sm\\:flex {\n display: flex;\n }\n .sm\\:hidden {\n display: none;\n }\n}\n* {\n margin: 0;\n padding: 0;\n box-sizing: border-box !important;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n line-height: 1.15;\n}\nbody {\n color: #232323;\n background-color: #f8fafc;\n}\nth {\n font-weight: normal;\n}\ncode {\n font-family: source-code-pro, Menlo, Monaco, Consolas, \"Courier New\", monospace;\n}\n@media only screen and (max-width: 768px) {\n select,\n textarea,\n input[type=\"text\"],\n input[type=\"password\"],\n input[type=\"datetime\"],\n input[type=\"datetime-local\"],\n input[type=\"date\"],\n input[type=\"month\"],\n input[type=\"time\"],\n input[type=\"week\"],\n input[type=\"number\"],\n input[type=\"email\"],\n input[type=\"url\"],\n input[type=\"search\"],\n input[type=\"tel\"],\n input[type=\"color\"] {\n font-size: 16px !important;\n }\n}\n@keyframes App-logo-spin {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}\n";
|
|
74
|
+
var css_248z = ".ant-divider-horizontal {\n margin: 0;\n}\n.ant-tag {\n border: none;\n border-radius: 14px;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n font-weight: 500;\n white-space: nowrap;\n margin: 0;\n}\n.ant-tag-blue {\n color: #3b82f6 !important;\n background: #bfdbfe !important;\n}\n.ant-tag-green {\n color: #059669 !important;\n background: #a7f3d0 !important;\n}\n.ant-tag-red {\n color: #ef4444 !important;\n background: #fecaca !important;\n}\n.ant-tag-orange {\n color: #f97316 !important;\n background: #fed7aa !important;\n}\n.ant-tag-yellow {\n color: #f59e0b !important;\n background: #fde68a !important;\n}\n.ant-tag-purple {\n color: #8b5cf6 !important;\n background: #ddd6fe !important;\n}\n.ant-tag-black {\n color: white !important;\n background: black !important;\n}\n.ant-popover {\n z-index: 1050;\n}\n.ant-popover-inner-content {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n max-width: 300px;\n}\n.ant-popover-message-title {\n padding: 0;\n text-align: center;\n font-size: 1rem;\n}\n.ant-popover-buttons {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.ant-btn-link:disabled {\n color: #717d94 !important;\n}\n.ant-btn-link:disabled:hover {\n background-color: transparent !important;\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-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:root {\n --row-background: #ffffff;\n --row-background-alternate: rgba(100, 116, 139, 0.04);\n --row-background-dark: #121212;\n --row-background-alternate-dark: #1e1e1e;\n}\n.plan-step-line {\n height: 1px;\n min-width: 128px;\n background: #717d94;\n}\n.plan-step-number {\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 9999px;\n border: 1px solid #717d94;\n background: white;\n width: 24px;\n height: 24px;\n color: #717d94;\n}\n.plan-step-number.active {\n border: none;\n color: white;\n background: #ff6e1c;\n}\n.hidden {\n display: none;\n}\n.cardElement {\n padding: 8px 11px;\n border: 1px solid #e5e7eb;\n background-color: white;\n font-family: Inter !important;\n}\n.tooltip {\n visibility: hidden;\n position: absolute !important;\n}\n.has-tooltip:hover .tooltip {\n visibility: visible;\n z-index: 100;\n}\n.show-on-hover {\n opacity: 0;\n}\n.show-on-hover-container:hover .show-on-hover {\n opacity: 1;\n}\n.pdf-only {\n display: none !important;\n}\n.notes p {\n margin: 0;\n padding: 0;\n padding-bottom: 0.25rem;\n}\n#form-element #finix-form-container .field-holder label {\n color: #717d94 !important;\n font-size: 12px !important;\n}\n#form-element #finix-form-container > *:first-child,\n#form-element #finix-form-container > *:last-child {\n margin-top: 0 !important;\n}\n#form-element #finix-form-container > *:not(:first-child):not(:last-child) {\n margin-top: 12px !important;\n}\n#form-element #finix-form-container .field-array > * {\n margin-top: 0 !important;\n}\n#form-element #finix-form-container .field-holder .field,\n#form-element #finix-form-container iframe {\n height: 34px !important;\n}\n#form-element #finix-form-container .field {\n margin-top: 0 !important;\n padding-top: 2px !important;\n}\n#form-element #finix-form-container .field-holder .validation {\n font-size: 11px !important;\n color: #ff4d4f !important;\n}\n.icon-path {\n transition: fill 0.3s;\n}\n.shadow-padding-x {\n padding-right: 1rem;\n padding-left: 1rem;\n}\n.shadow-padding-xb {\n padding-right: 1rem;\n padding-left: 1rem;\n padding-bottom: 0.5rem;\n}\n.content-container {\n width: 100%;\n margin: 0 auto;\n}\n@media (min-width: 1220px) {\n .content-container {\n width: 1220px !important;\n margin: 0 auto;\n }\n}\n@media (min-width: 768px) {\n .shadow-padding-x {\n padding-right: 2rem;\n padding-left: 2rem;\n }\n .shadow-padding-xb {\n padding-right: 2rem;\n padding-left: 2rem;\n padding-bottom: 0.5rem;\n }\n .sm\\:flex {\n display: flex !important;\n }\n .sm\\:hidden {\n display: none !important;\n }\n}\n.rotate-45,\n.transform {\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n}\n.shadow,\n.shadow-lg,\n.shadow-md,\n.shadow-none,\n.shadow-sm,\n.shadow-xl {\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n}\n.container {\n width: 100%;\n}\n@media (min-width: 768px) {\n .container {\n max-width: 768px;\n }\n}\n@media (min-width: 1024px) {\n .container {\n max-width: 1024px;\n }\n}\n@media (min-width: 1280px) {\n .container {\n max-width: 1280px;\n }\n}\n@media (min-width: 1536px) {\n .container {\n max-width: 1536px;\n }\n}\n.visible {\n visibility: visible;\n}\n.fixed {\n position: fixed;\n}\n.absolute {\n position: absolute;\n}\n.relative {\n position: relative;\n}\n.bottom-0 {\n bottom: 0px;\n}\n.left-0 {\n left: 0px;\n}\n.right-0 {\n right: 0px;\n}\n.top-0 {\n top: 0px;\n}\n.z-50 {\n z-index: 50;\n}\n.col-span-2 {\n grid-column: span 2 / span 2;\n}\n.col-span-3 {\n grid-column: span 3 / span 3;\n}\n.m-0 {\n margin: 0px;\n}\n.mx-4 {\n margin-left: 1rem;\n margin-right: 1rem;\n}\n.my-12 {\n margin-top: 3rem;\n margin-bottom: 3rem;\n}\n.my-2 {\n margin-top: 0.5rem;\n margin-bottom: 0.5rem;\n}\n.my-4 {\n margin-top: 1rem;\n margin-bottom: 1rem;\n}\n.mb-4 {\n margin-bottom: 1rem;\n}\n.ml-2 {\n margin-left: 0.5rem;\n}\n.mr-8 {\n margin-right: 2rem;\n}\n.mt-1 {\n margin-top: 0.25rem;\n}\n.mt-2 {\n margin-top: 0.5rem;\n}\n.mt-4 {\n margin-top: 1rem;\n}\n.mt-6 {\n margin-top: 1.5rem;\n}\n.mt-8 {\n margin-top: 2rem;\n}\n.block {\n display: block;\n}\n.flex {\n display: flex;\n}\n.table {\n display: table;\n}\n.grid {\n display: grid;\n}\n.contents {\n display: contents;\n}\n.hidden {\n display: none;\n}\n.h-4 {\n height: 1rem;\n}\n.h-5 {\n height: 1.25rem;\n}\n.h-8 {\n height: 2rem;\n}\n.h-full {\n height: 100%;\n}\n.w-1\\/2 {\n width: 50%;\n}\n.w-1\\/3 {\n width: 33.333333%;\n}\n.w-2\\/3 {\n width: 66.666667%;\n}\n.w-4 {\n width: 1rem;\n}\n.w-full {\n width: 100%;\n}\n.max-w-32 {\n max-width: 8rem;\n}\n.flex-1 {\n flex: 1 1 0%;\n}\n.shrink-0 {\n flex-shrink: 0;\n}\n.grow {\n flex-grow: 1;\n}\n.border-collapse {\n border-collapse: collapse;\n}\n.rotate-45 {\n --tw-rotate: 45deg;\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.transform {\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.cursor-pointer {\n cursor: pointer;\n}\n.grid-cols-2 {\n grid-template-columns: repeat(2, minmax(0, 1fr));\n}\n.grid-cols-3 {\n grid-template-columns: repeat(3, minmax(0, 1fr));\n}\n.flex-row {\n flex-direction: row;\n}\n.flex-col {\n flex-direction: column;\n}\n.items-end {\n align-items: flex-end;\n}\n.items-center {\n align-items: center;\n}\n.justify-start {\n justify-content: flex-start;\n}\n.justify-end {\n justify-content: flex-end;\n}\n.justify-center {\n justify-content: center;\n}\n.justify-between {\n justify-content: space-between;\n}\n.gap-0 {\n gap: 0px;\n}\n.gap-1 {\n gap: 0.25rem;\n}\n.gap-2 {\n gap: 0.5rem;\n}\n.gap-4 {\n gap: 1rem;\n}\n.gap-6 {\n gap: 1.5rem;\n}\n.space-y-2 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(0.5rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(0.5rem * var(--tw-space-y-reverse));\n}\n.space-y-4 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(1rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(1rem * var(--tw-space-y-reverse));\n}\n.space-y-8 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(2rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(2rem * var(--tw-space-y-reverse));\n}\n.overflow-auto {\n overflow: auto;\n}\n.overflow-hidden {\n overflow: hidden;\n}\n.overflow-visible {\n overflow: visible;\n}\n.whitespace-nowrap {\n white-space: nowrap;\n}\n.text-nowrap {\n text-wrap: nowrap;\n}\n.rounded {\n border-radius: 0.25rem;\n}\n.rounded-full {\n border-radius: 9999px;\n}\n.rounded-md {\n border-radius: 0.375rem;\n}\n.border {\n border-width: 1px;\n}\n.border-solid {\n border-style: solid;\n}\n.border-gray-400 {\n --tw-border-opacity: 1;\n border-color: rgb(156 163 175 / var(--tw-border-opacity, 1));\n}\n.border-gray-500 {\n --tw-border-opacity: 1;\n border-color: rgb(107 114 128 / var(--tw-border-opacity, 1));\n}\n.border-slate-200 {\n --tw-border-opacity: 1;\n border-color: rgb(226 232 240 / var(--tw-border-opacity, 1));\n}\n.border-slate-300 {\n --tw-border-opacity: 1;\n border-color: rgb(203 213 225 / var(--tw-border-opacity, 1));\n}\n.border-slate-700 {\n --tw-border-opacity: 1;\n border-color: rgb(51 65 85 / var(--tw-border-opacity, 1));\n}\n.bg-black {\n --tw-bg-opacity: 1;\n background-color: rgb(0 0 0 / var(--tw-bg-opacity, 1));\n}\n.bg-emerald-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(167 243 208 / var(--tw-bg-opacity, 1));\n}\n.bg-green-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(187 247 208 / var(--tw-bg-opacity, 1));\n}\n.bg-orange-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(254 215 170 / var(--tw-bg-opacity, 1));\n}\n.bg-red-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(254 202 202 / var(--tw-bg-opacity, 1));\n}\n.bg-red-500 {\n --tw-bg-opacity: 1;\n background-color: rgb(239 68 68 / var(--tw-bg-opacity, 1));\n}\n.bg-slate-50 {\n --tw-bg-opacity: 1;\n background-color: rgb(248 250 252 / var(--tw-bg-opacity, 1));\n}\n.bg-white {\n --tw-bg-opacity: 1;\n background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));\n}\n.bg-yellow-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(254 240 138 / var(--tw-bg-opacity, 1));\n}\n.p-0 {\n padding: 0px;\n}\n.p-1 {\n padding: 0.25rem;\n}\n.p-2 {\n padding: 0.5rem;\n}\n.p-4 {\n padding: 1rem;\n}\n.p-8 {\n padding: 2rem;\n}\n.px-2 {\n padding-left: 0.5rem;\n padding-right: 0.5rem;\n}\n.px-3 {\n padding-left: 0.75rem;\n padding-right: 0.75rem;\n}\n.px-4 {\n padding-left: 1rem;\n padding-right: 1rem;\n}\n.px-6 {\n padding-left: 1.5rem;\n padding-right: 1.5rem;\n}\n.py-1 {\n padding-top: 0.25rem;\n padding-bottom: 0.25rem;\n}\n.py-2 {\n padding-top: 0.5rem;\n padding-bottom: 0.5rem;\n}\n.py-4 {\n padding-top: 1rem;\n padding-bottom: 1rem;\n}\n.py-6 {\n padding-top: 1.5rem;\n padding-bottom: 1.5rem;\n}\n.pb-2 {\n padding-bottom: 0.5rem;\n}\n.pb-4 {\n padding-bottom: 1rem;\n}\n.pb-6 {\n padding-bottom: 1.5rem;\n}\n.pb-8 {\n padding-bottom: 2rem;\n}\n.pl-0 {\n padding-left: 0px;\n}\n.pl-2 {\n padding-left: 0.5rem;\n}\n.pl-4 {\n padding-left: 1rem;\n}\n.pt-1 {\n padding-top: 0.25rem;\n}\n.pt-12 {\n padding-top: 3rem;\n}\n.pt-2 {\n padding-top: 0.5rem;\n}\n.pt-4 {\n padding-top: 1rem;\n}\n.pt-5 {\n padding-top: 1.25rem;\n}\n.pt-6 {\n padding-top: 1.5rem;\n}\n.pt-8 {\n padding-top: 2rem;\n}\n.text-left {\n text-align: left;\n}\n.text-center {\n text-align: center;\n}\n.text-right {\n text-align: right;\n}\n.align-middle {\n vertical-align: middle;\n}\n.text-2xl {\n font-size: 1.5rem;\n line-height: 2rem;\n}\n.text-base {\n font-size: 1rem;\n line-height: 1.5rem;\n}\n.text-lg {\n font-size: 1.125rem;\n line-height: 1.75rem;\n}\n.text-sm {\n font-size: 0.875rem;\n line-height: 1.25rem;\n}\n.text-xl {\n font-size: 1.25rem;\n line-height: 1.75rem;\n}\n.text-xs {\n font-size: 0.75rem;\n line-height: 1rem;\n}\n.font-bold {\n font-weight: 700;\n}\n.font-medium {\n font-weight: 500;\n}\n.font-normal {\n font-weight: 400;\n}\n.capitalize {\n text-transform: capitalize;\n}\n.text-emerald-600 {\n --tw-text-opacity: 1;\n color: rgb(5 150 105 / var(--tw-text-opacity, 1));\n}\n.text-emerald-700 {\n --tw-text-opacity: 1;\n color: rgb(4 120 87 / var(--tw-text-opacity, 1));\n}\n.text-gray-600 {\n --tw-text-opacity: 1;\n color: rgb(75 85 99 / var(--tw-text-opacity, 1));\n}\n.text-gray-900 {\n --tw-text-opacity: 1;\n color: rgb(17 24 39 / var(--tw-text-opacity, 1));\n}\n.text-green-600 {\n --tw-text-opacity: 1;\n color: rgb(22 163 74 / var(--tw-text-opacity, 1));\n}\n.text-orange-500 {\n --tw-text-opacity: 1;\n color: rgb(249 115 22 / var(--tw-text-opacity, 1));\n}\n.text-red-500 {\n --tw-text-opacity: 1;\n color: rgb(239 68 68 / var(--tw-text-opacity, 1));\n}\n.text-slate-400 {\n --tw-text-opacity: 1;\n color: rgb(148 163 184 / var(--tw-text-opacity, 1));\n}\n.text-slate-500 {\n --tw-text-opacity: 1;\n color: rgb(100 116 139 / var(--tw-text-opacity, 1));\n}\n.text-white {\n --tw-text-opacity: 1;\n color: rgb(255 255 255 / var(--tw-text-opacity, 1));\n}\n.text-yellow-500 {\n --tw-text-opacity: 1;\n color: rgb(234 179 8 / var(--tw-text-opacity, 1));\n}\n.underline {\n text-decoration-line: underline;\n}\n.shadow {\n --tw-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);\n --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.shadow-lg {\n --tw-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);\n --tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.shadow-md {\n --tw-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);\n --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.shadow-none {\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.shadow-sm {\n --tw-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n --tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.shadow-xl {\n --tw-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);\n --tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.transition {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n.font-light {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n.font-medium {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n.font-bold {\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n}\n@media (min-width: 768px) {\n .sm\\:flex {\n display: flex;\n }\n .sm\\:hidden {\n display: none;\n }\n}\n* {\n margin: 0;\n padding: 0;\n box-sizing: border-box !important;\n font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\n line-height: 1.15;\n}\nbody {\n color: #232323;\n background-color: #f8fafc;\n}\nth {\n font-weight: normal;\n}\ncode {\n font-family: source-code-pro, Menlo, Monaco, Consolas, \"Courier New\", monospace;\n}\n@media only screen and (max-width: 768px) {\n select,\n textarea,\n input[type=\"text\"],\n input[type=\"password\"],\n input[type=\"datetime\"],\n input[type=\"datetime-local\"],\n input[type=\"date\"],\n input[type=\"month\"],\n input[type=\"time\"],\n input[type=\"week\"],\n input[type=\"number\"],\n input[type=\"email\"],\n input[type=\"url\"],\n input[type=\"search\"],\n input[type=\"tel\"],\n input[type=\"color\"] {\n font-size: 16px !important;\n }\n}\n@keyframes App-logo-spin {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}\n";
|
|
75
75
|
styleInject(css_248z);
|
|
76
76
|
|
|
77
77
|
/******************************************************************************
|
|
@@ -1710,6 +1710,19 @@ function ContextualWrapper(_a) {
|
|
|
1710
1710
|
colorSplit: darkMode ? common.SLATE_400 : common.SLATE_200,
|
|
1711
1711
|
verticalMarginInline: 0,
|
|
1712
1712
|
},
|
|
1713
|
+
Form: {
|
|
1714
|
+
itemMarginBottom: 0,
|
|
1715
|
+
verticalLabelPadding: "4px",
|
|
1716
|
+
},
|
|
1717
|
+
Input: {
|
|
1718
|
+
fontSize: 16,
|
|
1719
|
+
},
|
|
1720
|
+
Select: {
|
|
1721
|
+
fontSize: 16,
|
|
1722
|
+
},
|
|
1723
|
+
DatePicker: {
|
|
1724
|
+
fontSize: 16,
|
|
1725
|
+
},
|
|
1713
1726
|
} }, configProviderProps) }, { children: children })) })) }));
|
|
1714
1727
|
}
|
|
1715
1728
|
|
|
@@ -1777,13 +1790,24 @@ var useDownloadFile = function (id, onError) {
|
|
|
1777
1790
|
|
|
1778
1791
|
var InvoiceQuoteContext = React.createContext({});
|
|
1779
1792
|
|
|
1793
|
+
var PaymentContext = React.createContext({});
|
|
1794
|
+
|
|
1795
|
+
// Use this hook instead of getting the token from BunnyContext directly
|
|
1796
|
+
// Because we have overrideToken as an option, this token ensures the correct token is used
|
|
1797
|
+
function useToken() {
|
|
1798
|
+
var tokenFromContext = React.useContext(BunnyContext).token;
|
|
1799
|
+
var overrideToken = React.useContext(PaymentContext).overrideToken;
|
|
1800
|
+
return overrideToken || tokenFromContext;
|
|
1801
|
+
}
|
|
1802
|
+
|
|
1780
1803
|
var MarkupContainer = styled__default["default"].div(templateObject_1$8 || (templateObject_1$8 = __makeTemplateObject(["\n span {\n width: 100%;\n }\n"], ["\n span {\n width: 100%;\n }\n"])));
|
|
1781
1804
|
var InvoiceQuoteView = function (_a) {
|
|
1782
1805
|
var children = _a.children, formattedInvoice = _a.formattedInvoice, html = _a.html, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick, onDownloadError = _a.onDownloadError;
|
|
1783
1806
|
var downloadFile = useDownloadFile(formattedInvoice === null || formattedInvoice === void 0 ? void 0 : formattedInvoice.id, onDownloadError);
|
|
1784
1807
|
var secondaryColor = React.useContext(BrandContext).secondaryColor;
|
|
1785
|
-
var
|
|
1786
|
-
var
|
|
1808
|
+
var apiHost = React.useContext(BunnyContext).apiHost;
|
|
1809
|
+
var token = useToken();
|
|
1810
|
+
var _b = React.useContext(InvoiceQuoteContext), shadow = _b.shadow, hideDownloadButton = _b.hideDownloadButton;
|
|
1787
1811
|
var isMobile = common.useIsMobile();
|
|
1788
1812
|
var buttonsVisible = formattedInvoice && (!hideDownloadButton || onBackButtonClick);
|
|
1789
1813
|
return (jsxRuntime.jsxs("div", __assign({ className: "flex flex-col w-full grow ".concat(isMobile ? "overflow-hidden" : "") }, { children: [buttonsVisible ? (jsxRuntime.jsxs("div", __assign({ className: "flex justify-between items-center pb-4 ".concat(isMobile ? "shadow-padding-x" : ""), id: "acceptance" }, { children: [jsxRuntime.jsx("div", { children: onBackButtonClick ? (jsxRuntime.jsx(antd.Button, __assign({ className: "text-xs pl-0", onClick: onBackButtonClick, style: {
|
|
@@ -1804,17 +1828,57 @@ var quoteMetaTitle = function (_a) {
|
|
|
1804
1828
|
return vendorName + " " + documentName;
|
|
1805
1829
|
};
|
|
1806
1830
|
|
|
1807
|
-
var
|
|
1831
|
+
var fetchPDF = function (apiEndpoint, invoiceUuid) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1832
|
+
var response;
|
|
1833
|
+
return __generator(this, function (_a) {
|
|
1834
|
+
switch (_a.label) {
|
|
1835
|
+
case 0:
|
|
1836
|
+
if (!invoiceUuid) {
|
|
1837
|
+
throw new Error("Invoice ID is required to fetch PDF");
|
|
1838
|
+
}
|
|
1839
|
+
return [4 /*yield*/, fetch("".concat(apiEndpoint, "/api/legacy_invoices/").concat(invoiceUuid))];
|
|
1840
|
+
case 1:
|
|
1841
|
+
response = _a.sent();
|
|
1842
|
+
if (!response.ok)
|
|
1843
|
+
throw new Error("Failed to fetch PDF");
|
|
1844
|
+
return [2 /*return*/, response.blob()]; // Return the PDF as a blob
|
|
1845
|
+
}
|
|
1846
|
+
});
|
|
1847
|
+
}); };
|
|
1848
|
+
function InvoicePDF(_a) {
|
|
1849
|
+
var invoiceUuid = _a.invoiceUuid, apiHost = _a.apiHost;
|
|
1850
|
+
var _b = React.useState(undefined), pdfUrl = _b[0], setPdfUrl = _b[1];
|
|
1851
|
+
var _c = reactQuery.useQuery({
|
|
1852
|
+
queryKey: ["invoicePDF", invoiceUuid],
|
|
1853
|
+
queryFn: function () { return fetchPDF(apiHost || "", invoiceUuid); },
|
|
1854
|
+
enabled: Boolean(invoiceUuid),
|
|
1855
|
+
}), pdfBlob = _c.data, isLoading = _c.isLoading;
|
|
1856
|
+
React.useEffect(function () {
|
|
1857
|
+
if (pdfBlob) {
|
|
1858
|
+
var url_1 = URL.createObjectURL(pdfBlob);
|
|
1859
|
+
setPdfUrl(url_1);
|
|
1860
|
+
return function () { return URL.revokeObjectURL(url_1); };
|
|
1861
|
+
}
|
|
1862
|
+
}, [pdfBlob]);
|
|
1863
|
+
if (isLoading || !pdfUrl)
|
|
1864
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
1865
|
+
return (jsxRuntime.jsx("iframe", { src: pdfUrl, style: {
|
|
1866
|
+
border: "none",
|
|
1867
|
+
gridColumn: "1/-1",
|
|
1868
|
+
minHeight: "1000px",
|
|
1869
|
+
minWidth: "780px",
|
|
1870
|
+
}, title: "Invoice PDF", width: "100%" }));
|
|
1871
|
+
}
|
|
1808
1872
|
|
|
1809
1873
|
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}";
|
|
1810
|
-
var usePaymentMethod = function (graphQLClient
|
|
1874
|
+
var usePaymentMethod = function (graphQLClient) {
|
|
1811
1875
|
var result = reactQuery.useQuery({
|
|
1812
1876
|
queryKey: common.QueryKeyFactory.default.accountPaymentMethodKey,
|
|
1813
1877
|
queryFn: function () {
|
|
1814
1878
|
return graphQLClient
|
|
1815
1879
|
.request(paymentMethodsQuery, {
|
|
1816
1880
|
first: 1,
|
|
1817
|
-
filter: "disabled is false"
|
|
1881
|
+
filter: "disabled is false",
|
|
1818
1882
|
})
|
|
1819
1883
|
.then(function (data) {
|
|
1820
1884
|
var _a, _b;
|
|
@@ -1875,289 +1939,156 @@ var getQuoteAmountDue = function (quote) {
|
|
|
1875
1939
|
return quote.amountDue;
|
|
1876
1940
|
};
|
|
1877
1941
|
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
var amount = _a.amount, currency = _a.currency;
|
|
1881
|
-
return { token: "DemoPayTestToken", amount: amount, currency: currency };
|
|
1882
|
-
};
|
|
1883
|
-
var DIGIT_REGEX = /\d/;
|
|
1884
|
-
var isDigit = function (char) { return DIGIT_REGEX.test(char); };
|
|
1885
|
-
var isDeletion = function (char) { return [8, 46].includes(char); }; // Backspace or Delete
|
|
1886
|
-
var isNavigation = function (char) { return [9, 37, 38, 39, 40].includes(char); }; // Tab, Arrows
|
|
1887
|
-
var isModifier = function (char) { return [16, 17, 18].includes(char); }; // Shift, Ctrl, Alt
|
|
1888
|
-
var isValidKey = function (code) {
|
|
1889
|
-
return isDeletion(code) || isNavigation(code) || isModifier(code);
|
|
1890
|
-
};
|
|
1891
|
-
var isValidExpiry = function (expiry) {
|
|
1892
|
-
var month = parseInt(expiry.substring(0, 2), 10);
|
|
1893
|
-
var year = parseInt(expiry.substring(2, 4), 10) + 2000;
|
|
1894
|
-
if (isNaN(month) || isNaN(year))
|
|
1895
|
-
return false;
|
|
1896
|
-
if (month < 1 || month > 12)
|
|
1897
|
-
return false;
|
|
1898
|
-
return true;
|
|
1899
|
-
};
|
|
1900
|
-
var isCardExpired = function (expiry) {
|
|
1901
|
-
var month = parseInt(expiry.substring(0, 2), 10);
|
|
1902
|
-
var year = parseInt(expiry.substring(2, 4), 10) + 2000;
|
|
1903
|
-
var expiryDate = new Date(year, month, 1);
|
|
1904
|
-
return expiryDate < new Date();
|
|
1905
|
-
};
|
|
1906
|
-
var formatCardExpiry = function (cardExpiry) {
|
|
1907
|
-
if (cardExpiry.length <= 2)
|
|
1908
|
-
return cardExpiry;
|
|
1909
|
-
return cardExpiry.substring(0, 2) + "/" + cardExpiry.substring(2);
|
|
1910
|
-
};
|
|
1911
|
-
// removes spaces from a credit card number
|
|
1912
|
-
var unformatCardNumber = function (cardNumber) {
|
|
1913
|
-
var cardNumberArray = cardNumber.split("");
|
|
1914
|
-
var unformattedCardNumberArray = cardNumberArray.filter(function (character) { return character !== " "; });
|
|
1915
|
-
return unformattedCardNumberArray.join("");
|
|
1942
|
+
var DEFAULT_HEADERS = {
|
|
1943
|
+
"Content-type": "application/json; charset=utf-8",
|
|
1916
1944
|
};
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
switch (_a.label) {
|
|
1921
|
-
case 0:
|
|
1922
|
-
testCreditCardNumber = options.testCreditCardNumber, testCreditCardCvc = options.testCreditCardCvc, testCreditCardExpirationDate = options.testCreditCardExpirationDate, token = options.token;
|
|
1923
|
-
return [4 /*yield*/, common.invokePlugin({
|
|
1924
|
-
method: "store_payment_method",
|
|
1925
|
-
plugin: plugin,
|
|
1926
|
-
payload: {
|
|
1927
|
-
test_credit_card_number: testCreditCardNumber,
|
|
1928
|
-
test_credit_card_cvc: testCreditCardCvc,
|
|
1929
|
-
test_credit_card_expiration_date: testCreditCardExpirationDate,
|
|
1930
|
-
account_id: accountId,
|
|
1931
|
-
},
|
|
1932
|
-
token: token,
|
|
1933
|
-
apiHost: apiHost,
|
|
1934
|
-
})];
|
|
1935
|
-
case 1:
|
|
1936
|
-
response = _a.sent();
|
|
1937
|
-
if ((response === null || response === void 0 ? void 0 : response.status) !== "success")
|
|
1938
|
-
throw new Error(response === null || response === void 0 ? void 0 : response.message);
|
|
1939
|
-
return [2 /*return*/, response];
|
|
1940
|
-
}
|
|
1941
|
-
});
|
|
1942
|
-
}); };
|
|
1943
|
-
|
|
1944
|
-
function usePay$1(_a) {
|
|
1945
|
-
var _this = this;
|
|
1946
|
-
var onPaymentSuccess = _a.onPaymentSuccess, onPaymentError = _a.onPaymentError, quote = _a.quote, invoice = _a.invoice;
|
|
1947
|
-
var pay = function (_a) {
|
|
1948
|
-
var plugin = _a.plugin, savePaymentMethod = _a.savePaymentMethod;
|
|
1949
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
1950
|
-
var amountDue, currencyId, response;
|
|
1951
|
-
return __generator(this, function (_b) {
|
|
1952
|
-
amountDue = quote ? getQuoteAmountDue(quote) : invoice === null || invoice === void 0 ? void 0 : invoice.amountDue;
|
|
1953
|
-
currencyId = (quote === null || quote === void 0 ? void 0 : quote.currencyId) || (invoice === null || invoice === void 0 ? void 0 : invoice.currency);
|
|
1954
|
-
if (!amountDue || !currencyId) {
|
|
1955
|
-
throw new Error("No amount or currencyId");
|
|
1956
|
-
}
|
|
1957
|
-
try {
|
|
1958
|
-
response = confirmPayment({
|
|
1959
|
-
amount: amountDue,
|
|
1960
|
-
currency: currencyId,
|
|
1961
|
-
});
|
|
1962
|
-
onPaymentSuccess({
|
|
1963
|
-
pluginPaymentResponse: {
|
|
1964
|
-
plugin: plugin,
|
|
1965
|
-
token: response.token,
|
|
1966
|
-
savePaymentMethod: savePaymentMethod,
|
|
1967
|
-
},
|
|
1968
|
-
});
|
|
1969
|
-
}
|
|
1970
|
-
catch (error) {
|
|
1971
|
-
onPaymentError === null || onPaymentError === void 0 ? void 0 : onPaymentError(error);
|
|
1972
|
-
}
|
|
1973
|
-
return [2 /*return*/];
|
|
1974
|
-
});
|
|
1975
|
-
});
|
|
1976
|
-
};
|
|
1977
|
-
return { pay: pay };
|
|
1978
|
-
}
|
|
1979
|
-
|
|
1980
|
-
var createPaymentMethod = function (_a) {
|
|
1981
|
-
var paymentMethodId = _a.paymentMethodId, plugin = _a.plugin, token = _a.token, apiHost = _a.apiHost, accountId = _a.accountId;
|
|
1945
|
+
// !!! Duplicated from @bunnyapp/common due to bug in signup. Uses BunnyProvider token instead of apiToken.
|
|
1946
|
+
var gqlRequest = function (_a) {
|
|
1947
|
+
var query = _a.query, _b = _a.vars, vars = _b === void 0 ? {} : _b, headers = _a.headers, token = _a.token, isInPreviewMode = _a.isInPreviewMode, apiHost = _a.apiHost;
|
|
1982
1948
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
1983
|
-
var
|
|
1984
|
-
return __generator(this, function (
|
|
1985
|
-
switch (
|
|
1986
|
-
case 0:
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
throw new Error(response.message || "Unknown error");
|
|
2000
|
-
return [2 /*return*/, response];
|
|
1949
|
+
var graphqlEndpoint, requestHeaders, authorizationHeader, error_1;
|
|
1950
|
+
return __generator(this, function (_c) {
|
|
1951
|
+
switch (_c.label) {
|
|
1952
|
+
case 0:
|
|
1953
|
+
_c.trys.push([0, 2, , 3]);
|
|
1954
|
+
graphqlEndpoint = common.DEFAULT_CONFIG.graphqlEndpoint;
|
|
1955
|
+
requestHeaders = headers || DEFAULT_HEADERS;
|
|
1956
|
+
authorizationHeader = "Bearer ".concat(token);
|
|
1957
|
+
if (!requestHeaders.Authorization && !isInPreviewMode)
|
|
1958
|
+
requestHeaders.Authorization = authorizationHeader;
|
|
1959
|
+
return [4 /*yield*/, request__default["default"]("".concat(apiHost).concat(graphqlEndpoint), query, vars, requestHeaders)];
|
|
1960
|
+
case 1: return [2 /*return*/, _c.sent()];
|
|
1961
|
+
case 2:
|
|
1962
|
+
error_1 = _c.sent();
|
|
1963
|
+
throw error_1;
|
|
1964
|
+
case 3: return [2 /*return*/];
|
|
2001
1965
|
}
|
|
2002
1966
|
});
|
|
2003
1967
|
});
|
|
2004
1968
|
};
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
token: token,
|
|
2010
|
-
apiHost: apiHost,
|
|
2011
|
-
payload: {
|
|
2012
|
-
account_id: accountId,
|
|
2013
|
-
},
|
|
2014
|
-
});
|
|
2015
|
-
};
|
|
2016
|
-
var createPaymentIntent = function (_a) {
|
|
2017
|
-
var payable = _a.payable, savePaymentMethod = _a.savePaymentMethod, memo = _a.memo, plugin = _a.plugin, token = _a.token, apiHost = _a.apiHost;
|
|
1969
|
+
|
|
1970
|
+
var MUTATION$8 = "\n mutation checkout(\n $invoiceId: ID,\n $quoteId: ID,\n $paymentMethodId: ID,\n $paymentMethodData: CheckoutPaymentMethodAttributes\n ) {\n checkout(\n invoiceId: $invoiceId,\n quoteId: $quoteId,\n paymentMethodId: $paymentMethodId,\n paymentMethodData: $paymentMethodData\n ) {\n invoice {\n id\n state\n amount\n amountDue\n }\n payment {\n id\n state\n amount\n }\n paymentApplication {\n id\n invoiceId\n paymentId\n }\n transaction {\n id\n amount\n }\n }\n }\n";
|
|
1971
|
+
var checkout = function (_a) {
|
|
1972
|
+
var quoteId = _a.quoteId, invoiceId = _a.invoiceId, paymentMethodId = _a.paymentMethodId, paymentMethodData = _a.paymentMethodData, token = _a.token, apiHost = _a.apiHost;
|
|
2018
1973
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
2019
|
-
var
|
|
1974
|
+
var mutationVars, response, errors;
|
|
2020
1975
|
return __generator(this, function (_b) {
|
|
2021
1976
|
switch (_b.label) {
|
|
2022
1977
|
case 0:
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
1978
|
+
mutationVars = {
|
|
1979
|
+
quoteId: quoteId,
|
|
1980
|
+
invoiceId: invoiceId,
|
|
1981
|
+
paymentMethodId: paymentMethodId,
|
|
2027
1982
|
};
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
1983
|
+
if (paymentMethodData) {
|
|
1984
|
+
mutationVars.paymentMethodData = __assign(__assign({}, paymentMethodData), { metadata: paymentMethodData.metadata });
|
|
1985
|
+
}
|
|
1986
|
+
return [4 /*yield*/, gqlRequest({
|
|
1987
|
+
query: MUTATION$8,
|
|
2032
1988
|
token: token,
|
|
1989
|
+
vars: mutationVars,
|
|
2033
1990
|
apiHost: apiHost,
|
|
2034
1991
|
})];
|
|
2035
1992
|
case 1:
|
|
2036
1993
|
response = _b.sent();
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
1994
|
+
errors = (response === null || response === void 0 ? void 0 : response.checkout).errors;
|
|
1995
|
+
if (errors)
|
|
1996
|
+
throw errors;
|
|
1997
|
+
return [2 /*return*/, {
|
|
1998
|
+
savePaymentMethod: paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.savePaymentMethod,
|
|
1999
|
+
}];
|
|
2040
2000
|
}
|
|
2041
2001
|
});
|
|
2042
2002
|
});
|
|
2043
2003
|
};
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2004
|
+
|
|
2005
|
+
function usePay$1(_a) {
|
|
2006
|
+
var _this = this;
|
|
2007
|
+
var onPaymentSuccess = _a.onPaymentSuccess, onPaymentError = _a.onPaymentError, quote = _a.quote, invoice = _a.invoice, storedPaymentMethod = _a.storedPaymentMethod, plugin = _a.plugin;
|
|
2008
|
+
var apiHost = React.useContext(BunnyContext).apiHost;
|
|
2009
|
+
var customCheckoutFunction = React.useContext(PaymentContext).customCheckoutFunction;
|
|
2010
|
+
var token = useToken();
|
|
2011
|
+
var pay = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
2012
|
+
var amountDue, currencyId, response, response, error_1;
|
|
2013
|
+
return __generator(this, function (_a) {
|
|
2014
|
+
switch (_a.label) {
|
|
2015
|
+
case 0:
|
|
2016
|
+
amountDue = quote ? getQuoteAmountDue(quote) : invoice === null || invoice === void 0 ? void 0 : invoice.amountDue;
|
|
2017
|
+
currencyId = (quote === null || quote === void 0 ? void 0 : quote.currencyId) || (invoice === null || invoice === void 0 ? void 0 : invoice.currency);
|
|
2018
|
+
if (!amountDue || !currencyId) {
|
|
2019
|
+
throw new Error("No amount or currencyId");
|
|
2020
|
+
}
|
|
2021
|
+
_a.label = 1;
|
|
2022
|
+
case 1:
|
|
2023
|
+
_a.trys.push([1, 6, , 7]);
|
|
2024
|
+
if (!customCheckoutFunction) return [3 /*break*/, 3];
|
|
2025
|
+
return [4 /*yield*/, customCheckoutFunction(plugin)];
|
|
2026
|
+
case 2:
|
|
2027
|
+
response = _a.sent();
|
|
2028
|
+
onPaymentSuccess === null || onPaymentSuccess === void 0 ? void 0 : onPaymentSuccess(response);
|
|
2029
|
+
return [3 /*break*/, 5];
|
|
2030
|
+
case 3: return [4 /*yield*/, checkout({
|
|
2031
|
+
invoiceId: invoice === null || invoice === void 0 ? void 0 : invoice.id,
|
|
2032
|
+
quoteId: quote === null || quote === void 0 ? void 0 : quote.id,
|
|
2033
|
+
paymentMethodId: storedPaymentMethod === null || storedPaymentMethod === void 0 ? void 0 : storedPaymentMethod.id,
|
|
2034
|
+
token: token,
|
|
2035
|
+
apiHost: apiHost,
|
|
2036
|
+
})];
|
|
2037
|
+
case 4:
|
|
2038
|
+
response = _a.sent();
|
|
2039
|
+
onPaymentSuccess === null || onPaymentSuccess === void 0 ? void 0 : onPaymentSuccess(response);
|
|
2040
|
+
_a.label = 5;
|
|
2041
|
+
case 5: return [3 /*break*/, 7];
|
|
2042
|
+
case 6:
|
|
2043
|
+
error_1 = _a.sent();
|
|
2044
|
+
onPaymentError === null || onPaymentError === void 0 ? void 0 : onPaymentError(error_1);
|
|
2045
|
+
return [3 /*break*/, 7];
|
|
2046
|
+
case 7: return [2 /*return*/];
|
|
2047
|
+
}
|
|
2084
2048
|
});
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
};
|
|
2049
|
+
}); };
|
|
2050
|
+
return { pay: pay };
|
|
2051
|
+
}
|
|
2089
2052
|
|
|
2090
2053
|
function usePay(_a) {
|
|
2091
2054
|
var _this = this;
|
|
2092
|
-
var onPaymentSuccess = _a.onPaymentSuccess, onPaymentError = _a.onPaymentError, quote = _a.quote, invoice = _a.invoice;
|
|
2055
|
+
var onPaymentSuccess = _a.onPaymentSuccess, onPaymentError = _a.onPaymentError, quote = _a.quote, invoice = _a.invoice, storedPaymentMethod = _a.storedPaymentMethod, plugin = _a.plugin;
|
|
2093
2056
|
// Hooks
|
|
2094
|
-
var
|
|
2095
|
-
var
|
|
2096
|
-
var
|
|
2097
|
-
var pay = function (
|
|
2098
|
-
var
|
|
2099
|
-
return
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
clientSecret = paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.client_secret;
|
|
2128
|
-
return [4 /*yield*/, stripe.confirmPayment({
|
|
2129
|
-
elements: elements,
|
|
2130
|
-
clientSecret: clientSecret,
|
|
2131
|
-
redirect: "if_required",
|
|
2132
|
-
confirmParams: {
|
|
2133
|
-
return_url: window.location.href,
|
|
2134
|
-
},
|
|
2135
|
-
})];
|
|
2136
|
-
case 4:
|
|
2137
|
-
response = _c.sent();
|
|
2138
|
-
// See https://stripe.com/docs/payments/save-during-payment?platform=web#web-submit-payment
|
|
2139
|
-
if (response.error)
|
|
2140
|
-
throw new Error(response.error.message);
|
|
2141
|
-
paymentIntentId = (_b = response.paymentIntent) === null || _b === void 0 ? void 0 : _b.id;
|
|
2142
|
-
if (!paymentIntentId)
|
|
2143
|
-
throw new Error("Payment intent couldn't be retrieved");
|
|
2144
|
-
onPaymentSuccess === null || onPaymentSuccess === void 0 ? void 0 : onPaymentSuccess({
|
|
2145
|
-
pluginPaymentResponse: {
|
|
2146
|
-
plugin: plugin,
|
|
2147
|
-
token: paymentIntentId,
|
|
2148
|
-
savePaymentMethod: true,
|
|
2149
|
-
},
|
|
2150
|
-
});
|
|
2151
|
-
return [3 /*break*/, 6];
|
|
2152
|
-
case 5:
|
|
2153
|
-
error_1 = _c.sent();
|
|
2154
|
-
onPaymentError === null || onPaymentError === void 0 ? void 0 : onPaymentError(error_1);
|
|
2155
|
-
return [3 /*break*/, 6];
|
|
2156
|
-
case 6: return [2 /*return*/];
|
|
2157
|
-
}
|
|
2158
|
-
});
|
|
2057
|
+
var apiHost = React.useContext(BunnyContext).apiHost;
|
|
2058
|
+
var customCheckoutFunction = React.useContext(PaymentContext).customCheckoutFunction;
|
|
2059
|
+
var token = useToken();
|
|
2060
|
+
var pay = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
2061
|
+
var response, response, error_1;
|
|
2062
|
+
return __generator(this, function (_a) {
|
|
2063
|
+
switch (_a.label) {
|
|
2064
|
+
case 0:
|
|
2065
|
+
_a.trys.push([0, 5, , 6]);
|
|
2066
|
+
if (!customCheckoutFunction) return [3 /*break*/, 2];
|
|
2067
|
+
return [4 /*yield*/, customCheckoutFunction(plugin)];
|
|
2068
|
+
case 1:
|
|
2069
|
+
response = _a.sent();
|
|
2070
|
+
onPaymentSuccess === null || onPaymentSuccess === void 0 ? void 0 : onPaymentSuccess(response);
|
|
2071
|
+
return [3 /*break*/, 4];
|
|
2072
|
+
case 2: return [4 /*yield*/, checkout({
|
|
2073
|
+
invoiceId: invoice === null || invoice === void 0 ? void 0 : invoice.id,
|
|
2074
|
+
quoteId: quote === null || quote === void 0 ? void 0 : quote.id,
|
|
2075
|
+
paymentMethodId: storedPaymentMethod === null || storedPaymentMethod === void 0 ? void 0 : storedPaymentMethod.id,
|
|
2076
|
+
token: token,
|
|
2077
|
+
apiHost: apiHost,
|
|
2078
|
+
})];
|
|
2079
|
+
case 3:
|
|
2080
|
+
response = _a.sent();
|
|
2081
|
+
onPaymentSuccess === null || onPaymentSuccess === void 0 ? void 0 : onPaymentSuccess(response);
|
|
2082
|
+
_a.label = 4;
|
|
2083
|
+
case 4: return [3 /*break*/, 6];
|
|
2084
|
+
case 5:
|
|
2085
|
+
error_1 = _a.sent();
|
|
2086
|
+
onPaymentError === null || onPaymentError === void 0 ? void 0 : onPaymentError(error_1);
|
|
2087
|
+
return [3 /*break*/, 6];
|
|
2088
|
+
case 6: return [2 /*return*/];
|
|
2089
|
+
}
|
|
2159
2090
|
});
|
|
2160
|
-
};
|
|
2091
|
+
}); };
|
|
2161
2092
|
return { pay: pay };
|
|
2162
2093
|
}
|
|
2163
2094
|
|
|
@@ -2166,30 +2097,31 @@ var ActualCheckoutFooter = function (_a) {
|
|
|
2166
2097
|
var quote = _a.quote, invoice = _a.invoice, onPaymentSuccess = _a.onPaymentSuccess, noPadding = _a.noPadding, plugin = _a.plugin;
|
|
2167
2098
|
var isMobile = common.useIsMobile();
|
|
2168
2099
|
var _b = React.useState(false), isPaying = _b[0], setIsPaying = _b[1];
|
|
2100
|
+
var storedPaymentMethod = React.useContext(PaymentContext).storedPaymentMethod;
|
|
2169
2101
|
var amountDue = quote ? getQuoteAmountDue(quote) : invoice === null || invoice === void 0 ? void 0 : invoice.amountDue;
|
|
2170
2102
|
var currencyId = (quote === null || quote === void 0 ? void 0 : quote.currencyId) || (invoice === null || invoice === void 0 ? void 0 : invoice.currency);
|
|
2171
2103
|
// Payment hooks
|
|
2172
2104
|
var payDemoPay = usePay$1({
|
|
2173
|
-
onPaymentSuccess:
|
|
2174
|
-
onPaymentSuccess(response);
|
|
2175
|
-
},
|
|
2105
|
+
onPaymentSuccess: onPaymentSuccess,
|
|
2176
2106
|
onPaymentError: function (error) {
|
|
2177
2107
|
setIsPaying(false);
|
|
2178
|
-
showErrorNotification$1(error);
|
|
2108
|
+
showErrorNotification$1(JSON.stringify(error));
|
|
2179
2109
|
},
|
|
2180
2110
|
quote: quote,
|
|
2181
2111
|
invoice: invoice,
|
|
2112
|
+
storedPaymentMethod: storedPaymentMethod,
|
|
2113
|
+
plugin: plugin,
|
|
2182
2114
|
}).pay;
|
|
2183
2115
|
var payStripe = usePay({
|
|
2184
|
-
onPaymentSuccess:
|
|
2185
|
-
onPaymentSuccess(response);
|
|
2186
|
-
},
|
|
2116
|
+
onPaymentSuccess: onPaymentSuccess,
|
|
2187
2117
|
onPaymentError: function (error) {
|
|
2188
2118
|
setIsPaying(false);
|
|
2189
|
-
showErrorNotification$1(error);
|
|
2119
|
+
showErrorNotification$1(JSON.stringify(error));
|
|
2190
2120
|
},
|
|
2191
2121
|
quote: quote,
|
|
2192
2122
|
invoice: invoice,
|
|
2123
|
+
storedPaymentMethod: storedPaymentMethod,
|
|
2124
|
+
plugin: plugin,
|
|
2193
2125
|
}).pay;
|
|
2194
2126
|
var handlePaymentSubmit = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
2195
2127
|
var _a;
|
|
@@ -2199,22 +2131,17 @@ var ActualCheckoutFooter = function (_a) {
|
|
|
2199
2131
|
case 0:
|
|
2200
2132
|
if (!plugin)
|
|
2201
2133
|
return [2 /*return*/];
|
|
2202
|
-
_a = (_c = (_b = plugin
|
|
2134
|
+
_a = (_c = (_b = plugin.components) === null || _b === void 0 ? void 0 : _b.frontend) === null || _c === void 0 ? void 0 : _c[0].name;
|
|
2203
2135
|
switch (_a) {
|
|
2204
2136
|
case "StripePayment": return [3 /*break*/, 1];
|
|
2205
2137
|
case "DemoPayPayment": return [3 /*break*/, 3];
|
|
2206
2138
|
}
|
|
2207
2139
|
return [3 /*break*/, 5];
|
|
2208
|
-
case 1: return [4 /*yield*/, payStripe(
|
|
2209
|
-
plugin: plugin,
|
|
2210
|
-
})];
|
|
2140
|
+
case 1: return [4 /*yield*/, payStripe()];
|
|
2211
2141
|
case 2:
|
|
2212
2142
|
_d.sent();
|
|
2213
2143
|
return [3 /*break*/, 6];
|
|
2214
|
-
case 3: return [4 /*yield*/, payDemoPay(
|
|
2215
|
-
plugin: plugin,
|
|
2216
|
-
savePaymentMethod: false,
|
|
2217
|
-
})];
|
|
2144
|
+
case 3: return [4 /*yield*/, payDemoPay()];
|
|
2218
2145
|
case 4:
|
|
2219
2146
|
_d.sent();
|
|
2220
2147
|
return [3 /*break*/, 6];
|
|
@@ -2229,18 +2156,10 @@ var ActualCheckoutFooter = function (_a) {
|
|
|
2229
2156
|
}, size: isMobile ? "large" : "middle", type: "primary" }, { children: "".concat(isPaying ? "Paying" : "Pay", " ").concat(amountDue && currencyId ? common.formatCurrency(amountDue, currencyId) : "") })) })));
|
|
2230
2157
|
};
|
|
2231
2158
|
var CheckoutFooter = function (_a) {
|
|
2232
|
-
var _b, _c;
|
|
2233
2159
|
var quote = _a.quote, invoice = _a.invoice, onPaymentSuccess = _a.onPaymentSuccess, noPadding = _a.noPadding, plugin = _a.plugin;
|
|
2234
2160
|
if (!plugin)
|
|
2235
2161
|
return null;
|
|
2236
|
-
|
|
2237
|
-
var accountId = React.useContext(PaymentContext).accountId;
|
|
2238
|
-
// If plugin is not stripe, pass undefined to prevent errors
|
|
2239
|
-
var stripePlugin = ((_c = (_b = plugin === null || plugin === void 0 ? void 0 : plugin.components) === null || _b === void 0 ? void 0 : _b.frontend) === null || _c === void 0 ? void 0 : _c[0].name) === "StripePayment"
|
|
2240
|
-
? plugin
|
|
2241
|
-
: undefined;
|
|
2242
|
-
var _e = useStripePlugin(stripePlugin, token, apiHost, accountId), stripe = _e.stripe, options = _e.options;
|
|
2243
|
-
return (jsxRuntime.jsx(reactStripeJs.Elements, __assign({ options: options, stripe: stripe }, { children: jsxRuntime.jsx(ActualCheckoutFooter, { plugin: plugin, invoice: invoice, quote: quote, onPaymentSuccess: onPaymentSuccess, noPadding: noPadding }) })));
|
|
2162
|
+
return (jsxRuntime.jsx(ActualCheckoutFooter, { plugin: plugin, invoice: invoice, quote: quote, onPaymentSuccess: onPaymentSuccess, noPadding: noPadding }));
|
|
2244
2163
|
};
|
|
2245
2164
|
|
|
2246
2165
|
var dayjs_min = {exports: {}};
|
|
@@ -2268,13 +2187,13 @@ var PlusIcon = function (_a) {
|
|
|
2268
2187
|
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" })] })));
|
|
2269
2188
|
};
|
|
2270
2189
|
|
|
2271
|
-
var Text$
|
|
2190
|
+
var Text$g = antd.Typography.Text;
|
|
2272
2191
|
var CreditCard = function (_a) {
|
|
2273
2192
|
var _b;
|
|
2274
2193
|
var onClickRemove = _a.onClickRemove, onClickUpdate = _a.onClickUpdate, paymentMethodData = _a.paymentMethodData, _c = _a.shadow, shadow = _c === void 0 ? "shadow-md" : _c, _d = _a.cardEnabled, cardEnabled = _d === void 0 ? true : _d;
|
|
2275
2194
|
var isMobile = common.useIsMobile();
|
|
2276
2195
|
var Wrapper = cardEnabled ? Card : "div";
|
|
2277
|
-
return (jsxRuntime.jsxs(Wrapper, __assign({ className: "".concat(cardEnabled ? shadow : "", " m-0") }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex items-center justify-between gap-4 p-4" }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex items-center gap-4" }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex items-center gap-2" }, { children: [jsxRuntime.jsx(CardImage, { paymentMethodData: paymentMethodData }), jsxRuntime.jsx(Text$
|
|
2196
|
+
return (jsxRuntime.jsxs(Wrapper, __assign({ className: "".concat(cardEnabled ? shadow : "", " m-0") }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex items-center justify-between gap-4 p-4" }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex items-center gap-4" }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex items-center gap-2" }, { children: [jsxRuntime.jsx(CardImage, { paymentMethodData: paymentMethodData }), jsxRuntime.jsx(Text$g, { children: (_b = paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.metadata) === null || _b === void 0 ? void 0 : _b.identifier })] })), jsxRuntime.jsx(antd.Tag, __assign({ color: isExpired(paymentMethodData) ? "red" : "green" }, { children: isExpired(paymentMethodData) ? "Expired" : "Valid" }))] })), !isMobile && (jsxRuntime.jsx(CardActions, { onClickRemove: onClickRemove, onClickUpdate: onClickUpdate }))] })), dayjs(paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.expirationDate).isValid() && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(antd.Divider, {}), jsxRuntime.jsxs("div", __assign({ className: "flex flex-col p-4" }, { children: [jsxRuntime.jsx(CardAttribute, { title: "EXPIRATION", value: expirationDate(paymentMethodData) }), isMobile && (jsxRuntime.jsx(CardActions, { onClickRemove: onClickRemove, onClickUpdate: onClickUpdate }))] }))] }))] })));
|
|
2278
2197
|
};
|
|
2279
2198
|
var MiniCreditCard = function (_a) {
|
|
2280
2199
|
var _b;
|
|
@@ -2286,7 +2205,7 @@ var MiniCreditCard = function (_a) {
|
|
|
2286
2205
|
var backgroundColor = React.useMemo(function () {
|
|
2287
2206
|
return darkMode ? "var(--row-background-alternate)" : "bg-slate-50";
|
|
2288
2207
|
}, [darkMode]);
|
|
2289
|
-
return (jsxRuntime.jsx("div", __assign({ className: "flex flex-row justify-between items-center p-1 px-3 border-solid ".concat(backgroundColor, " ").concat(borderColor, " rounded-md border") }, { children: paymentMethodData ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.
|
|
2208
|
+
return (jsxRuntime.jsx("div", __assign({ className: "flex flex-row justify-between items-center p-1 px-3 border-solid ".concat(backgroundColor, " ").concat(borderColor, " rounded-md border") }, { children: paymentMethodData ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", __assign({ className: "flex flex-row gap-4" }, { children: jsxRuntime.jsxs("div", __assign({ className: "flex items-center gap-4 space-between w-full" }, { children: [jsxRuntime.jsx(CardImage, { paymentMethodData: paymentMethodData }), jsxRuntime.jsx(Text$g, { children: (_b = paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.metadata) === null || _b === void 0 ? void 0 : _b.identifier }), jsxRuntime.jsx(antd.Tag, __assign({ color: isExpired(paymentMethodData) ? "red" : "green" }, { children: isExpired(paymentMethodData) ? "Expired" : "Valid" }))] })) })), !hideRemoveButton && (jsxRuntime.jsx(antd.Popconfirm, __assign({ title: "Remove card?", onConfirm: onClickRemove }, { children: jsxRuntime.jsx(antd.Button, __assign({ className: "font-normal p-0", type: "link" }, { children: "Remove" })) })))] })) : (jsxRuntime.jsxs("div", __assign({ className: "flex flex-row gap-2 items-center" }, { children: [jsxRuntime.jsx(CreditCardOutlined$1, {}), jsxRuntime.jsx(Text$g, __assign({ className: "text-slate-400", style: { fontSize: "11px" } }, { children: "No payment method selected" })), jsxRuntime.jsx(antd.Button, { disabled: true, type: "link" })] }))) })));
|
|
2290
2209
|
};
|
|
2291
2210
|
var CardImage = function (_a) {
|
|
2292
2211
|
var _b, _c;
|
|
@@ -2305,7 +2224,7 @@ var CardImage = function (_a) {
|
|
|
2305
2224
|
};
|
|
2306
2225
|
var CardAttribute = function (_a) {
|
|
2307
2226
|
var title = _a.title, value = _a.value;
|
|
2308
|
-
return (jsxRuntime.jsxs("div", __assign({ className: "flex flex-col gap-2" }, { children: [jsxRuntime.jsx("div", __assign({ className: "text-slate-400", style: { fontSize: "11px" } }, { children: title })), jsxRuntime.jsx(Text$
|
|
2227
|
+
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$g, { children: value })] })));
|
|
2309
2228
|
};
|
|
2310
2229
|
var CardActions = function (_a) {
|
|
2311
2230
|
var onClickRemove = _a.onClickRemove, onClickUpdate = _a.onClickUpdate;
|
|
@@ -2321,16 +2240,77 @@ var isExpired = function (paymentMethodData) {
|
|
|
2321
2240
|
var expDate = dayjs(paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.expirationDate);
|
|
2322
2241
|
return expDate.isBefore(dayjs());
|
|
2323
2242
|
};
|
|
2324
|
-
var expirationDate = function (storedPaymentMethod) {
|
|
2325
|
-
return dayjs(storedPaymentMethod === null || storedPaymentMethod === void 0 ? void 0 : storedPaymentMethod.expirationDate).format("MM/YY");
|
|
2243
|
+
var expirationDate = function (storedPaymentMethod) {
|
|
2244
|
+
return dayjs(storedPaymentMethod === null || storedPaymentMethod === void 0 ? void 0 : storedPaymentMethod.expirationDate).format("MM/YY");
|
|
2245
|
+
};
|
|
2246
|
+
|
|
2247
|
+
var SavePaymentMethodFooter = function (_a) {
|
|
2248
|
+
var isSaving = _a.isSaving, onSave = _a.onSave, noPadding = _a.noPadding;
|
|
2249
|
+
var isMobile = common.useIsMobile();
|
|
2250
|
+
var onClickCancel = React.useContext(PaymentContext).onClickCancel;
|
|
2251
|
+
return (jsxRuntime.jsxs("div", __assign({ className: "flex justify-end gap-2 ".concat(noPadding ? "" : "pt-6") }, { children: [onClickCancel && (jsxRuntime.jsx(antd.Button, __assign({ className: "w-full", size: isMobile ? "large" : "middle", onClick: function () { return onClickCancel(); } }, { children: "Cancel" }))), jsxRuntime.jsx(antd.Button, __assign({ className: "w-full", disabled: isSaving, onClick: onSave, size: isMobile ? "large" : "middle", type: "primary" }, { children: isSaving ? "Saving" : "Save" }))] })));
|
|
2252
|
+
};
|
|
2253
|
+
|
|
2254
|
+
var DIGIT_REGEX = /\d/;
|
|
2255
|
+
var isDigit = function (char) { return DIGIT_REGEX.test(char); };
|
|
2256
|
+
var isDeletion = function (char) { return [8, 46].includes(char); }; // Backspace or Delete
|
|
2257
|
+
var isNavigation = function (char) { return [9, 37, 38, 39, 40].includes(char); }; // Tab, Arrows
|
|
2258
|
+
var isModifier = function (char) { return [16, 17, 18].includes(char); }; // Shift, Ctrl, Alt
|
|
2259
|
+
var isValidKey = function (code) {
|
|
2260
|
+
return isDeletion(code) || isNavigation(code) || isModifier(code);
|
|
2261
|
+
};
|
|
2262
|
+
var isValidExpiry = function (expiry) {
|
|
2263
|
+
var month = parseInt(expiry.substring(0, 2), 10);
|
|
2264
|
+
var year = parseInt(expiry.substring(2, 4), 10) + 2000;
|
|
2265
|
+
if (isNaN(month) || isNaN(year))
|
|
2266
|
+
return false;
|
|
2267
|
+
if (month < 1 || month > 12)
|
|
2268
|
+
return false;
|
|
2269
|
+
return true;
|
|
2270
|
+
};
|
|
2271
|
+
var isCardExpired = function (expiry) {
|
|
2272
|
+
var month = parseInt(expiry.substring(0, 2), 10);
|
|
2273
|
+
var year = parseInt(expiry.substring(2, 4), 10) + 2000;
|
|
2274
|
+
var expiryDate = new Date(year, month, 1);
|
|
2275
|
+
return expiryDate < new Date();
|
|
2276
|
+
};
|
|
2277
|
+
var formatCardExpiry = function (cardExpiry) {
|
|
2278
|
+
if (cardExpiry.length <= 2)
|
|
2279
|
+
return cardExpiry;
|
|
2280
|
+
return cardExpiry.substring(0, 2) + "/" + cardExpiry.substring(2);
|
|
2326
2281
|
};
|
|
2327
|
-
|
|
2328
|
-
var
|
|
2329
|
-
var
|
|
2330
|
-
var
|
|
2331
|
-
|
|
2332
|
-
return (jsxRuntime.jsxs("div", __assign({ className: "flex justify-end gap-2 ".concat(noPadding ? "" : "pt-6") }, { children: [onClickCancel && (jsxRuntime.jsx(antd.Button, __assign({ className: "w-full", size: isMobile ? "large" : "middle", onClick: function () { return onClickCancel(); } }, { children: "Cancel" }))), jsxRuntime.jsx(antd.Button, __assign({ className: "w-full", disabled: isSaving, onClick: onSave, size: isMobile ? "large" : "middle", type: "primary" }, { children: isSaving ? "Saving" : "Save" }))] })));
|
|
2282
|
+
// removes spaces from a credit card number
|
|
2283
|
+
var unformatCardNumber = function (cardNumber) {
|
|
2284
|
+
var cardNumberArray = cardNumber.split("");
|
|
2285
|
+
var unformattedCardNumberArray = cardNumberArray.filter(function (character) { return character !== " "; });
|
|
2286
|
+
return unformattedCardNumberArray.join("");
|
|
2333
2287
|
};
|
|
2288
|
+
var storePayment = function (options, plugin, apiHost, accountId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2289
|
+
var testCreditCardNumber, testCreditCardCvc, testCreditCardExpirationDate, token, response;
|
|
2290
|
+
return __generator(this, function (_a) {
|
|
2291
|
+
switch (_a.label) {
|
|
2292
|
+
case 0:
|
|
2293
|
+
testCreditCardNumber = options.testCreditCardNumber, testCreditCardCvc = options.testCreditCardCvc, testCreditCardExpirationDate = options.testCreditCardExpirationDate, token = options.token;
|
|
2294
|
+
return [4 /*yield*/, common.invokePlugin({
|
|
2295
|
+
method: "store_payment_method",
|
|
2296
|
+
plugin: plugin,
|
|
2297
|
+
payload: {
|
|
2298
|
+
test_credit_card_number: testCreditCardNumber,
|
|
2299
|
+
test_credit_card_cvc: testCreditCardCvc,
|
|
2300
|
+
test_credit_card_expiration_date: testCreditCardExpirationDate,
|
|
2301
|
+
account_id: accountId,
|
|
2302
|
+
},
|
|
2303
|
+
token: token,
|
|
2304
|
+
apiHost: apiHost,
|
|
2305
|
+
})];
|
|
2306
|
+
case 1:
|
|
2307
|
+
response = _a.sent();
|
|
2308
|
+
if ((response === null || response === void 0 ? void 0 : response.status) !== "success")
|
|
2309
|
+
throw new Error(response === null || response === void 0 ? void 0 : response.message);
|
|
2310
|
+
return [2 /*return*/, response];
|
|
2311
|
+
}
|
|
2312
|
+
});
|
|
2313
|
+
}); };
|
|
2334
2314
|
|
|
2335
2315
|
var DemoPayCardCvc = function (_a) {
|
|
2336
2316
|
var autoFocus = _a.autoFocus, onChange = _a.onChange, placeholder = _a.placeholder, value = _a.value;
|
|
@@ -2425,7 +2405,7 @@ function useSave$1(_a) {
|
|
|
2425
2405
|
return { save: save, isSaving: isSaving };
|
|
2426
2406
|
}
|
|
2427
2407
|
|
|
2428
|
-
var Text$
|
|
2408
|
+
var Text$f = antd.Typography.Text;
|
|
2429
2409
|
var TEST_CARD = "4242424242424242";
|
|
2430
2410
|
var DemoPayForm = function (_a) {
|
|
2431
2411
|
var onFail = _a.onFail, onSavePaymentMethod = _a.onSavePaymentMethod, plugin = _a.plugin;
|
|
@@ -2486,7 +2466,7 @@ var DemoPayForm = function (_a) {
|
|
|
2486
2466
|
var onCardCvcChange = function (cvc) {
|
|
2487
2467
|
setCardDetails(__assign(__assign({}, cardDetails), { cvc: cvc }));
|
|
2488
2468
|
};
|
|
2489
|
-
return (jsxRuntime.jsxs("div", __assign({ className: "flex flex-col gap-2" }, { children: [jsxRuntime.jsxs(StyledInputs, __assign({ className: "flex flex-col gap-2", darkMode: darkMode !== null && darkMode !== void 0 ? darkMode : false }, { children: [jsxRuntime.jsx(DemoPayCardNumber, { onChange: onCardNumberChange, value: cardDetails.number }), jsxRuntime.jsxs("div", __assign({ className: "flex gap-2" }, { children: [jsxRuntime.jsx(DemoPayExpiry, { onChange: onCardExpiryChange, value: cardDetails.expiry }), jsxRuntime.jsx(DemoPayCardCvc, { onChange: onCardCvcChange, value: cardDetails.cvc })] }))] })), jsxRuntime.jsx(Text$
|
|
2469
|
+
return (jsxRuntime.jsxs("div", __assign({ className: "flex flex-col gap-2" }, { children: [jsxRuntime.jsxs(StyledInputs, __assign({ className: "flex flex-col gap-2", darkMode: darkMode !== null && darkMode !== void 0 ? darkMode : false }, { children: [jsxRuntime.jsx(DemoPayCardNumber, { onChange: onCardNumberChange, value: cardDetails.number }), jsxRuntime.jsxs("div", __assign({ className: "flex gap-2" }, { children: [jsxRuntime.jsx(DemoPayExpiry, { onChange: onCardExpiryChange, value: cardDetails.expiry }), jsxRuntime.jsx(DemoPayCardCvc, { onChange: onCardCvcChange, value: cardDetails.cvc })] }))] })), jsxRuntime.jsx(Text$f, __assign({ className: "text-xs" }, { children: "DemoPay is for testing only." })), jsxRuntime.jsx(SavePaymentMethodFooter, { isSaving: isSaving, onSave: onSave })] })));
|
|
2490
2470
|
};
|
|
2491
2471
|
var StyledInputs = styled__default["default"].div(templateObject_1$7 || (templateObject_1$7 = __makeTemplateObject(["\n .ant-input {\n background-color: ", " !important;\n }\n .ant-input:not(:focus) {\n border-color: ", " !important;\n }\n"], ["\n .ant-input {\n background-color: ", " !important;\n }\n .ant-input:not(:focus) {\n border-color: ", " !important;\n }\n"])), function (_a) {
|
|
2492
2472
|
var darkMode = _a.darkMode;
|
|
@@ -2497,6 +2477,91 @@ var StyledInputs = styled__default["default"].div(templateObject_1$7 || (templat
|
|
|
2497
2477
|
});
|
|
2498
2478
|
var templateObject_1$7;
|
|
2499
2479
|
|
|
2480
|
+
var createPaymentMethod = function (_a) {
|
|
2481
|
+
var paymentMethodId = _a.paymentMethodId, plugin = _a.plugin, token = _a.token, apiHost = _a.apiHost, accountId = _a.accountId;
|
|
2482
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
2483
|
+
var response;
|
|
2484
|
+
return __generator(this, function (_b) {
|
|
2485
|
+
switch (_b.label) {
|
|
2486
|
+
case 0: return [4 /*yield*/, common.invokePlugin({
|
|
2487
|
+
plugin: plugin,
|
|
2488
|
+
method: "store_payment_method",
|
|
2489
|
+
payload: {
|
|
2490
|
+
payment_method_id: paymentMethodId,
|
|
2491
|
+
account_id: accountId,
|
|
2492
|
+
},
|
|
2493
|
+
token: token,
|
|
2494
|
+
apiHost: apiHost,
|
|
2495
|
+
})];
|
|
2496
|
+
case 1:
|
|
2497
|
+
response = _b.sent();
|
|
2498
|
+
if (response.status !== "success")
|
|
2499
|
+
throw new Error(response.message || "Unknown error");
|
|
2500
|
+
return [2 /*return*/, response];
|
|
2501
|
+
}
|
|
2502
|
+
});
|
|
2503
|
+
});
|
|
2504
|
+
};
|
|
2505
|
+
var createSetupIntent = function (plugin, token, apiHost, accountId) {
|
|
2506
|
+
return common.invokePlugin({
|
|
2507
|
+
plugin: plugin,
|
|
2508
|
+
method: "create_setup_intent",
|
|
2509
|
+
token: token,
|
|
2510
|
+
apiHost: apiHost,
|
|
2511
|
+
payload: {
|
|
2512
|
+
account_id: accountId,
|
|
2513
|
+
},
|
|
2514
|
+
});
|
|
2515
|
+
};
|
|
2516
|
+
var fetchStripeKey = function (plugin, token, apiHost, accountId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2517
|
+
var response;
|
|
2518
|
+
return __generator(this, function (_a) {
|
|
2519
|
+
switch (_a.label) {
|
|
2520
|
+
case 0: return [4 /*yield*/, common.invokePlugin({
|
|
2521
|
+
plugin: plugin,
|
|
2522
|
+
method: "retrieve_config",
|
|
2523
|
+
token: token,
|
|
2524
|
+
apiHost: apiHost,
|
|
2525
|
+
payload: {
|
|
2526
|
+
account_id: accountId,
|
|
2527
|
+
},
|
|
2528
|
+
})];
|
|
2529
|
+
case 1:
|
|
2530
|
+
response = _a.sent();
|
|
2531
|
+
return [2 /*return*/, response];
|
|
2532
|
+
}
|
|
2533
|
+
});
|
|
2534
|
+
}); };
|
|
2535
|
+
pure.loadStripe.setLoadParameters({ advancedFraudSignals: false });
|
|
2536
|
+
var useStripePlugin = function (plugin, token, apiHost, accountId) {
|
|
2537
|
+
var _a = React.useState(null), stripe = _a[0], setStripe = _a[1];
|
|
2538
|
+
var showErrorNotification = common.useErrorNotification();
|
|
2539
|
+
var options = {
|
|
2540
|
+
mode: "setup",
|
|
2541
|
+
// TODO: Fetch currency from the entity/account
|
|
2542
|
+
currency: "usd",
|
|
2543
|
+
setupFutureUsage: "off_session",
|
|
2544
|
+
};
|
|
2545
|
+
React.useEffect(function () {
|
|
2546
|
+
var _a, _b;
|
|
2547
|
+
if (!plugin)
|
|
2548
|
+
return;
|
|
2549
|
+
if (((_b = (_a = plugin.components) === null || _a === void 0 ? void 0 : _a.frontend) === null || _b === void 0 ? void 0 : _b[0].name) !== "StripePayment")
|
|
2550
|
+
return;
|
|
2551
|
+
fetchStripeKey(plugin, token, apiHost || "", accountId)
|
|
2552
|
+
.then(function (_a) {
|
|
2553
|
+
var payload = _a.payload;
|
|
2554
|
+
return pure.loadStripe(payload.publishable_key).then(setStripe);
|
|
2555
|
+
})
|
|
2556
|
+
.catch(function (error) {
|
|
2557
|
+
console.error("Caught Error in fetching stripe key: ", error);
|
|
2558
|
+
showErrorNotification(error.message, "Unexpected Error fetching key");
|
|
2559
|
+
});
|
|
2560
|
+
// eslint-disable-next-line
|
|
2561
|
+
}, [plugin, token]);
|
|
2562
|
+
return { stripe: stripe, options: options };
|
|
2563
|
+
};
|
|
2564
|
+
|
|
2500
2565
|
function useSave(_a) {
|
|
2501
2566
|
var _this = this;
|
|
2502
2567
|
var onSaveSuccess = _a.onSaveSuccess;
|
|
@@ -2504,7 +2569,8 @@ function useSave(_a) {
|
|
|
2504
2569
|
var _b = React.useState(false), isSaving = _b[0], setIsSaving = _b[1];
|
|
2505
2570
|
var elements = reactStripeJs.useElements();
|
|
2506
2571
|
var stripe = reactStripeJs.useStripe();
|
|
2507
|
-
var
|
|
2572
|
+
var apiHost = React.useContext(BunnyContext).apiHost;
|
|
2573
|
+
var token = useToken();
|
|
2508
2574
|
var accountId = React.useContext(PaymentContext).accountId;
|
|
2509
2575
|
var save = function (_a) {
|
|
2510
2576
|
var plugin = _a.plugin;
|
|
@@ -2615,12 +2681,7 @@ var PaymentMethodForm = function (_a) {
|
|
|
2615
2681
|
// This is just a wrapper to fetch the stripe object and pass it to the form
|
|
2616
2682
|
var StripeForm = function (_a) {
|
|
2617
2683
|
var plugin = _a.plugin, onFail = _a.onFail, onSavePaymentMethod = _a.onSavePaymentMethod;
|
|
2618
|
-
|
|
2619
|
-
var accountId = React.useContext(PaymentContext).accountId;
|
|
2620
|
-
var _c = useStripePlugin(plugin, token, apiHost, accountId), stripe = _c.stripe, options = _c.options;
|
|
2621
|
-
if (!stripe)
|
|
2622
|
-
return null;
|
|
2623
|
-
return (jsxRuntime.jsx(reactStripeJs.Elements, __assign({ options: options, stripe: stripe }, { children: jsxRuntime.jsx(PaymentMethodForm, { plugin: plugin, onFail: onFail, onSavePaymentMethod: onSavePaymentMethod }) })));
|
|
2684
|
+
return (jsxRuntime.jsx(PaymentMethodForm, { plugin: plugin, onFail: onFail, onSavePaymentMethod: onSavePaymentMethod }));
|
|
2624
2685
|
};
|
|
2625
2686
|
|
|
2626
2687
|
var PaymentMethodDetails = function (_a) {
|
|
@@ -2643,20 +2704,20 @@ var CardIcon = function () {
|
|
|
2643
2704
|
return (jsxRuntime.jsxs("svg", __assign({ width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: [jsxRuntime.jsx("path", { d: "M15 3.75H3C2.17157 3.75 1.5 4.42157 1.5 5.25V12.75C1.5 13.5784 2.17157 14.25 3 14.25H15C15.8284 14.25 16.5 13.5784 16.5 12.75V5.25C16.5 4.42157 15.8284 3.75 15 3.75Z", stroke: common.SLATE_400, strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), jsxRuntime.jsx("path", { d: "M1.5 7.5H16.5", stroke: common.SLATE_400, strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })] })));
|
|
2644
2705
|
};
|
|
2645
2706
|
|
|
2646
|
-
var Text$
|
|
2707
|
+
var Text$e = antd.Typography.Text;
|
|
2647
2708
|
var PaymentMethodSelector = function (_a) {
|
|
2648
2709
|
var paymentMethodAllowedPlugins = _a.paymentMethodAllowedPlugins, onSelect = _a.onSelect, value = _a.value;
|
|
2649
|
-
return (jsxRuntime.jsx("div", __assign({ className: "flex flex-col gap-2" }, { children: paymentMethodAllowedPlugins === null || paymentMethodAllowedPlugins === void 0 ? void 0 : paymentMethodAllowedPlugins.map(function (plugin, index) { return (jsxRuntime.jsx(PaymentOption, { name: plugin.name, onClick: onSelect,
|
|
2710
|
+
return (jsxRuntime.jsx("div", __assign({ className: "flex flex-col gap-2" }, { children: paymentMethodAllowedPlugins === null || paymentMethodAllowedPlugins === void 0 ? void 0 : paymentMethodAllowedPlugins.map(function (plugin, index) { return (jsxRuntime.jsx(PaymentOption, { name: plugin.name, onClick: onSelect, paymentPlugin: plugin, selected: (value === null || value === void 0 ? void 0 : value.id) === plugin.id }, index)); }) })));
|
|
2650
2711
|
};
|
|
2651
2712
|
var PaymentOption = function (_a) {
|
|
2652
|
-
var selected = _a.selected,
|
|
2713
|
+
var selected = _a.selected, paymentPlugin = _a.paymentPlugin, onClick = _a.onClick, name = _a.name;
|
|
2653
2714
|
var brandColor = React.useContext(BrandContext).brandColor;
|
|
2654
2715
|
var darkMode = React.useContext(BunnyContext).darkMode;
|
|
2655
2716
|
var isAch = name === null || name === void 0 ? void 0 : name.toLowerCase().includes("ach");
|
|
2656
2717
|
var isCard = name === null || name === void 0 ? void 0 : name.toLowerCase().includes("card");
|
|
2657
2718
|
return (jsxRuntime.jsxs(PaymentOptionContainer, __assign({ "$brandColor": brandColor, "$selected": selected, className: "flex justify-between items-center w-full cursor-pointer py-2 px-4 rounded border-solid ".concat(darkMode
|
|
2658
2719
|
? "var(--row-background-dark) border-gray-500"
|
|
2659
|
-
: "bg-slate-50 border-slate-200", " border"), onClick: function () { return onClick(
|
|
2720
|
+
: "bg-slate-50 border-slate-200", " border"), onClick: function () { return onClick(paymentPlugin); } }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex gap-2 items-center" }, { children: [jsxRuntime.jsx(antd.Checkbox, { checked: selected, className: darkMode ? "border-gray-400" : "" }), jsxRuntime.jsx(Text$e, { children: name })] })), isAch ? (jsxRuntime.jsx(BankOutlined$1, { className: "text-slate-400" })) : isCard ? (jsxRuntime.jsx(CardIcon, {})) : (jsxRuntime.jsx(CardIcon, {}))] })));
|
|
2660
2721
|
};
|
|
2661
2722
|
var PaymentOptionContainer = styled__default["default"].div(templateObject_1$6 || (templateObject_1$6 = __makeTemplateObject(["\n transition: border 0.3s ease;\n\n ", "\n\n &:hover {\n border-color: ", ";\n }\n"], ["\n transition: border 0.3s ease;\n\n ", "\n\n &:hover {\n border-color: ", ";\n }\n"])), function (_a) {
|
|
2662
2723
|
var $brandColor = _a.$brandColor, $selected = _a.$selected;
|
|
@@ -2693,224 +2754,79 @@ function useRemovePaymentMethod(paymentPlugins, token, apiHost, accountId) {
|
|
|
2693
2754
|
showErrorNotification(error.message, "Error removing payment method");
|
|
2694
2755
|
});
|
|
2695
2756
|
}
|
|
2696
|
-
}, [paymentPlugins, token, apiHost, queryClient]);
|
|
2697
|
-
return removePaymentMethod;
|
|
2698
|
-
}
|
|
2699
|
-
|
|
2700
|
-
var Panel = antd.Collapse.Panel;
|
|
2701
|
-
var PaymentForm = function (_a) {
|
|
2702
|
-
var entityId = _a.entityId, invoice = _a.invoice, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, quote = _a.quote, accountId = _a.accountId, onSavePaymentMethod = _a.onSavePaymentMethod, overrideToken = _a.overrideToken, graphQLClient = _a.graphQLClient;
|
|
2703
|
-
// Local state
|
|
2704
|
-
var _b = React.useState(), selectedPaymentMethod = _b[0], setSelectedPaymentMethod = _b[1];
|
|
2705
|
-
var _c = React.useState(false), showPaymentMethodForm = _c[0], setShowPaymentMethodForm = _c[1];
|
|
2706
|
-
var paying = !!(quote || invoice);
|
|
2707
|
-
// Hooks
|
|
2708
|
-
var
|
|
2709
|
-
var
|
|
2710
|
-
var
|
|
2711
|
-
var
|
|
2712
|
-
var
|
|
2713
|
-
var
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
if (!arePluginsFetched ||
|
|
2717
|
-
!isPaymentMethodFetched ||
|
|
2718
|
-
selectedPaymentMethod) {
|
|
2719
|
-
return;
|
|
2720
|
-
}
|
|
2721
|
-
var pluginPaymentMethod = paymentMethodAllowedPlugins === null || paymentMethodAllowedPlugins === void 0 ? void 0 : paymentMethodAllowedPlugins.find(function (plugin) { var _a; return plugin.name === ((_a = storedPaymentMethod === null || storedPaymentMethod === void 0 ? void 0 : storedPaymentMethod.metadata) === null || _a === void 0 ? void 0 : _a.issuer); });
|
|
2722
|
-
if (pluginPaymentMethod) {
|
|
2723
|
-
setSelectedPaymentMethod(pluginPaymentMethod);
|
|
2724
|
-
}
|
|
2725
|
-
else if (paymentMethodAllowedPlugins === null || paymentMethodAllowedPlugins === void 0 ? void 0 : paymentMethodAllowedPlugins[0]) {
|
|
2726
|
-
setSelectedPaymentMethod(paymentMethodAllowedPlugins === null || paymentMethodAllowedPlugins === void 0 ? void 0 : paymentMethodAllowedPlugins[0]);
|
|
2727
|
-
}
|
|
2728
|
-
}, [
|
|
2729
|
-
arePluginsFetched,
|
|
2730
|
-
isPaymentMethodFetched,
|
|
2731
|
-
paymentMethodAllowedPlugins,
|
|
2732
|
-
selectedPaymentMethod,
|
|
2733
|
-
setSelectedPaymentMethod,
|
|
2734
|
-
storedPaymentMethod,
|
|
2735
|
-
]);
|
|
2736
|
-
var showPaymentMethodSelector = React.useMemo(function () {
|
|
2737
|
-
var pluginCount = (paymentMethodAllowedPlugins === null || paymentMethodAllowedPlugins === void 0 ? void 0 : paymentMethodAllowedPlugins.length) || 0;
|
|
2738
|
-
return pluginCount > 1;
|
|
2739
|
-
}, [paymentMethodAllowedPlugins]);
|
|
2740
|
-
var handlePaymentSuccess = function (_a) {
|
|
2741
|
-
var pluginPaymentResponse = _a.pluginPaymentResponse, savedPaymentMethodResponse = _a.savedPaymentMethodResponse;
|
|
2742
|
-
// Hide payment method selector and form
|
|
2743
|
-
setShowPaymentMethodForm(false);
|
|
2744
|
-
// Set new selected payment method
|
|
2745
|
-
var paymentMethod = paymentMethodAllowedPlugins === null || paymentMethodAllowedPlugins === void 0 ? void 0 : paymentMethodAllowedPlugins.find(function (plugin) { var _a; return plugin.id === ((_a = pluginPaymentResponse === null || pluginPaymentResponse === void 0 ? void 0 : pluginPaymentResponse.plugin) === null || _a === void 0 ? void 0 : _a.id); });
|
|
2746
|
-
setSelectedPaymentMethod(paymentMethod);
|
|
2747
|
-
// Handle success keeps going up component tree
|
|
2748
|
-
onPaymentSuccess === null || onPaymentSuccess === void 0 ? void 0 : onPaymentSuccess({
|
|
2749
|
-
pluginPaymentResponse: pluginPaymentResponse,
|
|
2750
|
-
savedPaymentMethodResponse: savedPaymentMethodResponse,
|
|
2751
|
-
});
|
|
2752
|
-
};
|
|
2753
|
-
var handleSavePaymentMethod = function () {
|
|
2754
|
-
queryClient.invalidateQueries({
|
|
2755
|
-
queryKey: common.QueryKeyFactory.default.accountPaymentMethodKey,
|
|
2756
|
-
});
|
|
2757
|
-
onSavePaymentMethod === null || onSavePaymentMethod === void 0 ? void 0 : onSavePaymentMethod();
|
|
2758
|
-
setShowPaymentMethodForm(false);
|
|
2759
|
-
};
|
|
2760
|
-
return (jsxRuntime.jsx(PaymentContext.Provider, __assign({ value: {
|
|
2761
|
-
onClickCancel: function () { return setShowPaymentMethodForm(false); },
|
|
2762
|
-
accountId: accountId,
|
|
2763
|
-
overrideToken: overrideToken,
|
|
2764
|
-
} }, { children: jsxRuntime.jsx("div", __assign({ className: "flex flex-col gap-0 w-full" }, { children: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", __assign({ className: "px-4" }, { children: jsxRuntime.jsx(MiniCreditCard, { hideRemoveButton: paying, onClickRemove: function () { return onClickRemove(storedPaymentMethod); }, paymentMethodData: storedPaymentMethod }) })), paying && storedPaymentMethod ? (jsxRuntime.jsx("div", __assign({ className: "px-4" }, { children: jsxRuntime.jsx(CheckoutFooter, { quote: quote, invoice: invoice, onPaymentSuccess: handlePaymentSuccess, plugin: selectedPaymentMethod }) }))) : (
|
|
2765
|
-
//if not paying and payment method is saved, show Collapse
|
|
2766
|
-
jsxRuntime.jsx(antd.Collapse, __assign({ bordered: false, activeKey: showPaymentMethodForm ? "1" : undefined, ghost: true, collapsible: "disabled", destroyInactivePanel: true }, { children: jsxRuntime.jsx(Panel, __assign({ header: jsxRuntime.jsx(jsxRuntime.Fragment, { children: !showPaymentMethodForm ? (jsxRuntime.jsx("div", __assign({ className: "pt-4 px-4" }, { children: jsxRuntime.jsxs(antd.Button, __assign({ onClick: function () {
|
|
2767
|
-
setShowPaymentMethodForm(true);
|
|
2768
|
-
}, type: "default", className: "w-full" }, { children: [storedPaymentMethod ? "Update" : "Add", " payment method"] })) }))) : null }), showArrow: false }, { children: jsxRuntime.jsx("div", { children: selectedPaymentMethod ? (jsxRuntime.jsxs("div", __assign({ className: "flex flex-col gap-2 mt-2" }, { children: [showPaymentMethodSelector && (jsxRuntime.jsx(PaymentMethodSelector, { onSelect: setSelectedPaymentMethod, paymentMethodAllowedPlugins: paymentMethodAllowedPlugins, value: selectedPaymentMethod })), jsxRuntime.jsx("div", __assign({ className: "flex flex-col" }, { children: jsxRuntime.jsx(PaymentMethodDetails, { onFail: onFail, onSavePaymentMethod: handleSavePaymentMethod, paymentMethod: selectedPaymentMethod }) }))] }))) : (jsxRuntime.jsx("div", { children: "No payment method selected" })) }) }), "1") })))] }) })) })));
|
|
2769
|
-
};
|
|
2770
|
-
|
|
2771
|
-
var MUTATION$8 = "\n mutation checkout(\n $invoiceId: ID,\n $quoteId: ID,\n $paymentMethodId: ID,\n $paymentMethodData: CheckoutPaymentMethodAttributes\n ) {\n checkout(\n invoiceId: $invoiceId,\n quoteId: $quoteId,\n paymentMethodId: $paymentMethodId,\n paymentMethodData: $paymentMethodData\n ) {\n invoice {\n id\n state\n amount\n amountDue\n }\n payment {\n id\n state\n amount\n }\n paymentApplication {\n id\n invoiceId\n paymentId\n }\n transaction {\n id\n amount\n }\n }\n }\n";
|
|
2772
|
-
var checkout = function (_a) {
|
|
2773
|
-
var quoteId = _a.quoteId, invoiceId = _a.invoiceId, paymentMethodId = _a.paymentMethodId, paymentMethodData = _a.paymentMethodData, token = _a.token, apiHost = _a.apiHost;
|
|
2774
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
2775
|
-
var mutationVars, response, errors;
|
|
2776
|
-
return __generator(this, function (_b) {
|
|
2777
|
-
switch (_b.label) {
|
|
2778
|
-
case 0:
|
|
2779
|
-
mutationVars = {
|
|
2780
|
-
quoteId: quoteId,
|
|
2781
|
-
invoiceId: invoiceId,
|
|
2782
|
-
paymentMethodId: paymentMethodId,
|
|
2783
|
-
};
|
|
2784
|
-
if (paymentMethodData) {
|
|
2785
|
-
mutationVars.paymentMethodData = __assign(__assign({}, paymentMethodData), { metadata: paymentMethodData.metadata });
|
|
2786
|
-
}
|
|
2787
|
-
return [4 /*yield*/, common.gqlRequest({
|
|
2788
|
-
query: MUTATION$8,
|
|
2789
|
-
token: token,
|
|
2790
|
-
vars: mutationVars,
|
|
2791
|
-
apiHost: apiHost,
|
|
2792
|
-
})];
|
|
2793
|
-
case 1:
|
|
2794
|
-
response = _b.sent();
|
|
2795
|
-
errors = (response === null || response === void 0 ? void 0 : response.checkout).errors;
|
|
2796
|
-
if (errors)
|
|
2797
|
-
throw errors;
|
|
2798
|
-
return [2 /*return*/, {
|
|
2799
|
-
savePaymentMethod: paymentMethodData === null || paymentMethodData === void 0 ? void 0 : paymentMethodData.savePaymentMethod,
|
|
2800
|
-
}];
|
|
2801
|
-
}
|
|
2802
|
-
});
|
|
2803
|
-
});
|
|
2804
|
-
};
|
|
2805
|
-
|
|
2806
|
-
var InvoiceCheckout = function (_a) {
|
|
2807
|
-
var onSuccess = _a.onSuccess, onFail = _a.onFail, invoice = _a.invoice, entityId = _a.entityId;
|
|
2808
|
-
var _b = React.useContext(BunnyContext), apiHost = _b.apiHost, token = _b.token, graphQLClient = _b.graphQLClient;
|
|
2809
|
-
var checkoutMutation = reactQuery.useMutation({
|
|
2810
|
-
mutationFn: function (_a) {
|
|
2811
|
-
var pluginPaymentMethod = _a.pluginPaymentMethod, savedPaymentMethod = _a.savedPaymentMethod;
|
|
2812
|
-
if (savedPaymentMethod) {
|
|
2813
|
-
var paymentMethodId = savedPaymentMethod.paymentMethodId;
|
|
2814
|
-
return checkout({
|
|
2815
|
-
invoiceId: invoice === null || invoice === void 0 ? void 0 : invoice.id,
|
|
2816
|
-
paymentMethodId: paymentMethodId,
|
|
2817
|
-
token: token,
|
|
2818
|
-
apiHost: apiHost,
|
|
2819
|
-
});
|
|
2820
|
-
}
|
|
2821
|
-
else if (pluginPaymentMethod) {
|
|
2822
|
-
var plugin = pluginPaymentMethod.plugin, savePaymentMethod = pluginPaymentMethod.savePaymentMethod, metadata = pluginPaymentMethod.metadata;
|
|
2823
|
-
var paymentToken = pluginPaymentMethod.token;
|
|
2824
|
-
return checkout({
|
|
2825
|
-
invoiceId: invoice === null || invoice === void 0 ? void 0 : invoice.id,
|
|
2826
|
-
paymentMethodData: {
|
|
2827
|
-
metadata: metadata,
|
|
2828
|
-
pluginGuid: plugin.guid,
|
|
2829
|
-
savePaymentMethod: savePaymentMethod,
|
|
2830
|
-
token: paymentToken,
|
|
2831
|
-
},
|
|
2832
|
-
token: token,
|
|
2833
|
-
apiHost: apiHost,
|
|
2834
|
-
});
|
|
2835
|
-
}
|
|
2836
|
-
else
|
|
2837
|
-
throw new Error("No payment method provided");
|
|
2838
|
-
},
|
|
2839
|
-
onSuccess: onSuccess,
|
|
2840
|
-
onError: onFail,
|
|
2841
|
-
});
|
|
2842
|
-
// Handlers
|
|
2843
|
-
var handleCheckout = function (_a) {
|
|
2844
|
-
var pluginPaymentResponse = _a.pluginPaymentResponse, savedPaymentMethodResponse = _a.savedPaymentMethodResponse;
|
|
2845
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
2846
|
-
var token_1, plugin, savePaymentMethod, metadata, paymentMethodId;
|
|
2847
|
-
return __generator(this, function (_b) {
|
|
2848
|
-
if (pluginPaymentResponse) {
|
|
2849
|
-
token_1 = pluginPaymentResponse.token, plugin = pluginPaymentResponse.plugin, savePaymentMethod = pluginPaymentResponse.savePaymentMethod, metadata = pluginPaymentResponse.metadata;
|
|
2850
|
-
checkoutMutation.mutate({
|
|
2851
|
-
pluginPaymentMethod: {
|
|
2852
|
-
savePaymentMethod: savePaymentMethod,
|
|
2853
|
-
plugin: plugin,
|
|
2854
|
-
metadata: metadata,
|
|
2855
|
-
token: token_1,
|
|
2856
|
-
},
|
|
2857
|
-
});
|
|
2858
|
-
}
|
|
2859
|
-
else if (savedPaymentMethodResponse) {
|
|
2860
|
-
paymentMethodId = savedPaymentMethodResponse.paymentMethodId;
|
|
2861
|
-
checkoutMutation.mutate({
|
|
2862
|
-
savedPaymentMethod: {
|
|
2863
|
-
paymentMethodId: paymentMethodId,
|
|
2864
|
-
},
|
|
2865
|
-
});
|
|
2866
|
-
}
|
|
2867
|
-
return [2 /*return*/];
|
|
2868
|
-
});
|
|
2869
|
-
});
|
|
2870
|
-
};
|
|
2871
|
-
return (jsxRuntime.jsx("div", __assign({ className: "w-full pt-12" }, { children: jsxRuntime.jsx(PaymentForm, { entityId: entityId, onPaymentSuccess: handleCheckout, onFail: onFail, invoice: invoice, graphQLClient: graphQLClient }) })));
|
|
2872
|
-
};
|
|
2873
|
-
|
|
2874
|
-
var fetchPDF = function (apiEndpoint, invoiceUuid) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2875
|
-
var response;
|
|
2876
|
-
return __generator(this, function (_a) {
|
|
2877
|
-
switch (_a.label) {
|
|
2878
|
-
case 0:
|
|
2879
|
-
if (!invoiceUuid) {
|
|
2880
|
-
throw new Error("Invoice ID is required to fetch PDF");
|
|
2881
|
-
}
|
|
2882
|
-
return [4 /*yield*/, fetch("".concat(apiEndpoint, "/api/legacy_invoices/").concat(invoiceUuid))];
|
|
2883
|
-
case 1:
|
|
2884
|
-
response = _a.sent();
|
|
2885
|
-
if (!response.ok)
|
|
2886
|
-
throw new Error("Failed to fetch PDF");
|
|
2887
|
-
return [2 /*return*/, response.blob()]; // Return the PDF as a blob
|
|
2888
|
-
}
|
|
2889
|
-
});
|
|
2890
|
-
}); };
|
|
2891
|
-
function InvoicePDF(_a) {
|
|
2892
|
-
var invoiceUuid = _a.invoiceUuid, apiHost = _a.apiHost;
|
|
2893
|
-
var _b = React.useState(undefined), pdfUrl = _b[0], setPdfUrl = _b[1];
|
|
2894
|
-
var _c = reactQuery.useQuery({
|
|
2895
|
-
queryKey: ["invoicePDF", invoiceUuid],
|
|
2896
|
-
queryFn: function () { return fetchPDF(apiHost || "", invoiceUuid); },
|
|
2897
|
-
enabled: Boolean(invoiceUuid),
|
|
2898
|
-
}), pdfBlob = _c.data, isLoading = _c.isLoading;
|
|
2757
|
+
}, [paymentPlugins, token, apiHost, queryClient]);
|
|
2758
|
+
return removePaymentMethod;
|
|
2759
|
+
}
|
|
2760
|
+
|
|
2761
|
+
var Panel = antd.Collapse.Panel;
|
|
2762
|
+
var PaymentForm = function (_a) {
|
|
2763
|
+
var entityId = _a.entityId, invoice = _a.invoice, onFail = _a.onFail, onPaymentSuccess = _a.onPaymentSuccess, quote = _a.quote, accountId = _a.accountId, onSavePaymentMethod = _a.onSavePaymentMethod, overrideToken = _a.overrideToken, graphQLClient = _a.graphQLClient, customCheckoutFunction = _a.customCheckoutFunction;
|
|
2764
|
+
// Local state
|
|
2765
|
+
var _b = React.useState(), selectedPaymentMethod = _b[0], setSelectedPaymentMethod = _b[1];
|
|
2766
|
+
var _c = React.useState(false), showPaymentMethodForm = _c[0], setShowPaymentMethodForm = _c[1];
|
|
2767
|
+
var paying = !!(quote || invoice);
|
|
2768
|
+
// Hooks
|
|
2769
|
+
var apiHost = React.useContext(BunnyContext).apiHost;
|
|
2770
|
+
var token = useToken();
|
|
2771
|
+
var storedPaymentMethod = usePaymentMethod(graphQLClient).data;
|
|
2772
|
+
var isPaymentMethodFetched = storedPaymentMethod !== undefined;
|
|
2773
|
+
var _d = usePaymentPlugins({ entityId: entityId, apiHost: apiHost, token: overrideToken || token }), paymentMethodAllowedPlugins = _d.paymentMethodAllowedPlugins, arePluginsFetched = _d.isFetched;
|
|
2774
|
+
var onClickRemove = useRemovePaymentMethod(paymentMethodAllowedPlugins || [], overrideToken || token, apiHost, accountId);
|
|
2775
|
+
var queryClient = reactQuery.useQueryClient();
|
|
2776
|
+
// Set default plugin
|
|
2899
2777
|
React.useEffect(function () {
|
|
2900
|
-
if (
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
return
|
|
2778
|
+
if (!arePluginsFetched ||
|
|
2779
|
+
!isPaymentMethodFetched ||
|
|
2780
|
+
selectedPaymentMethod) {
|
|
2781
|
+
return;
|
|
2904
2782
|
}
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2783
|
+
var pluginPaymentMethod = paymentMethodAllowedPlugins === null || paymentMethodAllowedPlugins === void 0 ? void 0 : paymentMethodAllowedPlugins.find(function (plugin) { var _a, _b, _c; return ((_a = plugin.id) === null || _a === void 0 ? void 0 : _a.toString()) === ((_c = (_b = storedPaymentMethod === null || storedPaymentMethod === void 0 ? void 0 : storedPaymentMethod.plugin) === null || _b === void 0 ? void 0 : _b.id) === null || _c === void 0 ? void 0 : _c.toString()); });
|
|
2784
|
+
if (pluginPaymentMethod) {
|
|
2785
|
+
setSelectedPaymentMethod(pluginPaymentMethod);
|
|
2786
|
+
}
|
|
2787
|
+
else if (paymentMethodAllowedPlugins === null || paymentMethodAllowedPlugins === void 0 ? void 0 : paymentMethodAllowedPlugins[0]) {
|
|
2788
|
+
setSelectedPaymentMethod(paymentMethodAllowedPlugins === null || paymentMethodAllowedPlugins === void 0 ? void 0 : paymentMethodAllowedPlugins[0]);
|
|
2789
|
+
}
|
|
2790
|
+
}, [
|
|
2791
|
+
arePluginsFetched,
|
|
2792
|
+
isPaymentMethodFetched,
|
|
2793
|
+
paymentMethodAllowedPlugins,
|
|
2794
|
+
selectedPaymentMethod,
|
|
2795
|
+
setSelectedPaymentMethod,
|
|
2796
|
+
storedPaymentMethod,
|
|
2797
|
+
]);
|
|
2798
|
+
var showPaymentMethodSelector = React.useMemo(function () {
|
|
2799
|
+
var pluginCount = (paymentMethodAllowedPlugins === null || paymentMethodAllowedPlugins === void 0 ? void 0 : paymentMethodAllowedPlugins.length) || 0;
|
|
2800
|
+
return pluginCount > 1;
|
|
2801
|
+
}, [paymentMethodAllowedPlugins]);
|
|
2802
|
+
var handlePaymentSuccess = function () {
|
|
2803
|
+
// Hide payment method selector and form
|
|
2804
|
+
setShowPaymentMethodForm(false);
|
|
2805
|
+
onPaymentSuccess === null || onPaymentSuccess === void 0 ? void 0 : onPaymentSuccess();
|
|
2806
|
+
};
|
|
2807
|
+
var handleSavePaymentMethod = function () {
|
|
2808
|
+
queryClient.invalidateQueries({
|
|
2809
|
+
queryKey: common.QueryKeyFactory.default.accountPaymentMethodKey,
|
|
2810
|
+
});
|
|
2811
|
+
onSavePaymentMethod === null || onSavePaymentMethod === void 0 ? void 0 : onSavePaymentMethod();
|
|
2812
|
+
setShowPaymentMethodForm(false);
|
|
2813
|
+
};
|
|
2814
|
+
return (jsxRuntime.jsx(PaymentContext.Provider, __assign({ value: {
|
|
2815
|
+
onClickCancel: function () { return setShowPaymentMethodForm(false); },
|
|
2816
|
+
accountId: accountId,
|
|
2817
|
+
overrideToken: overrideToken,
|
|
2818
|
+
storedPaymentMethod: storedPaymentMethod,
|
|
2819
|
+
customCheckoutFunction: customCheckoutFunction,
|
|
2820
|
+
} }, { children: jsxRuntime.jsx(StripeWrapper, __assign({ plugin: selectedPaymentMethod, token: token, apiHost: apiHost, accountId: accountId }, { children: jsxRuntime.jsx("div", __assign({ className: "flex flex-col gap-0 w-full" }, { children: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", __assign({ className: "px-4" }, { children: jsxRuntime.jsx(MiniCreditCard, { onClickRemove: function () { return onClickRemove(storedPaymentMethod); }, paymentMethodData: storedPaymentMethod }) })), paying && storedPaymentMethod ? (jsxRuntime.jsx("div", __assign({ className: "px-4" }, { children: jsxRuntime.jsx(CheckoutFooter, { quote: quote, invoice: invoice, onPaymentSuccess: handlePaymentSuccess, plugin: selectedPaymentMethod }) }))) : (
|
|
2821
|
+
//if not paying and payment method is saved, show Collapse
|
|
2822
|
+
jsxRuntime.jsx(antd.Collapse, __assign({ bordered: false, activeKey: showPaymentMethodForm ? "1" : undefined, ghost: true, collapsible: "disabled", destroyInactivePanel: true }, { children: jsxRuntime.jsx(Panel, __assign({ header: jsxRuntime.jsx(jsxRuntime.Fragment, { children: !showPaymentMethodForm ? (jsxRuntime.jsx("div", __assign({ className: "pt-2" }, { children: jsxRuntime.jsxs(antd.Button, __assign({ onClick: function () {
|
|
2823
|
+
setShowPaymentMethodForm(true);
|
|
2824
|
+
}, type: "default", className: "w-full" }, { children: [storedPaymentMethod ? "Update" : "Add", " payment method"] })) }))) : null }), showArrow: false }, { children: jsxRuntime.jsx("div", { children: selectedPaymentMethod ? (jsxRuntime.jsxs("div", __assign({ className: "flex flex-col gap-2 mt-2" }, { children: [showPaymentMethodSelector && (jsxRuntime.jsx(PaymentMethodSelector, { onSelect: setSelectedPaymentMethod, paymentMethodAllowedPlugins: paymentMethodAllowedPlugins, value: selectedPaymentMethod })), jsxRuntime.jsx("div", __assign({ className: "flex flex-col" }, { children: jsxRuntime.jsx(PaymentMethodDetails, { onFail: onFail, onSavePaymentMethod: handleSavePaymentMethod, paymentMethod: selectedPaymentMethod }) }))] }))) : (jsxRuntime.jsx("div", { children: "No payment method selected" })) }) }), "1") })))] }) })) })) })));
|
|
2825
|
+
};
|
|
2826
|
+
function StripeWrapper(_a) {
|
|
2827
|
+
var children = _a.children, plugin = _a.plugin, token = _a.token, apiHost = _a.apiHost, accountId = _a.accountId;
|
|
2828
|
+
var _b = useStripePlugin(plugin, token, apiHost, accountId), stripe = _b.stripe, options = _b.options;
|
|
2829
|
+
return (jsxRuntime.jsx(reactStripeJs.Elements, __assign({ options: options, stripe: stripe }, { children: children })));
|
|
2914
2830
|
}
|
|
2915
2831
|
|
|
2916
2832
|
function Invoice(_a) {
|
|
@@ -2931,10 +2847,13 @@ function Invoice(_a) {
|
|
|
2931
2847
|
function ActualInvoice() {
|
|
2932
2848
|
// Context
|
|
2933
2849
|
var queryClient = reactQuery.useQueryClient();
|
|
2934
|
-
var _a = React.useContext(InvoiceQuoteContext), id = _a.id, invoiceQuoteViewComponent = _a.invoiceQuoteViewComponent, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick,
|
|
2935
|
-
|
|
2850
|
+
var _a = React.useContext(InvoiceQuoteContext), id = _a.id, invoiceQuoteViewComponent = _a.invoiceQuoteViewComponent, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick,
|
|
2851
|
+
// onPaymentSuccess,
|
|
2852
|
+
entityId = _a.entityId, className = _a.className;
|
|
2853
|
+
var _b = React.useContext(BunnyContext), apiHost = _b.apiHost, onTokenExpired = _b.onTokenExpired, graphQLClient = _b.graphQLClient;
|
|
2854
|
+
var token = useToken();
|
|
2936
2855
|
// Local state
|
|
2937
|
-
var isMobile = common.useIsMobile();
|
|
2856
|
+
var isMobile = common.useIsMobile(common.BreakpointNumbers.lg);
|
|
2938
2857
|
// Hooks
|
|
2939
2858
|
var showSuccessNotification = common.useSuccessNotification();
|
|
2940
2859
|
var handleAllErrorFormats = common.useAllErrorFormats(onTokenExpired);
|
|
@@ -2950,19 +2869,17 @@ function ActualInvoice() {
|
|
|
2950
2869
|
}
|
|
2951
2870
|
if (!formattedInvoice)
|
|
2952
2871
|
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
2953
|
-
var onSuccess = function (
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
queryKey: common.QueryKeyFactory.default.accountPaymentMethodKey,
|
|
2958
|
-
});
|
|
2872
|
+
var onSuccess = function () {
|
|
2873
|
+
// queryClient.invalidateQueries({
|
|
2874
|
+
// queryKey: QueryKeyFactory.default.accountPaymentMethodKey,
|
|
2875
|
+
// });
|
|
2959
2876
|
queryClient.invalidateQueries({
|
|
2960
2877
|
queryKey: common.QueryKeyFactory.default.transactionsKey(),
|
|
2961
2878
|
});
|
|
2962
2879
|
queryClient.invalidateQueries({
|
|
2963
2880
|
queryKey: common.QueryKeyFactory.default.createFormattedInvoiceKey(token, id),
|
|
2964
2881
|
});
|
|
2965
|
-
|
|
2882
|
+
// onPaymentSuccess?.(savePaymentMethod);
|
|
2966
2883
|
showSuccessNotification("Your invoice has been paid", "Payment successful");
|
|
2967
2884
|
};
|
|
2968
2885
|
var onFail = function (error) {
|
|
@@ -2971,9 +2888,7 @@ function ActualInvoice() {
|
|
|
2971
2888
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(reactHelmetAsync.Helmet, { children: [jsxRuntime.jsxs("title", { children: [formattedInvoice.vendorName, " ", common.DOCUMENT_NAME.INVOICE] }), jsxRuntime.jsx("meta", { name: "description", content: quoteMetaDescription(formattedInvoice.vendorName) }), jsxRuntime.jsx("meta", { property: "og:type", content: "website" }), jsxRuntime.jsx("meta", { property: "og:title", content: quoteMetaTitle({
|
|
2972
2889
|
vendorName: formattedInvoice.vendorName,
|
|
2973
2890
|
documentName: common.DOCUMENT_NAME.INVOICE,
|
|
2974
|
-
}) }), jsxRuntime.jsx("meta", { property: "og:description", content: quoteMetaDescription(formattedInvoice.vendorName) })] }), jsxRuntime.jsxs("div", __assign({ className: "flex gap-6 ".concat(isMobile ? "flex-col w-full overflow-hidden" : "shadow-padding-xb", " ").concat(className) }, { children: [formattedInvoice.isLegacy ? (jsxRuntime.jsx("div", __assign({ className: "flex justify-center w-full" }, { children: jsxRuntime.jsx(InvoicePDF, { invoiceUuid: formattedInvoice.uuid, apiHost: apiHost }) }))) : (invoiceQuoteViewComponent || (jsxRuntime.jsx(InvoiceQuoteView, { html: formattedInvoice.html, formattedInvoice: formattedInvoice, backButtonName: backButtonName, onBackButtonClick: onBackButtonClick }))),
|
|
2975
|
-
onFail(error);
|
|
2976
|
-
}, onSuccess: onSuccess, entityId: entityId }))] }))] }));
|
|
2891
|
+
}) }), jsxRuntime.jsx("meta", { property: "og:description", content: quoteMetaDescription(formattedInvoice.vendorName) })] }), jsxRuntime.jsxs("div", __assign({ className: "flex gap-6 ".concat(isMobile ? "flex-col w-full overflow-hidden" : "shadow-padding-xb", " ").concat(className) }, { children: [formattedInvoice.isLegacy ? (jsxRuntime.jsx("div", __assign({ className: "flex justify-center w-full" }, { children: jsxRuntime.jsx(InvoicePDF, { invoiceUuid: formattedInvoice.uuid, apiHost: apiHost }) }))) : (invoiceQuoteViewComponent || (jsxRuntime.jsx(InvoiceQuoteView, { html: formattedInvoice.html, formattedInvoice: formattedInvoice, backButtonName: backButtonName, onBackButtonClick: onBackButtonClick }))), isInvoicePayable && (jsxRuntime.jsx("div", __assign({ className: "w-full pt-12" }, { children: jsxRuntime.jsx(PaymentForm, { entityId: entityId, onPaymentSuccess: onSuccess, onFail: onFail, invoice: formattedInvoice, graphQLClient: graphQLClient }) })))] }))] }));
|
|
2977
2892
|
}
|
|
2978
2893
|
|
|
2979
2894
|
var MUTATION$7 = function (id) { return "\n query formattedQuote ($id: ID) {\n formattedQuote (id: $id) {\n payableId\n acceptedAt\n acceptedByName\n amount\n amountDue\n amountsByPeriod {\n id\n name\n amount\n }\n object { documents { id filename size date url } }\n billingCity\n billingCountry\n billingState\n billingStreet\n billingZip\n contactName\n currency\n customerBillingCity\n customerBillingCountry\n customerBillingState\n customerBillingStreet\n customerBillingZip\n customerName\n discount\n discountValue\n duration\n endDate\n expiresAt\n html\n formattedLines {\n amount\n amountsByPeriod {\n quantity\n id\n name\n startDate\n endDate\n amount\n amountsByTier {\n id\n tier {\n starts\n ends\n price\n }\n quantity\n amount\n }\n prorationRate\n }\n billingPeriodEnd\n billingPeriodStart\n chargeType\n discount\n frequency\n isRamp\n periods\n planName\n position\n price\n priceDecimals\n priceListChargeId\n priceListChargeName\n priceListId\n priceListName\n priceTiers {\n price\n starts\n }\n pricingModel\n productName\n prorationRate\n quantity\n showProductNameOnLineItem\n taxCode\n trialEndDate\n trialStartDate\n unitOfMeasure\n vatCode\n }\n netPaymentDays\n notes\n number\n poNumberRequired\n salesContactEmail\n sharedAt\n startDate\n state\n subtotal\n taxAmount\n taxNumberLabel\n taxNumberRequired\n vendorName\n }\n }"; };
|
|
@@ -3140,7 +3055,8 @@ var useIsExpired = function (expiresAt) {
|
|
|
3140
3055
|
|
|
3141
3056
|
var PandadocPollingModal = function (_a) {
|
|
3142
3057
|
var isVisible = _a.isVisible, setVisible = _a.setVisible, id = _a.id;
|
|
3143
|
-
var _b = React.useContext(BunnyContext),
|
|
3058
|
+
var _b = React.useContext(BunnyContext), apiHost = _b.apiHost, onTokenExpired = _b.onTokenExpired;
|
|
3059
|
+
var token = useToken();
|
|
3144
3060
|
var graphQLMutation = common.useGraphQLmutation(function () {
|
|
3145
3061
|
console.log("graphQLMutation navigateOnTokenExpired not yet implemented");
|
|
3146
3062
|
}, apiHost || "", function () {
|
|
@@ -3226,7 +3142,7 @@ var DOCUMENT_NAME;
|
|
|
3226
3142
|
DOCUMENT_NAME["QUOTE"] = "quote";
|
|
3227
3143
|
})(DOCUMENT_NAME || (DOCUMENT_NAME = {}));
|
|
3228
3144
|
|
|
3229
|
-
var Text$
|
|
3145
|
+
var Text$d = antd.Typography.Text;
|
|
3230
3146
|
var documentName = DOCUMENT_NAME.QUOTE;
|
|
3231
3147
|
styled__default["default"].div(templateObject_1$4 || (templateObject_1$4 = __makeTemplateObject(["\n span {\n width: 100%;\n }\n"], ["\n span {\n width: 100%;\n }\n"])));
|
|
3232
3148
|
function Quote(_a) {
|
|
@@ -3247,7 +3163,8 @@ function ActualQuote(_a) {
|
|
|
3247
3163
|
var _b, _c;
|
|
3248
3164
|
var entityId = _a.entityId;
|
|
3249
3165
|
// Context
|
|
3250
|
-
var _d = React.useContext(BunnyContext),
|
|
3166
|
+
var _d = React.useContext(BunnyContext), apiHost = _d.apiHost, onTokenExpired = _d.onTokenExpired;
|
|
3167
|
+
var token = useToken();
|
|
3251
3168
|
var entityBranding = React.useContext(BrandContext);
|
|
3252
3169
|
var _e = React.useContext(InvoiceQuoteContext), className = _e.className, id = _e.id, hideDownloadButton = _e.hideDownloadButton;
|
|
3253
3170
|
// Queries
|
|
@@ -3295,7 +3212,7 @@ function ActualQuote(_a) {
|
|
|
3295
3212
|
documentName: documentName,
|
|
3296
3213
|
}) }), jsxRuntime.jsx("meta", { property: "og:description", content: quoteMetaDescription(formattedQuote.vendorName) })] }), jsxRuntime.jsxs("div", __assign({ className: "flex flex-col gap-4 ".concat(className) }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex flex-row justify-end items-center gap-4", id: "acceptance", style: {
|
|
3297
3214
|
color: entityBranding.secondaryColor,
|
|
3298
|
-
} }, { children: [isAccepted && formattedQuote.acceptedAt ? (jsxRuntime.jsx(Text$
|
|
3215
|
+
} }, { children: [isAccepted && formattedQuote.acceptedAt ? (jsxRuntime.jsx(Text$d, { children: "Quote was accepted by ".concat(formattedQuote.acceptedByName, " on ").concat(common.formatDate(formattedQuote.acceptedAt)) })) : null, (!isMobile || !isAccepted) && (jsxRuntime.jsxs("div", __assign({ className: isMobile
|
|
3299
3216
|
? "flex w-full justify-end gap-2"
|
|
3300
3217
|
: "flex items-center justify-end gap-2" }, { children: [!isMobile && !hideDownloadButton ? (jsxRuntime.jsx(antd.Button, __assign({ icon: jsxRuntime.jsx(DownloadOutlined$1, {}), onClick: function () {
|
|
3301
3218
|
return downloadFile(apiHost + "/api/pdf/quote", token);
|
|
@@ -3390,10 +3307,10 @@ var getColor = function (state) {
|
|
|
3390
3307
|
}
|
|
3391
3308
|
};
|
|
3392
3309
|
|
|
3393
|
-
var Text$
|
|
3310
|
+
var Text$c = antd.Typography.Text;
|
|
3394
3311
|
var TransactionDate = function (_a) {
|
|
3395
3312
|
var date = _a.date;
|
|
3396
|
-
return jsxRuntime.jsx(Text$
|
|
3313
|
+
return jsxRuntime.jsx(Text$c, __assign({ className: "text-sm" }, { children: common.formatDate(date) }));
|
|
3397
3314
|
};
|
|
3398
3315
|
|
|
3399
3316
|
// TODO: delete
|
|
@@ -3427,10 +3344,10 @@ var TransactionGridCell = styled__default["default"].div.withConfig({
|
|
|
3427
3344
|
})(templateObject_1$3 || (templateObject_1$3 = __makeTemplateObject(["\n ", "\n\n display: flex;\n align-items: center;\n justify-content: ", ";\n\n text-align: ", ";\n white-space: nowrap;\n font-size: 14px;\n color: ", ";\n\n background-color: inherit;\n\n padding: 1rem;\n min-width: 48px;\n"], ["\n ", "\n\n display: flex;\n align-items: center;\n justify-content: ", ";\n\n text-align: ", ";\n white-space: nowrap;\n font-size: 14px;\n color: ", ";\n\n background-color: inherit;\n\n padding: 1rem;\n min-width: 48px;\n"])), function (props) { return props.gridColumn && "grid-column: ".concat(props.gridColumn, ";"); }, function (props) { return (props.right ? "flex-end" : "flex-start"); }, function (props) { return (props.right ? "right" : "left"); }, common.SLATE_600);
|
|
3428
3345
|
var templateObject_1$3;
|
|
3429
3346
|
|
|
3430
|
-
var Text$
|
|
3347
|
+
var Text$b = antd.Typography.Text;
|
|
3431
3348
|
var TransactionsEmptyState = function () {
|
|
3432
3349
|
var noTransactionsMessage = React.useContext(TransactionsListContext).noTransactionsMessage;
|
|
3433
|
-
return (jsxRuntime.jsx(Text$
|
|
3350
|
+
return (jsxRuntime.jsx(Text$b, __assign({ className: "flex justify-center p-4 text-base" }, { children: noTransactionsMessage || "There are no transactions" })));
|
|
3434
3351
|
};
|
|
3435
3352
|
|
|
3436
3353
|
var isInvoice = function (transaction) {
|
|
@@ -3447,11 +3364,12 @@ var TransactionRowTitle = function (_a) {
|
|
|
3447
3364
|
return (jsxRuntime.jsx("span", __assign({ className: "text-slate-400", style: { fontSize: "11px" } }, { children: transaction.transactionable.number })));
|
|
3448
3365
|
};
|
|
3449
3366
|
|
|
3450
|
-
var Text$
|
|
3367
|
+
var Text$a = antd.Typography.Text;
|
|
3451
3368
|
var TransactionsListDesktop = function (_a) {
|
|
3452
3369
|
var transactions = _a.transactions, onTransactionClick = _a.onTransactionClick;
|
|
3453
3370
|
var columns = React.useContext(TransactionsListContext).columns;
|
|
3454
|
-
var _b = React.useContext(BunnyContext),
|
|
3371
|
+
var _b = React.useContext(BunnyContext), apiHost = _b.apiHost, darkMode = _b.darkMode;
|
|
3372
|
+
var token = useToken();
|
|
3455
3373
|
var showAmount = columns.includes("amount");
|
|
3456
3374
|
var showDateAndTitle = columns.includes("date-and-title");
|
|
3457
3375
|
var showDownload = columns.includes("download");
|
|
@@ -3467,15 +3385,16 @@ var TransactionsListDesktop = function (_a) {
|
|
|
3467
3385
|
backgroundColor: index % 2 === 0
|
|
3468
3386
|
? "var(--row-background".concat(darkMode ? "-dark" : "", ")")
|
|
3469
3387
|
: "var(--row-background-alternate".concat(darkMode ? "-dark" : "", ")"),
|
|
3470
|
-
} }, { children: [!showDateAndTitle && !showState && !showAmount && !showDownload && (jsxRuntime.jsx(TransactionGridCell, { children: jsxRuntime.jsx(Text$
|
|
3388
|
+
} }, { children: [!showDateAndTitle && !showState && !showAmount && !showDownload && (jsxRuntime.jsx(TransactionGridCell, { children: jsxRuntime.jsx(Text$a, { children: "No columns selected" }) })), showDateAndTitle && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(TransactionGridCell, __assign({ right: false }, { children: jsxRuntime.jsx(TransactionDate, { date: transaction.createdAt }) })), jsxRuntime.jsxs(TransactionGridCell, __assign({ right: false, className: "flex items-center gap-2" }, { children: [jsxRuntime.jsx(Text$a, { children: lodash.capitalize(transaction.kind.toLowerCase()) }), jsxRuntime.jsx(TransactionRowTitle, { transaction: transaction })] }))] })), showDownload && (jsxRuntime.jsx(TransactionGridCell, { children: jsxRuntime.jsx(TransactionDownload, { transaction: transaction, token: token, apiHost: apiHost }) })), showState ? (jsxRuntime.jsx(TransactionGridCell, __assign({ right: true }, { children: jsxRuntime.jsx(StateTag, { state: transaction.state }) }))) : null, showAmount && (jsxRuntime.jsx(TransactionGridCell, __assign({ right: true }, { children: jsxRuntime.jsx(Text$a, { children: common.formatCurrency(((_a = transaction === null || transaction === void 0 ? void 0 : transaction.transactionable) === null || _a === void 0 ? void 0 : _a.amount) || transaction.amount, transaction.currencyId) }) })))] }), index));
|
|
3471
3389
|
});
|
|
3472
3390
|
};
|
|
3473
3391
|
|
|
3474
|
-
var Text$
|
|
3392
|
+
var Text$9 = antd.Typography.Text;
|
|
3475
3393
|
var TransactionsListMobile = function (_a) {
|
|
3476
3394
|
var transactions = _a.transactions, onTransactionClick = _a.onTransactionClick;
|
|
3477
3395
|
var columns = React.useContext(TransactionsListContext).columns;
|
|
3478
|
-
var _b = React.useContext(BunnyContext),
|
|
3396
|
+
var _b = React.useContext(BunnyContext), apiHost = _b.apiHost, darkMode = _b.darkMode;
|
|
3397
|
+
var token = useToken();
|
|
3479
3398
|
var showAmount = columns.includes("amount");
|
|
3480
3399
|
var showDateAndTitle = columns.includes("date-and-title");
|
|
3481
3400
|
var showDownload = columns.includes("download");
|
|
@@ -3490,11 +3409,11 @@ var TransactionsListMobile = function (_a) {
|
|
|
3490
3409
|
backgroundColor: index % 2 === 0
|
|
3491
3410
|
? "var(--row-background".concat(darkMode ? "-dark" : "", ")")
|
|
3492
3411
|
: "var(--row-background-alternate".concat(darkMode ? "-dark" : "", ")"),
|
|
3493
|
-
} }, { 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$
|
|
3412
|
+
} }, { 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$9, { children: lodash.capitalize(transaction.kind.toLowerCase()) }), jsxRuntime.jsx(TransactionRowTitle, { transaction: transaction })] })), showState && jsxRuntime.jsx(StateTag, { state: transaction.state })] })), jsxRuntime.jsxs("div", __assign({ className: "flex items-center gap-2" }, { children: [showDateAndTitle && (jsxRuntime.jsx(TransactionDate, { date: transaction.createdAt })), showAmount && showDateAndTitle && jsxRuntime.jsx(Text$9, { children: "\u00B7" }), showAmount && (jsxRuntime.jsx(Text$9, { children: common.formatCurrency(transaction.transactionable.amount || transaction.amount, transaction.currencyId) }))] }))] })) }), showDownload && (jsxRuntime.jsx(TransactionGridCell, __assign({ right: true }, { children: jsxRuntime.jsx(TransactionDownload, { transaction: transaction, token: token, apiHost: apiHost }) })))] }), index));
|
|
3494
3413
|
});
|
|
3495
3414
|
};
|
|
3496
3415
|
|
|
3497
|
-
var Text$
|
|
3416
|
+
var Text$8 = antd.Typography.Text;
|
|
3498
3417
|
var DISPLAY_WIDTH = 1200;
|
|
3499
3418
|
function Transactions(_a) {
|
|
3500
3419
|
var transactionComponent = _a.transactionComponent, _b = _a.showSearchBar, showSearchBar = _b === void 0 ? true : _b, _c = _a.showTitle, showTitle = _c === void 0 ? true : _c, _d = _a.title, title = _d === void 0 ? "Past transactions" : _d, _e = _a.columns, columns = _e === void 0 ? ["date-and-title", "state", "amount", "download"] : _e, className = _a.className, _f = _a.shadow, shadow = _f === void 0 ? "shadow-md" : _f, searchBarClassName = _a.searchBarClassName, _g = _a.useModal, useModal = _g === void 0 ? false : _g, onTransactionClick = _a.onTransactionClick, _h = _a.suppressTransactionDisplay, suppressTransactionDisplay = _h === void 0 ? false : _h, _j = _a.kindsToShow, kindsToShow = _j === void 0 ? [
|
|
@@ -3502,7 +3421,9 @@ function Transactions(_a) {
|
|
|
3502
3421
|
common.TransactionKind.PAYMENT,
|
|
3503
3422
|
common.TransactionKind.REFUND,
|
|
3504
3423
|
common.TransactionKind.WRITE_OFF,
|
|
3505
|
-
] : _j, style = _a.style, filter = _a.filter, noTransactionsMessage = _a.noTransactionsMessage, entityId = _a.entityId, filterTransactions = _a.filterTransactions,
|
|
3424
|
+
] : _j, style = _a.style, filter = _a.filter, noTransactionsMessage = _a.noTransactionsMessage, entityId = _a.entityId, filterTransactions = _a.filterTransactions, _k = _a.sortTransactions, sortTransactions = _k === void 0 ? function (a, b) {
|
|
3425
|
+
return new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime();
|
|
3426
|
+
} : _k;
|
|
3506
3427
|
var contextValues = {
|
|
3507
3428
|
showSearchBar: showSearchBar,
|
|
3508
3429
|
showTitle: showTitle,
|
|
@@ -3523,7 +3444,8 @@ function Transactions(_a) {
|
|
|
3523
3444
|
filterTransactions: filterTransactions,
|
|
3524
3445
|
sortTransactions: sortTransactions,
|
|
3525
3446
|
};
|
|
3526
|
-
var
|
|
3447
|
+
var apiHost = React.useContext(BunnyContext).apiHost;
|
|
3448
|
+
var token = useToken();
|
|
3527
3449
|
// Local state
|
|
3528
3450
|
var _l = React.useState(""), search = _l[0], setSearch = _l[1];
|
|
3529
3451
|
var filterValue = filter ||
|
|
@@ -3600,7 +3522,7 @@ function TransactionsDisplay(_a) {
|
|
|
3600
3522
|
onTransactionDisplayClose === null || onTransactionDisplayClose === void 0 ? void 0 : onTransactionDisplayClose(selectedTransaction);
|
|
3601
3523
|
setDrawerOpen(false);
|
|
3602
3524
|
}
|
|
3603
|
-
return (jsxRuntime.jsxs("div", __assign({ style: style }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex flex-col w-full shadow-padding-xb gap-2 ".concat(isMobile ? "overflow-hidden" : "", " ").concat(className) }, { children: [showTitle || showSearchBar ? (jsxRuntime.jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col gap-1" : "flex-row items-center", " justify-between") }, { children: [showTitle ? (jsxRuntime.jsx(Text$
|
|
3525
|
+
return (jsxRuntime.jsxs("div", __assign({ style: style }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex flex-col w-full shadow-padding-xb gap-2 ".concat(isMobile ? "overflow-hidden" : "", " ").concat(className) }, { children: [showTitle || showSearchBar ? (jsxRuntime.jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col gap-1" : "flex-row items-center", " justify-between") }, { children: [showTitle ? (jsxRuntime.jsx(Text$8, __assign({ className: "shrink-0 font-medium", style: { color: darkMode ? undefined : secondaryColor } }, { children: title }))) : (jsxRuntime.jsx("div", {}) // Empty div so justify-between works
|
|
3604
3526
|
), showSearchBar && (jsxRuntime.jsx("div", __assign({ className: "".concat(isMobile ? "w-full" : "") }, { children: jsxRuntime.jsx(antd.Input, { className: searchBarClassName
|
|
3605
3527
|
? searchBarClassName
|
|
3606
3528
|
: "border border-slate-200", onChange: function (e) {
|
|
@@ -3619,7 +3541,7 @@ function TransactionsDisplay(_a) {
|
|
|
3619
3541
|
}) })) : (jsxRuntime.jsx(jsxRuntime.Fragment, { children: TransactionsListDesktop({
|
|
3620
3542
|
transactions: updatedTransactions,
|
|
3621
3543
|
onTransactionClick: handleTransactionClick,
|
|
3622
|
-
}) })) }))] })), useModal ? (jsxRuntime.jsx(antd.Modal, __assign({ title:
|
|
3544
|
+
}) })) }))] })), useModal ? (jsxRuntime.jsx(antd.Modal, __assign({ title: drawerTitle(), open: drawerOpen, onOk: handleDisplayClose, onCancel: handleDisplayClose, width: DISPLAY_WIDTH, footer: null }, { children: jsxRuntime.jsx(Invoice, { id: (selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.transactionableId) || "", entityId: entityId }) }))) : (jsxRuntime.jsx(antd.Drawer, __assign({ title: drawerTitle(), onClose: handleDisplayClose, open: drawerOpen, width: DISPLAY_WIDTH }, { children: transactionComponent ? (transactionComponent) : (selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.kind) === "INVOICE" ? (jsxRuntime.jsx(Invoice, { id: selectedTransaction.transactionableId, entityId: entityId })) : (jsxRuntime.jsxs(antd.Card, __assign({ className: "shadow-md" }, { children: [jsxRuntime.jsx(antd.Typography.Title, __assign({ level: 2, className: "mb-4" }, { children: "Transaction Details" })), jsxRuntime.jsxs(antd.Typography.Paragraph, { children: [jsxRuntime.jsx("strong", { children: "Amount:" }), " ", jsxRuntime.jsx(antd.Typography.Text, { children: common.formatCurrency((selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.amount) || 0, (selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.currencyId) || "USD") })] }), jsxRuntime.jsxs(antd.Typography.Paragraph, { children: [jsxRuntime.jsx("strong", { children: "Description:" }), " ", jsxRuntime.jsx(antd.Typography.Text, { children: selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.description })] }), jsxRuntime.jsxs(antd.Typography.Paragraph, { children: [jsxRuntime.jsx("strong", { children: "Kind:" }), " ", jsxRuntime.jsx(antd.Typography.Text, { children: selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.kind })] }), jsxRuntime.jsxs(antd.Typography.Paragraph, { children: [jsxRuntime.jsx("strong", { children: "State:" }), " ", jsxRuntime.jsx(antd.Typography.Text, { children: selectedTransaction === null || selectedTransaction === void 0 ? void 0 : selectedTransaction.state })] })] }))) })))] })));
|
|
3623
3545
|
}
|
|
3624
3546
|
|
|
3625
3547
|
function Quotes(_a) {
|
|
@@ -3685,10 +3607,11 @@ function Quotes(_a) {
|
|
|
3685
3607
|
return (jsxRuntime.jsx(TransactionsListContext.Provider, __assign({ value: contextValues }, { children: jsxRuntime.jsx(QuotesWrapper, {}) })));
|
|
3686
3608
|
}
|
|
3687
3609
|
function QuotesWrapper() {
|
|
3688
|
-
var
|
|
3610
|
+
var apiHost = React.useContext(BunnyContext).apiHost;
|
|
3611
|
+
var token = useToken();
|
|
3689
3612
|
var filterFromContext = React.useContext(TransactionsListContext).filter;
|
|
3690
3613
|
// Local state
|
|
3691
|
-
var
|
|
3614
|
+
var _a = React.useState(""), search = _a[0], setSearch = _a[1];
|
|
3692
3615
|
var filter = filterFromContext || (search ? "filter: \"quote.id is ".concat(search, "\"") : "");
|
|
3693
3616
|
// Queries
|
|
3694
3617
|
var data = reactQuery.useQuery({
|
|
@@ -3716,14 +3639,16 @@ function QuotesWrapper() {
|
|
|
3716
3639
|
return (jsxRuntime.jsx(TransactionsDisplay, { transactions: quotesAsTransactions, onSearchValueChanged: setSearch, search: search }));
|
|
3717
3640
|
}
|
|
3718
3641
|
|
|
3642
|
+
var Text$7 = antd.Typography.Text;
|
|
3719
3643
|
var DrawerHeader = function (_a) {
|
|
3720
3644
|
var description = _a.description, onClose = _a.onClose, title = _a.title;
|
|
3721
|
-
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(
|
|
3645
|
+
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(Text$7, __assign({ className: "text-xl", style: { fontWeight: 400 } }, { 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 }))] })));
|
|
3722
3646
|
};
|
|
3723
3647
|
|
|
3724
3648
|
var PaymentMethod = function (_a) {
|
|
3725
3649
|
var entityId = _a.entityId, className = _a.className, _b = _a.shadow, shadow = _b === void 0 ? "shadow-md" : _b, _c = _a.cardEnabled, cardEnabled = _c === void 0 ? true : _c;
|
|
3726
|
-
var _d = React.useContext(BunnyContext),
|
|
3650
|
+
var _d = React.useContext(BunnyContext), apiHost = _d.apiHost, graphQLClient = _d.graphQLClient, onTokenExpired = _d.onTokenExpired;
|
|
3651
|
+
var token = useToken();
|
|
3727
3652
|
// Hooks
|
|
3728
3653
|
var queryClient = reactQuery.useQueryClient();
|
|
3729
3654
|
var paymentPlugins = usePaymentPlugins({ entityId: entityId, apiHost: apiHost, token: token }).paymentPlugins;
|
|
@@ -3855,10 +3780,11 @@ var TaxationForm = function (_a) {
|
|
|
3855
3780
|
var account = _a.account, quote = _a.quote;
|
|
3856
3781
|
// Hooks
|
|
3857
3782
|
var queryClient = reactQuery.useQueryClient();
|
|
3858
|
-
var
|
|
3783
|
+
var apiHost = React.useContext(BunnyContext).apiHost;
|
|
3784
|
+
var token = useToken();
|
|
3859
3785
|
var form = antd.Form.useForm()[0];
|
|
3860
3786
|
// Mutations
|
|
3861
|
-
var
|
|
3787
|
+
var _b = reactQuery.useMutation({
|
|
3862
3788
|
mutationFn: function (changedFormData) { return __awaiter(void 0, void 0, void 0, function () {
|
|
3863
3789
|
var account;
|
|
3864
3790
|
return __generator(this, function (_a) {
|
|
@@ -3880,7 +3806,7 @@ var TaxationForm = function (_a) {
|
|
|
3880
3806
|
queryKey: ["getTaxationRequiredAccountFields", token],
|
|
3881
3807
|
});
|
|
3882
3808
|
},
|
|
3883
|
-
}), updateAccount =
|
|
3809
|
+
}), updateAccount = _b.mutate, isUpdatingAccount = _b.isPending;
|
|
3884
3810
|
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) {
|
|
3885
3811
|
var _a, _b;
|
|
3886
3812
|
return ((_a = option === null || option === void 0 ? void 0 : option.label) !== null && _a !== void 0 ? _a : "").toLowerCase().includes(input.toLowerCase()) ||
|
|
@@ -3896,86 +3822,41 @@ var FormBillingState = function (_a) {
|
|
|
3896
3822
|
|
|
3897
3823
|
var QuoteCheckout = function (_a) {
|
|
3898
3824
|
var account = _a.account, onSuccess = _a.onSuccess, onFail = _a.onFail, quote = _a.quote, taxationRequiredAccountFields = _a.taxationRequiredAccountFields, entityId = _a.entityId;
|
|
3899
|
-
|
|
3825
|
+
var _b = React.useContext(BunnyContext), apiHost = _b.apiHost, graphQLClient = _b.graphQLClient;
|
|
3826
|
+
var token = useToken();
|
|
3900
3827
|
var isMobile = common.useIsMobile();
|
|
3901
|
-
var _b = React.useContext(BunnyContext), apiHost = _b.apiHost, token = _b.token, graphQLClient = _b.graphQLClient;
|
|
3902
3828
|
var _c = React.useState(false), isSaving = _c[0], setIsSaving = _c[1];
|
|
3903
3829
|
var paymentRequired = getQuoteAmountDue(quote) > 0;
|
|
3904
3830
|
var checkoutMutation = reactQuery.useMutation({
|
|
3905
|
-
mutationFn: function (
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
});
|
|
3919
|
-
}
|
|
3920
|
-
if (pluginPaymentMethod) {
|
|
3921
|
-
var plugin = pluginPaymentMethod.plugin, savePaymentMethod = pluginPaymentMethod.savePaymentMethod, metadata = pluginPaymentMethod.metadata;
|
|
3922
|
-
var paymentToken = pluginPaymentMethod.token;
|
|
3923
|
-
return checkout({
|
|
3924
|
-
quoteId: quote.id,
|
|
3925
|
-
paymentMethodData: {
|
|
3926
|
-
metadata: metadata,
|
|
3927
|
-
pluginGuid: plugin.guid,
|
|
3928
|
-
savePaymentMethod: savePaymentMethod,
|
|
3929
|
-
token: paymentToken,
|
|
3930
|
-
},
|
|
3931
|
-
token: token,
|
|
3932
|
-
apiHost: apiHost,
|
|
3933
|
-
});
|
|
3934
|
-
}
|
|
3935
|
-
throw new Error("Pay payment method provided");
|
|
3936
|
-
},
|
|
3831
|
+
mutationFn: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
3832
|
+
return __generator(this, function (_a) {
|
|
3833
|
+
switch (_a.label) {
|
|
3834
|
+
case 0:
|
|
3835
|
+
if (!quote)
|
|
3836
|
+
throw new Error("Quote is required");
|
|
3837
|
+
if (paymentRequired)
|
|
3838
|
+
throw new Error("Payment is required");
|
|
3839
|
+
return [4 /*yield*/, checkout({ quoteId: quote.id, token: token, apiHost: apiHost })];
|
|
3840
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
3841
|
+
}
|
|
3842
|
+
});
|
|
3843
|
+
}); },
|
|
3937
3844
|
onSuccess: onSuccess,
|
|
3938
3845
|
onError: onFail,
|
|
3939
3846
|
});
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
3944
|
-
var token_1, plugin, savePaymentMethod, metadata, paymentMethodId;
|
|
3945
|
-
return __generator(this, function (_b) {
|
|
3847
|
+
function handleCheckoutNoPayment() {
|
|
3848
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3849
|
+
return __generator(this, function (_a) {
|
|
3946
3850
|
setIsSaving(true);
|
|
3947
|
-
|
|
3948
|
-
token_1 = pluginPaymentResponse.token, plugin = pluginPaymentResponse.plugin, savePaymentMethod = pluginPaymentResponse.savePaymentMethod, metadata = pluginPaymentResponse.metadata;
|
|
3949
|
-
checkoutMutation.mutate({
|
|
3950
|
-
pluginPaymentMethod: {
|
|
3951
|
-
savePaymentMethod: savePaymentMethod,
|
|
3952
|
-
plugin: plugin,
|
|
3953
|
-
metadata: metadata,
|
|
3954
|
-
token: token_1,
|
|
3955
|
-
},
|
|
3956
|
-
});
|
|
3957
|
-
}
|
|
3958
|
-
else if (savedPaymentMethodResponse) {
|
|
3959
|
-
paymentMethodId = savedPaymentMethodResponse.paymentMethodId;
|
|
3960
|
-
checkoutMutation.mutate({
|
|
3961
|
-
storedPaymentMethod: {
|
|
3962
|
-
paymentMethodId: paymentMethodId,
|
|
3963
|
-
},
|
|
3964
|
-
});
|
|
3965
|
-
}
|
|
3966
|
-
else {
|
|
3967
|
-
checkoutMutation.mutate({});
|
|
3968
|
-
}
|
|
3851
|
+
checkoutMutation.mutate();
|
|
3969
3852
|
setIsSaving(false);
|
|
3970
3853
|
return [2 /*return*/];
|
|
3971
3854
|
});
|
|
3972
3855
|
});
|
|
3973
|
-
}
|
|
3856
|
+
}
|
|
3974
3857
|
if (taxationRequiredAccountFields)
|
|
3975
3858
|
return (jsxRuntime.jsx(PaymentFormWrapper, __assign({ setMaxHeight: false }, { children: jsxRuntime.jsx(TaxationForm, { account: account, quote: quote }) })));
|
|
3976
|
-
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: paymentRequired ? (jsxRuntime.jsx(PaymentForm, { entityId: entityId, onFail: onFail, onPaymentSuccess:
|
|
3977
|
-
handleCheckout({});
|
|
3978
|
-
}, type: "primary" }, { children: isSaving ? "Processing..." : "Complete order" })), jsxRuntime.jsx("div", __assign({ className: "text-xs text-slate-500" }, { children: "No payment is required" }))] })) }))) }));
|
|
3859
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: paymentRequired ? (jsxRuntime.jsx(PaymentForm, { entityId: entityId, onFail: onFail, onPaymentSuccess: onSuccess, quote: quote, graphQLClient: graphQLClient })) : (jsxRuntime.jsx(PaymentFormWrapper, __assign({ setMaxHeight: false }, { children: jsxRuntime.jsxs("div", __assign({ className: "flex flex-col gap-2 ".concat(isMobile ? "shadow-padding-x" : "") }, { children: [jsxRuntime.jsx(antd.Button, __assign({ onClick: handleCheckoutNoPayment, type: "primary" }, { children: isSaving ? "Processing..." : "Complete order" })), jsxRuntime.jsx("div", __assign({ className: "text-xs text-slate-500" }, { children: "No payment is required" }))] })) }))) }));
|
|
3979
3860
|
};
|
|
3980
3861
|
var PaymentFormWrapper = function (_a) {
|
|
3981
3862
|
var children = _a.children, setMaxHeight = _a.setMaxHeight, className = _a.className;
|
|
@@ -4052,55 +3933,11 @@ var Checkout = function (_a) {
|
|
|
4052
3933
|
return null;
|
|
4053
3934
|
return (jsxRuntime.jsx("div", __assign({ className: "flex flex-col fixed top-0 left-0 right-0 bottom-0 bg-slate-50 overflow-auto", style: {
|
|
4054
3935
|
zIndex: 1001,
|
|
4055
|
-
} }, { children: jsxRuntime.jsxs("div", __assign({ className: pageWrapperClassName(isMobile) }, { children: [jsxRuntime.jsx("div", __assign({ className: "flex justify-end w-full" }, { children: jsxRuntime.jsx(CloseOutlined$1, { className: "text-base shadow-padding-xb", onClick: onCancel }) })), jsxRuntime.jsxs("div", __assign({ className: "flex justify-end gap-6 pt-4 ".concat(isMobile ? "flex-col" : "shadow-padding-xb") }, { children: [((invoice === null || invoice === void 0 ? void 0 : invoice.html) || ((_b = quote === null || quote === void 0 ? void 0 : quote.formattedQuote) === null || _b === void 0 ? void 0 : _b.html)) && (jsxRuntime.jsx(InvoiceQuoteView, { html: invoice ? invoice.html : quote ? quote.formattedQuote.html : "" })), !isMobile && ((invoice === null || invoice === void 0 ? void 0 : invoice.html) || ((_c = quote === null || quote === void 0 ? void 0 : quote.formattedQuote) === null || _c === void 0 ? void 0 : _c.html)) && (jsxRuntime.jsx(antd.Divider, { className: "h-full", type: "vertical" })), invoice ? (jsxRuntime.jsx(
|
|
4056
|
-
onFail(error);
|
|
4057
|
-
}, onSuccess: function (_a) {
|
|
4058
|
-
var savePaymentMethod = _a.savePaymentMethod;
|
|
4059
|
-
onSuccess({ savePaymentMethod: savePaymentMethod });
|
|
4060
|
-
}, entityId: entityId })) : quote ? (jsxRuntime.jsx(QuoteCheckout, { account: account, entityId: entityId, onFail: function (error) {
|
|
3936
|
+
} }, { children: jsxRuntime.jsxs("div", __assign({ className: pageWrapperClassName(isMobile) }, { children: [jsxRuntime.jsx("div", __assign({ className: "flex justify-end w-full" }, { children: jsxRuntime.jsx(CloseOutlined$1, { className: "text-base shadow-padding-xb", onClick: onCancel }) })), jsxRuntime.jsxs("div", __assign({ className: "flex justify-end gap-6 pt-4 ".concat(isMobile ? "flex-col" : "shadow-padding-xb") }, { children: [((invoice === null || invoice === void 0 ? void 0 : invoice.html) || ((_b = quote === null || quote === void 0 ? void 0 : quote.formattedQuote) === null || _b === void 0 ? void 0 : _b.html)) && (jsxRuntime.jsx(InvoiceQuoteView, { html: invoice ? invoice.html : quote ? quote.formattedQuote.html : "" })), !isMobile && ((invoice === null || invoice === void 0 ? void 0 : invoice.html) || ((_c = quote === null || quote === void 0 ? void 0 : quote.formattedQuote) === null || _c === void 0 ? void 0 : _c.html)) && (jsxRuntime.jsx(antd.Divider, { className: "h-full", type: "vertical" })), invoice ? (jsxRuntime.jsx("div", __assign({ className: "w-full pt-12" }, { children: jsxRuntime.jsx(PaymentForm, { entityId: entityId, onPaymentSuccess: onSuccess, onFail: onFail, invoice: invoice, graphQLClient: graphQLClient }) }))) : quote ? (jsxRuntime.jsx(QuoteCheckout, { account: account, entityId: entityId, onFail: function (error) {
|
|
4061
3937
|
onFail(error);
|
|
4062
|
-
}, onSuccess: function (
|
|
4063
|
-
var savePaymentMethod = _a.savePaymentMethod;
|
|
4064
|
-
onSuccess({ savePaymentMethod: savePaymentMethod });
|
|
4065
|
-
}, quote: quote, taxationRequiredAccountFields: taxationRequiredAccountFields, token: token })) : (jsxRuntime.jsx(PaymentForm, { entityId: entityId, onFail: function (error) {
|
|
3938
|
+
}, onSuccess: onSuccess, quote: quote, taxationRequiredAccountFields: taxationRequiredAccountFields, token: token })) : (jsxRuntime.jsx(PaymentForm, { entityId: entityId, onFail: function (error) {
|
|
4066
3939
|
onFail(error);
|
|
4067
|
-
}, onPaymentSuccess:
|
|
4068
|
-
var pluginPaymentResponse = _a.pluginPaymentResponse;
|
|
4069
|
-
onSuccess({
|
|
4070
|
-
savePaymentMethod: pluginPaymentResponse === null || pluginPaymentResponse === void 0 ? void 0 : pluginPaymentResponse.savePaymentMethod,
|
|
4071
|
-
});
|
|
4072
|
-
}, graphQLClient: graphQLClient }))] }))] })) })));
|
|
4073
|
-
};
|
|
4074
|
-
|
|
4075
|
-
var DEFAULT_HEADERS = {
|
|
4076
|
-
"Content-type": "application/json; charset=utf-8",
|
|
4077
|
-
};
|
|
4078
|
-
// !!! Duplicated from @bunnyapp/common due to bug in signup. Uses BunnyProvider token instead of apiToken.
|
|
4079
|
-
var gqlRequest = function (_a) {
|
|
4080
|
-
var query = _a.query, _b = _a.vars, vars = _b === void 0 ? {} : _b, headers = _a.headers, token = _a.token, isInPreviewMode = _a.isInPreviewMode, apiHost = _a.apiHost;
|
|
4081
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
4082
|
-
var graphqlEndpoint, requestHeaders, authorizationHeader, error_1;
|
|
4083
|
-
return __generator(this, function (_c) {
|
|
4084
|
-
switch (_c.label) {
|
|
4085
|
-
case 0:
|
|
4086
|
-
console.log("token in gqlRequest", token);
|
|
4087
|
-
_c.label = 1;
|
|
4088
|
-
case 1:
|
|
4089
|
-
_c.trys.push([1, 3, , 4]);
|
|
4090
|
-
graphqlEndpoint = common.DEFAULT_CONFIG.graphqlEndpoint;
|
|
4091
|
-
requestHeaders = headers || DEFAULT_HEADERS;
|
|
4092
|
-
authorizationHeader = "Bearer ".concat(token);
|
|
4093
|
-
if (!requestHeaders.Authorization && !isInPreviewMode)
|
|
4094
|
-
requestHeaders.Authorization = authorizationHeader;
|
|
4095
|
-
return [4 /*yield*/, request__default["default"]("".concat(apiHost).concat(graphqlEndpoint), query, vars, requestHeaders)];
|
|
4096
|
-
case 2: return [2 /*return*/, _c.sent()];
|
|
4097
|
-
case 3:
|
|
4098
|
-
error_1 = _c.sent();
|
|
4099
|
-
throw error_1;
|
|
4100
|
-
case 4: return [2 /*return*/];
|
|
4101
|
-
}
|
|
4102
|
-
});
|
|
4103
|
-
});
|
|
3940
|
+
}, onPaymentSuccess: onSuccess, graphQLClient: graphQLClient }))] }))] })) })));
|
|
4104
3941
|
};
|
|
4105
3942
|
|
|
4106
3943
|
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}"; };
|
|
@@ -4146,14 +3983,12 @@ var portalSessionCreate = function (_a) {
|
|
|
4146
3983
|
var _b;
|
|
4147
3984
|
return __generator(this, function (_c) {
|
|
4148
3985
|
switch (_c.label) {
|
|
4149
|
-
case 0:
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
apiHost: apiHost,
|
|
4156
|
-
})];
|
|
3986
|
+
case 0: return [4 /*yield*/, gqlRequest({
|
|
3987
|
+
query: MUTATION$3,
|
|
3988
|
+
token: token,
|
|
3989
|
+
vars: { tenantCode: tenantCode, expiry: expiry, returnUrl: returnUrl },
|
|
3990
|
+
apiHost: apiHost,
|
|
3991
|
+
})];
|
|
4157
3992
|
case 1:
|
|
4158
3993
|
response = _c.sent();
|
|
4159
3994
|
errors = (response === null || response === void 0 ? void 0 : response.portalSessionCreate).errors;
|
|
@@ -4219,41 +4054,24 @@ var getPriceList = function (_a) {
|
|
|
4219
4054
|
};
|
|
4220
4055
|
|
|
4221
4056
|
function PaymentForms(_a) {
|
|
4222
|
-
var quote = _a.quote,
|
|
4057
|
+
var quote = _a.quote, handlePaymentSuccess = _a.handlePaymentSuccess, handlePaymentFail = _a.handlePaymentFail, handleSubmit = _a.handleSubmit, proceedingToPayment = _a.proceedingToPayment, entityId = _a.entityId, accountId = _a.accountId, overrideToken = _a.overrideToken, customCheckoutFunction = _a.customCheckoutFunction;
|
|
4223
4058
|
var apiHost = React.useContext(BunnyContext).apiHost;
|
|
4224
|
-
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: quote ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: overrideToken ? (jsxRuntime.jsx(PaymentForm, { entityId: entityId, onFail: handlePaymentFail, onPaymentSuccess:
|
|
4059
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: quote ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: overrideToken ? (jsxRuntime.jsx(PaymentForm, { entityId: entityId, onFail: handlePaymentFail, onPaymentSuccess: handlePaymentSuccess, accountId: accountId, quote: quote, overrideToken: overrideToken, graphQLClient: createGraphQLClient(overrideToken, apiHost), customCheckoutFunction: customCheckoutFunction })) : null })) : (jsxRuntime.jsx(InitialSignupForm, { onSubmit: handleSubmit, submitting: proceedingToPayment })) }));
|
|
4225
4060
|
}
|
|
4226
4061
|
function InitialSignupForm(_a) {
|
|
4227
4062
|
var onSubmit = _a.onSubmit, submitting = _a.submitting;
|
|
4228
|
-
var
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
}
|
|
4234
|
-
|
|
4235
|
-
var _a;
|
|
4236
|
-
var _b = e.target, name = _b.name, value = _b.value;
|
|
4237
|
-
setFormData(__assign(__assign({}, formData), (_a = {}, _a[name] = value, _a)));
|
|
4238
|
-
};
|
|
4239
|
-
return (jsxRuntime.jsxs(antd.Form, __assign({ className: "flex flex-col justify-between h-full w-full", onFinish: function () { return onSubmit(formData); } }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex flex-col space-y-2" }, { children: [jsxRuntime.jsx(antd.Form.Item, __assign({ rules: [{ required: true, message: "Please input your first name!" }], initialValue: formData.firstName }, { children: jsxRuntime.jsx(antd.Input, { placeholder: "First name", value: formData.firstName, onChange: function (e) {
|
|
4240
|
-
handleInputChange(e);
|
|
4241
|
-
setFormData(__assign(__assign({}, formData), { firstName: e.target.value }));
|
|
4242
|
-
} }) })), 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) {
|
|
4243
|
-
handleInputChange(e);
|
|
4244
|
-
setFormData(__assign(__assign({}, formData), { lastName: e.target.value }));
|
|
4245
|
-
} }) })), jsxRuntime.jsx(antd.Form.Item, __assign({ rules: [
|
|
4063
|
+
var form = antd.Form.useForm()[0];
|
|
4064
|
+
function handleSubmit() {
|
|
4065
|
+
form.validateFields({ validateOnly: true }).then(function () {
|
|
4066
|
+
onSubmit(form.getFieldsValue());
|
|
4067
|
+
});
|
|
4068
|
+
}
|
|
4069
|
+
return (jsxRuntime.jsxs(antd.Form, __assign({ className: "flex flex-col justify-between h-full w-full", onFinish: handleSubmit, form: form }, { children: [jsxRuntime.jsxs("div", __assign({ className: "flex flex-col space-y-2" }, { children: [jsxRuntime.jsx(antd.Form.Item, __assign({ name: "firstName", validateTrigger: "onBlur", rules: [{ required: true, message: "Please input your first name!" }] }, { children: jsxRuntime.jsx(antd.Input, { placeholder: "First name" }) })), jsxRuntime.jsx(antd.Form.Item, __assign({ name: "lastName", validateTrigger: "onBlur", rules: [{ required: true, message: "Please input your last name!" }] }, { children: jsxRuntime.jsx(antd.Input, { placeholder: "Last name" }) })), jsxRuntime.jsx(antd.Form.Item, __assign({ name: "email", validateTrigger: "onBlur", rules: [
|
|
4246
4070
|
{ required: true, message: "Please input your email!" },
|
|
4247
4071
|
{ type: "email", message: "Please enter a valid email!" },
|
|
4248
|
-
]
|
|
4249
|
-
handleInputChange(e);
|
|
4250
|
-
setFormData(__assign(__assign({}, formData), { email: e.target.value }));
|
|
4251
|
-
} }) })), jsxRuntime.jsx(antd.Form.Item, __assign({ rules: [
|
|
4072
|
+
] }, { children: jsxRuntime.jsx(antd.Input, { placeholder: "Email" }) })), jsxRuntime.jsx(antd.Form.Item, __assign({ name: "accountName", validateTrigger: "onBlur", rules: [
|
|
4252
4073
|
{ required: true, message: "Please input your account name!" },
|
|
4253
|
-
]
|
|
4254
|
-
handleInputChange(e);
|
|
4255
|
-
setFormData(__assign(__assign({}, formData), { accountName: e.target.value }));
|
|
4256
|
-
} }) }))] })), 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" })) })] })));
|
|
4074
|
+
] }, { children: jsxRuntime.jsx(antd.Input, { placeholder: "Account name" }) }))] })), 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" })) })] })));
|
|
4257
4075
|
}
|
|
4258
4076
|
|
|
4259
4077
|
var Title = antd.Typography.Title, Text$6 = antd.Typography.Text;
|
|
@@ -4267,32 +4085,31 @@ function PriceListDisplay(_a) {
|
|
|
4267
4085
|
var priceListData = _a.priceListData, topNavImageUrl = _a.topNavImageUrl;
|
|
4268
4086
|
if (!priceListData)
|
|
4269
4087
|
return null;
|
|
4270
|
-
|
|
4088
|
+
console.log("topNavImageUrl", topNavImageUrl);
|
|
4089
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx("div", __assign({ className: "flex flex-col justify-between h-full my-12" }, { children: jsxRuntime.jsxs("div", __assign({ className: "flex flex-col space-y-8" }, { children: [jsxRuntime.jsx(antd.Image, { width: 24, src: topNavImageUrl, alt: "Logo", preview: false }), jsxRuntime.jsxs("div", __assign({ className: "flex flex-col" }, { children: [jsxRuntime.jsx(Text$5, __assign({ className: "text-slate-500 font-bold text-lg" }, { children: priceListData.name })), jsxRuntime.jsxs(Text$5, __assign({ className: "font-bold text-xl" }, { children: [common.formatCurrency(priceListData.basePrice, priceListData.currencyId), " ", "/ month"] }))] })), priceListData.trialAllowed ? (jsxRuntime.jsxs("div", __assign({ className: "flex flex-col" }, { children: [jsxRuntime.jsxs(Text$5, __assign({ style: { fontSize: "16px" }, className: "text-slate-500" }, { children: [priceListData.trialLengthDays, " day trial"] })), jsxRuntime.jsx(Text$5, __assign({ className: "text-slate-500", style: { fontSize: "12px" } }, { children: "You will not be charged until the last day of the trial." }))] }))) : null] })) })) }));
|
|
4271
4090
|
}
|
|
4272
4091
|
|
|
4273
4092
|
var showErrorNotification = common.useErrorNotification();
|
|
4274
4093
|
function Signup(_a) {
|
|
4275
|
-
var
|
|
4094
|
+
var companyName = _a.companyName, entityId = _a.entityId, priceListCode = _a.priceListCode, returnUrl = _a.returnUrl, _b = _a.isCardEnabled, isCardEnabled = _b === void 0 ? true : _b, className = _a.className, _c = _a.shadow, shadow = _c === void 0 ? "shadow-md" : _c, style = _a.style;
|
|
4276
4095
|
// Hooks
|
|
4277
4096
|
var _d = React.useContext(BunnyContext), apiHost = _d.apiHost, graphQLClient = _d.graphQLClient;
|
|
4097
|
+
var token = useToken();
|
|
4278
4098
|
var isMobile = common.useIsMobile();
|
|
4279
4099
|
var topNavImageUrl = React.useContext(BrandContext).topNavImageUrl;
|
|
4100
|
+
console.log("topNavImageUrl in signup", topNavImageUrl);
|
|
4280
4101
|
var _e = React.useState(undefined), quote = _e[0], setQuote = _e[1];
|
|
4281
4102
|
var _f = React.useState(undefined), accountId = _f[0], setAccountId = _f[1];
|
|
4282
|
-
var _g = React.useState(undefined),
|
|
4283
|
-
var _h = React.useState(
|
|
4284
|
-
var _j = React.useState(
|
|
4285
|
-
var _k = React.useState(
|
|
4286
|
-
var
|
|
4287
|
-
var _m = React.useState(undefined), paymentMethodGraphQLClient = _m[0], setPaymentMethodGraphQLClient = _m[1];
|
|
4288
|
-
var paymentMethod = usePaymentMethod(paymentMethodGraphQLClient || graphQLClient, accountId).data;
|
|
4103
|
+
var _g = React.useState(undefined), portalSessionToken = _g[0], setPortalSessionToken = _g[1];
|
|
4104
|
+
var _h = React.useState(false), proceedingToPayment = _h[0], setProceedingToPayment = _h[1];
|
|
4105
|
+
var _j = React.useState(false), purchaseSucceeded = _j[0], setPurchaseSucceeded = _j[1];
|
|
4106
|
+
var _k = React.useState(undefined), paymentMethodGraphQLClient = _k[0], setPaymentMethodGraphQLClient = _k[1];
|
|
4107
|
+
var paymentMethod = usePaymentMethod(paymentMethodGraphQLClient || graphQLClient).data;
|
|
4289
4108
|
var queryClient = reactQuery.useQueryClient();
|
|
4290
4109
|
// Queries
|
|
4291
4110
|
var priceListData = reactQuery.useQuery({
|
|
4292
4111
|
queryKey: ["priceList", priceListCode],
|
|
4293
|
-
queryFn: function () {
|
|
4294
|
-
return getPriceList({ token: apiToken, apiHost: apiHost, code: priceListCode });
|
|
4295
|
-
},
|
|
4112
|
+
queryFn: function () { return getPriceList({ token: token, apiHost: apiHost, code: priceListCode }); },
|
|
4296
4113
|
}).data;
|
|
4297
4114
|
function handleSubmit(formData) {
|
|
4298
4115
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -4302,9 +4119,8 @@ function Signup(_a) {
|
|
|
4302
4119
|
case 0:
|
|
4303
4120
|
_a.trys.push([0, 3, , 4]);
|
|
4304
4121
|
setProceedingToPayment(true);
|
|
4305
|
-
setFormData(formData);
|
|
4306
4122
|
return [4 /*yield*/, quoteAccountSignup({
|
|
4307
|
-
token:
|
|
4123
|
+
token: token,
|
|
4308
4124
|
apiHost: apiHost,
|
|
4309
4125
|
entityId: entityId,
|
|
4310
4126
|
priceListCode: priceListCode,
|
|
@@ -4318,9 +4134,8 @@ function Signup(_a) {
|
|
|
4318
4134
|
case 1:
|
|
4319
4135
|
data = _a.sent();
|
|
4320
4136
|
setAccountId(data.account.id);
|
|
4321
|
-
console.log("apiToken", apiToken);
|
|
4322
4137
|
return [4 /*yield*/, portalSessionCreate({
|
|
4323
|
-
token:
|
|
4138
|
+
token: token,
|
|
4324
4139
|
apiHost: apiHost,
|
|
4325
4140
|
tenantCode: data.tenant.code,
|
|
4326
4141
|
expiry: 24,
|
|
@@ -4335,12 +4150,8 @@ function Signup(_a) {
|
|
|
4335
4150
|
queryClient.invalidateQueries({
|
|
4336
4151
|
queryKey: common.QueryKeyFactory.default.accountPaymentMethodKey,
|
|
4337
4152
|
});
|
|
4338
|
-
setQuoteId(data.quote.id);
|
|
4339
4153
|
setProceedingToPayment(false);
|
|
4340
|
-
setQuote(
|
|
4341
|
-
amountDue: data.quote.amountDue,
|
|
4342
|
-
currencyId: data.quote.currencyId,
|
|
4343
|
-
});
|
|
4154
|
+
setQuote(data.quote);
|
|
4344
4155
|
return [3 /*break*/, 4];
|
|
4345
4156
|
case 3:
|
|
4346
4157
|
error_1 = _a.sent();
|
|
@@ -4352,40 +4163,39 @@ function Signup(_a) {
|
|
|
4352
4163
|
});
|
|
4353
4164
|
});
|
|
4354
4165
|
}
|
|
4355
|
-
function
|
|
4166
|
+
function handlePaymentSuccess() {
|
|
4167
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4168
|
+
return __generator(this, function (_a) {
|
|
4169
|
+
setPurchaseSucceeded(true);
|
|
4170
|
+
return [2 /*return*/];
|
|
4171
|
+
});
|
|
4172
|
+
});
|
|
4173
|
+
}
|
|
4174
|
+
function accountSignupFunction(plugin) {
|
|
4356
4175
|
return __awaiter(this, void 0, void 0, function () {
|
|
4357
|
-
var response, plugin;
|
|
4358
4176
|
return __generator(this, function (_a) {
|
|
4359
4177
|
switch (_a.label) {
|
|
4360
4178
|
case 0:
|
|
4361
|
-
if (!
|
|
4362
|
-
throw new Error("
|
|
4363
|
-
}
|
|
4364
|
-
response = paymentSuccess.pluginPaymentResponse;
|
|
4365
|
-
plugin = response === null || response === void 0 ? void 0 : response.plugin;
|
|
4366
|
-
if (!(plugin === null || plugin === void 0 ? void 0 : plugin.id)) {
|
|
4367
|
-
throw new Error("Plugin ID is required");
|
|
4179
|
+
if (!portalSessionToken) {
|
|
4180
|
+
throw new Error("Portal session token is required");
|
|
4368
4181
|
}
|
|
4369
4182
|
if (!accountId) {
|
|
4370
4183
|
throw new Error("Account ID is required");
|
|
4371
4184
|
}
|
|
4372
|
-
if (!
|
|
4373
|
-
throw new Error("
|
|
4185
|
+
if (!(plugin === null || plugin === void 0 ? void 0 : plugin.id)) {
|
|
4186
|
+
throw new Error("Plugin ID is required");
|
|
4374
4187
|
}
|
|
4375
4188
|
return [4 /*yield*/, accountSignup({
|
|
4376
4189
|
token: portalSessionToken,
|
|
4377
4190
|
apiHost: apiHost,
|
|
4378
4191
|
entityId: entityId,
|
|
4379
|
-
quoteId:
|
|
4192
|
+
quoteId: quote === null || quote === void 0 ? void 0 : quote.id,
|
|
4380
4193
|
paymentMethodId: paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.id,
|
|
4381
|
-
pluginId: plugin.id.toString(),
|
|
4194
|
+
pluginId: plugin === null || plugin === void 0 ? void 0 : plugin.id.toString(),
|
|
4382
4195
|
priceListCode: priceListCode,
|
|
4383
4196
|
accountId: accountId,
|
|
4384
4197
|
})];
|
|
4385
|
-
case 1:
|
|
4386
|
-
_a.sent();
|
|
4387
|
-
setPurchaseSucceeded(true);
|
|
4388
|
-
return [2 /*return*/];
|
|
4198
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
4389
4199
|
}
|
|
4390
4200
|
});
|
|
4391
4201
|
});
|
|
@@ -4399,7 +4209,7 @@ function Signup(_a) {
|
|
|
4399
4209
|
};
|
|
4400
4210
|
return (jsxRuntime.jsx(WrapperComponent, __assign({ className: "p-4 flex flex-col ".concat(shadow, " ").concat(className), style: style }, { children: purchaseSucceeded ? (jsxRuntime.jsx(PaymentSuccessDisplay, { amountPaid: (quote === null || quote === void 0 ? void 0 : quote.amountDue) || 0, className: "w-full", companyName: companyName, returnUrl: returnUrl })) : (jsxRuntime.jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col" : "flex-row", " h-full w-full") }, { children: [jsxRuntime.jsx("div", __assign({ className: "flex flex-col ".concat(isMobile ? "items-center" : "w-1/2 items-center") }, { children: jsxRuntime.jsx(PriceListDisplay, { priceListData: priceListData, topNavImageUrl: topNavImageUrl }) })), jsxRuntime.jsx("div", __assign({ className: "".concat(isMobile ? "h-full" : "my-4") }, { children: jsxRuntime.jsx(antd.Divider, { className: "h-full", type: isMobile ? undefined : "vertical" }) })), jsxRuntime.jsx("div", __assign({ className: "flex ".concat(isMobile
|
|
4401
4211
|
? "items-center justify-center my-12"
|
|
4402
|
-
: "w-1/2 items-center justify-center my-12") }, { children: jsxRuntime.jsx("div", __assign({ className: "".concat(isMobile ? "w-full" : "w-1/2") }, { children: jsxRuntime.jsx(PaymentForms, { entityId: entityId, quote: quote,
|
|
4212
|
+
: "w-1/2 items-center justify-center my-12") }, { children: jsxRuntime.jsx("div", __assign({ className: "".concat(isMobile ? "w-full" : "w-1/2") }, { children: jsxRuntime.jsx(PaymentForms, { entityId: entityId, quote: quote, handlePaymentSuccess: handlePaymentSuccess, handlePaymentFail: handlePaymentFail, handleSubmit: handleSubmit, proceedingToPayment: proceedingToPayment, accountId: accountId, overrideToken: portalSessionToken, customCheckoutFunction: accountSignupFunction }) })) }))] }))) })));
|
|
4403
4213
|
}
|
|
4404
4214
|
|
|
4405
4215
|
// WARNING: There is a preview button on APP that will need to be changed if this query is changed
|
|
@@ -4828,8 +4638,9 @@ var SubscriptionCardActions = function (_a) {
|
|
|
4828
4638
|
var _b, _c;
|
|
4829
4639
|
var planChangeOptions = _a.planChangeOptions, subscription = _a.subscription, setEditingQuoteData = _a.setEditingQuoteData, setPayModalVisible = _a.setPayModalVisible;
|
|
4830
4640
|
// Context
|
|
4831
|
-
var
|
|
4832
|
-
var
|
|
4641
|
+
var apiHost = React.useContext(BunnyContext).apiHost;
|
|
4642
|
+
var token = useToken();
|
|
4643
|
+
var _d = React.useContext(SubscriptionsContext), onChangePlanClick = _d.onChangePlanClick, onClickUpgrade = _d.onClickUpgrade, isTempViewOnly = _d.isTempViewOnly;
|
|
4833
4644
|
// Hooks
|
|
4834
4645
|
common.useSuccessNotification();
|
|
4835
4646
|
// const cancelSubscription = useCancelSubscription();
|
|
@@ -5017,7 +4828,8 @@ var SubscriptionCardDesktop = function (_a) {
|
|
|
5017
4828
|
var SubscriptionCardDesktopRow = function (_a) {
|
|
5018
4829
|
var charge = _a.charge, chargeIndex = _a.chargeIndex, subscription = _a.subscription;
|
|
5019
4830
|
// Context
|
|
5020
|
-
var
|
|
4831
|
+
var apiHost = React.useContext(BunnyContext).apiHost;
|
|
4832
|
+
var token = useToken();
|
|
5021
4833
|
// Derived state
|
|
5022
4834
|
var isRamp = charge.isRamp;
|
|
5023
4835
|
var prevCharge = subscription.charges[chargeIndex - 1];
|
|
@@ -5138,7 +4950,8 @@ var SubscriptionsNavigation = function (_a) {
|
|
|
5138
4950
|
var Subscriptions = function (_a) {
|
|
5139
4951
|
var companyName = _a.companyName, entityId = _a.entityId, gap = _a.gap, shadow = _a.shadow, _b = _a.showTitle, showTitle = _b === void 0 ? true : _b, className = _a.className;
|
|
5140
4952
|
// Context
|
|
5141
|
-
var _c = React.useContext(BunnyContext),
|
|
4953
|
+
var _c = React.useContext(BunnyContext), apiHost = _c.apiHost, onTokenExpired = _c.onTokenExpired;
|
|
4954
|
+
var token = useToken();
|
|
5142
4955
|
// Recoil state
|
|
5143
4956
|
// const [updatingChargeQuantityId, setUpdatingChargeQuantityId] =
|
|
5144
4957
|
// useRecoilState(updatingChargeQuantityIdState);
|
|
@@ -8416,39 +8229,53 @@ var getAccount = function (_a) {
|
|
|
8416
8229
|
};
|
|
8417
8230
|
|
|
8418
8231
|
var BillingDetails = function (_a) {
|
|
8419
|
-
var entityId = _a.entityId,
|
|
8420
|
-
var _d = React.useContext(BunnyContext),
|
|
8232
|
+
var entityId = _a.entityId, _b = _a.isCardEnabled, isCardEnabled = _b === void 0 ? true : _b, _c = _a.shadow, shadow = _c === void 0 ? "shadow-md" : _c, className = _a.className, accountIdProp = _a.accountId, hidePaymentMethodForm = _a.hidePaymentMethodForm, countryListFilter = _a.countryListFilter;
|
|
8233
|
+
var _d = React.useContext(BunnyContext), apiHost = _d.apiHost, onTokenExpired = _d.onTokenExpired, graphQLClient = _d.graphQLClient;
|
|
8234
|
+
var token = useToken();
|
|
8421
8235
|
// Hooks
|
|
8422
8236
|
var isMobile = common.useIsMobile();
|
|
8423
8237
|
var queryClient = reactQuery.useQueryClient();
|
|
8424
|
-
var form = antd.Form.useForm()[0];
|
|
8425
|
-
var _e = React.useState(false), isFormEdited = _e[0], setIsFormEdited = _e[1];
|
|
8426
8238
|
var showSuccessNotification = common.useSuccessNotification();
|
|
8427
8239
|
var showErrorNotification = common.useErrorNotification();
|
|
8428
8240
|
var handleAllErrorFormats = common.useAllErrorFormats(onTokenExpired);
|
|
8241
|
+
var paymentMethod = usePaymentMethod(graphQLClient).data;
|
|
8242
|
+
// State
|
|
8243
|
+
var form = antd.Form.useForm()[0];
|
|
8244
|
+
var _e = React.useState(false), isFormEdited = _e[0], setIsFormEdited = _e[1];
|
|
8245
|
+
var _f = React.useState(accountIdProp), accountId = _f[0], setAccountId = _f[1];
|
|
8246
|
+
var filteredCountryList = React.useMemo(function () {
|
|
8247
|
+
return countryListFilter
|
|
8248
|
+
? common.Lists.COUNTRY_LIST.filter(countryListFilter)
|
|
8249
|
+
: common.Lists.COUNTRY_LIST;
|
|
8250
|
+
}, [countryListFilter]);
|
|
8429
8251
|
// Queries
|
|
8430
|
-
var
|
|
8252
|
+
var _g = reactQuery.useQuery({
|
|
8431
8253
|
queryKey: ["account", accountId],
|
|
8432
8254
|
queryFn: function () { return getAccount({ token: token, apiHost: apiHost, id: accountId }); },
|
|
8433
|
-
|
|
8434
|
-
|
|
8255
|
+
enabled: !!accountId,
|
|
8256
|
+
}), account = _g.data, isLoadingAccount = _g.isLoading;
|
|
8257
|
+
var _h = reactQuery.useMutation({
|
|
8435
8258
|
mutationFn: function (changedFormData) { return __awaiter(void 0, void 0, void 0, function () {
|
|
8436
8259
|
var account;
|
|
8437
8260
|
return __generator(this, function (_a) {
|
|
8438
8261
|
switch (_a.label) {
|
|
8439
|
-
case 0:
|
|
8440
|
-
|
|
8441
|
-
|
|
8442
|
-
|
|
8443
|
-
|
|
8444
|
-
|
|
8445
|
-
|
|
8446
|
-
|
|
8447
|
-
|
|
8448
|
-
|
|
8449
|
-
|
|
8450
|
-
|
|
8451
|
-
|
|
8262
|
+
case 0:
|
|
8263
|
+
if (!accountId) {
|
|
8264
|
+
throw new Error("Account ID is required");
|
|
8265
|
+
}
|
|
8266
|
+
return [4 /*yield*/, accountUpdate({
|
|
8267
|
+
accountId: accountId,
|
|
8268
|
+
attributes: {
|
|
8269
|
+
name: changedFormData.name,
|
|
8270
|
+
billingStreet: changedFormData.billingStreet,
|
|
8271
|
+
billingCity: changedFormData.billingCity,
|
|
8272
|
+
billingZip: changedFormData.billingZip,
|
|
8273
|
+
billingState: changedFormData.billingState,
|
|
8274
|
+
billingCountry: changedFormData.billingCountry,
|
|
8275
|
+
},
|
|
8276
|
+
token: token,
|
|
8277
|
+
apiHost: apiHost,
|
|
8278
|
+
})];
|
|
8452
8279
|
case 1:
|
|
8453
8280
|
account = _a.sent();
|
|
8454
8281
|
queryClient.setQueryData(["account", accountId], function (old) {
|
|
@@ -8459,11 +8286,17 @@ var BillingDetails = function (_a) {
|
|
|
8459
8286
|
});
|
|
8460
8287
|
}); },
|
|
8461
8288
|
onSuccess: function () {
|
|
8289
|
+
showSuccessNotification("Your account details have been saved");
|
|
8462
8290
|
queryClient.invalidateQueries({
|
|
8463
8291
|
queryKey: ["getTaxationRequiredAccountFields", token],
|
|
8464
8292
|
});
|
|
8465
8293
|
},
|
|
8466
|
-
}), updateAccount =
|
|
8294
|
+
}), updateAccount = _h.mutate, isUpdatingAccount = _h.isPending;
|
|
8295
|
+
React.useEffect(function () {
|
|
8296
|
+
if (paymentMethod) {
|
|
8297
|
+
setAccountId(paymentMethod.accountId);
|
|
8298
|
+
}
|
|
8299
|
+
}, [paymentMethod]);
|
|
8467
8300
|
React.useEffect(function () {
|
|
8468
8301
|
if (account) {
|
|
8469
8302
|
form.setFieldsValue({
|
|
@@ -8480,33 +8313,35 @@ var BillingDetails = function (_a) {
|
|
|
8480
8313
|
showSuccessNotification("Your payment method has been saved");
|
|
8481
8314
|
}, [queryClient]);
|
|
8482
8315
|
var savePaymentPreCondition = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
8483
|
-
var error_1;
|
|
8484
8316
|
return __generator(this, function (_a) {
|
|
8485
|
-
|
|
8486
|
-
|
|
8487
|
-
|
|
8488
|
-
|
|
8489
|
-
|
|
8490
|
-
|
|
8491
|
-
|
|
8492
|
-
|
|
8493
|
-
|
|
8494
|
-
|
|
8495
|
-
|
|
8496
|
-
|
|
8497
|
-
|
|
8498
|
-
|
|
8499
|
-
|
|
8500
|
-
|
|
8501
|
-
|
|
8317
|
+
form.validateFields({ validateOnly: true }).then(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
8318
|
+
var error_1;
|
|
8319
|
+
return __generator(this, function (_a) {
|
|
8320
|
+
switch (_a.label) {
|
|
8321
|
+
case 0:
|
|
8322
|
+
_a.trys.push([0, 2, 3, 4]);
|
|
8323
|
+
return [4 /*yield*/, form.validateFields()];
|
|
8324
|
+
case 1:
|
|
8325
|
+
_a.sent();
|
|
8326
|
+
updateAccount(form.getFieldsValue());
|
|
8327
|
+
return [2 /*return*/, true];
|
|
8328
|
+
case 2:
|
|
8329
|
+
error_1 = _a.sent();
|
|
8330
|
+
if (error_1 instanceof Error) {
|
|
8331
|
+
showErrorNotification("Failed to update account", error_1.message);
|
|
8332
|
+
}
|
|
8333
|
+
else {
|
|
8334
|
+
showErrorNotification("Please fill out all required fields");
|
|
8335
|
+
}
|
|
8336
|
+
return [2 /*return*/, false];
|
|
8337
|
+
case 3:
|
|
8338
|
+
setIsFormEdited(false);
|
|
8339
|
+
return [7 /*endfinally*/];
|
|
8340
|
+
case 4: return [2 /*return*/];
|
|
8502
8341
|
}
|
|
8503
|
-
|
|
8504
|
-
|
|
8505
|
-
|
|
8506
|
-
showSuccessNotification("Your account details have been saved");
|
|
8507
|
-
return [7 /*endfinally*/];
|
|
8508
|
-
case 5: return [2 /*return*/];
|
|
8509
|
-
}
|
|
8342
|
+
});
|
|
8343
|
+
}); });
|
|
8344
|
+
return [2 /*return*/];
|
|
8510
8345
|
});
|
|
8511
8346
|
}); };
|
|
8512
8347
|
function handleValuesChange(changedValues) {
|
|
@@ -8521,13 +8356,13 @@ var BillingDetails = function (_a) {
|
|
|
8521
8356
|
};
|
|
8522
8357
|
setIsFormEdited(isFormEdited());
|
|
8523
8358
|
}
|
|
8524
|
-
return (jsxRuntime.jsx(WrapperComponent, __assign({ isCardEnabled: isCardEnabled, shadow: shadow, className: className }, { children: jsxRuntime.jsxs("div", __assign({ className: "flex p-2 my-2 ".concat(isMobile ? "flex-col space-y-4" : "flex-row", " gap-4") }, { children: [jsxRuntime.jsxs("div", __assign({ className: "".concat(isMobile ? "w-full" : "w-1/2", " px-4") }, { children: [jsxRuntime.jsx(ReactQueryDevtools2, {}), jsxRuntime.jsx(antd.Skeleton, __assign({ loading: isLoadingAccount }, { children: jsxRuntime.jsxs(antd.Form, __assign({ className: "flex flex-col gap-2", form: form, layout: "vertical", disabled: isUpdatingAccount, onValuesChange: function (changedValues) {
|
|
8359
|
+
return (jsxRuntime.jsx(WrapperComponent, __assign({ isCardEnabled: isCardEnabled, shadow: shadow, className: className }, { children: jsxRuntime.jsxs("div", __assign({ className: "flex p-2 my-2 ".concat(isMobile ? "flex-col space-y-4" : "flex-row", " gap-4") }, { children: [jsxRuntime.jsxs("div", __assign({ className: "".concat(isMobile || hidePaymentMethodForm ? "w-full" : "w-1/2", " px-4") }, { children: [jsxRuntime.jsx(ReactQueryDevtools2, {}), jsxRuntime.jsx(antd.Skeleton, __assign({ loading: isLoadingAccount }, { children: jsxRuntime.jsxs(antd.Form, __assign({ className: "flex flex-col gap-2", form: form, layout: "vertical", disabled: isUpdatingAccount, onValuesChange: function (changedValues) {
|
|
8525
8360
|
handleValuesChange(changedValues);
|
|
8526
8361
|
} }, { children: [jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Account name", name: "name", rules: [
|
|
8527
8362
|
{ required: true, message: "Account name is required" },
|
|
8528
8363
|
] }, { children: jsxRuntime.jsx(antd.Input, {}) })), jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Street address", name: "billingStreet", rules: [
|
|
8529
8364
|
{ required: true, message: "Street address is required" },
|
|
8530
|
-
] }, { children: jsxRuntime.jsx(antd.Input, {}) })), jsxRuntime.jsxs("div", __assign({ className: "flex gap-4" }, { children: [jsxRuntime.jsx(antd.Form.Item, __assign({ label: "City", name: "billingCity", rules: [{ required: true, message: "City is required" }], className: "flex-1" }, { children: jsxRuntime.jsx(antd.Input, {}) })), jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Zipcode", name: "billingZip", rules: [{ required: true, message: "Zipcode is required" }], className: "flex-1" }, { children: jsxRuntime.jsx(antd.Input, {}) }))] })), jsxRuntime.jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col pb-2" : "flex-row", " gap-4") }, { children: [jsxRuntime.jsx(antd.Form.Item, __assign({ label: "State", name: "billingState", className: "flex-1" }, { children: jsxRuntime.jsx(antd.Input, {}) })), jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Country", name: "billingCountry", className: "flex-1", rules: [{ required: true, message: "Country is required" }] }, { children: jsxRuntime.jsx(antd.Select, { options:
|
|
8365
|
+
] }, { children: jsxRuntime.jsx(antd.Input, {}) })), jsxRuntime.jsxs("div", __assign({ className: "flex gap-4" }, { children: [jsxRuntime.jsx(antd.Form.Item, __assign({ label: "City", name: "billingCity", rules: [{ required: true, message: "City is required" }], className: "flex-1" }, { children: jsxRuntime.jsx(antd.Input, {}) })), jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Zipcode", name: "billingZip", rules: [{ required: true, message: "Zipcode is required" }], className: "flex-1" }, { children: jsxRuntime.jsx(antd.Input, {}) }))] })), jsxRuntime.jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col pb-2" : "flex-row", " gap-4") }, { children: [jsxRuntime.jsx(antd.Form.Item, __assign({ label: "State", name: "billingState", className: "flex-1" }, { children: jsxRuntime.jsx(antd.Input, {}) })), jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Country", name: "billingCountry", className: "flex-1", rules: [{ required: true, message: "Country is required" }] }, { children: jsxRuntime.jsx(antd.Select, { options: filteredCountryList, placeholder: "Select a country", showSearch: true, filterOption: function (input, option) {
|
|
8531
8366
|
var _a, _b;
|
|
8532
8367
|
return ((_a = option === null || option === void 0 ? void 0 : option.label) !== null && _a !== void 0 ? _a : "")
|
|
8533
8368
|
.toLowerCase()
|
|
@@ -8535,13 +8370,13 @@ var BillingDetails = function (_a) {
|
|
|
8535
8370
|
((_b = option === null || option === void 0 ? void 0 : option.value) !== null && _b !== void 0 ? _b : "")
|
|
8536
8371
|
.toLowerCase()
|
|
8537
8372
|
.includes(input.toLowerCase());
|
|
8538
|
-
} }) }))] })), jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Email", name: "email" }, { children: jsxRuntime.jsx(antd.Input, { disabled: true }) }))] })) })), jsxRuntime.jsx(antd.Button, __assign({ disabled: !isFormEdited || isUpdatingAccount, className: "w-full mt-4", type: "primary", onClick: function () {
|
|
8373
|
+
} }) }))] })), jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Email", name: "email" }, { children: jsxRuntime.jsx(antd.Input, { disabled: true, placeholder: "Available soon" }) })), jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Tax ID", name: "taxId", tooltip: "Tax ID will be printed on quotes and invoices below the account's address" }, { children: jsxRuntime.jsx(antd.Input, { disabled: true, placeholder: "Available soon" }) }))] })) })), jsxRuntime.jsx(antd.Button, __assign({ disabled: !isFormEdited || isUpdatingAccount, className: "w-full mt-4", type: "primary", onClick: function () {
|
|
8539
8374
|
savePaymentPreCondition();
|
|
8540
|
-
} }, { children: "Save" }))] })), isMobile ? (jsxRuntime.jsx("div", __assign({ className: "mx-4" }, { children: jsxRuntime.jsx(antd.Divider, {}) }))) : (jsxRuntime.jsx("div", { children: jsxRuntime.jsx(antd.Divider, { className: "h-full", type: "vertical" }) })), jsxRuntime.jsx("div", __assign({ className: "".concat(isMobile ? "w-full" : "w-1/2 pt-4", " flex justify-center") }, { children: jsxRuntime.jsx(PaymentForm, { entityId: entityId, onFail: function (error) {
|
|
8541
|
-
|
|
8542
|
-
|
|
8543
|
-
|
|
8544
|
-
|
|
8375
|
+
} }, { children: "Save" }))] })), !hidePaymentMethodForm ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [isMobile ? (jsxRuntime.jsx("div", __assign({ className: "mx-4" }, { children: jsxRuntime.jsx(antd.Divider, {}) }))) : (jsxRuntime.jsx("div", { children: jsxRuntime.jsx(antd.Divider, { className: "h-full", type: "vertical" }) })), jsxRuntime.jsx("div", __assign({ className: "".concat(isMobile ? "w-full" : "w-1/2 pt-4", " flex justify-center") }, { children: jsxRuntime.jsx(PaymentForm, { entityId: entityId, onFail: function (error) {
|
|
8376
|
+
handleAllErrorFormats(error);
|
|
8377
|
+
}, onSavePaymentMethod: function () {
|
|
8378
|
+
onSuccess();
|
|
8379
|
+
}, graphQLClient: graphQLClient }) }))] })) : null] })) })));
|
|
8545
8380
|
};
|
|
8546
8381
|
var WrapperComponent = function (_a) {
|
|
8547
8382
|
var children = _a.children, isCardEnabled = _a.isCardEnabled, shadow = _a.shadow, className = _a.className;
|