@cometchat/skills-cli 2.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 +70 -0
- package/bin/cometchat.mjs +7 -0
- package/dist/index.js +4395 -0
- package/dist/registry/schemas/template.schema.json +142 -0
- package/dist/registry/v6/experiences/1-conversation-list/astro.template.json +89 -0
- package/dist/registry/v6/experiences/1-conversation-list/nextjs-pages.template.json +83 -0
- package/dist/registry/v6/experiences/1-conversation-list/nextjs.template.json +83 -0
- package/dist/registry/v6/experiences/1-conversation-list/react-router.template.json +102 -0
- package/dist/registry/v6/experiences/1-conversation-list/reactjs.template.json +86 -0
- package/dist/registry/v6/experiences/1-conversation-list/templates/astro/ChatApp.css.tpl +39 -0
- package/dist/registry/v6/experiences/1-conversation-list/templates/astro/ChatApp.tsx.tpl +86 -0
- package/dist/registry/v6/experiences/1-conversation-list/templates/astro/CometChatSelector.tsx.tpl +40 -0
- package/dist/registry/v6/experiences/1-conversation-list/templates/astro/chat.astro.tpl +17 -0
- package/dist/registry/v6/experiences/1-conversation-list/templates/nextjs/CometChatNoSSR.css.tpl +39 -0
- package/dist/registry/v6/experiences/1-conversation-list/templates/nextjs/CometChatNoSSR.tsx.tpl +86 -0
- package/dist/registry/v6/experiences/1-conversation-list/templates/nextjs/CometChatSelector.tsx.tpl +41 -0
- package/dist/registry/v6/experiences/1-conversation-list/templates/nextjs/chat-page.tsx.tpl +11 -0
- package/dist/registry/v6/experiences/1-conversation-list/templates/nextjs-pages/CometChatNoSSR.css.tpl +39 -0
- package/dist/registry/v6/experiences/1-conversation-list/templates/nextjs-pages/CometChatNoSSR.tsx.tpl +88 -0
- package/dist/registry/v6/experiences/1-conversation-list/templates/nextjs-pages/CometChatSelector.tsx.tpl +41 -0
- package/dist/registry/v6/experiences/1-conversation-list/templates/nextjs-pages/chat-page.tsx.tpl +15 -0
- package/dist/registry/v6/experiences/1-conversation-list/templates/react-router/CometChat-route.tsx.tpl +22 -0
- package/dist/registry/v6/experiences/1-conversation-list/templates/react-router/CometChatNoSSR.css.tpl +39 -0
- package/dist/registry/v6/experiences/1-conversation-list/templates/react-router/CometChatNoSSR.tsx.tpl +87 -0
- package/dist/registry/v6/experiences/1-conversation-list/templates/react-router/CometChatSelector.tsx.tpl +40 -0
- package/dist/registry/v6/experiences/1-conversation-list/templates/reactjs/App.css.tpl +32 -0
- package/dist/registry/v6/experiences/1-conversation-list/templates/reactjs/App.tsx.tpl +55 -0
- package/dist/registry/v6/experiences/1-conversation-list/templates/reactjs/CometChatSelector.tsx.tpl +40 -0
- package/dist/registry/v6/experiences/1-conversation-list/templates/reactjs/main.tsx.tpl +46 -0
- package/dist/registry/v6/experiences/2-one-to-one/astro.template.json +81 -0
- package/dist/registry/v6/experiences/2-one-to-one/nextjs.template.json +77 -0
- package/dist/registry/v6/experiences/2-one-to-one/react-router.template.json +93 -0
- package/dist/registry/v6/experiences/2-one-to-one/reactjs.template.json +77 -0
- package/dist/registry/v6/experiences/2-one-to-one/templates/astro/ChatApp.css.tpl +21 -0
- package/dist/registry/v6/experiences/2-one-to-one/templates/astro/ChatApp.tsx.tpl +66 -0
- package/dist/registry/v6/experiences/2-one-to-one/templates/astro/chat.astro.tpl +17 -0
- package/dist/registry/v6/experiences/2-one-to-one/templates/nextjs/CometChatNoSSR.css.tpl +21 -0
- package/dist/registry/v6/experiences/2-one-to-one/templates/nextjs/CometChatNoSSR.tsx.tpl +66 -0
- package/dist/registry/v6/experiences/2-one-to-one/templates/nextjs/chat-page.tsx.tpl +11 -0
- package/dist/registry/v6/experiences/2-one-to-one/templates/react-router/CometChat-route.tsx.tpl +21 -0
- package/dist/registry/v6/experiences/2-one-to-one/templates/react-router/CometChatNoSSR.css.tpl +21 -0
- package/dist/registry/v6/experiences/2-one-to-one/templates/react-router/CometChatNoSSR.tsx.tpl +67 -0
- package/dist/registry/v6/experiences/2-one-to-one/templates/reactjs/App.css.tpl +4 -0
- package/dist/registry/v6/experiences/2-one-to-one/templates/reactjs/App.tsx.tpl +44 -0
- package/dist/registry/v6/experiences/2-one-to-one/templates/reactjs/main.tsx.tpl +46 -0
- package/dist/registry/v6/experiences/3-tab-based/astro.template.json +93 -0
- package/dist/registry/v6/experiences/3-tab-based/nextjs.template.json +90 -0
- package/dist/registry/v6/experiences/3-tab-based/react-router.template.json +105 -0
- package/dist/registry/v6/experiences/3-tab-based/reactjs.template.json +90 -0
- package/dist/registry/v6/experiences/3-tab-based/templates/astro/ChatApp.css.tpl +39 -0
- package/dist/registry/v6/experiences/3-tab-based/templates/astro/ChatApp.tsx.tpl +93 -0
- package/dist/registry/v6/experiences/3-tab-based/templates/astro/CometChatTabs.css.tpl +43 -0
- package/dist/registry/v6/experiences/3-tab-based/templates/astro/CometChatTabs.tsx.tpl +72 -0
- package/dist/registry/v6/experiences/3-tab-based/templates/astro/chat.astro.tpl +17 -0
- package/dist/registry/v6/experiences/3-tab-based/templates/nextjs/CometChatNoSSR.css.tpl +39 -0
- package/dist/registry/v6/experiences/3-tab-based/templates/nextjs/CometChatNoSSR.tsx.tpl +93 -0
- package/dist/registry/v6/experiences/3-tab-based/templates/nextjs/CometChatTabs.css.tpl +43 -0
- package/dist/registry/v6/experiences/3-tab-based/templates/nextjs/CometChatTabs.tsx.tpl +73 -0
- package/dist/registry/v6/experiences/3-tab-based/templates/nextjs/chat-page.tsx.tpl +11 -0
- package/dist/registry/v6/experiences/3-tab-based/templates/react-router/CometChat-route.tsx.tpl +21 -0
- package/dist/registry/v6/experiences/3-tab-based/templates/react-router/CometChatNoSSR.css.tpl +39 -0
- package/dist/registry/v6/experiences/3-tab-based/templates/react-router/CometChatNoSSR.tsx.tpl +94 -0
- package/dist/registry/v6/experiences/3-tab-based/templates/react-router/CometChatTabs.css.tpl +43 -0
- package/dist/registry/v6/experiences/3-tab-based/templates/react-router/CometChatTabs.tsx.tpl +72 -0
- package/dist/registry/v6/experiences/3-tab-based/templates/reactjs/App.css.tpl +7 -0
- package/dist/registry/v6/experiences/3-tab-based/templates/reactjs/App.tsx.tpl +62 -0
- package/dist/registry/v6/experiences/3-tab-based/templates/reactjs/CometChatTabs.css.tpl +43 -0
- package/dist/registry/v6/experiences/3-tab-based/templates/reactjs/CometChatTabs.tsx.tpl +72 -0
- package/dist/registry/v6/experiences/3-tab-based/templates/reactjs/main.tsx.tpl +46 -0
- package/dist/registry/v6/features/catalog.json +344 -0
- package/dist/registry/v6/production/astro/cometchat-token.ts.tpl +86 -0
- package/dist/registry/v6/production/astro.template.json +51 -0
- package/dist/registry/v6/production/nextjs/route.ts.tpl +79 -0
- package/dist/registry/v6/production/nextjs.template.json +50 -0
- package/dist/registry/v6/production/react-router/api.cometchat-token.ts.tpl +73 -0
- package/dist/registry/v6/production/react-router.template.json +58 -0
- package/dist/registry/v6/user-mgmt/astro/cometchat-user.ts.tpl +164 -0
- package/dist/registry/v6/user-mgmt/astro.template.json +33 -0
- package/dist/registry/v6/user-mgmt/nextjs/route.ts.tpl +212 -0
- package/dist/registry/v6/user-mgmt/nextjs.template.json +57 -0
- package/dist/registry/v6/user-mgmt/react-router/api.cometchat-user.ts.tpl +176 -0
- package/dist/registry/v6/user-mgmt/react-router.template.json +40 -0
- package/dist/registry/v6/widget/astro/CometChatWidget.css.tpl +105 -0
- package/dist/registry/v6/widget/astro/CometChatWidget.tsx.tpl +88 -0
- package/dist/registry/v6/widget/astro.template.json +38 -0
- package/dist/registry/v6/widget/nextjs/CometChatWidget.css.tpl +105 -0
- package/dist/registry/v6/widget/nextjs/CometChatWidget.tsx.tpl +88 -0
- package/dist/registry/v6/widget/nextjs.template.json +40 -0
- package/dist/registry/v6/widget/react-router/CometChatWidget.css.tpl +105 -0
- package/dist/registry/v6/widget/react-router/CometChatWidget.tsx.tpl +98 -0
- package/dist/registry/v6/widget/react-router.template.json +36 -0
- package/dist/registry/v6/widget/reactjs/CometChatWidget.css.tpl +105 -0
- package/dist/registry/v6/widget/reactjs/CometChatWidget.tsx.tpl +89 -0
- package/dist/registry/v6/widget/reactjs.template.json +36 -0
- package/package.json +53 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import React, { useEffect, useState } from "react";
|
|
3
|
+
import {
|
|
4
|
+
CometChatMessageComposer,
|
|
5
|
+
CometChatMessageHeader,
|
|
6
|
+
CometChatMessageList,
|
|
7
|
+
CometChatUIKit,
|
|
8
|
+
UIKitSettingsBuilder,
|
|
9
|
+
} from "@cometchat/chat-uikit-react";
|
|
10
|
+
import { CometChat } from "@cometchat/chat-sdk-javascript";
|
|
11
|
+
// css-variables.css is imported in app/globals.css — do NOT import it here
|
|
12
|
+
import "./CometChatNoSSR.css";
|
|
13
|
+
|
|
14
|
+
const COMETCHAT_CONSTANTS = {
|
|
15
|
+
APP_ID: process.env.{{ENV_PREFIX}}COMETCHAT_APP_ID!,
|
|
16
|
+
REGION: process.env.{{ENV_PREFIX}}COMETCHAT_REGION!,
|
|
17
|
+
AUTH_KEY: process.env.{{ENV_PREFIX}}COMETCHAT_AUTH_KEY!,
|
|
18
|
+
};
|
|
19
|
+
const LOGIN_UID = "{{LOGIN_UID}}";
|
|
20
|
+
const CHAT_UID = "{{CHAT_UID}}";
|
|
21
|
+
|
|
22
|
+
const CometChatNoSSR: React.FC = () => {
|
|
23
|
+
const [loggedIn, setLoggedIn] = useState(false);
|
|
24
|
+
const [chatUser, setChatUser] = useState<CometChat.User | undefined>();
|
|
25
|
+
const [error, setError] = useState<string | null>(null);
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
const settings = new UIKitSettingsBuilder()
|
|
29
|
+
.setAppId(COMETCHAT_CONSTANTS.APP_ID)
|
|
30
|
+
.setRegion(COMETCHAT_CONSTANTS.REGION)
|
|
31
|
+
.setAuthKey(COMETCHAT_CONSTANTS.AUTH_KEY)
|
|
32
|
+
.subscribePresenceForAllUsers()
|
|
33
|
+
.build();
|
|
34
|
+
|
|
35
|
+
CometChatUIKit.init(settings)?.then(() => {
|
|
36
|
+
CometChatUIKit.getLoggedinUser().then((u) => {
|
|
37
|
+
if (!u) {
|
|
38
|
+
CometChatUIKit.login(LOGIN_UID)
|
|
39
|
+
.then(() => setLoggedIn(true))
|
|
40
|
+
.catch((e: unknown) => setError(String(e)));
|
|
41
|
+
} else {
|
|
42
|
+
setLoggedIn(true);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}).catch((e: unknown) => setError(String(e)));
|
|
46
|
+
}, []);
|
|
47
|
+
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
if (!loggedIn) return;
|
|
50
|
+
CometChat.getUser(CHAT_UID)
|
|
51
|
+
.then((u) => setChatUser(u))
|
|
52
|
+
.catch((e: unknown) => setError(String(e)));
|
|
53
|
+
}, [loggedIn]);
|
|
54
|
+
|
|
55
|
+
if (error) return <div style={{ color: "red", padding: 16, fontFamily: "monospace" }}>{error}</div>;
|
|
56
|
+
if (!loggedIn || !chatUser) return <div className="empty-conversation">Loading chat…</div>;
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<div className="messages-wrapper">
|
|
60
|
+
<CometChatMessageHeader user={chatUser} />
|
|
61
|
+
<CometChatMessageList user={chatUser} />
|
|
62
|
+
<CometChatMessageComposer user={chatUser} />
|
|
63
|
+
</div>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
export default CometChatNoSSR;
|
package/dist/registry/v6/experiences/2-one-to-one/templates/react-router/CometChat-route.tsx.tpl
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
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/2-one-to-one/templates/react-router/CometChatNoSSR.css.tpl
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
.messages-wrapper {
|
|
2
|
+
width: 100%;
|
|
3
|
+
height: 100vh;
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.empty-conversation {
|
|
9
|
+
height: 100vh;
|
|
10
|
+
width: 100%;
|
|
11
|
+
display: flex;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
align-items: center;
|
|
14
|
+
background: white;
|
|
15
|
+
color: var(--cometchat-text-color-secondary, #727272);
|
|
16
|
+
font: var(--cometchat-font-body-regular, 400 14px Roboto);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.cometchat .cometchat-message-composer {
|
|
20
|
+
border-radius: 0;
|
|
21
|
+
}
|
package/dist/registry/v6/experiences/2-one-to-one/templates/react-router/CometChatNoSSR.tsx.tpl
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
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
|
+
// css-variables.css is imported in app/app.css — do NOT import it here
|
|
11
|
+
import "./CometChatNoSSR.css";
|
|
12
|
+
|
|
13
|
+
const COMETCHAT_CONSTANTS = {
|
|
14
|
+
APP_ID: import.meta.env.{{ENV_PREFIX}}COMETCHAT_APP_ID as string,
|
|
15
|
+
REGION: import.meta.env.{{ENV_PREFIX}}COMETCHAT_REGION as string,
|
|
16
|
+
AUTH_KEY: import.meta.env.{{ENV_PREFIX}}COMETCHAT_AUTH_KEY as string,
|
|
17
|
+
};
|
|
18
|
+
const LOGIN_UID = "{{LOGIN_UID}}";
|
|
19
|
+
const CHAT_UID = "{{CHAT_UID}}";
|
|
20
|
+
|
|
21
|
+
const CometChatNoSSR: React.FC = () => {
|
|
22
|
+
const [loggedIn, setLoggedIn] = useState(false);
|
|
23
|
+
const [chatUser, setChatUser] = useState<CometChat.User | undefined>();
|
|
24
|
+
const [error, setError] = useState<string | null>(null);
|
|
25
|
+
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (typeof window === "undefined") return;
|
|
28
|
+
|
|
29
|
+
const settings = new UIKitSettingsBuilder()
|
|
30
|
+
.setAppId(COMETCHAT_CONSTANTS.APP_ID)
|
|
31
|
+
.setRegion(COMETCHAT_CONSTANTS.REGION)
|
|
32
|
+
.setAuthKey(COMETCHAT_CONSTANTS.AUTH_KEY)
|
|
33
|
+
.subscribePresenceForAllUsers()
|
|
34
|
+
.build();
|
|
35
|
+
|
|
36
|
+
CometChatUIKit.init(settings)?.then(() => {
|
|
37
|
+
CometChatUIKit.getLoggedinUser().then((u) => {
|
|
38
|
+
if (!u) {
|
|
39
|
+
CometChatUIKit.login(LOGIN_UID)
|
|
40
|
+
.then(() => setLoggedIn(true))
|
|
41
|
+
.catch((e: unknown) => setError(String(e)));
|
|
42
|
+
} else {
|
|
43
|
+
setLoggedIn(true);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}).catch((e: unknown) => setError(String(e)));
|
|
47
|
+
}, []);
|
|
48
|
+
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
if (!loggedIn) return;
|
|
51
|
+
CometChat.getUser(CHAT_UID)
|
|
52
|
+
.then((u) => setChatUser(u))
|
|
53
|
+
.catch((e: unknown) => setError(String(e)));
|
|
54
|
+
}, [loggedIn]);
|
|
55
|
+
|
|
56
|
+
if (error) return <div style={{ color: "red", padding: 16, fontFamily: "monospace" }}>{error}</div>;
|
|
57
|
+
if (!loggedIn || !chatUser) return <div className="empty-conversation">Loading chat…</div>;
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<div className="messages-wrapper">
|
|
61
|
+
<CometChatMessageHeader user={chatUser} />
|
|
62
|
+
<CometChatMessageList user={chatUser} />
|
|
63
|
+
<CometChatMessageComposer user={chatUser} />
|
|
64
|
+
</div>
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
export default CometChatNoSSR;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
#root { width: 100vw; height: 100vh; }
|
|
2
|
+
.messages-wrapper { width: 100%; height: 100%; display: flex; flex-direction: column; }
|
|
3
|
+
.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); }
|
|
4
|
+
.cometchat .cometchat-message-composer { border-radius: 0; }
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useEffect, 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 "./App.css";
|
|
9
|
+
|
|
10
|
+
// The hardcoded user this chat connects to. Change to point at any
|
|
11
|
+
// CometChat UID created in your dashboard.
|
|
12
|
+
const CHAT_UID = "{{CHAT_UID}}";
|
|
13
|
+
|
|
14
|
+
function App() {
|
|
15
|
+
const [chatUser, setChatUser] = useState<CometChat.User | undefined>();
|
|
16
|
+
const [error, setError] = useState<string | null>(null);
|
|
17
|
+
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
CometChat.getUser(CHAT_UID)
|
|
20
|
+
.then((user) => setChatUser(user))
|
|
21
|
+
.catch((e: unknown) => setError(String(e)));
|
|
22
|
+
}, []);
|
|
23
|
+
|
|
24
|
+
if (error) {
|
|
25
|
+
return (
|
|
26
|
+
<div style={{ color: "red", padding: 16, fontFamily: "monospace" }}>
|
|
27
|
+
{error}
|
|
28
|
+
</div>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (!chatUser) {
|
|
33
|
+
return <div className="empty-conversation">Loading chat…</div>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<div className="messages-wrapper">
|
|
38
|
+
<CometChatMessageHeader user={chatUser} />
|
|
39
|
+
<CometChatMessageList user={chatUser} />
|
|
40
|
+
<CometChatMessageComposer user={chatUser} />
|
|
41
|
+
</div>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
export default App;
|
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../../schemas/template.schema.json",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"experience_id": 3,
|
|
5
|
+
"framework": "astro",
|
|
6
|
+
"sdk_compatibility": ">=6.0.0 <7.0.0",
|
|
7
|
+
"default_placement": "dedicated-route",
|
|
8
|
+
"deps": [
|
|
9
|
+
{
|
|
10
|
+
"name": "@cometchat/chat-uikit-react",
|
|
11
|
+
"version": "^6"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"name": "@cometchat/chat-sdk-javascript",
|
|
15
|
+
"version": "^4"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"name": "@astrojs/react",
|
|
19
|
+
"version": "^4"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"name": "react",
|
|
23
|
+
"version": "^18"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"name": "react-dom",
|
|
27
|
+
"version": "^18"
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
"env_vars": [
|
|
31
|
+
{
|
|
32
|
+
"name": "{{ENV_PREFIX}}COMETCHAT_APP_ID",
|
|
33
|
+
"required": true,
|
|
34
|
+
"description": "CometChat App ID from your dashboard"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": "{{ENV_PREFIX}}COMETCHAT_REGION",
|
|
38
|
+
"required": true,
|
|
39
|
+
"description": "CometChat region (us, eu, in, etc.)"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"name": "{{ENV_PREFIX}}COMETCHAT_AUTH_KEY",
|
|
43
|
+
"required": true,
|
|
44
|
+
"secret": true,
|
|
45
|
+
"description": "CometChat Auth Key (development only)"
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
"files": [
|
|
49
|
+
{
|
|
50
|
+
"path": "src/cometchat/ChatApp.tsx",
|
|
51
|
+
"action": "create",
|
|
52
|
+
"template_ref": "ChatApp.tsx.tpl",
|
|
53
|
+
"owned": true
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"path": "src/cometchat/ChatApp.css",
|
|
57
|
+
"action": "create",
|
|
58
|
+
"template_ref": "ChatApp.css.tpl",
|
|
59
|
+
"owned": true
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"path": "src/cometchat/CometChatTabs.tsx",
|
|
63
|
+
"action": "create",
|
|
64
|
+
"template_ref": "CometChatTabs.tsx.tpl",
|
|
65
|
+
"owned": true
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"path": "src/cometchat/CometChatTabs.css",
|
|
69
|
+
"action": "create",
|
|
70
|
+
"template_ref": "CometChatTabs.css.tpl",
|
|
71
|
+
"owned": true
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"path": "src/pages/chat.astro",
|
|
75
|
+
"action": "create",
|
|
76
|
+
"template_ref": "chat.astro.tpl",
|
|
77
|
+
"owned": true
|
|
78
|
+
}
|
|
79
|
+
],
|
|
80
|
+
"verify_rules": [
|
|
81
|
+
"init_before_login",
|
|
82
|
+
"no_user_and_group_same_component",
|
|
83
|
+
"no_auth_key_in_source",
|
|
84
|
+
"render_gated_on_login_resolve",
|
|
85
|
+
"error_ui_visible_on_failure"
|
|
86
|
+
],
|
|
87
|
+
"next_steps": [
|
|
88
|
+
"If `@astrojs/react` isn't installed yet, run: `npx astro add react`",
|
|
89
|
+
"Run `npm run dev` to start the dev server",
|
|
90
|
+
"Visit http://localhost:4321/chat",
|
|
91
|
+
"Click any of the 4 tabs (Chats / Calls / Users / Groups) to switch lists"
|
|
92
|
+
]
|
|
93
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../../schemas/template.schema.json",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"experience_id": 3,
|
|
5
|
+
"framework": "nextjs",
|
|
6
|
+
"sdk_compatibility": ">=6.0.0 <7.0.0",
|
|
7
|
+
"default_placement": "dedicated-route",
|
|
8
|
+
"deps": [
|
|
9
|
+
{
|
|
10
|
+
"name": "@cometchat/chat-uikit-react",
|
|
11
|
+
"version": "^6"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"name": "@cometchat/chat-sdk-javascript",
|
|
15
|
+
"version": "^4"
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"env_vars": [
|
|
19
|
+
{
|
|
20
|
+
"name": "{{ENV_PREFIX}}COMETCHAT_APP_ID",
|
|
21
|
+
"required": true,
|
|
22
|
+
"description": "CometChat App ID from your dashboard"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"name": "{{ENV_PREFIX}}COMETCHAT_REGION",
|
|
26
|
+
"required": true,
|
|
27
|
+
"description": "CometChat region (us, eu, in, etc.)"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"name": "{{ENV_PREFIX}}COMETCHAT_AUTH_KEY",
|
|
31
|
+
"required": true,
|
|
32
|
+
"secret": true,
|
|
33
|
+
"description": "CometChat Auth Key (development only)"
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
"files": [
|
|
37
|
+
{
|
|
38
|
+
"path": "src/app/cometchat/CometChatNoSSR.tsx",
|
|
39
|
+
"action": "create",
|
|
40
|
+
"template_ref": "CometChatNoSSR.tsx.tpl",
|
|
41
|
+
"owned": true
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"path": "src/app/cometchat/CometChatNoSSR.css",
|
|
45
|
+
"action": "create",
|
|
46
|
+
"template_ref": "CometChatNoSSR.css.tpl",
|
|
47
|
+
"owned": true
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"path": "src/app/cometchat/CometChatTabs.tsx",
|
|
51
|
+
"action": "create",
|
|
52
|
+
"template_ref": "CometChatTabs.tsx.tpl",
|
|
53
|
+
"owned": true
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"path": "src/app/cometchat/CometChatTabs.css",
|
|
57
|
+
"action": "create",
|
|
58
|
+
"template_ref": "CometChatTabs.css.tpl",
|
|
59
|
+
"owned": true
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"path": "src/app/chat/page.tsx",
|
|
63
|
+
"action": "create",
|
|
64
|
+
"template_ref": "chat-page.tsx.tpl",
|
|
65
|
+
"owned": true
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"path": "src/app/globals.css",
|
|
69
|
+
"action": "patch",
|
|
70
|
+
"patch_mode": "prepend",
|
|
71
|
+
"patch_content": "@import url(\"@cometchat/chat-uikit-react/css-variables.css\");\n",
|
|
72
|
+
"skip_if_exists": "@cometchat/chat-uikit-react/css-variables.css"
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
"verify_rules": [
|
|
76
|
+
"css_variables_imported_once",
|
|
77
|
+
"init_before_login",
|
|
78
|
+
"no_user_and_group_same_component",
|
|
79
|
+
"no_auth_key_in_source",
|
|
80
|
+
"render_gated_on_login_resolve",
|
|
81
|
+
"error_ui_visible_on_failure"
|
|
82
|
+
],
|
|
83
|
+
"next_steps": [
|
|
84
|
+
"Run `npm run dev` to start the dev server",
|
|
85
|
+
"Visit http://localhost:3000/chat",
|
|
86
|
+
"Click any of the 4 tabs (Chats / Calls / Users / Groups) to switch lists",
|
|
87
|
+
"Click a conversation, user, or group to open the message thread",
|
|
88
|
+
"When ready for production, run `cometchat apply --production` to set up server-side auth tokens"
|
|
89
|
+
]
|
|
90
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../../schemas/template.schema.json",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"experience_id": 3,
|
|
5
|
+
"framework": "react-router",
|
|
6
|
+
"sdk_compatibility": ">=6.0.0 <7.0.0",
|
|
7
|
+
"default_placement": "dedicated-route",
|
|
8
|
+
"deps": [
|
|
9
|
+
{
|
|
10
|
+
"name": "@cometchat/chat-uikit-react",
|
|
11
|
+
"version": "^6"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"name": "@cometchat/chat-sdk-javascript",
|
|
15
|
+
"version": "^4"
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"env_vars": [
|
|
19
|
+
{
|
|
20
|
+
"name": "{{ENV_PREFIX}}COMETCHAT_APP_ID",
|
|
21
|
+
"required": true,
|
|
22
|
+
"description": "CometChat App ID from your dashboard"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"name": "{{ENV_PREFIX}}COMETCHAT_REGION",
|
|
26
|
+
"required": true,
|
|
27
|
+
"description": "CometChat region (us, eu, in, etc.)"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"name": "{{ENV_PREFIX}}COMETCHAT_AUTH_KEY",
|
|
31
|
+
"required": true,
|
|
32
|
+
"secret": true,
|
|
33
|
+
"description": "CometChat Auth Key (development only)"
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
"files": [
|
|
37
|
+
{
|
|
38
|
+
"path": "app/cometchat/CometChatNoSSR.tsx",
|
|
39
|
+
"action": "create",
|
|
40
|
+
"template_ref": "CometChatNoSSR.tsx.tpl",
|
|
41
|
+
"owned": true
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"path": "app/cometchat/CometChatNoSSR.css",
|
|
45
|
+
"action": "create",
|
|
46
|
+
"template_ref": "CometChatNoSSR.css.tpl",
|
|
47
|
+
"owned": true
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"path": "app/cometchat/CometChatTabs.tsx",
|
|
51
|
+
"action": "create",
|
|
52
|
+
"template_ref": "CometChatTabs.tsx.tpl",
|
|
53
|
+
"owned": true
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"path": "app/cometchat/CometChatTabs.css",
|
|
57
|
+
"action": "create",
|
|
58
|
+
"template_ref": "CometChatTabs.css.tpl",
|
|
59
|
+
"owned": true
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"path": "app/routes/CometChat.tsx",
|
|
63
|
+
"action": "create",
|
|
64
|
+
"template_ref": "CometChat-route.tsx.tpl",
|
|
65
|
+
"owned": true
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"path": "app/routes.ts",
|
|
69
|
+
"action": "patch",
|
|
70
|
+
"patch_mode": "replace-section",
|
|
71
|
+
"anchor": "import { type RouteConfig, index }",
|
|
72
|
+
"patch_content": "import { type RouteConfig, index, route } from \"@react-router/dev/routes\";",
|
|
73
|
+
"skip_if_exists": "import { type RouteConfig, index, route }"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"path": "app/routes.ts",
|
|
77
|
+
"action": "patch",
|
|
78
|
+
"patch_mode": "insert-before",
|
|
79
|
+
"anchor": "] satisfies RouteConfig",
|
|
80
|
+
"patch_content": " route(\"chat\", \"routes/CometChat.tsx\"),\n",
|
|
81
|
+
"skip_if_exists": "routes/CometChat.tsx"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"path": "app/app.css",
|
|
85
|
+
"action": "patch",
|
|
86
|
+
"patch_mode": "prepend",
|
|
87
|
+
"patch_content": "@import url(\"@cometchat/chat-uikit-react/css-variables.css\");\n",
|
|
88
|
+
"skip_if_exists": "@cometchat/chat-uikit-react/css-variables.css"
|
|
89
|
+
}
|
|
90
|
+
],
|
|
91
|
+
"verify_rules": [
|
|
92
|
+
"css_variables_imported_once",
|
|
93
|
+
"init_before_login",
|
|
94
|
+
"no_user_and_group_same_component",
|
|
95
|
+
"no_auth_key_in_source",
|
|
96
|
+
"render_gated_on_login_resolve",
|
|
97
|
+
"error_ui_visible_on_failure"
|
|
98
|
+
],
|
|
99
|
+
"next_steps": [
|
|
100
|
+
"Add the chat route to app/routes.ts: route(\"chat\", \"routes/CometChat.tsx\")",
|
|
101
|
+
"Run `npm run dev` to start the dev server",
|
|
102
|
+
"Visit http://localhost:5173/chat",
|
|
103
|
+
"Click any of the 4 tabs (Chats / Calls / Users / Groups) to switch lists"
|
|
104
|
+
]
|
|
105
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../../schemas/template.schema.json",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"experience_id": 3,
|
|
5
|
+
"framework": "reactjs",
|
|
6
|
+
"sdk_compatibility": ">=6.0.0 <7.0.0",
|
|
7
|
+
"default_placement": "spa-root",
|
|
8
|
+
"deps": [
|
|
9
|
+
{
|
|
10
|
+
"name": "@cometchat/chat-uikit-react",
|
|
11
|
+
"version": "^6"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"name": "@cometchat/chat-sdk-javascript",
|
|
15
|
+
"version": "^4"
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"env_vars": [
|
|
19
|
+
{
|
|
20
|
+
"name": "{{ENV_PREFIX}}COMETCHAT_APP_ID",
|
|
21
|
+
"required": true,
|
|
22
|
+
"description": "CometChat App ID from your dashboard"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"name": "{{ENV_PREFIX}}COMETCHAT_REGION",
|
|
26
|
+
"required": true,
|
|
27
|
+
"description": "CometChat region (us, eu, in, etc.)"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"name": "{{ENV_PREFIX}}COMETCHAT_AUTH_KEY",
|
|
31
|
+
"required": true,
|
|
32
|
+
"secret": true,
|
|
33
|
+
"description": "CometChat Auth Key (development only — use auth tokens in production)"
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
"files": [
|
|
37
|
+
{
|
|
38
|
+
"path": "src/main.tsx",
|
|
39
|
+
"action": "create",
|
|
40
|
+
"template_ref": "main.tsx.tpl",
|
|
41
|
+
"owned": true
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"path": "src/App.tsx",
|
|
45
|
+
"action": "create",
|
|
46
|
+
"template_ref": "App.tsx.tpl",
|
|
47
|
+
"owned": true
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"path": "src/App.css",
|
|
51
|
+
"action": "create",
|
|
52
|
+
"template_ref": "App.css.tpl",
|
|
53
|
+
"owned": true
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"path": "src/cometchat/CometChatTabs.tsx",
|
|
57
|
+
"action": "create",
|
|
58
|
+
"template_ref": "CometChatTabs.tsx.tpl",
|
|
59
|
+
"owned": true
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"path": "src/cometchat/CometChatTabs.css",
|
|
63
|
+
"action": "create",
|
|
64
|
+
"template_ref": "CometChatTabs.css.tpl",
|
|
65
|
+
"owned": true
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"path": "src/index.css",
|
|
69
|
+
"action": "patch",
|
|
70
|
+
"patch_mode": "prepend",
|
|
71
|
+
"patch_content": "@import url(\"@cometchat/chat-uikit-react/css-variables.css\");\n",
|
|
72
|
+
"skip_if_exists": "@cometchat/chat-uikit-react/css-variables.css"
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
"verify_rules": [
|
|
76
|
+
"css_variables_imported_once",
|
|
77
|
+
"init_before_login",
|
|
78
|
+
"no_user_and_group_same_component",
|
|
79
|
+
"no_auth_key_in_source",
|
|
80
|
+
"render_gated_on_login_resolve",
|
|
81
|
+
"error_ui_visible_on_failure"
|
|
82
|
+
],
|
|
83
|
+
"next_steps": [
|
|
84
|
+
"Run `npm run dev` to start the dev server",
|
|
85
|
+
"Visit http://localhost:5173",
|
|
86
|
+
"The left panel shows the tab bar (Chats / Calls / Users / Groups). Click any tab to switch.",
|
|
87
|
+
"Click a conversation, user, or group to open the message thread on the right.",
|
|
88
|
+
"When ready for production, run `cometchat apply --production` to set up server-side auth tokens"
|
|
89
|
+
]
|
|
90
|
+
}
|