@40rty/ams-sdk 0.5.15 → 0.5.17
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 +197 -177
- package/dist/types/sdk/src/canvas/index.d.ts +0 -1
- package/dist/types/sdk/src/catalog/index.d.ts +1 -0
- package/dist/types/sdk/src/catalog/prose-links.d.ts +12 -0
- package/dist/types/sdk/src/host/host-modules.d.ts +24 -4
- package/dist/types/spacestation/src/catalog/catalog-schemas.d.ts +6 -0
- package/dist/types/spacestation/src/catalog/wire/catalog-wire.d.ts +6 -0
- package/dist/types/spacestation/src/catalog/wire/package-release.d.ts +5 -0
- package/dist/types/spacestation/src/contracts/retrieval/core/platform-connector.d.ts +6 -0
- package/dist/types/spacestation/src/signal/turn-ask.d.ts +11 -1
- package/dist/types/spacestation/src/space/agent-directive.d.ts +4 -4
- package/dist/types/spacestation/src/trace/trace-diagnostics.d.ts +20 -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,
|
|
@@ -475,6 +474,7 @@ __export(src_exports3, {
|
|
|
475
474
|
projectCollection: () => projectCollection,
|
|
476
475
|
projectProduct: () => projectProduct,
|
|
477
476
|
prose: () => prose,
|
|
477
|
+
proseRuns: () => proseRuns,
|
|
478
478
|
pruneFilterChips: () => pruneFilterChips,
|
|
479
479
|
publishClientState: () => publishClientState,
|
|
480
480
|
queueDiscountCode: () => queueDiscountCode,
|
|
@@ -655,7 +655,6 @@ __export(src_exports3, {
|
|
|
655
655
|
useHasLeftSeedHome: () => useHasLeftSeedHome,
|
|
656
656
|
useHistoryNav: () => useHistoryNav,
|
|
657
657
|
useHydrated: () => useHydrated,
|
|
658
|
-
useHydrationNotice: () => useHydrationNotice,
|
|
659
658
|
useHydrationState: () => useHydrationState,
|
|
660
659
|
useHydrators: () => useHydrators,
|
|
661
660
|
useInlineCompletion: () => useInlineCompletion,
|
|
@@ -2392,7 +2391,7 @@ function partsText(parts2) {
|
|
|
2392
2391
|
var ModelTurnAskSchema = z14.object({
|
|
2393
2392
|
kind: z14.enum(["choice", "open"]),
|
|
2394
2393
|
parts: z14.array(PartSchema).min(1)
|
|
2395
|
-
}).refine((ask) => partsText(ask.parts).trim().length > 0, { message: "the question reads as nothing" }).transform((ask) => {
|
|
2394
|
+
}).refine((ask) => partsText(ask.parts).trim().length > 0, { message: "the question reads as nothing" }).refine((ask) => /\?["'”’*)\s]*$/.test(partsText(ask.parts)), { message: "an ask is a question" }).transform((ask) => {
|
|
2396
2395
|
const answers = ask.parts.filter((p) => typeof p !== "string").length;
|
|
2397
2396
|
if (ask.kind === "choice" && answers >= MIN_CHOICE_ANSWERS && answers <= MAX_CHOICE_ANSWERS) return ask;
|
|
2398
2397
|
if (ask.kind === "open" && answers === 0) return ask;
|
|
@@ -3482,6 +3481,7 @@ var WireCatalogEntrySchema = z24.object({
|
|
|
3482
3481
|
examples: z24.array(z24.record(z24.unknown())).optional(),
|
|
3483
3482
|
renderedBy: z24.string().optional(),
|
|
3484
3483
|
alwaysInclude: z24.boolean().optional(),
|
|
3484
|
+
asks: z24.boolean().optional(),
|
|
3485
3485
|
whenToUse: z24.string().optional(),
|
|
3486
3486
|
dontUseWhen: z24.string().optional(),
|
|
3487
3487
|
variants: z24.string().optional(),
|
|
@@ -4117,7 +4117,7 @@ function scopeOfAttributeKey(config, key) {
|
|
|
4117
4117
|
|
|
4118
4118
|
// ../spacestation/src/space/agent-directive.ts
|
|
4119
4119
|
import { z as z38 } from "zod";
|
|
4120
|
-
var MAX_ACTIVE_AGENT_DIRECTIVES =
|
|
4120
|
+
var MAX_ACTIVE_AGENT_DIRECTIVES = 20;
|
|
4121
4121
|
var AGENT_DIRECTIVE_KINDS = ["preference", "pairing", "order of things", "promise", "threshold"];
|
|
4122
4122
|
var AGENT_DIRECTIVE_SEVERITIES = ["a missed opportunity", "a problem", "unacceptable"];
|
|
4123
4123
|
var AGENT_DIRECTIVE_SOURCES = ["owner", "operator", "session-lesson"];
|
|
@@ -8101,7 +8101,6 @@ __export(canvas_exports, {
|
|
|
8101
8101
|
GENERATION_EASE: () => GENERATION_EASE,
|
|
8102
8102
|
GenerationStyleContext: () => GenerationStyleContext,
|
|
8103
8103
|
GenerationStyleProvider: () => GenerationStyleProvider,
|
|
8104
|
-
HydrationNoticeProvider: () => HydrationNoticeProvider,
|
|
8105
8104
|
INITIAL_NAV_PRESENTATION: () => INITIAL_NAV_PRESENTATION,
|
|
8106
8105
|
ITEM_IDENTITY_ATTR: () => ITEM_IDENTITY_ATTR,
|
|
8107
8106
|
ItemTransitionGroup: () => ItemTransitionGroup,
|
|
@@ -8163,7 +8162,6 @@ __export(canvas_exports, {
|
|
|
8163
8162
|
useGenerationStyle: () => useGenerationStyle,
|
|
8164
8163
|
useHasLeftSeedHome: () => useHasLeftSeedHome,
|
|
8165
8164
|
useHistoryNav: () => useHistoryNav,
|
|
8166
|
-
useHydrationNotice: () => useHydrationNotice,
|
|
8167
8165
|
useInteraction: () => useInteraction,
|
|
8168
8166
|
useIsSeedHome: () => useIsSeedHome,
|
|
8169
8167
|
useLayout: () => useLayout,
|
|
@@ -8207,19 +8205,8 @@ function CanvasTailMount({
|
|
|
8207
8205
|
return /* @__PURE__ */ jsx9(Tail, {});
|
|
8208
8206
|
}
|
|
8209
8207
|
|
|
8210
|
-
// src/canvas/hydration-notice.tsx
|
|
8211
|
-
import * as React27 from "react";
|
|
8212
|
-
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
8213
|
-
var HydrationNoticeContext = React27.createContext(null);
|
|
8214
|
-
function HydrationNoticeProvider({ notice, children }) {
|
|
8215
|
-
return /* @__PURE__ */ jsx10(HydrationNoticeContext.Provider, { value: notice, children });
|
|
8216
|
-
}
|
|
8217
|
-
function useHydrationNotice() {
|
|
8218
|
-
return React27.useContext(HydrationNoticeContext);
|
|
8219
|
-
}
|
|
8220
|
-
|
|
8221
8208
|
// src/canvas/GenerationStyleContext.tsx
|
|
8222
|
-
import { createContext as
|
|
8209
|
+
import { createContext as createContext12, useContext as useContext12 } from "react";
|
|
8223
8210
|
|
|
8224
8211
|
// src/canvas/generation-style.ts
|
|
8225
8212
|
var DEFAULT_GENERATION_TIMINGS = {
|
|
@@ -8245,19 +8232,19 @@ var DEFAULT_GENERATION_STYLE = {
|
|
|
8245
8232
|
var GENERATION_EASE = [0.76, 0, 0.24, 1];
|
|
8246
8233
|
|
|
8247
8234
|
// src/canvas/GenerationStyleContext.tsx
|
|
8248
|
-
var GenerationStyleContext =
|
|
8235
|
+
var GenerationStyleContext = createContext12(DEFAULT_GENERATION_STYLE);
|
|
8249
8236
|
var GenerationStyleProvider = GenerationStyleContext.Provider;
|
|
8250
8237
|
function useGenerationStyle() {
|
|
8251
|
-
return
|
|
8238
|
+
return useContext12(GenerationStyleContext);
|
|
8252
8239
|
}
|
|
8253
8240
|
|
|
8254
8241
|
// src/canvas/ShimmerSweep.tsx
|
|
8255
8242
|
import { motion, useReducedMotion } from "framer-motion";
|
|
8256
|
-
import { jsx as
|
|
8243
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
8257
8244
|
function ShimmerSweep({ durationS }) {
|
|
8258
8245
|
const reduce = useReducedMotion();
|
|
8259
8246
|
if (reduce === true) return null;
|
|
8260
|
-
return /* @__PURE__ */
|
|
8247
|
+
return /* @__PURE__ */ jsx10(
|
|
8261
8248
|
motion.div,
|
|
8262
8249
|
{
|
|
8263
8250
|
"aria-hidden": true,
|
|
@@ -8275,14 +8262,14 @@ function ShimmerSweep({ durationS }) {
|
|
|
8275
8262
|
}
|
|
8276
8263
|
|
|
8277
8264
|
// src/canvas/TransitionContext.tsx
|
|
8278
|
-
import
|
|
8265
|
+
import React27, { createContext as createContext13, useContext as useContext13 } from "react";
|
|
8279
8266
|
import { AnimatePresence, motion as motion2 } from "framer-motion";
|
|
8280
|
-
import { jsx as
|
|
8267
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
8281
8268
|
function FadeGroup({ children }) {
|
|
8282
|
-
return /* @__PURE__ */
|
|
8269
|
+
return /* @__PURE__ */ jsx11(AnimatePresence, { mode: "popLayout", initial: false, children });
|
|
8283
8270
|
}
|
|
8284
|
-
var FadeItem =
|
|
8285
|
-
return /* @__PURE__ */
|
|
8271
|
+
var FadeItem = React27.forwardRef(function FadeItem2({ id, children, style, className }, ref) {
|
|
8272
|
+
return /* @__PURE__ */ jsx11(
|
|
8286
8273
|
motion2.div,
|
|
8287
8274
|
{
|
|
8288
8275
|
ref,
|
|
@@ -8297,62 +8284,62 @@ var FadeTransition = {
|
|
|
8297
8284
|
Group: FadeGroup,
|
|
8298
8285
|
Item: FadeItem
|
|
8299
8286
|
};
|
|
8300
|
-
var TransitionContext =
|
|
8287
|
+
var TransitionContext = createContext13(FadeTransition);
|
|
8301
8288
|
function TransitionProvider({
|
|
8302
8289
|
transition,
|
|
8303
8290
|
children
|
|
8304
8291
|
}) {
|
|
8305
|
-
return /* @__PURE__ */
|
|
8292
|
+
return /* @__PURE__ */ jsx11(TransitionContext.Provider, { value: transition, children });
|
|
8306
8293
|
}
|
|
8307
8294
|
function useLayoutTransition() {
|
|
8308
|
-
return
|
|
8295
|
+
return useContext13(TransitionContext);
|
|
8309
8296
|
}
|
|
8310
8297
|
|
|
8311
8298
|
// src/canvas/canvas-arrangement.tsx
|
|
8312
|
-
import
|
|
8313
|
-
import { jsx as
|
|
8314
|
-
var CanvasArrangementContext =
|
|
8299
|
+
import React28, { createContext as createContext14, useContext as useContext14 } from "react";
|
|
8300
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
8301
|
+
var CanvasArrangementContext = createContext14({ arrangement: "stack", turnPages: false });
|
|
8315
8302
|
function CanvasArrangementProvider({
|
|
8316
8303
|
arrangement,
|
|
8317
8304
|
turnPages = false,
|
|
8318
8305
|
children
|
|
8319
8306
|
}) {
|
|
8320
|
-
const value =
|
|
8321
|
-
return /* @__PURE__ */
|
|
8307
|
+
const value = React28.useMemo(() => ({ arrangement, turnPages }), [arrangement, turnPages]);
|
|
8308
|
+
return /* @__PURE__ */ jsx12(CanvasArrangementContext.Provider, { value, children });
|
|
8322
8309
|
}
|
|
8323
8310
|
function useCanvasArrangement() {
|
|
8324
|
-
return
|
|
8311
|
+
return useContext14(CanvasArrangementContext);
|
|
8325
8312
|
}
|
|
8326
8313
|
|
|
8327
8314
|
// src/canvas/canvas-lead.tsx
|
|
8328
|
-
import * as
|
|
8329
|
-
import { jsx as
|
|
8315
|
+
import * as React29 from "react";
|
|
8316
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
8330
8317
|
var NO_LEAD = () => false;
|
|
8331
|
-
var CanvasLeadContext =
|
|
8318
|
+
var CanvasLeadContext = React29.createContext(null);
|
|
8332
8319
|
function CanvasLeadProvider(props) {
|
|
8333
|
-
const [target, setTarget] =
|
|
8334
|
-
const [leadId, setLeadId] =
|
|
8320
|
+
const [target, setTarget] = React29.useState(null);
|
|
8321
|
+
const [leadId, setLeadId] = React29.useState(null);
|
|
8335
8322
|
const listed = "types" in props ? props.types : props.except;
|
|
8336
8323
|
const only = "types" in props;
|
|
8337
|
-
const canLead =
|
|
8338
|
-
const value =
|
|
8339
|
-
return /* @__PURE__ */
|
|
8324
|
+
const canLead = React29.useCallback((type) => listed.includes(type) === only, [listed, only]);
|
|
8325
|
+
const value = React29.useMemo(() => ({ canLead, target, setTarget, leadId, setLeadId }), [canLead, target, leadId]);
|
|
8326
|
+
return /* @__PURE__ */ jsx13(CanvasLeadContext.Provider, { value, children: props.children });
|
|
8340
8327
|
}
|
|
8341
8328
|
function CanvasLeadSlot({ className }) {
|
|
8342
|
-
const lead =
|
|
8329
|
+
const lead = React29.useContext(CanvasLeadContext);
|
|
8343
8330
|
if (lead === null) throw new Error("<CanvasLeadSlot> must be rendered inside <CanvasLeadProvider>.");
|
|
8344
8331
|
const { setTarget } = lead;
|
|
8345
|
-
const ref =
|
|
8346
|
-
return /* @__PURE__ */
|
|
8332
|
+
const ref = React29.useCallback((el) => setTarget(el), [setTarget]);
|
|
8333
|
+
return /* @__PURE__ */ jsx13("div", { ref, className, "data-fourty-canvas-lead": "" });
|
|
8347
8334
|
}
|
|
8348
8335
|
function useCanvasLead() {
|
|
8349
|
-
const lead =
|
|
8336
|
+
const lead = React29.useContext(CanvasLeadContext);
|
|
8350
8337
|
return { present: lead !== null && lead.target !== null && lead.leadId !== null };
|
|
8351
8338
|
}
|
|
8352
8339
|
function useCanvasLeadTarget() {
|
|
8353
|
-
const lead =
|
|
8340
|
+
const lead = React29.useContext(CanvasLeadContext);
|
|
8354
8341
|
const setLeadId = lead === null ? null : lead.setLeadId;
|
|
8355
|
-
const report =
|
|
8342
|
+
const report = React29.useCallback((id) => {
|
|
8356
8343
|
if (setLeadId !== null) setLeadId(id);
|
|
8357
8344
|
}, [setLeadId]);
|
|
8358
8345
|
if (lead === null) return { canLead: NO_LEAD, target: null, report };
|
|
@@ -8360,21 +8347,21 @@ function useCanvasLeadTarget() {
|
|
|
8360
8347
|
}
|
|
8361
8348
|
|
|
8362
8349
|
// src/canvas/canvas-motion-style.tsx
|
|
8363
|
-
import { createContext as
|
|
8364
|
-
import { jsx as
|
|
8365
|
-
var CanvasMotionStyleContext =
|
|
8350
|
+
import { createContext as createContext16, useContext as useContext16 } from "react";
|
|
8351
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
8352
|
+
var CanvasMotionStyleContext = createContext16(null);
|
|
8366
8353
|
function CanvasMotionStyleProvider({ style, children }) {
|
|
8367
|
-
return /* @__PURE__ */
|
|
8354
|
+
return /* @__PURE__ */ jsx14(CanvasMotionStyleContext.Provider, { value: style, children });
|
|
8368
8355
|
}
|
|
8369
8356
|
function useCanvasMotionStyle() {
|
|
8370
|
-
return
|
|
8357
|
+
return useContext16(CanvasMotionStyleContext);
|
|
8371
8358
|
}
|
|
8372
8359
|
|
|
8373
8360
|
// src/canvas/ElementIdContext.ts
|
|
8374
|
-
import { createContext as
|
|
8375
|
-
var ElementIdContext =
|
|
8361
|
+
import { createContext as createContext17, useContext as useContext17 } from "react";
|
|
8362
|
+
var ElementIdContext = createContext17(null);
|
|
8376
8363
|
function useElementId() {
|
|
8377
|
-
return
|
|
8364
|
+
return useContext17(ElementIdContext);
|
|
8378
8365
|
}
|
|
8379
8366
|
|
|
8380
8367
|
// src/canvas/generation-entrance.ts
|
|
@@ -8634,22 +8621,22 @@ function deriveTurnChangeAnchor(prev, next) {
|
|
|
8634
8621
|
}
|
|
8635
8622
|
|
|
8636
8623
|
// src/canvas/canvas-outlet.tsx
|
|
8637
|
-
import { createContext as
|
|
8638
|
-
import { jsx as
|
|
8639
|
-
var CanvasOutletContext =
|
|
8624
|
+
import { createContext as createContext18, useContext as useContext18 } from "react";
|
|
8625
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
8626
|
+
var CanvasOutletContext = createContext18(null);
|
|
8640
8627
|
function CanvasOutletProvider({ canvas, children }) {
|
|
8641
|
-
return /* @__PURE__ */
|
|
8628
|
+
return /* @__PURE__ */ jsx15(CanvasOutletContext.Provider, { value: canvas, children });
|
|
8642
8629
|
}
|
|
8643
8630
|
function SpacefrontCanvas() {
|
|
8644
|
-
const Canvas =
|
|
8631
|
+
const Canvas = useContext18(CanvasOutletContext);
|
|
8645
8632
|
if (Canvas === null) {
|
|
8646
8633
|
throw new Error("<SpacefrontCanvas> must be rendered inside <Spacefront> \u2014 no engine has provided a canvas.");
|
|
8647
8634
|
}
|
|
8648
|
-
return /* @__PURE__ */
|
|
8635
|
+
return /* @__PURE__ */ jsx15(Canvas, {});
|
|
8649
8636
|
}
|
|
8650
8637
|
|
|
8651
8638
|
// src/canvas/item-motion/ItemTransitionGroup.tsx
|
|
8652
|
-
import
|
|
8639
|
+
import React31 from "react";
|
|
8653
8640
|
import { AnimatePresence as AnimatePresence2, motion as motion3, useReducedMotion as useReducedMotion2 } from "framer-motion";
|
|
8654
8641
|
|
|
8655
8642
|
// src/canvas/item-motion/classify-items.ts
|
|
@@ -8868,7 +8855,7 @@ function getActiveProfile() {
|
|
|
8868
8855
|
}
|
|
8869
8856
|
|
|
8870
8857
|
// src/canvas/item-motion/ItemTransitionGroup.tsx
|
|
8871
|
-
import { jsx as
|
|
8858
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
8872
8859
|
var ITEM_IDENTITY_ATTR = "data-flip-id";
|
|
8873
8860
|
function ItemTransitionGroup({
|
|
8874
8861
|
items,
|
|
@@ -8883,14 +8870,14 @@ function ItemTransitionGroup({
|
|
|
8883
8870
|
const profile = getActiveProfile();
|
|
8884
8871
|
const animated = reduce !== true;
|
|
8885
8872
|
const ids = items.map(getId);
|
|
8886
|
-
const prevIdsRef =
|
|
8887
|
-
const lastChangeRef =
|
|
8873
|
+
const prevIdsRef = React31.useRef(null);
|
|
8874
|
+
const lastChangeRef = React31.useRef(null);
|
|
8888
8875
|
const prevIds = prevIdsRef.current;
|
|
8889
8876
|
const freshChange = prevIds === null ? null : classifyItemChange(prevIds, ids);
|
|
8890
8877
|
if (freshChange !== null) {
|
|
8891
8878
|
lastChangeRef.current = freshChange;
|
|
8892
8879
|
}
|
|
8893
|
-
|
|
8880
|
+
React31.useEffect(() => {
|
|
8894
8881
|
prevIdsRef.current = ids;
|
|
8895
8882
|
});
|
|
8896
8883
|
const activeChange = lastChangeRef.current;
|
|
@@ -8903,7 +8890,7 @@ function ItemTransitionGroup({
|
|
|
8903
8890
|
const isGrid = itemClassName === void 0;
|
|
8904
8891
|
const outerClassName = isGrid ? "h-full" : itemClassName;
|
|
8905
8892
|
const innerClassName = isGrid ? "h-full" : void 0;
|
|
8906
|
-
return /* @__PURE__ */
|
|
8893
|
+
return /* @__PURE__ */ jsx16("div", { className, style, children: /* @__PURE__ */ jsx16(AnimatePresence2, { mode: "popLayout", initial: false, children: items.map((item) => {
|
|
8907
8894
|
const id = getId(item);
|
|
8908
8895
|
const identityAttr = { [ITEM_IDENTITY_ATTR]: id };
|
|
8909
8896
|
const isEntering = activeChange !== null && activeChange.entered.includes(id);
|
|
@@ -8913,7 +8900,7 @@ function ItemTransitionGroup({
|
|
|
8913
8900
|
// `itemClassName`/`itemStyle` size the wrapper for flex/snap
|
|
8914
8901
|
// layouts (carousel); grid layouts leave them unset and get
|
|
8915
8902
|
// `h-full` so the cell height reaches the card.
|
|
8916
|
-
/* @__PURE__ */
|
|
8903
|
+
/* @__PURE__ */ jsx16(
|
|
8917
8904
|
motion3.div,
|
|
8918
8905
|
{
|
|
8919
8906
|
...identityAttr,
|
|
@@ -8922,7 +8909,7 @@ function ItemTransitionGroup({
|
|
|
8922
8909
|
layout: animated ? "position" : void 0,
|
|
8923
8910
|
layoutDependency,
|
|
8924
8911
|
transition: animated ? layoutTransition : void 0,
|
|
8925
|
-
children: /* @__PURE__ */
|
|
8912
|
+
children: /* @__PURE__ */ jsx16(
|
|
8926
8913
|
motion3.div,
|
|
8927
8914
|
{
|
|
8928
8915
|
className: innerClassName,
|
|
@@ -8984,6 +8971,7 @@ __export(catalog_exports, {
|
|
|
8984
8971
|
listRegisteredPlatforms: () => listRegisteredPlatforms,
|
|
8985
8972
|
listRegisteredServices: () => listRegisteredServices,
|
|
8986
8973
|
plain: () => plain,
|
|
8974
|
+
proseRuns: () => proseRuns,
|
|
8987
8975
|
registerComponent: () => registerComponent,
|
|
8988
8976
|
registerLibrary: () => registerLibrary,
|
|
8989
8977
|
registerPlatformHydrators: () => registerPlatformHydrators,
|
|
@@ -9002,21 +8990,21 @@ __export(catalog_exports, {
|
|
|
9002
8990
|
});
|
|
9003
8991
|
|
|
9004
8992
|
// src/catalog/DebugContext.tsx
|
|
9005
|
-
import { createContext as
|
|
9006
|
-
import { jsx as
|
|
9007
|
-
var DebugContext =
|
|
8993
|
+
import { createContext as createContext19, useContext as useContext19 } from "react";
|
|
8994
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
8995
|
+
var DebugContext = createContext19(false);
|
|
9008
8996
|
function DebugProvider({
|
|
9009
8997
|
debug,
|
|
9010
8998
|
children
|
|
9011
8999
|
}) {
|
|
9012
|
-
return /* @__PURE__ */
|
|
9000
|
+
return /* @__PURE__ */ jsx17(DebugContext.Provider, { value: debug, children });
|
|
9013
9001
|
}
|
|
9014
9002
|
function useDebug() {
|
|
9015
|
-
return
|
|
9003
|
+
return useContext19(DebugContext);
|
|
9016
9004
|
}
|
|
9017
9005
|
|
|
9018
9006
|
// src/catalog/HydrationStateContext.tsx
|
|
9019
|
-
import { createContext as
|
|
9007
|
+
import { createContext as createContext20, useContext as useContext20 } from "react";
|
|
9020
9008
|
var DEFAULT_STATE = {
|
|
9021
9009
|
hasResolvedFields: false,
|
|
9022
9010
|
hydrating: false,
|
|
@@ -9026,47 +9014,47 @@ var DEFAULT_STATE = {
|
|
|
9026
9014
|
pendingCount: 0,
|
|
9027
9015
|
errors: []
|
|
9028
9016
|
};
|
|
9029
|
-
var HydrationStateContext =
|
|
9017
|
+
var HydrationStateContext = createContext20(DEFAULT_STATE);
|
|
9030
9018
|
function useHydrationState() {
|
|
9031
|
-
return
|
|
9019
|
+
return useContext20(HydrationStateContext);
|
|
9032
9020
|
}
|
|
9033
9021
|
|
|
9034
9022
|
// src/catalog/HydratorContext.tsx
|
|
9035
|
-
import { createContext as
|
|
9036
|
-
import { jsx as
|
|
9037
|
-
var HydratorContext =
|
|
9023
|
+
import { createContext as createContext21, useContext as useContext21 } from "react";
|
|
9024
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
9025
|
+
var HydratorContext = createContext21({});
|
|
9038
9026
|
function HydratorProvider({
|
|
9039
9027
|
hydrators,
|
|
9040
9028
|
children
|
|
9041
9029
|
}) {
|
|
9042
|
-
return /* @__PURE__ */
|
|
9030
|
+
return /* @__PURE__ */ jsx18(HydratorContext.Provider, { value: hydrators, children });
|
|
9043
9031
|
}
|
|
9044
9032
|
function useHydrators() {
|
|
9045
|
-
return
|
|
9033
|
+
return useContext21(HydratorContext);
|
|
9046
9034
|
}
|
|
9047
9035
|
|
|
9048
9036
|
// src/catalog/registry.tsx
|
|
9049
|
-
import { createContext as
|
|
9050
|
-
import { jsx as
|
|
9051
|
-
var RegistryContext =
|
|
9037
|
+
import { createContext as createContext22, useContext as useContext22 } from "react";
|
|
9038
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
9039
|
+
var RegistryContext = createContext22({});
|
|
9052
9040
|
function RegistryProvider({
|
|
9053
9041
|
registry: registry2,
|
|
9054
9042
|
children
|
|
9055
9043
|
}) {
|
|
9056
|
-
return /* @__PURE__ */
|
|
9044
|
+
return /* @__PURE__ */ jsx19(RegistryContext.Provider, { value: registry2, children });
|
|
9057
9045
|
}
|
|
9058
9046
|
function useRegistry() {
|
|
9059
|
-
return
|
|
9047
|
+
return useContext22(RegistryContext);
|
|
9060
9048
|
}
|
|
9061
|
-
var PackageLookupContext =
|
|
9049
|
+
var PackageLookupContext = createContext22(null);
|
|
9062
9050
|
function PackageLookupProvider({
|
|
9063
9051
|
lookup,
|
|
9064
9052
|
children
|
|
9065
9053
|
}) {
|
|
9066
|
-
return /* @__PURE__ */
|
|
9054
|
+
return /* @__PURE__ */ jsx19(PackageLookupContext.Provider, { value: lookup, children });
|
|
9067
9055
|
}
|
|
9068
9056
|
function usePackageLookup() {
|
|
9069
|
-
return
|
|
9057
|
+
return useContext22(PackageLookupContext);
|
|
9070
9058
|
}
|
|
9071
9059
|
function createAliasedRegistry(baseRegistry, aliases, getPackageComponent) {
|
|
9072
9060
|
return new Proxy(baseRegistry, {
|
|
@@ -9097,9 +9085,34 @@ function createAliasedRegistry(baseRegistry, aliases, getPackageComponent) {
|
|
|
9097
9085
|
}
|
|
9098
9086
|
|
|
9099
9087
|
// src/catalog/render-inline.tsx
|
|
9100
|
-
import
|
|
9101
|
-
|
|
9102
|
-
|
|
9088
|
+
import React34 from "react";
|
|
9089
|
+
|
|
9090
|
+
// src/catalog/prose-links.ts
|
|
9091
|
+
var LINK = /\[([^\]\n]+)\]\(([^)\s]+)\)/g;
|
|
9092
|
+
var PARTIAL_LINK = /\[([^\]\n]*)(?:\](?:\([^)\s]*)?)?$/;
|
|
9093
|
+
var SAFE_HREF = /^(https?:\/\/|\/(?!\/))/i;
|
|
9094
|
+
function proseRuns(text2) {
|
|
9095
|
+
const runs = [];
|
|
9096
|
+
let at = 0;
|
|
9097
|
+
for (const m of text2.matchAll(LINK)) {
|
|
9098
|
+
if (m.index > at) runs.push({ text: text2.slice(at, m.index), href: void 0 });
|
|
9099
|
+
runs.push({ text: m[1], href: SAFE_HREF.test(m[2]) ? m[2] : void 0 });
|
|
9100
|
+
at = m.index + m[0].length;
|
|
9101
|
+
}
|
|
9102
|
+
const rest = text2.slice(at);
|
|
9103
|
+
const partial = PARTIAL_LINK.exec(rest);
|
|
9104
|
+
if (partial === null) {
|
|
9105
|
+
if (rest.length > 0) runs.push({ text: rest, href: void 0 });
|
|
9106
|
+
return runs;
|
|
9107
|
+
}
|
|
9108
|
+
if (partial.index > 0) runs.push({ text: rest.slice(0, partial.index), href: void 0 });
|
|
9109
|
+
if (partial[1].length > 0) runs.push({ text: partial[1], href: void 0 });
|
|
9110
|
+
return runs;
|
|
9111
|
+
}
|
|
9112
|
+
|
|
9113
|
+
// src/catalog/render-inline.tsx
|
|
9114
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
9115
|
+
var linkRenderer = (href, key) => /* @__PURE__ */ jsx20(
|
|
9103
9116
|
"a",
|
|
9104
9117
|
{
|
|
9105
9118
|
className: "fourty-inline-link",
|
|
@@ -9112,6 +9125,14 @@ var linkRenderer = (href, key) => /* @__PURE__ */ jsx21(
|
|
|
9112
9125
|
);
|
|
9113
9126
|
var URL_RE = /https?:\/\/[^\s<>()]+[^\s<>().,:;!?'"]/g;
|
|
9114
9127
|
function linkifyText(text2, keyPrefix) {
|
|
9128
|
+
return proseRuns(text2).flatMap((run, r) => {
|
|
9129
|
+
if (run.href === void 0) return linkifyBareUrls(run.text, `${keyPrefix}-${String(r)}`);
|
|
9130
|
+
return [
|
|
9131
|
+
/* @__PURE__ */ jsx20("a", { className: "fourty-inline-link", href: run.href, target: "_blank", rel: "noopener noreferrer", children: run.text }, `${keyPrefix}-${String(r)}-ll`)
|
|
9132
|
+
];
|
|
9133
|
+
});
|
|
9134
|
+
}
|
|
9135
|
+
function linkifyBareUrls(text2, keyPrefix) {
|
|
9115
9136
|
const out = [];
|
|
9116
9137
|
let last = 0;
|
|
9117
9138
|
let match;
|
|
@@ -9119,14 +9140,14 @@ function linkifyText(text2, keyPrefix) {
|
|
|
9119
9140
|
URL_RE.lastIndex = 0;
|
|
9120
9141
|
while ((match = URL_RE.exec(text2)) !== null) {
|
|
9121
9142
|
if (match.index > last) {
|
|
9122
|
-
out.push(/* @__PURE__ */
|
|
9143
|
+
out.push(/* @__PURE__ */ jsx20(React34.Fragment, { children: text2.slice(last, match.index) }, `${keyPrefix}-lt-${i++}`));
|
|
9123
9144
|
}
|
|
9124
9145
|
const href = match[0];
|
|
9125
9146
|
out.push(linkRenderer(href, `${keyPrefix}-lk-${i++}`));
|
|
9126
9147
|
last = match.index + href.length;
|
|
9127
9148
|
}
|
|
9128
9149
|
if (last < text2.length) {
|
|
9129
|
-
out.push(/* @__PURE__ */
|
|
9150
|
+
out.push(/* @__PURE__ */ jsx20(React34.Fragment, { children: text2.slice(last) }, `${keyPrefix}-lt-${i++}`));
|
|
9130
9151
|
}
|
|
9131
9152
|
return out;
|
|
9132
9153
|
}
|
|
@@ -9139,8 +9160,8 @@ function renderInline(text2, keyPrefix) {
|
|
|
9139
9160
|
while ((match = re.exec(text2)) !== null) {
|
|
9140
9161
|
if (match.index > last) out.push(...linkifyText(text2.slice(last, match.index), `${keyPrefix}-t-${i++}`));
|
|
9141
9162
|
const bold = match[1];
|
|
9142
|
-
if (bold !== void 0) out.push(/* @__PURE__ */
|
|
9143
|
-
else out.push(/* @__PURE__ */
|
|
9163
|
+
if (bold !== void 0) out.push(/* @__PURE__ */ jsx20("strong", { children: bold }, `${keyPrefix}-b-${i++}`));
|
|
9164
|
+
else out.push(/* @__PURE__ */ jsx20("em", { children: match[2] }, `${keyPrefix}-i-${i++}`));
|
|
9144
9165
|
last = match.index + match[0].length;
|
|
9145
9166
|
}
|
|
9146
9167
|
if (last < text2.length) out.push(...linkifyText(text2.slice(last), `${keyPrefix}-t-${i++}`));
|
|
@@ -9148,7 +9169,7 @@ function renderInline(text2, keyPrefix) {
|
|
|
9148
9169
|
}
|
|
9149
9170
|
|
|
9150
9171
|
// src/catalog/component-library.ts
|
|
9151
|
-
import * as
|
|
9172
|
+
import * as React35 from "react";
|
|
9152
9173
|
function displayNameOf(Inner) {
|
|
9153
9174
|
if (typeof Inner === "string") return Inner;
|
|
9154
9175
|
if (typeof Inner.displayName === "string" && Inner.displayName.length > 0) return Inner.displayName;
|
|
@@ -9157,7 +9178,7 @@ function displayNameOf(Inner) {
|
|
|
9157
9178
|
}
|
|
9158
9179
|
function adaptComponent(Inner) {
|
|
9159
9180
|
function Adapted(props) {
|
|
9160
|
-
return
|
|
9181
|
+
return React35.createElement(Inner, props);
|
|
9161
9182
|
}
|
|
9162
9183
|
Adapted.displayName = displayNameOf(Inner);
|
|
9163
9184
|
return Adapted;
|
|
@@ -9554,7 +9575,7 @@ function useConsumeStandingSignal(type) {
|
|
|
9554
9575
|
}
|
|
9555
9576
|
|
|
9556
9577
|
// src/widgets/presence/use-presence-notch.ts
|
|
9557
|
-
import * as
|
|
9578
|
+
import * as React36 from "react";
|
|
9558
9579
|
var SETTLE_DWELL_MS = 4e3;
|
|
9559
9580
|
var HOVER_CLOSE_MS = 240;
|
|
9560
9581
|
var HOVER_BOUNCE_WINDOW_MS = 800;
|
|
@@ -9562,21 +9583,21 @@ var BOUNCE_PX = 2;
|
|
|
9562
9583
|
function usePresenceNotch(widgets) {
|
|
9563
9584
|
const askStanding = useStandingOfType(AGENT_ASK_SIGNAL) !== null;
|
|
9564
9585
|
const { isRunning } = useAgentPresence();
|
|
9565
|
-
const [hovered, setHovered] =
|
|
9566
|
-
const [openDrawerId, setOpenDrawerId] =
|
|
9567
|
-
const rootRef =
|
|
9568
|
-
const toggleDrawer =
|
|
9586
|
+
const [hovered, setHovered] = React36.useState(false);
|
|
9587
|
+
const [openDrawerId, setOpenDrawerId] = React36.useState(null);
|
|
9588
|
+
const rootRef = React36.useRef(null);
|
|
9589
|
+
const toggleDrawer = React36.useCallback((id) => {
|
|
9569
9590
|
setOpenDrawerId((current2) => current2 === id ? null : id);
|
|
9570
9591
|
}, []);
|
|
9571
|
-
const closeTimer =
|
|
9572
|
-
const cancelClose =
|
|
9592
|
+
const closeTimer = React36.useRef(null);
|
|
9593
|
+
const cancelClose = React36.useCallback(() => {
|
|
9573
9594
|
if (closeTimer.current !== null) {
|
|
9574
9595
|
clearTimeout(closeTimer.current);
|
|
9575
9596
|
closeTimer.current = null;
|
|
9576
9597
|
}
|
|
9577
9598
|
}, []);
|
|
9578
|
-
const lastLeaveRef =
|
|
9579
|
-
const openHover =
|
|
9599
|
+
const lastLeaveRef = React36.useRef(null);
|
|
9600
|
+
const openHover = React36.useCallback((e) => {
|
|
9580
9601
|
const last = lastLeaveRef.current;
|
|
9581
9602
|
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) {
|
|
9582
9603
|
return;
|
|
@@ -9584,7 +9605,7 @@ function usePresenceNotch(widgets) {
|
|
|
9584
9605
|
cancelClose();
|
|
9585
9606
|
setHovered(true);
|
|
9586
9607
|
}, [cancelClose]);
|
|
9587
|
-
const scheduleClose =
|
|
9608
|
+
const scheduleClose = React36.useCallback((e) => {
|
|
9588
9609
|
lastLeaveRef.current = { x: e.clientX, y: e.clientY, t: Date.now() };
|
|
9589
9610
|
cancelClose();
|
|
9590
9611
|
closeTimer.current = setTimeout(() => {
|
|
@@ -9592,8 +9613,8 @@ function usePresenceNotch(widgets) {
|
|
|
9592
9613
|
setHovered(false);
|
|
9593
9614
|
}, HOVER_CLOSE_MS);
|
|
9594
9615
|
}, [cancelClose]);
|
|
9595
|
-
|
|
9596
|
-
|
|
9616
|
+
React36.useEffect(() => cancelClose, [cancelClose]);
|
|
9617
|
+
React36.useEffect(() => {
|
|
9597
9618
|
if (openDrawerId === null) return;
|
|
9598
9619
|
const onKey = (e) => {
|
|
9599
9620
|
if (e.key === "Escape") setOpenDrawerId(null);
|
|
@@ -9601,7 +9622,7 @@ function usePresenceNotch(widgets) {
|
|
|
9601
9622
|
window.addEventListener("keydown", onKey);
|
|
9602
9623
|
return () => window.removeEventListener("keydown", onKey);
|
|
9603
9624
|
}, [openDrawerId]);
|
|
9604
|
-
|
|
9625
|
+
React36.useEffect(() => {
|
|
9605
9626
|
if (openDrawerId === null) return;
|
|
9606
9627
|
const onDown = (e) => {
|
|
9607
9628
|
const root = rootRef.current;
|
|
@@ -9613,8 +9634,8 @@ function usePresenceNotch(widgets) {
|
|
|
9613
9634
|
document.addEventListener("pointerdown", onDown);
|
|
9614
9635
|
return () => document.removeEventListener("pointerdown", onDown);
|
|
9615
9636
|
}, [openDrawerId]);
|
|
9616
|
-
const [active, setActive] =
|
|
9617
|
-
|
|
9637
|
+
const [active, setActive] = React36.useState(false);
|
|
9638
|
+
React36.useEffect(() => {
|
|
9618
9639
|
if (isRunning) {
|
|
9619
9640
|
setActive(true);
|
|
9620
9641
|
return;
|
|
@@ -9774,7 +9795,7 @@ function presenceFactShape(fact) {
|
|
|
9774
9795
|
}
|
|
9775
9796
|
|
|
9776
9797
|
// src/widgets/presence/use-optimistic-facts.ts
|
|
9777
|
-
import * as
|
|
9798
|
+
import * as React37 from "react";
|
|
9778
9799
|
function readEntries(data) {
|
|
9779
9800
|
if (typeof data !== "object" || data === null || !("entries" in data)) return [];
|
|
9780
9801
|
const raw = data.entries;
|
|
@@ -9793,7 +9814,7 @@ function writeOptimisticFact(entries3, fact) {
|
|
|
9793
9814
|
}
|
|
9794
9815
|
function useOptimisticFactOverlay(flowId) {
|
|
9795
9816
|
const entries3 = readEntries(useAgentFlow(flowId));
|
|
9796
|
-
return
|
|
9817
|
+
return React37.useMemo(
|
|
9797
9818
|
() => ({
|
|
9798
9819
|
entries: entries3,
|
|
9799
9820
|
add: (fact) => setFlowOutput(flowId, { entries: writeOptimisticFact(entries3, fact) })
|
|
@@ -9802,8 +9823,8 @@ function useOptimisticFactOverlay(flowId) {
|
|
|
9802
9823
|
);
|
|
9803
9824
|
}
|
|
9804
9825
|
function useReconcileOptimisticFacts(flowId, readIdentity) {
|
|
9805
|
-
const seenRef =
|
|
9806
|
-
|
|
9826
|
+
const seenRef = React37.useRef(null);
|
|
9827
|
+
React37.useEffect(() => {
|
|
9807
9828
|
if (readIdentity === null) return;
|
|
9808
9829
|
if (seenRef.current === null) {
|
|
9809
9830
|
seenRef.current = readIdentity;
|
|
@@ -9975,10 +9996,10 @@ __export(chat_exports, {
|
|
|
9975
9996
|
});
|
|
9976
9997
|
|
|
9977
9998
|
// src/chat/chat-context.ts
|
|
9978
|
-
import { createContext as
|
|
9979
|
-
var FourtyChatContext =
|
|
9999
|
+
import { createContext as createContext23, useContext as useContext23 } from "react";
|
|
10000
|
+
var FourtyChatContext = createContext23(null);
|
|
9980
10001
|
function useFourtyChat() {
|
|
9981
|
-
const ctx =
|
|
10002
|
+
const ctx = useContext23(FourtyChatContext);
|
|
9982
10003
|
if (!ctx) throw new Error("useFourtyChat must be used inside <FourtyChatProvider>");
|
|
9983
10004
|
return ctx;
|
|
9984
10005
|
}
|
|
@@ -10215,34 +10236,34 @@ __export(interaction_exports, {
|
|
|
10215
10236
|
});
|
|
10216
10237
|
|
|
10217
10238
|
// src/interaction/withInteractionTracking.tsx
|
|
10218
|
-
import
|
|
10219
|
-
import { jsx as
|
|
10220
|
-
var InteractionContext =
|
|
10239
|
+
import React38, { createContext as createContext24, useContext as useContext24 } from "react";
|
|
10240
|
+
import { jsx as jsx21, jsxs } from "react/jsx-runtime";
|
|
10241
|
+
var InteractionContext = createContext24(null);
|
|
10221
10242
|
function InteractionProvider({
|
|
10222
10243
|
onInteraction,
|
|
10223
10244
|
children
|
|
10224
10245
|
}) {
|
|
10225
|
-
return /* @__PURE__ */
|
|
10246
|
+
return /* @__PURE__ */ jsx21(InteractionContext.Provider, { value: onInteraction, children });
|
|
10226
10247
|
}
|
|
10227
10248
|
function useInteraction2() {
|
|
10228
|
-
return
|
|
10249
|
+
return useContext24(InteractionContext);
|
|
10229
10250
|
}
|
|
10230
10251
|
function withInteractionTracking(WrappedComponent, meta) {
|
|
10231
10252
|
function TrackedComponent(props) {
|
|
10232
|
-
return /* @__PURE__ */
|
|
10253
|
+
return /* @__PURE__ */ jsx21(
|
|
10233
10254
|
"div",
|
|
10234
10255
|
{
|
|
10235
10256
|
"data-tracked-component": meta.componentId,
|
|
10236
10257
|
"data-tracked-component-type": meta.componentType,
|
|
10237
10258
|
style: { display: "contents" },
|
|
10238
|
-
children: /* @__PURE__ */
|
|
10259
|
+
children: /* @__PURE__ */ jsx21(ComponentErrorBoundary, { componentId: meta.componentId, children: /* @__PURE__ */ jsx21(WrappedComponent, { ...props }) })
|
|
10239
10260
|
}
|
|
10240
10261
|
);
|
|
10241
10262
|
}
|
|
10242
10263
|
TrackedComponent.displayName = `Tracked(${WrappedComponent.displayName || WrappedComponent.name || "Component"})`;
|
|
10243
10264
|
return TrackedComponent;
|
|
10244
10265
|
}
|
|
10245
|
-
var ComponentErrorBoundary = class extends
|
|
10266
|
+
var ComponentErrorBoundary = class extends React38.Component {
|
|
10246
10267
|
constructor() {
|
|
10247
10268
|
super(...arguments);
|
|
10248
10269
|
__publicField(this, "state", { error: null });
|
|
@@ -10256,7 +10277,7 @@ var ComponentErrorBoundary = class extends React39.Component {
|
|
|
10256
10277
|
render() {
|
|
10257
10278
|
if (this.state.error) {
|
|
10258
10279
|
return /* @__PURE__ */ jsxs("div", { className: "fourty-component-error", role: "alert", "data-component-id": this.props.componentId, children: [
|
|
10259
|
-
/* @__PURE__ */
|
|
10280
|
+
/* @__PURE__ */ jsx21("strong", { children: this.props.componentId }),
|
|
10260
10281
|
": ",
|
|
10261
10282
|
this.state.error.message
|
|
10262
10283
|
] });
|
|
@@ -10316,14 +10337,14 @@ __export(utils_exports, {
|
|
|
10316
10337
|
import { useSyncExternalStore as useSyncExternalStore6 } from "react";
|
|
10317
10338
|
|
|
10318
10339
|
// src/utils/viewport-window.tsx
|
|
10319
|
-
import { createContext as
|
|
10320
|
-
import { jsx as
|
|
10321
|
-
var ViewportWindowContext =
|
|
10340
|
+
import { createContext as createContext25, useContext as useContext25 } from "react";
|
|
10341
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
10342
|
+
var ViewportWindowContext = createContext25(null);
|
|
10322
10343
|
function canAnswer(win) {
|
|
10323
10344
|
return win !== null && typeof win.matchMedia === "function";
|
|
10324
10345
|
}
|
|
10325
10346
|
function useViewportWindow() {
|
|
10326
|
-
const provided =
|
|
10347
|
+
const provided = useContext25(ViewportWindowContext);
|
|
10327
10348
|
if (provided !== null) return canAnswer(provided) ? provided : null;
|
|
10328
10349
|
const global = globalThis;
|
|
10329
10350
|
return canAnswer(global) ? global : null;
|
|
@@ -10332,7 +10353,7 @@ function ViewportWindowProvider({
|
|
|
10332
10353
|
value,
|
|
10333
10354
|
children
|
|
10334
10355
|
}) {
|
|
10335
|
-
return /* @__PURE__ */
|
|
10356
|
+
return /* @__PURE__ */ jsx22(ViewportWindowContext.Provider, { value, children });
|
|
10336
10357
|
}
|
|
10337
10358
|
|
|
10338
10359
|
// src/utils/use-form-factor.ts
|
|
@@ -10423,7 +10444,7 @@ function useInlineCompletion(opts) {
|
|
|
10423
10444
|
}
|
|
10424
10445
|
|
|
10425
10446
|
// src/utils/use-document-visible.ts
|
|
10426
|
-
import
|
|
10447
|
+
import React39 from "react";
|
|
10427
10448
|
function subscribe4(onChange) {
|
|
10428
10449
|
document.addEventListener("visibilitychange", onChange);
|
|
10429
10450
|
return () => document.removeEventListener("visibilitychange", onChange);
|
|
@@ -10435,15 +10456,15 @@ function getServerSnapshot() {
|
|
|
10435
10456
|
return true;
|
|
10436
10457
|
}
|
|
10437
10458
|
function useDocumentVisible() {
|
|
10438
|
-
return
|
|
10459
|
+
return React39.useSyncExternalStore(subscribe4, getSnapshot, getServerSnapshot);
|
|
10439
10460
|
}
|
|
10440
10461
|
|
|
10441
10462
|
// src/utils/use-interval.ts
|
|
10442
|
-
import
|
|
10463
|
+
import React40 from "react";
|
|
10443
10464
|
function useInterval(callback, ms, active = true) {
|
|
10444
|
-
const cbRef =
|
|
10465
|
+
const cbRef = React40.useRef(callback);
|
|
10445
10466
|
cbRef.current = callback;
|
|
10446
|
-
|
|
10467
|
+
React40.useEffect(() => {
|
|
10447
10468
|
if (!active) return;
|
|
10448
10469
|
const id = window.setInterval(() => cbRef.current(), ms);
|
|
10449
10470
|
return () => window.clearInterval(id);
|
|
@@ -10655,15 +10676,15 @@ function primedEntitiesFor(resolverKey) {
|
|
|
10655
10676
|
}
|
|
10656
10677
|
|
|
10657
10678
|
// src/preview/SpacefrontPreviewProvider.tsx
|
|
10658
|
-
import * as
|
|
10659
|
-
import { jsx as
|
|
10679
|
+
import * as React41 from "react";
|
|
10680
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
10660
10681
|
var NOOP = () => {
|
|
10661
10682
|
};
|
|
10662
10683
|
var ASYNC_NOOP = () => Promise.resolve();
|
|
10663
10684
|
var VIEW = { page: { kind: "home" }, layout: EMPTY_SPEC, shell: EMPTY_SHELL };
|
|
10664
|
-
var PreviewContext =
|
|
10685
|
+
var PreviewContext = React41.createContext(null);
|
|
10665
10686
|
function usePreview() {
|
|
10666
|
-
const value =
|
|
10687
|
+
const value = React41.useContext(PreviewContext);
|
|
10667
10688
|
if (value === null) throw new Error("preview runtime used outside <SpacefrontPreviewProvider>");
|
|
10668
10689
|
return value;
|
|
10669
10690
|
}
|
|
@@ -10817,11 +10838,11 @@ var PRESENCE = {
|
|
|
10817
10838
|
usePresenceLiveTurn: () => usePreview().pending?.messageId
|
|
10818
10839
|
};
|
|
10819
10840
|
function SpacefrontPreviewProvider({ scene, onSend, children }) {
|
|
10820
|
-
const [sessionId] =
|
|
10821
|
-
const derived =
|
|
10822
|
-
const onSendRef =
|
|
10841
|
+
const [sessionId] = React41.useState(() => `preview-${Math.random().toString(36).slice(2)}`);
|
|
10842
|
+
const derived = React41.useMemo(() => derive(scene, sessionId), [scene, sessionId]);
|
|
10843
|
+
const onSendRef = React41.useRef(onSend);
|
|
10823
10844
|
onSendRef.current = onSend;
|
|
10824
|
-
const draft =
|
|
10845
|
+
const draft = React41.useMemo(() => {
|
|
10825
10846
|
let text2 = "";
|
|
10826
10847
|
const listeners14 = /* @__PURE__ */ new Set();
|
|
10827
10848
|
return {
|
|
@@ -10837,7 +10858,7 @@ function SpacefrontPreviewProvider({ scene, onSend, children }) {
|
|
|
10837
10858
|
}
|
|
10838
10859
|
};
|
|
10839
10860
|
}, []);
|
|
10840
|
-
const session =
|
|
10861
|
+
const session = React41.useMemo(() => {
|
|
10841
10862
|
const send = (text2) => {
|
|
10842
10863
|
draft.set("");
|
|
10843
10864
|
onSendRef.current?.(text2);
|
|
@@ -10889,15 +10910,15 @@ function SpacefrontPreviewProvider({ scene, onSend, children }) {
|
|
|
10889
10910
|
const qId = question === null ? null : question.id;
|
|
10890
10911
|
const qText = question === null ? "" : question.text;
|
|
10891
10912
|
const qReplies = question === null ? "" : list(question.replies).join("\0");
|
|
10892
|
-
const raised =
|
|
10893
|
-
|
|
10913
|
+
const raised = React41.useRef(0);
|
|
10914
|
+
React41.useEffect(() => {
|
|
10894
10915
|
if (qId === null) return;
|
|
10895
10916
|
raised.current += 1;
|
|
10896
10917
|
const id = `${qId}-${raised.current}`;
|
|
10897
10918
|
raiseStanding(AGENT_ASK_SIGNAL, id, { ask: qText, suggestions: qReplies === "" ? [] : qReplies.split("\0") }, sessionId);
|
|
10898
10919
|
return () => resolveStanding(id, sessionId);
|
|
10899
10920
|
}, [qId, qText, qReplies, sessionId]);
|
|
10900
|
-
return /* @__PURE__ */
|
|
10921
|
+
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 }) }) }) });
|
|
10901
10922
|
}
|
|
10902
10923
|
|
|
10903
10924
|
// src/verticals/commerce/index.ts
|
|
@@ -11041,7 +11062,7 @@ registerEntityPageKind("search", {
|
|
|
11041
11062
|
});
|
|
11042
11063
|
|
|
11043
11064
|
// src/verticals/commerce/commerce-context.tsx
|
|
11044
|
-
import { createContext as
|
|
11065
|
+
import { createContext as createContext27, useContext as useContext27 } from "react";
|
|
11045
11066
|
var INERT_COMMERCE_RUNTIME = {
|
|
11046
11067
|
useCart: () => {
|
|
11047
11068
|
throw new Error("useCart must be used within a <CommerceProvider>");
|
|
@@ -11082,12 +11103,12 @@ var INERT_COMMERCE_RUNTIME = {
|
|
|
11082
11103
|
// No store, no plans: a price line simply shows no installment offer.
|
|
11083
11104
|
useInstallmentOffer: () => void 0
|
|
11084
11105
|
};
|
|
11085
|
-
var FourtyCommerceRuntimeContext =
|
|
11106
|
+
var FourtyCommerceRuntimeContext = createContext27(
|
|
11086
11107
|
INERT_COMMERCE_RUNTIME
|
|
11087
11108
|
);
|
|
11088
11109
|
var FourtyCommerceRuntimeProvider = FourtyCommerceRuntimeContext.Provider;
|
|
11089
11110
|
function useCommerceRuntime() {
|
|
11090
|
-
return
|
|
11111
|
+
return useContext27(FourtyCommerceRuntimeContext);
|
|
11091
11112
|
}
|
|
11092
11113
|
function useCart() {
|
|
11093
11114
|
return useCommerceRuntime().useCart();
|
|
@@ -11861,7 +11882,7 @@ function useCartDrawer() {
|
|
|
11861
11882
|
}
|
|
11862
11883
|
|
|
11863
11884
|
// src/verticals/commerce/cart/use-cart-view.ts
|
|
11864
|
-
import
|
|
11885
|
+
import React42 from "react";
|
|
11865
11886
|
|
|
11866
11887
|
// src/verticals/commerce/cart/queued-discount-codes.ts
|
|
11867
11888
|
import { useSyncExternalStore as useSyncExternalStore12 } from "react";
|
|
@@ -11920,7 +11941,7 @@ registerSessionScopedClear(() => {
|
|
|
11920
11941
|
// src/verticals/commerce/cart/use-cart-view.ts
|
|
11921
11942
|
function useCartView(cart, onCheckout) {
|
|
11922
11943
|
const analytics = useOptionalAnalyticsSink();
|
|
11923
|
-
const [exitPending, setExitPending] =
|
|
11944
|
+
const [exitPending, setExitPending] = React42.useState(null);
|
|
11924
11945
|
const lines = cart === null ? [] : cart.lines;
|
|
11925
11946
|
const count = lines.reduce((sum, l) => sum + l.quantity, 0);
|
|
11926
11947
|
const totalsPending = lines.some((l) => isPendingCartLine(l));
|
|
@@ -11931,7 +11952,7 @@ function useCartView(cart, onCheckout) {
|
|
|
11931
11952
|
const backendTotal = cart !== null && cart.total !== void 0 ? cart.total.amount : void 0;
|
|
11932
11953
|
const discountAmount = backendTotal !== void 0 && backendTotal < subtotal ? subtotal - backendTotal : 0;
|
|
11933
11954
|
const effectiveTotal = backendTotal !== void 0 ? backendTotal : subtotal;
|
|
11934
|
-
const navigateToExit =
|
|
11955
|
+
const navigateToExit = React42.useCallback((url, kind) => {
|
|
11935
11956
|
const result = navigateToExternalCommerceUrl(url);
|
|
11936
11957
|
if (kind === "checkout") recordVisitorCheckoutExit(analytics, result);
|
|
11937
11958
|
if (result === "new-tab") {
|
|
@@ -11948,7 +11969,7 @@ function useCartView(cart, onCheckout) {
|
|
|
11948
11969
|
setExitPending(null);
|
|
11949
11970
|
}
|
|
11950
11971
|
}, [analytics]);
|
|
11951
|
-
const handleCheckout =
|
|
11972
|
+
const handleCheckout = React42.useCallback(() => {
|
|
11952
11973
|
if (lines.length === 0 || exitPending !== null) return;
|
|
11953
11974
|
setExitPending("checkout");
|
|
11954
11975
|
if (onCheckout) {
|
|
@@ -11968,7 +11989,7 @@ function useCartView(cart, onCheckout) {
|
|
|
11968
11989
|
}
|
|
11969
11990
|
navigateToExit(cart?.checkoutUrl, "checkout");
|
|
11970
11991
|
}, [lines.length, exitPending, onCheckout, cart, navigateToExit]);
|
|
11971
|
-
const handleGoToStore =
|
|
11992
|
+
const handleGoToStore = React42.useCallback(() => {
|
|
11972
11993
|
if (lines.length === 0 || exitPending !== null) return;
|
|
11973
11994
|
setExitPending("store");
|
|
11974
11995
|
navigateToExit(cart?.storeCartUrl, "store");
|
|
@@ -12056,7 +12077,7 @@ registerSessionScopedClear(() => {
|
|
|
12056
12077
|
});
|
|
12057
12078
|
|
|
12058
12079
|
// src/verticals/commerce/cart/use-cart-line-row.ts
|
|
12059
|
-
import * as
|
|
12080
|
+
import * as React43 from "react";
|
|
12060
12081
|
|
|
12061
12082
|
// src/verticals/commerce/use-commerce-actions.ts
|
|
12062
12083
|
import { useCallback as useCallback23 } from "react";
|
|
@@ -12102,19 +12123,19 @@ var SPOTLIGHT_MAX_AGE_MS = 3e4;
|
|
|
12102
12123
|
function useCartLineRow(line, opts) {
|
|
12103
12124
|
const actions = useCommerceActions();
|
|
12104
12125
|
const drawerFocus = useCartDrawerFocus();
|
|
12105
|
-
const rowRef =
|
|
12126
|
+
const rowRef = React43.useRef(null);
|
|
12106
12127
|
const pending2 = isPendingCartLine(line);
|
|
12107
12128
|
const navigable = actions !== null && !pending2 && line.productId.length > 0;
|
|
12108
12129
|
const onNavigated = opts === void 0 ? void 0 : opts.onNavigated;
|
|
12109
|
-
const navigatedRef =
|
|
12130
|
+
const navigatedRef = React43.useRef(onNavigated);
|
|
12110
12131
|
navigatedRef.current = onNavigated;
|
|
12111
|
-
const navigate =
|
|
12132
|
+
const navigate = React43.useCallback(() => {
|
|
12112
12133
|
if (actions === null) return;
|
|
12113
12134
|
actions.navigateToProduct(line.productId, line.title);
|
|
12114
12135
|
const done = navigatedRef.current;
|
|
12115
12136
|
if (done !== void 0) done();
|
|
12116
12137
|
}, [actions, line.productId, line.title]);
|
|
12117
|
-
const interaction =
|
|
12138
|
+
const interaction = React43.useMemo(() => {
|
|
12118
12139
|
if (!navigable) return void 0;
|
|
12119
12140
|
return {
|
|
12120
12141
|
onClick: navigate,
|
|
@@ -12129,7 +12150,7 @@ function useCartLineRow(line, opts) {
|
|
|
12129
12150
|
};
|
|
12130
12151
|
}, [navigable, navigate]);
|
|
12131
12152
|
const spotlightKey = drawerFocus !== null && !pending2 && line.productId.length > 0 && drawerFocus.productId === line.productId && Date.now() - drawerFocus.at < SPOTLIGHT_MAX_AGE_MS ? drawerFocus.at : null;
|
|
12132
|
-
|
|
12153
|
+
React43.useEffect(() => {
|
|
12133
12154
|
if (spotlightKey === null) return;
|
|
12134
12155
|
const node = rowRef.current;
|
|
12135
12156
|
if (node === null) return;
|
|
@@ -12274,7 +12295,7 @@ function pickColorCount(product) {
|
|
|
12274
12295
|
}
|
|
12275
12296
|
|
|
12276
12297
|
// src/verticals/commerce/product/use-look-card.ts
|
|
12277
|
-
import * as
|
|
12298
|
+
import * as React44 from "react";
|
|
12278
12299
|
|
|
12279
12300
|
// src/verticals/commerce/variant/variant-option-axes.ts
|
|
12280
12301
|
function carriesValue(variant, name, value) {
|
|
@@ -12484,8 +12505,8 @@ function useLookCard({
|
|
|
12484
12505
|
const session = useFourtySession();
|
|
12485
12506
|
const addFlash = useSuccessFlash({ duration: 1200 });
|
|
12486
12507
|
const locale = useSpaceLocale();
|
|
12487
|
-
const [pending2, setPending] =
|
|
12488
|
-
const clean =
|
|
12508
|
+
const [pending2, setPending] = React44.useState(null);
|
|
12509
|
+
const clean = React44.useMemo(
|
|
12489
12510
|
() => (Array.isArray(products) ? products : []).filter(
|
|
12490
12511
|
(p) => p !== null && p !== void 0 && typeof p === "object"
|
|
12491
12512
|
),
|
|
@@ -12840,7 +12861,7 @@ function useContentActions() {
|
|
|
12840
12861
|
import { useEffect as useEffect19, useState as useState19 } from "react";
|
|
12841
12862
|
|
|
12842
12863
|
// package.json
|
|
12843
|
-
var version = "0.5.
|
|
12864
|
+
var version = "0.5.17";
|
|
12844
12865
|
|
|
12845
12866
|
// src/host/host-modules.ts
|
|
12846
12867
|
import * as react from "react";
|
|
@@ -12901,7 +12922,7 @@ function loadEngine(apiUrl) {
|
|
|
12901
12922
|
}
|
|
12902
12923
|
|
|
12903
12924
|
// src/host/Spacefront.tsx
|
|
12904
|
-
import { jsx as
|
|
12925
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
12905
12926
|
function Spacefront(props) {
|
|
12906
12927
|
const [engine, setEngine] = useState19(null);
|
|
12907
12928
|
const [failure, setFailure] = useState19(null);
|
|
@@ -12923,7 +12944,7 @@ function Spacefront(props) {
|
|
|
12923
12944
|
if (failure !== null) throw failure;
|
|
12924
12945
|
if (engine === null) return null;
|
|
12925
12946
|
const EngineRoot = engine.EngineRoot;
|
|
12926
|
-
return /* @__PURE__ */
|
|
12947
|
+
return /* @__PURE__ */ jsx24(EngineRoot, { ...props });
|
|
12927
12948
|
}
|
|
12928
12949
|
|
|
12929
12950
|
// src/npm.ts
|
|
@@ -13072,7 +13093,6 @@ export {
|
|
|
13072
13093
|
HostExportsSchema,
|
|
13073
13094
|
HostImportsSchema,
|
|
13074
13095
|
HostPayloadSchema,
|
|
13075
|
-
HydrationNoticeProvider,
|
|
13076
13096
|
HydrationStateContext,
|
|
13077
13097
|
HydratorProvider,
|
|
13078
13098
|
INITIAL_NAV_PRESENTATION,
|
|
@@ -13398,6 +13418,7 @@ export {
|
|
|
13398
13418
|
projectCollection,
|
|
13399
13419
|
projectProduct,
|
|
13400
13420
|
prose,
|
|
13421
|
+
proseRuns,
|
|
13401
13422
|
pruneFilterChips,
|
|
13402
13423
|
publishClientState,
|
|
13403
13424
|
queueDiscountCode,
|
|
@@ -13578,7 +13599,6 @@ export {
|
|
|
13578
13599
|
useHasLeftSeedHome,
|
|
13579
13600
|
useHistoryNav,
|
|
13580
13601
|
useHydrated,
|
|
13581
|
-
useHydrationNotice,
|
|
13582
13602
|
useHydrationState,
|
|
13583
13603
|
useHydrators,
|
|
13584
13604
|
useInlineCompletion,
|