@chat-leo/chatleolib 0.0.0-stage → 2.0.1

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 (85) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +69 -2
  3. package/dist/ChatLeoWorker.d.ts +83 -0
  4. package/dist/ChatLeoWorker.d.ts.map +1 -0
  5. package/dist/ChatLeoWorker.js +255 -0
  6. package/dist/ChatLeoWorker.js.map +1 -0
  7. package/dist/ChatRoom.d.ts +121 -0
  8. package/dist/ChatRoom.d.ts.map +1 -0
  9. package/dist/ChatRoom.js +416 -0
  10. package/dist/ChatRoom.js.map +1 -0
  11. package/dist/ChatStore.d.ts +252 -0
  12. package/dist/ChatStore.d.ts.map +1 -0
  13. package/dist/ChatStore.js +774 -0
  14. package/dist/ChatStore.js.map +1 -0
  15. package/dist/JwtUtils.d.ts +39 -0
  16. package/dist/JwtUtils.d.ts.map +1 -0
  17. package/dist/JwtUtils.js +89 -0
  18. package/dist/JwtUtils.js.map +1 -0
  19. package/dist/Outbox.d.ts +68 -0
  20. package/dist/Outbox.d.ts.map +1 -0
  21. package/dist/Outbox.js +253 -0
  22. package/dist/Outbox.js.map +1 -0
  23. package/dist/UploadManager.d.ts +80 -0
  24. package/dist/UploadManager.d.ts.map +1 -0
  25. package/dist/UploadManager.js +204 -0
  26. package/dist/UploadManager.js.map +1 -0
  27. package/dist/chatleo-push-sw.js +149 -0
  28. package/dist/chatleo-push-sw.js.map +1 -0
  29. package/dist/index.d.ts +236 -0
  30. package/dist/index.d.ts.map +1 -0
  31. package/dist/index.esm.js +8526 -0
  32. package/dist/index.esm.js.map +1 -0
  33. package/dist/index.js +8535 -0
  34. package/dist/index.js.map +1 -0
  35. package/dist/index.umd.js +8541 -0
  36. package/dist/index.umd.js.map +1 -0
  37. package/dist/push/PushService.d.ts +32 -0
  38. package/dist/push/PushService.d.ts.map +1 -0
  39. package/dist/push/PushService.js +215 -0
  40. package/dist/push/PushService.js.map +1 -0
  41. package/dist/push-sw/index.d.ts +9 -0
  42. package/dist/push-sw/index.d.ts.map +1 -0
  43. package/dist/push-sw/index.js +142 -0
  44. package/dist/push-sw/index.js.map +1 -0
  45. package/dist/push-sw/standalone.d.ts +2 -0
  46. package/dist/push-sw/standalone.d.ts.map +1 -0
  47. package/dist/push-sw/standalone.js +3 -0
  48. package/dist/push-sw/standalone.js.map +1 -0
  49. package/dist/transport/SocketIoTransport.d.ts +37 -0
  50. package/dist/transport/SocketIoTransport.d.ts.map +1 -0
  51. package/dist/transport/SocketIoTransport.js +209 -0
  52. package/dist/transport/SocketIoTransport.js.map +1 -0
  53. package/dist/transport/WsV2Transport.d.ts +109 -0
  54. package/dist/transport/WsV2Transport.d.ts.map +1 -0
  55. package/dist/transport/WsV2Transport.js +604 -0
  56. package/dist/transport/WsV2Transport.js.map +1 -0
  57. package/dist/transport/discovery.d.ts +43 -0
  58. package/dist/transport/discovery.d.ts.map +1 -0
  59. package/dist/transport/discovery.js +87 -0
  60. package/dist/transport/discovery.js.map +1 -0
  61. package/dist/transport/factory.d.ts +38 -0
  62. package/dist/transport/factory.d.ts.map +1 -0
  63. package/dist/transport/factory.js +79 -0
  64. package/dist/transport/factory.js.map +1 -0
  65. package/dist/transport/index.d.ts +7 -0
  66. package/dist/transport/index.d.ts.map +1 -0
  67. package/dist/transport/index.js +5 -0
  68. package/dist/transport/index.js.map +1 -0
  69. package/dist/transport/types.d.ts +174 -0
  70. package/dist/transport/types.d.ts.map +1 -0
  71. package/dist/transport/types.js +35 -0
  72. package/dist/transport/types.js.map +1 -0
  73. package/dist/transport/util.d.ts +8 -0
  74. package/dist/transport/util.d.ts.map +1 -0
  75. package/dist/transport/util.js +33 -0
  76. package/dist/transport/util.js.map +1 -0
  77. package/dist/types/shared.d.ts +281 -0
  78. package/dist/types/shared.d.ts.map +1 -0
  79. package/dist/types/shared.js +2 -0
  80. package/dist/types/shared.js.map +1 -0
  81. package/dist/types/uploads.d.ts +14 -0
  82. package/dist/types/uploads.d.ts.map +1 -0
  83. package/dist/types/uploads.js +3 -0
  84. package/dist/types/uploads.js.map +1 -0
  85. package/package.json +70 -3
