@nominalso/vibe-host 0.3.0 → 0.4.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.cjs CHANGED
@@ -27,7 +27,7 @@ __export(index_exports, {
27
27
  module.exports = __toCommonJS(index_exports);
28
28
 
29
29
  // package.json
30
- var version = "0.3.0";
30
+ var version = "0.4.0";
31
31
 
32
32
  // ../protocol-types/dist/index.js
33
33
  function normalizeSubroute(subroute) {
package/dist/index.d.cts CHANGED
@@ -3180,6 +3180,54 @@ interface BridgeSubsidiary {
3180
3180
  id: number;
3181
3181
  displayName: string;
3182
3182
  }
3183
+ /**
3184
+ * PostHog configuration the host supplies so the iframe can record a session
3185
+ * replay (stitched into the host's recording via `recordCrossOriginIframes`)
3186
+ * and emit custom events, all attributed to the **same PostHog person** as
3187
+ * nom-ui.
3188
+ *
3189
+ * The host (nom-ui) is the single source of truth for these values — it knows
3190
+ * the project key, the env-aware ingestion host, and the resolved person — and
3191
+ * delivers them over the bridge so the iframe never hardcodes any of it. When
3192
+ * the host omits the {@link ContextPayload.posthog} block entirely (older host,
3193
+ * or recording disabled for this env/app), the bridge initializes nothing.
3194
+ */
3195
+ interface PostHogContext {
3196
+ /** Project API key — the same PostHog project the host (nom-ui) uses. */
3197
+ token: string;
3198
+ /**
3199
+ * **Absolute** ingestion host, e.g. `"https://us.i.posthog.com"`.
3200
+ *
3201
+ * Must NOT be the host's relative `/ingest` reverse-proxy path: a relative
3202
+ * path resolves against the iframe's *own* (cross-origin) host and 404s.
3203
+ */
3204
+ apiHost: string;
3205
+ /**
3206
+ * Host-resolved PostHog distinct id. The bridge calls `identify()` with it so
3207
+ * the iframe's recording and events attribute to the same person as the host.
3208
+ */
3209
+ distinctId: string;
3210
+ /**
3211
+ * **Optional.** The host's current PostHog session id (from
3212
+ * `posthog.get_session_id()`). When provided, the bridge seeds it as the
3213
+ * iframe instance's session via `bootstrap.sessionID`, so custom events from
3214
+ * `bridge.track()` share the **same `$session_id`** as the host — letting them
3215
+ * line up with the stitched session replay on one timeline.
3216
+ *
3217
+ * Not needed for *replay* stitching itself (that works via
3218
+ * `recordCrossOriginIframes` on both sides regardless). Must be a valid UUID
3219
+ * v7 — PostHog session ids already are. It is a one-time seed at connect, so
3220
+ * if the host's session later rotates the two can diverge; alignment is
3221
+ * best-effort for the session in progress.
3222
+ */
3223
+ sessionId?: string;
3224
+ /**
3225
+ * Master switch, env- and/or app-gated by the host. The bridge only calls
3226
+ * `posthog.init()` when this is `true`; it stays the kill-switch even though
3227
+ * `posthog-js` is bundled into the bridge.
3228
+ */
3229
+ enabled: boolean;
3230
+ }
3183
3231
  interface ContextPayload {
3184
3232
  tenant: string;
3185
3233
  subsidiaryId: number;
@@ -3192,6 +3240,13 @@ interface ContextPayload {
3192
3240
  subroute?: string;
3193
3241
  /** Slug of the last closed accounting period, e.g. "mar-2026". */
3194
3242
  lastClosedPeriodSlug?: string;
3243
+ /**
3244
+ * PostHog config for in-iframe session recording + custom events. **Absent
3245
+ * when recording is off** (older host, or disabled for this env/app), in which
3246
+ * case the bridge initializes no analytics. Optional so old hosts/bridges stay
3247
+ * compatible.
3248
+ */
3249
+ posthog?: PostHogContext;
3195
3250
  /** Version of the host SDK (@nominalso/vibe-host) running in nom-ui. */
3196
3251
  hostVersion: string;
3197
3252
  }
@@ -3710,4 +3765,4 @@ declare class VibeAppHost {
3710
3765
  private respond;
3711
3766
  }
3712
3767
 
3713
- export { BridgeError, type ContextPayload, type HostContext, type HostHandlers, HttpBridgeError, type InvalidateCachePayload, type InvalidateResult, type NavigateAction, type NavigatePayload, type RequestCompleteInfo, type RequestHandlers, type SetSideNavPayload, type SwitchSubsidiaryPayload, type UploadPayload, type UploadProgress, type UploadResponse, type VibeApiClientOptions, VibeAppHost, type VibeAppHostOptions };
3768
+ export { BridgeError, type ContextPayload, type HostContext, type HostHandlers, HttpBridgeError, type InvalidateCachePayload, type InvalidateResult, type NavigateAction, type NavigatePayload, type PostHogContext, type RequestCompleteInfo, type RequestHandlers, type SetSideNavPayload, type SwitchSubsidiaryPayload, type UploadPayload, type UploadProgress, type UploadResponse, type VibeApiClientOptions, VibeAppHost, type VibeAppHostOptions };
package/dist/index.d.ts CHANGED
@@ -3180,6 +3180,54 @@ interface BridgeSubsidiary {
3180
3180
  id: number;
3181
3181
  displayName: string;
3182
3182
  }
3183
+ /**
3184
+ * PostHog configuration the host supplies so the iframe can record a session
3185
+ * replay (stitched into the host's recording via `recordCrossOriginIframes`)
3186
+ * and emit custom events, all attributed to the **same PostHog person** as
3187
+ * nom-ui.
3188
+ *
3189
+ * The host (nom-ui) is the single source of truth for these values — it knows
3190
+ * the project key, the env-aware ingestion host, and the resolved person — and
3191
+ * delivers them over the bridge so the iframe never hardcodes any of it. When
3192
+ * the host omits the {@link ContextPayload.posthog} block entirely (older host,
3193
+ * or recording disabled for this env/app), the bridge initializes nothing.
3194
+ */
3195
+ interface PostHogContext {
3196
+ /** Project API key — the same PostHog project the host (nom-ui) uses. */
3197
+ token: string;
3198
+ /**
3199
+ * **Absolute** ingestion host, e.g. `"https://us.i.posthog.com"`.
3200
+ *
3201
+ * Must NOT be the host's relative `/ingest` reverse-proxy path: a relative
3202
+ * path resolves against the iframe's *own* (cross-origin) host and 404s.
3203
+ */
3204
+ apiHost: string;
3205
+ /**
3206
+ * Host-resolved PostHog distinct id. The bridge calls `identify()` with it so
3207
+ * the iframe's recording and events attribute to the same person as the host.
3208
+ */
3209
+ distinctId: string;
3210
+ /**
3211
+ * **Optional.** The host's current PostHog session id (from
3212
+ * `posthog.get_session_id()`). When provided, the bridge seeds it as the
3213
+ * iframe instance's session via `bootstrap.sessionID`, so custom events from
3214
+ * `bridge.track()` share the **same `$session_id`** as the host — letting them
3215
+ * line up with the stitched session replay on one timeline.
3216
+ *
3217
+ * Not needed for *replay* stitching itself (that works via
3218
+ * `recordCrossOriginIframes` on both sides regardless). Must be a valid UUID
3219
+ * v7 — PostHog session ids already are. It is a one-time seed at connect, so
3220
+ * if the host's session later rotates the two can diverge; alignment is
3221
+ * best-effort for the session in progress.
3222
+ */
3223
+ sessionId?: string;
3224
+ /**
3225
+ * Master switch, env- and/or app-gated by the host. The bridge only calls
3226
+ * `posthog.init()` when this is `true`; it stays the kill-switch even though
3227
+ * `posthog-js` is bundled into the bridge.
3228
+ */
3229
+ enabled: boolean;
3230
+ }
3183
3231
  interface ContextPayload {
3184
3232
  tenant: string;
3185
3233
  subsidiaryId: number;
@@ -3192,6 +3240,13 @@ interface ContextPayload {
3192
3240
  subroute?: string;
3193
3241
  /** Slug of the last closed accounting period, e.g. "mar-2026". */
3194
3242
  lastClosedPeriodSlug?: string;
3243
+ /**
3244
+ * PostHog config for in-iframe session recording + custom events. **Absent
3245
+ * when recording is off** (older host, or disabled for this env/app), in which
3246
+ * case the bridge initializes no analytics. Optional so old hosts/bridges stay
3247
+ * compatible.
3248
+ */
3249
+ posthog?: PostHogContext;
3195
3250
  /** Version of the host SDK (@nominalso/vibe-host) running in nom-ui. */
3196
3251
  hostVersion: string;
3197
3252
  }
@@ -3710,4 +3765,4 @@ declare class VibeAppHost {
3710
3765
  private respond;
3711
3766
  }
3712
3767
 
3713
- export { BridgeError, type ContextPayload, type HostContext, type HostHandlers, HttpBridgeError, type InvalidateCachePayload, type InvalidateResult, type NavigateAction, type NavigatePayload, type RequestCompleteInfo, type RequestHandlers, type SetSideNavPayload, type SwitchSubsidiaryPayload, type UploadPayload, type UploadProgress, type UploadResponse, type VibeApiClientOptions, VibeAppHost, type VibeAppHostOptions };
3768
+ export { BridgeError, type ContextPayload, type HostContext, type HostHandlers, HttpBridgeError, type InvalidateCachePayload, type InvalidateResult, type NavigateAction, type NavigatePayload, type PostHogContext, type RequestCompleteInfo, type RequestHandlers, type SetSideNavPayload, type SwitchSubsidiaryPayload, type UploadPayload, type UploadProgress, type UploadResponse, type VibeApiClientOptions, VibeAppHost, type VibeAppHostOptions };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "0.3.0";
2
+ var version = "0.4.0";
3
3
 
4
4
  // ../protocol-types/dist/index.js
5
5
  function normalizeSubroute(subroute) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nominalso/vibe-host",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Host-side SDK for embedding Nominal Vibe Apps — receives bridge requests over a typed postMessage protocol and dispatches them to Nominal APIs (used by nom-ui).",
5
5
  "license": "UNLICENSED",
6
6
  "homepage": "https://github.com/nominalso/vibe-apps-sdk#readme",