@voicenter-team/events-sdk 0.0.29 → 0.0.30

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.
Files changed (52) hide show
  1. package/dist/voicenter-events-sdk.cjs.js.map +1 -1
  2. package/dist/voicenter-events-sdk.es.js.map +1 -1
  3. package/dist/voicenter-events-sdk.iife.js.map +1 -1
  4. package/dist/voicenter-events-sdk.umd.js.map +1 -1
  5. package/package.json +59 -56
  6. package/.eslintrc.cjs +0 -17
  7. package/.github/workflows/main.yml +0 -16
  8. package/.idea/VoicenterEventsSDK.iml +0 -12
  9. package/.idea/git_toolbox_prj.xml +0 -15
  10. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  11. package/.idea/jsLibraryMappings.xml +0 -6
  12. package/.idea/jsLinters/eslint.xml +0 -7
  13. package/.idea/modules.xml +0 -8
  14. package/.idea/vcs.xml +0 -6
  15. package/.nvmrc +0 -1
  16. package/TODELETE_TEMP/events.json +0 -69122
  17. package/TODELETE_TEMP/temphelper.cjs +0 -101
  18. package/docs/package-lock.json +0 -3827
  19. package/docs/package.json +0 -26
  20. package/docs/src/.vuepress/client.js +0 -8
  21. package/docs/src/.vuepress/components/Demo.vue +0 -303
  22. package/docs/src/.vuepress/config.js +0 -60
  23. package/docs/src/.vuepress/public/favicon.ico +0 -0
  24. package/docs/src/.vuepress/public/images/logo.png +0 -0
  25. package/docs/src/.vuepress/styles/index.scss +0 -0
  26. package/docs/src/.vuepress/styles/index.styl +0 -8
  27. package/docs/src/.vuepress/styles/palette.styl +0 -10
  28. package/docs/src/demo.md +0 -7
  29. package/docs/src/index.md +0 -4
  30. package/jest.config.js +0 -11
  31. package/src/classes/auth/auth.class.ts +0 -355
  32. package/src/classes/event-emitter/event-emitter.class.ts +0 -73
  33. package/src/classes/events-sdk/events-sdk-default-options.ts +0 -34
  34. package/src/classes/events-sdk/events-sdk.class.ts +0 -208
  35. package/src/classes/events-sdk/events-sdk.test.ts +0 -17
  36. package/src/classes/events-sdk/events-sdk.types.ts +0 -75
  37. package/src/classes/logger/logger.class.ts +0 -61
  38. package/src/classes/socket-io/socket-io.class.ts +0 -220
  39. package/src/classes/socket-io/socket-io.d.ts +0 -10
  40. package/src/classes/socket-io/versions/index.ts +0 -52
  41. package/src/classes/socket-io/versions/v1_3_7.js +0 -2083
  42. package/src/classes/storage/storage.class.ts +0 -51
  43. package/src/enum/auth.enum.ts +0 -4
  44. package/src/enum/logger.enum.ts +0 -5
  45. package/src/index.ts +0 -13
  46. package/src/types/auth.d.ts +0 -53
  47. package/src/types/events.d.ts +0 -83
  48. package/src/types/listeners.d.ts +0 -37
  49. package/src/types/public-api.d.ts +0 -39
  50. package/src/types/socket.d.ts +0 -5
  51. package/tsconfig.json +0 -47
  52. package/vite.config.ts +0 -45
