@jchat/addon-sdk 1.0.0-alpha.21 → 1.0.0-alpha.22

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/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @jchat/addon-sdk
2
2
 
3
+ ## 1.0.0-alpha.22
4
+
5
+ ### Minor Changes
6
+
7
+ - Introduce composer preview slot, active addon coordination, and lifecycle optimizations
8
+
9
+ - Add CHAT_COMPOSER_PREVIEW mount point for live composer rich card previews
10
+ - Optimize message lifecycle pipeline with active addon caching and AbortSignal cancellation
11
+ - Allow passing verifyEntitlement function directly to verifyAddonEntitlement
12
+ - Provide activeAddonIds in AddonProps to enable addon self-coordination
13
+ - Update default service and documentation domains to jchatplatform.com
14
+
15
+ ### Patch Changes
16
+
17
+ - Bumped `@jchat/*` dependencies:
18
+ - [`ui@1.0.0-alpha.22`](https://github.com/mjjabarullah/jchat/releases/tag/ui@v1.0.0-alpha.22)
19
+
3
20
  ## 1.0.0-alpha.21
4
21
 
5
22
  ### Minor Changes
@@ -77,7 +94,7 @@ No changes in this release.
77
94
  - c5fa55f: Support direct icon imports via `@jchat/addon-sdk/icon` and align icon packs with canonical Lucide icon definitions. Addons can now import `Icons` directly without requiring hook invocation (`useIcons`), while maintaining backward compatibility for existing addons.
78
95
  - 27efa80: - Update third-party developer guide in README with complete quick start, architecture specifications, hook references, and mount points
79
96
  - Include `LICENSE` file in published npm package distribution
80
- - Update license badge and terms references to link to official public web address (`https://jchatlive.com/terms`)
97
+ - Update license badge and terms references to link to official public web address (`https://jchatplatform.com/terms`)
81
98
 
82
99
  ## 1.0.0-alpha.11
83
100
 
package/README.md CHANGED
@@ -1,11 +1,11 @@
1
1
  # @jchat/addon-sdk
2
2
 
3
- Official TypeScript SDK for developing extensions, UI widgets, and server plugins for the [JChat](https://jchatlive.com) communication platform.
3
+ Official TypeScript SDK for developing extensions, UI widgets, and server plugins for the [JChat](https://jchatplatform.com) communication platform.
4
4
 
5
5
  Provides typed interfaces, manifest contracts, Vite bundler plugins, and CLI development tooling for building sandboxed JChat addons.
6
6
 
7
7
  [![npm version](https://img.shields.io/npm/v/@jchat/addon-sdk.svg)](https://www.npmjs.com/package/@jchat/addon-sdk)
8
- [![License](https://img.shields.io/badge/license-Proprietary-blue.svg)](https://jchatlive.com/terms)
8
+ [![License](https://img.shields.io/badge/license-Proprietary-blue.svg)](https://jchatplatform.com/terms)
9
9
 
10
10
  ---
11
11
 
@@ -401,10 +401,10 @@ bun run build
401
401
  1. Build your addon package: `bun run build`.
402
402
  2. Ensure all 20 translation files pass validation: `bun test`.
403
403
  3. Package your addon distribution archive.
404
- 4. Sign in to the **[JChat Store Developer Portal](https://jchatlive.com/addons)** and submit your addon package for certified distribution.
404
+ 4. Sign in to the **[JChat Store Developer Portal](https://jchatplatform.com/addons)** and submit your addon package for certified distribution.
405
405
 
406
406
  ---
407
407
 
408
408
  ## License
409
409
 
410
- Proprietary — All rights reserved. See the [Commercial EULA & Licensing Terms](https://jchatlive.com/terms) for full details.
410
+ Proprietary — All rights reserved. See the [Commercial EULA & Licensing Terms](https://jchatplatform.com/terms) for full details.
@@ -44,6 +44,8 @@ export declare const MOUNT_POINTS: {
44
44
  readonly CHAT_MESSAGE_CARD: "chat-message-card";
45
45
  /** Custom badge, audio equalizer, or particle aura rendered on a chat bubble */
46
46
  readonly CHAT_MESSAGE_FLAIR: "chat-message-flair";
47
+ /** Custom interactive preview card rendered in the message composer */
48
+ readonly CHAT_COMPOSER_PREVIEW: "chat-composer-preview";
47
49
  };
48
50
  /** Union type of all valid addon mount points. */
49
51
  export type MountPoint = (typeof MOUNT_POINTS)[keyof typeof MOUNT_POINTS];
@@ -34,7 +34,9 @@ const MOUNT_POINTS = {
34
34
  /** Custom interactive card rendered inside an enriched chat message */
35
35
  CHAT_MESSAGE_CARD: "chat-message-card",
36
36
  /** Custom badge, audio equalizer, or particle aura rendered on a chat bubble */
37
- CHAT_MESSAGE_FLAIR: "chat-message-flair"
37
+ CHAT_MESSAGE_FLAIR: "chat-message-flair",
38
+ /** Custom interactive preview card rendered in the message composer */
39
+ CHAT_COMPOSER_PREVIEW: "chat-composer-preview"
38
40
  };
39
41
  //#endregion
40
42
  export { MOUNT_POINTS };
package/dist/index.mjs CHANGED
@@ -152,20 +152,22 @@ function getAddonSdkVersion() {
152
152
  *
153
153
  * @example
154
154
  * ;```ts
155
- * export default defineAddonServer((context, app) => {
156
- * verifyAddonEntitlement("tubescanpro", context)
157
- * return app.get("/trending", async () => { ... })
158
- * })
155
+ * export default ({ verifyEntitlement, db, t }: AddonServerContext, app: AddonApp) => {
156
+ * verifyAddonEntitlement("tubescanpro", verifyEntitlement)
157
+ * return app.get("/trending", async () => { ... })
158
+ * }
159
159
  * ```
160
160
  *
161
161
  * @param addonId - The canonical addon ID defined by the publisher (e.g. 'tubescanpro')
162
- * @param context - The AddonServerContext passed to the addon's server factory
162
+ * @param target - Either the `verifyEntitlement` function from context or the `AddonServerContext`
163
+ * object itself
163
164
  * @returns True if valid
164
165
  * @throws Error if entitlement verification fails
165
166
  */
166
- function verifyAddonEntitlement(addonId, context) {
167
- if (context?.verifyEntitlement) {
168
- if (!context.verifyEntitlement(addonId)) throw new Error(`addon_entitlement_verification_failed:${addonId}`);
167
+ function verifyAddonEntitlement(addonId, target) {
168
+ const verifyFn = typeof target === "function" ? target : target?.verifyEntitlement;
169
+ if (verifyFn) {
170
+ if (!verifyFn(addonId)) throw new Error(`addon_entitlement_verification_failed:${addonId}`);
169
171
  return true;
170
172
  }
171
173
  return true;
package/dist/index2.d.mts CHANGED
@@ -239,6 +239,11 @@ export interface AddonMessageContext {
239
239
  code: string;
240
240
  reason?: string;
241
241
  }) => never;
242
+ /**
243
+ * AbortSignal triggered if this interceptor times out or the message pipeline is cancelled. Can
244
+ * be passed to `fetch(url, { signal: context.signal })` or async operations.
245
+ */
246
+ signal?: AbortSignal;
242
247
  }
243
248
  export interface AddonMessageAfterSaveContext {
244
249
  siteId: string;
@@ -252,8 +257,12 @@ export interface AddonMessageAfterSaveContext {
252
257
  type: string;
253
258
  createdAt: Date | string;
254
259
  };
260
+ /** AbortSignal triggered if the observer times out or is cancelled. */
261
+ signal?: AbortSignal;
255
262
  }
256
263
  export interface AddonPipelineHooks {
264
+ /** Optional priority ordering. Lower numbers execute first (e.g. 10 runs before 100). Default is 100. */
265
+ priority?: number;
257
266
  /**
258
267
  * Run before validation to inspect or guard actions (rate-limits, permission gates). Throw or
259
268
  * call `context.abort()` to reject the message.
@@ -383,6 +392,8 @@ export interface AddonProps {
383
392
  message?: unknown;
384
393
  /** The addon's specific payload extracted from message.metadata */
385
394
  addonData?: unknown;
395
+ /** List of active addon IDs enabled on the current site */
396
+ activeAddonIds?: string[];
386
397
  }
387
398
  export interface AddonApi {
388
399
  get: <TResponse = unknown>(path: string) => Promise<TResponse>;
@@ -583,18 +594,19 @@ export declare function getAddonSdkVersion(): string;
583
594
  *
584
595
  * @example
585
596
  * ;```ts
586
- * export default defineAddonServer((context, app) => {
587
- * verifyAddonEntitlement("tubescanpro", context)
588
- * return app.get("/trending", async () => { ... })
589
- * })
597
+ * export default ({ verifyEntitlement, db, t }: AddonServerContext, app: AddonApp) => {
598
+ * verifyAddonEntitlement("tubescanpro", verifyEntitlement)
599
+ * return app.get("/trending", async () => { ... })
600
+ * }
590
601
  * ```
591
602
  *
592
603
  * @param addonId - The canonical addon ID defined by the publisher (e.g. 'tubescanpro')
593
- * @param context - The AddonServerContext passed to the addon's server factory
604
+ * @param target - Either the `verifyEntitlement` function from context or the `AddonServerContext`
605
+ * object itself
594
606
  * @returns True if valid
595
607
  * @throws Error if entitlement verification fails
596
608
  */
597
- export declare function verifyAddonEntitlement(addonId: string, context?: {
609
+ export declare function verifyAddonEntitlement(addonId: string, target?: ((expectedAddonId?: string) => boolean) | {
598
610
  verifyEntitlement?: (expectedAddonId?: string) => boolean;
599
611
  }): boolean;
600
612
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jchat/addon-sdk",
3
- "version": "1.0.0-alpha.21",
3
+ "version": "1.0.0-alpha.22",
4
4
  "private": false,
5
5
  "description": "JChat Addon SDK for building JChat addons.",
6
6
  "keywords": [