jamespot-front-business 1.1.63 → 1.1.64

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
@@ -2253,22 +2253,6 @@ const widgetArticleButtonContent = {
2253
2253
  borderRadius: '4',
2254
2254
  };
2255
2255
 
2256
- const widgetApiDefinition = {
2257
- label: 'WIDGET_Api',
2258
- description: 'WIDGET_Api_Description',
2259
- name: jamespot.WidgetsName.Api,
2260
- img: '/img/fast-intranet/widget-text.png',
2261
- available: true,
2262
- panel: {
2263
- useWrapper: false,
2264
- useEditor: true,
2265
- useWidgets: false,
2266
- },
2267
- };
2268
- const widgetApiContent = {
2269
- url: '',
2270
- };
2271
-
2272
2256
  const widgetArticleSliderDefinition = {
2273
2257
  label: 'WIDGET_Slider',
2274
2258
  description: 'WIDGET_Slider_Description',
@@ -2347,6 +2331,24 @@ const widgetExcelDatasourceTaleContent = {
2347
2331
  limit: 20,
2348
2332
  };
2349
2333
 
2334
+ const widgetPresenceDefinition = {
2335
+ label: 'WIDGET_Presence',
2336
+ description: 'WIDGET_Presence_Text',
2337
+ name: jamespot.WidgetsName.Presence,
2338
+ img: '/img/fast-intranet/widget-presence.png',
2339
+ available: true,
2340
+ panel: {
2341
+ useWrapper: true,
2342
+ useEditor: true,
2343
+ useWidgets: false,
2344
+ },
2345
+ };
2346
+ const widgetPresenceContent = {
2347
+ closing: false,
2348
+ limit: false,
2349
+ limitValue: 100,
2350
+ };
2351
+
2350
2352
  function widgetDefinition(name) {
2351
2353
  switch (name) {
2352
2354
  default:
@@ -2355,6 +2357,8 @@ function widgetDefinition(name) {
2355
2357
  return widgetArticleGalleryDefinition;
2356
2358
  case 'widget-article-attachment':
2357
2359
  return widgetArticleAttachmentDefinition;
2360
+ case 'widget-presence':
2361
+ return widgetPresenceDefinition;
2358
2362
  case 'widget-article-slider':
2359
2363
  return widgetArticleSliderDefinition;
2360
2364
  case 'widget-article-text':
@@ -2363,8 +2367,6 @@ function widgetDefinition(name) {
2363
2367
  return widgetArticleTitleDefinition;
2364
2368
  case 'widget-article-image':
2365
2369
  return widgetArticleImageDefinition;
2366
- case 'widget-api':
2367
- return widgetApiDefinition;
2368
2370
  case 'widget-datasource-table':
2369
2371
  return widgetDatasourceTableDefinition;
2370
2372
  case 'widget-excel-datasource-table':
@@ -2394,8 +2396,8 @@ function content(name) {
2394
2396
  default:
2395
2397
  case 'widget-article-attachment':
2396
2398
  return Object.assign({}, widgetArticleAttachmentContent);
2397
- case 'widget-api':
2398
- return Object.assign({}, widgetApiContent);
2399
+ case 'widget-presence':
2400
+ return Object.assign({}, widgetPresenceContent);
2399
2401
  case 'widget-datasource-table':
2400
2402
  return Object.assign({}, widgetDatasourceTaleContent);
2401
2403
  case 'widget-excel-datasource-table':
@@ -2417,6 +2419,26 @@ function content(name) {
2417
2419
  }
2418
2420
  }
2419
2421
 
2422
+ const getWidgetRTHandlers = function (dispatch, uniqid) {
2423
+ const widgetPresenceResponseHandler = function (message) {
2424
+ if (message.namespace === 'WIDGET' && message.function === 'widget-presence-response') {
2425
+ if (message.data && message.data.uniqid === uniqid) {
2426
+ dispatch(Widget.slice.actions.registerWidgetRTObject({
2427
+ uniqid: message.data.uniqid,
2428
+ object: message.data.object,
2429
+ }));
2430
+ }
2431
+ }
2432
+ };
2433
+ return [
2434
+ {
2435
+ namespace: 'WIDGET',
2436
+ function: 'widget-presence-response',
2437
+ handler: widgetPresenceResponseHandler,
2438
+ },
2439
+ ];
2440
+ };
2441
+
2420
2442
  const MODE_EDIT = 'edit';
2421
2443
  const MODE_VIEW = 'view';
2422
2444
  const initialState$3 = {
@@ -2429,7 +2451,18 @@ const initialState$3 = {
2429
2451
  currentEditableIndex: -1,
2430
2452
  currentEditableWidgetId: undefined,
2431
2453
  widgetObject: {},
2454
+ widgetObjectRights: {},
2455
+ widgetAuthor: {},
2456
+ rtObjectStack: [],
2432
2457
  };
2458
+ const IS_EMPTY = [
2459
+ jamespot.WidgetsName.ArticleTitle,
2460
+ jamespot.WidgetsName.ArticleText,
2461
+ jamespot.WidgetsName.ArticleImage,
2462
+ jamespot.WidgetsName.ArticleButton,
2463
+ jamespot.WidgetsName.ArticleSlider,
2464
+ jamespot.WidgetsName.ArticleAttachment,
2465
+ ];
2433
2466
  const widgetsSlice = toolkit.createSlice({
2434
2467
  name: 'widgets',
2435
2468
  initialState: initialState$3,
@@ -2443,13 +2476,21 @@ const widgetsSlice = toolkit.createSlice({
2443
2476
  loading: false,
2444
2477
  mounted: false,
2445
2478
  hover: false,
2446
- empty: true,
2479
+ empty: IS_EMPTY.includes(widget.widget.name),
2447
2480
  };
2448
2481
  },
2449
2482
  registerWidgetObject: (state, action) => {
2450
2483
  const { uniqid, object } = action.payload;
2451
2484
  state.widgetObject[uniqid] = object;
2452
2485
  },
2486
+ registerWidgetObjectRights: (state, action) => {
2487
+ const { uniqid, rights } = action.payload;
2488
+ state.widgetObjectRights[uniqid] = rights;
2489
+ },
2490
+ registerWidgetAuthor: (state, action) => {
2491
+ const { uniqid, author } = action.payload;
2492
+ state.widgetAuthor[uniqid] = author;
2493
+ },
2453
2494
  updateWidget: (state, action) => {
2454
2495
  const { uniqid } = action.payload;
2455
2496
  const wrapper = Object.assign({}, state.ids[uniqid]);
@@ -2459,6 +2500,10 @@ const widgetsSlice = toolkit.createSlice({
2459
2500
  : Object.assign(Object.assign(Object.assign({}, wrapper.widget.content), action.payload.content)) }) }));
2460
2501
  }
2461
2502
  },
2503
+ registerWidgetRTObject: (state, action) => {
2504
+ const { uniqid, object } = action.payload;
2505
+ state.rtObjectStack = [...state.rtObjectStack, { uniqid, object }];
2506
+ },
2462
2507
  flushWidget: (state, action) => {
2463
2508
  const { uniqid } = action.payload;
2464
2509
  delete state.ids[uniqid];
@@ -2566,7 +2611,10 @@ const selectWidgets = (state) => state.widgets.ids;
2566
2611
  const selectWidgetState = (state, uniqid) => { var _a; return (_a = state.widgets.states[uniqid]) !== null && _a !== void 0 ? _a : undefined; };
2567
2612
  const selectWidget = (state, uniqid) => { var _a; return (_a = state.widgets.ids[uniqid]) !== null && _a !== void 0 ? _a : undefined; };
2568
2613
  const selectWidgetObject = (state, uniqid) => { var _a; return (_a = state.widgets.widgetObject[uniqid]) !== null && _a !== void 0 ? _a : undefined; };
2614
+ const selectWidgetObjectRights = (state, uniqid) => { var _a; return (_a = state.widgets.widgetObjectRights[uniqid]) !== null && _a !== void 0 ? _a : undefined; };
2615
+ const selectWidgetAuthor = (state, uniqid) => { var _a; return (_a = state.widgets.widgetAuthor[uniqid]) !== null && _a !== void 0 ? _a : undefined; };
2569
2616
  const isActive = (state, uniqid) => state.widgets.currentEditableWidgetId === uniqid;
2617
+ const selectAllWidgetRTObject = (state, uniqid) => state.widgets.rtObjectStack.filter((el) => el.uniqid === uniqid);
2570
2618
  const updateWidgetContent = (uniqid, content, override) => Widget.slice.actions.updateWidget({ uniqid, content, override: override !== null && override !== void 0 ? override : false });
2571
2619
  const Widget = {
2572
2620
  const: WIDGETS,
@@ -2576,6 +2624,7 @@ const Widget = {
2576
2624
  uniqid,
2577
2625
  },
2578
2626
  slice: widgetsSlice,
2627
+ getWidgetRTHandlers,
2579
2628
  selectors: {
2580
2629
  isActive,
2581
2630
  selectToken,
@@ -2584,6 +2633,9 @@ const Widget = {
2584
2633
  selectWidgetState,
2585
2634
  selectModal,
2586
2635
  selectWidgetObject,
2636
+ selectWidgetAuthor,
2637
+ selectWidgetObjectRights,
2638
+ selectAllWidgetRTObject,
2587
2639
  },
2588
2640
  };
2589
2641
 
@@ -2595,12 +2647,19 @@ const editorsSlice = toolkit.createSlice({
2595
2647
  initialState: initialState$2,
2596
2648
  reducers: {
2597
2649
  registerEditor: (state, action) => {
2598
- const { uniqid, name } = action.payload;
2599
- const ed = {
2600
- uniqid,
2601
- name,
2602
- position: 'right',
2603
- };
2650
+ const { uniqid, name, onSave } = action.payload;
2651
+ const ed = !onSave
2652
+ ? {
2653
+ uniqid,
2654
+ name,
2655
+ position: 'right',
2656
+ }
2657
+ : {
2658
+ uniqid,
2659
+ name,
2660
+ onSave,
2661
+ position: 'right',
2662
+ };
2604
2663
  state.editors = state.editors.find((ed) => ed.uniqid === uniqid)
2605
2664
  ? state.editors
2606
2665
  : [...state.editors, ed];