jamespot-front-business 1.1.90 → 1.1.91

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/esm.js CHANGED
@@ -49,9 +49,16 @@ const isAbortError = (error) => {
49
49
  return !!error && typeof error === 'object' && 'aborted' in error && !!error.aborted;
50
50
  };
51
51
  const getErrorMessage = (error, defaultError) => {
52
- return error && typeof error === 'object' && 'errorMsg' in error && typeof error.errorMsg === 'string'
53
- ? error.errorMsg
54
- : defaultError !== null && defaultError !== void 0 ? defaultError : 'GLOBAL_Technical_Error';
52
+ if (!error || typeof error !== 'object') {
53
+ return defaultError !== null && defaultError !== void 0 ? defaultError : 'GLOBAL_Technical_Error';
54
+ }
55
+ if ('errorMsg' in error && typeof error.errorMsg === 'string') {
56
+ return error.errorMsg;
57
+ }
58
+ if ('message' in error && typeof error.message === 'string') {
59
+ return error.message;
60
+ }
61
+ return defaultError !== null && defaultError !== void 0 ? defaultError : 'GLOBAL_Technical_Error';
55
62
  };
56
63
 
57
64
  const toastAdapter = createEntityAdapter({
@@ -122,7 +129,7 @@ const fetchLogsNavigation = createAsyncThunk('admin/fetchLogsNavigation', (param
122
129
  }
123
130
  catch (err) {
124
131
  if (!isAbortError(err)) {
125
- dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
132
+ dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
126
133
  }
127
134
  return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve admin logs navigation' });
128
135
  }
@@ -192,7 +199,7 @@ const fetchLogsObjects = createAsyncThunk('admin/fetchLogsObjects', (params, { e
192
199
  }
193
200
  catch (err) {
194
201
  if (!isAbortError(err)) {
195
- dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
202
+ dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
196
203
  }
197
204
  return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve admin logs Objects' });
198
205
  }
@@ -261,7 +268,7 @@ const fetchLogsSearch = createAsyncThunk('admin/fetchLogsSearch', (params, { ext
261
268
  }
262
269
  catch (err) {
263
270
  if (!isAbortError(err)) {
264
- dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
271
+ dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
265
272
  }
266
273
  return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve admin logs Search' });
267
274
  }
@@ -361,7 +368,7 @@ const fetchCurrentAnimation = createAsyncThunk('animations/fetchCurrentAnimation
361
368
  }
362
369
  catch (err) {
363
370
  if (!isAbortError(err)) {
364
- dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
371
+ dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
365
372
  }
366
373
  return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve animation' });
367
374
  }
@@ -370,8 +377,8 @@ const fetchCurrentAnimationApp = createAsyncThunk('animations/fetchCurrentAnimat
370
377
  try {
371
378
  return (yield extra.jApi.animations.GetCurrentAnimationApp()).result;
372
379
  }
373
- catch (_) {
374
- dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
380
+ catch (err) {
381
+ dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
375
382
  return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve animation' });
376
383
  }
377
384
  }));
@@ -380,8 +387,8 @@ const deleteCurrentAnimation = createAsyncThunk('animations/deleteCurrentAnimati
380
387
  yield extra.jApi.animations.DeleteAnimation();
381
388
  return;
382
389
  }
383
- catch (_) {
384
- dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
390
+ catch (err) {
391
+ dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
385
392
  return rejectWithValue({ error: 1, errorMsg: 'Cannot delete animation' });
386
393
  }
387
394
  }));
@@ -390,8 +397,8 @@ const saveCurrentAnimation = createAsyncThunk('animations/saveCurrentAnimation',
390
397
  yield extra.jApi.animations.SaveAnimationConfiguration(params);
391
398
  return;
392
399
  }
393
- catch (_) {
394
- dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
400
+ catch (err) {
401
+ dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
395
402
  return rejectWithValue({ error: 1, errorMsg: 'Cannot update animation' });
396
403
  }
397
404
  }));
@@ -400,8 +407,8 @@ const toggleAnimationIsActive = createAsyncThunk('animations/toggleAnimationIsAc
400
407
  yield extra.jApi.animations.ToggleAnimationActive();
401
408
  return;
402
409
  }
403
- catch (_) {
404
- dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
410
+ catch (err) {
411
+ dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
405
412
  return rejectWithValue({ error: 1, errorMsg: 'Cannot update animation' });
406
413
  }
407
414
  }));
