@40rty/ams-sdk 0.5.6 → 0.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/dist/index.js +1068 -813
  2. package/dist/types/ecommerce/src/code-discounts.d.ts +47 -0
  3. package/dist/types/ecommerce/src/commerce-schemas.d.ts +16 -6
  4. package/dist/types/ecommerce/src/index.d.ts +2 -0
  5. package/dist/types/ecommerce/src/store-theme.d.ts +45 -0
  6. package/dist/types/sdk/src/canvas/hydration-notice.d.ts +23 -0
  7. package/dist/types/sdk/src/canvas/index.d.ts +1 -0
  8. package/dist/types/sdk/src/host/host-modules.d.ts +55 -14
  9. package/dist/types/sdk/src/session/index.d.ts +2 -1
  10. package/dist/types/sdk/src/session/space-locale-context.d.ts +10 -0
  11. package/dist/types/sdk/src/session/visitor-locale.d.ts +15 -0
  12. package/dist/types/sdk/src/shell/composer-attachments/use-composer-attachments.d.ts +4 -3
  13. package/dist/types/sdk/src/verticals/commerce/comparison/comparison-rows.d.ts +11 -2
  14. package/dist/types/sdk/src/verticals/commerce/index.d.ts +1 -1
  15. package/dist/types/sdk/src/verticals/commerce/price/format-price.d.ts +3 -2
  16. package/dist/types/spacestation/src/attachment/attachment-failure.d.ts +32 -0
  17. package/dist/types/spacestation/src/catalog/wire/host-imports.d.ts +15 -0
  18. package/dist/types/spacestation/src/catalog/wire/index.d.ts +2 -1
  19. package/dist/types/spacestation/src/catalog/wire/package-release.d.ts +19 -0
  20. package/dist/types/spacestation/src/contracts/tools/execution-context.d.ts +11 -0
  21. package/dist/types/spacestation/src/index.d.ts +5 -2
  22. package/dist/types/spacestation/src/signal/agent-signals.d.ts +31 -0
  23. package/dist/types/spacestation/src/space/session-queue.d.ts +8 -8
  24. package/dist/types/spacestation/src/space/space-config.d.ts +4 -0
  25. package/dist/types/spacestation/src/space/space-locale.d.ts +46 -0
  26. package/package.json +1 -1
@@ -0,0 +1,47 @@
1
+ /**
2
+ * A store's active code discounts — read by whoever can read them for this
3
+ * space, without the reader holding the store's token.
4
+ *
5
+ * The Shopify binding reads them with an Admin token when the space holds one
6
+ * of its own. A store that runs AMS through another installed app (AgentIQ)
7
+ * reads them through that app instead: the app keeps its token fresh, and a
8
+ * copy held here would expire. Like the product-name lookup, the source is
9
+ * INJECTED — the package that can answer registers a factory (§IX) and this
10
+ * package knows nothing about who it is.
11
+ */
12
+ /** The conditions a shopper is held to — data, so the agent states them
13
+ * instead of inferring them from a code's name. */
14
+ export interface CodeDiscountTerms {
15
+ /** Any customer can use it (false: selected customers or segments only). */
16
+ everyCustomer: boolean;
17
+ oncePerCustomer: boolean;
18
+ /** Total redemptions allowed across all customers; null = unlimited. */
19
+ usageLimit: number | null;
20
+ minimum: {
21
+ kind: 'subtotal';
22
+ amount: string;
23
+ currencyCode: string;
24
+ } | {
25
+ kind: 'quantity';
26
+ quantity: string;
27
+ } | null;
28
+ }
29
+ export interface StoreCodeDiscount {
30
+ code: string;
31
+ title: string;
32
+ summary: string;
33
+ endsAt: string | null;
34
+ terms: CodeDiscountTerms;
35
+ /** The merchant marked this discount for the agent on the discount itself —
36
+ * the `custom.agent_offer` metafield set to true. */
37
+ agentOffer: boolean;
38
+ }
39
+ /** The store's active code discounts, all of them — which to OFFER is the caller's rule. */
40
+ export type CodeDiscountSource = () => Promise<readonly StoreCodeDiscount[]>;
41
+ /** A source for one turn's options blob, or `undefined` when these options are not one this factory can serve. */
42
+ export type CodeDiscountSourceFactory = (options: unknown) => CodeDiscountSource | undefined;
43
+ export declare function registerCodeDiscountSource(factory: CodeDiscountSourceFactory): void;
44
+ /** First registered factory that claims these options. */
45
+ export declare function resolveCodeDiscountSource(options: unknown): CodeDiscountSource | undefined;
46
+ /** Test seam — drops every registration. */
47
+ export declare function clearCodeDiscountSources(): void;
@@ -262,6 +262,8 @@ export declare const ProductVariantSchema: z.ZodObject<{
262
262
  height?: number | undefined;
263
263
  srcSet?: string | undefined;
264
264
  }>>;
