@bunnyapp/components 1.0.68-beta.6 → 1.0.68-beta.8

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
@@ -156,7 +156,7 @@ var BrandContext = react.createContext({
156
156
  });
157
157
 
158
158
  // This will be replaced at build time by rollup-plugin-replace
159
- var PACKAGE_VERSION = '1.0.68-beta.6';
159
+ var PACKAGE_VERSION = '1.0.68-beta.8';
160
160
  var createRequestHeaders = function (token) {
161
161
  var headers = common.createClientDevHeaders(token);
162
162
  // Add the components version header
@@ -19395,12 +19395,10 @@ var useSendAcceptQuote = function (_a) {
19395
19395
  var _a = rsp.data.quoteSigningUrlCreate, redirectUri = _a.redirectUri, message = _a.message, pluginShortName = _a.pluginShortName;
19396
19396
  if (redirectUri) {
19397
19397
  // If redirectUri exists, redirect the browser
19398
- if (pluginShortName === 'pandadoc') {
19399
- setPandadocPollingModalVisible(true);
19400
- }
19401
- else {
19402
- window.location.href = redirectUri;
19403
- }
19398
+ window.location.href = redirectUri;
19399
+ }
19400
+ else if (pluginShortName === 'pandadoc') {
19401
+ setPandadocPollingModalVisible(true);
19404
19402
  }
19405
19403
  else if (message) {
19406
19404
  // If redirectUri is nil but message exists, display the message as notification
@@ -19535,6 +19533,9 @@ var AcceptQuoteModal = function (_a) {
19535
19533
  var acceptBoxVisible = _a.acceptBoxVisible, formattedQuote = _a.formattedQuote, sendAccept = _a.sendAccept, setAcceptBoxVisible = _a.setAcceptBoxVisible, setIsAccepting = _a.setIsAccepting, isSendAcceptPending = _a.isSendAcceptPending;
19536
19534
  // Refs
19537
19535
  var firstInputRef = react.useRef(null);
19536
+ var apiHost = react.useContext(BunnyContext).apiHost;
19537
+ var token = useToken();
19538
+ var signingPlugins = useSigningPlugins({ apiHost: apiHost, token: token });
19538
19539
  // Hooks
19539
19540
  var form = antd.Form.useForm()[0];
19540
19541
  useFocusFirstInput({ firstInputRef: firstInputRef, isVisible: acceptBoxVisible });
@@ -19556,7 +19557,7 @@ var AcceptQuoteModal = function (_a) {
19556
19557
  sendAccept(changedFields);
19557
19558
  })
19558
19559
  .catch(function () { });
19559
- }, open: acceptBoxVisible, title: "Start signing", width: 400 }, { children: jsxRuntime.jsxs(antd.Form, __assign({ className: "bunny-flex bunny-flex-col bunny-gap-2", form: form, layout: "vertical" }, { children: [jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Your name", name: "name", rules: createRules(true, 'Your name') }, { children: jsxRuntime.jsx(antd.Input, { autoFocus: true, ref: firstInputRef }) })), jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Your job title", name: "title", rules: createRules(true, 'Your job title') }, { children: jsxRuntime.jsx(antd.Input, {}) })), jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Purchase order number", name: "poNumber", rules: createRules(poNumberRequired, 'Purchase order number') }, { children: jsxRuntime.jsx(antd.Input, {}) })), taxNumberRequired && (jsxRuntime.jsx(antd.Form.Item, __assign({ name: "taxNumber", label: taxNumberLabel, rules: createRules(taxNumberRequired, taxNumberLabel) }, { children: jsxRuntime.jsx(antd.Input, {}) })))] })) })));
19560
+ }, open: acceptBoxVisible, title: (signingPlugins === null || signingPlugins === void 0 ? void 0 : signingPlugins.length) ? 'Start signing' : 'Accept quote', width: 400 }, { children: jsxRuntime.jsxs(antd.Form, __assign({ className: "bunny-flex bunny-flex-col bunny-gap-2", form: form, layout: "vertical" }, { children: [jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Your name", name: "name", rules: createRules(true, 'Your name') }, { children: jsxRuntime.jsx(antd.Input, { autoFocus: true, ref: firstInputRef }) })), jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Your job title", name: "title", rules: createRules(true, 'Your job title') }, { children: jsxRuntime.jsx(antd.Input, {}) })), jsxRuntime.jsx(antd.Form.Item, __assign({ label: "Purchase order number", name: "poNumber", rules: createRules(poNumberRequired, 'Purchase order number') }, { children: jsxRuntime.jsx(antd.Input, {}) })), taxNumberRequired && (jsxRuntime.jsx(antd.Form.Item, __assign({ name: "taxNumber", label: taxNumberLabel, rules: createRules(taxNumberRequired, taxNumberLabel) }, { children: jsxRuntime.jsx(antd.Input, {}) })))] })) })));
19560
19561
  };
19561
19562
 
19562
19563
  var Title$2 = antd.Typography.Title;
@@ -19624,11 +19625,11 @@ function ActualQuote() {
19624
19625
  var _this = this;
19625
19626
  var _a, _b, _c, _d;
19626
19627
  // Context
19627
- var _e = react.useContext(BunnyContext), apiHost = _e.apiHost, onTokenExpired = _e.onTokenExpired;
19628
+ var apiHost = react.useContext(BunnyContext).apiHost;
19628
19629
  var token = useToken();
19629
- var _f = react.useContext(InvoiceQuoteContext), className = _f.className, id = _f.id, hideDownloadButton = _f.hideDownloadButton, onQuoteLoaded = _f.onQuoteLoaded;
19630
+ var _e = react.useContext(InvoiceQuoteContext), className = _e.className, id = _e.id, hideDownloadButton = _e.hideDownloadButton, onQuoteLoaded = _e.onQuoteLoaded;
19630
19631
  // Queries
19631
- var _g = reactQuery.useQuery({
19632
+ var _f = reactQuery.useQuery({
19632
19633
  queryKey: common.QueryKeyFactory.default.createQuoteKey({ id: id, token: token }),
19633
19634
  queryFn: function () { return __awaiter(_this, void 0, void 0, function () {
19634
19635
  var error_1;
@@ -19647,15 +19648,14 @@ function ActualQuote() {
19647
19648
  });
19648
19649
  }); },
19649
19650
  placeholderData: reactQuery.keepPreviousData,
19650
- }), data = _g.data, isLoading = _g.isLoading;
19651
+ }), data = _f.data, isLoading = _f.isLoading;
19651
19652
  var formattedQuote = data;
19652
19653
  // Hooks
19653
- var _h = useSendAcceptQuote({
19654
+ var _g = useSendAcceptQuote({
19654
19655
  token: token,
19655
- onTokenExpired: onTokenExpired,
19656
19656
  apiHost: apiHost,
19657
19657
  quoteId: id,
19658
- }), acceptBoxVisible = _h.acceptBoxVisible, isAccepting = _h.isAccepting, sendAccept = _h.sendAccept, setAcceptBoxVisible = _h.setAcceptBoxVisible, setIsAccepting = _h.setIsAccepting, startAcceptance = _h.startAcceptance, pandadocPollingModalVisible = _h.pandadocPollingModalVisible, setPandadocPollingModalVisible = _h.setPandadocPollingModalVisible, isSendAcceptPending = _h.isSendAcceptPending;
19658
+ }), acceptBoxVisible = _g.acceptBoxVisible, isAccepting = _g.isAccepting, sendAccept = _g.sendAccept, setAcceptBoxVisible = _g.setAcceptBoxVisible, setIsAccepting = _g.setIsAccepting, startAcceptance = _g.startAcceptance, pandadocPollingModalVisible = _g.pandadocPollingModalVisible, setPandadocPollingModalVisible = _g.setPandadocPollingModalVisible, isSendAcceptPending = _g.isSendAcceptPending;
19659
19659
  useSigningComplete({ data: formattedQuote, token: token });
