@bigbinary/neeto-rules-frontend 2.5.12 → 2.5.14

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-CYeamuNR.js","sources":["../app/javascript/src/apis/automation_rules.js","../app/javascript/src/hooks/reactQuery/useAutomationRulesApi.js","../app/javascript/src/components/NeetoRules/constants.js","../app/javascript/src/components/NeetoRules/RulesReorder/utils.js","../app/javascript/src/components/NeetoRules/RulesReorder/DraggableItem.jsx","../app/javascript/src/components/NeetoRules/RulesReorder/index.jsx"],"sourcesContent":["import axios from \"axios\";\n\nconst fetch = ({ url, ...params }) => axios.get(url, { params });\n\nconst update = ({ url, id, payload }) => axios.patch(`${url}/${id}`, payload);\n\nconst clone = ({ url, id }) => axios.post(`${url}/${id}/clone`);\n\nconst destroy = ({ url, id }) => axios.delete(`${url}/${id}`);\n\nconst reorder = ({ url, payload }) => axios.patch(`${url}/reorder`, payload);\n\nconst automationRulesApi = { fetch, update, clone, destroy, reorder };\n\nexport default automationRulesApi;\n","import { keepPreviousData, useQuery } from \"@tanstack/react-query\";\nimport { useMutationWithInvalidation } from \"neetocommons/react-utils\";\n\nimport automationRulesApi from \"apis/automation_rules\";\nimport { AUTOMATION_RULES, STALE_TIME } from \"common/constants\";\n\nconst useFetchAutomationRules = (params, options = {}) =>\n useQuery({\n queryKey: [AUTOMATION_RULES, params.url, params],\n queryFn: () => automationRulesApi.fetch(params),\n staleTime: STALE_TIME,\n select: response => response.data || response,\n placeholderData: keepPreviousData,\n ...options,\n });\n\nconst useUpdateAutomationRule = url =>\n useMutationWithInvalidation(automationRulesApi.update, {\n keysToInvalidate: [[AUTOMATION_RULES, url]],\n });\n\nconst useCloneAutomationRule = url =>\n useMutationWithInvalidation(automationRulesApi.clone, {\n keysToInvalidate: [[AUTOMATION_RULES, url]],\n });\n\nconst useDeleteAutomationRule = url =>\n useMutationWithInvalidation(automationRulesApi.destroy, {\n keysToInvalidate: [[AUTOMATION_RULES, url]],\n });\n\nconst useReorderAutomationRules = url =>\n useMutationWithInvalidation(automationRulesApi.reorder, {\n keysToInvalidate: [[AUTOMATION_RULES, url]],\n });\nexport {\n useFetchAutomationRules,\n useUpdateAutomationRule,\n useCloneAutomationRule,\n useDeleteAutomationRule,\n useReorderAutomationRules,\n};\n","export const STATUS_KEYS = { ENABLED: \"enabled\", DISABLED: \"disabled\" };\n\nexport const DEFAULT_INIT_PAGE = 1;\n\nexport const INITIAL_RULES_DATA = { rules: [], totalCount: 0 };\n","export const reorderList = ({\n endIndex,\n firstDisplayOrder,\n list,\n startIndex,\n}) => {\n const result = Array.from(list);\n const [removed] = result.splice(startIndex, 1);\n result.splice(endIndex, 0, removed);\n\n return result.map((item, index) => ({\n ...item,\n displayOrder: firstDisplayOrder + index,\n }));\n};\n\nexport const getDragItemStyle = (isDragging, draggableStyle) => ({\n // styles we need to apply on draggables\n ...draggableStyle,\n\n ...(isDragging && { zIndex: 99999 }),\n});\n","import { Draggable } from \"@hello-pangea/dnd\";\nimport { Reorder } from \"neetoicons\";\nimport { withRouter } from \"react-router-dom\";\n\nimport { getDragItemStyle } from \"./utils\";\n\nconst DraggableItem = props => {\n const { rule, ruleIndex } = props;\n\n return (\n <Draggable draggableId={`item_${rule.id}`} index={ruleIndex}>\n {(provided, snapshot) => (\n <div\n className=\"neeto-ui-text-gray-800 mb-3 flex items-center space-x-4 font-medium\"\n key={`list_${rule.id}`}\n ref={provided.innerRef}\n {...provided.draggableProps}\n {...provided.dragHandleProps}\n style={getDragItemStyle(\n snapshot.isDragging,\n provided.draggableProps.style\n )}\n >\n <Reorder />\n <div\n className=\"neeto-ui-bg-white neeto-ui-border-gray-400 neeto-ui-rounded neeto-ui-shadow-xs flex w-96 items-center space-x-4 border border-solid p-3\"\n data-cy=\"automation-rule-reorder-container\"\n >\n {rule.name}\n </div>\n </div>\n )}\n </Draggable>\n );\n};\n\nexport default withRouter(DraggableItem);\n","import { useEffect, useState } from \"react\";\n\nimport { DragDropContext, Droppable } from \"@hello-pangea/dnd\";\nimport { Reorder as NeetoUIReorderIcon } from \"neetoicons\";\nimport { Pane, Typography, Button, Spinner } from \"neetoui\";\nimport { clone, equals } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport {\n useFetchAutomationRules,\n useReorderAutomationRules,\n} from \"hooks/reactQuery/useAutomationRulesApi\";\n\nimport DraggableItem from \"./DraggableItem\";\nimport { getDragItemStyle, reorderList } from \"./utils\";\n\nimport { INITIAL_RULES_DATA } from \"../constants\";\n\nconst RulesReorder = ({\n isOpen,\n totalCount,\n url,\n onClose,\n onReorderSuccess,\n}) => {\n const [reorderedRules, setReorderedRules] = useState([]);\n\n const { t } = useTranslation();\n\n const { data: { rules } = INITIAL_RULES_DATA, isLoading } =\n useFetchAutomationRules({ pageSize: totalCount, url }, { enabled: isOpen });\n\n const { mutate: reOrder, isPending } = useReorderAutomationRules(url);\n\n const firstDisplayOrder = rules[0]?.displayOrder ?? 1;\n\n const handleReorderSave = () =>\n reOrder(\n { url, payload: { reorder: { rules: reorderedRules } } },\n {\n onSuccess: () => {\n onReorderSuccess?.();\n onClose();\n },\n }\n );\n\n const onDragEnd = ({ destination, source }) => {\n if (!destination || source.index === destination.index) return;\n\n const items = reorderList({\n endIndex: destination.index,\n firstDisplayOrder,\n list: clone(reorderedRules),\n startIndex: source.index,\n });\n setReorderedRules(items);\n };\n\n useEffect(() => {\n setReorderedRules(rules);\n }, [rules]);\n\n if (isLoading) {\n return (\n <Pane {...{ isOpen, onClose }}>\n <div className=\"flex h-full w-full items-center justify-center\">\n <Spinner />\n </div>\n </Pane>\n );\n }\n\n return (\n <Pane {...{ isOpen, onClose }}>\n <Pane.Header>\n <Typography style=\"h2\" weight=\"semibold\">\n {t(\"neetoRules.common.reorder\")}\n </Typography>\n </Pane.Header>\n <Pane.Body>\n <Typography className=\"mb-3\" style=\"body2\">\n {t(\"neetoRules.description.reorder\")}\n </Typography>\n <div className=\"flex flex-col items-center\">\n <DragDropContext {...{ onDragEnd }}>\n <Droppable\n droppableId=\"droppable\"\n renderClone={(provided, snapshot, rubric) => (\n <div\n className=\"neeto-ui-text-gray-800 mb-3 flex items-center space-x-4 font-medium\"\n key={`list_${reorderedRules[rubric.source.index].id}`}\n ref={provided.innerRef}\n {...provided.draggableProps}\n {...provided.dragHandleProps}\n style={getDragItemStyle(\n snapshot.isDragging,\n provided.draggableProps.style\n )}\n >\n <NeetoUIReorderIcon />\n <div className=\"neeto-ui-bg-white neeto-ui-border-gray-400 neeto-ui-rounded neeto-ui-shadow-xs flex w-96 items-center space-x-4 border border-solid p-3\">\n <div>{reorderedRules[rubric.source.index].name}</div>\n </div>\n </div>\n )}\n >\n {provided => (\n <div {...provided.droppableProps} ref={provided.innerRef}>\n {reorderedRules.map((rule, index) => (\n <DraggableItem\n {...{ rule }}\n key={rule.id}\n ruleIndex={index}\n />\n ))}\n {provided.placeholder}\n </div>\n )}\n </Droppable>\n </DragDropContext>\n </div>\n </Pane.Body>\n <Pane.Footer className=\"flex items-center gap-x-2\">\n <Button\n disabled={isPending || equals(rules, reorderedRules)}\n label={t(\"neetoRules.common.saveChange\")}\n loading={isPending}\n style=\"primary\"\n onClick={handleReorderSave}\n />\n <Button\n label={t(\"neetoRules.buttons.cancel\")}\n style=\"text\"\n onClick={onClose}\n />\n </Pane.Footer>\n </Pane>\n );\n};\nexport default RulesReorder;\n"],"names":["fetch","_ref","url","params","_objectWithoutProperties","_excluded","axios","get","update","_ref2","id","payload","patch","concat","clone","_ref3","post","destroy","_ref4","reorder","_ref5","automationRulesApi","useFetchAutomationRules","options","arguments","length","undefined","useQuery","_objectSpread","queryKey","AUTOMATION_RULES","queryFn","staleTime","STALE_TIME","select","response","data","placeholderData","keepPreviousData","useUpdateAutomationRule","useMutationWithInvalidation","keysToInvalidate","useCloneAutomationRule","useDeleteAutomationRule","useReorderAutomationRules","INITIAL_RULES_DATA","rules","totalCount","reorderList","endIndex","firstDisplayOrder","list","startIndex","result","Array","from","_result$splice","splice","_result$splice2","_slicedToArray","removed","map","item","index","displayOrder","getDragItemStyle","isDragging","draggableStyle","zIndex","DraggableItem","props","rule","ruleIndex","_jsx","Draggable","draggableId","children","provided","snapshot","_jsxs","className","ref","innerRef","draggableProps","dragHandleProps","style","Reorder","name","withRouter","RulesReorder","_rules$0$displayOrder","_rules$","isOpen","onClose","onReorderSuccess","_useState","useState","_useState2","reorderedRules","setReorderedRules","_useTranslation","useTranslation","t","_useFetchAutomationRu","pageSize","enabled","_useFetchAutomationRu2","_useFetchAutomationRu3","isLoading","_useReorderAutomation","reOrder","mutate","isPending","handleReorderSave","onSuccess","onDragEnd","destination","source","items","useEffect","Pane","Spinner","Header","Typography","weight","Body","DragDropContext","Droppable","droppableId","renderClone","rubric","NeetoUIReorderIcon","droppableProps","_createElement","key","placeholder","Footer","Button","disabled","equals","label","loading","onClick"],"mappings":";;;;;;;;;;;;;;;;;;;;AAEA,IAAMA,KAAK,GAAG,SAARA,KAAKA,CAAAC,IAAA,EAAA;AAAA,EAAA,IAAMC,GAAG,GAAAD,IAAA,CAAHC,GAAG;AAAKC,IAAAA,MAAM,GAAAC,wBAAA,CAAAH,IAAA,EAAAI,SAAA,CAAA;AAAA,EAAA,OAAOC,KAAK,CAACC,GAAG,CAACL,GAAG,EAAE;AAAEC,IAAAA,MAAM,EAANA;AAAO,GAAC,CAAC;AAAA,CAAA;AAEhE,IAAMK,MAAM,GAAG,SAATA,MAAMA,CAAAC,KAAA,EAAA;AAAA,EAAA,IAAMP,GAAG,GAAAO,KAAA,CAAHP,GAAG;IAAEQ,EAAE,GAAAD,KAAA,CAAFC,EAAE;IAAEC,OAAO,GAAAF,KAAA,CAAPE,OAAO;AAAA,EAAA,OAAOL,KAAK,CAACM,KAAK,CAAA,EAAA,CAAAC,MAAA,CAAIX,GAAG,EAAA,GAAA,CAAA,CAAAW,MAAA,CAAIH,EAAE,CAAA,EAAIC,OAAO,CAAC;AAAA,CAAA;AAE7E,I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EAAET;AAAM,mBAClB,CAAC;AAAA,iBACH,CAAC,EACDc,QAAQ,CAAC0D,WAAW;AAAA,eAAA,CAClB,CAAC;AAAA;WAEC;SACI;AAAC,OACf,CAAC;AAAA,KACG,CAAC,eACZxD,IAAA,CAACyC,IAAI,CAACgB,MAAM,EAAA;AAACxD,MAAAA,SAAS,EAAC,2BAA2B;MAAAJ,QAAA,EAAA,cAChDH,GAAA,CAACgE,MAAM,EAAA;QACLC,QAAQ,EAAE1B,SAAS,IAAI2B,MAAM,CAAC7F,KAAK,EAAEoD,cAAc,CAAE;AACrD0C,QAAAA,KAAK,EAAEtC,CAAC,CAAC,8BAA8B,CAAE;AACzCuC,QAAAA,OAAO,EAAE7B,SAAU;AACnB3B,QAAAA,KAAK,EAAC,SAAS;AACfyD,QAAAA,OAAO,EAAE7B;AAAkB,OAC5B,CAAC,eACFxC,GAAA,CAACgE,MAAM,EAAA;AACLG,QAAAA,KAAK,EAAEtC,CAAC,CAAC,2BAA2B,CAAE;AACtCjB,QAAAA,KAAK,EAAC,MAAM;AACZyD,QAAAA,OAAO,EAAEjD;AAAQ,OAClB,CAAC;AAAA,KACS,CAAC;AAAA,GACV,CAAC;AAEX;;;;"}
@@ -0,0 +1,291 @@
1
+ 'use strict';
2
+
3
+ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
4
+ var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
5
+ var react = require('react');
6
+ var dnd = require('@hello-pangea/dnd');
7
+ var Reorder = require('@bigbinary/neeto-icons/Reorder');
8
+ var Pane = require('@bigbinary/neetoui/Pane');
9
+ var Typography = require('@bigbinary/neetoui/Typography');
10
+ var Button = require('@bigbinary/neetoui/Button');
11
+ var Spinner = require('@bigbinary/neetoui/Spinner');
12
+ var ramda = require('ramda');
13
+ var reactI18next = require('react-i18next');
14
+ var reactQuery = require('@tanstack/react-query');
15
+ var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
16
+ var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
17
+ var axios = require('axios');
18
+ var constants = require('./index-DFwPrb81.js');
19
+ var reactRouterDom = require('react-router-dom');
20
+ var jsxRuntime = require('react/jsx-runtime');
21
+
22
+ var _excluded = ["url"];
23
+ var fetch = function fetch(_ref) {
24
+ var url = _ref.url,
25
+ params = _objectWithoutProperties(_ref, _excluded);
26
+ return axios.get(url, {
27
+ params: params
28
+ });
29
+ };
30
+ var update = function update(_ref2) {
31
+ var url = _ref2.url,
32
+ id = _ref2.id,
33
+ payload = _ref2.payload;
34
+ return axios.patch("".concat(url, "/").concat(id), payload);
35
+ };
36
+ var clone = function clone(_ref3) {
37
+ var url = _ref3.url,
38
+ id = _ref3.id;
39
+ return axios.post("".concat(url, "/").concat(id, "/clone"));
40
+ };
41
+ var destroy = function destroy(_ref4) {
42
+ var url = _ref4.url,
43
+ id = _ref4.id;
44
+ return axios["delete"]("".concat(url, "/").concat(id));
45
+ };
46
+ var reorder = function reorder(_ref5) {
47
+ var url = _ref5.url,
48
+ payload = _ref5.payload;
49
+ return axios.patch("".concat(url, "/reorder"), payload);
50
+ };
51
+ var automationRulesApi = {
52
+ fetch: fetch,
53
+ update: update,
54
+ clone: clone,
55
+ destroy: destroy,
56
+ reorder: reorder
57
+ };
58
+
59
+ function ownKeys$3(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; }
60
+ function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
61
+ var useFetchAutomationRules = function useFetchAutomationRules(params) {
62
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
63
+ return reactQuery.useQuery(_objectSpread$3({
64
+ queryKey: [constants.AUTOMATION_RULES, params.url, params],
65
+ queryFn: function queryFn() {
66
+ return automationRulesApi.fetch(params);
67
+ },
68
+ staleTime: constants.STALE_TIME,
69
+ select: function select(response) {
70
+ return response.data || response;
71
+ },
72
+ placeholderData: reactQuery.keepPreviousData
73
+ }, options));
74
+ };
75
+ var useUpdateAutomationRule = function useUpdateAutomationRule(url) {
76
+ return reactUtils.useMutationWithInvalidation(automationRulesApi.update, {
77
+ keysToInvalidate: [[constants.AUTOMATION_RULES, url]]
78
+ });
79
+ };
80
+ var useCloneAutomationRule = function useCloneAutomationRule(url) {
81
+ return reactUtils.useMutationWithInvalidation(automationRulesApi.clone, {
82
+ keysToInvalidate: [[constants.AUTOMATION_RULES, url]]
83
+ });
84
+ };
85
+ var useDeleteAutomationRule = function useDeleteAutomationRule(url) {
86
+ return reactUtils.useMutationWithInvalidation(automationRulesApi.destroy, {
87
+ keysToInvalidate: [[constants.AUTOMATION_RULES, url]]
88
+ });
89
+ };
90
+ var useReorderAutomationRules = function useReorderAutomationRules(url) {
91
+ return reactUtils.useMutationWithInvalidation(automationRulesApi.reorder, {
92
+ keysToInvalidate: [[constants.AUTOMATION_RULES, url]]
93
+ });
94
+ };
95
+
96
+ var INITIAL_RULES_DATA = {
97
+ rules: [],
98
+ totalCount: 0
99
+ };
100
+
101
+ function ownKeys$2(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; }
102
+ function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
103
+ var reorderList = function reorderList(_ref) {
104
+ var endIndex = _ref.endIndex,
105
+ firstDisplayOrder = _ref.firstDisplayOrder,
106
+ list = _ref.list,
107
+ startIndex = _ref.startIndex;
108
+ var result = Array.from(list);
109
+ var _result$splice = result.splice(startIndex, 1),
110
+ _result$splice2 = _slicedToArray(_result$splice, 1),
111
+ removed = _result$splice2[0];
112
+ result.splice(endIndex, 0, removed);
113
+ return result.map(function (item, index) {
114
+ return _objectSpread$2(_objectSpread$2({}, item), {}, {
115
+ displayOrder: firstDisplayOrder + index
116
+ });
117
+ });
118
+ };
119
+ var getDragItemStyle = function getDragItemStyle(isDragging, draggableStyle) {
120
+ return _objectSpread$2(_objectSpread$2({}, draggableStyle), isDragging && {
121
+ zIndex: 99999
122
+ });
123
+ };
124
+
125
+ function ownKeys$1(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; }
126
+ function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
127
+ var DraggableItem = function DraggableItem(props) {
128
+ var rule = props.rule,
129
+ ruleIndex = props.ruleIndex;
130
+ return /*#__PURE__*/jsxRuntime.jsx(dnd.Draggable, {
131
+ draggableId: "item_".concat(rule.id),
132
+ index: ruleIndex,
133
+ children: function children(provided, snapshot) {
134
+ return /*#__PURE__*/jsxRuntime.jsxs("div", _objectSpread$1(_objectSpread$1(_objectSpread$1({
135
+ className: "neeto-ui-text-gray-800 mb-3 flex items-center space-x-4 font-medium",
136
+ ref: provided.innerRef
137
+ }, provided.draggableProps), provided.dragHandleProps), {}, {
138
+ style: getDragItemStyle(snapshot.isDragging, provided.draggableProps.style),
139
+ children: [/*#__PURE__*/jsxRuntime.jsx(Reorder, {}), /*#__PURE__*/jsxRuntime.jsx("div", {
140
+ className: "neeto-ui-bg-white neeto-ui-border-gray-400 neeto-ui-rounded neeto-ui-shadow-xs flex w-96 items-center space-x-4 border border-solid p-3",
141
+ "data-cy": "automation-rule-reorder-container",
142
+ children: rule.name
143
+ })]
144
+ }), "list_".concat(rule.id));
145
+ }
146
+ });
147
+ };
148
+ var DraggableItem$1 = reactRouterDom.withRouter(DraggableItem);
149
+
150
+ function ownKeys(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; }
151
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
152
+ var RulesReorder = function RulesReorder(_ref) {
153
+ var _rules$0$displayOrder, _rules$;
154
+ var isOpen = _ref.isOpen,
155
+ totalCount = _ref.totalCount,
156
+ url = _ref.url,
157
+ onClose = _ref.onClose,
158
+ onReorderSuccess = _ref.onReorderSuccess;
159
+ var _useState = react.useState([]),
160
+ _useState2 = _slicedToArray(_useState, 2),
161
+ reorderedRules = _useState2[0],
162
+ setReorderedRules = _useState2[1];
163
+ var _useTranslation = reactI18next.useTranslation(),
164
+ t = _useTranslation.t;
165
+ var _useFetchAutomationRu = useFetchAutomationRules({
166
+ pageSize: totalCount,
167
+ url: url
168
+ }, {
169
+ enabled: isOpen
170
+ }),
171
+ _useFetchAutomationRu2 = _useFetchAutomationRu.data,
172
+ _useFetchAutomationRu3 = _useFetchAutomationRu2 === void 0 ? INITIAL_RULES_DATA : _useFetchAutomationRu2,
173
+ rules = _useFetchAutomationRu3.rules,
174
+ isLoading = _useFetchAutomationRu.isLoading;
175
+ var _useReorderAutomation = useReorderAutomationRules(url),
176
+ reOrder = _useReorderAutomation.mutate,
177
+ isPending = _useReorderAutomation.isPending;
178
+ var firstDisplayOrder = (_rules$0$displayOrder = (_rules$ = rules[0]) === null || _rules$ === void 0 ? void 0 : _rules$.displayOrder) !== null && _rules$0$displayOrder !== void 0 ? _rules$0$displayOrder : 1;
179
+ var handleReorderSave = function handleReorderSave() {
180
+ return reOrder({
181
+ url: url,
182
+ payload: {
183
+ reorder: {
184
+ rules: reorderedRules
185
+ }
186
+ }
187
+ }, {
188
+ onSuccess: function onSuccess() {
189
+ onReorderSuccess === null || onReorderSuccess === void 0 || onReorderSuccess();
190
+ onClose();
191
+ }
192
+ });
193
+ };
194
+ var onDragEnd = function onDragEnd(_ref2) {
195
+ var destination = _ref2.destination,
196
+ source = _ref2.source;
197
+ if (!destination || source.index === destination.index) return;
198
+ var items = reorderList({
199
+ endIndex: destination.index,
200
+ firstDisplayOrder: firstDisplayOrder,
201
+ list: ramda.clone(reorderedRules),
202
+ startIndex: source.index
203
+ });
204
+ setReorderedRules(items);
205
+ };
206
+ react.useEffect(function () {
207
+ setReorderedRules(rules);
208
+ }, [rules]);
209
+ if (isLoading) {
210
+ return /*#__PURE__*/jsxRuntime.jsx(Pane, {
211
+ isOpen: isOpen,
212
+ onClose: onClose,
213
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
214
+ className: "flex h-full w-full items-center justify-center",
215
+ children: /*#__PURE__*/jsxRuntime.jsx(Spinner, {})
216
+ })
217
+ });
218
+ }
219
+ return /*#__PURE__*/jsxRuntime.jsxs(Pane, {
220
+ isOpen: isOpen,
221
+ onClose: onClose,
222
+ children: [/*#__PURE__*/jsxRuntime.jsx(Pane.Header, {
223
+ children: /*#__PURE__*/jsxRuntime.jsx(Typography, {
224
+ style: "h2",
225
+ weight: "semibold",
226
+ children: t("neetoRules.common.reorder")
227
+ })
228
+ }), /*#__PURE__*/jsxRuntime.jsxs(Pane.Body, {
229
+ children: [/*#__PURE__*/jsxRuntime.jsx(Typography, {
230
+ className: "mb-3",
231
+ style: "body2",
232
+ children: t("neetoRules.description.reorder")
233
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
234
+ className: "flex flex-col items-center",
235
+ children: /*#__PURE__*/jsxRuntime.jsx(dnd.DragDropContext, {
236
+ onDragEnd: onDragEnd,
237
+ children: /*#__PURE__*/jsxRuntime.jsx(dnd.Droppable, {
238
+ droppableId: "droppable",
239
+ renderClone: function renderClone(provided, snapshot, rubric) {
240
+ return /*#__PURE__*/jsxRuntime.jsxs("div", _objectSpread(_objectSpread(_objectSpread({
241
+ className: "neeto-ui-text-gray-800 mb-3 flex items-center space-x-4 font-medium",
242
+ ref: provided.innerRef
243
+ }, provided.draggableProps), provided.dragHandleProps), {}, {
244
+ style: getDragItemStyle(snapshot.isDragging, provided.draggableProps.style),
245
+ children: [/*#__PURE__*/jsxRuntime.jsx(Reorder, {}), /*#__PURE__*/jsxRuntime.jsx("div", {
246
+ className: "neeto-ui-bg-white neeto-ui-border-gray-400 neeto-ui-rounded neeto-ui-shadow-xs flex w-96 items-center space-x-4 border border-solid p-3",
247
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
248
+ children: reorderedRules[rubric.source.index].name
249
+ })
250
+ })]
251
+ }), "list_".concat(reorderedRules[rubric.source.index].id));
252
+ },
253
+ children: function children(provided) {
254
+ return /*#__PURE__*/jsxRuntime.jsxs("div", _objectSpread(_objectSpread({}, provided.droppableProps), {}, {
255
+ ref: provided.innerRef,
256
+ children: [reorderedRules.map(function (rule, index) {
257
+ return /*#__PURE__*/react.createElement(DraggableItem$1, {
258
+ rule: rule,
259
+ key: rule.id,
260
+ ruleIndex: index
261
+ });
262
+ }), provided.placeholder]
263
+ }));
264
+ }
265
+ })
266
+ })
267
+ })]
268
+ }), /*#__PURE__*/jsxRuntime.jsxs(Pane.Footer, {
269
+ className: "flex items-center gap-x-2",
270
+ children: [/*#__PURE__*/jsxRuntime.jsx(Button, {
271
+ disabled: isPending || ramda.equals(rules, reorderedRules),
272
+ label: t("neetoRules.common.saveChange"),
273
+ loading: isPending,
274
+ style: "primary",
275
+ onClick: handleReorderSave
276
+ }), /*#__PURE__*/jsxRuntime.jsx(Button, {
277
+ label: t("neetoRules.buttons.cancel"),
278
+ style: "text",
279
+ onClick: onClose
280
+ })]
281
+ })]
282
+ });
283
+ };
284
+
285
+ exports.INITIAL_RULES_DATA = INITIAL_RULES_DATA;
286
+ exports.RulesReorder = RulesReorder;
287
+ exports.useCloneAutomationRule = useCloneAutomationRule;
288
+ exports.useDeleteAutomationRule = useDeleteAutomationRule;
289
+ exports.useFetchAutomationRules = useFetchAutomationRules;
290
+ exports.useUpdateAutomationRule = useUpdateAutomationRule;
291
+ //# sourceMappingURL=index-DGlpB-_C.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-DGlpB-_C.js","sources":["../app/javascript/src/apis/automation_rules.js","../app/javascript/src/hooks/reactQuery/useAutomationRulesApi.js","../app/javascript/src/components/NeetoRules/constants.js","../app/javascript/src/components/NeetoRules/RulesReorder/utils.js","../app/javascript/src/components/NeetoRules/RulesReorder/DraggableItem.jsx","../app/javascript/src/components/NeetoRules/RulesReorder/index.jsx"],"sourcesContent":["import axios from \"axios\";\n\nconst fetch = ({ url, ...params }) => axios.get(url, { params });\n\nconst update = ({ url, id, payload }) => axios.patch(`${url}/${id}`, payload);\n\nconst clone = ({ url, id }) => axios.post(`${url}/${id}/clone`);\n\nconst destroy = ({ url, id }) => axios.delete(`${url}/${id}`);\n\nconst reorder = ({ url, payload }) => axios.patch(`${url}/reorder`, payload);\n\nconst automationRulesApi = { fetch, update, clone, destroy, reorder };\n\nexport default automationRulesApi;\n","import { keepPreviousData, useQuery } from \"@tanstack/react-query\";\nimport { useMutationWithInvalidation } from \"neetocommons/react-utils\";\n\nimport automationRulesApi from \"apis/automation_rules\";\nimport { AUTOMATION_RULES, STALE_TIME } from \"common/constants\";\n\nconst useFetchAutomationRules = (params, options = {}) =>\n useQuery({\n queryKey: [AUTOMATION_RULES, params.url, params],\n queryFn: () => automationRulesApi.fetch(params),\n staleTime: STALE_TIME,\n select: response => response.data || response,\n placeholderData: keepPreviousData,\n ...options,\n });\n\nconst useUpdateAutomationRule = url =>\n useMutationWithInvalidation(automationRulesApi.update, {\n keysToInvalidate: [[AUTOMATION_RULES, url]],\n });\n\nconst useCloneAutomationRule = url =>\n useMutationWithInvalidation(automationRulesApi.clone, {\n keysToInvalidate: [[AUTOMATION_RULES, url]],\n });\n\nconst useDeleteAutomationRule = url =>\n useMutationWithInvalidation(automationRulesApi.destroy, {\n keysToInvalidate: [[AUTOMATION_RULES, url]],\n });\n\nconst useReorderAutomationRules = url =>\n useMutationWithInvalidation(automationRulesApi.reorder, {\n keysToInvalidate: [[AUTOMATION_RULES, url]],\n });\nexport {\n useFetchAutomationRules,\n useUpdateAutomationRule,\n useCloneAutomationRule,\n useDeleteAutomationRule,\n useReorderAutomationRules,\n};\n","export const STATUS_KEYS = { ENABLED: \"enabled\", DISABLED: \"disabled\" };\n\nexport const DEFAULT_INIT_PAGE = 1;\n\nexport const INITIAL_RULES_DATA = { rules: [], totalCount: 0 };\n","export const reorderList = ({\n endIndex,\n firstDisplayOrder,\n list,\n startIndex,\n}) => {\n const result = Array.from(list);\n const [removed] = result.splice(startIndex, 1);\n result.splice(endIndex, 0, removed);\n\n return result.map((item, index) => ({\n ...item,\n displayOrder: firstDisplayOrder + index,\n }));\n};\n\nexport const getDragItemStyle = (isDragging, draggableStyle) => ({\n // styles we need to apply on draggables\n ...draggableStyle,\n\n ...(isDragging && { zIndex: 99999 }),\n});\n","import { Draggable } from \"@hello-pangea/dnd\";\nimport { Reorder } from \"neetoicons\";\nimport { withRouter } from \"react-router-dom\";\n\nimport { getDragItemStyle } from \"./utils\";\n\nconst DraggableItem = props => {\n const { rule, ruleIndex } = props;\n\n return (\n <Draggable draggableId={`item_${rule.id}`} index={ruleIndex}>\n {(provided, snapshot) => (\n <div\n className=\"neeto-ui-text-gray-800 mb-3 flex items-center space-x-4 font-medium\"\n key={`list_${rule.id}`}\n ref={provided.innerRef}\n {...provided.draggableProps}\n {...provided.dragHandleProps}\n style={getDragItemStyle(\n snapshot.isDragging,\n provided.draggableProps.style\n )}\n >\n <Reorder />\n <div\n className=\"neeto-ui-bg-white neeto-ui-border-gray-400 neeto-ui-rounded neeto-ui-shadow-xs flex w-96 items-center space-x-4 border border-solid p-3\"\n data-cy=\"automation-rule-reorder-container\"\n >\n {rule.name}\n </div>\n </div>\n )}\n </Draggable>\n );\n};\n\nexport default withRouter(DraggableItem);\n","import { useEffect, useState } from \"react\";\n\nimport { DragDropContext, Droppable } from \"@hello-pangea/dnd\";\nimport { Reorder as NeetoUIReorderIcon } from \"neetoicons\";\nimport { Pane, Typography, Button, Spinner } from \"neetoui\";\nimport { clone, equals } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport {\n useFetchAutomationRules,\n useReorderAutomationRules,\n} from \"hooks/reactQuery/useAutomationRulesApi\";\n\nimport DraggableItem from \"./DraggableItem\";\nimport { getDragItemStyle, reorderList } from \"./utils\";\n\nimport { INITIAL_RULES_DATA } from \"../constants\";\n\nconst RulesReorder = ({\n isOpen,\n totalCount,\n url,\n onClose,\n onReorderSuccess,\n}) => {\n const [reorderedRules, setReorderedRules] = useState([]);\n\n const { t } = useTranslation();\n\n const { data: { rules } = INITIAL_RULES_DATA, isLoading } =\n useFetchAutomationRules({ pageSize: totalCount, url }, { enabled: isOpen });\n\n const { mutate: reOrder, isPending } = useReorderAutomationRules(url);\n\n const firstDisplayOrder = rules[0]?.displayOrder ?? 1;\n\n const handleReorderSave = () =>\n reOrder(\n { url, payload: { reorder: { rules: reorderedRules } } },\n {\n onSuccess: () => {\n onReorderSuccess?.();\n onClose();\n },\n }\n );\n\n const onDragEnd = ({ destination, source }) => {\n if (!destination || source.index === destination.index) return;\n\n const items = reorderList({\n endIndex: destination.index,\n firstDisplayOrder,\n list: clone(reorderedRules),\n startIndex: source.index,\n });\n setReorderedRules(items);\n };\n\n useEffect(() => {\n setReorderedRules(rules);\n }, [rules]);\n\n if (isLoading) {\n return (\n <Pane {...{ isOpen, onClose }}>\n <div className=\"flex h-full w-full items-center justify-center\">\n <Spinner />\n </div>\n </Pane>\n );\n }\n\n return (\n <Pane {...{ isOpen, onClose }}>\n <Pane.Header>\n <Typography style=\"h2\" weight=\"semibold\">\n {t(\"neetoRules.common.reorder\")}\n </Typography>\n </Pane.Header>\n <Pane.Body>\n <Typography className=\"mb-3\" style=\"body2\">\n {t(\"neetoRules.description.reorder\")}\n </Typography>\n <div className=\"flex flex-col items-center\">\n <DragDropContext {...{ onDragEnd }}>\n <Droppable\n droppableId=\"droppable\"\n renderClone={(provided, snapshot, rubric) => (\n <div\n className=\"neeto-ui-text-gray-800 mb-3 flex items-center space-x-4 font-medium\"\n key={`list_${reorderedRules[rubric.source.index].id}`}\n ref={provided.innerRef}\n {...provided.draggableProps}\n {...provided.dragHandleProps}\n style={getDragItemStyle(\n snapshot.isDragging,\n provided.draggableProps.style\n )}\n >\n <NeetoUIReorderIcon />\n <div className=\"neeto-ui-bg-white neeto-ui-border-gray-400 neeto-ui-rounded neeto-ui-shadow-xs flex w-96 items-center space-x-4 border border-solid p-3\">\n <div>{reorderedRules[rubric.source.index].name}</div>\n </div>\n </div>\n )}\n >\n {provided => (\n <div {...provided.droppableProps} ref={provided.innerRef}>\n {reorderedRules.map((rule, index) => (\n <DraggableItem\n {...{ rule }}\n key={rule.id}\n ruleIndex={index}\n />\n ))}\n {provided.placeholder}\n </div>\n )}\n </Droppable>\n </DragDropContext>\n </div>\n </Pane.Body>\n <Pane.Footer className=\"flex items-center gap-x-2\">\n <Button\n disabled={isPending || equals(rules, reorderedRules)}\n label={t(\"neetoRules.common.saveChange\")}\n loading={isPending}\n style=\"primary\"\n onClick={handleReorderSave}\n />\n <Button\n label={t(\"neetoRules.buttons.cancel\")}\n style=\"text\"\n onClick={onClose}\n />\n </Pane.Footer>\n </Pane>\n );\n};\nexport default RulesReorder;\n"],"names":["fetch","_ref","url","params","_objectWithoutProperties","_excluded","axios","get","update","_ref2","id","payload","patch","concat","clone","_ref3","post","destroy","_ref4","reorder","_ref5","automationRulesApi","useFetchAutomationRules","options","arguments","length","undefined","useQuery","_objectSpread","queryKey","AUTOMATION_RULES","queryFn","staleTime","STALE_TIME","select","response","data","placeholderData","keepPreviousData","useUpdateAutomationRule","useMutationWithInvalidation","keysToInvalidate","useCloneAutomationRule","useDeleteAutomationRule","useReorderAutomationRules","INITIAL_RULES_DATA","rules","totalCount","reorderList","endIndex","firstDisplayOrder","list","startIndex","result","Array","from","_result$splice","splice","_result$splice2","_slicedToArray","removed","map","item","index","displayOrder","getDragItemStyle","isDragging","draggableStyle","zIndex","DraggableItem","props","rule","ruleIndex","_jsx","Draggable","draggableId","children","provided","snapshot","_jsxs","className","ref","innerRef","draggableProps","dragHandleProps","style","Reorder","name","withRouter","RulesReorder","_rules$0$displayOrder","_rules$","isOpen","onClose","onReorderSuccess","_useState","useState","_useState2","reorderedRules","setReorderedRules","_useTranslation","useTranslation","t","_useFetchAutomationRu","pageSize","enabled","_useFetchAutomationRu2","_useFetchAutomationRu3","isLoading","_useReorderAutomation","reOrder","mutate","isPending","handleReorderSave","onSuccess","onDragEnd","destination","source","items","useEffect","Pane","Spinner","Header","Typography","weight","Body","DragDropContext","Droppable","droppableId","renderClone","rubric","NeetoUIReorderIcon","droppableProps","_createElement","key","placeholder","Footer","Button","disabled","equals","label","loading","onClick"],"mappings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,MAAM,EAAA;AACLG,QAAAA,KAAK,EAAEtC,CAAC,CAAC,2BAA2B,CAAE;AACtCjB,QAAAA,KAAK,EAAC,MAAM;AACZyD,QAAAA,OAAO,EAAEjD;AAAQ,OAClB,CAAC;AAAA,KACS,CAAC;AAAA,GACV,CAAC;AAEX;;;;;;;;;"}
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  export { A as AUTOMATION_RULES_QUERY_KEY } from './index-9h4B7JZZ.js';
2
2
  export { default as CannedResponsesPane } from './CannedResponsesPane.js';
