@webitel/ui-sdk 24.10.65 → 24.10.66

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.10.65",
3
+ "version": "24.10.66",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vite",
@@ -16,7 +16,7 @@
16
16
  "docs:dev": "vitepress dev docs --port 8080",
17
17
  "docs:build": "vitepress build docs",
18
18
  "docs:preview": "vitepress preview docs",
19
- "update-node":"nvm install --lts && nvm alias default node"
19
+ "update-node": "nvm install --lts && nvm alias default node"
20
20
  },
21
21
  "main": "./dist/@webitel/ui-sdk.mjs",
22
22
  "type": "module",
@@ -135,30 +135,34 @@
135
135
  "xlsx": "^0.18.5"
136
136
  },
137
137
  "devDependencies": {
138
- "@biomejs/biome": "1.8.3",
139
- "@vitejs/plugin-vue": "5.0.4",
140
- "@vitest/coverage-v8": "^1.4.0",
138
+ "@biomejs/biome": "1.9.4",
139
+ "@vitejs/plugin-vue": "5.1.5",
140
+ "@vitest/coverage-v8": "^2.1.4",
141
141
  "@vue/compat": "^3.4.15",
142
142
  "@vue/compiler-sfc": "^3.4.15",
143
- "@vue/test-utils": "^2.4.5",
144
- "globby": "^14.0.0",
145
- "happy-dom": "^14.11.0",
146
- "markdown-it": "^13.0.2",
147
- "markdown-table": "^3.0.3",
148
- "postcss": "^8.4.31",
149
- "postcss-prefix-selector": "^1.16.0",
143
+ "@vue/test-utils": "^2.4.6",
144
+ "globby": "^14.0.2",
145
+ "happy-dom": "^15.11.0",
146
+ "markdown-it": "^14.1.0",
147
+ "markdown-table": "^3.0.4",
148
+ "path": "^0.12.7",
149
+ "postcss": "^8.4.48",
150
+ "postcss-prefix-selector": "^2.1.0",
150
151
  "prismjs": "^1.29.0",
151
- "sass": "^1.51.0",
152
- "vite": "^5.1.6",
153
- "vite-plugin-node-polyfills": "^0.21.0",
154
- "vite-plugin-static-copy": "^0.17.1",
155
- "vite-plugin-svg-sprite": "^0.5.1",
152
+ "sass": "^1.80.6",
153
+ "vite": "^5.4.11",
154
+ "vite-plugin-node-polyfills": "^0.22.0",
155
+ "vite-plugin-static-copy": "^2.1.0",
156
+ "vite-plugin-svg-sprite": "^0.5.2",
156
157
  "vite-plugin-vue-docgen": "^0.3.4",
157
- "vitepress": "1.4.1",
158
- "vitest": "^1.4.0",
158
+ "vitepress": "1.5.0",
159
+ "vitest": "^2.1.4",
159
160
  "vue": "^3.4.15",
160
161
  "vuex": "^4.1.0"
161
162
  },
