jamespot-front-business 1.1.63 → 1.1.65

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',
@@ -2312,7 +2296,7 @@ const widgetDatasourceTableDefinition = {
2312
2296
  img: '/img/fast-intranet/widget-datasource-table.png',
2313
2297
  available: true,
2314
2298
  panel: {
2315
- useWrapper: false,
2299
+ useWrapper: true,
2316
2300
  useEditor: true,
2317
2301
  useWidgets: false,
2318
2302
  },
@@ -2333,7 +2317,7 @@ const widgetExcelDatasourceTableDefinition = {
2333
2317
  img: '/img/fast-intranet/widget-excel-datasource-table.png',
2334
2318
  available: true,
2335
2319
  panel: {
2336
- useWrapper: false,
2320
+ useWrapper: true,
2337
2321
  useEditor: true,
2338
2322
  useWidgets: false,
2339
2323
  },
@@ -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,22 +2476,39 @@ 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),
2480
+ locked: false,
2447
2481
  };
2448
2482
  },
2449
2483
  registerWidgetObject: (state, action) => {
2450
2484
  const { uniqid, object } = action.payload;
2451
2485
  state.widgetObject[uniqid] = object;
2452
2486
  },
2487
+ registerWidgetObjectRights: (state, action) => {
2488
+ const { uniqid, rights } = action.payload;
2489
+ state.widgetObjectRights[uniqid] = rights;
2490
+ },
2491
+ registerWidgetAuthor: (state, action) => {
2492
+ const { uniqid, author } = action.payload;
2493
+ state.widgetAuthor[uniqid] = author;
2494
+ },
2453
2495
  updateWidget: (state, action) => {
2454
2496
  const { uniqid } = action.payload;
2455
2497
  const wrapper = Object.assign({}, state.ids[uniqid]);
2498
+ const states = state.states[uniqid];
2499
+ if (states === null || states === void 0 ? void 0 : states.locked) {
2500
+ return;
2501
+ }
2456
2502
  if (state.ids[uniqid] && wrapper && wrapper.widget) {
2457
2503
  state.ids[uniqid] = Object.assign(Object.assign(Object.assign({}, state.ids[uniqid]), { widget: Object.assign(Object.assign({}, wrapper.widget), { content: action.payload.override
2458
2504
  ? action.payload.content
2459
2505
  : Object.assign(Object.assign(Object.assign({}, wrapper.widget.content), action.payload.content)) }) }));
2460
2506
  }
2461
2507
  },
2508
+ registerWidgetRTObject: (state, action) => {
2509
+ const { uniqid, object } = action.payload;
2510
+ state.rtObjectStack = [...state.rtObjectStack, { uniqid, object }];
2511
+ },
2462
2512
  flushWidget: (state, action) => {
2463
2513
  const { uniqid } = action.payload;
2464
2514
  delete state.ids[uniqid];
@@ -2566,7 +2616,10 @@ const selectWidgets = (state) => state.widgets.ids;
2566
2616
  const selectWidgetState = (state, uniqid) => { var _a; return (_a = state.widgets.states[uniqid]) !== null && _a !== void 0 ? _a : undefined; };
2567
2617
  const selectWidget = (state, uniqid) => { var _a; return (_a = state.widgets.ids[uniqid]) !== null && _a !== void 0 ? _a : undefined; };
2568
2618
  const selectWidgetObject = (state, uniqid) => { var _a; return (_a = state.widgets.widgetObject[uniqid]) !== null && _a !== void 0 ? _a : undefined; };
2619
+ const selectWidgetObjectRights = (state, uniqid) => { var _a; return (_a = state.widgets.widgetObjectRights[uniqid]) !== null && _a !== void 0 ? _a : undefined; };
2620
+ const selectWidgetAuthor = (state, uniqid) => { var _a; return (_a = state.widgets.widgetAuthor[uniqid]) !== null && _a !== void 0 ? _a : undefined; };
2569
2621
  const isActive = (state, uniqid) => state.widgets.currentEditableWidgetId === uniqid;
2622
+ const selectAllWidgetRTObject = (state, uniqid) => state.widgets.rtObjectStack.filter((el) => el.uniqid === uniqid);
2570
2623
  const updateWidgetContent = (uniqid, content, override) => Widget.slice.actions.updateWidget({ uniqid, content, override: override !== null && override !== void 0 ? override : false });
2571
2624
  const Widget = {
2572
2625
  const: WIDGETS,
@@ -2576,6 +2629,7 @@ const Widget = {
2576
2629
  uniqid,
2577
2630
  },
2578
2631
  slice: widgetsSlice,
2632
+ getWidgetRTHandlers,
2579
2633
  selectors: {
2580
2634
  isActive,
2581
2635
  selectToken,
@@ -2584,6 +2638,9 @@ const Widget = {
2584
2638
  selectWidgetState,
2585
2639
  selectModal,
2586
2640
  selectWidgetObject,
2641
+ selectWidgetAuthor,
2642
+ selectWidgetObjectRights,
2643
+ selectAllWidgetRTObject,
2587
2644
  },
2588
2645
  };
2589
2646
 
@@ -2595,12 +2652,19 @@ const editorsSlice = toolkit.createSlice({
2595
2652
  initialState: initialState$2,
2596
2653
  reducers: {
2597
2654
  registerEditor: (state, action) => {
2598
- const { uniqid, name } = action.payload;
2599
- const ed = {
2600
- uniqid,
2601
- name,
2602
- position: 'right',
2603
- };
2655
+ const { uniqid, name, onSave } = action.payload;
2656
+ const ed = !onSave
2657
+ ? {
2658
+ uniqid,
2659
+ name,
2660
+ position: 'right',
2661
+ }
2662
+ : {
2663
+ uniqid,
2664
+ name,
2665
+ onSave,
2666
+ position: 'right',
2667
+ };
2604
2668
  state.editors = state.editors.find((ed) => ed.uniqid === uniqid)
2605
2669
  ? state.editors
2606
2670
  : [...state.editors, ed];