@40rty/ams-sdk 0.5.5 → 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.
- package/dist/index.js +872 -694
- package/dist/types/ecommerce/src/code-discounts.d.ts +47 -0
- package/dist/types/ecommerce/src/commerce-schemas.d.ts +16 -6
- package/dist/types/ecommerce/src/index.d.ts +1 -0
- package/dist/types/sdk/src/canvas/hydration-notice.d.ts +23 -0
- package/dist/types/sdk/src/canvas/index.d.ts +1 -0
- package/dist/types/sdk/src/catalog/registration/types.d.ts +4 -3
- package/dist/types/sdk/src/host/host-modules.d.ts +43 -14
- package/dist/types/sdk/src/session/index.d.ts +2 -1
- package/dist/types/sdk/src/session/space-locale-context.d.ts +10 -0
- package/dist/types/sdk/src/session/visitor-locale.d.ts +15 -0
- package/dist/types/sdk/src/shell/composer-attachments/use-composer-attachments.d.ts +4 -3
- package/dist/types/sdk/src/verticals/commerce/commerce-context.d.ts +6 -2
- package/dist/types/sdk/src/verticals/commerce/commerce-shapes.d.ts +16 -0
- package/dist/types/sdk/src/verticals/commerce/comparison/comparison-rows.d.ts +11 -2
- package/dist/types/sdk/src/verticals/commerce/index.d.ts +3 -3
- package/dist/types/sdk/src/verticals/commerce/price/format-price.d.ts +3 -2
- package/dist/types/spacestation/src/attachment/attachment-failure.d.ts +32 -0
- package/dist/types/spacestation/src/contracts/tools/definitions.d.ts +9 -0
- package/dist/types/spacestation/src/contracts/tools/execution-context.d.ts +11 -0
- package/dist/types/spacestation/src/index.d.ts +4 -1
- package/dist/types/spacestation/src/signal/agent-signals.d.ts +36 -0
- package/dist/types/spacestation/src/space/session-queue.d.ts +8 -8
- package/dist/types/spacestation/src/space/space-config.d.ts +4 -0
- package/dist/types/spacestation/src/space/space-locale.d.ts +46 -0
- 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,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';
|
|
@@ -69,9 +69,10 @@ export interface FourtyPackage {
|
|
|
69
69
|
}>;
|
|
70
70
|
/**
|
|
71
71
|
* URL of the package's own page stylesheet — set for a package whose CSS is
|
|
72
|
-
* PUBLISHED with it rather than compiled into the page that renders it.
|
|
73
|
-
*
|
|
74
|
-
*
|
|
72
|
+
* PUBLISHED with it rather than compiled into the page that renders it.
|
|
73
|
+
* Installed into whatever document or shadow root draws the package
|
|
74
|
+
* (`@fourty/spacefront`'s `PackageScope`); the console never draws one in
|
|
75
|
+
* its own document.
|
|
75
76
|
*/
|
|
76
77
|
stylesheet?: string;
|
|
77
78
|
/**
|
|
@@ -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;
|
|
@@ -343,6 +349,7 @@ export declare const HOST_MODULES: {
|
|
|
343
349
|
useProducts: typeof sdk.useProducts;
|
|
344
350
|
useCollectionByHandle: typeof sdk.useCollectionByHandle;
|
|
345
351
|
useProductReviews: typeof sdk.useProductReviews;
|
|
352
|
+
useCustomerAccount: typeof sdk.useCustomerAccount;
|
|
346
353
|
useCommerceRuntime: typeof sdk.useCommerceRuntime;
|
|
347
354
|
FourtyCommerceRuntimeProvider: react.Provider<sdk.FourtyCommerceRuntime>;
|
|
348
355
|
navigateToExternalCommerceUrl: typeof sdk.navigateToExternalCommerceUrl;
|
|
@@ -2358,6 +2365,9 @@ export declare const HOST_MODULES: {
|
|
|
2358
2365
|
size: number;
|
|
2359
2366
|
url: string;
|
|
2360
2367
|
}>, "many">;
|
|
2368
|
+
MAX_ATTACHMENT_MB: number;
|
|
2369
|
+
AttachmentUploadError: typeof spacestation.AttachmentUploadError;
|
|
2370
|
+
attachmentFailureOfStatus: typeof spacestation.attachmentFailureOfStatus;
|
|
2361
2371
|
ENTRY_CONTEXT_MAX_VALUE_CHARS: 200;
|
|
2362
2372
|
ENTRY_CONTEXT_MAX_KEYS: 12;
|
|
2363
2373
|
ENTRY_CONTEXT_MAX_NAMESPACES: 8;
|
|
@@ -2697,6 +2707,14 @@ export declare const HOST_MODULES: {
|
|
|
2697
2707
|
AGENT_DIRECTIVE_SOURCES: readonly ["owner", "operator", "session-lesson"];
|
|
2698
2708
|
AGENT_DIRECTIVE_STATUSES: readonly ["proposed", "active", "rejected", "retired"];
|
|
2699
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[];
|
|
2700
2718
|
DEFAULT_SPACE_CONFIG: spacestation.SpaceConfig;
|
|
2701
2719
|
DEFAULT_VISITOR_ACCESS: "open" | "identified" | "invited";
|
|
2702
2720
|
VISITOR_ACCESS: readonly ["open", "identified", "invited"];
|
|
@@ -3920,16 +3938,16 @@ export declare const HOST_MODULES: {
|
|
|
3920
3938
|
locale: zod.ZodNullable<zod.ZodString>;
|
|
3921
3939
|
referrer: zod.ZodNullable<zod.ZodString>;
|
|
3922
3940
|
}, "strip", zod.ZodTypeAny, {
|
|
3941
|
+
locale: string | null;
|
|
3923
3942
|
viewportWidth: number | null;
|
|
3924
3943
|
viewportHeight: number | null;
|
|
3925
3944
|
userAgent: string | null;
|
|
3926
|
-
locale: string | null;
|
|
3927
3945
|
referrer: string | null;
|
|
3928
3946
|
}, {
|
|
3947
|
+
locale: string | null;
|
|
3929
3948
|
viewportWidth: number | null;
|
|
3930
3949
|
viewportHeight: number | null;
|
|
3931
3950
|
userAgent: string | null;
|
|
3932
|
-
locale: string | null;
|
|
3933
3951
|
referrer: string | null;
|
|
3934
3952
|
}>;
|
|
3935
3953
|
SessionCaptureInputSchema: zod.ZodObject<{
|
|
@@ -3942,21 +3960,21 @@ export declare const HOST_MODULES: {
|
|
|
3942
3960
|
clientVersion: zod.ZodOptional<zod.ZodString>;
|
|
3943
3961
|
isInternal: zod.ZodOptional<zod.ZodBoolean>;
|
|
3944
3962
|
}, "strip", zod.ZodTypeAny, {
|
|
3963
|
+
locale?: string | undefined;
|
|
3945
3964
|
isInternal?: boolean | undefined;
|
|
3946
3965
|
clientVersion?: string | undefined;
|
|
3947
3966
|
viewportWidth?: number | undefined;
|
|
3948
3967
|
viewportHeight?: number | undefined;
|
|
3949
3968
|
userAgent?: string | undefined;
|
|
3950
|
-
locale?: string | undefined;
|
|
3951
3969
|
referrer?: string | undefined;
|
|
3952
3970
|
timeZone?: string | undefined;
|
|
3953
3971
|
}, {
|
|
3972
|
+
locale?: string | undefined;
|
|
3954
3973
|
isInternal?: boolean | undefined;
|
|
3955
3974
|
clientVersion?: string | undefined;
|
|
3956
3975
|
viewportWidth?: number | undefined;
|
|
3957
3976
|
viewportHeight?: number | undefined;
|
|
3958
3977
|
userAgent?: string | undefined;
|
|
3959
|
-
locale?: string | undefined;
|
|
3960
3978
|
referrer?: string | undefined;
|
|
3961
3979
|
timeZone?: string | undefined;
|
|
3962
3980
|
}>;
|
|
@@ -4068,16 +4086,16 @@ export declare const HOST_MODULES: {
|
|
|
4068
4086
|
locale: zod.ZodNullable<zod.ZodString>;
|
|
4069
4087
|
referrer: zod.ZodNullable<zod.ZodString>;
|
|
4070
4088
|
}, "strip", zod.ZodTypeAny, {
|
|
4089
|
+
locale: string | null;
|
|
4071
4090
|
viewportWidth: number | null;
|
|
4072
4091
|
viewportHeight: number | null;
|
|
4073
4092
|
userAgent: string | null;
|
|
4074
|
-
locale: string | null;
|
|
4075
4093
|
referrer: string | null;
|
|
4076
4094
|
}, {
|
|
4095
|
+
locale: string | null;
|
|
4077
4096
|
viewportWidth: number | null;
|
|
4078
4097
|
viewportHeight: number | null;
|
|
4079
4098
|
userAgent: string | null;
|
|
4080
|
-
locale: string | null;
|
|
4081
4099
|
referrer: string | null;
|
|
4082
4100
|
}>;
|
|
4083
4101
|
reviews: zod.ZodArray<zod.ZodObject<{
|
|
@@ -4348,10 +4366,10 @@ export declare const HOST_MODULES: {
|
|
|
4348
4366
|
bugIssueState: string | null;
|
|
4349
4367
|
};
|
|
4350
4368
|
capture: {
|
|
4369
|
+
locale: string | null;
|
|
4351
4370
|
viewportWidth: number | null;
|
|
4352
4371
|
viewportHeight: number | null;
|
|
4353
4372
|
userAgent: string | null;
|
|
4354
|
-
locale: string | null;
|
|
4355
4373
|
referrer: string | null;
|
|
4356
4374
|
};
|
|
4357
4375
|
reviews: {
|
|
@@ -4446,10 +4464,10 @@ export declare const HOST_MODULES: {
|
|
|
4446
4464
|
bugIssueState: string | null;
|
|
4447
4465
|
};
|
|
4448
4466
|
capture: {
|
|
4467
|
+
locale: string | null;
|
|
4449
4468
|
viewportWidth: number | null;
|
|
4450
4469
|
viewportHeight: number | null;
|
|
4451
4470
|
userAgent: string | null;
|
|
4452
|
-
locale: string | null;
|
|
4453
4471
|
referrer: string | null;
|
|
4454
4472
|
};
|
|
4455
4473
|
reviews: {
|
|
@@ -4698,6 +4716,9 @@ export declare const HOST_MODULES: {
|
|
|
4698
4716
|
registerProductNameLookup: typeof ecommerce.registerProductNameLookup;
|
|
4699
4717
|
resolveProductNameLookup: typeof ecommerce.resolveProductNameLookup;
|
|
4700
4718
|
clearProductNameLookups: typeof ecommerce.clearProductNameLookups;
|
|
4719
|
+
registerCodeDiscountSource: typeof ecommerce.registerCodeDiscountSource;
|
|
4720
|
+
resolveCodeDiscountSource: typeof ecommerce.resolveCodeDiscountSource;
|
|
4721
|
+
clearCodeDiscountSources: typeof ecommerce.clearCodeDiscountSources;
|
|
4701
4722
|
orderedVideoSources(video: ecommerce.ProductVideo): ecommerce.VideoSource[];
|
|
4702
4723
|
createUnavailableProduct(gid: string): ecommerce.Product;
|
|
4703
4724
|
isGhostEntity(value: unknown): boolean;
|
|
@@ -4904,6 +4925,7 @@ export declare const HOST_MODULES: {
|
|
|
4904
4925
|
height?: number | undefined;
|
|
4905
4926
|
srcSet?: string | undefined;
|
|
4906
4927
|
}>>;
|
|
4928
|
+
sku: zod.ZodOptional<zod.ZodString>;
|
|
4907
4929
|
}, "strip", zod.ZodTypeAny, {
|
|
4908
4930
|
id: string;
|
|
4909
4931
|
title: string;
|
|
@@ -4928,6 +4950,7 @@ export declare const HOST_MODULES: {
|
|
|
4928
4950
|
value: string;
|
|
4929
4951
|
name: string;
|
|
4930
4952
|
}[] | undefined;
|
|
4953
|
+
sku?: string | undefined;
|
|
4931
4954
|
}, {
|
|
4932
4955
|
id: string;
|
|
4933
4956
|
title: string;
|
|
@@ -4952,6 +4975,7 @@ export declare const HOST_MODULES: {
|
|
|
4952
4975
|
value: string;
|
|
4953
4976
|
name: string;
|
|
4954
4977
|
}[] | undefined;
|
|
4978
|
+
sku?: string | undefined;
|
|
4955
4979
|
}>;
|
|
4956
4980
|
SiblingProductSchema: zod.ZodObject<{
|
|
4957
4981
|
id: zod.ZodString;
|
|
@@ -5187,6 +5211,7 @@ export declare const HOST_MODULES: {
|
|
|
5187
5211
|
height?: number | undefined;
|
|
5188
5212
|
srcSet?: string | undefined;
|
|
5189
5213
|
}>>;
|
|
5214
|
+
sku: zod.ZodOptional<zod.ZodString>;
|
|
5190
5215
|
}, "strip", zod.ZodTypeAny, {
|
|
5191
5216
|
id: string;
|
|
5192
5217
|
title: string;
|
|
@@ -5211,6 +5236,7 @@ export declare const HOST_MODULES: {
|
|
|
5211
5236
|
value: string;
|
|
5212
5237
|
name: string;
|
|
5213
5238
|
}[] | undefined;
|
|
5239
|
+
sku?: string | undefined;
|
|
5214
5240
|
}, {
|
|
5215
5241
|
id: string;
|
|
5216
5242
|
title: string;
|
|
@@ -5235,6 +5261,7 @@ export declare const HOST_MODULES: {
|
|
|
5235
5261
|
value: string;
|
|
5236
5262
|
name: string;
|
|
5237
5263
|
}[] | undefined;
|
|
5264
|
+
sku?: string | undefined;
|
|
5238
5265
|
}>, "many">>;
|
|
5239
5266
|
availableForSale: zod.ZodDefault<zod.ZodBoolean>;
|
|
5240
5267
|
options: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
|
|
@@ -5363,6 +5390,7 @@ export declare const HOST_MODULES: {
|
|
|
5363
5390
|
value: string;
|
|
5364
5391
|
name: string;
|
|
5365
5392
|
}[] | undefined;
|
|
5393
|
+
sku?: string | undefined;
|
|
5366
5394
|
}[];
|
|
5367
5395
|
price: {
|
|
5368
5396
|
currencyCode: string;
|
|
@@ -5468,6 +5496,7 @@ export declare const HOST_MODULES: {
|
|
|
5468
5496
|
value: string;
|
|
5469
5497
|
name: string;
|
|
5470
5498
|
}[] | undefined;
|
|
5499
|
+
sku?: string | undefined;
|
|
5471
5500
|
}[] | undefined;
|
|
5472
5501
|
reviews?: {
|
|
5473
5502
|
date: string;
|
|
@@ -5821,9 +5850,9 @@ export declare const HOST_MODULES: {
|
|
|
5821
5850
|
value: string;
|
|
5822
5851
|
name: string;
|
|
5823
5852
|
}[] | undefined;
|
|
5853
|
+
sku?: string | undefined;
|
|
5824
5854
|
vendor?: string | undefined;
|
|
5825
5855
|
variantTitle?: string | undefined;
|
|
5826
|
-
sku?: string | undefined;
|
|
5827
5856
|
}, {
|
|
5828
5857
|
id: string;
|
|
5829
5858
|
title: string;
|
|
@@ -5850,9 +5879,9 @@ export declare const HOST_MODULES: {
|
|
|
5850
5879
|
value: string;
|
|
5851
5880
|
name: string;
|
|
5852
5881
|
}[] | undefined;
|
|
5882
|
+
sku?: string | undefined;
|
|
5853
5883
|
vendor?: string | undefined;
|
|
5854
5884
|
variantTitle?: string | undefined;
|
|
5855
|
-
sku?: string | undefined;
|
|
5856
5885
|
}>;
|
|
5857
5886
|
CartDiscountCodeSchema: zod.ZodObject<{
|
|
5858
5887
|
code: zod.ZodString;
|
|
@@ -5964,9 +5993,9 @@ export declare const HOST_MODULES: {
|
|
|
5964
5993
|
value: string;
|
|
5965
5994
|
name: string;
|
|
5966
5995
|
}[] | undefined;
|
|
5996
|
+
sku?: string | undefined;
|
|
5967
5997
|
vendor?: string | undefined;
|
|
5968
5998
|
variantTitle?: string | undefined;
|
|
5969
|
-
sku?: string | undefined;
|
|
5970
5999
|
}, {
|
|
5971
6000
|
id: string;
|
|
5972
6001
|
title: string;
|
|
@@ -5993,9 +6022,9 @@ export declare const HOST_MODULES: {
|
|
|
5993
6022
|
value: string;
|
|
5994
6023
|
name: string;
|
|
5995
6024
|
}[] | undefined;
|
|
6025
|
+
sku?: string | undefined;
|
|
5996
6026
|
vendor?: string | undefined;
|
|
5997
6027
|
variantTitle?: string | undefined;
|
|
5998
|
-
sku?: string | undefined;
|
|
5999
6028
|
}>, "many">;
|
|
6000
6029
|
totalQuantity: zod.ZodNumber;
|
|
6001
6030
|
subtotal: zod.ZodObject<{
|
|
@@ -6073,9 +6102,9 @@ export declare const HOST_MODULES: {
|
|
|
6073
6102
|
value: string;
|
|
6074
6103
|
name: string;
|
|
6075
6104
|
}[] | undefined;
|
|
6105
|
+
sku?: string | undefined;
|
|
6076
6106
|
vendor?: string | undefined;
|
|
6077
6107
|
variantTitle?: string | undefined;
|
|
6078
|
-
sku?: string | undefined;
|
|
6079
6108
|
}[];
|
|
6080
6109
|
totalQuantity: number;
|
|
6081
6110
|
subtotal: {
|
|
@@ -6127,9 +6156,9 @@ export declare const HOST_MODULES: {
|
|
|
6127
6156
|
value: string;
|
|
6128
6157
|
name: string;
|
|
6129
6158
|
}[] | undefined;
|
|
6159
|
+
sku?: string | undefined;
|
|
6130
6160
|
vendor?: string | undefined;
|
|
6131
6161
|
variantTitle?: string | undefined;
|
|
6132
|
-
sku?: string | undefined;
|
|
6133
6162
|
}[];
|
|
6134
6163
|
totalQuantity: number;
|
|
6135
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
|
-
/**
|
|
16
|
-
|
|
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[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Product } from '../../../../ecommerce/src/index';
|
|
2
|
-
export type { AddToCartApi, CartAddHints, CartAddOptions, CartApi, ProductReviewHighlight, ProductReviewItem, ProductReviewsResult, ProductsQuery, ToggleWishlistApi, WishlistApi, WishlistState, } from './commerce-shapes';
|
|
3
|
-
import type { AddToCartApi, CartAddHints, CartApi, ProductReviewsResult, ProductsQuery, ToggleWishlistApi, WishlistApi } from './commerce-shapes';
|
|
2
|
+
export type { AddToCartApi, CartAddHints, CartAddOptions, CartApi, CustomerAccountApi, ProductReviewHighlight, ProductReviewItem, ProductReviewsResult, ProductsQuery, ToggleWishlistApi, WishlistApi, WishlistState, } from './commerce-shapes';
|
|
3
|
+
import type { AddToCartApi, CartAddHints, CartApi, CustomerAccountApi, ProductReviewsResult, ProductsQuery, ToggleWishlistApi, WishlistApi } from './commerce-shapes';
|
|
4
4
|
/**
|
|
5
5
|
* FourtyCommerceRuntime — the commerce-hook surface the catalog
|
|
6
6
|
* consumes. Same dependency-inversion pattern as `FourtyRuntime`: these
|
|
@@ -28,6 +28,7 @@ export interface FourtyCommerceRuntime {
|
|
|
28
28
|
* reviews yet is generated on demand server-side from its title +
|
|
29
29
|
* description, so the hook needs that context, not just the id. */
|
|
30
30
|
useProductReviews: (product: Product | undefined, intent?: string) => ProductReviewsResult;
|
|
31
|
+
useCustomerAccount: () => CustomerAccountApi;
|
|
31
32
|
}
|
|
32
33
|
/**
|
|
33
34
|
* Provider for the commerce-hook surface. Mounted by the SDK's
|
|
@@ -60,3 +61,6 @@ export declare function useCollectionByHandle(handle: string | undefined): Produ
|
|
|
60
61
|
* a separate, third-party-shaped system, independent of the active
|
|
61
62
|
* commerce platform. Degrades to empty without a `<CommerceProvider>`. */
|
|
62
63
|
export declare function useProductReviews(product: Product | undefined, intent?: string): ProductReviewsResult;
|
|
64
|
+
/** The visitor's sign-in to the store's customer accounts. Inert (not
|
|
65
|
+
* available) without a `<CommerceProvider>`. */
|
|
66
|
+
export declare function useCustomerAccount(): CustomerAccountApi;
|
|
@@ -171,3 +171,19 @@ export interface ProductReviewsResult {
|
|
|
171
171
|
isLoading: boolean;
|
|
172
172
|
error: Error | null;
|
|
173
173
|
}
|
|
174
|
+
/** Return shape of the commerce `useCustomerAccount` hook — the visitor's
|
|
175
|
+
* sign-in to the store's own customer accounts, for this session. The token
|
|
176
|
+
* never reaches the page: this is only whether they are signed in, and as whom. */
|
|
177
|
+
export interface CustomerAccountApi {
|
|
178
|
+
/** `null` until the first check answers. */
|
|
179
|
+
signedIn: boolean | null;
|
|
180
|
+
/** Who is signed in, when they are. */
|
|
181
|
+
email: string | null;
|
|
182
|
+
/** Leave for the store's sign-in; the page comes back signed in. */
|
|
183
|
+
signIn: () => void;
|
|
184
|
+
/** Drop this session's sign-in. */
|
|
185
|
+
signOut: () => Promise<void>;
|
|
186
|
+
/** False where the page has no customer sign-in to offer (no session yet,
|
|
187
|
+
* or a space addressed by id, as in a console preview). */
|
|
188
|
+
available: boolean;
|
|
189
|
+
}
|
|
@@ -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
|
|
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;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './chip-relevance';
|
|
2
|
-
export { useCart, useAddToCart, useWishlist, useToggleWishlist, useProducts, useCollectionByHandle, useProductReviews, useCommerceRuntime, FourtyCommerceRuntimeProvider, } from './commerce-context';
|
|
3
|
-
export type { FourtyCommerceRuntime, CartApi, AddToCartApi, WishlistApi, ToggleWishlistApi, ProductsQuery, ProductReviewItem, ProductReviewHighlight, ProductReviewsResult, CartAddOptions, CartAddHints, WishlistState, } from './commerce-context';
|
|
2
|
+
export { useCart, useAddToCart, useWishlist, useToggleWishlist, useProducts, useCollectionByHandle, useProductReviews, useCustomerAccount, useCommerceRuntime, FourtyCommerceRuntimeProvider, } from './commerce-context';
|
|
3
|
+
export type { FourtyCommerceRuntime, CartApi, AddToCartApi, WishlistApi, ToggleWishlistApi, ProductsQuery, ProductReviewItem, ProductReviewHighlight, ProductReviewsResult, CustomerAccountApi, CartAddOptions, CartAddHints, WishlistState, } from './commerce-context';
|
|
4
4
|
export { navigateToExternalCommerceUrl } from './checkout/external-navigation';
|
|
5
5
|
export type { ExternalNavigationResult } from './checkout/external-navigation';
|
|
6
6
|
export { recordVariantSelection, getVariantSelection, useVariantSelections, } from './variant/variant-selection-store';
|
|
@@ -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';
|