jamespot-front-business 1.1.66 → 1.1.68

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
@@ -48,7 +48,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
48
48
  const toastAdapter = createEntityAdapter({
49
49
  selectId: (toast) => toast.id,
50
50
  });
51
- const slice$4 = createSlice({
51
+ const slice$5 = createSlice({
52
52
  name: 'toasts',
53
53
  initialState: toastAdapter.getInitialState(),
54
54
  reducers: {
@@ -62,9 +62,9 @@ const addMessage = (_a, type, timeout) => {
62
62
  if (type === void 0) { type = 'success'; }
63
63
  if (timeout === void 0) { timeout = 3000; }
64
64
  return (dispatch) => {
65
- dispatch(slice$4.actions.addOne(Object.assign(Object.assign({ id }, toast), { timeout, type })));
65
+ dispatch(slice$5.actions.addOne(Object.assign(Object.assign({ id }, toast), { timeout, type })));
66
66
  setTimeout(() => {
67
- dispatch(slice$4.actions.removeOne(id));
67
+ dispatch(slice$5.actions.removeOne(id));
68
68
  }, timeout);
69
69
  return id;
70
70
  };
@@ -75,11 +75,11 @@ const actions = {
75
75
  warning: (toast, timeout) => addMessage(toast, 'warning', timeout),
76
76
  error: (toast, timeout) => addMessage(toast, 'error', timeout),
77
77
  };
78
- const selectors$2 = toastAdapter.getSelectors((state) => state.toasts);
78
+ const selectors$3 = toastAdapter.getSelectors((state) => state.toasts);
79
79
  const Toast = {
80
- slice: slice$4,
81
- actions: Object.assign(Object.assign({}, actions), slice$4.actions),
82
- selectors: selectors$2,
80
+ slice: slice$5,
81
+ actions: Object.assign(Object.assign({}, actions), slice$5.actions),
82
+ selectors: selectors$3,
83
83
  };
84
84
 
85
85
  const initialState$m = {
@@ -295,24 +295,24 @@ const Animations = {
295
295
  getAnimationsRTHandlers,
296
296
  };
297
297
 
298
- const adapter$1 = createEntityAdapter({
298
+ const adapter$2 = createEntityAdapter({
299
299
  selectId: (app) => app.name,
300
300
  sortComparer: (a, b) => a.label.localeCompare(b.label),
301
301
  });
302
- const slice$3 = createSlice({
302
+ const slice$4 = createSlice({
303
303
  name: 'applications',
304
- initialState: adapter$1.getInitialState(),
304
+ initialState: adapter$2.getInitialState(),
305
305
  reducers: {
306
- addOne: adapter$1.addOne,
307
- addMany: adapter$1.addMany,
308
- setAll: adapter$1.setAll,
306
+ addOne: adapter$2.addOne,
307
+ addMany: adapter$2.addMany,
308
+ setAll: adapter$2.setAll,
309
309
  },
310
310
  });
311
- const selectors$1 = adapter$1.getSelectors((state) => state.entities.applications);
311
+ const selectors$2 = adapter$2.getSelectors((state) => state.entities.applications);
312
312
  const Application = {
313
- slice: slice$3,
314
- actions: Object.assign({}, slice$3.actions),
315
- selectors: selectors$1,
313
+ slice: slice$4,
314
+ actions: Object.assign({}, slice$4.actions),
315
+ selectors: selectors$2,
316
316
  };
317
317
 
318
318
  const initialState$l = {
@@ -476,6 +476,36 @@ const CommentListSlice = createSlice({
476
476
  discardComments: (state, action) => {
477
477
  state.comments = state.comments.filter((c) => c.idArticle !== action.payload.idArticle);
478
478
  },
479
+ hydrateComment: (state, action) => {
480
+ const { idArticle, list } = action.payload;
481
+ const hasList = state.comments.find((c) => c.idArticle === idArticle);
482
+ if (!hasList) {
483
+ state.comments = [
484
+ ...state.comments.filter((c) => c.idArticle !== idArticle),
485
+ {
486
+ idArticle,
487
+ list,
488
+ },
489
+ ];
490
+ return;
491
+ }
492
+ const initialUris = [];
493
+ const allUris = state.comments.reduce((uris, c) => {
494
+ return [...uris, ...c.list.map((el) => el.uri)];
495
+ }, initialUris);
496
+ const safeList = list.filter((el) => !allUris.includes(el.uri));
497
+ state.comments = state.comments.map((c) => {
498
+ return c.idArticle === idArticle
499
+ ? Object.assign(Object.assign({}, c), { list: [...c.list, ...safeList] }) : c;
500
+ });
501
+ },
502
+ updateComment: (state, action) => {
503
+ state.comments = state.comments.map((c) => {
504
+ const { idArticle, idComment, data } = action.payload;
505
+ return c.idArticle === idArticle
506
+ ? Object.assign(Object.assign({}, c), { list: c.list.map((comment) => comment.id === idComment ? Object.assign(Object.assign({}, comment), { description: data.description }) : comment) }) : c;
507
+ });
508
+ },
479
509
  },
480
510
  extraReducers: (builder) => {
481
511
  builder
@@ -1000,7 +1030,7 @@ const buildDrivesArrayFromObject = (drives) => {
1000
1030
  return Object.keys(drives).filter((k) => drives[k]);
1001
1031
  };
1002
1032
 
1003
- const slice$2 = createSlice({
1033
+ const slice$3 = createSlice({
1004
1034
  name: 'hooks',
1005
1035
  initialState: {},
1006
1036
  reducers: {
@@ -1018,8 +1048,8 @@ const hasHookLicense = (state, hook) => {
1018
1048
  return !!((_a = state.hooks[hook]) === null || _a === void 0 ? void 0 : _a.hasLicense);
1019
1049
  };
1020
1050
  const Hook = {
1021
- slice: slice$2,
1022
- actions: slice$2.actions,
1051
+ slice: slice$3,
1052
+ actions: slice$3.actions,
1023
1053
  selectors: { selectHooks, selectHook, hasHookLicense },
1024
1054
  utils: { buildDrivesArrayFromObject },
1025
1055
  };
@@ -1665,7 +1695,7 @@ const MediaLibrary = {
1665
1695
  },
1666
1696
  };
1667
1697
 
1668
- const adapter = createEntityAdapter({
1698
+ const adapter$1 = createEntityAdapter({
1669
1699
  selectId: (model) => model.type,
1670
1700
  sortComparer: (a, b) => a.label.localeCompare(b.label),
1671
1701
  });
@@ -1677,25 +1707,25 @@ const getModelIconSrc = (model, size) => {
1677
1707
  };
1678
1708
  return formatImgUrl(imgProps);
1679
1709
  };
1680
- const slice$1 = createSlice({
1710
+ const slice$2 = createSlice({
1681
1711
  name: 'models',
1682
- initialState: adapter.getInitialState(),
1712
+ initialState: adapter$1.getInitialState(),
1683
1713
  reducers: {
1684
- addOne: adapter.addOne,
1685
- addMany: adapter.addMany,
1686
- setAll: adapter.setAll,
1714
+ addOne: adapter$1.addOne,
1715
+ addMany: adapter$1.addMany,
1716
+ setAll: adapter$1.setAll,
1687
1717
  },
1688
1718
  });
1689
- const selectors = adapter.getSelectors((state) => state.entities.models);
1719
+ const selectors$1 = adapter$1.getSelectors((state) => state.entities.models);
1690
1720
  const utils = {
1691
1721
  getModelIconSrc,
1692
1722
  };
1693
1723
  const selectByIds = (state, types) => types.map((type) => state.entities.models.entities[type]).filter((model) => !!model);
1694
1724
  const Model = {
1695
- slice: slice$1,
1696
- actions: Object.assign({}, slice$1.actions),
1725
+ slice: slice$2,
1726
+ actions: Object.assign({}, slice$2.actions),
1697
1727
  utils,
1698
- selectors: Object.assign(Object.assign({}, selectors), { selectByIds }),
1728
+ selectors: Object.assign(Object.assign({}, selectors$1), { selectByIds }),
1699
1729
  };
1700
1730
 
1701
1731
  const initialState$a = {};
@@ -2078,7 +2108,7 @@ const initialState$4 = {
2078
2108
  level: 0,
2079
2109
  active: 1,
2080
2110
  };
2081
- const slice = createSlice({
2111
+ const slice$1 = createSlice({
2082
2112
  name: 'userCurrent',
2083
2113
  initialState: initialState$4,
2084
2114
  reducers: {
@@ -2097,8 +2127,8 @@ const isLogged = (userCurrent) => {
2097
2127
  return userCurrent.id !== 0;
2098
2128
  };
2099
2129
  const UserCurrent = {
2100
- slice: slice,
2101
- actions: Object.assign({}, slice.actions),
2130
+ slice: slice$1,
2131
+ actions: Object.assign({}, slice$1.actions),
2102
2132
  selectors: {
2103
2133
  get,
2104
2134
  },
@@ -2702,6 +2732,27 @@ const WidgetEditor = {
2702
2732
  },
2703
2733
  };
2704
2734
 
2735
+ const adapter = createEntityAdapter({
2736
+ selectId: (socialAction) => `${socialAction.struct.targetId}-${socialAction.type}`,
2737
+ });
2738
+ const slice = createSlice({
2739
+ name: 'socialActions',
2740
+ initialState: adapter.getInitialState(),
2741
+ reducers: {
2742
+ addOne: adapter.addOne,
2743
+ addMany: adapter.addMany,
2744
+ setAll: adapter.setAll,
2745
+ clear: adapter.removeAll,
2746
+ updateOne: adapter.updateOne,
2747
+ },
2748
+ });
2749
+ const selectors = adapter.getSelectors((state) => state.entities.socialActions);
2750
+ const SocialActions = {
2751
+ slice: slice,
2752
+ actions: Object.assign({}, slice.actions),
2753
+ selectors,
2754
+ };
2755
+
2705
2756
  const AUDIENCE = {
2706
2757
  ALL: '1',
2707
2758
  CUSTOM: '0',
@@ -4097,5 +4148,5 @@ const studio = {
4097
4148
  },
4098
4149
  };
4099
4150
 
4100
- export { APP_STATUS_TYPE, AUDIENCE, Animations, AppColumnsDefaultTypes, AppFieldFormPropertyTypes, AppFormBannedFromViews$1 as AppFormBannedFromViews, AppFormFieldOnlyInView, AppFormFixedList$1 as AppFormFixedList, AppFormItemTypes, AppFormNoAsFieldList, AppFormNonPrimaryList, AppFormPrimaryList, AppFormUniqueList, Application, AssetReservation, Bookmark, Comment, ExtraAppFieldsItemViews, Faq, Hook, MODE_EDIT, MODE_VIEW, MagicPad, MapExtraFieldsWithView, MediaLibrary, Model, Network, Platform, STUDIO_VIEW, Share, StatusType$1 as StatusType, TVDisplay, TinyMCE, Toast, UserCurrent, WedocApp, Widget, WidgetEditor, actions, animationsReducer, animationsSlice, fetchMediaLibraryConfig, fetchMediaLibraryFilesStats, fetchMediaLibraryFolders, fetchMediaLibraryFoldersStats, fetchMediaLibraryStats, fetchMediaLibraryUnclassifiedFiles, fetchPads, jland, magicPadSlice, mediaLibraryReducer, mediaLibrarySlice, slice, studio, updateWidgetContent, viewsList };
4151
+ export { APP_STATUS_TYPE, AUDIENCE, Animations, AppColumnsDefaultTypes, AppFieldFormPropertyTypes, AppFormBannedFromViews$1 as AppFormBannedFromViews, AppFormFieldOnlyInView, AppFormFixedList$1 as AppFormFixedList, AppFormItemTypes, AppFormNoAsFieldList, AppFormNonPrimaryList, AppFormPrimaryList, AppFormUniqueList, Application, AssetReservation, Bookmark, Comment, ExtraAppFieldsItemViews, Faq, Hook, MODE_EDIT, MODE_VIEW, MagicPad, MapExtraFieldsWithView, MediaLibrary, Model, Network, Platform, STUDIO_VIEW, Share, SocialActions, StatusType$1 as StatusType, TVDisplay, TinyMCE, Toast, UserCurrent, WedocApp, Widget, WidgetEditor, actions, animationsReducer, animationsSlice, fetchMediaLibraryConfig, fetchMediaLibraryFilesStats, fetchMediaLibraryFolders, fetchMediaLibraryFoldersStats, fetchMediaLibraryStats, fetchMediaLibraryUnclassifiedFiles, fetchPads, jland, magicPadSlice, mediaLibraryReducer, mediaLibrarySlice, slice$1 as slice, studio, updateWidgetContent, viewsList };
4101
4152
  //# sourceMappingURL=esm.js.map