@voicenter-team/events-sdk 0.0.29 → 0.0.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.
Files changed (53) hide show
  1. package/dist/voicenter-events-sdk.cjs.js.map +1 -1
  2. package/dist/voicenter-events-sdk.d.ts +594 -15
  3. package/dist/voicenter-events-sdk.es.js.map +1 -1
  4. package/dist/voicenter-events-sdk.iife.js.map +1 -1
  5. package/dist/voicenter-events-sdk.umd.js.map +1 -1
  6. package/package.json +59 -56
  7. package/.eslintrc.cjs +0 -17
  8. package/.github/workflows/main.yml +0 -16
  9. package/.idea/VoicenterEventsSDK.iml +0 -12
  10. package/.idea/git_toolbox_prj.xml +0 -15
  11. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  12. package/.idea/jsLibraryMappings.xml +0 -6
  13. package/.idea/jsLinters/eslint.xml +0 -7
  14. package/.idea/modules.xml +0 -8
  15. package/.idea/vcs.xml +0 -6
  16. package/.nvmrc +0 -1
  17. package/TODELETE_TEMP/events.json +0 -69122
  18. package/TODELETE_TEMP/temphelper.cjs +0 -101
  19. package/docs/package-lock.json +0 -3827
  20. package/docs/package.json +0 -26
  21. package/docs/src/.vuepress/client.js +0 -8
  22. package/docs/src/.vuepress/components/Demo.vue +0 -303
  23. package/docs/src/.vuepress/config.js +0 -60
  24. package/docs/src/.vuepress/public/favicon.ico +0 -0
  25. package/docs/src/.vuepress/public/images/logo.png +0 -0
  26. package/docs/src/.vuepress/styles/index.scss +0 -0
  27. package/docs/src/.vuepress/styles/index.styl +0 -8
  28. package/docs/src/.vuepress/styles/palette.styl +0 -10
  29. package/docs/src/demo.md +0 -7
  30. package/docs/src/index.md +0 -4
  31. package/jest.config.js +0 -11
  32. package/src/classes/auth/auth.class.ts +0 -355
  33. package/src/classes/event-emitter/event-emitter.class.ts +0 -73
  34. package/src/classes/events-sdk/events-sdk-default-options.ts +0 -34
  35. package/src/classes/events-sdk/events-sdk.class.ts +0 -208
  36. package/src/classes/events-sdk/events-sdk.test.ts +0 -17
  37. package/src/classes/events-sdk/events-sdk.types.ts +0 -75
  38. package/src/classes/logger/logger.class.ts +0 -61
  39. package/src/classes/socket-io/socket-io.class.ts +0 -220
  40. package/src/classes/socket-io/socket-io.d.ts +0 -10
  41. package/src/classes/socket-io/versions/index.ts +0 -52
  42. package/src/classes/socket-io/versions/v1_3_7.js +0 -2083
  43. package/src/classes/storage/storage.class.ts +0 -51
  44. package/src/enum/auth.enum.ts +0 -4
  45. package/src/enum/logger.enum.ts +0 -5
  46. package/src/index.ts +0 -13
  47. package/src/types/auth.d.ts +0 -53
  48. package/src/types/events.d.ts +0 -83
  49. package/src/types/listeners.d.ts +0 -37
  50. package/src/types/public-api.d.ts +0 -39
  51. package/src/types/socket.d.ts +0 -5
  52. package/tsconfig.json +0 -47
  53. package/vite.config.ts +0 -45
