jamespot-front-business 1.1.81 → 1.1.82

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.js CHANGED
@@ -53,6 +53,10 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
53
53
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
54
54
  };
55
55
 
56
+ const isAbortError = (error) => {
57
+ return !!error && typeof error === 'object' && 'aborted' in error && !!error.aborted;
58
+ };
59
+
56
60
  const toastAdapter = toolkit.createEntityAdapter({
57
61
  selectId: (toast) => toast.id,
58
62
  });
@@ -90,8 +94,234 @@ const Toast = {
90
94
  selectors: selectors$3,
91
95
  };
92
96
 
93
- const isAbortError = (error) => {
94
- return !!error && typeof error === 'object' && 'aborted' in error && !!error.aborted;
97
+ const formatDate$2 = (date) => date.toISOString().slice(0, 19).replace(/T/g, ' ');
98
+ const oneMonthAgo$2 = () => {
99
+ const date = new Date();
100
+ date.setMonth(date.getMonth() - 1);
101
+ return date;
102
+ };
103
+ const initialState$p = {
104
+ data: [],
105
+ loading: 'idle',
106
+ page: 1,
107
+ filters: [
108
+ {
109
+ name: 'dateCreation',
110
+ method: 'between',
111
+ value: {
112
+ start: formatDate$2(oneMonthAgo$2()),
113
+ end: formatDate$2(new Date()),
114
+ }
115
+ }
116
+ ],
117
+ orders: [],
118
+ limit: 30,
119
+ nbResults: 0,
120
+ };
121
+ const fetchLogsNavigation = toolkit.createAsyncThunk('admin/fetchLogsNavigation', (params, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
122
+ try {
123
+ const logs = (yield extra.jApi.admin.logs.getLogsNavigation(params)).result;
124
+ return logs;
125
+ }
126
+ catch (err) {
127
+ if (!isAbortError(err)) {
128
+ dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
129
+ }
130
+ return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve admin logs navigation' });
131
+ }
132
+ }));
133
+ const adminLogsNavigationSlice = toolkit.createSlice({
134
+ name: 'logsNavigation',
135
+ initialState: initialState$p,
136
+ reducers: {
137
+ setNavigationOrder: (state, action) => {
138
+ state.orders = [...action.payload];
139
+ state.page = 1;
140
+ },
141
+ setNavigationFilter: (state, action) => {
142
+ state.filters = [...action.payload];
143
+ state.page = 1;
144
+ },
145
+ setNavigationPage: (state, action) => {
146
+ state.page = action.payload;
147
+ },
148
+ },
149
+ extraReducers: (builder) => {
150
+ builder.addCase(fetchLogsNavigation.pending, (state) => {
151
+ state.loading = 'pending';
152
+ });
153
+ builder.addCase(fetchLogsNavigation.fulfilled, (state, action) => {
154
+ var _a;
155
+ state.data = action.payload.data;
156
+ state.nbResults = action.payload.cnt;
157
+ state.limit = (_a = action.payload.limit) !== null && _a !== void 0 ? _a : 30;
158
+ state.page = action.payload.page;
159
+ state.loading = 'idle';
160
+ });
161
+ builder.addCase(fetchLogsNavigation.rejected, (state) => {
162
+ state.loading = 'idle';
163
+ });
164
+ },
165
+ });
166
+
167
+ const formatDate$1 = (date) => date.toISOString().slice(0, 19).replace(/T/g, ' ');
168
+ const oneMonthAgo$1 = () => {
169
+ const date = new Date();
170
+ date.setMonth(date.getMonth() - 1);
171
+ return date;
172
+ };
173
+ const initialState$o = {
174
+ data: [],
175
+ loading: 'idle',
176
+ page: 1,
177
+ filters: [
178
+ {
179
+ name: 'dateCreation',
180
+ method: 'between',
181
+ value: {
182
+ start: formatDate$1(oneMonthAgo$1()),
183
+ end: formatDate$1(new Date()),
184
+ }
185
+ }
186
+ ],
187
+ orders: [],
188
+ limit: 30,
189
+ nbResults: 0,
190
+ };
191
+ const fetchLogsObjects = toolkit.createAsyncThunk('admin/fetchLogsObjects', (params, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
192
+ try {
193
+ const logs = (yield extra.jApi.admin.logs.getLogsObjects(params)).result;
194
+ return logs;
195
+ }
196
+ catch (err) {
197
+ if (!isAbortError(err)) {
198
+ dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
199
+ }
200
+ return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve admin logs Objects' });
201
+ }
202
+ }));
203
+ const adminLogsObjectsSlice = toolkit.createSlice({
204
+ name: 'logsObjects',
205
+ initialState: initialState$o,
206
+ reducers: {
207
+ setObjectsOrder: (state, action) => {
208
+ state.orders = [...action.payload];
209
+ state.page = 1;
210
+ },
211
+ setObjectsFilter: (state, action) => {
212
+ state.filters = [...action.payload];
213
+ state.page = 1;
214
+ },
215
+ setObjectsPage: (state, action) => {
216
+ state.page = action.payload;
217
+ },
218
+ },
219
+ extraReducers: (builder) => {
220
+ builder.addCase(fetchLogsObjects.pending, (state) => {
221
+ state.loading = 'pending';
222
+ });
223
+ builder.addCase(fetchLogsObjects.fulfilled, (state, action) => {
224
+ state.data = action.payload.data;
225
+ state.nbResults = action.payload.cnt;
226
+ state.limit = action.payload.limit || 30;
227
+ state.page = action.payload.page;
228
+ state.loading = 'idle';
229
+ });
230
+ builder.addCase(fetchLogsObjects.rejected, (state) => {
231
+ state.loading = 'idle';
232
+ });
233
+ },
234
+ });
235
+
236
+ const formatDate = (date) => date.toISOString().slice(0, 19).replace(/T/g, ' ');
237
+ const oneMonthAgo = () => {
238
+ const date = new Date();
239
+ date.setMonth(date.getMonth() - 1);
240
+ return date;
241
+ };
242
+ const initialState$n = {
243
+ data: [],
244
+ loading: 'idle',
245
+ page: 1,
246
+ filters: [
247
+ {
248
+ name: 'dateCreation',
249
+ method: 'between',
250
+ value: {
251
+ start: formatDate(oneMonthAgo()),
252
+ end: formatDate(new Date()),
253
+ }
254
+ }
255
+ ],
256
+ orders: [],
257
+ limit: 30,
258
+ nbResults: 0,
259
+ };
260
+ const fetchLogsSearch = toolkit.createAsyncThunk('admin/fetchLogsSearch', (params, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
261
+ try {
262
+ const logs = (yield extra.jApi.admin.logs.getLogsSearch(params)).result;
263
+ return logs;
264
+ }
265
+ catch (err) {
266
+ if (!isAbortError(err)) {
267
+ dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
268
+ }
269
+ return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve admin logs Search' });
270
+ }
271
+ }));
272
+ const adminLogsSearchSlice = toolkit.createSlice({
273
+ name: 'logsSearch',
274
+ initialState: initialState$n,
275
+ reducers: {
276
+ setSearchOrder: (state, action) => {
277
+ state.orders = [...action.payload];
278
+ state.page = 1;
279
+ },
280
+ setSearchFilter: (state, action) => {
281
+ state.filters = [...action.payload];
282
+ state.page = 1;
283
+ },
284
+ setSearchPage: (state, action) => {
285
+ state.page = action.payload;
286
+ },
287
+ },
288
+ extraReducers: (builder) => {
289
+ builder.addCase(fetchLogsSearch.pending, (state) => {
290
+ state.loading = 'pending';
291
+ });
292
+ builder.addCase(fetchLogsSearch.fulfilled, (state, action) => {
293
+ var _a;
294
+ state.data = action.payload.data;
295
+ state.nbResults = action.payload.cnt;
296
+ state.limit = (_a = action.payload.limit) !== null && _a !== void 0 ? _a : 30;
297
+ state.page = action.payload.page;
298
+ state.loading = 'idle';
299
+ });
300
+ builder.addCase(fetchLogsSearch.rejected, (state) => {
301
+ state.loading = 'idle';
302
+ });
303
+ },
304
+ });
305
+
306
+ const selectAdminLogsNavigation = (state) => state.adminLogs.logsNavigation;
307
+ const selectAdminLogsObjects = (state) => state.adminLogs.logsObjects;
308
+ const selectAdminLogsSearch = (state) => state.adminLogs.logsSearch;
309
+ const adminLogsSliceReducer = toolkit.combineReducers({
310
+ [adminLogsNavigationSlice.name]: adminLogsNavigationSlice.reducer,
311
+ [adminLogsObjectsSlice.name]: adminLogsObjectsSlice.reducer,
312
+ [adminLogsSearchSlice.name]: adminLogsSearchSlice.reducer,
313
+ });
314
+ const adminLogsSlice = {
315
+ name: 'adminLogs',
316
+ reducer: adminLogsSliceReducer,
317
+ };
318
+ const adminLogsReducer = adminLogsSlice.reducer;
319
+ const AdminLogs = {
320
+ slice: adminLogsSlice,
321
+ actions: Object.assign(Object.assign(Object.assign(Object.assign({}, adminLogsNavigationSlice.actions), adminLogsObjectsSlice.actions), adminLogsSearchSlice.actions), { fetchLogsNavigation,
322
+ fetchLogsObjects,
323
+ fetchLogsSearch }),
324
+ selectors: { selectAdminLogsNavigation, selectAdminLogsObjects, selectAdminLogsSearch },
95
325
  };
96
326
 
97
327
  const initialState$m = {
@@ -5213,6 +5443,7 @@ const studio = {
5213
5443
 
5214
5444
  exports.APP_STATUS_TYPE = APP_STATUS_TYPE;
5215
5445
  exports.AUDIENCE = AUDIENCE;
5446
+ exports.AdminLogs = AdminLogs;
5216
5447
  exports.Animations = Animations;
5217
5448
  exports.AppColumnsDefaultTypes = AppColumnsDefaultTypes;
5218
5449
  exports.AppFieldFormPropertyTypes = AppFieldFormPropertyTypes;
@@ -5251,6 +5482,8 @@ exports.WedocApp = WedocApp;
5251
5482
  exports.Widget = Widget;
5252
5483
  exports.WidgetEditor = WidgetEditor;
5253
5484
  exports.actions = actions;
5485
+ exports.adminLogsReducer = adminLogsReducer;
5486
+ exports.adminLogsSlice = adminLogsSlice;
5254
5487
  exports.animationsReducer = animationsReducer;
5255
5488
  exports.animationsSlice = animationsSlice;
5256
5489
  exports.fetchMediaLibraryConfig = fetchMediaLibraryConfig;