@40rty/ams-sdk 0.5.28 → 0.5.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1618 -1094
- package/dist/types/ecommerce/src/catalog-product-lookup.d.ts +24 -0
- package/dist/types/ecommerce/src/catalog-search.d.ts +7 -0
- package/dist/types/ecommerce/src/commerce-schemas.d.ts +10 -10
- package/dist/types/ecommerce/src/index.d.ts +1 -0
- package/dist/types/sdk/src/canvas/generation-style.d.ts +20 -1
- package/dist/types/sdk/src/canvas/index.d.ts +3 -3
- package/dist/types/sdk/src/canvas/runtime-hooks.d.ts +5 -1
- package/dist/types/sdk/src/canvas/runtime-types.d.ts +22 -1
- package/dist/types/sdk/src/host/host-modules.d.ts +43 -10
- package/dist/types/sdk/src/provider/index.d.ts +1 -0
- package/dist/types/sdk/src/provider/providers/page-claims.d.ts +50 -0
- package/dist/types/sdk/src/session/FourtySessionContext.d.ts +8 -0
- package/dist/types/sdk/src/session/conversation-key.d.ts +8 -0
- package/dist/types/sdk/src/session/index.d.ts +1 -0
- package/dist/types/sdk/src/shell/conversation/use-conversation-page.d.ts +9 -1
- package/dist/types/sdk/src/verticals/commerce/index.d.ts +2 -0
- package/dist/types/sdk/src/verticals/commerce/price/percent-off.d.ts +11 -0
- package/dist/types/sdk/src/verticals/commerce/product/product-detail-add.d.ts +52 -0
- package/dist/types/sdk/src/verticals/commerce/product/use-product-detail.d.ts +2 -1
- package/dist/types/sdk/src/verticals/commerce/variant/variant-selection.d.ts +22 -1
- package/dist/types/spacestation/src/analytics/index.d.ts +1 -0
- package/dist/types/spacestation/src/analytics/visitor.d.ts +4 -0
- package/dist/types/spacestation/src/contracts/tools/execution-context.d.ts +11 -0
- package/dist/types/spacestation/src/index.d.ts +5 -1
- package/dist/types/spacestation/src/layout/conversation.d.ts +22 -0
- package/dist/types/spacestation/src/signal/turn-ask.d.ts +6 -1
- package/dist/types/spacestation/src/space/space-config.d.ts +13 -0
- package/dist/types/spacestation/src/space/space-description.d.ts +27 -0
- package/dist/types/spacestation/src/space/space-share.d.ts +37 -0
- package/dist/types/spacestation/src/trace/trace-events.d.ts +19 -0
- package/dist/types/spacestation/src/types.d.ts +4 -0
- package/dist/types/spacestation/src/visitor/visitor-country.d.ts +63 -0
- package/package.json +1 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A space's products BY ID, read on the server — for what must name a product
|
|
3
|
+
* before any script runs: a shared deep link's preview card (`/?p=<id>`) and
|
|
4
|
+
* its share image.
|
|
5
|
+
*
|
|
6
|
+
* Injected (§IX) exactly like the served catalog search
|
|
7
|
+
* (`./catalog-search.ts`): the platform binding registers a factory, and the
|
|
8
|
+
* route that serves it never names a platform. A space whose options no
|
|
9
|
+
* factory claims serves no lookup, and its links preview as the site itself.
|
|
10
|
+
*/
|
|
11
|
+
import type { Product } from './commerce-schemas';
|
|
12
|
+
/**
|
|
13
|
+
* The products the catalog answers for, in any order. An id it no longer
|
|
14
|
+
* answers for is simply absent — never a ghost: a preview of a product that is
|
|
15
|
+
* gone is the site's own card, not an "unavailable" one.
|
|
16
|
+
*/
|
|
17
|
+
export type CatalogProductLookup = (ids: ReadonlyArray<string>) => Promise<Product[]>;
|
|
18
|
+
/** A lookup for a space's platform config, or `undefined` when the platform is not this factory's. */
|
|
19
|
+
export type CatalogProductLookupFactory = (platformConfig: unknown) => CatalogProductLookup | undefined;
|
|
20
|
+
export declare function registerCatalogProductLookup(factory: CatalogProductLookupFactory): void;
|
|
21
|
+
/** First registered factory that claims this platform config. */
|
|
22
|
+
export declare function resolveCatalogProductLookup(platformConfig: unknown): CatalogProductLookup | undefined;
|
|
23
|
+
/** Test seam: drops every registration. */
|
|
24
|
+
export declare function clearCatalogProductLookups(): void;
|
|
@@ -19,6 +19,13 @@ export interface CatalogSearchInput {
|
|
|
19
19
|
maxPrice?: number;
|
|
20
20
|
/** The visitor, when they signed in: a platform that can personalizes the page for them. Server-only. */
|
|
21
21
|
buyer?: SignedInBuyer;
|
|
22
|
+
/**
|
|
23
|
+
* ISO 3166-1 alpha-2 the page answers for — on the page, the country the
|
|
24
|
+
* visitor CHOSE; on the server, the country in effect (chosen, else observed)
|
|
25
|
+
* for a space that follows it. A platform searches what ships there and
|
|
26
|
+
* prices it for that market. Absent: the space's own market, as always.
|
|
27
|
+
*/
|
|
28
|
+
visitorCountry?: string;
|
|
22
29
|
}
|
|
23
30
|
export interface CatalogSearchPage {
|
|
24
31
|
items: Product[];
|
|
@@ -1851,6 +1851,11 @@ export declare const CartSchema: z.ZodObject<{
|
|
|
1851
1851
|
variantTitle?: string | undefined;
|
|
1852
1852
|
}[];
|
|
1853
1853
|
totalQuantity: number;
|
|
1854
|
+
messages: {
|
|
1855
|
+
code: string;
|
|
1856
|
+
kind: "error" | "warning" | "info";
|
|
1857
|
+
content: string;
|
|
1858
|
+
}[];
|
|
1854
1859
|
subtotal: {
|
|
1855
1860
|
currencyCode: string;
|
|
1856
1861
|
amount: number;
|
|
@@ -1859,11 +1864,6 @@ export declare const CartSchema: z.ZodObject<{
|
|
|
1859
1864
|
code: string;
|
|
1860
1865
|
applicable: boolean;
|
|
1861
1866
|
}[];
|
|
1862
|
-
messages: {
|
|
1863
|
-
code: string;
|
|
1864
|
-
kind: "error" | "warning" | "info";
|
|
1865
|
-
content: string;
|
|
1866
|
-
}[];
|
|
1867
1867
|
pending?: boolean | undefined;
|
|
1868
1868
|
backOfficeRef?: string | undefined;
|
|
1869
1869
|
total?: {
|
|
@@ -1915,6 +1915,11 @@ export declare const CartSchema: z.ZodObject<{
|
|
|
1915
1915
|
};
|
|
1916
1916
|
pending?: boolean | undefined;
|
|
1917
1917
|
backOfficeRef?: string | undefined;
|
|
1918
|
+
messages?: {
|
|
1919
|
+
code: string;
|
|
1920
|
+
kind: "error" | "warning" | "info";
|
|
1921
|
+
content: string;
|
|
1922
|
+
}[] | undefined;
|
|
1918
1923
|
total?: {
|
|
1919
1924
|
currencyCode: string;
|
|
1920
1925
|
amount: number;
|
|
@@ -1923,11 +1928,6 @@ export declare const CartSchema: z.ZodObject<{
|
|
|
1923
1928
|
code: string;
|
|
1924
1929
|
applicable: boolean;
|
|
1925
1930
|
}[] | undefined;
|
|
1926
|
-
messages?: {
|
|
1927
|
-
code: string;
|
|
1928
|
-
kind: "error" | "warning" | "info";
|
|
1929
|
-
content: string;
|
|
1930
|
-
}[] | undefined;
|
|
1931
1931
|
checkoutUrl?: string | undefined;
|
|
1932
1932
|
storeCartUrl?: string | undefined;
|
|
1933
1933
|
}>;
|
|
@@ -16,6 +16,7 @@ export { buildProductSectionsConfig, readProductSectionsConfig, registerProductS
|
|
|
16
16
|
export { registerStoreArticleLookup, resolveStoreArticleLookup, clearStoreArticleLookups, type StoreArticle, type StoreArticleLookup, type StoreArticleLookupFactory, } from './store-articles';
|
|
17
17
|
export { registerSellerDirectory, resolveSellerDirectory, clearSellerDirectories, type SellerProfile, type SellerDirectory, type SellerDirectoryFactory, } from './seller-profile';
|
|
18
18
|
export { registerCatalogSearch, resolveCatalogSearch, clearCatalogSearches, type CatalogSearch, type CatalogSearchFactory, type CatalogSearchInput, type CatalogSearchPage, } from './catalog-search';
|
|
19
|
+
export { registerCatalogProductLookup, resolveCatalogProductLookup, clearCatalogProductLookups, type CatalogProductLookup, type CatalogProductLookupFactory, } from './catalog-product-lookup';
|
|
19
20
|
export { registerShopCheckout, resolveShopCheckout, clearShopCheckouts, type ShopCheckoutLine, type ShopCheckoutMaker, type ShopCheckoutFactory, } from './shop-checkout';
|
|
20
21
|
export { registerBuyerSignIn, resolveBuyerSignIn, clearBuyerSignIns, type BuyerSignIn, type BuyerSignInFactory, type BuyerSignInProvider, type SignedInBuyer, } from './buyer-sign-in';
|
|
21
22
|
export { registerCodeDiscountSource, resolveCodeDiscountSource, clearCodeDiscountSources, type CodeDiscountSource, type CodeDiscountSourceFactory, type CodeDiscountTerms, type StoreCodeDiscount, } from './code-discounts';
|
|
@@ -32,7 +32,7 @@ export interface GenerationStyle {
|
|
|
32
32
|
entrance: EntranceTreatment;
|
|
33
33
|
text: TextTreatment;
|
|
34
34
|
image: ImageTreatment;
|
|
35
|
-
/** Micro scale-settle on the focal element when the turn completes. */
|
|
35
|
+
/** Micro scale-settle on the focal element when the turn completes (`SETTLE_PULSE`). */
|
|
36
36
|
settlePulse: boolean;
|
|
37
37
|
/**
|
|
38
38
|
* Time-travel replays the generation: navigating to a history view
|
|
@@ -60,3 +60,22 @@ export declare const DEFAULT_GENERATION_TIMINGS: GenerationTimings;
|
|
|
60
60
|
export declare const DEFAULT_GENERATION_STYLE: GenerationStyle;
|
|
61
61
|
/** The editorial ease shared by mask/line reveals. */
|
|
62
62
|
export declare const GENERATION_EASE: [number, number, number, number];
|
|
63
|
+
/** The completion settle pulse — see `SETTLE_PULSE`. */
|
|
64
|
+
export interface SettlePulse {
|
|
65
|
+
/** Transform origin on the Y axis: 0 = the target's top edge. */
|
|
66
|
+
originY: number;
|
|
67
|
+
scale: number[];
|
|
68
|
+
durationS: number;
|
|
69
|
+
ease: 'easeInOut';
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* The micro scale-settle a turn's focal element plays when the turn ends —
|
|
73
|
+
* the canvas going still is the "done".
|
|
74
|
+
*
|
|
75
|
+
* It scales from the TOP EDGE, never the centre. A centred scale moves the
|
|
76
|
+
* target's top by half the growth, so on a page-sized section (an in-place
|
|
77
|
+
* edit at 1440x900 measured ~1,590px tall) the heading the visitor is reading
|
|
78
|
+
* jumped 6-9px and back. Anchored at the top, the top moves 0px and all the
|
|
79
|
+
* growth goes downward, mostly below the fold for a tall target.
|
|
80
|
+
*/
|
|
81
|
+
export declare const SETTLE_PULSE: SettlePulse;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { FourtyRuntimeProvider, useFourtyRuntime, useOptionalFourtyRuntime, } from './runtime-context';
|
|
2
|
-
export { useTurn, useStream, useTurnAsk, useDisplayedLayout, useFourtyShell, useAgentDriven, useReasoning, useSessionState, useSessionId, useSessionMessages, useSeedLayout, 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
|
-
export type { TurnInfo, HistoryNav, CanvasBack, CanvasForward, ConversationState, RuntimeSessionState, FourtyRuntime, InteractionActions, VisitorName, ExplicitTurnSelection, } from './runtime-types';
|
|
2
|
+
export { useTurn, useStream, useTurnAsk, useDisplayedLayout, useFourtyShell, useAgentDriven, useReasoning, useSessionState, useSessionId, useSessionMessages, useSeedLayout, useFacts, useConversationMessages, usePendingMessage, useCurrentMessageIndex, useSelectMessage, useExplicitTurnId, useExplicitTurnSelection, useHistoryNav, useCanvasBack, useCanvasViewBack, useCanvasForward, useConversationState, useSuggestionsWithDefaults, useComposerPlaceholder, useComposerPlaceholderRotation, useLayout, useFocalEntityId, useInteraction, useConversations, useHasLeftSeedHome, useVisitorName, useVisitorCountry, } from './runtime-hooks';
|
|
3
|
+
export type { TurnInfo, HistoryNav, CanvasBack, CanvasForward, ConversationState, RuntimeSessionState, FourtyRuntime, InteractionActions, VisitorName, VisitorCountryApi, ExplicitTurnSelection, } from './runtime-types';
|
|
4
4
|
export { CanvasTailProvider, useCanvasTail, CanvasTailMount, type CanvasTailComponent, } from './canvas-tail';
|
|
5
5
|
export { GenerationStyleContext, GenerationStyleProvider, useGenerationStyle, } from './GenerationStyleContext';
|
|
6
6
|
export { ShimmerSweep, type ShimmerSweepProps } from './ShimmerSweep';
|
|
@@ -12,7 +12,7 @@ export { CanvasMotionStyleProvider, useCanvasMotionStyle, type CanvasMotionStyle
|
|
|
12
12
|
export { ElementIdContext, ElementLayoutContext, useElementId, useElementLayout } from './ElementIdContext';
|
|
13
13
|
export { buildEntranceProps, type EntranceMotionProps } from './generation-entrance';
|
|
14
14
|
export { INITIAL_NAV_PRESENTATION, type NavDirection, type NavPace, type NavPresentation, } from './nav-direction';
|
|
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';
|
|
15
|
+
export { DEFAULT_GENERATION_TIMINGS, DEFAULT_GENERATION_STYLE, GENERATION_EASE, SETTLE_PULSE, type SettlePulse, type SkeletonTreatment, type ActiveBlockTreatment, type EntranceTreatment, type TextTreatment, type ImageTreatment, type GenerationTimings, type GenerationStyle, } from './generation-style';
|
|
16
16
|
export { useCanvasActions, type CanvasActions } from './use-canvas-actions';
|
|
17
17
|
export { computeActiveChips } from './active-chips';
|
|
18
18
|
export { registerChipRelevanceRule, registerEntityPageKind, type ChipRelevanceRule, type ChipRelevanceContext, type EntitySurfaces, type EntityPageBinding, } from './chip-relevance';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ChatMessage, Spec, ShellConfig, ReasoningBeat, Message, PendingMessage, SuggestionActions, ConversationSummary } from '../../../spacestation/src/index';
|
|
2
|
-
import type { TurnInfo, HistoryNav, CanvasBack, CanvasForward, ConversationState, RuntimeSessionState, InteractionActions, VisitorName, ExplicitTurnSelection } from './runtime-types';
|
|
2
|
+
import type { TurnInfo, HistoryNav, CanvasBack, CanvasForward, ConversationState, RuntimeSessionState, InteractionActions, VisitorName, VisitorCountryApi, ExplicitTurnSelection } from './runtime-types';
|
|
3
3
|
/** Metadata for the turn currently on canvas. */
|
|
4
4
|
export declare function useTurn(): TurnInfo;
|
|
5
5
|
/** Per-turn stream channel for the turn currently on canvas. */
|
|
@@ -39,6 +39,10 @@ export declare function useFacts(): Record<string, unknown>;
|
|
|
39
39
|
* setter that records it. Visitor identity, not a visitor fact — see
|
|
40
40
|
* `VisitorName`. */
|
|
41
41
|
export declare function useVisitorName(): VisitorName;
|
|
42
|
+
/** Where the visitor is (`country`, `source`, `observed`), plus `choose` and
|
|
43
|
+
* `clear` — see `VisitorCountryApi`. For a header control that shows the
|
|
44
|
+
* guessed country as set and lets the visitor change it. */
|
|
45
|
+
export declare function useVisitorCountry(): VisitorCountryApi;
|
|
42
46
|
/** Committed conversation turns. */
|
|
43
47
|
export declare function useConversationMessages(): readonly Message[];
|
|
44
48
|
/** The in-flight pending message, or `null` between turns. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Spec, ShellConfig, ReasoningBeat, Message, PendingMessage, ChatMessage, SuggestionActions, ConversationSummary, InteractionSignal, AttachmentRef } from '../../../spacestation/src/index';
|
|
1
|
+
import type { Spec, ShellConfig, ReasoningBeat, Message, PendingMessage, ChatMessage, SuggestionActions, ConversationSummary, InteractionSignal, AttachmentRef, VisitorCountry } from '../../../spacestation/src/index';
|
|
2
2
|
/**
|
|
3
3
|
* Per-turn state the catalog needs to render. Returned by `useTurn()`.
|
|
4
4
|
*/
|
|
@@ -89,6 +89,26 @@ export interface VisitorName {
|
|
|
89
89
|
* session, so the agent can use it in the very next sentence it writes. */
|
|
90
90
|
setName: (name: string) => void;
|
|
91
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* Where the visitor is, as the space answers for it, and the way they change
|
|
94
|
+
* it. Returned by `useVisitorCountry()`.
|
|
95
|
+
*
|
|
96
|
+
* `country` is the one IN EFFECT: the one the visitor chose, else the one the
|
|
97
|
+
* server observed for their connection, else `null` (unknown — render it as
|
|
98
|
+
* unset, never as a default). Searches and the agent of a space that follows the
|
|
99
|
+
* visitor's country answer for it. Never an access decision.
|
|
100
|
+
*/
|
|
101
|
+
export interface VisitorCountryApi extends VisitorCountry {
|
|
102
|
+
/** What the server observed (edge geo header, else time zone), whatever was
|
|
103
|
+
* chosen — so a control can offer "use my location" back. Null until known. */
|
|
104
|
+
observed: string | null;
|
|
105
|
+
/** Choose a country (ISO 3166-1 alpha-2, any case). Kept in this browser
|
|
106
|
+
* across reloads and sessions, and in effect for the next search at once.
|
|
107
|
+
* Throws a `RangeError` for a code that names no country. */
|
|
108
|
+
choose: (country: string) => void;
|
|
109
|
+
/** Withdraw the choice: the observed country is in effect again. */
|
|
110
|
+
clear: () => void;
|
|
111
|
+
}
|
|
92
112
|
/**
|
|
93
113
|
* Interaction actions — stable refs, never causes re-render. Returned by
|
|
94
114
|
* `useInteraction()`.
|
|
@@ -158,6 +178,7 @@ export interface FourtyRuntime {
|
|
|
158
178
|
useSeedLayout: () => Spec | null;
|
|
159
179
|
useFacts: () => Record<string, unknown>;
|
|
160
180
|
useVisitorName: () => VisitorName;
|
|
181
|
+
useVisitorCountry: () => VisitorCountryApi;
|
|
161
182
|
useConversationMessages: () => readonly Message[];
|
|
162
183
|
usePendingMessage: () => PendingMessage | null;
|
|
163
184
|
useCurrentMessageIndex: () => number | null;
|
|
@@ -55,6 +55,7 @@ export declare const HOST_MODULES: {
|
|
|
55
55
|
useOptionalFourtySession: typeof sdk.useOptionalFourtySession;
|
|
56
56
|
useComposerDraft: typeof sdk.useComposerDraft;
|
|
57
57
|
FourtySessionContext: react.Context<sdk.FourtySessionContextValue | null>;
|
|
58
|
+
conversationKeyOf: typeof sdk.conversationKeyOf;
|
|
58
59
|
useAction: typeof sdk.useAction;
|
|
59
60
|
withSignalTurn: typeof sdk.withSignalTurn;
|
|
60
61
|
getVisitorLocale: typeof sdk.getVisitorLocale;
|
|
@@ -129,6 +130,9 @@ export declare const HOST_MODULES: {
|
|
|
129
130
|
withoutClosingQuestion: typeof sdk.withoutClosingQuestion;
|
|
130
131
|
useRegisterSignalHandlers: typeof sdk.useRegisterSignalHandlers;
|
|
131
132
|
HandlerRegistryContext: react.Context<sdk.HandlerRegistryValue | null>;
|
|
133
|
+
useClaimPage: typeof sdk.useClaimPage;
|
|
134
|
+
createPageClaimRegistry: typeof sdk.createPageClaimRegistry;
|
|
135
|
+
PageClaimContext: react.Context<sdk.PageClaimRegistry | null>;
|
|
132
136
|
AGENT_ASK_SIGNAL: "agent_ask";
|
|
133
137
|
useClampToggle: typeof sdk.useClampToggle;
|
|
134
138
|
useTimedFlag: typeof sdk.useTimedFlag;
|
|
@@ -167,6 +171,7 @@ export declare const HOST_MODULES: {
|
|
|
167
171
|
useConversations: typeof sdk.useConversations;
|
|
168
172
|
useHasLeftSeedHome: typeof sdk.useHasLeftSeedHome;
|
|
169
173
|
useVisitorName: typeof sdk.useVisitorName;
|
|
174
|
+
useVisitorCountry: typeof sdk.useVisitorCountry;
|
|
170
175
|
CanvasTailProvider: typeof sdk.CanvasTailProvider;
|
|
171
176
|
useCanvasTail: typeof sdk.useCanvasTail;
|
|
172
177
|
CanvasTailMount: typeof sdk.CanvasTailMount;
|
|
@@ -198,6 +203,7 @@ export declare const HOST_MODULES: {
|
|
|
198
203
|
DEFAULT_GENERATION_TIMINGS: sdk.GenerationTimings;
|
|
199
204
|
DEFAULT_GENERATION_STYLE: sdk.GenerationStyle;
|
|
200
205
|
GENERATION_EASE: [number, number, number, number];
|
|
206
|
+
SETTLE_PULSE: sdk.SettlePulse;
|
|
201
207
|
useCanvasActions: typeof sdk.useCanvasActions;
|
|
202
208
|
computeActiveChips: typeof sdk.computeActiveChips;
|
|
203
209
|
registerChipRelevanceRule: typeof sdk.registerChipRelevanceRule;
|
|
@@ -417,6 +423,7 @@ export declare const HOST_MODULES: {
|
|
|
417
423
|
isPendingCartLine: typeof ecommerce.isPendingCartLine;
|
|
418
424
|
settledCart: typeof ecommerce.settledCart;
|
|
419
425
|
useProductDetail: typeof sdk.useProductDetail;
|
|
426
|
+
productDetailAddResult: typeof sdk.productDetailAddResult;
|
|
420
427
|
classifyComparisonValue: typeof sdk.classifyComparisonValue;
|
|
421
428
|
useComparisonHighlight: typeof sdk.useComparisonHighlight;
|
|
422
429
|
useCartDrawer: typeof sdk.useCartDrawer;
|
|
@@ -470,6 +477,7 @@ export declare const HOST_MODULES: {
|
|
|
470
477
|
formatProductPrice: typeof sdk.formatProductPrice;
|
|
471
478
|
formatPrice: typeof sdk.formatPrice;
|
|
472
479
|
isOnSale: typeof sdk.isOnSale;
|
|
480
|
+
percentOff: typeof sdk.percentOff;
|
|
473
481
|
resolveSwatchColor: typeof sdk.resolveSwatchColor;
|
|
474
482
|
formatVariantValue: typeof ecommerce.formatVariantValue;
|
|
475
483
|
CART_LINE_ADDED: spacestationAnalytics.EventKind<"commerce.cart_line_added", {
|
|
@@ -2957,6 +2965,15 @@ export declare const HOST_MODULES: {
|
|
|
2957
2965
|
spaceLocaleOf: typeof spacestation.spaceLocaleOf;
|
|
2958
2966
|
declaredSpaceLocaleOf: typeof spacestation.declaredSpaceLocaleOf;
|
|
2959
2967
|
SUPPORTED_SPACE_LOCALES: readonly string[];
|
|
2968
|
+
SPACE_DESCRIPTION_MAX_CHARS: 300;
|
|
2969
|
+
SpaceDescriptionSchema: zod.ZodString;
|
|
2970
|
+
spaceDescriptionOf: typeof spacestation.spaceDescriptionOf;
|
|
2971
|
+
SPACE_SHARE_QUERY_MAX_CHARS: 120;
|
|
2972
|
+
SpaceShareQuerySchema: zod.ZodString;
|
|
2973
|
+
X_HANDLE_PATTERN: RegExp;
|
|
2974
|
+
XHandleSchema: zod.ZodString;
|
|
2975
|
+
bareXHandle: typeof spacestation.bareXHandle;
|
|
2976
|
+
spaceShareOf: typeof spacestation.spaceShareOf;
|
|
2960
2977
|
DEFAULT_SPACE_CONFIG: spacestation.SpaceConfig;
|
|
2961
2978
|
DEFAULT_VISITOR_ACCESS: "open" | "identified" | "invited";
|
|
2962
2979
|
VISITOR_ACCESS: readonly ["open", "identified", "invited"];
|
|
@@ -5483,6 +5500,19 @@ export declare const HOST_MODULES: {
|
|
|
5483
5500
|
}>;
|
|
5484
5501
|
boardLabelKey: typeof spacestation.boardLabelKey;
|
|
5485
5502
|
previewBoardEdit: typeof spacestation.previewBoardEdit;
|
|
5503
|
+
CountryCodeSchema: zod.ZodEffects<zod.ZodString, string, string>;
|
|
5504
|
+
isCountryCode: typeof spacestation.isCountryCode;
|
|
5505
|
+
visitorCountryInEffect: typeof spacestation.visitorCountryInEffect;
|
|
5506
|
+
NO_VISITOR_COUNTRY: spacestation.VisitorCountry;
|
|
5507
|
+
VISITOR_COUNTRY_CHOICE_NAMESPACE: "visitorCountryChoice";
|
|
5508
|
+
VISITOR_COUNTRY_OBSERVED_NAMESPACE: "visitorCountryObserved";
|
|
5509
|
+
VisitorCountryStateSchema: zod.ZodObject<{
|
|
5510
|
+
country: zod.ZodNullable<zod.ZodEffects<zod.ZodString, string, string>>;
|
|
5511
|
+
}, "strip", zod.ZodTypeAny, {
|
|
5512
|
+
country: string | null;
|
|
5513
|
+
}, {
|
|
5514
|
+
country: string | null;
|
|
5515
|
+
}>;
|
|
5486
5516
|
parseBcp47Locale: typeof ecommerce.parseBcp47Locale;
|
|
5487
5517
|
buildOptimisticCartLine: typeof ecommerce.buildOptimisticCartLine;
|
|
5488
5518
|
selectedOptionsToRecord: typeof ecommerce.selectedOptionsToRecord;
|
|
@@ -5540,6 +5570,9 @@ export declare const HOST_MODULES: {
|
|
|
5540
5570
|
registerCatalogSearch: typeof ecommerce.registerCatalogSearch;
|
|
5541
5571
|
resolveCatalogSearch: typeof ecommerce.resolveCatalogSearch;
|
|
5542
5572
|
clearCatalogSearches: typeof ecommerce.clearCatalogSearches;
|
|
5573
|
+
registerCatalogProductLookup: typeof ecommerce.registerCatalogProductLookup;
|
|
5574
|
+
resolveCatalogProductLookup: typeof ecommerce.resolveCatalogProductLookup;
|
|
5575
|
+
clearCatalogProductLookups: typeof ecommerce.clearCatalogProductLookups;
|
|
5543
5576
|
registerShopCheckout: typeof ecommerce.registerShopCheckout;
|
|
5544
5577
|
resolveShopCheckout: typeof ecommerce.resolveShopCheckout;
|
|
5545
5578
|
clearShopCheckouts: typeof ecommerce.clearShopCheckouts;
|
|
@@ -7036,6 +7069,11 @@ export declare const HOST_MODULES: {
|
|
|
7036
7069
|
variantTitle?: string | undefined;
|
|
7037
7070
|
}[];
|
|
7038
7071
|
totalQuantity: number;
|
|
7072
|
+
messages: {
|
|
7073
|
+
code: string;
|
|
7074
|
+
kind: "error" | "warning" | "info";
|
|
7075
|
+
content: string;
|
|
7076
|
+
}[];
|
|
7039
7077
|
subtotal: {
|
|
7040
7078
|
currencyCode: string;
|
|
7041
7079
|
amount: number;
|
|
@@ -7044,11 +7082,6 @@ export declare const HOST_MODULES: {
|
|
|
7044
7082
|
code: string;
|
|
7045
7083
|
applicable: boolean;
|
|
7046
7084
|
}[];
|
|
7047
|
-
messages: {
|
|
7048
|
-
code: string;
|
|
7049
|
-
kind: "error" | "warning" | "info";
|
|
7050
|
-
content: string;
|
|
7051
|
-
}[];
|
|
7052
7085
|
pending?: boolean | undefined;
|
|
7053
7086
|
backOfficeRef?: string | undefined;
|
|
7054
7087
|
total?: {
|
|
@@ -7100,6 +7133,11 @@ export declare const HOST_MODULES: {
|
|
|
7100
7133
|
};
|
|
7101
7134
|
pending?: boolean | undefined;
|
|
7102
7135
|
backOfficeRef?: string | undefined;
|
|
7136
|
+
messages?: {
|
|
7137
|
+
code: string;
|
|
7138
|
+
kind: "error" | "warning" | "info";
|
|
7139
|
+
content: string;
|
|
7140
|
+
}[] | undefined;
|
|
7103
7141
|
total?: {
|
|
7104
7142
|
currencyCode: string;
|
|
7105
7143
|
amount: number;
|
|
@@ -7108,11 +7146,6 @@ export declare const HOST_MODULES: {
|
|
|
7108
7146
|
code: string;
|
|
7109
7147
|
applicable: boolean;
|
|
7110
7148
|
}[] | undefined;
|
|
7111
|
-
messages?: {
|
|
7112
|
-
code: string;
|
|
7113
|
-
kind: "error" | "warning" | "info";
|
|
7114
|
-
content: string;
|
|
7115
|
-
}[] | undefined;
|
|
7116
7149
|
checkoutUrl?: string | undefined;
|
|
7117
7150
|
storeCartUrl?: string | undefined;
|
|
7118
7151
|
}>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { useRegisterSignalHandlers, HandlerRegistryContext, type SignalHandler, type HandlerRegistryValue, } from './providers/handler-registry';
|
|
2
|
+
export { useClaimPage, createPageClaimRegistry, PageClaimContext, type PageClaimRegistry, type PageKind, type PageOf, type PageOpener, } from './providers/page-claims';
|
|
2
3
|
export { AGENT_ASK_SIGNAL } from './agent-ask-signal';
|
|
3
4
|
export { useClampToggle, type ClampToggle } from './use-clamp-toggle';
|
|
4
5
|
export { useTimedFlag } from './use-timed-flag';
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { Page } from '../../../../spacestation/src/index';
|
|
2
|
+
/** A page kind, from the open `PageKindRegistry`. */
|
|
3
|
+
export type PageKind = Page['kind'];
|
|
4
|
+
/** The page of kind `K`, typed: `PageOf<'product'>` carries `id`. */
|
|
5
|
+
export type PageOf<K extends PageKind> = Extract<Page, {
|
|
6
|
+
kind: K;
|
|
7
|
+
}>;
|
|
8
|
+
/**
|
|
9
|
+
* Open `page` on the brand's own surface. Return `true` when it opened,
|
|
10
|
+
* `false` to decline (an id the brand cannot show, a state it will not open
|
|
11
|
+
* in) — the engine then opens the page itself.
|
|
12
|
+
*/
|
|
13
|
+
export type PageOpener<K extends PageKind> = (page: PageOf<K>) => boolean | Promise<boolean>;
|
|
14
|
+
export interface PageClaimRegistry {
|
|
15
|
+
/**
|
|
16
|
+
* Claim `kind`. One claim per kind: a second claim while one stands throws.
|
|
17
|
+
* Returns the release; releasing a claim that was already replaced is a no-op.
|
|
18
|
+
*/
|
|
19
|
+
claim: <K extends PageKind>(kind: K, open: PageOpener<K>) => () => void;
|
|
20
|
+
/** Whether a claim on `kind` stands right now. */
|
|
21
|
+
has: (kind: string) => boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Offer `page` to its kind's claim. `true` when the brand opened it; `false`
|
|
24
|
+
* when no claim exists, the claim declined, or it failed (logged).
|
|
25
|
+
*/
|
|
26
|
+
open: (page: Page) => Promise<boolean>;
|
|
27
|
+
}
|
|
28
|
+
/** The engine creates ONE per `<FourtyProvider>` and provides it. */
|
|
29
|
+
export declare function createPageClaimRegistry(): PageClaimRegistry;
|
|
30
|
+
export declare const PageClaimContext: import("react").Context<PageClaimRegistry | null>;
|
|
31
|
+
/**
|
|
32
|
+
* Claim a page kind the brand draws itself. Every navigation to a page of
|
|
33
|
+
* `kind` — an agent's chip, a button in a block, an external agent's
|
|
34
|
+
* `open_product`, the brand's own `useCanvasActions().navigate` — calls `open`
|
|
35
|
+
* first; the engine moves its page only when `open` returns `false`.
|
|
36
|
+
*
|
|
37
|
+
* `open` may change every render (it is read through a ref); the claim is
|
|
38
|
+
* held while the calling component is mounted and released on unmount.
|
|
39
|
+
* Throws outside `<FourtyProvider>`, and when another component already holds
|
|
40
|
+
* a claim on `kind`.
|
|
41
|
+
*
|
|
42
|
+
* ```tsx
|
|
43
|
+
* useClaimPage('product', (page) => {
|
|
44
|
+
* if (!canShow(page.id)) return false; // the engine opens its own page
|
|
45
|
+
* openProductSheet(page.id);
|
|
46
|
+
* return true;
|
|
47
|
+
* });
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export declare function useClaimPage<K extends PageKind>(kind: K, open: PageOpener<K>): void;
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import type { InteractionSignal, SuggestionAction, SuggestionActions, AgentSignal, PhaseProgress, ChatMessage, ConversationSummary, AttachmentRef, BoardCall, BoardState } from '../../../spacestation/src/index';
|
|
2
2
|
export interface FourtySessionContextValue {
|
|
3
3
|
sessionId: string | null;
|
|
4
|
+
/**
|
|
5
|
+
* The conversation's identity — equal to `sessionId`, except after the api
|
|
6
|
+
* lost the session and the engine replaced it: the visitor is still in the
|
|
7
|
+
* same conversation, on the same page, under a new `sessionId`. Key "a
|
|
8
|
+
* different conversation started" on this (read it with `conversationKeyOf`).
|
|
9
|
+
* Optional so a host's own context value stays valid without it.
|
|
10
|
+
*/
|
|
11
|
+
conversationId?: string | null;
|
|
4
12
|
/**
|
|
5
13
|
* Per-space client-storage namespace this session's `FourtyClient` is
|
|
6
14
|
* keyed on (the SpaceRef value — id or slug). Callers outside the SDK
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FourtySessionContextValue } from './FourtySessionContext';
|
|
2
|
+
/**
|
|
3
|
+
* The identity of the conversation the visitor is in — what "a different
|
|
4
|
+
* conversation started" keys on (a crossfade, a cache that belongs to one
|
|
5
|
+
* conversation). `conversationId` when the engine supplies it; otherwise the
|
|
6
|
+
* session id, which is the same thing for every session the api never lost.
|
|
7
|
+
*/
|
|
8
|
+
export declare function conversationKeyOf(session: Pick<FourtySessionContextValue, 'sessionId' | 'conversationId'>): string | null;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { useFourtySession, useOptionalFourtySession, useComposerDraft, FourtySessionContext, type FourtySessionContextValue, } from './FourtySessionContext';
|
|
2
|
+
export { conversationKeyOf } from './conversation-key';
|
|
2
3
|
export { useAction } from './use-action';
|
|
3
4
|
export { withSignalTurn } from './turn-attributed-session';
|
|
4
5
|
export { getVisitorLocale, commerceLocaleOf } from './visitor-locale';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SuggestionAction, TurnAsk } from '../../../../spacestation/src/index';
|
|
1
|
+
import type { SuggestionAction, TurnAsk, TurnFailure } from '../../../../spacestation/src/index';
|
|
2
2
|
import { type ConversationPresence } from './use-conversation-presence';
|
|
3
3
|
/** Where the live turn is: not running, still thinking (the page is untouched), or composing the page. */
|
|
4
4
|
export type ConversationPhase = 'idle' | 'thinking' | 'composing';
|
|
@@ -25,6 +25,14 @@ export interface ConversationTurn {
|
|
|
25
25
|
live: boolean;
|
|
26
26
|
/** The turn produced no answer (`Message.error`). */
|
|
27
27
|
failed: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Why it failed, when the server said (`Message.failure`): `reason`
|
|
30
|
+
* `over_budget` means asking again now is refused again. Undefined on a turn
|
|
31
|
+
* that did not fail, failed with no answer at all, or came from an older server.
|
|
32
|
+
*/
|
|
33
|
+
failure: TurnFailure | undefined;
|
|
34
|
+
/** When asking again can work (epoch ms) — the failed turn's commit time plus `failure.retryAfterMs`, else undefined. */
|
|
35
|
+
retryAt: number | undefined;
|
|
28
36
|
}
|
|
29
37
|
/**
|
|
30
38
|
* One step of the trail back through the conversation. `kind` says what it
|
|
@@ -12,6 +12,7 @@ export { useProductGridFilter } from './product/use-product-grid-filter';
|
|
|
12
12
|
export { pickProductCardAction, pickCartAddAction } from '../../../../ecommerce/src/index';
|
|
13
13
|
export { isPendingCartLine, settledCart } from '../../../../ecommerce/src/index';
|
|
14
14
|
export { useProductDetail, type ProductDetailVariantGroup, type ProductDetailOptions, } from './product/use-product-detail';
|
|
15
|
+
export { productDetailAddResult, type ProductDetailAddResult, type ProductDetailAddAction, type ProductDetailAddState, } from './product/product-detail-add';
|
|
15
16
|
export type { CartLineAttribute } from '../../../../spacestation/src/index';
|
|
16
17
|
export { classifyComparisonValue, useComparisonHighlight, type ComparisonCellRender, } from './comparison/use-comparison-table';
|
|
17
18
|
export { useCartDrawer } from './cart/use-cart-drawer';
|
|
@@ -34,5 +35,6 @@ export { useCommerceActions, type CommerceActions } from './use-commerce-actions
|
|
|
34
35
|
export { buildComparisonRows, formatProductPrice, type ComparisonAttributeRow, type ComparisonRowWords, } from './comparison/comparison-rows';
|
|
35
36
|
export { formatPrice } from './price/format-price';
|
|
36
37
|
export { isOnSale } from './price/is-on-sale';
|
|
38
|
+
export { percentOff } from './price/percent-off';
|
|
37
39
|
export { resolveSwatchColor } from './variant/resolve-swatch-color';
|
|
38
40
|
export { formatVariantValue } from '../../../../ecommerce/src/index';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whole percent saved against the original price — only when the saving is
|
|
3
|
+
* real. `undefined` when there is no original price, when it does not beat the
|
|
4
|
+
* current one ({@link isOnSale}), or when the saving rounds to 0%: "0% off"
|
|
5
|
+
* is not a deal, and printing it would claim one.
|
|
6
|
+
*
|
|
7
|
+
* One definition for every place a discount is stated — the comparison table's
|
|
8
|
+
* sale row and the product record an external agent reads over WebMCP — so the
|
|
9
|
+
* number a shopper sees and the number an agent quotes cannot disagree.
|
|
10
|
+
*/
|
|
11
|
+
export declare function percentOff(price: number, compareAtPrice: number | undefined): number | undefined;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Product } from '../../../../../ecommerce/src/index';
|
|
2
|
+
import { type ProductVariant } from '../variant/variant-selection';
|
|
3
|
+
/**
|
|
4
|
+
* What one PDP add does for a given `useProductDetail` state — so a brand can
|
|
5
|
+
* tell the visitor why a tap added nothing instead of leaving a button that
|
|
6
|
+
* silently does nothing.
|
|
7
|
+
*
|
|
8
|
+
* - `selection-incomplete` — an option group still has no pick
|
|
9
|
+
* (`missingGroup` names it).
|
|
10
|
+
* - `no-matching-variant` — every group is picked but no variant carries
|
|
11
|
+
* that combination (the connector's variants and options disagree).
|
|
12
|
+
* - `in-flight` — buy-now only: an earlier buy-now is still on its way to
|
|
13
|
+
* checkout, so the tap is ignored.
|
|
14
|
+
*/
|
|
15
|
+
export type ProductDetailAddResult = {
|
|
16
|
+
added: true;
|
|
17
|
+
variantId: string;
|
|
18
|
+
} | {
|
|
19
|
+
added: false;
|
|
20
|
+
reason: 'selection-incomplete' | 'no-matching-variant' | 'in-flight';
|
|
21
|
+
};
|
|
22
|
+
export type ProductDetailAddRefusal = Extract<ProductDetailAddResult, {
|
|
23
|
+
added: false;
|
|
24
|
+
}>;
|
|
25
|
+
/** Which of the hook's two adds: `onAddToBag` or `onBuyNow`. */
|
|
26
|
+
export type ProductDetailAddAction = 'add-to-bag' | 'buy-now';
|
|
27
|
+
/** The slice of `useProductDetail`'s return an add is decided on — the whole
|
|
28
|
+
* return satisfies it, so a brand passes its `detail` as is. */
|
|
29
|
+
export interface ProductDetailAddState {
|
|
30
|
+
allSelected: boolean;
|
|
31
|
+
selectedVariants: Record<string, string>;
|
|
32
|
+
buyNowPending: boolean;
|
|
33
|
+
}
|
|
34
|
+
/** The variant the add would put in the cart, or why there is none. The one
|
|
35
|
+
* decision `useProductDetail`'s `onAddToBag` / `onBuyNow` act on. */
|
|
36
|
+
export declare function pickVariantForAdd(product: Product, state: ProductDetailAddState, action: ProductDetailAddAction): {
|
|
37
|
+
variant: ProductVariant;
|
|
38
|
+
} | ProductDetailAddRefusal;
|
|
39
|
+
/**
|
|
40
|
+
* What `onAddToBag()` (`'add-to-bag'`) or `onBuyNow()` (`'buy-now'`) does for
|
|
41
|
+
* this render's `detail`. The hook decides with the same function on the same
|
|
42
|
+
* values, so calling it beside the tap is exact and synchronous:
|
|
43
|
+
*
|
|
44
|
+
* const result = productDetailAddResult(product, detail, 'add-to-bag');
|
|
45
|
+
* detail.onAddToBag();
|
|
46
|
+
* if (!result.added) showWhy(result.reason);
|
|
47
|
+
*
|
|
48
|
+
* A function beside the hook rather than a new member of its return: brands
|
|
49
|
+
* type and mock that return whole (`ReturnType<typeof useProductDetail>`), so
|
|
50
|
+
* any new member would break them at compile time.
|
|
51
|
+
*/
|
|
52
|
+
export declare function productDetailAddResult(product: Product, detail: ProductDetailAddState, action: ProductDetailAddAction): ProductDetailAddResult;
|
|
@@ -27,7 +27,8 @@ export interface ProductDetailOptions {
|
|
|
27
27
|
* - findVariant(opts) → ProductVariant | undefined
|
|
28
28
|
* - isVariantUnavailable(group, opt)
|
|
29
29
|
* - descExpanded / toggleDesc
|
|
30
|
-
* - onAddToBag (
|
|
30
|
+
* - onAddToBag / onBuyNow (dispatch cart.add only when the selection resolves
|
|
31
|
+
* to a variant; `productDetailAddResult` says beforehand whether it will)
|
|
31
32
|
* - onAskAgent (sends a chat message asking about this product)
|
|
32
33
|
* - onPickSibling (navigates to a colour-sibling product)
|
|
33
34
|
* - onSale predicate
|
|
@@ -12,11 +12,32 @@ export declare function deriveVariantGroups(product: Product): Array<{
|
|
|
12
12
|
name: string;
|
|
13
13
|
options: string[];
|
|
14
14
|
}>;
|
|
15
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* The variant the selection `opts` picks, if any — the first in product order.
|
|
17
|
+
*
|
|
18
|
+
* A variant that lists option values (`selectedOptions` non-empty) matches when
|
|
19
|
+
* `opts` holds every one of them.
|
|
20
|
+
*
|
|
21
|
+
* A variant that lists none (`selectedOptions` absent or `[]` — the two mean
|
|
22
|
+
* the same: it is defined by no option value) is placed on no axis, so:
|
|
23
|
+
* - on a product WITHOUT option groups it matches whatever `opts` holds —
|
|
24
|
+
* there is nothing to pick and nothing it could contradict. This is the
|
|
25
|
+
* single-variant product: the Shopify catalog connector (UCP) leaves
|
|
26
|
+
* `selectedOptions` absent on a variant with no options, the Storefront
|
|
27
|
+
* connector strips Shopify's `Title: Default Title` placeholder to `[]`.
|
|
28
|
+
* With several such variants (Storefront: a product whose only axis is an
|
|
29
|
+
* internal one like `Color Code`, stripped at the provider) the first wins —
|
|
30
|
+
* the visitor has no picker to choose another, and it is the lead variant
|
|
31
|
+
* whose price the product shows.
|
|
32
|
+
* - on a product WITH option groups it never matches: a variant that names no
|
|
33
|
+
* value cannot be the one the visitor picked "M" for.
|
|
34
|
+
*/
|
|
16
35
|
export declare function matchVariant(product: Product, opts: Record<string, string>): ProductVariant | undefined;
|
|
17
36
|
/**
|
|
18
37
|
* A `(group, opt)` pair is unavailable when EVERY product variant that
|
|
19
38
|
* includes it is sold out. Picks in OTHER groups narrow the pool first,
|
|
20
39
|
* falling back to the full candidate set when the narrowing empties it.
|
|
40
|
+
* A variant that lists no option values includes no `(group, opt)` pair, so it
|
|
41
|
+
* is never a candidate — the same reading `matchVariant` gives it.
|
|
21
42
|
*/
|
|
22
43
|
export declare function isOptionUnavailable(product: Product, selectedVariants: Record<string, string>, group: string, opt: string): boolean;
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
export { defineEventKind } from './kind';
|
|
23
23
|
export type { AnyEventKind, ClientEventKind, EventKind, EventTrust, Identical, NameOf, PayloadGuard, PayloadOf, } from './kind';
|
|
24
24
|
export { ENGAGEMENT_DWELL_MS, SESSION_ENGAGED } from './session';
|
|
25
|
+
export { VISITOR_COUNTRY_CHOSEN } from './visitor';
|
|
25
26
|
export { catalogEmittableSchema, catalogEventSchema, eventCatalog } from './catalog';
|
|
26
27
|
export type { CatalogEmittable, CatalogEvent, EmittableOf, EventCatalog, EventOf, } from './catalog';
|
|
27
28
|
export { ANALYTICS_CONSENTS, ANALYTICS_MAX_QUEUED, ANALYTICS_SURFACES, AnalyticsBatchSchema, AnalyticsConsentSchema, AnalyticsDropCountsSchema, AnalyticsSurfaceSchema, AnalyticsWireEventSchema, } from './envelope';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { EmitFn } from '../../trace/trace-events';
|
|
2
2
|
import type { VisitorLocation, EntityKind } from '../../types';
|
|
3
|
+
import type { VisitorCountry } from '../../visitor/visitor-country';
|
|
3
4
|
/**
|
|
4
5
|
* Runtime context passed to tool execute() functions.
|
|
5
6
|
*
|
|
@@ -109,6 +110,16 @@ export interface ToolExecutionContext {
|
|
|
109
110
|
* policy). Absent when the route had no IP or geoip returned no
|
|
110
111
|
* match — tools must guard before using. */
|
|
111
112
|
visitorLocation?: VisitorLocation;
|
|
113
|
+
/**
|
|
114
|
+
* The visitor's country IN EFFECT right now — chosen, else observed
|
|
115
|
+
* (`visitorCountryInEffect`) — read fresh per call, so a choice made mid-
|
|
116
|
+
* session reaches the very next tool call. Present only when the space
|
|
117
|
+
* follows the visitor's country (`spaces.config.followVisitorCountry`) AND a
|
|
118
|
+
* country is known; absent otherwise, and a tool then answers exactly as it
|
|
119
|
+
* did before the field existed. What a tool does with it is the tool's own
|
|
120
|
+
* business (a commerce connector searches what ships there).
|
|
121
|
+
*/
|
|
122
|
+
visitorCountry?: VisitorCountry;
|
|
112
123
|
/** Known entity refs the session has seen, EACH WITH ITS KIND — gids
|
|
113
124
|
* returned by prior tool calls, gids in the active layout, gids in the
|
|
114
125
|
* entity index. Tools that take entity-id input (any
|