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

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
@@ -25,24 +25,6 @@ var pkg = require('pluralize');
25
25
 
26
26
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
27
27
 
28
- function _interopNamespace(e) {
29
- if (e && e.__esModule) return e;
30
- var n = Object.create(null);
31
- if (e) {
32
- Object.keys(e).forEach(function (k) {
33
- if (k !== 'default') {
34
- var d = Object.getOwnPropertyDescriptor(e, k);
35
- Object.defineProperty(n, k, d.get ? d : {
36
- enumerable: true,
37
- get: function () { return e[k]; }
38
- });
39
- }
40
- });
41
- }
42
- n["default"] = e;
43
- return Object.freeze(n);
44
- }
45
-
46
28
  var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
47
29
  var theme__default = /*#__PURE__*/_interopDefaultLegacy(theme);
48
30
  var request__default = /*#__PURE__*/_interopDefaultLegacy(request);
@@ -174,7 +156,7 @@ var BrandContext = react.createContext({
174
156
  });
175
157
 
176
158
  // This will be replaced at build time by rollup-plugin-replace
177
- var PACKAGE_VERSION = '1.0.68-beta.5';
159
+ var PACKAGE_VERSION = '1.0.68-beta.6';
178
160
  var createRequestHeaders = function (token) {
179
161
  var headers = common.createClientDevHeaders(token);
180
162
  // Add the components version header
@@ -19226,7 +19208,7 @@ function ActualInvoice() {
19226
19208
  // Context
19227
19209
  var queryClient = reactQuery.useQueryClient();
19228
19210
  var _a = react.useContext(InvoiceQuoteContext), id = _a.id, invoiceQuoteViewComponent = _a.invoiceQuoteViewComponent, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick, onPaymentSuccess = _a.onPaymentSuccess, className = _a.className;
19229
- var _b = react.useContext(BunnyContext), apiHost = _b.apiHost, onTokenExpired = _b.onTokenExpired; _b.graphQLClient;
19211
+ var _b = react.useContext(BunnyContext), apiHost = _b.apiHost, onTokenExpired = _b.onTokenExpired;
19230
19212
  var _c = react.useContext(InvoiceQuoteContext), hideDownloadButton = _c.hideDownloadButton, onInvoiceLoaded = _c.onInvoiceLoaded;
19231
19213
  var token = useToken();
19232
19214
  var entityId = useCurrentUserData().entityId;
@@ -19386,72 +19368,48 @@ var quoteAccept = function (_a) {
19386
19368
  };
19387
19369
  // export default quoteAccept;
19388
19370
  var useSendAcceptQuote = function (_a) {
19389
- _a.onTokenExpired; var quoteId = _a.quoteId, apiHost = _a.apiHost, token = _a.token;
19371
+ var quoteId = _a.quoteId, apiHost = _a.apiHost, token = _a.token;
19390
19372
  // Hooks
19391
19373
  var graphQLMutation = common.useGraphQLmutation(function () {
19392
- console.log("navigate in useGraphQLmutation in useSendAcceptQuote is not yet implemented");
19393
- }, apiHost || "", function () {
19394
- console.log("onError in useGraphQLmutation in useSendAcceptQuote is not yet implemented");
19374
+ console.log('navigate in useGraphQLmutation in useSendAcceptQuote is not yet implemented');
19375
+ }, apiHost || '', function () {
19376
+ console.log('onError in useGraphQLmutation in useSendAcceptQuote is not yet implemented');
19395
19377
  });
19396
19378
  var signingPlugins = useSigningPlugins({ apiHost: apiHost, token: token });
19397
19379
  var queryClient = reactQuery.useQueryClient();
19380
+ var showInfoNotification = common.useInfoNotification();
19398
19381
  // Local state
19399
19382
  var _b = react.useState(false), acceptBoxVisible = _b[0], setAcceptBoxVisible = _b[1];
19400
19383
  var _c = react.useState(false), isAccepting = _c[0], setIsAccepting = _c[1];
19401
19384
  // Pandadoc polling modal state
19402
19385
  var _d = react.useState(false), pandadocPollingModalVisible = _d[0], setPandadocPollingModalVisible = _d[1];
19403
19386
  var redirectForSigning = function () {
19404
- var mutation = "mutation quoteSigningUrlCreate($quoteId: ID) {\n quoteSigningUrlCreate(quoteId: $quoteId) {\n redirectUri\n pluginClientId\n pluginShortName\n errors\n }\n }";
19387
+ var mutation = "mutation quoteSigningUrlCreate($quoteId: ID) {\n quoteSigningUrlCreate(quoteId: $quoteId) {\n redirectUri\n pluginClientId\n pluginShortName\n message\n errors\n }\n }";
19405
19388
  var variables = {
19406
19389
  quoteId: quoteId,
19407
19390
  };
19408
19391
  graphQLMutation(mutation, variables, function (rsp) {
19409
19392
  if (rsp.errors)
19410
- console.log("rsp.errors", rsp.errors);
19393
+ console.log('rsp.errors', rsp.errors);
19411
19394
  else {
19412
- if (rsp.data.quoteSigningUrlCreate.pluginShortName === "dropbox_sign") {
19413
- openDropboxSignModal(rsp.data.quoteSigningUrlCreate.pluginClientId, rsp.data.quoteSigningUrlCreate.redirectUri);
19414
- }
19415
- else if (rsp.data.quoteSigningUrlCreate.pluginShortName === "pandadoc") {
19416
- setPandadocPollingModalVisible(true);
19395
+ var _a = rsp.data.quoteSigningUrlCreate, redirectUri = _a.redirectUri, message = _a.message, pluginShortName = _a.pluginShortName;
19396
+ if (redirectUri) {
19397
+ // If redirectUri exists, redirect the browser
19398
+ if (pluginShortName === 'pandadoc') {
19399
+ setPandadocPollingModalVisible(true);
19400
+ }
19401
+ else {
19402
+ window.location.href = redirectUri;
19403
+ }
19417
19404
  }
19418
- else {
19419
- window.location.href = rsp.data.quoteSigningUrlCreate.redirectUri;
19405
+ else if (message) {
19406
+ // If redirectUri is nil but message exists, display the message as notification
19407
+ showInfoNotification(message, 'Signing Information');
19408
+ setIsAccepting(false);
19420
19409
  }
19421
19410
  }
19422
19411
  }, token);
19423
19412
  };
19424
- var openDropboxSignModal = function (clientId, url) { return __awaiter(void 0, void 0, void 0, function () {
19425
- var HelloSign, client;
19426
- return __generator(this, function (_a) {
19427
- switch (_a.label) {
19428
- case 0:
19429
- if (typeof window === "undefined") {
19430
- return [2 /*return*/];
19431
- }
19432
- return [4 /*yield*/, Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('hellosign-embedded')); })];
19433
- case 1:
19434
- HelloSign = (_a.sent()).default;
19435
- client = new HelloSign({
19436
- clientId: clientId,
19437
- });
19438
- client.on("sign", function (data) {
19439
- queryClient.refetchQueries({
19440
- queryKey: common.QueryKeyFactory.default.createQuoteKey({
19441
- id: quoteId,
19442
- token: token,
19443
- }),
19444
- });
19445
- });
19446
- // Open the DropboxSign modal
19447
- client.open(url, {
19448
- clientId: clientId,
19449
- skipDomainVerification: false, // Set true for development testing
19450
- });
19451
- return [2 /*return*/];
19452
- }
19453
- });
19454
- }); };
19455
19413
  var _e = reactQuery.useMutation({
19456
19414
  mutationFn: function (changedFormItems) { return __awaiter(void 0, void 0, void 0, function () {
19457
19415
  return __generator(this, function (_a) {
@@ -19585,7 +19543,7 @@ var AcceptQuoteModal = function (_a) {
19585
19543
  var createRules = function (required, title) {
19586
19544
  return required ? [{ required: true, message: "".concat(title, " is required") }] : [];
19587
19545
  };
19588
- return (jsxRuntime.jsx(StyledModal$1, __assign({ centered: true, okText: isSendAcceptPending ? "Accepting..." : "Accept", okButtonProps: {
19546
+ return (jsxRuntime.jsx(StyledModal$1, __assign({ centered: true, okText: isSendAcceptPending ? 'Accepting...' : 'Accept', okButtonProps: {
19589
19547
  loading: isSendAcceptPending,
19590
19548
  disabled: isSendAcceptPending,
19591
19549
  }, onCancel: function () {
@@ -19598,7 +19556,7 @@ var AcceptQuoteModal = function (_a) {
19598
19556
  sendAccept(changedFields);
19599
19557
  })
19600
19558
  .catch(function () { });
19601
- }, open: acceptBoxVisible, title: "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, {}) })))] })) })));
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, {}) })))] })) })));
19602
19560
  };
19603
19561
 
19604
19562
  var Title$2 = antd.Typography.Title;
@@ -19741,7 +19699,7 @@ function QuoteButtons(_a) {
19741
19699
  var isExpired = useIsExpired(formattedQuote === null || formattedQuote === void 0 ? void 0 : formattedQuote.expiresAt);
19742
19700
  return (jsxRuntime.jsxs("div", __assign({ className: "flex flex-row justify-end items-center gap-4", id: "acceptance", style: {
19743
19701
  color: entityBranding.secondaryColor,
19744
- } }, { 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' : 'Accept quote' }))) : null }))] })))] })));
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 }))] })))] })));
19745
19703
  }