3
3
  export { default as NeetoRules } from './NeetoRules.js';
4
+ export { R as RulesReorder } from './index-CYeamuNR.js';
4
5
  export { u as useCustomDataStore } from './useCustomDataStore-B1qHMIGJ.js';
5
6
  export { default as NeetoRulesForm } from './NeetoRulesForm.js';
6
7
  export { default as RulePreview } from './RulePreview.js';
@@ -27,15 +28,9 @@ import '@bigbinary/neetoui/Label';
27
28
  import 'react/jsx-runtime';
28
29
  import '@bigbinary/neeto-commons-frontend/react-utils';
29
30
  import '@bigbinary/neeto-molecules/Container';
30
- import '@tanstack/react-query';
31
- import '@babel/runtime/helpers/objectWithoutProperties';
32
- import 'axios';
33
31
  import '@bigbinary/neeto-molecules/Header';
34
32
  import '@bigbinary/neetoui/Button';
35
33
  import './utils-CvS2p6ZS.js';
36
- import '@hello-pangea/dnd';
37
- import '@bigbinary/neeto-icons/Reorder';
38
- import 'react-router-dom';
39
34
  import 'zustand/shallow';
40
35
  import '@bigbinary/neeto-molecules/SubHeader';
41
36
  import '@bigbinary/neeto-molecules/TableWrapper';
