@40rty/ams-sdk 0.3.1 → 0.4.2

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 (113) hide show
  1. package/dist/index.js +6655 -5934
  2. package/dist/types/ecommerce/src/review-schemas.d.ts +32 -0
  3. package/dist/types/sdk/src/analytics/scope-context.d.ts +2 -2
  4. package/dist/types/sdk/src/canvas/active-chips.d.ts +8 -0
  5. package/dist/types/sdk/src/canvas/chip-relevance.d.ts +41 -0
  6. package/dist/types/sdk/src/canvas/index.d.ts +6 -1
  7. package/dist/types/sdk/src/canvas/item-motion/index.d.ts +1 -1
  8. package/dist/types/sdk/src/canvas/item-motion/profile.d.ts +0 -3
  9. package/dist/types/sdk/src/canvas/layout-entity-refs.d.ts +12 -0
  10. package/dist/types/sdk/src/canvas/runtime-hooks.d.ts +2 -0
  11. package/dist/types/sdk/src/canvas/runtime-types.d.ts +2 -0
  12. package/dist/types/sdk/src/canvas/use-canvas-actions.d.ts +14 -24
  13. package/dist/types/sdk/src/canvas/use-is-seed-home.d.ts +17 -0
  14. package/dist/types/sdk/src/canvas/use-safe-facts.d.ts +9 -0
  15. package/dist/types/sdk/src/catalog/define.d.ts +1 -1
  16. package/dist/types/sdk/src/catalog/index.d.ts +1 -1
  17. package/dist/types/sdk/src/catalog/interaction-contract.d.ts +3 -3
  18. package/dist/types/sdk/src/catalog/registration/types.d.ts +7 -0
  19. package/dist/types/sdk/src/catalog/render-inline.d.ts +0 -37
  20. package/dist/types/sdk/src/host/host-modules.d.ts +217 -121
  21. package/dist/types/sdk/src/host/types.d.ts +3 -1
  22. package/dist/types/sdk/src/index.d.ts +3 -5
  23. package/dist/types/sdk/src/preview/SpacefrontPreviewProvider.d.ts +65 -0
  24. package/dist/types/sdk/src/preview/index.d.ts +1 -0
  25. package/dist/types/sdk/src/projection/index.d.ts +1 -0
  26. package/dist/types/sdk/src/projection/transform.d.ts +12 -0
  27. package/dist/types/sdk/src/projection/use-projection.d.ts +24 -0
  28. package/dist/types/sdk/src/provider/agent-ask-signal.d.ts +4 -0
  29. package/dist/types/sdk/src/provider/index.d.ts +1 -1
  30. package/dist/types/sdk/src/session/FourtySessionContext.d.ts +1 -1
  31. package/dist/types/sdk/src/shell/composer-attachments/heic-convert.d.ts +6 -0
  32. package/dist/types/sdk/src/shell/composer-attachments/use-composer-attachments.d.ts +37 -0
  33. package/dist/types/sdk/src/shell/conversation/answer-text.d.ts +15 -0
  34. package/dist/types/sdk/src/shell/conversation/index.d.ts +4 -0
  35. package/dist/types/sdk/src/shell/conversation/turn-pages.d.ts +16 -0
  36. package/dist/types/sdk/src/shell/conversation/use-conversation-page.d.ts +65 -0
  37. package/dist/types/sdk/src/shell/conversation/use-conversation-presence.d.ts +31 -0
  38. package/dist/types/sdk/src/shell/index.d.ts +6 -0
  39. package/dist/types/sdk/src/shell/turn-ask-placement.d.ts +17 -0
  40. package/dist/types/sdk/src/shell/use-dock-state.d.ts +58 -0
  41. package/dist/types/sdk/src/shell/use-prompt-composer.d.ts +51 -0
  42. package/dist/types/sdk/src/shell/use-thread-rows.d.ts +3 -1
  43. package/dist/types/sdk/src/shell/use-turn-ask-reply.d.ts +5 -0
  44. package/dist/types/sdk/src/utils/core-utils/index.d.ts +0 -6
  45. package/dist/types/sdk/src/utils/index.d.ts +1 -1
  46. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/cart}/use-cart-drawer.d.ts +1 -1
  47. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/cart}/use-cart-line-row.d.ts +1 -1
  48. package/dist/types/sdk/src/verticals/commerce/cart/use-cart-view.d.ts +51 -0
  49. package/dist/types/sdk/src/verticals/commerce/cart/use-safe-cart.d.ts +16 -0
  50. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/checkout}/buy-now-exit.d.ts +1 -1
  51. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/checkout}/checkout-handoff-reasons.d.ts +2 -2
  52. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/checkout}/checkout-handoff-shape.d.ts +1 -1
  53. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/checkout}/checkout-handoff-store.d.ts +3 -3
  54. package/dist/types/sdk/src/verticals/commerce/chip-relevance.d.ts +1 -0
  55. package/dist/types/sdk/src/{commerce → verticals/commerce}/commerce-context.d.ts +1 -1
  56. package/dist/types/sdk/src/{commerce → verticals/commerce}/commerce-shapes.d.ts +2 -2
  57. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/comparison}/comparison-rows.d.ts +1 -1
  58. package/dist/types/sdk/src/verticals/commerce/index.d.ts +35 -0
  59. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/product}/normalize-collection.d.ts +2 -2
  60. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/product}/product-filters.d.ts +1 -1
  61. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/product}/use-look-card.d.ts +4 -4
  62. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/product}/use-product-card.d.ts +2 -2
  63. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/product}/use-product-detail.d.ts +3 -3
  64. package/dist/types/sdk/src/verticals/commerce/use-commerce-actions.d.ts +18 -0
  65. package/dist/types/sdk/src/{commerce → verticals/commerce/variant}/pending-variant-choice-store.d.ts +2 -2
  66. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/variant}/preselect-from-facts.d.ts +1 -1
  67. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/variant}/use-selected-variants-state.d.ts +1 -1
  68. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/variant}/variant-option-axes.d.ts +1 -1
  69. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/variant}/variant-resolution.d.ts +1 -1
  70. package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/variant}/variant-selection.d.ts +1 -1
  71. package/dist/types/sdk/src/verticals/content/index.d.ts +1 -0
  72. package/dist/types/sdk/src/verticals/content/use-content-actions.d.ts +12 -0
  73. package/dist/types/sdk/src/widgets/presence/index.d.ts +1 -0
  74. package/dist/types/sdk/src/widgets/presence/runtime-context.d.ts +1 -1
  75. package/dist/types/sdk/src/widgets/presence/use-forget-fact.d.ts +35 -0
  76. package/dist/types/spacestation/src/analytics/ecommerce/events.d.ts +1 -1
  77. package/dist/types/spacestation/src/catalog/shape-tokens.d.ts +2 -0
  78. package/dist/types/spacestation/src/catalog/wire/index.d.ts +1 -1
  79. package/dist/types/spacestation/src/catalog/wire/package-release.d.ts +24 -1
  80. package/dist/types/spacestation/src/index.d.ts +3 -1
  81. package/dist/types/spacestation/src/layout/conversation.d.ts +5 -0
  82. package/dist/types/spacestation/src/signal/turn-ask.d.ts +94 -0
  83. package/dist/types/spacestation/src/widgets/presence/profile.d.ts +2 -2
  84. package/package.json +2 -1
  85. package/dist/types/sdk/src/animation/index.d.ts +0 -2
  86. package/dist/types/sdk/src/animation/useListTransition.d.ts +0 -16
  87. package/dist/types/sdk/src/animation/useUpdateTransition.d.ts +0 -16
  88. package/dist/types/sdk/src/commerce/ecommerce/agentic-overlay.d.ts +0 -27
  89. package/dist/types/sdk/src/commerce/ecommerce/index.d.ts +0 -21
  90. package/dist/types/sdk/src/commerce/ecommerce/use-product-carousel-scroll.d.ts +0 -13
  91. package/dist/types/sdk/src/commerce/index.d.ts +0 -9
  92. package/dist/types/sdk/src/content/index.d.ts +0 -2
  93. package/dist/types/sdk/src/content/use-faq-accordion.d.ts +0 -11
  94. package/dist/types/sdk/src/content/use-newsletter-form.d.ts +0 -16
  95. package/dist/types/sdk/src/provider/AgentAsk.d.ts +0 -16
  96. package/dist/types/sdk/src/shared/index.d.ts +0 -2
  97. package/dist/types/sdk/src/social/index.d.ts +0 -2
  98. package/dist/types/sdk/src/social/use-review-helpful.d.ts +0 -10
  99. package/dist/types/sdk/src/social/use-testimonials-carousel.d.ts +0 -15
  100. package/dist/types/sdk/src/utils/core-utils/format-distance.d.ts +0 -6
  101. package/dist/types/sdk/src/utils/core-utils/maps-directions-url.d.ts +0 -5
  102. /package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/cart}/cart-action-failures.d.ts +0 -0
  103. /package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/cart}/cart-drawer-store.d.ts +0 -0
  104. /package/dist/types/sdk/src/{commerce → verticals/commerce/checkout}/external-navigation.d.ts +0 -0
  105. /package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/checkout}/use-buy-now.d.ts +0 -0
  106. /package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/comparison}/use-comparison-table.d.ts +0 -0
  107. /package/dist/types/sdk/src/{utils/core-utils → verticals/commerce/price}/format-price.d.ts +0 -0
  108. /package/dist/types/sdk/src/{utils/core-utils → verticals/commerce/price}/is-on-sale.d.ts +0 -0
  109. /package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/product}/use-product-grid-filter.d.ts +0 -0
  110. /package/dist/types/sdk/src/{commerce → verticals/commerce/variant}/option-selection-store.d.ts +0 -0
  111. /package/dist/types/sdk/src/{utils/core-utils → verticals/commerce/variant}/resolve-swatch-color.d.ts +0 -0
  112. /package/dist/types/sdk/src/{commerce → verticals/commerce/variant}/variant-selection-store.d.ts +0 -0
  113. /package/dist/types/sdk/src/{commerce/ecommerce → verticals/commerce/wishlist}/use-wishlist-drawer.d.ts +0 -0
