@saooti/octopus-sdk 39.0.6 → 39.0.7-SNAPSHOT

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saooti/octopus-sdk",
3
- "version": "39.0.6",
3
+ "version": "39.0.7-SNAPSHOT",
4
4
  "private": false,
5
5
  "description": "Javascript SDK for using octopus",
6
6
  "author": "Saooti",
@@ -12,7 +12,7 @@
12
12
  padding: 0.5rem 0 0;
13
13
  color: black;
14
14
  font-weight: bold;
15
- margin-bottom: 0.5rem;
15
+ margin-bottom: 0.2rem;
16
16
  }
17
17
  .counter-align-right{
18
18
  flex-grow: 1;
@@ -52,11 +52,12 @@ import { orgaComputed } from "../../mixins/orgaComputed";
52
52
  import octopusApi from "@saooti/octopus-api";
53
53
  import { useFilterStore } from "@/stores/FilterStore";
54
54
  import { useAuthStore } from "@/stores/AuthStore";
55
- import { mapState } from "pinia";
55
+ import { mapActions, mapState } from "pinia";
56
56
  import { state } from "../../../stores/ParamSdkStore";
57
57
  import { Conference } from "@/stores/class/conference/conference";
58
58
  import { defineComponent } from "vue";
59
59
  import { AxiosError } from "axios";
60
+ import { useSaveFetchStore } from "@/stores/SaveFetchStore";
60
61
  export default defineComponent({
61
62
  name: "LiveList",
62
63
  components: {
@@ -163,13 +164,13 @@ export default defineComponent({
163
164
  },
164
165
  },
165
166
  methods: {
167
+ ...mapActions(useSaveFetchStore, ["getOrgaLiveEnabled"]),
166
168
  async checkIfLiveAuthorized(): Promise<void> {
167
169
  if (!this.filterOrgaUsed) {
168
170
  return;
169
171
  }
170
- this.isLiveAuthorized = await octopusApi.fetchData<boolean>(
171
- 0,
172
- "organisation/liveEnabled/" + this.filterOrgaUsed,
172
+ this.isLiveAuthorized = await this.getOrgaLiveEnabled(
173
+ this.filterOrgaUsed,
173
174
  );
174
175
  },
175
176
  endLoading(): void {
@@ -37,7 +37,7 @@
37
37
 
38
38
  <script lang="ts">
39
39
  import { useAuthStore } from "@/stores/AuthStore";
40
- import { mapState } from "pinia";
40
+ import { mapActions, mapState } from "pinia";
41
41
  import imageProxy from "../../mixins/imageProxy";
42
42
  import selenium from "../../mixins/selenium";
43
43
  import { orgaComputed } from "../../mixins/orgaComputed";
@@ -48,6 +48,7 @@ import {
48
48
  emptyOrgaData,
49
49
  Organisation,
50
50
  } from "@/stores/class/general/organisation";
51
+ import { useSaveFetchStore } from "@/stores/SaveFetchStore";
51
52
  export default defineComponent({
52
53
  components: {
53
54
  ClassicMultiselect,
@@ -109,6 +110,7 @@ export default defineComponent({
109
110
  this.organisationChosen = this.getDefaultOrganisation;
110
111
  },
111
112
  methods: {
113
+ ...mapActions(useSaveFetchStore, ["getOrgaData"]),
112
114
  async onSearchOrganisation(query?: string): Promise<void> {
113
115
  const response = await octopusApi.fetchDataWithParams<{
114
116
  count: number;
@@ -145,9 +147,8 @@ export default defineComponent({
145
147
  ).afterSearch(notNullOrga, response.count);
146
148
  },
147
149
  async fetchOrganisation(): Promise<void> {
148
- this.organisationChosen = await octopusApi.fetchData<Organisation>(
149
- 0,
150
- `organisation/${this.orgaIdSelected}`,
150
+ this.organisationChosen = await this.getOrgaData(
151
+ this.orgaIdSelected ?? "",
151
152
  );
152
153
  this.initLoaded = true;
153
154
  },
@@ -27,7 +27,8 @@
27
27
 
28
28
  <script lang="ts">
29
29
  import { Organisation } from "@/stores/class/general/organisation";
30
- import octopusApi from "@saooti/octopus-api";
30
+ import { useSaveFetchStore } from "@/stores/SaveFetchStore";
31
+ import { mapActions } from "pinia";
31
32
  import { defineComponent } from "vue";
32
33
  export default defineComponent({
33
34
  props: {
@@ -64,6 +65,7 @@ export default defineComponent({
64
65
  },
65
66
 
66
67
  methods: {
68
+ ...mapActions(useSaveFetchStore, ["getOrgaData"]),
67
69
  onOrganisationSelected(): void {
68
70
  this.$emit(
69
71
  "selected",
@@ -74,12 +76,8 @@ export default defineComponent({
74
76
  if (!this.value) {
75
77
  return;
76
78
  }
77
- const data = await octopusApi.fetchData<Organisation>(
78
- 0,
79
- `organisation/${this.value}`,
80
- );
81
- this.organisation = data;
82
- this.actual = data.id;
79
+ this.organisation = await this.getOrgaData(this.value);
80
+ this.actual = this.organisation.id;
83
81
  this.init = true;
84
82
  },
85
83
  },
@@ -0,0 +1,22 @@
1
+ <template>
2
+ <ClassicCheckbox
3
+ :text-init="insertCode"
4
+ id-checkbox="insert-code-checkbox"
5
+ :label="$t('Insert custom code')"
6
+ @update:text-init="$emit('update:insertCode', $event)"
7
+ />
8
+ </template>
9
+
10
+ <script lang="ts">
11
+ import ClassicCheckbox from "../../form/ClassicCheckbox.vue";
12
+ import { defineComponent } from "vue";
13
+ export default defineComponent({
14
+ components: {
15
+ ClassicCheckbox,
16
+ },
17
+ props: {
18
+ insertCode: { default: false, type: Boolean },
19
+ },
20
+ emits: ["update:insertCode"],
21
+ });
22
+ </script>
@@ -63,6 +63,10 @@
63
63
  @i-frame-number="iFrameNumber = $event"
64
64
  @episode-numbers="episodeNumbers = $event"
65
65
  />
66
+ <PlayerCommonParameters
67
+ v-if="displayInsertCode"
68
+ v-model:insertCode="insertCode"
69
+ />
66
70
  <ShareModalPlayer
67
71
  v-if="isShareModal"
68
72
  :embed-link="iFrame"
@@ -104,6 +108,9 @@ const ShareModalPlayer = defineAsyncComponent(
104
108
  const PlayerParameters = defineAsyncComponent(
105
109
  () => import("./PlayerParameters.vue"),
106
110
  );
111
+ const PlayerCommonParameters = defineAsyncComponent(
112
+ () => import("./PlayerCommonParameters.vue"),
113
+ );
107
114
  const SharePlayerTypes = defineAsyncComponent(
108
115
  () => import("./SharePlayerTypes.vue"),
109
116
  );
@@ -120,6 +127,7 @@ export default defineComponent({
120
127
  PlayerParameters,
121
128
  SharePlayerTypes,
122
129
  ClassicCheckbox,
130
+ PlayerCommonParameters,
123
131
  },
124
132
  mixins: [orgaComputed],
125
133
  props: {
@@ -149,6 +157,7 @@ export default defineComponent({
149
157
  orgaAttributes: undefined as
150
158
  | { [key: string]: string | number | boolean | undefined }
151
159
  | undefined,
160
+ insertCode: false as boolean,
152
161
  };
153
162
  },
154
163
 
@@ -167,6 +176,19 @@ export default defineComponent({
167
176
  "largeMore" === this.iFrameModel)
168
177
  );
169
178
  },
179
+ displayInsertCode(): boolean {
180
+ let orgaResourceId = "";
181
+ if (this.podcast) {
182
+ orgaResourceId = this.podcast.organisation.id;
183
+ }
184
+ if (this.emission) {
185
+ orgaResourceId = this.emission.orga.id;
186
+ }
187
+ if (this.playlist) {
188
+ orgaResourceId = this.playlist.organisation?.id ?? "";
189
+ }
190
+ return this.authenticated && orgaResourceId === this.myOrganisationId;
191
+ },
170
192
  displayTranscriptParam(): boolean {
171
193
  return (
172
194
  this.isTranscriptionAuthorize && (this.isDefault || this.isEmission)
@@ -376,6 +398,9 @@ export default defineComponent({
376
398
  if (this.isVisible) {
377
399
  url.push("&key=" + window.btoa(this.dataTitle.toString()));
378
400
  }
401
+ if (this.insertCode) {
402
+ url.push("&insertCode=true");
403
+ }
379
404
  return url;
380
405
  },
381
406
  initColor(): void {
@@ -10,10 +10,18 @@
10
10
  :src="iFrameSrc"
11
11
  width="100%"
12
12
  height="140px"
13
+ scrolling="no"
14
+ allow="clipboard-read; clipboard-write; autoplay"
15
+ frameborder="0"
13
16
  class="max-iframe mx-3 flex-grow-1"
14
17
  />
15
- <div class="d-flex flex-column flex-grow-1 align-items-center">
18
+ <div class="d-flex flex-column">
16
19
  <SharePlayerColors v-model:color="color" v-model:theme="theme" />
20
+ <div class="h4 mb-2 mt-3">{{ $t("player parameters") }}</div>
21
+ <PlayerCommonParameters
22
+ v-if="displayInsertCode"
23
+ v-model:insertCode="insertCode"
24
+ />
17
25
  <ShareModalPlayer
18
26
  v-if="isShareModal"
19
27
  :embed-link="iFrame"
@@ -45,10 +53,14 @@ const ShareModalPlayer = defineAsyncComponent(
45
53
  const SharePlayerColors = defineAsyncComponent(
46
54
  () => import("./SharePlayerColors.vue"),
47
55
  );
56
+ const PlayerCommonParameters = defineAsyncComponent(
57
+ () => import("./PlayerCommonParameters.vue"),
58
+ );
48
59
  export default defineComponent({
49
60
  components: {
50
61
  ShareModalPlayer,
51
62
  SharePlayerColors,
63
+ PlayerCommonParameters,
52
64
  },
53
65
  mixins: [orgaComputed],
54
66
  props: {
@@ -64,19 +76,29 @@ export default defineComponent({
64
76
  orgaAttributes: undefined as
65
77
  | { [key: string]: string | number | boolean | undefined }
66
78
  | undefined,
79
+ insertCode: false as boolean,
67
80
  };
68
81
  },
69
82
 
70
83
  computed: {
71
84
  ...mapState(useAuthStore, ["authOrganisation"]),
85
+ displayInsertCode(): boolean {
86
+ return (
87
+ this.authenticated &&
88
+ this.canal?.organisationId === this.myOrganisationId
89
+ );
90
+ },
72
91
  iFrameSrc(): string {
73
- return `${state.podcastPage.MiniplayerUri}miniplayer/radio/${
92
+ let url = `${state.podcastPage.MiniplayerUri}miniplayer/radio/${
74
93
  this.canal?.id
75
94
  }?distributorId=${this.organisationId}&color=${this.color.substring(
76
95
  1,
77
96
  )}&theme=${this.theme.substring(1)}`;
97
+ if (this.insertCode) {
98
+ url += "&insertCode=true";
99
+ }
100
+ return url;
78
101
  },
79
-
80
102
  iFrame(): string {
81
103
  return `<iframe src="${this.iFrameSrc}" width="100%" height="140px" scrolling="no" allow="clipboard-read; clipboard-write; autoplay" frameborder="0"></iframe>`;
82
104
  },
@@ -219,7 +219,7 @@ export default defineComponent({
219
219
  "" !== this.authOrganisation.id
220
220
  ? this.authOrganisation.id
221
221
  : state.generalParameters.organisationId;
222
- if (!orgaId || orgaId?.length) {
222
+ if (!orgaId?.length) {
223
223
  return;
224
224
  }
225
225
  const attributes = await this.getOrgaAttributes(orgaId ?? "");
@@ -5,17 +5,15 @@ import { useFilterStore } from "@/stores/FilterStore";
5
5
  import { mapActions } from "pinia";
6
6
  import { defineComponent } from "vue";
7
7
  import { AxiosError } from "axios";
8
- import { Organisation } from "@/stores/class/general/organisation";
8
+ import { useSaveFetchStore } from "@/stores/SaveFetchStore";
9
9
  export default defineComponent({
10
10
  mixins: [handle403],
11
11
  methods: {
12
+ ...mapActions(useSaveFetchStore, ["getOrgaLiveEnabled", "getOrgaData"]),
12
13
  ...mapActions(useFilterStore, ["filterUpdateOrga"]),
13
14
  async selectOrganisation(organisationId: string): Promise<void> {
14
15
  try {
15
- const response = await octopusApi.fetchData<Organisation>(
16
- 0,
17
- `organisation/${organisationId}`,
18
- );
16
+ const response = await this.getOrgaData(organisationId);
19
17
  const data = await octopusApi.fetchDataWithParams<Array<Rubriquage>>(
20
18
  0,
21
19
  "rubriquage/find/" + organisationId,
@@ -25,10 +23,7 @@ export default defineComponent({
25
23
  },
26
24
  true,
27
25
  );
28
- const isLive = await octopusApi.fetchData<boolean>(
29
- 0,
30
- "organisation/liveEnabled/" + organisationId,
31
- );
26
+ const isLive = await this.getOrgaLiveEnabled(organisationId);
32
27
  this.filterUpdateOrga({
33
28
  orgaId: organisationId,
34
29
  imgUrl: response.imageUrl,
@@ -258,7 +258,10 @@ export default defineComponent({
258
258
  },
259
259
  podcastsFetched(podcasts: Array<Podcast>) {
260
260
  for (const podcast of podcasts) {
261
- if ("READY" === podcast.processingStatus) {
261
+ if (
262
+ "READY" === podcast.processingStatus &&
263
+ podcast.availability.visibility
264
+ ) {
262
265
  this.lastPodcast = podcast;
263
266
  return;
264
267
  }
package/src/locale/de.ts CHANGED
@@ -357,4 +357,5 @@ export default {
357
357
  "Choose background color":"Wählen Sie die Hintergrundfarbe",
358
358
  "Skip ad":"Überspringen",
359
359
  "Skip ad in seconds":"Anzeige in {seconds} Sekunden überspringen",
360
+ "Insert custom code":"Fügen Sie benutzerdefinierten Code ein",
360
361
  }
package/src/locale/en.ts CHANGED
@@ -358,4 +358,5 @@ export default {
358
358
  "Choose background color":"Choose background color",
359
359
  "Skip ad":"Skip ad",
360
360
  "Skip ad in seconds":"Skip ad in {seconds} seconds",
361
+ "Insert custom code":"Insert custom code",
361
362
  };
package/src/locale/es.ts CHANGED
@@ -358,4 +358,5 @@ export default {
358
358
  "Choose background color":"Elige el color de fondo",
359
359
  "Skip ad":"Omitir aviso publicitario",
360
360
  "Skip ad in seconds":"Saltar anuncio en {segundos} segundos",
361
+ "Insert custom code":"Insertar código personalizado",
361
362
  }
package/src/locale/fr.ts CHANGED
@@ -365,4 +365,5 @@ export default {
365
365
  "Choose background color":"Choisir la couleur du fond",
366
366
  "Skip ad":"Ignorer l'annonce",
367
367
  "Skip ad in seconds":"Ignorer l'annonce dans {seconds} secondes",
368
+ "Insert custom code":"Insérer le code personnalisé",
368
369
  };
package/src/locale/it.ts CHANGED
@@ -351,4 +351,5 @@ export default{
351
351
  "Choose background color":"Scegli il colore dello sfondo",
352
352
  "Skip ad":"Salta annuncio",
353
353
  "Skip ad in seconds":"Salta l'annuncio tra {seconds} secondi",
354
+ "Insert custom code":"Inserisci il codice personalizzato",
354
355
  };
package/src/locale/sl.ts CHANGED
@@ -348,4 +348,5 @@ export default {
348
348
  "Choose background color":"Izberite barvo ozadja",
349
349
  "Skip ad":"Preskočite oglas",
350
350
  "Skip ad in seconds":"Preskoči oglas čez {seconds} sekund",
351
+ "Insert custom code":"Vstavite kodo po meri",
351
352
  }
@@ -2,13 +2,18 @@
2
2
  import { defineStore } from 'pinia';
3
3
  import octopusApi from '@saooti/octopus-api';
4
4
  import { useAuthStore } from '@/stores/AuthStore';
5
+ import {Organisation} from "@/stores/class/general/organisation";
5
6
 
6
7
  interface SaveFetchState{
7
8
  orgaPublicAttributes: {[key:string]: {[key: string]:string|number|boolean|undefined}},
9
+ orgaLiveEnabled: {[key:string]: boolean},
10
+ orgaData: {[key:string]: Organisation},
8
11
  }
9
12
  export const useSaveFetchStore = defineStore('SaveFetchStore', {
10
13
  state: (): SaveFetchState => ({
11
- orgaPublicAttributes:{}
14
+ orgaPublicAttributes:{},
15
+ orgaLiveEnabled:{},
16
+ orgaData:{},
12
17
  }),
13
18
  actions:{
14
19
  async getOrgaAttributes(orgaId: string): Promise<{ [key: string]: string | number | boolean | undefined; }>{
@@ -25,6 +30,28 @@ export const useSaveFetchStore = defineStore('SaveFetchStore', {
25
30
  this.orgaPublicAttributes[orgaId] = await octopusApi.fetchData<{[key:string]:string}>(0, 'organisation/attributes/'+orgaId);
26
31
  }
27
32
  return this.orgaPublicAttributes[orgaId];
33
+ },
34
+ async getOrgaData(orgaId: string): Promise<Organisation>{
35
+ if(this.orgaData[orgaId]){
36
+ return this.orgaData[orgaId];
37
+ }
38
+ const authStore = useAuthStore();
39
+ if(orgaId === authStore.authOrganisation.id){
40
+ this.orgaData[orgaId] = authStore.authOrganisation;
41
+ }else{
42
+ this.orgaData[orgaId] = await octopusApi.fetchData<Organisation>(0, 'organisation/'+orgaId);
43
+ }
44
+ return this.orgaData[orgaId];
45
+ },
46
+ async getOrgaLiveEnabled(orgaId: string): Promise<boolean>{
47
+ if(!orgaId.length){
48
+ return false;
49
+ }
50
+ if(this.orgaLiveEnabled[orgaId]){
51
+ return this.orgaLiveEnabled[orgaId];
52
+ }
53
+ this.orgaLiveEnabled[orgaId] = await octopusApi.fetchData<boolean>(0, "organisation/liveEnabled/"+orgaId);
54
+ return this.orgaLiveEnabled[orgaId];
28
55
  }
29
56
  }
30
57
  })