@@ -44,10 +39,16 @@ import '@bigbinary/neetoui/Table';
44
39
  import '@bigbinary/neetoui/NoData';
45
40
  import './useUtilityStore-KjKihXb0.js';
46
41
  import 'zustand';
42
+ import '@babel/runtime/helpers/objectWithoutProperties';
47
43
  import '@bigbinary/neeto-commons-frontend/utils';
48
44
  import '@bigbinary/neeto-molecules/MoreDropdown';
49
45
  import '@bigbinary/neetoui/Switch';
50
46
  import '@bigbinary/neetoui/Tooltip';
47
+ import '@hello-pangea/dnd';
48
+ import '@bigbinary/neeto-icons/Reorder';
49
+ import '@tanstack/react-query';
50
+ import 'axios';
51
+ import 'react-router-dom';
51
52
  import '@babel/runtime/helpers/objectDestructuringEmpty';
52
53
  import '@bigbinary/neeto-icons/Plus';
53
54
  import '@bigbinary/neeto-icons/Delete';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/neeto-rules-frontend",
3
- "version": "2.5.12",
3
+ "version": "2.5.14",
4
4
  "description": "A repo acts as the source of truth for the new nano's structure, configs, data etc.",
5
5
  "license": "UNLICENSED",
6
6
  "homepage": "https://github.com/bigbinary/neeto-rules-nano",
