@saooti/octopus-sdk 33.0.9 → 33.1.1

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.
Files changed (40) hide show
  1. package/README.md +1 -0
  2. package/package.json +1 -1
  3. package/src/App.vue +4 -3
  4. package/src/api/classicCrud.ts +1 -1
  5. package/src/assets/transition.scss +0 -3
  6. package/src/components/display/comments/AddCommentModal.vue +1 -1
  7. package/src/components/display/comments/CommentInput.vue +1 -1
  8. package/src/components/display/emission/EmissionList.vue +1 -2
  9. package/src/components/display/emission/EmissionPlayerItem.vue +4 -4
  10. package/src/components/display/live/LiveHorizontalList.vue +1 -2
  11. package/src/components/display/organisation/OrganisationChooser.vue +1 -1
  12. package/src/components/display/participant/ParticipantList.vue +1 -2
  13. package/src/components/display/playlist/PlaylistList.vue +1 -2
  14. package/src/components/display/podcasts/PodcastImage.vue +4 -4
  15. package/src/components/display/podcasts/PodcastList.vue +2 -3
  16. package/src/components/display/sharing/QrCode.vue +2 -2
  17. package/src/components/display/sharing/SharePlayer.vue +2 -2
  18. package/src/components/misc/HomeDropdown.vue +2 -2
  19. package/src/components/misc/LeftMenu.vue +2 -4
  20. package/src/components/misc/TopBar.vue +1 -1
  21. package/src/components/misc/modal/ClipboardModal.vue +2 -1
  22. package/src/components/misc/modal/NewsletterModal.vue +2 -2
  23. package/src/components/misc/player/Player.vue +43 -48
  24. package/src/components/misc/player/PlayerCompact.vue +2 -2
  25. package/src/components/mixins/handle403.ts +1 -1
  26. package/src/components/mixins/player/playerComment.ts +1 -1
  27. package/src/components/mixins/player/playerDisplay.ts +2 -2
  28. package/src/components/mixins/player/playerLive.ts +5 -5
  29. package/src/components/mixins/player/playerLogic.ts +27 -24
  30. package/src/components/pages/Lives.vue +1 -1
  31. package/src/store/AppStore.ts +33 -88
  32. package/src/store/PlayerStore.ts +77 -0
  33. package/src/store/class/general/emission.ts +17 -0
  34. package/src/store/class/general/participant.ts +7 -0
  35. package/src/store/class/general/playlist.ts +13 -0
  36. package/src/store/class/general/podcast.ts +30 -1
  37. package/src/store/classStore/typeAppStore.ts +79 -0
  38. package/src/store/classStore/typeAuthStore.ts +44 -0
  39. package/src/store/classStore/typePlayerStore.ts +14 -0
  40. package/src/store/typeAppStore.ts +0 -339
@@ -4,8 +4,9 @@ import { CommentPodcast } from '@/store/class/general/comment';
4
4
  import { cookies } from '../functions';
5
5
  import { playerLive } from './playerLive';
6
6
  import { playerComment } from './playerComment';
7
- import { StoreState } from '@/store/typeAppStore';
8
7
  import { defineComponent } from 'vue';
