@webitel/ui-sdk 23.12.29 → 23.12.31

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": "23.12.29",
3
+ "version": "23.12.31",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "build": "vue-cli-service build --target lib --name ui-sdk ./src/install.js",
@@ -340,7 +340,7 @@ export default {
340
340
  },
341
341
  deleteConfirmationPopup: {
342
342
  title: 'Confirm deletion',
343
- askingAlert: 'Are you sure you want\n to delete {count} records? | Are you sure you want\n to delete {count} records?',
343
+ askingAlert: 'Are you sure you want\n to delete {count} record? | Are you sure you want\n to delete {count} records?',
344
344
  deleteAll: 'ALL',
345
345
  },
346
346
  dummy: {
@@ -0,0 +1,7 @@
1
+ Validator for WebSocket URL string
2
+ ```javascript
3
+ import websocketValidator from '@webitel/ui-sdk/src/validators/websocketValidator/websocketValidator';
4
+
5
+ websocketValidator('wss://example.com') // true
6
+ websocketValidator('krokoziabra') // false
7
+ ```
@@ -0,0 +1,28 @@
1
+ import websocketValidator from '../websocketValidator';
2
+
3
+ describe('websocketValidator', () => {
4
+ it('truthy case 1: localhost ws', () => {
5
+ expect(websocketValidator('ws://localhost:8080')).toBe(true);
6
+ });
7
+ it('truthy case 2: localhost wss', () => {
8
+ expect(websocketValidator('wss://localhost:8080')).toBe(true);
9
+ });
10
+ it('truthy case 3: ip ws', () => {
11
+ expect(websocketValidator('ws://10.10.10.10:8080')).toBe(true);
12
+ });
13
+ it('truthy case 4: dns name', () => {
14
+ expect(websocketValidator('wss://example.com')).toBe(true);
15
+ });
16
+ it('truthy case 5: dns name', () => {
17
+ expect(websocketValidator('wss://example.com/ws')).toBe(true);
18
+ });
19
+ it('truthy case 6: dns name', () => {
20
+ expect(websocketValidator('wss://socket.socket.com/v3/channel_123?api_key=123')).toBe(true);
21
+ });
22
+ it('falsy case 1: empty string', () => {
23
+ expect(websocketValidator('')).toBe(false);
24
+ });
25
+ it('falsy case 2: ws+ws', () => {
26
+ expect(websocketValidator('wss://example.com/wswss://example.com/ws')).toBe(false);
27
+ });
28
+ });
@@ -0,0 +1,2 @@
1
+ // That's strange but i haven't found any npm package with websocket validator
2
+ export default (value) => (/^(wss?:\/\/)([0-9]{1,3}(?:\.[0-9]{1,3}){3}|[^\/]+)(\:[0-9]{1,5})?(.*)$/i).test(value);