@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.
- package/README.md +45 -37
- package/dist/index.js +1690 -12609
- 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 -526
- 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,526 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"sdk_compatibility": ">=6.0.0 <7.0.0",
|
|
5
|
-
"description": "Catalog of CometChat features available in the React UI Kit. Categorized by what work is needed to enable each one. NOTE: this catalog stores OUR taxonomy (default vs dashboard-toggle vs package-install vs component-swap) plus a `dashboard_path` HINT for navigation. The hint is short and intentionally fragile — the canonical source is always the docs URL constructed from `docs_topic`. Agents must query the cometchat-docs MCP at runtime for current dashboard navigation, prop signatures, builder methods, and SDK reference. This catalog is for routing, not for SDK reference.",
|
|
6
|
-
"feature_types": {
|
|
7
|
-
"default": "Already enabled by default in the UI Kit components your integration uses. Zero code changes needed — the skill just shows you which component renders it.",
|
|
8
|
-
"extension": "Pure boolean toggle on a backend extension. The CLI's `apply-feature` command calls POST /apps/{appId}/extensions to enable, no further config needed. Some have their UI decorator auto-attached by the UI Kit (auto_wired_in_uikit: true). Others additionally require passing the extension to UIKitSettingsBuilder.setExtensions([...]) before init.",
|
|
9
|
-
"ai-feature": "Backend AI feature toggle. Requires an OpenAI API key (PUT /apps/{appId}/ai/settings) before the feature can be enabled (POST /apps/{appId}/features/ai.{ai_key}/enabled). The CLI prompts for the key once, stores it on the app's settings, then enables the feature. The `ai_key` field is the API suffix.",
|
|
10
|
-
"dashboard-only": "Requires entering third-party config the user has to fetch themselves (Giphy/Stipop/Tenor API key, Chatwoot webhook URL, Intercom token, etc.) or making a multi-field configuration choice (Disappearing Messages interval, Message Shortcuts list). The CLI cannot automate these — falls back to opening the dashboard. `dashboard_path` is load-bearing for these entries.",
|
|
11
|
-
"package-install": "Requires installing an additional npm package. The UI Kit's initiateAfterLogin() auto-calls enableCalling() which detects the calls SDK and wires up call buttons. Currently calls only.",
|
|
12
|
-
"component-swap": "Requires replacing one UI Kit component with a drop-in variant. One-line change. The SDK currently ships exactly one such variant (CometChatCompactMessageComposer for rich text formatting); more variants will become catalog entries here as the SDK adds them.",
|
|
13
|
-
"moderation": "Backend moderation feature with configuration. Like 'extension' but takes a `config` payload (keyword lists, sensitivity levels, severity thresholds, quarantine action). The CLI's `apply-feature` walks an interactive config-collection step, then POSTs to /apps/{appId}/extensions/{id}/config plus the standard enable POST. `config_schema` describes the fields the user must supply.",
|
|
14
|
-
"calls-feature": "Calls SDK feature configured via CallSettingsBuilder (no backend toggle, no extension). The CLI's `apply-feature` command verifies the calls SDK is installed and points the agent at the matching per-family reference doc (e.g. `cometchat-react-calls/references/raise-hand.md`). The `reference_topic` field maps to the file slug; the `settings_flag` field is the CallSettingsBuilder method involved. Idempotency: persisted in state.applied_features."
|
|
15
|
-
},
|
|
16
|
-
"features": [
|
|
17
|
-
{
|
|
18
|
-
"id": "instant-messaging",
|
|
19
|
-
"name": "Instant Messaging",
|
|
20
|
-
"type": "default",
|
|
21
|
-
"description": "Real-time text messaging via CometChatMessageList + CometChatMessageComposer. The core of every chat experience.",
|
|
22
|
-
"components": ["CometChatMessageList", "CometChatMessageComposer"],
|
|
23
|
-
"docs_topic": "core-features#instant-messaging"
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
"id": "media-sharing",
|
|
27
|
-
"name": "Media Sharing",
|
|
28
|
-
"type": "default",
|
|
29
|
-
"description": "Send images, videos, audio, and documents within conversations. Built into CometChatMessageComposer's ActionSheet.",
|
|
30
|
-
"components": ["CometChatMessageComposer"],
|
|
31
|
-
"docs_topic": "core-features#media-sharing"
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
"id": "read-receipts",
|
|
35
|
-
"name": "Read Receipts",
|
|
36
|
-
"type": "default",
|
|
37
|
-
"description": "See when messages have been delivered and read. Visible in message bubbles and the Conversations list.",
|
|
38
|
-
"components": ["CometChatMessageList", "CometChatConversations"],
|
|
39
|
-
"docs_topic": "core-features#read-receipts"
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
"id": "mark-as-unread",
|
|
43
|
-
"name": "Mark as Unread",
|
|
44
|
-
"type": "default",
|
|
45
|
-
"description": "Manually mark conversations or messages as unread.",
|
|
46
|
-
"components": ["CometChatMessageList"],
|
|
47
|
-
"docs_topic": "core-features#mark-as-unread"
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
"id": "typing-indicator",
|
|
51
|
-
"name": "Typing Indicator",
|
|
52
|
-
"type": "default",
|
|
53
|
-
"description": "Real-time typing awareness. Shows in CometChatMessageHeader and CometChatConversations.",
|
|
54
|
-
"components": ["CometChatMessageHeader", "CometChatConversations"],
|
|
55
|
-
"docs_topic": "core-features#typing-indicator"
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
"id": "user-presence",
|
|
59
|
-
"name": "User Presence",
|
|
60
|
-
"type": "default",
|
|
61
|
-
"description": "Online/offline status across Conversations, Message Header, Users, and Group Members.",
|
|
62
|
-
"components": ["CometChatConversations", "CometChatMessageHeader", "CometChatUsers", "CometChatGroupMembers"],
|
|
63
|
-
"docs_topic": "core-features#user-presence"
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
"id": "reactions",
|
|
67
|
-
"name": "Reactions",
|
|
68
|
-
"type": "default",
|
|
69
|
-
"description": "React to messages with emojis without typing a full response.",
|
|
70
|
-
"components": ["CometChatMessageList"],
|
|
71
|
-
"docs_topic": "core-features#reactions"
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
"id": "mentions",
|
|
75
|
-
"name": "Mentions",
|
|
76
|
-
"type": "default",
|
|
77
|
-
"description": "Address specific users with @username, including @all for groups.",
|
|
78
|
-
"components": ["CometChatMessageComposer", "CometChatMessageList"],
|
|
79
|
-
"docs_topic": "core-features#mentions"
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
"id": "threaded-conversations",
|
|
83
|
-
"name": "Threaded Conversations",
|
|
84
|
-
"type": "default",
|
|
85
|
-
"description": "Reply to specific messages in a thread, keeping conversations organized.",
|
|
86
|
-
"components": ["CometChatMessageList", "CometChatThreadHeader"],
|
|
87
|
-
"docs_topic": "core-features#threaded-conversations"
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
"id": "quoted-replies",
|
|
91
|
-
"name": "Quoted Replies",
|
|
92
|
-
"type": "default",
|
|
93
|
-
"description": "Quote a specific message when replying to maintain context.",
|
|
94
|
-
"components": ["CometChatMessageComposer", "CometChatMessageList"],
|
|
95
|
-
"docs_topic": "core-features#quoted-replies"
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
"id": "group-chat",
|
|
99
|
-
"name": "Group Chat",
|
|
100
|
-
"type": "default",
|
|
101
|
-
"description": "Multi-participant conversations via CometChatGroups.",
|
|
102
|
-
"components": ["CometChatGroups"],
|
|
103
|
-
"docs_topic": "core-features#group-chat"
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
"id": "report-message",
|
|
107
|
-
"name": "Report Message",
|
|
108
|
-
"type": "default",
|
|
109
|
-
"description": "Users can flag inappropriate messages with predefined reasons.",
|
|
110
|
-
"components": ["CometChatMessageList"],
|
|
111
|
-
"docs_topic": "core-features#report-message"
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
"id": "search",
|
|
115
|
-
"name": "Conversation and Advanced Search",
|
|
116
|
-
"type": "default",
|
|
117
|
-
"description": "Full-text search across conversations, messages, and media.",
|
|
118
|
-
"components": ["CometChatSearch"],
|
|
119
|
-
"docs_topic": "core-features#search"
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
"id": "moderation",
|
|
123
|
-
"name": "Moderation (overview)",
|
|
124
|
-
"type": "default",
|
|
125
|
-
"description": "Umbrella entry — moderation is the family of seven configurable backend features below (profanity-filter, image-moderation, data-masking, sentiment-analysis, xss-filter, slow-mode, virus-malware-scanner). Each has its own catalog entry of type 'moderation' that the CLI can configure interactively.",
|
|
126
|
-
"components": ["CometChatMessageList"],
|
|
127
|
-
"docs_topic": "core-features#moderation"
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
"id": "profanity-filter",
|
|
131
|
-
"name": "Profanity Filter",
|
|
132
|
-
"type": "moderation",
|
|
133
|
-
"extension_id": "profanity-filter",
|
|
134
|
-
"description": "Detects and filters profane language from messages. Replaces matched words with asterisks or rejects the message outright.",
|
|
135
|
-
"components": ["CometChatMessageList", "CometChatMessageComposer"],
|
|
136
|
-
"config_schema": {
|
|
137
|
-
"case_sensitivity": { "type": "enum", "values": ["case-sensitive", "case-insensitive"], "default": "case-insensitive", "prompt": "Case sensitivity for keyword matching?" },
|
|
138
|
-
"filter_profanities_for": { "type": "enum", "values": ["all", "specific-roles"], "default": "all", "prompt": "Apply filter to all users or specific roles?" },
|
|
139
|
-
"specific_roles": { "type": "array<string>", "when": { "filter_profanities_for": "specific-roles" }, "prompt": "Comma-separated role names" },
|
|
140
|
-
"profane_words": { "type": "array<string>", "default": [], "prompt": "Custom words to add to the profanity list (comma-separated; empty for default list only)" },
|
|
141
|
-
"white_listed_words": { "type": "array<string>", "default": [], "prompt": "Words to whitelist that would otherwise match (comma-separated)" },
|
|
142
|
-
"rule": { "type": "enum", "values": ["mask", "drop", "tag"], "default": "mask", "prompt": "What to do with matched messages? (mask: replace with ****, drop: reject, tag: deliver but flag)" }
|
|
143
|
-
},
|
|
144
|
-
"docs_topic": "extensions#profanity-filter"
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
"id": "image-moderation",
|
|
148
|
-
"name": "Image Moderation",
|
|
149
|
-
"type": "moderation",
|
|
150
|
-
"extension_id": "image-moderation",
|
|
151
|
-
"description": "Detects unsafe content in images (NSFW, violence, etc.) using ML-based classification. Configurable confidence thresholds.",
|
|
152
|
-
"components": ["CometChatMessageList"],
|
|
153
|
-
"config_schema": {
|
|
154
|
-
"explicit_threshold": { "type": "number", "min": 0, "max": 100, "default": 70, "prompt": "Threshold for explicit content (0-100; lower = stricter)" },
|
|
155
|
-
"suggestive_threshold": { "type": "number", "min": 0, "max": 100, "default": 70, "prompt": "Threshold for suggestive content" },
|
|
156
|
-
"violence_threshold": { "type": "number", "min": 0, "max": 100, "default": 70, "prompt": "Threshold for violent content" },
|
|
157
|
-
"drugs_threshold": { "type": "number", "min": 0, "max": 100, "default": 70, "prompt": "Threshold for drug-related content" },
|
|
158
|
-
"rule": { "type": "enum", "values": ["block", "blur", "tag"], "default": "blur", "prompt": "Action for flagged images?" }
|
|
159
|
-
},
|
|
160
|
-
"docs_topic": "extensions#image-moderation"
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
"id": "data-masking",
|
|
164
|
-
"name": "Data Masking",
|
|
165
|
-
"type": "moderation",
|
|
166
|
-
"extension_id": "data-masking",
|
|
167
|
-
"description": "Masks PII (phone numbers, email addresses, credit cards, SSNs) in messages. Critical for healthcare, fintech, marketplace apps.",
|
|
168
|
-
"components": ["CometChatMessageList"],
|
|
169
|
-
"config_schema": {
|
|
170
|
-
"mask_phone": { "type": "boolean", "default": true, "prompt": "Mask phone numbers?" },
|
|
171
|
-
"mask_email": { "type": "boolean", "default": true, "prompt": "Mask email addresses?" },
|
|
172
|
-
"mask_ssn": { "type": "boolean", "default": false, "prompt": "Mask US Social Security Numbers?" },
|
|
173
|
-
"mask_credit_card": { "type": "boolean", "default": true, "prompt": "Mask credit card numbers?" },
|
|
174
|
-
"custom_patterns": { "type": "array<{name:string,regex:string}>", "default": [], "prompt": "Custom regex patterns to mask (e.g. internal IDs)" },
|
|
175
|
-
"rule": { "type": "enum", "values": ["mask", "drop", "tag"], "default": "mask", "prompt": "Action for messages containing matched data?" }
|
|
176
|
-
},
|
|
177
|
-
"docs_topic": "extensions#data-masking"
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
"id": "sentiment-analysis",
|
|
181
|
-
"name": "Sentiment Analysis",
|
|
182
|
-
"type": "moderation",
|
|
183
|
-
"extension_id": "sentiment-analysis",
|
|
184
|
-
"description": "Detects negative sentiment / toxicity in messages. Optionally surfaces a 'View confidently' confirm dialog before showing flagged messages.",
|
|
185
|
-
"components": ["CometChatMessageList"],
|
|
186
|
-
"config_schema": {
|
|
187
|
-
"threshold": { "type": "number", "min": 0, "max": 100, "default": 50, "prompt": "Sentiment threshold (0-100; lower = more aggressive)" },
|
|
188
|
-
"rule": { "type": "enum", "values": ["confirm-view", "tag", "drop"], "default": "confirm-view", "prompt": "Action for flagged messages?" }
|
|
189
|
-
},
|
|
190
|
-
"docs_topic": "extensions#sentiment-analysis"
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
"id": "xss-filter",
|
|
194
|
-
"name": "XSS Filter",
|
|
195
|
-
"type": "moderation",
|
|
196
|
-
"extension_id": "xss-filter",
|
|
197
|
-
"description": "Strips HTML/script injection from messages before delivery. Critical for chat surfaces that render rich text.",
|
|
198
|
-
"components": ["CometChatMessageList"],
|
|
199
|
-
"config_schema": {
|
|
200
|
-
"strict_mode": { "type": "boolean", "default": true, "prompt": "Strict mode (blocks all HTML; safer)?" },
|
|
201
|
-
"allowed_tags": { "type": "array<string>", "default": ["b", "i", "u", "strong", "em"], "when": { "strict_mode": false }, "prompt": "Allowed HTML tags (when strict mode off)" }
|
|
202
|
-
},
|
|
203
|
-
"docs_topic": "extensions#xss-filter"
|
|
204
|
-
},
|
|
205
|
-
{
|
|
206
|
-
"id": "slow-mode",
|
|
207
|
-
"name": "Slow Mode",
|
|
208
|
-
"type": "moderation",
|
|
209
|
-
"extension_id": "slow-mode",
|
|
210
|
-
"description": "Rate-limits how often a user can post in a conversation/group. Reduces spam in busy channels.",
|
|
211
|
-
"components": ["CometChatMessageComposer"],
|
|
212
|
-
"config_schema": {
|
|
213
|
-
"interval_seconds": { "type": "number", "min": 1, "max": 3600, "default": 5, "prompt": "Minimum seconds between messages from the same user" },
|
|
214
|
-
"applies_to": { "type": "enum", "values": ["all", "groups-only", "specific-groups"], "default": "groups-only", "prompt": "Apply slow mode where?" },
|
|
215
|
-
"specific_group_ids": { "type": "array<string>", "when": { "applies_to": "specific-groups" }, "prompt": "Group IDs (comma-separated)" }
|
|
216
|
-
},
|
|
217
|
-
"docs_topic": "extensions#slow-mode"
|
|
218
|
-
},
|
|
219
|
-
{
|
|
220
|
-
"id": "virus-malware-scanner",
|
|
221
|
-
"name": "Virus / Malware Scanner",
|
|
222
|
-
"type": "moderation",
|
|
223
|
-
"extension_id": "virus-malware-scanner",
|
|
224
|
-
"description": "Scans uploaded files (images, documents, archives) for malware before delivery. Required for healthcare, legal, finance apps.",
|
|
225
|
-
"components": ["CometChatMessageList", "CometChatMessageComposer"],
|
|
226
|
-
"config_schema": {
|
|
227
|
-
"scan_images": { "type": "boolean", "default": true, "prompt": "Scan image uploads?" },
|
|
228
|
-
"scan_documents": { "type": "boolean", "default": true, "prompt": "Scan document uploads (.pdf, .docx, etc.)?" },
|
|
229
|
-
"scan_archives": { "type": "boolean", "default": true, "prompt": "Scan archive uploads (.zip, .tar.gz)?" },
|
|
230
|
-
"rule": { "type": "enum", "values": ["block", "quarantine", "tag"], "default": "block", "prompt": "Action when malware detected?" }
|
|
231
|
-
},
|
|
232
|
-
"docs_topic": "extensions#virus-malware-scanner"
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
"id": "bitly",
|
|
236
|
-
"name": "Bitly URL Shortening",
|
|
237
|
-
"type": "extension",
|
|
238
|
-
"description": "Automatically shorten long URLs in messages using Bitly.",
|
|
239
|
-
"dashboard_path": "Extensions → Bitly → Toggle on",
|
|
240
|
-
"docs_topic": "extensions#bitly"
|
|
241
|
-
},
|
|
242
|
-
{
|
|
243
|
-
"id": "link-preview",
|
|
244
|
-
"name": "Link Preview",
|
|
245
|
-
"type": "extension",
|
|
246
|
-
"auto_wired_in_uikit": true,
|
|
247
|
-
"description": "Show URL previews with title, description, and thumbnail. UI decorator auto-attached by the UI Kit (in defaultExtensions[]).",
|
|
248
|
-
"dashboard_path": "Extensions → Link Preview → Toggle on",
|
|
249
|
-
"docs_topic": "extensions#link-preview"
|
|
250
|
-
},
|
|
251
|
-
{
|
|
252
|
-
"id": "message-shortcuts",
|
|
253
|
-
"name": "Message Shortcuts",
|
|
254
|
-
"type": "dashboard-only",
|
|
255
|
-
"description": "Expand predefined short codes into full messages.",
|
|
256
|
-
"dashboard_path": "Extensions → Message Shortcuts → Configure shortcuts",
|
|
257
|
-
"docs_topic": "extensions#message-shortcuts"
|
|
258
|
-
},
|
|
259
|
-
{
|
|
260
|
-
"id": "pin-message",
|
|
261
|
-
"name": "Pin Message",
|
|
262
|
-
"type": "extension",
|
|
263
|
-
"description": "Pin important messages for easy access.",
|
|
264
|
-
"dashboard_path": "Extensions → Pin Message → Toggle on",
|
|
265
|
-
"docs_topic": "extensions#pin-message"
|
|
266
|
-
},
|
|
267
|
-
{
|
|
268
|
-
"id": "rich-media-preview",
|
|
269
|
-
"name": "Rich Media Preview",
|
|
270
|
-
"type": "extension",
|
|
271
|
-
"description": "Generate rich preview panels for URLs via iFramely.",
|
|
272
|
-
"dashboard_path": "Extensions → Rich Media Preview → Toggle on",
|
|
273
|
-
"docs_topic": "extensions#rich-media-preview"
|
|
274
|
-
},
|
|
275
|
-
{
|
|
276
|
-
"id": "save-message",
|
|
277
|
-
"name": "Save Message",
|
|
278
|
-
"type": "extension",
|
|
279
|
-
"description": "Bookmark messages privately for later.",
|
|
280
|
-
"dashboard_path": "Extensions → Save Message → Toggle on",
|
|
281
|
-
"docs_topic": "extensions#save-message"
|
|
282
|
-
},
|
|
283
|
-
{
|
|
284
|
-
"id": "thumbnail-generation",
|
|
285
|
-
"name": "Thumbnail Generation",
|
|
286
|
-
"type": "extension",
|
|
287
|
-
"auto_wired_in_uikit": true,
|
|
288
|
-
"description": "Auto-generate thumbnails for shared media to reduce bandwidth. UI decorator auto-attached by the UI Kit (in defaultExtensions[]).",
|
|
289
|
-
"dashboard_path": "Extensions → Thumbnail Generation → Toggle on",
|
|
290
|
-
"docs_topic": "extensions#thumbnail-generation"
|
|
291
|
-
},
|
|
292
|
-
{
|
|
293
|
-
"id": "tinyurl",
|
|
294
|
-
"name": "TinyURL Shortening",
|
|
295
|
-
"type": "extension",
|
|
296
|
-
"description": "Shorten URLs using TinyURL service.",
|
|
297
|
-
"dashboard_path": "Extensions → TinyURL → Toggle on",
|
|
298
|
-
"docs_topic": "extensions#tinyurl"
|
|
299
|
-
},
|
|
300
|
-
{
|
|
301
|
-
"id": "voice-transcription",
|
|
302
|
-
"name": "Voice Transcription",
|
|
303
|
-
"type": "extension",
|
|
304
|
-
"description": "Convert audio messages to text automatically.",
|
|
305
|
-
"dashboard_path": "Extensions → Voice Transcription → Toggle on",
|
|
306
|
-
"docs_topic": "extensions#voice-transcription"
|
|
307
|
-
},
|
|
308
|
-
{
|
|
309
|
-
"id": "giphy",
|
|
310
|
-
"name": "Giphy GIFs",
|
|
311
|
-
"type": "dashboard-only",
|
|
312
|
-
"description": "Search and share GIFs from Giphy.",
|
|
313
|
-
"dashboard_path": "Extensions → Giphy → Configure API key",
|
|
314
|
-
"docs_topic": "extensions#giphy"
|
|
315
|
-
},
|
|
316
|
-
{
|
|
317
|
-
"id": "message-translation",
|
|
318
|
-
"name": "Message Translation",
|
|
319
|
-
"type": "extension",
|
|
320
|
-
"auto_wired_in_uikit": true,
|
|
321
|
-
"description": "Translate messages into the user's locale. UI decorator auto-attached by the UI Kit (in defaultExtensions[]).",
|
|
322
|
-
"dashboard_path": "Extensions → Message Translation → Toggle on",
|
|
323
|
-
"docs_topic": "extensions#message-translation"
|
|
324
|
-
},
|
|
325
|
-
{
|
|
326
|
-
"id": "polls",
|
|
327
|
-
"name": "Polls",
|
|
328
|
-
"type": "extension",
|
|
329
|
-
"auto_wired_in_uikit": true,
|
|
330
|
-
"description": "Create polls in group discussions with preset answers. UI decorator auto-attached by the UI Kit (in defaultExtensions[]).",
|
|
331
|
-
"dashboard_path": "Extensions → Polls → Toggle on",
|
|
332
|
-
"docs_topic": "extensions#polls"
|
|
333
|
-
},
|
|
334
|
-
{
|
|
335
|
-
"id": "reminders",
|
|
336
|
-
"name": "Reminders",
|
|
337
|
-
"type": "extension",
|
|
338
|
-
"description": "Set message reminders or personal notifications via bot.",
|
|
339
|
-
"dashboard_path": "Extensions → Reminders → Toggle on",
|
|
340
|
-
"docs_topic": "extensions#reminders"
|
|
341
|
-
},
|
|
342
|
-
{
|
|
343
|
-
"id": "stickers",
|
|
344
|
-
"name": "Stickers",
|
|
345
|
-
"type": "extension",
|
|
346
|
-
"auto_wired_in_uikit": true,
|
|
347
|
-
"description": "Send pre-designed stickers in conversations. UI decorator auto-attached by the UI Kit (in defaultExtensions[]).",
|
|
348
|
-
"dashboard_path": "Extensions → Stickers → Toggle on",
|
|
349
|
-
"docs_topic": "extensions#stickers"
|
|
350
|
-
},
|
|
351
|
-
{
|
|
352
|
-
"id": "stipop",
|
|
353
|
-
"name": "Stipop Sticker Library",
|
|
354
|
-
"type": "dashboard-only",
|
|
355
|
-
"description": "Integrates the Stipop sticker library.",
|
|
356
|
-
"dashboard_path": "Extensions → Stipop → Configure API key",
|
|
357
|
-
"docs_topic": "extensions#stipop"
|
|
358
|
-
},
|
|
359
|
-
{
|
|
360
|
-
"id": "tenor",
|
|
361
|
-
"name": "Tenor GIFs",
|
|
362
|
-
"type": "dashboard-only",
|
|
363
|
-
"description": "Search and share GIFs from Tenor.",
|
|
364
|
-
"dashboard_path": "Extensions → Tenor → Configure API key",
|
|
365
|
-
"docs_topic": "extensions#tenor"
|
|
366
|
-
},
|
|
367
|
-
{
|
|
368
|
-
"id": "collaborative-document",
|
|
369
|
-
"name": "Collaborative Document",
|
|
370
|
-
"type": "extension",
|
|
371
|
-
"auto_wired_in_uikit": true,
|
|
372
|
-
"description": "Real-time shared document editing. UI decorator auto-attached by the UI Kit (in defaultExtensions[]).",
|
|
373
|
-
"dashboard_path": "Extensions → Collaborative Document → Toggle on",
|
|
374
|
-
"docs_topic": "extensions#collaborative-document"
|
|
375
|
-
},
|
|
376
|
-
{
|
|
377
|
-
"id": "collaborative-whiteboard",
|
|
378
|
-
"name": "Collaborative Whiteboard",
|
|
379
|
-
"type": "extension",
|
|
380
|
-
"auto_wired_in_uikit": true,
|
|
381
|
-
"description": "Shared whiteboard for drawing and brainstorming. UI decorator auto-attached by the UI Kit (in defaultExtensions[]).",
|
|
382
|
-
"dashboard_path": "Extensions → Collaborative Whiteboard → Toggle on",
|
|
383
|
-
"docs_topic": "extensions#collaborative-whiteboard"
|
|
384
|
-
},
|
|
385
|
-
{
|
|
386
|
-
"id": "disappearing-messages",
|
|
387
|
-
"name": "Disappearing Messages",
|
|
388
|
-
"type": "dashboard-only",
|
|
389
|
-
"description": "Messages auto-delete after a specified interval.",
|
|
390
|
-
"dashboard_path": "Extensions → Disappearing Messages → Configure interval",
|
|
391
|
-
"docs_topic": "extensions#disappearing-messages"
|
|
392
|
-
},
|
|
393
|
-
{
|
|
394
|
-
"id": "chatwoot",
|
|
395
|
-
"name": "Chatwoot Integration",
|
|
396
|
-
"type": "dashboard-only",
|
|
397
|
-
"description": "Route messages to Chatwoot for customer support.",
|
|
398
|
-
"dashboard_path": "Extensions → Chatwoot → Configure webhook",
|
|
399
|
-
"docs_topic": "extensions#chatwoot"
|
|
400
|
-
},
|
|
401
|
-
{
|
|
402
|
-
"id": "intercom",
|
|
403
|
-
"name": "Intercom Integration",
|
|
404
|
-
"type": "dashboard-only",
|
|
405
|
-
"description": "Integrate Intercom for in-app customer support.",
|
|
406
|
-
"dashboard_path": "Extensions → Intercom → Configure API key",
|
|
407
|
-
"docs_topic": "extensions#intercom"
|
|
408
|
-
},
|
|
409
|
-
{
|
|
410
|
-
"id": "conversation-starter",
|
|
411
|
-
"name": "AI Conversation Starter",
|
|
412
|
-
"type": "ai-feature",
|
|
413
|
-
"ai_key": "conversation-starter",
|
|
414
|
-
"requires": "openai-key",
|
|
415
|
-
"description": "AI-generated opening messages for new chats.",
|
|
416
|
-
"dashboard_path": "AI Features → Conversation Starter → Toggle on",
|
|
417
|
-
"docs_topic": "ai-features#conversation-starter"
|
|
418
|
-
},
|
|
419
|
-
{
|
|
420
|
-
"id": "smart-replies",
|
|
421
|
-
"name": "AI Smart Replies",
|
|
422
|
-
"type": "ai-feature",
|
|
423
|
-
"ai_key": "smart-replies",
|
|
424
|
-
"requires": "openai-key",
|
|
425
|
-
"description": "AI-generated contextual response suggestions.",
|
|
426
|
-
"dashboard_path": "AI Features → Smart Replies → Toggle on",
|
|
427
|
-
"docs_topic": "ai-features#smart-replies"
|
|
428
|
-
},
|
|
429
|
-
{
|
|
430
|
-
"id": "conversation-summary",
|
|
431
|
-
"name": "AI Conversation Summary",
|
|
432
|
-
"type": "ai-feature",
|
|
433
|
-
"ai_key": "conversation-summary",
|
|
434
|
-
"requires": "openai-key",
|
|
435
|
-
"description": "AI-generated recaps of extended conversations.",
|
|
436
|
-
"dashboard_path": "AI Features → Conversation Summary → Toggle on",
|
|
437
|
-
"docs_topic": "ai-features#conversation-summary"
|
|
438
|
-
},
|
|
439
|
-
{
|
|
440
|
-
"id": "calls",
|
|
441
|
-
"name": "Audio/Video Calls",
|
|
442
|
-
"type": "package-install",
|
|
443
|
-
"description": "1:1 and group audio/video calling. Includes call buttons in headers, incoming/outgoing call UI, and call logs. Requires installing the calls SDK for your platform.",
|
|
444
|
-
"package": "@cometchat/calls-sdk-javascript",
|
|
445
|
-
"package_native": "@cometchat/calls-sdk-react-native",
|
|
446
|
-
"package_native_peers": [
|
|
447
|
-
"react-native-webrtc",
|
|
448
|
-
"react-native-incall-manager",
|
|
449
|
-
"react-native-background-timer",
|
|
450
|
-
"react-native-callstats",
|
|
451
|
-
"@react-native-community/netinfo"
|
|
452
|
-
],
|
|
453
|
-
"components": ["CometChatIncomingCall", "CometChatOutgoingCall", "CometChatCallLogs"],
|
|
454
|
-
"docs_topic": "call-features"
|
|
455
|
-
},
|
|
456
|
-
{
|
|
457
|
-
"id": "rich-text-formatting",
|
|
458
|
-
"name": "Rich Text Formatting",
|
|
459
|
-
"type": "component-swap",
|
|
460
|
-
"description": "Bold, italic, underline, code, links, lists in messages. Replace CometChatMessageComposer with CometChatCompactMessageComposer.",
|
|
461
|
-
"swap_from": "CometChatMessageComposer",
|
|
462
|
-
"swap_to": "CometChatCompactMessageComposer",
|
|
463
|
-
"docs_topic": "core-features#rich-text-formatting"
|
|
464
|
-
},
|
|
465
|
-
{
|
|
466
|
-
"id": "call-recording",
|
|
467
|
-
"name": "Call Recording",
|
|
468
|
-
"type": "calls-feature",
|
|
469
|
-
"description": "Record calls to cloud storage. Built into Calls SDK; configured via CallSettingsBuilder. Server-side recording requires the Recording add-on enabled on your CometChat plan.",
|
|
470
|
-
"settings_flag": "startRecordingOnCallStart",
|
|
471
|
-
"reference_topic": "recording",
|
|
472
|
-
"platforms_supported": ["web", "react-native", "angular", "ios", "android-v5", "android-v6", "flutter-v5", "flutter-v6"],
|
|
473
|
-
"docs_topic": "calls/recording"
|
|
474
|
-
},
|
|
475
|
-
{
|
|
476
|
-
"id": "screen-share",
|
|
477
|
-
"name": "Screen Sharing",
|
|
478
|
-
"type": "calls-feature",
|
|
479
|
-
"description": "Share screen during a call. Built into Calls SDK; configured via CallSettingsBuilder hideScreenShareButton flag. Mobile platforms have OS-level gating (iOS broadcast extension, Android MediaProjection).",
|
|
480
|
-
"settings_flag": "hideScreenShareButton",
|
|
481
|
-
"reference_topic": "screen-sharing",
|
|
482
|
-
"platforms_supported": ["web", "react-native", "angular", "ios", "android-v5", "android-v6", "flutter-v5", "flutter-v6"],
|
|
483
|
-
"docs_topic": "calls/screen-sharing"
|
|
484
|
-
},
|
|
485
|
-
{
|
|
486
|
-
"id": "virtual-background",
|
|
487
|
-
"name": "Virtual Background",
|
|
488
|
-
"type": "calls-feature",
|
|
489
|
-
"description": "Blur or replace the user's background during a call. JavaScript-only feature — not available on iOS/Android/RN browsers (mobile webviews don't ship the ML Kit needed).",
|
|
490
|
-
"settings_flag": "hideVirtualBackgroundButton",
|
|
491
|
-
"reference_topic": "virtual-background",
|
|
492
|
-
"platforms_supported": ["web", "angular"],
|
|
493
|
-
"docs_topic": "calls/virtual-background"
|
|
494
|
-
},
|
|
495
|
-
{
|
|
496
|
-
"id": "raise-hand",
|
|
497
|
-
"name": "Raise Hand",
|
|
498
|
-
"type": "calls-feature",
|
|
499
|
-
"description": "Participants can raise a hand to signal they want to speak. Built into Calls SDK.",
|
|
500
|
-
"settings_flag": "hideRaiseHandButton",
|
|
501
|
-
"reference_topic": "raise-hand",
|
|
502
|
-
"platforms_supported": ["web", "react-native", "angular", "ios", "android-v5", "android-v6", "flutter-v5", "flutter-v6"],
|
|
503
|
-
"docs_topic": "calls/raise-hand"
|
|
504
|
-
},
|
|
505
|
-
{
|
|
506
|
-
"id": "picture-in-picture",
|
|
507
|
-
"name": "Picture-in-Picture",
|
|
508
|
-
"type": "calls-feature",
|
|
509
|
-
"description": "Minimize an in-progress call into a floating window so the user can keep using the rest of your app (or other apps on mobile). Per-platform constraints — iOS PIP requires a multitasking-capable iPad or iOS 15+ iPhone, Android requires API 26+.",
|
|
510
|
-
"settings_flag": "hidePIPButton",
|
|
511
|
-
"reference_topic": "picture-in-picture",
|
|
512
|
-
"platforms_supported": ["web", "react-native", "angular", "ios", "android-v5", "android-v6", "flutter-v5", "flutter-v6"],
|
|
513
|
-
"docs_topic": "calls/picture-in-picture"
|
|
514
|
-
},
|
|
515
|
-
{
|
|
516
|
-
"id": "idle-timeout",
|
|
517
|
-
"name": "Idle Timeout",
|
|
518
|
-
"type": "calls-feature",
|
|
519
|
-
"description": "Auto-end a call after a configurable period of no activity. Prevents zombie calls + unbounded billing. Built into Calls SDK; configured via CallSettingsBuilder callIdleTime.",
|
|
520
|
-
"settings_flag": "callIdleTime",
|
|
521
|
-
"reference_topic": "idle-timeout",
|
|
522
|
-
"platforms_supported": ["web", "react-native", "angular", "ios", "android-v5", "android-v6", "flutter-v5", "flutter-v6"],
|
|
523
|
-
"docs_topic": "calls/idle-timeout"
|
|
524
|
-
}
|
|
525
|
-
]
|
|
526
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* /api/cometchat-token — server-side endpoint that mints CometChat auth tokens.
|
|
3
|
-
*
|
|
4
|
-
* Astro API route. The Auth Key NEVER leaves the server. The client calls
|
|
5
|
-
* this endpoint to get a short-lived auth token, then passes it to
|
|
6
|
-
* CometChatUIKit.loginWithAuthToken().
|
|
7
|
-
*
|
|
8
|
-
* Generated by `cometchat production-auth`. Customize freely:
|
|
9
|
-
* - Add real authentication: read the user's session cookie / JWT here
|
|
10
|
-
* - Map your app's user IDs to CometChat UIDs
|
|
11
|
-
* - Add rate limiting if exposed publicly
|
|
12
|
-
*
|
|
13
|
-
* Astro requirement: your astro.config.mjs must have `output: 'server'` or
|
|
14
|
-
* `output: 'hybrid'` for API routes to work. Static-only Astro builds
|
|
15
|
-
* cannot run server-side endpoints.
|
|
16
|
-
*
|
|
17
|
-
* Security note: this file MUST NOT use PUBLIC_* env vars for the Auth Key.
|
|
18
|
-
* The whole point is to keep the Auth Key out of the browser.
|
|
19
|
-
*/
|
|
20
|
-
import type { APIRoute } from "astro";
|
|
21
|
-
|
|
22
|
-
const COMETCHAT_APP_ID = import.meta.env.PUBLIC_COMETCHAT_APP_ID!;
|
|
23
|
-
const COMETCHAT_REGION = import.meta.env.PUBLIC_COMETCHAT_REGION!;
|
|
24
|
-
// IMPORTANT: server-only — no PUBLIC_ prefix
|
|
25
|
-
const COMETCHAT_AUTH_KEY = import.meta.env.COMETCHAT_AUTH_KEY!;
|
|
26
|
-
|
|
27
|
-
export const GET: APIRoute = async ({ request }) => {
|
|
28
|
-
const url = new URL(request.url);
|
|
29
|
-
// ⚠ Replace this with your real auth: read the session, extract the user ID,
|
|
30
|
-
// then map it to a CometChat UID. Do not trust the query param in production.
|
|
31
|
-
const uid = url.searchParams.get("uid") ?? "cometchat-uid-1";
|
|
32
|
-
|
|
33
|
-
if (!COMETCHAT_APP_ID || !COMETCHAT_REGION || !COMETCHAT_AUTH_KEY) {
|
|
34
|
-
return new Response(
|
|
35
|
-
JSON.stringify({ error: "CometChat credentials not configured on the server" }),
|
|
36
|
-
{ status: 500, headers: { "Content-Type": "application/json" } },
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
try {
|
|
41
|
-
const res = await fetch(
|
|
42
|
-
`https://${COMETCHAT_APP_ID}.api-${COMETCHAT_REGION}.cometchat.io/v3/users/${encodeURIComponent(uid)}/auth_tokens`,
|
|
43
|
-
{
|
|
44
|
-
method: "POST",
|
|
45
|
-
headers: {
|
|
46
|
-
"Content-Type": "application/json",
|
|
47
|
-
appid: COMETCHAT_APP_ID,
|
|
48
|
-
apikey: COMETCHAT_AUTH_KEY,
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
if (!res.ok) {
|
|
54
|
-
const text = await res.text();
|
|
55
|
-
return new Response(
|
|
56
|
-
JSON.stringify({ error: `CometChat token mint failed (${res.status})`, detail: text }),
|
|
57
|
-
{ status: 502, headers: { "Content-Type": "application/json" } },
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const body = (await res.json()) as { data?: { authToken?: string } };
|
|
62
|
-
const authToken = body.data?.authToken;
|
|
63
|
-
if (!authToken) {
|
|
64
|
-
return new Response(
|
|
65
|
-
JSON.stringify({ error: "CometChat returned no authToken in response" }),
|
|
66
|
-
{ status: 502, headers: { "Content-Type": "application/json" } },
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return new Response(JSON.stringify({ authToken, uid }), {
|
|
71
|
-
status: 200,
|
|
72
|
-
headers: { "Content-Type": "application/json" },
|
|
73
|
-
});
|
|
74
|
-
} catch (err) {
|
|
75
|
-
return new Response(
|
|
76
|
-
JSON.stringify({
|
|
77
|
-
error: "Token mint failed",
|
|
78
|
-
detail: err instanceof Error ? err.message : String(err),
|
|
79
|
-
}),
|
|
80
|
-
{ status: 500, headers: { "Content-Type": "application/json" } },
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
// Astro requires this for non-static routes
|
|
86
|
-
export const prerender = false;
|