8
+ import { Player } from '@/store/class/general/player';
9
+ import { StoreState } from '@/store/classStore/typeAppStore';
9
10
  export const playerLogic = defineComponent({
10
11
  mixins:[cookies,playerLive,playerComment],
11
12
  data() {
@@ -27,18 +28,20 @@ export const playerLogic = defineComponent({
27
28
  };
28
29
  },
29
30
  computed: {
30
- ...mapState({
31
- podcast (state: StoreState){ return state.player.podcast},
32
- media: (state: StoreState) => state.player.media,
33
- live: (state: StoreState) => state.player.live,
34
- volume: (state: StoreState) => state.player.volume,
35
- commentsLoaded: (state: StoreState) => state.comments.loadedComments,
36
- percentProgress: (state: StoreState) => {
37
- if(!state.player.elapsed){return 0;}
38
- return state.player.elapsed * 100;
31
+ ...mapState('player',{
32
+ podcast (state: Player){ return state.podcast},
33
+ media: (state: Player) => state.media,
34
+ live: (state: Player) => state.live,
35
+ volume: (state: Player) => state.volume,
36
+ percentProgress: (state: Player) => {
37
+ if(!state.elapsed){return 0;}
38
+ return state.elapsed * 100;
39
39
  },
40
- playerSeekTime: (state: StoreState) => state.player.seekTime,
40
+ playerSeekTime: (state: Player) => state.seekTime,
41
41
  }),
42
+ commentsLoaded(){
43
+ return this.$store.state.comments.loadedComments;
44
+ },
42
45
  audioUrl(): string {
43
46
  return this.getAudioUrl();
44
47
  },
@@ -98,13 +101,13 @@ export const playerLogic = defineComponent({
98
101
  methods: {
99
102
  async getTranscription(): Promise<void>{
100
103
  if(!this.podcast){
101
- this.$store.commit('playerTranscript',undefined);
104
+ this.$store.commit('player/transcript',undefined);
102
105
  return;
103
106
  }
104
107
  const result = await octopusApi.fetchDataPublic<string>(11 , `response/${this.podcast.podcastId}`);
105
108
  const arrayTranscript = this.parseSrt(result);
106
109
  const actualText = arrayTranscript?.[0]?.startTime === 0 ? arrayTranscript[0].text : "";
107
- this.$store.commit('playerTranscript',{actual: 0,actualText:actualText, value : arrayTranscript});
110
+ this.$store.commit('player/transcript',{actual: 0,actualText:actualText, value : arrayTranscript});
108
111
  },
109
112
  parseSrt(transcript: string){
110
113
  var pattern = /(\d+)\n([\d:,]+)\s+-{2}\>\s+([\d:,]+)\n([\s\S]*?(?=\n{2}|$))/gm;
@@ -144,15 +147,15 @@ export const playerLogic = defineComponent({
144
147
  parameters.push('origin=octopus');
145
148
  parameters.push('listenerId='+this.getListenerId());
146
149
  if (
147
- this.$store.state.authentication &&
148
- this.$store.state.authentication.organisationId
150
+ this.$store.state.auth &&
151
+ this.$store.state.auth.organisationId
149
152
  ) {
150
153
  parameters.push(
151
- 'distributorId=' + this.$store.state.authentication.organisationId
154
+ 'distributorId=' + this.$store.state.auth.organisationId
152
155
  );
153
156
  }
154
- if("SECURED" === this.podcast.organisation.privacy && this.$store.state.authentication.isAuthenticated && this.$store.state.oAuthParam.accessToken){
155
- parameters.push('access_token='+this.$store.state.oAuthParam.accessToken);
157
+ if("SECURED" === this.podcast.organisation.privacy && this.$store.state.auth && this.$store.state.auth.oAuthParam.accessToken){
158
+ parameters.push('access_token='+this.$store.state.auth?.oAuthParam.accessToken);
156
159
  }
157
160
  return this.podcast.podcastId + '.mp3?' + parameters.join('&');
158
161
  },
@@ -170,7 +173,7 @@ export const playerLogic = defineComponent({
170
173
  this.initComments();
171
174
  },
172
175
  stopPlayer(): void {
173
- this.$store.commit('playerPlayPodcast');
176
+ this.$store.commit('player/playPodcast');
174
177
  },
175
178
  getListenerId(): string{
176
179
  let listenerId = this.getCookie("octopus_listenerId");
@@ -228,8 +231,8 @@ export const playerLogic = defineComponent({
228
231
  onTimeUpdatePodcast(streamDuration:number, currentTime:number){
229
232
  this.displayAlertBar = false;
230
233
  this.percentLiveProgress = 100;
231
- this.$store.commit('playerTotalTime', streamDuration);
232
- this.$store.commit('playerElapsed', currentTime / streamDuration);
234
+ this.$store.commit('player/totalTime', streamDuration);
235
+ this.$store.commit('player/elapsed', currentTime / streamDuration);
233
236
  this.onTimeUpdateTranscript(currentTime);
234
237
  },
235
238
  onTimeUpdateLive(streamDuration: number, currentTime:number){
@@ -238,7 +241,7 @@ export const playerLogic = defineComponent({
238
241
  if (scheduledDuration > streamDuration) {
239
242
  this.displayAlertBar = false;
240
243
  this.percentLiveProgress = (streamDuration / scheduledDuration) * 100;
241
- this.$store.commit('playerTotalTime', scheduledDuration);
244
+ this.$store.commit('player/totalTime', scheduledDuration);
242
245
  this.$store.commit(
243
246
  'playerElapsed',
244
247
  currentTime / scheduledDuration
@@ -247,8 +250,8 @@ export const playerLogic = defineComponent({
247
250
  this.percentLiveProgress = 100;
248
251
  this.displayAlertBar = true;
249
252
  this.durationLivePosition = (scheduledDuration / streamDuration) * 100;
250
- this.$store.commit('playerTotalTime', streamDuration);
251
- this.$store.commit('playerElapsed', currentTime / streamDuration);
253
+ this.$store.commit('player/totalTime', streamDuration);
254
+ this.$store.commit('player/elapsed', currentTime / streamDuration);
252
255
  }
253
256
  },
254
257
  onTimeUpdate(event: Event): void {
@@ -72,7 +72,7 @@ export default defineComponent({
72
72
  } else if (this.$store.state.filter.organisationId) {
73
73
  this.$emit('update:organisationId',this.$store.state.filter.organisationId);
74
74
  }
75
- if (!this.$store.state.organisation?.attributes?.['live.active']) {
75
+ if (!this.$store.state.auth?.organisation?.attributes?.['live.active']) {
76
76
  this.live = false;
77
77
  }
78
78
  },
@@ -1,89 +1,18 @@
1
1
  import { createStore } from 'vuex'
2
- import { AppStoreData } from './typeAppStore';
3
-
2
+ import { AppStoreData } from './classStore/typeAppStore';
3
+ import PlayerStore from '@/store/PlayerStore';
4
4
  export default createStore({
5
5
  state: AppStoreData(),
6
-
7
- getters: {},
6
+ modules: {
7
+ player: PlayerStore
8
+ },
8
9
  mutations: {
9
- playerPlayPodcast(state, podcast) {
10
- if (!podcast) {
11
- state.player = {
12
- status: 'STOPPED', //STOPPED, LOADING, PLAYING, PAUSED
13
- podcast: undefined,
14
- media: undefined,
15
- live: undefined,
16
- elapsed: 0,
17
- };
18
- return;
19
- }
20
- if (
21
- (state.player.podcast &&
22
- state.player.podcast.podcastId === podcast.podcastId) ||
23
- (state.player.media &&
24
- state.player.media.mediaId === podcast.mediaId) ||
25
- (state.player.live &&
26
- state.player.live.conferenceId === podcast.conferenceId)
27
- ) {
28
- //Do nothing
29
- return;
30
- }
31
- if (
32
- podcast.conferenceId &&
33
- (!podcast.podcastId || 'READY' !== podcast.processingStatus)
34
- ) {
35
- state.player = {
36
- status: 'LOADING', //STOPPED, LOADING, PLAYING, PAUSED
37
- podcast: undefined,
38
- media: undefined,
39
- live: podcast,
40
- elapsed: 0,
41
- };
42
- } else if (podcast.podcastId) {
43
- state.player = {
44
- status: 'LOADING', //STOPPED, LOADING, PLAYING, PAUSED
45
- podcast: podcast,
46
- media: undefined,
47
- live: undefined,
48
- elapsed: 0,
49
- };
50
- } else if (podcast.mediaId) {
51
- state.player = {
52
- status: 'LOADING', //STOPPED, LOADING, PLAYING, PAUSED
53
- podcast: undefined,
54
- media: podcast,
55
- live: undefined,
56
- elapsed: 0,
57
- };
58
- }
59
- },
60
-
61
- playerPause(state, pause) {
62
- if (pause) {
63
- state.player.status = 'PAUSED';
64
- } else {
65
- state.player.status = 'PLAYING';
66
- }
67
- },
68
-
69
- playerElapsed(state, elapsed) {
70
- state.player.elapsed = elapsed;
71
- },
72
-
73
- playerTotalTime(state, total) {
74
- state.player.total = total;
75
- },
76
-
77
- playerVolume(state, volume) {
78
- state.player.volume = volume;
79
- },
80
- playerSeekTime(state, seekTime) {
81
- state.player.seekTime = seekTime;
10
+ categoriesSet(state, categories) {
11
+ state.categories = categories;
82
12
  },
83
- playerTranscript(state, transcript) {
84
- state.player.transcript = transcript;
13
+ categoriesOrgaSet(state, categories) {
14
+ state.categoriesOrga = categories;
85
15
  },
86
-
87
16
  filterOrga(state, filter) {
88
17
  state.filter.organisationId = filter.orgaId;
89
18
  if (filter.imgUrl || !filter.orgaId) {
@@ -95,7 +24,7 @@ export default createStore({
95
24
  if(filter.rubriquageArray){
96
25
  state.filter.rubriquageArray = filter.rubriquageArray;
97
26
  }
98
- state.filter.live= filter.isLive;
27
+ state.filter.live = filter.isLive;
99
28
  state.filter.iab = undefined;
100
29
  },
101
30
  filterIab(state, iab) {
@@ -107,13 +36,25 @@ export default createStore({
107
36
  filterRubriqueDisplay(state, rubriques) {
108
37
  state.filter.rubriqueDisplay = rubriques;
109
38
  },
110
-
111
- categoriesSet(state, categories) {
112
- state.categories = categories;
39
+ filterMedia(state, filter) {
40
+ if (filter.type) {
41
+ state.filter.typeMedia = filter.type;
42
+ }
43
+ if (filter.order) {
44
+ state.filter.sortOrder = filter.order;
45
+ }
46
+ if (filter.field) {
47
+ state.filter.sortField = filter.field;
48
+ }
113
49
  },
114
-
115
- categoriesOrgaSet(state, categories) {
116
- state.categoriesOrga = categories;
50
+ initFilter(state, data) {
51
+ state.filter = {
52
+ ...state.filter,
53
+ ...data,
54
+ };
55
+ },
56
+ liveUpdate(state, isBeforeLive) {
57
+ state.liveUpdate.isBeforeLive = isBeforeLive;
117
58
  },
118
59
  setCommentIdentity(state, identity) {
119
60
  state.comments.knownIdentity = identity;
@@ -121,7 +62,11 @@ export default createStore({
121
62
  setCommentLoaded(state, data) {
122
63
  state.comments.actualPodcastId = data.podcastId;
123
64
  state.comments.loadedComments = data.comments;
124
- state.comments.totalCount = data.count;
65
+ },
66
+ isEducation(state, isEducation) {
67
+ state.general.education = isEducation;
68
+ state.general.logoUrl = '/img/logo_education.webp';
69
+ state.general.metaTitle = 'RadioEducation.org';
125
70
  },
126
71
  },
127
72
  });
@@ -0,0 +1,77 @@
1
+ import { getDefaultPlayerState } from './classStore/typePlayerStore';
2
+ import { Module, MutationTree } from 'vuex';
3
+ import { StoreState } from './classStore/typeAppStore';
4
+ import { Player } from './class/general/player';
5
+
6
+ const mutations = <MutationTree<Player>>{
7
+ playPodcast(state, podcast) {
8
+ if (!podcast) {
9
+ state.status = 'STOPPED';
10
+ state.podcast = undefined;
11
+ state.media = undefined;
12
+ state.live = undefined;
13
+ state.elapsed = 0;
14
+ return;
15
+ }
16
+ if (
17
+ (state.podcast &&
18
+ state.podcast.podcastId === podcast.podcastId) ||
19
+ (state.media && state.media.mediaId === podcast.mediaId) ||
20
+ (state.live &&
21
+ state.live.conferenceId === podcast.conferenceId)
22
+ ) {
23
+ //Do nothing
24
+ return;
25
+ }
26
+ state.status = 'LOADING';
27
+ state.podcast = undefined;
28
+ state.media = undefined;
29
+ state.live = undefined;
30
+ state.elapsed = 0;
31
+ if (
32
+ podcast.conferenceId &&
33
+ (!podcast.podcastId || podcast.processingStatus !== 'READY')
34
+ ) {
35
+ state.live = podcast;
36
+ } else if (podcast.podcastId) {
37
+ state.podcast = podcast;
38
+ } else if (podcast.mediaId) {
39
+ state.media = podcast;
40
+ }
41
+ },
42
+
43
+ pause(state, pause) {
44
+ if (pause) {
45
+ state.status = 'PAUSED';
46
+ } else {
47
+ state.status = 'PLAYING';
48
+ }
49
+ },
50
+
51
+ elapsed(state, elapsed) {
52
+ state.elapsed = elapsed;
53
+ },
54
+
55
+ totalTime(state, total) {
56
+ state.total = total;
57
+ },
58
+
59
+ volume(state, volume) {
60
+ state.volume = volume;
61
+ },
62
+
63
+ seekTime(state, seekTime) {
64
+ state.seekTime = seekTime;
65
+ },
66
+ transcript(state, transcript) {
67
+ state.transcript = transcript;
68
+ },
69
+ };
70
+
71
+ const PlayerModule: Module<Player, StoreState> = {
72
+ namespaced: true,
73
+ state: getDefaultPlayerState(),
74
+ mutations: mutations,
75
+ };
76
+
77
+ export default PlayerModule;
@@ -20,4 +20,21 @@ export interface Emission {
20
20
  optItunesCategories?: Array<string>;
21
21
  adConfigs?: {[key:string]: AdserverConfig};
22
22
  urlFeed?: string;
23
+ }
24
+
25
+ export function emptyEmissionData(): Emission{
26
+ return {
27
+ emissionId: 0,
28
+ name: '' ,
29
+ description: '' ,
30
+ imageUrl: '' ,
31
+ iabIds: undefined ,
32
+ orga: {
33
+ id: '',
34
+ name: '',
35
+ imageUrl: ''
36
+ },
37
+ rubriqueIds: [] ,
38
+ monetisable: 'UNDEFINED',
39
+ }
23
40
  }
@@ -10,3 +10,10 @@ export interface Participant {
10
10
  score?: number;
11
11
  uid?: string;
12
12
  }
13
+ export function emptyParticipantData(): Participant{
14
+ return {
15
+ firstName: '',
16
+ lastName: '',
17
+ participantId:0
18
+ }
19
+ }
@@ -16,6 +16,19 @@ export interface Playlist {
16
16
  publisher?: Person;
17
17
  }
18
18
 
19
+ export function emptyPlaylistData(): Playlist{
20
+ return {
21
+ description: '',
22
+ playlistId: 0,
23
+ podcasts: undefined,
24
+ score: 0,
25
+ title: '',
26
+ type:'DYNAMIC',
27
+ samplingViews:[]
28
+ }
29
+ }
30
+
31
+
19
32
  export interface PlaylistRule {
20
33
  maxSize: number,
21
34
  podcastId?: number,
@@ -1,4 +1,4 @@
1
- import { Emission } from './emission';
1
+ import { Emission, emptyEmissionData } from './emission';
2
2
  import { Organisation } from './organisation';
3
3
  import { Participant } from './participant';
4
4
  import { Person } from '../user/person';
@@ -41,3 +41,32 @@ export interface Podcast {
41
41
  order?: number;
42
42
  livePodcastId?: number
43
43
  }
44
+ export function emptyPodcastData(): Podcast {
45
+ return {
46
+ podcastId:0,
47
+ audioUrl: '',
48
+ audioStorageUrl: '',
49
+ article:'',
50
+ imageUrl: '',
51
+ animators: [],
52
+ guests: [],
53
+ emission: emptyEmissionData(),
54
+ title: '',
55
+ description: undefined,
56
+ tags: [],
57
+ availability: {
58
+ visibility: true,
59
+ date: undefined,
60
+ },
61
+ monetisable: 'UNDEFINED',
62
+ comments: 'inherit',
63
+ organisation: {
64
+ id: '',
65
+ name: '',
66
+ imageUrl: '',
67
+ },
68
+ pubDate: undefined,
69
+ conferenceId: 0,
70
+ duration: 0,
71
+ };
72
+ }
@@ -0,0 +1,79 @@
1
+ import { Category } from '../class/general/category';
2
+ import { CommentPodcast } from '../class/general/comment';
3
+ import { Player } from '../class/general/player';
4
+ import { Rubriquage } from '../class/rubrique/rubriquage';
5
+ import { RubriquageFilter } from '../class/rubrique/rubriquageFilter';
6
+ import { Rubrique } from '../class/rubrique/rubrique';
7
+ import { AuthState } from './typeAuthStore';
8
+ import { getDefaultPlayerState } from './typePlayerStore';
9
+
10
+ export interface Filter{
11
+ organisationId: string | undefined;
12
+ imgUrl: string | undefined;
13
+ name: string | undefined;
14
+ rubriquageArray: Array<Rubriquage>;
15
+ rubriqueFilter: Array<RubriquageFilter>;
16
+ rubriqueDisplay: Array<Rubrique>;
17
+ typeMedia: string | undefined;
18
+ sortOrder: string | undefined;
19
+ sortField: string | undefined;
20
+ live: boolean|undefined;
21
+ iab: Category |undefined;
22
+ }
23
+
24
+ export interface StoreState {
25
+ general: {
26
+ metaTitle: string;
27
+ education: boolean;
28
+ logoUrl: string;
29
+ };
30
+ categories: Array<Category>;
31
+ categoriesOrga: Array<Category>;
32
+ filter: Filter;
33
+ liveUpdate: {
34
+ isBeforeLive: boolean;
35
+ };
36
+ comments: {
37
+ knownIdentity: string | null;
38
+ actualPodcastId: number;
39
+ loadedComments: Array<CommentPodcast>;
40
+ totalCount: number;
41
+ };
42
+ player: Player;
43
+ auth?: AuthState;
44
+ }
45
+
46
+ export function AppStoreData(): StoreState {
47
+ return {
48
+ general: {
49
+ metaTitle: 'Octopus by Saooti',
50
+ education: false,
51
+ logoUrl: '/img/logo_octopus_final.svg',
52
+ },
53
+ categories: [],
54
+ categoriesOrga: [],
55
+ filter: {
56
+ organisationId: undefined,
57
+ imgUrl: undefined,
58
+ name:undefined,
59
+ rubriquageArray: [],
60
+ rubriqueFilter: [],
61
+ rubriqueDisplay: [],
62
+ typeMedia: undefined,
63
+ sortOrder: undefined,
64
+ sortField: undefined,
65
+ live: false,
66
+ iab: undefined,
67
+ },
68
+ liveUpdate: {
69
+ isBeforeLive: true,
70
+ },
71
+ comments: {
72
+ knownIdentity: null,
73
+ actualPodcastId: 0,
74
+ loadedComments: [],
75
+ totalCount: 0,
76
+ },
77
+ player: getDefaultPlayerState(),
78
+ };
79
+ }
@@ -0,0 +1,44 @@
1
+ import { Organisation } from "../class/general/organisation";
2
+ import { Profile } from "../class/user/profile";
3
+
4
+ export interface AuthState {
5
+ name: string;
6
+ organisationId: string | undefined;
7
+ organisationName: string | undefined;
8
+ role: Array<string>;
9
+ oAuthParam: {
10
+ accessToken: string | undefined;
11
+ refreshToken: string | undefined;
12
+ expiration: Date | undefined;
13
+ };
14
+ profile: Profile;
15
+ organisation: Organisation;
16
+ }
17
+ export function getDefaultAuthState(): AuthState {
18
+ return {
19
+ name: '',
20
+ organisationId: undefined,
21
+ organisationName: undefined,
22
+ role: [''],
23
+ oAuthParam: {
24
+ accessToken: undefined,
25
+ refreshToken: undefined,
26
+ expiration: undefined,
27
+ },
28
+ profile: {
29
+ userId: '',
30
+ },
31
+ organisation: {
32
+ id: '',
33
+ name: '',
34
+ imageUrl: '',
35
+ description: undefined,
36
+ monetisable: undefined,
37
+ location: undefined,
38
+ comments: undefined,
39
+ attributes: {
40
+ RSS_CONTACT: undefined,
41
+ },
42
+ },
43
+ };
44
+ }
@@ -0,0 +1,14 @@
1
+ import { Player } from '../class/general/player';
2
+
3
+ export function getDefaultPlayerState(): Player {
4
+ return {
5
+ status: 'STOPPED', //STOPPED, LOADING, PLAYING, PAUSED
6
+ podcast: undefined,
7
+ volume: 1, //From 0 to 1
8
+ elapsed: 0, //From 0 to 1
9
+ total: 0,
10
+ media: undefined,
11
+ live: undefined,
12
+ seekTime:0,
13
+ };
14
+ }