@stackable-labs/cli-app-extension 2.29.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/dist/index.js +7 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -155,7 +155,7 @@ var TEMPLATE_FLAVOR_META = {
|
|
|
155
155
|
};
|
|
156
156
|
var TARGET_PERMISSION_MAP = {
|
|
157
157
|
[SURFACE_TARGET.HEADER]: ["context:read"],
|
|
158
|
-
[SURFACE_TARGET.CONTENT]: ["context:read", "data:query", "data:fetch", "actions:toast", "actions:invoke"],
|
|
158
|
+
[SURFACE_TARGET.CONTENT]: ["context:read", "data:query", "data:fetch", "actions:toast", "actions:invoke", "messaging:send"],
|
|
159
159
|
[SURFACE_TARGET.FOOTER]: [],
|
|
160
160
|
[SURFACE_TARGET.FOOTER_LINKS]: []
|
|
161
161
|
};
|
|
@@ -2105,6 +2105,7 @@ var rewritePreviewApp = async (rootDir, targets, permissions) => {
|
|
|
2105
2105
|
const includeToast = permissions.includes("actions:toast");
|
|
2106
2106
|
const includeInvoke = permissions.includes("actions:invoke");
|
|
2107
2107
|
const includeContextRead = permissions.includes("context:read");
|
|
2108
|
+
const includeMessagingSend = permissions.includes("messaging:send");
|
|
2108
2109
|
const typeImports = [
|
|
2109
2110
|
"ExtensionRegistryEntry",
|
|
2110
2111
|
"Permission",
|
|
@@ -2112,7 +2113,8 @@ var rewritePreviewApp = async (rootDir, targets, permissions) => {
|
|
|
2112
2113
|
"FetchResponse",
|
|
2113
2114
|
includeInvoke ? "ActionInvokePayload" : "",
|
|
2114
2115
|
includeDataQuery ? "ApiRequest" : "",
|
|
2115
|
-
includeToast ? "ToastPayload" : ""
|
|
2116
|
+
includeToast ? "ToastPayload" : "",
|
|
2117
|
+
includeMessagingSend ? "SendMessagePayload" : ""
|
|
2116
2118
|
].filter(Boolean);
|
|
2117
2119
|
const handlers = [];
|
|
2118
2120
|
handlers.push(" 'data.fetch': async (_extensionId: string, payload: FetchRequest): Promise<FetchResponse> => {\n const response = await fetch(payload.url, {\n method: payload.method ?? 'GET',\n headers: payload.headers,\n ...(payload.body !== undefined ? { body: JSON.stringify(payload.body) } : {}),\n })\n const text = await response.text()\n let data: unknown = null\n try {\n data = text ? JSON.parse(text) : null\n } catch {\n data = text\n }\n\n return {\n status: response.status,\n ok: response.ok,\n data,\n }\n },");
|
|
@@ -2128,6 +2130,9 @@ var rewritePreviewApp = async (rootDir, targets, permissions) => {
|
|
|
2128
2130
|
if (includeContextRead) {
|
|
2129
2131
|
handlers.push(" 'context.read': async () => mockContext,");
|
|
2130
2132
|
}
|
|
2133
|
+
if (includeMessagingSend) {
|
|
2134
|
+
handlers.push(" 'messaging.send': async (_extensionId: string, payload: SendMessagePayload) => {\n console.log('[Preview] messaging.send:', payload)\n return { messageId: `preview_msg_${Date.now()}` }\n },");
|
|
2135
|
+
}
|
|
2131
2136
|
const appContent = `import { ExtensionProvider, ExtensionSlot } from '@stackable-labs/sdk-extension-host'
|
|
2132
2137
|
import type { CapabilityHandlers } from '@stackable-labs/sdk-extension-host'
|
|
2133
2138
|
import hostComponents from '@stackable-labs/embeddables/components'
|