163
+ "optionalDependencies": {
164
+ "@rollup/rollup-linux-x64-gnu": "4.9.5"
165
+ },
162
166
  "engines": {
163
167
  "npm": "10.9.0",
164
168
  "node": "v22.11.0"
@@ -15,7 +15,7 @@ describe('WtNotificationsBar', () => {
15
15
  const wrapper = shallowMount(WtNotificationsBar, {
16
16
  global: { provide: { $eventBus: eventBus } },
17
17
  });
18
- wrapper.vm.$eventBus.$emit('notification', {
18
+ eventBus.$emit('notification', {
19
19
  type: 'error',
20
20
  text: 'error',
21
21
  });
@@ -27,7 +27,7 @@ describe('WtNotificationsBar', () => {
27
27
  const wrapper = shallowMount(WtNotificationsBar, {
28
28
  global: { provide: { $eventBus: eventBus } },
29
29
  });
30
- wrapper.vm.$eventBus.$emit('notification', {
30
+ eventBus.$emit('notification', {
31
31
  type: 'error',
32
32
  text: 'error',
33
33
  });
@@ -42,7 +42,7 @@ describe('WtNotificationsBar', () => {
42
42
  global: { provide: { $eventBus: eventBus } },
43
43
  data: () => ({ notificationDuration: 100 }),
44
44
  });
45
- wrapper.vm.$eventBus.$emit('notification', {
45
+ eventBus.$emit('notification', {
46
46
  type: 'error',
47
47
  text: 'error',
48
48
  });
@@ -17,22 +17,29 @@
17
17
  </template>
18
18
 
19
19
  <script>
20
+ import defaultEventBus from '../../scripts/eventBus.js';
21
+ import { _wtUiLog as loggr } from '../../scripts/logger.js';
22
+
20
23
  export default {
21
24
  name: 'WtNotificationsBar',
22
25
  inject: ['$eventBus'],
23
26
  data: () => ({
24
27
  notificationDuration: 4000,
25
28
  notifications: [],
29
+
30
+ eventBus: defaultEventBus,
26
31
  }),
27
32
  created() {
28
- try {
29
- this.$eventBus.$on('notification', this.showNotification);
30
- } catch (err) {
31
- console.error('wt-notifications-bar cannot work without globally registered eventBus', err);
33
+ if (this.$eventBus) {
34
+ this.eventBus = this.$eventBus;
35
+ } else {
36
+ loggr.warn({ entity: 'component', module: 'wt-notification-bar' })('no globally provided $eventBus found, using default webitel-ui eventBus');
32
37
  }
38
+
39
+ this.eventBus.$on('notification', this.showNotification);
33
40
  },
34
41
  unmounted() {
35
- this.$eventBus.$off('notification', this.showNotification);
42
+ this.eventBus.$off('notification', this.showNotification);
36
43
  },
37
44
  methods: {
38
45
  showNotification(notification) {
@@ -25,7 +25,7 @@
25
25
  </template>
26
26
 
27
27
  <script>
28
- import Plyr from 'plyr';
28
+ // import Plyr from 'plyr'; // breaks vitepress build, https://webitel.atlassian.net/browse/WTEL-5425?focusedCommentId=639144
29
29
  import 'plyr/src/sass/plyr.scss';
30
30
  import createPlyrURL from './scripts/createPlyrURL.js';
31
31
 
@@ -132,6 +132,8 @@ export default {
132
132
  : defaultControls;
133
133
 
134
134
  if (this.download) controls.push('download');
135
+
136
+ const Plyr = (await import('plyr')).default; // https://webitel.atlassian.net/browse/WTEL-5425?focusedCommentId=639144
135
137
  this.player = new Plyr(this.$refs.player, {
136
138
  // this.player = new Plyr('.wt-player__player', {
137
139
  autoplay: this.autoplay,
package/src/install.js CHANGED
@@ -1,5 +1,5 @@
1
- import './css/main.scss';
2
1
  import 'vue-multiselect/dist/vue-multiselect.css';
2
+ import './css/main.scss';
3
3
  import generateInstance from './api/axios/generateInstance.js';
4
4
  import Components from './components/index.js'; // init all components
5
5
  import Directives from './directives/index.js'; // init all directives
@@ -14,9 +14,6 @@ export default {
14
14
  Object.keys(Components).forEach((name) => {
15
15
  app.component(name, Components[name]);
16
16
  });
17
- // Vue.prototype.$webitelUI = {
18
- // // locale: this.$i18n.locale,
19
- // };
20
17
  Object.keys(globals).forEach((globalKey) => {
21
18
  app.provide(globalKey, globals[globalKey]);
22
19
  });
@@ -7,6 +7,7 @@ import prettifyTime from './prettifyTime.js';
7
7
  import preventHiddenPageCallsDecorator
8
8
  from './preventHiddenPageCallsDecorator.js';
9
9
  import saveAsJSON from './saveAsJSON.js';
10
+ import { wtlog } from './logger.js';
10
11
  import {
11
12
  sortToQueryAdapter,
12
13
  queryToSortAdapter,
@@ -46,6 +47,7 @@ export {
46
47
  eventBus,
47
48
  isEmpty,
48
49
  convertDuration,
50
+ wtlog,
49
51
 
50
52
  // compareSize.js
51
53
  compareSize,
@@ -0,0 +1,38 @@
1
+ import isObject from 'lodash/isObject.js';
2
+
3
+ const validateConfig = (config) => {
4
+ return isObject(config) && (config.entity || config.module);
5
+ };
6
+
7
+ const logger =
8
+ (globalApp) =>
9
+ (type) =>
10
+ (...params) => {
11
+ if (validateConfig(params[0])) {
12
+ const config = params[0];
13
+
14
+ const { app = globalApp, entity = '', module = '' } = config;
15
+ const timestamp = new Date();
16
+ const path = window?.location?.href || 'non-browser env';
17
+
18
+ return (...msgs) => {
19
+ const prependix = `@webitel/${app}:${entity}:${module}:`;
20
+
21
+ const appendix = `[${timestamp}][${path}]`;
22
+
23
+ return console[type](prependix, ...msgs, appendix);
24
+ };
25
+ }
26
+
27
+ return console[type](...params);
28
+ };
29
+
30
+ export const wtlog = (app) => ({
31
+ info: logger(app)('info'),
32
+ warn: logger(app)('warn'),
33
+ error: logger(app)('error'),
34
+ log: logger(app)('log'),
35
+ });
36
+
37
+ // only for ui-sdk usage
38
+ export const _wtUiLog = wtlog('ui-sdk');