@@ -448,8 +455,8 @@ const fetchAnimationStats = createAsyncThunk('animations/fetchAnimationStats', (
448
455
  const stats = (yield extra.jApi.animations.GetAnimationStats(name)).result.data;
449
456
  return stats;
450
457
  }
451
- catch (_) {
452
- dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
458
+ catch (err) {
459
+ dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
453
460
  return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve animation stats' });
454
461
  }
455
462
  }));
@@ -480,8 +487,8 @@ const fetchAnimationStatsCurrent = createAsyncThunk('animations/fetchAnimationSt
480
487
  const stats = (yield extra.jApi.animations.GetAnimationStatsCurrent(uri)).result;
481
488
  return stats;
482
489
  }
483
- catch (_) {
484
- dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
490
+ catch (err) {
491
+ dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
485
492
  return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve animation stats current' });
486
493
  }
487
494
  }));
@@ -845,13 +852,12 @@ const fetchBookmark = createAsyncThunk('bookmarkList/fetchbookmarkList', (_, { e
845
852
  try {
846
853
  return yield extra.jApi.bookmark.getFormattedList(filterSpec, 'raw-list');
847
854
  }
848
- catch (_) {
849
- dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
855
+ catch (err) {
856
+ dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
850
857
  return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve bookmarks' });
851
858
  }
852
859
  }));
853
860
  const addBookmark = createAsyncThunk('bookmarkList/addBookmark', (bookmark, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
854
- var _a;
855
861
  try {
856
862
  if (jEnsure.isBookmarkLink(bookmark)) {
857
863
  const result = yield extra.jApi.bookmark.addFormattedLink(bookmark.targetId, bookmark.targetType, 'raw-list');
@@ -863,7 +869,7 @@ const addBookmark = createAsyncThunk('bookmarkList/addBookmark', (bookmark, { ex
863
869
  }
864
870
  }
865
871
  catch (error) {
866
- const toastLabel = (_a = error.errorMsg) !== null && _a !== void 0 ? _a : 'GLOBAL_Technical_Error';
872
+ const toastLabel = getErrorMessage(error);
867
873
  dispatch(Toast.actions.error({ label: toastLabel }));
868
874
  return rejectWithValue({ error: 1, errorMsg: 'Error saving bookmark' });
869
875
  }
@@ -873,8 +879,8 @@ const moveBookmark = createAsyncThunk('bookmarkList/moveBookmark', ({ bookmark,
873
879
  yield extra.jApi.bookmark.move(bookmark.id, bookmarkReference.id, position);
874
880
  return;
875
881
  }
876
- catch (_) {
877
- dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
882
+ catch (err) {
883
+ dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
878
884
  return rejectWithValue({ error: 1, errorMsg: 'Error moving bookmark' });
879
885
  }
880
886
  }));
@@ -883,8 +889,8 @@ const deleteBookmark = createAsyncThunk('bookmarkList/deleteBookmark', (bookmark
883
889
  yield extra.jApi.bookmark.delete(bookmark.id);
884
890
  return;
885
891
  }
886
- catch (_) {
887
- dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
892
+ catch (err) {
893
+ dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
888
894
  return rejectWithValue({ error: 1, errorMsg: 'Error deleting bookmark' });
889
895
  }
890
896
  }));
@@ -1139,7 +1145,6 @@ const initialState$h = {
1139
1145
  comments: [],
1140
1146
  };
1141
1147
  const fetchComments = createAsyncThunk('commentList/fetchCommentList', (params, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
1142
- var _a;
1143
1148
  try {
1144
1149
  const res = yield extra.jApi.article.getComments(params, {
1145
1150
  format: 'raw-list',
@@ -1148,18 +1153,17 @@ const fetchComments = createAsyncThunk('commentList/fetchCommentList', (params,
1148
1153
  return { idArticle: params.idArticle, list: res.result };
1149
1154
  }
1150
1155
  catch (error) {
1151
- dispatch(Toast.actions.error({ label: (_a = error.errorMsg) !== null && _a !== void 0 ? _a : 'GLOBAL_Technical_Error' }));
1156
+ dispatch(Toast.actions.error({ label: getErrorMessage(error) }));
1152
1157
  return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve comments' });
1153
1158
  }
1154
1159
  }));
1155
1160
  const deleteComment = createAsyncThunk('commentList/deleteComment', (params, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
1156
- var _b;
1157
1161
  try {
1158
1162
  yield extra.jApi.article.deleteComment(params.idComment);
1159
1163
  return true;
1160
1164
  }
1161
1165
  catch (error) {
1162
- dispatch(Toast.actions.error({ label: (_b = error.errorMsg) !== null && _b !== void 0 ? _b : 'GLOBAL_Technical_Error' }));
1166
+ dispatch(Toast.actions.error({ label: getErrorMessage(error) }));
1163
1167
  return rejectWithValue({ error: 1, errorMsg: 'Cannot delete comment' });
1164
1168
  }
1165
1169
  }));
@@ -2086,7 +2090,6 @@ const magicPadSlice = createSlice({
2086
2090
  },
2087
2091
  });
2088
2092
  const fetchPads = createAsyncThunk('magicPad/fetchPads', (params, { extra, rejectWithValue, dispatch, getState }) => __awaiter(void 0, void 0, void 0, function* () {
2089
- var _a;
2090
2093
  try {
2091
2094
  const state = getState().magicPad;
2092
2095
  const page = state.page;
@@ -2114,7 +2117,7 @@ const fetchPads = createAsyncThunk('magicPad/fetchPads', (params, { extra, rejec
2114
2117
  })).result;
2115
2118
  }
2116
2119
  catch (error) {
2117
- dispatch(Toast.actions.error({ label: (_a = error.errorMsg) !== null && _a !== void 0 ? _a : 'GLOBAL_Technical_Error' }));
2120
+ dispatch(Toast.actions.error({ label: getErrorMessage(error) }));
2118
2121
  return rejectWithValue({ error: 1, errorMsg: 'Cannot fetch pads' });
2119
2122
  }
2120
2123
  }));
@@ -2238,7 +2241,6 @@ const mediaLibrarySlice = createSlice({
2238
2241
  },
2239
2242
  });
2240
2243
  const fetchMediaLibraryFolders = createAsyncThunk('MediaLibrary/fetchMediaLibraryFolders', (_, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
2241
- var _a;
2242
2244
  const args = {
2243
2245
  type: MediaLibraryAppConst.typeMediaLibraryFolder,
2244
2246
  format: 'raw-little',
@@ -2248,12 +2250,11 @@ const fetchMediaLibraryFolders = createAsyncThunk('MediaLibrary/fetchMediaLibrar
2248
2250
  return yield extra.jApi.article.list(args);
2249
2251
  }
2250
2252
  catch (error) {
2251
- dispatch(Toast.actions.error({ label: (_a = error.errorMsg) !== null && _a !== void 0 ? _a : 'GLOBAL_Technical_Error' }));
2253
+ dispatch(Toast.actions.error({ label: getErrorMessage(error) }));
2252
2254
  return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve folders' });
2253
2255
  }
2254
2256
  }));
2255
2257
  const fetchMediaLibraryUnclassifiedFiles = createAsyncThunk('MediaLibrary/fetchMediaLibraryUnclassifiedFiles', (page, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
2256
- var _b;
2257
2258
  try {
2258
2259
  return yield extra.jApi.mediaLibrary.GetUnclassifiedFiles({
2259
2260
  format: 'raw-little',
@@ -2262,47 +2263,43 @@ const fetchMediaLibraryUnclassifiedFiles = createAsyncThunk('MediaLibrary/fetchM
2262
2263
  });
2263
2264
  }
2264
2265
  catch (error) {
2265
- dispatch(Toast.actions.error({ label: (_b = error.errorMsg) !== null && _b !== void 0 ? _b : 'GLOBAL_Technical_Error' }));
2266
+ dispatch(Toast.actions.error({ label: getErrorMessage(error) }));
2266
2267
  return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve UnclassifiedFiles' });
2267
2268
  }
2268
2269
  }));
2269
2270
  const fetchMediaLibraryConfig = createAsyncThunk('MediaLibrary/fetchMediaLibraryConfig', (_, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
2270
- var _c;
2271
2271
  try {
2272
2272
  return yield extra.jApi.mediaLibrary.getAccess();
2273
2273
  }
2274
2274
  catch (error) {
2275
- dispatch(Toast.actions.error({ label: (_c = error.errorMsg) !== null && _c !== void 0 ? _c : 'GLOBAL_Technical_Error' }));
2275
+ dispatch(Toast.actions.error({ label: getErrorMessage(error) }));
2276
2276
  return rejectWithValue({ error: 1, errorMsg: 'Cannot get MediaLibrary Config' });
2277
2277
  }
2278
2278
  }));
2279
2279
  const fetchMediaLibraryFoldersStats = createAsyncThunk('MediaLibrary/fetchMediaLibraryFoldersStats', ({ page, filters, orders }, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
2280
- var _d;
2281
2280
  try {
2282
2281
  return yield extra.jApi.mediaLibrary.getFoldersStatsList(filters, orders, page);
2283
2282
  }
2284
2283
  catch (error) {
2285
- dispatch(Toast.actions.error({ label: (_d = error.errorMsg) !== null && _d !== void 0 ? _d : 'GLOBAL_Technical_Error' }));
2284
+ dispatch(Toast.actions.error({ label: getErrorMessage(error) }));
2286
2285
  return rejectWithValue({ error: 1, errorMsg: 'Cannot get MediaLibrary folders stats' });
2287
2286
  }
2288
2287
  }));
2289
2288
  const fetchMediaLibraryFilesStats = createAsyncThunk('MediaLibrary/fetchMediaLibraryFilesStats', ({ page, filters, orders }, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
2290
- var _e;
2291
2289
  try {
2292
2290
  return yield extra.jApi.mediaLibrary.getFilesStatsList(filters, orders, page);
2293
2291
  }
2294
2292
  catch (error) {
2295
- dispatch(Toast.actions.error({ label: (_e = error.errorMsg) !== null && _e !== void 0 ? _e : 'GLOBAL_Technical_Error' }));
2293
+ dispatch(Toast.actions.error({ label: getErrorMessage(error) }));
2296
2294
  return rejectWithValue({ error: 1, errorMsg: 'Cannot get MediaLibrary files stats' });
2297
2295
  }
2298
2296
  }));
2299
2297
  const fetchMediaLibraryStats = createAsyncThunk('MediaLibrary/fetchMediaLibraryStats', (_, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
2300
- var _f;
2301
2298
  try {
2302
2299
  return yield extra.jApi.mediaLibrary.getStats();
2303
2300
  }
2304
2301
  catch (error) {
2305
- dispatch(Toast.actions.error({ label: (_f = error.errorMsg) !== null && _f !== void 0 ? _f : 'GLOBAL_Technical_Error' }));
2302
+ dispatch(Toast.actions.error({ label: getErrorMessage(error) }));
2306
2303
  return rejectWithValue({ error: 1, errorMsg: 'Cannot get MediaLibrary stats' });
2307
2304
  }
2308
2305
  }));
@@ -5437,8 +5434,8 @@ const saveCurrentStudioApp = createAsyncThunk('studio/saveCurrentStudioApp', (_,
5437
5434
  dispatch(Toast.actions.success({ label: 'APPSTUDIO_AppItem_Edition_Saved' }));
5438
5435
  return;
5439
5436
  }
5440
- catch (_) {
5441
- dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
5437
+ catch (err) {
5438
+ dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
5442
5439
  return rejectWithValue(error);
5443
5440
  }
5444
5441
  }));
