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/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',
@@ -2304,7 +2288,7 @@ const widgetDatasourceTableDefinition = {
2304
2288
  img: '/img/fast-intranet/widget-datasource-table.png',
2305
2289
  available: true,
2306
2290
  panel: {
2307
- useWrapper: false,
2291
+ useWrapper: true,
2308
2292
  useEditor: true,
2309
2293
  useWidgets: false,
2310
2294
  },
@@ -2325,7 +2309,7 @@ const widgetExcelDatasourceTableDefinition = {
2325
2309
  img: '/img/fast-intranet/widget-excel-datasource-table.png',
2326
2310
  available: true,
2327
2311
  panel: {
2328
- useWrapper: false,
2312
+ useWrapper: true,
2329
2313
  useEditor: true,
2330
2314
  useWidgets: false,
2331
2315
  },
@@ -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: {},
2446
+ widgetObjectRights: {},
2447
+ widgetAuthor: {},
2448
+ rtObjectStack: [],
2424
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,22 +2468,39 @@ 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),
2472
+ locked: false,
2439
2473
  };
2440
2474
  },
2441
2475
  registerWidgetObject: (state, action) => {
2442
2476
  const { uniqid, object } = action.payload;
2443
2477
  state.widgetObject[uniqid] = object;
2444
2478
  },
2479
+ registerWidgetObjectRights: (state, action) => {
2480
+ const { uniqid, rights } = action.payload;
2481
+ state.widgetObjectRights[uniqid] = rights;
2482
+ },
2483
+ registerWidgetAuthor: (state, action) => {
2484
+ const { uniqid, author } = action.payload;
2485
+ state.widgetAuthor[uniqid] = author;
2486
+ },
2445
2487
  updateWidget: (state, action) => {
2446
2488
  const { uniqid } = action.payload;
2447
2489
  const wrapper = Object.assign({}, state.ids[uniqid]);
2490
+ const states = state.states[uniqid];
2491
+ if (states === null || states === void 0 ? void 0 : states.locked) {
2492
+ return;
2493
+ }
2448
2494
  if (state.ids[uniqid] && wrapper && wrapper.widget) {
2449
2495
  state.ids[uniqid] = Object.assign(Object.assign(Object.assign({}, state.ids[uniqid]), { widget: Object.assign(Object.assign({}, wrapper.widget), { content: action.payload.override
2450
2496
  ? action.payload.content
2451
2497
  : Object.assign(Object.assign(Object.assign({}, wrapper.widget.content), action.payload.content)) }) }));
2452
2498
  }
2453
2499
  },
2500
+ registerWidgetRTObject: (state, action) => {
2501
+ const { uniqid, object } = action.payload;
2502
+ state.rtObjectStack = [...state.rtObjectStack, { uniqid, object }];
2503
+ },
2454
2504
  flushWidget: (state, action) => {
2455
2505
  const { uniqid } = action.payload;
2456
2506
  delete state.ids[uniqid];
@@ -2558,7 +2608,10 @@ const selectWidgets = (state) => state.widgets.ids;
2558
2608
  const selectWidgetState = (state, uniqid) => { var _a; return (_a = state.widgets.states[uniqid]) !== null && _a !== void 0 ? _a : undefined; };
2559
2609
  const selectWidget = (state, uniqid) => { var _a; return (_a = state.widgets.ids[uniqid]) !== null && _a !== void 0 ? _a : undefined; };
2560
2610
  const selectWidgetObject = (state, uniqid) => { var _a; return (_a = state.widgets.widgetObject[uniqid]) !== null && _a !== void 0 ? _a : undefined; };
2611
+ const selectWidgetObjectRights = (state, uniqid) => { var _a; return (_a = state.widgets.widgetObjectRights[uniqid]) !== null && _a !== void 0 ? _a : undefined; };
2612
+ const selectWidgetAuthor = (state, uniqid) => { var _a; return (_a = state.widgets.widgetAuthor[uniqid]) !== null && _a !== void 0 ? _a : undefined; };
2561
2613
  const isActive = (state, uniqid) => state.widgets.currentEditableWidgetId === uniqid;
2614
+ const selectAllWidgetRTObject = (state, uniqid) => state.widgets.rtObjectStack.filter((el) => el.uniqid === uniqid);
2562
2615
  const updateWidgetContent = (uniqid, content, override) => Widget.slice.actions.updateWidget({ uniqid, content, override: override !== null && override !== void 0 ? override : false });
2563
2616
  const Widget = {
2564
2617
  const: WIDGETS,
@@ -2568,6 +2621,7 @@ const Widget = {
2568
2621
  uniqid,
2569
2622
  },
2570
2623
  slice: widgetsSlice,
2624
+ getWidgetRTHandlers,
2571
2625
  selectors: {
2572
2626
  isActive,
2573
2627
  selectToken,
@@ -2576,6 +2630,9 @@ const Widget = {
2576
2630
  selectWidgetState,
2577
2631
  selectModal,
2578
2632
  selectWidgetObject,
2633
+ selectWidgetAuthor,
2634
+ selectWidgetObjectRights,
2635
+ selectAllWidgetRTObject,
2579
2636
  },
2580
2637
  };
2581
2638
 
@@ -2587,12 +2644,19 @@ const editorsSlice = createSlice({
2587
2644
  initialState: initialState$2,
2588
2645
  reducers: {
2589
2646
  registerEditor: (state, action) => {
2590
- const { uniqid, name } = action.payload;
2591
- const ed = {
2592
- uniqid,
2593
- name,
2594
- position: 'right',
2595
- };
2647
+ const { uniqid, name, onSave } = action.payload;
2648
+ const ed = !onSave
2649
+ ? {
2650
+ uniqid,
2651
+ name,
2652
+ position: 'right',
2653
+ }
2654
+ : {
2655
+ uniqid,
2656
+ name,
2657
+ onSave,
2658
+ position: 'right',
2659
+ };
2596
2660
  state.editors = state.editors.find((ed) => ed.uniqid === uniqid)
2597
2661
  ? state.editors
2598
2662
  : [...state.editors, ed];