@bunnyapp/components 1.8.0-beta.2 → 1.8.0-beta.3

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
@@ -1283,7 +1283,7 @@ const DEFAULT_CONFIG = {
1283
1283
  };
1284
1284
 
1285
1285
  // This will be replaced at build time by rollup-plugin-replace
1286
- const PACKAGE_VERSION = '1.8.0-beta.1';
1286
+ const PACKAGE_VERSION = '1.8.0-beta.2';
1287
1287
  const createRequestHeaders = (token) => {
1288
1288
  const headers = createClientDevHeaders({ token });
1289
1289
  // Add the components version header
@@ -1310,7 +1310,12 @@ const gqlRequest = async ({ query, apiHost, token, vars, isInPreviewMode, }) =>
1310
1310
  const requestHeaders = {
1311
1311
  ...baseHeaders,
1312
1312
  };
1313
- return await request$1(`${apiHost}${graphqlEndpoint}`, query, vars, requestHeaders);
1313
+ try {
1314
+ return await request$1(`${apiHost}${graphqlEndpoint}`, query, vars, requestHeaders);
1315
+ }
1316
+ catch (error) {
1317
+ throw error;
1318
+ }
1314
1319
  };
1315
1320
  const createClientDevHeaders = ({ token, componentsVersion, additionalHeaders, }) => {
1316
1321
  const headers = {
@@ -1543,8 +1548,12 @@ const useAllErrorFormats = ({ onUserUnavailable, onInvalidOrMissingAuthorization
1543
1548
  };
1544
1549
 
1545
1550
  const useCreateQueryClient = () => {
1546
- const { onUserUnavailable, onInvalidOrMissingAuthorization, suppressUserUnavailableErrorNotification } = useBunnyProviderCallbacks();
1547
- const handleAllErrorFormats = useAllErrorFormats({ onUserUnavailable, onInvalidOrMissingAuthorization, suppressUserUnavailableErrorNotification });
1551
+ const { onUserUnavailable, onInvalidOrMissingAuthorization, suppressUserUnavailableErrorNotification, } = useBunnyProviderCallbacks();
1552
+ const handleAllErrorFormats = useAllErrorFormats({
1553
+ onUserUnavailable,
1554
+ onInvalidOrMissingAuthorization,
1555
+ suppressUserUnavailableErrorNotification,
1556
+ });
1548
1557
  const onError = (error, _query) => {
1549
1558
  // Extract mutation name from query string
1550
1559
  // const mutationName = query?.mutation?.match(/mutation\s+(\w+)/)?.[1];
@@ -1554,9 +1563,6 @@ const useCreateQueryClient = () => {
1554
1563
  };
1555
1564
  return () => new reactQuery.QueryClient({
1556
1565
  defaultOptions: {
1557
- mutations: {
1558
- onError,
1559
- },
1560
1566
  queries: {
1561
1567
  gcTime: Number.POSITIVE_INFINITY,
1562
1568
  refetchIntervalInBackground: false,
@@ -1565,6 +1571,9 @@ const useCreateQueryClient = () => {
1565
1571
  refetchOnWindowFocus: false,
1566
1572
  },
1567
1573
  },
1574
+ mutationCache: new reactQuery.MutationCache({
1575
+ onError,
1576
+ }),
1568
1577
  queryCache: new reactQuery.QueryCache({
1569
1578
  onError,
1570
1579
  }),
@@ -24436,12 +24445,9 @@ const mutation$c = t(`
24436
24445
  }
24437
24446
  `, [QuoteContext_QuoteFragment]);
24438
24447
  const quoteChargeUpdate$1 = async (quoteChargeId, quantity, apiHost, token) => {
24439
- var _a, _b;
24448
+ var _a;
24440
24449
  const response = await execute(mutation$c, { apiHost, token }, { quoteChargeId, quantity });
24441
- if ((_a = response.quoteChargeUpdate) === null || _a === void 0 ? void 0 : _a.errors) {
24442
- throw new Error(response.quoteChargeUpdate.errors[0]);
24443
- }
24444
- return (_b = response.quoteChargeUpdate) === null || _b === void 0 ? void 0 : _b.quoteCharge;
24450
+ return (_a = response.quoteChargeUpdate) === null || _a === void 0 ? void 0 : _a.quoteCharge;
24445
24451
  };
24446
24452
 
24447
24453
  /**
@@ -24484,12 +24490,9 @@ const mutation$b = t(`
24484
24490
  }
24485
24491
  `, [QuoteContext_QuoteFragment]);
24486
24492
  const quoteChargeDelete = async ({ quoteChargeId, token, apiHost }) => {
24487
- var _a, _b, _c, _d;
24493
+ var _a;
24488
24494
  const response = await execute(mutation$b, { apiHost, token }, { quoteChargeId });
24489
- if ((_a = response.quoteChargeDelete) === null || _a === void 0 ? void 0 : _a.errors) {
24490
- throw new Error((_c = (_b = response.quoteChargeDelete) === null || _b === void 0 ? void 0 : _b.errors) === null || _c === void 0 ? void 0 : _c[0]);
24491
- }
24492
- return (_d = response.quoteChargeDelete) === null || _d === void 0 ? void 0 : _d.quoteCharge;
24495
+ return (_a = response.quoteChargeDelete) === null || _a === void 0 ? void 0 : _a.quoteCharge;
24493
24496
  };
24494
24497
 
24495
24498
  const showErrorNotification$1 = useErrorNotification();
@@ -28222,12 +28225,9 @@ const mutation$6 = t(`
28222
28225
  }
28223
28226
  `, [QuantityDrawer_QuoteFragment]);
28224
28227
  const quoteChargeUpdate = async (quoteChargeId, quantity, apiHost, token) => {
28225
- var _a, _b;
28228
+ var _a;
28226
28229
  const response = await execute(mutation$6, { apiHost, token }, { quoteChargeId, quantity });
28227
- if ((_a = response.quoteChargeUpdate) === null || _a === void 0 ? void 0 : _a.errors) {
28228
- throw new Error(response.quoteChargeUpdate.errors[0]);
28229
- }
28230
- return (_b = response.quoteChargeUpdate) === null || _b === void 0 ? void 0 : _b.quoteCharge;
28230
+ return (_a = response.quoteChargeUpdate) === null || _a === void 0 ? void 0 : _a.quoteCharge;
28231
28231
  };
28232
28232
 
28233
28233
  const mutation$5 = t(`
@@ -28273,12 +28273,9 @@ const mutation$4 = t(`
28273
28273
  }
28274
28274
  `, [QuantityDrawer_QuoteFragment]);
28275
28275
  const quoteSubscriptionUpdate = async (subscriptionIds, apiHost, token) => {
28276
- var _a, _b;
28276
+ var _a;
28277
28277
  const response = await execute(mutation$4, { apiHost, token }, { subscriptionIds });
28278
- if ((_a = response.quoteSubscriptionUpdate) === null || _a === void 0 ? void 0 : _a.errors) {
28279
- throw new Error(response.quoteSubscriptionUpdate.errors[0]);
28280
- }
28281
- return (_b = response.quoteSubscriptionUpdate) === null || _b === void 0 ? void 0 : _b.quote;
28278
+ return (_a = response.quoteSubscriptionUpdate) === null || _a === void 0 ? void 0 : _a.quote;
28282
28279
  };
28283
28280
 
28284
28281
  const formatDateForApi = (date) => {
package/dist/esm/index.js CHANGED
@@ -2,7 +2,7 @@ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
2
2
  import { useState, useEffect, isValidElement, createContext, useContext, useMemo, createElement, useRef, useCallback, Fragment as Fragment$1 } from 'react';
3
3
  import { WarningOutlined, CheckCircleOutlined, CreditCardOutlined, EllipsisOutlined, BankOutlined, DownloadOutlined, SearchOutlined, CheckCircleFilled, LoadingOutlined, CloseOutlined, InfoCircleOutlined } from '@ant-design/icons';
4
4
  import { notification, theme, ConfigProvider, Tag, Button, Dropdown, Typography, Input, Modal, Checkbox, Skeleton, Collapse, Spin, Form, Tooltip as Tooltip$1, Drawer, Card as Card$1, Divider, Select, Popconfirm, Table, Radio, Space, Switch } from 'antd';
5
- import { QueryClient, QueryCache, QueryClientProvider, useQuery, useMutation, useQueryClient, keepPreviousData, useIsMutating, useIsFetching } from '@tanstack/react-query';
5
+ import { QueryClient, MutationCache, QueryCache, QueryClientProvider, useQuery, useMutation, useQueryClient, keepPreviousData, useIsMutating, useIsFetching } from '@tanstack/react-query';
6
6
  import request$1 from 'graphql-request';
7
7
  import { RecoilRoot } from 'recoil';
8
8
  import { print } from 'graphql';
@@ -1281,7 +1281,7 @@ const DEFAULT_CONFIG = {
1281
1281
  };
1282
1282
 
1283
1283
  // This will be replaced at build time by rollup-plugin-replace
1284
- const PACKAGE_VERSION = '1.8.0-beta.1';
1284
+ const PACKAGE_VERSION = '1.8.0-beta.2';
1285
1285
  const createRequestHeaders = (token) => {
1286
1286
  const headers = createClientDevHeaders({ token });
1287
1287
  // Add the components version header
@@ -1308,7 +1308,12 @@ const gqlRequest = async ({ query, apiHost, token, vars, isInPreviewMode, }) =>
1308
1308
  const requestHeaders = {
1309
1309
  ...baseHeaders,
1310
1310
  };
1311
- return await request$1(`${apiHost}${graphqlEndpoint}`, query, vars, requestHeaders);
1311
+ try {
1312
+ return await request$1(`${apiHost}${graphqlEndpoint}`, query, vars, requestHeaders);
1313
+ }
1314
+ catch (error) {
1315
+ throw error;
1316
+ }
1312
1317
  };
1313
1318
  const createClientDevHeaders = ({ token, componentsVersion, additionalHeaders, }) => {
1314
1319
  const headers = {
@@ -1541,8 +1546,12 @@ const useAllErrorFormats = ({ onUserUnavailable, onInvalidOrMissingAuthorization
1541
1546
  };
1542
1547
 
1543
1548
  const useCreateQueryClient = () => {
1544
- const { onUserUnavailable, onInvalidOrMissingAuthorization, suppressUserUnavailableErrorNotification } = useBunnyProviderCallbacks();
1545
- const handleAllErrorFormats = useAllErrorFormats({ onUserUnavailable, onInvalidOrMissingAuthorization, suppressUserUnavailableErrorNotification });
1549
+ const { onUserUnavailable, onInvalidOrMissingAuthorization, suppressUserUnavailableErrorNotification, } = useBunnyProviderCallbacks();
1550
+ const handleAllErrorFormats = useAllErrorFormats({
1551
+ onUserUnavailable,
1552
+ onInvalidOrMissingAuthorization,
1553
+ suppressUserUnavailableErrorNotification,
1554
+ });
1546
1555
  const onError = (error, _query) => {
1547
1556
  // Extract mutation name from query string
1548
1557
  // const mutationName = query?.mutation?.match(/mutation\s+(\w+)/)?.[1];
@@ -1552,9 +1561,6 @@ const useCreateQueryClient = () => {
1552
1561
  };
1553
1562
  return () => new QueryClient({
1554
1563
  defaultOptions: {
1555
- mutations: {
1556
- onError,
1557
- },
1558
1564
  queries: {
1559
1565
  gcTime: Number.POSITIVE_INFINITY,
1560
1566
  refetchIntervalInBackground: false,
@@ -1563,6 +1569,9 @@ const useCreateQueryClient = () => {
1563
1569
  refetchOnWindowFocus: false,
1564
1570
  },
1565
1571
  },
1572
+ mutationCache: new MutationCache({
1573
+ onError,
1574
+ }),
1566
1575
  queryCache: new QueryCache({
1567
1576
  onError,
1568
1577
  }),
@@ -24434,12 +24443,9 @@ const mutation$c = t(`
24434
24443
  }
24435
24444
  `, [QuoteContext_QuoteFragment]);
24436
24445
  const quoteChargeUpdate$1 = async (quoteChargeId, quantity, apiHost, token) => {
24437
- var _a, _b;
24446
+ var _a;
24438
24447
  const response = await execute(mutation$c, { apiHost, token }, { quoteChargeId, quantity });
24439
- if ((_a = response.quoteChargeUpdate) === null || _a === void 0 ? void 0 : _a.errors) {
24440
- throw new Error(response.quoteChargeUpdate.errors[0]);
24441
- }
24442
- return (_b = response.quoteChargeUpdate) === null || _b === void 0 ? void 0 : _b.quoteCharge;
24448
+ return (_a = response.quoteChargeUpdate) === null || _a === void 0 ? void 0 : _a.quoteCharge;
24443
24449
  };
24444
24450
 
24445
24451
  /**
@@ -24482,12 +24488,9 @@ const mutation$b = t(`
24482
24488
  }
24483
24489
  `, [QuoteContext_QuoteFragment]);
24484
24490
  const quoteChargeDelete = async ({ quoteChargeId, token, apiHost }) => {
24485
- var _a, _b, _c, _d;
24491
+ var _a;
24486
24492
  const response = await execute(mutation$b, { apiHost, token }, { quoteChargeId });
24487
- if ((_a = response.quoteChargeDelete) === null || _a === void 0 ? void 0 : _a.errors) {
24488
- throw new Error((_c = (_b = response.quoteChargeDelete) === null || _b === void 0 ? void 0 : _b.errors) === null || _c === void 0 ? void 0 : _c[0]);
24489
- }
24490
- return (_d = response.quoteChargeDelete) === null || _d === void 0 ? void 0 : _d.quoteCharge;
24493
+ return (_a = response.quoteChargeDelete) === null || _a === void 0 ? void 0 : _a.quoteCharge;
24491
24494
  };
24492
24495
 
24493
24496
  const showErrorNotification$1 = useErrorNotification();
@@ -28220,12 +28223,9 @@ const mutation$6 = t(`
28220
28223
  }
28221
28224
  `, [QuantityDrawer_QuoteFragment]);
28222
28225
  const quoteChargeUpdate = async (quoteChargeId, quantity, apiHost, token) => {
28223
- var _a, _b;
28226
+ var _a;
28224
28227
  const response = await execute(mutation$6, { apiHost, token }, { quoteChargeId, quantity });
28225
- if ((_a = response.quoteChargeUpdate) === null || _a === void 0 ? void 0 : _a.errors) {
28226
- throw new Error(response.quoteChargeUpdate.errors[0]);
28227
- }
28228
- return (_b = response.quoteChargeUpdate) === null || _b === void 0 ? void 0 : _b.quoteCharge;
28228
+ return (_a = response.quoteChargeUpdate) === null || _a === void 0 ? void 0 : _a.quoteCharge;
28229
28229
  };
28230
28230
 
28231
28231
  const mutation$5 = t(`
@@ -28271,12 +28271,9 @@ const mutation$4 = t(`
28271
28271
  }
28272
28272
  `, [QuantityDrawer_QuoteFragment]);
28273
28273
  const quoteSubscriptionUpdate = async (subscriptionIds, apiHost, token) => {
28274
- var _a, _b;
28274
+ var _a;
28275
28275
  const response = await execute(mutation$4, { apiHost, token }, { subscriptionIds });
28276
- if ((_a = response.quoteSubscriptionUpdate) === null || _a === void 0 ? void 0 : _a.errors) {
28277
- throw new Error(response.quoteSubscriptionUpdate.errors[0]);
28278
- }
28279
- return (_b = response.quoteSubscriptionUpdate) === null || _b === void 0 ? void 0 : _b.quote;
28276
+ return (_a = response.quoteSubscriptionUpdate) === null || _a === void 0 ? void 0 : _a.quote;
28280
28277
  };
28281
28278
 
28282
28279
  const formatDateForApi = (date) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bunnyapp/components",
3
- "version": "1.8.0-beta.2",
3
+ "version": "1.8.0-beta.3",
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",