@@ -5457,8 +5454,8 @@ const installStudioApp = createAsyncThunk('studio/installApp', ({ callback }, {
5457
5454
  callback();
5458
5455
  return;
5459
5456
  }
5460
- catch (_) {
5461
- dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
5457
+ catch (err) {
5458
+ dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
5462
5459
  return rejectWithValue(error);
5463
5460
  }
5464
5461
  }));
@@ -5652,9 +5649,9 @@ const fetchStudioAppsList = createAsyncThunk('studio/appsList', (intl, { extra,
5652
5649
  }));
5653
5650
  return transformedApps;
5654
5651
  }
5655
- catch (_) {
5656
- console.error(_);
5657
- dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
5652
+ catch (err) {
5653
+ console.error(err);
5654
+ dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
5658
5655
  throw rejectWithValue({ error: 1, errorMsg: 'Error retrieving applications' });
5659
5656
  }
5660
5657
  }));
@@ -5691,8 +5688,8 @@ const createNewStudioApp = createAsyncThunk('studio/createApp', ({ appName, call
5691
5688
  callback();
5692
5689
  return newStudioApp;
5693
5690
  }
5694
- catch (_) {
5695
- dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
5691
+ catch (err) {
5692
+ dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
5696
5693
  throw rejectWithValue({ error: 1, errorMsg: 'Error creating application' });
5697
5694
  }
5698
5695
  }));
