@chat-leo/chatleo 0.0.0-stage → 2.0.2

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 (144) hide show
  1. package/LICENSE +21 -0
  2. package/dist/chatleo/chatleo.esm.js +1 -0
  3. package/dist/chatleo/index.esm.js +1 -0
  4. package/dist/chatleo/p-43ada232.entry.js +1 -0
  5. package/dist/chatleo/p-4485e141.entry.js +1 -0
  6. package/dist/chatleo/p-BnCPdbII.js +1 -0
  7. package/dist/chatleo/p-C-l90Wre.js +1 -0
  8. package/dist/chatleo/p-DQuL1Twl.js +1 -0
  9. package/dist/chatleo/p-DmL518NK.js +3 -0
  10. package/dist/chatleo/p-aed60255.entry.js +1 -0
  11. package/dist/cjs/app-globals-V2Kpy_OQ.js +5 -0
  12. package/dist/cjs/chatleo-avatar_13.cjs.entry.js +2986 -0
  13. package/dist/cjs/chatleo-call-adapter-B2OfC0VZ.js +35 -0
  14. package/dist/cjs/chatleo-chat-input.cjs.entry.js +67 -0
  15. package/dist/cjs/chatleo.cjs.js +25 -0
  16. package/dist/cjs/index-DkSDLR0y.js +56 -0
  17. package/dist/cjs/index-Dxw4YCA_.js +1741 -0
  18. package/dist/cjs/index.cjs.js +7 -0
  19. package/dist/cjs/loader.cjs.js +13 -0
  20. package/dist/cjs/my-component.cjs.entry.js +33 -0
  21. package/dist/collection/__mocks__/stencil-core.js +26 -0
  22. package/dist/collection/collection-manifest.json +27 -0
  23. package/dist/collection/components/chatleo-avatar/chatleo-avatar.css +40 -0
  24. package/dist/collection/components/chatleo-avatar/chatleo-avatar.js +116 -0
  25. package/dist/collection/components/chatleo-chat/chatleo-chat.css +108 -0
  26. package/dist/collection/components/chatleo-chat/chatleo-chat.js +459 -0
  27. package/dist/collection/components/chatleo-chat-header/chatleo-chat-header.css +22 -0
  28. package/dist/collection/components/chatleo-chat-header/chatleo-chat-header.js +105 -0
  29. package/dist/collection/components/chatleo-chat-input/chatleo-chat-input.css +84 -0
  30. package/dist/collection/components/chatleo-chat-input/chatleo-chat-input.js +141 -0
  31. package/dist/collection/components/chatleo-chat-message/chatleo-chat-message.css +149 -0
  32. package/dist/collection/components/chatleo-chat-message/chatleo-chat-message.js +259 -0
  33. package/dist/collection/components/chatleo-component/chatleo-component.css +271 -0
  34. package/dist/collection/components/chatleo-component/chatleo-component.js +1366 -0
  35. package/dist/collection/components/chatleo-new-message-selector/chatleo-new-message-selector.css +96 -0
  36. package/dist/collection/components/chatleo-new-message-selector/chatleo-new-message-selector.js +231 -0
  37. package/dist/collection/components/chatleo-rich-input/chatleo-rich-input.css +352 -0
  38. package/dist/collection/components/chatleo-rich-input/chatleo-rich-input.js +976 -0
  39. package/dist/collection/components/chatleo-rich-message-renderer/chatleo-rich-message-renderer.css +169 -0
  40. package/dist/collection/components/chatleo-rich-message-renderer/chatleo-rich-message-renderer.js +400 -0
  41. package/dist/collection/components/chatleo-room-list/chatleo-room-list.css +111 -0
  42. package/dist/collection/components/chatleo-room-list/chatleo-room-list.js +180 -0
  43. package/dist/collection/components/chatleo-room-tile-component/chatleo-room-tile-component.css +110 -0
  44. package/dist/collection/components/chatleo-room-tile-component/chatleo-room-tile-component.js +241 -0
  45. package/dist/collection/components/chatleo-room-view/chatleo-room-view.css +93 -0
  46. package/dist/collection/components/chatleo-room-view/chatleo-room-view.js +593 -0
  47. package/dist/collection/components/chatleo-tray-component/chatleo-tray-component.css +284 -0
  48. package/dist/collection/components/chatleo-tray-component/chatleo-tray-component.js +391 -0
  49. package/dist/collection/components/chatleo-user-tile/chatleo-user-tile.css +56 -0
  50. package/dist/collection/components/chatleo-user-tile/chatleo-user-tile.js +149 -0
  51. package/dist/collection/components/my-component/my-component.css +4 -0
  52. package/dist/collection/components/my-component/my-component.js +95 -0
  53. package/dist/collection/index.js +10 -0
  54. package/dist/collection/utils/call-entry.js +34 -0
  55. package/dist/collection/utils/delivery.js +7 -0
  56. package/dist/collection/utils/utils.js +51 -0
  57. package/dist/components/chatleo-avatar.d.ts +11 -0
  58. package/dist/components/chatleo-avatar.js +1 -0
  59. package/dist/components/chatleo-chat-header.d.ts +11 -0
  60. package/dist/components/chatleo-chat-header.js +1 -0
  61. package/dist/components/chatleo-chat-input.d.ts +11 -0
  62. package/dist/components/chatleo-chat-input.js +1 -0
  63. package/dist/components/chatleo-chat-message.d.ts +11 -0
  64. package/dist/components/chatleo-chat-message.js +1 -0
  65. package/dist/components/chatleo-chat.d.ts +11 -0
  66. package/dist/components/chatleo-chat.js +1 -0
  67. package/dist/components/chatleo-component.d.ts +11 -0
  68. package/dist/components/chatleo-component.js +1 -0
  69. package/dist/components/chatleo-new-message-selector.d.ts +11 -0
  70. package/dist/components/chatleo-new-message-selector.js +1 -0
  71. package/dist/components/chatleo-rich-input.d.ts +11 -0
  72. package/dist/components/chatleo-rich-input.js +1 -0
  73. package/dist/components/chatleo-rich-message-renderer.d.ts +11 -0
  74. package/dist/components/chatleo-rich-message-renderer.js +1 -0
  75. package/dist/components/chatleo-room-list.d.ts +11 -0
  76. package/dist/components/chatleo-room-list.js +1 -0
  77. package/dist/components/chatleo-room-tile-component.d.ts +11 -0
  78. package/dist/components/chatleo-room-tile-component.js +1 -0
  79. package/dist/components/chatleo-room-view.d.ts +11 -0
  80. package/dist/components/chatleo-room-view.js +1 -0
  81. package/dist/components/chatleo-tray-component.d.ts +11 -0
  82. package/dist/components/chatleo-tray-component.js +1 -0
  83. package/dist/components/chatleo-user-tile.d.ts +11 -0
  84. package/dist/components/chatleo-user-tile.js +1 -0
  85. package/dist/components/index.d.ts +35 -0
  86. package/dist/components/index.js +1 -0
  87. package/dist/components/my-component.d.ts +11 -0
  88. package/dist/components/my-component.js +1 -0
  89. package/dist/components/p-8kvQ-Uh-.js +1 -0
  90. package/dist/components/p-B7cdqAgv.js +1 -0
  91. package/dist/components/p-BdiOcOYZ.js +1 -0
  92. package/dist/components/p-BlbDSb7D.js +1 -0
  93. package/dist/components/p-BnCPdbII.js +1 -0
  94. package/dist/components/p-C-v19aUJ.js +1 -0
  95. package/dist/components/p-C1mF0s8g.js +1 -0
  96. package/dist/components/p-CRtBdzP3.js +1 -0
  97. package/dist/components/p-CfayCm9O.js +1 -0
  98. package/dist/components/p-DGjAxoQy.js +1 -0
  99. package/dist/components/p-Exj_2-yI.js +1 -0
  100. package/dist/components/p-XlwGxsqT.js +1 -0
  101. package/dist/components/p-fjMaTJam.js +1 -0
  102. package/dist/components/p-xt4kzz3B.js +1 -0
  103. package/dist/esm/app-globals-DQuL1Twl.js +3 -0
  104. package/dist/esm/chatleo-avatar_13.entry.js +2972 -0
  105. package/dist/esm/chatleo-call-adapter-BnCPdbII.js +33 -0
  106. package/dist/esm/chatleo-chat-input.entry.js +65 -0
  107. package/dist/esm/chatleo.js +21 -0
  108. package/dist/esm/index-C-l90Wre.js +53 -0
  109. package/dist/esm/index-DmL518NK.js +1733 -0
  110. package/dist/esm/index.js +1 -0
  111. package/dist/esm/loader.js +11 -0
  112. package/dist/esm/my-component.entry.js +31 -0
  113. package/dist/index.cjs.js +1 -0
  114. package/dist/index.js +1 -0
  115. package/dist/types/__mocks__/stencil-core.d.ts +24 -0
  116. package/dist/types/components/chatleo-avatar/chatleo-avatar.d.ts +27 -0
  117. package/dist/types/components/chatleo-chat/chatleo-chat.d.ts +75 -0
  118. package/dist/types/components/chatleo-chat-header/chatleo-chat-header.d.ts +27 -0
  119. package/dist/types/components/chatleo-chat-input/chatleo-chat-input.d.ts +31 -0
  120. package/dist/types/components/chatleo-chat-message/chatleo-chat-message.d.ts +22 -0
  121. package/dist/types/components/chatleo-component/chatleo-component.d.ts +278 -0
  122. package/dist/types/components/chatleo-new-message-selector/chatleo-new-message-selector.d.ts +68 -0
  123. package/dist/types/components/chatleo-rich-input/chatleo-rich-input.d.ts +216 -0
  124. package/dist/types/components/chatleo-rich-message-renderer/chatleo-rich-message-renderer.d.ts +77 -0
  125. package/dist/types/components/chatleo-room-list/chatleo-room-list.d.ts +52 -0
  126. package/dist/types/components/chatleo-room-tile-component/chatleo-room-tile-component.d.ts +59 -0
  127. package/dist/types/components/chatleo-room-view/chatleo-room-view.d.ts +91 -0
  128. package/dist/types/components/chatleo-tray-component/chatleo-tray-component.d.ts +112 -0
  129. package/dist/types/components/chatleo-user-tile/chatleo-user-tile.d.ts +36 -0
  130. package/dist/types/components/my-component/my-component.d.ts +16 -0
  131. package/dist/types/components.d.ts +1593 -0
  132. package/dist/types/index.d.ts +12 -0
  133. package/dist/types/stencil-public-runtime.d.ts +1879 -0
  134. package/dist/types/utils/call-entry.d.ts +9 -0
  135. package/dist/types/utils/delivery.d.ts +7 -0
  136. package/dist/types/utils/utils.d.ts +24 -0
  137. package/loader/cdn.js +1 -0
  138. package/loader/index.cjs.js +1 -0
  139. package/loader/index.d.ts +24 -0
  140. package/loader/index.es2017.js +1 -0
  141. package/loader/index.js +2 -0
  142. package/package.json +70 -3
  143. package/readme.md +111 -0
  144. package/README.md +0 -3
