jamespot-front-business 1.1.10 → 1.1.12

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
@@ -63,7 +63,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
63
63
  });
64
64
  }
65
65
 
66
- const initialState$8 = {
66
+ const initialState$9 = {
67
67
  entities: [],
68
68
  loading: 'idle',
69
69
  nbResults: 0,
@@ -74,7 +74,7 @@ const fetchBookableAsset = toolkit.createAsyncThunk('BookableAsset/fetchBookable
74
74
  }));
75
75
  const BookableAssetSlice = toolkit.createSlice({
76
76
  name: 'bookableAsset',
77
- initialState: initialState$8,
77
+ initialState: initialState$9,
78
78
  reducers: {},
79
79
  extraReducers: (builder) => {
80
80
  builder
@@ -95,7 +95,7 @@ const BookableAssetSlice = toolkit.createSlice({
95
95
  const fetchConfiguration = toolkit.createAsyncThunk('AssetReservation/configuration', (_, { extra }) => __awaiter(void 0, void 0, void 0, function* () {
96
96
  return yield extra.jApi.assetReservation.configuration();
97
97
  }));
98
- const initialState$7 = {
98
+ const initialState$8 = {
99
99
  description: '',
100
100
  right: {
101
101
  manage: false,
@@ -109,7 +109,7 @@ const initialState$7 = {
109
109
  };
110
110
  const AssetReservationConfigurationSlice = toolkit.createSlice({
111
111
  name: 'configuration',
112
- initialState: initialState$7,
112
+ initialState: initialState$8,
113
113
  reducers: {},
114
114
  extraReducers: (builder) => {
115
115
  builder
@@ -130,7 +130,7 @@ const initForm = {
130
130
  hourStart: '',
131
131
  hourEnd: '',
132
132
  };
133
- const initialState$6 = {
133
+ const initialState$7 = {
134
134
  entities: [],
135
135
  loading: 'idle',
136
136
  nbResults: 0,
@@ -142,7 +142,7 @@ const fetchReservation = toolkit.createAsyncThunk('Reservation/fetchReservation'
142
142
  }));
143
143
  const ReservationSlice = toolkit.createSlice({
144
144
  name: 'reservation',
145
- initialState: initialState$6,
145
+ initialState: initialState$7,
146
146
  reducers: {
147
147
  setForm: (state, action) => {
148
148
  state.form = action.payload;
@@ -235,7 +235,7 @@ const Toast = {
235
235
  selectors: selectors$1,
236
236
  };
237
237
 
238
- const initialState$5 = {
238
+ const initialState$6 = {
239
239
  bookmarks: [],
240
240
  loading: 'idle',
241
241
  status: undefined,
@@ -298,7 +298,7 @@ const deleteBookmark = toolkit.createAsyncThunk('bookmarkList/deleteBookmark', (
298
298
  }));
299
299
  const BookmarkListSlice = toolkit.createSlice({
300
300
  name: 'bookmarkList',
301
- initialState: initialState$5,
301
+ initialState: initialState$6,
302
302
  reducers: {
303
303
  resetAddBookmarkStatus: (state, action) => {
304
304
  if (state.add[action.payload]) {
@@ -455,7 +455,7 @@ const getRTHandlers = function (dispatch) {
455
455
  ];
456
456
  };
457
457
 
458
- const initialState$4 = {
458
+ const initialState$5 = {
459
459
  bookmark: undefined,
460
460
  status: undefined,
461
461
  loading: 'idle',
@@ -477,7 +477,7 @@ const editBookmark = toolkit.createAsyncThunk('bookmarkEdit/editBookmark', (book
477
477
  }));
478
478
  const BookmarkEditSlice = toolkit.createSlice({
479
479
  name: 'bookmarkEdit',
480
- initialState: initialState$4,
480
+ initialState: initialState$5,
481
481
  reducers: {
482
482
  setEditBookmark: (state, action) => {
483
483
  state.bookmark = Object.assign({}, action.payload);
@@ -763,7 +763,7 @@ const initialMap = {
763
763
  illustration: '',
764
764
  assignLicense: false,
765
765
  };
766
- const initialState$3 = {
766
+ const initialState$4 = {
767
767
  map: Object.assign({}, initialMap),
768
768
  loading: 'idle',
769
769
  status: undefined,
@@ -807,13 +807,13 @@ const createMap = toolkit.createAsyncThunk('mapCreate/create', ({ map, jlandUrlB
807
807
  }));
808
808
  const MapCreateSlice = toolkit.createSlice({
809
809
  name: 'mapCreate',
810
- initialState: initialState$3,
810
+ initialState: initialState$4,
811
811
  reducers: {
812
812
  setMap: (state, action) => {
813
813
  state.map = action.payload;
814
814
  },
815
815
  resetCreateMapState: () => {
816
- return initialState$3;
816
+ return initialState$4;
817
817
  },
818
818
  },
819
819
  extraReducers: (builder) => {
@@ -843,13 +843,13 @@ const selectJLandAvailableLicenses = function selectJLandAvailableLicenses(state
843
843
  const selectMapCreate = function selectMapCreate(state) {
844
844
  return state.jland.mapCreate;
845
845
  };
846
- const joinedReducers = toolkit.combineReducers({
846
+ const joinedReducers$1 = toolkit.combineReducers({
847
847
  [JLandMapListSlice.name]: JLandMapListSlice.reducer,
848
848
  [MapCreateSlice.name]: MapCreateSlice.reducer,
849
849
  });
850
850
  const jlandSlice = {
851
851
  name: 'jland',
852
- reducer: joinedReducers,
852
+ reducer: joinedReducers$1,
853
853
  };
854
854
  const jland = {
855
855
  slice: jlandSlice,
@@ -887,6 +887,88 @@ const Model = {
887
887
  selectors,
888
888
  };
889
889
 
890
+ const initialState$3 = {
891
+ channels: undefined,
892
+ loading: 'idle',
893
+ loadingChannelDeletion: 'idle',
894
+ };
895
+ const fetchChannels = toolkit.createAsyncThunk('/fetchChannels', (page, { extra }) => __awaiter(void 0, void 0, void 0, function* () {
896
+ const askedPage = page !== null && page !== void 0 ? page : 1;
897
+ const jApi = extra.jApi;
898
+ return yield new Promise((resolve, reject) => {
899
+ const config = {
900
+ type: 'tvDisplayChannel',
901
+ format: 'raw-list',
902
+ page: askedPage,
903
+ };
904
+ jApi.article
905
+ .list(config)
906
+ .then((channelsResp) => {
907
+ resolve(channelsResp.result);
908
+ })
909
+ .catch((ex) => {
910
+ var _a, _b;
911
+ reject({ error: (_a = ex.error) !== null && _a !== void 0 ? _a : 1, errorMsg: (_b = ex.errorMsg) !== null && _b !== void 0 ? _b : 'Error retrieving channels' });
912
+ });
913
+ });
914
+ }));
915
+ const ChannelsListSlice = toolkit.createSlice({
916
+ name: 'channelsList',
917
+ initialState: Object.assign({}, initialState$3),
918
+ reducers: {},
919
+ extraReducers: (builder) => {
920
+ builder
921
+ .addCase(fetchChannels.pending, (state) => {
922
+ if (state.loading === 'idle') {
923
+ state.loading = 'pending';
924
+ }
925
+ })
926
+ .addCase(fetchChannels.fulfilled, (state, action) => {
927
+ if (state.loading === 'pending') {
928
+ state.loading = 'idle';
929
+ state.channels = action.payload;
930
+ }
931
+ })
932
+ .addCase(fetchChannels.rejected, (state) => {
933
+ if (state.loading === 'pending') {
934
+ state.loading = 'idle';
935
+ }
936
+ });
937
+ },
938
+ });
939
+
940
+ function isChannelConfigured(channel) {
941
+ if (channel.tvChannelType === 'DYNAMIC') {
942
+ return !!channel.tvChannelBackgroundColor && !!channel.tvChannelGroupTarget;
943
+ }
944
+ else {
945
+ return !!channel.tvChannelBackgroundColor && channel.tvChannelNumImages !== 0;
946
+ }
947
+ }
948
+
949
+ const joinedReducers = toolkit.combineReducers({
950
+ [ChannelsListSlice.name]: ChannelsListSlice.reducer,
951
+ });
952
+ const TVDisplaySlice = {
953
+ name: 'tvDisplay',
954
+ reducer: joinedReducers,
955
+ };
956
+ const selectChannelsList = function selectChannelsList(state) {
957
+ return state.tvDisplay.channelsList;
958
+ };
959
+ const TVDisplay = {
960
+ slice: TVDisplaySlice,
961
+ actions: {
962
+ fetchChannels,
963
+ },
964
+ selectors: {
965
+ selectChannelsList,
966
+ },
967
+ utils: {
968
+ isChannelConfigured,
969
+ },
970
+ };
971
+
890
972
  const initialState$2 = {
891
973
  id: 0,
892
974
  mainType: 'user',
@@ -922,6 +1004,125 @@ const UserCurrent = {
922
1004
  utils: { isAdmin },
923
1005
  };
924
1006
 
1007
+ const widgetArticleAttachmentDefinition = {
1008
+ label: 'WIDGET_Article_Attachment',
1009
+ description: 'WIDGET_Article_Attachment_Description',
1010
+ name: 'widget-article-attachment',
1011
+ img: '/img/fast-intranet/widget-file.png',
1012
+ available: true,
1013
+ panel: {
1014
+ useWrapper: true,
1015
+ useEditor: true,
1016
+ useWidgets: false
1017
+ },
1018
+ };
1019
+ const widgetArticleAttachmentContent = {
1020
+ files: [],
1021
+ };
1022
+
1023
+ const widgetArticleGalleryDefinition = {
1024
+ label: 'WIDGET_Article_Gallery',
1025
+ description: 'WIDGET_Article_Gallery_Description',
1026
+ name: 'widget-article-gallery',
1027
+ img: '/img/fast-intranet/widget-slider.png',
1028
+ available: true,
1029
+ panel: {
1030
+ useWrapper: false,
1031
+ useEditor: true,
1032
+ useWidgets: false
1033
+ },
1034
+ };
1035
+ const widgetArticleGalleryContent = {
1036
+ files: [],
1037
+ gap: '4',
1038
+ columnCount: '3',
1039
+ galleryDisplay: 'landscape',
1040
+ heightMode: 'auto',
1041
+ heightModeValue: '200',
1042
+ };
1043
+
1044
+ const widgetArticleImageDefinition = {
1045
+ label: 'WIDGET_Article_Image',
1046
+ description: 'WIDGET_Article_Image_Description',
1047
+ name: 'widget-article-image',
1048
+ img: '/img/fast-intranet/widget-image.png',
1049
+ available: true,
1050
+ panel: {
1051
+ useWrapper: false,
1052
+ useEditor: true,
1053
+ useWidgets: false
1054
+ },
1055
+ };
1056
+ const widgetArticleImageContent = {
1057
+ displayAs: 'image',
1058
+ backgroundPosition: 'center',
1059
+ backgroundSize: 'cover',
1060
+ borderRadius: '8'
1061
+ };
1062
+
1063
+ const widgetArticleButtonDefinition = {
1064
+ label: 'WIDGET_Button',
1065
+ description: 'WIDGET_Button_Description',
1066
+ name: 'widget-article-button',
1067
+ img: '/img/fast-intranet/widget-button.png',
1068
+ available: true,
1069
+ panel: {
1070
+ useWrapper: false,
1071
+ useEditor: true,
1072
+ useWidgets: false
1073
+ },
1074
+ };
1075
+ const widgetArticleButtonContent = {
1076
+ text: 'This is a button',
1077
+ openingType: 'link',
1078
+ openingTypeLink: {
1079
+ url: '',
1080
+ target: '_blank'
1081
+ },
1082
+ variant: 'contained',
1083
+ fontSize: '14',
1084
+ color: '#fff',
1085
+ backgroundColor: '#4dbf96',
1086
+ buttonSize: 'lg',
1087
+ borderRadius: '4',
1088
+ };
1089
+
1090
+ const widgetArticleTextDefinition = {
1091
+ label: 'WIDGET_Text',
1092
+ description: 'WIDGET_Text_Description',
1093
+ name: 'widget-article-text',
1094
+ img: '/img/fast-intranet/widget-text.png',
1095
+ available: true,
1096
+ panel: {
1097
+ useWrapper: false,
1098
+ useEditor: true,
1099
+ useWidgets: false
1100
+ },
1101
+ };
1102
+ const widgetArticleTextContent = {
1103
+ fontSize: '18',
1104
+ lineHeight: '1.6',
1105
+ text: ''
1106
+ };
1107
+
1108
+ const widgetArticleTitleDefinition = {
1109
+ label: 'WIDGET_Title',
1110
+ description: 'WIDGET_Title_Description',
1111
+ name: 'widget-article-title',
1112
+ img: '/img/fast-intranet/widget-text.png',
1113
+ available: true,
1114
+ panel: {
1115
+ useWrapper: false,
1116
+ useEditor: true,
1117
+ useWidgets: false
1118
+ },
1119
+ };
1120
+ const widgetArticleTitleContent = {
1121
+ text: '',
1122
+ heading: 'h1',
1123
+ backgroundColor: 'transparent'
1124
+ };
1125
+
925
1126
  function uniqid() {
926
1127
  let id = '';
927
1128
  for (let index = 0; index < 16; index++) {
@@ -930,6 +1131,37 @@ function uniqid() {
930
1131
  return id;
931
1132
  }
932
1133
 
1134
+ function widgetFactory(name) {
1135
+ return {
1136
+ title: '',
1137
+ widget: widget(name),
1138
+ };
1139
+ }
1140
+ function widget(name) {
1141
+ return {
1142
+ uniqid: uniqid(),
1143
+ name,
1144
+ content: content(name)
1145
+ };
1146
+ }
1147
+ function content(name) {
1148
+ switch (name) {
1149
+ default:
1150
+ case 'widget-article-attachment':
1151
+ return Object.assign({}, widgetArticleAttachmentContent);
1152
+ case 'widget-article-gallery':
1153
+ return Object.assign({}, widgetArticleGalleryContent);
1154
+ case 'widget-article-button':
1155
+ return Object.assign({}, widgetArticleButtonContent);
1156
+ case 'widget-article-title':
1157
+ return Object.assign({}, widgetArticleTitleContent);
1158
+ case 'widget-article-image':
1159
+ return Object.assign({}, widgetArticleImageContent);
1160
+ case 'widget-article-text':
1161
+ return Object.assign({}, widgetArticleTextContent);
1162
+ }
1163
+ }
1164
+
933
1165
  const WIDGET_ARTICLE_TITLE = 'widget-article-title';
934
1166
  const WIDGET_ARTICLE_TEXT = 'widget-article-text';
935
1167
  const WIDGET_ARTICLE_IMAGE = 'widget-article-image';
@@ -947,155 +1179,22 @@ var WIDGETS = /*#__PURE__*/Object.freeze({
947
1179
  WIDGET_ARTICLE_ATTACHMENT: WIDGET_ARTICLE_ATTACHMENT
948
1180
  });
949
1181
 
950
- function widgetFactory(name, widgetWrapperExtraParams) {
951
- const widgetWrapper = {
952
- title: '',
953
- widget: {
954
- name,
955
- uniqid: uniqid(),
956
- content: {}
957
- },
958
- position: { x: 0, y: 0 }
959
- };
960
- switch (name) {
961
- default:
962
- case WIDGET_ARTICLE_ATTACHMENT:
963
- return Object.assign(Object.assign(Object.assign({}, widgetWrapper), widgetWrapperExtraParams), { widget: Object.assign(Object.assign({}, widgetWrapper.widget), { content: {
964
- files: []
965
- } }) });
966
- case WIDGET_ARTICLE_GALLERY:
967
- return Object.assign(Object.assign(Object.assign({}, widgetWrapper), widgetWrapperExtraParams), { widget: Object.assign(Object.assign({}, widgetWrapper.widget), { content: {
968
- widgets: [],
969
- gap: '4',
970
- horizontalNumber: '3',
971
- galleryDisplay: 'landscape'
972
- } }) });
973
- case WIDGET_ARTICLE_IMAGE:
974
- return Object.assign(Object.assign(Object.assign({}, widgetWrapper), widgetWrapperExtraParams), { widget: Object.assign(Object.assign({}, widgetWrapper.widget), { content: {
975
- widgets: [],
976
- displayAs: 'image',
977
- backgroundPosition: 'center',
978
- backgroundSize: 'cover',
979
- borderRadius: 8
980
- } }) });
981
- case WIDGET_ARTICLE_BUTTON:
982
- return Object.assign(Object.assign(Object.assign({}, widgetWrapper), widgetWrapperExtraParams), { widget: Object.assign(Object.assign({}, widgetWrapper.widget), { content: {
983
- text: 'This is a button',
984
- variant: 'contained',
985
- fontSize: '14',
986
- color: '#fff',
987
- backgroundColor: '#4dbf96',
988
- buttonSize: 'lg',
989
- borderRadius: '4'
990
- } }) });
991
- case WIDGET_ARTICLE_TITLE:
992
- return Object.assign(Object.assign(Object.assign({}, widgetWrapper), widgetWrapperExtraParams), { widget: Object.assign(Object.assign({}, widgetWrapper.widget), { content: {
993
- text: 'Ceci est un titre',
994
- heading: 'h1',
995
- backgroundColor: 'transparent'
996
- } }) });
997
- case WIDGET_ARTICLE_TEXT:
998
- return Object.assign(Object.assign(Object.assign({}, widgetWrapper), widgetWrapperExtraParams), { widget: Object.assign(Object.assign({}, widgetWrapper.widget), { content: {
999
- fontSize: '18',
1000
- lineHeight: '1.6',
1001
- text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'
1002
- } }) });
1003
- }
1004
- }
1005
-
1006
1182
  function widgetDefinition(name) {
1007
1183
  switch (name) {
1008
1184
  default:
1009
- return {
1010
- label: 'WIDGET_Article_Gallery',
1011
- description: 'WIDGET_Article_Gallery_Description',
1012
- name: 'widget-article-image',
1013
- img: '/img/fast-intranet/widget-slider.png',
1014
- available: true,
1015
- panel: {
1016
- useWrapper: false,
1017
- useEditor: true,
1018
- useWidgets: false
1019
- },
1020
- };
1021
- case WIDGET_ARTICLE_GALLERY:
1022
- return {
1023
- label: 'WIDGET_Article_Gallery',
1024
- description: 'WIDGET_Article_Gallery_Description',
1025
- name,
1026
- img: '/img/fast-intranet/widget-slider.png',
1027
- available: true,
1028
- panel: {
1029
- useWrapper: false,
1030
- useEditor: true,
1031
- useWidgets: false
1032
- },
1033
- };
1034
- case WIDGET_ARTICLE_ATTACHMENT:
1035
- return {
1036
- label: 'WIDGET_Article_Attachment',
1037
- description: 'WIDGET_Article_Attachment_Description',
1038
- name,
1039
- img: '/img/fast-intranet/widget-file.png',
1040
- available: true,
1041
- panel: {
1042
- useWrapper: true,
1043
- useEditor: true,
1044
- useWidgets: false
1045
- },
1046
- };
1047
- case WIDGET_ARTICLE_TEXT:
1048
- return {
1049
- label: 'WIDGET_Text',
1050
- description: 'WIDGET_Text_Description',
1051
- name,
1052
- img: '/img/fast-intranet/widget-text.png',
1053
- available: true,
1054
- panel: {
1055
- useWrapper: false,
1056
- useEditor: true,
1057
- useWidgets: false
1058
- },
1059
- };
1060
- case WIDGET_ARTICLE_TITLE:
1061
- return {
1062
- label: 'WIDGET_Title',
1063
- description: 'WIDGET_Title_Description',
1064
- name,
1065
- img: '/img/fast-intranet/widget-text.png',
1066
- available: true,
1067
- panel: {
1068
- useWrapper: false,
1069
- useEditor: true,
1070
- useWidgets: false
1071
- },
1072
- };
1073
- case WIDGET_ARTICLE_IMAGE:
1074
- return {
1075
- label: 'WIDGET_Article_Image',
1076
- description: 'WIDGET_Article_Image_Description',
1077
- name,
1078
- img: '/img/fast-intranet/widget-image.png',
1079
- available: true,
1080
- panel: {
1081
- useWrapper: false,
1082
- useEditor: true,
1083
- useWidgets: false
1084
- },
1085
- };
1086
- case WIDGET_ARTICLE_BUTTON:
1087
- return {
1088
- label: 'WIDGET_Button',
1089
- description: 'WIDGET_Button_Description',
1090
- name,
1091
- img: '/img/fast-intranet/widget-button.png',
1092
- available: true,
1093
- panel: {
1094
- useWrapper: false,
1095
- useEditor: true,
1096
- useWidgets: false
1097
- },
1098
- };
1185
+ return widgetArticleGalleryDefinition;
1186
+ case 'widget-article-gallery':
1187
+ return widgetArticleGalleryDefinition;
1188
+ case 'widget-article-attachment':
1189
+ return widgetArticleAttachmentDefinition;
1190
+ case 'widget-article-text':
1191
+ return widgetArticleTextDefinition;
1192
+ case 'widget-article-title':
1193
+ return widgetArticleTitleDefinition;
1194
+ case 'widget-article-image':
1195
+ return widgetArticleImageDefinition;
1196
+ case 'widget-article-button':
1197
+ return widgetArticleButtonDefinition;
1099
1198
  }
1100
1199
  }
1101
1200
 
@@ -1104,8 +1203,12 @@ const MODE_VIEW = 'view';
1104
1203
  const initialState$1 = {
1105
1204
  token: undefined,
1106
1205
  ids: {},
1206
+ layers: {},
1107
1207
  states: {},
1108
1208
  modal: undefined,
1209
+ editableMap: {},
1210
+ currentEditableIndex: -1,
1211
+ currentEditableWidgetId: undefined,
1109
1212
  };
1110
1213
  const widgetsSlice = toolkit.createSlice({
1111
1214
  name: 'widgets',
@@ -1114,14 +1217,15 @@ const widgetsSlice = toolkit.createSlice({
1114
1217
  registerWidget: (state, action) => {
1115
1218
  const { uniqid, widget } = action.payload;
1116
1219
  state.ids[uniqid] = widget;
1117
- state.states[uniqid] = { busy: false, initialized: false, loading: false, mounted: false };
1220
+ state.states[uniqid] = { busy: false, initialized: false, loading: false, mounted: false, hover: false };
1118
1221
  },
1119
1222
  updateWidget: (state, action) => {
1120
- var _a;
1121
- const { uniqid, content } = action.payload;
1223
+ const { uniqid } = action.payload;
1122
1224
  const wrapper = Object.assign({}, state.ids[uniqid]);
1123
- if (wrapper !== undefined && wrapper.widget !== undefined) {
1124
- state.ids[uniqid] = Object.assign(Object.assign({}, wrapper), { title: (_a = wrapper === null || wrapper === void 0 ? void 0 : wrapper.title) !== null && _a !== void 0 ? _a : '', widget: Object.assign(Object.assign({}, wrapper.widget), { content }) });
1225
+ if (state.ids[uniqid] && wrapper && wrapper.widget) {
1226
+ state.ids[uniqid] = Object.assign(Object.assign(Object.assign({}, state.ids[uniqid]), { widget: Object.assign(Object.assign({}, wrapper.widget), { content: action.payload.override
1227
+ ? action.payload.content
1228
+ : Object.assign(Object.assign(Object.assign({}, wrapper.widget.content), action.payload.content)) }) }));
1125
1229
  }
1126
1230
  },
1127
1231
  flushWidget: (state, action) => {
@@ -1129,34 +1233,90 @@ const widgetsSlice = toolkit.createSlice({
1129
1233
  delete state.ids[uniqid];
1130
1234
  delete state.states[uniqid];
1131
1235
  },
1236
+ flushAllWidget: (state) => {
1237
+ state.ids = {};
1238
+ state.states = {};
1239
+ },
1132
1240
  updateWidgetWrapper: (state, action) => {
1133
- const { uniqid, title, position } = action.payload;
1134
- const wrapper = Object.assign({}, state.ids[uniqid]);
1135
- if (wrapper !== undefined && wrapper.widget !== undefined) {
1136
- if (position) {
1137
- state.ids[uniqid] = Object.assign(Object.assign({}, wrapper), { title, position, widget: wrapper.widget });
1241
+ const { uniqid } = action.payload;
1242
+ if (state.ids && state.ids[uniqid]) {
1243
+ state.ids[uniqid] = Object.assign(Object.assign(Object.assign({}, state.ids[uniqid]), action.payload));
1244
+ }
1245
+ },
1246
+ registerLayer: (state, action) => {
1247
+ const layerId = uniqid();
1248
+ const wrapper = Object.assign({}, state.ids[action.payload.uniqid]);
1249
+ if (wrapper && wrapper.widget) {
1250
+ if (state.ids[action.payload.uniqid] && wrapper.widget.layers) {
1251
+ state.ids[action.payload.uniqid] = Object.assign(Object.assign(Object.assign({}, state.ids[action.payload.uniqid]), { widget: Object.assign(Object.assign({}, wrapper.widget), { layers: [...wrapper.widget.layers, layerId] }) }));
1138
1252
  }
1139
1253
  else {
1140
- state.ids[uniqid] = Object.assign(Object.assign({}, wrapper), { title, widget: wrapper.widget });
1254
+ state.ids[action.payload.uniqid] = Object.assign(Object.assign(Object.assign({}, state.ids[action.payload.uniqid]), { widget: Object.assign(Object.assign({}, wrapper.widget), { layers: [layerId] }) }));
1141
1255
  }
1256
+ state.ids[action.payload.widget.widget.uniqid] = action.payload.widget;
1257
+ state.states[action.payload.widget.widget.uniqid] = {
1258
+ busy: false,
1259
+ initialized: false,
1260
+ loading: false,
1261
+ mounted: false,
1262
+ hover: false,
1263
+ };
1264
+ state.layers[layerId] = {
1265
+ uniqid: layerId,
1266
+ widgets: [action.payload.widget],
1267
+ title: `Layer ${layerId}`,
1268
+ visible: true,
1269
+ locked: false,
1270
+ position: { x: 0, y: 0 },
1271
+ };
1272
+ }
1273
+ },
1274
+ updateLayer: (state, action) => {
1275
+ if (state.layers[action.payload.uniqid]) {
1276
+ state.layers[action.payload.uniqid] = Object.assign(Object.assign(Object.assign({}, state.layers[action.payload.uniqid]), action.payload.props));
1277
+ }
1278
+ },
1279
+ flushLayer: (state, action) => {
1280
+ const wrapper = Object.assign({}, state.ids[action.payload.uniqid]);
1281
+ if (wrapper && wrapper.widget && wrapper.widget.layers) {
1282
+ state.ids[action.payload.uniqid] = Object.assign(Object.assign(Object.assign({}, state.ids[action.payload.uniqid]), { widget: Object.assign(Object.assign({}, wrapper.widget), { layers: [
1283
+ ...wrapper.widget.layers.filter((layerId) => layerId !== action.payload.layerId),
1284
+ ] }) }));
1285
+ delete state.layers[action.payload.layerId];
1142
1286
  }
1143
1287
  },
1288
+ prevEditableIndex: (state) => {
1289
+ const count = Object.keys(state.ids).length;
1290
+ state.currentEditableIndex = state.currentEditableIndex === 0 ? count - 1 : state.currentEditableIndex - 1;
1291
+ },
1292
+ nextEditableIndex: (state) => {
1293
+ const count = Object.keys(state.ids).length;
1294
+ state.currentEditableIndex = state.currentEditableIndex < count - 1 ? state.currentEditableIndex + 1 : 0;
1295
+ },
1296
+ setEditableIndex: (state, action) => {
1297
+ state.currentEditableIndex = action.payload.index;
1298
+ },
1299
+ setEditableWidgetId: (state, action) => {
1300
+ state.currentEditableWidgetId = action.payload.uniqid;
1301
+ },
1302
+ registerEditableWidget: (state, action) => {
1303
+ state.editableMap[action.payload.uniqid] = action.payload;
1304
+ },
1144
1305
  setToken: (state, action) => {
1145
1306
  state.token = action.payload.token;
1146
1307
  },
1147
- setState: (state, action) => {
1308
+ setWidgetState: (state, action) => {
1148
1309
  const { uniqid } = action.payload;
1149
1310
  const widgetState = Object.assign({}, state.states[uniqid]);
1150
1311
  if (widgetState !== undefined) {
1151
1312
  state.states[uniqid] = Object.assign(Object.assign({}, state.states[uniqid]), action.payload);
1152
1313
  }
1153
1314
  },
1154
- setAllStates: (state, action) => {
1155
- const { busy, initialized, loading, mounted } = action.payload;
1315
+ setAllWidgetStates: (state, action) => {
1156
1316
  Object.keys(state.states).map((key) => {
1157
1317
  const widgetState = Object.assign({}, state.states[key]);
1158
1318
  if (widgetState !== undefined) {
1159
- state.states[key] = Object.assign(Object.assign({}, state.states[key]), { busy: busy !== null && busy !== void 0 ? busy : widgetState.busy, initialized: initialized !== null && initialized !== void 0 ? initialized : widgetState.initialized, loading: loading !== null && loading !== void 0 ? loading : widgetState.loading, mounted: mounted !== null && mounted !== void 0 ? mounted : widgetState.mounted });
1319
+ state.states[key] = Object.assign(Object.assign({}, state.states[key]), action.payload);
1160
1320
  }
1161
1321
  });
1162
1322
  },
@@ -1171,7 +1331,7 @@ const widgetsSlice = toolkit.createSlice({
1171
1331
  const selectToken = (state) => state.widgets.token;
1172
1332
  const selectModal = (state) => state.widgets.modal;
1173
1333
  const selectWidgets = (state) => state.widgets.ids;
1174
- const selectWidgetContent = (state, uniqid) => { var _a, _b; return (_b = (_a = state.widgets) === null || _a === void 0 ? void 0 : _a.ids[uniqid]) === null || _b === void 0 ? void 0 : _b.widget.content; };
1334
+ const selectWidgetContent = (state, uniqid) => { var _a; return (_a = state.widgets.ids[uniqid]) === null || _a === void 0 ? void 0 : _a.widget.content; };
1175
1335
  const selectWidgetState = (state, uniqid) => { var _a; return (_a = state.widgets.states[uniqid]) !== null && _a !== void 0 ? _a : undefined; };
1176
1336
  const selectWidget = (state, uniqid) => { var _a; return (_a = state.widgets.ids[uniqid]) !== null && _a !== void 0 ? _a : undefined; };
1177
1337
  const Widget = {
@@ -1179,7 +1339,7 @@ const Widget = {
1179
1339
  factory: widgetFactory,
1180
1340
  definition: widgetDefinition,
1181
1341
  utils: {
1182
- uniqid
1342
+ uniqid,
1183
1343
  },
1184
1344
  slice: widgetsSlice,
1185
1345
  selectors: {
@@ -1189,7 +1349,7 @@ const Widget = {
1189
1349
  selectWidgetState,
1190
1350
  selectWidgetContent,
1191
1351
  selectModal,
1192
- }
1352
+ },
1193
1353
  };
1194
1354
 
1195
1355
  const initialState = {
@@ -1228,18 +1388,13 @@ const editorsSlice = toolkit.createSlice({
1228
1388
  }),
1229
1389
  ];
1230
1390
  },
1231
- updateEditor: (state, action) => {
1232
- const { uniqid, content } = action.payload;
1233
- state.editors = [
1234
- ...state.editors.map((ed) => {
1235
- return ed.uniqid === uniqid ? Object.assign(Object.assign({}, ed), { content }) : ed;
1236
- }),
1237
- ];
1238
- },
1239
1391
  flushEditor: (state, action) => {
1240
1392
  const { uniqid } = action.payload;
1241
1393
  state.editors = [...state.editors.filter((ed) => ed.uniqid !== uniqid)];
1242
1394
  },
1395
+ flushAllEditor: (state) => {
1396
+ state.editors.length = 0;
1397
+ },
1243
1398
  },
1244
1399
  });
1245
1400
  const selectEditors = (state) => state.editors.editors;
@@ -1258,6 +1413,7 @@ exports.Bookmark = Bookmark;
1258
1413
  exports.MODE_EDIT = MODE_EDIT;
1259
1414
  exports.MODE_VIEW = MODE_VIEW;
1260
1415
  exports.Model = Model;
1416
+ exports.TVDisplay = TVDisplay;
1261
1417
  exports.Toast = Toast;
1262
1418
  exports.UserCurrent = UserCurrent;
1263
1419
  exports.Widget = Widget;