@40rty/ams-sdk 0.5.1 → 0.5.3

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.
Files changed (30) hide show
  1. package/dist/index.js +639 -479
  2. package/dist/types/ecommerce/src/attribute-buckets.d.ts +2 -2
  3. package/dist/types/ecommerce/src/base-attributes.d.ts +3 -3
  4. package/dist/types/ecommerce/src/commerce-schemas.d.ts +1 -1
  5. package/dist/types/sdk/src/analytics/index.d.ts +1 -1
  6. package/dist/types/sdk/src/analytics/outbox.d.ts +2 -0
  7. package/dist/types/sdk/src/analytics/scope-context.d.ts +6 -0
  8. package/dist/types/sdk/src/analytics/scope.d.ts +7 -0
  9. package/dist/types/sdk/src/host/host-modules.d.ts +238 -36
  10. package/dist/types/sdk/src/session/turn-attributed-session.d.ts +4 -0
  11. package/dist/types/sdk/src/verticals/commerce/commerce-shapes.d.ts +3 -0
  12. package/dist/types/sdk/src/widgets/presence/core-presence/fact-shape.d.ts +1 -1
  13. package/dist/types/sdk/src/widgets/presence/core-presence/standing-signal-store.d.ts +1 -1
  14. package/dist/types/spacestation/src/analytics/envelope.d.ts +24 -0
  15. package/dist/types/spacestation/src/catalog/catalog-schemas.d.ts +1 -1
  16. package/dist/types/spacestation/src/catalog/element-filled.d.ts +2 -2
  17. package/dist/types/spacestation/src/catalog/wire/package-release.d.ts +10 -0
  18. package/dist/types/spacestation/src/commerce/cart-add-signal.d.ts +10 -0
  19. package/dist/types/spacestation/src/contracts/retrieval/ecommerce/option-values.d.ts +1 -1
  20. package/dist/types/spacestation/src/index.d.ts +2 -0
  21. package/dist/types/spacestation/src/layout/layout.d.ts +3 -3
  22. package/dist/types/spacestation/src/space/agent-directive.d.ts +239 -0
  23. package/dist/types/spacestation/src/space/session-queue.d.ts +24 -24
  24. package/dist/types/spacestation/src/space/space-config.d.ts +1 -1
  25. package/dist/types/spacestation/src/space/trace.d.ts +12 -12
  26. package/dist/types/spacestation/src/space/workspace-catalog.d.ts +4 -4
  27. package/dist/types/spacestation/src/trace/trace-diagnostics.d.ts +8 -0
  28. package/dist/types/spacestation/src/trace/trace-envelopes.d.ts +1 -1
  29. package/dist/types/spacestation/src/trace/trace-events.d.ts +1 -1
  30. package/package.json +1 -1
@@ -2,7 +2,7 @@
2
2
  * Product-type buckets (ecommerce vertical, wire-level).
3
3
  *
4
4
  * Shopify catalogs expose `product.productType` as free-form merchant
5
- * vocabulary — Steve Madden alone uses ~60 distinct values (`Heels`,
5
+ * vocabulary — a single footwear brand can use ~60 distinct values (`Heels`,
6
6
  * `Booties`, `Sneakers`, `Mules`, …). Scoping slot keys by raw
7
7
  * productType would explode the registry and prevent a `Heels_Size`
8
8
  * fact from helping a visitor browsing `Boots`.
@@ -48,7 +48,7 @@ export type ProductBucket = 'shoes' | 'bags' | 'apparel' | 'accessories' | 'jewe
48
48
  * of this got that backwards: hardcoded here, shared by every ecommerce
49
49
  * space regardless of what it sells. See `apps/api/src/lib/
50
50
  * resolve-bucket-labels.ts` — a brand declares its own words in its own
51
- * package (`packages/stevemadden/src/bucket-labels.ts`), the SAME seam as
51
+ * package (its `bucket-labels.ts`), the SAME seam as
52
52
  * `baseAttributes`. Absent here ⇒ the bare option name, the safe default —
53
53
  * no vertical-wide word gets forced onto a space that never chose it.
54
54
  */
@@ -13,7 +13,7 @@
13
13
  *
14
14
  * WHY CODE, NOT A DB ROW. An earlier version of this made the mistake of
15
15
  * declaring nine slots as `ECOMMERCE_BASE_ATTRIBUTES`, shared by every
16
- * ecommerce space regardless of what it sells — Steve Madden's wedding
16
+ * ecommerce space regardless of what it sells — a fashion brand's wedding
17
17
  * vocabulary (`venue_surface: grass/sand/pavement/indoor`, `role: ...
18
18
  * bridesmaid...`) leaked onto a grocery or electronics space just as readily.
19
19
  * The fix isn't "put it in the database instead" — a brand's own attribute
@@ -23,8 +23,8 @@
23
23
  * reviewed the same way as everything else it ships, not a DB write a
24
24
  * migration or an admin form has to reach in and mutate). This module is the
