@bunnyapp/components 1.0.27 → 1.0.28
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 +17 -13
- package/dist/cjs/src/components/PaymentForm/Stripe/stripeUtils.d.ts +1 -1
- package/dist/cjs/src/components/Signup/PaymentSuccess.d.ts +2 -1
- package/dist/esm/index.js +17 -13
- package/dist/esm/src/components/PaymentForm/Stripe/stripeUtils.d.ts +1 -1
- package/dist/esm/src/components/Signup/PaymentSuccess.d.ts +2 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -2070,7 +2070,7 @@ var ActualCheckoutFooter = function (_a) {
|
|
|
2070
2070
|
var _b = React.useState(false), isPaying = _b[0], setIsPaying = _b[1];
|
|
2071
2071
|
var storedPaymentMethod = React.useContext(PaymentContext).storedPaymentMethod;
|
|
2072
2072
|
var amountDue = quote ? getQuoteAmountDue(quote) : invoice === null || invoice === void 0 ? void 0 : invoice.amountDue;
|
|
2073
|
-
var currencyId = (quote === null || quote === void 0 ? void 0 : quote.currencyId) || (invoice === null || invoice === void 0 ? void 0 : invoice.
|
|
2073
|
+
var currencyId = (quote === null || quote === void 0 ? void 0 : quote.currencyId) || (invoice === null || invoice === void 0 ? void 0 : invoice.currencyId);
|
|
2074
2074
|
// Payment hooks
|
|
2075
2075
|
var payDemoPay = usePay$1({
|
|
2076
2076
|
onPaymentSuccess: onPaymentSuccess,
|
|
@@ -2504,13 +2504,12 @@ var fetchStripeKey = function (plugin, token, apiHost, accountId) { return __awa
|
|
|
2504
2504
|
});
|
|
2505
2505
|
}); };
|
|
2506
2506
|
pure.loadStripe.setLoadParameters({ advancedFraudSignals: false });
|
|
2507
|
-
var useStripePlugin = function (plugin, token, apiHost, accountId) {
|
|
2507
|
+
var useStripePlugin = function (plugin, token, apiHost, currencyId, accountId) {
|
|
2508
2508
|
var _a = React.useState(null), stripe = _a[0], setStripe = _a[1];
|
|
2509
2509
|
var showErrorNotification = common.useErrorNotification();
|
|
2510
2510
|
var options = {
|
|
2511
2511
|
mode: "setup",
|
|
2512
|
-
|
|
2513
|
-
currency: "usd",
|
|
2512
|
+
currency: currencyId,
|
|
2514
2513
|
setupFutureUsage: "off_session",
|
|
2515
2514
|
};
|
|
2516
2515
|
React.useEffect(function () {
|
|
@@ -2742,17 +2741,19 @@ function useRemovePaymentMethod(paymentPlugins, token, apiHost, entityId, accoun
|
|
|
2742
2741
|
|
|
2743
2742
|
var Panel = antd.Collapse.Panel;
|
|
2744
2743
|
var PaymentForm = function (_a) {
|
|
2744
|
+
var _b;
|
|
2745
2745
|
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;
|
|
2746
2746
|
// Local state
|
|
2747
|
-
var
|
|
2748
|
-
var
|
|
2747
|
+
var _c = React.useState(), selectedPaymentMethod = _c[0], setSelectedPaymentMethod = _c[1];
|
|
2748
|
+
var _d = React.useState(false), showPaymentMethodForm = _d[0], setShowPaymentMethodForm = _d[1];
|
|
2749
2749
|
var paying = !!(quote || invoice);
|
|
2750
|
+
var currencyId = (_b = ((quote === null || quote === void 0 ? void 0 : quote.currencyId) || (invoice === null || invoice === void 0 ? void 0 : invoice.currencyId))) === null || _b === void 0 ? void 0 : _b.toLowerCase();
|
|
2750
2751
|
// Hooks
|
|
2751
2752
|
var apiHost = React.useContext(BunnyContext).apiHost;
|
|
2752
2753
|
var token = useToken();
|
|
2753
2754
|
var storedPaymentMethod = usePaymentMethod(graphQLClient, entityId, overrideToken || token).data;
|
|
2754
2755
|
var isPaymentMethodFetched = storedPaymentMethod !== undefined;
|
|
2755
|
-
var
|
|
2756
|
+
var _e = usePaymentPlugins({ entityId: entityId, apiHost: apiHost, token: overrideToken || token }), paymentMethodAllowedPlugins = _e.paymentMethodAllowedPlugins, arePluginsFetched = _e.isFetched;
|
|
2756
2757
|
var onClickRemove = useRemovePaymentMethod(paymentMethodAllowedPlugins || [], overrideToken || token, apiHost, entityId, accountId);
|
|
2757
2758
|
var queryClient = reactQuery.useQueryClient();
|
|
2758
2759
|
// Set default plugin
|
|
@@ -2793,21 +2794,24 @@ var PaymentForm = function (_a) {
|
|
|
2793
2794
|
onSavePaymentMethod === null || onSavePaymentMethod === void 0 ? void 0 : onSavePaymentMethod();
|
|
2794
2795
|
setShowPaymentMethodForm(false);
|
|
2795
2796
|
};
|
|
2797
|
+
if (!currencyId) {
|
|
2798
|
+
return jsxRuntime.jsx("div", { children: "No currency id found from quote or invoice" });
|
|
2799
|
+
}
|
|
2796
2800
|
return (jsxRuntime.jsx(PaymentContext.Provider, __assign({ value: {
|
|
2797
2801
|
onClickCancel: function () { return setShowPaymentMethodForm(false); },
|
|
2798
2802
|
accountId: accountId,
|
|
2799
2803
|
overrideToken: overrideToken,
|
|
2800
2804
|
storedPaymentMethod: storedPaymentMethod,
|
|
2801
2805
|
customCheckoutFunction: customCheckoutFunction,
|
|
2802
|
-
} }, { 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 }) }))) : (
|
|
2806
|
+
} }, { children: jsxRuntime.jsx(StripeWrapper, __assign({ plugin: selectedPaymentMethod, token: token, apiHost: apiHost, currencyId: currencyId, 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 }) }))) : (
|
|
2803
2807
|
//if not paying and payment method is saved, show Collapse
|
|
2804
2808
|
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 () {
|
|
2805
2809
|
setShowPaymentMethodForm(true);
|
|
2806
2810
|
}, type: "default", className: "w-full", id: "addPaymentMethod" }, { 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") })))] }) })) })) })));
|
|
2807
2811
|
};
|
|
2808
2812
|
function StripeWrapper(_a) {
|
|
2809
|
-
var children = _a.children, plugin = _a.plugin, token = _a.token, apiHost = _a.apiHost, accountId = _a.accountId;
|
|
2810
|
-
var _b = useStripePlugin(plugin, token, apiHost, accountId), stripe = _b.stripe, options = _b.options;
|
|
2813
|
+
var children = _a.children, plugin = _a.plugin, token = _a.token, apiHost = _a.apiHost, currencyId = _a.currencyId, accountId = _a.accountId;
|
|
2814
|
+
var _b = useStripePlugin(plugin, token, apiHost, currencyId, accountId), stripe = _b.stripe, options = _b.options;
|
|
2811
2815
|
return (jsxRuntime.jsx(reactStripeJs.Elements, __assign({ options: options, stripe: stripe }, { children: children })));
|
|
2812
2816
|
}
|
|
2813
2817
|
|
|
@@ -4050,8 +4054,8 @@ function InitialSignupForm(_a) {
|
|
|
4050
4054
|
|
|
4051
4055
|
var Title = antd.Typography.Title, Text$4 = antd.Typography.Text;
|
|
4052
4056
|
function PaymentSuccessDisplay(_a) {
|
|
4053
|
-
var amountPaid = _a.amountPaid, className = _a.className, companyName = _a.companyName, returnUrl = _a.returnUrl, style = _a.style;
|
|
4054
|
-
return (jsxRuntime.jsxs("div", __assign({ className: "flex flex-col items-center justify-center h-full ".concat(className), style: style }, { children: [jsxRuntime.jsx(CheckCircleFilled$1, { style: { fontSize: "48px", color: "rgb(52 211 153)" } }), jsxRuntime.jsxs(Title, __assign({ level: 3, className: "mt-2 m-0" }, { children: ["Payment of ", common.formatCurrency(amountPaid,
|
|
4057
|
+
var amountPaid = _a.amountPaid, className = _a.className, companyName = _a.companyName, returnUrl = _a.returnUrl, style = _a.style, currencyId = _a.currencyId;
|
|
4058
|
+
return (jsxRuntime.jsxs("div", __assign({ className: "flex flex-col items-center justify-center h-full ".concat(className), style: style }, { children: [jsxRuntime.jsx(CheckCircleFilled$1, { style: { fontSize: "48px", color: "rgb(52 211 153)" } }), jsxRuntime.jsxs(Title, __assign({ level: 3, className: "mt-2 m-0" }, { children: ["Payment of ", common.formatCurrency(amountPaid, currencyId), " successful"] })), returnUrl && (jsxRuntime.jsxs(Text$4, __assign({ className: "text-slate-500 cursor-pointer underline", onClick: function () { return (window.location.href = returnUrl); } }, { children: ["Back to ", companyName] })))] })));
|
|
4055
4059
|
}
|
|
4056
4060
|
|
|
4057
4061
|
var Text$3 = antd.Typography.Text;
|
|
@@ -4171,7 +4175,7 @@ function Signup(_a) {
|
|
|
4171
4175
|
var children = _a.children, className = _a.className, style = _a.style;
|
|
4172
4176
|
return isCardEnabled ? (jsxRuntime.jsx(Card, __assign({ className: className, style: style }, { children: children }))) : (jsxRuntime.jsx("div", __assign({ className: className, style: style }, { children: children })));
|
|
4173
4177
|
};
|
|
4174
|
-
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
|
|
4178
|
+
return (jsxRuntime.jsx(WrapperComponent, __assign({ className: "p-4 flex flex-col ".concat(shadow, " ").concat(className), style: style }, { children: purchaseSucceeded ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: (quote === null || quote === void 0 ? void 0 : quote.currencyId) !== undefined ? (jsxRuntime.jsx(PaymentSuccessDisplay, { amountPaid: (quote === null || quote === void 0 ? void 0 : quote.amountDue) || 0, className: "w-full", companyName: companyName, returnUrl: returnUrl, currencyId: quote === null || quote === void 0 ? void 0 : quote.currencyId })) : (jsxRuntime.jsx("div", { children: "No currency ID found from Quote" })) })) : (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
|
|
4175
4179
|
? "items-center justify-center my-12"
|
|
4176
4180
|
: "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 }) })) }))] }))) })));
|
|
4177
4181
|
}
|
|
@@ -16,7 +16,7 @@ export declare const createPaymentIntent: ({ payable, savePaymentMethod, memo, p
|
|
|
16
16
|
token: string;
|
|
17
17
|
apiHost: string;
|
|
18
18
|
}) => Promise<any>;
|
|
19
|
-
export declare const useStripePlugin: (plugin: PluginData | undefined, token: string, apiHost: string, accountId?: string) => {
|
|
19
|
+
export declare const useStripePlugin: (plugin: PluginData | undefined, token: string, apiHost: string, currencyId: string, accountId?: string) => {
|
|
20
20
|
stripe: Stripe | null;
|
|
21
21
|
options: {
|
|
22
22
|
mode: "setup";
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export default function PaymentSuccessDisplay({ amountPaid, className, companyName, returnUrl, style, }: {
|
|
2
|
+
export default function PaymentSuccessDisplay({ amountPaid, className, companyName, returnUrl, style, currencyId, }: {
|
|
3
3
|
amountPaid: number;
|
|
4
4
|
className: string;
|
|
5
5
|
companyName: string;
|
|
6
6
|
returnUrl?: string;
|
|
7
7
|
style?: React.CSSProperties;
|
|
8
|
+
currencyId: string;
|
|
8
9
|
}): import("react/jsx-runtime").JSX.Element;
|
package/dist/esm/index.js
CHANGED
|
@@ -2042,7 +2042,7 @@ var ActualCheckoutFooter = function (_a) {
|
|
|
2042
2042
|
var _b = useState(false), isPaying = _b[0], setIsPaying = _b[1];
|
|
2043
2043
|
var storedPaymentMethod = useContext(PaymentContext).storedPaymentMethod;
|
|
2044
2044
|
var amountDue = quote ? getQuoteAmountDue(quote) : invoice === null || invoice === void 0 ? void 0 : invoice.amountDue;
|
|
2045
|
-
var currencyId = (quote === null || quote === void 0 ? void 0 : quote.currencyId) || (invoice === null || invoice === void 0 ? void 0 : invoice.
|
|
2045
|
+
var currencyId = (quote === null || quote === void 0 ? void 0 : quote.currencyId) || (invoice === null || invoice === void 0 ? void 0 : invoice.currencyId);
|
|
2046
2046
|
// Payment hooks
|
|
2047
2047
|
var payDemoPay = usePay$1({
|
|
2048
2048
|
onPaymentSuccess: onPaymentSuccess,
|
|
@@ -2476,13 +2476,12 @@ var fetchStripeKey = function (plugin, token, apiHost, accountId) { return __awa
|
|
|
2476
2476
|
});
|
|
2477
2477
|
}); };
|
|
2478
2478
|
loadStripe.setLoadParameters({ advancedFraudSignals: false });
|
|
2479
|
-
var useStripePlugin = function (plugin, token, apiHost, accountId) {
|
|
2479
|
+
var useStripePlugin = function (plugin, token, apiHost, currencyId, accountId) {
|
|
2480
2480
|
var _a = useState(null), stripe = _a[0], setStripe = _a[1];
|
|
2481
2481
|
var showErrorNotification = useErrorNotification();
|
|
2482
2482
|
var options = {
|
|
2483
2483
|
mode: "setup",
|
|
2484
|
-
|
|
2485
|
-
currency: "usd",
|
|
2484
|
+
currency: currencyId,
|
|
2486
2485
|
setupFutureUsage: "off_session",
|
|
2487
2486
|
};
|
|
2488
2487
|
useEffect(function () {
|
|
@@ -2714,17 +2713,19 @@ function useRemovePaymentMethod(paymentPlugins, token, apiHost, entityId, accoun
|
|
|
2714
2713
|
|
|
2715
2714
|
var Panel = Collapse.Panel;
|
|
2716
2715
|
var PaymentForm = function (_a) {
|
|
2716
|
+
var _b;
|
|
2717
2717
|
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;
|
|
2718
2718
|
// Local state
|
|
2719
|
-
var
|
|
2720
|
-
var
|
|
2719
|
+
var _c = useState(), selectedPaymentMethod = _c[0], setSelectedPaymentMethod = _c[1];
|
|
2720
|
+
var _d = useState(false), showPaymentMethodForm = _d[0], setShowPaymentMethodForm = _d[1];
|
|
2721
2721
|
var paying = !!(quote || invoice);
|
|
2722
|
+
var currencyId = (_b = ((quote === null || quote === void 0 ? void 0 : quote.currencyId) || (invoice === null || invoice === void 0 ? void 0 : invoice.currencyId))) === null || _b === void 0 ? void 0 : _b.toLowerCase();
|
|
2722
2723
|
// Hooks
|
|
2723
2724
|
var apiHost = useContext(BunnyContext).apiHost;
|
|
2724
2725
|
var token = useToken();
|
|
2725
2726
|
var storedPaymentMethod = usePaymentMethod(graphQLClient, entityId, overrideToken || token).data;
|
|
2726
2727
|
var isPaymentMethodFetched = storedPaymentMethod !== undefined;
|
|
2727
|
-
var
|
|
2728
|
+
var _e = usePaymentPlugins({ entityId: entityId, apiHost: apiHost, token: overrideToken || token }), paymentMethodAllowedPlugins = _e.paymentMethodAllowedPlugins, arePluginsFetched = _e.isFetched;
|
|
2728
2729
|
var onClickRemove = useRemovePaymentMethod(paymentMethodAllowedPlugins || [], overrideToken || token, apiHost, entityId, accountId);
|
|
2729
2730
|
var queryClient = useQueryClient();
|
|
2730
2731
|
// Set default plugin
|
|
@@ -2765,21 +2766,24 @@ var PaymentForm = function (_a) {
|
|
|
2765
2766
|
onSavePaymentMethod === null || onSavePaymentMethod === void 0 ? void 0 : onSavePaymentMethod();
|
|
2766
2767
|
setShowPaymentMethodForm(false);
|
|
2767
2768
|
};
|
|
2769
|
+
if (!currencyId) {
|
|
2770
|
+
return jsx("div", { children: "No currency id found from quote or invoice" });
|
|
2771
|
+
}
|
|
2768
2772
|
return (jsx(PaymentContext.Provider, __assign({ value: {
|
|
2769
2773
|
onClickCancel: function () { return setShowPaymentMethodForm(false); },
|
|
2770
2774
|
accountId: accountId,
|
|
2771
2775
|
overrideToken: overrideToken,
|
|
2772
2776
|
storedPaymentMethod: storedPaymentMethod,
|
|
2773
2777
|
customCheckoutFunction: customCheckoutFunction,
|
|
2774
|
-
} }, { children: jsx(StripeWrapper, __assign({ plugin: selectedPaymentMethod, token: token, apiHost: apiHost, accountId: accountId }, { children: jsx("div", __assign({ className: "flex flex-col gap-0 w-full" }, { children: jsxs(Fragment, { children: [jsx("div", __assign({ className: "px-4" }, { children: jsx(MiniCreditCard, { onClickRemove: function () { return onClickRemove(storedPaymentMethod); }, paymentMethodData: storedPaymentMethod }) })), paying && storedPaymentMethod ? (jsx("div", __assign({ className: "px-4" }, { children: jsx(CheckoutFooter, { quote: quote, invoice: invoice, onPaymentSuccess: handlePaymentSuccess, plugin: selectedPaymentMethod }) }))) : (
|
|
2778
|
+
} }, { children: jsx(StripeWrapper, __assign({ plugin: selectedPaymentMethod, token: token, apiHost: apiHost, currencyId: currencyId, accountId: accountId }, { children: jsx("div", __assign({ className: "flex flex-col gap-0 w-full" }, { children: jsxs(Fragment, { children: [jsx("div", __assign({ className: "px-4" }, { children: jsx(MiniCreditCard, { onClickRemove: function () { return onClickRemove(storedPaymentMethod); }, paymentMethodData: storedPaymentMethod }) })), paying && storedPaymentMethod ? (jsx("div", __assign({ className: "px-4" }, { children: jsx(CheckoutFooter, { quote: quote, invoice: invoice, onPaymentSuccess: handlePaymentSuccess, plugin: selectedPaymentMethod }) }))) : (
|
|
2775
2779
|
//if not paying and payment method is saved, show Collapse
|
|
2776
2780
|
jsx(Collapse, __assign({ bordered: false, activeKey: showPaymentMethodForm ? "1" : undefined, ghost: true, collapsible: "disabled", destroyInactivePanel: true }, { children: jsx(Panel, __assign({ header: jsx(Fragment, { children: !showPaymentMethodForm ? (jsx("div", __assign({ className: "pt-2" }, { children: jsxs(Button, __assign({ onClick: function () {
|
|
2777
2781
|
setShowPaymentMethodForm(true);
|
|
2778
2782
|
}, type: "default", className: "w-full", id: "addPaymentMethod" }, { children: [storedPaymentMethod ? "Update" : "Add", " payment method"] })) }))) : null }), showArrow: false }, { children: jsx("div", { children: selectedPaymentMethod ? (jsxs("div", __assign({ className: "flex flex-col gap-2 mt-2" }, { children: [showPaymentMethodSelector && (jsx(PaymentMethodSelector, { onSelect: setSelectedPaymentMethod, paymentMethodAllowedPlugins: paymentMethodAllowedPlugins, value: selectedPaymentMethod })), jsx("div", __assign({ className: "flex flex-col" }, { children: jsx(PaymentMethodDetails, { onFail: onFail, onSavePaymentMethod: handleSavePaymentMethod, paymentMethod: selectedPaymentMethod }) }))] }))) : (jsx("div", { children: "No payment method selected" })) }) }), "1") })))] }) })) })) })));
|
|
2779
2783
|
};
|
|
2780
2784
|
function StripeWrapper(_a) {
|
|
2781
|
-
var children = _a.children, plugin = _a.plugin, token = _a.token, apiHost = _a.apiHost, accountId = _a.accountId;
|
|
2782
|
-
var _b = useStripePlugin(plugin, token, apiHost, accountId), stripe = _b.stripe, options = _b.options;
|
|
2785
|
+
var children = _a.children, plugin = _a.plugin, token = _a.token, apiHost = _a.apiHost, currencyId = _a.currencyId, accountId = _a.accountId;
|
|
2786
|
+
var _b = useStripePlugin(plugin, token, apiHost, currencyId, accountId), stripe = _b.stripe, options = _b.options;
|
|
2783
2787
|
return (jsx(Elements, __assign({ options: options, stripe: stripe }, { children: children })));
|
|
2784
2788
|
}
|
|
2785
2789
|
|
|
@@ -4022,8 +4026,8 @@ function InitialSignupForm(_a) {
|
|
|
4022
4026
|
|
|
4023
4027
|
var Title = Typography.Title, Text$4 = Typography.Text;
|
|
4024
4028
|
function PaymentSuccessDisplay(_a) {
|
|
4025
|
-
var amountPaid = _a.amountPaid, className = _a.className, companyName = _a.companyName, returnUrl = _a.returnUrl, style = _a.style;
|
|
4026
|
-
return (jsxs("div", __assign({ className: "flex flex-col items-center justify-center h-full ".concat(className), style: style }, { children: [jsx(CheckCircleFilled$1, { style: { fontSize: "48px", color: "rgb(52 211 153)" } }), jsxs(Title, __assign({ level: 3, className: "mt-2 m-0" }, { children: ["Payment of ", formatCurrency(amountPaid,
|
|
4029
|
+
var amountPaid = _a.amountPaid, className = _a.className, companyName = _a.companyName, returnUrl = _a.returnUrl, style = _a.style, currencyId = _a.currencyId;
|
|
4030
|
+
return (jsxs("div", __assign({ className: "flex flex-col items-center justify-center h-full ".concat(className), style: style }, { children: [jsx(CheckCircleFilled$1, { style: { fontSize: "48px", color: "rgb(52 211 153)" } }), jsxs(Title, __assign({ level: 3, className: "mt-2 m-0" }, { children: ["Payment of ", formatCurrency(amountPaid, currencyId), " successful"] })), returnUrl && (jsxs(Text$4, __assign({ className: "text-slate-500 cursor-pointer underline", onClick: function () { return (window.location.href = returnUrl); } }, { children: ["Back to ", companyName] })))] })));
|
|
4027
4031
|
}
|
|
4028
4032
|
|
|
4029
4033
|
var Text$3 = Typography.Text;
|
|
@@ -4143,7 +4147,7 @@ function Signup(_a) {
|
|
|
4143
4147
|
var children = _a.children, className = _a.className, style = _a.style;
|
|
4144
4148
|
return isCardEnabled ? (jsx(Card, __assign({ className: className, style: style }, { children: children }))) : (jsx("div", __assign({ className: className, style: style }, { children: children })));
|
|
4145
4149
|
};
|
|
4146
|
-
return (jsx(WrapperComponent, __assign({ className: "p-4 flex flex-col ".concat(shadow, " ").concat(className), style: style }, { children: purchaseSucceeded ? (jsx(PaymentSuccessDisplay, { amountPaid: (quote === null || quote === void 0 ? void 0 : quote.amountDue) || 0, className: "w-full", companyName: companyName, returnUrl: returnUrl })) : (jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col" : "flex-row", " h-full w-full") }, { children: [jsx("div", __assign({ className: "flex flex-col ".concat(isMobile ? "items-center" : "w-1/2 items-center") }, { children: jsx(PriceListDisplay, { priceListData: priceListData, topNavImageUrl: topNavImageUrl }) })), jsx("div", __assign({ className: "".concat(isMobile ? "h-full" : "my-4") }, { children: jsx(Divider, { className: "h-full", type: isMobile ? undefined : "vertical" }) })), jsx("div", __assign({ className: "flex ".concat(isMobile
|
|
4150
|
+
return (jsx(WrapperComponent, __assign({ className: "p-4 flex flex-col ".concat(shadow, " ").concat(className), style: style }, { children: purchaseSucceeded ? (jsx(Fragment, { children: (quote === null || quote === void 0 ? void 0 : quote.currencyId) !== undefined ? (jsx(PaymentSuccessDisplay, { amountPaid: (quote === null || quote === void 0 ? void 0 : quote.amountDue) || 0, className: "w-full", companyName: companyName, returnUrl: returnUrl, currencyId: quote === null || quote === void 0 ? void 0 : quote.currencyId })) : (jsx("div", { children: "No currency ID found from Quote" })) })) : (jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col" : "flex-row", " h-full w-full") }, { children: [jsx("div", __assign({ className: "flex flex-col ".concat(isMobile ? "items-center" : "w-1/2 items-center") }, { children: jsx(PriceListDisplay, { priceListData: priceListData, topNavImageUrl: topNavImageUrl }) })), jsx("div", __assign({ className: "".concat(isMobile ? "h-full" : "my-4") }, { children: jsx(Divider, { className: "h-full", type: isMobile ? undefined : "vertical" }) })), jsx("div", __assign({ className: "flex ".concat(isMobile
|
|
4147
4151
|
? "items-center justify-center my-12"
|
|
4148
4152
|
: "w-1/2 items-center justify-center my-12") }, { children: jsx("div", __assign({ className: "".concat(isMobile ? "w-full" : "w-1/2") }, { children: jsx(PaymentForms, { entityId: entityId, quote: quote, handlePaymentSuccess: handlePaymentSuccess, handlePaymentFail: handlePaymentFail, handleSubmit: handleSubmit, proceedingToPayment: proceedingToPayment, accountId: accountId, overrideToken: portalSessionToken, customCheckoutFunction: accountSignupFunction }) })) }))] }))) })));
|
|
4149
4153
|
}
|
|
@@ -16,7 +16,7 @@ export declare const createPaymentIntent: ({ payable, savePaymentMethod, memo, p
|
|
|
16
16
|
token: string;
|
|
17
17
|
apiHost: string;
|
|
18
18
|
}) => Promise<any>;
|
|
19
|
-
export declare const useStripePlugin: (plugin: PluginData | undefined, token: string, apiHost: string, accountId?: string) => {
|
|
19
|
+
export declare const useStripePlugin: (plugin: PluginData | undefined, token: string, apiHost: string, currencyId: string, accountId?: string) => {
|
|
20
20
|
stripe: Stripe | null;
|
|
21
21
|
options: {
|
|
22
22
|
mode: "setup";
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export default function PaymentSuccessDisplay({ amountPaid, className, companyName, returnUrl, style, }: {
|
|
2
|
+
export default function PaymentSuccessDisplay({ amountPaid, className, companyName, returnUrl, style, currencyId, }: {
|
|
3
3
|
amountPaid: number;
|
|
4
4
|
className: string;
|
|
5
5
|
companyName: string;
|
|
6
6
|
returnUrl?: string;
|
|
7
7
|
style?: React.CSSProperties;
|
|
8
|
+
currencyId: string;
|
|
8
9
|
}): import("react/jsx-runtime").JSX.Element;
|
package/package.json
CHANGED