@bunnyapp/components 1.0.1 → 1.0.2
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 +23 -17
- package/dist/cjs/src/components/Signup/PaymentForms.d.ts +2 -1
- package/dist/cjs/src/components/Signup/PaymentSuccess.d.ts +2 -2
- package/dist/cjs/src/components/Signup/Signup.d.ts +2 -2
- package/dist/esm/index.js +23 -17
- package/dist/esm/src/components/Signup/PaymentForms.d.ts +2 -1
- package/dist/esm/src/components/Signup/PaymentSuccess.d.ts +2 -2
- package/dist/esm/src/components/Signup/Signup.d.ts +2 -2
- package/dist/index.d.ts +2 -2
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -2272,6 +2272,7 @@ var DemoPayForm = function (_a) {
|
|
|
2272
2272
|
switch (_a.label) {
|
|
2273
2273
|
case 0:
|
|
2274
2274
|
_a.trys.push([0, 6, , 7]);
|
|
2275
|
+
validateCardDetails();
|
|
2275
2276
|
if (!onlySavePaymentMethod) return [3 /*break*/, 2];
|
|
2276
2277
|
setIsSaving(true);
|
|
2277
2278
|
return [4 /*yield*/, storePayment({
|
|
@@ -2299,14 +2300,6 @@ var DemoPayForm = function (_a) {
|
|
|
2299
2300
|
case 2:
|
|
2300
2301
|
if (!(amountDue !== undefined && currencyId)) return [3 /*break*/, 4];
|
|
2301
2302
|
setIsSaving(true);
|
|
2302
|
-
if (cardDetails.number !== TEST_CARD)
|
|
2303
|
-
throw new Error("Only the card number 4242 4242 4242 4242 will be accepted.");
|
|
2304
|
-
if (!isValidExpiry(cardDetails.expiry))
|
|
2305
|
-
throw new Error("Invalid expiry date");
|
|
2306
|
-
if (isCardExpired(cardDetails.expiry))
|
|
2307
|
-
throw new Error("Card is expired");
|
|
2308
|
-
if (cardDetails.cvc.length !== 3)
|
|
2309
|
-
throw new Error("Invalid CVC");
|
|
2310
2303
|
return [4 /*yield*/, confirmPayment({
|
|
2311
2304
|
amount: amountDue,
|
|
2312
2305
|
currency: currencyId,
|
|
@@ -2335,6 +2328,16 @@ var DemoPayForm = function (_a) {
|
|
|
2335
2328
|
}
|
|
2336
2329
|
});
|
|
2337
2330
|
}); };
|
|
2331
|
+
function validateCardDetails() {
|
|
2332
|
+
if (cardDetails.number !== TEST_CARD)
|
|
2333
|
+
throw new Error("Only the card number 4242 4242 4242 4242 will be accepted.");
|
|
2334
|
+
if (!isValidExpiry(cardDetails.expiry))
|
|
2335
|
+
throw new Error("Invalid expiry date");
|
|
2336
|
+
if (isCardExpired(cardDetails.expiry))
|
|
2337
|
+
throw new Error("Card is expired");
|
|
2338
|
+
if (cardDetails.cvc.length !== 3)
|
|
2339
|
+
throw new Error("Invalid CVC");
|
|
2340
|
+
}
|
|
2338
2341
|
var onCardNumberChange = function (number) {
|
|
2339
2342
|
setCardDetails(__assign(__assign({}, cardDetails), { number: number }));
|
|
2340
2343
|
};
|
|
@@ -3814,10 +3817,8 @@ var getPriceList = function (_a) {
|
|
|
3814
3817
|
};
|
|
3815
3818
|
|
|
3816
3819
|
function PaymentForms(_a) {
|
|
3817
|
-
var quote = _a.quote, paying = _a.paying, setIsPaying = _a.setIsPaying, handlePaymentSaveSuccess = _a.handlePaymentSaveSuccess, handleSubmit = _a.handleSubmit, proceedingToPayment = _a.proceedingToPayment, accountId = _a.accountId;
|
|
3818
|
-
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: quote ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: accountId && (jsxRuntime.jsx(PaymentContext.Provider, __assign({ value: { accountId: accountId, displayPayButtonNameAnyways: true } }, { children: jsxRuntime.jsx(PaymentForm, { isSaving: paying, setIsSaving: setIsPaying, onFail:
|
|
3819
|
-
console.log("payment saving failed darn");
|
|
3820
|
-
}, onPaymentSuccess: handlePaymentSaveSuccess }) }))) })) : (jsxRuntime.jsx(InitialSignupForm, { onSubmit: handleSubmit, submitting: proceedingToPayment })) }));
|
|
3820
|
+
var quote = _a.quote, paying = _a.paying, setIsPaying = _a.setIsPaying, handlePaymentSaveSuccess = _a.handlePaymentSaveSuccess, handlePaymentFail = _a.handlePaymentFail, handleSubmit = _a.handleSubmit, proceedingToPayment = _a.proceedingToPayment, accountId = _a.accountId;
|
|
3821
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: quote ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: accountId && (jsxRuntime.jsx(PaymentContext.Provider, __assign({ value: { accountId: accountId, displayPayButtonNameAnyways: true } }, { children: jsxRuntime.jsx(PaymentForm, { isSaving: paying, setIsSaving: setIsPaying, onFail: handlePaymentFail, onPaymentSuccess: handlePaymentSaveSuccess }) }))) })) : (jsxRuntime.jsx(InitialSignupForm, { onSubmit: handleSubmit, submitting: proceedingToPayment })) }));
|
|
3821
3822
|
}
|
|
3822
3823
|
function InitialSignupForm(_a) {
|
|
3823
3824
|
var onSubmit = _a.onSubmit, submitting = _a.submitting;
|
|
@@ -3854,10 +3855,10 @@ function InitialSignupForm(_a) {
|
|
|
3854
3855
|
|
|
3855
3856
|
var Title = antd.Typography.Title, Text$a = antd.Typography.Text;
|
|
3856
3857
|
function PaymentSuccessDisplay(_a) {
|
|
3857
|
-
var className = _a.className, amountPaid = _a.amountPaid, style = _a.style,
|
|
3858
|
+
var className = _a.className, amountPaid = _a.amountPaid, style = _a.style, returnUrl = _a.returnUrl;
|
|
3858
3859
|
var window = React.useContext(BunnyContext).window;
|
|
3859
3860
|
var companyName = common.useCurrentUserData().companyName;
|
|
3860
|
-
return (jsxRuntime.jsxs("div", __assign({ className: "flex flex-col items-center justify-center h-full ".concat(className), style: style }, { children: [jsxRuntime.jsx(CheckCircleFilled$1, { style: { fontSize: "48px", color: "rgb(52 211 153)" } }), jsxRuntime.jsxs(Title, __assign({ level: 3, className: "mt-2 m-0" }, { children: ["Payment of ", common.Misc.formatCurrency(amountPaid, "USD"), " successful"] })),
|
|
3861
|
+
return (jsxRuntime.jsxs("div", __assign({ className: "flex flex-col items-center justify-center h-full ".concat(className), style: style }, { children: [jsxRuntime.jsx(CheckCircleFilled$1, { style: { fontSize: "48px", color: "rgb(52 211 153)" } }), jsxRuntime.jsxs(Title, __assign({ level: 3, className: "mt-2 m-0" }, { children: ["Payment of ", common.Misc.formatCurrency(amountPaid, "USD"), " successful"] })), returnUrl && (jsxRuntime.jsxs(Text$a, __assign({ className: "text-slate-500 cursor-pointer underline", onClick: function () { return (window.location.href = returnUrl); } }, { children: ["Back to ", companyName] })))] })));
|
|
3861
3862
|
}
|
|
3862
3863
|
|
|
3863
3864
|
var Text$9 = antd.Typography.Text;
|
|
@@ -3894,8 +3895,9 @@ var StyedLink = styled__default["default"].a(templateObject_1$4 || (templateObje
|
|
|
3894
3895
|
var StyledBunnyLink = styled__default["default"](StyedLink)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n &:hover {\n color: ", " !important;\n }\n"], ["\n &:hover {\n color: ", " !important;\n }\n"])), common.PRIMARY_COLOR);
|
|
3895
3896
|
var templateObject_1$4, templateObject_2;
|
|
3896
3897
|
|
|
3898
|
+
var showErrorNotification = common.NotificationUtils.useErrorNotification();
|
|
3897
3899
|
function Signup(_a) {
|
|
3898
|
-
var priceListCode = _a.priceListCode,
|
|
3900
|
+
var priceListCode = _a.priceListCode, returnUrl = _a.returnUrl;
|
|
3899
3901
|
// Hooks
|
|
3900
3902
|
var _b = React.useContext(BunnyContext), subdomain = _b.subdomain, token = _b.token, window = _b.window;
|
|
3901
3903
|
reactQuery.useQuery({
|
|
@@ -3988,11 +3990,15 @@ function Signup(_a) {
|
|
|
3988
3990
|
});
|
|
3989
3991
|
});
|
|
3990
3992
|
}
|
|
3993
|
+
function handlePaymentFail(error) {
|
|
3994
|
+
showErrorNotification(error.message);
|
|
3995
|
+
setIsPaying(false);
|
|
3996
|
+
}
|
|
3991
3997
|
if (isMobile) {
|
|
3992
|
-
return (jsxRuntime.jsx(Card, __assign({ className: "p-4 flex flex-col" }, { children: purchaseSucceeded ? (jsxRuntime.jsx(PaymentSuccessDisplay, { className: "w-full", amountPaid: (quote === null || quote === void 0 ? void 0 : quote.amountDue) || 0,
|
|
3998
|
+
return (jsxRuntime.jsx(Card, __assign({ className: "p-4 flex flex-col" }, { children: purchaseSucceeded ? (jsxRuntime.jsx(PaymentSuccessDisplay, { className: "w-full", amountPaid: (quote === null || quote === void 0 ? void 0 : quote.amountDue) || 0, returnUrl: returnUrl })) : (jsxRuntime.jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col" : "flex-row", " h-full w-full") }, { children: [jsxRuntime.jsx("div", __assign({ className: "flex flex-col items-center" }, { children: jsxRuntime.jsx(PriceListDisplay, { priceListData: priceListData, topNavImageUrl: topNavImageUrl }) })), jsxRuntime.jsx("div", __assign({ className: "mx-8" }, { children: jsxRuntime.jsx(antd.Divider, { className: "h-full" }) })), jsxRuntime.jsx("div", __assign({ className: "flex items-center justify-center my-12" }, { children: jsxRuntime.jsx(PaymentForms, { quote: quote, paying: paying, setIsPaying: setIsPaying, handlePaymentSaveSuccess: handlePaymentSaveSuccess, handlePaymentFail: handlePaymentFail, handleSubmit: handleSubmit, proceedingToPayment: proceedingToPayment, accountId: accountId || "" }) }))] }))) })));
|
|
3993
3999
|
}
|
|
3994
4000
|
else {
|
|
3995
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Card, __assign({ className: "p-4 flex flex-col w-screen h-screen" }, { children: purchaseSucceeded ? (jsxRuntime.jsx(PaymentSuccessDisplay, { className: "w-full", amountPaid: (quote === null || quote === void 0 ? void 0 : quote.amountDue) || 0,
|
|
4001
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Card, __assign({ className: "p-4 flex flex-col w-screen h-screen" }, { children: purchaseSucceeded ? (jsxRuntime.jsx(PaymentSuccessDisplay, { className: "w-full", amountPaid: (quote === null || quote === void 0 ? void 0 : quote.amountDue) || 0, returnUrl: returnUrl })) : (jsxRuntime.jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col" : "flex-row", " h-full w-full") }, { children: [jsxRuntime.jsx("div", __assign({ className: "flex flex-col w-1/2 items-center" }, { children: jsxRuntime.jsx(PriceListDisplay, { priceListData: priceListData, topNavImageUrl: topNavImageUrl }) })), jsxRuntime.jsx("div", __assign({ className: "my-4" }, { children: jsxRuntime.jsx(antd.Divider, { className: "h-full", type: "vertical" }) })), jsxRuntime.jsx("div", __assign({ className: "flex w-1/2 items-center justify-center my-12" }, { children: jsxRuntime.jsx(PaymentForms, { quote: quote, paying: paying, setIsPaying: setIsPaying, handlePaymentSaveSuccess: handlePaymentSaveSuccess, handlePaymentFail: handlePaymentFail, handleSubmit: handleSubmit, proceedingToPayment: proceedingToPayment, accountId: accountId || "" }) }))] }))) })), jsxRuntime.jsx(Footer, {})] }));
|
|
3996
4002
|
}
|
|
3997
4003
|
}
|
|
3998
4004
|
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import "../../styles/index.less";
|
|
2
2
|
import { Quote } from "@bunnyapp/common";
|
|
3
3
|
import { OnPaymentSuccessType } from "../PaymentForm/PaymentFormTypes";
|
|
4
|
-
export default function PaymentForms({ quote, paying, setIsPaying, handlePaymentSaveSuccess, handleSubmit, proceedingToPayment, accountId, }: {
|
|
4
|
+
export default function PaymentForms({ quote, paying, setIsPaying, handlePaymentSaveSuccess, handlePaymentFail, handleSubmit, proceedingToPayment, accountId, }: {
|
|
5
5
|
quote?: Quote;
|
|
6
6
|
paying: boolean;
|
|
7
7
|
setIsPaying: (paying: boolean) => void;
|
|
8
8
|
handlePaymentSaveSuccess: (paymentSuccess: OnPaymentSuccessType) => void;
|
|
9
|
+
handlePaymentFail: (error: any) => void;
|
|
9
10
|
handleSubmit: (formData: FormData) => void;
|
|
10
11
|
proceedingToPayment: boolean;
|
|
11
12
|
accountId?: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export default function PaymentSuccessDisplay({ className, amountPaid, style,
|
|
2
|
+
export default function PaymentSuccessDisplay({ className, amountPaid, style, returnUrl, }: {
|
|
3
3
|
className: string;
|
|
4
4
|
amountPaid: number;
|
|
5
5
|
style?: React.CSSProperties;
|
|
6
|
-
|
|
6
|
+
returnUrl?: string;
|
|
7
7
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../../styles/index.less";
|
|
2
|
-
export default function Signup({ priceListCode,
|
|
2
|
+
export default function Signup({ priceListCode, returnUrl, }: {
|
|
3
3
|
priceListCode: string;
|
|
4
|
-
|
|
4
|
+
returnUrl?: string;
|
|
5
5
|
}): import("react/jsx-runtime").JSX.Element;
|
package/dist/esm/index.js
CHANGED
|
@@ -2243,6 +2243,7 @@ var DemoPayForm = function (_a) {
|
|
|
2243
2243
|
switch (_a.label) {
|
|
2244
2244
|
case 0:
|
|
2245
2245
|
_a.trys.push([0, 6, , 7]);
|
|
2246
|
+
validateCardDetails();
|
|
2246
2247
|
if (!onlySavePaymentMethod) return [3 /*break*/, 2];
|
|
2247
2248
|
setIsSaving(true);
|
|
2248
2249
|
return [4 /*yield*/, storePayment({
|
|
@@ -2270,14 +2271,6 @@ var DemoPayForm = function (_a) {
|
|
|
2270
2271
|
case 2:
|
|
2271
2272
|
if (!(amountDue !== undefined && currencyId)) return [3 /*break*/, 4];
|
|
2272
2273
|
setIsSaving(true);
|
|
2273
|
-
if (cardDetails.number !== TEST_CARD)
|
|
2274
|
-
throw new Error("Only the card number 4242 4242 4242 4242 will be accepted.");
|
|
2275
|
-
if (!isValidExpiry(cardDetails.expiry))
|
|
2276
|
-
throw new Error("Invalid expiry date");
|
|
2277
|
-
if (isCardExpired(cardDetails.expiry))
|
|
2278
|
-
throw new Error("Card is expired");
|
|
2279
|
-
if (cardDetails.cvc.length !== 3)
|
|
2280
|
-
throw new Error("Invalid CVC");
|
|
2281
2274
|
return [4 /*yield*/, confirmPayment({
|
|
2282
2275
|
amount: amountDue,
|
|
2283
2276
|
currency: currencyId,
|
|
@@ -2306,6 +2299,16 @@ var DemoPayForm = function (_a) {
|
|
|
2306
2299
|
}
|
|
2307
2300
|
});
|
|
2308
2301
|
}); };
|
|
2302
|
+
function validateCardDetails() {
|
|
2303
|
+
if (cardDetails.number !== TEST_CARD)
|
|
2304
|
+
throw new Error("Only the card number 4242 4242 4242 4242 will be accepted.");
|
|
2305
|
+
if (!isValidExpiry(cardDetails.expiry))
|
|
2306
|
+
throw new Error("Invalid expiry date");
|
|
2307
|
+
if (isCardExpired(cardDetails.expiry))
|
|
2308
|
+
throw new Error("Card is expired");
|
|
2309
|
+
if (cardDetails.cvc.length !== 3)
|
|
2310
|
+
throw new Error("Invalid CVC");
|
|
2311
|
+
}
|
|
2309
2312
|
var onCardNumberChange = function (number) {
|
|
2310
2313
|
setCardDetails(__assign(__assign({}, cardDetails), { number: number }));
|
|
2311
2314
|
};
|
|
@@ -3785,10 +3788,8 @@ var getPriceList = function (_a) {
|
|
|
3785
3788
|
};
|
|
3786
3789
|
|
|
3787
3790
|
function PaymentForms(_a) {
|
|
3788
|
-
var quote = _a.quote, paying = _a.paying, setIsPaying = _a.setIsPaying, handlePaymentSaveSuccess = _a.handlePaymentSaveSuccess, handleSubmit = _a.handleSubmit, proceedingToPayment = _a.proceedingToPayment, accountId = _a.accountId;
|
|
3789
|
-
return (jsx(Fragment, { children: quote ? (jsx(Fragment, { children: accountId && (jsx(PaymentContext.Provider, __assign({ value: { accountId: accountId, displayPayButtonNameAnyways: true } }, { children: jsx(PaymentForm, { isSaving: paying, setIsSaving: setIsPaying, onFail:
|
|
3790
|
-
console.log("payment saving failed darn");
|
|
3791
|
-
}, onPaymentSuccess: handlePaymentSaveSuccess }) }))) })) : (jsx(InitialSignupForm, { onSubmit: handleSubmit, submitting: proceedingToPayment })) }));
|
|
3791
|
+
var quote = _a.quote, paying = _a.paying, setIsPaying = _a.setIsPaying, handlePaymentSaveSuccess = _a.handlePaymentSaveSuccess, handlePaymentFail = _a.handlePaymentFail, handleSubmit = _a.handleSubmit, proceedingToPayment = _a.proceedingToPayment, accountId = _a.accountId;
|
|
3792
|
+
return (jsx(Fragment, { children: quote ? (jsx(Fragment, { children: accountId && (jsx(PaymentContext.Provider, __assign({ value: { accountId: accountId, displayPayButtonNameAnyways: true } }, { children: jsx(PaymentForm, { isSaving: paying, setIsSaving: setIsPaying, onFail: handlePaymentFail, onPaymentSuccess: handlePaymentSaveSuccess }) }))) })) : (jsx(InitialSignupForm, { onSubmit: handleSubmit, submitting: proceedingToPayment })) }));
|
|
3792
3793
|
}
|
|
3793
3794
|
function InitialSignupForm(_a) {
|
|
3794
3795
|
var onSubmit = _a.onSubmit, submitting = _a.submitting;
|
|
@@ -3825,10 +3826,10 @@ function InitialSignupForm(_a) {
|
|
|
3825
3826
|
|
|
3826
3827
|
var Title = Typography.Title, Text$a = Typography.Text;
|
|
3827
3828
|
function PaymentSuccessDisplay(_a) {
|
|
3828
|
-
var className = _a.className, amountPaid = _a.amountPaid, style = _a.style,
|
|
3829
|
+
var className = _a.className, amountPaid = _a.amountPaid, style = _a.style, returnUrl = _a.returnUrl;
|
|
3829
3830
|
var window = useContext(BunnyContext).window;
|
|
3830
3831
|
var companyName = useCurrentUserData().companyName;
|
|
3831
|
-
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 ", Misc.formatCurrency(amountPaid, "USD"), " successful"] })),
|
|
3832
|
+
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 ", Misc.formatCurrency(amountPaid, "USD"), " successful"] })), returnUrl && (jsxs(Text$a, __assign({ className: "text-slate-500 cursor-pointer underline", onClick: function () { return (window.location.href = returnUrl); } }, { children: ["Back to ", companyName] })))] })));
|
|
3832
3833
|
}
|
|
3833
3834
|
|
|
3834
3835
|
var Text$9 = Typography.Text;
|
|
@@ -3865,8 +3866,9 @@ var StyedLink = styled.a(templateObject_1$4 || (templateObject_1$4 = __makeTempl
|
|
|
3865
3866
|
var StyledBunnyLink = styled(StyedLink)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n &:hover {\n color: ", " !important;\n }\n"], ["\n &:hover {\n color: ", " !important;\n }\n"])), PRIMARY_COLOR);
|
|
3866
3867
|
var templateObject_1$4, templateObject_2;
|
|
3867
3868
|
|
|
3869
|
+
var showErrorNotification = NotificationUtils.useErrorNotification();
|
|
3868
3870
|
function Signup(_a) {
|
|
3869
|
-
var priceListCode = _a.priceListCode,
|
|
3871
|
+
var priceListCode = _a.priceListCode, returnUrl = _a.returnUrl;
|
|
3870
3872
|
// Hooks
|
|
3871
3873
|
var _b = useContext(BunnyContext), subdomain = _b.subdomain, token = _b.token, window = _b.window;
|
|
3872
3874
|
useQuery({
|
|
@@ -3959,11 +3961,15 @@ function Signup(_a) {
|
|
|
3959
3961
|
});
|
|
3960
3962
|
});
|
|
3961
3963
|
}
|
|
3964
|
+
function handlePaymentFail(error) {
|
|
3965
|
+
showErrorNotification(error.message);
|
|
3966
|
+
setIsPaying(false);
|
|
3967
|
+
}
|
|
3962
3968
|
if (isMobile) {
|
|
3963
|
-
return (jsx(Card, __assign({ className: "p-4 flex flex-col" }, { children: purchaseSucceeded ? (jsx(PaymentSuccessDisplay, { className: "w-full", amountPaid: (quote === null || quote === void 0 ? void 0 : quote.amountDue) || 0,
|
|
3969
|
+
return (jsx(Card, __assign({ className: "p-4 flex flex-col" }, { children: purchaseSucceeded ? (jsx(PaymentSuccessDisplay, { className: "w-full", amountPaid: (quote === null || quote === void 0 ? void 0 : quote.amountDue) || 0, returnUrl: returnUrl })) : (jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col" : "flex-row", " h-full w-full") }, { children: [jsx("div", __assign({ className: "flex flex-col items-center" }, { children: jsx(PriceListDisplay, { priceListData: priceListData, topNavImageUrl: topNavImageUrl }) })), jsx("div", __assign({ className: "mx-8" }, { children: jsx(Divider, { className: "h-full" }) })), jsx("div", __assign({ className: "flex items-center justify-center my-12" }, { children: jsx(PaymentForms, { quote: quote, paying: paying, setIsPaying: setIsPaying, handlePaymentSaveSuccess: handlePaymentSaveSuccess, handlePaymentFail: handlePaymentFail, handleSubmit: handleSubmit, proceedingToPayment: proceedingToPayment, accountId: accountId || "" }) }))] }))) })));
|
|
3964
3970
|
}
|
|
3965
3971
|
else {
|
|
3966
|
-
return (jsxs(Fragment, { children: [jsx(Card, __assign({ className: "p-4 flex flex-col w-screen h-screen" }, { children: purchaseSucceeded ? (jsx(PaymentSuccessDisplay, { className: "w-full", amountPaid: (quote === null || quote === void 0 ? void 0 : quote.amountDue) || 0,
|
|
3972
|
+
return (jsxs(Fragment, { children: [jsx(Card, __assign({ className: "p-4 flex flex-col w-screen h-screen" }, { children: purchaseSucceeded ? (jsx(PaymentSuccessDisplay, { className: "w-full", amountPaid: (quote === null || quote === void 0 ? void 0 : quote.amountDue) || 0, returnUrl: returnUrl })) : (jsxs("div", __assign({ className: "flex ".concat(isMobile ? "flex-col" : "flex-row", " h-full w-full") }, { children: [jsx("div", __assign({ className: "flex flex-col w-1/2 items-center" }, { children: jsx(PriceListDisplay, { priceListData: priceListData, topNavImageUrl: topNavImageUrl }) })), jsx("div", __assign({ className: "my-4" }, { children: jsx(Divider, { className: "h-full", type: "vertical" }) })), jsx("div", __assign({ className: "flex w-1/2 items-center justify-center my-12" }, { children: jsx(PaymentForms, { quote: quote, paying: paying, setIsPaying: setIsPaying, handlePaymentSaveSuccess: handlePaymentSaveSuccess, handlePaymentFail: handlePaymentFail, handleSubmit: handleSubmit, proceedingToPayment: proceedingToPayment, accountId: accountId || "" }) }))] }))) })), jsx(Footer, {})] }));
|
|
3967
3973
|
}
|
|
3968
3974
|
}
|
|
3969
3975
|
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import "../../styles/index.less";
|
|
2
2
|
import { Quote } from "@bunnyapp/common";
|
|
3
3
|
import { OnPaymentSuccessType } from "../PaymentForm/PaymentFormTypes";
|
|
4
|
-
export default function PaymentForms({ quote, paying, setIsPaying, handlePaymentSaveSuccess, handleSubmit, proceedingToPayment, accountId, }: {
|
|
4
|
+
export default function PaymentForms({ quote, paying, setIsPaying, handlePaymentSaveSuccess, handlePaymentFail, handleSubmit, proceedingToPayment, accountId, }: {
|
|
5
5
|
quote?: Quote;
|
|
6
6
|
paying: boolean;
|
|
7
7
|
setIsPaying: (paying: boolean) => void;
|
|
8
8
|
handlePaymentSaveSuccess: (paymentSuccess: OnPaymentSuccessType) => void;
|
|
9
|
+
handlePaymentFail: (error: any) => void;
|
|
9
10
|
handleSubmit: (formData: FormData) => void;
|
|
10
11
|
proceedingToPayment: boolean;
|
|
11
12
|
accountId?: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export default function PaymentSuccessDisplay({ className, amountPaid, style,
|
|
2
|
+
export default function PaymentSuccessDisplay({ className, amountPaid, style, returnUrl, }: {
|
|
3
3
|
className: string;
|
|
4
4
|
amountPaid: number;
|
|
5
5
|
style?: React.CSSProperties;
|
|
6
|
-
|
|
6
|
+
returnUrl?: string;
|
|
7
7
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../../styles/index.less";
|
|
2
|
-
export default function Signup({ priceListCode,
|
|
2
|
+
export default function Signup({ priceListCode, returnUrl, }: {
|
|
3
3
|
priceListCode: string;
|
|
4
|
-
|
|
4
|
+
returnUrl?: string;
|
|
5
5
|
}): import("react/jsx-runtime").JSX.Element;
|
package/dist/index.d.ts
CHANGED
|
@@ -53,9 +53,9 @@ declare const Checkout: ({ onCancel, onSuccess, onFail, invoice, open, quote, se
|
|
|
53
53
|
|
|
54
54
|
declare const getQuoteAmountDue: (quote: Quote$1) => number;
|
|
55
55
|
|
|
56
|
-
declare function Signup({ priceListCode,
|
|
56
|
+
declare function Signup({ priceListCode, returnUrl, }: {
|
|
57
57
|
priceListCode: string;
|
|
58
|
-
|
|
58
|
+
returnUrl?: string;
|
|
59
59
|
}): react_jsx_runtime.JSX.Element;
|
|
60
60
|
|
|
61
61
|
declare function BunnyProvider({ children, token, subdomain, window, accountId, darkMode, }: {
|
package/package.json
CHANGED