@40rty/ams-sdk 0.5.6 → 0.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +862 -693
- package/dist/types/ecommerce/src/code-discounts.d.ts +47 -0
- package/dist/types/ecommerce/src/commerce-schemas.d.ts +16 -6
- package/dist/types/ecommerce/src/index.d.ts +1 -0
- package/dist/types/sdk/src/canvas/hydration-notice.d.ts +23 -0
- package/dist/types/sdk/src/canvas/index.d.ts +1 -0
- package/dist/types/sdk/src/host/host-modules.d.ts +42 -14
- package/dist/types/sdk/src/session/index.d.ts +2 -1
- package/dist/types/sdk/src/session/space-locale-context.d.ts +10 -0
- package/dist/types/sdk/src/session/visitor-locale.d.ts +15 -0
- package/dist/types/sdk/src/shell/composer-attachments/use-composer-attachments.d.ts +4 -3
- package/dist/types/sdk/src/verticals/commerce/comparison/comparison-rows.d.ts +11 -2
- package/dist/types/sdk/src/verticals/commerce/index.d.ts +1 -1
- package/dist/types/sdk/src/verticals/commerce/price/format-price.d.ts +3 -2
- package/dist/types/spacestation/src/attachment/attachment-failure.d.ts +32 -0
- package/dist/types/spacestation/src/contracts/tools/execution-context.d.ts +11 -0
- package/dist/types/spacestation/src/index.d.ts +4 -1
- package/dist/types/spacestation/src/signal/agent-signals.d.ts +31 -0
- package/dist/types/spacestation/src/space/session-queue.d.ts +8 -8
- package/dist/types/spacestation/src/space/space-config.d.ts +4 -0
- package/dist/types/spacestation/src/space/space-locale.d.ts +46 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -34,6 +34,7 @@ __export(src_exports3, {
|
|
|
34
34
|
AssetSchema: () => AssetSchema,
|
|
35
35
|
AttachmentRefSchema: () => AttachmentRefSchema,
|
|
36
36
|
AttachmentRefsSchema: () => AttachmentRefsSchema,
|
|
37
|
+
AttachmentUploadError: () => AttachmentUploadError,
|
|
37
38
|
AttributeDefSchema: () => AttributeDefSchema,
|
|
38
39
|
AttributeScopeBucketSchema: () => AttributeScopeBucketSchema,
|
|
39
40
|
AttributeScopeConfigSchema: () => AttributeScopeConfigSchema,
|
|
@@ -101,6 +102,7 @@ __export(src_exports3, {
|
|
|
101
102
|
DEFAULT_HOSTING: () => DEFAULT_HOSTING,
|
|
102
103
|
DEFAULT_PRESENCE_PROFILE: () => DEFAULT_PRESENCE_PROFILE,
|
|
103
104
|
DEFAULT_SPACE_CONFIG: () => DEFAULT_SPACE_CONFIG,
|
|
105
|
+
DEFAULT_SPACE_LOCALE: () => DEFAULT_SPACE_LOCALE,
|
|
104
106
|
DEFAULT_VISITOR_ACCESS: () => DEFAULT_VISITOR_ACCESS,
|
|
105
107
|
DIRECTION_FLOW: () => DIRECTION_FLOW,
|
|
106
108
|
DROP_REASONS: () => DROP_REASONS,
|
|
@@ -141,6 +143,7 @@ __export(src_exports3, {
|
|
|
141
143
|
HandlerRegistryContext: () => HandlerRegistryContext,
|
|
142
144
|
HostClearedSchema: () => HostClearedSchema,
|
|
143
145
|
HostPayloadSchema: () => HostPayloadSchema,
|
|
146
|
+
HydrationNoticeProvider: () => HydrationNoticeProvider,
|
|
144
147
|
HydrationStateContext: () => HydrationStateContext,
|
|
145
148
|
HydratorProvider: () => HydratorProvider,
|
|
146
149
|
INITIAL_NAV_PRESENTATION: () => INITIAL_NAV_PRESENTATION,
|
|
@@ -157,6 +160,7 @@ __export(src_exports3, {
|
|
|
157
160
|
LlmUsageDailySchema: () => LlmUsageDailySchema,
|
|
158
161
|
MAX_ACTIVE_AGENT_DIRECTIVES: () => MAX_ACTIVE_AGENT_DIRECTIVES,
|
|
159
162
|
MAX_ATTACHMENT_BYTES: () => MAX_ATTACHMENT_BYTES,
|
|
163
|
+
MAX_ATTACHMENT_MB: () => MAX_ATTACHMENT_MB,
|
|
160
164
|
MAX_VISITOR_PROMPT_CHARS: () => MAX_VISITOR_PROMPT_CHARS,
|
|
161
165
|
MIN_WIRE_PROTOCOL_VERSION: () => MIN_WIRE_PROTOCOL_VERSION,
|
|
162
166
|
MOBILE_VIEWPORT_MAX: () => MOBILE_VIEWPORT_MAX,
|
|
@@ -211,6 +215,7 @@ __export(src_exports3, {
|
|
|
211
215
|
SOCKET_TICKET_PARAM: () => SOCKET_TICKET_PARAM,
|
|
212
216
|
STRUCTURAL_BASELINE_CATALOG: () => STRUCTURAL_BASELINE_CATALOG,
|
|
213
217
|
STRUCTURAL_BASELINE_TYPES: () => STRUCTURAL_BASELINE_TYPES,
|
|
218
|
+
SUPPORTED_SPACE_LOCALES: () => SUPPORTED_SPACE_LOCALES,
|
|
214
219
|
SURFACES: () => SURFACES,
|
|
215
220
|
SURFACE_DISPOSITION: () => SURFACE_DISPOSITION,
|
|
216
221
|
ScrollContainerProvider: () => ScrollContainerProvider,
|
|
@@ -243,6 +248,8 @@ __export(src_exports3, {
|
|
|
243
248
|
SpaceAgentDirectiveSchema: () => SpaceAgentDirectiveSchema,
|
|
244
249
|
SpaceBrandMarkSchema: () => SpaceBrandMarkSchema,
|
|
245
250
|
SpaceBugSchema: () => SpaceBugSchema,
|
|
251
|
+
SpaceLocaleProvider: () => SpaceLocaleProvider,
|
|
252
|
+
SpaceLocaleSchema: () => SpaceLocaleSchema,
|
|
246
253
|
SpacefrontCanvas: () => SpacefrontCanvas,
|
|
247
254
|
SpacefrontPreviewProvider: () => SpacefrontPreviewProvider,
|
|
248
255
|
SpecSchema: () => SpecSchema,
|
|
@@ -300,6 +307,7 @@ __export(src_exports3, {
|
|
|
300
307
|
arraysEqual: () => arraysEqual,
|
|
301
308
|
arrivalFromParams: () => arrivalFromParams,
|
|
302
309
|
arrivalToParams: () => arrivalToParams,
|
|
310
|
+
attachmentFailureOfStatus: () => attachmentFailureOfStatus,
|
|
303
311
|
bareComponentType: () => bareComponentType,
|
|
304
312
|
buildBaseAttributesConfig: () => buildBaseAttributesConfig,
|
|
305
313
|
buildBucketLabelsConfig: () => buildBucketLabelsConfig,
|
|
@@ -324,6 +332,7 @@ __export(src_exports3, {
|
|
|
324
332
|
classifyItemChange: () => classifyItemChange,
|
|
325
333
|
clearAgentPresence: () => clearAgentPresence,
|
|
326
334
|
clearCartActionFailures: () => clearCartActionFailures,
|
|
335
|
+
clearCodeDiscountSources: () => clearCodeDiscountSources,
|
|
327
336
|
clearProductNameLookups: () => clearProductNameLookups,
|
|
328
337
|
clearVariantChoice: () => clearVariantChoice,
|
|
329
338
|
clientStateEntries: () => clientStateEntries,
|
|
@@ -333,6 +342,7 @@ __export(src_exports3, {
|
|
|
333
342
|
collectLayoutGids: () => collectLayoutGids,
|
|
334
343
|
collectPlacedEntityRefs: () => collectPlacedEntityRefs,
|
|
335
344
|
colorHexOf: () => colorHexOf,
|
|
345
|
+
commerceLocaleOf: () => commerceLocaleOf,
|
|
336
346
|
compareSdkVersions: () => compareSdkVersions,
|
|
337
347
|
compressArray: () => compressArray,
|
|
338
348
|
compressString: () => compressString,
|
|
@@ -347,6 +357,7 @@ __export(src_exports3, {
|
|
|
347
357
|
createSessionStorageAdapter: () => createSessionStorageAdapter,
|
|
348
358
|
createTokenOverlapScorer: () => createTokenOverlapScorer,
|
|
349
359
|
createUnavailableProduct: () => createUnavailableProduct,
|
|
360
|
+
declaredSpaceLocaleOf: () => declaredSpaceLocaleOf,
|
|
350
361
|
defineEventKind: () => defineEventKind,
|
|
351
362
|
derivePropsDoc: () => derivePropsDoc,
|
|
352
363
|
deriveSourceElement: () => deriveSourceElement,
|
|
@@ -405,6 +416,8 @@ __export(src_exports3, {
|
|
|
405
416
|
isPresenceStreamArtifact: () => isPresenceStreamArtifact,
|
|
406
417
|
isReservedId: () => isReservedId,
|
|
407
418
|
isVideoUrl: () => isVideoUrl,
|
|
419
|
+
languageNameOf: () => languageNameOf,
|
|
420
|
+
languageOf: () => languageOf,
|
|
408
421
|
layoutTopWithin: () => layoutTopWithin,
|
|
409
422
|
listRegisteredPlatforms: () => listRegisteredPlatforms,
|
|
410
423
|
listRegisteredServices: () => listRegisteredServices,
|
|
@@ -457,6 +470,7 @@ __export(src_exports3, {
|
|
|
457
470
|
reducePatch: () => reducePatch,
|
|
458
471
|
refuseCheckoutHandoff: () => refuseCheckoutHandoff,
|
|
459
472
|
registerChipRelevanceRule: () => registerChipRelevanceRule,
|
|
473
|
+
registerCodeDiscountSource: () => registerCodeDiscountSource,
|
|
460
474
|
registerComponent: () => registerComponent,
|
|
461
475
|
registerEntityPageKind: () => registerEntityPageKind,
|
|
462
476
|
registerExclusiveOverlay: () => registerExclusiveOverlay,
|
|
@@ -481,6 +495,7 @@ __export(src_exports3, {
|
|
|
481
495
|
requestVariantChoice: () => requestVariantChoice,
|
|
482
496
|
requiredTopLevelProps: () => requiredTopLevelProps,
|
|
483
497
|
resetServerState: () => resetServerState,
|
|
498
|
+
resolveCodeDiscountSource: () => resolveCodeDiscountSource,
|
|
484
499
|
resolveHydrators: () => resolveHydrators,
|
|
485
500
|
resolvePresenceFactForm: () => resolvePresenceFactForm,
|
|
486
501
|
resolvePresenceForm: () => resolvePresenceForm,
|
|
@@ -516,6 +531,7 @@ __export(src_exports3, {
|
|
|
516
531
|
settleArmedCheckoutHandoff: () => settleArmedCheckoutHandoff,
|
|
517
532
|
settledBlocks: () => settledBlocks,
|
|
518
533
|
settledCart: () => settledCart,
|
|
534
|
+
spaceLocaleOf: () => spaceLocaleOf,
|
|
519
535
|
splitAnswer: () => splitAnswer,
|
|
520
536
|
splitSentences: () => splitSentences,
|
|
521
537
|
stateSnapshotSignal: () => stateSnapshotSignal,
|
|
@@ -526,6 +542,7 @@ __export(src_exports3, {
|
|
|
526
542
|
surfaceEmits: () => surfaceEmits,
|
|
527
543
|
surfaceSuppressionReason: () => surfaceSuppressionReason,
|
|
528
544
|
text: () => text,
|
|
545
|
+
textDirectionOf: () => textDirectionOf,
|
|
529
546
|
threadRowAttrs: () => threadRowAttrs,
|
|
530
547
|
toggleCartDrawer: () => toggleCartDrawer,
|
|
531
548
|
token: () => token,
|
|
@@ -606,6 +623,7 @@ __export(src_exports3, {
|
|
|
606
623
|
useHasLeftSeedHome: () => useHasLeftSeedHome,
|
|
607
624
|
useHistoryNav: () => useHistoryNav,
|
|
608
625
|
useHydrated: () => useHydrated,
|
|
626
|
+
useHydrationNotice: () => useHydrationNotice,
|
|
609
627
|
useHydrationState: () => useHydrationState,
|
|
610
628
|
useHydrators: () => useHydrators,
|
|
611
629
|
useInlineCompletion: () => useInlineCompletion,
|
|
@@ -660,10 +678,12 @@ __export(src_exports3, {
|
|
|
660
678
|
useSessionState: () => useSessionState,
|
|
661
679
|
useShellRegistry: () => useShellRegistry,
|
|
662
680
|
useShellRoot: () => useShellRoot,
|
|
681
|
+
useSpaceLocale: () => useSpaceLocale,
|
|
663
682
|
useStandingOfType: () => useStandingOfType,
|
|
664
683
|
useStream: () => useStream,
|
|
665
684
|
useSuccessFlash: () => useSuccessFlash,
|
|
666
685
|
useSuggestionsWithDefaults: () => useSuggestionsWithDefaults,
|
|
686
|
+
useTextDirection: () => useTextDirection,
|
|
667
687
|
useThreadJumpMarks: () => useThreadJumpMarks,
|
|
668
688
|
useThreadLanding: () => useThreadLanding,
|
|
669
689
|
useThreadRows: () => useThreadRows,
|
|
@@ -1438,6 +1458,8 @@ function useOptionalAnalyticsSink() {
|
|
|
1438
1458
|
var session_exports = {};
|
|
1439
1459
|
__export(session_exports, {
|
|
1440
1460
|
FourtySessionContext: () => FourtySessionContext,
|
|
1461
|
+
SpaceLocaleProvider: () => SpaceLocaleProvider,
|
|
1462
|
+
commerceLocaleOf: () => commerceLocaleOf,
|
|
1441
1463
|
getVisitorLocale: () => getVisitorLocale,
|
|
1442
1464
|
registerSessionScopedClear: () => registerSessionScopedClear,
|
|
1443
1465
|
runSessionScopedClearHandlers: () => runSessionScopedClearHandlers,
|
|
@@ -1445,6 +1467,8 @@ __export(session_exports, {
|
|
|
1445
1467
|
useComposerDraft: () => useComposerDraft,
|
|
1446
1468
|
useFourtySession: () => useFourtySession,
|
|
1447
1469
|
useOptionalFourtySession: () => useOptionalFourtySession,
|
|
1470
|
+
useSpaceLocale: () => useSpaceLocale,
|
|
1471
|
+
useTextDirection: () => useTextDirection,
|
|
1448
1472
|
withSignalTurn: () => withSignalTurn
|
|
1449
1473
|
});
|
|
1450
1474
|
|
|
@@ -1470,6 +1494,7 @@ __export(src_exports, {
|
|
|
1470
1494
|
AgentSignalSchema: () => AgentSignalSchema,
|
|
1471
1495
|
AttachmentRefSchema: () => AttachmentRefSchema,
|
|
1472
1496
|
AttachmentRefsSchema: () => AttachmentRefsSchema,
|
|
1497
|
+
AttachmentUploadError: () => AttachmentUploadError,
|
|
1473
1498
|
AttributeDefSchema: () => AttributeDefSchema,
|
|
1474
1499
|
AttributeScopeBucketSchema: () => AttributeScopeBucketSchema,
|
|
1475
1500
|
AttributeScopeConfigSchema: () => AttributeScopeConfigSchema,
|
|
@@ -1504,6 +1529,7 @@ __export(src_exports, {
|
|
|
1504
1529
|
CreateTraceInputSchema: () => CreateTraceInputSchema,
|
|
1505
1530
|
DEFAULT_HOSTING: () => DEFAULT_HOSTING,
|
|
1506
1531
|
DEFAULT_SPACE_CONFIG: () => DEFAULT_SPACE_CONFIG,
|
|
1532
|
+
DEFAULT_SPACE_LOCALE: () => DEFAULT_SPACE_LOCALE,
|
|
1507
1533
|
DEFAULT_VISITOR_ACCESS: () => DEFAULT_VISITOR_ACCESS,
|
|
1508
1534
|
DIRECTION_FLOW: () => DIRECTION_FLOW,
|
|
1509
1535
|
DirectiveValueSchema: () => DirectiveValueSchema,
|
|
@@ -1535,6 +1561,7 @@ __export(src_exports, {
|
|
|
1535
1561
|
LlmUsageDailySchema: () => LlmUsageDailySchema,
|
|
1536
1562
|
MAX_ACTIVE_AGENT_DIRECTIVES: () => MAX_ACTIVE_AGENT_DIRECTIVES,
|
|
1537
1563
|
MAX_ATTACHMENT_BYTES: () => MAX_ATTACHMENT_BYTES,
|
|
1564
|
+
MAX_ATTACHMENT_MB: () => MAX_ATTACHMENT_MB,
|
|
1538
1565
|
MAX_VISITOR_PROMPT_CHARS: () => MAX_VISITOR_PROMPT_CHARS,
|
|
1539
1566
|
MIN_WIRE_PROTOCOL_VERSION: () => MIN_WIRE_PROTOCOL_VERSION,
|
|
1540
1567
|
MOBILE_VIEWPORT_MAX: () => MOBILE_VIEWPORT_MAX,
|
|
@@ -1568,6 +1595,7 @@ __export(src_exports, {
|
|
|
1568
1595
|
SOCKET_TICKET_PARAM: () => SOCKET_TICKET_PARAM,
|
|
1569
1596
|
STRUCTURAL_BASELINE_CATALOG: () => STRUCTURAL_BASELINE_CATALOG,
|
|
1570
1597
|
STRUCTURAL_BASELINE_TYPES: () => STRUCTURAL_BASELINE_TYPES,
|
|
1598
|
+
SUPPORTED_SPACE_LOCALES: () => SUPPORTED_SPACE_LOCALES,
|
|
1571
1599
|
SURFACES: () => SURFACES,
|
|
1572
1600
|
SdkVersionSchema: () => SdkVersionSchema,
|
|
1573
1601
|
SessionActivityEventSchema: () => SessionActivityEventSchema,
|
|
@@ -1593,6 +1621,7 @@ __export(src_exports, {
|
|
|
1593
1621
|
SpaceAgentDirectiveSchema: () => SpaceAgentDirectiveSchema,
|
|
1594
1622
|
SpaceBrandMarkSchema: () => SpaceBrandMarkSchema,
|
|
1595
1623
|
SpaceBugSchema: () => SpaceBugSchema,
|
|
1624
|
+
SpaceLocaleSchema: () => SpaceLocaleSchema,
|
|
1596
1625
|
SpecSchema: () => SpecSchema,
|
|
1597
1626
|
StateSnapshotFrameSchema: () => StateSnapshotFrameSchema,
|
|
1598
1627
|
SuggestionActionSchema: () => SuggestionActionSchema,
|
|
@@ -1634,6 +1663,7 @@ __export(src_exports, {
|
|
|
1634
1663
|
applySinglePatch: () => applySinglePatch,
|
|
1635
1664
|
arrivalFromParams: () => arrivalFromParams,
|
|
1636
1665
|
arrivalToParams: () => arrivalToParams,
|
|
1666
|
+
attachmentFailureOfStatus: () => attachmentFailureOfStatus,
|
|
1637
1667
|
bareComponentType: () => bareComponentType,
|
|
1638
1668
|
canonicalOptionValue: () => canonicalOptionValue,
|
|
1639
1669
|
carriesShapeToken: () => carriesShapeToken,
|
|
@@ -1645,6 +1675,7 @@ __export(src_exports, {
|
|
|
1645
1675
|
compressArray: () => compressArray,
|
|
1646
1676
|
compressString: () => compressString,
|
|
1647
1677
|
createTokenOverlapScorer: () => createTokenOverlapScorer,
|
|
1678
|
+
declaredSpaceLocaleOf: () => declaredSpaceLocaleOf,
|
|
1648
1679
|
derivePropsDoc: () => derivePropsDoc,
|
|
1649
1680
|
derivedSourceFilled: () => derivedSourceFilled,
|
|
1650
1681
|
diffLayouts: () => diffLayouts,
|
|
@@ -1668,6 +1699,8 @@ __export(src_exports, {
|
|
|
1668
1699
|
isLateBound: () => isLateBound,
|
|
1669
1700
|
isOptionalTopLevelProp: () => isOptionalTopLevelProp,
|
|
1670
1701
|
isReservedId: () => isReservedId,
|
|
1702
|
+
languageNameOf: () => languageNameOf,
|
|
1703
|
+
languageOf: () => languageOf,
|
|
1671
1704
|
namespaceFromSnapshotSignal: () => namespaceFromSnapshotSignal,
|
|
1672
1705
|
normalizeAttributeField: () => normalizeAttributeField,
|
|
1673
1706
|
normalizeRefs: () => normalizeRefs,
|
|
@@ -1699,9 +1732,11 @@ __export(src_exports, {
|
|
|
1699
1732
|
sdkShimsFor: () => sdkShimsFor,
|
|
1700
1733
|
sdkWindowProblem: () => sdkWindowProblem,
|
|
1701
1734
|
settledBlocks: () => settledBlocks,
|
|
1735
|
+
spaceLocaleOf: () => spaceLocaleOf,
|
|
1702
1736
|
splitSentences: () => splitSentences,
|
|
1703
1737
|
stateSnapshotSignal: () => stateSnapshotSignal,
|
|
1704
1738
|
statedValueVerdict: () => statedValueVerdict,
|
|
1739
|
+
textDirectionOf: () => textDirectionOf,
|
|
1705
1740
|
tokenize: () => tokenize,
|
|
1706
1741
|
turnAskAnswers: () => turnAskAnswers,
|
|
1707
1742
|
turnAskFromSignal: () => turnAskFromSignal,
|
|
@@ -3734,6 +3769,22 @@ var AttachmentRefSchema = z33.object({
|
|
|
3734
3769
|
});
|
|
3735
3770
|
var AttachmentRefsSchema = z33.array(AttachmentRefSchema);
|
|
3736
3771
|
|
|
3772
|
+
// ../spacestation/src/attachment/attachment-failure.ts
|
|
3773
|
+
var MAX_ATTACHMENT_MB = Math.round(MAX_ATTACHMENT_BYTES / (1024 * 1024));
|
|
3774
|
+
var AttachmentUploadError = class extends Error {
|
|
3775
|
+
constructor(failure, detail) {
|
|
3776
|
+
super(detail);
|
|
3777
|
+
this.failure = failure;
|
|
3778
|
+
this.name = "AttachmentUploadError";
|
|
3779
|
+
}
|
|
3780
|
+
};
|
|
3781
|
+
function attachmentFailureOfStatus(status, mimeType) {
|
|
3782
|
+
if (status === 400) return { kind: "empty" };
|
|
3783
|
+
if (status === 413) return { kind: "too_large", maxMb: MAX_ATTACHMENT_MB };
|
|
3784
|
+
if (status === 415) return { kind: "unsupported_type", mimeType };
|
|
3785
|
+
return { kind: "upload_failed" };
|
|
3786
|
+
}
|
|
3787
|
+
|
|
3737
3788
|
// ../spacestation/src/contracts/entry-context.ts
|
|
3738
3789
|
import { z as z34 } from "zod";
|
|
3739
3790
|
var ENTRY_CONTEXT_MAX_VALUE_CHARS = 200;
|
|
@@ -3987,6 +4038,45 @@ var UpdateAgentDirectiveInputSchema = z37.object({
|
|
|
3987
4038
|
}).strict();
|
|
3988
4039
|
var ReorderAgentDirectivesInputSchema = z37.object({ ids: z37.array(z37.string()).min(1) }).strict();
|
|
3989
4040
|
|
|
4041
|
+
// ../spacestation/src/space/space-locale.ts
|
|
4042
|
+
import { z as z38 } from "zod";
|
|
4043
|
+
var DEFAULT_SPACE_LOCALE = "en-US";
|
|
4044
|
+
function isBcp47(tag) {
|
|
4045
|
+
try {
|
|
4046
|
+
return new Intl.Locale(tag).language.length > 0;
|
|
4047
|
+
} catch (err) {
|
|
4048
|
+
if (err instanceof RangeError) return false;
|
|
4049
|
+
throw err;
|
|
4050
|
+
}
|
|
4051
|
+
}
|
|
4052
|
+
var SpaceLocaleSchema = z38.string().refine(isBcp47, { message: "locale must be a BCP 47 language tag, e.g. he-IL" });
|
|
4053
|
+
var RTL_SCRIPTS = /* @__PURE__ */ new Set(["Arab", "Hebr", "Thaa", "Syrc", "Nkoo", "Adlm", "Rohg", "Mand", "Samr"]);
|
|
4054
|
+
var RTL_LANGUAGES = /* @__PURE__ */ new Set(["ar", "he", "iw", "fa", "ur", "ps", "sd", "ug", "yi", "dv", "ckb", "syr"]);
|
|
4055
|
+
function textDirectionOf(locale) {
|
|
4056
|
+
const parsed = new Intl.Locale(locale);
|
|
4057
|
+
if (parsed.script !== void 0) return RTL_SCRIPTS.has(parsed.script) ? "rtl" : "ltr";
|
|
4058
|
+
return RTL_LANGUAGES.has(parsed.language) ? "rtl" : "ltr";
|
|
4059
|
+
}
|
|
4060
|
+
function languageOf(locale) {
|
|
4061
|
+
return new Intl.Locale(locale).language;
|
|
4062
|
+
}
|
|
4063
|
+
function languageNameOf(locale) {
|
|
4064
|
+
const name = new Intl.DisplayNames(["en"], { type: "language" }).of(languageOf(locale));
|
|
4065
|
+
if (name === void 0) throw new Error(`no display name for locale ${locale}`);
|
|
4066
|
+
return name;
|
|
4067
|
+
}
|
|
4068
|
+
var SUPPORTED_SPACE_LOCALES = ["en-US", "he-IL"];
|
|
4069
|
+
function declaredSpaceLocaleOf(config) {
|
|
4070
|
+
if (config === null || config === void 0) return void 0;
|
|
4071
|
+
const raw = config.locale;
|
|
4072
|
+
if (raw === void 0) return void 0;
|
|
4073
|
+
return SpaceLocaleSchema.parse(raw);
|
|
4074
|
+
}
|
|
4075
|
+
function spaceLocaleOf(config) {
|
|
4076
|
+
const declared = declaredSpaceLocaleOf(config);
|
|
4077
|
+
return declared === void 0 ? DEFAULT_SPACE_LOCALE : declared;
|
|
4078
|
+
}
|
|
4079
|
+
|
|
3990
4080
|
// ../spacestation/src/space/workspace-catalog.ts
|
|
3991
4081
|
var COMPONENT_SOURCE = {
|
|
3992
4082
|
ui: "@fourty/ui"
|
|
@@ -4049,30 +4139,30 @@ function hostingAllows(hosting, surface) {
|
|
|
4049
4139
|
}
|
|
4050
4140
|
|
|
4051
4141
|
// ../spacestation/src/space/trace.ts
|
|
4052
|
-
import { z as
|
|
4053
|
-
var RunTokenUsageSchema =
|
|
4054
|
-
input_tokens:
|
|
4055
|
-
output_tokens:
|
|
4056
|
-
cache_read_tokens:
|
|
4142
|
+
import { z as z39 } from "zod";
|
|
4143
|
+
var RunTokenUsageSchema = z39.object({
|
|
4144
|
+
input_tokens: z39.number().optional(),
|
|
4145
|
+
output_tokens: z39.number().optional(),
|
|
4146
|
+
cache_read_tokens: z39.number().optional()
|
|
4057
4147
|
});
|
|
4058
|
-
var TraceRecordSchema =
|
|
4059
|
-
id:
|
|
4060
|
-
spaceId:
|
|
4061
|
-
sessionId:
|
|
4148
|
+
var TraceRecordSchema = z39.object({
|
|
4149
|
+
id: z39.string().uuid(),
|
|
4150
|
+
spaceId: z39.string().uuid().nullable(),
|
|
4151
|
+
sessionId: z39.string(),
|
|
4062
4152
|
/** OTP-verified visitor email the session was unlocked with, or `null`
|
|
4063
4153
|
* for an unlocked space / anonymous unlock. */
|
|
4064
|
-
visitorEmail:
|
|
4065
|
-
userPrompt:
|
|
4066
|
-
branch:
|
|
4067
|
-
responseText:
|
|
4068
|
-
layout:
|
|
4069
|
-
phaseTimings:
|
|
4070
|
-
tokensByModel:
|
|
4071
|
-
toolCalls:
|
|
4072
|
-
diagnostics:
|
|
4073
|
-
latencyFirstText:
|
|
4074
|
-
latencyFirstPatch:
|
|
4075
|
-
latencyTotal:
|
|
4154
|
+
visitorEmail: z39.string().nullable(),
|
|
4155
|
+
userPrompt: z39.string(),
|
|
4156
|
+
branch: z39.string().nullable(),
|
|
4157
|
+
responseText: z39.string().nullable(),
|
|
4158
|
+
layout: z39.unknown().nullable(),
|
|
4159
|
+
phaseTimings: z39.record(z39.number()).nullable(),
|
|
4160
|
+
tokensByModel: z39.record(RunTokenUsageSchema).nullable(),
|
|
4161
|
+
toolCalls: z39.array(z39.unknown()).nullable(),
|
|
4162
|
+
diagnostics: z39.array(z39.unknown()).nullable(),
|
|
4163
|
+
latencyFirstText: z39.number().int().nullable(),
|
|
4164
|
+
latencyFirstPatch: z39.number().int().nullable(),
|
|
4165
|
+
latencyTotal: z39.number().int().nullable(),
|
|
4076
4166
|
/**
|
|
4077
4167
|
* The CLIENT's turn id for this run, or `null`.
|
|
4078
4168
|
*
|
|
@@ -4088,29 +4178,29 @@ var TraceRecordSchema = z38.object({
|
|
|
4088
4178
|
* a turn whose ack the client never saw — none of which is evidence that a
|
|
4089
4179
|
* visitor asked something and got nothing.
|
|
4090
4180
|
*/
|
|
4091
|
-
turnId:
|
|
4181
|
+
turnId: z39.string().nullable(),
|
|
4092
4182
|
/** Serialized `TraceTracker.exportState()` payload (parsed object) —
|
|
4093
4183
|
* lets the inspector rehydrate this run verbatim after a reload. */
|
|
4094
|
-
trackerState:
|
|
4095
|
-
createdAt:
|
|
4184
|
+
trackerState: z39.unknown().nullable(),
|
|
4185
|
+
createdAt: z39.string()
|
|
4096
4186
|
});
|
|
4097
|
-
var MillisecondsSchema =
|
|
4098
|
-
var CreateTraceInputSchema =
|
|
4099
|
-
spaceId:
|
|
4100
|
-
sessionId:
|
|
4101
|
-
visitorEmail:
|
|
4102
|
-
userPrompt:
|
|
4103
|
-
branch:
|
|
4104
|
-
responseText:
|
|
4105
|
-
layout:
|
|
4106
|
-
phaseTimings:
|
|
4107
|
-
tokensByModel:
|
|
4108
|
-
toolCalls:
|
|
4109
|
-
diagnostics:
|
|
4187
|
+
var MillisecondsSchema = z39.number().nullable().transform((v) => v === null ? null : Math.round(v));
|
|
4188
|
+
var CreateTraceInputSchema = z39.object({
|
|
4189
|
+
spaceId: z39.string().uuid().nullable(),
|
|
4190
|
+
sessionId: z39.string(),
|
|
4191
|
+
visitorEmail: z39.string().nullable(),
|
|
4192
|
+
userPrompt: z39.string(),
|
|
4193
|
+
branch: z39.string().nullable(),
|
|
4194
|
+
responseText: z39.string().nullable(),
|
|
4195
|
+
layout: z39.unknown().nullable(),
|
|
4196
|
+
phaseTimings: z39.record(z39.number()).nullable(),
|
|
4197
|
+
tokensByModel: z39.record(RunTokenUsageSchema).nullable(),
|
|
4198
|
+
toolCalls: z39.array(z39.unknown()).nullable(),
|
|
4199
|
+
diagnostics: z39.array(z39.unknown()).nullable(),
|
|
4110
4200
|
latencyFirstText: MillisecondsSchema,
|
|
4111
4201
|
latencyFirstPatch: MillisecondsSchema,
|
|
4112
4202
|
latencyTotal: MillisecondsSchema,
|
|
4113
|
-
trackerState:
|
|
4203
|
+
trackerState: z39.unknown().nullable(),
|
|
4114
4204
|
/**
|
|
4115
4205
|
* The CLIENT's turn id for this run, or `null`.
|
|
4116
4206
|
*
|
|
@@ -4126,37 +4216,37 @@ var CreateTraceInputSchema = z38.object({
|
|
|
4126
4216
|
* a turn whose ack the client never saw — none of which is evidence that a
|
|
4127
4217
|
* visitor asked something and got nothing.
|
|
4128
4218
|
*/
|
|
4129
|
-
turnId:
|
|
4219
|
+
turnId: z39.string().nullable()
|
|
4130
4220
|
});
|
|
4131
|
-
var AgentSessionSummarySchema =
|
|
4132
|
-
sessionId:
|
|
4221
|
+
var AgentSessionSummarySchema = z39.object({
|
|
4222
|
+
sessionId: z39.string(),
|
|
4133
4223
|
/** Turn rows only; background/secondary runs are excluded by the aggregate. */
|
|
4134
|
-
turnCount:
|
|
4224
|
+
turnCount: z39.number().int(),
|
|
4135
4225
|
/** The session's opening prompt — titles the row in the UI. */
|
|
4136
|
-
firstPrompt:
|
|
4137
|
-
startedAt:
|
|
4138
|
-
lastRunAt:
|
|
4226
|
+
firstPrompt: z39.string(),
|
|
4227
|
+
startedAt: z39.string(),
|
|
4228
|
+
lastRunAt: z39.string(),
|
|
4139
4229
|
/** Summed `latency_total` across the session's turns. */
|
|
4140
|
-
totalLatencyMs:
|
|
4230
|
+
totalLatencyMs: z39.number().int()
|
|
4141
4231
|
});
|
|
4142
|
-
var SessionTurnSchema =
|
|
4143
|
-
id:
|
|
4144
|
-
userPrompt:
|
|
4145
|
-
responseText:
|
|
4232
|
+
var SessionTurnSchema = z39.object({
|
|
4233
|
+
id: z39.string().uuid(),
|
|
4234
|
+
userPrompt: z39.string(),
|
|
4235
|
+
responseText: z39.string().nullable(),
|
|
4146
4236
|
/** Full cumulative Spec committed by this turn — never a patch delta. */
|
|
4147
|
-
layout:
|
|
4148
|
-
createdAt:
|
|
4149
|
-
latencyTotal:
|
|
4150
|
-
phaseTimings:
|
|
4151
|
-
tokensByModel:
|
|
4152
|
-
input_tokens:
|
|
4153
|
-
output_tokens:
|
|
4237
|
+
layout: z39.unknown().nullable(),
|
|
4238
|
+
createdAt: z39.string(),
|
|
4239
|
+
latencyTotal: z39.number().int().nullable(),
|
|
4240
|
+
phaseTimings: z39.record(z39.number()).nullable(),
|
|
4241
|
+
tokensByModel: z39.record(z39.object({
|
|
4242
|
+
input_tokens: z39.number().optional(),
|
|
4243
|
+
output_tokens: z39.number().optional()
|
|
4154
4244
|
})).nullable(),
|
|
4155
|
-
toolCalls:
|
|
4156
|
-
diagnostics:
|
|
4245
|
+
toolCalls: z39.array(z39.unknown()).nullable(),
|
|
4246
|
+
diagnostics: z39.array(z39.unknown()).nullable()
|
|
4157
4247
|
});
|
|
4158
|
-
var SessionReplaySchema =
|
|
4159
|
-
turns:
|
|
4248
|
+
var SessionReplaySchema = z39.object({
|
|
4249
|
+
turns: z39.array(SessionTurnSchema),
|
|
4160
4250
|
/**
|
|
4161
4251
|
* The session's own last-committed layout, read straight off the durable
|
|
4162
4252
|
* session record (`sessions.blob.layout`) rather than derived from `turns`.
|
|
@@ -4167,20 +4257,20 @@ var SessionReplaySchema = z38.object({
|
|
|
4167
4257
|
* a perfectly real layout; only this field can show it. Null exclusively
|
|
4168
4258
|
* when the durable session row itself could not be read.
|
|
4169
4259
|
*/
|
|
4170
|
-
sessionLayout:
|
|
4260
|
+
sessionLayout: z39.record(z39.string(), z39.unknown()).nullable()
|
|
4171
4261
|
});
|
|
4172
|
-
var SessionTraceSchema =
|
|
4173
|
-
trackerState:
|
|
4262
|
+
var SessionTraceSchema = z39.object({
|
|
4263
|
+
trackerState: z39.string().nullable()
|
|
4174
4264
|
});
|
|
4175
|
-
var LlmUsageDailySchema =
|
|
4176
|
-
day:
|
|
4265
|
+
var LlmUsageDailySchema = z39.object({
|
|
4266
|
+
day: z39.string(),
|
|
4177
4267
|
/** Deployment that made the call — 'production', 'staging', 'pr-123', 'development'. */
|
|
4178
|
-
environment:
|
|
4179
|
-
feature:
|
|
4180
|
-
model:
|
|
4181
|
-
provider:
|
|
4268
|
+
environment: z39.string(),
|
|
4269
|
+
feature: z39.string(),
|
|
4270
|
+
model: z39.string(),
|
|
4271
|
+
provider: z39.string(),
|
|
4182
4272
|
/** Masked tail of the key actually billed, or null when unknown/non-Google. */
|
|
4183
|
-
keyFingerprint:
|
|
4273
|
+
keyFingerprint: z39.string().nullable(),
|
|
4184
4274
|
/**
|
|
4185
4275
|
* The space the call served, or null when it served none.
|
|
4186
4276
|
*
|
|
@@ -4189,91 +4279,91 @@ var LlmUsageDailySchema = z38.object({
|
|
|
4189
4279
|
* report that share rather than dropping it, or a per-space total reads as
|
|
4190
4280
|
* the platform total.
|
|
4191
4281
|
*/
|
|
4192
|
-
spaceId:
|
|
4282
|
+
spaceId: z39.string().nullable(),
|
|
4193
4283
|
/**
|
|
4194
4284
|
* The surface of the session the call served (`sessions.surface`), or null
|
|
4195
4285
|
* when it served no session or the session predates surface recording.
|
|
4196
4286
|
* `automation` is the eval harness — the signal that files an ordinary
|
|
4197
4287
|
* `agent-turn` as testing spend rather than as a visitor's.
|
|
4198
4288
|
*/
|
|
4199
|
-
surface:
|
|
4200
|
-
inputTokens:
|
|
4201
|
-
outputTokens:
|
|
4289
|
+
surface: z39.string().nullable(),
|
|
4290
|
+
inputTokens: z39.number(),
|
|
4291
|
+
outputTokens: z39.number(),
|
|
4202
4292
|
/** Subset of inputTokens, never additional to it. */
|
|
4203
|
-
cachedInputTokens:
|
|
4204
|
-
reasoningTokens:
|
|
4205
|
-
callCount:
|
|
4206
|
-
errorCount:
|
|
4207
|
-
estimatedCostUsd:
|
|
4293
|
+
cachedInputTokens: z39.number(),
|
|
4294
|
+
reasoningTokens: z39.number(),
|
|
4295
|
+
callCount: z39.number(),
|
|
4296
|
+
errorCount: z39.number(),
|
|
4297
|
+
estimatedCostUsd: z39.number().nullable()
|
|
4208
4298
|
});
|
|
4209
|
-
var LlmUsageBySessionSchema =
|
|
4210
|
-
sessionId:
|
|
4211
|
-
environment:
|
|
4212
|
-
model:
|
|
4299
|
+
var LlmUsageBySessionSchema = z39.object({
|
|
4300
|
+
sessionId: z39.string(),
|
|
4301
|
+
environment: z39.string(),
|
|
4302
|
+
model: z39.string(),
|
|
4213
4303
|
/** The space this session belongs to, or null for a session with no space. */
|
|
4214
|
-
spaceId:
|
|
4304
|
+
spaceId: z39.string().nullable(),
|
|
4215
4305
|
/** The session's surface — see `LlmUsageDailySchema.surface`. */
|
|
4216
|
-
surface:
|
|
4306
|
+
surface: z39.string().nullable(),
|
|
4217
4307
|
/** Label only — the first feature seen in the session. */
|
|
4218
|
-
firstFeature:
|
|
4219
|
-
startedAt:
|
|
4220
|
-
endedAt:
|
|
4221
|
-
inputTokens:
|
|
4222
|
-
outputTokens:
|
|
4223
|
-
cachedInputTokens:
|
|
4224
|
-
reasoningTokens:
|
|
4225
|
-
callCount:
|
|
4226
|
-
errorCount:
|
|
4308
|
+
firstFeature: z39.string(),
|
|
4309
|
+
startedAt: z39.string(),
|
|
4310
|
+
endedAt: z39.string(),
|
|
4311
|
+
inputTokens: z39.number(),
|
|
4312
|
+
outputTokens: z39.number(),
|
|
4313
|
+
cachedInputTokens: z39.number(),
|
|
4314
|
+
reasoningTokens: z39.number(),
|
|
4315
|
+
callCount: z39.number(),
|
|
4316
|
+
errorCount: z39.number(),
|
|
4227
4317
|
/** Priced server-side, like the daily rollup — the browser never carries a
|
|
4228
4318
|
* rate table, so there is exactly one place a price can be wrong. Null when
|
|
4229
4319
|
* the model is unpriced; never 0, which would read as free. */
|
|
4230
|
-
estimatedCostUsd:
|
|
4320
|
+
estimatedCostUsd: z39.number().nullable()
|
|
4231
4321
|
});
|
|
4232
|
-
var LlmSessionsDailySchema =
|
|
4233
|
-
day:
|
|
4234
|
-
environment:
|
|
4235
|
-
sessionCount:
|
|
4322
|
+
var LlmSessionsDailySchema = z39.object({
|
|
4323
|
+
day: z39.string(),
|
|
4324
|
+
environment: z39.string(),
|
|
4325
|
+
sessionCount: z39.number()
|
|
4236
4326
|
});
|
|
4237
4327
|
|
|
4238
4328
|
// ../spacestation/src/space/session-queue.ts
|
|
4239
|
-
import { z as
|
|
4329
|
+
import { z as z41 } from "zod";
|
|
4240
4330
|
|
|
4241
4331
|
// ../spacestation/src/space/session-activity.ts
|
|
4242
|
-
import { z as
|
|
4243
|
-
var SessionActivityEventSchema =
|
|
4244
|
-
id:
|
|
4245
|
-
kind:
|
|
4246
|
-
occurredAt:
|
|
4247
|
-
source:
|
|
4248
|
-
surface:
|
|
4249
|
-
payload:
|
|
4332
|
+
import { z as z40 } from "zod";
|
|
4333
|
+
var SessionActivityEventSchema = z40.object({
|
|
4334
|
+
id: z40.string(),
|
|
4335
|
+
kind: z40.string(),
|
|
4336
|
+
occurredAt: z40.string(),
|
|
4337
|
+
source: z40.string(),
|
|
4338
|
+
surface: z40.string(),
|
|
4339
|
+
payload: z40.record(z40.unknown())
|
|
4250
4340
|
});
|
|
4251
|
-
var SessionActivitySchema =
|
|
4252
|
-
events:
|
|
4253
|
-
hasMore:
|
|
4341
|
+
var SessionActivitySchema = z40.object({
|
|
4342
|
+
events: z40.array(SessionActivityEventSchema),
|
|
4343
|
+
hasMore: z40.boolean()
|
|
4254
4344
|
});
|
|
4255
4345
|
|
|
4256
4346
|
// ../spacestation/src/space/session-queue.ts
|
|
4257
|
-
var SessionVerdictSchema =
|
|
4258
|
-
var RecordableVerdictSchema =
|
|
4259
|
-
var SessionReviewEventSchema =
|
|
4260
|
-
id:
|
|
4347
|
+
var SessionVerdictSchema = z41.enum(["unreviewed", "viewed", "bug"]);
|
|
4348
|
+
var RecordableVerdictSchema = z41.enum(["viewed", "bug"]);
|
|
4349
|
+
var SessionReviewEventSchema = z41.object({
|
|
4350
|
+
id: z41.string().uuid(),
|
|
4261
4351
|
verdict: RecordableVerdictSchema,
|
|
4262
4352
|
/** Account email of the operator who judged it. Attribution is the reason the
|
|
4263
4353
|
* log is append-only rather than a mutable current-state row. */
|
|
4264
|
-
reviewer:
|
|
4265
|
-
note:
|
|
4266
|
-
createdAt:
|
|
4354
|
+
reviewer: z41.string(),
|
|
4355
|
+
note: z41.string().nullable(),
|
|
4356
|
+
createdAt: z41.string()
|
|
4267
4357
|
});
|
|
4268
|
-
var BugSeveritySchema =
|
|
4269
|
-
var BugLocationSchema =
|
|
4270
|
-
elementId:
|
|
4358
|
+
var BugSeveritySchema = z41.enum(["high", "medium", "low"]);
|
|
4359
|
+
var BugLocationSchema = z41.object({
|
|
4360
|
+
elementId: z41.string().nullable(),
|
|
4271
4361
|
/** Display only — the catalog component type, e.g. "productGrid". Null
|
|
4272
4362
|
* alongside a null `elementId`. */
|
|
4273
|
-
elementType:
|
|
4363
|
+
elementType: z41.string().nullable(),
|
|
4274
4364
|
/** Fraction of the ELEMENT's own box. Null for a page anchor. */
|
|
4275
|
-
offsetXPct:
|
|
4276
|
-
offsetYPct:
|
|
4365
|
+
offsetXPct: z41.number().min(0).max(100).nullable(),
|
|
4366
|
+
offsetYPct: z41.number().min(0).max(100).nullable(),
|
|
4277
4367
|
/**
|
|
4278
4368
|
* ABSOLUTE document pixels, for a pin with no element under it. Null for an
|
|
4279
4369
|
* element anchor.
|
|
@@ -4284,8 +4374,8 @@ var BugLocationSchema = z40.object({
|
|
|
4284
4374
|
* on the page with it. Measured before this was fixed: growing the page 9%
|
|
4285
4375
|
* slid a pin 32px, so a pin ran away from the cursor reaching for it.
|
|
4286
4376
|
*/
|
|
4287
|
-
pageX:
|
|
4288
|
-
pageY:
|
|
4377
|
+
pageX: z41.number().nullable(),
|
|
4378
|
+
pageY: z41.number().nullable()
|
|
4289
4379
|
}).refine(
|
|
4290
4380
|
(loc) => {
|
|
4291
4381
|
const hasOffsets = loc.offsetXPct !== null && loc.offsetYPct !== null;
|
|
@@ -4299,24 +4389,24 @@ var BugLocationSchema = z40.object({
|
|
|
4299
4389
|
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)"
|
|
4300
4390
|
}
|
|
4301
4391
|
);
|
|
4302
|
-
var SessionBugSchema =
|
|
4303
|
-
id:
|
|
4392
|
+
var SessionBugSchema = z41.object({
|
|
4393
|
+
id: z41.string().uuid(),
|
|
4304
4394
|
/** 1-based turn the fault was observed on; null when the fault is session-wide. */
|
|
4305
|
-
turnIndex:
|
|
4395
|
+
turnIndex: z41.number().int().nullable(),
|
|
4306
4396
|
/** Where on that turn's canvas the pin was dropped; null for a bug filed
|
|
4307
4397
|
* without pinning a spot. */
|
|
4308
4398
|
location: BugLocationSchema.nullable(),
|
|
4309
|
-
provider:
|
|
4310
|
-
issueKey:
|
|
4311
|
-
issueUrl:
|
|
4399
|
+
provider: z41.string(),
|
|
4400
|
+
issueKey: z41.string().nullable(),
|
|
4401
|
+
issueUrl: z41.string().nullable(),
|
|
4312
4402
|
/** The tracker's own state word ('Todo', 'Done', …) — their vocabulary, so
|
|
4313
4403
|
* open text. Null until first synced. */
|
|
4314
|
-
issueState:
|
|
4315
|
-
title:
|
|
4316
|
-
body:
|
|
4404
|
+
issueState: z41.string().nullable(),
|
|
4405
|
+
title: z41.string(),
|
|
4406
|
+
body: z41.string(),
|
|
4317
4407
|
severity: BugSeveritySchema,
|
|
4318
|
-
createdBy:
|
|
4319
|
-
createdAt:
|
|
4408
|
+
createdBy: z41.string(),
|
|
4409
|
+
createdAt: z41.string(),
|
|
4320
4410
|
/**
|
|
4321
4411
|
* When this bug was resolved from the console; null means still OPEN.
|
|
4322
4412
|
*
|
|
@@ -4325,60 +4415,60 @@ var SessionBugSchema = z40.object({
|
|
|
4325
4415
|
* whether a particular fault is still live. The timestamp IS the state, so
|
|
4326
4416
|
* no boolean can contradict it.
|
|
4327
4417
|
*/
|
|
4328
|
-
resolvedAt:
|
|
4329
|
-
resolvedBy:
|
|
4418
|
+
resolvedAt: z41.string().nullable(),
|
|
4419
|
+
resolvedBy: z41.string().nullable()
|
|
4330
4420
|
});
|
|
4331
|
-
var SpaceBugSchema = SessionBugSchema.extend({ sessionId:
|
|
4332
|
-
var SessionCommentSchema =
|
|
4333
|
-
id:
|
|
4421
|
+
var SpaceBugSchema = SessionBugSchema.extend({ sessionId: z41.string() });
|
|
4422
|
+
var SessionCommentSchema = z41.object({
|
|
4423
|
+
id: z41.string().uuid(),
|
|
4334
4424
|
/** Set = a reply in that bug's thread. Null = a standalone comment pin. */
|
|
4335
|
-
bugId:
|
|
4425
|
+
bugId: z41.string().uuid().nullable(),
|
|
4336
4426
|
/** 1-based turn the comment was left on; null for a reply (it reads its
|
|
4337
4427
|
* parent bug's turn). */
|
|
4338
|
-
turnIndex:
|
|
4428
|
+
turnIndex: z41.number().int().nullable(),
|
|
4339
4429
|
/** The canvas anchor for a STANDALONE comment's own pin; null for a reply. */
|
|
4340
4430
|
location: BugLocationSchema.nullable(),
|
|
4341
|
-
body:
|
|
4342
|
-
createdBy:
|
|
4343
|
-
createdAt:
|
|
4431
|
+
body: z41.string(),
|
|
4432
|
+
createdBy: z41.string(),
|
|
4433
|
+
createdAt: z41.string()
|
|
4344
4434
|
});
|
|
4345
|
-
var CreateCommentInputSchema =
|
|
4346
|
-
bugId:
|
|
4347
|
-
turnIndex:
|
|
4435
|
+
var CreateCommentInputSchema = z41.object({
|
|
4436
|
+
bugId: z41.string().uuid().nullable(),
|
|
4437
|
+
turnIndex: z41.number().int().positive().nullable(),
|
|
4348
4438
|
location: BugLocationSchema.nullable(),
|
|
4349
4439
|
// Trimmed, so whitespace is not content: `.min(1)` alone accepted a comment
|
|
4350
4440
|
// of three spaces, which renders as an empty bubble nobody can interpret.
|
|
4351
|
-
body:
|
|
4441
|
+
body: z41.string().trim().min(1)
|
|
4352
4442
|
}).refine((input) => input.bugId === null !== (input.location === null), {
|
|
4353
4443
|
message: "a comment is either a reply (bugId, no location) or a standalone pin (location, no bugId)"
|
|
4354
4444
|
});
|
|
4355
|
-
var UpdateCommentInputSchema =
|
|
4356
|
-
body:
|
|
4357
|
-
bugId:
|
|
4445
|
+
var UpdateCommentInputSchema = z41.object({
|
|
4446
|
+
body: z41.string().trim().min(1).optional(),
|
|
4447
|
+
bugId: z41.string().uuid().nullable().optional(),
|
|
4358
4448
|
location: BugLocationSchema.nullable().optional()
|
|
4359
4449
|
});
|
|
4360
4450
|
var MOBILE_VIEWPORT_MAX = 720;
|
|
4361
|
-
var SessionFormFactorSchema =
|
|
4451
|
+
var SessionFormFactorSchema = z41.enum(["mobile", "desktop"]).nullable();
|
|
4362
4452
|
function formFactorFromViewport(width) {
|
|
4363
4453
|
if (width === null) return null;
|
|
4364
4454
|
return width <= MOBILE_VIEWPORT_MAX ? "mobile" : "desktop";
|
|
4365
4455
|
}
|
|
4366
|
-
var SessionSummarySchema =
|
|
4367
|
-
sessionId:
|
|
4456
|
+
var SessionSummarySchema = z41.object({
|
|
4457
|
+
sessionId: z41.string(),
|
|
4368
4458
|
/** Stable per-browser id — the join key across a visitor's sessions. Null when
|
|
4369
4459
|
* the session row is gone (pruned) or predates the `sessions` table. */
|
|
4370
|
-
visitorId:
|
|
4460
|
+
visitorId: z41.string().nullable(),
|
|
4371
4461
|
/** Provider-qualified identity anchor, present only once the visitor
|
|
4372
4462
|
* identified themselves. Both null together means "not identified yet". */
|
|
4373
|
-
identityProvider:
|
|
4374
|
-
identityKey:
|
|
4463
|
+
identityProvider: z41.string().nullable(),
|
|
4464
|
+
identityKey: z41.string().nullable(),
|
|
4375
4465
|
/** Team/test traffic. The queue hides these by default. */
|
|
4376
|
-
isInternal:
|
|
4466
|
+
isInternal: z41.boolean(),
|
|
4377
4467
|
/** Build that served the session. Null = not captured; a version filter must
|
|
4378
4468
|
* therefore EXCLUDE it rather than let it match an arbitrary bucket. */
|
|
4379
|
-
clientVersion:
|
|
4469
|
+
clientVersion: z41.string().nullable(),
|
|
4380
4470
|
/** Commit-shaped interaction signals, counted, keyed by open `SignalType`. */
|
|
4381
|
-
signalCounts:
|
|
4471
|
+
signalCounts: z41.record(z41.number()),
|
|
4382
4472
|
/**
|
|
4383
4473
|
* Did this conversation ACQUIRE anything, and how many times?
|
|
4384
4474
|
*
|
|
@@ -4395,7 +4485,7 @@ var SessionSummarySchema = z40.object({
|
|
|
4395
4485
|
* predates the column — and renders as no mark at all. It never means zero:
|
|
4396
4486
|
* zero is a real, recorded answer and the rail reports it as one.
|
|
4397
4487
|
*/
|
|
4398
|
-
conversionAttempts:
|
|
4488
|
+
conversionAttempts: z41.number().int().nullable(),
|
|
4399
4489
|
/**
|
|
4400
4490
|
* The same attempts split by EVENT KIND, keyed by the kind's own name
|
|
4401
4491
|
* (`commerce.cart_line_added`, `commerce.registry_clicked`), counted distinct
|
|
@@ -4411,7 +4501,7 @@ var SessionSummarySchema = z40.object({
|
|
|
4411
4501
|
* kinds together, and one attempt id appearing under both would be counted
|
|
4412
4502
|
* once there and twice here.
|
|
4413
4503
|
*/
|
|
4414
|
-
conversionKinds:
|
|
4504
|
+
conversionKinds: z41.record(z41.number()),
|
|
4415
4505
|
/**
|
|
4416
4506
|
* Every analytics funnel step this session reached, in funnel order — the
|
|
4417
4507
|
* dashboard's own step ids, read by the same per-step predicates, so a queue
|
|
@@ -4419,20 +4509,20 @@ var SessionSummarySchema = z40.object({
|
|
|
4419
4509
|
* set of strings for the reason `conversionKinds` is: the contract does not
|
|
4420
4510
|
* learn what a step means. Empty only when read from a pre-column database.
|
|
4421
4511
|
*/
|
|
4422
|
-
funnelSteps:
|
|
4512
|
+
funnelSteps: z41.array(z41.string()),
|
|
4423
4513
|
/**
|
|
4424
4514
|
* The connector's opaque handle for what this session produced in its back
|
|
4425
4515
|
* office — present only once a checkout actually reached the platform. The
|
|
4426
4516
|
* console hands it to the back-office link registry; nothing else reads it.
|
|
4427
4517
|
*/
|
|
4428
|
-
backOfficeRef:
|
|
4518
|
+
backOfficeRef: z41.string().nullable(),
|
|
4429
4519
|
/**
|
|
4430
4520
|
* The order this session produced, when the connector's back office reported
|
|
4431
4521
|
* it (`session_orders`): its opaque id and the back office's own name for it.
|
|
4432
4522
|
* Both null when no order is known — the cart handle above is then the door.
|
|
4433
4523
|
*/
|
|
4434
|
-
orderRef:
|
|
4435
|
-
orderLabel:
|
|
4524
|
+
orderRef: z41.string().nullable(),
|
|
4525
|
+
orderLabel: z41.string().nullable(),
|
|
4436
4526
|
/**
|
|
4437
4527
|
* Which shell this session rendered — the one thing about the CAPTURE a list
|
|
4438
4528
|
* needs.
|
|
@@ -4445,12 +4535,12 @@ var SessionSummarySchema = z40.object({
|
|
|
4445
4535
|
* on a desktop are not the same session.
|
|
4446
4536
|
*/
|
|
4447
4537
|
formFactor: SessionFormFactorSchema,
|
|
4448
|
-
turnCount:
|
|
4538
|
+
turnCount: z41.number().int(),
|
|
4449
4539
|
/** The visitor's opening message — the single most informative field for
|
|
4450
4540
|
* deciding whether a session is worth opening, hence the widest column. */
|
|
4451
|
-
firstPrompt:
|
|
4452
|
-
startedAt:
|
|
4453
|
-
lastRunAt:
|
|
4541
|
+
firstPrompt: z41.string(),
|
|
4542
|
+
startedAt: z41.string(),
|
|
4543
|
+
lastRunAt: z41.string(),
|
|
4454
4544
|
/**
|
|
4455
4545
|
* The VISITOR's own IANA zone (`America/New_York`), read from their browser
|
|
4456
4546
|
* at session create — what the two timestamps above should be read in.
|
|
@@ -4478,7 +4568,7 @@ var SessionSummarySchema = z40.object({
|
|
|
4478
4568
|
* Client-asserted and never validated against a zone table, so every consumer
|
|
4479
4569
|
* must tolerate an unknown name: `Intl` throws a RangeError on one.
|
|
4480
4570
|
*/
|
|
4481
|
-
visitorTimeZone:
|
|
4571
|
+
visitorTimeZone: z41.string().nullable(),
|
|
4482
4572
|
/**
|
|
4483
4573
|
* Mean TIME TO FIRST PATCH, over the turns that recorded one — the first
|
|
4484
4574
|
* layout op reaching the visitor, and THE latency the project is managed on.
|
|
@@ -4486,31 +4576,31 @@ var SessionSummarySchema = z40.object({
|
|
|
4486
4576
|
* `totalLatencyMs` carries the chip-gen tail that runs after the visitor is
|
|
4487
4577
|
* already reading. Null when no turn in the session recorded a patch.
|
|
4488
4578
|
*/
|
|
4489
|
-
avgTtftMs:
|
|
4579
|
+
avgTtftMs: z41.number().int().nullable(),
|
|
4490
4580
|
/** Mean `main_done_ms` — layout + prose complete. Context for the TTFT, not
|
|
4491
4581
|
* a budget: null on sessions older than the mark's recording. */
|
|
4492
|
-
avgMainDoneMs:
|
|
4582
|
+
avgMainDoneMs: z41.number().int().nullable(),
|
|
4493
4583
|
/** Mean `chip_gen_ms` — the pass that runs AFTER mainDone and is out of the
|
|
4494
4584
|
* budget. On the row only to explain the gap to `totalLatencyMs`. */
|
|
4495
|
-
avgChipGenMs:
|
|
4496
|
-
totalLatencyMs:
|
|
4497
|
-
durationMs:
|
|
4585
|
+
avgChipGenMs: z41.number().int().nullable(),
|
|
4586
|
+
totalLatencyMs: z41.number().int(),
|
|
4587
|
+
durationMs: z41.number().int(),
|
|
4498
4588
|
/** Inferred from recent activity — nothing writes a session-end marker. A
|
|
4499
4589
|
* live session streams and cannot be given a verdict until it ends. */
|
|
4500
|
-
isLive:
|
|
4590
|
+
isLive: z41.boolean(),
|
|
4501
4591
|
verdict: SessionVerdictSchema,
|
|
4502
|
-
reviewedBy:
|
|
4503
|
-
reviewedAt:
|
|
4592
|
+
reviewedBy: z41.string().nullable(),
|
|
4593
|
+
reviewedAt: z41.string().nullable(),
|
|
4504
4594
|
/** Latest filed bug, flattened onto the row so the queue can show its live
|
|
4505
4595
|
* state without a second request. */
|
|
4506
|
-
bugIssueKey:
|
|
4507
|
-
bugIssueUrl:
|
|
4508
|
-
bugIssueState:
|
|
4596
|
+
bugIssueKey: z41.string().nullable(),
|
|
4597
|
+
bugIssueUrl: z41.string().nullable(),
|
|
4598
|
+
bugIssueState: z41.string().nullable()
|
|
4509
4599
|
});
|
|
4510
|
-
var SessionQueuePageSchema =
|
|
4511
|
-
sessions:
|
|
4512
|
-
totalCount:
|
|
4513
|
-
hiddenInternalCount:
|
|
4600
|
+
var SessionQueuePageSchema = z41.object({
|
|
4601
|
+
sessions: z41.array(SessionSummarySchema),
|
|
4602
|
+
totalCount: z41.number().int(),
|
|
4603
|
+
hiddenInternalCount: z41.number().int(),
|
|
4514
4604
|
/**
|
|
4515
4605
|
* Bounced sessions the queue left out — no turn and no add, the default.
|
|
4516
4606
|
*
|
|
@@ -4520,61 +4610,61 @@ var SessionQueuePageSchema = z40.object({
|
|
|
4520
4610
|
* `totalCount + hiddenBouncedCount` is that population, and this count is the
|
|
4521
4611
|
* analytics dashboard's bounce over the same window.
|
|
4522
4612
|
*/
|
|
4523
|
-
hiddenBouncedCount:
|
|
4613
|
+
hiddenBouncedCount: z41.number().int()
|
|
4524
4614
|
});
|
|
4525
|
-
var SessionQueueFacetsSchema =
|
|
4526
|
-
review:
|
|
4527
|
-
version:
|
|
4528
|
-
turns:
|
|
4529
|
-
durationS:
|
|
4615
|
+
var SessionQueueFacetsSchema = z41.object({
|
|
4616
|
+
review: z41.record(z41.number()),
|
|
4617
|
+
version: z41.record(z41.number()),
|
|
4618
|
+
turns: z41.record(z41.number()),
|
|
4619
|
+
durationS: z41.record(z41.number()),
|
|
4530
4620
|
/** Sessions per funnel step reached — a session counts under every step it reached. */
|
|
4531
|
-
funnel:
|
|
4621
|
+
funnel: z41.record(z41.number())
|
|
4532
4622
|
});
|
|
4533
|
-
var SessionCaptureSchema =
|
|
4534
|
-
viewportWidth:
|
|
4535
|
-
viewportHeight:
|
|
4536
|
-
userAgent:
|
|
4537
|
-
locale:
|
|
4623
|
+
var SessionCaptureSchema = z41.object({
|
|
4624
|
+
viewportWidth: z41.number().int().nullable(),
|
|
4625
|
+
viewportHeight: z41.number().int().nullable(),
|
|
4626
|
+
userAgent: z41.string().nullable(),
|
|
4627
|
+
locale: z41.string().nullable(),
|
|
4538
4628
|
/** Referrer at session create — separates agentic traffic from organic. */
|
|
4539
|
-
referrer:
|
|
4629
|
+
referrer: z41.string().nullable()
|
|
4540
4630
|
});
|
|
4541
|
-
var SessionCaptureInputSchema =
|
|
4542
|
-
viewportWidth:
|
|
4543
|
-
viewportHeight:
|
|
4544
|
-
userAgent:
|
|
4545
|
-
locale:
|
|
4631
|
+
var SessionCaptureInputSchema = z41.object({
|
|
4632
|
+
viewportWidth: z41.number().int().positive().max(2e4).optional(),
|
|
4633
|
+
viewportHeight: z41.number().int().positive().max(2e4).optional(),
|
|
4634
|
+
userAgent: z41.string().max(1e3).optional(),
|
|
4635
|
+
locale: z41.string().max(35).optional(),
|
|
4546
4636
|
/** IANA zone name from the visitor's browser. Bounded rather than validated:
|
|
4547
4637
|
* the zone database grows, and refusing a name this build has not heard of
|
|
4548
4638
|
* would drop a real session's capture over a table that is out of date. */
|
|
4549
|
-
timeZone:
|
|
4550
|
-
referrer:
|
|
4551
|
-
clientVersion:
|
|
4552
|
-
isInternal:
|
|
4639
|
+
timeZone: z41.string().max(64).optional(),
|
|
4640
|
+
referrer: z41.string().max(2048).optional(),
|
|
4641
|
+
clientVersion: z41.string().max(100).optional(),
|
|
4642
|
+
isInternal: z41.boolean().optional()
|
|
4553
4643
|
});
|
|
4554
|
-
var SessionDetailSchema =
|
|
4644
|
+
var SessionDetailSchema = z41.object({
|
|
4555
4645
|
session: SessionSummarySchema,
|
|
4556
4646
|
capture: SessionCaptureSchema,
|
|
4557
4647
|
/** Full verdict history, newest first. Verdicts are revisable, and a session
|
|
4558
4648
|
* re-judged after a fix is the evidence the fix worked. */
|
|
4559
|
-
reviews:
|
|
4560
|
-
bugs:
|
|
4561
|
-
comments:
|
|
4649
|
+
reviews: z41.array(SessionReviewEventSchema),
|
|
4650
|
+
bugs: z41.array(SessionBugSchema),
|
|
4651
|
+
comments: z41.array(SessionCommentSchema),
|
|
4562
4652
|
/** Optional during API/console rolling deployment. Absent is unavailable,
|
|
4563
4653
|
* not evidence of zero visitor activity. */
|
|
4564
4654
|
activity: SessionActivitySchema.optional()
|
|
4565
4655
|
});
|
|
4566
|
-
var RecordVerdictInputSchema =
|
|
4656
|
+
var RecordVerdictInputSchema = z41.object({
|
|
4567
4657
|
verdict: RecordableVerdictSchema,
|
|
4568
|
-
note:
|
|
4658
|
+
note: z41.string().max(2e3).optional()
|
|
4569
4659
|
});
|
|
4570
|
-
var FileBugInputSchema =
|
|
4571
|
-
turnIndex:
|
|
4660
|
+
var FileBugInputSchema = z41.object({
|
|
4661
|
+
turnIndex: z41.number().int().positive().nullable(),
|
|
4572
4662
|
/** Optional — a bug filed without dropping a pin has no location. */
|
|
4573
4663
|
location: BugLocationSchema.nullable().optional(),
|
|
4574
|
-
title:
|
|
4575
|
-
body:
|
|
4664
|
+
title: z41.string().min(1).max(300),
|
|
4665
|
+
body: z41.string().min(1),
|
|
4576
4666
|
severity: BugSeveritySchema,
|
|
4577
|
-
payload:
|
|
4667
|
+
payload: z41.record(z41.unknown())
|
|
4578
4668
|
});
|
|
4579
4669
|
|
|
4580
4670
|
// ../spacestation/src/contracts/retrieval/ecommerce/option-values.ts
|
|
@@ -4868,6 +4958,7 @@ __export(src_exports2, {
|
|
|
4868
4958
|
buildPdpCompanionsConfig: () => buildPdpCompanionsConfig,
|
|
4869
4959
|
cartLineMatchesSelections: () => cartLineMatchesSelections,
|
|
4870
4960
|
cartLinesForProduct: () => cartLinesForProduct,
|
|
4961
|
+
clearCodeDiscountSources: () => clearCodeDiscountSources,
|
|
4871
4962
|
clearProductNameLookups: () => clearProductNameLookups,
|
|
4872
4963
|
createUnavailableProduct: () => createUnavailableProduct,
|
|
4873
4964
|
entityProjections: () => entityProjections,
|
|
@@ -4885,7 +4976,9 @@ __export(src_exports2, {
|
|
|
4885
4976
|
readBaseAttributesConfig: () => readBaseAttributesConfig,
|
|
4886
4977
|
readBucketLabelsConfig: () => readBucketLabelsConfig,
|
|
4887
4978
|
readPdpCompanions: () => readPdpCompanions,
|
|
4979
|
+
registerCodeDiscountSource: () => registerCodeDiscountSource,
|
|
4888
4980
|
registerProductNameLookup: () => registerProductNameLookup,
|
|
4981
|
+
resolveCodeDiscountSource: () => resolveCodeDiscountSource,
|
|
4889
4982
|
resolveProductNameLookup: () => resolveProductNameLookup,
|
|
4890
4983
|
scopedAttributeKey: () => scopedAttributeKey,
|
|
4891
4984
|
selectedOptionsToRecord: () => selectedOptionsToRecord,
|
|
@@ -4893,60 +4986,60 @@ __export(src_exports2, {
|
|
|
4893
4986
|
});
|
|
4894
4987
|
|
|
4895
4988
|
// ../ecommerce/src/commerce-schemas.ts
|
|
4896
|
-
import { z as
|
|
4897
|
-
var MoneySchema =
|
|
4898
|
-
amount:
|
|
4899
|
-
currencyCode:
|
|
4989
|
+
import { z as z42 } from "zod";
|
|
4990
|
+
var MoneySchema = z42.object({
|
|
4991
|
+
amount: z42.number(),
|
|
4992
|
+
currencyCode: z42.string()
|
|
4900
4993
|
});
|
|
4901
|
-
var ImageSchema =
|
|
4902
|
-
url:
|
|
4903
|
-
altText:
|
|
4904
|
-
width:
|
|
4905
|
-
height:
|
|
4994
|
+
var ImageSchema = z42.object({
|
|
4995
|
+
url: z42.string(),
|
|
4996
|
+
altText: z42.string(),
|
|
4997
|
+
width: z42.number().optional(),
|
|
4998
|
+
height: z42.number().optional(),
|
|
4906
4999
|
/** Responsive candidate set, resolved at the commerce-adapter boundary —
|
|
4907
5000
|
* never computed in a component. Renderers use it as `<img srcSet>` paired
|
|
4908
5001
|
* with a layout `sizes`. Absent for non-CDN / unsizable images. */
|
|
4909
|
-
srcSet:
|
|
5002
|
+
srcSet: z42.string().optional()
|
|
4910
5003
|
});
|
|
4911
|
-
var AssetSchema =
|
|
5004
|
+
var AssetSchema = z42.object({
|
|
4912
5005
|
/** Opaque asset id — the `resolved()` ref the agent emitted. */
|
|
4913
|
-
id:
|
|
4914
|
-
url:
|
|
4915
|
-
altText:
|
|
4916
|
-
srcSet:
|
|
5006
|
+
id: z42.string(),
|
|
5007
|
+
url: z42.string(),
|
|
5008
|
+
altText: z42.string(),
|
|
5009
|
+
srcSet: z42.string().optional()
|
|
4917
5010
|
});
|
|
4918
|
-
var SelectedOptionSchema =
|
|
4919
|
-
name:
|
|
4920
|
-
value:
|
|
5011
|
+
var SelectedOptionSchema = z42.object({
|
|
5012
|
+
name: z42.string(),
|
|
5013
|
+
value: z42.string()
|
|
4921
5014
|
});
|
|
4922
|
-
var VideoSourceSchema =
|
|
4923
|
-
url:
|
|
4924
|
-
mimeType:
|
|
4925
|
-
width:
|
|
4926
|
-
height:
|
|
5015
|
+
var VideoSourceSchema = z42.object({
|
|
5016
|
+
url: z42.string(),
|
|
5017
|
+
mimeType: z42.string(),
|
|
5018
|
+
width: z42.number().optional(),
|
|
5019
|
+
height: z42.number().optional()
|
|
4927
5020
|
});
|
|
4928
|
-
var ProductVideoSchema =
|
|
4929
|
-
kind:
|
|
5021
|
+
var ProductVideoSchema = z42.object({
|
|
5022
|
+
kind: z42.enum(["hosted", "external"]),
|
|
4930
5023
|
previewImage: ImageSchema.optional(),
|
|
4931
|
-
altText:
|
|
5024
|
+
altText: z42.string().default(""),
|
|
4932
5025
|
/** `kind: 'hosted'` only — empty for external embeds. */
|
|
4933
|
-
sources:
|
|
5026
|
+
sources: z42.array(VideoSourceSchema).default([]),
|
|
4934
5027
|
/** `kind: 'external'` only — iframe embed URL. */
|
|
4935
|
-
embedUrl:
|
|
5028
|
+
embedUrl: z42.string().optional(),
|
|
4936
5029
|
/** `kind: 'external'` only — e.g. `YOUTUBE` | `VIMEO`. */
|
|
4937
|
-
host:
|
|
5030
|
+
host: z42.string().optional()
|
|
4938
5031
|
});
|
|
4939
|
-
var AvailabilityStatusSchema =
|
|
5032
|
+
var AvailabilityStatusSchema = z42.enum([
|
|
4940
5033
|
"in_stock",
|
|
4941
5034
|
"backorder",
|
|
4942
5035
|
"preorder",
|
|
4943
5036
|
"out_of_stock",
|
|
4944
5037
|
"discontinued"
|
|
4945
5038
|
]);
|
|
4946
|
-
var ProductVariantSchema =
|
|
4947
|
-
id:
|
|
4948
|
-
title:
|
|
4949
|
-
available:
|
|
5039
|
+
var ProductVariantSchema = z42.object({
|
|
5040
|
+
id: z42.string(),
|
|
5041
|
+
title: z42.string(),
|
|
5042
|
+
available: z42.boolean(),
|
|
4950
5043
|
/**
|
|
4951
5044
|
* Qualifies `available` with the fulfillment state behind it. Absent means
|
|
4952
5045
|
* the backend did not say — which is NOT the same as in stock, and must not
|
|
@@ -4961,8 +5054,10 @@ var ProductVariantSchema = z41.object({
|
|
|
4961
5054
|
availabilityStatus: AvailabilityStatusSchema.optional(),
|
|
4962
5055
|
price: MoneySchema,
|
|
4963
5056
|
compareAtPrice: MoneySchema.optional(),
|
|
4964
|
-
selectedOptions:
|
|
4965
|
-
image: ImageSchema.optional()
|
|
5057
|
+
selectedOptions: z42.array(SelectedOptionSchema).optional(),
|
|
5058
|
+
image: ImageSchema.optional(),
|
|
5059
|
+
/** The merchant's stock-keeping code. Absent when the backend has none. */
|
|
5060
|
+
sku: z42.string().optional()
|
|
4966
5061
|
});
|
|
4967
5062
|
var MP4_MIME = "video/mp4";
|
|
4968
5063
|
var HLS_MIME = "application/x-mpegURL";
|
|
@@ -4972,34 +5067,34 @@ function orderedVideoSources(video) {
|
|
|
4972
5067
|
const hls = video.sources.filter((s) => s.mimeType === HLS_MIME);
|
|
4973
5068
|
return [...mp4, ...hls];
|
|
4974
5069
|
}
|
|
4975
|
-
var SiblingProductSchema =
|
|
4976
|
-
id:
|
|
4977
|
-
handle:
|
|
4978
|
-
title:
|
|
5070
|
+
var SiblingProductSchema = z42.object({
|
|
5071
|
+
id: z42.string(),
|
|
5072
|
+
handle: z42.string(),
|
|
5073
|
+
title: z42.string(),
|
|
4979
5074
|
/** The differentiating value across siblings — typically the color
|
|
4980
5075
|
* label ("OLIVE", "STONE"). Rendered next to the swatch row. */
|
|
4981
|
-
color:
|
|
5076
|
+
color: z42.string(),
|
|
4982
5077
|
/** Swatch artwork. Hydrators populate from the sibling product's
|
|
4983
5078
|
* first image; renderers crop / fit to the swatch tile. */
|
|
4984
5079
|
swatchImage: ImageSchema.optional(),
|
|
4985
|
-
available:
|
|
5080
|
+
available: z42.boolean().default(true),
|
|
4986
5081
|
/** Marks the sibling that IS the currently-rendered product. The
|
|
4987
5082
|
* picker uses this to highlight the active swatch without an
|
|
4988
5083
|
* external id comparison. */
|
|
4989
|
-
current:
|
|
5084
|
+
current: z42.boolean().default(false)
|
|
4990
5085
|
});
|
|
4991
|
-
var ProductSchema =
|
|
4992
|
-
id:
|
|
4993
|
-
handle:
|
|
4994
|
-
title:
|
|
4995
|
-
description:
|
|
4996
|
-
descriptionHtml:
|
|
4997
|
-
vendor:
|
|
4998
|
-
productType:
|
|
4999
|
-
tags:
|
|
5086
|
+
var ProductSchema = z42.object({
|
|
5087
|
+
id: z42.string(),
|
|
5088
|
+
handle: z42.string().default(""),
|
|
5089
|
+
title: z42.string(),
|
|
5090
|
+
description: z42.string().default(""),
|
|
5091
|
+
descriptionHtml: z42.string().optional(),
|
|
5092
|
+
vendor: z42.string().default(""),
|
|
5093
|
+
productType: z42.string().optional(),
|
|
5094
|
+
tags: z42.array(z42.string()).default([]),
|
|
5000
5095
|
price: MoneySchema.default({ amount: 0, currencyCode: "USD" }),
|
|
5001
5096
|
compareAtPrice: MoneySchema.optional(),
|
|
5002
|
-
images:
|
|
5097
|
+
images: z42.array(ImageSchema).default([]),
|
|
5003
5098
|
/**
|
|
5004
5099
|
* Product videos (`Video` + `ExternalVideo` media). Shopify's MCP
|
|
5005
5100
|
* catalog drops video media — it only surfaces through the Storefront
|
|
@@ -5007,21 +5102,21 @@ var ProductSchema = z41.object({
|
|
|
5007
5102
|
* boundary. Default `[]` so renderers gate on `length > 0` without a
|
|
5008
5103
|
* presence guard.
|
|
5009
5104
|
*/
|
|
5010
|
-
videos:
|
|
5011
|
-
variants:
|
|
5012
|
-
availableForSale:
|
|
5013
|
-
options:
|
|
5014
|
-
name:
|
|
5015
|
-
values:
|
|
5105
|
+
videos: z42.array(ProductVideoSchema).default([]),
|
|
5106
|
+
variants: z42.array(ProductVariantSchema).default([]),
|
|
5107
|
+
availableForSale: z42.boolean().default(true),
|
|
5108
|
+
options: z42.array(z42.object({
|
|
5109
|
+
name: z42.string(),
|
|
5110
|
+
values: z42.array(z42.string())
|
|
5016
5111
|
})).optional(),
|
|
5017
|
-
collections:
|
|
5112
|
+
collections: z42.array(z42.string()).optional(),
|
|
5018
5113
|
/** See `SiblingProductSchema`. Default `[]` so renderers can check
|
|
5019
5114
|
* `length > 1` to decide whether to draw the swatch row without a
|
|
5020
5115
|
* presence guard. */
|
|
5021
|
-
colorVariants:
|
|
5022
|
-
rating:
|
|
5023
|
-
value:
|
|
5024
|
-
count:
|
|
5116
|
+
colorVariants: z42.array(SiblingProductSchema).default([]),
|
|
5117
|
+
rating: z42.object({
|
|
5118
|
+
value: z42.number(),
|
|
5119
|
+
count: z42.number()
|
|
5025
5120
|
}).optional(),
|
|
5026
5121
|
/**
|
|
5027
5122
|
* Product reviews surfaced from the brand's review store. SDK
|
|
@@ -5030,12 +5125,12 @@ var ProductSchema = z41.object({
|
|
|
5030
5125
|
* review bodies. Renderers (`Reviews` component, `ProductDetail`,
|
|
5031
5126
|
* etc.) consume directly.
|
|
5032
5127
|
*/
|
|
5033
|
-
reviews:
|
|
5034
|
-
author:
|
|
5035
|
-
rating:
|
|
5036
|
-
content:
|
|
5037
|
-
date:
|
|
5038
|
-
verified:
|
|
5128
|
+
reviews: z42.array(z42.object({
|
|
5129
|
+
author: z42.string(),
|
|
5130
|
+
rating: z42.number(),
|
|
5131
|
+
content: z42.string(),
|
|
5132
|
+
date: z42.string(),
|
|
5133
|
+
verified: z42.boolean().optional()
|
|
5039
5134
|
})).optional(),
|
|
5040
5135
|
/**
|
|
5041
5136
|
* Ghost-entity flag — `true` when the Storefront API could not hydrate
|
|
@@ -5047,7 +5142,7 @@ var ProductSchema = z41.object({
|
|
|
5047
5142
|
* Set exclusively by `createUnavailableProduct()` — never by the
|
|
5048
5143
|
* Storefront mapper.
|
|
5049
5144
|
*/
|
|
5050
|
-
unavailable:
|
|
5145
|
+
unavailable: z42.boolean().default(false)
|
|
5051
5146
|
});
|
|
5052
5147
|
function createUnavailableProduct(gid) {
|
|
5053
5148
|
return {
|
|
@@ -5069,68 +5164,68 @@ function createUnavailableProduct(gid) {
|
|
|
5069
5164
|
function isGhostEntity(value) {
|
|
5070
5165
|
return typeof value === "object" && value !== null && "unavailable" in value && value.unavailable === true;
|
|
5071
5166
|
}
|
|
5072
|
-
var ReviewSchema =
|
|
5073
|
-
id:
|
|
5074
|
-
productId:
|
|
5075
|
-
author:
|
|
5076
|
-
rating:
|
|
5077
|
-
text:
|
|
5078
|
-
date:
|
|
5079
|
-
verified:
|
|
5167
|
+
var ReviewSchema = z42.object({
|
|
5168
|
+
id: z42.string(),
|
|
5169
|
+
productId: z42.string(),
|
|
5170
|
+
author: z42.string(),
|
|
5171
|
+
rating: z42.number(),
|
|
5172
|
+
text: z42.string(),
|
|
5173
|
+
date: z42.string(),
|
|
5174
|
+
verified: z42.boolean()
|
|
5080
5175
|
});
|
|
5081
|
-
var ArticleSchema =
|
|
5082
|
-
id:
|
|
5083
|
-
handle:
|
|
5084
|
-
title:
|
|
5085
|
-
excerpt:
|
|
5086
|
-
content:
|
|
5087
|
-
contentHtml:
|
|
5088
|
-
author:
|
|
5089
|
-
publishedAt:
|
|
5176
|
+
var ArticleSchema = z42.object({
|
|
5177
|
+
id: z42.string(),
|
|
5178
|
+
handle: z42.string().default(""),
|
|
5179
|
+
title: z42.string(),
|
|
5180
|
+
excerpt: z42.string().default(""),
|
|
5181
|
+
content: z42.string().default(""),
|
|
5182
|
+
contentHtml: z42.string().optional(),
|
|
5183
|
+
author: z42.string().default(""),
|
|
5184
|
+
publishedAt: z42.string().default(""),
|
|
5090
5185
|
image: ImageSchema.optional(),
|
|
5091
|
-
blogHandle:
|
|
5092
|
-
tags:
|
|
5186
|
+
blogHandle: z42.string().default(""),
|
|
5187
|
+
tags: z42.array(z42.string()).default([])
|
|
5093
5188
|
});
|
|
5094
|
-
var CmsPageSchema =
|
|
5095
|
-
id:
|
|
5096
|
-
handle:
|
|
5097
|
-
title:
|
|
5098
|
-
body:
|
|
5099
|
-
bodyHtml:
|
|
5100
|
-
bodySummary:
|
|
5101
|
-
updatedAt:
|
|
5102
|
-
seoTitle:
|
|
5103
|
-
seoDescription:
|
|
5189
|
+
var CmsPageSchema = z42.object({
|
|
5190
|
+
id: z42.string(),
|
|
5191
|
+
handle: z42.string().default(""),
|
|
5192
|
+
title: z42.string(),
|
|
5193
|
+
body: z42.string().default(""),
|
|
5194
|
+
bodyHtml: z42.string().optional(),
|
|
5195
|
+
bodySummary: z42.string().default(""),
|
|
5196
|
+
updatedAt: z42.string().default(""),
|
|
5197
|
+
seoTitle: z42.string().optional(),
|
|
5198
|
+
seoDescription: z42.string().optional()
|
|
5104
5199
|
});
|
|
5105
|
-
var CmsPolicySchema =
|
|
5106
|
-
id:
|
|
5200
|
+
var CmsPolicySchema = z42.object({
|
|
5201
|
+
id: z42.string(),
|
|
5107
5202
|
/** Stable policy slot identifier: 'refund' | 'privacy' | 'terms' |
|
|
5108
5203
|
* 'shipping' | 'subscription' | 'warranty' | custom string. Open so
|
|
5109
5204
|
* platforms with custom policy types can extend. */
|
|
5110
|
-
kind:
|
|
5205
|
+
kind: z42.string(),
|
|
5111
5206
|
/** Slug-shaped handle the platform exposes for storefront URLs
|
|
5112
5207
|
* (e.g. `refund-policy`). Empty string when the backend doesn't
|
|
5113
5208
|
* surface one. */
|
|
5114
|
-
handle:
|
|
5115
|
-
title:
|
|
5116
|
-
body:
|
|
5117
|
-
bodyHtml:
|
|
5118
|
-
url:
|
|
5209
|
+
handle: z42.string().default(""),
|
|
5210
|
+
title: z42.string(),
|
|
5211
|
+
body: z42.string().default(""),
|
|
5212
|
+
bodyHtml: z42.string().optional(),
|
|
5213
|
+
url: z42.string().default("")
|
|
5119
5214
|
});
|
|
5120
|
-
var CollectionSchema =
|
|
5121
|
-
id:
|
|
5122
|
-
handle:
|
|
5123
|
-
title:
|
|
5124
|
-
description:
|
|
5215
|
+
var CollectionSchema = z42.object({
|
|
5216
|
+
id: z42.string(),
|
|
5217
|
+
handle: z42.string().default(""),
|
|
5218
|
+
title: z42.string(),
|
|
5219
|
+
description: z42.string().default(""),
|
|
5125
5220
|
image: ImageSchema.optional(),
|
|
5126
|
-
productCount:
|
|
5221
|
+
productCount: z42.number().int().nonnegative().optional()
|
|
5127
5222
|
});
|
|
5128
|
-
var CartLineSchema =
|
|
5129
|
-
id:
|
|
5130
|
-
merchandiseId:
|
|
5131
|
-
productId:
|
|
5132
|
-
title:
|
|
5133
|
-
variantTitle:
|
|
5223
|
+
var CartLineSchema = z42.object({
|
|
5224
|
+
id: z42.string(),
|
|
5225
|
+
merchandiseId: z42.string(),
|
|
5226
|
+
productId: z42.string(),
|
|
5227
|
+
title: z42.string(),
|
|
5228
|
+
variantTitle: z42.string().optional(),
|
|
5134
5229
|
/**
|
|
5135
5230
|
* The variant's option axes as structured pairs (e.g.
|
|
5136
5231
|
* `[{name:'Size', value:'7'}]`). The machine-readable counterpart of
|
|
@@ -5139,10 +5234,10 @@ var CartLineSchema = z41.object({
|
|
|
5139
5234
|
* single-variant products (the degenerate `Title: Default Title` axis
|
|
5140
5235
|
* is normalized away at the adapter boundary).
|
|
5141
5236
|
*/
|
|
5142
|
-
selectedOptions:
|
|
5143
|
-
vendor:
|
|
5144
|
-
sku:
|
|
5145
|
-
quantity:
|
|
5237
|
+
selectedOptions: z42.array(SelectedOptionSchema).optional(),
|
|
5238
|
+
vendor: z42.string().optional(),
|
|
5239
|
+
sku: z42.string().optional(),
|
|
5240
|
+
quantity: z42.number().int().positive(),
|
|
5146
5241
|
unitPrice: MoneySchema,
|
|
5147
5242
|
totalPrice: MoneySchema,
|
|
5148
5243
|
image: ImageSchema.optional(),
|
|
@@ -5162,26 +5257,26 @@ var CartLineSchema = z41.object({
|
|
|
5162
5257
|
* client-minted id the backend rejects, line-tap navigation is
|
|
5163
5258
|
* suppressed, and the money never folds into a settled-looking total.
|
|
5164
5259
|
*/
|
|
5165
|
-
pending:
|
|
5260
|
+
pending: z42.boolean().optional()
|
|
5166
5261
|
});
|
|
5167
5262
|
function isPendingCartLine(line) {
|
|
5168
5263
|
return line.pending === true;
|
|
5169
5264
|
}
|
|
5170
|
-
var CartDiscountCodeSchema =
|
|
5171
|
-
code:
|
|
5172
|
-
applicable:
|
|
5265
|
+
var CartDiscountCodeSchema = z42.object({
|
|
5266
|
+
code: z42.string(),
|
|
5267
|
+
applicable: z42.boolean()
|
|
5173
5268
|
});
|
|
5174
|
-
var CartMessageSchema =
|
|
5175
|
-
kind:
|
|
5269
|
+
var CartMessageSchema = z42.object({
|
|
5270
|
+
kind: z42.enum(["error", "warning", "info"]),
|
|
5176
5271
|
/** Machine code for branching; opaque and backend-defined. */
|
|
5177
|
-
code:
|
|
5272
|
+
code: z42.string(),
|
|
5178
5273
|
/** Human-readable text, meant to be shown as-is. */
|
|
5179
|
-
content:
|
|
5274
|
+
content: z42.string()
|
|
5180
5275
|
});
|
|
5181
|
-
var CartSchema =
|
|
5182
|
-
id:
|
|
5183
|
-
lines:
|
|
5184
|
-
totalQuantity:
|
|
5276
|
+
var CartSchema = z42.object({
|
|
5277
|
+
id: z42.string(),
|
|
5278
|
+
lines: z42.array(CartLineSchema),
|
|
5279
|
+
totalQuantity: z42.number().int().nonnegative(),
|
|
5185
5280
|
subtotal: MoneySchema,
|
|
5186
5281
|
/**
|
|
5187
5282
|
* Cart total after discounts (pre-shipping/tax). Absent when the
|
|
@@ -5191,11 +5286,11 @@ var CartSchema = z41.object({
|
|
|
5191
5286
|
*/
|
|
5192
5287
|
total: MoneySchema.optional(),
|
|
5193
5288
|
/** Discount codes currently attached to the cart. */
|
|
5194
|
-
discountCodes:
|
|
5289
|
+
discountCodes: z42.array(CartDiscountCodeSchema).default([]),
|
|
5195
5290
|
/** Notices the backend attached to this cart — see `CartMessageSchema`.
|
|
5196
5291
|
* Empty when the backend said nothing or does not report them. */
|
|
5197
|
-
messages:
|
|
5198
|
-
checkoutUrl:
|
|
5292
|
+
messages: z42.array(CartMessageSchema).default([]),
|
|
5293
|
+
checkoutUrl: z42.string().optional(),
|
|
5199
5294
|
/**
|
|
5200
5295
|
* Opaque handle this cart is known by in the connector's BACK OFFICE — the
|
|
5201
5296
|
* value a space owner searches there to find the order this cart became.
|
|
@@ -5208,14 +5303,14 @@ var CartSchema = z41.object({
|
|
|
5208
5303
|
* Absent when the platform has no such handle, or while the cart is still the
|
|
5209
5304
|
* client's optimistic paint and its id is client-minted.
|
|
5210
5305
|
*/
|
|
5211
|
-
backOfficeRef:
|
|
5306
|
+
backOfficeRef: z42.string().optional(),
|
|
5212
5307
|
/**
|
|
5213
5308
|
* URL that recreates this cart on the merchant's own store website
|
|
5214
5309
|
* (replace semantics — overwrites any cart the visitor already has
|
|
5215
5310
|
* there). Populated by platform adapters that support it; absent when
|
|
5216
5311
|
* the cart is empty or the URL cannot be built.
|
|
5217
5312
|
*/
|
|
5218
|
-
storeCartUrl:
|
|
5313
|
+
storeCartUrl: z42.string().optional(),
|
|
5219
5314
|
/**
|
|
5220
5315
|
* True while this cart exists only in the client's optimistic paint —
|
|
5221
5316
|
* no backend cart has been created yet, so its `id` is client-minted and
|
|
@@ -5223,7 +5318,7 @@ var CartSchema = z41.object({
|
|
|
5223
5318
|
* `CartLineSchema.pending`: the adapter never sets it, and callers that
|
|
5224
5319
|
* need a real cart id read THIS rather than sniffing the id's shape.
|
|
5225
5320
|
*/
|
|
5226
|
-
pending:
|
|
5321
|
+
pending: z42.boolean().optional()
|
|
5227
5322
|
});
|
|
5228
5323
|
function settledCart(cart) {
|
|
5229
5324
|
if (cart === null || cart === void 0) return null;
|
|
@@ -5231,27 +5326,27 @@ function settledCart(cart) {
|
|
|
5231
5326
|
}
|
|
5232
5327
|
|
|
5233
5328
|
// ../ecommerce/src/review-schemas.ts
|
|
5234
|
-
import { z as
|
|
5329
|
+
import { z as z43 } from "zod";
|
|
5235
5330
|
var PRODUCT_REVIEWS_RESOLVER_KEY = "productReviews";
|
|
5236
|
-
var ProductReviewItemSchema =
|
|
5237
|
-
author:
|
|
5238
|
-
rating:
|
|
5331
|
+
var ProductReviewItemSchema = z43.object({
|
|
5332
|
+
author: z43.string(),
|
|
5333
|
+
rating: z43.number(),
|
|
5239
5334
|
/** The reviewer's own headline ("love"), when they wrote one — the site shows it above `content`. */
|
|
5240
|
-
title:
|
|
5241
|
-
content:
|
|
5242
|
-
date:
|
|
5243
|
-
verified:
|
|
5335
|
+
title: z43.string().optional(),
|
|
5336
|
+
content: z43.string(),
|
|
5337
|
+
date: z43.string(),
|
|
5338
|
+
verified: z43.boolean().optional(),
|
|
5244
5339
|
/**
|
|
5245
5340
|
* Non-empty when the review was written for a grouped SIBLING product rather
|
|
5246
5341
|
* than this one (brands pool reviews across a product line). A surface can
|
|
5247
5342
|
* attribute it; empty / absent ⇒ the product's own review.
|
|
5248
5343
|
*/
|
|
5249
|
-
writtenFor:
|
|
5344
|
+
writtenFor: z43.string().optional()
|
|
5250
5345
|
});
|
|
5251
5346
|
var ProductReviewHighlightSchema = ProductReviewItemSchema.extend({
|
|
5252
5347
|
/** The sentence(s) the ranking fired on. Descriptive — it is what the matcher
|
|
5253
5348
|
* scored, NOT necessarily text that occurs in `content`. */
|
|
5254
|
-
highlight:
|
|
5349
|
+
highlight: z43.string().optional(),
|
|
5255
5350
|
/**
|
|
5256
5351
|
* `highlight` resolved back into `content` as a VERBATIM substring, so a
|
|
5257
5352
|
* surface can mark it with a plain `indexOf` and no matcher of its own.
|
|
@@ -5266,29 +5361,29 @@ var ProductReviewHighlightSchema = ProductReviewItemSchema.extend({
|
|
|
5266
5361
|
* Absent when the passage genuinely has no home in the body (one cut from the
|
|
5267
5362
|
* title). A surface then marks NOTHING rather than guessing at a span.
|
|
5268
5363
|
*/
|
|
5269
|
-
mark:
|
|
5364
|
+
mark: z43.string().optional()
|
|
5270
5365
|
});
|
|
5271
|
-
var ReviewAggregateSchema =
|
|
5272
|
-
value:
|
|
5273
|
-
count:
|
|
5366
|
+
var ReviewAggregateSchema = z43.object({
|
|
5367
|
+
value: z43.number(),
|
|
5368
|
+
count: z43.number()
|
|
5274
5369
|
});
|
|
5275
|
-
var ProductReviewDataSchema =
|
|
5276
|
-
id:
|
|
5370
|
+
var ProductReviewDataSchema = z43.object({
|
|
5371
|
+
id: z43.string(),
|
|
5277
5372
|
/** The product's FULL retrieved set — what a filterable list renders. */
|
|
5278
|
-
reviews:
|
|
5373
|
+
reviews: z43.array(ProductReviewItemSchema).default([]),
|
|
5279
5374
|
aggregate: ReviewAggregateSchema.default({ value: 0, count: 0 }),
|
|
5280
5375
|
/** 5★→1★ star COUNTS over the full set (index 0 = 5-star). */
|
|
5281
|
-
distribution:
|
|
5376
|
+
distribution: z43.array(z43.number()).default([]),
|
|
5282
5377
|
/**
|
|
5283
5378
|
* The reviews that ANSWER the surface's intent, best first. Empty when no
|
|
5284
5379
|
* intent was asked for — never a silent copy of `reviews`.
|
|
5285
5380
|
*/
|
|
5286
|
-
highlights:
|
|
5381
|
+
highlights: z43.array(ProductReviewHighlightSchema).default([]),
|
|
5287
5382
|
/**
|
|
5288
5383
|
* True when the review provider could not be read and nothing is indexed —
|
|
5289
5384
|
* the empty lists mean "not loaded", NOT "this product has no reviews".
|
|
5290
5385
|
*/
|
|
5291
|
-
unavailable:
|
|
5386
|
+
unavailable: z43.boolean().optional()
|
|
5292
5387
|
});
|
|
5293
5388
|
var ProductReviewPayloadSchema = ProductReviewDataSchema.omit({ id: true });
|
|
5294
5389
|
|
|
@@ -5582,9 +5677,9 @@ function readPdpCompanions(config) {
|
|
|
5582
5677
|
}
|
|
5583
5678
|
|
|
5584
5679
|
// ../ecommerce/src/base-attributes.ts
|
|
5585
|
-
import { z as
|
|
5680
|
+
import { z as z44 } from "zod";
|
|
5586
5681
|
var BASE_ATTRIBUTES_CONFIG_KEY = "baseAttributes";
|
|
5587
|
-
var BaseAttributesRecordSchema =
|
|
5682
|
+
var BaseAttributesRecordSchema = z44.record(z44.string(), AttributeDefSchema);
|
|
5588
5683
|
function buildBaseAttributesConfig(attributes) {
|
|
5589
5684
|
return { [BASE_ATTRIBUTES_CONFIG_KEY]: attributes };
|
|
5590
5685
|
}
|
|
@@ -5595,9 +5690,9 @@ function readBaseAttributesConfig(config) {
|
|
|
5595
5690
|
}
|
|
5596
5691
|
|
|
5597
5692
|
// ../ecommerce/src/bucket-labels.ts
|
|
5598
|
-
import { z as
|
|
5693
|
+
import { z as z45 } from "zod";
|
|
5599
5694
|
var BUCKET_LABELS_CONFIG_KEY = "bucketLabels";
|
|
5600
|
-
var BucketLabelsRecordSchema =
|
|
5695
|
+
var BucketLabelsRecordSchema = z45.record(z45.string(), z45.string());
|
|
5601
5696
|
function buildBucketLabelsConfig(labels) {
|
|
5602
5697
|
return { [BUCKET_LABELS_CONFIG_KEY]: labels };
|
|
5603
5698
|
}
|
|
@@ -5623,6 +5718,22 @@ function clearProductNameLookups() {
|
|
|
5623
5718
|
factories.length = 0;
|
|
5624
5719
|
}
|
|
5625
5720
|
|
|
5721
|
+
// ../ecommerce/src/code-discounts.ts
|
|
5722
|
+
var factories2 = [];
|
|
5723
|
+
function registerCodeDiscountSource(factory) {
|
|
5724
|
+
factories2.push(factory);
|
|
5725
|
+
}
|
|
5726
|
+
function resolveCodeDiscountSource(options) {
|
|
5727
|
+
for (const factory of factories2) {
|
|
5728
|
+
const source = factory(options);
|
|
5729
|
+
if (source !== void 0) return source;
|
|
5730
|
+
}
|
|
5731
|
+
return void 0;
|
|
5732
|
+
}
|
|
5733
|
+
function clearCodeDiscountSources() {
|
|
5734
|
+
factories2.length = 0;
|
|
5735
|
+
}
|
|
5736
|
+
|
|
5626
5737
|
// src/session/visitor-locale.ts
|
|
5627
5738
|
var cached = null;
|
|
5628
5739
|
function getVisitorLocale() {
|
|
@@ -5631,6 +5742,30 @@ function getVisitorLocale() {
|
|
|
5631
5742
|
cached = parseBcp47Locale(navigator.language);
|
|
5632
5743
|
return cached;
|
|
5633
5744
|
}
|
|
5745
|
+
function commerceLocaleOf(spaceLocale) {
|
|
5746
|
+
const visitor = getVisitorLocale();
|
|
5747
|
+
if (spaceLocale === void 0) return visitor;
|
|
5748
|
+
const space = parseBcp47Locale(spaceLocale);
|
|
5749
|
+
const out = {};
|
|
5750
|
+
if (space.language !== void 0) out.language = space.language;
|
|
5751
|
+
const country = space.country !== void 0 ? space.country : visitor.country;
|
|
5752
|
+
if (country !== void 0) out.country = country;
|
|
5753
|
+
return out;
|
|
5754
|
+
}
|
|
5755
|
+
|
|
5756
|
+
// src/session/space-locale-context.tsx
|
|
5757
|
+
import * as React from "react";
|
|
5758
|
+
import { jsx } from "react/jsx-runtime";
|
|
5759
|
+
var SpaceLocaleContext = React.createContext(DEFAULT_SPACE_LOCALE);
|
|
5760
|
+
function SpaceLocaleProvider({ locale, children }) {
|
|
5761
|
+
return /* @__PURE__ */ jsx(SpaceLocaleContext.Provider, { value: locale, children });
|
|
5762
|
+
}
|
|
5763
|
+
function useSpaceLocale() {
|
|
5764
|
+
return React.useContext(SpaceLocaleContext);
|
|
5765
|
+
}
|
|
5766
|
+
function useTextDirection() {
|
|
5767
|
+
return textDirectionOf(useSpaceLocale());
|
|
5768
|
+
}
|
|
5634
5769
|
|
|
5635
5770
|
// src/session/clear-registry.ts
|
|
5636
5771
|
var sessionScopedClearHandlers = /* @__PURE__ */ new Set();
|
|
@@ -5690,17 +5825,17 @@ __export(shell_exports, {
|
|
|
5690
5825
|
});
|
|
5691
5826
|
|
|
5692
5827
|
// src/shell/ScrollContainerContext.tsx
|
|
5693
|
-
import
|
|
5694
|
-
import { jsx } from "react/jsx-runtime";
|
|
5695
|
-
var ScrollContainerContext =
|
|
5828
|
+
import React2 from "react";
|
|
5829
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
5830
|
+
var ScrollContainerContext = React2.createContext(null);
|
|
5696
5831
|
function ScrollContainerProvider({
|
|
5697
5832
|
value,
|
|
5698
5833
|
children
|
|
5699
5834
|
}) {
|
|
5700
|
-
return /* @__PURE__ */
|
|
5835
|
+
return /* @__PURE__ */ jsx2(ScrollContainerContext.Provider, { value, children });
|
|
5701
5836
|
}
|
|
5702
5837
|
function useScrollContainerRef() {
|
|
5703
|
-
const ref =
|
|
5838
|
+
const ref = React2.useContext(ScrollContainerContext);
|
|
5704
5839
|
if (!ref) {
|
|
5705
5840
|
throw new Error(
|
|
5706
5841
|
"useScrollContainerRef must be used inside <ScrollContainerProvider> (mounted by FourtyProvider)."
|
|
@@ -5710,31 +5845,31 @@ function useScrollContainerRef() {
|
|
|
5710
5845
|
}
|
|
5711
5846
|
|
|
5712
5847
|
// src/shell/ShellRegistry.tsx
|
|
5713
|
-
import { createContext as
|
|
5714
|
-
import { jsx as
|
|
5715
|
-
var ShellRegistryContext =
|
|
5848
|
+
import { createContext as createContext4, useContext as useContext4 } from "react";
|
|
5849
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
5850
|
+
var ShellRegistryContext = createContext4({});
|
|
5716
5851
|
function ShellRegistryProvider({
|
|
5717
5852
|
registry: registry2,
|
|
5718
5853
|
children
|
|
5719
5854
|
}) {
|
|
5720
|
-
return /* @__PURE__ */
|
|
5855
|
+
return /* @__PURE__ */ jsx3(ShellRegistryContext.Provider, { value: registry2, children });
|
|
5721
5856
|
}
|
|
5722
5857
|
function useShellRegistry() {
|
|
5723
|
-
return
|
|
5858
|
+
return useContext4(ShellRegistryContext);
|
|
5724
5859
|
}
|
|
5725
5860
|
|
|
5726
5861
|
// src/shell/ShellRootContext.tsx
|
|
5727
|
-
import { createContext as
|
|
5728
|
-
var ShellRootContext =
|
|
5862
|
+
import { createContext as createContext5, useContext as useContext5 } from "react";
|
|
5863
|
+
var ShellRootContext = createContext5(null);
|
|
5729
5864
|
function useShellRoot() {
|
|
5730
|
-
const ref =
|
|
5865
|
+
const ref = useContext5(ShellRootContext);
|
|
5731
5866
|
return ref ? ref.current : null;
|
|
5732
5867
|
}
|
|
5733
5868
|
|
|
5734
5869
|
// src/shell/dock-persistence.tsx
|
|
5735
|
-
import
|
|
5736
|
-
import { jsx as
|
|
5737
|
-
var DockPersistenceContext =
|
|
5870
|
+
import React4 from "react";
|
|
5871
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
5872
|
+
var DockPersistenceContext = React4.createContext({
|
|
5738
5873
|
initialOpen: null,
|
|
5739
5874
|
onOpenChange: () => {
|
|
5740
5875
|
}
|
|
@@ -5743,28 +5878,28 @@ function DockPersistenceProvider({
|
|
|
5743
5878
|
value,
|
|
5744
5879
|
children
|
|
5745
5880
|
}) {
|
|
5746
|
-
return /* @__PURE__ */
|
|
5881
|
+
return /* @__PURE__ */ jsx4(DockPersistenceContext.Provider, { value, children });
|
|
5747
5882
|
}
|
|
5748
5883
|
function useDockPersistence() {
|
|
5749
|
-
return
|
|
5884
|
+
return React4.useContext(DockPersistenceContext);
|
|
5750
5885
|
}
|
|
5751
5886
|
|
|
5752
5887
|
// src/shell/use-dock-state.ts
|
|
5753
|
-
import
|
|
5888
|
+
import React7 from "react";
|
|
5754
5889
|
|
|
5755
5890
|
// src/canvas/runtime-context.tsx
|
|
5756
|
-
import { createContext as
|
|
5757
|
-
var FourtyRuntimeContext =
|
|
5891
|
+
import { createContext as createContext6, useContext as useContext6 } from "react";
|
|
5892
|
+
var FourtyRuntimeContext = createContext6(null);
|
|
5758
5893
|
var FourtyRuntimeProvider = FourtyRuntimeContext.Provider;
|
|
5759
5894
|
function useFourtyRuntime() {
|
|
5760
|
-
const runtime =
|
|
5895
|
+
const runtime = useContext6(FourtyRuntimeContext);
|
|
5761
5896
|
if (!runtime) {
|
|
5762
5897
|
throw new Error("useFourtyRuntime must be used within a <FourtyProvider>");
|
|
5763
5898
|
}
|
|
5764
5899
|
return runtime;
|
|
5765
5900
|
}
|
|
5766
5901
|
function useOptionalFourtyRuntime() {
|
|
5767
|
-
return
|
|
5902
|
+
return useContext6(FourtyRuntimeContext);
|
|
5768
5903
|
}
|
|
5769
5904
|
|
|
5770
5905
|
// src/canvas/runtime-hooks.ts
|
|
@@ -5863,21 +5998,21 @@ function useHasLeftSeedHome() {
|
|
|
5863
5998
|
}
|
|
5864
5999
|
|
|
5865
6000
|
// src/shell/use-hydrated.ts
|
|
5866
|
-
import
|
|
6001
|
+
import React5 from "react";
|
|
5867
6002
|
function useHydrated() {
|
|
5868
|
-
const [hydrated, setHydrated] =
|
|
5869
|
-
|
|
6003
|
+
const [hydrated, setHydrated] = React5.useState(false);
|
|
6004
|
+
React5.useEffect(() => {
|
|
5870
6005
|
setHydrated(true);
|
|
5871
6006
|
}, []);
|
|
5872
6007
|
return hydrated;
|
|
5873
6008
|
}
|
|
5874
6009
|
|
|
5875
6010
|
// src/shell/use-overridable-toggle.ts
|
|
5876
|
-
import
|
|
6011
|
+
import React6 from "react";
|
|
5877
6012
|
function useOverridableToggle(defaultValue) {
|
|
5878
|
-
const [override, setOverride] =
|
|
6013
|
+
const [override, setOverride] = React6.useState(null);
|
|
5879
6014
|
const value = override === null ? defaultValue : override;
|
|
5880
|
-
const set =
|
|
6015
|
+
const set = React6.useCallback((next) => {
|
|
5881
6016
|
setOverride(next);
|
|
5882
6017
|
}, []);
|
|
5883
6018
|
const toggle = () => {
|
|
@@ -5894,9 +6029,9 @@ function useDockState(reopenOnMessage, autoOpen) {
|
|
|
5894
6029
|
const hasLeftHome = useHasLeftSeedHome();
|
|
5895
6030
|
const agentDriven = useAgentDriven();
|
|
5896
6031
|
const settled = sessionId !== null;
|
|
5897
|
-
const settledRef =
|
|
5898
|
-
const engagedWhenSettledRef =
|
|
5899
|
-
const hasEngagedRef =
|
|
6032
|
+
const settledRef = React7.useRef(false);
|
|
6033
|
+
const engagedWhenSettledRef = React7.useRef(false);
|
|
6034
|
+
const hasEngagedRef = React7.useRef(initialOpen === true);
|
|
5900
6035
|
const historyIsAccountedFor = initialOpen !== null;
|
|
5901
6036
|
const engagementIsNew = historyIsAccountedFor ? settledRef.current && !engagedWhenSettledRef.current : true;
|
|
5902
6037
|
if (hasLeftHome && engagementIsNew && !agentDriven) hasEngagedRef.current = true;
|
|
@@ -5904,8 +6039,8 @@ function useDockState(reopenOnMessage, autoOpen) {
|
|
|
5904
6039
|
const openDefault = agentDriven || !autoOpen ? false : hydrated ? hasEngagedRef.current : initialOpen === true;
|
|
5905
6040
|
const toggle = useOverridableToggle(openDefault);
|
|
5906
6041
|
const userTurns = messages.reduce((n, m) => m.role === "user" ? n + 1 : n, 0);
|
|
5907
|
-
const prevUserTurns =
|
|
5908
|
-
|
|
6042
|
+
const prevUserTurns = React7.useRef(userTurns);
|
|
6043
|
+
React7.useEffect(() => {
|
|
5909
6044
|
if (!settledRef.current) {
|
|
5910
6045
|
if (!settled) return;
|
|
5911
6046
|
settledRef.current = true;
|
|
@@ -5916,7 +6051,7 @@ function useDockState(reopenOnMessage, autoOpen) {
|
|
|
5916
6051
|
if (reopenOnMessage && autoOpen && !agentDriven && userTurns > prevUserTurns.current) toggle.set(true);
|
|
5917
6052
|
prevUserTurns.current = userTurns;
|
|
5918
6053
|
}, [userTurns, settled, hasLeftHome, reopenOnMessage, autoOpen, agentDriven, toggle.set]);
|
|
5919
|
-
|
|
6054
|
+
React7.useEffect(() => {
|
|
5920
6055
|
onOpenChange(toggle.value);
|
|
5921
6056
|
}, [toggle.value, onOpenChange]);
|
|
5922
6057
|
return { open: toggle.value, toggle: toggle.toggle };
|
|
@@ -5948,7 +6083,7 @@ function useExclusiveOverlay(id, open, close) {
|
|
|
5948
6083
|
}
|
|
5949
6084
|
|
|
5950
6085
|
// src/shell/composer-attachments/use-composer-attachments.ts
|
|
5951
|
-
import * as
|
|
6086
|
+
import * as React8 from "react";
|
|
5952
6087
|
|
|
5953
6088
|
// src/utils/core-utils/mint-id.ts
|
|
5954
6089
|
function mintId(prefix) {
|
|
@@ -5977,27 +6112,29 @@ async function heicToJpeg(file) {
|
|
|
5977
6112
|
|
|
5978
6113
|
// src/shell/composer-attachments/use-composer-attachments.ts
|
|
5979
6114
|
var ATTACHMENT_ACCEPT = ALLOWED_ATTACHMENT_TYPES.join(",");
|
|
5980
|
-
var MAX_MB = Math.round(MAX_ATTACHMENT_BYTES / (1024 * 1024));
|
|
5981
6115
|
function validate(file) {
|
|
5982
|
-
if (file.size === 0) return
|
|
5983
|
-
if (!isAllowedAttachmentType(file.type)) {
|
|
5984
|
-
|
|
5985
|
-
}
|
|
5986
|
-
if (file.size > MAX_ATTACHMENT_BYTES) return `File is larger than ${MAX_MB}MB.`;
|
|
6116
|
+
if (file.size === 0) return { kind: "empty" };
|
|
6117
|
+
if (!isAllowedAttachmentType(file.type)) return { kind: "unsupported_type", mimeType: file.type };
|
|
6118
|
+
if (file.size > MAX_ATTACHMENT_BYTES) return { kind: "too_large", maxMb: MAX_ATTACHMENT_MB };
|
|
5987
6119
|
return null;
|
|
5988
6120
|
}
|
|
6121
|
+
function failureOf(err) {
|
|
6122
|
+
if (err instanceof AttachmentUploadError) return err.failure;
|
|
6123
|
+
console.warn("[attachments] upload rejected without a reason:", err);
|
|
6124
|
+
return { kind: "upload_failed" };
|
|
6125
|
+
}
|
|
5989
6126
|
function useComposerAttachments() {
|
|
5990
6127
|
const session = useFourtySession();
|
|
5991
|
-
const [attachments, setAttachments] =
|
|
5992
|
-
const createdUrls =
|
|
5993
|
-
const update2 =
|
|
6128
|
+
const [attachments, setAttachments] = React8.useState([]);
|
|
6129
|
+
const createdUrls = React8.useRef(/* @__PURE__ */ new Set());
|
|
6130
|
+
const update2 = React8.useCallback((localId, patch) => {
|
|
5994
6131
|
setAttachments((prev) => prev.map((a) => a.localId === localId ? { ...a, ...patch } : a));
|
|
5995
6132
|
}, []);
|
|
5996
|
-
const startUpload =
|
|
6133
|
+
const startUpload = React8.useCallback(
|
|
5997
6134
|
(localId, file) => {
|
|
5998
|
-
const
|
|
5999
|
-
if (
|
|
6000
|
-
update2(localId, { status: "error",
|
|
6135
|
+
const failure = validate(file);
|
|
6136
|
+
if (failure !== null) {
|
|
6137
|
+
update2(localId, { status: "error", failure, name: file.name, mimeType: file.type, size: file.size });
|
|
6001
6138
|
return;
|
|
6002
6139
|
}
|
|
6003
6140
|
const previewUrl = isImageAttachment(file.type) ? URL.createObjectURL(file) : null;
|
|
@@ -6008,19 +6145,16 @@ function useComposerAttachments() {
|
|
|
6008
6145
|
mimeType: file.type,
|
|
6009
6146
|
size: file.size,
|
|
6010
6147
|
previewUrl,
|
|
6011
|
-
|
|
6148
|
+
failure: null
|
|
6012
6149
|
});
|
|
6013
6150
|
session.uploadAttachment(file).then(
|
|
6014
6151
|
(ref) => update2(localId, { status: "ready", ref }),
|
|
6015
|
-
(err) => update2(localId, {
|
|
6016
|
-
status: "error",
|
|
6017
|
-
error: err instanceof Error ? err.message : "Upload failed."
|
|
6018
|
-
})
|
|
6152
|
+
(err) => update2(localId, { status: "error", failure: failureOf(err) })
|
|
6019
6153
|
);
|
|
6020
6154
|
},
|
|
6021
6155
|
[session, update2]
|
|
6022
6156
|
);
|
|
6023
|
-
const addFiles =
|
|
6157
|
+
const addFiles = React8.useCallback(
|
|
6024
6158
|
(files) => {
|
|
6025
6159
|
const list2 = Array.from(files);
|
|
6026
6160
|
for (const file of list2) {
|
|
@@ -6035,7 +6169,7 @@ function useComposerAttachments() {
|
|
|
6035
6169
|
previewUrl: null,
|
|
6036
6170
|
status: "uploading",
|
|
6037
6171
|
ref: null,
|
|
6038
|
-
|
|
6172
|
+
failure: null
|
|
6039
6173
|
}
|
|
6040
6174
|
]);
|
|
6041
6175
|
if (isHeic(file)) {
|
|
@@ -6053,13 +6187,13 @@ function useComposerAttachments() {
|
|
|
6053
6187
|
},
|
|
6054
6188
|
[startUpload]
|
|
6055
6189
|
);
|
|
6056
|
-
const revoke =
|
|
6190
|
+
const revoke = React8.useCallback((url) => {
|
|
6057
6191
|
if (url !== null && createdUrls.current.has(url)) {
|
|
6058
6192
|
URL.revokeObjectURL(url);
|
|
6059
6193
|
createdUrls.current.delete(url);
|
|
6060
6194
|
}
|
|
6061
6195
|
}, []);
|
|
6062
|
-
const remove2 =
|
|
6196
|
+
const remove2 = React8.useCallback(
|
|
6063
6197
|
(localId) => {
|
|
6064
6198
|
setAttachments((prev) => {
|
|
6065
6199
|
const target = prev.find((a) => a.localId === localId);
|
|
@@ -6069,12 +6203,12 @@ function useComposerAttachments() {
|
|
|
6069
6203
|
},
|
|
6070
6204
|
[revoke]
|
|
6071
6205
|
);
|
|
6072
|
-
const clear =
|
|
6206
|
+
const clear = React8.useCallback(() => {
|
|
6073
6207
|
for (const url of createdUrls.current) URL.revokeObjectURL(url);
|
|
6074
6208
|
createdUrls.current.clear();
|
|
6075
6209
|
setAttachments([]);
|
|
6076
6210
|
}, []);
|
|
6077
|
-
|
|
6211
|
+
React8.useEffect(
|
|
6078
6212
|
() => () => {
|
|
6079
6213
|
for (const url of createdUrls.current) URL.revokeObjectURL(url);
|
|
6080
6214
|
createdUrls.current.clear();
|
|
@@ -6082,7 +6216,7 @@ function useComposerAttachments() {
|
|
|
6082
6216
|
[]
|
|
6083
6217
|
);
|
|
6084
6218
|
const hasPending = attachments.some((a) => a.status === "uploading");
|
|
6085
|
-
const readyRefs =
|
|
6219
|
+
const readyRefs = React8.useMemo(
|
|
6086
6220
|
() => attachments.filter((a) => a.ref !== null).map((a) => a.ref),
|
|
6087
6221
|
[attachments]
|
|
6088
6222
|
);
|
|
@@ -6090,7 +6224,7 @@ function useComposerAttachments() {
|
|
|
6090
6224
|
}
|
|
6091
6225
|
|
|
6092
6226
|
// src/shell/use-prompt-composer.ts
|
|
6093
|
-
import * as
|
|
6227
|
+
import * as React9 from "react";
|
|
6094
6228
|
|
|
6095
6229
|
// src/voice/use-voice-capture.ts
|
|
6096
6230
|
import { useCallback as useCallback4, useEffect as useEffect4, useRef as useRef4, useState as useState3 } from "react";
|
|
@@ -6362,26 +6496,26 @@ function usePromptComposer(options = {}) {
|
|
|
6362
6496
|
const internalAttach = useComposerAttachments();
|
|
6363
6497
|
const attach = attachmentsController !== void 0 ? attachmentsController : internalAttach;
|
|
6364
6498
|
const [value, setValue] = useComposerDraft();
|
|
6365
|
-
const dictationBaseRef =
|
|
6366
|
-
const handleDictationResult =
|
|
6499
|
+
const dictationBaseRef = React9.useRef("");
|
|
6500
|
+
const handleDictationResult = React9.useCallback((transcript) => {
|
|
6367
6501
|
const base = dictationBaseRef.current;
|
|
6368
6502
|
setValue(base.length > 0 ? `${base} ${transcript}` : transcript);
|
|
6369
6503
|
}, [setValue]);
|
|
6370
|
-
const submitRef =
|
|
6504
|
+
const submitRef = React9.useRef(() => {
|
|
6371
6505
|
});
|
|
6372
6506
|
const voiceCapture = useVoiceCapture({
|
|
6373
6507
|
onResult: handleDictationResult,
|
|
6374
6508
|
onCommit: () => submitRef.current()
|
|
6375
6509
|
});
|
|
6376
|
-
const valueRef =
|
|
6510
|
+
const valueRef = React9.useRef(value);
|
|
6377
6511
|
valueRef.current = value;
|
|
6378
|
-
const toggleDictation =
|
|
6512
|
+
const toggleDictation = React9.useCallback(() => {
|
|
6379
6513
|
if (voiceCapture.state !== "listening") {
|
|
6380
6514
|
dictationBaseRef.current = valueRef.current;
|
|
6381
6515
|
}
|
|
6382
6516
|
voiceCapture.toggle();
|
|
6383
6517
|
}, [voiceCapture]);
|
|
6384
|
-
const onPaste =
|
|
6518
|
+
const onPaste = React9.useCallback(
|
|
6385
6519
|
(e) => {
|
|
6386
6520
|
const files = e.clipboardData.files;
|
|
6387
6521
|
if (files.length > 0) {
|
|
@@ -6392,7 +6526,7 @@ function usePromptComposer(options = {}) {
|
|
|
6392
6526
|
[attach]
|
|
6393
6527
|
);
|
|
6394
6528
|
const canSend = (value.trim().length > 0 || attach.readyRefs.length > 0) && !attach.hasPending;
|
|
6395
|
-
const submit =
|
|
6529
|
+
const submit = React9.useCallback(() => {
|
|
6396
6530
|
if (!((value.trim().length > 0 || attach.readyRefs.length > 0) && !attach.hasPending)) return;
|
|
6397
6531
|
voiceCapture.cancel();
|
|
6398
6532
|
session.sendMessage(
|
|
@@ -6419,10 +6553,10 @@ function usePromptComposer(options = {}) {
|
|
|
6419
6553
|
}
|
|
6420
6554
|
|
|
6421
6555
|
// src/shell/use-composer-chip-select.ts
|
|
6422
|
-
import * as
|
|
6556
|
+
import * as React10 from "react";
|
|
6423
6557
|
function useComposerChipSelect() {
|
|
6424
6558
|
const session = useFourtySession();
|
|
6425
|
-
return
|
|
6559
|
+
return React10.useCallback(
|
|
6426
6560
|
(action) => {
|
|
6427
6561
|
session.dispatchSuggestionAction({
|
|
6428
6562
|
id: action.id,
|
|
@@ -6436,10 +6570,10 @@ function useComposerChipSelect() {
|
|
|
6436
6570
|
}
|
|
6437
6571
|
|
|
6438
6572
|
// src/shell/use-turn-ask-reply.ts
|
|
6439
|
-
import * as
|
|
6573
|
+
import * as React11 from "react";
|
|
6440
6574
|
function useTurnAskReply() {
|
|
6441
6575
|
const session = useFourtySession();
|
|
6442
|
-
return
|
|
6576
|
+
return React11.useCallback(
|
|
6443
6577
|
(answer) => {
|
|
6444
6578
|
session.dispatchSuggestionAction({ id: `ask-${answer}`, label: answer, type: "message", payload: { text: answer, followUp: true } });
|
|
6445
6579
|
},
|
|
@@ -6448,14 +6582,14 @@ function useTurnAskReply() {
|
|
|
6448
6582
|
}
|
|
6449
6583
|
|
|
6450
6584
|
// src/shell/turn-ask-placement.tsx
|
|
6451
|
-
import * as
|
|
6452
|
-
import { jsx as
|
|
6453
|
-
var TurnAskPlacementContext =
|
|
6585
|
+
import * as React12 from "react";
|
|
6586
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
6587
|
+
var TurnAskPlacementContext = React12.createContext("prose");
|
|
6454
6588
|
function TurnAskPlacementProvider({ placement, children }) {
|
|
6455
|
-
return /* @__PURE__ */
|
|
6589
|
+
return /* @__PURE__ */ jsx5(TurnAskPlacementContext.Provider, { value: placement, children });
|
|
6456
6590
|
}
|
|
6457
6591
|
function useTurnAskPlacement() {
|
|
6458
|
-
return
|
|
6592
|
+
return React12.useContext(TurnAskPlacementContext);
|
|
6459
6593
|
}
|
|
6460
6594
|
|
|
6461
6595
|
// src/shell/use-go-home.ts
|
|
@@ -6472,10 +6606,10 @@ function useGoHome() {
|
|
|
6472
6606
|
}
|
|
6473
6607
|
|
|
6474
6608
|
// src/shell/use-menu-item-select.ts
|
|
6475
|
-
import * as
|
|
6609
|
+
import * as React13 from "react";
|
|
6476
6610
|
function useMenuItemSelect() {
|
|
6477
6611
|
const session = useFourtySession();
|
|
6478
|
-
return
|
|
6612
|
+
return React13.useCallback(
|
|
6479
6613
|
(item) => {
|
|
6480
6614
|
const payload = item.action.payload === void 0 ? {} : item.action.payload;
|
|
6481
6615
|
session.dispatchSuggestionAction({
|
|
@@ -6528,15 +6662,15 @@ function useThreadRows() {
|
|
|
6528
6662
|
}
|
|
6529
6663
|
|
|
6530
6664
|
// src/shell/conversation/use-conversation-page.ts
|
|
6531
|
-
import * as
|
|
6665
|
+
import * as React17 from "react";
|
|
6532
6666
|
|
|
6533
6667
|
// src/canvas/use-is-seed-home.ts
|
|
6534
|
-
import * as
|
|
6668
|
+
import * as React14 from "react";
|
|
6535
6669
|
function useIsSeedHome() {
|
|
6536
6670
|
const layout = useDisplayedLayout();
|
|
6537
6671
|
const turn = useTurn();
|
|
6538
6672
|
const sessionState = useSessionState();
|
|
6539
|
-
return
|
|
6673
|
+
return React14.useMemo(() => {
|
|
6540
6674
|
if (sessionState.seedLayout === null) return false;
|
|
6541
6675
|
if (turn.index !== 0) return false;
|
|
6542
6676
|
if (turn.userMessage !== "") return false;
|
|
@@ -6772,8 +6906,8 @@ var PRESENCE_LIFECYCLE = {
|
|
|
6772
6906
|
};
|
|
6773
6907
|
|
|
6774
6908
|
// ../spacestation/src/widgets/presence/profile.ts
|
|
6775
|
-
import { z as
|
|
6776
|
-
var PresenceProfileSchema =
|
|
6909
|
+
import { z as z46 } from "zod";
|
|
6910
|
+
var PresenceProfileSchema = z46.object({
|
|
6777
6911
|
/**
|
|
6778
6912
|
* How much the agent SPEAKS in presence.
|
|
6779
6913
|
* - 'off' the faculty generates no prose at all. Zero tokens, and
|
|
@@ -6783,14 +6917,14 @@ var PresenceProfileSchema = z45.object({
|
|
|
6783
6917
|
* - 'terse' one lead line per turn. The default — see below.
|
|
6784
6918
|
* - 'full' a lead line plus asides beside individual elements.
|
|
6785
6919
|
*/
|
|
6786
|
-
voice:
|
|
6920
|
+
voice: z46.enum(["off", "terse", "full"]),
|
|
6787
6921
|
/**
|
|
6788
6922
|
* Which source kinds this space surfaces. 'all' = every tool that declares a
|
|
6789
6923
|
* `sourceKind`. An explicit list lets a space stay quiet about lookups its
|
|
6790
6924
|
* visitors would find uninteresting (policy checks on a fashion space)
|
|
6791
6925
|
* without the tool having to lie about what it is.
|
|
6792
6926
|
*/
|
|
6793
|
-
sources:
|
|
6927
|
+
sources: z46.union([z46.array(z46.string()), z46.literal("all")]),
|
|
6794
6928
|
/**
|
|
6795
6929
|
* Which facts render.
|
|
6796
6930
|
* - 'inferred-only' hides `provenance: 'stated'` facts. The default and the
|
|
@@ -6799,7 +6933,7 @@ var PresenceProfileSchema = z45.object({
|
|
|
6799
6933
|
* - 'all' shows stated facts too — for spaces where confirming the brief
|
|
6800
6934
|
* back is itself the product (intake, configuration).
|
|
6801
6935
|
*/
|
|
6802
|
-
facts:
|
|
6936
|
+
facts: z46.enum(["inferred-only", "all"])
|
|
6803
6937
|
});
|
|
6804
6938
|
var DEFAULT_PRESENCE_PROFILE = {
|
|
6805
6939
|
voice: "terse",
|
|
@@ -6808,18 +6942,18 @@ var DEFAULT_PRESENCE_PROFILE = {
|
|
|
6808
6942
|
};
|
|
6809
6943
|
|
|
6810
6944
|
// src/widgets/presence/runtime-context.tsx
|
|
6811
|
-
import { createContext as
|
|
6812
|
-
var PresenceRuntimeContext =
|
|
6945
|
+
import { createContext as createContext8, useContext as useContext8 } from "react";
|
|
6946
|
+
var PresenceRuntimeContext = createContext8(null);
|
|
6813
6947
|
var PresenceRuntimeProvider = PresenceRuntimeContext.Provider;
|
|
6814
6948
|
function usePresenceRuntime() {
|
|
6815
|
-
const runtime =
|
|
6949
|
+
const runtime = useContext8(PresenceRuntimeContext);
|
|
6816
6950
|
if (!runtime) {
|
|
6817
6951
|
throw new Error("usePresenceRuntime must be used within a <FourtyProvider>");
|
|
6818
6952
|
}
|
|
6819
6953
|
return runtime;
|
|
6820
6954
|
}
|
|
6821
6955
|
function useOptionalPresenceRuntime() {
|
|
6822
|
-
return
|
|
6956
|
+
return useContext8(PresenceRuntimeContext);
|
|
6823
6957
|
}
|
|
6824
6958
|
function useScanning() {
|
|
6825
6959
|
return usePresenceRuntime().useScanning();
|
|
@@ -6995,17 +7129,17 @@ function useAgentPresenceFresh(flowId = PRESENCE_FLOW) {
|
|
|
6995
7129
|
import { useMemo as useMemo5 } from "react";
|
|
6996
7130
|
|
|
6997
7131
|
// src/catalog/CatalogContext.tsx
|
|
6998
|
-
import { createContext as
|
|
6999
|
-
import { jsx as
|
|
7000
|
-
var CatalogContext =
|
|
7132
|
+
import { createContext as createContext9, useContext as useContext9 } from "react";
|
|
7133
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
7134
|
+
var CatalogContext = createContext9({});
|
|
7001
7135
|
function CatalogProvider({
|
|
7002
7136
|
catalog,
|
|
7003
7137
|
children
|
|
7004
7138
|
}) {
|
|
7005
|
-
return /* @__PURE__ */
|
|
7139
|
+
return /* @__PURE__ */ jsx6(CatalogContext.Provider, { value: catalog, children });
|
|
7006
7140
|
}
|
|
7007
7141
|
function useComponentCatalog() {
|
|
7008
|
-
return
|
|
7142
|
+
return useContext9(CatalogContext);
|
|
7009
7143
|
}
|
|
7010
7144
|
|
|
7011
7145
|
// src/canvas/layout-entity-refs.ts
|
|
@@ -7065,10 +7199,10 @@ function useAgentPresence(flowId = PRESENCE_FLOW) {
|
|
|
7065
7199
|
}
|
|
7066
7200
|
|
|
7067
7201
|
// src/widgets/presence/use-forget-fact.ts
|
|
7068
|
-
import * as
|
|
7202
|
+
import * as React16 from "react";
|
|
7069
7203
|
|
|
7070
7204
|
// src/widgets/presence/use-optimistic-flow-set.ts
|
|
7071
|
-
import * as
|
|
7205
|
+
import * as React15 from "react";
|
|
7072
7206
|
function readKeys(data) {
|
|
7073
7207
|
if (typeof data !== "object" || data === null || !("keys" in data)) return [];
|
|
7074
7208
|
const raw = data.keys;
|
|
@@ -7077,8 +7211,8 @@ function readKeys(data) {
|
|
|
7077
7211
|
function useOptimisticFlowSet(flowId) {
|
|
7078
7212
|
const keys = readKeys(useAgentFlow(flowId));
|
|
7079
7213
|
const joined = keys.join("\0");
|
|
7080
|
-
const set =
|
|
7081
|
-
return
|
|
7214
|
+
const set = React15.useMemo(() => new Set(keys), [joined]);
|
|
7215
|
+
return React15.useMemo(
|
|
7082
7216
|
() => ({
|
|
7083
7217
|
has: (key) => set.has(key),
|
|
7084
7218
|
add: (key) => {
|
|
@@ -7094,7 +7228,7 @@ function useOptimisticFlowSet(flowId) {
|
|
|
7094
7228
|
function useReconcileFlowSet(flowId, presentKeys) {
|
|
7095
7229
|
const data = useAgentFlow(flowId);
|
|
7096
7230
|
const presentJoined = presentKeys === null ? null : [...presentKeys].join("\0");
|
|
7097
|
-
|
|
7231
|
+
React15.useEffect(() => {
|
|
7098
7232
|
if (presentKeys === null) return;
|
|
7099
7233
|
const keys = readKeys(data);
|
|
7100
7234
|
if (keys.length === 0) return;
|
|
@@ -7116,7 +7250,7 @@ var useUndismissedFacts = useVisibleFactList;
|
|
|
7116
7250
|
function useForgetFact() {
|
|
7117
7251
|
const { sendImmediateSignal } = useFourtySession();
|
|
7118
7252
|
const dismissed = useOptimisticFlowSet(DISMISSED_FLOW);
|
|
7119
|
-
const forget =
|
|
7253
|
+
const forget = React16.useCallback(
|
|
7120
7254
|
(f) => {
|
|
7121
7255
|
dismissed.add(f.label);
|
|
7122
7256
|
sendImmediateSignal({ type: PRESENCE_FACT_DISMISS_SIGNAL, payload: { label: f.label, value: f.value } });
|
|
@@ -7167,7 +7301,7 @@ function useConversationPage() {
|
|
|
7167
7301
|
const presence = useConversationPresence();
|
|
7168
7302
|
const suggestions = useSuggestionsWithDefaults();
|
|
7169
7303
|
const followUp = useComposerChipSelect();
|
|
7170
|
-
const onWelcomePage =
|
|
7304
|
+
const onWelcomePage = React17.useMemo(
|
|
7171
7305
|
() => seedLayout !== null && JSON.stringify(layout) === JSON.stringify(seedLayout),
|
|
7172
7306
|
[layout, seedLayout]
|
|
7173
7307
|
);
|
|
@@ -7235,14 +7369,14 @@ function findThreadHeadroom(scroller) {
|
|
|
7235
7369
|
}
|
|
7236
7370
|
|
|
7237
7371
|
// src/shell/thread-scroll/ThreadHeadroom.tsx
|
|
7238
|
-
import { jsx as
|
|
7372
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
7239
7373
|
var HEADROOM_STYLE = { height: 0, flexShrink: 0 };
|
|
7240
7374
|
function ThreadHeadroom() {
|
|
7241
|
-
return /* @__PURE__ */
|
|
7375
|
+
return /* @__PURE__ */ jsx7("div", { ...{ [THREAD_HEADROOM_ATTR]: "" }, "aria-hidden": true, style: HEADROOM_STYLE });
|
|
7242
7376
|
}
|
|
7243
7377
|
|
|
7244
7378
|
// src/shell/thread-scroll/use-pin-turn-to-top.ts
|
|
7245
|
-
import * as
|
|
7379
|
+
import * as React18 from "react";
|
|
7246
7380
|
|
|
7247
7381
|
// src/canvas/dom-targets.ts
|
|
7248
7382
|
var ACTIVE_PANEL_ATTR = "data-fourty-panel-active";
|
|
@@ -7419,7 +7553,7 @@ function pinTurnHead(scroller, row, options) {
|
|
|
7419
7553
|
|
|
7420
7554
|
// src/shell/thread-scroll/use-pin-turn-to-top.ts
|
|
7421
7555
|
function usePinTurnToTop({ scrollerRef, turnRef, turnId }) {
|
|
7422
|
-
|
|
7556
|
+
React18.useEffect(() => {
|
|
7423
7557
|
if (turnId === null) return;
|
|
7424
7558
|
const scroller = scrollerRef.current;
|
|
7425
7559
|
const row = turnRef.current;
|
|
@@ -7440,10 +7574,10 @@ function usePinTurnToTop({ scrollerRef, turnRef, turnId }) {
|
|
|
7440
7574
|
}
|
|
7441
7575
|
|
|
7442
7576
|
// src/shell/thread-scroll/use-scroll-has-more-below.ts
|
|
7443
|
-
import * as
|
|
7577
|
+
import * as React19 from "react";
|
|
7444
7578
|
function useScrollHasMoreBelow(scroller, thresholdPx = 16) {
|
|
7445
|
-
const [hasMore, setHasMore] =
|
|
7446
|
-
|
|
7579
|
+
const [hasMore, setHasMore] = React19.useState(false);
|
|
7580
|
+
React19.useEffect(() => {
|
|
7447
7581
|
if (scroller === null) return;
|
|
7448
7582
|
const view = scroller.ownerDocument.defaultView;
|
|
7449
7583
|
if (view === null) return;
|
|
@@ -7483,9 +7617,9 @@ function threadRowAttrs(key) {
|
|
|
7483
7617
|
}
|
|
7484
7618
|
|
|
7485
7619
|
// src/shell/thread-scroll/use-thread-jump-marks.ts
|
|
7486
|
-
import * as
|
|
7620
|
+
import * as React20 from "react";
|
|
7487
7621
|
function useThreadJumpMarks(rows) {
|
|
7488
|
-
return
|
|
7622
|
+
return React20.useMemo(
|
|
7489
7623
|
() => rows.filter((row) => row.visitorText.length > 0).map((row) => ({
|
|
7490
7624
|
key: row.key,
|
|
7491
7625
|
label: row.visitorText,
|
|
@@ -7499,7 +7633,7 @@ function useThreadJumpMarks(rows) {
|
|
|
7499
7633
|
}
|
|
7500
7634
|
|
|
7501
7635
|
// src/shell/thread-scroll/use-thread-landing.ts
|
|
7502
|
-
import * as
|
|
7636
|
+
import * as React21 from "react";
|
|
7503
7637
|
|
|
7504
7638
|
// src/shell/thread-scroll/settle-thread-row.ts
|
|
7505
7639
|
var SETTLE_MS = 1200;
|
|
@@ -7563,11 +7697,11 @@ function settleThreadRow(scroller, rowKey, behavior = "smooth") {
|
|
|
7563
7697
|
}
|
|
7564
7698
|
|
|
7565
7699
|
// src/shell/thread-scroll/use-thread-landing.ts
|
|
7566
|
-
var useIsomorphicLayoutEffect = typeof window === "undefined" ?
|
|
7700
|
+
var useIsomorphicLayoutEffect = typeof window === "undefined" ? React21.useEffect : React21.useLayoutEffect;
|
|
7567
7701
|
function useThreadLanding(scroller, relandKey = 0) {
|
|
7568
7702
|
const { turnId, seq } = useExplicitTurnSelection();
|
|
7569
|
-
const openedWith =
|
|
7570
|
-
const landedRef =
|
|
7703
|
+
const openedWith = React21.useRef({ turnId, seq });
|
|
7704
|
+
const landedRef = React21.useRef(null);
|
|
7571
7705
|
useIsomorphicLayoutEffect(() => {
|
|
7572
7706
|
if (scroller === null) return;
|
|
7573
7707
|
if (turnId !== null) {
|
|
@@ -7608,10 +7742,10 @@ function settleToHead(scroller) {
|
|
|
7608
7742
|
}
|
|
7609
7743
|
|
|
7610
7744
|
// src/provider/providers/handler-registry.ts
|
|
7611
|
-
import { createContext as
|
|
7612
|
-
var HandlerRegistryContext =
|
|
7745
|
+
import { createContext as createContext10, useContext as useContext10, useEffect as useEffect9 } from "react";
|
|
7746
|
+
var HandlerRegistryContext = createContext10(null);
|
|
7613
7747
|
function useRegisterSignalHandlers(handlers) {
|
|
7614
|
-
const registry2 =
|
|
7748
|
+
const registry2 = useContext10(HandlerRegistryContext);
|
|
7615
7749
|
useEffect9(() => {
|
|
7616
7750
|
if (!registry2) return;
|
|
7617
7751
|
return registry2.register(handlers);
|
|
@@ -7622,7 +7756,7 @@ function useRegisterSignalHandlers(handlers) {
|
|
|
7622
7756
|
var AGENT_ASK_SIGNAL = "agent_ask";
|
|
7623
7757
|
|
|
7624
7758
|
// src/provider/use-clamp-toggle.ts
|
|
7625
|
-
import
|
|
7759
|
+
import React22 from "react";
|
|
7626
7760
|
|
|
7627
7761
|
// src/shared/use-expandable.ts
|
|
7628
7762
|
import { useCallback as useCallback10, useState as useState5 } from "react";
|
|
@@ -7635,9 +7769,9 @@ function useExpandable(initial = false) {
|
|
|
7635
7769
|
// src/provider/use-clamp-toggle.ts
|
|
7636
7770
|
function useClampToggle(contentKey) {
|
|
7637
7771
|
const { expanded, toggle } = useExpandable(false);
|
|
7638
|
-
const [overflowing, setOverflowing] =
|
|
7639
|
-
const ref =
|
|
7640
|
-
|
|
7772
|
+
const [overflowing, setOverflowing] = React22.useState(false);
|
|
7773
|
+
const ref = React22.useRef(null);
|
|
7774
|
+
React22.useEffect(() => {
|
|
7641
7775
|
const el = ref.current;
|
|
7642
7776
|
if (el === null) return;
|
|
7643
7777
|
if (expanded) return;
|
|
@@ -7653,16 +7787,16 @@ function useClampToggle(contentKey) {
|
|
|
7653
7787
|
}
|
|
7654
7788
|
|
|
7655
7789
|
// src/provider/use-timed-flag.ts
|
|
7656
|
-
import
|
|
7790
|
+
import React23 from "react";
|
|
7657
7791
|
function useTimedFlag(durationMs) {
|
|
7658
|
-
const [flag, setFlag] =
|
|
7659
|
-
const timerRef =
|
|
7660
|
-
|
|
7792
|
+
const [flag, setFlag] = React23.useState(false);
|
|
7793
|
+
const timerRef = React23.useRef(null);
|
|
7794
|
+
React23.useEffect(() => {
|
|
7661
7795
|
return () => {
|
|
7662
7796
|
if (timerRef.current !== null) window.clearTimeout(timerRef.current);
|
|
7663
7797
|
};
|
|
7664
7798
|
}, []);
|
|
7665
|
-
const trigger =
|
|
7799
|
+
const trigger = React23.useCallback(() => {
|
|
7666
7800
|
if (timerRef.current !== null) window.clearTimeout(timerRef.current);
|
|
7667
7801
|
setFlag(true);
|
|
7668
7802
|
timerRef.current = window.setTimeout(() => {
|
|
@@ -7691,6 +7825,7 @@ __export(canvas_exports, {
|
|
|
7691
7825
|
GENERATION_EASE: () => GENERATION_EASE,
|
|
7692
7826
|
GenerationStyleContext: () => GenerationStyleContext,
|
|
7693
7827
|
GenerationStyleProvider: () => GenerationStyleProvider,
|
|
7828
|
+
HydrationNoticeProvider: () => HydrationNoticeProvider,
|
|
7694
7829
|
INITIAL_NAV_PRESENTATION: () => INITIAL_NAV_PRESENTATION,
|
|
7695
7830
|
ITEM_IDENTITY_ATTR: () => ITEM_IDENTITY_ATTR,
|
|
7696
7831
|
ItemTransitionGroup: () => ItemTransitionGroup,
|
|
@@ -7750,6 +7885,7 @@ __export(canvas_exports, {
|
|
|
7750
7885
|
useGenerationStyle: () => useGenerationStyle,
|
|
7751
7886
|
useHasLeftSeedHome: () => useHasLeftSeedHome,
|
|
7752
7887
|
useHistoryNav: () => useHistoryNav,
|
|
7888
|
+
useHydrationNotice: () => useHydrationNotice,
|
|
7753
7889
|
useInteraction: () => useInteraction,
|
|
7754
7890
|
useIsSeedHome: () => useIsSeedHome,
|
|
7755
7891
|
useLayout: () => useLayout,
|
|
@@ -7773,28 +7909,39 @@ __export(canvas_exports, {
|
|
|
7773
7909
|
});
|
|
7774
7910
|
|
|
7775
7911
|
// src/canvas/canvas-tail.tsx
|
|
7776
|
-
import * as
|
|
7777
|
-
import { jsx as
|
|
7778
|
-
var CanvasTailContext =
|
|
7912
|
+
import * as React24 from "react";
|
|
7913
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
7914
|
+
var CanvasTailContext = React24.createContext(null);
|
|
7779
7915
|
function CanvasTailProvider({
|
|
7780
7916
|
tail,
|
|
7781
7917
|
children
|
|
7782
7918
|
}) {
|
|
7783
|
-
return /* @__PURE__ */
|
|
7919
|
+
return /* @__PURE__ */ jsx8(CanvasTailContext.Provider, { value: tail, children });
|
|
7784
7920
|
}
|
|
7785
7921
|
function useCanvasTail() {
|
|
7786
|
-
return
|
|
7922
|
+
return React24.useContext(CanvasTailContext);
|
|
7787
7923
|
}
|
|
7788
7924
|
function CanvasTailMount({
|
|
7789
7925
|
isActive
|
|
7790
7926
|
}) {
|
|
7791
7927
|
const Tail = useCanvasTail();
|
|
7792
7928
|
if (!isActive || Tail === null) return null;
|
|
7793
|
-
return /* @__PURE__ */
|
|
7929
|
+
return /* @__PURE__ */ jsx8(Tail, {});
|
|
7930
|
+
}
|
|
7931
|
+
|
|
7932
|
+
// src/canvas/hydration-notice.tsx
|
|
7933
|
+
import * as React25 from "react";
|
|
7934
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
7935
|
+
var HydrationNoticeContext = React25.createContext(null);
|
|
7936
|
+
function HydrationNoticeProvider({ notice, children }) {
|
|
7937
|
+
return /* @__PURE__ */ jsx9(HydrationNoticeContext.Provider, { value: notice, children });
|
|
7938
|
+
}
|
|
7939
|
+
function useHydrationNotice() {
|
|
7940
|
+
return React25.useContext(HydrationNoticeContext);
|
|
7794
7941
|
}
|
|
7795
7942
|
|
|
7796
7943
|
// src/canvas/GenerationStyleContext.tsx
|
|
7797
|
-
import { createContext as
|
|
7944
|
+
import { createContext as createContext13, useContext as useContext13 } from "react";
|
|
7798
7945
|
|
|
7799
7946
|
// src/canvas/generation-style.ts
|
|
7800
7947
|
var DEFAULT_GENERATION_TIMINGS = {
|
|
@@ -7820,19 +7967,19 @@ var DEFAULT_GENERATION_STYLE = {
|
|
|
7820
7967
|
var GENERATION_EASE = [0.76, 0, 0.24, 1];
|
|
7821
7968
|
|
|
7822
7969
|
// src/canvas/GenerationStyleContext.tsx
|
|
7823
|
-
var GenerationStyleContext =
|
|
7970
|
+
var GenerationStyleContext = createContext13(DEFAULT_GENERATION_STYLE);
|
|
7824
7971
|
var GenerationStyleProvider = GenerationStyleContext.Provider;
|
|
7825
7972
|
function useGenerationStyle() {
|
|
7826
|
-
return
|
|
7973
|
+
return useContext13(GenerationStyleContext);
|
|
7827
7974
|
}
|
|
7828
7975
|
|
|
7829
7976
|
// src/canvas/ShimmerSweep.tsx
|
|
7830
7977
|
import { motion, useReducedMotion } from "framer-motion";
|
|
7831
|
-
import { jsx as
|
|
7978
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
7832
7979
|
function ShimmerSweep({ durationS }) {
|
|
7833
7980
|
const reduce = useReducedMotion();
|
|
7834
7981
|
if (reduce === true) return null;
|
|
7835
|
-
return /* @__PURE__ */
|
|
7982
|
+
return /* @__PURE__ */ jsx10(
|
|
7836
7983
|
motion.div,
|
|
7837
7984
|
{
|
|
7838
7985
|
"aria-hidden": true,
|
|
@@ -7850,14 +7997,14 @@ function ShimmerSweep({ durationS }) {
|
|
|
7850
7997
|
}
|
|
7851
7998
|
|
|
7852
7999
|
// src/canvas/TransitionContext.tsx
|
|
7853
|
-
import
|
|
8000
|
+
import React26, { createContext as createContext14, useContext as useContext14 } from "react";
|
|
7854
8001
|
import { AnimatePresence, motion as motion2 } from "framer-motion";
|
|
7855
|
-
import { jsx as
|
|
8002
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
7856
8003
|
function FadeGroup({ children }) {
|
|
7857
|
-
return /* @__PURE__ */
|
|
8004
|
+
return /* @__PURE__ */ jsx11(AnimatePresence, { mode: "popLayout", initial: false, children });
|
|
7858
8005
|
}
|
|
7859
|
-
var FadeItem =
|
|
7860
|
-
return /* @__PURE__ */
|
|
8006
|
+
var FadeItem = React26.forwardRef(function FadeItem2({ id, children, style, className }, ref) {
|
|
8007
|
+
return /* @__PURE__ */ jsx11(
|
|
7861
8008
|
motion2.div,
|
|
7862
8009
|
{
|
|
7863
8010
|
ref,
|
|
@@ -7872,49 +8019,49 @@ var FadeTransition = {
|
|
|
7872
8019
|
Group: FadeGroup,
|
|
7873
8020
|
Item: FadeItem
|
|
7874
8021
|
};
|
|
7875
|
-
var TransitionContext =
|
|
8022
|
+
var TransitionContext = createContext14(FadeTransition);
|
|
7876
8023
|
function TransitionProvider({
|
|
7877
8024
|
transition,
|
|
7878
8025
|
children
|
|
7879
8026
|
}) {
|
|
7880
|
-
return /* @__PURE__ */
|
|
8027
|
+
return /* @__PURE__ */ jsx11(TransitionContext.Provider, { value: transition, children });
|
|
7881
8028
|
}
|
|
7882
8029
|
function useLayoutTransition() {
|
|
7883
|
-
return
|
|
8030
|
+
return useContext14(TransitionContext);
|
|
7884
8031
|
}
|
|
7885
8032
|
|
|
7886
8033
|
// src/canvas/canvas-arrangement.tsx
|
|
7887
|
-
import
|
|
7888
|
-
import { jsx as
|
|
7889
|
-
var CanvasArrangementContext =
|
|
8034
|
+
import React27, { createContext as createContext15, useContext as useContext15 } from "react";
|
|
8035
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
8036
|
+
var CanvasArrangementContext = createContext15({ arrangement: "stack", turnPages: false });
|
|
7890
8037
|
function CanvasArrangementProvider({
|
|
7891
8038
|
arrangement,
|
|
7892
8039
|
turnPages = false,
|
|
7893
8040
|
children
|
|
7894
8041
|
}) {
|
|
7895
|
-
const value =
|
|
7896
|
-
return /* @__PURE__ */
|
|
8042
|
+
const value = React27.useMemo(() => ({ arrangement, turnPages }), [arrangement, turnPages]);
|
|
8043
|
+
return /* @__PURE__ */ jsx12(CanvasArrangementContext.Provider, { value, children });
|
|
7897
8044
|
}
|
|
7898
8045
|
function useCanvasArrangement() {
|
|
7899
|
-
return
|
|
8046
|
+
return useContext15(CanvasArrangementContext);
|
|
7900
8047
|
}
|
|
7901
8048
|
|
|
7902
8049
|
// src/canvas/canvas-motion-style.tsx
|
|
7903
|
-
import { createContext as
|
|
7904
|
-
import { jsx as
|
|
7905
|
-
var CanvasMotionStyleContext =
|
|
8050
|
+
import { createContext as createContext16, useContext as useContext16 } from "react";
|
|
8051
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
8052
|
+
var CanvasMotionStyleContext = createContext16(null);
|
|
7906
8053
|
function CanvasMotionStyleProvider({ style, children }) {
|
|
7907
|
-
return /* @__PURE__ */
|
|
8054
|
+
return /* @__PURE__ */ jsx13(CanvasMotionStyleContext.Provider, { value: style, children });
|
|
7908
8055
|
}
|
|
7909
8056
|
function useCanvasMotionStyle() {
|
|
7910
|
-
return
|
|
8057
|
+
return useContext16(CanvasMotionStyleContext);
|
|
7911
8058
|
}
|
|
7912
8059
|
|
|
7913
8060
|
// src/canvas/ElementIdContext.ts
|
|
7914
|
-
import { createContext as
|
|
7915
|
-
var ElementIdContext =
|
|
8061
|
+
import { createContext as createContext17, useContext as useContext17 } from "react";
|
|
8062
|
+
var ElementIdContext = createContext17(null);
|
|
7916
8063
|
function useElementId() {
|
|
7917
|
-
return
|
|
8064
|
+
return useContext17(ElementIdContext);
|
|
7918
8065
|
}
|
|
7919
8066
|
|
|
7920
8067
|
// src/canvas/generation-entrance.ts
|
|
@@ -8174,22 +8321,22 @@ function deriveTurnChangeAnchor(prev, next) {
|
|
|
8174
8321
|
}
|
|
8175
8322
|
|
|
8176
8323
|
// src/canvas/canvas-outlet.tsx
|
|
8177
|
-
import { createContext as
|
|
8178
|
-
import { jsx as
|
|
8179
|
-
var CanvasOutletContext =
|
|
8324
|
+
import { createContext as createContext18, useContext as useContext18 } from "react";
|
|
8325
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
8326
|
+
var CanvasOutletContext = createContext18(null);
|
|
8180
8327
|
function CanvasOutletProvider({ canvas, children }) {
|
|
8181
|
-
return /* @__PURE__ */
|
|
8328
|
+
return /* @__PURE__ */ jsx14(CanvasOutletContext.Provider, { value: canvas, children });
|
|
8182
8329
|
}
|
|
8183
8330
|
function SpacefrontCanvas() {
|
|
8184
|
-
const Canvas =
|
|
8331
|
+
const Canvas = useContext18(CanvasOutletContext);
|
|
8185
8332
|
if (Canvas === null) {
|
|
8186
8333
|
throw new Error("<SpacefrontCanvas> must be rendered inside <Spacefront> \u2014 no engine has provided a canvas.");
|
|
8187
8334
|
}
|
|
8188
|
-
return /* @__PURE__ */
|
|
8335
|
+
return /* @__PURE__ */ jsx14(Canvas, {});
|
|
8189
8336
|
}
|
|
8190
8337
|
|
|
8191
8338
|
// src/canvas/item-motion/ItemTransitionGroup.tsx
|
|
8192
|
-
import
|
|
8339
|
+
import React29 from "react";
|
|
8193
8340
|
import { AnimatePresence as AnimatePresence2, motion as motion3, useReducedMotion as useReducedMotion2 } from "framer-motion";
|
|
8194
8341
|
|
|
8195
8342
|
// src/canvas/item-motion/classify-items.ts
|
|
@@ -8408,7 +8555,7 @@ function getActiveProfile() {
|
|
|
8408
8555
|
}
|
|
8409
8556
|
|
|
8410
8557
|
// src/canvas/item-motion/ItemTransitionGroup.tsx
|
|
8411
|
-
import { jsx as
|
|
8558
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
8412
8559
|
var ITEM_IDENTITY_ATTR = "data-flip-id";
|
|
8413
8560
|
function ItemTransitionGroup({
|
|
8414
8561
|
items,
|
|
@@ -8423,14 +8570,14 @@ function ItemTransitionGroup({
|
|
|
8423
8570
|
const profile = getActiveProfile();
|
|
8424
8571
|
const animated = reduce !== true;
|
|
8425
8572
|
const ids = items.map(getId);
|
|
8426
|
-
const prevIdsRef =
|
|
8427
|
-
const lastChangeRef =
|
|
8573
|
+
const prevIdsRef = React29.useRef(null);
|
|
8574
|
+
const lastChangeRef = React29.useRef(null);
|
|
8428
8575
|
const prevIds = prevIdsRef.current;
|
|
8429
8576
|
const freshChange = prevIds === null ? null : classifyItemChange(prevIds, ids);
|
|
8430
8577
|
if (freshChange !== null) {
|
|
8431
8578
|
lastChangeRef.current = freshChange;
|
|
8432
8579
|
}
|
|
8433
|
-
|
|
8580
|
+
React29.useEffect(() => {
|
|
8434
8581
|
prevIdsRef.current = ids;
|
|
8435
8582
|
});
|
|
8436
8583
|
const activeChange = lastChangeRef.current;
|
|
@@ -8443,7 +8590,7 @@ function ItemTransitionGroup({
|
|
|
8443
8590
|
const isGrid = itemClassName === void 0;
|
|
8444
8591
|
const outerClassName = isGrid ? "h-full" : itemClassName;
|
|
8445
8592
|
const innerClassName = isGrid ? "h-full" : void 0;
|
|
8446
|
-
return /* @__PURE__ */
|
|
8593
|
+
return /* @__PURE__ */ jsx15("div", { className, style, children: /* @__PURE__ */ jsx15(AnimatePresence2, { mode: "popLayout", initial: false, children: items.map((item) => {
|
|
8447
8594
|
const id = getId(item);
|
|
8448
8595
|
const identityAttr = { [ITEM_IDENTITY_ATTR]: id };
|
|
8449
8596
|
const isEntering = activeChange !== null && activeChange.entered.includes(id);
|
|
@@ -8453,7 +8600,7 @@ function ItemTransitionGroup({
|
|
|
8453
8600
|
// `itemClassName`/`itemStyle` size the wrapper for flex/snap
|
|
8454
8601
|
// layouts (carousel); grid layouts leave them unset and get
|
|
8455
8602
|
// `h-full` so the cell height reaches the card.
|
|
8456
|
-
/* @__PURE__ */
|
|
8603
|
+
/* @__PURE__ */ jsx15(
|
|
8457
8604
|
motion3.div,
|
|
8458
8605
|
{
|
|
8459
8606
|
...identityAttr,
|
|
@@ -8462,7 +8609,7 @@ function ItemTransitionGroup({
|
|
|
8462
8609
|
layout: animated ? "position" : void 0,
|
|
8463
8610
|
layoutDependency,
|
|
8464
8611
|
transition: animated ? layoutTransition : void 0,
|
|
8465
|
-
children: /* @__PURE__ */
|
|
8612
|
+
children: /* @__PURE__ */ jsx15(
|
|
8466
8613
|
motion3.div,
|
|
8467
8614
|
{
|
|
8468
8615
|
className: innerClassName,
|
|
@@ -8542,21 +8689,21 @@ __export(catalog_exports, {
|
|
|
8542
8689
|
});
|
|
8543
8690
|
|
|
8544
8691
|
// src/catalog/DebugContext.tsx
|
|
8545
|
-
import { createContext as
|
|
8546
|
-
import { jsx as
|
|
8547
|
-
var DebugContext =
|
|
8692
|
+
import { createContext as createContext19, useContext as useContext19 } from "react";
|
|
8693
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
8694
|
+
var DebugContext = createContext19(false);
|
|
8548
8695
|
function DebugProvider({
|
|
8549
8696
|
debug,
|
|
8550
8697
|
children
|
|
8551
8698
|
}) {
|
|
8552
|
-
return /* @__PURE__ */
|
|
8699
|
+
return /* @__PURE__ */ jsx16(DebugContext.Provider, { value: debug, children });
|
|
8553
8700
|
}
|
|
8554
8701
|
function useDebug() {
|
|
8555
|
-
return
|
|
8702
|
+
return useContext19(DebugContext);
|
|
8556
8703
|
}
|
|
8557
8704
|
|
|
8558
8705
|
// src/catalog/HydrationStateContext.tsx
|
|
8559
|
-
import { createContext as
|
|
8706
|
+
import { createContext as createContext20, useContext as useContext20 } from "react";
|
|
8560
8707
|
var DEFAULT_STATE = {
|
|
8561
8708
|
hasResolvedFields: false,
|
|
8562
8709
|
hydrating: false,
|
|
@@ -8566,47 +8713,47 @@ var DEFAULT_STATE = {
|
|
|
8566
8713
|
pendingCount: 0,
|
|
8567
8714
|
errors: []
|
|
8568
8715
|
};
|
|
8569
|
-
var HydrationStateContext =
|
|
8716
|
+
var HydrationStateContext = createContext20(DEFAULT_STATE);
|
|
8570
8717
|
function useHydrationState() {
|
|
8571
|
-
return
|
|
8718
|
+
return useContext20(HydrationStateContext);
|
|
8572
8719
|
}
|
|
8573
8720
|
|
|
8574
8721
|
// src/catalog/HydratorContext.tsx
|
|
8575
|
-
import { createContext as
|
|
8576
|
-
import { jsx as
|
|
8577
|
-
var HydratorContext =
|
|
8722
|
+
import { createContext as createContext21, useContext as useContext21 } from "react";
|
|
8723
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
8724
|
+
var HydratorContext = createContext21({});
|
|
8578
8725
|
function HydratorProvider({
|
|
8579
8726
|
hydrators,
|
|
8580
8727
|
children
|
|
8581
8728
|
}) {
|
|
8582
|
-
return /* @__PURE__ */
|
|
8729
|
+
return /* @__PURE__ */ jsx17(HydratorContext.Provider, { value: hydrators, children });
|
|
8583
8730
|
}
|
|
8584
8731
|
function useHydrators() {
|
|
8585
|
-
return
|
|
8732
|
+
return useContext21(HydratorContext);
|
|
8586
8733
|
}
|
|
8587
8734
|
|
|
8588
8735
|
// src/catalog/registry.tsx
|
|
8589
|
-
import { createContext as
|
|
8590
|
-
import { jsx as
|
|
8591
|
-
var RegistryContext =
|
|
8736
|
+
import { createContext as createContext22, useContext as useContext22 } from "react";
|
|
8737
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
8738
|
+
var RegistryContext = createContext22({});
|
|
8592
8739
|
function RegistryProvider({
|
|
8593
8740
|
registry: registry2,
|
|
8594
8741
|
children
|
|
8595
8742
|
}) {
|
|
8596
|
-
return /* @__PURE__ */
|
|
8743
|
+
return /* @__PURE__ */ jsx18(RegistryContext.Provider, { value: registry2, children });
|
|
8597
8744
|
}
|
|
8598
8745
|
function useRegistry() {
|
|
8599
|
-
return
|
|
8746
|
+
return useContext22(RegistryContext);
|
|
8600
8747
|
}
|
|
8601
|
-
var PackageLookupContext =
|
|
8748
|
+
var PackageLookupContext = createContext22(null);
|
|
8602
8749
|
function PackageLookupProvider({
|
|
8603
8750
|
lookup,
|
|
8604
8751
|
children
|
|
8605
8752
|
}) {
|
|
8606
|
-
return /* @__PURE__ */
|
|
8753
|
+
return /* @__PURE__ */ jsx18(PackageLookupContext.Provider, { value: lookup, children });
|
|
8607
8754
|
}
|
|
8608
8755
|
function usePackageLookup() {
|
|
8609
|
-
return
|
|
8756
|
+
return useContext22(PackageLookupContext);
|
|
8610
8757
|
}
|
|
8611
8758
|
function createAliasedRegistry(baseRegistry, aliases, getPackageComponent) {
|
|
8612
8759
|
return new Proxy(baseRegistry, {
|
|
@@ -8637,9 +8784,9 @@ function createAliasedRegistry(baseRegistry, aliases, getPackageComponent) {
|
|
|
8637
8784
|
}
|
|
8638
8785
|
|
|
8639
8786
|
// src/catalog/render-inline.tsx
|
|
8640
|
-
import
|
|
8641
|
-
import { jsx as
|
|
8642
|
-
var linkRenderer = (href, key) => /* @__PURE__ */
|
|
8787
|
+
import React32 from "react";
|
|
8788
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
8789
|
+
var linkRenderer = (href, key) => /* @__PURE__ */ jsx19(
|
|
8643
8790
|
"a",
|
|
8644
8791
|
{
|
|
8645
8792
|
className: "fourty-inline-link",
|
|
@@ -8659,14 +8806,14 @@ function linkifyText(text2, keyPrefix) {
|
|
|
8659
8806
|
URL_RE.lastIndex = 0;
|
|
8660
8807
|
while ((match = URL_RE.exec(text2)) !== null) {
|
|
8661
8808
|
if (match.index > last) {
|
|
8662
|
-
out.push(/* @__PURE__ */
|
|
8809
|
+
out.push(/* @__PURE__ */ jsx19(React32.Fragment, { children: text2.slice(last, match.index) }, `${keyPrefix}-lt-${i++}`));
|
|
8663
8810
|
}
|
|
8664
8811
|
const href = match[0];
|
|
8665
8812
|
out.push(linkRenderer(href, `${keyPrefix}-lk-${i++}`));
|
|
8666
8813
|
last = match.index + href.length;
|
|
8667
8814
|
}
|
|
8668
8815
|
if (last < text2.length) {
|
|
8669
|
-
out.push(/* @__PURE__ */
|
|
8816
|
+
out.push(/* @__PURE__ */ jsx19(React32.Fragment, { children: text2.slice(last) }, `${keyPrefix}-lt-${i++}`));
|
|
8670
8817
|
}
|
|
8671
8818
|
return out;
|
|
8672
8819
|
}
|
|
@@ -8679,8 +8826,8 @@ function renderInline(text2, keyPrefix) {
|
|
|
8679
8826
|
while ((match = re.exec(text2)) !== null) {
|
|
8680
8827
|
if (match.index > last) out.push(...linkifyText(text2.slice(last, match.index), `${keyPrefix}-t-${i++}`));
|
|
8681
8828
|
const bold = match[1];
|
|
8682
|
-
if (bold !== void 0) out.push(/* @__PURE__ */
|
|
8683
|
-
else out.push(/* @__PURE__ */
|
|
8829
|
+
if (bold !== void 0) out.push(/* @__PURE__ */ jsx19("strong", { children: bold }, `${keyPrefix}-b-${i++}`));
|
|
8830
|
+
else out.push(/* @__PURE__ */ jsx19("em", { children: match[2] }, `${keyPrefix}-i-${i++}`));
|
|
8684
8831
|
last = match.index + match[0].length;
|
|
8685
8832
|
}
|
|
8686
8833
|
if (last < text2.length) out.push(...linkifyText(text2.slice(last), `${keyPrefix}-t-${i++}`));
|
|
@@ -8688,7 +8835,7 @@ function renderInline(text2, keyPrefix) {
|
|
|
8688
8835
|
}
|
|
8689
8836
|
|
|
8690
8837
|
// src/catalog/component-library.ts
|
|
8691
|
-
import * as
|
|
8838
|
+
import * as React33 from "react";
|
|
8692
8839
|
function displayNameOf(Inner) {
|
|
8693
8840
|
if (typeof Inner === "string") return Inner;
|
|
8694
8841
|
if (typeof Inner.displayName === "string" && Inner.displayName.length > 0) return Inner.displayName;
|
|
@@ -8697,7 +8844,7 @@ function displayNameOf(Inner) {
|
|
|
8697
8844
|
}
|
|
8698
8845
|
function adaptComponent(Inner) {
|
|
8699
8846
|
function Adapted(props) {
|
|
8700
|
-
return
|
|
8847
|
+
return React33.createElement(Inner, props);
|
|
8701
8848
|
}
|
|
8702
8849
|
Adapted.displayName = displayNameOf(Inner);
|
|
8703
8850
|
return Adapted;
|
|
@@ -8738,23 +8885,23 @@ function buildComponentLibrary(catalog, componentMap) {
|
|
|
8738
8885
|
}
|
|
8739
8886
|
|
|
8740
8887
|
// src/catalog/define.ts
|
|
8741
|
-
import { z as
|
|
8742
|
-
var HYDRATED_ENTITY =
|
|
8888
|
+
import { z as z47 } from "zod";
|
|
8889
|
+
var HYDRATED_ENTITY = z47.object({}).passthrough();
|
|
8743
8890
|
function entity(resolverKey, opts) {
|
|
8744
8891
|
return resolved(HYDRATED_ENTITY, resolverKey, opts);
|
|
8745
8892
|
}
|
|
8746
|
-
var text = prose(
|
|
8893
|
+
var text = prose(z47.string());
|
|
8747
8894
|
function plain() {
|
|
8748
|
-
return
|
|
8895
|
+
return z47.string();
|
|
8749
8896
|
}
|
|
8750
8897
|
function token(values) {
|
|
8751
|
-
return
|
|
8898
|
+
return z47.enum(values);
|
|
8752
8899
|
}
|
|
8753
8900
|
function catalogComponent(meta, render) {
|
|
8754
8901
|
const { props, requires, ...rest } = meta;
|
|
8755
8902
|
return {
|
|
8756
8903
|
...rest,
|
|
8757
|
-
propsSchema:
|
|
8904
|
+
propsSchema: z47.object(props),
|
|
8758
8905
|
...requires !== void 0 ? { requires } : {},
|
|
8759
8906
|
component: adaptComponent(render)
|
|
8760
8907
|
};
|
|
@@ -9094,7 +9241,7 @@ function useConsumeStandingSignal(type) {
|
|
|
9094
9241
|
}
|
|
9095
9242
|
|
|
9096
9243
|
// src/widgets/presence/use-presence-notch.ts
|
|
9097
|
-
import * as
|
|
9244
|
+
import * as React34 from "react";
|
|
9098
9245
|
var SETTLE_DWELL_MS = 4e3;
|
|
9099
9246
|
var HOVER_CLOSE_MS = 240;
|
|
9100
9247
|
var HOVER_BOUNCE_WINDOW_MS = 800;
|
|
@@ -9102,21 +9249,21 @@ var BOUNCE_PX = 2;
|
|
|
9102
9249
|
function usePresenceNotch(widgets) {
|
|
9103
9250
|
const askStanding = useStandingOfType(AGENT_ASK_SIGNAL) !== null;
|
|
9104
9251
|
const { isRunning } = useAgentPresence();
|
|
9105
|
-
const [hovered, setHovered] =
|
|
9106
|
-
const [openDrawerId, setOpenDrawerId] =
|
|
9107
|
-
const rootRef =
|
|
9108
|
-
const toggleDrawer =
|
|
9252
|
+
const [hovered, setHovered] = React34.useState(false);
|
|
9253
|
+
const [openDrawerId, setOpenDrawerId] = React34.useState(null);
|
|
9254
|
+
const rootRef = React34.useRef(null);
|
|
9255
|
+
const toggleDrawer = React34.useCallback((id) => {
|
|
9109
9256
|
setOpenDrawerId((current2) => current2 === id ? null : id);
|
|
9110
9257
|
}, []);
|
|
9111
|
-
const closeTimer =
|
|
9112
|
-
const cancelClose =
|
|
9258
|
+
const closeTimer = React34.useRef(null);
|
|
9259
|
+
const cancelClose = React34.useCallback(() => {
|
|
9113
9260
|
if (closeTimer.current !== null) {
|
|
9114
9261
|
clearTimeout(closeTimer.current);
|
|
9115
9262
|
closeTimer.current = null;
|
|
9116
9263
|
}
|
|
9117
9264
|
}, []);
|
|
9118
|
-
const lastLeaveRef =
|
|
9119
|
-
const openHover =
|
|
9265
|
+
const lastLeaveRef = React34.useRef(null);
|
|
9266
|
+
const openHover = React34.useCallback((e) => {
|
|
9120
9267
|
const last = lastLeaveRef.current;
|
|
9121
9268
|
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) {
|
|
9122
9269
|
return;
|
|
@@ -9124,7 +9271,7 @@ function usePresenceNotch(widgets) {
|
|
|
9124
9271
|
cancelClose();
|
|
9125
9272
|
setHovered(true);
|
|
9126
9273
|
}, [cancelClose]);
|
|
9127
|
-
const scheduleClose =
|
|
9274
|
+
const scheduleClose = React34.useCallback((e) => {
|
|
9128
9275
|
lastLeaveRef.current = { x: e.clientX, y: e.clientY, t: Date.now() };
|
|
9129
9276
|
cancelClose();
|
|
9130
9277
|
closeTimer.current = setTimeout(() => {
|
|
@@ -9132,8 +9279,8 @@ function usePresenceNotch(widgets) {
|
|
|
9132
9279
|
setHovered(false);
|
|
9133
9280
|
}, HOVER_CLOSE_MS);
|
|
9134
9281
|
}, [cancelClose]);
|
|
9135
|
-
|
|
9136
|
-
|
|
9282
|
+
React34.useEffect(() => cancelClose, [cancelClose]);
|
|
9283
|
+
React34.useEffect(() => {
|
|
9137
9284
|
if (openDrawerId === null) return;
|
|
9138
9285
|
const onKey = (e) => {
|
|
9139
9286
|
if (e.key === "Escape") setOpenDrawerId(null);
|
|
@@ -9141,7 +9288,7 @@ function usePresenceNotch(widgets) {
|
|
|
9141
9288
|
window.addEventListener("keydown", onKey);
|
|
9142
9289
|
return () => window.removeEventListener("keydown", onKey);
|
|
9143
9290
|
}, [openDrawerId]);
|
|
9144
|
-
|
|
9291
|
+
React34.useEffect(() => {
|
|
9145
9292
|
if (openDrawerId === null) return;
|
|
9146
9293
|
const onDown = (e) => {
|
|
9147
9294
|
const root = rootRef.current;
|
|
@@ -9153,8 +9300,8 @@ function usePresenceNotch(widgets) {
|
|
|
9153
9300
|
document.addEventListener("pointerdown", onDown);
|
|
9154
9301
|
return () => document.removeEventListener("pointerdown", onDown);
|
|
9155
9302
|
}, [openDrawerId]);
|
|
9156
|
-
const [active, setActive] =
|
|
9157
|
-
|
|
9303
|
+
const [active, setActive] = React34.useState(false);
|
|
9304
|
+
React34.useEffect(() => {
|
|
9158
9305
|
if (isRunning) {
|
|
9159
9306
|
setActive(true);
|
|
9160
9307
|
return;
|
|
@@ -9314,7 +9461,7 @@ function presenceFactShape(fact) {
|
|
|
9314
9461
|
}
|
|
9315
9462
|
|
|
9316
9463
|
// src/widgets/presence/use-optimistic-facts.ts
|
|
9317
|
-
import * as
|
|
9464
|
+
import * as React35 from "react";
|
|
9318
9465
|
function readEntries(data) {
|
|
9319
9466
|
if (typeof data !== "object" || data === null || !("entries" in data)) return [];
|
|
9320
9467
|
const raw = data.entries;
|
|
@@ -9333,7 +9480,7 @@ function writeOptimisticFact(entries3, fact) {
|
|
|
9333
9480
|
}
|
|
9334
9481
|
function useOptimisticFactOverlay(flowId) {
|
|
9335
9482
|
const entries3 = readEntries(useAgentFlow(flowId));
|
|
9336
|
-
return
|
|
9483
|
+
return React35.useMemo(
|
|
9337
9484
|
() => ({
|
|
9338
9485
|
entries: entries3,
|
|
9339
9486
|
add: (fact) => setFlowOutput(flowId, { entries: writeOptimisticFact(entries3, fact) })
|
|
@@ -9342,8 +9489,8 @@ function useOptimisticFactOverlay(flowId) {
|
|
|
9342
9489
|
);
|
|
9343
9490
|
}
|
|
9344
9491
|
function useReconcileOptimisticFacts(flowId, readIdentity) {
|
|
9345
|
-
const seenRef =
|
|
9346
|
-
|
|
9492
|
+
const seenRef = React35.useRef(null);
|
|
9493
|
+
React35.useEffect(() => {
|
|
9347
9494
|
if (readIdentity === null) return;
|
|
9348
9495
|
if (seenRef.current === null) {
|
|
9349
9496
|
seenRef.current = readIdentity;
|
|
@@ -9515,10 +9662,10 @@ __export(chat_exports, {
|
|
|
9515
9662
|
});
|
|
9516
9663
|
|
|
9517
9664
|
// src/chat/chat-context.ts
|
|
9518
|
-
import { createContext as
|
|
9519
|
-
var FourtyChatContext =
|
|
9665
|
+
import { createContext as createContext23, useContext as useContext23 } from "react";
|
|
9666
|
+
var FourtyChatContext = createContext23(null);
|
|
9520
9667
|
function useFourtyChat() {
|
|
9521
|
-
const ctx =
|
|
9668
|
+
const ctx = useContext23(FourtyChatContext);
|
|
9522
9669
|
if (!ctx) throw new Error("useFourtyChat must be used inside <FourtyChatProvider>");
|
|
9523
9670
|
return ctx;
|
|
9524
9671
|
}
|
|
@@ -9755,34 +9902,34 @@ __export(interaction_exports, {
|
|
|
9755
9902
|
});
|
|
9756
9903
|
|
|
9757
9904
|
// src/interaction/withInteractionTracking.tsx
|
|
9758
|
-
import
|
|
9759
|
-
import { jsx as
|
|
9760
|
-
var InteractionContext =
|
|
9905
|
+
import React36, { createContext as createContext24, useContext as useContext24 } from "react";
|
|
9906
|
+
import { jsx as jsx20, jsxs } from "react/jsx-runtime";
|
|
9907
|
+
var InteractionContext = createContext24(null);
|
|
9761
9908
|
function InteractionProvider({
|
|
9762
9909
|
onInteraction,
|
|
9763
9910
|
children
|
|
9764
9911
|
}) {
|
|
9765
|
-
return /* @__PURE__ */
|
|
9912
|
+
return /* @__PURE__ */ jsx20(InteractionContext.Provider, { value: onInteraction, children });
|
|
9766
9913
|
}
|
|
9767
9914
|
function useInteraction2() {
|
|
9768
|
-
return
|
|
9915
|
+
return useContext24(InteractionContext);
|
|
9769
9916
|
}
|
|
9770
9917
|
function withInteractionTracking(WrappedComponent, meta) {
|
|
9771
9918
|
function TrackedComponent(props) {
|
|
9772
|
-
return /* @__PURE__ */
|
|
9919
|
+
return /* @__PURE__ */ jsx20(
|
|
9773
9920
|
"div",
|
|
9774
9921
|
{
|
|
9775
9922
|
"data-tracked-component": meta.componentId,
|
|
9776
9923
|
"data-tracked-component-type": meta.componentType,
|
|
9777
9924
|
style: { display: "contents" },
|
|
9778
|
-
children: /* @__PURE__ */
|
|
9925
|
+
children: /* @__PURE__ */ jsx20(ComponentErrorBoundary, { componentId: meta.componentId, children: /* @__PURE__ */ jsx20(WrappedComponent, { ...props }) })
|
|
9779
9926
|
}
|
|
9780
9927
|
);
|
|
9781
9928
|
}
|
|
9782
9929
|
TrackedComponent.displayName = `Tracked(${WrappedComponent.displayName || WrappedComponent.name || "Component"})`;
|
|
9783
9930
|
return TrackedComponent;
|
|
9784
9931
|
}
|
|
9785
|
-
var ComponentErrorBoundary = class extends
|
|
9932
|
+
var ComponentErrorBoundary = class extends React36.Component {
|
|
9786
9933
|
constructor() {
|
|
9787
9934
|
super(...arguments);
|
|
9788
9935
|
__publicField(this, "state", { error: null });
|
|
@@ -9796,7 +9943,7 @@ var ComponentErrorBoundary = class extends React34.Component {
|
|
|
9796
9943
|
render() {
|
|
9797
9944
|
if (this.state.error) {
|
|
9798
9945
|
return /* @__PURE__ */ jsxs("div", { className: "fourty-component-error", role: "alert", "data-component-id": this.props.componentId, children: [
|
|
9799
|
-
/* @__PURE__ */
|
|
9946
|
+
/* @__PURE__ */ jsx20("strong", { children: this.props.componentId }),
|
|
9800
9947
|
": ",
|
|
9801
9948
|
this.state.error.message
|
|
9802
9949
|
] });
|
|
@@ -9856,14 +10003,14 @@ __export(utils_exports, {
|
|
|
9856
10003
|
import { useSyncExternalStore as useSyncExternalStore5 } from "react";
|
|
9857
10004
|
|
|
9858
10005
|
// src/utils/viewport-window.tsx
|
|
9859
|
-
import { createContext as
|
|
9860
|
-
import { jsx as
|
|
9861
|
-
var ViewportWindowContext =
|
|
10006
|
+
import { createContext as createContext25, useContext as useContext25 } from "react";
|
|
10007
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
10008
|
+
var ViewportWindowContext = createContext25(null);
|
|
9862
10009
|
function canAnswer(win) {
|
|
9863
10010
|
return win !== null && typeof win.matchMedia === "function";
|
|
9864
10011
|
}
|
|
9865
10012
|
function useViewportWindow() {
|
|
9866
|
-
const provided =
|
|
10013
|
+
const provided = useContext25(ViewportWindowContext);
|
|
9867
10014
|
if (provided !== null) return canAnswer(provided) ? provided : null;
|
|
9868
10015
|
const global = globalThis;
|
|
9869
10016
|
return canAnswer(global) ? global : null;
|
|
@@ -9872,7 +10019,7 @@ function ViewportWindowProvider({
|
|
|
9872
10019
|
value,
|
|
9873
10020
|
children
|
|
9874
10021
|
}) {
|
|
9875
|
-
return /* @__PURE__ */
|
|
10022
|
+
return /* @__PURE__ */ jsx21(ViewportWindowContext.Provider, { value, children });
|
|
9876
10023
|
}
|
|
9877
10024
|
|
|
9878
10025
|
// src/utils/use-form-factor.ts
|
|
@@ -9963,7 +10110,7 @@ function useInlineCompletion(opts) {
|
|
|
9963
10110
|
}
|
|
9964
10111
|
|
|
9965
10112
|
// src/utils/use-document-visible.ts
|
|
9966
|
-
import
|
|
10113
|
+
import React37 from "react";
|
|
9967
10114
|
function subscribe3(onChange) {
|
|
9968
10115
|
document.addEventListener("visibilitychange", onChange);
|
|
9969
10116
|
return () => document.removeEventListener("visibilitychange", onChange);
|
|
@@ -9975,15 +10122,15 @@ function getServerSnapshot() {
|
|
|
9975
10122
|
return true;
|
|
9976
10123
|
}
|
|
9977
10124
|
function useDocumentVisible() {
|
|
9978
|
-
return
|
|
10125
|
+
return React37.useSyncExternalStore(subscribe3, getSnapshot, getServerSnapshot);
|
|
9979
10126
|
}
|
|
9980
10127
|
|
|
9981
10128
|
// src/utils/use-interval.ts
|
|
9982
|
-
import
|
|
10129
|
+
import React38 from "react";
|
|
9983
10130
|
function useInterval(callback, ms, active = true) {
|
|
9984
|
-
const cbRef =
|
|
10131
|
+
const cbRef = React38.useRef(callback);
|
|
9985
10132
|
cbRef.current = callback;
|
|
9986
|
-
|
|
10133
|
+
React38.useEffect(() => {
|
|
9987
10134
|
if (!active) return;
|
|
9988
10135
|
const id = window.setInterval(() => cbRef.current(), ms);
|
|
9989
10136
|
return () => window.clearInterval(id);
|
|
@@ -10195,15 +10342,15 @@ function primedEntitiesFor(resolverKey) {
|
|
|
10195
10342
|
}
|
|
10196
10343
|
|
|
10197
10344
|
// src/preview/SpacefrontPreviewProvider.tsx
|
|
10198
|
-
import * as
|
|
10199
|
-
import { jsx as
|
|
10345
|
+
import * as React39 from "react";
|
|
10346
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
10200
10347
|
var NOOP = () => {
|
|
10201
10348
|
};
|
|
10202
10349
|
var ASYNC_NOOP = () => Promise.resolve();
|
|
10203
10350
|
var VIEW = { page: { kind: "home" }, layout: EMPTY_SPEC, shell: EMPTY_SHELL };
|
|
10204
|
-
var PreviewContext =
|
|
10351
|
+
var PreviewContext = React39.createContext(null);
|
|
10205
10352
|
function usePreview() {
|
|
10206
|
-
const value =
|
|
10353
|
+
const value = React39.useContext(PreviewContext);
|
|
10207
10354
|
if (value === null) throw new Error("preview runtime used outside <SpacefrontPreviewProvider>");
|
|
10208
10355
|
return value;
|
|
10209
10356
|
}
|
|
@@ -10357,11 +10504,11 @@ var PRESENCE = {
|
|
|
10357
10504
|
usePresenceLiveTurn: () => usePreview().pending?.messageId
|
|
10358
10505
|
};
|
|
10359
10506
|
function SpacefrontPreviewProvider({ scene, onSend, children }) {
|
|
10360
|
-
const [sessionId] =
|
|
10361
|
-
const derived =
|
|
10362
|
-
const onSendRef =
|
|
10507
|
+
const [sessionId] = React39.useState(() => `preview-${Math.random().toString(36).slice(2)}`);
|
|
10508
|
+
const derived = React39.useMemo(() => derive(scene, sessionId), [scene, sessionId]);
|
|
10509
|
+
const onSendRef = React39.useRef(onSend);
|
|
10363
10510
|
onSendRef.current = onSend;
|
|
10364
|
-
const draft =
|
|
10511
|
+
const draft = React39.useMemo(() => {
|
|
10365
10512
|
let text2 = "";
|
|
10366
10513
|
const listeners12 = /* @__PURE__ */ new Set();
|
|
10367
10514
|
return {
|
|
@@ -10377,7 +10524,7 @@ function SpacefrontPreviewProvider({ scene, onSend, children }) {
|
|
|
10377
10524
|
}
|
|
10378
10525
|
};
|
|
10379
10526
|
}, []);
|
|
10380
|
-
const session =
|
|
10527
|
+
const session = React39.useMemo(() => {
|
|
10381
10528
|
const send = (text2) => {
|
|
10382
10529
|
draft.set("");
|
|
10383
10530
|
onSendRef.current?.(text2);
|
|
@@ -10429,15 +10576,15 @@ function SpacefrontPreviewProvider({ scene, onSend, children }) {
|
|
|
10429
10576
|
const qId = question === null ? null : question.id;
|
|
10430
10577
|
const qText = question === null ? "" : question.text;
|
|
10431
10578
|
const qReplies = question === null ? "" : list(question.replies).join("\0");
|
|
10432
|
-
const raised =
|
|
10433
|
-
|
|
10579
|
+
const raised = React39.useRef(0);
|
|
10580
|
+
React39.useEffect(() => {
|
|
10434
10581
|
if (qId === null) return;
|
|
10435
10582
|
raised.current += 1;
|
|
10436
10583
|
const id = `${qId}-${raised.current}`;
|
|
10437
10584
|
raiseStanding(AGENT_ASK_SIGNAL, id, { ask: qText, suggestions: qReplies === "" ? [] : qReplies.split("\0") }, sessionId);
|
|
10438
10585
|
return () => resolveStanding(id, sessionId);
|
|
10439
10586
|
}, [qId, qText, qReplies, sessionId]);
|
|
10440
|
-
return /* @__PURE__ */
|
|
10587
|
+
return /* @__PURE__ */ jsx22(PreviewContext.Provider, { value: derived, children: /* @__PURE__ */ jsx22(FourtySessionContext.Provider, { value: session, children: /* @__PURE__ */ jsx22(FourtyRuntimeProvider, { value: RUNTIME, children: /* @__PURE__ */ jsx22(PresenceRuntimeProvider, { value: PRESENCE, children }) }) }) });
|
|
10441
10588
|
}
|
|
10442
10589
|
|
|
10443
10590
|
// src/verticals/commerce/index.ts
|
|
@@ -10573,7 +10720,7 @@ registerEntityPageKind("search", {
|
|
|
10573
10720
|
});
|
|
10574
10721
|
|
|
10575
10722
|
// src/verticals/commerce/commerce-context.tsx
|
|
10576
|
-
import { createContext as
|
|
10723
|
+
import { createContext as createContext27, useContext as useContext27 } from "react";
|
|
10577
10724
|
var INERT_COMMERCE_RUNTIME = {
|
|
10578
10725
|
useCart: () => {
|
|
10579
10726
|
throw new Error("useCart must be used within a <CommerceProvider>");
|
|
@@ -10612,12 +10759,12 @@ var INERT_COMMERCE_RUNTIME = {
|
|
|
10612
10759
|
}, signOut: async () => {
|
|
10613
10760
|
}, available: false })
|
|
10614
10761
|
};
|
|
10615
|
-
var FourtyCommerceRuntimeContext =
|
|
10762
|
+
var FourtyCommerceRuntimeContext = createContext27(
|
|
10616
10763
|
INERT_COMMERCE_RUNTIME
|
|
10617
10764
|
);
|
|
10618
10765
|
var FourtyCommerceRuntimeProvider = FourtyCommerceRuntimeContext.Provider;
|
|
10619
10766
|
function useCommerceRuntime() {
|
|
10620
|
-
return
|
|
10767
|
+
return useContext27(FourtyCommerceRuntimeContext);
|
|
10621
10768
|
}
|
|
10622
10769
|
function useCart() {
|
|
10623
10770
|
return useCommerceRuntime().useCart();
|
|
@@ -10797,18 +10944,18 @@ __export(ecommerce_exports, {
|
|
|
10797
10944
|
});
|
|
10798
10945
|
|
|
10799
10946
|
// ../spacestation/src/analytics/ecommerce/surfacing.ts
|
|
10800
|
-
import { z as
|
|
10947
|
+
import { z as z48 } from "zod";
|
|
10801
10948
|
var PRODUCTS_SURFACED = defineEventKind(
|
|
10802
10949
|
"commerce.products_surfaced",
|
|
10803
10950
|
"client",
|
|
10804
|
-
|
|
10951
|
+
z48.object({
|
|
10805
10952
|
/** The turn whose commit this describes. Minted where the prompt signal
|
|
10806
10953
|
* is built and shared with `agent_runs`, so the read layer can line a
|
|
10807
10954
|
* surfacing up against the prompt that asked for it. */
|
|
10808
|
-
turnId:
|
|
10955
|
+
turnId: z48.string().min(1).max(128),
|
|
10809
10956
|
/** Distinct entity refs this turn placed that were not on the canvas
|
|
10810
10957
|
* before it. ZERO IS A REAL VALUE — see the header. */
|
|
10811
|
-
productCount:
|
|
10958
|
+
productCount: z48.number().int().nonnegative()
|
|
10812
10959
|
}).strict()
|
|
10813
10960
|
);
|
|
10814
10961
|
|
|
@@ -11388,10 +11535,10 @@ function useCartDrawer() {
|
|
|
11388
11535
|
}
|
|
11389
11536
|
|
|
11390
11537
|
// src/verticals/commerce/cart/use-cart-view.ts
|
|
11391
|
-
import
|
|
11538
|
+
import React40 from "react";
|
|
11392
11539
|
function useCartView(cart, onCheckout) {
|
|
11393
11540
|
const analytics = useOptionalAnalyticsSink();
|
|
11394
|
-
const [exitPending, setExitPending] =
|
|
11541
|
+
const [exitPending, setExitPending] = React40.useState(null);
|
|
11395
11542
|
const lines = cart === null ? [] : cart.lines;
|
|
11396
11543
|
const count = lines.reduce((sum, l) => sum + l.quantity, 0);
|
|
11397
11544
|
const totalsPending = lines.some((l) => isPendingCartLine(l));
|
|
@@ -11401,7 +11548,7 @@ function useCartView(cart, onCheckout) {
|
|
|
11401
11548
|
const backendTotal = cart !== null && cart.total !== void 0 ? cart.total.amount : void 0;
|
|
11402
11549
|
const discountAmount = backendTotal !== void 0 && backendTotal < subtotal ? subtotal - backendTotal : 0;
|
|
11403
11550
|
const effectiveTotal = backendTotal !== void 0 ? backendTotal : subtotal;
|
|
11404
|
-
const navigateToExit =
|
|
11551
|
+
const navigateToExit = React40.useCallback((url, kind) => {
|
|
11405
11552
|
const result = navigateToExternalCommerceUrl(url);
|
|
11406
11553
|
if (kind === "checkout") recordVisitorCheckoutExit(analytics, result);
|
|
11407
11554
|
if (result === "new-tab") {
|
|
@@ -11418,7 +11565,7 @@ function useCartView(cart, onCheckout) {
|
|
|
11418
11565
|
setExitPending(null);
|
|
11419
11566
|
}
|
|
11420
11567
|
}, [analytics]);
|
|
11421
|
-
const handleCheckout =
|
|
11568
|
+
const handleCheckout = React40.useCallback(() => {
|
|
11422
11569
|
if (lines.length === 0 || exitPending !== null) return;
|
|
11423
11570
|
setExitPending("checkout");
|
|
11424
11571
|
if (onCheckout) {
|
|
@@ -11438,7 +11585,7 @@ function useCartView(cart, onCheckout) {
|
|
|
11438
11585
|
}
|
|
11439
11586
|
navigateToExit(cart?.checkoutUrl, "checkout");
|
|
11440
11587
|
}, [lines.length, exitPending, onCheckout, cart, navigateToExit]);
|
|
11441
|
-
const handleGoToStore =
|
|
11588
|
+
const handleGoToStore = React40.useCallback(() => {
|
|
11442
11589
|
if (lines.length === 0 || exitPending !== null) return;
|
|
11443
11590
|
setExitPending("store");
|
|
11444
11591
|
navigateToExit(cart?.storeCartUrl, "store");
|
|
@@ -11526,7 +11673,7 @@ registerSessionScopedClear(() => {
|
|
|
11526
11673
|
});
|
|
11527
11674
|
|
|
11528
11675
|
// src/verticals/commerce/cart/use-cart-line-row.ts
|
|
11529
|
-
import * as
|
|
11676
|
+
import * as React41 from "react";
|
|
11530
11677
|
|
|
11531
11678
|
// src/verticals/commerce/use-commerce-actions.ts
|
|
11532
11679
|
import { useCallback as useCallback22 } from "react";
|
|
@@ -11572,19 +11719,19 @@ var SPOTLIGHT_MAX_AGE_MS = 3e4;
|
|
|
11572
11719
|
function useCartLineRow(line, opts) {
|
|
11573
11720
|
const actions = useCommerceActions();
|
|
11574
11721
|
const drawerFocus = useCartDrawerFocus();
|
|
11575
|
-
const rowRef =
|
|
11722
|
+
const rowRef = React41.useRef(null);
|
|
11576
11723
|
const pending2 = isPendingCartLine(line);
|
|
11577
11724
|
const navigable = actions !== null && !pending2 && line.productId.length > 0;
|
|
11578
11725
|
const onNavigated = opts === void 0 ? void 0 : opts.onNavigated;
|
|
11579
|
-
const navigatedRef =
|
|
11726
|
+
const navigatedRef = React41.useRef(onNavigated);
|
|
11580
11727
|
navigatedRef.current = onNavigated;
|
|
11581
|
-
const navigate =
|
|
11728
|
+
const navigate = React41.useCallback(() => {
|
|
11582
11729
|
if (actions === null) return;
|
|
11583
11730
|
actions.navigateToProduct(line.productId, line.title);
|
|
11584
11731
|
const done = navigatedRef.current;
|
|
11585
11732
|
if (done !== void 0) done();
|
|
11586
11733
|
}, [actions, line.productId, line.title]);
|
|
11587
|
-
const interaction =
|
|
11734
|
+
const interaction = React41.useMemo(() => {
|
|
11588
11735
|
if (!navigable) return void 0;
|
|
11589
11736
|
return {
|
|
11590
11737
|
onClick: navigate,
|
|
@@ -11599,7 +11746,7 @@ function useCartLineRow(line, opts) {
|
|
|
11599
11746
|
};
|
|
11600
11747
|
}, [navigable, navigate]);
|
|
11601
11748
|
const spotlightKey = drawerFocus !== null && !pending2 && line.productId.length > 0 && drawerFocus.productId === line.productId && Date.now() - drawerFocus.at < SPOTLIGHT_MAX_AGE_MS ? drawerFocus.at : null;
|
|
11602
|
-
|
|
11749
|
+
React41.useEffect(() => {
|
|
11603
11750
|
if (spotlightKey === null) return;
|
|
11604
11751
|
const node = rowRef.current;
|
|
11605
11752
|
if (node === null) return;
|
|
@@ -11674,7 +11821,7 @@ function useImageHover() {
|
|
|
11674
11821
|
}
|
|
11675
11822
|
|
|
11676
11823
|
// src/verticals/commerce/price/format-price.ts
|
|
11677
|
-
function formatPrice(amount, currencyCode
|
|
11824
|
+
function formatPrice(amount, currencyCode, locale) {
|
|
11678
11825
|
const hasCents = Math.round(amount * 100) % 100 !== 0;
|
|
11679
11826
|
const formatter = new Intl.NumberFormat(locale, {
|
|
11680
11827
|
style: "currency",
|
|
@@ -11689,6 +11836,7 @@ function formatPrice(amount, currencyCode = "USD", locale = "en-US") {
|
|
|
11689
11836
|
function useProductCard(product) {
|
|
11690
11837
|
const session = useFourtySession();
|
|
11691
11838
|
const { hover, hoverProps } = useImageHover();
|
|
11839
|
+
const locale = useSpaceLocale();
|
|
11692
11840
|
const productImages = Array.isArray(product.images) ? product.images : [];
|
|
11693
11841
|
const primaryImage2 = productImages[0];
|
|
11694
11842
|
const hoverImage = productImages[1];
|
|
@@ -11696,8 +11844,8 @@ function useProductCard(product) {
|
|
|
11696
11844
|
const onSale = isOnSale(product.price.amount, product.compareAtPrice?.amount);
|
|
11697
11845
|
const badge = pickBadge(product);
|
|
11698
11846
|
const colorCount = pickColorCount(product);
|
|
11699
|
-
const priceLabel = formatPrice(product.price.amount, product.price.currencyCode);
|
|
11700
|
-
const compareAtPriceLabel = onSale && product.compareAtPrice !== void 0 ? formatPrice(product.compareAtPrice.amount, product.compareAtPrice.currencyCode) : void 0;
|
|
11847
|
+
const priceLabel = formatPrice(product.price.amount, product.price.currencyCode, locale);
|
|
11848
|
+
const compareAtPriceLabel = onSale && product.compareAtPrice !== void 0 ? formatPrice(product.compareAtPrice.amount, product.compareAtPrice.currencyCode, locale) : void 0;
|
|
11701
11849
|
const onCardClick = () => {
|
|
11702
11850
|
session.dispatchSuggestionAction(pickProductCardAction(product));
|
|
11703
11851
|
};
|
|
@@ -11743,7 +11891,7 @@ function pickColorCount(product) {
|
|
|
11743
11891
|
}
|
|
11744
11892
|
|
|
11745
11893
|
// src/verticals/commerce/product/use-look-card.ts
|
|
11746
|
-
import * as
|
|
11894
|
+
import * as React42 from "react";
|
|
11747
11895
|
|
|
11748
11896
|
// src/verticals/commerce/variant/variant-option-axes.ts
|
|
11749
11897
|
function carriesValue(variant, name, value) {
|
|
@@ -11952,8 +12100,9 @@ function useLookCard({
|
|
|
11952
12100
|
}) {
|
|
11953
12101
|
const session = useFourtySession();
|
|
11954
12102
|
const addFlash = useSuccessFlash({ duration: 1200 });
|
|
11955
|
-
const
|
|
11956
|
-
const
|
|
12103
|
+
const locale = useSpaceLocale();
|
|
12104
|
+
const [pending2, setPending] = React42.useState(null);
|
|
12105
|
+
const clean = React42.useMemo(
|
|
11957
12106
|
() => (Array.isArray(products) ? products : []).filter(
|
|
11958
12107
|
(p) => p !== null && p !== void 0 && typeof p === "object"
|
|
11959
12108
|
),
|
|
@@ -11961,7 +12110,7 @@ function useLookCard({
|
|
|
11961
12110
|
);
|
|
11962
12111
|
if (clean.length === 0) return null;
|
|
11963
12112
|
const visibleProducts = clean.slice(0, maxTiles);
|
|
11964
|
-
const total = sumTotal(visibleProducts);
|
|
12113
|
+
const total = sumTotal(visibleProducts, locale);
|
|
11965
12114
|
const totalEyebrow = typeof totalLabel === "string" && totalLabel.length > 0 && totalLabel.length < 24 ? totalLabel : "Total";
|
|
11966
12115
|
const visible = visibleProducts.map((product) => ({
|
|
11967
12116
|
product,
|
|
@@ -12051,7 +12200,7 @@ function useLookCard({
|
|
|
12051
12200
|
addFlash
|
|
12052
12201
|
};
|
|
12053
12202
|
}
|
|
12054
|
-
function sumTotal(products) {
|
|
12203
|
+
function sumTotal(products, locale) {
|
|
12055
12204
|
if (products.length === 0) return null;
|
|
12056
12205
|
const currency = products[0].price.currencyCode;
|
|
12057
12206
|
let total = 0;
|
|
@@ -12059,7 +12208,7 @@ function sumTotal(products) {
|
|
|
12059
12208
|
if (p.price.currencyCode !== currency) return null;
|
|
12060
12209
|
total += p.price.amount;
|
|
12061
12210
|
}
|
|
12062
|
-
return formatPrice(total, currency);
|
|
12211
|
+
return formatPrice(total, currency, locale);
|
|
12063
12212
|
}
|
|
12064
12213
|
function pickPrimaryImage(product) {
|
|
12065
12214
|
const productImages = Array.isArray(product.images) ? product.images : [];
|
|
@@ -12189,24 +12338,24 @@ function discountPct(p) {
|
|
|
12189
12338
|
const saved = (p.compareAtPrice.amount - p.price.amount) / p.compareAtPrice.amount;
|
|
12190
12339
|
return Math.round(saved * 100);
|
|
12191
12340
|
}
|
|
12192
|
-
function buildComparisonRows(products) {
|
|
12341
|
+
function buildComparisonRows(products, locale, words) {
|
|
12193
12342
|
const rows = [
|
|
12194
|
-
{ id: "price", label:
|
|
12343
|
+
{ id: "price", label: words.price, values: byProduct(products, (p) => formatProductPrice(p, locale)) }
|
|
12195
12344
|
];
|
|
12196
12345
|
if (products.some((p) => discountPct(p) !== void 0)) {
|
|
12197
12346
|
rows.push({
|
|
12198
12347
|
id: "sale",
|
|
12199
|
-
label:
|
|
12348
|
+
label: words.sale,
|
|
12200
12349
|
values: byProduct(products, (p) => {
|
|
12201
12350
|
const pct = discountPct(p);
|
|
12202
|
-
return pct === void 0 ? "\u2014" :
|
|
12351
|
+
return pct === void 0 ? "\u2014" : words.percentOff(pct);
|
|
12203
12352
|
})
|
|
12204
12353
|
});
|
|
12205
12354
|
}
|
|
12206
12355
|
if (products.some((p) => ratingOf(p) !== void 0)) {
|
|
12207
12356
|
rows.push({
|
|
12208
12357
|
id: "rating",
|
|
12209
|
-
label:
|
|
12358
|
+
label: words.rating,
|
|
12210
12359
|
values: byProduct(products, (p) => {
|
|
12211
12360
|
const r = ratingOf(p);
|
|
12212
12361
|
return r === void 0 ? "\u2014" : `${r.value.toFixed(1)} (${r.count})`;
|
|
@@ -12215,12 +12364,12 @@ function buildComparisonRows(products) {
|
|
|
12215
12364
|
}
|
|
12216
12365
|
return rows;
|
|
12217
12366
|
}
|
|
12218
|
-
function formatProductPrice(p) {
|
|
12367
|
+
function formatProductPrice(p, locale) {
|
|
12219
12368
|
if (p.price === void 0 || p.price === null) return "\u2014";
|
|
12220
12369
|
if (typeof p.price.amount !== "string" && typeof p.price.amount !== "number") {
|
|
12221
12370
|
return "\u2014";
|
|
12222
12371
|
}
|
|
12223
|
-
return formatPrice(p.price.amount, p.price.currencyCode);
|
|
12372
|
+
return formatPrice(p.price.amount, p.price.currencyCode, locale);
|
|
12224
12373
|
}
|
|
12225
12374
|
|
|
12226
12375
|
// src/verticals/commerce/variant/resolve-swatch-color.ts
|
|
@@ -12308,7 +12457,7 @@ function useContentActions() {
|
|
|
12308
12457
|
import { useEffect as useEffect19, useState as useState18 } from "react";
|
|
12309
12458
|
|
|
12310
12459
|
// package.json
|
|
12311
|
-
var version = "0.5.
|
|
12460
|
+
var version = "0.5.7";
|
|
12312
12461
|
|
|
12313
12462
|
// src/host/host-modules.ts
|
|
12314
12463
|
import * as react from "react";
|
|
@@ -12369,7 +12518,7 @@ function loadEngine(apiUrl) {
|
|
|
12369
12518
|
}
|
|
12370
12519
|
|
|
12371
12520
|
// src/host/Spacefront.tsx
|
|
12372
|
-
import { jsx as
|
|
12521
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
12373
12522
|
function Spacefront(props) {
|
|
12374
12523
|
const [engine, setEngine] = useState18(null);
|
|
12375
12524
|
const [failure, setFailure] = useState18(null);
|
|
@@ -12391,11 +12540,11 @@ function Spacefront(props) {
|
|
|
12391
12540
|
if (failure !== null) throw failure;
|
|
12392
12541
|
if (engine === null) return null;
|
|
12393
12542
|
const EngineRoot = engine.EngineRoot;
|
|
12394
|
-
return /* @__PURE__ */
|
|
12543
|
+
return /* @__PURE__ */ jsx23(EngineRoot, { ...props });
|
|
12395
12544
|
}
|
|
12396
12545
|
|
|
12397
12546
|
// src/npm.ts
|
|
12398
|
-
import { z as
|
|
12547
|
+
import { z as z50 } from "zod";
|
|
12399
12548
|
export {
|
|
12400
12549
|
ACQUISITION_KIND_LABELS,
|
|
12401
12550
|
ACTIVE_PANEL_ATTR,
|
|
@@ -12421,6 +12570,7 @@ export {
|
|
|
12421
12570
|
AssetSchema,
|
|
12422
12571
|
AttachmentRefSchema,
|
|
12423
12572
|
AttachmentRefsSchema,
|
|
12573
|
+
AttachmentUploadError,
|
|
12424
12574
|
AttributeDefSchema,
|
|
12425
12575
|
AttributeScopeBucketSchema,
|
|
12426
12576
|
AttributeScopeConfigSchema,
|
|
@@ -12488,6 +12638,7 @@ export {
|
|
|
12488
12638
|
DEFAULT_HOSTING,
|
|
12489
12639
|
DEFAULT_PRESENCE_PROFILE,
|
|
12490
12640
|
DEFAULT_SPACE_CONFIG,
|
|
12641
|
+
DEFAULT_SPACE_LOCALE,
|
|
12491
12642
|
DEFAULT_VISITOR_ACCESS,
|
|
12492
12643
|
DIRECTION_FLOW,
|
|
12493
12644
|
DROP_REASONS,
|
|
@@ -12530,6 +12681,7 @@ export {
|
|
|
12530
12681
|
HandlerRegistryContext,
|
|
12531
12682
|
HostClearedSchema,
|
|
12532
12683
|
HostPayloadSchema,
|
|
12684
|
+
HydrationNoticeProvider,
|
|
12533
12685
|
HydrationStateContext,
|
|
12534
12686
|
HydratorProvider,
|
|
12535
12687
|
INITIAL_NAV_PRESENTATION,
|
|
@@ -12546,6 +12698,7 @@ export {
|
|
|
12546
12698
|
LlmUsageDailySchema,
|
|
12547
12699
|
MAX_ACTIVE_AGENT_DIRECTIVES,
|
|
12548
12700
|
MAX_ATTACHMENT_BYTES,
|
|
12701
|
+
MAX_ATTACHMENT_MB,
|
|
12549
12702
|
MAX_VISITOR_PROMPT_CHARS,
|
|
12550
12703
|
MIN_WIRE_PROTOCOL_VERSION,
|
|
12551
12704
|
MOBILE_VIEWPORT_MAX,
|
|
@@ -12600,6 +12753,7 @@ export {
|
|
|
12600
12753
|
SOCKET_TICKET_PARAM,
|
|
12601
12754
|
STRUCTURAL_BASELINE_CATALOG,
|
|
12602
12755
|
STRUCTURAL_BASELINE_TYPES,
|
|
12756
|
+
SUPPORTED_SPACE_LOCALES,
|
|
12603
12757
|
SURFACES,
|
|
12604
12758
|
SURFACE_DISPOSITION,
|
|
12605
12759
|
ScrollContainerProvider,
|
|
@@ -12632,6 +12786,8 @@ export {
|
|
|
12632
12786
|
SpaceAgentDirectiveSchema,
|
|
12633
12787
|
SpaceBrandMarkSchema,
|
|
12634
12788
|
SpaceBugSchema,
|
|
12789
|
+
SpaceLocaleProvider,
|
|
12790
|
+
SpaceLocaleSchema,
|
|
12635
12791
|
Spacefront,
|
|
12636
12792
|
SpacefrontCanvas,
|
|
12637
12793
|
SpacefrontPreviewProvider,
|
|
@@ -12690,6 +12846,7 @@ export {
|
|
|
12690
12846
|
arraysEqual,
|
|
12691
12847
|
arrivalFromParams,
|
|
12692
12848
|
arrivalToParams,
|
|
12849
|
+
attachmentFailureOfStatus,
|
|
12693
12850
|
bareComponentType,
|
|
12694
12851
|
buildBaseAttributesConfig,
|
|
12695
12852
|
buildBucketLabelsConfig,
|
|
@@ -12714,6 +12871,7 @@ export {
|
|
|
12714
12871
|
classifyItemChange,
|
|
12715
12872
|
clearAgentPresence,
|
|
12716
12873
|
clearCartActionFailures,
|
|
12874
|
+
clearCodeDiscountSources,
|
|
12717
12875
|
clearProductNameLookups,
|
|
12718
12876
|
clearVariantChoice,
|
|
12719
12877
|
clientStateEntries,
|
|
@@ -12723,6 +12881,7 @@ export {
|
|
|
12723
12881
|
collectLayoutGids,
|
|
12724
12882
|
collectPlacedEntityRefs,
|
|
12725
12883
|
colorHexOf,
|
|
12884
|
+
commerceLocaleOf,
|
|
12726
12885
|
compareSdkVersions,
|
|
12727
12886
|
compressArray,
|
|
12728
12887
|
compressString,
|
|
@@ -12737,6 +12896,7 @@ export {
|
|
|
12737
12896
|
createSessionStorageAdapter,
|
|
12738
12897
|
createTokenOverlapScorer,
|
|
12739
12898
|
createUnavailableProduct,
|
|
12899
|
+
declaredSpaceLocaleOf,
|
|
12740
12900
|
defineEventKind,
|
|
12741
12901
|
derivePropsDoc,
|
|
12742
12902
|
deriveSourceElement,
|
|
@@ -12795,6 +12955,8 @@ export {
|
|
|
12795
12955
|
isPresenceStreamArtifact,
|
|
12796
12956
|
isReservedId,
|
|
12797
12957
|
isVideoUrl,
|
|
12958
|
+
languageNameOf,
|
|
12959
|
+
languageOf,
|
|
12798
12960
|
layoutTopWithin,
|
|
12799
12961
|
listRegisteredPlatforms,
|
|
12800
12962
|
listRegisteredServices,
|
|
@@ -12848,6 +13010,7 @@ export {
|
|
|
12848
13010
|
reducePatch,
|
|
12849
13011
|
refuseCheckoutHandoff,
|
|
12850
13012
|
registerChipRelevanceRule,
|
|
13013
|
+
registerCodeDiscountSource,
|
|
12851
13014
|
registerComponent,
|
|
12852
13015
|
registerEntityPageKind,
|
|
12853
13016
|
registerExclusiveOverlay,
|
|
@@ -12872,6 +13035,7 @@ export {
|
|
|
12872
13035
|
requestVariantChoice,
|
|
12873
13036
|
requiredTopLevelProps,
|
|
12874
13037
|
resetServerState,
|
|
13038
|
+
resolveCodeDiscountSource,
|
|
12875
13039
|
resolveHydrators,
|
|
12876
13040
|
resolvePresenceFactForm,
|
|
12877
13041
|
resolvePresenceForm,
|
|
@@ -12907,6 +13071,7 @@ export {
|
|
|
12907
13071
|
settleArmedCheckoutHandoff,
|
|
12908
13072
|
settledBlocks,
|
|
12909
13073
|
settledCart,
|
|
13074
|
+
spaceLocaleOf,
|
|
12910
13075
|
splitAnswer,
|
|
12911
13076
|
splitSentences,
|
|
12912
13077
|
stateSnapshotSignal,
|
|
@@ -12917,6 +13082,7 @@ export {
|
|
|
12917
13082
|
surfaceEmits,
|
|
12918
13083
|
surfaceSuppressionReason,
|
|
12919
13084
|
text,
|
|
13085
|
+
textDirectionOf,
|
|
12920
13086
|
threadRowAttrs,
|
|
12921
13087
|
toggleCartDrawer,
|
|
12922
13088
|
token,
|
|
@@ -12997,6 +13163,7 @@ export {
|
|
|
12997
13163
|
useHasLeftSeedHome,
|
|
12998
13164
|
useHistoryNav,
|
|
12999
13165
|
useHydrated,
|
|
13166
|
+
useHydrationNotice,
|
|
13000
13167
|
useHydrationState,
|
|
13001
13168
|
useHydrators,
|
|
13002
13169
|
useInlineCompletion,
|
|
@@ -13051,10 +13218,12 @@ export {
|
|
|
13051
13218
|
useSessionState,
|
|
13052
13219
|
useShellRegistry,
|
|
13053
13220
|
useShellRoot,
|
|
13221
|
+
useSpaceLocale,
|
|
13054
13222
|
useStandingOfType,
|
|
13055
13223
|
useStream,
|
|
13056
13224
|
useSuccessFlash,
|
|
13057
13225
|
useSuggestionsWithDefaults,
|
|
13226
|
+
useTextDirection,
|
|
13058
13227
|
useThreadJumpMarks,
|
|
13059
13228
|
useThreadLanding,
|
|
13060
13229
|
useThreadRows,
|
|
@@ -13083,5 +13252,5 @@ export {
|
|
|
13083
13252
|
withCartActorOrigin,
|
|
13084
13253
|
withInteractionTracking,
|
|
13085
13254
|
withSignalTurn,
|
|
13086
|
-
|
|
13255
|
+
z50 as z
|
|
13087
13256
|
};
|