jamespot-front-business 1.1.57 → 1.1.59

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
@@ -85,6 +85,38 @@ const Toast = {
85
85
  selectors: selectors$2,
86
86
  };
87
87
 
88
+ const initialState$m = {
89
+ animationConfiguration: null,
90
+ isActiveForCurrentUser: false,
91
+ isInitialized: false,
92
+ isToggleLoading: false,
93
+ };
94
+ const animationsListSlice = toolkit.createSlice({
95
+ name: 'animationsList',
96
+ initialState: initialState$m,
97
+ reducers: {},
98
+ extraReducers: (builder) => {
99
+ builder.addCase(fetchCurrentAnimation.fulfilled, (state, action) => {
100
+ state.isActiveForCurrentUser = action.payload.isActiveForCurrentUser;
101
+ state.animationConfiguration = action.payload.animationConfiguration;
102
+ state.isInitialized = action.payload.isInitialized;
103
+ });
104
+ builder.addCase(fetchCurrentAnimationApp.fulfilled, (state, action) => {
105
+ state.animationConfigurationApp = action.payload;
106
+ });
107
+ builder.addCase(toggleAnimationIsActive.pending, (state) => {
108
+ state.isToggleLoading = true;
109
+ state.isActiveForCurrentUser = !state.isActiveForCurrentUser;
110
+ });
111
+ builder.addCase(toggleAnimationIsActive.fulfilled, (state) => {
112
+ state.isToggleLoading = false;
113
+ });
114
+ builder.addCase(toggleAnimationIsActive.rejected, (state) => {
115
+ state.isActiveForCurrentUser = !state.isActiveForCurrentUser;
116
+ state.isToggleLoading = false;
117
+ });
118
+ },
119
+ });
88
120
  const fetchCurrentAnimation = toolkit.createAsyncThunk('animations/fetchCurrentAnimation', (_, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
89
121
  try {
90
122
  const animationConfiguration = (yield extra.jApi.animations.GetCurrentAnimation()).result;
@@ -173,42 +205,83 @@ const getAnimationsRTHandlers = function (dispatch) {
173
205
  ];
174
206
  };
175
207
 
176
- const initialState$m = {
177
- animationConfiguration: null,
178
- isActiveForCurrentUser: false,
179
- isInitialized: false,
180
- isToggleLoading: false,
208
+ const fetchAnimationStats = toolkit.createAsyncThunk('animations/fetchAnimationStats', ({ name }, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
209
+ try {
210
+ const stats = (yield extra.jApi.animations.GetAnimationStats(name)).result.data;
211
+ return stats;
212
+ }
213
+ catch (_) {
214
+ dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
215
+ return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve animation stats' });
216
+ }
217
+ }));
218
+ const animationStatsInitialState$1 = {
219
+ stats: [],
220
+ loading: 'idle',
181
221
  };
182
- const animationsSlice = toolkit.createSlice({
183
- name: 'animations',
184
- initialState: initialState$m,
222
+ const animationStatsSlice = toolkit.createSlice({
223
+ name: 'animationStats',
224
+ initialState: animationStatsInitialState$1,
185
225
  reducers: {},
186
226
  extraReducers: (builder) => {
187
- builder.addCase(fetchCurrentAnimation.fulfilled, (state, action) => {
188
- state.isActiveForCurrentUser = action.payload.isActiveForCurrentUser;
189
- state.animationConfiguration = action.payload.animationConfiguration;
190
- state.isInitialized = action.payload.isInitialized;
227
+ builder.addCase(fetchAnimationStats.pending, (state) => {
228
+ state.loading = 'pending';
191
229
  });
192
- builder.addCase(fetchCurrentAnimationApp.fulfilled, (state, action) => {
193
- state.animationConfigurationApp = action.payload;
230
+ builder.addCase(fetchAnimationStats.fulfilled, (state, action) => {
231
+ state.loading = 'idle';
232
+ state.stats = action.payload;
194
233
  });
195
- builder.addCase(toggleAnimationIsActive.pending, (state) => {
196
- state.isToggleLoading = true;
197
- state.isActiveForCurrentUser = !state.isActiveForCurrentUser;
234
+ builder.addCase(fetchAnimationStats.rejected, (state) => {
235
+ state.loading = 'idle';
198
236
  });
199
- builder.addCase(toggleAnimationIsActive.fulfilled, (state) => {
200
- state.isToggleLoading = false;
237
+ }
238
+ });
239
+
240
+ const fetchAnimationStatsCurrent = toolkit.createAsyncThunk('animations/fetchAnimationStatsCurrent', (uri, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
241
+ try {
242
+ const stats = (yield extra.jApi.animations.GetAnimationStatsCurrent(uri)).result;
243
+ return stats;
244
+ }
245
+ catch (_) {
246
+ dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
247
+ return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve animation stats current' });
248
+ }
249
+ }));
250
+ const animationStatsInitialState = {
251
+ stats: null,
252
+ loading: 'idle',
253
+ };
254
+ const animationStatsCurrentSlice = toolkit.createSlice({
255
+ name: 'animationStatsCurrent',
256
+ initialState: animationStatsInitialState,
257
+ reducers: {},
258
+ extraReducers: (builder) => {
259
+ builder.addCase(fetchAnimationStatsCurrent.pending, (state) => {
260
+ state.loading = 'pending';
201
261
  });
202
- builder.addCase(toggleAnimationIsActive.rejected, (state) => {
203
- state.isActiveForCurrentUser = !state.isActiveForCurrentUser;
204
- state.isToggleLoading = false;
262
+ builder.addCase(fetchAnimationStatsCurrent.fulfilled, (state, action) => {
263
+ state.loading = 'idle';
264
+ state.stats = action.payload;
205
265
  });
206
- },
266
+ builder.addCase(fetchAnimationStatsCurrent.rejected, (state) => {
267
+ state.loading = 'idle';
268
+ });
269
+ }
270
+ });
271
+
272
+ const selectCurrentAnimation = (state) => state.animations.animationsList.animationConfiguration;
273
+ const isActiveAnimation = (state) => state.animations.animationsList.isActiveForCurrentUser;
274
+ const isToggleLoading = (state) => state.animations.animationsList.isToggleLoading;
275
+ const selectAnimationConfigurationApp = (state) => state.animations.animationsList.animationConfigurationApp;
276
+ const animationsSliceReducer = toolkit.combineReducers({
277
+ [animationsListSlice.name]: animationsListSlice.reducer,
278
+ [animationStatsSlice.name]: animationStatsSlice.reducer,
279
+ [animationStatsCurrentSlice.name]: animationStatsCurrentSlice.reducer,
207
280
  });
208
- const selectCurrentAnimation = (state) => state.animations.animationConfiguration;
209
- const isActiveAnimation = (state) => state.animations.isActiveForCurrentUser;
210
- const isToggleLoading = (state) => state.animations.isToggleLoading;
211
- const selectAnimationConfigurationApp = (state) => state.animations.animationConfigurationApp;
281
+ const animationsSlice = {
282
+ name: 'animations',
283
+ reducer: animationsSliceReducer,
284
+ };
212
285
  const animationsReducer = animationsSlice.reducer;
213
286
  const Animations = {
214
287
  slice: animationsSlice,
@@ -218,6 +291,8 @@ const Animations = {
218
291
  deleteCurrentAnimation,
219
292
  toggleAnimationIsActive,
220
293
  fetchCurrentAnimationApp,
294
+ fetchAnimationStats,
295
+ fetchAnimationStatsCurrent,
221
296
  },
222
297
  selectors: { selectCurrentAnimation, isActiveAnimation, isToggleLoading, selectAnimationConfigurationApp },
223
298
  getAnimationsRTHandlers,
@@ -782,6 +857,7 @@ const bookmarkSlice = {
782
857
  const selectBookmarkList = (state) => state.bookmark.bookmarkList;
783
858
  const selectBookmarkListIsInitialized = (state) => state.bookmark.bookmarkList.isInitialized;
784
859
  const selectBookmarkEditBookmark = (state) => state.bookmark.bookmarkEdit.bookmark;
860
+ const selectBookmarkByArticleId = (state, idArticle) => state.bookmark.bookmarkList.bookmarks.find((bookmark) => bookmark.targetId === idArticle);
785
861
  const Bookmark = {
786
862
  slice: bookmarkSlice,
787
863
  actions: Object.assign(Object.assign({ fetchBookmark,
@@ -793,6 +869,7 @@ const Bookmark = {
793
869
  bookmarkList: selectBookmarkList,
794
870
  bookmarkListIsInitialized: selectBookmarkListIsInitialized,
795
871
  bookmarkEditBookmark: selectBookmarkEditBookmark,
872
+ bookmarkByArticleId: selectBookmarkByArticleId,
796
873
  },
797
874
  getRTHandlers: getBookmarkRTHandlers,
798
875
  };