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/esm.js CHANGED
@@ -77,6 +77,38 @@ const Toast = {
77
77
  selectors: selectors$2,
78
78
  };
79
79
 
80
+ const initialState$m = {
81
+ animationConfiguration: null,
82
+ isActiveForCurrentUser: false,
83
+ isInitialized: false,
84
+ isToggleLoading: false,
85
+ };
86
+ const animationsListSlice = createSlice({
87
+ name: 'animationsList',
88
+ initialState: initialState$m,
89
+ reducers: {},
90
+ extraReducers: (builder) => {
91
+ builder.addCase(fetchCurrentAnimation.fulfilled, (state, action) => {
92
+ state.isActiveForCurrentUser = action.payload.isActiveForCurrentUser;
93
+ state.animationConfiguration = action.payload.animationConfiguration;
94
+ state.isInitialized = action.payload.isInitialized;
95
+ });
96
+ builder.addCase(fetchCurrentAnimationApp.fulfilled, (state, action) => {
97
+ state.animationConfigurationApp = action.payload;
98
+ });
99
+ builder.addCase(toggleAnimationIsActive.pending, (state) => {
100
+ state.isToggleLoading = true;
101
+ state.isActiveForCurrentUser = !state.isActiveForCurrentUser;
102
+ });
103
+ builder.addCase(toggleAnimationIsActive.fulfilled, (state) => {
104
+ state.isToggleLoading = false;
105
+ });
106
+ builder.addCase(toggleAnimationIsActive.rejected, (state) => {
107
+ state.isActiveForCurrentUser = !state.isActiveForCurrentUser;
108
+ state.isToggleLoading = false;
109
+ });
110
+ },
111
+ });
80
112
  const fetchCurrentAnimation = createAsyncThunk('animations/fetchCurrentAnimation', (_, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
81
113
  try {
82
114
  const animationConfiguration = (yield extra.jApi.animations.GetCurrentAnimation()).result;
@@ -165,42 +197,83 @@ const getAnimationsRTHandlers = function (dispatch) {
165
197
  ];
166
198
  };
167
199
 
168
- const initialState$m = {
169
- animationConfiguration: null,
170
- isActiveForCurrentUser: false,
171
- isInitialized: false,
172
- isToggleLoading: false,
200
+ const fetchAnimationStats = createAsyncThunk('animations/fetchAnimationStats', ({ name }, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
201
+ try {
202
+ const stats = (yield extra.jApi.animations.GetAnimationStats(name)).result.data;
203
+ return stats;
204
+ }
205
+ catch (_) {
206
+ dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
207
+ return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve animation stats' });
208
+ }
209
+ }));
210
+ const animationStatsInitialState$1 = {
211
+ stats: [],
212
+ loading: 'idle',
173
213
  };
174
- const animationsSlice = createSlice({
175
- name: 'animations',
176
- initialState: initialState$m,
214
+ const animationStatsSlice = createSlice({
215
+ name: 'animationStats',
216
+ initialState: animationStatsInitialState$1,
177
217
  reducers: {},
178
218
  extraReducers: (builder) => {
179
- builder.addCase(fetchCurrentAnimation.fulfilled, (state, action) => {
180
- state.isActiveForCurrentUser = action.payload.isActiveForCurrentUser;
181
- state.animationConfiguration = action.payload.animationConfiguration;
182
- state.isInitialized = action.payload.isInitialized;
219
+ builder.addCase(fetchAnimationStats.pending, (state) => {
220
+ state.loading = 'pending';
183
221
  });
184
- builder.addCase(fetchCurrentAnimationApp.fulfilled, (state, action) => {
185
- state.animationConfigurationApp = action.payload;
222
+ builder.addCase(fetchAnimationStats.fulfilled, (state, action) => {
223
+ state.loading = 'idle';
224
+ state.stats = action.payload;
186
225
  });
187
- builder.addCase(toggleAnimationIsActive.pending, (state) => {
188
- state.isToggleLoading = true;
189
- state.isActiveForCurrentUser = !state.isActiveForCurrentUser;
226
+ builder.addCase(fetchAnimationStats.rejected, (state) => {
227
+ state.loading = 'idle';
190
228
  });
191
- builder.addCase(toggleAnimationIsActive.fulfilled, (state) => {
192
- state.isToggleLoading = false;
229
+ }
230
+ });
231
+
232
+ const fetchAnimationStatsCurrent = createAsyncThunk('animations/fetchAnimationStatsCurrent', (uri, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
233
+ try {
234
+ const stats = (yield extra.jApi.animations.GetAnimationStatsCurrent(uri)).result;
235
+ return stats;
236
+ }
237
+ catch (_) {
238
+ dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
239
+ return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve animation stats current' });
240
+ }
241
+ }));
242
+ const animationStatsInitialState = {
243
+ stats: null,
244
+ loading: 'idle',
245
+ };
246
+ const animationStatsCurrentSlice = createSlice({
247
+ name: 'animationStatsCurrent',
248
+ initialState: animationStatsInitialState,
249
+ reducers: {},
250
+ extraReducers: (builder) => {
251
+ builder.addCase(fetchAnimationStatsCurrent.pending, (state) => {
252
+ state.loading = 'pending';
193
253
  });
194
- builder.addCase(toggleAnimationIsActive.rejected, (state) => {
195
- state.isActiveForCurrentUser = !state.isActiveForCurrentUser;
196
- state.isToggleLoading = false;
254
+ builder.addCase(fetchAnimationStatsCurrent.fulfilled, (state, action) => {
255
+ state.loading = 'idle';
256
+ state.stats = action.payload;
197
257
  });
198
- },
258
+ builder.addCase(fetchAnimationStatsCurrent.rejected, (state) => {
259
+ state.loading = 'idle';
260
+ });
261
+ }
262
+ });
263
+
264
+ const selectCurrentAnimation = (state) => state.animations.animationsList.animationConfiguration;
265
+ const isActiveAnimation = (state) => state.animations.animationsList.isActiveForCurrentUser;
266
+ const isToggleLoading = (state) => state.animations.animationsList.isToggleLoading;
267
+ const selectAnimationConfigurationApp = (state) => state.animations.animationsList.animationConfigurationApp;
268
+ const animationsSliceReducer = combineReducers({
269
+ [animationsListSlice.name]: animationsListSlice.reducer,
270
+ [animationStatsSlice.name]: animationStatsSlice.reducer,
271
+ [animationStatsCurrentSlice.name]: animationStatsCurrentSlice.reducer,
199
272
  });
200
- const selectCurrentAnimation = (state) => state.animations.animationConfiguration;
201
- const isActiveAnimation = (state) => state.animations.isActiveForCurrentUser;
202
- const isToggleLoading = (state) => state.animations.isToggleLoading;
203
- const selectAnimationConfigurationApp = (state) => state.animations.animationConfigurationApp;
273
+ const animationsSlice = {
274
+ name: 'animations',
275
+ reducer: animationsSliceReducer,
276
+ };
204
277
  const animationsReducer = animationsSlice.reducer;
205
278
  const Animations = {
206
279
  slice: animationsSlice,
@@ -210,6 +283,8 @@ const Animations = {
210
283
  deleteCurrentAnimation,
211
284
  toggleAnimationIsActive,
212
285
  fetchCurrentAnimationApp,
286
+ fetchAnimationStats,
287
+ fetchAnimationStatsCurrent,
213
288
  },
214
289
  selectors: { selectCurrentAnimation, isActiveAnimation, isToggleLoading, selectAnimationConfigurationApp },
215
290
  getAnimationsRTHandlers,
@@ -774,6 +849,7 @@ const bookmarkSlice = {
774
849
  const selectBookmarkList = (state) => state.bookmark.bookmarkList;
775
850
  const selectBookmarkListIsInitialized = (state) => state.bookmark.bookmarkList.isInitialized;
776
851
  const selectBookmarkEditBookmark = (state) => state.bookmark.bookmarkEdit.bookmark;
852
+ const selectBookmarkByArticleId = (state, idArticle) => state.bookmark.bookmarkList.bookmarks.find((bookmark) => bookmark.targetId === idArticle);
777
853
  const Bookmark = {
778
854
  slice: bookmarkSlice,
779
855
  actions: Object.assign(Object.assign({ fetchBookmark,
@@ -785,6 +861,7 @@ const Bookmark = {
785
861
  bookmarkList: selectBookmarkList,
786
862
  bookmarkListIsInitialized: selectBookmarkListIsInitialized,
787
863
  bookmarkEditBookmark: selectBookmarkEditBookmark,
864
+ bookmarkByArticleId: selectBookmarkByArticleId,
788
865
  },
789
866
  getRTHandlers: getBookmarkRTHandlers,
790
867
  };