@saooti/octopus-sdk 31.0.5 → 31.0.8

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
@@ -567,6 +567,9 @@ See [Configuration Reference](https://cli.vuejs.org/config/).
567
567
  * 30.0.68 Parlement européen
568
568
  * 30.0.69 Parlement européen
569
569
  * 30.0.70 Améliorations 30
570
+ * 30.0.71 Parlement européen
571
+ * 30.0.72 Ajout des traductions
572
+
570
573
 
571
574
  * 31.0.0 Passage en 31
572
575
  * 31.0.1 Ajout pocket casts
@@ -574,6 +577,9 @@ See [Configuration Reference](https://cli.vuejs.org/config/).
574
577
  * 31.0.3 Merge 30
575
578
  * 31.0.4 Selection des customPlayers
576
579
  * 31.0.5 Merge 30
580
+ * 31.0.6 Erreur de Merge 30
581
+ * 31.0.7 Sécurisation
582
+ * 31.0.8 Dropdown Lang + classicSelect
577
583
 
578
584
 
579
585
 
package/index.ts CHANGED
@@ -56,6 +56,7 @@ import ClassicSearch from "./src/components/form/ClassicSearch.vue";
56
56
  import ClassicCheckbox from "./src/components/form/ClassicCheckbox.vue";
57
57
  import ClassicRadio from "./src/components/form/ClassicRadio.vue";
58
58
  import ClassicLoading from "./src/components/form/ClassicLoading.vue";
59
+ import ClassicSelect from "./src/components/form/ClassicSelect.vue";
59
60
 
60
61
  //mixins
61
62
  import {selenium} from "./src/components/mixins/functions";
@@ -114,7 +115,8 @@ const components = {
114
115
  ClassicRadio,
115
116
  ClassicLoading,
116
117
  AdvancedSearch,
117
- PodcastPlaylistInlineList
118
+ PodcastPlaylistInlineList,
119
+ ClassicSelect
118
120
  }
119
121
 
120
122
  export default components;
@@ -168,5 +170,6 @@ export {
168
170
  ClassicRadio,
169
171
  ClassicLoading,
170
172
  AdvancedSearch,
171
- PodcastPlaylistInlineList
173
+ PodcastPlaylistInlineList,
174
+ ClassicSelect
172
175
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saooti/octopus-sdk",
3
- "version": "31.0.5",
3
+ "version": "31.0.8",
4
4
  "private": false,
5
5
  "description": "Javascript SDK for using octopus",
6
6
  "author": "Saooti",
@@ -15,7 +15,7 @@
15
15
  "main": "./dist/octopus.common.js",
16
16
  "dependencies": {
17
17
  "@popperjs/core": "^2.11.0",
18
- "@saooti/octopus-api": "^0.31.0",
18
+ "@saooti/octopus-api": "^0.31.1",
19
19
  "@vue/cli": "^5.0.0-rc.1",
20
20
  "@vue/compat": "^3.2.26",
21
21
  "axios": "^0.24.0",
@@ -119,7 +119,7 @@ export default defineComponent({
119
119
  this.keepOrganisation = false;
120
120
  if (organisation && organisation.id) {
121
121
  this.$emit('updateOrganisationId', organisation.id);
122
- if(organisation.private){
122
+ if(organisation.privacy){
123
123
  this.$nextTick(() => {
124
124
  this.onKeepOrganisation();
125
125
  });
@@ -82,7 +82,7 @@ export default defineComponent({
82
82
  const data = await octopusApi.fetchOrganisation(this.value);
83
83
  this.organisation = data;
84
84
  this.actual = data.id;
85
- this.privateOrganisation = data.private??false;
85
+ this.privateOrganisation = "PUBLIC"!==data.privacy;
86
86
  this.init = true;
87
87
  },
88
88
  },
@@ -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
@@ -8,17 +8,17 @@
8
8
  <div class="d-flex">
9
9
  <button
10
10
  class="btn btn-underline"
11
- :class="{ active: popularSort }"
12
- @click="sortPopular()"
11
+ :class="{ active: !popularSort }"
12
+ @click="sortChrono()"
13
13
  >
14
- {{ $t('Most popular') }}
14
+ {{ $t('Last added') }}
15
15
  </button>
16
16
  <button
17
17
  class="btn btn-underline"
18
- :class="{ active: !popularSort }"
19
- @click="sortChrono()"
18
+ :class="{ active: popularSort }"
19
+ @click="sortPopular()"
20
20
  >
21
- {{ $t('Last added') }}
21
+ {{ $t('Most popular') }}
22
22
  </button>
23
23
  </div>
24
24
  <div
@@ -68,6 +68,7 @@
68
68
  <router-link
69
69
  class="btn btn-link align-self-center width-fit-content m-4"
70
70
  :to="refTo"
71
+ @click="handleSeeMoreButton"
71
72
  >
72
73
  {{ buttonText }}
73
74
  <div
@@ -91,6 +92,7 @@ import { RubriquageFilter } from '@/store/class/rubrique/rubriquageFilter';
91
92
  import { defineComponent } from 'vue'
92
93
  import { RouteLocationRaw } from 'vue-router';
93
94
  import { AxiosError } from 'axios';
95
+ import { Rubrique } from '@/store/class/rubrique/rubrique';
94
96
  export default defineComponent({
95
97
  name: 'PodcastInlineList',
96
98
 
@@ -126,7 +128,7 @@ export default defineComponent({
126
128
  first: 0 as number,
127
129
  size: 5 as number,
128
130
  totalCount: 0 as number,
129
- popularSort: true as boolean,
131
+ popularSort: false as boolean,
130
132
  allPodcasts: [] as Array<Podcast>,
131
133
  direction: 1 as number,
132
134
  alignLeft: false as boolean,
@@ -214,6 +216,26 @@ export default defineComponent({
214
216
  this.fetchNext();
215
217
  },
216
218
  methods: {
219
+ handleSeeMoreButton(event: { preventDefault: () => void; }){
220
+ if(!this.rubriqueId || this.noRubriquageId.length){
221
+ return;
222
+ }
223
+ event.preventDefault();
224
+ const rubriqueChosenId = this.rubriqueId[this.rubriqueId.length - 1];
225
+ const rubriqueChosen = this.$store.state.filter.rubriquageArray[this.rubriqueId.length - 1].rubriques.find((element: Rubrique) => element.rubriqueId === rubriqueChosenId);
226
+ const filterToAdd = {
227
+ rubriquageId: this.$store.state.filter.rubriquageArray[this.rubriqueId.length - 1].rubriquageId,
228
+ rubriqueId: rubriqueChosenId,
229
+ nameRubriquage: this.$store.state.filter.rubriquageArray[this.rubriqueId.length - 1].title,
230
+ nameRubrique: rubriqueChosen.name
231
+ };
232
+ const newFilter: Array<RubriquageFilter> = Array.from(this.$store.state.filter.rubriqueFilter);
233
+ newFilter.push(filterToAdd);
234
+ this.$store.commit('filterRubrique', newFilter);
235
+ const queries = this.$route.query;
236
+ const queryString = newFilter.map(value => value.rubriquageId+':'+value.rubriqueId).join();
237
+ this.$router.push({ name: 'podcasts',query: { ...queries, ...{ rubriquesId: queryString }} });
238
+ },
217
239
  async fetchNext(): Promise<void> {
218
240
  try {
219
241
  const data = await octopusApi.fetchPodcasts({
@@ -139,12 +139,6 @@
139
139
  :message="$t('Podcast not validated')"
140
140
  />
141
141
  </div>
142
- <ShareButtons
143
- v-if="isDownloadButton"
144
- :podcast="podcast"
145
- :big-round="true"
146
- :audio-url="podcast.audioUrl"
147
- />
148
142
  </div>
149
143
  </div>
150
144
  </div>
@@ -168,14 +162,12 @@ import { Podcast } from '@/store/class/general/podcast';
168
162
  import { Conference } from '@/store/class/conference/conference';
169
163
 
170
164
  import { defineComponent, defineAsyncComponent } from 'vue';
171
- const ShareButtons = defineAsyncComponent(() => import('../sharing/ShareButtons.vue'));
172
165
  const ErrorMessage = defineAsyncComponent(() => import('../../misc/ErrorMessage.vue'));
173
166
  export default defineComponent({
174
167
  name: "PodcastModuleBox",
175
168
  components: {
176
169
  PodcastImage,
177
170
  ParticipantDescription,
178
- ShareButtons,
179
171
  TagList,
180
172
  ErrorMessage,
181
173
  PodcastPlayBar
@@ -209,9 +201,6 @@ export default defineComponent({
209
201
  isOuestFrance(): boolean {
210
202
  return (state.podcastPage.ouestFranceStyle as boolean);
211
203
  },
212
- isDownloadButton(): boolean {
213
- return (state.podcastPage.downloadButton as boolean);
214
- },
215
204
  date(): string {
216
205
  if (this.podcast && 1970 !== moment(this.podcast.pubDate).year()){
217
206
  return moment(this.podcast.pubDate).format('D MMMM YYYY, HH[h]mm');
@@ -32,17 +32,18 @@
32
32
  verticalDisplay ? 'd-flex-row' : '',
33
33
  ]"
34
34
  >
35
- <a
36
- v-if="audioUrl"
37
- class="btn btn-big-round"
35
+ <button
36
+ v-if="isDownloadButton"
37
+ class="text-dark"
38
+ :class="[
39
+ bigRound ? 'btn btn-big-round' : 'btn share-btn mb-2',
40
+ verticalDisplay ? '' : 'mx-2',
41
+ ]"
38
42
  :title="$t('Downloading')"
39
- :href="audioUrl"
40
- rel="noopener"
41
- target="_blank"
42
- download
43
+ @click="onDownload(podcast.audioUrl, podcast.title)"
43
44
  >
44
45
  <div class="saooti-download-bounty" />
45
- </a>
46
+ </button>
46
47
  <a
47
48
  rel="noopener"
48
49
  target="_blank"
@@ -283,6 +284,12 @@ export default defineComponent({
283
284
  },
284
285
 
285
286
  computed: {
287
+ isDownloadButton(): boolean{
288
+ return this.isDownloadButtonParam && undefined!==this.podcast && (!this.podcast.tags || !this.podcast.tags.includes('copyright'));
289
+ },
290
+ isDownloadButtonParam(): boolean {
291
+ return (state.podcastPage.downloadButton as boolean);
292
+ },
286
293
  urlPage(): string{
287
294
  return window.location.href;
288
295
  },
@@ -334,7 +341,24 @@ export default defineComponent({
334
341
  let check = false;
335
342
  (function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(a.substr(0,4))) check = true;})(navigator.userAgent);
336
343
  return check;
337
- }
344
+ },
345
+ onDownload(urlToDownload: string, nameOfDownload: string): void{
346
+ const xhr = new XMLHttpRequest();
347
+ xhr.open('GET', urlToDownload, true);
348
+ xhr.responseType = 'blob';
349
+ xhr.onload = function() {
350
+ const urlCreator = window.URL || window.webkitURL;
351
+ const imageUrl = urlCreator.createObjectURL(this.response);
352
+ const tag = document.createElement('a');
353
+ tag.href = imageUrl;
354
+ tag.target = '_blank';
355
+ tag.download = nameOfDownload.replace(/ /g, '_');
356
+ document.body.appendChild(tag);
357
+ tag.click();
358
+ document.body.removeChild(tag);
359
+ };
360
+ xhr.send();
361
+ },
338
362
  },
339
363
  })
340
364
  </script>
@@ -0,0 +1,68 @@
1
+ <template>
2
+ <div class="classic-select">
3
+ <label
4
+ :for="idSelect"
5
+ class="form-label mt-2"
6
+ :class="displayLabel?'':'d-none'"
7
+ >{{ label }}</label>
8
+ <select
9
+ :id="idSelect"
10
+ v-model="textValue"
11
+ :disabled="isDisabled"
12
+ class="c-hand"
13
+ >
14
+ <option
15
+ v-for="option in options"
16
+ :key="option.title"
17
+ :value="option.value"
18
+ >
19
+ {{ option.title }}
20
+ </option>
21
+ </select>
22
+ </div>
23
+ </template>
24
+ <script lang="ts">
25
+ import { defineComponent } from 'vue';
26
+ export default defineComponent({
27
+ name: 'ClassicSelect',
28
+
29
+ props: {
30
+ idSelect: { default: '', type: String },
31
+ label: { default: '', type: String },
32
+ displayLabel:{default: true, type: Boolean},
33
+ isDisabled: { default: false, type: Boolean },
34
+ options: { default: ()=>[], type: Array as () => Array<{title: string, value: string|undefined}> },
35
+ textInit: { default: undefined, type: String },
36
+ },
37
+
38
+ emits: ['update:textInit'],
39
+
40
+ data() {
41
+ return {
42
+ textValue: undefined as string|undefined,
43
+ };
44
+ },
45
+ watch: {
46
+ textValue(){
47
+ if(this.textInit !== this.textValue){
48
+ this.$emit('update:textInit', this.textValue)
49
+ }
50
+ },
51
+ textInit(){
52
+ if(this.textInit !== this.textValue){
53
+ this.textValue =this.textInit;
54
+ }
55
+ }
56
+ },
57
+ mounted(){
58
+ this.textValue = this.textInit;
59
+ }
60
+ });
61
+ </script>
62
+ <style lang="scss">
63
+ .octopus-app{
64
+ .classic-select select{
65
+ width: inherit;
66
+ }
67
+ }
68
+ </style>
@@ -92,12 +92,18 @@
92
92
  $t('Used libraries')
93
93
  }}
94
94
  </router-link>
95
- <a
96
- class="link-hover c-hand"
97
- @click="changeLanguage"
98
- >{{
99
- $t('Change locale')
100
- }}</a>
95
+ <ClassicSelect
96
+ v-model:textInit="language"
97
+ :display-label="false"
98
+ id-select="language-chooser-select"
99
+ :label="$t('Change locale')"
100
+ :options="[{title:'Deutsch', value:'de'},
101
+ {title:'English', value:'en'},
102
+ {title:'Español', value:'es'},
103
+ {title:'Français', value:'fr'},
104
+ {title:'Italiano', value:'it'},
105
+ {title:'Slovenščina', value:'sl'}]"
106
+ />
101
107
  </div>
102
108
  </div>
103
109
  <hr class="show-phone">
@@ -136,6 +142,7 @@
136
142
  </template>
137
143
 
138
144
  <script lang="ts">
145
+ import ClassicSelect from '../form/ClassicSelect.vue';
139
146
  import Player from './Player.vue';
140
147
  import { state } from '../../store/paramStore';
141
148
  import octopusApi from '@saooti/octopus-api';
@@ -147,8 +154,16 @@ export default defineComponent({
147
154
  name: 'Footer',
148
155
  components: {
149
156
  Player,
157
+ ClassicSelect
158
+ },
159
+
160
+ data() {
161
+ return {
162
+ language: this.$i18n.locale as string,
163
+ };
150
164
  },
151
165
 
166
+
152
167
  computed: {
153
168
  isPodcastmaker(): boolean {
154
169
  return (state.generalParameters.podcastmaker as boolean);
@@ -167,6 +182,12 @@ export default defineComponent({
167
182
  },
168
183
  },
169
184
 
185
+ watch:{
186
+ language(){
187
+ this.changeLanguage();
188
+ }
189
+ },
190
+
170
191
  methods: {
171
192
  showBlackBorder(hide: boolean): void {
172
193
  const footerElement = document.getElementById('footer');
@@ -178,11 +199,7 @@ export default defineComponent({
178
199
  }
179
200
  },
180
201
  changeLanguage(): void{
181
- if('fr'===this.$i18n.locale){
182
- this.$i18n.locale= "en";
183
- }else{
184
- this.$i18n.locale= "fr";
185
- }
202
+ this.$i18n.locale= this.language;
186
203
  moment.locale(this.$i18n.locale);
187
204
  octopusApi.fetchCategories({ lang: this.$i18n.locale }).then((data: Array<Category>) => {
188
205
  this.$store.commit('categoriesSet', data);
@@ -173,5 +173,4 @@ export default defineComponent({
173
173
  }
174
174
  }
175
175
  }
176
- }
177
176
  </style>
@@ -246,7 +246,7 @@ export default defineComponent({
246
246
  try {
247
247
  const data: Emission = await octopusApi.fetchEmission(this.emissionId);
248
248
  this.emission = data;
249
- if(this.emission.orga.private && this.filterOrga!==this.emission.orga.id){
249
+ if("PUBLIC"!==this.emission.orga.privacy && this.filterOrga!==this.emission.orga.id){
250
250
  this.initError();
251
251
  return;
252
252
  }
@@ -186,7 +186,7 @@ export default defineComponent({
186
186
  this.loaded = false;
187
187
  try {
188
188
  const data = await octopusApi.fetchParticipant(this.participantId ? this.participantId.toString(): "");
189
- if(data && data.orga && data.orga.private && this.filterOrga!==data.orga.id){
189
+ if(data && data.orga && "PUBLIC"!==data.orga.privacy && this.filterOrga!==data.orga.id){
190
190
  this.initError();
191
191
  return;
192
192
  }
@@ -143,7 +143,7 @@ export default defineComponent({
143
143
  this.error = false;
144
144
  const data: Playlist = await octopusApi.fetchPlaylist(this.playlistId ? this.playlistId.toString(): "");
145
145
  this.playlist = data;
146
- if(this.playlist.organisation.private && this.filterOrga!==this.playlist.organisation.id){
146
+ if("PUBLIC"!==this.playlist.organisation.privacy && this.filterOrga!==this.playlist.organisation.id){
147
147
  this.initError();
148
148
  return;
149
149
  }
@@ -327,7 +327,7 @@ export default defineComponent({
327
327
  async getPodcastDetails(podcastId: number): Promise<void> {
328
328
  try {
329
329
  const data : Podcast = await octopusApi.fetchPodcast(podcastId.toString());
330
- if(data.organisation.private && this.filterOrga!==data.organisation.id){
330
+ if("PUBLIC"!==data.organisation.privacy && this.filterOrga!==data.organisation.id){
331
331
  this.initError();
332
332
  return;
333
333
  }