@cometchat/skills-cli 2.4.0 → 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.
Files changed (111) hide show
  1. package/README.md +45 -37
  2. package/dist/index.js +1690 -12609
  3. package/dist/utils/error-dictionary.js +0 -69
  4. package/package.json +10 -12
  5. package/dist/registry/schemas/config.schema.json +0 -119
  6. package/dist/registry/schemas/template.schema.json +0 -142
  7. package/dist/registry/v6/experiences/1-conversation-list/astro.template.json +0 -89
  8. package/dist/registry/v6/experiences/1-conversation-list/nextjs-pages.template.json +0 -83
  9. package/dist/registry/v6/experiences/1-conversation-list/nextjs.template.json +0 -83
  10. package/dist/registry/v6/experiences/1-conversation-list/react-router.template.json +0 -102
  11. package/dist/registry/v6/experiences/1-conversation-list/reactjs-dedicated-route.template.json +0 -81
  12. package/dist/registry/v6/experiences/1-conversation-list/reactjs.template.json +0 -86
  13. package/dist/registry/v6/experiences/1-conversation-list/templates/astro/ChatApp.css.tpl +0 -43
  14. package/dist/registry/v6/experiences/1-conversation-list/templates/astro/ChatApp.tsx.tpl +0 -86
  15. package/dist/registry/v6/experiences/1-conversation-list/templates/astro/CometChatSelector.tsx.tpl +0 -40
  16. package/dist/registry/v6/experiences/1-conversation-list/templates/astro/chat.astro.tpl +0 -17
  17. package/dist/registry/v6/experiences/1-conversation-list/templates/nextjs/CometChatNoSSR.css.tpl +0 -43
  18. package/dist/registry/v6/experiences/1-conversation-list/templates/nextjs/CometChatNoSSR.tsx.tpl +0 -86
  19. package/dist/registry/v6/experiences/1-conversation-list/templates/nextjs/CometChatSelector.tsx.tpl +0 -41
  20. package/dist/registry/v6/experiences/1-conversation-list/templates/nextjs/chat-page.tsx.tpl +0 -11
  21. package/dist/registry/v6/experiences/1-conversation-list/templates/nextjs-pages/CometChatNoSSR.css.tpl +0 -43
  22. package/dist/registry/v6/experiences/1-conversation-list/templates/nextjs-pages/CometChatNoSSR.tsx.tpl +0 -88
  23. package/dist/registry/v6/experiences/1-conversation-list/templates/nextjs-pages/CometChatSelector.tsx.tpl +0 -41
  24. package/dist/registry/v6/experiences/1-conversation-list/templates/nextjs-pages/chat-page.tsx.tpl +0 -15
  25. package/dist/registry/v6/experiences/1-conversation-list/templates/react-router/CometChat-route.tsx.tpl +0 -22
  26. package/dist/registry/v6/experiences/1-conversation-list/templates/react-router/CometChatNoSSR.css.tpl +0 -43
  27. package/dist/registry/v6/experiences/1-conversation-list/templates/react-router/CometChatNoSSR.tsx.tpl +0 -87
  28. package/dist/registry/v6/experiences/1-conversation-list/templates/react-router/CometChatSelector.tsx.tpl +0 -40
  29. package/dist/registry/v6/experiences/1-conversation-list/templates/reactjs/App.css.tpl +0 -40
  30. package/dist/registry/v6/experiences/1-conversation-list/templates/reactjs/App.tsx.tpl +0 -55
  31. package/dist/registry/v6/experiences/1-conversation-list/templates/reactjs/CometChatSelector.tsx.tpl +0 -40
  32. package/dist/registry/v6/experiences/1-conversation-list/templates/reactjs/main.tsx.tpl +0 -46
  33. package/dist/registry/v6/experiences/1-conversation-list/templates/reactjs-dedicated-route/ChatPage.tsx.tpl +0 -87
  34. package/dist/registry/v6/experiences/1-conversation-list/templates/reactjs-dedicated-route/CometChatMessenger.css.tpl +0 -20
  35. package/dist/registry/v6/experiences/1-conversation-list/templates/reactjs-dedicated-route/CometChatMessenger.tsx.tpl +0 -54
  36. package/dist/registry/v6/experiences/1-conversation-list/templates/reactjs-dedicated-route/CometChatSelector.tsx.tpl +0 -40
  37. package/dist/registry/v6/experiences/2-one-to-one/astro.template.json +0 -81
  38. package/dist/registry/v6/experiences/2-one-to-one/nextjs.template.json +0 -77
  39. package/dist/registry/v6/experiences/2-one-to-one/react-router.template.json +0 -93
  40. package/dist/registry/v6/experiences/2-one-to-one/reactjs-dedicated-route.template.json +0 -75
  41. package/dist/registry/v6/experiences/2-one-to-one/reactjs.template.json +0 -80
  42. package/dist/registry/v6/experiences/2-one-to-one/templates/astro/ChatApp.css.tpl +0 -21
  43. package/dist/registry/v6/experiences/2-one-to-one/templates/astro/ChatApp.tsx.tpl +0 -66
  44. package/dist/registry/v6/experiences/2-one-to-one/templates/astro/chat.astro.tpl +0 -17
  45. package/dist/registry/v6/experiences/2-one-to-one/templates/nextjs/CometChatNoSSR.css.tpl +0 -21
  46. package/dist/registry/v6/experiences/2-one-to-one/templates/nextjs/CometChatNoSSR.tsx.tpl +0 -66
  47. package/dist/registry/v6/experiences/2-one-to-one/templates/nextjs/chat-page.tsx.tpl +0 -11
  48. package/dist/registry/v6/experiences/2-one-to-one/templates/react-router/CometChat-route.tsx.tpl +0 -21
  49. package/dist/registry/v6/experiences/2-one-to-one/templates/react-router/CometChatNoSSR.css.tpl +0 -21
  50. package/dist/registry/v6/experiences/2-one-to-one/templates/react-router/CometChatNoSSR.tsx.tpl +0 -67
  51. package/dist/registry/v6/experiences/2-one-to-one/templates/reactjs/App.css.tpl +0 -4
  52. package/dist/registry/v6/experiences/2-one-to-one/templates/reactjs/App.tsx.tpl +0 -44
  53. package/dist/registry/v6/experiences/2-one-to-one/templates/reactjs/main.tsx.tpl +0 -46
  54. package/dist/registry/v6/experiences/2-one-to-one/templates/reactjs-dedicated-route/ChatPage.tsx.tpl +0 -84
  55. package/dist/registry/v6/experiences/2-one-to-one/templates/reactjs-dedicated-route/CometChatMessenger.css.tpl +0 -9
  56. package/dist/registry/v6/experiences/2-one-to-one/templates/reactjs-dedicated-route/CometChatMessenger.tsx.tpl +0 -43
  57. package/dist/registry/v6/experiences/3-tab-based/astro.template.json +0 -93
  58. package/dist/registry/v6/experiences/3-tab-based/nextjs.template.json +0 -90
  59. package/dist/registry/v6/experiences/3-tab-based/react-router.template.json +0 -105
  60. package/dist/registry/v6/experiences/3-tab-based/reactjs-dedicated-route.template.json +0 -89
  61. package/dist/registry/v6/experiences/3-tab-based/reactjs.template.json +0 -93
  62. package/dist/registry/v6/experiences/3-tab-based/templates/astro/ChatApp.css.tpl +0 -39
  63. package/dist/registry/v6/experiences/3-tab-based/templates/astro/ChatApp.tsx.tpl +0 -93
  64. package/dist/registry/v6/experiences/3-tab-based/templates/astro/CometChatTabs.css.tpl +0 -43
  65. package/dist/registry/v6/experiences/3-tab-based/templates/astro/CometChatTabs.tsx.tpl +0 -72
  66. package/dist/registry/v6/experiences/3-tab-based/templates/astro/chat.astro.tpl +0 -17
  67. package/dist/registry/v6/experiences/3-tab-based/templates/nextjs/CometChatNoSSR.css.tpl +0 -39
  68. package/dist/registry/v6/experiences/3-tab-based/templates/nextjs/CometChatNoSSR.tsx.tpl +0 -93
  69. package/dist/registry/v6/experiences/3-tab-based/templates/nextjs/CometChatTabs.css.tpl +0 -43
  70. package/dist/registry/v6/experiences/3-tab-based/templates/nextjs/CometChatTabs.tsx.tpl +0 -73
  71. package/dist/registry/v6/experiences/3-tab-based/templates/nextjs/chat-page.tsx.tpl +0 -11
  72. package/dist/registry/v6/experiences/3-tab-based/templates/react-router/CometChat-route.tsx.tpl +0 -21
  73. package/dist/registry/v6/experiences/3-tab-based/templates/react-router/CometChatNoSSR.css.tpl +0 -39
  74. package/dist/registry/v6/experiences/3-tab-based/templates/react-router/CometChatNoSSR.tsx.tpl +0 -94
  75. package/dist/registry/v6/experiences/3-tab-based/templates/react-router/CometChatTabs.css.tpl +0 -43
  76. package/dist/registry/v6/experiences/3-tab-based/templates/react-router/CometChatTabs.tsx.tpl +0 -72
  77. package/dist/registry/v6/experiences/3-tab-based/templates/reactjs/App.css.tpl +0 -7
  78. package/dist/registry/v6/experiences/3-tab-based/templates/reactjs/App.tsx.tpl +0 -62
  79. package/dist/registry/v6/experiences/3-tab-based/templates/reactjs/CometChatTabs.css.tpl +0 -43
  80. package/dist/registry/v6/experiences/3-tab-based/templates/reactjs/CometChatTabs.tsx.tpl +0 -72
  81. package/dist/registry/v6/experiences/3-tab-based/templates/reactjs/main.tsx.tpl +0 -46
  82. package/dist/registry/v6/experiences/3-tab-based/templates/reactjs-dedicated-route/ChatPage.tsx.tpl +0 -84
  83. package/dist/registry/v6/experiences/3-tab-based/templates/reactjs-dedicated-route/CometChatMessenger.css.tpl +0 -11
  84. package/dist/registry/v6/experiences/3-tab-based/templates/reactjs-dedicated-route/CometChatMessenger.tsx.tpl +0 -61
  85. package/dist/registry/v6/experiences/3-tab-based/templates/reactjs-dedicated-route/CometChatTabs.css.tpl +0 -43
  86. package/dist/registry/v6/experiences/3-tab-based/templates/reactjs-dedicated-route/CometChatTabs.tsx.tpl +0 -72
  87. package/dist/registry/v6/features/catalog.json +0 -526
  88. package/dist/registry/v6/production/astro/cometchat-token.ts.tpl +0 -86
  89. package/dist/registry/v6/production/astro.template.json +0 -51
  90. package/dist/registry/v6/production/nextjs/route.ts.tpl +0 -79
  91. package/dist/registry/v6/production/nextjs.template.json +0 -50
  92. package/dist/registry/v6/production/react-router/api.cometchat-token.ts.tpl +0 -73
  93. package/dist/registry/v6/production/react-router.template.json +0 -58
  94. package/dist/registry/v6/user-mgmt/astro/cometchat-user.ts.tpl +0 -164
  95. package/dist/registry/v6/user-mgmt/astro.template.json +0 -33
  96. package/dist/registry/v6/user-mgmt/nextjs/route.ts.tpl +0 -212
  97. package/dist/registry/v6/user-mgmt/nextjs.template.json +0 -57
  98. package/dist/registry/v6/user-mgmt/react-router/api.cometchat-user.ts.tpl +0 -176
  99. package/dist/registry/v6/user-mgmt/react-router.template.json +0 -40
  100. package/dist/registry/v6/widget/astro/CometChatWidget.css.tpl +0 -105
  101. package/dist/registry/v6/widget/astro/CometChatWidget.tsx.tpl +0 -88
  102. package/dist/registry/v6/widget/astro.template.json +0 -38
  103. package/dist/registry/v6/widget/nextjs/CometChatWidget.css.tpl +0 -105
  104. package/dist/registry/v6/widget/nextjs/CometChatWidget.tsx.tpl +0 -88
  105. package/dist/registry/v6/widget/nextjs.template.json +0 -40
  106. package/dist/registry/v6/widget/react-router/CometChatWidget.css.tpl +0 -105
  107. package/dist/registry/v6/widget/react-router/CometChatWidget.tsx.tpl +0 -98
  108. package/dist/registry/v6/widget/react-router.template.json +0 -36
  109. package/dist/registry/v6/widget/reactjs/CometChatWidget.css.tpl +0 -105
  110. package/dist/registry/v6/widget/reactjs/CometChatWidget.tsx.tpl +0 -89
  111. package/dist/registry/v6/widget/reactjs.template.json +0 -36
