@salesforce/platform-sdk 11.4.7 → 11.6.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.
@@ -7,7 +7,7 @@ export { Surface, getVerifiedSurface, initialize, isSfEmbeddingIframe, resetSurf
7
7
  export type { InitializeOptions } from './surface';
8
8
  export type { SDKOptions } from './options';
9
9
  export type { HostContext, HostStyles, ChatMessage, ChatSDK, ContentBlock, DeviceCapabilities, DisplayMode, ResourceRequest, SafeAreaInsets, SetWidgetStateOptions, ToolCall, ToolState, } from './chat';
10
- export type { AlertOptions, MessageLevel, ModalOptions, ToastOptions, Theme, ThemeMode, ViewSDK, } from './view';
10
+ export type { AlertOptions, MessageLevel, ModalOptions, ToastOptions, Theme, ThemeMode, UiState, UiStyles, ViewSDK, } from './view';
11
11
  export type { CacheControl, DataSDK, DataSDKGraphQL, GraphQLError, GraphQLRawDocument, GraphQLRequest, GraphQLResponse, MutateOptions, MutationResult, QueryOptions, QueryResult, QuerySubscriber, Unsubscribe, } from './data';
12
12
  export type { LightningSDK, LMSMessage, LMSSubscription, MessageChannel } from './lightning';
13
13
  export type { OpenAISDK } from './platforms';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACN,OAAO,EACP,kBAAkB,EAClB,UAAU,EACV,mBAAmB,EACnB,YAAY,GACZ,MAAM,WAAW,CAAC;AACnB,YAAY,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAGnD,YAAY,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAG5C,YAAY,EACX,WAAW,EACX,UAAU,EACV,WAAW,EACX,OAAO,EACP,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,cAAc,EACd,qBAAqB,EACrB,QAAQ,EACR,SAAS,GACT,MAAM,QAAQ,CAAC;AAGhB,YAAY,EACX,YAAY,EACZ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,EACL,SAAS,EACT,OAAO,EACP,QAAQ,EACR,OAAO,GACP,MAAM,QAAQ,CAAC;AAGhB,YAAY,EACX,YAAY,EACZ,OAAO,EACP,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,aAAa,EACb,cAAc,EACd,YAAY,EACZ,WAAW,EACX,eAAe,EACf,WAAW,GACX,MAAM,QAAQ,CAAC;AAGhB,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG7F,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG7C,OAAO,EAAE,wBAAwB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC7E,YAAY,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAGnF,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,YAAY,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAG1D,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC"}
@@ -3,6 +3,34 @@
3
3
  * All rights reserved.
4
4
  * For full license text, see the LICENSE.txt file
5
5
  */
6
+ /**
7
+ * CSS-adjacent styling the host publishes for the embedded surface.
8
+ *
9
+ * `variables` are CSS custom properties (`--*`) read off the host element's inline
10
+ * style; `attributes` are mirrored a11y/i18n/input attributes from the host LWC.
11
+ */
12
+ export interface UiStyles {
13
+ variables?: Record<string, string>;
14
+ attributes?: Record<string, string>;
15
+ }
16
+ /**
17
+ * Host → embedding rendering snapshot exposed to bundles via {@link ViewSDK.getUiState}.
18
+ *
19
+ * `props` are host-configurable inputs (theme, locale, mode, etc.); `styles` are the
20
+ * CSS custom properties and attributes the host wants mirrored onto the surface.
21
+ *
22
+ * Declared locally (not re-exported from `@salesforce/sf-embedding-bridge`) to keep the
23
+ * wire-layer package off the SDK's public type graph; the shape mirrors the bridge's, so
24
+ * surface-side code assigns without a cast.
25
+ *
26
+ * This is the open, fully-permissive shape. A bundle that knows its host contract can
27
+ * declare a narrower type that `extends UiState` (tighter `props`/`styles`) and pass it to
28
+ * {@link ViewSDK.getUiState}'s single type parameter for precise typing.
29
+ */
30
+ export interface UiState {
31
+ props: Record<string, unknown>;
32
+ styles: UiStyles;
33
+ }
6
34
  /**
7
35
  * Theme mode
8
36
  */
@@ -93,6 +121,19 @@ export interface ModalOptions {
93
121
  * alerts, toast notifications, modal dialogs, and managing application state. All methods
94
122
  * are optional and may not be available depending on the runtime surface.
95
123
  *
124
+ * ## Events
125
+ *
126
+ * A ViewSDK is a DOM {@link EventTarget}: the event API is the native
127
+ * `addEventListener` / `removeEventListener` / `dispatchEvent`. On surfaces backed by a
128
+ * host bridge (e.g. the embedded MicroFrontend surface), `dispatchEvent` both notifies
129
+ * local listeners and forwards the event to the host, and events pushed by the host are
130
+ * re-dispatched onto the SDK so `addEventListener` hears them too — one unified stream of
131
+ * host-pushed and same-document events.
132
+ *
133
+ * The `EventTarget` members are declared via {@link Partial} so that surfaces without an
134
+ * event bus (e.g. the WebApp/Mosaic degraded SDK, which is a bare `{}`) still satisfy the
135
+ * type. Feature-detect before use: `viewSDK.dispatchEvent?.(...)`.
136
+ *
96
137
  * @example
97
138
  * ```typescript
98
139
  * const viewSDK = await createViewSDK();
@@ -103,11 +144,17 @@ export interface ModalOptions {
103
144
  * level: 'success'
104
145
  * });
105
146
  *
147
+ * // Listen for events (host-pushed or same-document) and dispatch your own
148
+ * viewSDK.addEventListener?.('user-action', (e) => {
149
+ * console.log('received:', (e as CustomEvent).detail);
150
+ * });
151
+ * viewSDK.dispatchEvent?.(new CustomEvent('user-action', { detail: { action: 'click' } }));
152
+ *
106
153
  * // Mark application as having unsaved changes
107
154
  * await viewSDK.markDirtyState?.();
108
155
  * ```
109
156
  */
110
- export interface ViewSDK {
157
+ export type ViewSDK = Partial<EventTarget> & {
111
158
  /**
112
159
  * Display an alert message in the host environment
113
160
  *
@@ -226,52 +273,50 @@ export interface ViewSDK {
226
273
  */
227
274
  clearDirtyState?(label?: string): Promise<void>;
228
275
  /**
229
- * Dispatch a custom event to the host environment
230
- *
231
- * This allows the application to send custom events with associated data to the
232
- * host. The host can listen for these events and respond accordingly.
276
+ * Get the current host UI state and a `subscribe` function for future changes.
233
277
  *
234
- * @param event - The event name/type to dispatch
235
- * @param data - Associated event data as key-value pairs
236
- * @returns Promise that resolves when the event is dispatched
237
- *
238
- * @example
239
- * ```typescript
240
- * await viewSDK.dispatchEvent?.('user-action', {
241
- * action: 'click',
242
- * buttonId: 'submit',
243
- * timestamp: Date.now()
244
- * });
245
- * ```
246
- */
247
- dispatchEvent?(event: string, data: Record<string, unknown>): Promise<void>;
248
- /**
249
- * Get UI properties from the host and subscribe to changes
278
+ * Returns the latest known snapshot synchronously the underlying wire subscription is
279
+ * opened once, is session-scoped, and is shared across every caller ({@link getTheme} is
280
+ * its synchronous sibling). Call `subscribe` with a handler to be notified on every
281
+ * subsequent host push; `subscribe` returns an `unsubscribe` function that detaches that
282
+ * one handler. Detaching is local fan-out only — the shared wire subscription stays open.
250
283
  *
251
- * Returns an object containing a promise for the initial props and a subscribe
252
- * function to listen for prop updates. UI props allow the host to configure
253
- * the application's appearance or behavior dynamically.
284
+ * The optional `State` type parameter describes the host contract this caller expects:
285
+ * pass a type that `extends UiState` (narrower `props`/`styles`) and both `state` and the
286
+ * `subscribe` handler's argument are typed as it. It defaults to the open {@link UiState},
287
+ * so `getUiState()` with no type argument is the fully-permissive snapshot. `State` is
288
+ * erased at runtime — purely a compile-time convenience, so pin only what the host
289
+ * actually guarantees.
254
290
  *
255
- * @returns Object with props promise and subscribe function
291
+ * @typeParam State - The expected snapshot shape; must extend {@link UiState}.
292
+ * @returns `{ state, subscribe }` — the current snapshot and a subscribe function whose
293
+ * return value is the per-handler `unsubscribe`.
256
294
  *
257
295
  * @example
258
296
  * ```typescript
259
- * const uiProps = viewSDK.getUiProps?.();
260
- *
261
- * // Get initial props
262
- * const initialProps = await uiProps.props;
263
- * console.log('Theme:', initialProps.theme);
264
- *
265
- * // Subscribe to prop changes
266
- * uiProps.subscribe((newProps) => {
267
- * console.log('Props updated:', newProps);
268
- * // Update UI based on new props
269
- * });
297
+ * // Untyped the permissive default.
298
+ * const { state, subscribe } = viewSDK.getUiState?.() ?? {
299
+ * state: { props: {}, styles: {} },
300
+ * subscribe: () => () => {},
301
+ * };
302
+ * applyProps(state.props);
303
+ * const unsubscribe = subscribe((next) => applyProps(next.props));
304
+ * unsubscribe(); // later, when the caller no longer cares
305
+ *
306
+ * // Typed pin the exact snapshot the host guarantees.
307
+ * interface MyUiState extends UiState {
308
+ * props: { theme: "light" | "dark" };
309
+ * styles: { variables?: { "--accent": string } };
310
+ * }
311
+ * const { state } = viewSDK.getUiState?.<MyUiState>() ??
312
+ * { state: { props: { theme: "light" }, styles: {} } };
313
+ * state.props.theme; // "light" | "dark"
314
+ * state.styles.variables?.["--accent"]; // string | undefined
270
315
  * ```
271
316
  */
272
- getUiProps?(): {
273
- props: Promise<Record<string, unknown>>;
274
- subscribe: (callback: (props: Record<string, unknown>) => void) => void;
317
+ getUiState?<State extends UiState = UiState>(): {
318
+ state: State;
319
+ subscribe: (handler: (state: State) => void) => () => void;
275
320
  };
276
321
  /**
277
322
  * Resize the application viewport
@@ -310,5 +355,5 @@ export interface ViewSDK {
310
355
  * ```
311
356
  */
312
357
  getTheme?(): Theme | null;
313
- }
358
+ };
314
359
  //# sourceMappingURL=view.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../src/core/view.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;AAEzC;;GAEG;AACH,MAAM,WAAW,KAAK;IACrB,IAAI,EAAE,SAAS,CAAC;CAChB;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,SAAS,GAAG,SAA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;IACH,eAAe,CAAC,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAyCG;IACH,UAAU,CAAC,CAAC,KAAK,SAAS,OAAO,GAAG,OAAO,KAAK;QAC/C,KAAK,EAAE,KAAK,CAAC;QACb,SAAS,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,KAAK,MAAM,IAAI,CAAC;KAC3D,CAAC;IAEF;;;;;;;;;;;;;;;;;;OAkBG;IACH,MAAM,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtD;;;;;;;;;;;;;;;OAeG;IACH,QAAQ,CAAC,IAAI,KAAK,GAAG,IAAI,CAAC;CAC1B,CAAC"}
@@ -196,7 +196,7 @@ class ie {
196
196
  })).structuredContent;
197
197
  }
