@jchat/addon-sdk 1.0.0-alpha.3 → 1.0.0-alpha.30

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/dist/index.mjs CHANGED
@@ -1,105 +1,5 @@
1
- //#region package.json
2
- var version = "1.0.0-alpha.3";
3
- //#endregion
4
- //#region src/contracts.ts
5
- /** Valid locations where an addon can be rendered within the Jchat layout. */
6
- const MOUNT_POINTS = {
7
- /** Top of the main chat column */
8
- CHAT_HEADER: "chat-header",
9
- /** Below the main chat header, above messages */
10
- CHAT_TOOLBAR: "chat-toolbar",
11
- /** The persistent right-side sidebar */
12
- CHAT_SIDEBAR: "chat-sidebar",
13
- /** Top of the left sidebar (room list) */
14
- SIDEBAR_TOP: "sidebar-top",
15
- /** Bottom of the left sidebar */
16
- SIDEBAR_BOTTOM: "sidebar-bottom",
17
- /** Action list shown when clicking a user's avatar */
18
- USER_POPOVER_ACTIONS: "user-popover-actions",
19
- /** Menu shown when right-clicking a message */
20
- MESSAGE_CONTEXT_MENU: "message-context-menu",
21
- /** Floating overlay rendered on top of the message stream */
22
- MESSAGE_FEED_OVERLAY: "message-feed-overlay",
23
- /** Main admin dashboard area */
24
- ADMIN_PANEL: "admin-panel",
25
- /** User or site settings dashboard area */
26
- SETTINGS_PANEL: "settings-panel",
27
- /** The 'plus' (+) menu in the message composer */
28
- CHAT_PLUS_MENU: "chat-plus-menu",
29
- /** Custom tab in the emoji/gif selection panel */
30
- EMOJI_PICKER_GIF_TAB: "emoji-picker-gif-tab",
31
- /** Full-screen or modal dialog specifically for TubeScan */
32
- TUBESCAN_DIALOG: "tubescan-dialog"
33
- };
34
- //#endregion
35
- //#region src/index.ts
36
- /** Define a manifest with full validation-friendly typing while preserving literal values. */
37
- function defineAddonManifest(manifest) {
38
- return manifest;
39
- }
40
- /** Define a typed server factory without widening its addon database interface. */
41
- function defineAddonServer(factory) {
42
- return factory;
43
- }
44
- /**
45
- * Access the host application's SDK. Provides authenticated API access, toast notifications, and
46
- * navigation.
47
- *
48
- * This function is a shell; the real implementation is provided by the Jchat host environment at
49
- * runtime.
50
- *
51
- * @example
52
- * ;```tsx
53
- * import { useAddonSDK } from "@jchat/addon-sdk"
54
- *
55
- * export default function MyAddon({ mountPoint }: AddonProps) {
56
- * const sdk = useAddonSDK()
57
- *
58
- * const handleClick = async () => {
59
- * const data = await sdk.api.get("/trending")
60
- * sdk.toast("Fetched trending posts!", "success")
61
- * }
62
- * }
63
- * ```
64
- */
65
- function useAddonSDK() {
66
- throw new Error("AddonSDK must be used within the Jchat host environment.");
67
- }
68
- /**
69
- * Access the host application's active icon pack. Returns the icon set matching the site's
70
- * configured icon pack preference.
71
- *
72
- * This function is a shell; the real implementation is provided by the Jchat host environment at
73
- * runtime.
74
- *
75
- * @example
76
- * ;```tsx
77
- * import { useIcons } from "@jchat/addon-sdk"
78
- *
79
- * export default function MyAddon() {
80
- * const { Icons } = useIcons()
81
- * return <Icons.Send className="size-5" />
82
- * }
83
- * ```
84
- */
85
- function useIcons() {
86
- throw new Error("useIcons must be used within the Jchat host environment.");
87
- }
88
- /**
89
- * Get the version of the addon SDK. This is useful for checking compatibility with the host
90
- * application.
91
- *
92
- * @example
93
- * ;```tsx
94
- * import { getAddonSdkVersion } from "@jchat/addon-sdk"
95
- *
96
- * console.log(getAddonSdkVersion())
97
- * ```
98
- *
99
- * @returns
100
- */
101
- function getAddonSdkVersion() {
102
- return version;
103
- }
104
- //#endregion
105
- export { MOUNT_POINTS, defineAddonManifest, defineAddonServer, getAddonSdkVersion, useAddonSDK, useIcons };
1
+ import { _ as hasPermission, a as useAddonSDK, c as useAddonInfiniteQuery, d as useQueryClient, f as AbilityBuilder, g as createMongoAbility, h as createAddonAbility, i as getAddonSdkVersion, l as useAddonMutation, m as authorizeResourceOwnership, n as defineAddonManifest, o as verifyAddonEntitlement, p as ForbiddenError, r as defineAddonServer, s as createMockAddonServerContext, t as AddonPipelineAbortError, u as useAddonQuery, v as subject } from "./src.mjs";
2
+ import { HOST_LOCALES, MOUNT_POINTS } from "./contracts.mjs";
3
+ import { i as useTranslation, n as createTranslator, r as useLocale, t as LocaleContext } from "./i18n.mjs";
4
+ import { ADDON_ID_PATTERN, COMPATIBILITY_RANGE_PATTERN, MAX_ADDON_ARCHIVE_BYTES, assertSafeRelativePath, canonicalManifest, createCanonicalAddonDigest, isCompatibilityRange, sortValue, validateAddonManifest } from "./signing.mjs";
5
+ export { ADDON_ID_PATTERN, AbilityBuilder, AddonPipelineAbortError, COMPATIBILITY_RANGE_PATTERN, ForbiddenError, HOST_LOCALES, LocaleContext, MAX_ADDON_ARCHIVE_BYTES, MOUNT_POINTS, assertSafeRelativePath, authorizeResourceOwnership, canonicalManifest, createAddonAbility, createCanonicalAddonDigest, createMockAddonServerContext, createMongoAbility, createTranslator, defineAddonManifest, defineAddonServer, getAddonSdkVersion, hasPermission, isCompatibilityRange, sortValue, subject, useAddonInfiniteQuery, useAddonMutation, useAddonQuery, useAddonSDK, useLocale, useQueryClient, useTranslation, validateAddonManifest, verifyAddonEntitlement };