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/cjs.js CHANGED
@@ -56,7 +56,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
56
56
  const toastAdapter = toolkit.createEntityAdapter({
57
57
  selectId: (toast) => toast.id,
58
58
  });
59
- const slice$4 = toolkit.createSlice({
59
+ const slice$5 = toolkit.createSlice({
60
60
  name: 'toasts',
61
61
  initialState: toastAdapter.getInitialState(),
62
62
  reducers: {
@@ -70,9 +70,9 @@ const addMessage = (_a, type, timeout) => {
70
70
  if (type === void 0) { type = 'success'; }
71
71
  if (timeout === void 0) { timeout = 3000; }
72
72
  return (dispatch) => {
73
- dispatch(slice$4.actions.addOne(Object.assign(Object.assign({ id }, toast), { timeout, type })));
73
+ dispatch(slice$5.actions.addOne(Object.assign(Object.assign({ id }, toast), { timeout, type })));
74
74
  setTimeout(() => {
75
- dispatch(slice$4.actions.removeOne(id));
75
+ dispatch(slice$5.actions.removeOne(id));
76
76
  }, timeout);
77
77
  return id;
78
78
  };
@@ -83,11 +83,11 @@ const actions = {
83
83
  warning: (toast, timeout) => addMessage(toast, 'warning', timeout),
84
84
  error: (toast, timeout) => addMessage(toast, 'error', timeout),
85
85
  };
86
- const selectors$2 = toastAdapter.getSelectors((state) => state.toasts);
86
+ const selectors$3 = toastAdapter.getSelectors((state) => state.toasts);
87
87
  const Toast = {
88
- slice: slice$4,
89
- actions: Object.assign(Object.assign({}, actions), slice$4.actions),
90
- selectors: selectors$2,
88
+ slice: slice$5,
89
+ actions: Object.assign(Object.assign({}, actions), slice$5.actions),
90
+ selectors: selectors$3,
91
91
  };
92
92
 
93
93
  const initialState$m = {
@@ -303,24 +303,24 @@ const Animations = {
303
303
  getAnimationsRTHandlers,
304
304
  };
305
305
 
306
- const adapter$1 = toolkit.createEntityAdapter({
306
+ const adapter$2 = toolkit.createEntityAdapter({
307
307
  selectId: (app) => app.name,
308
308
  sortComparer: (a, b) => a.label.localeCompare(b.label),
309
309
  });
310
- const slice$3 = toolkit.createSlice({
310
+ const slice$4 = toolkit.createSlice({
311
311
  name: 'applications',
312
- initialState: adapter$1.getInitialState(),
312
+ initialState: adapter$2.getInitialState(),
313
313
  reducers: {
314
- addOne: adapter$1.addOne,
315
- addMany: adapter$1.addMany,
316
- setAll: adapter$1.setAll,
314
+ addOne: adapter$2.addOne,
315
+ addMany: adapter$2.addMany,
316
+ setAll: adapter$2.setAll,
317
317
  },
318
318
  });
319
- const selectors$1 = adapter$1.getSelectors((state) => state.entities.applications);
319
+ const selectors$2 = adapter$2.getSelectors((state) => state.entities.applications);
320
320
  const Application = {
321
- slice: slice$3,
322
- actions: Object.assign({}, slice$3.actions),
323
- selectors: selectors$1,
321
+ slice: slice$4,
322
+ actions: Object.assign({}, slice$4.actions),
323
+ selectors: selectors$2,
324
324
  };
325
325
 
326
326
  const initialState$l = {
@@ -484,6 +484,36 @@ const CommentListSlice = toolkit.createSlice({
484
484
  discardComments: (state, action) => {
485
485
  state.comments = state.comments.filter((c) => c.idArticle !== action.payload.idArticle);
486
486
  },
487
+ hydrateComment: (state, action) => {
488
+ const { idArticle, list } = action.payload;
489
+ const hasList = state.comments.find((c) => c.idArticle === idArticle);
490
+ if (!hasList) {
491
+ state.comments = [
492
+ ...state.comments.filter((c) => c.idArticle !== idArticle),
493
+ {
494
+ idArticle,
495
+ list,
496
+ },
497
+ ];
498
+ return;
499
+ }
500
+ const initialUris = [];
501
+ const allUris = state.comments.reduce((uris, c) => {
502
+ return [...uris, ...c.list.map((el) => el.uri)];
503
+ }, initialUris);
504
+ const safeList = list.filter((el) => !allUris.includes(el.uri));
505
+ state.comments = state.comments.map((c) => {
506
+ return c.idArticle === idArticle
507
+ ? Object.assign(Object.assign({}, c), { list: [...c.list, ...safeList] }) : c;
508
+ });
509
+ },
510
+ updateComment: (state, action) => {
511
+ state.comments = state.comments.map((c) => {
512
+ const { idArticle, idComment, data } = action.payload;
513
+ return c.idArticle === idArticle
514
+ ? Object.assign(Object.assign({}, c), { list: c.list.map((comment) => comment.id === idComment ? Object.assign(Object.assign({}, comment), { description: data.description }) : comment) }) : c;
515
+ });
516
+ },
487
517
  },
488
518
  extraReducers: (builder) => {
489
519
  builder
@@ -1008,7 +1038,7 @@ const buildDrivesArrayFromObject = (drives) => {
1008
1038
  return Object.keys(drives).filter((k) => drives[k]);
1009
1039
  };
1010
1040
 
1011
- const slice$2 = toolkit.createSlice({
1041
+ const slice$3 = toolkit.createSlice({
1012
1042
  name: 'hooks',
1013
1043
  initialState: {},
1014
1044
  reducers: {
@@ -1026,8 +1056,8 @@ const hasHookLicense = (state, hook) => {
1026
1056
  return !!((_a = state.hooks[hook]) === null || _a === void 0 ? void 0 : _a.hasLicense);
1027
1057
  };
1028
1058
  const Hook = {
1029
- slice: slice$2,
1030
- actions: slice$2.actions,
1059
+ slice: slice$3,
1060
+ actions: slice$3.actions,
1031
1061
  selectors: { selectHooks, selectHook, hasHookLicense },
1032
1062
  utils: { buildDrivesArrayFromObject },
1033
1063
  };
@@ -1673,7 +1703,7 @@ const MediaLibrary = {
1673
1703
  },
1674
1704
  };
1675
1705
 
1676
- const adapter = toolkit.createEntityAdapter({
1706
+ const adapter$1 = toolkit.createEntityAdapter({
1677
1707
  selectId: (model) => model.type,
1678
1708
  sortComparer: (a, b) => a.label.localeCompare(b.label),
1679
1709
  });
@@ -1685,25 +1715,25 @@ const getModelIconSrc = (model, size) => {
1685
1715
  };
1686
1716
  return jamespot.formatImgUrl(imgProps);
1687
1717
  };
1688
- const slice$1 = toolkit.createSlice({
1718
+ const slice$2 = toolkit.createSlice({
1689
1719
  name: 'models',
1690
- initialState: adapter.getInitialState(),
1720
+ initialState: adapter$1.getInitialState(),
1691
1721
  reducers: {
1692
- addOne: adapter.addOne,
1693
- addMany: adapter.addMany,
1694
- setAll: adapter.setAll,
1722
+ addOne: adapter$1.addOne,
1723
+ addMany: adapter$1.addMany,
1724
+ setAll: adapter$1.setAll,
1695
1725
  },
1696
1726
  });
1697
- const selectors = adapter.getSelectors((state) => state.entities.models);
1727
+ const selectors$1 = adapter$1.getSelectors((state) => state.entities.models);
1698
1728
  const utils = {
1699
1729
  getModelIconSrc,
1700
1730
  };
1701
1731
  const selectByIds = (state, types) => types.map((type) => state.entities.models.entities[type]).filter((model) => !!model);
1702
1732
  const Model = {
1703
- slice: slice$1,
1704
- actions: Object.assign({}, slice$1.actions),
1733
+ slice: slice$2,
1734
+ actions: Object.assign({}, slice$2.actions),
1705
1735
  utils,
1706
- selectors: Object.assign(Object.assign({}, selectors), { selectByIds }),
1736
+ selectors: Object.assign(Object.assign({}, selectors$1), { selectByIds }),
1707
1737
  };
1708
1738
 
1709
1739
  const initialState$a = {};
@@ -2086,7 +2116,7 @@ const initialState$4 = {
2086
2116
  level: 0,
2087
2117
  active: 1,
2088
2118
  };
2089
- const slice = toolkit.createSlice({
2119
+ const slice$1 = toolkit.createSlice({
2090
2120
  name: 'userCurrent',
2091
2121
  initialState: initialState$4,
2092
2122
  reducers: {
@@ -2105,8 +2135,8 @@ const isLogged = (userCurrent) => {
2105
2135
  return userCurrent.id !== 0;
2106
2136
  };
2107
2137
  const UserCurrent = {
2108
- slice: slice,
2109
- actions: Object.assign({}, slice.actions),
2138
+ slice: slice$1,
2139
+ actions: Object.assign({}, slice$1.actions),
2110
2140
  selectors: {
2111
2141
  get,
2112
2142
  },
@@ -2710,6 +2740,27 @@ const WidgetEditor = {
2710
2740
  },
2711
2741
  };
2712
2742
 
2743
+ const adapter = toolkit.createEntityAdapter({
2744
+ selectId: (socialAction) => `${socialAction.struct.targetId}-${socialAction.type}`,
2745
+ });
2746
+ const slice = toolkit.createSlice({
2747
+ name: 'socialActions',
2748
+ initialState: adapter.getInitialState(),
2749
+ reducers: {
2750
+ addOne: adapter.addOne,
2751
+ addMany: adapter.addMany,
2752
+ setAll: adapter.setAll,
2753
+ clear: adapter.removeAll,
2754
+ updateOne: adapter.updateOne,
2755
+ },
2756
+ });
2757
+ const selectors = adapter.getSelectors((state) => state.entities.socialActions);
2758
+ const SocialActions = {
2759
+ slice: slice,
2760
+ actions: Object.assign({}, slice.actions),
2761
+ selectors,
2762
+ };
2763
+
2713
2764
  const AUDIENCE = {
2714
2765
  ALL: '1',
2715
2766
  CUSTOM: '0',
@@ -4132,6 +4183,7 @@ exports.Network = Network;
4132
4183
  exports.Platform = Platform;
4133
4184
  exports.STUDIO_VIEW = STUDIO_VIEW;
4134
4185
  exports.Share = Share;
4186
+ exports.SocialActions = SocialActions;
4135
4187
  exports.TVDisplay = TVDisplay;
4136
4188
  exports.TinyMCE = TinyMCE;
4137
4189
  exports.Toast = Toast;
@@ -4153,7 +4205,7 @@ exports.jland = jland;
4153
4205
  exports.magicPadSlice = magicPadSlice;
4154
4206
  exports.mediaLibraryReducer = mediaLibraryReducer;
4155
4207
  exports.mediaLibrarySlice = mediaLibrarySlice;
4156
- exports.slice = slice;
4208
+ exports.slice = slice$1;
4157
4209
  exports.studio = studio;
4158
4210
  exports.updateWidgetContent = updateWidgetContent;
4159
4211
  exports.viewsList = viewsList;