@@ -1,66 +0,0 @@
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 type { 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;
@@ -1,11 +0,0 @@
1
- "use client";
2
- import dynamic from "next/dynamic";
3
-
4
- const CometChatComponent = dynamic(
5
- () => import("../cometchat/CometChatNoSSR"),
6
- { ssr: false }
7
- );
8
-
9
- export default function ChatPage() {
10
- return <CometChatComponent />;
11
- }
@@ -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
- }
@@ -1,21 +0,0 @@
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
- }
@@ -1,67 +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 type { 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;
@@ -1,4 +0,0 @@
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; }
@@ -1,44 +0,0 @@
1
- import { useEffect, useState } from "react";
2
- import {
3
- CometChatMessageComposer,
4
- CometChatMessageHeader,
5
- CometChatMessageList,
6
- } from "@cometchat/chat-uikit-react";
7
- import type { 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;
@@ -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
- }
@@ -1,84 +0,0 @@
1
- import { lazy, Suspense, useEffect, useState } from "react";
2
- import {
3
- CometChatUIKit,
4
- UIKitSettingsBuilder,
5
- } from "@cometchat/chat-uikit-react";
6
-
7
- const CometChatMessenger = lazy(
8
- () => import("../cometchat/CometChatMessenger")
9
- );
10
-
11
- const COMETCHAT_CONSTANTS = {
12
- APP_ID: import.meta.env.{{ENV_PREFIX}}COMETCHAT_APP_ID as string,
13
- REGION: import.meta.env.{{ENV_PREFIX}}COMETCHAT_REGION as string,
14
- AUTH_KEY: import.meta.env.{{ENV_PREFIX}}COMETCHAT_AUTH_KEY as string,
15
- };
16
-
17
- const settings = new UIKitSettingsBuilder()
18
- .setAppId(COMETCHAT_CONSTANTS.APP_ID)
19
- .setRegion(COMETCHAT_CONSTANTS.REGION)
20
- .setAuthKey(COMETCHAT_CONSTANTS.AUTH_KEY)
21
- .subscribePresenceForAllUsers()
22
- .build();
23
-
24
- let initPromise: Promise<void> | null = null;
25
- function ensureInitialized(): Promise<void> {
26
- if (initPromise) return initPromise;
27
- initPromise = CometChatUIKit.init(settings)
28
- .then(() => CometChatUIKit.getLoggedinUser())
29
- .then((user) => {
30
- if (user) return undefined;
31
- return CometChatUIKit.login("{{LOGIN_UID}}").then(() => undefined);
32
- })
33
- .then(() => undefined);
34
- return initPromise;
35
- }
36
-
37
- export default function ChatPage() {
38
- const [ready, setReady] = useState(false);
39
- const [error, setError] = useState<string | null>(null);
40
-
41
- useEffect(() => {
42
- let cancelled = false;
43
- ensureInitialized()
44
- .then(() => {
45
- if (!cancelled) setReady(true);
46
- })
47
- .catch((e: unknown) => {
48
- if (!cancelled) setError(String(e));
49
- });
50
- return () => {
51
- cancelled = true;
52
- };
53
- }, []);
54
-
55
- if (error) {
56
- return (
57
- <div
58
- className="cometchat-page"
59
- style={{
60
- color: "red",
61
- padding: 16,
62
- fontFamily: "monospace",
63
- }}
64
- >
65
- CometChat failed to load: {error}
66
- </div>
67
- );
68
- }
69
- if (!ready) {
70
- return (
71
- <div className="cometchat-page" style={{ padding: 16 }}>
72
- Loading chat…
73
- </div>
74
- );
75
- }
76
-
77
- return (
78
- <div className="cometchat-page">
79
- <Suspense fallback={<div style={{ padding: 16 }}>Loading chat…</div>}>
80
- <CometChatMessenger />
81
- </Suspense>
82
- </div>
83
- );
84
- }
@@ -1,9 +0,0 @@
1
- /* Scoped to .cometchat-page (root div in ChatPage.tsx) so the fixed-height
2
- * chat layout doesn't leak into other routes. See the exp 1 dedicated-route
3
- * CSS file for the full explanation of why the message list needs resolved
4
- * heights on every ancestor.
5
- */
6
- .cometchat-page { width: 100%; height: 100vh; }
7
- .messages-wrapper { height: 100%; width: 100%; display: flex; flex-direction: column; }
8
- .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); }
9
- .cometchat .cometchat-message-composer { border-radius: 0; }
@@ -1,43 +0,0 @@
1
- import { useEffect, useState } from "react";
2
- import {
3
- CometChatMessageComposer,
4
- CometChatMessageHeader,
5
- CometChatMessageList,
6
- } from "@cometchat/chat-uikit-react";
7
- import type { CometChat } from "@cometchat/chat-sdk-javascript";
8
- import "./CometChatMessenger.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
- export default function CometChatMessenger() {
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
- }
@@ -1,93 +0,0 @@
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
- }
@@ -1,90 +0,0 @@
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
- }