@saooti/octopus-sdk 31.0.3 → 31.0.4

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/README.md CHANGED
@@ -562,9 +562,13 @@ See [Configuration Reference](https://cli.vuejs.org/config/).
562
562
  * 30.0.63 Italian translation
563
563
  * 30.0.64 Modif Le soir
564
564
  * 30.0.65 OAuthType
565
+ * 30.0.66 ScrollBehavior
565
566
 
566
567
  * 31.0.0 Passage en 31
567
568
  * 31.0.1 Ajout pocket casts
568
569
  * 31.0.2 Gestion des 403
569
570
  * 31.0.3 Merge 30
571
+ * 31.0.4 Selection des customPlayers
570
572
 
573
+
574
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saooti/octopus-sdk",
3
- "version": "31.0.3",
3
+ "version": "31.0.4",
4
4
  "private": false,
5
5
  "description": "Javascript SDK for using octopus",
6
6
  "author": "Saooti",
@@ -122,7 +122,7 @@ export default defineComponent({
122
122
  this.$store.commit('filterRubrique', filter);
123
123
  const queries = this.$route.query;
124
124
  const queryString = filter.map(value => value.rubriquageId+':'+value.rubriqueId).join();
125
- this.$router.push({ query: { ...queries, ...{ rubriquesId: queryString }} });
125
+ this.$router.replace({ query: { ...queries, ...{ rubriquesId: queryString }} });
126
126
  }
127
127
  },
128
128
  getRubriques(rubriquageId: number): Array<Rubrique>{
@@ -138,7 +138,7 @@ export default defineComponent({
138
138
  const queries = this.$route.query;
139
139
  if(this.categoryFilter){
140
140
  if (queries.iabId) {
141
- this.$router.push({ query: {...queries, ...{iabId: undefined} } });
141
+ this.$router.replace({ query: {...queries, ...{iabId: undefined} } });
142
142
  }
143
143
  this.$store.commit('filterIab', undefined);
144
144
  }else{
@@ -147,9 +147,9 @@ export default defineComponent({
147
147
  if (queries.rubriquesId) {
148
148
  const queryString = newFilter.map(value => value.rubriquageId+':'+value.rubriqueId).join();
149
149
  if("" !== queryString){
150
- this.$router.push({ query: { ...queries, ...{ rubriquesId: queryString }} });
150
+ this.$router.replace({ query: { ...queries, ...{ rubriquesId: queryString }} });
151
151
  }else{
152
- this.$router.push({ query: { ...queries, ...{ rubriquesId: undefined }} });
152
+ this.$router.replace({ query: { ...queries, ...{ rubriquesId: undefined }} });
153
153
  }
154
154
  }
155
155
  this.$store.commit('filterRubrique', newFilter);
@@ -139,7 +139,7 @@ export default defineComponent({
139
139
  }
140
140
  const queries = this.$route.query;
141
141
  if(!queries.iabId || ('string'===typeof queries.iabId && parseInt(queries.iabId ,10) !== category.id)) {
142
- this.$router.push({ query: { ...queries, ...{ iabId: category.id.toString() }} });
142
+ this.$router.replace({ query: { ...queries, ...{ iabId: category.id.toString() }} });
143
143
  }
144
144
  this.$store.commit('filterIab',category);
145
145
  },
@@ -105,7 +105,7 @@ export default defineComponent({
105
105
  }
106
106
  const queries = this.$route.query;
107
107
  if (queries.iabId) {
108
- this.$router.push({ query: {...queries, ...{iabId: undefined} } });
108
+ this.$router.replace({ query: {...queries, ...{iabId: undefined} } });
109
109
  }
110
110
  this.$store.commit('filterIab', undefined);
111
111
  }
@@ -118,11 +118,17 @@ export default defineComponent({
118
118
  });
119
119
  this.keepOrganisation = false;
120
120
  if (organisation && organisation.id) {
121
- this.showBubble = true;
122
- setTimeout(() => {
123
- this.showBubble = false;
124
- }, 6000);
125
121
  this.$emit('updateOrganisationId', organisation.id);
122
+ if(organisation.private){
123
+ this.$nextTick(() => {
124
+ this.onKeepOrganisation();
125
+ });
126
+ } else{
127
+ this.showBubble = true;
128
+ setTimeout(() => {
129
+ this.showBubble = false;
130
+ }, 6000);
131
+ }
126
132
  } else {
127
133
  this.$emit('updateOrganisationId', undefined);
128
134
  }
@@ -229,7 +229,7 @@ export default defineComponent({
229
229
  }
230
230
  const queries = this.$route.query;
231
231
  if (queries.rubriquesId) {
232
- this.$router.push({ query: {...queries, ...{rubriquesId: undefined} } });
232
+ this.$router.replace({ query: {...queries, ...{rubriquesId: undefined} } });
233
233
  }
234
234
  this.$store.commit('filterRubrique', []);
235
235
  }
@@ -49,9 +49,9 @@
49
49
  <router-link
50
50
  class="btn btn-link align-self-center width-fit-content m-4"
51
51
  :to="{
52
- name: 'playlist',
53
- params: { playlistId: playlistId.toString() },
54
- }"
52
+ name: 'playlist',
53
+ params: { playlistId: playlistId.toString() },
54
+ }"
55
55
  >
56
56
  {{ $t('See more') }}
57
57
  <div
@@ -130,7 +130,7 @@ export default defineComponent({
130
130
  this.$store.commit('filterRubrique', newFilter);
131
131
  const queries = this.$route.query;
132
132
  const queryString = newFilter.map(value => value.rubriquageId+':'+value.rubriqueId).join();
133
- this.$router.push({ query: { ...queries, ...{ rubriquesId: queryString }} });
133
+ this.$router.replace({ query: { ...queries, ...{ rubriquesId: queryString }} });
134
134
  this.selectNewRubriquage();
135
135
  },
136
136
  selectNewRubriquage(){
@@ -33,7 +33,7 @@
33
33
  :podcast="podcast"
34
34
  :emission="emission"
35
35
  :playlist="playlist"
36
- :custom-players="customPlayers"
36
+ :organisation-id="organisationId"
37
37
  />
38
38
  </div>
39
39
  <SharePlayerColors
@@ -82,7 +82,6 @@ import octopusApi from '@saooti/octopus-api';
82
82
  import { Podcast } from '@/store/class/general/podcast';
83
83
  import { Emission } from '@/store/class/general/emission';
84
84
  import { Playlist } from '@/store/class/general/playlist';
85
- import { CustomPlayer } from '@/store/class/general/customPlayer';
86
85
  import { defineComponent, defineAsyncComponent } from 'vue';
87
86
  const ShareModalPlayer = defineAsyncComponent(() => import('../../misc/modal/ShareModalPlayer.vue'));
88
87
  const PlayerParameters = defineAsyncComponent(() => import('./PlayerParameters.vue'));
@@ -119,7 +118,6 @@ export default defineComponent({
119
118
  iFrameNumber: '3' as string,
120
119
  isVisible: false as boolean,
121
120
  displayArticle: true as boolean,
122
- customPlayers: [] as Array<CustomPlayer>,
123
121
  colors: ['#000000', '#ffffff'],
124
122
  };
125
123
  },
@@ -333,15 +331,6 @@ export default defineComponent({
333
331
  } else {
334
332
  this.theme = '#000000';
335
333
  }
336
- let dataFetched = await octopusApi.fetchCustomPlayer('customPlayer/organisation/'+ this.organisationId);
337
- this.customPlayers = dataFetched.content;
338
- const totalCount = dataFetched.totalElements;
339
- let index = 1;
340
- while (totalCount > this.customPlayers.length) {
341
- dataFetched = await octopusApi.fetchCustomPlayer('customPlayer/organisation/'+ this.organisationId+'?start='+index);
342
- this.customPlayers = this.customPlayers.concat(dataFetched.content);
343
- ++index;
344
- }
345
334
  },
346
335
  updateEpisodeNumber(value: string): void {
347
336
  this.episodeNumbers = value;
@@ -48,6 +48,8 @@
48
48
  </template>
49
49
 
50
50
  <script lang="ts">
51
+ import { state } from '../../../store/paramStore';
52
+ import octopusApi from '@saooti/octopus-api';
51
53
  import { Podcast } from '@/store/class/general/podcast';
52
54
  import { CustomPlayer } from '@/store/class/general/customPlayer';
53
55
  import { defineComponent } from 'vue';
@@ -58,12 +60,21 @@ export default defineComponent({
58
60
  podcast: { default: undefined, type: Object as ()=> Podcast},
59
61
  emission: { default: undefined, type: Object as ()=> Emission},
60
62
  playlist: { default: undefined, type: Object as ()=> Playlist},
61
- customPlayers: { default: ()=>[], type: Array as ()=> Array<CustomPlayer>},
62
63
  iFrameModel: { default: 'default', type: String},
64
+ organisationId: { default: undefined, type: String},
63
65
  },
64
66
  emits:['update:iFrameModel'],
65
67
 
68
+ data() {
69
+ return {
70
+ customPlayers: [] as Array<CustomPlayer>,
71
+ };
72
+ },
73
+
66
74
  computed: {
75
+ authenticated(): boolean {
76
+ return (state.generalParameters.authenticated as boolean);
77
+ },
67
78
  customPlayersDisplay(): Array<CustomPlayer>{
68
79
  return this.customPlayers.filter((player: CustomPlayer)=>{
69
80
  return (('EPISODE' === player.typePlayer ||'SUGGESTION' === player.typePlayer) && this.podcast && this.podcast.podcastId) ||
@@ -71,5 +82,41 @@ export default defineComponent({
71
82
  });
72
83
  },
73
84
  },
85
+ async created() {
86
+ await this.initCustomPlayers();
87
+ },
88
+
89
+ methods: {
90
+ async fetchCustomPlayers(type:string, trySelect: boolean): Promise<boolean>{
91
+ let players = await octopusApi.fetchCustomPlayer('customPlayer/type/'+ this.organisationId+'/'+type);
92
+ let playersContent = players.content;
93
+ const totalCount = players.totalElements;
94
+ let index = 1;
95
+ while (totalCount > playersContent.length) {
96
+ players = await octopusApi.fetchCustomPlayer('customPlayer/type/'+ this.organisationId+'/'+type+'?start='+index);
97
+ playersContent = playersContent.concat(players.content);
98
+ ++index;
99
+ }
100
+ this.customPlayers = this.customPlayers.concat(playersContent);
101
+ if(trySelect && this.customPlayers[0] && this.customPlayers[0].selected){
102
+ this.$emit('update:iFrameModel',this.customPlayers[0].customId);
103
+ return false;
104
+ }
105
+ return true;
106
+ },
107
+ async initCustomPlayers(): Promise<void> {
108
+ if (!this.authenticated) return;
109
+ if(this.playlist){
110
+ this.fetchCustomPlayers('PLAYLIST', true);
111
+ }else if(this.emission && !this.podcast){
112
+ this.fetchCustomPlayers('EMISSION', true);
113
+ }else{
114
+ let playerTrySelect = true;
115
+ playerTrySelect = await this.fetchCustomPlayers('EPISODE', playerTrySelect);
116
+ playerTrySelect = await this.fetchCustomPlayers('EMISSION', playerTrySelect);
117
+ playerTrySelect = await this.fetchCustomPlayers('SUGGESTION', playerTrySelect);
118
+ }
119
+ },
120
+ }
74
121
  })
75
122
  </script>
package/src/main.ts CHANGED
@@ -16,7 +16,7 @@ import 'bootstrap/dist/js/bootstrap.bundle.min.js';
16
16
 
17
17
  //TODO
18
18
  const navigatorLang = navigator.language /* || navigator.userLanguage */;
19
- let language = 'it';
19
+ let language = 'fr';
20
20
  if(navigatorLang.includes('en')){
21
21
  language = 'en';
22
22
  }
@@ -4,5 +4,6 @@ export interface CustomPlayer{
4
4
  template: string,
5
5
  css: string,
6
6
  typePlayer: string,
7
- name: string
7
+ name: string,
8
+ selected: boolean,
8
9
  }
@@ -12,7 +12,7 @@ const state:paramStore = {
12
12
  isPlaylist: false,
13
13
  isProduction: true,
14
14
  isContribution: true,
15
- ApiUri: 'https://api.staging.saooti.org/',
15
+ ApiUri: 'https://api.dev2.saooti.org/',
16
16
  podcastmaker: false,
17
17
  buttonPlus: true,
18
18
  allCategories: [],
@@ -26,10 +26,10 @@ const state:paramStore = {
26
26
  SharePlayer: true,
27
27
  ShareButtons: true,
28
28
  ShareDistribution: true,
29
- MiniplayerUri: 'https://playerbeta.staging.saooti.org/',
29
+ MiniplayerUri: 'https://playerbeta.dev2.saooti.org/',
30
30
  ouestFranceStyle: false,
31
31
  downloadButton: false,
32
- hlsUri: 'https://hls.staging.saooti.org/',
32
+ hlsUri: 'https://hls.dev2.saooti.org/',
33
33
  mainRubrique: 0,
34
34
  resourceUrl: undefined
35
35
  },
@@ -85,10 +85,10 @@ const state:paramStore = {
85
85
  userName: '',
86
86
  },
87
87
  octopusApi: {
88
- url: 'http://api.staging.saooti.org/',
89
- commentsUrl: 'http://comments.staging.saooti.org/',
90
- studioUrl: 'http://studio.staging.saooti.org/',
91
- playerUrl: 'https://playerbeta.staging.saooti.org/',
88
+ url: 'http://api.dev2.saooti.org/',
89
+ commentsUrl: 'http://comments.dev2.saooti.org/',
90
+ studioUrl: 'http://studio.dev2.saooti.org/',
91
+ playerUrl: 'https://playerbeta.dev2.saooti.org/',
92
92
  organisationId: undefined,
93
93
  rubriqueIdFilter: undefined,
94
94
  },