19660
19660
  var isMobile = common.useIsMobile();
19661
19661
  var showErrorNotification = common.useErrorNotification();
@@ -19665,7 +19665,7 @@ function ActualQuote() {
19665
19665
  }
19666
19666
  }, [formattedQuote]);
19667
19667
  // Payment hold stuff here
19668
- var _j = useQuotePaymentHold(formattedQuote), paymentHoldModalVisible = _j.paymentHoldModalVisible, setPaymentHoldModalVisible = _j.setPaymentHoldModalVisible, shouldDoPaymentHold = _j.shouldDoPaymentHold, paymentHoldCompleted = _j.paymentHoldCompleted, paymentHold = _j.paymentHold;
19668
+ var _h = useQuotePaymentHold(formattedQuote), paymentHoldModalVisible = _h.paymentHoldModalVisible, setPaymentHoldModalVisible = _h.setPaymentHoldModalVisible, shouldDoPaymentHold = _h.shouldDoPaymentHold, paymentHoldCompleted = _h.paymentHoldCompleted, paymentHold = _h.paymentHold;
19669
19669
  var handleClickAccept = function () {
19670
19670
  if (shouldDoPaymentHold && !paymentHoldCompleted) {
19671
19671
  setPaymentHoldModalVisible(true);
@@ -19697,9 +19697,14 @@ function QuoteButtons(_a) {
19697
19697
  var entityBranding = react.useContext(BrandContext);
19698
19698
  var downloadFile = useDownloadFile(id);
19699
19699
  var isExpired = useIsExpired(formattedQuote === null || formattedQuote === void 0 ? void 0 : formattedQuote.expiresAt);
19700
+ var signingPlugins = useSigningPlugins({ apiHost: apiHost, token: token });
19700
19701
  return (jsxRuntime.jsxs("div", __assign({ className: "flex flex-row justify-end items-center gap-4", id: "acceptance", style: {
19701
19702
  color: entityBranding.secondaryColor,
19702
- } }, { children: [isAccepted && formattedQuote.acceptedAt ? (jsxRuntime.jsx(Text$n, { children: "Quote was accepted by ".concat(formattedQuote.acceptedByName, " on ").concat(common.formatDate(formattedQuote.acceptedAt)) })) : null, (!isMobile || !isAccepted) && (jsxRuntime.jsxs("div", __assign({ className: isMobile ? 'flex w-full justify-end gap-2' : 'flex items-center justify-end gap-2' }, { children: [paymentHold ? (jsxRuntime.jsx(PaymentHoldDisplay, { paymentHold: paymentHold, currency: formattedQuote.currency, amount: formattedQuote.amount })) : null, !isMobile && !hideDownloadButton ? (jsxRuntime.jsx(antd.Button, __assign({ icon: jsxRuntime.jsx(icons.DownloadOutlined, {}), onClick: function () { return downloadFile(apiHost + '/api/pdf/quote', token); } }, { children: "Download" }))) : null, shouldDoPaymentHold && !paymentHoldCompleted ? (jsxRuntime.jsx(antd.Button, __assign({ disabled: isExpired, onClick: function () { return setPaymentHoldModalVisible(true); }, type: "primary" }, { children: "Pay to accept" }))) : (jsxRuntime.jsx(jsxRuntime.Fragment, { children: !isAccepted ? (jsxRuntime.jsx(antd.Button, __assign({ disabled: isExpired || isAccepting, onClick: handleClickAccept, type: "primary" }, { children: isExpired ? 'Quote is expired' : 'Start signing' }))) : null }))] })))] })));
19703
+ } }, { children: [isAccepted && formattedQuote.acceptedAt ? (jsxRuntime.jsx(Text$n, { children: "Quote was accepted by ".concat(formattedQuote.acceptedByName, " on ").concat(common.formatDate(formattedQuote.acceptedAt)) })) : null, (!isMobile || !isAccepted) && (jsxRuntime.jsxs("div", __assign({ className: isMobile ? 'flex w-full justify-end gap-2' : 'flex items-center justify-end gap-2' }, { children: [paymentHold ? (jsxRuntime.jsx(PaymentHoldDisplay, { paymentHold: paymentHold, currency: formattedQuote.currency, amount: formattedQuote.amount })) : null, !isMobile && !hideDownloadButton ? (jsxRuntime.jsx(antd.Button, __assign({ icon: jsxRuntime.jsx(icons.DownloadOutlined, {}), onClick: function () { return downloadFile(apiHost + '/api/pdf/quote', token); } }, { children: "Download" }))) : null, shouldDoPaymentHold && !paymentHoldCompleted ? (jsxRuntime.jsx(antd.Button, __assign({ disabled: isExpired, onClick: function () { return setPaymentHoldModalVisible(true); }, type: "primary" }, { children: "Pay to accept" }))) : (jsxRuntime.jsx(jsxRuntime.Fragment, { children: !isAccepted ? (jsxRuntime.jsx(antd.Button, __assign({ disabled: isExpired || isAccepting, onClick: handleClickAccept, type: "primary" }, { children: isExpired
19704
+ ? 'Quote is expired'
19705
+ : (signingPlugins === null || signingPlugins === void 0 ? void 0 : signingPlugins.length)
19706
+ ? 'Start signing'
19707
+ : 'Accept quote' }))) : null }))] })))] })));
19703
19708
  }