265
+ /** The merchant's stock-keeping code. Absent when the backend has none. */
266
+ sku: z.ZodOptional<z.ZodString>;
265
267
  }, "strip", z.ZodTypeAny, {
266
268
  id: string;
267
269
  title: string;
@@ -286,6 +288,7 @@ export declare const ProductVariantSchema: z.ZodObject<{
286
288
  value: string;
287
289
  name: string;
288
290
  }[] | undefined;
291
+ sku?: string | undefined;
289
292
  }, {
290
293
  id: string;
291
294
  title: string;
@@ -310,6 +313,7 @@ export declare const ProductVariantSchema: z.ZodObject<{
310
313
  value: string;
311
314
  name: string;
312
315
  }[] | undefined;
316
+ sku?: string | undefined;
313
317
  }>;
314
318
  export type Money = z.infer<typeof MoneySchema>;
315
319
  export type Image = z.infer<typeof ImageSchema>;
@@ -614,6 +618,8 @@ export declare const ProductSchema: z.ZodObject<{
614
618
  height?: number | undefined;
615
619
  srcSet?: string | undefined;
616
620
  }>>;
621
+ /** The merchant's stock-keeping code. Absent when the backend has none. */
622
+ sku: z.ZodOptional<z.ZodString>;
617
623
  }, "strip", z.ZodTypeAny, {
618
624
  id: string;
619
625
  title: string;
@@ -638,6 +644,7 @@ export declare const ProductSchema: z.ZodObject<{
638
644
  value: string;
639
645
  name: string;
640
646
  }[] | undefined;
647
+ sku?: string | undefined;
641
648
  }, {
642
649
  id: string;
643
650
  title: string;
@@ -662,6 +669,7 @@ export declare const ProductSchema: z.ZodObject<{
662
669
  value: string;
663
670
  name: string;
664
671
  }[] | undefined;
672
+ sku?: string | undefined;
665
673
  }>, "many">>;
666
674
  availableForSale: z.ZodDefault<z.ZodBoolean>;
667
675
  options: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -820,6 +828,7 @@ export declare const ProductSchema: z.ZodObject<{
820
828
  value: string;
821
829
  name: string;
822
830
  }[] | undefined;
831
+ sku?: string | undefined;
823
832
  }[];
824
833
  price: {
825
834
  currencyCode: string;
@@ -925,6 +934,7 @@ export declare const ProductSchema: z.ZodObject<{
925
934
  value: string;
926
935
  name: string;
927
936
  }[] | undefined;
937
+ sku?: string | undefined;
928
938
  }[] | undefined;
929
939
  reviews?: {
930
940
  date: string;
@@ -1379,9 +1389,9 @@ export declare const CartLineSchema: z.ZodObject<{
1379
1389
  value: string;
1380
1390
  name: string;
1381
1391
  }[] | undefined;
1392
+ sku?: string | undefined;
1382
1393
  vendor?: string | undefined;
1383
1394
  variantTitle?: string | undefined;
1384
- sku?: string | undefined;
1385
1395
  }, {
1386
1396
  id: string;
1387
1397
  title: string;
@@ -1408,9 +1418,9 @@ export declare const CartLineSchema: z.ZodObject<{
1408
1418
  value: string;
1409
1419
  name: string;
1410
1420
  }[] | undefined;
1421
+ sku?: string | undefined;
1411
1422
  vendor?: string | undefined;
1412
1423
  variantTitle?: string | undefined;
1413
- sku?: string | undefined;
1414
1424
  }>;
1415
1425
  export type CartLine = z.infer<typeof CartLineSchema>;
