@40rty/ams-sdk 0.5.10 → 0.5.12
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 +762 -618
- 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/index.d.ts +1 -0
- package/dist/types/sdk/src/verticals/commerce/cart/queued-discount-codes.d.ts +24 -0
- package/dist/types/sdk/src/verticals/commerce/index.d.ts +1 -0
- package/dist/types/spacestation/src/contracts/customer-account-session-header.d.ts +2 -0
- package/dist/types/spacestation/src/contracts/socket-ticket-param.d.ts +16 -0
- package/dist/types/spacestation/src/index.d.ts +3 -1
- package/dist/types/spacestation/src/shell/bot-check-notice.d.ts +34 -0
- package/dist/types/spacestation/src/space/connector.d.ts +3 -2
- 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,
|
|
@@ -76,6 +78,7 @@ __export(src_exports3, {
|
|
|
76
78
|
CONSENT_DISPOSITION: () => CONSENT_DISPOSITION,
|
|
77
79
|
CONTAINER_TYPES: () => CONTAINER_TYPES,
|
|
78
80
|
CONTINUATION_ENABLED: () => CONTINUATION_ENABLED,
|
|
81
|
+
CUSTOMER_ACCOUNT_SESSION_HEADER: () => CUSTOMER_ACCOUNT_SESSION_HEADER,
|
|
79
82
|
CanvasArrangementProvider: () => CanvasArrangementProvider,
|
|
80
83
|
CanvasMotionStyleProvider: () => CanvasMotionStyleProvider,
|
|
81
84
|
CanvasOutletProvider: () => CanvasOutletProvider,
|
|
@@ -216,6 +219,8 @@ __export(src_exports3, {
|
|
|
216
219
|
SDK_VERSION_PATTERN: () => SDK_VERSION_PATTERN,
|
|
217
220
|
SELECTION_ORIGIN_VISITOR: () => SELECTION_ORIGIN_VISITOR,
|
|
218
221
|
SIGNAL_PATCH_PREFIX: () => SIGNAL_PATCH_PREFIX,
|
|
222
|
+
SOCKET_BEARER_SUBPROTOCOL_PREFIX: () => SOCKET_BEARER_SUBPROTOCOL_PREFIX,
|
|
223
|
+
SOCKET_SUBPROTOCOL: () => SOCKET_SUBPROTOCOL,
|
|
219
224
|
SOCKET_TICKET_PARAM: () => SOCKET_TICKET_PARAM,
|
|
220
225
|
STRUCTURAL_BASELINE_CATALOG: () => STRUCTURAL_BASELINE_CATALOG,
|
|
221
226
|
STRUCTURAL_BASELINE_TYPES: () => STRUCTURAL_BASELINE_TYPES,
|
|
@@ -314,6 +319,7 @@ __export(src_exports3, {
|
|
|
314
319
|
arrivalToParams: () => arrivalToParams,
|
|
315
320
|
attachmentFailureOfStatus: () => attachmentFailureOfStatus,
|
|
316
321
|
bareComponentType: () => bareComponentType,
|
|
322
|
+
bearerFromSocketProtocols: () => bearerFromSocketProtocols,
|
|
317
323
|
buildBaseAttributesConfig: () => buildBaseAttributesConfig,
|
|
318
324
|
buildBucketLabelsConfig: () => buildBucketLabelsConfig,
|
|
319
325
|
buildComparisonRows: () => buildComparisonRows,
|
|
@@ -365,6 +371,7 @@ __export(src_exports3, {
|
|
|
365
371
|
createUnavailableProduct: () => createUnavailableProduct,
|
|
366
372
|
declaredSpaceLocaleOf: () => declaredSpaceLocaleOf,
|
|
367
373
|
defineEventKind: () => defineEventKind,
|
|
374
|
+
dequeueDiscountCode: () => dequeueDiscountCode,
|
|
368
375
|
derivePropsDoc: () => derivePropsDoc,
|
|
369
376
|
deriveSourceElement: () => deriveSourceElement,
|
|
370
377
|
deriveTurnChangeAnchor: () => deriveTurnChangeAnchor,
|
|
@@ -409,6 +416,7 @@ __export(src_exports3, {
|
|
|
409
416
|
isActiveDirective: () => isActiveDirective,
|
|
410
417
|
isAllowedAttachmentType: () => isAllowedAttachmentType,
|
|
411
418
|
isDegenerateLayout: () => isDegenerateLayout,
|
|
419
|
+
isDiscountCodeQueued: () => isDiscountCodeQueued,
|
|
412
420
|
isDraftSource: () => isDraftSource,
|
|
413
421
|
isElementUnfilled: () => isElementUnfilled,
|
|
414
422
|
isEmptyPropValue: () => isEmptyPropValue,
|
|
@@ -463,6 +471,7 @@ __export(src_exports3, {
|
|
|
463
471
|
prose: () => prose,
|
|
464
472
|
pruneFilterChips: () => pruneFilterChips,
|
|
465
473
|
publishClientState: () => publishClientState,
|
|
474
|
+
queueDiscountCode: () => queueDiscountCode,
|
|
466
475
|
raiseStanding: () => raiseStanding,
|
|
467
476
|
readBaseAttributesConfig: () => readBaseAttributesConfig,
|
|
468
477
|
readBucketLabelsConfig: () => readBucketLabelsConfig,
|
|
@@ -471,6 +480,7 @@ __export(src_exports3, {
|
|
|
471
480
|
readHosting: () => readHosting,
|
|
472
481
|
readOptionAxes: () => readOptionAxes,
|
|
473
482
|
readPdpCompanions: () => readPdpCompanions,
|
|
483
|
+
readQueuedDiscountCodes: () => readQueuedDiscountCodes,
|
|
474
484
|
recordCartActionFailure: () => recordCartActionFailure,
|
|
475
485
|
recordOptionSelections: () => recordOptionSelections,
|
|
476
486
|
recordVariantSelection: () => recordVariantSelection,
|
|
@@ -541,6 +551,7 @@ __export(src_exports3, {
|
|
|
541
551
|
settleArmedCheckoutHandoff: () => settleArmedCheckoutHandoff,
|
|
542
552
|
settledBlocks: () => settledBlocks,
|
|
543
553
|
settledCart: () => settledCart,
|
|
554
|
+
socketProtocolsFor: () => socketProtocolsFor,
|
|
544
555
|
spaceLocaleOf: () => spaceLocaleOf,
|
|
545
556
|
splitAnswer: () => splitAnswer,
|
|
546
557
|
splitSentences: () => splitSentences,
|
|
@@ -551,6 +562,7 @@ __export(src_exports3, {
|
|
|
551
562
|
subscribeServerState: () => subscribeServerState,
|
|
552
563
|
surfaceEmits: () => surfaceEmits,
|
|
553
564
|
surfaceSuppressionReason: () => surfaceSuppressionReason,
|
|
565
|
+
takeQueuedDiscountCodes: () => takeQueuedDiscountCodes,
|
|
554
566
|
text: () => text,
|
|
555
567
|
textDirectionOf: () => textDirectionOf,
|
|
556
568
|
threadRowAttrs: () => threadRowAttrs,
|
|
@@ -572,6 +584,7 @@ __export(src_exports3, {
|
|
|
572
584
|
useAgentPresenceFrame: () => useAgentPresenceFrame,
|
|
573
585
|
useAgentPresenceFresh: () => useAgentPresenceFresh,
|
|
574
586
|
useAnalyticsSink: () => useAnalyticsSink,
|
|
587
|
+
useBotCheckNotice: () => useBotCheckNotice,
|
|
575
588
|
useCanvasActions: () => useCanvasActions,
|
|
576
589
|
useCanvasArrangement: () => useCanvasArrangement,
|
|
577
590
|
useCanvasBack: () => useCanvasBack,
|
|
@@ -671,6 +684,7 @@ __export(src_exports3, {
|
|
|
671
684
|
useProducts: () => useProducts,
|
|
672
685
|
useProjection: () => useProjection,
|
|
673
686
|
usePromptComposer: () => usePromptComposer,
|
|
687
|
+
useQueuedDiscountCodes: () => useQueuedDiscountCodes,
|
|
674
688
|
useReasoning: () => useReasoning,
|
|
675
689
|
useReconcileDismissed: () => useReconcileDismissed,
|
|
676
690
|
useReconcileFlowSet: () => useReconcileFlowSet,
|
|
@@ -721,6 +735,7 @@ __export(src_exports3, {
|
|
|
721
735
|
wipeProfile: () => wipeProfile,
|
|
722
736
|
withCartActorOrigin: () => withCartActorOrigin,
|
|
723
737
|
withInteractionTracking: () => withInteractionTracking,
|
|
738
|
+
withQueuedDiscountCodes: () => withQueuedDiscountCodes,
|
|
724
739
|
withSignalTurn: () => withSignalTurn
|
|
725
740
|
});
|
|
726
741
|
|
|
@@ -1511,6 +1526,7 @@ __export(src_exports, {
|
|
|
1511
1526
|
BRAND_MARK_MAX_BYTES: () => BRAND_MARK_MAX_BYTES,
|
|
1512
1527
|
BRAND_MARK_SLOTS: () => BRAND_MARK_SLOTS,
|
|
1513
1528
|
BRAND_MARK_TYPES: () => BRAND_MARK_TYPES,
|
|
1529
|
+
BotCheckNoticeSchema: () => BotCheckNoticeSchema,
|
|
1514
1530
|
BrandMarkImageSchema: () => BrandMarkImageSchema,
|
|
1515
1531
|
BrandMarkSchema: () => BrandMarkSchema,
|
|
1516
1532
|
BugLocationSchema: () => BugLocationSchema,
|
|
@@ -1530,6 +1546,7 @@ __export(src_exports, {
|
|
|
1530
1546
|
COMPONENT_SOURCE_DEFAULT_THEME: () => COMPONENT_SOURCE_DEFAULT_THEME,
|
|
1531
1547
|
CONTAINER_TYPES: () => CONTAINER_TYPES,
|
|
1532
1548
|
CONTINUATION_ENABLED: () => CONTINUATION_ENABLED,
|
|
1549
|
+
CUSTOMER_ACCOUNT_SESSION_HEADER: () => CUSTOMER_ACCOUNT_SESSION_HEADER,
|
|
1533
1550
|
CartAddSignalPayloadSchema: () => CartAddSignalPayloadSchema,
|
|
1534
1551
|
CartRemoveSignalPayloadSchema: () => CartRemoveSignalPayloadSchema,
|
|
1535
1552
|
CartSnapshotLineSchema: () => CartSnapshotLineSchema,
|
|
@@ -1606,6 +1623,8 @@ __export(src_exports, {
|
|
|
1606
1623
|
SDK_VERSION_PATTERN: () => SDK_VERSION_PATTERN,
|
|
1607
1624
|
SELECTION_ORIGIN_VISITOR: () => SELECTION_ORIGIN_VISITOR,
|
|
1608
1625
|
SIGNAL_PATCH_PREFIX: () => SIGNAL_PATCH_PREFIX,
|
|
1626
|
+
SOCKET_BEARER_SUBPROTOCOL_PREFIX: () => SOCKET_BEARER_SUBPROTOCOL_PREFIX,
|
|
1627
|
+
SOCKET_SUBPROTOCOL: () => SOCKET_SUBPROTOCOL,
|
|
1609
1628
|
SOCKET_TICKET_PARAM: () => SOCKET_TICKET_PARAM,
|
|
1610
1629
|
STRUCTURAL_BASELINE_CATALOG: () => STRUCTURAL_BASELINE_CATALOG,
|
|
1611
1630
|
STRUCTURAL_BASELINE_TYPES: () => STRUCTURAL_BASELINE_TYPES,
|
|
@@ -1679,6 +1698,7 @@ __export(src_exports, {
|
|
|
1679
1698
|
arrivalToParams: () => arrivalToParams,
|
|
1680
1699
|
attachmentFailureOfStatus: () => attachmentFailureOfStatus,
|
|
1681
1700
|
bareComponentType: () => bareComponentType,
|
|
1701
|
+
bearerFromSocketProtocols: () => bearerFromSocketProtocols,
|
|
1682
1702
|
canonicalOptionValue: () => canonicalOptionValue,
|
|
1683
1703
|
carriesShapeToken: () => carriesShapeToken,
|
|
1684
1704
|
catalogFromWire: () => catalogFromWire,
|
|
@@ -1748,6 +1768,7 @@ __export(src_exports, {
|
|
|
1748
1768
|
sdkShimsFor: () => sdkShimsFor,
|
|
1749
1769
|
sdkWindowProblem: () => sdkWindowProblem,
|
|
1750
1770
|
settledBlocks: () => settledBlocks,
|
|
1771
|
+
socketProtocolsFor: () => socketProtocolsFor,
|
|
1751
1772
|
spaceLocaleOf: () => spaceLocaleOf,
|
|
1752
1773
|
splitSentences: () => splitSentences,
|
|
1753
1774
|
stateSnapshotSignal: () => stateSnapshotSignal,
|
|
@@ -3968,6 +3989,25 @@ function arrivalToParams(arrival, into) {
|
|
|
3968
3989
|
|
|
3969
3990
|
// ../spacestation/src/contracts/socket-ticket-param.ts
|
|
3970
3991
|
var SOCKET_TICKET_PARAM = "ticket";
|
|
3992
|
+
var SOCKET_SUBPROTOCOL = "fourty.v1";
|
|
3993
|
+
var SOCKET_BEARER_SUBPROTOCOL_PREFIX = "fourty.bearer.";
|
|
3994
|
+
function socketProtocolsFor(bearer) {
|
|
3995
|
+
return [SOCKET_SUBPROTOCOL, `${SOCKET_BEARER_SUBPROTOCOL_PREFIX}${bearer}`];
|
|
3996
|
+
}
|
|
3997
|
+
function bearerFromSocketProtocols(header) {
|
|
3998
|
+
if (header === void 0) return void 0;
|
|
3999
|
+
for (const offered of header.split(",")) {
|
|
4000
|
+
const protocol = offered.trim();
|
|
4001
|
+
if (protocol.startsWith(SOCKET_BEARER_SUBPROTOCOL_PREFIX)) {
|
|
4002
|
+
const bearer = protocol.slice(SOCKET_BEARER_SUBPROTOCOL_PREFIX.length);
|
|
4003
|
+
if (bearer.length > 0) return bearer;
|
|
4004
|
+
}
|
|
4005
|
+
}
|
|
4006
|
+
return void 0;
|
|
4007
|
+
}
|
|
4008
|
+
|
|
4009
|
+
// ../spacestation/src/contracts/customer-account-session-header.ts
|
|
4010
|
+
var CUSTOMER_ACCOUNT_SESSION_HEADER = "x-fourty-session";
|
|
3971
4011
|
|
|
3972
4012
|
// ../spacestation/src/contracts/wire-protocol.ts
|
|
3973
4013
|
var WIRE_PROTOCOL_VERSION = 1;
|
|
@@ -4088,8 +4128,15 @@ var UpdateAgentDirectiveInputSchema = z38.object({
|
|
|
4088
4128
|
}).strict();
|
|
4089
4129
|
var ReorderAgentDirectivesInputSchema = z38.object({ ids: z38.array(z38.string()).min(1) }).strict();
|
|
4090
4130
|
|
|
4091
|
-
// ../spacestation/src/
|
|
4131
|
+
// ../spacestation/src/shell/bot-check-notice.ts
|
|
4092
4132
|
import { z as z39 } from "zod";
|
|
4133
|
+
var BotCheckNoticeSchema = z39.object({
|
|
4134
|
+
/** Read in order: plain text, and links the notice must keep linked. */
|
|
4135
|
+
segments: z39.array(z39.union([z39.string(), z39.object({ text: z39.string(), href: z39.string().url() })])).min(1)
|
|
4136
|
+
});
|
|
4137
|
+
|
|
4138
|
+
// ../spacestation/src/space/space-locale.ts
|
|
4139
|
+
import { z as z40 } from "zod";
|
|
4093
4140
|
var DEFAULT_SPACE_LOCALE = "en-US";
|
|
4094
4141
|
function isBcp47(tag) {
|
|
4095
4142
|
try {
|
|
@@ -4099,7 +4146,7 @@ function isBcp47(tag) {
|
|
|
4099
4146
|
throw err;
|
|
4100
4147
|
}
|
|
4101
4148
|
}
|
|
4102
|
-
var SpaceLocaleSchema =
|
|
4149
|
+
var SpaceLocaleSchema = z40.string().refine(isBcp47, { message: "locale must be a BCP 47 language tag, e.g. he-IL" });
|
|
4103
4150
|
var RTL_SCRIPTS = /* @__PURE__ */ new Set(["Arab", "Hebr", "Thaa", "Syrc", "Nkoo", "Adlm", "Rohg", "Mand", "Samr"]);
|
|
4104
4151
|
var RTL_LANGUAGES = /* @__PURE__ */ new Set(["ar", "he", "iw", "fa", "ur", "ps", "sd", "ug", "yi", "dv", "ckb", "syr"]);
|
|
4105
4152
|
function textDirectionOf(locale) {
|
|
@@ -4189,30 +4236,30 @@ function hostingAllows(hosting, surface) {
|
|
|
4189
4236
|
}
|
|
4190
4237
|
|
|
4191
4238
|
// ../spacestation/src/space/trace.ts
|
|
4192
|
-
import { z as
|
|
4193
|
-
var RunTokenUsageSchema =
|
|
4194
|
-
input_tokens:
|
|
4195
|
-
output_tokens:
|
|
4196
|
-
cache_read_tokens:
|
|
4239
|
+
import { z as z41 } from "zod";
|
|
4240
|
+
var RunTokenUsageSchema = z41.object({
|
|
4241
|
+
input_tokens: z41.number().optional(),
|
|
4242
|
+
output_tokens: z41.number().optional(),
|
|
4243
|
+
cache_read_tokens: z41.number().optional()
|
|
4197
4244
|
});
|
|
4198
|
-
var TraceRecordSchema =
|
|
4199
|
-
id:
|
|
4200
|
-
spaceId:
|
|
4201
|
-
sessionId:
|
|
4245
|
+
var TraceRecordSchema = z41.object({
|
|
4246
|
+
id: z41.string().uuid(),
|
|
4247
|
+
spaceId: z41.string().uuid().nullable(),
|
|
4248
|
+
sessionId: z41.string(),
|
|
4202
4249
|
/** OTP-verified visitor email the session was unlocked with, or `null`
|
|
4203
4250
|
* for an unlocked space / anonymous unlock. */
|
|
4204
|
-
visitorEmail:
|
|
4205
|
-
userPrompt:
|
|
4206
|
-
branch:
|
|
4207
|
-
responseText:
|
|
4208
|
-
layout:
|
|
4209
|
-
phaseTimings:
|
|
4210
|
-
tokensByModel:
|
|
4211
|
-
toolCalls:
|
|
4212
|
-
diagnostics:
|
|
4213
|
-
latencyFirstText:
|
|
4214
|
-
latencyFirstPatch:
|
|
4215
|
-
latencyTotal:
|
|
4251
|
+
visitorEmail: z41.string().nullable(),
|
|
4252
|
+
userPrompt: z41.string(),
|
|
4253
|
+
branch: z41.string().nullable(),
|
|
4254
|
+
responseText: z41.string().nullable(),
|
|
4255
|
+
layout: z41.unknown().nullable(),
|
|
4256
|
+
phaseTimings: z41.record(z41.number()).nullable(),
|
|
4257
|
+
tokensByModel: z41.record(RunTokenUsageSchema).nullable(),
|
|
4258
|
+
toolCalls: z41.array(z41.unknown()).nullable(),
|
|
4259
|
+
diagnostics: z41.array(z41.unknown()).nullable(),
|
|
4260
|
+
latencyFirstText: z41.number().int().nullable(),
|
|
4261
|
+
latencyFirstPatch: z41.number().int().nullable(),
|
|
4262
|
+
latencyTotal: z41.number().int().nullable(),
|
|
4216
4263
|
/**
|
|
4217
4264
|
* The CLIENT's turn id for this run, or `null`.
|
|
4218
4265
|
*
|
|
@@ -4228,29 +4275,29 @@ var TraceRecordSchema = z40.object({
|
|
|
4228
4275
|
* a turn whose ack the client never saw — none of which is evidence that a
|
|
4229
4276
|
* visitor asked something and got nothing.
|
|
4230
4277
|
*/
|
|
4231
|
-
turnId:
|
|
4278
|
+
turnId: z41.string().nullable(),
|
|
4232
4279
|
/** Serialized `TraceTracker.exportState()` payload (parsed object) —
|
|
4233
4280
|
* lets the inspector rehydrate this run verbatim after a reload. */
|
|
4234
|
-
trackerState:
|
|
4235
|
-
createdAt:
|
|
4281
|
+
trackerState: z41.unknown().nullable(),
|
|
4282
|
+
createdAt: z41.string()
|
|
4236
4283
|
});
|
|
4237
|
-
var MillisecondsSchema =
|
|
4238
|
-
var CreateTraceInputSchema =
|
|
4239
|
-
spaceId:
|
|
4240
|
-
sessionId:
|
|
4241
|
-
visitorEmail:
|
|
4242
|
-
userPrompt:
|
|
4243
|
-
branch:
|
|
4244
|
-
responseText:
|
|
4245
|
-
layout:
|
|
4246
|
-
phaseTimings:
|
|
4247
|
-
tokensByModel:
|
|
4248
|
-
toolCalls:
|
|
4249
|
-
diagnostics:
|
|
4284
|
+
var MillisecondsSchema = z41.number().nullable().transform((v) => v === null ? null : Math.round(v));
|
|
4285
|
+
var CreateTraceInputSchema = z41.object({
|
|
4286
|
+
spaceId: z41.string().uuid().nullable(),
|
|
4287
|
+
sessionId: z41.string(),
|
|
4288
|
+
visitorEmail: z41.string().nullable(),
|
|
4289
|
+
userPrompt: z41.string(),
|
|
4290
|
+
branch: z41.string().nullable(),
|
|
4291
|
+
responseText: z41.string().nullable(),
|
|
4292
|
+
layout: z41.unknown().nullable(),
|
|
4293
|
+
phaseTimings: z41.record(z41.number()).nullable(),
|
|
4294
|
+
tokensByModel: z41.record(RunTokenUsageSchema).nullable(),
|
|
4295
|
+
toolCalls: z41.array(z41.unknown()).nullable(),
|
|
4296
|
+
diagnostics: z41.array(z41.unknown()).nullable(),
|
|
4250
4297
|
latencyFirstText: MillisecondsSchema,
|
|
4251
4298
|
latencyFirstPatch: MillisecondsSchema,
|
|
4252
4299
|
latencyTotal: MillisecondsSchema,
|
|
4253
|
-
trackerState:
|
|
4300
|
+
trackerState: z41.unknown().nullable(),
|
|
4254
4301
|
/**
|
|
4255
4302
|
* The CLIENT's turn id for this run, or `null`.
|
|
4256
4303
|
*
|
|
@@ -4266,37 +4313,37 @@ var CreateTraceInputSchema = z40.object({
|
|
|
4266
4313
|
* a turn whose ack the client never saw — none of which is evidence that a
|
|
4267
4314
|
* visitor asked something and got nothing.
|
|
4268
4315
|
*/
|
|
4269
|
-
turnId:
|
|
4316
|
+
turnId: z41.string().nullable()
|
|
4270
4317
|
});
|
|
4271
|
-
var AgentSessionSummarySchema =
|
|
4272
|
-
sessionId:
|
|
4318
|
+
var AgentSessionSummarySchema = z41.object({
|
|
4319
|
+
sessionId: z41.string(),
|
|
4273
4320
|
/** Turn rows only; background/secondary runs are excluded by the aggregate. */
|
|
4274
|
-
turnCount:
|
|
4321
|
+
turnCount: z41.number().int(),
|
|
4275
4322
|
/** The session's opening prompt — titles the row in the UI. */
|
|
4276
|
-
firstPrompt:
|
|
4277
|
-
startedAt:
|
|
4278
|
-
lastRunAt:
|
|
4323
|
+
firstPrompt: z41.string(),
|
|
4324
|
+
startedAt: z41.string(),
|
|
4325
|
+
lastRunAt: z41.string(),
|
|
4279
4326
|
/** Summed `latency_total` across the session's turns. */
|
|
4280
|
-
totalLatencyMs:
|
|
4327
|
+
totalLatencyMs: z41.number().int()
|
|
4281
4328
|
});
|
|
4282
|
-
var SessionTurnSchema =
|
|
4283
|
-
id:
|
|
4284
|
-
userPrompt:
|
|
4285
|
-
responseText:
|
|
4329
|
+
var SessionTurnSchema = z41.object({
|
|
4330
|
+
id: z41.string().uuid(),
|
|
4331
|
+
userPrompt: z41.string(),
|
|
4332
|
+
responseText: z41.string().nullable(),
|
|
4286
4333
|
/** Full cumulative Spec committed by this turn — never a patch delta. */
|
|
4287
|
-
layout:
|
|
4288
|
-
createdAt:
|
|
4289
|
-
latencyTotal:
|
|
4290
|
-
phaseTimings:
|
|
4291
|
-
tokensByModel:
|
|
4292
|
-
input_tokens:
|
|
4293
|
-
output_tokens:
|
|
4334
|
+
layout: z41.unknown().nullable(),
|
|
4335
|
+
createdAt: z41.string(),
|
|
4336
|
+
latencyTotal: z41.number().int().nullable(),
|
|
4337
|
+
phaseTimings: z41.record(z41.number()).nullable(),
|
|
4338
|
+
tokensByModel: z41.record(z41.object({
|
|
4339
|
+
input_tokens: z41.number().optional(),
|
|
4340
|
+
output_tokens: z41.number().optional()
|
|
4294
4341
|
})).nullable(),
|
|
4295
|
-
toolCalls:
|
|
4296
|
-
diagnostics:
|
|
4342
|
+
toolCalls: z41.array(z41.unknown()).nullable(),
|
|
4343
|
+
diagnostics: z41.array(z41.unknown()).nullable()
|
|
4297
4344
|
});
|
|
4298
|
-
var SessionReplaySchema =
|
|
4299
|
-
turns:
|
|
4345
|
+
var SessionReplaySchema = z41.object({
|
|
4346
|
+
turns: z41.array(SessionTurnSchema),
|
|
4300
4347
|
/**
|
|
4301
4348
|
* The session's own last-committed layout, read straight off the durable
|
|
4302
4349
|
* session record (`sessions.blob.layout`) rather than derived from `turns`.
|
|
@@ -4307,20 +4354,20 @@ var SessionReplaySchema = z40.object({
|
|
|
4307
4354
|
* a perfectly real layout; only this field can show it. Null exclusively
|
|
4308
4355
|
* when the durable session row itself could not be read.
|
|
4309
4356
|
*/
|
|
4310
|
-
sessionLayout:
|
|
4357
|
+
sessionLayout: z41.record(z41.string(), z41.unknown()).nullable()
|
|
4311
4358
|
});
|
|
4312
|
-
var SessionTraceSchema =
|
|
4313
|
-
trackerState:
|
|
4359
|
+
var SessionTraceSchema = z41.object({
|
|
4360
|
+
trackerState: z41.string().nullable()
|
|
4314
4361
|
});
|
|
4315
|
-
var LlmUsageDailySchema =
|
|
4316
|
-
day:
|
|
4362
|
+
var LlmUsageDailySchema = z41.object({
|
|
4363
|
+
day: z41.string(),
|
|
4317
4364
|
/** Deployment that made the call — 'production', 'staging', 'pr-123', 'development'. */
|
|
4318
|
-
environment:
|
|
4319
|
-
feature:
|
|
4320
|
-
model:
|
|
4321
|
-
provider:
|
|
4365
|
+
environment: z41.string(),
|
|
4366
|
+
feature: z41.string(),
|
|
4367
|
+
model: z41.string(),
|
|
4368
|
+
provider: z41.string(),
|
|
4322
4369
|
/** Masked tail of the key actually billed, or null when unknown/non-Google. */
|
|
4323
|
-
keyFingerprint:
|
|
4370
|
+
keyFingerprint: z41.string().nullable(),
|
|
4324
4371
|
/**
|
|
4325
4372
|
* The space the call served, or null when it served none.
|
|
4326
4373
|
*
|
|
@@ -4329,91 +4376,91 @@ var LlmUsageDailySchema = z40.object({
|
|
|
4329
4376
|
* report that share rather than dropping it, or a per-space total reads as
|
|
4330
4377
|
* the platform total.
|
|
4331
4378
|
*/
|
|
4332
|
-
spaceId:
|
|
4379
|
+
spaceId: z41.string().nullable(),
|
|
4333
4380
|
/**
|
|
4334
4381
|
* The surface of the session the call served (`sessions.surface`), or null
|
|
4335
4382
|
* when it served no session or the session predates surface recording.
|
|
4336
4383
|
* `automation` is the eval harness — the signal that files an ordinary
|
|
4337
4384
|
* `agent-turn` as testing spend rather than as a visitor's.
|
|
4338
4385
|
*/
|
|
4339
|
-
surface:
|
|
4340
|
-
inputTokens:
|
|
4341
|
-
outputTokens:
|
|
4386
|
+
surface: z41.string().nullable(),
|
|
4387
|
+
inputTokens: z41.number(),
|
|
4388
|
+
outputTokens: z41.number(),
|
|
4342
4389
|
/** Subset of inputTokens, never additional to it. */
|
|
4343
|
-
cachedInputTokens:
|
|
4344
|
-
reasoningTokens:
|
|
4345
|
-
callCount:
|
|
4346
|
-
errorCount:
|
|
4347
|
-
estimatedCostUsd:
|
|
4390
|
+
cachedInputTokens: z41.number(),
|
|
4391
|
+
reasoningTokens: z41.number(),
|
|
4392
|
+
callCount: z41.number(),
|
|
4393
|
+
errorCount: z41.number(),
|
|
4394
|
+
estimatedCostUsd: z41.number().nullable()
|
|
4348
4395
|
});
|
|
4349
|
-
var LlmUsageBySessionSchema =
|
|
4350
|
-
sessionId:
|
|
4351
|
-
environment:
|
|
4352
|
-
model:
|
|
4396
|
+
var LlmUsageBySessionSchema = z41.object({
|
|
4397
|
+
sessionId: z41.string(),
|
|
4398
|
+
environment: z41.string(),
|
|
4399
|
+
model: z41.string(),
|
|
4353
4400
|
/** The space this session belongs to, or null for a session with no space. */
|
|
4354
|
-
spaceId:
|
|
4401
|
+
spaceId: z41.string().nullable(),
|
|
4355
4402
|
/** The session's surface — see `LlmUsageDailySchema.surface`. */
|
|
4356
|
-
surface:
|
|
4403
|
+
surface: z41.string().nullable(),
|
|
4357
4404
|
/** Label only — the first feature seen in the session. */
|
|
4358
|
-
firstFeature:
|
|
4359
|
-
startedAt:
|
|
4360
|
-
endedAt:
|
|
4361
|
-
inputTokens:
|
|
4362
|
-
outputTokens:
|
|
4363
|
-
cachedInputTokens:
|
|
4364
|
-
reasoningTokens:
|
|
4365
|
-
callCount:
|
|
4366
|
-
errorCount:
|
|
4405
|
+
firstFeature: z41.string(),
|
|
4406
|
+
startedAt: z41.string(),
|
|
4407
|
+
endedAt: z41.string(),
|
|
4408
|
+
inputTokens: z41.number(),
|
|
4409
|
+
outputTokens: z41.number(),
|
|
4410
|
+
cachedInputTokens: z41.number(),
|
|
4411
|
+
reasoningTokens: z41.number(),
|
|
4412
|
+
callCount: z41.number(),
|
|
4413
|
+
errorCount: z41.number(),
|
|
4367
4414
|
/** Priced server-side, like the daily rollup — the browser never carries a
|
|
4368
4415
|
* rate table, so there is exactly one place a price can be wrong. Null when
|
|
4369
4416
|
* the model is unpriced; never 0, which would read as free. */
|
|
4370
|
-
estimatedCostUsd:
|
|
4417
|
+
estimatedCostUsd: z41.number().nullable()
|
|
4371
4418
|
});
|
|
4372
|
-
var LlmSessionsDailySchema =
|
|
4373
|
-
day:
|
|
4374
|
-
environment:
|
|
4375
|
-
sessionCount:
|
|
4419
|
+
var LlmSessionsDailySchema = z41.object({
|
|
4420
|
+
day: z41.string(),
|
|
4421
|
+
environment: z41.string(),
|
|
4422
|
+
sessionCount: z41.number()
|
|
4376
4423
|
});
|
|
4377
4424
|
|
|
4378
4425
|
// ../spacestation/src/space/session-queue.ts
|
|
4379
|
-
import { z as
|
|
4426
|
+
import { z as z43 } from "zod";
|
|
4380
4427
|
|
|
4381
4428
|
// ../spacestation/src/space/session-activity.ts
|
|
4382
|
-
import { z as
|
|
4383
|
-
var SessionActivityEventSchema =
|
|
4384
|
-
id:
|
|
4385
|
-
kind:
|
|
4386
|
-
occurredAt:
|
|
4387
|
-
source:
|
|
4388
|
-
surface:
|
|
4389
|
-
payload:
|
|
4429
|
+
import { z as z42 } from "zod";
|
|
4430
|
+
var SessionActivityEventSchema = z42.object({
|
|
4431
|
+
id: z42.string(),
|
|
4432
|
+
kind: z42.string(),
|
|
4433
|
+
occurredAt: z42.string(),
|
|
4434
|
+
source: z42.string(),
|
|
4435
|
+
surface: z42.string(),
|
|
4436
|
+
payload: z42.record(z42.unknown())
|
|
4390
4437
|
});
|
|
4391
|
-
var SessionActivitySchema =
|
|
4392
|
-
events:
|
|
4393
|
-
hasMore:
|
|
4438
|
+
var SessionActivitySchema = z42.object({
|
|
4439
|
+
events: z42.array(SessionActivityEventSchema),
|
|
4440
|
+
hasMore: z42.boolean()
|
|
4394
4441
|
});
|
|
4395
4442
|
|
|
4396
4443
|
// ../spacestation/src/space/session-queue.ts
|
|
4397
|
-
var SessionVerdictSchema =
|
|
4398
|
-
var RecordableVerdictSchema =
|
|
4399
|
-
var SessionReviewEventSchema =
|
|
4400
|
-
id:
|
|
4444
|
+
var SessionVerdictSchema = z43.enum(["unreviewed", "viewed", "bug"]);
|
|
4445
|
+
var RecordableVerdictSchema = z43.enum(["viewed", "bug"]);
|
|
4446
|
+
var SessionReviewEventSchema = z43.object({
|
|
4447
|
+
id: z43.string().uuid(),
|
|
4401
4448
|
verdict: RecordableVerdictSchema,
|
|
4402
4449
|
/** Account email of the operator who judged it. Attribution is the reason the
|
|
4403
4450
|
* log is append-only rather than a mutable current-state row. */
|
|
4404
|
-
reviewer:
|
|
4405
|
-
note:
|
|
4406
|
-
createdAt:
|
|
4451
|
+
reviewer: z43.string(),
|
|
4452
|
+
note: z43.string().nullable(),
|
|
4453
|
+
createdAt: z43.string()
|
|
4407
4454
|
});
|
|
4408
|
-
var BugSeveritySchema =
|
|
4409
|
-
var BugLocationSchema =
|
|
4410
|
-
elementId:
|
|
4455
|
+
var BugSeveritySchema = z43.enum(["high", "medium", "low"]);
|
|
4456
|
+
var BugLocationSchema = z43.object({
|
|
4457
|
+
elementId: z43.string().nullable(),
|
|
4411
4458
|
/** Display only — the catalog component type, e.g. "productGrid". Null
|
|
4412
4459
|
* alongside a null `elementId`. */
|
|
4413
|
-
elementType:
|
|
4460
|
+
elementType: z43.string().nullable(),
|
|
4414
4461
|
/** Fraction of the ELEMENT's own box. Null for a page anchor. */
|
|
4415
|
-
offsetXPct:
|
|
4416
|
-
offsetYPct:
|
|
4462
|
+
offsetXPct: z43.number().min(0).max(100).nullable(),
|
|
4463
|
+
offsetYPct: z43.number().min(0).max(100).nullable(),
|
|
4417
4464
|
/**
|
|
4418
4465
|
* ABSOLUTE document pixels, for a pin with no element under it. Null for an
|
|
4419
4466
|
* element anchor.
|
|
@@ -4424,8 +4471,8 @@ var BugLocationSchema = z42.object({
|
|
|
4424
4471
|
* on the page with it. Measured before this was fixed: growing the page 9%
|
|
4425
4472
|
* slid a pin 32px, so a pin ran away from the cursor reaching for it.
|
|
4426
4473
|
*/
|
|
4427
|
-
pageX:
|
|
4428
|
-
pageY:
|
|
4474
|
+
pageX: z43.number().nullable(),
|
|
4475
|
+
pageY: z43.number().nullable()
|
|
4429
4476
|
}).refine(
|
|
4430
4477
|
(loc) => {
|
|
4431
4478
|
const hasOffsets = loc.offsetXPct !== null && loc.offsetYPct !== null;
|
|
@@ -4439,24 +4486,24 @@ var BugLocationSchema = z42.object({
|
|
|
4439
4486
|
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)"
|
|
4440
4487
|
}
|
|
4441
4488
|
);
|
|
4442
|
-
var SessionBugSchema =
|
|
4443
|
-
id:
|
|
4489
|
+
var SessionBugSchema = z43.object({
|
|
4490
|
+
id: z43.string().uuid(),
|
|
4444
4491
|
/** 1-based turn the fault was observed on; null when the fault is session-wide. */
|
|
4445
|
-
turnIndex:
|
|
4492
|
+
turnIndex: z43.number().int().nullable(),
|
|
4446
4493
|
/** Where on that turn's canvas the pin was dropped; null for a bug filed
|
|
4447
4494
|
* without pinning a spot. */
|
|
4448
4495
|
location: BugLocationSchema.nullable(),
|
|
4449
|
-
provider:
|
|
4450
|
-
issueKey:
|
|
4451
|
-
issueUrl:
|
|
4496
|
+
provider: z43.string(),
|
|
4497
|
+
issueKey: z43.string().nullable(),
|
|
4498
|
+
issueUrl: z43.string().nullable(),
|
|
4452
4499
|
/** The tracker's own state word ('Todo', 'Done', …) — their vocabulary, so
|
|
4453
4500
|
* open text. Null until first synced. */
|
|
4454
|
-
issueState:
|
|
4455
|
-
title:
|
|
4456
|
-
body:
|
|
4501
|
+
issueState: z43.string().nullable(),
|
|
4502
|
+
title: z43.string(),
|
|
4503
|
+
body: z43.string(),
|
|
4457
4504
|
severity: BugSeveritySchema,
|
|
4458
|
-
createdBy:
|
|
4459
|
-
createdAt:
|
|
4505
|
+
createdBy: z43.string(),
|
|
4506
|
+
createdAt: z43.string(),
|
|
4460
4507
|
/**
|
|
4461
4508
|
* When this bug was resolved from the console; null means still OPEN.
|
|
4462
4509
|
*
|
|
@@ -4465,60 +4512,60 @@ var SessionBugSchema = z42.object({
|
|
|
4465
4512
|
* whether a particular fault is still live. The timestamp IS the state, so
|
|
4466
4513
|
* no boolean can contradict it.
|
|
4467
4514
|
*/
|
|
4468
|
-
resolvedAt:
|
|
4469
|
-
resolvedBy:
|
|
4515
|
+
resolvedAt: z43.string().nullable(),
|
|
4516
|
+
resolvedBy: z43.string().nullable()
|
|
4470
4517
|
});
|
|
4471
|
-
var SpaceBugSchema = SessionBugSchema.extend({ sessionId:
|
|
4472
|
-
var SessionCommentSchema =
|
|
4473
|
-
id:
|
|
4518
|
+
var SpaceBugSchema = SessionBugSchema.extend({ sessionId: z43.string() });
|
|
4519
|
+
var SessionCommentSchema = z43.object({
|
|
4520
|
+
id: z43.string().uuid(),
|
|
4474
4521
|
/** Set = a reply in that bug's thread. Null = a standalone comment pin. */
|
|
4475
|
-
bugId:
|
|
4522
|
+
bugId: z43.string().uuid().nullable(),
|
|
4476
4523
|
/** 1-based turn the comment was left on; null for a reply (it reads its
|
|
4477
4524
|
* parent bug's turn). */
|
|
4478
|
-
turnIndex:
|
|
4525
|
+
turnIndex: z43.number().int().nullable(),
|
|
4479
4526
|
/** The canvas anchor for a STANDALONE comment's own pin; null for a reply. */
|
|
4480
4527
|
location: BugLocationSchema.nullable(),
|
|
4481
|
-
body:
|
|
4482
|
-
createdBy:
|
|
4483
|
-
createdAt:
|
|
4528
|
+
body: z43.string(),
|
|
4529
|
+
createdBy: z43.string(),
|
|
4530
|
+
createdAt: z43.string()
|
|
4484
4531
|
});
|
|
4485
|
-
var CreateCommentInputSchema =
|
|
4486
|
-
bugId:
|
|
4487
|
-
turnIndex:
|
|
4532
|
+
var CreateCommentInputSchema = z43.object({
|
|
4533
|
+
bugId: z43.string().uuid().nullable(),
|
|
4534
|
+
turnIndex: z43.number().int().positive().nullable(),
|
|
4488
4535
|
location: BugLocationSchema.nullable(),
|
|
4489
4536
|
// Trimmed, so whitespace is not content: `.min(1)` alone accepted a comment
|
|
4490
4537
|
// of three spaces, which renders as an empty bubble nobody can interpret.
|
|
4491
|
-
body:
|
|
4538
|
+
body: z43.string().trim().min(1)
|
|
4492
4539
|
}).refine((input) => input.bugId === null !== (input.location === null), {
|
|
4493
4540
|
message: "a comment is either a reply (bugId, no location) or a standalone pin (location, no bugId)"
|
|
4494
4541
|
});
|
|
4495
|
-
var UpdateCommentInputSchema =
|
|
4496
|
-
body:
|
|
4497
|
-
bugId:
|
|
4542
|
+
var UpdateCommentInputSchema = z43.object({
|
|
4543
|
+
body: z43.string().trim().min(1).optional(),
|
|
4544
|
+
bugId: z43.string().uuid().nullable().optional(),
|
|
4498
4545
|
location: BugLocationSchema.nullable().optional()
|
|
4499
4546
|
});
|
|
4500
4547
|
var MOBILE_VIEWPORT_MAX = 720;
|
|
4501
|
-
var SessionFormFactorSchema =
|
|
4548
|
+
var SessionFormFactorSchema = z43.enum(["mobile", "desktop"]).nullable();
|
|
4502
4549
|
function formFactorFromViewport(width) {
|
|
4503
4550
|
if (width === null) return null;
|
|
4504
4551
|
return width <= MOBILE_VIEWPORT_MAX ? "mobile" : "desktop";
|
|
4505
4552
|
}
|
|
4506
|
-
var SessionSummarySchema =
|
|
4507
|
-
sessionId:
|
|
4553
|
+
var SessionSummarySchema = z43.object({
|
|
4554
|
+
sessionId: z43.string(),
|
|
4508
4555
|
/** Stable per-browser id — the join key across a visitor's sessions. Null when
|
|
4509
4556
|
* the session row is gone (pruned) or predates the `sessions` table. */
|
|
4510
|
-
visitorId:
|
|
4557
|
+
visitorId: z43.string().nullable(),
|
|
4511
4558
|
/** Provider-qualified identity anchor, present only once the visitor
|
|
4512
4559
|
* identified themselves. Both null together means "not identified yet". */
|
|
4513
|
-
identityProvider:
|
|
4514
|
-
identityKey:
|
|
4560
|
+
identityProvider: z43.string().nullable(),
|
|
4561
|
+
identityKey: z43.string().nullable(),
|
|
4515
4562
|
/** Team/test traffic. The queue hides these by default. */
|
|
4516
|
-
isInternal:
|
|
4563
|
+
isInternal: z43.boolean(),
|
|
4517
4564
|
/** Build that served the session. Null = not captured; a version filter must
|
|
4518
4565
|
* therefore EXCLUDE it rather than let it match an arbitrary bucket. */
|
|
4519
|
-
clientVersion:
|
|
4566
|
+
clientVersion: z43.string().nullable(),
|
|
4520
4567
|
/** Commit-shaped interaction signals, counted, keyed by open `SignalType`. */
|
|
4521
|
-
signalCounts:
|
|
4568
|
+
signalCounts: z43.record(z43.number()),
|
|
4522
4569
|
/**
|
|
4523
4570
|
* Did this conversation ACQUIRE anything, and how many times?
|
|
4524
4571
|
*
|
|
@@ -4535,7 +4582,7 @@ var SessionSummarySchema = z42.object({
|
|
|
4535
4582
|
* predates the column — and renders as no mark at all. It never means zero:
|
|
4536
4583
|
* zero is a real, recorded answer and the rail reports it as one.
|
|
4537
4584
|
*/
|
|
4538
|
-
conversionAttempts:
|
|
4585
|
+
conversionAttempts: z43.number().int().nullable(),
|
|
4539
4586
|
/**
|
|
4540
4587
|
* The same attempts split by EVENT KIND, keyed by the kind's own name
|
|
4541
4588
|
* (`commerce.cart_line_added`, `commerce.registry_clicked`), counted distinct
|
|
@@ -4551,7 +4598,7 @@ var SessionSummarySchema = z42.object({
|
|
|
4551
4598
|
* kinds together, and one attempt id appearing under both would be counted
|
|
4552
4599
|
* once there and twice here.
|
|
4553
4600
|
*/
|
|
4554
|
-
conversionKinds:
|
|
4601
|
+
conversionKinds: z43.record(z43.number()),
|
|
4555
4602
|
/**
|
|
4556
4603
|
* Every analytics funnel step this session reached, in funnel order — the
|
|
4557
4604
|
* dashboard's own step ids, read by the same per-step predicates, so a queue
|
|
@@ -4559,20 +4606,20 @@ var SessionSummarySchema = z42.object({
|
|
|
4559
4606
|
* set of strings for the reason `conversionKinds` is: the contract does not
|
|
4560
4607
|
* learn what a step means. Empty only when read from a pre-column database.
|
|
4561
4608
|
*/
|
|
4562
|
-
funnelSteps:
|
|
4609
|
+
funnelSteps: z43.array(z43.string()),
|
|
4563
4610
|
/**
|
|
4564
4611
|
* The connector's opaque handle for what this session produced in its back
|
|
4565
4612
|
* office — present only once a checkout actually reached the platform. The
|
|
4566
4613
|
* console hands it to the back-office link registry; nothing else reads it.
|
|
4567
4614
|
*/
|
|
4568
|
-
backOfficeRef:
|
|
4615
|
+
backOfficeRef: z43.string().nullable(),
|
|
4569
4616
|
/**
|
|
4570
4617
|
* The order this session produced, when the connector's back office reported
|
|
4571
4618
|
* it (`session_orders`): its opaque id and the back office's own name for it.
|
|
4572
4619
|
* Both null when no order is known — the cart handle above is then the door.
|
|
4573
4620
|
*/
|
|
4574
|
-
orderRef:
|
|
4575
|
-
orderLabel:
|
|
4621
|
+
orderRef: z43.string().nullable(),
|
|
4622
|
+
orderLabel: z43.string().nullable(),
|
|
4576
4623
|
/**
|
|
4577
4624
|
* Which shell this session rendered — the one thing about the CAPTURE a list
|
|
4578
4625
|
* needs.
|
|
@@ -4585,12 +4632,12 @@ var SessionSummarySchema = z42.object({
|
|
|
4585
4632
|
* on a desktop are not the same session.
|
|
4586
4633
|
*/
|
|
4587
4634
|
formFactor: SessionFormFactorSchema,
|
|
4588
|
-
turnCount:
|
|
4635
|
+
turnCount: z43.number().int(),
|
|
4589
4636
|
/** The visitor's opening message — the single most informative field for
|
|
4590
4637
|
* deciding whether a session is worth opening, hence the widest column. */
|
|
4591
|
-
firstPrompt:
|
|
4592
|
-
startedAt:
|
|
4593
|
-
lastRunAt:
|
|
4638
|
+
firstPrompt: z43.string(),
|
|
4639
|
+
startedAt: z43.string(),
|
|
4640
|
+
lastRunAt: z43.string(),
|
|
4594
4641
|
/**
|
|
4595
4642
|
* The VISITOR's own IANA zone (`America/New_York`), read from their browser
|
|
4596
4643
|
* at session create — what the two timestamps above should be read in.
|
|
@@ -4618,7 +4665,7 @@ var SessionSummarySchema = z42.object({
|
|
|
4618
4665
|
* Client-asserted and never validated against a zone table, so every consumer
|
|
4619
4666
|
* must tolerate an unknown name: `Intl` throws a RangeError on one.
|
|
4620
4667
|
*/
|
|
4621
|
-
visitorTimeZone:
|
|
4668
|
+
visitorTimeZone: z43.string().nullable(),
|
|
4622
4669
|
/**
|
|
4623
4670
|
* Mean TIME TO FIRST PATCH, over the turns that recorded one — the first
|
|
4624
4671
|
* layout op reaching the visitor, and THE latency the project is managed on.
|
|
@@ -4626,31 +4673,31 @@ var SessionSummarySchema = z42.object({
|
|
|
4626
4673
|
* `totalLatencyMs` carries the chip-gen tail that runs after the visitor is
|
|
4627
4674
|
* already reading. Null when no turn in the session recorded a patch.
|
|
4628
4675
|
*/
|
|
4629
|
-
avgTtftMs:
|
|
4676
|
+
avgTtftMs: z43.number().int().nullable(),
|
|
4630
4677
|
/** Mean `main_done_ms` — layout + prose complete. Context for the TTFT, not
|
|
4631
4678
|
* a budget: null on sessions older than the mark's recording. */
|
|
4632
|
-
avgMainDoneMs:
|
|
4679
|
+
avgMainDoneMs: z43.number().int().nullable(),
|
|
4633
4680
|
/** Mean `chip_gen_ms` — the pass that runs AFTER mainDone and is out of the
|
|
4634
4681
|
* budget. On the row only to explain the gap to `totalLatencyMs`. */
|
|
4635
|
-
avgChipGenMs:
|
|
4636
|
-
totalLatencyMs:
|
|
4637
|
-
durationMs:
|
|
4682
|
+
avgChipGenMs: z43.number().int().nullable(),
|
|
4683
|
+
totalLatencyMs: z43.number().int(),
|
|
4684
|
+
durationMs: z43.number().int(),
|
|
4638
4685
|
/** Inferred from recent activity — nothing writes a session-end marker. A
|
|
4639
4686
|
* live session streams and cannot be given a verdict until it ends. */
|
|
4640
|
-
isLive:
|
|
4687
|
+
isLive: z43.boolean(),
|
|
4641
4688
|
verdict: SessionVerdictSchema,
|
|
4642
|
-
reviewedBy:
|
|
4643
|
-
reviewedAt:
|
|
4689
|
+
reviewedBy: z43.string().nullable(),
|
|
4690
|
+
reviewedAt: z43.string().nullable(),
|
|
4644
4691
|
/** Latest filed bug, flattened onto the row so the queue can show its live
|
|
4645
4692
|
* state without a second request. */
|
|
4646
|
-
bugIssueKey:
|
|
4647
|
-
bugIssueUrl:
|
|
4648
|
-
bugIssueState:
|
|
4693
|
+
bugIssueKey: z43.string().nullable(),
|
|
4694
|
+
bugIssueUrl: z43.string().nullable(),
|
|
4695
|
+
bugIssueState: z43.string().nullable()
|
|
4649
4696
|
});
|
|
4650
|
-
var SessionQueuePageSchema =
|
|
4651
|
-
sessions:
|
|
4652
|
-
totalCount:
|
|
4653
|
-
hiddenInternalCount:
|
|
4697
|
+
var SessionQueuePageSchema = z43.object({
|
|
4698
|
+
sessions: z43.array(SessionSummarySchema),
|
|
4699
|
+
totalCount: z43.number().int(),
|
|
4700
|
+
hiddenInternalCount: z43.number().int(),
|
|
4654
4701
|
/**
|
|
4655
4702
|
* Bounced sessions the queue left out — no turn and no add, the default.
|
|
4656
4703
|
*
|
|
@@ -4660,61 +4707,61 @@ var SessionQueuePageSchema = z42.object({
|
|
|
4660
4707
|
* `totalCount + hiddenBouncedCount` is that population, and this count is the
|
|
4661
4708
|
* analytics dashboard's bounce over the same window.
|
|
4662
4709
|
*/
|
|
4663
|
-
hiddenBouncedCount:
|
|
4710
|
+
hiddenBouncedCount: z43.number().int()
|
|
4664
4711
|
});
|
|
4665
|
-
var SessionQueueFacetsSchema =
|
|
4666
|
-
review:
|
|
4667
|
-
version:
|
|
4668
|
-
turns:
|
|
4669
|
-
durationS:
|
|
4712
|
+
var SessionQueueFacetsSchema = z43.object({
|
|
4713
|
+
review: z43.record(z43.number()),
|
|
4714
|
+
version: z43.record(z43.number()),
|
|
4715
|
+
turns: z43.record(z43.number()),
|
|
4716
|
+
durationS: z43.record(z43.number()),
|
|
4670
4717
|
/** Sessions per funnel step reached — a session counts under every step it reached. */
|
|
4671
|
-
funnel:
|
|
4718
|
+
funnel: z43.record(z43.number())
|
|
4672
4719
|
});
|
|
4673
|
-
var SessionCaptureSchema =
|
|
4674
|
-
viewportWidth:
|
|
4675
|
-
viewportHeight:
|
|
4676
|
-
userAgent:
|
|
4677
|
-
locale:
|
|
4720
|
+
var SessionCaptureSchema = z43.object({
|
|
4721
|
+
viewportWidth: z43.number().int().nullable(),
|
|
4722
|
+
viewportHeight: z43.number().int().nullable(),
|
|
4723
|
+
userAgent: z43.string().nullable(),
|
|
4724
|
+
locale: z43.string().nullable(),
|
|
4678
4725
|
/** Referrer at session create — separates agentic traffic from organic. */
|
|
4679
|
-
referrer:
|
|
4726
|
+
referrer: z43.string().nullable()
|
|
4680
4727
|
});
|
|
4681
|
-
var SessionCaptureInputSchema =
|
|
4682
|
-
viewportWidth:
|
|
4683
|
-
viewportHeight:
|
|
4684
|
-
userAgent:
|
|
4685
|
-
locale:
|
|
4728
|
+
var SessionCaptureInputSchema = z43.object({
|
|
4729
|
+
viewportWidth: z43.number().int().positive().max(2e4).optional(),
|
|
4730
|
+
viewportHeight: z43.number().int().positive().max(2e4).optional(),
|
|
4731
|
+
userAgent: z43.string().max(1e3).optional(),
|
|
4732
|
+
locale: z43.string().max(35).optional(),
|
|
4686
4733
|
/** IANA zone name from the visitor's browser. Bounded rather than validated:
|
|
4687
4734
|
* the zone database grows, and refusing a name this build has not heard of
|
|
4688
4735
|
* would drop a real session's capture over a table that is out of date. */
|
|
4689
|
-
timeZone:
|
|
4690
|
-
referrer:
|
|
4691
|
-
clientVersion:
|
|
4692
|
-
isInternal:
|
|
4736
|
+
timeZone: z43.string().max(64).optional(),
|
|
4737
|
+
referrer: z43.string().max(2048).optional(),
|
|
4738
|
+
clientVersion: z43.string().max(100).optional(),
|
|
4739
|
+
isInternal: z43.boolean().optional()
|
|
4693
4740
|
});
|
|
4694
|
-
var SessionDetailSchema =
|
|
4741
|
+
var SessionDetailSchema = z43.object({
|
|
4695
4742
|
session: SessionSummarySchema,
|
|
4696
4743
|
capture: SessionCaptureSchema,
|
|
4697
4744
|
/** Full verdict history, newest first. Verdicts are revisable, and a session
|
|
4698
4745
|
* re-judged after a fix is the evidence the fix worked. */
|
|
4699
|
-
reviews:
|
|
4700
|
-
bugs:
|
|
4701
|
-
comments:
|
|
4746
|
+
reviews: z43.array(SessionReviewEventSchema),
|
|
4747
|
+
bugs: z43.array(SessionBugSchema),
|
|
4748
|
+
comments: z43.array(SessionCommentSchema),
|
|
4702
4749
|
/** Optional during API/console rolling deployment. Absent is unavailable,
|
|
4703
4750
|
* not evidence of zero visitor activity. */
|
|
4704
4751
|
activity: SessionActivitySchema.optional()
|
|
4705
4752
|
});
|
|
4706
|
-
var RecordVerdictInputSchema =
|
|
4753
|
+
var RecordVerdictInputSchema = z43.object({
|
|
4707
4754
|
verdict: RecordableVerdictSchema,
|
|
4708
|
-
note:
|
|
4755
|
+
note: z43.string().max(2e3).optional()
|
|
4709
4756
|
});
|
|
4710
|
-
var FileBugInputSchema =
|
|
4711
|
-
turnIndex:
|
|
4757
|
+
var FileBugInputSchema = z43.object({
|
|
4758
|
+
turnIndex: z43.number().int().positive().nullable(),
|
|
4712
4759
|
/** Optional — a bug filed without dropping a pin has no location. */
|
|
4713
4760
|
location: BugLocationSchema.nullable().optional(),
|
|
4714
|
-
title:
|
|
4715
|
-
body:
|
|
4761
|
+
title: z43.string().min(1).max(300),
|
|
4762
|
+
body: z43.string().min(1),
|
|
4716
4763
|
severity: BugSeveritySchema,
|
|
4717
|
-
payload:
|
|
4764
|
+
payload: z43.record(z43.unknown())
|
|
4718
4765
|
});
|
|
4719
4766
|
|
|
4720
4767
|
// ../spacestation/src/contracts/retrieval/ecommerce/option-values.ts
|
|
@@ -5040,60 +5087,60 @@ __export(src_exports2, {
|
|
|
5040
5087
|
});
|
|
5041
5088
|
|
|
5042
5089
|
// ../ecommerce/src/commerce-schemas.ts
|
|
5043
|
-
import { z as
|
|
5044
|
-
var MoneySchema =
|
|
5045
|
-
amount:
|
|
5046
|
-
currencyCode:
|
|
5090
|
+
import { z as z44 } from "zod";
|
|
5091
|
+
var MoneySchema = z44.object({
|
|
5092
|
+
amount: z44.number(),
|
|
5093
|
+
currencyCode: z44.string()
|
|
5047
5094
|
});
|
|
5048
|
-
var ImageSchema =
|
|
5049
|
-
url:
|
|
5050
|
-
altText:
|
|
5051
|
-
width:
|
|
5052
|
-
height:
|
|
5095
|
+
var ImageSchema = z44.object({
|
|
5096
|
+
url: z44.string(),
|
|
5097
|
+
altText: z44.string(),
|
|
5098
|
+
width: z44.number().optional(),
|
|
5099
|
+
height: z44.number().optional(),
|
|
5053
5100
|
/** Responsive candidate set, resolved at the commerce-adapter boundary —
|
|
5054
5101
|
* never computed in a component. Renderers use it as `<img srcSet>` paired
|
|
5055
5102
|
* with a layout `sizes`. Absent for non-CDN / unsizable images. */
|
|
5056
|
-
srcSet:
|
|
5103
|
+
srcSet: z44.string().optional()
|
|
5057
5104
|
});
|
|
5058
|
-
var AssetSchema =
|
|
5105
|
+
var AssetSchema = z44.object({
|
|
5059
5106
|
/** Opaque asset id — the `resolved()` ref the agent emitted. */
|
|
5060
|
-
id:
|
|
5061
|
-
url:
|
|
5062
|
-
altText:
|
|
5063
|
-
srcSet:
|
|
5107
|
+
id: z44.string(),
|
|
5108
|
+
url: z44.string(),
|
|
5109
|
+
altText: z44.string(),
|
|
5110
|
+
srcSet: z44.string().optional()
|
|
5064
5111
|
});
|
|
5065
|
-
var SelectedOptionSchema =
|
|
5066
|
-
name:
|
|
5067
|
-
value:
|
|
5112
|
+
var SelectedOptionSchema = z44.object({
|
|
5113
|
+
name: z44.string(),
|
|
5114
|
+
value: z44.string()
|
|
5068
5115
|
});
|
|
5069
|
-
var VideoSourceSchema =
|
|
5070
|
-
url:
|
|
5071
|
-
mimeType:
|
|
5072
|
-
width:
|
|
5073
|
-
height:
|
|
5116
|
+
var VideoSourceSchema = z44.object({
|
|
5117
|
+
url: z44.string(),
|
|
5118
|
+
mimeType: z44.string(),
|
|
5119
|
+
width: z44.number().optional(),
|
|
5120
|
+
height: z44.number().optional()
|
|
5074
5121
|
});
|
|
5075
|
-
var ProductVideoSchema =
|
|
5076
|
-
kind:
|
|
5122
|
+
var ProductVideoSchema = z44.object({
|
|
5123
|
+
kind: z44.enum(["hosted", "external"]),
|
|
5077
5124
|
previewImage: ImageSchema.optional(),
|
|
5078
|
-
altText:
|
|
5125
|
+
altText: z44.string().default(""),
|
|
5079
5126
|
/** `kind: 'hosted'` only — empty for external embeds. */
|
|
5080
|
-
sources:
|
|
5127
|
+
sources: z44.array(VideoSourceSchema).default([]),
|
|
5081
5128
|
/** `kind: 'external'` only — iframe embed URL. */
|
|
5082
|
-
embedUrl:
|
|
5129
|
+
embedUrl: z44.string().optional(),
|
|
5083
5130
|
/** `kind: 'external'` only — e.g. `YOUTUBE` | `VIMEO`. */
|
|
5084
|
-
host:
|
|
5131
|
+
host: z44.string().optional()
|
|
5085
5132
|
});
|
|
5086
|
-
var AvailabilityStatusSchema =
|
|
5133
|
+
var AvailabilityStatusSchema = z44.enum([
|
|
5087
5134
|
"in_stock",
|
|
5088
5135
|
"backorder",
|
|
5089
5136
|
"preorder",
|
|
5090
5137
|
"out_of_stock",
|
|
5091
5138
|
"discontinued"
|
|
5092
5139
|
]);
|
|
5093
|
-
var ProductVariantSchema =
|
|
5094
|
-
id:
|
|
5095
|
-
title:
|
|
5096
|
-
available:
|
|
5140
|
+
var ProductVariantSchema = z44.object({
|
|
5141
|
+
id: z44.string(),
|
|
5142
|
+
title: z44.string(),
|
|
5143
|
+
available: z44.boolean(),
|
|
5097
5144
|
/**
|
|
5098
5145
|
* Qualifies `available` with the fulfillment state behind it. Absent means
|
|
5099
5146
|
* the backend did not say — which is NOT the same as in stock, and must not
|
|
@@ -5108,10 +5155,10 @@ var ProductVariantSchema = z43.object({
|
|
|
5108
5155
|
availabilityStatus: AvailabilityStatusSchema.optional(),
|
|
5109
5156
|
price: MoneySchema,
|
|
5110
5157
|
compareAtPrice: MoneySchema.optional(),
|
|
5111
|
-
selectedOptions:
|
|
5158
|
+
selectedOptions: z44.array(SelectedOptionSchema).optional(),
|
|
5112
5159
|
image: ImageSchema.optional(),
|
|
5113
5160
|
/** The merchant's stock-keeping code. Absent when the backend has none. */
|
|
5114
|
-
sku:
|
|
5161
|
+
sku: z44.string().optional()
|
|
5115
5162
|
});
|
|
5116
5163
|
var MP4_MIME = "video/mp4";
|
|
5117
5164
|
var HLS_MIME = "application/x-mpegURL";
|
|
@@ -5121,34 +5168,34 @@ function orderedVideoSources(video) {
|
|
|
5121
5168
|
const hls = video.sources.filter((s) => s.mimeType === HLS_MIME);
|
|
5122
5169
|
return [...mp4, ...hls];
|
|
5123
5170
|
}
|
|
5124
|
-
var SiblingProductSchema =
|
|
5125
|
-
id:
|
|
5126
|
-
handle:
|
|
5127
|
-
title:
|
|
5171
|
+
var SiblingProductSchema = z44.object({
|
|
5172
|
+
id: z44.string(),
|
|
5173
|
+
handle: z44.string(),
|
|
5174
|
+
title: z44.string(),
|
|
5128
5175
|
/** The differentiating value across siblings — typically the color
|
|
5129
5176
|
* label ("OLIVE", "STONE"). Rendered next to the swatch row. */
|
|
5130
|
-
color:
|
|
5177
|
+
color: z44.string(),
|
|
5131
5178
|
/** Swatch artwork. Hydrators populate from the sibling product's
|
|
5132
5179
|
* first image; renderers crop / fit to the swatch tile. */
|
|
5133
5180
|
swatchImage: ImageSchema.optional(),
|
|
5134
|
-
available:
|
|
5181
|
+
available: z44.boolean().default(true),
|
|
5135
5182
|
/** Marks the sibling that IS the currently-rendered product. The
|
|
5136
5183
|
* picker uses this to highlight the active swatch without an
|
|
5137
5184
|
* external id comparison. */
|
|
5138
|
-
current:
|
|
5185
|
+
current: z44.boolean().default(false)
|
|
5139
5186
|
});
|
|
5140
|
-
var ProductSchema =
|
|
5141
|
-
id:
|
|
5142
|
-
handle:
|
|
5143
|
-
title:
|
|
5144
|
-
description:
|
|
5145
|
-
descriptionHtml:
|
|
5146
|
-
vendor:
|
|
5147
|
-
productType:
|
|
5148
|
-
tags:
|
|
5187
|
+
var ProductSchema = z44.object({
|
|
5188
|
+
id: z44.string(),
|
|
5189
|
+
handle: z44.string().default(""),
|
|
5190
|
+
title: z44.string(),
|
|
5191
|
+
description: z44.string().default(""),
|
|
5192
|
+
descriptionHtml: z44.string().optional(),
|
|
5193
|
+
vendor: z44.string().default(""),
|
|
5194
|
+
productType: z44.string().optional(),
|
|
5195
|
+
tags: z44.array(z44.string()).default([]),
|
|
5149
5196
|
price: MoneySchema.default({ amount: 0, currencyCode: "USD" }),
|
|
5150
5197
|
compareAtPrice: MoneySchema.optional(),
|
|
5151
|
-
images:
|
|
5198
|
+
images: z44.array(ImageSchema).default([]),
|
|
5152
5199
|
/**
|
|
5153
5200
|
* Product videos (`Video` + `ExternalVideo` media). Shopify's MCP
|
|
5154
5201
|
* catalog drops video media — it only surfaces through the Storefront
|
|
@@ -5156,21 +5203,21 @@ var ProductSchema = z43.object({
|
|
|
5156
5203
|
* boundary. Default `[]` so renderers gate on `length > 0` without a
|
|
5157
5204
|
* presence guard.
|
|
5158
5205
|
*/
|
|
5159
|
-
videos:
|
|
5160
|
-
variants:
|
|
5161
|
-
availableForSale:
|
|
5162
|
-
options:
|
|
5163
|
-
name:
|
|
5164
|
-
values:
|
|
5206
|
+
videos: z44.array(ProductVideoSchema).default([]),
|
|
5207
|
+
variants: z44.array(ProductVariantSchema).default([]),
|
|
5208
|
+
availableForSale: z44.boolean().default(true),
|
|
5209
|
+
options: z44.array(z44.object({
|
|
5210
|
+
name: z44.string(),
|
|
5211
|
+
values: z44.array(z44.string())
|
|
5165
5212
|
})).optional(),
|
|
5166
|
-
collections:
|
|
5213
|
+
collections: z44.array(z44.string()).optional(),
|
|
5167
5214
|
/** See `SiblingProductSchema`. Default `[]` so renderers can check
|
|
5168
5215
|
* `length > 1` to decide whether to draw the swatch row without a
|
|
5169
5216
|
* presence guard. */
|
|
5170
|
-
colorVariants:
|
|
5171
|
-
rating:
|
|
5172
|
-
value:
|
|
5173
|
-
count:
|
|
5217
|
+
colorVariants: z44.array(SiblingProductSchema).default([]),
|
|
5218
|
+
rating: z44.object({
|
|
5219
|
+
value: z44.number(),
|
|
5220
|
+
count: z44.number()
|
|
5174
5221
|
}).optional(),
|
|
5175
5222
|
/**
|
|
5176
5223
|
* Product reviews surfaced from the brand's review store. SDK
|
|
@@ -5179,12 +5226,12 @@ var ProductSchema = z43.object({
|
|
|
5179
5226
|
* review bodies. Renderers (`Reviews` component, `ProductDetail`,
|
|
5180
5227
|
* etc.) consume directly.
|
|
5181
5228
|
*/
|
|
5182
|
-
reviews:
|
|
5183
|
-
author:
|
|
5184
|
-
rating:
|
|
5185
|
-
content:
|
|
5186
|
-
date:
|
|
5187
|
-
verified:
|
|
5229
|
+
reviews: z44.array(z44.object({
|
|
5230
|
+
author: z44.string(),
|
|
5231
|
+
rating: z44.number(),
|
|
5232
|
+
content: z44.string(),
|
|
5233
|
+
date: z44.string(),
|
|
5234
|
+
verified: z44.boolean().optional()
|
|
5188
5235
|
})).optional(),
|
|
5189
5236
|
/**
|
|
5190
5237
|
* Ghost-entity flag — `true` when the Storefront API could not hydrate
|
|
@@ -5196,7 +5243,7 @@ var ProductSchema = z43.object({
|
|
|
5196
5243
|
* Set exclusively by `createUnavailableProduct()` — never by the
|
|
5197
5244
|
* Storefront mapper.
|
|
5198
5245
|
*/
|
|
5199
|
-
unavailable:
|
|
5246
|
+
unavailable: z44.boolean().default(false)
|
|
5200
5247
|
});
|
|
5201
5248
|
function createUnavailableProduct(gid) {
|
|
5202
5249
|
return {
|
|
@@ -5218,68 +5265,68 @@ function createUnavailableProduct(gid) {
|
|
|
5218
5265
|
function isGhostEntity(value) {
|
|
5219
5266
|
return typeof value === "object" && value !== null && "unavailable" in value && value.unavailable === true;
|
|
5220
5267
|
}
|
|
5221
|
-
var ReviewSchema =
|
|
5222
|
-
id:
|
|
5223
|
-
productId:
|
|
5224
|
-
author:
|
|
5225
|
-
rating:
|
|
5226
|
-
text:
|
|
5227
|
-
date:
|
|
5228
|
-
verified:
|
|
5268
|
+
var ReviewSchema = z44.object({
|
|
5269
|
+
id: z44.string(),
|
|
5270
|
+
productId: z44.string(),
|
|
5271
|
+
author: z44.string(),
|
|
5272
|
+
rating: z44.number(),
|
|
5273
|
+
text: z44.string(),
|
|
5274
|
+
date: z44.string(),
|
|
5275
|
+
verified: z44.boolean()
|
|
5229
5276
|
});
|
|
5230
|
-
var ArticleSchema =
|
|
5231
|
-
id:
|
|
5232
|
-
handle:
|
|
5233
|
-
title:
|
|
5234
|
-
excerpt:
|
|
5235
|
-
content:
|
|
5236
|
-
contentHtml:
|
|
5237
|
-
author:
|
|
5238
|
-
publishedAt:
|
|
5277
|
+
var ArticleSchema = z44.object({
|
|
5278
|
+
id: z44.string(),
|
|
5279
|
+
handle: z44.string().default(""),
|
|
5280
|
+
title: z44.string(),
|
|
5281
|
+
excerpt: z44.string().default(""),
|
|
5282
|
+
content: z44.string().default(""),
|
|
5283
|
+
contentHtml: z44.string().optional(),
|
|
5284
|
+
author: z44.string().default(""),
|
|
5285
|
+
publishedAt: z44.string().default(""),
|
|
5239
5286
|
image: ImageSchema.optional(),
|
|
5240
|
-
blogHandle:
|
|
5241
|
-
tags:
|
|
5287
|
+
blogHandle: z44.string().default(""),
|
|
5288
|
+
tags: z44.array(z44.string()).default([])
|
|
5242
5289
|
});
|
|
5243
|
-
var CmsPageSchema =
|
|
5244
|
-
id:
|
|
5245
|
-
handle:
|
|
5246
|
-
title:
|
|
5247
|
-
body:
|
|
5248
|
-
bodyHtml:
|
|
5249
|
-
bodySummary:
|
|
5250
|
-
updatedAt:
|
|
5251
|
-
seoTitle:
|
|
5252
|
-
seoDescription:
|
|
5290
|
+
var CmsPageSchema = z44.object({
|
|
5291
|
+
id: z44.string(),
|
|
5292
|
+
handle: z44.string().default(""),
|
|
5293
|
+
title: z44.string(),
|
|
5294
|
+
body: z44.string().default(""),
|
|
5295
|
+
bodyHtml: z44.string().optional(),
|
|
5296
|
+
bodySummary: z44.string().default(""),
|
|
5297
|
+
updatedAt: z44.string().default(""),
|
|
5298
|
+
seoTitle: z44.string().optional(),
|
|
5299
|
+
seoDescription: z44.string().optional()
|
|
5253
5300
|
});
|
|
5254
|
-
var CmsPolicySchema =
|
|
5255
|
-
id:
|
|
5301
|
+
var CmsPolicySchema = z44.object({
|
|
5302
|
+
id: z44.string(),
|
|
5256
5303
|
/** Stable policy slot identifier: 'refund' | 'privacy' | 'terms' |
|
|
5257
5304
|
* 'shipping' | 'subscription' | 'warranty' | custom string. Open so
|
|
5258
5305
|
* platforms with custom policy types can extend. */
|
|
5259
|
-
kind:
|
|
5306
|
+
kind: z44.string(),
|
|
5260
5307
|
/** Slug-shaped handle the platform exposes for storefront URLs
|
|
5261
5308
|
* (e.g. `refund-policy`). Empty string when the backend doesn't
|
|
5262
5309
|
* surface one. */
|
|
5263
|
-
handle:
|
|
5264
|
-
title:
|
|
5265
|
-
body:
|
|
5266
|
-
bodyHtml:
|
|
5267
|
-
url:
|
|
5310
|
+
handle: z44.string().default(""),
|
|
5311
|
+
title: z44.string(),
|
|
5312
|
+
body: z44.string().default(""),
|
|
5313
|
+
bodyHtml: z44.string().optional(),
|
|
5314
|
+
url: z44.string().default("")
|
|
5268
5315
|
});
|
|
5269
|
-
var CollectionSchema =
|
|
5270
|
-
id:
|
|
5271
|
-
handle:
|
|
5272
|
-
title:
|
|
5273
|
-
description:
|
|
5316
|
+
var CollectionSchema = z44.object({
|
|
5317
|
+
id: z44.string(),
|
|
5318
|
+
handle: z44.string().default(""),
|
|
5319
|
+
title: z44.string(),
|
|
5320
|
+
description: z44.string().default(""),
|
|
5274
5321
|
image: ImageSchema.optional(),
|
|
5275
|
-
productCount:
|
|
5322
|
+
productCount: z44.number().int().nonnegative().optional()
|
|
5276
5323
|
});
|
|
5277
|
-
var CartLineSchema =
|
|
5278
|
-
id:
|
|
5279
|
-
merchandiseId:
|
|
5280
|
-
productId:
|
|
5281
|
-
title:
|
|
5282
|
-
variantTitle:
|
|
5324
|
+
var CartLineSchema = z44.object({
|
|
5325
|
+
id: z44.string(),
|
|
5326
|
+
merchandiseId: z44.string(),
|
|
5327
|
+
productId: z44.string(),
|
|
5328
|
+
title: z44.string(),
|
|
5329
|
+
variantTitle: z44.string().optional(),
|
|
5283
5330
|
/**
|
|
5284
5331
|
* The variant's option axes as structured pairs (e.g.
|
|
5285
5332
|
* `[{name:'Size', value:'7'}]`). The machine-readable counterpart of
|
|
@@ -5288,10 +5335,10 @@ var CartLineSchema = z43.object({
|
|
|
5288
5335
|
* single-variant products (the degenerate `Title: Default Title` axis
|
|
5289
5336
|
* is normalized away at the adapter boundary).
|
|
5290
5337
|
*/
|
|
5291
|
-
selectedOptions:
|
|
5292
|
-
vendor:
|
|
5293
|
-
sku:
|
|
5294
|
-
quantity:
|
|
5338
|
+
selectedOptions: z44.array(SelectedOptionSchema).optional(),
|
|
5339
|
+
vendor: z44.string().optional(),
|
|
5340
|
+
sku: z44.string().optional(),
|
|
5341
|
+
quantity: z44.number().int().positive(),
|
|
5295
5342
|
unitPrice: MoneySchema,
|
|
5296
5343
|
totalPrice: MoneySchema,
|
|
5297
5344
|
image: ImageSchema.optional(),
|
|
@@ -5311,26 +5358,26 @@ var CartLineSchema = z43.object({
|
|
|
5311
5358
|
* client-minted id the backend rejects, line-tap navigation is
|
|
5312
5359
|
* suppressed, and the money never folds into a settled-looking total.
|
|
5313
5360
|
*/
|
|
5314
|
-
pending:
|
|
5361
|
+
pending: z44.boolean().optional()
|
|
5315
5362
|
});
|
|
5316
5363
|
function isPendingCartLine(line) {
|
|
5317
5364
|
return line.pending === true;
|
|
5318
5365
|
}
|
|
5319
|
-
var CartDiscountCodeSchema =
|
|
5320
|
-
code:
|
|
5321
|
-
applicable:
|
|
5366
|
+
var CartDiscountCodeSchema = z44.object({
|
|
5367
|
+
code: z44.string(),
|
|
5368
|
+
applicable: z44.boolean()
|
|
5322
5369
|
});
|
|
5323
|
-
var CartMessageSchema =
|
|
5324
|
-
kind:
|
|
5370
|
+
var CartMessageSchema = z44.object({
|
|
5371
|
+
kind: z44.enum(["error", "warning", "info"]),
|
|
5325
5372
|
/** Machine code for branching; opaque and backend-defined. */
|
|
5326
|
-
code:
|
|
5373
|
+
code: z44.string(),
|
|
5327
5374
|
/** Human-readable text, meant to be shown as-is. */
|
|
5328
|
-
content:
|
|
5375
|
+
content: z44.string()
|
|
5329
5376
|
});
|
|
5330
|
-
var CartSchema =
|
|
5331
|
-
id:
|
|
5332
|
-
lines:
|
|
5333
|
-
totalQuantity:
|
|
5377
|
+
var CartSchema = z44.object({
|
|
5378
|
+
id: z44.string(),
|
|
5379
|
+
lines: z44.array(CartLineSchema),
|
|
5380
|
+
totalQuantity: z44.number().int().nonnegative(),
|
|
5334
5381
|
subtotal: MoneySchema,
|
|
5335
5382
|
/**
|
|
5336
5383
|
* Cart total after discounts (pre-shipping/tax). Absent when the
|
|
@@ -5340,11 +5387,11 @@ var CartSchema = z43.object({
|
|
|
5340
5387
|
*/
|
|
5341
5388
|
total: MoneySchema.optional(),
|
|
5342
5389
|
/** Discount codes currently attached to the cart. */
|
|
5343
|
-
discountCodes:
|
|
5390
|
+
discountCodes: z44.array(CartDiscountCodeSchema).default([]),
|
|
5344
5391
|
/** Notices the backend attached to this cart — see `CartMessageSchema`.
|
|
5345
5392
|
* Empty when the backend said nothing or does not report them. */
|
|
5346
|
-
messages:
|
|
5347
|
-
checkoutUrl:
|
|
5393
|
+
messages: z44.array(CartMessageSchema).default([]),
|
|
5394
|
+
checkoutUrl: z44.string().optional(),
|
|
5348
5395
|
/**
|
|
5349
5396
|
* Opaque handle this cart is known by in the connector's BACK OFFICE — the
|
|
5350
5397
|
* value a space owner searches there to find the order this cart became.
|
|
@@ -5357,14 +5404,14 @@ var CartSchema = z43.object({
|
|
|
5357
5404
|
* Absent when the platform has no such handle, or while the cart is still the
|
|
5358
5405
|
* client's optimistic paint and its id is client-minted.
|
|
5359
5406
|
*/
|
|
5360
|
-
backOfficeRef:
|
|
5407
|
+
backOfficeRef: z44.string().optional(),
|
|
5361
5408
|
/**
|
|
5362
5409
|
* URL that recreates this cart on the merchant's own store website
|
|
5363
5410
|
* (replace semantics — overwrites any cart the visitor already has
|
|
5364
5411
|
* there). Populated by platform adapters that support it; absent when
|
|
5365
5412
|
* the cart is empty or the URL cannot be built.
|
|
5366
5413
|
*/
|
|
5367
|
-
storeCartUrl:
|
|
5414
|
+
storeCartUrl: z44.string().optional(),
|
|
5368
5415
|
/**
|
|
5369
5416
|
* True while this cart exists only in the client's optimistic paint —
|
|
5370
5417
|
* no backend cart has been created yet, so its `id` is client-minted and
|
|
@@ -5372,7 +5419,7 @@ var CartSchema = z43.object({
|
|
|
5372
5419
|
* `CartLineSchema.pending`: the adapter never sets it, and callers that
|
|
5373
5420
|
* need a real cart id read THIS rather than sniffing the id's shape.
|
|
5374
5421
|
*/
|
|
5375
|
-
pending:
|
|
5422
|
+
pending: z44.boolean().optional()
|
|
5376
5423
|
});
|
|
5377
5424
|
function settledCart(cart) {
|
|
5378
5425
|
if (cart === null || cart === void 0) return null;
|
|
@@ -5380,27 +5427,27 @@ function settledCart(cart) {
|
|
|
5380
5427
|
}
|
|
5381
5428
|
|
|
5382
5429
|
// ../ecommerce/src/review-schemas.ts
|
|
5383
|
-
import { z as
|
|
5430
|
+
import { z as z45 } from "zod";
|
|
5384
5431
|
var PRODUCT_REVIEWS_RESOLVER_KEY = "productReviews";
|
|
5385
|
-
var ProductReviewItemSchema =
|
|
5386
|
-
author:
|
|
5387
|
-
rating:
|
|
5432
|
+
var ProductReviewItemSchema = z45.object({
|
|
5433
|
+
author: z45.string(),
|
|
5434
|
+
rating: z45.number(),
|
|
5388
5435
|
/** The reviewer's own headline ("love"), when they wrote one — the site shows it above `content`. */
|
|
5389
|
-
title:
|
|
5390
|
-
content:
|
|
5391
|
-
date:
|
|
5392
|
-
verified:
|
|
5436
|
+
title: z45.string().optional(),
|
|
5437
|
+
content: z45.string(),
|
|
5438
|
+
date: z45.string(),
|
|
5439
|
+
verified: z45.boolean().optional(),
|
|
5393
5440
|
/**
|
|
5394
5441
|
* Non-empty when the review was written for a grouped SIBLING product rather
|
|
5395
5442
|
* than this one (brands pool reviews across a product line). A surface can
|
|
5396
5443
|
* attribute it; empty / absent ⇒ the product's own review.
|
|
5397
5444
|
*/
|
|
5398
|
-
writtenFor:
|
|
5445
|
+
writtenFor: z45.string().optional()
|
|
5399
5446
|
});
|
|
5400
5447
|
var ProductReviewHighlightSchema = ProductReviewItemSchema.extend({
|
|
5401
5448
|
/** The sentence(s) the ranking fired on. Descriptive — it is what the matcher
|
|
5402
5449
|
* scored, NOT necessarily text that occurs in `content`. */
|
|
5403
|
-
highlight:
|
|
5450
|
+
highlight: z45.string().optional(),
|
|
5404
5451
|
/**
|
|
5405
5452
|
* `highlight` resolved back into `content` as a VERBATIM substring, so a
|
|
5406
5453
|
* surface can mark it with a plain `indexOf` and no matcher of its own.
|
|
@@ -5415,29 +5462,29 @@ var ProductReviewHighlightSchema = ProductReviewItemSchema.extend({
|
|
|
5415
5462
|
* Absent when the passage genuinely has no home in the body (one cut from the
|
|
5416
5463
|
* title). A surface then marks NOTHING rather than guessing at a span.
|
|
5417
5464
|
*/
|
|
5418
|
-
mark:
|
|
5465
|
+
mark: z45.string().optional()
|
|
5419
5466
|
});
|
|
5420
|
-
var ReviewAggregateSchema =
|
|
5421
|
-
value:
|
|
5422
|
-
count:
|
|
5467
|
+
var ReviewAggregateSchema = z45.object({
|
|
5468
|
+
value: z45.number(),
|
|
5469
|
+
count: z45.number()
|
|
5423
5470
|
});
|
|
5424
|
-
var ProductReviewDataSchema =
|
|
5425
|
-
id:
|
|
5471
|
+
var ProductReviewDataSchema = z45.object({
|
|
5472
|
+
id: z45.string(),
|
|
5426
5473
|
/** The product's FULL retrieved set — what a filterable list renders. */
|
|
5427
|
-
reviews:
|
|
5474
|
+
reviews: z45.array(ProductReviewItemSchema).default([]),
|
|
5428
5475
|
aggregate: ReviewAggregateSchema.default({ value: 0, count: 0 }),
|
|
5429
5476
|
/** 5★→1★ star COUNTS over the full set (index 0 = 5-star). */
|
|
5430
|
-
distribution:
|
|
5477
|
+
distribution: z45.array(z45.number()).default([]),
|
|
5431
5478
|
/**
|
|
5432
5479
|
* The reviews that ANSWER the surface's intent, best first. Empty when no
|
|
5433
5480
|
* intent was asked for — never a silent copy of `reviews`.
|
|
5434
5481
|
*/
|
|
5435
|
-
highlights:
|
|
5482
|
+
highlights: z45.array(ProductReviewHighlightSchema).default([]),
|
|
5436
5483
|
/**
|
|
5437
5484
|
* True when the review provider could not be read and nothing is indexed —
|
|
5438
5485
|
* the empty lists mean "not loaded", NOT "this product has no reviews".
|
|
5439
5486
|
*/
|
|
5440
|
-
unavailable:
|
|
5487
|
+
unavailable: z45.boolean().optional()
|
|
5441
5488
|
});
|
|
5442
5489
|
var ProductReviewPayloadSchema = ProductReviewDataSchema.omit({ id: true });
|
|
5443
5490
|
|
|
@@ -5731,9 +5778,9 @@ function readPdpCompanions(config) {
|
|
|
5731
5778
|
}
|
|
5732
5779
|
|
|
5733
5780
|
// ../ecommerce/src/base-attributes.ts
|
|
5734
|
-
import { z as
|
|
5781
|
+
import { z as z46 } from "zod";
|
|
5735
5782
|
var BASE_ATTRIBUTES_CONFIG_KEY = "baseAttributes";
|
|
5736
|
-
var BaseAttributesRecordSchema =
|
|
5783
|
+
var BaseAttributesRecordSchema = z46.record(z46.string(), AttributeDefSchema);
|
|
5737
5784
|
function buildBaseAttributesConfig(attributes) {
|
|
5738
5785
|
return { [BASE_ATTRIBUTES_CONFIG_KEY]: attributes };
|
|
5739
5786
|
}
|
|
@@ -5744,9 +5791,9 @@ function readBaseAttributesConfig(config) {
|
|
|
5744
5791
|
}
|
|
5745
5792
|
|
|
5746
5793
|
// ../ecommerce/src/bucket-labels.ts
|
|
5747
|
-
import { z as
|
|
5794
|
+
import { z as z47 } from "zod";
|
|
5748
5795
|
var BUCKET_LABELS_CONFIG_KEY = "bucketLabels";
|
|
5749
|
-
var BucketLabelsRecordSchema =
|
|
5796
|
+
var BucketLabelsRecordSchema = z47.record(z47.string(), z47.string());
|
|
5750
5797
|
function buildBucketLabelsConfig(labels) {
|
|
5751
5798
|
return { [BUCKET_LABELS_CONFIG_KEY]: labels };
|
|
5752
5799
|
}
|
|
@@ -5865,6 +5912,8 @@ function runSessionScopedClearHandlers() {
|
|
|
5865
5912
|
var shell_exports = {};
|
|
5866
5913
|
__export(shell_exports, {
|
|
5867
5914
|
ATTACHMENT_ACCEPT: () => ATTACHMENT_ACCEPT,
|
|
5915
|
+
BotCheckNoticeProvider: () => BotCheckNoticeProvider,
|
|
5916
|
+
BotCheckNoticeSchema: () => BotCheckNoticeSchema,
|
|
5868
5917
|
DockPersistenceProvider: () => DockPersistenceProvider,
|
|
5869
5918
|
ScrollContainerProvider: () => ScrollContainerProvider,
|
|
5870
5919
|
ShellRegistryProvider: () => ShellRegistryProvider,
|
|
@@ -5876,6 +5925,7 @@ __export(shell_exports, {
|
|
|
5876
5925
|
registerExclusiveOverlay: () => registerExclusiveOverlay,
|
|
5877
5926
|
splitAnswer: () => splitAnswer,
|
|
5878
5927
|
threadRowAttrs: () => threadRowAttrs,
|
|
5928
|
+
useBotCheckNotice: () => useBotCheckNotice,
|
|
5879
5929
|
useComposerAttachments: () => useComposerAttachments,
|
|
5880
5930
|
useComposerChipSelect: () => useComposerChipSelect,
|
|
5881
5931
|
useConversationPage: () => useConversationPage,
|
|
@@ -5960,8 +6010,22 @@ function useDockPersistence() {
|
|
|
5960
6010
|
return React4.useContext(DockPersistenceContext);
|
|
5961
6011
|
}
|
|
5962
6012
|
|
|
6013
|
+
// src/shell/bot-check-notice.tsx
|
|
6014
|
+
import React5 from "react";
|
|
6015
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
6016
|
+
var BotCheckNoticeContext = React5.createContext(null);
|
|
6017
|
+
function BotCheckNoticeProvider({
|
|
6018
|
+
value,
|
|
6019
|
+
children
|
|
6020
|
+
}) {
|
|
6021
|
+
return /* @__PURE__ */ jsx5(BotCheckNoticeContext.Provider, { value, children });
|
|
6022
|
+
}
|
|
6023
|
+
function useBotCheckNotice() {
|
|
6024
|
+
return React5.useContext(BotCheckNoticeContext);
|
|
6025
|
+
}
|
|
6026
|
+
|
|
5963
6027
|
// src/shell/use-dock-state.ts
|
|
5964
|
-
import
|
|
6028
|
+
import React8 from "react";
|
|
5965
6029
|
|
|
5966
6030
|
// src/canvas/runtime-context.tsx
|
|
5967
6031
|
import { createContext as createContext6, useContext as useContext6 } from "react";
|
|
@@ -6074,21 +6138,21 @@ function useHasLeftSeedHome() {
|
|
|
6074
6138
|
}
|
|
6075
6139
|
|
|
6076
6140
|
// src/shell/use-hydrated.ts
|
|
6077
|
-
import
|
|
6141
|
+
import React6 from "react";
|
|
6078
6142
|
function useHydrated() {
|
|
6079
|
-
const [hydrated, setHydrated] =
|
|
6080
|
-
|
|
6143
|
+
const [hydrated, setHydrated] = React6.useState(false);
|
|
6144
|
+
React6.useEffect(() => {
|
|
6081
6145
|
setHydrated(true);
|
|
6082
6146
|
}, []);
|
|
6083
6147
|
return hydrated;
|
|
6084
6148
|
}
|
|
6085
6149
|
|
|
6086
6150
|
// src/shell/use-overridable-toggle.ts
|
|
6087
|
-
import
|
|
6151
|
+
import React7 from "react";
|
|
6088
6152
|
function useOverridableToggle(defaultValue) {
|
|
6089
|
-
const [override, setOverride] =
|
|
6153
|
+
const [override, setOverride] = React7.useState(null);
|
|
6090
6154
|
const value = override === null ? defaultValue : override;
|
|
6091
|
-
const set =
|
|
6155
|
+
const set = React7.useCallback((next) => {
|
|
6092
6156
|
setOverride(next);
|
|
6093
6157
|
}, []);
|
|
6094
6158
|
const toggle = () => {
|
|
@@ -6105,9 +6169,9 @@ function useDockState(reopenOnMessage, autoOpen) {
|
|
|
6105
6169
|
const hasLeftHome = useHasLeftSeedHome();
|
|
6106
6170
|
const agentDriven = useAgentDriven();
|
|
6107
6171
|
const settled = sessionId !== null;
|
|
6108
|
-
const settledRef =
|
|
6109
|
-
const engagedWhenSettledRef =
|
|
6110
|
-
const hasEngagedRef =
|
|
6172
|
+
const settledRef = React8.useRef(false);
|
|
6173
|
+
const engagedWhenSettledRef = React8.useRef(false);
|
|
6174
|
+
const hasEngagedRef = React8.useRef(initialOpen === true);
|
|
6111
6175
|
const historyIsAccountedFor = initialOpen !== null;
|
|
6112
6176
|
const engagementIsNew = historyIsAccountedFor ? settledRef.current && !engagedWhenSettledRef.current : true;
|
|
6113
6177
|
if (hasLeftHome && engagementIsNew && !agentDriven) hasEngagedRef.current = true;
|
|
@@ -6115,8 +6179,8 @@ function useDockState(reopenOnMessage, autoOpen) {
|
|
|
6115
6179
|
const openDefault = agentDriven || !autoOpen ? false : hydrated ? hasEngagedRef.current : initialOpen === true;
|
|
6116
6180
|
const toggle = useOverridableToggle(openDefault);
|
|
6117
6181
|
const userTurns = messages.reduce((n, m) => m.role === "user" ? n + 1 : n, 0);
|
|
6118
|
-
const prevUserTurns =
|
|
6119
|
-
|
|
6182
|
+
const prevUserTurns = React8.useRef(userTurns);
|
|
6183
|
+
React8.useEffect(() => {
|
|
6120
6184
|
if (!settledRef.current) {
|
|
6121
6185
|
if (!settled) return;
|
|
6122
6186
|
settledRef.current = true;
|
|
@@ -6127,7 +6191,7 @@ function useDockState(reopenOnMessage, autoOpen) {
|
|
|
6127
6191
|
if (reopenOnMessage && autoOpen && !agentDriven && userTurns > prevUserTurns.current) toggle.set(true);
|
|
6128
6192
|
prevUserTurns.current = userTurns;
|
|
6129
6193
|
}, [userTurns, settled, hasLeftHome, reopenOnMessage, autoOpen, agentDriven, toggle.set]);
|
|
6130
|
-
|
|
6194
|
+
React8.useEffect(() => {
|
|
6131
6195
|
onOpenChange(toggle.value);
|
|
6132
6196
|
}, [toggle.value, onOpenChange]);
|
|
6133
6197
|
return { open: toggle.value, toggle: toggle.toggle };
|
|
@@ -6159,7 +6223,7 @@ function useExclusiveOverlay(id, open, close) {
|
|
|
6159
6223
|
}
|
|
6160
6224
|
|
|
6161
6225
|
// src/shell/composer-attachments/use-composer-attachments.ts
|
|
6162
|
-
import * as
|
|
6226
|
+
import * as React9 from "react";
|
|
6163
6227
|
|
|
6164
6228
|
// src/utils/core-utils/mint-id.ts
|
|
6165
6229
|
function mintId(prefix) {
|
|
@@ -6201,12 +6265,12 @@ function failureOf(err) {
|
|
|
6201
6265
|
}
|
|
6202
6266
|
function useComposerAttachments() {
|
|
6203
6267
|
const session = useFourtySession();
|
|
6204
|
-
const [attachments, setAttachments] =
|
|
6205
|
-
const createdUrls =
|
|
6206
|
-
const update2 =
|
|
6268
|
+
const [attachments, setAttachments] = React9.useState([]);
|
|
6269
|
+
const createdUrls = React9.useRef(/* @__PURE__ */ new Set());
|
|
6270
|
+
const update2 = React9.useCallback((localId, patch) => {
|
|
6207
6271
|
setAttachments((prev) => prev.map((a) => a.localId === localId ? { ...a, ...patch } : a));
|
|
6208
6272
|
}, []);
|
|
6209
|
-
const startUpload =
|
|
6273
|
+
const startUpload = React9.useCallback(
|
|
6210
6274
|
(localId, file) => {
|
|
6211
6275
|
const failure = validate(file);
|
|
6212
6276
|
if (failure !== null) {
|
|
@@ -6230,7 +6294,7 @@ function useComposerAttachments() {
|
|
|
6230
6294
|
},
|
|
6231
6295
|
[session, update2]
|
|
6232
6296
|
);
|
|
6233
|
-
const addFiles =
|
|
6297
|
+
const addFiles = React9.useCallback(
|
|
6234
6298
|
(files) => {
|
|
6235
6299
|
const list2 = Array.from(files);
|
|
6236
6300
|
for (const file of list2) {
|
|
@@ -6263,13 +6327,13 @@ function useComposerAttachments() {
|
|
|
6263
6327
|
},
|
|
6264
6328
|
[startUpload]
|
|
6265
6329
|
);
|
|
6266
|
-
const revoke =
|
|
6330
|
+
const revoke = React9.useCallback((url) => {
|
|
6267
6331
|
if (url !== null && createdUrls.current.has(url)) {
|
|
6268
6332
|
URL.revokeObjectURL(url);
|
|
6269
6333
|
createdUrls.current.delete(url);
|
|
6270
6334
|
}
|
|
6271
6335
|
}, []);
|
|
6272
|
-
const remove2 =
|
|
6336
|
+
const remove2 = React9.useCallback(
|
|
6273
6337
|
(localId) => {
|
|
6274
6338
|
setAttachments((prev) => {
|
|
6275
6339
|
const target = prev.find((a) => a.localId === localId);
|
|
@@ -6279,12 +6343,12 @@ function useComposerAttachments() {
|
|
|
6279
6343
|
},
|
|
6280
6344
|
[revoke]
|
|
6281
6345
|
);
|
|
6282
|
-
const clear =
|
|
6346
|
+
const clear = React9.useCallback(() => {
|
|
6283
6347
|
for (const url of createdUrls.current) URL.revokeObjectURL(url);
|
|
6284
6348
|
createdUrls.current.clear();
|
|
6285
6349
|
setAttachments([]);
|
|
6286
6350
|
}, []);
|
|
6287
|
-
|
|
6351
|
+
React9.useEffect(
|
|
6288
6352
|
() => () => {
|
|
6289
6353
|
for (const url of createdUrls.current) URL.revokeObjectURL(url);
|
|
6290
6354
|
createdUrls.current.clear();
|
|
@@ -6292,7 +6356,7 @@ function useComposerAttachments() {
|
|
|
6292
6356
|
[]
|
|
6293
6357
|
);
|
|
6294
6358
|
const hasPending = attachments.some((a) => a.status === "uploading");
|
|
6295
|
-
const readyRefs =
|
|
6359
|
+
const readyRefs = React9.useMemo(
|
|
6296
6360
|
() => attachments.filter((a) => a.ref !== null).map((a) => a.ref),
|
|
6297
6361
|
[attachments]
|
|
6298
6362
|
);
|
|
@@ -6300,7 +6364,7 @@ function useComposerAttachments() {
|
|
|
6300
6364
|
}
|
|
6301
6365
|
|
|
6302
6366
|
// src/shell/use-prompt-composer.ts
|
|
6303
|
-
import * as
|
|
6367
|
+
import * as React10 from "react";
|
|
6304
6368
|
|
|
6305
6369
|
// src/voice/use-voice-capture.ts
|
|
6306
6370
|
import { useCallback as useCallback4, useEffect as useEffect4, useRef as useRef4, useState as useState3 } from "react";
|
|
@@ -6572,26 +6636,26 @@ function usePromptComposer(options = {}) {
|
|
|
6572
6636
|
const internalAttach = useComposerAttachments();
|
|
6573
6637
|
const attach = attachmentsController !== void 0 ? attachmentsController : internalAttach;
|
|
6574
6638
|
const [value, setValue] = useComposerDraft();
|
|
6575
|
-
const dictationBaseRef =
|
|
6576
|
-
const handleDictationResult =
|
|
6639
|
+
const dictationBaseRef = React10.useRef("");
|
|
6640
|
+
const handleDictationResult = React10.useCallback((transcript) => {
|
|
6577
6641
|
const base = dictationBaseRef.current;
|
|
6578
6642
|
setValue(base.length > 0 ? `${base} ${transcript}` : transcript);
|
|
6579
6643
|
}, [setValue]);
|
|
6580
|
-
const submitRef =
|
|
6644
|
+
const submitRef = React10.useRef(() => {
|
|
6581
6645
|
});
|
|
6582
6646
|
const voiceCapture = useVoiceCapture({
|
|
6583
6647
|
onResult: handleDictationResult,
|
|
6584
6648
|
onCommit: () => submitRef.current()
|
|
6585
6649
|
});
|
|
6586
|
-
const valueRef =
|
|
6650
|
+
const valueRef = React10.useRef(value);
|
|
6587
6651
|
valueRef.current = value;
|
|
6588
|
-
const toggleDictation =
|
|
6652
|
+
const toggleDictation = React10.useCallback(() => {
|
|
6589
6653
|
if (voiceCapture.state !== "listening") {
|
|
6590
6654
|
dictationBaseRef.current = valueRef.current;
|
|
6591
6655
|
}
|
|
6592
6656
|
voiceCapture.toggle();
|
|
6593
6657
|
}, [voiceCapture]);
|
|
6594
|
-
const onPaste =
|
|
6658
|
+
const onPaste = React10.useCallback(
|
|
6595
6659
|
(e) => {
|
|
6596
6660
|
const files = e.clipboardData.files;
|
|
6597
6661
|
if (files.length > 0) {
|
|
@@ -6602,7 +6666,7 @@ function usePromptComposer(options = {}) {
|
|
|
6602
6666
|
[attach]
|
|
6603
6667
|
);
|
|
6604
6668
|
const canSend = (value.trim().length > 0 || attach.readyRefs.length > 0) && !attach.hasPending;
|
|
6605
|
-
const submit =
|
|
6669
|
+
const submit = React10.useCallback(() => {
|
|
6606
6670
|
if (!((value.trim().length > 0 || attach.readyRefs.length > 0) && !attach.hasPending)) return;
|
|
6607
6671
|
voiceCapture.cancel();
|
|
6608
6672
|
session.sendMessage(
|
|
@@ -6629,10 +6693,10 @@ function usePromptComposer(options = {}) {
|
|
|
6629
6693
|
}
|
|
6630
6694
|
|
|
6631
6695
|
// src/shell/use-composer-chip-select.ts
|
|
6632
|
-
import * as
|
|
6696
|
+
import * as React11 from "react";
|
|
6633
6697
|
function useComposerChipSelect() {
|
|
6634
6698
|
const session = useFourtySession();
|
|
6635
|
-
return
|
|
6699
|
+
return React11.useCallback(
|
|
6636
6700
|
(action) => {
|
|
6637
6701
|
session.dispatchSuggestionAction({
|
|
6638
6702
|
id: action.id,
|
|
@@ -6646,10 +6710,10 @@ function useComposerChipSelect() {
|
|
|
6646
6710
|
}
|
|
6647
6711
|
|
|
6648
6712
|
// src/shell/use-turn-ask-reply.ts
|
|
6649
|
-
import * as
|
|
6713
|
+
import * as React12 from "react";
|
|
6650
6714
|
function useTurnAskReply() {
|
|
6651
6715
|
const session = useFourtySession();
|
|
6652
|
-
return
|
|
6716
|
+
return React12.useCallback(
|
|
6653
6717
|
(answer) => {
|
|
6654
6718
|
session.dispatchSuggestionAction({ id: `ask-${answer}`, label: answer, type: "message", payload: { text: answer, followUp: true } });
|
|
6655
6719
|
},
|
|
@@ -6658,14 +6722,14 @@ function useTurnAskReply() {
|
|
|
6658
6722
|
}
|
|
6659
6723
|
|
|
6660
6724
|
// src/shell/turn-ask-placement.tsx
|
|
6661
|
-
import * as
|
|
6662
|
-
import { jsx as
|
|
6663
|
-
var TurnAskPlacementContext =
|
|
6725
|
+
import * as React13 from "react";
|
|
6726
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
6727
|
+
var TurnAskPlacementContext = React13.createContext("prose");
|
|
6664
6728
|
function TurnAskPlacementProvider({ placement, children }) {
|
|
6665
|
-
return /* @__PURE__ */
|
|
6729
|
+
return /* @__PURE__ */ jsx6(TurnAskPlacementContext.Provider, { value: placement, children });
|
|
6666
6730
|
}
|
|
6667
6731
|
function useTurnAskPlacement() {
|
|
6668
|
-
return
|
|
6732
|
+
return React13.useContext(TurnAskPlacementContext);
|
|
6669
6733
|
}
|
|
6670
6734
|
|
|
6671
6735
|
// src/shell/use-go-home.ts
|
|
@@ -6682,10 +6746,10 @@ function useGoHome() {
|
|
|
6682
6746
|
}
|
|
6683
6747
|
|
|
6684
6748
|
// src/shell/use-menu-item-select.ts
|
|
6685
|
-
import * as
|
|
6749
|
+
import * as React14 from "react";
|
|
6686
6750
|
function useMenuItemSelect() {
|
|
6687
6751
|
const session = useFourtySession();
|
|
6688
|
-
return
|
|
6752
|
+
return React14.useCallback(
|
|
6689
6753
|
(item) => {
|
|
6690
6754
|
const payload = item.action.payload === void 0 ? {} : item.action.payload;
|
|
6691
6755
|
session.dispatchSuggestionAction({
|
|
@@ -6738,15 +6802,15 @@ function useThreadRows() {
|
|
|
6738
6802
|
}
|
|
6739
6803
|
|
|
6740
6804
|
// src/shell/conversation/use-conversation-page.ts
|
|
6741
|
-
import * as
|
|
6805
|
+
import * as React18 from "react";
|
|
6742
6806
|
|
|
6743
6807
|
// src/canvas/use-is-seed-home.ts
|
|
6744
|
-
import * as
|
|
6808
|
+
import * as React15 from "react";
|
|
6745
6809
|
function useIsSeedHome() {
|
|
6746
6810
|
const layout = useDisplayedLayout();
|
|
6747
6811
|
const turn = useTurn();
|
|
6748
6812
|
const sessionState = useSessionState();
|
|
6749
|
-
return
|
|
6813
|
+
return React15.useMemo(() => {
|
|
6750
6814
|
if (sessionState.seedLayout === null) return false;
|
|
6751
6815
|
if (turn.index !== 0) return false;
|
|
6752
6816
|
if (turn.userMessage !== "") return false;
|
|
@@ -6982,8 +7046,8 @@ var PRESENCE_LIFECYCLE = {
|
|
|
6982
7046
|
};
|
|
6983
7047
|
|
|
6984
7048
|
// ../spacestation/src/widgets/presence/profile.ts
|
|
6985
|
-
import { z as
|
|
6986
|
-
var PresenceProfileSchema =
|
|
7049
|
+
import { z as z48 } from "zod";
|
|
7050
|
+
var PresenceProfileSchema = z48.object({
|
|
6987
7051
|
/**
|
|
6988
7052
|
* How much the agent SPEAKS in presence.
|
|
6989
7053
|
* - 'off' the faculty generates no prose at all. Zero tokens, and
|
|
@@ -6993,14 +7057,14 @@ var PresenceProfileSchema = z47.object({
|
|
|
6993
7057
|
* - 'terse' one lead line per turn. The default — see below.
|
|
6994
7058
|
* - 'full' a lead line plus asides beside individual elements.
|
|
6995
7059
|
*/
|
|
6996
|
-
voice:
|
|
7060
|
+
voice: z48.enum(["off", "terse", "full"]),
|
|
6997
7061
|
/**
|
|
6998
7062
|
* Which source kinds this space surfaces. 'all' = every tool that declares a
|
|
6999
7063
|
* `sourceKind`. An explicit list lets a space stay quiet about lookups its
|
|
7000
7064
|
* visitors would find uninteresting (policy checks on a fashion space)
|
|
7001
7065
|
* without the tool having to lie about what it is.
|
|
7002
7066
|
*/
|
|
7003
|
-
sources:
|
|
7067
|
+
sources: z48.union([z48.array(z48.string()), z48.literal("all")]),
|
|
7004
7068
|
/**
|
|
7005
7069
|
* Which facts render.
|
|
7006
7070
|
* - 'inferred-only' hides `provenance: 'stated'` facts. The default and the
|
|
@@ -7009,7 +7073,7 @@ var PresenceProfileSchema = z47.object({
|
|
|
7009
7073
|
* - 'all' shows stated facts too — for spaces where confirming the brief
|
|
7010
7074
|
* back is itself the product (intake, configuration).
|
|
7011
7075
|
*/
|
|
7012
|
-
facts:
|
|
7076
|
+
facts: z48.enum(["inferred-only", "all"])
|
|
7013
7077
|
});
|
|
7014
7078
|
var DEFAULT_PRESENCE_PROFILE = {
|
|
7015
7079
|
voice: "terse",
|
|
@@ -7055,6 +7119,7 @@ function openWebStorage(kind) {
|
|
|
7055
7119
|
let adapter;
|
|
7056
7120
|
try {
|
|
7057
7121
|
const storage3 = window[kind];
|
|
7122
|
+
if (storage3 === null) throw new Error(`window.${kind} is null (DOM storage disabled)`);
|
|
7058
7123
|
adapter = {
|
|
7059
7124
|
get: (key) => storage3.getItem(key),
|
|
7060
7125
|
set: (key, value) => storage3.setItem(key, value),
|
|
@@ -7206,13 +7271,13 @@ import { useMemo as useMemo5 } from "react";
|
|
|
7206
7271
|
|
|
7207
7272
|
// src/catalog/CatalogContext.tsx
|
|
7208
7273
|
import { createContext as createContext9, useContext as useContext9 } from "react";
|
|
7209
|
-
import { jsx as
|
|
7274
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
7210
7275
|
var CatalogContext = createContext9({});
|
|
7211
7276
|
function CatalogProvider({
|
|
7212
7277
|
catalog,
|
|
7213
7278
|
children
|
|
7214
7279
|
}) {
|
|
7215
|
-
return /* @__PURE__ */
|
|
7280
|
+
return /* @__PURE__ */ jsx7(CatalogContext.Provider, { value: catalog, children });
|
|
7216
7281
|
}
|
|
7217
7282
|
function useComponentCatalog() {
|
|
7218
7283
|
return useContext9(CatalogContext);
|
|
@@ -7275,10 +7340,10 @@ function useAgentPresence(flowId = PRESENCE_FLOW) {
|
|
|
7275
7340
|
}
|
|
7276
7341
|
|
|
7277
7342
|
// src/widgets/presence/use-forget-fact.ts
|
|
7278
|
-
import * as
|
|
7343
|
+
import * as React17 from "react";
|
|
7279
7344
|
|
|
7280
7345
|
// src/widgets/presence/use-optimistic-flow-set.ts
|
|
7281
|
-
import * as
|
|
7346
|
+
import * as React16 from "react";
|
|
7282
7347
|
function readKeys(data) {
|
|
7283
7348
|
if (typeof data !== "object" || data === null || !("keys" in data)) return [];
|
|
7284
7349
|
const raw = data.keys;
|
|
@@ -7287,8 +7352,8 @@ function readKeys(data) {
|
|
|
7287
7352
|
function useOptimisticFlowSet(flowId) {
|
|
7288
7353
|
const keys = readKeys(useAgentFlow(flowId));
|
|
7289
7354
|
const joined = keys.join("\0");
|
|
7290
|
-
const set =
|
|
7291
|
-
return
|
|
7355
|
+
const set = React16.useMemo(() => new Set(keys), [joined]);
|
|
7356
|
+
return React16.useMemo(
|
|
7292
7357
|
() => ({
|
|
7293
7358
|
has: (key) => set.has(key),
|
|
7294
7359
|
add: (key) => {
|
|
@@ -7304,7 +7369,7 @@ function useOptimisticFlowSet(flowId) {
|
|
|
7304
7369
|
function useReconcileFlowSet(flowId, presentKeys) {
|
|
7305
7370
|
const data = useAgentFlow(flowId);
|
|
7306
7371
|
const presentJoined = presentKeys === null ? null : [...presentKeys].join("\0");
|
|
7307
|
-
|
|
7372
|
+
React16.useEffect(() => {
|
|
7308
7373
|
if (presentKeys === null) return;
|
|
7309
7374
|
const keys = readKeys(data);
|
|
7310
7375
|
if (keys.length === 0) return;
|
|
@@ -7326,7 +7391,7 @@ var useUndismissedFacts = useVisibleFactList;
|
|
|
7326
7391
|
function useForgetFact() {
|
|
7327
7392
|
const { sendImmediateSignal } = useFourtySession();
|
|
7328
7393
|
const dismissed = useOptimisticFlowSet(DISMISSED_FLOW);
|
|
7329
|
-
const forget =
|
|
7394
|
+
const forget = React17.useCallback(
|
|
7330
7395
|
(f) => {
|
|
7331
7396
|
dismissed.add(f.label);
|
|
7332
7397
|
sendImmediateSignal({ type: PRESENCE_FACT_DISMISS_SIGNAL, payload: { label: f.label, value: f.value } });
|
|
@@ -7377,7 +7442,7 @@ function useConversationPage() {
|
|
|
7377
7442
|
const presence = useConversationPresence();
|
|
7378
7443
|
const suggestions = useSuggestionsWithDefaults();
|
|
7379
7444
|
const followUp = useComposerChipSelect();
|
|
7380
|
-
const onWelcomePage =
|
|
7445
|
+
const onWelcomePage = React18.useMemo(
|
|
7381
7446
|
() => seedLayout !== null && JSON.stringify(layout) === JSON.stringify(seedLayout),
|
|
7382
7447
|
[layout, seedLayout]
|
|
7383
7448
|
);
|
|
@@ -7445,14 +7510,14 @@ function findThreadHeadroom(scroller) {
|
|
|
7445
7510
|
}
|
|
7446
7511
|
|
|
7447
7512
|
// src/shell/thread-scroll/ThreadHeadroom.tsx
|
|
7448
|
-
import { jsx as
|
|
7513
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
7449
7514
|
var HEADROOM_STYLE = { height: 0, flexShrink: 0 };
|
|
7450
7515
|
function ThreadHeadroom() {
|
|
7451
|
-
return /* @__PURE__ */
|
|
7516
|
+
return /* @__PURE__ */ jsx8("div", { ...{ [THREAD_HEADROOM_ATTR]: "" }, "aria-hidden": true, style: HEADROOM_STYLE });
|
|
7452
7517
|
}
|
|
7453
7518
|
|
|
7454
7519
|
// src/shell/thread-scroll/use-pin-turn-to-top.ts
|
|
7455
|
-
import * as
|
|
7520
|
+
import * as React19 from "react";
|
|
7456
7521
|
|
|
7457
7522
|
// src/canvas/dom-targets.ts
|
|
7458
7523
|
var ACTIVE_PANEL_ATTR = "data-fourty-panel-active";
|
|
@@ -7629,7 +7694,7 @@ function pinTurnHead(scroller, row, options) {
|
|
|
7629
7694
|
|
|
7630
7695
|
// src/shell/thread-scroll/use-pin-turn-to-top.ts
|
|
7631
7696
|
function usePinTurnToTop({ scrollerRef, turnRef, turnId }) {
|
|
7632
|
-
|
|
7697
|
+
React19.useEffect(() => {
|
|
7633
7698
|
if (turnId === null) return;
|
|
7634
7699
|
const scroller = scrollerRef.current;
|
|
7635
7700
|
const row = turnRef.current;
|
|
@@ -7650,10 +7715,10 @@ function usePinTurnToTop({ scrollerRef, turnRef, turnId }) {
|
|
|
7650
7715
|
}
|
|
7651
7716
|
|
|
7652
7717
|
// src/shell/thread-scroll/use-scroll-has-more-below.ts
|
|
7653
|
-
import * as
|
|
7718
|
+
import * as React20 from "react";
|
|
7654
7719
|
function useScrollHasMoreBelow(scroller, thresholdPx = 16) {
|
|
7655
|
-
const [hasMore, setHasMore] =
|
|
7656
|
-
|
|
7720
|
+
const [hasMore, setHasMore] = React20.useState(false);
|
|
7721
|
+
React20.useEffect(() => {
|
|
7657
7722
|
if (scroller === null) return;
|
|
7658
7723
|
const view = scroller.ownerDocument.defaultView;
|
|
7659
7724
|
if (view === null) return;
|
|
@@ -7693,9 +7758,9 @@ function threadRowAttrs(key) {
|
|
|
7693
7758
|
}
|
|
7694
7759
|
|
|
7695
7760
|
// src/shell/thread-scroll/use-thread-jump-marks.ts
|
|
7696
|
-
import * as
|
|
7761
|
+
import * as React21 from "react";
|
|
7697
7762
|
function useThreadJumpMarks(rows) {
|
|
7698
|
-
return
|
|
7763
|
+
return React21.useMemo(
|
|
7699
7764
|
() => rows.filter((row) => row.visitorText.length > 0).map((row) => ({
|
|
7700
7765
|
key: row.key,
|
|
7701
7766
|
label: row.visitorText,
|
|
@@ -7709,7 +7774,7 @@ function useThreadJumpMarks(rows) {
|
|
|
7709
7774
|
}
|
|
7710
7775
|
|
|
7711
7776
|
// src/shell/thread-scroll/use-thread-landing.ts
|
|
7712
|
-
import * as
|
|
7777
|
+
import * as React22 from "react";
|
|
7713
7778
|
|
|
7714
7779
|
// src/shell/thread-scroll/settle-thread-row.ts
|
|
7715
7780
|
var SETTLE_MS = 1200;
|
|
@@ -7773,11 +7838,11 @@ function settleThreadRow(scroller, rowKey, behavior = "smooth") {
|
|
|
7773
7838
|
}
|
|
7774
7839
|
|
|
7775
7840
|
// src/shell/thread-scroll/use-thread-landing.ts
|
|
7776
|
-
var useIsomorphicLayoutEffect = typeof window === "undefined" ?
|
|
7841
|
+
var useIsomorphicLayoutEffect = typeof window === "undefined" ? React22.useEffect : React22.useLayoutEffect;
|
|
7777
7842
|
function useThreadLanding(scroller, relandKey = 0) {
|
|
7778
7843
|
const { turnId, seq } = useExplicitTurnSelection();
|
|
7779
|
-
const openedWith =
|
|
7780
|
-
const landedRef =
|
|
7844
|
+
const openedWith = React22.useRef({ turnId, seq });
|
|
7845
|
+
const landedRef = React22.useRef(null);
|
|
7781
7846
|
useIsomorphicLayoutEffect(() => {
|
|
7782
7847
|
if (scroller === null) return;
|
|
7783
7848
|
if (turnId !== null) {
|
|
@@ -7832,7 +7897,7 @@ function useRegisterSignalHandlers(handlers) {
|
|
|
7832
7897
|
var AGENT_ASK_SIGNAL = "agent_ask";
|
|
7833
7898
|
|
|
7834
7899
|
// src/provider/use-clamp-toggle.ts
|
|
7835
|
-
import
|
|
7900
|
+
import React23 from "react";
|
|
7836
7901
|
|
|
7837
7902
|
// src/shared/use-expandable.ts
|
|
7838
7903
|
import { useCallback as useCallback10, useState as useState5 } from "react";
|
|
@@ -7845,9 +7910,9 @@ function useExpandable(initial = false) {
|
|
|
7845
7910
|
// src/provider/use-clamp-toggle.ts
|
|
7846
7911
|
function useClampToggle(contentKey) {
|
|
7847
7912
|
const { expanded, toggle } = useExpandable(false);
|
|
7848
|
-
const [overflowing, setOverflowing] =
|
|
7849
|
-
const ref =
|
|
7850
|
-
|
|
7913
|
+
const [overflowing, setOverflowing] = React23.useState(false);
|
|
7914
|
+
const ref = React23.useRef(null);
|
|
7915
|
+
React23.useEffect(() => {
|
|
7851
7916
|
const el = ref.current;
|
|
7852
7917
|
if (el === null) return;
|
|
7853
7918
|
if (expanded) return;
|
|
@@ -7863,16 +7928,16 @@ function useClampToggle(contentKey) {
|
|
|
7863
7928
|
}
|
|
7864
7929
|
|
|
7865
7930
|
// src/provider/use-timed-flag.ts
|
|
7866
|
-
import
|
|
7931
|
+
import React24 from "react";
|
|
7867
7932
|
function useTimedFlag(durationMs) {
|
|
7868
|
-
const [flag, setFlag] =
|
|
7869
|
-
const timerRef =
|
|
7870
|
-
|
|
7933
|
+
const [flag, setFlag] = React24.useState(false);
|
|
7934
|
+
const timerRef = React24.useRef(null);
|
|
7935
|
+
React24.useEffect(() => {
|
|
7871
7936
|
return () => {
|
|
7872
7937
|
if (timerRef.current !== null) window.clearTimeout(timerRef.current);
|
|
7873
7938
|
};
|
|
7874
7939
|
}, []);
|
|
7875
|
-
const trigger =
|
|
7940
|
+
const trigger = React24.useCallback(() => {
|
|
7876
7941
|
if (timerRef.current !== null) window.clearTimeout(timerRef.current);
|
|
7877
7942
|
setFlag(true);
|
|
7878
7943
|
timerRef.current = window.setTimeout(() => {
|
|
@@ -7985,35 +8050,35 @@ __export(canvas_exports, {
|
|
|
7985
8050
|
});
|
|
7986
8051
|
|
|
7987
8052
|
// src/canvas/canvas-tail.tsx
|
|
7988
|
-
import * as
|
|
7989
|
-
import { jsx as
|
|
7990
|
-
var CanvasTailContext =
|
|
8053
|
+
import * as React25 from "react";
|
|
8054
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
8055
|
+
var CanvasTailContext = React25.createContext(null);
|
|
7991
8056
|
function CanvasTailProvider({
|
|
7992
8057
|
tail,
|
|
7993
8058
|
children
|
|
7994
8059
|
}) {
|
|
7995
|
-
return /* @__PURE__ */
|
|
8060
|
+
return /* @__PURE__ */ jsx9(CanvasTailContext.Provider, { value: tail, children });
|
|
7996
8061
|
}
|
|
7997
8062
|
function useCanvasTail() {
|
|
7998
|
-
return
|
|
8063
|
+
return React25.useContext(CanvasTailContext);
|
|
7999
8064
|
}
|
|
8000
8065
|
function CanvasTailMount({
|
|
8001
8066
|
isActive
|
|
8002
8067
|
}) {
|
|
8003
8068
|
const Tail = useCanvasTail();
|
|
8004
8069
|
if (!isActive || Tail === null) return null;
|
|
8005
|
-
return /* @__PURE__ */
|
|
8070
|
+
return /* @__PURE__ */ jsx9(Tail, {});
|
|
8006
8071
|
}
|
|
8007
8072
|
|
|
8008
8073
|
// src/canvas/hydration-notice.tsx
|
|
8009
|
-
import * as
|
|
8010
|
-
import { jsx as
|
|
8011
|
-
var HydrationNoticeContext =
|
|
8074
|
+
import * as React26 from "react";
|
|
8075
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
8076
|
+
var HydrationNoticeContext = React26.createContext(null);
|
|
8012
8077
|
function HydrationNoticeProvider({ notice, children }) {
|
|
8013
|
-
return /* @__PURE__ */
|
|
8078
|
+
return /* @__PURE__ */ jsx10(HydrationNoticeContext.Provider, { value: notice, children });
|
|
8014
8079
|
}
|
|
8015
8080
|
function useHydrationNotice() {
|
|
8016
|
-
return
|
|
8081
|
+
return React26.useContext(HydrationNoticeContext);
|
|
8017
8082
|
}
|
|
8018
8083
|
|
|
8019
8084
|
// src/canvas/GenerationStyleContext.tsx
|
|
@@ -8051,11 +8116,11 @@ function useGenerationStyle() {
|
|
|
8051
8116
|
|
|
8052
8117
|
// src/canvas/ShimmerSweep.tsx
|
|
8053
8118
|
import { motion, useReducedMotion } from "framer-motion";
|
|
8054
|
-
import { jsx as
|
|
8119
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
8055
8120
|
function ShimmerSweep({ durationS }) {
|
|
8056
8121
|
const reduce = useReducedMotion();
|
|
8057
8122
|
if (reduce === true) return null;
|
|
8058
|
-
return /* @__PURE__ */
|
|
8123
|
+
return /* @__PURE__ */ jsx11(
|
|
8059
8124
|
motion.div,
|
|
8060
8125
|
{
|
|
8061
8126
|
"aria-hidden": true,
|
|
@@ -8073,14 +8138,14 @@ function ShimmerSweep({ durationS }) {
|
|
|
8073
8138
|
}
|
|
8074
8139
|
|
|
8075
8140
|
// src/canvas/TransitionContext.tsx
|
|
8076
|
-
import
|
|
8141
|
+
import React27, { createContext as createContext14, useContext as useContext14 } from "react";
|
|
8077
8142
|
import { AnimatePresence, motion as motion2 } from "framer-motion";
|
|
8078
|
-
import { jsx as
|
|
8143
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
8079
8144
|
function FadeGroup({ children }) {
|
|
8080
|
-
return /* @__PURE__ */
|
|
8145
|
+
return /* @__PURE__ */ jsx12(AnimatePresence, { mode: "popLayout", initial: false, children });
|
|
8081
8146
|
}
|
|
8082
|
-
var FadeItem =
|
|
8083
|
-
return /* @__PURE__ */
|
|
8147
|
+
var FadeItem = React27.forwardRef(function FadeItem2({ id, children, style, className }, ref) {
|
|
8148
|
+
return /* @__PURE__ */ jsx12(
|
|
8084
8149
|
motion2.div,
|
|
8085
8150
|
{
|
|
8086
8151
|
ref,
|
|
@@ -8100,23 +8165,23 @@ function TransitionProvider({
|
|
|
8100
8165
|
transition,
|
|
8101
8166
|
children
|
|
8102
8167
|
}) {
|
|
8103
|
-
return /* @__PURE__ */
|
|
8168
|
+
return /* @__PURE__ */ jsx12(TransitionContext.Provider, { value: transition, children });
|
|
8104
8169
|
}
|
|
8105
8170
|
function useLayoutTransition() {
|
|
8106
8171
|
return useContext14(TransitionContext);
|
|
8107
8172
|
}
|
|
8108
8173
|
|
|
8109
8174
|
// src/canvas/canvas-arrangement.tsx
|
|
8110
|
-
import
|
|
8111
|
-
import { jsx as
|
|
8175
|
+
import React28, { createContext as createContext15, useContext as useContext15 } from "react";
|
|
8176
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
8112
8177
|
var CanvasArrangementContext = createContext15({ arrangement: "stack", turnPages: false });
|
|
8113
8178
|
function CanvasArrangementProvider({
|
|
8114
8179
|
arrangement,
|
|
8115
8180
|
turnPages = false,
|
|
8116
8181
|
children
|
|
8117
8182
|
}) {
|
|
8118
|
-
const value =
|
|
8119
|
-
return /* @__PURE__ */
|
|
8183
|
+
const value = React28.useMemo(() => ({ arrangement, turnPages }), [arrangement, turnPages]);
|
|
8184
|
+
return /* @__PURE__ */ jsx13(CanvasArrangementContext.Provider, { value, children });
|
|
8120
8185
|
}
|
|
8121
8186
|
function useCanvasArrangement() {
|
|
8122
8187
|
return useContext15(CanvasArrangementContext);
|
|
@@ -8124,10 +8189,10 @@ function useCanvasArrangement() {
|
|
|
8124
8189
|
|
|
8125
8190
|
// src/canvas/canvas-motion-style.tsx
|
|
8126
8191
|
import { createContext as createContext16, useContext as useContext16 } from "react";
|
|
8127
|
-
import { jsx as
|
|
8192
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
8128
8193
|
var CanvasMotionStyleContext = createContext16(null);
|
|
8129
8194
|
function CanvasMotionStyleProvider({ style, children }) {
|
|
8130
|
-
return /* @__PURE__ */
|
|
8195
|
+
return /* @__PURE__ */ jsx14(CanvasMotionStyleContext.Provider, { value: style, children });
|
|
8131
8196
|
}
|
|
8132
8197
|
function useCanvasMotionStyle() {
|
|
8133
8198
|
return useContext16(CanvasMotionStyleContext);
|
|
@@ -8398,21 +8463,21 @@ function deriveTurnChangeAnchor(prev, next) {
|
|
|
8398
8463
|
|
|
8399
8464
|
// src/canvas/canvas-outlet.tsx
|
|
8400
8465
|
import { createContext as createContext18, useContext as useContext18 } from "react";
|
|
8401
|
-
import { jsx as
|
|
8466
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
8402
8467
|
var CanvasOutletContext = createContext18(null);
|
|
8403
8468
|
function CanvasOutletProvider({ canvas, children }) {
|
|
8404
|
-
return /* @__PURE__ */
|
|
8469
|
+
return /* @__PURE__ */ jsx15(CanvasOutletContext.Provider, { value: canvas, children });
|
|
8405
8470
|
}
|
|
8406
8471
|
function SpacefrontCanvas() {
|
|
8407
8472
|
const Canvas = useContext18(CanvasOutletContext);
|
|
8408
8473
|
if (Canvas === null) {
|
|
8409
8474
|
throw new Error("<SpacefrontCanvas> must be rendered inside <Spacefront> \u2014 no engine has provided a canvas.");
|
|
8410
8475
|
}
|
|
8411
|
-
return /* @__PURE__ */
|
|
8476
|
+
return /* @__PURE__ */ jsx15(Canvas, {});
|
|
8412
8477
|
}
|
|
8413
8478
|
|
|
8414
8479
|
// src/canvas/item-motion/ItemTransitionGroup.tsx
|
|
8415
|
-
import
|
|
8480
|
+
import React30 from "react";
|
|
8416
8481
|
import { AnimatePresence as AnimatePresence2, motion as motion3, useReducedMotion as useReducedMotion2 } from "framer-motion";
|
|
8417
8482
|
|
|
8418
8483
|
// src/canvas/item-motion/classify-items.ts
|
|
@@ -8631,7 +8696,7 @@ function getActiveProfile() {
|
|
|
8631
8696
|
}
|
|
8632
8697
|
|
|
8633
8698
|
// src/canvas/item-motion/ItemTransitionGroup.tsx
|
|
8634
|
-
import { jsx as
|
|
8699
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
8635
8700
|
var ITEM_IDENTITY_ATTR = "data-flip-id";
|
|
8636
8701
|
function ItemTransitionGroup({
|
|
8637
8702
|
items,
|
|
@@ -8646,14 +8711,14 @@ function ItemTransitionGroup({
|
|
|
8646
8711
|
const profile = getActiveProfile();
|
|
8647
8712
|
const animated = reduce !== true;
|
|
8648
8713
|
const ids = items.map(getId);
|
|
8649
|
-
const prevIdsRef =
|
|
8650
|
-
const lastChangeRef =
|
|
8714
|
+
const prevIdsRef = React30.useRef(null);
|
|
8715
|
+
const lastChangeRef = React30.useRef(null);
|
|
8651
8716
|
const prevIds = prevIdsRef.current;
|
|
8652
8717
|
const freshChange = prevIds === null ? null : classifyItemChange(prevIds, ids);
|
|
8653
8718
|
if (freshChange !== null) {
|
|
8654
8719
|
lastChangeRef.current = freshChange;
|
|
8655
8720
|
}
|
|
8656
|
-
|
|
8721
|
+
React30.useEffect(() => {
|
|
8657
8722
|
prevIdsRef.current = ids;
|
|
8658
8723
|
});
|
|
8659
8724
|
const activeChange = lastChangeRef.current;
|
|
@@ -8666,7 +8731,7 @@ function ItemTransitionGroup({
|
|
|
8666
8731
|
const isGrid = itemClassName === void 0;
|
|
8667
8732
|
const outerClassName = isGrid ? "h-full" : itemClassName;
|
|
8668
8733
|
const innerClassName = isGrid ? "h-full" : void 0;
|
|
8669
|
-
return /* @__PURE__ */
|
|
8734
|
+
return /* @__PURE__ */ jsx16("div", { className, style, children: /* @__PURE__ */ jsx16(AnimatePresence2, { mode: "popLayout", initial: false, children: items.map((item) => {
|
|
8670
8735
|
const id = getId(item);
|
|
8671
8736
|
const identityAttr = { [ITEM_IDENTITY_ATTR]: id };
|
|
8672
8737
|
const isEntering = activeChange !== null && activeChange.entered.includes(id);
|
|
@@ -8676,7 +8741,7 @@ function ItemTransitionGroup({
|
|
|
8676
8741
|
// `itemClassName`/`itemStyle` size the wrapper for flex/snap
|
|
8677
8742
|
// layouts (carousel); grid layouts leave them unset and get
|
|
8678
8743
|
// `h-full` so the cell height reaches the card.
|
|
8679
|
-
/* @__PURE__ */
|
|
8744
|
+
/* @__PURE__ */ jsx16(
|
|
8680
8745
|
motion3.div,
|
|
8681
8746
|
{
|
|
8682
8747
|
...identityAttr,
|
|
@@ -8685,7 +8750,7 @@ function ItemTransitionGroup({
|
|
|
8685
8750
|
layout: animated ? "position" : void 0,
|
|
8686
8751
|
layoutDependency,
|
|
8687
8752
|
transition: animated ? layoutTransition : void 0,
|
|
8688
|
-
children: /* @__PURE__ */
|
|
8753
|
+
children: /* @__PURE__ */ jsx16(
|
|
8689
8754
|
motion3.div,
|
|
8690
8755
|
{
|
|
8691
8756
|
className: innerClassName,
|
|
@@ -8766,13 +8831,13 @@ __export(catalog_exports, {
|
|
|
8766
8831
|
|
|
8767
8832
|
// src/catalog/DebugContext.tsx
|
|
8768
8833
|
import { createContext as createContext19, useContext as useContext19 } from "react";
|
|
8769
|
-
import { jsx as
|
|
8834
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
8770
8835
|
var DebugContext = createContext19(false);
|
|
8771
8836
|
function DebugProvider({
|
|
8772
8837
|
debug,
|
|
8773
8838
|
children
|
|
8774
8839
|
}) {
|
|
8775
|
-
return /* @__PURE__ */
|
|
8840
|
+
return /* @__PURE__ */ jsx17(DebugContext.Provider, { value: debug, children });
|
|
8776
8841
|
}
|
|
8777
8842
|
function useDebug() {
|
|
8778
8843
|
return useContext19(DebugContext);
|
|
@@ -8796,13 +8861,13 @@ function useHydrationState() {
|
|
|
8796
8861
|
|
|
8797
8862
|
// src/catalog/HydratorContext.tsx
|
|
8798
8863
|
import { createContext as createContext21, useContext as useContext21 } from "react";
|
|
8799
|
-
import { jsx as
|
|
8864
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
8800
8865
|
var HydratorContext = createContext21({});
|
|
8801
8866
|
function HydratorProvider({
|
|
8802
8867
|
hydrators,
|
|
8803
8868
|
children
|
|
8804
8869
|
}) {
|
|
8805
|
-
return /* @__PURE__ */
|
|
8870
|
+
return /* @__PURE__ */ jsx18(HydratorContext.Provider, { value: hydrators, children });
|
|
8806
8871
|
}
|
|
8807
8872
|
function useHydrators() {
|
|
8808
8873
|
return useContext21(HydratorContext);
|
|
@@ -8810,13 +8875,13 @@ function useHydrators() {
|
|
|
8810
8875
|
|
|
8811
8876
|
// src/catalog/registry.tsx
|
|
8812
8877
|
import { createContext as createContext22, useContext as useContext22 } from "react";
|
|
8813
|
-
import { jsx as
|
|
8878
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
8814
8879
|
var RegistryContext = createContext22({});
|
|
8815
8880
|
function RegistryProvider({
|
|
8816
8881
|
registry: registry2,
|
|
8817
8882
|
children
|
|
8818
8883
|
}) {
|
|
8819
|
-
return /* @__PURE__ */
|
|
8884
|
+
return /* @__PURE__ */ jsx19(RegistryContext.Provider, { value: registry2, children });
|
|
8820
8885
|
}
|
|
8821
8886
|
function useRegistry() {
|
|
8822
8887
|
return useContext22(RegistryContext);
|
|
@@ -8826,7 +8891,7 @@ function PackageLookupProvider({
|
|
|
8826
8891
|
lookup,
|
|
8827
8892
|
children
|
|
8828
8893
|
}) {
|
|
8829
|
-
return /* @__PURE__ */
|
|
8894
|
+
return /* @__PURE__ */ jsx19(PackageLookupContext.Provider, { value: lookup, children });
|
|
8830
8895
|
}
|
|
8831
8896
|
function usePackageLookup() {
|
|
8832
8897
|
return useContext22(PackageLookupContext);
|
|
@@ -8860,9 +8925,9 @@ function createAliasedRegistry(baseRegistry, aliases, getPackageComponent) {
|
|
|
8860
8925
|
}
|
|
8861
8926
|
|
|
8862
8927
|
// src/catalog/render-inline.tsx
|
|
8863
|
-
import
|
|
8864
|
-
import { jsx as
|
|
8865
|
-
var linkRenderer = (href, key) => /* @__PURE__ */
|
|
8928
|
+
import React33 from "react";
|
|
8929
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
8930
|
+
var linkRenderer = (href, key) => /* @__PURE__ */ jsx20(
|
|
8866
8931
|
"a",
|
|
8867
8932
|
{
|
|
8868
8933
|
className: "fourty-inline-link",
|
|
@@ -8882,14 +8947,14 @@ function linkifyText(text2, keyPrefix) {
|
|
|
8882
8947
|
URL_RE.lastIndex = 0;
|
|
8883
8948
|
while ((match = URL_RE.exec(text2)) !== null) {
|
|
8884
8949
|
if (match.index > last) {
|
|
8885
|
-
out.push(/* @__PURE__ */
|
|
8950
|
+
out.push(/* @__PURE__ */ jsx20(React33.Fragment, { children: text2.slice(last, match.index) }, `${keyPrefix}-lt-${i++}`));
|
|
8886
8951
|
}
|
|
8887
8952
|
const href = match[0];
|
|
8888
8953
|
out.push(linkRenderer(href, `${keyPrefix}-lk-${i++}`));
|
|
8889
8954
|
last = match.index + href.length;
|
|
8890
8955
|
}
|
|
8891
8956
|
if (last < text2.length) {
|
|
8892
|
-
out.push(/* @__PURE__ */
|
|
8957
|
+
out.push(/* @__PURE__ */ jsx20(React33.Fragment, { children: text2.slice(last) }, `${keyPrefix}-lt-${i++}`));
|
|
8893
8958
|
}
|
|
8894
8959
|
return out;
|
|
8895
8960
|
}
|
|
@@ -8902,8 +8967,8 @@ function renderInline(text2, keyPrefix) {
|
|
|
8902
8967
|
while ((match = re.exec(text2)) !== null) {
|
|
8903
8968
|
if (match.index > last) out.push(...linkifyText(text2.slice(last, match.index), `${keyPrefix}-t-${i++}`));
|
|
8904
8969
|
const bold = match[1];
|
|
8905
|
-
if (bold !== void 0) out.push(/* @__PURE__ */
|
|
8906
|
-
else out.push(/* @__PURE__ */
|
|
8970
|
+
if (bold !== void 0) out.push(/* @__PURE__ */ jsx20("strong", { children: bold }, `${keyPrefix}-b-${i++}`));
|
|
8971
|
+
else out.push(/* @__PURE__ */ jsx20("em", { children: match[2] }, `${keyPrefix}-i-${i++}`));
|
|
8907
8972
|
last = match.index + match[0].length;
|
|
8908
8973
|
}
|
|
8909
8974
|
if (last < text2.length) out.push(...linkifyText(text2.slice(last), `${keyPrefix}-t-${i++}`));
|
|
@@ -8911,7 +8976,7 @@ function renderInline(text2, keyPrefix) {
|
|
|
8911
8976
|
}
|
|
8912
8977
|
|
|
8913
8978
|
// src/catalog/component-library.ts
|
|
8914
|
-
import * as
|
|
8979
|
+
import * as React34 from "react";
|
|
8915
8980
|
function displayNameOf(Inner) {
|
|
8916
8981
|
if (typeof Inner === "string") return Inner;
|
|
8917
8982
|
if (typeof Inner.displayName === "string" && Inner.displayName.length > 0) return Inner.displayName;
|
|
@@ -8920,7 +8985,7 @@ function displayNameOf(Inner) {
|
|
|
8920
8985
|
}
|
|
8921
8986
|
function adaptComponent(Inner) {
|
|
8922
8987
|
function Adapted(props) {
|
|
8923
|
-
return
|
|
8988
|
+
return React34.createElement(Inner, props);
|
|
8924
8989
|
}
|
|
8925
8990
|
Adapted.displayName = displayNameOf(Inner);
|
|
8926
8991
|
return Adapted;
|
|
@@ -8961,23 +9026,23 @@ function buildComponentLibrary(catalog, componentMap) {
|
|
|
8961
9026
|
}
|
|
8962
9027
|
|
|
8963
9028
|
// src/catalog/define.ts
|
|
8964
|
-
import { z as
|
|
8965
|
-
var HYDRATED_ENTITY =
|
|
9029
|
+
import { z as z49 } from "zod";
|
|
9030
|
+
var HYDRATED_ENTITY = z49.object({}).passthrough();
|
|
8966
9031
|
function entity(resolverKey, opts) {
|
|
8967
9032
|
return resolved(HYDRATED_ENTITY, resolverKey, opts);
|
|
8968
9033
|
}
|
|
8969
|
-
var text = prose(
|
|
9034
|
+
var text = prose(z49.string());
|
|
8970
9035
|
function plain() {
|
|
8971
|
-
return
|
|
9036
|
+
return z49.string();
|
|
8972
9037
|
}
|
|
8973
9038
|
function token(values) {
|
|
8974
|
-
return
|
|
9039
|
+
return z49.enum(values);
|
|
8975
9040
|
}
|
|
8976
9041
|
function catalogComponent(meta, render) {
|
|
8977
9042
|
const { props, requires, ...rest } = meta;
|
|
8978
9043
|
return {
|
|
8979
9044
|
...rest,
|
|
8980
|
-
propsSchema:
|
|
9045
|
+
propsSchema: z49.object(props),
|
|
8981
9046
|
...requires !== void 0 ? { requires } : {},
|
|
8982
9047
|
component: adaptComponent(render)
|
|
8983
9048
|
};
|
|
@@ -9317,7 +9382,7 @@ function useConsumeStandingSignal(type) {
|
|
|
9317
9382
|
}
|
|
9318
9383
|
|
|
9319
9384
|
// src/widgets/presence/use-presence-notch.ts
|
|
9320
|
-
import * as
|
|
9385
|
+
import * as React35 from "react";
|
|
9321
9386
|
var SETTLE_DWELL_MS = 4e3;
|
|
9322
9387
|
var HOVER_CLOSE_MS = 240;
|
|
9323
9388
|
var HOVER_BOUNCE_WINDOW_MS = 800;
|
|
@@ -9325,21 +9390,21 @@ var BOUNCE_PX = 2;
|
|
|
9325
9390
|
function usePresenceNotch(widgets) {
|
|
9326
9391
|
const askStanding = useStandingOfType(AGENT_ASK_SIGNAL) !== null;
|
|
9327
9392
|
const { isRunning } = useAgentPresence();
|
|
9328
|
-
const [hovered, setHovered] =
|
|
9329
|
-
const [openDrawerId, setOpenDrawerId] =
|
|
9330
|
-
const rootRef =
|
|
9331
|
-
const toggleDrawer =
|
|
9393
|
+
const [hovered, setHovered] = React35.useState(false);
|
|
9394
|
+
const [openDrawerId, setOpenDrawerId] = React35.useState(null);
|
|
9395
|
+
const rootRef = React35.useRef(null);
|
|
9396
|
+
const toggleDrawer = React35.useCallback((id) => {
|
|
9332
9397
|
setOpenDrawerId((current2) => current2 === id ? null : id);
|
|
9333
9398
|
}, []);
|
|
9334
|
-
const closeTimer =
|
|
9335
|
-
const cancelClose =
|
|
9399
|
+
const closeTimer = React35.useRef(null);
|
|
9400
|
+
const cancelClose = React35.useCallback(() => {
|
|
9336
9401
|
if (closeTimer.current !== null) {
|
|
9337
9402
|
clearTimeout(closeTimer.current);
|
|
9338
9403
|
closeTimer.current = null;
|
|
9339
9404
|
}
|
|
9340
9405
|
}, []);
|
|
9341
|
-
const lastLeaveRef =
|
|
9342
|
-
const openHover =
|
|
9406
|
+
const lastLeaveRef = React35.useRef(null);
|
|
9407
|
+
const openHover = React35.useCallback((e) => {
|
|
9343
9408
|
const last = lastLeaveRef.current;
|
|
9344
9409
|
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) {
|
|
9345
9410
|
return;
|
|
@@ -9347,7 +9412,7 @@ function usePresenceNotch(widgets) {
|
|
|
9347
9412
|
cancelClose();
|
|
9348
9413
|
setHovered(true);
|
|
9349
9414
|
}, [cancelClose]);
|
|
9350
|
-
const scheduleClose =
|
|
9415
|
+
const scheduleClose = React35.useCallback((e) => {
|
|
9351
9416
|
lastLeaveRef.current = { x: e.clientX, y: e.clientY, t: Date.now() };
|
|
9352
9417
|
cancelClose();
|
|
9353
9418
|
closeTimer.current = setTimeout(() => {
|
|
@@ -9355,8 +9420,8 @@ function usePresenceNotch(widgets) {
|
|
|
9355
9420
|
setHovered(false);
|
|
9356
9421
|
}, HOVER_CLOSE_MS);
|
|
9357
9422
|
}, [cancelClose]);
|
|
9358
|
-
|
|
9359
|
-
|
|
9423
|
+
React35.useEffect(() => cancelClose, [cancelClose]);
|
|
9424
|
+
React35.useEffect(() => {
|
|
9360
9425
|
if (openDrawerId === null) return;
|
|
9361
9426
|
const onKey = (e) => {
|
|
9362
9427
|
if (e.key === "Escape") setOpenDrawerId(null);
|
|
@@ -9364,7 +9429,7 @@ function usePresenceNotch(widgets) {
|
|
|
9364
9429
|
window.addEventListener("keydown", onKey);
|
|
9365
9430
|
return () => window.removeEventListener("keydown", onKey);
|
|
9366
9431
|
}, [openDrawerId]);
|
|
9367
|
-
|
|
9432
|
+
React35.useEffect(() => {
|
|
9368
9433
|
if (openDrawerId === null) return;
|
|
9369
9434
|
const onDown = (e) => {
|
|
9370
9435
|
const root = rootRef.current;
|
|
@@ -9376,8 +9441,8 @@ function usePresenceNotch(widgets) {
|
|
|
9376
9441
|
document.addEventListener("pointerdown", onDown);
|
|
9377
9442
|
return () => document.removeEventListener("pointerdown", onDown);
|
|
9378
9443
|
}, [openDrawerId]);
|
|
9379
|
-
const [active, setActive] =
|
|
9380
|
-
|
|
9444
|
+
const [active, setActive] = React35.useState(false);
|
|
9445
|
+
React35.useEffect(() => {
|
|
9381
9446
|
if (isRunning) {
|
|
9382
9447
|
setActive(true);
|
|
9383
9448
|
return;
|
|
@@ -9537,7 +9602,7 @@ function presenceFactShape(fact) {
|
|
|
9537
9602
|
}
|
|
9538
9603
|
|
|
9539
9604
|
// src/widgets/presence/use-optimistic-facts.ts
|
|
9540
|
-
import * as
|
|
9605
|
+
import * as React36 from "react";
|
|
9541
9606
|
function readEntries(data) {
|
|
9542
9607
|
if (typeof data !== "object" || data === null || !("entries" in data)) return [];
|
|
9543
9608
|
const raw = data.entries;
|
|
@@ -9556,7 +9621,7 @@ function writeOptimisticFact(entries3, fact) {
|
|
|
9556
9621
|
}
|
|
9557
9622
|
function useOptimisticFactOverlay(flowId) {
|
|
9558
9623
|
const entries3 = readEntries(useAgentFlow(flowId));
|
|
9559
|
-
return
|
|
9624
|
+
return React36.useMemo(
|
|
9560
9625
|
() => ({
|
|
9561
9626
|
entries: entries3,
|
|
9562
9627
|
add: (fact) => setFlowOutput(flowId, { entries: writeOptimisticFact(entries3, fact) })
|
|
@@ -9565,8 +9630,8 @@ function useOptimisticFactOverlay(flowId) {
|
|
|
9565
9630
|
);
|
|
9566
9631
|
}
|
|
9567
9632
|
function useReconcileOptimisticFacts(flowId, readIdentity) {
|
|
9568
|
-
const seenRef =
|
|
9569
|
-
|
|
9633
|
+
const seenRef = React36.useRef(null);
|
|
9634
|
+
React36.useEffect(() => {
|
|
9570
9635
|
if (readIdentity === null) return;
|
|
9571
9636
|
if (seenRef.current === null) {
|
|
9572
9637
|
seenRef.current = readIdentity;
|
|
@@ -9978,34 +10043,34 @@ __export(interaction_exports, {
|
|
|
9978
10043
|
});
|
|
9979
10044
|
|
|
9980
10045
|
// src/interaction/withInteractionTracking.tsx
|
|
9981
|
-
import
|
|
9982
|
-
import { jsx as
|
|
10046
|
+
import React37, { createContext as createContext24, useContext as useContext24 } from "react";
|
|
10047
|
+
import { jsx as jsx21, jsxs } from "react/jsx-runtime";
|
|
9983
10048
|
var InteractionContext = createContext24(null);
|
|
9984
10049
|
function InteractionProvider({
|
|
9985
10050
|
onInteraction,
|
|
9986
10051
|
children
|
|
9987
10052
|
}) {
|
|
9988
|
-
return /* @__PURE__ */
|
|
10053
|
+
return /* @__PURE__ */ jsx21(InteractionContext.Provider, { value: onInteraction, children });
|
|
9989
10054
|
}
|
|
9990
10055
|
function useInteraction2() {
|
|
9991
10056
|
return useContext24(InteractionContext);
|
|
9992
10057
|
}
|
|
9993
10058
|
function withInteractionTracking(WrappedComponent, meta) {
|
|
9994
10059
|
function TrackedComponent(props) {
|
|
9995
|
-
return /* @__PURE__ */
|
|
10060
|
+
return /* @__PURE__ */ jsx21(
|
|
9996
10061
|
"div",
|
|
9997
10062
|
{
|
|
9998
10063
|
"data-tracked-component": meta.componentId,
|
|
9999
10064
|
"data-tracked-component-type": meta.componentType,
|
|
10000
10065
|
style: { display: "contents" },
|
|
10001
|
-
children: /* @__PURE__ */
|
|
10066
|
+
children: /* @__PURE__ */ jsx21(ComponentErrorBoundary, { componentId: meta.componentId, children: /* @__PURE__ */ jsx21(WrappedComponent, { ...props }) })
|
|
10002
10067
|
}
|
|
10003
10068
|
);
|
|
10004
10069
|
}
|
|
10005
10070
|
TrackedComponent.displayName = `Tracked(${WrappedComponent.displayName || WrappedComponent.name || "Component"})`;
|
|
10006
10071
|
return TrackedComponent;
|
|
10007
10072
|
}
|
|
10008
|
-
var ComponentErrorBoundary = class extends
|
|
10073
|
+
var ComponentErrorBoundary = class extends React37.Component {
|
|
10009
10074
|
constructor() {
|
|
10010
10075
|
super(...arguments);
|
|
10011
10076
|
__publicField(this, "state", { error: null });
|
|
@@ -10019,7 +10084,7 @@ var ComponentErrorBoundary = class extends React36.Component {
|
|
|
10019
10084
|
render() {
|
|
10020
10085
|
if (this.state.error) {
|
|
10021
10086
|
return /* @__PURE__ */ jsxs("div", { className: "fourty-component-error", role: "alert", "data-component-id": this.props.componentId, children: [
|
|
10022
|
-
/* @__PURE__ */
|
|
10087
|
+
/* @__PURE__ */ jsx21("strong", { children: this.props.componentId }),
|
|
10023
10088
|
": ",
|
|
10024
10089
|
this.state.error.message
|
|
10025
10090
|
] });
|
|
@@ -10029,10 +10094,10 @@ var ComponentErrorBoundary = class extends React36.Component {
|
|
|
10029
10094
|
};
|
|
10030
10095
|
|
|
10031
10096
|
// src/interaction/normalize-signals.ts
|
|
10032
|
-
function normalizeSignals(
|
|
10097
|
+
function normalizeSignals(queued2, prompt) {
|
|
10033
10098
|
const latestLayoutUpdate = /* @__PURE__ */ new Map();
|
|
10034
10099
|
const rest = [];
|
|
10035
|
-
for (const signal of
|
|
10100
|
+
for (const signal of queued2) {
|
|
10036
10101
|
if (signal.type === "layout_update") {
|
|
10037
10102
|
latestLayoutUpdate.set(signal.type, signal);
|
|
10038
10103
|
} else {
|
|
@@ -10080,7 +10145,7 @@ import { useSyncExternalStore as useSyncExternalStore5 } from "react";
|
|
|
10080
10145
|
|
|
10081
10146
|
// src/utils/viewport-window.tsx
|
|
10082
10147
|
import { createContext as createContext25, useContext as useContext25 } from "react";
|
|
10083
|
-
import { jsx as
|
|
10148
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
10084
10149
|
var ViewportWindowContext = createContext25(null);
|
|
10085
10150
|
function canAnswer(win) {
|
|
10086
10151
|
return win !== null && typeof win.matchMedia === "function";
|
|
@@ -10095,7 +10160,7 @@ function ViewportWindowProvider({
|
|
|
10095
10160
|
value,
|
|
10096
10161
|
children
|
|
10097
10162
|
}) {
|
|
10098
|
-
return /* @__PURE__ */
|
|
10163
|
+
return /* @__PURE__ */ jsx22(ViewportWindowContext.Provider, { value, children });
|
|
10099
10164
|
}
|
|
10100
10165
|
|
|
10101
10166
|
// src/utils/use-form-factor.ts
|
|
@@ -10186,7 +10251,7 @@ function useInlineCompletion(opts) {
|
|
|
10186
10251
|
}
|
|
10187
10252
|
|
|
10188
10253
|
// src/utils/use-document-visible.ts
|
|
10189
|
-
import
|
|
10254
|
+
import React38 from "react";
|
|
10190
10255
|
function subscribe3(onChange) {
|
|
10191
10256
|
document.addEventListener("visibilitychange", onChange);
|
|
10192
10257
|
return () => document.removeEventListener("visibilitychange", onChange);
|
|
@@ -10198,15 +10263,15 @@ function getServerSnapshot() {
|
|
|
10198
10263
|
return true;
|
|
10199
10264
|
}
|
|
10200
10265
|
function useDocumentVisible() {
|
|
10201
|
-
return
|
|
10266
|
+
return React38.useSyncExternalStore(subscribe3, getSnapshot, getServerSnapshot);
|
|
10202
10267
|
}
|
|
10203
10268
|
|
|
10204
10269
|
// src/utils/use-interval.ts
|
|
10205
|
-
import
|
|
10270
|
+
import React39 from "react";
|
|
10206
10271
|
function useInterval(callback, ms, active = true) {
|
|
10207
|
-
const cbRef =
|
|
10272
|
+
const cbRef = React39.useRef(callback);
|
|
10208
10273
|
cbRef.current = callback;
|
|
10209
|
-
|
|
10274
|
+
React39.useEffect(() => {
|
|
10210
10275
|
if (!active) return;
|
|
10211
10276
|
const id = window.setInterval(() => cbRef.current(), ms);
|
|
10212
10277
|
return () => window.clearInterval(id);
|
|
@@ -10418,15 +10483,15 @@ function primedEntitiesFor(resolverKey) {
|
|
|
10418
10483
|
}
|
|
10419
10484
|
|
|
10420
10485
|
// src/preview/SpacefrontPreviewProvider.tsx
|
|
10421
|
-
import * as
|
|
10422
|
-
import { jsx as
|
|
10486
|
+
import * as React40 from "react";
|
|
10487
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
10423
10488
|
var NOOP = () => {
|
|
10424
10489
|
};
|
|
10425
10490
|
var ASYNC_NOOP = () => Promise.resolve();
|
|
10426
10491
|
var VIEW = { page: { kind: "home" }, layout: EMPTY_SPEC, shell: EMPTY_SHELL };
|
|
10427
|
-
var PreviewContext =
|
|
10492
|
+
var PreviewContext = React40.createContext(null);
|
|
10428
10493
|
function usePreview() {
|
|
10429
|
-
const value =
|
|
10494
|
+
const value = React40.useContext(PreviewContext);
|
|
10430
10495
|
if (value === null) throw new Error("preview runtime used outside <SpacefrontPreviewProvider>");
|
|
10431
10496
|
return value;
|
|
10432
10497
|
}
|
|
@@ -10580,27 +10645,27 @@ var PRESENCE = {
|
|
|
10580
10645
|
usePresenceLiveTurn: () => usePreview().pending?.messageId
|
|
10581
10646
|
};
|
|
10582
10647
|
function SpacefrontPreviewProvider({ scene, onSend, children }) {
|
|
10583
|
-
const [sessionId] =
|
|
10584
|
-
const derived =
|
|
10585
|
-
const onSendRef =
|
|
10648
|
+
const [sessionId] = React40.useState(() => `preview-${Math.random().toString(36).slice(2)}`);
|
|
10649
|
+
const derived = React40.useMemo(() => derive(scene, sessionId), [scene, sessionId]);
|
|
10650
|
+
const onSendRef = React40.useRef(onSend);
|
|
10586
10651
|
onSendRef.current = onSend;
|
|
10587
|
-
const draft =
|
|
10652
|
+
const draft = React40.useMemo(() => {
|
|
10588
10653
|
let text2 = "";
|
|
10589
|
-
const
|
|
10654
|
+
const listeners13 = /* @__PURE__ */ new Set();
|
|
10590
10655
|
return {
|
|
10591
10656
|
store: { subscribe: (fn) => {
|
|
10592
|
-
|
|
10657
|
+
listeners13.add(fn);
|
|
10593
10658
|
return () => {
|
|
10594
|
-
|
|
10659
|
+
listeners13.delete(fn);
|
|
10595
10660
|
};
|
|
10596
10661
|
}, get: () => text2 },
|
|
10597
10662
|
set: (next) => {
|
|
10598
10663
|
text2 = next;
|
|
10599
|
-
|
|
10664
|
+
listeners13.forEach((fn) => fn());
|
|
10600
10665
|
}
|
|
10601
10666
|
};
|
|
10602
10667
|
}, []);
|
|
10603
|
-
const session =
|
|
10668
|
+
const session = React40.useMemo(() => {
|
|
10604
10669
|
const send = (text2) => {
|
|
10605
10670
|
draft.set("");
|
|
10606
10671
|
onSendRef.current?.(text2);
|
|
@@ -10652,15 +10717,15 @@ function SpacefrontPreviewProvider({ scene, onSend, children }) {
|
|
|
10652
10717
|
const qId = question === null ? null : question.id;
|
|
10653
10718
|
const qText = question === null ? "" : question.text;
|
|
10654
10719
|
const qReplies = question === null ? "" : list(question.replies).join("\0");
|
|
10655
|
-
const raised =
|
|
10656
|
-
|
|
10720
|
+
const raised = React40.useRef(0);
|
|
10721
|
+
React40.useEffect(() => {
|
|
10657
10722
|
if (qId === null) return;
|
|
10658
10723
|
raised.current += 1;
|
|
10659
10724
|
const id = `${qId}-${raised.current}`;
|
|
10660
10725
|
raiseStanding(AGENT_ASK_SIGNAL, id, { ask: qText, suggestions: qReplies === "" ? [] : qReplies.split("\0") }, sessionId);
|
|
10661
10726
|
return () => resolveStanding(id, sessionId);
|
|
10662
10727
|
}, [qId, qText, qReplies, sessionId]);
|
|
10663
|
-
return /* @__PURE__ */
|
|
10728
|
+
return /* @__PURE__ */ jsx23(PreviewContext.Provider, { value: derived, children: /* @__PURE__ */ jsx23(FourtySessionContext.Provider, { value: session, children: /* @__PURE__ */ jsx23(FourtyRuntimeProvider, { value: RUNTIME, children: /* @__PURE__ */ jsx23(PresenceRuntimeProvider, { value: PRESENCE, children }) }) }) });
|
|
10664
10729
|
}
|
|
10665
10730
|
|
|
10666
10731
|
// src/verticals/commerce/index.ts
|
|
@@ -10695,12 +10760,14 @@ __export(commerce_exports, {
|
|
|
10695
10760
|
clearVariantChoice: () => clearVariantChoice,
|
|
10696
10761
|
closeCartDrawer: () => closeCartDrawer,
|
|
10697
10762
|
consumeArmedCheckoutHandoff: () => consumeArmedCheckoutHandoff,
|
|
10763
|
+
dequeueDiscountCode: () => dequeueDiscountCode,
|
|
10698
10764
|
disarmCheckoutHandoff: () => disarmCheckoutHandoff,
|
|
10699
10765
|
formatPrice: () => formatPrice,
|
|
10700
10766
|
formatProductPrice: () => formatProductPrice,
|
|
10701
10767
|
formatVariantValue: () => formatVariantValue,
|
|
10702
10768
|
getOptionSelections: () => getOptionSelections,
|
|
10703
10769
|
getVariantSelection: () => getVariantSelection,
|
|
10770
|
+
isDiscountCodeQueued: () => isDiscountCodeQueued,
|
|
10704
10771
|
isFunnelStep: () => isFunnelStep,
|
|
10705
10772
|
isOnSale: () => isOnSale,
|
|
10706
10773
|
isPendingCartLine: () => isPendingCartLine,
|
|
@@ -10714,8 +10781,10 @@ __export(commerce_exports, {
|
|
|
10714
10781
|
pickProductCardAction: () => pickProductCardAction,
|
|
10715
10782
|
preselectFromFacts: () => preselectFromFacts,
|
|
10716
10783
|
pruneFilterChips: () => pruneFilterChips,
|
|
10784
|
+
queueDiscountCode: () => queueDiscountCode,
|
|
10717
10785
|
readCartActionFailures: () => readCartActionFailures,
|
|
10718
10786
|
readCheckoutHandoff: () => readCheckoutHandoff,
|
|
10787
|
+
readQueuedDiscountCodes: () => readQueuedDiscountCodes,
|
|
10719
10788
|
recordCartActionFailure: () => recordCartActionFailure,
|
|
10720
10789
|
recordOptionSelections: () => recordOptionSelections,
|
|
10721
10790
|
recordVariantSelection: () => recordVariantSelection,
|
|
@@ -10726,6 +10795,7 @@ __export(commerce_exports, {
|
|
|
10726
10795
|
resolveSwatchColor: () => resolveSwatchColor,
|
|
10727
10796
|
settleArmedCheckoutHandoff: () => settleArmedCheckoutHandoff,
|
|
10728
10797
|
settledCart: () => settledCart,
|
|
10798
|
+
takeQueuedDiscountCodes: () => takeQueuedDiscountCodes,
|
|
10729
10799
|
toggleCartDrawer: () => toggleCartDrawer,
|
|
10730
10800
|
useAddToCart: () => useAddToCart,
|
|
10731
10801
|
useCart: () => useCart,
|
|
@@ -10750,12 +10820,14 @@ __export(commerce_exports, {
|
|
|
10750
10820
|
useProductGridFilter: () => useProductGridFilter,
|
|
10751
10821
|
useProductReviews: () => useProductReviews,
|
|
10752
10822
|
useProducts: () => useProducts,
|
|
10823
|
+
useQueuedDiscountCodes: () => useQueuedDiscountCodes,
|
|
10753
10824
|
useSafeCart: () => useSafeCart,
|
|
10754
10825
|
useToggleWishlist: () => useToggleWishlist,
|
|
10755
10826
|
useVariantSelections: () => useVariantSelections,
|
|
10756
10827
|
useWishlist: () => useWishlist,
|
|
10757
10828
|
useWishlistDrawer: () => useWishlistDrawer,
|
|
10758
|
-
variantForSelections: () => variantForSelections
|
|
10829
|
+
variantForSelections: () => variantForSelections,
|
|
10830
|
+
withQueuedDiscountCodes: () => withQueuedDiscountCodes
|
|
10759
10831
|
});
|
|
10760
10832
|
|
|
10761
10833
|
// src/verticals/commerce/chip-relevance.ts
|
|
@@ -11020,18 +11092,18 @@ __export(ecommerce_exports, {
|
|
|
11020
11092
|
});
|
|
11021
11093
|
|
|
11022
11094
|
// ../spacestation/src/analytics/ecommerce/surfacing.ts
|
|
11023
|
-
import { z as
|
|
11095
|
+
import { z as z50 } from "zod";
|
|
11024
11096
|
var PRODUCTS_SURFACED = defineEventKind(
|
|
11025
11097
|
"commerce.products_surfaced",
|
|
11026
11098
|
"client",
|
|
11027
|
-
|
|
11099
|
+
z50.object({
|
|
11028
11100
|
/** The turn whose commit this describes. Minted where the prompt signal
|
|
11029
11101
|
* is built and shared with `agent_runs`, so the read layer can line a
|
|
11030
11102
|
* surfacing up against the prompt that asked for it. */
|
|
11031
|
-
turnId:
|
|
11103
|
+
turnId: z50.string().min(1).max(128),
|
|
11032
11104
|
/** Distinct entity refs this turn placed that were not on the canvas
|
|
11033
11105
|
* before it. ZERO IS A REAL VALUE — see the header. */
|
|
11034
|
-
productCount:
|
|
11106
|
+
productCount: z50.number().int().nonnegative()
|
|
11035
11107
|
}).strict()
|
|
11036
11108
|
);
|
|
11037
11109
|
|
|
@@ -11611,20 +11683,77 @@ function useCartDrawer() {
|
|
|
11611
11683
|
}
|
|
11612
11684
|
|
|
11613
11685
|
// src/verticals/commerce/cart/use-cart-view.ts
|
|
11614
|
-
import
|
|
11686
|
+
import React41 from "react";
|
|
11687
|
+
|
|
11688
|
+
// src/verticals/commerce/cart/queued-discount-codes.ts
|
|
11689
|
+
import { useSyncExternalStore as useSyncExternalStore11 } from "react";
|
|
11690
|
+
var queued = [];
|
|
11691
|
+
var listeners11 = /* @__PURE__ */ new Set();
|
|
11692
|
+
function notify11() {
|
|
11693
|
+
for (const listener of listeners11) listener();
|
|
11694
|
+
}
|
|
11695
|
+
function withQueuedDiscountCodes(cartCodes, held) {
|
|
11696
|
+
const extra = held.filter((h) => !cartCodes.some((c) => sameCode(c.code, h)));
|
|
11697
|
+
return [...cartCodes, ...extra.map((code) => ({ code, applicable: true }))];
|
|
11698
|
+
}
|
|
11699
|
+
function isDiscountCodeQueued(code) {
|
|
11700
|
+
return queued.some((c) => sameCode(c, code));
|
|
11701
|
+
}
|
|
11702
|
+
function dequeueDiscountCode(code) {
|
|
11703
|
+
const kept = queued.filter((c) => !sameCode(c, code));
|
|
11704
|
+
if (kept.length === queued.length) return;
|
|
11705
|
+
queued = kept;
|
|
11706
|
+
notify11();
|
|
11707
|
+
}
|
|
11708
|
+
function sameCode(a, b) {
|
|
11709
|
+
return a.toUpperCase() === b.toUpperCase();
|
|
11710
|
+
}
|
|
11711
|
+
function queueDiscountCode(code) {
|
|
11712
|
+
if (queued.some((c) => sameCode(c, code))) return;
|
|
11713
|
+
queued = [...queued, code];
|
|
11714
|
+
notify11();
|
|
11715
|
+
}
|
|
11716
|
+
function takeQueuedDiscountCodes() {
|
|
11717
|
+
const taken = queued;
|
|
11718
|
+
if (taken.length === 0) return taken;
|
|
11719
|
+
queued = [];
|
|
11720
|
+
notify11();
|
|
11721
|
+
return taken;
|
|
11722
|
+
}
|
|
11723
|
+
function readQueuedDiscountCodes() {
|
|
11724
|
+
return queued;
|
|
11725
|
+
}
|
|
11726
|
+
function subscribe9(listener) {
|
|
11727
|
+
listeners11.add(listener);
|
|
11728
|
+
return () => {
|
|
11729
|
+
listeners11.delete(listener);
|
|
11730
|
+
};
|
|
11731
|
+
}
|
|
11732
|
+
var NONE = [];
|
|
11733
|
+
function useQueuedDiscountCodes() {
|
|
11734
|
+
return useSyncExternalStore11(subscribe9, readQueuedDiscountCodes, () => NONE);
|
|
11735
|
+
}
|
|
11736
|
+
registerSessionScopedClear(() => {
|
|
11737
|
+
if (queued.length === 0) return;
|
|
11738
|
+
queued = [];
|
|
11739
|
+
notify11();
|
|
11740
|
+
});
|
|
11741
|
+
|
|
11742
|
+
// src/verticals/commerce/cart/use-cart-view.ts
|
|
11615
11743
|
function useCartView(cart, onCheckout) {
|
|
11616
11744
|
const analytics = useOptionalAnalyticsSink();
|
|
11617
|
-
const [exitPending, setExitPending] =
|
|
11745
|
+
const [exitPending, setExitPending] = React41.useState(null);
|
|
11618
11746
|
const lines = cart === null ? [] : cart.lines;
|
|
11619
11747
|
const count = lines.reduce((sum, l) => sum + l.quantity, 0);
|
|
11620
11748
|
const totalsPending = lines.some((l) => isPendingCartLine(l));
|
|
11621
11749
|
const subtotal = cart === null ? 0 : cart.subtotal.amount;
|
|
11622
11750
|
const currency = cart === null ? "USD" : cart.subtotal.currencyCode;
|
|
11623
|
-
const
|
|
11751
|
+
const heldCodes = useQueuedDiscountCodes();
|
|
11752
|
+
const discountCodes = withQueuedDiscountCodes(cart === null ? [] : cart.discountCodes, heldCodes);
|
|
11624
11753
|
const backendTotal = cart !== null && cart.total !== void 0 ? cart.total.amount : void 0;
|
|
11625
11754
|
const discountAmount = backendTotal !== void 0 && backendTotal < subtotal ? subtotal - backendTotal : 0;
|
|
11626
11755
|
const effectiveTotal = backendTotal !== void 0 ? backendTotal : subtotal;
|
|
11627
|
-
const navigateToExit =
|
|
11756
|
+
const navigateToExit = React41.useCallback((url, kind) => {
|
|
11628
11757
|
const result = navigateToExternalCommerceUrl(url);
|
|
11629
11758
|
if (kind === "checkout") recordVisitorCheckoutExit(analytics, result);
|
|
11630
11759
|
if (result === "new-tab") {
|
|
@@ -11641,7 +11770,7 @@ function useCartView(cart, onCheckout) {
|
|
|
11641
11770
|
setExitPending(null);
|
|
11642
11771
|
}
|
|
11643
11772
|
}, [analytics]);
|
|
11644
|
-
const handleCheckout =
|
|
11773
|
+
const handleCheckout = React41.useCallback(() => {
|
|
11645
11774
|
if (lines.length === 0 || exitPending !== null) return;
|
|
11646
11775
|
setExitPending("checkout");
|
|
11647
11776
|
if (onCheckout) {
|
|
@@ -11661,7 +11790,7 @@ function useCartView(cart, onCheckout) {
|
|
|
11661
11790
|
}
|
|
11662
11791
|
navigateToExit(cart?.checkoutUrl, "checkout");
|
|
11663
11792
|
}, [lines.length, exitPending, onCheckout, cart, navigateToExit]);
|
|
11664
|
-
const handleGoToStore =
|
|
11793
|
+
const handleGoToStore = React41.useCallback(() => {
|
|
11665
11794
|
if (lines.length === 0 || exitPending !== null) return;
|
|
11666
11795
|
setExitPending("store");
|
|
11667
11796
|
navigateToExit(cart?.storeCartUrl, "store");
|
|
@@ -11685,13 +11814,13 @@ function useCartView(cart, onCheckout) {
|
|
|
11685
11814
|
}
|
|
11686
11815
|
|
|
11687
11816
|
// src/verticals/commerce/cart/cart-action-failures.ts
|
|
11688
|
-
import { useMemo as useMemo16, useSyncExternalStore as
|
|
11817
|
+
import { useMemo as useMemo16, useSyncExternalStore as useSyncExternalStore12 } from "react";
|
|
11689
11818
|
var FAILURE_TTL_MS = 2 * 6e4;
|
|
11690
11819
|
var FAILURE_CAP = 5;
|
|
11691
11820
|
var failures = [];
|
|
11692
|
-
var
|
|
11693
|
-
function
|
|
11694
|
-
for (const listener of
|
|
11821
|
+
var listeners12 = /* @__PURE__ */ new Set();
|
|
11822
|
+
function notify12() {
|
|
11823
|
+
for (const listener of listeners12) listener();
|
|
11695
11824
|
}
|
|
11696
11825
|
function pruneExpired(now) {
|
|
11697
11826
|
const kept = failures.filter((f) => now - f.at <= FAILURE_TTL_MS);
|
|
@@ -11709,13 +11838,13 @@ function recordCartActionFailure(action, subject, reason) {
|
|
|
11709
11838
|
pruneExpired(now);
|
|
11710
11839
|
const rest = failures.filter((f) => !(f.action === action && sameSubject(f, subject)));
|
|
11711
11840
|
failures = [...rest, { action, productId: subject.productId, code: subject.code, reason, at: now }].slice(-FAILURE_CAP);
|
|
11712
|
-
|
|
11841
|
+
notify12();
|
|
11713
11842
|
}
|
|
11714
11843
|
function clearCartActionFailures(subject) {
|
|
11715
11844
|
const kept = failures.filter((f) => !sameSubject(f, subject));
|
|
11716
11845
|
if (kept.length === failures.length) return;
|
|
11717
11846
|
failures = kept;
|
|
11718
|
-
|
|
11847
|
+
notify12();
|
|
11719
11848
|
}
|
|
11720
11849
|
function snapshot() {
|
|
11721
11850
|
return failures;
|
|
@@ -11724,15 +11853,15 @@ function readCartActionFailures() {
|
|
|
11724
11853
|
pruneExpired(Date.now());
|
|
11725
11854
|
return failures;
|
|
11726
11855
|
}
|
|
11727
|
-
function
|
|
11728
|
-
|
|
11856
|
+
function subscribe10(listener) {
|
|
11857
|
+
listeners12.add(listener);
|
|
11729
11858
|
return () => {
|
|
11730
|
-
|
|
11859
|
+
listeners12.delete(listener);
|
|
11731
11860
|
};
|
|
11732
11861
|
}
|
|
11733
11862
|
var NO_FAILURES = [];
|
|
11734
11863
|
function useCartActionFailures() {
|
|
11735
|
-
return
|
|
11864
|
+
return useSyncExternalStore12(subscribe10, snapshot, () => NO_FAILURES);
|
|
11736
11865
|
}
|
|
11737
11866
|
function useCartActionFailuresFor(productIdsInCart) {
|
|
11738
11867
|
const all = useCartActionFailures();
|
|
@@ -11745,11 +11874,11 @@ function useCartActionFailuresFor(productIdsInCart) {
|
|
|
11745
11874
|
registerSessionScopedClear(() => {
|
|
11746
11875
|
if (failures.length === 0) return;
|
|
11747
11876
|
failures = [];
|
|
11748
|
-
|
|
11877
|
+
notify12();
|
|
11749
11878
|
});
|
|
11750
11879
|
|
|
11751
11880
|
// src/verticals/commerce/cart/use-cart-line-row.ts
|
|
11752
|
-
import * as
|
|
11881
|
+
import * as React42 from "react";
|
|
11753
11882
|
|
|
11754
11883
|
// src/verticals/commerce/use-commerce-actions.ts
|
|
11755
11884
|
import { useCallback as useCallback22 } from "react";
|
|
@@ -11795,19 +11924,19 @@ var SPOTLIGHT_MAX_AGE_MS = 3e4;
|
|
|
11795
11924
|
function useCartLineRow(line, opts) {
|
|
11796
11925
|
const actions = useCommerceActions();
|
|
11797
11926
|
const drawerFocus = useCartDrawerFocus();
|
|
11798
|
-
const rowRef =
|
|
11927
|
+
const rowRef = React42.useRef(null);
|
|
11799
11928
|
const pending2 = isPendingCartLine(line);
|
|
11800
11929
|
const navigable = actions !== null && !pending2 && line.productId.length > 0;
|
|
11801
11930
|
const onNavigated = opts === void 0 ? void 0 : opts.onNavigated;
|
|
11802
|
-
const navigatedRef =
|
|
11931
|
+
const navigatedRef = React42.useRef(onNavigated);
|
|
11803
11932
|
navigatedRef.current = onNavigated;
|
|
11804
|
-
const navigate =
|
|
11933
|
+
const navigate = React42.useCallback(() => {
|
|
11805
11934
|
if (actions === null) return;
|
|
11806
11935
|
actions.navigateToProduct(line.productId, line.title);
|
|
11807
11936
|
const done = navigatedRef.current;
|
|
11808
11937
|
if (done !== void 0) done();
|
|
11809
11938
|
}, [actions, line.productId, line.title]);
|
|
11810
|
-
const interaction =
|
|
11939
|
+
const interaction = React42.useMemo(() => {
|
|
11811
11940
|
if (!navigable) return void 0;
|
|
11812
11941
|
return {
|
|
11813
11942
|
onClick: navigate,
|
|
@@ -11822,7 +11951,7 @@ function useCartLineRow(line, opts) {
|
|
|
11822
11951
|
};
|
|
11823
11952
|
}, [navigable, navigate]);
|
|
11824
11953
|
const spotlightKey = drawerFocus !== null && !pending2 && line.productId.length > 0 && drawerFocus.productId === line.productId && Date.now() - drawerFocus.at < SPOTLIGHT_MAX_AGE_MS ? drawerFocus.at : null;
|
|
11825
|
-
|
|
11954
|
+
React42.useEffect(() => {
|
|
11826
11955
|
if (spotlightKey === null) return;
|
|
11827
11956
|
const node = rowRef.current;
|
|
11828
11957
|
if (node === null) return;
|
|
@@ -11967,7 +12096,7 @@ function pickColorCount(product) {
|
|
|
11967
12096
|
}
|
|
11968
12097
|
|
|
11969
12098
|
// src/verticals/commerce/product/use-look-card.ts
|
|
11970
|
-
import * as
|
|
12099
|
+
import * as React43 from "react";
|
|
11971
12100
|
|
|
11972
12101
|
// src/verticals/commerce/variant/variant-option-axes.ts
|
|
11973
12102
|
function carriesValue(variant, name, value) {
|
|
@@ -12177,8 +12306,8 @@ function useLookCard({
|
|
|
12177
12306
|
const session = useFourtySession();
|
|
12178
12307
|
const addFlash = useSuccessFlash({ duration: 1200 });
|
|
12179
12308
|
const locale = useSpaceLocale();
|
|
12180
|
-
const [pending2, setPending] =
|
|
12181
|
-
const clean =
|
|
12309
|
+
const [pending2, setPending] = React43.useState(null);
|
|
12310
|
+
const clean = React43.useMemo(
|
|
12182
12311
|
() => (Array.isArray(products) ? products : []).filter(
|
|
12183
12312
|
(p) => p !== null && p !== void 0 && typeof p === "object"
|
|
12184
12313
|
),
|
|
@@ -12533,7 +12662,7 @@ function useContentActions() {
|
|
|
12533
12662
|
import { useEffect as useEffect19, useState as useState18 } from "react";
|
|
12534
12663
|
|
|
12535
12664
|
// package.json
|
|
12536
|
-
var version = "0.5.
|
|
12665
|
+
var version = "0.5.12";
|
|
12537
12666
|
|
|
12538
12667
|
// src/host/host-modules.ts
|
|
12539
12668
|
import * as react from "react";
|
|
@@ -12594,7 +12723,7 @@ function loadEngine(apiUrl) {
|
|
|
12594
12723
|
}
|
|
12595
12724
|
|
|
12596
12725
|
// src/host/Spacefront.tsx
|
|
12597
|
-
import { jsx as
|
|
12726
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
12598
12727
|
function Spacefront(props) {
|
|
12599
12728
|
const [engine, setEngine] = useState18(null);
|
|
12600
12729
|
const [failure, setFailure] = useState18(null);
|
|
@@ -12616,11 +12745,11 @@ function Spacefront(props) {
|
|
|
12616
12745
|
if (failure !== null) throw failure;
|
|
12617
12746
|
if (engine === null) return null;
|
|
12618
12747
|
const EngineRoot = engine.EngineRoot;
|
|
12619
|
-
return /* @__PURE__ */
|
|
12748
|
+
return /* @__PURE__ */ jsx24(EngineRoot, { ...props });
|
|
12620
12749
|
}
|
|
12621
12750
|
|
|
12622
12751
|
// src/npm.ts
|
|
12623
|
-
import { z as
|
|
12752
|
+
import { z as z52 } from "zod";
|
|
12624
12753
|
export {
|
|
12625
12754
|
ACQUISITION_KIND_LABELS,
|
|
12626
12755
|
ACTIVE_PANEL_ATTR,
|
|
@@ -12654,6 +12783,8 @@ export {
|
|
|
12654
12783
|
BRAND_MARK_MAX_BYTES,
|
|
12655
12784
|
BRAND_MARK_SLOTS,
|
|
12656
12785
|
BRAND_MARK_TYPES,
|
|
12786
|
+
BotCheckNoticeProvider,
|
|
12787
|
+
BotCheckNoticeSchema,
|
|
12657
12788
|
BrandMarkImageSchema,
|
|
12658
12789
|
BrandMarkSchema,
|
|
12659
12790
|
BugLocationSchema,
|
|
@@ -12688,6 +12819,7 @@ export {
|
|
|
12688
12819
|
CONSENT_DISPOSITION,
|
|
12689
12820
|
CONTAINER_TYPES,
|
|
12690
12821
|
CONTINUATION_ENABLED,
|
|
12822
|
+
CUSTOMER_ACCOUNT_SESSION_HEADER,
|
|
12691
12823
|
CanvasArrangementProvider,
|
|
12692
12824
|
CanvasMotionStyleProvider,
|
|
12693
12825
|
CanvasOutletProvider,
|
|
@@ -12830,6 +12962,8 @@ export {
|
|
|
12830
12962
|
SDK_VERSION_PATTERN,
|
|
12831
12963
|
SELECTION_ORIGIN_VISITOR,
|
|
12832
12964
|
SIGNAL_PATCH_PREFIX,
|
|
12965
|
+
SOCKET_BEARER_SUBPROTOCOL_PREFIX,
|
|
12966
|
+
SOCKET_SUBPROTOCOL,
|
|
12833
12967
|
SOCKET_TICKET_PARAM,
|
|
12834
12968
|
STRUCTURAL_BASELINE_CATALOG,
|
|
12835
12969
|
STRUCTURAL_BASELINE_TYPES,
|
|
@@ -12929,6 +13063,7 @@ export {
|
|
|
12929
13063
|
arrivalToParams,
|
|
12930
13064
|
attachmentFailureOfStatus,
|
|
12931
13065
|
bareComponentType,
|
|
13066
|
+
bearerFromSocketProtocols,
|
|
12932
13067
|
buildBaseAttributesConfig,
|
|
12933
13068
|
buildBucketLabelsConfig,
|
|
12934
13069
|
buildComparisonRows,
|
|
@@ -12980,6 +13115,7 @@ export {
|
|
|
12980
13115
|
createUnavailableProduct,
|
|
12981
13116
|
declaredSpaceLocaleOf,
|
|
12982
13117
|
defineEventKind,
|
|
13118
|
+
dequeueDiscountCode,
|
|
12983
13119
|
derivePropsDoc,
|
|
12984
13120
|
deriveSourceElement,
|
|
12985
13121
|
deriveTurnChangeAnchor,
|
|
@@ -13024,6 +13160,7 @@ export {
|
|
|
13024
13160
|
isActiveDirective,
|
|
13025
13161
|
isAllowedAttachmentType,
|
|
13026
13162
|
isDegenerateLayout,
|
|
13163
|
+
isDiscountCodeQueued,
|
|
13027
13164
|
isDraftSource,
|
|
13028
13165
|
isElementUnfilled,
|
|
13029
13166
|
isEmptyPropValue,
|
|
@@ -13079,6 +13216,7 @@ export {
|
|
|
13079
13216
|
prose,
|
|
13080
13217
|
pruneFilterChips,
|
|
13081
13218
|
publishClientState,
|
|
13219
|
+
queueDiscountCode,
|
|
13082
13220
|
raiseStanding,
|
|
13083
13221
|
readBaseAttributesConfig,
|
|
13084
13222
|
readBucketLabelsConfig,
|
|
@@ -13087,6 +13225,7 @@ export {
|
|
|
13087
13225
|
readHosting,
|
|
13088
13226
|
readOptionAxes,
|
|
13089
13227
|
readPdpCompanions,
|
|
13228
|
+
readQueuedDiscountCodes,
|
|
13090
13229
|
recordCartActionFailure,
|
|
13091
13230
|
recordOptionSelections,
|
|
13092
13231
|
recordVariantSelection,
|
|
@@ -13157,6 +13296,7 @@ export {
|
|
|
13157
13296
|
settleArmedCheckoutHandoff,
|
|
13158
13297
|
settledBlocks,
|
|
13159
13298
|
settledCart,
|
|
13299
|
+
socketProtocolsFor,
|
|
13160
13300
|
spaceLocaleOf,
|
|
13161
13301
|
splitAnswer,
|
|
13162
13302
|
splitSentences,
|
|
@@ -13167,6 +13307,7 @@ export {
|
|
|
13167
13307
|
subscribeServerState,
|
|
13168
13308
|
surfaceEmits,
|
|
13169
13309
|
surfaceSuppressionReason,
|
|
13310
|
+
takeQueuedDiscountCodes,
|
|
13170
13311
|
text,
|
|
13171
13312
|
textDirectionOf,
|
|
13172
13313
|
threadRowAttrs,
|
|
@@ -13188,6 +13329,7 @@ export {
|
|
|
13188
13329
|
useAgentPresenceFrame,
|
|
13189
13330
|
useAgentPresenceFresh,
|
|
13190
13331
|
useAnalyticsSink,
|
|
13332
|
+
useBotCheckNotice,
|
|
13191
13333
|
useCanvasActions,
|
|
13192
13334
|
useCanvasArrangement,
|
|
13193
13335
|
useCanvasBack,
|
|
@@ -13287,6 +13429,7 @@ export {
|
|
|
13287
13429
|
useProducts,
|
|
13288
13430
|
useProjection,
|
|
13289
13431
|
usePromptComposer,
|
|
13432
|
+
useQueuedDiscountCodes,
|
|
13290
13433
|
useReasoning,
|
|
13291
13434
|
useReconcileDismissed,
|
|
13292
13435
|
useReconcileFlowSet,
|
|
@@ -13337,6 +13480,7 @@ export {
|
|
|
13337
13480
|
wipeProfile,
|
|
13338
13481
|
withCartActorOrigin,
|
|
13339
13482
|
withInteractionTracking,
|
|
13483
|
+
withQueuedDiscountCodes,
|
|
13340
13484
|
withSignalTurn,
|
|
13341
|
-
|
|
13485
|
+
z52 as z
|
|
13342
13486
|
};
|