@webitel/ui-sdk 24.2.58 → 24.2.60

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": "@webitel/ui-sdk",
3
- "version": "24.2.58",
3
+ "version": "24.2.60",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vite",
@@ -73,7 +73,7 @@
73
73
 
74
74
  <script setup>
75
75
  import {
76
- ref, computed, useSlots, onMounted,
76
+ ref, computed, useSlots, onMounted, toRefs,
77
77
  } from 'vue';
78
78
  import { useValidation } from '../../mixins/validationMixin/useValidation';
79
79
 
@@ -180,11 +180,15 @@ const props = defineProps({
180
180
  const emit = defineEmits(['update:modelValue', 'input', 'keyup']);
181
181
 
182
182
  const slots = useSlots();
183
+
184
+ // https://stackoverflow.com/questions/72408463/use-props-in-composables-vue3
185
+ const { v, customValidators } = toRefs(props);
186
+
183
187
  const {
184
188
  isValidation,
185
189
  invalid,
186
190
  validationText,
187
- } = useValidation({ v: props.v, customValidators: props.customValidators });
191
+ } = useValidation({ v, customValidators });
188
192
 
189
193
  // toggles password <-> text at showPassword
190
194
  const inputType = ref('');
@@ -3,7 +3,8 @@
3
3
  --plyr-audio-control-color: var(--icon-color);
4
4
  --plyr-audio-control-color-hover: var(--icon-btn-hover-color);
5
5
  --plyr-audio-controls-background: var(--content-wrapper-color);
6
- --plyr-control-icon-size: var(--icon-md-size);
6
+ --plyr-controls-icon-size: var(--icon-sm-size);
7
+ --plyr-controls-icon-padding: var(--spacing-2xs);
7
8
  --plyr-audio-control-background-hover: transparent;
8
9
  --plyr-audio-progress-buffered-background: var(--dp-14-surface-color); // loaded color
9
10
  --wt-player-audio-progress-background: var(--wt-slider-background-color); // not played color
@@ -0,0 +1,31 @@
1
+ import createPlyrURL from '../createPlyrURL';
2
+
3
+ describe('createPlyrURL', () => {
4
+ it('baseURL equals to "/"', () => {
5
+ const baseURL = '/';
6
+ const iconURL = '/img/plyr.svg';
7
+ expect(createPlyrURL(baseURL))
8
+ .toBe(iconURL);
9
+ });
10
+
11
+ it('baseURL starts with "/"', () => {
12
+ const baseURL = '/workspace';
13
+ const iconURL = '/workspace/img/plyr.svg';
14
+ expect(createPlyrURL(baseURL))
15
+ .toBe(iconURL);
16
+ });
17
+
18
+ it('baseURL starts and ends with "/"', () => {
19
+ const baseURL = '/workspace/';
20
+ const iconURL = '/workspace/img/plyr.svg';
21
+ expect(createPlyrURL(baseURL))
22
+ .toBe(iconURL);
23
+ });
24
+
25
+ it('Empty baseURL', () => {
26
+ const baseURL = '';
27
+ const iconURL = '/img/plyr.svg';
28
+ expect(createPlyrURL(baseURL))
29
+ .toBe(iconURL);
30
+ });
31
+ });
@@ -0,0 +1,11 @@
1
+ function createPlyrURL(baseURL) {
2
+ // Check if baseURL is exactly "/" and adjust it to an empty string
3
+ let normalizedBaseURL = baseURL === "/" ? "" : baseURL;
4
+
5
+ // Ensure there is no trailing slash in normalizedBaseURL to prevent double slashes
6
+ normalizedBaseURL = normalizedBaseURL.endsWith('/') ? normalizedBaseURL.slice(0, -1) : normalizedBaseURL;
7
+
8
+ // Construct iconUrl
9
+ return `${normalizedBaseURL}/img/plyr.svg`;
10
+ }
11
+ export default createPlyrURL;
@@ -27,6 +27,7 @@
27
27
  <script>
28
28
  import Plyr from 'plyr';
29
29
  import 'plyr/src/sass/plyr.scss';
30
+ import createPlyrURL from './scripts/createPlyrURL';
30
31
 
31
32
  export default {
32
33
  name: 'WtPlayer',
@@ -104,6 +105,7 @@ export default {
104
105
  async setupPlayer() {
105
106
  await this.$nextTick(); // test is failing to render component if element is passed to Plyr as Vue $ref
106
107
  const baseURL = this.$baseURL || process.env.BASE_URL || import.meta.env.BASE_URL;
108
+ const iconUrl = createPlyrURL(baseURL);
107
109
  if (this.player) this.player.destroy();
108
110
  const controls = [
109
111
  'play-large', 'play', 'progress', 'current-time',
@@ -117,7 +119,7 @@ export default {
117
119
  loadSprite: false,
118
120
  resetOnEnd: this.resetOnEnd,
119
121
  invertTime: this.invertTime,
120
- iconUrl: `${baseURL}img/plyr.svg`,
122
+ iconUrl,
121
123
  controls,
122
124
  loop: {
123
125
  active: this.loop,
@@ -184,6 +186,15 @@ export default {
184
186
  box-shadow: var(--elevation-10);
185
187
  }
186
188
 
189
+ .plyr__controls .plyr__control {
190
+ padding: var(--plyr-controls-icon-padding);
191
+
192
+ svg {
193
+ height: var(--plyr-controls-icon-size);
194
+ width: var(--plyr-controls-icon-size);
195
+ }
196
+ }
197
+
187
198
  .plyr__control--overlaid svg {
188
199
  left: 0; // reset plyr style for video "play" button icon
189
200
  }