@40rty/ams-sdk 0.5.4 → 0.5.6

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.
@@ -146,6 +146,7 @@ export declare const ProductVideoSchema: z.ZodObject<{
146
146
  width?: number | undefined;
147
147
  height?: number | undefined;
148
148
  }[];
149
+ host?: string | undefined;
149
150
  previewImage?: {
150
151
  url: string;
151
152
  altText: string;
@@ -154,9 +155,9 @@ export declare const ProductVideoSchema: z.ZodObject<{
154
155
  srcSet?: string | undefined;
155
156
  } | undefined;
156
157
  embedUrl?: string | undefined;
157
- host?: string | undefined;
158
158
  }, {
159
159
  kind: "hosted" | "external";
160
+ host?: string | undefined;
160
161
  altText?: string | undefined;
161
162
  previewImage?: {
162
163
  url: string;
@@ -172,7 +173,6 @@ export declare const ProductVideoSchema: z.ZodObject<{
172
173
  height?: number | undefined;
173
174
  }[] | undefined;
174
175
  embedUrl?: string | undefined;
175
- host?: string | undefined;
176
176
  }>;
177
177
  /**
178
178
  * Why a variant can or cannot be bought right now — UCP's `availability.status`
@@ -377,8 +377,8 @@ export declare const SiblingProductSchema: z.ZodObject<{
377
377
  current: z.ZodDefault<z.ZodBoolean>;
378
378
  }, "strip", z.ZodTypeAny, {
379
379
  id: string;
380
- handle: string;
381
380
  title: string;
381
+ handle: string;
382
382
  available: boolean;
383
383
  color: string;
384
384
  current: boolean;
@@ -391,8 +391,8 @@ export declare const SiblingProductSchema: z.ZodObject<{
391
391
  } | undefined;
392
392
  }, {
393
393
  id: string;
394
- handle: string;
395
394
  title: string;
395
+ handle: string;
396
396
  color: string;
397
397
  available?: boolean | undefined;
398
398
  swatchImage?: {
@@ -518,6 +518,7 @@ export declare const ProductSchema: z.ZodObject<{
518
518
  width?: number | undefined;
519
519
  height?: number | undefined;
520
520
  }[];
521
+ host?: string | undefined;
521
522
  previewImage?: {
522
523
  url: string;
523
524
  altText: string;
@@ -526,9 +527,9 @@ export declare const ProductSchema: z.ZodObject<{
526
527
  srcSet?: string | undefined;
527
528
  } | undefined;
528
529
  embedUrl?: string | undefined;
529
- host?: string | undefined;
530
530
  }, {
531
531
  kind: "hosted" | "external";
532
+ host?: string | undefined;
532
533
  altText?: string | undefined;
533
534
  previewImage?: {
534
535
  url: string;
@@ -544,7 +545,6 @@ export declare const ProductSchema: z.ZodObject<{
544
545
  height?: number | undefined;
545
546
  }[] | undefined;
546
547
  embedUrl?: string | undefined;
547
- host?: string | undefined;
548
548
  }>, "many">>;
549
549
  variants: z.ZodDefault<z.ZodArray<z.ZodObject<{
550
550
  id: z.ZodString;
@@ -716,8 +716,8 @@ export declare const ProductSchema: z.ZodObject<{
716
716
  current: z.ZodDefault<z.ZodBoolean>;
717
717
  }, "strip", z.ZodTypeAny, {
718
718
  id: string;
719
- handle: string;
720
719
  title: string;
720
+ handle: string;
721
721
  available: boolean;
722
722
  color: string;
723
723
  current: boolean;
@@ -730,8 +730,8 @@ export declare const ProductSchema: z.ZodObject<{
730
730
  } | undefined;
731
731
  }, {
732
732
  id: string;
733
- handle: string;
734
733
  title: string;
734
+ handle: string;
735
735
  color: string;
736
736
  available?: boolean | undefined;
737
737
  swatchImage?: {
@@ -792,8 +792,8 @@ export declare const ProductSchema: z.ZodObject<{
792
792
  unavailable: z.ZodDefault<z.ZodBoolean>;
793
793
  }, "strip", z.ZodTypeAny, {
794
794
  id: string;
795
- handle: string;
796
795
  title: string;
796
+ handle: string;
797
797
  unavailable: boolean;
798
798
  description: string;
799
799
  variants: {
@@ -843,6 +843,7 @@ export declare const ProductSchema: z.ZodObject<{
843
843
  width?: number | undefined;
844
844
  height?: number | undefined;
845
845
  }[];
846
+ host?: string | undefined;
846
847
  previewImage?: {
847
848
  url: string;
848
849
  altText: string;
@@ -851,13 +852,12 @@ export declare const ProductSchema: z.ZodObject<{
851
852
  srcSet?: string | undefined;
852
853
  } | undefined;
853
854
  embedUrl?: string | undefined;
854
- host?: string | undefined;
855
855
  }[];
856
856
  availableForSale: boolean;
857
857
  colorVariants: {
858
858
  id: string;
859
- handle: string;
860
859
  title: string;
860
+ handle: string;
861
861
  available: boolean;
862
862
  color: string;
863
863
  current: boolean;
@@ -954,6 +954,7 @@ export declare const ProductSchema: z.ZodObject<{
954
954
  }[] | undefined;
955
955
  videos?: {
956
956
  kind: "hosted" | "external";
957
+ host?: string | undefined;
957
958
  altText?: string | undefined;
958
959
  previewImage?: {
959
960
  url: string;
@@ -969,14 +970,13 @@ export declare const ProductSchema: z.ZodObject<{
969
970
  height?: number | undefined;
970
971
  }[] | undefined;
971
972
  embedUrl?: string | undefined;
972
- host?: string | undefined;
973
973
  }[] | undefined;
974
974
  availableForSale?: boolean | undefined;
975
975
  collections?: string[] | undefined;
976
976
  colorVariants?: {
977
977
  id: string;
978
- handle: string;
979
978
  title: string;
979
+ handle: string;
980
980
  color: string;
981
981
  available?: boolean | undefined;
982
982
  swatchImage?: {
@@ -1088,8 +1088,8 @@ export declare const ArticleSchema: z.ZodObject<{
1088
1088
  tags: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
1089
1089
  }, "strip", z.ZodTypeAny, {
1090
1090
  id: string;
1091
- handle: string;
1092
1091
  title: string;
1092
+ handle: string;
1093
1093
  content: string;
1094
1094
  tags: string[];
1095
1095
  author: string;
@@ -1136,8 +1136,8 @@ export declare const CmsPageSchema: z.ZodObject<{
1136
1136
  seoDescription: z.ZodOptional<z.ZodString>;
1137
1137
  }, "strip", z.ZodTypeAny, {
1138
1138
  id: string;
1139
- handle: string;
1140
1139
  title: string;
1140
+ handle: string;
1141
1141
  body: string;
1142
1142
  bodySummary: string;
1143
1143
  updatedAt: string;
@@ -1182,8 +1182,8 @@ export declare const CmsPolicySchema: z.ZodObject<{
1182
1182
  }, "strip", z.ZodTypeAny, {
1183
1183
  kind: string;
1184
1184
  id: string;
1185
- handle: string;
1186
1185
  title: string;
1186
+ handle: string;
1187
1187
  url: string;
1188
1188
  body: string;
1189
1189
  bodyHtml?: string | undefined;
@@ -1236,8 +1236,8 @@ export declare const CollectionSchema: z.ZodObject<{
1236
1236
  productCount: z.ZodOptional<z.ZodNumber>;
1237
1237
  }, "strip", z.ZodTypeAny, {
1238
1238
  id: string;
1239
- handle: string;
1240
1239
  title: string;
1240
+ handle: string;
1241
1241
  description: string;
1242
1242
  image?: {
1243
1243
  url: string;
@@ -29,26 +29,6 @@ import * as React from 'react';
29
29
  import { z } from 'zod';
30
30
  import { type CatalogEntryStructural } from '../../../spacestation/src/index';
31
31
  import { type BrandComponent } from './component-library';
32
- /**
33
- * A hydrated ENTITY REFERENCE prop.
34
- *
35
- * The agent emits ids (`gid://shopify/Product/123`), never entity bodies — that
36
- * is the ~80% prompt-token saving — and the client hydrates them at the render
37
- * boundary.
38
- *
39
- * `resolverKey` is looked up in the platform HYDRATOR REGISTRY
40
- * (`registerPlatformHydrators`), so this deliberately does NOT take an entity
41
- * schema. A brand naming `'product'` should not also have to import
42
- * `ProductSchema` from `@fourty/ecommerce`: the agent never emits a Product, and
43
- * the hydrated shape the component receives is decided by the hydrator, not the
44
- * brand. Keeping the key opaque here is also what keeps `@fourty/sdk` free of
45
- * any one platform's vocabulary — Shopify registers `product`/`collection`/
46
- * `article`/`page`/`policy`, another platform registers its own, and both get
47
- * this vocabulary for free.
48
- *
49
- * `max: 1` yields a single ref; anything else yields an array, matching
50
- * `resolved()`'s own behaviour.
51
- */
52
32
  export declare function entity(resolverKey: string, opts?: {
53
33
  min?: number;
54
34
  max?: number;
@@ -69,9 +69,10 @@ export interface FourtyPackage {
69
69
  }>;
70
70
  /**
71
71
  * URL of the package's own page stylesheet — set for a package whose CSS is
72
- * PUBLISHED with it rather than compiled into the page that renders it. A
73
- * surface that is not the package's own page (the console's previews) loads
74
- * it into an isolated frame instead of its own document.
72
+ * PUBLISHED with it rather than compiled into the page that renders it.
73
+ * Installed into whatever document or shadow root draws the package
74
+ * (`@fourty/spacefront`'s `PackageScope`); the console never draws one in
75
+ * its own document.
75
76
  */
76
77
  stylesheet?: string;
77
78
  /**
@@ -56,6 +56,7 @@ export declare const HOST_MODULES: {
56
56
  useComposerDraft: typeof sdk.useComposerDraft;
57
57
  FourtySessionContext: react.Context<sdk.FourtySessionContextValue | null>;
58
58
  useAction: typeof sdk.useAction;
59
+ withSignalTurn: typeof sdk.withSignalTurn;
59
60
  getVisitorLocale: typeof sdk.getVisitorLocale;
60
61
  registerSessionScopedClear: typeof sdk.registerSessionScopedClear;
61
62
  runSessionScopedClearHandlers: typeof sdk.runSessionScopedClearHandlers;
@@ -91,6 +92,7 @@ export declare const HOST_MODULES: {
91
92
  THREAD_ROW_ATTR: "data-fourty-thread-row";
92
93
  threadRowAttrs: typeof sdk.threadRowAttrs;
93
94
  useConversationPage: typeof sdk.useConversationPage;
95
+ useConversationPresence: typeof sdk.useConversationPresence;
94
96
  splitAnswer: typeof sdk.splitAnswer;
95
97
  useRegisterSignalHandlers: typeof sdk.useRegisterSignalHandlers;
96
98
  HandlerRegistryContext: react.Context<sdk.HandlerRegistryValue | null>;
@@ -341,6 +343,7 @@ export declare const HOST_MODULES: {
341
343
  useProducts: typeof sdk.useProducts;
342
344
  useCollectionByHandle: typeof sdk.useCollectionByHandle;
343
345
  useProductReviews: typeof sdk.useProductReviews;
346
+ useCustomerAccount: typeof sdk.useCustomerAccount;
344
347
  useCommerceRuntime: typeof sdk.useCommerceRuntime;
345
348
  FourtyCommerceRuntimeProvider: react.Provider<sdk.FourtyCommerceRuntime>;
346
349
  navigateToExternalCommerceUrl: typeof sdk.navigateToExternalCommerceUrl;
@@ -820,6 +823,7 @@ export declare const HOST_MODULES: {
820
823
  };
821
824
  shell: Record<string, unknown>;
822
825
  }>;
826
+ pageIdentityKey: typeof spacestation.pageIdentityKey;
823
827
  CartSnapshotSchema: zod.ZodObject<{
824
828
  lines: zod.ZodArray<zod.ZodObject<{
825
829
  productId: zod.ZodString;
@@ -2193,6 +2197,34 @@ export declare const HOST_MODULES: {
2193
2197
  isLateBound: typeof spacestation.isLateBound;
2194
2198
  isActiveDirective: typeof spacestation.isActiveDirective;
2195
2199
  projectCollection: typeof spacestation.projectCollection;
2200
+ VIEW_HOST_SIGNAL: "view.host";
2201
+ HostPayloadSchema: zod.ZodObject<{
2202
+ page: zod.ZodNullable<zod.ZodType<spacestation.Page, zod.ZodTypeDef, spacestation.Page>>;
2203
+ maxSections: zod.ZodNullable<zod.ZodNumber>;
2204
+ surface: zod.ZodEnum<["page", "slot"]>;
2205
+ }, "strip", zod.ZodTypeAny, {
2206
+ surface: "page" | "slot";
2207
+ page: spacestation.Page | null;
2208
+ maxSections: number | null;
2209
+ }, {
2210
+ surface: "page" | "slot";
2211
+ page: spacestation.Page | null;
2212
+ maxSections: number | null;
2213
+ }>;
2214
+ hostPlace: typeof spacestation.hostPlace;
2215
+ pagePlace: typeof spacestation.pagePlace;
2216
+ hostFillsPage: typeof spacestation.hostFillsPage;
2217
+ HostClearedSchema: zod.ZodObject<{
2218
+ cleared: zod.ZodLiteral<true>;
2219
+ }, "strip", zod.ZodTypeAny, {
2220
+ cleared: true;
2221
+ }, {
2222
+ cleared: true;
2223
+ }>;
2224
+ HOST_CLEARED: {
2225
+ cleared: true;
2226
+ };
2227
+ PAGELESS_HOST_PLACE: "host";
2196
2228
  VIEW_FOCUS_ELEMENT_SIGNAL: "view.focus.element";
2197
2229
  FocusElementPayloadSchema: zod.ZodObject<{
2198
2230
  elementId: zod.ZodString;
@@ -4790,6 +4822,7 @@ export declare const HOST_MODULES: {
4790
4822
  width?: number | undefined;
4791
4823
  height?: number | undefined;
4792
4824
  }[];
4825
+ host?: string | undefined;
4793
4826
  previewImage?: {
4794
4827
  url: string;
4795
4828
  altText: string;
@@ -4798,9 +4831,9 @@ export declare const HOST_MODULES: {
4798
4831
  srcSet?: string | undefined;
4799
4832
  } | undefined;
4800
4833
  embedUrl?: string | undefined;
4801
- host?: string | undefined;
4802
4834
  }, {
4803
4835
  kind: "hosted" | "external";
4836
+ host?: string | undefined;
4804
4837
  altText?: string | undefined;
4805
4838
  previewImage?: {
4806
4839
  url: string;
@@ -4816,7 +4849,6 @@ export declare const HOST_MODULES: {
4816
4849
  height?: number | undefined;
4817
4850
  }[] | undefined;
4818
4851
  embedUrl?: string | undefined;
4819
- host?: string | undefined;
4820
4852
  }>;
4821
4853
  AvailabilityStatusSchema: zod.ZodEnum<["in_stock", "backorder", "preorder", "out_of_stock", "discontinued"]>;
4822
4854
  ProductVariantSchema: zod.ZodObject<{
@@ -4950,8 +4982,8 @@ export declare const HOST_MODULES: {
4950
4982
  current: zod.ZodDefault<zod.ZodBoolean>;
4951
4983
  }, "strip", zod.ZodTypeAny, {
4952
4984
  id: string;
4953
- handle: string;
4954
4985
  title: string;
4986
+ handle: string;
4955
4987
  available: boolean;
4956
4988
  color: string;
4957
4989
  current: boolean;
@@ -4964,8 +4996,8 @@ export declare const HOST_MODULES: {
4964
4996
  } | undefined;
4965
4997
  }, {
4966
4998
  id: string;
4967
- handle: string;
4968
4999
  title: string;
5000
+ handle: string;
4969
5001
  color: string;
4970
5002
  available?: boolean | undefined;
4971
5003
  swatchImage?: {
@@ -5074,6 +5106,7 @@ export declare const HOST_MODULES: {
5074
5106
  width?: number | undefined;
5075
5107
  height?: number | undefined;
5076
5108
  }[];
5109
+ host?: string | undefined;
5077
5110
  previewImage?: {
5078
5111
  url: string;
5079
5112
  altText: string;
@@ -5082,9 +5115,9 @@ export declare const HOST_MODULES: {
5082
5115
  srcSet?: string | undefined;
5083
5116
  } | undefined;
5084
5117
  embedUrl?: string | undefined;
5085
- host?: string | undefined;
5086
5118
  }, {
5087
5119
  kind: "hosted" | "external";
5120
+ host?: string | undefined;
5088
5121
  altText?: string | undefined;
5089
5122
  previewImage?: {
5090
5123
  url: string;
@@ -5100,7 +5133,6 @@ export declare const HOST_MODULES: {
5100
5133
  height?: number | undefined;
5101
5134
  }[] | undefined;
5102
5135
  embedUrl?: string | undefined;
5103
- host?: string | undefined;
5104
5136
  }>, "many">>;
5105
5137
  variants: zod.ZodDefault<zod.ZodArray<zod.ZodObject<{
5106
5138
  id: zod.ZodString;
@@ -5245,8 +5277,8 @@ export declare const HOST_MODULES: {
5245
5277
  current: zod.ZodDefault<zod.ZodBoolean>;
5246
5278
  }, "strip", zod.ZodTypeAny, {
5247
5279
  id: string;
5248
- handle: string;
5249
5280
  title: string;
5281
+ handle: string;
5250
5282
  available: boolean;
5251
5283
  color: string;
5252
5284
  current: boolean;
@@ -5259,8 +5291,8 @@ export declare const HOST_MODULES: {
5259
5291
  } | undefined;
5260
5292
  }, {
5261
5293
  id: string;
5262
- handle: string;
5263
5294
  title: string;
5295
+ handle: string;
5264
5296
  color: string;
5265
5297
  available?: boolean | undefined;
5266
5298
  swatchImage?: {
@@ -5304,8 +5336,8 @@ export declare const HOST_MODULES: {
5304
5336
  unavailable: zod.ZodDefault<zod.ZodBoolean>;
5305
5337
  }, "strip", zod.ZodTypeAny, {
5306
5338
  id: string;
5307
- handle: string;
5308
5339
  title: string;
5340
+ handle: string;
5309
5341
  unavailable: boolean;
5310
5342
  description: string;
5311
5343
  variants: {
@@ -5355,6 +5387,7 @@ export declare const HOST_MODULES: {
5355
5387
  width?: number | undefined;
5356
5388
  height?: number | undefined;
5357
5389
  }[];
5390
+ host?: string | undefined;
5358
5391
  previewImage?: {
5359
5392
  url: string;
5360
5393
  altText: string;
@@ -5363,13 +5396,12 @@ export declare const HOST_MODULES: {
5363
5396
  srcSet?: string | undefined;
5364
5397
  } | undefined;
5365
5398
  embedUrl?: string | undefined;
5366
- host?: string | undefined;
5367
5399
  }[];
5368
5400
  availableForSale: boolean;
5369
5401
  colorVariants: {
5370
5402
  id: string;
5371
- handle: string;
5372
5403
  title: string;
5404
+ handle: string;
5373
5405
  available: boolean;
5374
5406
  color: string;
5375
5407
  current: boolean;
@@ -5466,6 +5498,7 @@ export declare const HOST_MODULES: {
5466
5498
  }[] | undefined;
5467
5499
  videos?: {
5468
5500
  kind: "hosted" | "external";
5501
+ host?: string | undefined;
5469
5502
  altText?: string | undefined;
5470
5503
  previewImage?: {
5471
5504
  url: string;
@@ -5481,14 +5514,13 @@ export declare const HOST_MODULES: {
5481
5514
  height?: number | undefined;
5482
5515
  }[] | undefined;
5483
5516
  embedUrl?: string | undefined;
5484
- host?: string | undefined;
5485
5517
  }[] | undefined;
5486
5518
  availableForSale?: boolean | undefined;
5487
5519
  collections?: string[] | undefined;
5488
5520
  colorVariants?: {
5489
5521
  id: string;
5490
- handle: string;
5491
5522
  title: string;
5523
+ handle: string;
5492
5524
  color: string;
5493
5525
  available?: boolean | undefined;
5494
5526
  swatchImage?: {
@@ -5562,8 +5594,8 @@ export declare const HOST_MODULES: {
5562
5594
  tags: zod.ZodDefault<zod.ZodArray<zod.ZodString, "many">>;
5563
5595
  }, "strip", zod.ZodTypeAny, {
5564
5596
  id: string;
5565
- handle: string;
5566
5597
  title: string;
5598
+ handle: string;
5567
5599
  content: string;
5568
5600
  tags: string[];
5569
5601
  author: string;
@@ -5609,8 +5641,8 @@ export declare const HOST_MODULES: {
5609
5641
  seoDescription: zod.ZodOptional<zod.ZodString>;
5610
5642
  }, "strip", zod.ZodTypeAny, {
5611
5643
  id: string;
5612
- handle: string;
5613
5644
  title: string;
5645
+ handle: string;
5614
5646
  body: string;
5615
5647
  bodySummary: string;
5616
5648
  updatedAt: string;
@@ -5639,8 +5671,8 @@ export declare const HOST_MODULES: {
5639
5671
  }, "strip", zod.ZodTypeAny, {
5640
5672
  kind: string;
5641
5673
  id: string;
5642
- handle: string;
5643
5674
  title: string;
5675
+ handle: string;
5644
5676
  url: string;
5645
5677
  body: string;
5646
5678
  bodyHtml?: string | undefined;
@@ -5680,8 +5712,8 @@ export declare const HOST_MODULES: {
5680
5712
  productCount: zod.ZodOptional<zod.ZodNumber>;
5681
5713
  }, "strip", zod.ZodTypeAny, {
5682
5714
  id: string;
5683
- handle: string;
5684
5715
  title: string;
5716
+ handle: string;
5685
5717
  description: string;
5686
5718
  image?: {
5687
5719
  url: string;
@@ -1,4 +1,5 @@
1
1
  export { useFourtySession, useOptionalFourtySession, useComposerDraft, FourtySessionContext, type FourtySessionContextValue, } from './FourtySessionContext';
2
2
  export { useAction } from './use-action';
3
+ export { withSignalTurn } from './turn-attributed-session';
3
4
  export { getVisitorLocale } from './visitor-locale';
4
5
  export { registerSessionScopedClear, runSessionScopedClearHandlers } from './clear-registry';
@@ -1,4 +1,9 @@
1
+ import { type AgentSignal } from '../../../spacestation/src/index';
1
2
  import type { FourtySessionContextValue } from './FourtySessionContext';
3
+ /** Stamp `turnId` onto a turn-attributed signal's payload; every other signal,
4
+ * and one already carrying a turn, passes through unchanged. Also used at the
5
+ * agent's own signal boundary (`FourtyProvider`), where the turn is the live one. */
6
+ export declare function withSignalTurn<T extends AgentSignal>(signal: T, turnId: string): T;
2
7
  /** The session as a component inside a canvas element sees it: its outcome
3
8
  * signals carry that element's turn. Outside a turn, the session unchanged. */
4
9
  export declare function useTurnAttributedSession(session: FourtySessionContextValue | null): FourtySessionContextValue | null;
@@ -1,4 +1,5 @@
1
1
  export { useConversationPage } from './use-conversation-page';
2
2
  export type { ConversationPage, ConversationCrumb, ConversationPhase, ConversationPlace, ConversationTurn } from './use-conversation-page';
3
+ export { useConversationPresence } from './use-conversation-presence';
3
4
  export type { ConversationActivity, ConversationFact, ConversationPresence } from './use-conversation-presence';
4
5
  export { splitAnswer, type AnswerText } from './answer-text';
@@ -1,6 +1,6 @@
1
1
  import type { Product } from '../../../../ecommerce/src/index';
2
- export type { AddToCartApi, CartAddHints, CartAddOptions, CartApi, ProductReviewHighlight, ProductReviewItem, ProductReviewsResult, ProductsQuery, ToggleWishlistApi, WishlistApi, WishlistState, } from './commerce-shapes';
3
- import type { AddToCartApi, CartAddHints, CartApi, ProductReviewsResult, ProductsQuery, ToggleWishlistApi, WishlistApi } from './commerce-shapes';
2
+ export type { AddToCartApi, CartAddHints, CartAddOptions, CartApi, CustomerAccountApi, ProductReviewHighlight, ProductReviewItem, ProductReviewsResult, ProductsQuery, ToggleWishlistApi, WishlistApi, WishlistState, } from './commerce-shapes';
3
+ import type { AddToCartApi, CartAddHints, CartApi, CustomerAccountApi, ProductReviewsResult, ProductsQuery, ToggleWishlistApi, WishlistApi } from './commerce-shapes';
4
4
  /**
5
5
  * FourtyCommerceRuntime — the commerce-hook surface the catalog
6
6
  * consumes. Same dependency-inversion pattern as `FourtyRuntime`: these
@@ -28,6 +28,7 @@ export interface FourtyCommerceRuntime {
28
28
  * reviews yet is generated on demand server-side from its title +
29
29
  * description, so the hook needs that context, not just the id. */
30
30
  useProductReviews: (product: Product | undefined, intent?: string) => ProductReviewsResult;
31
+ useCustomerAccount: () => CustomerAccountApi;
31
32
  }
32
33
  /**
33
34
  * Provider for the commerce-hook surface. Mounted by the SDK's
@@ -60,3 +61,6 @@ export declare function useCollectionByHandle(handle: string | undefined): Produ
60
61
  * a separate, third-party-shaped system, independent of the active
61
62
  * commerce platform. Degrades to empty without a `<CommerceProvider>`. */
62
63
  export declare function useProductReviews(product: Product | undefined, intent?: string): ProductReviewsResult;
64
+ /** The visitor's sign-in to the store's customer accounts. Inert (not
65
+ * available) without a `<CommerceProvider>`. */
66
+ export declare function useCustomerAccount(): CustomerAccountApi;
@@ -171,3 +171,19 @@ export interface ProductReviewsResult {
171
171
  isLoading: boolean;
172
172
  error: Error | null;
173
173
  }
174
+ /** Return shape of the commerce `useCustomerAccount` hook — the visitor's
175
+ * sign-in to the store's own customer accounts, for this session. The token
176
+ * never reaches the page: this is only whether they are signed in, and as whom. */
177
+ export interface CustomerAccountApi {
178
+ /** `null` until the first check answers. */
179
+ signedIn: boolean | null;
180
+ /** Who is signed in, when they are. */
181
+ email: string | null;
182
+ /** Leave for the store's sign-in; the page comes back signed in. */
183
+ signIn: () => void;
184
+ /** Drop this session's sign-in. */
185
+ signOut: () => Promise<void>;
186
+ /** False where the page has no customer sign-in to offer (no session yet,
187
+ * or a space addressed by id, as in a console preview). */
188
+ available: boolean;
189
+ }
@@ -1,6 +1,6 @@
1
1
  import './chip-relevance';
2
- export { useCart, useAddToCart, useWishlist, useToggleWishlist, useProducts, useCollectionByHandle, useProductReviews, useCommerceRuntime, FourtyCommerceRuntimeProvider, } from './commerce-context';
3
- export type { FourtyCommerceRuntime, CartApi, AddToCartApi, WishlistApi, ToggleWishlistApi, ProductsQuery, ProductReviewItem, ProductReviewHighlight, ProductReviewsResult, CartAddOptions, CartAddHints, WishlistState, } from './commerce-context';
2
+ export { useCart, useAddToCart, useWishlist, useToggleWishlist, useProducts, useCollectionByHandle, useProductReviews, useCustomerAccount, useCommerceRuntime, FourtyCommerceRuntimeProvider, } from './commerce-context';
3
+ export type { FourtyCommerceRuntime, CartApi, AddToCartApi, WishlistApi, ToggleWishlistApi, ProductsQuery, ProductReviewItem, ProductReviewHighlight, ProductReviewsResult, CustomerAccountApi, CartAddOptions, CartAddHints, WishlistState, } from './commerce-context';
4
4
  export { navigateToExternalCommerceUrl } from './checkout/external-navigation';
5
5
  export type { ExternalNavigationResult } from './checkout/external-navigation';
6
6
  export { recordVariantSelection, getVariantSelection, useVariantSelections, } from './variant/variant-selection-store';
@@ -58,7 +58,8 @@ export declare const CartAddSignalPayloadSchema: z.ZodObject<{
58
58
  /**
59
59
  * The agent turn whose canvas element the add came from — stamped by the sdk
60
60
  * session hooks for a producer inside a turn (`turn-attributed-session.ts`),
61
- * absent for one outside any (the agent's own add, the header cart, WebMCP).
61
+ * stamped with the live turn for the agent's own add (`FourtyProvider`),
62
+ * absent for one outside any (the header cart, WebMCP).
62
63
  * Carried for the same reason as `origin`: the handler that emits the outcome
63
64
  * sees only this payload.
64
65
  */
@@ -11,6 +11,13 @@ declare module '../layout/page' {
11
11
  * this unset so it navigates normally.
12
12
  */
13
13
  morph?: boolean;
14
+ /**
15
+ * The product's display title, when the page's producer already holds it
16
+ * — a host page (`host/host-page.ts`) carries it, because the storefront
17
+ * rendering the product knows its name while the agent's entity registry
18
+ * has never seen it. Advisory: the id is the identity.
19
+ */
20
+ title?: string;
14
21
  };
15
22
  collection: {
16
23
  handle: string;
@@ -71,6 +71,15 @@ export interface FourtyToolDefDescriptor {
71
71
  * on) takes precedence.
72
72
  */
73
73
  defaultEnabled?: boolean;
74
+ /**
75
+ * Whether a session may replay this tool's result for an identical call.
76
+ * Absent = `true`: the registry's per-session cache answers a repeat
77
+ * `(name, args)` without running the tool. Set `false` for a tool whose
78
+ * answer follows visitor state that changes mid-session with the same args
79
+ * — a signed-in shopper's account reads "not signed in" until they sign in,
80
+ * and a replay would keep saying so after they have.
81
+ */
82
+ cacheResults?: boolean;
74
83
  /**
75
84
  * Declarative absorb shape — when present, the agent's per-session
76
85
  * entity registry harvests entries from this tool's result without
@@ -0,0 +1,62 @@
1
+ import { z } from 'zod';
2
+ import { type Page } from '../layout/page';
3
+ /** Signal type — the embed sends the page it is mounted on. */
4
+ export declare const VIEW_HOST_SIGNAL = "view.host";
5
+ /**
6
+ * Payload, both fields always present so every frame states the whole host:
7
+ * - `page` — the host page, as a registered `Page` kind, or `null` when the
8
+ * embed no longer sits on a page with a subject (the session drops the page
9
+ * it held; it would otherwise answer about a product the visitor left).
10
+ * - `maxSections` — the most top-level sections the canvas may hold, or
11
+ * `null` when the host sets no limit.
12
+ * - `surface` — what the host gives the canvas: `'page'`, the page itself
13
+ * (a page made for asking — the canvas opens on the space's welcome layout
14
+ * and draws the brand's canvas frame), or `'slot'`, a place among the
15
+ * host's own sections (empty until it has an answer). Declared on its own,
16
+ * not read off `maxSections`: how much room and what kind of room are two
17
+ * different questions.
18
+ */
19
+ export declare const HostPayloadSchema: z.ZodObject<{
20
+ page: z.ZodNullable<z.ZodType<Page, z.ZodTypeDef, Page>>;
21
+ maxSections: z.ZodNullable<z.ZodNumber>;
22
+ surface: z.ZodEnum<["page", "slot"]>;
23
+ }, "strip", z.ZodTypeAny, {
24
+ surface: "page" | "slot";
25
+ page: Page | null;
26
+ maxSections: number | null;
27
+ }, {
28
+ surface: "page" | "slot";
29
+ page: Page | null;
30
+ maxSections: number | null;
31
+ }>;
32
+ export type HostPayload = z.infer<typeof HostPayloadSchema>;
33
+ /**
34
+ * The frame the embed sends ONCE when it leaves its host — the session then has
35
+ * no host. Its own shape, never a host with nothing declared: an island on a
36
+ * page that names no page and gives no slot (a store's home, search or cart) is
37
+ * still a host page — its canvas is the page-less place's — and a write from it
38
+ * must be filed there, not on whichever page the session holds live.
39
+ */
40
+ export declare const HostClearedSchema: z.ZodObject<{
41
+ cleared: z.ZodLiteral<true>;
42
+ }, "strip", z.ZodTypeAny, {
43
+ cleared: true;
44
+ }, {
45
+ cleared: true;
46
+ }>;
47
+ export type HostCleared = z.infer<typeof HostClearedSchema>;
48
+ export declare const HOST_CLEARED: HostCleared;
49
+ /** Whether the host gives the canvas the whole page (`surface: 'page'`) rather than a slot in its own. */
50
+ export declare function hostFillsPage(host: HostPayload): boolean;
51
+ /** The place of a host that names no page — one canvas shared by every such page. */
52
+ export declare const PAGELESS_HOST_PLACE = "host";
53
+ /**
54
+ * The PLACE a host's canvas belongs to: the host page's identity
55
+ * (`pageIdentityKey` — `product:id=gid://…`, `cms:handle=ask`), the same key
56
+ * the client canvas uses for "the same page". The client restores the canvas
57
+ * of this place and the server parks / restores canvases under it, so both
58
+ * sides must derive it here and nowhere else.
59
+ */
60
+ export declare function hostPlace(host: HostPayload): string;
61
+ /** The place of a host page — `hostPlace` for a caller that holds only the page (the page-entry route). */
62
+ export declare function pagePlace(page: Page | null): string;