@bunnyapp/components 1.0.76-beta.2 → 1.0.76-beta.4

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
@@ -154,7 +154,7 @@ var BrandContext = react.createContext({
154
154
  });
155
155
 
156
156
  // This will be replaced at build time by rollup-plugin-replace
157
- var PACKAGE_VERSION = '1.0.76-beta.2';
157
+ var PACKAGE_VERSION = '1.0.76-beta.4';
158
158
  var createRequestHeaders = function (token) {
159
159
  var headers = common.createClientDevHeaders(token);
160
160
  // Add the components version header
@@ -389,23 +389,28 @@ var DocumentTemplatePreview = function (_a) {
389
389
  var targetUrl = _a.targetUrl;
390
390
  var _b = react.useState(null), pdfUrl = _b[0], setPdfUrl = _b[1];
391
391
  var queryClient = reactQuery.useQueryClient();
392
+ var _c = react.useContext(BunnyContext), apiHost = _c.apiHost, token = _c.token;
392
393
  var queryKey = react.useMemo(function () { return ['documentTemplatePreview', targetUrl]; }, [targetUrl]);
393
394
  // Clear previous data when component mounts or id changes
394
395
  react.useEffect(function () {
395
396
  // Remove any existing data for this query
396
397
  queryClient.removeQueries({ queryKey: queryKey });
397
398
  }, [queryClient, queryKey]);
398
- var _c = reactQuery.useQuery({
399
+ var _d = reactQuery.useQuery({
399
400
  queryKey: queryKey,
400
401
  queryFn: function () { return __awaiter(void 0, void 0, void 0, function () {
401
402
  var response, blob;
402
403
  return __generator(this, function (_a) {
403
404
  switch (_a.label) {
404
- case 0: return [4 /*yield*/, fetch(targetUrl)];
405
+ case 0: return [4 /*yield*/, common.request({
406
+ endpoint: targetUrl,
407
+ apiHost: apiHost,
408
+ token: token,
409
+ })];
405
410
  case 1:
406
411
  response = _a.sent();
407
412
  if (!response.ok) {
408
- throw new Error('Failed to fetch PDF');
413
+ throw new Error("Failed to fetch PDF");
409
414
  }
410
415
  return [4 /*yield*/, response.blob()];
411
416
  case 2:
@@ -415,7 +420,7 @@ var DocumentTemplatePreview = function (_a) {
415
420
  });
416
421
  }); },
417
422
  enabled: !!targetUrl,
418
- }), data = _c.data, isLoading = _c.isLoading;
423
+ }), data = _d.data, isLoading = _d.isLoading;
419
424
  react.useEffect(function () {
420
425
  if (data) {
421
426
  var url_1 = URL.createObjectURL(data);
@@ -22030,7 +22035,7 @@ function FeatureAddonRow(_a) {
22030
22035
  periodMonths: priceList.periodMonths,
22031
22036
  doesPlanHaveFlatFeeCharges: false,
22032
22037
  }) }))] }));
