@saooti/octopus-sdk 30.0.16 → 30.0.20

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/README.md CHANGED
@@ -513,4 +513,8 @@ See [Configuration Reference](https://cli.vuejs.org/config/).
513
513
  * 30.0.13 Améliorations css
514
514
  * 30.0.14 Améliorations css
515
515
  * 30.0.15 Améliorations css
516
- * 30.0.16 Change Aria-Label in title
516
+ * 30.0.16 Change Aria-Label in title
517
+ * 30.0.17 Oups
518
+ * 30.0.18 Responsive select
519
+ * 30.0.19 Mise à jour Api
520
+ * 30.0.20 Petit refacto commentaires
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saooti/octopus-sdk",
3
- "version": "30.0.16",
3
+ "version": "30.0.20",
4
4
  "private": false,
5
5
  "description": "Javascript SDK for using octopus",
6
6
  "author": "Saooti",
@@ -15,7 +15,7 @@
15
15
  "main": "./dist/octopus.common.js",
16
16
  "dependencies": {
17
17
  "@popperjs/core": "^2.11.0",
18
- "@saooti/octopus-api": "^0.30.2",
18
+ "@saooti/octopus-api": "^0.30.3",
19
19
  "@vue/cli": "^5.0.0-rc.1",
20
20
  "@vue/compat": "^3.2.26",
21
21
  "axios": "^0.24.0",
@@ -263,7 +263,7 @@
263
263
  align-items: center;
264
264
  }
265
265
  .bg-secondary{
266
- background: #eee;
266
+ background: #eee !important;
267
267
  }
268
268
  }
269
269
 
@@ -69,4 +69,7 @@
69
69
  }
70
70
  }
71
71
  }
72
+ .classic-select select {
73
+ width: 100%;
74
+ }
72
75
  }
@@ -18,9 +18,6 @@
18
18
  border: 0;
19
19
  background: #f3f3f3;
20
20
  }
21
- @media (max-width: 450px) {
22
- margin: 0.5rem auto 0;
23
- }
24
21
  }
25
22
  .category-rubrique-item-plus {
26
23
  display: flex;
@@ -156,40 +153,23 @@
156
153
  font-size: 0.6rem;
157
154
  }
158
155
  }
