@saooti/octopus-sdk 39.0.5 → 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.5",
3
+ "version": "39.0.7-SNAPSHOT",
4
4
  "private": false,
5
5
  "description": "Javascript SDK for using octopus",
6
6
  "author": "Saooti",
package/src/App.vue CHANGED
@@ -1,14 +1,15 @@
1
1
  <template>
2
- <!-- v-if="isInit" -->
3
- <div :key="reload" class="d-flex flex-column h-100 octopus-app">
4
- <TopBar :is-education="false" />
5
- <CategoryFilter v-if="firstDisplayCategoryFilter" />
6
- <div v-else class="category-filter-no-filter" />
7
- <router-view />
8
- <ClassicLazy v-if="pageFullyLoad" :min-height="125">
9
- <FooterOctopus />
10
- </ClassicLazy>
11
- <PlayerComponent />
2
+ <div class="d-flex flex-column h-100 octopus-app">
3
+ <template v-if="pageFullyLoad">
4
+ <TopBar :is-education="false" />
5
+ <CategoryFilter v-if="firstDisplayCategoryFilter" />
6
+ <div v-else class="category-filter-no-filter" />
7
+ <router-view />
8
+ <ClassicLazy :min-height="125">
9
+ <FooterOctopus />
10
+ </ClassicLazy>
11
+ <PlayerComponent />
12
+ </template>
12
13
  </div>
13
14
  </template>
14
15
 
