@40rty/ams-sdk 0.5.6 → 0.5.7

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.
@@ -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,4 @@ 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';
@@ -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;
@@ -2359,6 +2365,9 @@ export declare const HOST_MODULES: {
2359
2365
  size: number;
2360
2366
  url: string;
2361
2367
  }>, "many">;
2368
+ MAX_ATTACHMENT_MB: number;
2369
+ AttachmentUploadError: typeof spacestation.AttachmentUploadError;
2370
+ attachmentFailureOfStatus: typeof spacestation.attachmentFailureOfStatus;
2362
2371
  ENTRY_CONTEXT_MAX_VALUE_CHARS: 200;
2363
2372
  ENTRY_CONTEXT_MAX_KEYS: 12;
2364
2373
  ENTRY_CONTEXT_MAX_NAMESPACES: 8;
@@ -2698,6 +2707,14 @@ export declare const HOST_MODULES: {
2698
2707
  AGENT_DIRECTIVE_SOURCES: readonly ["owner", "operator", "session-lesson"];
2699
2708
  AGENT_DIRECTIVE_STATUSES: readonly ["proposed", "active", "rejected", "retired"];
2700
2709
  MAX_ACTIVE_AGENT_DIRECTIVES: 12;
2710
+ DEFAULT_SPACE_LOCALE: "en-US";
2711
+ SpaceLocaleSchema: zod.ZodEffects<zod.ZodString, string, string>;
2712
+ textDirectionOf: typeof spacestation.textDirectionOf;
2713
+ languageOf: typeof spacestation.languageOf;
2714
+ languageNameOf: typeof spacestation.languageNameOf;
2715
+ spaceLocaleOf: typeof spacestation.spaceLocaleOf;
2716
+ declaredSpaceLocaleOf: typeof spacestation.declaredSpaceLocaleOf;
2717
+ SUPPORTED_SPACE_LOCALES: readonly string[];
2701
2718
  DEFAULT_SPACE_CONFIG: spacestation.SpaceConfig;
2702
2719
  DEFAULT_VISITOR_ACCESS: "open" | "identified" | "invited";
2703
2720
  VISITOR_ACCESS: readonly ["open", "identified", "invited"];
@@ -3921,16 +3938,16 @@ export declare const HOST_MODULES: {
3921
3938
  locale: zod.ZodNullable<zod.ZodString>;
3922
3939
  referrer: zod.ZodNullable<zod.ZodString>;
3923
3940
  }, "strip", zod.ZodTypeAny, {
3941
+ locale: string | null;
3924
3942
  viewportWidth: number | null;
3925
3943
  viewportHeight: number | null;
3926
3944
  userAgent: string | null;
3927
- locale: string | null;
3928
3945
  referrer: string | null;
3929
3946
  }, {
3947
+ locale: string | null;
3930
3948
  viewportWidth: number | null;
3931
3949
  viewportHeight: number | null;
3932
3950
  userAgent: string | null;
3933
- locale: string | null;
3934
3951
  referrer: string | null;
3935
3952
  }>;
3936
3953
  SessionCaptureInputSchema: zod.ZodObject<{
@@ -3943,21 +3960,21 @@ export declare const HOST_MODULES: {
3943
3960
  clientVersion: zod.ZodOptional<zod.ZodString>;
3944
3961
  isInternal: zod.ZodOptional<zod.ZodBoolean>;
3945
3962
  }, "strip", zod.ZodTypeAny, {
3963
+ locale?: string | undefined;
3946
3964
  isInternal?: boolean | undefined;
3947
3965
  clientVersion?: string | undefined;
3948
3966
  viewportWidth?: number | undefined;
3949
3967
  viewportHeight?: number | undefined;
3950
3968
  userAgent?: string | undefined;
3951
- locale?: string | undefined;
3952
3969
  referrer?: string | undefined;
3953
3970
  timeZone?: string | undefined;
3954
3971
  }, {
3972
+ locale?: string | undefined;
3955
3973
  isInternal?: boolean | undefined;
3956
3974
  clientVersion?: string | undefined;
3957
3975
  viewportWidth?: number | undefined;
3958
3976
  viewportHeight?: number | undefined;
3959
3977
  userAgent?: string | undefined;
3960
- locale?: string | undefined;
3961
3978
  referrer?: string | undefined;
3962
3979
  timeZone?: string | undefined;
3963
3980
  }>;
@@ -4069,16 +4086,16 @@ export declare const HOST_MODULES: {
4069
4086
  locale: zod.ZodNullable<zod.ZodString>;
4070
4087
  referrer: zod.ZodNullable<zod.ZodString>;
4071
4088
  }, "strip", zod.ZodTypeAny, {
4089
+ locale: string | null;
4072
4090
  viewportWidth: number | null;
4073
4091
  viewportHeight: number | null;
4074
4092
  userAgent: string | null;
4075
- locale: string | null;
4076
4093
  referrer: string | null;
4077
4094
  }, {
4095
+ locale: string | null;
4078
4096
  viewportWidth: number | null;
4079
4097
  viewportHeight: number | null;
4080
4098
  userAgent: string | null;
4081
- locale: string | null;
4082
4099
  referrer: string | null;
4083
4100
  }>;
4084
4101
  reviews: zod.ZodArray<zod.ZodObject<{
@@ -4349,10 +4366,10 @@ export declare const HOST_MODULES: {
4349
4366
  bugIssueState: string | null;
4350
4367
  };
4351
4368
  capture: {
4369
+ locale: string | null;
4352
4370
  viewportWidth: number | null;
4353
4371
  viewportHeight: number | null;
4354
4372
  userAgent: string | null;
4355
- locale: string | null;
4356
4373
  referrer: string | null;
4357
4374
  };
4358
4375
  reviews: {
@@ -4447,10 +4464,10 @@ export declare const HOST_MODULES: {
4447
4464
  bugIssueState: string | null;
4448
4465
  };
4449
4466
  capture: {
4467
+ locale: string | null;
4450
4468
  viewportWidth: number | null;
4451
4469
  viewportHeight: number | null;
4452
4470
  userAgent: string | null;
4453
- locale: string | null;
4454
4471
  referrer: string | null;
4455
4472
  };
4456
4473
  reviews: {
@@ -4699,6 +4716,9 @@ export declare const HOST_MODULES: {
4699
4716
  registerProductNameLookup: typeof ecommerce.registerProductNameLookup;
4700
4717
  resolveProductNameLookup: typeof ecommerce.resolveProductNameLookup;
4701
4718
  clearProductNameLookups: typeof ecommerce.clearProductNameLookups;
4719
+ registerCodeDiscountSource: typeof ecommerce.registerCodeDiscountSource;
4720
+ resolveCodeDiscountSource: typeof ecommerce.resolveCodeDiscountSource;
4721
+ clearCodeDiscountSources: typeof ecommerce.clearCodeDiscountSources;
4702
4722
  orderedVideoSources(video: ecommerce.ProductVideo): ecommerce.VideoSource[];
4703
4723
  createUnavailableProduct(gid: string): ecommerce.Product;
4704
4724
  isGhostEntity(value: unknown): boolean;
@@ -4905,6 +4925,7 @@ export declare const HOST_MODULES: {
4905
4925
  height?: number | undefined;
4906
4926
  srcSet?: string | undefined;
4907
4927
  }>>;
4928
+ sku: zod.ZodOptional<zod.ZodString>;
4908
4929
  }, "strip", zod.ZodTypeAny, {
4909
4930
  id: string;
4910
4931
  title: string;
@@ -4929,6 +4950,7 @@ export declare const HOST_MODULES: {
4929
4950
  value: string;
4930
4951
  name: string;
4931
4952
  }[] | undefined;
4953
+ sku?: string | undefined;
4932
4954
  }, {
4933
4955
  id: string;
4934
4956
  title: string;
@@ -4953,6 +4975,7 @@ export declare const HOST_MODULES: {
4953
4975
  value: string;
4954
4976
  name: string;
4955
4977
  }[] | undefined;
4978
+ sku?: string | undefined;
4956
4979
  }>;
4957
4980
  SiblingProductSchema: zod.ZodObject<{
4958
4981
  id: zod.ZodString;
@@ -5188,6 +5211,7 @@ export declare const HOST_MODULES: {
5188
5211
  height?: number | undefined;
5189
5212
  srcSet?: string | undefined;
5190
5213
  }>>;
5214
+ sku: zod.ZodOptional<zod.ZodString>;
5191
5215
  }, "strip", zod.ZodTypeAny, {
5192
5216
  id: string;
5193
5217
  title: string;
@@ -5212,6 +5236,7 @@ export declare const HOST_MODULES: {
5212
5236
  value: string;
5213
5237
  name: string;
5214
5238
  }[] | undefined;
5239
+ sku?: string | undefined;
5215
5240
  }, {
5216
5241
  id: string;
5217
5242
  title: string;
@@ -5236,6 +5261,7 @@ export declare const HOST_MODULES: {
5236
5261
  value: string;
5237
5262
  name: string;
5238
5263
  }[] | undefined;
5264
+ sku?: string | undefined;
5239
5265
  }>, "many">>;
5240
5266
  availableForSale: zod.ZodDefault<zod.ZodBoolean>;
5241
5267
  options: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
@@ -5364,6 +5390,7 @@ export declare const HOST_MODULES: {
5364
5390
  value: string;
5365
5391
  name: string;
5366
5392
  }[] | undefined;
5393
+ sku?: string | undefined;
5367
5394
  }[];
5368
5395
  price: {
5369
5396
  currencyCode: string;
@@ -5469,6 +5496,7 @@ export declare const HOST_MODULES: {
5469
5496
  value: string;
5470
5497
  name: string;
5471
5498
  }[] | undefined;
5499
+ sku?: string | undefined;
5472
5500
  }[] | undefined;
5473
5501
  reviews?: {
5474
5502
  date: string;
@@ -5822,9 +5850,9 @@ export declare const HOST_MODULES: {
5822
5850
  value: string;
5823
5851
  name: string;
5824
5852
  }[] | undefined;
5853
+ sku?: string | undefined;
5825
5854
  vendor?: string | undefined;
5826
5855
  variantTitle?: string | undefined;
5827
- sku?: string | undefined;
5828
5856
  }, {
5829
5857
  id: string;
5830
5858
  title: string;
@@ -5851,9 +5879,9 @@ export declare const HOST_MODULES: {
5851
5879
  value: string;
5852
5880
  name: string;
5853
5881
  }[] | undefined;
5882
+ sku?: string | undefined;
5854
5883
  vendor?: string | undefined;
5855
5884
  variantTitle?: string | undefined;
5856
- sku?: string | undefined;
5857
5885
  }>;
5858
5886
  CartDiscountCodeSchema: zod.ZodObject<{
5859
5887
  code: zod.ZodString;
@@ -5965,9 +5993,9 @@ export declare const HOST_MODULES: {
5965
5993
  value: string;
5966
5994
  name: string;
5967
5995
  }[] | undefined;
5996
+ sku?: string | undefined;
5968
5997
  vendor?: string | undefined;
5969
5998
  variantTitle?: string | undefined;
5970
- sku?: string | undefined;
5971
5999
  }, {
5972
6000
  id: string;
5973
6001
  title: string;
@@ -5994,9 +6022,9 @@ export declare const HOST_MODULES: {
5994
6022
  value: string;
5995
6023
  name: string;
5996
6024
  }[] | undefined;
6025
+ sku?: string | undefined;
5997
6026
  vendor?: string | undefined;
5998
6027
  variantTitle?: string | undefined;
5999
- sku?: string | undefined;
6000
6028
  }>, "many">;
6001
6029
  totalQuantity: zod.ZodNumber;
6002
6030
  subtotal: zod.ZodObject<{
@@ -6074,9 +6102,9 @@ export declare const HOST_MODULES: {
6074
6102
  value: string;
6075
6103
  name: string;
6076
6104
  }[] | undefined;
6105
+ sku?: string | undefined;
6077
6106
  vendor?: string | undefined;
6078
6107
  variantTitle?: string | undefined;
6079
- sku?: string | undefined;
6080
6108
  }[];
6081
6109
  totalQuantity: number;
6082
6110
  subtotal: {
@@ -6128,9 +6156,9 @@ export declare const HOST_MODULES: {
6128
6156
  value: string;
6129
6157
  name: string;
6130
6158
  }[] | undefined;
6159
+ sku?: string | undefined;
6131
6160
  vendor?: string | undefined;
6132
6161
  variantTitle?: string | undefined;
6133
- sku?: string | undefined;
6134
6162
  }[];
6135
6163
  totalQuantity: number;
6136
6164
  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;
@@ -28,7 +28,7 @@ export { preselectFromFacts } from './variant/preselect-from-facts';
28
28
  export { matchesProductFilter, pruneFilterChips, type ProductFilterChip, type ProductFilterPredicate, } from './product/product-filters';
29
29
  export { normalizeCollectionLegacy, pickCollectionAction } from './product/normalize-collection';
30
30
  export { useCommerceActions, type CommerceActions } from './use-commerce-actions';
31
- export { buildComparisonRows, formatProductPrice, type ComparisonAttributeRow, } from './comparison/comparison-rows';
31
+ export { buildComparisonRows, formatProductPrice, type ComparisonAttributeRow, type ComparisonRowWords, } from './comparison/comparison-rows';
32
32
  export { formatPrice } from './price/format-price';
33
33
  export { isOnSale } from './price/is-on-sale';
34
34
  export { resolveSwatchColor } from './variant/resolve-swatch-color';
@@ -1,7 +1,8 @@
1
1
  /**
2
- * Format a price as a localized currency string. Uses Intl.NumberFormat;
2
+ * Format a price as a localized currency string, in the SPACE's locale
3
+ * (`useSpaceLocale()`) — never a hardcoded or browser default. Uses Intl.NumberFormat;
3
4
  * brand components don't need to hand-roll currency symbols, decimals, or
4
5
  * thousand separators. Drops the decimal part when the price is a whole
5
6
  * dollar amount ($49, not $49.00) — cents only render when they're non-zero.
6
7
  */
7
- export declare function formatPrice(amount: number, currencyCode?: string, locale?: string): string;
8
+ export declare function formatPrice(amount: number, currencyCode: string, locale: string): string;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * WHY an attachment did not make it — a reason, never a sentence. The engine
3
+ * and the sdk report this; the UI words it in the space's language
4
+ * (`composer.attachmentFailure` in `@fourty/ui`'s labels). A server message is
5
+ * English diagnostics: it goes to the console, never to the visitor.
6
+ */
7
+ export type AttachmentFailure = {
8
+ kind: 'empty';
9
+ }
10
+ /** `mimeType` is what the browser reported — empty when it reported none. */
11
+ | {
12
+ kind: 'unsupported_type';
13
+ mimeType: string;
14
+ } | {
15
+ kind: 'too_large';
16
+ maxMb: number;
17
+ }
18
+ /** Picked before the session existed to upload into. */
19
+ | {
20
+ kind: 'not_ready';
21
+ } | {
22
+ kind: 'upload_failed';
23
+ };
24
+ /** The per-file ceiling in whole MB, as the visitor is told it. */
25
+ export declare const MAX_ATTACHMENT_MB: number;
26
+ /** Thrown by the upload; `message` is diagnostics, `failure` is what the visitor sees. */
27
+ export declare class AttachmentUploadError extends Error {
28
+ readonly failure: AttachmentFailure;
29
+ constructor(failure: AttachmentFailure, detail: string);
30
+ }
31
+ /** The upload endpoint's refusal status → its reason (`POST /sessions/:id/attachments`). */
32
+ export declare function attachmentFailureOfStatus(status: number, mimeType: string): AttachmentFailure;
@@ -66,6 +66,17 @@ export interface ToolExecutionContext {
66
66
  * allowing the action, never to blocking it.
67
67
  */
68
68
  readStateSnapshot?: (namespace: string) => Record<string, unknown> | undefined;
69
+ /**
70
+ * Entities of `kind` that answer to a name, best first — the space's own
71
+ * lookup for that kind (e.g. product search), registered by the platform.
72
+ * Lets an action resolve a NAME to an id in the same batch it acts in (see
73
+ * `ActionDefinition.prepare`). Absent when nothing is registered for the
74
+ * space; a caller then has nothing to resolve with.
75
+ */
76
+ findEntitiesByName?: (kind: string, name: string, limit: number) => Promise<ReadonlyArray<{
77
+ id: string;
78
+ title: string;
79
+ }>>;
69
80
  /**
70
81
  * Hand the client entities this call just resolved, as `ref → entity`, under
71
82
  * the `resolverKey` a catalog declares via `resolved()`. The client's