22033
- return (jsxRuntime.jsxs("div", __assign({ className: "bunny-flex bunny-flex-row bunny-flex-wrap bunny-items-center bunny-justify-between bunny-gap-1" }, { children: [jsxRuntime.jsxs("div", __assign({ className: "bunny-flex bunny-flex-row bunny-items-center bunny-gap-1" }, { children: [jsxRuntime.jsxs("div", __assign({ className: "bunny-flex bunny-gap-1 bunny-text-gray-600", style: { fontSize: '13px' } }, { children: [checked ? (jsxRuntime.jsx(CheckIcon, { backgroundColor: brandColor, size: "15px" })) : (jsxRuntime.jsx(CheckIcon, { backgroundColor: common.SLATE_200, size: "15px" })), featureAddon.name] })), jsxRuntime.jsx(antd.Tooltip, __assign({ title: tooltipContent }, { children: jsxRuntime.jsx(icons.InfoCircleOutlined, { className: "bunny-text-gray-500", size: 15 }) }))] })), jsxRuntime.jsx(antd.Switch, { loading: isPending, disabled: isDisabled || !editingQuoteLoaded, checked: checked, onChange: function (checked) {
22038
+ return (jsxRuntime.jsxs("div", __assign({ className: "bunny-flex bunny-flex-row bunny-flex-wrap bunny-items-center bunny-justify-between bunny-gap-1" }, { children: [jsxRuntime.jsxs("div", __assign({ className: "bunny-flex bunny-flex-row bunny-items-center bunny-gap-1" }, { children: [jsxRuntime.jsxs("div", __assign({ className: "bunny-flex bunny-gap-1 bunny-text-gray-600", style: { fontSize: '13px' } }, { children: [checked ? (jsxRuntime.jsx(CheckIcon, { backgroundColor: brandColor, size: "15px" })) : (jsxRuntime.jsx(CheckIcon, { backgroundColor: common.SLATE_200, size: "15px" })), featureAddon.name] })), jsxRuntime.jsx(antd.Tooltip, __assign({ title: tooltipContent }, { children: jsxRuntime.jsx(icons.InfoCircleOutlined, { className: "bunny-text-gray-500", size: 15 }) }))] })), jsxRuntime.jsx(antd.Switch, { size: "small", loading: isPending, disabled: isDisabled || !editingQuoteLoaded, checked: checked, onChange: function (checked) {
22034
22039
  if (checked) {
22035
22040
  handleAddFeatureAddon();
22036
22041
  }
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, Divider, Select, Image, Radio, Space, Switch, Popconfirm, Table } from 'antd';
5
5
  import { DownloadOutlined, CreditCardOutlined, EllipsisOutlined, BankOutlined, SearchOutlined, CheckCircleFilled, CloseOutlined, ArrowLeftOutlined, InfoCircleOutlined } 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, useInfoNotification, formatDate, TransactionState, SLATE_600, WHITE, TransactionKind, SLATE_500, PRIMARY_COLOR, Lists, sortSubscriptionCharges, getAccount, StringUtils, BillingPeriod, ChargeType, SubscriptionState as SubscriptionState$2, PERIOD_LABELS, PricingStyle, PricingModel, SLATE_100, 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, request as request$1, useErrorNotification, invokePlugin, useAllErrorFormats, formatCurrency, GRAY_500, GRAY_200, useSuccessNotification, getFormattedInvoice, PAYABLE_INVOICE_STATES, BreakpointNumbers, useGraphQLmutation, useInfoNotification, formatDate, TransactionState, SLATE_600, WHITE, TransactionKind, SLATE_500, PRIMARY_COLOR, Lists, sortSubscriptionCharges, 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';
@@ -143,7 +143,7 @@ var BrandContext = createContext({
143
143
  });
144
144
 
145
145
  // This will be replaced at build time by rollup-plugin-replace
146
- var PACKAGE_VERSION = '1.0.76-beta.2';
146
+ var PACKAGE_VERSION = '1.0.76-beta.4';
147
147
  var createRequestHeaders = function (token) {
148
148
  var headers = createClientDevHeaders(token);
149
149
  // Add the components version header
@@ -378,23 +378,28 @@ var DocumentTemplatePreview = function (_a) {
378
378
  var targetUrl = _a.targetUrl;
379
379
  var _b = useState(null), pdfUrl = _b[0], setPdfUrl = _b[1];
380
380
  var queryClient = useQueryClient();
381
+ var _c = useContext(BunnyContext), apiHost = _c.apiHost, token = _c.token;
381
382
  var queryKey = useMemo(function () { return ['documentTemplatePreview', targetUrl]; }, [targetUrl]);
382
383
  // Clear previous data when component mounts or id changes
383
384
  useEffect(function () {
384
385
  // Remove any existing data for this query
385
386
  queryClient.removeQueries({ queryKey: queryKey });
386
387
  }, [queryClient, queryKey]);
387
- var _c = useQuery({
388
+ var _d = useQuery({
388
389
  queryKey: queryKey,
389
390
  queryFn: function () { return __awaiter(void 0, void 0, void 0, function () {
390
391
  var response, blob;
391
392
  return __generator(this, function (_a) {
392
393
  switch (_a.label) {
393
- case 0: return [4 /*yield*/, fetch(targetUrl)];
394
+ case 0: return [4 /*yield*/, request$1({
395
+ endpoint: targetUrl,
396
+ apiHost: apiHost,
397
+ token: token,
398
+ })];
394
399
  case 1:
395
400
  response = _a.sent();
396
401
  if (!response.ok) {
397
- throw new Error('Failed to fetch PDF');
402
+ throw new Error("Failed to fetch PDF");
398
403
  }
399
404
  return [4 /*yield*/, response.blob()];
400
405
  case 2:
@@ -404,7 +409,7 @@ var DocumentTemplatePreview = function (_a) {
404
409
  });
405
410
  }); },
406
411
  enabled: !!targetUrl,
407
- }), data = _c.data, isLoading = _c.isLoading;
412
+ }), data = _d.data, isLoading = _d.isLoading;
408
413
  useEffect(function () {
409
414
  if (data) {
410
415
  var url_1 = URL.createObjectURL(data);
@@ -22019,7 +22024,7 @@ function FeatureAddonRow(_a) {
22019
22024
  periodMonths: priceList.periodMonths,
22020
22025
  doesPlanHaveFlatFeeCharges: false,
22021
22026
  }) }))] }));
22022
- return (jsxs("div", __assign({ className: "bunny-flex bunny-flex-row bunny-flex-wrap bunny-items-center bunny-justify-between bunny-gap-1" }, { children: [jsxs("div", __assign({ className: "bunny-flex bunny-flex-row bunny-items-center bunny-gap-1" }, { children: [jsxs("div", __assign({ className: "bunny-flex bunny-gap-1 bunny-text-gray-600", style: { fontSize: '13px' } }, { children: [checked ? (jsx(CheckIcon, { backgroundColor: brandColor, size: "15px" })) : (jsx(CheckIcon, { backgroundColor: SLATE_200, size: "15px" })), featureAddon.name] })), jsx(Tooltip, __assign({ title: tooltipContent }, { children: jsx(InfoCircleOutlined, { className: "bunny-text-gray-500", size: 15 }) }))] })), jsx(Switch, { loading: isPending, disabled: isDisabled || !editingQuoteLoaded, checked: checked, onChange: function (checked) {
22027
+ return (jsxs("div", __assign({ className: "bunny-flex bunny-flex-row bunny-flex-wrap bunny-items-center bunny-justify-between bunny-gap-1" }, { children: [jsxs("div", __assign({ className: "bunny-flex bunny-flex-row bunny-items-center bunny-gap-1" }, { children: [jsxs("div", __assign({ className: "bunny-flex bunny-gap-1 bunny-text-gray-600", style: { fontSize: '13px' } }, { children: [checked ? (jsx(CheckIcon, { backgroundColor: brandColor, size: "15px" })) : (jsx(CheckIcon, { backgroundColor: SLATE_200, size: "15px" })), featureAddon.name] })), jsx(Tooltip, __assign({ title: tooltipContent }, { children: jsx(InfoCircleOutlined, { className: "bunny-text-gray-500", size: 15 }) }))] })), jsx(Switch, { size: "small", loading: isPending, disabled: isDisabled || !editingQuoteLoaded, checked: checked, onChange: function (checked) {
22023
22028
  if (checked) {
22024
22029
  handleAddFeatureAddon();
22025
22030
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bunnyapp/components",
3
- "version": "1.0.76-beta.2",
3
+ "version": "1.0.76-beta.4",
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",