19704
19709
  function PaymentHoldDisplay(_a) {
19705
19710
  var _b, _c, _d, _e;
@@ -20164,9 +20169,9 @@ function QuotesWrapper() {
20164
20169
  return (jsxRuntime.jsx(TransactionsDisplay, { transactions: quotesAsTransactions, onSearchValueChanged: setSearch, search: search }));
20165
20170
  }
20166
20171
 
20167
- var MUTATION$6 = function () { return "\nmutation AccountSignup (\n $pluginId: String!,\n $paymentMethodId: String,\n $priceListCode: String!,\n $accountId: ID!,\n $quoteId: ID!,\n $entityId: ID!\n) {\n accountSignup(\n pluginId: $pluginId,\n paymentMethodId: $paymentMethodId,\n priceListCode: $priceListCode,\n accountId: $accountId,\n quoteId: $quoteId,\n entityId: $entityId\n ) {\n errors\n quote {\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}"; };
20172
+ var MUTATION$6 = function () { return "\nmutation AccountSignup (\n $pluginId: String!,\n $paymentMethodId: String,\n $priceListCode: String!,\n $accountId: ID!,\n $quoteId: ID!,\n) {\n accountSignup(\n pluginId: $pluginId,\n paymentMethodId: $paymentMethodId,\n priceListCode: $priceListCode,\n accountId: $accountId,\n quoteId: $quoteId,\n ) {\n errors\n quote {\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}"; };
20168
20173
  var accountSignup = function (_a) {
20169
- var token = _a.token, apiHost = _a.apiHost, accountId = _a.accountId, quoteId = _a.quoteId, paymentToken = _a.paymentToken, paymentMethodId = _a.paymentMethodId, pluginId = _a.pluginId, priceListCode = _a.priceListCode, entityId = _a.entityId;
20174
+ var token = _a.token, apiHost = _a.apiHost, accountId = _a.accountId, quoteId = _a.quoteId, paymentToken = _a.paymentToken, paymentMethodId = _a.paymentMethodId, pluginId = _a.pluginId, priceListCode = _a.priceListCode;
20170
20175
  return __awaiter(void 0, void 0, void 0, function () {
20171
20176
  var vars, response, errors;
20172
20177
  var _b;
@@ -20180,7 +20185,6 @@ var accountSignup = function (_a) {
20180
20185
  pluginId: pluginId,
20181
20186
  paymentMethodId: paymentMethodId,
20182
20187
  priceListCode: priceListCode,
20183
- entityId: entityId,
20184
20188
  };
20185
20189
  return [4 /*yield*/, gqlRequest({
20186
20190
  query: MUTATION$6(),
@@ -20199,9 +20203,9 @@ var accountSignup = function (_a) {
20199
20203
  });
20200
20204
  };
20201
20205
 
20202
- var MUTATION$5 = function () { return "\nmutation QuoteAccountSignup (\n $accountName: String!,\n $billingContact: ContactAttributes!,\n $priceListCode: String!,\n $entityId: ID!\n) {\n quoteAccountSignup(\n priceListCode: $priceListCode,\n accountName: $accountName,\n billingContact: $billingContact,\n entityId: $entityId\n ) {\n account {\n id\n }\n quote {\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 tenant {\n code\n }\n portalSessionToken\n errors\n }\n}"; };
20206
+ var MUTATION$5 = function () { return "\nmutation QuoteAccountSignup (\n $accountName: String!,\n $billingContact: ContactAttributes!,\n $priceListCode: String!,\n) {\n quoteAccountSignup(\n priceListCode: $priceListCode,\n accountName: $accountName,\n billingContact: $billingContact,\n ) {\n account {\n id\n }\n quote {\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 tenant {\n code\n }\n portalSessionToken\n errors\n }\n}"; };
20203
20207
  var quoteAccountSignup = function (_a) {
20204
- var token = _a.token, apiHost = _a.apiHost, priceListCode = _a.priceListCode, accountName = _a.accountName, billingContact = _a.billingContact, entityId = _a.entityId;
20208
+ var token = _a.token, apiHost = _a.apiHost, priceListCode = _a.priceListCode, accountName = _a.accountName, billingContact = _a.billingContact;
20205
20209
  return __awaiter(void 0, void 0, void 0, function () {
20206
20210
  var vars, response, errors;
20207
20211
  var _b;
@@ -20212,7 +20216,6 @@ var quoteAccountSignup = function (_a) {
20212
20216
  priceListCode: priceListCode,
20213
20217
  accountName: accountName,
20214
20218
  billingContact: billingContact,
20215
- entityId: entityId,
20216
20219
  };
20217
20220
  return [4 /*yield*/, gqlRequest({
20218
20221
  query: MUTATION$5(),
@@ -20357,7 +20360,7 @@ function PriceListDisplay(_a) {
20357
20360
 
20358
20361
  var showErrorNotification = common.useErrorNotification();
20359
20362
  function Signup(_a) {
20360
- var companyName = _a.companyName, priceListCode = _a.priceListCode, returnUrl = _a.returnUrl, couponCode = _a.couponCode, className = _a.className, _b = _a.shadow, shadow = _b === void 0 ? 'shadow-md' : _b, style = _a.style, entityId = _a.entityId;
20363
+ var companyName = _a.companyName, priceListCode = _a.priceListCode, returnUrl = _a.returnUrl, couponCode = _a.couponCode, className = _a.className, _b = _a.shadow, shadow = _b === void 0 ? 'shadow-md' : _b, style = _a.style;
20361
20364
  // Hooks
20362
20365
  var apiHost = react.useContext(BunnyContext).apiHost;
20363
20366
  var tokenFromContexts = useToken();
@@ -20443,7 +20446,6 @@ function Signup(_a) {
20443
20446
  lastName: formData.lastName,
20444
20447
  email: formData.email,
20445
20448
  },
20446
- entityId: entityId,
20447
20449
  })];
20448
20450
  case 1:
20449
20451
  data_1 = _a.sent();
@@ -20503,7 +20505,6 @@ function Signup(_a) {
20503
20505
  pluginId: plugin === null || plugin === void 0 ? void 0 : plugin.id.toString(),
20504
20506
  priceListCode: priceListCode,
20505
20507
  accountId: accountId,
20506
- entityId: entityId,
20507
20508
  })];
20508
20509
  case 1: return [2 /*return*/, _a.sent()];
20509
20510
  }
@@ -21263,7 +21264,7 @@ var PlanPickerCheckoutBar = function (_a) {
21263
21264
  };
21264
21265
 
21265
21266
  // WARNING: There is a preview button on APP that will need to be changed if this query is changed
21266
- var PRICE_LIST_CHANGE_OPTIONS_QUERY = "\n query priceListChangeOptions($subscriptionId: ID, $productId: ID) {\n priceListChangeOptions(subscriptionId: $subscriptionId, productId: $productId) {\n products {\n everythingInPlus\n id\n name\n plansToDisplay\n features(sort: \"position asc\") {\n description\n id\n isVisible\n kind\n name\n position\n }\n }\n priceLists {\n basePrice\n currencyId\n id\n monthlyBasePrice\n periodMonths\n plan {\n code\n contactUsLabel\n contactUsUrl\n description\n id\n name\n position\n pricingDescription\n pricingStyle\n planFeatures {\n featureId\n value\n feature {\n name\n }\n }\n }\n product {\n id\n }\n charges {\n basePrice\n billingPeriod\n chargeType\n id\n name\n priceDecimals\n pricingModel\n quantityMax\n quantityMin\n selfServiceQuantity\n feature {\n name\n unitName\n }\n }\n }\n }\n }";
21267
+ var PRICE_LIST_CHANGE_OPTIONS_QUERY = "\n query priceListChangeOptions($subscriptionId: ID, $productId: ID) {\n priceListChangeOptions(subscriptionId: $subscriptionId, productId: $productId) {\n products {\n everythingInPlus\n id\n name\n plansToDisplay\n features(sort: \"position asc\") {\n description\n id\n isVisible\n kind\n name\n position\n }\n }\n priceLists {\n showPriceAsMonthly\n basePrice\n currencyId\n id\n monthlyBasePrice\n periodMonths\n plan {\n code\n contactUsLabel\n contactUsUrl\n description\n id\n name\n position\n pricingDescription\n pricingStyle\n planFeatures {\n featureId\n value\n feature {\n name\n }\n }\n }\n product {\n id\n }\n charges {\n basePrice\n billingPeriod\n chargeType\n id\n name\n priceDecimals\n pricingModel\n quantityMax\n quantityMin\n selfServiceQuantity\n feature {\n name\n unitName\n }\n }\n }\n }\n }";
21267
21268
  var getPriceListChangeOptions = function (_a) {
21268
21269
  var apiHost = _a.apiHost, isInPreviewMode = _a.isInPreviewMode, productId = _a.productId, token = _a.token, upgradingSubscription = _a.upgradingSubscription;
21269
21270
  return __awaiter(void 0, void 0, void 0, function () {
@@ -21367,10 +21368,30 @@ var PriceListCardTitle = function (_a) {
21367
21368
  : " " }))), jsxRuntime.jsx("div", __assign({ className: "bunny-font-medium bunny-text-center ".concat(isMobile ? "bunny-text-slate-500" : "bunny-text-orange-600"), style: { fontSize: "20px" } }, { children: priceList.plan.name }))] })));
21368
21369
  };
21369
21370
 
21371
+ var getPrice = function (priceList) {
21372
+ if (priceList.showPriceAsMonthly) {
21373
+ return priceList.monthlyBasePrice;
21374
+ }
21375
+ return priceList.basePrice;
21376
+ };
21377
+ var calculatePriceDecimals = function (priceList) {
21378
+ if (priceList.plan.pricingStyle === common.PricingStyle.PRICED) {
21379
+ var decimalPart = getPrice(priceList).toString().split('.')[1];
21380
+ if (!decimalPart)
21381
+ return 0;
21382
+ // If decimal part consists only of zeros, return 0
21383
+ if (parseInt(decimalPart) === 0) {
21384
+ return 0;
21385
+ }
21386
+ return undefined;
21387
+ }
21388
+ return 0;
21389
+ };
21370
21390
  var PriceListCardPrice = function (_a) {
21371
21391
  var priceList = _a.priceList;
21392
+ var priceDecimals = calculatePriceDecimals(priceList);
21372
21393
  return (jsxRuntime.jsx("div", __assign({ className: "bunny-font-medium bunny-text-center bunny-text-gray-900", style: { fontSize: '32px' } }, { children: !priceList.plan.pricingStyle || priceList.plan.pricingStyle === common.PricingStyle.PRICED
21373
- ? common.formatCurrency(priceList.monthlyBasePrice, priceList.currencyId, 0)
21394
+ ? common.formatCurrency(getPrice(priceList), priceList.currencyId, priceDecimals)
21374
21395
  : priceList.plan.pricingStyle === common.PricingStyle.CONTACT_US
21375
21396
  ? ''
21376
21397
  : 'Free' })));
@@ -21409,7 +21430,9 @@ var PriceListCardPriceDescription = function (_a) {
21409
21430
  fontSize: isMobile ? '13px' : '12px',
21410
21431
  } }, { children: priceList.plan.pricingDescription && !isEmptyHtml(priceList.plan.pricingDescription) ? (jsxRuntime.jsx(interweave.Markup, { content: priceList.plan.pricingDescription })) : ("per ".concat((feature === null || feature === void 0 ? void 0 : feature.unitName) && !doesPlanHaveFlatFeeCharges
21411
21432
  ? "".concat(feature.unitName.toLowerCase(), " / ")
21412
- : '', "month")) })), priceList.periodMonths > 1 && (jsxRuntime.jsxs(Text$b, __assign({ className: "bunny-text-center bunny-text-gray-900", style: { fontSize: isMobile ? '12px' : '11px' } }, { children: ["billed ", BillingPeriodConverter$1[periodMonthsConverter(priceList.periodMonths)]] })))] }));
21433
+ : '').concat(priceList.showPriceAsMonthly
21434
+ ? 'month'
21435
+ : common.PERIOD_LABELS[periodMonthsConverter(priceList.periodMonths)])) })), priceList.periodMonths > 1 && (jsxRuntime.jsxs(Text$b, __assign({ className: "bunny-text-center bunny-text-gray-900", style: { fontSize: isMobile ? '12px' : '11px' } }, { children: ["billed ", BillingPeriodConverter$1[periodMonthsConverter(priceList.periodMonths)]] })))] }));
21413
21436
  };