19746
19704
  function PaymentHoldDisplay(_a) {
19747
19705
  var _b, _c, _d, _e;
@@ -1,4 +1,4 @@
1
- import { FormattedQuote } from "@bunnyapp/common";
1
+ import { FormattedQuote } from '@bunnyapp/common';
2
2
  declare const AcceptQuoteModal: ({ acceptBoxVisible, formattedQuote, sendAccept, setAcceptBoxVisible, setIsAccepting, isSendAcceptPending, }: {
3
3
  acceptBoxVisible: boolean;
4
4
  formattedQuote: FormattedQuote;
@@ -1,6 +1,5 @@
1
1
  /// <reference types="react" />
2
- declare const useSendAcceptQuote: ({ onTokenExpired, quoteId, apiHost, token, }: {
3
- onTokenExpired?: (() => void) | undefined;
2
+ declare const useSendAcceptQuote: ({ quoteId, apiHost, token, }: {
4
3
  quoteId?: string | undefined;
5
4
  apiHost: string;
6
5
  token?: string | undefined;
package/dist/esm/index.js CHANGED
@@ -4,7 +4,7 @@ import { Markup } from 'interweave';
4
4
  import { ConfigProvider, Spin, Button, Tag, Typography, Dropdown, Input, Checkbox, Skeleton, Collapse, Modal, Form, Tooltip, Drawer, Card as Card$1, Image, Divider, Select, Radio, Space, Popconfirm, Table } from 'antd';
5
5
  import { DownloadOutlined, CreditCardOutlined, EllipsisOutlined, BankOutlined, SearchOutlined, CheckCircleFilled, CloseOutlined, ArrowLeftOutlined } from '@ant-design/icons';
6
6
  import styled from 'styled-components';
7
- import { DEFAULT_ACCENT_COLOR, DEFAULT_BRAND_COLOR, DEFAULT_SECONDARY_COLOR, DEFAULT_TOP_NAV_IMAGE_URL, gqlRequest as gqlRequest$1, createClientDevHeaders, X_BUNNY_COMPONENTS_VERSION_HEADER_NAME, QueryKeyFactory, useIsMobile, isColorTooDark, INPUT_BORDER_COLOR, SLATE_50, SLATE_400, SLATE_200, useErrorNotification, invokePlugin, useAllErrorFormats, formatCurrency, GRAY_500, GRAY_200, useSuccessNotification, getFormattedInvoice, PAYABLE_INVOICE_STATES, BreakpointNumbers, request as request$1, useGraphQLmutation, formatDate, FrontendTransaction, SLATE_600, WHITE, TransactionKind, SLATE_500, PRIMARY_COLOR as PRIMARY_COLOR$1, sortSubscriptionCharges, Lists, getAccount, StringUtils, BillingPeriod, ChargeType, SubscriptionState as SubscriptionState$2, PERIOD_LABELS, PricingStyle, PricingModel, SLATE_100, useInfoNotification, MODAL_MAX_HEIGHT, DataInterval, QuoteChangeKind, TAG_COLORS } from '@bunnyapp/common';
7
+ import { DEFAULT_ACCENT_COLOR, DEFAULT_BRAND_COLOR, DEFAULT_SECONDARY_COLOR, DEFAULT_TOP_NAV_IMAGE_URL, gqlRequest as gqlRequest$1, createClientDevHeaders, X_BUNNY_COMPONENTS_VERSION_HEADER_NAME, QueryKeyFactory, useIsMobile, isColorTooDark, INPUT_BORDER_COLOR, SLATE_50, SLATE_400, SLATE_200, useErrorNotification, invokePlugin, useAllErrorFormats, formatCurrency, GRAY_500, GRAY_200, useSuccessNotification, getFormattedInvoice, PAYABLE_INVOICE_STATES, BreakpointNumbers, request as request$1, useGraphQLmutation, useInfoNotification, formatDate, FrontendTransaction, SLATE_600, WHITE, TransactionKind, SLATE_500, PRIMARY_COLOR as PRIMARY_COLOR$1, sortSubscriptionCharges, Lists, getAccount, StringUtils, BillingPeriod, ChargeType, SubscriptionState as SubscriptionState$2, PERIOD_LABELS, PricingStyle, PricingModel, SLATE_100, MODAL_MAX_HEIGHT, DataInterval, QuoteChangeKind, TAG_COLORS } from '@bunnyapp/common';
8
8
  import { QueryClient, QueryClientProvider, useQuery, useQueryClient, useMutation, keepPreviousData } from '@tanstack/react-query';
9
9
  import theme from 'antd/lib/theme/index.js';
10
10
  import { RecoilRoot } from 'recoil';
@@ -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.5';
147
+ var PACKAGE_VERSION = '1.0.68-beta.6';
148
148
  var createRequestHeaders = function (token) {
149
149
  var headers = createClientDevHeaders(token);
150
150
  // Add the components version header
@@ -19196,7 +19196,7 @@ function ActualInvoice() {
19196
19196
  // Context
19197
19197
  var queryClient = useQueryClient();
19198
19198
  var _a = useContext(InvoiceQuoteContext), id = _a.id, invoiceQuoteViewComponent = _a.invoiceQuoteViewComponent, backButtonName = _a.backButtonName, onBackButtonClick = _a.onBackButtonClick, onPaymentSuccess = _a.onPaymentSuccess, className = _a.className;
19199
- var _b = useContext(BunnyContext), apiHost = _b.apiHost, onTokenExpired = _b.onTokenExpired; _b.graphQLClient;
19199
+ var _b = useContext(BunnyContext), apiHost = _b.apiHost, onTokenExpired = _b.onTokenExpired;
19200
19200
  var _c = useContext(InvoiceQuoteContext), hideDownloadButton = _c.hideDownloadButton, onInvoiceLoaded = _c.onInvoiceLoaded;
19201
19201
  var token = useToken();
19202
19202
  var entityId = useCurrentUserData().entityId;
@@ -19356,72 +19356,48 @@ var quoteAccept = function (_a) {
19356
19356
  };
19357
19357
  // export default quoteAccept;
19358
19358
  var useSendAcceptQuote = function (_a) {
19359
- _a.onTokenExpired; var quoteId = _a.quoteId, apiHost = _a.apiHost, token = _a.token;
19359
+ var quoteId = _a.quoteId, apiHost = _a.apiHost, token = _a.token;
19360
19360
  // Hooks
19361
19361
  var graphQLMutation = useGraphQLmutation(function () {
19362
- console.log("navigate in useGraphQLmutation in useSendAcceptQuote is not yet implemented");
19363
- }, apiHost || "", function () {
19364
- console.log("onError in useGraphQLmutation in useSendAcceptQuote is not yet implemented");
19362
+ console.log('navigate in useGraphQLmutation in useSendAcceptQuote is not yet implemented');
19363
+ }, apiHost || '', function () {
19364
+ console.log('onError in useGraphQLmutation in useSendAcceptQuote is not yet implemented');
19365
19365
  });
19366
19366
  var signingPlugins = useSigningPlugins({ apiHost: apiHost, token: token });
19367
19367
  var queryClient = useQueryClient();
19368
+ var showInfoNotification = useInfoNotification();
19368
19369
  // Local state
19369
19370
  var _b = useState(false), acceptBoxVisible = _b[0], setAcceptBoxVisible = _b[1];
19370
19371
  var _c = useState(false), isAccepting = _c[0], setIsAccepting = _c[1];
19371
19372
  // Pandadoc polling modal state
19372
19373
  var _d = useState(false), pandadocPollingModalVisible = _d[0], setPandadocPollingModalVisible = _d[1];
19373
19374
  var redirectForSigning = function () {
19374
- var mutation = "mutation quoteSigningUrlCreate($quoteId: ID) {\n quoteSigningUrlCreate(quoteId: $quoteId) {\n redirectUri\n pluginClientId\n pluginShortName\n errors\n }\n }";
19375
+ var mutation = "mutation quoteSigningUrlCreate($quoteId: ID) {\n quoteSigningUrlCreate(quoteId: $quoteId) {\n redirectUri\n pluginClientId\n pluginShortName\n message\n errors\n }\n }";
19375
19376
  var variables = {
19376
19377
  quoteId: quoteId,
19377
19378
  };
19378
19379
  graphQLMutation(mutation, variables, function (rsp) {
19379
19380
  if (rsp.errors)
19380
- console.log("rsp.errors", rsp.errors);
19381
+ console.log('rsp.errors', rsp.errors);
19381
19382
  else {
19382
- if (rsp.data.quoteSigningUrlCreate.pluginShortName === "dropbox_sign") {
19383
- openDropboxSignModal(rsp.data.quoteSigningUrlCreate.pluginClientId, rsp.data.quoteSigningUrlCreate.redirectUri);
19384
- }
19385
- else if (rsp.data.quoteSigningUrlCreate.pluginShortName === "pandadoc") {
19386
- setPandadocPollingModalVisible(true);
19383
+ var _a = rsp.data.quoteSigningUrlCreate, redirectUri = _a.redirectUri, message = _a.message, pluginShortName = _a.pluginShortName;
19384
+ if (redirectUri) {
19385
+ // If redirectUri exists, redirect the browser
19386
+ if (pluginShortName === 'pandadoc') {
19387
+ setPandadocPollingModalVisible(true);
19388
+ }
19389
+ else {
19390
+ window.location.href = redirectUri;
19391
+ }
19387
19392
  }
19388
- else {
19389
- window.location.href = rsp.data.quoteSigningUrlCreate.redirectUri;
19393
+ else if (message) {
19394
+ // If redirectUri is nil but message exists, display the message as notification
19395
+ showInfoNotification(message, 'Signing Information');
19396
+ setIsAccepting(false);
19390
19397
  }
19391
19398
  }
19392
19399
  }, token);
19393
19400
  };
19394
- var openDropboxSignModal = function (clientId, url) { return __awaiter(void 0, void 0, void 0, function () {
19395
- var HelloSign, client;
19396
- return __generator(this, function (_a) {
19397
- switch (_a.label) {
19398
- case 0:
19399
- if (typeof window === "undefined") {
19400
- return [2 /*return*/];
19401
- }
19402
- return [4 /*yield*/, import('hellosign-embedded')];
19403
- case 1:
19404
- HelloSign = (_a.sent()).default;
19405
- client = new HelloSign({
19406
- clientId: clientId,
19407
- });
19408
- client.on("sign", function (data) {
19409
- queryClient.refetchQueries({
19410
- queryKey: QueryKeyFactory.default.createQuoteKey({
19411
- id: quoteId,
19412
- token: token,
19413
- }),
19414
- });
19415
- });
19416
- // Open the DropboxSign modal
19417
- client.open(url, {
19418
- clientId: clientId,
19419
- skipDomainVerification: false, // Set true for development testing
19420
- });
19421
- return [2 /*return*/];
19422
- }
19423
- });
19424
- }); };
19425
19401
  var _e = useMutation({
19426
19402
  mutationFn: function (changedFormItems) { return __awaiter(void 0, void 0, void 0, function () {
19427
19403
  return __generator(this, function (_a) {
@@ -19555,7 +19531,7 @@ var AcceptQuoteModal = function (_a) {
19555
19531
  var createRules = function (required, title) {
19556
19532
  return required ? [{ required: true, message: "".concat(title, " is required") }] : [];
19557
19533
  };
19558
- return (jsx(StyledModal$1, __assign({ centered: true, okText: isSendAcceptPending ? "Accepting..." : "Accept", okButtonProps: {
19534
+ return (jsx(StyledModal$1, __assign({ centered: true, okText: isSendAcceptPending ? 'Accepting...' : 'Accept', okButtonProps: {
19559
19535
  loading: isSendAcceptPending,
19560
19536
  disabled: isSendAcceptPending,
19561
19537
  }, onCancel: function () {
@@ -19568,7 +19544,7 @@ var AcceptQuoteModal = function (_a) {
19568
19544
  sendAccept(changedFields);
19569
19545
  })
19570
19546
  .catch(function () { });
19571
- }, open: acceptBoxVisible, title: "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, {}) })))] })) })));
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, {}) })))] })) })));
19572
19548
  };
19573
19549
 
19574
19550
  var Title$2 = Typography.Title;
@@ -19711,7 +19687,7 @@ function QuoteButtons(_a) {
19711
19687
  var isExpired = useIsExpired(formattedQuote === null || formattedQuote === void 0 ? void 0 : formattedQuote.expiresAt);
19712
19688
  return (jsxs("div", __assign({ className: "flex flex-row justify-end items-center gap-4", id: "acceptance", style: {
19713
19689
  color: entityBranding.secondaryColor,
19714
- } }, { 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' : 'Accept quote' }))) : null }))] })))] })));
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 }))] })))] })));
19715
19691
  }
19716
19692
  function PaymentHoldDisplay(_a) {
19717
19693
  var _b, _c, _d, _e;
@@ -1,4 +1,4 @@
1
- import { FormattedQuote } from "@bunnyapp/common";
1
+ import { FormattedQuote } from '@bunnyapp/common';
2
2
  declare const AcceptQuoteModal: ({ acceptBoxVisible, formattedQuote, sendAccept, setAcceptBoxVisible, setIsAccepting, isSendAcceptPending, }: {
3
3
  acceptBoxVisible: boolean;
4
4
  formattedQuote: FormattedQuote;
@@ -1,6 +1,5 @@
1
1
  /// <reference types="react" />
2
- declare const useSendAcceptQuote: ({ onTokenExpired, quoteId, apiHost, token, }: {
3
- onTokenExpired?: (() => void) | undefined;
2
+ declare const useSendAcceptQuote: ({ quoteId, apiHost, token, }: {
4
3
  quoteId?: string | undefined;
5
4
  apiHost: string;
6
5
  token?: string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bunnyapp/components",
3
- "version": "1.0.68-beta.5",
3
+ "version": "1.0.68-beta.6",
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",
@@ -37,7 +37,6 @@
37
37
  "@storybook/test": "^8.4.7",
38
38
  "@tanstack/eslint-plugin-query": "^5.60.1",
39
39
  "@tanstack/react-query-devtools": "^5.65.1",
40
- "@types/hellosign-embedded": "^2.0.6",
41
40
  "@types/lodash": "^4.17.13",
42
41
  "@types/lodash-es": "^4.17.12",
43
42
  "@types/pluralize": "^0.0.33",
@@ -76,7 +75,6 @@
76
75
  "@tanstack/react-query": "^5.59.20",
77
76
  "antd": "^5.23.2",
78
77
  "graphql-request": "^6.1.0",
79
- "hellosign-embedded": "^2.12.2",
80
78
  "interweave": "^13.1.0",
81
79
  "less": "^4.2.0",
82
80
  "lodash-es": "^4.17.21",