198
198
  }
199
- const ce = "X-SFDC-Client-Name", ue = "X-SFDC-Client-Version", he = "@salesforce/platform-sdk", le = "11.4.7", de = (t) => {
199
+ const ce = "X-SFDC-Client-Name", ue = "X-SFDC-Client-Version", he = "@salesforce/platform-sdk", le = "11.6.0", de = (t) => {
200
200
  let e = y(ce, he, t);
201
201
  return e = y(ue, le, e), u(e);
202
202
  }, pe = "X-CSRF-Token";
@@ -1,15 +1,105 @@
1
- import { ViewSDK } from '../core';
1
+ import { UiState, ViewSDK } from '../core';
2
2
  /** Pixel-only dimension string: bare number or `Npx`. The empty string is allowed so a caller can omit one axis. */
3
3
  export type PixelSize = `${number}` | `${number}px` | "";
4
- /** ViewSDK for the sf-embedding surface; wraps bridge wire-layer primitives. */
5
- export declare class EmbeddingViewSDK implements ViewSDK {
4
+ /**
5
+ * ViewSDK for the sf-embedding surface; wraps bridge wire-layer primitives.
6
+ *
7
+ * This SDK **is** a DOM {@link EventTarget}: the public event API is the native
8
+ * `addEventListener` / `removeEventListener` / `dispatchEvent`. Events flow through it in
9
+ * both directions and are unified into a single stream:
10
+ *
11
+ * - **Outbound** — {@link dispatchEvent} both notifies local listeners (via the native
12
+ * {@link EventTarget}) *and* forwards the event to the host over the wire.
13
+ * - **Inbound** — events the host pushes over the wire are re-dispatched onto this
14
+ * `EventTarget`, so `addEventListener` consumers hear host-pushed and same-document
15
+ * events alike.
16
+ *
17
+ * The wire is host-trusted; same-document dispatches are not. Consumers that must trust
18
+ * the origin of an event should validate its payload rather than assume it came from the
19
+ * host.
20
+ */
21
+ export declare class EmbeddingViewSDK extends EventTarget implements ViewSDK {
6
22
  private readonly session;
7
23
  static create(): Promise<EmbeddingViewSDK>;
24
+ private currentUiState;
25
+ private readonly uiStateListeners;
8
26
  private constructor();
27
+ /**
28
+ * Dispatch a custom event.
29
+ *
30
+ * Overrides {@link EventTarget.dispatchEvent} to be symmetric across both channels an
31
+ * embedded bundle can reach: it forwards the event to the host over the wire **and**
32
+ * notifies local listeners on this `EventTarget`. A {@link CustomEvent}'s `detail` is
33
+ * the payload sent to the host; a plain `Event` (no `detail`) is delivered to local
34
+ * listeners only, since there is nothing to carry over the wire.
35
+ *
36
+ * A bundle's own dispatch reaches its own listeners exactly once — synchronously, here
37
+ * — and is not echoed back: the host does not relay a bundle's own dispatch down the
38
+ * wire to the originating iframe (inbound re-dispatch goes through `super.dispatchEvent`,
39
+ * never back out through this override).
40
+ *
41
+ * @param event - The event to dispatch. Use a {@link CustomEvent} to carry a payload.
42
+ * @returns `false` if the event is cancelable and a listener called `preventDefault()`,
43
+ * otherwise `true` (native {@link EventTarget} semantics).
44
+ */
45
+ dispatchEvent(event: Event): boolean;
46
+ /**
47
+ * Get the current host UI state and a `subscribe` function for future changes.
48
+ *
49
+ * The snapshot is fetched once at {@link EmbeddingViewSDK.create} and refreshed on every
50
+ * host push, so this returns synchronously. `subscribe(handler)` registers the handler for
51
+ * every subsequent push and returns an `unsubscribe` that detaches just that handler; the
52
+ * underlying wire subscription is session-scoped and shared, so detaching is a local
53
+ * `Set.delete`, not a wire teardown.
54
+ *
55
+ * The optional `State` type parameter narrows `state` and the `subscribe` handler for this
56
+ * caller; it is erased at runtime, so the stored snapshot and listeners are the open-shaped
57
+ * {@link UiState} and the narrowed handler is adapted to that at the boundary.
58
+ *
59
+ * @returns `{ state, subscribe }` — the latest cached snapshot and a subscribe function
60
+ * whose return value is the per-handler `unsubscribe`.
61
+ */
62
+ getUiState<State extends UiState = UiState>(): {
63
+ state: State;
64
+ subscribe: (handler: (state: State) => void) => () => void;
65
+ };
9
66
  markDirtyState(label?: string): Promise<void>;
10
67
  clearDirtyState(label?: string): Promise<void>;
11
68
  /** Resize the embedded surface. Pass `""` for either axis to leave it unchanged; both empty is a no-op. */
12
69
  resize(width: PixelSize, height: PixelSize): Promise<void>;
70
+ /**
71
+ * Send an event to the host over the wire. Private wire-layer plumbing; the public
72
+ * entry point is {@link dispatchEvent}, which calls this in addition to notifying
73
+ * local listeners.
74
+ */
75
+ private dispatchHostEvent;
76
+ /**
77
+ * Open the host's event stream and pipe inbound host-pushed events onto this
78
+ * `EventTarget`, so `addEventListener` consumers hear them alongside same-document
79
+ * dispatches. Private wire-layer plumbing, opened once per session — the bridge
80
+ * delivers a single stream and per-type fan-out is the native `EventTarget`'s job
81
+ * ("one subscription per session").
82
+ *
83
+ * Inbound events are re-dispatched through `super.dispatchEvent`, not the
84
+ * {@link dispatchEvent} override, so a host push notifies local listeners without
85
+ * being echoed straight back up the wire.
86
+ *
87
+ * Best-effort: if the subscription cannot be opened, inbound host events simply do not
88
+ * arrive; outbound {@link dispatchEvent} and every other method still work. The wire is
89
+ * not explicitly torn down — it lives for the session and is released when the bridge
90
+ * is disposed.
91
+ */
92
+ private subscribeToHostEvent;
93
+ /**
94
+ * Open the host's ui-state stream once per session and cache the initial snapshot,
95
+ * then fan out every subsequent push to registered listeners. Private wire-layer
96
+ * plumbing — the public entry point is {@link getUiState}.
97
+ *
98
+ * Best-effort, mirroring {@link subscribeToHostEvent}: if the subscription cannot be
99
+ * opened, {@link getUiState} still returns a usable (empty) snapshot and every other
100
+ * method continues to work. The wire is not explicitly torn down.
101
+ */
102
+ private subscribeToUiState;
13
103
  private setDirty;
14
104
  }
15
105
  //# sourceMappingURL=embedding.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"embedding.d.ts","sourceRoot":"","sources":["../../src/view/embedding.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAMvC,oHAAoH;AACpH,MAAM,MAAM,SAAS,GAAG,GAAG,MAAM,EAAE,GAAG,GAAG,MAAM,IAAI,GAAG,EAAE,CAAC;AAEzD,gFAAgF;AAChF,qBAAa,gBAAiB,YAAW,OAAO;IAM3B,OAAO,CAAC,QAAQ,CAAC,OAAO;WAL/B,MAAM,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAKhD,OAAO;IAED,cAAc,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI7C,eAAe,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIpD,2GAA2G;IACrG,MAAM,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAYhE,OAAO,CAAC,QAAQ;CAOhB"}
1
+ {"version":3,"file":"embedding.d.ts","sourceRoot":"","sources":["../../src/view/embedding.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAMhD,oHAAoH;AACpH,MAAM,MAAM,SAAS,GAAG,GAAG,MAAM,EAAE,GAAG,GAAG,MAAM,IAAI,GAAG,EAAE,CAAC;AAEzD;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,gBAAiB,SAAQ,WAAY,YAAW,OAAO;IAa/C,OAAO,CAAC,QAAQ,CAAC,OAAO;WAZ/B,MAAM,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAShD,OAAO,CAAC,cAAc,CAAsC;IAC5D,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAuC;IAExE,OAAO;IAIP;;;;;;;;;;;;;;;;;OAiBG;IACM,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO;IA0B7C;;;;;;;;;;;;;;;OAeG;IACH,UAAU,CAAC,KAAK,SAAS,OAAO,GAAG,OAAO,KAAK;QAC9C,KAAK,EAAE,KAAK,CAAC;QACb,SAAS,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,KAAK,MAAM,IAAI,CAAC;KAC3D;IAeK,cAAc,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI7C,eAAe,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIpD,2GAA2G;IACrG,MAAM,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAYhE;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IAQzB;;;;;;;;;;;;;;;OAeG;YACW,oBAAoB;IAyBlC;;;;;;;;OAQG;YACW,kBAAkB;IAiBhC,OAAO,CAAC,QAAQ;CAOhB"}
@@ -25,5 +25,5 @@ export interface ViewSDKOptions extends SDKOptions {
25
25
  export declare function createViewSDK(options?: ViewSDKOptions): Promise<ViewSDK>;
26
26
  export { MCPAppsViewSDK } from './mcpapps';
27
27
  export { getViewSDK, getViewSDKSync, resetViewSDK } from './singleton';
28
- export type { AlertOptions, ModalOptions, SDKOptions, Theme, ThemeMode, ToastOptions, ViewSDK, } from '../core';
28
+ export type { AlertOptions, ModalOptions, SDKOptions, Theme, ThemeMode, ToastOptions, UiState, UiStyles, ViewSDK, } from '../core';
29
29
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/view/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAKnD;;;;;;GAMG;AAEH,MAAM,WAAW,cAAe,SAAQ,UAAU;CAAG;AAErD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,CAgCxE;AAED,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEvE,YAAY,EACX,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,KAAK,EACL,SAAS,EACT,YAAY,EACZ,OAAO,GACP,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/view/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAKnD;;;;;;GAMG;AAEH,MAAM,WAAW,cAAe,SAAQ,UAAU;CAAG;AAErD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,CAgCxE;AAED,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEvE,YAAY,EACX,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,KAAK,EACL,SAAS,EACT,YAAY,EACZ,OAAO,EACP,QAAQ,EACR,OAAO,GACP,MAAM,SAAS,CAAC"}
@@ -1,8 +1,8 @@
1
- import { g as w, S as a, a as h } from "../surface-Dd2tqrPi.js";
2
- import { w as m } from "../sdk-promise-D0sy7OW1.js";
3
- import { requireSharedSession as f } from "../sf-embedding/index.js";
4
- function p(n) {
5
- switch (n) {
1
+ import { g as h, S as n, a as w } from "../surface-Dd2tqrPi.js";
2
+ import { w as p } from "../sdk-promise-D0sy7OW1.js";
3
+ import { requireSharedSession as m } from "../sf-embedding/index.js";
4
+ function f(i) {
5
+ switch (i) {
6
6
  case "info":
7
7
  return "ℹ️";
8
8
  case "success":
@@ -15,33 +15,98 @@ function p(n) {
15
15
  return "ℹ️";
16
16
  }
17
17
  }
18
- function u(n, e) {
19
- return `${p(e)} ${n}`;
18
+ function u(i, e) {
19
+ return `${f(e)} ${i}`;
20
20
  }
21
- function o(n, e) {
22
- const t = n.trim();
23
- if (t === "")
21
+ function o(i, e) {
22
+ const s = i.trim();
23
+ if (s === "")
24
24
  return { success: !0, value: void 0 };
25
- const s = t.match(/^(\d+(?:\.\d+)?)(px)?$/);
26
- if (!s || !s[1])
25
+ const t = s.match(/^(\d+(?:\.\d+)?)(px)?$/);
26
+ if (!t || !t[1])
27
27
  return {
28
28
  success: !1,
29
- error: `Invalid ${e}: "${n}". Only pixel values are supported (e.g., "800px" or "800").`
29
+ error: `Invalid ${e}: "${i}". Only pixel values are supported (e.g., "800px" or "800").`
30
30
  };
31
- const r = parseFloat(s[1]);
31
+ const r = parseFloat(t[1]);
32
32
  return r < 0 || !isFinite(r) ? {
33
33
  success: !1,
34
- error: `Invalid ${e}: "${n}". Value must be a positive number.`
34
+ error: `Invalid ${e}: "${i}". Value must be a positive number.`
35
35
  } : { success: !0, value: r };
36
36
  }
37
- const g = "trackdirtystate";
38
- class l {
37
+ const b = "trackdirtystate";
38
+ class l extends EventTarget {
39
39
  constructor(e) {
40
- this.session = e;
40
+ super(), this.session = e;
41
41
  }
42
42
  static async create() {
43
- const e = await f("EmbeddingViewSDK");
44
- return new l(e);
43
+ const e = await m("EmbeddingViewSDK"), s = new l(e);
44
+ return await Promise.all([s.subscribeToHostEvent(), s.subscribeToUiState()]), s;
45
+ }
46
+ // Latest snapshot, refreshed on every host push. Session-scoped — the wire subscription
47
+ // is opened once at create() and never torn down.
48
+ currentUiState = { props: {}, styles: {} };
49
+ uiStateListeners = /* @__PURE__ */ new Set();
50
+ /**
51
+ * Dispatch a custom event.
52
+ *
53
+ * Overrides {@link EventTarget.dispatchEvent} to be symmetric across both channels an
54
+ * embedded bundle can reach: it forwards the event to the host over the wire **and**
55
+ * notifies local listeners on this `EventTarget`. A {@link CustomEvent}'s `detail` is
56
+ * the payload sent to the host; a plain `Event` (no `detail`) is delivered to local
57
+ * listeners only, since there is nothing to carry over the wire.
58
+ *
59
+ * A bundle's own dispatch reaches its own listeners exactly once — synchronously, here
60
+ * — and is not echoed back: the host does not relay a bundle's own dispatch down the
61
+ * wire to the originating iframe (inbound re-dispatch goes through `super.dispatchEvent`,
62
+ * never back out through this override).
63
+ *
64
+ * @param event - The event to dispatch. Use a {@link CustomEvent} to carry a payload.
65
+ * @returns `false` if the event is cancelable and a listener called `preventDefault()`,
66
+ * otherwise `true` (native {@link EventTarget} semantics).
67
+ */
68
+ dispatchEvent(e) {
69
+ if (e instanceof CustomEvent)
70
+ try {
71
+ this.dispatchHostEvent(e.type, e.detail, {
72
+ bubbles: e.bubbles,
73
+ composed: e.composed,
74
+ cancelable: e.cancelable
75
+ });
76
+ } catch (s) {
77
+ console.warn(
78
+ `[EmbeddingViewSDK] wire dispatch failed for "${e.type}"; local listeners will still fire`,
79
+ s
80
+ );
81
+ }
82
+ return super.dispatchEvent(e);
83
+ }
84
+ /**
85
+ * Get the current host UI state and a `subscribe` function for future changes.
86
+ *
87
+ * The snapshot is fetched once at {@link EmbeddingViewSDK.create} and refreshed on every
88
+ * host push, so this returns synchronously. `subscribe(handler)` registers the handler for
89
+ * every subsequent push and returns an `unsubscribe` that detaches just that handler; the
90
+ * underlying wire subscription is session-scoped and shared, so detaching is a local
91
+ * `Set.delete`, not a wire teardown.
92
+ *
93
+ * The optional `State` type parameter narrows `state` and the `subscribe` handler for this
94
+ * caller; it is erased at runtime, so the stored snapshot and listeners are the open-shaped
95
+ * {@link UiState} and the narrowed handler is adapted to that at the boundary.
96
+ *
97
+ * @returns `{ state, subscribe }` — the latest cached snapshot and a subscribe function
98
+ * whose return value is the per-handler `unsubscribe`.
99
+ */
100
+ getUiState() {
101
+ return {
102
+ state: this.currentUiState,
103
+ subscribe: (e) => {
104
+ const s = e;
105
+ return this.uiStateListeners.add(s), () => {
106
+ this.uiStateListeners.delete(s);
107
+ };
108
+ }
109
+ };
45
110
  }
46
111
  async markDirtyState(e) {
47
112
  this.setDirty(!0, e);
@@ -50,25 +115,95 @@ class l {
50
115
  this.setDirty(!1, e);
51
116
  }
52
117
  /** Resize the embedded surface. Pass `""` for either axis to leave it unchanged; both empty is a no-op. */
53
- async resize(e, t) {
54
- const s = o(e, "width");
55
- if (!s.success) throw new Error(s.error);
56
- const r = o(t, "height");
118
+ async resize(e, s) {
119
+ const t = o(e, "width");
120
+ if (!t.success) throw new Error(t.error);
121
+ const r = o(s, "height");
57
122
  if (!r.success) throw new Error(r.error);
58
- s.value === void 0 && r.value === void 0 || this.session.bridge.sendResize({
59
- ...s.value !== void 0 ? { width: s.value } : {},
123
+ t.value === void 0 && r.value === void 0 || this.session.bridge.sendResize({
124
+ ...t.value !== void 0 ? { width: t.value } : {},
60
125
  ...r.value !== void 0 ? { height: r.value } : {}
61
126
  });
62
127
  }
63
- setDirty(e, t) {
64
- this.session.bridge.sendEventDispatch(g, {
128
+ /**
129
+ * Send an event to the host over the wire. Private wire-layer plumbing; the public
130
+ * entry point is {@link dispatchEvent}, which calls this in addition to notifying
131
+ * local listeners.
132
+ */
133
+ dispatchHostEvent(e, s, t) {
134
+ this.session.bridge.sendEventDispatch(e, s, t);
135
+ }
136
+ /**
137
+ * Open the host's event stream and pipe inbound host-pushed events onto this
138
+ * `EventTarget`, so `addEventListener` consumers hear them alongside same-document
139
+ * dispatches. Private wire-layer plumbing, opened once per session — the bridge
140
+ * delivers a single stream and per-type fan-out is the native `EventTarget`'s job
141
+ * ("one subscription per session").
142
+ *
143
+ * Inbound events are re-dispatched through `super.dispatchEvent`, not the
144
+ * {@link dispatchEvent} override, so a host push notifies local listeners without
145
+ * being echoed straight back up the wire.
146
+ *
147
+ * Best-effort: if the subscription cannot be opened, inbound host events simply do not
148
+ * arrive; outbound {@link dispatchEvent} and every other method still work. The wire is
149
+ * not explicitly torn down — it lives for the session and is released when the bridge
150
+ * is disposed.
151
+ */
152
+ async subscribeToHostEvent() {
153
+ const e = this.session.bridge;
154
+ e.onEventDispatch((s) => {
155
+ super.dispatchEvent(
156
+ new CustomEvent(s.eventType, {
157
+ detail: s.detail,
158
+ bubbles: s.bubbles ?? !0,
159
+ composed: s.composed ?? !0,
160
+ cancelable: s.cancelable ?? !1
161
+ })
162
+ );
163
+ });
164
+ try {
165
+ await e.sendEventSubscribe();
166
+ } catch (s) {
167
+ console.warn(
168
+ "[EmbeddingViewSDK] host event subscription failed; inbound host events will not be delivered",
169
+ s
170
+ );
171
+ }
172
+ }
173
+ /**
174
+ * Open the host's ui-state stream once per session and cache the initial snapshot,
175
+ * then fan out every subsequent push to registered listeners. Private wire-layer
176
+ * plumbing — the public entry point is {@link getUiState}.
177
+ *
178
+ * Best-effort, mirroring {@link subscribeToHostEvent}: if the subscription cannot be
179
+ * opened, {@link getUiState} still returns a usable (empty) snapshot and every other
180
+ * method continues to work. The wire is not explicitly torn down.
181
+ */
182
+ async subscribeToUiState() {
183
+ const e = this.session.bridge;
184
+ e.onUiStateChanged((s) => {
185
+ this.currentUiState = s.current;
186
+ for (const t of this.uiStateListeners) t(s.current);
187
+ });
188
+ try {
189
+ const { current: s } = await e.sendUiStateSubscribe();
190
+ this.currentUiState = s;
191
+ } catch (s) {
192
+ console.warn(
193
+ "[EmbeddingViewSDK] ui-state subscription failed; getUiState will return an empty snapshot",
194
+ s
195
+ );
196
+ }
197
+ }
198
+ setDirty(e, s) {
199
+ this.session.bridge.sendEventDispatch(b, {
65
200
  isDirty: e,
66
201
  instanceId: this.session.hostMetaData.instanceId,
67
- label: t ?? ""
202
+ label: s ?? ""
68
203
  });
69
204
  }
70
205
  }
71
- class v {
206
+ class g {
72
207
  constructor(e) {
73
208
  this.session = e;
74
209
  }
@@ -77,14 +212,14 @@ class v {
77
212
  * @param message - The message text
78
213
  * @param level - The message severity level (defaults to "info")
79
214
  */
80
- async sendMessage(e, t = "info") {
81
- const s = u(e, t);
215
+ async sendMessage(e, s = "info") {
216
+ const t = u(e, s);
82
217
  await this.session.request("ui/message", {
83
218
  role: "user",
84
219
  content: [
85
220
  {
86
221
  type: "text",
87
- text: s
222
+ text: t
88
223
  }
89
224
  ]
90
225
  });
@@ -102,25 +237,25 @@ class v {
102
237
  const e = this.session.getHostContext().theme;
103
238
  return e ? { mode: e } : null;
104
239
  }
105
- async resize(e, t) {
106
- const s = o(e, "width");
107
- if (!s.success)
108
- return Promise.reject(new Error(s.error));
109
- const r = o(t, "height");
240
+ async resize(e, s) {
241
+ const t = o(e, "width");
242
+ if (!t.success)
243
+ return Promise.reject(new Error(t.error));
244
+ const r = o(s, "height");
110
245
  if (!r.success)
111
246
  return Promise.reject(new Error(r.error));
112
247
  const c = {};
113
- return s.value !== void 0 && (c.width = s.value), r.value !== void 0 && (c.height = r.value), this.session.sendNotification("ui/notifications/size-changed", c), Promise.resolve();
248
+ return t.value !== void 0 && (c.width = t.value), r.value !== void 0 && (c.height = r.value), this.session.sendNotification("ui/notifications/size-changed", c), Promise.resolve();
114
249
  }
115
250
  }
116
- class y {
251
+ class v {
117
252
  async displayAlert(e) {
118
- const t = e.level || "info", s = u(e.message, t);
119
- await window.openai.sendFollowUpMessage({ prompt: s });
253
+ const s = e.level || "info", t = u(e.message, s);
254
+ await window.openai.sendFollowUpMessage({ prompt: t });
120
255
  }
121
256
  async displayToast(e) {
122
- const t = e.level || "info", s = u(e.message, t);
123
- await window.openai.sendFollowUpMessage({ prompt: s });
257
+ const s = e.level || "info", t = u(e.message, s);
258
+ await window.openai.sendFollowUpMessage({ prompt: t });
124
259
  }
125
260
  async displayModal(e) {
126
261
  await window.openai.requestModal({
@@ -133,31 +268,31 @@ class y {
133
268
  return e ? { mode: e } : null;
134
269
  }
135
270
  }
136
- let i = null, d = null;
137
- function A(n) {
138
- return i || (i = S(n).then((e) => (d = e, e))), i;
271
+ let a = null, d = null;
272
+ function M(i) {
273
+ return a || (a = y(i).then((e) => (d = e, e))), a;
139
274
  }
140
- function E() {
275
+ function T() {
141
276
  return d;
142
277
  }
143
- function I() {
144
- i = null, d = null;
278
+ function V() {
279
+ a = null, d = null;
145
280
  }
146
- function S(n) {
147
- return m(
281
+ function y(i) {
282
+ return p(
148
283
  (async () => {
149
284
  try {
150
- switch (await w(n?.surface)) {
151
- case a.OpenAI:
152
- return new y();
153
- case a.WebApp:
154
- case a.Mosaic:
285
+ switch (await h(i?.surface)) {
286
+ case n.OpenAI:
287
+ return new v();
288
+ case n.WebApp:
289
+ case n.Mosaic:
155
290
  return {};
156
- case a.MicroFrontend:
291
+ case n.MicroFrontend:
157
292
  return await l.create();
158
- case a.MCPApps: {
159
- const t = await h.getInstance();
160
- return new v(t);
293
+ case n.MCPApps: {
294
+ const s = await w.getInstance();
295
+ return new g(s);
161
296
  }
162
297
  default:
163
298
  return {};
@@ -170,9 +305,9 @@ function S(n) {
170
305
  );
171
306
  }
172
307
  export {
173
- v as MCPAppsViewSDK,
174
- S as createViewSDK,
175
- A as getViewSDK,
176
- E as getViewSDKSync,
177
- I as resetViewSDK
308
+ g as MCPAppsViewSDK,
309
+ y as createViewSDK,
310
+ M as getViewSDK,
311
+ T as getViewSDKSync,
312
+ V as resetViewSDK
178
313
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/platform-sdk",
3
- "version": "11.4.7",
3
+ "version": "11.6.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -115,7 +115,7 @@
115
115
  "@conduit-client/service-pubsub": "3.19.6",
116
116
  "@conduit-client/service-retry": "3.19.6",
117
117
  "@conduit-client/utils": "3.19.6",
118
- "@salesforce/jsonrpc": "^11.4.7",
118
+ "@salesforce/jsonrpc": "^11.6.0",
119
119
  "@salesforce/sf-embedding-bridge": "2.2.4-rc.1"
120
120
  },
121
121
  "peerDependencies": {