21414
21437
 
21415
21438
  var CheckIcon = function (_a) {
@@ -21447,11 +21470,11 @@ var PriceListCardMobile = function (_a) {
21447
21470
  if (!disableOnClick)
21448
21471
  onClick(priceList);
21449
21472
  }, style: {
21450
- minWidth: "220px",
21473
+ minWidth: '220px',
21451
21474
  borderColor: isSelected ? brandColor : common.SLATE_200,
21452
21475
  } }, { children: [isSelected && (jsxRuntime.jsx("div", __assign({ className: "bunny-absolute", style: {
21453
- top: "10px",
21454
- right: "10px",
21476
+ top: '10px',
21477
+ right: '10px',
21455
21478
  } }, { children: jsxRuntime.jsx(CheckIcon, { backgroundColor: brandColor, size: "20px" }) }))), jsxRuntime.jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-items-center bunny-grow bunny-gap-2" }, { children: [jsxRuntime.jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-items-center bunny-gap-2" }, { children: [jsxRuntime.jsx(PriceListCardTitle, { isPriceListCurrentSubscription: isPriceListCurrentSubscription, priceList: priceList, trialRemainingDays: trialRemainingDays }), jsxRuntime.jsx(PriceListCardDescription, { description: description })] })), jsxRuntime.jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-items-center bunny-gap-2" }, { children: [jsxRuntime.jsx(PriceListCardPrice, { priceList: priceList }), jsxRuntime.jsx(PriceListCardPriceDescription, { feature: feature, priceList: priceList })] })), jsxRuntime.jsx(PriceListCardButton, { disableOnClick: disableOnClick, isPriceListCurrentSubscription: isPriceListCurrentSubscription, isSelected: isSelected, priceList: priceList, subscriptionPlan: subscriptionPlan })] }))] })));
21456
21479
  };
21457
21480
 
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import '../../styles/index.less';
3
3
  import { ShadowType } from '../../types/shadowType';
