@40rty/ams-sdk 0.5.18 → 0.5.19

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.
@@ -1848,6 +1848,24 @@ export interface StoreAnswer {
1848
1848
  seller: string;
1849
1849
  answer: string;
1850
1850
  }
1851
+ /**
1852
+ * A whole bag paid in ONE checkout through Shop, what a marketplace space's
1853
+ * unified checkout answers (`useShopCheckout`). `combined`: every store's lines
1854
+ * are in one Shop Pay checkout at `continueUrl` (Shopify Universal Checkout).
1855
+ * `separate`: one checkout was not possible (`reason`), so each store's lines
1856
+ * are paid at that store's own Shop checkout, in `stores`. `stores` always
1857
+ * names every store's share, so a surface can show who sells what either way.
1858
+ * `continueUrl` and each `checkoutUrl` open a live checkout session: never log them.
1859
+ */
1860
+ export type ShopCheckoutResult = {
1861
+ status: 'combined';
1862
+ continueUrl: string;
1863
+ stores: StoreCheckout[];
1864
+ } | {
1865
+ status: 'separate';
1866
+ reason: string;
1867
+ stores: StoreCheckout[];
1868
+ };
1851
1869
  /** The backend-accepted cart, or null when all we hold is an optimistic
1852
1870
  * paint. The single predicate for "is there a cart id the backend knows?" —
1853
1871
  * every cart mutation needs it before it can talk to the backend. */
@@ -11,6 +11,8 @@ export { buildPdpCompanionsConfig, readPdpCompanions } from './pdp-companions';
11
11
  export { buildBaseAttributesConfig, readBaseAttributesConfig } from './base-attributes';
12
12
  export { buildBucketLabelsConfig, readBucketLabelsConfig } from './bucket-labels';
13
13
  export { registerProductNameLookup, resolveProductNameLookup, clearProductNameLookups, type ProductNameLookup, type ProductNameLookupFactory, type ProductNameMatch, } from './product-lookup';
14
+ export { registerStoreArticleLookup, resolveStoreArticleLookup, clearStoreArticleLookups, type StoreArticle, type StoreArticleLookup, type StoreArticleLookupFactory, } from './store-articles';
15
+ export { registerShopCheckout, resolveShopCheckout, clearShopCheckouts, type ShopCheckoutLine, type ShopCheckoutMaker, type ShopCheckoutFactory, } from './shop-checkout';
14
16
  export { registerCodeDiscountSource, resolveCodeDiscountSource, clearCodeDiscountSources, type CodeDiscountSource, type CodeDiscountSourceFactory, type CodeDiscountTerms, type StoreCodeDiscount, } from './code-discounts';
15
17
  export { registerStoreThemeSource, resolveStoreThemeSource, clearStoreThemeSources, StoreThemeAccessError, type StoreThemeSource, type StoreThemeSourceFactory, type StoreThemeFile, type StoreThemeFilesPage, type StoreThemeProduct, } from './store-theme';
16
18
  export { installmentOffer, installmentPayment, type InstallmentTerm, type InstallmentPlan, type InstallmentPlans, type InstallmentQuote, type InstallmentOffer, } from './installment-offer';
@@ -0,0 +1,21 @@
1
+ /**
2
+ * One checkout for a bag that spans several stores. A marketplace platform
3
+ * registers how it makes one (the shopify-catalog platform: a Shop cart per
4
+ * store joined by Shopify Universal Checkout); the space route resolves it by
5
+ * the space's platform config and never names a vendor (architecture §IX).
6
+ */
7
+ import type { ShopCheckoutResult } from './commerce-schemas';
8
+ /** One line of the bag: the cart line it came from, the variant, how many. */
9
+ export interface ShopCheckoutLine {
10
+ lineId: string;
11
+ variantId: string;
12
+ quantity: number;
13
+ }
14
+ export type ShopCheckoutMaker = (lines: ReadonlyArray<ShopCheckoutLine>) => Promise<ShopCheckoutResult>;
15
+ /** A maker for a space's platform config, or `undefined` when the platform is not this factory's. */
16
+ export type ShopCheckoutFactory = (platformConfig: unknown) => ShopCheckoutMaker | undefined;
17
+ export declare function registerShopCheckout(factory: ShopCheckoutFactory): void;
18
+ /** First registered factory that claims this platform config. */
19
+ export declare function resolveShopCheckout(platformConfig: unknown): ShopCheckoutMaker | undefined;
20
+ /** Test seam: drops every registration. */
21
+ export declare function clearShopCheckouts(): void;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Articles the selling stores published themselves (their own blogs), for a
3
+ * space whose products come from many stores: "what to wear to a beach
4
+ * wedding" from the store that sells the shirt, linen care from the store that
5
+ * sells the trousers.
6
+ *
7
+ * The lookup is INJECTED (§IX), like the product-name lookup: the platform
8
+ * binding that knows where a product's store lives registers one, and the
9
+ * route that serves it never names a platform. A space whose options no
10
+ * factory claims has no store articles.
11
+ */
12
+ /** One article as the store published it. Nothing here is written by us. */
13
+ export interface StoreArticle {
14
+ /** The store's name. */
15
+ seller: string;
16
+ /** The article on the store's own site. */
17
+ url: string;
18
+ title: string;
19
+ /** The store's share image for the article; empty when it set none. */
20
+ image: string;
21
+ /** The store's own summary, else the article's opening text. */
22
+ excerpt: string;
23
+ /** The article's sentences that mention the topic, best first (may be empty). */
24
+ passages: string[];
25
+ }
26
+ /** The articles relevant to `topic` from the stores selling `productIds`, best first. */
27
+ export type StoreArticleLookup = (productIds: ReadonlyArray<string>, topic: string) => Promise<StoreArticle[]>;
28
+ /** A lookup for a space's platform config, or `undefined` when the platform is not this factory's. */
29
+ export type StoreArticleLookupFactory = (platformConfig: unknown) => StoreArticleLookup | undefined;
30
+ export declare function registerStoreArticleLookup(factory: StoreArticleLookupFactory): void;
31
+ /** First registered factory that claims this platform config. */
32
+ export declare function resolveStoreArticleLookup(platformConfig: unknown): StoreArticleLookup | undefined;
33
+ /** Test seam: drops every registration. */
34
+ export declare function clearStoreArticleLookups(): void;
@@ -1,3 +1,4 @@
1
+ import type { Spec } from '../../../spacestation/src/index';
1
2
  /**
2
3
  * Per-element SDK identity context. Provided by HydratedComponent for every
3
4
  * rendered layout element. Components that need the element ID for SDK signals
@@ -11,3 +12,10 @@ export declare const ElementIdContext: import("react").Context<string | null>;
11
12
  * rendered outside a HydratedComponent (e.g. Storybook, tests).
12
13
  */
