@bigbinary/neeto-filters-frontend 2.14.0 → 2.14.1

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/index.js CHANGED
@@ -3,7 +3,7 @@ import classnames from 'classnames';
3
3
  import { curryN, isNil, complement, curry, isEmpty, either, groupBy, anyPass, any, toLower, mergeLeft, identity, omit, mergeRight, toPairs, concat, pluck, has as has$1, equals, pick, modify, prop, isNotNil, append, last, not } from 'ramda';
4
4
  import { Tooltip, Typography, Dropdown as Dropdown$2, Button, Pane as Pane$1, Alert, Select, DatePicker, TimePicker, Input as Input$1, Accordion, Spinner } from '@bigbinary/neetoui';
5
5
  import { useHistory, useLocation } from 'react-router-dom';
6
- import { useHotKeys, useDebounce, withT } from '@bigbinary/neeto-commons-frontend/react-utils';
6
+ import { useHotKeys, useMutationWithInvalidation, useDebounce, withT } from '@bigbinary/neeto-commons-frontend/react-utils';
7
7
  import { Close, Search, Check, MenuHorizontal, Down, Settings } from '@bigbinary/neeto-icons';
8
8
  import dayjs from 'dayjs';
9
9
  import { getQueryParams, dateFormat } from '@bigbinary/neeto-commons-frontend/utils';
@@ -12,7 +12,7 @@ import timezone from 'dayjs/plugin/timezone';
12
12
  import utc from 'dayjs/plugin/utc';
13
13
  import weekday from 'dayjs/plugin/weekday';
14
14
  import { Form, Input, ActionBlock } from '@bigbinary/neetoui/formik';
15
- import { useQuery, useQueryClient, useMutation } from 'react-query';
15
+ import { useQuery } from 'react-query';
16
16
  import axios from 'axios';
17
17
  import ReactDOM, { createPortal } from 'react-dom';
18
18
  import MenuBar from '@bigbinary/neeto-molecules/MenuBar';
@@ -3338,8 +3338,8 @@ dayjs.extend(timezone);
3338
3338
  dayjs.extend(weekday);
3339
3339
  dayjs.Ls.en.weekStart = 1;
3340
3340
 
3341
- function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3342
- function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$4(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
3341
+ function ownKeys$5(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3342
+ function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$5(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$5(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
3343
3343
  var groupByGroup = groupBy(function (_ref) {
3344
3344
  var group = _ref.group;
3345
3345
  return group || "individual";
@@ -3632,7 +3632,7 @@ var buildDatePayload = function buildDatePayload(value) {
3632
3632
  var buildSingleDatePayload = function buildSingleDatePayload(filter) {
3633
3633
  var value = filter.value;
3634
3634
  var filterValue = Array.isArray(value) ? value.join(",") : value;
3635
- return _objectSpread$4(_objectSpread$4({}, filter), {}, {
3635
+ return _objectSpread$5(_objectSpread$5({}, filter), {}, {
3636
3636
  value: filterValue,
3637
3637
  type: "date"
3638
3638
  });
@@ -3640,7 +3640,7 @@ var buildSingleDatePayload = function buildSingleDatePayload(filter) {
3640
3640
  var buildSingleTimePayload = function buildSingleTimePayload(filter) {
3641
3641
  var value = filter.value;
3642
3642
  var filterValue = Array.isArray(value) ? value.join(",") : value;
3643
- return _objectSpread$4(_objectSpread$4({}, filter), {}, {
3643
+ return _objectSpread$5(_objectSpread$5({}, filter), {}, {
3644
3644
  value: filterValue,
3645
3645
  type: "time"
3646
3646
  });
@@ -3922,7 +3922,7 @@ var buildFilterColumnsFromFields = function buildFilterColumnsFromFields(_ref21)
3922
3922
  };
3923
3923
  var getColumnsWithStandardizedType = function getColumnsWithStandardizedType(columns) {
3924
3924
  return columns.map(function (column) {
3925
- return _objectSpread$4(_objectSpread$4({}, column), {}, {
3925
+ return _objectSpread$5(_objectSpread$5({}, column), {}, {
3926
3926
  type: standardizeColumnType(column.type)
3927
3927
  });
3928
3928
  });
@@ -4143,6 +4143,8 @@ var QUERY_KEYS = {
4143
4143
  };
4144
4144
  var SEGMENTS_STALE_TIME = 900000; // 15 mins
4145
4145
 
4146
+ function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4147
+ function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$4(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4146
4148
  var SEGMENTS_LIST = QUERY_KEYS.SEGMENTS_LIST;
4147
4149
  var useFetchSegments = function useFetchSegments(_ref) {
4148
4150
  var entity = _ref.entity,
@@ -4169,34 +4171,19 @@ var useShowSegment = function useShowSegment(id) {
4169
4171
  }, options));
4170
4172
  };
4171
4173
  var useCreateSegment = function useCreateSegment(options) {
4172
- var queryClient = useQueryClient();
4173
- return useMutation(segmentsApi.create, {
4174
- onSuccess: function onSuccess() {
4175
- var _options$onSuccess;
4176
- queryClient.invalidateQueries(SEGMENTS_LIST);
4177
- options === null || options === void 0 ? void 0 : (_options$onSuccess = options.onSuccess) === null || _options$onSuccess === void 0 ? void 0 : _options$onSuccess.call(options);
4178
- }
4179
- });
4174
+ return useMutationWithInvalidation(segmentsApi.create, _objectSpread$4({
4175
+ keysToInvalidate: [SEGMENTS_LIST]
4176
+ }, options));
4180
4177
  };
4181
4178
  var useUpdateSegment = function useUpdateSegment(options) {
4182
- var queryClient = useQueryClient();
4183
- return useMutation(segmentsApi.update, {
4184
- onSuccess: function onSuccess() {
4185
- var _options$onSuccess2;
4186
- queryClient.invalidateQueries(SEGMENTS_LIST);
4187
- options === null || options === void 0 ? void 0 : (_options$onSuccess2 = options.onSuccess) === null || _options$onSuccess2 === void 0 ? void 0 : _options$onSuccess2.call(options);
4188
- }
4189
- });
4179
+ return useMutationWithInvalidation(segmentsApi.update, _objectSpread$4({
4180
+ keysToInvalidate: [SEGMENTS_LIST]
4181
+ }, options));
4190
4182
  };
4191
4183
  var useDestroySegment = function useDestroySegment(options) {
4192
- var queryClient = useQueryClient();
4193
- return useMutation(segmentsApi.destroy, {
4194
- onSuccess: function onSuccess() {
4195
- var _options$onSuccess3;
4196
- queryClient.invalidateQueries(SEGMENTS_LIST);
4197
- options === null || options === void 0 ? void 0 : (_options$onSuccess3 = options.onSuccess) === null || _options$onSuccess3 === void 0 ? void 0 : _options$onSuccess3.call(options);
4198
- }
4199
- });
4184
+ return useMutationWithInvalidation(segmentsApi.destroy, _objectSpread$4({
4185
+ keysToInvalidate: [SEGMENTS_LIST]
4186
+ }, options));
4200
4187
  };
4201
4188
 
4202
4189
  var Menu = Dropdown$2.Menu,