@@ -0,0 +1 @@
1
+ export { f as format } from './index-C-l90Wre.js';
@@ -0,0 +1,11 @@
1
+ import { b as bootstrapLazy } from './index-DmL518NK.js';
2
+ export { s as setNonce } from './index-DmL518NK.js';
3
+ import { g as globalScripts } from './app-globals-DQuL1Twl.js';
4
+
5
+ const defineCustomElements = async (win, options) => {
6
+ if (typeof window === 'undefined') return undefined;
7
+ await globalScripts();
8
+ return bootstrapLazy([["chatleo-chat-input",[[513,"chatleo-chat-input",{"disabled":[4],"sendOnModifierEnter":[4,"send-on-modifier-enter"],"inputValue":[32]}]]],["my-component",[[513,"my-component",{"first":[1],"middle":[1],"last":[1]}]]],["chatleo-avatar_13",[[513,"chatleo-component",{"username":[1],"ticket":[1],"useTray":[4,"use-tray"],"useMain":[4,"use-main"],"useRoomView":[4,"use-room-view"],"roomId":[1,"room-id"],"chatLeoLib":[16],"chatStore":[16],"serverUrl":[1,"server-url"],"transport":[1],"calls":[1],"push":[1],"pushSwPath":[1,"push-sw-path"],"isLoggedIn":[32],"loading":[32],"isSessionExpired":[32],"connectionStatus":[32],"callsAvailable":[32],"incomingCall":[32],"callView":[32],"showCall":[32],"pushState":[32],"pushPromptDismissed":[32],"getConnectionStatus":[64],"openRoom":[64],"closeRoom":[64],"getActiveRoomId":[64],"getDraft":[64],"setDraft":[64],"addFiles":[64],"focusComposer":[64],"openDirectMessageWithUser":[64],"openNewChatDraft":[64]},[[0,"callError","onCallError"],[0,"callLeft","onCallLeft"],[0,"callRequested","onCallRequested"],[0,"newChatClicked","onNewChatClicked"],[0,"messageChatSent","onChatMessage"],[0,"userSelected","onUserSelectedForChat"]],{"chatLeoLib":[{"onChatLeoLibChange":0}],"chatStore":[{"onChatStoreChange":0}],"ticket":[{"onTicketChange":0}],"calls":[{"onCallsChange":0}],"incomingCall":[{"onIncomingCallChange":0}]}],[513,"chatleo-chat",{"chatStore":[16],"isOnline":[4,"is-online"],"pending":[4],"callsAvailable":[4,"calls-available"],"inCall":[4,"in-call"],"selectedRoomId":[32],"_version":[32],"_showRoomDetail":[32],"openRoom":[64],"closeRoom":[64],"getDraft":[64],"setDraft":[64],"addFiles":[64],"focusComposer":[64]},[[0,"messageInputSent","handleSendMessage"],[0,"messageSend","messageSendHandler"],[0,"roomClicked","handleRoomClicked"]],{"chatStore":[{"onChatStoreChange":0}]}],[513,"chatleo-tray-component",{"chatStore":[16],"isChatOpen":[32],"isNewChatSelectorOpen":[32],"isMessagesOpen":[32],"selectedRoomId":[32],"isPending":[32],"_version":[32],"isSessionExpired":[32],"connectionStatus":[32],"openChatPanel":[64]},[[0,"roomClicked","roomClickedHandler"],[0,"messageSend","messageSendHandler"]],{"chatStore":[{"onChatStoreChange":0}],"selectedRoomId":[{"onSelectedRoomIdChanged":0}]}],[513,"chatleo-room-view",{"chatStore":[16],"roomId":[1,"room-id"],"isOnline":[4,"is-online"],"pending":[4],"callsAvailable":[4,"calls-available"],"inCall":[4,"in-call"],"_version":[32],"getDraft":[64],"setDraft":[64],"addFiles":[64],"focusComposer":[64]},[[0,"messageRetry","messageRetryHandler"],[0,"messageDiscard","messageDiscardHandler"],[0,"messageSend","messageSendHandler"]],{"chatStore":[{"onChatStoreChange":0}],"roomId":[{"onRoomIdChanged":0}]}],[513,"chatleo-room-list",{"rooms":[16],"chatStore":[16],"selectedRoomId":[1,"selected-room-id"],"_version":[32],"isNewChatOpen":[32]},[[0,"userSelected","onUserSelected"]],{"chatStore":[{"onChatStoreChange":0}]}],[513,"chatleo-chat-message",{"message":[16],"sender":[16],"senderIsOnline":[4,"sender-is-online"],"isOwnMessage":[4,"is-own-message"],"locale":[1],"translations":[16]}],[513,"chatleo-new-message-selector",{"chatStore":[16],"placeholder":[1],"filterText":[32],"filteredUsers":[32],"_version":[32]},null,{"chatStore":[{"onChatStoreChange":0}]}],[513,"chatleo-chat-header",{"name":[1],"avatar":[1],"isOnline":[4,"is-online"]}],[513,"chatleo-room-tile-component",{"room":[16],"chatStore":[16],"onlineUserIds":[16],"lastMessage":[1,"last-message"],"timestamp":[1],"unreadCount":[2,"unread-count"],"isActive":[4,"is-active"]}],[513,"chatleo-rich-input",{"disabled":[4],"placeholder":[1],"maxHeight":[1,"max-height"],"acceptFiles":[1,"accept-files"],"isDragOver":[32],"hasContent":[32],"getText":[64],"setText":[64],"addFiles":[64],"focusEditor":[64]}],[513,"chatleo-user-tile",{"profile":[16],"isOnline":[4,"is-online"],"lastSeen":[1,"last-seen"]}],[513,"chatleo-rich-message-renderer",{"content":[16],"downloadUrls":[16],"alignment":[1],"translations":[16],"attachmentStates":[32]}],[513,"chatleo-avatar",{"name":[1],"url":[1],"isOnline":[4,"is-online"]}]]]], options);
9
+ };
10
+
11
+ export { defineCustomElements };
@@ -0,0 +1,31 @@
1
+ import { r as registerInstance, h } from './index-DmL518NK.js';
2
+ import { f as format } from './index-C-l90Wre.js';
3
+
4
+ const myComponentCss = () => `:host{--display:block;display:var(--display)}`;
5
+
6
+ const MyComponent = class {
7
+ constructor(hostRef) {
8
+ registerInstance(this, hostRef);
9
+ }
10
+ /**
11
+ * The first name
12
+ */
13
+ first;
14
+ /**
15
+ * The middle name
16
+ */
17
+ middle;
18
+ /**
19
+ * The last name
20
+ */
21
+ last;
22
+ getText() {
23
+ return format(this.first, this.middle, this.last);
24
+ }
25
+ render() {
26
+ return h("div", { key: '190c7c8bc8333f9d1b4934fd633f7cf9820c7523' }, "Hello, World! I'm ", this.getText());
27
+ }
28
+ };
29
+ MyComponent.style = myComponentCss();
30
+
31
+ export { MyComponent as my_component };
@@ -0,0 +1 @@
1
+ module.exports = require('./cjs/index.cjs.js');
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from './esm/index.js';
@@ -0,0 +1,24 @@
1
+ /**
2
+ * No-op shim for @stencil/core decorators used in unit tests.
3
+ *
4
+ * When tests run via plain jest (not the Stencil test runner), the Stencil
5
+ * decorator functions (@Prop, @State, @Method, etc.) would otherwise fail
6
+ * because the Stencil runtime is not bootstrapped. This shim replaces them
7
+ * with identity/noop decorators so the class can be instantiated normally
8
+ * and the logic methods can be tested in isolation.
9
+ */
10
+ export declare const Component: () => () => void;
11
+ export declare const Prop: () => () => void;
12
+ export declare const State: () => () => void;
13
+ export declare const Method: () => () => void;
14
+ export declare const Event: () => () => void;
15
+ export declare const Listen: () => () => void;
16
+ export declare const Watch: () => () => void;
17
+ export declare const Element: () => () => void;
18
+ export declare const Host: () => () => void;
19
+ /** Minimal no-op h (hyperscript) function */
20
+ export declare const h: (..._args: any[]) => any;
21
+ /** EventEmitter stub */
22
+ export declare class EventEmitter<T = any> {
23
+ emit(_value?: T): void;
24
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @component ChatleoAvatar
3
+ * @description This component is responsible for rendering a user's avatar. It can display an image from a URL if one is provided. If no URL is given, it generates a colorful SVG avatar with the user's initials. It also displays a status indicator showing whether the user is online or offline.
4
+ * @property {string} name - The full name of the user. This is used to generate the initials for the SVG fallback avatar.
5
+ * @property {string} url - The URL for the user's avatar image. If this is not provided, the component will render a generated SVG avatar.
6
+ * @property {boolean} isOnline - A boolean that determines the color of the status indicator. `true` for online (green), `false` for offline (gray).
7
+ */
8
+ export declare class ChatleoAvatar {
9
+ /**
10
+ * The full name of the user, which is used to generate the initials for the SVG fallback avatar.
11
+ */
12
+ name: string;
13
+ /**
14
+ * The URL for the user's avatar image. If this is not provided, the component will render a generated SVG avatar.
15
+ */
16
+ url: string;
17
+ /**
18
+ * A boolean that determines the color of the status indicator. `true` for online (green), `false` for offline (gray).
19
+ */
20
+ isOnline: boolean;
21
+ /**
22
+ * @function render
23
+ * @description The render method for the `ChatleoAvatar` component. It conditionally renders either the user's image from the `url` prop or a generated SVG avatar if the URL is not available. It also renders a status indicator.
24
+ * @returns {any} A VNode representing the component's UI.
25
+ */
26
+ render(): any;
27
+ }
@@ -0,0 +1,75 @@
1
+ import { EventEmitter } from '../../stencil-public-runtime';
2
+ import { ChatMessageSent, RoomSummary } from '@chat-leo/chatleolib';
3
+ import { ChatStore } from '@chat-leo/chatleolib';
4
+ /**
5
+ * @component ChatleoChat
6
+ * @description This is the main component for the chat interface. It orchestrates the different parts of the chat, including the room list, chat header, message display, and input area. It listens for events from child components to handle message sending and room selection.
7
+ * @property {ChatStore} chatStore - An instance of the `ChatStore` class, which manages the application's state, including rooms, messages, and user profiles.
8
+ * @property {boolean} isOnline - Indicates the current user's online status.
9
+ * @property {boolean} pending - If `true`, the component will display a loading state instead of the message list.
10
+ * @fires messageChatSent - This event is emitted when a user sends a message. The event detail contains the message payload, including the room ID, content, and sender information.
11
+ */
12
+ export declare class ChatleoChat {
13
+ /**
14
+ * An instance of the `ChatStore` class, which manages the application's state, including rooms, messages, and user profiles.
15
+ */
16
+ chatStore?: ChatStore;
17
+ /**
18
+ * Indicates the current user's online status.
19
+ */
20
+ isOnline: boolean;
21
+ /**
22
+ * If `true`, the component will display a loading state instead of the message list.
23
+ */
24
+ pending?: boolean;
25
+ /** Calls are available and enabled for this host. */
26
+ callsAvailable: boolean;
27
+ /** This client is currently in the room's call. */
28
+ inCall: boolean;
29
+ selectedRoomId?: string;
30
+ _version: number;
31
+ _showRoomDetail: boolean;
32
+ private roomViewRef?;
33
+ private handleToggleMobileView;
34
+ private isMobileViewport;
35
+ /** Opens a room regardless of the current pane, and shows the conversation on a phone. */
36
+ openRoom(roomId: string): Promise<void>;
37
+ /** Returns to the room list (device back / app back button). */
38
+ closeRoom(): Promise<void>;
39
+ getDraft(): Promise<string>;
40
+ setDraft(text: string): Promise<void>;
41
+ addFiles(files: File[]): Promise<void>;
42
+ focusComposer(): Promise<void>;
43
+ /**
44
+ * @function onChatStoreChange
45
+ * @description This watcher is triggered whenever the `chatStore` prop changes. It is responsible for setting up event listeners on the new store to update the component when data changes, such as when a new room is added or a message is received.
46
+ * @param {ChatStore} newStore - The new `ChatStore` instance.
47
+ * @param {ChatStore} oldStore - The previous `ChatStore` instance.
48
+ */
49
+ onChatStoreChange(newStore: ChatStore, oldStore: ChatStore): void;
50
+ messageChatSent: EventEmitter<ChatMessageSent>;
51
+ /**
52
+ * @function handleSendMessage
53
+ * @description This is a listener for the `messageInputSent` event, which is fired by the `chatleo-chat-input` component. It takes the plain text from the event, constructs a `ChatMessageSent` object, and emits it as a `messageChatSent` event.
54
+ * @param {CustomEvent<string>} event - The custom event containing the message text.
55
+ */
56
+ handleSendMessage(event: CustomEvent<string>): void;
57
+ /**
58
+ * @function messageSendHandler
59
+ * @description This listener handles the `messageSend` event from the `chatleo-rich-input` component. It processes the rich content payload, sanitizing it by removing base64 image previews from attachments to reduce payload size. It then constructs a `ChatMessageSent` object and emits it.
60
+ * @param {CustomEvent<any>} event - The custom event containing the structured message content.
61
+ */
62
+ messageSendHandler(event: CustomEvent<any>): void;
63
+ /**
64
+ * @function handleRoomClicked
65
+ * @description This listener is triggered when a user clicks on a room in the `chatleo-room-list` component. It updates the `selectedRoomId` state, which causes the component to re-render and display the messages for the newly selected room.
66
+ * @param {CustomEvent<RoomSummary>} event - The custom event containing the summary of the clicked room.
67
+ */
68
+ handleRoomClicked(event: CustomEvent<RoomSummary>): Promise<void>;
69
+ /**
70
+ * @function render
71
+ * @description The render method for the `ChatleoChat` component. It assembles the chat interface, including the room list and the room view. It uses the new `chatleo-room-view` component to display the selected room.
72
+ * @returns {any} A VNode representing the component's UI.
73
+ */
74
+ render(): any;
75
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @component ChatleoChatHeader
3
+ * @description This component displays the header for a chat window. It includes the user's avatar, name, and online status. It is a simple presentational component that receives all its data via props.
4
+ * @property {string} name - The name of the user to be displayed in the header.
5
+ * @property {string} avatar - The URL of the user's avatar image. This is passed to the `chatleo-avatar` component.
6
+ * @property {boolean} isOnline - A boolean indicating the user's online status, which is also passed to the `chatleo-avatar` component to show a status indicator.
7
+ */
8
+ export declare class ChatleoChatHeader {
9
+ /**
10
+ * The name of the user to be displayed in the header.
11
+ */
12
+ name: string;
13
+ /**
14
+ * The URL of the user's avatar image. This is passed to the `chatleo-avatar` component.
15
+ */
16
+ avatar: string;
17
+ /**
18
+ * A boolean indicating the user's online status, which is also passed to the `chatleo-avatar` component to show a status indicator.
19
+ */
20
+ isOnline: boolean;
21
+ /**
22
+ * @function render
23
+ * @description The render method for the `ChatleoChatHeader` component. It renders the user's avatar and name within a container.
24
+ * @returns {any} A VNode representing the component's UI.
25
+ */
26
+ render(): any;
27
+ }
@@ -0,0 +1,31 @@
1
+ import { EventEmitter } from '../../stencil-public-runtime';
2
+ /**
3
+ * @component ChatleoChatInput
4
+ * @description This component provides a simple text input for sending chat messages. It includes a text field, an emoji button, and action buttons for attaching files and sending the message. It can be configured to send messages on `Enter` or `Cmd/Ctrl+Enter`.
5
+ * @property {boolean} disabled - When `true`, the input field and all buttons are disabled, preventing user interaction.
6
+ * @property {boolean} sendOnModifierEnter - If `true`, the message will be sent when the user presses `Cmd+Enter` (on Mac) or `Ctrl+Enter` (on other systems). If `false`, the message is sent on `Enter` alone.
7
+ * @fires messageInputSent - This event is emitted when the user sends a message. The event detail contains the trimmed text of the message.
8
+ */
9
+ export declare class ChatleoChatInput {
10
+ /**
11
+ * When `true`, the input field and all buttons are disabled, preventing user interaction.
12
+ */
13
+ disabled: boolean;
14
+ /**
15
+ * If `true`, the message will be sent when the user presses `Cmd+Enter` (on Mac) or `Ctrl+Enter` (on other systems). If `false`, the message is sent on `Enter` alone.
16
+ */
17
+ sendOnModifierEnter: boolean;
18
+ inputValue: string;
19
+ messageInputSent: EventEmitter<string>;
20
+ private inputRef;
21
+ private isMac;
22
+ private handleSubmit;
23
+ private handleKeyPress;
24
+ private handleInput;
25
+ /**
26
+ * @function render
27
+ * @description The render method for the `ChatleoChatInput` component. It creates the layout for the input area, including the text input, emoji button, and action buttons. The `disabled` state of the input and buttons is controlled by the `disabled` prop.
28
+ * @returns {any} A VNode representing the component's UI.
29
+ */
30
+ render(): any;
31
+ }
@@ -0,0 +1,22 @@
1
+ import { EventEmitter } from '../../stencil-public-runtime';
2
+ import type { ChatLeoMessage, UserProfile } from '@chat-leo/chatleolib';
3
+ export declare class ChatleoChatMessageComponent {
4
+ message: ChatLeoMessage;
5
+ sender: UserProfile | undefined;
6
+ senderIsOnline: boolean;
7
+ isOwnMessage: boolean;
8
+ locale: string;
9
+ translations: Record<string, string>;
10
+ /** Emitted when the user asks to resend a failed message (detail: `client_id`). */
11
+ messageRetry: EventEmitter<string>;
12
+ /** Emitted when the user discards a failed/pending message (detail: `client_id`). */
13
+ messageDiscard: EventEmitter<string>;
14
+ private isStructuredContent;
15
+ private formatTimestamp;
16
+ private defaultTranslations;
17
+ private t;
18
+ private callEntry;
19
+ private renderMessageContent;
20
+ private renderDeliveryStatus;
21
+ render(): any;
22
+ }
@@ -0,0 +1,278 @@
1
+ import { EventEmitter } from '../../stencil-public-runtime';
2
+ import type { ChatLeoClient, ChatLeoLib } from '@chat-leo/chatleolib';
3
+ import type { ChatMessageSent, IncomingCall, PushState, UserProfile } from '@chat-leo/chatleolib';
4
+ import { ChatStore } from '@chat-leo/chatleolib';
5
+ import type { ConnectionStatus } from '@chat-leo/chatleolib';
6
+ /**
7
+ * @component ChatLeoComponent
8
+ * @description This is the root component for the ChatLeo application. It serves as the main entry point and orchestrates the overall functionality. It can be configured to render either a full-page chat client or a tray-based widget. It also handles the connection to the `ChatLeoLib` and manages the application's lifecycle.
9
+ * @property {string} username - The username of the user, which can be used for authentication.
10
+ * @property {string} ticket - An authentication ticket used to establish a connection with the chat service.
11
+ * @property {boolean} useTray - If `true`, the component will render as a tray-based chat widget.
12
+ * @property {boolean} useMain - If `true`, the component will render as a full-page chat application.
13
+ * @property {ChatLeoLib} chatLeoLib - An instance of the `ChatLeoLib` class, which provides the core chat functionalities.
14
+ * @property {ChatStore} chatStore - An instance of the `ChatStore` class, which manages the application's state.
15
+ */
16
+ export declare class ChatLeoComponent implements ChatLeoClient {
17
+ /**
18
+ * The username of the user, which can be used for authentication.
19
+ */
20
+ username: string;
21
+ /**
22
+ * An authentication ticket used to establish a connection with the chat service.
23
+ */
24
+ ticket: string;
25
+ /**
26
+ * If `true`, the component will render as a tray-based chat widget.
27
+ */
28
+ useTray: boolean;
29
+ /**
30
+ * If `true`, the component will render as a full-page chat application.
31
+ */
32
+ useMain: boolean;
33
+ /**
34
+ * If `true`, the component will render as a single room view without the room list.
35
+ */
36
+ useRoomView: boolean;
37
+ /**
38
+ * The ID of the room to display when using room view mode.
39
+ */
40
+ roomId?: string;
41
+ /**
42
+ * An instance of the `ChatLeoLib` class, which provides the core chat functionalities.
43
+ */
44
+ chatLeoLib?: ChatLeoLib;
45
+ /**
46
+ * An instance of the `ChatStore` class, which manages the application's state.
47
+ */
48
+ chatStore?: ChatStore;
49
+ serverUrl?: string;
50
+ /**
51
+ * Real-time protocol: `socketio` (default), `v2` (ChatLeo Protocol v2) or `auto`
52
+ * (use v2 when the server's `/.well-known/chatleo` offers it, otherwise Socket.IO).
53
+ * Overrides `ChatLeoLib.transport`.
54
+ */
55
+ transport?: 'auto' | 'socketio' | 'v2';
56
+ /** `auto` shows call controls when the server advertises calls; `off` disables the call UI. */
57
+ calls: 'auto' | 'off';
58
+ /** `manual` shows a notification control; `prompt` also shows an in-page explanation; `off` hides it. */
59
+ push: 'off' | 'manual' | 'prompt';
60
+ /** Path of the push service worker served by the host. */
61
+ pushSwPath?: string;
62
+ isLoggedIn: boolean;
63
+ loading: boolean;
64
+ isSessionExpired: boolean;
65
+ connectionStatus: ConnectionStatus;
66
+ callsAvailable: boolean;
67
+ incomingCall: IncomingCall | null;
68
+ callView: {
69
+ callId: string;
70
+ roomId: string;
71
+ mode: 'direct' | 'group' | 'stage';
72
+ credentials: any;
73
+ } | null;
74
+ showCall: boolean;
75
+ pushState: PushState | null;
76
+ pushPromptDismissed: boolean;
77
+ /** Fires when the open conversation changes, so a host can drive navigation/history. */
78
+ activeRoomChange: EventEmitter<{
79
+ roomId: string | null;
80
+ }>;
81
+ /** Fires when the total unread count changes (app badge, title, ...). */
82
+ unreadTotalChange: EventEmitter<{
83
+ count: number;
84
+ }>;
85
+ private chatEl?;
86
+ private boundActiveRoomChanged;
87
+ private boundUnreadTotalChanged;
88
+ private callRingtoneTimer?;
89
+ private incomingRef?;
90
+ private callRingtoneContext?;
91
+ private callsChannel?;
92
+ private callAdapterRef?;
93
+ private trayEl?;
94
+ private static OPEN_ROOM_EVENT;
95
+ private static START_DM_EVENT;
96
+ private static NEW_CHAT_EVENT;
97
+ private boundOpenRoomListener;
98
+ private boundStartDmListener;
99
+ private boundNewChatListener;
100
+ private boundStartCallListener;
101
+ private boundCallRinging;
102
+ private boundCallChanged;
103
+ private boundCallRole;
104
+ private boundServiceWorkerMessage;
105
+ /**
106
+ * @function onChatLeoLibChange
107
+ * @description A Stencil watcher that triggers when the `chatLeoLib` prop is updated. This is mainly used for debugging to observe when the library is injected.
108
+ * @param {ChatLeoLib} newValue - The new instance of `ChatLeoLib`.
109
+ */
110
+ onChatLeoLibChange(newValue: ChatLeoLib): void;
111
+ /**
112
+ * @function onChatStoreChange
113
+ * @description A Stencil watcher that triggers when the `chatStore` prop is updated. It attaches an event listener to the new store to listen for new rooms being added.
114
+ * @param {ChatStore} newStore - The new `ChatStore` instance.
115
+ * @param {ChatStore} oldStore - The previous `ChatStore` instance.
116
+ */
117
+ onChatStoreChange(newStore: ChatStore, oldStore: ChatStore): void;
118
+ /**
119
+ * @function onTicketChange
120
+ * @description A Stencil watcher that is called when the `ticket` prop changes. This will trigger a reconnection attempt to the chat library with the new ticket.
121
+ * @param {string} _newValue - The new authentication ticket.
122
+ */
123
+ onTicketChange(_newValue: string): void;
124
+ /** A host can turn the call UI on/off after sign-in (settings screen). */
125
+ onCallsChange(value: 'auto' | 'off'): void;
126
+ componentDidLoad(): void;
127
+ connectedCallback(): void;
128
+ disconnectedCallback(): void;
129
+ private requestLibConnection;
130
+ /**
131
+ * @function setLoading
132
+ * @description This method is part of the `ChatLeoClient` interface. It is called by the `ChatLeoLib` to update the component's loading state.
133
+ * @param {boolean} loading - A boolean indicating whether the application is in a loading state.
134
+ */
135
+ setLoading(loading: boolean): void;
136
+ /**
137
+ * @function setLoggedIn
138
+ * @description This method is part of the `ChatLeoClient` interface. It is called by the `ChatLeoLib` to update the component's logged-in state.
139
+ * @param {boolean} isLoggedIn - A boolean indicating whether the user is logged in.
140
+ */
141
+ setLoggedIn(isLoggedIn: boolean): void;
142
+ /**
143
+ * @function setSessionExpired
144
+ * @description Called by ChatLeoLib when token refresh fails. Shows an overlay prompting the user to reload.
145
+ */
146
+ setSessionExpired(expired: boolean): void;
147
+ /** Called by ChatLeoLib when the socket connection status changes. */
148
+ setConnectionStatus(status: ConnectionStatus): void;
149
+ /**
150
+ * @function getConnectionStatus
151
+ * @description Returns the current connection and session status of the chat component.
152
+ *
153
+ * Embedding applications should call this method on `window` focus events (or any
154
+ * other relevant trigger) to determine whether the user's session is still valid
155
+ * and whether the page needs to be reloaded.
156
+ *
157
+ * @returns {Promise<{ isConnected: boolean; isSessionExpired: boolean }>}
158
+ * - `isConnected` – `true` when the underlying WebSocket is currently connected.
159
+ * - `isSessionExpired` – `true` when the token refresh has permanently failed
160
+ * (HTTP 401/403 from the refresh endpoint, or too many transient errors).
161
+ * When this is `true` the user must reload the page to restore the session.
162
+ *
163
+ * @example
164
+ * const chatEl = document.querySelector('chatleo-component');
165
+ *
166
+ * // Check on every tab-focus whether a reload is needed
167
+ * window.addEventListener('focus', async () => {
168
+ * const { isSessionExpired } = await chatEl.getConnectionStatus();
169
+ * if (isSessionExpired) {
170
+ * window.location.reload();
171
+ * }
172
+ * });
173
+ */
174
+ getConnectionStatus(): Promise<{
175
+ isConnected: boolean;
176
+ isSessionExpired: boolean;
177
+ connectionStatus: ConnectionStatus;
178
+ }>;
179
+ /**
180
+ * @function openRoom
181
+ * @description This method provides a public API to programmatically open a specific chat room in the tray view. It calls the `openChatPanel` method on the `chatleo-tray-component` element.
182
+ * @param {string} roomId - The ID of the room to be opened.
183
+ */
184
+ openRoom(roomId: string): Promise<void>;
185
+ /**
186
+ * @function closeRoom
187
+ * @description Returns to the room list (used for the device back action and deep links
188
+ * that could not be opened).
189
+ */
190
+ closeRoom(): Promise<void>;
191
+ /** The currently open room, or `null` on the room list. */
192
+ getActiveRoomId(): Promise<string | null>;
193
+ /** Unsent composer text (used to preserve a draft across an app update). */
194
+ getDraft(): Promise<string>;
195
+ /** Restores unsent composer text. */
196
+ setDraft(text: string): Promise<void>;
197
+ /** Adds shared files to the composer of the open room. */
198
+ addFiles(files: File[]): Promise<void>;
199
+ /** Focuses the composer (share text, deep link). */
200
+ focusComposer(): Promise<void>;
201
+ /**
202
+ * @function openDirectMessageWithUser
203
+ * @description This method allows programmatically opening a direct message conversation with a specific user. It will either find an existing DM room or create a new one.
204
+ * @param {string} userId - The ID of the user to start a direct message with.
205
+ * @param use_external_id
206
+ */
207
+ openDirectMessageWithUser(userId: string, use_external_id?: boolean): Promise<void>;
208
+ /**
209
+ * @function openNewChatDraft
210
+ * @description This method programmatically opens the new chat draft view in the tray, allowing the user to start a new conversation.
211
+ */
212
+ openNewChatDraft(): Promise<void>;
213
+ private internalStartDmFlow;
214
+ private handleExternalOpenRoom;
215
+ private handleExternalStartDm;
216
+ private handleExternalNewChat;
217
+ private refreshCallsAvailability;
218
+ private loadCallComponents;
219
+ private startOrJoinCall;
220
+ onIncomingCallChange(call: IncomingCall | null): void;
221
+ private handleCallRinging;
222
+ private handleCallChanged;
223
+ private acceptIncomingCall;
224
+ private declineIncomingCall;
225
+ private handleExternalStartCall;
226
+ /** ChatLeo changed this user's role in a stage call: present a new token so the SFU applies it. */
227
+ private handleCallRole;
228
+ /** Fresh SFU credentials for the running call: token expiry and role changes. */
229
+ private callToken;
230
+ private promoteInCall;
231
+ private demoteInCall;
232
+ private startRingtone;
233
+ private stopRingtone;
234
+ private refreshPush;
235
+ private enablePush;
236
+ private disablePush;
237
+ private handleServiceWorkerMessage;
238
+ private renderPushControl;
239
+ private identityResolver;
240
+ /**
241
+ * The call cannot go on for this user: they were removed or lost access, joined on another
242
+ * device, the room ended, or the connection could not be restored. Close the call view.
243
+ */
244
+ onCallError(event: CustomEvent<{
245
+ code?: string;
246
+ }>): void;
247
+ /** The user hung up in the call room: tell the server and return to the conversation. */
248
+ onCallLeft(): void;
249
+ onCallRequested(event: CustomEvent<{
250
+ roomId: string;
251
+ callId?: string;
252
+ }>): void;
253
+ /**
254
+ * @function onNewChatClicked
255
+ * @description A listener for the `newChatClicked` event. This event is handled within the tray component to open the user selector.
256
+ * @param {CustomEvent<string>} _event - The custom event object.
257
+ */
258
+ onNewChatClicked(_event: CustomEvent<string>): void;
259
+ /**
260
+ * @function onChatMessage
261
+ * @description This listener captures the `messageChatSent` event, which is fired by child components when a user sends a message. It then calls the `sendChatMessage` method on the `chatLeoLib` to send the message to the server.
262
+ * @param {CustomEvent<ChatMessageSent>} event - The custom event containing the message payload.
263
+ */
264
+ onChatMessage(event: CustomEvent<ChatMessageSent>): void;
265
+ /**
266
+ * @function onUserSelectedForChat
267
+ * @description This listener handles the `userSelected` event, which is fired when a user is selected from the new message selector. It initiates the process of starting a new direct message conversation with the selected user.
268
+ * @param {CustomEvent<UserProfile>} event - The custom event containing the profile of the selected user.
269
+ */
270
+ onUserSelectedForChat(event: CustomEvent<UserProfile>): Promise<void>;
271
+ /**
272
+ * @function render
273
+ * @description The render method for the `ChatLeoComponent`. It conditionally renders the `chatleo-chat` (main view), `chatleo-tray-component`, or `chatleo-room-view` based on the `useMain`, `useTray`, and `useRoomView` props.
274
+ * @returns {any} A VNode representing the component's UI.
275
+ */
276
+ private get _connectionBannerLabel();
277
+ render(): any;
278
+ }
@@ -0,0 +1,68 @@
1
+ import { EventEmitter } from "../../stencil-public-runtime";
2
+ import type { UserProfile } from "@chat-leo/chatleolib";
3
+ import { ChatStore } from "@chat-leo/chatleolib";
4
+ /**
5
+ * @component ChatLeoNewMessageSelector
6
+ * @description This component provides a UI for starting a new conversation. It displays a list of users that can be filtered by name. When a user is selected, it fires an event to notify the parent component.
7
+ * @property {ChatStore} chatStore - An instance of the `ChatStore` class, used to access the list of users and their presence information.
8
+ * @property {string} placeholder - The placeholder text to be displayed in the search input field.
9
+ * @fires userSelected - This event is emitted when a user is selected from the list. The event detail contains the `UserProfile` of the selected user.
10
+ * @fires doClose - This event is emitted when the user clicks the close button.
11
+ */
12
+ export declare class ChatLeoNewMessageSelector {
13
+ /**
14
+ * An instance of the `ChatStore` class, used to access the list of users and their presence information.
15
+ */
16
+ chatStore?: ChatStore;
17
+ /**
18
+ * The placeholder text to be displayed in the search input field.
19
+ */
20
+ placeholder: string;
21
+ filterText: string;
22
+ filteredUsers: UserProfile[];
23
+ _version: number;
24
+ private boundOnUserAdded;
25
+ private boundOnPresenceChange;
26
+ userSelected: EventEmitter<UserProfile>;
27
+ doClose: EventEmitter<void>;
28
+ /**
29
+ * @function onChatStoreChange
30
+ * @description A Stencil watcher that is called when the `chatStore` prop changes. It sets up event listeners on the new store to update the user list when users are added or their presence changes.
31
+ * @param {ChatStore} chatStore - The new `ChatStore` instance.
32
+ * @param {ChatStore} oldValue - The previous `ChatStore` instance.
33
+ */
34
+ onChatStoreChange(chatStore: ChatStore, oldValue?: ChatStore): void;
35
+ connectedCallback(): void;
36
+ disconnectedCallback(): void;
37
+ private bindChatStore;
38
+ private unbindChatStore;
39
+ /**
40
+ * @function onUserAdded
41
+ * @description This event handler is called when a new user is added to the `ChatStore`. It triggers an update of the filtered user list to include the new user.
42
+ */
43
+ onUserAdded(): void;
44
+ /**
45
+ * @function onPresenceChange
46
+ * @description This event handler is called when a user's presence status changes in the `ChatStore`. It increments a version counter to trigger a re-render of the component.
47
+ */
48
+ onPresenceChange(): void;
49
+ /**
50
+ * @function onDoClose
51
+ * @description This method is called when the user clicks the close button. It prevents the default event behavior and emits the `doClose` event to notify the parent component to close the selector.
52
+ * @param {Event} e - The click event from the close button.
53
+ */
54
+ onDoClose(e: Event): void;
55
+ onFilterChange: (event: Event) => void;
56
+ /**
57
+ * @function updateFilteredUsers
58
+ * @description This method filters the list of users from the `ChatStore` based on the text entered in the search input. If the filter text is empty, it displays all users; otherwise, it shows only the users whose display name matches the filter text.
59
+ */
60
+ updateFilteredUsers(): void;
61
+ onUserSelected: (event: CustomEvent<UserProfile>) => void;
62
+ /**
63
+ * @function render
64
+ * @description The render method for the `ChatLeoNewMessageSelector` component. It constructs the UI, including the header with a close button, the search input, and the list of filtered users. Each user is rendered using the `chatleo-user-tile` component.
65
+ * @returns {any} A VNode representing the component's UI.
66
+ */
67
+ render(): any;
68
+ }