package/docs/package.json DELETED
@@ -1,26 +0,0 @@
1
- {
2
- "name": "voicneter-events-sdk",
3
- "version": "0.0.1",
4
- "description": "",
5
- "main": "index.js",
6
- "authors": {
7
- "name": "",
8
- "email": "bohdan.ko@voicenter.com"
9
- },
10
- "scripts": {
11
- "dev": "vuepress dev src",
12
- "build": "vuepress build src"
13
- },
14
- "license": "MIT",
15
- "devDependencies": {
16
- "@vuepress/plugin-register-components": "^2.0.0-beta.62",
17
- "typedoc": "^0.24.8",
18
- "typedoc-plugin-markdown": "^3.15.3",
19
- "vuepress": "^2.0.0-beta.62",
20
- "vuepress-plugin-typedoc": "^0.12.1",
21
- "@voicenter-team/real-time-events-types": "^0.0.6"
22
- },
23
- "dependencies": {
24
- "dotenv": "^16.3.1"
25
- }
26
- }
@@ -1,8 +0,0 @@
1
- import { defineClientConfig } from '@vuepress/client'
2
- import './styles/index.scss'
3
-
4
- export default defineClientConfig({
5
- enhance({ app, router, siteData }) {},
6
- setup() {},
7
- rootComponents: [],
8
- })
@@ -1,303 +0,0 @@
1
- <template>
2
- <div>
3
- <Transition name="fade">
4
- <div v-if="isOnline && showSuccessNotification" class="message message--success" key="success">
5
- Connection established!
6
- </div>
7
- </Transition>
8
-
9
- <Transition name="fade">
10
- <p v-if="!isOnline" class="message message--error" key="error">
11
- No connection
12
- <div class="message-container">
13
- <Transition name="attempt-to-connect" mode="out-in">
14
- <span v-if="attemptToConnect" :key="attemptToConnect" class="message">
15
- Trying to connect to {{ attemptToConnect }}
16
- </span>
17
- </Transition>
18
- </div>
19
- </p>
20
- </Transition>
21
-
22
- <p v-if="loading && isOnline">
23
- Loading...
24
- </p>
25
-
26
- <template v-else>
27
- <div>
28
- <pre><code style="color: black">{{ JSON.stringify(events, null, 4) }}</code></pre>
29
- </div>
30
-
31
- <div>
32
- <form @submit.prevent="login">
33
- <input type="text" v-model="token" placeholder="token"/>
34
-
35
- <button type="submit">Login</button>
36
- </form>
37
- </div>
38
- </template>
39
- </div>
40
- </template>
41
-
42
- <script lang="ts" setup>
43
- import {reactive, ref} from 'vue'
44
- import EventsSdkClass from '@/index'
45
- import {EventsEnum} from '@voicenter-team/real-time-events-types'
46
- import {EventTypeData} from '@/types/events'
47
- import {LoginType} from "@/enum/auth.enum";
48
-
49
- /* Data */
50
- const showSuccessNotification = ref(false)
51
- const isOnline = ref(true)
52
- const attemptToConnect = ref<string | undefined>(undefined)
53
- const token = ref('')
54
- const loading = ref(false)
55
- const loggedId = ref(false)
56
- const events = reactive<{ [K in EventsEnum]?: Array<EventTypeData<K>> }>({})
57
- let eventsdk
58
- /* Methods */
59
- async function login() {
60
- if (!token.value) {
61
- return alert('Token is required')
62
- }
63
-
64
- loading.value = true
65
-
66
- const sdk = new EventsSdkClass({
67
- loginUrl: "https://loginapidev.voicenter.co.il/Auth/Login/Voicenter/Monitor",
68
- refreshTokenUrl: "https://loginapidev.voicenter.co.il/Auth/RefreshToken",
69
- getSettingsUrl: "https://loginapidev.voicenter.co.il/Application/GetSettings",
70
- loginType: LoginType.TOKEN, // <=== "User" or "Token"
71
- token: 'QMSVU9dwNYC9Le9VCBqx24AB9TYyWj9Xn5aCPV0GFHIWoShQqfPtnAPmnw24xpJIUSsDDtlac2OPpjx0t3MSkxH3AhiQGHCeGZ8e',
72
- password: '78253050510',
73
- email: 'test2@status.com',
74
- isNewStack: true
75
- })
76
-
77
- await sdk.init()
78
-
79
- eventsdk = sdk
80
-
81
- sdk.on(
82
- EventsEnum.ALL_DIALER_STATUS,
83
- ({ data }) => {
84
-
85
- if (!events[EventsEnum.ALL_DIALER_STATUS]) {
86
- events[EventsEnum.ALL_DIALER_STATUS] = []
87
- }
88
-
89
- events[EventsEnum.ALL_DIALER_STATUS]?.push(data)
90
- }
91
- )
92
-
93
- sdk.on(
94
- EventsEnum.ALL_EXTENSION_STATUS,
95
- ({ data }) => {
96
-
97
- if (!events[EventsEnum.ALL_EXTENSION_STATUS]) {
98
- events[EventsEnum.ALL_EXTENSION_STATUS] = []
99
- }
100
-
101
- events[EventsEnum.ALL_EXTENSION_STATUS]?.push(data)
102
- }
103
- )
104
-
105
- sdk.on(
106
- EventsEnum.ALL_USERS_STATUS,
107
- ({ data }) => {
108
-
109
- if (!events[EventsEnum.ALL_USERS_STATUS]) {
110
- events[EventsEnum.ALL_USERS_STATUS] = []
111
- }
112
-
113
- events[EventsEnum.ALL_USERS_STATUS]?.push(data)
114
- }
115
- )
116
-
117
- sdk.on(
118
- EventsEnum.QUEUE_EVENT,
119
- ({ data }) => {
120
-
121
- if (!events[EventsEnum.QUEUE_EVENT]) {
122
- events[EventsEnum.QUEUE_EVENT] = []
123
- }
124
-
125
- events[EventsEnum.QUEUE_EVENT]?.push(data)
126
- }
127
- )
128
-
129
- sdk.on(
130
- EventsEnum.EXTENSION_EVENT,
131
- ({ data }) => {
132
-
133
- if (!events[EventsEnum.EXTENSION_EVENT]) {
134
- events[EventsEnum.EXTENSION_EVENT] = []
135
- }
136
-
137
- events[EventsEnum.EXTENSION_EVENT]?.push(data)
138
- }
139
- )
140
-
141
- sdk.on(
142
- EventsEnum.LOGIN_SUCCESS,
143
- ({ data }) => {
144
- if (!events[EventsEnum.LOGIN_SUCCESS]) {
145
- events[EventsEnum.LOGIN_SUCCESS] = []
146
- }
147
-
148
- loggedId.value = true
149
- loading.value = false
150
-
151
- events[EventsEnum.LOGIN_SUCCESS]?.push(data)
152
- }
153
- )
154
-
155
- sdk.on(
156
- EventsEnum.LOGIN_STATUS,
157
- ({ data }) => {
158
- if (!events[EventsEnum.LOGIN_STATUS]) {
159
- events[EventsEnum.LOGIN_STATUS] = []
160
- }
161
-
162
- events[EventsEnum.LOGIN_STATUS]?.push(data)
163
- }
164
- )
165
-
166
- sdk.on(
167
- EventsEnum.ONLINE_STATUS_EVENT,
168
- ({ data }) => {
169
- isOnline.value = data.isSocketConnected
170
- attemptToConnect.value = data.attemptToConnect
171
-
172
- if (data.isSocketConnected) {
173
- showSuccessNotification.value = true
174
-
175
- setTimeout(() => {
176
- showSuccessNotification.value = false
177
- }, 3000)
178
- }
179
- }
180
- )
181
-
182
- sdk.on(
183
- '*',
184
- (data) => {
185
- switch (data.name) {
186
- case EventsEnum.ALL_DIALER_STATUS:
187
- console.log(`FROM ALL ${EventsEnum.ALL_DIALER_STATUS}`, data)
188
- break
189
- case EventsEnum.ALL_EXTENSION_STATUS:
190
- console.log(`FROM ALL ${EventsEnum.ALL_EXTENSION_STATUS}`, data)
191
- break
192
- case EventsEnum.ALL_USERS_STATUS:
193
- console.log(`FROM ALL ${EventsEnum.ALL_USERS_STATUS}`, data)
194
- break
195
- case EventsEnum.QUEUE_EVENT:
196
- console.log(`FROM ALL ${EventsEnum.QUEUE_EVENT}`, data)
197
- break
198
- case EventsEnum.EXTENSION_EVENT:
199
- console.log(`FROM ALL ${EventsEnum.EXTENSION_EVENT}`, data)
200
- break
201
- case EventsEnum.LOGIN_SUCCESS:
202
- console.log(`FROM ALL ${EventsEnum.LOGIN_SUCCESS}`, data)
203
- break
204
- case EventsEnum.LOGIN_STATUS:
205
- console.log(`FROM ALL ${EventsEnum.LOGIN_STATUS}`, data)
206
- break
207
- case EventsEnum.EXTENSIONS_UPDATED:
208
- console.log(`FROM ALL ${EventsEnum.EXTENSIONS_UPDATED}`, data)
209
- break
210
- case EventsEnum.ONLINE_STATUS_EVENT:
211
- console.log(`FROM ALL ${EventsEnum.ONLINE_STATUS_EVENT}`, data)
212
- break
213
- default:
214
- console.log('Unknown event', data)
215
-
216
- }
217
- }
218
- )
219
-
220
- setTimeout(
221
- () => {
222
- eventsdk.emit('updateMonitoredExtensions', {extensionsString: '104082, 105703, 113921, 128288'})
223
- if (!loggedId.value) {
224
- loading.value = false
225
- alert('Login failed')
226
- }
227
- },
228
- 15000
229
- )
230
- }
231
- </script>
232
-
233
- <style>
234
- .fade-enter-active,
235
- .fade-leave-active {
236
- transition: opacity 0.5s ease;
237
- }
238
-
239
- .fade-enter-from,
240
- .fade-leave-to {
241
- opacity: 0;
242
- }
243
-
244
-
245
- .message-container {
246
- position: relative;
247
- min-height: 50px; /* Adjust based on your content's typical size */
248
- }
249
-
250
- /* Enhanced transition handling for attempt-to-connect */
251
- .attempt-to-connect-enter-active, .attempt-to-connect-leave-active {
252
- transition: opacity 0.5s, transform 0.5s;
253
- position: absolute;
254
- width: 100%;
255
- top: 0;
256
- left: 0;
257
- }
258
-
259
- .attempt-to-connect-enter {
260
- opacity: 0;
261
- transform: translateY(20px);
262
- }
263
-
264
- .attempt-to-connect-leave-active {
265
- opacity: 1;
266
- }
267
-
268
- .attempt-to-connect-leave-to {
269
- opacity: 0;
270
- transform: translateY(-20px);
271
- }
272
-
273
- .attempt-to-connect-enter-to, .attempt-to-connect-leave {
274
- opacity: 1;
275
- transform: translateY(0);
276
- position: relative;
277
- }
278
- </style>
279
-
280
- <style lang="scss" scoped>
281
- .message {
282
- border-radius: 24px;
283
- font-size: 24px;
284
- text-align: center;
285
- padding: 8px 0;
286
-
287
- &--error {
288
- background-color: #a31c1c;
289
- color: white;
290
-
291
- span {
292
- font-size: 16px;
293
- margin-top: 16px;
294
- display: block;
295
- }
296
- }
297
-
298
- &--success {
299
- background-color: #1ca31c;
300
- color: white;
301
- }
302
- }
303
- </style>
@@ -1,60 +0,0 @@
1
- import { defineUserConfig, defaultTheme } from 'vuepress'
2
- import { description } from '../../package'
3
- import { registerComponentsPlugin } from '@vuepress/plugin-register-components'
4
- import { getDirname, path } from '@vuepress/utils'
5
- import { typedocPlugin } from 'vuepress-plugin-typedoc/next';
6
- import * as dotenv from 'dotenv'
7
- dotenv.config()
8
-
9
- const __dirname = getDirname(import.meta.url)
10
-
11
- export default defineUserConfig({
12
- description: description,
13
-
14
- head: [
15
- ['link', {rel: 'icon', href: '/favicon.ico'}],
16
- ['meta', {name: 'theme-color', content: '#2675FF'}],
17
- ['meta', {name: 'apple-mobile-web-app-capable', content: 'yes'}],
18
- ['meta', {name: 'apple-mobile-web-app-status-bar-style', content: '#2675FF'}]
19
- ],
20
-
21
- theme: defaultTheme({
22
- repo: '',
23
- editLinks: false,
24
- logo: '/images/logo.png',
25
- docsDir: '',
26
- editLinkText: '',
27
- colorMode: 'light',
28
- lastUpdated: false,
29
- sidebar: [
30
- {
31
- text: 'General',
32
- link: '/',
33
- collapsible: false,
34
- children: [
35
- 'demo',
36
- {
37
- text: 'API',
38
- link: 'api',
39
- rel: 'api'
40
- }
41
- ]
42
- }
43
- ]
44
- }),
45
-
46
- plugins: [
47
- registerComponentsPlugin({
48
- componentsDir: path.resolve(__dirname, './components')
49
- }),
50
- // typedocPlugin({
51
- // entryPoints: ['../src/types/public-api.d.ts'],
52
- // tsconfig: '../tsconfig.json'
53
- // })
54
- ],
55
-
56
- alias: {
57
- '@': path.resolve(__dirname, '../', '../', '../', 'src'),
58
- 'root': path.resolve(__dirname, '../', '../', '../'),
59
- }
60
- })
File without changes
@@ -1,8 +0,0 @@
1
- /**
2
- * Custom Styles here.
3
- *
4
- * ref:https://v1.vuepress.vuejs.org/config/#index-styl
5
- */
6
-
7
- .home .hero img
8
- max-width 450px!important
@@ -1,10 +0,0 @@
1
- /**
2
- * Custom palette here.
3
- *
4
- * ref:https://v1.vuepress.vuejs.org/zh/config/#palette-styl
5
- */
6
-
7
- $accentColor = #a5c544
8
- $textColor = #2c3e50
9
- $borderColor = #eaecef
10
- $codeBgColor = #282c34
package/docs/src/demo.md DELETED
@@ -1,7 +0,0 @@
1
- # Demo
2
-
3
- <ClientOnly>
4
- <div class="py-5">
5
- <Demo />
6
- </div>
7
- </ClientOnly>
package/docs/src/index.md DELETED
@@ -1,4 +0,0 @@
1
- # Voicenter Events SDK
2
-
3
- - [Demo](demo.md)
4
- - [API](api/modules.md)
package/jest.config.js DELETED
@@ -1,11 +0,0 @@
1
- // jest.config.js
2
- module.exports = {
3
- preset: 'ts-jest',
4
- testEnvironment: 'node',
5
- roots: [ '<rootDir>/src' ],
6
- transform: {
7
- '^.+\\.tsx?$': 'ts-jest',
8
- },
9
- testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$',
10
- moduleFileExtensions: [ 'ts', 'tsx', 'js', 'jsx', 'json', 'node' ],
11
- }