jamespot-front-business 1.1.39 → 1.1.40

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
@@ -3,26 +3,6 @@ import { combineReducers as combineReducers$1 } from 'redux';
3
3
  import jamespot, { jEnsure, formatImgUrl, UserLevel, StudioApplicationStatus } from 'jamespot-user-api';
4
4
  import { v4 } from 'uuid';
5
5
 
6
- const adapter$1 = createEntityAdapter({
7
- selectId: (app) => app.name,
8
- sortComparer: (a, b) => a.label.localeCompare(b.label),
9
- });
10
- const slice$3 = createSlice({
11
- name: 'applications',
12
- initialState: adapter$1.getInitialState(),
13
- reducers: {
14
- addOne: adapter$1.addOne,
15
- addMany: adapter$1.addMany,
16
- setAll: adapter$1.setAll,
17
- },
18
- });
19
- const selectors$2 = adapter$1.getSelectors((state) => state.entities.applications);
20
- const Application = {
21
- slice: slice$3,
22
- actions: Object.assign({}, slice$3.actions),
23
- selectors: selectors$2,
24
- };
25
-
26
6
  /******************************************************************************
27
7
  Copyright (c) Microsoft Corporation.
28
8
 
@@ -60,6 +40,195 @@ function __awaiter(thisArg, _arguments, P, generator) {
60
40
  });
61
41
  }
62
42
 
43
+ const toastAdapter = createEntityAdapter({
44
+ selectId: (toast) => toast.id,
45
+ });
46
+ const slice$3 = createSlice({
47
+ name: 'toasts',
48
+ initialState: toastAdapter.getInitialState(),
49
+ reducers: {
50
+ addOne: toastAdapter.addOne,
51
+ removeOne: toastAdapter.removeOne,
52
+ },
53
+ });
54
+ const randomId = () => Math.random().toString(16).slice(2);
55
+ const addMessage = (_a, type, timeout) => {
56
+ var { id = randomId() } = _a, toast = __rest(_a, ["id"]);
57
+ if (type === void 0) { type = 'success'; }
58
+ if (timeout === void 0) { timeout = 3000; }
59
+ return (dispatch) => {
60
+ dispatch(slice$3.actions.addOne(Object.assign(Object.assign({ id }, toast), { timeout, type })));
61
+ setTimeout(() => {
62
+ dispatch(slice$3.actions.removeOne(id));
63
+ }, timeout);
64
+ return id;
65
+ };
66
+ };
67
+ const actions = {
68
+ addMessage,
69
+ success: (toast, timeout) => addMessage(toast, 'success', timeout),
70
+ warning: (toast, timeout) => addMessage(toast, 'warning', timeout),
71
+ error: (toast, timeout) => addMessage(toast, 'error', timeout),
72
+ };
73
+ const selectors$2 = toastAdapter.getSelectors((state) => state.toasts);
74
+ const Toast = {
75
+ slice: slice$3,
76
+ actions: Object.assign(Object.assign({}, actions), slice$3.actions),
77
+ selectors: selectors$2,
78
+ };
79
+
80
+ const getAnimationsRTHandlers = function (dispatch) {
81
+ const addAnimationHandler = function (message) {
82
+ if (message.namespace === 'ANIMATIONS' &&
83
+ message.function === 'add') {
84
+ dispatch(fetchCurrentAnimation());
85
+ dispatch(fetchCurrentAnimationApp());
86
+ }
87
+ };
88
+ const deleteAnimationHandler = function (message) {
89
+ if (message.namespace === 'ANIMATIONS' &&
90
+ message.function === 'delete') {
91
+ dispatch(fetchCurrentAnimation());
92
+ dispatch(fetchCurrentAnimationApp());
93
+ }
94
+ };
95
+ const toggleIsActiveAnimationHandler = function (message) {
96
+ if (message.namespace === 'ANIMATIONS' &&
97
+ message.function === 'toggle') {
98
+ dispatch(fetchCurrentAnimation());
99
+ }
100
+ };
101
+ return [
102
+ {
103
+ namespace: 'ANIMATIONS',
104
+ function: 'add',
105
+ handler: addAnimationHandler,
106
+ },
107
+ {
108
+ namespace: 'ANIMATIONS',
109
+ function: 'delete',
110
+ handler: deleteAnimationHandler,
111
+ },
112
+ {
113
+ namespace: 'ANIMATIONS',
114
+ function: 'toggle',
115
+ handler: toggleIsActiveAnimationHandler,
116
+ },
117
+ ];
118
+ };
119
+
120
+ const initialState$k = {
121
+ animationConfiguration: null,
122
+ isActiveForCurrentUser: false,
123
+ isInitialized: false,
124
+ isToggleLoading: false,
125
+ };
126
+ const animationsSlice = createSlice({
127
+ name: 'animations',
128
+ initialState: initialState$k,
129
+ reducers: {},
130
+ extraReducers: (builder) => {
131
+ builder.addCase(fetchCurrentAnimation.fulfilled, (state, action) => {
132
+ state.isActiveForCurrentUser = action.payload.isActiveForCurrentUser;
133
+ state.animationConfiguration = action.payload.animationConfiguration;
134
+ state.isInitialized = action.payload.isInitialized;
135
+ });
136
+ builder.addCase(fetchCurrentAnimationApp.fulfilled, (state, action) => {
137
+ state.animationConfigurationApp = action.payload;
138
+ });
139
+ builder.addCase(toggleAnimationIsActive.pending, (state) => {
140
+ state.isToggleLoading = true;
141
+ });
142
+ builder.addCase(toggleAnimationIsActive.fulfilled, (state) => {
143
+ state.isToggleLoading = false;
144
+ });
145
+ builder.addCase(toggleAnimationIsActive.rejected, (state) => {
146
+ state.isToggleLoading = false;
147
+ });
148
+ },
149
+ });
150
+ const fetchCurrentAnimation = createAsyncThunk('animations/fetchCurrentAnimation', (_, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
151
+ try {
152
+ const animationConfiguration = (yield extra.jApi.animations.GetCurrentAnimation()).result;
153
+ const isActiveForCurrentUser = (yield extra.jApi.animations.GetAnimationActive()).result;
154
+ return { animationConfiguration, isActiveForCurrentUser, isInitialized: true };
155
+ }
156
+ catch (_) {
157
+ dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
158
+ return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve animation' });
159
+ }
160
+ }));
161
+ const fetchCurrentAnimationApp = createAsyncThunk('animations/fetchCurrentAnimationApp', (_, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
162
+ try {
163
+ return (yield extra.jApi.animations.GetCurrentAnimationApp()).result;
164
+ }
165
+ catch (_) {
166
+ dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
167
+ return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve animation' });
168
+ }
169
+ }));
170
+ const deleteCurrentAnimation = createAsyncThunk('animations/deleteCurrentAnimation', (_, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
171
+ try {
172
+ yield extra.jApi.animations.DeleteAnimation();
173
+ return;
174
+ }
175
+ catch (_) {
176
+ dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
177
+ return rejectWithValue({ error: 1, errorMsg: 'Cannot delete animation' });
178
+ }
179
+ }));
180
+ const saveCurrentAnimation = createAsyncThunk('animations/saveCurrentAnimation', (params, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
181
+ try {
182
+ yield extra.jApi.animations.SaveAnimationConfiguration(params);
183
+ return;
184
+ }
185
+ catch (_) {
186
+ dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
187
+ return rejectWithValue({ error: 1, errorMsg: 'Cannot update animation' });
188
+ }
189
+ }));
190
+ const toggleAnimationIsActive = createAsyncThunk('animations/toggleAnimationIsActive', (_, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
191
+ try {
192
+ yield extra.jApi.animations.ToggleAnimationActive();
193
+ return;
194
+ }
195
+ catch (_) {
196
+ dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
197
+ return rejectWithValue({ error: 1, errorMsg: 'Cannot update animation' });
198
+ }
199
+ }));
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;
204
+ const animationsReducer = animationsSlice.reducer;
205
+ const Animations = {
206
+ slice: animationsSlice,
207
+ actions: { saveCurrentAnimation, fetchCurrentAnimation, deleteCurrentAnimation, toggleAnimationIsActive, fetchCurrentAnimationApp },
208
+ selectors: { selectCurrentAnimation, isActiveAnimation, isToggleLoading, selectAnimationConfigurationApp },
209
+ getAnimationsRTHandlers
210
+ };
211
+
212
+ const adapter$1 = createEntityAdapter({
213
+ selectId: (app) => app.name,
214
+ sortComparer: (a, b) => a.label.localeCompare(b.label),
215
+ });
216
+ const slice$2 = createSlice({
217
+ name: 'applications',
218
+ initialState: adapter$1.getInitialState(),
219
+ reducers: {
220
+ addOne: adapter$1.addOne,
221
+ addMany: adapter$1.addMany,
222
+ setAll: adapter$1.setAll,
223
+ },
224
+ });
225
+ const selectors$1 = adapter$1.getSelectors((state) => state.entities.applications);
226
+ const Application = {
227
+ slice: slice$2,
228
+ actions: Object.assign({}, slice$2.actions),
229
+ selectors: selectors$1,
230
+ };
231
+
63
232
  const initialState$j = {
64
233
  entities: [],
65
234
  loading: 'idle',
@@ -195,43 +364,6 @@ const AssetReservation = {
195
364
  },
196
365
  };
197
366
 
198
- const toastAdapter = createEntityAdapter({
199
- selectId: (toast) => toast.id,
200
- });
201
- const slice$2 = createSlice({
202
- name: 'toasts',
203
- initialState: toastAdapter.getInitialState(),
204
- reducers: {
205
- addOne: toastAdapter.addOne,
206
- removeOne: toastAdapter.removeOne,
207
- },
208
- });
209
- const randomId = () => Math.random().toString(16).slice(2);
210
- const addMessage = (_a, type, timeout) => {
211
- var { id = randomId() } = _a, toast = __rest(_a, ["id"]);
212
- if (type === void 0) { type = 'success'; }
213
- if (timeout === void 0) { timeout = 3000; }
214
- return (dispatch) => {
215
- dispatch(slice$2.actions.addOne(Object.assign(Object.assign({ id }, toast), { timeout, type })));
216
- setTimeout(() => {
217
- dispatch(slice$2.actions.removeOne(id));
218
- }, timeout);
219
- return id;
220
- };
221
- };
222
- const actions = {
223
- addMessage,
224
- success: (toast, timeout) => addMessage(toast, 'success', timeout),
225
- warning: (toast, timeout) => addMessage(toast, 'warning', timeout),
226
- error: (toast, timeout) => addMessage(toast, 'error', timeout),
227
- };
228
- const selectors$1 = toastAdapter.getSelectors((state) => state.toasts);
229
- const Toast = {
230
- slice: slice$2,
231
- actions: Object.assign(Object.assign({}, actions), slice$2.actions),
232
- selectors: selectors$1,
233
- };
234
-
235
367
  const initialState$g = {
236
368
  loading: 'idle',
237
369
  comments: [],
@@ -1656,6 +1788,22 @@ const widgetArticleTitleContent = {
1656
1788
  backgroundColor: 'transparent',
1657
1789
  };
1658
1790
 
1791
+ const widgetApiDefinition = {
1792
+ label: 'WIDGET_Api',
1793
+ description: 'WIDGET_Api_Description',
1794
+ name: 'widget-api',
1795
+ img: '/img/fast-intranet/widget-text.png',
1796
+ available: true,
1797
+ panel: {
1798
+ useWrapper: false,
1799
+ useEditor: true,
1800
+ useWidgets: false,
1801
+ },
1802
+ };
1803
+ const widgetApiContent = {
1804
+ url: '',
1805
+ };
1806
+
1659
1807
  const widgetArticleSliderDefinition = {
1660
1808
  label: 'WIDGET_Slider',
1661
1809
  description: 'WIDGET_Slider_Description',
@@ -1702,6 +1850,8 @@ function content(name) {
1702
1850
  default:
1703
1851
  case 'widget-article-attachment':
1704
1852
  return Object.assign({}, widgetArticleAttachmentContent);
1853
+ case 'widget-api':
1854
+ return Object.assign({}, widgetApiContent);
1705
1855
  case 'widget-article-slider':
1706
1856
  return Object.assign({}, widgetArticleSliderContent);
1707
1857
  case 'widget-article-gallery':
@@ -1750,6 +1900,8 @@ function widgetDefinition(name) {
1750
1900
  return widgetArticleTitleDefinition;
1751
1901
  case 'widget-article-image':
1752
1902
  return widgetArticleImageDefinition;
1903
+ case 'widget-api':
1904
+ return widgetApiDefinition;
1753
1905
  case 'widget-article-button':
1754
1906
  return widgetArticleButtonDefinition;
1755
1907
  }
@@ -3326,5 +3478,5 @@ const studio = {
3326
3478
  },
3327
3479
  };
3328
3480
 
3329
- export { APP_STATUS_TYPE, AUDIENCE, AppColumnsDefaultTypes, AppFieldFormPropertyTypes, AppFormBannedFromViews$1 as AppFormBannedFromViews, AppFormItemTypes, AppFormPrimaryList, AppFormUniqueList, Application, AssetReservation, Bookmark, Comment, ExtraAppFieldsItemViews, Faq, MODE_EDIT, MODE_VIEW, MapExtraFieldsWithView, Model, Network, Platform, STUDIO_VIEW, Share, StatusType$1 as StatusType, TVDisplay, TinyMCE, Toast, UserCurrent, WedocApp, Widget, WidgetEditor, actions, jland, slice, studio, updateWidgetContent, viewsList };
3481
+ export { APP_STATUS_TYPE, AUDIENCE, Animations, AppColumnsDefaultTypes, AppFieldFormPropertyTypes, AppFormBannedFromViews$1 as AppFormBannedFromViews, AppFormItemTypes, AppFormPrimaryList, AppFormUniqueList, Application, AssetReservation, Bookmark, Comment, ExtraAppFieldsItemViews, Faq, MODE_EDIT, MODE_VIEW, MapExtraFieldsWithView, Model, Network, Platform, STUDIO_VIEW, Share, StatusType$1 as StatusType, TVDisplay, TinyMCE, Toast, UserCurrent, WedocApp, Widget, WidgetEditor, actions, animationsReducer, animationsSlice, deleteCurrentAnimation, fetchCurrentAnimation, fetchCurrentAnimationApp, jland, saveCurrentAnimation, slice, studio, toggleAnimationIsActive, updateWidgetContent, viewsList };
3330
3482
  //# sourceMappingURL=esm.js.map