@saooti/octopus-sdk 37.0.50 → 37.0.52

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": "37.0.50",
3
+ "version": "37.0.52",
4
4
  "private": false,
5
5
  "description": "Javascript SDK for using octopus",
6
6
  "author": "Saooti",
@@ -1,47 +1,19 @@
1
1
  <template>
2
2
  <div class="d-flex flex-column p-3 list-episode">
3
- <div v-if="!overflowScroll" class="d-flex justify-content-end">
4
- <div class="hide-phone">
5
- <button
6
- class="btn admin-button m-1 saooti-left"
7
- :class="{ disabled: !previousAvailable }"
8
- :title="$t('Display previous')"
9
- @click="displayPrevious()"
10
- />
11
- <button
12
- class="btn admin-button m-1 saooti-right"
13
- :class="{ disabled: !nextAvailable }"
14
- :title="$t('Display next')"
15
- @click="displayNext()"
16
- />
17
- </div>
18
- </div>
19
3
  <ClassicLoading
20
4
  :loading-text="loading ? $t('Loading emissions ...') : undefined"
21
5
  />
22
- <transition-group
23
- v-show="
24
- (displayRubriquage && rubriques) || !(displayRubriquage && loaded)
25
- "
26
- :name="transitionName"
27
- class="element-list-inline"
28
- tag="div"
29
- :class="[
30
- alignLeft ? 'justify-content-start' : '',
31
- overflowScroll ? 'overflowScroll' : '',
32
- ]"
33
- :css="isInlineAnimation"
34
- >
35
- <EmissionPlayerItem
36
- v-for="e in emissions"
37
- :key="e.emissionId"
38
- class="flex-shrink-0 item-phone-margin"
39
- :emission="e"
40
- :class="[alignLeft ? 'me-3' : '', mainRubriquage(e)]"
41
- :nb-podcasts="nbPodcasts"
42
- :rubrique-name="rubriquesId(e)"
43
- />
44
- </transition-group>
6
+ <SwiperList v-if="(displayRubriquage && rubriques) || !(displayRubriquage && loaded)" :sizeItemOverload="itemSize" :list-object="allEmissions">
7
+ <template #octopusSlide="{ option }">
8
+ <EmissionPlayerItem
9
+ class="flex-shrink-0 item-phone-margin"
10
+ :emission="option"
11
+ :class="[mainRubriquage(option)]"
12
+ :nb-podcasts="nbPodcasts"
13
+ :rubrique-name="rubriquesId(option)"
14
+ />
15
+ </template>
16
+ </SwiperList>
45
17
  <router-link
46
18
  :to="href"
47
19
  class="btn btn-primary align-self-center width-fit-content m-4"
@@ -52,12 +24,11 @@
52
24
  </template>
53
25
 
54
26
  <script lang="ts">
27
+ import SwiperList from "../list/SwiperList.vue";
55
28
  import octopusApi from "@saooti/octopus-api";
56
- import domHelper from "../../../helper/dom";
57
29
  import EmissionPlayerItem from "./EmissionPlayerItem.vue";
58
30
  import { state } from "../../../stores/ParamSdkStore";
59
31
  import { handle403 } from "../../mixins/handle403";
60
- const PHONE_WIDTH = 960;
61
32
  import ClassicLoading from "../../form/ClassicLoading.vue";
62
33
  import { Emission } from "@/stores/class/general/emission";
63
34
  import { Rubrique } from "@/stores/class/rubrique/rubrique";
