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/cjs.js CHANGED
@@ -11,26 +11,6 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
11
11
 
12
12
  var jamespot__default = /*#__PURE__*/_interopDefaultLegacy(jamespot);
13
13
 
14
- const adapter$1 = toolkit.createEntityAdapter({
15
- selectId: (app) => app.name,
16
- sortComparer: (a, b) => a.label.localeCompare(b.label),
17
- });
18
- const slice$3 = toolkit.createSlice({
19
- name: 'applications',
20
- initialState: adapter$1.getInitialState(),
21
- reducers: {
22
- addOne: adapter$1.addOne,
23
- addMany: adapter$1.addMany,
24
- setAll: adapter$1.setAll,
25
- },
26
- });
27
- const selectors$2 = adapter$1.getSelectors((state) => state.entities.applications);
28
- const Application = {
29
- slice: slice$3,
30
- actions: Object.assign({}, slice$3.actions),
31
- selectors: selectors$2,
32
- };
33
-
34
14
  /******************************************************************************
35
15
  Copyright (c) Microsoft Corporation.
36
16
 
@@ -68,6 +48,195 @@ function __awaiter(thisArg, _arguments, P, generator) {
68
48
  });
69
49
  }
70
50
 
51
+ const toastAdapter = toolkit.createEntityAdapter({
52
+ selectId: (toast) => toast.id,
53
+ });
54
+ const slice$3 = toolkit.createSlice({
55
+ name: 'toasts',
56
+ initialState: toastAdapter.getInitialState(),
57
+ reducers: {
58
+ addOne: toastAdapter.addOne,
59
+ removeOne: toastAdapter.removeOne,
60
+ },
61
+ });
62
+ const randomId = () => Math.random().toString(16).slice(2);
63
+ const addMessage = (_a, type, timeout) => {
64
+ var { id = randomId() } = _a, toast = __rest(_a, ["id"]);
65
+ if (type === void 0) { type = 'success'; }
66
+ if (timeout === void 0) { timeout = 3000; }
67
+ return (dispatch) => {
68
+ dispatch(slice$3.actions.addOne(Object.assign(Object.assign({ id }, toast), { timeout, type })));
69
+ setTimeout(() => {
70
+ dispatch(slice$3.actions.removeOne(id));
71
+ }, timeout);
72
+ return id;
73
+ };
74
+ };
75
+ const actions = {
76
+ addMessage,
77
+ success: (toast, timeout) => addMessage(toast, 'success', timeout),
78
+ warning: (toast, timeout) => addMessage(toast, 'warning', timeout),
79
+ error: (toast, timeout) => addMessage(toast, 'error', timeout),
80
+ };
81
+ const selectors$2 = toastAdapter.getSelectors((state) => state.toasts);
82
+ const Toast = {
83
+ slice: slice$3,
84
+ actions: Object.assign(Object.assign({}, actions), slice$3.actions),
85
+ selectors: selectors$2,
86
+ };
87
+
88
+ const getAnimationsRTHandlers = function (dispatch) {
89
+ const addAnimationHandler = function (message) {
90
+ if (message.namespace === 'ANIMATIONS' &&
91
+ message.function === 'add') {
92
+ dispatch(fetchCurrentAnimation());
93
+ dispatch(fetchCurrentAnimationApp());
94
+ }
95
+ };
96
+ const deleteAnimationHandler = function (message) {
97
+ if (message.namespace === 'ANIMATIONS' &&
98
+ message.function === 'delete') {
99
+ dispatch(fetchCurrentAnimation());
100
+ dispatch(fetchCurrentAnimationApp());
101
+ }
102
+ };
103
+ const toggleIsActiveAnimationHandler = function (message) {
104
+ if (message.namespace === 'ANIMATIONS' &&
105
+ message.function === 'toggle') {
106
+ dispatch(fetchCurrentAnimation());
107
+ }
108
+ };
109
+ return [
110
+ {
111
+ namespace: 'ANIMATIONS',
112
+ function: 'add',
113
+ handler: addAnimationHandler,
114
+ },
115
+ {
116
+ namespace: 'ANIMATIONS',
117
+ function: 'delete',
118
+ handler: deleteAnimationHandler,
119
+ },
120
+ {
121
+ namespace: 'ANIMATIONS',
122
+ function: 'toggle',
123
+ handler: toggleIsActiveAnimationHandler,
124
+ },
125
+ ];
126
+ };
127
+
128
+ const initialState$k = {
129
+ animationConfiguration: null,
130
+ isActiveForCurrentUser: false,
131
+ isInitialized: false,
132
+ isToggleLoading: false,
133
+ };
134
+ const animationsSlice = toolkit.createSlice({
135
+ name: 'animations',
136
+ initialState: initialState$k,
137
+ reducers: {},
138
+ extraReducers: (builder) => {
139
+ builder.addCase(fetchCurrentAnimation.fulfilled, (state, action) => {
140
+ state.isActiveForCurrentUser = action.payload.isActiveForCurrentUser;
141
+ state.animationConfiguration = action.payload.animationConfiguration;
142
+ state.isInitialized = action.payload.isInitialized;
143
+ });
144
+ builder.addCase(fetchCurrentAnimationApp.fulfilled, (state, action) => {
145
+ state.animationConfigurationApp = action.payload;
146
+ });
147
+ builder.addCase(toggleAnimationIsActive.pending, (state) => {
148
+ state.isToggleLoading = true;
149
+ });
150
+ builder.addCase(toggleAnimationIsActive.fulfilled, (state) => {
151
+ state.isToggleLoading = false;
152
+ });
153
+ builder.addCase(toggleAnimationIsActive.rejected, (state) => {
154
+ state.isToggleLoading = false;
155
+ });
156
+ },
157
+ });
158
+ const fetchCurrentAnimation = toolkit.createAsyncThunk('animations/fetchCurrentAnimation', (_, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
159
+ try {
160
+ const animationConfiguration = (yield extra.jApi.animations.GetCurrentAnimation()).result;
161
+ const isActiveForCurrentUser = (yield extra.jApi.animations.GetAnimationActive()).result;
162
+ return { animationConfiguration, isActiveForCurrentUser, isInitialized: true };
163
+ }
164
+ catch (_) {
165
+ dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
166
+ return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve animation' });
167
+ }
168
+ }));
169
+ const fetchCurrentAnimationApp = toolkit.createAsyncThunk('animations/fetchCurrentAnimationApp', (_, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
170
+ try {
171
+ return (yield extra.jApi.animations.GetCurrentAnimationApp()).result;
172
+ }
173
+ catch (_) {
174
+ dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
175
+ return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve animation' });
176
+ }
177
+ }));
178
+ const deleteCurrentAnimation = toolkit.createAsyncThunk('animations/deleteCurrentAnimation', (_, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
179
+ try {
180
+ yield extra.jApi.animations.DeleteAnimation();
181
+ return;
182
+ }
183
+ catch (_) {
184
+ dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
185
+ return rejectWithValue({ error: 1, errorMsg: 'Cannot delete animation' });
186
+ }
187
+ }));
188
+ const saveCurrentAnimation = toolkit.createAsyncThunk('animations/saveCurrentAnimation', (params, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
189
+ try {
190
+ yield extra.jApi.animations.SaveAnimationConfiguration(params);
191
+ return;
192
+ }
193
+ catch (_) {
194
+ dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
195
+ return rejectWithValue({ error: 1, errorMsg: 'Cannot update animation' });
196
+ }
197
+ }));
198
+ const toggleAnimationIsActive = toolkit.createAsyncThunk('animations/toggleAnimationIsActive', (_, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
199
+ try {
200
+ yield extra.jApi.animations.ToggleAnimationActive();
201
+ return;
202
+ }
203
+ catch (_) {
204
+ dispatch(Toast.actions.error({ label: 'GLOBAL_Technical_Error' }));
205
+ return rejectWithValue({ error: 1, errorMsg: 'Cannot update animation' });
206
+ }
207
+ }));
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;
212
+ const animationsReducer = animationsSlice.reducer;
213
+ const Animations = {
214
+ slice: animationsSlice,
215
+ actions: { saveCurrentAnimation, fetchCurrentAnimation, deleteCurrentAnimation, toggleAnimationIsActive, fetchCurrentAnimationApp },
216
+ selectors: { selectCurrentAnimation, isActiveAnimation, isToggleLoading, selectAnimationConfigurationApp },
217
+ getAnimationsRTHandlers
218
+ };
219
+
220
+ const adapter$1 = toolkit.createEntityAdapter({
221
+ selectId: (app) => app.name,
222
+ sortComparer: (a, b) => a.label.localeCompare(b.label),
223
+ });
224
+ const slice$2 = toolkit.createSlice({
225
+ name: 'applications',
226
+ initialState: adapter$1.getInitialState(),
227
+ reducers: {
228
+ addOne: adapter$1.addOne,
229
+ addMany: adapter$1.addMany,
230
+ setAll: adapter$1.setAll,
231
+ },
232
+ });
233
+ const selectors$1 = adapter$1.getSelectors((state) => state.entities.applications);
234
+ const Application = {
235
+ slice: slice$2,
236
+ actions: Object.assign({}, slice$2.actions),
237
+ selectors: selectors$1,
238
+ };
239
+
71
240
  const initialState$j = {
72
241
  entities: [],
73
242
  loading: 'idle',
@@ -203,43 +372,6 @@ const AssetReservation = {
203
372
  },
204
373
  };
205
374
 
206
- const toastAdapter = toolkit.createEntityAdapter({
207
- selectId: (toast) => toast.id,
208
- });
209
- const slice$2 = toolkit.createSlice({
210
- name: 'toasts',
211
- initialState: toastAdapter.getInitialState(),
212
- reducers: {
213
- addOne: toastAdapter.addOne,
214
- removeOne: toastAdapter.removeOne,
215
- },
216
- });
217
- const randomId = () => Math.random().toString(16).slice(2);
218
- const addMessage = (_a, type, timeout) => {
219
- var { id = randomId() } = _a, toast = __rest(_a, ["id"]);
220
- if (type === void 0) { type = 'success'; }
221
- if (timeout === void 0) { timeout = 3000; }
222
- return (dispatch) => {
223
- dispatch(slice$2.actions.addOne(Object.assign(Object.assign({ id }, toast), { timeout, type })));
224
- setTimeout(() => {
225
- dispatch(slice$2.actions.removeOne(id));
226
- }, timeout);
227
- return id;
228
- };
229
- };
230
- const actions = {
231
- addMessage,
232
- success: (toast, timeout) => addMessage(toast, 'success', timeout),
233
- warning: (toast, timeout) => addMessage(toast, 'warning', timeout),
234
- error: (toast, timeout) => addMessage(toast, 'error', timeout),
235
- };
236
- const selectors$1 = toastAdapter.getSelectors((state) => state.toasts);
237
- const Toast = {
238
- slice: slice$2,
239
- actions: Object.assign(Object.assign({}, actions), slice$2.actions),
240
- selectors: selectors$1,
241
- };
242
-
243
375
  const initialState$g = {
244
376
  loading: 'idle',
245
377
  comments: [],
@@ -1664,6 +1796,22 @@ const widgetArticleTitleContent = {
1664
1796
  backgroundColor: 'transparent',
1665
1797
  };
1666
1798
 
1799
+ const widgetApiDefinition = {
1800
+ label: 'WIDGET_Api',
1801
+ description: 'WIDGET_Api_Description',
1802
+ name: 'widget-api',
1803
+ img: '/img/fast-intranet/widget-text.png',
1804
+ available: true,
1805
+ panel: {
1806
+ useWrapper: false,
1807
+ useEditor: true,
1808
+ useWidgets: false,
1809
+ },
1810
+ };
1811
+ const widgetApiContent = {
1812
+ url: '',
1813
+ };
1814
+
1667
1815
  const widgetArticleSliderDefinition = {
1668
1816
  label: 'WIDGET_Slider',
1669
1817
  description: 'WIDGET_Slider_Description',
@@ -1710,6 +1858,8 @@ function content(name) {
1710
1858
  default:
1711
1859
  case 'widget-article-attachment':
1712
1860
  return Object.assign({}, widgetArticleAttachmentContent);
1861
+ case 'widget-api':
1862
+ return Object.assign({}, widgetApiContent);
1713
1863
  case 'widget-article-slider':
1714
1864
  return Object.assign({}, widgetArticleSliderContent);
1715
1865
  case 'widget-article-gallery':
@@ -1758,6 +1908,8 @@ function widgetDefinition(name) {
1758
1908
  return widgetArticleTitleDefinition;
1759
1909
  case 'widget-article-image':
1760
1910
  return widgetArticleImageDefinition;
1911
+ case 'widget-api':
1912
+ return widgetApiDefinition;
1761
1913
  case 'widget-article-button':
1762
1914
  return widgetArticleButtonDefinition;
1763
1915
  }
@@ -3336,6 +3488,7 @@ const studio = {
3336
3488
 
3337
3489
  exports.APP_STATUS_TYPE = APP_STATUS_TYPE;
3338
3490
  exports.AUDIENCE = AUDIENCE;
3491
+ exports.Animations = Animations;
3339
3492
  exports.AppColumnsDefaultTypes = AppColumnsDefaultTypes;
3340
3493
  exports.AppFormBannedFromViews = AppFormBannedFromViews$1;
3341
3494
  exports.AppFormPrimaryList = AppFormPrimaryList;
@@ -3361,9 +3514,16 @@ exports.WedocApp = WedocApp;
3361
3514
  exports.Widget = Widget;
3362
3515
  exports.WidgetEditor = WidgetEditor;
3363
3516
  exports.actions = actions;
3517
+ exports.animationsReducer = animationsReducer;
3518
+ exports.animationsSlice = animationsSlice;
3519
+ exports.deleteCurrentAnimation = deleteCurrentAnimation;
3520
+ exports.fetchCurrentAnimation = fetchCurrentAnimation;
3521
+ exports.fetchCurrentAnimationApp = fetchCurrentAnimationApp;
3364
3522
  exports.jland = jland;
3523
+ exports.saveCurrentAnimation = saveCurrentAnimation;
3365
3524
  exports.slice = slice;
3366
3525
  exports.studio = studio;
3526
+ exports.toggleAnimationIsActive = toggleAnimationIsActive;
3367
3527
  exports.updateWidgetContent = updateWidgetContent;
3368
3528
  exports.viewsList = viewsList;
3369
3529
  //# sourceMappingURL=cjs.js.map