4
- export default function Signup({ companyName, priceListCode, returnUrl, couponCode, className, shadow, style, entityId, }: {
4
+ export default function Signup({ companyName, priceListCode, returnUrl, couponCode, className, shadow, style, }: {
5
5
  /** The company name to display on the signup page */
6
6
  companyName: string;
7
7
  /** The price list code to use for the signup */
@@ -16,6 +16,4 @@ export default function Signup({ companyName, priceListCode, returnUrl, couponCo
16
16
  shadow?: ShadowType;
17
17
  /** A custom style to apply to the component */
18
18
  style?: React.CSSProperties;
19
- /** The entity ID to use for the signup */
20
- entityId: string;
21
19
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import { Feature, PriceList, Subscription } from "@bunnyapp/common";
1
+ import { Feature, PriceList, Subscription } from '@bunnyapp/common';
2
2
  declare const PriceListCardMobile: ({ description, disableOnClick, feature, isPriceListCurrentSubscription, isSelected, onClick, priceList, subscriptionPlan, trialRemainingDays, }: {
3
3
  description: string;
4
4
  disableOnClick: boolean;
@@ -1,4 +1,4 @@
1
- declare const accountSignup: ({ token, apiHost, accountId, quoteId, paymentToken, paymentMethodId, pluginId, priceListCode, entityId, }: {
1
+ declare const accountSignup: ({ token, apiHost, accountId, quoteId, paymentToken, paymentMethodId, pluginId, priceListCode, }: {
2
2
  token: string;
3
3
  apiHost: string;
4
4
  accountId: string;
@@ -7,6 +7,5 @@ declare const accountSignup: ({ token, apiHost, accountId, quoteId, paymentToken
7
7
  paymentMethodId?: string | undefined;
8
8
  pluginId: string;
9
9
  priceListCode: string;
10
- entityId: string;
11
10
  }) => Promise<any>;
12
11
  export default accountSignup;
@@ -3,12 +3,11 @@ type BillingContact = {
3
3
  lastName: string;
4
4
  email: string;
5
5
  };
6
- declare const quoteAccountSignup: ({ token, apiHost, priceListCode, accountName, billingContact, entityId, }: {
6
+ declare const quoteAccountSignup: ({ token, apiHost, priceListCode, accountName, billingContact, }: {
7
7
  token?: string | undefined;
8
8
  apiHost: string;
9
9
  priceListCode: string;
10
10
  accountName: string;
11
11
  billingContact: BillingContact;
12
- entityId: string;
13
12
  }) => Promise<any>;
14
13
  export default quoteAccountSignup;
package/dist/esm/index.js CHANGED
@@ -144,7 +144,7 @@ var BrandContext = createContext({
144
144
  });
145
145
 
146
146
  // This will be replaced at build time by rollup-plugin-replace
147
- var PACKAGE_VERSION = '1.0.68-beta.6';
147
+ var PACKAGE_VERSION = '1.0.68-beta.8';
148
148
  var createRequestHeaders = function (token) {
149
149
  var headers = createClientDevHeaders(token);
150
150
  // Add the components version header
@@ -19383,12 +19383,10 @@ var useSendAcceptQuote = function (_a) {
19383
19383
  var _a = rsp.data.quoteSigningUrlCreate, redirectUri = _a.redirectUri, message = _a.message, pluginShortName = _a.pluginShortName;
19384
19384
  if (redirectUri) {
19385
19385
  // If redirectUri exists, redirect the browser
19386
- if (pluginShortName === 'pandadoc') {
19387
- setPandadocPollingModalVisible(true);
19388
- }
19389
- else {
19390
- window.location.href = redirectUri;
19391
- }
19386
+ window.location.href = redirectUri;
19387
+ }
19388
+ else if (pluginShortName === 'pandadoc') {
19389
+ setPandadocPollingModalVisible(true);
19392
19390
  }
19393
19391
  else if (message) {
19394
19392
  // If redirectUri is nil but message exists, display the message as notification
@@ -19523,6 +19521,9 @@ var AcceptQuoteModal = function (_a) {
19523
19521
  var acceptBoxVisible = _a.acceptBoxVisible, formattedQuote = _a.formattedQuote, sendAccept = _a.sendAccept, setAcceptBoxVisible = _a.setAcceptBoxVisible, setIsAccepting = _a.setIsAccepting, isSendAcceptPending = _a.isSendAcceptPending;
19524
19522
  // Refs
19525
19523
  var firstInputRef = useRef(null);
19524
+ var apiHost = useContext(BunnyContext).apiHost;
19525
+ var token = useToken();
19526
+ var signingPlugins = useSigningPlugins({ apiHost: apiHost, token: token });
19526
19527
  // Hooks
19527
19528
  var form = Form.useForm()[0];
19528
19529
  useFocusFirstInput({ firstInputRef: firstInputRef, isVisible: acceptBoxVisible });
@@ -19544,7 +19545,7 @@ var AcceptQuoteModal = function (_a) {
19544
19545
  sendAccept(changedFields);
19545
19546
  })
19546
19547
  .catch(function () { });
19547
- }, open: acceptBoxVisible, title: "Start signing", width: 400 }, { children: jsxs(Form, __assign({ className: "bunny-flex bunny-flex-col bunny-gap-2", form: form, layout: "vertical" }, { children: [jsx(Form.Item, __assign({ label: "Your name", name: "name", rules: createRules(true, 'Your name') }, { children: jsx(Input, { autoFocus: true, ref: firstInputRef }) })), jsx(Form.Item, __assign({ label: "Your job title", name: "title", rules: createRules(true, 'Your job title') }, { children: jsx(Input, {}) })), jsx(Form.Item, __assign({ label: "Purchase order number", name: "poNumber", rules: createRules(poNumberRequired, 'Purchase order number') }, { children: jsx(Input, {}) })), taxNumberRequired && (jsx(Form.Item, __assign({ name: "taxNumber", label: taxNumberLabel, rules: createRules(taxNumberRequired, taxNumberLabel) }, { children: jsx(Input, {}) })))] })) })));
19548
+ }, open: acceptBoxVisible, title: (signingPlugins === null || signingPlugins === void 0 ? void 0 : signingPlugins.length) ? 'Start signing' : 'Accept quote', width: 400 }, { children: jsxs(Form, __assign({ className: "bunny-flex bunny-flex-col bunny-gap-2", form: form, layout: "vertical" }, { children: [jsx(Form.Item, __assign({ label: "Your name", name: "name", rules: createRules(true, 'Your name') }, { children: jsx(Input, { autoFocus: true, ref: firstInputRef }) })), jsx(Form.Item, __assign({ label: "Your job title", name: "title", rules: createRules(true, 'Your job title') }, { children: jsx(Input, {}) })), jsx(Form.Item, __assign({ label: "Purchase order number", name: "poNumber", rules: createRules(poNumberRequired, 'Purchase order number') }, { children: jsx(Input, {}) })), taxNumberRequired && (jsx(Form.Item, __assign({ name: "taxNumber", label: taxNumberLabel, rules: createRules(taxNumberRequired, taxNumberLabel) }, { children: jsx(Input, {}) })))] })) })));
19548
19549
  };
19549
19550
 
19550
19551
  var Title$2 = Typography.Title;
@@ -19612,11 +19613,11 @@ function ActualQuote() {
19612
19613
  var _this = this;
19613
19614
  var _a, _b, _c, _d;
19614
19615
  // Context
19615
- var _e = useContext(BunnyContext), apiHost = _e.apiHost, onTokenExpired = _e.onTokenExpired;
19616
+ var apiHost = useContext(BunnyContext).apiHost;
19616
19617
  var token = useToken();
19617
- var _f = useContext(InvoiceQuoteContext), className = _f.className, id = _f.id, hideDownloadButton = _f.hideDownloadButton, onQuoteLoaded = _f.onQuoteLoaded;
19618
+ var _e = useContext(InvoiceQuoteContext), className = _e.className, id = _e.id, hideDownloadButton = _e.hideDownloadButton, onQuoteLoaded = _e.onQuoteLoaded;
19618
19619
  // Queries
19619
- var _g = useQuery({
19620
+ var _f = useQuery({
19620
19621
  queryKey: QueryKeyFactory.default.createQuoteKey({ id: id, token: token }),
19621
19622
  queryFn: function () { return __awaiter(_this, void 0, void 0, function () {
19622
19623
  var error_1;
@@ -19635,15 +19636,14 @@ function ActualQuote() {
19635
19636
  });
19636
19637
  }); },
19637
19638
  placeholderData: keepPreviousData,
19638
- }), data = _g.data, isLoading = _g.isLoading;
19639
+ }), data = _f.data, isLoading = _f.isLoading;
19639
19640
  var formattedQuote = data;
19640
19641
  // Hooks
19641
- var _h = useSendAcceptQuote({
19642
+ var _g = useSendAcceptQuote({
19642
19643
  token: token,
19643
- onTokenExpired: onTokenExpired,
19644
19644
  apiHost: apiHost,
19645
19645
  quoteId: id,
19646
- }), acceptBoxVisible = _h.acceptBoxVisible, isAccepting = _h.isAccepting, sendAccept = _h.sendAccept, setAcceptBoxVisible = _h.setAcceptBoxVisible, setIsAccepting = _h.setIsAccepting, startAcceptance = _h.startAcceptance, pandadocPollingModalVisible = _h.pandadocPollingModalVisible, setPandadocPollingModalVisible = _h.setPandadocPollingModalVisible, isSendAcceptPending = _h.isSendAcceptPending;
19646
+ }), acceptBoxVisible = _g.acceptBoxVisible, isAccepting = _g.isAccepting, sendAccept = _g.sendAccept, setAcceptBoxVisible = _g.setAcceptBoxVisible, setIsAccepting = _g.setIsAccepting, startAcceptance = _g.startAcceptance, pandadocPollingModalVisible = _g.pandadocPollingModalVisible, setPandadocPollingModalVisible = _g.setPandadocPollingModalVisible, isSendAcceptPending = _g.isSendAcceptPending;
19647
19647
  useSigningComplete({ data: formattedQuote, token: token });
19648
19648
  var isMobile = useIsMobile();
19649
19649
  var showErrorNotification = useErrorNotification();
@@ -19653,7 +19653,7 @@ function ActualQuote() {
19653
19653
  }
19654
19654
  }, [formattedQuote]);
19655
19655
  // Payment hold stuff here
19656
- var _j = useQuotePaymentHold(formattedQuote), paymentHoldModalVisible = _j.paymentHoldModalVisible, setPaymentHoldModalVisible = _j.setPaymentHoldModalVisible, shouldDoPaymentHold = _j.shouldDoPaymentHold, paymentHoldCompleted = _j.paymentHoldCompleted, paymentHold = _j.paymentHold;
19656
+ var _h = useQuotePaymentHold(formattedQuote), paymentHoldModalVisible = _h.paymentHoldModalVisible, setPaymentHoldModalVisible = _h.setPaymentHoldModalVisible, shouldDoPaymentHold = _h.shouldDoPaymentHold, paymentHoldCompleted = _h.paymentHoldCompleted, paymentHold = _h.paymentHold;
19657
19657
  var handleClickAccept = function () {
19658
19658
  if (shouldDoPaymentHold && !paymentHoldCompleted) {
19659
19659
  setPaymentHoldModalVisible(true);
@@ -19685,9 +19685,14 @@ function QuoteButtons(_a) {
19685
19685
  var entityBranding = useContext(BrandContext);
19686
19686
  var downloadFile = useDownloadFile(id);
19687
19687
  var isExpired = useIsExpired(formattedQuote === null || formattedQuote === void 0 ? void 0 : formattedQuote.expiresAt);
19688
+ var signingPlugins = useSigningPlugins({ apiHost: apiHost, token: token });
19688
19689
  return (jsxs("div", __assign({ className: "flex flex-row justify-end items-center gap-4", id: "acceptance", style: {
19689
19690
  color: entityBranding.secondaryColor,
19690
- } }, { children: [isAccepted && formattedQuote.acceptedAt ? (jsx(Text$n, { children: "Quote was accepted by ".concat(formattedQuote.acceptedByName, " on ").concat(formatDate(formattedQuote.acceptedAt)) })) : null, (!isMobile || !isAccepted) && (jsxs("div", __assign({ className: isMobile ? 'flex w-full justify-end gap-2' : 'flex items-center justify-end gap-2' }, { children: [paymentHold ? (jsx(PaymentHoldDisplay, { paymentHold: paymentHold, currency: formattedQuote.currency, amount: formattedQuote.amount })) : null, !isMobile && !hideDownloadButton ? (jsx(Button, __assign({ icon: jsx(DownloadOutlined, {}), onClick: function () { return downloadFile(apiHost + '/api/pdf/quote', token); } }, { children: "Download" }))) : null, shouldDoPaymentHold && !paymentHoldCompleted ? (jsx(Button, __assign({ disabled: isExpired, onClick: function () { return setPaymentHoldModalVisible(true); }, type: "primary" }, { children: "Pay to accept" }))) : (jsx(Fragment, { children: !isAccepted ? (jsx(Button, __assign({ disabled: isExpired || isAccepting, onClick: handleClickAccept, type: "primary" }, { children: isExpired ? 'Quote is expired' : 'Start signing' }))) : null }))] })))] })));
19691
+ } }, { children: [isAccepted && formattedQuote.acceptedAt ? (jsx(Text$n, { children: "Quote was accepted by ".concat(formattedQuote.acceptedByName, " on ").concat(formatDate(formattedQuote.acceptedAt)) })) : null, (!isMobile || !isAccepted) && (jsxs("div", __assign({ className: isMobile ? 'flex w-full justify-end gap-2' : 'flex items-center justify-end gap-2' }, { children: [paymentHold ? (jsx(PaymentHoldDisplay, { paymentHold: paymentHold, currency: formattedQuote.currency, amount: formattedQuote.amount })) : null, !isMobile && !hideDownloadButton ? (jsx(Button, __assign({ icon: jsx(DownloadOutlined, {}), onClick: function () { return downloadFile(apiHost + '/api/pdf/quote', token); } }, { children: "Download" }))) : null, shouldDoPaymentHold && !paymentHoldCompleted ? (jsx(Button, __assign({ disabled: isExpired, onClick: function () { return setPaymentHoldModalVisible(true); }, type: "primary" }, { children: "Pay to accept" }))) : (jsx(Fragment, { children: !isAccepted ? (jsx(Button, __assign({ disabled: isExpired || isAccepting, onClick: handleClickAccept, type: "primary" }, { children: isExpired
19692
+ ? 'Quote is expired'
19693
+ : (signingPlugins === null || signingPlugins === void 0 ? void 0 : signingPlugins.length)
19694
+ ? 'Start signing'
19695
+ : 'Accept quote' }))) : null }))] })))] })));
19691
19696
  }
19692
19697
  function PaymentHoldDisplay(_a) {
19693
19698
  var _b, _c, _d, _e;
@@ -20152,9 +20157,9 @@ function QuotesWrapper() {
20152
20157
  return (jsx(TransactionsDisplay, { transactions: quotesAsTransactions, onSearchValueChanged: setSearch, search: search }));
20153
20158
  }
20154
20159
 
20155
- var MUTATION$6 = function () { return "\nmutation AccountSignup (\n $pluginId: String!,\n $paymentMethodId: String,\n $priceListCode: String!,\n $accountId: ID!,\n $quoteId: ID!,\n $entityId: ID!\n) {\n accountSignup(\n pluginId: $pluginId,\n paymentMethodId: $paymentMethodId,\n priceListCode: $priceListCode,\n accountId: $accountId,\n quoteId: $quoteId,\n entityId: $entityId\n ) {\n errors\n quote {\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}"; };
20160
+ var MUTATION$6 = function () { return "\nmutation AccountSignup (\n $pluginId: String!,\n $paymentMethodId: String,\n $priceListCode: String!,\n $accountId: ID!,\n $quoteId: ID!,\n) {\n accountSignup(\n pluginId: $pluginId,\n paymentMethodId: $paymentMethodId,\n priceListCode: $priceListCode,\n accountId: $accountId,\n quoteId: $quoteId,\n ) {\n errors\n quote {\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}"; };
20156
20161
  var accountSignup = function (_a) {
20157
- var token = _a.token, apiHost = _a.apiHost, accountId = _a.accountId, quoteId = _a.quoteId, paymentToken = _a.paymentToken, paymentMethodId = _a.paymentMethodId, pluginId = _a.pluginId, priceListCode = _a.priceListCode, entityId = _a.entityId;
20162
+ var token = _a.token, apiHost = _a.apiHost, accountId = _a.accountId, quoteId = _a.quoteId, paymentToken = _a.paymentToken, paymentMethodId = _a.paymentMethodId, pluginId = _a.pluginId, priceListCode = _a.priceListCode;
20158
20163
  return __awaiter(void 0, void 0, void 0, function () {
20159
20164
  var vars, response, errors;
20160
20165
  var _b;
@@ -20168,7 +20173,6 @@ var accountSignup = function (_a) {
20168
20173
  pluginId: pluginId,
20169
20174
  paymentMethodId: paymentMethodId,
20170
20175
  priceListCode: priceListCode,
20171
- entityId: entityId,
20172
20176
  };
20173
20177
  return [4 /*yield*/, gqlRequest({
20174
20178
  query: MUTATION$6(),
@@ -20187,9 +20191,9 @@ var accountSignup = function (_a) {
20187
20191
  });
20188
20192
  };
20189
20193
 
20190
- var MUTATION$5 = function () { return "\nmutation QuoteAccountSignup (\n $accountName: String!,\n $billingContact: ContactAttributes!,\n $priceListCode: String!,\n $entityId: ID!\n) {\n quoteAccountSignup(\n priceListCode: $priceListCode,\n accountName: $accountName,\n billingContact: $billingContact,\n entityId: $entityId\n ) {\n account {\n id\n }\n quote {\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 tenant {\n code\n }\n portalSessionToken\n errors\n }\n}"; };
20194
+ var MUTATION$5 = function () { return "\nmutation QuoteAccountSignup (\n $accountName: String!,\n $billingContact: ContactAttributes!,\n $priceListCode: String!,\n) {\n quoteAccountSignup(\n priceListCode: $priceListCode,\n accountName: $accountName,\n billingContact: $billingContact,\n ) {\n account {\n id\n }\n quote {\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 tenant {\n code\n }\n portalSessionToken\n errors\n }\n}"; };
20191
20195
  var quoteAccountSignup = function (_a) {
20192
- var token = _a.token, apiHost = _a.apiHost, priceListCode = _a.priceListCode, accountName = _a.accountName, billingContact = _a.billingContact, entityId = _a.entityId;
20196
+ var token = _a.token, apiHost = _a.apiHost, priceListCode = _a.priceListCode, accountName = _a.accountName, billingContact = _a.billingContact;
20193
20197
  return __awaiter(void 0, void 0, void 0, function () {
20194
20198
  var vars, response, errors;
20195
20199
  var _b;
@@ -20200,7 +20204,6 @@ var quoteAccountSignup = function (_a) {
20200
20204
  priceListCode: priceListCode,
20201
20205
  accountName: accountName,
20202
20206
  billingContact: billingContact,
20203
- entityId: entityId,
20204
20207
  };
20205
20208
  return [4 /*yield*/, gqlRequest({
20206
20209
  query: MUTATION$5(),
@@ -20345,7 +20348,7 @@ function PriceListDisplay(_a) {
20345
20348
 
20346
20349
  var showErrorNotification = useErrorNotification();
20347
20350
  function Signup(_a) {
20348
- var companyName = _a.companyName, priceListCode = _a.priceListCode, returnUrl = _a.returnUrl, couponCode = _a.couponCode, className = _a.className, _b = _a.shadow, shadow = _b === void 0 ? 'shadow-md' : _b, style = _a.style, entityId = _a.entityId;
20351
+ var companyName = _a.companyName, priceListCode = _a.priceListCode, returnUrl = _a.returnUrl, couponCode = _a.couponCode, className = _a.className, _b = _a.shadow, shadow = _b === void 0 ? 'shadow-md' : _b, style = _a.style;
20349
20352
  // Hooks
20350
20353
  var apiHost = useContext(BunnyContext).apiHost;
20351
20354
  var tokenFromContexts = useToken();
@@ -20431,7 +20434,6 @@ function Signup(_a) {
20431
20434
  lastName: formData.lastName,
20432
20435
  email: formData.email,
20433
20436
  },
20434
- entityId: entityId,
20435
20437
  })];
20436
20438
  case 1:
20437
20439
  data_1 = _a.sent();
@@ -20491,7 +20493,6 @@ function Signup(_a) {
20491
20493
  pluginId: plugin === null || plugin === void 0 ? void 0 : plugin.id.toString(),
20492
20494
  priceListCode: priceListCode,
20493
20495
  accountId: accountId,
20494
- entityId: entityId,
20495
20496
  })];
20496
20497
  case 1: return [2 /*return*/, _a.sent()];
20497
20498
  }
@@ -21251,7 +21252,7 @@ var PlanPickerCheckoutBar = function (_a) {
21251
21252
  };
21252
21253
 
21253
21254
  // WARNING: There is a preview button on APP that will need to be changed if this query is changed
21254
- var PRICE_LIST_CHANGE_OPTIONS_QUERY = "\n query priceListChangeOptions($subscriptionId: ID, $productId: ID) {\n priceListChangeOptions(subscriptionId: $subscriptionId, productId: $productId) {\n products {\n everythingInPlus\n id\n name\n plansToDisplay\n features(sort: \"position asc\") {\n description\n id\n isVisible\n kind\n name\n position\n }\n }\n priceLists {\n basePrice\n currencyId\n id\n monthlyBasePrice\n periodMonths\n plan {\n code\n contactUsLabel\n contactUsUrl\n description\n id\n name\n position\n pricingDescription\n pricingStyle\n planFeatures {\n featureId\n value\n feature {\n name\n }\n }\n }\n product {\n id\n }\n charges {\n basePrice\n billingPeriod\n chargeType\n id\n name\n priceDecimals\n pricingModel\n quantityMax\n quantityMin\n selfServiceQuantity\n feature {\n name\n unitName\n }\n }\n }\n }\n }";
21255
+ var PRICE_LIST_CHANGE_OPTIONS_QUERY = "\n query priceListChangeOptions($subscriptionId: ID, $productId: ID) {\n priceListChangeOptions(subscriptionId: $subscriptionId, productId: $productId) {\n products {\n everythingInPlus\n id\n name\n plansToDisplay\n features(sort: \"position asc\") {\n description\n id\n isVisible\n kind\n name\n position\n }\n }\n priceLists {\n showPriceAsMonthly\n basePrice\n currencyId\n id\n monthlyBasePrice\n periodMonths\n plan {\n code\n contactUsLabel\n contactUsUrl\n description\n id\n name\n position\n pricingDescription\n pricingStyle\n planFeatures {\n featureId\n value\n feature {\n name\n }\n }\n }\n product {\n id\n }\n charges {\n basePrice\n billingPeriod\n chargeType\n id\n name\n priceDecimals\n pricingModel\n quantityMax\n quantityMin\n selfServiceQuantity\n feature {\n name\n unitName\n }\n }\n }\n }\n }";
21255
21256
  var getPriceListChangeOptions = function (_a) {
21256
21257
  var apiHost = _a.apiHost, isInPreviewMode = _a.isInPreviewMode, productId = _a.productId, token = _a.token, upgradingSubscription = _a.upgradingSubscription;
21257
21258
  return __awaiter(void 0, void 0, void 0, function () {
@@ -21355,10 +21356,30 @@ var PriceListCardTitle = function (_a) {
21355
21356
  : " " }))), jsx("div", __assign({ className: "bunny-font-medium bunny-text-center ".concat(isMobile ? "bunny-text-slate-500" : "bunny-text-orange-600"), style: { fontSize: "20px" } }, { children: priceList.plan.name }))] })));
21356
21357
  };
21357
21358
 
21359
+ var getPrice = function (priceList) {
21360
+ if (priceList.showPriceAsMonthly) {
21361
+ return priceList.monthlyBasePrice;
21362
+ }
21363
+ return priceList.basePrice;
21364
+ };
21365
+ var calculatePriceDecimals = function (priceList) {
21366
+ if (priceList.plan.pricingStyle === PricingStyle.PRICED) {
21367
+ var decimalPart = getPrice(priceList).toString().split('.')[1];
21368
+ if (!decimalPart)
21369
+ return 0;
21370
+ // If decimal part consists only of zeros, return 0
21371
+ if (parseInt(decimalPart) === 0) {
21372
+ return 0;
21373
+ }
21374
+ return undefined;
21375
+ }
21376
+ return 0;
21377
+ };
21358
21378
  var PriceListCardPrice = function (_a) {
21359
21379
  var priceList = _a.priceList;
21380
+ var priceDecimals = calculatePriceDecimals(priceList);
21360
21381
  return (jsx("div", __assign({ className: "bunny-font-medium bunny-text-center bunny-text-gray-900", style: { fontSize: '32px' } }, { children: !priceList.plan.pricingStyle || priceList.plan.pricingStyle === PricingStyle.PRICED
21361
- ? formatCurrency(priceList.monthlyBasePrice, priceList.currencyId, 0)
21382
+ ? formatCurrency(getPrice(priceList), priceList.currencyId, priceDecimals)
21362
21383
  : priceList.plan.pricingStyle === PricingStyle.CONTACT_US
21363
21384
  ? ''
21364
21385
  : 'Free' })));
@@ -21397,7 +21418,9 @@ var PriceListCardPriceDescription = function (_a) {
21397
21418
  fontSize: isMobile ? '13px' : '12px',
21398
21419
  } }, { children: priceList.plan.pricingDescription && !isEmptyHtml(priceList.plan.pricingDescription) ? (jsx(Markup, { content: priceList.plan.pricingDescription })) : ("per ".concat((feature === null || feature === void 0 ? void 0 : feature.unitName) && !doesPlanHaveFlatFeeCharges
21399
21420
  ? "".concat(feature.unitName.toLowerCase(), " / ")
21400
- : '', "month")) })), priceList.periodMonths > 1 && (jsxs(Text$b, __assign({ className: "bunny-text-center bunny-text-gray-900", style: { fontSize: isMobile ? '12px' : '11px' } }, { children: ["billed ", BillingPeriodConverter$1[periodMonthsConverter(priceList.periodMonths)]] })))] }));
21421
+ : '').concat(priceList.showPriceAsMonthly
21422
+ ? 'month'
21423
+ : PERIOD_LABELS[periodMonthsConverter(priceList.periodMonths)])) })), priceList.periodMonths > 1 && (jsxs(Text$b, __assign({ className: "bunny-text-center bunny-text-gray-900", style: { fontSize: isMobile ? '12px' : '11px' } }, { children: ["billed ", BillingPeriodConverter$1[periodMonthsConverter(priceList.periodMonths)]] })))] }));
21401
21424
  };