@@ -72,6 +43,7 @@ export default defineComponent({
72
43
  components: {
73
44
  EmissionPlayerItem,
74
45
  ClassicLoading,
46
+ SwiperList
75
47
  },
76
48
 
77
49
  mixins: [handle403, imageProxy, resizePhone],
@@ -83,69 +55,21 @@ export default defineComponent({
83
55
  rubriqueId: { default: undefined, type: Number },
84
56
  rubriquageId: { default: undefined, type: Number },
85
57
  nbPodcasts: { default: undefined, type: Number },
86
- itemSize: { default: 13, type: Number },
58
+ itemSize: { default: undefined, type: Number },
87
59
  },
88
60
 
89
61
  data() {
90
62
  return {
91
63
  loading: true as boolean,
92
- loaded: true as boolean,
93
- index: 0 as number,
94
- first: 0 as number,
95
- size: 5 as number,
96
- totalCount: 0 as number,
97
- popularSort: true as boolean,
98
64
  allEmissions: [] as Array<Emission>,
99
- direction: 1 as number,
100
- alignLeft: false as boolean,
101
65
  rubriques: undefined as Array<Rubrique> | undefined,
102
- isPhone: false as boolean,
103
- windowWidth: 0 as number,
104
66
  };
105
67
  },
106
68
 
107
69
  computed: {
108
- emissions(): Array<Emission> {
109
- return this.allEmissions.slice(this.index, this.index + this.size);
110
- },
111
- overflowScroll(): boolean {
112
- return state.emissionsPage.overflowScroll as boolean;
113
- },
114
- previousAvailable(): boolean {
115
- return this.index > 0;
116
- },
117
- nextAvailable(): boolean {
118
- return this.index + this.size < this.totalCount;
119
- },
120
70
  displayRubriquage(): number | undefined {
121
71
  return state.emissionsPage.rubriquage;
122
72
  },
123
- transitionName(): string {
124
- return this.direction > 0 ? "out-left" : "out-right";
125
- },
126
- isInlineAnimation(): boolean {
127
- return state.generalParameters.isInlineAnimation as boolean;
128
- },
129
- },
130
-
131
- watch: {
132
- sizeItem() {
133
- this.handleResize();
134
- },
135
- windowWidth() {
136
- if (!this.$el) return;
137
- if (this.overflowScroll) {
138
- this.size = 20;
139
- return;
140
- }
141
- if (window.innerWidth <= PHONE_WIDTH) {
142
- this.size = 10;
143
- return;
144
- }
145
- const width = (this.$el as HTMLElement).offsetWidth;
146
- const sixteen = domHelper.convertRemToPixels(this.itemSize + 0.7);
147
- this.size = Math.floor(width / sixteen);
148
- },
149
73
  },
150
74
 
151
75
  mounted() {
@@ -165,8 +89,8 @@ export default defineComponent({
165
89
  0,
166
90
  "emission/search",
167
91
  {
168
- first: this.first,
169
- size: this.size + 1,
92
+ first: 0,
93
+ size: 10,
170
94
  organisationId: this.organisationId,
171
95
  rubriqueId: this.rubriqueId ? [this.rubriqueId] : [],
172
96
  rubriquageId: this.rubriquageId ? [this.rubriquageId] : [],
@@ -174,52 +98,19 @@ export default defineComponent({
174
98
  },
175
99
  true,
176
100
  );
177
-
101
+ this.allEmissions = this.allEmissions.concat(
102
+ data.result.filter((em: Emission | null) => null !== em),
103
+ );
178
104
  this.loading = false;
179
- this.loaded = true;
180
- this.totalCount = data.count;
181
- if (this.allEmissions.length + data.result.length < this.totalCount) {
182
- const nexEl = data.result.pop() as Emission;
183
- this.preloadImage(nexEl.imageUrl ? nexEl.imageUrl : "");
184
- }
185
- this.allEmissions = this.allEmissions.concat(data.result);
186
- if (this.allEmissions.length <= 3) {
187
- this.alignLeft = true;
188
- }
189
- this.first += this.size;
190
105
  } catch (error) {
191
106
  this.handle403(error as AxiosError);
192
107
  }
193
108
  },
194
- displayPrevious(): void {
195
- this.direction = -1;
196
- if (this.previousAvailable) {
197
- this.index -= 1;
198
- }
199
- },
200
- displayNext(): void {
201
- this.direction = 1;
202
- if (!this.nextAvailable) return;
203
- if (
204
- this.first - (this.index + this.size) < 2 &&
205
- this.allEmissions.length < this.totalCount
206
- ) {
207
- this.fetchNext();
208
- }
209
- this.index += 1;
210
- },
109
+
211
110
  reset(): void {
212
111
  this.loading = true;
213
- this.loaded = true;
214
- this.index = 0;
215
- this.first = 0;
216
- this.totalCount = 0;
217
112
  this.allEmissions.length = 0;
218
113
  },
219
- preloadImage(url: string): void {
220
- const img = new Image();
221
- img.src = this.proxyImageUrl(url, "330");
222
- },
223
114
  async fetchRubriques(): Promise<void> {
224
115
  const data = await octopusApi.fetchData<Rubriquage>(
225
116
  0,
@@ -34,6 +34,7 @@
34
34
  :emission="e"
35
35
  class="m-3 flex-shrink-0"
36
36
  :class="mainRubriquage(e)"
37
+ :nb-podcasts="nbPodcasts"
37
38
  :rubrique-name="rubriquesId(e)"
38
39
  />
39
40
  </template>
@@ -85,6 +86,7 @@ export default defineComponent({
85
86
  rubriqueId: { default: () => [], type: Array as () => Array<number> },
86
87
  rubriquageId: { default: () => [], type: Array as () => Array<number> },
87
88
  noRubriquageId: { default: () => [], type: Array as () => Array<number> },
89
+ nbPodcasts: { default: undefined, type: Number },
88
90
  },
89
91
 
90
92
  data() {
@@ -24,21 +24,8 @@
24
24
  {{ emission.name }}
25
25
  </div>
26
26
  </div>
27
- <div class="d-flex flex-column p-2">
28
- <div class="fw-bold text-uppercase text-truncate">
29
- {{ emission.name }}
30
- </div>
31
- <div
32
- ref="descriptionEmissionContainer"
33
- class="emission-description html-wysiwyg-content"
34
- >
35
- <!-- eslint-disable vue/no-v-html -->
36
- <div
37
- ref="descriptionEmission"
38
- v-html="urlify(emission.description)"
39
- />
40
- <!-- eslint-enable -->
41
- </div>
27
+ <div class="fw-bold text-uppercase text-truncate p-2">
28
+ {{ emission.name }}
42
29
  </div>
43
30
  </router-link>
44
31
  <div
@@ -66,22 +53,11 @@
66
53
  params: { podcastId: p.podcastId },
67
54
  query: { productor: filterOrgaId },
68
55
  }"
69
- class="d-flex flex-column define-width text-dark"
56
+ class="d-flex flex-grow-1 align-items-center define-width text-dark"
70
57
  >
71
58
  <div class="fw-bold text-truncate">
72
59
  {{ p.title }}
73
60
  </div>
74
- <div
75
- :ref="'descriptionPodcastContainer' + p.podcastId"
76
- class="emission-description html-wysiwyg-content"
77
- >
78
- <!-- eslint-disable vue/no-v-html -->
79
- <div
80
- :ref="'descriptionPodcast' + p.podcastId"
81
- v-html="urlify(p.description)"
82
- />
83
- <!-- eslint-enable -->
84
- </div>
85
61
  </router-link>
86
62
  <PodcastPlayBar :podcast-id="p.podcastId" :duration="p.duration" />
87
63
  </div>
@@ -180,18 +156,6 @@ export default defineComponent({
180
156
  created() {
181
157
  this.loadPodcasts();
182
158
  },
183
- mounted() {
184
- const emissionDesc = this.$refs.descriptionEmission as HTMLElement;
185
- const emissionDescContainer = this.$refs
186
- .descriptionEmissionContainer as HTMLElement;
187
- if (
188
- null !== emissionDesc &&
189
- null !== emissionDescContainer &&
190
- emissionDesc.clientHeight > emissionDescContainer.clientHeight
191
- ) {
192
- emissionDescContainer.classList.add("after-emission-description");
193
- }
194
- },
195
159
  methods: {
196
160
  ...mapActions(usePlayerStore, ["playerPlay", "playerChangeStatus"]),
197
161
  play(podcast: Podcast): void {
@@ -224,29 +188,6 @@ export default defineComponent({
224
188
  this.activeEmission = false;
225
189
  }
226
190
  this.podcasts = data.result;
227
- this.$nextTick(() => {
228
- for (let index = 0, len = this.podcasts.length; index < len; index++) {
229
- const podcastDesc =
230
- (
231
- this.$refs[
232
- "descriptionPodcast" + this.podcasts[index].podcastId
233
- ] as Array<HTMLElement>
234
- )?.[0] ?? null;
235
- const podcastDescContainer =
236
- (
237
- this.$refs[
238
- "descriptionPodcastContainer" + this.podcasts[index].podcastId
239
- ] as Array<HTMLElement>
240
- )?.[0] ?? null;
241
- if (
242
- null !== podcastDesc &&
243
- null !== podcastDescContainer &&
244
- podcastDesc.clientHeight > podcastDescContainer.clientHeight
245
- ) {
246
- podcastDescContainer.classList.add("after-emission-description");
247
- }
248
- }
249
- });
250
191
  },
251
192
  },
252
193
  });
@@ -268,25 +209,6 @@ export default defineComponent({
268
209
  .emission-item-border-color {
269
210
  border-color: #ddd;
270
211
  }
271
- .emission-description {
272
- overflow: hidden;
273
- margin-top: 0.5em;
274
- word-break: break-word;
275
- max-height: 3.5rem;
276
- position: relative;
277
- &.after-emission-description:after {
278
- content: "...";
279
- position: absolute;
280
- padding-left: 1rem;
281
- right: 0;
282
- bottom: 0;
283
- width: 100%;
284
- font-size: 1rem;
285
- font-weight: bolder;
286
- text-align: center;
287
- background: linear-gradient(to bottom, rgba(255, 255, 255, 0), #fff 40%);
288
- }
289
- }
290
212
  .define-width {
291
213
  width: 9rem;
292
214
  }