13
14
  export declare function useElementId(): string | null;
15
+ /**
16
+ * The layout the current element was rendered from. On a stacked canvas (`stackedTurns`) an earlier turn's blocks
17
+ * render from that turn's own layout, not the live one, so a block that reads its own stamp or its page's other
18
+ * blocks reads them here. `null` outside a HydratedComponent.
19
+ */
20
+ export declare const ElementLayoutContext: import("react").Context<Spec | null>;
21
+ export declare function useElementLayout(): Spec | null;
@@ -5,16 +5,23 @@ export interface CanvasArrangementValue {
5
5
  /** One page per turn: a turn that answers something new shows only its own
6
6
  * blocks; one that only adds (`extendsPage` blocks) keeps the page. */
7
7
  turnPages: boolean;
8
+ /** Every turn's page stacked on one continuous page, oldest first, each held at
9
+ * the layout its turn ended on: a turn that composes a new page appends below
10
+ * the earlier ones instead of replacing them. */
11
+ stackedTurns: boolean;
8
12
  }
9
13
  /**
10
14
  * How the canvas arranges the agent's top-level blocks. A brand shell mounts
11
15
  * this around its canvas (`'bento'` → a 12-column grid packed from each
12
- * block's catalog `size`; `turnPages` → each turn its own page); the engine
13
- * reads it. The agent is unaware of it.
16
+ * block's catalog `size`; `turnPages` → each turn its own page; `stackedTurns` →
17
+ * every turn's page kept, stacked in order, the newest appended at the end); the
18
+ * engine reads it. `stackedTurns` is for the stack arrangement and excludes
19
+ * `turnPages`. The agent is unaware of it.
14
20
  */
