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/esm.js CHANGED
@@ -59,7 +59,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
59
59
  });
60
60
  }
61
61
 
62
- const initialState$8 = {
62
+ const initialState$9 = {
63
63
  entities: [],
64
64
  loading: 'idle',
65
65
  nbResults: 0,
@@ -70,7 +70,7 @@ const fetchBookableAsset = createAsyncThunk('BookableAsset/fetchBookableAsset',
70
70
  }));
71
71
  const BookableAssetSlice = createSlice({
72
72
  name: 'bookableAsset',
73
- initialState: initialState$8,
73
+ initialState: initialState$9,
74
74
  reducers: {},
75
75
  extraReducers: (builder) => {
76
76
  builder
@@ -91,7 +91,7 @@ const BookableAssetSlice = createSlice({
91
91
  const fetchConfiguration = createAsyncThunk('AssetReservation/configuration', (_, { extra }) => __awaiter(void 0, void 0, void 0, function* () {
92
92
  return yield extra.jApi.assetReservation.configuration();
93
93
  }));
94
- const initialState$7 = {
94
+ const initialState$8 = {
95
95
  description: '',
96
96
  right: {
97
97
  manage: false,
@@ -105,7 +105,7 @@ const initialState$7 = {
105
105
  };
106
106
  const AssetReservationConfigurationSlice = createSlice({
107
107
  name: 'configuration',
108
- initialState: initialState$7,
108
+ initialState: initialState$8,
109
109
  reducers: {},
110
110
  extraReducers: (builder) => {
111
111
  builder
@@ -126,7 +126,7 @@ const initForm = {
126
126
  hourStart: '',
127
127
  hourEnd: '',
128
128
  };
129
- const initialState$6 = {
129
+ const initialState$7 = {
130
130
  entities: [],
131
131
  loading: 'idle',
132
132
  nbResults: 0,
@@ -138,7 +138,7 @@ const fetchReservation = createAsyncThunk('Reservation/fetchReservation', (viewM
138
138
  }));
139
139
  const ReservationSlice = createSlice({
140
140
  name: 'reservation',
141
- initialState: initialState$6,
141
+ initialState: initialState$7,
142
142
  reducers: {
143
143
  setForm: (state, action) => {
144
144
  state.form = action.payload;
@@ -231,7 +231,7 @@ const Toast = {
231
231
  selectors: selectors$1,
232
232
  };
233
233
 
234
- const initialState$5 = {
234
+ const initialState$6 = {
235
235
  bookmarks: [],
236
236
  loading: 'idle',
237
237
  status: undefined,
@@ -294,7 +294,7 @@ const deleteBookmark = createAsyncThunk('bookmarkList/deleteBookmark', (bookmark
294
294
  }));
295
295
  const BookmarkListSlice = createSlice({
296
296
  name: 'bookmarkList',
297
- initialState: initialState$5,
297
+ initialState: initialState$6,
298
298
  reducers: {
299
299
  resetAddBookmarkStatus: (state, action) => {
300
300
  if (state.add[action.payload]) {
@@ -451,7 +451,7 @@ const getRTHandlers = function (dispatch) {
451
451
  ];
452
452
  };
453
453
 
454
- const initialState$4 = {
454
+ const initialState$5 = {
455
455
  bookmark: undefined,
456
456
  status: undefined,
457
457
  loading: 'idle',
@@ -473,7 +473,7 @@ const editBookmark = createAsyncThunk('bookmarkEdit/editBookmark', (bookmark, {
473
473
  }));
474
474
  const BookmarkEditSlice = createSlice({
475
475
  name: 'bookmarkEdit',
476
- initialState: initialState$4,
476
+ initialState: initialState$5,
477
477
  reducers: {
478
478
  setEditBookmark: (state, action) => {
479
479
  state.bookmark = Object.assign({}, action.payload);
@@ -759,7 +759,7 @@ const initialMap = {
759
759
  illustration: '',
760
760
  assignLicense: false,
761
761
  };
762
- const initialState$3 = {
762
+ const initialState$4 = {
763
763
  map: Object.assign({}, initialMap),
764
764
  loading: 'idle',
765
765
  status: undefined,
@@ -803,13 +803,13 @@ const createMap = createAsyncThunk('mapCreate/create', ({ map, jlandUrlBase }, {
803
803
  }));
804
804
  const MapCreateSlice = createSlice({
805
805
  name: 'mapCreate',
806
- initialState: initialState$3,
806
+ initialState: initialState$4,
807
807
  reducers: {
808
808
  setMap: (state, action) => {
809
809
  state.map = action.payload;
810
810
  },
811
811
  resetCreateMapState: () => {
812
- return initialState$3;
812
+ return initialState$4;
813
813
  },
814
814
  },
815
815
  extraReducers: (builder) => {
@@ -839,13 +839,13 @@ const selectJLandAvailableLicenses = function selectJLandAvailableLicenses(state
839
839
  const selectMapCreate = function selectMapCreate(state) {
840
840
  return state.jland.mapCreate;
841
841
  };
842
- const joinedReducers = combineReducers({
842
+ const joinedReducers$1 = combineReducers({
843
843
  [JLandMapListSlice.name]: JLandMapListSlice.reducer,
844
844
  [MapCreateSlice.name]: MapCreateSlice.reducer,
845
845
  });
846
846
  const jlandSlice = {
847
847
  name: 'jland',
848
- reducer: joinedReducers,
848
+ reducer: joinedReducers$1,
849
849
  };
850
850
  const jland = {
851
851
  slice: jlandSlice,
@@ -883,6 +883,88 @@ const Model = {
883
883
  selectors,
884
884
  };
885
885
 
886
+ const initialState$3 = {
887
+ channels: undefined,
888
+ loading: 'idle',
889
+ loadingChannelDeletion: 'idle',
890
+ };
891
+ const fetchChannels = createAsyncThunk('/fetchChannels', (page, { extra }) => __awaiter(void 0, void 0, void 0, function* () {
892
+ const askedPage = page !== null && page !== void 0 ? page : 1;
893
+ const jApi = extra.jApi;
894
+ return yield new Promise((resolve, reject) => {
895
+ const config = {
896
+ type: 'tvDisplayChannel',
897
+ format: 'raw-list',
898
+ page: askedPage,
899
+ };
900
+ jApi.article
901
+ .list(config)
902
+ .then((channelsResp) => {
903
+ resolve(channelsResp.result);
904
+ })
905
+ .catch((ex) => {
906
+ var _a, _b;
907
+ reject({ error: (_a = ex.error) !== null && _a !== void 0 ? _a : 1, errorMsg: (_b = ex.errorMsg) !== null && _b !== void 0 ? _b : 'Error retrieving channels' });
908
+ });
909
+ });
910
+ }));
911
+ const ChannelsListSlice = createSlice({
912
+ name: 'channelsList',
913
+ initialState: Object.assign({}, initialState$3),
914
+ reducers: {},
915
+ extraReducers: (builder) => {
916
+ builder
917
+ .addCase(fetchChannels.pending, (state) => {
918
+ if (state.loading === 'idle') {
919
+ state.loading = 'pending';
920
+ }
921
+ })
922
+ .addCase(fetchChannels.fulfilled, (state, action) => {
923
+ if (state.loading === 'pending') {
924
+ state.loading = 'idle';
925
+ state.channels = action.payload;
926
+ }
927
+ })
928
+ .addCase(fetchChannels.rejected, (state) => {
929
+ if (state.loading === 'pending') {
930
+ state.loading = 'idle';
931
+ }
932
+ });
933
+ },
934
+ });
935
+
936
+ function isChannelConfigured(channel) {
937
+ if (channel.tvChannelType === 'DYNAMIC') {
938
+ return !!channel.tvChannelBackgroundColor && !!channel.tvChannelGroupTarget;
939
+ }
940
+ else {
941
+ return !!channel.tvChannelBackgroundColor && channel.tvChannelNumImages !== 0;
942
+ }
943
+ }
944
+
945
+ const joinedReducers = combineReducers({
946
+ [ChannelsListSlice.name]: ChannelsListSlice.reducer,
947
+ });
948
+ const TVDisplaySlice = {
949
+ name: 'tvDisplay',
950
+ reducer: joinedReducers,
951
+ };
952
+ const selectChannelsList = function selectChannelsList(state) {
953
+ return state.tvDisplay.channelsList;
954
+ };
955
+ const TVDisplay = {
956
+ slice: TVDisplaySlice,
957
+ actions: {
958
+ fetchChannels,
959
+ },
960
+ selectors: {
961
+ selectChannelsList,
962
+ },
963
+ utils: {
964
+ isChannelConfigured,
965
+ },
966
+ };
967
+
886
968
  const initialState$2 = {
887
969
  id: 0,
888
970
  mainType: 'user',
@@ -918,6 +1000,125 @@ const UserCurrent = {
918
1000
  utils: { isAdmin },
919
1001
  };
920
1002
 
1003
+ const widgetArticleAttachmentDefinition = {
1004
+ label: 'WIDGET_Article_Attachment',
1005
+ description: 'WIDGET_Article_Attachment_Description',
1006
+ name: 'widget-article-attachment',
1007
+ img: '/img/fast-intranet/widget-file.png',
1008
+ available: true,
1009
+ panel: {
1010
+ useWrapper: true,
1011
+ useEditor: true,
1012
+ useWidgets: false
1013
+ },
1014
+ };
1015
+ const widgetArticleAttachmentContent = {
1016
+ files: [],
1017
+ };
1018
+
1019
+ const widgetArticleGalleryDefinition = {
1020
+ label: 'WIDGET_Article_Gallery',
1021
+ description: 'WIDGET_Article_Gallery_Description',
1022
+ name: 'widget-article-gallery',
1023
+ img: '/img/fast-intranet/widget-slider.png',
1024
+ available: true,
1025
+ panel: {
1026
+ useWrapper: false,
1027
+ useEditor: true,
1028
+ useWidgets: false
1029
+ },
1030
+ };
1031
+ const widgetArticleGalleryContent = {
1032
+ files: [],
1033
+ gap: '4',
1034
+ columnCount: '3',
1035
+ galleryDisplay: 'landscape',
1036
+ heightMode: 'auto',
1037
+ heightModeValue: '200',
1038
+ };
1039
+
1040
+ const widgetArticleImageDefinition = {
1041
+ label: 'WIDGET_Article_Image',
1042
+ description: 'WIDGET_Article_Image_Description',
1043
+ name: 'widget-article-image',
1044
+ img: '/img/fast-intranet/widget-image.png',
1045
+ available: true,
1046
+ panel: {
1047
+ useWrapper: false,
1048
+ useEditor: true,
1049
+ useWidgets: false
1050
+ },
1051
+ };
1052
+ const widgetArticleImageContent = {
1053
+ displayAs: 'image',
1054
+ backgroundPosition: 'center',
1055
+ backgroundSize: 'cover',
1056
+ borderRadius: '8'
1057
+ };
1058
+
1059
+ const widgetArticleButtonDefinition = {
1060
+ label: 'WIDGET_Button',
1061
+ description: 'WIDGET_Button_Description',
1062
+ name: 'widget-article-button',
1063
+ img: '/img/fast-intranet/widget-button.png',
1064
+ available: true,
1065
+ panel: {
1066
+ useWrapper: false,
1067
+ useEditor: true,
1068
+ useWidgets: false
1069
+ },
1070
+ };
1071
+ const widgetArticleButtonContent = {
1072
+ text: 'This is a button',
1073
+ openingType: 'link',
1074
+ openingTypeLink: {
1075
+ url: '',
1076
+ target: '_blank'
1077
+ },
1078
+ variant: 'contained',
1079
+ fontSize: '14',
1080
+ color: '#fff',
1081
+ backgroundColor: '#4dbf96',
1082
+ buttonSize: 'lg',
1083
+ borderRadius: '4',
1084
+ };
1085
+
1086
+ const widgetArticleTextDefinition = {
1087
+ label: 'WIDGET_Text',
1088
+ description: 'WIDGET_Text_Description',
1089
+ name: 'widget-article-text',
1090
+ img: '/img/fast-intranet/widget-text.png',
1091
+ available: true,
1092
+ panel: {
1093
+ useWrapper: false,
1094
+ useEditor: true,
1095
+ useWidgets: false
1096
+ },
1097
+ };
1098
+ const widgetArticleTextContent = {
1099
+ fontSize: '18',
1100
+ lineHeight: '1.6',
1101
+ text: ''
1102
+ };
1103
+
1104
+ const widgetArticleTitleDefinition = {
1105
+ label: 'WIDGET_Title',
1106
+ description: 'WIDGET_Title_Description',
1107
+ name: 'widget-article-title',
1108
+ img: '/img/fast-intranet/widget-text.png',
1109
+ available: true,
1110
+ panel: {
1111
+ useWrapper: false,
1112
+ useEditor: true,
1113
+ useWidgets: false
1114
+ },
1115
+ };
1116
+ const widgetArticleTitleContent = {
1117
+ text: '',
1118
+ heading: 'h1',
1119
+ backgroundColor: 'transparent'
1120
+ };
1121
+
921
1122
  function uniqid() {
922
1123
  let id = '';
923
1124
  for (let index = 0; index < 16; index++) {
@@ -926,6 +1127,37 @@ function uniqid() {
926
1127
  return id;
927
1128
  }
928
1129
 
1130
+ function widgetFactory(name) {
1131
+ return {
1132
+ title: '',
1133
+ widget: widget(name),
1134
+ };
1135
+ }
1136
+ function widget(name) {
1137
+ return {
1138
+ uniqid: uniqid(),
1139
+ name,
1140
+ content: content(name)
1141
+ };
1142
+ }
1143
+ function content(name) {
1144
+ switch (name) {
1145
+ default:
1146
+ case 'widget-article-attachment':
1147
+ return Object.assign({}, widgetArticleAttachmentContent);
1148
+ case 'widget-article-gallery':
1149
+ return Object.assign({}, widgetArticleGalleryContent);
1150
+ case 'widget-article-button':
1151
+ return Object.assign({}, widgetArticleButtonContent);
1152
+ case 'widget-article-title':
1153
+ return Object.assign({}, widgetArticleTitleContent);
1154
+ case 'widget-article-image':
1155
+ return Object.assign({}, widgetArticleImageContent);
1156
+ case 'widget-article-text':
1157
+ return Object.assign({}, widgetArticleTextContent);
1158
+ }
1159
+ }
1160
+
929
1161
  const WIDGET_ARTICLE_TITLE = 'widget-article-title';
930
1162
  const WIDGET_ARTICLE_TEXT = 'widget-article-text';
931
1163
  const WIDGET_ARTICLE_IMAGE = 'widget-article-image';
@@ -943,155 +1175,22 @@ var WIDGETS = /*#__PURE__*/Object.freeze({
943
1175
  WIDGET_ARTICLE_ATTACHMENT: WIDGET_ARTICLE_ATTACHMENT
944
1176
  });
945
1177
 
946
- function widgetFactory(name, widgetWrapperExtraParams) {
947
- const widgetWrapper = {
948
- title: '',
949
- widget: {
950
- name,
951
- uniqid: uniqid(),
952
- content: {}
953
- },
954
- position: { x: 0, y: 0 }
955
- };
956
- switch (name) {
957
- default:
958
- case WIDGET_ARTICLE_ATTACHMENT:
959
- return Object.assign(Object.assign(Object.assign({}, widgetWrapper), widgetWrapperExtraParams), { widget: Object.assign(Object.assign({}, widgetWrapper.widget), { content: {
960
- files: []
961
- } }) });
962
- case WIDGET_ARTICLE_GALLERY:
963
- return Object.assign(Object.assign(Object.assign({}, widgetWrapper), widgetWrapperExtraParams), { widget: Object.assign(Object.assign({}, widgetWrapper.widget), { content: {
964
- widgets: [],
965
- gap: '4',
966
- horizontalNumber: '3',
967
- galleryDisplay: 'landscape'
968
- } }) });
969
- case WIDGET_ARTICLE_IMAGE:
970
- return Object.assign(Object.assign(Object.assign({}, widgetWrapper), widgetWrapperExtraParams), { widget: Object.assign(Object.assign({}, widgetWrapper.widget), { content: {
971
- widgets: [],
972
- displayAs: 'image',
973
- backgroundPosition: 'center',
974
- backgroundSize: 'cover',
975
- borderRadius: 8
976
- } }) });
977
- case WIDGET_ARTICLE_BUTTON:
978
- return Object.assign(Object.assign(Object.assign({}, widgetWrapper), widgetWrapperExtraParams), { widget: Object.assign(Object.assign({}, widgetWrapper.widget), { content: {
979
- text: 'This is a button',
980
- variant: 'contained',
981
- fontSize: '14',
982
- color: '#fff',
983
- backgroundColor: '#4dbf96',
984
- buttonSize: 'lg',
985
- borderRadius: '4'
986
- } }) });
987
- case WIDGET_ARTICLE_TITLE:
988
- return Object.assign(Object.assign(Object.assign({}, widgetWrapper), widgetWrapperExtraParams), { widget: Object.assign(Object.assign({}, widgetWrapper.widget), { content: {
989
- text: 'Ceci est un titre',
990
- heading: 'h1',
991
- backgroundColor: 'transparent'
992
- } }) });
993
- case WIDGET_ARTICLE_TEXT:
994
- return Object.assign(Object.assign(Object.assign({}, widgetWrapper), widgetWrapperExtraParams), { widget: Object.assign(Object.assign({}, widgetWrapper.widget), { content: {
995
- fontSize: '18',
996
- lineHeight: '1.6',
997
- 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.'
998
- } }) });
999
- }
1000
- }
1001
-
1002
1178
  function widgetDefinition(name) {
1003
1179
  switch (name) {
1004
1180
  default:
1005
- return {
1006
- label: 'WIDGET_Article_Gallery',
1007
- description: 'WIDGET_Article_Gallery_Description',
1008
- name: 'widget-article-image',
1009
- img: '/img/fast-intranet/widget-slider.png',
1010
- available: true,
1011
- panel: {
1012
- useWrapper: false,
1013
- useEditor: true,
1014
- useWidgets: false
1015
- },
1016
- };
1017
- case WIDGET_ARTICLE_GALLERY:
1018
- return {
1019
- label: 'WIDGET_Article_Gallery',
1020
- description: 'WIDGET_Article_Gallery_Description',
1021
- name,
1022
- img: '/img/fast-intranet/widget-slider.png',
1023
- available: true,
1024
- panel: {
1025
- useWrapper: false,
1026
- useEditor: true,
1027
- useWidgets: false
1028
- },
1029
- };
1030
- case WIDGET_ARTICLE_ATTACHMENT:
1031
- return {
1032
- label: 'WIDGET_Article_Attachment',
1033
- description: 'WIDGET_Article_Attachment_Description',
1034
- name,
1035
- img: '/img/fast-intranet/widget-file.png',
1036
- available: true,
1037
- panel: {
1038
- useWrapper: true,
1039
- useEditor: true,
1040
- useWidgets: false
1041
- },
1042
- };
1043
- case WIDGET_ARTICLE_TEXT:
1044
- return {
1045
- label: 'WIDGET_Text',
1046
- description: 'WIDGET_Text_Description',
1047
- name,
1048
- img: '/img/fast-intranet/widget-text.png',
1049
- available: true,
1050
- panel: {
1051
- useWrapper: false,
1052
- useEditor: true,
1053
- useWidgets: false
1054
- },
1055
- };
1056
- case WIDGET_ARTICLE_TITLE:
1057
- return {
1058
- label: 'WIDGET_Title',
1059
- description: 'WIDGET_Title_Description',
1060
- name,
1061
- img: '/img/fast-intranet/widget-text.png',
1062
- available: true,
1063
- panel: {
1064
- useWrapper: false,
1065
- useEditor: true,
1066
- useWidgets: false
1067
- },
1068
- };
1069
- case WIDGET_ARTICLE_IMAGE:
1070
- return {
1071
- label: 'WIDGET_Article_Image',
1072
- description: 'WIDGET_Article_Image_Description',
1073
- name,
1074
- img: '/img/fast-intranet/widget-image.png',
1075
- available: true,
1076
- panel: {
1077
- useWrapper: false,
1078
- useEditor: true,
1079
- useWidgets: false
1080
- },
1081
- };
1082
- case WIDGET_ARTICLE_BUTTON:
1083
- return {
1084
- label: 'WIDGET_Button',
1085
- description: 'WIDGET_Button_Description',
1086
- name,
1087
- img: '/img/fast-intranet/widget-button.png',
1088
- available: true,
1089
- panel: {
1090
- useWrapper: false,
1091
- useEditor: true,
1092
- useWidgets: false
1093
- },
1094
- };
1181
+ return widgetArticleGalleryDefinition;
1182
+ case 'widget-article-gallery':
1183
+ return widgetArticleGalleryDefinition;
1184
+ case 'widget-article-attachment':
1185
+ return widgetArticleAttachmentDefinition;
1186
+ case 'widget-article-text':
1187
+ return widgetArticleTextDefinition;
1188
+ case 'widget-article-title':
1189
+ return widgetArticleTitleDefinition;
1190
+ case 'widget-article-image':
1191
+ return widgetArticleImageDefinition;
1192
+ case 'widget-article-button':
1193
+ return widgetArticleButtonDefinition;
1095
1194
  }
1096
1195
  }
1097
1196
 
@@ -1100,8 +1199,12 @@ const MODE_VIEW = 'view';
1100
1199
  const initialState$1 = {
1101
1200
  token: undefined,
1102
1201
  ids: {},
1202
+ layers: {},
1103
1203
  states: {},
1104
1204
  modal: undefined,
1205
+ editableMap: {},
1206
+ currentEditableIndex: -1,
1207
+ currentEditableWidgetId: undefined,
1105
1208
  };
1106
1209
  const widgetsSlice = createSlice({
1107
1210
  name: 'widgets',
@@ -1110,14 +1213,15 @@ const widgetsSlice = createSlice({
1110
1213
  registerWidget: (state, action) => {
1111
1214
  const { uniqid, widget } = action.payload;
1112
1215
  state.ids[uniqid] = widget;
1113
- state.states[uniqid] = { busy: false, initialized: false, loading: false, mounted: false };
1216
+ state.states[uniqid] = { busy: false, initialized: false, loading: false, mounted: false, hover: false };
1114
1217
  },
1115
1218
  updateWidget: (state, action) => {
1116
- var _a;
1117
- const { uniqid, content } = action.payload;
1219
+ const { uniqid } = action.payload;
1118
1220
  const wrapper = Object.assign({}, state.ids[uniqid]);
1119
- if (wrapper !== undefined && wrapper.widget !== undefined) {
1120
- 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 }) });
1221
+ if (state.ids[uniqid] && wrapper && wrapper.widget) {
1222
+ state.ids[uniqid] = Object.assign(Object.assign(Object.assign({}, state.ids[uniqid]), { widget: Object.assign(Object.assign({}, wrapper.widget), { content: action.payload.override
1223
+ ? action.payload.content
1224
+ : Object.assign(Object.assign(Object.assign({}, wrapper.widget.content), action.payload.content)) }) }));
1121
1225
  }
1122
1226
  },
1123
1227
  flushWidget: (state, action) => {
@@ -1125,34 +1229,90 @@ const widgetsSlice = createSlice({
1125
1229
  delete state.ids[uniqid];
1126
1230
  delete state.states[uniqid];
1127
1231
  },
1232
+ flushAllWidget: (state) => {
1233
+ state.ids = {};
1234
+ state.states = {};
1235
+ },
1128
1236
  updateWidgetWrapper: (state, action) => {
1129
- const { uniqid, title, position } = action.payload;
1130
- const wrapper = Object.assign({}, state.ids[uniqid]);
1131
- if (wrapper !== undefined && wrapper.widget !== undefined) {
1132
- if (position) {
1133
- state.ids[uniqid] = Object.assign(Object.assign({}, wrapper), { title, position, widget: wrapper.widget });
1237
+ const { uniqid } = action.payload;
1238
+ if (state.ids && state.ids[uniqid]) {
1239
+ state.ids[uniqid] = Object.assign(Object.assign(Object.assign({}, state.ids[uniqid]), action.payload));
1240
+ }
1241
+ },
1242
+ registerLayer: (state, action) => {
1243
+ const layerId = uniqid();
1244
+ const wrapper = Object.assign({}, state.ids[action.payload.uniqid]);
1245
+ if (wrapper && wrapper.widget) {
1246
+ if (state.ids[action.payload.uniqid] && wrapper.widget.layers) {
1247
+ 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] }) }));
1134
1248
  }
1135
1249
  else {
1136
- state.ids[uniqid] = Object.assign(Object.assign({}, wrapper), { title, widget: wrapper.widget });
1250
+ 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] }) }));
1137
1251
  }
1252
+ state.ids[action.payload.widget.widget.uniqid] = action.payload.widget;
1253
+ state.states[action.payload.widget.widget.uniqid] = {
1254
+ busy: false,
1255
+ initialized: false,
1256
+ loading: false,
1257
+ mounted: false,
1258
+ hover: false,
1259
+ };
1260
+ state.layers[layerId] = {
1261
+ uniqid: layerId,
1262
+ widgets: [action.payload.widget],
1263
+ title: `Layer ${layerId}`,
1264
+ visible: true,
1265
+ locked: false,
1266
+ position: { x: 0, y: 0 },
1267
+ };
1268
+ }
1269
+ },
1270
+ updateLayer: (state, action) => {
1271
+ if (state.layers[action.payload.uniqid]) {
1272
+ state.layers[action.payload.uniqid] = Object.assign(Object.assign(Object.assign({}, state.layers[action.payload.uniqid]), action.payload.props));
1273
+ }
1274
+ },
1275
+ flushLayer: (state, action) => {
1276
+ const wrapper = Object.assign({}, state.ids[action.payload.uniqid]);
1277
+ if (wrapper && wrapper.widget && wrapper.widget.layers) {
1278
+ state.ids[action.payload.uniqid] = Object.assign(Object.assign(Object.assign({}, state.ids[action.payload.uniqid]), { widget: Object.assign(Object.assign({}, wrapper.widget), { layers: [
1279
+ ...wrapper.widget.layers.filter((layerId) => layerId !== action.payload.layerId),
1280
+ ] }) }));
1281
+ delete state.layers[action.payload.layerId];
1138
1282
  }
1139
1283
  },
1284
+ prevEditableIndex: (state) => {
1285
+ const count = Object.keys(state.ids).length;
1286
+ state.currentEditableIndex = state.currentEditableIndex === 0 ? count - 1 : state.currentEditableIndex - 1;
1287
+ },
1288
+ nextEditableIndex: (state) => {
1289
+ const count = Object.keys(state.ids).length;
1290
+ state.currentEditableIndex = state.currentEditableIndex < count - 1 ? state.currentEditableIndex + 1 : 0;
1291
+ },
1292
+ setEditableIndex: (state, action) => {
1293
+ state.currentEditableIndex = action.payload.index;
1294
+ },
1295
+ setEditableWidgetId: (state, action) => {
1296
+ state.currentEditableWidgetId = action.payload.uniqid;
1297
+ },
1298
+ registerEditableWidget: (state, action) => {
1299
+ state.editableMap[action.payload.uniqid] = action.payload;
1300
+ },
1140
1301
  setToken: (state, action) => {
1141
1302
  state.token = action.payload.token;
1142
1303
  },
1143
- setState: (state, action) => {
1304
+ setWidgetState: (state, action) => {
1144
1305
  const { uniqid } = action.payload;
1145
1306
  const widgetState = Object.assign({}, state.states[uniqid]);
1146
1307
  if (widgetState !== undefined) {
1147
1308
  state.states[uniqid] = Object.assign(Object.assign({}, state.states[uniqid]), action.payload);
1148
1309
  }
1149
1310
  },
1150
- setAllStates: (state, action) => {
1151
- const { busy, initialized, loading, mounted } = action.payload;
1311
+ setAllWidgetStates: (state, action) => {
1152
1312
  Object.keys(state.states).map((key) => {
1153
1313
  const widgetState = Object.assign({}, state.states[key]);
1154
1314
  if (widgetState !== undefined) {
1155
- 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 });
1315
+ state.states[key] = Object.assign(Object.assign({}, state.states[key]), action.payload);
1156
1316
  }
1157
1317
  });
1158
1318
  },
@@ -1167,7 +1327,7 @@ const widgetsSlice = createSlice({
1167
1327
  const selectToken = (state) => state.widgets.token;
1168
1328
  const selectModal = (state) => state.widgets.modal;
1169
1329
  const selectWidgets = (state) => state.widgets.ids;
1170
- 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; };
1330
+ const selectWidgetContent = (state, uniqid) => { var _a; return (_a = state.widgets.ids[uniqid]) === null || _a === void 0 ? void 0 : _a.widget.content; };
1171
1331
  const selectWidgetState = (state, uniqid) => { var _a; return (_a = state.widgets.states[uniqid]) !== null && _a !== void 0 ? _a : undefined; };
1172
1332
  const selectWidget = (state, uniqid) => { var _a; return (_a = state.widgets.ids[uniqid]) !== null && _a !== void 0 ? _a : undefined; };
1173
1333
  const Widget = {
@@ -1175,7 +1335,7 @@ const Widget = {
1175
1335
  factory: widgetFactory,
1176
1336
  definition: widgetDefinition,
1177
1337
  utils: {
1178
- uniqid
1338
+ uniqid,
1179
1339
  },
1180
1340
  slice: widgetsSlice,
1181
1341
  selectors: {
@@ -1185,7 +1345,7 @@ const Widget = {
1185
1345
  selectWidgetState,
1186
1346
  selectWidgetContent,
1187
1347
  selectModal,
1188
- }
1348
+ },
1189
1349
  };
1190
1350
 
1191
1351
  const initialState = {
@@ -1224,18 +1384,13 @@ const editorsSlice = createSlice({
1224
1384
  }),
1225
1385
  ];
1226
1386
  },
1227
- updateEditor: (state, action) => {
1228
- const { uniqid, content } = action.payload;
1229
- state.editors = [
1230
- ...state.editors.map((ed) => {
1231
- return ed.uniqid === uniqid ? Object.assign(Object.assign({}, ed), { content }) : ed;
1232
- }),
1233
- ];
1234
- },
1235
1387
  flushEditor: (state, action) => {
1236
1388
  const { uniqid } = action.payload;
1237
1389
  state.editors = [...state.editors.filter((ed) => ed.uniqid !== uniqid)];
1238
1390
  },
1391
+ flushAllEditor: (state) => {
1392
+ state.editors.length = 0;
1393
+ },
1239
1394
  },
1240
1395
  });
1241
1396
  const selectEditors = (state) => state.editors.editors;
@@ -1248,5 +1403,5 @@ const WidgetEditor = {
1248
1403
  },
1249
1404
  };
1250
1405
 
1251
- export { Application, AssetReservation, Bookmark, MODE_EDIT, MODE_VIEW, Model, Toast, UserCurrent, Widget, WidgetEditor, actions, jland, slice };
1406
+ export { Application, AssetReservation, Bookmark, MODE_EDIT, MODE_VIEW, Model, TVDisplay, Toast, UserCurrent, Widget, WidgetEditor, actions, jland, slice };
1252
1407
  //# sourceMappingURL=esm.js.map