21402
21425
 
21403
21426
  var CheckIcon = function (_a) {
@@ -21435,11 +21458,11 @@ var PriceListCardMobile = function (_a) {
21435
21458
  if (!disableOnClick)
21436
21459
  onClick(priceList);
21437
21460
  }, style: {
21438
- minWidth: "220px",
21461
+ minWidth: '220px',
21439
21462
  borderColor: isSelected ? brandColor : SLATE_200,
21440
21463
  } }, { children: [isSelected && (jsx("div", __assign({ className: "bunny-absolute", style: {
21441
- top: "10px",
21442
- right: "10px",
21464
+ top: '10px',
21465
+ right: '10px',
21443
21466
  } }, { children: jsx(CheckIcon, { backgroundColor: brandColor, size: "20px" }) }))), jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-items-center bunny-grow bunny-gap-2" }, { children: [jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-items-center bunny-gap-2" }, { children: [jsx(PriceListCardTitle, { isPriceListCurrentSubscription: isPriceListCurrentSubscription, priceList: priceList, trialRemainingDays: trialRemainingDays }), jsx(PriceListCardDescription, { description: description })] })), jsxs("div", __assign({ className: "bunny-flex bunny-flex-col bunny-items-center bunny-gap-2" }, { children: [jsx(PriceListCardPrice, { priceList: priceList }), jsx(PriceListCardPriceDescription, { feature: feature, priceList: priceList })] })), jsx(PriceListCardButton, { disableOnClick: disableOnClick, isPriceListCurrentSubscription: isPriceListCurrentSubscription, isSelected: isSelected, priceList: priceList, subscriptionPlan: subscriptionPlan })] }))] })));
