@jchat/addon-sdk 1.0.0-alpha.21 → 1.0.0-alpha.23
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 +27 -1
- package/README.md +4 -4
- package/dist/contracts.d.mts +2 -0
- package/dist/contracts.mjs +3 -1
- package/dist/index.mjs +11 -9
- package/dist/index2.d.mts +18 -6
- package/dist/vite.mjs +2 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @jchat/addon-sdk
|
|
2
2
|
|
|
3
|
+
## 1.0.0-alpha.23
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Support newline normalization for addon signing private keys
|
|
8
|
+
|
|
9
|
+
- Bumped `@jchat/*` dependencies:
|
|
10
|
+
- [`ui@1.0.0-alpha.23`](https://github.com/mjjabarullah/jchat/releases/tag/ui@v1.0.0-alpha.23)
|
|
11
|
+
|
|
12
|
+
## 1.0.0-alpha.22
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- Introduce composer preview slot, active addon coordination, and lifecycle optimizations
|
|
17
|
+
|
|
18
|
+
- Add CHAT_COMPOSER_PREVIEW mount point for live composer rich card previews
|
|
19
|
+
- Optimize message lifecycle pipeline with active addon caching and AbortSignal cancellation
|
|
20
|
+
- Allow passing verifyEntitlement function directly to verifyAddonEntitlement
|
|
21
|
+
- Provide activeAddonIds in AddonProps to enable addon self-coordination
|
|
22
|
+
- Update default service and documentation domains to jchatplatform.com
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- Bumped `@jchat/*` dependencies:
|
|
27
|
+
- [`ui@1.0.0-alpha.22`](https://github.com/mjjabarullah/jchat/releases/tag/ui@v1.0.0-alpha.22)
|
|
28
|
+
|
|
3
29
|
## 1.0.0-alpha.21
|
|
4
30
|
|
|
5
31
|
### Minor Changes
|
|
@@ -77,7 +103,7 @@ No changes in this release.
|
|
|
77
103
|
- 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
104
|
- 27efa80: - Update third-party developer guide in README with complete quick start, architecture specifications, hook references, and mount points
|
|
79
105
|
- Include `LICENSE` file in published npm package distribution
|
|
80
|
-
- Update license badge and terms references to link to official public web address (`https://
|
|
106
|
+
- Update license badge and terms references to link to official public web address (`https://jchatplatform.com/terms`)
|
|
81
107
|
|
|
82
108
|
## 1.0.0-alpha.11
|
|
83
109
|
|
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://
|
|
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
|
[](https://www.npmjs.com/package/@jchat/addon-sdk)
|
|
8
|
-
[](https://
|
|
8
|
+
[](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://
|
|
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://
|
|
410
|
+
Proprietary — All rights reserved. See the [Commercial EULA & Licensing Terms](https://jchatplatform.com/terms) for full details.
|
package/dist/contracts.d.mts
CHANGED
|
@@ -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];
|
package/dist/contracts.mjs
CHANGED
|
@@ -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
|
@@ -2,7 +2,7 @@ import { MOUNT_POINTS } from "./contracts.mjs";
|
|
|
2
2
|
import { a as useTranslation, i as useLocale, n as LocaleContext, r as createTranslator, t as HOST_LANGUAGES } from "./i18n.mjs";
|
|
3
3
|
import { useInfiniteQuery, useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
4
4
|
//#region package.json
|
|
5
|
-
var version = "1.0.0-alpha.
|
|
5
|
+
var version = "1.0.0-alpha.22";
|
|
6
6
|
//#endregion
|
|
7
7
|
//#region src/query.ts
|
|
8
8
|
/**
|
|
@@ -152,20 +152,22 @@ function getAddonSdkVersion() {
|
|
|
152
152
|
*
|
|
153
153
|
* @example
|
|
154
154
|
* ;```ts
|
|
155
|
-
* export default
|
|
156
|
-
*
|
|
157
|
-
*
|
|
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
|
|
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,
|
|
167
|
-
|
|
168
|
-
|
|
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
|
|
587
|
-
*
|
|
588
|
-
*
|
|
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
|
|
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,
|
|
609
|
+
export declare function verifyAddonEntitlement(addonId: string, target?: ((expectedAddonId?: string) => boolean) | {
|
|
598
610
|
verifyEntitlement?: (expectedAddonId?: string) => boolean;
|
|
599
611
|
}): boolean;
|
|
600
612
|
//#endregion
|
package/dist/vite.mjs
CHANGED
|
@@ -221,12 +221,13 @@ function signAddonManifest(manifest, files, privateKey) {
|
|
|
221
221
|
hash.update("\0");
|
|
222
222
|
}
|
|
223
223
|
const digest = hash.digest("hex");
|
|
224
|
+
const normalizedKey = privateKey.replace(/\\n/g, "\n").trim();
|
|
224
225
|
return {
|
|
225
226
|
...unsigned,
|
|
226
227
|
signature: {
|
|
227
228
|
algorithm: "rsa-sha256",
|
|
228
229
|
digest,
|
|
229
|
-
value: crypto.sign("sha256", Buffer.from(digest),
|
|
230
|
+
value: crypto.sign("sha256", Buffer.from(digest), normalizedKey).toString("base64url")
|
|
230
231
|
}
|
|
231
232
|
};
|
|
232
233
|
}
|