@bigbinary/neeto-rules-frontend 2.0.1 → 2.0.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/README.md CHANGED
@@ -24,6 +24,8 @@ The `neeto-rules-nano` facilitates the management of automation rules within nee
24
24
  - [Actions](#38-actions)
25
25
  - [Custom action component](#39-custom-action-component)
26
26
  - [RulePreview](#4-rulepreview)
27
+ - [Constants](#constants)
28
+ - [AUTOMATION_RULES_QUERY_KEY](#1-automation-rules-query-key)
27
29
  2. [Instructions for Publishing](#instructions-for-publishing)
28
30
 
29
31
  ## Development with Host Application
@@ -684,9 +686,15 @@ The `RulePreview` component is used to preview the automation rule.
684
686
  3. `isOpen`: To specify if the preview is open. (Boolean).
685
687
  4. `onClose`: The callback function to call when the preview is closed. `() => void`.
686
688
 
689
+ ### Constans
690
+
691
+ #### 1. `AUTOMATION_RULES_QUERY_KEY`
692
+
693
+ The `AUTOMATION_RULES_QUERY_KEY` is the base query key which is being used as key for query fetching.
694
+
687
695
  reference:
688
696
 
689
- 1. [neeto-crm-web](https://github.com/bigbinary/neeto-crm-web/blob/b4c59181aec20d7519dd73b54b0695362ed4466f/app/javascript/src/components/Settings/Automations/index.jsx#L115)
697
+ 1. [neeto-desk-web](https://github.com/bigbinary/neeto-desk-web/blob/main/app/javascript/src/components/Automations/index.jsx)
690
698
 
691
699
 
692
700
  ## Instructions for Publishing
package/dist/index.cjs.js CHANGED
@@ -136,6 +136,9 @@ var Help__default = /*#__PURE__*/_interopDefaultLegacy(Help);
136
136
  var Down__default = /*#__PURE__*/_interopDefaultLegacy(Down);
137
137
  var Up__default = /*#__PURE__*/_interopDefaultLegacy(Up);
138
138
 
139
+ var AUTOMATION_RULES = "automation-rules";
140
+ var STALE_TIME = 3200000;
141
+
139
142
  function _typeof$3(o) {
140
143
  "@babel/helpers - typeof";
141
144
 
@@ -298,15 +301,12 @@ var automationRulesApi = {
298
301
  reorder: reorder
299
302
  };
300
303
 
301
- var AUTOMATION_RULES = "automation-rules";
302
- var STALE_TIME = 3200000;
303
-
304
304
  function ownKeys$v(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
305
305
  function _objectSpread$t(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$v(Object(t), !0).forEach(function (r) { _defineProperty$2(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$v(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
306
306
  var useFetchAutomationRules = function useFetchAutomationRules(params) {
307
307
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
308
308
  return reactQuery.useQuery(_objectSpread$t({
309
- queryKey: [AUTOMATION_RULES, params],
309
+ queryKey: [AUTOMATION_RULES, params.url, params],
310
310
  queryFn: function queryFn() {
311
311
  return automationRulesApi.fetch(params);
312
312
  },
@@ -317,24 +317,24 @@ var useFetchAutomationRules = function useFetchAutomationRules(params) {
317
317
  placeholderData: reactQuery.keepPreviousData
318
318
  }, options));
319
319
  };
320
- var useUpdateAutomationRule = function useUpdateAutomationRule() {
320
+ var useUpdateAutomationRule = function useUpdateAutomationRule(url) {
321
321
  return reactUtils.useMutationWithInvalidation(automationRulesApi.update, {
322
- keysToInvalidate: [[AUTOMATION_RULES]]
322
+ keysToInvalidate: [[AUTOMATION_RULES, url]]
323
323
  });
324
324
  };
325
- var useCloneAutomationRule = function useCloneAutomationRule() {
325
+ var useCloneAutomationRule = function useCloneAutomationRule(url) {
326
326
  return reactUtils.useMutationWithInvalidation(automationRulesApi.clone, {
327
- keysToInvalidate: [[AUTOMATION_RULES]]
327
+ keysToInvalidate: [[AUTOMATION_RULES, url]]
328
328
  });
329
329
  };
330
- var useDeleteAutomationRule = function useDeleteAutomationRule() {
330
+ var useDeleteAutomationRule = function useDeleteAutomationRule(url) {
331
331
  return reactUtils.useMutationWithInvalidation(automationRulesApi.destroy, {
332
- keysToInvalidate: [[AUTOMATION_RULES]]
332
+ keysToInvalidate: [[AUTOMATION_RULES, url]]
333
333
  });
334
334
  };
335
- var useReorderAutomationRules = function useReorderAutomationRules() {
335
+ var useReorderAutomationRules = function useReorderAutomationRules(url) {
336
336
  return reactUtils.useMutationWithInvalidation(automationRulesApi.reorder, {
337
- keysToInvalidate: [[AUTOMATION_RULES]]
337
+ keysToInvalidate: [[AUTOMATION_RULES, url]]
338
338
  });
339
339
  };
340
340
 
@@ -9522,7 +9522,7 @@ var RulesReorder = function RulesReorder(_ref) {
9522
9522
  setInitialRules = _useState2[1];
9523
9523
  var _useTranslation = reactI18next.useTranslation(),
9524
9524
  t = _useTranslation.t;
9525
- var _useReorderAutomation = useReorderAutomationRules(),
9525
+ var _useReorderAutomation = useReorderAutomationRules(url),
9526
9526
  reOrder = _useReorderAutomation.mutate,
9527
9527
  isPending = _useReorderAutomation.isPending;
9528
9528
  var handleReorderSave = function handleReorderSave(rules) {
@@ -9878,13 +9878,13 @@ var RulesTable = function RulesTable(_ref) {
9878
9878
  hidePreviewPane = _useUtilityStore.hidePreviewPane;
9879
9879
  var _useTranslation = reactI18next.useTranslation(),
9880
9880
  t = _useTranslation.t;
9881
- var _useUpdateAutomationR = useUpdateAutomationRule(),
9881
+ var _useUpdateAutomationR = useUpdateAutomationRule(url),
9882
9882
  updateRule = _useUpdateAutomationR.mutate,
9883
9883
  isUpdating = _useUpdateAutomationR.isPending;
9884
- var _useCloneAutomationRu = useCloneAutomationRule(),
9884
+ var _useCloneAutomationRu = useCloneAutomationRule(url),
9885
9885
  cloneRule = _useCloneAutomationRu.mutate,
9886
9886
  isCloning = _useCloneAutomationRu.isPending;
9887
- var _useDeleteAutomationR = useDeleteAutomationRule(),
9887
+ var _useDeleteAutomationR = useDeleteAutomationRule(url),
9888
9888
  deleteRule = _useDeleteAutomationR.mutate,
9889
9889
  isDeleting = _useDeleteAutomationR.isPending;
9890
9890
  var handleChangeStatus = function handleChangeStatus(event, id) {
@@ -23430,6 +23430,7 @@ var RulePreview = function RulePreview(_ref) {
23430
23430
  });
23431
23431
  };
23432
23432
 
23433
+ exports.AUTOMATION_RULES_QUERY_KEY = AUTOMATION_RULES;
23433
23434
  exports.NeetoRules = NeetoRules;
23434
23435
  exports.NeetoRulesForm = NeetoRulesForm;
23435
23436
  exports.RulePreview = RulePreview;