21444
21467
  };
21445
21468
 
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import '../../styles/index.less';
3
3
  import { ShadowType } from '../../types/shadowType';
4
- export default function Signup({ companyName, priceListCode, returnUrl, couponCode, className, shadow, style, entityId, }: {
4
+ export default function Signup({ companyName, priceListCode, returnUrl, couponCode, className, shadow, style, }: {
5
5
  /** The company name to display on the signup page */
6
6
  companyName: string;
7
7
  /** The price list code to use for the signup */
@@ -16,6 +16,4 @@ export default function Signup({ companyName, priceListCode, returnUrl, couponCo
16
16
  shadow?: ShadowType;
17
17
  /** A custom style to apply to the component */
18
18
  style?: React.CSSProperties;
19
- /** The entity ID to use for the signup */
20
- entityId: string;
21
19
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import { Feature, PriceList, Subscription } from "@bunnyapp/common";
1
+ import { Feature, PriceList, Subscription } from '@bunnyapp/common';
2
2
  declare const PriceListCardMobile: ({ description, disableOnClick, feature, isPriceListCurrentSubscription, isSelected, onClick, priceList, subscriptionPlan, trialRemainingDays, }: {
3
3
  description: string;
4
4
  disableOnClick: boolean;
@@ -1,4 +1,4 @@
1
- declare const accountSignup: ({ token, apiHost, accountId, quoteId, paymentToken, paymentMethodId, pluginId, priceListCode, entityId, }: {
1
+ declare const accountSignup: ({ token, apiHost, accountId, quoteId, paymentToken, paymentMethodId, pluginId, priceListCode, }: {
2
2
  token: string;
3
3
  apiHost: string;
4
4
  accountId: string;
@@ -7,6 +7,5 @@ declare const accountSignup: ({ token, apiHost, accountId, quoteId, paymentToken
7
7
  paymentMethodId?: string | undefined;
8
8
  pluginId: string;
9
9
  priceListCode: string;
10
- entityId: string;
11
10
  }) => Promise<any>;
12
11
  export default accountSignup;
@@ -3,12 +3,11 @@ type BillingContact = {
3
3
  lastName: string;
4
4
  email: string;
5
5
  };
6
- declare const quoteAccountSignup: ({ token, apiHost, priceListCode, accountName, billingContact, entityId, }: {
6
+ declare const quoteAccountSignup: ({ token, apiHost, priceListCode, accountName, billingContact, }: {
7
7
  token?: string | undefined;
8
8
  apiHost: string;
9
9
  priceListCode: string;
10
10
  accountName: string;
11
11
  billingContact: BillingContact;
12
- entityId: string;
13
12
  }) => Promise<any>;
14
13
  export default quoteAccountSignup;
package/dist/index.d.ts CHANGED
@@ -91,7 +91,7 @@ declare const PaymentForm: ({ invoice, onFail, onPaymentSuccess, onPaymentHoldSu
91
91
  } | undefined;
92
92
  }) => react_jsx_runtime.JSX.Element;
93
93
 
94
- declare function Signup({ companyName, priceListCode, returnUrl, couponCode, className, shadow, style, entityId, }: {
94
+ declare function Signup({ companyName, priceListCode, returnUrl, couponCode, className, shadow, style, }: {
95
95
  /** The company name to display on the signup page */
96
96
  companyName: string;
97
97
  /** The price list code to use for the signup */
@@ -106,8 +106,6 @@ declare function Signup({ companyName, priceListCode, returnUrl, couponCode, cla
106
106
  shadow?: ShadowType;
107
107
  /** A custom style to apply to the component */
108
108
  style?: React.CSSProperties;
109
- /** The entity ID to use for the signup */
110
- entityId: string;
111
109
  }): react_jsx_runtime.JSX.Element;
112
110
 
113
111
  declare function BunnyProvider({ children, darkMode, queryClient, apiHost, token, onTokenExpired, configProviderProps, }: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bunnyapp/components",
3
- "version": "1.0.68-beta.6",
3
+ "version": "1.0.68-beta.8",
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",
@@ -64,7 +64,7 @@
64
64
  },
65
65
  "peerDependencies": {
66
66
  "@ant-design/icons": "^5.6.1",
67
- "@bunnyapp/common": "^1.0.66-beta.5",
67
+ "@bunnyapp/common": "^1.0.66-beta.8",
68
68
  "@fortawesome/fontawesome-svg-core": "^6.7.2",
69
69
  "@fortawesome/free-brands-svg-icons": "^6.7.2",
70
70
  "@fortawesome/free-regular-svg-icons": "^6.7.2",