@@ -1,51 +0,0 @@
1
- export class StorageClass{
2
- public static getSessionStorageDataByKey <T extends object> (key: string, doParse?: true): Promise<T | undefined>
3
- public static getSessionStorageDataByKey (key: string, doParse?: false): Promise<string | undefined>
4
- public static async getSessionStorageDataByKey (key: string, doParse = true) {
5
- if (typeof chrome !== 'undefined' && typeof chrome.storage !== 'undefined') {
6
- const loginSessionKey = await chrome.storage.session.get(key)
7
-
8
- if (loginSessionKey[key]) {
9
- if (doParse) {
10
- return JSON.parse(loginSessionKey[key])
11
- } else {
12
- return loginSessionKey[key]
13
- }
14
- }
15
- }
16
-
17
- if (typeof window !== 'undefined') {
18
- const loginSessionKey = window.sessionStorage.getItem(key)
19
-
20
- if (loginSessionKey) {
21
- if (doParse) {
22
- return JSON.parse(loginSessionKey)
23
- } else {
24
- return loginSessionKey
25
- }
26
- }
27
- }
28
- }
29
-
30
- public static async updateSessionStorageKey <T> (key: string, storageData: Partial<T>) {
31
- if (typeof chrome !== 'undefined' && typeof chrome.storage !== 'undefined') {
32
- await chrome.storage.session.set({
33
- [key]: JSON.stringify(storageData)
34
- })
35
- }
36
-
37
- if (typeof window !== 'undefined') {
38
- window.sessionStorage.setItem(key, JSON.stringify(storageData))
39
- }
40
- }
41
-
42
- public static clearSessionStorage () {
43
- if (typeof chrome !== 'undefined' && typeof chrome.storage !== 'undefined') {
44
- chrome.storage.session.clear()
45
- }
46
-
47
- if (typeof window !== 'undefined') {
48
- window.sessionStorage.clear()
49
- }
50
- }
51
- }
@@ -1,4 +0,0 @@
1
- export enum LoginType {
2
- USER = 'User',
3
- TOKEN = 'Token'
4
- }
@@ -1,5 +0,0 @@
1
- export enum LoggerTypeEnum {
2
- INFO = 'INFO',
3
- WARN = 'WARN',
4
- ERROR = 'ERROR'
5
- }
package/src/index.ts DELETED
@@ -1,13 +0,0 @@
1
- import EventsSdkClass from '@/classes/events-sdk/events-sdk.class'
2
-
3
- // Export all types and enums
4
- export type * from './types/auth'
5
- export type * from './types/events'
6
- export type * from './types/listeners'
7
- export type * from './types/public-api'
8
- export type * from './types/socket'
9
- export type * from './classes/events-sdk/events-sdk.types'
10
-
11
- export * from '@voicenter-team/real-time-events-types'
12
-
13
- export default EventsSdkClass
@@ -1,53 +0,0 @@
1
- import { Server } from '@/classes/events-sdk/events-sdk.types'
2
- import { LoginType } from '@/enum/auth.enum'
3
-
4
- export interface LoginSessionPayload {
5
- token: string,
6
- email: string,
7
- password: string
8
- }
9
-
10
- export interface ExternalLoginRequestBody {
11
- identityType: LoginType,
12
- username?: string,
13
- password?: string,
14
- token?: string
15
- }
16
-
17
- export interface ExternalLoginResponse<T> {
18
- StatusCode: number,
19
- Status: string,
20
- Data: T
21
- }
22
-
23
- interface ExternalLoginNewStackResponseData {
24
- AccessToken: string,
25
- RefreshToken: string
26
- }
27
-
28
- interface ExternalLoginOldStackResponseData {
29
- Socket: Socket,
30
- }
31
-
32
- export interface Socket {
33
- Client: string,
34
- PersonId: number,
35
- RefreshToken: string,
36
- RefreshTokenExpiry: Date,
37
- Token: string,
38
- TokenExpiry: Date,
39
- URLList: string[],
40
- Url: string,
41
- Version: string
42
- }
43
-
44
- export interface Settings {
45
- IdentityCode: string,
46
- IdentityCodeExpiry: Date,
47
- PersonID: number,
48
- PersonType: number,
49
- ExtensionMonitorID: number,
50
- MonitorList: Server[]
51
- }
52
-
53
- export interface LoginSessionData extends Settings, ExternalLoginNewStackResponseData, Socket {}
@@ -1,83 +0,0 @@
1
- import {
2
- EventsEnum,
3
- LoginSuccessEvent,
4
- LoginStatusEvent,
5
- AllExtensionStatusEvent,
6
- AllDialersStatusEvent,
7
- AllUsersStatusEvent,
8
- QueueEvent,
9
- ExtensionEvent,
10
- KeepAliveResponseEvent,
11
- DialerEvent,
12
- ExtensionsUpdated,
13
- OnlineStatusEvent
14
- } from '@voicenter-team/real-time-events-types'
15
-
16
- /**
17
- * Mapping of event names to their respective data structures.
18
- */
19
- export interface EventDataMap {
20
- [EventsEnum.ALL_EXTENSION_STATUS]: AllExtensionStatusEvent
21
- [EventsEnum.ALL_DIALER_STATUS]: AllDialersStatusEvent
22
- [EventsEnum.ALL_USERS_STATUS]: AllUsersStatusEvent
23
- [EventsEnum.QUEUE_EVENT]: QueueEvent
24
- [EventsEnum.EXTENSION_EVENT]: ExtensionEvent
25
- [EventsEnum.DIALER_EVENT]: DialerEvent
26
- [EventsEnum.LOGIN_SUCCESS]: LoginSuccessEvent
27
- [EventsEnum.LOGIN_STATUS]: LoginStatusEvent
28
- [EventsEnum.KEEP_ALIVE_RESPONSE]: KeepAliveResponseEvent
29
- [EventsEnum.ONLINE_STATUS_EVENT]: OnlineStatusEvent
30
- [EventsEnum.EXTENSIONS_UPDATED]: ExtensionsUpdated
31
- }
32
-
33
- /**
34
- * Represents the set of all possible event type names as keys from the EventDataMap.
35
- * This type is used to define event listeners and handlers.
36
- */
37
- type EventTypeNames = keyof EventDataMap
38
-
39
- // Generic structure for wrapped socket event data
40
- type WrappedSocketEvent<T extends EventsEnum> = {
41
- name: T
42
- data: EventDataMap[T]
43
- }
44
-
45
- // Generic type for event type data
46
- export type EventTypeData<T extends EventsEnum> = EventDataMap[T]
47
-
48
- /**
49
- * Defines a registry of callback functions for each event type.
50
- * Each key is an event type name, and the value is a function that takes the specific event data type as an argument.
51
- * This registry is used to manage and invoke event-specific callbacks.
52
- */
53
- export type EventCallbackRegistry = {
54
- [K in EventTypeNames]: (data: EventDataMap[K]) => void
55
- }
56
-
57
- /**
58
- * This is a generic type for callback functions used in event handling.
59
- * It takes a generic event name and defines a callback function that receives wrapped socket event data for that specific event.
60
- */
61
- export type EventSpecificCallback<T extends EventTypeNames> = (data: WrappedSocketEvent<T>) => void
62
-
63
- /**
64
- * This type defines a map where each key is an event name, and the value is an array of callback functions associated with that event.
65
- * This structure is used to manage event listeners for different events
66
- */
67
- export type EventCallbackListenersMap = {
68
- [K in EventTypeNames]: Array<EventSpecificCallback<K>>
69
- }
70
-
71
- /**
72
- * This type represents a mapping of listener event names to their corresponding wrapped socket event data structures.
73
- * Each key is an event name, and the value is the wrapped socket event data for that event
74
- */
75
- export type EventWrappedSocketDataMap = {
76
- [K in EventTypeNames]: WrappedSocketEvent<K>
77
- }
78
-
79
- /**
80
- * A generic type that represents the structure of any event data wrapped in a socket event format.
81
- * This type is used in the handling of all event types, providing a consistent structure for event data processing.
82
- */
83
- export type GenericEventWrapper = EventWrappedSocketDataMap[EventTypeNames]
@@ -1,37 +0,0 @@
1
- export type readyListener = (value: boolean) => void
2
- export type changeActiveCallsListener = (event: { [key: string]: string }) => void
3
- export type TestEventListener = (event: { test: string }) => void
4
- export type ActiveRoomListener = (event: number | undefined) => void
5
- export type CallAddingProgressListener = (callId: string | undefined) => void
6
- export type RoomDeletedListener = (roomId: number) => void
7
- export type changeActiveInputMediaDeviceListener = (event: string) => void
8
- export type changeActiveOutputMediaDeviceListener = (event: string) => void
9
- export type changeMuteWhenJoinListener = (value: boolean) => void
10
- export type changeIsDNDListener = (value: boolean) => void
11
- export type changeIsMutedListener = (value: boolean) => void
12
- export type addRoomListener = (value: string) => void
13
- export type updateRoomListener = (value: string) => void
14
- export type removeRoomListener = (value: string) => void
15
- export type changeCallStatusListener = (event: { [key: string]: number }) => void
16
-
17
- export interface OpenSIPSEventMap {
18
- ready: readyListener
19
- changeActiveCalls: changeActiveCallsListener
20
- callConfirmed: TestEventListener
21
- currentActiveRoomChanged: ActiveRoomListener
22
- callAddingInProgressChanged: CallAddingProgressListener
23
- roomDeleted: RoomDeletedListener
24
- changeActiveInputMediaDevice: changeActiveInputMediaDeviceListener
25
- changeActiveOutputMediaDevice: changeActiveOutputMediaDeviceListener
26
- changeMuteWhenJoin: changeMuteWhenJoinListener
27
- changeIsDND: changeIsDNDListener
28
- changeIsMuted: changeIsMutedListener
29
- addRoom: addRoomListener
30
- updateRoom: updateRoomListener
31
- removeRoom: removeRoomListener
32
- changeCallStatus: changeCallStatusListener
33
- }
34
-
35
- export type ListenersKeyType = keyof OpenSIPSEventMap
36
- export type ListenersCallbackFnType = OpenSIPSEventMap[ListenersKeyType]
37
- export type ListenerCallbackFnType<T extends ListenersKeyType> = OpenSIPSEventMap[T]
@@ -1,39 +0,0 @@
1
- /**
2
- * Represents Event Types in Enum
3
- */
4
- export enum EventTypesEnum {
5
- ALL_DIALERS_STATUS = 'AllDialersStatus',
6
- ALL_EXTENSION_STATUS = 'AllExtensionsStatus',
7
- CLOSE = 'closeme',
8
- CONNECT = 'connect',
9
- CONNECT_ERROR = 'connect_error',
10
- CONNECT_TIMEOUT = 'connect_timeout',
11
- DISCONNECT = 'disconnect',
12
- DIALER_EVENT = 'DialerEvent',
13
- DIALERS_UPDATED = 'DialersUpdated',
14
- ERROR = 'error',
15
- EXTENSION_EVENT = 'ExtensionEvent',
16
- EXTENSION_UPDATED = 'ExtensionsUpdated',
17
- KEEP_ALIVE = 'keepalive',
18
- KEEP_ALIVE_RESPONSE = 'keepaliveResponse',
19
- LOGIN = 'login',
20
- LOGIN_ACCOUNT = 'loginAccount',
21
- LOGIN_CODE = 'loginUserCode',
22
- LOGIN_RESPONSE = 'loginResponse',
23
- LOGIN_STATUS = 'loginStatus',
24
- LOGIN_USER = 'loginUser',
25
- PONG = 'pong',
26
- QUEUE_EVENT = 'QueueEvent',
27
- QUEUES_UPDATED = 'QueuesUpdated',
28
- RECONNECT = 'reconnect',
29
- RECONNECT_ATTEMPT = 'reconnect_attempt',
30
- RECONNECT_ERROR = 'reconnect_error',
31
- RECONNECT_FAILED = 'reconnect_failed',
32
- RECONNECTING = 'reconnecting',
33
- RESYNC = 'resync'
34
- }
35
-
36
- export enum ServerTypesEnum {
37
- DEFAULT = 1,
38
- CHROME_EXTENSION = 2
39
- }
@@ -1,5 +0,0 @@
1
- import { Socket } from 'socket.io-client'
2
- import { EventCallbackRegistry } from '@/types/events'
3
- import { EventsEnum } from '@voicenter-team/real-time-events-types'
4
-
5
- export type SocketTyped = Socket<EventCallbackRegistry, Record<EventsEnum, any>>
package/tsconfig.json DELETED
@@ -1,47 +0,0 @@
1
- {
2
- "include": [
3
- "src/**/*",
4
- "src/**/*.d.ts",
5
- "docs/**/*",
6
- ],
7
- "exclude": ["public/**/*", "node_modules"],
8
- "compilerOptions": {
9
- "target": "ES2022" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */,
10
- "module": "ESNext" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
11
- "moduleResolution": "Node",
12
- "resolveJsonModule": true,
13
- "lib": [
14
- "dom",
15
- "ESNext"
16
- ],
17
- "types": [
18
- "vite/client",
19
- "node",
20
- "jest",
21
- "chrome"
22
- ],
23
- "declaration": true, /* Generates corresponding '.d.ts' file. */
24
- "esModuleInterop": true,
25
- "paths": {
26
- "voicenterEventsSDK/*": [
27
- "./src/*"
28
- ],
29
- "@/*": [
30
- "./src/*"
31
- ]
32
- },
33
- "useDefineForClassFields": true,
34
- "strict": true,
35
- "jsx": "preserve",
36
- "sourceMap": true,
37
- "isolatedModules": true,
38
- "declarationDir": "dist/types",
39
- "noUnusedLocals": true,
40
- "noUnusedParameters": true,
41
- "importHelpers": true,
42
- "experimentalDecorators": true,
43
- "allowSyntheticDefaultImports": true,
44
- "skipLibCheck": true,
45
- "baseUrl": ".",
46
- }
47
- }
package/vite.config.ts DELETED
@@ -1,45 +0,0 @@
1
- import { resolve } from 'path'
2
- import { defineConfig, loadEnv, ConfigEnv } from 'vite'
3
- import dts from 'vite-plugin-dts'
4
-
5
- export default ({ mode }: ConfigEnv) => {
6
- process.env = {
7
- ...process.env,
8
- ...loadEnv(mode, process.cwd(), '')
9
- }
10
-
11
- return defineConfig({
12
- build: {
13
- rollupOptions: {
14
- output: {
15
- exports: 'named'
16
- }
17
- },
18
- outDir: 'dist',
19
- sourcemap: true,
20
- commonjsOptions: {
21
- esmExternals: true
22
- },
23
- lib: {
24
- entry: resolve(__dirname, 'src/index.ts'),
25
- formats: [ 'es', 'cjs', 'umd', 'iife' ],
26
- name: 'VoicenterEventsSDK',
27
- fileName: (format) => {
28
- return `voicenter-events-sdk.${format}.js`
29
- },
30
- }
31
- },
32
- plugins: [
33
- dts({
34
- copyDtsFiles: true,
35
- rollupTypes: true,
36
- })
37
- ],
38
- resolve: {
39
- alias: {
40
- '@': resolve(__dirname, './src'),
41
- voicenterEventsSDK: resolve(__dirname, './src'),
42
- }
43
- }
44
- })
45
- }