jamespot-front-business 1.1.29 → 1.1.30

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
@@ -67,7 +67,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
67
67
  });
68
68
  }
69
69
 
70
- const initialState$f = {
70
+ const initialState$g = {
71
71
  entities: [],
72
72
  loading: 'idle',
73
73
  nbResults: 0,
@@ -78,7 +78,7 @@ const fetchBookableAsset = toolkit.createAsyncThunk('BookableAsset/fetchBookable
78
78
  }));
79
79
  const BookableAssetSlice = toolkit.createSlice({
80
80
  name: 'bookableAsset',
81
- initialState: initialState$f,
81
+ initialState: initialState$g,
82
82
  reducers: {},
83
83
  extraReducers: (builder) => {
84
84
  builder
@@ -99,7 +99,7 @@ const BookableAssetSlice = toolkit.createSlice({
99
99
  const fetchConfiguration = toolkit.createAsyncThunk('AssetReservation/configuration', (_, { extra }) => __awaiter(void 0, void 0, void 0, function* () {
100
100
  return yield extra.jApi.assetReservation.configuration();
101
101
  }));
102
- const initialState$e = {
102
+ const initialState$f = {
103
103
  description: '',
104
104
  right: {
105
105
  manage: false,
@@ -113,7 +113,7 @@ const initialState$e = {
113
113
  };
114
114
  const AssetReservationConfigurationSlice = toolkit.createSlice({
115
115
  name: 'configuration',
116
- initialState: initialState$e,
116
+ initialState: initialState$f,
117
117
  reducers: {},
118
118
  extraReducers: (builder) => {
119
119
  builder
@@ -134,7 +134,7 @@ const initForm = {
134
134
  hourStart: '',
135
135
  hourEnd: '',
136
136
  };
137
- const initialState$d = {
137
+ const initialState$e = {
138
138
  entities: [],
139
139
  loading: 'idle',
140
140
  nbResults: 0,
@@ -146,7 +146,7 @@ const fetchReservation = toolkit.createAsyncThunk('Reservation/fetchReservation'
146
146
  }));
147
147
  const ReservationSlice = toolkit.createSlice({
148
148
  name: 'reservation',
149
- initialState: initialState$d,
149
+ initialState: initialState$e,
150
150
  reducers: {
151
151
  setForm: (state, action) => {
152
152
  state.form = action.payload;
@@ -239,7 +239,7 @@ const Toast = {
239
239
  selectors: selectors$1,
240
240
  };
241
241
 
242
- const initialState$c = {
242
+ const initialState$d = {
243
243
  bookmarks: [],
244
244
  loading: 'idle',
245
245
  status: undefined,
@@ -302,7 +302,7 @@ const deleteBookmark = toolkit.createAsyncThunk('bookmarkList/deleteBookmark', (
302
302
  }));
303
303
  const BookmarkListSlice = toolkit.createSlice({
304
304
  name: 'bookmarkList',
305
- initialState: initialState$c,
305
+ initialState: initialState$d,
306
306
  reducers: {
307
307
  resetAddBookmarkStatus: (state, action) => {
308
308
  if (state.add[action.payload]) {
@@ -465,7 +465,7 @@ const getRTHandlers = function (dispatch) {
465
465
  ];
466
466
  };
467
467
 
468
- const initialState$b = {
468
+ const initialState$c = {
469
469
  bookmark: undefined,
470
470
  status: undefined,
471
471
  loading: 'idle',
@@ -487,7 +487,7 @@ const editBookmark = toolkit.createAsyncThunk('bookmarkEdit/editBookmark', (book
487
487
  }));
488
488
  const BookmarkEditSlice = toolkit.createSlice({
489
489
  name: 'bookmarkEdit',
490
- initialState: initialState$b,
490
+ initialState: initialState$c,
491
491
  reducers: {
492
492
  setEditBookmark: (state, action) => {
493
493
  state.bookmark = Object.assign({}, action.payload);
@@ -540,7 +540,7 @@ const Bookmark = {
540
540
  getRTHandlers: getRTHandlers,
541
541
  };
542
542
 
543
- const initialState$a = {
543
+ const initialState$b = {
544
544
  loading: 'idle',
545
545
  access: { createCategory: false },
546
546
  };
@@ -568,7 +568,7 @@ const fetchFaqConfig = toolkit.createAsyncThunk('faqConfig/fetch', () => __await
568
568
  }));
569
569
  const FaqConfigSlice = toolkit.createSlice({
570
570
  name: 'config',
571
- initialState: initialState$a,
571
+ initialState: initialState$b,
572
572
  reducers: {},
573
573
  extraReducers: (builder) => {
574
574
  builder
@@ -600,7 +600,7 @@ const FaqConfigSlice = toolkit.createSlice({
600
600
  },
601
601
  });
602
602
 
603
- const initialState$9 = {
603
+ const initialState$a = {
604
604
  loading: 'idle',
605
605
  categories: null,
606
606
  };
@@ -612,7 +612,7 @@ const fetchFaqCategories = toolkit.createAsyncThunk('faqCategories/fetch', () =>
612
612
  }));
613
613
  const FaqCategoriesSlice = toolkit.createSlice({
614
614
  name: 'categories',
615
- initialState: initialState$9,
615
+ initialState: initialState$a,
616
616
  reducers: {},
617
617
  extraReducers: (builder) => {
618
618
  builder
@@ -633,13 +633,13 @@ const FaqCategoriesSlice = toolkit.createSlice({
633
633
  },
634
634
  });
635
635
 
636
- const joinedReducers$4 = toolkit.combineReducers({
636
+ const joinedReducers$5 = toolkit.combineReducers({
637
637
  [FaqConfigSlice.name]: FaqConfigSlice.reducer,
638
638
  [FaqCategoriesSlice.name]: FaqCategoriesSlice.reducer,
639
639
  });
640
640
  const FaqSlice = {
641
641
  name: 'faq',
642
- reducer: joinedReducers$4,
642
+ reducer: joinedReducers$5,
643
643
  };
644
644
  const selectFaqConfig = (state) => {
645
645
  return state.faq.config;
@@ -894,7 +894,7 @@ const initialMap = {
894
894
  illustration: '',
895
895
  assignLicense: false,
896
896
  };
897
- const initialState$8 = {
897
+ const initialState$9 = {
898
898
  map: Object.assign({}, initialMap),
899
899
  loading: 'idle',
900
900
  status: undefined,
@@ -938,13 +938,13 @@ const createMap = toolkit.createAsyncThunk('mapCreate/create', ({ map, jlandUrlB
938
938
  }));
939
939
  const MapCreateSlice = toolkit.createSlice({
940
940
  name: 'mapCreate',
941
- initialState: initialState$8,
941
+ initialState: initialState$9,
942
942
  reducers: {
943
943
  setMap: (state, action) => {
944
944
  state.map = action.payload;
945
945
  },
946
946
  resetCreateMapState: () => {
947
- return initialState$8;
947
+ return initialState$9;
948
948
  },
949
949
  },
950
950
  extraReducers: (builder) => {
@@ -974,13 +974,13 @@ const selectJLandAvailableLicenses = function selectJLandAvailableLicenses(state
974
974
  const selectMapCreate = function selectMapCreate(state) {
975
975
  return state.jland.mapCreate;
976
976
  };
977
- const joinedReducers$3 = toolkit.combineReducers({
977
+ const joinedReducers$4 = toolkit.combineReducers({
978
978
  [JLandMapListSlice.name]: JLandMapListSlice.reducer,
979
979
  [MapCreateSlice.name]: MapCreateSlice.reducer,
980
980
  });
981
981
  const jlandSlice = {
982
982
  name: 'jland',
983
- reducer: joinedReducers$3,
983
+ reducer: joinedReducers$4,
984
984
  };
985
985
  const jland = {
986
986
  slice: jlandSlice,
@@ -1031,10 +1031,10 @@ const Model = {
1031
1031
  selectors: Object.assign(Object.assign({}, selectors), { selectByIds }),
1032
1032
  };
1033
1033
 
1034
- const initialState$7 = {};
1034
+ const initialState$8 = {};
1035
1035
  const NetworkStaticsSlice = toolkit.createSlice({
1036
1036
  name: 'statics',
1037
- initialState: initialState$7,
1037
+ initialState: initialState$8,
1038
1038
  reducers: {
1039
1039
  initNetworkStatics: (_, { payload }) => {
1040
1040
  return payload;
@@ -1042,12 +1042,12 @@ const NetworkStaticsSlice = toolkit.createSlice({
1042
1042
  },
1043
1043
  });
1044
1044
 
1045
- const joinedReducers$2 = toolkit.combineReducers({
1045
+ const joinedReducers$3 = toolkit.combineReducers({
1046
1046
  [NetworkStaticsSlice.name]: NetworkStaticsSlice.reducer,
1047
1047
  });
1048
1048
  const NetworkSlice = {
1049
1049
  name: 'network',
1050
- reducer: joinedReducers$2,
1050
+ reducer: joinedReducers$3,
1051
1051
  };
1052
1052
  const selectNetworkStatics = (state) => {
1053
1053
  return state.network.statics;
@@ -1090,7 +1090,7 @@ const fetchRecentFiles = toolkit.createAsyncThunk('/fetchRecentFiles', (_, { ext
1090
1090
  return yield jApi.wedoc.getFiles(Object.assign(Object.assign({}, initialQuery), { filters, limit: 4 }));
1091
1091
  }));
1092
1092
 
1093
- const initialState$6 = {
1093
+ const initialState$7 = {
1094
1094
  entities: [],
1095
1095
  nbEntities: 0,
1096
1096
  entitiesRecent: [],
@@ -1102,7 +1102,7 @@ const initialState$6 = {
1102
1102
  };
1103
1103
  const WedocAppSlice = toolkit.createSlice({
1104
1104
  name: 'wedoc',
1105
- initialState: initialState$6,
1105
+ initialState: initialState$7,
1106
1106
  reducers: {
1107
1107
  update: (state, action) => {
1108
1108
  state.entities = [
@@ -1175,14 +1175,14 @@ const fetchRequest = toolkit.createAsyncThunk('/fetchRequest', ({ uri, idUser },
1175
1175
  return yield jApi.wedoc.getAccessRequest(uri, idUser);
1176
1176
  }));
1177
1177
 
1178
- const initialState$5 = {
1178
+ const initialState$6 = {
1179
1179
  entities: [],
1180
1180
  nbEntities: 0,
1181
1181
  loading: 'idle',
1182
1182
  };
1183
1183
  const ShareSlice = toolkit.createSlice({
1184
1184
  name: 'share',
1185
- initialState: initialState$5,
1185
+ initialState: initialState$6,
1186
1186
  reducers: {
1187
1187
  remove: (state, action) => {
1188
1188
  state.entities = [
@@ -1220,7 +1220,7 @@ const Share = {
1220
1220
  },
1221
1221
  };
1222
1222
 
1223
- const initialState$4 = {
1223
+ const initialState$5 = {
1224
1224
  channels: undefined,
1225
1225
  loading: 'idle',
1226
1226
  loadingChannelDeletion: 'idle',
@@ -1263,7 +1263,7 @@ const deleteChannel = toolkit.createAsyncThunk('/deleteChannel', ({ channel }, {
1263
1263
  }));
1264
1264
  const ChannelsListSlice = toolkit.createSlice({
1265
1265
  name: 'channelsList',
1266
- initialState: Object.assign({}, initialState$4),
1266
+ initialState: Object.assign({}, initialState$5),
1267
1267
  reducers: {},
1268
1268
  extraReducers: (builder) => {
1269
1269
  builder
@@ -1308,12 +1308,12 @@ function isChannelConfigured(channel) {
1308
1308
  }
1309
1309
  }
1310
1310
 
1311
- const joinedReducers$1 = toolkit.combineReducers({
1311
+ const joinedReducers$2 = toolkit.combineReducers({
1312
1312
  [ChannelsListSlice.name]: ChannelsListSlice.reducer,
1313
1313
  });
1314
1314
  const TVDisplaySlice = {
1315
1315
  name: 'tvDisplay',
1316
- reducer: joinedReducers$1,
1316
+ reducer: joinedReducers$2,
1317
1317
  };
1318
1318
  const selectChannelsList = function selectChannelsList(state) {
1319
1319
  return state.tvDisplay.channelsList;
@@ -1332,10 +1332,10 @@ const TVDisplay = {
1332
1332
  },
1333
1333
  };
1334
1334
 
1335
- const initialState$3 = {};
1335
+ const initialState$4 = {};
1336
1336
  const TinyMCEOptionsSlice = toolkit.createSlice({
1337
1337
  name: 'options',
1338
- initialState: initialState$3,
1338
+ initialState: initialState$4,
1339
1339
  reducers: {
1340
1340
  initOptions: (_, { payload }) => {
1341
1341
  return { common: payload };
@@ -1343,12 +1343,12 @@ const TinyMCEOptionsSlice = toolkit.createSlice({
1343
1343
  },
1344
1344
  });
1345
1345
 
1346
- const joinedReducers = toolkit.combineReducers({
1346
+ const joinedReducers$1 = toolkit.combineReducers({
1347
1347
  [TinyMCEOptionsSlice.name]: TinyMCEOptionsSlice.reducer,
1348
1348
  });
1349
1349
  const TinyMCESlice = {
1350
1350
  name: 'tinymce',
1351
- reducer: joinedReducers,
1351
+ reducer: joinedReducers$1,
1352
1352
  };
1353
1353
  const selectTinyMCECommonOptions = (state) => {
1354
1354
  return state.tinymce.options.common;
@@ -1361,7 +1361,7 @@ const TinyMCE = {
1361
1361
  },
1362
1362
  };
1363
1363
 
1364
- const initialState$2 = {
1364
+ const initialState$3 = {
1365
1365
  id: 0,
1366
1366
  mainType: 'user',
1367
1367
  type: 'user',
@@ -1375,7 +1375,7 @@ const initialState$2 = {
1375
1375
  };
1376
1376
  const slice = toolkit.createSlice({
1377
1377
  name: 'userCurrent',
1378
- initialState: initialState$2,
1378
+ initialState: initialState$3,
1379
1379
  reducers: {
1380
1380
  init: (_, { payload }) => {
1381
1381
  return payload;
@@ -1593,7 +1593,7 @@ function widgetDefinition(name) {
1593
1593
 
1594
1594
  const MODE_EDIT = 'edit';
1595
1595
  const MODE_VIEW = 'view';
1596
- const initialState$1 = {
1596
+ const initialState$2 = {
1597
1597
  token: undefined,
1598
1598
  ids: {},
1599
1599
  layers: {},
@@ -1605,7 +1605,7 @@ const initialState$1 = {
1605
1605
  };
1606
1606
  const widgetsSlice = toolkit.createSlice({
1607
1607
  name: 'widgets',
1608
- initialState: initialState$1,
1608
+ initialState: initialState$2,
1609
1609
  reducers: {
1610
1610
  registerWidget: (state, action) => {
1611
1611
  const { uniqid, widget } = action.payload;
@@ -1747,12 +1747,12 @@ const Widget = {
1747
1747
  },
1748
1748
  };
1749
1749
 
1750
- const initialState = {
1750
+ const initialState$1 = {
1751
1751
  editors: [],
1752
1752
  };
1753
1753
  const editorsSlice = toolkit.createSlice({
1754
1754
  name: 'editors',
1755
- initialState,
1755
+ initialState: initialState$1,
1756
1756
  reducers: {
1757
1757
  registerEditor: (state, action) => {
1758
1758
  const { uniqid, name } = action.payload;
@@ -1802,6 +1802,269 @@ const WidgetEditor = {
1802
1802
  },
1803
1803
  };
1804
1804
 
1805
+ const AUDIENCE = {
1806
+ ALL: '1',
1807
+ CUSTOM: '0',
1808
+ };
1809
+ exports.StatusType = void 0;
1810
+ (function (StatusType) {
1811
+ StatusType["draft"] = "draft";
1812
+ StatusType["installed"] = "installed";
1813
+ StatusType["suspended"] = "suspended";
1814
+ })(exports.StatusType || (exports.StatusType = {}));
1815
+ const APP_STATUS_TYPE = {
1816
+ DRAFT: exports.StatusType.draft,
1817
+ INSTALLED: exports.StatusType.installed,
1818
+ SUSPENDED: exports.StatusType.suspended,
1819
+ };
1820
+ exports.AppFormItemType = void 0;
1821
+ (function (AppFormItemType) {
1822
+ AppFormItemType["TITLE"] = "TITLE";
1823
+ AppFormItemType["IMAGE"] = "IMAGE";
1824
+ AppFormItemType["DESCRIPTION"] = "DESCRIPTION";
1825
+ AppFormItemType["IDUSER"] = "IDUSER";
1826
+ AppFormItemType["PUBLISHTO"] = "PUBLISHTO";
1827
+ AppFormItemType["SENDALERTTOSUBSCRIBERS"] = "SENDALERTTOSUBSCRIBERS";
1828
+ AppFormItemType["RECEIVEACOPY"] = "RECEIVEACOPY";
1829
+ AppFormItemType["TEXT"] = "TEXT";
1830
+ AppFormItemType["TEXTAREA"] = "TEXTAREA";
1831
+ AppFormItemType["TEXTAREAHTML"] = "TEXTAREAHTML";
1832
+ AppFormItemType["DATE"] = "DATE";
1833
+ AppFormItemType["DATETIME"] = "DATETIME";
1834
+ AppFormItemType["RANGE"] = "RANGE";
1835
+ AppFormItemType["NUMBER"] = "NUMBER";
1836
+ AppFormItemType["URL"] = "URL";
1837
+ AppFormItemType["EMAIL"] = "EMAIL";
1838
+ AppFormItemType["SELECT"] = "SELECT";
1839
+ AppFormItemType["CHECKBOX"] = "CHECKBOX";
1840
+ AppFormItemType["TOGGLE"] = "TOGGLE";
1841
+ AppFormItemType["RADIO"] = "RADIO";
1842
+ AppFormItemType["TAGS"] = "TAGS";
1843
+ AppFormItemType["ADDFILEATTACHMENT"] = "ADDFILEATTACHMENT";
1844
+ AppFormItemType["AUDIENCE"] = "AUDIENCE";
1845
+ AppFormItemType["CODEHTML"] = "CODEHTML";
1846
+ AppFormItemType["DATECREATION"] = "DATECREATION";
1847
+ AppFormItemType["USERLINK"] = "USERLINK";
1848
+ AppFormItemType["CONTENTLINK"] = "CONTENTLINK";
1849
+ })(exports.AppFormItemType || (exports.AppFormItemType = {}));
1850
+ const AppFormPrimaryList = [exports.AppFormItemType.DESCRIPTION];
1851
+ const AppFormNotFields = [exports.AppFormItemType.AUDIENCE, exports.AppFormItemType.RANGE];
1852
+ const AppFormFixedHeadList = {
1853
+ create: [exports.AppFormItemType.TITLE],
1854
+ popup: [exports.AppFormItemType.TITLE],
1855
+ edit: [exports.AppFormItemType.TITLE],
1856
+ list: [exports.AppFormItemType.TITLE, exports.AppFormItemType.IDUSER],
1857
+ filter: [exports.AppFormItemType.TITLE, exports.AppFormItemType.IDUSER],
1858
+ view: [exports.AppFormItemType.TITLE],
1859
+ };
1860
+ const AppFormFixedFootList4View = {
1861
+ create: [exports.AppFormItemType.PUBLISHTO, exports.AppFormItemType.SENDALERTTOSUBSCRIBERS, exports.AppFormItemType.RECEIVEACOPY],
1862
+ popup: [exports.AppFormItemType.PUBLISHTO],
1863
+ edit: [exports.AppFormItemType.PUBLISHTO],
1864
+ list: [exports.AppFormItemType.DATECREATION],
1865
+ filter: [exports.AppFormItemType.DATECREATION],
1866
+ view: [],
1867
+ };
1868
+ const AppFormFixedList = [
1869
+ exports.AppFormItemType.TITLE,
1870
+ exports.AppFormItemType.PUBLISHTO,
1871
+ exports.AppFormItemType.SENDALERTTOSUBSCRIBERS,
1872
+ exports.AppFormItemType.RECEIVEACOPY,
1873
+ exports.AppFormItemType.IDUSER,
1874
+ exports.AppFormItemType.DATECREATION,
1875
+ ];
1876
+ const AppFormUniqueList = [exports.AppFormItemType.DESCRIPTION, exports.AppFormItemType.IMAGE];
1877
+ const AppFormBannedFromViews = new Map();
1878
+ AppFormBannedFromViews.set(exports.AppFormItemType.IMAGE, ['list', 'filter', 'view']);
1879
+ const AppListFilter = [
1880
+ exports.AppFormItemType.TITLE,
1881
+ exports.AppFormItemType.DESCRIPTION,
1882
+ exports.AppFormItemType.TEXT,
1883
+ exports.AppFormItemType.TEXTAREA,
1884
+ exports.AppFormItemType.TEXTAREAHTML,
1885
+ exports.AppFormItemType.DATE,
1886
+ exports.AppFormItemType.DATETIME,
1887
+ exports.AppFormItemType.RANGE,
1888
+ exports.AppFormItemType.NUMBER,
1889
+ exports.AppFormItemType.URL,
1890
+ exports.AppFormItemType.EMAIL,
1891
+ exports.AppFormItemType.SELECT,
1892
+ exports.AppFormItemType.TOGGLE,
1893
+ exports.AppFormItemType.CHECKBOX,
1894
+ exports.AppFormItemType.RADIO,
1895
+ exports.AppFormItemType.TAGS,
1896
+ exports.AppFormItemType.PUBLISHTO,
1897
+ exports.AppFormItemType.SENDALERTTOSUBSCRIBERS,
1898
+ exports.AppFormItemType.RECEIVEACOPY,
1899
+ exports.AppFormItemType.ADDFILEATTACHMENT,
1900
+ exports.AppFormItemType.CODEHTML,
1901
+ exports.AppFormItemType.IDUSER,
1902
+ exports.AppFormItemType.DATECREATION,
1903
+ exports.AppFormItemType.USERLINK,
1904
+ exports.AppFormItemType.CONTENTLINK,
1905
+ ];
1906
+ const AppFormNoFixedValueList = {
1907
+ create: [exports.AppFormItemType.IMAGE, exports.AppFormItemType.ADDFILEATTACHMENT, exports.AppFormItemType.CODEHTML],
1908
+ popup: [exports.AppFormItemType.IMAGE, exports.AppFormItemType.ADDFILEATTACHMENT, exports.AppFormItemType.CODEHTML],
1909
+ edit: [exports.AppFormItemType.IMAGE, exports.AppFormItemType.ADDFILEATTACHMENT, exports.AppFormItemType.CODEHTML],
1910
+ list: AppListFilter,
1911
+ filter: AppListFilter,
1912
+ view: AppListFilter,
1913
+ };
1914
+ const AppFormNoAsFieldList = AppFormFixedList.concat(AppFormNotFields)
1915
+ .concat(exports.AppFormItemType.IDUSER)
1916
+ .concat(exports.AppFormItemType.TITLE);
1917
+ const AppFormFieldOnlyInView = [exports.AppFormItemType.CODEHTML];
1918
+ const AppFormNonPrimaryList = AppFormNoAsFieldList.concat(AppFormFieldOnlyInView).concat(AppFormPrimaryList);
1919
+ const STUDIO_VIEW = {
1920
+ SOLR: '1',
1921
+ NOT_SOLR: '0',
1922
+ };
1923
+
1924
+ function InstalledAppStudioAdapter(serverApp, serverApps) {
1925
+ const { version, dateCreation } = serverApp.manifest;
1926
+ const appTypeServer = serverApp.typeModel;
1927
+ const studioApp = {
1928
+ idApp: serverApp.idApp,
1929
+ status: _formatStatus(serverApp),
1930
+ manifest: {
1931
+ appShortName: serverApp.name,
1932
+ appName: serverApp.label,
1933
+ description: serverApp.description,
1934
+ author: serverApp.author,
1935
+ cssColor: appTypeServer.cssColor,
1936
+ cssClass: { label: appTypeServer.cssClass, value: appTypeServer.cssClass },
1937
+ version: version,
1938
+ dateCreation: dateCreation,
1939
+ checkAccess: serverApp.checkAccess,
1940
+ attrExposed: serverApp.attrExposed,
1941
+ viewSolr: serverApp.view,
1942
+ typeLabel: appTypeServer.typeLabel,
1943
+ },
1944
+ };
1945
+ const inWorkAppVersion = _findAssociatedDraft(serverApp.idApp, serverApps);
1946
+ if (!inWorkAppVersion)
1947
+ return studioApp;
1948
+ const inWorkApp = DraftAppStudioAdapter(inWorkAppVersion);
1949
+ if (!inWorkApp)
1950
+ return studioApp;
1951
+ studioApp.inWorkVersion = inWorkApp;
1952
+ return studioApp;
1953
+ }
1954
+ function DraftAppStudioAdapter(serverApp) {
1955
+ if (!serverApp.value)
1956
+ return undefined;
1957
+ const parsedJson = JSON.parse(serverApp.value);
1958
+ return {
1959
+ idApp: serverApp.idApp,
1960
+ status: _formatStatus(serverApp),
1961
+ manifest: parsedJson.manifest,
1962
+ };
1963
+ }
1964
+ function _formatStatus(serverApp) {
1965
+ return serverApp.status === jamespot.StudioApplicationStatus.installed
1966
+ ? serverApp.suspended
1967
+ ? exports.StatusType.suspended
1968
+ : exports.StatusType.installed
1969
+ : exports.StatusType.draft;
1970
+ }
1971
+ function _findAssociatedDraft(idApp, serverApps) {
1972
+ const draft = serverApps.find((app) => app.idApp === idApp && app.status === jamespot.StudioApplicationStatus.saved);
1973
+ return draft;
1974
+ }
1975
+ function _findAssociatedInstalled(idApp, serverApps) {
1976
+ return !!serverApps.find((app) => app.idApp === idApp && app.status === jamespot.StudioApplicationStatus.installed);
1977
+ }
1978
+ function serverAppsToStudioApps(serverApps) {
1979
+ const studioApps = serverApps
1980
+ .map((serverApp) => {
1981
+ if (serverApp.status === jamespot.StudioApplicationStatus.installed) {
1982
+ return InstalledAppStudioAdapter(serverApp, serverApps);
1983
+ }
1984
+ else {
1985
+ if (_findAssociatedInstalled(serverApp.idApp, serverApps))
1986
+ return undefined;
1987
+ return DraftAppStudioAdapter(serverApp);
1988
+ }
1989
+ })
1990
+ .filter((app) => app !== undefined);
1991
+ return studioApps;
1992
+ }
1993
+
1994
+ const initialState = {
1995
+ studioAppsList: [],
1996
+ loadingStudioAppsList: 'idle',
1997
+ };
1998
+ const fetchStudioAppsList = toolkit.createAsyncThunk('studio/appsList', (_, { extra }) => __awaiter(void 0, void 0, void 0, function* () {
1999
+ const jApi = extra.jApi;
2000
+ return yield new Promise((resolve, rejectWithValue) => {
2001
+ jApi.application
2002
+ .list()
2003
+ .then((res) => __awaiter(void 0, void 0, void 0, function* () {
2004
+ const coreApps = yield Promise.all(res.result.map((app) => __awaiter(void 0, void 0, void 0, function* () { return (yield jApi.application.get(app.idApp, app.status)).result; })));
2005
+ resolve(coreApps);
2006
+ }))
2007
+ .catch((e) => {
2008
+ var _a, _b;
2009
+ rejectWithValue({ error: (_a = e.error) !== null && _a !== void 0 ? _a : 1, errorMsg: (_b = e.errorMsg) !== null && _b !== void 0 ? _b : 'Error retrieving applications' });
2010
+ });
2011
+ });
2012
+ }));
2013
+ const StudioAppsListSlice = toolkit.createSlice({
2014
+ name: 'studioAppsList',
2015
+ initialState,
2016
+ reducers: {},
2017
+ extraReducers: (builder) => {
2018
+ builder
2019
+ .addCase(fetchStudioAppsList.pending, (state) => {
2020
+ if (state.loadingStudioAppsList === 'idle')
2021
+ state.loadingStudioAppsList = 'pending';
2022
+ })
2023
+ .addCase(fetchStudioAppsList.fulfilled, (state, action) => {
2024
+ if (state.loadingStudioAppsList === 'pending')
2025
+ state.loadingStudioAppsList = 'idle';
2026
+ state.studioAppsList = serverAppsToStudioApps(action.payload);
2027
+ })
2028
+ .addCase(fetchStudioAppsList.rejected, (state) => {
2029
+ if (state.loadingStudioAppsList === 'pending')
2030
+ state.loadingStudioAppsList = 'idle';
2031
+ });
2032
+ },
2033
+ });
2034
+
2035
+ const joinedReducers = redux.combineReducers({
2036
+ [StudioAppsListSlice.name]: StudioAppsListSlice.reducer,
2037
+ });
2038
+ const selectStudioAppsList = function selectStudioAppsList(state) {
2039
+ return state.studio.studioAppsList;
2040
+ };
2041
+ const studioSlice = {
2042
+ name: 'studio',
2043
+ reducer: joinedReducers,
2044
+ };
2045
+ const studio = {
2046
+ slice: studioSlice,
2047
+ actions: {
2048
+ fetchStudioAppsList,
2049
+ },
2050
+ selectors: {
2051
+ selectStudioAppsList,
2052
+ },
2053
+ };
2054
+
2055
+ exports.APP_STATUS_TYPE = APP_STATUS_TYPE;
2056
+ exports.AUDIENCE = AUDIENCE;
2057
+ exports.AppFormBannedFromViews = AppFormBannedFromViews;
2058
+ exports.AppFormFieldOnlyInView = AppFormFieldOnlyInView;
2059
+ exports.AppFormFixedFootList4View = AppFormFixedFootList4View;
2060
+ exports.AppFormFixedHeadList = AppFormFixedHeadList;
2061
+ exports.AppFormFixedList = AppFormFixedList;
2062
+ exports.AppFormNoAsFieldList = AppFormNoAsFieldList;
2063
+ exports.AppFormNoFixedValueList = AppFormNoFixedValueList;
2064
+ exports.AppFormNonPrimaryList = AppFormNonPrimaryList;
2065
+ exports.AppFormNotFields = AppFormNotFields;
2066
+ exports.AppFormPrimaryList = AppFormPrimaryList;
2067
+ exports.AppFormUniqueList = AppFormUniqueList;
1805
2068
  exports.Application = Application;
1806
2069
  exports.AssetReservation = AssetReservation;
1807
2070
  exports.Bookmark = Bookmark;
@@ -1810,6 +2073,7 @@ exports.MODE_EDIT = MODE_EDIT;
1810
2073
  exports.MODE_VIEW = MODE_VIEW;
1811
2074
  exports.Model = Model;
1812
2075
  exports.Network = Network;
2076
+ exports.STUDIO_VIEW = STUDIO_VIEW;
1813
2077
  exports.Share = Share;
1814
2078
  exports.TVDisplay = TVDisplay;
1815
2079
  exports.TinyMCE = TinyMCE;
@@ -1821,4 +2085,5 @@ exports.WidgetEditor = WidgetEditor;
1821
2085
  exports.actions = actions;
1822
2086
  exports.jland = jland;
1823
2087
  exports.slice = slice;
2088
+ exports.studio = studio;
1824
2089
  //# sourceMappingURL=cjs.js.map