@40rty/ams-sdk 0.5.11 → 0.5.13
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 +1065 -847
- package/dist/types/ecommerce/src/index.d.ts +1 -0
- package/dist/types/ecommerce/src/installment-offer.d.ts +42 -0
- package/dist/types/sdk/src/canvas/canvas-lead.d.ts +23 -0
- package/dist/types/sdk/src/canvas/index.d.ts +1 -0
- package/dist/types/sdk/src/host/host-modules.d.ts +36 -0
- package/dist/types/sdk/src/shell/bot-check-notice.d.ts +9 -0
- package/dist/types/sdk/src/shell/conversation/answer-text.d.ts +7 -0
- package/dist/types/sdk/src/shell/conversation/index.d.ts +1 -1
- package/dist/types/sdk/src/shell/index.d.ts +2 -0
- package/dist/types/sdk/src/shell/submit-origin.d.ts +40 -0
- package/dist/types/sdk/src/shell/use-prompt-composer.d.ts +6 -0
- package/dist/types/sdk/src/verticals/commerce/commerce-context.d.ts +9 -1
- package/dist/types/sdk/src/verticals/commerce/commerce-shapes.d.ts +3 -2
- package/dist/types/sdk/src/verticals/commerce/index.d.ts +1 -1
- package/dist/types/spacestation/src/index.d.ts +2 -0
- package/dist/types/spacestation/src/shell/bot-check-notice.d.ts +34 -0
- package/dist/types/spacestation/src/signal/chip-show.d.ts +10 -0
- package/dist/types/spacestation/src/space/space-config.d.ts +4 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -42,6 +42,8 @@ __export(src_exports3, {
|
|
|
42
42
|
BRAND_MARK_MAX_BYTES: () => BRAND_MARK_MAX_BYTES,
|
|
43
43
|
BRAND_MARK_SLOTS: () => BRAND_MARK_SLOTS,
|
|
44
44
|
BRAND_MARK_TYPES: () => BRAND_MARK_TYPES,
|
|
45
|
+
BotCheckNoticeProvider: () => BotCheckNoticeProvider,
|
|
46
|
+
BotCheckNoticeSchema: () => BotCheckNoticeSchema,
|
|
45
47
|
BrandMarkImageSchema: () => BrandMarkImageSchema,
|
|
46
48
|
BrandMarkSchema: () => BrandMarkSchema,
|
|
47
49
|
BugLocationSchema: () => BugLocationSchema,
|
|
@@ -69,6 +71,7 @@ __export(src_exports3, {
|
|
|
69
71
|
CHECKOUT_OUTCOMES: () => CHECKOUT_OUTCOMES,
|
|
70
72
|
CHECKOUT_REACHED_OUTCOMES: () => CHECKOUT_REACHED_OUTCOMES,
|
|
71
73
|
CHECKOUT_REFUSALS: () => CHECKOUT_REFUSALS,
|
|
74
|
+
CHIP_SHOW_SIGNAL: () => CHIP_SHOW_SIGNAL,
|
|
72
75
|
CLICK_ID_KINDS: () => CLICK_ID_KINDS,
|
|
73
76
|
CLIENT_STATE_HELLO_SIGNAL: () => CLIENT_STATE_HELLO_SIGNAL,
|
|
74
77
|
COMPONENT_SOURCE: () => COMPONENT_SOURCE,
|
|
@@ -78,6 +81,8 @@ __export(src_exports3, {
|
|
|
78
81
|
CONTINUATION_ENABLED: () => CONTINUATION_ENABLED,
|
|
79
82
|
CUSTOMER_ACCOUNT_SESSION_HEADER: () => CUSTOMER_ACCOUNT_SESSION_HEADER,
|
|
80
83
|
CanvasArrangementProvider: () => CanvasArrangementProvider,
|
|
84
|
+
CanvasLeadProvider: () => CanvasLeadProvider,
|
|
85
|
+
CanvasLeadSlot: () => CanvasLeadSlot,
|
|
81
86
|
CanvasMotionStyleProvider: () => CanvasMotionStyleProvider,
|
|
82
87
|
CanvasOutletProvider: () => CanvasOutletProvider,
|
|
83
88
|
CanvasTailMount: () => CanvasTailMount,
|
|
@@ -336,6 +341,7 @@ __export(src_exports3, {
|
|
|
336
341
|
catalogToWire: () => catalogToWire,
|
|
337
342
|
changeAnchorWithin: () => changeAnchorWithin,
|
|
338
343
|
checkoutHandoffReasonFor: () => checkoutHandoffReasonFor,
|
|
344
|
+
chipsFromShowSignal: () => chipsFromShowSignal,
|
|
339
345
|
claimExclusiveOverlay: () => claimExclusiveOverlay,
|
|
340
346
|
classifyComparisonValue: () => classifyComparisonValue,
|
|
341
347
|
classifyItemChange: () => classifyItemChange,
|
|
@@ -411,6 +417,8 @@ __export(src_exports3, {
|
|
|
411
417
|
hostPlace: () => hostPlace,
|
|
412
418
|
hostingAllows: () => hostingAllows,
|
|
413
419
|
injectGoogleFonts: () => injectGoogleFonts,
|
|
420
|
+
installmentOffer: () => installmentOffer,
|
|
421
|
+
installmentPayment: () => installmentPayment,
|
|
414
422
|
isActiveDirective: () => isActiveDirective,
|
|
415
423
|
isAllowedAttachmentType: () => isAllowedAttachmentType,
|
|
416
424
|
isDegenerateLayout: () => isDegenerateLayout,
|
|
@@ -561,6 +569,7 @@ __export(src_exports3, {
|
|
|
561
569
|
surfaceEmits: () => surfaceEmits,
|
|
562
570
|
surfaceSuppressionReason: () => surfaceSuppressionReason,
|
|
563
571
|
takeQueuedDiscountCodes: () => takeQueuedDiscountCodes,
|
|
572
|
+
takeSubmitOrigin: () => takeSubmitOrigin,
|
|
564
573
|
text: () => text,
|
|
565
574
|
textDirectionOf: () => textDirectionOf,
|
|
566
575
|
threadRowAttrs: () => threadRowAttrs,
|
|
@@ -582,10 +591,13 @@ __export(src_exports3, {
|
|
|
582
591
|
useAgentPresenceFrame: () => useAgentPresenceFrame,
|
|
583
592
|
useAgentPresenceFresh: () => useAgentPresenceFresh,
|
|
584
593
|
useAnalyticsSink: () => useAnalyticsSink,
|
|
594
|
+
useBotCheckNotice: () => useBotCheckNotice,
|
|
585
595
|
useCanvasActions: () => useCanvasActions,
|
|
586
596
|
useCanvasArrangement: () => useCanvasArrangement,
|
|
587
597
|
useCanvasBack: () => useCanvasBack,
|
|
588
598
|
useCanvasForward: () => useCanvasForward,
|
|
599
|
+
useCanvasLead: () => useCanvasLead,
|
|
600
|
+
useCanvasLeadTarget: () => useCanvasLeadTarget,
|
|
589
601
|
useCanvasMotionStyle: () => useCanvasMotionStyle,
|
|
590
602
|
useCanvasTail: () => useCanvasTail,
|
|
591
603
|
useCanvasViewBack: () => useCanvasViewBack,
|
|
@@ -647,6 +659,7 @@ __export(src_exports3, {
|
|
|
647
659
|
useHydrationState: () => useHydrationState,
|
|
648
660
|
useHydrators: () => useHydrators,
|
|
649
661
|
useInlineCompletion: () => useInlineCompletion,
|
|
662
|
+
useInstallmentOffer: () => useInstallmentOffer,
|
|
650
663
|
useInteraction: () => useInteraction,
|
|
651
664
|
useInteractionTracking: () => useInteraction2,
|
|
652
665
|
useInterval: () => useInterval,
|
|
@@ -721,6 +734,7 @@ __export(src_exports3, {
|
|
|
721
734
|
useVisibleFactList: () => useVisibleFactList,
|
|
722
735
|
useVisitorName: () => useVisitorName,
|
|
723
736
|
useVoiceCapture: () => useVoiceCapture,
|
|
737
|
+
useWaitingSubmitOrigin: () => useWaitingSubmitOrigin,
|
|
724
738
|
useWakeLock: () => useWakeLock,
|
|
725
739
|
useWishlist: () => useWishlist,
|
|
726
740
|
useWishlistDrawer: () => useWishlistDrawer,
|
|
@@ -733,7 +747,8 @@ __export(src_exports3, {
|
|
|
733
747
|
withCartActorOrigin: () => withCartActorOrigin,
|
|
734
748
|
withInteractionTracking: () => withInteractionTracking,
|
|
735
749
|
withQueuedDiscountCodes: () => withQueuedDiscountCodes,
|
|
736
|
-
withSignalTurn: () => withSignalTurn
|
|
750
|
+
withSignalTurn: () => withSignalTurn,
|
|
751
|
+
withoutClosingQuestion: () => withoutClosingQuestion
|
|
737
752
|
});
|
|
738
753
|
|
|
739
754
|
// src/analytics/index.ts
|
|
@@ -1523,6 +1538,7 @@ __export(src_exports, {
|
|
|
1523
1538
|
BRAND_MARK_MAX_BYTES: () => BRAND_MARK_MAX_BYTES,
|
|
1524
1539
|
BRAND_MARK_SLOTS: () => BRAND_MARK_SLOTS,
|
|
1525
1540
|
BRAND_MARK_TYPES: () => BRAND_MARK_TYPES,
|
|
1541
|
+
BotCheckNoticeSchema: () => BotCheckNoticeSchema,
|
|
1526
1542
|
BrandMarkImageSchema: () => BrandMarkImageSchema,
|
|
1527
1543
|
BrandMarkSchema: () => BrandMarkSchema,
|
|
1528
1544
|
BugLocationSchema: () => BugLocationSchema,
|
|
@@ -1536,6 +1552,7 @@ __export(src_exports, {
|
|
|
1536
1552
|
CART_REMOVE_SIGNAL: () => CART_REMOVE_SIGNAL,
|
|
1537
1553
|
CART_SET_QUANTITY_SIGNAL: () => CART_SET_QUANTITY_SIGNAL,
|
|
1538
1554
|
CHECKOUT_BEGIN_SIGNAL: () => CHECKOUT_BEGIN_SIGNAL,
|
|
1555
|
+
CHIP_SHOW_SIGNAL: () => CHIP_SHOW_SIGNAL,
|
|
1539
1556
|
CLICK_ID_KINDS: () => CLICK_ID_KINDS,
|
|
1540
1557
|
CLIENT_STATE_HELLO_SIGNAL: () => CLIENT_STATE_HELLO_SIGNAL,
|
|
1541
1558
|
COMPONENT_SOURCE: () => COMPONENT_SOURCE,
|
|
@@ -1699,6 +1716,7 @@ __export(src_exports, {
|
|
|
1699
1716
|
carriesShapeToken: () => carriesShapeToken,
|
|
1700
1717
|
catalogFromWire: () => catalogFromWire,
|
|
1701
1718
|
catalogToWire: () => catalogToWire,
|
|
1719
|
+
chipsFromShowSignal: () => chipsFromShowSignal,
|
|
1702
1720
|
collectElementEntityRefs: () => collectElementEntityRefs,
|
|
1703
1721
|
collectPlacedEntityRefs: () => collectPlacedEntityRefs,
|
|
1704
1722
|
compareSdkVersions: () => compareSdkVersions,
|
|
@@ -2343,6 +2361,24 @@ function withCartActorOrigin(signalType, payload, origin) {
|
|
|
2343
2361
|
return { ...payload, origin };
|
|
2344
2362
|
}
|
|
2345
2363
|
|
|
2364
|
+
// ../spacestation/src/signal/chip-show.ts
|
|
2365
|
+
var CHIP_SHOW_SIGNAL = "chip.show";
|
|
2366
|
+
function chipsFromShowSignal(signal) {
|
|
2367
|
+
if (signal.type !== CHIP_SHOW_SIGNAL) return null;
|
|
2368
|
+
const actions = Array.isArray(signal.payload.chips) ? signal.payload.chips.map(
|
|
2369
|
+
(chip, index) => typeof chip === "object" && chip !== null && !Array.isArray(chip) && !("id" in chip) ? { ...chip, id: `chip-${String(index)}` } : chip
|
|
2370
|
+
) : signal.payload.chips;
|
|
2371
|
+
const parsed = SuggestionActionsSchema.safeParse({
|
|
2372
|
+
type: "suggestion_cards",
|
|
2373
|
+
actions
|
|
2374
|
+
});
|
|
2375
|
+
if (!parsed.success) {
|
|
2376
|
+
console.warn("[chip-show] payload failed validation:", parsed.error);
|
|
2377
|
+
return null;
|
|
2378
|
+
}
|
|
2379
|
+
return parsed.data.actions;
|
|
2380
|
+
}
|
|
2381
|
+
|
|
2346
2382
|
// ../spacestation/src/signal/turn-ask.ts
|
|
2347
2383
|
import { z as z14 } from "zod";
|
|
2348
2384
|
var TURN_ASK_SIGNAL = "turn.ask";
|
|
@@ -4124,8 +4160,15 @@ var UpdateAgentDirectiveInputSchema = z38.object({
|
|
|
4124
4160
|
}).strict();
|
|
4125
4161
|
var ReorderAgentDirectivesInputSchema = z38.object({ ids: z38.array(z38.string()).min(1) }).strict();
|
|
4126
4162
|
|
|
4127
|
-
// ../spacestation/src/
|
|
4163
|
+
// ../spacestation/src/shell/bot-check-notice.ts
|
|
4128
4164
|
import { z as z39 } from "zod";
|
|
4165
|
+
var BotCheckNoticeSchema = z39.object({
|
|
4166
|
+
/** Read in order: plain text, and links the notice must keep linked. */
|
|
4167
|
+
segments: z39.array(z39.union([z39.string(), z39.object({ text: z39.string(), href: z39.string().url() })])).min(1)
|
|
4168
|
+
});
|
|
4169
|
+
|
|
4170
|
+
// ../spacestation/src/space/space-locale.ts
|
|
4171
|
+
import { z as z40 } from "zod";
|
|
4129
4172
|
var DEFAULT_SPACE_LOCALE = "en-US";
|
|
4130
4173
|
function isBcp47(tag) {
|
|
4131
4174
|
try {
|
|
@@ -4135,7 +4178,7 @@ function isBcp47(tag) {
|
|
|
4135
4178
|
throw err;
|
|
4136
4179
|
}
|
|
4137
4180
|
}
|
|
4138
|
-
var SpaceLocaleSchema =
|
|
4181
|
+
var SpaceLocaleSchema = z40.string().refine(isBcp47, { message: "locale must be a BCP 47 language tag, e.g. he-IL" });
|
|
4139
4182
|
var RTL_SCRIPTS = /* @__PURE__ */ new Set(["Arab", "Hebr", "Thaa", "Syrc", "Nkoo", "Adlm", "Rohg", "Mand", "Samr"]);
|
|
4140
4183
|
var RTL_LANGUAGES = /* @__PURE__ */ new Set(["ar", "he", "iw", "fa", "ur", "ps", "sd", "ug", "yi", "dv", "ckb", "syr"]);
|
|
4141
4184
|
function textDirectionOf(locale) {
|
|
@@ -4225,30 +4268,30 @@ function hostingAllows(hosting, surface) {
|
|
|
4225
4268
|
}
|
|
4226
4269
|
|
|
4227
4270
|
// ../spacestation/src/space/trace.ts
|
|
4228
|
-
import { z as
|
|
4229
|
-
var RunTokenUsageSchema =
|
|
4230
|
-
input_tokens:
|
|
4231
|
-
output_tokens:
|
|
4232
|
-
cache_read_tokens:
|
|
4271
|
+
import { z as z41 } from "zod";
|
|
4272
|
+
var RunTokenUsageSchema = z41.object({
|
|
4273
|
+
input_tokens: z41.number().optional(),
|
|
4274
|
+
output_tokens: z41.number().optional(),
|
|
4275
|
+
cache_read_tokens: z41.number().optional()
|
|
4233
4276
|
});
|
|
4234
|
-
var TraceRecordSchema =
|
|
4235
|
-
id:
|
|
4236
|
-
spaceId:
|
|
4237
|
-
sessionId:
|
|
4277
|
+
var TraceRecordSchema = z41.object({
|
|
4278
|
+
id: z41.string().uuid(),
|
|
4279
|
+
spaceId: z41.string().uuid().nullable(),
|
|
4280
|
+
sessionId: z41.string(),
|
|
4238
4281
|
/** OTP-verified visitor email the session was unlocked with, or `null`
|
|
4239
4282
|
* for an unlocked space / anonymous unlock. */
|
|
4240
|
-
visitorEmail:
|
|
4241
|
-
userPrompt:
|
|
4242
|
-
branch:
|
|
4243
|
-
responseText:
|
|
4244
|
-
layout:
|
|
4245
|
-
phaseTimings:
|
|
4246
|
-
tokensByModel:
|
|
4247
|
-
toolCalls:
|
|
4248
|
-
diagnostics:
|
|
4249
|
-
latencyFirstText:
|
|
4250
|
-
latencyFirstPatch:
|
|
4251
|
-
latencyTotal:
|
|
4283
|
+
visitorEmail: z41.string().nullable(),
|
|
4284
|
+
userPrompt: z41.string(),
|
|
4285
|
+
branch: z41.string().nullable(),
|
|
4286
|
+
responseText: z41.string().nullable(),
|
|
4287
|
+
layout: z41.unknown().nullable(),
|
|
4288
|
+
phaseTimings: z41.record(z41.number()).nullable(),
|
|
4289
|
+
tokensByModel: z41.record(RunTokenUsageSchema).nullable(),
|
|
4290
|
+
toolCalls: z41.array(z41.unknown()).nullable(),
|
|
4291
|
+
diagnostics: z41.array(z41.unknown()).nullable(),
|
|
4292
|
+
latencyFirstText: z41.number().int().nullable(),
|
|
4293
|
+
latencyFirstPatch: z41.number().int().nullable(),
|
|
4294
|
+
latencyTotal: z41.number().int().nullable(),
|
|
4252
4295
|
/**
|
|
4253
4296
|
* The CLIENT's turn id for this run, or `null`.
|
|
4254
4297
|
*
|
|
@@ -4264,29 +4307,29 @@ var TraceRecordSchema = z40.object({
|
|
|
4264
4307
|
* a turn whose ack the client never saw — none of which is evidence that a
|
|
4265
4308
|
* visitor asked something and got nothing.
|
|
4266
4309
|
*/
|
|
4267
|
-
turnId:
|
|
4310
|
+
turnId: z41.string().nullable(),
|
|
4268
4311
|
/** Serialized `TraceTracker.exportState()` payload (parsed object) —
|
|
4269
4312
|
* lets the inspector rehydrate this run verbatim after a reload. */
|
|
4270
|
-
trackerState:
|
|
4271
|
-
createdAt:
|
|
4313
|
+
trackerState: z41.unknown().nullable(),
|
|
4314
|
+
createdAt: z41.string()
|
|
4272
4315
|
});
|
|
4273
|
-
var MillisecondsSchema =
|
|
4274
|
-
var CreateTraceInputSchema =
|
|
4275
|
-
spaceId:
|
|
4276
|
-
sessionId:
|
|
4277
|
-
visitorEmail:
|
|
4278
|
-
userPrompt:
|
|
4279
|
-
branch:
|
|
4280
|
-
responseText:
|
|
4281
|
-
layout:
|
|
4282
|
-
phaseTimings:
|
|
4283
|
-
tokensByModel:
|
|
4284
|
-
toolCalls:
|
|
4285
|
-
diagnostics:
|
|
4316
|
+
var MillisecondsSchema = z41.number().nullable().transform((v) => v === null ? null : Math.round(v));
|
|
4317
|
+
var CreateTraceInputSchema = z41.object({
|
|
4318
|
+
spaceId: z41.string().uuid().nullable(),
|
|
4319
|
+
sessionId: z41.string(),
|
|
4320
|
+
visitorEmail: z41.string().nullable(),
|
|
4321
|
+
userPrompt: z41.string(),
|
|
4322
|
+
branch: z41.string().nullable(),
|
|
4323
|
+
responseText: z41.string().nullable(),
|
|
4324
|
+
layout: z41.unknown().nullable(),
|
|
4325
|
+
phaseTimings: z41.record(z41.number()).nullable(),
|
|
4326
|
+
tokensByModel: z41.record(RunTokenUsageSchema).nullable(),
|
|
4327
|
+
toolCalls: z41.array(z41.unknown()).nullable(),
|
|
4328
|
+
diagnostics: z41.array(z41.unknown()).nullable(),
|
|
4286
4329
|
latencyFirstText: MillisecondsSchema,
|
|
4287
4330
|
latencyFirstPatch: MillisecondsSchema,
|
|
4288
4331
|
latencyTotal: MillisecondsSchema,
|
|
4289
|
-
trackerState:
|
|
4332
|
+
trackerState: z41.unknown().nullable(),
|
|
4290
4333
|
/**
|
|
4291
4334
|
* The CLIENT's turn id for this run, or `null`.
|
|
4292
4335
|
*
|
|
@@ -4302,37 +4345,37 @@ var CreateTraceInputSchema = z40.object({
|
|
|
4302
4345
|
* a turn whose ack the client never saw — none of which is evidence that a
|
|
4303
4346
|
* visitor asked something and got nothing.
|
|
4304
4347
|
*/
|
|
4305
|
-
turnId:
|
|
4348
|
+
turnId: z41.string().nullable()
|
|
4306
4349
|
});
|
|
4307
|
-
var AgentSessionSummarySchema =
|
|
4308
|
-
sessionId:
|
|
4350
|
+
var AgentSessionSummarySchema = z41.object({
|
|
4351
|
+
sessionId: z41.string(),
|
|
4309
4352
|
/** Turn rows only; background/secondary runs are excluded by the aggregate. */
|
|
4310
|
-
turnCount:
|
|
4353
|
+
turnCount: z41.number().int(),
|
|
4311
4354
|
/** The session's opening prompt — titles the row in the UI. */
|
|
4312
|
-
firstPrompt:
|
|
4313
|
-
startedAt:
|
|
4314
|
-
lastRunAt:
|
|
4355
|
+
firstPrompt: z41.string(),
|
|
4356
|
+
startedAt: z41.string(),
|
|
4357
|
+
lastRunAt: z41.string(),
|
|
4315
4358
|
/** Summed `latency_total` across the session's turns. */
|
|
4316
|
-
totalLatencyMs:
|
|
4359
|
+
totalLatencyMs: z41.number().int()
|
|
4317
4360
|
});
|
|
4318
|
-
var SessionTurnSchema =
|
|
4319
|
-
id:
|
|
4320
|
-
userPrompt:
|
|
4321
|
-
responseText:
|
|
4361
|
+
var SessionTurnSchema = z41.object({
|
|
4362
|
+
id: z41.string().uuid(),
|
|
4363
|
+
userPrompt: z41.string(),
|
|
4364
|
+
responseText: z41.string().nullable(),
|
|
4322
4365
|
/** Full cumulative Spec committed by this turn — never a patch delta. */
|
|
4323
|
-
layout:
|
|
4324
|
-
createdAt:
|
|
4325
|
-
latencyTotal:
|
|
4326
|
-
phaseTimings:
|
|
4327
|
-
tokensByModel:
|
|
4328
|
-
input_tokens:
|
|
4329
|
-
output_tokens:
|
|
4366
|
+
layout: z41.unknown().nullable(),
|
|
4367
|
+
createdAt: z41.string(),
|
|
4368
|
+
latencyTotal: z41.number().int().nullable(),
|
|
4369
|
+
phaseTimings: z41.record(z41.number()).nullable(),
|
|
4370
|
+
tokensByModel: z41.record(z41.object({
|
|
4371
|
+
input_tokens: z41.number().optional(),
|
|
4372
|
+
output_tokens: z41.number().optional()
|
|
4330
4373
|
})).nullable(),
|
|
4331
|
-
toolCalls:
|
|
4332
|
-
diagnostics:
|
|
4374
|
+
toolCalls: z41.array(z41.unknown()).nullable(),
|
|
4375
|
+
diagnostics: z41.array(z41.unknown()).nullable()
|
|
4333
4376
|
});
|
|
4334
|
-
var SessionReplaySchema =
|
|
4335
|
-
turns:
|
|
4377
|
+
var SessionReplaySchema = z41.object({
|
|
4378
|
+
turns: z41.array(SessionTurnSchema),
|
|
4336
4379
|
/**
|
|
4337
4380
|
* The session's own last-committed layout, read straight off the durable
|
|
4338
4381
|
* session record (`sessions.blob.layout`) rather than derived from `turns`.
|
|
@@ -4343,20 +4386,20 @@ var SessionReplaySchema = z40.object({
|
|
|
4343
4386
|
* a perfectly real layout; only this field can show it. Null exclusively
|
|
4344
4387
|
* when the durable session row itself could not be read.
|
|
4345
4388
|
*/
|
|
4346
|
-
sessionLayout:
|
|
4389
|
+
sessionLayout: z41.record(z41.string(), z41.unknown()).nullable()
|
|
4347
4390
|
});
|
|
4348
|
-
var SessionTraceSchema =
|
|
4349
|
-
trackerState:
|
|
4391
|
+
var SessionTraceSchema = z41.object({
|
|
4392
|
+
trackerState: z41.string().nullable()
|
|
4350
4393
|
});
|
|
4351
|
-
var LlmUsageDailySchema =
|
|
4352
|
-
day:
|
|
4394
|
+
var LlmUsageDailySchema = z41.object({
|
|
4395
|
+
day: z41.string(),
|
|
4353
4396
|
/** Deployment that made the call — 'production', 'staging', 'pr-123', 'development'. */
|
|
4354
|
-
environment:
|
|
4355
|
-
feature:
|
|
4356
|
-
model:
|
|
4357
|
-
provider:
|
|
4397
|
+
environment: z41.string(),
|
|
4398
|
+
feature: z41.string(),
|
|
4399
|
+
model: z41.string(),
|
|
4400
|
+
provider: z41.string(),
|
|
4358
4401
|
/** Masked tail of the key actually billed, or null when unknown/non-Google. */
|
|
4359
|
-
keyFingerprint:
|
|
4402
|
+
keyFingerprint: z41.string().nullable(),
|
|
4360
4403
|
/**
|
|
4361
4404
|
* The space the call served, or null when it served none.
|
|
4362
4405
|
*
|
|
@@ -4365,91 +4408,91 @@ var LlmUsageDailySchema = z40.object({
|
|
|
4365
4408
|
* report that share rather than dropping it, or a per-space total reads as
|
|
4366
4409
|
* the platform total.
|
|
4367
4410
|
*/
|
|
4368
|
-
spaceId:
|
|
4411
|
+
spaceId: z41.string().nullable(),
|
|
4369
4412
|
/**
|
|
4370
4413
|
* The surface of the session the call served (`sessions.surface`), or null
|
|
4371
4414
|
* when it served no session or the session predates surface recording.
|
|
4372
4415
|
* `automation` is the eval harness — the signal that files an ordinary
|
|
4373
4416
|
* `agent-turn` as testing spend rather than as a visitor's.
|
|
4374
4417
|
*/
|
|
4375
|
-
surface:
|
|
4376
|
-
inputTokens:
|
|
4377
|
-
outputTokens:
|
|
4418
|
+
surface: z41.string().nullable(),
|
|
4419
|
+
inputTokens: z41.number(),
|
|
4420
|
+
outputTokens: z41.number(),
|
|
4378
4421
|
/** Subset of inputTokens, never additional to it. */
|
|
4379
|
-
cachedInputTokens:
|
|
4380
|
-
reasoningTokens:
|
|
4381
|
-
callCount:
|
|
4382
|
-
errorCount:
|
|
4383
|
-
estimatedCostUsd:
|
|
4422
|
+
cachedInputTokens: z41.number(),
|
|
4423
|
+
reasoningTokens: z41.number(),
|
|
4424
|
+
callCount: z41.number(),
|
|
4425
|
+
errorCount: z41.number(),
|
|
4426
|
+
estimatedCostUsd: z41.number().nullable()
|
|
4384
4427
|
});
|
|
4385
|
-
var LlmUsageBySessionSchema =
|
|
4386
|
-
sessionId:
|
|
4387
|
-
environment:
|
|
4388
|
-
model:
|
|
4428
|
+
var LlmUsageBySessionSchema = z41.object({
|
|
4429
|
+
sessionId: z41.string(),
|
|
4430
|
+
environment: z41.string(),
|
|
4431
|
+
model: z41.string(),
|
|
4389
4432
|
/** The space this session belongs to, or null for a session with no space. */
|
|
4390
|
-
spaceId:
|
|
4433
|
+
spaceId: z41.string().nullable(),
|
|
4391
4434
|
/** The session's surface — see `LlmUsageDailySchema.surface`. */
|
|
4392
|
-
surface:
|
|
4435
|
+
surface: z41.string().nullable(),
|
|
4393
4436
|
/** Label only — the first feature seen in the session. */
|
|
4394
|
-
firstFeature:
|
|
4395
|
-
startedAt:
|
|
4396
|
-
endedAt:
|
|
4397
|
-
inputTokens:
|
|
4398
|
-
outputTokens:
|
|
4399
|
-
cachedInputTokens:
|
|
4400
|
-
reasoningTokens:
|
|
4401
|
-
callCount:
|
|
4402
|
-
errorCount:
|
|
4437
|
+
firstFeature: z41.string(),
|
|
4438
|
+
startedAt: z41.string(),
|
|
4439
|
+
endedAt: z41.string(),
|
|
4440
|
+
inputTokens: z41.number(),
|
|
4441
|
+
outputTokens: z41.number(),
|
|
4442
|
+
cachedInputTokens: z41.number(),
|
|
4443
|
+
reasoningTokens: z41.number(),
|
|
4444
|
+
callCount: z41.number(),
|
|
4445
|
+
errorCount: z41.number(),
|
|
4403
4446
|
/** Priced server-side, like the daily rollup — the browser never carries a
|
|
4404
4447
|
* rate table, so there is exactly one place a price can be wrong. Null when
|
|
4405
4448
|
* the model is unpriced; never 0, which would read as free. */
|
|
4406
|
-
estimatedCostUsd:
|
|
4449
|
+
estimatedCostUsd: z41.number().nullable()
|
|
4407
4450
|
});
|
|
4408
|
-
var LlmSessionsDailySchema =
|
|
4409
|
-
day:
|
|
4410
|
-
environment:
|
|
4411
|
-
sessionCount:
|
|
4451
|
+
var LlmSessionsDailySchema = z41.object({
|
|
4452
|
+
day: z41.string(),
|
|
4453
|
+
environment: z41.string(),
|
|
4454
|
+
sessionCount: z41.number()
|
|
4412
4455
|
});
|
|
4413
4456
|
|
|
4414
4457
|
// ../spacestation/src/space/session-queue.ts
|
|
4415
|
-
import { z as
|
|
4458
|
+
import { z as z43 } from "zod";
|
|
4416
4459
|
|
|
4417
4460
|
// ../spacestation/src/space/session-activity.ts
|
|
4418
|
-
import { z as
|
|
4419
|
-
var SessionActivityEventSchema =
|
|
4420
|
-
id:
|
|
4421
|
-
kind:
|
|
4422
|
-
occurredAt:
|
|
4423
|
-
source:
|
|
4424
|
-
surface:
|
|
4425
|
-
payload:
|
|
4461
|
+
import { z as z42 } from "zod";
|
|
4462
|
+
var SessionActivityEventSchema = z42.object({
|
|
4463
|
+
id: z42.string(),
|
|
4464
|
+
kind: z42.string(),
|
|
4465
|
+
occurredAt: z42.string(),
|
|
4466
|
+
source: z42.string(),
|
|
4467
|
+
surface: z42.string(),
|
|
4468
|
+
payload: z42.record(z42.unknown())
|
|
4426
4469
|
});
|
|
4427
|
-
var SessionActivitySchema =
|
|
4428
|
-
events:
|
|
4429
|
-
hasMore:
|
|
4470
|
+
var SessionActivitySchema = z42.object({
|
|
4471
|
+
events: z42.array(SessionActivityEventSchema),
|
|
4472
|
+
hasMore: z42.boolean()
|
|
4430
4473
|
});
|
|
4431
4474
|
|
|
4432
4475
|
// ../spacestation/src/space/session-queue.ts
|
|
4433
|
-
var SessionVerdictSchema =
|
|
4434
|
-
var RecordableVerdictSchema =
|
|
4435
|
-
var SessionReviewEventSchema =
|
|
4436
|
-
id:
|
|
4476
|
+
var SessionVerdictSchema = z43.enum(["unreviewed", "viewed", "bug"]);
|
|
4477
|
+
var RecordableVerdictSchema = z43.enum(["viewed", "bug"]);
|
|
4478
|
+
var SessionReviewEventSchema = z43.object({
|
|
4479
|
+
id: z43.string().uuid(),
|
|
4437
4480
|
verdict: RecordableVerdictSchema,
|
|
4438
4481
|
/** Account email of the operator who judged it. Attribution is the reason the
|
|
4439
4482
|
* log is append-only rather than a mutable current-state row. */
|
|
4440
|
-
reviewer:
|
|
4441
|
-
note:
|
|
4442
|
-
createdAt:
|
|
4483
|
+
reviewer: z43.string(),
|
|
4484
|
+
note: z43.string().nullable(),
|
|
4485
|
+
createdAt: z43.string()
|
|
4443
4486
|
});
|
|
4444
|
-
var BugSeveritySchema =
|
|
4445
|
-
var BugLocationSchema =
|
|
4446
|
-
elementId:
|
|
4487
|
+
var BugSeveritySchema = z43.enum(["high", "medium", "low"]);
|
|
4488
|
+
var BugLocationSchema = z43.object({
|
|
4489
|
+
elementId: z43.string().nullable(),
|
|
4447
4490
|
/** Display only — the catalog component type, e.g. "productGrid". Null
|
|
4448
4491
|
* alongside a null `elementId`. */
|
|
4449
|
-
elementType:
|
|
4492
|
+
elementType: z43.string().nullable(),
|
|
4450
4493
|
/** Fraction of the ELEMENT's own box. Null for a page anchor. */
|
|
4451
|
-
offsetXPct:
|
|
4452
|
-
offsetYPct:
|
|
4494
|
+
offsetXPct: z43.number().min(0).max(100).nullable(),
|
|
4495
|
+
offsetYPct: z43.number().min(0).max(100).nullable(),
|
|
4453
4496
|
/**
|
|
4454
4497
|
* ABSOLUTE document pixels, for a pin with no element under it. Null for an
|
|
4455
4498
|
* element anchor.
|
|
@@ -4460,8 +4503,8 @@ var BugLocationSchema = z42.object({
|
|
|
4460
4503
|
* on the page with it. Measured before this was fixed: growing the page 9%
|
|
4461
4504
|
* slid a pin 32px, so a pin ran away from the cursor reaching for it.
|
|
4462
4505
|
*/
|
|
4463
|
-
pageX:
|
|
4464
|
-
pageY:
|
|
4506
|
+
pageX: z43.number().nullable(),
|
|
4507
|
+
pageY: z43.number().nullable()
|
|
4465
4508
|
}).refine(
|
|
4466
4509
|
(loc) => {
|
|
4467
4510
|
const hasOffsets = loc.offsetXPct !== null && loc.offsetYPct !== null;
|
|
@@ -4475,24 +4518,24 @@ var BugLocationSchema = z42.object({
|
|
|
4475
4518
|
message: "location must be one complete anchor: an element (elementId + elementType + both offsets), a page position (pageX + pageY), or a legacy page fraction (both offsets)"
|
|
4476
4519
|
}
|
|
4477
4520
|
);
|
|
4478
|
-
var SessionBugSchema =
|
|
4479
|
-
id:
|
|
4521
|
+
var SessionBugSchema = z43.object({
|
|
4522
|
+
id: z43.string().uuid(),
|
|
4480
4523
|
/** 1-based turn the fault was observed on; null when the fault is session-wide. */
|
|
4481
|
-
turnIndex:
|
|
4524
|
+
turnIndex: z43.number().int().nullable(),
|
|
4482
4525
|
/** Where on that turn's canvas the pin was dropped; null for a bug filed
|
|
4483
4526
|
* without pinning a spot. */
|
|
4484
4527
|
location: BugLocationSchema.nullable(),
|
|
4485
|
-
provider:
|
|
4486
|
-
issueKey:
|
|
4487
|
-
issueUrl:
|
|
4528
|
+
provider: z43.string(),
|
|
4529
|
+
issueKey: z43.string().nullable(),
|
|
4530
|
+
issueUrl: z43.string().nullable(),
|
|
4488
4531
|
/** The tracker's own state word ('Todo', 'Done', …) — their vocabulary, so
|
|
4489
4532
|
* open text. Null until first synced. */
|
|
4490
|
-
issueState:
|
|
4491
|
-
title:
|
|
4492
|
-
body:
|
|
4533
|
+
issueState: z43.string().nullable(),
|
|
4534
|
+
title: z43.string(),
|
|
4535
|
+
body: z43.string(),
|
|
4493
4536
|
severity: BugSeveritySchema,
|
|
4494
|
-
createdBy:
|
|
4495
|
-
createdAt:
|
|
4537
|
+
createdBy: z43.string(),
|
|
4538
|
+
createdAt: z43.string(),
|
|
4496
4539
|
/**
|
|
4497
4540
|
* When this bug was resolved from the console; null means still OPEN.
|
|
4498
4541
|
*
|
|
@@ -4501,60 +4544,60 @@ var SessionBugSchema = z42.object({
|
|
|
4501
4544
|
* whether a particular fault is still live. The timestamp IS the state, so
|
|
4502
4545
|
* no boolean can contradict it.
|
|
4503
4546
|
*/
|
|
4504
|
-
resolvedAt:
|
|
4505
|
-
resolvedBy:
|
|
4547
|
+
resolvedAt: z43.string().nullable(),
|
|
4548
|
+
resolvedBy: z43.string().nullable()
|
|
4506
4549
|
});
|
|
4507
|
-
var SpaceBugSchema = SessionBugSchema.extend({ sessionId:
|
|
4508
|
-
var SessionCommentSchema =
|
|
4509
|
-
id:
|
|
4550
|
+
var SpaceBugSchema = SessionBugSchema.extend({ sessionId: z43.string() });
|
|
4551
|
+
var SessionCommentSchema = z43.object({
|
|
4552
|
+
id: z43.string().uuid(),
|
|
4510
4553
|
/** Set = a reply in that bug's thread. Null = a standalone comment pin. */
|
|
4511
|
-
bugId:
|
|
4554
|
+
bugId: z43.string().uuid().nullable(),
|
|
4512
4555
|
/** 1-based turn the comment was left on; null for a reply (it reads its
|
|
4513
4556
|
* parent bug's turn). */
|
|
4514
|
-
turnIndex:
|
|
4557
|
+
turnIndex: z43.number().int().nullable(),
|
|
4515
4558
|
/** The canvas anchor for a STANDALONE comment's own pin; null for a reply. */
|
|
4516
4559
|
location: BugLocationSchema.nullable(),
|
|
4517
|
-
body:
|
|
4518
|
-
createdBy:
|
|
4519
|
-
createdAt:
|
|
4560
|
+
body: z43.string(),
|
|
4561
|
+
createdBy: z43.string(),
|
|
4562
|
+
createdAt: z43.string()
|
|
4520
4563
|
});
|
|
4521
|
-
var CreateCommentInputSchema =
|
|
4522
|
-
bugId:
|
|
4523
|
-
turnIndex:
|
|
4564
|
+
var CreateCommentInputSchema = z43.object({
|
|
4565
|
+
bugId: z43.string().uuid().nullable(),
|
|
4566
|
+
turnIndex: z43.number().int().positive().nullable(),
|
|
4524
4567
|
location: BugLocationSchema.nullable(),
|
|
4525
4568
|
// Trimmed, so whitespace is not content: `.min(1)` alone accepted a comment
|
|
4526
4569
|
// of three spaces, which renders as an empty bubble nobody can interpret.
|
|
4527
|
-
body:
|
|
4570
|
+
body: z43.string().trim().min(1)
|
|
4528
4571
|
}).refine((input) => input.bugId === null !== (input.location === null), {
|
|
4529
4572
|
message: "a comment is either a reply (bugId, no location) or a standalone pin (location, no bugId)"
|
|
4530
4573
|
});
|
|
4531
|
-
var UpdateCommentInputSchema =
|
|
4532
|
-
body:
|
|
4533
|
-
bugId:
|
|
4574
|
+
var UpdateCommentInputSchema = z43.object({
|
|
4575
|
+
body: z43.string().trim().min(1).optional(),
|
|
4576
|
+
bugId: z43.string().uuid().nullable().optional(),
|
|
4534
4577
|
location: BugLocationSchema.nullable().optional()
|
|
4535
4578
|
});
|
|
4536
4579
|
var MOBILE_VIEWPORT_MAX = 720;
|
|
4537
|
-
var SessionFormFactorSchema =
|
|
4580
|
+
var SessionFormFactorSchema = z43.enum(["mobile", "desktop"]).nullable();
|
|
4538
4581
|
function formFactorFromViewport(width) {
|
|
4539
4582
|
if (width === null) return null;
|
|
4540
4583
|
return width <= MOBILE_VIEWPORT_MAX ? "mobile" : "desktop";
|
|
4541
4584
|
}
|
|
4542
|
-
var SessionSummarySchema =
|
|
4543
|
-
sessionId:
|
|
4585
|
+
var SessionSummarySchema = z43.object({
|
|
4586
|
+
sessionId: z43.string(),
|
|
4544
4587
|
/** Stable per-browser id — the join key across a visitor's sessions. Null when
|
|
4545
4588
|
* the session row is gone (pruned) or predates the `sessions` table. */
|
|
4546
|
-
visitorId:
|
|
4589
|
+
visitorId: z43.string().nullable(),
|
|
4547
4590
|
/** Provider-qualified identity anchor, present only once the visitor
|
|
4548
4591
|
* identified themselves. Both null together means "not identified yet". */
|
|
4549
|
-
identityProvider:
|
|
4550
|
-
identityKey:
|
|
4592
|
+
identityProvider: z43.string().nullable(),
|
|
4593
|
+
identityKey: z43.string().nullable(),
|
|
4551
4594
|
/** Team/test traffic. The queue hides these by default. */
|
|
4552
|
-
isInternal:
|
|
4595
|
+
isInternal: z43.boolean(),
|
|
4553
4596
|
/** Build that served the session. Null = not captured; a version filter must
|
|
4554
4597
|
* therefore EXCLUDE it rather than let it match an arbitrary bucket. */
|
|
4555
|
-
clientVersion:
|
|
4598
|
+
clientVersion: z43.string().nullable(),
|
|
4556
4599
|
/** Commit-shaped interaction signals, counted, keyed by open `SignalType`. */
|
|
4557
|
-
signalCounts:
|
|
4600
|
+
signalCounts: z43.record(z43.number()),
|
|
4558
4601
|
/**
|
|
4559
4602
|
* Did this conversation ACQUIRE anything, and how many times?
|
|
4560
4603
|
*
|
|
@@ -4571,7 +4614,7 @@ var SessionSummarySchema = z42.object({
|
|
|
4571
4614
|
* predates the column — and renders as no mark at all. It never means zero:
|
|
4572
4615
|
* zero is a real, recorded answer and the rail reports it as one.
|
|
4573
4616
|
*/
|
|
4574
|
-
conversionAttempts:
|
|
4617
|
+
conversionAttempts: z43.number().int().nullable(),
|
|
4575
4618
|
/**
|
|
4576
4619
|
* The same attempts split by EVENT KIND, keyed by the kind's own name
|
|
4577
4620
|
* (`commerce.cart_line_added`, `commerce.registry_clicked`), counted distinct
|
|
@@ -4587,7 +4630,7 @@ var SessionSummarySchema = z42.object({
|
|
|
4587
4630
|
* kinds together, and one attempt id appearing under both would be counted
|
|
4588
4631
|
* once there and twice here.
|
|
4589
4632
|
*/
|
|
4590
|
-
conversionKinds:
|
|
4633
|
+
conversionKinds: z43.record(z43.number()),
|
|
4591
4634
|
/**
|
|
4592
4635
|
* Every analytics funnel step this session reached, in funnel order — the
|
|
4593
4636
|
* dashboard's own step ids, read by the same per-step predicates, so a queue
|
|
@@ -4595,20 +4638,20 @@ var SessionSummarySchema = z42.object({
|
|
|
4595
4638
|
* set of strings for the reason `conversionKinds` is: the contract does not
|
|
4596
4639
|
* learn what a step means. Empty only when read from a pre-column database.
|
|
4597
4640
|
*/
|
|
4598
|
-
funnelSteps:
|
|
4641
|
+
funnelSteps: z43.array(z43.string()),
|
|
4599
4642
|
/**
|
|
4600
4643
|
* The connector's opaque handle for what this session produced in its back
|
|
4601
4644
|
* office — present only once a checkout actually reached the platform. The
|
|
4602
4645
|
* console hands it to the back-office link registry; nothing else reads it.
|
|
4603
4646
|
*/
|
|
4604
|
-
backOfficeRef:
|
|
4647
|
+
backOfficeRef: z43.string().nullable(),
|
|
4605
4648
|
/**
|
|
4606
4649
|
* The order this session produced, when the connector's back office reported
|
|
4607
4650
|
* it (`session_orders`): its opaque id and the back office's own name for it.
|
|
4608
4651
|
* Both null when no order is known — the cart handle above is then the door.
|
|
4609
4652
|
*/
|
|
4610
|
-
orderRef:
|
|
4611
|
-
orderLabel:
|
|
4653
|
+
orderRef: z43.string().nullable(),
|
|
4654
|
+
orderLabel: z43.string().nullable(),
|
|
4612
4655
|
/**
|
|
4613
4656
|
* Which shell this session rendered — the one thing about the CAPTURE a list
|
|
4614
4657
|
* needs.
|
|
@@ -4621,12 +4664,12 @@ var SessionSummarySchema = z42.object({
|
|
|
4621
4664
|
* on a desktop are not the same session.
|
|
4622
4665
|
*/
|
|
4623
4666
|
formFactor: SessionFormFactorSchema,
|
|
4624
|
-
turnCount:
|
|
4667
|
+
turnCount: z43.number().int(),
|
|
4625
4668
|
/** The visitor's opening message — the single most informative field for
|
|
4626
4669
|
* deciding whether a session is worth opening, hence the widest column. */
|
|
4627
|
-
firstPrompt:
|
|
4628
|
-
startedAt:
|
|
4629
|
-
lastRunAt:
|
|
4670
|
+
firstPrompt: z43.string(),
|
|
4671
|
+
startedAt: z43.string(),
|
|
4672
|
+
lastRunAt: z43.string(),
|
|
4630
4673
|
/**
|
|
4631
4674
|
* The VISITOR's own IANA zone (`America/New_York`), read from their browser
|
|
4632
4675
|
* at session create — what the two timestamps above should be read in.
|
|
@@ -4654,7 +4697,7 @@ var SessionSummarySchema = z42.object({
|
|
|
4654
4697
|
* Client-asserted and never validated against a zone table, so every consumer
|
|
4655
4698
|
* must tolerate an unknown name: `Intl` throws a RangeError on one.
|
|
4656
4699
|
*/
|
|
4657
|
-
visitorTimeZone:
|
|
4700
|
+
visitorTimeZone: z43.string().nullable(),
|
|
4658
4701
|
/**
|
|
4659
4702
|
* Mean TIME TO FIRST PATCH, over the turns that recorded one — the first
|
|
4660
4703
|
* layout op reaching the visitor, and THE latency the project is managed on.
|
|
@@ -4662,31 +4705,31 @@ var SessionSummarySchema = z42.object({
|
|
|
4662
4705
|
* `totalLatencyMs` carries the chip-gen tail that runs after the visitor is
|
|
4663
4706
|
* already reading. Null when no turn in the session recorded a patch.
|
|
4664
4707
|
*/
|
|
4665
|
-
avgTtftMs:
|
|
4708
|
+
avgTtftMs: z43.number().int().nullable(),
|
|
4666
4709
|
/** Mean `main_done_ms` — layout + prose complete. Context for the TTFT, not
|
|
4667
4710
|
* a budget: null on sessions older than the mark's recording. */
|
|
4668
|
-
avgMainDoneMs:
|
|
4711
|
+
avgMainDoneMs: z43.number().int().nullable(),
|
|
4669
4712
|
/** Mean `chip_gen_ms` — the pass that runs AFTER mainDone and is out of the
|
|
4670
4713
|
* budget. On the row only to explain the gap to `totalLatencyMs`. */
|
|
4671
|
-
avgChipGenMs:
|
|
4672
|
-
totalLatencyMs:
|
|
4673
|
-
durationMs:
|
|
4714
|
+
avgChipGenMs: z43.number().int().nullable(),
|
|
4715
|
+
totalLatencyMs: z43.number().int(),
|
|
4716
|
+
durationMs: z43.number().int(),
|
|
4674
4717
|
/** Inferred from recent activity — nothing writes a session-end marker. A
|
|
4675
4718
|
* live session streams and cannot be given a verdict until it ends. */
|
|
4676
|
-
isLive:
|
|
4719
|
+
isLive: z43.boolean(),
|
|
4677
4720
|
verdict: SessionVerdictSchema,
|
|
4678
|
-
reviewedBy:
|
|
4679
|
-
reviewedAt:
|
|
4721
|
+
reviewedBy: z43.string().nullable(),
|
|
4722
|
+
reviewedAt: z43.string().nullable(),
|
|
4680
4723
|
/** Latest filed bug, flattened onto the row so the queue can show its live
|
|
4681
4724
|
* state without a second request. */
|
|
4682
|
-
bugIssueKey:
|
|
4683
|
-
bugIssueUrl:
|
|
4684
|
-
bugIssueState:
|
|
4725
|
+
bugIssueKey: z43.string().nullable(),
|
|
4726
|
+
bugIssueUrl: z43.string().nullable(),
|
|
4727
|
+
bugIssueState: z43.string().nullable()
|
|
4685
4728
|
});
|
|
4686
|
-
var SessionQueuePageSchema =
|
|
4687
|
-
sessions:
|
|
4688
|
-
totalCount:
|
|
4689
|
-
hiddenInternalCount:
|
|
4729
|
+
var SessionQueuePageSchema = z43.object({
|
|
4730
|
+
sessions: z43.array(SessionSummarySchema),
|
|
4731
|
+
totalCount: z43.number().int(),
|
|
4732
|
+
hiddenInternalCount: z43.number().int(),
|
|
4690
4733
|
/**
|
|
4691
4734
|
* Bounced sessions the queue left out — no turn and no add, the default.
|
|
4692
4735
|
*
|
|
@@ -4696,61 +4739,61 @@ var SessionQueuePageSchema = z42.object({
|
|
|
4696
4739
|
* `totalCount + hiddenBouncedCount` is that population, and this count is the
|
|
4697
4740
|
* analytics dashboard's bounce over the same window.
|
|
4698
4741
|
*/
|
|
4699
|
-
hiddenBouncedCount:
|
|
4742
|
+
hiddenBouncedCount: z43.number().int()
|
|
4700
4743
|
});
|
|
4701
|
-
var SessionQueueFacetsSchema =
|
|
4702
|
-
review:
|
|
4703
|
-
version:
|
|
4704
|
-
turns:
|
|
4705
|
-
durationS:
|
|
4744
|
+
var SessionQueueFacetsSchema = z43.object({
|
|
4745
|
+
review: z43.record(z43.number()),
|
|
4746
|
+
version: z43.record(z43.number()),
|
|
4747
|
+
turns: z43.record(z43.number()),
|
|
4748
|
+
durationS: z43.record(z43.number()),
|
|
4706
4749
|
/** Sessions per funnel step reached — a session counts under every step it reached. */
|
|
4707
|
-
funnel:
|
|
4750
|
+
funnel: z43.record(z43.number())
|
|
4708
4751
|
});
|
|
4709
|
-
var SessionCaptureSchema =
|
|
4710
|
-
viewportWidth:
|
|
4711
|
-
viewportHeight:
|
|
4712
|
-
userAgent:
|
|
4713
|
-
locale:
|
|
4752
|
+
var SessionCaptureSchema = z43.object({
|
|
4753
|
+
viewportWidth: z43.number().int().nullable(),
|
|
4754
|
+
viewportHeight: z43.number().int().nullable(),
|
|
4755
|
+
userAgent: z43.string().nullable(),
|
|
4756
|
+
locale: z43.string().nullable(),
|
|
4714
4757
|
/** Referrer at session create — separates agentic traffic from organic. */
|
|
4715
|
-
referrer:
|
|
4758
|
+
referrer: z43.string().nullable()
|
|
4716
4759
|
});
|
|
4717
|
-
var SessionCaptureInputSchema =
|
|
4718
|
-
viewportWidth:
|
|
4719
|
-
viewportHeight:
|
|
4720
|
-
userAgent:
|
|
4721
|
-
locale:
|
|
4760
|
+
var SessionCaptureInputSchema = z43.object({
|
|
4761
|
+
viewportWidth: z43.number().int().positive().max(2e4).optional(),
|
|
4762
|
+
viewportHeight: z43.number().int().positive().max(2e4).optional(),
|
|
4763
|
+
userAgent: z43.string().max(1e3).optional(),
|
|
4764
|
+
locale: z43.string().max(35).optional(),
|
|
4722
4765
|
/** IANA zone name from the visitor's browser. Bounded rather than validated:
|
|
4723
4766
|
* the zone database grows, and refusing a name this build has not heard of
|
|
4724
4767
|
* would drop a real session's capture over a table that is out of date. */
|
|
4725
|
-
timeZone:
|
|
4726
|
-
referrer:
|
|
4727
|
-
clientVersion:
|
|
4728
|
-
isInternal:
|
|
4768
|
+
timeZone: z43.string().max(64).optional(),
|
|
4769
|
+
referrer: z43.string().max(2048).optional(),
|
|
4770
|
+
clientVersion: z43.string().max(100).optional(),
|
|
4771
|
+
isInternal: z43.boolean().optional()
|
|
4729
4772
|
});
|
|
4730
|
-
var SessionDetailSchema =
|
|
4773
|
+
var SessionDetailSchema = z43.object({
|
|
4731
4774
|
session: SessionSummarySchema,
|
|
4732
4775
|
capture: SessionCaptureSchema,
|
|
4733
4776
|
/** Full verdict history, newest first. Verdicts are revisable, and a session
|
|
4734
4777
|
* re-judged after a fix is the evidence the fix worked. */
|
|
4735
|
-
reviews:
|
|
4736
|
-
bugs:
|
|
4737
|
-
comments:
|
|
4778
|
+
reviews: z43.array(SessionReviewEventSchema),
|
|
4779
|
+
bugs: z43.array(SessionBugSchema),
|
|
4780
|
+
comments: z43.array(SessionCommentSchema),
|
|
4738
4781
|
/** Optional during API/console rolling deployment. Absent is unavailable,
|
|
4739
4782
|
* not evidence of zero visitor activity. */
|
|
4740
4783
|
activity: SessionActivitySchema.optional()
|
|
4741
4784
|
});
|
|
4742
|
-
var RecordVerdictInputSchema =
|
|
4785
|
+
var RecordVerdictInputSchema = z43.object({
|
|
4743
4786
|
verdict: RecordableVerdictSchema,
|
|
4744
|
-
note:
|
|
4787
|
+
note: z43.string().max(2e3).optional()
|
|
4745
4788
|
});
|
|
4746
|
-
var FileBugInputSchema =
|
|
4747
|
-
turnIndex:
|
|
4789
|
+
var FileBugInputSchema = z43.object({
|
|
4790
|
+
turnIndex: z43.number().int().positive().nullable(),
|
|
4748
4791
|
/** Optional — a bug filed without dropping a pin has no location. */
|
|
4749
4792
|
location: BugLocationSchema.nullable().optional(),
|
|
4750
|
-
title:
|
|
4751
|
-
body:
|
|
4793
|
+
title: z43.string().min(1).max(300),
|
|
4794
|
+
body: z43.string().min(1),
|
|
4752
4795
|
severity: BugSeveritySchema,
|
|
4753
|
-
payload:
|
|
4796
|
+
payload: z43.record(z43.unknown())
|
|
4754
4797
|
});
|
|
4755
4798
|
|
|
4756
4799
|
// ../spacestation/src/contracts/retrieval/ecommerce/option-values.ts
|
|
@@ -5051,6 +5094,8 @@ __export(src_exports2, {
|
|
|
5051
5094
|
createUnavailableProduct: () => createUnavailableProduct,
|
|
5052
5095
|
entityProjections: () => entityProjections,
|
|
5053
5096
|
formatVariantValue: () => formatVariantValue,
|
|
5097
|
+
installmentOffer: () => installmentOffer,
|
|
5098
|
+
installmentPayment: () => installmentPayment,
|
|
5054
5099
|
isGhostEntity: () => isGhostEntity,
|
|
5055
5100
|
isPendingCartLine: () => isPendingCartLine,
|
|
5056
5101
|
lookupBucketedFact: () => lookupBucketedFact,
|
|
@@ -5076,60 +5121,60 @@ __export(src_exports2, {
|
|
|
5076
5121
|
});
|
|
5077
5122
|
|
|
5078
5123
|
// ../ecommerce/src/commerce-schemas.ts
|
|
5079
|
-
import { z as
|
|
5080
|
-
var MoneySchema =
|
|
5081
|
-
amount:
|
|
5082
|
-
currencyCode:
|
|
5124
|
+
import { z as z44 } from "zod";
|
|
5125
|
+
var MoneySchema = z44.object({
|
|
5126
|
+
amount: z44.number(),
|
|
5127
|
+
currencyCode: z44.string()
|
|
5083
5128
|
});
|
|
5084
|
-
var ImageSchema =
|
|
5085
|
-
url:
|
|
5086
|
-
altText:
|
|
5087
|
-
width:
|
|
5088
|
-
height:
|
|
5129
|
+
var ImageSchema = z44.object({
|
|
5130
|
+
url: z44.string(),
|
|
5131
|
+
altText: z44.string(),
|
|
5132
|
+
width: z44.number().optional(),
|
|
5133
|
+
height: z44.number().optional(),
|
|
5089
5134
|
/** Responsive candidate set, resolved at the commerce-adapter boundary —
|
|
5090
5135
|
* never computed in a component. Renderers use it as `<img srcSet>` paired
|
|
5091
5136
|
* with a layout `sizes`. Absent for non-CDN / unsizable images. */
|
|
5092
|
-
srcSet:
|
|
5137
|
+
srcSet: z44.string().optional()
|
|
5093
5138
|
});
|
|
5094
|
-
var AssetSchema =
|
|
5139
|
+
var AssetSchema = z44.object({
|
|
5095
5140
|
/** Opaque asset id — the `resolved()` ref the agent emitted. */
|
|
5096
|
-
id:
|
|
5097
|
-
url:
|
|
5098
|
-
altText:
|
|
5099
|
-
srcSet:
|
|
5141
|
+
id: z44.string(),
|
|
5142
|
+
url: z44.string(),
|
|
5143
|
+
altText: z44.string(),
|
|
5144
|
+
srcSet: z44.string().optional()
|
|
5100
5145
|
});
|
|
5101
|
-
var SelectedOptionSchema =
|
|
5102
|
-
name:
|
|
5103
|
-
value:
|
|
5146
|
+
var SelectedOptionSchema = z44.object({
|
|
5147
|
+
name: z44.string(),
|
|
5148
|
+
value: z44.string()
|
|
5104
5149
|
});
|
|
5105
|
-
var VideoSourceSchema =
|
|
5106
|
-
url:
|
|
5107
|
-
mimeType:
|
|
5108
|
-
width:
|
|
5109
|
-
height:
|
|
5150
|
+
var VideoSourceSchema = z44.object({
|
|
5151
|
+
url: z44.string(),
|
|
5152
|
+
mimeType: z44.string(),
|
|
5153
|
+
width: z44.number().optional(),
|
|
5154
|
+
height: z44.number().optional()
|
|
5110
5155
|
});
|
|
5111
|
-
var ProductVideoSchema =
|
|
5112
|
-
kind:
|
|
5156
|
+
var ProductVideoSchema = z44.object({
|
|
5157
|
+
kind: z44.enum(["hosted", "external"]),
|
|
5113
5158
|
previewImage: ImageSchema.optional(),
|
|
5114
|
-
altText:
|
|
5159
|
+
altText: z44.string().default(""),
|
|
5115
5160
|
/** `kind: 'hosted'` only — empty for external embeds. */
|
|
5116
|
-
sources:
|
|
5161
|
+
sources: z44.array(VideoSourceSchema).default([]),
|
|
5117
5162
|
/** `kind: 'external'` only — iframe embed URL. */
|
|
5118
|
-
embedUrl:
|
|
5163
|
+
embedUrl: z44.string().optional(),
|
|
5119
5164
|
/** `kind: 'external'` only — e.g. `YOUTUBE` | `VIMEO`. */
|
|
5120
|
-
host:
|
|
5165
|
+
host: z44.string().optional()
|
|
5121
5166
|
});
|
|
5122
|
-
var AvailabilityStatusSchema =
|
|
5167
|
+
var AvailabilityStatusSchema = z44.enum([
|
|
5123
5168
|
"in_stock",
|
|
5124
5169
|
"backorder",
|
|
5125
5170
|
"preorder",
|
|
5126
5171
|
"out_of_stock",
|
|
5127
5172
|
"discontinued"
|
|
5128
5173
|
]);
|
|
5129
|
-
var ProductVariantSchema =
|
|
5130
|
-
id:
|
|
5131
|
-
title:
|
|
5132
|
-
available:
|
|
5174
|
+
var ProductVariantSchema = z44.object({
|
|
5175
|
+
id: z44.string(),
|
|
5176
|
+
title: z44.string(),
|
|
5177
|
+
available: z44.boolean(),
|
|
5133
5178
|
/**
|
|
5134
5179
|
* Qualifies `available` with the fulfillment state behind it. Absent means
|
|
5135
5180
|
* the backend did not say — which is NOT the same as in stock, and must not
|
|
@@ -5144,10 +5189,10 @@ var ProductVariantSchema = z43.object({
|
|
|
5144
5189
|
availabilityStatus: AvailabilityStatusSchema.optional(),
|
|
5145
5190
|
price: MoneySchema,
|
|
5146
5191
|
compareAtPrice: MoneySchema.optional(),
|
|
5147
|
-
selectedOptions:
|
|
5192
|
+
selectedOptions: z44.array(SelectedOptionSchema).optional(),
|
|
5148
5193
|
image: ImageSchema.optional(),
|
|
5149
5194
|
/** The merchant's stock-keeping code. Absent when the backend has none. */
|
|
5150
|
-
sku:
|
|
5195
|
+
sku: z44.string().optional()
|
|
5151
5196
|
});
|
|
5152
5197
|
var MP4_MIME = "video/mp4";
|
|
5153
5198
|
var HLS_MIME = "application/x-mpegURL";
|
|
@@ -5157,34 +5202,34 @@ function orderedVideoSources(video) {
|
|
|
5157
5202
|
const hls = video.sources.filter((s) => s.mimeType === HLS_MIME);
|
|
5158
5203
|
return [...mp4, ...hls];
|
|
5159
5204
|
}
|
|
5160
|
-
var SiblingProductSchema =
|
|
5161
|
-
id:
|
|
5162
|
-
handle:
|
|
5163
|
-
title:
|
|
5205
|
+
var SiblingProductSchema = z44.object({
|
|
5206
|
+
id: z44.string(),
|
|
5207
|
+
handle: z44.string(),
|
|
5208
|
+
title: z44.string(),
|
|
5164
5209
|
/** The differentiating value across siblings — typically the color
|
|
5165
5210
|
* label ("OLIVE", "STONE"). Rendered next to the swatch row. */
|
|
5166
|
-
color:
|
|
5211
|
+
color: z44.string(),
|
|
5167
5212
|
/** Swatch artwork. Hydrators populate from the sibling product's
|
|
5168
5213
|
* first image; renderers crop / fit to the swatch tile. */
|
|
5169
5214
|
swatchImage: ImageSchema.optional(),
|
|
5170
|
-
available:
|
|
5215
|
+
available: z44.boolean().default(true),
|
|
5171
5216
|
/** Marks the sibling that IS the currently-rendered product. The
|
|
5172
5217
|
* picker uses this to highlight the active swatch without an
|
|
5173
5218
|
* external id comparison. */
|
|
5174
|
-
current:
|
|
5219
|
+
current: z44.boolean().default(false)
|
|
5175
5220
|
});
|
|
5176
|
-
var ProductSchema =
|
|
5177
|
-
id:
|
|
5178
|
-
handle:
|
|
5179
|
-
title:
|
|
5180
|
-
description:
|
|
5181
|
-
descriptionHtml:
|
|
5182
|
-
vendor:
|
|
5183
|
-
productType:
|
|
5184
|
-
tags:
|
|
5221
|
+
var ProductSchema = z44.object({
|
|
5222
|
+
id: z44.string(),
|
|
5223
|
+
handle: z44.string().default(""),
|
|
5224
|
+
title: z44.string(),
|
|
5225
|
+
description: z44.string().default(""),
|
|
5226
|
+
descriptionHtml: z44.string().optional(),
|
|
5227
|
+
vendor: z44.string().default(""),
|
|
5228
|
+
productType: z44.string().optional(),
|
|
5229
|
+
tags: z44.array(z44.string()).default([]),
|
|
5185
5230
|
price: MoneySchema.default({ amount: 0, currencyCode: "USD" }),
|
|
5186
5231
|
compareAtPrice: MoneySchema.optional(),
|
|
5187
|
-
images:
|
|
5232
|
+
images: z44.array(ImageSchema).default([]),
|
|
5188
5233
|
/**
|
|
5189
5234
|
* Product videos (`Video` + `ExternalVideo` media). Shopify's MCP
|
|
5190
5235
|
* catalog drops video media — it only surfaces through the Storefront
|
|
@@ -5192,21 +5237,21 @@ var ProductSchema = z43.object({
|
|
|
5192
5237
|
* boundary. Default `[]` so renderers gate on `length > 0` without a
|
|
5193
5238
|
* presence guard.
|
|
5194
5239
|
*/
|
|
5195
|
-
videos:
|
|
5196
|
-
variants:
|
|
5197
|
-
availableForSale:
|
|
5198
|
-
options:
|
|
5199
|
-
name:
|
|
5200
|
-
values:
|
|
5240
|
+
videos: z44.array(ProductVideoSchema).default([]),
|
|
5241
|
+
variants: z44.array(ProductVariantSchema).default([]),
|
|
5242
|
+
availableForSale: z44.boolean().default(true),
|
|
5243
|
+
options: z44.array(z44.object({
|
|
5244
|
+
name: z44.string(),
|
|
5245
|
+
values: z44.array(z44.string())
|
|
5201
5246
|
})).optional(),
|
|
5202
|
-
collections:
|
|
5247
|
+
collections: z44.array(z44.string()).optional(),
|
|
5203
5248
|
/** See `SiblingProductSchema`. Default `[]` so renderers can check
|
|
5204
5249
|
* `length > 1` to decide whether to draw the swatch row without a
|
|
5205
5250
|
* presence guard. */
|
|
5206
|
-
colorVariants:
|
|
5207
|
-
rating:
|
|
5208
|
-
value:
|
|
5209
|
-
count:
|
|
5251
|
+
colorVariants: z44.array(SiblingProductSchema).default([]),
|
|
5252
|
+
rating: z44.object({
|
|
5253
|
+
value: z44.number(),
|
|
5254
|
+
count: z44.number()
|
|
5210
5255
|
}).optional(),
|
|
5211
5256
|
/**
|
|
5212
5257
|
* Product reviews surfaced from the brand's review store. SDK
|
|
@@ -5215,12 +5260,12 @@ var ProductSchema = z43.object({
|
|
|
5215
5260
|
* review bodies. Renderers (`Reviews` component, `ProductDetail`,
|
|
5216
5261
|
* etc.) consume directly.
|
|
5217
5262
|
*/
|
|
5218
|
-
reviews:
|
|
5219
|
-
author:
|
|
5220
|
-
rating:
|
|
5221
|
-
content:
|
|
5222
|
-
date:
|
|
5223
|
-
verified:
|
|
5263
|
+
reviews: z44.array(z44.object({
|
|
5264
|
+
author: z44.string(),
|
|
5265
|
+
rating: z44.number(),
|
|
5266
|
+
content: z44.string(),
|
|
5267
|
+
date: z44.string(),
|
|
5268
|
+
verified: z44.boolean().optional()
|
|
5224
5269
|
})).optional(),
|
|
5225
5270
|
/**
|
|
5226
5271
|
* Ghost-entity flag — `true` when the Storefront API could not hydrate
|
|
@@ -5232,7 +5277,7 @@ var ProductSchema = z43.object({
|
|
|
5232
5277
|
* Set exclusively by `createUnavailableProduct()` — never by the
|
|
5233
5278
|
* Storefront mapper.
|
|
5234
5279
|
*/
|
|
5235
|
-
unavailable:
|
|
5280
|
+
unavailable: z44.boolean().default(false)
|
|
5236
5281
|
});
|
|
5237
5282
|
function createUnavailableProduct(gid) {
|
|
5238
5283
|
return {
|
|
@@ -5254,68 +5299,68 @@ function createUnavailableProduct(gid) {
|
|
|
5254
5299
|
function isGhostEntity(value) {
|
|
5255
5300
|
return typeof value === "object" && value !== null && "unavailable" in value && value.unavailable === true;
|
|
5256
5301
|
}
|
|
5257
|
-
var ReviewSchema =
|
|
5258
|
-
id:
|
|
5259
|
-
productId:
|
|
5260
|
-
author:
|
|
5261
|
-
rating:
|
|
5262
|
-
text:
|
|
5263
|
-
date:
|
|
5264
|
-
verified:
|
|
5302
|
+
var ReviewSchema = z44.object({
|
|
5303
|
+
id: z44.string(),
|
|
5304
|
+
productId: z44.string(),
|
|
5305
|
+
author: z44.string(),
|
|
5306
|
+
rating: z44.number(),
|
|
5307
|
+
text: z44.string(),
|
|
5308
|
+
date: z44.string(),
|
|
5309
|
+
verified: z44.boolean()
|
|
5265
5310
|
});
|
|
5266
|
-
var ArticleSchema =
|
|
5267
|
-
id:
|
|
5268
|
-
handle:
|
|
5269
|
-
title:
|
|
5270
|
-
excerpt:
|
|
5271
|
-
content:
|
|
5272
|
-
contentHtml:
|
|
5273
|
-
author:
|
|
5274
|
-
publishedAt:
|
|
5311
|
+
var ArticleSchema = z44.object({
|
|
5312
|
+
id: z44.string(),
|
|
5313
|
+
handle: z44.string().default(""),
|
|
5314
|
+
title: z44.string(),
|
|
5315
|
+
excerpt: z44.string().default(""),
|
|
5316
|
+
content: z44.string().default(""),
|
|
5317
|
+
contentHtml: z44.string().optional(),
|
|
5318
|
+
author: z44.string().default(""),
|
|
5319
|
+
publishedAt: z44.string().default(""),
|
|
5275
5320
|
image: ImageSchema.optional(),
|
|
5276
|
-
blogHandle:
|
|
5277
|
-
tags:
|
|
5321
|
+
blogHandle: z44.string().default(""),
|
|
5322
|
+
tags: z44.array(z44.string()).default([])
|
|
5278
5323
|
});
|
|
5279
|
-
var CmsPageSchema =
|
|
5280
|
-
id:
|
|
5281
|
-
handle:
|
|
5282
|
-
title:
|
|
5283
|
-
body:
|
|
5284
|
-
bodyHtml:
|
|
5285
|
-
bodySummary:
|
|
5286
|
-
updatedAt:
|
|
5287
|
-
seoTitle:
|
|
5288
|
-
seoDescription:
|
|
5324
|
+
var CmsPageSchema = z44.object({
|
|
5325
|
+
id: z44.string(),
|
|
5326
|
+
handle: z44.string().default(""),
|
|
5327
|
+
title: z44.string(),
|
|
5328
|
+
body: z44.string().default(""),
|
|
5329
|
+
bodyHtml: z44.string().optional(),
|
|
5330
|
+
bodySummary: z44.string().default(""),
|
|
5331
|
+
updatedAt: z44.string().default(""),
|
|
5332
|
+
seoTitle: z44.string().optional(),
|
|
5333
|
+
seoDescription: z44.string().optional()
|
|
5289
5334
|
});
|
|
5290
|
-
var CmsPolicySchema =
|
|
5291
|
-
id:
|
|
5335
|
+
var CmsPolicySchema = z44.object({
|
|
5336
|
+
id: z44.string(),
|
|
5292
5337
|
/** Stable policy slot identifier: 'refund' | 'privacy' | 'terms' |
|
|
5293
5338
|
* 'shipping' | 'subscription' | 'warranty' | custom string. Open so
|
|
5294
5339
|
* platforms with custom policy types can extend. */
|
|
5295
|
-
kind:
|
|
5340
|
+
kind: z44.string(),
|
|
5296
5341
|
/** Slug-shaped handle the platform exposes for storefront URLs
|
|
5297
5342
|
* (e.g. `refund-policy`). Empty string when the backend doesn't
|
|
5298
5343
|
* surface one. */
|
|
5299
|
-
handle:
|
|
5300
|
-
title:
|
|
5301
|
-
body:
|
|
5302
|
-
bodyHtml:
|
|
5303
|
-
url:
|
|
5344
|
+
handle: z44.string().default(""),
|
|
5345
|
+
title: z44.string(),
|
|
5346
|
+
body: z44.string().default(""),
|
|
5347
|
+
bodyHtml: z44.string().optional(),
|
|
5348
|
+
url: z44.string().default("")
|
|
5304
5349
|
});
|
|
5305
|
-
var CollectionSchema =
|
|
5306
|
-
id:
|
|
5307
|
-
handle:
|
|
5308
|
-
title:
|
|
5309
|
-
description:
|
|
5350
|
+
var CollectionSchema = z44.object({
|
|
5351
|
+
id: z44.string(),
|
|
5352
|
+
handle: z44.string().default(""),
|
|
5353
|
+
title: z44.string(),
|
|
5354
|
+
description: z44.string().default(""),
|
|
5310
5355
|
image: ImageSchema.optional(),
|
|
5311
|
-
productCount:
|
|
5356
|
+
productCount: z44.number().int().nonnegative().optional()
|
|
5312
5357
|
});
|
|
5313
|
-
var CartLineSchema =
|
|
5314
|
-
id:
|
|
5315
|
-
merchandiseId:
|
|
5316
|
-
productId:
|
|
5317
|
-
title:
|
|
5318
|
-
variantTitle:
|
|
5358
|
+
var CartLineSchema = z44.object({
|
|
5359
|
+
id: z44.string(),
|
|
5360
|
+
merchandiseId: z44.string(),
|
|
5361
|
+
productId: z44.string(),
|
|
5362
|
+
title: z44.string(),
|
|
5363
|
+
variantTitle: z44.string().optional(),
|
|
5319
5364
|
/**
|
|
5320
5365
|
* The variant's option axes as structured pairs (e.g.
|
|
5321
5366
|
* `[{name:'Size', value:'7'}]`). The machine-readable counterpart of
|
|
@@ -5324,10 +5369,10 @@ var CartLineSchema = z43.object({
|
|
|
5324
5369
|
* single-variant products (the degenerate `Title: Default Title` axis
|
|
5325
5370
|
* is normalized away at the adapter boundary).
|
|
5326
5371
|
*/
|
|
5327
|
-
selectedOptions:
|
|
5328
|
-
vendor:
|
|
5329
|
-
sku:
|
|
5330
|
-
quantity:
|
|
5372
|
+
selectedOptions: z44.array(SelectedOptionSchema).optional(),
|
|
5373
|
+
vendor: z44.string().optional(),
|
|
5374
|
+
sku: z44.string().optional(),
|
|
5375
|
+
quantity: z44.number().int().positive(),
|
|
5331
5376
|
unitPrice: MoneySchema,
|
|
5332
5377
|
totalPrice: MoneySchema,
|
|
5333
5378
|
image: ImageSchema.optional(),
|
|
@@ -5347,26 +5392,26 @@ var CartLineSchema = z43.object({
|
|
|
5347
5392
|
* client-minted id the backend rejects, line-tap navigation is
|
|
5348
5393
|
* suppressed, and the money never folds into a settled-looking total.
|
|
5349
5394
|
*/
|
|
5350
|
-
pending:
|
|
5395
|
+
pending: z44.boolean().optional()
|
|
5351
5396
|
});
|
|
5352
5397
|
function isPendingCartLine(line) {
|
|
5353
5398
|
return line.pending === true;
|
|
5354
5399
|
}
|
|
5355
|
-
var CartDiscountCodeSchema =
|
|
5356
|
-
code:
|
|
5357
|
-
applicable:
|
|
5400
|
+
var CartDiscountCodeSchema = z44.object({
|
|
5401
|
+
code: z44.string(),
|
|
5402
|
+
applicable: z44.boolean()
|
|
5358
5403
|
});
|
|
5359
|
-
var CartMessageSchema =
|
|
5360
|
-
kind:
|
|
5404
|
+
var CartMessageSchema = z44.object({
|
|
5405
|
+
kind: z44.enum(["error", "warning", "info"]),
|
|
5361
5406
|
/** Machine code for branching; opaque and backend-defined. */
|
|
5362
|
-
code:
|
|
5407
|
+
code: z44.string(),
|
|
5363
5408
|
/** Human-readable text, meant to be shown as-is. */
|
|
5364
|
-
content:
|
|
5409
|
+
content: z44.string()
|
|
5365
5410
|
});
|
|
5366
|
-
var CartSchema =
|
|
5367
|
-
id:
|
|
5368
|
-
lines:
|
|
5369
|
-
totalQuantity:
|
|
5411
|
+
var CartSchema = z44.object({
|
|
5412
|
+
id: z44.string(),
|
|
5413
|
+
lines: z44.array(CartLineSchema),
|
|
5414
|
+
totalQuantity: z44.number().int().nonnegative(),
|
|
5370
5415
|
subtotal: MoneySchema,
|
|
5371
5416
|
/**
|
|
5372
5417
|
* Cart total after discounts (pre-shipping/tax). Absent when the
|
|
@@ -5376,11 +5421,11 @@ var CartSchema = z43.object({
|
|
|
5376
5421
|
*/
|
|
5377
5422
|
total: MoneySchema.optional(),
|
|
5378
5423
|
/** Discount codes currently attached to the cart. */
|
|
5379
|
-
discountCodes:
|
|
5424
|
+
discountCodes: z44.array(CartDiscountCodeSchema).default([]),
|
|
5380
5425
|
/** Notices the backend attached to this cart — see `CartMessageSchema`.
|
|
5381
5426
|
* Empty when the backend said nothing or does not report them. */
|
|
5382
|
-
messages:
|
|
5383
|
-
checkoutUrl:
|
|
5427
|
+
messages: z44.array(CartMessageSchema).default([]),
|
|
5428
|
+
checkoutUrl: z44.string().optional(),
|
|
5384
5429
|
/**
|
|
5385
5430
|
* Opaque handle this cart is known by in the connector's BACK OFFICE — the
|
|
5386
5431
|
* value a space owner searches there to find the order this cart became.
|
|
@@ -5393,14 +5438,14 @@ var CartSchema = z43.object({
|
|
|
5393
5438
|
* Absent when the platform has no such handle, or while the cart is still the
|
|
5394
5439
|
* client's optimistic paint and its id is client-minted.
|
|
5395
5440
|
*/
|
|
5396
|
-
backOfficeRef:
|
|
5441
|
+
backOfficeRef: z44.string().optional(),
|
|
5397
5442
|
/**
|
|
5398
5443
|
* URL that recreates this cart on the merchant's own store website
|
|
5399
5444
|
* (replace semantics — overwrites any cart the visitor already has
|
|
5400
5445
|
* there). Populated by platform adapters that support it; absent when
|
|
5401
5446
|
* the cart is empty or the URL cannot be built.
|
|
5402
5447
|
*/
|
|
5403
|
-
storeCartUrl:
|
|
5448
|
+
storeCartUrl: z44.string().optional(),
|
|
5404
5449
|
/**
|
|
5405
5450
|
* True while this cart exists only in the client's optimistic paint —
|
|
5406
5451
|
* no backend cart has been created yet, so its `id` is client-minted and
|
|
@@ -5408,7 +5453,7 @@ var CartSchema = z43.object({
|
|
|
5408
5453
|
* `CartLineSchema.pending`: the adapter never sets it, and callers that
|
|
5409
5454
|
* need a real cart id read THIS rather than sniffing the id's shape.
|
|
5410
5455
|
*/
|
|
5411
|
-
pending:
|
|
5456
|
+
pending: z44.boolean().optional()
|
|
5412
5457
|
});
|
|
5413
5458
|
function settledCart(cart) {
|
|
5414
5459
|
if (cart === null || cart === void 0) return null;
|
|
@@ -5416,27 +5461,27 @@ function settledCart(cart) {
|
|
|
5416
5461
|
}
|
|
5417
5462
|
|
|
5418
5463
|
// ../ecommerce/src/review-schemas.ts
|
|
5419
|
-
import { z as
|
|
5464
|
+
import { z as z45 } from "zod";
|
|
5420
5465
|
var PRODUCT_REVIEWS_RESOLVER_KEY = "productReviews";
|
|
5421
|
-
var ProductReviewItemSchema =
|
|
5422
|
-
author:
|
|
5423
|
-
rating:
|
|
5466
|
+
var ProductReviewItemSchema = z45.object({
|
|
5467
|
+
author: z45.string(),
|
|
5468
|
+
rating: z45.number(),
|
|
5424
5469
|
/** The reviewer's own headline ("love"), when they wrote one — the site shows it above `content`. */
|
|
5425
|
-
title:
|
|
5426
|
-
content:
|
|
5427
|
-
date:
|
|
5428
|
-
verified:
|
|
5470
|
+
title: z45.string().optional(),
|
|
5471
|
+
content: z45.string(),
|
|
5472
|
+
date: z45.string(),
|
|
5473
|
+
verified: z45.boolean().optional(),
|
|
5429
5474
|
/**
|
|
5430
5475
|
* Non-empty when the review was written for a grouped SIBLING product rather
|
|
5431
5476
|
* than this one (brands pool reviews across a product line). A surface can
|
|
5432
5477
|
* attribute it; empty / absent ⇒ the product's own review.
|
|
5433
5478
|
*/
|
|
5434
|
-
writtenFor:
|
|
5479
|
+
writtenFor: z45.string().optional()
|
|
5435
5480
|
});
|
|
5436
5481
|
var ProductReviewHighlightSchema = ProductReviewItemSchema.extend({
|
|
5437
5482
|
/** The sentence(s) the ranking fired on. Descriptive — it is what the matcher
|
|
5438
5483
|
* scored, NOT necessarily text that occurs in `content`. */
|
|
5439
|
-
highlight:
|
|
5484
|
+
highlight: z45.string().optional(),
|
|
5440
5485
|
/**
|
|
5441
5486
|
* `highlight` resolved back into `content` as a VERBATIM substring, so a
|
|
5442
5487
|
* surface can mark it with a plain `indexOf` and no matcher of its own.
|
|
@@ -5451,29 +5496,29 @@ var ProductReviewHighlightSchema = ProductReviewItemSchema.extend({
|
|
|
5451
5496
|
* Absent when the passage genuinely has no home in the body (one cut from the
|
|
5452
5497
|
* title). A surface then marks NOTHING rather than guessing at a span.
|
|
5453
5498
|
*/
|
|
5454
|
-
mark:
|
|
5499
|
+
mark: z45.string().optional()
|
|
5455
5500
|
});
|
|
5456
|
-
var ReviewAggregateSchema =
|
|
5457
|
-
value:
|
|
5458
|
-
count:
|
|
5501
|
+
var ReviewAggregateSchema = z45.object({
|
|
5502
|
+
value: z45.number(),
|
|
5503
|
+
count: z45.number()
|
|
5459
5504
|
});
|
|
5460
|
-
var ProductReviewDataSchema =
|
|
5461
|
-
id:
|
|
5505
|
+
var ProductReviewDataSchema = z45.object({
|
|
5506
|
+
id: z45.string(),
|
|
5462
5507
|
/** The product's FULL retrieved set — what a filterable list renders. */
|
|
5463
|
-
reviews:
|
|
5508
|
+
reviews: z45.array(ProductReviewItemSchema).default([]),
|
|
5464
5509
|
aggregate: ReviewAggregateSchema.default({ value: 0, count: 0 }),
|
|
5465
5510
|
/** 5★→1★ star COUNTS over the full set (index 0 = 5-star). */
|
|
5466
|
-
distribution:
|
|
5511
|
+
distribution: z45.array(z45.number()).default([]),
|
|
5467
5512
|
/**
|
|
5468
5513
|
* The reviews that ANSWER the surface's intent, best first. Empty when no
|
|
5469
5514
|
* intent was asked for — never a silent copy of `reviews`.
|
|
5470
5515
|
*/
|
|
5471
|
-
highlights:
|
|
5516
|
+
highlights: z45.array(ProductReviewHighlightSchema).default([]),
|
|
5472
5517
|
/**
|
|
5473
5518
|
* True when the review provider could not be read and nothing is indexed —
|
|
5474
5519
|
* the empty lists mean "not loaded", NOT "this product has no reviews".
|
|
5475
5520
|
*/
|
|
5476
|
-
unavailable:
|
|
5521
|
+
unavailable: z45.boolean().optional()
|
|
5477
5522
|
});
|
|
5478
5523
|
var ProductReviewPayloadSchema = ProductReviewDataSchema.omit({ id: true });
|
|
5479
5524
|
|
|
@@ -5767,9 +5812,9 @@ function readPdpCompanions(config) {
|
|
|
5767
5812
|
}
|
|
5768
5813
|
|
|
5769
5814
|
// ../ecommerce/src/base-attributes.ts
|
|
5770
|
-
import { z as
|
|
5815
|
+
import { z as z46 } from "zod";
|
|
5771
5816
|
var BASE_ATTRIBUTES_CONFIG_KEY = "baseAttributes";
|
|
5772
|
-
var BaseAttributesRecordSchema =
|
|
5817
|
+
var BaseAttributesRecordSchema = z46.record(z46.string(), AttributeDefSchema);
|
|
5773
5818
|
function buildBaseAttributesConfig(attributes) {
|
|
5774
5819
|
return { [BASE_ATTRIBUTES_CONFIG_KEY]: attributes };
|
|
5775
5820
|
}
|
|
@@ -5780,9 +5825,9 @@ function readBaseAttributesConfig(config) {
|
|
|
5780
5825
|
}
|
|
5781
5826
|
|
|
5782
5827
|
// ../ecommerce/src/bucket-labels.ts
|
|
5783
|
-
import { z as
|
|
5828
|
+
import { z as z47 } from "zod";
|
|
5784
5829
|
var BUCKET_LABELS_CONFIG_KEY = "bucketLabels";
|
|
5785
|
-
var BucketLabelsRecordSchema =
|
|
5830
|
+
var BucketLabelsRecordSchema = z47.record(z47.string(), z47.string());
|
|
5786
5831
|
function buildBucketLabelsConfig(labels) {
|
|
5787
5832
|
return { [BUCKET_LABELS_CONFIG_KEY]: labels };
|
|
5788
5833
|
}
|
|
@@ -5846,6 +5891,36 @@ function clearStoreThemeSources() {
|
|
|
5846
5891
|
factories3.length = 0;
|
|
5847
5892
|
}
|
|
5848
5893
|
|
|
5894
|
+
// ../ecommerce/src/installment-offer.ts
|
|
5895
|
+
function installmentPayment(amount, term) {
|
|
5896
|
+
const r = term.apr / 100 / (term.frequency === "weekly" ? 52 : 12);
|
|
5897
|
+
const raw = r === 0 ? amount / term.count : amount * r / (1 - Math.pow(1 + r, -term.count));
|
|
5898
|
+
return Math.round(raw * 100) / 100;
|
|
5899
|
+
}
|
|
5900
|
+
function installmentOffer(plans, price) {
|
|
5901
|
+
if (price.currencyCode !== plans.minPrice.currencyCode) return void 0;
|
|
5902
|
+
const amount = price.amount;
|
|
5903
|
+
const band = plans.plans.find((p) => amount >= p.minPrice.amount && amount <= p.maxPrice.amount);
|
|
5904
|
+
if (band === void 0) return void 0;
|
|
5905
|
+
const quotes = band.terms.map((t) => ({
|
|
5906
|
+
kind: t.kind,
|
|
5907
|
+
apr: t.apr,
|
|
5908
|
+
frequency: t.frequency,
|
|
5909
|
+
count: t.count,
|
|
5910
|
+
payment: installmentPayment(amount, t)
|
|
5911
|
+
}));
|
|
5912
|
+
let split;
|
|
5913
|
+
let lowestMonthly;
|
|
5914
|
+
for (const q of quotes) {
|
|
5915
|
+
if (q.kind === "split") {
|
|
5916
|
+
if (split === void 0 || q.count > split.count) split = q;
|
|
5917
|
+
} else if (q.frequency === "monthly" && (lowestMonthly === void 0 || q.payment < lowestMonthly.payment)) {
|
|
5918
|
+
lowestMonthly = q;
|
|
5919
|
+
}
|
|
5920
|
+
}
|
|
5921
|
+
return { plans: quotes, split, lowestMonthly };
|
|
5922
|
+
}
|
|
5923
|
+
|
|
5849
5924
|
// src/session/visitor-locale.ts
|
|
5850
5925
|
var cached = null;
|
|
5851
5926
|
function getVisitorLocale() {
|
|
@@ -5901,6 +5976,8 @@ function runSessionScopedClearHandlers() {
|
|
|
5901
5976
|
var shell_exports = {};
|
|
5902
5977
|
__export(shell_exports, {
|
|
5903
5978
|
ATTACHMENT_ACCEPT: () => ATTACHMENT_ACCEPT,
|
|
5979
|
+
BotCheckNoticeProvider: () => BotCheckNoticeProvider,
|
|
5980
|
+
BotCheckNoticeSchema: () => BotCheckNoticeSchema,
|
|
5904
5981
|
DockPersistenceProvider: () => DockPersistenceProvider,
|
|
5905
5982
|
ScrollContainerProvider: () => ScrollContainerProvider,
|
|
5906
5983
|
ShellRegistryProvider: () => ShellRegistryProvider,
|
|
@@ -5911,7 +5988,9 @@ __export(shell_exports, {
|
|
|
5911
5988
|
claimExclusiveOverlay: () => claimExclusiveOverlay,
|
|
5912
5989
|
registerExclusiveOverlay: () => registerExclusiveOverlay,
|
|
5913
5990
|
splitAnswer: () => splitAnswer,
|
|
5991
|
+
takeSubmitOrigin: () => takeSubmitOrigin,
|
|
5914
5992
|
threadRowAttrs: () => threadRowAttrs,
|
|
5993
|
+
useBotCheckNotice: () => useBotCheckNotice,
|
|
5915
5994
|
useComposerAttachments: () => useComposerAttachments,
|
|
5916
5995
|
useComposerChipSelect: () => useComposerChipSelect,
|
|
5917
5996
|
useConversationPage: () => useConversationPage,
|
|
@@ -5933,7 +6012,9 @@ __export(shell_exports, {
|
|
|
5933
6012
|
useThreadLanding: () => useThreadLanding,
|
|
5934
6013
|
useThreadRows: () => useThreadRows,
|
|
5935
6014
|
useTurnAskPlacement: () => useTurnAskPlacement,
|
|
5936
|
-
useTurnAskReply: () => useTurnAskReply
|
|
6015
|
+
useTurnAskReply: () => useTurnAskReply,
|
|
6016
|
+
useWaitingSubmitOrigin: () => useWaitingSubmitOrigin,
|
|
6017
|
+
withoutClosingQuestion: () => withoutClosingQuestion
|
|
5937
6018
|
});
|
|
5938
6019
|
|
|
5939
6020
|
// src/shell/ScrollContainerContext.tsx
|
|
@@ -5996,8 +6077,22 @@ function useDockPersistence() {
|
|
|
5996
6077
|
return React4.useContext(DockPersistenceContext);
|
|
5997
6078
|
}
|
|
5998
6079
|
|
|
6080
|
+
// src/shell/bot-check-notice.tsx
|
|
6081
|
+
import React5 from "react";
|
|
6082
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
6083
|
+
var BotCheckNoticeContext = React5.createContext(null);
|
|
6084
|
+
function BotCheckNoticeProvider({
|
|
6085
|
+
value,
|
|
6086
|
+
children
|
|
6087
|
+
}) {
|
|
6088
|
+
return /* @__PURE__ */ jsx5(BotCheckNoticeContext.Provider, { value, children });
|
|
6089
|
+
}
|
|
6090
|
+
function useBotCheckNotice() {
|
|
6091
|
+
return React5.useContext(BotCheckNoticeContext);
|
|
6092
|
+
}
|
|
6093
|
+
|
|
5999
6094
|
// src/shell/use-dock-state.ts
|
|
6000
|
-
import
|
|
6095
|
+
import React8 from "react";
|
|
6001
6096
|
|
|
6002
6097
|
// src/canvas/runtime-context.tsx
|
|
6003
6098
|
import { createContext as createContext6, useContext as useContext6 } from "react";
|
|
@@ -6110,21 +6205,21 @@ function useHasLeftSeedHome() {
|
|
|
6110
6205
|
}
|
|
6111
6206
|
|
|
6112
6207
|
// src/shell/use-hydrated.ts
|
|
6113
|
-
import
|
|
6208
|
+
import React6 from "react";
|
|
6114
6209
|
function useHydrated() {
|
|
6115
|
-
const [hydrated, setHydrated] =
|
|
6116
|
-
|
|
6210
|
+
const [hydrated, setHydrated] = React6.useState(false);
|
|
6211
|
+
React6.useEffect(() => {
|
|
6117
6212
|
setHydrated(true);
|
|
6118
6213
|
}, []);
|
|
6119
6214
|
return hydrated;
|
|
6120
6215
|
}
|
|
6121
6216
|
|
|
6122
6217
|
// src/shell/use-overridable-toggle.ts
|
|
6123
|
-
import
|
|
6218
|
+
import React7 from "react";
|
|
6124
6219
|
function useOverridableToggle(defaultValue) {
|
|
6125
|
-
const [override, setOverride] =
|
|
6220
|
+
const [override, setOverride] = React7.useState(null);
|
|
6126
6221
|
const value = override === null ? defaultValue : override;
|
|
6127
|
-
const set =
|
|
6222
|
+
const set = React7.useCallback((next) => {
|
|
6128
6223
|
setOverride(next);
|
|
6129
6224
|
}, []);
|
|
6130
6225
|
const toggle = () => {
|
|
@@ -6141,9 +6236,9 @@ function useDockState(reopenOnMessage, autoOpen) {
|
|
|
6141
6236
|
const hasLeftHome = useHasLeftSeedHome();
|
|
6142
6237
|
const agentDriven = useAgentDriven();
|
|
6143
6238
|
const settled = sessionId !== null;
|
|
6144
|
-
const settledRef =
|
|
6145
|
-
const engagedWhenSettledRef =
|
|
6146
|
-
const hasEngagedRef =
|
|
6239
|
+
const settledRef = React8.useRef(false);
|
|
6240
|
+
const engagedWhenSettledRef = React8.useRef(false);
|
|
6241
|
+
const hasEngagedRef = React8.useRef(initialOpen === true);
|
|
6147
6242
|
const historyIsAccountedFor = initialOpen !== null;
|
|
6148
6243
|
const engagementIsNew = historyIsAccountedFor ? settledRef.current && !engagedWhenSettledRef.current : true;
|
|
6149
6244
|
if (hasLeftHome && engagementIsNew && !agentDriven) hasEngagedRef.current = true;
|
|
@@ -6151,8 +6246,8 @@ function useDockState(reopenOnMessage, autoOpen) {
|
|
|
6151
6246
|
const openDefault = agentDriven || !autoOpen ? false : hydrated ? hasEngagedRef.current : initialOpen === true;
|
|
6152
6247
|
const toggle = useOverridableToggle(openDefault);
|
|
6153
6248
|
const userTurns = messages.reduce((n, m) => m.role === "user" ? n + 1 : n, 0);
|
|
6154
|
-
const prevUserTurns =
|
|
6155
|
-
|
|
6249
|
+
const prevUserTurns = React8.useRef(userTurns);
|
|
6250
|
+
React8.useEffect(() => {
|
|
6156
6251
|
if (!settledRef.current) {
|
|
6157
6252
|
if (!settled) return;
|
|
6158
6253
|
settledRef.current = true;
|
|
@@ -6163,7 +6258,7 @@ function useDockState(reopenOnMessage, autoOpen) {
|
|
|
6163
6258
|
if (reopenOnMessage && autoOpen && !agentDriven && userTurns > prevUserTurns.current) toggle.set(true);
|
|
6164
6259
|
prevUserTurns.current = userTurns;
|
|
6165
6260
|
}, [userTurns, settled, hasLeftHome, reopenOnMessage, autoOpen, agentDriven, toggle.set]);
|
|
6166
|
-
|
|
6261
|
+
React8.useEffect(() => {
|
|
6167
6262
|
onOpenChange(toggle.value);
|
|
6168
6263
|
}, [toggle.value, onOpenChange]);
|
|
6169
6264
|
return { open: toggle.value, toggle: toggle.toggle };
|
|
@@ -6195,7 +6290,7 @@ function useExclusiveOverlay(id, open, close) {
|
|
|
6195
6290
|
}
|
|
6196
6291
|
|
|
6197
6292
|
// src/shell/composer-attachments/use-composer-attachments.ts
|
|
6198
|
-
import * as
|
|
6293
|
+
import * as React9 from "react";
|
|
6199
6294
|
|
|
6200
6295
|
// src/utils/core-utils/mint-id.ts
|
|
6201
6296
|
function mintId(prefix) {
|
|
@@ -6237,12 +6332,12 @@ function failureOf(err) {
|
|
|
6237
6332
|
}
|
|
6238
6333
|
function useComposerAttachments() {
|
|
6239
6334
|
const session = useFourtySession();
|
|
6240
|
-
const [attachments, setAttachments] =
|
|
6241
|
-
const createdUrls =
|
|
6242
|
-
const update2 =
|
|
6335
|
+
const [attachments, setAttachments] = React9.useState([]);
|
|
6336
|
+
const createdUrls = React9.useRef(/* @__PURE__ */ new Set());
|
|
6337
|
+
const update2 = React9.useCallback((localId, patch) => {
|
|
6243
6338
|
setAttachments((prev) => prev.map((a) => a.localId === localId ? { ...a, ...patch } : a));
|
|
6244
6339
|
}, []);
|
|
6245
|
-
const startUpload =
|
|
6340
|
+
const startUpload = React9.useCallback(
|
|
6246
6341
|
(localId, file) => {
|
|
6247
6342
|
const failure = validate(file);
|
|
6248
6343
|
if (failure !== null) {
|
|
@@ -6266,7 +6361,7 @@ function useComposerAttachments() {
|
|
|
6266
6361
|
},
|
|
6267
6362
|
[session, update2]
|
|
6268
6363
|
);
|
|
6269
|
-
const addFiles =
|
|
6364
|
+
const addFiles = React9.useCallback(
|
|
6270
6365
|
(files) => {
|
|
6271
6366
|
const list2 = Array.from(files);
|
|
6272
6367
|
for (const file of list2) {
|
|
@@ -6299,13 +6394,13 @@ function useComposerAttachments() {
|
|
|
6299
6394
|
},
|
|
6300
6395
|
[startUpload]
|
|
6301
6396
|
);
|
|
6302
|
-
const revoke =
|
|
6397
|
+
const revoke = React9.useCallback((url) => {
|
|
6303
6398
|
if (url !== null && createdUrls.current.has(url)) {
|
|
6304
6399
|
URL.revokeObjectURL(url);
|
|
6305
6400
|
createdUrls.current.delete(url);
|
|
6306
6401
|
}
|
|
6307
6402
|
}, []);
|
|
6308
|
-
const remove2 =
|
|
6403
|
+
const remove2 = React9.useCallback(
|
|
6309
6404
|
(localId) => {
|
|
6310
6405
|
setAttachments((prev) => {
|
|
6311
6406
|
const target = prev.find((a) => a.localId === localId);
|
|
@@ -6315,12 +6410,12 @@ function useComposerAttachments() {
|
|
|
6315
6410
|
},
|
|
6316
6411
|
[revoke]
|
|
6317
6412
|
);
|
|
6318
|
-
const clear =
|
|
6413
|
+
const clear = React9.useCallback(() => {
|
|
6319
6414
|
for (const url of createdUrls.current) URL.revokeObjectURL(url);
|
|
6320
6415
|
createdUrls.current.clear();
|
|
6321
6416
|
setAttachments([]);
|
|
6322
6417
|
}, []);
|
|
6323
|
-
|
|
6418
|
+
React9.useEffect(
|
|
6324
6419
|
() => () => {
|
|
6325
6420
|
for (const url of createdUrls.current) URL.revokeObjectURL(url);
|
|
6326
6421
|
createdUrls.current.clear();
|
|
@@ -6328,7 +6423,7 @@ function useComposerAttachments() {
|
|
|
6328
6423
|
[]
|
|
6329
6424
|
);
|
|
6330
6425
|
const hasPending = attachments.some((a) => a.status === "uploading");
|
|
6331
|
-
const readyRefs =
|
|
6426
|
+
const readyRefs = React9.useMemo(
|
|
6332
6427
|
() => attachments.filter((a) => a.ref !== null).map((a) => a.ref),
|
|
6333
6428
|
[attachments]
|
|
6334
6429
|
);
|
|
@@ -6336,7 +6431,7 @@ function useComposerAttachments() {
|
|
|
6336
6431
|
}
|
|
6337
6432
|
|
|
6338
6433
|
// src/shell/use-prompt-composer.ts
|
|
6339
|
-
import * as
|
|
6434
|
+
import * as React11 from "react";
|
|
6340
6435
|
|
|
6341
6436
|
// src/voice/use-voice-capture.ts
|
|
6342
6437
|
import { useCallback as useCallback4, useEffect as useEffect4, useRef as useRef4, useState as useState3 } from "react";
|
|
@@ -6601,33 +6696,88 @@ function useVoiceCapture(options) {
|
|
|
6601
6696
|
};
|
|
6602
6697
|
}
|
|
6603
6698
|
|
|
6699
|
+
// src/shell/submit-origin.ts
|
|
6700
|
+
import * as React10 from "react";
|
|
6701
|
+
var ORIGIN_TTL_MS = 3e3;
|
|
6702
|
+
var noted = null;
|
|
6703
|
+
var notedAt = 0;
|
|
6704
|
+
var expiry = null;
|
|
6705
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
6706
|
+
var notify = () => listeners.forEach((l) => l());
|
|
6707
|
+
var sameWords = (a, b) => a.replace(/\s+/g, " ").trim() === b.replace(/\s+/g, " ").trim();
|
|
6708
|
+
var px = (value, fallback) => {
|
|
6709
|
+
const n = Number.parseFloat(value);
|
|
6710
|
+
return Number.isFinite(n) ? n : fallback;
|
|
6711
|
+
};
|
|
6712
|
+
function noteSubmitOrigin(text2, el) {
|
|
6713
|
+
const r = el.getBoundingClientRect();
|
|
6714
|
+
const style = getComputedStyle(el);
|
|
6715
|
+
const fontSizePx = px(style.fontSize, 16);
|
|
6716
|
+
const padLeft = px(style.paddingLeft, 0);
|
|
6717
|
+
const padTop = px(style.paddingTop, 0);
|
|
6718
|
+
const padRight = px(style.paddingRight, 0);
|
|
6719
|
+
const padBottom = px(style.paddingBottom, 0);
|
|
6720
|
+
noted = {
|
|
6721
|
+
text: text2,
|
|
6722
|
+
rect: { left: r.left + padLeft, top: r.top + padTop, width: Math.max(0, r.width - padLeft - padRight), height: Math.max(0, r.height - padTop - padBottom) },
|
|
6723
|
+
fontSizePx,
|
|
6724
|
+
lineHeightPx: px(style.lineHeight, fontSizePx * 1.4),
|
|
6725
|
+
fontFamily: style.fontFamily,
|
|
6726
|
+
color: style.color
|
|
6727
|
+
};
|
|
6728
|
+
notedAt = performance.now();
|
|
6729
|
+
if (expiry !== null) clearTimeout(expiry);
|
|
6730
|
+
expiry = setTimeout(() => {
|
|
6731
|
+
noted = null;
|
|
6732
|
+
expiry = null;
|
|
6733
|
+
notify();
|
|
6734
|
+
}, ORIGIN_TTL_MS);
|
|
6735
|
+
notify();
|
|
6736
|
+
}
|
|
6737
|
+
function takeSubmitOrigin(text2) {
|
|
6738
|
+
const origin = noted;
|
|
6739
|
+
if (origin === null || performance.now() - notedAt > ORIGIN_TTL_MS || !sameWords(origin.text, text2)) return null;
|
|
6740
|
+
noted = null;
|
|
6741
|
+
if (expiry !== null) clearTimeout(expiry);
|
|
6742
|
+
expiry = null;
|
|
6743
|
+
notify();
|
|
6744
|
+
return origin;
|
|
6745
|
+
}
|
|
6746
|
+
function subscribe(listener) {
|
|
6747
|
+
listeners.add(listener);
|
|
6748
|
+
return () => listeners.delete(listener);
|
|
6749
|
+
}
|
|
6750
|
+
function useWaitingSubmitOrigin() {
|
|
6751
|
+
return React10.useSyncExternalStore(subscribe, () => noted, () => null);
|
|
6752
|
+
}
|
|
6753
|
+
|
|
6604
6754
|
// src/shell/use-prompt-composer.ts
|
|
6605
6755
|
function usePromptComposer(options = {}) {
|
|
6606
|
-
const { attachments: attachmentsController } = options;
|
|
6756
|
+
const { attachments: attachmentsController, origin } = options;
|
|
6607
6757
|
const session = useFourtySession();
|
|
6608
6758
|
const internalAttach = useComposerAttachments();
|
|
6609
6759
|
const attach = attachmentsController !== void 0 ? attachmentsController : internalAttach;
|
|
6610
6760
|
const [value, setValue] = useComposerDraft();
|
|
6611
|
-
const dictationBaseRef =
|
|
6612
|
-
const handleDictationResult =
|
|
6761
|
+
const dictationBaseRef = React11.useRef("");
|
|
6762
|
+
const handleDictationResult = React11.useCallback((transcript) => {
|
|
6613
6763
|
const base = dictationBaseRef.current;
|
|
6614
6764
|
setValue(base.length > 0 ? `${base} ${transcript}` : transcript);
|
|
6615
6765
|
}, [setValue]);
|
|
6616
|
-
const submitRef =
|
|
6766
|
+
const submitRef = React11.useRef(() => {
|
|
6617
6767
|
});
|
|
6618
6768
|
const voiceCapture = useVoiceCapture({
|
|
6619
6769
|
onResult: handleDictationResult,
|
|
6620
6770
|
onCommit: () => submitRef.current()
|
|
6621
6771
|
});
|
|
6622
|
-
const valueRef =
|
|
6772
|
+
const valueRef = React11.useRef(value);
|
|
6623
6773
|
valueRef.current = value;
|
|
6624
|
-
const toggleDictation =
|
|
6774
|
+
const toggleDictation = React11.useCallback(() => {
|
|
6625
6775
|
if (voiceCapture.state !== "listening") {
|
|
6626
6776
|
dictationBaseRef.current = valueRef.current;
|
|
6627
6777
|
}
|
|
6628
6778
|
voiceCapture.toggle();
|
|
6629
6779
|
}, [voiceCapture]);
|
|
6630
|
-
const onPaste =
|
|
6780
|
+
const onPaste = React11.useCallback(
|
|
6631
6781
|
(e) => {
|
|
6632
6782
|
const files = e.clipboardData.files;
|
|
6633
6783
|
if (files.length > 0) {
|
|
@@ -6638,16 +6788,19 @@ function usePromptComposer(options = {}) {
|
|
|
6638
6788
|
[attach]
|
|
6639
6789
|
);
|
|
6640
6790
|
const canSend = (value.trim().length > 0 || attach.readyRefs.length > 0) && !attach.hasPending;
|
|
6641
|
-
const submit =
|
|
6791
|
+
const submit = React11.useCallback(() => {
|
|
6642
6792
|
if (!((value.trim().length > 0 || attach.readyRefs.length > 0) && !attach.hasPending)) return;
|
|
6643
6793
|
voiceCapture.cancel();
|
|
6644
|
-
|
|
6645
|
-
|
|
6646
|
-
|
|
6647
|
-
|
|
6794
|
+
const originEl = origin === void 0 ? null : origin.current;
|
|
6795
|
+
if (originEl !== null && value.trim().length > 0) noteSubmitOrigin(value, originEl);
|
|
6796
|
+
const text2 = value;
|
|
6797
|
+
const options2 = attach.readyRefs.length > 0 ? { attachments: attach.readyRefs } : void 0;
|
|
6648
6798
|
setValue("");
|
|
6649
6799
|
attach.clear();
|
|
6650
|
-
|
|
6800
|
+
requestAnimationFrame(() => {
|
|
6801
|
+
setTimeout(() => session.sendMessage(text2, options2), 0);
|
|
6802
|
+
});
|
|
6803
|
+
}, [session, value, attach, setValue, voiceCapture, origin]);
|
|
6651
6804
|
submitRef.current = submit;
|
|
6652
6805
|
return {
|
|
6653
6806
|
value,
|
|
@@ -6665,10 +6818,10 @@ function usePromptComposer(options = {}) {
|
|
|
6665
6818
|
}
|
|
6666
6819
|
|
|
6667
6820
|
// src/shell/use-composer-chip-select.ts
|
|
6668
|
-
import * as
|
|
6821
|
+
import * as React12 from "react";
|
|
6669
6822
|
function useComposerChipSelect() {
|
|
6670
6823
|
const session = useFourtySession();
|
|
6671
|
-
return
|
|
6824
|
+
return React12.useCallback(
|
|
6672
6825
|
(action) => {
|
|
6673
6826
|
session.dispatchSuggestionAction({
|
|
6674
6827
|
id: action.id,
|
|
@@ -6682,10 +6835,10 @@ function useComposerChipSelect() {
|
|
|
6682
6835
|
}
|
|
6683
6836
|
|
|
6684
6837
|
// src/shell/use-turn-ask-reply.ts
|
|
6685
|
-
import * as
|
|
6838
|
+
import * as React13 from "react";
|
|
6686
6839
|
function useTurnAskReply() {
|
|
6687
6840
|
const session = useFourtySession();
|
|
6688
|
-
return
|
|
6841
|
+
return React13.useCallback(
|
|
6689
6842
|
(answer) => {
|
|
6690
6843
|
session.dispatchSuggestionAction({ id: `ask-${answer}`, label: answer, type: "message", payload: { text: answer, followUp: true } });
|
|
6691
6844
|
},
|
|
@@ -6694,14 +6847,14 @@ function useTurnAskReply() {
|
|
|
6694
6847
|
}
|
|
6695
6848
|
|
|
6696
6849
|
// src/shell/turn-ask-placement.tsx
|
|
6697
|
-
import * as
|
|
6698
|
-
import { jsx as
|
|
6699
|
-
var TurnAskPlacementContext =
|
|
6850
|
+
import * as React14 from "react";
|
|
6851
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
6852
|
+
var TurnAskPlacementContext = React14.createContext("prose");
|
|
6700
6853
|
function TurnAskPlacementProvider({ placement, children }) {
|
|
6701
|
-
return /* @__PURE__ */
|
|
6854
|
+
return /* @__PURE__ */ jsx6(TurnAskPlacementContext.Provider, { value: placement, children });
|
|
6702
6855
|
}
|
|
6703
6856
|
function useTurnAskPlacement() {
|
|
6704
|
-
return
|
|
6857
|
+
return React14.useContext(TurnAskPlacementContext);
|
|
6705
6858
|
}
|
|
6706
6859
|
|
|
6707
6860
|
// src/shell/use-go-home.ts
|
|
@@ -6718,10 +6871,10 @@ function useGoHome() {
|
|
|
6718
6871
|
}
|
|
6719
6872
|
|
|
6720
6873
|
// src/shell/use-menu-item-select.ts
|
|
6721
|
-
import * as
|
|
6874
|
+
import * as React15 from "react";
|
|
6722
6875
|
function useMenuItemSelect() {
|
|
6723
6876
|
const session = useFourtySession();
|
|
6724
|
-
return
|
|
6877
|
+
return React15.useCallback(
|
|
6725
6878
|
(item) => {
|
|
6726
6879
|
const payload = item.action.payload === void 0 ? {} : item.action.payload;
|
|
6727
6880
|
session.dispatchSuggestionAction({
|
|
@@ -6774,15 +6927,15 @@ function useThreadRows() {
|
|
|
6774
6927
|
}
|
|
6775
6928
|
|
|
6776
6929
|
// src/shell/conversation/use-conversation-page.ts
|
|
6777
|
-
import * as
|
|
6930
|
+
import * as React19 from "react";
|
|
6778
6931
|
|
|
6779
6932
|
// src/canvas/use-is-seed-home.ts
|
|
6780
|
-
import * as
|
|
6933
|
+
import * as React16 from "react";
|
|
6781
6934
|
function useIsSeedHome() {
|
|
6782
6935
|
const layout = useDisplayedLayout();
|
|
6783
6936
|
const turn = useTurn();
|
|
6784
6937
|
const sessionState = useSessionState();
|
|
6785
|
-
return
|
|
6938
|
+
return React16.useMemo(() => {
|
|
6786
6939
|
if (sessionState.seedLayout === null) return false;
|
|
6787
6940
|
if (turn.index !== 0) return false;
|
|
6788
6941
|
if (turn.userMessage !== "") return false;
|
|
@@ -6811,6 +6964,13 @@ function splitAnswer(prose2) {
|
|
|
6811
6964
|
body: text2.slice(end).trim().replace(/\s*\n+\s*/g, " ").replace(/([.!?])(?=\*{0,2}[A-Z])/g, "$1 ")
|
|
6812
6965
|
};
|
|
6813
6966
|
}
|
|
6967
|
+
function withoutClosingQuestion(body) {
|
|
6968
|
+
const text2 = body.trimEnd();
|
|
6969
|
+
if (!/\?\**$/.test(text2)) return body;
|
|
6970
|
+
const stops = [...text2.slice(0, -1).matchAll(/[.!?]\**\s/g)];
|
|
6971
|
+
const last = stops[stops.length - 1];
|
|
6972
|
+
return last === void 0 ? "" : text2.slice(0, last.index + last[0].length).trimEnd();
|
|
6973
|
+
}
|
|
6814
6974
|
|
|
6815
6975
|
// src/canvas/turn-edit.ts
|
|
6816
6976
|
function isRecord2(value) {
|
|
@@ -7018,8 +7178,8 @@ var PRESENCE_LIFECYCLE = {
|
|
|
7018
7178
|
};
|
|
7019
7179
|
|
|
7020
7180
|
// ../spacestation/src/widgets/presence/profile.ts
|
|
7021
|
-
import { z as
|
|
7022
|
-
var PresenceProfileSchema =
|
|
7181
|
+
import { z as z48 } from "zod";
|
|
7182
|
+
var PresenceProfileSchema = z48.object({
|
|
7023
7183
|
/**
|
|
7024
7184
|
* How much the agent SPEAKS in presence.
|
|
7025
7185
|
* - 'off' the faculty generates no prose at all. Zero tokens, and
|
|
@@ -7029,14 +7189,14 @@ var PresenceProfileSchema = z47.object({
|
|
|
7029
7189
|
* - 'terse' one lead line per turn. The default — see below.
|
|
7030
7190
|
* - 'full' a lead line plus asides beside individual elements.
|
|
7031
7191
|
*/
|
|
7032
|
-
voice:
|
|
7192
|
+
voice: z48.enum(["off", "terse", "full"]),
|
|
7033
7193
|
/**
|
|
7034
7194
|
* Which source kinds this space surfaces. 'all' = every tool that declares a
|
|
7035
7195
|
* `sourceKind`. An explicit list lets a space stay quiet about lookups its
|
|
7036
7196
|
* visitors would find uninteresting (policy checks on a fashion space)
|
|
7037
7197
|
* without the tool having to lie about what it is.
|
|
7038
7198
|
*/
|
|
7039
|
-
sources:
|
|
7199
|
+
sources: z48.union([z48.array(z48.string()), z48.literal("all")]),
|
|
7040
7200
|
/**
|
|
7041
7201
|
* Which facts render.
|
|
7042
7202
|
* - 'inferred-only' hides `provenance: 'stated'` facts. The default and the
|
|
@@ -7045,7 +7205,7 @@ var PresenceProfileSchema = z47.object({
|
|
|
7045
7205
|
* - 'all' shows stated facts too — for spaces where confirming the brief
|
|
7046
7206
|
* back is itself the product (intake, configuration).
|
|
7047
7207
|
*/
|
|
7048
|
-
facts:
|
|
7208
|
+
facts: z48.enum(["inferred-only", "all"])
|
|
7049
7209
|
});
|
|
7050
7210
|
var DEFAULT_PRESENCE_PROFILE = {
|
|
7051
7211
|
voice: "terse",
|
|
@@ -7081,7 +7241,7 @@ function usePresenceLiveTurn() {
|
|
|
7081
7241
|
}
|
|
7082
7242
|
|
|
7083
7243
|
// src/widgets/presence/flows/flow-store.ts
|
|
7084
|
-
import { useSyncExternalStore as
|
|
7244
|
+
import { useSyncExternalStore as useSyncExternalStore3 } from "react";
|
|
7085
7245
|
|
|
7086
7246
|
// src/utils/storage.ts
|
|
7087
7247
|
var opened = /* @__PURE__ */ new Map();
|
|
@@ -7171,14 +7331,14 @@ function load() {
|
|
|
7171
7331
|
}
|
|
7172
7332
|
var outputs = load();
|
|
7173
7333
|
var freshIds = /* @__PURE__ */ new Set();
|
|
7174
|
-
var
|
|
7175
|
-
function
|
|
7176
|
-
for (const listener of
|
|
7334
|
+
var listeners2 = /* @__PURE__ */ new Set();
|
|
7335
|
+
function notify2() {
|
|
7336
|
+
for (const listener of listeners2) listener();
|
|
7177
7337
|
}
|
|
7178
|
-
function
|
|
7179
|
-
|
|
7338
|
+
function subscribe2(listener) {
|
|
7339
|
+
listeners2.add(listener);
|
|
7180
7340
|
return () => {
|
|
7181
|
-
|
|
7341
|
+
listeners2.delete(listener);
|
|
7182
7342
|
};
|
|
7183
7343
|
}
|
|
7184
7344
|
function persist() {
|
|
@@ -7189,24 +7349,24 @@ function setFlowOutput(flowId, data) {
|
|
|
7189
7349
|
outputs = { ...outputs, [flowId]: data };
|
|
7190
7350
|
freshIds.add(flowId);
|
|
7191
7351
|
persist();
|
|
7192
|
-
|
|
7352
|
+
notify2();
|
|
7193
7353
|
}
|
|
7194
7354
|
function getFlowOutput(flowId) {
|
|
7195
7355
|
return Object.prototype.hasOwnProperty.call(outputs, flowId) ? outputs[flowId] : null;
|
|
7196
7356
|
}
|
|
7197
7357
|
function subscribeFlowOutputs(listener) {
|
|
7198
|
-
return
|
|
7358
|
+
return subscribe2(listener);
|
|
7199
7359
|
}
|
|
7200
7360
|
function useAgentFlow(flowId) {
|
|
7201
|
-
return
|
|
7202
|
-
|
|
7361
|
+
return useSyncExternalStore3(
|
|
7362
|
+
subscribe2,
|
|
7203
7363
|
() => Object.prototype.hasOwnProperty.call(outputs, flowId) ? outputs[flowId] : null,
|
|
7204
7364
|
() => null
|
|
7205
7365
|
);
|
|
7206
7366
|
}
|
|
7207
7367
|
function useAgentFlowFresh(flowId) {
|
|
7208
|
-
return
|
|
7209
|
-
|
|
7368
|
+
return useSyncExternalStore3(
|
|
7369
|
+
subscribe2,
|
|
7210
7370
|
() => freshIds.has(flowId),
|
|
7211
7371
|
() => false
|
|
7212
7372
|
);
|
|
@@ -7216,7 +7376,7 @@ if (typeof window !== "undefined") {
|
|
|
7216
7376
|
outputs = {};
|
|
7217
7377
|
freshIds.clear();
|
|
7218
7378
|
persist();
|
|
7219
|
-
|
|
7379
|
+
notify2();
|
|
7220
7380
|
});
|
|
7221
7381
|
}
|
|
7222
7382
|
|
|
@@ -7243,13 +7403,13 @@ import { useMemo as useMemo5 } from "react";
|
|
|
7243
7403
|
|
|
7244
7404
|
// src/catalog/CatalogContext.tsx
|
|
7245
7405
|
import { createContext as createContext9, useContext as useContext9 } from "react";
|
|
7246
|
-
import { jsx as
|
|
7406
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
7247
7407
|
var CatalogContext = createContext9({});
|
|
7248
7408
|
function CatalogProvider({
|
|
7249
7409
|
catalog,
|
|
7250
7410
|
children
|
|
7251
7411
|
}) {
|
|
7252
|
-
return /* @__PURE__ */
|
|
7412
|
+
return /* @__PURE__ */ jsx7(CatalogContext.Provider, { value: catalog, children });
|
|
7253
7413
|
}
|
|
7254
7414
|
function useComponentCatalog() {
|
|
7255
7415
|
return useContext9(CatalogContext);
|
|
@@ -7312,10 +7472,10 @@ function useAgentPresence(flowId = PRESENCE_FLOW) {
|
|
|
7312
7472
|
}
|
|
7313
7473
|
|
|
7314
7474
|
// src/widgets/presence/use-forget-fact.ts
|
|
7315
|
-
import * as
|
|
7475
|
+
import * as React18 from "react";
|
|
7316
7476
|
|
|
7317
7477
|
// src/widgets/presence/use-optimistic-flow-set.ts
|
|
7318
|
-
import * as
|
|
7478
|
+
import * as React17 from "react";
|
|
7319
7479
|
function readKeys(data) {
|
|
7320
7480
|
if (typeof data !== "object" || data === null || !("keys" in data)) return [];
|
|
7321
7481
|
const raw = data.keys;
|
|
@@ -7324,8 +7484,8 @@ function readKeys(data) {
|
|
|
7324
7484
|
function useOptimisticFlowSet(flowId) {
|
|
7325
7485
|
const keys = readKeys(useAgentFlow(flowId));
|
|
7326
7486
|
const joined = keys.join("\0");
|
|
7327
|
-
const set =
|
|
7328
|
-
return
|
|
7487
|
+
const set = React17.useMemo(() => new Set(keys), [joined]);
|
|
7488
|
+
return React17.useMemo(
|
|
7329
7489
|
() => ({
|
|
7330
7490
|
has: (key) => set.has(key),
|
|
7331
7491
|
add: (key) => {
|
|
@@ -7341,7 +7501,7 @@ function useOptimisticFlowSet(flowId) {
|
|
|
7341
7501
|
function useReconcileFlowSet(flowId, presentKeys) {
|
|
7342
7502
|
const data = useAgentFlow(flowId);
|
|
7343
7503
|
const presentJoined = presentKeys === null ? null : [...presentKeys].join("\0");
|
|
7344
|
-
|
|
7504
|
+
React17.useEffect(() => {
|
|
7345
7505
|
if (presentKeys === null) return;
|
|
7346
7506
|
const keys = readKeys(data);
|
|
7347
7507
|
if (keys.length === 0) return;
|
|
@@ -7363,7 +7523,7 @@ var useUndismissedFacts = useVisibleFactList;
|
|
|
7363
7523
|
function useForgetFact() {
|
|
7364
7524
|
const { sendImmediateSignal } = useFourtySession();
|
|
7365
7525
|
const dismissed = useOptimisticFlowSet(DISMISSED_FLOW);
|
|
7366
|
-
const forget =
|
|
7526
|
+
const forget = React18.useCallback(
|
|
7367
7527
|
(f) => {
|
|
7368
7528
|
dismissed.add(f.label);
|
|
7369
7529
|
sendImmediateSignal({ type: PRESENCE_FACT_DISMISS_SIGNAL, payload: { label: f.label, value: f.value } });
|
|
@@ -7414,7 +7574,7 @@ function useConversationPage() {
|
|
|
7414
7574
|
const presence = useConversationPresence();
|
|
7415
7575
|
const suggestions = useSuggestionsWithDefaults();
|
|
7416
7576
|
const followUp = useComposerChipSelect();
|
|
7417
|
-
const onWelcomePage =
|
|
7577
|
+
const onWelcomePage = React19.useMemo(
|
|
7418
7578
|
() => seedLayout !== null && JSON.stringify(layout) === JSON.stringify(seedLayout),
|
|
7419
7579
|
[layout, seedLayout]
|
|
7420
7580
|
);
|
|
@@ -7441,7 +7601,8 @@ function useConversationPage() {
|
|
|
7441
7601
|
index: shown.index,
|
|
7442
7602
|
question: shown.visitorText,
|
|
7443
7603
|
headline: answer.headline,
|
|
7444
|
-
body
|
|
7604
|
+
// Its closing question is `ask`'s line, so the body never repeats it.
|
|
7605
|
+
body: shown.streams.ask === void 0 ? answer.body : withoutClosingQuestion(answer.body),
|
|
7445
7606
|
ask: shown.streams.ask,
|
|
7446
7607
|
answerable: settledNewest,
|
|
7447
7608
|
live: live !== null,
|
|
@@ -7482,14 +7643,14 @@ function findThreadHeadroom(scroller) {
|
|
|
7482
7643
|
}
|
|
7483
7644
|
|
|
7484
7645
|
// src/shell/thread-scroll/ThreadHeadroom.tsx
|
|
7485
|
-
import { jsx as
|
|
7646
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
7486
7647
|
var HEADROOM_STYLE = { height: 0, flexShrink: 0 };
|
|
7487
7648
|
function ThreadHeadroom() {
|
|
7488
|
-
return /* @__PURE__ */
|
|
7649
|
+
return /* @__PURE__ */ jsx8("div", { ...{ [THREAD_HEADROOM_ATTR]: "" }, "aria-hidden": true, style: HEADROOM_STYLE });
|
|
7489
7650
|
}
|
|
7490
7651
|
|
|
7491
7652
|
// src/shell/thread-scroll/use-pin-turn-to-top.ts
|
|
7492
|
-
import * as
|
|
7653
|
+
import * as React20 from "react";
|
|
7493
7654
|
|
|
7494
7655
|
// src/canvas/dom-targets.ts
|
|
7495
7656
|
var ACTIVE_PANEL_ATTR = "data-fourty-panel-active";
|
|
@@ -7666,7 +7827,7 @@ function pinTurnHead(scroller, row, options) {
|
|
|
7666
7827
|
|
|
7667
7828
|
// src/shell/thread-scroll/use-pin-turn-to-top.ts
|
|
7668
7829
|
function usePinTurnToTop({ scrollerRef, turnRef, turnId }) {
|
|
7669
|
-
|
|
7830
|
+
React20.useEffect(() => {
|
|
7670
7831
|
if (turnId === null) return;
|
|
7671
7832
|
const scroller = scrollerRef.current;
|
|
7672
7833
|
const row = turnRef.current;
|
|
@@ -7687,10 +7848,10 @@ function usePinTurnToTop({ scrollerRef, turnRef, turnId }) {
|
|
|
7687
7848
|
}
|
|
7688
7849
|
|
|
7689
7850
|
// src/shell/thread-scroll/use-scroll-has-more-below.ts
|
|
7690
|
-
import * as
|
|
7851
|
+
import * as React21 from "react";
|
|
7691
7852
|
function useScrollHasMoreBelow(scroller, thresholdPx = 16) {
|
|
7692
|
-
const [hasMore, setHasMore] =
|
|
7693
|
-
|
|
7853
|
+
const [hasMore, setHasMore] = React21.useState(false);
|
|
7854
|
+
React21.useEffect(() => {
|
|
7694
7855
|
if (scroller === null) return;
|
|
7695
7856
|
const view = scroller.ownerDocument.defaultView;
|
|
7696
7857
|
if (view === null) return;
|
|
@@ -7730,9 +7891,9 @@ function threadRowAttrs(key) {
|
|
|
7730
7891
|
}
|
|
7731
7892
|
|
|
7732
7893
|
// src/shell/thread-scroll/use-thread-jump-marks.ts
|
|
7733
|
-
import * as
|
|
7894
|
+
import * as React22 from "react";
|
|
7734
7895
|
function useThreadJumpMarks(rows) {
|
|
7735
|
-
return
|
|
7896
|
+
return React22.useMemo(
|
|
7736
7897
|
() => rows.filter((row) => row.visitorText.length > 0).map((row) => ({
|
|
7737
7898
|
key: row.key,
|
|
7738
7899
|
label: row.visitorText,
|
|
@@ -7746,7 +7907,7 @@ function useThreadJumpMarks(rows) {
|
|
|
7746
7907
|
}
|
|
7747
7908
|
|
|
7748
7909
|
// src/shell/thread-scroll/use-thread-landing.ts
|
|
7749
|
-
import * as
|
|
7910
|
+
import * as React23 from "react";
|
|
7750
7911
|
|
|
7751
7912
|
// src/shell/thread-scroll/settle-thread-row.ts
|
|
7752
7913
|
var SETTLE_MS = 1200;
|
|
@@ -7810,11 +7971,11 @@ function settleThreadRow(scroller, rowKey, behavior = "smooth") {
|
|
|
7810
7971
|
}
|
|
7811
7972
|
|
|
7812
7973
|
// src/shell/thread-scroll/use-thread-landing.ts
|
|
7813
|
-
var useIsomorphicLayoutEffect = typeof window === "undefined" ?
|
|
7974
|
+
var useIsomorphicLayoutEffect = typeof window === "undefined" ? React23.useEffect : React23.useLayoutEffect;
|
|
7814
7975
|
function useThreadLanding(scroller, relandKey = 0) {
|
|
7815
7976
|
const { turnId, seq } = useExplicitTurnSelection();
|
|
7816
|
-
const openedWith =
|
|
7817
|
-
const landedRef =
|
|
7977
|
+
const openedWith = React23.useRef({ turnId, seq });
|
|
7978
|
+
const landedRef = React23.useRef(null);
|
|
7818
7979
|
useIsomorphicLayoutEffect(() => {
|
|
7819
7980
|
if (scroller === null) return;
|
|
7820
7981
|
if (turnId !== null) {
|
|
@@ -7869,7 +8030,7 @@ function useRegisterSignalHandlers(handlers) {
|
|
|
7869
8030
|
var AGENT_ASK_SIGNAL = "agent_ask";
|
|
7870
8031
|
|
|
7871
8032
|
// src/provider/use-clamp-toggle.ts
|
|
7872
|
-
import
|
|
8033
|
+
import React24 from "react";
|
|
7873
8034
|
|
|
7874
8035
|
// src/shared/use-expandable.ts
|
|
7875
8036
|
import { useCallback as useCallback10, useState as useState5 } from "react";
|
|
@@ -7882,9 +8043,9 @@ function useExpandable(initial = false) {
|
|
|
7882
8043
|
// src/provider/use-clamp-toggle.ts
|
|
7883
8044
|
function useClampToggle(contentKey) {
|
|
7884
8045
|
const { expanded, toggle } = useExpandable(false);
|
|
7885
|
-
const [overflowing, setOverflowing] =
|
|
7886
|
-
const ref =
|
|
7887
|
-
|
|
8046
|
+
const [overflowing, setOverflowing] = React24.useState(false);
|
|
8047
|
+
const ref = React24.useRef(null);
|
|
8048
|
+
React24.useEffect(() => {
|
|
7888
8049
|
const el = ref.current;
|
|
7889
8050
|
if (el === null) return;
|
|
7890
8051
|
if (expanded) return;
|
|
@@ -7900,16 +8061,16 @@ function useClampToggle(contentKey) {
|
|
|
7900
8061
|
}
|
|
7901
8062
|
|
|
7902
8063
|
// src/provider/use-timed-flag.ts
|
|
7903
|
-
import
|
|
8064
|
+
import React25 from "react";
|
|
7904
8065
|
function useTimedFlag(durationMs) {
|
|
7905
|
-
const [flag, setFlag] =
|
|
7906
|
-
const timerRef =
|
|
7907
|
-
|
|
8066
|
+
const [flag, setFlag] = React25.useState(false);
|
|
8067
|
+
const timerRef = React25.useRef(null);
|
|
8068
|
+
React25.useEffect(() => {
|
|
7908
8069
|
return () => {
|
|
7909
8070
|
if (timerRef.current !== null) window.clearTimeout(timerRef.current);
|
|
7910
8071
|
};
|
|
7911
8072
|
}, []);
|
|
7912
|
-
const trigger =
|
|
8073
|
+
const trigger = React25.useCallback(() => {
|
|
7913
8074
|
if (timerRef.current !== null) window.clearTimeout(timerRef.current);
|
|
7914
8075
|
setFlag(true);
|
|
7915
8076
|
timerRef.current = window.setTimeout(() => {
|
|
@@ -7926,6 +8087,8 @@ __export(canvas_exports, {
|
|
|
7926
8087
|
ACTIVE_PANEL_ATTR: () => ACTIVE_PANEL_ATTR,
|
|
7927
8088
|
ACTIVE_PANEL_SELECTOR: () => ACTIVE_PANEL_SELECTOR,
|
|
7928
8089
|
CanvasArrangementProvider: () => CanvasArrangementProvider,
|
|
8090
|
+
CanvasLeadProvider: () => CanvasLeadProvider,
|
|
8091
|
+
CanvasLeadSlot: () => CanvasLeadSlot,
|
|
7929
8092
|
CanvasMotionStyleProvider: () => CanvasMotionStyleProvider,
|
|
7930
8093
|
CanvasOutletProvider: () => CanvasOutletProvider,
|
|
7931
8094
|
CanvasTailMount: () => CanvasTailMount,
|
|
@@ -7977,6 +8140,8 @@ __export(canvas_exports, {
|
|
|
7977
8140
|
useCanvasArrangement: () => useCanvasArrangement,
|
|
7978
8141
|
useCanvasBack: () => useCanvasBack,
|
|
7979
8142
|
useCanvasForward: () => useCanvasForward,
|
|
8143
|
+
useCanvasLead: () => useCanvasLead,
|
|
8144
|
+
useCanvasLeadTarget: () => useCanvasLeadTarget,
|
|
7980
8145
|
useCanvasMotionStyle: () => useCanvasMotionStyle,
|
|
7981
8146
|
useCanvasTail: () => useCanvasTail,
|
|
7982
8147
|
useCanvasViewBack: () => useCanvasViewBack,
|
|
@@ -8022,35 +8187,35 @@ __export(canvas_exports, {
|
|
|
8022
8187
|
});
|
|
8023
8188
|
|
|
8024
8189
|
// src/canvas/canvas-tail.tsx
|
|
8025
|
-
import * as
|
|
8026
|
-
import { jsx as
|
|
8027
|
-
var CanvasTailContext =
|
|
8190
|
+
import * as React26 from "react";
|
|
8191
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
8192
|
+
var CanvasTailContext = React26.createContext(null);
|
|
8028
8193
|
function CanvasTailProvider({
|
|
8029
8194
|
tail,
|
|
8030
8195
|
children
|
|
8031
8196
|
}) {
|
|
8032
|
-
return /* @__PURE__ */
|
|
8197
|
+
return /* @__PURE__ */ jsx9(CanvasTailContext.Provider, { value: tail, children });
|
|
8033
8198
|
}
|
|
8034
8199
|
function useCanvasTail() {
|
|
8035
|
-
return
|
|
8200
|
+
return React26.useContext(CanvasTailContext);
|
|
8036
8201
|
}
|
|
8037
8202
|
function CanvasTailMount({
|
|
8038
8203
|
isActive
|
|
8039
8204
|
}) {
|
|
8040
8205
|
const Tail = useCanvasTail();
|
|
8041
8206
|
if (!isActive || Tail === null) return null;
|
|
8042
|
-
return /* @__PURE__ */
|
|
8207
|
+
return /* @__PURE__ */ jsx9(Tail, {});
|
|
8043
8208
|
}
|
|
8044
8209
|
|
|
8045
8210
|
// src/canvas/hydration-notice.tsx
|
|
8046
|
-
import * as
|
|
8047
|
-
import { jsx as
|
|
8048
|
-
var HydrationNoticeContext =
|
|
8211
|
+
import * as React27 from "react";
|
|
8212
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
8213
|
+
var HydrationNoticeContext = React27.createContext(null);
|
|
8049
8214
|
function HydrationNoticeProvider({ notice, children }) {
|
|
8050
|
-
return /* @__PURE__ */
|
|
8215
|
+
return /* @__PURE__ */ jsx10(HydrationNoticeContext.Provider, { value: notice, children });
|
|
8051
8216
|
}
|
|
8052
8217
|
function useHydrationNotice() {
|
|
8053
|
-
return
|
|
8218
|
+
return React27.useContext(HydrationNoticeContext);
|
|
8054
8219
|
}
|
|
8055
8220
|
|
|
8056
8221
|
// src/canvas/GenerationStyleContext.tsx
|
|
@@ -8088,11 +8253,11 @@ function useGenerationStyle() {
|
|
|
8088
8253
|
|
|
8089
8254
|
// src/canvas/ShimmerSweep.tsx
|
|
8090
8255
|
import { motion, useReducedMotion } from "framer-motion";
|
|
8091
|
-
import { jsx as
|
|
8256
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
8092
8257
|
function ShimmerSweep({ durationS }) {
|
|
8093
8258
|
const reduce = useReducedMotion();
|
|
8094
8259
|
if (reduce === true) return null;
|
|
8095
|
-
return /* @__PURE__ */
|
|
8260
|
+
return /* @__PURE__ */ jsx11(
|
|
8096
8261
|
motion.div,
|
|
8097
8262
|
{
|
|
8098
8263
|
"aria-hidden": true,
|
|
@@ -8110,14 +8275,14 @@ function ShimmerSweep({ durationS }) {
|
|
|
8110
8275
|
}
|
|
8111
8276
|
|
|
8112
8277
|
// src/canvas/TransitionContext.tsx
|
|
8113
|
-
import
|
|
8278
|
+
import React28, { createContext as createContext14, useContext as useContext14 } from "react";
|
|
8114
8279
|
import { AnimatePresence, motion as motion2 } from "framer-motion";
|
|
8115
|
-
import { jsx as
|
|
8280
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
8116
8281
|
function FadeGroup({ children }) {
|
|
8117
|
-
return /* @__PURE__ */
|
|
8282
|
+
return /* @__PURE__ */ jsx12(AnimatePresence, { mode: "popLayout", initial: false, children });
|
|
8118
8283
|
}
|
|
8119
|
-
var FadeItem =
|
|
8120
|
-
return /* @__PURE__ */
|
|
8284
|
+
var FadeItem = React28.forwardRef(function FadeItem2({ id, children, style, className }, ref) {
|
|
8285
|
+
return /* @__PURE__ */ jsx12(
|
|
8121
8286
|
motion2.div,
|
|
8122
8287
|
{
|
|
8123
8288
|
ref,
|
|
@@ -8137,44 +8302,76 @@ function TransitionProvider({
|
|
|
8137
8302
|
transition,
|
|
8138
8303
|
children
|
|
8139
8304
|
}) {
|
|
8140
|
-
return /* @__PURE__ */
|
|
8305
|
+
return /* @__PURE__ */ jsx12(TransitionContext.Provider, { value: transition, children });
|
|
8141
8306
|
}
|
|
8142
8307
|
function useLayoutTransition() {
|
|
8143
8308
|
return useContext14(TransitionContext);
|
|
8144
8309
|
}
|
|
8145
8310
|
|
|
8146
8311
|
// src/canvas/canvas-arrangement.tsx
|
|
8147
|
-
import
|
|
8148
|
-
import { jsx as
|
|
8312
|
+
import React29, { createContext as createContext15, useContext as useContext15 } from "react";
|
|
8313
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
8149
8314
|
var CanvasArrangementContext = createContext15({ arrangement: "stack", turnPages: false });
|
|
8150
8315
|
function CanvasArrangementProvider({
|
|
8151
8316
|
arrangement,
|
|
8152
8317
|
turnPages = false,
|
|
8153
8318
|
children
|
|
8154
8319
|
}) {
|
|
8155
|
-
const value =
|
|
8156
|
-
return /* @__PURE__ */
|
|
8320
|
+
const value = React29.useMemo(() => ({ arrangement, turnPages }), [arrangement, turnPages]);
|
|
8321
|
+
return /* @__PURE__ */ jsx13(CanvasArrangementContext.Provider, { value, children });
|
|
8157
8322
|
}
|
|
8158
8323
|
function useCanvasArrangement() {
|
|
8159
8324
|
return useContext15(CanvasArrangementContext);
|
|
8160
8325
|
}
|
|
8161
8326
|
|
|
8327
|
+
// src/canvas/canvas-lead.tsx
|
|
8328
|
+
import * as React30 from "react";
|
|
8329
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
8330
|
+
var NO_TYPES = [];
|
|
8331
|
+
var CanvasLeadContext = React30.createContext(null);
|
|
8332
|
+
function CanvasLeadProvider({ types, children }) {
|
|
8333
|
+
const [target, setTarget] = React30.useState(null);
|
|
8334
|
+
const [leadId, setLeadId] = React30.useState(null);
|
|
8335
|
+
const value = React30.useMemo(() => ({ types, target, setTarget, leadId, setLeadId }), [types, target, leadId]);
|
|
8336
|
+
return /* @__PURE__ */ jsx14(CanvasLeadContext.Provider, { value, children });
|
|
8337
|
+
}
|
|
8338
|
+
function CanvasLeadSlot({ className }) {
|
|
8339
|
+
const lead = React30.useContext(CanvasLeadContext);
|
|
8340
|
+
if (lead === null) throw new Error("<CanvasLeadSlot> must be rendered inside <CanvasLeadProvider>.");
|
|
8341
|
+
const { setTarget } = lead;
|
|
8342
|
+
const ref = React30.useCallback((el) => setTarget(el), [setTarget]);
|
|
8343
|
+
return /* @__PURE__ */ jsx14("div", { ref, className, "data-fourty-canvas-lead": "" });
|
|
8344
|
+
}
|
|
8345
|
+
function useCanvasLead() {
|
|
8346
|
+
const lead = React30.useContext(CanvasLeadContext);
|
|
8347
|
+
return { present: lead !== null && lead.target !== null && lead.leadId !== null };
|
|
8348
|
+
}
|
|
8349
|
+
function useCanvasLeadTarget() {
|
|
8350
|
+
const lead = React30.useContext(CanvasLeadContext);
|
|
8351
|
+
const setLeadId = lead === null ? null : lead.setLeadId;
|
|
8352
|
+
const report = React30.useCallback((id) => {
|
|
8353
|
+
if (setLeadId !== null) setLeadId(id);
|
|
8354
|
+
}, [setLeadId]);
|
|
8355
|
+
if (lead === null) return { types: NO_TYPES, target: null, report };
|
|
8356
|
+
return { types: lead.types, target: lead.target, report };
|
|
8357
|
+
}
|
|
8358
|
+
|
|
8162
8359
|
// src/canvas/canvas-motion-style.tsx
|
|
8163
|
-
import { createContext as
|
|
8164
|
-
import { jsx as
|
|
8165
|
-
var CanvasMotionStyleContext =
|
|
8360
|
+
import { createContext as createContext17, useContext as useContext17 } from "react";
|
|
8361
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
8362
|
+
var CanvasMotionStyleContext = createContext17(null);
|
|
8166
8363
|
function CanvasMotionStyleProvider({ style, children }) {
|
|
8167
|
-
return /* @__PURE__ */
|
|
8364
|
+
return /* @__PURE__ */ jsx15(CanvasMotionStyleContext.Provider, { value: style, children });
|
|
8168
8365
|
}
|
|
8169
8366
|
function useCanvasMotionStyle() {
|
|
8170
|
-
return
|
|
8367
|
+
return useContext17(CanvasMotionStyleContext);
|
|
8171
8368
|
}
|
|
8172
8369
|
|
|
8173
8370
|
// src/canvas/ElementIdContext.ts
|
|
8174
|
-
import { createContext as
|
|
8175
|
-
var ElementIdContext =
|
|
8371
|
+
import { createContext as createContext18, useContext as useContext18 } from "react";
|
|
8372
|
+
var ElementIdContext = createContext18(null);
|
|
8176
8373
|
function useElementId() {
|
|
8177
|
-
return
|
|
8374
|
+
return useContext18(ElementIdContext);
|
|
8178
8375
|
}
|
|
8179
8376
|
|
|
8180
8377
|
// src/canvas/generation-entrance.ts
|
|
@@ -8248,27 +8445,27 @@ var INITIAL_NAV_PRESENTATION = {
|
|
|
8248
8445
|
};
|
|
8249
8446
|
|
|
8250
8447
|
// src/canvas/use-canvas-actions.ts
|
|
8251
|
-
import { useCallback as
|
|
8448
|
+
import { useCallback as useCallback12 } from "react";
|
|
8252
8449
|
function navigateActionId(page) {
|
|
8253
8450
|
const id = Reflect.get(page, "id");
|
|
8254
8451
|
return typeof id === "string" ? `navigate-${page.kind}-${id}` : `navigate-${page.kind}`;
|
|
8255
8452
|
}
|
|
8256
8453
|
function useCanvasActions() {
|
|
8257
8454
|
const session = useOptionalFourtySession();
|
|
8258
|
-
const dispatchAction =
|
|
8455
|
+
const dispatchAction = useCallback12(
|
|
8259
8456
|
(action) => {
|
|
8260
8457
|
if (!session) return;
|
|
8261
8458
|
session.dispatchSuggestionAction(action);
|
|
8262
8459
|
},
|
|
8263
8460
|
[session]
|
|
8264
8461
|
);
|
|
8265
|
-
const navigate =
|
|
8462
|
+
const navigate = useCallback12(
|
|
8266
8463
|
(page, label) => {
|
|
8267
8464
|
dispatchAction({ id: navigateActionId(page), label, type: NAVIGATE_SIGNAL, payload: { page } });
|
|
8268
8465
|
},
|
|
8269
8466
|
[dispatchAction]
|
|
8270
8467
|
);
|
|
8271
|
-
const ask =
|
|
8468
|
+
const ask = useCallback12(
|
|
8272
8469
|
(text2, label) => {
|
|
8273
8470
|
dispatchAction({ id: `ask-${label}`, label, type: "message", payload: { text: text2 } });
|
|
8274
8471
|
},
|
|
@@ -8434,22 +8631,22 @@ function deriveTurnChangeAnchor(prev, next) {
|
|
|
8434
8631
|
}
|
|
8435
8632
|
|
|
8436
8633
|
// src/canvas/canvas-outlet.tsx
|
|
8437
|
-
import { createContext as
|
|
8438
|
-
import { jsx as
|
|
8439
|
-
var CanvasOutletContext =
|
|
8634
|
+
import { createContext as createContext19, useContext as useContext19 } from "react";
|
|
8635
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
8636
|
+
var CanvasOutletContext = createContext19(null);
|
|
8440
8637
|
function CanvasOutletProvider({ canvas, children }) {
|
|
8441
|
-
return /* @__PURE__ */
|
|
8638
|
+
return /* @__PURE__ */ jsx16(CanvasOutletContext.Provider, { value: canvas, children });
|
|
8442
8639
|
}
|
|
8443
8640
|
function SpacefrontCanvas() {
|
|
8444
|
-
const Canvas =
|
|
8641
|
+
const Canvas = useContext19(CanvasOutletContext);
|
|
8445
8642
|
if (Canvas === null) {
|
|
8446
8643
|
throw new Error("<SpacefrontCanvas> must be rendered inside <Spacefront> \u2014 no engine has provided a canvas.");
|
|
8447
8644
|
}
|
|
8448
|
-
return /* @__PURE__ */
|
|
8645
|
+
return /* @__PURE__ */ jsx16(Canvas, {});
|
|
8449
8646
|
}
|
|
8450
8647
|
|
|
8451
8648
|
// src/canvas/item-motion/ItemTransitionGroup.tsx
|
|
8452
|
-
import
|
|
8649
|
+
import React32 from "react";
|
|
8453
8650
|
import { AnimatePresence as AnimatePresence2, motion as motion3, useReducedMotion as useReducedMotion2 } from "framer-motion";
|
|
8454
8651
|
|
|
8455
8652
|
// src/canvas/item-motion/classify-items.ts
|
|
@@ -8668,7 +8865,7 @@ function getActiveProfile() {
|
|
|
8668
8865
|
}
|
|
8669
8866
|
|
|
8670
8867
|
// src/canvas/item-motion/ItemTransitionGroup.tsx
|
|
8671
|
-
import { jsx as
|
|
8868
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
8672
8869
|
var ITEM_IDENTITY_ATTR = "data-flip-id";
|
|
8673
8870
|
function ItemTransitionGroup({
|
|
8674
8871
|
items,
|
|
@@ -8683,14 +8880,14 @@ function ItemTransitionGroup({
|
|
|
8683
8880
|
const profile = getActiveProfile();
|
|
8684
8881
|
const animated = reduce !== true;
|
|
8685
8882
|
const ids = items.map(getId);
|
|
8686
|
-
const prevIdsRef =
|
|
8687
|
-
const lastChangeRef =
|
|
8883
|
+
const prevIdsRef = React32.useRef(null);
|
|
8884
|
+
const lastChangeRef = React32.useRef(null);
|
|
8688
8885
|
const prevIds = prevIdsRef.current;
|
|
8689
8886
|
const freshChange = prevIds === null ? null : classifyItemChange(prevIds, ids);
|
|
8690
8887
|
if (freshChange !== null) {
|
|
8691
8888
|
lastChangeRef.current = freshChange;
|
|
8692
8889
|
}
|
|
8693
|
-
|
|
8890
|
+
React32.useEffect(() => {
|
|
8694
8891
|
prevIdsRef.current = ids;
|
|
8695
8892
|
});
|
|
8696
8893
|
const activeChange = lastChangeRef.current;
|
|
@@ -8703,7 +8900,7 @@ function ItemTransitionGroup({
|
|
|
8703
8900
|
const isGrid = itemClassName === void 0;
|
|
8704
8901
|
const outerClassName = isGrid ? "h-full" : itemClassName;
|
|
8705
8902
|
const innerClassName = isGrid ? "h-full" : void 0;
|
|
8706
|
-
return /* @__PURE__ */
|
|
8903
|
+
return /* @__PURE__ */ jsx17("div", { className, style, children: /* @__PURE__ */ jsx17(AnimatePresence2, { mode: "popLayout", initial: false, children: items.map((item) => {
|
|
8707
8904
|
const id = getId(item);
|
|
8708
8905
|
const identityAttr = { [ITEM_IDENTITY_ATTR]: id };
|
|
8709
8906
|
const isEntering = activeChange !== null && activeChange.entered.includes(id);
|
|
@@ -8713,7 +8910,7 @@ function ItemTransitionGroup({
|
|
|
8713
8910
|
// `itemClassName`/`itemStyle` size the wrapper for flex/snap
|
|
8714
8911
|
// layouts (carousel); grid layouts leave them unset and get
|
|
8715
8912
|
// `h-full` so the cell height reaches the card.
|
|
8716
|
-
/* @__PURE__ */
|
|
8913
|
+
/* @__PURE__ */ jsx17(
|
|
8717
8914
|
motion3.div,
|
|
8718
8915
|
{
|
|
8719
8916
|
...identityAttr,
|
|
@@ -8722,7 +8919,7 @@ function ItemTransitionGroup({
|
|
|
8722
8919
|
layout: animated ? "position" : void 0,
|
|
8723
8920
|
layoutDependency,
|
|
8724
8921
|
transition: animated ? layoutTransition : void 0,
|
|
8725
|
-
children: /* @__PURE__ */
|
|
8922
|
+
children: /* @__PURE__ */ jsx17(
|
|
8726
8923
|
motion3.div,
|
|
8727
8924
|
{
|
|
8728
8925
|
className: innerClassName,
|
|
@@ -8802,21 +8999,21 @@ __export(catalog_exports, {
|
|
|
8802
8999
|
});
|
|
8803
9000
|
|
|
8804
9001
|
// src/catalog/DebugContext.tsx
|
|
8805
|
-
import { createContext as
|
|
8806
|
-
import { jsx as
|
|
8807
|
-
var DebugContext =
|
|
9002
|
+
import { createContext as createContext20, useContext as useContext20 } from "react";
|
|
9003
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
9004
|
+
var DebugContext = createContext20(false);
|
|
8808
9005
|
function DebugProvider({
|
|
8809
9006
|
debug,
|
|
8810
9007
|
children
|
|
8811
9008
|
}) {
|
|
8812
|
-
return /* @__PURE__ */
|
|
9009
|
+
return /* @__PURE__ */ jsx18(DebugContext.Provider, { value: debug, children });
|
|
8813
9010
|
}
|
|
8814
9011
|
function useDebug() {
|
|
8815
|
-
return
|
|
9012
|
+
return useContext20(DebugContext);
|
|
8816
9013
|
}
|
|
8817
9014
|
|
|
8818
9015
|
// src/catalog/HydrationStateContext.tsx
|
|
8819
|
-
import { createContext as
|
|
9016
|
+
import { createContext as createContext21, useContext as useContext21 } from "react";
|
|
8820
9017
|
var DEFAULT_STATE = {
|
|
8821
9018
|
hasResolvedFields: false,
|
|
8822
9019
|
hydrating: false,
|
|
@@ -8826,47 +9023,47 @@ var DEFAULT_STATE = {
|
|
|
8826
9023
|
pendingCount: 0,
|
|
8827
9024
|
errors: []
|
|
8828
9025
|
};
|
|
8829
|
-
var HydrationStateContext =
|
|
9026
|
+
var HydrationStateContext = createContext21(DEFAULT_STATE);
|
|
8830
9027
|
function useHydrationState() {
|
|
8831
|
-
return
|
|
9028
|
+
return useContext21(HydrationStateContext);
|
|
8832
9029
|
}
|
|
8833
9030
|
|
|
8834
9031
|
// src/catalog/HydratorContext.tsx
|
|
8835
|
-
import { createContext as
|
|
8836
|
-
import { jsx as
|
|
8837
|
-
var HydratorContext =
|
|
9032
|
+
import { createContext as createContext22, useContext as useContext22 } from "react";
|
|
9033
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
9034
|
+
var HydratorContext = createContext22({});
|
|
8838
9035
|
function HydratorProvider({
|
|
8839
9036
|
hydrators,
|
|
8840
9037
|
children
|
|
8841
9038
|
}) {
|
|
8842
|
-
return /* @__PURE__ */
|
|
9039
|
+
return /* @__PURE__ */ jsx19(HydratorContext.Provider, { value: hydrators, children });
|
|
8843
9040
|
}
|
|
8844
9041
|
function useHydrators() {
|
|
8845
|
-
return
|
|
9042
|
+
return useContext22(HydratorContext);
|
|
8846
9043
|
}
|
|
8847
9044
|
|
|
8848
9045
|
// src/catalog/registry.tsx
|
|
8849
|
-
import { createContext as
|
|
8850
|
-
import { jsx as
|
|
8851
|
-
var RegistryContext =
|
|
9046
|
+
import { createContext as createContext23, useContext as useContext23 } from "react";
|
|
9047
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
9048
|
+
var RegistryContext = createContext23({});
|
|
8852
9049
|
function RegistryProvider({
|
|
8853
9050
|
registry: registry2,
|
|
8854
9051
|
children
|
|
8855
9052
|
}) {
|
|
8856
|
-
return /* @__PURE__ */
|
|
9053
|
+
return /* @__PURE__ */ jsx20(RegistryContext.Provider, { value: registry2, children });
|
|
8857
9054
|
}
|
|
8858
9055
|
function useRegistry() {
|
|
8859
|
-
return
|
|
9056
|
+
return useContext23(RegistryContext);
|
|
8860
9057
|
}
|
|
8861
|
-
var PackageLookupContext =
|
|
9058
|
+
var PackageLookupContext = createContext23(null);
|
|
8862
9059
|
function PackageLookupProvider({
|
|
8863
9060
|
lookup,
|
|
8864
9061
|
children
|
|
8865
9062
|
}) {
|
|
8866
|
-
return /* @__PURE__ */
|
|
9063
|
+
return /* @__PURE__ */ jsx20(PackageLookupContext.Provider, { value: lookup, children });
|
|
8867
9064
|
}
|
|
8868
9065
|
function usePackageLookup() {
|
|
8869
|
-
return
|
|
9066
|
+
return useContext23(PackageLookupContext);
|
|
8870
9067
|
}
|
|
8871
9068
|
function createAliasedRegistry(baseRegistry, aliases, getPackageComponent) {
|
|
8872
9069
|
return new Proxy(baseRegistry, {
|
|
@@ -8897,9 +9094,9 @@ function createAliasedRegistry(baseRegistry, aliases, getPackageComponent) {
|
|
|
8897
9094
|
}
|
|
8898
9095
|
|
|
8899
9096
|
// src/catalog/render-inline.tsx
|
|
8900
|
-
import
|
|
8901
|
-
import { jsx as
|
|
8902
|
-
var linkRenderer = (href, key) => /* @__PURE__ */
|
|
9097
|
+
import React35 from "react";
|
|
9098
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
9099
|
+
var linkRenderer = (href, key) => /* @__PURE__ */ jsx21(
|
|
8903
9100
|
"a",
|
|
8904
9101
|
{
|
|
8905
9102
|
className: "fourty-inline-link",
|
|
@@ -8919,14 +9116,14 @@ function linkifyText(text2, keyPrefix) {
|
|
|
8919
9116
|
URL_RE.lastIndex = 0;
|
|
8920
9117
|
while ((match = URL_RE.exec(text2)) !== null) {
|
|
8921
9118
|
if (match.index > last) {
|
|
8922
|
-
out.push(/* @__PURE__ */
|
|
9119
|
+
out.push(/* @__PURE__ */ jsx21(React35.Fragment, { children: text2.slice(last, match.index) }, `${keyPrefix}-lt-${i++}`));
|
|
8923
9120
|
}
|
|
8924
9121
|
const href = match[0];
|
|
8925
9122
|
out.push(linkRenderer(href, `${keyPrefix}-lk-${i++}`));
|
|
8926
9123
|
last = match.index + href.length;
|
|
8927
9124
|
}
|
|
8928
9125
|
if (last < text2.length) {
|
|
8929
|
-
out.push(/* @__PURE__ */
|
|
9126
|
+
out.push(/* @__PURE__ */ jsx21(React35.Fragment, { children: text2.slice(last) }, `${keyPrefix}-lt-${i++}`));
|
|
8930
9127
|
}
|
|
8931
9128
|
return out;
|
|
8932
9129
|
}
|
|
@@ -8939,8 +9136,8 @@ function renderInline(text2, keyPrefix) {
|
|
|
8939
9136
|
while ((match = re.exec(text2)) !== null) {
|
|
8940
9137
|
if (match.index > last) out.push(...linkifyText(text2.slice(last, match.index), `${keyPrefix}-t-${i++}`));
|
|
8941
9138
|
const bold = match[1];
|
|
8942
|
-
if (bold !== void 0) out.push(/* @__PURE__ */
|
|
8943
|
-
else out.push(/* @__PURE__ */
|
|
9139
|
+
if (bold !== void 0) out.push(/* @__PURE__ */ jsx21("strong", { children: bold }, `${keyPrefix}-b-${i++}`));
|
|
9140
|
+
else out.push(/* @__PURE__ */ jsx21("em", { children: match[2] }, `${keyPrefix}-i-${i++}`));
|
|
8944
9141
|
last = match.index + match[0].length;
|
|
8945
9142
|
}
|
|
8946
9143
|
if (last < text2.length) out.push(...linkifyText(text2.slice(last), `${keyPrefix}-t-${i++}`));
|
|
@@ -8948,7 +9145,7 @@ function renderInline(text2, keyPrefix) {
|
|
|
8948
9145
|
}
|
|
8949
9146
|
|
|
8950
9147
|
// src/catalog/component-library.ts
|
|
8951
|
-
import * as
|
|
9148
|
+
import * as React36 from "react";
|
|
8952
9149
|
function displayNameOf(Inner) {
|
|
8953
9150
|
if (typeof Inner === "string") return Inner;
|
|
8954
9151
|
if (typeof Inner.displayName === "string" && Inner.displayName.length > 0) return Inner.displayName;
|
|
@@ -8957,7 +9154,7 @@ function displayNameOf(Inner) {
|
|
|
8957
9154
|
}
|
|
8958
9155
|
function adaptComponent(Inner) {
|
|
8959
9156
|
function Adapted(props) {
|
|
8960
|
-
return
|
|
9157
|
+
return React36.createElement(Inner, props);
|
|
8961
9158
|
}
|
|
8962
9159
|
Adapted.displayName = displayNameOf(Inner);
|
|
8963
9160
|
return Adapted;
|
|
@@ -8998,23 +9195,23 @@ function buildComponentLibrary(catalog, componentMap) {
|
|
|
8998
9195
|
}
|
|
8999
9196
|
|
|
9000
9197
|
// src/catalog/define.ts
|
|
9001
|
-
import { z as
|
|
9002
|
-
var HYDRATED_ENTITY =
|
|
9198
|
+
import { z as z49 } from "zod";
|
|
9199
|
+
var HYDRATED_ENTITY = z49.object({}).passthrough();
|
|
9003
9200
|
function entity(resolverKey, opts) {
|
|
9004
9201
|
return resolved(HYDRATED_ENTITY, resolverKey, opts);
|
|
9005
9202
|
}
|
|
9006
|
-
var text = prose(
|
|
9203
|
+
var text = prose(z49.string());
|
|
9007
9204
|
function plain() {
|
|
9008
|
-
return
|
|
9205
|
+
return z49.string();
|
|
9009
9206
|
}
|
|
9010
9207
|
function token(values) {
|
|
9011
|
-
return
|
|
9208
|
+
return z49.enum(values);
|
|
9012
9209
|
}
|
|
9013
9210
|
function catalogComponent(meta, render) {
|
|
9014
9211
|
const { props, requires, ...rest } = meta;
|
|
9015
9212
|
return {
|
|
9016
9213
|
...rest,
|
|
9017
|
-
propsSchema:
|
|
9214
|
+
propsSchema: z49.object(props),
|
|
9018
9215
|
...requires !== void 0 ? { requires } : {},
|
|
9019
9216
|
component: adaptComponent(render)
|
|
9020
9217
|
};
|
|
@@ -9240,12 +9437,12 @@ __export(presence_exports2, {
|
|
|
9240
9437
|
});
|
|
9241
9438
|
|
|
9242
9439
|
// src/widgets/presence/use-standing-signal.ts
|
|
9243
|
-
import { useMemo as
|
|
9440
|
+
import { useMemo as useMemo10 } from "react";
|
|
9244
9441
|
|
|
9245
9442
|
// src/widgets/presence/core-presence/standing-signal-store.ts
|
|
9246
|
-
import { useSyncExternalStore as
|
|
9443
|
+
import { useSyncExternalStore as useSyncExternalStore4 } from "react";
|
|
9247
9444
|
var current = null;
|
|
9248
|
-
var
|
|
9445
|
+
var listeners3 = /* @__PURE__ */ new Set();
|
|
9249
9446
|
var scope = null;
|
|
9250
9447
|
var seen = /* @__PURE__ */ new Set();
|
|
9251
9448
|
function seenKey(forScope) {
|
|
@@ -9276,13 +9473,13 @@ function bindScope(next) {
|
|
|
9276
9473
|
scope = next;
|
|
9277
9474
|
seen = readSeen(next);
|
|
9278
9475
|
}
|
|
9279
|
-
function
|
|
9280
|
-
for (const listener of
|
|
9476
|
+
function notify3() {
|
|
9477
|
+
for (const listener of listeners3) listener();
|
|
9281
9478
|
}
|
|
9282
|
-
function
|
|
9283
|
-
|
|
9479
|
+
function subscribe3(listener) {
|
|
9480
|
+
listeners3.add(listener);
|
|
9284
9481
|
return () => {
|
|
9285
|
-
|
|
9482
|
+
listeners3.delete(listener);
|
|
9286
9483
|
};
|
|
9287
9484
|
}
|
|
9288
9485
|
function raiseStanding(type, id, payload, signalScope) {
|
|
@@ -9291,7 +9488,7 @@ function raiseStanding(type, id, payload, signalScope) {
|
|
|
9291
9488
|
if (seen.has(id)) return;
|
|
9292
9489
|
if (current !== null) return;
|
|
9293
9490
|
current = { type, id, payload };
|
|
9294
|
-
|
|
9491
|
+
notify3();
|
|
9295
9492
|
}
|
|
9296
9493
|
function resolveStanding(id, signalScope) {
|
|
9297
9494
|
bindScope(signalScope);
|
|
@@ -9299,12 +9496,12 @@ function resolveStanding(id, signalScope) {
|
|
|
9299
9496
|
persistSeen();
|
|
9300
9497
|
if (current !== null && current.id === id) {
|
|
9301
9498
|
current = null;
|
|
9302
|
-
|
|
9499
|
+
notify3();
|
|
9303
9500
|
}
|
|
9304
9501
|
}
|
|
9305
9502
|
function useStandingOfType(type) {
|
|
9306
|
-
return
|
|
9307
|
-
|
|
9503
|
+
return useSyncExternalStore4(
|
|
9504
|
+
subscribe3,
|
|
9308
9505
|
() => current !== null && current.type === type ? current : null,
|
|
9309
9506
|
() => null
|
|
9310
9507
|
);
|
|
@@ -9315,7 +9512,7 @@ if (typeof window !== "undefined") {
|
|
|
9315
9512
|
seen.clear();
|
|
9316
9513
|
persistSeen();
|
|
9317
9514
|
scope = null;
|
|
9318
|
-
|
|
9515
|
+
notify3();
|
|
9319
9516
|
});
|
|
9320
9517
|
}
|
|
9321
9518
|
|
|
@@ -9324,7 +9521,7 @@ function useConsumeStandingSignal(type) {
|
|
|
9324
9521
|
const session = useFourtySession();
|
|
9325
9522
|
const scope2 = session.sessionId === null ? void 0 : session.sessionId;
|
|
9326
9523
|
useRegisterSignalHandlers(
|
|
9327
|
-
|
|
9524
|
+
useMemo10(
|
|
9328
9525
|
() => ({
|
|
9329
9526
|
[type]: (payload) => {
|
|
9330
9527
|
const id = typeof payload.id === "string" && payload.id.length > 0 ? payload.id : type;
|
|
@@ -9335,7 +9532,7 @@ function useConsumeStandingSignal(type) {
|
|
|
9335
9532
|
)
|
|
9336
9533
|
);
|
|
9337
9534
|
const standing = useStandingOfType(type);
|
|
9338
|
-
return
|
|
9535
|
+
return useMemo10(() => {
|
|
9339
9536
|
if (standing === null) return null;
|
|
9340
9537
|
const id = standing.id;
|
|
9341
9538
|
return {
|
|
@@ -9354,7 +9551,7 @@ function useConsumeStandingSignal(type) {
|
|
|
9354
9551
|
}
|
|
9355
9552
|
|
|
9356
9553
|
// src/widgets/presence/use-presence-notch.ts
|
|
9357
|
-
import * as
|
|
9554
|
+
import * as React37 from "react";
|
|
9358
9555
|
var SETTLE_DWELL_MS = 4e3;
|
|
9359
9556
|
var HOVER_CLOSE_MS = 240;
|
|
9360
9557
|
var HOVER_BOUNCE_WINDOW_MS = 800;
|
|
@@ -9362,21 +9559,21 @@ var BOUNCE_PX = 2;
|
|
|
9362
9559
|
function usePresenceNotch(widgets) {
|
|
9363
9560
|
const askStanding = useStandingOfType(AGENT_ASK_SIGNAL) !== null;
|
|
9364
9561
|
const { isRunning } = useAgentPresence();
|
|
9365
|
-
const [hovered, setHovered] =
|
|
9366
|
-
const [openDrawerId, setOpenDrawerId] =
|
|
9367
|
-
const rootRef =
|
|
9368
|
-
const toggleDrawer =
|
|
9562
|
+
const [hovered, setHovered] = React37.useState(false);
|
|
9563
|
+
const [openDrawerId, setOpenDrawerId] = React37.useState(null);
|
|
9564
|
+
const rootRef = React37.useRef(null);
|
|
9565
|
+
const toggleDrawer = React37.useCallback((id) => {
|
|
9369
9566
|
setOpenDrawerId((current2) => current2 === id ? null : id);
|
|
9370
9567
|
}, []);
|
|
9371
|
-
const closeTimer =
|
|
9372
|
-
const cancelClose =
|
|
9568
|
+
const closeTimer = React37.useRef(null);
|
|
9569
|
+
const cancelClose = React37.useCallback(() => {
|
|
9373
9570
|
if (closeTimer.current !== null) {
|
|
9374
9571
|
clearTimeout(closeTimer.current);
|
|
9375
9572
|
closeTimer.current = null;
|
|
9376
9573
|
}
|
|
9377
9574
|
}, []);
|
|
9378
|
-
const lastLeaveRef =
|
|
9379
|
-
const openHover =
|
|
9575
|
+
const lastLeaveRef = React37.useRef(null);
|
|
9576
|
+
const openHover = React37.useCallback((e) => {
|
|
9380
9577
|
const last = lastLeaveRef.current;
|
|
9381
9578
|
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) {
|
|
9382
9579
|
return;
|
|
@@ -9384,7 +9581,7 @@ function usePresenceNotch(widgets) {
|
|
|
9384
9581
|
cancelClose();
|
|
9385
9582
|
setHovered(true);
|
|
9386
9583
|
}, [cancelClose]);
|
|
9387
|
-
const scheduleClose =
|
|
9584
|
+
const scheduleClose = React37.useCallback((e) => {
|
|
9388
9585
|
lastLeaveRef.current = { x: e.clientX, y: e.clientY, t: Date.now() };
|
|
9389
9586
|
cancelClose();
|
|
9390
9587
|
closeTimer.current = setTimeout(() => {
|
|
@@ -9392,8 +9589,8 @@ function usePresenceNotch(widgets) {
|
|
|
9392
9589
|
setHovered(false);
|
|
9393
9590
|
}, HOVER_CLOSE_MS);
|
|
9394
9591
|
}, [cancelClose]);
|
|
9395
|
-
|
|
9396
|
-
|
|
9592
|
+
React37.useEffect(() => cancelClose, [cancelClose]);
|
|
9593
|
+
React37.useEffect(() => {
|
|
9397
9594
|
if (openDrawerId === null) return;
|
|
9398
9595
|
const onKey = (e) => {
|
|
9399
9596
|
if (e.key === "Escape") setOpenDrawerId(null);
|
|
@@ -9401,7 +9598,7 @@ function usePresenceNotch(widgets) {
|
|
|
9401
9598
|
window.addEventListener("keydown", onKey);
|
|
9402
9599
|
return () => window.removeEventListener("keydown", onKey);
|
|
9403
9600
|
}, [openDrawerId]);
|
|
9404
|
-
|
|
9601
|
+
React37.useEffect(() => {
|
|
9405
9602
|
if (openDrawerId === null) return;
|
|
9406
9603
|
const onDown = (e) => {
|
|
9407
9604
|
const root = rootRef.current;
|
|
@@ -9413,8 +9610,8 @@ function usePresenceNotch(widgets) {
|
|
|
9413
9610
|
document.addEventListener("pointerdown", onDown);
|
|
9414
9611
|
return () => document.removeEventListener("pointerdown", onDown);
|
|
9415
9612
|
}, [openDrawerId]);
|
|
9416
|
-
const [active, setActive] =
|
|
9417
|
-
|
|
9613
|
+
const [active, setActive] = React37.useState(false);
|
|
9614
|
+
React37.useEffect(() => {
|
|
9418
9615
|
if (isRunning) {
|
|
9419
9616
|
setActive(true);
|
|
9420
9617
|
return;
|
|
@@ -9574,7 +9771,7 @@ function presenceFactShape(fact) {
|
|
|
9574
9771
|
}
|
|
9575
9772
|
|
|
9576
9773
|
// src/widgets/presence/use-optimistic-facts.ts
|
|
9577
|
-
import * as
|
|
9774
|
+
import * as React38 from "react";
|
|
9578
9775
|
function readEntries(data) {
|
|
9579
9776
|
if (typeof data !== "object" || data === null || !("entries" in data)) return [];
|
|
9580
9777
|
const raw = data.entries;
|
|
@@ -9593,7 +9790,7 @@ function writeOptimisticFact(entries3, fact) {
|
|
|
9593
9790
|
}
|
|
9594
9791
|
function useOptimisticFactOverlay(flowId) {
|
|
9595
9792
|
const entries3 = readEntries(useAgentFlow(flowId));
|
|
9596
|
-
return
|
|
9793
|
+
return React38.useMemo(
|
|
9597
9794
|
() => ({
|
|
9598
9795
|
entries: entries3,
|
|
9599
9796
|
add: (fact) => setFlowOutput(flowId, { entries: writeOptimisticFact(entries3, fact) })
|
|
@@ -9602,8 +9799,8 @@ function useOptimisticFactOverlay(flowId) {
|
|
|
9602
9799
|
);
|
|
9603
9800
|
}
|
|
9604
9801
|
function useReconcileOptimisticFacts(flowId, readIdentity) {
|
|
9605
|
-
const seenRef =
|
|
9606
|
-
|
|
9802
|
+
const seenRef = React38.useRef(null);
|
|
9803
|
+
React38.useEffect(() => {
|
|
9607
9804
|
if (readIdentity === null) return;
|
|
9608
9805
|
if (seenRef.current === null) {
|
|
9609
9806
|
seenRef.current = readIdentity;
|
|
@@ -9775,16 +9972,16 @@ __export(chat_exports, {
|
|
|
9775
9972
|
});
|
|
9776
9973
|
|
|
9777
9974
|
// src/chat/chat-context.ts
|
|
9778
|
-
import { createContext as
|
|
9779
|
-
var FourtyChatContext =
|
|
9975
|
+
import { createContext as createContext24, useContext as useContext24 } from "react";
|
|
9976
|
+
var FourtyChatContext = createContext24(null);
|
|
9780
9977
|
function useFourtyChat() {
|
|
9781
|
-
const ctx =
|
|
9978
|
+
const ctx = useContext24(FourtyChatContext);
|
|
9782
9979
|
if (!ctx) throw new Error("useFourtyChat must be used inside <FourtyChatProvider>");
|
|
9783
9980
|
return ctx;
|
|
9784
9981
|
}
|
|
9785
9982
|
|
|
9786
9983
|
// src/rendering/post-hydration.ts
|
|
9787
|
-
import { useCallback as
|
|
9984
|
+
import { useCallback as useCallback14 } from "react";
|
|
9788
9985
|
var registry = [];
|
|
9789
9986
|
function registerPostHydrationTransform(transform) {
|
|
9790
9987
|
const existing = registry.findIndex((t) => t.id === transform.id);
|
|
@@ -9793,7 +9990,7 @@ function registerPostHydrationTransform(transform) {
|
|
|
9793
9990
|
}
|
|
9794
9991
|
function usePostHydrationTransforms() {
|
|
9795
9992
|
const fns = registry.map((t) => t.use());
|
|
9796
|
-
return
|
|
9993
|
+
return useCallback14(
|
|
9797
9994
|
(props, ctx) => {
|
|
9798
9995
|
let out = props;
|
|
9799
9996
|
for (const fn of fns) {
|
|
@@ -9809,10 +10006,10 @@ function usePostHydrationTransforms() {
|
|
|
9809
10006
|
}
|
|
9810
10007
|
|
|
9811
10008
|
// src/projection/transform.ts
|
|
9812
|
-
import { useMemo as
|
|
10009
|
+
import { useMemo as useMemo12 } from "react";
|
|
9813
10010
|
|
|
9814
10011
|
// src/projection/preferences.ts
|
|
9815
|
-
import { useSyncExternalStore as
|
|
10012
|
+
import { useSyncExternalStore as useSyncExternalStore5 } from "react";
|
|
9816
10013
|
var STORAGE_KEY2 = "fourty.projection.preferences";
|
|
9817
10014
|
var storage2 = createSessionStorageAdapter();
|
|
9818
10015
|
function load2() {
|
|
@@ -9827,22 +10024,22 @@ function load2() {
|
|
|
9827
10024
|
}
|
|
9828
10025
|
}
|
|
9829
10026
|
var preferences = load2();
|
|
9830
|
-
var
|
|
10027
|
+
var listeners4 = /* @__PURE__ */ new Set();
|
|
9831
10028
|
registerSessionScopedClear(() => {
|
|
9832
10029
|
preferences = {};
|
|
9833
10030
|
storage2.remove(STORAGE_KEY2);
|
|
9834
|
-
|
|
10031
|
+
notify4();
|
|
9835
10032
|
});
|
|
9836
|
-
function
|
|
9837
|
-
for (const listener of
|
|
10033
|
+
function notify4() {
|
|
10034
|
+
for (const listener of listeners4) listener();
|
|
9838
10035
|
}
|
|
9839
10036
|
function getProjectionPreferences() {
|
|
9840
10037
|
return preferences;
|
|
9841
10038
|
}
|
|
9842
10039
|
function subscribeProjectionPreferences(listener) {
|
|
9843
|
-
|
|
10040
|
+
listeners4.add(listener);
|
|
9844
10041
|
return () => {
|
|
9845
|
-
|
|
10042
|
+
listeners4.delete(listener);
|
|
9846
10043
|
};
|
|
9847
10044
|
}
|
|
9848
10045
|
function allProjectableScopes() {
|
|
@@ -9883,11 +10080,11 @@ function applyProjectionSet(payload) {
|
|
|
9883
10080
|
if (!changed) return;
|
|
9884
10081
|
preferences = next;
|
|
9885
10082
|
storage2.set(STORAGE_KEY2, JSON.stringify(preferences));
|
|
9886
|
-
|
|
10083
|
+
notify4();
|
|
9887
10084
|
}
|
|
9888
10085
|
var EMPTY = {};
|
|
9889
10086
|
function useProjectionPreferences() {
|
|
9890
|
-
return
|
|
10087
|
+
return useSyncExternalStore5(
|
|
9891
10088
|
subscribeProjectionPreferences,
|
|
9892
10089
|
getProjectionPreferences,
|
|
9893
10090
|
() => EMPTY
|
|
@@ -9937,7 +10134,7 @@ var projectionTransform = {
|
|
|
9937
10134
|
use: () => {
|
|
9938
10135
|
const preferences2 = useProjectionPreferences();
|
|
9939
10136
|
const facts = useFacts();
|
|
9940
|
-
return
|
|
10137
|
+
return useMemo12(() => {
|
|
9941
10138
|
if (Object.keys(preferences2).length === 0) return null;
|
|
9942
10139
|
return buildTransform(preferences2, facts);
|
|
9943
10140
|
}, [preferences2, facts]);
|
|
@@ -9953,7 +10150,7 @@ function ProjectionSignalBridge() {
|
|
|
9953
10150
|
}
|
|
9954
10151
|
|
|
9955
10152
|
// src/projection/use-projection.ts
|
|
9956
|
-
import { useCallback as
|
|
10153
|
+
import { useCallback as useCallback15, useEffect as useEffect12, useState as useState8 } from "react";
|
|
9957
10154
|
function readResult(raw) {
|
|
9958
10155
|
if (raw === null || typeof raw !== "object") return void 0;
|
|
9959
10156
|
if (!("hiddenCount" in raw) || typeof raw.hiddenCount !== "number") return void 0;
|
|
@@ -9966,8 +10163,8 @@ function entityIdOf(value) {
|
|
|
9966
10163
|
}
|
|
9967
10164
|
var NO_AXES = [];
|
|
9968
10165
|
function useProjection(projectionProp, entity2) {
|
|
9969
|
-
const [expanded, setExpanded] =
|
|
9970
|
-
const toggle =
|
|
10166
|
+
const [expanded, setExpanded] = useState8(false);
|
|
10167
|
+
const toggle = useCallback15(() => setExpanded((e) => !e), []);
|
|
9971
10168
|
const entityId = entityIdOf(entity2);
|
|
9972
10169
|
useEffect12(() => {
|
|
9973
10170
|
setExpanded(false);
|
|
@@ -10015,34 +10212,34 @@ __export(interaction_exports, {
|
|
|
10015
10212
|
});
|
|
10016
10213
|
|
|
10017
10214
|
// src/interaction/withInteractionTracking.tsx
|
|
10018
|
-
import
|
|
10019
|
-
import { jsx as
|
|
10020
|
-
var InteractionContext =
|
|
10215
|
+
import React39, { createContext as createContext25, useContext as useContext25 } from "react";
|
|
10216
|
+
import { jsx as jsx22, jsxs } from "react/jsx-runtime";
|
|
10217
|
+
var InteractionContext = createContext25(null);
|
|
10021
10218
|
function InteractionProvider({
|
|
10022
10219
|
onInteraction,
|
|
10023
10220
|
children
|
|
10024
10221
|
}) {
|
|
10025
|
-
return /* @__PURE__ */
|
|
10222
|
+
return /* @__PURE__ */ jsx22(InteractionContext.Provider, { value: onInteraction, children });
|
|
10026
10223
|
}
|
|
10027
10224
|
function useInteraction2() {
|
|
10028
|
-
return
|
|
10225
|
+
return useContext25(InteractionContext);
|
|
10029
10226
|
}
|
|
10030
10227
|
function withInteractionTracking(WrappedComponent, meta) {
|
|
10031
10228
|
function TrackedComponent(props) {
|
|
10032
|
-
return /* @__PURE__ */
|
|
10229
|
+
return /* @__PURE__ */ jsx22(
|
|
10033
10230
|
"div",
|
|
10034
10231
|
{
|
|
10035
10232
|
"data-tracked-component": meta.componentId,
|
|
10036
10233
|
"data-tracked-component-type": meta.componentType,
|
|
10037
10234
|
style: { display: "contents" },
|
|
10038
|
-
children: /* @__PURE__ */
|
|
10235
|
+
children: /* @__PURE__ */ jsx22(ComponentErrorBoundary, { componentId: meta.componentId, children: /* @__PURE__ */ jsx22(WrappedComponent, { ...props }) })
|
|
10039
10236
|
}
|
|
10040
10237
|
);
|
|
10041
10238
|
}
|
|
10042
10239
|
TrackedComponent.displayName = `Tracked(${WrappedComponent.displayName || WrappedComponent.name || "Component"})`;
|
|
10043
10240
|
return TrackedComponent;
|
|
10044
10241
|
}
|
|
10045
|
-
var ComponentErrorBoundary = class extends
|
|
10242
|
+
var ComponentErrorBoundary = class extends React39.Component {
|
|
10046
10243
|
constructor() {
|
|
10047
10244
|
super(...arguments);
|
|
10048
10245
|
__publicField(this, "state", { error: null });
|
|
@@ -10056,7 +10253,7 @@ var ComponentErrorBoundary = class extends React36.Component {
|
|
|
10056
10253
|
render() {
|
|
10057
10254
|
if (this.state.error) {
|
|
10058
10255
|
return /* @__PURE__ */ jsxs("div", { className: "fourty-component-error", role: "alert", "data-component-id": this.props.componentId, children: [
|
|
10059
|
-
/* @__PURE__ */
|
|
10256
|
+
/* @__PURE__ */ jsx22("strong", { children: this.props.componentId }),
|
|
10060
10257
|
": ",
|
|
10061
10258
|
this.state.error.message
|
|
10062
10259
|
] });
|
|
@@ -10113,17 +10310,17 @@ __export(utils_exports, {
|
|
|
10113
10310
|
});
|
|
10114
10311
|
|
|
10115
10312
|
// src/utils/use-form-factor.ts
|
|
10116
|
-
import { useSyncExternalStore as
|
|
10313
|
+
import { useSyncExternalStore as useSyncExternalStore6 } from "react";
|
|
10117
10314
|
|
|
10118
10315
|
// src/utils/viewport-window.tsx
|
|
10119
|
-
import { createContext as
|
|
10120
|
-
import { jsx as
|
|
10121
|
-
var ViewportWindowContext =
|
|
10316
|
+
import { createContext as createContext26, useContext as useContext26 } from "react";
|
|
10317
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
10318
|
+
var ViewportWindowContext = createContext26(null);
|
|
10122
10319
|
function canAnswer(win) {
|
|
10123
10320
|
return win !== null && typeof win.matchMedia === "function";
|
|
10124
10321
|
}
|
|
10125
10322
|
function useViewportWindow() {
|
|
10126
|
-
const provided =
|
|
10323
|
+
const provided = useContext26(ViewportWindowContext);
|
|
10127
10324
|
if (provided !== null) return canAnswer(provided) ? provided : null;
|
|
10128
10325
|
const global = globalThis;
|
|
10129
10326
|
return canAnswer(global) ? global : null;
|
|
@@ -10132,7 +10329,7 @@ function ViewportWindowProvider({
|
|
|
10132
10329
|
value,
|
|
10133
10330
|
children
|
|
10134
10331
|
}) {
|
|
10135
|
-
return /* @__PURE__ */
|
|
10332
|
+
return /* @__PURE__ */ jsx23(ViewportWindowContext.Provider, { value, children });
|
|
10136
10333
|
}
|
|
10137
10334
|
|
|
10138
10335
|
// src/utils/use-form-factor.ts
|
|
@@ -10191,7 +10388,7 @@ var noWindowRead = () => SERVER_SNAPSHOT;
|
|
|
10191
10388
|
function useFormFactor() {
|
|
10192
10389
|
const win = useViewportWindow();
|
|
10193
10390
|
const store = win === null ? null : storeFor(win);
|
|
10194
|
-
return
|
|
10391
|
+
return useSyncExternalStore6(
|
|
10195
10392
|
store === null ? noWindowSubscribe : store.subscribe,
|
|
10196
10393
|
store === null ? noWindowRead : store.read,
|
|
10197
10394
|
noWindowRead
|
|
@@ -10199,14 +10396,14 @@ function useFormFactor() {
|
|
|
10199
10396
|
}
|
|
10200
10397
|
|
|
10201
10398
|
// src/utils/use-inline-completion.ts
|
|
10202
|
-
import { useCallback as
|
|
10399
|
+
import { useCallback as useCallback16, useMemo as useMemo13, useState as useState9 } from "react";
|
|
10203
10400
|
function useInlineCompletion(opts) {
|
|
10204
10401
|
const { value, candidates } = opts;
|
|
10205
10402
|
const minChars = opts.minChars !== void 0 ? opts.minChars : 2;
|
|
10206
10403
|
const enabled = opts.enabled !== void 0 ? opts.enabled : true;
|
|
10207
|
-
const [dismissedValue, setDismissedValue] =
|
|
10208
|
-
const dismiss =
|
|
10209
|
-
return
|
|
10404
|
+
const [dismissedValue, setDismissedValue] = useState9(null);
|
|
10405
|
+
const dismiss = useCallback16(() => setDismissedValue(value), [value]);
|
|
10406
|
+
return useMemo13(() => {
|
|
10210
10407
|
if (!enabled || value.length < minChars || dismissedValue === value) {
|
|
10211
10408
|
return { completion: "", ghost: "", active: false, dismiss };
|
|
10212
10409
|
}
|
|
@@ -10223,8 +10420,8 @@ function useInlineCompletion(opts) {
|
|
|
10223
10420
|
}
|
|
10224
10421
|
|
|
10225
10422
|
// src/utils/use-document-visible.ts
|
|
10226
|
-
import
|
|
10227
|
-
function
|
|
10423
|
+
import React40 from "react";
|
|
10424
|
+
function subscribe4(onChange) {
|
|
10228
10425
|
document.addEventListener("visibilitychange", onChange);
|
|
10229
10426
|
return () => document.removeEventListener("visibilitychange", onChange);
|
|
10230
10427
|
}
|
|
@@ -10235,15 +10432,15 @@ function getServerSnapshot() {
|
|
|
10235
10432
|
return true;
|
|
10236
10433
|
}
|
|
10237
10434
|
function useDocumentVisible() {
|
|
10238
|
-
return
|
|
10435
|
+
return React40.useSyncExternalStore(subscribe4, getSnapshot, getServerSnapshot);
|
|
10239
10436
|
}
|
|
10240
10437
|
|
|
10241
10438
|
// src/utils/use-interval.ts
|
|
10242
|
-
import
|
|
10439
|
+
import React41 from "react";
|
|
10243
10440
|
function useInterval(callback, ms, active = true) {
|
|
10244
|
-
const cbRef =
|
|
10441
|
+
const cbRef = React41.useRef(callback);
|
|
10245
10442
|
cbRef.current = callback;
|
|
10246
|
-
|
|
10443
|
+
React41.useEffect(() => {
|
|
10247
10444
|
if (!active) return;
|
|
10248
10445
|
const id = window.setInterval(() => cbRef.current(), ms);
|
|
10249
10446
|
return () => window.clearInterval(id);
|
|
@@ -10251,7 +10448,7 @@ function useInterval(callback, ms, active = true) {
|
|
|
10251
10448
|
}
|
|
10252
10449
|
|
|
10253
10450
|
// src/utils/use-success-flash.ts
|
|
10254
|
-
import { useCallback as
|
|
10451
|
+
import { useCallback as useCallback17, useEffect as useEffect13, useRef as useRef9, useState as useState10 } from "react";
|
|
10255
10452
|
import { useAnimationControls } from "framer-motion";
|
|
10256
10453
|
function useSuccessFlash(options) {
|
|
10257
10454
|
const duration = options !== void 0 && options.duration !== void 0 ? options.duration : 900;
|
|
@@ -10260,14 +10457,14 @@ function useSuccessFlash(options) {
|
|
|
10260
10457
|
options !== void 0 && options.scale !== void 0 ? options.scale : [1, 1.06, 0.98, 1]
|
|
10261
10458
|
);
|
|
10262
10459
|
const controls = useAnimationControls();
|
|
10263
|
-
const [flashing, setFlashing] =
|
|
10460
|
+
const [flashing, setFlashing] = useState10(false);
|
|
10264
10461
|
const timerRef = useRef9(null);
|
|
10265
10462
|
useEffect13(() => {
|
|
10266
10463
|
return () => {
|
|
10267
10464
|
if (timerRef.current !== null) window.clearTimeout(timerRef.current);
|
|
10268
10465
|
};
|
|
10269
10466
|
}, []);
|
|
10270
|
-
const trigger =
|
|
10467
|
+
const trigger = useCallback17(() => {
|
|
10271
10468
|
setFlashing(true);
|
|
10272
10469
|
controls.start({
|
|
10273
10470
|
scale: scaleRef.current,
|
|
@@ -10369,14 +10566,14 @@ function validateAll(items, schema, context) {
|
|
|
10369
10566
|
|
|
10370
10567
|
// src/client-state/store.ts
|
|
10371
10568
|
var entries = /* @__PURE__ */ new Map();
|
|
10372
|
-
var
|
|
10569
|
+
var listeners5 = /* @__PURE__ */ new Set();
|
|
10373
10570
|
var vectorCache = {};
|
|
10374
10571
|
var entriesCache = /* @__PURE__ */ new Map();
|
|
10375
|
-
function
|
|
10572
|
+
function notify5() {
|
|
10376
10573
|
vectorCache = {};
|
|
10377
10574
|
for (const [ns, e] of entries) vectorCache[ns] = e.rev;
|
|
10378
10575
|
entriesCache = new Map(entries);
|
|
10379
|
-
for (const l of
|
|
10576
|
+
for (const l of listeners5) l();
|
|
10380
10577
|
}
|
|
10381
10578
|
function publishClientState(namespace, payload) {
|
|
10382
10579
|
if (namespace.length === 0) return;
|
|
@@ -10385,7 +10582,7 @@ function publishClientState(namespace, payload) {
|
|
|
10385
10582
|
if (prev !== void 0 && prev.key === key) return;
|
|
10386
10583
|
const rev = prev !== void 0 ? prev.rev + 1 : 1;
|
|
10387
10584
|
entries.set(namespace, { payload, rev, key });
|
|
10388
|
-
|
|
10585
|
+
notify5();
|
|
10389
10586
|
}
|
|
10390
10587
|
function clientStateVector() {
|
|
10391
10588
|
return vectorCache;
|
|
@@ -10394,26 +10591,26 @@ function clientStateEntries() {
|
|
|
10394
10591
|
return entriesCache;
|
|
10395
10592
|
}
|
|
10396
10593
|
function subscribeClientState(listener) {
|
|
10397
|
-
|
|
10594
|
+
listeners5.add(listener);
|
|
10398
10595
|
return () => {
|
|
10399
|
-
|
|
10596
|
+
listeners5.delete(listener);
|
|
10400
10597
|
};
|
|
10401
10598
|
}
|
|
10402
10599
|
|
|
10403
10600
|
// src/client-state/server-store.ts
|
|
10404
10601
|
var entries2 = /* @__PURE__ */ new Map();
|
|
10405
|
-
var
|
|
10602
|
+
var listeners6 = /* @__PURE__ */ new Set();
|
|
10406
10603
|
var entriesCache2 = /* @__PURE__ */ new Map();
|
|
10407
|
-
function
|
|
10604
|
+
function notify6() {
|
|
10408
10605
|
entriesCache2 = new Map(entries2);
|
|
10409
|
-
for (const l of
|
|
10606
|
+
for (const l of listeners6) l();
|
|
10410
10607
|
}
|
|
10411
10608
|
function applyServerState(namespace, rev, payload) {
|
|
10412
10609
|
if (namespace.length === 0) return false;
|
|
10413
10610
|
const prev = entries2.get(namespace);
|
|
10414
10611
|
if (prev !== void 0 && rev <= prev.rev) return false;
|
|
10415
10612
|
entries2.set(namespace, { payload, rev });
|
|
10416
|
-
|
|
10613
|
+
notify6();
|
|
10417
10614
|
return true;
|
|
10418
10615
|
}
|
|
10419
10616
|
function serverState(namespace) {
|
|
@@ -10429,15 +10626,15 @@ function serverStateEntries() {
|
|
|
10429
10626
|
return entriesCache2;
|
|
10430
10627
|
}
|
|
10431
10628
|
function subscribeServerState(listener) {
|
|
10432
|
-
|
|
10629
|
+
listeners6.add(listener);
|
|
10433
10630
|
return () => {
|
|
10434
|
-
|
|
10631
|
+
listeners6.delete(listener);
|
|
10435
10632
|
};
|
|
10436
10633
|
}
|
|
10437
10634
|
function resetServerState() {
|
|
10438
10635
|
if (entries2.size === 0) return;
|
|
10439
10636
|
entries2.clear();
|
|
10440
|
-
|
|
10637
|
+
notify6();
|
|
10441
10638
|
}
|
|
10442
10639
|
function primedEntities() {
|
|
10443
10640
|
const payload = serverState(ENTITY_PRIME_NAMESPACE);
|
|
@@ -10455,15 +10652,15 @@ function primedEntitiesFor(resolverKey) {
|
|
|
10455
10652
|
}
|
|
10456
10653
|
|
|
10457
10654
|
// src/preview/SpacefrontPreviewProvider.tsx
|
|
10458
|
-
import * as
|
|
10459
|
-
import { jsx as
|
|
10655
|
+
import * as React42 from "react";
|
|
10656
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
10460
10657
|
var NOOP = () => {
|
|
10461
10658
|
};
|
|
10462
10659
|
var ASYNC_NOOP = () => Promise.resolve();
|
|
10463
10660
|
var VIEW = { page: { kind: "home" }, layout: EMPTY_SPEC, shell: EMPTY_SHELL };
|
|
10464
|
-
var PreviewContext =
|
|
10661
|
+
var PreviewContext = React42.createContext(null);
|
|
10465
10662
|
function usePreview() {
|
|
10466
|
-
const value =
|
|
10663
|
+
const value = React42.useContext(PreviewContext);
|
|
10467
10664
|
if (value === null) throw new Error("preview runtime used outside <SpacefrontPreviewProvider>");
|
|
10468
10665
|
return value;
|
|
10469
10666
|
}
|
|
@@ -10617,27 +10814,27 @@ var PRESENCE = {
|
|
|
10617
10814
|
usePresenceLiveTurn: () => usePreview().pending?.messageId
|
|
10618
10815
|
};
|
|
10619
10816
|
function SpacefrontPreviewProvider({ scene, onSend, children }) {
|
|
10620
|
-
const [sessionId] =
|
|
10621
|
-
const derived =
|
|
10622
|
-
const onSendRef =
|
|
10817
|
+
const [sessionId] = React42.useState(() => `preview-${Math.random().toString(36).slice(2)}`);
|
|
10818
|
+
const derived = React42.useMemo(() => derive(scene, sessionId), [scene, sessionId]);
|
|
10819
|
+
const onSendRef = React42.useRef(onSend);
|
|
10623
10820
|
onSendRef.current = onSend;
|
|
10624
|
-
const draft =
|
|
10821
|
+
const draft = React42.useMemo(() => {
|
|
10625
10822
|
let text2 = "";
|
|
10626
|
-
const
|
|
10823
|
+
const listeners14 = /* @__PURE__ */ new Set();
|
|
10627
10824
|
return {
|
|
10628
10825
|
store: { subscribe: (fn) => {
|
|
10629
|
-
|
|
10826
|
+
listeners14.add(fn);
|
|
10630
10827
|
return () => {
|
|
10631
|
-
|
|
10828
|
+
listeners14.delete(fn);
|
|
10632
10829
|
};
|
|
10633
10830
|
}, get: () => text2 },
|
|
10634
10831
|
set: (next) => {
|
|
10635
10832
|
text2 = next;
|
|
10636
|
-
|
|
10833
|
+
listeners14.forEach((fn) => fn());
|
|
10637
10834
|
}
|
|
10638
10835
|
};
|
|
10639
10836
|
}, []);
|
|
10640
|
-
const session =
|
|
10837
|
+
const session = React42.useMemo(() => {
|
|
10641
10838
|
const send = (text2) => {
|
|
10642
10839
|
draft.set("");
|
|
10643
10840
|
onSendRef.current?.(text2);
|
|
@@ -10689,15 +10886,15 @@ function SpacefrontPreviewProvider({ scene, onSend, children }) {
|
|
|
10689
10886
|
const qId = question === null ? null : question.id;
|
|
10690
10887
|
const qText = question === null ? "" : question.text;
|
|
10691
10888
|
const qReplies = question === null ? "" : list(question.replies).join("\0");
|
|
10692
|
-
const raised =
|
|
10693
|
-
|
|
10889
|
+
const raised = React42.useRef(0);
|
|
10890
|
+
React42.useEffect(() => {
|
|
10694
10891
|
if (qId === null) return;
|
|
10695
10892
|
raised.current += 1;
|
|
10696
10893
|
const id = `${qId}-${raised.current}`;
|
|
10697
10894
|
raiseStanding(AGENT_ASK_SIGNAL, id, { ask: qText, suggestions: qReplies === "" ? [] : qReplies.split("\0") }, sessionId);
|
|
10698
10895
|
return () => resolveStanding(id, sessionId);
|
|
10699
10896
|
}, [qId, qText, qReplies, sessionId]);
|
|
10700
|
-
return /* @__PURE__ */
|
|
10897
|
+
return /* @__PURE__ */ jsx24(PreviewContext.Provider, { value: derived, children: /* @__PURE__ */ jsx24(FourtySessionContext.Provider, { value: session, children: /* @__PURE__ */ jsx24(FourtyRuntimeProvider, { value: RUNTIME, children: /* @__PURE__ */ jsx24(PresenceRuntimeProvider, { value: PRESENCE, children }) }) }) });
|
|
10701
10898
|
}
|
|
10702
10899
|
|
|
10703
10900
|
// src/verticals/commerce/index.ts
|
|
@@ -10784,6 +10981,7 @@ __export(commerce_exports, {
|
|
|
10784
10981
|
useCommerceRuntime: () => useCommerceRuntime,
|
|
10785
10982
|
useComparisonHighlight: () => useComparisonHighlight,
|
|
10786
10983
|
useCustomerAccount: () => useCustomerAccount,
|
|
10984
|
+
useInstallmentOffer: () => useInstallmentOffer,
|
|
10787
10985
|
useLookCard: () => useLookCard,
|
|
10788
10986
|
useOptionSelections: () => useOptionSelections,
|
|
10789
10987
|
usePendingVariantChoice: () => usePendingVariantChoice,
|
|
@@ -10840,7 +11038,7 @@ registerEntityPageKind("search", {
|
|
|
10840
11038
|
});
|
|
10841
11039
|
|
|
10842
11040
|
// src/verticals/commerce/commerce-context.tsx
|
|
10843
|
-
import { createContext as
|
|
11041
|
+
import { createContext as createContext28, useContext as useContext28 } from "react";
|
|
10844
11042
|
var INERT_COMMERCE_RUNTIME = {
|
|
10845
11043
|
useCart: () => {
|
|
10846
11044
|
throw new Error("useCart must be used within a <CommerceProvider>");
|
|
@@ -10877,14 +11075,16 @@ var INERT_COMMERCE_RUNTIME = {
|
|
|
10877
11075
|
}),
|
|
10878
11076
|
useCustomerAccount: () => ({ signedIn: false, email: null, signIn: () => {
|
|
10879
11077
|
}, signOut: async () => {
|
|
10880
|
-
}, available: false })
|
|
11078
|
+
}, available: false }),
|
|
11079
|
+
// No store, no plans: a price line simply shows no installment offer.
|
|
11080
|
+
useInstallmentOffer: () => void 0
|
|
10881
11081
|
};
|
|
10882
|
-
var FourtyCommerceRuntimeContext =
|
|
11082
|
+
var FourtyCommerceRuntimeContext = createContext28(
|
|
10883
11083
|
INERT_COMMERCE_RUNTIME
|
|
10884
11084
|
);
|
|
10885
11085
|
var FourtyCommerceRuntimeProvider = FourtyCommerceRuntimeContext.Provider;
|
|
10886
11086
|
function useCommerceRuntime() {
|
|
10887
|
-
return
|
|
11087
|
+
return useContext28(FourtyCommerceRuntimeContext);
|
|
10888
11088
|
}
|
|
10889
11089
|
function useCart() {
|
|
10890
11090
|
return useCommerceRuntime().useCart();
|
|
@@ -10910,6 +11110,9 @@ function useProductReviews(product, intent) {
|
|
|
10910
11110
|
function useCustomerAccount() {
|
|
10911
11111
|
return useCommerceRuntime().useCustomerAccount();
|
|
10912
11112
|
}
|
|
11113
|
+
function useInstallmentOffer(price) {
|
|
11114
|
+
return useCommerceRuntime().useInstallmentOffer(price);
|
|
11115
|
+
}
|
|
10913
11116
|
|
|
10914
11117
|
// src/verticals/commerce/checkout/external-navigation.ts
|
|
10915
11118
|
function navigateToExternalCommerceUrl(url) {
|
|
@@ -10935,17 +11138,17 @@ function navigateToExternalCommerceUrl(url) {
|
|
|
10935
11138
|
}
|
|
10936
11139
|
|
|
10937
11140
|
// src/verticals/commerce/variant/variant-selection-store.ts
|
|
10938
|
-
import { useSyncExternalStore as
|
|
11141
|
+
import { useSyncExternalStore as useSyncExternalStore7 } from "react";
|
|
10939
11142
|
var EMPTY2 = /* @__PURE__ */ new Map();
|
|
10940
11143
|
var selections = /* @__PURE__ */ new Map();
|
|
10941
|
-
var
|
|
10942
|
-
function
|
|
10943
|
-
for (const listener of
|
|
11144
|
+
var listeners7 = /* @__PURE__ */ new Set();
|
|
11145
|
+
function notify7() {
|
|
11146
|
+
for (const listener of listeners7) listener();
|
|
10944
11147
|
}
|
|
10945
|
-
function
|
|
10946
|
-
|
|
11148
|
+
function subscribe5(listener) {
|
|
11149
|
+
listeners7.add(listener);
|
|
10947
11150
|
return () => {
|
|
10948
|
-
|
|
11151
|
+
listeners7.delete(listener);
|
|
10949
11152
|
};
|
|
10950
11153
|
}
|
|
10951
11154
|
function recordVariantSelection(productId, variantId) {
|
|
@@ -10955,58 +11158,58 @@ function recordVariantSelection(productId, variantId) {
|
|
|
10955
11158
|
const next = new Map(selections);
|
|
10956
11159
|
next.set(productId, variantId);
|
|
10957
11160
|
selections = next;
|
|
10958
|
-
|
|
11161
|
+
notify7();
|
|
10959
11162
|
}
|
|
10960
11163
|
function getVariantSelection(productId) {
|
|
10961
11164
|
return selections.get(productId);
|
|
10962
11165
|
}
|
|
10963
11166
|
function useVariantSelections() {
|
|
10964
|
-
return
|
|
11167
|
+
return useSyncExternalStore7(subscribe5, () => selections, () => EMPTY2);
|
|
10965
11168
|
}
|
|
10966
11169
|
registerSessionScopedClear(() => {
|
|
10967
11170
|
if (selections.size === 0) return;
|
|
10968
11171
|
selections = /* @__PURE__ */ new Map();
|
|
10969
|
-
|
|
11172
|
+
notify7();
|
|
10970
11173
|
});
|
|
10971
11174
|
|
|
10972
11175
|
// src/verticals/commerce/variant/pending-variant-choice-store.ts
|
|
10973
|
-
import { useSyncExternalStore as
|
|
11176
|
+
import { useSyncExternalStore as useSyncExternalStore8 } from "react";
|
|
10974
11177
|
var pending = null;
|
|
10975
|
-
var
|
|
10976
|
-
function
|
|
10977
|
-
for (const listener of
|
|
11178
|
+
var listeners8 = /* @__PURE__ */ new Set();
|
|
11179
|
+
function notify8() {
|
|
11180
|
+
for (const listener of listeners8) listener();
|
|
10978
11181
|
}
|
|
10979
|
-
function
|
|
10980
|
-
|
|
11182
|
+
function subscribe6(listener) {
|
|
11183
|
+
listeners8.add(listener);
|
|
10981
11184
|
return () => {
|
|
10982
|
-
|
|
11185
|
+
listeners8.delete(listener);
|
|
10983
11186
|
};
|
|
10984
11187
|
}
|
|
10985
11188
|
function requestVariantChoice(choice) {
|
|
10986
11189
|
pending = choice;
|
|
10987
|
-
|
|
11190
|
+
notify8();
|
|
10988
11191
|
}
|
|
10989
11192
|
function clearVariantChoice() {
|
|
10990
11193
|
if (pending === null) return;
|
|
10991
11194
|
pending = null;
|
|
10992
|
-
|
|
11195
|
+
notify8();
|
|
10993
11196
|
}
|
|
10994
11197
|
function usePendingVariantChoice() {
|
|
10995
|
-
return
|
|
11198
|
+
return useSyncExternalStore8(subscribe6, () => pending, () => null);
|
|
10996
11199
|
}
|
|
10997
11200
|
|
|
10998
11201
|
// src/verticals/commerce/variant/option-selection-store.ts
|
|
10999
|
-
import { useSyncExternalStore as
|
|
11202
|
+
import { useSyncExternalStore as useSyncExternalStore9 } from "react";
|
|
11000
11203
|
var EMPTY3 = /* @__PURE__ */ new Map();
|
|
11001
11204
|
var selections2 = /* @__PURE__ */ new Map();
|
|
11002
|
-
var
|
|
11003
|
-
function
|
|
11004
|
-
for (const listener of
|
|
11205
|
+
var listeners9 = /* @__PURE__ */ new Set();
|
|
11206
|
+
function notify9() {
|
|
11207
|
+
for (const listener of listeners9) listener();
|
|
11005
11208
|
}
|
|
11006
|
-
function
|
|
11007
|
-
|
|
11209
|
+
function subscribe7(listener) {
|
|
11210
|
+
listeners9.add(listener);
|
|
11008
11211
|
return () => {
|
|
11009
|
-
|
|
11212
|
+
listeners9.delete(listener);
|
|
11010
11213
|
};
|
|
11011
11214
|
}
|
|
11012
11215
|
function recordOptionSelections(productId, picks) {
|
|
@@ -11028,18 +11231,18 @@ function recordOptionSelections(productId, picks) {
|
|
|
11028
11231
|
const next = new Map(selections2);
|
|
11029
11232
|
next.set(productId, merged);
|
|
11030
11233
|
selections2 = next;
|
|
11031
|
-
|
|
11234
|
+
notify9();
|
|
11032
11235
|
}
|
|
11033
11236
|
function getOptionSelections(productId) {
|
|
11034
11237
|
return selections2.get(productId);
|
|
11035
11238
|
}
|
|
11036
11239
|
function useOptionSelections() {
|
|
11037
|
-
return
|
|
11240
|
+
return useSyncExternalStore9(subscribe7, () => selections2, () => EMPTY3);
|
|
11038
11241
|
}
|
|
11039
11242
|
registerSessionScopedClear(() => {
|
|
11040
11243
|
if (selections2.size === 0) return;
|
|
11041
11244
|
selections2 = /* @__PURE__ */ new Map();
|
|
11042
|
-
|
|
11245
|
+
notify9();
|
|
11043
11246
|
});
|
|
11044
11247
|
|
|
11045
11248
|
// ../spacestation/src/analytics/ecommerce/index.ts
|
|
@@ -11064,18 +11267,18 @@ __export(ecommerce_exports, {
|
|
|
11064
11267
|
});
|
|
11065
11268
|
|
|
11066
11269
|
// ../spacestation/src/analytics/ecommerce/surfacing.ts
|
|
11067
|
-
import { z as
|
|
11270
|
+
import { z as z50 } from "zod";
|
|
11068
11271
|
var PRODUCTS_SURFACED = defineEventKind(
|
|
11069
11272
|
"commerce.products_surfaced",
|
|
11070
11273
|
"client",
|
|
11071
|
-
|
|
11274
|
+
z50.object({
|
|
11072
11275
|
/** The turn whose commit this describes. Minted where the prompt signal
|
|
11073
11276
|
* is built and shared with `agent_runs`, so the read layer can line a
|
|
11074
11277
|
* surfacing up against the prompt that asked for it. */
|
|
11075
|
-
turnId:
|
|
11278
|
+
turnId: z50.string().min(1).max(128),
|
|
11076
11279
|
/** Distinct entity refs this turn placed that were not on the canvas
|
|
11077
11280
|
* before it. ZERO IS A REAL VALUE — see the header. */
|
|
11078
|
-
productCount:
|
|
11281
|
+
productCount: z50.number().int().nonnegative()
|
|
11079
11282
|
}).strict()
|
|
11080
11283
|
);
|
|
11081
11284
|
|
|
@@ -11097,33 +11300,33 @@ function isFunnelStep(value) {
|
|
|
11097
11300
|
}
|
|
11098
11301
|
|
|
11099
11302
|
// src/verticals/commerce/product/use-product-grid-filter.ts
|
|
11100
|
-
import { useCallback as
|
|
11303
|
+
import { useCallback as useCallback18, useMemo as useMemo15, useState as useState12 } from "react";
|
|
11101
11304
|
function useProductGridFilter(chips) {
|
|
11102
|
-
const labelKey =
|
|
11305
|
+
const labelKey = useMemo15(() => chips.map((c) => c.label).join("|"), [chips]);
|
|
11103
11306
|
const first = chips[0];
|
|
11104
|
-
const [activeLabel, setActiveLabel] =
|
|
11307
|
+
const [activeLabel, setActiveLabel] = useState12(
|
|
11105
11308
|
first !== void 0 ? first.label : null
|
|
11106
11309
|
);
|
|
11107
|
-
const activeFromKey =
|
|
11310
|
+
const activeFromKey = useMemo15(() => {
|
|
11108
11311
|
void labelKey;
|
|
11109
11312
|
if (first === void 0) return null;
|
|
11110
11313
|
const found = chips.find((c) => c.label === activeLabel);
|
|
11111
11314
|
return found !== void 0 ? found : first;
|
|
11112
11315
|
}, [chips, first, activeLabel, labelKey]);
|
|
11113
|
-
const setActive =
|
|
11316
|
+
const setActive = useCallback18((next) => {
|
|
11114
11317
|
setActiveLabel(next.label);
|
|
11115
11318
|
}, []);
|
|
11116
11319
|
return { chips, active: activeFromKey, setActive };
|
|
11117
11320
|
}
|
|
11118
11321
|
|
|
11119
11322
|
// src/verticals/commerce/product/use-product-detail.ts
|
|
11120
|
-
import { useCallback as
|
|
11323
|
+
import { useCallback as useCallback20, useMemo as useMemo16, useRef as useRef13, useState as useState15 } from "react";
|
|
11121
11324
|
|
|
11122
11325
|
// src/verticals/commerce/checkout/use-buy-now.ts
|
|
11123
|
-
import { useCallback as
|
|
11326
|
+
import { useCallback as useCallback19, useEffect as useEffect16, useState as useState13 } from "react";
|
|
11124
11327
|
|
|
11125
11328
|
// src/verticals/commerce/checkout/checkout-handoff-store.ts
|
|
11126
|
-
import { useSyncExternalStore as
|
|
11329
|
+
import { useSyncExternalStore as useSyncExternalStore10 } from "react";
|
|
11127
11330
|
|
|
11128
11331
|
// src/verticals/commerce/checkout/checkout-handoff-reasons.ts
|
|
11129
11332
|
var CHECKOUT_BLOCKED_REASON = "the browser blocked the checkout tab, so the visitor has NOT reached checkout and is still on the page. Tell them plainly and point them at their bag to check out from there; never imply they arrived.";
|
|
@@ -11152,13 +11355,13 @@ var IDLE = {
|
|
|
11152
11355
|
attempt: 0
|
|
11153
11356
|
};
|
|
11154
11357
|
var state = IDLE;
|
|
11155
|
-
var
|
|
11156
|
-
function
|
|
11157
|
-
for (const listener of
|
|
11358
|
+
var listeners10 = /* @__PURE__ */ new Set();
|
|
11359
|
+
function notify10() {
|
|
11360
|
+
for (const listener of listeners10) listener();
|
|
11158
11361
|
}
|
|
11159
11362
|
function record(analytics, next) {
|
|
11160
11363
|
state = next;
|
|
11161
|
-
|
|
11364
|
+
notify10();
|
|
11162
11365
|
if (analytics === null) return;
|
|
11163
11366
|
analytics.emit(CHECKOUT_CLICKED, {
|
|
11164
11367
|
origin: next.origin,
|
|
@@ -11224,22 +11427,22 @@ function recordVisitorCheckoutExit(analytics, outcome) {
|
|
|
11224
11427
|
attempt: state.attempt + 1
|
|
11225
11428
|
});
|
|
11226
11429
|
}
|
|
11227
|
-
function
|
|
11228
|
-
|
|
11430
|
+
function subscribe8(listener) {
|
|
11431
|
+
listeners10.add(listener);
|
|
11229
11432
|
return () => {
|
|
11230
|
-
|
|
11433
|
+
listeners10.delete(listener);
|
|
11231
11434
|
};
|
|
11232
11435
|
}
|
|
11233
11436
|
function readCheckoutHandoff() {
|
|
11234
11437
|
return state;
|
|
11235
11438
|
}
|
|
11236
11439
|
function useCheckoutHandoff() {
|
|
11237
|
-
return
|
|
11440
|
+
return useSyncExternalStore10(subscribe8, readCheckoutHandoff, () => IDLE);
|
|
11238
11441
|
}
|
|
11239
11442
|
registerSessionScopedClear(() => {
|
|
11240
11443
|
if (state === IDLE) return;
|
|
11241
11444
|
state = IDLE;
|
|
11242
|
-
|
|
11445
|
+
notify10();
|
|
11243
11446
|
});
|
|
11244
11447
|
|
|
11245
11448
|
// src/verticals/commerce/checkout/buy-now-exit.ts
|
|
@@ -11260,8 +11463,8 @@ var BUY_NOW_SETTLE_TIMEOUT_MS = 12e3;
|
|
|
11260
11463
|
function useBuyNow(addToCart) {
|
|
11261
11464
|
const cartApi = useCart();
|
|
11262
11465
|
const analytics = useOptionalAnalyticsSink();
|
|
11263
|
-
const [pending2, setPending] =
|
|
11264
|
-
const start =
|
|
11466
|
+
const [pending2, setPending] = useState13(null);
|
|
11467
|
+
const start = useCallback19((variantId) => {
|
|
11265
11468
|
if (pending2 !== null) return;
|
|
11266
11469
|
addToCart();
|
|
11267
11470
|
setPending(variantId);
|
|
@@ -11349,9 +11552,9 @@ function isOptionUnavailable(product, selectedVariants, group, opt) {
|
|
|
11349
11552
|
}
|
|
11350
11553
|
|
|
11351
11554
|
// src/verticals/commerce/variant/use-selected-variants-state.ts
|
|
11352
|
-
import { useEffect as useEffect17, useRef as useRef12, useState as
|
|
11555
|
+
import { useEffect as useEffect17, useRef as useRef12, useState as useState14 } from "react";
|
|
11353
11556
|
function useSelectedVariantsState(product, facts) {
|
|
11354
|
-
const [selectedVariants, setSelectedVariants] =
|
|
11557
|
+
const [selectedVariants, setSelectedVariants] = useState14(() => {
|
|
11355
11558
|
const recorded = getOptionSelections(product.id);
|
|
11356
11559
|
return { ...preselectFromFacts(product, facts), ...recorded !== void 0 ? recorded : {} };
|
|
11357
11560
|
});
|
|
@@ -11402,8 +11605,8 @@ function useProductDetail(product) {
|
|
|
11402
11605
|
const session = useFourtySession();
|
|
11403
11606
|
const facts = useFacts();
|
|
11404
11607
|
const optimisticFacts = useOptimisticFactOverlay(PRESENCE_OPTIMISTIC_FACTS_FLOW);
|
|
11405
|
-
const [selectedImage, setSelectedImage] =
|
|
11406
|
-
const [zoomed, setZoomed] =
|
|
11608
|
+
const [selectedImage, setSelectedImage] = useState15(0);
|
|
11609
|
+
const [zoomed, setZoomed] = useState15(false);
|
|
11407
11610
|
const lastProductIdRef = useRef13(product.id);
|
|
11408
11611
|
if (lastProductIdRef.current !== product.id) {
|
|
11409
11612
|
lastProductIdRef.current = product.id;
|
|
@@ -11412,19 +11615,19 @@ function useProductDetail(product) {
|
|
|
11412
11615
|
}
|
|
11413
11616
|
const { selectedVariants, setSelectedVariants, markTouched } = useSelectedVariantsState(product, facts);
|
|
11414
11617
|
const desc = useExpandable(false);
|
|
11415
|
-
const variantGroups =
|
|
11618
|
+
const variantGroups = useMemo16(
|
|
11416
11619
|
() => deriveVariantGroups(product),
|
|
11417
11620
|
[product]
|
|
11418
11621
|
);
|
|
11419
|
-
const allSelected =
|
|
11622
|
+
const allSelected = useMemo16(
|
|
11420
11623
|
() => variantGroups.every((g) => selectedVariants[g.name] !== void 0),
|
|
11421
11624
|
[variantGroups, selectedVariants]
|
|
11422
11625
|
);
|
|
11423
|
-
const missingGroup =
|
|
11626
|
+
const missingGroup = useMemo16(
|
|
11424
11627
|
() => variantGroups.find((g) => selectedVariants[g.name] === void 0),
|
|
11425
11628
|
[variantGroups, selectedVariants]
|
|
11426
11629
|
);
|
|
11427
|
-
const findVariant =
|
|
11630
|
+
const findVariant = useCallback20(
|
|
11428
11631
|
(opts) => matchVariant(product, opts),
|
|
11429
11632
|
[product]
|
|
11430
11633
|
);
|
|
@@ -11435,11 +11638,11 @@ function useProductDetail(product) {
|
|
|
11435
11638
|
const matchIndex = product.images.findIndex((img) => img.url === activeVariantImageUrl);
|
|
11436
11639
|
if (matchIndex >= 0) setSelectedImage(matchIndex);
|
|
11437
11640
|
}
|
|
11438
|
-
const isVariantUnavailable =
|
|
11641
|
+
const isVariantUnavailable = useCallback20(
|
|
11439
11642
|
(group, opt) => isOptionUnavailable(product, selectedVariants, group, opt),
|
|
11440
11643
|
[product, selectedVariants]
|
|
11441
11644
|
);
|
|
11442
|
-
const selectVariant =
|
|
11645
|
+
const selectVariant = useCallback20((group, opt) => {
|
|
11443
11646
|
markTouched();
|
|
11444
11647
|
setSelectedVariants((prev) => ({ ...prev, [group]: opt }));
|
|
11445
11648
|
session.dispatchSignal({
|
|
@@ -11448,7 +11651,7 @@ function useProductDetail(product) {
|
|
|
11448
11651
|
});
|
|
11449
11652
|
optimisticFacts.add({ label: group, value: opt });
|
|
11450
11653
|
}, [session, product.id, markTouched, setSelectedVariants, optimisticFacts]);
|
|
11451
|
-
const addPicked =
|
|
11654
|
+
const addPicked = useCallback20((acknowledgeInDrawer) => {
|
|
11452
11655
|
if (!allSelected) return;
|
|
11453
11656
|
const variant = findVariant(selectedVariants);
|
|
11454
11657
|
if (variant === void 0) {
|
|
@@ -11472,10 +11675,10 @@ function useProductDetail(product) {
|
|
|
11472
11675
|
}
|
|
11473
11676
|
});
|
|
11474
11677
|
}, [allSelected, findVariant, product.id, product.title, product.images, selectedVariants, session]);
|
|
11475
|
-
const onAddToBag =
|
|
11476
|
-
const addForBuyNow =
|
|
11678
|
+
const onAddToBag = useCallback20(() => addPicked(true), [addPicked]);
|
|
11679
|
+
const addForBuyNow = useCallback20(() => addPicked(false), [addPicked]);
|
|
11477
11680
|
const buyNow = useBuyNow(addForBuyNow);
|
|
11478
|
-
const onBuyNow =
|
|
11681
|
+
const onBuyNow = useCallback20(() => {
|
|
11479
11682
|
if (!allSelected) return;
|
|
11480
11683
|
const variant = findVariant(selectedVariants);
|
|
11481
11684
|
if (variant === void 0) {
|
|
@@ -11484,10 +11687,10 @@ function useProductDetail(product) {
|
|
|
11484
11687
|
}
|
|
11485
11688
|
buyNow.start(variant.id);
|
|
11486
11689
|
}, [allSelected, findVariant, selectedVariants, buyNow]);
|
|
11487
|
-
const onAskAgent =
|
|
11690
|
+
const onAskAgent = useCallback20(() => {
|
|
11488
11691
|
session.sendMessage(`Tell me more about the ${product.title}`);
|
|
11489
11692
|
}, [session, product.title]);
|
|
11490
|
-
const onPickSibling =
|
|
11693
|
+
const onPickSibling = useCallback20((sibling) => {
|
|
11491
11694
|
if (sibling.current === true) return;
|
|
11492
11695
|
session.dispatchSuggestionAction({
|
|
11493
11696
|
id: `navigate-product-${sibling.id}`,
|
|
@@ -11502,7 +11705,7 @@ function useProductDetail(product) {
|
|
|
11502
11705
|
payload: { page: { kind: "product", id: sibling.id, morph: true } }
|
|
11503
11706
|
});
|
|
11504
11707
|
}, [session]);
|
|
11505
|
-
const toggleZoom =
|
|
11708
|
+
const toggleZoom = useCallback20(() => setZoomed((p) => !p), []);
|
|
11506
11709
|
return {
|
|
11507
11710
|
selectedImage,
|
|
11508
11711
|
selectImage: setSelectedImage,
|
|
@@ -11529,7 +11732,7 @@ function useProductDetail(product) {
|
|
|
11529
11732
|
}
|
|
11530
11733
|
|
|
11531
11734
|
// src/verticals/commerce/comparison/use-comparison-table.ts
|
|
11532
|
-
import { useCallback as
|
|
11735
|
+
import { useCallback as useCallback21 } from "react";
|
|
11533
11736
|
function classifyComparisonValue(v) {
|
|
11534
11737
|
if (v === void 0) return { kind: "value", value: "" };
|
|
11535
11738
|
if (v === true || v === "true" || v === "Yes") return { kind: "true" };
|
|
@@ -11537,7 +11740,7 @@ function classifyComparisonValue(v) {
|
|
|
11537
11740
|
return { kind: "value", value: v };
|
|
11538
11741
|
}
|
|
11539
11742
|
function useComparisonHighlight(highlightedId) {
|
|
11540
|
-
const isHighlighted =
|
|
11743
|
+
const isHighlighted = useCallback21(
|
|
11541
11744
|
(id) => id === highlightedId,
|
|
11542
11745
|
[highlightedId]
|
|
11543
11746
|
);
|
|
@@ -11545,7 +11748,7 @@ function useComparisonHighlight(highlightedId) {
|
|
|
11545
11748
|
}
|
|
11546
11749
|
|
|
11547
11750
|
// src/verticals/commerce/cart/use-cart-drawer.ts
|
|
11548
|
-
import { useCallback as
|
|
11751
|
+
import { useCallback as useCallback22 } from "react";
|
|
11549
11752
|
|
|
11550
11753
|
// src/verticals/commerce/cart/use-safe-cart.ts
|
|
11551
11754
|
var warnedCart = false;
|
|
@@ -11579,24 +11782,24 @@ function useSafeCart() {
|
|
|
11579
11782
|
}
|
|
11580
11783
|
|
|
11581
11784
|
// src/verticals/commerce/cart/cart-drawer-store.ts
|
|
11582
|
-
import { useSyncExternalStore as
|
|
11785
|
+
import { useSyncExternalStore as useSyncExternalStore11 } from "react";
|
|
11583
11786
|
var isOpen = false;
|
|
11584
11787
|
var focus = null;
|
|
11585
|
-
var
|
|
11586
|
-
function
|
|
11587
|
-
for (const listener of
|
|
11788
|
+
var listeners11 = /* @__PURE__ */ new Set();
|
|
11789
|
+
function notify11() {
|
|
11790
|
+
for (const listener of listeners11) listener();
|
|
11588
11791
|
}
|
|
11589
|
-
function
|
|
11590
|
-
|
|
11792
|
+
function subscribe9(listener) {
|
|
11793
|
+
listeners11.add(listener);
|
|
11591
11794
|
return () => {
|
|
11592
|
-
|
|
11795
|
+
listeners11.delete(listener);
|
|
11593
11796
|
};
|
|
11594
11797
|
}
|
|
11595
11798
|
function openCartDrawer() {
|
|
11596
11799
|
if (isOpen) return;
|
|
11597
11800
|
claimExclusiveOverlay("cart");
|
|
11598
11801
|
isOpen = true;
|
|
11599
|
-
|
|
11802
|
+
notify11();
|
|
11600
11803
|
}
|
|
11601
11804
|
function openCartDrawerFocusedOn(productId) {
|
|
11602
11805
|
if (typeof productId !== "string" || productId.length === 0) {
|
|
@@ -11606,39 +11809,39 @@ function openCartDrawerFocusedOn(productId) {
|
|
|
11606
11809
|
claimExclusiveOverlay("cart");
|
|
11607
11810
|
isOpen = true;
|
|
11608
11811
|
focus = { productId, at: Date.now() };
|
|
11609
|
-
|
|
11812
|
+
notify11();
|
|
11610
11813
|
}
|
|
11611
11814
|
function useCartDrawerFocus() {
|
|
11612
|
-
return
|
|
11815
|
+
return useSyncExternalStore11(subscribe9, () => focus, () => null);
|
|
11613
11816
|
}
|
|
11614
11817
|
function closeCartDrawer() {
|
|
11615
11818
|
if (!isOpen) return;
|
|
11616
11819
|
isOpen = false;
|
|
11617
|
-
|
|
11820
|
+
notify11();
|
|
11618
11821
|
}
|
|
11619
11822
|
function toggleCartDrawer() {
|
|
11620
11823
|
if (!isOpen) claimExclusiveOverlay("cart");
|
|
11621
11824
|
isOpen = !isOpen;
|
|
11622
|
-
|
|
11825
|
+
notify11();
|
|
11623
11826
|
}
|
|
11624
11827
|
function useCartDrawerOpen() {
|
|
11625
|
-
return
|
|
11828
|
+
return useSyncExternalStore11(subscribe9, () => isOpen, () => false);
|
|
11626
11829
|
}
|
|
11627
11830
|
registerExclusiveOverlay("cart", closeCartDrawer);
|
|
11628
11831
|
registerSessionScopedClear(() => {
|
|
11629
11832
|
if (!isOpen && focus === null) return;
|
|
11630
11833
|
isOpen = false;
|
|
11631
11834
|
focus = null;
|
|
11632
|
-
|
|
11835
|
+
notify11();
|
|
11633
11836
|
});
|
|
11634
11837
|
|
|
11635
11838
|
// src/verticals/commerce/cart/use-cart-drawer.ts
|
|
11636
11839
|
function useCartDrawer() {
|
|
11637
11840
|
const cart = useSafeCart();
|
|
11638
11841
|
const isOpen2 = useCartDrawerOpen();
|
|
11639
|
-
const open =
|
|
11640
|
-
const close =
|
|
11641
|
-
const toggle =
|
|
11842
|
+
const open = useCallback22(() => openCartDrawer(), []);
|
|
11843
|
+
const close = useCallback22(() => closeCartDrawer(), []);
|
|
11844
|
+
const toggle = useCallback22(() => toggleCartDrawer(), []);
|
|
11642
11845
|
return {
|
|
11643
11846
|
isOpen: isOpen2,
|
|
11644
11847
|
open,
|
|
@@ -11655,14 +11858,14 @@ function useCartDrawer() {
|
|
|
11655
11858
|
}
|
|
11656
11859
|
|
|
11657
11860
|
// src/verticals/commerce/cart/use-cart-view.ts
|
|
11658
|
-
import
|
|
11861
|
+
import React43 from "react";
|
|
11659
11862
|
|
|
11660
11863
|
// src/verticals/commerce/cart/queued-discount-codes.ts
|
|
11661
|
-
import { useSyncExternalStore as
|
|
11864
|
+
import { useSyncExternalStore as useSyncExternalStore12 } from "react";
|
|
11662
11865
|
var queued = [];
|
|
11663
|
-
var
|
|
11664
|
-
function
|
|
11665
|
-
for (const listener of
|
|
11866
|
+
var listeners12 = /* @__PURE__ */ new Set();
|
|
11867
|
+
function notify12() {
|
|
11868
|
+
for (const listener of listeners12) listener();
|
|
11666
11869
|
}
|
|
11667
11870
|
function withQueuedDiscountCodes(cartCodes, held) {
|
|
11668
11871
|
const extra = held.filter((h) => !cartCodes.some((c) => sameCode(c.code, h)));
|
|
@@ -11675,7 +11878,7 @@ function dequeueDiscountCode(code) {
|
|
|
11675
11878
|
const kept = queued.filter((c) => !sameCode(c, code));
|
|
11676
11879
|
if (kept.length === queued.length) return;
|
|
11677
11880
|
queued = kept;
|
|
11678
|
-
|
|
11881
|
+
notify12();
|
|
11679
11882
|
}
|
|
11680
11883
|
function sameCode(a, b) {
|
|
11681
11884
|
return a.toUpperCase() === b.toUpperCase();
|
|
@@ -11683,38 +11886,38 @@ function sameCode(a, b) {
|
|
|
11683
11886
|
function queueDiscountCode(code) {
|
|
11684
11887
|
if (queued.some((c) => sameCode(c, code))) return;
|
|
11685
11888
|
queued = [...queued, code];
|
|
11686
|
-
|
|
11889
|
+
notify12();
|
|
11687
11890
|
}
|
|
11688
11891
|
function takeQueuedDiscountCodes() {
|
|
11689
11892
|
const taken = queued;
|
|
11690
11893
|
if (taken.length === 0) return taken;
|
|
11691
11894
|
queued = [];
|
|
11692
|
-
|
|
11895
|
+
notify12();
|
|
11693
11896
|
return taken;
|
|
11694
11897
|
}
|
|
11695
11898
|
function readQueuedDiscountCodes() {
|
|
11696
11899
|
return queued;
|
|
11697
11900
|
}
|
|
11698
|
-
function
|
|
11699
|
-
|
|
11901
|
+
function subscribe10(listener) {
|
|
11902
|
+
listeners12.add(listener);
|
|
11700
11903
|
return () => {
|
|
11701
|
-
|
|
11904
|
+
listeners12.delete(listener);
|
|
11702
11905
|
};
|
|
11703
11906
|
}
|
|
11704
11907
|
var NONE = [];
|
|
11705
11908
|
function useQueuedDiscountCodes() {
|
|
11706
|
-
return
|
|
11909
|
+
return useSyncExternalStore12(subscribe10, readQueuedDiscountCodes, () => NONE);
|
|
11707
11910
|
}
|
|
11708
11911
|
registerSessionScopedClear(() => {
|
|
11709
11912
|
if (queued.length === 0) return;
|
|
11710
11913
|
queued = [];
|
|
11711
|
-
|
|
11914
|
+
notify12();
|
|
11712
11915
|
});
|
|
11713
11916
|
|
|
11714
11917
|
// src/verticals/commerce/cart/use-cart-view.ts
|
|
11715
11918
|
function useCartView(cart, onCheckout) {
|
|
11716
11919
|
const analytics = useOptionalAnalyticsSink();
|
|
11717
|
-
const [exitPending, setExitPending] =
|
|
11920
|
+
const [exitPending, setExitPending] = React43.useState(null);
|
|
11718
11921
|
const lines = cart === null ? [] : cart.lines;
|
|
11719
11922
|
const count = lines.reduce((sum, l) => sum + l.quantity, 0);
|
|
11720
11923
|
const totalsPending = lines.some((l) => isPendingCartLine(l));
|
|
@@ -11725,7 +11928,7 @@ function useCartView(cart, onCheckout) {
|
|
|
11725
11928
|
const backendTotal = cart !== null && cart.total !== void 0 ? cart.total.amount : void 0;
|
|
11726
11929
|
const discountAmount = backendTotal !== void 0 && backendTotal < subtotal ? subtotal - backendTotal : 0;
|
|
11727
11930
|
const effectiveTotal = backendTotal !== void 0 ? backendTotal : subtotal;
|
|
11728
|
-
const navigateToExit =
|
|
11931
|
+
const navigateToExit = React43.useCallback((url, kind) => {
|
|
11729
11932
|
const result = navigateToExternalCommerceUrl(url);
|
|
11730
11933
|
if (kind === "checkout") recordVisitorCheckoutExit(analytics, result);
|
|
11731
11934
|
if (result === "new-tab") {
|
|
@@ -11742,7 +11945,7 @@ function useCartView(cart, onCheckout) {
|
|
|
11742
11945
|
setExitPending(null);
|
|
11743
11946
|
}
|
|
11744
11947
|
}, [analytics]);
|
|
11745
|
-
const handleCheckout =
|
|
11948
|
+
const handleCheckout = React43.useCallback(() => {
|
|
11746
11949
|
if (lines.length === 0 || exitPending !== null) return;
|
|
11747
11950
|
setExitPending("checkout");
|
|
11748
11951
|
if (onCheckout) {
|
|
@@ -11762,7 +11965,7 @@ function useCartView(cart, onCheckout) {
|
|
|
11762
11965
|
}
|
|
11763
11966
|
navigateToExit(cart?.checkoutUrl, "checkout");
|
|
11764
11967
|
}, [lines.length, exitPending, onCheckout, cart, navigateToExit]);
|
|
11765
|
-
const handleGoToStore =
|
|
11968
|
+
const handleGoToStore = React43.useCallback(() => {
|
|
11766
11969
|
if (lines.length === 0 || exitPending !== null) return;
|
|
11767
11970
|
setExitPending("store");
|
|
11768
11971
|
navigateToExit(cart?.storeCartUrl, "store");
|
|
@@ -11786,13 +11989,13 @@ function useCartView(cart, onCheckout) {
|
|
|
11786
11989
|
}
|
|
11787
11990
|
|
|
11788
11991
|
// src/verticals/commerce/cart/cart-action-failures.ts
|
|
11789
|
-
import { useMemo as
|
|
11992
|
+
import { useMemo as useMemo17, useSyncExternalStore as useSyncExternalStore13 } from "react";
|
|
11790
11993
|
var FAILURE_TTL_MS = 2 * 6e4;
|
|
11791
11994
|
var FAILURE_CAP = 5;
|
|
11792
11995
|
var failures = [];
|
|
11793
|
-
var
|
|
11794
|
-
function
|
|
11795
|
-
for (const listener of
|
|
11996
|
+
var listeners13 = /* @__PURE__ */ new Set();
|
|
11997
|
+
function notify13() {
|
|
11998
|
+
for (const listener of listeners13) listener();
|
|
11796
11999
|
}
|
|
11797
12000
|
function pruneExpired(now) {
|
|
11798
12001
|
const kept = failures.filter((f) => now - f.at <= FAILURE_TTL_MS);
|
|
@@ -11810,13 +12013,13 @@ function recordCartActionFailure(action, subject, reason) {
|
|
|
11810
12013
|
pruneExpired(now);
|
|
11811
12014
|
const rest = failures.filter((f) => !(f.action === action && sameSubject(f, subject)));
|
|
11812
12015
|
failures = [...rest, { action, productId: subject.productId, code: subject.code, reason, at: now }].slice(-FAILURE_CAP);
|
|
11813
|
-
|
|
12016
|
+
notify13();
|
|
11814
12017
|
}
|
|
11815
12018
|
function clearCartActionFailures(subject) {
|
|
11816
12019
|
const kept = failures.filter((f) => !sameSubject(f, subject));
|
|
11817
12020
|
if (kept.length === failures.length) return;
|
|
11818
12021
|
failures = kept;
|
|
11819
|
-
|
|
12022
|
+
notify13();
|
|
11820
12023
|
}
|
|
11821
12024
|
function snapshot() {
|
|
11822
12025
|
return failures;
|
|
@@ -11825,20 +12028,20 @@ function readCartActionFailures() {
|
|
|
11825
12028
|
pruneExpired(Date.now());
|
|
11826
12029
|
return failures;
|
|
11827
12030
|
}
|
|
11828
|
-
function
|
|
11829
|
-
|
|
12031
|
+
function subscribe11(listener) {
|
|
12032
|
+
listeners13.add(listener);
|
|
11830
12033
|
return () => {
|
|
11831
|
-
|
|
12034
|
+
listeners13.delete(listener);
|
|
11832
12035
|
};
|
|
11833
12036
|
}
|
|
11834
12037
|
var NO_FAILURES = [];
|
|
11835
12038
|
function useCartActionFailures() {
|
|
11836
|
-
return
|
|
12039
|
+
return useSyncExternalStore13(subscribe11, snapshot, () => NO_FAILURES);
|
|
11837
12040
|
}
|
|
11838
12041
|
function useCartActionFailuresFor(productIdsInCart) {
|
|
11839
12042
|
const all = useCartActionFailures();
|
|
11840
12043
|
const key = productIdsInCart.join("\0");
|
|
11841
|
-
return
|
|
12044
|
+
return useMemo17(() => {
|
|
11842
12045
|
const present = new Set(key.length === 0 ? [] : key.split("\0"));
|
|
11843
12046
|
return all.filter((f) => f.productId !== void 0 && !present.has(f.productId));
|
|
11844
12047
|
}, [all, key]);
|
|
@@ -11846,24 +12049,24 @@ function useCartActionFailuresFor(productIdsInCart) {
|
|
|
11846
12049
|
registerSessionScopedClear(() => {
|
|
11847
12050
|
if (failures.length === 0) return;
|
|
11848
12051
|
failures = [];
|
|
11849
|
-
|
|
12052
|
+
notify13();
|
|
11850
12053
|
});
|
|
11851
12054
|
|
|
11852
12055
|
// src/verticals/commerce/cart/use-cart-line-row.ts
|
|
11853
|
-
import * as
|
|
12056
|
+
import * as React44 from "react";
|
|
11854
12057
|
|
|
11855
12058
|
// src/verticals/commerce/use-commerce-actions.ts
|
|
11856
|
-
import { useCallback as
|
|
12059
|
+
import { useCallback as useCallback23 } from "react";
|
|
11857
12060
|
function useCommerceActions() {
|
|
11858
12061
|
const canvas = useCanvasActions();
|
|
11859
|
-
const navigateToProduct =
|
|
12062
|
+
const navigateToProduct = useCallback23(
|
|
11860
12063
|
(productId, title) => {
|
|
11861
12064
|
if (!canvas) return;
|
|
11862
12065
|
canvas.navigate({ kind: "product", id: productId }, title);
|
|
11863
12066
|
},
|
|
11864
12067
|
[canvas]
|
|
11865
12068
|
);
|
|
11866
|
-
const showCollection =
|
|
12069
|
+
const showCollection = useCallback23(
|
|
11867
12070
|
(collectionTitle) => {
|
|
11868
12071
|
if (!canvas) return;
|
|
11869
12072
|
canvas.dispatchAction({
|
|
@@ -11875,7 +12078,7 @@ function useCommerceActions() {
|
|
|
11875
12078
|
},
|
|
11876
12079
|
[canvas]
|
|
11877
12080
|
);
|
|
11878
|
-
const navigateToProductSet =
|
|
12081
|
+
const navigateToProductSet = useCallback23(
|
|
11879
12082
|
(handle, title, productIds) => {
|
|
11880
12083
|
if (!canvas) return;
|
|
11881
12084
|
canvas.dispatchAction({
|
|
@@ -11896,19 +12099,19 @@ var SPOTLIGHT_MAX_AGE_MS = 3e4;
|
|
|
11896
12099
|
function useCartLineRow(line, opts) {
|
|
11897
12100
|
const actions = useCommerceActions();
|
|
11898
12101
|
const drawerFocus = useCartDrawerFocus();
|
|
11899
|
-
const rowRef =
|
|
12102
|
+
const rowRef = React44.useRef(null);
|
|
11900
12103
|
const pending2 = isPendingCartLine(line);
|
|
11901
12104
|
const navigable = actions !== null && !pending2 && line.productId.length > 0;
|
|
11902
12105
|
const onNavigated = opts === void 0 ? void 0 : opts.onNavigated;
|
|
11903
|
-
const navigatedRef =
|
|
12106
|
+
const navigatedRef = React44.useRef(onNavigated);
|
|
11904
12107
|
navigatedRef.current = onNavigated;
|
|
11905
|
-
const navigate =
|
|
12108
|
+
const navigate = React44.useCallback(() => {
|
|
11906
12109
|
if (actions === null) return;
|
|
11907
12110
|
actions.navigateToProduct(line.productId, line.title);
|
|
11908
12111
|
const done = navigatedRef.current;
|
|
11909
12112
|
if (done !== void 0) done();
|
|
11910
12113
|
}, [actions, line.productId, line.title]);
|
|
11911
|
-
const interaction =
|
|
12114
|
+
const interaction = React44.useMemo(() => {
|
|
11912
12115
|
if (!navigable) return void 0;
|
|
11913
12116
|
return {
|
|
11914
12117
|
onClick: navigate,
|
|
@@ -11923,7 +12126,7 @@ function useCartLineRow(line, opts) {
|
|
|
11923
12126
|
};
|
|
11924
12127
|
}, [navigable, navigate]);
|
|
11925
12128
|
const spotlightKey = drawerFocus !== null && !pending2 && line.productId.length > 0 && drawerFocus.productId === line.productId && Date.now() - drawerFocus.at < SPOTLIGHT_MAX_AGE_MS ? drawerFocus.at : null;
|
|
11926
|
-
|
|
12129
|
+
React44.useEffect(() => {
|
|
11927
12130
|
if (spotlightKey === null) return;
|
|
11928
12131
|
const node = rowRef.current;
|
|
11929
12132
|
if (node === null) return;
|
|
@@ -11933,7 +12136,7 @@ function useCartLineRow(line, opts) {
|
|
|
11933
12136
|
}
|
|
11934
12137
|
|
|
11935
12138
|
// src/verticals/commerce/wishlist/use-wishlist-drawer.ts
|
|
11936
|
-
import { useCallback as
|
|
12139
|
+
import { useCallback as useCallback25, useState as useState16 } from "react";
|
|
11937
12140
|
var warnedDegraded = false;
|
|
11938
12141
|
function useSafeWishlist() {
|
|
11939
12142
|
try {
|
|
@@ -11956,12 +12159,12 @@ function useSafeWishlist() {
|
|
|
11956
12159
|
}
|
|
11957
12160
|
function useWishlistDrawer() {
|
|
11958
12161
|
const wishlist = useSafeWishlist();
|
|
11959
|
-
const [isOpen2, setIsOpen] =
|
|
11960
|
-
const open =
|
|
11961
|
-
const close =
|
|
11962
|
-
const toggle =
|
|
12162
|
+
const [isOpen2, setIsOpen] = useState16(false);
|
|
12163
|
+
const open = useCallback25(() => setIsOpen(true), []);
|
|
12164
|
+
const close = useCallback25(() => setIsOpen(false), []);
|
|
12165
|
+
const toggle = useCallback25(() => setIsOpen((p) => !p), []);
|
|
11963
12166
|
useExclusiveOverlay("wishlist", isOpen2, close);
|
|
11964
|
-
const removeLine =
|
|
12167
|
+
const removeLine = useCallback25(
|
|
11965
12168
|
(productId) => {
|
|
11966
12169
|
if (wishlist === null) {
|
|
11967
12170
|
console.warn("[useWishlistDrawer] removeLine called with no commerce provider");
|
|
@@ -11985,9 +12188,9 @@ function useWishlistDrawer() {
|
|
|
11985
12188
|
}
|
|
11986
12189
|
|
|
11987
12190
|
// src/shared/use-image-hover.ts
|
|
11988
|
-
import { useState as
|
|
12191
|
+
import { useState as useState17 } from "react";
|
|
11989
12192
|
function useImageHover() {
|
|
11990
|
-
const [hover, setHover] =
|
|
12193
|
+
const [hover, setHover] = useState17(false);
|
|
11991
12194
|
return {
|
|
11992
12195
|
hover,
|
|
11993
12196
|
hoverProps: {
|
|
@@ -12068,7 +12271,7 @@ function pickColorCount(product) {
|
|
|
12068
12271
|
}
|
|
12069
12272
|
|
|
12070
12273
|
// src/verticals/commerce/product/use-look-card.ts
|
|
12071
|
-
import * as
|
|
12274
|
+
import * as React45 from "react";
|
|
12072
12275
|
|
|
12073
12276
|
// src/verticals/commerce/variant/variant-option-axes.ts
|
|
12074
12277
|
function carriesValue(variant, name, value) {
|
|
@@ -12278,8 +12481,8 @@ function useLookCard({
|
|
|
12278
12481
|
const session = useFourtySession();
|
|
12279
12482
|
const addFlash = useSuccessFlash({ duration: 1200 });
|
|
12280
12483
|
const locale = useSpaceLocale();
|
|
12281
|
-
const [pending2, setPending] =
|
|
12282
|
-
const clean =
|
|
12484
|
+
const [pending2, setPending] = React45.useState(null);
|
|
12485
|
+
const clean = React45.useMemo(
|
|
12283
12486
|
() => (Array.isArray(products) ? products : []).filter(
|
|
12284
12487
|
(p) => p !== null && p !== void 0 && typeof p === "object"
|
|
12285
12488
|
),
|
|
@@ -12604,17 +12807,17 @@ function resolveSwatchColor(name) {
|
|
|
12604
12807
|
}
|
|
12605
12808
|
|
|
12606
12809
|
// src/verticals/content/use-content-actions.ts
|
|
12607
|
-
import { useCallback as
|
|
12810
|
+
import { useCallback as useCallback26 } from "react";
|
|
12608
12811
|
function useContentActions() {
|
|
12609
12812
|
const canvas = useCanvasActions();
|
|
12610
|
-
const navigateToArticle =
|
|
12813
|
+
const navigateToArticle = useCallback26(
|
|
12611
12814
|
(articleId, title) => {
|
|
12612
12815
|
if (!canvas) return;
|
|
12613
12816
|
canvas.navigate({ kind: "article", id: articleId }, title);
|
|
12614
12817
|
},
|
|
12615
12818
|
[canvas]
|
|
12616
12819
|
);
|
|
12617
|
-
const subscribeNewsletter =
|
|
12820
|
+
const subscribeNewsletter = useCallback26(
|
|
12618
12821
|
(email, buttonLabel) => {
|
|
12619
12822
|
if (!canvas) return;
|
|
12620
12823
|
canvas.dispatchAction({
|
|
@@ -12631,10 +12834,10 @@ function useContentActions() {
|
|
|
12631
12834
|
}
|
|
12632
12835
|
|
|
12633
12836
|
// src/host/Spacefront.tsx
|
|
12634
|
-
import { useEffect as useEffect19, useState as
|
|
12837
|
+
import { useEffect as useEffect19, useState as useState19 } from "react";
|
|
12635
12838
|
|
|
12636
12839
|
// package.json
|
|
12637
|
-
var version = "0.5.
|
|
12840
|
+
var version = "0.5.13";
|
|
12638
12841
|
|
|
12639
12842
|
// src/host/host-modules.ts
|
|
12640
12843
|
import * as react from "react";
|
|
@@ -12695,10 +12898,10 @@ function loadEngine(apiUrl) {
|
|
|
12695
12898
|
}
|
|
12696
12899
|
|
|
12697
12900
|
// src/host/Spacefront.tsx
|
|
12698
|
-
import { jsx as
|
|
12901
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
12699
12902
|
function Spacefront(props) {
|
|
12700
|
-
const [engine, setEngine] =
|
|
12701
|
-
const [failure, setFailure] =
|
|
12903
|
+
const [engine, setEngine] = useState19(null);
|
|
12904
|
+
const [failure, setFailure] = useState19(null);
|
|
12702
12905
|
useEffect19(() => {
|
|
12703
12906
|
let live = true;
|
|
12704
12907
|
loadEngine(props.apiUrl).then(
|
|
@@ -12717,11 +12920,11 @@ function Spacefront(props) {
|
|
|
12717
12920
|
if (failure !== null) throw failure;
|
|
12718
12921
|
if (engine === null) return null;
|
|
12719
12922
|
const EngineRoot = engine.EngineRoot;
|
|
12720
|
-
return /* @__PURE__ */
|
|
12923
|
+
return /* @__PURE__ */ jsx25(EngineRoot, { ...props });
|
|
12721
12924
|
}
|
|
12722
12925
|
|
|
12723
12926
|
// src/npm.ts
|
|
12724
|
-
import { z as
|
|
12927
|
+
import { z as z52 } from "zod";
|
|
12725
12928
|
export {
|
|
12726
12929
|
ACQUISITION_KIND_LABELS,
|
|
12727
12930
|
ACTIVE_PANEL_ATTR,
|
|
@@ -12755,6 +12958,8 @@ export {
|
|
|
12755
12958
|
BRAND_MARK_MAX_BYTES,
|
|
12756
12959
|
BRAND_MARK_SLOTS,
|
|
12757
12960
|
BRAND_MARK_TYPES,
|
|
12961
|
+
BotCheckNoticeProvider,
|
|
12962
|
+
BotCheckNoticeSchema,
|
|
12758
12963
|
BrandMarkImageSchema,
|
|
12759
12964
|
BrandMarkSchema,
|
|
12760
12965
|
BugLocationSchema,
|
|
@@ -12782,6 +12987,7 @@ export {
|
|
|
12782
12987
|
CHECKOUT_OUTCOMES,
|
|
12783
12988
|
CHECKOUT_REACHED_OUTCOMES,
|
|
12784
12989
|
CHECKOUT_REFUSALS,
|
|
12990
|
+
CHIP_SHOW_SIGNAL,
|
|
12785
12991
|
CLICK_ID_KINDS,
|
|
12786
12992
|
CLIENT_STATE_HELLO_SIGNAL,
|
|
12787
12993
|
COMPONENT_SOURCE,
|
|
@@ -12791,6 +12997,8 @@ export {
|
|
|
12791
12997
|
CONTINUATION_ENABLED,
|
|
12792
12998
|
CUSTOMER_ACCOUNT_SESSION_HEADER,
|
|
12793
12999
|
CanvasArrangementProvider,
|
|
13000
|
+
CanvasLeadProvider,
|
|
13001
|
+
CanvasLeadSlot,
|
|
12794
13002
|
CanvasMotionStyleProvider,
|
|
12795
13003
|
CanvasOutletProvider,
|
|
12796
13004
|
CanvasTailMount,
|
|
@@ -13052,6 +13260,7 @@ export {
|
|
|
13052
13260
|
catalogToWire,
|
|
13053
13261
|
changeAnchorWithin,
|
|
13054
13262
|
checkoutHandoffReasonFor,
|
|
13263
|
+
chipsFromShowSignal,
|
|
13055
13264
|
claimExclusiveOverlay,
|
|
13056
13265
|
classifyComparisonValue,
|
|
13057
13266
|
classifyItemChange,
|
|
@@ -13127,6 +13336,8 @@ export {
|
|
|
13127
13336
|
hostPlace,
|
|
13128
13337
|
hostingAllows,
|
|
13129
13338
|
injectGoogleFonts,
|
|
13339
|
+
installmentOffer,
|
|
13340
|
+
installmentPayment,
|
|
13130
13341
|
isActiveDirective,
|
|
13131
13342
|
isAllowedAttachmentType,
|
|
13132
13343
|
isDegenerateLayout,
|
|
@@ -13278,6 +13489,7 @@ export {
|
|
|
13278
13489
|
surfaceEmits,
|
|
13279
13490
|
surfaceSuppressionReason,
|
|
13280
13491
|
takeQueuedDiscountCodes,
|
|
13492
|
+
takeSubmitOrigin,
|
|
13281
13493
|
text,
|
|
13282
13494
|
textDirectionOf,
|
|
13283
13495
|
threadRowAttrs,
|
|
@@ -13299,10 +13511,13 @@ export {
|
|
|
13299
13511
|
useAgentPresenceFrame,
|
|
13300
13512
|
useAgentPresenceFresh,
|
|
13301
13513
|
useAnalyticsSink,
|
|
13514
|
+
useBotCheckNotice,
|
|
13302
13515
|
useCanvasActions,
|
|
13303
13516
|
useCanvasArrangement,
|
|
13304
13517
|
useCanvasBack,
|
|
13305
13518
|
useCanvasForward,
|
|
13519
|
+
useCanvasLead,
|
|
13520
|
+
useCanvasLeadTarget,
|
|
13306
13521
|
useCanvasMotionStyle,
|
|
13307
13522
|
useCanvasTail,
|
|
13308
13523
|
useCanvasViewBack,
|
|
@@ -13364,6 +13579,7 @@ export {
|
|
|
13364
13579
|
useHydrationState,
|
|
13365
13580
|
useHydrators,
|
|
13366
13581
|
useInlineCompletion,
|
|
13582
|
+
useInstallmentOffer,
|
|
13367
13583
|
useInteraction,
|
|
13368
13584
|
useInteraction2 as useInteractionTracking,
|
|
13369
13585
|
useInterval,
|
|
@@ -13438,6 +13654,7 @@ export {
|
|
|
13438
13654
|
useVisibleFactList,
|
|
13439
13655
|
useVisitorName,
|
|
13440
13656
|
useVoiceCapture,
|
|
13657
|
+
useWaitingSubmitOrigin,
|
|
13441
13658
|
useWakeLock,
|
|
13442
13659
|
useWishlist,
|
|
13443
13660
|
useWishlistDrawer,
|
|
@@ -13451,5 +13668,6 @@ export {
|
|
|
13451
13668
|
withInteractionTracking,
|
|
13452
13669
|
withQueuedDiscountCodes,
|
|
13453
13670
|
withSignalTurn,
|
|
13454
|
-
|
|
13671
|
+
withoutClosingQuestion,
|
|
13672
|
+
z52 as z
|
|
13455
13673
|
};
|