@@ -59,15 +59,15 @@
59
59
  "@babel/preset-typescript": "7.26.0",
60
60
  "@babel/runtime": "7.26.0",
61
61
  "@bigbinary/babel-preset-neeto": "^1.0.3",
62
- "@bigbinary/eslint-plugin-neeto": "1.5.7",
62
+ "@bigbinary/eslint-plugin-neeto": "1.5.8",
63
63
  "@bigbinary/neeto-cist": "1.0.15",
64
- "@bigbinary/neeto-commons-frontend": "4.13.23",
65
- "@bigbinary/neeto-editor": "1.45.13",
64
+ "@bigbinary/neeto-commons-frontend": "4.13.26",
65
+ "@bigbinary/neeto-editor": "1.45.21",
66
66
  "@bigbinary/neeto-filters-frontend": "4.3.15",
67
67
  "@bigbinary/neeto-hotkeys": "1.0.9",
68
- "@bigbinary/neeto-icons": "1.20.26",
69
- "@bigbinary/neeto-molecules": "3.15.35",
70
- "@bigbinary/neetoui": "8.2.64",
68
+ "@bigbinary/neeto-icons": "1.20.29",
69
+ "@bigbinary/neeto-molecules": "3.15.57",
70
+ "@bigbinary/neetoui": "8.2.74",
71
71
  "@emotion/is-prop-valid": "1.2.0",
