jamespot-front-business 1.1.11 → 1.1.13

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);
@@ -552,10 +552,6 @@ const fetchJLandMaps = createAsyncThunk('/fetchMaps', ({ jlandUrlBase, retrieveA
552
552
  const mapsPromise = retrieveAllMaps ? jApi.jland.getAllMapsAsAdmin() : jApi.article.list(config);
553
553
  mapsPromise
554
554
  .then((mapsResp) => {
555
- if (mapsResp.error || mapsResp.errorMsg) {
556
- reject({ error: 1, errorMsg: 'Error retrieving maps and liceses' });
557
- return;
558
- }
559
555
  const maps = mapsResp.result.data;
560
556
  const result = maps.map((currentMap) => {
561
557
  const newMap = Object.assign({}, currentMap);
@@ -564,7 +560,10 @@ const fetchJLandMaps = createAsyncThunk('/fetchMaps', ({ jlandUrlBase, retrieveA
564
560
  });
565
561
  resolve(result);
566
562
  })
567
- .catch(() => {
563
+ .catch((err) => {
564
+ if (err.error) {
565
+ reject(err);
566
+ }
568
567
  reject({ error: 1, errorMsg: 'Error retrieving maps' });
569
568
  });
570
569
  });
@@ -572,17 +571,20 @@ const fetchJLandMaps = createAsyncThunk('/fetchMaps', ({ jlandUrlBase, retrieveA
572
571
  const fetchJLandAvailableLicenses = createAsyncThunk('/fetchAvailableLicenses', (_, { extra }) => __awaiter(void 0, void 0, void 0, function* () {
573
572
  const jApi = extra.jApi;
574
573
  return yield new Promise((resolve, reject) => {
575
- jApi.license
576
- .countLicenseNotAssigned('jlandmap')
574
+ jApi.admin.license
575
+ .getLicensesNotAssigned('jlandmap')
577
576
  .then((response) => {
578
- if (response.error) {
579
- reject({ error: 1, errorMsg: response.errorMsg });
580
- return;
581
- }
582
577
  resolve(response.result);
583
578
  })
584
- .catch(() => {
585
- reject({ error: 1, errorMsg: 'Error while retrieving licenses not assigned' });
579
+ .catch((err) => {
580
+ if (err.error) {
581
+ reject(err);
582
+ return;
583
+ }
584
+ reject({
585
+ error: 1,
586
+ errorMsg: 'Error while retrieving licenses not assigned',
587
+ });
586
588
  });
587
589
  });
588
590
  }));
@@ -593,20 +595,20 @@ const unassignLicense = createAsyncThunk('/unassignLicense', ({ map, retrieveAll
593
595
  return false;
594
596
  }
595
597
  return yield new Promise((resolve, reject) => {
596
- jApi.license
597
- .unassignLicense(map.uri)
598
+ jApi.admin.license
599
+ .unAssignLicense(map.uri)
598
600
  .then((response) => {
599
- if (response.error) {
600
- reject({ error: 1, errorMsg: response.errorMsg });
601
- return;
602
- }
603
601
  if (response.result) {
604
602
  dispatch(fetchJLandAvailableLicenses());
605
603
  dispatch(fetchJLandMaps({ jlandUrlBase, retrieveAllMaps }));
606
604
  }
607
605
  resolve(response.result);
608
606
  })
609
- .catch(() => {
607
+ .catch((err) => {
608
+ if (err.error) {
609
+ reject(err);
610
+ return;
611
+ }
610
612
  reject({ error: 1, errorMsg: 'Error unassign license' });
611
613
  });
612
614
  });
@@ -621,16 +623,16 @@ const deleteJlandMap = createAsyncThunk('/deleteLicense', ({ map, retrieveAllMap
621
623
  jApi.article
622
624
  .delete(map.id)
623
625
  .then((response) => {
624
- if (response.error) {
625
- reject({ error: 1, errorMsg: response.errorMsg });
626
- return;
627
- }
628
626
  resolve(response.result);
629
627
  dispatch(fetchJLandMaps({ jlandUrlBase, retrieveAllMaps }));
630
628
  dispatch(fetchJLandAvailableLicenses());
631
629
  })
632
- .catch((error) => {
633
- reject({ error: 1, errorMsg: error.errorMsg + '' });
630
+ .catch((err) => {
631
+ if (err.error) {
632
+ reject(err);
633
+ return;
634
+ }
635
+ reject({ error: 1, errorMsg: err.errorMsg + '' });
634
636
  });
635
637
  });
636
638
  }));
@@ -641,20 +643,20 @@ const assignLicense = createAsyncThunk('/assignLicense', ({ map, retrieveAllMaps
641
643
  }
642
644
  const jApi = extra.jApi;
643
645
  return yield new Promise((resolve, reject) => {
644
- jApi.license
646
+ jApi.admin.license
645
647
  .assignLicense(map.uri)
646
648
  .then((response) => {
647
- if (response.error) {
648
- reject({ error: 1, errorMsg: response.errorMsg });
649
- return;
650
- }
651
649
  if (response.result) {
652
650
  dispatch(fetchJLandAvailableLicenses());
653
651
  dispatch(fetchJLandMaps({ jlandUrlBase, retrieveAllMaps }));
654
652
  }
655
653
  resolve(response.result);
656
654
  })
657
- .catch(() => {
655
+ .catch((err) => {
656
+ if (err.error) {
657
+ reject(err);
658
+ return;
659
+ }
658
660
  reject({ error: 1, errorMsg: 'Error assign license' });
659
661
  });
660
662
  });
@@ -759,7 +761,7 @@ const initialMap = {
759
761
  illustration: '',
760
762
  assignLicense: false,
761
763
  };
762
- const initialState$3 = {
764
+ const initialState$4 = {
763
765
  map: Object.assign({}, initialMap),
764
766
  loading: 'idle',
765
767
  status: undefined,
@@ -803,13 +805,13 @@ const createMap = createAsyncThunk('mapCreate/create', ({ map, jlandUrlBase }, {
803
805
  }));
804
806
  const MapCreateSlice = createSlice({
805
807
  name: 'mapCreate',
806
- initialState: initialState$3,
808
+ initialState: initialState$4,
807
809
  reducers: {
808
810
  setMap: (state, action) => {
809
811
  state.map = action.payload;
810
812
  },
811
813
  resetCreateMapState: () => {
812
- return initialState$3;
814
+ return initialState$4;
813
815
  },
814
816
  },
815
817
  extraReducers: (builder) => {
@@ -839,13 +841,13 @@ const selectJLandAvailableLicenses = function selectJLandAvailableLicenses(state
839
841
  const selectMapCreate = function selectMapCreate(state) {
840
842
  return state.jland.mapCreate;
841
843
  };
842
- const joinedReducers = combineReducers({
844
+ const joinedReducers$1 = combineReducers({
843
845
  [JLandMapListSlice.name]: JLandMapListSlice.reducer,
844
846
  [MapCreateSlice.name]: MapCreateSlice.reducer,
845
847
  });
846
848
  const jlandSlice = {
847
849
  name: 'jland',
848
- reducer: joinedReducers,
850
+ reducer: joinedReducers$1,
849
851
  };
850
852
  const jland = {
851
853
  slice: jlandSlice,
@@ -858,7 +860,7 @@ const jland = {
858
860
  selectors: {
859
861
  selectJLandMaps,
860
862
  selectJLandAvailableLicenses,
861
- selectMapCreate
863
+ selectMapCreate,
862
864
  },
863
865
  utils: { buildUrlToJland },
864
866
  };
@@ -883,6 +885,88 @@ const Model = {
883
885
  selectors,
884
886
  };
885
887
 
888
+ const initialState$3 = {
889
+ channels: undefined,
890
+ loading: 'idle',
891
+ loadingChannelDeletion: 'idle',
892
+ };
893
+ const fetchChannels = createAsyncThunk('/fetchChannels', (page, { extra }) => __awaiter(void 0, void 0, void 0, function* () {
894
+ const askedPage = page !== null && page !== void 0 ? page : 1;
895
+ const jApi = extra.jApi;
896
+ return yield new Promise((resolve, reject) => {
897
+ const config = {
898
+ type: 'tvDisplayChannel',
899
+ format: 'raw-list',
900
+ page: askedPage,
901
+ };
902
+ jApi.article
903
+ .list(config)
904
+ .then((channelsResp) => {
905
+ resolve(channelsResp.result);
906
+ })
907
+ .catch((ex) => {
908
+ var _a, _b;
909
+ reject({ error: (_a = ex.error) !== null && _a !== void 0 ? _a : 1, errorMsg: (_b = ex.errorMsg) !== null && _b !== void 0 ? _b : 'Error retrieving channels' });
910
+ });
911
+ });
912
+ }));
913
+ const ChannelsListSlice = createSlice({
914
+ name: 'channelsList',
915
+ initialState: Object.assign({}, initialState$3),
916
+ reducers: {},
917
+ extraReducers: (builder) => {
918
+ builder
919
+ .addCase(fetchChannels.pending, (state) => {
920
+ if (state.loading === 'idle') {
921
+ state.loading = 'pending';
922
+ }
923
+ })
924
+ .addCase(fetchChannels.fulfilled, (state, action) => {
925
+ if (state.loading === 'pending') {
926
+ state.loading = 'idle';
927
+ state.channels = action.payload;
928
+ }
929
+ })
930
+ .addCase(fetchChannels.rejected, (state) => {
931
+ if (state.loading === 'pending') {
932
+ state.loading = 'idle';
933
+ }
934
+ });
935
+ },
936
+ });
937
+
938
+ function isChannelConfigured(channel) {
939
+ if (channel.tvChannelType === 'DYNAMIC') {
940
+ return !!channel.tvChannelBackgroundColor && !!channel.tvChannelGroupTarget;
941
+ }
942
+ else {
943
+ return !!channel.tvChannelBackgroundColor && channel.tvChannelNumImages !== 0;
944
+ }
945
+ }
946
+
947
+ const joinedReducers = combineReducers({
948
+ [ChannelsListSlice.name]: ChannelsListSlice.reducer,
949
+ });
950
+ const TVDisplaySlice = {
951
+ name: 'tvDisplay',
952
+ reducer: joinedReducers,
953
+ };
954
+ const selectChannelsList = function selectChannelsList(state) {
955
+ return state.tvDisplay.channelsList;
956
+ };
957
+ const TVDisplay = {
958
+ slice: TVDisplaySlice,
959
+ actions: {
960
+ fetchChannels,
961
+ },
962
+ selectors: {
963
+ selectChannelsList,
964
+ },
965
+ utils: {
966
+ isChannelConfigured,
967
+ },
968
+ };
969
+
886
970
  const initialState$2 = {
887
971
  id: 0,
888
972
  mainType: 'user',
@@ -1321,5 +1405,5 @@ const WidgetEditor = {
1321
1405
  },
1322
1406
  };
1323
1407
 
1324
- export { Application, AssetReservation, Bookmark, MODE_EDIT, MODE_VIEW, Model, Toast, UserCurrent, Widget, WidgetEditor, actions, jland, slice };
1408
+ export { Application, AssetReservation, Bookmark, MODE_EDIT, MODE_VIEW, Model, TVDisplay, Toast, UserCurrent, Widget, WidgetEditor, actions, jland, slice };
1325
1409
  //# sourceMappingURL=esm.js.map