@@ -5703,8 +5700,8 @@ const deleteStudioApp = createAsyncThunk('studio/deleteApp', ({ idApp, status },
5703
5700
  dispatch(Toast.actions.success({ label: 'APPSTUDIO_StudioApp_Deleted' }));
5704
5701
  return deleteRes;
5705
5702
  }
5706
- catch (_) {
5707
- dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
5703
+ catch (err) {
5704
+ dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
5708
5705
  return rejectWithValue({ error: 1, errorMsg: 'Error deleting application' });
5709
5706
  }
5710
5707
  }));
@@ -5714,8 +5711,8 @@ const suspendStudioApp = createAsyncThunk('studio/suspendStudioApp', ({ idApp },
5714
5711
  yield jApi.application.studioSuspend(idApp);
5715
5712
  dispatch(Toast.actions.success({ label: 'APPSTUDIO_AppItem_Suspended' }));
5716
5713
  }
5717
- catch (_) {
5718
- dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
5714
+ catch (err) {
5715
+ dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
5719
5716
  throw rejectWithValue({ error: 1, errorMsg: 'Error suspending application' });
5720
5717
  }
5721
5718
  }));
@@ -5725,8 +5722,8 @@ const restartStudioApp = createAsyncThunk('studio/restartStudioApp', ({ idApp },
5725
5722
  yield jApi.application.studioRestart(idApp);
5726
5723
  dispatch(Toast.actions.success({ label: 'APPSTUDIO_AppItem_Restarted' }));
5727
5724
  }
5728
- catch (_) {
5729
- dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
5725
+ catch (err) {
5726
+ dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
5730
5727
  throw rejectWithValue({ error: 1, errorMsg: 'Error restarting application' });
5731
5728
  }
5732
5729
  }));
@@ -5752,8 +5749,8 @@ const cloneStudioApp = createAsyncThunk('studio/cloneStudioApp', ({ idApp, inWor
5752
5749
  dispatch(Toast.actions.success({ label: 'APPSTUDIO_AppItem_Cloned' }));
5753
5750
  return clonedStudioApp;
5754
5751
  }
5755
- catch (_) {
5756
- dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
5752
+ catch (err) {
5753
+ dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
5757
5754
  return rejectWithValue({ error: 1, errorMsg: 'Error cloning application' });
5758
5755
  }
5759
5756
  }));
@@ -5773,8 +5770,8 @@ const createInWorkStudioApp = createAsyncThunk('studio/createInWorkStudioApp', (
5773
5770
  dispatch(Toast.actions.success({ label: 'APPSTUDIO_AppItem_CreateInWork' }));
5774
5771
  return clonedStudioApp;
5775
5772
  }
5776
- catch (_) {
5777
- dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
5773
+ catch (err) {
5774
+ dispatch(Toast.actions.error({ label: getErrorMessage(err) }));
5778
5775
  return rejectWithValue({ error: 1, errorMsg: 'Error creating in work version for application' });
5779
5776
  }
5780
5777
  }));