72
72
  "@faker-js/faker": "8.2.0",
73
73
  "@hello-pangea/dnd": "16.3.0",
@@ -174,13 +174,13 @@
174
174
  "peerDependencies": {
175
175
  "@babel/runtime": "7.26.0",
176
176
  "@bigbinary/neeto-cist": "1.0.15",
177
- "@bigbinary/neeto-commons-frontend": "4.13.23",
178
- "@bigbinary/neeto-editor": "1.45.13",
177
+ "@bigbinary/neeto-commons-frontend": "4.13.26",
178
+ "@bigbinary/neeto-editor": "1.45.21",
179
179
  "@bigbinary/neeto-filters-frontend": "4.3.15",
180
180
  "@bigbinary/neeto-hotkeys": "1.0.9",
181
- "@bigbinary/neeto-icons": "1.20.26",
182
- "@bigbinary/neeto-molecules": "3.15.35",
183
- "@bigbinary/neetoui": "8.2.64",
181
+ "@bigbinary/neeto-icons": "1.20.29",
182
+ "@bigbinary/neeto-molecules": "3.15.57",
183
+ "@bigbinary/neetoui": "8.2.74",
184
184
  "@hello-pangea/dnd": "16.3.0",
185
185
  "@honeybadger-io/js": "6.10.1",
186
186
  "@honeybadger-io/react": "6.1.25",