@saooti/octopus-sdk 40.1.14 → 40.1.16

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": "40.1.14",
3
+ "version": "40.1.16",
4
4
  "private": false,
5
5
  "description": "Javascript SDK for using octopus",
6
6
  "author": "Saooti",
@@ -59,23 +59,11 @@
59
59
  </router-link>
60
60
  <PodcastPlayBar
61
61
  v-else
62
- :podcast-id="p.podcastId"
63
- :duration="p.duration"
62
+ :displayButonPlay="true"
63
+ :podcast="p"
64
64
  />
65
65
  </div>
66
- <button
67
- v-if="
68
- playerPodcast !== p ||
69
- (playerPodcast === p && 'PAUSED' === playerStatus)
70
- "
71
- class="play-button-box bg-secondary-light"
72
- @click="play(p)"
73
- >
74
- <PlayIcon class="text-light" :title="$t('Play')" />
75
- </button>
76
- <button v-else class="play-button-box bg-secondary-light" @click="pause(p)">
77
- <PauseIcon class="text-light" :title="$t('Pause')" />
78
- </button>
66
+ <PodcastPlayBasicButton v-if="!isProgressBar"/>
79
67
  </div>
80
68
  </div>
81
69
  <div
@@ -96,28 +84,24 @@
96
84
  </template>
97
85
 
98
86
  <script lang="ts">
99
- import PlayIcon from "vue-material-design-icons/Play.vue";
100
- import PauseIcon from "vue-material-design-icons/Pause.vue";
101
87
  import classicApi from "../../../api/classicApi";
102
88
  import { Emission } from "@/stores/class/general/emission";
103
89
  import { Podcast } from "@/stores/class/general/podcast";
104
90
  import { state } from "../../../stores/ParamSdkStore";
105
91
  import {useImageProxy} from "../../composable/useImageProxy";
106
92
  import {useOrgaComputed} from "../../composable/useOrgaComputed";
107
- import { usePlayerStore } from "../../../stores/PlayerStore";
108
- import { mapState, mapActions } from "pinia";
109
93
  import { defineAsyncComponent, defineComponent } from "vue";
110
94
  import { ListClassicReturn } from "@/stores/class/general/listReturn";
111
95
  const PodcastPlayBar = defineAsyncComponent(
112
96
  () => import("../podcasts/PodcastPlayBar.vue"),
113
97
  );
