@bunnyapp/components 1.0.41 → 1.0.42

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 CHANGED
@@ -19498,7 +19498,7 @@ var getBillingDetails = function (_a) {
19498
19498
  var Text$5 = antd.Typography.Text;
19499
19499
  var DrawerHeader = function (_a) {
19500
19500
  var description = _a.description, onClose = _a.onClose, title = _a.title, closeButtonClassName = _a.closeButtonClassName;
19501
- 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$5, __assign({ className: "text-xl", style: { fontWeight: 400 } }, { children: title })), onClose ? (jsxRuntime.jsx("button", __assign({ onClick: onClose, className: closeButtonClassName }, { children: jsxRuntime.jsx(icons.CloseOutlined, {}) }))) : null] })), description && jsxRuntime.jsx("div", __assign({ className: "text-xs" }, { children: description }))] })));
19501
+ 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$5, __assign({ className: "text-xl", style: { fontWeight: 400 } }, { children: title })), onClose ? (jsxRuntime.jsx("button", __assign({ id: "closePayment", onClick: onClose, className: closeButtonClassName }, { children: jsxRuntime.jsx(icons.CloseOutlined, {}) }))) : null] })), description && jsxRuntime.jsx("div", __assign({ className: "text-xs" }, { children: description }))] })));
19502
19502
  };
19503
19503
 
19504
19504
  var PaymentMethod = function (_a) {
@@ -19555,7 +19555,7 @@ var PaymentMethodDisplay = function (_a) {
19555
19555
  body: {
19556
19556
  padding: "1rem 0 0 0",
19557
19557
  },
19558
- }, title: jsxRuntime.jsx("div", __assign({ className: "px-4" }, { children: jsxRuntime.jsx(DrawerHeader, { title: "New payment method", onClose: function () { return setShowModal(false); }, closeButtonClassName: "bg-transparent border-none cursor-pointer hover:bg-gray-100 p-2 rounded-sm transition-all duration-200" }) })), footer: null }, { children: children })));
19558
+ }, title: jsxRuntime.jsx("div", __assign({ className: "px-4" }, { children: jsxRuntime.jsx(DrawerHeader, { closeButtonClassName: "bg-transparent border-none cursor-pointer hover:bg-gray-100 p-2 rounded-sm transition-all duration-200", onClose: function () { return setShowModal(false); }, title: "New payment method" }) })), footer: null }, { children: children })));
19559
19559
  }
