jamespot-front-business 1.1.36 → 1.1.37

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
@@ -60,7 +60,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
60
60
  });
61
61
  }
62
62
 
63
- const initialState$h = {
63
+ const initialState$j = {
64
64
  entities: [],
65
65
  loading: 'idle',
66
66
  nbResults: 0,
@@ -71,7 +71,7 @@ const fetchBookableAsset = createAsyncThunk('BookableAsset/fetchBookableAsset',
71
71
  }));
72
72
  const BookableAssetSlice = createSlice({
73
73
  name: 'bookableAsset',
74
- initialState: initialState$h,
74
+ initialState: initialState$j,
75
75
  reducers: {},
76
76
  extraReducers: (builder) => {
77
77
  builder
@@ -92,7 +92,7 @@ const BookableAssetSlice = createSlice({
92
92
  const fetchConfiguration = createAsyncThunk('AssetReservation/configuration', (_, { extra }) => __awaiter(void 0, void 0, void 0, function* () {
93
93
  return yield extra.jApi.assetReservation.configuration();
94
94
  }));
95
- const initialState$g = {
95
+ const initialState$i = {
96
96
  description: '',
97
97
  right: {
98
98
  manage: false,
@@ -106,7 +106,7 @@ const initialState$g = {
106
106
  };
107
107
  const AssetReservationConfigurationSlice = createSlice({
108
108
  name: 'configuration',
109
- initialState: initialState$g,
109
+ initialState: initialState$i,
110
110
  reducers: {},
111
111
  extraReducers: (builder) => {
112
112
  builder
@@ -127,7 +127,7 @@ const initForm = {
127
127
  hourStart: '',
128
128
  hourEnd: '',
129
129
  };
130
- const initialState$f = {
130
+ const initialState$h = {
131
131
  entities: [],
132
132
  loading: 'idle',
133
133
  nbResults: 0,
@@ -139,7 +139,7 @@ const fetchReservation = createAsyncThunk('Reservation/fetchReservation', (viewM
139
139
  }));
140
140
  const ReservationSlice = createSlice({
141
141
  name: 'reservation',
142
- initialState: initialState$f,
142
+ initialState: initialState$h,
143
143
  reducers: {
144
144
  setForm: (state, action) => {
145
145
  state.form = action.payload;
@@ -232,7 +232,115 @@ const Toast = {
232
232
  selectors: selectors$1,
233
233
  };
234
234
 
235
- const initialState$e = {
235
+ const initialState$g = {
236
+ loading: 'idle',
237
+ comments: [],
238
+ };
239
+ const fetchComments = createAsyncThunk('commentList/fetchCommentList', (params, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
240
+ var _a;
241
+ try {
242
+ const res = yield extra.jApi.article.getComments(params, 'raw-list');
243
+ return { idArticle: params.idArticle, list: res.result };
244
+ }
245
+ catch (error) {
246
+ dispatch(Toast.actions.error({ label: (_a = error.errorMsg) !== null && _a !== void 0 ? _a : 'GLOBAL_Technical_Error' }));
247
+ return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve comments' });
248
+ }
249
+ }));
250
+ const CommentListSlice = createSlice({
251
+ name: 'commentList',
252
+ initialState: initialState$g,
253
+ reducers: {
254
+ discardComments: (state, action) => {
255
+ state.comments = state.comments.filter((c) => c.idArticle !== action.payload.idArticle);
256
+ },
257
+ },
258
+ extraReducers: (builder) => {
259
+ builder
260
+ .addCase(fetchComments.pending, (state) => {
261
+ state.loading = 'pending';
262
+ })
263
+ .addCase(fetchComments.fulfilled, (state, action) => {
264
+ state.loading = 'idle';
265
+ state.comments = [
266
+ ...state.comments.filter((c) => c.idArticle !== action.payload.idArticle),
267
+ {
268
+ idArticle: action.payload.idArticle,
269
+ list: action.payload.list.reverse(),
270
+ },
271
+ ];
272
+ })
273
+ .addCase(fetchComments.rejected, (state) => {
274
+ state.loading = 'idle';
275
+ });
276
+ },
277
+ });
278
+
279
+ const getCommentRTHandlers = function (dispatch, idArticle) {
280
+ const addCommentHandler = function (message) {
281
+ if (message.namespace === 'JAMESPOT' &&
282
+ message.function === 'comment-create' &&
283
+ message.object.idArticle === idArticle) {
284
+ dispatch(fetchComments({ idArticle }));
285
+ }
286
+ };
287
+ const deleteCommentHandler = function (message) {
288
+ if (message.namespace === 'JAMESPOT' &&
289
+ message.function === 'comment-delete' &&
290
+ Number(message.object.idArticle) === idArticle) {
291
+ dispatch(fetchComments({ idArticle }));
292
+ }
293
+ };
294
+ return [
295
+ {
296
+ namespace: 'JAMESPOT',
297
+ function: 'comment-create',
298
+ handler: addCommentHandler,
299
+ },
300
+ {
301
+ namespace: 'JAMESPOT',
302
+ function: 'comment-delete',
303
+ handler: deleteCommentHandler,
304
+ },
305
+ ];
306
+ };
307
+
308
+ const getCommentsLikeRTHandlers = function (dispatch, idComments, idArticle) {
309
+ const commentLikeHandler = function (message) {
310
+ if (message.namespace === 'CUSTOM-ACTION' &&
311
+ (message.function === 'add' || message.function === 'remove') &&
312
+ message.object.type === 'sociallike' &&
313
+ message.object.targetId &&
314
+ idComments &&
315
+ idComments.includes(message.object.targetId)) {
316
+ dispatch(fetchComments({ idArticle }));
317
+ }
318
+ };
319
+ return idComments ? [
320
+ { namespace: 'CUSTOM-ACTION', function: 'add', handler: commentLikeHandler },
321
+ { namespace: 'CUSTOM-ACTION', function: 'remove', handler: commentLikeHandler },
322
+ ] : [];
323
+ };
324
+
325
+ const CommentReducer = combineReducers$1({
326
+ [CommentListSlice.name]: CommentListSlice.reducer,
327
+ });
328
+ const commentSlice = {
329
+ name: 'comment',
330
+ reducer: CommentReducer,
331
+ };
332
+ const selectCommentList = (state, idArticle) => state.comment.commentList.comments.find((c) => c.idArticle === idArticle);
333
+ const Comment = {
334
+ slice: commentSlice,
335
+ actions: Object.assign({ fetchComments }, CommentListSlice.actions),
336
+ selectors: {
337
+ commentList: selectCommentList,
338
+ },
339
+ getCommentRTHandlers,
340
+ getCommentsLikeRTHandlers,
341
+ };
342
+
343
+ const initialState$f = {
236
344
  bookmarks: [],
237
345
  loading: 'idle',
238
346
  status: undefined,
@@ -295,7 +403,7 @@ const deleteBookmark = createAsyncThunk('bookmarkList/deleteBookmark', (bookmark
295
403
  }));
296
404
  const BookmarkListSlice = createSlice({
297
405
  name: 'bookmarkList',
298
- initialState: initialState$e,
406
+ initialState: initialState$f,
299
407
  reducers: {
300
408
  resetAddBookmarkStatus: (state, action) => {
301
409
  if (state.add[action.payload]) {
@@ -405,7 +513,7 @@ const BookmarkListSlice = createSlice({
405
513
  },
406
514
  });
407
515
 
408
- const getRTHandlers = function (dispatch) {
516
+ const getBookmarkRTHandlers = function (dispatch) {
409
517
  const dispatchOrFetch = function (message, action) {
410
518
  if (jEnsure.objectIsType('bookmarkLink', message.object)) {
411
519
  dispatch(action(message.object));
@@ -458,7 +566,7 @@ const getRTHandlers = function (dispatch) {
458
566
  ];
459
567
  };
460
568
 
461
- const initialState$d = {
569
+ const initialState$e = {
462
570
  bookmark: undefined,
463
571
  status: undefined,
464
572
  loading: 'idle',
@@ -480,7 +588,7 @@ const editBookmark = createAsyncThunk('bookmarkEdit/editBookmark', (bookmark, {
480
588
  }));
481
589
  const BookmarkEditSlice = createSlice({
482
590
  name: 'bookmarkEdit',
483
- initialState: initialState$d,
591
+ initialState: initialState$e,
484
592
  reducers: {
485
593
  setEditBookmark: (state, action) => {
486
594
  state.bookmark = Object.assign({}, action.payload);
@@ -530,17 +638,17 @@ const Bookmark = {
530
638
  bookmarkListIsInitialized: selectBookmarkListIsInitialized,
531
639
  bookmarkEditBookmark: selectBookmarkEditBookmark
532
640
  },
533
- getRTHandlers: getRTHandlers,
641
+ getRTHandlers: getBookmarkRTHandlers,
534
642
  };
535
643
 
536
- const initialState$c = {
644
+ const initialState$d = {
537
645
  loading: 'idle',
538
646
  access: { createCategory: false },
539
647
  };
540
648
  const fetchFaqConfig = createAsyncThunk('faqConfig/fetch', () => __awaiter(void 0, void 0, void 0, function* () {
541
649
  try {
542
650
  const [hookProperties, access] = yield Promise.all([
543
- yield jamespot.faq.getHookProperties(['_web', 'appImage', 'appImageText']),
651
+ yield jamespot.faq.getHookProperties(['_web', 'appImage', 'appImageText', '_displayComment']),
544
652
  yield jamespot.faq.getAccess()
545
653
  ]);
546
654
  return {
@@ -548,6 +656,7 @@ const fetchFaqConfig = createAsyncThunk('faqConfig/fetch', () => __awaiter(void
548
656
  appImage: hookProperties.result.appImage,
549
657
  appImageText: hookProperties.result.appImageText,
550
658
  access: access.result,
659
+ _displayComment: hookProperties.result._displayComment,
551
660
  };
552
661
  }
553
662
  catch (e) {
@@ -561,7 +670,7 @@ const fetchFaqConfig = createAsyncThunk('faqConfig/fetch', () => __awaiter(void
561
670
  }));
562
671
  const FaqConfigSlice = createSlice({
563
672
  name: 'config',
564
- initialState: initialState$c,
673
+ initialState: initialState$d,
565
674
  reducers: {},
566
675
  extraReducers: (builder) => {
567
676
  builder
@@ -584,6 +693,9 @@ const FaqConfigSlice = createSlice({
584
693
  if (action.payload.access) {
585
694
  state.access = action.payload.access;
586
695
  }
696
+ if (action.payload._displayComment !== undefined) {
697
+ state._displayComment = action.payload._displayComment;
698
+ }
587
699
  return state;
588
700
  })
589
701
  .addCase(fetchFaqConfig.rejected, (state) => {
@@ -593,7 +705,7 @@ const FaqConfigSlice = createSlice({
593
705
  },
594
706
  });
595
707
 
596
- const initialState$b = {
708
+ const initialState$c = {
597
709
  loading: 'idle',
598
710
  categories: null,
599
711
  };
@@ -605,7 +717,7 @@ const fetchFaqCategories = createAsyncThunk('faqCategories/fetch', () => __await
605
717
  }));
606
718
  const FaqCategoriesSlice = createSlice({
607
719
  name: 'categories',
608
- initialState: initialState$b,
720
+ initialState: initialState$c,
609
721
  reducers: {},
610
722
  extraReducers: (builder) => {
611
723
  builder
@@ -626,13 +738,13 @@ const FaqCategoriesSlice = createSlice({
626
738
  },
627
739
  });
628
740
 
629
- const joinedReducers$5 = combineReducers({
741
+ const joinedReducers$6 = combineReducers({
630
742
  [FaqConfigSlice.name]: FaqConfigSlice.reducer,
631
743
  [FaqCategoriesSlice.name]: FaqCategoriesSlice.reducer,
632
744
  });
633
745
  const FaqSlice = {
634
746
  name: 'faq',
635
- reducer: joinedReducers$5,
747
+ reducer: joinedReducers$6,
636
748
  };
637
749
  const selectFaqConfig = (state) => {
638
750
  return state.faq.config;
@@ -887,7 +999,7 @@ const initialMap = {
887
999
  illustration: '',
888
1000
  assignLicense: false,
889
1001
  };
890
- const initialState$a = {
1002
+ const initialState$b = {
891
1003
  map: Object.assign({}, initialMap),
892
1004
  loading: 'idle',
893
1005
  status: undefined,
@@ -931,13 +1043,13 @@ const createMap = createAsyncThunk('mapCreate/create', ({ map, jlandUrlBase }, {
931
1043
  }));
932
1044
  const MapCreateSlice = createSlice({
933
1045
  name: 'mapCreate',
934
- initialState: initialState$a,
1046
+ initialState: initialState$b,
935
1047
  reducers: {
936
1048
  setMap: (state, action) => {
937
1049
  state.map = action.payload;
938
1050
  },
939
1051
  resetCreateMapState: () => {
940
- return initialState$a;
1052
+ return initialState$b;
941
1053
  },
942
1054
  },
943
1055
  extraReducers: (builder) => {
@@ -967,13 +1079,13 @@ const selectJLandAvailableLicenses = function selectJLandAvailableLicenses(state
967
1079
  const selectMapCreate = function selectMapCreate(state) {
968
1080
  return state.jland.mapCreate;
969
1081
  };
970
- const joinedReducers$4 = combineReducers({
1082
+ const joinedReducers$5 = combineReducers({
971
1083
  [JLandMapListSlice.name]: JLandMapListSlice.reducer,
972
1084
  [MapCreateSlice.name]: MapCreateSlice.reducer,
973
1085
  });
974
1086
  const jlandSlice = {
975
1087
  name: 'jland',
976
- reducer: joinedReducers$4,
1088
+ reducer: joinedReducers$5,
977
1089
  };
978
1090
  const jland = {
979
1091
  slice: jlandSlice,
@@ -1024,10 +1136,10 @@ const Model = {
1024
1136
  selectors: Object.assign(Object.assign({}, selectors), { selectByIds }),
1025
1137
  };
1026
1138
 
1027
- const initialState$9 = {};
1139
+ const initialState$a = {};
1028
1140
  const NetworkStaticsSlice = createSlice({
1029
1141
  name: 'statics',
1030
- initialState: initialState$9,
1142
+ initialState: initialState$a,
1031
1143
  reducers: {
1032
1144
  initNetworkStatics: (_, { payload }) => {
1033
1145
  return payload;
@@ -1035,12 +1147,12 @@ const NetworkStaticsSlice = createSlice({
1035
1147
  },
1036
1148
  });
1037
1149
 
1038
- const joinedReducers$3 = combineReducers({
1150
+ const joinedReducers$4 = combineReducers({
1039
1151
  [NetworkStaticsSlice.name]: NetworkStaticsSlice.reducer,
1040
1152
  });
1041
1153
  const NetworkSlice = {
1042
1154
  name: 'network',
1043
- reducer: joinedReducers$3,
1155
+ reducer: joinedReducers$4,
1044
1156
  };
1045
1157
  const selectNetworkStatics = (state) => {
1046
1158
  return state.network.statics;
@@ -1061,6 +1173,46 @@ const Network = {
1061
1173
  },
1062
1174
  };
1063
1175
 
1176
+ const initialState$9 = {
1177
+ userHighlightFields: [],
1178
+ userAccountStatus: 0
1179
+ };
1180
+ const PlatformConfigSlice = createSlice({
1181
+ name: 'config',
1182
+ initialState: initialState$9,
1183
+ reducers: {
1184
+ initPlatformConfig: (_, { payload }) => {
1185
+ return payload;
1186
+ },
1187
+ },
1188
+ });
1189
+
1190
+ const joinedReducers$3 = combineReducers({
1191
+ [PlatformConfigSlice.name]: PlatformConfigSlice.reducer,
1192
+ });
1193
+ const PlatformSlice = {
1194
+ name: 'platform',
1195
+ reducer: joinedReducers$3,
1196
+ };
1197
+ const selectPlatformConfig = (state) => {
1198
+ return state.platform.config;
1199
+ };
1200
+ const selectUserHighlightFields = (state) => {
1201
+ return state.platform.config.userHighlightFields;
1202
+ };
1203
+ const selectUserAccountStatus = (state) => {
1204
+ return state.platform.config.userAccountStatus;
1205
+ };
1206
+ const Platform = {
1207
+ slice: PlatformSlice,
1208
+ actions: Object.assign({}, PlatformConfigSlice.actions),
1209
+ selectors: {
1210
+ selectPlatformConfig,
1211
+ selectUserHighlightFields,
1212
+ selectUserAccountStatus,
1213
+ },
1214
+ };
1215
+
1064
1216
  const initialQuery = {
1065
1217
  query: '',
1066
1218
  filters: [],
@@ -2379,5 +2531,5 @@ const studio = {
2379
2531
  },
2380
2532
  };
2381
2533
 
2382
- export { APP_STATUS_TYPE, AUDIENCE, AppFieldFormPropertyTypes, AppFormBannedFromViews, AppFormItemTypes, AppFormUniqueList, Application, AssetReservation, Bookmark, ExtraAppFieldsItemViews, Faq, MODE_EDIT, MODE_VIEW, MapExtraFieldsWithView, Model, Network, STUDIO_VIEW, Share, StatusType, TVDisplay, TinyMCE, Toast, UserCurrent, WedocApp, Widget, WidgetEditor, actions, jland, slice, studio, updateWidgetContent, viewsList };
2534
+ export { APP_STATUS_TYPE, AUDIENCE, AppFieldFormPropertyTypes, AppFormBannedFromViews, AppFormItemTypes, AppFormUniqueList, Application, AssetReservation, Bookmark, Comment, ExtraAppFieldsItemViews, Faq, MODE_EDIT, MODE_VIEW, MapExtraFieldsWithView, Model, Network, Platform, STUDIO_VIEW, Share, StatusType, TVDisplay, TinyMCE, Toast, UserCurrent, WedocApp, Widget, WidgetEditor, actions, jland, slice, studio, updateWidgetContent, viewsList };
2383
2535
  //# sourceMappingURL=esm.js.map