@@ -0,0 +1,281 @@
1
+ /**
2
+ * @typedef {object} UserProfile
3
+ * @description Represents the profile of a user in the chat system.
4
+ * @property {string} id - The unique identifier for the user.
5
+ * @property {string} display_name - The name of the user that is displayed in the UI.
6
+ * @property {string | null} profile_picture_url - The URL for the user's profile picture. Can be null if the user has not set one.
7
+ */
8
+ export type UserProfile = {
9
+ id: string;
10
+ display_name: string;
11
+ profile_picture_url: string | null;
12
+ };
13
+ /**
14
+ * @typedef {'DirectMessage' | 'Group' | 'Channel' | 'Space' | 'Unknown'} RoomType
15
+ * @description Defines the possible types of a chat room.
16
+ */
17
+ export type RoomType = 'DirectMessage' | 'Group' | 'Channel' | 'Space' | 'Unknown';
18
+ /**
19
+ * @interface RoomSummary
20
+ * @description Provides a brief summary of a chat room, typically used for display in a room list.
21
+ * @property {string} id - The unique identifier for the room.
22
+ * @property {string} name - The display name of the room.
23
+ * @property {RoomType} room_type - The type of the room, e.g., 'DirectMessage', 'Group'.
24
+ * @property {string[]} participants - An array of user IDs for the participants in the room.
25
+ */
26
+ export interface RoomSummary {
27
+ id: string;
28
+ name: string;
29
+ room_type: RoomType;
30
+ participants: string[];
31
+ is_read_only?: boolean;
32
+ unread_count?: number;
33
+ /** Highest message `seq` in the room (absent on servers without sequencing). */
34
+ last_seq?: number;
35
+ /** Highest `seq` the current user has read (absent on servers without read markers). */
36
+ last_read_seq?: number;
37
+ /** The call currently running in this room, when the server reports one. */
38
+ active_call?: ActiveCall;
39
+ /** This user's notification level for the room. */
40
+ notification_level?: NotificationLevel;
41
+ }
42
+ /**
43
+ * Delivery state of a locally originated message.
44
+ *
45
+ * `pending` is shown immediately while the send is in the outbox, `sent` after the server
46
+ * acknowledged it, and `failed` when it cannot be delivered (permanent error or retries
47
+ * exhausted). Server messages have no delivery state.
48
+ */
49
+ export type DeliveryState = 'pending' | 'sent' | 'failed';
50
+ /** Mode and lifecycle of a call in a room. */
51
+ export type CallMode = 'direct' | 'group' | 'stage';
52
+ export type CallState = 'ringing' | 'active' | 'ended';
53
+ export interface CallParticipant {
54
+ id: string;
55
+ display_name?: string;
56
+ profile_picture_url?: string | null;
57
+ }
58
+ /** Summary of the call currently running in a room (room list, sync, REST response). */
59
+ export interface ActiveCall {
60
+ id: string;
61
+ room_id: string;
62
+ mode: CallMode;
63
+ state: CallState;
64
+ starter_id: string;
65
+ started_at?: string;
66
+ ring_expires_at?: string;
67
+ video?: boolean;
68
+ }
69
+ /** A ringing direct call as shown by the incoming-call screen. */
70
+ export interface IncomingCall {
71
+ id: string;
72
+ room_id: string;
73
+ mode: 'direct';
74
+ caller: CallParticipant;
75
+ expires_at?: string;
76
+ video?: boolean;
77
+ }
78
+ /** Wire payload of a call event, normalised by the transports. */
79
+ export interface CallEventData {
80
+ event: 'started' | 'ringing' | 'accepted' | 'declined' | 'ended' | 'role';
81
+ call_id: string;
82
+ room_id: string;
83
+ mode: CallMode;
84
+ starter_id?: string;
85
+ caller?: CallParticipant;
86
+ expires_at?: string;
87
+ video?: boolean;
88
+ user_id?: string;
89
+ reason?: string;
90
+ duration_ms?: number;
91
+ /** `role` events: the user may publish (speaker) or is back in the audience. */
92
+ promoted?: boolean;
93
+ }
94
+ /** Credentials returned by the ChatLeo join endpoint. */
95
+ export interface CallCredentials {
96
+ sfu_url: string;
97
+ token: string;
98
+ room_id: string;
99
+ mode: CallMode;
100
+ expires_at?: string;
101
+ ice_servers?: RTCIceServer[];
102
+ }
103
+ /** Per-room notification level. */
104
+ export type NotificationLevel = 'all' | 'mentions' | 'none';
105
+ /** Server push configuration. */
106
+ export interface PushConfig {
107
+ enabled: boolean;
108
+ provider: string;
109
+ vapid_public_key?: string;
110
+ }
111
+ /** Per-account notification preferences. */
112
+ export interface PushPreferences {
113
+ push_enabled: boolean;
114
+ show_preview: boolean;
115
+ }
116
+ /** Why push is or is not available on this device. */
117
+ export type PushAvailabilityReason = 'available' | 'server_unsupported' | 'browser_unsupported' | 'worker_unreachable' | 'ios_install_required' | 'disabled';
118
+ /** Current push state exposed to the UI. */
119
+ export interface PushState {
120
+ availability: PushAvailabilityReason;
121
+ permission: 'granted' | 'denied' | 'default' | 'unsupported';
122
+ subscribed: boolean;
123
+ accountEnabled: boolean;
124
+ showPreview: boolean;
125
+ }
126
+ /**
127
+ * @interface ChatLeoMessage
128
+ * @description Represents the structure of a single chat message as returned by the API.
129
+ * @property {string} id - The unique identifier for the message.
130
+ * @property {string} room_id - The ID of the room where the message was sent.
131
+ * @property {string} sender_id - The ID of the user who sent the message.
132
+ * @property {string | null} parent_message_id - The ID of the message this message is a reply to, if any.
133
+ * @property {string} content_type - The MIME type of the message content, e.g., 'text/plain' or 'application/json+blocks'.
134
+ * @property {string} content_body - The body of the message. For simple text, this is the text itself. For structured content, this is a JSON string.
135
+ * @property {string} created_at - The ISO 8601 timestamp of when the message was created.
136
+ */
137
+ export interface ChatLeoMessage {
138
+ id: string;
139
+ room_id: string;
140
+ sender_id: string;
141
+ parent_message_id: string | null;
142
+ content_type: string;
143
+ content_body: string;
144
+ created_at: string;
145
+ attachment_details: Record<string, AttachmentDownloadInfo>;
146
+ /** Per-room sequence number (protocol v2 / sync-capable servers). */
147
+ seq?: number;
148
+ /** Idempotency id chosen by the sender. */
149
+ client_id?: string;
150
+ /** `human` (default when absent), `agent` or `system`. */
151
+ sender_kind?: 'human' | 'agent' | 'system';
152
+ /** Member ids the message addresses (usually an agent). */
153
+ mentions?: string[];
154
+ /** Client-only delivery state for optimistic sends (absent on server messages). */
155
+ delivery?: DeliveryState;
156
+ /** Client-only failure reason when `delivery` is `failed`. */
157
+ error?: string;
158
+ }
159
+ /**
160
+ * @interface FileAttachment
161
+ * @description Represents a file that is attached to a message.
162
+ * @property {string} id - A unique identifier for the attachment.
163
+ * @property {File} file - The `File` object itself.
164
+ * @property {string} mime_type - The MIME type of the file.
165
+ * @property {string} preview - A base64-encoded data URL for a preview of the file, typically for images.
166
+ * @property {string} name - The name of the file.
167
+ * @property {number} size - The size of the file in bytes.
168
+ */
169
+ export interface FileAttachment {
170
+ id: string;
171
+ file: File;
172
+ mime_type: string;
173
+ preview?: string;
174
+ name: string;
175
+ size: number;
176
+ }
177
+ /**
178
+ * @interface AttachmentDownloadInfo
179
+ * @description Contains the necessary information to download an attachment.
180
+ * @property {string} mime_type - The MIME type of the file.
181
+ * @property {string} download_url - The URL from which the file can be downloaded.
182
+ * @property {number} file_size - The size of the file in bytes.
183
+ */
184
+ export interface AttachmentDownloadInfo {
185
+ mime_type: string;
186
+ download_url: string;
187
+ file_size: number;
188
+ }
189
+ /**
190
+ * @interface RichInputContent
191
+ * @description Represents the content of a rich text input, including both text and attachments.
192
+ * @property {string} text - The textual content of the input.
193
+ * @property {FileAttachment[]} attachments - An array of `FileAttachment` objects.
194
+ */
195
+ export interface RichInputContent {
196
+ text: string;
197
+ attachments: FileAttachment[];
198
+ }
199
+ /**
200
+ * @interface MessageContentBlock
201
+ * @description A base interface for a block of content in a structured message.
202
+ * @property {string} id - A unique identifier for the block.
203
+ * @property {'text' | 'attachment'} type - The type of the content block.
204
+ * @property {string} [fallback_text] - Optional plain-text representation, shown by clients that do not recognise the block type.
205
+ */
206
+ export interface MessageContentBlock {
207
+ id: string;
208
+ type: 'text' | 'attachment';
209
+ fallback_text?: string;
210
+ }
211
+ /**
212
+ * @interface TextBlock
213
+ * @extends MessageContentBlock
214
+ * @description Represents a block of text content in a structured message.
215
+ * @property {'text'} type - The type of the block, which is always 'text'.
216
+ * @property {string} content - The text content of the block.
217
+ * @property {TextStyle} style - An optional object defining the style of the text.
218
+ */
219
+ export interface TextBlock extends MessageContentBlock {
220
+ type: 'text';
221
+ content: string;
222
+ style?: TextStyle;
223
+ }
224
+ /**
225
+ * @interface AttachmentBlock
226
+ * @extends MessageContentBlock
227
+ * @description Represents a block of one or more file attachments in a structured message.
228
+ * @property {'attachment'} type - The type of the block, which is always 'attachment'.
229
+ * @property {FileAttachment[]} attachments - An array of `FileAttachment` objects.
230
+ */
231
+ export interface AttachmentBlock extends MessageContentBlock {
232
+ type: 'attachment';
233
+ attachments: FileAttachment[];
234
+ }
235
+ /**
236
+ * @interface TextStyle
237
+ * @description Defines a set of optional styling properties for text.
238
+ * @property {boolean} bold - If `true`, the text will be bold.
239
+ * @property {boolean} italic - If `true`, the text will be italic.
240
+ * @property {boolean} underline - If `true`, the text will be underlined.
241
+ * @property {string} color - The color of the text.
242
+ * @property {string} backgroundColor - The background color of the text.
243
+ * @property {number} fontSize - The font size of the text.
244
+ * @property {string} fontFamily - The font family of the text.
245
+ */
246
+ export interface TextStyle {
247
+ bold?: boolean;
248
+ italic?: boolean;
249
+ underline?: boolean;
250
+ color?: string;
251
+ backgroundColor?: string;
252
+ fontSize?: number;
253
+ fontFamily?: string;
254
+ }
255
+ /**
256
+ * @interface StructuredMessageContent
257
+ * @description Represents the entire content of a structured message, including all its blocks and a version identifier.
258
+ * @property {(TextBlock | AttachmentBlock)[]} blocks - An array of `TextBlock` and `AttachmentBlock` objects that make up the message content.
259
+ * @property {string} version - The version of the structured message format, for future compatibility.
260
+ * @property {string} html - An optional HTML representation of the message content.
261
+ */
262
+ export interface StructuredMessageContent {
263
+ blocks: (TextBlock | AttachmentBlock)[];
264
+ version: string;
265
+ html?: string;
266
+ }
267
+ /**
268
+ * @typedef {object} ChatMessageSent
269
+ * @description Represents the payload for a message that is being sent.
270
+ * @property {string} room_id - The ID of the room where the message is being sent.
271
+ * @property {any} content - The content of the message. This can be a simple string or a structured content object.
272
+ * @property {string} content_type - The MIME type of the content.
273
+ * @property {string} sender - The ID of the user who is sending the message.
274
+ */
275
+ export type ChatMessageSent = {
276
+ room_id: string;
277
+ content: any;
278
+ content_type: string;
279
+ sender: string;
280
+ };
281
+ //# sourceMappingURL=shared.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/types/shared.ts"],"names":[],"mappings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eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,CAAC,SAAS,GAAG,eAAe,CAAC,EAAE,CAAC;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;GAOG;AAEH,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,GAAG,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/types/shared.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ export type UploadStatus = 'queued' | 'awaiting_url' | 'uploading' | 'done' | 'error' | 'canceled';
2
+ export interface AttachmentUploadRef {
3
+ fileId: string;
4
+ messageId?: string;
5
+ uploadUrl?: string;
6
+ expiresAt?: string;
7
+ mime: string;
8
+ name?: string;
9
+ size: number;
10
+ progress: number;
11
+ status: UploadStatus;
12
+ error?: string;
13
+ }
14
+ //# sourceMappingURL=uploads.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uploads.d.ts","sourceRoot":"","sources":["../../src/types/uploads.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,cAAc,GAAG,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,CAAC;AAEnG,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,YAAY,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
@@ -0,0 +1,3 @@
1
+ // Upload-related types kept within chatleolib to avoid breaking shared package consumers for now.
2
+ export {};
3
+ //# sourceMappingURL=uploads.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uploads.js","sourceRoot":"","sources":["../../src/types/uploads.ts"],"names":[],"mappings":"AAAA,kGAAkG"}
package/package.json CHANGED
@@ -1,6 +1,73 @@
1
1
  {
2
2
  "name": "@chat-leo/chatleolib",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "2.0.1",
4
+ "description": "ChatLeo library for web integration",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.esm.js",
7
+ "types": "dist/index.d.ts",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "keywords": [
12
+ "chatleo",
13
+ "web",
14
+ "library",
15
+ "chat"
16
+ ],
17
+ "author": "Danny Thuering <danny@webmobix.com>",
18
+ "license": "MIT",
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/webmobix/chatleo-web.git",
22
+ "directory": "packages/chatleolib"
23
+ },
24
+ "homepage": "https://chat-leo.com",
25
+ "bugs": {
26
+ "url": "https://github.com/webmobix/chatleo-web/issues"
27
+ },
28
+ "publishConfig": {
29
+ "access": "public",
30
+ "registry": "https://registry.npmjs.org"
31
+ },
32
+ "dependencies": {
33
+ "@webmobix/pulse-leo-sdk": "^0.3.0"
34
+ },
35
+ "devDependencies": {
36
+ "@rollup/plugin-commonjs": "^29.0.0",
37
+ "@rollup/plugin-node-resolve": "^16.0.3",
38
+ "@rollup/plugin-typescript": "^12.3.1",
39
+ "@types/jest": "^30.0.0",
40
+ "jest": "^30.5.2",
41
+ "jest-environment-jsdom": "^30.2.0",
42
+ "rollup": "^4.68.2",
43
+ "socket.io-client": "^4.8.3",
44
+ "ts-jest": "^29.1.0",
45
+ "tslib": "^2.9.1",
46
+ "typescript": "^5.9.3"
47
+ },
48
+ "exports": {
49
+ ".": {
50
+ "import": "./dist/index.esm.js",
51
+ "require": "./dist/index.js",
52
+ "types": "./dist/index.d.ts"
53
+ },
54
+ "./push-sw": {
55
+ "import": "./dist/push-sw/index.js",
56
+ "types": "./dist/push-sw/index.d.ts"
57
+ },
58
+ "./push-sw.js": "./dist/chatleo-push-sw.js",
59
+ "./dist/*": {
60
+ "types": "./dist/*.d.ts",
61
+ "import": "./dist/*.js",
62
+ "require": "./dist/*.js"
63
+ }
64
+ },
65
+ "scripts": {
66
+ "build": "tsc && rollup -c && rollup -c rollup.push-sw.config.js",
67
+ "build:dev": "tsc && rollup -c --environment NODE_ENV:development && rollup -c rollup.push-sw.config.js",
68
+ "dev": "rollup -c --watch",
69
+ "clean": "rm -rf dist",
70
+ "test": "jest",
71
+ "test:coverage": "jest --coverage"
72
+ }
6
73
  }