jamespot-front-business 1.1.36 → 1.1.38

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
@@ -68,7 +68,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
68
68
  });
69
69
  }
70
70
 
71
- const initialState$h = {
71
+ const initialState$j = {
72
72
  entities: [],
73
73
  loading: 'idle',
74
74
  nbResults: 0,
@@ -79,7 +79,7 @@ const fetchBookableAsset = toolkit.createAsyncThunk('BookableAsset/fetchBookable
79
79
  }));
80
80
  const BookableAssetSlice = toolkit.createSlice({
81
81
  name: 'bookableAsset',
82
- initialState: initialState$h,
82
+ initialState: initialState$j,
83
83
  reducers: {},
84
84
  extraReducers: (builder) => {
85
85
  builder
@@ -100,7 +100,7 @@ const BookableAssetSlice = toolkit.createSlice({
100
100
  const fetchConfiguration = toolkit.createAsyncThunk('AssetReservation/configuration', (_, { extra }) => __awaiter(void 0, void 0, void 0, function* () {
101
101
  return yield extra.jApi.assetReservation.configuration();
102
102
  }));
103
- const initialState$g = {
103
+ const initialState$i = {
104
104
  description: '',
105
105
  right: {
106
106
  manage: false,
@@ -114,7 +114,7 @@ const initialState$g = {
114
114
  };
115
115
  const AssetReservationConfigurationSlice = toolkit.createSlice({
116
116
  name: 'configuration',
117
- initialState: initialState$g,
117
+ initialState: initialState$i,
118
118
  reducers: {},
119
119
  extraReducers: (builder) => {
120
120
  builder
@@ -135,7 +135,7 @@ const initForm = {
135
135
  hourStart: '',
136
136
  hourEnd: '',
137
137
  };
138
- const initialState$f = {
138
+ const initialState$h = {
139
139
  entities: [],
140
140
  loading: 'idle',
141
141
  nbResults: 0,
@@ -147,7 +147,7 @@ const fetchReservation = toolkit.createAsyncThunk('Reservation/fetchReservation'
147
147
  }));
148
148
  const ReservationSlice = toolkit.createSlice({
149
149
  name: 'reservation',
150
- initialState: initialState$f,
150
+ initialState: initialState$h,
151
151
  reducers: {
152
152
  setForm: (state, action) => {
153
153
  state.form = action.payload;
@@ -240,7 +240,115 @@ const Toast = {
240
240
  selectors: selectors$1,
241
241
  };
242
242
 
243
- const initialState$e = {
243
+ const initialState$g = {
244
+ loading: 'idle',
245
+ comments: [],
246
+ };
247
+ const fetchComments = toolkit.createAsyncThunk('commentList/fetchCommentList', (params, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
248
+ var _a;
249
+ try {
250
+ const res = yield extra.jApi.article.getComments(params, 'raw-list');
251
+ return { idArticle: params.idArticle, list: res.result };
252
+ }
253
+ catch (error) {
254
+ dispatch(Toast.actions.error({ label: (_a = error.errorMsg) !== null && _a !== void 0 ? _a : 'GLOBAL_Technical_Error' }));
255
+ return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve comments' });
256
+ }
257
+ }));
258
+ const CommentListSlice = toolkit.createSlice({
259
+ name: 'commentList',
260
+ initialState: initialState$g,
261
+ reducers: {
262
+ discardComments: (state, action) => {
263
+ state.comments = state.comments.filter((c) => c.idArticle !== action.payload.idArticle);
264
+ },
265
+ },
266
+ extraReducers: (builder) => {
267
+ builder
268
+ .addCase(fetchComments.pending, (state) => {
269
+ state.loading = 'pending';
270
+ })
271
+ .addCase(fetchComments.fulfilled, (state, action) => {
272
+ state.loading = 'idle';
273
+ state.comments = [
274
+ ...state.comments.filter((c) => c.idArticle !== action.payload.idArticle),
275
+ {
276
+ idArticle: action.payload.idArticle,
277
+ list: action.payload.list.reverse(),
278
+ },
279
+ ];
280
+ })
281
+ .addCase(fetchComments.rejected, (state) => {
282
+ state.loading = 'idle';
283
+ });
284
+ },
285
+ });
286
+
287
+ const getCommentRTHandlers = function (dispatch, idArticle) {
288
+ const addCommentHandler = function (message) {
289
+ if (message.namespace === 'JAMESPOT' &&
290
+ message.function === 'comment-create' &&
291
+ message.object.idArticle === idArticle) {
292
+ dispatch(fetchComments({ idArticle }));
293
+ }
294
+ };
295
+ const deleteCommentHandler = function (message) {
296
+ if (message.namespace === 'JAMESPOT' &&
297
+ message.function === 'comment-delete' &&
298
+ Number(message.object.idArticle) === idArticle) {
299
+ dispatch(fetchComments({ idArticle }));
300
+ }
301
+ };
302
+ return [
303
+ {
304
+ namespace: 'JAMESPOT',
305
+ function: 'comment-create',
306
+ handler: addCommentHandler,
307
+ },
308
+ {
309
+ namespace: 'JAMESPOT',
310
+ function: 'comment-delete',
311
+ handler: deleteCommentHandler,
312
+ },
313
+ ];
314
+ };
315
+
316
+ const getCommentsLikeRTHandlers = function (dispatch, idComments, idArticle) {
317
+ const commentLikeHandler = function (message) {
318
+ if (message.namespace === 'CUSTOM-ACTION' &&
319
+ (message.function === 'add' || message.function === 'remove') &&
320
+ message.object.type === 'sociallike' &&
321
+ message.object.targetId &&
322
+ idComments &&
323
+ idComments.includes(message.object.targetId)) {
324
+ dispatch(fetchComments({ idArticle }));
325
+ }
326
+ };
327
+ return idComments ? [
328
+ { namespace: 'CUSTOM-ACTION', function: 'add', handler: commentLikeHandler },
329
+ { namespace: 'CUSTOM-ACTION', function: 'remove', handler: commentLikeHandler },
330
+ ] : [];
331
+ };
332
+
333
+ const CommentReducer = redux.combineReducers({
334
+ [CommentListSlice.name]: CommentListSlice.reducer,
335
+ });
336
+ const commentSlice = {
337
+ name: 'comment',
338
+ reducer: CommentReducer,
339
+ };
340
+ const selectCommentList = (state, idArticle) => state.comment.commentList.comments.find((c) => c.idArticle === idArticle);
341
+ const Comment = {
342
+ slice: commentSlice,
343
+ actions: Object.assign({ fetchComments }, CommentListSlice.actions),
344
+ selectors: {
345
+ commentList: selectCommentList,
346
+ },
347
+ getCommentRTHandlers,
348
+ getCommentsLikeRTHandlers,
349
+ };
350
+
351
+ const initialState$f = {
244
352
  bookmarks: [],
245
353
  loading: 'idle',
246
354
  status: undefined,
@@ -303,7 +411,7 @@ const deleteBookmark = toolkit.createAsyncThunk('bookmarkList/deleteBookmark', (
303
411
  }));
304
412
  const BookmarkListSlice = toolkit.createSlice({
305
413
  name: 'bookmarkList',
306
- initialState: initialState$e,
414
+ initialState: initialState$f,
307
415
  reducers: {
308
416
  resetAddBookmarkStatus: (state, action) => {
309
417
  if (state.add[action.payload]) {
@@ -413,7 +521,7 @@ const BookmarkListSlice = toolkit.createSlice({
413
521
  },
414
522
  });
415
523
 
416
- const getRTHandlers = function (dispatch) {
524
+ const getBookmarkRTHandlers = function (dispatch) {
417
525
  const dispatchOrFetch = function (message, action) {
418
526
  if (jamespot.jEnsure.objectIsType('bookmarkLink', message.object)) {
419
527
  dispatch(action(message.object));
@@ -466,7 +574,7 @@ const getRTHandlers = function (dispatch) {
466
574
  ];
467
575
  };
468
576
 
469
- const initialState$d = {
577
+ const initialState$e = {
470
578
  bookmark: undefined,
471
579
  status: undefined,
472
580
  loading: 'idle',
@@ -488,7 +596,7 @@ const editBookmark = toolkit.createAsyncThunk('bookmarkEdit/editBookmark', (book
488
596
  }));
489
597
  const BookmarkEditSlice = toolkit.createSlice({
490
598
  name: 'bookmarkEdit',
491
- initialState: initialState$d,
599
+ initialState: initialState$e,
492
600
  reducers: {
493
601
  setEditBookmark: (state, action) => {
494
602
  state.bookmark = Object.assign({}, action.payload);
@@ -538,17 +646,17 @@ const Bookmark = {
538
646
  bookmarkListIsInitialized: selectBookmarkListIsInitialized,
539
647
  bookmarkEditBookmark: selectBookmarkEditBookmark
540
648
  },
541
- getRTHandlers: getRTHandlers,
649
+ getRTHandlers: getBookmarkRTHandlers,
542
650
  };
543
651
 
544
- const initialState$c = {
652
+ const initialState$d = {
545
653
  loading: 'idle',
546
654
  access: { createCategory: false },
547
655
  };
548
656
  const fetchFaqConfig = toolkit.createAsyncThunk('faqConfig/fetch', () => __awaiter(void 0, void 0, void 0, function* () {
549
657
  try {
550
658
  const [hookProperties, access] = yield Promise.all([
551
- yield jamespot__default["default"].faq.getHookProperties(['_web', 'appImage', 'appImageText']),
659
+ yield jamespot__default["default"].faq.getHookProperties(['_web', 'appImage', 'appImageText', '_displayComment']),
552
660
  yield jamespot__default["default"].faq.getAccess()
553
661
  ]);
554
662
  return {
@@ -556,6 +664,7 @@ const fetchFaqConfig = toolkit.createAsyncThunk('faqConfig/fetch', () => __await
556
664
  appImage: hookProperties.result.appImage,
557
665
  appImageText: hookProperties.result.appImageText,
558
666
  access: access.result,
667
+ _displayComment: hookProperties.result._displayComment,
559
668
  };
560
669
  }
561
670
  catch (e) {
@@ -569,7 +678,7 @@ const fetchFaqConfig = toolkit.createAsyncThunk('faqConfig/fetch', () => __await
569
678
  }));
570
679
  const FaqConfigSlice = toolkit.createSlice({
571
680
  name: 'config',
572
- initialState: initialState$c,
681
+ initialState: initialState$d,
573
682
  reducers: {},
574
683
  extraReducers: (builder) => {
575
684
  builder
@@ -592,6 +701,9 @@ const FaqConfigSlice = toolkit.createSlice({
592
701
  if (action.payload.access) {
593
702
  state.access = action.payload.access;
594
703
  }
704
+ if (action.payload._displayComment !== undefined) {
705
+ state._displayComment = action.payload._displayComment;
706
+ }
595
707
  return state;
596
708
  })
597
709
  .addCase(fetchFaqConfig.rejected, (state) => {
@@ -601,7 +713,7 @@ const FaqConfigSlice = toolkit.createSlice({
601
713
  },
602
714
  });
603
715
 
604
- const initialState$b = {
716
+ const initialState$c = {
605
717
  loading: 'idle',
606
718
  categories: null,
607
719
  };
@@ -613,7 +725,7 @@ const fetchFaqCategories = toolkit.createAsyncThunk('faqCategories/fetch', () =>
613
725
  }));
614
726
  const FaqCategoriesSlice = toolkit.createSlice({
615
727
  name: 'categories',
616
- initialState: initialState$b,
728
+ initialState: initialState$c,
617
729
  reducers: {},
618
730
  extraReducers: (builder) => {
619
731
  builder
@@ -634,13 +746,13 @@ const FaqCategoriesSlice = toolkit.createSlice({
634
746
  },
635
747
  });
636
748
 
637
- const joinedReducers$5 = toolkit.combineReducers({
749
+ const joinedReducers$6 = toolkit.combineReducers({
638
750
  [FaqConfigSlice.name]: FaqConfigSlice.reducer,
639
751
  [FaqCategoriesSlice.name]: FaqCategoriesSlice.reducer,
640
752
  });
641
753
  const FaqSlice = {
642
754
  name: 'faq',
643
- reducer: joinedReducers$5,
755
+ reducer: joinedReducers$6,
644
756
  };
645
757
  const selectFaqConfig = (state) => {
646
758
  return state.faq.config;
@@ -895,7 +1007,7 @@ const initialMap = {
895
1007
  illustration: '',
896
1008
  assignLicense: false,
897
1009
  };
898
- const initialState$a = {
1010
+ const initialState$b = {
899
1011
  map: Object.assign({}, initialMap),
900
1012
  loading: 'idle',
901
1013
  status: undefined,
@@ -939,13 +1051,13 @@ const createMap = toolkit.createAsyncThunk('mapCreate/create', ({ map, jlandUrlB
939
1051
  }));
940
1052
  const MapCreateSlice = toolkit.createSlice({
941
1053
  name: 'mapCreate',
942
- initialState: initialState$a,
1054
+ initialState: initialState$b,
943
1055
  reducers: {
944
1056
  setMap: (state, action) => {
945
1057
  state.map = action.payload;
946
1058
  },
947
1059
  resetCreateMapState: () => {
948
- return initialState$a;
1060
+ return initialState$b;
949
1061
  },
950
1062
  },
951
1063
  extraReducers: (builder) => {
@@ -975,13 +1087,13 @@ const selectJLandAvailableLicenses = function selectJLandAvailableLicenses(state
975
1087
  const selectMapCreate = function selectMapCreate(state) {
976
1088
  return state.jland.mapCreate;
977
1089
  };
978
- const joinedReducers$4 = toolkit.combineReducers({
1090
+ const joinedReducers$5 = toolkit.combineReducers({
979
1091
  [JLandMapListSlice.name]: JLandMapListSlice.reducer,
980
1092
  [MapCreateSlice.name]: MapCreateSlice.reducer,
981
1093
  });
982
1094
  const jlandSlice = {
983
1095
  name: 'jland',
984
- reducer: joinedReducers$4,
1096
+ reducer: joinedReducers$5,
985
1097
  };
986
1098
  const jland = {
987
1099
  slice: jlandSlice,
@@ -1032,10 +1144,10 @@ const Model = {
1032
1144
  selectors: Object.assign(Object.assign({}, selectors), { selectByIds }),
1033
1145
  };
1034
1146
 
1035
- const initialState$9 = {};
1147
+ const initialState$a = {};
1036
1148
  const NetworkStaticsSlice = toolkit.createSlice({
1037
1149
  name: 'statics',
1038
- initialState: initialState$9,
1150
+ initialState: initialState$a,
1039
1151
  reducers: {
1040
1152
  initNetworkStatics: (_, { payload }) => {
1041
1153
  return payload;
@@ -1043,12 +1155,12 @@ const NetworkStaticsSlice = toolkit.createSlice({
1043
1155
  },
1044
1156
  });
1045
1157
 
1046
- const joinedReducers$3 = toolkit.combineReducers({
1158
+ const joinedReducers$4 = toolkit.combineReducers({
1047
1159
  [NetworkStaticsSlice.name]: NetworkStaticsSlice.reducer,
1048
1160
  });
1049
1161
  const NetworkSlice = {
1050
1162
  name: 'network',
1051
- reducer: joinedReducers$3,
1163
+ reducer: joinedReducers$4,
1052
1164
  };
1053
1165
  const selectNetworkStatics = (state) => {
1054
1166
  return state.network.statics;
@@ -1069,6 +1181,46 @@ const Network = {
1069
1181
  },
1070
1182
  };
1071
1183
 
1184
+ const initialState$9 = {
1185
+ userHighlightFields: [],
1186
+ userAccountStatus: 0
1187
+ };
1188
+ const PlatformConfigSlice = toolkit.createSlice({
1189
+ name: 'config',
1190
+ initialState: initialState$9,
1191
+ reducers: {
1192
+ initPlatformConfig: (_, { payload }) => {
1193
+ return payload;
1194
+ },
1195
+ },
1196
+ });
1197
+
1198
+ const joinedReducers$3 = toolkit.combineReducers({
1199
+ [PlatformConfigSlice.name]: PlatformConfigSlice.reducer,
1200
+ });
1201
+ const PlatformSlice = {
1202
+ name: 'platform',
1203
+ reducer: joinedReducers$3,
1204
+ };
1205
+ const selectPlatformConfig = (state) => {
1206
+ return state.platform.config;
1207
+ };
1208
+ const selectUserHighlightFields = (state) => {
1209
+ return state.platform.config.userHighlightFields;
1210
+ };
1211
+ const selectUserAccountStatus = (state) => {
1212
+ return state.platform.config.userAccountStatus;
1213
+ };
1214
+ const Platform = {
1215
+ slice: PlatformSlice,
1216
+ actions: Object.assign({}, PlatformConfigSlice.actions),
1217
+ selectors: {
1218
+ selectPlatformConfig,
1219
+ selectUserHighlightFields,
1220
+ selectUserAccountStatus,
1221
+ },
1222
+ };
1223
+
1072
1224
  const initialQuery = {
1073
1225
  query: '',
1074
1226
  filters: [],
@@ -2394,12 +2546,14 @@ exports.AppFormUniqueList = AppFormUniqueList;
2394
2546
  exports.Application = Application;
2395
2547
  exports.AssetReservation = AssetReservation;
2396
2548
  exports.Bookmark = Bookmark;
2549
+ exports.Comment = Comment;
2397
2550
  exports.Faq = Faq;
2398
2551
  exports.MODE_EDIT = MODE_EDIT;
2399
2552
  exports.MODE_VIEW = MODE_VIEW;
2400
2553
  exports.MapExtraFieldsWithView = MapExtraFieldsWithView;
2401
2554
  exports.Model = Model;
2402
2555
  exports.Network = Network;
2556
+ exports.Platform = Platform;
2403
2557
  exports.STUDIO_VIEW = STUDIO_VIEW;
2404
2558
  exports.Share = Share;
2405
2559
  exports.TVDisplay = TVDisplay;