1416
1426
  /** True when a cart line has not been accepted by the backend yet — the one
@@ -1580,9 +1590,9 @@ export declare const CartSchema: z.ZodObject<{
1580
1590
  value: string;
1581
1591
  name: string;
1582
1592
  }[] | undefined;
1593
+ sku?: string | undefined;
1583
1594
  vendor?: string | undefined;
1584
1595
  variantTitle?: string | undefined;
1585
- sku?: string | undefined;
1586
1596
  }, {
1587
1597
  id: string;
1588
1598
  title: string;
@@ -1609,9 +1619,9 @@ export declare const CartSchema: z.ZodObject<{
1609
1619
  value: string;
1610
1620
  name: string;
1611
1621
  }[] | undefined;
1622
+ sku?: string | undefined;
1612
1623
  vendor?: string | undefined;
1613
1624
  variantTitle?: string | undefined;
1614
- sku?: string | undefined;
1615
1625
  }>, "many">;
1616
1626
  totalQuantity: z.ZodNumber;
1617
1627
  subtotal: z.ZodObject<{
@@ -1725,9 +1735,9 @@ export declare const CartSchema: z.ZodObject<{
1725
1735
  value: string;
1726
1736
  name: string;
1727
1737
  }[] | undefined;
1738
+ sku?: string | undefined;
1728
1739
  vendor?: string | undefined;
1729
1740
  variantTitle?: string | undefined;
1730
- sku?: string | undefined;
1731
1741
  }[];
1732
1742
  totalQuantity: number;
1733
1743
  subtotal: {
@@ -1779,9 +1789,9 @@ export declare const CartSchema: z.ZodObject<{
1779
1789
  value: string;
1780
1790
  name: string;
1781
1791
  }[] | undefined;
1792
+ sku?: string | undefined;
1782
1793
  vendor?: string | undefined;
1783
1794
  variantTitle?: string | undefined;
1784
- sku?: string | undefined;
1785
1795
  }[];
1786
1796
  totalQuantity: number;
1787
1797
  subtotal: {
@@ -11,3 +11,5 @@ 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 { registerCodeDiscountSource, resolveCodeDiscountSource, clearCodeDiscountSources, type CodeDiscountSource, type CodeDiscountSourceFactory, type CodeDiscountTerms, type StoreCodeDiscount, } from './code-discounts';
15
+ export { registerStoreThemeSource, resolveStoreThemeSource, clearStoreThemeSources, StoreThemeAccessError, type StoreThemeSource, type StoreThemeSourceFactory, type StoreThemeFile, type StoreThemeFilesPage, type StoreThemeProduct, } from './store-theme';
@@ -0,0 +1,45 @@
1
+ /**
2
+ * The store's own storefront theme, read for a brand's tooling (`forty theme
3
+ * sync`): its theme files and which template each product page renders. A brand
4
+ * builds its product pages from these rather than from a rendered capture.
5
+ *
6
+ * Platform-neutral here, like `code-discounts.ts`: a platform's bindings
7
+ * register a factory that recognises its own store options and answers with a
8
+ * reader; the caller never names a platform.
9
+ */
10
+ export interface StoreThemeFile {
11
+ filename: string;
12
+ size: number;
13
+ /** Text files carry their content; binary assets their CDN url. */
14
+ content?: string;
15
+ url?: string;
16
+ }
17
+ export interface StoreThemeFilesPage {
18
+ themeId: string;
19
+ themeName: string;
20
+ files: StoreThemeFile[];
21
+ /** Pass back as `after` for the next page; null on the last one. */
22
+ nextCursor: string | null;
23
+ }
24
+ export interface StoreThemeProduct {
25
+ /** The platform's product id, as the commerce wire carries it. */
26
+ id: string;
27
+ handle: string;
28
+ /** The product's own template name, or null for the store's default one. */
29
+ templateSuffix: string | null;
30
+ }
31
+ export interface StoreThemeSource {
32
+ /** Theme files matching the platform's patterns (empty = every file), one page at a time. */
33
+ files(filenames: readonly string[], after: string | null): Promise<StoreThemeFilesPage>;
34
+ /** Every live product with the template it renders. */
35
+ products(): Promise<StoreThemeProduct[]>;
36
+ }
37
+ /** Thrown when the store has not granted theme access to whatever reads it — a setup step, not a bug. */
38
+ export declare class StoreThemeAccessError extends Error {
39
+ constructor(message: string);
40
+ }
41
+ export type StoreThemeSourceFactory = (options: unknown) => StoreThemeSource | undefined;
42
+ export declare function registerStoreThemeSource(factory: StoreThemeSourceFactory): void;
43
+ /** The first registered reader that recognises these store options, or undefined. */
44
+ export declare function resolveStoreThemeSource(options: unknown): StoreThemeSource | undefined;
45
+ export declare function clearStoreThemeSources(): void;
@@ -0,0 +1,23 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * THE HYDRATION-FAILURE NOTICE SLOT — what the canvas shows the visitor when
4
+ * an element's entities could not be loaded.
5
+ *
6
+ * The engine (`@fourty/react`) decides WHEN a notice is due; it does not own
7
+ * the WORDS, because words are in the space's language and the label set lives
8
+ * in the UI layer the engine cannot import. So the engine asks this slot, and
9
+ * the spacefront mounts the UI's notice into it (`SpaceFront`). No provider ⇒
10
+ * no notice, never an English one.
11
+ */
12
+ export interface HydrationNoticeProps {
13
+ /** Entities that resolved to nothing (deleted, unpublished) — the count shown. */
14
+ unavailableCount: number;
15
+ /** A hydrator threw: the content is unknown, not merely missing. */
16
+ hasErrors: boolean;
17
+ }
18
+ export type HydrationNoticeComponent = React.ComponentType<HydrationNoticeProps>;
19
+ export declare function HydrationNoticeProvider({ notice, children }: {
20
+ notice: HydrationNoticeComponent;
21
+ children: React.ReactNode;
22
+ }): React.ReactElement;
23
+ export declare function useHydrationNotice(): HydrationNoticeComponent | null;
@@ -2,6 +2,7 @@ export { FourtyRuntimeProvider, useFourtyRuntime, useOptionalFourtyRuntime, } fr
2
2
  export { useTurn, useStream, useTurnAsk, useDisplayedLayout, useFourtyShell, useAgentDriven, useReasoning, useSessionState, useSessionId, useSessionMessages, useFacts, useConversationMessages, usePendingMessage, useCurrentMessageIndex, useSelectMessage, useExplicitTurnId, useExplicitTurnSelection, useHistoryNav, useCanvasBack, useCanvasViewBack, useCanvasForward, useConversationState, useSuggestionsWithDefaults, useComposerPlaceholder, useComposerPlaceholderRotation, useLayout, useFocalEntityId, useInteraction, useConversations, useHasLeftSeedHome, useVisitorName, } from './runtime-hooks';
