saasco-sdk 0.2.4 → 0.2.5

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.
@@ -25,9 +25,6 @@ declare function initEmbedBridge(options: {
25
25
  allowedOrigins: string[];
26
26
  }): void;
27
27
 
28
- /** Snapshot of host-app state appended to the agent's system prompt each turn. */
29
- declare function setStateSnapshot(snapshot: unknown): void;
30
-
31
28
  /**
32
29
  * Public types for the embeddable support widget. These restate the
33
30
  * server wire contracts (`libs/support/shared` / `libs/chat/shared`) locally
@@ -59,7 +56,7 @@ type JSONSchema7Object = {
59
56
  * marked `destructive` pause for an explicit Approve/Reject before running.
60
57
  */
61
58
  type SupportTool = {
62
- /** Shown to the model; 1–2000 chars. */
59
+ /** Shown to the model. Active tools require a non-empty description. */
63
60
  description: string;
64
61
  /** Pauses for an explicit Approve/Reject before running. */
65
62
  destructive?: boolean;
@@ -105,6 +102,8 @@ type WidgetConfig = {
105
102
  /** Input placeholder. */
106
103
  placeholder?: string;
107
104
  projectId: string;
105
+ /** Dashboard / embed preview: open the panel on mount. */
106
+ startOpen?: boolean;
108
107
  /** Canned prompts offered before the first message. */
109
108
  suggestions?: SupportSuggestion[];
110
109
  };
@@ -151,6 +150,18 @@ type SupportConversation = {
151
150
  state: "open" | "closed" | "snoozed";
152
151
  };
153
152
 
153
+ /**
154
+ * Iframe-side state store with subscribe/notify (same pattern as the internal
155
+ * AgentContext). In the cross-origin embed the widget UI runs inside the Saasco
156
+ * `/embed/support` iframe; the host page's loader pushes identity, the
157
+ * signed JWT, host-state snapshots, the host viewport and open/close commands
158
+ * over `postMessage`, and the embed bridge writes them here so the live widget
159
+ * (subscribed via `useSyncExternalStore`) picks them up without a reboot.
160
+ */
161
+
162
+ /** Snapshot of host-app state appended to the agent's system prompt each turn. */
163
+ declare function setStateSnapshot(snapshot: unknown): void;
164
+
154
165
  /**
155
166
  * Embeddable customer-facing support for third-party apps — an
156
167
  * Intercom-style messenger (Home + Messages tabs, branded workspace rows, a
@@ -166,18 +177,18 @@ type SupportConversation = {
166
177
  * into the open chat by polling the conversation endpoint, and
167
178
  * - once a human takes the conversation over the agent stream is muted, the
168
179
  * customer sees a handoff acknowledgment, a "Waiting for a teammate" indicator
169
- * until someone replies, then "{name} has joined the conversation" above the
170
- * first team message.
180
+ * while they are waiting on a reply (open, customer last), then "{name} has
181
+ * joined the conversation" above the first team message.
171
182
  *
172
183
  * The per-conversation session token (and the captured email) are persisted in
173
184
  * the Saasco iframe-origin `localStorage` so anonymous threads survive reloads
174
- * (best-effort — Safari/strict-Firefox partition third-party storage; identified
175
- * users resume server-side via the JWT instead). This component is the iframe
185
+ * (best-effort — Safari/strict-Firefox partition third-party storage;
186
+ * identified users resume server-side). This component is the iframe
176
187
  * app entry: it renders directly into the `/embed/support` page (no host-
177
188
  * realm blank-iframe wrapper), and the host integrates over the postMessage
178
189
  * bridge — identity, JWT, state snapshots, viewport and open/close all arrive
179
190
  * through {@link initEmbedBridge} and are read here from the registry.
180
191
  */
181
- declare function SupportWidgetInner({ baseUrl, getStateSnapshot, placeholder, projectId, suggestions, }: WidgetConfig): React.ReactElement;
192
+ declare function SupportWidgetInner({ baseUrl, getStateSnapshot, placeholder, projectId, startOpen, suggestions, }: WidgetConfig): React.ReactElement;
182
193
 
183
194
  export { type JSONSchema7Object, type SupportConversation, type SupportConversationMessage, type SupportSession, type SupportSuggestion, type SupportTool, SupportWidgetInner, type WidgetConfig, initEmbedBridge, setStateSnapshot };
package/dist/support.d.ts CHANGED
@@ -25,9 +25,6 @@ declare function initEmbedBridge(options: {
25
25
  allowedOrigins: string[];
26
26
  }): void;
27
27
 
28
- /** Snapshot of host-app state appended to the agent's system prompt each turn. */
29
- declare function setStateSnapshot(snapshot: unknown): void;
30
-
31
28
  /**
32
29
  * Public types for the embeddable support widget. These restate the
33
30
  * server wire contracts (`libs/support/shared` / `libs/chat/shared`) locally
@@ -59,7 +56,7 @@ type JSONSchema7Object = {
59
56
  * marked `destructive` pause for an explicit Approve/Reject before running.
60
57
  */
61
58
  type SupportTool = {
62
- /** Shown to the model; 1–2000 chars. */
59
+ /** Shown to the model. Active tools require a non-empty description. */
63
60
  description: string;
64
61
  /** Pauses for an explicit Approve/Reject before running. */
65
62
  destructive?: boolean;
@@ -105,6 +102,8 @@ type WidgetConfig = {
105
102
  /** Input placeholder. */
106
103
  placeholder?: string;
107
104
  projectId: string;
105
+ /** Dashboard / embed preview: open the panel on mount. */
106
+ startOpen?: boolean;
108
107
  /** Canned prompts offered before the first message. */
109
108
  suggestions?: SupportSuggestion[];
110
109
  };
@@ -151,6 +150,18 @@ type SupportConversation = {
151
150
  state: "open" | "closed" | "snoozed";
152
151
  };
153
152
 
153
+ /**
154
+ * Iframe-side state store with subscribe/notify (same pattern as the internal
155
+ * AgentContext). In the cross-origin embed the widget UI runs inside the Saasco
156
+ * `/embed/support` iframe; the host page's loader pushes identity, the
157
+ * signed JWT, host-state snapshots, the host viewport and open/close commands
158
+ * over `postMessage`, and the embed bridge writes them here so the live widget
159
+ * (subscribed via `useSyncExternalStore`) picks them up without a reboot.
160
+ */
161
+
162
+ /** Snapshot of host-app state appended to the agent's system prompt each turn. */
163
+ declare function setStateSnapshot(snapshot: unknown): void;
164
+
154
165
  /**
155
166
  * Embeddable customer-facing support for third-party apps — an
156
167
  * Intercom-style messenger (Home + Messages tabs, branded workspace rows, a
@@ -166,18 +177,18 @@ type SupportConversation = {
166
177
  * into the open chat by polling the conversation endpoint, and
167
178
  * - once a human takes the conversation over the agent stream is muted, the
168
179
  * customer sees a handoff acknowledgment, a "Waiting for a teammate" indicator
169
- * until someone replies, then "{name} has joined the conversation" above the
170
- * first team message.
180
+ * while they are waiting on a reply (open, customer last), then "{name} has
181
+ * joined the conversation" above the first team message.
171
182
  *
172
183
  * The per-conversation session token (and the captured email) are persisted in
173
184
  * the Saasco iframe-origin `localStorage` so anonymous threads survive reloads
174
- * (best-effort — Safari/strict-Firefox partition third-party storage; identified
175
- * users resume server-side via the JWT instead). This component is the iframe
185
+ * (best-effort — Safari/strict-Firefox partition third-party storage;
186
+ * identified users resume server-side). This component is the iframe
176
187
  * app entry: it renders directly into the `/embed/support` page (no host-
177
188
  * realm blank-iframe wrapper), and the host integrates over the postMessage
178
189
  * bridge — identity, JWT, state snapshots, viewport and open/close all arrive
179
190
  * through {@link initEmbedBridge} and are read here from the registry.
180
191
  */
181
- declare function SupportWidgetInner({ baseUrl, getStateSnapshot, placeholder, projectId, suggestions, }: WidgetConfig): React.ReactElement;
192
+ declare function SupportWidgetInner({ baseUrl, getStateSnapshot, placeholder, projectId, startOpen, suggestions, }: WidgetConfig): React.ReactElement;
182
193
 
183
194
  export { type JSONSchema7Object, type SupportConversation, type SupportConversationMessage, type SupportSession, type SupportSuggestion, type SupportTool, SupportWidgetInner, type WidgetConfig, initEmbedBridge, setStateSnapshot };