19560
19560
  return (jsxRuntime.jsx(antd.Drawer, __assign({ closeIcon: null, onClose: function () { return setShowModal(false); }, open: showModal, styles: {
19561
19561
  body: {
@@ -19965,6 +19965,7 @@ function Signup(_a) {
19965
19965
  var _j = react.useState(false), purchaseSucceeded = _j[0], setPurchaseSucceeded = _j[1];
19966
19966
  var _k = react.useState(undefined), paymentMethodGraphQLClient = _k[0], setPaymentMethodGraphQLClient = _k[1];
19967
19967
  var paymentMethod = usePaymentMethod({
19968
+ accountId: accountId,
19968
19969
  entityId: entityId,
19969
19970
  graphQLClient: paymentMethodGraphQLClient || graphQLClient,
19970
19971
  token: token,
@@ -19999,11 +20000,14 @@ function Signup(_a) {
19999
20000
  data = _a.sent();
20000
20001
  setAccountId(data.account.id);
20001
20002
  setPortalSessionToken(data.portalSessionToken);
20002
- setPaymentMethodGraphQLClient(createGraphQLClient(apiHost || "", data.portalSessionToken));
20003
+ setPaymentMethodGraphQLClient(createGraphQLClient(apiHost, data.portalSessionToken));
20003
20004
  // We must invalidate the accountPaymentMethodKey query in order to clear payment methods from the provided api token,
20004
20005
  // to instead use paymentMethods from portalSessionToken.
20005
20006
  queryClient.invalidateQueries({
20006
- queryKey: common.QueryKeyFactory.default.accountPaymentMethodKey({ entityId: entityId, token: token }),
20007
+ queryKey: common.QueryKeyFactory.default.accountPaymentMethodKey({
20008
+ entityId: entityId,
20009
+ token: token,
20010
+ }),
20007
20011
  });
20008
20012
  setProceedingToPayment(false);
20009
20013
  setQuote(data.quote);
@@ -20040,6 +20044,9 @@ function Signup(_a) {
20040
20044
  if (!(plugin === null || plugin === void 0 ? void 0 : plugin.id)) {
20041
20045
  throw new Error("Plugin ID is required");
20042
20046
  }
20047
+ if (!(paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.id)) {
20048
+ throw new Error("Payment method ID is required");
20049
+ }
20043
20050
  return [4 /*yield*/, accountSignup({
20044
20051
  token: portalSessionToken,
20045
20052
  apiHost: apiHost,
@@ -20062,7 +20069,9 @@ function Signup(_a) {
20062
20069
  var children = _a.children, className = _a.className, style = _a.style;
20063
20070
  return isCardEnabled ? (jsxRuntime.jsx(Card, __assign({ className: className, style: style }, { children: children }))) : (jsxRuntime.jsx("div", __assign({ className: className, style: style }, { children: children })));
20064
20071
  };
20065
- 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 ? "items-center justify-center my-12" : "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 }) })) }))] }))) })));
20072
+ 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
20073
+ ? "items-center justify-center my-12"
20074
+ : "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 }) })) }))] }))) })));
20066
20075
  }
20067
20076
 
20068
20077
  // WARNING: There is a preview button on APP that will need to be changed if this query is changed
package/dist/esm/index.js CHANGED
@@ -19470,7 +19470,7 @@ var getBillingDetails = function (_a) {
19470
19470
  var Text$5 = Typography.Text;
19471
19471
  var DrawerHeader = function (_a) {
19472
19472
  var description = _a.description, onClose = _a.onClose, title = _a.title, closeButtonClassName = _a.closeButtonClassName;
19473
- return (jsxs("div", __assign({ className: "flex flex-col gap-4" }, { children: [jsxs("div", __assign({ className: "flex items-center justify-between gap-2" }, { children: [jsx(Text$5, __assign({ className: "text-xl", style: { fontWeight: 400 } }, { children: title })), onClose ? (jsx("button", __assign({ onClick: onClose, className: closeButtonClassName }, { children: jsx(CloseOutlined, {}) }))) : null] })), description && jsx("div", __assign({ className: "text-xs" }, { children: description }))] })));
19473
+ return (jsxs("div", __assign({ className: "flex flex-col gap-4" }, { children: [jsxs("div", __assign({ className: "flex items-center justify-between gap-2" }, { children: [jsx(Text$5, __assign({ className: "text-xl", style: { fontWeight: 400 } }, { children: title })), onClose ? (jsx("button", __assign({ id: "closePayment", onClick: onClose, className: closeButtonClassName }, { children: jsx(CloseOutlined, {}) }))) : null] })), description && jsx("div", __assign({ className: "text-xs" }, { children: description }))] })));
19474
19474
  };
19475
19475
 
19476
19476
  var PaymentMethod = function (_a) {
@@ -19527,7 +19527,7 @@ var PaymentMethodDisplay = function (_a) {
19527
19527
  body: {
19528
19528
  padding: "1rem 0 0 0",
19529
19529
  },
19530
- }, title: jsx("div", __assign({ className: "px-4" }, { children: jsx(DrawerHeader, { title: "New payment method", onClose: function () { return setShowModal(false); }, closeButtonClassName: "bg-transparent border-none cursor-pointer hover:bg-gray-100 p-2 rounded-sm transition-all duration-200" }) })), footer: null }, { children: children })));
19530
+ }, title: jsx("div", __assign({ className: "px-4" }, { children: jsx(DrawerHeader, { closeButtonClassName: "bg-transparent border-none cursor-pointer hover:bg-gray-100 p-2 rounded-sm transition-all duration-200", onClose: function () { return setShowModal(false); }, title: "New payment method" }) })), footer: null }, { children: children })));
19531
19531
  }
19532
19532
  return (jsx(Drawer, __assign({ closeIcon: null, onClose: function () { return setShowModal(false); }, open: showModal, styles: {
19533
19533
  body: {
@@ -19937,6 +19937,7 @@ function Signup(_a) {
19937
19937
  var _j = useState(false), purchaseSucceeded = _j[0], setPurchaseSucceeded = _j[1];
19938
19938
  var _k = useState(undefined), paymentMethodGraphQLClient = _k[0], setPaymentMethodGraphQLClient = _k[1];
19939
19939
  var paymentMethod = usePaymentMethod({
19940
+ accountId: accountId,
19940
19941
  entityId: entityId,
19941
19942
  graphQLClient: paymentMethodGraphQLClient || graphQLClient,
19942
19943
  token: token,
@@ -19971,11 +19972,14 @@ function Signup(_a) {
19971
19972
  data = _a.sent();
19972
19973
  setAccountId(data.account.id);
19973
19974
  setPortalSessionToken(data.portalSessionToken);
19974
- setPaymentMethodGraphQLClient(createGraphQLClient(apiHost || "", data.portalSessionToken));
19975
+ setPaymentMethodGraphQLClient(createGraphQLClient(apiHost, data.portalSessionToken));
19975
19976
  // We must invalidate the accountPaymentMethodKey query in order to clear payment methods from the provided api token,
19976
19977
  // to instead use paymentMethods from portalSessionToken.
19977
19978
  queryClient.invalidateQueries({
19978
- queryKey: QueryKeyFactory.default.accountPaymentMethodKey({ entityId: entityId, token: token }),
19979
+ queryKey: QueryKeyFactory.default.accountPaymentMethodKey({
19980
+ entityId: entityId,
19981
+ token: token,
19982
+ }),
19979
19983
  });
19980
19984
  setProceedingToPayment(false);
19981
19985
  setQuote(data.quote);
@@ -20012,6 +20016,9 @@ function Signup(_a) {
20012
20016
  if (!(plugin === null || plugin === void 0 ? void 0 : plugin.id)) {
20013
20017
  throw new Error("Plugin ID is required");
20014
20018
  }
20019
+ if (!(paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.id)) {
20020
+ throw new Error("Payment method ID is required");
20021
+ }
20015
20022
  return [4 /*yield*/, accountSignup({
20016
20023
  token: portalSessionToken,
20017
20024
  apiHost: apiHost,
@@ -20034,7 +20041,9 @@ function Signup(_a) {
20034
20041
  var children = _a.children, className = _a.className, style = _a.style;
20035
20042
  return isCardEnabled ? (jsx(Card, __assign({ className: className, style: style }, { children: children }))) : (jsx("div", __assign({ className: className, style: style }, { children: children })));
20036
20043
  };
20037
- 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 ? "items-center justify-center my-12" : "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 }) })) }))] }))) })));
20044
+ 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
20045
+ ? "items-center justify-center my-12"
20046
+ : "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 }) })) }))] }))) })));
20038
20047
  }
20039
20048
 
20040
20049
  // WARNING: There is a preview button on APP that will need to be changed if this query is changed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bunnyapp/components",
3
- "version": "1.0.41",
3
+ "version": "1.0.42",
4
4
  "description": "Components from the Bunny portal to embed Bunny UI functionality into your application.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",