3
3
  export type { TurnInfo, HistoryNav, CanvasBack, CanvasForward, ConversationState, RuntimeSessionState, FourtyRuntime, InteractionActions, VisitorName, ExplicitTurnSelection, } from './runtime-types';
4
4
  export { CanvasTailProvider, useCanvasTail, CanvasTailMount, type CanvasTailComponent, } from './canvas-tail';
5
+ export { HydrationNoticeProvider, useHydrationNotice, type HydrationNoticeProps, type HydrationNoticeComponent, } from './hydration-notice';
5
6
  export { GenerationStyleContext, GenerationStyleProvider, useGenerationStyle, } from './GenerationStyleContext';
6
7
  export { ShimmerSweep, type ShimmerSweepProps } from './ShimmerSweep';
7
8
  export { FadeTransition, TransitionProvider, useLayoutTransition, type LayoutTransitionItemProps, type LayoutTransitionGroupProps, type LayoutTransition, } from './TransitionContext';
@@ -58,6 +58,10 @@ export declare const HOST_MODULES: {
58
58
  useAction: typeof sdk.useAction;
59
59
  withSignalTurn: typeof sdk.withSignalTurn;
60
60
  getVisitorLocale: typeof sdk.getVisitorLocale;
61
+ commerceLocaleOf: typeof sdk.commerceLocaleOf;
62
+ SpaceLocaleProvider: typeof sdk.SpaceLocaleProvider;
63
+ useSpaceLocale: typeof sdk.useSpaceLocale;
64
+ useTextDirection: typeof sdk.useTextDirection;
61
65
  registerSessionScopedClear: typeof sdk.registerSessionScopedClear;
62
66
  runSessionScopedClearHandlers: typeof sdk.runSessionScopedClearHandlers;
63
67
  ScrollContainerProvider: typeof sdk.ScrollContainerProvider;
@@ -136,6 +140,8 @@ export declare const HOST_MODULES: {
136
140
  CanvasTailProvider: typeof sdk.CanvasTailProvider;
137
141
  useCanvasTail: typeof sdk.useCanvasTail;
138
142
  CanvasTailMount: typeof sdk.CanvasTailMount;
143
+ HydrationNoticeProvider: typeof sdk.HydrationNoticeProvider;
144
+ useHydrationNotice: typeof sdk.useHydrationNotice;
139
145
  GenerationStyleContext: react.Context<sdk.GenerationStyle>;
140
146
  GenerationStyleProvider: react.Provider<sdk.GenerationStyle>;
141
147
  useGenerationStyle: typeof sdk.useGenerationStyle;
@@ -1400,6 +1406,7 @@ export declare const HOST_MODULES: {
1400
1406
  version: zod.ZodString;
1401
1407
  description: zod.ZodOptional<zod.ZodString>;
1402
1408
  builtWithSdk: zod.ZodOptional<zod.ZodString>;
1409
+ hostImports: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodArray<zod.ZodString, "many">>>;
1403
1410
  catalog: zod.ZodRecord<zod.ZodString, zod.ZodObject<{
1404
1411
  type: zod.ZodString;
1405
1412
  propsSchema: zod.ZodOptional<zod.ZodType<spacestation.WireSchema, zod.ZodTypeDef, spacestation.WireSchema>>;
@@ -1719,6 +1726,7 @@ export declare const HOST_MODULES: {
1719
1726
  config?: Record<string, unknown> | undefined;
1720
1727
  description?: string | undefined;
1721
1728
  builtWithSdk?: string | undefined;
1729
+ hostImports?: Record<string, string[]> | undefined;
1722
1730
  bundle?: {
1723
1731
  js: string;
1724
1732
  css: string;
@@ -1801,6 +1809,7 @@ export declare const HOST_MODULES: {
1801
1809
  config?: Record<string, unknown> | undefined;
1802
1810
  description?: string | undefined;
1803
1811
  builtWithSdk?: string | undefined;
1812
+ hostImports?: Record<string, string[]> | undefined;
1804
1813
  bundle?: {
1805
1814
  js: string;
1806
1815
  css: string;
@@ -1849,6 +1858,8 @@ export declare const HOST_MODULES: {
1849
1858
  space: string;
1850
1859
  } | undefined;
1851
1860
  }>;
1861
+ ReleaseMessageSchema: zod.ZodString;
1862
+ RELEASE_MESSAGE_MAX: 140;
1852
1863
  draftSourceId: typeof spacestation.draftSourceId;
1853
1864
  isDraftSource: typeof spacestation.isDraftSource;
1854
1865
  releasePreviewSourceId: typeof spacestation.releasePreviewSourceId;
@@ -1864,6 +1875,10 @@ export declare const HOST_MODULES: {
1864
1875
  compareSdkVersions: typeof spacestation.compareSdkVersions;
1865
1876
  sdkShimsFor: typeof spacestation.sdkShimsFor;
1866
1877
  sdkWindowProblem: typeof spacestation.sdkWindowProblem;
1878
+ HostImportsSchema: zod.ZodRecord<zod.ZodString, zod.ZodArray<zod.ZodString, "many">>;
1879
+ HostExportsSchema: zod.ZodRecord<zod.ZodString, zod.ZodArray<zod.ZodString, "many">>;
1880
+ hostImportProblems: typeof spacestation.hostImportProblems;
1881
+ hostImportsRefusal: typeof spacestation.hostImportsRefusal;
1867
1882
  PackageBundleRefSchema: zod.ZodObject<{
1868
1883
  sourceId: zod.ZodString;
1869
1884
  js: zod.ZodString;
@@ -2359,6 +2374,9 @@ export declare const HOST_MODULES: {
2359
2374
  size: number;
2360
2375
  url: string;
2361
2376
  }>, "many">;
2377
+ MAX_ATTACHMENT_MB: number;
2378
+ AttachmentUploadError: typeof spacestation.AttachmentUploadError;
2379
+ attachmentFailureOfStatus: typeof spacestation.attachmentFailureOfStatus;
2362
2380
  ENTRY_CONTEXT_MAX_VALUE_CHARS: 200;
2363
2381
  ENTRY_CONTEXT_MAX_KEYS: 12;
2364
2382
  ENTRY_CONTEXT_MAX_NAMESPACES: 8;
@@ -2698,6 +2716,14 @@ export declare const HOST_MODULES: {
2698
2716
  AGENT_DIRECTIVE_SOURCES: readonly ["owner", "operator", "session-lesson"];
2699
2717
  AGENT_DIRECTIVE_STATUSES: readonly ["proposed", "active", "rejected", "retired"];
2700
2718
  MAX_ACTIVE_AGENT_DIRECTIVES: 12;
2719
+ DEFAULT_SPACE_LOCALE: "en-US";
2720
+ SpaceLocaleSchema: zod.ZodEffects<zod.ZodString, string, string>;
2721
+ textDirectionOf: typeof spacestation.textDirectionOf;
2722
+ languageOf: typeof spacestation.languageOf;
2723
+ languageNameOf: typeof spacestation.languageNameOf;
2724
+ spaceLocaleOf: typeof spacestation.spaceLocaleOf;
2725
+ declaredSpaceLocaleOf: typeof spacestation.declaredSpaceLocaleOf;
2726
+ SUPPORTED_SPACE_LOCALES: readonly string[];
2701
2727
  DEFAULT_SPACE_CONFIG: spacestation.SpaceConfig;
2702
2728
  DEFAULT_VISITOR_ACCESS: "open" | "identified" | "invited";
2703
2729
  VISITOR_ACCESS: readonly ["open", "identified", "invited"];
@@ -3921,16 +3947,16 @@ export declare const HOST_MODULES: {
3921
3947
  locale: zod.ZodNullable<zod.ZodString>;
3922
3948
  referrer: zod.ZodNullable<zod.ZodString>;
3923
3949
  }, "strip", zod.ZodTypeAny, {
3950
+ locale: string | null;
3924
3951
  viewportWidth: number | null;
3925
3952
  viewportHeight: number | null;
3926
3953
  userAgent: string | null;
3927
- locale: string | null;
3928
3954
  referrer: string | null;
3929
3955
  }, {
3956
+ locale: string | null;
3930
3957
  viewportWidth: number | null;
3931
3958
  viewportHeight: number | null;
3932
3959
  userAgent: string | null;
3933
- locale: string | null;
3934
3960
  referrer: string | null;
3935
3961
  }>;
3936
3962
  SessionCaptureInputSchema: zod.ZodObject<{
@@ -3943,21 +3969,21 @@ export declare const HOST_MODULES: {
3943
3969
  clientVersion: zod.ZodOptional<zod.ZodString>;
3944
3970
  isInternal: zod.ZodOptional<zod.ZodBoolean>;
3945
3971
  }, "strip", zod.ZodTypeAny, {
3972
+ locale?: string | undefined;
3946
3973
  isInternal?: boolean | undefined;
3947
3974
  clientVersion?: string | undefined;
3948
3975
  viewportWidth?: number | undefined;
3949
3976
  viewportHeight?: number | undefined;
3950
3977
  userAgent?: string | undefined;
3951
- locale?: string | undefined;
3952
3978
  referrer?: string | undefined;
3953
3979
  timeZone?: string | undefined;
3954
3980
  }, {
3981
+ locale?: string | undefined;
3955
3982
  isInternal?: boolean | undefined;
3956
3983
  clientVersion?: string | undefined;
3957
3984
  viewportWidth?: number | undefined;
3958
3985
  viewportHeight?: number | undefined;
3959
3986
  userAgent?: string | undefined;
3960
- locale?: string | undefined;
3961
3987
  referrer?: string | undefined;
3962
3988
  timeZone?: string | undefined;
3963
3989
  }>;
@@ -4069,16 +4095,16 @@ export declare const HOST_MODULES: {
4069
4095
  locale: zod.ZodNullable<zod.ZodString>;
4070
4096
  referrer: zod.ZodNullable<zod.ZodString>;
4071
4097
  }, "strip", zod.ZodTypeAny, {
4098
+ locale: string | null;
4072
4099
  viewportWidth: number | null;
4073
4100
  viewportHeight: number | null;
4074
4101
  userAgent: string | null;
4075
- locale: string | null;
4076
4102
  referrer: string | null;
4077
4103
  }, {
4104
+ locale: string | null;
4078
4105
  viewportWidth: number | null;
4079
4106
  viewportHeight: number | null;
4080
4107
  userAgent: string | null;
4081
- locale: string | null;
4082
4108
  referrer: string | null;
4083
4109
  }>;
4084
4110
  reviews: zod.ZodArray<zod.ZodObject<{
@@ -4349,10 +4375,10 @@ export declare const HOST_MODULES: {
4349
4375
  bugIssueState: string | null;
4350
4376
  };
4351
4377
  capture: {
4378
+ locale: string | null;
4352
4379
  viewportWidth: number | null;
4353
4380
  viewportHeight: number | null;
4354
4381
  userAgent: string | null;
4355
- locale: string | null;
4356
4382
  referrer: string | null;
4357
4383
  };
4358
4384
  reviews: {
@@ -4447,10 +4473,10 @@ export declare const HOST_MODULES: {
4447
4473
  bugIssueState: string | null;
4448
4474
  };
4449
4475
  capture: {
4476
+ locale: string | null;
4450
4477
  viewportWidth: number | null;
4451
4478
  viewportHeight: number | null;
4452
4479
  userAgent: string | null;
4453
- locale: string | null;
4454
4480
  referrer: string | null;
4455
4481
  };
4456
4482
  reviews: {
@@ -4699,6 +4725,13 @@ export declare const HOST_MODULES: {
4699
4725
  registerProductNameLookup: typeof ecommerce.registerProductNameLookup;
4700
4726
  resolveProductNameLookup: typeof ecommerce.resolveProductNameLookup;
4701
4727
  clearProductNameLookups: typeof ecommerce.clearProductNameLookups;
4728
+ registerCodeDiscountSource: typeof ecommerce.registerCodeDiscountSource;
4729
+ resolveCodeDiscountSource: typeof ecommerce.resolveCodeDiscountSource;
4730
+ clearCodeDiscountSources: typeof ecommerce.clearCodeDiscountSources;
4731
+ registerStoreThemeSource: typeof ecommerce.registerStoreThemeSource;
4732
+ resolveStoreThemeSource: typeof ecommerce.resolveStoreThemeSource;
4733
+ clearStoreThemeSources: typeof ecommerce.clearStoreThemeSources;
4734
+ StoreThemeAccessError: typeof ecommerce.StoreThemeAccessError;
4702
4735
  orderedVideoSources(video: ecommerce.ProductVideo): ecommerce.VideoSource[];
4703
4736
  createUnavailableProduct(gid: string): ecommerce.Product;
4704
4737
  isGhostEntity(value: unknown): boolean;
@@ -4905,6 +4938,7 @@ export declare const HOST_MODULES: {
4905
4938
  height?: number | undefined;
4906
4939
  srcSet?: string | undefined;
4907
4940
  }>>;
4941
+ sku: zod.ZodOptional<zod.ZodString>;
4908
4942
  }, "strip", zod.ZodTypeAny, {
4909
4943
  id: string;
4910
4944
  title: string;
@@ -4929,6 +4963,7 @@ export declare const HOST_MODULES: {
4929
4963
  value: string;
4930
4964
  name: string;
4931
4965
  }[] | undefined;
4966
+ sku?: string | undefined;
4932
4967
  }, {
4933
4968
  id: string;
4934
4969
  title: string;
@@ -4953,6 +4988,7 @@ export declare const HOST_MODULES: {
4953
4988
  value: string;
4954
4989
  name: string;
4955
4990
  }[] | undefined;
4991
+ sku?: string | undefined;
4956
4992
  }>;
4957
4993
  SiblingProductSchema: zod.ZodObject<{
4958
4994
  id: zod.ZodString;
@@ -5188,6 +5224,7 @@ export declare const HOST_MODULES: {
5188
5224
  height?: number | undefined;
5189
5225
  srcSet?: string | undefined;
5190
5226
  }>>;
5227
+ sku: zod.ZodOptional<zod.ZodString>;
5191
5228
  }, "strip", zod.ZodTypeAny, {
5192
5229
  id: string;
5193
5230
  title: string;
@@ -5212,6 +5249,7 @@ export declare const HOST_MODULES: {
5212
5249
  value: string;
5213
5250
  name: string;
5214
5251
  }[] | undefined;
5252
+ sku?: string | undefined;
5215
5253
  }, {
5216
5254
  id: string;
5217
5255
  title: string;
@@ -5236,6 +5274,7 @@ export declare const HOST_MODULES: {
5236
5274
  value: string;
5237
5275
  name: string;
5238
5276
  }[] | undefined;
5277
+ sku?: string | undefined;
5239
5278
  }>, "many">>;
5240
5279
  availableForSale: zod.ZodDefault<zod.ZodBoolean>;
5241
5280
  options: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
@@ -5364,6 +5403,7 @@ export declare const HOST_MODULES: {
5364
5403
  value: string;
5365
5404
  name: string;
5366
5405
  }[] | undefined;
5406
+ sku?: string | undefined;
5367
5407
  }[];
5368
5408
  price: {
5369
5409
  currencyCode: string;
@@ -5469,6 +5509,7 @@ export declare const HOST_MODULES: {
5469
5509
  value: string;
5470
5510
  name: string;
5471
5511
  }[] | undefined;
5512
+ sku?: string | undefined;
5472
5513
  }[] | undefined;
5473
5514
  reviews?: {
5474
5515
  date: string;
@@ -5822,9 +5863,9 @@ export declare const HOST_MODULES: {
5822
5863
  value: string;
5823
5864
  name: string;
5824
5865
  }[] | undefined;
5866
+ sku?: string | undefined;
5825
5867
  vendor?: string | undefined;
5826
5868
  variantTitle?: string | undefined;
5827
- sku?: string | undefined;
5828
5869
  }, {
5829
5870
  id: string;
5830
5871
  title: string;
@@ -5851,9 +5892,9 @@ export declare const HOST_MODULES: {
5851
5892
  value: string;
5852
5893
  name: string;
5853
5894
  }[] | undefined;
5895
+ sku?: string | undefined;
5854
5896
  vendor?: string | undefined;
5855
5897
  variantTitle?: string | undefined;
5856
- sku?: string | undefined;
5857
5898
  }>;
5858
5899
  CartDiscountCodeSchema: zod.ZodObject<{
5859
5900
  code: zod.ZodString;
@@ -5965,9 +6006,9 @@ export declare const HOST_MODULES: {
5965
6006
  value: string;
5966
6007
  name: string;
5967
6008
  }[] | undefined;
6009
+ sku?: string | undefined;
5968
6010
  vendor?: string | undefined;
5969
6011
  variantTitle?: string | undefined;
5970
- sku?: string | undefined;
5971
6012
  }, {
5972
6013
  id: string;
5973
6014
  title: string;
@@ -5994,9 +6035,9 @@ export declare const HOST_MODULES: {
5994
6035
  value: string;
5995
6036
  name: string;
5996
6037
  }[] | undefined;
6038
+ sku?: string | undefined;
5997
6039
  vendor?: string | undefined;
5998
6040
  variantTitle?: string | undefined;
5999
- sku?: string | undefined;
6000
6041
  }>, "many">;
6001
6042
  totalQuantity: zod.ZodNumber;
6002
6043
  subtotal: zod.ZodObject<{
@@ -6074,9 +6115,9 @@ export declare const HOST_MODULES: {
6074
6115
  value: string;
6075
6116
  name: string;
6076
6117
  }[] | undefined;
6118
+ sku?: string | undefined;
6077
6119
  vendor?: string | undefined;
6078
6120
  variantTitle?: string | undefined;
6079
- sku?: string | undefined;
6080
6121
  }[];
6081
6122
  totalQuantity: number;
6082
6123
  subtotal: {
@@ -6128,9 +6169,9 @@ export declare const HOST_MODULES: {
6128
6169
  value: string;
6129
6170
  name: string;
6130
6171
  }[] | undefined;
6172
+ sku?: string | undefined;
6131
6173
  vendor?: string | undefined;
6132
6174
  variantTitle?: string | undefined;
6133
- sku?: string | undefined;
6134
6175
  }[];
6135
6176
  totalQuantity: number;
6136
6177
  subtotal: {
@@ -1,5 +1,6 @@
1
1
  export { useFourtySession, useOptionalFourtySession, useComposerDraft, FourtySessionContext, type FourtySessionContextValue, } from './FourtySessionContext';
2
2
  export { useAction } from './use-action';
3
3
  export { withSignalTurn } from './turn-attributed-session';
4
- export { getVisitorLocale } from './visitor-locale';
4
+ export { getVisitorLocale, commerceLocaleOf } from './visitor-locale';
5
+ export { SpaceLocaleProvider, useSpaceLocale, useTextDirection } from './space-locale-context';
5
6
  export { registerSessionScopedClear, runSessionScopedClearHandlers } from './clear-registry';
@@ -0,0 +1,10 @@
1
+ import * as React from 'react';
2
+ import { type TextDirection } from '../../../spacestation/src/index';
3
+ export declare function SpaceLocaleProvider({ locale, children }: {
4
+ locale: string;
5
+ children: React.ReactNode;
6
+ }): React.ReactElement;
7
+ /** The locale the space speaks (BCP 47, e.g. `he-IL`). */
8
+ export declare function useSpaceLocale(): string;
9
+ /** The space's writing direction — derived from its locale, never stored. */
10
+ export declare function useTextDirection(): TextDirection;
@@ -1,2 +1,17 @@
1
1
  import { type CommerceLocale } from '../../../ecommerce/src/index';
2
2
  export declare function getVisitorLocale(): CommerceLocale;
3
+ /**
4
+ * The {country, language} every platform factory (hydrators + commerce
5
+ * adapters) asks the store in.
6
+ *
7
+ * A space that DECLARED a locale (`declaredSpaceLocaleOf`) decides the
8
+ * language — a Hebrew space reads the store in Hebrew whatever the visitor's
9
+ * browser says — and its region decides the market: a visitor in Israel on an
10
+ * `en-US` browser (the common case there) must not be priced in dollars on an
11
+ * Israeli brand's surface. A declared locale with no region (`he`) keeps the
12
+ * visitor's country.
13
+ *
14
+ * An undeclared space (`undefined`) asks in the visitor's locale, as it always
15
+ * has; the store's own markets then decide (`resolveMarketContext`).
16
+ */
17
+ export declare function commerceLocaleOf(spaceLocale: string | undefined): CommerceLocale;
@@ -1,4 +1,4 @@
1
- import { type AttachmentRef } from '../../../../spacestation/src/index';
1
+ import { type AttachmentFailure, type AttachmentRef } from '../../../../spacestation/src/index';
2
2
  export type AttachmentStatus = 'uploading' | 'ready' | 'error';
3
3
  /** One composer attachment through its lifecycle: picked → uploading → ready /
4
4
  * error. The composer renders these as thumbnails; only `ready` ones are sent. */
@@ -12,8 +12,9 @@ export interface ComposerAttachment {
12
12
  status: AttachmentStatus;
13
13
  /** Set once the upload resolves (`status === 'ready'`). */
14
14
  ref: AttachmentRef | null;
15
- /** Visitor-safe failure message (`status === 'error'`). */
16
- error: string | null;
15
+ /** Why it failed (`status === 'error'`) — a reason the UI words in the
16
+ * space's language, never a sentence. */
17
+ failure: AttachmentFailure | null;
17
18
  }
18
19
  export interface ComposerAttachmentsApi {
19
20
  attachments: ComposerAttachment[];
@@ -7,6 +7,15 @@ export interface ComparisonAttributeRow {
7
7
  /** Per-product values keyed by `Product.id`. */
8
8
  values: Record<string, string | number | boolean>;
9
9
  }
10
+ /** The floor rows' words, in the space's language — the caller's labels
11
+ * (`useLabels().comparison.rows` in `@fourty/ui`); the sdk ships no copy. */
12
+ export interface ComparisonRowWords {
13
+ price: string;
14
+ sale: string;
15
+ rating: string;
16
+ /** A sale cell: `pct` is the whole-number percent saved. */
17
+ percentOff: (pct: number) => string;
18
+ }
10
19
  /**
11
20
  * Structured comparison floor — the SAFETY NET, not the headline. It carries
12
21
  * only the axes that are genuinely decision-relevant AND need no agent
@@ -20,11 +29,11 @@ export interface ComparisonAttributeRow {
20
29
  * Single source of truth: brand `<ComparisonTable>`s consume this and merge
21
30
  * the agent's judgment rows on top; the per-row math lives in one place.
22
31
  */
23
- export declare function buildComparisonRows(products: ReadonlyArray<Product>): ComparisonAttributeRow[];
32
+ export declare function buildComparisonRows(products: ReadonlyArray<Product>, locale: string, words: ComparisonRowWords): ComparisonAttributeRow[];
24
33
  /**
25
34
  * Defensive price formatter — returns an em-dash for half-hydrated
26
35
  * products whose `.price` hasn't materialised yet. Exported so brand
27
36
  * headers (e.g. the product-column header in a comparison table) can
28
37
  * format the same way without re-rolling the guard.
29
38
  */
30
- export declare function formatProductPrice(p: Product): string;
39
+ export declare function formatProductPrice(p: Product, locale: string): string;