@arthakosh/chat-widget 0.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.
- package/README.md +24 -0
- package/esm2022/arthakosh-chat-widget.mjs +5 -0
- package/esm2022/chat-widget.mjs +5 -0
- package/esm2022/lib/chat-launcher/chat-launcher.component.mjs +85 -0
- package/esm2022/lib/chat-widget.module.mjs +27 -0
- package/esm2022/lib/chat-window/chat-window.component.mjs +191 -0
- package/esm2022/lib/core/models/chat.models.mjs +2 -0
- package/esm2022/lib/core/services/chat.service.mjs +72 -0
- package/esm2022/lib/core/services/socket.service.mjs +44 -0
- package/esm2022/public-api.mjs +7 -0
- package/esm2022/ranjeethr-chat-widget.mjs +5 -0
- package/fesm2022/arthakosh-chat-widget.mjs +408 -0
- package/fesm2022/arthakosh-chat-widget.mjs.map +1 -0
- package/fesm2022/chat-widget.mjs +404 -0
- package/fesm2022/chat-widget.mjs.map +1 -0
- package/fesm2022/ranjeethr-chat-widget.mjs +408 -0
- package/fesm2022/ranjeethr-chat-widget.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/chat-launcher/chat-launcher.component.d.ts +29 -0
- package/lib/chat-widget.module.d.ts +9 -0
- package/lib/chat-window/chat-window.component.d.ts +46 -0
- package/lib/core/models/chat.models.d.ts +22 -0
- package/lib/core/services/chat.service.d.ts +24 -0
- package/lib/core/services/socket.service.d.ts +19 -0
- package/package.json +43 -0
- package/public-api.d.ts +3 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ElementRef, OnInit } from '@angular/core';
|
|
2
|
+
import { ChatService } from '../core/services/chat.service';
|
|
3
|
+
import { SocketService } from '../core/services/socket.service';
|
|
4
|
+
import { MessageService } from 'primeng/api';
|
|
5
|
+
import { ChatMessage } from '../core/models/chat.models';
|
|
6
|
+
import { OverlayPanel } from 'primeng/overlaypanel';
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
export declare class ChatWindowComponent implements OnInit {
|
|
9
|
+
chatRoomId: string;
|
|
10
|
+
header: string;
|
|
11
|
+
chatUsers: never[];
|
|
12
|
+
refreshRoom: import("@angular/core").InputSignal<boolean>;
|
|
13
|
+
chatService: ChatService;
|
|
14
|
+
socket: SocketService;
|
|
15
|
+
messageService: MessageService;
|
|
16
|
+
users: import("@angular/core").WritableSignal<any[]>;
|
|
17
|
+
messages: import("@angular/core").WritableSignal<ChatMessage[]>;
|
|
18
|
+
newMessage: string;
|
|
19
|
+
minimized: boolean;
|
|
20
|
+
loading: boolean;
|
|
21
|
+
replyTo: ChatMessage | null;
|
|
22
|
+
selectedUser: any;
|
|
23
|
+
messagesContainer: ElementRef<HTMLDivElement>;
|
|
24
|
+
reactionOverlay: OverlayPanel;
|
|
25
|
+
private observer;
|
|
26
|
+
showUsers: boolean;
|
|
27
|
+
suggestion: string;
|
|
28
|
+
private suggestTimer;
|
|
29
|
+
hoveredReactionUsers: string[];
|
|
30
|
+
constructor();
|
|
31
|
+
ngOnInit(): void;
|
|
32
|
+
loadUsers(): void;
|
|
33
|
+
loadMessages(): void;
|
|
34
|
+
listenSocket(): void;
|
|
35
|
+
send(): void;
|
|
36
|
+
addUserToRoom(): void;
|
|
37
|
+
toggleMinimize(): void;
|
|
38
|
+
setReply(msg: ChatMessage): void;
|
|
39
|
+
clearReply(): void;
|
|
40
|
+
trackById(index: number, msg: ChatMessage): string;
|
|
41
|
+
ngOnDestroy(): void;
|
|
42
|
+
ngAfterViewInit(): void;
|
|
43
|
+
toggleUsers(): void;
|
|
44
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ChatWindowComponent, never>;
|
|
45
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ChatWindowComponent, "app-chat-window", never, { "chatRoomId": { "alias": "chatRoomId"; "required": false; }; "header": { "alias": "header"; "required": false; }; "chatUsers": { "alias": "chatUsers"; "required": false; }; "refreshRoom": { "alias": "refreshRoom"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
46
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface ChatMessage {
|
|
2
|
+
id: string;
|
|
3
|
+
chatRoomId: string;
|
|
4
|
+
senderId: string;
|
|
5
|
+
senderName: string;
|
|
6
|
+
content: string | null;
|
|
7
|
+
replyToMessageId?: string | null;
|
|
8
|
+
createdAt: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ChatReaction {
|
|
11
|
+
id: string;
|
|
12
|
+
messageId: string;
|
|
13
|
+
users: string[];
|
|
14
|
+
displayName: string;
|
|
15
|
+
emoji: string;
|
|
16
|
+
createdAt: string;
|
|
17
|
+
}
|
|
18
|
+
export interface Reaction {
|
|
19
|
+
emoji: string;
|
|
20
|
+
count: number;
|
|
21
|
+
users: any;
|
|
22
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { HttpClient } from '@angular/common/http';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { ChatMessage } from '../models/chat.models';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class ChatService {
|
|
6
|
+
private http;
|
|
7
|
+
private baseUrl;
|
|
8
|
+
currentUser: import("@angular/core").WritableSignal<any>;
|
|
9
|
+
userList: import("@angular/core").WritableSignal<any[]>;
|
|
10
|
+
constructor(http: HttpClient);
|
|
11
|
+
createRoom(roomId: string, name: string, createdBy: string, username: string, chatUsers: any): Observable<any>;
|
|
12
|
+
getRoomUsers(roomId: string): Observable<any[]>;
|
|
13
|
+
addUserToRoom(roomId: string, userId: string, userName: string, createdBy: string): Observable<Object>;
|
|
14
|
+
getMessages(roomId: string, since?: string): Observable<ChatMessage[]>;
|
|
15
|
+
sendMessage(roomId: string, payload: {
|
|
16
|
+
senderId: string;
|
|
17
|
+
content: string;
|
|
18
|
+
replyToMessageId?: string | null;
|
|
19
|
+
createdBy: string;
|
|
20
|
+
}): Observable<ChatMessage>;
|
|
21
|
+
getRooms(loggedInUserId: string): Observable<any[]>;
|
|
22
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ChatService, never>;
|
|
23
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ChatService>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class SocketService {
|
|
4
|
+
private socket;
|
|
5
|
+
constructor();
|
|
6
|
+
joinRoom(roomId: string): void;
|
|
7
|
+
joinUserChannel(userId: string): void;
|
|
8
|
+
on<T>(event: string): Observable<T>;
|
|
9
|
+
emit(event: string, data?: any): void;
|
|
10
|
+
onNewMessage(cb: (msg: any) => void): void;
|
|
11
|
+
offNewMessage(): void;
|
|
12
|
+
onMessageSeen(cb: (data: {
|
|
13
|
+
chatRoomId: string;
|
|
14
|
+
userId: string;
|
|
15
|
+
}) => void): void;
|
|
16
|
+
offMessageSeen(): void;
|
|
17
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SocketService, never>;
|
|
18
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<SocketService>;
|
|
19
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@arthakosh/chat-widget",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Reusable floating chat widget for Arthakosh",
|
|
5
|
+
"author": "ranjeethravindran",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"angular",
|
|
9
|
+
"chat",
|
|
10
|
+
"widget",
|
|
11
|
+
"floating",
|
|
12
|
+
"primeng",
|
|
13
|
+
"arthakosh"
|
|
14
|
+
],
|
|
15
|
+
"peerDependencies": {
|
|
16
|
+
"@angular/common": "^17.3.0",
|
|
17
|
+
"@angular/core": "^17.3.0",
|
|
18
|
+
"primeng": "^17.0.0",
|
|
19
|
+
"primeicons": "^7.0.0",
|
|
20
|
+
"rxjs": "^7.8.0",
|
|
21
|
+
"uuid": "^9.0.0"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"tslib": "^2.3.0"
|
|
25
|
+
},
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
29
|
+
"sideEffects": false,
|
|
30
|
+
"module": "fesm2022/arthakosh-chat-widget.mjs",
|
|
31
|
+
"typings": "index.d.ts",
|
|
32
|
+
"exports": {
|
|
33
|
+
"./package.json": {
|
|
34
|
+
"default": "./package.json"
|
|
35
|
+
},
|
|
36
|
+
".": {
|
|
37
|
+
"types": "./index.d.ts",
|
|
38
|
+
"esm2022": "./esm2022/arthakosh-chat-widget.mjs",
|
|
39
|
+
"esm": "./esm2022/arthakosh-chat-widget.mjs",
|
|
40
|
+
"default": "./fesm2022/arthakosh-chat-widget.mjs"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
package/public-api.d.ts
ADDED