25
25
  * vertical's half of that seam — the KEY convention only; the actual values
26
- * are each brand's own, declared in that brand's own package (e.g.
27
- * `packages/stevemadden/src/base-attributes.ts`).
26
+ * are each brand's own, declared in that brand's own package (e.g. its
27
+ * `base-attributes.ts`).
28
28
  */
29
29
  import { type AttributeDef } from '../../spacestation/src/index';
30
30
  /** Build the `config` blob a brand's `BrandDefinition` should carry to
@@ -328,7 +328,7 @@ export type ProductVideo = z.infer<typeof ProductVideoSchema>;
328
328
  export declare function orderedVideoSources(video: ProductVideo): VideoSource[];
329
329
  /**
330
330
  * Sibling products grouped by a shared parent (typically color). Many
331
- * Shopify merchants (Steve Madden, Nordstrom, etc.) model each color as
331
+ * Many Shopify merchants (fashion and footwear especially) model each color as
332
332
  * a standalone product joined to its siblings via a tag / metafield
333
333
  * convention — so the "color picker" the visitor sees on a PDP is really
334
334
  * a navigator across sibling products, not an in-product variant axis.
@@ -1,6 +1,6 @@
1
1
  export { createAnalyticsScope } from './scope';
2
2
  export type { AnalyticsScope, AnalyticsScopeConfig, AnalyticsScopeStats, AnalyticsSink, SinkGuard, } from './scope';
3
- export { AnalyticsSinkProvider, useAnalyticsSink, useOptionalAnalyticsSink } from './scope-context';
3
+ export { AnalyticsSinkProvider, TurnScopeProvider, useAnalyticsSink, useOptionalAnalyticsSink, useTurnScope } from './scope-context';
4
4
  export { SURFACE_DISPOSITION, surfaceEmits, surfaceSuppressionReason } from './surface';
5
5
  export type { SurfaceDisposition } from './surface';
6
6
  export { CONSENT_DISPOSITION, consentDisposition } from './consent';
@@ -39,6 +39,8 @@ export interface HeldEvent {
39
39
  readonly payload: Record<string, unknown>;
40
40
  /** `null` until `attributeHeld` stamps it. Never re-stamped once set. */
41
41
  readonly sessionId: string | null;
42
+ /** The agent turn whose canvas this came from; `null` outside any turn. */
43
+ readonly turnId: string | null;
42
44
  }
43
45
  /**
44
46
  * Is this value shaped like a wire payload?
@@ -1,6 +1,12 @@
1
1
  import type { AnalyticsSink } from './scope';
2
2
  /** Filled by `@fourty/react`'s `AnalyticsScopeMount`, once per mount. */
3
3
  export declare const AnalyticsSinkProvider: import("react").Provider<AnalyticsSink | null>;
4
+ /** Filled by `@fourty/react`'s `ElementWrapper`, once per canvas element. */
5
+ export declare const TurnScopeProvider: import("react").Provider<string | null>;
6
+ /** The agent turn whose canvas element this subtree renders, or `null` outside
7
+ * one. For a producer whose outcome is emitted elsewhere — a signal handled at
8
+ * the provider, out of this subtree — to carry the turn with it. */
9
+ export declare function useTurnScope(): string | null;
4
10
  /**
5
11
  * The sink for THIS mount. THROWS when no mount is upstream.
6
12
  *
@@ -30,6 +30,13 @@ export type SinkGuard<Kind extends ClientEventKind> = Identical<PayloadOf<Kind>,
30
30
  */
31
31
  export interface AnalyticsSink {
32
32
  emit<Kind extends ClientEventKind>(kind: Kind, payload: PayloadOf<Kind>, ...guard: SinkGuard<Kind>): void;
33
+ /**
34
+ * The same sink, with every emit attributed to `turnId` — the agent turn
35
+ * whose canvas the emit came from. Called by the React seam
36
+ * (`useAnalyticsSink` reads the enclosing turn), never by an emit site, so
37
+ * the turn stays envelope the call site cannot get wrong.
38
+ */
39
+ forTurn(turnId: string): AnalyticsSink;
33
40
  }
34
41
  /** What the mount can see without draining anything. */
35
42
  export interface AnalyticsScopeStats {