@@ -26,6 +26,8 @@ export declare const PRODUCT_REVIEWS_RESOLVER_KEY = "productReviews";
26
26
  export declare const ProductReviewItemSchema: z.ZodObject<{
27
27
  author: z.ZodString;
28
28
  rating: z.ZodNumber;
29
+ /** The reviewer's own headline ("love"), when they wrote one — the site shows it above `content`. */
30
+ title: z.ZodOptional<z.ZodString>;
29
31
  content: z.ZodString;
30
32
  date: z.ZodString;
31
33
  verified: z.ZodOptional<z.ZodBoolean>;
@@ -40,6 +42,7 @@ export declare const ProductReviewItemSchema: z.ZodObject<{
40
42
  content: string;
41
43
  rating: number;
42
44
  author: string;
45
+ title?: string | undefined;
43
46
  verified?: boolean | undefined;
44
47
  writtenFor?: string | undefined;
45
48
  }, {
@@ -47,6 +50,7 @@ export declare const ProductReviewItemSchema: z.ZodObject<{
47
50
  content: string;
48
51
  rating: number;
49
52
  author: string;
53
+ title?: string | undefined;
50
54
  verified?: boolean | undefined;
51
55
  writtenFor?: string | undefined;
52
56
  }>;
@@ -55,6 +59,8 @@ export type ProductReviewItem = z.infer<typeof ProductReviewItemSchema>;
55
59
  export declare const ProductReviewHighlightSchema: z.ZodObject<{
56
60
  author: z.ZodString;
57
61
  rating: z.ZodNumber;
62
+ /** The reviewer's own headline ("love"), when they wrote one — the site shows it above `content`. */
63
+ title: z.ZodOptional<z.ZodString>;
58
64
  content: z.ZodString;
59
65
  date: z.ZodString;
60
66
  verified: z.ZodOptional<z.ZodBoolean>;
@@ -88,6 +94,7 @@ export declare const ProductReviewHighlightSchema: z.ZodObject<{
88
94
  content: string;
89
95
  rating: number;
90
96
  author: string;
97
+ title?: string | undefined;
91
98
  verified?: boolean | undefined;
92
99
  writtenFor?: string | undefined;
93
100
  highlight?: string | undefined;
@@ -97,6 +104,7 @@ export declare const ProductReviewHighlightSchema: z.ZodObject<{
97
104
  content: string;
98
105
  rating: number;
99
106
  author: string;
107
+ title?: string | undefined;
100
108
  verified?: boolean | undefined;
101
109
  writtenFor?: string | undefined;
102
110
  highlight?: string | undefined;
@@ -129,6 +137,8 @@ export declare const ProductReviewDataSchema: z.ZodObject<{
129
137
  reviews: z.ZodDefault<z.ZodArray<z.ZodObject<{
130
138
  author: z.ZodString;
131
139
  rating: z.ZodNumber;
140
+ /** The reviewer's own headline ("love"), when they wrote one — the site shows it above `content`. */
141
+ title: z.ZodOptional<z.ZodString>;
132
142
  content: z.ZodString;
133
143
  date: z.ZodString;
134
144
  verified: z.ZodOptional<z.ZodBoolean>;
@@ -143,6 +153,7 @@ export declare const ProductReviewDataSchema: z.ZodObject<{
143
153
  content: string;
144
154
  rating: number;
145
155
  author: string;
156
+ title?: string | undefined;
146
157
  verified?: boolean | undefined;
147
158
  writtenFor?: string | undefined;
148
159
  }, {
@@ -150,6 +161,7 @@ export declare const ProductReviewDataSchema: z.ZodObject<{
150
161
  content: string;
151
162
  rating: number;
152
163
  author: string;
164
+ title?: string | undefined;
153
165
  verified?: boolean | undefined;
154
166
  writtenFor?: string | undefined;
155
167
  }>, "many">>;
@@ -172,6 +184,8 @@ export declare const ProductReviewDataSchema: z.ZodObject<{
172
184
  highlights: z.ZodDefault<z.ZodArray<z.ZodObject<{
173
185
  author: z.ZodString;
174
186
  rating: z.ZodNumber;
187
+ /** The reviewer's own headline ("love"), when they wrote one — the site shows it above `content`. */
188
+ title: z.ZodOptional<z.ZodString>;
175
189
  content: z.ZodString;
176
190
  date: z.ZodString;
177
191
  verified: z.ZodOptional<z.ZodBoolean>;
@@ -205,6 +219,7 @@ export declare const ProductReviewDataSchema: z.ZodObject<{
205
219
  content: string;
206
220
  rating: number;
207
221
  author: string;
222
+ title?: string | undefined;
208
223
  verified?: boolean | undefined;
209
224
  writtenFor?: string | undefined;
210
225
  highlight?: string | undefined;
@@ -214,6 +229,7 @@ export declare const ProductReviewDataSchema: z.ZodObject<{
214
229
  content: string;
215
230
  rating: number;
216
231
  author: string;
232
+ title?: string | undefined;
217
233
  verified?: boolean | undefined;
218
234
  writtenFor?: string | undefined;
219
235
  highlight?: string | undefined;
@@ -226,6 +242,7 @@ export declare const ProductReviewDataSchema: z.ZodObject<{
226
242
  content: string;
227
243
  rating: number;
228
244
  author: string;
245
+ title?: string | undefined;
229
246
  verified?: boolean | undefined;
230
247
  writtenFor?: string | undefined;
231
248
  }[];
@@ -239,6 +256,7 @@ export declare const ProductReviewDataSchema: z.ZodObject<{
239
256
  content: string;
240
257
  rating: number;
241
258
  author: string;
259
+ title?: string | undefined;
242
260
  verified?: boolean | undefined;
243
261
  writtenFor?: string | undefined;
244
262
  highlight?: string | undefined;
@@ -251,6 +269,7 @@ export declare const ProductReviewDataSchema: z.ZodObject<{
251
269
  content: string;
252
270
  rating: number;
253
271
  author: string;
272
+ title?: string | undefined;
254
273
  verified?: boolean | undefined;
255
274
  writtenFor?: string | undefined;
256
275
  }[] | undefined;
@@ -264,6 +283,7 @@ export declare const ProductReviewDataSchema: z.ZodObject<{
264
283
  content: string;
265
284
  rating: number;
266
285
  author: string;
286
+ title?: string | undefined;
267
287
  verified?: boolean | undefined;
268
288
  writtenFor?: string | undefined;
269
289
  highlight?: string | undefined;
@@ -283,6 +303,8 @@ export declare const ProductReviewPayloadSchema: z.ZodObject<Omit<{
283
303
  reviews: z.ZodDefault<z.ZodArray<z.ZodObject<{
284
304
  author: z.ZodString;
285
305
  rating: z.ZodNumber;
306
+ /** The reviewer's own headline ("love"), when they wrote one — the site shows it above `content`. */
307
+ title: z.ZodOptional<z.ZodString>;
286
308
  content: z.ZodString;
287
309
  date: z.ZodString;
288
310
  verified: z.ZodOptional<z.ZodBoolean>;
@@ -297,6 +319,7 @@ export declare const ProductReviewPayloadSchema: z.ZodObject<Omit<{
297
319
  content: string;
298
320
  rating: number;
299
321
  author: string;
322
+ title?: string | undefined;
300
323
  verified?: boolean | undefined;
301
324
  writtenFor?: string | undefined;
302
325
  }, {
@@ -304,6 +327,7 @@ export declare const ProductReviewPayloadSchema: z.ZodObject<Omit<{
304
327
  content: string;
305
328
  rating: number;
306
329
  author: string;
330
+ title?: string | undefined;
307
331
  verified?: boolean | undefined;
308
332
  writtenFor?: string | undefined;
309
333
  }>, "many">>;
@@ -326,6 +350,8 @@ export declare const ProductReviewPayloadSchema: z.ZodObject<Omit<{
326
350
  highlights: z.ZodDefault<z.ZodArray<z.ZodObject<{
327
351
  author: z.ZodString;
328
352
  rating: z.ZodNumber;
353
+ /** The reviewer's own headline ("love"), when they wrote one — the site shows it above `content`. */
354
+ title: z.ZodOptional<z.ZodString>;
329
355
  content: z.ZodString;
330
356
  date: z.ZodString;
331
357
  verified: z.ZodOptional<z.ZodBoolean>;
@@ -359,6 +385,7 @@ export declare const ProductReviewPayloadSchema: z.ZodObject<Omit<{
359
385
  content: string;
360
386
  rating: number;
361
387
  author: string;
388
+ title?: string | undefined;
362
389
  verified?: boolean | undefined;
363
390
  writtenFor?: string | undefined;
364
391
  highlight?: string | undefined;
@@ -368,6 +395,7 @@ export declare const ProductReviewPayloadSchema: z.ZodObject<Omit<{
368
395
  content: string;
369
396
  rating: number;
370
397
  author: string;
398
+ title?: string | undefined;
371
399
  verified?: boolean | undefined;
372
400
  writtenFor?: string | undefined;
373
401
  highlight?: string | undefined;
@@ -379,6 +407,7 @@ export declare const ProductReviewPayloadSchema: z.ZodObject<Omit<{
379
407
  content: string;
380
408
  rating: number;
381
409
  author: string;
410
+ title?: string | undefined;
382
411
  verified?: boolean | undefined;
383
412
  writtenFor?: string | undefined;
384
413
  }[];
@@ -392,6 +421,7 @@ export declare const ProductReviewPayloadSchema: z.ZodObject<Omit<{
392
421
  content: string;
393
422
  rating: number;
394
423
  author: string;
424
+ title?: string | undefined;
395
425
  verified?: boolean | undefined;
396
426
  writtenFor?: string | undefined;
397
427
  highlight?: string | undefined;
@@ -403,6 +433,7 @@ export declare const ProductReviewPayloadSchema: z.ZodObject<Omit<{
403
433
  content: string;
404
434
  rating: number;
405
435
  author: string;
436
+ title?: string | undefined;
406
437
  verified?: boolean | undefined;
407
438
  writtenFor?: string | undefined;
408
439
  }[] | undefined;
@@ -416,6 +447,7 @@ export declare const ProductReviewPayloadSchema: z.ZodObject<Omit<{
416
447
  content: string;
417
448
  rating: number;
418
449
  author: string;
450
+ title?: string | undefined;
419
451
  verified?: boolean | undefined;
420
452
  writtenFor?: string | undefined;
421
453
  highlight?: string | undefined;
@@ -14,8 +14,8 @@ export declare function useAnalyticsSink(): AnalyticsSink;
14
14
  * Non-throwing variant — `null` when no mount is upstream, with one warning.
15
15
  *
16
16
  * THE ONE `@fourty/ui` USES. Shared UI renders in preview and storybook
17
- * contexts with no provider at all, which is exactly why that package already
18
- * ships `use-safe-cart`, `use-safe-facts` and `use-safe-fourty-session`. A
17
+ * contexts with no provider at all, which is exactly why the sdk already
18
+ * ships `useSafeCart`, `useSafeFacts` and `useOptionalFourtySession`. A
19
19
  * caller receiving `null` passes it on explicitly (`AnalyticsSink | null` is the
20
20
  * one tolerated null in this module: the store parameter stays REQUIRED, so an
21
21
  * un-threaded call site is still TS2554, while a preview render says "there is
@@ -0,0 +1,8 @@
1
+ import type { Spec, SuggestionAction, SuggestionActions, ComponentCatalogStructural } from '../../../spacestation/src/index';
2
+ /**
3
+ * Compute the chips to display given the current layout and the agent's most
4
+ * recently emitted suggestion set: the agent's chips, de-duplicated by id,
5
+ * minus those the registered rule for their type says the current layout has
6
+ * invalidated. Chips carry NO defaults. Returns null when the set is empty.
7
+ */
8
+ export declare function computeActiveChips(layout: Spec | null, agentChips: SuggestionAction[], catalog: ComponentCatalogStructural): SuggestionActions | null;
@@ -0,0 +1,41 @@
1
+ import type { NavigatePayload, SuggestionAction } from '../../../spacestation/src/index';
2
+ /** Resolver keys present on the layout, bucketed by the surface they appear on. */
3
+ export interface EntitySurfaces {
4
+ /** Keys on a single-entity reader — a `resolved(…, key, { max: 1 })` prop. */
5
+ focus: ReadonlySet<string>;
6
+ /** Keys on a browse surface — a `resolved(…, key)` prop with no `max: 1`. */
7
+ list: ReadonlySet<string>;
8
+ }
9
+ export interface ChipRelevanceContext {
10
+ /** Every entity id referenced anywhere on the layout. */
11
+ layoutEntityIds: ReadonlySet<string>;
12
+ surfaces: EntitySurfaces;
13
+ }
14
+ /** `true` = the chip still belongs over the current layout. */
15
+ export type ChipRelevanceRule = (chip: SuggestionAction, ctx: ChipRelevanceContext) => boolean;
16
+ /** Register the relevance rule for one chip type. Module-load time only. */
17
+ export declare function registerChipRelevanceRule(chipType: string, rule: ChipRelevanceRule): void;
18
+ /** The rule for a chip type, or `null` when none is registered (the chip is kept). */
19
+ export declare function chipRelevanceRuleFor(chipType: string): ChipRelevanceRule | null;
20
+ type Page = NavigatePayload['page'];
21
+ /**
22
+ * How a page kind addresses entities of one resolver key:
23
+ * - `focus`: the page IS one entity — a navigate to it is redundant when a
24
+ * focus surface for the key is on screen and the entity is on the layout.
25
+ * - `list`: the page lists entities — a navigate to it is redundant when a
26
+ * list surface for the key is on screen and already shows all of them.
27
+ */
28
+ export type EntityPageBinding = {
29
+ surface: 'focus';
30
+ resolverKey: string;
31
+ entityId: (page: Page) => string | null;
32
+ } | {
33
+ surface: 'list';
34
+ resolverKey: string;
35
+ entityIds: (page: Page) => readonly string[];
36
+ };
37
+ /** Declare that a page kind addresses entities. Module-load time only. */
38
+ export declare function registerEntityPageKind(kind: string, binding: EntityPageBinding): void;
39
+ /** The entity binding for a page kind, or `null` for a page that addresses none. */
40
+ export declare function entityPageBindingFor(kind: string): EntityPageBinding | null;
41
+ export {};
@@ -1,5 +1,5 @@
1
1
  export { FourtyRuntimeProvider, useFourtyRuntime, useOptionalFourtyRuntime, } from './runtime-context';
2
- export { useTurn, useStream, useDisplayedLayout, useFourtyShell, useAgentDriven, useReasoning, useSessionState, useSessionId, useSessionMessages, useFacts, useConversationMessages, usePendingMessage, useCurrentMessageIndex, useSelectMessage, useExplicitTurnId, useExplicitTurnSelection, useHistoryNav, useCanvasBack, useCanvasViewBack, useCanvasForward, useConversationState, useSuggestionsWithDefaults, useComposerPlaceholder, useComposerPlaceholderRotation, useLayout, useFocalEntityId, useInteraction, useConversations, useHasLeftSeedHome, useVisitorName, } from './runtime-hooks';
2
+ export { useTurn, useStream, useTurnAsk, useDisplayedLayout, useFourtyShell, useAgentDriven, useReasoning, useSessionState, useSessionId, useSessionMessages, useFacts, useConversationMessages, usePendingMessage, useCurrentMessageIndex, useSelectMessage, useExplicitTurnId, useExplicitTurnSelection, useHistoryNav, useCanvasBack, useCanvasViewBack, useCanvasForward, useConversationState, useSuggestionsWithDefaults, useComposerPlaceholder, useComposerPlaceholderRotation, useLayout, useFocalEntityId, useInteraction, useConversations, useHasLeftSeedHome, useVisitorName, } from './runtime-hooks';
3
3
  export type { TurnInfo, HistoryNav, CanvasBack, CanvasForward, ConversationState, RuntimeSessionState, FourtyRuntime, InteractionActions, VisitorName, ExplicitTurnSelection, } from './runtime-types';
4
4
  export { CanvasTailProvider, useCanvasTail, CanvasTailMount, type CanvasTailComponent, } from './canvas-tail';
5
5
  export { GenerationStyleContext, GenerationStyleProvider, useGenerationStyle, } from './GenerationStyleContext';
@@ -12,6 +12,8 @@ export { buildEntranceProps, type EntranceMotionProps } from './generation-entra
12
12
  export { INITIAL_NAV_PRESENTATION, type NavDirection, type NavPace, type NavPresentation, } from './nav-direction';
13
13
  export { DEFAULT_GENERATION_TIMINGS, DEFAULT_GENERATION_STYLE, GENERATION_EASE, type SkeletonTreatment, type ActiveBlockTreatment, type EntranceTreatment, type TextTreatment, type ImageTreatment, type GenerationTimings, type GenerationStyle, } from './generation-style';
14
14
  export { useCanvasActions, type CanvasActions } from './use-canvas-actions';
15
+ export { computeActiveChips } from './active-chips';
16
+ export { registerChipRelevanceRule, registerEntityPageKind, type ChipRelevanceRule, type ChipRelevanceContext, type EntitySurfaces, type EntityPageBinding, } from './chip-relevance';
15
17
  export { useFourtyLayout } from './use-fourty-layout';
16
18
  export { findElementScrollTarget, findChangeAnchorTarget, findChangeAnchorItem, findTurnScrollTarget, turnOwnsView, findPanelHeadroom, scrollPaddingTopOf, layoutTopWithin, viewportRectOf, anchorLineOf, isFullyVisible, arraysEqual, setNavScrollActive, isNavScrollActive, ACTIVE_PANEL_ATTR, ACTIVE_PANEL_SELECTOR, type ViewportRect, } from './dom-targets';
17
19
  export { scrollEventTarget } from './scroll-event-target';
@@ -19,3 +21,6 @@ export { deriveTurnChangeAnchor, changeAnchorWithin, type TurnChangeAnchor } fro
19
21
  export { turnEditedBlock } from './turn-edit';
20
22
  export { CanvasOutletProvider, SpacefrontCanvas } from './canvas-outlet';
21
23
  export * from './item-motion';
24
+ export { collectLayoutGids } from './layout-entity-refs';
25
+ export { useIsSeedHome } from './use-is-seed-home';
26
+ export { useSafeFacts } from './use-safe-facts';
@@ -1,5 +1,5 @@
1
1
  export { ItemTransitionGroup, ITEM_IDENTITY_ATTR, type ItemTransitionGroupProps } from './ItemTransitionGroup';
2
- export { getActiveProfile, registerCanvasProfile, setCanvasProfile, type CanvasScenario, type CanvasMotionProfile, type ScenarioMotion, type RevealScroll, type WipeBehavior, type WipeDirection, type MotionEase, type ItemScenario, } from './profile';
2
+ export { getActiveProfile, setCanvasProfile, type CanvasScenario, type CanvasMotionProfile, type ScenarioMotion, type RevealScroll, type WipeBehavior, type WipeDirection, type MotionEase, type ItemScenario, } from './profile';
3
3
  export { wipeProfile } from './plugins/wipe';
4
4
  export { classifyItemChange, type ItemChange } from './classify-items';
5
5
  export { wipePhases, buildWipeVariants, selectItemVariants } from './wipe';
@@ -68,9 +68,6 @@ export interface CanvasMotionProfile {
68
68
  items: Record<ItemScenario, WipeBehavior>;
69
69
  generation: GenerationStyle;
70
70
  }
71
- /** Register a named profile (or override one). Extension point — translate a
72
- * new playground export into a plugin file and register it here. */
73
- export declare function registerCanvasProfile(name: string, profile: CanvasMotionProfile): void;
74
71
  /** Select the active profile by name. No-op if unknown (keeps the current one). */
75
72
  export declare function setCanvasProfile(name: string): void;
76
73
  /** The active profile — what the engine plays. */
@@ -0,0 +1,12 @@
1
+ import type { Spec, ComponentCatalogStructural } from '../../../spacestation/src/index';
2
+ /**
3
+ * Harvest every entity reference on the layout from catalog-declared
4
+ * `resolved()` props. Catalog-driven, platform-agnostic: any non-empty
5
+ * string at a resolved path counts as a ref, no matter the format
6
+ * (Shopify `gid://shopify/...`, a WooCommerce post id, a Square object
7
+ * id, a flat handle). The resolver decides what's resolvable.
8
+ *
9
+ * Platform code — read by presence (`useLayoutEntityIds`), the engine's
10
+ * surfacing bridge, and the chip projection (`active-chips`).
11
+ */
12
+ export declare function collectLayoutGids(layout: Spec | null, catalog: ComponentCatalogStructural): Set<string>;
@@ -4,6 +4,8 @@ import type { TurnInfo, HistoryNav, CanvasBack, CanvasForward, ConversationState
4
4
  export declare function useTurn(): TurnInfo;
5
5
  /** Per-turn stream channel for the turn currently on canvas. */
6
6
  export declare function useStream<T extends 'prose' | 'actions' | 'signals'>(name: T): T extends 'prose' ? string : import('../../../spacestation/src/index').AgentSignal[];
7
+ /** The question the turn on canvas closed on, apart from its prose (`TurnAsk`). */
8
+ export declare function useTurnAsk(): import('../../../spacestation/src/index').TurnAsk | undefined;
7
9
  /** The layout doc currently on canvas. */
8
10
  export declare function useDisplayedLayout(): Spec;
9
11
  /** Brand chrome for the view currently on canvas. */
@@ -138,6 +138,8 @@ export interface ExplicitTurnSelection {
138
138
  export interface FourtyRuntime {
139
139
  useTurn: () => TurnInfo;
140
140
  useStream: <T extends 'prose' | 'actions' | 'signals'>(name: T) => T extends 'prose' ? string : import('../../../spacestation/src/index').AgentSignal[];
141
+ /** The question the turn on canvas closed on, apart from its prose. */
142
+ useTurnAsk: () => import('../../../spacestation/src/index').TurnAsk | undefined;
141
143
  useDisplayedLayout: () => Spec;
142
144
  useFourtyShell: () => ShellConfig;
143
145
  /** True once an external WebMCP agent has invoked one of this page's tools —
@@ -1,41 +1,31 @@
1
- import { type SuggestionAction } from '../../../spacestation/src/index';
1
+ import { type NavigatePayload, type SuggestionAction } from '../../../spacestation/src/index';
2
2
  /**
3
3
  * Composition hook for canvas-rendered catalog components.
4
4
  *
5
- * Catalog components (`ProductCard`, `CollectionCard`, `ComparisonTable`,
6
- * `BlogPosts`, `Newsletter`, `CartDrawer`, `CartLineItem`,
7
- * `WishlistDrawer`, `ProductDetail`) are rendered by the
8
- * canvas renderer — they have no parent to pass them callback props. So
9
- * the "click → action meaning" they need lives HERE, in the runtime seam
10
- * the harness owns, not inside the dumb presentational component.
5
+ * Catalog components are rendered by the canvas renderer — they have no
6
+ * parent to pass them callback props. So the "click → action meaning" they
7
+ * need lives HERE, in the runtime seam the harness owns, not inside the dumb
8
+ * presentational component.
11
9
  *
12
10
  * A `@fourty/ui` catalog component must NOT call
13
11
  * `useFourtySession().dispatchSuggestionAction(...)` itself — it must not
14
12
  * encode click→action meaning. It consumes the ready-made handlers this
15
13
  * hook returns and stays a pure renderer; the harness assigns the meaning.
16
14
  *
15
+ * These are the vertical-neutral verbs. A vertical's own verbs are built on
16
+ * them in `verticals/<vertical>/` (`useCommerceActions`, `useContentActions`).
17
+ *
17
18
  * Returns `null` when no `<FourtyProvider>` is mounted upstream (Storybook
18
19
  * / preview sandboxes). Components fall back to a non-interactive render
19
20
  * in that case — the click does nothing rather than crashing.
20
21
  */
21
22
  export interface CanvasActions {
22
- /** Navigate to a product's detail view (`{page:{kind:'product'}}`). */
23
- navigateToProduct: (productId: string, title: string) => void;
24
- /** Navigate to an article's detail view (`{page:{kind:'article'}}`). */
25
- navigateToArticle: (articleId: string, title: string) => void;
26
- /** Navigate to a collection. Storefront `Collection` doesn't carry
27
- * productIds at the tile surface, so this round-trips through the
28
- * agent as a `message` — the agent resolves the collection gid and
29
- * emits a productGrid layout. */
30
- showCollection: (collectionTitle: string) => void;
31
- /** Navigate to a synthetic collection of explicit product ids — the
32
- * "view all hearted" wishlist affordance. */
33
- navigateToProductSet: (handle: string, title: string, productIds: string[]) => void;
34
- /** Dispatch an arbitrary agent-emitted action verbatim — used by
35
- * in-canvas components like `ComparisonTable` whose cells carry a
36
- * full `SuggestionAction` the agent authored. */
23
+ /** Navigate the canvas to a typed destination `Page`. */
24
+ navigate: (page: NavigatePayload['page'], label: string) => void;
25
+ /** Ask the agent something in the visitor's words (a `message` action). */
26
+ ask: (text: string, label: string) => void;
27
+ /** Dispatch an arbitrary action verbatim — used by in-canvas components
28
+ * whose cells carry a full `SuggestionAction` the agent authored. */
37
29
  dispatchAction: (action: SuggestionAction) => void;
38
- /** Subscribe a `newsletter.subscribe` submission. */
39
- subscribeNewsletter: (email: string, buttonLabel: string) => void;
40
30
  }
41
31
  export declare function useCanvasActions(): CanvasActions | null;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * `true` when the visitor is on the canonical welcome layout — turn 0,
3
+ * no userMessage, displayed layout structurally equal to the seed.
4
+ *
5
+ * After ANY click-driven `navigate` (productDetail / productGrid /
6
+ * articleDetail / etc.), the displayed layout diverges from `seedLayout`,
7
+ * so this returns false and the composer leaves hero placement.
8
+ *
9
+ * Not `!useHasLeftSeedHome()`: that one is a LATCH (any user turn or any nav
10
+ * ever), while this reads the CURRENT view — Back to the welcome layout makes
11
+ * it true again, and it is false until the seed layout is known.
12
+ *
13
+ * Reference-compare is unreliable (JSON round-trip breaks identity),
14
+ * so structural-compare via JSON.stringify — both payloads are small
15
+ * enough that the cost is irrelevant.
16
+ */
17
+ export declare function useIsSeedHome(): boolean;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Wraps `useFacts()` with provider-presence safety.
3
+ *
4
+ * Returns the live fact map if a `<FourtyProvider>` is mounted upstream.
5
+ * Returns an empty object and logs a one-shot console warning otherwise —
6
+ * mirrors `useSafeCart`, used by catalog components that read
7
+ * facts inside storybook / preview sandboxes without a provider.
8
+ */
9
+ export declare function useSafeFacts(): Record<string, unknown>;
@@ -19,7 +19,7 @@
19
19
  * This is a typed layer over Zod, not a replacement for it. `entity()` emits
20
20
  * exactly what `resolved()` emits; `text` emits a `prose()`-marked string.
21
21
  * Every downstream consumer — `getResolvedPaths`/`getProsePaths` in
22
- * `HydratedComponent`, `resolvedTopLevelProps` in the agentic overlay,
22
+ * `HydratedComponent`, `resolvedTopLevelProps` in the chip projection,
23
23
  * `findFunctionPropPaths` in the interaction contract, and the agent's catalog
24
24
  * prompt generation — keeps working unchanged, because it still receives an
25
25
  * ordinary tagged Zod schema. That also makes adoption incremental: a brand can
@@ -4,7 +4,7 @@ export { HydrationStateContext, useHydrationState, type HydrationState, } from '
4
4
  export { HydratorProvider, useHydrators } from './HydratorContext';
5
5
  export type { ComponentMapping, ComponentsMap, Hydrator, HydratorMap, HydrationContext, } from './normalize-components';
6
6
  export { RegistryProvider, useRegistry, PackageLookupProvider, usePackageLookup, createAliasedRegistry, type ComponentRegistry, type PackageLookupFn, } from './registry';
7
- export { renderInline, setInlineLinkRenderer, type InlineLinkRenderer } from './render-inline';
7
+ export { renderInline } from './render-inline';
8
8
  export { adaptComponent, NullComponent, buildComponentLibrary, type BrandComponent } from './component-library';
9
9
  export { catalogComponent, catalogComponentFrom, entity, text, plain, token, type CatalogComponent, type CatalogComponentMeta, } from './define';
10
10
  export { adaptCatalogComponent, type CatalogComponentProps, type ValidCatalogComponent, type InteractionContractViolation, } from './interaction-contract';
@@ -12,8 +12,8 @@ import { type BrandComponent } from './component-library';
12
12
  * wired to a value that is ALWAYS `undefined` at render — a dead no-op. The fix
13
13
  * is structural: a catalog component's props must be EXACTLY the data its
14
14
  * `propsSchema` declares (plus React's own framework plumbing). Actions come
15
- * only from platform hooks (`useAddToCart`, `useToggleWishlist`,
16
- * `useCanvasActions`, …), which read from context — never from a prop.
15
+ * only from runtime hooks (`useCanvasActions` and each vertical's action
16
+ * hooks), which read from context — never from a prop.
17
17
  *
18
18
  * `adaptCatalogComponent(schema, Component)` binds a component's props type to
19
19
  * `z.infer<schema>`. Because a Zod data schema cannot infer a function, and any
@@ -48,7 +48,7 @@ type UndeclaredPropKeys<P, S extends z.ZodTypeAny> = Exclude<keyof P, keyof z.in
48
48
  * outside its schema. It intersects the component argument, so the argument
49
49
  * (a component, not a string) fails to type-check — pointing the author here.
50
50
  */
51
- export type InteractionContractViolation = 'Interaction contract: this catalog component declares prop(s) not in its propsSchema. Catalog components take ONLY the data their schema declares; actions come from platform hooks (useAddToCart, useToggleWishlist, useCanvasActions), never a callback prop the agent cannot emit. See docs/architecture-invariants.md §IV.5.';
51
+ export type InteractionContractViolation = 'Interaction contract: this catalog component declares prop(s) not in its propsSchema. Catalog components take ONLY the data their schema declares; actions come from runtime hooks (useCanvasActions and the vertical action hooks), never a callback prop the agent cannot emit. See docs/architecture-invariants.md §IV.5.';
52
52
  /**
53
53
  * `unknown` (an identity for intersection) when the component's props are
54
54
  * exactly the schema's data plus framework plumbing; the violation string
@@ -1,5 +1,6 @@
1
1
  import type { CatalogEntryStructural } from '../../../../spacestation/src/index';
2
2
  import type { ShellComponent } from '../../shell/ShellRegistry';
3
+ import type { TurnAskPlacement } from '../../shell/turn-ask-placement';
3
4
  /**
4
5
  * A single component definition within a FourtyPackage.
5
6
  * Combines structural catalog metadata (propsSchema + slots + bindings)
@@ -80,4 +81,10 @@ export interface FourtyPackage {
80
81
  * so the brand-side `default` wins.
81
82
  */
82
83
  shells?: Record<string, ShellComponent>;
84
+ /**
85
+ * Who draws the turn's closing question — `'shell'` when this package's
86
+ * shell renders it (`useTurnAsk`), else the engine folds it into the prose.
87
+ * Read from the active brand only, like `shells`.
88
+ */
89
+ turnAsk?: TurnAskPlacement;
83
90
  }
@@ -1,39 +1,2 @@
1
1
  import React from 'react';
2
- /**
3
- * The inline markdown subset the agent is told it may emit — `**bold**` for
4
- * visual anchors and `*italic*` for tonal emphasis (see
5
- * `prompts/core/output/01-wire-format.md` and the VOICE section of `prompts/vertical/ecommerce/ecommerce.md`,
6
- * which name exactly these two and rule out headings / links / code). Block
7
- * constructs (paragraphs, bullet lists) are NOT handled here — `AgentText`'s
8
- * `blockifyProse` splits those and delegates each line back to this function.
9
- *
10
- * PLUS bare-URL autolinking. The agent never EMITS link markdown, but
11
- * `prose()`-marked DATA carries raw URLs — a FAQ answer or policy that says
12
- * "verify at https://support.recallsecure.com/". Those are linkified here so
13
- * they render as clickable anchors (new tab) instead of dead text.
14
- *
15
- * Link rendering is CUSTOMIZABLE two ways, so a brand can emphasize links how
16
- * it wants without forking this renderer:
17
- * 1. CSS — every autolink carries the stable class `fourty-inline-link`, and
18
- * the default anchor colours off the `--fourty-color-link` token (falling
19
- * back to `--fourty-color-accent`, then `currentColor`). A brand styles the
20
- * class / sets the token in its own stylesheet.
21
- * 2. A render seam — `setInlineLinkRenderer(fn)` swaps the entire anchor for a
22
- * brand's own node (a branded `<a>`, an icon, a tracked link). Pass `null`
23
- * to restore the default. The default already opens in a new tab.
24
- *
25
- * Returns an array of React nodes; safe as the children of any element.
26
- *
27
- * Lives in `@fourty/sdk` because the hydration boundary here calls it too — it
28
- * applies this to every `prose()`-marked catalog field before a component ever
29
- * sees the string. `@fourty/ui` re-exports it so brand components importing
30
- * from there keep working.
31
- */
32
- /** How a bare URL found in prose is turned into a node. */
33
- export type InlineLinkRenderer = (href: string, key: string) => React.ReactNode;
34
- /**
35
- * Override how autolinked URLs render (brand emphasis, icon, tracking). Pass
36
- * `null` to restore the default new-tab anchor. Set once at app/brand startup.
37
- */
38
- export declare function setInlineLinkRenderer(renderer: InlineLinkRenderer | null): void;
39
2
  export declare function renderInline(text: string, keyPrefix: string): React.ReactNode[];