@saooti/octopus-sdk 39.0.44 → 39.0.46

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.44",
3
+ "version": "39.0.46",
4
4
  "private": false,
5
5
  "description": "Javascript SDK for using octopus",
6
6
  "author": "Saooti",
@@ -28,6 +28,7 @@
28
28
  <div class="d-flex flex-column flex-grow-1">
29
29
  <SharePlayerTypes
30
30
  v-model:iFrameModel="iFrameModel"
31
+ v-model:typeCustomPlayer="typeCustomPlayer"
31
32
  :podcast="podcast"
32
33
  :emission="emission"
33
34
  :playlist="playlist"
@@ -53,9 +54,7 @@
53
54
  v-model:is-visible="isVisible"
54
55
  v-model:player-auto-play="playerAutoPlay"
55
56
  :is-visible="isVisible"
56
- :chose-number-episode="
57
- displayChoiceAllEpisodes || isLargeSuggestion
58
- "
57
+ :chose-number-episode="choseNumberEpisodes"
59
58
  :display-choice-all-episodes="displayChoiceAllEpisodes"
60
59
  :display-transcript-param="displayTranscriptParam"
61
60
  :display-article-param="displayArticleParam"
@@ -142,6 +141,7 @@ export default defineComponent({
142
141
 
143
142
  data() {
144
143
  return {
144
+ typeCustomPlayer: "",
145
145
  iFrameModel: "default" as string,
146
146
  isShareModal: false as boolean,
147
147
  color: "#40a372" as string,
@@ -166,6 +166,9 @@ export default defineComponent({
166
166
  displayWaveParam(): boolean {
167
167
  return "default" === this.iFrameModel || "emission" === this.iFrameModel;
168
168
  },
169
+ choseNumberEpisodes():boolean{
170
+ return this.displayChoiceAllEpisodes || this.isTypeSuggestion;
171
+ },
169
172
  displayArticleParam(): boolean {
170
173
  return (
171
174
  undefined !== this.podcast &&
@@ -204,7 +207,7 @@ export default defineComponent({
204
207
  : false;
205
208
  },
206
209
  displayChoiceAllEpisodes(): boolean {
207
- return !this.podcast || this.isEmission || this.isLargeEmission;
210
+ return !this.podcast || this.isTypeEmission;
208
211
  },
209
212
  baseUrl(): string {
210
213
  return state.podcastPage.MiniplayerUri as string;
@@ -218,8 +221,11 @@ export default defineComponent({
218
221
  isLargeEmission(): boolean {
219
222
  return "emissionLarge" === this.iFrameModel;
220
223
  },
221
- isLargeSuggestion(): boolean {
222
- return "largeSuggestion" === this.iFrameModel;
224
+ isTypeSuggestion(): boolean {
225
+ return "largeSuggestion" === this.iFrameModel || "SUGGESTION"===this.typeCustomPlayer;
226
+ },
227
+ isTypeEmission():boolean{
228
+ return this.isEmission || this.isLargeEmission || "EMISSION"===this.typeCustomPlayer;
223
229
  },
224
230
  titleStillAvailable(): string {
225
231
  return this.isPodcastNotVisible
@@ -263,11 +269,11 @@ export default defineComponent({
263
269
  url = this.constructPlaylistUrl(url);
264
270
  } else if (this.emission && this.podcast) {
265
271
  url.push(`${this.iFrameModel}/`);
266
- if (this.isEmission || this.isLargeEmission) {
272
+ if (this.isTypeEmission) {
267
273
  url.push(
268
274
  `${this.emission.emissionId}${iFrameNumber}/${this.podcast.podcastId}`,
269
275
  );
270
- } else if (this.isLargeSuggestion) {
276
+ } else if (this.isTypeSuggestion) {
271
277
  url.push(`${this.podcast.podcastId}${iFrameNumber}`);
272
278
  } else {
273
279
  url.push(`${this.podcast.podcastId}`);
@@ -3,8 +3,7 @@
3
3
  <select
4
4
  id="iframe-select"
5
5
  :value="iFrameModel"
6
- class=""
7
- @change="$emit('update:iFrameModel', $event.target.value)"
6
+ @change="selectChange($event)"
8
7
  >
9
8
  <template v-for="option in optionsSelect" :key="option.value">
10
9
  <option v-if="option.condition" :value="option.value">
@@ -36,10 +35,11 @@ export default defineComponent({
36
35
  emission: { default: undefined, type: Object as () => Emission },
37
36
  playlist: { default: undefined, type: Object as () => Playlist },
38
37
  iFrameModel: { default: "default", type: String },
38
+ typeCustomPlayer: { default: "", type: String },
39
39
  organisationId: { default: undefined, type: String },
40
40
  isLive: { default: false, type: Boolean },
41
41
  },
42
- emits: ["update:iFrameModel"],
42
+ emits: ["update:iFrameModel", "update:typeCustomPlayer"],
43
43
 
44
44
  data() {
45
45
  return {
@@ -120,10 +120,24 @@ export default defineComponent({
120
120
  this.initCustomPlayers();
121
121
  },
122
122
  methods: {
123
- async fetchCustomPlayers(
124
- type: string,
125
- trySelect: boolean,
126
- ): Promise<boolean> {
123
+ isNumeric(value: string):boolean {
124
+ return /^-?\d+$/.test(value);
125
+ },
126
+ selectChange($event: any){
127
+ const val = $event.target.value;
128
+ if(!val){
129
+ return;
130
+ }
131
+ if(this.isNumeric(val)){
132
+ var customPlayer = this.customPlayersDisplay.find((p) => {return p.customId.toString() === val});
133
+ if(customPlayer){
134
+ this.selectCustomPlayer(customPlayer);
135
+ }
136
+ }else{
137
+ this.$emit('update:iFrameModel',val)
138
+ }
139
+ },
140
+ async fetchPlayerPaginate(type: string): Promise<CustomPlayer[]>{
127
141
  let players = await octopusApi.fetchDataPublic<
128
142
  InterfacePageable<CustomPlayer>
129
143
  >(6, "customPlayer/type/" + this.organisationId + "/" + type);
@@ -145,38 +159,35 @@ export default defineComponent({
145
159
  playersContent = playersContent.concat(players.content);
146
160
  ++index;
147
161
  }
148
- this.customPlayers = this.customPlayers.concat(playersContent);
162
+ return playersContent;
163
+ },
164
+ selectCustomPlayer(customPlayer: CustomPlayer){
165
+ this.$emit("update:typeCustomPlayer", customPlayer.typePlayer);
166
+ this.$emit("update:iFrameModel",customPlayer.customId.toString());
167
+ },
168
+ async fetchCustomPlayers(type: string, selectIfPossible = true): Promise<boolean> {
169
+ let customPlayersForType = await this.fetchPlayerPaginate(type);
170
+ this.customPlayers = this.customPlayers.concat(customPlayersForType);
149
171
  if (
150
172
  "video" !== this.iFrameModel &&
151
- trySelect &&
152
- this.customPlayers[0] &&
153
- this.customPlayers[0].selected
173
+ selectIfPossible &&
174
+ customPlayersForType?.[0]?.selected
154
175
  ) {
155
- this.$emit(
156
- "update:iFrameModel",
157
- this.customPlayers[0].customId.toString(),
158
- );
159
- return false;
176
+ this.selectCustomPlayer(this.customPlayers[0]);
177
+ return true;
160
178
  }
161
- return true;
179
+ return false;
162
180
  },
163
181
  async initCustomPlayers(): Promise<void> {
164
182
  if (!state.generalParameters.authenticated) return;
165
183
  if (this.playlist) {
166
- this.fetchCustomPlayers("PLAYLIST", true);
184
+ this.fetchCustomPlayers("PLAYLIST");
167
185
  } else if (this.emission && !this.podcast) {
168
- this.fetchCustomPlayers("EMISSION", true);
186
+ this.fetchCustomPlayers("EMISSION");
169
187
  } else {
170
- let playerTrySelect = true;
171
- playerTrySelect = await this.fetchCustomPlayers(
172
- "EPISODE",
173
- playerTrySelect,
174
- );
175
- playerTrySelect = await this.fetchCustomPlayers(
176
- "EMISSION",
177
- playerTrySelect,
178
- );
179
- await this.fetchCustomPlayers("SUGGESTION", playerTrySelect);
188
+ const episodeSelected = await this.fetchCustomPlayers("EPISODE");
189
+ const emissionSelected = await this.fetchCustomPlayers("EMISSION", !episodeSelected);
190
+ await this.fetchCustomPlayers("SUGGESTION", !episodeSelected && !emissionSelected);
180
191
  }
181
192
  },
182
193
  },
@@ -20,10 +20,12 @@
20
20
  :disabled="isDisabled"
21
21
  :loading="isLoading"
22
22
  :placeholder="placeholder"
23
+ :clearSearchOnBlur="()=>{return true}"
23
24
  :filter="fakeSearch"
24
25
  :selectable="() => !maxOptionsSelected"
25
26
  @open="onSearch"
26
27
  @search="onSearch"
28
+ @close="onClose"
27
29
  @option:selected="onOptionSelected"
28
30
  @option:deselected="onOptionDeselect"
29
31
  >
@@ -90,7 +92,7 @@ export default {
90
92
  allowEmpty: { default: true, type: Boolean },
91
93
  },
92
94
 
93
- emits: ["onSearch", "selected"],
95
+ emits: ["onSearch", "selected", "onClose"],
94
96
 
95
97
  data() {
96
98
  return {
@@ -99,6 +101,7 @@ export default {
99
101
  remainingElements: 0 as number,
100
102
  isLoading: false as boolean,
101
103
  nbOptionsSelected: 0 as number,
104
+ searchInput: "" as string
102
105
  };
103
106
  },
104
107
  computed: {
@@ -135,13 +138,19 @@ export default {
135
138
  fakeSearch(): Array<unknown> {
136
139
  return this.options;
137
140
  },
138
- onSearch(search: string): void {
141
+ onSearch(search?: string): void {
139
142
  if (search && search.length < this.minSearchLength) {
140
143
  return;
144
+ }else if(search){
145
+ this.searchInput = search;
141
146
  }
142
147
  this.isLoading = true;
143
148
  this.$emit("onSearch", search);
144
149
  },
150
+ onClose(){
151
+ this.$emit("onClose", this.searchInput);
152
+ this.searchInput = "";
153
+ },
145
154
  afterSearch(optionsFetched: Array<unknown>, count: number): void {
146
155
  this.options = optionsFetched;
147
156
  this.remainingElements = Math.max(0, count - this.maxElement);
@@ -156,7 +165,7 @@ export default {
156
165
  }
157
166
  if (
158
167
  !this.allowEmpty &&
159
- 1 >= (this.optionSelected as Array<unknown>).length
168
+ 0 === (this.optionSelected as Array<unknown>).length
160
169
  ) {
161
170
  (this.optionSelected as Array<unknown>).push(event);
162
171
  return;
@@ -41,8 +41,8 @@
41
41
  </svg>
42
42
  </button>
43
43
  <button
44
- :title="$t('Delete link')"
45
- data-selenium="unlink"
44
+ :title="$t('Link')"
45
+ data-selenium="link"
46
46
  :class="{ 'is-active': editor.isActive('link') }"
47
47
  @click="setLink"
48
48
  >
@@ -58,8 +58,8 @@
58
58
  </svg>
59
59
  </button>
60
60
  <button
61
- :title="$t('Unlink')"
62
- data-selenium="Heading3"
61
+ :title="$t('Delete link')"
62
+ data-selenium="unlink"
63
63
  :disabled="!editor.isActive('link')"
64
64
  @click="editor.chain().focus().unsetLink().run()"
65
65
  >
@@ -5,14 +5,14 @@ const state: ParamStore = {
5
5
  generalParameters: {
6
6
  organisationId: "ecbd98d9-79bd-4312-ad5e-fc7c1c4a191c",
7
7
  authenticated: false,
8
- isAdmin: false,
9
- isRoleLive: false,
10
- isCommments: false,
11
- isOrganisation:false,
12
- isPlaylist: false,
13
- isProduction: false,
14
- isContribution: false,
15
- isRadio: false,
8
+ isAdmin: true,
9
+ isRoleLive: true,
10
+ isCommments: true,
11
+ isOrganisation:true,
12
+ isPlaylist: true,
13
+ isProduction: true,
14
+ isContribution: true,
15
+ isRadio: true,
16
16
  ApiUri: "https://api.dev2.saooti.org/",
17
17
  podcastmaker: false,
18
18
  buttonPlus: true,