159
- .comment-item-container {
160
- .btn-comment-edit {
161
- width: 32px;
162
- height: 32px;
163
- background: $octopus-secondary-color;
164
- padding: 0;
165
- display: flex;
166
- align-items: center;
167
- justify-content: center;
168
- color: $octopus-primary-color;
169
- margin-right: 0.25rem;
170
- }
171
- .status-Pending {
172
- background: #eb7d22;
173
- }
174
- .status-Invalid {
175
- background: #d40303;
176
- }
177
- .status-Valid {
178
- background: $octopus-primary-color;
179
- }
180
- .status-Valid, .status-Invalid, .status-Pending {
181
- width: 14px;
182
- height: 14px;
183
- border-radius: 50%;
184
- }
185
- .icon-certified {
186
- height: 15px;
187
- margin-right: 0.5rem;
188
- }
189
- .collapsed > .when-opened,
190
- :not(.collapsed) > .when-closed {
191
- display: none !important;
192
- }
156
+ .status-Pending {
157
+ background: #eb7d22;
158
+ }
159
+ .status-Invalid {
160
+ background: #d40303;
161
+ }
162
+ .status-Valid {
163
+ background: $octopus-primary-color;
164
+ }
165
+ .status-Valid, .status-Invalid, .status-Pending {
166
+ width: 14px;
167
+ height: 14px;
168
+ border-radius: 50%;
169
+ }
170
+ .icon-certified {
171
+ height: 15px;
172
+ margin-right: 0.5rem;
193
173
  }
194
174
 
195
175
 
@@ -19,6 +19,7 @@
19
19
  class="form-input"
20
20
  type="text"
21
21
  :placeholder="$t('Your name')"
22
+ :class="{ 'border border-danger': name.length < 2 }"
22
23
  >
23
24
  <div
24
25
  v-if="sendError"
@@ -38,33 +39,20 @@
38
39
  </template>
39
40
  </div>
40
41
  <div class="modal-footer">
41
- <template
42
- v-if="!sending"
42
+ <button
43
+ class="btn m-1"
44
+ @click="closePopup"
43
45
  >
44
- <button
45
- class="btn btn-light m-1"
46
- @click="closePopup"
47
- >
48
- {{ $t('Cancel') }}
49
- </button>
50
- <button
51
- class="btn btn-primary m-1"
52
- :disabled="name.length <= 2"
53
- @click="recaptcha"
54
- >
55
- {{ $t('Validate') }}
56
- </button>
57
- </template>
58
- <template
59
- v-else
46
+ {{ $t('Close') }}
47
+ </button>
48
+ <button
49
+ v-if="!sending"
50
+ class="btn btn-primary m-1"
51
+ :disabled="name.length <= 2"
52
+ @click="validateName"
60
53
  >
61
- <button
62
- class="btn m-1"
63
- @click="closePopup"
64
- >
65
- {{ $t('Close') }}
66
- </button>
67
- </template>
54
+ {{ $t('Validate') }}
55
+ </button>
68
56
  </div>
69
57
  </div>
70
58
  </div>
@@ -92,38 +80,38 @@ export default defineComponent({
92
80
  },
93
81
 
94
82
  computed: {
95
- authenticated(): boolean {
96
- return (state.generalParameters.authenticated as boolean);
97
- },
98
83
  isCaptchaTest(): boolean {
99
84
  return (state.generalParameters.isCaptchaTest as boolean);
100
85
  },
101
86
  },
102
87
 
103
88
  mounted() {
104
- const captcha = document.getElementsByClassName('grecaptcha-badge')[0];
105
- if (captcha) {
106
- (captcha as HTMLElement).style.display = 'block';
107
- }
108
- if (this.authenticated) {
109
- this.name = (
110
- (this.$store.state.profile.firstname || '') +
111
- ' ' +
112
- (this.$store.state.profile.lastname || '')
113
- ).trim();
114
- this.needVerify = false;
115
- }
89
+ this.displayCaptcha('block');
90
+ this.initAuthenticatedName();
116
91
  },
117
92
 
118
93
  unmounted() {
119
- const captcha = document.getElementsByClassName('grecaptcha-badge')[0];
120
- if (captcha) {
121
- (captcha as HTMLElement).style.display = 'none';
122
- }
94
+ this.displayCaptcha('none');
123
95
  },
124
96
 
125
97
  methods: {
126
- async recaptcha(): Promise<void> {
98
+ initAuthenticatedName():void{
99
+ if (state.generalParameters.authenticated) {
100
+ this.name = (
101
+ (this.$store.state.profile.firstname || '') +
102
+ ' ' +
103
+ (this.$store.state.profile.lastname || '')
104
+ ).trim();
105
+ this.needVerify = false;
106
+ }
107
+ },
108
+ displayCaptcha(displayStyle: string): void{
109
+ const captcha = document.getElementsByClassName('grecaptcha-badge')[0];
110
+ if (captcha) {
111
+ (captcha as HTMLElement).style.display = displayStyle;
112
+ }
113
+ },
114
+ async validateName(): Promise<void> {
127
115
  if (!this.needVerify || this.isCaptchaTest) {
128
116
  this.sendComment();
129
117
  return;
@@ -145,8 +133,7 @@ export default defineComponent({
145
133
  }
146
134
  this.sendComment();
147
135
  },
148
- closePopup(event: { preventDefault: () => void }): void {
149
- event.preventDefault();
136
+ closePopup(): void {
150
137
  this.$emit('close');
151
138
  },
152
139
  sendComment(): void {
@@ -155,6 +142,4 @@ export default defineComponent({
155
142
  },
156
143
  },
157
144
  })
158
- </script>
159
-
160
- <style lang="scss"></style>
145
+ </script>
@@ -0,0 +1,96 @@
1
+ <template>
2
+ <div>
3
+ <div class="d-flex small-text">
4
+ <b
5
+ v-if="recordingInLive && ('Live' === comment.phase || 'Prelive' === comment.phase)"
6
+ class="recording-bg me-1 text-light p-1"
7
+ >{{ $t('Live') }}</b>
8
+ <b
9
+ :id="'popover-comment' + comment.comId"
10
+ tabindex="-1"
11
+ :class="editRight || isValid? '':'text-danger'"
12
+ class="me-2"
13
+ >{{
14
+ comment.name
15
+ }}</b>
16
+ <Popover
17
+ v-if="!editRight && !isValid"
18
+ :target="'popover-comment' + comment.comId"
19
+ >
20
+ {{ $t('Comment waiting') }}
21
+ </Popover>
22
+ <img
23
+ v-if="comment.certified"
24
+ class="icon-certified"
25
+ src="/img/certified.png"
26
+ :data-selenium="'certified-icon-' + seleniumFormat(comment.name)"
27
+ :title="$t('Certified account')"
28
+ >
29
+ <div class="me-2">
30
+ {{ date }}
31
+ </div>
32
+ <span
33
+ v-if="editRight"
34
+ :class="'status-' + comment.status"
35
+ :data-selenium="'status-comment-' + seleniumFormat(comment.name)"
36
+ />
37
+ </div>
38
+ <!-- eslint-disable vue/no-v-html -->
39
+ <div v-html="urlify(contentDisplay)" />
40
+ <!-- eslint-enable -->
41
+ <a
42
+ v-if="comment.content.length > 300"
43
+ class="c-hand font-italic"
44
+ @click="summary = !summary"
45
+ >{{ readMore }}</a>
46
+ </div>
47
+ </template>
48
+
49
+ <script lang="ts">
50
+ import { displayMethods, selenium } from '../../mixins/functions';
51
+ import { CommentPodcast } from '@/store/class/general/comment';
52
+ import moment from 'moment';
53
+ import Popover from '../../misc/Popover.vue';
54
+ import { defineComponent } from 'vue';
55
+ export default defineComponent({
56
+ name: 'CommentBasicView',
57
+
58
+ components: {
59
+ Popover
60
+ },
61
+
62
+ mixins:[displayMethods, selenium],
63
+
64
+ props: {
65
+ comment: { default: ()=>({}), type: Object as ()=>CommentPodcast },
66
+ editRight: { default: false, type: Boolean},
67
+ recordingInLive: { default: false, type: Boolean},
68
+ },
69
+
70
+ data() {
71
+ return {
72
+ summary: true as boolean,
73
+ };
74
+ },
75
+ computed: {
76
+ isValid(): boolean{
77
+ return 'Valid'=== this.comment.status;
78
+ },
79
+ date(): string {
80
+ if (this.comment.date)
81
+ return moment(this.comment.date).format('D MMMM YYYY HH[h]mm');
82
+ return '';
83
+ },
84
+ readMore(): string {
85
+ if (this.summary) return this.$t('Read more').toString();
86
+ return this.$t('Read less').toString();
87
+ },
88
+ contentDisplay(): string {
89
+ if (!this.summary){return this.comment.content;}
90
+ if (!this.comment.content) return '';
91
+ if (this.comment.content.length <= 300) return this.comment.content;
92
+ return this.comment.content.substring(0, 300) + '...';
93
+ },
94
+ },
95
+ })
96
+ </script>
@@ -9,7 +9,7 @@
9
9
  @click="changeIdentity"
10
10
  >{{ knownIdentity }}</b>
11
11
  <div
12
- v-if="knownIdentity && editName"
12
+ v-if="editName"
13
13
  class="d-flex"
14
14
  >
15
15
  <input
@@ -19,13 +19,13 @@
19
19
  :class="{ 'border border-danger': temporaryName.length < 2 }"
20
20
  >
21
21
  <button
22
- class="btn btn-light p-1 m-1"
22
+ class="btn"
23
23
  @click="editName = false"
24
24
  >
25
25
  {{ $t('Cancel') }}
26
26
  </button>
27
27
  <button
28
- class="btn btn-primary p-1 m-1"
28
+ class="btn btn-primary"
29
29
  :disabled="temporaryName.length < 2"
30
30
  @click="validEdit"
31
31
  >
@@ -142,28 +142,23 @@ export default defineComponent({
142
142
  if (this.comment && this.comment.comId) return this.$t('Answer a comment').toString();
143
143
  return this.$t('Write a comment').toString();
144
144
  },
145
- organisationId(): string|undefined {
146
- return state.generalParameters.organisationId;
147
- },
148
- authenticated(): boolean {
149
- return (state.generalParameters.authenticated as boolean);
150
- },
151
145
  isCertified(): boolean {
152
146
  if (
153
147
  (state.generalParameters.isCommments &&
154
- this.organisationId === this.podcastOrga) ||
148
+ state.generalParameters.organisationId === this.podcastOrga) ||
155
149
  state.generalParameters.isAdmin
156
- )
150
+ ){
157
151
  return true;
152
+ }
158
153
  return false;
159
154
  },
160
155
  userId(): string|undefined {
161
- if (this.authenticated) return this.$store.state.profile.userId;
156
+ if (state.generalParameters.authenticated) return this.$store.state.profile.userId;
162
157
  return undefined;
163
158
  },
164
159
  phase(): string|undefined {
165
160
  if(undefined === this.podcast){
166
- return this.comment ? this.comment.phase : '';
161
+ return this.comment ? this.comment.phase : undefined;
167
162
  }
168
163
  if (
169
164
  !this.podcast.conferenceId ||
@@ -233,11 +228,7 @@ export default defineComponent({
233
228
  cancelAction(): void {
234
229
  this.$emit('cancelAction');
235
230
  },
236
- async postComment(name?: string): Promise<void> {
237
- if (name) {
238
- this.setCookie('comment-octopus-name', name);
239
- this.$emit('update:knownIdentity', name);
240
- }
231
+ defineTimelineValue(): number{
241
232
  let timeline = 0;
242
233
  if (
243
234
  undefined !== this.podcast &&(
@@ -261,16 +252,20 @@ export default defineComponent({
261
252
  timeline = 0;
262
253
  }
263
254
  }
264
- let sendName = this.knownIdentity;
265
- if (null === sendName && name) {
266
- sendName = name;
255
+ return timeline;
256
+ },
257
+ async postComment(name?: string): Promise<void> {
258
+ if (name) {
259
+ this.setCookie('comment-octopus-name', name);
260
+ this.$emit('update:knownIdentity', name);
267
261
  }
262
+ const sendName = name ? name: this.knownIdentity;
268
263
  const commentPodcastId = this.comment ? this.comment.podcastId : 0;
269
264
  const comment: CommentPodcast = {
270
265
  content: this.newComment,
271
266
  name: sendName ? sendName : '',
272
267
  podcastId: this.podcast ? this.podcast.podcastId : commentPodcastId,
273
- timeline: timeline,
268
+ timeline: this.defineTimelineValue(),
274
269
  organisationId: this.podcastOrga,
275
270
  commentIdReferer: this.comment ? this.comment.comId : undefined,
276
271
  certified: this.isCertified,
@@ -287,11 +282,10 @@ export default defineComponent({
287
282
  }
288
283
  this.$emit('newComment', data);
289
284
  this.newComment = '';
290
- this.checkIdentityModal = false;
291
285
  } catch (error) {
292
- this.checkIdentityModal = false;
293
286
  this.postError = true;
294
287
  }
288
+ this.checkIdentityModal = false;
295
289
  },
296
290
  },
297
291
  })
@@ -315,10 +309,10 @@ export default defineComponent({
315
309
  overflow: hidden !important;
316
310
  box-shadow: unset !important;
317
311
  background: transparent !important;
318
- height: 40px;
319
- }
320
- textarea.short {
321
- max-height: 38px;
312
+ height: 50px;
313
+ &.short{
314
+ max-height: 38px;
315
+ }
322
316
  }
323
317
  }
324
318
  </style>