@cometchat/skills-cli 2.4.1 → 3.0.0
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 +45 -37
- package/dist/index.js +1821 -13090
- package/dist/utils/error-dictionary.js +0 -69
- package/package.json +10 -12
- package/dist/registry/schemas/config.schema.json +0 -119
- package/dist/registry/schemas/template.schema.json +0 -142
- package/dist/registry/v6/experiences/1-conversation-list/astro.template.json +0 -89
- package/dist/registry/v6/experiences/1-conversation-list/nextjs-pages.template.json +0 -83
- package/dist/registry/v6/experiences/1-conversation-list/nextjs.template.json +0 -83
- package/dist/registry/v6/experiences/1-conversation-list/react-router.template.json +0 -102
- package/dist/registry/v6/experiences/1-conversation-list/reactjs-dedicated-route.template.json +0 -81
- package/dist/registry/v6/experiences/1-conversation-list/reactjs.template.json +0 -86
- package/dist/registry/v6/experiences/1-conversation-list/templates/astro/ChatApp.css.tpl +0 -43
- package/dist/registry/v6/experiences/1-conversation-list/templates/astro/ChatApp.tsx.tpl +0 -86
- package/dist/registry/v6/experiences/1-conversation-list/templates/astro/CometChatSelector.tsx.tpl +0 -40
- package/dist/registry/v6/experiences/1-conversation-list/templates/astro/chat.astro.tpl +0 -17
- package/dist/registry/v6/experiences/1-conversation-list/templates/nextjs/CometChatNoSSR.css.tpl +0 -43
- package/dist/registry/v6/experiences/1-conversation-list/templates/nextjs/CometChatNoSSR.tsx.tpl +0 -86
- package/dist/registry/v6/experiences/1-conversation-list/templates/nextjs/CometChatSelector.tsx.tpl +0 -41
- package/dist/registry/v6/experiences/1-conversation-list/templates/nextjs/chat-page.tsx.tpl +0 -11
- package/dist/registry/v6/experiences/1-conversation-list/templates/nextjs-pages/CometChatNoSSR.css.tpl +0 -43
- package/dist/registry/v6/experiences/1-conversation-list/templates/nextjs-pages/CometChatNoSSR.tsx.tpl +0 -88
- package/dist/registry/v6/experiences/1-conversation-list/templates/nextjs-pages/CometChatSelector.tsx.tpl +0 -41
- package/dist/registry/v6/experiences/1-conversation-list/templates/nextjs-pages/chat-page.tsx.tpl +0 -15
- package/dist/registry/v6/experiences/1-conversation-list/templates/react-router/CometChat-route.tsx.tpl +0 -22
- package/dist/registry/v6/experiences/1-conversation-list/templates/react-router/CometChatNoSSR.css.tpl +0 -43
- package/dist/registry/v6/experiences/1-conversation-list/templates/react-router/CometChatNoSSR.tsx.tpl +0 -87
- package/dist/registry/v6/experiences/1-conversation-list/templates/react-router/CometChatSelector.tsx.tpl +0 -40
- package/dist/registry/v6/experiences/1-conversation-list/templates/reactjs/App.css.tpl +0 -40
- package/dist/registry/v6/experiences/1-conversation-list/templates/reactjs/App.tsx.tpl +0 -55
- package/dist/registry/v6/experiences/1-conversation-list/templates/reactjs/CometChatSelector.tsx.tpl +0 -40
- package/dist/registry/v6/experiences/1-conversation-list/templates/reactjs/main.tsx.tpl +0 -46
- package/dist/registry/v6/experiences/1-conversation-list/templates/reactjs-dedicated-route/ChatPage.tsx.tpl +0 -87
- package/dist/registry/v6/experiences/1-conversation-list/templates/reactjs-dedicated-route/CometChatMessenger.css.tpl +0 -20
- package/dist/registry/v6/experiences/1-conversation-list/templates/reactjs-dedicated-route/CometChatMessenger.tsx.tpl +0 -54
- package/dist/registry/v6/experiences/1-conversation-list/templates/reactjs-dedicated-route/CometChatSelector.tsx.tpl +0 -40
- package/dist/registry/v6/experiences/2-one-to-one/astro.template.json +0 -81
- package/dist/registry/v6/experiences/2-one-to-one/nextjs.template.json +0 -77
- package/dist/registry/v6/experiences/2-one-to-one/react-router.template.json +0 -93
- package/dist/registry/v6/experiences/2-one-to-one/reactjs-dedicated-route.template.json +0 -75
- package/dist/registry/v6/experiences/2-one-to-one/reactjs.template.json +0 -80
- package/dist/registry/v6/experiences/2-one-to-one/templates/astro/ChatApp.css.tpl +0 -21
- package/dist/registry/v6/experiences/2-one-to-one/templates/astro/ChatApp.tsx.tpl +0 -66
- package/dist/registry/v6/experiences/2-one-to-one/templates/astro/chat.astro.tpl +0 -17
- package/dist/registry/v6/experiences/2-one-to-one/templates/nextjs/CometChatNoSSR.css.tpl +0 -21
- package/dist/registry/v6/experiences/2-one-to-one/templates/nextjs/CometChatNoSSR.tsx.tpl +0 -66
- package/dist/registry/v6/experiences/2-one-to-one/templates/nextjs/chat-page.tsx.tpl +0 -11
- package/dist/registry/v6/experiences/2-one-to-one/templates/react-router/CometChat-route.tsx.tpl +0 -21
- package/dist/registry/v6/experiences/2-one-to-one/templates/react-router/CometChatNoSSR.css.tpl +0 -21
- package/dist/registry/v6/experiences/2-one-to-one/templates/react-router/CometChatNoSSR.tsx.tpl +0 -67
- package/dist/registry/v6/experiences/2-one-to-one/templates/reactjs/App.css.tpl +0 -4
- package/dist/registry/v6/experiences/2-one-to-one/templates/reactjs/App.tsx.tpl +0 -44
- package/dist/registry/v6/experiences/2-one-to-one/templates/reactjs/main.tsx.tpl +0 -46
- package/dist/registry/v6/experiences/2-one-to-one/templates/reactjs-dedicated-route/ChatPage.tsx.tpl +0 -84
- package/dist/registry/v6/experiences/2-one-to-one/templates/reactjs-dedicated-route/CometChatMessenger.css.tpl +0 -9
- package/dist/registry/v6/experiences/2-one-to-one/templates/reactjs-dedicated-route/CometChatMessenger.tsx.tpl +0 -43
- package/dist/registry/v6/experiences/3-tab-based/astro.template.json +0 -93
- package/dist/registry/v6/experiences/3-tab-based/nextjs.template.json +0 -90
- package/dist/registry/v6/experiences/3-tab-based/react-router.template.json +0 -105
- package/dist/registry/v6/experiences/3-tab-based/reactjs-dedicated-route.template.json +0 -89
- package/dist/registry/v6/experiences/3-tab-based/reactjs.template.json +0 -93
- package/dist/registry/v6/experiences/3-tab-based/templates/astro/ChatApp.css.tpl +0 -39
- package/dist/registry/v6/experiences/3-tab-based/templates/astro/ChatApp.tsx.tpl +0 -93
- package/dist/registry/v6/experiences/3-tab-based/templates/astro/CometChatTabs.css.tpl +0 -43
- package/dist/registry/v6/experiences/3-tab-based/templates/astro/CometChatTabs.tsx.tpl +0 -72
- package/dist/registry/v6/experiences/3-tab-based/templates/astro/chat.astro.tpl +0 -17
- package/dist/registry/v6/experiences/3-tab-based/templates/nextjs/CometChatNoSSR.css.tpl +0 -39
- package/dist/registry/v6/experiences/3-tab-based/templates/nextjs/CometChatNoSSR.tsx.tpl +0 -93
- package/dist/registry/v6/experiences/3-tab-based/templates/nextjs/CometChatTabs.css.tpl +0 -43
- package/dist/registry/v6/experiences/3-tab-based/templates/nextjs/CometChatTabs.tsx.tpl +0 -73
- package/dist/registry/v6/experiences/3-tab-based/templates/nextjs/chat-page.tsx.tpl +0 -11
- package/dist/registry/v6/experiences/3-tab-based/templates/react-router/CometChat-route.tsx.tpl +0 -21
- package/dist/registry/v6/experiences/3-tab-based/templates/react-router/CometChatNoSSR.css.tpl +0 -39
- package/dist/registry/v6/experiences/3-tab-based/templates/react-router/CometChatNoSSR.tsx.tpl +0 -94
- package/dist/registry/v6/experiences/3-tab-based/templates/react-router/CometChatTabs.css.tpl +0 -43
- package/dist/registry/v6/experiences/3-tab-based/templates/react-router/CometChatTabs.tsx.tpl +0 -72
- package/dist/registry/v6/experiences/3-tab-based/templates/reactjs/App.css.tpl +0 -7
- package/dist/registry/v6/experiences/3-tab-based/templates/reactjs/App.tsx.tpl +0 -62
- package/dist/registry/v6/experiences/3-tab-based/templates/reactjs/CometChatTabs.css.tpl +0 -43
- package/dist/registry/v6/experiences/3-tab-based/templates/reactjs/CometChatTabs.tsx.tpl +0 -72
- package/dist/registry/v6/experiences/3-tab-based/templates/reactjs/main.tsx.tpl +0 -46
- package/dist/registry/v6/experiences/3-tab-based/templates/reactjs-dedicated-route/ChatPage.tsx.tpl +0 -84
- package/dist/registry/v6/experiences/3-tab-based/templates/reactjs-dedicated-route/CometChatMessenger.css.tpl +0 -11
- package/dist/registry/v6/experiences/3-tab-based/templates/reactjs-dedicated-route/CometChatMessenger.tsx.tpl +0 -61
- package/dist/registry/v6/experiences/3-tab-based/templates/reactjs-dedicated-route/CometChatTabs.css.tpl +0 -43
- package/dist/registry/v6/experiences/3-tab-based/templates/reactjs-dedicated-route/CometChatTabs.tsx.tpl +0 -72
- package/dist/registry/v6/features/catalog.json +0 -990
- package/dist/registry/v6/production/astro/cometchat-token.ts.tpl +0 -86
- package/dist/registry/v6/production/astro.template.json +0 -51
- package/dist/registry/v6/production/nextjs/route.ts.tpl +0 -79
- package/dist/registry/v6/production/nextjs.template.json +0 -50
- package/dist/registry/v6/production/react-router/api.cometchat-token.ts.tpl +0 -73
- package/dist/registry/v6/production/react-router.template.json +0 -58
- package/dist/registry/v6/user-mgmt/astro/cometchat-user.ts.tpl +0 -164
- package/dist/registry/v6/user-mgmt/astro.template.json +0 -33
- package/dist/registry/v6/user-mgmt/nextjs/route.ts.tpl +0 -212
- package/dist/registry/v6/user-mgmt/nextjs.template.json +0 -57
- package/dist/registry/v6/user-mgmt/react-router/api.cometchat-user.ts.tpl +0 -176
- package/dist/registry/v6/user-mgmt/react-router.template.json +0 -40
- package/dist/registry/v6/widget/astro/CometChatWidget.css.tpl +0 -105
- package/dist/registry/v6/widget/astro/CometChatWidget.tsx.tpl +0 -88
- package/dist/registry/v6/widget/astro.template.json +0 -38
- package/dist/registry/v6/widget/nextjs/CometChatWidget.css.tpl +0 -105
- package/dist/registry/v6/widget/nextjs/CometChatWidget.tsx.tpl +0 -88
- package/dist/registry/v6/widget/nextjs.template.json +0 -40
- package/dist/registry/v6/widget/react-router/CometChatWidget.css.tpl +0 -105
- package/dist/registry/v6/widget/react-router/CometChatWidget.tsx.tpl +0 -98
- package/dist/registry/v6/widget/react-router.template.json +0 -36
- package/dist/registry/v6/widget/reactjs/CometChatWidget.css.tpl +0 -105
- package/dist/registry/v6/widget/reactjs/CometChatWidget.tsx.tpl +0 -89
- package/dist/registry/v6/widget/reactjs.template.json +0 -36
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
.cometchat-tabs {
|
|
2
|
-
height: 100%;
|
|
3
|
-
width: 100%;
|
|
4
|
-
display: flex;
|
|
5
|
-
flex-direction: column;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.cometchat-tabs-content {
|
|
9
|
-
flex: 1;
|
|
10
|
-
overflow: hidden;
|
|
11
|
-
display: flex;
|
|
12
|
-
flex-direction: column;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.cometchat-tabs-content > .cometchat {
|
|
16
|
-
flex: 1;
|
|
17
|
-
overflow: hidden;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.cometchat-tabs-bar {
|
|
21
|
-
display: flex;
|
|
22
|
-
border-top: 1px solid var(--cometchat-border-color-default, #e8e8e8);
|
|
23
|
-
background: var(--cometchat-background-color-01, #ffffff);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.cometchat-tabs-bar-tab {
|
|
27
|
-
flex: 1;
|
|
28
|
-
padding: 12px 8px;
|
|
29
|
-
border: none;
|
|
30
|
-
background: transparent;
|
|
31
|
-
font: var(--cometchat-font-body-regular, 400 14px Roboto);
|
|
32
|
-
color: var(--cometchat-text-color-secondary, #727272);
|
|
33
|
-
cursor: pointer;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.cometchat-tabs-bar-tab.active {
|
|
37
|
-
color: var(--cometchat-primary-color, #6852d6);
|
|
38
|
-
font-weight: 600;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.cometchat-tabs-bar-tab:hover {
|
|
42
|
-
background: var(--cometchat-background-color-02, #f8f8f8);
|
|
43
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useEffect, useState } from "react";
|
|
3
|
-
import type { CometChat } from "@cometchat/chat-sdk-javascript";
|
|
4
|
-
import {
|
|
5
|
-
CometChatCallLogs,
|
|
6
|
-
CometChatConversations,
|
|
7
|
-
CometChatGroups,
|
|
8
|
-
CometChatUIKitLoginListener,
|
|
9
|
-
CometChatUsers,
|
|
10
|
-
} from "@cometchat/chat-uikit-react";
|
|
11
|
-
import "./CometChatTabs.css";
|
|
12
|
-
|
|
13
|
-
export type CometChatTab = "chats" | "calls" | "users" | "groups";
|
|
14
|
-
|
|
15
|
-
interface CometChatTabsProps {
|
|
16
|
-
activeTab: CometChatTab;
|
|
17
|
-
onTabChange: (tab: CometChatTab) => void;
|
|
18
|
-
onItemClick: (
|
|
19
|
-
item: CometChat.Conversation | CometChat.User | CometChat.Group,
|
|
20
|
-
) => void;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const TABS: { id: CometChatTab; label: string }[] = [
|
|
24
|
-
{ id: "chats", label: "Chats" },
|
|
25
|
-
{ id: "calls", label: "Calls" },
|
|
26
|
-
{ id: "users", label: "Users" },
|
|
27
|
-
{ id: "groups", label: "Groups" },
|
|
28
|
-
];
|
|
29
|
-
|
|
30
|
-
export const CometChatTabs = ({
|
|
31
|
-
activeTab,
|
|
32
|
-
onTabChange,
|
|
33
|
-
onItemClick,
|
|
34
|
-
}: CometChatTabsProps) => {
|
|
35
|
-
const [loggedInUser, setLoggedInUser] = useState<CometChat.User | null>(null);
|
|
36
|
-
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
setLoggedInUser(CometChatUIKitLoginListener.getLoggedInUser());
|
|
39
|
-
}, []);
|
|
40
|
-
|
|
41
|
-
if (!loggedInUser) return null;
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<div className="cometchat-tabs">
|
|
45
|
-
<div className="cometchat-tabs-content">
|
|
46
|
-
{activeTab === "chats" && (
|
|
47
|
-
<CometChatConversations
|
|
48
|
-
onItemClick={(c) => onItemClick(c)}
|
|
49
|
-
/>
|
|
50
|
-
)}
|
|
51
|
-
{activeTab === "calls" && <CometChatCallLogs />}
|
|
52
|
-
{activeTab === "users" && (
|
|
53
|
-
<CometChatUsers onItemClick={(u) => onItemClick(u)} />
|
|
54
|
-
)}
|
|
55
|
-
{activeTab === "groups" && (
|
|
56
|
-
<CometChatGroups onItemClick={(g) => onItemClick(g)} />
|
|
57
|
-
)}
|
|
58
|
-
</div>
|
|
59
|
-
<nav className="cometchat-tabs-bar">
|
|
60
|
-
{TABS.map((tab) => (
|
|
61
|
-
<button
|
|
62
|
-
key={tab.id}
|
|
63
|
-
type="button"
|
|
64
|
-
className={`cometchat-tabs-bar-tab${activeTab === tab.id ? " active" : ""}`}
|
|
65
|
-
onClick={() => onTabChange(tab.id)}
|
|
66
|
-
>
|
|
67
|
-
{tab.label}
|
|
68
|
-
</button>
|
|
69
|
-
))}
|
|
70
|
-
</nav>
|
|
71
|
-
</div>
|
|
72
|
-
);
|
|
73
|
-
};
|
package/dist/registry/v6/experiences/3-tab-based/templates/react-router/CometChat-route.tsx.tpl
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React, { lazy, Suspense, useEffect, useState } from "react";
|
|
2
|
-
|
|
3
|
-
const CometChatNoSSR = lazy(() => import("../cometchat/CometChatNoSSR"));
|
|
4
|
-
|
|
5
|
-
export default function CometChatRoute() {
|
|
6
|
-
const [mounted, setMounted] = useState(false);
|
|
7
|
-
|
|
8
|
-
useEffect(() => {
|
|
9
|
-
setMounted(true);
|
|
10
|
-
}, []);
|
|
11
|
-
|
|
12
|
-
if (!mounted) {
|
|
13
|
-
return <div style={{ padding: 16 }}>Loading…</div>;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
<Suspense fallback={<div style={{ padding: 16 }}>Loading…</div>}>
|
|
18
|
-
<CometChatNoSSR />
|
|
19
|
-
</Suspense>
|
|
20
|
-
);
|
|
21
|
-
}
|
package/dist/registry/v6/experiences/3-tab-based/templates/react-router/CometChatNoSSR.css.tpl
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
.conversations-with-messages {
|
|
2
|
-
display: flex;
|
|
3
|
-
height: 100vh;
|
|
4
|
-
width: 100%;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.conversations-wrapper {
|
|
8
|
-
height: 100%;
|
|
9
|
-
width: 480px;
|
|
10
|
-
overflow: hidden;
|
|
11
|
-
display: flex;
|
|
12
|
-
flex-direction: column;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.conversations-wrapper > .cometchat {
|
|
16
|
-
overflow: hidden;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.messages-wrapper {
|
|
20
|
-
width: calc(100% - 480px);
|
|
21
|
-
height: 100%;
|
|
22
|
-
display: flex;
|
|
23
|
-
flex-direction: column;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.empty-conversation {
|
|
27
|
-
height: 100%;
|
|
28
|
-
width: 100%;
|
|
29
|
-
display: flex;
|
|
30
|
-
justify-content: center;
|
|
31
|
-
align-items: center;
|
|
32
|
-
background: white;
|
|
33
|
-
color: var(--cometchat-text-color-secondary, #727272);
|
|
34
|
-
font: var(--cometchat-font-body-regular, 400 14px Roboto);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.cometchat .cometchat-message-composer {
|
|
38
|
-
border-radius: 0;
|
|
39
|
-
}
|
package/dist/registry/v6/experiences/3-tab-based/templates/react-router/CometChatNoSSR.tsx.tpl
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from "react";
|
|
2
|
-
import {
|
|
3
|
-
CometChatMessageComposer,
|
|
4
|
-
CometChatMessageHeader,
|
|
5
|
-
CometChatMessageList,
|
|
6
|
-
CometChatUIKit,
|
|
7
|
-
UIKitSettingsBuilder,
|
|
8
|
-
} from "@cometchat/chat-uikit-react";
|
|
9
|
-
import { CometChat } from "@cometchat/chat-sdk-javascript";
|
|
10
|
-
import { CometChatTabs, type CometChatTab } from "./CometChatTabs";
|
|
11
|
-
// css-variables.css is imported in app/app.css — do NOT import it here
|
|
12
|
-
import "./CometChatNoSSR.css";
|
|
13
|
-
|
|
14
|
-
const COMETCHAT_CONSTANTS = {
|
|
15
|
-
APP_ID: import.meta.env.{{ENV_PREFIX}}COMETCHAT_APP_ID as string,
|
|
16
|
-
REGION: import.meta.env.{{ENV_PREFIX}}COMETCHAT_REGION as string,
|
|
17
|
-
AUTH_KEY: import.meta.env.{{ENV_PREFIX}}COMETCHAT_AUTH_KEY as string,
|
|
18
|
-
};
|
|
19
|
-
const UID = "{{LOGIN_UID}}";
|
|
20
|
-
|
|
21
|
-
const CometChatNoSSR: React.FC = () => {
|
|
22
|
-
const [user, setUser] = useState<CometChat.User | undefined>();
|
|
23
|
-
const [error, setError] = useState<string | null>(null);
|
|
24
|
-
const [activeTab, setActiveTab] = useState<CometChatTab>("chats");
|
|
25
|
-
const [selectedUser, setSelectedUser] = useState<CometChat.User | undefined>();
|
|
26
|
-
const [selectedGroup, setSelectedGroup] = useState<CometChat.Group | undefined>();
|
|
27
|
-
|
|
28
|
-
useEffect(() => {
|
|
29
|
-
if (typeof window === "undefined") return;
|
|
30
|
-
|
|
31
|
-
const settings = new UIKitSettingsBuilder()
|
|
32
|
-
.setAppId(COMETCHAT_CONSTANTS.APP_ID)
|
|
33
|
-
.setRegion(COMETCHAT_CONSTANTS.REGION)
|
|
34
|
-
.setAuthKey(COMETCHAT_CONSTANTS.AUTH_KEY)
|
|
35
|
-
.subscribePresenceForAllUsers()
|
|
36
|
-
.build();
|
|
37
|
-
|
|
38
|
-
CometChatUIKit.init(settings)?.then(() => {
|
|
39
|
-
CometChatUIKit.getLoggedinUser().then((u) => {
|
|
40
|
-
if (!u) {
|
|
41
|
-
CometChatUIKit.login(UID)
|
|
42
|
-
.then(setUser)
|
|
43
|
-
.catch((e: unknown) => setError(String(e)));
|
|
44
|
-
} else {
|
|
45
|
-
setUser(u);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
}).catch((e: unknown) => setError(String(e)));
|
|
49
|
-
}, []);
|
|
50
|
-
|
|
51
|
-
const handleSelectorItemClicked = (
|
|
52
|
-
activeItem: CometChat.Conversation | CometChat.User | CometChat.Group,
|
|
53
|
-
) => {
|
|
54
|
-
const item =
|
|
55
|
-
activeItem instanceof CometChat.Conversation
|
|
56
|
-
? activeItem.getConversationWith()
|
|
57
|
-
: activeItem;
|
|
58
|
-
if (item instanceof CometChat.User) {
|
|
59
|
-
setSelectedUser(item);
|
|
60
|
-
setSelectedGroup(undefined);
|
|
61
|
-
} else if (item instanceof CometChat.Group) {
|
|
62
|
-
setSelectedUser(undefined);
|
|
63
|
-
setSelectedGroup(item);
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
if (error) return <div style={{ color: "red", padding: 16, fontFamily: "monospace" }}>{error}</div>;
|
|
68
|
-
if (!user) return null;
|
|
69
|
-
|
|
70
|
-
return (
|
|
71
|
-
<div className="conversations-with-messages">
|
|
72
|
-
<div className="conversations-wrapper">
|
|
73
|
-
<CometChatTabs
|
|
74
|
-
activeTab={activeTab}
|
|
75
|
-
onTabChange={setActiveTab}
|
|
76
|
-
onItemClick={handleSelectorItemClicked}
|
|
77
|
-
/>
|
|
78
|
-
</div>
|
|
79
|
-
{selectedUser || selectedGroup ? (
|
|
80
|
-
<div className="messages-wrapper">
|
|
81
|
-
{selectedUser && <CometChatMessageHeader user={selectedUser} />}
|
|
82
|
-
{selectedGroup && <CometChatMessageHeader group={selectedGroup} />}
|
|
83
|
-
{selectedUser && <CometChatMessageList user={selectedUser} />}
|
|
84
|
-
{selectedGroup && <CometChatMessageList group={selectedGroup} />}
|
|
85
|
-
{selectedUser && <CometChatMessageComposer user={selectedUser} />}
|
|
86
|
-
{selectedGroup && <CometChatMessageComposer group={selectedGroup} />}
|
|
87
|
-
</div>
|
|
88
|
-
) : (
|
|
89
|
-
<div className="empty-conversation">Select a conversation to start chatting</div>
|
|
90
|
-
)}
|
|
91
|
-
</div>
|
|
92
|
-
);
|
|
93
|
-
};
|
|
94
|
-
export default CometChatNoSSR;
|
package/dist/registry/v6/experiences/3-tab-based/templates/react-router/CometChatTabs.css.tpl
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
.cometchat-tabs {
|
|
2
|
-
height: 100%;
|
|
3
|
-
width: 100%;
|
|
4
|
-
display: flex;
|
|
5
|
-
flex-direction: column;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.cometchat-tabs-content {
|
|
9
|
-
flex: 1;
|
|
10
|
-
overflow: hidden;
|
|
11
|
-
display: flex;
|
|
12
|
-
flex-direction: column;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.cometchat-tabs-content > .cometchat {
|
|
16
|
-
flex: 1;
|
|
17
|
-
overflow: hidden;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.cometchat-tabs-bar {
|
|
21
|
-
display: flex;
|
|
22
|
-
border-top: 1px solid var(--cometchat-border-color-default, #e8e8e8);
|
|
23
|
-
background: var(--cometchat-background-color-01, #ffffff);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.cometchat-tabs-bar-tab {
|
|
27
|
-
flex: 1;
|
|
28
|
-
padding: 12px 8px;
|
|
29
|
-
border: none;
|
|
30
|
-
background: transparent;
|
|
31
|
-
font: var(--cometchat-font-body-regular, 400 14px Roboto);
|
|
32
|
-
color: var(--cometchat-text-color-secondary, #727272);
|
|
33
|
-
cursor: pointer;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.cometchat-tabs-bar-tab.active {
|
|
37
|
-
color: var(--cometchat-primary-color, #6852d6);
|
|
38
|
-
font-weight: 600;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.cometchat-tabs-bar-tab:hover {
|
|
42
|
-
background: var(--cometchat-background-color-02, #f8f8f8);
|
|
43
|
-
}
|
package/dist/registry/v6/experiences/3-tab-based/templates/react-router/CometChatTabs.tsx.tpl
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from "react";
|
|
2
|
-
import type { CometChat } from "@cometchat/chat-sdk-javascript";
|
|
3
|
-
import {
|
|
4
|
-
CometChatCallLogs,
|
|
5
|
-
CometChatConversations,
|
|
6
|
-
CometChatGroups,
|
|
7
|
-
CometChatUIKitLoginListener,
|
|
8
|
-
CometChatUsers,
|
|
9
|
-
} from "@cometchat/chat-uikit-react";
|
|
10
|
-
import "./CometChatTabs.css";
|
|
11
|
-
|
|
12
|
-
export type CometChatTab = "chats" | "calls" | "users" | "groups";
|
|
13
|
-
|
|
14
|
-
interface CometChatTabsProps {
|
|
15
|
-
activeTab: CometChatTab;
|
|
16
|
-
onTabChange: (tab: CometChatTab) => void;
|
|
17
|
-
onItemClick: (
|
|
18
|
-
item: CometChat.Conversation | CometChat.User | CometChat.Group,
|
|
19
|
-
) => void;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const TABS: { id: CometChatTab; label: string }[] = [
|
|
23
|
-
{ id: "chats", label: "Chats" },
|
|
24
|
-
{ id: "calls", label: "Calls" },
|
|
25
|
-
{ id: "users", label: "Users" },
|
|
26
|
-
{ id: "groups", label: "Groups" },
|
|
27
|
-
];
|
|
28
|
-
|
|
29
|
-
export const CometChatTabs = ({
|
|
30
|
-
activeTab,
|
|
31
|
-
onTabChange,
|
|
32
|
-
onItemClick,
|
|
33
|
-
}: CometChatTabsProps) => {
|
|
34
|
-
const [loggedInUser, setLoggedInUser] = useState<CometChat.User | null>(null);
|
|
35
|
-
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
setLoggedInUser(CometChatUIKitLoginListener.getLoggedInUser());
|
|
38
|
-
}, []);
|
|
39
|
-
|
|
40
|
-
if (!loggedInUser) return null;
|
|
41
|
-
|
|
42
|
-
return (
|
|
43
|
-
<div className="cometchat-tabs">
|
|
44
|
-
<div className="cometchat-tabs-content">
|
|
45
|
-
{activeTab === "chats" && (
|
|
46
|
-
<CometChatConversations
|
|
47
|
-
onItemClick={(c) => onItemClick(c)}
|
|
48
|
-
/>
|
|
49
|
-
)}
|
|
50
|
-
{activeTab === "calls" && <CometChatCallLogs />}
|
|
51
|
-
{activeTab === "users" && (
|
|
52
|
-
<CometChatUsers onItemClick={(u) => onItemClick(u)} />
|
|
53
|
-
)}
|
|
54
|
-
{activeTab === "groups" && (
|
|
55
|
-
<CometChatGroups onItemClick={(g) => onItemClick(g)} />
|
|
56
|
-
)}
|
|
57
|
-
</div>
|
|
58
|
-
<nav className="cometchat-tabs-bar">
|
|
59
|
-
{TABS.map((tab) => (
|
|
60
|
-
<button
|
|
61
|
-
key={tab.id}
|
|
62
|
-
type="button"
|
|
63
|
-
className={`cometchat-tabs-bar-tab${activeTab === tab.id ? " active" : ""}`}
|
|
64
|
-
onClick={() => onTabChange(tab.id)}
|
|
65
|
-
>
|
|
66
|
-
{tab.label}
|
|
67
|
-
</button>
|
|
68
|
-
))}
|
|
69
|
-
</nav>
|
|
70
|
-
</div>
|
|
71
|
-
);
|
|
72
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
#root { width: 100vw; height: 100vh; }
|
|
2
|
-
.conversations-with-messages { display: flex; height: 100%; width: 100%; }
|
|
3
|
-
.conversations-wrapper { height: 100vh; width: 480px; overflow: hidden; display: flex; flex-direction: column; }
|
|
4
|
-
.conversations-wrapper > .cometchat { overflow: hidden; }
|
|
5
|
-
.messages-wrapper { width: 100%; height: 100%; display: flex; flex-direction: column; }
|
|
6
|
-
.empty-conversation { height: 100vh; width: 100%; display: flex; justify-content: center; align-items: center; background: var(--cometchat-background-color-03, #F5F5F5); color: var(--cometchat-text-color-secondary, #727272); font: var(--cometchat-font-body-regular, 400 14px Roboto); }
|
|
7
|
-
.cometchat .cometchat-message-composer { border-radius: 0; }
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { useState } from "react";
|
|
2
|
-
import {
|
|
3
|
-
CometChatMessageComposer,
|
|
4
|
-
CometChatMessageHeader,
|
|
5
|
-
CometChatMessageList,
|
|
6
|
-
} from "@cometchat/chat-uikit-react";
|
|
7
|
-
import { CometChat } from "@cometchat/chat-sdk-javascript";
|
|
8
|
-
import { CometChatTabs, type CometChatTab } from "./cometchat/CometChatTabs";
|
|
9
|
-
import "./App.css";
|
|
10
|
-
|
|
11
|
-
function App() {
|
|
12
|
-
const [activeTab, setActiveTab] = useState<CometChatTab>("chats");
|
|
13
|
-
const [selectedUser, setSelectedUser] = useState<
|
|
14
|
-
CometChat.User | undefined
|
|
15
|
-
>();
|
|
16
|
-
const [selectedGroup, setSelectedGroup] = useState<
|
|
17
|
-
CometChat.Group | undefined
|
|
18
|
-
>();
|
|
19
|
-
|
|
20
|
-
const handleSelectorItemClicked = (
|
|
21
|
-
activeItem: CometChat.Conversation | CometChat.User | CometChat.Group,
|
|
22
|
-
) => {
|
|
23
|
-
const item =
|
|
24
|
-
activeItem instanceof CometChat.Conversation
|
|
25
|
-
? activeItem.getConversationWith()
|
|
26
|
-
: activeItem;
|
|
27
|
-
if (item instanceof CometChat.User) {
|
|
28
|
-
setSelectedUser(item);
|
|
29
|
-
setSelectedGroup(undefined);
|
|
30
|
-
} else if (item instanceof CometChat.Group) {
|
|
31
|
-
setSelectedUser(undefined);
|
|
32
|
-
setSelectedGroup(item);
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
return (
|
|
37
|
-
<div className="conversations-with-messages">
|
|
38
|
-
<div className="conversations-wrapper">
|
|
39
|
-
<CometChatTabs
|
|
40
|
-
activeTab={activeTab}
|
|
41
|
-
onTabChange={setActiveTab}
|
|
42
|
-
onItemClick={handleSelectorItemClicked}
|
|
43
|
-
/>
|
|
44
|
-
</div>
|
|
45
|
-
{selectedUser || selectedGroup ? (
|
|
46
|
-
<div className="messages-wrapper">
|
|
47
|
-
{selectedUser && <CometChatMessageHeader user={selectedUser} />}
|
|
48
|
-
{selectedGroup && <CometChatMessageHeader group={selectedGroup} />}
|
|
49
|
-
{selectedUser && <CometChatMessageList user={selectedUser} />}
|
|
50
|
-
{selectedGroup && <CometChatMessageList group={selectedGroup} />}
|
|
51
|
-
{selectedUser && <CometChatMessageComposer user={selectedUser} />}
|
|
52
|
-
{selectedGroup && <CometChatMessageComposer group={selectedGroup} />}
|
|
53
|
-
</div>
|
|
54
|
-
) : (
|
|
55
|
-
<div className="empty-conversation">
|
|
56
|
-
Select a conversation to start chatting
|
|
57
|
-
</div>
|
|
58
|
-
)}
|
|
59
|
-
</div>
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
export default App;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
.cometchat-tabs {
|
|
2
|
-
height: 100vh;
|
|
3
|
-
width: 100%;
|
|
4
|
-
display: flex;
|
|
5
|
-
flex-direction: column;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.cometchat-tabs-content {
|
|
9
|
-
flex: 1;
|
|
10
|
-
overflow: hidden;
|
|
11
|
-
display: flex;
|
|
12
|
-
flex-direction: column;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.cometchat-tabs-content > .cometchat {
|
|
16
|
-
flex: 1;
|
|
17
|
-
overflow: hidden;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.cometchat-tabs-bar {
|
|
21
|
-
display: flex;
|
|
22
|
-
border-top: 1px solid var(--cometchat-border-color-default, #e8e8e8);
|
|
23
|
-
background: var(--cometchat-background-color-01, #ffffff);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.cometchat-tabs-bar-tab {
|
|
27
|
-
flex: 1;
|
|
28
|
-
padding: 12px 8px;
|
|
29
|
-
border: none;
|
|
30
|
-
background: transparent;
|
|
31
|
-
font: var(--cometchat-font-body-regular, 400 14px Roboto);
|
|
32
|
-
color: var(--cometchat-text-color-secondary, #727272);
|
|
33
|
-
cursor: pointer;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.cometchat-tabs-bar-tab.active {
|
|
37
|
-
color: var(--cometchat-primary-color, #6852d6);
|
|
38
|
-
font-weight: 600;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.cometchat-tabs-bar-tab:hover {
|
|
42
|
-
background: var(--cometchat-background-color-02, #f8f8f8);
|
|
43
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from "react";
|
|
2
|
-
import type { CometChat } from "@cometchat/chat-sdk-javascript";
|
|
3
|
-
import {
|
|
4
|
-
CometChatCallLogs,
|
|
5
|
-
CometChatConversations,
|
|
6
|
-
CometChatGroups,
|
|
7
|
-
CometChatUIKitLoginListener,
|
|
8
|
-
CometChatUsers,
|
|
9
|
-
} from "@cometchat/chat-uikit-react";
|
|
10
|
-
import "./CometChatTabs.css";
|
|
11
|
-
|
|
12
|
-
export type CometChatTab = "chats" | "calls" | "users" | "groups";
|
|
13
|
-
|
|
14
|
-
interface CometChatTabsProps {
|
|
15
|
-
activeTab: CometChatTab;
|
|
16
|
-
onTabChange: (tab: CometChatTab) => void;
|
|
17
|
-
onItemClick: (
|
|
18
|
-
item: CometChat.Conversation | CometChat.User | CometChat.Group,
|
|
19
|
-
) => void;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const TABS: { id: CometChatTab; label: string }[] = [
|
|
23
|
-
{ id: "chats", label: "Chats" },
|
|
24
|
-
{ id: "calls", label: "Calls" },
|
|
25
|
-
{ id: "users", label: "Users" },
|
|
26
|
-
{ id: "groups", label: "Groups" },
|
|
27
|
-
];
|
|
28
|
-
|
|
29
|
-
export const CometChatTabs = ({
|
|
30
|
-
activeTab,
|
|
31
|
-
onTabChange,
|
|
32
|
-
onItemClick,
|
|
33
|
-
}: CometChatTabsProps) => {
|
|
34
|
-
const [loggedInUser, setLoggedInUser] = useState<CometChat.User | null>(null);
|
|
35
|
-
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
setLoggedInUser(CometChatUIKitLoginListener.getLoggedInUser());
|
|
38
|
-
}, []);
|
|
39
|
-
|
|
40
|
-
if (!loggedInUser) return null;
|
|
41
|
-
|
|
42
|
-
return (
|
|
43
|
-
<div className="cometchat-tabs">
|
|
44
|
-
<div className="cometchat-tabs-content">
|
|
45
|
-
{activeTab === "chats" && (
|
|
46
|
-
<CometChatConversations
|
|
47
|
-
onItemClick={(c) => onItemClick(c)}
|
|
48
|
-
/>
|
|
49
|
-
)}
|
|
50
|
-
{activeTab === "calls" && <CometChatCallLogs />}
|
|
51
|
-
{activeTab === "users" && (
|
|
52
|
-
<CometChatUsers onItemClick={(u) => onItemClick(u)} />
|
|
53
|
-
)}
|
|
54
|
-
{activeTab === "groups" && (
|
|
55
|
-
<CometChatGroups onItemClick={(g) => onItemClick(g)} />
|
|
56
|
-
)}
|
|
57
|
-
</div>
|
|
58
|
-
<nav className="cometchat-tabs-bar">
|
|
59
|
-
{TABS.map((tab) => (
|
|
60
|
-
<button
|
|
61
|
-
key={tab.id}
|
|
62
|
-
type="button"
|
|
63
|
-
className={`cometchat-tabs-bar-tab${activeTab === tab.id ? " active" : ""}`}
|
|
64
|
-
onClick={() => onTabChange(tab.id)}
|
|
65
|
-
>
|
|
66
|
-
{tab.label}
|
|
67
|
-
</button>
|
|
68
|
-
))}
|
|
69
|
-
</nav>
|
|
70
|
-
</div>
|
|
71
|
-
);
|
|
72
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { StrictMode } from 'react'
|
|
2
|
-
import { createRoot } from 'react-dom/client'
|
|
3
|
-
import { CometChatUIKit, UIKitSettingsBuilder } from '@cometchat/chat-uikit-react'
|
|
4
|
-
import './index.css'
|
|
5
|
-
import App from './App.tsx'
|
|
6
|
-
|
|
7
|
-
const COMETCHAT_CONSTANTS = {
|
|
8
|
-
APP_ID: import.meta.env.{{ENV_PREFIX}}COMETCHAT_APP_ID as string,
|
|
9
|
-
REGION: import.meta.env.{{ENV_PREFIX}}COMETCHAT_REGION as string,
|
|
10
|
-
AUTH_KEY: import.meta.env.{{ENV_PREFIX}}COMETCHAT_AUTH_KEY as string,
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const settings = new UIKitSettingsBuilder()
|
|
14
|
-
.setAppId(COMETCHAT_CONSTANTS.APP_ID)
|
|
15
|
-
.setRegion(COMETCHAT_CONSTANTS.REGION)
|
|
16
|
-
.setAuthKey(COMETCHAT_CONSTANTS.AUTH_KEY)
|
|
17
|
-
.subscribePresenceForAllUsers()
|
|
18
|
-
.build()
|
|
19
|
-
|
|
20
|
-
CometChatUIKit.init(settings)
|
|
21
|
-
?.then(() => {
|
|
22
|
-
CometChatUIKit.getLoggedinUser().then((user) => {
|
|
23
|
-
if (!user) {
|
|
24
|
-
CometChatUIKit.login('{{LOGIN_UID}}')
|
|
25
|
-
.then(() => mount())
|
|
26
|
-
.catch((e: unknown) => mountError(String(e)))
|
|
27
|
-
} else {
|
|
28
|
-
mount()
|
|
29
|
-
}
|
|
30
|
-
})
|
|
31
|
-
})
|
|
32
|
-
.catch((e: unknown) => mountError(String(e)))
|
|
33
|
-
|
|
34
|
-
function mount() {
|
|
35
|
-
createRoot(document.getElementById('root')!).render(
|
|
36
|
-
<StrictMode>
|
|
37
|
-
<App />
|
|
38
|
-
</StrictMode>,
|
|
39
|
-
)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function mountError(message: string) {
|
|
43
|
-
createRoot(document.getElementById('root')!).render(
|
|
44
|
-
<div style={{ color: 'red', padding: 16, fontFamily: 'monospace' }}>{message}</div>,
|
|
45
|
-
)
|
|
46
|
-
}
|