@@ -48,7 +49,6 @@ export default defineComponent({
48
49
  data() {
49
50
  return {
50
51
  reload: false as boolean,
51
- isInit: false as boolean,
52
52
  pageFullyLoad: false as boolean,
53
53
  firstDisplayCategoryFilter: false as boolean,
54
54
  };
@@ -98,7 +98,6 @@ export default defineComponent({
98
98
  await this.handleOrganisationFilter();
99
99
  this.handleIabIdFilter();
100
100
  this.handleRubriquesFilter();
101
- this.isInit = true;
102
101
  },
103
102
  async handleOrganisationFilter() {
104
103
  let orgaId = "";
@@ -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
  },
@@ -48,6 +48,7 @@
48
48
  target="_blank"
49
49
  class="octopus-dropdown-item justify-content-start"
50
50
  :href="link.url"
51
+ realLink="true"
51
52
  >
52
53
  <span :class="link.icon" class="me-1" /> {{ link.title }}
53
54
  </a>
@@ -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,
@@ -1,4 +1,5 @@
1
1
  import { state } from "../../../stores/ParamSdkStore";
2
+ import dayjs from "dayjs";
2
3
  import { playerLogicProgress} from "./playerLogicProgress";
3
4
  import { usePlayerStore } from "@/stores/PlayerStore";
4
5
  import { useAuthStore } from "@/stores/AuthStore";
@@ -6,6 +7,7 @@ import { mapState, mapActions } from "pinia";
6
7
  /* eslint-disable */
7
8
  let Hls:any = null;
8
9
  /* eslint-enable */
10
+ const maxMinutesSessionId = 1;
9
11
  import { defineComponent } from "vue";
10
12
  export const playerLive = defineComponent({
11
13
  mixins: [playerLogicProgress],
@@ -31,7 +33,20 @@ export const playerLive = defineComponent({
31
33
  },
32
34
  playRadio() {
33
35
  if (!this.playerRadio) return;
34
- this.playHls(this.playerRadio.url);
36
+ this.handleSessionIdRadio();
37
+ this.playHls(this.playerRadio.url+"?origin=octopus&sessionId="+this.playerRadio.sessionId);
38
+ },
39
+ handleSessionIdRadio(){
40
+ if(!this.playerRadio) return;
41
+ if(this.playerRadio.sessionId && dayjs().diff(dayjs(this.playerRadio.dateSessionId), 'm')<maxMinutesSessionId){
42
+ return;
43
+ }
44
+ this.playerRadio.sessionId = this.uuidv4();
45
+ },
46
+ uuidv4() {
47
+ return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, c =>
48
+ (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
49
+ );
35
50
  },
36
51
  playLive() {
37
52
  if (!this.playerLive) return;
@@ -12,6 +12,7 @@ import { usePlayerStore } from "@/stores/PlayerStore";
12
12
  import { mapState, mapActions } from "pinia";
13
13
  import { FetchParam } from "@/stores/class/general/fetchParam";
14
14
  import { useVastStore } from "@/stores/VastStore";
15
+ import dayjs from "dayjs";
15
16
  export const playerLogic = defineComponent({
16
17
  mixins: [cookies, playerLive, playerComment, playerTranscript, playerStitching],
17
18
  data() {
@@ -114,6 +115,7 @@ export const playerLogic = defineComponent({
114
115
  return;
115
116
  }
116
117
  if ("PAUSED" === this.playerStatus && this.playerRadio) {
118
+ this.playerRadio.dateSessionId = dayjs().toISOString();
117
119
  this.hlsReady = false;
118
120
  this.reInitPlayer();
119
121
  this.endingLive();
@@ -58,7 +58,6 @@ export const playerStitching = defineComponent({
58
58
  return this.useVastPlayerPodcast;
59
59
  },
60
60
  defineRadioInterval(){
61
- //TODO remove tag en dur
62
61
  this.clearRadioInterval();
63
62
  const timeRemaining = dayjs(this.radioNextAdvertisingStartDate).diff(dayjs(), "millisecond");
64
63
  console.log("TimeRemaining "+timeRemaining);
@@ -66,6 +65,8 @@ export const playerStitching = defineComponent({
66
65
  return;
67
66
  }
68
67
  this.radioInterval = setTimeout(() => {
68
+ //If pause when ad needs to be played then skipped (TO THINK)
69
+ if("PAUSED"===this.playerStatus){return;}
69
70
  this.onRequestAd(this.getVastUrl(this.playerRadio?.nextAdvertising?.tag ??"5e385e1b51c86"));
70
71
  }, timeRemaining);
71
72
  },
@@ -31,7 +31,10 @@ export const fetchRadioData = defineComponent({
31
31
  );
32
32
  if(callbackAdvertising){
33
33
  //TODO remove mock
34
- //callbackAdvertising("2024-03-12T15:25:00Z");
34
+ /* callbackAdvertising({
35
+ startDate: "2024-03-25T08:21:00Z",
36
+ tag: "5e385e1b51c86"
37
+ }); */
35
38
  callbackAdvertising(metadata.nextAdvertising);
36
39
  }
37
40
  const arrayMetadata = metadata.previously;
@@ -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
  }
@@ -44,22 +44,24 @@
44
44
  :podcast="podcast"
45
45
  :organisation-id="podcast.organisation.id"
46
46
  />
47
- <ClassicLazy :min-height="550">
48
- <PodcastInlineList
49
- class="mt-4"
50
- :podcast-id="podcastId"
51
- :title="$t('Suggested listening')"
52
- />
53
- </ClassicLazy>
54
- <ClassicLazy v-for="c in categories" :key="c.id" :min-height="550">
55
- <PodcastInlineList
56
- class="mt-4"
57
- :iab-id="c.id"
58
- :href="'/main/pub/category/' + c.id"
59
- :title="$t('More episodes of this category : ', { name: c.name })"
60
- :button-text="$t('All podcast button', { name: c.name })"
61
- />
62
- </ClassicLazy>
47
+ <template v-if="!hideSuggestions">
48
+ <ClassicLazy :min-height="550">
49
+ <PodcastInlineList
50
+ class="mt-4"
51
+ :podcast-id="podcastId"
52
+ :title="$t('Suggested listening')"
53
+ />
54
+ </ClassicLazy>
55
+ <ClassicLazy v-for="c in categories" :key="c.id" :min-height="550">
56
+ <PodcastInlineList
57
+ class="mt-4"
58
+ :iab-id="c.id"
59
+ :href="'/main/pub/category/' + c.id"
60
+ :title="$t('More episodes of this category : ', { name: c.name })"
61
+ :button-text="$t('All podcast button', { name: c.name })"
62
+ />
63
+ </ClassicLazy>
64
+ </template>
63
65
  </div>
64
66
  </template>
65
67
  <ClassicLoading
@@ -144,6 +146,14 @@ export default defineComponent({
144
146
 
145
147
  computed: {
146
148
  ...mapState(useGeneralStore, ["storedCategories"]),
149
+ hideSuggestions(): boolean {
150
+ return (
151
+ "true" ===
152
+ (this.podcast?.emission?.annotations?.["HIDE_SUGGESTIONS"] as
153
+ | string
154
+ | undefined)
155
+ );
156
+ },
147
157
  isComments(): boolean {
148
158
  if (!this.podcast) return true;
149
159
  let podcastComment = "INHERIT";
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
  })
@@ -9,6 +9,8 @@ export interface Radio {
9
9
  nextAdvertising:NextAdvertising;
10
10
  isInit: boolean;
11
11
  podcast?: Podcast;
12
+ sessionId?: string;
13
+ dateSessionId?:string;
12
14
  }
13
15
  export interface MediaRadio {
14
16
  artist: string;