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/esm.js CHANGED
@@ -2245,22 +2245,6 @@ const widgetArticleButtonContent = {
2245
2245
  borderRadius: '4',
2246
2246
  };
2247
2247
 
2248
- const widgetApiDefinition = {
2249
- label: 'WIDGET_Api',
2250
- description: 'WIDGET_Api_Description',
2251
- name: WidgetsName.Api,
2252
- img: '/img/fast-intranet/widget-text.png',
2253
- available: true,
2254
- panel: {
2255
- useWrapper: false,
2256
- useEditor: true,
2257
- useWidgets: false,
2258
- },
2259
- };
2260
- const widgetApiContent = {
2261
- url: '',
2262
- };
2263
-
2264
2248
  const widgetArticleSliderDefinition = {
2265
2249
  label: 'WIDGET_Slider',
2266
2250
  description: 'WIDGET_Slider_Description',
@@ -2339,6 +2323,24 @@ const widgetExcelDatasourceTaleContent = {
2339
2323
  limit: 20,
2340
2324
  };
2341
2325
 
2326
+ const widgetPresenceDefinition = {
2327
+ label: 'WIDGET_Presence',
2328
+ description: 'WIDGET_Presence_Text',
2329
+ name: WidgetsName.Presence,
2330
+ img: '/img/fast-intranet/widget-presence.png',
2331
+ available: true,
2332
+ panel: {
2333
+ useWrapper: true,
2334
+ useEditor: true,
2335
+ useWidgets: false,
2336
+ },
2337
+ };
2338
+ const widgetPresenceContent = {
2339
+ closing: false,
2340
+ limit: false,
2341
+ limitValue: 100,
2342
+ };
2343
+
2342
2344
  function widgetDefinition(name) {
2343
2345
  switch (name) {
2344
2346
  default:
@@ -2347,6 +2349,8 @@ function widgetDefinition(name) {
2347
2349
  return widgetArticleGalleryDefinition;
2348
2350
  case 'widget-article-attachment':
2349
2351
  return widgetArticleAttachmentDefinition;
2352
+ case 'widget-presence':
2353
+ return widgetPresenceDefinition;
2350
2354
  case 'widget-article-slider':
2351
2355
  return widgetArticleSliderDefinition;
2352
2356
  case 'widget-article-text':
@@ -2355,8 +2359,6 @@ function widgetDefinition(name) {
2355
2359
  return widgetArticleTitleDefinition;
2356
2360
  case 'widget-article-image':
2357
2361
  return widgetArticleImageDefinition;
2358
- case 'widget-api':
2359
- return widgetApiDefinition;
2360
2362
  case 'widget-datasource-table':
2361
2363
  return widgetDatasourceTableDefinition;
2362
2364
  case 'widget-excel-datasource-table':
@@ -2386,8 +2388,8 @@ function content(name) {
2386
2388
  default:
2387
2389
  case 'widget-article-attachment':
2388
2390
  return Object.assign({}, widgetArticleAttachmentContent);
2389
- case 'widget-api':
2390
- return Object.assign({}, widgetApiContent);
2391
+ case 'widget-presence':
2392
+ return Object.assign({}, widgetPresenceContent);
2391
2393
  case 'widget-datasource-table':
2392
2394
  return Object.assign({}, widgetDatasourceTaleContent);
2393
2395
  case 'widget-excel-datasource-table':
@@ -2409,6 +2411,26 @@ function content(name) {
2409
2411
  }
2410
2412
  }
2411
2413
 
2414
+ const getWidgetRTHandlers = function (dispatch, uniqid) {
2415
+ const widgetPresenceResponseHandler = function (message) {
2416
+ if (message.namespace === 'WIDGET' && message.function === 'widget-presence-response') {
2417
+ if (message.data && message.data.uniqid === uniqid) {
2418
+ dispatch(Widget.slice.actions.registerWidgetRTObject({
2419
+ uniqid: message.data.uniqid,
2420
+ object: message.data.object,
2421
+ }));
2422
+ }
2423
+ }
2424
+ };
2425
+ return [
2426
+ {
2427
+ namespace: 'WIDGET',
2428
+ function: 'widget-presence-response',
2429
+ handler: widgetPresenceResponseHandler,
2430
+ },
2431
+ ];
2432
+ };
2433
+
2412
2434
  const MODE_EDIT = 'edit';
2413
2435
  const MODE_VIEW = 'view';
2414
2436
  const initialState$3 = {
@@ -2421,7 +2443,18 @@ const initialState$3 = {
2421
2443
  currentEditableIndex: -1,
2422
2444
  currentEditableWidgetId: undefined,
2423
2445
  widgetObject: {},
2424
- };
2446
+ widgetObjectRights: {},
2447
+ widgetAuthor: {},
2448
+ rtObjectStack: [],
2449
+ };
2450
+ const IS_EMPTY = [
2451
+ WidgetsName.ArticleTitle,
2452
+ WidgetsName.ArticleText,
2453
+ WidgetsName.ArticleImage,
2454
+ WidgetsName.ArticleButton,
2455
+ WidgetsName.ArticleSlider,
2456
+ WidgetsName.ArticleAttachment,
2457
+ ];
2425
2458
  const widgetsSlice = createSlice({
2426
2459
  name: 'widgets',
2427
2460
  initialState: initialState$3,
@@ -2435,13 +2468,21 @@ const widgetsSlice = createSlice({
2435
2468
  loading: false,
2436
2469
  mounted: false,
2437
2470
  hover: false,
2438
- empty: true,
2471
+ empty: IS_EMPTY.includes(widget.widget.name),
2439
2472
  };
2440
2473
  },
2441
2474
  registerWidgetObject: (state, action) => {
2442
2475
  const { uniqid, object } = action.payload;
2443
2476
  state.widgetObject[uniqid] = object;
2444
2477
  },
2478
+ registerWidgetObjectRights: (state, action) => {
2479
+ const { uniqid, rights } = action.payload;
2480
+ state.widgetObjectRights[uniqid] = rights;
2481
+ },
2482
+ registerWidgetAuthor: (state, action) => {
2483
+ const { uniqid, author } = action.payload;
2484
+ state.widgetAuthor[uniqid] = author;
2485
+ },
2445
2486
  updateWidget: (state, action) => {
2446
2487
  const { uniqid } = action.payload;
2447
2488
  const wrapper = Object.assign({}, state.ids[uniqid]);
@@ -2451,6 +2492,10 @@ const widgetsSlice = createSlice({
2451
2492
  : Object.assign(Object.assign(Object.assign({}, wrapper.widget.content), action.payload.content)) }) }));
2452
2493
  }
2453
2494
  },
2495
+ registerWidgetRTObject: (state, action) => {
2496
+ const { uniqid, object } = action.payload;
2497
+ state.rtObjectStack = [...state.rtObjectStack, { uniqid, object }];
2498
+ },
2454
2499
  flushWidget: (state, action) => {
2455
2500
  const { uniqid } = action.payload;
2456
2501
  delete state.ids[uniqid];
@@ -2558,7 +2603,10 @@ const selectWidgets = (state) => state.widgets.ids;
2558
2603
  const selectWidgetState = (state, uniqid) => { var _a; return (_a = state.widgets.states[uniqid]) !== null && _a !== void 0 ? _a : undefined; };
2559
2604
  const selectWidget = (state, uniqid) => { var _a; return (_a = state.widgets.ids[uniqid]) !== null && _a !== void 0 ? _a : undefined; };
2560
2605
  const selectWidgetObject = (state, uniqid) => { var _a; return (_a = state.widgets.widgetObject[uniqid]) !== null && _a !== void 0 ? _a : undefined; };
2606
+ const selectWidgetObjectRights = (state, uniqid) => { var _a; return (_a = state.widgets.widgetObjectRights[uniqid]) !== null && _a !== void 0 ? _a : undefined; };
2607
+ const selectWidgetAuthor = (state, uniqid) => { var _a; return (_a = state.widgets.widgetAuthor[uniqid]) !== null && _a !== void 0 ? _a : undefined; };
2561
2608
  const isActive = (state, uniqid) => state.widgets.currentEditableWidgetId === uniqid;
2609
+ const selectAllWidgetRTObject = (state, uniqid) => state.widgets.rtObjectStack.filter((el) => el.uniqid === uniqid);
2562
2610
  const updateWidgetContent = (uniqid, content, override) => Widget.slice.actions.updateWidget({ uniqid, content, override: override !== null && override !== void 0 ? override : false });
2563
2611
  const Widget = {
2564
2612
  const: WIDGETS,
@@ -2568,6 +2616,7 @@ const Widget = {
2568
2616
  uniqid,
2569
2617
  },
2570
2618
  slice: widgetsSlice,
2619
+ getWidgetRTHandlers,
2571
2620
  selectors: {
2572
2621
  isActive,
2573
2622
  selectToken,
@@ -2576,6 +2625,9 @@ const Widget = {
2576
2625
  selectWidgetState,
2577
2626
  selectModal,
2578
2627
  selectWidgetObject,
2628
+ selectWidgetAuthor,
2629
+ selectWidgetObjectRights,
2630
+ selectAllWidgetRTObject,
2579
2631
  },
2580
2632
  };
2581
2633
 
@@ -2587,12 +2639,19 @@ const editorsSlice = createSlice({
2587
2639
  initialState: initialState$2,
2588
2640
  reducers: {
2589
2641
  registerEditor: (state, action) => {
2590
- const { uniqid, name } = action.payload;
2591
- const ed = {
2592
- uniqid,
2593
- name,
2594
- position: 'right',
2595
- };
2642
+ const { uniqid, name, onSave } = action.payload;
2643
+ const ed = !onSave
2644
+ ? {
2645
+ uniqid,
2646
+ name,
2647
+ position: 'right',
2648
+ }
2649
+ : {
2650
+ uniqid,
2651
+ name,
2652
+ onSave,
2653
+ position: 'right',
2654
+ };
2596
2655
  state.editors = state.editors.find((ed) => ed.uniqid === uniqid)
2597
2656
  ? state.editors
2598
2657
  : [...state.editors, ed];