@40rty/ams-sdk 0.5.16 → 0.5.18
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 +185 -178
- package/dist/types/ecommerce/src/commerce-schemas.d.ts +31 -0
- package/dist/types/sdk/src/canvas/index.d.ts +0 -1
- package/dist/types/sdk/src/host/host-modules.d.ts +3 -3
- package/dist/types/sdk/src/verticals/commerce/commerce-context.d.ts +14 -2
- package/dist/types/sdk/src/verticals/commerce/commerce-shapes.d.ts +23 -1
- package/dist/types/sdk/src/verticals/commerce/index.d.ts +2 -2
- package/dist/types/spacestation/src/catalog/catalog-schemas.d.ts +3 -2
- package/dist/types/spacestation/src/contracts/retrieval/core/platform-connector.d.ts +6 -0
- package/dist/types/spacestation/src/contracts/tools/execution-context.d.ts +11 -0
- package/dist/types/spacestation/src/contracts/tools/index.d.ts +1 -1
- package/dist/types/spacestation/src/contracts/tools/types.d.ts +1 -1
- package/dist/types/spacestation/src/space/agent-directive.d.ts +4 -4
- package/dist/types/spacestation/src/trace/trace-diagnostics.d.ts +10 -0
- package/package.json +1 -1
- package/dist/types/sdk/src/canvas/hydration-notice.d.ts +0 -23
package/dist/index.js
CHANGED
|
@@ -151,7 +151,6 @@ __export(src_exports3, {
|
|
|
151
151
|
HostExportsSchema: () => HostExportsSchema,
|
|
152
152
|
HostImportsSchema: () => HostImportsSchema,
|
|
153
153
|
HostPayloadSchema: () => HostPayloadSchema,
|
|
154
|
-
HydrationNoticeProvider: () => HydrationNoticeProvider,
|
|
155
154
|
HydrationStateContext: () => HydrationStateContext,
|
|
156
155
|
HydratorProvider: () => HydratorProvider,
|
|
157
156
|
INITIAL_NAV_PRESENTATION: () => INITIAL_NAV_PRESENTATION,
|
|
@@ -592,6 +591,7 @@ __export(src_exports3, {
|
|
|
592
591
|
useAgentPresenceFrame: () => useAgentPresenceFrame,
|
|
593
592
|
useAgentPresenceFresh: () => useAgentPresenceFresh,
|
|
594
593
|
useAnalyticsSink: () => useAnalyticsSink,
|
|
594
|
+
useAskStore: () => useAskStore,
|
|
595
595
|
useBotCheckNotice: () => useBotCheckNotice,
|
|
596
596
|
useCanvasActions: () => useCanvasActions,
|
|
597
597
|
useCanvasArrangement: () => useCanvasArrangement,
|
|
@@ -656,7 +656,6 @@ __export(src_exports3, {
|
|
|
656
656
|
useHasLeftSeedHome: () => useHasLeftSeedHome,
|
|
657
657
|
useHistoryNav: () => useHistoryNav,
|
|
658
658
|
useHydrated: () => useHydrated,
|
|
659
|
-
useHydrationNotice: () => useHydrationNotice,
|
|
660
659
|
useHydrationState: () => useHydrationState,
|
|
661
660
|
useHydrators: () => useHydrators,
|
|
662
661
|
useInlineCompletion: () => useInlineCompletion,
|
|
@@ -715,6 +714,7 @@ __export(src_exports3, {
|
|
|
715
714
|
useShellRoot: () => useShellRoot,
|
|
716
715
|
useSpaceLocale: () => useSpaceLocale,
|
|
717
716
|
useStandingOfType: () => useStandingOfType,
|
|
717
|
+
useStoreCheckouts: () => useStoreCheckouts,
|
|
718
718
|
useStream: () => useStream,
|
|
719
719
|
useSuccessFlash: () => useSuccessFlash,
|
|
720
720
|
useSuggestionsWithDefaults: () => useSuggestionsWithDefaults,
|
|
@@ -4119,7 +4119,7 @@ function scopeOfAttributeKey(config, key) {
|
|
|
4119
4119
|
|
|
4120
4120
|
// ../spacestation/src/space/agent-directive.ts
|
|
4121
4121
|
import { z as z38 } from "zod";
|
|
4122
|
-
var MAX_ACTIVE_AGENT_DIRECTIVES =
|
|
4122
|
+
var MAX_ACTIVE_AGENT_DIRECTIVES = 20;
|
|
4123
4123
|
var AGENT_DIRECTIVE_KINDS = ["preference", "pairing", "order of things", "promise", "threshold"];
|
|
4124
4124
|
var AGENT_DIRECTIVE_SEVERITIES = ["a missed opportunity", "a problem", "unacceptable"];
|
|
4125
4125
|
var AGENT_DIRECTIVE_SOURCES = ["owner", "operator", "session-lesson"];
|
|
@@ -8103,7 +8103,6 @@ __export(canvas_exports, {
|
|
|
8103
8103
|
GENERATION_EASE: () => GENERATION_EASE,
|
|
8104
8104
|
GenerationStyleContext: () => GenerationStyleContext,
|
|
8105
8105
|
GenerationStyleProvider: () => GenerationStyleProvider,
|
|
8106
|
-
HydrationNoticeProvider: () => HydrationNoticeProvider,
|
|
8107
8106
|
INITIAL_NAV_PRESENTATION: () => INITIAL_NAV_PRESENTATION,
|
|
8108
8107
|
ITEM_IDENTITY_ATTR: () => ITEM_IDENTITY_ATTR,
|
|
8109
8108
|
ItemTransitionGroup: () => ItemTransitionGroup,
|
|
@@ -8165,7 +8164,6 @@ __export(canvas_exports, {
|
|
|
8165
8164
|
useGenerationStyle: () => useGenerationStyle,
|
|
8166
8165
|
useHasLeftSeedHome: () => useHasLeftSeedHome,
|
|
8167
8166
|
useHistoryNav: () => useHistoryNav,
|
|
8168
|
-
useHydrationNotice: () => useHydrationNotice,
|
|
8169
8167
|
useInteraction: () => useInteraction,
|
|
8170
8168
|
useIsSeedHome: () => useIsSeedHome,
|
|
8171
8169
|
useLayout: () => useLayout,
|
|
@@ -8209,19 +8207,8 @@ function CanvasTailMount({
|
|
|
8209
8207
|
return /* @__PURE__ */ jsx9(Tail, {});
|
|
8210
8208
|
}
|
|
8211
8209
|
|
|
8212
|
-
// src/canvas/hydration-notice.tsx
|
|
8213
|
-
import * as React27 from "react";
|
|
8214
|
-
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
8215
|
-
var HydrationNoticeContext = React27.createContext(null);
|
|
8216
|
-
function HydrationNoticeProvider({ notice, children }) {
|
|
8217
|
-
return /* @__PURE__ */ jsx10(HydrationNoticeContext.Provider, { value: notice, children });
|
|
8218
|
-
}
|
|
8219
|
-
function useHydrationNotice() {
|
|
8220
|
-
return React27.useContext(HydrationNoticeContext);
|
|
8221
|
-
}
|
|
8222
|
-
|
|
8223
8210
|
// src/canvas/GenerationStyleContext.tsx
|
|
8224
|
-
import { createContext as
|
|
8211
|
+
import { createContext as createContext12, useContext as useContext12 } from "react";
|
|
8225
8212
|
|
|
8226
8213
|
// src/canvas/generation-style.ts
|
|
8227
8214
|
var DEFAULT_GENERATION_TIMINGS = {
|
|
@@ -8247,19 +8234,19 @@ var DEFAULT_GENERATION_STYLE = {
|
|
|
8247
8234
|
var GENERATION_EASE = [0.76, 0, 0.24, 1];
|
|
8248
8235
|
|
|
8249
8236
|
// src/canvas/GenerationStyleContext.tsx
|
|
8250
|
-
var GenerationStyleContext =
|
|
8237
|
+
var GenerationStyleContext = createContext12(DEFAULT_GENERATION_STYLE);
|
|
8251
8238
|
var GenerationStyleProvider = GenerationStyleContext.Provider;
|
|
8252
8239
|
function useGenerationStyle() {
|
|
8253
|
-
return
|
|
8240
|
+
return useContext12(GenerationStyleContext);
|
|
8254
8241
|
}
|
|
8255
8242
|
|
|
8256
8243
|
// src/canvas/ShimmerSweep.tsx
|
|
8257
8244
|
import { motion, useReducedMotion } from "framer-motion";
|
|
8258
|
-
import { jsx as
|
|
8245
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
8259
8246
|
function ShimmerSweep({ durationS }) {
|
|
8260
8247
|
const reduce = useReducedMotion();
|
|
8261
8248
|
if (reduce === true) return null;
|
|
8262
|
-
return /* @__PURE__ */
|
|
8249
|
+
return /* @__PURE__ */ jsx10(
|
|
8263
8250
|
motion.div,
|
|
8264
8251
|
{
|
|
8265
8252
|
"aria-hidden": true,
|
|
@@ -8277,14 +8264,14 @@ function ShimmerSweep({ durationS }) {
|
|
|
8277
8264
|
}
|
|
8278
8265
|
|
|
8279
8266
|
// src/canvas/TransitionContext.tsx
|
|
8280
|
-
import
|
|
8267
|
+
import React27, { createContext as createContext13, useContext as useContext13 } from "react";
|
|
8281
8268
|
import { AnimatePresence, motion as motion2 } from "framer-motion";
|
|
8282
|
-
import { jsx as
|
|
8269
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
8283
8270
|
function FadeGroup({ children }) {
|
|
8284
|
-
return /* @__PURE__ */
|
|
8271
|
+
return /* @__PURE__ */ jsx11(AnimatePresence, { mode: "popLayout", initial: false, children });
|
|
8285
8272
|
}
|
|
8286
|
-
var FadeItem =
|
|
8287
|
-
return /* @__PURE__ */
|
|
8273
|
+
var FadeItem = React27.forwardRef(function FadeItem2({ id, children, style, className }, ref) {
|
|
8274
|
+
return /* @__PURE__ */ jsx11(
|
|
8288
8275
|
motion2.div,
|
|
8289
8276
|
{
|
|
8290
8277
|
ref,
|
|
@@ -8299,62 +8286,62 @@ var FadeTransition = {
|
|
|
8299
8286
|
Group: FadeGroup,
|
|
8300
8287
|
Item: FadeItem
|
|
8301
8288
|
};
|
|
8302
|
-
var TransitionContext =
|
|
8289
|
+
var TransitionContext = createContext13(FadeTransition);
|
|
8303
8290
|
function TransitionProvider({
|
|
8304
8291
|
transition,
|
|
8305
8292
|
children
|
|
8306
8293
|
}) {
|
|
8307
|
-
return /* @__PURE__ */
|
|
8294
|
+
return /* @__PURE__ */ jsx11(TransitionContext.Provider, { value: transition, children });
|
|
8308
8295
|
}
|
|
8309
8296
|
function useLayoutTransition() {
|
|
8310
|
-
return
|
|
8297
|
+
return useContext13(TransitionContext);
|
|
8311
8298
|
}
|
|
8312
8299
|
|
|
8313
8300
|
// src/canvas/canvas-arrangement.tsx
|
|
8314
|
-
import
|
|
8315
|
-
import { jsx as
|
|
8316
|
-
var CanvasArrangementContext =
|
|
8301
|
+
import React28, { createContext as createContext14, useContext as useContext14 } from "react";
|
|
8302
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
8303
|
+
var CanvasArrangementContext = createContext14({ arrangement: "stack", turnPages: false });
|
|
8317
8304
|
function CanvasArrangementProvider({
|
|
8318
8305
|
arrangement,
|
|
8319
8306
|
turnPages = false,
|
|
8320
8307
|
children
|
|
8321
8308
|
}) {
|
|
8322
|
-
const value =
|
|
8323
|
-
return /* @__PURE__ */
|
|
8309
|
+
const value = React28.useMemo(() => ({ arrangement, turnPages }), [arrangement, turnPages]);
|
|
8310
|
+
return /* @__PURE__ */ jsx12(CanvasArrangementContext.Provider, { value, children });
|
|
8324
8311
|
}
|
|
8325
8312
|
function useCanvasArrangement() {
|
|
8326
|
-
return
|
|
8313
|
+
return useContext14(CanvasArrangementContext);
|
|
8327
8314
|
}
|
|
8328
8315
|
|
|
8329
8316
|
// src/canvas/canvas-lead.tsx
|
|
8330
|
-
import * as
|
|
8331
|
-
import { jsx as
|
|
8317
|
+
import * as React29 from "react";
|
|
8318
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
8332
8319
|
var NO_LEAD = () => false;
|
|
8333
|
-
var CanvasLeadContext =
|
|
8320
|
+
var CanvasLeadContext = React29.createContext(null);
|
|
8334
8321
|
function CanvasLeadProvider(props) {
|
|
8335
|
-
const [target, setTarget] =
|
|
8336
|
-
const [leadId, setLeadId] =
|
|
8322
|
+
const [target, setTarget] = React29.useState(null);
|
|
8323
|
+
const [leadId, setLeadId] = React29.useState(null);
|
|
8337
8324
|
const listed = "types" in props ? props.types : props.except;
|
|
8338
8325
|
const only = "types" in props;
|
|
8339
|
-
const canLead =
|
|
8340
|
-
const value =
|
|
8341
|
-
return /* @__PURE__ */
|
|
8326
|
+
const canLead = React29.useCallback((type) => listed.includes(type) === only, [listed, only]);
|
|
8327
|
+
const value = React29.useMemo(() => ({ canLead, target, setTarget, leadId, setLeadId }), [canLead, target, leadId]);
|
|
8328
|
+
return /* @__PURE__ */ jsx13(CanvasLeadContext.Provider, { value, children: props.children });
|
|
8342
8329
|
}
|
|
8343
8330
|
function CanvasLeadSlot({ className }) {
|
|
8344
|
-
const lead =
|
|
8331
|
+
const lead = React29.useContext(CanvasLeadContext);
|
|
8345
8332
|
if (lead === null) throw new Error("<CanvasLeadSlot> must be rendered inside <CanvasLeadProvider>.");
|
|
8346
8333
|
const { setTarget } = lead;
|
|
8347
|
-
const ref =
|
|
8348
|
-
return /* @__PURE__ */
|
|
8334
|
+
const ref = React29.useCallback((el) => setTarget(el), [setTarget]);
|
|
8335
|
+
return /* @__PURE__ */ jsx13("div", { ref, className, "data-fourty-canvas-lead": "" });
|
|
8349
8336
|
}
|
|
8350
8337
|
function useCanvasLead() {
|
|
8351
|
-
const lead =
|
|
8338
|
+
const lead = React29.useContext(CanvasLeadContext);
|
|
8352
8339
|
return { present: lead !== null && lead.target !== null && lead.leadId !== null };
|
|
8353
8340
|
}
|
|
8354
8341
|
function useCanvasLeadTarget() {
|
|
8355
|
-
const lead =
|
|
8342
|
+
const lead = React29.useContext(CanvasLeadContext);
|
|
8356
8343
|
const setLeadId = lead === null ? null : lead.setLeadId;
|
|
8357
|
-
const report =
|
|
8344
|
+
const report = React29.useCallback((id) => {
|
|
8358
8345
|
if (setLeadId !== null) setLeadId(id);
|
|
8359
8346
|
}, [setLeadId]);
|
|
8360
8347
|
if (lead === null) return { canLead: NO_LEAD, target: null, report };
|
|
@@ -8362,21 +8349,21 @@ function useCanvasLeadTarget() {
|
|
|
8362
8349
|
}
|
|
8363
8350
|
|
|
8364
8351
|
// src/canvas/canvas-motion-style.tsx
|
|
8365
|
-
import { createContext as
|
|
8366
|
-
import { jsx as
|
|
8367
|
-
var CanvasMotionStyleContext =
|
|
8352
|
+
import { createContext as createContext16, useContext as useContext16 } from "react";
|
|
8353
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
8354
|
+
var CanvasMotionStyleContext = createContext16(null);
|
|
8368
8355
|
function CanvasMotionStyleProvider({ style, children }) {
|
|
8369
|
-
return /* @__PURE__ */
|
|
8356
|
+
return /* @__PURE__ */ jsx14(CanvasMotionStyleContext.Provider, { value: style, children });
|
|
8370
8357
|
}
|
|
8371
8358
|
function useCanvasMotionStyle() {
|
|
8372
|
-
return
|
|
8359
|
+
return useContext16(CanvasMotionStyleContext);
|
|
8373
8360
|
}
|
|
8374
8361
|
|
|
8375
8362
|
// src/canvas/ElementIdContext.ts
|
|
8376
|
-
import { createContext as
|
|
8377
|
-
var ElementIdContext =
|
|
8363
|
+
import { createContext as createContext17, useContext as useContext17 } from "react";
|
|
8364
|
+
var ElementIdContext = createContext17(null);
|
|
8378
8365
|
function useElementId() {
|
|
8379
|
-
return
|
|
8366
|
+
return useContext17(ElementIdContext);
|
|
8380
8367
|
}
|
|
8381
8368
|
|
|
8382
8369
|
// src/canvas/generation-entrance.ts
|
|
@@ -8636,22 +8623,22 @@ function deriveTurnChangeAnchor(prev, next) {
|
|
|
8636
8623
|
}
|
|
8637
8624
|
|
|
8638
8625
|
// src/canvas/canvas-outlet.tsx
|
|
8639
|
-
import { createContext as
|
|
8640
|
-
import { jsx as
|
|
8641
|
-
var CanvasOutletContext =
|
|
8626
|
+
import { createContext as createContext18, useContext as useContext18 } from "react";
|
|
8627
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
8628
|
+
var CanvasOutletContext = createContext18(null);
|
|
8642
8629
|
function CanvasOutletProvider({ canvas, children }) {
|
|
8643
|
-
return /* @__PURE__ */
|
|
8630
|
+
return /* @__PURE__ */ jsx15(CanvasOutletContext.Provider, { value: canvas, children });
|
|
8644
8631
|
}
|
|
8645
8632
|
function SpacefrontCanvas() {
|
|
8646
|
-
const Canvas =
|
|
8633
|
+
const Canvas = useContext18(CanvasOutletContext);
|
|
8647
8634
|
if (Canvas === null) {
|
|
8648
8635
|
throw new Error("<SpacefrontCanvas> must be rendered inside <Spacefront> \u2014 no engine has provided a canvas.");
|
|
8649
8636
|
}
|
|
8650
|
-
return /* @__PURE__ */
|
|
8637
|
+
return /* @__PURE__ */ jsx15(Canvas, {});
|
|
8651
8638
|
}
|
|
8652
8639
|
|
|
8653
8640
|
// src/canvas/item-motion/ItemTransitionGroup.tsx
|
|
8654
|
-
import
|
|
8641
|
+
import React31 from "react";
|
|
8655
8642
|
import { AnimatePresence as AnimatePresence2, motion as motion3, useReducedMotion as useReducedMotion2 } from "framer-motion";
|
|
8656
8643
|
|
|
8657
8644
|
// src/canvas/item-motion/classify-items.ts
|
|
@@ -8870,7 +8857,7 @@ function getActiveProfile() {
|
|
|
8870
8857
|
}
|
|
8871
8858
|
|
|
8872
8859
|
// src/canvas/item-motion/ItemTransitionGroup.tsx
|
|
8873
|
-
import { jsx as
|
|
8860
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
8874
8861
|
var ITEM_IDENTITY_ATTR = "data-flip-id";
|
|
8875
8862
|
function ItemTransitionGroup({
|
|
8876
8863
|
items,
|
|
@@ -8885,14 +8872,14 @@ function ItemTransitionGroup({
|
|
|
8885
8872
|
const profile = getActiveProfile();
|
|
8886
8873
|
const animated = reduce !== true;
|
|
8887
8874
|
const ids = items.map(getId);
|
|
8888
|
-
const prevIdsRef =
|
|
8889
|
-
const lastChangeRef =
|
|
8875
|
+
const prevIdsRef = React31.useRef(null);
|
|
8876
|
+
const lastChangeRef = React31.useRef(null);
|
|
8890
8877
|
const prevIds = prevIdsRef.current;
|
|
8891
8878
|
const freshChange = prevIds === null ? null : classifyItemChange(prevIds, ids);
|
|
8892
8879
|
if (freshChange !== null) {
|
|
8893
8880
|
lastChangeRef.current = freshChange;
|
|
8894
8881
|
}
|
|
8895
|
-
|
|
8882
|
+
React31.useEffect(() => {
|
|
8896
8883
|
prevIdsRef.current = ids;
|
|
8897
8884
|
});
|
|
8898
8885
|
const activeChange = lastChangeRef.current;
|
|
@@ -8905,7 +8892,7 @@ function ItemTransitionGroup({
|
|
|
8905
8892
|
const isGrid = itemClassName === void 0;
|
|
8906
8893
|
const outerClassName = isGrid ? "h-full" : itemClassName;
|
|
8907
8894
|
const innerClassName = isGrid ? "h-full" : void 0;
|
|
8908
|
-
return /* @__PURE__ */
|
|
8895
|
+
return /* @__PURE__ */ jsx16("div", { className, style, children: /* @__PURE__ */ jsx16(AnimatePresence2, { mode: "popLayout", initial: false, children: items.map((item) => {
|
|
8909
8896
|
const id = getId(item);
|
|
8910
8897
|
const identityAttr = { [ITEM_IDENTITY_ATTR]: id };
|
|
8911
8898
|
const isEntering = activeChange !== null && activeChange.entered.includes(id);
|
|
@@ -8915,7 +8902,7 @@ function ItemTransitionGroup({
|
|
|
8915
8902
|
// `itemClassName`/`itemStyle` size the wrapper for flex/snap
|
|
8916
8903
|
// layouts (carousel); grid layouts leave them unset and get
|
|
8917
8904
|
// `h-full` so the cell height reaches the card.
|
|
8918
|
-
/* @__PURE__ */
|
|
8905
|
+
/* @__PURE__ */ jsx16(
|
|
8919
8906
|
motion3.div,
|
|
8920
8907
|
{
|
|
8921
8908
|
...identityAttr,
|
|
@@ -8924,7 +8911,7 @@ function ItemTransitionGroup({
|
|
|
8924
8911
|
layout: animated ? "position" : void 0,
|
|
8925
8912
|
layoutDependency,
|
|
8926
8913
|
transition: animated ? layoutTransition : void 0,
|
|
8927
|
-
children: /* @__PURE__ */
|
|
8914
|
+
children: /* @__PURE__ */ jsx16(
|
|
8928
8915
|
motion3.div,
|
|
8929
8916
|
{
|
|
8930
8917
|
className: innerClassName,
|
|
@@ -9005,21 +8992,21 @@ __export(catalog_exports, {
|
|
|
9005
8992
|
});
|
|
9006
8993
|
|
|
9007
8994
|
// src/catalog/DebugContext.tsx
|
|
9008
|
-
import { createContext as
|
|
9009
|
-
import { jsx as
|
|
9010
|
-
var DebugContext =
|
|
8995
|
+
import { createContext as createContext19, useContext as useContext19 } from "react";
|
|
8996
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
8997
|
+
var DebugContext = createContext19(false);
|
|
9011
8998
|
function DebugProvider({
|
|
9012
8999
|
debug,
|
|
9013
9000
|
children
|
|
9014
9001
|
}) {
|
|
9015
|
-
return /* @__PURE__ */
|
|
9002
|
+
return /* @__PURE__ */ jsx17(DebugContext.Provider, { value: debug, children });
|
|
9016
9003
|
}
|
|
9017
9004
|
function useDebug() {
|
|
9018
|
-
return
|
|
9005
|
+
return useContext19(DebugContext);
|
|
9019
9006
|
}
|
|
9020
9007
|
|
|
9021
9008
|
// src/catalog/HydrationStateContext.tsx
|
|
9022
|
-
import { createContext as
|
|
9009
|
+
import { createContext as createContext20, useContext as useContext20 } from "react";
|
|
9023
9010
|
var DEFAULT_STATE = {
|
|
9024
9011
|
hasResolvedFields: false,
|
|
9025
9012
|
hydrating: false,
|
|
@@ -9029,47 +9016,47 @@ var DEFAULT_STATE = {
|
|
|
9029
9016
|
pendingCount: 0,
|
|
9030
9017
|
errors: []
|
|
9031
9018
|
};
|
|
9032
|
-
var HydrationStateContext =
|
|
9019
|
+
var HydrationStateContext = createContext20(DEFAULT_STATE);
|
|
9033
9020
|
function useHydrationState() {
|
|
9034
|
-
return
|
|
9021
|
+
return useContext20(HydrationStateContext);
|
|
9035
9022
|
}
|
|
9036
9023
|
|
|
9037
9024
|
// src/catalog/HydratorContext.tsx
|
|
9038
|
-
import { createContext as
|
|
9039
|
-
import { jsx as
|
|
9040
|
-
var HydratorContext =
|
|
9025
|
+
import { createContext as createContext21, useContext as useContext21 } from "react";
|
|
9026
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
9027
|
+
var HydratorContext = createContext21({});
|
|
9041
9028
|
function HydratorProvider({
|
|
9042
9029
|
hydrators,
|
|
9043
9030
|
children
|
|
9044
9031
|
}) {
|
|
9045
|
-
return /* @__PURE__ */
|
|
9032
|
+
return /* @__PURE__ */ jsx18(HydratorContext.Provider, { value: hydrators, children });
|
|
9046
9033
|
}
|
|
9047
9034
|
function useHydrators() {
|
|
9048
|
-
return
|
|
9035
|
+
return useContext21(HydratorContext);
|
|
9049
9036
|
}
|
|
9050
9037
|
|
|
9051
9038
|
// src/catalog/registry.tsx
|
|
9052
|
-
import { createContext as
|
|
9053
|
-
import { jsx as
|
|
9054
|
-
var RegistryContext =
|
|
9039
|
+
import { createContext as createContext22, useContext as useContext22 } from "react";
|
|
9040
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
9041
|
+
var RegistryContext = createContext22({});
|
|
9055
9042
|
function RegistryProvider({
|
|
9056
9043
|
registry: registry2,
|
|
9057
9044
|
children
|
|
9058
9045
|
}) {
|
|
9059
|
-
return /* @__PURE__ */
|
|
9046
|
+
return /* @__PURE__ */ jsx19(RegistryContext.Provider, { value: registry2, children });
|
|
9060
9047
|
}
|
|
9061
9048
|
function useRegistry() {
|
|
9062
|
-
return
|
|
9049
|
+
return useContext22(RegistryContext);
|
|
9063
9050
|
}
|
|
9064
|
-
var PackageLookupContext =
|
|
9051
|
+
var PackageLookupContext = createContext22(null);
|
|
9065
9052
|
function PackageLookupProvider({
|
|
9066
9053
|
lookup,
|
|
9067
9054
|
children
|
|
9068
9055
|
}) {
|
|
9069
|
-
return /* @__PURE__ */
|
|
9056
|
+
return /* @__PURE__ */ jsx19(PackageLookupContext.Provider, { value: lookup, children });
|
|
9070
9057
|
}
|
|
9071
9058
|
function usePackageLookup() {
|
|
9072
|
-
return
|
|
9059
|
+
return useContext22(PackageLookupContext);
|
|
9073
9060
|
}
|
|
9074
9061
|
function createAliasedRegistry(baseRegistry, aliases, getPackageComponent) {
|
|
9075
9062
|
return new Proxy(baseRegistry, {
|
|
@@ -9100,7 +9087,7 @@ function createAliasedRegistry(baseRegistry, aliases, getPackageComponent) {
|
|
|
9100
9087
|
}
|
|
9101
9088
|
|
|
9102
9089
|
// src/catalog/render-inline.tsx
|
|
9103
|
-
import
|
|
9090
|
+
import React34 from "react";
|
|
9104
9091
|
|
|
9105
9092
|
// src/catalog/prose-links.ts
|
|
9106
9093
|
var LINK = /\[([^\]\n]+)\]\(([^)\s]+)\)/g;
|
|
@@ -9126,8 +9113,8 @@ function proseRuns(text2) {
|
|
|
9126
9113
|
}
|
|
9127
9114
|
|
|
9128
9115
|
// src/catalog/render-inline.tsx
|
|
9129
|
-
import { jsx as
|
|
9130
|
-
var linkRenderer = (href, key) => /* @__PURE__ */
|
|
9116
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
9117
|
+
var linkRenderer = (href, key) => /* @__PURE__ */ jsx20(
|
|
9131
9118
|
"a",
|
|
9132
9119
|
{
|
|
9133
9120
|
className: "fourty-inline-link",
|
|
@@ -9143,7 +9130,7 @@ function linkifyText(text2, keyPrefix) {
|
|
|
9143
9130
|
return proseRuns(text2).flatMap((run, r) => {
|
|
9144
9131
|
if (run.href === void 0) return linkifyBareUrls(run.text, `${keyPrefix}-${String(r)}`);
|
|
9145
9132
|
return [
|
|
9146
|
-
/* @__PURE__ */
|
|
9133
|
+
/* @__PURE__ */ jsx20("a", { className: "fourty-inline-link", href: run.href, target: "_blank", rel: "noopener noreferrer", children: run.text }, `${keyPrefix}-${String(r)}-ll`)
|
|
9147
9134
|
];
|
|
9148
9135
|
});
|
|
9149
9136
|
}
|
|
@@ -9155,14 +9142,14 @@ function linkifyBareUrls(text2, keyPrefix) {
|
|
|
9155
9142
|
URL_RE.lastIndex = 0;
|
|
9156
9143
|
while ((match = URL_RE.exec(text2)) !== null) {
|
|
9157
9144
|
if (match.index > last) {
|
|
9158
|
-
out.push(/* @__PURE__ */
|
|
9145
|
+
out.push(/* @__PURE__ */ jsx20(React34.Fragment, { children: text2.slice(last, match.index) }, `${keyPrefix}-lt-${i++}`));
|
|
9159
9146
|
}
|
|
9160
9147
|
const href = match[0];
|
|
9161
9148
|
out.push(linkRenderer(href, `${keyPrefix}-lk-${i++}`));
|
|
9162
9149
|
last = match.index + href.length;
|
|
9163
9150
|
}
|
|
9164
9151
|
if (last < text2.length) {
|
|
9165
|
-
out.push(/* @__PURE__ */
|
|
9152
|
+
out.push(/* @__PURE__ */ jsx20(React34.Fragment, { children: text2.slice(last) }, `${keyPrefix}-lt-${i++}`));
|
|
9166
9153
|
}
|
|
9167
9154
|
return out;
|
|
9168
9155
|
}
|
|
@@ -9175,8 +9162,8 @@ function renderInline(text2, keyPrefix) {
|
|
|
9175
9162
|
while ((match = re.exec(text2)) !== null) {
|
|
9176
9163
|
if (match.index > last) out.push(...linkifyText(text2.slice(last, match.index), `${keyPrefix}-t-${i++}`));
|
|
9177
9164
|
const bold = match[1];
|
|
9178
|
-
if (bold !== void 0) out.push(/* @__PURE__ */
|
|
9179
|
-
else out.push(/* @__PURE__ */
|
|
9165
|
+
if (bold !== void 0) out.push(/* @__PURE__ */ jsx20("strong", { children: bold }, `${keyPrefix}-b-${i++}`));
|
|
9166
|
+
else out.push(/* @__PURE__ */ jsx20("em", { children: match[2] }, `${keyPrefix}-i-${i++}`));
|
|
9180
9167
|
last = match.index + match[0].length;
|
|
9181
9168
|
}
|
|
9182
9169
|
if (last < text2.length) out.push(...linkifyText(text2.slice(last), `${keyPrefix}-t-${i++}`));
|
|
@@ -9184,7 +9171,7 @@ function renderInline(text2, keyPrefix) {
|
|
|
9184
9171
|
}
|
|
9185
9172
|
|
|
9186
9173
|
// src/catalog/component-library.ts
|
|
9187
|
-
import * as
|
|
9174
|
+
import * as React35 from "react";
|
|
9188
9175
|
function displayNameOf(Inner) {
|
|
9189
9176
|
if (typeof Inner === "string") return Inner;
|
|
9190
9177
|
if (typeof Inner.displayName === "string" && Inner.displayName.length > 0) return Inner.displayName;
|
|
@@ -9193,7 +9180,7 @@ function displayNameOf(Inner) {
|
|
|
9193
9180
|
}
|
|
9194
9181
|
function adaptComponent(Inner) {
|
|
9195
9182
|
function Adapted(props) {
|
|
9196
|
-
return
|
|
9183
|
+
return React35.createElement(Inner, props);
|
|
9197
9184
|
}
|
|
9198
9185
|
Adapted.displayName = displayNameOf(Inner);
|
|
9199
9186
|
return Adapted;
|
|
@@ -9590,7 +9577,7 @@ function useConsumeStandingSignal(type) {
|
|
|
9590
9577
|
}
|
|
9591
9578
|
|
|
9592
9579
|
// src/widgets/presence/use-presence-notch.ts
|
|
9593
|
-
import * as
|
|
9580
|
+
import * as React36 from "react";
|
|
9594
9581
|
var SETTLE_DWELL_MS = 4e3;
|
|
9595
9582
|
var HOVER_CLOSE_MS = 240;
|
|
9596
9583
|
var HOVER_BOUNCE_WINDOW_MS = 800;
|
|
@@ -9598,21 +9585,21 @@ var BOUNCE_PX = 2;
|
|
|
9598
9585
|
function usePresenceNotch(widgets) {
|
|
9599
9586
|
const askStanding = useStandingOfType(AGENT_ASK_SIGNAL) !== null;
|
|
9600
9587
|
const { isRunning } = useAgentPresence();
|
|
9601
|
-
const [hovered, setHovered] =
|
|
9602
|
-
const [openDrawerId, setOpenDrawerId] =
|
|
9603
|
-
const rootRef =
|
|
9604
|
-
const toggleDrawer =
|
|
9588
|
+
const [hovered, setHovered] = React36.useState(false);
|
|
9589
|
+
const [openDrawerId, setOpenDrawerId] = React36.useState(null);
|
|
9590
|
+
const rootRef = React36.useRef(null);
|
|
9591
|
+
const toggleDrawer = React36.useCallback((id) => {
|
|
9605
9592
|
setOpenDrawerId((current2) => current2 === id ? null : id);
|
|
9606
9593
|
}, []);
|
|
9607
|
-
const closeTimer =
|
|
9608
|
-
const cancelClose =
|
|
9594
|
+
const closeTimer = React36.useRef(null);
|
|
9595
|
+
const cancelClose = React36.useCallback(() => {
|
|
9609
9596
|
if (closeTimer.current !== null) {
|
|
9610
9597
|
clearTimeout(closeTimer.current);
|
|
9611
9598
|
closeTimer.current = null;
|
|
9612
9599
|
}
|
|
9613
9600
|
}, []);
|
|
9614
|
-
const lastLeaveRef =
|
|
9615
|
-
const openHover =
|
|
9601
|
+
const lastLeaveRef = React36.useRef(null);
|
|
9602
|
+
const openHover = React36.useCallback((e) => {
|
|
9616
9603
|
const last = lastLeaveRef.current;
|
|
9617
9604
|
if (last !== null && Date.now() - last.t < HOVER_BOUNCE_WINDOW_MS && Math.abs(e.clientX - last.x) <= BOUNCE_PX && Math.abs(e.clientY - last.y) <= BOUNCE_PX) {
|
|
9618
9605
|
return;
|
|
@@ -9620,7 +9607,7 @@ function usePresenceNotch(widgets) {
|
|
|
9620
9607
|
cancelClose();
|
|
9621
9608
|
setHovered(true);
|
|
9622
9609
|
}, [cancelClose]);
|
|
9623
|
-
const scheduleClose =
|
|
9610
|
+
const scheduleClose = React36.useCallback((e) => {
|
|
9624
9611
|
lastLeaveRef.current = { x: e.clientX, y: e.clientY, t: Date.now() };
|
|
9625
9612
|
cancelClose();
|
|
9626
9613
|
closeTimer.current = setTimeout(() => {
|
|
@@ -9628,8 +9615,8 @@ function usePresenceNotch(widgets) {
|
|
|
9628
9615
|
setHovered(false);
|
|
9629
9616
|
}, HOVER_CLOSE_MS);
|
|
9630
9617
|
}, [cancelClose]);
|
|
9631
|
-
|
|
9632
|
-
|
|
9618
|
+
React36.useEffect(() => cancelClose, [cancelClose]);
|
|
9619
|
+
React36.useEffect(() => {
|
|
9633
9620
|
if (openDrawerId === null) return;
|
|
9634
9621
|
const onKey = (e) => {
|
|
9635
9622
|
if (e.key === "Escape") setOpenDrawerId(null);
|
|
@@ -9637,7 +9624,7 @@ function usePresenceNotch(widgets) {
|
|
|
9637
9624
|
window.addEventListener("keydown", onKey);
|
|
9638
9625
|
return () => window.removeEventListener("keydown", onKey);
|
|
9639
9626
|
}, [openDrawerId]);
|
|
9640
|
-
|
|
9627
|
+
React36.useEffect(() => {
|
|
9641
9628
|
if (openDrawerId === null) return;
|
|
9642
9629
|
const onDown = (e) => {
|
|
9643
9630
|
const root = rootRef.current;
|
|
@@ -9649,8 +9636,8 @@ function usePresenceNotch(widgets) {
|
|
|
9649
9636
|
document.addEventListener("pointerdown", onDown);
|
|
9650
9637
|
return () => document.removeEventListener("pointerdown", onDown);
|
|
9651
9638
|
}, [openDrawerId]);
|
|
9652
|
-
const [active, setActive] =
|
|
9653
|
-
|
|
9639
|
+
const [active, setActive] = React36.useState(false);
|
|
9640
|
+
React36.useEffect(() => {
|
|
9654
9641
|
if (isRunning) {
|
|
9655
9642
|
setActive(true);
|
|
9656
9643
|
return;
|
|
@@ -9810,7 +9797,7 @@ function presenceFactShape(fact) {
|
|
|
9810
9797
|
}
|
|
9811
9798
|
|
|
9812
9799
|
// src/widgets/presence/use-optimistic-facts.ts
|
|
9813
|
-
import * as
|
|
9800
|
+
import * as React37 from "react";
|
|
9814
9801
|
function readEntries(data) {
|
|
9815
9802
|
if (typeof data !== "object" || data === null || !("entries" in data)) return [];
|
|
9816
9803
|
const raw = data.entries;
|
|
@@ -9829,7 +9816,7 @@ function writeOptimisticFact(entries3, fact) {
|
|
|
9829
9816
|
}
|
|
9830
9817
|
function useOptimisticFactOverlay(flowId) {
|
|
9831
9818
|
const entries3 = readEntries(useAgentFlow(flowId));
|
|
9832
|
-
return
|
|
9819
|
+
return React37.useMemo(
|
|
9833
9820
|
() => ({
|
|
9834
9821
|
entries: entries3,
|
|
9835
9822
|
add: (fact) => setFlowOutput(flowId, { entries: writeOptimisticFact(entries3, fact) })
|
|
@@ -9838,8 +9825,8 @@ function useOptimisticFactOverlay(flowId) {
|
|
|
9838
9825
|
);
|
|
9839
9826
|
}
|
|
9840
9827
|
function useReconcileOptimisticFacts(flowId, readIdentity) {
|
|
9841
|
-
const seenRef =
|
|
9842
|
-
|
|
9828
|
+
const seenRef = React37.useRef(null);
|
|
9829
|
+
React37.useEffect(() => {
|
|
9843
9830
|
if (readIdentity === null) return;
|
|
9844
9831
|
if (seenRef.current === null) {
|
|
9845
9832
|
seenRef.current = readIdentity;
|
|
@@ -10011,10 +9998,10 @@ __export(chat_exports, {
|
|
|
10011
9998
|
});
|
|
10012
9999
|
|
|
10013
10000
|
// src/chat/chat-context.ts
|
|
10014
|
-
import { createContext as
|
|
10015
|
-
var FourtyChatContext =
|
|
10001
|
+
import { createContext as createContext23, useContext as useContext23 } from "react";
|
|
10002
|
+
var FourtyChatContext = createContext23(null);
|
|
10016
10003
|
function useFourtyChat() {
|
|
10017
|
-
const ctx =
|
|
10004
|
+
const ctx = useContext23(FourtyChatContext);
|
|
10018
10005
|
if (!ctx) throw new Error("useFourtyChat must be used inside <FourtyChatProvider>");
|
|
10019
10006
|
return ctx;
|
|
10020
10007
|
}
|
|
@@ -10251,34 +10238,34 @@ __export(interaction_exports, {
|
|
|
10251
10238
|
});
|
|
10252
10239
|
|
|
10253
10240
|
// src/interaction/withInteractionTracking.tsx
|
|
10254
|
-
import
|
|
10255
|
-
import { jsx as
|
|
10256
|
-
var InteractionContext =
|
|
10241
|
+
import React38, { createContext as createContext24, useContext as useContext24 } from "react";
|
|
10242
|
+
import { jsx as jsx21, jsxs } from "react/jsx-runtime";
|
|
10243
|
+
var InteractionContext = createContext24(null);
|
|
10257
10244
|
function InteractionProvider({
|
|
10258
10245
|
onInteraction,
|
|
10259
10246
|
children
|
|
10260
10247
|
}) {
|
|
10261
|
-
return /* @__PURE__ */
|
|
10248
|
+
return /* @__PURE__ */ jsx21(InteractionContext.Provider, { value: onInteraction, children });
|
|
10262
10249
|
}
|
|
10263
10250
|
function useInteraction2() {
|
|
10264
|
-
return
|
|
10251
|
+
return useContext24(InteractionContext);
|
|
10265
10252
|
}
|
|
10266
10253
|
function withInteractionTracking(WrappedComponent, meta) {
|
|
10267
10254
|
function TrackedComponent(props) {
|
|
10268
|
-
return /* @__PURE__ */
|
|
10255
|
+
return /* @__PURE__ */ jsx21(
|
|
10269
10256
|
"div",
|
|
10270
10257
|
{
|
|
10271
10258
|
"data-tracked-component": meta.componentId,
|
|
10272
10259
|
"data-tracked-component-type": meta.componentType,
|
|
10273
10260
|
style: { display: "contents" },
|
|
10274
|
-
children: /* @__PURE__ */
|
|
10261
|
+
children: /* @__PURE__ */ jsx21(ComponentErrorBoundary, { componentId: meta.componentId, children: /* @__PURE__ */ jsx21(WrappedComponent, { ...props }) })
|
|
10275
10262
|
}
|
|
10276
10263
|
);
|
|
10277
10264
|
}
|
|
10278
10265
|
TrackedComponent.displayName = `Tracked(${WrappedComponent.displayName || WrappedComponent.name || "Component"})`;
|
|
10279
10266
|
return TrackedComponent;
|
|
10280
10267
|
}
|
|
10281
|
-
var ComponentErrorBoundary = class extends
|
|
10268
|
+
var ComponentErrorBoundary = class extends React38.Component {
|
|
10282
10269
|
constructor() {
|
|
10283
10270
|
super(...arguments);
|
|
10284
10271
|
__publicField(this, "state", { error: null });
|
|
@@ -10292,7 +10279,7 @@ var ComponentErrorBoundary = class extends React39.Component {
|
|
|
10292
10279
|
render() {
|
|
10293
10280
|
if (this.state.error) {
|
|
10294
10281
|
return /* @__PURE__ */ jsxs("div", { className: "fourty-component-error", role: "alert", "data-component-id": this.props.componentId, children: [
|
|
10295
|
-
/* @__PURE__ */
|
|
10282
|
+
/* @__PURE__ */ jsx21("strong", { children: this.props.componentId }),
|
|
10296
10283
|
": ",
|
|
10297
10284
|
this.state.error.message
|
|
10298
10285
|
] });
|
|
@@ -10352,14 +10339,14 @@ __export(utils_exports, {
|
|
|
10352
10339
|
import { useSyncExternalStore as useSyncExternalStore6 } from "react";
|
|
10353
10340
|
|
|
10354
10341
|
// src/utils/viewport-window.tsx
|
|
10355
|
-
import { createContext as
|
|
10356
|
-
import { jsx as
|
|
10357
|
-
var ViewportWindowContext =
|
|
10342
|
+
import { createContext as createContext25, useContext as useContext25 } from "react";
|
|
10343
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
10344
|
+
var ViewportWindowContext = createContext25(null);
|
|
10358
10345
|
function canAnswer(win) {
|
|
10359
10346
|
return win !== null && typeof win.matchMedia === "function";
|
|
10360
10347
|
}
|
|
10361
10348
|
function useViewportWindow() {
|
|
10362
|
-
const provided =
|
|
10349
|
+
const provided = useContext25(ViewportWindowContext);
|
|
10363
10350
|
if (provided !== null) return canAnswer(provided) ? provided : null;
|
|
10364
10351
|
const global = globalThis;
|
|
10365
10352
|
return canAnswer(global) ? global : null;
|
|
@@ -10368,7 +10355,7 @@ function ViewportWindowProvider({
|
|
|
10368
10355
|
value,
|
|
10369
10356
|
children
|
|
10370
10357
|
}) {
|
|
10371
|
-
return /* @__PURE__ */
|
|
10358
|
+
return /* @__PURE__ */ jsx22(ViewportWindowContext.Provider, { value, children });
|
|
10372
10359
|
}
|
|
10373
10360
|
|
|
10374
10361
|
// src/utils/use-form-factor.ts
|
|
@@ -10459,7 +10446,7 @@ function useInlineCompletion(opts) {
|
|
|
10459
10446
|
}
|
|
10460
10447
|
|
|
10461
10448
|
// src/utils/use-document-visible.ts
|
|
10462
|
-
import
|
|
10449
|
+
import React39 from "react";
|
|
10463
10450
|
function subscribe4(onChange) {
|
|
10464
10451
|
document.addEventListener("visibilitychange", onChange);
|
|
10465
10452
|
return () => document.removeEventListener("visibilitychange", onChange);
|
|
@@ -10471,15 +10458,15 @@ function getServerSnapshot() {
|
|
|
10471
10458
|
return true;
|
|
10472
10459
|
}
|
|
10473
10460
|
function useDocumentVisible() {
|
|
10474
|
-
return
|
|
10461
|
+
return React39.useSyncExternalStore(subscribe4, getSnapshot, getServerSnapshot);
|
|
10475
10462
|
}
|
|
10476
10463
|
|
|
10477
10464
|
// src/utils/use-interval.ts
|
|
10478
|
-
import
|
|
10465
|
+
import React40 from "react";
|
|
10479
10466
|
function useInterval(callback, ms, active = true) {
|
|
10480
|
-
const cbRef =
|
|
10467
|
+
const cbRef = React40.useRef(callback);
|
|
10481
10468
|
cbRef.current = callback;
|
|
10482
|
-
|
|
10469
|
+
React40.useEffect(() => {
|
|
10483
10470
|
if (!active) return;
|
|
10484
10471
|
const id = window.setInterval(() => cbRef.current(), ms);
|
|
10485
10472
|
return () => window.clearInterval(id);
|
|
@@ -10691,15 +10678,15 @@ function primedEntitiesFor(resolverKey) {
|
|
|
10691
10678
|
}
|
|
10692
10679
|
|
|
10693
10680
|
// src/preview/SpacefrontPreviewProvider.tsx
|
|
10694
|
-
import * as
|
|
10695
|
-
import { jsx as
|
|
10681
|
+
import * as React41 from "react";
|
|
10682
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
10696
10683
|
var NOOP = () => {
|
|
10697
10684
|
};
|
|
10698
10685
|
var ASYNC_NOOP = () => Promise.resolve();
|
|
10699
10686
|
var VIEW = { page: { kind: "home" }, layout: EMPTY_SPEC, shell: EMPTY_SHELL };
|
|
10700
|
-
var PreviewContext =
|
|
10687
|
+
var PreviewContext = React41.createContext(null);
|
|
10701
10688
|
function usePreview() {
|
|
10702
|
-
const value =
|
|
10689
|
+
const value = React41.useContext(PreviewContext);
|
|
10703
10690
|
if (value === null) throw new Error("preview runtime used outside <SpacefrontPreviewProvider>");
|
|
10704
10691
|
return value;
|
|
10705
10692
|
}
|
|
@@ -10853,11 +10840,11 @@ var PRESENCE = {
|
|
|
10853
10840
|
usePresenceLiveTurn: () => usePreview().pending?.messageId
|
|
10854
10841
|
};
|
|
10855
10842
|
function SpacefrontPreviewProvider({ scene, onSend, children }) {
|
|
10856
|
-
const [sessionId] =
|
|
10857
|
-
const derived =
|
|
10858
|
-
const onSendRef =
|
|
10843
|
+
const [sessionId] = React41.useState(() => `preview-${Math.random().toString(36).slice(2)}`);
|
|
10844
|
+
const derived = React41.useMemo(() => derive(scene, sessionId), [scene, sessionId]);
|
|
10845
|
+
const onSendRef = React41.useRef(onSend);
|
|
10859
10846
|
onSendRef.current = onSend;
|
|
10860
|
-
const draft =
|
|
10847
|
+
const draft = React41.useMemo(() => {
|
|
10861
10848
|
let text2 = "";
|
|
10862
10849
|
const listeners14 = /* @__PURE__ */ new Set();
|
|
10863
10850
|
return {
|
|
@@ -10873,7 +10860,7 @@ function SpacefrontPreviewProvider({ scene, onSend, children }) {
|
|
|
10873
10860
|
}
|
|
10874
10861
|
};
|
|
10875
10862
|
}, []);
|
|
10876
|
-
const session =
|
|
10863
|
+
const session = React41.useMemo(() => {
|
|
10877
10864
|
const send = (text2) => {
|
|
10878
10865
|
draft.set("");
|
|
10879
10866
|
onSendRef.current?.(text2);
|
|
@@ -10925,15 +10912,15 @@ function SpacefrontPreviewProvider({ scene, onSend, children }) {
|
|
|
10925
10912
|
const qId = question === null ? null : question.id;
|
|
10926
10913
|
const qText = question === null ? "" : question.text;
|
|
10927
10914
|
const qReplies = question === null ? "" : list(question.replies).join("\0");
|
|
10928
|
-
const raised =
|
|
10929
|
-
|
|
10915
|
+
const raised = React41.useRef(0);
|
|
10916
|
+
React41.useEffect(() => {
|
|
10930
10917
|
if (qId === null) return;
|
|
10931
10918
|
raised.current += 1;
|
|
10932
10919
|
const id = `${qId}-${raised.current}`;
|
|
10933
10920
|
raiseStanding(AGENT_ASK_SIGNAL, id, { ask: qText, suggestions: qReplies === "" ? [] : qReplies.split("\0") }, sessionId);
|
|
10934
10921
|
return () => resolveStanding(id, sessionId);
|
|
10935
10922
|
}, [qId, qText, qReplies, sessionId]);
|
|
10936
|
-
return /* @__PURE__ */
|
|
10923
|
+
return /* @__PURE__ */ jsx23(PreviewContext.Provider, { value: derived, children: /* @__PURE__ */ jsx23(FourtySessionContext.Provider, { value: session, children: /* @__PURE__ */ jsx23(FourtyRuntimeProvider, { value: RUNTIME, children: /* @__PURE__ */ jsx23(PresenceRuntimeProvider, { value: PRESENCE, children }) }) }) });
|
|
10937
10924
|
}
|
|
10938
10925
|
|
|
10939
10926
|
// src/verticals/commerce/index.ts
|
|
@@ -11006,6 +10993,7 @@ __export(commerce_exports, {
|
|
|
11006
10993
|
takeQueuedDiscountCodes: () => takeQueuedDiscountCodes,
|
|
11007
10994
|
toggleCartDrawer: () => toggleCartDrawer,
|
|
11008
10995
|
useAddToCart: () => useAddToCart,
|
|
10996
|
+
useAskStore: () => useAskStore,
|
|
11009
10997
|
useCart: () => useCart,
|
|
11010
10998
|
useCartActionFailures: () => useCartActionFailures,
|
|
11011
10999
|
useCartActionFailuresFor: () => useCartActionFailuresFor,
|
|
@@ -11031,6 +11019,7 @@ __export(commerce_exports, {
|
|
|
11031
11019
|
useProducts: () => useProducts,
|
|
11032
11020
|
useQueuedDiscountCodes: () => useQueuedDiscountCodes,
|
|
11033
11021
|
useSafeCart: () => useSafeCart,
|
|
11022
|
+
useStoreCheckouts: () => useStoreCheckouts,
|
|
11034
11023
|
useToggleWishlist: () => useToggleWishlist,
|
|
11035
11024
|
useVariantSelections: () => useVariantSelections,
|
|
11036
11025
|
useWishlist: () => useWishlist,
|
|
@@ -11077,7 +11066,7 @@ registerEntityPageKind("search", {
|
|
|
11077
11066
|
});
|
|
11078
11067
|
|
|
11079
11068
|
// src/verticals/commerce/commerce-context.tsx
|
|
11080
|
-
import { createContext as
|
|
11069
|
+
import { createContext as createContext27, useContext as useContext27 } from "react";
|
|
11081
11070
|
var INERT_COMMERCE_RUNTIME = {
|
|
11082
11071
|
useCart: () => {
|
|
11083
11072
|
throw new Error("useCart must be used within a <CommerceProvider>");
|
|
@@ -11116,14 +11105,26 @@ var INERT_COMMERCE_RUNTIME = {
|
|
|
11116
11105
|
}, signOut: async () => {
|
|
11117
11106
|
}, available: false }),
|
|
11118
11107
|
// No store, no plans: a price line simply shows no installment offer.
|
|
11119
|
-
useInstallmentOffer: () => void 0
|
|
11108
|
+
useInstallmentOffer: () => void 0,
|
|
11109
|
+
// No commerce, no stores to check out at.
|
|
11110
|
+
useStoreCheckouts: () => ({
|
|
11111
|
+
available: false,
|
|
11112
|
+
create: () => Promise.reject(new Error("useStoreCheckouts needs a <CommerceProvider>")),
|
|
11113
|
+
pending: false
|
|
11114
|
+
}),
|
|
11115
|
+
// No commerce, no store to ask.
|
|
11116
|
+
useAskStore: () => ({
|
|
11117
|
+
available: false,
|
|
11118
|
+
ask: () => Promise.reject(new Error("useAskStore needs a <CommerceProvider>")),
|
|
11119
|
+
pending: false
|
|
11120
|
+
})
|
|
11120
11121
|
};
|
|
11121
|
-
var FourtyCommerceRuntimeContext =
|
|
11122
|
+
var FourtyCommerceRuntimeContext = createContext27(
|
|
11122
11123
|
INERT_COMMERCE_RUNTIME
|
|
11123
11124
|
);
|
|
11124
11125
|
var FourtyCommerceRuntimeProvider = FourtyCommerceRuntimeContext.Provider;
|
|
11125
11126
|
function useCommerceRuntime() {
|
|
11126
|
-
return
|
|
11127
|
+
return useContext27(FourtyCommerceRuntimeContext);
|
|
11127
11128
|
}
|
|
11128
11129
|
function useCart() {
|
|
11129
11130
|
return useCommerceRuntime().useCart();
|
|
@@ -11152,6 +11153,12 @@ function useCustomerAccount() {
|
|
|
11152
11153
|
function useInstallmentOffer(price) {
|
|
11153
11154
|
return useCommerceRuntime().useInstallmentOffer(price);
|
|
11154
11155
|
}
|
|
11156
|
+
function useStoreCheckouts() {
|
|
11157
|
+
return useCommerceRuntime().useStoreCheckouts();
|
|
11158
|
+
}
|
|
11159
|
+
function useAskStore() {
|
|
11160
|
+
return useCommerceRuntime().useAskStore();
|
|
11161
|
+
}
|
|
11155
11162
|
|
|
11156
11163
|
// src/verticals/commerce/checkout/external-navigation.ts
|
|
11157
11164
|
function navigateToExternalCommerceUrl(url) {
|
|
@@ -11897,7 +11904,7 @@ function useCartDrawer() {
|
|
|
11897
11904
|
}
|
|
11898
11905
|
|
|
11899
11906
|
// src/verticals/commerce/cart/use-cart-view.ts
|
|
11900
|
-
import
|
|
11907
|
+
import React42 from "react";
|
|
11901
11908
|
|
|
11902
11909
|
// src/verticals/commerce/cart/queued-discount-codes.ts
|
|
11903
11910
|
import { useSyncExternalStore as useSyncExternalStore12 } from "react";
|
|
@@ -11956,7 +11963,7 @@ registerSessionScopedClear(() => {
|
|
|
11956
11963
|
// src/verticals/commerce/cart/use-cart-view.ts
|
|
11957
11964
|
function useCartView(cart, onCheckout) {
|
|
11958
11965
|
const analytics = useOptionalAnalyticsSink();
|
|
11959
|
-
const [exitPending, setExitPending] =
|
|
11966
|
+
const [exitPending, setExitPending] = React42.useState(null);
|
|
11960
11967
|
const lines = cart === null ? [] : cart.lines;
|
|
11961
11968
|
const count = lines.reduce((sum, l) => sum + l.quantity, 0);
|
|
11962
11969
|
const totalsPending = lines.some((l) => isPendingCartLine(l));
|
|
@@ -11967,7 +11974,7 @@ function useCartView(cart, onCheckout) {
|
|
|
11967
11974
|
const backendTotal = cart !== null && cart.total !== void 0 ? cart.total.amount : void 0;
|
|
11968
11975
|
const discountAmount = backendTotal !== void 0 && backendTotal < subtotal ? subtotal - backendTotal : 0;
|
|
11969
11976
|
const effectiveTotal = backendTotal !== void 0 ? backendTotal : subtotal;
|
|
11970
|
-
const navigateToExit =
|
|
11977
|
+
const navigateToExit = React42.useCallback((url, kind) => {
|
|
11971
11978
|
const result = navigateToExternalCommerceUrl(url);
|
|
11972
11979
|
if (kind === "checkout") recordVisitorCheckoutExit(analytics, result);
|
|
11973
11980
|
if (result === "new-tab") {
|
|
@@ -11984,7 +11991,7 @@ function useCartView(cart, onCheckout) {
|
|
|
11984
11991
|
setExitPending(null);
|
|
11985
11992
|
}
|
|
11986
11993
|
}, [analytics]);
|
|
11987
|
-
const handleCheckout =
|
|
11994
|
+
const handleCheckout = React42.useCallback(() => {
|
|
11988
11995
|
if (lines.length === 0 || exitPending !== null) return;
|
|
11989
11996
|
setExitPending("checkout");
|
|
11990
11997
|
if (onCheckout) {
|
|
@@ -12004,7 +12011,7 @@ function useCartView(cart, onCheckout) {
|
|
|
12004
12011
|
}
|
|
12005
12012
|
navigateToExit(cart?.checkoutUrl, "checkout");
|
|
12006
12013
|
}, [lines.length, exitPending, onCheckout, cart, navigateToExit]);
|
|
12007
|
-
const handleGoToStore =
|
|
12014
|
+
const handleGoToStore = React42.useCallback(() => {
|
|
12008
12015
|
if (lines.length === 0 || exitPending !== null) return;
|
|
12009
12016
|
setExitPending("store");
|
|
12010
12017
|
navigateToExit(cart?.storeCartUrl, "store");
|
|
@@ -12092,7 +12099,7 @@ registerSessionScopedClear(() => {
|
|
|
12092
12099
|
});
|
|
12093
12100
|
|
|
12094
12101
|
// src/verticals/commerce/cart/use-cart-line-row.ts
|
|
12095
|
-
import * as
|
|
12102
|
+
import * as React43 from "react";
|
|
12096
12103
|
|
|
12097
12104
|
// src/verticals/commerce/use-commerce-actions.ts
|
|
12098
12105
|
import { useCallback as useCallback23 } from "react";
|
|
@@ -12138,19 +12145,19 @@ var SPOTLIGHT_MAX_AGE_MS = 3e4;
|
|
|
12138
12145
|
function useCartLineRow(line, opts) {
|
|
12139
12146
|
const actions = useCommerceActions();
|
|
12140
12147
|
const drawerFocus = useCartDrawerFocus();
|
|
12141
|
-
const rowRef =
|
|
12148
|
+
const rowRef = React43.useRef(null);
|
|
12142
12149
|
const pending2 = isPendingCartLine(line);
|
|
12143
12150
|
const navigable = actions !== null && !pending2 && line.productId.length > 0;
|
|
12144
12151
|
const onNavigated = opts === void 0 ? void 0 : opts.onNavigated;
|
|
12145
|
-
const navigatedRef =
|
|
12152
|
+
const navigatedRef = React43.useRef(onNavigated);
|
|
12146
12153
|
navigatedRef.current = onNavigated;
|
|
12147
|
-
const navigate =
|
|
12154
|
+
const navigate = React43.useCallback(() => {
|
|
12148
12155
|
if (actions === null) return;
|
|
12149
12156
|
actions.navigateToProduct(line.productId, line.title);
|
|
12150
12157
|
const done = navigatedRef.current;
|
|
12151
12158
|
if (done !== void 0) done();
|
|
12152
12159
|
}, [actions, line.productId, line.title]);
|
|
12153
|
-
const interaction =
|
|
12160
|
+
const interaction = React43.useMemo(() => {
|
|
12154
12161
|
if (!navigable) return void 0;
|
|
12155
12162
|
return {
|
|
12156
12163
|
onClick: navigate,
|
|
@@ -12165,7 +12172,7 @@ function useCartLineRow(line, opts) {
|
|
|
12165
12172
|
};
|
|
12166
12173
|
}, [navigable, navigate]);
|
|
12167
12174
|
const spotlightKey = drawerFocus !== null && !pending2 && line.productId.length > 0 && drawerFocus.productId === line.productId && Date.now() - drawerFocus.at < SPOTLIGHT_MAX_AGE_MS ? drawerFocus.at : null;
|
|
12168
|
-
|
|
12175
|
+
React43.useEffect(() => {
|
|
12169
12176
|
if (spotlightKey === null) return;
|
|
12170
12177
|
const node = rowRef.current;
|
|
12171
12178
|
if (node === null) return;
|
|
@@ -12310,7 +12317,7 @@ function pickColorCount(product) {
|
|
|
12310
12317
|
}
|
|
12311
12318
|
|
|
12312
12319
|
// src/verticals/commerce/product/use-look-card.ts
|
|
12313
|
-
import * as
|
|
12320
|
+
import * as React44 from "react";
|
|
12314
12321
|
|
|
12315
12322
|
// src/verticals/commerce/variant/variant-option-axes.ts
|
|
12316
12323
|
function carriesValue(variant, name, value) {
|
|
@@ -12520,8 +12527,8 @@ function useLookCard({
|
|
|
12520
12527
|
const session = useFourtySession();
|
|
12521
12528
|
const addFlash = useSuccessFlash({ duration: 1200 });
|
|
12522
12529
|
const locale = useSpaceLocale();
|
|
12523
|
-
const [pending2, setPending] =
|
|
12524
|
-
const clean =
|
|
12530
|
+
const [pending2, setPending] = React44.useState(null);
|
|
12531
|
+
const clean = React44.useMemo(
|
|
12525
12532
|
() => (Array.isArray(products) ? products : []).filter(
|
|
12526
12533
|
(p) => p !== null && p !== void 0 && typeof p === "object"
|
|
12527
12534
|
),
|
|
@@ -12876,7 +12883,7 @@ function useContentActions() {
|
|
|
12876
12883
|
import { useEffect as useEffect19, useState as useState19 } from "react";
|
|
12877
12884
|
|
|
12878
12885
|
// package.json
|
|
12879
|
-
var version = "0.5.
|
|
12886
|
+
var version = "0.5.18";
|
|
12880
12887
|
|
|
12881
12888
|
// src/host/host-modules.ts
|
|
12882
12889
|
import * as react from "react";
|
|
@@ -12937,7 +12944,7 @@ function loadEngine(apiUrl) {
|
|
|
12937
12944
|
}
|
|
12938
12945
|
|
|
12939
12946
|
// src/host/Spacefront.tsx
|
|
12940
|
-
import { jsx as
|
|
12947
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
12941
12948
|
function Spacefront(props) {
|
|
12942
12949
|
const [engine, setEngine] = useState19(null);
|
|
12943
12950
|
const [failure, setFailure] = useState19(null);
|
|
@@ -12959,7 +12966,7 @@ function Spacefront(props) {
|
|
|
12959
12966
|
if (failure !== null) throw failure;
|
|
12960
12967
|
if (engine === null) return null;
|
|
12961
12968
|
const EngineRoot = engine.EngineRoot;
|
|
12962
|
-
return /* @__PURE__ */
|
|
12969
|
+
return /* @__PURE__ */ jsx24(EngineRoot, { ...props });
|
|
12963
12970
|
}
|
|
12964
12971
|
|
|
12965
12972
|
// src/npm.ts
|
|
@@ -13108,7 +13115,6 @@ export {
|
|
|
13108
13115
|
HostExportsSchema,
|
|
13109
13116
|
HostImportsSchema,
|
|
13110
13117
|
HostPayloadSchema,
|
|
13111
|
-
HydrationNoticeProvider,
|
|
13112
13118
|
HydrationStateContext,
|
|
13113
13119
|
HydratorProvider,
|
|
13114
13120
|
INITIAL_NAV_PRESENTATION,
|
|
@@ -13551,6 +13557,7 @@ export {
|
|
|
13551
13557
|
useAgentPresenceFrame,
|
|
13552
13558
|
useAgentPresenceFresh,
|
|
13553
13559
|
useAnalyticsSink,
|
|
13560
|
+
useAskStore,
|
|
13554
13561
|
useBotCheckNotice,
|
|
13555
13562
|
useCanvasActions,
|
|
13556
13563
|
useCanvasArrangement,
|
|
@@ -13615,7 +13622,6 @@ export {
|
|
|
13615
13622
|
useHasLeftSeedHome,
|
|
13616
13623
|
useHistoryNav,
|
|
13617
13624
|
useHydrated,
|
|
13618
|
-
useHydrationNotice,
|
|
13619
13625
|
useHydrationState,
|
|
13620
13626
|
useHydrators,
|
|
13621
13627
|
useInlineCompletion,
|
|
@@ -13674,6 +13680,7 @@ export {
|
|
|
13674
13680
|
useShellRoot,
|
|
13675
13681
|
useSpaceLocale,
|
|
13676
13682
|
useStandingOfType,
|
|
13683
|
+
useStoreCheckouts,
|
|
13677
13684
|
useStream,
|
|
13678
13685
|
useSuccessFlash,
|
|
13679
13686
|
useSuggestionsWithDefaults,
|
|
@@ -1817,6 +1817,37 @@ export declare const CartSchema: z.ZodObject<{
|
|
|
1817
1817
|
storeCartUrl?: string | undefined;
|
|
1818
1818
|
}>;
|
|
1819
1819
|
export type Cart = z.infer<typeof CartSchema>;
|
|
1820
|
+
/**
|
|
1821
|
+
* One store's checkout for its share of a cart that spans several stores —
|
|
1822
|
+
* what `CommerceAdapter.createStoreCheckouts` answers, one entry per seller.
|
|
1823
|
+
*
|
|
1824
|
+
* A single-store cart exits through `Cart.checkoutUrl`; a marketplace cart
|
|
1825
|
+
* (lines from many sellers, as on the cross-merchant catalog) has no one place
|
|
1826
|
+
* to be paid, so each seller's lines get their own checkout. `ready` carries
|
|
1827
|
+
* the page where the visitor reviews and pays for that store's lines; `failed`
|
|
1828
|
+
* says why that store gave none, so a surface names it instead of dropping it.
|
|
1829
|
+
*/
|
|
1830
|
+
export type StoreCheckout = {
|
|
1831
|
+
status: 'ready';
|
|
1832
|
+
seller: string;
|
|
1833
|
+
lineIds: string[];
|
|
1834
|
+
checkoutUrl: string;
|
|
1835
|
+
} | {
|
|
1836
|
+
status: 'failed';
|
|
1837
|
+
seller: string;
|
|
1838
|
+
lineIds: string[];
|
|
1839
|
+
reason: string;
|
|
1840
|
+
};
|
|
1841
|
+
/**
|
|
1842
|
+
* A store's own answer to a visitor's question about one of its products —
|
|
1843
|
+
* what `CommerceAdapter.askStore` returns. It is the STORE's statement (its
|
|
1844
|
+
* policies, its listing), never a fact the platform checked, so a surface
|
|
1845
|
+
* credits it to `seller`.
|
|
1846
|
+
*/
|
|
1847
|
+
export interface StoreAnswer {
|
|
1848
|
+
seller: string;
|
|
1849
|
+
answer: string;
|
|
1850
|
+
}
|
|
1820
1851
|
/** The backend-accepted cart, or null when all we hold is an optimistic
|
|
1821
1852
|
* paint. The single predicate for "is there a cart id the backend knows?" —
|
|
1822
1853
|
* every cart mutation needs it before it can talk to the backend. */
|
|
@@ -2,7 +2,6 @@ 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';
|
|
6
5
|
export { GenerationStyleContext, GenerationStyleProvider, useGenerationStyle, } from './GenerationStyleContext';
|
|
7
6
|
export { ShimmerSweep, type ShimmerSweepProps } from './ShimmerSweep';
|
|
8
7
|
export { FadeTransition, TransitionProvider, useLayoutTransition, type LayoutTransitionItemProps, type LayoutTransitionGroupProps, type LayoutTransition, } from './TransitionContext';
|
|
@@ -167,8 +167,6 @@ export declare const HOST_MODULES: {
|
|
|
167
167
|
CanvasTailProvider: typeof sdk.CanvasTailProvider;
|
|
168
168
|
useCanvasTail: typeof sdk.useCanvasTail;
|
|
169
169
|
CanvasTailMount: typeof sdk.CanvasTailMount;
|
|
170
|
-
HydrationNoticeProvider: typeof sdk.HydrationNoticeProvider;
|
|
171
|
-
useHydrationNotice: typeof sdk.useHydrationNotice;
|
|
172
170
|
GenerationStyleContext: react.Context<sdk.GenerationStyle>;
|
|
173
171
|
GenerationStyleProvider: react.Provider<sdk.GenerationStyle>;
|
|
174
172
|
useGenerationStyle: typeof sdk.useGenerationStyle;
|
|
@@ -383,6 +381,8 @@ export declare const HOST_MODULES: {
|
|
|
383
381
|
useProductReviews: typeof sdk.useProductReviews;
|
|
384
382
|
useCustomerAccount: typeof sdk.useCustomerAccount;
|
|
385
383
|
useInstallmentOffer: typeof sdk.useInstallmentOffer;
|
|
384
|
+
useStoreCheckouts: typeof sdk.useStoreCheckouts;
|
|
385
|
+
useAskStore: typeof sdk.useAskStore;
|
|
386
386
|
useCommerceRuntime: typeof sdk.useCommerceRuntime;
|
|
387
387
|
FourtyCommerceRuntimeProvider: react.Provider<sdk.FourtyCommerceRuntime>;
|
|
388
388
|
navigateToExternalCommerceUrl: typeof sdk.navigateToExternalCommerceUrl;
|
|
@@ -2783,7 +2783,7 @@ export declare const HOST_MODULES: {
|
|
|
2783
2783
|
AGENT_DIRECTIVE_SEVERITIES: readonly ["a missed opportunity", "a problem", "unacceptable"];
|
|
2784
2784
|
AGENT_DIRECTIVE_SOURCES: readonly ["owner", "operator", "session-lesson"];
|
|
2785
2785
|
AGENT_DIRECTIVE_STATUSES: readonly ["proposed", "active", "rejected", "retired"];
|
|
2786
|
-
MAX_ACTIVE_AGENT_DIRECTIVES:
|
|
2786
|
+
MAX_ACTIVE_AGENT_DIRECTIVES: 20;
|
|
2787
2787
|
DEFAULT_SPACE_LOCALE: "en-US";
|
|
2788
2788
|
SpaceLocaleSchema: zod.ZodEffects<zod.ZodString, string, string>;
|
|
2789
2789
|
textDirectionOf: typeof spacestation.textDirectionOf;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { InstallmentOffer, Money, Product } from '../../../../ecommerce/src/index';
|
|
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';
|
|
2
|
+
export type { AddToCartApi, CartAddHints, CartAddOptions, CartApi, CustomerAccountApi, StoreCheckoutsApi, AskStoreApi, ProductReviewHighlight, ProductReviewItem, ProductReviewsResult, ProductsQuery, ToggleWishlistApi, WishlistApi, WishlistState, } from './commerce-shapes';
|
|
3
|
+
import type { AddToCartApi, CartAddHints, CartApi, CustomerAccountApi, StoreCheckoutsApi, AskStoreApi, ProductReviewsResult, ProductsQuery, ToggleWishlistApi, WishlistApi } from './commerce-shapes';
|
|
4
4
|
/**
|
|
5
5
|
* FourtyCommerceRuntime — the commerce-hook surface the catalog
|
|
6
6
|
* consumes. Same dependency-inversion pattern as `FourtyRuntime`: these
|
|
@@ -31,6 +31,10 @@ export interface FourtyCommerceRuntime {
|
|
|
31
31
|
useCustomerAccount: () => CustomerAccountApi;
|
|
32
32
|
/** What `price` qualifies for under the store's pay-over-time plans. */
|
|
33
33
|
useInstallmentOffer: (price: Money) => InstallmentOffer | undefined;
|
|
34
|
+
/** One checkout per store, for a cart that spans several. */
|
|
35
|
+
useStoreCheckouts: () => StoreCheckoutsApi;
|
|
36
|
+
/** A question put to the store that sells a product. */
|
|
37
|
+
useAskStore: () => AskStoreApi;
|
|
34
38
|
}
|
|
35
39
|
/**
|
|
36
40
|
* Provider for the commerce-hook surface. Mounted by the SDK's
|
|
@@ -72,3 +76,11 @@ export declare function useCustomerAccount(): CustomerAccountApi;
|
|
|
72
76
|
* read), when `price` is outside every plan's band, and without a
|
|
73
77
|
* `<CommerceProvider>`. */
|
|
74
78
|
export declare function useInstallmentOffer(price: Money): InstallmentOffer | undefined;
|
|
79
|
+
/** A cart that spans several stores, checked out one store at a time. Not
|
|
80
|
+
* available (and `create` rejects) on a single-store backend or without a
|
|
81
|
+
* `<CommerceProvider>`. */
|
|
82
|
+
export declare function useStoreCheckouts(): StoreCheckoutsApi;
|
|
83
|
+
/** Put a question to the store that sells a product; the answer is that
|
|
84
|
+
* store's own statement. Not available (and `ask` rejects) where the space is
|
|
85
|
+
* the only store, or without a `<CommerceProvider>`. */
|
|
86
|
+
export declare function useAskStore(): AskStoreApi;
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* this path directly from outside the SDK.
|
|
12
12
|
*/
|
|
13
13
|
import type { CartOrigin } from '../../../../spacestation/src/analytics/ecommerce/index';
|
|
14
|
-
import type { Cart, OptimisticCartLine, Product, ProductReviewItem, ProductReviewHighlight } from '../../../../ecommerce/src/index';
|
|
14
|
+
import type { Cart, OptimisticCartLine, Product, ProductReviewItem, ProductReviewHighlight, StoreAnswer, StoreCheckout } from '../../../../ecommerce/src/index';
|
|
15
15
|
/**
|
|
16
16
|
* One review / one intent-matched review. Both are `z.infer` of the review
|
|
17
17
|
* schemas in `@fourty/ecommerce` — the single source of truth for the shape,
|
|
@@ -188,3 +188,25 @@ export interface CustomerAccountApi {
|
|
|
188
188
|
* session yet, or a space addressed by id, as in a console preview. */
|
|
189
189
|
available: boolean;
|
|
190
190
|
}
|
|
191
|
+
/** Return shape of `useStoreCheckouts` — a cart that spans several stores,
|
|
192
|
+
* checked out one store at a time (`CommerceAdapter.createStoreCheckouts`). */
|
|
193
|
+
export interface StoreCheckoutsApi {
|
|
194
|
+
/** False where the backend's cart belongs to one store — that cart exits
|
|
195
|
+
* through `cart.checkoutUrl` (`useCartView().handleCheckout`) instead. */
|
|
196
|
+
available: boolean;
|
|
197
|
+
/** Make one checkout per store in the cart. Places no order; each `ready`
|
|
198
|
+
* entry's `checkoutUrl` is where the visitor pays for that store's lines. */
|
|
199
|
+
create: () => Promise<StoreCheckout[]>;
|
|
200
|
+
/** True while `create` is in flight. */
|
|
201
|
+
pending: boolean;
|
|
202
|
+
}
|
|
203
|
+
/** Return shape of `useAskStore` — a question put to the store that sells a
|
|
204
|
+
* product (`CommerceAdapter.askStore`). The answer is that store's own
|
|
205
|
+
* statement, so a surface credits it to `seller`. */
|
|
206
|
+
export interface AskStoreApi {
|
|
207
|
+
/** False where the space is the only store — there is no one else to ask. */
|
|
208
|
+
available: boolean;
|
|
209
|
+
ask: (productId: string, question: string) => Promise<StoreAnswer>;
|
|
210
|
+
/** True while `ask` is in flight. */
|
|
211
|
+
pending: boolean;
|
|
212
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './chip-relevance';
|
|
2
|
-
export { useCart, useAddToCart, useWishlist, useToggleWishlist, useProducts, useCollectionByHandle, useProductReviews, useCustomerAccount, useInstallmentOffer, useCommerceRuntime, FourtyCommerceRuntimeProvider, } from './commerce-context';
|
|
3
|
-
export type { FourtyCommerceRuntime, CartApi, AddToCartApi, WishlistApi, ToggleWishlistApi, ProductsQuery, ProductReviewItem, ProductReviewHighlight, ProductReviewsResult, CustomerAccountApi, CartAddOptions, CartAddHints, WishlistState, } from './commerce-context';
|
|
2
|
+
export { useCart, useAddToCart, useWishlist, useToggleWishlist, useProducts, useCollectionByHandle, useProductReviews, useCustomerAccount, useInstallmentOffer, useStoreCheckouts, useAskStore, useCommerceRuntime, FourtyCommerceRuntimeProvider, } from './commerce-context';
|
|
3
|
+
export type { FourtyCommerceRuntime, CartApi, AddToCartApi, WishlistApi, ToggleWishlistApi, ProductsQuery, ProductReviewItem, ProductReviewHighlight, ProductReviewsResult, CustomerAccountApi, StoreCheckoutsApi, AskStoreApi, CartAddOptions, CartAddHints, WishlistState, } from './commerce-context';
|
|
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';
|
|
@@ -36,8 +36,9 @@ export interface CatalogEntryStructural {
|
|
|
36
36
|
alwaysInclude?: boolean;
|
|
37
37
|
/** The component ASKS the visitor something (a quiz, an interview card):
|
|
38
38
|
* once one has been on the canvas, no later turn may introduce another
|
|
39
|
-
* (`@fourty/agent` `layout/spent-ask-guard.ts`)
|
|
40
|
-
* `asks
|
|
39
|
+
* (`@fourty/agent` `layout/spent-ask-guard.ts`), and a turn that places
|
|
40
|
+
* one leads its page with it (`layout/asks-lead.ts`). Set from the
|
|
41
|
+
* manifest's `asks: true` frontmatter by `applyManifests`. */
|
|
41
42
|
asks?: boolean;
|
|
42
43
|
/** When the LLM should select this component. */
|
|
43
44
|
whenToUse?: string;
|
|
@@ -46,4 +46,10 @@ export interface PlatformConnector<TDomains = unknown> {
|
|
|
46
46
|
* The runner falls back to "no enrichment" silently.
|
|
47
47
|
*/
|
|
48
48
|
resolveEntities?(ids: ReadonlyArray<string>): Promise<ReadonlyMap<string, EntityRegistryEntry>>;
|
|
49
|
+
/**
|
|
50
|
+
* The `resolved()` kinds `resolveEntities` answers. An id of any other kind
|
|
51
|
+
* is absent from its result because it was never looked up — not because
|
|
52
|
+
* the store lacks it — so a caller asking "does this exist?" asks only these.
|
|
53
|
+
*/
|
|
54
|
+
readonly resolvableKinds?: readonly string[];
|
|
49
55
|
}
|
|
@@ -15,6 +15,13 @@ import type { VisitorLocation, EntityKind } from '../../types';
|
|
|
15
15
|
* agent run (e.g. preflight cache warmup, eval harnesses) — tools
|
|
16
16
|
* that need the channel must guard with `if (context.emit) ...`.
|
|
17
17
|
*/
|
|
18
|
+
/** A file the visitor attached to THIS turn, as the session's own storage
|
|
19
|
+
* returned it (never fetched from a visitor-supplied URL). */
|
|
20
|
+
export interface TurnAttachment {
|
|
21
|
+
id: string;
|
|
22
|
+
mimeType: string;
|
|
23
|
+
bytes: Uint8Array;
|
|
24
|
+
}
|
|
18
25
|
export interface ToolExecutionContext {
|
|
19
26
|
visitorId: string;
|
|
20
27
|
sessionId: string;
|
|
@@ -93,6 +100,10 @@ export interface ToolExecutionContext {
|
|
|
93
100
|
* an optimisation and stay correct without it.
|
|
94
101
|
*/
|
|
95
102
|
primeEntities?: (resolverKey: string, byRef: Record<string, unknown>) => void;
|
|
103
|
+
/** The files the visitor attached to this turn — the same ones the model
|
|
104
|
+
* sees as image/file parts — for a tool whose backend takes the file itself
|
|
105
|
+
* (search by photo). Absent when the turn carries none. */
|
|
106
|
+
attachments?: ReadonlyArray<TurnAttachment>;
|
|
96
107
|
/** Coarse IP-derived geolocation captured at session bind. Available
|
|
97
108
|
* to location-aware tools (storeLocator, nearest-pickup, regional
|
|
98
109
|
* policy). Absent when the route had no IP or geoip returned no
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
* as shims; runtime-coupled tool types (`ResolvedToolSet`, `ToolManifest`,
|
|
7
7
|
* `ValidationResult`) stay in `@fourty/agent`.
|
|
8
8
|
*/
|
|
9
|
-
export type { McpToolDescriptor, ToolCategory, ToolTransport, FourtyToolDefDescriptor, FourtyToolDef, ToolExecutionContext, FourtyToolPackageManifest, FourtyToolPackageDescriptor, FourtyToolPackage, ToolPackageProvider, DefineToolOptions, } from './types';
|
|
9
|
+
export type { McpToolDescriptor, ToolCategory, ToolTransport, FourtyToolDefDescriptor, FourtyToolDef, ToolExecutionContext, TurnAttachment, FourtyToolPackageManifest, FourtyToolPackageDescriptor, FourtyToolPackage, ToolPackageProvider, DefineToolOptions, } from './types';
|
|
@@ -17,7 +17,7 @@ import type { ZodTypeAny } from 'zod';
|
|
|
17
17
|
import type { FourtyToolDef, FourtyToolDefDescriptor, ToolCategory } from './definitions';
|
|
18
18
|
import type { ToolExecutionContext } from './execution-context';
|
|
19
19
|
export type { McpToolDescriptor, ToolCategory, ToolTransport, FourtyToolDefDescriptor, FourtyToolDef } from './definitions';
|
|
20
|
-
export type { ToolExecutionContext } from './execution-context';
|
|
20
|
+
export type { ToolExecutionContext, TurnAttachment } from './execution-context';
|
|
21
21
|
/**
|
|
22
22
|
* Tool package manifest — metadata about who ships this tool collection.
|
|
23
23
|
* Mirrors FourtyPackageManifest.
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
* list; only `AgentDirective` reaches the prompt.
|
|
14
14
|
*/
|
|
15
15
|
import { z } from 'zod';
|
|
16
|
-
/** At most this many ACTIVE directives per space
|
|
17
|
-
*
|
|
18
|
-
* is pasted in, the prompt just gets longer. */
|
|
19
|
-
export declare const MAX_ACTIVE_AGENT_DIRECTIVES =
|
|
16
|
+
/** At most this many ACTIVE directives per space (raised from 12 in 2026-11,
|
|
17
|
+
* when live spaces hit the limit). Prose is where a cap rots silently: nothing
|
|
18
|
+
* throws when one more rule is pasted in, the prompt just gets longer. */
|
|
19
|
+
export declare const MAX_ACTIVE_AGENT_DIRECTIVES = 20;
|
|
20
20
|
/** What KIND of directive — how an evidence report tells a preference from a
|
|
21
21
|
* promise. */
|
|
22
22
|
export declare const AGENT_DIRECTIVE_KINDS: readonly ["preference", "pairing", "order of things", "promise", "threshold"];
|
|
@@ -225,6 +225,16 @@ export type TraceDiagnostic = {
|
|
|
225
225
|
stage: 'layout_generation';
|
|
226
226
|
element: string;
|
|
227
227
|
elementType: string;
|
|
228
|
+
}
|
|
229
|
+
/** The turn placed an `asks` card (a quiz, an interview card, a planner)
|
|
230
|
+
* below another block on its page. Moved to lead by the asks-leads repair
|
|
231
|
+
* (`layout/asks-lead.ts`) after the stream — a soft model fault: the card is
|
|
232
|
+
* the turn's question, and below a long block the visitor never reaches it. */
|
|
233
|
+
| {
|
|
234
|
+
kind: 'asks_card_led';
|
|
235
|
+
stage: 'layout_generation';
|
|
236
|
+
rootKey: string;
|
|
237
|
+
children: string[];
|
|
228
238
|
} | {
|
|
229
239
|
kind: 'render_sanitized';
|
|
230
240
|
stage: 'layout_generation';
|
package/package.json
CHANGED
|
@@ -1,23 +0,0 @@
|
|
|
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;
|