@40rty/ams-sdk 0.5.28 → 0.5.29
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 +1618 -1094
- package/dist/types/ecommerce/src/catalog-product-lookup.d.ts +24 -0
- package/dist/types/ecommerce/src/catalog-search.d.ts +7 -0
- package/dist/types/ecommerce/src/commerce-schemas.d.ts +10 -10
- package/dist/types/ecommerce/src/index.d.ts +1 -0
- package/dist/types/sdk/src/canvas/generation-style.d.ts +20 -1
- package/dist/types/sdk/src/canvas/index.d.ts +3 -3
- package/dist/types/sdk/src/canvas/runtime-hooks.d.ts +5 -1
- package/dist/types/sdk/src/canvas/runtime-types.d.ts +22 -1
- package/dist/types/sdk/src/host/host-modules.d.ts +43 -10
- package/dist/types/sdk/src/provider/index.d.ts +1 -0
- package/dist/types/sdk/src/provider/providers/page-claims.d.ts +50 -0
- package/dist/types/sdk/src/session/FourtySessionContext.d.ts +8 -0
- package/dist/types/sdk/src/session/conversation-key.d.ts +8 -0
- package/dist/types/sdk/src/session/index.d.ts +1 -0
- package/dist/types/sdk/src/shell/conversation/use-conversation-page.d.ts +9 -1
- package/dist/types/sdk/src/verticals/commerce/index.d.ts +2 -0
- package/dist/types/sdk/src/verticals/commerce/price/percent-off.d.ts +11 -0
- package/dist/types/sdk/src/verticals/commerce/product/product-detail-add.d.ts +52 -0
- package/dist/types/sdk/src/verticals/commerce/product/use-product-detail.d.ts +2 -1
- package/dist/types/sdk/src/verticals/commerce/variant/variant-selection.d.ts +22 -1
- package/dist/types/spacestation/src/analytics/index.d.ts +1 -0
- package/dist/types/spacestation/src/analytics/visitor.d.ts +4 -0
- package/dist/types/spacestation/src/contracts/tools/execution-context.d.ts +11 -0
- package/dist/types/spacestation/src/index.d.ts +5 -1
- package/dist/types/spacestation/src/layout/conversation.d.ts +22 -0
- package/dist/types/spacestation/src/signal/turn-ask.d.ts +6 -1
- package/dist/types/spacestation/src/space/space-config.d.ts +13 -0
- package/dist/types/spacestation/src/space/space-description.d.ts +27 -0
- package/dist/types/spacestation/src/space/space-share.d.ts +37 -0
- package/dist/types/spacestation/src/trace/trace-events.d.ts +19 -0
- package/dist/types/spacestation/src/types.d.ts +4 -0
- package/dist/types/spacestation/src/visitor/visitor-country.d.ts +63 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -118,6 +118,7 @@ __export(src_exports3, {
|
|
|
118
118
|
CmsPolicySchema: () => CmsPolicySchema,
|
|
119
119
|
CollectionSchema: () => CollectionSchema,
|
|
120
120
|
ComponentErrorBoundary: () => ComponentErrorBoundary,
|
|
121
|
+
CountryCodeSchema: () => CountryCodeSchema,
|
|
121
122
|
CreateCommentInputSchema: () => CreateCommentInputSchema,
|
|
122
123
|
CreateTraceInputSchema: () => CreateTraceInputSchema,
|
|
123
124
|
DEFAULT_GENERATION_STYLE: () => DEFAULT_GENERATION_STYLE,
|
|
@@ -195,6 +196,7 @@ __export(src_exports3, {
|
|
|
195
196
|
MOBILE_VIEWPORT_MAX: () => MOBILE_VIEWPORT_MAX,
|
|
196
197
|
MoneySchema: () => MoneySchema,
|
|
197
198
|
NAVIGATE_SIGNAL: () => NAVIGATE_SIGNAL,
|
|
199
|
+
NO_VISITOR_COUNTRY: () => NO_VISITOR_COUNTRY,
|
|
198
200
|
NavigatePayloadSchema: () => NavigatePayloadSchema,
|
|
199
201
|
NullComponent: () => NullComponent,
|
|
200
202
|
OLDEST_SUPPORTED_SDK: () => OLDEST_SUPPORTED_SDK,
|
|
@@ -215,6 +217,7 @@ __export(src_exports3, {
|
|
|
215
217
|
PackageBundleRefSchema: () => PackageBundleRefSchema,
|
|
216
218
|
PackageLookupProvider: () => PackageLookupProvider,
|
|
217
219
|
PackageReleaseSchema: () => PackageReleaseSchema,
|
|
220
|
+
PageClaimContext: () => PageClaimContext,
|
|
218
221
|
PageSchema: () => PageSchema,
|
|
219
222
|
PatchSchema: () => PatchSchema,
|
|
220
223
|
PointedAtSchema: () => PointedAtSchema,
|
|
@@ -251,10 +254,13 @@ __export(src_exports3, {
|
|
|
251
254
|
SDK_VERSION_PATTERN: () => SDK_VERSION_PATTERN,
|
|
252
255
|
SELECTION_ORIGIN_VISITOR: () => SELECTION_ORIGIN_VISITOR,
|
|
253
256
|
SESSION_UNAVAILABLE_CLOSE: () => SESSION_UNAVAILABLE_CLOSE,
|
|
257
|
+
SETTLE_PULSE: () => SETTLE_PULSE,
|
|
254
258
|
SIGNAL_PATCH_PREFIX: () => SIGNAL_PATCH_PREFIX,
|
|
255
259
|
SOCKET_BEARER_SUBPROTOCOL_PREFIX: () => SOCKET_BEARER_SUBPROTOCOL_PREFIX,
|
|
256
260
|
SOCKET_SUBPROTOCOL: () => SOCKET_SUBPROTOCOL,
|
|
257
261
|
SOCKET_TICKET_PARAM: () => SOCKET_TICKET_PARAM,
|
|
262
|
+
SPACE_DESCRIPTION_MAX_CHARS: () => SPACE_DESCRIPTION_MAX_CHARS,
|
|
263
|
+
SPACE_SHARE_QUERY_MAX_CHARS: () => SPACE_SHARE_QUERY_MAX_CHARS,
|
|
258
264
|
STRUCTURAL_BASELINE_CATALOG: () => STRUCTURAL_BASELINE_CATALOG,
|
|
259
265
|
STRUCTURAL_BASELINE_TYPES: () => STRUCTURAL_BASELINE_TYPES,
|
|
260
266
|
SUPPORTED_SPACE_LOCALES: () => SUPPORTED_SPACE_LOCALES,
|
|
@@ -293,8 +299,10 @@ __export(src_exports3, {
|
|
|
293
299
|
SpaceAgentDirectiveSchema: () => SpaceAgentDirectiveSchema,
|
|
294
300
|
SpaceBrandMarkSchema: () => SpaceBrandMarkSchema,
|
|
295
301
|
SpaceBugSchema: () => SpaceBugSchema,
|
|
302
|
+
SpaceDescriptionSchema: () => SpaceDescriptionSchema,
|
|
296
303
|
SpaceLocaleProvider: () => SpaceLocaleProvider,
|
|
297
304
|
SpaceLocaleSchema: () => SpaceLocaleSchema,
|
|
305
|
+
SpaceShareQuerySchema: () => SpaceShareQuerySchema,
|
|
298
306
|
SpacefrontCanvas: () => SpacefrontCanvas,
|
|
299
307
|
SpacefrontPreviewProvider: () => SpacefrontPreviewProvider,
|
|
300
308
|
SpecSchema: () => SpecSchema,
|
|
@@ -329,6 +337,8 @@ __export(src_exports3, {
|
|
|
329
337
|
VIEW_HOST_SIGNAL: () => VIEW_HOST_SIGNAL,
|
|
330
338
|
VISITOR_ACCESS: () => VISITOR_ACCESS,
|
|
331
339
|
VISITOR_CONTEXT_SIGNAL: () => VISITOR_CONTEXT_SIGNAL,
|
|
340
|
+
VISITOR_COUNTRY_CHOICE_NAMESPACE: () => VISITOR_COUNTRY_CHOICE_NAMESPACE,
|
|
341
|
+
VISITOR_COUNTRY_OBSERVED_NAMESPACE: () => VISITOR_COUNTRY_OBSERVED_NAMESPACE,
|
|
332
342
|
VISITOR_ID_DURABILITIES: () => VISITOR_ID_DURABILITIES,
|
|
333
343
|
VISITOR_NAME_SIGNAL: () => VISITOR_NAME_SIGNAL,
|
|
334
344
|
VideoSourceSchema: () => VideoSourceSchema,
|
|
@@ -337,6 +347,7 @@ __export(src_exports3, {
|
|
|
337
347
|
ViewportFocusSchema: () => ViewportFocusSchema,
|
|
338
348
|
ViewportWindowContext: () => ViewportWindowContext,
|
|
339
349
|
ViewportWindowProvider: () => ViewportWindowProvider,
|
|
350
|
+
VisitorCountryStateSchema: () => VisitorCountryStateSchema,
|
|
340
351
|
VisitorIdDurabilitySchema: () => VisitorIdDurabilitySchema,
|
|
341
352
|
WIRE_PROTOCOL_PARAM: () => WIRE_PROTOCOL_PARAM,
|
|
342
353
|
WIRE_PROTOCOL_UNSUPPORTED_CLOSE: () => WIRE_PROTOCOL_UNSUPPORTED_CLOSE,
|
|
@@ -346,6 +357,8 @@ __export(src_exports3, {
|
|
|
346
357
|
WireCatalogSchema: () => WireCatalogSchema,
|
|
347
358
|
WireSchemaSchema: () => WireSchemaSchema,
|
|
348
359
|
WishlistSnapshotSchema: () => WishlistSnapshotSchema,
|
|
360
|
+
XHandleSchema: () => XHandleSchema,
|
|
361
|
+
X_HANDLE_PATTERN: () => X_HANDLE_PATTERN,
|
|
349
362
|
adaptCatalogComponent: () => adaptCatalogComponent,
|
|
350
363
|
adaptComponent: () => adaptComponent,
|
|
351
364
|
anchorLineOf: () => anchorLineOf,
|
|
@@ -357,6 +370,7 @@ __export(src_exports3, {
|
|
|
357
370
|
arrivalToParams: () => arrivalToParams,
|
|
358
371
|
attachmentFailureOfStatus: () => attachmentFailureOfStatus,
|
|
359
372
|
bareComponentType: () => bareComponentType,
|
|
373
|
+
bareXHandle: () => bareXHandle,
|
|
360
374
|
bearerFromSocketProtocols: () => bearerFromSocketProtocols,
|
|
361
375
|
boardLabelKey: () => boardLabelKey,
|
|
362
376
|
buildBaseAttributesConfig: () => buildBaseAttributesConfig,
|
|
@@ -386,6 +400,7 @@ __export(src_exports3, {
|
|
|
386
400
|
clearAgentPresence: () => clearAgentPresence,
|
|
387
401
|
clearBuyerSignIns: () => clearBuyerSignIns,
|
|
388
402
|
clearCartActionFailures: () => clearCartActionFailures,
|
|
403
|
+
clearCatalogProductLookups: () => clearCatalogProductLookups,
|
|
389
404
|
clearCatalogSearches: () => clearCatalogSearches,
|
|
390
405
|
clearCodeDiscountSources: () => clearCodeDiscountSources,
|
|
391
406
|
clearProductFieldReaders: () => clearProductFieldReaders,
|
|
@@ -410,10 +425,12 @@ __export(src_exports3, {
|
|
|
410
425
|
computeActiveChips: () => computeActiveChips,
|
|
411
426
|
consentDisposition: () => consentDisposition,
|
|
412
427
|
consumeArmedCheckoutHandoff: () => consumeArmedCheckoutHandoff,
|
|
428
|
+
conversationKeyOf: () => conversationKeyOf,
|
|
413
429
|
createAliasedRegistry: () => createAliasedRegistry,
|
|
414
430
|
createAnalyticsScope: () => createAnalyticsScope,
|
|
415
431
|
createLocalStorageAdapter: () => createLocalStorageAdapter,
|
|
416
432
|
createMemoryStorageAdapter: () => createMemoryStorageAdapter,
|
|
433
|
+
createPageClaimRegistry: () => createPageClaimRegistry,
|
|
417
434
|
createRegistry: () => createRegistry,
|
|
418
435
|
createSessionStorageAdapter: () => createSessionStorageAdapter,
|
|
419
436
|
createTokenOverlapScorer: () => createTokenOverlapScorer,
|
|
@@ -466,6 +483,7 @@ __export(src_exports3, {
|
|
|
466
483
|
installmentPayment: () => installmentPayment,
|
|
467
484
|
isActiveDirective: () => isActiveDirective,
|
|
468
485
|
isAllowedAttachmentType: () => isAllowedAttachmentType,
|
|
486
|
+
isCountryCode: () => isCountryCode,
|
|
469
487
|
isDeclaredProductField: () => isDeclaredProductField,
|
|
470
488
|
isDegenerateLayout: () => isDegenerateLayout,
|
|
471
489
|
isDiscountCodeQueued: () => isDiscountCodeQueued,
|
|
@@ -506,6 +524,7 @@ __export(src_exports3, {
|
|
|
506
524
|
pagePlace: () => pagePlace,
|
|
507
525
|
parseBcp47Locale: () => parseBcp47Locale,
|
|
508
526
|
parseReleasePreview: () => parseReleasePreview,
|
|
527
|
+
percentOff: () => percentOff,
|
|
509
528
|
pickCartAddAction: () => pickCartAddAction,
|
|
510
529
|
pickCollectionAction: () => pickCollectionAction,
|
|
511
530
|
pickProductCardAction: () => pickProductCardAction,
|
|
@@ -518,6 +537,7 @@ __export(src_exports3, {
|
|
|
518
537
|
previewBoardEdit: () => previewBoardEdit,
|
|
519
538
|
primedEntities: () => primedEntities,
|
|
520
539
|
primedEntitiesFor: () => primedEntitiesFor,
|
|
540
|
+
productDetailAddResult: () => productDetailAddResult,
|
|
521
541
|
productTypeBucket: () => productTypeBucket,
|
|
522
542
|
projectCollection: () => projectCollection,
|
|
523
543
|
projectProduct: () => projectProduct,
|
|
@@ -544,6 +564,7 @@ __export(src_exports3, {
|
|
|
544
564
|
reducePatch: () => reducePatch,
|
|
545
565
|
refuseCheckoutHandoff: () => refuseCheckoutHandoff,
|
|
546
566
|
registerBuyerSignIn: () => registerBuyerSignIn,
|
|
567
|
+
registerCatalogProductLookup: () => registerCatalogProductLookup,
|
|
547
568
|
registerCatalogSearch: () => registerCatalogSearch,
|
|
548
569
|
registerChipRelevanceRule: () => registerChipRelevanceRule,
|
|
549
570
|
registerCodeDiscountSource: () => registerCodeDiscountSource,
|
|
@@ -579,6 +600,7 @@ __export(src_exports3, {
|
|
|
579
600
|
requiredTopLevelProps: () => requiredTopLevelProps,
|
|
580
601
|
resetServerState: () => resetServerState,
|
|
581
602
|
resolveBuyerSignIn: () => resolveBuyerSignIn,
|
|
603
|
+
resolveCatalogProductLookup: () => resolveCatalogProductLookup,
|
|
582
604
|
resolveCatalogSearch: () => resolveCatalogSearch,
|
|
583
605
|
resolveCodeDiscountSource: () => resolveCodeDiscountSource,
|
|
584
606
|
resolveHydrators: () => resolveHydrators,
|
|
@@ -625,7 +647,9 @@ __export(src_exports3, {
|
|
|
625
647
|
settledBlocks: () => settledBlocks,
|
|
626
648
|
settledCart: () => settledCart,
|
|
627
649
|
socketProtocolsFor: () => socketProtocolsFor,
|
|
650
|
+
spaceDescriptionOf: () => spaceDescriptionOf,
|
|
628
651
|
spaceLocaleOf: () => spaceLocaleOf,
|
|
652
|
+
spaceShareOf: () => spaceShareOf,
|
|
629
653
|
splitAnswer: () => splitAnswer,
|
|
630
654
|
splitSentences: () => splitSentences,
|
|
631
655
|
stateSnapshotSignal: () => stateSnapshotSignal,
|
|
@@ -682,6 +706,7 @@ __export(src_exports3, {
|
|
|
682
706
|
useCartLineRow: () => useCartLineRow,
|
|
683
707
|
useCartView: () => useCartView,
|
|
684
708
|
useCheckoutHandoff: () => useCheckoutHandoff,
|
|
709
|
+
useClaimPage: () => useClaimPage,
|
|
685
710
|
useClampToggle: () => useClampToggle,
|
|
686
711
|
useCollectionByHandle: () => useCollectionByHandle,
|
|
687
712
|
useCommerceActions: () => useCommerceActions,
|
|
@@ -812,6 +837,7 @@ __export(src_exports3, {
|
|
|
812
837
|
useVariantSelections: () => useVariantSelections,
|
|
813
838
|
useViewportWindow: () => useViewportWindow,
|
|
814
839
|
useVisibleFactList: () => useVisibleFactList,
|
|
840
|
+
useVisitorCountry: () => useVisitorCountry,
|
|
815
841
|
useVisitorName: () => useVisitorName,
|
|
816
842
|
useVoiceCapture: () => useVoiceCapture,
|
|
817
843
|
useWaitingSubmitOrigin: () => useWaitingSubmitOrigin,
|
|
@@ -822,6 +848,7 @@ __export(src_exports3, {
|
|
|
822
848
|
variantForSelections: () => variantForSelections,
|
|
823
849
|
viewportRectOf: () => viewportRectOf,
|
|
824
850
|
visitorAccessOf: () => visitorAccessOf,
|
|
851
|
+
visitorCountryInEffect: () => visitorCountryInEffect,
|
|
825
852
|
wipePhases: () => wipePhases,
|
|
826
853
|
wipeProfile: () => wipeProfile,
|
|
827
854
|
withCartActorOrigin: () => withCartActorOrigin,
|
|
@@ -866,6 +893,7 @@ __export(analytics_exports, {
|
|
|
866
893
|
AnalyticsWireEventSchema: () => AnalyticsWireEventSchema,
|
|
867
894
|
ENGAGEMENT_DWELL_MS: () => ENGAGEMENT_DWELL_MS,
|
|
868
895
|
SESSION_ENGAGED: () => SESSION_ENGAGED,
|
|
896
|
+
VISITOR_COUNTRY_CHOSEN: () => VISITOR_COUNTRY_CHOSEN,
|
|
869
897
|
catalogEmittableSchema: () => catalogEmittableSchema,
|
|
870
898
|
catalogEventSchema: () => catalogEventSchema,
|
|
871
899
|
defineEventKind: () => defineEventKind,
|
|
@@ -889,8 +917,290 @@ var SESSION_ENGAGED = defineEventKind(
|
|
|
889
917
|
}).strict()
|
|
890
918
|
);
|
|
891
919
|
|
|
892
|
-
// ../spacestation/src/analytics/
|
|
920
|
+
// ../spacestation/src/analytics/visitor.ts
|
|
921
|
+
import { z as z3 } from "zod";
|
|
922
|
+
|
|
923
|
+
// ../spacestation/src/visitor/visitor-country.ts
|
|
893
924
|
import { z as z2 } from "zod";
|
|
925
|
+
var ISO_3166_ALPHA2 = /* @__PURE__ */ new Set([
|
|
926
|
+
"AD",
|
|
927
|
+
"AE",
|
|
928
|
+
"AF",
|
|
929
|
+
"AG",
|
|
930
|
+
"AI",
|
|
931
|
+
"AL",
|
|
932
|
+
"AM",
|
|
933
|
+
"AO",
|
|
934
|
+
"AQ",
|
|
935
|
+
"AR",
|
|
936
|
+
"AS",
|
|
937
|
+
"AT",
|
|
938
|
+
"AU",
|
|
939
|
+
"AW",
|
|
940
|
+
"AX",
|
|
941
|
+
"AZ",
|
|
942
|
+
"BA",
|
|
943
|
+
"BB",
|
|
944
|
+
"BD",
|
|
945
|
+
"BE",
|
|
946
|
+
"BF",
|
|
947
|
+
"BG",
|
|
948
|
+
"BH",
|
|
949
|
+
"BI",
|
|
950
|
+
"BJ",
|
|
951
|
+
"BL",
|
|
952
|
+
"BM",
|
|
953
|
+
"BN",
|
|
954
|
+
"BO",
|
|
955
|
+
"BQ",
|
|
956
|
+
"BR",
|
|
957
|
+
"BS",
|
|
958
|
+
"BT",
|
|
959
|
+
"BV",
|
|
960
|
+
"BW",
|
|
961
|
+
"BY",
|
|
962
|
+
"BZ",
|
|
963
|
+
"CA",
|
|
964
|
+
"CC",
|
|
965
|
+
"CD",
|
|
966
|
+
"CF",
|
|
967
|
+
"CG",
|
|
968
|
+
"CH",
|
|
969
|
+
"CI",
|
|
970
|
+
"CK",
|
|
971
|
+
"CL",
|
|
972
|
+
"CM",
|
|
973
|
+
"CN",
|
|
974
|
+
"CO",
|
|
975
|
+
"CR",
|
|
976
|
+
"CU",
|
|
977
|
+
"CV",
|
|
978
|
+
"CW",
|
|
979
|
+
"CX",
|
|
980
|
+
"CY",
|
|
981
|
+
"CZ",
|
|
982
|
+
"DE",
|
|
983
|
+
"DJ",
|
|
984
|
+
"DK",
|
|
985
|
+
"DM",
|
|
986
|
+
"DO",
|
|
987
|
+
"DZ",
|
|
988
|
+
"EC",
|
|
989
|
+
"EE",
|
|
990
|
+
"EG",
|
|
991
|
+
"EH",
|
|
992
|
+
"ER",
|
|
993
|
+
"ES",
|
|
994
|
+
"ET",
|
|
995
|
+
"FI",
|
|
996
|
+
"FJ",
|
|
997
|
+
"FK",
|
|
998
|
+
"FM",
|
|
999
|
+
"FO",
|
|
1000
|
+
"FR",
|
|
1001
|
+
"GA",
|
|
1002
|
+
"GB",
|
|
1003
|
+
"GD",
|
|
1004
|
+
"GE",
|
|
1005
|
+
"GF",
|
|
1006
|
+
"GG",
|
|
1007
|
+
"GH",
|
|
1008
|
+
"GI",
|
|
1009
|
+
"GL",
|
|
1010
|
+
"GM",
|
|
1011
|
+
"GN",
|
|
1012
|
+
"GP",
|
|
1013
|
+
"GQ",
|
|
1014
|
+
"GR",
|
|
1015
|
+
"GS",
|
|
1016
|
+
"GT",
|
|
1017
|
+
"GU",
|
|
1018
|
+
"GW",
|
|
1019
|
+
"GY",
|
|
1020
|
+
"HK",
|
|
1021
|
+
"HM",
|
|
1022
|
+
"HN",
|
|
1023
|
+
"HR",
|
|
1024
|
+
"HT",
|
|
1025
|
+
"HU",
|
|
1026
|
+
"ID",
|
|
1027
|
+
"IE",
|
|
1028
|
+
"IL",
|
|
1029
|
+
"IM",
|
|
1030
|
+
"IN",
|
|
1031
|
+
"IO",
|
|
1032
|
+
"IQ",
|
|
1033
|
+
"IR",
|
|
1034
|
+
"IS",
|
|
1035
|
+
"IT",
|
|
1036
|
+
"JE",
|
|
1037
|
+
"JM",
|
|
1038
|
+
"JO",
|
|
1039
|
+
"JP",
|
|
1040
|
+
"KE",
|
|
1041
|
+
"KG",
|
|
1042
|
+
"KH",
|
|
1043
|
+
"KI",
|
|
1044
|
+
"KM",
|
|
1045
|
+
"KN",
|
|
1046
|
+
"KP",
|
|
1047
|
+
"KR",
|
|
1048
|
+
"KW",
|
|
1049
|
+
"KY",
|
|
1050
|
+
"KZ",
|
|
1051
|
+
"LA",
|
|
1052
|
+
"LB",
|
|
1053
|
+
"LC",
|
|
1054
|
+
"LI",
|
|
1055
|
+
"LK",
|
|
1056
|
+
"LR",
|
|
1057
|
+
"LS",
|
|
1058
|
+
"LT",
|
|
1059
|
+
"LU",
|
|
1060
|
+
"LV",
|
|
1061
|
+
"LY",
|
|
1062
|
+
"MA",
|
|
1063
|
+
"MC",
|
|
1064
|
+
"MD",
|
|
1065
|
+
"ME",
|
|
1066
|
+
"MF",
|
|
1067
|
+
"MG",
|
|
1068
|
+
"MH",
|
|
1069
|
+
"MK",
|
|
1070
|
+
"ML",
|
|
1071
|
+
"MM",
|
|
1072
|
+
"MN",
|
|
1073
|
+
"MO",
|
|
1074
|
+
"MP",
|
|
1075
|
+
"MQ",
|
|
1076
|
+
"MR",
|
|
1077
|
+
"MS",
|
|
1078
|
+
"MT",
|
|
1079
|
+
"MU",
|
|
1080
|
+
"MV",
|
|
1081
|
+
"MW",
|
|
1082
|
+
"MX",
|
|
1083
|
+
"MY",
|
|
1084
|
+
"MZ",
|
|
1085
|
+
"NA",
|
|
1086
|
+
"NC",
|
|
1087
|
+
"NE",
|
|
1088
|
+
"NF",
|
|
1089
|
+
"NG",
|
|
1090
|
+
"NI",
|
|
1091
|
+
"NL",
|
|
1092
|
+
"NO",
|
|
1093
|
+
"NP",
|
|
1094
|
+
"NR",
|
|
1095
|
+
"NU",
|
|
1096
|
+
"NZ",
|
|
1097
|
+
"OM",
|
|
1098
|
+
"PA",
|
|
1099
|
+
"PE",
|
|
1100
|
+
"PF",
|
|
1101
|
+
"PG",
|
|
1102
|
+
"PH",
|
|
1103
|
+
"PK",
|
|
1104
|
+
"PL",
|
|
1105
|
+
"PM",
|
|
1106
|
+
"PN",
|
|
1107
|
+
"PR",
|
|
1108
|
+
"PS",
|
|
1109
|
+
"PT",
|
|
1110
|
+
"PW",
|
|
1111
|
+
"PY",
|
|
1112
|
+
"QA",
|
|
1113
|
+
"RE",
|
|
1114
|
+
"RO",
|
|
1115
|
+
"RS",
|
|
1116
|
+
"RU",
|
|
1117
|
+
"RW",
|
|
1118
|
+
"SA",
|
|
1119
|
+
"SB",
|
|
1120
|
+
"SC",
|
|
1121
|
+
"SD",
|
|
1122
|
+
"SE",
|
|
1123
|
+
"SG",
|
|
1124
|
+
"SH",
|
|
1125
|
+
"SI",
|
|
1126
|
+
"SJ",
|
|
1127
|
+
"SK",
|
|
1128
|
+
"SL",
|
|
1129
|
+
"SM",
|
|
1130
|
+
"SN",
|
|
1131
|
+
"SO",
|
|
1132
|
+
"SR",
|
|
1133
|
+
"SS",
|
|
1134
|
+
"ST",
|
|
1135
|
+
"SV",
|
|
1136
|
+
"SX",
|
|
1137
|
+
"SY",
|
|
1138
|
+
"SZ",
|
|
1139
|
+
"TC",
|
|
1140
|
+
"TD",
|
|
1141
|
+
"TF",
|
|
1142
|
+
"TG",
|
|
1143
|
+
"TH",
|
|
1144
|
+
"TJ",
|
|
1145
|
+
"TK",
|
|
1146
|
+
"TL",
|
|
1147
|
+
"TM",
|
|
1148
|
+
"TN",
|
|
1149
|
+
"TO",
|
|
1150
|
+
"TR",
|
|
1151
|
+
"TT",
|
|
1152
|
+
"TV",
|
|
1153
|
+
"TW",
|
|
1154
|
+
"TZ",
|
|
1155
|
+
"UA",
|
|
1156
|
+
"UG",
|
|
1157
|
+
"UM",
|
|
1158
|
+
"US",
|
|
1159
|
+
"UY",
|
|
1160
|
+
"UZ",
|
|
1161
|
+
"VA",
|
|
1162
|
+
"VC",
|
|
1163
|
+
"VE",
|
|
1164
|
+
"VG",
|
|
1165
|
+
"VI",
|
|
1166
|
+
"VN",
|
|
1167
|
+
"VU",
|
|
1168
|
+
"WF",
|
|
1169
|
+
"WS",
|
|
1170
|
+
"YE",
|
|
1171
|
+
"YT",
|
|
1172
|
+
"ZA",
|
|
1173
|
+
"ZM",
|
|
1174
|
+
"ZW"
|
|
1175
|
+
]);
|
|
1176
|
+
function isCountryCode(value2) {
|
|
1177
|
+
return typeof value2 === "string" && ISO_3166_ALPHA2.has(value2);
|
|
1178
|
+
}
|
|
1179
|
+
var CountryCodeSchema = z2.string().refine(isCountryCode, { message: "not an ISO 3166-1 alpha-2 country code" });
|
|
1180
|
+
var NO_VISITOR_COUNTRY = { country: null, source: null };
|
|
1181
|
+
function visitorCountryInEffect(facts) {
|
|
1182
|
+
if (facts.chosen !== null) return { country: facts.chosen, source: "chosen" };
|
|
1183
|
+
if (facts.observed !== null) return { country: facts.observed, source: "observed" };
|
|
1184
|
+
return NO_VISITOR_COUNTRY;
|
|
1185
|
+
}
|
|
1186
|
+
var VISITOR_COUNTRY_CHOICE_NAMESPACE = "visitorCountryChoice";
|
|
1187
|
+
var VISITOR_COUNTRY_OBSERVED_NAMESPACE = "visitorCountryObserved";
|
|
1188
|
+
var VisitorCountryStateSchema = z2.object({ country: CountryCodeSchema.nullable() });
|
|
1189
|
+
|
|
1190
|
+
// ../spacestation/src/analytics/visitor.ts
|
|
1191
|
+
var VISITOR_COUNTRY_CHOSEN = defineEventKind(
|
|
1192
|
+
"visitor.country_chosen",
|
|
1193
|
+
"client",
|
|
1194
|
+
z3.object({
|
|
1195
|
+
/** ISO 3166-1 alpha-2 the visitor chose. */
|
|
1196
|
+
chosen: CountryCodeSchema,
|
|
1197
|
+
/** The country the server observed for them at that moment, or null when it had none. */
|
|
1198
|
+
observed: CountryCodeSchema.nullable()
|
|
1199
|
+
}).strict()
|
|
1200
|
+
);
|
|
1201
|
+
|
|
1202
|
+
// ../spacestation/src/analytics/catalog.ts
|
|
1203
|
+
import { z as z4 } from "zod";
|
|
894
1204
|
function eventCatalog(...kinds) {
|
|
895
1205
|
const byName = /* @__PURE__ */ new Map();
|
|
896
1206
|
for (const kind of kinds) {
|
|
@@ -924,18 +1234,18 @@ function accepts(catalog, value2, emittableOnly) {
|
|
|
924
1234
|
return found.schema.safeParse(payload).success;
|
|
925
1235
|
}
|
|
926
1236
|
function catalogEventSchema(catalog) {
|
|
927
|
-
return
|
|
1237
|
+
return z4.custom((value2) => accepts(catalog, value2, false), {
|
|
928
1238
|
message: "Not a registered analytics event kind, or the payload does not match its schema"
|
|
929
1239
|
});
|
|
930
1240
|
}
|
|
931
1241
|
function catalogEmittableSchema(catalog) {
|
|
932
|
-
return
|
|
1242
|
+
return z4.custom((value2) => accepts(catalog, value2, true), {
|
|
933
1243
|
message: "Not a registered, browser-emittable analytics event kind, or the payload does not match its schema"
|
|
934
1244
|
});
|
|
935
1245
|
}
|
|
936
1246
|
|
|
937
1247
|
// ../spacestation/src/analytics/envelope.ts
|
|
938
|
-
import { z as
|
|
1248
|
+
import { z as z5 } from "zod";
|
|
939
1249
|
var ANALYTICS_SURFACES = [
|
|
940
1250
|
/** The public spacefront — visitor traffic. EMITS. */
|
|
941
1251
|
"spacefront",
|
|
@@ -954,21 +1264,21 @@ var ANALYTICS_SURFACES = [
|
|
|
954
1264
|
/** A signed-in operator browsing the live `/{slug}` — not visitor traffic. */
|
|
955
1265
|
"operator-preview"
|
|
956
1266
|
];
|
|
957
|
-
var AnalyticsSurfaceSchema =
|
|
1267
|
+
var AnalyticsSurfaceSchema = z5.enum(ANALYTICS_SURFACES);
|
|
958
1268
|
var ANALYTICS_CONSENTS = ["granted", "pending", "withheld"];
|
|
959
|
-
var AnalyticsConsentSchema =
|
|
1269
|
+
var AnalyticsConsentSchema = z5.enum(ANALYTICS_CONSENTS);
|
|
960
1270
|
var ANALYTICS_MAX_QUEUED = 500;
|
|
961
|
-
var AnalyticsDropCountsSchema =
|
|
962
|
-
|
|
963
|
-
|
|
1271
|
+
var AnalyticsDropCountsSchema = z5.record(
|
|
1272
|
+
z5.string().min(1).max(64),
|
|
1273
|
+
z5.number().int().nonnegative()
|
|
964
1274
|
);
|
|
965
|
-
var AnalyticsWireEventSchema =
|
|
1275
|
+
var AnalyticsWireEventSchema = z5.object({
|
|
966
1276
|
/**
|
|
967
1277
|
* The idempotency key, minted at EMIT and byte-identical on retry — which is
|
|
968
1278
|
* what the row's `ON CONFLICT DO NOTHING` absorption needs to make a re-sent
|
|
969
1279
|
* batch a no-op rather than a double count.
|
|
970
1280
|
*/
|
|
971
|
-
eventId:
|
|
1281
|
+
eventId: z5.string().min(1).max(128),
|
|
972
1282
|
/**
|
|
973
1283
|
* Wall-clock epoch milliseconds, stamped at EMIT and not at flush. A row can
|
|
974
1284
|
* sit in the pre-session holding area for the reconnect budget's ~94 seconds,
|
|
@@ -978,14 +1288,14 @@ var AnalyticsWireEventSchema = z3.object({
|
|
|
978
1288
|
* window around `received_at` with an exception row naming it. Clamping would
|
|
979
1289
|
* turn a broken clock into a plausible number, which is worse than a gap.
|
|
980
1290
|
*/
|
|
981
|
-
occurredAt:
|
|
1291
|
+
occurredAt: z5.number().int().positive(),
|
|
982
1292
|
/**
|
|
983
1293
|
* Never null on the wire. The scope holds unattributed rows until
|
|
984
1294
|
* `bindSession`, so a row without a session is a row that was never sent.
|
|
985
1295
|
*/
|
|
986
|
-
sessionId:
|
|
987
|
-
kind:
|
|
988
|
-
payload:
|
|
1296
|
+
sessionId: z5.string().min(1).max(128),
|
|
1297
|
+
kind: z5.string().min(1).max(128),
|
|
1298
|
+
payload: z5.record(z5.unknown()),
|
|
989
1299
|
/**
|
|
990
1300
|
* The agent turn whose canvas the event came from — stamped by the scope
|
|
991
1301
|
* from the element the emit ran inside, never by the emit site; `null` when
|
|
@@ -994,19 +1304,19 @@ var AnalyticsWireEventSchema = z3.object({
|
|
|
994
1304
|
* (header) is what keeps that bundle's batch alive. Lands in the typed
|
|
995
1305
|
* `client_events.turn_id` column — the join to `agent_runs.turn_id`.
|
|
996
1306
|
*/
|
|
997
|
-
turnId:
|
|
1307
|
+
turnId: z5.string().min(1).max(128).nullable().optional()
|
|
998
1308
|
});
|
|
999
|
-
var AnalyticsBatchSchema =
|
|
1309
|
+
var AnalyticsBatchSchema = z5.object({
|
|
1000
1310
|
/** One mount's whole life. Lets the server see a mount's batches as one
|
|
1001
1311
|
* stream, and is the tiebreaker for any `(session_id, …)` dedupe key if a
|
|
1002
1312
|
* host ever moves from session storage to local storage. */
|
|
1003
|
-
scopeId:
|
|
1313
|
+
scopeId: z5.string().min(1).max(128),
|
|
1004
1314
|
surface: AnalyticsSurfaceSchema,
|
|
1005
1315
|
/** A SLUG, never an id — see `spaceId` above. */
|
|
1006
|
-
spaceSlug:
|
|
1316
|
+
spaceSlug: z5.string().min(1).max(128),
|
|
1007
1317
|
consent: AnalyticsConsentSchema,
|
|
1008
1318
|
drops: AnalyticsDropCountsSchema,
|
|
1009
|
-
events:
|
|
1319
|
+
events: z5.array(AnalyticsWireEventSchema).min(1).max(ANALYTICS_MAX_QUEUED)
|
|
1010
1320
|
});
|
|
1011
1321
|
|
|
1012
1322
|
// src/analytics/notify.ts
|
|
@@ -1577,6 +1887,7 @@ __export(session_exports, {
|
|
|
1577
1887
|
FourtySessionContext: () => FourtySessionContext,
|
|
1578
1888
|
SpaceLocaleProvider: () => SpaceLocaleProvider,
|
|
1579
1889
|
commerceLocaleOf: () => commerceLocaleOf,
|
|
1890
|
+
conversationKeyOf: () => conversationKeyOf,
|
|
1580
1891
|
getVisitorLocale: () => getVisitorLocale,
|
|
1581
1892
|
registerSessionScopedClear: () => registerSessionScopedClear,
|
|
1582
1893
|
runSessionScopedClearHandlers: () => runSessionScopedClearHandlers,
|
|
@@ -1662,6 +1973,7 @@ __export(src_exports, {
|
|
|
1662
1973
|
CartSnapshotLineSchema: () => CartSnapshotLineSchema,
|
|
1663
1974
|
CartSnapshotSchema: () => CartSnapshotSchema,
|
|
1664
1975
|
ClickIdKindSchema: () => ClickIdKindSchema,
|
|
1976
|
+
CountryCodeSchema: () => CountryCodeSchema,
|
|
1665
1977
|
CreateCommentInputSchema: () => CreateCommentInputSchema,
|
|
1666
1978
|
CreateTraceInputSchema: () => CreateTraceInputSchema,
|
|
1667
1979
|
DEFAULT_HOSTING: () => DEFAULT_HOSTING,
|
|
@@ -1709,6 +2021,7 @@ __export(src_exports, {
|
|
|
1709
2021
|
MIN_WIRE_PROTOCOL_VERSION: () => MIN_WIRE_PROTOCOL_VERSION,
|
|
1710
2022
|
MOBILE_VIEWPORT_MAX: () => MOBILE_VIEWPORT_MAX,
|
|
1711
2023
|
NAVIGATE_SIGNAL: () => NAVIGATE_SIGNAL,
|
|
2024
|
+
NO_VISITOR_COUNTRY: () => NO_VISITOR_COUNTRY,
|
|
1712
2025
|
NavigatePayloadSchema: () => NavigatePayloadSchema,
|
|
1713
2026
|
OLDEST_SUPPORTED_SDK: () => OLDEST_SUPPORTED_SDK,
|
|
1714
2027
|
PAGELESS_HOST_PLACE: () => PAGELESS_HOST_PLACE,
|
|
@@ -1746,6 +2059,8 @@ __export(src_exports, {
|
|
|
1746
2059
|
SOCKET_BEARER_SUBPROTOCOL_PREFIX: () => SOCKET_BEARER_SUBPROTOCOL_PREFIX,
|
|
1747
2060
|
SOCKET_SUBPROTOCOL: () => SOCKET_SUBPROTOCOL,
|
|
1748
2061
|
SOCKET_TICKET_PARAM: () => SOCKET_TICKET_PARAM,
|
|
2062
|
+
SPACE_DESCRIPTION_MAX_CHARS: () => SPACE_DESCRIPTION_MAX_CHARS,
|
|
2063
|
+
SPACE_SHARE_QUERY_MAX_CHARS: () => SPACE_SHARE_QUERY_MAX_CHARS,
|
|
1749
2064
|
STRUCTURAL_BASELINE_CATALOG: () => STRUCTURAL_BASELINE_CATALOG,
|
|
1750
2065
|
STRUCTURAL_BASELINE_TYPES: () => STRUCTURAL_BASELINE_TYPES,
|
|
1751
2066
|
SUPPORTED_SPACE_LOCALES: () => SUPPORTED_SPACE_LOCALES,
|
|
@@ -1775,7 +2090,9 @@ __export(src_exports, {
|
|
|
1775
2090
|
SpaceAgentDirectiveSchema: () => SpaceAgentDirectiveSchema,
|
|
1776
2091
|
SpaceBrandMarkSchema: () => SpaceBrandMarkSchema,
|
|
1777
2092
|
SpaceBugSchema: () => SpaceBugSchema,
|
|
2093
|
+
SpaceDescriptionSchema: () => SpaceDescriptionSchema,
|
|
1778
2094
|
SpaceLocaleSchema: () => SpaceLocaleSchema,
|
|
2095
|
+
SpaceShareQuerySchema: () => SpaceShareQuerySchema,
|
|
1779
2096
|
SpecSchema: () => SpecSchema,
|
|
1780
2097
|
StateSnapshotFrameSchema: () => StateSnapshotFrameSchema,
|
|
1781
2098
|
SuggestionActionSchema: () => SuggestionActionSchema,
|
|
@@ -1800,11 +2117,14 @@ __export(src_exports, {
|
|
|
1800
2117
|
VIEW_HOST_SIGNAL: () => VIEW_HOST_SIGNAL,
|
|
1801
2118
|
VISITOR_ACCESS: () => VISITOR_ACCESS,
|
|
1802
2119
|
VISITOR_CONTEXT_SIGNAL: () => VISITOR_CONTEXT_SIGNAL,
|
|
2120
|
+
VISITOR_COUNTRY_CHOICE_NAMESPACE: () => VISITOR_COUNTRY_CHOICE_NAMESPACE,
|
|
2121
|
+
VISITOR_COUNTRY_OBSERVED_NAMESPACE: () => VISITOR_COUNTRY_OBSERVED_NAMESPACE,
|
|
1803
2122
|
VISITOR_ID_DURABILITIES: () => VISITOR_ID_DURABILITIES,
|
|
1804
2123
|
VISITOR_NAME_SIGNAL: () => VISITOR_NAME_SIGNAL,
|
|
1805
2124
|
ViewExtendPayloadSchema: () => ViewExtendPayloadSchema,
|
|
1806
2125
|
ViewSchema: () => ViewSchema,
|
|
1807
2126
|
ViewportFocusSchema: () => ViewportFocusSchema,
|
|
2127
|
+
VisitorCountryStateSchema: () => VisitorCountryStateSchema,
|
|
1808
2128
|
VisitorIdDurabilitySchema: () => VisitorIdDurabilitySchema,
|
|
1809
2129
|
WIRE_PROTOCOL_PARAM: () => WIRE_PROTOCOL_PARAM,
|
|
1810
2130
|
WIRE_PROTOCOL_UNSUPPORTED_CLOSE: () => WIRE_PROTOCOL_UNSUPPORTED_CLOSE,
|
|
@@ -1814,11 +2134,14 @@ __export(src_exports, {
|
|
|
1814
2134
|
WireCatalogSchema: () => WireCatalogSchema,
|
|
1815
2135
|
WireSchemaSchema: () => WireSchemaSchema,
|
|
1816
2136
|
WishlistSnapshotSchema: () => WishlistSnapshotSchema,
|
|
2137
|
+
XHandleSchema: () => XHandleSchema,
|
|
2138
|
+
X_HANDLE_PATTERN: () => X_HANDLE_PATTERN,
|
|
1817
2139
|
applySinglePatch: () => applySinglePatch,
|
|
1818
2140
|
arrivalFromParams: () => arrivalFromParams,
|
|
1819
2141
|
arrivalToParams: () => arrivalToParams,
|
|
1820
2142
|
attachmentFailureOfStatus: () => attachmentFailureOfStatus,
|
|
1821
2143
|
bareComponentType: () => bareComponentType,
|
|
2144
|
+
bareXHandle: () => bareXHandle,
|
|
1822
2145
|
bearerFromSocketProtocols: () => bearerFromSocketProtocols,
|
|
1823
2146
|
boardLabelKey: () => boardLabelKey,
|
|
1824
2147
|
canonicalOptionValue: () => canonicalOptionValue,
|
|
@@ -1850,6 +2173,7 @@ __export(src_exports, {
|
|
|
1850
2173
|
hostingAllows: () => hostingAllows,
|
|
1851
2174
|
isActiveDirective: () => isActiveDirective,
|
|
1852
2175
|
isAllowedAttachmentType: () => isAllowedAttachmentType,
|
|
2176
|
+
isCountryCode: () => isCountryCode,
|
|
1853
2177
|
isDegenerateLayout: () => isDegenerateLayout,
|
|
1854
2178
|
isDraftSource: () => isDraftSource,
|
|
1855
2179
|
isElementUnfilled: () => isElementUnfilled,
|
|
@@ -1893,7 +2217,9 @@ __export(src_exports, {
|
|
|
1893
2217
|
sdkWindowProblem: () => sdkWindowProblem,
|
|
1894
2218
|
settledBlocks: () => settledBlocks,
|
|
1895
2219
|
socketProtocolsFor: () => socketProtocolsFor,
|
|
2220
|
+
spaceDescriptionOf: () => spaceDescriptionOf,
|
|
1896
2221
|
spaceLocaleOf: () => spaceLocaleOf,
|
|
2222
|
+
spaceShareOf: () => spaceShareOf,
|
|
1897
2223
|
splitSentences: () => splitSentences,
|
|
1898
2224
|
stateSnapshotSignal: () => stateSnapshotSignal,
|
|
1899
2225
|
statedValueVerdict: () => statedValueVerdict,
|
|
@@ -1904,11 +2230,12 @@ __export(src_exports, {
|
|
|
1904
2230
|
turnAskPlainText: () => turnAskPlainText,
|
|
1905
2231
|
turnAskSegments: () => turnAskSegments,
|
|
1906
2232
|
visitorAccessOf: () => visitorAccessOf,
|
|
2233
|
+
visitorCountryInEffect: () => visitorCountryInEffect,
|
|
1907
2234
|
withCartActorOrigin: () => withCartActorOrigin
|
|
1908
2235
|
});
|
|
1909
2236
|
|
|
1910
2237
|
// ../spacestation/src/layout/layout.ts
|
|
1911
|
-
import { z as
|
|
2238
|
+
import { z as z6 } from "zod";
|
|
1912
2239
|
var JSON_PATCH_OPS = ["add", "remove", "replace", "move"];
|
|
1913
2240
|
var EMPTY_SPEC = {
|
|
1914
2241
|
root: "page",
|
|
@@ -1924,28 +2251,28 @@ function isDegenerateLayout(spec) {
|
|
|
1924
2251
|
if (!Array.isArray(children) || children.length === 0) return true;
|
|
1925
2252
|
return false;
|
|
1926
2253
|
}
|
|
1927
|
-
var UIElementSchema =
|
|
1928
|
-
type:
|
|
1929
|
-
props:
|
|
1930
|
-
children:
|
|
1931
|
-
experience:
|
|
1932
|
-
__turnId:
|
|
1933
|
-
});
|
|
1934
|
-
var SpecSchema =
|
|
1935
|
-
root:
|
|
1936
|
-
aliases:
|
|
1937
|
-
elements:
|
|
1938
|
-
state:
|
|
1939
|
-
});
|
|
1940
|
-
var JsonPatchOpSchema =
|
|
1941
|
-
op:
|
|
1942
|
-
path:
|
|
1943
|
-
value:
|
|
1944
|
-
from:
|
|
1945
|
-
});
|
|
1946
|
-
var AgentOutputSchema =
|
|
2254
|
+
var UIElementSchema = z6.object({
|
|
2255
|
+
type: z6.string(),
|
|
2256
|
+
props: z6.record(z6.unknown()).default({}),
|
|
2257
|
+
children: z6.array(z6.string()).optional(),
|
|
2258
|
+
experience: z6.string().optional(),
|
|
2259
|
+
__turnId: z6.string().optional()
|
|
2260
|
+
});
|
|
2261
|
+
var SpecSchema = z6.object({
|
|
2262
|
+
root: z6.string(),
|
|
2263
|
+
aliases: z6.record(z6.string()).optional(),
|
|
2264
|
+
elements: z6.record(UIElementSchema),
|
|
2265
|
+
state: z6.record(z6.unknown()).optional()
|
|
2266
|
+
});
|
|
2267
|
+
var JsonPatchOpSchema = z6.object({
|
|
2268
|
+
op: z6.enum(JSON_PATCH_OPS),
|
|
2269
|
+
path: z6.string(),
|
|
2270
|
+
value: z6.unknown().optional(),
|
|
2271
|
+
from: z6.string().optional()
|
|
2272
|
+
});
|
|
2273
|
+
var AgentOutputSchema = z6.object({
|
|
1947
2274
|
layout: SpecSchema.optional(),
|
|
1948
|
-
patches:
|
|
2275
|
+
patches: z6.array(JsonPatchOpSchema).optional()
|
|
1949
2276
|
});
|
|
1950
2277
|
var BASE_PACKAGE = "@fourty/ui";
|
|
1951
2278
|
function resolveType(type, aliases) {
|
|
@@ -1992,22 +2319,22 @@ function diffLayouts(before, after) {
|
|
|
1992
2319
|
}
|
|
1993
2320
|
|
|
1994
2321
|
// ../spacestation/src/layout/patch.ts
|
|
1995
|
-
import { z as
|
|
1996
|
-
var PatchSchema =
|
|
1997
|
-
|
|
1998
|
-
id:
|
|
1999
|
-
op:
|
|
2322
|
+
import { z as z7 } from "zod";
|
|
2323
|
+
var PatchSchema = z7.union([
|
|
2324
|
+
z7.object({
|
|
2325
|
+
id: z7.string().min(1),
|
|
2326
|
+
op: z7.literal("set"),
|
|
2000
2327
|
element: UIElementSchema
|
|
2001
2328
|
}),
|
|
2002
|
-
|
|
2003
|
-
id:
|
|
2004
|
-
op:
|
|
2005
|
-
field:
|
|
2006
|
-
value:
|
|
2329
|
+
z7.object({
|
|
2330
|
+
id: z7.string().min(1),
|
|
2331
|
+
op: z7.literal("append"),
|
|
2332
|
+
field: z7.string().min(1),
|
|
2333
|
+
value: z7.union([z7.string(), z7.array(z7.unknown())])
|
|
2007
2334
|
}),
|
|
2008
|
-
|
|
2009
|
-
id:
|
|
2010
|
-
op:
|
|
2335
|
+
z7.object({
|
|
2336
|
+
id: z7.string().min(1),
|
|
2337
|
+
op: z7.literal("remove")
|
|
2011
2338
|
})
|
|
2012
2339
|
]);
|
|
2013
2340
|
|
|
@@ -2076,45 +2403,45 @@ function reducePatch(spec, patch) {
|
|
|
2076
2403
|
}
|
|
2077
2404
|
|
|
2078
2405
|
// ../spacestation/src/layout/page.ts
|
|
2079
|
-
import { z as
|
|
2406
|
+
import { z as z10 } from "zod";
|
|
2080
2407
|
|
|
2081
2408
|
// ../spacestation/src/shell/shell.ts
|
|
2082
|
-
import { z as
|
|
2409
|
+
import { z as z9 } from "zod";
|
|
2083
2410
|
|
|
2084
2411
|
// ../spacestation/src/signal/agent-signals.ts
|
|
2085
|
-
import { z as
|
|
2086
|
-
var ToolCallHintSchema =
|
|
2087
|
-
name:
|
|
2088
|
-
args:
|
|
2089
|
-
});
|
|
2090
|
-
var AgentSignalSchema =
|
|
2091
|
-
id:
|
|
2092
|
-
label:
|
|
2093
|
-
type:
|
|
2094
|
-
payload:
|
|
2095
|
-
icon:
|
|
2412
|
+
import { z as z8 } from "zod";
|
|
2413
|
+
var ToolCallHintSchema = z8.object({
|
|
2414
|
+
name: z8.string().min(1),
|
|
2415
|
+
args: z8.record(z8.unknown())
|
|
2416
|
+
});
|
|
2417
|
+
var AgentSignalSchema = z8.object({
|
|
2418
|
+
id: z8.string().optional(),
|
|
2419
|
+
label: z8.string().optional(),
|
|
2420
|
+
type: z8.string(),
|
|
2421
|
+
payload: z8.record(z8.unknown()).optional(),
|
|
2422
|
+
icon: z8.string().optional(),
|
|
2096
2423
|
expectedTool: ToolCallHintSchema.optional()
|
|
2097
2424
|
});
|
|
2098
2425
|
var MAX_VISITOR_PROMPT_CHARS = 2e3;
|
|
2099
|
-
var InteractionSignalSchema =
|
|
2100
|
-
type:
|
|
2101
|
-
timestamp:
|
|
2102
|
-
payload:
|
|
2103
|
-
causedBy:
|
|
2426
|
+
var InteractionSignalSchema = z8.object({
|
|
2427
|
+
type: z8.string().min(1).max(64),
|
|
2428
|
+
timestamp: z8.number().optional(),
|
|
2429
|
+
payload: z8.object({ text: z8.string().max(MAX_VISITOR_PROMPT_CHARS).optional() }).catchall(z8.unknown()).optional(),
|
|
2430
|
+
causedBy: z8.string().max(200).optional()
|
|
2104
2431
|
});
|
|
2105
2432
|
var SuggestionActionSchema = AgentSignalSchema;
|
|
2106
|
-
var SuggestionActionStrictSchema =
|
|
2107
|
-
id:
|
|
2108
|
-
label:
|
|
2109
|
-
type:
|
|
2110
|
-
payload:
|
|
2111
|
-
icon:
|
|
2433
|
+
var SuggestionActionStrictSchema = z8.object({
|
|
2434
|
+
id: z8.string(),
|
|
2435
|
+
label: z8.string(),
|
|
2436
|
+
type: z8.string(),
|
|
2437
|
+
payload: z8.record(z8.unknown()),
|
|
2438
|
+
icon: z8.string().optional(),
|
|
2112
2439
|
expectedTool: ToolCallHintSchema.optional()
|
|
2113
2440
|
});
|
|
2114
|
-
var SuggestionActionsSchema =
|
|
2115
|
-
type:
|
|
2116
|
-
actions:
|
|
2117
|
-
heading:
|
|
2441
|
+
var SuggestionActionsSchema = z8.object({
|
|
2442
|
+
type: z8.literal("suggestion_cards"),
|
|
2443
|
+
actions: z8.array(SuggestionActionStrictSchema),
|
|
2444
|
+
heading: z8.string().optional()
|
|
2118
2445
|
});
|
|
2119
2446
|
var SIGNAL_PATCH_PREFIX = "/signals/";
|
|
2120
2447
|
var NAVIGATE_SIGNAL = "navigate";
|
|
@@ -2130,15 +2457,15 @@ var FEED_QUESTION_FLOW = "feed.question";
|
|
|
2130
2457
|
var EPHEMERAL_FACT_FLOWS = [PRESENCE_FLOW, DIRECTION_FLOW];
|
|
2131
2458
|
|
|
2132
2459
|
// ../spacestation/src/shell/shell.ts
|
|
2133
|
-
var ShellMenuItemSchema =
|
|
2134
|
-
label:
|
|
2460
|
+
var ShellMenuItemSchema = z9.object({
|
|
2461
|
+
label: z9.string(),
|
|
2135
2462
|
action: AgentSignalSchema,
|
|
2136
2463
|
/** Optional secondary label shown beside the main label (e.g. "→"). */
|
|
2137
|
-
hint:
|
|
2464
|
+
hint: z9.string().optional(),
|
|
2138
2465
|
/** Optional icon hint for renderers that show menu icons. */
|
|
2139
|
-
icon:
|
|
2466
|
+
icon: z9.string().optional()
|
|
2140
2467
|
});
|
|
2141
|
-
var ShellConfigSchema =
|
|
2468
|
+
var ShellConfigSchema = z9.record(z9.unknown());
|
|
2142
2469
|
var EMPTY_SHELL = {};
|
|
2143
2470
|
|
|
2144
2471
|
// ../spacestation/src/layout/page.ts
|
|
@@ -2151,22 +2478,22 @@ function registerPageKindSchema(kind, schema, options = {}) {
|
|
|
2151
2478
|
function registeredPageKinds() {
|
|
2152
2479
|
return [...pageKindSchemas.keys()];
|
|
2153
2480
|
}
|
|
2154
|
-
registerPageKindSchema("home",
|
|
2481
|
+
registerPageKindSchema("home", z10.object({ kind: z10.literal("home") }));
|
|
2155
2482
|
registerPageKindSchema(
|
|
2156
2483
|
"message",
|
|
2157
|
-
|
|
2158
|
-
kind:
|
|
2159
|
-
messageIndex:
|
|
2160
|
-
messageId:
|
|
2484
|
+
z10.object({
|
|
2485
|
+
kind: z10.literal("message"),
|
|
2486
|
+
messageIndex: z10.number().int().nonnegative(),
|
|
2487
|
+
messageId: z10.string().min(1).optional()
|
|
2161
2488
|
}),
|
|
2162
2489
|
{ identityOmit: ["messageId"] }
|
|
2163
2490
|
);
|
|
2164
2491
|
registerPageKindSchema(
|
|
2165
2492
|
"answer",
|
|
2166
|
-
|
|
2167
|
-
kind:
|
|
2168
|
-
messageIndex:
|
|
2169
|
-
messageId:
|
|
2493
|
+
z10.object({
|
|
2494
|
+
kind: z10.literal("answer"),
|
|
2495
|
+
messageIndex: z10.number().int().nonnegative(),
|
|
2496
|
+
messageId: z10.string().min(1).optional()
|
|
2170
2497
|
}),
|
|
2171
2498
|
{ identityOmit: ["messageId"] }
|
|
2172
2499
|
);
|
|
@@ -2177,7 +2504,7 @@ function lookupPageKindSchema(val) {
|
|
|
2177
2504
|
const schema = pageKindSchemas.get(kind);
|
|
2178
2505
|
return schema === void 0 ? null : schema;
|
|
2179
2506
|
}
|
|
2180
|
-
var PageSchema =
|
|
2507
|
+
var PageSchema = z10.custom((val) => {
|
|
2181
2508
|
const schema = lookupPageKindSchema(val);
|
|
2182
2509
|
if (schema === null) return false;
|
|
2183
2510
|
return schema.safeParse(val).success;
|
|
@@ -2187,15 +2514,15 @@ var PageSchema = z8.custom((val) => {
|
|
|
2187
2514
|
const parsed = schema.safeParse(val);
|
|
2188
2515
|
return parsed.success ? parsed.data : val;
|
|
2189
2516
|
});
|
|
2190
|
-
var NavigatePayloadSchema =
|
|
2517
|
+
var NavigatePayloadSchema = z10.object({
|
|
2191
2518
|
page: PageSchema
|
|
2192
2519
|
});
|
|
2193
|
-
var ViewportFocusSchema =
|
|
2194
|
-
visibleElementIds:
|
|
2195
|
-
topElementId:
|
|
2196
|
-
nearBottom:
|
|
2520
|
+
var ViewportFocusSchema = z10.object({
|
|
2521
|
+
visibleElementIds: z10.array(z10.string()),
|
|
2522
|
+
topElementId: z10.string().min(1).optional(),
|
|
2523
|
+
nearBottom: z10.boolean().optional()
|
|
2197
2524
|
});
|
|
2198
|
-
var ViewSchema =
|
|
2525
|
+
var ViewSchema = z10.object({
|
|
2199
2526
|
page: PageSchema,
|
|
2200
2527
|
layout: SpecSchema,
|
|
2201
2528
|
shell: ShellConfigSchema
|
|
@@ -2211,52 +2538,52 @@ function pageIdentityKey(page) {
|
|
|
2211
2538
|
}
|
|
2212
2539
|
|
|
2213
2540
|
// ../spacestation/src/commerce/page-kinds.ts
|
|
2214
|
-
import { z as
|
|
2541
|
+
import { z as z11 } from "zod";
|
|
2215
2542
|
registerPageKindSchema(
|
|
2216
2543
|
"product",
|
|
2217
|
-
|
|
2218
|
-
kind:
|
|
2219
|
-
id:
|
|
2220
|
-
morph:
|
|
2221
|
-
title:
|
|
2544
|
+
z11.object({
|
|
2545
|
+
kind: z11.literal("product"),
|
|
2546
|
+
id: z11.string().min(1),
|
|
2547
|
+
morph: z11.boolean().optional(),
|
|
2548
|
+
title: z11.string().optional()
|
|
2222
2549
|
}),
|
|
2223
2550
|
{ identityOmit: ["morph"] }
|
|
2224
2551
|
);
|
|
2225
2552
|
registerPageKindSchema(
|
|
2226
2553
|
"collection",
|
|
2227
|
-
|
|
2228
|
-
kind:
|
|
2229
|
-
handle:
|
|
2230
|
-
products:
|
|
2231
|
-
title:
|
|
2554
|
+
z11.object({
|
|
2555
|
+
kind: z11.literal("collection"),
|
|
2556
|
+
handle: z11.string().min(1),
|
|
2557
|
+
products: z11.array(z11.string()).optional(),
|
|
2558
|
+
title: z11.string().optional()
|
|
2232
2559
|
}),
|
|
2233
2560
|
{ identityOmit: ["products"] }
|
|
2234
2561
|
);
|
|
2235
2562
|
registerPageKindSchema(
|
|
2236
2563
|
"search",
|
|
2237
|
-
|
|
2238
|
-
kind:
|
|
2239
|
-
query:
|
|
2240
|
-
products:
|
|
2564
|
+
z11.object({
|
|
2565
|
+
kind: z11.literal("search"),
|
|
2566
|
+
query: z11.string(),
|
|
2567
|
+
products: z11.array(z11.string()).optional()
|
|
2241
2568
|
}),
|
|
2242
2569
|
{ identityOmit: ["products"] }
|
|
2243
2570
|
);
|
|
2244
|
-
registerPageKindSchema("article",
|
|
2245
|
-
registerPageKindSchema("cms",
|
|
2571
|
+
registerPageKindSchema("article", z11.object({ kind: z11.literal("article"), id: z11.string().min(1) }));
|
|
2572
|
+
registerPageKindSchema("cms", z11.object({ kind: z11.literal("cms"), handle: z11.string().min(1) }));
|
|
2246
2573
|
|
|
2247
2574
|
// ../spacestation/src/commerce/cart-state.ts
|
|
2248
|
-
import { z as
|
|
2249
|
-
var CartSnapshotLineSchema =
|
|
2250
|
-
productId:
|
|
2251
|
-
title:
|
|
2252
|
-
selection:
|
|
2253
|
-
quantity:
|
|
2575
|
+
import { z as z12 } from "zod";
|
|
2576
|
+
var CartSnapshotLineSchema = z12.object({
|
|
2577
|
+
productId: z12.string().min(1),
|
|
2578
|
+
title: z12.string(),
|
|
2579
|
+
selection: z12.string().min(1).optional(),
|
|
2580
|
+
quantity: z12.number().int().positive()
|
|
2254
2581
|
});
|
|
2255
|
-
var CartSnapshotSchema =
|
|
2256
|
-
lines:
|
|
2582
|
+
var CartSnapshotSchema = z12.object({
|
|
2583
|
+
lines: z12.array(CartSnapshotLineSchema)
|
|
2257
2584
|
});
|
|
2258
|
-
var WishlistSnapshotSchema =
|
|
2259
|
-
productIds:
|
|
2585
|
+
var WishlistSnapshotSchema = z12.object({
|
|
2586
|
+
productIds: z12.array(z12.string().min(1))
|
|
2260
2587
|
});
|
|
2261
2588
|
|
|
2262
2589
|
// ../spacestation/src/commerce/selection-signal.ts
|
|
@@ -2265,10 +2592,10 @@ var SELECTION_ORIGIN_VISITOR = "visitor";
|
|
|
2265
2592
|
var VARIANT_SELECTED_OBSERVATION = "variant.selected";
|
|
2266
2593
|
|
|
2267
2594
|
// ../spacestation/src/commerce/cart-add-signal.ts
|
|
2268
|
-
import { z as
|
|
2595
|
+
import { z as z15 } from "zod";
|
|
2269
2596
|
|
|
2270
2597
|
// ../spacestation/src/analytics/ecommerce/events.ts
|
|
2271
|
-
import { z as
|
|
2598
|
+
import { z as z13 } from "zod";
|
|
2272
2599
|
var CART_ORIGINS = ["visitor", "agent", "webmcp"];
|
|
2273
2600
|
var CHECKOUT_ORIGINS = ["visitor", "agent"];
|
|
2274
2601
|
var CHECKOUT_OUTCOMES = [
|
|
@@ -2309,7 +2636,7 @@ var CART_SETTLE_TRIGGERS = [
|
|
|
2309
2636
|
var CART_LINE_ADDED = defineEventKind(
|
|
2310
2637
|
"commerce.cart_line_added",
|
|
2311
2638
|
"client",
|
|
2312
|
-
|
|
2639
|
+
z13.object({
|
|
2313
2640
|
/**
|
|
2314
2641
|
* ONE visitor/agent INTENT, minted once per intent and shared by every
|
|
2315
2642
|
* `addLine` call that intent produces. This is why metric #5a is
|
|
@@ -2321,47 +2648,47 @@ var CART_LINE_ADDED = defineEventKind(
|
|
|
2321
2648
|
* product resolution; it is load-bearing and is not being deleted to make
|
|
2322
2649
|
* a count easier.
|
|
2323
2650
|
*/
|
|
2324
|
-
attemptId:
|
|
2651
|
+
attemptId: z13.string().min(1).max(128),
|
|
2325
2652
|
/**
|
|
2326
2653
|
* NULLABLE AND REQUIRED. A quick-add from a batch CTA knows the variant
|
|
2327
2654
|
* and not always the product, so writing `null` is a decision the call
|
|
2328
2655
|
* site has to make. `productId?: string` would let it be forgotten, and a
|
|
2329
2656
|
* forgotten field and a deliberate null are indistinguishable afterwards.
|
|
2330
2657
|
*/
|
|
2331
|
-
productId:
|
|
2332
|
-
variantId:
|
|
2333
|
-
quantity:
|
|
2334
|
-
origin:
|
|
2658
|
+
productId: z13.string().min(1).max(256).nullable(),
|
|
2659
|
+
variantId: z13.string().min(1).max(256),
|
|
2660
|
+
quantity: z13.number().int().positive(),
|
|
2661
|
+
origin: z13.enum(CART_ORIGINS)
|
|
2335
2662
|
}).strict()
|
|
2336
2663
|
);
|
|
2337
2664
|
var CART_LINE_REMOVED = defineEventKind(
|
|
2338
2665
|
"commerce.cart_line_removed",
|
|
2339
2666
|
"client",
|
|
2340
|
-
|
|
2341
|
-
lineId:
|
|
2667
|
+
z13.object({
|
|
2668
|
+
lineId: z13.string().min(1).max(256),
|
|
2342
2669
|
/** Nullable and required, for the same reason as the add's: the line's
|
|
2343
2670
|
* product is read off the settled cart, and the settled cart is not
|
|
2344
2671
|
* always in hand at the facade. */
|
|
2345
|
-
productId:
|
|
2346
|
-
origin:
|
|
2672
|
+
productId: z13.string().min(1).max(256).nullable(),
|
|
2673
|
+
origin: z13.enum(CART_ORIGINS)
|
|
2347
2674
|
}).strict()
|
|
2348
2675
|
);
|
|
2349
2676
|
var CART_SETTLED = defineEventKind(
|
|
2350
2677
|
"commerce.cart_settled",
|
|
2351
2678
|
"client",
|
|
2352
|
-
|
|
2353
|
-
trigger:
|
|
2354
|
-
lineCount:
|
|
2355
|
-
totalQuantity:
|
|
2356
|
-
subtotalAmount:
|
|
2679
|
+
z13.object({
|
|
2680
|
+
trigger: z13.enum(CART_SETTLE_TRIGGERS),
|
|
2681
|
+
lineCount: z13.number().int().nonnegative(),
|
|
2682
|
+
totalQuantity: z13.number().int().nonnegative(),
|
|
2683
|
+
subtotalAmount: z13.number().nonnegative().finite(),
|
|
2357
2684
|
/** ISO-4217 alpha-3, as the storefront reports it. */
|
|
2358
|
-
currencyCode:
|
|
2685
|
+
currencyCode: z13.string().regex(/^[A-Z]{3}$/),
|
|
2359
2686
|
/**
|
|
2360
2687
|
* True when the cart still carries a pending line, so its totals are
|
|
2361
2688
|
* mid-flight. Reported rather than suppressed: a subtotal that is honest
|
|
2362
2689
|
* about being provisional is usable, and a row that never arrives is not.
|
|
2363
2690
|
*/
|
|
2364
|
-
totalsPending:
|
|
2691
|
+
totalsPending: z13.boolean(),
|
|
2365
2692
|
/**
|
|
2366
2693
|
* The cart's OPAQUE back-office handle — what the connector's own back
|
|
2367
2694
|
* office knows this cart by, so a reviewer can open the order it became.
|
|
@@ -2378,29 +2705,29 @@ var CART_SETTLED = defineEventKind(
|
|
|
2378
2705
|
* Nullable and required: a platform with no back office writes `null`
|
|
2379
2706
|
* explicitly, so "no handle" is an assertion rather than an omission.
|
|
2380
2707
|
*/
|
|
2381
|
-
backOfficeRef:
|
|
2708
|
+
backOfficeRef: z13.string().nullable()
|
|
2382
2709
|
}).strict()
|
|
2383
2710
|
);
|
|
2384
2711
|
var CHECKOUT_CLICKED = defineEventKind(
|
|
2385
2712
|
"commerce.checkout_clicked",
|
|
2386
2713
|
"client",
|
|
2387
|
-
|
|
2388
|
-
origin:
|
|
2389
|
-
outcome:
|
|
2714
|
+
z13.object({
|
|
2715
|
+
origin: z13.enum(CHECKOUT_ORIGINS),
|
|
2716
|
+
outcome: z13.enum(CHECKOUT_OUTCOMES),
|
|
2390
2717
|
/** Nullable and required: every non-`unavailable` outcome writes `null`
|
|
2391
2718
|
* explicitly, so "no refusal" is an assertion rather than an omission. */
|
|
2392
|
-
refusal:
|
|
2719
|
+
refusal: z13.enum(CHECKOUT_REFUSALS).nullable(),
|
|
2393
2720
|
/** The store's monotone per-session counter, starting at 1. */
|
|
2394
|
-
attempt:
|
|
2721
|
+
attempt: z13.number().int().positive()
|
|
2395
2722
|
}).strict()
|
|
2396
2723
|
);
|
|
2397
2724
|
var REGISTRY_CLICKED = defineEventKind(
|
|
2398
2725
|
"commerce.registry_clicked",
|
|
2399
2726
|
"client",
|
|
2400
|
-
|
|
2727
|
+
z13.object({
|
|
2401
2728
|
/** One visitor intent. Minted per click so a double-click is two
|
|
2402
2729
|
* attempts, exactly as two taps on Add to cart are two attempts. */
|
|
2403
|
-
attemptId:
|
|
2730
|
+
attemptId: z13.string().min(1).max(128),
|
|
2404
2731
|
/**
|
|
2405
2732
|
* WHICH registry. Free-form and bounded rather than an enum, because
|
|
2406
2733
|
* `RegistryProvider.id` is a `string` the brand supplies and the
|
|
@@ -2410,41 +2737,41 @@ var REGISTRY_CLICKED = defineEventKind(
|
|
|
2410
2737
|
* — for the sake of a validation that buys the read layer nothing it
|
|
2411
2738
|
* cannot do with a `GROUP BY`.
|
|
2412
2739
|
*/
|
|
2413
|
-
partnerId:
|
|
2740
|
+
partnerId: z13.string().min(1).max(64),
|
|
2414
2741
|
/** Nullable and required, for the same reason the cart add's is: a
|
|
2415
2742
|
* registry action rendered outside a product detail has no product in
|
|
2416
2743
|
* scope, and writing `null` is a decision the call site has to make
|
|
2417
2744
|
* rather than a field it can forget. */
|
|
2418
|
-
productId:
|
|
2419
|
-
origin:
|
|
2745
|
+
productId: z13.string().min(1).max(256).nullable(),
|
|
2746
|
+
origin: z13.enum(CART_ORIGINS)
|
|
2420
2747
|
}).strict()
|
|
2421
2748
|
);
|
|
2422
2749
|
|
|
2423
2750
|
// ../spacestation/src/commerce/cart-verb-signals.ts
|
|
2424
|
-
import { z as
|
|
2751
|
+
import { z as z14 } from "zod";
|
|
2425
2752
|
var CART_REMOVE_SIGNAL = "cart.remove";
|
|
2426
2753
|
var CART_SET_QUANTITY_SIGNAL = "cart.set_quantity";
|
|
2427
2754
|
var CHECKOUT_BEGIN_SIGNAL = "checkout.begin";
|
|
2428
|
-
var CartRemoveSignalPayloadSchema =
|
|
2429
|
-
origin:
|
|
2430
|
-
productId:
|
|
2431
|
-
selections:
|
|
2755
|
+
var CartRemoveSignalPayloadSchema = z14.object({
|
|
2756
|
+
origin: z14.enum(CART_ORIGINS),
|
|
2757
|
+
productId: z14.string().min(1),
|
|
2758
|
+
selections: z14.record(z14.string()).optional()
|
|
2432
2759
|
});
|
|
2433
2760
|
var CART_REMOVE_MALFORMED_REASON = "that request was missing something \u2014 nothing was removed";
|
|
2434
2761
|
|
|
2435
2762
|
// ../spacestation/src/commerce/cart-add-signal.ts
|
|
2436
|
-
var CartLineAttributeSchema =
|
|
2437
|
-
key:
|
|
2438
|
-
value:
|
|
2763
|
+
var CartLineAttributeSchema = z15.object({
|
|
2764
|
+
key: z15.string().min(1),
|
|
2765
|
+
value: z15.string()
|
|
2439
2766
|
});
|
|
2440
2767
|
var CART_ADD_SIGNAL = "cart.add";
|
|
2441
|
-
var CartAddSignalPayloadSchema =
|
|
2442
|
-
origin:
|
|
2443
|
-
productId:
|
|
2444
|
-
variantId:
|
|
2445
|
-
quantity:
|
|
2446
|
-
selections:
|
|
2447
|
-
optimisticLine:
|
|
2768
|
+
var CartAddSignalPayloadSchema = z15.object({
|
|
2769
|
+
origin: z15.enum(CART_ORIGINS),
|
|
2770
|
+
productId: z15.string().optional(),
|
|
2771
|
+
variantId: z15.string().optional(),
|
|
2772
|
+
quantity: z15.number().optional(),
|
|
2773
|
+
selections: z15.record(z15.string()).optional(),
|
|
2774
|
+
optimisticLine: z15.unknown().optional(),
|
|
2448
2775
|
/**
|
|
2449
2776
|
* The agent turn whose canvas element the add came from — stamped by the sdk
|
|
2450
2777
|
* session hooks for a producer inside a turn (`turn-attributed-session.ts`),
|
|
@@ -2453,7 +2780,7 @@ var CartAddSignalPayloadSchema = z13.object({
|
|
|
2453
2780
|
* Carried for the same reason as `origin`: the handler that emits the outcome
|
|
2454
2781
|
* sees only this payload.
|
|
2455
2782
|
*/
|
|
2456
|
-
turnId:
|
|
2783
|
+
turnId: z15.string().min(1).optional(),
|
|
2457
2784
|
/**
|
|
2458
2785
|
* Whether a LANDED add announces itself by opening the cart drawer on the
|
|
2459
2786
|
* changed line. Absent means yes, which is every existing producer's
|
|
@@ -2470,13 +2797,13 @@ var CartAddSignalPayloadSchema = z13.object({
|
|
|
2470
2797
|
* property of the INTENT — the producer is the only frame that knows why the
|
|
2471
2798
|
* add is happening — and the handler is several frames away from it.
|
|
2472
2799
|
*/
|
|
2473
|
-
acknowledgeInDrawer:
|
|
2800
|
+
acknowledgeInDrawer: z15.boolean().optional(),
|
|
2474
2801
|
/**
|
|
2475
2802
|
* Line attributes the added line carries (`CartLineAttribute`). Absent means
|
|
2476
2803
|
* no attributes, which is every existing producer. Set by a brand PDP that
|
|
2477
2804
|
* tags the line it adds (`useProductDetail(product, { lineAttributes })`).
|
|
2478
2805
|
*/
|
|
2479
|
-
attributes:
|
|
2806
|
+
attributes: z15.array(CartLineAttributeSchema).optional()
|
|
2480
2807
|
});
|
|
2481
2808
|
var CART_ADD_MALFORMED_REASON = "that request was missing something \u2014 nothing was added";
|
|
2482
2809
|
var ORIGIN_BEARING_CART_SIGNALS = /* @__PURE__ */ new Set([CART_ADD_SIGNAL, CART_REMOVE_SIGNAL]);
|
|
@@ -2504,69 +2831,95 @@ function chipsFromShowSignal(signal) {
|
|
|
2504
2831
|
}
|
|
2505
2832
|
|
|
2506
2833
|
// ../spacestation/src/signal/visitor-view.ts
|
|
2507
|
-
import { z as
|
|
2834
|
+
import { z as z16 } from "zod";
|
|
2508
2835
|
var ATTENTION_NAMESPACE = "attention";
|
|
2509
2836
|
var POINTING_NAMESPACE = "pointing";
|
|
2510
2837
|
var REACTIONS_NAMESPACE = "reactions";
|
|
2511
|
-
var Ref =
|
|
2512
|
-
var Label =
|
|
2513
|
-
var SeenSchema =
|
|
2838
|
+
var Ref = z16.string().trim().min(1).max(200);
|
|
2839
|
+
var Label = z16.string().trim().min(1).max(160);
|
|
2840
|
+
var SeenSchema = z16.object({
|
|
2514
2841
|
/** The entity's id as the agent knows it (a product id), when the thing is an entity. */
|
|
2515
2842
|
ref: Ref.optional(),
|
|
2516
2843
|
label: Label,
|
|
2517
2844
|
/** One short fact the visitor can see on it ("$48", "sold out"). */
|
|
2518
|
-
note:
|
|
2845
|
+
note: z16.string().trim().max(80).optional()
|
|
2519
2846
|
});
|
|
2520
|
-
var AttentionSchema =
|
|
2847
|
+
var AttentionSchema = z16.object({
|
|
2521
2848
|
/** On the visitor's screen now, in reading order. */
|
|
2522
|
-
onScreen:
|
|
2849
|
+
onScreen: z16.array(SeenSchema).max(24),
|
|
2523
2850
|
/** Where the visitor rested longest, most first. */
|
|
2524
|
-
lingered:
|
|
2851
|
+
lingered: z16.array(SeenSchema.extend({ seconds: z16.number().nonnegative() })).max(6),
|
|
2525
2852
|
/** Sections the visitor has scrolled through, in order (titles the page showed). */
|
|
2526
|
-
passed:
|
|
2853
|
+
passed: z16.array(Label).max(12)
|
|
2527
2854
|
});
|
|
2528
|
-
var PointedAtSchema =
|
|
2855
|
+
var PointedAtSchema = z16.object({
|
|
2529
2856
|
ref: Ref.optional(),
|
|
2530
2857
|
/** What the element is ("Faherty linen shirt", "the page headline"). */
|
|
2531
2858
|
label: Label,
|
|
2532
2859
|
/** Which of its facets the visitor tapped ("price", "colour", "style", "section"). */
|
|
2533
|
-
field:
|
|
2860
|
+
field: z16.string().trim().min(1).max(40),
|
|
2534
2861
|
/** That facet's value as shown ("$128", "Navy"). */
|
|
2535
|
-
value:
|
|
2862
|
+
value: z16.string().trim().max(160).optional()
|
|
2536
2863
|
});
|
|
2537
|
-
var ReactionsSchema =
|
|
2538
|
-
items:
|
|
2539
|
-
|
|
2864
|
+
var ReactionsSchema = z16.object({
|
|
2865
|
+
items: z16.array(
|
|
2866
|
+
z16.object({
|
|
2540
2867
|
label: Label,
|
|
2541
|
-
reaction:
|
|
2868
|
+
reaction: z16.enum(["more", "less", "saved", "looked"]),
|
|
2542
2869
|
/** The facet a `looked` was on ("colour"), when it was one. */
|
|
2543
|
-
facet:
|
|
2544
|
-
value:
|
|
2870
|
+
facet: z16.string().trim().max(40).optional(),
|
|
2871
|
+
value: z16.string().trim().max(80).optional()
|
|
2545
2872
|
})
|
|
2546
2873
|
).max(24)
|
|
2547
2874
|
});
|
|
2548
2875
|
|
|
2549
2876
|
// ../spacestation/src/signal/turn-ask.ts
|
|
2550
|
-
import { z as
|
|
2877
|
+
import { z as z17 } from "zod";
|
|
2551
2878
|
var TURN_ASK_SIGNAL = "turn.ask";
|
|
2552
2879
|
var MIN_CHOICE_ANSWERS = 2;
|
|
2553
2880
|
var MAX_CHOICE_ANSWERS = 4;
|
|
2554
|
-
var AnswerPartSchema =
|
|
2555
|
-
var PartSchema =
|
|
2881
|
+
var AnswerPartSchema = z17.object({ answer: z17.string().trim().min(1) });
|
|
2882
|
+
var PartSchema = z17.union([z17.string(), AnswerPartSchema]);
|
|
2556
2883
|
function partsText(parts2) {
|
|
2557
2884
|
return parts2.map((p) => typeof p === "string" ? p : p.answer).join("");
|
|
2558
2885
|
}
|
|
2559
|
-
var
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2886
|
+
var QUESTION_END = /\?["'”’*)\s]*$/;
|
|
2887
|
+
var ANSWER_JOINER = /^[^\p{L}\p{N}]*\p{L}{0,6}[^\p{L}\p{N}]*$/u;
|
|
2888
|
+
function listedAnswersStart(parts2) {
|
|
2889
|
+
let start = parts2.length;
|
|
2890
|
+
let answers = 0;
|
|
2891
|
+
while (start > 0) {
|
|
2892
|
+
const part = parts2[start - 1];
|
|
2893
|
+
if (part === void 0) break;
|
|
2894
|
+
if (typeof part === "string") {
|
|
2895
|
+
if (!ANSWER_JOINER.test(part)) break;
|
|
2896
|
+
} else {
|
|
2897
|
+
answers += 1;
|
|
2898
|
+
}
|
|
2899
|
+
start -= 1;
|
|
2900
|
+
}
|
|
2901
|
+
if (answers === 0 || start === 0) return null;
|
|
2902
|
+
return QUESTION_END.test(partsText(parts2.slice(0, start))) ? start : null;
|
|
2903
|
+
}
|
|
2904
|
+
function isQuestion(parts2) {
|
|
2905
|
+
return QUESTION_END.test(partsText(parts2)) || listedAnswersStart(parts2) !== null;
|
|
2906
|
+
}
|
|
2907
|
+
function asOpen(parts2) {
|
|
2908
|
+
const listed = listedAnswersStart(parts2);
|
|
2909
|
+
const kept = listed === null || QUESTION_END.test(partsText(parts2)) ? parts2 : parts2.slice(0, listed);
|
|
2910
|
+
return { kind: "open", parts: [partsText(kept).trim()] };
|
|
2911
|
+
}
|
|
2912
|
+
var ModelTurnAskSchema = z17.object({
|
|
2913
|
+
kind: z17.enum(["choice", "open"]),
|
|
2914
|
+
parts: z17.array(PartSchema).min(1)
|
|
2915
|
+
}).refine((ask) => partsText(ask.parts).trim().length > 0, { message: "the question reads as nothing" }).refine((ask) => isQuestion(ask.parts), { message: "an ask is a question" }).transform((ask) => {
|
|
2563
2916
|
const answers = ask.parts.filter((p) => typeof p !== "string").length;
|
|
2564
2917
|
if (ask.kind === "choice" && answers >= MIN_CHOICE_ANSWERS && answers <= MAX_CHOICE_ANSWERS) return ask;
|
|
2565
2918
|
if (ask.kind === "open" && answers === 0) return ask;
|
|
2566
|
-
return
|
|
2919
|
+
return asOpen(ask.parts);
|
|
2567
2920
|
});
|
|
2568
|
-
var PersistedQuestionSchema =
|
|
2569
|
-
var TurnAskSchema =
|
|
2921
|
+
var PersistedQuestionSchema = z17.object({ question: z17.string().trim().min(1) }).transform((row) => ({ kind: "open", parts: [row.question.replace(/[[\]]/g, "")] }));
|
|
2922
|
+
var TurnAskSchema = z17.union([ModelTurnAskSchema, PersistedQuestionSchema]);
|
|
2570
2923
|
function turnAskSegments(ask) {
|
|
2571
2924
|
return ask.parts.map((p) => typeof p === "string" ? { kind: "text", text: p } : { kind: "answer", text: p.answer });
|
|
2572
2925
|
}
|
|
@@ -2583,15 +2936,15 @@ function turnAskFromSignal(signal) {
|
|
|
2583
2936
|
}
|
|
2584
2937
|
|
|
2585
2938
|
// ../spacestation/src/types.ts
|
|
2586
|
-
import { z as
|
|
2939
|
+
import { z as z18 } from "zod";
|
|
2587
2940
|
var PRESENCE_FACT_DISMISS_SIGNAL = "presence.fact_dismissed";
|
|
2588
2941
|
var VISITOR_NAME_SIGNAL = "visitor.name_stated";
|
|
2589
2942
|
var VISITOR_CONTEXT_SIGNAL = "visitor.context_stated";
|
|
2590
2943
|
var PRESENCE_CANVAS_REFRESH_SIGNAL = "presence.canvas_refresh";
|
|
2591
2944
|
var CLIENT_STATE_HELLO_SIGNAL = "state.hello";
|
|
2592
|
-
var StateSnapshotFrameSchema =
|
|
2593
|
-
rev:
|
|
2594
|
-
state:
|
|
2945
|
+
var StateSnapshotFrameSchema = z18.object({
|
|
2946
|
+
rev: z18.number(),
|
|
2947
|
+
state: z18.record(z18.unknown())
|
|
2595
2948
|
});
|
|
2596
2949
|
function stateSnapshotSignal(namespace) {
|
|
2597
2950
|
return `${namespace}.snapshot`;
|
|
@@ -2655,36 +3008,36 @@ function settledBlocks(sizes) {
|
|
|
2655
3008
|
}
|
|
2656
3009
|
|
|
2657
3010
|
// ../spacestation/src/catalog/structural-baseline.ts
|
|
2658
|
-
import { z as
|
|
2659
|
-
var agentTextProps =
|
|
2660
|
-
text:
|
|
2661
|
-
parts:
|
|
2662
|
-
type:
|
|
2663
|
-
value:
|
|
3011
|
+
import { z as z19 } from "zod";
|
|
3012
|
+
var agentTextProps = z19.object({
|
|
3013
|
+
text: z19.string().optional().describe("Plain prose. Used by the streaming text.delta slot binding so the agent can flow words in without choosing emphasis spans up front."),
|
|
3014
|
+
parts: z19.array(z19.object({
|
|
3015
|
+
type: z19.enum(["text", "em"]).describe("text = sans body; em = italic emphasis."),
|
|
3016
|
+
value: z19.string()
|
|
2664
3017
|
})).optional().describe("Pre-segmented prose with mixed sans + italic spans. When present, takes precedence over `text`. Use sparingly \u2014 italic carries weight, save it for the human moment in the answer."),
|
|
2665
|
-
size:
|
|
3018
|
+
size: z19.enum(["sm", "md", "lg"]).optional().describe("Visual scale. lg for hero prose at the top of a turn; md (default) for body; sm for trailing footnote prose.")
|
|
2666
3019
|
});
|
|
2667
|
-
var turnProps =
|
|
2668
|
-
prompt:
|
|
2669
|
-
index:
|
|
2670
|
-
timestamp:
|
|
2671
|
-
thinking:
|
|
3020
|
+
var turnProps = z19.object({
|
|
3021
|
+
prompt: z19.string().describe("The user's prompt for this turn, rendered as a quoted lede above the agent's response. Required so the conversation reads."),
|
|
3022
|
+
index: z19.number().optional().describe("Turn index (0-based). When omitted the runtime infers from sibling turns."),
|
|
3023
|
+
timestamp: z19.string().optional().describe("ISO timestamp for the small turn header. Omit to skip the header."),
|
|
3024
|
+
thinking: z19.string().optional().describe("Short status line shown while the response streams in. Hidden once the first block lands.")
|
|
2672
3025
|
});
|
|
2673
|
-
var backdropProps =
|
|
2674
|
-
variant:
|
|
3026
|
+
var backdropProps = z19.object({
|
|
3027
|
+
variant: z19.enum(["ridges", "sky", "video", "none"]).optional().describe(
|
|
2675
3028
|
"Background variant. `ridges` = parallax silhouettes + sky gradient. `sky` = gradient + grain + vignette only. `video` = full-bleed autoplay-loop-muted video sourced from `videoUrl`. `none` = nothing rendered."
|
|
2676
3029
|
),
|
|
2677
|
-
ridgeColor:
|
|
2678
|
-
videoUrl:
|
|
3030
|
+
ridgeColor: z19.string().optional().describe("Hex color of the ridge silhouettes. Defaults to surface fg1."),
|
|
3031
|
+
videoUrl: z19.string().optional().describe(
|
|
2679
3032
|
'Direct mp4/webm URL for the `video` variant. Loaded with preload="metadata", muted, looped, playsInline.'
|
|
2680
3033
|
),
|
|
2681
|
-
posterUrl:
|
|
3034
|
+
posterUrl: z19.string().optional().describe("Optional poster frame shown while video buffers.")
|
|
2682
3035
|
});
|
|
2683
3036
|
var STRUCTURAL_BASELINE_CATALOG = {
|
|
2684
3037
|
page: {
|
|
2685
3038
|
type: "page",
|
|
2686
3039
|
alwaysInclude: true,
|
|
2687
|
-
propsSchema:
|
|
3040
|
+
propsSchema: z19.object({}),
|
|
2688
3041
|
layout: "fullbleed",
|
|
2689
3042
|
progressLabel: "Composing the page"
|
|
2690
3043
|
},
|
|
@@ -2737,7 +3090,7 @@ var STRUCTURAL_BASELINE_CATALOG = {
|
|
|
2737
3090
|
var STRUCTURAL_BASELINE_TYPES = Object.keys(STRUCTURAL_BASELINE_CATALOG);
|
|
2738
3091
|
|
|
2739
3092
|
// ../spacestation/src/catalog/resolved.ts
|
|
2740
|
-
import { z as
|
|
3093
|
+
import { z as z20 } from "zod";
|
|
2741
3094
|
function resolved(schema, resolverKey, opts) {
|
|
2742
3095
|
const meta = { resolverKey, ...opts };
|
|
2743
3096
|
if (opts && opts.max === 1) {
|
|
@@ -2745,7 +3098,7 @@ function resolved(schema, resolverKey, opts) {
|
|
|
2745
3098
|
writeResolvedMeta(tagged, meta);
|
|
2746
3099
|
return tagged;
|
|
2747
3100
|
}
|
|
2748
|
-
const arraySchema =
|
|
3101
|
+
const arraySchema = z20.array(schema);
|
|
2749
3102
|
writeResolvedMeta(arraySchema, meta);
|
|
2750
3103
|
return arraySchema;
|
|
2751
3104
|
}
|
|
@@ -2794,7 +3147,7 @@ function walk(schema, path, out, visited) {
|
|
|
2794
3147
|
if (visited.has(schema)) return;
|
|
2795
3148
|
const meta = readResolvedMeta(schema);
|
|
2796
3149
|
if (meta !== void 0) {
|
|
2797
|
-
const entitySchema = schema instanceof
|
|
3150
|
+
const entitySchema = schema instanceof z20.ZodArray ? schema.element : schema;
|
|
2798
3151
|
out.push({ path, meta, schema: entitySchema });
|
|
2799
3152
|
return;
|
|
2800
3153
|
}
|
|
@@ -2806,18 +3159,18 @@ function walk(schema, path, out, visited) {
|
|
|
2806
3159
|
return;
|
|
2807
3160
|
}
|
|
2808
3161
|
}
|
|
2809
|
-
if (schema instanceof
|
|
3162
|
+
if (schema instanceof z20.ZodObject) {
|
|
2810
3163
|
for (const [key, child] of Object.entries(schema.shape)) {
|
|
2811
3164
|
walk(child, [...path, key], out, visited);
|
|
2812
3165
|
}
|
|
2813
3166
|
return;
|
|
2814
3167
|
}
|
|
2815
|
-
if (schema instanceof
|
|
3168
|
+
if (schema instanceof z20.ZodArray) {
|
|
2816
3169
|
const element = schema.element;
|
|
2817
3170
|
walk(element, [...path, "*"], out, visited);
|
|
2818
3171
|
return;
|
|
2819
3172
|
}
|
|
2820
|
-
if (schema instanceof
|
|
3173
|
+
if (schema instanceof z20.ZodUnion || schema instanceof z20.ZodDiscriminatedUnion) {
|
|
2821
3174
|
for (const opt of schema.options) {
|
|
2822
3175
|
walk(opt, path, out, visited);
|
|
2823
3176
|
}
|
|
@@ -2925,7 +3278,7 @@ function collectElementEntityRefs(element, catalog) {
|
|
|
2925
3278
|
}
|
|
2926
3279
|
|
|
2927
3280
|
// ../spacestation/src/catalog/prose.ts
|
|
2928
|
-
import { z as
|
|
3281
|
+
import { z as z21 } from "zod";
|
|
2929
3282
|
function prose(schema) {
|
|
2930
3283
|
const tagged = cloneSchema2(schema);
|
|
2931
3284
|
writeProseMeta(tagged);
|
|
@@ -2966,17 +3319,17 @@ function walk2(schema, path, when, out, visited) {
|
|
|
2966
3319
|
walk2(def.innerType, path, when, out, visited);
|
|
2967
3320
|
return;
|
|
2968
3321
|
}
|
|
2969
|
-
if (schema instanceof
|
|
3322
|
+
if (schema instanceof z21.ZodObject) {
|
|
2970
3323
|
for (const [key, child] of Object.entries(schema.shape)) {
|
|
2971
3324
|
walk2(child, [...path, key], when, out, visited);
|
|
2972
3325
|
}
|
|
2973
3326
|
return;
|
|
2974
3327
|
}
|
|
2975
|
-
if (schema instanceof
|
|
3328
|
+
if (schema instanceof z21.ZodArray) {
|
|
2976
3329
|
walk2(schema.element, [...path, "*"], when, out, visited);
|
|
2977
3330
|
return;
|
|
2978
3331
|
}
|
|
2979
|
-
if (schema instanceof
|
|
3332
|
+
if (schema instanceof z21.ZodDiscriminatedUnion) {
|
|
2980
3333
|
const key = schema.discriminator;
|
|
2981
3334
|
for (const opt of schema.options) {
|
|
2982
3335
|
const value2 = discriminatorValue(opt, key);
|
|
@@ -2985,7 +3338,7 @@ function walk2(schema, path, when, out, visited) {
|
|
|
2985
3338
|
}
|
|
2986
3339
|
return;
|
|
2987
3340
|
}
|
|
2988
|
-
if (schema instanceof
|
|
3341
|
+
if (schema instanceof z21.ZodUnion) {
|
|
2989
3342
|
for (const opt of schema.options) {
|
|
2990
3343
|
walk2(opt, path, when, out, visited);
|
|
2991
3344
|
}
|
|
@@ -2993,15 +3346,15 @@ function walk2(schema, path, when, out, visited) {
|
|
|
2993
3346
|
}
|
|
2994
3347
|
}
|
|
2995
3348
|
function discriminatorValue(option, key) {
|
|
2996
|
-
if (!(option instanceof
|
|
3349
|
+
if (!(option instanceof z21.ZodObject)) return void 0;
|
|
2997
3350
|
const field = option.shape[key];
|
|
2998
|
-
if (!(field instanceof
|
|
3351
|
+
if (!(field instanceof z21.ZodLiteral)) return void 0;
|
|
2999
3352
|
const value2 = field.value;
|
|
3000
3353
|
return typeof value2 === "string" ? value2 : void 0;
|
|
3001
3354
|
}
|
|
3002
3355
|
|
|
3003
3356
|
// ../spacestation/src/catalog/required-props.ts
|
|
3004
|
-
import { z as
|
|
3357
|
+
import { z as z22 } from "zod";
|
|
3005
3358
|
function requiredTopLevelProps(schema) {
|
|
3006
3359
|
const obj = unwrapToObject(schema);
|
|
3007
3360
|
if (obj === void 0) return [];
|
|
@@ -3021,7 +3374,7 @@ function isEmptyPropValue(value2) {
|
|
|
3021
3374
|
return false;
|
|
3022
3375
|
}
|
|
3023
3376
|
function isOptionalSchema(schema) {
|
|
3024
|
-
return schema instanceof
|
|
3377
|
+
return schema instanceof z22.ZodOptional || schema instanceof z22.ZodDefault || schema instanceof z22.ZodNullable;
|
|
3025
3378
|
}
|
|
3026
3379
|
function isOptionalTopLevelProp(schema, prop) {
|
|
3027
3380
|
const obj = unwrapToObject(schema);
|
|
@@ -3030,12 +3383,12 @@ function isOptionalTopLevelProp(schema, prop) {
|
|
|
3030
3383
|
return child !== void 0 && isOptionalSchema(child);
|
|
3031
3384
|
}
|
|
3032
3385
|
function unwrapToObject(schema) {
|
|
3033
|
-
if (schema instanceof
|
|
3386
|
+
if (schema instanceof z22.ZodObject) return schema;
|
|
3034
3387
|
return void 0;
|
|
3035
3388
|
}
|
|
3036
3389
|
|
|
3037
3390
|
// ../spacestation/src/catalog/function-props.ts
|
|
3038
|
-
import { z as
|
|
3391
|
+
import { z as z23 } from "zod";
|
|
3039
3392
|
function findFunctionPropPaths(schema) {
|
|
3040
3393
|
if (schema === void 0) return [];
|
|
3041
3394
|
const found = [];
|
|
@@ -3045,74 +3398,74 @@ function findFunctionPropPaths(schema) {
|
|
|
3045
3398
|
function walk3(schema, path, found, visited) {
|
|
3046
3399
|
if (visited.has(schema)) return;
|
|
3047
3400
|
visited.add(schema);
|
|
3048
|
-
if (schema instanceof
|
|
3401
|
+
if (schema instanceof z23.ZodFunction) {
|
|
3049
3402
|
found.push(path === "" ? "(root)" : path);
|
|
3050
3403
|
return;
|
|
3051
3404
|
}
|
|
3052
|
-
if (schema instanceof
|
|
3405
|
+
if (schema instanceof z23.ZodObject) {
|
|
3053
3406
|
for (const [key, child] of Object.entries(schema.shape)) {
|
|
3054
|
-
if (child instanceof
|
|
3407
|
+
if (child instanceof z23.ZodType) {
|
|
3055
3408
|
walk3(child, path === "" ? key : `${path}.${key}`, found, visited);
|
|
3056
3409
|
}
|
|
3057
3410
|
}
|
|
3058
3411
|
return;
|
|
3059
3412
|
}
|
|
3060
|
-
if (schema instanceof
|
|
3413
|
+
if (schema instanceof z23.ZodArray) {
|
|
3061
3414
|
walk3(schema.element, `${path}[]`, found, visited);
|
|
3062
3415
|
return;
|
|
3063
3416
|
}
|
|
3064
|
-
if (schema instanceof
|
|
3417
|
+
if (schema instanceof z23.ZodTuple) {
|
|
3065
3418
|
for (const [i, item] of schema.items.entries()) {
|
|
3066
|
-
if (item instanceof
|
|
3419
|
+
if (item instanceof z23.ZodType) walk3(item, `${path}[${i}]`, found, visited);
|
|
3067
3420
|
}
|
|
3068
3421
|
const rest = schema._def.rest;
|
|
3069
|
-
if (rest instanceof
|
|
3422
|
+
if (rest instanceof z23.ZodType) walk3(rest, `${path}[]`, found, visited);
|
|
3070
3423
|
return;
|
|
3071
3424
|
}
|
|
3072
|
-
if (schema instanceof
|
|
3425
|
+
if (schema instanceof z23.ZodUnion || schema instanceof z23.ZodDiscriminatedUnion) {
|
|
3073
3426
|
for (const option of schema.options) {
|
|
3074
|
-
if (option instanceof
|
|
3427
|
+
if (option instanceof z23.ZodType) walk3(option, path, found, visited);
|
|
3075
3428
|
}
|
|
3076
3429
|
return;
|
|
3077
3430
|
}
|
|
3078
|
-
if (schema instanceof
|
|
3431
|
+
if (schema instanceof z23.ZodIntersection) {
|
|
3079
3432
|
walk3(schema._def.left, path, found, visited);
|
|
3080
3433
|
walk3(schema._def.right, path, found, visited);
|
|
3081
3434
|
return;
|
|
3082
3435
|
}
|
|
3083
|
-
if (schema instanceof
|
|
3436
|
+
if (schema instanceof z23.ZodRecord) {
|
|
3084
3437
|
walk3(schema.valueSchema, `${path}{}`, found, visited);
|
|
3085
3438
|
return;
|
|
3086
3439
|
}
|
|
3087
|
-
if (schema instanceof
|
|
3440
|
+
if (schema instanceof z23.ZodMap) {
|
|
3088
3441
|
walk3(schema.valueSchema, `${path}{}`, found, visited);
|
|
3089
3442
|
return;
|
|
3090
3443
|
}
|
|
3091
|
-
if (schema instanceof
|
|
3444
|
+
if (schema instanceof z23.ZodSet) {
|
|
3092
3445
|
walk3(schema._def.valueType, `${path}[]`, found, visited);
|
|
3093
3446
|
return;
|
|
3094
3447
|
}
|
|
3095
|
-
if (schema instanceof
|
|
3448
|
+
if (schema instanceof z23.ZodOptional || schema instanceof z23.ZodNullable || schema instanceof z23.ZodBranded || schema instanceof z23.ZodReadonly || schema instanceof z23.ZodPromise) {
|
|
3096
3449
|
walk3(schema.unwrap(), path, found, visited);
|
|
3097
3450
|
return;
|
|
3098
3451
|
}
|
|
3099
|
-
if (schema instanceof
|
|
3452
|
+
if (schema instanceof z23.ZodDefault) {
|
|
3100
3453
|
walk3(schema.removeDefault(), path, found, visited);
|
|
3101
3454
|
return;
|
|
3102
3455
|
}
|
|
3103
|
-
if (schema instanceof
|
|
3456
|
+
if (schema instanceof z23.ZodCatch) {
|
|
3104
3457
|
walk3(schema.removeCatch(), path, found, visited);
|
|
3105
3458
|
return;
|
|
3106
3459
|
}
|
|
3107
|
-
if (schema instanceof
|
|
3460
|
+
if (schema instanceof z23.ZodEffects) {
|
|
3108
3461
|
walk3(schema.innerType(), path, found, visited);
|
|
3109
3462
|
return;
|
|
3110
3463
|
}
|
|
3111
|
-
if (schema instanceof
|
|
3464
|
+
if (schema instanceof z23.ZodLazy) {
|
|
3112
3465
|
walk3(schema.schema, path, found, visited);
|
|
3113
3466
|
return;
|
|
3114
3467
|
}
|
|
3115
|
-
if (schema instanceof
|
|
3468
|
+
if (schema instanceof z23.ZodPipeline) {
|
|
3116
3469
|
walk3(schema._def.in, path, found, visited);
|
|
3117
3470
|
walk3(schema._def.out, path, found, visited);
|
|
3118
3471
|
return;
|
|
@@ -3431,47 +3784,47 @@ function getDescription(schema) {
|
|
|
3431
3784
|
}
|
|
3432
3785
|
|
|
3433
3786
|
// ../spacestation/src/catalog/wire/wire-schema.ts
|
|
3434
|
-
import { z as
|
|
3787
|
+
import { z as z24 } from "zod";
|
|
3435
3788
|
var common = {
|
|
3436
|
-
description:
|
|
3437
|
-
resolved:
|
|
3438
|
-
resolverKey:
|
|
3439
|
-
min:
|
|
3440
|
-
max:
|
|
3441
|
-
renderFloor:
|
|
3442
|
-
derivedFrom:
|
|
3789
|
+
description: z24.string().optional(),
|
|
3790
|
+
resolved: z24.object({
|
|
3791
|
+
resolverKey: z24.string(),
|
|
3792
|
+
min: z24.number().optional(),
|
|
3793
|
+
max: z24.number().optional(),
|
|
3794
|
+
renderFloor: z24.number().optional(),
|
|
3795
|
+
derivedFrom: z24.string().optional()
|
|
3443
3796
|
}).strict().optional(),
|
|
3444
|
-
prose:
|
|
3797
|
+
prose: z24.literal(true).optional()
|
|
3445
3798
|
};
|
|
3446
|
-
var WireSchemaSchema =
|
|
3447
|
-
() =>
|
|
3448
|
-
|
|
3449
|
-
|
|
3799
|
+
var WireSchemaSchema = z24.lazy(
|
|
3800
|
+
() => z24.discriminatedUnion("t", [
|
|
3801
|
+
z24.object({ ...common, t: z24.literal("string"), min: z24.number().optional(), max: z24.number().optional() }).strict(),
|
|
3802
|
+
z24.object({
|
|
3450
3803
|
...common,
|
|
3451
|
-
t:
|
|
3452
|
-
int:
|
|
3453
|
-
min:
|
|
3454
|
-
minExclusive:
|
|
3455
|
-
max:
|
|
3456
|
-
maxExclusive:
|
|
3804
|
+
t: z24.literal("number"),
|
|
3805
|
+
int: z24.literal(true).optional(),
|
|
3806
|
+
min: z24.number().optional(),
|
|
3807
|
+
minExclusive: z24.literal(true).optional(),
|
|
3808
|
+
max: z24.number().optional(),
|
|
3809
|
+
maxExclusive: z24.literal(true).optional()
|
|
3457
3810
|
}).strict(),
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3811
|
+
z24.object({ ...common, t: z24.literal("boolean") }).strict(),
|
|
3812
|
+
z24.object({ ...common, t: z24.literal("unknown") }).strict(),
|
|
3813
|
+
z24.object({ ...common, t: z24.literal("literal"), value: z24.union([z24.string(), z24.number(), z24.boolean()]) }).strict(),
|
|
3814
|
+
z24.object({ ...common, t: z24.literal("enum"), values: z24.array(z24.string()).min(1) }).strict(),
|
|
3815
|
+
z24.object({ ...common, t: z24.literal("array"), element: WireSchemaSchema, min: z24.number().optional(), max: z24.number().optional() }).strict(),
|
|
3816
|
+
z24.object({ ...common, t: z24.literal("object"), shape: z24.record(WireSchemaSchema), unknownKeys: z24.enum(["strip", "passthrough", "strict"]) }).strict(),
|
|
3817
|
+
z24.object({ ...common, t: z24.literal("union"), options: z24.array(WireSchemaSchema).min(2) }).strict(),
|
|
3818
|
+
z24.object({ ...common, t: z24.literal("discriminatedUnion"), discriminator: z24.string(), options: z24.array(WireSchemaSchema).min(2) }).strict(),
|
|
3819
|
+
z24.object({ ...common, t: z24.literal("record"), value: WireSchemaSchema }).strict(),
|
|
3820
|
+
z24.object({ ...common, t: z24.literal("optional"), inner: WireSchemaSchema }).strict(),
|
|
3821
|
+
z24.object({ ...common, t: z24.literal("nullable"), inner: WireSchemaSchema }).strict(),
|
|
3822
|
+
z24.object({ ...common, t: z24.literal("default"), inner: WireSchemaSchema, value: z24.unknown() }).strict()
|
|
3470
3823
|
])
|
|
3471
3824
|
);
|
|
3472
3825
|
|
|
3473
3826
|
// ../spacestation/src/catalog/wire/schema-to-wire.ts
|
|
3474
|
-
import { z as
|
|
3827
|
+
import { z as z25 } from "zod";
|
|
3475
3828
|
var UnsupportedSchemaError = class extends Error {
|
|
3476
3829
|
constructor(path, what) {
|
|
3477
3830
|
super(`Cannot publish the schema at ${path === "" ? "<root>" : path}: ${what}.`);
|
|
@@ -3509,7 +3862,7 @@ function arrayNode(schema, path) {
|
|
|
3509
3862
|
return node;
|
|
3510
3863
|
}
|
|
3511
3864
|
function objectNode(schema, path) {
|
|
3512
|
-
if (!(schema._def.catchall instanceof
|
|
3865
|
+
if (!(schema._def.catchall instanceof z25.ZodNever)) throw new UnsupportedSchemaError(path, "object .catchall() is not supported");
|
|
3513
3866
|
const shape = {};
|
|
3514
3867
|
for (const [key, child] of Object.entries(schema.shape)) shape[key] = toNode(child, path === "" ? key : `${path}.${key}`);
|
|
3515
3868
|
return { t: "object", shape, unknownKeys: schema._def.unknownKeys };
|
|
@@ -3520,19 +3873,19 @@ function literalNode(schema, path) {
|
|
|
3520
3873
|
throw new UnsupportedSchemaError(path, "only string, number and boolean literals are supported");
|
|
3521
3874
|
}
|
|
3522
3875
|
function bare(schema, path) {
|
|
3523
|
-
if (schema instanceof
|
|
3524
|
-
if (schema instanceof
|
|
3525
|
-
if (schema instanceof
|
|
3526
|
-
if (schema instanceof
|
|
3527
|
-
if (schema instanceof
|
|
3528
|
-
if (schema instanceof
|
|
3529
|
-
if (schema instanceof
|
|
3530
|
-
if (schema instanceof
|
|
3531
|
-
if (schema instanceof
|
|
3876
|
+
if (schema instanceof z25.ZodString) return stringNode(schema, path);
|
|
3877
|
+
if (schema instanceof z25.ZodNumber) return numberNode(schema, path);
|
|
3878
|
+
if (schema instanceof z25.ZodBoolean) return { t: "boolean" };
|
|
3879
|
+
if (schema instanceof z25.ZodUnknown || schema instanceof z25.ZodAny) return { t: "unknown" };
|
|
3880
|
+
if (schema instanceof z25.ZodLiteral) return literalNode(schema, path);
|
|
3881
|
+
if (schema instanceof z25.ZodEnum) return { t: "enum", values: [...schema.options] };
|
|
3882
|
+
if (schema instanceof z25.ZodArray) return arrayNode(schema, path);
|
|
3883
|
+
if (schema instanceof z25.ZodObject) return objectNode(schema, path);
|
|
3884
|
+
if (schema instanceof z25.ZodUnion) {
|
|
3532
3885
|
const options = schema.options;
|
|
3533
3886
|
return { t: "union", options: options.map((option, i) => toNode(option, `${path}|${i}`)) };
|
|
3534
3887
|
}
|
|
3535
|
-
if (schema instanceof
|
|
3888
|
+
if (schema instanceof z25.ZodDiscriminatedUnion) {
|
|
3536
3889
|
const options = schema.options;
|
|
3537
3890
|
return {
|
|
3538
3891
|
t: "discriminatedUnion",
|
|
@@ -3540,13 +3893,13 @@ function bare(schema, path) {
|
|
|
3540
3893
|
options: options.map((option, i) => toNode(option, `${path}|${i}`))
|
|
3541
3894
|
};
|
|
3542
3895
|
}
|
|
3543
|
-
if (schema instanceof
|
|
3544
|
-
if (!(schema.keySchema instanceof
|
|
3896
|
+
if (schema instanceof z25.ZodRecord) {
|
|
3897
|
+
if (!(schema.keySchema instanceof z25.ZodString)) throw new UnsupportedSchemaError(path, "only string-keyed records are supported");
|
|
3545
3898
|
return { t: "record", value: toNode(schema.valueSchema, `${path}{}`) };
|
|
3546
3899
|
}
|
|
3547
|
-
if (schema instanceof
|
|
3548
|
-
if (schema instanceof
|
|
3549
|
-
if (schema instanceof
|
|
3900
|
+
if (schema instanceof z25.ZodOptional) return { t: "optional", inner: toNode(schema.unwrap(), path) };
|
|
3901
|
+
if (schema instanceof z25.ZodNullable) return { t: "nullable", inner: toNode(schema.unwrap(), path) };
|
|
3902
|
+
if (schema instanceof z25.ZodDefault) {
|
|
3550
3903
|
return { t: "default", inner: toNode(schema._def.innerType, path), value: schema._def.defaultValue() };
|
|
3551
3904
|
}
|
|
3552
3905
|
throw new UnsupportedSchemaError(path, `${schema.constructor.name} is not supported`);
|
|
@@ -3564,35 +3917,35 @@ function schemaToWire(schema) {
|
|
|
3564
3917
|
}
|
|
3565
3918
|
|
|
3566
3919
|
// ../spacestation/src/catalog/wire/schema-from-wire.ts
|
|
3567
|
-
import { z as
|
|
3920
|
+
import { z as z26 } from "zod";
|
|
3568
3921
|
function bare2(node) {
|
|
3569
3922
|
switch (node.t) {
|
|
3570
3923
|
case "string": {
|
|
3571
|
-
let schema =
|
|
3924
|
+
let schema = z26.string();
|
|
3572
3925
|
if (node.min !== void 0) schema = schema.min(node.min);
|
|
3573
3926
|
if (node.max !== void 0) schema = schema.max(node.max);
|
|
3574
3927
|
return schema;
|
|
3575
3928
|
}
|
|
3576
3929
|
case "number": {
|
|
3577
|
-
let schema =
|
|
3930
|
+
let schema = z26.number();
|
|
3578
3931
|
if (node.int === true) schema = schema.int();
|
|
3579
3932
|
if (node.min !== void 0) schema = node.minExclusive === true ? schema.gt(node.min) : schema.gte(node.min);
|
|
3580
3933
|
if (node.max !== void 0) schema = node.maxExclusive === true ? schema.lt(node.max) : schema.lte(node.max);
|
|
3581
3934
|
return schema;
|
|
3582
3935
|
}
|
|
3583
3936
|
case "boolean":
|
|
3584
|
-
return
|
|
3937
|
+
return z26.boolean();
|
|
3585
3938
|
case "unknown":
|
|
3586
|
-
return
|
|
3939
|
+
return z26.unknown();
|
|
3587
3940
|
case "literal":
|
|
3588
|
-
return
|
|
3941
|
+
return z26.literal(node.value);
|
|
3589
3942
|
case "enum": {
|
|
3590
3943
|
const [first, ...rest] = node.values;
|
|
3591
3944
|
if (first === void 0) throw new Error("A wire enum needs at least one value.");
|
|
3592
|
-
return
|
|
3945
|
+
return z26.enum([first, ...rest]);
|
|
3593
3946
|
}
|
|
3594
3947
|
case "array": {
|
|
3595
|
-
let schema =
|
|
3948
|
+
let schema = z26.array(schemaFromWire(node.element));
|
|
3596
3949
|
if (node.min !== void 0) schema = schema.min(node.min);
|
|
3597
3950
|
if (node.max !== void 0) schema = schema.max(node.max);
|
|
3598
3951
|
return schema;
|
|
@@ -3600,7 +3953,7 @@ function bare2(node) {
|
|
|
3600
3953
|
case "object": {
|
|
3601
3954
|
const shape = {};
|
|
3602
3955
|
for (const [key, child] of Object.entries(node.shape)) shape[key] = schemaFromWire(child);
|
|
3603
|
-
const schema =
|
|
3956
|
+
const schema = z26.object(shape);
|
|
3604
3957
|
if (node.unknownKeys === "passthrough") return schema.passthrough();
|
|
3605
3958
|
if (node.unknownKeys === "strict") return schema.strict();
|
|
3606
3959
|
return schema;
|
|
@@ -3608,30 +3961,30 @@ function bare2(node) {
|
|
|
3608
3961
|
case "union": {
|
|
3609
3962
|
const [first, second, ...rest] = node.options.map(schemaFromWire);
|
|
3610
3963
|
if (first === void 0 || second === void 0) throw new Error("A wire union needs at least two options.");
|
|
3611
|
-
return
|
|
3964
|
+
return z26.union([first, second, ...rest]);
|
|
3612
3965
|
}
|
|
3613
3966
|
case "discriminatedUnion": {
|
|
3614
3967
|
const options = node.options.map(schemaFromWire);
|
|
3615
3968
|
const objects = [];
|
|
3616
3969
|
for (const option of options) {
|
|
3617
|
-
if (!(option instanceof
|
|
3970
|
+
if (!(option instanceof z26.ZodObject)) throw new Error("Every option of a wire discriminated union must be an object.");
|
|
3618
3971
|
objects.push(option);
|
|
3619
3972
|
}
|
|
3620
3973
|
const [first, second, ...rest] = objects;
|
|
3621
3974
|
if (first === void 0 || second === void 0) throw new Error("A wire discriminated union needs at least two options.");
|
|
3622
|
-
return
|
|
3975
|
+
return z26.discriminatedUnion(node.discriminator, [first, second, ...rest]);
|
|
3623
3976
|
}
|
|
3624
3977
|
case "record":
|
|
3625
|
-
return
|
|
3978
|
+
return z26.record(schemaFromWire(node.value));
|
|
3626
3979
|
// The static constructors, not the fluent `.optional()` / `.default()`:
|
|
3627
3980
|
// those copy the inner schema's description onto the wrapper, which would
|
|
3628
3981
|
// invent a description the original wrapper did not carry.
|
|
3629
3982
|
case "optional":
|
|
3630
|
-
return
|
|
3983
|
+
return z26.optional(schemaFromWire(node.inner));
|
|
3631
3984
|
case "nullable":
|
|
3632
|
-
return
|
|
3985
|
+
return z26.nullable(schemaFromWire(node.inner));
|
|
3633
3986
|
case "default":
|
|
3634
|
-
return
|
|
3987
|
+
return z26.ZodDefault.create(schemaFromWire(node.inner), { default: node.value });
|
|
3635
3988
|
}
|
|
3636
3989
|
}
|
|
3637
3990
|
function schemaFromWire(node) {
|
|
@@ -3642,38 +3995,38 @@ function schemaFromWire(node) {
|
|
|
3642
3995
|
}
|
|
3643
3996
|
|
|
3644
3997
|
// ../spacestation/src/catalog/wire/catalog-wire.ts
|
|
3645
|
-
import { z as
|
|
3646
|
-
var WireCatalogEntrySchema =
|
|
3647
|
-
type:
|
|
3998
|
+
import { z as z27 } from "zod";
|
|
3999
|
+
var WireCatalogEntrySchema = z27.object({
|
|
4000
|
+
type: z27.string().min(1),
|
|
3648
4001
|
propsSchema: WireSchemaSchema.optional(),
|
|
3649
|
-
examples:
|
|
3650
|
-
renderedBy:
|
|
3651
|
-
alwaysInclude:
|
|
3652
|
-
asks:
|
|
3653
|
-
whenToUse:
|
|
3654
|
-
dontUseWhen:
|
|
3655
|
-
variants:
|
|
3656
|
-
dependencies:
|
|
3657
|
-
layout:
|
|
3658
|
-
size:
|
|
3659
|
-
extendsPage:
|
|
3660
|
-
bindings:
|
|
3661
|
-
|
|
3662
|
-
source:
|
|
3663
|
-
prop:
|
|
3664
|
-
accumulate:
|
|
3665
|
-
mountAt:
|
|
4002
|
+
examples: z27.array(z27.record(z27.unknown())).optional(),
|
|
4003
|
+
renderedBy: z27.string().optional(),
|
|
4004
|
+
alwaysInclude: z27.boolean().optional(),
|
|
4005
|
+
asks: z27.boolean().optional(),
|
|
4006
|
+
whenToUse: z27.string().optional(),
|
|
4007
|
+
dontUseWhen: z27.string().optional(),
|
|
4008
|
+
variants: z27.string().optional(),
|
|
4009
|
+
dependencies: z27.string().optional(),
|
|
4010
|
+
layout: z27.enum(["section", "fullbleed"]).optional(),
|
|
4011
|
+
size: z27.enum(CANVAS_BLOCK_SIZES).optional(),
|
|
4012
|
+
extendsPage: z27.boolean().optional(),
|
|
4013
|
+
bindings: z27.array(
|
|
4014
|
+
z27.object({
|
|
4015
|
+
source: z27.string(),
|
|
4016
|
+
prop: z27.string(),
|
|
4017
|
+
accumulate: z27.enum(["replace", "append", "concat-text"]).optional(),
|
|
4018
|
+
mountAt: z27.string().optional()
|
|
3666
4019
|
})
|
|
3667
4020
|
).optional(),
|
|
3668
|
-
defaultLayoutWeight:
|
|
3669
|
-
defaultMaxHeight:
|
|
3670
|
-
category:
|
|
3671
|
-
progressLabel:
|
|
3672
|
-
isExperience:
|
|
3673
|
-
requires:
|
|
3674
|
-
provides:
|
|
4021
|
+
defaultLayoutWeight: z27.number().optional(),
|
|
4022
|
+
defaultMaxHeight: z27.enum(["sm", "md", "lg", "full"]).optional(),
|
|
4023
|
+
category: z27.string().optional(),
|
|
4024
|
+
progressLabel: z27.string().optional(),
|
|
4025
|
+
isExperience: z27.boolean().optional(),
|
|
4026
|
+
requires: z27.array(z27.string()).optional(),
|
|
4027
|
+
provides: z27.array(z27.string()).optional()
|
|
3675
4028
|
}).strict();
|
|
3676
|
-
var WireCatalogSchema =
|
|
4029
|
+
var WireCatalogSchema = z27.record(WireCatalogEntrySchema);
|
|
3677
4030
|
function propsToWire(type, schema) {
|
|
3678
4031
|
try {
|
|
3679
4032
|
return schemaToWire(schema);
|
|
@@ -3698,7 +4051,7 @@ function catalogFromWire(wire) {
|
|
|
3698
4051
|
continue;
|
|
3699
4052
|
}
|
|
3700
4053
|
const rebuilt = schemaFromWire(propsSchema);
|
|
3701
|
-
if (!(rebuilt instanceof
|
|
4054
|
+
if (!(rebuilt instanceof z27.ZodObject)) throw new Error(`Catalog type "${type}": propsSchema must be an object schema.`);
|
|
3702
4055
|
const built = { ...data, propsSchema: rebuilt };
|
|
3703
4056
|
out[type] = built;
|
|
3704
4057
|
}
|
|
@@ -3706,31 +4059,31 @@ function catalogFromWire(wire) {
|
|
|
3706
4059
|
}
|
|
3707
4060
|
|
|
3708
4061
|
// ../spacestation/src/catalog/wire/package-release.ts
|
|
3709
|
-
import { z as
|
|
4062
|
+
import { z as z31 } from "zod";
|
|
3710
4063
|
|
|
3711
4064
|
// ../spacestation/src/catalog/wire/brand-mark.ts
|
|
3712
|
-
import { z as
|
|
4065
|
+
import { z as z28 } from "zod";
|
|
3713
4066
|
var BRAND_MARK_TYPES = ["svg", "png"];
|
|
3714
4067
|
var BRAND_MARK_MAX_BYTES = 256 * 1024;
|
|
3715
4068
|
var MAX_BASE64_LENGTH = Math.ceil(BRAND_MARK_MAX_BYTES / 3) * 4;
|
|
3716
|
-
var BrandMarkUploadSchema =
|
|
3717
|
-
type:
|
|
3718
|
-
data:
|
|
4069
|
+
var BrandMarkUploadSchema = z28.object({
|
|
4070
|
+
type: z28.enum(BRAND_MARK_TYPES),
|
|
4071
|
+
data: z28.string().base64().min(1).max(MAX_BASE64_LENGTH, `a mark file is at most ${BRAND_MARK_MAX_BYTES / 1024} KB`)
|
|
3719
4072
|
}).strict();
|
|
3720
|
-
var BrandMarkStoredSchema =
|
|
3721
|
-
type:
|
|
3722
|
-
sha256:
|
|
4073
|
+
var BrandMarkStoredSchema = z28.object({
|
|
4074
|
+
type: z28.enum(BRAND_MARK_TYPES),
|
|
4075
|
+
sha256: z28.string().regex(/^[0-9a-f]{64}$/, "a stored mark is named by its sha256")
|
|
3723
4076
|
}).strict();
|
|
3724
|
-
var BrandMarkFileSchema =
|
|
4077
|
+
var BrandMarkFileSchema = z28.union([BrandMarkUploadSchema, BrandMarkStoredSchema]);
|
|
3725
4078
|
var BRAND_MARK_SLOTS = ["square", "wordmark"];
|
|
3726
|
-
var BrandMarkSchema =
|
|
3727
|
-
var BrandMarkImageSchema =
|
|
3728
|
-
var SpaceBrandMarkSchema =
|
|
4079
|
+
var BrandMarkSchema = z28.object({ square: BrandMarkFileSchema.optional(), wordmark: BrandMarkFileSchema.optional() }).strict().refine((mark) => mark.square !== void 0 || mark.wordmark !== void 0, "a mark names a square, a wordmark, or both");
|
|
4080
|
+
var BrandMarkImageSchema = z28.object({ src: z28.string().min(1), type: z28.enum(BRAND_MARK_TYPES) }).strict();
|
|
4081
|
+
var SpaceBrandMarkSchema = z28.object({ square: BrandMarkImageSchema.nullable(), wordmark: BrandMarkImageSchema.nullable() }).strict();
|
|
3729
4082
|
|
|
3730
4083
|
// ../spacestation/src/catalog/wire/sdk-compat.ts
|
|
3731
|
-
import { z as
|
|
4084
|
+
import { z as z29 } from "zod";
|
|
3732
4085
|
var SDK_VERSION_PATTERN = /^\d{1,4}\.\d{1,4}\.\d{1,4}(-[0-9A-Za-z.]{1,32})?$/;
|
|
3733
|
-
var SdkVersionSchema =
|
|
4086
|
+
var SdkVersionSchema = z29.string().regex(SDK_VERSION_PATTERN, "an sdk version is major.minor.patch");
|
|
3734
4087
|
var OLDEST_SUPPORTED_SDK = "0.3.0";
|
|
3735
4088
|
var SDK_SHIMS = {
|
|
3736
4089
|
/** sdk ≤ 0.3 called the vertical verbs on `useCanvasActions()` — `legacy-canvas-actions.ts`. */
|
|
@@ -3776,10 +4129,10 @@ function sdkWindowProblem(builtWithSdk, platformSdk) {
|
|
|
3776
4129
|
}
|
|
3777
4130
|
|
|
3778
4131
|
// ../spacestation/src/catalog/wire/host-imports.ts
|
|
3779
|
-
import { z as
|
|
3780
|
-
var SpecifierSchema =
|
|
3781
|
-
var HostImportsSchema =
|
|
3782
|
-
var HostExportsSchema =
|
|
4132
|
+
import { z as z30 } from "zod";
|
|
4133
|
+
var SpecifierSchema = z30.string().min(1).max(200);
|
|
4134
|
+
var HostImportsSchema = z30.record(SpecifierSchema, z30.array(z30.string().min(1).max(200)).max(5e3));
|
|
4135
|
+
var HostExportsSchema = z30.record(SpecifierSchema, z30.array(z30.string()));
|
|
3783
4136
|
function hostImportProblems(imports, provided) {
|
|
3784
4137
|
const problems = [];
|
|
3785
4138
|
for (const [specifier, names] of Object.entries(imports)) {
|
|
@@ -3802,15 +4155,15 @@ function hostImportsRefusal(commit) {
|
|
|
3802
4155
|
var RESERVED_SCOPES = ["@fourty/", "@40rty/"];
|
|
3803
4156
|
var BUNDLE_ASSET_PATH = /^assets\/[A-Za-z0-9_-]+\.(woff2?|ttf|otf|png|jpe?g|svg|gif|webp)$/;
|
|
3804
4157
|
var RELEASE_MESSAGE_MAX = 140;
|
|
3805
|
-
var ReleaseMessageSchema =
|
|
3806
|
-
var PackageReleaseSchema =
|
|
4158
|
+
var ReleaseMessageSchema = z31.string().trim().min(1, "say what this release changes").max(RELEASE_MESSAGE_MAX, `keep the message to one line of ${RELEASE_MESSAGE_MAX} characters or fewer`);
|
|
4159
|
+
var PackageReleaseSchema = z31.object({
|
|
3807
4160
|
/** The id spaces name in `componentSources` — an npm-style package name. */
|
|
3808
|
-
sourceId:
|
|
3809
|
-
label:
|
|
4161
|
+
sourceId: z31.string().regex(/^(@[a-z0-9][a-z0-9-]*\/)?[a-z0-9][a-z0-9-]*$/, "sourceId must be an npm-style package name").refine((id) => !RESERVED_SCOPES.some((scope2) => id.startsWith(scope2)), `the ${RESERVED_SCOPES.join(" and ")} scopes are reserved`),
|
|
4162
|
+
label: z31.string().min(1).max(120),
|
|
3810
4163
|
/** The package's own version, as its repository states it — shown in the console. */
|
|
3811
|
-
version:
|
|
4164
|
+
version: z31.string().min(1).max(40),
|
|
3812
4165
|
/** What this release changed, in the publisher's words (`forty publish --message`) — shown in the console's version list. */
|
|
3813
|
-
description:
|
|
4166
|
+
description: z31.string().min(1).max(500).optional(),
|
|
3814
4167
|
/**
|
|
3815
4168
|
* The `@40rty/ams-sdk` version the brand project resolved when `forty
|
|
3816
4169
|
* publish` built this release. A bundle takes the sdk from the page at
|
|
@@ -3830,7 +4183,7 @@ var PackageReleaseSchema = z29.object({
|
|
|
3830
4183
|
hostImports: HostImportsSchema.optional(),
|
|
3831
4184
|
catalog: WireCatalogSchema,
|
|
3832
4185
|
/** Component manifests by path under `catalogs/`, e.g. `catalogs/product/productGrid.md`. */
|
|
3833
|
-
manifests:
|
|
4186
|
+
manifests: z31.record(z31.string().regex(/^catalogs\/.+\.md$/, "a manifest path is catalogs/<\u2026>.md"), z31.string()),
|
|
3834
4187
|
/**
|
|
3835
4188
|
* The brand's components, built — present when the PLATFORM hosts this
|
|
3836
4189
|
* brand's spacefront, absent when the brand hosts it in its own app. One
|
|
@@ -3839,17 +4192,17 @@ var PackageReleaseSchema = z29.object({
|
|
|
3839
4192
|
* images — base64, keyed by the path the stylesheet's `url()` names, beside
|
|
3840
4193
|
* it). It is served to browsers; the platform's servers never run it.
|
|
3841
4194
|
*/
|
|
3842
|
-
bundle:
|
|
3843
|
-
js:
|
|
3844
|
-
css:
|
|
3845
|
-
assets:
|
|
4195
|
+
bundle: z31.object({
|
|
4196
|
+
js: z31.string().min(1),
|
|
4197
|
+
css: z31.string(),
|
|
4198
|
+
assets: z31.record(z31.string().regex(BUNDLE_ASSET_PATH, "an asset is assets/<name>.<font or image extension>"), z31.string().base64()).optional()
|
|
3846
4199
|
}).strict().optional(),
|
|
3847
4200
|
/**
|
|
3848
4201
|
* The class the spacefront root carries while this package is the space's.
|
|
3849
4202
|
* The package's own stylesheet styles under it. Absent = the platform's
|
|
3850
4203
|
* default theme class.
|
|
3851
4204
|
*/
|
|
3852
|
-
theme:
|
|
4205
|
+
theme: z31.object({ themeClass: z31.string().regex(/^[a-z][a-z0-9-]*$/, "a theme class is lowercase letters, digits and hyphens") }).strict().optional(),
|
|
3853
4206
|
/**
|
|
3854
4207
|
* The brand's mark (`brand-mark.ts`). Sent as the files themselves; the
|
|
3855
4208
|
* platform stores them content-addressed at ingest and keeps only their
|
|
@@ -3862,7 +4215,7 @@ var PackageReleaseSchema = z29.object({
|
|
|
3862
4215
|
* The package's own composition guidance for its own components — prompt
|
|
3863
4216
|
* markdown the agent reads, gated on the capabilities it names (`requires`).
|
|
3864
4217
|
*/
|
|
3865
|
-
promptSections:
|
|
4218
|
+
promptSections: z31.array(z31.object({ id: z31.string().regex(/^[a-z0-9-]+$/), order: z31.number().int(), content: z31.string().min(1).max(2e4), requires: z31.array(z31.string()) }).strict()).max(10).optional(),
|
|
3866
4219
|
/**
|
|
3867
4220
|
* The brand's SPACE prompt — its `prompts/space.md`, verbatim: sections split
|
|
3868
4221
|
* by `<!-- section:<id> -->` markers, the same format as the platform's
|
|
@@ -3870,17 +4223,17 @@ var PackageReleaseSchema = z29.object({
|
|
|
3870
4223
|
* package. How the brand speaks, what it sells and what it never claims ship
|
|
3871
4224
|
* with the brand, and a release changes them with no platform deploy.
|
|
3872
4225
|
*/
|
|
3873
|
-
spacePrompt:
|
|
4226
|
+
spacePrompt: z31.string().min(1).max(2e5).optional(),
|
|
3874
4227
|
/**
|
|
3875
4228
|
* Opaque per-vertical extension data (`BrandDefinition.config`): the
|
|
3876
4229
|
* platform stays vertical-agnostic and the vertical's own code reads its keys.
|
|
3877
4230
|
*/
|
|
3878
|
-
config:
|
|
4231
|
+
config: z31.record(z31.string(), z31.unknown()).optional(),
|
|
3879
4232
|
/**
|
|
3880
4233
|
* Set by the platform, never by a publisher: this release is a DRAFT of the
|
|
3881
4234
|
* package `of`, previewed on the space `space`. See `draftSourceId`.
|
|
3882
4235
|
*/
|
|
3883
|
-
draft:
|
|
4236
|
+
draft: z31.object({ of: z31.string().min(1), space: z31.string().min(1) }).strict().optional()
|
|
3884
4237
|
}).strict();
|
|
3885
4238
|
var DRAFT_SEPARATOR = "--";
|
|
3886
4239
|
function draftSourceId(sourceId, spaceSlug, developer) {
|
|
@@ -3899,49 +4252,49 @@ function parseReleasePreview(id) {
|
|
|
3899
4252
|
}
|
|
3900
4253
|
|
|
3901
4254
|
// ../spacestation/src/catalog/wire/package-bundle-ref.ts
|
|
3902
|
-
import { z as
|
|
3903
|
-
var PackageBundleRefSchema =
|
|
3904
|
-
sourceId:
|
|
3905
|
-
js:
|
|
3906
|
-
css:
|
|
4255
|
+
import { z as z32 } from "zod";
|
|
4256
|
+
var PackageBundleRefSchema = z32.object({
|
|
4257
|
+
sourceId: z32.string(),
|
|
4258
|
+
js: z32.string(),
|
|
4259
|
+
css: z32.string(),
|
|
3907
4260
|
/** The brand's name for itself, and its package's version. */
|
|
3908
|
-
label:
|
|
3909
|
-
version:
|
|
4261
|
+
label: z32.string(),
|
|
4262
|
+
version: z32.string(),
|
|
3910
4263
|
/** The sdk the bundle was built against (`PackageRelease.builtWithSdk`) — absent for a legacy release. Picks its compat shims. */
|
|
3911
4264
|
builtWithSdk: SdkVersionSchema.optional()
|
|
3912
4265
|
});
|
|
3913
4266
|
|
|
3914
4267
|
// ../spacestation/src/projection/projection.ts
|
|
3915
|
-
import { z as
|
|
3916
|
-
var LateBoundValueSchema =
|
|
3917
|
-
var DirectiveValueSchema =
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
4268
|
+
import { z as z33 } from "zod";
|
|
4269
|
+
var LateBoundValueSchema = z33.object({ fact: z33.literal(true) });
|
|
4270
|
+
var DirectiveValueSchema = z33.union([
|
|
4271
|
+
z33.string(),
|
|
4272
|
+
z33.number(),
|
|
4273
|
+
z33.boolean(),
|
|
3921
4274
|
LateBoundValueSchema
|
|
3922
4275
|
]);
|
|
3923
4276
|
function isLateBound(v) {
|
|
3924
4277
|
return typeof v === "object" && v !== null && "fact" in v;
|
|
3925
4278
|
}
|
|
3926
|
-
var ProjectionDirectiveSchema =
|
|
4279
|
+
var ProjectionDirectiveSchema = z33.object({
|
|
3927
4280
|
/** Keep only items whose axis values all match. Keyed by axis name
|
|
3928
4281
|
* (e.g. `Size`); value is a literal or the `{fact:true}` marker. */
|
|
3929
|
-
isolateTo:
|
|
4282
|
+
isolateTo: z33.record(DirectiveValueSchema).optional(),
|
|
3930
4283
|
/** Isolate to EVERY axis the visitor has a stored fact for. The agent
|
|
3931
4284
|
* emits this (it is vertical-agnostic — it cannot name axes); the
|
|
3932
4285
|
* entity binding expands it against the entity's own axes + facts. */
|
|
3933
|
-
isolateToFacts:
|
|
4286
|
+
isolateToFacts: z33.boolean().optional(),
|
|
3934
4287
|
/** Keep only items the entity binding reports as available. */
|
|
3935
|
-
availableOnly:
|
|
4288
|
+
availableOnly: z33.boolean().optional(),
|
|
3936
4289
|
/** Cap the rendered count after filtering. */
|
|
3937
|
-
limit:
|
|
4290
|
+
limit: z33.number().int().positive().optional()
|
|
3938
4291
|
});
|
|
3939
|
-
var ProjectionPreferencesSchema =
|
|
3940
|
-
|
|
4292
|
+
var ProjectionPreferencesSchema = z33.record(
|
|
4293
|
+
z33.union([ProjectionDirectiveSchema, z33.null()])
|
|
3941
4294
|
);
|
|
3942
4295
|
var PROJECTION_SET_SIGNAL = "projection.set";
|
|
3943
|
-
var ProjectionSetPayloadSchema =
|
|
3944
|
-
setAll:
|
|
4296
|
+
var ProjectionSetPayloadSchema = z33.object({
|
|
4297
|
+
setAll: z33.union([ProjectionDirectiveSchema, z33.null()]).optional(),
|
|
3945
4298
|
set: ProjectionPreferencesSchema.optional()
|
|
3946
4299
|
});
|
|
3947
4300
|
function norm(v) {
|
|
@@ -3975,14 +4328,14 @@ function isActiveDirective(directive) {
|
|
|
3975
4328
|
}
|
|
3976
4329
|
|
|
3977
4330
|
// ../spacestation/src/host/host-page.ts
|
|
3978
|
-
import { z as
|
|
4331
|
+
import { z as z34 } from "zod";
|
|
3979
4332
|
var VIEW_HOST_SIGNAL = "view.host";
|
|
3980
|
-
var HostPayloadSchema =
|
|
4333
|
+
var HostPayloadSchema = z34.object({
|
|
3981
4334
|
page: PageSchema.nullable(),
|
|
3982
|
-
maxSections:
|
|
3983
|
-
surface:
|
|
4335
|
+
maxSections: z34.number().int().positive().nullable(),
|
|
4336
|
+
surface: z34.enum(["page", "slot"])
|
|
3984
4337
|
});
|
|
3985
|
-
var HostClearedSchema =
|
|
4338
|
+
var HostClearedSchema = z34.object({ cleared: z34.literal(true) });
|
|
3986
4339
|
var HOST_CLEARED = { cleared: true };
|
|
3987
4340
|
function hostFillsPage(host) {
|
|
3988
4341
|
return host.surface === "page";
|
|
@@ -3996,23 +4349,23 @@ function pagePlace(page) {
|
|
|
3996
4349
|
}
|
|
3997
4350
|
|
|
3998
4351
|
// ../spacestation/src/focus/focus.ts
|
|
3999
|
-
import { z as
|
|
4352
|
+
import { z as z35 } from "zod";
|
|
4000
4353
|
var VIEW_FOCUS_ELEMENT_SIGNAL = "view.focus.element";
|
|
4001
|
-
var FocusElementPayloadSchema =
|
|
4002
|
-
elementId:
|
|
4354
|
+
var FocusElementPayloadSchema = z35.object({
|
|
4355
|
+
elementId: z35.string().min(1)
|
|
4003
4356
|
});
|
|
4004
4357
|
|
|
4005
4358
|
// ../spacestation/src/view/continuation.ts
|
|
4006
|
-
import { z as
|
|
4359
|
+
import { z as z36 } from "zod";
|
|
4007
4360
|
var VIEW_EXTEND_SIGNAL = "view.extend";
|
|
4008
|
-
var ViewExtendPayloadSchema =
|
|
4009
|
-
reason:
|
|
4361
|
+
var ViewExtendPayloadSchema = z36.object({
|
|
4362
|
+
reason: z36.enum(["scroll_near_bottom"])
|
|
4010
4363
|
});
|
|
4011
4364
|
var VIEW_EXHAUSTED_SIGNAL = "view.exhausted";
|
|
4012
4365
|
var CONTINUATION_ENABLED = false;
|
|
4013
4366
|
|
|
4014
4367
|
// ../spacestation/src/attachment/attachment.ts
|
|
4015
|
-
import { z as
|
|
4368
|
+
import { z as z37 } from "zod";
|
|
4016
4369
|
var ALLOWED_ATTACHMENT_TYPES = [
|
|
4017
4370
|
"image/jpeg",
|
|
4018
4371
|
"image/png",
|
|
@@ -4027,18 +4380,18 @@ function isAllowedAttachmentType(mime) {
|
|
|
4027
4380
|
function isImageAttachment(mime) {
|
|
4028
4381
|
return mime.startsWith("image/");
|
|
4029
4382
|
}
|
|
4030
|
-
var AttachmentRefSchema =
|
|
4383
|
+
var AttachmentRefSchema = z37.object({
|
|
4031
4384
|
// A UUID, as `storeAttachment` mints it: the id becomes a storage path segment,
|
|
4032
4385
|
// so nothing else — no `/`, no `..` — may reach that lookup.
|
|
4033
|
-
id:
|
|
4034
|
-
mimeType:
|
|
4386
|
+
id: z37.string().uuid(),
|
|
4387
|
+
mimeType: z37.string().refine(isAllowedAttachmentType, {
|
|
4035
4388
|
message: "mimeType not on the attachment allow-list"
|
|
4036
4389
|
}),
|
|
4037
|
-
name:
|
|
4038
|
-
size:
|
|
4039
|
-
url:
|
|
4390
|
+
name: z37.string().min(1),
|
|
4391
|
+
size: z37.number().int().positive().max(MAX_ATTACHMENT_BYTES),
|
|
4392
|
+
url: z37.string().min(1)
|
|
4040
4393
|
});
|
|
4041
|
-
var AttachmentRefsSchema =
|
|
4394
|
+
var AttachmentRefsSchema = z37.array(AttachmentRefSchema);
|
|
4042
4395
|
|
|
4043
4396
|
// ../spacestation/src/attachment/attachment-failure.ts
|
|
4044
4397
|
var MAX_ATTACHMENT_MB = Math.round(MAX_ATTACHMENT_BYTES / (1024 * 1024));
|
|
@@ -4057,22 +4410,22 @@ function attachmentFailureOfStatus(status, mimeType) {
|
|
|
4057
4410
|
}
|
|
4058
4411
|
|
|
4059
4412
|
// ../spacestation/src/contracts/entry-context.ts
|
|
4060
|
-
import { z as
|
|
4413
|
+
import { z as z38 } from "zod";
|
|
4061
4414
|
var ENTRY_CONTEXT_MAX_VALUE_CHARS = 200;
|
|
4062
4415
|
var ENTRY_CONTEXT_MAX_KEYS = 12;
|
|
4063
4416
|
var ENTRY_CONTEXT_MAX_NAMESPACES = 8;
|
|
4064
4417
|
var ENTRY_CONTEXT_MAX_NAME_CHARS = 64;
|
|
4065
|
-
var EntryContextValueSchema =
|
|
4066
|
-
var EntryContextNameSchema =
|
|
4067
|
-
var EntryContextNamespaceSchema =
|
|
4418
|
+
var EntryContextValueSchema = z38.string().trim().min(1).max(ENTRY_CONTEXT_MAX_VALUE_CHARS);
|
|
4419
|
+
var EntryContextNameSchema = z38.string().trim().min(1).max(ENTRY_CONTEXT_MAX_NAME_CHARS);
|
|
4420
|
+
var EntryContextNamespaceSchema = z38.record(EntryContextNameSchema, EntryContextValueSchema).refine((entries3) => Object.keys(entries3).length <= ENTRY_CONTEXT_MAX_KEYS, {
|
|
4068
4421
|
message: `at most ${ENTRY_CONTEXT_MAX_KEYS} entries per namespace`
|
|
4069
4422
|
});
|
|
4070
|
-
var EntryContextSchema =
|
|
4423
|
+
var EntryContextSchema = z38.record(EntryContextNameSchema, EntryContextNamespaceSchema).refine((namespaces) => Object.keys(namespaces).length <= ENTRY_CONTEXT_MAX_NAMESPACES, {
|
|
4071
4424
|
message: `at most ${ENTRY_CONTEXT_MAX_NAMESPACES} entry-context namespaces`
|
|
4072
4425
|
});
|
|
4073
4426
|
|
|
4074
4427
|
// ../spacestation/src/contracts/session-arrival.ts
|
|
4075
|
-
import { z as
|
|
4428
|
+
import { z as z39 } from "zod";
|
|
4076
4429
|
var SURFACES = [
|
|
4077
4430
|
"spacefront",
|
|
4078
4431
|
"embed",
|
|
@@ -4082,11 +4435,11 @@ var SURFACES = [
|
|
|
4082
4435
|
"playground",
|
|
4083
4436
|
"automation"
|
|
4084
4437
|
];
|
|
4085
|
-
var SurfaceSchema =
|
|
4438
|
+
var SurfaceSchema = z39.enum(SURFACES);
|
|
4086
4439
|
var CLICK_ID_KINDS = ["gclid", "fbclid", "msclkid", "wbraid", "gbraid"];
|
|
4087
|
-
var ClickIdKindSchema =
|
|
4440
|
+
var ClickIdKindSchema = z39.enum(CLICK_ID_KINDS);
|
|
4088
4441
|
var VISITOR_ID_DURABILITIES = ["persisted", "ephemeral", "host_supplied"];
|
|
4089
|
-
var VisitorIdDurabilitySchema =
|
|
4442
|
+
var VisitorIdDurabilitySchema = z39.enum(VISITOR_ID_DURABILITIES);
|
|
4090
4443
|
var TRAFFIC_BUCKETS = [
|
|
4091
4444
|
"paid_google",
|
|
4092
4445
|
"paid_meta",
|
|
@@ -4098,10 +4451,10 @@ var TRAFFIC_BUCKETS = [
|
|
|
4098
4451
|
"direct",
|
|
4099
4452
|
"unknown"
|
|
4100
4453
|
];
|
|
4101
|
-
var TrafficBucketSchema =
|
|
4454
|
+
var TrafficBucketSchema = z39.enum(TRAFFIC_BUCKETS);
|
|
4102
4455
|
var ARRIVAL_MAX_VALUE_CHARS = 200;
|
|
4103
|
-
var ArrivalValueSchema =
|
|
4104
|
-
var SessionArrivalSchema =
|
|
4456
|
+
var ArrivalValueSchema = z39.string().trim().min(1).max(ARRIVAL_MAX_VALUE_CHARS);
|
|
4457
|
+
var SessionArrivalSchema = z39.object({
|
|
4105
4458
|
utmSource: ArrivalValueSchema.optional(),
|
|
4106
4459
|
utmMedium: ArrivalValueSchema.optional(),
|
|
4107
4460
|
utmCampaign: ArrivalValueSchema.optional(),
|
|
@@ -4227,36 +4580,36 @@ var WIRE_PROTOCOL_UNSUPPORTED_CLOSE = 4426;
|
|
|
4227
4580
|
var SESSION_UNAVAILABLE_CLOSE = 4404;
|
|
4228
4581
|
|
|
4229
4582
|
// ../spacestation/src/catalog/attribute-registry.ts
|
|
4230
|
-
import { z as
|
|
4231
|
-
var AttributeScopeBucketSchema =
|
|
4232
|
-
scope:
|
|
4233
|
-
needles:
|
|
4234
|
-
label:
|
|
4235
|
-
});
|
|
4236
|
-
var AttributeScopeConfigSchema =
|
|
4237
|
-
facet:
|
|
4238
|
-
buckets:
|
|
4239
|
-
emptyScope:
|
|
4240
|
-
noMatchScope:
|
|
4241
|
-
ignoreValues:
|
|
4242
|
-
emptyScopeLabel:
|
|
4243
|
-
noMatchScopeLabel:
|
|
4244
|
-
});
|
|
4245
|
-
var AttributeDefBaseSchema =
|
|
4246
|
-
description:
|
|
4247
|
-
durable:
|
|
4248
|
-
label:
|
|
4249
|
-
});
|
|
4250
|
-
var AttributeDefSchema =
|
|
4251
|
-
AttributeDefBaseSchema.extend({ kind:
|
|
4252
|
-
AttributeDefBaseSchema.extend({ kind:
|
|
4253
|
-
AttributeDefBaseSchema.extend({ kind:
|
|
4254
|
-
AttributeDefBaseSchema.extend({ kind:
|
|
4583
|
+
import { z as z40 } from "zod";
|
|
4584
|
+
var AttributeScopeBucketSchema = z40.object({
|
|
4585
|
+
scope: z40.string(),
|
|
4586
|
+
needles: z40.array(z40.string()).readonly(),
|
|
4587
|
+
label: z40.string().optional()
|
|
4588
|
+
});
|
|
4589
|
+
var AttributeScopeConfigSchema = z40.object({
|
|
4590
|
+
facet: z40.string(),
|
|
4591
|
+
buckets: z40.array(AttributeScopeBucketSchema).readonly(),
|
|
4592
|
+
emptyScope: z40.string(),
|
|
4593
|
+
noMatchScope: z40.string(),
|
|
4594
|
+
ignoreValues: z40.array(z40.string()).readonly(),
|
|
4595
|
+
emptyScopeLabel: z40.string().optional(),
|
|
4596
|
+
noMatchScopeLabel: z40.string().optional()
|
|
4597
|
+
});
|
|
4598
|
+
var AttributeDefBaseSchema = z40.object({
|
|
4599
|
+
description: z40.string().optional(),
|
|
4600
|
+
durable: z40.boolean().optional(),
|
|
4601
|
+
label: z40.string().optional()
|
|
4602
|
+
});
|
|
4603
|
+
var AttributeDefSchema = z40.discriminatedUnion("kind", [
|
|
4604
|
+
AttributeDefBaseSchema.extend({ kind: z40.literal("enum"), values: z40.array(z40.string()) }),
|
|
4605
|
+
AttributeDefBaseSchema.extend({ kind: z40.literal("free_text") }),
|
|
4606
|
+
AttributeDefBaseSchema.extend({ kind: z40.literal("date_or_season") }),
|
|
4607
|
+
AttributeDefBaseSchema.extend({ kind: z40.literal("money_or_band") }),
|
|
4255
4608
|
AttributeDefBaseSchema.extend({
|
|
4256
|
-
kind:
|
|
4257
|
-
min:
|
|
4258
|
-
max:
|
|
4259
|
-
unit:
|
|
4609
|
+
kind: z40.literal("number"),
|
|
4610
|
+
min: z40.number().optional(),
|
|
4611
|
+
max: z40.number().optional(),
|
|
4612
|
+
unit: z40.string().optional()
|
|
4260
4613
|
})
|
|
4261
4614
|
]);
|
|
4262
4615
|
var EXTRAS_PREFIX = "extras.";
|
|
@@ -4295,59 +4648,59 @@ function scopeOfAttributeKey(config, key) {
|
|
|
4295
4648
|
}
|
|
4296
4649
|
|
|
4297
4650
|
// ../spacestation/src/space/agent-directive.ts
|
|
4298
|
-
import { z as
|
|
4651
|
+
import { z as z41 } from "zod";
|
|
4299
4652
|
var MAX_ACTIVE_AGENT_DIRECTIVES = 20;
|
|
4300
4653
|
var AGENT_DIRECTIVE_KINDS = ["preference", "pairing", "order of things", "promise", "threshold"];
|
|
4301
4654
|
var AGENT_DIRECTIVE_SEVERITIES = ["a missed opportunity", "a problem", "unacceptable"];
|
|
4302
4655
|
var AGENT_DIRECTIVE_SOURCES = ["owner", "operator", "session-lesson"];
|
|
4303
4656
|
var AGENT_DIRECTIVE_STATUSES = ["proposed", "active", "rejected", "retired"];
|
|
4304
|
-
var AgentDirectiveSchema =
|
|
4305
|
-
name:
|
|
4306
|
-
kind:
|
|
4307
|
-
severity:
|
|
4657
|
+
var AgentDirectiveSchema = z41.object({
|
|
4658
|
+
name: z41.string().trim().min(1).max(80),
|
|
4659
|
+
kind: z41.enum(AGENT_DIRECTIVE_KINDS),
|
|
4660
|
+
severity: z41.enum(AGENT_DIRECTIVE_SEVERITIES),
|
|
4308
4661
|
/** No bare URL: a URL is a hallucination surface, and a handle is not a
|
|
4309
4662
|
* product name. */
|
|
4310
|
-
text:
|
|
4663
|
+
text: z41.string().trim().min(1).max(1e3).refine((t) => !/https?:\/\//.test(t), "a directive names things by name, never by URL")
|
|
4311
4664
|
}).strict();
|
|
4312
|
-
var SpaceAgentDirectiveSchema =
|
|
4313
|
-
id:
|
|
4314
|
-
position:
|
|
4315
|
-
name:
|
|
4316
|
-
kind:
|
|
4317
|
-
severity:
|
|
4318
|
-
text:
|
|
4319
|
-
source:
|
|
4320
|
-
status:
|
|
4665
|
+
var SpaceAgentDirectiveSchema = z41.object({
|
|
4666
|
+
id: z41.string(),
|
|
4667
|
+
position: z41.number().int(),
|
|
4668
|
+
name: z41.string(),
|
|
4669
|
+
kind: z41.enum(AGENT_DIRECTIVE_KINDS),
|
|
4670
|
+
severity: z41.enum(AGENT_DIRECTIVE_SEVERITIES),
|
|
4671
|
+
text: z41.string(),
|
|
4672
|
+
source: z41.enum(AGENT_DIRECTIVE_SOURCES),
|
|
4673
|
+
status: z41.enum(AGENT_DIRECTIVE_STATUSES),
|
|
4321
4674
|
/** Who wrote it; null for a lesson the system proposed. */
|
|
4322
|
-
createdBy:
|
|
4675
|
+
createdBy: z41.string().nullable(),
|
|
4323
4676
|
/** Why a mined lesson was proposed; null for a directive a person wrote. */
|
|
4324
|
-
evidence:
|
|
4325
|
-
decidedBy:
|
|
4326
|
-
decidedAt:
|
|
4327
|
-
createdAt:
|
|
4677
|
+
evidence: z41.record(z41.unknown()).nullable(),
|
|
4678
|
+
decidedBy: z41.string().nullable(),
|
|
4679
|
+
decidedAt: z41.string().nullable(),
|
|
4680
|
+
createdAt: z41.string()
|
|
4328
4681
|
});
|
|
4329
|
-
var OutcomeTallySchema =
|
|
4682
|
+
var OutcomeTallySchema = z41.object({ turns: z41.number().int(), acted: z41.number().int() });
|
|
4330
4683
|
var SpaceAgentDirectiveListItemSchema = SpaceAgentDirectiveSchema.extend({
|
|
4331
|
-
impact:
|
|
4684
|
+
impact: z41.object({ before: OutcomeTallySchema, after: OutcomeTallySchema }).nullable()
|
|
4332
4685
|
});
|
|
4333
|
-
var UpdateAgentDirectiveInputSchema =
|
|
4686
|
+
var UpdateAgentDirectiveInputSchema = z41.object({
|
|
4334
4687
|
name: AgentDirectiveSchema.shape.name.optional(),
|
|
4335
4688
|
kind: AgentDirectiveSchema.shape.kind.optional(),
|
|
4336
4689
|
severity: AgentDirectiveSchema.shape.severity.optional(),
|
|
4337
4690
|
text: AgentDirectiveSchema.shape.text.optional(),
|
|
4338
|
-
status:
|
|
4691
|
+
status: z41.enum(AGENT_DIRECTIVE_STATUSES).optional()
|
|
4339
4692
|
}).strict();
|
|
4340
|
-
var ReorderAgentDirectivesInputSchema =
|
|
4693
|
+
var ReorderAgentDirectivesInputSchema = z41.object({ ids: z41.array(z41.string()).min(1) }).strict();
|
|
4341
4694
|
|
|
4342
4695
|
// ../spacestation/src/shell/bot-check-notice.ts
|
|
4343
|
-
import { z as
|
|
4344
|
-
var BotCheckNoticeSchema =
|
|
4696
|
+
import { z as z42 } from "zod";
|
|
4697
|
+
var BotCheckNoticeSchema = z42.object({
|
|
4345
4698
|
/** Read in order: plain text, and links the notice must keep linked. */
|
|
4346
|
-
segments:
|
|
4699
|
+
segments: z42.array(z42.union([z42.string(), z42.object({ text: z42.string(), href: z42.string().url() })])).min(1)
|
|
4347
4700
|
});
|
|
4348
4701
|
|
|
4349
4702
|
// ../spacestation/src/space/space-locale.ts
|
|
4350
|
-
import { z as
|
|
4703
|
+
import { z as z43 } from "zod";
|
|
4351
4704
|
var DEFAULT_SPACE_LOCALE = "en-US";
|
|
4352
4705
|
function isBcp47(tag) {
|
|
4353
4706
|
try {
|
|
@@ -4357,7 +4710,7 @@ function isBcp47(tag) {
|
|
|
4357
4710
|
throw err;
|
|
4358
4711
|
}
|
|
4359
4712
|
}
|
|
4360
|
-
var SpaceLocaleSchema =
|
|
4713
|
+
var SpaceLocaleSchema = z43.string().refine(isBcp47, { message: "locale must be a BCP 47 language tag, e.g. he-IL" });
|
|
4361
4714
|
var RTL_SCRIPTS = /* @__PURE__ */ new Set(["Arab", "Hebr", "Thaa", "Syrc", "Nkoo", "Adlm", "Rohg", "Mand", "Samr"]);
|
|
4362
4715
|
var RTL_LANGUAGES = /* @__PURE__ */ new Set(["ar", "he", "iw", "fa", "ur", "ps", "sd", "ug", "yi", "dv", "ckb", "syr"]);
|
|
4363
4716
|
function textDirectionOf(locale) {
|
|
@@ -4385,6 +4738,39 @@ function spaceLocaleOf(config) {
|
|
|
4385
4738
|
return declared === void 0 ? DEFAULT_SPACE_LOCALE : declared;
|
|
4386
4739
|
}
|
|
4387
4740
|
|
|
4741
|
+
// ../spacestation/src/space/space-description.ts
|
|
4742
|
+
import { z as z44 } from "zod";
|
|
4743
|
+
var SPACE_DESCRIPTION_MAX_CHARS = 300;
|
|
4744
|
+
var SpaceDescriptionSchema = z44.string().trim().min(1).max(SPACE_DESCRIPTION_MAX_CHARS);
|
|
4745
|
+
function spaceDescriptionOf(config) {
|
|
4746
|
+
if (config.description === void 0) return null;
|
|
4747
|
+
const parsed = SpaceDescriptionSchema.safeParse(config.description);
|
|
4748
|
+
return parsed.success ? parsed.data : null;
|
|
4749
|
+
}
|
|
4750
|
+
|
|
4751
|
+
// ../spacestation/src/space/space-share.ts
|
|
4752
|
+
import { z as z45 } from "zod";
|
|
4753
|
+
var X_HANDLE_PATTERN = /^@?[A-Za-z0-9_]{1,15}$/;
|
|
4754
|
+
var XHandleSchema = z45.string().trim().regex(X_HANDLE_PATTERN);
|
|
4755
|
+
var SPACE_SHARE_QUERY_MAX_CHARS = 120;
|
|
4756
|
+
var SpaceShareQuerySchema = z45.string().trim().min(1).max(SPACE_SHARE_QUERY_MAX_CHARS);
|
|
4757
|
+
function bareXHandle(handle) {
|
|
4758
|
+
return handle.trim().replace(/^@/, "");
|
|
4759
|
+
}
|
|
4760
|
+
function handleOf(value2) {
|
|
4761
|
+
if (value2 === void 0) return null;
|
|
4762
|
+
const parsed = XHandleSchema.safeParse(value2);
|
|
4763
|
+
return parsed.success ? bareXHandle(parsed.data) : null;
|
|
4764
|
+
}
|
|
4765
|
+
function spaceShareOf(config) {
|
|
4766
|
+
const query = config.shareQuery === void 0 ? null : SpaceShareQuerySchema.safeParse(config.shareQuery);
|
|
4767
|
+
return {
|
|
4768
|
+
twitterSite: handleOf(config.twitterSite),
|
|
4769
|
+
twitterCreator: handleOf(config.twitterCreator),
|
|
4770
|
+
shareQuery: query !== null && query.success ? query.data : null
|
|
4771
|
+
};
|
|
4772
|
+
}
|
|
4773
|
+
|
|
4388
4774
|
// ../spacestation/src/space/workspace-catalog.ts
|
|
4389
4775
|
var COMPONENT_SOURCE = {
|
|
4390
4776
|
ui: "@fourty/ui"
|
|
@@ -4447,30 +4833,30 @@ function hostingAllows(hosting, surface) {
|
|
|
4447
4833
|
}
|
|
4448
4834
|
|
|
4449
4835
|
// ../spacestation/src/space/trace.ts
|
|
4450
|
-
import { z as
|
|
4451
|
-
var RunTokenUsageSchema =
|
|
4452
|
-
input_tokens:
|
|
4453
|
-
output_tokens:
|
|
4454
|
-
cache_read_tokens:
|
|
4455
|
-
});
|
|
4456
|
-
var TraceRecordSchema =
|
|
4457
|
-
id:
|
|
4458
|
-
spaceId:
|
|
4459
|
-
sessionId:
|
|
4836
|
+
import { z as z46 } from "zod";
|
|
4837
|
+
var RunTokenUsageSchema = z46.object({
|
|
4838
|
+
input_tokens: z46.number().optional(),
|
|
4839
|
+
output_tokens: z46.number().optional(),
|
|
4840
|
+
cache_read_tokens: z46.number().optional()
|
|
4841
|
+
});
|
|
4842
|
+
var TraceRecordSchema = z46.object({
|
|
4843
|
+
id: z46.string().uuid(),
|
|
4844
|
+
spaceId: z46.string().uuid().nullable(),
|
|
4845
|
+
sessionId: z46.string(),
|
|
4460
4846
|
/** OTP-verified visitor email the session was unlocked with, or `null`
|
|
4461
4847
|
* for an unlocked space / anonymous unlock. */
|
|
4462
|
-
visitorEmail:
|
|
4463
|
-
userPrompt:
|
|
4464
|
-
branch:
|
|
4465
|
-
responseText:
|
|
4466
|
-
layout:
|
|
4467
|
-
phaseTimings:
|
|
4468
|
-
tokensByModel:
|
|
4469
|
-
toolCalls:
|
|
4470
|
-
diagnostics:
|
|
4471
|
-
latencyFirstText:
|
|
4472
|
-
latencyFirstPatch:
|
|
4473
|
-
latencyTotal:
|
|
4848
|
+
visitorEmail: z46.string().nullable(),
|
|
4849
|
+
userPrompt: z46.string(),
|
|
4850
|
+
branch: z46.string().nullable(),
|
|
4851
|
+
responseText: z46.string().nullable(),
|
|
4852
|
+
layout: z46.unknown().nullable(),
|
|
4853
|
+
phaseTimings: z46.record(z46.number()).nullable(),
|
|
4854
|
+
tokensByModel: z46.record(RunTokenUsageSchema).nullable(),
|
|
4855
|
+
toolCalls: z46.array(z46.unknown()).nullable(),
|
|
4856
|
+
diagnostics: z46.array(z46.unknown()).nullable(),
|
|
4857
|
+
latencyFirstText: z46.number().int().nullable(),
|
|
4858
|
+
latencyFirstPatch: z46.number().int().nullable(),
|
|
4859
|
+
latencyTotal: z46.number().int().nullable(),
|
|
4474
4860
|
/**
|
|
4475
4861
|
* The CLIENT's turn id for this run, or `null`.
|
|
4476
4862
|
*
|
|
@@ -4486,29 +4872,29 @@ var TraceRecordSchema = z42.object({
|
|
|
4486
4872
|
* a turn whose ack the client never saw — none of which is evidence that a
|
|
4487
4873
|
* visitor asked something and got nothing.
|
|
4488
4874
|
*/
|
|
4489
|
-
turnId:
|
|
4875
|
+
turnId: z46.string().nullable(),
|
|
4490
4876
|
/** Serialized `TraceTracker.exportState()` payload (parsed object) —
|
|
4491
4877
|
* lets the inspector rehydrate this run verbatim after a reload. */
|
|
4492
|
-
trackerState:
|
|
4493
|
-
createdAt:
|
|
4494
|
-
});
|
|
4495
|
-
var MillisecondsSchema =
|
|
4496
|
-
var CreateTraceInputSchema =
|
|
4497
|
-
spaceId:
|
|
4498
|
-
sessionId:
|
|
4499
|
-
visitorEmail:
|
|
4500
|
-
userPrompt:
|
|
4501
|
-
branch:
|
|
4502
|
-
responseText:
|
|
4503
|
-
layout:
|
|
4504
|
-
phaseTimings:
|
|
4505
|
-
tokensByModel:
|
|
4506
|
-
toolCalls:
|
|
4507
|
-
diagnostics:
|
|
4878
|
+
trackerState: z46.unknown().nullable(),
|
|
4879
|
+
createdAt: z46.string()
|
|
4880
|
+
});
|
|
4881
|
+
var MillisecondsSchema = z46.number().nullable().transform((v) => v === null ? null : Math.round(v));
|
|
4882
|
+
var CreateTraceInputSchema = z46.object({
|
|
4883
|
+
spaceId: z46.string().uuid().nullable(),
|
|
4884
|
+
sessionId: z46.string(),
|
|
4885
|
+
visitorEmail: z46.string().nullable(),
|
|
4886
|
+
userPrompt: z46.string(),
|
|
4887
|
+
branch: z46.string().nullable(),
|
|
4888
|
+
responseText: z46.string().nullable(),
|
|
4889
|
+
layout: z46.unknown().nullable(),
|
|
4890
|
+
phaseTimings: z46.record(z46.number()).nullable(),
|
|
4891
|
+
tokensByModel: z46.record(RunTokenUsageSchema).nullable(),
|
|
4892
|
+
toolCalls: z46.array(z46.unknown()).nullable(),
|
|
4893
|
+
diagnostics: z46.array(z46.unknown()).nullable(),
|
|
4508
4894
|
latencyFirstText: MillisecondsSchema,
|
|
4509
4895
|
latencyFirstPatch: MillisecondsSchema,
|
|
4510
4896
|
latencyTotal: MillisecondsSchema,
|
|
4511
|
-
trackerState:
|
|
4897
|
+
trackerState: z46.unknown().nullable(),
|
|
4512
4898
|
/**
|
|
4513
4899
|
* The CLIENT's turn id for this run, or `null`.
|
|
4514
4900
|
*
|
|
@@ -4524,45 +4910,45 @@ var CreateTraceInputSchema = z42.object({
|
|
|
4524
4910
|
* a turn whose ack the client never saw — none of which is evidence that a
|
|
4525
4911
|
* visitor asked something and got nothing.
|
|
4526
4912
|
*/
|
|
4527
|
-
turnId:
|
|
4913
|
+
turnId: z46.string().nullable()
|
|
4528
4914
|
});
|
|
4529
|
-
var AgentSessionSummarySchema =
|
|
4530
|
-
sessionId:
|
|
4915
|
+
var AgentSessionSummarySchema = z46.object({
|
|
4916
|
+
sessionId: z46.string(),
|
|
4531
4917
|
/** Turn rows only; background/secondary runs are excluded by the aggregate. */
|
|
4532
|
-
turnCount:
|
|
4918
|
+
turnCount: z46.number().int(),
|
|
4533
4919
|
/** The session's opening prompt — titles the row in the UI. */
|
|
4534
|
-
firstPrompt:
|
|
4535
|
-
startedAt:
|
|
4536
|
-
lastRunAt:
|
|
4920
|
+
firstPrompt: z46.string(),
|
|
4921
|
+
startedAt: z46.string(),
|
|
4922
|
+
lastRunAt: z46.string(),
|
|
4537
4923
|
/** Summed `latency_total` across the session's turns. */
|
|
4538
|
-
totalLatencyMs:
|
|
4924
|
+
totalLatencyMs: z46.number().int()
|
|
4539
4925
|
});
|
|
4540
|
-
var SessionTurnSchema =
|
|
4541
|
-
id:
|
|
4542
|
-
userPrompt:
|
|
4543
|
-
responseText:
|
|
4926
|
+
var SessionTurnSchema = z46.object({
|
|
4927
|
+
id: z46.string().uuid(),
|
|
4928
|
+
userPrompt: z46.string(),
|
|
4929
|
+
responseText: z46.string().nullable(),
|
|
4544
4930
|
/** Full cumulative Spec committed by this turn — never a patch delta. */
|
|
4545
|
-
layout:
|
|
4546
|
-
createdAt:
|
|
4931
|
+
layout: z46.unknown().nullable(),
|
|
4932
|
+
createdAt: z46.string(),
|
|
4547
4933
|
/** Turn start → first prose delta. Null on a turn that wrote no prose. */
|
|
4548
|
-
latencyFirstText:
|
|
4934
|
+
latencyFirstText: z46.number().int().nullable(),
|
|
4549
4935
|
/** Turn start → first layout patch — the LAYOUT latency the session screen
|
|
4550
4936
|
* grades against the budget. Null on a turn that patched nothing. */
|
|
4551
|
-
latencyFirstPatch:
|
|
4552
|
-
latencyTotal:
|
|
4553
|
-
phaseTimings:
|
|
4554
|
-
tokensByModel:
|
|
4937
|
+
latencyFirstPatch: z46.number().int().nullable(),
|
|
4938
|
+
latencyTotal: z46.number().int().nullable(),
|
|
4939
|
+
phaseTimings: z46.record(z46.number()).nullable(),
|
|
4940
|
+
tokensByModel: z46.record(RunTokenUsageSchema).nullable(),
|
|
4555
4941
|
/**
|
|
4556
4942
|
* The turn's tokens priced SERVER-side (`estimateCostUsd`), so the browser
|
|
4557
4943
|
* never carries a rate table. Null when any model on the turn is unpriced —
|
|
4558
4944
|
* never 0, which would read as free.
|
|
4559
4945
|
*/
|
|
4560
|
-
estimatedCostUsd:
|
|
4561
|
-
toolCalls:
|
|
4562
|
-
diagnostics:
|
|
4946
|
+
estimatedCostUsd: z46.number().nullable(),
|
|
4947
|
+
toolCalls: z46.array(z46.unknown()).nullable(),
|
|
4948
|
+
diagnostics: z46.array(z46.unknown()).nullable()
|
|
4563
4949
|
});
|
|
4564
|
-
var SessionReplaySchema =
|
|
4565
|
-
turns:
|
|
4950
|
+
var SessionReplaySchema = z46.object({
|
|
4951
|
+
turns: z46.array(SessionTurnSchema),
|
|
4566
4952
|
/**
|
|
4567
4953
|
* The session's own last-committed layout, read straight off the durable
|
|
4568
4954
|
* session record (`sessions.blob.layout`) rather than derived from `turns`.
|
|
@@ -4573,20 +4959,20 @@ var SessionReplaySchema = z42.object({
|
|
|
4573
4959
|
* a perfectly real layout; only this field can show it. Null exclusively
|
|
4574
4960
|
* when the durable session row itself could not be read.
|
|
4575
4961
|
*/
|
|
4576
|
-
sessionLayout:
|
|
4962
|
+
sessionLayout: z46.record(z46.string(), z46.unknown()).nullable()
|
|
4577
4963
|
});
|
|
4578
|
-
var SessionTraceSchema =
|
|
4579
|
-
trackerState:
|
|
4964
|
+
var SessionTraceSchema = z46.object({
|
|
4965
|
+
trackerState: z46.string().nullable()
|
|
4580
4966
|
});
|
|
4581
|
-
var LlmUsageDailySchema =
|
|
4582
|
-
day:
|
|
4967
|
+
var LlmUsageDailySchema = z46.object({
|
|
4968
|
+
day: z46.string(),
|
|
4583
4969
|
/** Deployment that made the call — 'production', 'staging', 'pr-123', 'development'. */
|
|
4584
|
-
environment:
|
|
4585
|
-
feature:
|
|
4586
|
-
model:
|
|
4587
|
-
provider:
|
|
4970
|
+
environment: z46.string(),
|
|
4971
|
+
feature: z46.string(),
|
|
4972
|
+
model: z46.string(),
|
|
4973
|
+
provider: z46.string(),
|
|
4588
4974
|
/** Masked tail of the key actually billed, or null when unknown/non-Google. */
|
|
4589
|
-
keyFingerprint:
|
|
4975
|
+
keyFingerprint: z46.string().nullable(),
|
|
4590
4976
|
/**
|
|
4591
4977
|
* The space the call served, or null when it served none.
|
|
4592
4978
|
*
|
|
@@ -4595,92 +4981,92 @@ var LlmUsageDailySchema = z42.object({
|
|
|
4595
4981
|
* report that share rather than dropping it, or a per-space total reads as
|
|
4596
4982
|
* the platform total.
|
|
4597
4983
|
*/
|
|
4598
|
-
spaceId:
|
|
4984
|
+
spaceId: z46.string().nullable(),
|
|
4599
4985
|
/**
|
|
4600
4986
|
* The surface of the session the call served (`sessions.surface`), or null
|
|
4601
4987
|
* when it served no session or the session predates surface recording.
|
|
4602
4988
|
* `automation` is the eval harness — the signal that files an ordinary
|
|
4603
4989
|
* `agent-turn` as testing spend rather than as a visitor's.
|
|
4604
4990
|
*/
|
|
4605
|
-
surface:
|
|
4606
|
-
inputTokens:
|
|
4607
|
-
outputTokens:
|
|
4991
|
+
surface: z46.string().nullable(),
|
|
4992
|
+
inputTokens: z46.number(),
|
|
4993
|
+
outputTokens: z46.number(),
|
|
4608
4994
|
/** Subset of inputTokens, never additional to it. */
|
|
4609
|
-
cachedInputTokens:
|
|
4610
|
-
reasoningTokens:
|
|
4611
|
-
callCount:
|
|
4612
|
-
errorCount:
|
|
4613
|
-
estimatedCostUsd:
|
|
4614
|
-
});
|
|
4615
|
-
var LlmUsageBySessionSchema =
|
|
4616
|
-
sessionId:
|
|
4617
|
-
environment:
|
|
4618
|
-
model:
|
|
4995
|
+
cachedInputTokens: z46.number(),
|
|
4996
|
+
reasoningTokens: z46.number(),
|
|
4997
|
+
callCount: z46.number(),
|
|
4998
|
+
errorCount: z46.number(),
|
|
4999
|
+
estimatedCostUsd: z46.number().nullable()
|
|
5000
|
+
});
|
|
5001
|
+
var LlmUsageBySessionSchema = z46.object({
|
|
5002
|
+
sessionId: z46.string(),
|
|
5003
|
+
environment: z46.string(),
|
|
5004
|
+
model: z46.string(),
|
|
4619
5005
|
/** The space this session belongs to, or null for a session with no space. */
|
|
4620
|
-
spaceId:
|
|
5006
|
+
spaceId: z46.string().nullable(),
|
|
4621
5007
|
/** The session's surface — see `LlmUsageDailySchema.surface`. */
|
|
4622
|
-
surface:
|
|
5008
|
+
surface: z46.string().nullable(),
|
|
4623
5009
|
/** Label only — the first feature seen in the session. */
|
|
4624
|
-
firstFeature:
|
|
4625
|
-
startedAt:
|
|
4626
|
-
endedAt:
|
|
4627
|
-
inputTokens:
|
|
4628
|
-
outputTokens:
|
|
4629
|
-
cachedInputTokens:
|
|
4630
|
-
reasoningTokens:
|
|
4631
|
-
callCount:
|
|
4632
|
-
errorCount:
|
|
5010
|
+
firstFeature: z46.string(),
|
|
5011
|
+
startedAt: z46.string(),
|
|
5012
|
+
endedAt: z46.string(),
|
|
5013
|
+
inputTokens: z46.number(),
|
|
5014
|
+
outputTokens: z46.number(),
|
|
5015
|
+
cachedInputTokens: z46.number(),
|
|
5016
|
+
reasoningTokens: z46.number(),
|
|
5017
|
+
callCount: z46.number(),
|
|
5018
|
+
errorCount: z46.number(),
|
|
4633
5019
|
/** Priced server-side, like the daily rollup — the browser never carries a
|
|
4634
5020
|
* rate table, so there is exactly one place a price can be wrong. Null when
|
|
4635
5021
|
* the model is unpriced; never 0, which would read as free. */
|
|
4636
|
-
estimatedCostUsd:
|
|
5022
|
+
estimatedCostUsd: z46.number().nullable()
|
|
4637
5023
|
});
|
|
4638
|
-
var LlmSessionsDailySchema =
|
|
4639
|
-
day:
|
|
4640
|
-
environment:
|
|
4641
|
-
sessionCount:
|
|
5024
|
+
var LlmSessionsDailySchema = z46.object({
|
|
5025
|
+
day: z46.string(),
|
|
5026
|
+
environment: z46.string(),
|
|
5027
|
+
sessionCount: z46.number()
|
|
4642
5028
|
});
|
|
4643
5029
|
|
|
4644
5030
|
// ../spacestation/src/space/session-queue.ts
|
|
4645
|
-
import { z as
|
|
5031
|
+
import { z as z48 } from "zod";
|
|
4646
5032
|
|
|
4647
5033
|
// ../spacestation/src/space/session-activity.ts
|
|
4648
|
-
import { z as
|
|
4649
|
-
var SessionActivityEventSchema =
|
|
4650
|
-
id:
|
|
4651
|
-
kind:
|
|
4652
|
-
occurredAt:
|
|
4653
|
-
source:
|
|
4654
|
-
surface:
|
|
4655
|
-
payload:
|
|
5034
|
+
import { z as z47 } from "zod";
|
|
5035
|
+
var SessionActivityEventSchema = z47.object({
|
|
5036
|
+
id: z47.string(),
|
|
5037
|
+
kind: z47.string(),
|
|
5038
|
+
occurredAt: z47.string(),
|
|
5039
|
+
source: z47.string(),
|
|
5040
|
+
surface: z47.string(),
|
|
5041
|
+
payload: z47.record(z47.unknown())
|
|
4656
5042
|
});
|
|
4657
|
-
var SessionActivitySchema =
|
|
4658
|
-
events:
|
|
4659
|
-
hasMore:
|
|
5043
|
+
var SessionActivitySchema = z47.object({
|
|
5044
|
+
events: z47.array(SessionActivityEventSchema),
|
|
5045
|
+
hasMore: z47.boolean()
|
|
4660
5046
|
});
|
|
4661
5047
|
|
|
4662
5048
|
// ../spacestation/src/space/session-queue.ts
|
|
4663
|
-
var QueueSortKeySchema =
|
|
4664
|
-
var SessionVerdictSchema =
|
|
4665
|
-
var RecordableVerdictSchema =
|
|
4666
|
-
var SessionReviewEventSchema =
|
|
4667
|
-
id:
|
|
5049
|
+
var QueueSortKeySchema = z48.enum(["lastActive", "stage", "source", "location", "turns", "duration"]);
|
|
5050
|
+
var SessionVerdictSchema = z48.enum(["unreviewed", "viewed", "bug"]);
|
|
5051
|
+
var RecordableVerdictSchema = z48.enum(["viewed", "bug"]);
|
|
5052
|
+
var SessionReviewEventSchema = z48.object({
|
|
5053
|
+
id: z48.string().uuid(),
|
|
4668
5054
|
verdict: RecordableVerdictSchema,
|
|
4669
5055
|
/** Account email of the operator who judged it. Attribution is the reason the
|
|
4670
5056
|
* log is append-only rather than a mutable current-state row. */
|
|
4671
|
-
reviewer:
|
|
4672
|
-
note:
|
|
4673
|
-
createdAt:
|
|
5057
|
+
reviewer: z48.string(),
|
|
5058
|
+
note: z48.string().nullable(),
|
|
5059
|
+
createdAt: z48.string()
|
|
4674
5060
|
});
|
|
4675
|
-
var BugSeveritySchema =
|
|
4676
|
-
var BugLocationSchema =
|
|
4677
|
-
elementId:
|
|
5061
|
+
var BugSeveritySchema = z48.enum(["high", "medium", "low"]);
|
|
5062
|
+
var BugLocationSchema = z48.object({
|
|
5063
|
+
elementId: z48.string().nullable(),
|
|
4678
5064
|
/** Display only — the catalog component type, e.g. "productGrid". Null
|
|
4679
5065
|
* alongside a null `elementId`. */
|
|
4680
|
-
elementType:
|
|
5066
|
+
elementType: z48.string().nullable(),
|
|
4681
5067
|
/** Fraction of the ELEMENT's own box. Null for a page anchor. */
|
|
4682
|
-
offsetXPct:
|
|
4683
|
-
offsetYPct:
|
|
5068
|
+
offsetXPct: z48.number().min(0).max(100).nullable(),
|
|
5069
|
+
offsetYPct: z48.number().min(0).max(100).nullable(),
|
|
4684
5070
|
/**
|
|
4685
5071
|
* ABSOLUTE document pixels, for a pin with no element under it. Null for an
|
|
4686
5072
|
* element anchor.
|
|
@@ -4691,8 +5077,8 @@ var BugLocationSchema = z44.object({
|
|
|
4691
5077
|
* on the page with it. Measured before this was fixed: growing the page 9%
|
|
4692
5078
|
* slid a pin 32px, so a pin ran away from the cursor reaching for it.
|
|
4693
5079
|
*/
|
|
4694
|
-
pageX:
|
|
4695
|
-
pageY:
|
|
5080
|
+
pageX: z48.number().nullable(),
|
|
5081
|
+
pageY: z48.number().nullable()
|
|
4696
5082
|
}).refine(
|
|
4697
5083
|
(loc) => {
|
|
4698
5084
|
const hasOffsets = loc.offsetXPct !== null && loc.offsetYPct !== null;
|
|
@@ -4706,24 +5092,24 @@ var BugLocationSchema = z44.object({
|
|
|
4706
5092
|
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)"
|
|
4707
5093
|
}
|
|
4708
5094
|
);
|
|
4709
|
-
var SessionBugSchema =
|
|
4710
|
-
id:
|
|
5095
|
+
var SessionBugSchema = z48.object({
|
|
5096
|
+
id: z48.string().uuid(),
|
|
4711
5097
|
/** 1-based turn the fault was observed on; null when the fault is session-wide. */
|
|
4712
|
-
turnIndex:
|
|
5098
|
+
turnIndex: z48.number().int().nullable(),
|
|
4713
5099
|
/** Where on that turn's canvas the pin was dropped; null for a bug filed
|
|
4714
5100
|
* without pinning a spot. */
|
|
4715
5101
|
location: BugLocationSchema.nullable(),
|
|
4716
|
-
provider:
|
|
4717
|
-
issueKey:
|
|
4718
|
-
issueUrl:
|
|
5102
|
+
provider: z48.string(),
|
|
5103
|
+
issueKey: z48.string().nullable(),
|
|
5104
|
+
issueUrl: z48.string().nullable(),
|
|
4719
5105
|
/** The tracker's own state word ('Todo', 'Done', …) — their vocabulary, so
|
|
4720
5106
|
* open text. Null until first synced. */
|
|
4721
|
-
issueState:
|
|
4722
|
-
title:
|
|
4723
|
-
body:
|
|
5107
|
+
issueState: z48.string().nullable(),
|
|
5108
|
+
title: z48.string(),
|
|
5109
|
+
body: z48.string(),
|
|
4724
5110
|
severity: BugSeveritySchema,
|
|
4725
|
-
createdBy:
|
|
4726
|
-
createdAt:
|
|
5111
|
+
createdBy: z48.string(),
|
|
5112
|
+
createdAt: z48.string(),
|
|
4727
5113
|
/**
|
|
4728
5114
|
* When this bug was resolved from the console; null means still OPEN.
|
|
4729
5115
|
*
|
|
@@ -4732,60 +5118,60 @@ var SessionBugSchema = z44.object({
|
|
|
4732
5118
|
* whether a particular fault is still live. The timestamp IS the state, so
|
|
4733
5119
|
* no boolean can contradict it.
|
|
4734
5120
|
*/
|
|
4735
|
-
resolvedAt:
|
|
4736
|
-
resolvedBy:
|
|
5121
|
+
resolvedAt: z48.string().nullable(),
|
|
5122
|
+
resolvedBy: z48.string().nullable()
|
|
4737
5123
|
});
|
|
4738
|
-
var SpaceBugSchema = SessionBugSchema.extend({ sessionId:
|
|
4739
|
-
var SessionCommentSchema =
|
|
4740
|
-
id:
|
|
5124
|
+
var SpaceBugSchema = SessionBugSchema.extend({ sessionId: z48.string() });
|
|
5125
|
+
var SessionCommentSchema = z48.object({
|
|
5126
|
+
id: z48.string().uuid(),
|
|
4741
5127
|
/** Set = a reply in that bug's thread. Null = a standalone comment pin. */
|
|
4742
|
-
bugId:
|
|
5128
|
+
bugId: z48.string().uuid().nullable(),
|
|
4743
5129
|
/** 1-based turn the comment was left on; null for a reply (it reads its
|
|
4744
5130
|
* parent bug's turn). */
|
|
4745
|
-
turnIndex:
|
|
5131
|
+
turnIndex: z48.number().int().nullable(),
|
|
4746
5132
|
/** The canvas anchor for a STANDALONE comment's own pin; null for a reply. */
|
|
4747
5133
|
location: BugLocationSchema.nullable(),
|
|
4748
|
-
body:
|
|
4749
|
-
createdBy:
|
|
4750
|
-
createdAt:
|
|
5134
|
+
body: z48.string(),
|
|
5135
|
+
createdBy: z48.string(),
|
|
5136
|
+
createdAt: z48.string()
|
|
4751
5137
|
});
|
|
4752
|
-
var CreateCommentInputSchema =
|
|
4753
|
-
bugId:
|
|
4754
|
-
turnIndex:
|
|
5138
|
+
var CreateCommentInputSchema = z48.object({
|
|
5139
|
+
bugId: z48.string().uuid().nullable(),
|
|
5140
|
+
turnIndex: z48.number().int().positive().nullable(),
|
|
4755
5141
|
location: BugLocationSchema.nullable(),
|
|
4756
5142
|
// Trimmed, so whitespace is not content: `.min(1)` alone accepted a comment
|
|
4757
5143
|
// of three spaces, which renders as an empty bubble nobody can interpret.
|
|
4758
|
-
body:
|
|
5144
|
+
body: z48.string().trim().min(1)
|
|
4759
5145
|
}).refine((input) => input.bugId === null !== (input.location === null), {
|
|
4760
5146
|
message: "a comment is either a reply (bugId, no location) or a standalone pin (location, no bugId)"
|
|
4761
5147
|
});
|
|
4762
|
-
var UpdateCommentInputSchema =
|
|
4763
|
-
body:
|
|
4764
|
-
bugId:
|
|
5148
|
+
var UpdateCommentInputSchema = z48.object({
|
|
5149
|
+
body: z48.string().trim().min(1).optional(),
|
|
5150
|
+
bugId: z48.string().uuid().nullable().optional(),
|
|
4765
5151
|
location: BugLocationSchema.nullable().optional()
|
|
4766
5152
|
});
|
|
4767
5153
|
var MOBILE_VIEWPORT_MAX = 720;
|
|
4768
|
-
var SessionFormFactorSchema =
|
|
5154
|
+
var SessionFormFactorSchema = z48.enum(["mobile", "desktop"]).nullable();
|
|
4769
5155
|
function formFactorFromViewport(width) {
|
|
4770
5156
|
if (width === null) return null;
|
|
4771
5157
|
return width <= MOBILE_VIEWPORT_MAX ? "mobile" : "desktop";
|
|
4772
5158
|
}
|
|
4773
|
-
var SessionSummarySchema =
|
|
4774
|
-
sessionId:
|
|
5159
|
+
var SessionSummarySchema = z48.object({
|
|
5160
|
+
sessionId: z48.string(),
|
|
4775
5161
|
/** Stable per-browser id — the join key across a visitor's sessions. Null when
|
|
4776
5162
|
* the session row is gone (pruned) or predates the `sessions` table. */
|
|
4777
|
-
visitorId:
|
|
5163
|
+
visitorId: z48.string().nullable(),
|
|
4778
5164
|
/** Provider-qualified identity anchor, present only once the visitor
|
|
4779
5165
|
* identified themselves. Both null together means "not identified yet". */
|
|
4780
|
-
identityProvider:
|
|
4781
|
-
identityKey:
|
|
5166
|
+
identityProvider: z48.string().nullable(),
|
|
5167
|
+
identityKey: z48.string().nullable(),
|
|
4782
5168
|
/** Team/test traffic. The queue hides these by default. */
|
|
4783
|
-
isInternal:
|
|
5169
|
+
isInternal: z48.boolean(),
|
|
4784
5170
|
/** Build that served the session. Null = not captured; a version filter must
|
|
4785
5171
|
* therefore EXCLUDE it rather than let it match an arbitrary bucket. */
|
|
4786
|
-
clientVersion:
|
|
5172
|
+
clientVersion: z48.string().nullable(),
|
|
4787
5173
|
/** Commit-shaped interaction signals, counted, keyed by open `SignalType`. */
|
|
4788
|
-
signalCounts:
|
|
5174
|
+
signalCounts: z48.record(z48.number()),
|
|
4789
5175
|
/**
|
|
4790
5176
|
* Did this conversation ACQUIRE anything, and how many times?
|
|
4791
5177
|
*
|
|
@@ -4802,7 +5188,7 @@ var SessionSummarySchema = z44.object({
|
|
|
4802
5188
|
* predates the column — and renders as no mark at all. It never means zero:
|
|
4803
5189
|
* zero is a real, recorded answer and the rail reports it as one.
|
|
4804
5190
|
*/
|
|
4805
|
-
conversionAttempts:
|
|
5191
|
+
conversionAttempts: z48.number().int().nullable(),
|
|
4806
5192
|
/**
|
|
4807
5193
|
* The same attempts split by EVENT KIND, keyed by the kind's own name
|
|
4808
5194
|
* (`commerce.cart_line_added`, `commerce.registry_clicked`), counted distinct
|
|
@@ -4818,7 +5204,7 @@ var SessionSummarySchema = z44.object({
|
|
|
4818
5204
|
* kinds together, and one attempt id appearing under both would be counted
|
|
4819
5205
|
* once there and twice here.
|
|
4820
5206
|
*/
|
|
4821
|
-
conversionKinds:
|
|
5207
|
+
conversionKinds: z48.record(z48.number()),
|
|
4822
5208
|
/**
|
|
4823
5209
|
* Every analytics funnel step this session reached, in funnel order — the
|
|
4824
5210
|
* dashboard's own step ids, read by the same per-step predicates, so a queue
|
|
@@ -4826,20 +5212,20 @@ var SessionSummarySchema = z44.object({
|
|
|
4826
5212
|
* set of strings for the reason `conversionKinds` is: the contract does not
|
|
4827
5213
|
* learn what a step means. Empty only when read from a pre-column database.
|
|
4828
5214
|
*/
|
|
4829
|
-
funnelSteps:
|
|
5215
|
+
funnelSteps: z48.array(z48.string()),
|
|
4830
5216
|
/**
|
|
4831
5217
|
* The connector's opaque handle for what this session produced in its back
|
|
4832
5218
|
* office — present only once a checkout actually reached the platform. The
|
|
4833
5219
|
* console hands it to the back-office link registry; nothing else reads it.
|
|
4834
5220
|
*/
|
|
4835
|
-
backOfficeRef:
|
|
5221
|
+
backOfficeRef: z48.string().nullable(),
|
|
4836
5222
|
/**
|
|
4837
5223
|
* The order this session produced, when the connector's back office reported
|
|
4838
5224
|
* it (`session_orders`): its opaque id and the back office's own name for it.
|
|
4839
5225
|
* Both null when no order is known — the cart handle above is then the door.
|
|
4840
5226
|
*/
|
|
4841
|
-
orderRef:
|
|
4842
|
-
orderLabel:
|
|
5227
|
+
orderRef: z48.string().nullable(),
|
|
5228
|
+
orderLabel: z48.string().nullable(),
|
|
4843
5229
|
/**
|
|
4844
5230
|
* Which shell this session rendered — the one thing about the CAPTURE a list
|
|
4845
5231
|
* needs.
|
|
@@ -4854,20 +5240,20 @@ var SessionSummarySchema = z44.object({
|
|
|
4854
5240
|
formFactor: SessionFormFactorSchema,
|
|
4855
5241
|
/** How the visitor arrived (`sessions.traffic_bucket`), 'not_recorded' when none was
|
|
4856
5242
|
* recorded; null only from a queue function that predates the column. */
|
|
4857
|
-
trafficBucket:
|
|
5243
|
+
trafficBucket: z48.string().nullable(),
|
|
4858
5244
|
/** The referring site the arrival was recorded with (`sessions.referrer_host`),
|
|
4859
5245
|
* as the browser reported it. Null when there was none, or from a queue
|
|
4860
5246
|
* function that predates the column. */
|
|
4861
|
-
referrerHost:
|
|
5247
|
+
referrerHost: z48.string().nullable(),
|
|
4862
5248
|
/** The visitor's country (`sessions.visitor_country`, ISO-3166 alpha-2) —
|
|
4863
5249
|
* null when unknown, or from a queue function that predates carrying it. */
|
|
4864
|
-
visitorCountry:
|
|
4865
|
-
turnCount:
|
|
5250
|
+
visitorCountry: z48.string().nullable(),
|
|
5251
|
+
turnCount: z48.number().int(),
|
|
4866
5252
|
/** The visitor's opening message — the single most informative field for
|
|
4867
5253
|
* deciding whether a session is worth opening, hence the widest column. */
|
|
4868
|
-
firstPrompt:
|
|
4869
|
-
startedAt:
|
|
4870
|
-
lastRunAt:
|
|
5254
|
+
firstPrompt: z48.string(),
|
|
5255
|
+
startedAt: z48.string(),
|
|
5256
|
+
lastRunAt: z48.string(),
|
|
4871
5257
|
/**
|
|
4872
5258
|
* The VISITOR's own IANA zone (`America/New_York`), read from their browser
|
|
4873
5259
|
* at session create — what the two timestamps above should be read in.
|
|
@@ -4895,7 +5281,7 @@ var SessionSummarySchema = z44.object({
|
|
|
4895
5281
|
* Client-asserted and never validated against a zone table, so every consumer
|
|
4896
5282
|
* must tolerate an unknown name: `Intl` throws a RangeError on one.
|
|
4897
5283
|
*/
|
|
4898
|
-
visitorTimeZone:
|
|
5284
|
+
visitorTimeZone: z48.string().nullable(),
|
|
4899
5285
|
/**
|
|
4900
5286
|
* Mean TIME TO FIRST PATCH, over the turns that recorded one — the first
|
|
4901
5287
|
* layout op reaching the visitor, and THE latency the project is managed on.
|
|
@@ -4903,31 +5289,31 @@ var SessionSummarySchema = z44.object({
|
|
|
4903
5289
|
* `totalLatencyMs` carries the chip-gen tail that runs after the visitor is
|
|
4904
5290
|
* already reading. Null when no turn in the session recorded a patch.
|
|
4905
5291
|
*/
|
|
4906
|
-
avgTtftMs:
|
|
5292
|
+
avgTtftMs: z48.number().int().nullable(),
|
|
4907
5293
|
/** Mean `main_done_ms` — layout + prose complete. Context for the TTFT, not
|
|
4908
5294
|
* a budget: null on sessions older than the mark's recording. */
|
|
4909
|
-
avgMainDoneMs:
|
|
5295
|
+
avgMainDoneMs: z48.number().int().nullable(),
|
|
4910
5296
|
/** Mean `chip_gen_ms` — the pass that runs AFTER mainDone and is out of the
|
|
4911
5297
|
* budget. On the row only to explain the gap to `totalLatencyMs`. */
|
|
4912
|
-
avgChipGenMs:
|
|
4913
|
-
totalLatencyMs:
|
|
4914
|
-
durationMs:
|
|
5298
|
+
avgChipGenMs: z48.number().int().nullable(),
|
|
5299
|
+
totalLatencyMs: z48.number().int(),
|
|
5300
|
+
durationMs: z48.number().int(),
|
|
4915
5301
|
/** Inferred from recent activity — nothing writes a session-end marker. A
|
|
4916
5302
|
* live session streams and cannot be given a verdict until it ends. */
|
|
4917
|
-
isLive:
|
|
5303
|
+
isLive: z48.boolean(),
|
|
4918
5304
|
verdict: SessionVerdictSchema,
|
|
4919
|
-
reviewedBy:
|
|
4920
|
-
reviewedAt:
|
|
5305
|
+
reviewedBy: z48.string().nullable(),
|
|
5306
|
+
reviewedAt: z48.string().nullable(),
|
|
4921
5307
|
/** Latest filed bug, flattened onto the row so the queue can show its live
|
|
4922
5308
|
* state without a second request. */
|
|
4923
|
-
bugIssueKey:
|
|
4924
|
-
bugIssueUrl:
|
|
4925
|
-
bugIssueState:
|
|
4926
|
-
});
|
|
4927
|
-
var SessionQueuePageSchema =
|
|
4928
|
-
sessions:
|
|
4929
|
-
totalCount:
|
|
4930
|
-
hiddenInternalCount:
|
|
5309
|
+
bugIssueKey: z48.string().nullable(),
|
|
5310
|
+
bugIssueUrl: z48.string().nullable(),
|
|
5311
|
+
bugIssueState: z48.string().nullable()
|
|
5312
|
+
});
|
|
5313
|
+
var SessionQueuePageSchema = z48.object({
|
|
5314
|
+
sessions: z48.array(SessionSummarySchema),
|
|
5315
|
+
totalCount: z48.number().int(),
|
|
5316
|
+
hiddenInternalCount: z48.number().int(),
|
|
4931
5317
|
/**
|
|
4932
5318
|
* Bounced sessions the queue left out — no turn and no add, the default.
|
|
4933
5319
|
*
|
|
@@ -4937,82 +5323,82 @@ var SessionQueuePageSchema = z44.object({
|
|
|
4937
5323
|
* `totalCount + hiddenBouncedCount` is that population, and this count is the
|
|
4938
5324
|
* analytics dashboard's bounce over the same window.
|
|
4939
5325
|
*/
|
|
4940
|
-
hiddenBouncedCount:
|
|
5326
|
+
hiddenBouncedCount: z48.number().int(),
|
|
4941
5327
|
/** Sessions the region exclusion left out (unknown country is never hidden). */
|
|
4942
|
-
hiddenRegionCount:
|
|
5328
|
+
hiddenRegionCount: z48.number().int(),
|
|
4943
5329
|
/** The visitor countries this page excluded — the request's, else the space's default. */
|
|
4944
|
-
excludedRegions:
|
|
5330
|
+
excludedRegions: z48.array(z48.string())
|
|
4945
5331
|
});
|
|
4946
|
-
var SessionQueueFacetsSchema =
|
|
4947
|
-
review:
|
|
4948
|
-
version:
|
|
4949
|
-
turns:
|
|
4950
|
-
durationS:
|
|
5332
|
+
var SessionQueueFacetsSchema = z48.object({
|
|
5333
|
+
review: z48.record(z48.number()),
|
|
5334
|
+
version: z48.record(z48.number()),
|
|
5335
|
+
turns: z48.record(z48.number()),
|
|
5336
|
+
durationS: z48.record(z48.number()),
|
|
4951
5337
|
/** Sessions per funnel step reached — a session counts under every step it reached. */
|
|
4952
|
-
funnel:
|
|
5338
|
+
funnel: z48.record(z48.number()),
|
|
4953
5339
|
/** Sessions per traffic bucket ('not_recorded' where none was recorded). */
|
|
4954
|
-
source:
|
|
5340
|
+
source: z48.record(z48.number()),
|
|
4955
5341
|
/** Sessions per visitor country (ISO alpha-2), under every other filter. */
|
|
4956
|
-
region:
|
|
5342
|
+
region: z48.record(z48.number())
|
|
4957
5343
|
});
|
|
4958
|
-
var SessionCaptureSchema =
|
|
4959
|
-
viewportWidth:
|
|
4960
|
-
viewportHeight:
|
|
4961
|
-
userAgent:
|
|
4962
|
-
locale:
|
|
5344
|
+
var SessionCaptureSchema = z48.object({
|
|
5345
|
+
viewportWidth: z48.number().int().nullable(),
|
|
5346
|
+
viewportHeight: z48.number().int().nullable(),
|
|
5347
|
+
userAgent: z48.string().nullable(),
|
|
5348
|
+
locale: z48.string().nullable(),
|
|
4963
5349
|
/** Referrer at session create — separates agentic traffic from organic. */
|
|
4964
|
-
referrer:
|
|
5350
|
+
referrer: z48.string().nullable()
|
|
4965
5351
|
});
|
|
4966
|
-
var SessionCaptureInputSchema =
|
|
4967
|
-
viewportWidth:
|
|
4968
|
-
viewportHeight:
|
|
4969
|
-
userAgent:
|
|
4970
|
-
locale:
|
|
5352
|
+
var SessionCaptureInputSchema = z48.object({
|
|
5353
|
+
viewportWidth: z48.number().int().positive().max(2e4).optional(),
|
|
5354
|
+
viewportHeight: z48.number().int().positive().max(2e4).optional(),
|
|
5355
|
+
userAgent: z48.string().max(1e3).optional(),
|
|
5356
|
+
locale: z48.string().max(35).optional(),
|
|
4971
5357
|
/** IANA zone name from the visitor's browser. Bounded rather than validated:
|
|
4972
5358
|
* the zone database grows, and refusing a name this build has not heard of
|
|
4973
5359
|
* would drop a real session's capture over a table that is out of date. */
|
|
4974
|
-
timeZone:
|
|
4975
|
-
referrer:
|
|
4976
|
-
clientVersion:
|
|
4977
|
-
isInternal:
|
|
4978
|
-
});
|
|
4979
|
-
var SessionArrivalRecordSchema =
|
|
4980
|
-
trafficBucket:
|
|
4981
|
-
referrerHost:
|
|
4982
|
-
landingPath:
|
|
4983
|
-
utmSource:
|
|
4984
|
-
utmMedium:
|
|
4985
|
-
utmCampaign:
|
|
4986
|
-
utmContent:
|
|
4987
|
-
utmTerm:
|
|
4988
|
-
clickIdKind:
|
|
4989
|
-
});
|
|
4990
|
-
var SessionDetailSchema =
|
|
5360
|
+
timeZone: z48.string().max(64).optional(),
|
|
5361
|
+
referrer: z48.string().max(2048).optional(),
|
|
5362
|
+
clientVersion: z48.string().max(100).optional(),
|
|
5363
|
+
isInternal: z48.boolean().optional()
|
|
5364
|
+
});
|
|
5365
|
+
var SessionArrivalRecordSchema = z48.object({
|
|
5366
|
+
trafficBucket: z48.string().nullable(),
|
|
5367
|
+
referrerHost: z48.string().nullable(),
|
|
5368
|
+
landingPath: z48.string().nullable(),
|
|
5369
|
+
utmSource: z48.string().nullable(),
|
|
5370
|
+
utmMedium: z48.string().nullable(),
|
|
5371
|
+
utmCampaign: z48.string().nullable(),
|
|
5372
|
+
utmContent: z48.string().nullable(),
|
|
5373
|
+
utmTerm: z48.string().nullable(),
|
|
5374
|
+
clickIdKind: z48.string().nullable()
|
|
5375
|
+
});
|
|
5376
|
+
var SessionDetailSchema = z48.object({
|
|
4991
5377
|
session: SessionSummarySchema,
|
|
4992
5378
|
capture: SessionCaptureSchema,
|
|
4993
5379
|
/** Full verdict history, newest first. Verdicts are revisable, and a session
|
|
4994
5380
|
* re-judged after a fix is the evidence the fix worked. */
|
|
4995
|
-
reviews:
|
|
4996
|
-
bugs:
|
|
4997
|
-
comments:
|
|
5381
|
+
reviews: z48.array(SessionReviewEventSchema),
|
|
5382
|
+
bugs: z48.array(SessionBugSchema),
|
|
5383
|
+
comments: z48.array(SessionCommentSchema),
|
|
4998
5384
|
/** Optional during API/console rolling deployment. Absent is unavailable,
|
|
4999
5385
|
* not evidence of zero visitor activity. */
|
|
5000
5386
|
activity: SessionActivitySchema.optional(),
|
|
5001
5387
|
/** Optional during API/console rolling deployment: absent is unavailable. */
|
|
5002
5388
|
arrival: SessionArrivalRecordSchema.optional()
|
|
5003
5389
|
});
|
|
5004
|
-
var RecordVerdictInputSchema =
|
|
5390
|
+
var RecordVerdictInputSchema = z48.object({
|
|
5005
5391
|
verdict: RecordableVerdictSchema,
|
|
5006
|
-
note:
|
|
5392
|
+
note: z48.string().max(2e3).optional()
|
|
5007
5393
|
});
|
|
5008
|
-
var FileBugInputSchema =
|
|
5009
|
-
turnIndex:
|
|
5394
|
+
var FileBugInputSchema = z48.object({
|
|
5395
|
+
turnIndex: z48.number().int().positive().nullable(),
|
|
5010
5396
|
/** Optional — a bug filed without dropping a pin has no location. */
|
|
5011
5397
|
location: BugLocationSchema.nullable().optional(),
|
|
5012
|
-
title:
|
|
5013
|
-
body:
|
|
5398
|
+
title: z48.string().min(1).max(300),
|
|
5399
|
+
body: z48.string().min(1),
|
|
5014
5400
|
severity: BugSeveritySchema,
|
|
5015
|
-
payload:
|
|
5401
|
+
payload: z48.record(z48.unknown())
|
|
5016
5402
|
});
|
|
5017
5403
|
|
|
5018
5404
|
// ../spacestation/src/contracts/retrieval/ecommerce/option-values.ts
|
|
@@ -5196,7 +5582,7 @@ function stringifyForScoring(v) {
|
|
|
5196
5582
|
}
|
|
5197
5583
|
|
|
5198
5584
|
// ../spacestation/src/board/board.ts
|
|
5199
|
-
import { z as
|
|
5585
|
+
import { z as z49 } from "zod";
|
|
5200
5586
|
var BOARD_NAMESPACE = "board";
|
|
5201
5587
|
var BOARD_MAX_FACTS = 12;
|
|
5202
5588
|
var BOARD_MAX_ITEMS = 60;
|
|
@@ -5205,36 +5591,36 @@ var BOARD_VALUE_MAX = 80;
|
|
|
5205
5591
|
var BOARD_REF_MAX = 200;
|
|
5206
5592
|
var BOARD_TITLE_MAX = 80;
|
|
5207
5593
|
var BOARD_NAME_MAX = 40;
|
|
5208
|
-
var label =
|
|
5209
|
-
var value =
|
|
5210
|
-
var ref =
|
|
5211
|
-
var BoardFactSchema =
|
|
5212
|
-
var BoardItemSchema =
|
|
5213
|
-
var BoardMemberSchema =
|
|
5214
|
-
var BoardProjectionSchema =
|
|
5215
|
-
title:
|
|
5216
|
-
invite:
|
|
5217
|
-
facts:
|
|
5218
|
-
items:
|
|
5219
|
-
members:
|
|
5220
|
-
version:
|
|
5221
|
-
});
|
|
5222
|
-
var BoardStateSchema =
|
|
5223
|
-
|
|
5224
|
-
|
|
5594
|
+
var label = z49.string().trim().min(1).max(BOARD_LABEL_MAX);
|
|
5595
|
+
var value = z49.string().trim().min(1).max(BOARD_VALUE_MAX);
|
|
5596
|
+
var ref = z49.string().trim().min(1).max(BOARD_REF_MAX);
|
|
5597
|
+
var BoardFactSchema = z49.object({ label, value, by: z49.string().nullable(), mine: z49.boolean(), at: z49.number() });
|
|
5598
|
+
var BoardItemSchema = z49.object({ ref, by: z49.string().nullable(), mine: z49.boolean(), at: z49.number() });
|
|
5599
|
+
var BoardMemberSchema = z49.object({ name: z49.string().nullable(), owner: z49.boolean(), you: z49.boolean() });
|
|
5600
|
+
var BoardProjectionSchema = z49.object({
|
|
5601
|
+
title: z49.string(),
|
|
5602
|
+
invite: z49.string(),
|
|
5603
|
+
facts: z49.array(BoardFactSchema),
|
|
5604
|
+
items: z49.array(BoardItemSchema),
|
|
5605
|
+
members: z49.array(BoardMemberSchema),
|
|
5606
|
+
version: z49.number()
|
|
5607
|
+
});
|
|
5608
|
+
var BoardStateSchema = z49.union([
|
|
5609
|
+
z49.object({ joined: z49.literal(true), board: BoardProjectionSchema }),
|
|
5610
|
+
z49.object({ joined: z49.literal(false) })
|
|
5225
5611
|
]);
|
|
5226
|
-
var BoardEditSchema =
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
|
|
5612
|
+
var BoardEditSchema = z49.discriminatedUnion("op", [
|
|
5613
|
+
z49.object({ op: z49.literal("fact.set"), label, value }),
|
|
5614
|
+
z49.object({ op: z49.literal("fact.clear"), label }),
|
|
5615
|
+
z49.object({ op: z49.literal("item.add"), ref }),
|
|
5616
|
+
z49.object({ op: z49.literal("item.remove"), ref }),
|
|
5231
5617
|
/** What the member is called on the board: every entry they added, and the member list, show it. */
|
|
5232
|
-
|
|
5618
|
+
z49.object({ op: z49.literal("name.set"), name: z49.string().trim().min(1).max(BOARD_NAME_MAX) })
|
|
5233
5619
|
]);
|
|
5234
|
-
var BoardShareSchema =
|
|
5235
|
-
title:
|
|
5236
|
-
facts:
|
|
5237
|
-
items:
|
|
5620
|
+
var BoardShareSchema = z49.object({
|
|
5621
|
+
title: z49.string().trim().max(BOARD_TITLE_MAX),
|
|
5622
|
+
facts: z49.array(z49.object({ label, value })).max(BOARD_MAX_FACTS),
|
|
5623
|
+
items: z49.array(ref).max(BOARD_MAX_ITEMS)
|
|
5238
5624
|
});
|
|
5239
5625
|
function boardLabelKey(l) {
|
|
5240
5626
|
return l.trim().toLowerCase().replace(/\s+/g, " ");
|
|
@@ -5305,6 +5691,11 @@ function useComposerDraft() {
|
|
|
5305
5691
|
return [value2, setComposerDraft];
|
|
5306
5692
|
}
|
|
5307
5693
|
|
|
5694
|
+
// src/session/conversation-key.ts
|
|
5695
|
+
function conversationKeyOf(session) {
|
|
5696
|
+
return session.conversationId === void 0 ? session.sessionId : session.conversationId;
|
|
5697
|
+
}
|
|
5698
|
+
|
|
5308
5699
|
// src/session/use-action.ts
|
|
5309
5700
|
import { useCallback } from "react";
|
|
5310
5701
|
function useAction(label2, action) {
|
|
@@ -5388,6 +5779,7 @@ __export(src_exports2, {
|
|
|
5388
5779
|
cartLineMatchesSelections: () => cartLineMatchesSelections,
|
|
5389
5780
|
cartLinesForProduct: () => cartLinesForProduct,
|
|
5390
5781
|
clearBuyerSignIns: () => clearBuyerSignIns,
|
|
5782
|
+
clearCatalogProductLookups: () => clearCatalogProductLookups,
|
|
5391
5783
|
clearCatalogSearches: () => clearCatalogSearches,
|
|
5392
5784
|
clearCodeDiscountSources: () => clearCodeDiscountSources,
|
|
5393
5785
|
clearProductFieldReaders: () => clearProductFieldReaders,
|
|
@@ -5419,6 +5811,7 @@ __export(src_exports2, {
|
|
|
5419
5811
|
readProductFieldsConfig: () => readProductFieldsConfig,
|
|
5420
5812
|
readProductSectionsConfig: () => readProductSectionsConfig,
|
|
5421
5813
|
registerBuyerSignIn: () => registerBuyerSignIn,
|
|
5814
|
+
registerCatalogProductLookup: () => registerCatalogProductLookup,
|
|
5422
5815
|
registerCatalogSearch: () => registerCatalogSearch,
|
|
5423
5816
|
registerCodeDiscountSource: () => registerCodeDiscountSource,
|
|
5424
5817
|
registerProductFieldReader: () => registerProductFieldReader,
|
|
@@ -5430,6 +5823,7 @@ __export(src_exports2, {
|
|
|
5430
5823
|
registerStoreArticleLookup: () => registerStoreArticleLookup,
|
|
5431
5824
|
registerStoreThemeSource: () => registerStoreThemeSource,
|
|
5432
5825
|
resolveBuyerSignIn: () => resolveBuyerSignIn,
|
|
5826
|
+
resolveCatalogProductLookup: () => resolveCatalogProductLookup,
|
|
5433
5827
|
resolveCatalogSearch: () => resolveCatalogSearch,
|
|
5434
5828
|
resolveCodeDiscountSource: () => resolveCodeDiscountSource,
|
|
5435
5829
|
resolveProductFieldReader: () => resolveProductFieldReader,
|
|
@@ -5446,60 +5840,60 @@ __export(src_exports2, {
|
|
|
5446
5840
|
});
|
|
5447
5841
|
|
|
5448
5842
|
// ../ecommerce/src/commerce-schemas.ts
|
|
5449
|
-
import { z as
|
|
5450
|
-
var MoneySchema =
|
|
5451
|
-
amount:
|
|
5452
|
-
currencyCode:
|
|
5453
|
-
});
|
|
5454
|
-
var ImageSchema =
|
|
5455
|
-
url:
|
|
5456
|
-
altText:
|
|
5457
|
-
width:
|
|
5458
|
-
height:
|
|
5843
|
+
import { z as z50 } from "zod";
|
|
5844
|
+
var MoneySchema = z50.object({
|
|
5845
|
+
amount: z50.number(),
|
|
5846
|
+
currencyCode: z50.string()
|
|
5847
|
+
});
|
|
5848
|
+
var ImageSchema = z50.object({
|
|
5849
|
+
url: z50.string(),
|
|
5850
|
+
altText: z50.string(),
|
|
5851
|
+
width: z50.number().optional(),
|
|
5852
|
+
height: z50.number().optional(),
|
|
5459
5853
|
/** Responsive candidate set, resolved at the commerce-adapter boundary —
|
|
5460
5854
|
* never computed in a component. Renderers use it as `<img srcSet>` paired
|
|
5461
5855
|
* with a layout `sizes`. Absent for non-CDN / unsizable images. */
|
|
5462
|
-
srcSet:
|
|
5856
|
+
srcSet: z50.string().optional()
|
|
5463
5857
|
});
|
|
5464
|
-
var AssetSchema =
|
|
5858
|
+
var AssetSchema = z50.object({
|
|
5465
5859
|
/** Opaque asset id — the `resolved()` ref the agent emitted. */
|
|
5466
|
-
id:
|
|
5467
|
-
url:
|
|
5468
|
-
altText:
|
|
5469
|
-
srcSet:
|
|
5470
|
-
});
|
|
5471
|
-
var SelectedOptionSchema =
|
|
5472
|
-
name:
|
|
5473
|
-
value:
|
|
5474
|
-
});
|
|
5475
|
-
var VideoSourceSchema =
|
|
5476
|
-
url:
|
|
5477
|
-
mimeType:
|
|
5478
|
-
width:
|
|
5479
|
-
height:
|
|
5480
|
-
});
|
|
5481
|
-
var ProductVideoSchema =
|
|
5482
|
-
kind:
|
|
5860
|
+
id: z50.string(),
|
|
5861
|
+
url: z50.string(),
|
|
5862
|
+
altText: z50.string(),
|
|
5863
|
+
srcSet: z50.string().optional()
|
|
5864
|
+
});
|
|
5865
|
+
var SelectedOptionSchema = z50.object({
|
|
5866
|
+
name: z50.string(),
|
|
5867
|
+
value: z50.string()
|
|
5868
|
+
});
|
|
5869
|
+
var VideoSourceSchema = z50.object({
|
|
5870
|
+
url: z50.string(),
|
|
5871
|
+
mimeType: z50.string(),
|
|
5872
|
+
width: z50.number().optional(),
|
|
5873
|
+
height: z50.number().optional()
|
|
5874
|
+
});
|
|
5875
|
+
var ProductVideoSchema = z50.object({
|
|
5876
|
+
kind: z50.enum(["hosted", "external"]),
|
|
5483
5877
|
previewImage: ImageSchema.optional(),
|
|
5484
|
-
altText:
|
|
5878
|
+
altText: z50.string().default(""),
|
|
5485
5879
|
/** `kind: 'hosted'` only — empty for external embeds. */
|
|
5486
|
-
sources:
|
|
5880
|
+
sources: z50.array(VideoSourceSchema).default([]),
|
|
5487
5881
|
/** `kind: 'external'` only — iframe embed URL. */
|
|
5488
|
-
embedUrl:
|
|
5882
|
+
embedUrl: z50.string().optional(),
|
|
5489
5883
|
/** `kind: 'external'` only — e.g. `YOUTUBE` | `VIMEO`. */
|
|
5490
|
-
host:
|
|
5884
|
+
host: z50.string().optional()
|
|
5491
5885
|
});
|
|
5492
|
-
var AvailabilityStatusSchema =
|
|
5886
|
+
var AvailabilityStatusSchema = z50.enum([
|
|
5493
5887
|
"in_stock",
|
|
5494
5888
|
"backorder",
|
|
5495
5889
|
"preorder",
|
|
5496
5890
|
"out_of_stock",
|
|
5497
5891
|
"discontinued"
|
|
5498
5892
|
]);
|
|
5499
|
-
var ProductVariantSchema =
|
|
5500
|
-
id:
|
|
5501
|
-
title:
|
|
5502
|
-
available:
|
|
5893
|
+
var ProductVariantSchema = z50.object({
|
|
5894
|
+
id: z50.string(),
|
|
5895
|
+
title: z50.string(),
|
|
5896
|
+
available: z50.boolean(),
|
|
5503
5897
|
/**
|
|
5504
5898
|
* Qualifies `available` with the fulfillment state behind it. Absent means
|
|
5505
5899
|
* the backend did not say — which is NOT the same as in stock, and must not
|
|
@@ -5514,10 +5908,10 @@ var ProductVariantSchema = z46.object({
|
|
|
5514
5908
|
availabilityStatus: AvailabilityStatusSchema.optional(),
|
|
5515
5909
|
price: MoneySchema,
|
|
5516
5910
|
compareAtPrice: MoneySchema.optional(),
|
|
5517
|
-
selectedOptions:
|
|
5911
|
+
selectedOptions: z50.array(SelectedOptionSchema).optional(),
|
|
5518
5912
|
image: ImageSchema.optional(),
|
|
5519
5913
|
/** The merchant's stock-keeping code. Absent when the backend has none. */
|
|
5520
|
-
sku:
|
|
5914
|
+
sku: z50.string().optional()
|
|
5521
5915
|
});
|
|
5522
5916
|
var MP4_MIME = "video/mp4";
|
|
5523
5917
|
var HLS_MIME = "application/x-mpegURL";
|
|
@@ -5527,34 +5921,34 @@ function orderedVideoSources(video) {
|
|
|
5527
5921
|
const hls = video.sources.filter((s) => s.mimeType === HLS_MIME);
|
|
5528
5922
|
return [...mp4, ...hls];
|
|
5529
5923
|
}
|
|
5530
|
-
var SiblingProductSchema =
|
|
5531
|
-
id:
|
|
5532
|
-
handle:
|
|
5533
|
-
title:
|
|
5924
|
+
var SiblingProductSchema = z50.object({
|
|
5925
|
+
id: z50.string(),
|
|
5926
|
+
handle: z50.string(),
|
|
5927
|
+
title: z50.string(),
|
|
5534
5928
|
/** The differentiating value across siblings — typically the color
|
|
5535
5929
|
* label ("OLIVE", "STONE"). Rendered next to the swatch row. */
|
|
5536
|
-
color:
|
|
5930
|
+
color: z50.string(),
|
|
5537
5931
|
/** Swatch artwork. Hydrators populate from the sibling product's
|
|
5538
5932
|
* first image; renderers crop / fit to the swatch tile. */
|
|
5539
5933
|
swatchImage: ImageSchema.optional(),
|
|
5540
|
-
available:
|
|
5934
|
+
available: z50.boolean().default(true),
|
|
5541
5935
|
/** Marks the sibling that IS the currently-rendered product. The
|
|
5542
5936
|
* picker uses this to highlight the active swatch without an
|
|
5543
5937
|
* external id comparison. */
|
|
5544
|
-
current:
|
|
5545
|
-
});
|
|
5546
|
-
var ProductSchema =
|
|
5547
|
-
id:
|
|
5548
|
-
handle:
|
|
5549
|
-
title:
|
|
5550
|
-
description:
|
|
5551
|
-
descriptionHtml:
|
|
5552
|
-
vendor:
|
|
5553
|
-
productType:
|
|
5554
|
-
tags:
|
|
5938
|
+
current: z50.boolean().default(false)
|
|
5939
|
+
});
|
|
5940
|
+
var ProductSchema = z50.object({
|
|
5941
|
+
id: z50.string(),
|
|
5942
|
+
handle: z50.string().default(""),
|
|
5943
|
+
title: z50.string(),
|
|
5944
|
+
description: z50.string().default(""),
|
|
5945
|
+
descriptionHtml: z50.string().optional(),
|
|
5946
|
+
vendor: z50.string().default(""),
|
|
5947
|
+
productType: z50.string().optional(),
|
|
5948
|
+
tags: z50.array(z50.string()).default([]),
|
|
5555
5949
|
price: MoneySchema.default({ amount: 0, currencyCode: "USD" }),
|
|
5556
5950
|
compareAtPrice: MoneySchema.optional(),
|
|
5557
|
-
images:
|
|
5951
|
+
images: z50.array(ImageSchema).default([]),
|
|
5558
5952
|
/**
|
|
5559
5953
|
* Product videos (`Video` + `ExternalVideo` media). Shopify's MCP
|
|
5560
5954
|
* catalog drops video media — it only surfaces through the Storefront
|
|
@@ -5562,21 +5956,21 @@ var ProductSchema = z46.object({
|
|
|
5562
5956
|
* boundary. Default `[]` so renderers gate on `length > 0` without a
|
|
5563
5957
|
* presence guard.
|
|
5564
5958
|
*/
|
|
5565
|
-
videos:
|
|
5566
|
-
variants:
|
|
5567
|
-
availableForSale:
|
|
5568
|
-
options:
|
|
5569
|
-
name:
|
|
5570
|
-
values:
|
|
5959
|
+
videos: z50.array(ProductVideoSchema).default([]),
|
|
5960
|
+
variants: z50.array(ProductVariantSchema).default([]),
|
|
5961
|
+
availableForSale: z50.boolean().default(true),
|
|
5962
|
+
options: z50.array(z50.object({
|
|
5963
|
+
name: z50.string(),
|
|
5964
|
+
values: z50.array(z50.string())
|
|
5571
5965
|
})).optional(),
|
|
5572
|
-
collections:
|
|
5966
|
+
collections: z50.array(z50.string()).optional(),
|
|
5573
5967
|
/** See `SiblingProductSchema`. Default `[]` so renderers can check
|
|
5574
5968
|
* `length > 1` to decide whether to draw the swatch row without a
|
|
5575
5969
|
* presence guard. */
|
|
5576
|
-
colorVariants:
|
|
5577
|
-
rating:
|
|
5578
|
-
value:
|
|
5579
|
-
count:
|
|
5970
|
+
colorVariants: z50.array(SiblingProductSchema).default([]),
|
|
5971
|
+
rating: z50.object({
|
|
5972
|
+
value: z50.number(),
|
|
5973
|
+
count: z50.number()
|
|
5580
5974
|
}).optional(),
|
|
5581
5975
|
/**
|
|
5582
5976
|
* Product reviews surfaced from the brand's review store. SDK
|
|
@@ -5585,12 +5979,12 @@ var ProductSchema = z46.object({
|
|
|
5585
5979
|
* review bodies. Renderers (`Reviews` component, `ProductDetail`,
|
|
5586
5980
|
* etc.) consume directly.
|
|
5587
5981
|
*/
|
|
5588
|
-
reviews:
|
|
5589
|
-
author:
|
|
5590
|
-
rating:
|
|
5591
|
-
content:
|
|
5592
|
-
date:
|
|
5593
|
-
verified:
|
|
5982
|
+
reviews: z50.array(z50.object({
|
|
5983
|
+
author: z50.string(),
|
|
5984
|
+
rating: z50.number(),
|
|
5985
|
+
content: z50.string(),
|
|
5986
|
+
date: z50.string(),
|
|
5987
|
+
verified: z50.boolean().optional()
|
|
5594
5988
|
})).optional(),
|
|
5595
5989
|
/**
|
|
5596
5990
|
* Ghost-entity flag — `true` when the Storefront API could not hydrate
|
|
@@ -5602,23 +5996,23 @@ var ProductSchema = z46.object({
|
|
|
5602
5996
|
* Set exclusively by `createUnavailableProduct()` — never by the
|
|
5603
5997
|
* Storefront mapper.
|
|
5604
5998
|
*/
|
|
5605
|
-
unavailable:
|
|
5999
|
+
unavailable: z50.boolean().default(false),
|
|
5606
6000
|
/**
|
|
5607
6001
|
* Who sells it, as a marketplace or cross-store catalog names them: the store's name, its own storefront, and its
|
|
5608
6002
|
* policies (returns, shipping, privacy, terms), each a link. Absent for a single store's own products — the space IS
|
|
5609
6003
|
* the seller there.
|
|
5610
6004
|
*/
|
|
5611
|
-
seller:
|
|
5612
|
-
name:
|
|
5613
|
-
url:
|
|
5614
|
-
policies:
|
|
6005
|
+
seller: z50.object({
|
|
6006
|
+
name: z50.string(),
|
|
6007
|
+
url: z50.string().optional(),
|
|
6008
|
+
policies: z50.array(z50.object({ kind: z50.string(), url: z50.string() })).default([])
|
|
5615
6009
|
}).optional(),
|
|
5616
6010
|
/** What the product is known for, in the seller's or catalog's own words (top features, selling points). */
|
|
5617
|
-
highlights:
|
|
6011
|
+
highlights: z50.array(z50.string()).optional(),
|
|
5618
6012
|
/** Its specifications, one line each. */
|
|
5619
|
-
specs:
|
|
6013
|
+
specs: z50.array(z50.string()).optional(),
|
|
5620
6014
|
/** The product's own page on the seller's site. */
|
|
5621
|
-
productUrl:
|
|
6015
|
+
productUrl: z50.string().optional()
|
|
5622
6016
|
});
|
|
5623
6017
|
function createUnavailableProduct(gid) {
|
|
5624
6018
|
return {
|
|
@@ -5640,68 +6034,68 @@ function createUnavailableProduct(gid) {
|
|
|
5640
6034
|
function isGhostEntity(value2) {
|
|
5641
6035
|
return typeof value2 === "object" && value2 !== null && "unavailable" in value2 && value2.unavailable === true;
|
|
5642
6036
|
}
|
|
5643
|
-
var ReviewSchema =
|
|
5644
|
-
id:
|
|
5645
|
-
productId:
|
|
5646
|
-
author:
|
|
5647
|
-
rating:
|
|
5648
|
-
text:
|
|
5649
|
-
date:
|
|
5650
|
-
verified:
|
|
5651
|
-
});
|
|
5652
|
-
var ArticleSchema =
|
|
5653
|
-
id:
|
|
5654
|
-
handle:
|
|
5655
|
-
title:
|
|
5656
|
-
excerpt:
|
|
5657
|
-
content:
|
|
5658
|
-
contentHtml:
|
|
5659
|
-
author:
|
|
5660
|
-
publishedAt:
|
|
6037
|
+
var ReviewSchema = z50.object({
|
|
6038
|
+
id: z50.string(),
|
|
6039
|
+
productId: z50.string(),
|
|
6040
|
+
author: z50.string(),
|
|
6041
|
+
rating: z50.number(),
|
|
6042
|
+
text: z50.string(),
|
|
6043
|
+
date: z50.string(),
|
|
6044
|
+
verified: z50.boolean()
|
|
6045
|
+
});
|
|
6046
|
+
var ArticleSchema = z50.object({
|
|
6047
|
+
id: z50.string(),
|
|
6048
|
+
handle: z50.string().default(""),
|
|
6049
|
+
title: z50.string(),
|
|
6050
|
+
excerpt: z50.string().default(""),
|
|
6051
|
+
content: z50.string().default(""),
|
|
6052
|
+
contentHtml: z50.string().optional(),
|
|
6053
|
+
author: z50.string().default(""),
|
|
6054
|
+
publishedAt: z50.string().default(""),
|
|
5661
6055
|
image: ImageSchema.optional(),
|
|
5662
|
-
blogHandle:
|
|
5663
|
-
tags:
|
|
5664
|
-
});
|
|
5665
|
-
var CmsPageSchema =
|
|
5666
|
-
id:
|
|
5667
|
-
handle:
|
|
5668
|
-
title:
|
|
5669
|
-
body:
|
|
5670
|
-
bodyHtml:
|
|
5671
|
-
bodySummary:
|
|
5672
|
-
updatedAt:
|
|
5673
|
-
seoTitle:
|
|
5674
|
-
seoDescription:
|
|
5675
|
-
});
|
|
5676
|
-
var CmsPolicySchema =
|
|
5677
|
-
id:
|
|
6056
|
+
blogHandle: z50.string().default(""),
|
|
6057
|
+
tags: z50.array(z50.string()).default([])
|
|
6058
|
+
});
|
|
6059
|
+
var CmsPageSchema = z50.object({
|
|
6060
|
+
id: z50.string(),
|
|
6061
|
+
handle: z50.string().default(""),
|
|
6062
|
+
title: z50.string(),
|
|
6063
|
+
body: z50.string().default(""),
|
|
6064
|
+
bodyHtml: z50.string().optional(),
|
|
6065
|
+
bodySummary: z50.string().default(""),
|
|
6066
|
+
updatedAt: z50.string().default(""),
|
|
6067
|
+
seoTitle: z50.string().optional(),
|
|
6068
|
+
seoDescription: z50.string().optional()
|
|
6069
|
+
});
|
|
6070
|
+
var CmsPolicySchema = z50.object({
|
|
6071
|
+
id: z50.string(),
|
|
5678
6072
|
/** Stable policy slot identifier: 'refund' | 'privacy' | 'terms' |
|
|
5679
6073
|
* 'shipping' | 'subscription' | 'warranty' | custom string. Open so
|
|
5680
6074
|
* platforms with custom policy types can extend. */
|
|
5681
|
-
kind:
|
|
6075
|
+
kind: z50.string(),
|
|
5682
6076
|
/** Slug-shaped handle the platform exposes for storefront URLs
|
|
5683
6077
|
* (e.g. `refund-policy`). Empty string when the backend doesn't
|
|
5684
6078
|
* surface one. */
|
|
5685
|
-
handle:
|
|
5686
|
-
title:
|
|
5687
|
-
body:
|
|
5688
|
-
bodyHtml:
|
|
5689
|
-
url:
|
|
5690
|
-
});
|
|
5691
|
-
var CollectionSchema =
|
|
5692
|
-
id:
|
|
5693
|
-
handle:
|
|
5694
|
-
title:
|
|
5695
|
-
description:
|
|
6079
|
+
handle: z50.string().default(""),
|
|
6080
|
+
title: z50.string(),
|
|
6081
|
+
body: z50.string().default(""),
|
|
6082
|
+
bodyHtml: z50.string().optional(),
|
|
6083
|
+
url: z50.string().default("")
|
|
6084
|
+
});
|
|
6085
|
+
var CollectionSchema = z50.object({
|
|
6086
|
+
id: z50.string(),
|
|
6087
|
+
handle: z50.string().default(""),
|
|
6088
|
+
title: z50.string(),
|
|
6089
|
+
description: z50.string().default(""),
|
|
5696
6090
|
image: ImageSchema.optional(),
|
|
5697
|
-
productCount:
|
|
5698
|
-
});
|
|
5699
|
-
var CartLineSchema =
|
|
5700
|
-
id:
|
|
5701
|
-
merchandiseId:
|
|
5702
|
-
productId:
|
|
5703
|
-
title:
|
|
5704
|
-
variantTitle:
|
|
6091
|
+
productCount: z50.number().int().nonnegative().optional()
|
|
6092
|
+
});
|
|
6093
|
+
var CartLineSchema = z50.object({
|
|
6094
|
+
id: z50.string(),
|
|
6095
|
+
merchandiseId: z50.string(),
|
|
6096
|
+
productId: z50.string(),
|
|
6097
|
+
title: z50.string(),
|
|
6098
|
+
variantTitle: z50.string().optional(),
|
|
5705
6099
|
/**
|
|
5706
6100
|
* The variant's option axes as structured pairs (e.g.
|
|
5707
6101
|
* `[{name:'Size', value:'7'}]`). The machine-readable counterpart of
|
|
@@ -5710,10 +6104,10 @@ var CartLineSchema = z46.object({
|
|
|
5710
6104
|
* single-variant products (the degenerate `Title: Default Title` axis
|
|
5711
6105
|
* is normalized away at the adapter boundary).
|
|
5712
6106
|
*/
|
|
5713
|
-
selectedOptions:
|
|
5714
|
-
vendor:
|
|
5715
|
-
sku:
|
|
5716
|
-
quantity:
|
|
6107
|
+
selectedOptions: z50.array(SelectedOptionSchema).optional(),
|
|
6108
|
+
vendor: z50.string().optional(),
|
|
6109
|
+
sku: z50.string().optional(),
|
|
6110
|
+
quantity: z50.number().int().positive(),
|
|
5717
6111
|
unitPrice: MoneySchema,
|
|
5718
6112
|
totalPrice: MoneySchema,
|
|
5719
6113
|
image: ImageSchema.optional(),
|
|
@@ -5733,32 +6127,32 @@ var CartLineSchema = z46.object({
|
|
|
5733
6127
|
* client-minted id the backend rejects, line-tap navigation is
|
|
5734
6128
|
* suppressed, and the money never folds into a settled-looking total.
|
|
5735
6129
|
*/
|
|
5736
|
-
pending:
|
|
6130
|
+
pending: z50.boolean().optional(),
|
|
5737
6131
|
/**
|
|
5738
6132
|
* The line's custom attributes (Shopify line item properties), as the
|
|
5739
6133
|
* backend holds them — how a surface tells whether a line carries a tag such
|
|
5740
6134
|
* as `_checkbox_discount`. Absent when the line has none.
|
|
5741
6135
|
*/
|
|
5742
|
-
attributes:
|
|
6136
|
+
attributes: z50.array(CartLineAttributeSchema).optional()
|
|
5743
6137
|
});
|
|
5744
6138
|
function isPendingCartLine(line) {
|
|
5745
6139
|
return line.pending === true;
|
|
5746
6140
|
}
|
|
5747
|
-
var CartDiscountCodeSchema =
|
|
5748
|
-
code:
|
|
5749
|
-
applicable:
|
|
6141
|
+
var CartDiscountCodeSchema = z50.object({
|
|
6142
|
+
code: z50.string(),
|
|
6143
|
+
applicable: z50.boolean()
|
|
5750
6144
|
});
|
|
5751
|
-
var CartMessageSchema =
|
|
5752
|
-
kind:
|
|
6145
|
+
var CartMessageSchema = z50.object({
|
|
6146
|
+
kind: z50.enum(["error", "warning", "info"]),
|
|
5753
6147
|
/** Machine code for branching; opaque and backend-defined. */
|
|
5754
|
-
code:
|
|
6148
|
+
code: z50.string(),
|
|
5755
6149
|
/** Human-readable text, meant to be shown as-is. */
|
|
5756
|
-
content:
|
|
6150
|
+
content: z50.string()
|
|
5757
6151
|
});
|
|
5758
|
-
var CartSchema =
|
|
5759
|
-
id:
|
|
5760
|
-
lines:
|
|
5761
|
-
totalQuantity:
|
|
6152
|
+
var CartSchema = z50.object({
|
|
6153
|
+
id: z50.string(),
|
|
6154
|
+
lines: z50.array(CartLineSchema),
|
|
6155
|
+
totalQuantity: z50.number().int().nonnegative(),
|
|
5762
6156
|
subtotal: MoneySchema,
|
|
5763
6157
|
/**
|
|
5764
6158
|
* Cart total after discounts (pre-shipping/tax). Absent when the
|
|
@@ -5768,11 +6162,11 @@ var CartSchema = z46.object({
|
|
|
5768
6162
|
*/
|
|
5769
6163
|
total: MoneySchema.optional(),
|
|
5770
6164
|
/** Discount codes currently attached to the cart. */
|
|
5771
|
-
discountCodes:
|
|
6165
|
+
discountCodes: z50.array(CartDiscountCodeSchema).default([]),
|
|
5772
6166
|
/** Notices the backend attached to this cart — see `CartMessageSchema`.
|
|
5773
6167
|
* Empty when the backend said nothing or does not report them. */
|
|
5774
|
-
messages:
|
|
5775
|
-
checkoutUrl:
|
|
6168
|
+
messages: z50.array(CartMessageSchema).default([]),
|
|
6169
|
+
checkoutUrl: z50.string().optional(),
|
|
5776
6170
|
/**
|
|
5777
6171
|
* Opaque handle this cart is known by in the connector's BACK OFFICE — the
|
|
5778
6172
|
* value a space owner searches there to find the order this cart became.
|
|
@@ -5785,14 +6179,14 @@ var CartSchema = z46.object({
|
|
|
5785
6179
|
* Absent when the platform has no such handle, or while the cart is still the
|
|
5786
6180
|
* client's optimistic paint and its id is client-minted.
|
|
5787
6181
|
*/
|
|
5788
|
-
backOfficeRef:
|
|
6182
|
+
backOfficeRef: z50.string().optional(),
|
|
5789
6183
|
/**
|
|
5790
6184
|
* URL that recreates this cart on the merchant's own store website
|
|
5791
6185
|
* (replace semantics — overwrites any cart the visitor already has
|
|
5792
6186
|
* there). Populated by platform adapters that support it; absent when
|
|
5793
6187
|
* the cart is empty or the URL cannot be built.
|
|
5794
6188
|
*/
|
|
5795
|
-
storeCartUrl:
|
|
6189
|
+
storeCartUrl: z50.string().optional(),
|
|
5796
6190
|
/**
|
|
5797
6191
|
* True while this cart exists only in the client's optimistic paint —
|
|
5798
6192
|
* no backend cart has been created yet, so its `id` is client-minted and
|
|
@@ -5800,19 +6194,19 @@ var CartSchema = z46.object({
|
|
|
5800
6194
|
* `CartLineSchema.pending`: the adapter never sets it, and callers that
|
|
5801
6195
|
* need a real cart id read THIS rather than sniffing the id's shape.
|
|
5802
6196
|
*/
|
|
5803
|
-
pending:
|
|
6197
|
+
pending: z50.boolean().optional()
|
|
5804
6198
|
});
|
|
5805
|
-
var StoreCheckoutSchema =
|
|
5806
|
-
|
|
5807
|
-
|
|
6199
|
+
var StoreCheckoutSchema = z50.union([
|
|
6200
|
+
z50.object({ status: z50.literal("ready"), seller: z50.string(), lineIds: z50.array(z50.string()), checkoutUrl: z50.string() }),
|
|
6201
|
+
z50.object({ status: z50.literal("failed"), seller: z50.string(), lineIds: z50.array(z50.string()), reason: z50.string() })
|
|
5808
6202
|
]);
|
|
5809
|
-
var ShopCheckoutResultSchema =
|
|
5810
|
-
|
|
5811
|
-
|
|
6203
|
+
var ShopCheckoutResultSchema = z50.union([
|
|
6204
|
+
z50.object({ status: z50.literal("combined"), continueUrl: z50.string(), stores: z50.array(StoreCheckoutSchema) }),
|
|
6205
|
+
z50.object({ status: z50.literal("separate"), reason: z50.string(), stores: z50.array(StoreCheckoutSchema) })
|
|
5812
6206
|
]);
|
|
5813
|
-
var ShopCheckoutAnswerSchema =
|
|
5814
|
-
|
|
5815
|
-
|
|
6207
|
+
var ShopCheckoutAnswerSchema = z50.union([
|
|
6208
|
+
z50.object({ available: z50.literal(false) }),
|
|
6209
|
+
z50.object({ available: z50.literal(true), result: ShopCheckoutResultSchema })
|
|
5816
6210
|
]);
|
|
5817
6211
|
function settledCart(cart) {
|
|
5818
6212
|
if (cart === null || cart === void 0) return null;
|
|
@@ -5820,27 +6214,27 @@ function settledCart(cart) {
|
|
|
5820
6214
|
}
|
|
5821
6215
|
|
|
5822
6216
|
// ../ecommerce/src/review-schemas.ts
|
|
5823
|
-
import { z as
|
|
6217
|
+
import { z as z51 } from "zod";
|
|
5824
6218
|
var PRODUCT_REVIEWS_RESOLVER_KEY = "productReviews";
|
|
5825
|
-
var ProductReviewItemSchema =
|
|
5826
|
-
author:
|
|
5827
|
-
rating:
|
|
6219
|
+
var ProductReviewItemSchema = z51.object({
|
|
6220
|
+
author: z51.string(),
|
|
6221
|
+
rating: z51.number(),
|
|
5828
6222
|
/** The reviewer's own headline ("love"), when they wrote one — the site shows it above `content`. */
|
|
5829
|
-
title:
|
|
5830
|
-
content:
|
|
5831
|
-
date:
|
|
5832
|
-
verified:
|
|
6223
|
+
title: z51.string().optional(),
|
|
6224
|
+
content: z51.string(),
|
|
6225
|
+
date: z51.string(),
|
|
6226
|
+
verified: z51.boolean().optional(),
|
|
5833
6227
|
/**
|
|
5834
6228
|
* Non-empty when the review was written for a grouped SIBLING product rather
|
|
5835
6229
|
* than this one (brands pool reviews across a product line). A surface can
|
|
5836
6230
|
* attribute it; empty / absent ⇒ the product's own review.
|
|
5837
6231
|
*/
|
|
5838
|
-
writtenFor:
|
|
6232
|
+
writtenFor: z51.string().optional()
|
|
5839
6233
|
});
|
|
5840
6234
|
var ProductReviewHighlightSchema = ProductReviewItemSchema.extend({
|
|
5841
6235
|
/** The sentence(s) the ranking fired on. Descriptive — it is what the matcher
|
|
5842
6236
|
* scored, NOT necessarily text that occurs in `content`. */
|
|
5843
|
-
highlight:
|
|
6237
|
+
highlight: z51.string().optional(),
|
|
5844
6238
|
/**
|
|
5845
6239
|
* `highlight` resolved back into `content` as a VERBATIM substring, so a
|
|
5846
6240
|
* surface can mark it with a plain `indexOf` and no matcher of its own.
|
|
@@ -5855,29 +6249,29 @@ var ProductReviewHighlightSchema = ProductReviewItemSchema.extend({
|
|
|
5855
6249
|
* Absent when the passage genuinely has no home in the body (one cut from the
|
|
5856
6250
|
* title). A surface then marks NOTHING rather than guessing at a span.
|
|
5857
6251
|
*/
|
|
5858
|
-
mark:
|
|
6252
|
+
mark: z51.string().optional()
|
|
5859
6253
|
});
|
|
5860
|
-
var ReviewAggregateSchema =
|
|
5861
|
-
value:
|
|
5862
|
-
count:
|
|
6254
|
+
var ReviewAggregateSchema = z51.object({
|
|
6255
|
+
value: z51.number(),
|
|
6256
|
+
count: z51.number()
|
|
5863
6257
|
});
|
|
5864
|
-
var ProductReviewDataSchema =
|
|
5865
|
-
id:
|
|
6258
|
+
var ProductReviewDataSchema = z51.object({
|
|
6259
|
+
id: z51.string(),
|
|
5866
6260
|
/** The product's FULL retrieved set — what a filterable list renders. */
|
|
5867
|
-
reviews:
|
|
6261
|
+
reviews: z51.array(ProductReviewItemSchema).default([]),
|
|
5868
6262
|
aggregate: ReviewAggregateSchema.default({ value: 0, count: 0 }),
|
|
5869
6263
|
/** 5★→1★ star COUNTS over the full set (index 0 = 5-star). */
|
|
5870
|
-
distribution:
|
|
6264
|
+
distribution: z51.array(z51.number()).default([]),
|
|
5871
6265
|
/**
|
|
5872
6266
|
* The reviews that ANSWER the surface's intent, best first. Empty when no
|
|
5873
6267
|
* intent was asked for — never a silent copy of `reviews`.
|
|
5874
6268
|
*/
|
|
5875
|
-
highlights:
|
|
6269
|
+
highlights: z51.array(ProductReviewHighlightSchema).default([]),
|
|
5876
6270
|
/**
|
|
5877
6271
|
* True when the review provider could not be read and nothing is indexed —
|
|
5878
6272
|
* the empty lists mean "not loaded", NOT "this product has no reviews".
|
|
5879
6273
|
*/
|
|
5880
|
-
unavailable:
|
|
6274
|
+
unavailable: z51.boolean().optional()
|
|
5881
6275
|
});
|
|
5882
6276
|
var ProductReviewPayloadSchema = ProductReviewDataSchema.omit({ id: true });
|
|
5883
6277
|
|
|
@@ -6171,9 +6565,9 @@ function readPdpCompanions(config) {
|
|
|
6171
6565
|
}
|
|
6172
6566
|
|
|
6173
6567
|
// ../ecommerce/src/base-attributes.ts
|
|
6174
|
-
import { z as
|
|
6568
|
+
import { z as z52 } from "zod";
|
|
6175
6569
|
var BASE_ATTRIBUTES_CONFIG_KEY = "baseAttributes";
|
|
6176
|
-
var BaseAttributesRecordSchema =
|
|
6570
|
+
var BaseAttributesRecordSchema = z52.record(z52.string(), AttributeDefSchema);
|
|
6177
6571
|
function buildBaseAttributesConfig(attributes) {
|
|
6178
6572
|
return { [BASE_ATTRIBUTES_CONFIG_KEY]: attributes };
|
|
6179
6573
|
}
|
|
@@ -6184,9 +6578,9 @@ function readBaseAttributesConfig(config) {
|
|
|
6184
6578
|
}
|
|
6185
6579
|
|
|
6186
6580
|
// ../ecommerce/src/bucket-labels.ts
|
|
6187
|
-
import { z as
|
|
6581
|
+
import { z as z53 } from "zod";
|
|
6188
6582
|
var BUCKET_LABELS_CONFIG_KEY = "bucketLabels";
|
|
6189
|
-
var BucketLabelsRecordSchema =
|
|
6583
|
+
var BucketLabelsRecordSchema = z53.record(z53.string(), z53.string());
|
|
6190
6584
|
function buildBucketLabelsConfig(labels) {
|
|
6191
6585
|
return { [BUCKET_LABELS_CONFIG_KEY]: labels };
|
|
6192
6586
|
}
|
|
@@ -6344,52 +6738,68 @@ function clearCatalogSearches() {
|
|
|
6344
6738
|
factories6.length = 0;
|
|
6345
6739
|
}
|
|
6346
6740
|
|
|
6347
|
-
// ../ecommerce/src/
|
|
6741
|
+
// ../ecommerce/src/catalog-product-lookup.ts
|
|
6348
6742
|
var factories7 = [];
|
|
6349
|
-
function
|
|
6743
|
+
function registerCatalogProductLookup(factory) {
|
|
6350
6744
|
factories7.push(factory);
|
|
6351
6745
|
}
|
|
6352
|
-
function
|
|
6746
|
+
function resolveCatalogProductLookup(platformConfig) {
|
|
6353
6747
|
for (const factory of factories7) {
|
|
6748
|
+
const lookup = factory(platformConfig);
|
|
6749
|
+
if (lookup !== void 0) return lookup;
|
|
6750
|
+
}
|
|
6751
|
+
return void 0;
|
|
6752
|
+
}
|
|
6753
|
+
function clearCatalogProductLookups() {
|
|
6754
|
+
factories7.length = 0;
|
|
6755
|
+
}
|
|
6756
|
+
|
|
6757
|
+
// ../ecommerce/src/shop-checkout.ts
|
|
6758
|
+
var factories8 = [];
|
|
6759
|
+
function registerShopCheckout(factory) {
|
|
6760
|
+
factories8.push(factory);
|
|
6761
|
+
}
|
|
6762
|
+
function resolveShopCheckout(platformConfig) {
|
|
6763
|
+
for (const factory of factories8) {
|
|
6354
6764
|
const maker = factory(platformConfig);
|
|
6355
6765
|
if (maker !== void 0) return maker;
|
|
6356
6766
|
}
|
|
6357
6767
|
return void 0;
|
|
6358
6768
|
}
|
|
6359
6769
|
function clearShopCheckouts() {
|
|
6360
|
-
|
|
6770
|
+
factories8.length = 0;
|
|
6361
6771
|
}
|
|
6362
6772
|
|
|
6363
6773
|
// ../ecommerce/src/buyer-sign-in.ts
|
|
6364
|
-
var
|
|
6774
|
+
var factories9 = [];
|
|
6365
6775
|
function registerBuyerSignIn(factory) {
|
|
6366
|
-
|
|
6776
|
+
factories9.push(factory);
|
|
6367
6777
|
}
|
|
6368
6778
|
function resolveBuyerSignIn(platformConfig) {
|
|
6369
|
-
for (const factory of
|
|
6779
|
+
for (const factory of factories9) {
|
|
6370
6780
|
const provider = factory(platformConfig);
|
|
6371
6781
|
if (provider !== void 0) return provider;
|
|
6372
6782
|
}
|
|
6373
6783
|
return void 0;
|
|
6374
6784
|
}
|
|
6375
6785
|
function clearBuyerSignIns() {
|
|
6376
|
-
|
|
6786
|
+
factories9.length = 0;
|
|
6377
6787
|
}
|
|
6378
6788
|
|
|
6379
6789
|
// ../ecommerce/src/code-discounts.ts
|
|
6380
|
-
var
|
|
6790
|
+
var factories10 = [];
|
|
6381
6791
|
function registerCodeDiscountSource(factory) {
|
|
6382
|
-
|
|
6792
|
+
factories10.push(factory);
|
|
6383
6793
|
}
|
|
6384
6794
|
function resolveCodeDiscountSource(options) {
|
|
6385
|
-
for (const factory of
|
|
6795
|
+
for (const factory of factories10) {
|
|
6386
6796
|
const source = factory(options);
|
|
6387
6797
|
if (source !== void 0) return source;
|
|
6388
6798
|
}
|
|
6389
6799
|
return void 0;
|
|
6390
6800
|
}
|
|
6391
6801
|
function clearCodeDiscountSources() {
|
|
6392
|
-
|
|
6802
|
+
factories10.length = 0;
|
|
6393
6803
|
}
|
|
6394
6804
|
|
|
6395
6805
|
// ../ecommerce/src/store-theme.ts
|
|
@@ -6399,19 +6809,19 @@ var StoreThemeAccessError = class extends Error {
|
|
|
6399
6809
|
this.name = "StoreThemeAccessError";
|
|
6400
6810
|
}
|
|
6401
6811
|
};
|
|
6402
|
-
var
|
|
6812
|
+
var factories11 = [];
|
|
6403
6813
|
function registerStoreThemeSource(factory) {
|
|
6404
|
-
|
|
6814
|
+
factories11.push(factory);
|
|
6405
6815
|
}
|
|
6406
6816
|
function resolveStoreThemeSource(options) {
|
|
6407
|
-
for (const factory of
|
|
6817
|
+
for (const factory of factories11) {
|
|
6408
6818
|
const source = factory(options);
|
|
6409
6819
|
if (source !== void 0) return source;
|
|
6410
6820
|
}
|
|
6411
6821
|
return void 0;
|
|
6412
6822
|
}
|
|
6413
6823
|
function clearStoreThemeSources() {
|
|
6414
|
-
|
|
6824
|
+
factories11.length = 0;
|
|
6415
6825
|
}
|
|
6416
6826
|
|
|
6417
6827
|
// ../ecommerce/src/installment-offer.ts
|
|
@@ -6767,6 +7177,9 @@ function useFacts() {
|
|
|
6767
7177
|
function useVisitorName() {
|
|
6768
7178
|
return useFourtyRuntime().useVisitorName();
|
|
6769
7179
|
}
|
|
7180
|
+
function useVisitorCountry() {
|
|
7181
|
+
return useFourtyRuntime().useVisitorCountry();
|
|
7182
|
+
}
|
|
6770
7183
|
function useConversationMessages() {
|
|
6771
7184
|
return useFourtyRuntime().useConversationMessages();
|
|
6772
7185
|
}
|
|
@@ -7816,8 +8229,8 @@ var PRESENCE_LIFECYCLE = {
|
|
|
7816
8229
|
};
|
|
7817
8230
|
|
|
7818
8231
|
// ../spacestation/src/widgets/presence/profile.ts
|
|
7819
|
-
import { z as
|
|
7820
|
-
var PresenceProfileSchema =
|
|
8232
|
+
import { z as z54 } from "zod";
|
|
8233
|
+
var PresenceProfileSchema = z54.object({
|
|
7821
8234
|
/**
|
|
7822
8235
|
* How much the agent SPEAKS in presence.
|
|
7823
8236
|
* - 'off' the faculty generates no prose at all. Zero tokens, and
|
|
@@ -7827,14 +8240,14 @@ var PresenceProfileSchema = z50.object({
|
|
|
7827
8240
|
* - 'terse' one lead line per turn. The default — see below.
|
|
7828
8241
|
* - 'full' a lead line plus asides beside individual elements.
|
|
7829
8242
|
*/
|
|
7830
|
-
voice:
|
|
8243
|
+
voice: z54.enum(["off", "terse", "full"]),
|
|
7831
8244
|
/**
|
|
7832
8245
|
* Which source kinds this space surfaces. 'all' = every tool that declares a
|
|
7833
8246
|
* `sourceKind`. An explicit list lets a space stay quiet about lookups its
|
|
7834
8247
|
* visitors would find uninteresting (policy checks on a fashion space)
|
|
7835
8248
|
* without the tool having to lie about what it is.
|
|
7836
8249
|
*/
|
|
7837
|
-
sources:
|
|
8250
|
+
sources: z54.union([z54.array(z54.string()), z54.literal("all")]),
|
|
7838
8251
|
/**
|
|
7839
8252
|
* Which facts render.
|
|
7840
8253
|
* - 'inferred-only' hides `provenance: 'stated'` facts. The default and the
|
|
@@ -7843,7 +8256,7 @@ var PresenceProfileSchema = z50.object({
|
|
|
7843
8256
|
* - 'all' shows stated facts too — for spaces where confirming the brief
|
|
7844
8257
|
* back is itself the product (intake, configuration).
|
|
7845
8258
|
*/
|
|
7846
|
-
facts:
|
|
8259
|
+
facts: z54.enum(["inferred-only", "all"])
|
|
7847
8260
|
});
|
|
7848
8261
|
var DEFAULT_PRESENCE_PROFILE = {
|
|
7849
8262
|
voice: "terse",
|
|
@@ -8250,6 +8663,11 @@ function useConversationPresence() {
|
|
|
8250
8663
|
}
|
|
8251
8664
|
|
|
8252
8665
|
// src/shell/conversation/use-conversation-page.ts
|
|
8666
|
+
function retryAtOf(committedAt, failure) {
|
|
8667
|
+
if (failure === void 0 || failure.retryAfterMs === void 0) return void 0;
|
|
8668
|
+
const at = Date.parse(committedAt);
|
|
8669
|
+
return Number.isNaN(at) ? void 0 : at + failure.retryAfterMs;
|
|
8670
|
+
}
|
|
8253
8671
|
function useConversationPage() {
|
|
8254
8672
|
const messages = useConversationMessages();
|
|
8255
8673
|
const currentIndex = useCurrentMessageIndex();
|
|
@@ -8296,7 +8714,9 @@ function useConversationPage() {
|
|
|
8296
8714
|
ask: shown.streams.ask,
|
|
8297
8715
|
answerable: settledNewest,
|
|
8298
8716
|
live: live !== null,
|
|
8299
|
-
failed: "error" in shown && shown.error !== void 0
|
|
8717
|
+
failed: "error" in shown && shown.error !== void 0,
|
|
8718
|
+
failure: "failure" in shown ? shown.failure : void 0,
|
|
8719
|
+
retryAt: "failure" in shown ? retryAtOf(shown.committedAt, shown.failure) : void 0
|
|
8300
8720
|
};
|
|
8301
8721
|
const home = { key: "home", kind: "home", label: "", open: goHome };
|
|
8302
8722
|
if (away) {
|
|
@@ -8641,6 +9061,52 @@ function useRegisterSignalHandlers(handlers) {
|
|
|
8641
9061
|
}, [registry2]);
|
|
8642
9062
|
}
|
|
8643
9063
|
|
|
9064
|
+
// src/provider/providers/page-claims.ts
|
|
9065
|
+
import { createContext as createContext11, useContext as useContext11, useEffect as useEffect11, useRef as useRef8 } from "react";
|
|
9066
|
+
function isPageOfKind(page, kind) {
|
|
9067
|
+
return page.kind === kind;
|
|
9068
|
+
}
|
|
9069
|
+
function createPageClaimRegistry() {
|
|
9070
|
+
const claims = /* @__PURE__ */ new Map();
|
|
9071
|
+
return {
|
|
9072
|
+
claim: (kind, open) => {
|
|
9073
|
+
if (claims.has(kind)) {
|
|
9074
|
+
throw new Error(
|
|
9075
|
+
`[useClaimPage] "${kind}" pages are already claimed \u2014 one surface per page kind. Claim it from one component.`
|
|
9076
|
+
);
|
|
9077
|
+
}
|
|
9078
|
+
const entry = (page) => isPageOfKind(page, kind) ? open(page) : false;
|
|
9079
|
+
claims.set(kind, entry);
|
|
9080
|
+
return () => {
|
|
9081
|
+
if (claims.get(kind) === entry) claims.delete(kind);
|
|
9082
|
+
};
|
|
9083
|
+
},
|
|
9084
|
+
has: (kind) => claims.has(kind),
|
|
9085
|
+
open: async (page) => {
|
|
9086
|
+
const entry = claims.get(page.kind);
|
|
9087
|
+
if (entry === void 0) return false;
|
|
9088
|
+
try {
|
|
9089
|
+
return await entry(page) === true;
|
|
9090
|
+
} catch (err) {
|
|
9091
|
+
console.warn(`[useClaimPage] the "${page.kind}" claim failed \u2014 opening the page on the canvas:`, err);
|
|
9092
|
+
return false;
|
|
9093
|
+
}
|
|
9094
|
+
}
|
|
9095
|
+
};
|
|
9096
|
+
}
|
|
9097
|
+
var PageClaimContext = createContext11(null);
|
|
9098
|
+
function useClaimPage(kind, open) {
|
|
9099
|
+
const registry2 = useContext11(PageClaimContext);
|
|
9100
|
+
if (registry2 === null) {
|
|
9101
|
+
throw new Error("useClaimPage must be used inside <FourtyProvider>");
|
|
9102
|
+
}
|
|
9103
|
+
const openRef = useRef8(open);
|
|
9104
|
+
useEffect11(() => {
|
|
9105
|
+
openRef.current = open;
|
|
9106
|
+
}, [open]);
|
|
9107
|
+
useEffect11(() => registry2.claim(kind, (page) => openRef.current(page)), [registry2, kind]);
|
|
9108
|
+
}
|
|
9109
|
+
|
|
8644
9110
|
// src/provider/agent-ask-signal.ts
|
|
8645
9111
|
var AGENT_ASK_SIGNAL = "agent_ask";
|
|
8646
9112
|
|
|
@@ -8721,6 +9187,7 @@ __export(canvas_exports, {
|
|
|
8721
9187
|
INITIAL_NAV_PRESENTATION: () => INITIAL_NAV_PRESENTATION,
|
|
8722
9188
|
ITEM_IDENTITY_ATTR: () => ITEM_IDENTITY_ATTR,
|
|
8723
9189
|
ItemTransitionGroup: () => ItemTransitionGroup,
|
|
9190
|
+
SETTLE_PULSE: () => SETTLE_PULSE,
|
|
8724
9191
|
ShimmerSweep: () => ShimmerSweep,
|
|
8725
9192
|
SpacefrontCanvas: () => SpacefrontCanvas,
|
|
8726
9193
|
TURN_TAIL_ATTR: () => TURN_TAIL_ATTR,
|
|
@@ -8800,6 +9267,7 @@ __export(canvas_exports, {
|
|
|
8800
9267
|
useSuggestionsWithDefaults: () => useSuggestionsWithDefaults,
|
|
8801
9268
|
useTurn: () => useTurn,
|
|
8802
9269
|
useTurnAsk: () => useTurnAsk,
|
|
9270
|
+
useVisitorCountry: () => useVisitorCountry,
|
|
8803
9271
|
useVisitorName: () => useVisitorName,
|
|
8804
9272
|
viewportRectOf: () => viewportRectOf,
|
|
8805
9273
|
wipePhases: () => wipePhases,
|
|
@@ -8828,7 +9296,7 @@ function CanvasTailMount({
|
|
|
8828
9296
|
}
|
|
8829
9297
|
|
|
8830
9298
|
// src/canvas/GenerationStyleContext.tsx
|
|
8831
|
-
import { createContext as
|
|
9299
|
+
import { createContext as createContext13, useContext as useContext13 } from "react";
|
|
8832
9300
|
|
|
8833
9301
|
// src/canvas/generation-style.ts
|
|
8834
9302
|
var DEFAULT_GENERATION_TIMINGS = {
|
|
@@ -8852,12 +9320,18 @@ var DEFAULT_GENERATION_STYLE = {
|
|
|
8852
9320
|
timings: DEFAULT_GENERATION_TIMINGS
|
|
8853
9321
|
};
|
|
8854
9322
|
var GENERATION_EASE = [0.76, 0, 0.24, 1];
|
|
9323
|
+
var SETTLE_PULSE = {
|
|
9324
|
+
originY: 0,
|
|
9325
|
+
scale: [1, 1.008, 1],
|
|
9326
|
+
durationS: 0.4,
|
|
9327
|
+
ease: "easeInOut"
|
|
9328
|
+
};
|
|
8855
9329
|
|
|
8856
9330
|
// src/canvas/GenerationStyleContext.tsx
|
|
8857
|
-
var GenerationStyleContext =
|
|
9331
|
+
var GenerationStyleContext = createContext13(DEFAULT_GENERATION_STYLE);
|
|
8858
9332
|
var GenerationStyleProvider = GenerationStyleContext.Provider;
|
|
8859
9333
|
function useGenerationStyle() {
|
|
8860
|
-
return
|
|
9334
|
+
return useContext13(GenerationStyleContext);
|
|
8861
9335
|
}
|
|
8862
9336
|
|
|
8863
9337
|
// src/canvas/ShimmerSweep.tsx
|
|
@@ -8884,7 +9358,7 @@ function ShimmerSweep({ durationS }) {
|
|
|
8884
9358
|
}
|
|
8885
9359
|
|
|
8886
9360
|
// src/canvas/TransitionContext.tsx
|
|
8887
|
-
import React29, { createContext as
|
|
9361
|
+
import React29, { createContext as createContext14, useContext as useContext14 } from "react";
|
|
8888
9362
|
import { AnimatePresence, motion as motion2 } from "framer-motion";
|
|
8889
9363
|
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
8890
9364
|
function FadeGroup({ children }) {
|
|
@@ -8906,7 +9380,7 @@ var FadeTransition = {
|
|
|
8906
9380
|
Group: FadeGroup,
|
|
8907
9381
|
Item: FadeItem
|
|
8908
9382
|
};
|
|
8909
|
-
var TransitionContext =
|
|
9383
|
+
var TransitionContext = createContext14(FadeTransition);
|
|
8910
9384
|
function TransitionProvider({
|
|
8911
9385
|
transition,
|
|
8912
9386
|
children
|
|
@@ -8914,13 +9388,13 @@ function TransitionProvider({
|
|
|
8914
9388
|
return /* @__PURE__ */ jsx11(TransitionContext.Provider, { value: transition, children });
|
|
8915
9389
|
}
|
|
8916
9390
|
function useLayoutTransition() {
|
|
8917
|
-
return
|
|
9391
|
+
return useContext14(TransitionContext);
|
|
8918
9392
|
}
|
|
8919
9393
|
|
|
8920
9394
|
// src/canvas/canvas-arrangement.tsx
|
|
8921
|
-
import React30, { createContext as
|
|
9395
|
+
import React30, { createContext as createContext15, useContext as useContext15 } from "react";
|
|
8922
9396
|
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
8923
|
-
var CanvasArrangementContext =
|
|
9397
|
+
var CanvasArrangementContext = createContext15({ arrangement: "stack", turnPages: false, stackedTurns: false });
|
|
8924
9398
|
function CanvasArrangementProvider({
|
|
8925
9399
|
arrangement,
|
|
8926
9400
|
turnPages = false,
|
|
@@ -8931,7 +9405,7 @@ function CanvasArrangementProvider({
|
|
|
8931
9405
|
return /* @__PURE__ */ jsx12(CanvasArrangementContext.Provider, { value: value2, children });
|
|
8932
9406
|
}
|
|
8933
9407
|
function useCanvasArrangement() {
|
|
8934
|
-
return
|
|
9408
|
+
return useContext15(CanvasArrangementContext);
|
|
8935
9409
|
}
|
|
8936
9410
|
|
|
8937
9411
|
// src/canvas/canvas-lead.tsx
|
|
@@ -8995,25 +9469,25 @@ function turnTailSlots(keys, turnOf, newest) {
|
|
|
8995
9469
|
}
|
|
8996
9470
|
|
|
8997
9471
|
// src/canvas/canvas-motion-style.tsx
|
|
8998
|
-
import { createContext as
|
|
9472
|
+
import { createContext as createContext18, useContext as useContext18 } from "react";
|
|
8999
9473
|
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
9000
|
-
var CanvasMotionStyleContext =
|
|
9474
|
+
var CanvasMotionStyleContext = createContext18(null);
|
|
9001
9475
|
function CanvasMotionStyleProvider({ style, children }) {
|
|
9002
9476
|
return /* @__PURE__ */ jsx15(CanvasMotionStyleContext.Provider, { value: style, children });
|
|
9003
9477
|
}
|
|
9004
9478
|
function useCanvasMotionStyle() {
|
|
9005
|
-
return
|
|
9479
|
+
return useContext18(CanvasMotionStyleContext);
|
|
9006
9480
|
}
|
|
9007
9481
|
|
|
9008
9482
|
// src/canvas/ElementIdContext.ts
|
|
9009
|
-
import { createContext as
|
|
9010
|
-
var ElementIdContext =
|
|
9483
|
+
import { createContext as createContext19, useContext as useContext19 } from "react";
|
|
9484
|
+
var ElementIdContext = createContext19(null);
|
|
9011
9485
|
function useElementId() {
|
|
9012
|
-
return
|
|
9486
|
+
return useContext19(ElementIdContext);
|
|
9013
9487
|
}
|
|
9014
|
-
var ElementLayoutContext =
|
|
9488
|
+
var ElementLayoutContext = createContext19(null);
|
|
9015
9489
|
function useElementLayout() {
|
|
9016
|
-
return
|
|
9490
|
+
return useContext19(ElementLayoutContext);
|
|
9017
9491
|
}
|
|
9018
9492
|
|
|
9019
9493
|
// src/canvas/generation-entrance.ts
|
|
@@ -9357,14 +9831,14 @@ function deriveTurnChangeAnchor(prev, next) {
|
|
|
9357
9831
|
}
|
|
9358
9832
|
|
|
9359
9833
|
// src/canvas/canvas-outlet.tsx
|
|
9360
|
-
import { createContext as
|
|
9834
|
+
import { createContext as createContext20, useContext as useContext20 } from "react";
|
|
9361
9835
|
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
9362
|
-
var CanvasOutletContext =
|
|
9836
|
+
var CanvasOutletContext = createContext20(null);
|
|
9363
9837
|
function CanvasOutletProvider({ canvas, children }) {
|
|
9364
9838
|
return /* @__PURE__ */ jsx16(CanvasOutletContext.Provider, { value: canvas, children });
|
|
9365
9839
|
}
|
|
9366
9840
|
function SpacefrontCanvas() {
|
|
9367
|
-
const Canvas =
|
|
9841
|
+
const Canvas = useContext20(CanvasOutletContext);
|
|
9368
9842
|
if (Canvas === null) {
|
|
9369
9843
|
throw new Error("<SpacefrontCanvas> must be rendered inside <Spacefront> \u2014 no engine has provided a canvas.");
|
|
9370
9844
|
}
|
|
@@ -9726,9 +10200,9 @@ __export(catalog_exports, {
|
|
|
9726
10200
|
});
|
|
9727
10201
|
|
|
9728
10202
|
// src/catalog/DebugContext.tsx
|
|
9729
|
-
import { createContext as
|
|
10203
|
+
import { createContext as createContext21, useContext as useContext21 } from "react";
|
|
9730
10204
|
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
9731
|
-
var DebugContext =
|
|
10205
|
+
var DebugContext = createContext21(false);
|
|
9732
10206
|
function DebugProvider({
|
|
9733
10207
|
debug,
|
|
9734
10208
|
children
|
|
@@ -9736,11 +10210,11 @@ function DebugProvider({
|
|
|
9736
10210
|
return /* @__PURE__ */ jsx18(DebugContext.Provider, { value: debug, children });
|
|
9737
10211
|
}
|
|
9738
10212
|
function useDebug() {
|
|
9739
|
-
return
|
|
10213
|
+
return useContext21(DebugContext);
|
|
9740
10214
|
}
|
|
9741
10215
|
|
|
9742
10216
|
// src/catalog/HydrationStateContext.tsx
|
|
9743
|
-
import { createContext as
|
|
10217
|
+
import { createContext as createContext22, useContext as useContext22 } from "react";
|
|
9744
10218
|
var DEFAULT_STATE = {
|
|
9745
10219
|
hasResolvedFields: false,
|
|
9746
10220
|
hydrating: false,
|
|
@@ -9750,15 +10224,15 @@ var DEFAULT_STATE = {
|
|
|
9750
10224
|
pendingCount: 0,
|
|
9751
10225
|
errors: []
|
|
9752
10226
|
};
|
|
9753
|
-
var HydrationStateContext =
|
|
10227
|
+
var HydrationStateContext = createContext22(DEFAULT_STATE);
|
|
9754
10228
|
function useHydrationState() {
|
|
9755
|
-
return
|
|
10229
|
+
return useContext22(HydrationStateContext);
|
|
9756
10230
|
}
|
|
9757
10231
|
|
|
9758
10232
|
// src/catalog/HydratorContext.tsx
|
|
9759
|
-
import { createContext as
|
|
10233
|
+
import { createContext as createContext23, useContext as useContext23 } from "react";
|
|
9760
10234
|
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
9761
|
-
var HydratorContext =
|
|
10235
|
+
var HydratorContext = createContext23({});
|
|
9762
10236
|
function HydratorProvider({
|
|
9763
10237
|
hydrators,
|
|
9764
10238
|
children
|
|
@@ -9766,13 +10240,13 @@ function HydratorProvider({
|
|
|
9766
10240
|
return /* @__PURE__ */ jsx19(HydratorContext.Provider, { value: hydrators, children });
|
|
9767
10241
|
}
|
|
9768
10242
|
function useHydrators() {
|
|
9769
|
-
return
|
|
10243
|
+
return useContext23(HydratorContext);
|
|
9770
10244
|
}
|
|
9771
10245
|
|
|
9772
10246
|
// src/catalog/registry.tsx
|
|
9773
|
-
import { createContext as
|
|
10247
|
+
import { createContext as createContext24, useContext as useContext24 } from "react";
|
|
9774
10248
|
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
9775
|
-
var RegistryContext =
|
|
10249
|
+
var RegistryContext = createContext24({});
|
|
9776
10250
|
function RegistryProvider({
|
|
9777
10251
|
registry: registry2,
|
|
9778
10252
|
children
|
|
@@ -9780,9 +10254,9 @@ function RegistryProvider({
|
|
|
9780
10254
|
return /* @__PURE__ */ jsx20(RegistryContext.Provider, { value: registry2, children });
|
|
9781
10255
|
}
|
|
9782
10256
|
function useRegistry() {
|
|
9783
|
-
return
|
|
10257
|
+
return useContext24(RegistryContext);
|
|
9784
10258
|
}
|
|
9785
|
-
var PackageLookupContext =
|
|
10259
|
+
var PackageLookupContext = createContext24(null);
|
|
9786
10260
|
function PackageLookupProvider({
|
|
9787
10261
|
lookup,
|
|
9788
10262
|
children
|
|
@@ -9790,7 +10264,7 @@ function PackageLookupProvider({
|
|
|
9790
10264
|
return /* @__PURE__ */ jsx20(PackageLookupContext.Provider, { value: lookup, children });
|
|
9791
10265
|
}
|
|
9792
10266
|
function usePackageLookup() {
|
|
9793
|
-
return
|
|
10267
|
+
return useContext24(PackageLookupContext);
|
|
9794
10268
|
}
|
|
9795
10269
|
function createAliasedRegistry(baseRegistry, aliases, getPackageComponent) {
|
|
9796
10270
|
return new Proxy(baseRegistry, {
|
|
@@ -9955,23 +10429,23 @@ function buildComponentLibrary(catalog, componentMap) {
|
|
|
9955
10429
|
}
|
|
9956
10430
|
|
|
9957
10431
|
// src/catalog/define.ts
|
|
9958
|
-
import { z as
|
|
9959
|
-
var HYDRATED_ENTITY =
|
|
10432
|
+
import { z as z55 } from "zod";
|
|
10433
|
+
var HYDRATED_ENTITY = z55.object({}).passthrough();
|
|
9960
10434
|
function entity(resolverKey, opts) {
|
|
9961
10435
|
return resolved(HYDRATED_ENTITY, resolverKey, opts);
|
|
9962
10436
|
}
|
|
9963
|
-
var text = prose(
|
|
10437
|
+
var text = prose(z55.string());
|
|
9964
10438
|
function plain() {
|
|
9965
|
-
return
|
|
10439
|
+
return z55.string();
|
|
9966
10440
|
}
|
|
9967
10441
|
function token(values) {
|
|
9968
|
-
return
|
|
10442
|
+
return z55.enum(values);
|
|
9969
10443
|
}
|
|
9970
10444
|
function catalogComponent(meta, render) {
|
|
9971
10445
|
const { props, requires, ...rest } = meta;
|
|
9972
10446
|
return {
|
|
9973
10447
|
...rest,
|
|
9974
|
-
propsSchema:
|
|
10448
|
+
propsSchema: z55.object(props),
|
|
9975
10449
|
...requires !== void 0 ? { requires } : {},
|
|
9976
10450
|
component: adaptComponent(render)
|
|
9977
10451
|
};
|
|
@@ -10689,10 +11163,10 @@ __export(chat_exports, {
|
|
|
10689
11163
|
});
|
|
10690
11164
|
|
|
10691
11165
|
// src/chat/chat-context.ts
|
|
10692
|
-
import { createContext as
|
|
10693
|
-
var FourtyChatContext =
|
|
11166
|
+
import { createContext as createContext25, useContext as useContext25 } from "react";
|
|
11167
|
+
var FourtyChatContext = createContext25(null);
|
|
10694
11168
|
function useFourtyChat() {
|
|
10695
|
-
const ctx =
|
|
11169
|
+
const ctx = useContext25(FourtyChatContext);
|
|
10696
11170
|
if (!ctx) throw new Error("useFourtyChat must be used inside <FourtyChatProvider>");
|
|
10697
11171
|
return ctx;
|
|
10698
11172
|
}
|
|
@@ -10867,7 +11341,7 @@ function ProjectionSignalBridge() {
|
|
|
10867
11341
|
}
|
|
10868
11342
|
|
|
10869
11343
|
// src/projection/use-projection.ts
|
|
10870
|
-
import { useCallback as useCallback17, useEffect as
|
|
11344
|
+
import { useCallback as useCallback17, useEffect as useEffect13, useState as useState8 } from "react";
|
|
10871
11345
|
function readResult(raw) {
|
|
10872
11346
|
if (raw === null || typeof raw !== "object") return void 0;
|
|
10873
11347
|
if (!("hiddenCount" in raw) || typeof raw.hiddenCount !== "number") return void 0;
|
|
@@ -10883,7 +11357,7 @@ function useProjection(projectionProp, entity2) {
|
|
|
10883
11357
|
const [expanded, setExpanded] = useState8(false);
|
|
10884
11358
|
const toggle = useCallback17(() => setExpanded((e) => !e), []);
|
|
10885
11359
|
const entityId = entityIdOf(entity2);
|
|
10886
|
-
|
|
11360
|
+
useEffect13(() => {
|
|
10887
11361
|
setExpanded(false);
|
|
10888
11362
|
}, [entityId]);
|
|
10889
11363
|
const result = readResult(projectionProp);
|
|
@@ -10929,9 +11403,9 @@ __export(interaction_exports, {
|
|
|
10929
11403
|
});
|
|
10930
11404
|
|
|
10931
11405
|
// src/interaction/withInteractionTracking.tsx
|
|
10932
|
-
import React40, { createContext as
|
|
11406
|
+
import React40, { createContext as createContext26, useContext as useContext26 } from "react";
|
|
10933
11407
|
import { jsx as jsx22, jsxs } from "react/jsx-runtime";
|
|
10934
|
-
var InteractionContext =
|
|
11408
|
+
var InteractionContext = createContext26(null);
|
|
10935
11409
|
function InteractionProvider({
|
|
10936
11410
|
onInteraction,
|
|
10937
11411
|
children
|
|
@@ -10939,7 +11413,7 @@ function InteractionProvider({
|
|
|
10939
11413
|
return /* @__PURE__ */ jsx22(InteractionContext.Provider, { value: onInteraction, children });
|
|
10940
11414
|
}
|
|
10941
11415
|
function useInteraction2() {
|
|
10942
|
-
return
|
|
11416
|
+
return useContext26(InteractionContext);
|
|
10943
11417
|
}
|
|
10944
11418
|
function withInteractionTracking(WrappedComponent, meta) {
|
|
10945
11419
|
function TrackedComponent(props) {
|
|
@@ -11030,14 +11504,14 @@ __export(utils_exports, {
|
|
|
11030
11504
|
import { useSyncExternalStore as useSyncExternalStore7 } from "react";
|
|
11031
11505
|
|
|
11032
11506
|
// src/utils/viewport-window.tsx
|
|
11033
|
-
import { createContext as
|
|
11507
|
+
import { createContext as createContext27, useContext as useContext27 } from "react";
|
|
11034
11508
|
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
11035
|
-
var ViewportWindowContext =
|
|
11509
|
+
var ViewportWindowContext = createContext27(null);
|
|
11036
11510
|
function canAnswer(win) {
|
|
11037
11511
|
return win !== null && typeof win.matchMedia === "function";
|
|
11038
11512
|
}
|
|
11039
11513
|
function useViewportWindow() {
|
|
11040
|
-
const provided =
|
|
11514
|
+
const provided = useContext27(ViewportWindowContext);
|
|
11041
11515
|
if (provided !== null) return canAnswer(provided) ? provided : null;
|
|
11042
11516
|
const global = globalThis;
|
|
11043
11517
|
return canAnswer(global) ? global : null;
|
|
@@ -11165,18 +11639,18 @@ function useInterval(callback, ms, active = true) {
|
|
|
11165
11639
|
}
|
|
11166
11640
|
|
|
11167
11641
|
// src/utils/use-success-flash.ts
|
|
11168
|
-
import { useCallback as useCallback19, useEffect as
|
|
11642
|
+
import { useCallback as useCallback19, useEffect as useEffect14, useRef as useRef10, useState as useState10 } from "react";
|
|
11169
11643
|
import { useAnimationControls } from "framer-motion";
|
|
11170
11644
|
function useSuccessFlash(options) {
|
|
11171
11645
|
const duration = options !== void 0 && options.duration !== void 0 ? options.duration : 900;
|
|
11172
11646
|
const popDuration = options !== void 0 && options.popDuration !== void 0 ? options.popDuration : 0.5;
|
|
11173
|
-
const scaleRef =
|
|
11647
|
+
const scaleRef = useRef10(
|
|
11174
11648
|
options !== void 0 && options.scale !== void 0 ? options.scale : [1, 1.06, 0.98, 1]
|
|
11175
11649
|
);
|
|
11176
11650
|
const controls = useAnimationControls();
|
|
11177
11651
|
const [flashing, setFlashing] = useState10(false);
|
|
11178
|
-
const timerRef =
|
|
11179
|
-
|
|
11652
|
+
const timerRef = useRef10(null);
|
|
11653
|
+
useEffect14(() => {
|
|
11180
11654
|
return () => {
|
|
11181
11655
|
if (timerRef.current !== null) window.clearTimeout(timerRef.current);
|
|
11182
11656
|
};
|
|
@@ -11201,10 +11675,10 @@ function useSuccessFlash(options) {
|
|
|
11201
11675
|
}
|
|
11202
11676
|
|
|
11203
11677
|
// src/utils/use-wake-lock.ts
|
|
11204
|
-
import { useEffect as
|
|
11678
|
+
import { useEffect as useEffect15, useRef as useRef11 } from "react";
|
|
11205
11679
|
function useWakeLock(active) {
|
|
11206
|
-
const sentinelRef =
|
|
11207
|
-
|
|
11680
|
+
const sentinelRef = useRef11(null);
|
|
11681
|
+
useEffect15(() => {
|
|
11208
11682
|
if (!active) return;
|
|
11209
11683
|
if (typeof navigator === "undefined" || !("wakeLock" in navigator)) return;
|
|
11210
11684
|
let cancelled = false;
|
|
@@ -11429,6 +11903,8 @@ var RUNTIME = {
|
|
|
11429
11903
|
useSeedLayout: () => null,
|
|
11430
11904
|
useFacts: () => ({}),
|
|
11431
11905
|
useVisitorName: () => ({ name: null, setName: NOOP }),
|
|
11906
|
+
// A preview has no visitor: no country known, and choosing one goes nowhere.
|
|
11907
|
+
useVisitorCountry: () => ({ country: null, source: null, observed: null, choose: NOOP, clear: NOOP }),
|
|
11432
11908
|
useConversationMessages: () => usePreview().messages,
|
|
11433
11909
|
usePendingMessage: () => usePreview().pending,
|
|
11434
11910
|
useCurrentMessageIndex: () => {
|
|
@@ -11610,10 +12086,12 @@ __export(commerce_exports, {
|
|
|
11610
12086
|
normalizeCollectionLegacy: () => normalizeCollectionLegacy,
|
|
11611
12087
|
openCartDrawer: () => openCartDrawer,
|
|
11612
12088
|
openCartDrawerFocusedOn: () => openCartDrawerFocusedOn,
|
|
12089
|
+
percentOff: () => percentOff,
|
|
11613
12090
|
pickCartAddAction: () => pickCartAddAction,
|
|
11614
12091
|
pickCollectionAction: () => pickCollectionAction,
|
|
11615
12092
|
pickProductCardAction: () => pickProductCardAction,
|
|
11616
12093
|
preselectFromFacts: () => preselectFromFacts,
|
|
12094
|
+
productDetailAddResult: () => productDetailAddResult,
|
|
11617
12095
|
pruneFilterChips: () => pruneFilterChips,
|
|
11618
12096
|
queueDiscountCode: () => queueDiscountCode,
|
|
11619
12097
|
readCartActionFailures: () => readCartActionFailures,
|
|
@@ -11711,7 +12189,7 @@ registerEntityPageKind("search", {
|
|
|
11711
12189
|
});
|
|
11712
12190
|
|
|
11713
12191
|
// src/verticals/commerce/commerce-context.tsx
|
|
11714
|
-
import { createContext as
|
|
12192
|
+
import { createContext as createContext29, useContext as useContext29 } from "react";
|
|
11715
12193
|
var INERT_COMMERCE_RUNTIME = {
|
|
11716
12194
|
useCart: () => {
|
|
11717
12195
|
throw new Error("useCart must be used within a <CommerceProvider>");
|
|
@@ -11779,12 +12257,12 @@ var INERT_COMMERCE_RUNTIME = {
|
|
|
11779
12257
|
// No commerce, no catalog to search.
|
|
11780
12258
|
useProductSearch: () => ({ available: false, products: [], nextCursor: null, isLoading: false, error: null })
|
|
11781
12259
|
};
|
|
11782
|
-
var FourtyCommerceRuntimeContext =
|
|
12260
|
+
var FourtyCommerceRuntimeContext = createContext29(
|
|
11783
12261
|
INERT_COMMERCE_RUNTIME
|
|
11784
12262
|
);
|
|
11785
12263
|
var FourtyCommerceRuntimeProvider = FourtyCommerceRuntimeContext.Provider;
|
|
11786
12264
|
function useCommerceRuntime() {
|
|
11787
|
-
return
|
|
12265
|
+
return useContext29(FourtyCommerceRuntimeContext);
|
|
11788
12266
|
}
|
|
11789
12267
|
function useCart() {
|
|
11790
12268
|
return useCommerceRuntime().useCart();
|
|
@@ -11993,18 +12471,18 @@ __export(ecommerce_exports, {
|
|
|
11993
12471
|
});
|
|
11994
12472
|
|
|
11995
12473
|
// ../spacestation/src/analytics/ecommerce/surfacing.ts
|
|
11996
|
-
import { z as
|
|
12474
|
+
import { z as z56 } from "zod";
|
|
11997
12475
|
var PRODUCTS_SURFACED = defineEventKind(
|
|
11998
12476
|
"commerce.products_surfaced",
|
|
11999
12477
|
"client",
|
|
12000
|
-
|
|
12478
|
+
z56.object({
|
|
12001
12479
|
/** The turn whose commit this describes. Minted where the prompt signal
|
|
12002
12480
|
* is built and shared with `agent_runs`, so the read layer can line a
|
|
12003
12481
|
* surfacing up against the prompt that asked for it. */
|
|
12004
|
-
turnId:
|
|
12482
|
+
turnId: z56.string().min(1).max(128),
|
|
12005
12483
|
/** Distinct entity refs this turn placed that were not on the canvas
|
|
12006
12484
|
* before it. ZERO IS A REAL VALUE — see the header. */
|
|
12007
|
-
productCount:
|
|
12485
|
+
productCount: z56.number().int().nonnegative()
|
|
12008
12486
|
}).strict()
|
|
12009
12487
|
);
|
|
12010
12488
|
|
|
@@ -12047,10 +12525,10 @@ function useProductGridFilter(chips) {
|
|
|
12047
12525
|
}
|
|
12048
12526
|
|
|
12049
12527
|
// src/verticals/commerce/product/use-product-detail.ts
|
|
12050
|
-
import { useCallback as useCallback22, useMemo as useMemo17, useRef as
|
|
12528
|
+
import { useCallback as useCallback22, useMemo as useMemo17, useRef as useRef14, useState as useState15 } from "react";
|
|
12051
12529
|
|
|
12052
12530
|
// src/verticals/commerce/checkout/use-buy-now.ts
|
|
12053
|
-
import { useCallback as useCallback21, useEffect as
|
|
12531
|
+
import { useCallback as useCallback21, useEffect as useEffect17, useState as useState13 } from "react";
|
|
12054
12532
|
|
|
12055
12533
|
// src/verticals/commerce/checkout/checkout-handoff-store.ts
|
|
12056
12534
|
import { useSyncExternalStore as useSyncExternalStore11 } from "react";
|
|
@@ -12196,7 +12674,7 @@ function useBuyNow(addToCart) {
|
|
|
12196
12674
|
addToCart();
|
|
12197
12675
|
setPending(variantId);
|
|
12198
12676
|
}, [pending2, addToCart]);
|
|
12199
|
-
|
|
12677
|
+
useEffect17(() => {
|
|
12200
12678
|
if (pending2 === null) return;
|
|
12201
12679
|
const exit = resolveBuyNowExit(cartApi.cart, pending2);
|
|
12202
12680
|
if (exit.kind === "exit") {
|
|
@@ -12251,12 +12729,14 @@ function deriveVariantGroups(product) {
|
|
|
12251
12729
|
return product.options.map((o) => ({ name: o.name, options: o.values }));
|
|
12252
12730
|
}
|
|
12253
12731
|
function matchVariant(product, opts) {
|
|
12732
|
+
const hasOptionGroups = deriveVariantGroups(product).length > 0;
|
|
12254
12733
|
for (const variant of product.variants) {
|
|
12255
|
-
|
|
12256
|
-
|
|
12257
|
-
(
|
|
12258
|
-
|
|
12259
|
-
|
|
12734
|
+
const listed = variant.selectedOptions === void 0 ? [] : variant.selectedOptions;
|
|
12735
|
+
if (listed.length === 0) {
|
|
12736
|
+
if (hasOptionGroups) continue;
|
|
12737
|
+
return variant;
|
|
12738
|
+
}
|
|
12739
|
+
if (listed.every((opt) => opts[opt.name] === opt.value)) return variant;
|
|
12260
12740
|
}
|
|
12261
12741
|
return void 0;
|
|
12262
12742
|
}
|
|
@@ -12279,14 +12759,14 @@ function isOptionUnavailable(product, selectedVariants, group, opt) {
|
|
|
12279
12759
|
}
|
|
12280
12760
|
|
|
12281
12761
|
// src/verticals/commerce/variant/use-selected-variants-state.ts
|
|
12282
|
-
import { useEffect as
|
|
12762
|
+
import { useEffect as useEffect18, useRef as useRef13, useState as useState14 } from "react";
|
|
12283
12763
|
function useSelectedVariantsState(product, facts) {
|
|
12284
12764
|
const [selectedVariants, setSelectedVariants] = useState14(() => {
|
|
12285
12765
|
const recorded = getOptionSelections(product.id);
|
|
12286
12766
|
return { ...preselectFromFacts(product, facts), ...recorded !== void 0 ? recorded : {} };
|
|
12287
12767
|
});
|
|
12288
|
-
const touchedForProductRef =
|
|
12289
|
-
|
|
12768
|
+
const touchedForProductRef = useRef13(null);
|
|
12769
|
+
useEffect18(() => {
|
|
12290
12770
|
if (touchedForProductRef.current === product.id) return;
|
|
12291
12771
|
const next = preselectFromFacts(product, facts);
|
|
12292
12772
|
setSelectedVariants((prev) => {
|
|
@@ -12302,7 +12782,7 @@ function useSelectedVariantsState(product, facts) {
|
|
|
12302
12782
|
});
|
|
12303
12783
|
}, [facts, product]);
|
|
12304
12784
|
const optionSelections = useOptionSelections();
|
|
12305
|
-
|
|
12785
|
+
useEffect18(() => {
|
|
12306
12786
|
const recorded = optionSelections.get(product.id);
|
|
12307
12787
|
if (recorded === void 0) return;
|
|
12308
12788
|
setSelectedVariants((prev) => {
|
|
@@ -12327,6 +12807,20 @@ function useSelectedVariantsState(product, facts) {
|
|
|
12327
12807
|
};
|
|
12328
12808
|
}
|
|
12329
12809
|
|
|
12810
|
+
// src/verticals/commerce/product/product-detail-add.ts
|
|
12811
|
+
function pickVariantForAdd(product, state2, action) {
|
|
12812
|
+
if (action === "buy-now" && state2.buyNowPending) return { added: false, reason: "in-flight" };
|
|
12813
|
+
if (!state2.allSelected) return { added: false, reason: "selection-incomplete" };
|
|
12814
|
+
const variant = matchVariant(product, state2.selectedVariants);
|
|
12815
|
+
if (variant === void 0) return { added: false, reason: "no-matching-variant" };
|
|
12816
|
+
return { variant };
|
|
12817
|
+
}
|
|
12818
|
+
function productDetailAddResult(product, detail, action) {
|
|
12819
|
+
const pick = pickVariantForAdd(product, detail, action);
|
|
12820
|
+
if ("variant" in pick) return { added: true, variantId: pick.variant.id };
|
|
12821
|
+
return pick;
|
|
12822
|
+
}
|
|
12823
|
+
|
|
12330
12824
|
// src/verticals/commerce/product/use-product-detail.ts
|
|
12331
12825
|
function useProductDetail(product, options) {
|
|
12332
12826
|
const session = useFourtySession();
|
|
@@ -12335,7 +12829,7 @@ function useProductDetail(product, options) {
|
|
|
12335
12829
|
const optimisticFacts = useOptimisticFactOverlay(PRESENCE_OPTIMISTIC_FACTS_FLOW);
|
|
12336
12830
|
const [selectedImage, setSelectedImage] = useState15(0);
|
|
12337
12831
|
const [zoomed, setZoomed] = useState15(false);
|
|
12338
|
-
const lastProductIdRef =
|
|
12832
|
+
const lastProductIdRef = useRef14(product.id);
|
|
12339
12833
|
if (lastProductIdRef.current !== product.id) {
|
|
12340
12834
|
lastProductIdRef.current = product.id;
|
|
12341
12835
|
setSelectedImage(0);
|
|
@@ -12360,7 +12854,7 @@ function useProductDetail(product, options) {
|
|
|
12360
12854
|
[product]
|
|
12361
12855
|
);
|
|
12362
12856
|
const activeVariantImageUrl = findVariant(selectedVariants)?.image?.url;
|
|
12363
|
-
const lastVariantImageUrlRef =
|
|
12857
|
+
const lastVariantImageUrlRef = useRef14(void 0);
|
|
12364
12858
|
if (activeVariantImageUrl !== void 0 && activeVariantImageUrl !== lastVariantImageUrlRef.current) {
|
|
12365
12859
|
lastVariantImageUrlRef.current = activeVariantImageUrl;
|
|
12366
12860
|
const matchIndex = product.images.findIndex((img) => img.url === activeVariantImageUrl);
|
|
@@ -12380,12 +12874,12 @@ function useProductDetail(product, options) {
|
|
|
12380
12874
|
optimisticFacts.add({ label: group, value: opt });
|
|
12381
12875
|
}, [session, product.id, markTouched, setSelectedVariants, optimisticFacts]);
|
|
12382
12876
|
const addPicked = useCallback22((acknowledgeInDrawer) => {
|
|
12383
|
-
|
|
12384
|
-
|
|
12385
|
-
|
|
12386
|
-
console.warn("[useProductDetail] no variant matched for selection", selectedVariants);
|
|
12877
|
+
const pick = pickVariantForAdd(product, { allSelected, selectedVariants, buyNowPending: false }, "add-to-bag");
|
|
12878
|
+
if (!("variant" in pick)) {
|
|
12879
|
+
if (pick.reason === "no-matching-variant") console.warn("[useProductDetail] no variant matched for selection", selectedVariants);
|
|
12387
12880
|
return;
|
|
12388
12881
|
}
|
|
12882
|
+
const { variant } = pick;
|
|
12389
12883
|
session.dispatchSuggestionAction({
|
|
12390
12884
|
id: `cart-add-${variant.id}`,
|
|
12391
12885
|
label: product.title,
|
|
@@ -12403,19 +12897,18 @@ function useProductDetail(product, options) {
|
|
|
12403
12897
|
...lineAttributes !== void 0 && lineAttributes.length > 0 ? { attributes: lineAttributes } : {}
|
|
12404
12898
|
}
|
|
12405
12899
|
});
|
|
12406
|
-
}, [allSelected,
|
|
12900
|
+
}, [allSelected, product, selectedVariants, session, lineAttributes]);
|
|
12407
12901
|
const onAddToBag = useCallback22(() => addPicked(true), [addPicked]);
|
|
12408
12902
|
const addForBuyNow = useCallback22(() => addPicked(false), [addPicked]);
|
|
12409
12903
|
const buyNow = useBuyNow(addForBuyNow);
|
|
12410
12904
|
const onBuyNow = useCallback22(() => {
|
|
12411
|
-
|
|
12412
|
-
|
|
12413
|
-
|
|
12414
|
-
console.warn("[useProductDetail] buy-now: no variant matched for selection", selectedVariants);
|
|
12905
|
+
const pick = pickVariantForAdd(product, { allSelected, selectedVariants, buyNowPending: buyNow.pending }, "buy-now");
|
|
12906
|
+
if (!("variant" in pick)) {
|
|
12907
|
+
if (pick.reason === "no-matching-variant") console.warn("[useProductDetail] buy-now: no variant matched for selection", selectedVariants);
|
|
12415
12908
|
return;
|
|
12416
12909
|
}
|
|
12417
|
-
buyNow.start(variant.id);
|
|
12418
|
-
}, [
|
|
12910
|
+
buyNow.start(pick.variant.id);
|
|
12911
|
+
}, [product, allSelected, selectedVariants, buyNow]);
|
|
12419
12912
|
const onAskAgent = useCallback22(() => {
|
|
12420
12913
|
session.sendMessage(`Tell me more about the ${product.title}`);
|
|
12421
12914
|
}, [session, product.title]);
|
|
@@ -13427,6 +13920,13 @@ function pickCollectionAction(collection, override) {
|
|
|
13427
13920
|
};
|
|
13428
13921
|
}
|
|
13429
13922
|
|
|
13923
|
+
// src/verticals/commerce/price/percent-off.ts
|
|
13924
|
+
function percentOff(price, compareAtPrice) {
|
|
13925
|
+
if (compareAtPrice === void 0 || !isOnSale(price, compareAtPrice)) return void 0;
|
|
13926
|
+
const pct = Math.round((compareAtPrice - price) / compareAtPrice * 100);
|
|
13927
|
+
return pct > 0 ? pct : void 0;
|
|
13928
|
+
}
|
|
13929
|
+
|
|
13430
13930
|
// src/verticals/commerce/comparison/comparison-rows.ts
|
|
13431
13931
|
function byProduct(products, fn) {
|
|
13432
13932
|
const out = {};
|
|
@@ -13442,10 +13942,7 @@ function ratingOf(p) {
|
|
|
13442
13942
|
return void 0;
|
|
13443
13943
|
}
|
|
13444
13944
|
function discountPct(p) {
|
|
13445
|
-
|
|
13446
|
-
if (!isOnSale(p.price.amount, p.compareAtPrice.amount)) return void 0;
|
|
13447
|
-
const saved = (p.compareAtPrice.amount - p.price.amount) / p.compareAtPrice.amount;
|
|
13448
|
-
return Math.round(saved * 100);
|
|
13945
|
+
return percentOff(p.price.amount, p.compareAtPrice === void 0 ? void 0 : p.compareAtPrice.amount);
|
|
13449
13946
|
}
|
|
13450
13947
|
function buildComparisonRows(products, locale, words) {
|
|
13451
13948
|
const rows = [
|
|
@@ -13563,10 +14060,10 @@ function useContentActions() {
|
|
|
13563
14060
|
}
|
|
13564
14061
|
|
|
13565
14062
|
// src/host/Spacefront.tsx
|
|
13566
|
-
import { useEffect as
|
|
14063
|
+
import { useEffect as useEffect20, useState as useState19 } from "react";
|
|
13567
14064
|
|
|
13568
14065
|
// package.json
|
|
13569
|
-
var version = "0.5.
|
|
14066
|
+
var version = "0.5.29";
|
|
13570
14067
|
|
|
13571
14068
|
// src/host/host-modules.ts
|
|
13572
14069
|
import * as react from "react";
|
|
@@ -13631,7 +14128,7 @@ import { jsx as jsx25 } from "react/jsx-runtime";
|
|
|
13631
14128
|
function Spacefront(props) {
|
|
13632
14129
|
const [engine, setEngine] = useState19(null);
|
|
13633
14130
|
const [failure, setFailure] = useState19(null);
|
|
13634
|
-
|
|
14131
|
+
useEffect20(() => {
|
|
13635
14132
|
let live = true;
|
|
13636
14133
|
loadEngine(props.apiUrl).then(
|
|
13637
14134
|
(loaded) => {
|
|
@@ -13653,7 +14150,7 @@ function Spacefront(props) {
|
|
|
13653
14150
|
}
|
|
13654
14151
|
|
|
13655
14152
|
// src/npm.ts
|
|
13656
|
-
import { z as
|
|
14153
|
+
import { z as z58 } from "zod";
|
|
13657
14154
|
export {
|
|
13658
14155
|
ACQUISITION_KIND_LABELS,
|
|
13659
14156
|
ACTIVE_PANEL_ATTR,
|
|
@@ -13763,6 +14260,7 @@ export {
|
|
|
13763
14260
|
CmsPolicySchema,
|
|
13764
14261
|
CollectionSchema,
|
|
13765
14262
|
ComponentErrorBoundary,
|
|
14263
|
+
CountryCodeSchema,
|
|
13766
14264
|
CreateCommentInputSchema,
|
|
13767
14265
|
CreateTraceInputSchema,
|
|
13768
14266
|
DEFAULT_GENERATION_STYLE,
|
|
@@ -13842,6 +14340,7 @@ export {
|
|
|
13842
14340
|
MOBILE_VIEWPORT_MAX,
|
|
13843
14341
|
MoneySchema,
|
|
13844
14342
|
NAVIGATE_SIGNAL,
|
|
14343
|
+
NO_VISITOR_COUNTRY,
|
|
13845
14344
|
NavigatePayloadSchema,
|
|
13846
14345
|
NullComponent,
|
|
13847
14346
|
OLDEST_SUPPORTED_SDK,
|
|
@@ -13862,6 +14361,7 @@ export {
|
|
|
13862
14361
|
PackageBundleRefSchema,
|
|
13863
14362
|
PackageLookupProvider,
|
|
13864
14363
|
PackageReleaseSchema,
|
|
14364
|
+
PageClaimContext,
|
|
13865
14365
|
PageSchema,
|
|
13866
14366
|
PatchSchema,
|
|
13867
14367
|
PointedAtSchema,
|
|
@@ -13898,10 +14398,13 @@ export {
|
|
|
13898
14398
|
SDK_VERSION_PATTERN,
|
|
13899
14399
|
SELECTION_ORIGIN_VISITOR,
|
|
13900
14400
|
SESSION_UNAVAILABLE_CLOSE,
|
|
14401
|
+
SETTLE_PULSE,
|
|
13901
14402
|
SIGNAL_PATCH_PREFIX,
|
|
13902
14403
|
SOCKET_BEARER_SUBPROTOCOL_PREFIX,
|
|
13903
14404
|
SOCKET_SUBPROTOCOL,
|
|
13904
14405
|
SOCKET_TICKET_PARAM,
|
|
14406
|
+
SPACE_DESCRIPTION_MAX_CHARS,
|
|
14407
|
+
SPACE_SHARE_QUERY_MAX_CHARS,
|
|
13905
14408
|
STRUCTURAL_BASELINE_CATALOG,
|
|
13906
14409
|
STRUCTURAL_BASELINE_TYPES,
|
|
13907
14410
|
SUPPORTED_SPACE_LOCALES,
|
|
@@ -13940,8 +14443,10 @@ export {
|
|
|
13940
14443
|
SpaceAgentDirectiveSchema,
|
|
13941
14444
|
SpaceBrandMarkSchema,
|
|
13942
14445
|
SpaceBugSchema,
|
|
14446
|
+
SpaceDescriptionSchema,
|
|
13943
14447
|
SpaceLocaleProvider,
|
|
13944
14448
|
SpaceLocaleSchema,
|
|
14449
|
+
SpaceShareQuerySchema,
|
|
13945
14450
|
Spacefront,
|
|
13946
14451
|
SpacefrontCanvas,
|
|
13947
14452
|
SpacefrontPreviewProvider,
|
|
@@ -13977,6 +14482,8 @@ export {
|
|
|
13977
14482
|
VIEW_HOST_SIGNAL,
|
|
13978
14483
|
VISITOR_ACCESS,
|
|
13979
14484
|
VISITOR_CONTEXT_SIGNAL,
|
|
14485
|
+
VISITOR_COUNTRY_CHOICE_NAMESPACE,
|
|
14486
|
+
VISITOR_COUNTRY_OBSERVED_NAMESPACE,
|
|
13980
14487
|
VISITOR_ID_DURABILITIES,
|
|
13981
14488
|
VISITOR_NAME_SIGNAL,
|
|
13982
14489
|
VideoSourceSchema,
|
|
@@ -13985,6 +14492,7 @@ export {
|
|
|
13985
14492
|
ViewportFocusSchema,
|
|
13986
14493
|
ViewportWindowContext,
|
|
13987
14494
|
ViewportWindowProvider,
|
|
14495
|
+
VisitorCountryStateSchema,
|
|
13988
14496
|
VisitorIdDurabilitySchema,
|
|
13989
14497
|
WIRE_PROTOCOL_PARAM,
|
|
13990
14498
|
WIRE_PROTOCOL_UNSUPPORTED_CLOSE,
|
|
@@ -13994,6 +14502,8 @@ export {
|
|
|
13994
14502
|
WireCatalogSchema,
|
|
13995
14503
|
WireSchemaSchema,
|
|
13996
14504
|
WishlistSnapshotSchema,
|
|
14505
|
+
XHandleSchema,
|
|
14506
|
+
X_HANDLE_PATTERN,
|
|
13997
14507
|
adaptCatalogComponent,
|
|
13998
14508
|
adaptComponent,
|
|
13999
14509
|
anchorLineOf,
|
|
@@ -14005,6 +14515,7 @@ export {
|
|
|
14005
14515
|
arrivalToParams,
|
|
14006
14516
|
attachmentFailureOfStatus,
|
|
14007
14517
|
bareComponentType,
|
|
14518
|
+
bareXHandle,
|
|
14008
14519
|
bearerFromSocketProtocols,
|
|
14009
14520
|
boardLabelKey,
|
|
14010
14521
|
buildBaseAttributesConfig,
|
|
@@ -14034,6 +14545,7 @@ export {
|
|
|
14034
14545
|
clearAgentPresence,
|
|
14035
14546
|
clearBuyerSignIns,
|
|
14036
14547
|
clearCartActionFailures,
|
|
14548
|
+
clearCatalogProductLookups,
|
|
14037
14549
|
clearCatalogSearches,
|
|
14038
14550
|
clearCodeDiscountSources,
|
|
14039
14551
|
clearProductFieldReaders,
|
|
@@ -14058,10 +14570,12 @@ export {
|
|
|
14058
14570
|
computeActiveChips,
|
|
14059
14571
|
consentDisposition,
|
|
14060
14572
|
consumeArmedCheckoutHandoff,
|
|
14573
|
+
conversationKeyOf,
|
|
14061
14574
|
createAliasedRegistry,
|
|
14062
14575
|
createAnalyticsScope,
|
|
14063
14576
|
createLocalStorageAdapter,
|
|
14064
14577
|
createMemoryStorageAdapter,
|
|
14578
|
+
createPageClaimRegistry,
|
|
14065
14579
|
createRegistry,
|
|
14066
14580
|
createSessionStorageAdapter,
|
|
14067
14581
|
createTokenOverlapScorer,
|
|
@@ -14114,6 +14628,7 @@ export {
|
|
|
14114
14628
|
installmentPayment,
|
|
14115
14629
|
isActiveDirective,
|
|
14116
14630
|
isAllowedAttachmentType,
|
|
14631
|
+
isCountryCode,
|
|
14117
14632
|
isDeclaredProductField,
|
|
14118
14633
|
isDegenerateLayout,
|
|
14119
14634
|
isDiscountCodeQueued,
|
|
@@ -14155,6 +14670,7 @@ export {
|
|
|
14155
14670
|
pagePlace,
|
|
14156
14671
|
parseBcp47Locale,
|
|
14157
14672
|
parseReleasePreview,
|
|
14673
|
+
percentOff,
|
|
14158
14674
|
pickCartAddAction,
|
|
14159
14675
|
pickCollectionAction,
|
|
14160
14676
|
pickProductCardAction,
|
|
@@ -14167,6 +14683,7 @@ export {
|
|
|
14167
14683
|
previewBoardEdit,
|
|
14168
14684
|
primedEntities,
|
|
14169
14685
|
primedEntitiesFor,
|
|
14686
|
+
productDetailAddResult,
|
|
14170
14687
|
productTypeBucket,
|
|
14171
14688
|
projectCollection,
|
|
14172
14689
|
projectProduct,
|
|
@@ -14193,6 +14710,7 @@ export {
|
|
|
14193
14710
|
reducePatch,
|
|
14194
14711
|
refuseCheckoutHandoff,
|
|
14195
14712
|
registerBuyerSignIn,
|
|
14713
|
+
registerCatalogProductLookup,
|
|
14196
14714
|
registerCatalogSearch,
|
|
14197
14715
|
registerChipRelevanceRule,
|
|
14198
14716
|
registerCodeDiscountSource,
|
|
@@ -14228,6 +14746,7 @@ export {
|
|
|
14228
14746
|
requiredTopLevelProps,
|
|
14229
14747
|
resetServerState,
|
|
14230
14748
|
resolveBuyerSignIn,
|
|
14749
|
+
resolveCatalogProductLookup,
|
|
14231
14750
|
resolveCatalogSearch,
|
|
14232
14751
|
resolveCodeDiscountSource,
|
|
14233
14752
|
resolveHydrators,
|
|
@@ -14274,7 +14793,9 @@ export {
|
|
|
14274
14793
|
settledBlocks,
|
|
14275
14794
|
settledCart,
|
|
14276
14795
|
socketProtocolsFor,
|
|
14796
|
+
spaceDescriptionOf,
|
|
14277
14797
|
spaceLocaleOf,
|
|
14798
|
+
spaceShareOf,
|
|
14278
14799
|
splitAnswer,
|
|
14279
14800
|
splitSentences,
|
|
14280
14801
|
stateSnapshotSignal,
|
|
@@ -14331,6 +14852,7 @@ export {
|
|
|
14331
14852
|
useCartLineRow,
|
|
14332
14853
|
useCartView,
|
|
14333
14854
|
useCheckoutHandoff,
|
|
14855
|
+
useClaimPage,
|
|
14334
14856
|
useClampToggle,
|
|
14335
14857
|
useCollectionByHandle,
|
|
14336
14858
|
useCommerceActions,
|
|
@@ -14461,6 +14983,7 @@ export {
|
|
|
14461
14983
|
useVariantSelections,
|
|
14462
14984
|
useViewportWindow,
|
|
14463
14985
|
useVisibleFactList,
|
|
14986
|
+
useVisitorCountry,
|
|
14464
14987
|
useVisitorName,
|
|
14465
14988
|
useVoiceCapture,
|
|
14466
14989
|
useWaitingSubmitOrigin,
|
|
@@ -14471,6 +14994,7 @@ export {
|
|
|
14471
14994
|
variantForSelections,
|
|
14472
14995
|
viewportRectOf,
|
|
14473
14996
|
visitorAccessOf,
|
|
14997
|
+
visitorCountryInEffect,
|
|
14474
14998
|
wipePhases,
|
|
14475
14999
|
wipeProfile,
|
|
14476
15000
|
withCartActorOrigin,
|
|
@@ -14478,5 +15002,5 @@ export {
|
|
|
14478
15002
|
withQueuedDiscountCodes,
|
|
14479
15003
|
withSignalTurn,
|
|
14480
15004
|
withoutClosingQuestion,
|
|
14481
|
-
|
|
15005
|
+
z58 as z
|
|
14482
15006
|
};
|