98
+ const PodcastPlayBasicButton = defineAsyncComponent(() => import("./PodcastPlayBasicButton.vue"));
114
99
  export default defineComponent({
115
100
  name: "EmissionPlayerItem",
116
101
 
117
102
  components: {
118
103
  PodcastPlayBar,
119
- PlayIcon,
120
- PauseIcon,
104
+ PodcastPlayBasicButton
121
105
  },
122
106
  props: {
123
107
  emission: { default: () => ({}), type: Object as () => Emission },
@@ -138,7 +122,6 @@ export default defineComponent({
138
122
  },
139
123
 
140
124
  computed: {
141
- ...mapState(usePlayerStore, ["playerPodcast", "playerStatus"]),
142
125
  isProgressBar(): boolean {
143
126
  return state.emissionsPage.progressBar as boolean;
144
127
  },
@@ -154,17 +137,6 @@ export default defineComponent({
154
137
  this.loadPodcasts();
155
138
  },
156
139
  methods: {
157
- ...mapActions(usePlayerStore, ["playerPlay", "playerChangeStatus"]),
158
- play(podcast: Podcast): void {
159
- if (podcast === this.playerPodcast) {
160
- this.playerChangeStatus(false);
161
- } else {
162
- this.playerPlay(podcast);
163
- }
164
- },
165
- pause(): void {
166
- this.playerChangeStatus(true);
167
- },
168
140
  async loadPodcasts(): Promise<void> {
169
141
  const nb = this.nbPodcasts ? this.nbPodcasts : 2;
170
142
  const data = await classicApi.fetchData<ListClassicReturn<Podcast>>({
@@ -31,13 +31,7 @@
31
31
  @mouseleave="debounceHideDescriptionEvent"
32
32
  >
33
33
  <PodcastItemInfo
34
- :podcast-id="podcast.podcastId"
35
- :title="podcast.title"
36
- :pub-date="podcast.pubDate"
37
- :podcast-organisation-id="podcast.organisation.id"
38
- :podcast-organisation-name="podcast.organisation.name"
39
- :duration="podcast.duration"
40
- :animators="podcast.animators"
34
+ :podcast="podcast"
41
35
  />
42
36
  </div>
43
37
  </article>
@@ -1,39 +1,39 @@
1
1
  <template>
2
2
  <div>
3
3
  <time
4
- :datetime="pubDate"
4
+ :datetime="podcast.pubDate"
5
5
  class="text-secondary h6 ms-2">
6
6
  {{ date }}
7
7
  </time>
8
8
  <router-link
9
9
  :to="{
10
10
  name: 'podcast',
11
- params: { podcastId: podcastId },
11
+ params: { podcastId: podcast.podcastId },
12
12
  }"
13
- class="text-dark flex-grow-1 title-podcast-item basic-line-clamp three-line"
14
- :title="$t('Episode name page', { name: title })"
13
+ class="text-dark flex-grow-1 podcast.title-podcast-item basic-line-clamp three-line"
14
+ :podcast.title="$t('Episode name page', { name: podcast.title })"
15
15
  >
16
- {{ title }}
16
+ {{ podcast.title }}
17
17
  </router-link>
18
18
  <PodcastPlayBar
19
19
  v-if="isProgressBar"
20
- :podcast-id="podcastId"
21
- :duration="duration"
22
- class="mx-2"
20
+ :display-buton-play="true"
21
+ :podcast="podcast"
22
+ class="me-2"
23
23
  />
24
24
 
25
25
  <div class="mx-2 d-flex align-items-center justify-content-between mt-2">
26
26
  <div v-if="isPodcastmaker" class="useless-div-for-podcastmaker" />
27
27
  <AnimatorsItem
28
- v-if="animators && 0 !== animators.length"
28
+ v-if="podcast.animators && 0 !== podcast.animators.length"
29
29
  class="w-0 flex-grow-1"
30
- :animator="animators[0]"
30
+ :animator="podcast.animators[0]"
31
31
  />
32
32
  <router-link
33
33
  v-if="!isPodcastmaker"
34
34
  :to="{
35
35
  name: 'productor',
36
- params: { productorId: podcastOrganisationId },
36
+ params: { productorId: podcast.organisation.id },
37
37
  }"
38
38
  class="text-dark producer-podcast-item"
39
39
  >
@@ -45,11 +45,10 @@
45
45
 
46
46
  <script lang="ts">
47
47
  import AnimatorsItem from "./AnimatorsItem.vue";
48
- import { state } from "../../../stores/ParamSdkStore";
49
48
  import {useOrgaComputed} from "../../composable/useOrgaComputed";
50
49
  import dayjs from "dayjs";
51
50
  import { defineAsyncComponent, defineComponent } from "vue";
52
- import { Participant } from "@/stores/class/general/participant";
51
+ import { Podcast } from "@/stores/class/general/podcast";
53
52
  const PodcastPlayBar = defineAsyncComponent(
54
53
  () => import("./PodcastPlayBar.vue"),
55
54
  );
@@ -62,13 +61,7 @@ export default defineComponent({
62
61
  },
63
62
 
64
63
  props: {
65
- podcastId: { default: undefined, type: Number },
66
- title: { default: "", type: String },
67
- pubDate: { default: "", type: String },
68
- podcastOrganisationId: { default: "", type: String },
69
- podcastOrganisationName: { default: "", type: String },
70
- duration: { default: 0, type: Number },
71
- animators: { default: undefined, type: Object as () => Array<Participant> },
64
+ podcast: { default: () => ({}), type: Object as () => Podcast },
72
65
  },
73
66
 
74
67
  setup(){
@@ -81,16 +74,16 @@ export default defineComponent({
81
74
  return state.emissionsPage.progressBar as boolean;
82
75
  },
83
76
  date(): string {
84
- return dayjs(this.pubDate).format("D MMMM YYYY");
77
+ return dayjs(this.podcast.pubDate).format("D MMMM YYYY");
85
78
  },
86
79
  editRight(): boolean {
87
- return this.isEditRights(this.podcastOrganisationId);
80
+ return this.isEditRights(this.podcast.organisation.id);
88
81
  },
89
82
  orgaNameDisplay(): string {
90
- if (this.podcastOrganisationName.length > 30) {
91
- return this.podcastOrganisationName.substring(0, 30) + "...";
83
+ if (this.podcast.organisation.name.length > 30) {
84
+ return this.podcast.organisation.name.substring(0, 30) + "...";
92
85
  }
93
- return this.podcastOrganisationName;
86
+ return this.podcast.organisation.name;
94
87
  },
95
88
  },
96
89
  });
@@ -98,7 +91,7 @@ export default defineComponent({
98
91
 
99
92
  <style lang="scss">
100
93
  .octopus-app {
101
- .title-podcast-item {
94
+ .podcast.title-podcast-item {
102
95
  font-weight: 700;
103
96
  margin: 0.25rem 0.5rem 0.5rem;
104
97
  flex-grow: 1;
@@ -93,8 +93,7 @@
93
93
  </a>
94
94
  <PodcastPlayBar
95
95
  v-if="isProgressBar"
96
- :podcast-id="podcast.podcastId"
97
- :duration="podcast.duration"
96
+ :podcast="podcast"
98
97
  />
99
98
  <div v-if="editRight && !isPodcastmaker">
100
99
  <div
@@ -1,17 +1,20 @@
1
1
  <template>
2
- <div class="d-flex align-items-center podcast-play-bar">
3
- <div class="me-2">
4
- {{ playedTime }}
5
- </div>
6
- <div class="position-relative flex-grow-1">
7
- <ProgressBar
8
- :main-progress="percentProgress"
9
- class="medium"
10
- @mouseup="seekTo"
11
- />
12
- </div>
13
- <div class="ms-2">
14
- {{ totalTime }}
2
+ <div class="d-flex align-items-center">
3
+ <PodcastPlayBasicButton v-if="displayButonPlay" :podcast="podcast"/>
4
+ <div class="d-flex align-items-center podcast-play-bar flex-grow-1">
5
+ <div class="me-2">
6
+ {{ playedTime }}
7
+ </div>
8
+ <div class="position-relative flex-grow-1">
9
+ <ProgressBar
10
+ :main-progress="percentProgress"
11
+ class="medium"
12
+ @mouseup="seekTo"
13
+ />
14
+ </div>
15
+ <div class="ms-2">
16
+ {{ totalTime }}
17
+ </div>
15
18
  </div>
16
19
  </div>
17
20
  </template>
@@ -21,30 +24,34 @@ import ProgressBar from "../../misc/ProgressBar.vue";
21
24
  import DurationHelper from "../../../helper/durationHelper";
22
25
  import { usePlayerStore } from "../../../stores/PlayerStore";
23
26
  import { mapState, mapActions } from "pinia";
24
- import { defineComponent } from "vue";
27
+ import { defineAsyncComponent, defineComponent } from "vue";
28
+ import { Podcast } from "@/stores/class/general/podcast";
29
+ const PodcastPlayBasicButton = defineAsyncComponent(() => import("./PodcastPlayBasicButton.vue"));
25
30
  export default defineComponent({
26
31
  name: "PodcastPlayBar",
27
32
  components: {
28
33
  ProgressBar,
34
+ PodcastPlayBasicButton
29
35
  },
30
36
  props: {
31
- podcastId: { default: undefined, type: Number },
32
- duration: { default: 0, type: Number },
37
+ podcast: { default: () => ({}), type: Object as () => Podcast },
38
+ displayButonPlay:{ default: false, type: Boolean },
33
39
  },
34
40
  computed: {
35
41
  ...mapState(usePlayerStore, [
36
42
  "playerPodcast",
37
43
  "playerElapsed",
38
44
  "playerTotal",
45
+ "playerStatus"
39
46
  ]),
40
47
  percentProgress(): number {
41
- if (this.podcastId !== this.playerPodcast?.podcastId) {
48
+ if (this.podcast?.podcastId !== this.playerPodcast?.podcastId) {
42
49
  return 0;
43
50
  }
44
51
  return !this.playerElapsed ? 0 : this.playerElapsed * 100;
45
52
  },
46
53
  playedTime(): string {
47
- if (this.podcastId === this.playerPodcast?.podcastId) {
54
+ if (this.podcast?.podcastId === this.playerPodcast?.podcastId) {
48
55
  if (
49
56
  this.playerElapsed &&
50
57
  this.playerElapsed > 0 &&
@@ -59,7 +66,7 @@ export default defineComponent({
59
66
  return "00:00";
60
67
  },
61
68
  totalTime(): string {
62
- return DurationHelper.formatDuration(Math.round(this.duration / 1000));
69
+ return DurationHelper.formatDuration(Math.round(this.podcast.duration / 1000));
63
70
  },
64
71
  },
65
72
  methods: {
@@ -67,7 +74,7 @@ export default defineComponent({
67
74
  seekTo(event: MouseEvent): void {
68
75
  if (
69
76
  !this.playerPodcast ||
70
- this.podcastId !== this.playerPodcast.podcastId
77
+ this.podcast?.podcastId !== this.playerPodcast.podcastId
71
78
  ) {
72
79
  return;
73
80
  }
@@ -75,9 +82,8 @@ export default defineComponent({
75
82
  const barWidth = (event.currentTarget as Element).clientWidth;
76
83
  const x = event.clientX - rect.left;
77
84
  const percentPosition = x / barWidth;
78
- if (percentPosition * 100 >= this.percentLiveProgress) return;
79
85
  this.playerUpdateSeekTime(this.playerTotal * percentPosition);
80
86
  },
81
87
  },
82
88
  });
83
- </script>
89
+ </script>
@@ -0,0 +1,57 @@
1
+ <template>
2
+ <button
3
+ class="btn play-button-box bg-primary"
4
+ @click="clickBtn(podcast)"
5
+ >
6
+ <PlayIcon v-if="btnPlay" class="text-light" :title="$t('Play')" />
7
+ <PauseIcon v-else class="text-light" :title="$t('Pause')" />
8
+ </button>
9
+ </template>
10
+
11
+ <script lang="ts">
12
+ import PlayIcon from "vue-material-design-icons/Play.vue";
13
+ import PauseIcon from "vue-material-design-icons/Pause.vue";
14
+ import { usePlayerStore } from "../../../stores/PlayerStore";
15
+ import { mapState, mapActions } from "pinia";
16
+ import { defineComponent } from "vue";
17
+ import { Podcast } from "@/stores/class/general/podcast";
18
+ export default defineComponent({
19
+ name: "PodcastPlayBasicButton",
20
+ components: {
21
+ PlayIcon,
22
+ PauseIcon
23
+ },
24
+ props: {
25
+ podcast: { default: () => ({}), type: Object as () => Podcast },
26
+ },
27
+ computed: {
28
+ ...mapState(usePlayerStore, ["playerPodcast", "playerStatus"]),
29
+ btnPlay(){
30
+ return this.playerPodcast !== this.podcast || (this.playerPodcast === this.podcast && 'PAUSED' === this.playerStatus);
31
+ }
32
+ },
33
+ methods: {
34
+ ...mapActions(usePlayerStore, ["playerPlay", "playerChangeStatus"]),
35
+ clickBtn(podcast: Podcast){
36
+ if(this.btnPlay){
37
+ this.play(podcast);
38
+ return;
39
+ }
40
+ this.pause();
41
+ },
42
+ play(podcast: Podcast): void {
43
+ if (podcast === this.playerPodcast) {
44
+ this.playerChangeStatus(false);
45
+ } else {
46
+ this.playerPlay(podcast);
47
+ }
48
+ },
49
+ pause(): void {
50
+ this.playerChangeStatus(true);
51
+ },
52
+ },
53
+ });
54
+ </script>
55
+ <style lang="scss">
56
+ @use "../../../style/playButton";
57
+ </style>
@@ -119,23 +119,11 @@ export default defineComponent({
119
119
  </script>
120
120
 
121
121
  <style lang="scss">
122
+ @use "../../../../style/playButton";
122
123
  .octopus-app {
123
- .play-button-box {
124
- height: 2.2rem;
125
- width: 2.2rem;
126
- display: flex;
127
- align-items: center;
128
- justify-content: center;
129
- margin: 0 0.5rem;
130
- border-radius: 50% !important;
131
- flex-shrink: 0;
132
- cursor: pointer;
133
- }
134
-
135
124
  .play-button-box:not(.small-font) {
136
125
  font-size: 1rem !important;
137
126
  }
138
-
139
127
  .play-big-button-box {
140
128
  height: 5rem;
141
129
  width: 5rem;
@@ -0,0 +1,14 @@
1
+ .octopus-app{
2
+ .play-button-box {
3
+ height: 2.2rem;
4
+ width: 2.2rem;
5
+ display: flex;
6
+ align-items: center;
7
+ justify-content: center;
8
+ margin: 0 0.5rem;
9
+ border-radius: 50% !important;
10
+ flex-shrink: 0;
11
+ cursor: pointer;
12
+ }
13
+
14
+ }