15
- export declare function CanvasArrangementProvider({ arrangement, turnPages, children, }: {
21
+ export declare function CanvasArrangementProvider({ arrangement, turnPages, stackedTurns, children, }: {
16
22
  arrangement: CanvasArrangement;
17
23
  turnPages?: boolean;
24
+ stackedTurns?: boolean;
18
25
  children: React.ReactNode;
19
26
  }): import("react/jsx-runtime").JSX.Element;
20
27
  export declare function useCanvasArrangement(): CanvasArrangementValue;
@@ -0,0 +1,44 @@
1
+ import * as React from 'react';
2
+ /** What a turn tail is told about the turn it closes. */
3
+ export interface CanvasTurnTailProps {
4
+ /** The turn's message id: the `__turnId` every block it placed carries. */
5
+ turnKey: string;
6
+ /** The conversation's newest turn: the one streaming, else the last committed one. */
7
+ isNewest: boolean;
8
+ /** The turn is streaming right now. */
9
+ live: boolean;
10
+ /** The turn has placed blocks on its page (read from the turn's own page, so it holds for an earlier turn whose
11
+ * blocks a later turn's page no longer carries). */
12
+ placed: boolean;
13
+ }
14
+ export type CanvasTurnTailComponent = React.ComponentType<CanvasTurnTailProps>;
15
+ /** The DOM attribute on each rendered turn tail, carrying its turn key. */
16
+ export declare const TURN_TAIL_ATTR = "data-fourty-turn-tail";
17
+ /**
18
+ * A brand's content AFTER each turn's blocks, inside the canvas flow: the
19
+ * engine renders `tail` right after a turn's last top-level block (and, for the
20
+ * newest turn while it has no block yet, at the end of the page), so what a
21
+ * brand keeps under an answer (an endless feed, the turn's thinking state)
22
+ * stays in place when a later turn appends below it. `placed` says whether the
23
+ * turn has blocks on its own page. Mount around
24
+ * `<SpacefrontCanvas />`. Stack arrangement only (a bento grid places blocks
25
+ * by size and has no slot for it). No provider, no tails: the canvas renders as
26
+ * before. On a new turn the engine glides the new turn's tail into view, only
27
+ * ever downwards.
28
+ */
29
+ export declare function CanvasTurnTailProvider({ tail, children, }: {
30
+ tail: CanvasTurnTailComponent;
31
+ children: React.ReactNode;
32
+ }): React.ReactElement;
33
+ export declare function useCanvasTurnTail(): CanvasTurnTailComponent | null;
34
+ /**
35
+ * Where turn tails go in a root block list: after the last block of each turn,
36
+ * and for the newest turn with no block of its own, at the end. `turnOf` names
37
+ * a block's turn (undefined for a block no turn placed, e.g. a welcome section).
38
+ * Returns, per position in `keys`, the turn whose tail follows it, plus the
39
+ * turn whose tail closes the list.
40
+ */
41
+ export declare function turnTailSlots(keys: readonly string[], turnOf: (key: string) => string | undefined, newest: string | null): {
42
+ after: ReadonlyMap<number, string>;
43
+ end: string | null;
44
+ };
@@ -7,8 +7,9 @@ export { ShimmerSweep, type ShimmerSweepProps } from './ShimmerSweep';
7
7
  export { FadeTransition, TransitionProvider, useLayoutTransition, type LayoutTransitionItemProps, type LayoutTransitionGroupProps, type LayoutTransition, } from './TransitionContext';
8
8
  export { CanvasArrangementProvider, useCanvasArrangement, type CanvasArrangementValue } from './canvas-arrangement';
9
9
  export { CanvasLeadProvider, CanvasLeadSlot, useCanvasLead, useCanvasLeadTarget, type CanvasLeadRule } from './canvas-lead';
10
+ export { CanvasTurnTailProvider, useCanvasTurnTail, turnTailSlots, TURN_TAIL_ATTR, type CanvasTurnTailComponent, type CanvasTurnTailProps } from './canvas-turn-tail';
10
11
  export { CanvasMotionStyleProvider, useCanvasMotionStyle, type CanvasMotionStyle } from './canvas-motion-style';
11
- export { ElementIdContext, useElementId } from './ElementIdContext';
12
+ export { ElementIdContext, ElementLayoutContext, useElementId, useElementLayout } from './ElementIdContext';
12
13
  export { buildEntranceProps, type EntranceMotionProps } from './generation-entrance';
13
14
  export { INITIAL_NAV_PRESENTATION, type NavDirection, type NavPace, type NavPresentation, } from './nav-direction';
14
15
  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';
@@ -104,6 +104,7 @@ export declare const HOST_MODULES: {
104
104
  ATTACHMENT_ACCEPT: string;
105
105
  usePromptComposer: typeof sdk.usePromptComposer;
106
106
  useComposerChipSelect: typeof sdk.useComposerChipSelect;
107
+ useAskAbout: typeof sdk.useAskAbout;
107
108
  useTurnAskReply: typeof sdk.useTurnAskReply;
108
109
  TurnAskPlacementProvider: typeof sdk.TurnAskPlacementProvider;
109
110
  useTurnAskPlacement: typeof sdk.useTurnAskPlacement;
@@ -180,10 +181,16 @@ export declare const HOST_MODULES: {
180
181
  CanvasLeadSlot: typeof sdk.CanvasLeadSlot;
181
182
  useCanvasLead: typeof sdk.useCanvasLead;
182
183
  useCanvasLeadTarget: typeof sdk.useCanvasLeadTarget;
184
+ CanvasTurnTailProvider: typeof sdk.CanvasTurnTailProvider;
185
+ useCanvasTurnTail: typeof sdk.useCanvasTurnTail;
186
+ turnTailSlots: typeof sdk.turnTailSlots;
187
+ TURN_TAIL_ATTR: "data-fourty-turn-tail";
183
188
  CanvasMotionStyleProvider: typeof sdk.CanvasMotionStyleProvider;
184
189
  useCanvasMotionStyle: typeof sdk.useCanvasMotionStyle;
185
190
  ElementIdContext: react.Context<string | null>;
191
+ ElementLayoutContext: react.Context<spacestation.Spec | null>;
186
192
  useElementId: typeof sdk.useElementId;
193
+ useElementLayout: typeof sdk.useElementLayout;
187
194
  buildEntranceProps: typeof sdk.buildEntranceProps;
188
195
  INITIAL_NAV_PRESENTATION: sdk.NavPresentation;
189
196
  DEFAULT_GENERATION_TIMINGS: sdk.GenerationTimings;
@@ -383,6 +390,9 @@ export declare const HOST_MODULES: {
383
390
  useInstallmentOffer: typeof sdk.useInstallmentOffer;
384
391
  useStoreCheckouts: typeof sdk.useStoreCheckouts;
385
392
  useAskStore: typeof sdk.useAskStore;
393
+ useStoreArticles: typeof sdk.useStoreArticles;
394
+ useShopCheckout: typeof sdk.useShopCheckout;
395
+ useProductSearch: typeof sdk.useProductSearch;
386
396
  useCommerceRuntime: typeof sdk.useCommerceRuntime;
387
397
  FourtyCommerceRuntimeProvider: react.Provider<sdk.FourtyCommerceRuntime>;
388
398
  navigateToExternalCommerceUrl: typeof sdk.navigateToExternalCommerceUrl;
@@ -1166,6 +1176,83 @@ export declare const HOST_MODULES: {
1166
1176
  EPHEMERAL_FACT_FLOWS: readonly string[];
1167
1177
  CHIP_SHOW_SIGNAL: "chip.show";
1168
1178
  chipsFromShowSignal: typeof spacestation.chipsFromShowSignal;
1179
+ ATTENTION_NAMESPACE: "attention";
1180
+ POINTING_NAMESPACE: "pointing";
1181
+ AttentionSchema: zod.ZodObject<{
1182
+ onScreen: zod.ZodArray<zod.ZodObject<{
1183
+ ref: zod.ZodOptional<zod.ZodString>;
1184
+ label: zod.ZodString;
1185
+ note: zod.ZodOptional<zod.ZodString>;
1186
+ }, "strip", zod.ZodTypeAny, {
1187
+ label: string;
1188
+ ref?: string | undefined;
1189
+ note?: string | undefined;
1190
+ }, {
1191
+ label: string;
1192
+ ref?: string | undefined;
1193
+ note?: string | undefined;
1194
+ }>, "many">;
1195
+ lingered: zod.ZodArray<zod.ZodObject<{
1196
+ ref: zod.ZodOptional<zod.ZodString>;
1197
+ label: zod.ZodString;
1198
+ note: zod.ZodOptional<zod.ZodString>;
1199
+ } & {
1200
+ seconds: zod.ZodNumber;
1201
+ }, "strip", zod.ZodTypeAny, {
1202
+ label: string;
1203
+ seconds: number;
1204
+ ref?: string | undefined;
1205
+ note?: string | undefined;
1206
+ }, {
1207
+ label: string;
1208
+ seconds: number;
1209
+ ref?: string | undefined;
1210
+ note?: string | undefined;
1211
+ }>, "many">;
1212
+ passed: zod.ZodArray<zod.ZodString, "many">;
1213
+ }, "strip", zod.ZodTypeAny, {
1214
+ onScreen: {
1215
+ label: string;
1216
+ ref?: string | undefined;
1217
+ note?: string | undefined;
1218
+ }[];
1219
+ lingered: {
1220
+ label: string;
1221
+ seconds: number;
1222
+ ref?: string | undefined;
1223
+ note?: string | undefined;
1224
+ }[];
1225
+ passed: string[];
1226
+ }, {
1227
+ onScreen: {
1228
+ label: string;
1229
+ ref?: string | undefined;
1230
+ note?: string | undefined;
1231
+ }[];
1232
+ lingered: {
1233
+ label: string;
1234
+ seconds: number;
1235
+ ref?: string | undefined;
1236
+ note?: string | undefined;
1237
+ }[];
1238
+ passed: string[];
1239
+ }>;
1240
+ PointedAtSchema: zod.ZodObject<{
1241
+ ref: zod.ZodOptional<zod.ZodString>;
1242
+ label: zod.ZodString;
1243
+ field: zod.ZodString;
1244
+ value: zod.ZodOptional<zod.ZodString>;
1245
+ }, "strip", zod.ZodTypeAny, {
1246
+ field: string;
1247
+ label: string;
1248
+ value?: string | undefined;
1249
+ ref?: string | undefined;
1250
+ }, {
1251
+ field: string;
1252
+ label: string;
1253
+ value?: string | undefined;
1254
+ ref?: string | undefined;
1255
+ }>;
1169
1256
  TURN_ASK_SIGNAL: "turn.ask";
1170
1257
  TurnAskSchema: zod.ZodUnion<[zod.ZodEffects<zod.ZodEffects<zod.ZodEffects<zod.ZodObject<{
1171
1258
  kind: zod.ZodEnum<["choice", "open"]>;
@@ -3249,16 +3336,16 @@ export declare const HOST_MODULES: {
3249
3336
  createdAt: zod.ZodString;
3250
3337
  }, "strip", zod.ZodTypeAny, {
3251
3338
  id: string;
3339
+ note: string | null;
3252
3340
  createdAt: string;
3253
3341
  verdict: "viewed" | "bug";
3254
3342
  reviewer: string;
3255
- note: string | null;
3256
3343
  }, {
3257
3344
  id: string;
3345
+ note: string | null;
3258
3346
  createdAt: string;
3259
3347
  verdict: "viewed" | "bug";
3260
3348
  reviewer: string;
3261
- note: string | null;
3262
3349
  }>;
3263
3350
  BugSeveritySchema: zod.ZodEnum<["high", "medium", "low"]>;
3264
3351
  BugLocationSchema: zod.ZodEffects<zod.ZodObject<{
@@ -4183,16 +4270,16 @@ export declare const HOST_MODULES: {
4183
4270
  createdAt: zod.ZodString;
4184
4271
  }, "strip", zod.ZodTypeAny, {
4185
4272
  id: string;
4273
+ note: string | null;
4186
4274
  createdAt: string;
4187
4275
  verdict: "viewed" | "bug";
4188
4276
  reviewer: string;
4189
- note: string | null;
4190
4277
  }, {
4191
4278
  id: string;
4279
+ note: string | null;
4192
4280
  createdAt: string;
4193
4281
  verdict: "viewed" | "bug";
4194
4282
  reviewer: string;
4195
- note: string | null;
4196
4283
  }>, "many">;
4197
4284
  bugs: zod.ZodArray<zod.ZodObject<{
4198
4285
  id: zod.ZodString;
@@ -4451,10 +4538,10 @@ export declare const HOST_MODULES: {
4451
4538
  };
4452
4539
  reviews: {
4453
4540
  id: string;
4541
+ note: string | null;
4454
4542
  createdAt: string;
4455
4543
  verdict: "viewed" | "bug";
4456
4544
  reviewer: string;
4457
- note: string | null;
4458
4545
  }[];
4459
4546
  bugs: {
4460
4547
  id: string;
@@ -4549,10 +4636,10 @@ export declare const HOST_MODULES: {
4549
4636
  };
4550
4637
  reviews: {
4551
4638
  id: string;
4639
+ note: string | null;
4552
4640
  createdAt: string;
4553
4641
  verdict: "viewed" | "bug";
4554
4642
  reviewer: string;
4555
- note: string | null;
4556
4643
  }[];
4557
4644
  bugs: {
4558
4645
  id: string;
@@ -4793,6 +4880,12 @@ export declare const HOST_MODULES: {
4793
4880
  registerProductNameLookup: typeof ecommerce.registerProductNameLookup;
4794
4881
  resolveProductNameLookup: typeof ecommerce.resolveProductNameLookup;
4795
4882
  clearProductNameLookups: typeof ecommerce.clearProductNameLookups;
4883
+ registerStoreArticleLookup: typeof ecommerce.registerStoreArticleLookup;
4884
+ resolveStoreArticleLookup: typeof ecommerce.resolveStoreArticleLookup;
4885
+ clearStoreArticleLookups: typeof ecommerce.clearStoreArticleLookups;
4886
+ registerShopCheckout: typeof ecommerce.registerShopCheckout;
4887
+ resolveShopCheckout: typeof ecommerce.resolveShopCheckout;
4888
+ clearShopCheckouts: typeof ecommerce.clearShopCheckouts;
4796
4889
  registerCodeDiscountSource: typeof ecommerce.registerCodeDiscountSource;
4797
4890
  resolveCodeDiscountSource: typeof ecommerce.resolveCodeDiscountSource;
4798
4891
  clearCodeDiscountSources: typeof ecommerce.clearCodeDiscountSources;
@@ -8,6 +8,7 @@ export { registerExclusiveOverlay, claimExclusiveOverlay, useExclusiveOverlay, }
8
8
  export { useComposerAttachments, ATTACHMENT_ACCEPT, type AttachmentStatus, type ComposerAttachmentsApi, type ComposerAttachment, } from './composer-attachments/use-composer-attachments';
9
9
  export { usePromptComposer, type UsePromptComposerApi, type UsePromptComposerOptions, } from './use-prompt-composer';
10
10
  export { useComposerChipSelect } from './use-composer-chip-select';
11
+ export { useAskAbout } from './use-ask-about';
11
12
  export { useTurnAskReply } from './use-turn-ask-reply';
12
13
  export { TurnAskPlacementProvider, useTurnAskPlacement, type TurnAskPlacement } from './turn-ask-placement';
13
14
  export { useGoHome } from './use-go-home';
@@ -0,0 +1,10 @@
1
+ import type { PointedAt } from '../../../spacestation/src/index';
2
+ /**
3
+ * Returns a callback that sends a message about one element on the page — a tapped price,
4
+ * colour, product or section — so the agent answers about exactly that element: the turn
5
+ * carries `about` (`PointedAt`: the entity, the facet tapped, the value shown) beside the text.
6
+ *
7
+ * const askAbout = useAskAbout();
8
+ * askAbout('Cheaper', { ref: product.id, label: product.title, field: 'price', value: '$128' });
9
+ */
10
+ export declare function useAskAbout(): (text: string, about: PointedAt) => void;
@@ -1,6 +1,6 @@
1
1
  import type { InstallmentOffer, Money, Product } from '../../../../ecommerce/src/index';
2
- export type { AddToCartApi, CartAddHints, CartAddOptions, CartApi, CustomerAccountApi, StoreCheckoutsApi, AskStoreApi, ProductReviewHighlight, ProductReviewItem, ProductReviewsResult, ProductsQuery, ToggleWishlistApi, WishlistApi, WishlistState, } from './commerce-shapes';
3
- import type { AddToCartApi, CartAddHints, CartApi, CustomerAccountApi, StoreCheckoutsApi, AskStoreApi, ProductReviewsResult, ProductsQuery, ToggleWishlistApi, WishlistApi } from './commerce-shapes';
2
+ export type { AddToCartApi, CartAddHints, CartAddOptions, CartApi, CustomerAccountApi, StoreCheckoutsApi, AskStoreApi, StoreArticlesApi, ShopCheckoutApi, ProductSearchApi, ProductSearchOptions, ProductReviewHighlight, ProductReviewItem, ProductReviewsResult, ProductsQuery, ToggleWishlistApi, WishlistApi, WishlistState, } from './commerce-shapes';
3
+ import type { AddToCartApi, CartAddHints, CartApi, CustomerAccountApi, StoreCheckoutsApi, AskStoreApi, StoreArticlesApi, ShopCheckoutApi, ProductSearchApi, ProductSearchOptions, 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
@@ -35,6 +35,12 @@ export interface FourtyCommerceRuntime {
35
35
  useStoreCheckouts: () => StoreCheckoutsApi;
36
36
  /** A question put to the store that sells a product. */
37
37
  useAskStore: () => AskStoreApi;
38
+ /** The selling stores' own articles for an ask. */
39
+ useStoreArticles: (productIds: ReadonlyArray<string>, topic: string) => StoreArticlesApi;
40
+ /** The whole bag in ONE checkout through Shop, across its stores. */
41
+ useShopCheckout: () => ShopCheckoutApi;
42
+ /** One page of the space's catalog search. */
43
+ useProductSearch: (query: string, opts?: ProductSearchOptions) => ProductSearchApi;
38
44
  }
39
45
  /**
40
46
  * Provider for the commerce-hook surface. Mounted by the SDK's
@@ -84,3 +90,16 @@ export declare function useStoreCheckouts(): StoreCheckoutsApi;
84
90
  * store's own statement. Not available (and `ask` rejects) where the space is
85
91
  * the only store, or without a `<CommerceProvider>`. */
86
92
  export declare function useAskStore(): AskStoreApi;
93
+ /** The articles the stores selling `productIds` published themselves, relevant
94
+ * to `topic`. Not available (empty) on a single store's space or without a
95
+ * `<CommerceProvider>`. */
96
+ export declare function useStoreArticles(productIds: ReadonlyArray<string>, topic: string): StoreArticlesApi;
97
+ /** The whole bag in ONE checkout through Shop, even across several stores
98
+ * (`combined`), or each store separately with the reason (`separate`). Not
99
+ * available (and `create` rejects) on a single-store backend, without a bag,
100
+ * or without a `<CommerceProvider>`. */
101
+ export declare function useShopCheckout(): ShopCheckoutApi;
102
+ /** One page of the space's catalog search for `query`, in the catalog's order, with the
103
+ * cursor for the next page (pass it back as `opts.cursor`). Not available without a
104
+ * `<CommerceProvider>`. */
105
+ export declare function useProductSearch(query: string, opts?: ProductSearchOptions): ProductSearchApi;
@@ -11,7 +11,7 @@
11
11
  * this path directly from outside the SDK.
12
12
  */
13
13
  import type { CartOrigin } from '../../../../spacestation/src/analytics/ecommerce/index';
14
- import type { Cart, OptimisticCartLine, Product, ProductReviewItem, ProductReviewHighlight, StoreAnswer, StoreCheckout } from '../../../../ecommerce/src/index';
14
+ import type { Cart, OptimisticCartLine, Product, ProductReviewItem, ProductReviewHighlight, StoreAnswer, StoreArticle, StoreCheckout, ShopCheckoutResult } from '../../../../ecommerce/src/index';
15
15
  /**
16
16
  * One review / one intent-matched review. Both are `z.infer` of the review
17
17
  * schemas in `@fourty/ecommerce` — the single source of truth for the shape,
@@ -210,3 +210,43 @@ export interface AskStoreApi {
210
210
  /** True while `ask` is in flight. */
211
211
  pending: boolean;
212
212
  }
213
+ /** Return shape of `useStoreArticles`: the articles the selling stores published
214
+ * themselves that speak to an ask (their own blogs), best first. */
215
+ export interface StoreArticlesApi {
216
+ /** False where the space has no store articles to read (a single store's space). */
217
+ available: boolean;
218
+ articles: StoreArticle[];
219
+ isLoading: boolean;
220
+ }
221
+ /** What `useProductSearch` asks for: one page of a catalog search. Prices are major units. */
222
+ export interface ProductSearchOptions {
223
+ limit?: number;
224
+ /** The previous page's `nextCursor`; absent = the first page. */
225
+ cursor?: string;
226
+ minPrice?: number;
227
+ maxPrice?: number;
228
+ }
229
+ /** Return shape of `useProductSearch`: ONE page of the space's catalog search, in the
230
+ * catalog's order, and the cursor for the next page. Pages are never merged or deduplicated here. */
231
+ export interface ProductSearchApi {
232
+ /** False without a commerce backend to search. */
233
+ available: boolean;
234
+ products: Product[];
235
+ /** Pass back as `cursor` for the next page; null on the last page. */
236
+ nextCursor: string | null;
237
+ isLoading: boolean;
238
+ error: Error | null;
239
+ }
240
+ /** Return shape of `useShopCheckout`: the whole bag paid in ONE checkout
241
+ * through Shop, even when its lines come from several stores. */
242
+ export interface ShopCheckoutApi {
243
+ /** False where the bag belongs to one store and exits through
244
+ * `cart.checkoutUrl` (`useCartView().handleCheckout`) instead, or there is no bag yet. */
245
+ available: boolean;
246
+ /** Make the checkout. `combined`: one Shop Pay checkout at `continueUrl` for every
247
+ * store. `separate` (with the reason): each store's own Shop checkout, in `stores`.
248
+ * Places no order. The URLs open live sessions: never log them. */
249
+ create: () => Promise<ShopCheckoutResult>;
250
+ /** True while `create` is in flight. */
251
+ pending: boolean;
252
+ }
@@ -1,6 +1,6 @@
1
1
  import './chip-relevance';
2
- export { useCart, useAddToCart, useWishlist, useToggleWishlist, useProducts, useCollectionByHandle, useProductReviews, useCustomerAccount, useInstallmentOffer, useStoreCheckouts, useAskStore, useCommerceRuntime, FourtyCommerceRuntimeProvider, } from './commerce-context';
3
- export type { FourtyCommerceRuntime, CartApi, AddToCartApi, WishlistApi, ToggleWishlistApi, ProductsQuery, ProductReviewItem, ProductReviewHighlight, ProductReviewsResult, CustomerAccountApi, StoreCheckoutsApi, AskStoreApi, CartAddOptions, CartAddHints, WishlistState, } from './commerce-context';
2
+ export { useCart, useAddToCart, useWishlist, useToggleWishlist, useProducts, useCollectionByHandle, useProductReviews, useCustomerAccount, useInstallmentOffer, useStoreCheckouts, useAskStore, useStoreArticles, useShopCheckout, useProductSearch, useCommerceRuntime, FourtyCommerceRuntimeProvider, } from './commerce-context';
3
+ export type { FourtyCommerceRuntime, CartApi, AddToCartApi, WishlistApi, ToggleWishlistApi, ProductsQuery, ProductReviewItem, ProductReviewHighlight, ProductReviewsResult, CustomerAccountApi, StoreCheckoutsApi, AskStoreApi, StoreArticlesApi, ShopCheckoutApi, ProductSearchApi, ProductSearchOptions, 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';
@@ -14,6 +14,7 @@ export { type StepName, type TraceEvent, type EmitFn, type TraceStartInfo, type
14
14
  export { type TraceDiagnostic, type DiagnosticKind, type TraceStage, } from './trace/trace-diagnostics';
15
15
  export { type SuggestionAction, type SuggestionActions, type SuggestionRendererProps, SuggestionActionSchema, SuggestionActionsSchema, SIGNAL_PATCH_PREFIX, type SuggestionActionInput, type AgentSignal, type AgentSignalInput, AgentSignalSchema, InteractionSignalSchema, MAX_VISITOR_PROMPT_CHARS, type ToolCallHint, ToolCallHintSchema, type ActionDefinition, type ActionConfirmation, type ActionGuardEntities, type ActionPrepareContext, type ActionNamedEntity, type ActionPrepared, type ActionManifest, type AskDefinition, type AskManifest, NAVIGATE_SIGNAL, FLOW_OUTPUT_SIGNAL, PRESENCE_FLOW, PRESENCE_OPTIMISTIC_FACTS_FLOW, EXTEND_FLOW, DIRECTION_FLOW, EPHEMERAL_FACT_FLOWS, type FlowSpec, type FacultyFlowSpec, } from './signal/agent-signals';
16
16
  export { CHIP_SHOW_SIGNAL, chipsFromShowSignal } from './signal/chip-show';
17
+ export { ATTENTION_NAMESPACE, POINTING_NAMESPACE, AttentionSchema, PointedAtSchema, type Attention, type PointedAt } from './signal/visitor-view';
17
18
  export { TURN_ASK_SIGNAL, TurnAskSchema, turnAskFromSignal, turnAskSegments, turnAskAnswers, turnAskPlainText, type TurnAsk, type TurnAskSegment } from './signal/turn-ask';
18
19
  export { type TraceSpanData, type TraceData, type Trace, type TraceLatency, type TraceEventLogEntry, type LayoutChangeEntry, } from './trace/trace-data';
19
20
  export { type TraceSnapshotEnvelope, type SystemPromptSnapshotEnvelope, type LayoutSnapshotEnvelope, type SuggestionsSnapshotEnvelope, type TurnSnapshotEnvelope, type AssemblyInputsEnvelope, type AssemblyInputComponent, type AssemblyInputTool, type AssemblyInputPrompt, } from './trace/trace-envelopes';
@@ -0,0 +1,101 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * What the visitor is looking at and pointing to, for the agent — vertical-neutral.
4
+ *
5
+ * ATTENTION is a client-leads live-state namespace (`publishClientState(ATTENTION_NAMESPACE, …)`):
6
+ * a shell that renders things the agent did not place (an endless feed, a client-paged section)
7
+ * or knows where the visitor lingers reports it here, and the agent reads it as live state on
8
+ * every turn (and in its follow-up suggestions).
9
+ *
10
+ * POINTING rides one prompt (`about` on the prompt payload): the element the visitor tapped to
11
+ * talk about — a price, a colour, a block — so the turn answers about exactly that.
12
+ */
13
+ export declare const ATTENTION_NAMESPACE = "attention";
14
+ export declare const POINTING_NAMESPACE = "pointing";
15
+ export declare const AttentionSchema: z.ZodObject<{
16
+ /** On the visitor's screen now, in reading order. */
17
+ onScreen: z.ZodArray<z.ZodObject<{
18
+ /** The entity's id as the agent knows it (a product id), when the thing is an entity. */
19
+ ref: z.ZodOptional<z.ZodString>;
20
+ label: z.ZodString;
21
+ /** One short fact the visitor can see on it ("$48", "sold out"). */
22
+ note: z.ZodOptional<z.ZodString>;
23
+ }, "strip", z.ZodTypeAny, {
24
+ label: string;
25
+ ref?: string | undefined;
26
+ note?: string | undefined;
27
+ }, {
28
+ label: string;
29
+ ref?: string | undefined;
30
+ note?: string | undefined;
31
+ }>, "many">;
32
+ /** Where the visitor rested longest, most first. */
33
+ lingered: z.ZodArray<z.ZodObject<{
34
+ /** The entity's id as the agent knows it (a product id), when the thing is an entity. */
35
+ ref: z.ZodOptional<z.ZodString>;
36
+ label: z.ZodString;
37
+ /** One short fact the visitor can see on it ("$48", "sold out"). */
38
+ note: z.ZodOptional<z.ZodString>;
39
+ } & {
40
+ seconds: z.ZodNumber;
41
+ }, "strip", z.ZodTypeAny, {
42
+ label: string;
43
+ seconds: number;
44
+ ref?: string | undefined;
45
+ note?: string | undefined;
46
+ }, {
47
+ label: string;
48
+ seconds: number;
49
+ ref?: string | undefined;
50
+ note?: string | undefined;
51
+ }>, "many">;
52
+ /** Sections the visitor has scrolled through, in order (titles the page showed). */
53
+ passed: z.ZodArray<z.ZodString, "many">;
54
+ }, "strip", z.ZodTypeAny, {
55
+ onScreen: {
56
+ label: string;
57
+ ref?: string | undefined;
58
+ note?: string | undefined;
59
+ }[];
60
+ lingered: {
61
+ label: string;
62
+ seconds: number;
63
+ ref?: string | undefined;
64
+ note?: string | undefined;
65
+ }[];
66
+ passed: string[];
67
+ }, {
68
+ onScreen: {
69
+ label: string;
70
+ ref?: string | undefined;
71
+ note?: string | undefined;
72
+ }[];
73
+ lingered: {
74
+ label: string;
75
+ seconds: number;
76
+ ref?: string | undefined;
77
+ note?: string | undefined;
78
+ }[];
79
+ passed: string[];
80
+ }>;
81
+ export type Attention = z.infer<typeof AttentionSchema>;
82
+ export declare const PointedAtSchema: z.ZodObject<{
83
+ ref: z.ZodOptional<z.ZodString>;
84
+ /** What the element is ("Faherty linen shirt", "the page headline"). */
85
+ label: z.ZodString;
86
+ /** Which of its facets the visitor tapped ("price", "colour", "style", "section"). */
87
+ field: z.ZodString;
88
+ /** That facet's value as shown ("$128", "Navy"). */
89
+ value: z.ZodOptional<z.ZodString>;
90
+ }, "strip", z.ZodTypeAny, {
91
+ field: string;
92
+ label: string;
93
+ value?: string | undefined;
94
+ ref?: string | undefined;
95
+ }, {
96
+ field: string;
97
+ label: string;
98
+ value?: string | undefined;
99
+ ref?: string | undefined;
100
+ }>;
101
+ export type PointedAt = z.infer<typeof PointedAtSchema>;