@40rty/ams-sdk 0.5.21 → 0.5.23
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 +909 -654
- package/dist/types/ecommerce/src/buyer-sign-in.d.ts +2 -0
- package/dist/types/ecommerce/src/index.d.ts +1 -0
- package/dist/types/ecommerce/src/product-sections.d.ts +41 -0
- package/dist/types/sdk/src/canvas/index.d.ts +1 -1
- package/dist/types/sdk/src/canvas/runtime-hooks.d.ts +4 -0
- package/dist/types/sdk/src/canvas/runtime-types.d.ts +3 -0
- package/dist/types/sdk/src/client-state/index.d.ts +1 -1
- package/dist/types/sdk/src/client-state/server-store.d.ts +3 -0
- package/dist/types/sdk/src/host/host-modules.d.ts +466 -26
- package/dist/types/sdk/src/session/FourtySessionContext.d.ts +7 -1
- package/dist/types/sdk/src/session/index.d.ts +2 -0
- package/dist/types/sdk/src/session/use-board.d.ts +19 -0
- package/dist/types/sdk/src/verticals/commerce/commerce-context.d.ts +4 -9
- package/dist/types/sdk/src/verticals/commerce/commerce-shapes.d.ts +6 -0
- package/dist/types/sdk/src/verticals/commerce/index.d.ts +3 -2
- package/dist/types/sdk/src/verticals/commerce/product-data-hooks.d.ts +12 -0
- package/dist/types/spacestation/src/analytics/ecommerce/funnel.d.ts +6 -2
- package/dist/types/spacestation/src/board/board.d.ts +427 -0
- package/dist/types/spacestation/src/contracts/session-arrival-params.d.ts +6 -0
- package/dist/types/spacestation/src/contracts/session-arrival.d.ts +9 -0
- package/dist/types/spacestation/src/contracts/wire-protocol.d.ts +7 -0
- package/dist/types/spacestation/src/index.d.ts +6 -4
- package/dist/types/spacestation/src/signal/agent-signals.d.ts +3 -0
- package/dist/types/spacestation/src/space/session-queue.d.ts +33 -18
- package/dist/types/spacestation/src/space/trace.d.ts +56 -4
- package/dist/types/spacestation/src/trace/trace-diagnostics.d.ts +14 -0
- package/dist/types/spacestation/src/widgets/presence/profile.d.ts +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defNormalProp = (obj, key,
|
|
3
|
+
var __defNormalProp = (obj, key, value2) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value: value2 }) : obj[key] = value2;
|
|
4
4
|
var __export = (target, all) => {
|
|
5
5
|
for (var name in all)
|
|
6
6
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
7
7
|
};
|
|
8
|
-
var __publicField = (obj, key,
|
|
8
|
+
var __publicField = (obj, key, value2) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value2);
|
|
9
9
|
|
|
10
10
|
// src/index.ts
|
|
11
11
|
var src_exports3 = {};
|
|
@@ -41,9 +41,21 @@ __export(src_exports3, {
|
|
|
41
41
|
AttributeScopeBucketSchema: () => AttributeScopeBucketSchema,
|
|
42
42
|
AttributeScopeConfigSchema: () => AttributeScopeConfigSchema,
|
|
43
43
|
AvailabilityStatusSchema: () => AvailabilityStatusSchema,
|
|
44
|
+
BOARD_MAX_FACTS: () => BOARD_MAX_FACTS,
|
|
45
|
+
BOARD_MAX_ITEMS: () => BOARD_MAX_ITEMS,
|
|
46
|
+
BOARD_NAMESPACE: () => BOARD_NAMESPACE,
|
|
47
|
+
BOARD_NAME_MAX: () => BOARD_NAME_MAX,
|
|
48
|
+
BOARD_TITLE_MAX: () => BOARD_TITLE_MAX,
|
|
44
49
|
BRAND_MARK_MAX_BYTES: () => BRAND_MARK_MAX_BYTES,
|
|
45
50
|
BRAND_MARK_SLOTS: () => BRAND_MARK_SLOTS,
|
|
46
51
|
BRAND_MARK_TYPES: () => BRAND_MARK_TYPES,
|
|
52
|
+
BoardEditSchema: () => BoardEditSchema,
|
|
53
|
+
BoardFactSchema: () => BoardFactSchema,
|
|
54
|
+
BoardItemSchema: () => BoardItemSchema,
|
|
55
|
+
BoardMemberSchema: () => BoardMemberSchema,
|
|
56
|
+
BoardProjectionSchema: () => BoardProjectionSchema,
|
|
57
|
+
BoardShareSchema: () => BoardShareSchema,
|
|
58
|
+
BoardStateSchema: () => BoardStateSchema,
|
|
47
59
|
BotCheckNoticeProvider: () => BotCheckNoticeProvider,
|
|
48
60
|
BotCheckNoticeSchema: () => BotCheckNoticeSchema,
|
|
49
61
|
BrandMarkImageSchema: () => BrandMarkImageSchema,
|
|
@@ -138,6 +150,7 @@ __export(src_exports3, {
|
|
|
138
150
|
EntryContextSchema: () => EntryContextSchema,
|
|
139
151
|
EntryContextValueSchema: () => EntryContextValueSchema,
|
|
140
152
|
FACT_SHAPE: () => FACT_SHAPE,
|
|
153
|
+
FEED_QUESTION_FLOW: () => FEED_QUESTION_FLOW,
|
|
141
154
|
FEED_SECTION_FLOW: () => FEED_SECTION_FLOW,
|
|
142
155
|
FLOW_OUTPUT_SIGNAL: () => FLOW_OUTPUT_SIGNAL,
|
|
143
156
|
FUNNEL_STEPS: () => FUNNEL_STEPS,
|
|
@@ -169,6 +182,7 @@ __export(src_exports3, {
|
|
|
169
182
|
ItemTransitionGroup: () => ItemTransitionGroup,
|
|
170
183
|
JSON_PATCH_OPS: () => JSON_PATCH_OPS,
|
|
171
184
|
JsonPatchOpSchema: () => JsonPatchOpSchema,
|
|
185
|
+
LANDING_PATH_PARAM: () => LANDING_PATH_PARAM,
|
|
172
186
|
LateBoundValueSchema: () => LateBoundValueSchema,
|
|
173
187
|
LlmSessionsDailySchema: () => LlmSessionsDailySchema,
|
|
174
188
|
LlmUsageBySessionSchema: () => LlmUsageBySessionSchema,
|
|
@@ -193,6 +207,8 @@ __export(src_exports3, {
|
|
|
193
207
|
PRESENCE_OPTIMISTIC_FACTS_FLOW: () => PRESENCE_OPTIMISTIC_FACTS_FLOW,
|
|
194
208
|
PRODUCTS_SURFACED: () => PRODUCTS_SURFACED,
|
|
195
209
|
PRODUCT_REVIEWS_RESOLVER_KEY: () => PRODUCT_REVIEWS_RESOLVER_KEY,
|
|
210
|
+
PRODUCT_SECTION_ID_PATTERN: () => PRODUCT_SECTION_ID_PATTERN,
|
|
211
|
+
PRODUCT_SECTION_MAX_CHARS: () => PRODUCT_SECTION_MAX_CHARS,
|
|
196
212
|
PRODUCT_SELECT_OPTION_SIGNAL: () => PRODUCT_SELECT_OPTION_SIGNAL,
|
|
197
213
|
PRODUCT_VARIANTS_SCOPE: () => PRODUCT_VARIANTS_SCOPE,
|
|
198
214
|
PROJECTION_SET_SIGNAL: () => PROJECTION_SET_SIGNAL,
|
|
@@ -215,6 +231,7 @@ __export(src_exports3, {
|
|
|
215
231
|
ProjectionPreferencesSchema: () => ProjectionPreferencesSchema,
|
|
216
232
|
ProjectionSetPayloadSchema: () => ProjectionSetPayloadSchema,
|
|
217
233
|
ProjectionSignalBridge: () => ProjectionSignalBridge,
|
|
234
|
+
QueueSortKeySchema: () => QueueSortKeySchema,
|
|
218
235
|
REACTIONS_NAMESPACE: () => REACTIONS_NAMESPACE,
|
|
219
236
|
REFERRER_HOST_PARAM: () => REFERRER_HOST_PARAM,
|
|
220
237
|
REGISTRY_CLICKED: () => REGISTRY_CLICKED,
|
|
@@ -233,6 +250,7 @@ __export(src_exports3, {
|
|
|
233
250
|
SDK_SHIMS: () => SDK_SHIMS,
|
|
234
251
|
SDK_VERSION_PATTERN: () => SDK_VERSION_PATTERN,
|
|
235
252
|
SELECTION_ORIGIN_VISITOR: () => SELECTION_ORIGIN_VISITOR,
|
|
253
|
+
SESSION_UNAVAILABLE_CLOSE: () => SESSION_UNAVAILABLE_CLOSE,
|
|
236
254
|
SIGNAL_PATCH_PREFIX: () => SIGNAL_PATCH_PREFIX,
|
|
237
255
|
SOCKET_BEARER_SUBPROTOCOL_PREFIX: () => SOCKET_BEARER_SUBPROTOCOL_PREFIX,
|
|
238
256
|
SOCKET_SUBPROTOCOL: () => SOCKET_SUBPROTOCOL,
|
|
@@ -340,6 +358,7 @@ __export(src_exports3, {
|
|
|
340
358
|
attachmentFailureOfStatus: () => attachmentFailureOfStatus,
|
|
341
359
|
bareComponentType: () => bareComponentType,
|
|
342
360
|
bearerFromSocketProtocols: () => bearerFromSocketProtocols,
|
|
361
|
+
boardLabelKey: () => boardLabelKey,
|
|
343
362
|
buildBaseAttributesConfig: () => buildBaseAttributesConfig,
|
|
344
363
|
buildBucketLabelsConfig: () => buildBucketLabelsConfig,
|
|
345
364
|
buildComparisonRows: () => buildComparisonRows,
|
|
@@ -348,6 +367,7 @@ __export(src_exports3, {
|
|
|
348
367
|
buildOptimisticCartLine: () => buildOptimisticCartLine,
|
|
349
368
|
buildPdpCompanionsConfig: () => buildPdpCompanionsConfig,
|
|
350
369
|
buildProductFieldsConfig: () => buildProductFieldsConfig,
|
|
370
|
+
buildProductSectionsConfig: () => buildProductSectionsConfig,
|
|
351
371
|
buildWipeVariants: () => buildWipeVariants,
|
|
352
372
|
canonicalOptionValue: () => canonicalOptionValue,
|
|
353
373
|
carriesShapeToken: () => carriesShapeToken,
|
|
@@ -370,6 +390,7 @@ __export(src_exports3, {
|
|
|
370
390
|
clearCodeDiscountSources: () => clearCodeDiscountSources,
|
|
371
391
|
clearProductFieldReaders: () => clearProductFieldReaders,
|
|
372
392
|
clearProductNameLookups: () => clearProductNameLookups,
|
|
393
|
+
clearProductSectionReaders: () => clearProductSectionReaders,
|
|
373
394
|
clearShopCheckouts: () => clearShopCheckouts,
|
|
374
395
|
clearStoreArticleLookups: () => clearStoreArticleLookups,
|
|
375
396
|
clearStoreThemeSources: () => clearStoreThemeSources,
|
|
@@ -493,6 +514,7 @@ __export(src_exports3, {
|
|
|
493
514
|
preselectFromFacts: () => preselectFromFacts,
|
|
494
515
|
presenceFactShape: () => presenceFactShape,
|
|
495
516
|
presenceReducer: () => presenceReducer,
|
|
517
|
+
previewBoardEdit: () => previewBoardEdit,
|
|
496
518
|
primedEntities: () => primedEntities,
|
|
497
519
|
primedEntitiesFor: () => primedEntitiesFor,
|
|
498
520
|
productTypeBucket: () => productTypeBucket,
|
|
@@ -512,6 +534,7 @@ __export(src_exports3, {
|
|
|
512
534
|
readOptionAxes: () => readOptionAxes,
|
|
513
535
|
readPdpCompanions: () => readPdpCompanions,
|
|
514
536
|
readProductFieldsConfig: () => readProductFieldsConfig,
|
|
537
|
+
readProductSectionsConfig: () => readProductSectionsConfig,
|
|
515
538
|
readQueuedDiscountCodes: () => readQueuedDiscountCodes,
|
|
516
539
|
recordCartActionFailure: () => recordCartActionFailure,
|
|
517
540
|
recordOptionSelections: () => recordOptionSelections,
|
|
@@ -536,6 +559,7 @@ __export(src_exports3, {
|
|
|
536
559
|
registerProductFieldReader: () => registerProductFieldReader,
|
|
537
560
|
registerProductFieldSource: () => registerProductFieldSource,
|
|
538
561
|
registerProductNameLookup: () => registerProductNameLookup,
|
|
562
|
+
registerProductSectionReader: () => registerProductSectionReader,
|
|
539
563
|
registerServiceHydrators: () => registerServiceHydrators,
|
|
540
564
|
registerSessionScopedClear: () => registerSessionScopedClear,
|
|
541
565
|
registerShopCheckout: () => registerShopCheckout,
|
|
@@ -562,6 +586,7 @@ __export(src_exports3, {
|
|
|
562
586
|
resolveProductFieldReader: () => resolveProductFieldReader,
|
|
563
587
|
resolveProductFieldSource: () => resolveProductFieldSource,
|
|
564
588
|
resolveProductNameLookup: () => resolveProductNameLookup,
|
|
589
|
+
resolveProductSectionReader: () => resolveProductSectionReader,
|
|
565
590
|
resolveProductVariant: () => resolveProductVariant,
|
|
566
591
|
resolveScope: () => resolveScope,
|
|
567
592
|
resolveServiceHydrators: () => resolveServiceHydrators,
|
|
@@ -587,6 +612,7 @@ __export(src_exports3, {
|
|
|
587
612
|
selectedOptionsToRecord: () => selectedOptionsToRecord,
|
|
588
613
|
serverState: () => serverState,
|
|
589
614
|
serverStateEntries: () => serverStateEntries,
|
|
615
|
+
serverStateRev: () => serverStateRev,
|
|
590
616
|
serverStateVector: () => serverStateVector,
|
|
591
617
|
setAgentPresenceFrame: () => setAgentPresenceFrame,
|
|
592
618
|
setCanvasProfile: () => setCanvasProfile,
|
|
@@ -632,6 +658,7 @@ __export(src_exports3, {
|
|
|
632
658
|
useAnalyticsSink: () => useAnalyticsSink,
|
|
633
659
|
useAskAbout: () => useAskAbout,
|
|
634
660
|
useAskStore: () => useAskStore,
|
|
661
|
+
useBoard: () => useBoard,
|
|
635
662
|
useBotCheckNotice: () => useBotCheckNotice,
|
|
636
663
|
useCanvasActions: () => useCanvasActions,
|
|
637
664
|
useCanvasArrangement: () => useCanvasArrangement,
|
|
@@ -735,6 +762,7 @@ __export(src_exports3, {
|
|
|
735
762
|
useProductGridFilter: () => useProductGridFilter,
|
|
736
763
|
useProductReviews: () => useProductReviews,
|
|
737
764
|
useProductSearch: () => useProductSearch,
|
|
765
|
+
useProductSection: () => useProductSection,
|
|
738
766
|
useProducts: () => useProducts,
|
|
739
767
|
useProjection: () => useProjection,
|
|
740
768
|
usePromptComposer: () => usePromptComposer,
|
|
@@ -750,6 +778,7 @@ __export(src_exports3, {
|
|
|
750
778
|
useScanning: () => useScanning,
|
|
751
779
|
useScrollContainerRef: () => useScrollContainerRef,
|
|
752
780
|
useScrollHasMoreBelow: () => useScrollHasMoreBelow,
|
|
781
|
+
useSeedLayout: () => useSeedLayout,
|
|
753
782
|
useSelectMessage: () => useSelectMessage,
|
|
754
783
|
useSessionId: () => useSessionId,
|
|
755
784
|
useSessionMessages: () => useSessionMessages,
|
|
@@ -880,23 +909,23 @@ function eventCatalog(...kinds) {
|
|
|
880
909
|
}
|
|
881
910
|
};
|
|
882
911
|
}
|
|
883
|
-
function accepts(catalog,
|
|
884
|
-
if (typeof
|
|
885
|
-
const name = Reflect.get(
|
|
912
|
+
function accepts(catalog, value2, emittableOnly) {
|
|
913
|
+
if (typeof value2 !== "object" || value2 === null || Array.isArray(value2)) return false;
|
|
914
|
+
const name = Reflect.get(value2, "kind");
|
|
886
915
|
if (typeof name !== "string" || name.length === 0) return false;
|
|
887
916
|
const found = catalog.lookup(name);
|
|
888
917
|
if (found === null) return false;
|
|
889
918
|
if (emittableOnly && found.trust !== "client") return false;
|
|
890
|
-
const payload = Reflect.get(
|
|
919
|
+
const payload = Reflect.get(value2, "payload");
|
|
891
920
|
return found.schema.safeParse(payload).success;
|
|
892
921
|
}
|
|
893
922
|
function catalogEventSchema(catalog) {
|
|
894
|
-
return z2.custom((
|
|
923
|
+
return z2.custom((value2) => accepts(catalog, value2, false), {
|
|
895
924
|
message: "Not a registered analytics event kind, or the payload does not match its schema"
|
|
896
925
|
});
|
|
897
926
|
}
|
|
898
927
|
function catalogEmittableSchema(catalog) {
|
|
899
|
-
return z2.custom((
|
|
928
|
+
return z2.custom((value2) => accepts(catalog, value2, true), {
|
|
900
929
|
message: "Not a registered, browser-emittable analytics event kind, or the payload does not match its schema"
|
|
901
930
|
});
|
|
902
931
|
}
|
|
@@ -1048,8 +1077,8 @@ function consentDisposition(consent) {
|
|
|
1048
1077
|
}
|
|
1049
1078
|
|
|
1050
1079
|
// src/analytics/outbox.ts
|
|
1051
|
-
function isWirePayload(
|
|
1052
|
-
return typeof
|
|
1080
|
+
function isWirePayload(value2) {
|
|
1081
|
+
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
|
|
1053
1082
|
}
|
|
1054
1083
|
function isAttributed(row) {
|
|
1055
1084
|
return row.sessionId !== null;
|
|
@@ -1548,6 +1577,7 @@ __export(session_exports, {
|
|
|
1548
1577
|
registerSessionScopedClear: () => registerSessionScopedClear,
|
|
1549
1578
|
runSessionScopedClearHandlers: () => runSessionScopedClearHandlers,
|
|
1550
1579
|
useAction: () => useAction,
|
|
1580
|
+
useBoard: () => useBoard,
|
|
1551
1581
|
useComposerDraft: () => useComposerDraft,
|
|
1552
1582
|
useFourtySession: () => useFourtySession,
|
|
1553
1583
|
useOptionalFourtySession: () => useOptionalFourtySession,
|
|
@@ -1584,9 +1614,21 @@ __export(src_exports, {
|
|
|
1584
1614
|
AttributeDefSchema: () => AttributeDefSchema,
|
|
1585
1615
|
AttributeScopeBucketSchema: () => AttributeScopeBucketSchema,
|
|
1586
1616
|
AttributeScopeConfigSchema: () => AttributeScopeConfigSchema,
|
|
1617
|
+
BOARD_MAX_FACTS: () => BOARD_MAX_FACTS,
|
|
1618
|
+
BOARD_MAX_ITEMS: () => BOARD_MAX_ITEMS,
|
|
1619
|
+
BOARD_NAMESPACE: () => BOARD_NAMESPACE,
|
|
1620
|
+
BOARD_NAME_MAX: () => BOARD_NAME_MAX,
|
|
1621
|
+
BOARD_TITLE_MAX: () => BOARD_TITLE_MAX,
|
|
1587
1622
|
BRAND_MARK_MAX_BYTES: () => BRAND_MARK_MAX_BYTES,
|
|
1588
1623
|
BRAND_MARK_SLOTS: () => BRAND_MARK_SLOTS,
|
|
1589
1624
|
BRAND_MARK_TYPES: () => BRAND_MARK_TYPES,
|
|
1625
|
+
BoardEditSchema: () => BoardEditSchema,
|
|
1626
|
+
BoardFactSchema: () => BoardFactSchema,
|
|
1627
|
+
BoardItemSchema: () => BoardItemSchema,
|
|
1628
|
+
BoardMemberSchema: () => BoardMemberSchema,
|
|
1629
|
+
BoardProjectionSchema: () => BoardProjectionSchema,
|
|
1630
|
+
BoardShareSchema: () => BoardShareSchema,
|
|
1631
|
+
BoardStateSchema: () => BoardStateSchema,
|
|
1590
1632
|
BotCheckNoticeSchema: () => BotCheckNoticeSchema,
|
|
1591
1633
|
BrandMarkImageSchema: () => BrandMarkImageSchema,
|
|
1592
1634
|
BrandMarkSchema: () => BrandMarkSchema,
|
|
@@ -1637,6 +1679,7 @@ __export(src_exports, {
|
|
|
1637
1679
|
EntryContextNamespaceSchema: () => EntryContextNamespaceSchema,
|
|
1638
1680
|
EntryContextSchema: () => EntryContextSchema,
|
|
1639
1681
|
EntryContextValueSchema: () => EntryContextValueSchema,
|
|
1682
|
+
FEED_QUESTION_FLOW: () => FEED_QUESTION_FLOW,
|
|
1640
1683
|
FEED_SECTION_FLOW: () => FEED_SECTION_FLOW,
|
|
1641
1684
|
FLOW_OUTPUT_SIGNAL: () => FLOW_OUTPUT_SIGNAL,
|
|
1642
1685
|
FileBugInputSchema: () => FileBugInputSchema,
|
|
@@ -1650,6 +1693,7 @@ __export(src_exports, {
|
|
|
1650
1693
|
InteractionSignalSchema: () => InteractionSignalSchema,
|
|
1651
1694
|
JSON_PATCH_OPS: () => JSON_PATCH_OPS,
|
|
1652
1695
|
JsonPatchOpSchema: () => JsonPatchOpSchema,
|
|
1696
|
+
LANDING_PATH_PARAM: () => LANDING_PATH_PARAM,
|
|
1653
1697
|
LateBoundValueSchema: () => LateBoundValueSchema,
|
|
1654
1698
|
LlmSessionsDailySchema: () => LlmSessionsDailySchema,
|
|
1655
1699
|
LlmUsageBySessionSchema: () => LlmUsageBySessionSchema,
|
|
@@ -1679,6 +1723,7 @@ __export(src_exports, {
|
|
|
1679
1723
|
ProjectionDirectiveSchema: () => ProjectionDirectiveSchema,
|
|
1680
1724
|
ProjectionPreferencesSchema: () => ProjectionPreferencesSchema,
|
|
1681
1725
|
ProjectionSetPayloadSchema: () => ProjectionSetPayloadSchema,
|
|
1726
|
+
QueueSortKeySchema: () => QueueSortKeySchema,
|
|
1682
1727
|
REACTIONS_NAMESPACE: () => REACTIONS_NAMESPACE,
|
|
1683
1728
|
REFERRER_HOST_PARAM: () => REFERRER_HOST_PARAM,
|
|
1684
1729
|
RELEASE_MESSAGE_MAX: () => RELEASE_MESSAGE_MAX,
|
|
@@ -1692,6 +1737,7 @@ __export(src_exports, {
|
|
|
1692
1737
|
SDK_SHIMS: () => SDK_SHIMS,
|
|
1693
1738
|
SDK_VERSION_PATTERN: () => SDK_VERSION_PATTERN,
|
|
1694
1739
|
SELECTION_ORIGIN_VISITOR: () => SELECTION_ORIGIN_VISITOR,
|
|
1740
|
+
SESSION_UNAVAILABLE_CLOSE: () => SESSION_UNAVAILABLE_CLOSE,
|
|
1695
1741
|
SIGNAL_PATCH_PREFIX: () => SIGNAL_PATCH_PREFIX,
|
|
1696
1742
|
SOCKET_BEARER_SUBPROTOCOL_PREFIX: () => SOCKET_BEARER_SUBPROTOCOL_PREFIX,
|
|
1697
1743
|
SOCKET_SUBPROTOCOL: () => SOCKET_SUBPROTOCOL,
|
|
@@ -1770,6 +1816,7 @@ __export(src_exports, {
|
|
|
1770
1816
|
attachmentFailureOfStatus: () => attachmentFailureOfStatus,
|
|
1771
1817
|
bareComponentType: () => bareComponentType,
|
|
1772
1818
|
bearerFromSocketProtocols: () => bearerFromSocketProtocols,
|
|
1819
|
+
boardLabelKey: () => boardLabelKey,
|
|
1773
1820
|
canonicalOptionValue: () => canonicalOptionValue,
|
|
1774
1821
|
carriesShapeToken: () => carriesShapeToken,
|
|
1775
1822
|
catalogFromWire: () => catalogFromWire,
|
|
@@ -1818,6 +1865,7 @@ __export(src_exports, {
|
|
|
1818
1865
|
parseReleasePreview: () => parseReleasePreview,
|
|
1819
1866
|
placeBlocks: () => placeBlocks,
|
|
1820
1867
|
placedEntityRefsOf: () => placedEntityRefsOf,
|
|
1868
|
+
previewBoardEdit: () => previewBoardEdit,
|
|
1821
1869
|
projectCollection: () => projectCollection,
|
|
1822
1870
|
prose: () => prose,
|
|
1823
1871
|
readHosting: () => readHosting,
|
|
@@ -2074,6 +2122,7 @@ var DIRECTION_FLOW = "direction.standing";
|
|
|
2074
2122
|
var COMPANION_FLOW = "companion.note";
|
|
2075
2123
|
var GREETING_FLOW = "greeting.line";
|
|
2076
2124
|
var FEED_SECTION_FLOW = "feed.section";
|
|
2125
|
+
var FEED_QUESTION_FLOW = "feed.question";
|
|
2077
2126
|
var EPHEMERAL_FACT_FLOWS = [PRESENCE_FLOW, DIRECTION_FLOW];
|
|
2078
2127
|
|
|
2079
2128
|
// ../spacestation/src/shell/shell.ts
|
|
@@ -2153,7 +2202,7 @@ function kindOmits(kind, key) {
|
|
|
2153
2202
|
return omit !== void 0 && omit.has(key);
|
|
2154
2203
|
}
|
|
2155
2204
|
function pageIdentityKey(page) {
|
|
2156
|
-
const parts2 = Object.entries(page).filter(([key,
|
|
2205
|
+
const parts2 = Object.entries(page).filter(([key, value2]) => key !== "kind" && value2 !== void 0 && !PAGE_IDENTITY_OMIT.has(key) && !kindOmits(page.kind, key)).map(([key, value2]) => [key, String(value2)]).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([key, value2]) => `${key}=${value2}`);
|
|
2157
2206
|
return parts2.length === 0 ? page.kind : `${page.kind}:${parts2.join(",")}`;
|
|
2158
2207
|
}
|
|
2159
2208
|
|
|
@@ -2791,15 +2840,15 @@ function ownersAt(root, keys) {
|
|
|
2791
2840
|
for (const key of keys.slice(0, -1)) {
|
|
2792
2841
|
const next = [];
|
|
2793
2842
|
for (const owner of owners) {
|
|
2794
|
-
const
|
|
2795
|
-
if (isPlainObject(
|
|
2796
|
-
next.push({ container:
|
|
2843
|
+
const value2 = owner.container[key];
|
|
2844
|
+
if (isPlainObject(value2)) {
|
|
2845
|
+
next.push({ container: value2, indexInParent: -1 });
|
|
2797
2846
|
continue;
|
|
2798
2847
|
}
|
|
2799
|
-
if (!Array.isArray(
|
|
2800
|
-
for (let i = 0; i <
|
|
2801
|
-
const item =
|
|
2802
|
-
if (isPlainObject(item)) next.push({ container: item, parentArray:
|
|
2848
|
+
if (!Array.isArray(value2)) continue;
|
|
2849
|
+
for (let i = 0; i < value2.length; i++) {
|
|
2850
|
+
const item = value2[i];
|
|
2851
|
+
if (isPlainObject(item)) next.push({ container: item, parentArray: value2, indexInParent: i });
|
|
2803
2852
|
}
|
|
2804
2853
|
}
|
|
2805
2854
|
owners = next;
|
|
@@ -2813,27 +2862,27 @@ function collectPlacedEntityRefs(props, sites) {
|
|
|
2813
2862
|
const leaf = keys[keys.length - 1];
|
|
2814
2863
|
if (leaf === void 0) continue;
|
|
2815
2864
|
for (const owner of ownersAt(props, keys)) {
|
|
2816
|
-
const
|
|
2817
|
-
if (Array.isArray(
|
|
2818
|
-
for (const item of
|
|
2865
|
+
const value2 = owner.container[leaf];
|
|
2866
|
+
if (Array.isArray(value2)) {
|
|
2867
|
+
for (const item of value2) {
|
|
2819
2868
|
if (typeof item !== "string" || item.length === 0) continue;
|
|
2820
2869
|
placed.push({
|
|
2821
2870
|
site,
|
|
2822
2871
|
ref: item,
|
|
2823
2872
|
remove: () => {
|
|
2824
|
-
const at =
|
|
2825
|
-
if (at !== -1)
|
|
2873
|
+
const at = value2.indexOf(item);
|
|
2874
|
+
if (at !== -1) value2.splice(at, 1);
|
|
2826
2875
|
}
|
|
2827
2876
|
});
|
|
2828
2877
|
}
|
|
2829
2878
|
continue;
|
|
2830
2879
|
}
|
|
2831
|
-
if (typeof
|
|
2880
|
+
if (typeof value2 !== "string" || value2.length === 0) continue;
|
|
2832
2881
|
const required = site.meta.min !== void 0 && site.meta.min >= 1;
|
|
2833
2882
|
const isArrayElement = owner.parentArray !== void 0;
|
|
2834
2883
|
placed.push({
|
|
2835
2884
|
site,
|
|
2836
|
-
ref:
|
|
2885
|
+
ref: value2,
|
|
2837
2886
|
remove: () => {
|
|
2838
2887
|
if (isArrayElement && required && owner.parentArray !== void 0) {
|
|
2839
2888
|
const at = owner.parentArray.indexOf(owner.container);
|
|
@@ -2926,9 +2975,9 @@ function walk2(schema, path, when, out, visited) {
|
|
|
2926
2975
|
if (schema instanceof z19.ZodDiscriminatedUnion) {
|
|
2927
2976
|
const key = schema.discriminator;
|
|
2928
2977
|
for (const opt of schema.options) {
|
|
2929
|
-
const
|
|
2930
|
-
if (
|
|
2931
|
-
walk2(opt, path, [...when, { depth: path.length, key, value }], out, visited);
|
|
2978
|
+
const value2 = discriminatorValue(opt, key);
|
|
2979
|
+
if (value2 === void 0) continue;
|
|
2980
|
+
walk2(opt, path, [...when, { depth: path.length, key, value: value2 }], out, visited);
|
|
2932
2981
|
}
|
|
2933
2982
|
return;
|
|
2934
2983
|
}
|
|
@@ -2943,8 +2992,8 @@ function discriminatorValue(option, key) {
|
|
|
2943
2992
|
if (!(option instanceof z19.ZodObject)) return void 0;
|
|
2944
2993
|
const field = option.shape[key];
|
|
2945
2994
|
if (!(field instanceof z19.ZodLiteral)) return void 0;
|
|
2946
|
-
const
|
|
2947
|
-
return typeof
|
|
2995
|
+
const value2 = field.value;
|
|
2996
|
+
return typeof value2 === "string" ? value2 : void 0;
|
|
2948
2997
|
}
|
|
2949
2998
|
|
|
2950
2999
|
// ../spacestation/src/catalog/required-props.ts
|
|
@@ -2961,10 +3010,10 @@ function requiredTopLevelProps(schema) {
|
|
|
2961
3010
|
}
|
|
2962
3011
|
return out;
|
|
2963
3012
|
}
|
|
2964
|
-
function isEmptyPropValue(
|
|
2965
|
-
if (
|
|
2966
|
-
if (typeof
|
|
2967
|
-
if (Array.isArray(
|
|
3013
|
+
function isEmptyPropValue(value2) {
|
|
3014
|
+
if (value2 === void 0 || value2 === null) return true;
|
|
3015
|
+
if (typeof value2 === "string") return value2.trim().length === 0;
|
|
3016
|
+
if (Array.isArray(value2)) return value2.length === 0;
|
|
2968
3017
|
return false;
|
|
2969
3018
|
}
|
|
2970
3019
|
function isOptionalSchema(schema) {
|
|
@@ -3084,11 +3133,11 @@ function* expandInner(node, remaining, real) {
|
|
|
3084
3133
|
if (node === null || typeof node !== "object") return;
|
|
3085
3134
|
yield* expandInner(node[seg], rest, [...real, seg]);
|
|
3086
3135
|
}
|
|
3087
|
-
function normalizeRefs(
|
|
3088
|
-
if (typeof
|
|
3089
|
-
if (Array.isArray(
|
|
3136
|
+
function normalizeRefs(value2) {
|
|
3137
|
+
if (typeof value2 === "string") return [value2];
|
|
3138
|
+
if (Array.isArray(value2)) {
|
|
3090
3139
|
const out = [];
|
|
3091
|
-
for (const v of
|
|
3140
|
+
for (const v of value2) if (typeof v === "string") out.push(v);
|
|
3092
3141
|
return out;
|
|
3093
3142
|
}
|
|
3094
3143
|
return [];
|
|
@@ -3096,8 +3145,8 @@ function normalizeRefs(value) {
|
|
|
3096
3145
|
function derivedSourceFilled(meta, props) {
|
|
3097
3146
|
const source = meta.derivedFrom;
|
|
3098
3147
|
if (typeof source !== "string" || source.length === 0) return false;
|
|
3099
|
-
for (const
|
|
3100
|
-
if (
|
|
3148
|
+
for (const ref2 of normalizeRefs(props[source])) {
|
|
3149
|
+
if (ref2.length > 0) return true;
|
|
3101
3150
|
}
|
|
3102
3151
|
return false;
|
|
3103
3152
|
}
|
|
@@ -3114,8 +3163,8 @@ function isElementUnfilled(element, catalog, aliases, options) {
|
|
|
3114
3163
|
if (typeof top === "string" && isOptionalTopLevelProp(entry.propsSchema, top)) continue;
|
|
3115
3164
|
const expansions = Array.from(expandPath(props, path));
|
|
3116
3165
|
if (expansions.length === 0) return true;
|
|
3117
|
-
for (const { value } of expansions) {
|
|
3118
|
-
if (normalizeRefs(
|
|
3166
|
+
for (const { value: value2 } of expansions) {
|
|
3167
|
+
if (normalizeRefs(value2).length === 0) return true;
|
|
3119
3168
|
}
|
|
3120
3169
|
}
|
|
3121
3170
|
for (const prop of requiredTopLevelProps(entry.propsSchema)) {
|
|
@@ -3142,22 +3191,22 @@ function rendersNothing(spec, catalog, aliases) {
|
|
|
3142
3191
|
|
|
3143
3192
|
// ../spacestation/src/catalog/shape-tokens.ts
|
|
3144
3193
|
var SHAPE_TOKEN = /<(?![/!])[^<>=]*\s[^<>=]*(?<!\/)>/;
|
|
3145
|
-
function carriesShapeToken(
|
|
3146
|
-
if (typeof
|
|
3147
|
-
if (Array.isArray(
|
|
3148
|
-
if (typeof
|
|
3194
|
+
function carriesShapeToken(value2) {
|
|
3195
|
+
if (typeof value2 === "string") return SHAPE_TOKEN.test(value2);
|
|
3196
|
+
if (Array.isArray(value2)) return value2.some(carriesShapeToken);
|
|
3197
|
+
if (typeof value2 === "object" && value2 !== null) return Object.values(value2).some(carriesShapeToken);
|
|
3149
3198
|
return false;
|
|
3150
3199
|
}
|
|
3151
3200
|
|
|
3152
3201
|
// ../spacestation/src/layout/apply-patch.ts
|
|
3153
|
-
function arrayAdd(arr, key,
|
|
3202
|
+
function arrayAdd(arr, key, value2) {
|
|
3154
3203
|
if (key === "-") {
|
|
3155
|
-
arr.push(
|
|
3204
|
+
arr.push(value2);
|
|
3156
3205
|
return true;
|
|
3157
3206
|
}
|
|
3158
3207
|
const idx = Number(key);
|
|
3159
3208
|
if (!Number.isInteger(idx) || idx < 0 || idx > arr.length) return false;
|
|
3160
|
-
arr.splice(idx, 0,
|
|
3209
|
+
arr.splice(idx, 0, value2);
|
|
3161
3210
|
return true;
|
|
3162
3211
|
}
|
|
3163
3212
|
function arrayIndex(arr, key) {
|
|
@@ -3462,8 +3511,8 @@ function objectNode(schema, path) {
|
|
|
3462
3511
|
return { t: "object", shape, unknownKeys: schema._def.unknownKeys };
|
|
3463
3512
|
}
|
|
3464
3513
|
function literalNode(schema, path) {
|
|
3465
|
-
const
|
|
3466
|
-
if (typeof
|
|
3514
|
+
const value2 = schema.value;
|
|
3515
|
+
if (typeof value2 === "string" || typeof value2 === "number" || typeof value2 === "boolean") return { t: "literal", value: value2 };
|
|
3467
3516
|
throw new UnsupportedSchemaError(path, "only string, number and boolean literals are supported");
|
|
3468
3517
|
}
|
|
3469
3518
|
function bare(schema, path) {
|
|
@@ -3902,8 +3951,8 @@ function projectCollection(items, directive, acc) {
|
|
|
3902
3951
|
if (resolved2 === void 0) continue;
|
|
3903
3952
|
const target = norm(resolved2);
|
|
3904
3953
|
out = out.filter((item) => {
|
|
3905
|
-
const
|
|
3906
|
-
return
|
|
3954
|
+
const value2 = acc.axisValueOf(item, axis);
|
|
3955
|
+
return value2 !== void 0 && norm(value2) === target;
|
|
3907
3956
|
});
|
|
3908
3957
|
}
|
|
3909
3958
|
}
|
|
@@ -4061,6 +4110,11 @@ var SessionArrivalSchema = z37.object({
|
|
|
4061
4110
|
/** Host only — never a full URL. A path carries query strings, and query
|
|
4062
4111
|
* strings carry emails and order ids. Normalised server-side. */
|
|
4063
4112
|
referrerHost: ArrivalValueSchema.optional(),
|
|
4113
|
+
/** The PATH the visitor landed on (`/products/<handle>`), on a page the
|
|
4114
|
+
* spacefront owns — never its query, and never an embed's host page,
|
|
4115
|
+
* whose paths are the merchant's (and can carry order ids). Normalised
|
|
4116
|
+
* server-side. */
|
|
4117
|
+
landingPath: ArrivalValueSchema.optional(),
|
|
4064
4118
|
surface: SurfaceSchema.optional(),
|
|
4065
4119
|
visitorIdDurability: VisitorIdDurabilitySchema.optional()
|
|
4066
4120
|
}).strict().refine(
|
|
@@ -4077,6 +4131,7 @@ var UTM_PARAMS = [
|
|
|
4077
4131
|
["utm_term", "utmTerm"]
|
|
4078
4132
|
];
|
|
4079
4133
|
var REFERRER_HOST_PARAM = "referrer_host";
|
|
4134
|
+
var LANDING_PATH_PARAM = "landing_path";
|
|
4080
4135
|
var ARRIVAL_PARAMS = [
|
|
4081
4136
|
...UTM_PARAMS.map(([param]) => param),
|
|
4082
4137
|
...CLICK_ID_KINDS
|
|
@@ -4086,9 +4141,9 @@ function firstClickId(params) {
|
|
|
4086
4141
|
for (const kind of CLICK_ID_PRECEDENCE) {
|
|
4087
4142
|
const raw = params.get(kind);
|
|
4088
4143
|
if (raw === null) continue;
|
|
4089
|
-
const
|
|
4090
|
-
if (
|
|
4091
|
-
return { kind, value };
|
|
4144
|
+
const value2 = raw.trim();
|
|
4145
|
+
if (value2.length === 0) continue;
|
|
4146
|
+
return { kind, value: value2 };
|
|
4092
4147
|
}
|
|
4093
4148
|
return null;
|
|
4094
4149
|
}
|
|
@@ -4097,9 +4152,9 @@ function arrivalFromParams(evidence) {
|
|
|
4097
4152
|
for (const [param, field] of UTM_PARAMS) {
|
|
4098
4153
|
const raw = evidence.params.get(param);
|
|
4099
4154
|
if (raw === null) continue;
|
|
4100
|
-
const
|
|
4101
|
-
if (
|
|
4102
|
-
draft[field] =
|
|
4155
|
+
const value2 = raw.trim();
|
|
4156
|
+
if (value2.length === 0) continue;
|
|
4157
|
+
draft[field] = value2;
|
|
4103
4158
|
}
|
|
4104
4159
|
const click = firstClickId(evidence.params);
|
|
4105
4160
|
if (click !== null) {
|
|
@@ -4109,6 +4164,9 @@ function arrivalFromParams(evidence) {
|
|
|
4109
4164
|
if (evidence.referrerHost !== void 0 && evidence.referrerHost.length > 0) {
|
|
4110
4165
|
draft.referrerHost = evidence.referrerHost;
|
|
4111
4166
|
}
|
|
4167
|
+
if (evidence.landingPath !== void 0 && evidence.landingPath.length > 0) {
|
|
4168
|
+
draft.landingPath = evidence.landingPath;
|
|
4169
|
+
}
|
|
4112
4170
|
const hostFields = {
|
|
4113
4171
|
surface: evidence.surface,
|
|
4114
4172
|
...evidence.visitorIdDurability === void 0 ? {} : { visitorIdDurability: evidence.visitorIdDurability }
|
|
@@ -4123,13 +4181,14 @@ function arrivalFromParams(evidence) {
|
|
|
4123
4181
|
}
|
|
4124
4182
|
function arrivalToParams(arrival, into) {
|
|
4125
4183
|
for (const [param, field] of UTM_PARAMS) {
|
|
4126
|
-
const
|
|
4127
|
-
if (
|
|
4184
|
+
const value2 = arrival[field];
|
|
4185
|
+
if (value2 !== void 0) into.set(param, value2);
|
|
4128
4186
|
}
|
|
4129
4187
|
if (arrival.clickIdKind !== void 0 && arrival.clickId !== void 0) {
|
|
4130
4188
|
into.set(arrival.clickIdKind, arrival.clickId);
|
|
4131
4189
|
}
|
|
4132
4190
|
if (arrival.referrerHost !== void 0) into.set(REFERRER_HOST_PARAM, arrival.referrerHost);
|
|
4191
|
+
if (arrival.landingPath !== void 0) into.set(LANDING_PATH_PARAM, arrival.landingPath);
|
|
4133
4192
|
if (arrival.surface !== void 0) into.set("surface", arrival.surface);
|
|
4134
4193
|
if (arrival.visitorIdDurability !== void 0) into.set("visitorIdDurability", arrival.visitorIdDurability);
|
|
4135
4194
|
}
|
|
@@ -4161,6 +4220,7 @@ var WIRE_PROTOCOL_VERSION = 1;
|
|
|
4161
4220
|
var MIN_WIRE_PROTOCOL_VERSION = 1;
|
|
4162
4221
|
var WIRE_PROTOCOL_PARAM = "protocol";
|
|
4163
4222
|
var WIRE_PROTOCOL_UNSUPPORTED_CLOSE = 4426;
|
|
4223
|
+
var SESSION_UNAVAILABLE_CLOSE = 4404;
|
|
4164
4224
|
|
|
4165
4225
|
// ../spacestation/src/catalog/attribute-registry.ts
|
|
4166
4226
|
import { z as z38 } from "zod";
|
|
@@ -4364,8 +4424,8 @@ var DEFAULT_HOSTING = {
|
|
|
4364
4424
|
headless: true,
|
|
4365
4425
|
embedded: false
|
|
4366
4426
|
};
|
|
4367
|
-
function isRecord(
|
|
4368
|
-
return typeof
|
|
4427
|
+
function isRecord(value2) {
|
|
4428
|
+
return typeof value2 === "object" && value2 !== null;
|
|
4369
4429
|
}
|
|
4370
4430
|
function readHosting(platformConfigBag) {
|
|
4371
4431
|
const bag = isRecord(platformConfigBag) ? platformConfigBag : {};
|
|
@@ -4480,12 +4540,20 @@ var SessionTurnSchema = z42.object({
|
|
|
4480
4540
|
/** Full cumulative Spec committed by this turn — never a patch delta. */
|
|
4481
4541
|
layout: z42.unknown().nullable(),
|
|
4482
4542
|
createdAt: z42.string(),
|
|
4543
|
+
/** Turn start → first prose delta. Null on a turn that wrote no prose. */
|
|
4544
|
+
latencyFirstText: z42.number().int().nullable(),
|
|
4545
|
+
/** Turn start → first layout patch — the LAYOUT latency the session screen
|
|
4546
|
+
* grades against the budget. Null on a turn that patched nothing. */
|
|
4547
|
+
latencyFirstPatch: z42.number().int().nullable(),
|
|
4483
4548
|
latencyTotal: z42.number().int().nullable(),
|
|
4484
4549
|
phaseTimings: z42.record(z42.number()).nullable(),
|
|
4485
|
-
tokensByModel: z42.record(
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4550
|
+
tokensByModel: z42.record(RunTokenUsageSchema).nullable(),
|
|
4551
|
+
/**
|
|
4552
|
+
* The turn's tokens priced SERVER-side (`estimateCostUsd`), so the browser
|
|
4553
|
+
* never carries a rate table. Null when any model on the turn is unpriced —
|
|
4554
|
+
* never 0, which would read as free.
|
|
4555
|
+
*/
|
|
4556
|
+
estimatedCostUsd: z42.number().nullable(),
|
|
4489
4557
|
toolCalls: z42.array(z42.unknown()).nullable(),
|
|
4490
4558
|
diagnostics: z42.array(z42.unknown()).nullable()
|
|
4491
4559
|
});
|
|
@@ -4588,6 +4656,7 @@ var SessionActivitySchema = z43.object({
|
|
|
4588
4656
|
});
|
|
4589
4657
|
|
|
4590
4658
|
// ../spacestation/src/space/session-queue.ts
|
|
4659
|
+
var QueueSortKeySchema = z44.enum(["lastActive", "stage", "source", "location", "turns", "duration"]);
|
|
4591
4660
|
var SessionVerdictSchema = z44.enum(["unreviewed", "viewed", "bug"]);
|
|
4592
4661
|
var RecordableVerdictSchema = z44.enum(["viewed", "bug"]);
|
|
4593
4662
|
var SessionReviewEventSchema = z44.object({
|
|
@@ -4906,6 +4975,7 @@ var SessionCaptureInputSchema = z44.object({
|
|
|
4906
4975
|
var SessionArrivalRecordSchema = z44.object({
|
|
4907
4976
|
trafficBucket: z44.string().nullable(),
|
|
4908
4977
|
referrerHost: z44.string().nullable(),
|
|
4978
|
+
landingPath: z44.string().nullable(),
|
|
4909
4979
|
utmSource: z44.string().nullable(),
|
|
4910
4980
|
utmMedium: z44.string().nullable(),
|
|
4911
4981
|
utmCampaign: z44.string().nullable(),
|
|
@@ -4942,13 +5012,13 @@ var FileBugInputSchema = z44.object({
|
|
|
4942
5012
|
});
|
|
4943
5013
|
|
|
4944
5014
|
// ../spacestation/src/contracts/retrieval/ecommerce/option-values.ts
|
|
4945
|
-
function canonicalOptionValue(
|
|
4946
|
-
return
|
|
5015
|
+
function canonicalOptionValue(value2) {
|
|
5016
|
+
return value2.trim().toLowerCase();
|
|
4947
5017
|
}
|
|
4948
|
-
function statedValueVerdict(axes, axisName,
|
|
5018
|
+
function statedValueVerdict(axes, axisName, value2) {
|
|
4949
5019
|
const values = reportedAxisValues(axes, axisName);
|
|
4950
5020
|
if (values === void 0) return "unknown";
|
|
4951
|
-
const want = canonicalOptionValue(
|
|
5021
|
+
const want = canonicalOptionValue(value2);
|
|
4952
5022
|
return values.some((v) => canonicalOptionValue(v) === want) ? "carries" : "lacks";
|
|
4953
5023
|
}
|
|
4954
5024
|
function reportedAxisValues(axes, axisName) {
|
|
@@ -5121,6 +5191,69 @@ function stringifyForScoring(v) {
|
|
|
5121
5191
|
}
|
|
5122
5192
|
}
|
|
5123
5193
|
|
|
5194
|
+
// ../spacestation/src/board/board.ts
|
|
5195
|
+
import { z as z45 } from "zod";
|
|
5196
|
+
var BOARD_NAMESPACE = "board";
|
|
5197
|
+
var BOARD_MAX_FACTS = 12;
|
|
5198
|
+
var BOARD_MAX_ITEMS = 60;
|
|
5199
|
+
var BOARD_LABEL_MAX = 40;
|
|
5200
|
+
var BOARD_VALUE_MAX = 80;
|
|
5201
|
+
var BOARD_REF_MAX = 200;
|
|
5202
|
+
var BOARD_TITLE_MAX = 80;
|
|
5203
|
+
var BOARD_NAME_MAX = 40;
|
|
5204
|
+
var label = z45.string().trim().min(1).max(BOARD_LABEL_MAX);
|
|
5205
|
+
var value = z45.string().trim().min(1).max(BOARD_VALUE_MAX);
|
|
5206
|
+
var ref = z45.string().trim().min(1).max(BOARD_REF_MAX);
|
|
5207
|
+
var BoardFactSchema = z45.object({ label, value, by: z45.string().nullable(), mine: z45.boolean(), at: z45.number() });
|
|
5208
|
+
var BoardItemSchema = z45.object({ ref, by: z45.string().nullable(), mine: z45.boolean(), at: z45.number() });
|
|
5209
|
+
var BoardMemberSchema = z45.object({ name: z45.string().nullable(), owner: z45.boolean(), you: z45.boolean() });
|
|
5210
|
+
var BoardProjectionSchema = z45.object({
|
|
5211
|
+
title: z45.string(),
|
|
5212
|
+
invite: z45.string(),
|
|
5213
|
+
facts: z45.array(BoardFactSchema),
|
|
5214
|
+
items: z45.array(BoardItemSchema),
|
|
5215
|
+
members: z45.array(BoardMemberSchema),
|
|
5216
|
+
version: z45.number()
|
|
5217
|
+
});
|
|
5218
|
+
var BoardStateSchema = z45.union([
|
|
5219
|
+
z45.object({ joined: z45.literal(true), board: BoardProjectionSchema }),
|
|
5220
|
+
z45.object({ joined: z45.literal(false) })
|
|
5221
|
+
]);
|
|
5222
|
+
var BoardEditSchema = z45.discriminatedUnion("op", [
|
|
5223
|
+
z45.object({ op: z45.literal("fact.set"), label, value }),
|
|
5224
|
+
z45.object({ op: z45.literal("fact.clear"), label }),
|
|
5225
|
+
z45.object({ op: z45.literal("item.add"), ref }),
|
|
5226
|
+
z45.object({ op: z45.literal("item.remove"), ref })
|
|
5227
|
+
]);
|
|
5228
|
+
var BoardShareSchema = z45.object({
|
|
5229
|
+
title: z45.string().trim().max(BOARD_TITLE_MAX),
|
|
5230
|
+
facts: z45.array(z45.object({ label, value })).max(BOARD_MAX_FACTS),
|
|
5231
|
+
items: z45.array(ref).max(BOARD_MAX_ITEMS)
|
|
5232
|
+
});
|
|
5233
|
+
function boardLabelKey(l) {
|
|
5234
|
+
return l.trim().toLowerCase().replace(/\s+/g, " ");
|
|
5235
|
+
}
|
|
5236
|
+
function previewBoardEdit(board, edit, now) {
|
|
5237
|
+
const you = board.members.find((m) => m.you);
|
|
5238
|
+
const by = you === void 0 ? null : you.name;
|
|
5239
|
+
switch (edit.op) {
|
|
5240
|
+
case "fact.set": {
|
|
5241
|
+
const key = boardLabelKey(edit.label);
|
|
5242
|
+
const fact = { label: edit.label, value: edit.value, by, mine: true, at: now };
|
|
5243
|
+
const has = board.facts.some((f) => boardLabelKey(f.label) === key);
|
|
5244
|
+
return { ...board, facts: has ? board.facts.map((f) => boardLabelKey(f.label) === key ? fact : f) : [...board.facts, fact] };
|
|
5245
|
+
}
|
|
5246
|
+
case "fact.clear": {
|
|
5247
|
+
const key = boardLabelKey(edit.label);
|
|
5248
|
+
return { ...board, facts: board.facts.filter((f) => boardLabelKey(f.label) !== key) };
|
|
5249
|
+
}
|
|
5250
|
+
case "item.add":
|
|
5251
|
+
return board.items.some((i) => i.ref === edit.ref) ? board : { ...board, items: [...board.items, { ref: edit.ref, by, mine: true, at: now }] };
|
|
5252
|
+
case "item.remove":
|
|
5253
|
+
return { ...board, items: board.items.filter((i) => i.ref !== edit.ref) };
|
|
5254
|
+
}
|
|
5255
|
+
}
|
|
5256
|
+
|
|
5124
5257
|
// src/session/turn-attributed-session.ts
|
|
5125
5258
|
var TURN_ATTRIBUTED_SIGNALS = /* @__PURE__ */ new Set([CART_ADD_SIGNAL]);
|
|
5126
5259
|
function withSignalTurn(signal, turnId) {
|
|
@@ -5151,45 +5284,45 @@ function useOptionalFourtySession() {
|
|
|
5151
5284
|
}
|
|
5152
5285
|
function useComposerDraft() {
|
|
5153
5286
|
const { composerDraftStore, setComposerDraft } = useFourtySession();
|
|
5154
|
-
const
|
|
5287
|
+
const value2 = useSyncExternalStore(
|
|
5155
5288
|
composerDraftStore.subscribe,
|
|
5156
5289
|
composerDraftStore.get,
|
|
5157
5290
|
composerDraftStore.get
|
|
5158
5291
|
);
|
|
5159
|
-
return [
|
|
5292
|
+
return [value2, setComposerDraft];
|
|
5160
5293
|
}
|
|
5161
5294
|
|
|
5162
5295
|
// src/session/use-action.ts
|
|
5163
5296
|
import { useCallback } from "react";
|
|
5164
|
-
function useAction(
|
|
5297
|
+
function useAction(label2, action) {
|
|
5165
5298
|
const session = useOptionalFourtySession();
|
|
5166
5299
|
return useCallback(() => {
|
|
5167
5300
|
if (!session) return;
|
|
5168
5301
|
const dispatchable = action !== void 0 && isDispatchable(action);
|
|
5169
5302
|
if (action !== void 0 && !dispatchable) {
|
|
5170
5303
|
console.warn(
|
|
5171
|
-
`[useAction] "${
|
|
5304
|
+
`[useAction] "${label2}" carries an undispatchable ${action.type} action \u2014 falling back to message("${label2}")`,
|
|
5172
5305
|
action.payload
|
|
5173
5306
|
);
|
|
5174
5307
|
}
|
|
5175
5308
|
const resolved2 = dispatchable && action !== void 0 ? {
|
|
5176
|
-
id: action.id ?? `cta-${action.type}-${
|
|
5309
|
+
id: action.id ?? `cta-${action.type}-${label2}`,
|
|
5177
5310
|
// A control always has a visible label as its
|
|
5178
5311
|
// user-visible string; the action.label override is rare. Fall
|
|
5179
5312
|
// back to the control's own `label` prop so SuggestionAction's
|
|
5180
5313
|
// required `label` field is never undefined.
|
|
5181
|
-
label: action.label ??
|
|
5314
|
+
label: action.label ?? label2,
|
|
5182
5315
|
type: action.type,
|
|
5183
5316
|
payload: action.payload ?? {},
|
|
5184
5317
|
...action.icon ? { icon: action.icon } : {}
|
|
5185
5318
|
} : {
|
|
5186
|
-
id: `cta-message-${
|
|
5187
|
-
label,
|
|
5319
|
+
id: `cta-message-${label2}`,
|
|
5320
|
+
label: label2,
|
|
5188
5321
|
type: "message",
|
|
5189
|
-
payload: { text:
|
|
5322
|
+
payload: { text: label2 }
|
|
5190
5323
|
};
|
|
5191
5324
|
session.dispatchSuggestionAction(resolved2);
|
|
5192
|
-
}, [
|
|
5325
|
+
}, [label2, action, session]);
|
|
5193
5326
|
}
|
|
5194
5327
|
function isDispatchable(action) {
|
|
5195
5328
|
if (action.type !== NAVIGATE_SIGNAL) return true;
|
|
@@ -5213,6 +5346,8 @@ __export(src_exports2, {
|
|
|
5213
5346
|
ImageSchema: () => ImageSchema,
|
|
5214
5347
|
MoneySchema: () => MoneySchema,
|
|
5215
5348
|
PRODUCT_REVIEWS_RESOLVER_KEY: () => PRODUCT_REVIEWS_RESOLVER_KEY,
|
|
5349
|
+
PRODUCT_SECTION_ID_PATTERN: () => PRODUCT_SECTION_ID_PATTERN,
|
|
5350
|
+
PRODUCT_SECTION_MAX_CHARS: () => PRODUCT_SECTION_MAX_CHARS,
|
|
5216
5351
|
PRODUCT_VARIANTS_SCOPE: () => PRODUCT_VARIANTS_SCOPE,
|
|
5217
5352
|
ProductFieldIdError: () => ProductFieldIdError,
|
|
5218
5353
|
ProductReviewDataSchema: () => ProductReviewDataSchema,
|
|
@@ -5236,6 +5371,7 @@ __export(src_exports2, {
|
|
|
5236
5371
|
buildOptimisticCartLine: () => buildOptimisticCartLine,
|
|
5237
5372
|
buildPdpCompanionsConfig: () => buildPdpCompanionsConfig,
|
|
5238
5373
|
buildProductFieldsConfig: () => buildProductFieldsConfig,
|
|
5374
|
+
buildProductSectionsConfig: () => buildProductSectionsConfig,
|
|
5239
5375
|
cartLineMatchesSelections: () => cartLineMatchesSelections,
|
|
5240
5376
|
cartLinesForProduct: () => cartLinesForProduct,
|
|
5241
5377
|
clearBuyerSignIns: () => clearBuyerSignIns,
|
|
@@ -5243,6 +5379,7 @@ __export(src_exports2, {
|
|
|
5243
5379
|
clearCodeDiscountSources: () => clearCodeDiscountSources,
|
|
5244
5380
|
clearProductFieldReaders: () => clearProductFieldReaders,
|
|
5245
5381
|
clearProductNameLookups: () => clearProductNameLookups,
|
|
5382
|
+
clearProductSectionReaders: () => clearProductSectionReaders,
|
|
5246
5383
|
clearShopCheckouts: () => clearShopCheckouts,
|
|
5247
5384
|
clearStoreArticleLookups: () => clearStoreArticleLookups,
|
|
5248
5385
|
clearStoreThemeSources: () => clearStoreThemeSources,
|
|
@@ -5266,12 +5403,14 @@ __export(src_exports2, {
|
|
|
5266
5403
|
readBucketLabelsConfig: () => readBucketLabelsConfig,
|
|
5267
5404
|
readPdpCompanions: () => readPdpCompanions,
|
|
5268
5405
|
readProductFieldsConfig: () => readProductFieldsConfig,
|
|
5406
|
+
readProductSectionsConfig: () => readProductSectionsConfig,
|
|
5269
5407
|
registerBuyerSignIn: () => registerBuyerSignIn,
|
|
5270
5408
|
registerCatalogSearch: () => registerCatalogSearch,
|
|
5271
5409
|
registerCodeDiscountSource: () => registerCodeDiscountSource,
|
|
5272
5410
|
registerProductFieldReader: () => registerProductFieldReader,
|
|
5273
5411
|
registerProductFieldSource: () => registerProductFieldSource,
|
|
5274
5412
|
registerProductNameLookup: () => registerProductNameLookup,
|
|
5413
|
+
registerProductSectionReader: () => registerProductSectionReader,
|
|
5275
5414
|
registerShopCheckout: () => registerShopCheckout,
|
|
5276
5415
|
registerStoreArticleLookup: () => registerStoreArticleLookup,
|
|
5277
5416
|
registerStoreThemeSource: () => registerStoreThemeSource,
|
|
@@ -5281,6 +5420,7 @@ __export(src_exports2, {
|
|
|
5281
5420
|
resolveProductFieldReader: () => resolveProductFieldReader,
|
|
5282
5421
|
resolveProductFieldSource: () => resolveProductFieldSource,
|
|
5283
5422
|
resolveProductNameLookup: () => resolveProductNameLookup,
|
|
5423
|
+
resolveProductSectionReader: () => resolveProductSectionReader,
|
|
5284
5424
|
resolveShopCheckout: () => resolveShopCheckout,
|
|
5285
5425
|
resolveStoreArticleLookup: () => resolveStoreArticleLookup,
|
|
5286
5426
|
resolveStoreThemeSource: () => resolveStoreThemeSource,
|
|
@@ -5290,60 +5430,60 @@ __export(src_exports2, {
|
|
|
5290
5430
|
});
|
|
5291
5431
|
|
|
5292
5432
|
// ../ecommerce/src/commerce-schemas.ts
|
|
5293
|
-
import { z as
|
|
5294
|
-
var MoneySchema =
|
|
5295
|
-
amount:
|
|
5296
|
-
currencyCode:
|
|
5297
|
-
});
|
|
5298
|
-
var ImageSchema =
|
|
5299
|
-
url:
|
|
5300
|
-
altText:
|
|
5301
|
-
width:
|
|
5302
|
-
height:
|
|
5433
|
+
import { z as z46 } from "zod";
|
|
5434
|
+
var MoneySchema = z46.object({
|
|
5435
|
+
amount: z46.number(),
|
|
5436
|
+
currencyCode: z46.string()
|
|
5437
|
+
});
|
|
5438
|
+
var ImageSchema = z46.object({
|
|
5439
|
+
url: z46.string(),
|
|
5440
|
+
altText: z46.string(),
|
|
5441
|
+
width: z46.number().optional(),
|
|
5442
|
+
height: z46.number().optional(),
|
|
5303
5443
|
/** Responsive candidate set, resolved at the commerce-adapter boundary —
|
|
5304
5444
|
* never computed in a component. Renderers use it as `<img srcSet>` paired
|
|
5305
5445
|
* with a layout `sizes`. Absent for non-CDN / unsizable images. */
|
|
5306
|
-
srcSet:
|
|
5446
|
+
srcSet: z46.string().optional()
|
|
5307
5447
|
});
|
|
5308
|
-
var AssetSchema =
|
|
5448
|
+
var AssetSchema = z46.object({
|
|
5309
5449
|
/** Opaque asset id — the `resolved()` ref the agent emitted. */
|
|
5310
|
-
id:
|
|
5311
|
-
url:
|
|
5312
|
-
altText:
|
|
5313
|
-
srcSet:
|
|
5314
|
-
});
|
|
5315
|
-
var SelectedOptionSchema =
|
|
5316
|
-
name:
|
|
5317
|
-
value:
|
|
5318
|
-
});
|
|
5319
|
-
var VideoSourceSchema =
|
|
5320
|
-
url:
|
|
5321
|
-
mimeType:
|
|
5322
|
-
width:
|
|
5323
|
-
height:
|
|
5324
|
-
});
|
|
5325
|
-
var ProductVideoSchema =
|
|
5326
|
-
kind:
|
|
5450
|
+
id: z46.string(),
|
|
5451
|
+
url: z46.string(),
|
|
5452
|
+
altText: z46.string(),
|
|
5453
|
+
srcSet: z46.string().optional()
|
|
5454
|
+
});
|
|
5455
|
+
var SelectedOptionSchema = z46.object({
|
|
5456
|
+
name: z46.string(),
|
|
5457
|
+
value: z46.string()
|
|
5458
|
+
});
|
|
5459
|
+
var VideoSourceSchema = z46.object({
|
|
5460
|
+
url: z46.string(),
|
|
5461
|
+
mimeType: z46.string(),
|
|
5462
|
+
width: z46.number().optional(),
|
|
5463
|
+
height: z46.number().optional()
|
|
5464
|
+
});
|
|
5465
|
+
var ProductVideoSchema = z46.object({
|
|
5466
|
+
kind: z46.enum(["hosted", "external"]),
|
|
5327
5467
|
previewImage: ImageSchema.optional(),
|
|
5328
|
-
altText:
|
|
5468
|
+
altText: z46.string().default(""),
|
|
5329
5469
|
/** `kind: 'hosted'` only — empty for external embeds. */
|
|
5330
|
-
sources:
|
|
5470
|
+
sources: z46.array(VideoSourceSchema).default([]),
|
|
5331
5471
|
/** `kind: 'external'` only — iframe embed URL. */
|
|
5332
|
-
embedUrl:
|
|
5472
|
+
embedUrl: z46.string().optional(),
|
|
5333
5473
|
/** `kind: 'external'` only — e.g. `YOUTUBE` | `VIMEO`. */
|
|
5334
|
-
host:
|
|
5474
|
+
host: z46.string().optional()
|
|
5335
5475
|
});
|
|
5336
|
-
var AvailabilityStatusSchema =
|
|
5476
|
+
var AvailabilityStatusSchema = z46.enum([
|
|
5337
5477
|
"in_stock",
|
|
5338
5478
|
"backorder",
|
|
5339
5479
|
"preorder",
|
|
5340
5480
|
"out_of_stock",
|
|
5341
5481
|
"discontinued"
|
|
5342
5482
|
]);
|
|
5343
|
-
var ProductVariantSchema =
|
|
5344
|
-
id:
|
|
5345
|
-
title:
|
|
5346
|
-
available:
|
|
5483
|
+
var ProductVariantSchema = z46.object({
|
|
5484
|
+
id: z46.string(),
|
|
5485
|
+
title: z46.string(),
|
|
5486
|
+
available: z46.boolean(),
|
|
5347
5487
|
/**
|
|
5348
5488
|
* Qualifies `available` with the fulfillment state behind it. Absent means
|
|
5349
5489
|
* the backend did not say — which is NOT the same as in stock, and must not
|
|
@@ -5358,10 +5498,10 @@ var ProductVariantSchema = z45.object({
|
|
|
5358
5498
|
availabilityStatus: AvailabilityStatusSchema.optional(),
|
|
5359
5499
|
price: MoneySchema,
|
|
5360
5500
|
compareAtPrice: MoneySchema.optional(),
|
|
5361
|
-
selectedOptions:
|
|
5501
|
+
selectedOptions: z46.array(SelectedOptionSchema).optional(),
|
|
5362
5502
|
image: ImageSchema.optional(),
|
|
5363
5503
|
/** The merchant's stock-keeping code. Absent when the backend has none. */
|
|
5364
|
-
sku:
|
|
5504
|
+
sku: z46.string().optional()
|
|
5365
5505
|
});
|
|
5366
5506
|
var MP4_MIME = "video/mp4";
|
|
5367
5507
|
var HLS_MIME = "application/x-mpegURL";
|
|
@@ -5371,34 +5511,34 @@ function orderedVideoSources(video) {
|
|
|
5371
5511
|
const hls = video.sources.filter((s) => s.mimeType === HLS_MIME);
|
|
5372
5512
|
return [...mp4, ...hls];
|
|
5373
5513
|
}
|
|
5374
|
-
var SiblingProductSchema =
|
|
5375
|
-
id:
|
|
5376
|
-
handle:
|
|
5377
|
-
title:
|
|
5514
|
+
var SiblingProductSchema = z46.object({
|
|
5515
|
+
id: z46.string(),
|
|
5516
|
+
handle: z46.string(),
|
|
5517
|
+
title: z46.string(),
|
|
5378
5518
|
/** The differentiating value across siblings — typically the color
|
|
5379
5519
|
* label ("OLIVE", "STONE"). Rendered next to the swatch row. */
|
|
5380
|
-
color:
|
|
5520
|
+
color: z46.string(),
|
|
5381
5521
|
/** Swatch artwork. Hydrators populate from the sibling product's
|
|
5382
5522
|
* first image; renderers crop / fit to the swatch tile. */
|
|
5383
5523
|
swatchImage: ImageSchema.optional(),
|
|
5384
|
-
available:
|
|
5524
|
+
available: z46.boolean().default(true),
|
|
5385
5525
|
/** Marks the sibling that IS the currently-rendered product. The
|
|
5386
5526
|
* picker uses this to highlight the active swatch without an
|
|
5387
5527
|
* external id comparison. */
|
|
5388
|
-
current:
|
|
5528
|
+
current: z46.boolean().default(false)
|
|
5389
5529
|
});
|
|
5390
|
-
var ProductSchema =
|
|
5391
|
-
id:
|
|
5392
|
-
handle:
|
|
5393
|
-
title:
|
|
5394
|
-
description:
|
|
5395
|
-
descriptionHtml:
|
|
5396
|
-
vendor:
|
|
5397
|
-
productType:
|
|
5398
|
-
tags:
|
|
5530
|
+
var ProductSchema = z46.object({
|
|
5531
|
+
id: z46.string(),
|
|
5532
|
+
handle: z46.string().default(""),
|
|
5533
|
+
title: z46.string(),
|
|
5534
|
+
description: z46.string().default(""),
|
|
5535
|
+
descriptionHtml: z46.string().optional(),
|
|
5536
|
+
vendor: z46.string().default(""),
|
|
5537
|
+
productType: z46.string().optional(),
|
|
5538
|
+
tags: z46.array(z46.string()).default([]),
|
|
5399
5539
|
price: MoneySchema.default({ amount: 0, currencyCode: "USD" }),
|
|
5400
5540
|
compareAtPrice: MoneySchema.optional(),
|
|
5401
|
-
images:
|
|
5541
|
+
images: z46.array(ImageSchema).default([]),
|
|
5402
5542
|
/**
|
|
5403
5543
|
* Product videos (`Video` + `ExternalVideo` media). Shopify's MCP
|
|
5404
5544
|
* catalog drops video media — it only surfaces through the Storefront
|
|
@@ -5406,21 +5546,21 @@ var ProductSchema = z45.object({
|
|
|
5406
5546
|
* boundary. Default `[]` so renderers gate on `length > 0` without a
|
|
5407
5547
|
* presence guard.
|
|
5408
5548
|
*/
|
|
5409
|
-
videos:
|
|
5410
|
-
variants:
|
|
5411
|
-
availableForSale:
|
|
5412
|
-
options:
|
|
5413
|
-
name:
|
|
5414
|
-
values:
|
|
5549
|
+
videos: z46.array(ProductVideoSchema).default([]),
|
|
5550
|
+
variants: z46.array(ProductVariantSchema).default([]),
|
|
5551
|
+
availableForSale: z46.boolean().default(true),
|
|
5552
|
+
options: z46.array(z46.object({
|
|
5553
|
+
name: z46.string(),
|
|
5554
|
+
values: z46.array(z46.string())
|
|
5415
5555
|
})).optional(),
|
|
5416
|
-
collections:
|
|
5556
|
+
collections: z46.array(z46.string()).optional(),
|
|
5417
5557
|
/** See `SiblingProductSchema`. Default `[]` so renderers can check
|
|
5418
5558
|
* `length > 1` to decide whether to draw the swatch row without a
|
|
5419
5559
|
* presence guard. */
|
|
5420
|
-
colorVariants:
|
|
5421
|
-
rating:
|
|
5422
|
-
value:
|
|
5423
|
-
count:
|
|
5560
|
+
colorVariants: z46.array(SiblingProductSchema).default([]),
|
|
5561
|
+
rating: z46.object({
|
|
5562
|
+
value: z46.number(),
|
|
5563
|
+
count: z46.number()
|
|
5424
5564
|
}).optional(),
|
|
5425
5565
|
/**
|
|
5426
5566
|
* Product reviews surfaced from the brand's review store. SDK
|
|
@@ -5429,12 +5569,12 @@ var ProductSchema = z45.object({
|
|
|
5429
5569
|
* review bodies. Renderers (`Reviews` component, `ProductDetail`,
|
|
5430
5570
|
* etc.) consume directly.
|
|
5431
5571
|
*/
|
|
5432
|
-
reviews:
|
|
5433
|
-
author:
|
|
5434
|
-
rating:
|
|
5435
|
-
content:
|
|
5436
|
-
date:
|
|
5437
|
-
verified:
|
|
5572
|
+
reviews: z46.array(z46.object({
|
|
5573
|
+
author: z46.string(),
|
|
5574
|
+
rating: z46.number(),
|
|
5575
|
+
content: z46.string(),
|
|
5576
|
+
date: z46.string(),
|
|
5577
|
+
verified: z46.boolean().optional()
|
|
5438
5578
|
})).optional(),
|
|
5439
5579
|
/**
|
|
5440
5580
|
* Ghost-entity flag — `true` when the Storefront API could not hydrate
|
|
@@ -5446,7 +5586,7 @@ var ProductSchema = z45.object({
|
|
|
5446
5586
|
* Set exclusively by `createUnavailableProduct()` — never by the
|
|
5447
5587
|
* Storefront mapper.
|
|
5448
5588
|
*/
|
|
5449
|
-
unavailable:
|
|
5589
|
+
unavailable: z46.boolean().default(false)
|
|
5450
5590
|
});
|
|
5451
5591
|
function createUnavailableProduct(gid) {
|
|
5452
5592
|
return {
|
|
@@ -5465,71 +5605,71 @@ function createUnavailableProduct(gid) {
|
|
|
5465
5605
|
unavailable: true
|
|
5466
5606
|
};
|
|
5467
5607
|
}
|
|
5468
|
-
function isGhostEntity(
|
|
5469
|
-
return typeof
|
|
5470
|
-
}
|
|
5471
|
-
var ReviewSchema =
|
|
5472
|
-
id:
|
|
5473
|
-
productId:
|
|
5474
|
-
author:
|
|
5475
|
-
rating:
|
|
5476
|
-
text:
|
|
5477
|
-
date:
|
|
5478
|
-
verified:
|
|
5479
|
-
});
|
|
5480
|
-
var ArticleSchema =
|
|
5481
|
-
id:
|
|
5482
|
-
handle:
|
|
5483
|
-
title:
|
|
5484
|
-
excerpt:
|
|
5485
|
-
content:
|
|
5486
|
-
contentHtml:
|
|
5487
|
-
author:
|
|
5488
|
-
publishedAt:
|
|
5608
|
+
function isGhostEntity(value2) {
|
|
5609
|
+
return typeof value2 === "object" && value2 !== null && "unavailable" in value2 && value2.unavailable === true;
|
|
5610
|
+
}
|
|
5611
|
+
var ReviewSchema = z46.object({
|
|
5612
|
+
id: z46.string(),
|
|
5613
|
+
productId: z46.string(),
|
|
5614
|
+
author: z46.string(),
|
|
5615
|
+
rating: z46.number(),
|
|
5616
|
+
text: z46.string(),
|
|
5617
|
+
date: z46.string(),
|
|
5618
|
+
verified: z46.boolean()
|
|
5619
|
+
});
|
|
5620
|
+
var ArticleSchema = z46.object({
|
|
5621
|
+
id: z46.string(),
|
|
5622
|
+
handle: z46.string().default(""),
|
|
5623
|
+
title: z46.string(),
|
|
5624
|
+
excerpt: z46.string().default(""),
|
|
5625
|
+
content: z46.string().default(""),
|
|
5626
|
+
contentHtml: z46.string().optional(),
|
|
5627
|
+
author: z46.string().default(""),
|
|
5628
|
+
publishedAt: z46.string().default(""),
|
|
5489
5629
|
image: ImageSchema.optional(),
|
|
5490
|
-
blogHandle:
|
|
5491
|
-
tags:
|
|
5630
|
+
blogHandle: z46.string().default(""),
|
|
5631
|
+
tags: z46.array(z46.string()).default([])
|
|
5492
5632
|
});
|
|
5493
|
-
var CmsPageSchema =
|
|
5494
|
-
id:
|
|
5495
|
-
handle:
|
|
5496
|
-
title:
|
|
5497
|
-
body:
|
|
5498
|
-
bodyHtml:
|
|
5499
|
-
bodySummary:
|
|
5500
|
-
updatedAt:
|
|
5501
|
-
seoTitle:
|
|
5502
|
-
seoDescription:
|
|
5503
|
-
});
|
|
5504
|
-
var CmsPolicySchema =
|
|
5505
|
-
id:
|
|
5633
|
+
var CmsPageSchema = z46.object({
|
|
5634
|
+
id: z46.string(),
|
|
5635
|
+
handle: z46.string().default(""),
|
|
5636
|
+
title: z46.string(),
|
|
5637
|
+
body: z46.string().default(""),
|
|
5638
|
+
bodyHtml: z46.string().optional(),
|
|
5639
|
+
bodySummary: z46.string().default(""),
|
|
5640
|
+
updatedAt: z46.string().default(""),
|
|
5641
|
+
seoTitle: z46.string().optional(),
|
|
5642
|
+
seoDescription: z46.string().optional()
|
|
5643
|
+
});
|
|
5644
|
+
var CmsPolicySchema = z46.object({
|
|
5645
|
+
id: z46.string(),
|
|
5506
5646
|
/** Stable policy slot identifier: 'refund' | 'privacy' | 'terms' |
|
|
5507
5647
|
* 'shipping' | 'subscription' | 'warranty' | custom string. Open so
|
|
5508
5648
|
* platforms with custom policy types can extend. */
|
|
5509
|
-
kind:
|
|
5649
|
+
kind: z46.string(),
|
|
5510
5650
|
/** Slug-shaped handle the platform exposes for storefront URLs
|
|
5511
5651
|
* (e.g. `refund-policy`). Empty string when the backend doesn't
|
|
5512
5652
|
* surface one. */
|
|
5513
|
-
handle:
|
|
5514
|
-
title:
|
|
5515
|
-
body:
|
|
5516
|
-
bodyHtml:
|
|
5517
|
-
url:
|
|
5653
|
+
handle: z46.string().default(""),
|
|
5654
|
+
title: z46.string(),
|
|
5655
|
+
body: z46.string().default(""),
|
|
5656
|
+
bodyHtml: z46.string().optional(),
|
|
5657
|
+
url: z46.string().default("")
|
|
5518
5658
|
});
|
|
5519
|
-
var CollectionSchema =
|
|
5520
|
-
id:
|
|
5521
|
-
handle:
|
|
5522
|
-
title:
|
|
5523
|
-
description:
|
|
5659
|
+
var CollectionSchema = z46.object({
|
|
5660
|
+
id: z46.string(),
|
|
5661
|
+
handle: z46.string().default(""),
|
|
5662
|
+
title: z46.string(),
|
|
5663
|
+
description: z46.string().default(""),
|
|
5524
5664
|
image: ImageSchema.optional(),
|
|
5525
|
-
productCount:
|
|
5665
|
+
productCount: z46.number().int().nonnegative().optional()
|
|
5526
5666
|
});
|
|
5527
|
-
var CartLineSchema =
|
|
5528
|
-
id:
|
|
5529
|
-
merchandiseId:
|
|
5530
|
-
productId:
|
|
5531
|
-
title:
|
|
5532
|
-
variantTitle:
|
|
5667
|
+
var CartLineSchema = z46.object({
|
|
5668
|
+
id: z46.string(),
|
|
5669
|
+
merchandiseId: z46.string(),
|
|
5670
|
+
productId: z46.string(),
|
|
5671
|
+
title: z46.string(),
|
|
5672
|
+
variantTitle: z46.string().optional(),
|
|
5533
5673
|
/**
|
|
5534
5674
|
* The variant's option axes as structured pairs (e.g.
|
|
5535
5675
|
* `[{name:'Size', value:'7'}]`). The machine-readable counterpart of
|
|
@@ -5538,10 +5678,10 @@ var CartLineSchema = z45.object({
|
|
|
5538
5678
|
* single-variant products (the degenerate `Title: Default Title` axis
|
|
5539
5679
|
* is normalized away at the adapter boundary).
|
|
5540
5680
|
*/
|
|
5541
|
-
selectedOptions:
|
|
5542
|
-
vendor:
|
|
5543
|
-
sku:
|
|
5544
|
-
quantity:
|
|
5681
|
+
selectedOptions: z46.array(SelectedOptionSchema).optional(),
|
|
5682
|
+
vendor: z46.string().optional(),
|
|
5683
|
+
sku: z46.string().optional(),
|
|
5684
|
+
quantity: z46.number().int().positive(),
|
|
5545
5685
|
unitPrice: MoneySchema,
|
|
5546
5686
|
totalPrice: MoneySchema,
|
|
5547
5687
|
image: ImageSchema.optional(),
|
|
@@ -5561,32 +5701,32 @@ var CartLineSchema = z45.object({
|
|
|
5561
5701
|
* client-minted id the backend rejects, line-tap navigation is
|
|
5562
5702
|
* suppressed, and the money never folds into a settled-looking total.
|
|
5563
5703
|
*/
|
|
5564
|
-
pending:
|
|
5704
|
+
pending: z46.boolean().optional(),
|
|
5565
5705
|
/**
|
|
5566
5706
|
* The line's custom attributes (Shopify line item properties), as the
|
|
5567
5707
|
* backend holds them — how a surface tells whether a line carries a tag such
|
|
5568
5708
|
* as `_checkbox_discount`. Absent when the line has none.
|
|
5569
5709
|
*/
|
|
5570
|
-
attributes:
|
|
5710
|
+
attributes: z46.array(CartLineAttributeSchema).optional()
|
|
5571
5711
|
});
|
|
5572
5712
|
function isPendingCartLine(line) {
|
|
5573
5713
|
return line.pending === true;
|
|
5574
5714
|
}
|
|
5575
|
-
var CartDiscountCodeSchema =
|
|
5576
|
-
code:
|
|
5577
|
-
applicable:
|
|
5715
|
+
var CartDiscountCodeSchema = z46.object({
|
|
5716
|
+
code: z46.string(),
|
|
5717
|
+
applicable: z46.boolean()
|
|
5578
5718
|
});
|
|
5579
|
-
var CartMessageSchema =
|
|
5580
|
-
kind:
|
|
5719
|
+
var CartMessageSchema = z46.object({
|
|
5720
|
+
kind: z46.enum(["error", "warning", "info"]),
|
|
5581
5721
|
/** Machine code for branching; opaque and backend-defined. */
|
|
5582
|
-
code:
|
|
5722
|
+
code: z46.string(),
|
|
5583
5723
|
/** Human-readable text, meant to be shown as-is. */
|
|
5584
|
-
content:
|
|
5724
|
+
content: z46.string()
|
|
5585
5725
|
});
|
|
5586
|
-
var CartSchema =
|
|
5587
|
-
id:
|
|
5588
|
-
lines:
|
|
5589
|
-
totalQuantity:
|
|
5726
|
+
var CartSchema = z46.object({
|
|
5727
|
+
id: z46.string(),
|
|
5728
|
+
lines: z46.array(CartLineSchema),
|
|
5729
|
+
totalQuantity: z46.number().int().nonnegative(),
|
|
5590
5730
|
subtotal: MoneySchema,
|
|
5591
5731
|
/**
|
|
5592
5732
|
* Cart total after discounts (pre-shipping/tax). Absent when the
|
|
@@ -5596,11 +5736,11 @@ var CartSchema = z45.object({
|
|
|
5596
5736
|
*/
|
|
5597
5737
|
total: MoneySchema.optional(),
|
|
5598
5738
|
/** Discount codes currently attached to the cart. */
|
|
5599
|
-
discountCodes:
|
|
5739
|
+
discountCodes: z46.array(CartDiscountCodeSchema).default([]),
|
|
5600
5740
|
/** Notices the backend attached to this cart — see `CartMessageSchema`.
|
|
5601
5741
|
* Empty when the backend said nothing or does not report them. */
|
|
5602
|
-
messages:
|
|
5603
|
-
checkoutUrl:
|
|
5742
|
+
messages: z46.array(CartMessageSchema).default([]),
|
|
5743
|
+
checkoutUrl: z46.string().optional(),
|
|
5604
5744
|
/**
|
|
5605
5745
|
* Opaque handle this cart is known by in the connector's BACK OFFICE — the
|
|
5606
5746
|
* value a space owner searches there to find the order this cart became.
|
|
@@ -5613,14 +5753,14 @@ var CartSchema = z45.object({
|
|
|
5613
5753
|
* Absent when the platform has no such handle, or while the cart is still the
|
|
5614
5754
|
* client's optimistic paint and its id is client-minted.
|
|
5615
5755
|
*/
|
|
5616
|
-
backOfficeRef:
|
|
5756
|
+
backOfficeRef: z46.string().optional(),
|
|
5617
5757
|
/**
|
|
5618
5758
|
* URL that recreates this cart on the merchant's own store website
|
|
5619
5759
|
* (replace semantics — overwrites any cart the visitor already has
|
|
5620
5760
|
* there). Populated by platform adapters that support it; absent when
|
|
5621
5761
|
* the cart is empty or the URL cannot be built.
|
|
5622
5762
|
*/
|
|
5623
|
-
storeCartUrl:
|
|
5763
|
+
storeCartUrl: z46.string().optional(),
|
|
5624
5764
|
/**
|
|
5625
5765
|
* True while this cart exists only in the client's optimistic paint —
|
|
5626
5766
|
* no backend cart has been created yet, so its `id` is client-minted and
|
|
@@ -5628,19 +5768,19 @@ var CartSchema = z45.object({
|
|
|
5628
5768
|
* `CartLineSchema.pending`: the adapter never sets it, and callers that
|
|
5629
5769
|
* need a real cart id read THIS rather than sniffing the id's shape.
|
|
5630
5770
|
*/
|
|
5631
|
-
pending:
|
|
5771
|
+
pending: z46.boolean().optional()
|
|
5632
5772
|
});
|
|
5633
|
-
var StoreCheckoutSchema =
|
|
5634
|
-
|
|
5635
|
-
|
|
5773
|
+
var StoreCheckoutSchema = z46.union([
|
|
5774
|
+
z46.object({ status: z46.literal("ready"), seller: z46.string(), lineIds: z46.array(z46.string()), checkoutUrl: z46.string() }),
|
|
5775
|
+
z46.object({ status: z46.literal("failed"), seller: z46.string(), lineIds: z46.array(z46.string()), reason: z46.string() })
|
|
5636
5776
|
]);
|
|
5637
|
-
var ShopCheckoutResultSchema =
|
|
5638
|
-
|
|
5639
|
-
|
|
5777
|
+
var ShopCheckoutResultSchema = z46.union([
|
|
5778
|
+
z46.object({ status: z46.literal("combined"), continueUrl: z46.string(), stores: z46.array(StoreCheckoutSchema) }),
|
|
5779
|
+
z46.object({ status: z46.literal("separate"), reason: z46.string(), stores: z46.array(StoreCheckoutSchema) })
|
|
5640
5780
|
]);
|
|
5641
|
-
var ShopCheckoutAnswerSchema =
|
|
5642
|
-
|
|
5643
|
-
|
|
5781
|
+
var ShopCheckoutAnswerSchema = z46.union([
|
|
5782
|
+
z46.object({ available: z46.literal(false) }),
|
|
5783
|
+
z46.object({ available: z46.literal(true), result: ShopCheckoutResultSchema })
|
|
5644
5784
|
]);
|
|
5645
5785
|
function settledCart(cart) {
|
|
5646
5786
|
if (cart === null || cart === void 0) return null;
|
|
@@ -5648,27 +5788,27 @@ function settledCart(cart) {
|
|
|
5648
5788
|
}
|
|
5649
5789
|
|
|
5650
5790
|
// ../ecommerce/src/review-schemas.ts
|
|
5651
|
-
import { z as
|
|
5791
|
+
import { z as z47 } from "zod";
|
|
5652
5792
|
var PRODUCT_REVIEWS_RESOLVER_KEY = "productReviews";
|
|
5653
|
-
var ProductReviewItemSchema =
|
|
5654
|
-
author:
|
|
5655
|
-
rating:
|
|
5793
|
+
var ProductReviewItemSchema = z47.object({
|
|
5794
|
+
author: z47.string(),
|
|
5795
|
+
rating: z47.number(),
|
|
5656
5796
|
/** The reviewer's own headline ("love"), when they wrote one — the site shows it above `content`. */
|
|
5657
|
-
title:
|
|
5658
|
-
content:
|
|
5659
|
-
date:
|
|
5660
|
-
verified:
|
|
5797
|
+
title: z47.string().optional(),
|
|
5798
|
+
content: z47.string(),
|
|
5799
|
+
date: z47.string(),
|
|
5800
|
+
verified: z47.boolean().optional(),
|
|
5661
5801
|
/**
|
|
5662
5802
|
* Non-empty when the review was written for a grouped SIBLING product rather
|
|
5663
5803
|
* than this one (brands pool reviews across a product line). A surface can
|
|
5664
5804
|
* attribute it; empty / absent ⇒ the product's own review.
|
|
5665
5805
|
*/
|
|
5666
|
-
writtenFor:
|
|
5806
|
+
writtenFor: z47.string().optional()
|
|
5667
5807
|
});
|
|
5668
5808
|
var ProductReviewHighlightSchema = ProductReviewItemSchema.extend({
|
|
5669
5809
|
/** The sentence(s) the ranking fired on. Descriptive — it is what the matcher
|
|
5670
5810
|
* scored, NOT necessarily text that occurs in `content`. */
|
|
5671
|
-
highlight:
|
|
5811
|
+
highlight: z47.string().optional(),
|
|
5672
5812
|
/**
|
|
5673
5813
|
* `highlight` resolved back into `content` as a VERBATIM substring, so a
|
|
5674
5814
|
* surface can mark it with a plain `indexOf` and no matcher of its own.
|
|
@@ -5683,39 +5823,39 @@ var ProductReviewHighlightSchema = ProductReviewItemSchema.extend({
|
|
|
5683
5823
|
* Absent when the passage genuinely has no home in the body (one cut from the
|
|
5684
5824
|
* title). A surface then marks NOTHING rather than guessing at a span.
|
|
5685
5825
|
*/
|
|
5686
|
-
mark:
|
|
5826
|
+
mark: z47.string().optional()
|
|
5687
5827
|
});
|
|
5688
|
-
var ReviewAggregateSchema =
|
|
5689
|
-
value:
|
|
5690
|
-
count:
|
|
5828
|
+
var ReviewAggregateSchema = z47.object({
|
|
5829
|
+
value: z47.number(),
|
|
5830
|
+
count: z47.number()
|
|
5691
5831
|
});
|
|
5692
|
-
var ProductReviewDataSchema =
|
|
5693
|
-
id:
|
|
5832
|
+
var ProductReviewDataSchema = z47.object({
|
|
5833
|
+
id: z47.string(),
|
|
5694
5834
|
/** The product's FULL retrieved set — what a filterable list renders. */
|
|
5695
|
-
reviews:
|
|
5835
|
+
reviews: z47.array(ProductReviewItemSchema).default([]),
|
|
5696
5836
|
aggregate: ReviewAggregateSchema.default({ value: 0, count: 0 }),
|
|
5697
5837
|
/** 5★→1★ star COUNTS over the full set (index 0 = 5-star). */
|
|
5698
|
-
distribution:
|
|
5838
|
+
distribution: z47.array(z47.number()).default([]),
|
|
5699
5839
|
/**
|
|
5700
5840
|
* The reviews that ANSWER the surface's intent, best first. Empty when no
|
|
5701
5841
|
* intent was asked for — never a silent copy of `reviews`.
|
|
5702
5842
|
*/
|
|
5703
|
-
highlights:
|
|
5843
|
+
highlights: z47.array(ProductReviewHighlightSchema).default([]),
|
|
5704
5844
|
/**
|
|
5705
5845
|
* True when the review provider could not be read and nothing is indexed —
|
|
5706
5846
|
* the empty lists mean "not loaded", NOT "this product has no reviews".
|
|
5707
5847
|
*/
|
|
5708
|
-
unavailable:
|
|
5848
|
+
unavailable: z47.boolean().optional()
|
|
5709
5849
|
});
|
|
5710
5850
|
var ProductReviewPayloadSchema = ProductReviewDataSchema.omit({ id: true });
|
|
5711
5851
|
|
|
5712
5852
|
// ../ecommerce/src/format-variant-value.ts
|
|
5713
5853
|
var ONE_SIZE_LABEL = "One Size";
|
|
5714
5854
|
var ONE_SIZE_TOKENS = /* @__PURE__ */ new Set(["onesz", "one size", "one_size", "os", "osfa", "osfm"]);
|
|
5715
|
-
function formatVariantValue(
|
|
5716
|
-
const normalized =
|
|
5855
|
+
function formatVariantValue(value2) {
|
|
5856
|
+
const normalized = value2.trim().toLowerCase();
|
|
5717
5857
|
if (ONE_SIZE_TOKENS.has(normalized)) return ONE_SIZE_LABEL;
|
|
5718
|
-
return
|
|
5858
|
+
return value2;
|
|
5719
5859
|
}
|
|
5720
5860
|
|
|
5721
5861
|
// ../ecommerce/src/locale.ts
|
|
@@ -5780,7 +5920,7 @@ function cartLineMatchesSelections(line, wanted) {
|
|
|
5780
5920
|
if (pairs.length === 0) return true;
|
|
5781
5921
|
const actual = selectedOptionsToRecord(line.selectedOptions);
|
|
5782
5922
|
if (actual === void 0) return false;
|
|
5783
|
-
return pairs.every(([axis,
|
|
5923
|
+
return pairs.every(([axis, value2]) => actual[axis] === value2);
|
|
5784
5924
|
}
|
|
5785
5925
|
function cartLinesForProduct(lines, productId, selections3) {
|
|
5786
5926
|
return lines.filter((line) => {
|
|
@@ -5993,15 +6133,15 @@ function buildPdpCompanionsConfig(types) {
|
|
|
5993
6133
|
}
|
|
5994
6134
|
function readPdpCompanions(config) {
|
|
5995
6135
|
if (config === void 0) return void 0;
|
|
5996
|
-
const
|
|
5997
|
-
if (!Array.isArray(
|
|
5998
|
-
return
|
|
6136
|
+
const value2 = config[PDP_COMPANIONS_CONFIG_KEY];
|
|
6137
|
+
if (!Array.isArray(value2)) return void 0;
|
|
6138
|
+
return value2.filter((entry) => typeof entry === "string");
|
|
5999
6139
|
}
|
|
6000
6140
|
|
|
6001
6141
|
// ../ecommerce/src/base-attributes.ts
|
|
6002
|
-
import { z as
|
|
6142
|
+
import { z as z48 } from "zod";
|
|
6003
6143
|
var BASE_ATTRIBUTES_CONFIG_KEY = "baseAttributes";
|
|
6004
|
-
var BaseAttributesRecordSchema =
|
|
6144
|
+
var BaseAttributesRecordSchema = z48.record(z48.string(), AttributeDefSchema);
|
|
6005
6145
|
function buildBaseAttributesConfig(attributes) {
|
|
6006
6146
|
return { [BASE_ATTRIBUTES_CONFIG_KEY]: attributes };
|
|
6007
6147
|
}
|
|
@@ -6012,9 +6152,9 @@ function readBaseAttributesConfig(config) {
|
|
|
6012
6152
|
}
|
|
6013
6153
|
|
|
6014
6154
|
// ../ecommerce/src/bucket-labels.ts
|
|
6015
|
-
import { z as
|
|
6155
|
+
import { z as z49 } from "zod";
|
|
6016
6156
|
var BUCKET_LABELS_CONFIG_KEY = "bucketLabels";
|
|
6017
|
-
var BucketLabelsRecordSchema =
|
|
6157
|
+
var BucketLabelsRecordSchema = z49.record(z49.string(), z49.string());
|
|
6018
6158
|
function buildBucketLabelsConfig(labels) {
|
|
6019
6159
|
return { [BUCKET_LABELS_CONFIG_KEY]: labels };
|
|
6020
6160
|
}
|
|
@@ -6045,17 +6185,17 @@ var PRODUCT_FIELDS_CONFIG_KEY = "productFields";
|
|
|
6045
6185
|
function buildProductFieldsConfig(fields) {
|
|
6046
6186
|
return { [PRODUCT_FIELDS_CONFIG_KEY]: fields.map((f) => ({ namespace: f.namespace, key: f.key })) };
|
|
6047
6187
|
}
|
|
6048
|
-
function isFieldRef(
|
|
6049
|
-
if (typeof
|
|
6050
|
-
const namespace = Reflect.get(
|
|
6051
|
-
const key = Reflect.get(
|
|
6188
|
+
function isFieldRef(value2) {
|
|
6189
|
+
if (typeof value2 !== "object" || value2 === null) return false;
|
|
6190
|
+
const namespace = Reflect.get(value2, "namespace");
|
|
6191
|
+
const key = Reflect.get(value2, "key");
|
|
6052
6192
|
return typeof namespace === "string" && namespace.length > 0 && typeof key === "string" && key.length > 0;
|
|
6053
6193
|
}
|
|
6054
6194
|
function readProductFieldsConfig(config) {
|
|
6055
6195
|
if (config === void 0) return void 0;
|
|
6056
|
-
const
|
|
6057
|
-
if (!Array.isArray(
|
|
6058
|
-
return
|
|
6196
|
+
const value2 = config[PRODUCT_FIELDS_CONFIG_KEY];
|
|
6197
|
+
if (!Array.isArray(value2)) return void 0;
|
|
6198
|
+
return value2.filter(isFieldRef).map((f) => ({ namespace: f.namespace, key: f.key }));
|
|
6059
6199
|
}
|
|
6060
6200
|
function isDeclaredProductField(declared, field) {
|
|
6061
6201
|
return declared.some((d) => d.namespace === field.namespace && d.key === field.key);
|
|
@@ -6093,84 +6233,115 @@ function clearProductFieldReaders() {
|
|
|
6093
6233
|
sources.length = 0;
|
|
6094
6234
|
}
|
|
6095
6235
|
|
|
6096
|
-
// ../ecommerce/src/
|
|
6236
|
+
// ../ecommerce/src/product-sections.ts
|
|
6237
|
+
var PRODUCT_SECTION_MAX_CHARS = 64 * 1024;
|
|
6238
|
+
var PRODUCT_SECTION_ID_PATTERN = /^[A-Za-z0-9_-]{1,100}$/;
|
|
6239
|
+
var PRODUCT_SECTIONS_CONFIG_KEY = "productSections";
|
|
6240
|
+
function buildProductSectionsConfig(sectionIds) {
|
|
6241
|
+
return { [PRODUCT_SECTIONS_CONFIG_KEY]: [...sectionIds] };
|
|
6242
|
+
}
|
|
6243
|
+
function isSectionId(value2) {
|
|
6244
|
+
return typeof value2 === "string" && PRODUCT_SECTION_ID_PATTERN.test(value2);
|
|
6245
|
+
}
|
|
6246
|
+
function readProductSectionsConfig(config) {
|
|
6247
|
+
if (config === void 0) return void 0;
|
|
6248
|
+
const value2 = config[PRODUCT_SECTIONS_CONFIG_KEY];
|
|
6249
|
+
if (!Array.isArray(value2)) return void 0;
|
|
6250
|
+
return value2.filter(isSectionId);
|
|
6251
|
+
}
|
|
6097
6252
|
var factories3 = [];
|
|
6098
|
-
function
|
|
6253
|
+
function registerProductSectionReader(factory) {
|
|
6099
6254
|
factories3.push(factory);
|
|
6100
6255
|
}
|
|
6101
|
-
function
|
|
6256
|
+
function resolveProductSectionReader(platformConfig) {
|
|
6102
6257
|
for (const factory of factories3) {
|
|
6258
|
+
const reader = factory(platformConfig);
|
|
6259
|
+
if (reader !== void 0) return reader;
|
|
6260
|
+
}
|
|
6261
|
+
return void 0;
|
|
6262
|
+
}
|
|
6263
|
+
function clearProductSectionReaders() {
|
|
6264
|
+
factories3.length = 0;
|
|
6265
|
+
}
|
|
6266
|
+
|
|
6267
|
+
// ../ecommerce/src/store-articles.ts
|
|
6268
|
+
var factories4 = [];
|
|
6269
|
+
function registerStoreArticleLookup(factory) {
|
|
6270
|
+
factories4.push(factory);
|
|
6271
|
+
}
|
|
6272
|
+
function resolveStoreArticleLookup(platformConfig) {
|
|
6273
|
+
for (const factory of factories4) {
|
|
6103
6274
|
const lookup = factory(platformConfig);
|
|
6104
6275
|
if (lookup !== void 0) return lookup;
|
|
6105
6276
|
}
|
|
6106
6277
|
return void 0;
|
|
6107
6278
|
}
|
|
6108
6279
|
function clearStoreArticleLookups() {
|
|
6109
|
-
|
|
6280
|
+
factories4.length = 0;
|
|
6110
6281
|
}
|
|
6111
6282
|
|
|
6112
6283
|
// ../ecommerce/src/catalog-search.ts
|
|
6113
|
-
var
|
|
6284
|
+
var factories5 = [];
|
|
6114
6285
|
function registerCatalogSearch(factory) {
|
|
6115
|
-
|
|
6286
|
+
factories5.push(factory);
|
|
6116
6287
|
}
|
|
6117
6288
|
function resolveCatalogSearch(platformConfig) {
|
|
6118
|
-
for (const factory of
|
|
6289
|
+
for (const factory of factories5) {
|
|
6119
6290
|
const search = factory(platformConfig);
|
|
6120
6291
|
if (search !== void 0) return search;
|
|
6121
6292
|
}
|
|
6122
6293
|
return void 0;
|
|
6123
6294
|
}
|
|
6124
6295
|
function clearCatalogSearches() {
|
|
6125
|
-
|
|
6296
|
+
factories5.length = 0;
|
|
6126
6297
|
}
|
|
6127
6298
|
|
|
6128
6299
|
// ../ecommerce/src/shop-checkout.ts
|
|
6129
|
-
var
|
|
6300
|
+
var factories6 = [];
|
|
6130
6301
|
function registerShopCheckout(factory) {
|
|
6131
|
-
|
|
6302
|
+
factories6.push(factory);
|
|
6132
6303
|
}
|
|
6133
6304
|
function resolveShopCheckout(platformConfig) {
|
|
6134
|
-
for (const factory of
|
|
6305
|
+
for (const factory of factories6) {
|
|
6135
6306
|
const maker = factory(platformConfig);
|
|
6136
6307
|
if (maker !== void 0) return maker;
|
|
6137
6308
|
}
|
|
6138
6309
|
return void 0;
|
|
6139
6310
|
}
|
|
6140
6311
|
function clearShopCheckouts() {
|
|
6141
|
-
|
|
6312
|
+
factories6.length = 0;
|
|
6142
6313
|
}
|
|
6143
6314
|
|
|
6144
6315
|
// ../ecommerce/src/buyer-sign-in.ts
|
|
6145
|
-
var
|
|
6316
|
+
var factories7 = [];
|
|
6146
6317
|
function registerBuyerSignIn(factory) {
|
|
6147
|
-
|
|
6318
|
+
factories7.push(factory);
|
|
6148
6319
|
}
|
|
6149
6320
|
function resolveBuyerSignIn(platformConfig) {
|
|
6150
|
-
for (const factory of
|
|
6321
|
+
for (const factory of factories7) {
|
|
6151
6322
|
const provider = factory(platformConfig);
|
|
6152
6323
|
if (provider !== void 0) return provider;
|
|
6153
6324
|
}
|
|
6154
6325
|
return void 0;
|
|
6155
6326
|
}
|
|
6156
6327
|
function clearBuyerSignIns() {
|
|
6157
|
-
|
|
6328
|
+
factories7.length = 0;
|
|
6158
6329
|
}
|
|
6159
6330
|
|
|
6160
6331
|
// ../ecommerce/src/code-discounts.ts
|
|
6161
|
-
var
|
|
6332
|
+
var factories8 = [];
|
|
6162
6333
|
function registerCodeDiscountSource(factory) {
|
|
6163
|
-
|
|
6334
|
+
factories8.push(factory);
|
|
6164
6335
|
}
|
|
6165
6336
|
function resolveCodeDiscountSource(options) {
|
|
6166
|
-
for (const factory of
|
|
6337
|
+
for (const factory of factories8) {
|
|
6167
6338
|
const source = factory(options);
|
|
6168
6339
|
if (source !== void 0) return source;
|
|
6169
6340
|
}
|
|
6170
6341
|
return void 0;
|
|
6171
6342
|
}
|
|
6172
6343
|
function clearCodeDiscountSources() {
|
|
6173
|
-
|
|
6344
|
+
factories8.length = 0;
|
|
6174
6345
|
}
|
|
6175
6346
|
|
|
6176
6347
|
// ../ecommerce/src/store-theme.ts
|
|
@@ -6180,19 +6351,19 @@ var StoreThemeAccessError = class extends Error {
|
|
|
6180
6351
|
this.name = "StoreThemeAccessError";
|
|
6181
6352
|
}
|
|
6182
6353
|
};
|
|
6183
|
-
var
|
|
6354
|
+
var factories9 = [];
|
|
6184
6355
|
function registerStoreThemeSource(factory) {
|
|
6185
|
-
|
|
6356
|
+
factories9.push(factory);
|
|
6186
6357
|
}
|
|
6187
6358
|
function resolveStoreThemeSource(options) {
|
|
6188
|
-
for (const factory of
|
|
6359
|
+
for (const factory of factories9) {
|
|
6189
6360
|
const source = factory(options);
|
|
6190
6361
|
if (source !== void 0) return source;
|
|
6191
6362
|
}
|
|
6192
6363
|
return void 0;
|
|
6193
6364
|
}
|
|
6194
6365
|
function clearStoreThemeSources() {
|
|
6195
|
-
|
|
6366
|
+
factories9.length = 0;
|
|
6196
6367
|
}
|
|
6197
6368
|
|
|
6198
6369
|
// ../ecommerce/src/installment-offer.ts
|
|
@@ -6276,6 +6447,100 @@ function runSessionScopedClearHandlers() {
|
|
|
6276
6447
|
}
|
|
6277
6448
|
}
|
|
6278
6449
|
|
|
6450
|
+
// src/session/use-board.ts
|
|
6451
|
+
import { useCallback as useCallback2, useMemo as useMemo3, useSyncExternalStore as useSyncExternalStore2 } from "react";
|
|
6452
|
+
|
|
6453
|
+
// src/client-state/server-store.ts
|
|
6454
|
+
var entries = /* @__PURE__ */ new Map();
|
|
6455
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
6456
|
+
var entriesCache = /* @__PURE__ */ new Map();
|
|
6457
|
+
function notify() {
|
|
6458
|
+
entriesCache = new Map(entries);
|
|
6459
|
+
for (const l of listeners) l();
|
|
6460
|
+
}
|
|
6461
|
+
function applyServerState(namespace, rev, payload) {
|
|
6462
|
+
if (namespace.length === 0) return false;
|
|
6463
|
+
const prev = entries.get(namespace);
|
|
6464
|
+
if (prev !== void 0 && rev <= prev.rev) return false;
|
|
6465
|
+
entries.set(namespace, { payload, rev });
|
|
6466
|
+
notify();
|
|
6467
|
+
return true;
|
|
6468
|
+
}
|
|
6469
|
+
function serverState(namespace) {
|
|
6470
|
+
const entry = entries.get(namespace);
|
|
6471
|
+
return entry === void 0 ? void 0 : entry.payload;
|
|
6472
|
+
}
|
|
6473
|
+
function serverStateRev(namespace) {
|
|
6474
|
+
const entry = entries.get(namespace);
|
|
6475
|
+
return entry === void 0 ? 0 : entry.rev;
|
|
6476
|
+
}
|
|
6477
|
+
function serverStateVector() {
|
|
6478
|
+
const out = {};
|
|
6479
|
+
for (const [ns, e] of entries) out[ns] = e.rev;
|
|
6480
|
+
return out;
|
|
6481
|
+
}
|
|
6482
|
+
function serverStateEntries() {
|
|
6483
|
+
return entriesCache;
|
|
6484
|
+
}
|
|
6485
|
+
function subscribeServerState(listener) {
|
|
6486
|
+
listeners.add(listener);
|
|
6487
|
+
return () => {
|
|
6488
|
+
listeners.delete(listener);
|
|
6489
|
+
};
|
|
6490
|
+
}
|
|
6491
|
+
function resetServerState() {
|
|
6492
|
+
if (entries.size === 0) return;
|
|
6493
|
+
entries.clear();
|
|
6494
|
+
notify();
|
|
6495
|
+
}
|
|
6496
|
+
function primedEntities() {
|
|
6497
|
+
const payload = serverState(ENTITY_PRIME_NAMESPACE);
|
|
6498
|
+
if (payload === void 0) return {};
|
|
6499
|
+
const out = {};
|
|
6500
|
+
for (const [resolverKey, byRef] of Object.entries(payload)) {
|
|
6501
|
+
if (byRef === null || typeof byRef !== "object" || Array.isArray(byRef)) continue;
|
|
6502
|
+
out[resolverKey] = byRef;
|
|
6503
|
+
}
|
|
6504
|
+
return out;
|
|
6505
|
+
}
|
|
6506
|
+
function primedEntitiesFor(resolverKey) {
|
|
6507
|
+
const byKey = primedEntities()[resolverKey];
|
|
6508
|
+
return byKey === void 0 ? {} : byKey;
|
|
6509
|
+
}
|
|
6510
|
+
|
|
6511
|
+
// src/session/use-board.ts
|
|
6512
|
+
var NOT_ON_A_BOARD = { joined: false };
|
|
6513
|
+
function readBoard(entries3) {
|
|
6514
|
+
const entry = entries3.get(BOARD_NAMESPACE);
|
|
6515
|
+
if (entry === void 0) return NOT_ON_A_BOARD;
|
|
6516
|
+
const parsed = BoardStateSchema.safeParse(entry.payload);
|
|
6517
|
+
if (parsed.success) return parsed.data;
|
|
6518
|
+
console.warn("[useBoard] unreadable board frame \u2014 showing no board:", parsed.error.issues[0]?.message);
|
|
6519
|
+
return NOT_ON_A_BOARD;
|
|
6520
|
+
}
|
|
6521
|
+
function linkFor(invite) {
|
|
6522
|
+
if (typeof window === "undefined") return null;
|
|
6523
|
+
const url = new URL(window.location.pathname, window.location.origin);
|
|
6524
|
+
url.searchParams.set("board", invite);
|
|
6525
|
+
return url.toString();
|
|
6526
|
+
}
|
|
6527
|
+
function useBoard() {
|
|
6528
|
+
const entries3 = useSyncExternalStore2(subscribeServerState, serverStateEntries, serverStateEntries);
|
|
6529
|
+
const state2 = useMemo3(() => readBoard(entries3), [entries3]);
|
|
6530
|
+
const { board: call } = useFourtySession();
|
|
6531
|
+
const share = useCallback2(
|
|
6532
|
+
async (input, name) => {
|
|
6533
|
+
const after = await call({ kind: "share", share: input, ...name === void 0 ? {} : { name } });
|
|
6534
|
+
return after !== null && after.joined ? linkFor(after.board.invite) : null;
|
|
6535
|
+
},
|
|
6536
|
+
[call]
|
|
6537
|
+
);
|
|
6538
|
+
const edit = useCallback2((e) => void call({ kind: "edit", edit: e }), [call]);
|
|
6539
|
+
const leave = useCallback2(() => void call({ kind: "leave" }), [call]);
|
|
6540
|
+
const board = state2.joined ? state2.board : null;
|
|
6541
|
+
return { board, share, edit, leave, link: board === null ? null : linkFor(board.invite) };
|
|
6542
|
+
}
|
|
6543
|
+
|
|
6279
6544
|
// src/shell/index.ts
|
|
6280
6545
|
var shell_exports = {};
|
|
6281
6546
|
__export(shell_exports, {
|
|
@@ -6327,19 +6592,19 @@ import React2 from "react";
|
|
|
6327
6592
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
6328
6593
|
var ScrollContainerContext = React2.createContext(null);
|
|
6329
6594
|
function ScrollContainerProvider({
|
|
6330
|
-
value,
|
|
6595
|
+
value: value2,
|
|
6331
6596
|
children
|
|
6332
6597
|
}) {
|
|
6333
|
-
return /* @__PURE__ */ jsx2(ScrollContainerContext.Provider, { value, children });
|
|
6598
|
+
return /* @__PURE__ */ jsx2(ScrollContainerContext.Provider, { value: value2, children });
|
|
6334
6599
|
}
|
|
6335
6600
|
function useScrollContainerRef() {
|
|
6336
|
-
const
|
|
6337
|
-
if (!
|
|
6601
|
+
const ref2 = React2.useContext(ScrollContainerContext);
|
|
6602
|
+
if (!ref2) {
|
|
6338
6603
|
throw new Error(
|
|
6339
6604
|
"useScrollContainerRef must be used inside <ScrollContainerProvider> (mounted by FourtyProvider)."
|
|
6340
6605
|
);
|
|
6341
6606
|
}
|
|
6342
|
-
return
|
|
6607
|
+
return ref2;
|
|
6343
6608
|
}
|
|
6344
6609
|
|
|
6345
6610
|
// src/shell/ShellRegistry.tsx
|
|
@@ -6360,8 +6625,8 @@ function useShellRegistry() {
|
|
|
6360
6625
|
import { createContext as createContext5, useContext as useContext5 } from "react";
|
|
6361
6626
|
var ShellRootContext = createContext5(null);
|
|
6362
6627
|
function useShellRoot() {
|
|
6363
|
-
const
|
|
6364
|
-
return
|
|
6628
|
+
const ref2 = useContext5(ShellRootContext);
|
|
6629
|
+
return ref2 ? ref2.current : null;
|
|
6365
6630
|
}
|
|
6366
6631
|
|
|
6367
6632
|
// src/shell/dock-persistence.tsx
|
|
@@ -6373,10 +6638,10 @@ var DockPersistenceContext = React4.createContext({
|
|
|
6373
6638
|
}
|
|
6374
6639
|
});
|
|
6375
6640
|
function DockPersistenceProvider({
|
|
6376
|
-
value,
|
|
6641
|
+
value: value2,
|
|
6377
6642
|
children
|
|
6378
6643
|
}) {
|
|
6379
|
-
return /* @__PURE__ */ jsx4(DockPersistenceContext.Provider, { value, children });
|
|
6644
|
+
return /* @__PURE__ */ jsx4(DockPersistenceContext.Provider, { value: value2, children });
|
|
6380
6645
|
}
|
|
6381
6646
|
function useDockPersistence() {
|
|
6382
6647
|
return React4.useContext(DockPersistenceContext);
|
|
@@ -6387,10 +6652,10 @@ import React5 from "react";
|
|
|
6387
6652
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
6388
6653
|
var BotCheckNoticeContext = React5.createContext(null);
|
|
6389
6654
|
function BotCheckNoticeProvider({
|
|
6390
|
-
value,
|
|
6655
|
+
value: value2,
|
|
6391
6656
|
children
|
|
6392
6657
|
}) {
|
|
6393
|
-
return /* @__PURE__ */ jsx5(BotCheckNoticeContext.Provider, { value, children });
|
|
6658
|
+
return /* @__PURE__ */ jsx5(BotCheckNoticeContext.Provider, { value: value2, children });
|
|
6394
6659
|
}
|
|
6395
6660
|
function useBotCheckNotice() {
|
|
6396
6661
|
return React5.useContext(BotCheckNoticeContext);
|
|
@@ -6445,6 +6710,9 @@ function useSessionId() {
|
|
|
6445
6710
|
function useSessionMessages() {
|
|
6446
6711
|
return useFourtyRuntime().useSessionMessages();
|
|
6447
6712
|
}
|
|
6713
|
+
function useSeedLayout() {
|
|
6714
|
+
return useFourtyRuntime().useSeedLayout();
|
|
6715
|
+
}
|
|
6448
6716
|
function useFacts() {
|
|
6449
6717
|
return useFourtyRuntime().useFacts();
|
|
6450
6718
|
}
|
|
@@ -6523,14 +6791,14 @@ function useHydrated() {
|
|
|
6523
6791
|
import React7 from "react";
|
|
6524
6792
|
function useOverridableToggle(defaultValue) {
|
|
6525
6793
|
const [override, setOverride] = React7.useState(null);
|
|
6526
|
-
const
|
|
6794
|
+
const value2 = override === null ? defaultValue : override;
|
|
6527
6795
|
const set = React7.useCallback((next) => {
|
|
6528
6796
|
setOverride(next);
|
|
6529
6797
|
}, []);
|
|
6530
6798
|
const toggle = () => {
|
|
6531
|
-
setOverride(!
|
|
6799
|
+
setOverride(!value2);
|
|
6532
6800
|
};
|
|
6533
|
-
return { value, toggle, set };
|
|
6801
|
+
return { value: value2, toggle, set };
|
|
6534
6802
|
}
|
|
6535
6803
|
|
|
6536
6804
|
// src/shell/use-dock-state.ts
|
|
@@ -6660,7 +6928,7 @@ function useComposerAttachments() {
|
|
|
6660
6928
|
failure: null
|
|
6661
6929
|
});
|
|
6662
6930
|
session.uploadAttachment(file).then(
|
|
6663
|
-
(
|
|
6931
|
+
(ref2) => update2(localId, { status: "ready", ref: ref2 }),
|
|
6664
6932
|
(err) => update2(localId, { status: "error", failure: failureOf(err) })
|
|
6665
6933
|
);
|
|
6666
6934
|
},
|
|
@@ -6739,10 +7007,10 @@ function useComposerAttachments() {
|
|
|
6739
7007
|
import * as React11 from "react";
|
|
6740
7008
|
|
|
6741
7009
|
// src/voice/use-voice-capture.ts
|
|
6742
|
-
import { useCallback as
|
|
7010
|
+
import { useCallback as useCallback5, useEffect as useEffect4, useRef as useRef4, useState as useState3 } from "react";
|
|
6743
7011
|
|
|
6744
7012
|
// src/voice/use-dictation.ts
|
|
6745
|
-
import { useCallback as
|
|
7013
|
+
import { useCallback as useCallback4, useEffect as useEffect3, useRef as useRef3, useState as useState2 } from "react";
|
|
6746
7014
|
function resolveSpeechRecognitionCtor() {
|
|
6747
7015
|
if (typeof globalThis.SpeechRecognition === "function") {
|
|
6748
7016
|
return globalThis.SpeechRecognition;
|
|
@@ -6772,7 +7040,7 @@ function useDictation(options) {
|
|
|
6772
7040
|
useEffect3(() => {
|
|
6773
7041
|
setSupported(resolveSpeechRecognitionCtor() !== null);
|
|
6774
7042
|
}, []);
|
|
6775
|
-
const start =
|
|
7043
|
+
const start = useCallback4(() => {
|
|
6776
7044
|
if (recognitionRef.current !== null) return;
|
|
6777
7045
|
const Ctor = resolveSpeechRecognitionCtor();
|
|
6778
7046
|
if (Ctor === null) return;
|
|
@@ -6843,7 +7111,7 @@ function useDictation(options) {
|
|
|
6843
7111
|
setListening(true);
|
|
6844
7112
|
setPermissionDenied(false);
|
|
6845
7113
|
}, []);
|
|
6846
|
-
const stop =
|
|
7114
|
+
const stop = useCallback4(() => {
|
|
6847
7115
|
intentRef.current = false;
|
|
6848
7116
|
const recognition = recognitionRef.current;
|
|
6849
7117
|
if (recognition !== null) {
|
|
@@ -6852,7 +7120,7 @@ function useDictation(options) {
|
|
|
6852
7120
|
recognition.stop();
|
|
6853
7121
|
}
|
|
6854
7122
|
}, []);
|
|
6855
|
-
const toggle =
|
|
7123
|
+
const toggle = useCallback4(() => {
|
|
6856
7124
|
if (recognitionRef.current !== null) {
|
|
6857
7125
|
stop();
|
|
6858
7126
|
} else {
|
|
@@ -6889,7 +7157,7 @@ function useVoiceCapture(options) {
|
|
|
6889
7157
|
const commitRef = useRef4(() => {
|
|
6890
7158
|
});
|
|
6891
7159
|
const wakeLockRef = useRef4(null);
|
|
6892
|
-
const releaseWakeLock =
|
|
7160
|
+
const releaseWakeLock = useCallback5(() => {
|
|
6893
7161
|
const sentinel = wakeLockRef.current;
|
|
6894
7162
|
if (sentinel === null) return;
|
|
6895
7163
|
wakeLockRef.current = null;
|
|
@@ -6897,7 +7165,7 @@ function useVoiceCapture(options) {
|
|
|
6897
7165
|
console.warn("[useVoiceCapture] failed to release the screen wake lock:", err);
|
|
6898
7166
|
});
|
|
6899
7167
|
}, []);
|
|
6900
|
-
const acquireWakeLock =
|
|
7168
|
+
const acquireWakeLock = useCallback5(() => {
|
|
6901
7169
|
if (typeof navigator === "undefined" || !("wakeLock" in navigator)) return;
|
|
6902
7170
|
releaseWakeLock();
|
|
6903
7171
|
navigator.wakeLock.request("screen").then(
|
|
@@ -6909,13 +7177,13 @@ function useVoiceCapture(options) {
|
|
|
6909
7177
|
}
|
|
6910
7178
|
);
|
|
6911
7179
|
}, [releaseWakeLock]);
|
|
6912
|
-
const clearSilenceTimer =
|
|
7180
|
+
const clearSilenceTimer = useCallback5(() => {
|
|
6913
7181
|
if (silenceTimerRef.current !== null) {
|
|
6914
7182
|
clearTimeout(silenceTimerRef.current);
|
|
6915
7183
|
silenceTimerRef.current = null;
|
|
6916
7184
|
}
|
|
6917
7185
|
}, []);
|
|
6918
|
-
const reset =
|
|
7186
|
+
const reset = useCallback5(() => {
|
|
6919
7187
|
stateRef.current = "idle";
|
|
6920
7188
|
clearSilenceTimer();
|
|
6921
7189
|
releaseWakeLock();
|
|
@@ -6923,7 +7191,7 @@ function useVoiceCapture(options) {
|
|
|
6923
7191
|
setTranscript("");
|
|
6924
7192
|
setState("idle");
|
|
6925
7193
|
}, [clearSilenceTimer, releaseWakeLock]);
|
|
6926
|
-
const handleResult =
|
|
7194
|
+
const handleResult = useCallback5(
|
|
6927
7195
|
(next) => {
|
|
6928
7196
|
if (stateRef.current !== "listening") return;
|
|
6929
7197
|
transcriptRef.current = next;
|
|
@@ -6939,7 +7207,7 @@ function useVoiceCapture(options) {
|
|
|
6939
7207
|
const dictation = useDictation({ onResult: handleResult, lang });
|
|
6940
7208
|
const dictationRef = useRef4(dictation);
|
|
6941
7209
|
dictationRef.current = dictation;
|
|
6942
|
-
const commit =
|
|
7210
|
+
const commit = useCallback5(() => {
|
|
6943
7211
|
if (stateRef.current !== "listening") return;
|
|
6944
7212
|
const text2 = transcriptRef.current.trim();
|
|
6945
7213
|
reset();
|
|
@@ -6947,11 +7215,11 @@ function useVoiceCapture(options) {
|
|
|
6947
7215
|
if (text2.length > 0) onCommitRef.current(text2);
|
|
6948
7216
|
}, [reset]);
|
|
6949
7217
|
commitRef.current = commit;
|
|
6950
|
-
const cancel =
|
|
7218
|
+
const cancel = useCallback5(() => {
|
|
6951
7219
|
reset();
|
|
6952
7220
|
dictationRef.current.stop();
|
|
6953
7221
|
}, [reset]);
|
|
6954
|
-
const start =
|
|
7222
|
+
const start = useCallback5(() => {
|
|
6955
7223
|
if (!dictationRef.current.supported || stateRef.current === "listening") return;
|
|
6956
7224
|
stateRef.current = "listening";
|
|
6957
7225
|
transcriptRef.current = "";
|
|
@@ -6960,7 +7228,7 @@ function useVoiceCapture(options) {
|
|
|
6960
7228
|
acquireWakeLock();
|
|
6961
7229
|
dictationRef.current.start();
|
|
6962
7230
|
}, [acquireWakeLock]);
|
|
6963
|
-
const toggle =
|
|
7231
|
+
const toggle = useCallback5(() => {
|
|
6964
7232
|
if (stateRef.current === "listening") commit();
|
|
6965
7233
|
else start();
|
|
6966
7234
|
}, [commit, start]);
|
|
@@ -7007,11 +7275,11 @@ var ORIGIN_TTL_MS = 3e3;
|
|
|
7007
7275
|
var noted = null;
|
|
7008
7276
|
var notedAt = 0;
|
|
7009
7277
|
var expiry = null;
|
|
7010
|
-
var
|
|
7011
|
-
var
|
|
7278
|
+
var listeners2 = /* @__PURE__ */ new Set();
|
|
7279
|
+
var notify2 = () => listeners2.forEach((l) => l());
|
|
7012
7280
|
var sameWords = (a, b) => a.replace(/\s+/g, " ").trim() === b.replace(/\s+/g, " ").trim();
|
|
7013
|
-
var px = (
|
|
7014
|
-
const n = Number.parseFloat(
|
|
7281
|
+
var px = (value2, fallback) => {
|
|
7282
|
+
const n = Number.parseFloat(value2);
|
|
7015
7283
|
return Number.isFinite(n) ? n : fallback;
|
|
7016
7284
|
};
|
|
7017
7285
|
function noteSubmitOrigin(text2, el) {
|
|
@@ -7035,9 +7303,9 @@ function noteSubmitOrigin(text2, el) {
|
|
|
7035
7303
|
expiry = setTimeout(() => {
|
|
7036
7304
|
noted = null;
|
|
7037
7305
|
expiry = null;
|
|
7038
|
-
|
|
7306
|
+
notify2();
|
|
7039
7307
|
}, ORIGIN_TTL_MS);
|
|
7040
|
-
|
|
7308
|
+
notify2();
|
|
7041
7309
|
}
|
|
7042
7310
|
function takeSubmitOrigin(text2) {
|
|
7043
7311
|
const origin = noted;
|
|
@@ -7045,12 +7313,12 @@ function takeSubmitOrigin(text2) {
|
|
|
7045
7313
|
noted = null;
|
|
7046
7314
|
if (expiry !== null) clearTimeout(expiry);
|
|
7047
7315
|
expiry = null;
|
|
7048
|
-
|
|
7316
|
+
notify2();
|
|
7049
7317
|
return origin;
|
|
7050
7318
|
}
|
|
7051
7319
|
function subscribe(listener) {
|
|
7052
|
-
|
|
7053
|
-
return () =>
|
|
7320
|
+
listeners2.add(listener);
|
|
7321
|
+
return () => listeners2.delete(listener);
|
|
7054
7322
|
}
|
|
7055
7323
|
function useWaitingSubmitOrigin() {
|
|
7056
7324
|
return React10.useSyncExternalStore(subscribe, () => noted, () => null);
|
|
@@ -7062,7 +7330,7 @@ function usePromptComposer(options = {}) {
|
|
|
7062
7330
|
const session = useFourtySession();
|
|
7063
7331
|
const internalAttach = useComposerAttachments();
|
|
7064
7332
|
const attach = attachmentsController !== void 0 ? attachmentsController : internalAttach;
|
|
7065
|
-
const [
|
|
7333
|
+
const [value2, setValue] = useComposerDraft();
|
|
7066
7334
|
const dictationBaseRef = React11.useRef("");
|
|
7067
7335
|
const handleDictationResult = React11.useCallback((transcript) => {
|
|
7068
7336
|
const base = dictationBaseRef.current;
|
|
@@ -7074,8 +7342,8 @@ function usePromptComposer(options = {}) {
|
|
|
7074
7342
|
onResult: handleDictationResult,
|
|
7075
7343
|
onCommit: () => submitRef.current()
|
|
7076
7344
|
});
|
|
7077
|
-
const valueRef = React11.useRef(
|
|
7078
|
-
valueRef.current =
|
|
7345
|
+
const valueRef = React11.useRef(value2);
|
|
7346
|
+
valueRef.current = value2;
|
|
7079
7347
|
const toggleDictation = React11.useCallback(() => {
|
|
7080
7348
|
if (voiceCapture.state !== "listening") {
|
|
7081
7349
|
dictationBaseRef.current = valueRef.current;
|
|
@@ -7092,23 +7360,23 @@ function usePromptComposer(options = {}) {
|
|
|
7092
7360
|
},
|
|
7093
7361
|
[attach]
|
|
7094
7362
|
);
|
|
7095
|
-
const canSend = (
|
|
7363
|
+
const canSend = (value2.trim().length > 0 || attach.readyRefs.length > 0) && !attach.hasPending;
|
|
7096
7364
|
const submit = React11.useCallback(() => {
|
|
7097
|
-
if (!((
|
|
7365
|
+
if (!((value2.trim().length > 0 || attach.readyRefs.length > 0) && !attach.hasPending)) return;
|
|
7098
7366
|
voiceCapture.cancel();
|
|
7099
7367
|
const originEl = origin === void 0 ? null : origin.current;
|
|
7100
|
-
if (originEl !== null &&
|
|
7101
|
-
const text2 =
|
|
7368
|
+
if (originEl !== null && value2.trim().length > 0) noteSubmitOrigin(value2, originEl);
|
|
7369
|
+
const text2 = value2;
|
|
7102
7370
|
const options2 = attach.readyRefs.length > 0 ? { attachments: attach.readyRefs } : void 0;
|
|
7103
7371
|
setValue("");
|
|
7104
7372
|
attach.clear();
|
|
7105
7373
|
requestAnimationFrame(() => {
|
|
7106
7374
|
setTimeout(() => session.sendMessage(text2, options2), 0);
|
|
7107
7375
|
});
|
|
7108
|
-
}, [session,
|
|
7376
|
+
}, [session, value2, attach, setValue, voiceCapture, origin]);
|
|
7109
7377
|
submitRef.current = submit;
|
|
7110
7378
|
return {
|
|
7111
|
-
value,
|
|
7379
|
+
value: value2,
|
|
7112
7380
|
setValue,
|
|
7113
7381
|
attachments: attach,
|
|
7114
7382
|
dictation: {
|
|
@@ -7243,7 +7511,7 @@ function useThreadRows() {
|
|
|
7243
7511
|
ask: pending2.streams.ask
|
|
7244
7512
|
});
|
|
7245
7513
|
}
|
|
7246
|
-
const
|
|
7514
|
+
const sessionId = useSessionId();
|
|
7247
7515
|
const settled = sessionId !== null;
|
|
7248
7516
|
return { rows, isEmpty: hydrated && settled && messages.length === 0 && pending2 === null };
|
|
7249
7517
|
}
|
|
@@ -7256,18 +7524,18 @@ import * as React17 from "react";
|
|
|
7256
7524
|
function useIsSeedHome() {
|
|
7257
7525
|
const layout = useDisplayedLayout();
|
|
7258
7526
|
const turn = useTurn();
|
|
7259
|
-
const
|
|
7527
|
+
const seedLayout = useSeedLayout();
|
|
7260
7528
|
return React17.useMemo(() => {
|
|
7261
|
-
if (
|
|
7529
|
+
if (seedLayout === null) return false;
|
|
7262
7530
|
if (turn.index !== 0) return false;
|
|
7263
7531
|
if (turn.userMessage !== "") return false;
|
|
7264
7532
|
try {
|
|
7265
|
-
return JSON.stringify(layout) === JSON.stringify(
|
|
7533
|
+
return JSON.stringify(layout) === JSON.stringify(seedLayout);
|
|
7266
7534
|
} catch (err) {
|
|
7267
7535
|
console.warn("[useIsSeedHome] could not compare the layout with the seed \u2014 treating it as not home", err);
|
|
7268
7536
|
return false;
|
|
7269
7537
|
}
|
|
7270
|
-
}, [layout,
|
|
7538
|
+
}, [layout, seedLayout, turn.index, turn.userMessage]);
|
|
7271
7539
|
}
|
|
7272
7540
|
|
|
7273
7541
|
// src/shell/conversation/answer-text.ts
|
|
@@ -7295,8 +7563,8 @@ function withoutClosingQuestion(body) {
|
|
|
7295
7563
|
}
|
|
7296
7564
|
|
|
7297
7565
|
// src/canvas/turn-edit.ts
|
|
7298
|
-
function isRecord2(
|
|
7299
|
-
return typeof
|
|
7566
|
+
function isRecord2(value2) {
|
|
7567
|
+
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
|
|
7300
7568
|
}
|
|
7301
7569
|
function sameValue(a, b) {
|
|
7302
7570
|
if (a === b) return true;
|
|
@@ -7375,29 +7643,29 @@ function recordsOf(output) {
|
|
|
7375
7643
|
const parsed = parse(output);
|
|
7376
7644
|
if (typeof parsed !== "object" || parsed === null) return void 0;
|
|
7377
7645
|
for (const key of SCAN_RECORD_KEYS) {
|
|
7378
|
-
const
|
|
7379
|
-
if (!Array.isArray(
|
|
7380
|
-
return
|
|
7646
|
+
const value2 = Reflect.get(parsed, key);
|
|
7647
|
+
if (!Array.isArray(value2)) continue;
|
|
7648
|
+
return value2.filter((item) => typeof item === "object" && item !== null);
|
|
7381
7649
|
}
|
|
7382
7650
|
return void 0;
|
|
7383
7651
|
}
|
|
7384
7652
|
function imageOf(record2) {
|
|
7385
7653
|
for (const key of SCAN_IMAGE_KEYS) {
|
|
7386
|
-
const
|
|
7387
|
-
if (typeof
|
|
7654
|
+
const value2 = Reflect.get(record2, key);
|
|
7655
|
+
if (typeof value2 === "string" && value2.length > 0) return value2;
|
|
7388
7656
|
}
|
|
7389
7657
|
return void 0;
|
|
7390
7658
|
}
|
|
7391
7659
|
function metaOf(record2) {
|
|
7392
7660
|
const meta = {};
|
|
7393
|
-
for (const [key,
|
|
7661
|
+
for (const [key, value2] of Object.entries(record2)) {
|
|
7394
7662
|
if (key === "id" || key.startsWith("__") || SCAN_IMAGE_KEYS.includes(key)) continue;
|
|
7395
|
-
if (typeof
|
|
7396
|
-
meta[key] =
|
|
7663
|
+
if (typeof value2 === "number" || typeof value2 === "boolean") {
|
|
7664
|
+
meta[key] = value2;
|
|
7397
7665
|
continue;
|
|
7398
7666
|
}
|
|
7399
|
-
if (typeof
|
|
7400
|
-
meta[key] =
|
|
7667
|
+
if (typeof value2 === "string" && value2.length > 0) {
|
|
7668
|
+
meta[key] = value2.length <= SCAN_FACET_MAX_CHARS ? value2 : value2.slice(0, SCAN_FACET_MAX_CHARS);
|
|
7401
7669
|
}
|
|
7402
7670
|
}
|
|
7403
7671
|
return Object.keys(meta).length > 0 ? meta : void 0;
|
|
@@ -7406,12 +7674,12 @@ function refOf(record2) {
|
|
|
7406
7674
|
if (typeof record2 !== "object" || record2 === null) return void 0;
|
|
7407
7675
|
const id = Reflect.get(record2, "id");
|
|
7408
7676
|
if (typeof id !== "string" || id.length === 0) return void 0;
|
|
7409
|
-
const
|
|
7677
|
+
const ref2 = { id };
|
|
7410
7678
|
const imageUrl = imageOf(record2);
|
|
7411
|
-
if (imageUrl !== void 0)
|
|
7679
|
+
if (imageUrl !== void 0) ref2.imageUrl = imageUrl;
|
|
7412
7680
|
const meta = metaOf(record2);
|
|
7413
|
-
if (meta !== void 0)
|
|
7414
|
-
return
|
|
7681
|
+
if (meta !== void 0) ref2.meta = meta;
|
|
7682
|
+
return ref2;
|
|
7415
7683
|
}
|
|
7416
7684
|
function pendingSourceElement(input) {
|
|
7417
7685
|
return {
|
|
@@ -7429,8 +7697,8 @@ function deriveSourceElement(input) {
|
|
|
7429
7697
|
if (records === void 0) return void 0;
|
|
7430
7698
|
const refs = [];
|
|
7431
7699
|
for (const record2 of records) {
|
|
7432
|
-
const
|
|
7433
|
-
if (
|
|
7700
|
+
const ref2 = refOf(record2);
|
|
7701
|
+
if (ref2 !== void 0) refs.push(ref2);
|
|
7434
7702
|
}
|
|
7435
7703
|
const element = {
|
|
7436
7704
|
id: input.id,
|
|
@@ -7477,9 +7745,9 @@ function projectSourceOutput(output) {
|
|
|
7477
7745
|
}
|
|
7478
7746
|
|
|
7479
7747
|
// ../spacestation/src/widgets/presence/element.ts
|
|
7480
|
-
function isPresenceStreamArtifact(
|
|
7481
|
-
if (typeof
|
|
7482
|
-
return Array.isArray(Reflect.get(
|
|
7748
|
+
function isPresenceStreamArtifact(value2) {
|
|
7749
|
+
if (typeof value2 !== "object" || value2 === null) return false;
|
|
7750
|
+
return Array.isArray(Reflect.get(value2, "elements"));
|
|
7483
7751
|
}
|
|
7484
7752
|
var PRESENCE_LIFECYCLE = {
|
|
7485
7753
|
// Two-stage, and the two stages are MARK then PRUNE:
|
|
@@ -7500,8 +7768,8 @@ var PRESENCE_LIFECYCLE = {
|
|
|
7500
7768
|
};
|
|
7501
7769
|
|
|
7502
7770
|
// ../spacestation/src/widgets/presence/profile.ts
|
|
7503
|
-
import { z as
|
|
7504
|
-
var PresenceProfileSchema =
|
|
7771
|
+
import { z as z50 } from "zod";
|
|
7772
|
+
var PresenceProfileSchema = z50.object({
|
|
7505
7773
|
/**
|
|
7506
7774
|
* How much the agent SPEAKS in presence.
|
|
7507
7775
|
* - 'off' the faculty generates no prose at all. Zero tokens, and
|
|
@@ -7511,14 +7779,14 @@ var PresenceProfileSchema = z49.object({
|
|
|
7511
7779
|
* - 'terse' one lead line per turn. The default — see below.
|
|
7512
7780
|
* - 'full' a lead line plus asides beside individual elements.
|
|
7513
7781
|
*/
|
|
7514
|
-
voice:
|
|
7782
|
+
voice: z50.enum(["off", "terse", "full"]),
|
|
7515
7783
|
/**
|
|
7516
7784
|
* Which source kinds this space surfaces. 'all' = every tool that declares a
|
|
7517
7785
|
* `sourceKind`. An explicit list lets a space stay quiet about lookups its
|
|
7518
7786
|
* visitors would find uninteresting (policy checks on a fashion space)
|
|
7519
7787
|
* without the tool having to lie about what it is.
|
|
7520
7788
|
*/
|
|
7521
|
-
sources:
|
|
7789
|
+
sources: z50.union([z50.array(z50.string()), z50.literal("all")]),
|
|
7522
7790
|
/**
|
|
7523
7791
|
* Which facts render.
|
|
7524
7792
|
* - 'inferred-only' hides `provenance: 'stated'` facts. The default and the
|
|
@@ -7527,7 +7795,7 @@ var PresenceProfileSchema = z49.object({
|
|
|
7527
7795
|
* - 'all' shows stated facts too — for spaces where confirming the brief
|
|
7528
7796
|
* back is itself the product (intake, configuration).
|
|
7529
7797
|
*/
|
|
7530
|
-
facts:
|
|
7798
|
+
facts: z50.enum(["inferred-only", "all"])
|
|
7531
7799
|
});
|
|
7532
7800
|
var DEFAULT_PRESENCE_PROFILE = {
|
|
7533
7801
|
voice: "terse",
|
|
@@ -7563,7 +7831,7 @@ function usePresenceLiveTurn() {
|
|
|
7563
7831
|
}
|
|
7564
7832
|
|
|
7565
7833
|
// src/widgets/presence/flows/flow-store.ts
|
|
7566
|
-
import { useSyncExternalStore as
|
|
7834
|
+
import { useSyncExternalStore as useSyncExternalStore4 } from "react";
|
|
7567
7835
|
|
|
7568
7836
|
// src/utils/storage.ts
|
|
7569
7837
|
var opened = /* @__PURE__ */ new Map();
|
|
@@ -7576,7 +7844,7 @@ function openWebStorage(kind) {
|
|
|
7576
7844
|
if (storage3 === null) throw new Error(`window.${kind} is null (DOM storage disabled)`);
|
|
7577
7845
|
adapter = {
|
|
7578
7846
|
get: (key) => storage3.getItem(key),
|
|
7579
|
-
set: (key,
|
|
7847
|
+
set: (key, value2) => storage3.setItem(key, value2),
|
|
7580
7848
|
remove: (key) => storage3.removeItem(key)
|
|
7581
7849
|
};
|
|
7582
7850
|
} catch (err) {
|
|
@@ -7592,9 +7860,9 @@ function createWebStorageAdapter(kind) {
|
|
|
7592
7860
|
if (typeof window === "undefined") return null;
|
|
7593
7861
|
return openWebStorage(kind).get(key);
|
|
7594
7862
|
},
|
|
7595
|
-
set(key,
|
|
7863
|
+
set(key, value2) {
|
|
7596
7864
|
if (typeof window === "undefined") return;
|
|
7597
|
-
openWebStorage(kind).set(key,
|
|
7865
|
+
openWebStorage(kind).set(key, value2);
|
|
7598
7866
|
},
|
|
7599
7867
|
remove(key) {
|
|
7600
7868
|
if (typeof window === "undefined") return;
|
|
@@ -7614,8 +7882,8 @@ function createMemoryStorageAdapter() {
|
|
|
7614
7882
|
get(key) {
|
|
7615
7883
|
return store.get(key) ?? null;
|
|
7616
7884
|
},
|
|
7617
|
-
set(key,
|
|
7618
|
-
store.set(key,
|
|
7885
|
+
set(key, value2) {
|
|
7886
|
+
store.set(key, value2);
|
|
7619
7887
|
},
|
|
7620
7888
|
remove(key) {
|
|
7621
7889
|
store.delete(key);
|
|
@@ -7653,14 +7921,14 @@ function load() {
|
|
|
7653
7921
|
}
|
|
7654
7922
|
var outputs = load();
|
|
7655
7923
|
var freshIds = /* @__PURE__ */ new Set();
|
|
7656
|
-
var
|
|
7657
|
-
function
|
|
7658
|
-
for (const listener of
|
|
7924
|
+
var listeners3 = /* @__PURE__ */ new Set();
|
|
7925
|
+
function notify3() {
|
|
7926
|
+
for (const listener of listeners3) listener();
|
|
7659
7927
|
}
|
|
7660
7928
|
function subscribe2(listener) {
|
|
7661
|
-
|
|
7929
|
+
listeners3.add(listener);
|
|
7662
7930
|
return () => {
|
|
7663
|
-
|
|
7931
|
+
listeners3.delete(listener);
|
|
7664
7932
|
};
|
|
7665
7933
|
}
|
|
7666
7934
|
function persist() {
|
|
@@ -7671,7 +7939,7 @@ function setFlowOutput(flowId, data) {
|
|
|
7671
7939
|
outputs = { ...outputs, [flowId]: data };
|
|
7672
7940
|
freshIds.add(flowId);
|
|
7673
7941
|
persist();
|
|
7674
|
-
|
|
7942
|
+
notify3();
|
|
7675
7943
|
}
|
|
7676
7944
|
function getFlowOutput(flowId) {
|
|
7677
7945
|
return Object.prototype.hasOwnProperty.call(outputs, flowId) ? outputs[flowId] : null;
|
|
@@ -7680,14 +7948,14 @@ function subscribeFlowOutputs(listener) {
|
|
|
7680
7948
|
return subscribe2(listener);
|
|
7681
7949
|
}
|
|
7682
7950
|
function useAgentFlow(flowId) {
|
|
7683
|
-
return
|
|
7951
|
+
return useSyncExternalStore4(
|
|
7684
7952
|
subscribe2,
|
|
7685
7953
|
() => Object.prototype.hasOwnProperty.call(outputs, flowId) ? outputs[flowId] : null,
|
|
7686
7954
|
() => null
|
|
7687
7955
|
);
|
|
7688
7956
|
}
|
|
7689
7957
|
function useAgentFlowFresh(flowId) {
|
|
7690
|
-
return
|
|
7958
|
+
return useSyncExternalStore4(
|
|
7691
7959
|
subscribe2,
|
|
7692
7960
|
() => freshIds.has(flowId),
|
|
7693
7961
|
() => false
|
|
@@ -7698,7 +7966,7 @@ if (typeof window !== "undefined") {
|
|
|
7698
7966
|
outputs = {};
|
|
7699
7967
|
freshIds.clear();
|
|
7700
7968
|
persist();
|
|
7701
|
-
|
|
7969
|
+
notify3();
|
|
7702
7970
|
});
|
|
7703
7971
|
}
|
|
7704
7972
|
|
|
@@ -7721,7 +7989,7 @@ function useAgentPresenceFresh(flowId = PRESENCE_FLOW) {
|
|
|
7721
7989
|
}
|
|
7722
7990
|
|
|
7723
7991
|
// src/widgets/presence/use-layout-entity-ids.ts
|
|
7724
|
-
import { useMemo as
|
|
7992
|
+
import { useMemo as useMemo6 } from "react";
|
|
7725
7993
|
|
|
7726
7994
|
// src/catalog/CatalogContext.tsx
|
|
7727
7995
|
import { createContext as createContext9, useContext as useContext9 } from "react";
|
|
@@ -7742,7 +8010,7 @@ function collectLayoutGids(layout, catalog) {
|
|
|
7742
8010
|
const refs = /* @__PURE__ */ new Set();
|
|
7743
8011
|
if (!layout || !layout.elements) return refs;
|
|
7744
8012
|
for (const el of Object.values(layout.elements)) {
|
|
7745
|
-
for (const
|
|
8013
|
+
for (const ref2 of collectElementEntityRefs(el, catalog)) refs.add(ref2);
|
|
7746
8014
|
}
|
|
7747
8015
|
return refs;
|
|
7748
8016
|
}
|
|
@@ -7751,7 +8019,7 @@ function collectLayoutGids(layout, catalog) {
|
|
|
7751
8019
|
function useLayoutEntityIds() {
|
|
7752
8020
|
const layout = useLayout();
|
|
7753
8021
|
const catalog = useComponentCatalog();
|
|
7754
|
-
return
|
|
8022
|
+
return useMemo6(() => [...collectLayoutGids(layout, catalog)], [layout, catalog]);
|
|
7755
8023
|
}
|
|
7756
8024
|
|
|
7757
8025
|
// src/widgets/presence/use-presence.ts
|
|
@@ -7870,9 +8138,9 @@ function readEntries(data) {
|
|
|
7870
8138
|
const out = [];
|
|
7871
8139
|
for (const e of raw) {
|
|
7872
8140
|
if (typeof e !== "object" || e === null) continue;
|
|
7873
|
-
const
|
|
7874
|
-
const
|
|
7875
|
-
if (typeof
|
|
8141
|
+
const label2 = Reflect.get(e, "label");
|
|
8142
|
+
const value2 = Reflect.get(e, "value");
|
|
8143
|
+
if (typeof label2 === "string" && typeof value2 === "string") out.push({ label: label2, value: value2 });
|
|
7876
8144
|
}
|
|
7877
8145
|
return out;
|
|
7878
8146
|
}
|
|
@@ -7939,7 +8207,7 @@ function useConversationPage() {
|
|
|
7939
8207
|
const currentIndex = useCurrentMessageIndex();
|
|
7940
8208
|
const pending2 = usePendingMessage();
|
|
7941
8209
|
const layout = useDisplayedLayout();
|
|
7942
|
-
const
|
|
8210
|
+
const seedLayout = useSeedLayout();
|
|
7943
8211
|
const onSeedHome = useIsSeedHome();
|
|
7944
8212
|
const selectMessage = useSelectMessage();
|
|
7945
8213
|
const goHome = useGoHome();
|
|
@@ -8332,10 +8600,10 @@ var AGENT_ASK_SIGNAL = "agent_ask";
|
|
|
8332
8600
|
import React26 from "react";
|
|
8333
8601
|
|
|
8334
8602
|
// src/shared/use-expandable.ts
|
|
8335
|
-
import { useCallback as
|
|
8603
|
+
import { useCallback as useCallback12, useState as useState5 } from "react";
|
|
8336
8604
|
function useExpandable(initial = false) {
|
|
8337
8605
|
const [expanded, setExpanded] = useState5(initial);
|
|
8338
|
-
const toggle =
|
|
8606
|
+
const toggle = useCallback12(() => setExpanded((p) => !p), []);
|
|
8339
8607
|
return { expanded, toggle, setExpanded };
|
|
8340
8608
|
}
|
|
8341
8609
|
|
|
@@ -8343,9 +8611,9 @@ function useExpandable(initial = false) {
|
|
|
8343
8611
|
function useClampToggle(contentKey) {
|
|
8344
8612
|
const { expanded, toggle } = useExpandable(false);
|
|
8345
8613
|
const [overflowing, setOverflowing] = React26.useState(false);
|
|
8346
|
-
const
|
|
8614
|
+
const ref2 = React26.useRef(null);
|
|
8347
8615
|
React26.useEffect(() => {
|
|
8348
|
-
const el =
|
|
8616
|
+
const el = ref2.current;
|
|
8349
8617
|
if (el === null) return;
|
|
8350
8618
|
if (expanded) return;
|
|
8351
8619
|
const measure = () => {
|
|
@@ -8356,7 +8624,7 @@ function useClampToggle(contentKey) {
|
|
|
8356
8624
|
ro.observe(el);
|
|
8357
8625
|
return () => ro.disconnect();
|
|
8358
8626
|
}, [expanded, contentKey]);
|
|
8359
|
-
return { expanded, toggle, overflowing, ref };
|
|
8627
|
+
return { expanded, toggle, overflowing, ref: ref2 };
|
|
8360
8628
|
}
|
|
8361
8629
|
|
|
8362
8630
|
// src/provider/use-timed-flag.ts
|
|
@@ -8475,6 +8743,7 @@ __export(canvas_exports, {
|
|
|
8475
8743
|
usePendingMessage: () => usePendingMessage,
|
|
8476
8744
|
useReasoning: () => useReasoning,
|
|
8477
8745
|
useSafeFacts: () => useSafeFacts,
|
|
8746
|
+
useSeedLayout: () => useSeedLayout,
|
|
8478
8747
|
useSelectMessage: () => useSelectMessage,
|
|
8479
8748
|
useSessionId: () => useSessionId,
|
|
8480
8749
|
useSessionMessages: () => useSessionMessages,
|
|
@@ -8573,11 +8842,11 @@ import { jsx as jsx11 } from "react/jsx-runtime";
|
|
|
8573
8842
|
function FadeGroup({ children }) {
|
|
8574
8843
|
return /* @__PURE__ */ jsx11(AnimatePresence, { mode: "popLayout", initial: false, children });
|
|
8575
8844
|
}
|
|
8576
|
-
var FadeItem = React29.forwardRef(function FadeItem2({ id, children, style, className },
|
|
8845
|
+
var FadeItem = React29.forwardRef(function FadeItem2({ id, children, style, className }, ref2) {
|
|
8577
8846
|
return /* @__PURE__ */ jsx11(
|
|
8578
8847
|
motion2.div,
|
|
8579
8848
|
{
|
|
8580
|
-
ref,
|
|
8849
|
+
ref: ref2,
|
|
8581
8850
|
style,
|
|
8582
8851
|
className,
|
|
8583
8852
|
children
|
|
@@ -8610,8 +8879,8 @@ function CanvasArrangementProvider({
|
|
|
8610
8879
|
stackedTurns = false,
|
|
8611
8880
|
children
|
|
8612
8881
|
}) {
|
|
8613
|
-
const
|
|
8614
|
-
return /* @__PURE__ */ jsx12(CanvasArrangementContext.Provider, { value, children });
|
|
8882
|
+
const value2 = React30.useMemo(() => ({ arrangement, turnPages, stackedTurns }), [arrangement, turnPages, stackedTurns]);
|
|
8883
|
+
return /* @__PURE__ */ jsx12(CanvasArrangementContext.Provider, { value: value2, children });
|
|
8615
8884
|
}
|
|
8616
8885
|
function useCanvasArrangement() {
|
|
8617
8886
|
return useContext14(CanvasArrangementContext);
|
|
@@ -8628,15 +8897,15 @@ function CanvasLeadProvider(props) {
|
|
|
8628
8897
|
const listed = "types" in props ? props.types : props.except;
|
|
8629
8898
|
const only = "types" in props;
|
|
8630
8899
|
const canLead = React31.useCallback((type) => listed.includes(type) === only, [listed, only]);
|
|
8631
|
-
const
|
|
8632
|
-
return /* @__PURE__ */ jsx13(CanvasLeadContext.Provider, { value, children: props.children });
|
|
8900
|
+
const value2 = React31.useMemo(() => ({ canLead, target, setTarget, leadId, setLeadId }), [canLead, target, leadId]);
|
|
8901
|
+
return /* @__PURE__ */ jsx13(CanvasLeadContext.Provider, { value: value2, children: props.children });
|
|
8633
8902
|
}
|
|
8634
8903
|
function CanvasLeadSlot({ className }) {
|
|
8635
8904
|
const lead = React31.useContext(CanvasLeadContext);
|
|
8636
8905
|
if (lead === null) throw new Error("<CanvasLeadSlot> must be rendered inside <CanvasLeadProvider>.");
|
|
8637
8906
|
const { setTarget } = lead;
|
|
8638
|
-
const
|
|
8639
|
-
return /* @__PURE__ */ jsx13("div", { ref, className, "data-fourty-canvas-lead": "" });
|
|
8907
|
+
const ref2 = React31.useCallback((el) => setTarget(el), [setTarget]);
|
|
8908
|
+
return /* @__PURE__ */ jsx13("div", { ref: ref2, className, "data-fourty-canvas-lead": "" });
|
|
8640
8909
|
}
|
|
8641
8910
|
function useCanvasLead() {
|
|
8642
8911
|
const lead = React31.useContext(CanvasLeadContext);
|
|
@@ -8770,29 +9039,29 @@ var INITIAL_NAV_PRESENTATION = {
|
|
|
8770
9039
|
};
|
|
8771
9040
|
|
|
8772
9041
|
// src/canvas/use-canvas-actions.ts
|
|
8773
|
-
import { useCallback as
|
|
9042
|
+
import { useCallback as useCallback14 } from "react";
|
|
8774
9043
|
function navigateActionId(page) {
|
|
8775
9044
|
const id = Reflect.get(page, "id");
|
|
8776
9045
|
return typeof id === "string" ? `navigate-${page.kind}-${id}` : `navigate-${page.kind}`;
|
|
8777
9046
|
}
|
|
8778
9047
|
function useCanvasActions() {
|
|
8779
9048
|
const session = useOptionalFourtySession();
|
|
8780
|
-
const dispatchAction =
|
|
9049
|
+
const dispatchAction = useCallback14(
|
|
8781
9050
|
(action) => {
|
|
8782
9051
|
if (!session) return;
|
|
8783
9052
|
session.dispatchSuggestionAction(action);
|
|
8784
9053
|
},
|
|
8785
9054
|
[session]
|
|
8786
9055
|
);
|
|
8787
|
-
const navigate =
|
|
8788
|
-
(page,
|
|
8789
|
-
dispatchAction({ id: navigateActionId(page), label, type: NAVIGATE_SIGNAL, payload: { page } });
|
|
9056
|
+
const navigate = useCallback14(
|
|
9057
|
+
(page, label2) => {
|
|
9058
|
+
dispatchAction({ id: navigateActionId(page), label: label2, type: NAVIGATE_SIGNAL, payload: { page } });
|
|
8790
9059
|
},
|
|
8791
9060
|
[dispatchAction]
|
|
8792
9061
|
);
|
|
8793
|
-
const ask =
|
|
8794
|
-
(text2,
|
|
8795
|
-
dispatchAction({ id: `ask-${
|
|
9062
|
+
const ask = useCallback14(
|
|
9063
|
+
(text2, label2) => {
|
|
9064
|
+
dispatchAction({ id: `ask-${label2}`, label: label2, type: "message", payload: { text: text2 } });
|
|
8796
9065
|
},
|
|
8797
9066
|
[dispatchAction]
|
|
8798
9067
|
);
|
|
@@ -9638,23 +9907,23 @@ function buildComponentLibrary(catalog, componentMap) {
|
|
|
9638
9907
|
}
|
|
9639
9908
|
|
|
9640
9909
|
// src/catalog/define.ts
|
|
9641
|
-
import { z as
|
|
9642
|
-
var HYDRATED_ENTITY =
|
|
9910
|
+
import { z as z51 } from "zod";
|
|
9911
|
+
var HYDRATED_ENTITY = z51.object({}).passthrough();
|
|
9643
9912
|
function entity(resolverKey, opts) {
|
|
9644
9913
|
return resolved(HYDRATED_ENTITY, resolverKey, opts);
|
|
9645
9914
|
}
|
|
9646
|
-
var text = prose(
|
|
9915
|
+
var text = prose(z51.string());
|
|
9647
9916
|
function plain() {
|
|
9648
|
-
return
|
|
9917
|
+
return z51.string();
|
|
9649
9918
|
}
|
|
9650
9919
|
function token(values) {
|
|
9651
|
-
return
|
|
9920
|
+
return z51.enum(values);
|
|
9652
9921
|
}
|
|
9653
9922
|
function catalogComponent(meta, render) {
|
|
9654
9923
|
const { props, requires, ...rest } = meta;
|
|
9655
9924
|
return {
|
|
9656
9925
|
...rest,
|
|
9657
|
-
propsSchema:
|
|
9926
|
+
propsSchema: z51.object(props),
|
|
9658
9927
|
...requires !== void 0 ? { requires } : {},
|
|
9659
9928
|
component: adaptComponent(render)
|
|
9660
9929
|
};
|
|
@@ -9729,10 +9998,10 @@ function listRegisteredServices() {
|
|
|
9729
9998
|
}
|
|
9730
9999
|
|
|
9731
10000
|
// src/catalog/prose-value.ts
|
|
9732
|
-
function hasProse(
|
|
9733
|
-
if (
|
|
9734
|
-
if (typeof
|
|
9735
|
-
if (Array.isArray(
|
|
10001
|
+
function hasProse(value2) {
|
|
10002
|
+
if (value2 === void 0 || value2 === null || value2 === false) return false;
|
|
10003
|
+
if (typeof value2 === "string") return value2.length > 0;
|
|
10004
|
+
if (Array.isArray(value2)) return value2.length > 0;
|
|
9736
10005
|
return true;
|
|
9737
10006
|
}
|
|
9738
10007
|
|
|
@@ -9880,12 +10149,12 @@ __export(presence_exports2, {
|
|
|
9880
10149
|
});
|
|
9881
10150
|
|
|
9882
10151
|
// src/widgets/presence/use-standing-signal.ts
|
|
9883
|
-
import { useMemo as
|
|
10152
|
+
import { useMemo as useMemo12 } from "react";
|
|
9884
10153
|
|
|
9885
10154
|
// src/widgets/presence/core-presence/standing-signal-store.ts
|
|
9886
|
-
import { useSyncExternalStore as
|
|
10155
|
+
import { useSyncExternalStore as useSyncExternalStore5 } from "react";
|
|
9887
10156
|
var current = null;
|
|
9888
|
-
var
|
|
10157
|
+
var listeners4 = /* @__PURE__ */ new Set();
|
|
9889
10158
|
var scope = null;
|
|
9890
10159
|
var seen = /* @__PURE__ */ new Set();
|
|
9891
10160
|
function seenKey(forScope) {
|
|
@@ -9916,13 +10185,13 @@ function bindScope(next) {
|
|
|
9916
10185
|
scope = next;
|
|
9917
10186
|
seen = readSeen(next);
|
|
9918
10187
|
}
|
|
9919
|
-
function
|
|
9920
|
-
for (const listener of
|
|
10188
|
+
function notify4() {
|
|
10189
|
+
for (const listener of listeners4) listener();
|
|
9921
10190
|
}
|
|
9922
10191
|
function subscribe3(listener) {
|
|
9923
|
-
|
|
10192
|
+
listeners4.add(listener);
|
|
9924
10193
|
return () => {
|
|
9925
|
-
|
|
10194
|
+
listeners4.delete(listener);
|
|
9926
10195
|
};
|
|
9927
10196
|
}
|
|
9928
10197
|
function raiseStanding(type, id, payload, signalScope) {
|
|
@@ -9931,7 +10200,7 @@ function raiseStanding(type, id, payload, signalScope) {
|
|
|
9931
10200
|
if (seen.has(id)) return;
|
|
9932
10201
|
if (current !== null) return;
|
|
9933
10202
|
current = { type, id, payload };
|
|
9934
|
-
|
|
10203
|
+
notify4();
|
|
9935
10204
|
}
|
|
9936
10205
|
function resolveStanding(id, signalScope) {
|
|
9937
10206
|
bindScope(signalScope);
|
|
@@ -9939,11 +10208,11 @@ function resolveStanding(id, signalScope) {
|
|
|
9939
10208
|
persistSeen();
|
|
9940
10209
|
if (current !== null && current.id === id) {
|
|
9941
10210
|
current = null;
|
|
9942
|
-
|
|
10211
|
+
notify4();
|
|
9943
10212
|
}
|
|
9944
10213
|
}
|
|
9945
10214
|
function useStandingOfType(type) {
|
|
9946
|
-
return
|
|
10215
|
+
return useSyncExternalStore5(
|
|
9947
10216
|
subscribe3,
|
|
9948
10217
|
() => current !== null && current.type === type ? current : null,
|
|
9949
10218
|
() => null
|
|
@@ -9955,7 +10224,7 @@ if (typeof window !== "undefined") {
|
|
|
9955
10224
|
seen.clear();
|
|
9956
10225
|
persistSeen();
|
|
9957
10226
|
scope = null;
|
|
9958
|
-
|
|
10227
|
+
notify4();
|
|
9959
10228
|
});
|
|
9960
10229
|
}
|
|
9961
10230
|
|
|
@@ -9964,7 +10233,7 @@ function useConsumeStandingSignal(type) {
|
|
|
9964
10233
|
const session = useFourtySession();
|
|
9965
10234
|
const scope2 = session.sessionId === null ? void 0 : session.sessionId;
|
|
9966
10235
|
useRegisterSignalHandlers(
|
|
9967
|
-
|
|
10236
|
+
useMemo12(
|
|
9968
10237
|
() => ({
|
|
9969
10238
|
[type]: (payload) => {
|
|
9970
10239
|
const id = typeof payload.id === "string" && payload.id.length > 0 ? payload.id : type;
|
|
@@ -9975,7 +10244,7 @@ function useConsumeStandingSignal(type) {
|
|
|
9975
10244
|
)
|
|
9976
10245
|
);
|
|
9977
10246
|
const standing = useStandingOfType(type);
|
|
9978
|
-
return
|
|
10247
|
+
return useMemo12(() => {
|
|
9979
10248
|
if (standing === null) return null;
|
|
9980
10249
|
const id = standing.id;
|
|
9981
10250
|
return {
|
|
@@ -10179,8 +10448,8 @@ var COLOR_TERMS = {
|
|
|
10179
10448
|
denim: "#3a5f8a",
|
|
10180
10449
|
indigo: "#3f3a8c"
|
|
10181
10450
|
};
|
|
10182
|
-
function colorHexOf(
|
|
10183
|
-
const key =
|
|
10451
|
+
function colorHexOf(value2) {
|
|
10452
|
+
const key = value2.trim().toLowerCase().replace(/[^a-z-]/g, "");
|
|
10184
10453
|
if (key.length === 0) return null;
|
|
10185
10454
|
if (!(key in COLOR_TERMS)) return null;
|
|
10186
10455
|
return COLOR_TERMS[key];
|
|
@@ -10188,24 +10457,24 @@ function colorHexOf(value) {
|
|
|
10188
10457
|
var EMBEDDED_FIGURE = /\d+(?:[.,]\d+)?/;
|
|
10189
10458
|
var TRAILING_SYMBOLS = /[^\p{L}\d\s]+$/u;
|
|
10190
10459
|
function factFigureParts(fact) {
|
|
10191
|
-
const
|
|
10192
|
-
const match = EMBEDDED_FIGURE.exec(
|
|
10460
|
+
const value2 = fact.value.trim();
|
|
10461
|
+
const match = EMBEDDED_FIGURE.exec(value2);
|
|
10193
10462
|
if (match === null) return null;
|
|
10194
10463
|
const numeral = match[0];
|
|
10195
|
-
const lead =
|
|
10464
|
+
const lead = value2.slice(0, match.index).trim();
|
|
10196
10465
|
const symbolAt = lead.search(TRAILING_SYMBOLS);
|
|
10197
10466
|
const glued = symbolAt === -1 ? "" : lead.slice(symbolAt).replace(/\s+/g, "");
|
|
10198
10467
|
return {
|
|
10199
10468
|
before: symbolAt === -1 ? lead : lead.slice(0, symbolAt).trim(),
|
|
10200
10469
|
figure: `${glued}${numeral}`,
|
|
10201
|
-
after:
|
|
10470
|
+
after: value2.slice(match.index + numeral.length).trim()
|
|
10202
10471
|
};
|
|
10203
10472
|
}
|
|
10204
10473
|
var BARE_NUMERAL = /^\d+(?:[.,]\d+)?$/;
|
|
10205
10474
|
function presenceFactShape(fact) {
|
|
10206
|
-
const
|
|
10207
|
-
if (
|
|
10208
|
-
if (colorHexOf(
|
|
10475
|
+
const value2 = fact.value.trim();
|
|
10476
|
+
if (value2.length === 0) return FACT_SHAPE.plain;
|
|
10477
|
+
if (colorHexOf(value2) !== null) return FACT_SHAPE.color;
|
|
10209
10478
|
const parts2 = factFigureParts(fact);
|
|
10210
10479
|
if (parts2 === null) return FACT_SHAPE.plain;
|
|
10211
10480
|
const alone = parts2.before.length === 0 && parts2.after.length === 0;
|
|
@@ -10226,7 +10495,7 @@ function isFact(el) {
|
|
|
10226
10495
|
return el.kind === "fact";
|
|
10227
10496
|
}
|
|
10228
10497
|
function chosenOnly(source, materialized) {
|
|
10229
|
-
const refs = source.refs.filter((
|
|
10498
|
+
const refs = source.refs.filter((ref2) => materialized.has(ref2.id));
|
|
10230
10499
|
if (refs.length === 0) return void 0;
|
|
10231
10500
|
const chosen = {
|
|
10232
10501
|
id: source.id,
|
|
@@ -10330,8 +10599,8 @@ var FACT_PROVENANCES = [
|
|
|
10330
10599
|
"inferred",
|
|
10331
10600
|
"recalled"
|
|
10332
10601
|
];
|
|
10333
|
-
function stringField(
|
|
10334
|
-
const raw = Reflect.get(
|
|
10602
|
+
function stringField(value2, key) {
|
|
10603
|
+
const raw = Reflect.get(value2, key);
|
|
10335
10604
|
if (typeof raw !== "string" || raw.length === 0) return void 0;
|
|
10336
10605
|
return raw;
|
|
10337
10606
|
}
|
|
@@ -10340,15 +10609,15 @@ function asDurableFact(entry) {
|
|
|
10340
10609
|
if (Reflect.get(entry, "kind") !== "fact") return void 0;
|
|
10341
10610
|
const id = stringField(entry, "id");
|
|
10342
10611
|
const turnId = stringField(entry, "turnId");
|
|
10343
|
-
const
|
|
10344
|
-
const
|
|
10345
|
-
if (id === void 0 || turnId === void 0 ||
|
|
10612
|
+
const label2 = stringField(entry, "label");
|
|
10613
|
+
const value2 = stringField(entry, "value");
|
|
10614
|
+
if (id === void 0 || turnId === void 0 || label2 === void 0 || value2 === void 0) {
|
|
10346
10615
|
return void 0;
|
|
10347
10616
|
}
|
|
10348
10617
|
const tier = FACT_TIERS.find((t) => t === Reflect.get(entry, "tier"));
|
|
10349
10618
|
const provenance = FACT_PROVENANCES.find((p) => p === Reflect.get(entry, "provenance"));
|
|
10350
10619
|
if (tier === void 0 || provenance === void 0) return void 0;
|
|
10351
|
-
const restored = { id, turnId, kind: "fact", label, value, tier, provenance };
|
|
10620
|
+
const restored = { id, turnId, kind: "fact", label: label2, value: value2, tier, provenance };
|
|
10352
10621
|
const scope2 = stringField(entry, "scope");
|
|
10353
10622
|
if (scope2 !== void 0) restored.scope = scope2;
|
|
10354
10623
|
return restored;
|
|
@@ -10381,7 +10650,7 @@ function useFourtyChat() {
|
|
|
10381
10650
|
}
|
|
10382
10651
|
|
|
10383
10652
|
// src/rendering/post-hydration.ts
|
|
10384
|
-
import { useCallback as
|
|
10653
|
+
import { useCallback as useCallback16 } from "react";
|
|
10385
10654
|
var registry = [];
|
|
10386
10655
|
function registerPostHydrationTransform(transform) {
|
|
10387
10656
|
const existing = registry.findIndex((t) => t.id === transform.id);
|
|
@@ -10390,7 +10659,7 @@ function registerPostHydrationTransform(transform) {
|
|
|
10390
10659
|
}
|
|
10391
10660
|
function usePostHydrationTransforms() {
|
|
10392
10661
|
const fns = registry.map((t) => t.use());
|
|
10393
|
-
return
|
|
10662
|
+
return useCallback16(
|
|
10394
10663
|
(props, ctx) => {
|
|
10395
10664
|
let out = props;
|
|
10396
10665
|
for (const fn of fns) {
|
|
@@ -10406,10 +10675,10 @@ function usePostHydrationTransforms() {
|
|
|
10406
10675
|
}
|
|
10407
10676
|
|
|
10408
10677
|
// src/projection/transform.ts
|
|
10409
|
-
import { useMemo as
|
|
10678
|
+
import { useMemo as useMemo13 } from "react";
|
|
10410
10679
|
|
|
10411
10680
|
// src/projection/preferences.ts
|
|
10412
|
-
import { useSyncExternalStore as
|
|
10681
|
+
import { useSyncExternalStore as useSyncExternalStore6 } from "react";
|
|
10413
10682
|
var STORAGE_KEY2 = "fourty.projection.preferences";
|
|
10414
10683
|
var storage2 = createSessionStorageAdapter();
|
|
10415
10684
|
function load2() {
|
|
@@ -10424,22 +10693,22 @@ function load2() {
|
|
|
10424
10693
|
}
|
|
10425
10694
|
}
|
|
10426
10695
|
var preferences = load2();
|
|
10427
|
-
var
|
|
10696
|
+
var listeners5 = /* @__PURE__ */ new Set();
|
|
10428
10697
|
registerSessionScopedClear(() => {
|
|
10429
10698
|
preferences = {};
|
|
10430
10699
|
storage2.remove(STORAGE_KEY2);
|
|
10431
|
-
|
|
10700
|
+
notify5();
|
|
10432
10701
|
});
|
|
10433
|
-
function
|
|
10434
|
-
for (const listener of
|
|
10702
|
+
function notify5() {
|
|
10703
|
+
for (const listener of listeners5) listener();
|
|
10435
10704
|
}
|
|
10436
10705
|
function getProjectionPreferences() {
|
|
10437
10706
|
return preferences;
|
|
10438
10707
|
}
|
|
10439
10708
|
function subscribeProjectionPreferences(listener) {
|
|
10440
|
-
|
|
10709
|
+
listeners5.add(listener);
|
|
10441
10710
|
return () => {
|
|
10442
|
-
|
|
10711
|
+
listeners5.delete(listener);
|
|
10443
10712
|
};
|
|
10444
10713
|
}
|
|
10445
10714
|
function allProjectableScopes() {
|
|
@@ -10480,11 +10749,11 @@ function applyProjectionSet(payload) {
|
|
|
10480
10749
|
if (!changed) return;
|
|
10481
10750
|
preferences = next;
|
|
10482
10751
|
storage2.set(STORAGE_KEY2, JSON.stringify(preferences));
|
|
10483
|
-
|
|
10752
|
+
notify5();
|
|
10484
10753
|
}
|
|
10485
10754
|
var EMPTY = {};
|
|
10486
10755
|
function useProjectionPreferences() {
|
|
10487
|
-
return
|
|
10756
|
+
return useSyncExternalStore6(
|
|
10488
10757
|
subscribeProjectionPreferences,
|
|
10489
10758
|
getProjectionPreferences,
|
|
10490
10759
|
() => EMPTY
|
|
@@ -10534,7 +10803,7 @@ var projectionTransform = {
|
|
|
10534
10803
|
use: () => {
|
|
10535
10804
|
const preferences2 = useProjectionPreferences();
|
|
10536
10805
|
const facts = useFacts();
|
|
10537
|
-
return
|
|
10806
|
+
return useMemo13(() => {
|
|
10538
10807
|
if (Object.keys(preferences2).length === 0) return null;
|
|
10539
10808
|
return buildTransform(preferences2, facts);
|
|
10540
10809
|
}, [preferences2, facts]);
|
|
@@ -10550,21 +10819,21 @@ function ProjectionSignalBridge() {
|
|
|
10550
10819
|
}
|
|
10551
10820
|
|
|
10552
10821
|
// src/projection/use-projection.ts
|
|
10553
|
-
import { useCallback as
|
|
10822
|
+
import { useCallback as useCallback17, useEffect as useEffect12, useState as useState8 } from "react";
|
|
10554
10823
|
function readResult(raw) {
|
|
10555
10824
|
if (raw === null || typeof raw !== "object") return void 0;
|
|
10556
10825
|
if (!("hiddenCount" in raw) || typeof raw.hiddenCount !== "number") return void 0;
|
|
10557
10826
|
const trimmedAxes = "trimmedAxes" in raw && Array.isArray(raw.trimmedAxes) ? raw.trimmedAxes.filter((a) => typeof a === "string") : [];
|
|
10558
10827
|
return { full: "full" in raw ? raw.full : void 0, hiddenCount: raw.hiddenCount, trimmedAxes };
|
|
10559
10828
|
}
|
|
10560
|
-
function entityIdOf(
|
|
10561
|
-
if (
|
|
10562
|
-
return typeof
|
|
10829
|
+
function entityIdOf(value2) {
|
|
10830
|
+
if (value2 === null || typeof value2 !== "object" || !("id" in value2)) return "";
|
|
10831
|
+
return typeof value2.id === "string" ? value2.id : "";
|
|
10563
10832
|
}
|
|
10564
10833
|
var NO_AXES = [];
|
|
10565
10834
|
function useProjection(projectionProp, entity2) {
|
|
10566
10835
|
const [expanded, setExpanded] = useState8(false);
|
|
10567
|
-
const toggle =
|
|
10836
|
+
const toggle = useCallback17(() => setExpanded((e) => !e), []);
|
|
10568
10837
|
const entityId = entityIdOf(entity2);
|
|
10569
10838
|
useEffect12(() => {
|
|
10570
10839
|
setExpanded(false);
|
|
@@ -10710,7 +10979,7 @@ __export(utils_exports, {
|
|
|
10710
10979
|
});
|
|
10711
10980
|
|
|
10712
10981
|
// src/utils/use-form-factor.ts
|
|
10713
|
-
import { useSyncExternalStore as
|
|
10982
|
+
import { useSyncExternalStore as useSyncExternalStore7 } from "react";
|
|
10714
10983
|
|
|
10715
10984
|
// src/utils/viewport-window.tsx
|
|
10716
10985
|
import { createContext as createContext26, useContext as useContext26 } from "react";
|
|
@@ -10726,10 +10995,10 @@ function useViewportWindow() {
|
|
|
10726
10995
|
return canAnswer(global) ? global : null;
|
|
10727
10996
|
}
|
|
10728
10997
|
function ViewportWindowProvider({
|
|
10729
|
-
value,
|
|
10998
|
+
value: value2,
|
|
10730
10999
|
children
|
|
10731
11000
|
}) {
|
|
10732
|
-
return /* @__PURE__ */ jsx23(ViewportWindowContext.Provider, { value, children });
|
|
11001
|
+
return /* @__PURE__ */ jsx23(ViewportWindowContext.Provider, { value: value2, children });
|
|
10733
11002
|
}
|
|
10734
11003
|
|
|
10735
11004
|
// src/utils/use-form-factor.ts
|
|
@@ -10788,7 +11057,7 @@ var noWindowRead = () => SERVER_SNAPSHOT;
|
|
|
10788
11057
|
function useFormFactor() {
|
|
10789
11058
|
const win = useViewportWindow();
|
|
10790
11059
|
const store = win === null ? null : storeFor(win);
|
|
10791
|
-
return
|
|
11060
|
+
return useSyncExternalStore7(
|
|
10792
11061
|
store === null ? noWindowSubscribe : store.subscribe,
|
|
10793
11062
|
store === null ? noWindowRead : store.read,
|
|
10794
11063
|
noWindowRead
|
|
@@ -10796,27 +11065,27 @@ function useFormFactor() {
|
|
|
10796
11065
|
}
|
|
10797
11066
|
|
|
10798
11067
|
// src/utils/use-inline-completion.ts
|
|
10799
|
-
import { useCallback as
|
|
11068
|
+
import { useCallback as useCallback18, useMemo as useMemo14, useState as useState9 } from "react";
|
|
10800
11069
|
function useInlineCompletion(opts) {
|
|
10801
|
-
const { value, candidates } = opts;
|
|
11070
|
+
const { value: value2, candidates } = opts;
|
|
10802
11071
|
const minChars = opts.minChars !== void 0 ? opts.minChars : 2;
|
|
10803
11072
|
const enabled = opts.enabled !== void 0 ? opts.enabled : true;
|
|
10804
11073
|
const [dismissedValue, setDismissedValue] = useState9(null);
|
|
10805
|
-
const dismiss =
|
|
10806
|
-
return
|
|
10807
|
-
if (!enabled ||
|
|
11074
|
+
const dismiss = useCallback18(() => setDismissedValue(value2), [value2]);
|
|
11075
|
+
return useMemo14(() => {
|
|
11076
|
+
if (!enabled || value2.length < minChars || dismissedValue === value2) {
|
|
10808
11077
|
return { completion: "", ghost: "", active: false, dismiss };
|
|
10809
11078
|
}
|
|
10810
|
-
const needle =
|
|
11079
|
+
const needle = value2.toLowerCase();
|
|
10811
11080
|
for (const cand of candidates) {
|
|
10812
|
-
if (typeof cand !== "string" || cand.length <=
|
|
11081
|
+
if (typeof cand !== "string" || cand.length <= value2.length) continue;
|
|
10813
11082
|
if (!cand.toLowerCase().startsWith(needle)) continue;
|
|
10814
|
-
const ghost = cand.slice(
|
|
11083
|
+
const ghost = cand.slice(value2.length);
|
|
10815
11084
|
if (ghost.length === 0) continue;
|
|
10816
11085
|
return { completion: cand, ghost, active: true, dismiss };
|
|
10817
11086
|
}
|
|
10818
11087
|
return { completion: "", ghost: "", active: false, dismiss };
|
|
10819
|
-
}, [
|
|
11088
|
+
}, [value2, candidates, minChars, enabled, dismissedValue, dismiss]);
|
|
10820
11089
|
}
|
|
10821
11090
|
|
|
10822
11091
|
// src/utils/use-document-visible.ts
|
|
@@ -10848,7 +11117,7 @@ function useInterval(callback, ms, active = true) {
|
|
|
10848
11117
|
}
|
|
10849
11118
|
|
|
10850
11119
|
// src/utils/use-success-flash.ts
|
|
10851
|
-
import { useCallback as
|
|
11120
|
+
import { useCallback as useCallback19, useEffect as useEffect13, useRef as useRef9, useState as useState10 } from "react";
|
|
10852
11121
|
import { useAnimationControls } from "framer-motion";
|
|
10853
11122
|
function useSuccessFlash(options) {
|
|
10854
11123
|
const duration = options !== void 0 && options.duration !== void 0 ? options.duration : 900;
|
|
@@ -10864,7 +11133,7 @@ function useSuccessFlash(options) {
|
|
|
10864
11133
|
if (timerRef.current !== null) window.clearTimeout(timerRef.current);
|
|
10865
11134
|
};
|
|
10866
11135
|
}, []);
|
|
10867
|
-
const trigger =
|
|
11136
|
+
const trigger = useCallback19(() => {
|
|
10868
11137
|
setFlashing(true);
|
|
10869
11138
|
controls.start({
|
|
10870
11139
|
scale: scaleRef.current,
|
|
@@ -10965,91 +11234,37 @@ function validateAll(items, schema, context) {
|
|
|
10965
11234
|
}
|
|
10966
11235
|
|
|
10967
11236
|
// src/client-state/store.ts
|
|
10968
|
-
var
|
|
10969
|
-
var
|
|
11237
|
+
var entries2 = /* @__PURE__ */ new Map();
|
|
11238
|
+
var listeners6 = /* @__PURE__ */ new Set();
|
|
10970
11239
|
var vectorCache = {};
|
|
10971
|
-
var
|
|
10972
|
-
function
|
|
11240
|
+
var entriesCache2 = /* @__PURE__ */ new Map();
|
|
11241
|
+
function notify6() {
|
|
10973
11242
|
vectorCache = {};
|
|
10974
|
-
for (const [ns, e] of
|
|
10975
|
-
|
|
10976
|
-
for (const l of
|
|
11243
|
+
for (const [ns, e] of entries2) vectorCache[ns] = e.rev;
|
|
11244
|
+
entriesCache2 = new Map(entries2);
|
|
11245
|
+
for (const l of listeners6) l();
|
|
10977
11246
|
}
|
|
10978
11247
|
function publishClientState(namespace, payload) {
|
|
10979
11248
|
if (namespace.length === 0) return;
|
|
10980
11249
|
const key = JSON.stringify(payload);
|
|
10981
|
-
const prev =
|
|
11250
|
+
const prev = entries2.get(namespace);
|
|
10982
11251
|
if (prev !== void 0 && prev.key === key) return;
|
|
10983
11252
|
const rev = prev !== void 0 ? prev.rev + 1 : 1;
|
|
10984
|
-
|
|
10985
|
-
|
|
11253
|
+
entries2.set(namespace, { payload, rev, key });
|
|
11254
|
+
notify6();
|
|
10986
11255
|
}
|
|
10987
11256
|
function clientStateVector() {
|
|
10988
11257
|
return vectorCache;
|
|
10989
11258
|
}
|
|
10990
11259
|
function clientStateEntries() {
|
|
10991
|
-
return entriesCache;
|
|
10992
|
-
}
|
|
10993
|
-
function subscribeClientState(listener) {
|
|
10994
|
-
listeners5.add(listener);
|
|
10995
|
-
return () => {
|
|
10996
|
-
listeners5.delete(listener);
|
|
10997
|
-
};
|
|
10998
|
-
}
|
|
10999
|
-
|
|
11000
|
-
// src/client-state/server-store.ts
|
|
11001
|
-
var entries2 = /* @__PURE__ */ new Map();
|
|
11002
|
-
var listeners6 = /* @__PURE__ */ new Set();
|
|
11003
|
-
var entriesCache2 = /* @__PURE__ */ new Map();
|
|
11004
|
-
function notify6() {
|
|
11005
|
-
entriesCache2 = new Map(entries2);
|
|
11006
|
-
for (const l of listeners6) l();
|
|
11007
|
-
}
|
|
11008
|
-
function applyServerState(namespace, rev, payload) {
|
|
11009
|
-
if (namespace.length === 0) return false;
|
|
11010
|
-
const prev = entries2.get(namespace);
|
|
11011
|
-
if (prev !== void 0 && rev <= prev.rev) return false;
|
|
11012
|
-
entries2.set(namespace, { payload, rev });
|
|
11013
|
-
notify6();
|
|
11014
|
-
return true;
|
|
11015
|
-
}
|
|
11016
|
-
function serverState(namespace) {
|
|
11017
|
-
const entry = entries2.get(namespace);
|
|
11018
|
-
return entry === void 0 ? void 0 : entry.payload;
|
|
11019
|
-
}
|
|
11020
|
-
function serverStateVector() {
|
|
11021
|
-
const out = {};
|
|
11022
|
-
for (const [ns, e] of entries2) out[ns] = e.rev;
|
|
11023
|
-
return out;
|
|
11024
|
-
}
|
|
11025
|
-
function serverStateEntries() {
|
|
11026
11260
|
return entriesCache2;
|
|
11027
11261
|
}
|
|
11028
|
-
function
|
|
11262
|
+
function subscribeClientState(listener) {
|
|
11029
11263
|
listeners6.add(listener);
|
|
11030
11264
|
return () => {
|
|
11031
11265
|
listeners6.delete(listener);
|
|
11032
11266
|
};
|
|
11033
11267
|
}
|
|
11034
|
-
function resetServerState() {
|
|
11035
|
-
if (entries2.size === 0) return;
|
|
11036
|
-
entries2.clear();
|
|
11037
|
-
notify6();
|
|
11038
|
-
}
|
|
11039
|
-
function primedEntities() {
|
|
11040
|
-
const payload = serverState(ENTITY_PRIME_NAMESPACE);
|
|
11041
|
-
if (payload === void 0) return {};
|
|
11042
|
-
const out = {};
|
|
11043
|
-
for (const [resolverKey, byRef] of Object.entries(payload)) {
|
|
11044
|
-
if (byRef === null || typeof byRef !== "object" || Array.isArray(byRef)) continue;
|
|
11045
|
-
out[resolverKey] = byRef;
|
|
11046
|
-
}
|
|
11047
|
-
return out;
|
|
11048
|
-
}
|
|
11049
|
-
function primedEntitiesFor(resolverKey) {
|
|
11050
|
-
const byKey = primedEntities()[resolverKey];
|
|
11051
|
-
return byKey === void 0 ? {} : byKey;
|
|
11052
|
-
}
|
|
11053
11268
|
|
|
11054
11269
|
// src/preview/SpacefrontPreviewProvider.tsx
|
|
11055
11270
|
import * as React43 from "react";
|
|
@@ -11060,15 +11275,15 @@ var ASYNC_NOOP = () => Promise.resolve();
|
|
|
11060
11275
|
var VIEW = { page: { kind: "home" }, layout: EMPTY_SPEC, shell: EMPTY_SHELL };
|
|
11061
11276
|
var PreviewContext = React43.createContext(null);
|
|
11062
11277
|
function usePreview() {
|
|
11063
|
-
const
|
|
11064
|
-
if (
|
|
11065
|
-
return
|
|
11278
|
+
const value2 = React43.useContext(PreviewContext);
|
|
11279
|
+
if (value2 === null) throw new Error("preview runtime used outside <SpacefrontPreviewProvider>");
|
|
11280
|
+
return value2;
|
|
11066
11281
|
}
|
|
11067
|
-
function list(
|
|
11068
|
-
return
|
|
11282
|
+
function list(value2) {
|
|
11283
|
+
return value2 === void 0 ? [] : value2;
|
|
11069
11284
|
}
|
|
11070
|
-
function orNull(
|
|
11071
|
-
return
|
|
11285
|
+
function orNull(value2) {
|
|
11286
|
+
return value2 === void 0 ? null : value2;
|
|
11072
11287
|
}
|
|
11073
11288
|
function derive(scene, sessionId) {
|
|
11074
11289
|
const turns = list(scene.turns);
|
|
@@ -11098,7 +11313,7 @@ function derive(scene, sessionId) {
|
|
|
11098
11313
|
const labels = list(scene.suggestions);
|
|
11099
11314
|
const suggestions = labels.length === 0 ? null : {
|
|
11100
11315
|
type: "suggestion_cards",
|
|
11101
|
-
actions: labels.map((
|
|
11316
|
+
actions: labels.map((label2, i) => ({ id: `chip-${i}`, label: label2, type: "message", payload: { text: label2 } }))
|
|
11102
11317
|
};
|
|
11103
11318
|
const turnId = `turn-${Math.max(0, turns.length - (p === null ? 1 : 0))}`;
|
|
11104
11319
|
const elements = [];
|
|
@@ -11163,6 +11378,7 @@ var RUNTIME = {
|
|
|
11163
11378
|
},
|
|
11164
11379
|
useSessionId: () => usePreview().sessionId,
|
|
11165
11380
|
useSessionMessages: () => usePreview().chat,
|
|
11381
|
+
useSeedLayout: () => null,
|
|
11166
11382
|
useFacts: () => ({}),
|
|
11167
11383
|
useVisitorName: () => ({ name: null, setName: NOOP }),
|
|
11168
11384
|
useConversationMessages: () => usePreview().messages,
|
|
@@ -11271,6 +11487,7 @@ function SpacefrontPreviewProvider({ scene, onSend, children }) {
|
|
|
11271
11487
|
clearSession: NOOP,
|
|
11272
11488
|
forgetVisitor: ASYNC_NOOP,
|
|
11273
11489
|
shareCanvas: () => Promise.resolve(null),
|
|
11490
|
+
board: () => Promise.resolve(null),
|
|
11274
11491
|
recentConversations: [],
|
|
11275
11492
|
newConversation: NOOP,
|
|
11276
11493
|
switchConversation: NOOP,
|
|
@@ -11392,6 +11609,7 @@ __export(commerce_exports, {
|
|
|
11392
11609
|
useProductGridFilter: () => useProductGridFilter,
|
|
11393
11610
|
useProductReviews: () => useProductReviews,
|
|
11394
11611
|
useProductSearch: () => useProductSearch,
|
|
11612
|
+
useProductSection: () => useProductSection,
|
|
11395
11613
|
useProducts: () => useProducts,
|
|
11396
11614
|
useQueuedDiscountCodes: () => useQueuedDiscountCodes,
|
|
11397
11615
|
useSafeCart: () => useSafeCart,
|
|
@@ -11500,6 +11718,8 @@ var INERT_COMMERCE_RUNTIME = {
|
|
|
11500
11718
|
useStoreArticles: () => ({ available: false, articles: [], isLoading: false }),
|
|
11501
11719
|
// No commerce, no store to read the field from.
|
|
11502
11720
|
useProductField: () => ({ value: void 0, status: "error" }),
|
|
11721
|
+
// No commerce, no store page to read the section from.
|
|
11722
|
+
useProductSection: () => ({ body: void 0, status: "error" }),
|
|
11503
11723
|
// No commerce, no bag to check out.
|
|
11504
11724
|
useShopCheckout: () => ({
|
|
11505
11725
|
available: false,
|
|
@@ -11552,9 +11772,6 @@ function useAskStore() {
|
|
|
11552
11772
|
function useStoreArticles(productIds, topic) {
|
|
11553
11773
|
return useCommerceRuntime().useStoreArticles(productIds, topic);
|
|
11554
11774
|
}
|
|
11555
|
-
function useProductField(productId, namespace, key) {
|
|
11556
|
-
return useCommerceRuntime().useProductField(productId, namespace, key);
|
|
11557
|
-
}
|
|
11558
11775
|
function useShopCheckout() {
|
|
11559
11776
|
return useCommerceRuntime().useShopCheckout();
|
|
11560
11777
|
}
|
|
@@ -11562,6 +11779,14 @@ function useProductSearch(query, opts) {
|
|
|
11562
11779
|
return useCommerceRuntime().useProductSearch(query, opts);
|
|
11563
11780
|
}
|
|
11564
11781
|
|
|
11782
|
+
// src/verticals/commerce/product-data-hooks.ts
|
|
11783
|
+
function useProductField(productId, namespace, key) {
|
|
11784
|
+
return useCommerceRuntime().useProductField(productId, namespace, key);
|
|
11785
|
+
}
|
|
11786
|
+
function useProductSection(productId, sectionId) {
|
|
11787
|
+
return useCommerceRuntime().useProductSection(productId, sectionId);
|
|
11788
|
+
}
|
|
11789
|
+
|
|
11565
11790
|
// src/verticals/commerce/checkout/external-navigation.ts
|
|
11566
11791
|
function navigateToExternalCommerceUrl(url) {
|
|
11567
11792
|
if (typeof window === "undefined" || url === void 0 || url.length === 0) {
|
|
@@ -11586,7 +11811,7 @@ function navigateToExternalCommerceUrl(url) {
|
|
|
11586
11811
|
}
|
|
11587
11812
|
|
|
11588
11813
|
// src/verticals/commerce/variant/variant-selection-store.ts
|
|
11589
|
-
import { useSyncExternalStore as
|
|
11814
|
+
import { useSyncExternalStore as useSyncExternalStore8 } from "react";
|
|
11590
11815
|
var EMPTY2 = /* @__PURE__ */ new Map();
|
|
11591
11816
|
var selections = /* @__PURE__ */ new Map();
|
|
11592
11817
|
var listeners7 = /* @__PURE__ */ new Set();
|
|
@@ -11612,7 +11837,7 @@ function getVariantSelection(productId) {
|
|
|
11612
11837
|
return selections.get(productId);
|
|
11613
11838
|
}
|
|
11614
11839
|
function useVariantSelections() {
|
|
11615
|
-
return
|
|
11840
|
+
return useSyncExternalStore8(subscribe5, () => selections, () => EMPTY2);
|
|
11616
11841
|
}
|
|
11617
11842
|
registerSessionScopedClear(() => {
|
|
11618
11843
|
if (selections.size === 0) return;
|
|
@@ -11621,7 +11846,7 @@ registerSessionScopedClear(() => {
|
|
|
11621
11846
|
});
|
|
11622
11847
|
|
|
11623
11848
|
// src/verticals/commerce/variant/pending-variant-choice-store.ts
|
|
11624
|
-
import { useSyncExternalStore as
|
|
11849
|
+
import { useSyncExternalStore as useSyncExternalStore9 } from "react";
|
|
11625
11850
|
var pending = null;
|
|
11626
11851
|
var listeners8 = /* @__PURE__ */ new Set();
|
|
11627
11852
|
function notify8() {
|
|
@@ -11643,11 +11868,11 @@ function clearVariantChoice() {
|
|
|
11643
11868
|
notify8();
|
|
11644
11869
|
}
|
|
11645
11870
|
function usePendingVariantChoice() {
|
|
11646
|
-
return
|
|
11871
|
+
return useSyncExternalStore9(subscribe6, () => pending, () => null);
|
|
11647
11872
|
}
|
|
11648
11873
|
|
|
11649
11874
|
// src/verticals/commerce/variant/option-selection-store.ts
|
|
11650
|
-
import { useSyncExternalStore as
|
|
11875
|
+
import { useSyncExternalStore as useSyncExternalStore10 } from "react";
|
|
11651
11876
|
var EMPTY3 = /* @__PURE__ */ new Map();
|
|
11652
11877
|
var selections2 = /* @__PURE__ */ new Map();
|
|
11653
11878
|
var listeners9 = /* @__PURE__ */ new Set();
|
|
@@ -11669,9 +11894,9 @@ function recordOptionSelections(productId, picks) {
|
|
|
11669
11894
|
const current2 = selections2.get(productId);
|
|
11670
11895
|
const merged = current2 !== void 0 ? { ...current2 } : {};
|
|
11671
11896
|
let changed = false;
|
|
11672
|
-
for (const [axis,
|
|
11673
|
-
if (merged[axis] !==
|
|
11674
|
-
merged[axis] =
|
|
11897
|
+
for (const [axis, value2] of entries3) {
|
|
11898
|
+
if (merged[axis] !== value2) {
|
|
11899
|
+
merged[axis] = value2;
|
|
11675
11900
|
changed = true;
|
|
11676
11901
|
}
|
|
11677
11902
|
}
|
|
@@ -11685,7 +11910,7 @@ function getOptionSelections(productId) {
|
|
|
11685
11910
|
return selections2.get(productId);
|
|
11686
11911
|
}
|
|
11687
11912
|
function useOptionSelections() {
|
|
11688
|
-
return
|
|
11913
|
+
return useSyncExternalStore10(subscribe7, () => selections2, () => EMPTY3);
|
|
11689
11914
|
}
|
|
11690
11915
|
registerSessionScopedClear(() => {
|
|
11691
11916
|
if (selections2.size === 0) return;
|
|
@@ -11715,25 +11940,26 @@ __export(ecommerce_exports, {
|
|
|
11715
11940
|
});
|
|
11716
11941
|
|
|
11717
11942
|
// ../spacestation/src/analytics/ecommerce/surfacing.ts
|
|
11718
|
-
import { z as
|
|
11943
|
+
import { z as z52 } from "zod";
|
|
11719
11944
|
var PRODUCTS_SURFACED = defineEventKind(
|
|
11720
11945
|
"commerce.products_surfaced",
|
|
11721
11946
|
"client",
|
|
11722
|
-
|
|
11947
|
+
z52.object({
|
|
11723
11948
|
/** The turn whose commit this describes. Minted where the prompt signal
|
|
11724
11949
|
* is built and shared with `agent_runs`, so the read layer can line a
|
|
11725
11950
|
* surfacing up against the prompt that asked for it. */
|
|
11726
|
-
turnId:
|
|
11951
|
+
turnId: z52.string().min(1).max(128),
|
|
11727
11952
|
/** Distinct entity refs this turn placed that were not on the canvas
|
|
11728
11953
|
* before it. ZERO IS A REAL VALUE — see the header. */
|
|
11729
|
-
productCount:
|
|
11954
|
+
productCount: z52.number().int().nonnegative()
|
|
11730
11955
|
}).strict()
|
|
11731
11956
|
);
|
|
11732
11957
|
|
|
11733
11958
|
// ../spacestation/src/analytics/ecommerce/funnel.ts
|
|
11734
|
-
var FUNNEL_STEPS = ["started", "engaged", "surfaced", "cart", "handoff"];
|
|
11959
|
+
var FUNNEL_STEPS = ["started", "browsed", "engaged", "surfaced", "cart", "handoff"];
|
|
11735
11960
|
var FUNNEL_STEP_LABELS = {
|
|
11736
11961
|
started: "Landed",
|
|
11962
|
+
browsed: "Browsed",
|
|
11737
11963
|
engaged: "Chatted",
|
|
11738
11964
|
surfaced: "Viewed products",
|
|
11739
11965
|
cart: "Added to cart",
|
|
@@ -11743,38 +11969,38 @@ var ACQUISITION_KIND_LABELS = {
|
|
|
11743
11969
|
"commerce.cart_line_added": "Cart",
|
|
11744
11970
|
"commerce.registry_clicked": "Registry"
|
|
11745
11971
|
};
|
|
11746
|
-
function isFunnelStep(
|
|
11747
|
-
return FUNNEL_STEPS.some((step) => step ===
|
|
11972
|
+
function isFunnelStep(value2) {
|
|
11973
|
+
return FUNNEL_STEPS.some((step) => step === value2);
|
|
11748
11974
|
}
|
|
11749
11975
|
|
|
11750
11976
|
// src/verticals/commerce/product/use-product-grid-filter.ts
|
|
11751
|
-
import { useCallback as
|
|
11977
|
+
import { useCallback as useCallback20, useMemo as useMemo16, useState as useState12 } from "react";
|
|
11752
11978
|
function useProductGridFilter(chips) {
|
|
11753
|
-
const labelKey =
|
|
11979
|
+
const labelKey = useMemo16(() => chips.map((c) => c.label).join("|"), [chips]);
|
|
11754
11980
|
const first = chips[0];
|
|
11755
11981
|
const [activeLabel, setActiveLabel] = useState12(
|
|
11756
11982
|
first !== void 0 ? first.label : null
|
|
11757
11983
|
);
|
|
11758
|
-
const activeFromKey =
|
|
11984
|
+
const activeFromKey = useMemo16(() => {
|
|
11759
11985
|
void labelKey;
|
|
11760
11986
|
if (first === void 0) return null;
|
|
11761
11987
|
const found = chips.find((c) => c.label === activeLabel);
|
|
11762
11988
|
return found !== void 0 ? found : first;
|
|
11763
11989
|
}, [chips, first, activeLabel, labelKey]);
|
|
11764
|
-
const setActive =
|
|
11990
|
+
const setActive = useCallback20((next) => {
|
|
11765
11991
|
setActiveLabel(next.label);
|
|
11766
11992
|
}, []);
|
|
11767
11993
|
return { chips, active: activeFromKey, setActive };
|
|
11768
11994
|
}
|
|
11769
11995
|
|
|
11770
11996
|
// src/verticals/commerce/product/use-product-detail.ts
|
|
11771
|
-
import { useCallback as
|
|
11997
|
+
import { useCallback as useCallback22, useMemo as useMemo17, useRef as useRef13, useState as useState15 } from "react";
|
|
11772
11998
|
|
|
11773
11999
|
// src/verticals/commerce/checkout/use-buy-now.ts
|
|
11774
|
-
import { useCallback as
|
|
12000
|
+
import { useCallback as useCallback21, useEffect as useEffect16, useState as useState13 } from "react";
|
|
11775
12001
|
|
|
11776
12002
|
// src/verticals/commerce/checkout/checkout-handoff-store.ts
|
|
11777
|
-
import { useSyncExternalStore as
|
|
12003
|
+
import { useSyncExternalStore as useSyncExternalStore11 } from "react";
|
|
11778
12004
|
|
|
11779
12005
|
// src/verticals/commerce/checkout/checkout-handoff-reasons.ts
|
|
11780
12006
|
var CHECKOUT_BLOCKED_REASON = "the browser blocked the checkout tab, so the visitor has NOT reached checkout and is still on the page. Tell them plainly and point them at their bag to check out from there; never imply they arrived.";
|
|
@@ -11885,7 +12111,7 @@ function readCheckoutHandoff() {
|
|
|
11885
12111
|
return state;
|
|
11886
12112
|
}
|
|
11887
12113
|
function useCheckoutHandoff() {
|
|
11888
|
-
return
|
|
12114
|
+
return useSyncExternalStore11(subscribe8, readCheckoutHandoff, () => IDLE);
|
|
11889
12115
|
}
|
|
11890
12116
|
registerSessionScopedClear(() => {
|
|
11891
12117
|
if (state === IDLE) return;
|
|
@@ -11912,7 +12138,7 @@ function useBuyNow(addToCart) {
|
|
|
11912
12138
|
const cartApi = useCart();
|
|
11913
12139
|
const analytics = useOptionalAnalyticsSink();
|
|
11914
12140
|
const [pending2, setPending] = useState13(null);
|
|
11915
|
-
const start =
|
|
12141
|
+
const start = useCallback21((variantId) => {
|
|
11916
12142
|
if (pending2 !== null) return;
|
|
11917
12143
|
addToCart();
|
|
11918
12144
|
setPending(variantId);
|
|
@@ -12029,9 +12255,9 @@ function useSelectedVariantsState(product, facts) {
|
|
|
12029
12255
|
setSelectedVariants((prev) => {
|
|
12030
12256
|
let changed = false;
|
|
12031
12257
|
const merged = { ...prev };
|
|
12032
|
-
for (const [axis,
|
|
12033
|
-
if (merged[axis] !==
|
|
12034
|
-
merged[axis] =
|
|
12258
|
+
for (const [axis, value2] of Object.entries(recorded)) {
|
|
12259
|
+
if (merged[axis] !== value2) {
|
|
12260
|
+
merged[axis] = value2;
|
|
12035
12261
|
changed = true;
|
|
12036
12262
|
}
|
|
12037
12263
|
}
|
|
@@ -12064,19 +12290,19 @@ function useProductDetail(product, options) {
|
|
|
12064
12290
|
}
|
|
12065
12291
|
const { selectedVariants, setSelectedVariants, markTouched } = useSelectedVariantsState(product, facts);
|
|
12066
12292
|
const desc = useExpandable(false);
|
|
12067
|
-
const variantGroups =
|
|
12293
|
+
const variantGroups = useMemo17(
|
|
12068
12294
|
() => deriveVariantGroups(product),
|
|
12069
12295
|
[product]
|
|
12070
12296
|
);
|
|
12071
|
-
const allSelected =
|
|
12297
|
+
const allSelected = useMemo17(
|
|
12072
12298
|
() => variantGroups.every((g) => selectedVariants[g.name] !== void 0),
|
|
12073
12299
|
[variantGroups, selectedVariants]
|
|
12074
12300
|
);
|
|
12075
|
-
const missingGroup =
|
|
12301
|
+
const missingGroup = useMemo17(
|
|
12076
12302
|
() => variantGroups.find((g) => selectedVariants[g.name] === void 0),
|
|
12077
12303
|
[variantGroups, selectedVariants]
|
|
12078
12304
|
);
|
|
12079
|
-
const findVariant =
|
|
12305
|
+
const findVariant = useCallback22(
|
|
12080
12306
|
(opts) => matchVariant(product, opts),
|
|
12081
12307
|
[product]
|
|
12082
12308
|
);
|
|
@@ -12087,11 +12313,11 @@ function useProductDetail(product, options) {
|
|
|
12087
12313
|
const matchIndex = product.images.findIndex((img) => img.url === activeVariantImageUrl);
|
|
12088
12314
|
if (matchIndex >= 0) setSelectedImage(matchIndex);
|
|
12089
12315
|
}
|
|
12090
|
-
const isVariantUnavailable =
|
|
12316
|
+
const isVariantUnavailable = useCallback22(
|
|
12091
12317
|
(group, opt) => isOptionUnavailable(product, selectedVariants, group, opt),
|
|
12092
12318
|
[product, selectedVariants]
|
|
12093
12319
|
);
|
|
12094
|
-
const selectVariant =
|
|
12320
|
+
const selectVariant = useCallback22((group, opt) => {
|
|
12095
12321
|
markTouched();
|
|
12096
12322
|
setSelectedVariants((prev) => ({ ...prev, [group]: opt }));
|
|
12097
12323
|
session.dispatchSignal({
|
|
@@ -12100,7 +12326,7 @@ function useProductDetail(product, options) {
|
|
|
12100
12326
|
});
|
|
12101
12327
|
optimisticFacts.add({ label: group, value: opt });
|
|
12102
12328
|
}, [session, product.id, markTouched, setSelectedVariants, optimisticFacts]);
|
|
12103
|
-
const addPicked =
|
|
12329
|
+
const addPicked = useCallback22((acknowledgeInDrawer) => {
|
|
12104
12330
|
if (!allSelected) return;
|
|
12105
12331
|
const variant = findVariant(selectedVariants);
|
|
12106
12332
|
if (variant === void 0) {
|
|
@@ -12125,10 +12351,10 @@ function useProductDetail(product, options) {
|
|
|
12125
12351
|
}
|
|
12126
12352
|
});
|
|
12127
12353
|
}, [allSelected, findVariant, product.id, product.title, product.images, selectedVariants, session, lineAttributes]);
|
|
12128
|
-
const onAddToBag =
|
|
12129
|
-
const addForBuyNow =
|
|
12354
|
+
const onAddToBag = useCallback22(() => addPicked(true), [addPicked]);
|
|
12355
|
+
const addForBuyNow = useCallback22(() => addPicked(false), [addPicked]);
|
|
12130
12356
|
const buyNow = useBuyNow(addForBuyNow);
|
|
12131
|
-
const onBuyNow =
|
|
12357
|
+
const onBuyNow = useCallback22(() => {
|
|
12132
12358
|
if (!allSelected) return;
|
|
12133
12359
|
const variant = findVariant(selectedVariants);
|
|
12134
12360
|
if (variant === void 0) {
|
|
@@ -12137,10 +12363,10 @@ function useProductDetail(product, options) {
|
|
|
12137
12363
|
}
|
|
12138
12364
|
buyNow.start(variant.id);
|
|
12139
12365
|
}, [allSelected, findVariant, selectedVariants, buyNow]);
|
|
12140
|
-
const onAskAgent =
|
|
12366
|
+
const onAskAgent = useCallback22(() => {
|
|
12141
12367
|
session.sendMessage(`Tell me more about the ${product.title}`);
|
|
12142
12368
|
}, [session, product.title]);
|
|
12143
|
-
const onPickSibling =
|
|
12369
|
+
const onPickSibling = useCallback22((sibling) => {
|
|
12144
12370
|
if (sibling.current === true) return;
|
|
12145
12371
|
session.dispatchSuggestionAction({
|
|
12146
12372
|
id: `navigate-product-${sibling.id}`,
|
|
@@ -12155,7 +12381,7 @@ function useProductDetail(product, options) {
|
|
|
12155
12381
|
payload: { page: { kind: "product", id: sibling.id, morph: true } }
|
|
12156
12382
|
});
|
|
12157
12383
|
}, [session]);
|
|
12158
|
-
const toggleZoom =
|
|
12384
|
+
const toggleZoom = useCallback22(() => setZoomed((p) => !p), []);
|
|
12159
12385
|
return {
|
|
12160
12386
|
selectedImage,
|
|
12161
12387
|
selectImage: setSelectedImage,
|
|
@@ -12182,7 +12408,7 @@ function useProductDetail(product, options) {
|
|
|
12182
12408
|
}
|
|
12183
12409
|
|
|
12184
12410
|
// src/verticals/commerce/comparison/use-comparison-table.ts
|
|
12185
|
-
import { useCallback as
|
|
12411
|
+
import { useCallback as useCallback23 } from "react";
|
|
12186
12412
|
function classifyComparisonValue(v) {
|
|
12187
12413
|
if (v === void 0) return { kind: "value", value: "" };
|
|
12188
12414
|
if (v === true || v === "true" || v === "Yes") return { kind: "true" };
|
|
@@ -12190,7 +12416,7 @@ function classifyComparisonValue(v) {
|
|
|
12190
12416
|
return { kind: "value", value: v };
|
|
12191
12417
|
}
|
|
12192
12418
|
function useComparisonHighlight(highlightedId) {
|
|
12193
|
-
const isHighlighted =
|
|
12419
|
+
const isHighlighted = useCallback23(
|
|
12194
12420
|
(id) => id === highlightedId,
|
|
12195
12421
|
[highlightedId]
|
|
12196
12422
|
);
|
|
@@ -12198,7 +12424,7 @@ function useComparisonHighlight(highlightedId) {
|
|
|
12198
12424
|
}
|
|
12199
12425
|
|
|
12200
12426
|
// src/verticals/commerce/cart/use-cart-drawer.ts
|
|
12201
|
-
import { useCallback as
|
|
12427
|
+
import { useCallback as useCallback24 } from "react";
|
|
12202
12428
|
|
|
12203
12429
|
// src/verticals/commerce/cart/use-safe-cart.ts
|
|
12204
12430
|
var warnedCart = false;
|
|
@@ -12232,7 +12458,7 @@ function useSafeCart() {
|
|
|
12232
12458
|
}
|
|
12233
12459
|
|
|
12234
12460
|
// src/verticals/commerce/cart/cart-drawer-store.ts
|
|
12235
|
-
import { useSyncExternalStore as
|
|
12461
|
+
import { useSyncExternalStore as useSyncExternalStore12 } from "react";
|
|
12236
12462
|
var isOpen = false;
|
|
12237
12463
|
var focus = null;
|
|
12238
12464
|
var listeners11 = /* @__PURE__ */ new Set();
|
|
@@ -12262,7 +12488,7 @@ function openCartDrawerFocusedOn(productId) {
|
|
|
12262
12488
|
notify11();
|
|
12263
12489
|
}
|
|
12264
12490
|
function useCartDrawerFocus() {
|
|
12265
|
-
return
|
|
12491
|
+
return useSyncExternalStore12(subscribe9, () => focus, () => null);
|
|
12266
12492
|
}
|
|
12267
12493
|
function closeCartDrawer() {
|
|
12268
12494
|
if (!isOpen) return;
|
|
@@ -12275,7 +12501,7 @@ function toggleCartDrawer() {
|
|
|
12275
12501
|
notify11();
|
|
12276
12502
|
}
|
|
12277
12503
|
function useCartDrawerOpen() {
|
|
12278
|
-
return
|
|
12504
|
+
return useSyncExternalStore12(subscribe9, () => isOpen, () => false);
|
|
12279
12505
|
}
|
|
12280
12506
|
registerExclusiveOverlay("cart", closeCartDrawer);
|
|
12281
12507
|
registerSessionScopedClear(() => {
|
|
@@ -12289,9 +12515,9 @@ registerSessionScopedClear(() => {
|
|
|
12289
12515
|
function useCartDrawer() {
|
|
12290
12516
|
const cart = useSafeCart();
|
|
12291
12517
|
const isOpen2 = useCartDrawerOpen();
|
|
12292
|
-
const open =
|
|
12293
|
-
const close =
|
|
12294
|
-
const toggle =
|
|
12518
|
+
const open = useCallback24(() => openCartDrawer(), []);
|
|
12519
|
+
const close = useCallback24(() => closeCartDrawer(), []);
|
|
12520
|
+
const toggle = useCallback24(() => toggleCartDrawer(), []);
|
|
12295
12521
|
return {
|
|
12296
12522
|
isOpen: isOpen2,
|
|
12297
12523
|
open,
|
|
@@ -12311,7 +12537,7 @@ function useCartDrawer() {
|
|
|
12311
12537
|
import React44 from "react";
|
|
12312
12538
|
|
|
12313
12539
|
// src/verticals/commerce/cart/queued-discount-codes.ts
|
|
12314
|
-
import { useSyncExternalStore as
|
|
12540
|
+
import { useSyncExternalStore as useSyncExternalStore13 } from "react";
|
|
12315
12541
|
var queued = [];
|
|
12316
12542
|
var listeners12 = /* @__PURE__ */ new Set();
|
|
12317
12543
|
function notify12() {
|
|
@@ -12356,7 +12582,7 @@ function subscribe10(listener) {
|
|
|
12356
12582
|
}
|
|
12357
12583
|
var NONE = [];
|
|
12358
12584
|
function useQueuedDiscountCodes() {
|
|
12359
|
-
return
|
|
12585
|
+
return useSyncExternalStore13(subscribe10, readQueuedDiscountCodes, () => NONE);
|
|
12360
12586
|
}
|
|
12361
12587
|
registerSessionScopedClear(() => {
|
|
12362
12588
|
if (queued.length === 0) return;
|
|
@@ -12439,7 +12665,7 @@ function useCartView(cart, onCheckout) {
|
|
|
12439
12665
|
}
|
|
12440
12666
|
|
|
12441
12667
|
// src/verticals/commerce/cart/cart-action-failures.ts
|
|
12442
|
-
import { useMemo as
|
|
12668
|
+
import { useMemo as useMemo18, useSyncExternalStore as useSyncExternalStore14 } from "react";
|
|
12443
12669
|
var FAILURE_TTL_MS = 2 * 6e4;
|
|
12444
12670
|
var FAILURE_CAP = 5;
|
|
12445
12671
|
var failures = [];
|
|
@@ -12486,12 +12712,12 @@ function subscribe11(listener) {
|
|
|
12486
12712
|
}
|
|
12487
12713
|
var NO_FAILURES = [];
|
|
12488
12714
|
function useCartActionFailures() {
|
|
12489
|
-
return
|
|
12715
|
+
return useSyncExternalStore14(subscribe11, snapshot, () => NO_FAILURES);
|
|
12490
12716
|
}
|
|
12491
12717
|
function useCartActionFailuresFor(productIdsInCart) {
|
|
12492
12718
|
const all = useCartActionFailures();
|
|
12493
12719
|
const key = productIdsInCart.join("\0");
|
|
12494
|
-
return
|
|
12720
|
+
return useMemo18(() => {
|
|
12495
12721
|
const present = new Set(key.length === 0 ? [] : key.split("\0"));
|
|
12496
12722
|
return all.filter((f) => f.productId !== void 0 && !present.has(f.productId));
|
|
12497
12723
|
}, [all, key]);
|
|
@@ -12506,17 +12732,17 @@ registerSessionScopedClear(() => {
|
|
|
12506
12732
|
import * as React45 from "react";
|
|
12507
12733
|
|
|
12508
12734
|
// src/verticals/commerce/use-commerce-actions.ts
|
|
12509
|
-
import { useCallback as
|
|
12735
|
+
import { useCallback as useCallback25 } from "react";
|
|
12510
12736
|
function useCommerceActions() {
|
|
12511
12737
|
const canvas = useCanvasActions();
|
|
12512
|
-
const navigateToProduct =
|
|
12738
|
+
const navigateToProduct = useCallback25(
|
|
12513
12739
|
(productId, title) => {
|
|
12514
12740
|
if (!canvas) return;
|
|
12515
12741
|
canvas.navigate({ kind: "product", id: productId }, title);
|
|
12516
12742
|
},
|
|
12517
12743
|
[canvas]
|
|
12518
12744
|
);
|
|
12519
|
-
const showCollection =
|
|
12745
|
+
const showCollection = useCallback25(
|
|
12520
12746
|
(collectionTitle) => {
|
|
12521
12747
|
if (!canvas) return;
|
|
12522
12748
|
canvas.dispatchAction({
|
|
@@ -12528,7 +12754,7 @@ function useCommerceActions() {
|
|
|
12528
12754
|
},
|
|
12529
12755
|
[canvas]
|
|
12530
12756
|
);
|
|
12531
|
-
const navigateToProductSet =
|
|
12757
|
+
const navigateToProductSet = useCallback25(
|
|
12532
12758
|
(handle, title, productIds) => {
|
|
12533
12759
|
if (!canvas) return;
|
|
12534
12760
|
canvas.dispatchAction({
|
|
@@ -12586,7 +12812,7 @@ function useCartLineRow(line, opts) {
|
|
|
12586
12812
|
}
|
|
12587
12813
|
|
|
12588
12814
|
// src/verticals/commerce/wishlist/use-wishlist-drawer.ts
|
|
12589
|
-
import { useCallback as
|
|
12815
|
+
import { useCallback as useCallback27, useState as useState16 } from "react";
|
|
12590
12816
|
var warnedDegraded = false;
|
|
12591
12817
|
function useSafeWishlist() {
|
|
12592
12818
|
try {
|
|
@@ -12610,11 +12836,11 @@ function useSafeWishlist() {
|
|
|
12610
12836
|
function useWishlistDrawer() {
|
|
12611
12837
|
const wishlist = useSafeWishlist();
|
|
12612
12838
|
const [isOpen2, setIsOpen] = useState16(false);
|
|
12613
|
-
const open =
|
|
12614
|
-
const close =
|
|
12615
|
-
const toggle =
|
|
12839
|
+
const open = useCallback27(() => setIsOpen(true), []);
|
|
12840
|
+
const close = useCallback27(() => setIsOpen(false), []);
|
|
12841
|
+
const toggle = useCallback27(() => setIsOpen((p) => !p), []);
|
|
12616
12842
|
useExclusiveOverlay("wishlist", isOpen2, close);
|
|
12617
|
-
const removeLine =
|
|
12843
|
+
const removeLine = useCallback27(
|
|
12618
12844
|
(productId) => {
|
|
12619
12845
|
if (wishlist === null) {
|
|
12620
12846
|
console.warn("[useWishlistDrawer] removeLine called with no commerce provider");
|
|
@@ -12724,9 +12950,9 @@ function pickColorCount(product) {
|
|
|
12724
12950
|
import * as React46 from "react";
|
|
12725
12951
|
|
|
12726
12952
|
// src/verticals/commerce/variant/variant-option-axes.ts
|
|
12727
|
-
function carriesValue(variant, name,
|
|
12953
|
+
function carriesValue(variant, name, value2) {
|
|
12728
12954
|
const wantName = canonicalOptionValue(name);
|
|
12729
|
-
const wantValue = canonicalOptionValue(
|
|
12955
|
+
const wantValue = canonicalOptionValue(value2);
|
|
12730
12956
|
return variant.selectedOptions?.some(
|
|
12731
12957
|
(o) => canonicalOptionValue(o.name) === wantName && canonicalOptionValue(o.value) === wantValue
|
|
12732
12958
|
) === true;
|
|
@@ -12754,8 +12980,8 @@ function variantsMatching(product, selections3) {
|
|
|
12754
12980
|
function purchasableAlternativesFor(product, axisName, selections3) {
|
|
12755
12981
|
if (!hasAxis(product, axisName)) return null;
|
|
12756
12982
|
const others = {};
|
|
12757
|
-
for (const [name,
|
|
12758
|
-
if (name !== axisName) others[name] =
|
|
12983
|
+
for (const [name, value2] of Object.entries(selections3)) {
|
|
12984
|
+
if (name !== axisName) others[name] = value2;
|
|
12759
12985
|
}
|
|
12760
12986
|
const pool = Object.keys(others).length > 0 ? variantsMatching(product, others) : product.variants;
|
|
12761
12987
|
const want = canonicalOptionValue(axisName);
|
|
@@ -12767,13 +12993,13 @@ function purchasableAlternativesFor(product, axisName, selections3) {
|
|
|
12767
12993
|
}
|
|
12768
12994
|
return values;
|
|
12769
12995
|
}
|
|
12770
|
-
function photoForValue(product, name,
|
|
12771
|
-
const matches = product.variants.filter((v) => carriesValue(v, name,
|
|
12996
|
+
function photoForValue(product, name, value2) {
|
|
12997
|
+
const matches = product.variants.filter((v) => carriesValue(v, name, value2));
|
|
12772
12998
|
const available = matches.find((v) => v.available === true && v.image !== void 0);
|
|
12773
12999
|
const withImage = available !== void 0 ? available : matches.find((v) => v.image !== void 0);
|
|
12774
13000
|
if (withImage === void 0 || withImage.image === void 0) return void 0;
|
|
12775
13001
|
const { url, altText } = withImage.image;
|
|
12776
|
-
return { url, altText: altText.length > 0 ? altText :
|
|
13002
|
+
return { url, altText: altText.length > 0 ? altText : value2 };
|
|
12777
13003
|
}
|
|
12778
13004
|
function photosDiscriminate(values) {
|
|
12779
13005
|
const urls = /* @__PURE__ */ new Set();
|
|
@@ -12793,12 +13019,12 @@ function differingAxes(product, candidates) {
|
|
|
12793
13019
|
if (match !== void 0) present.add(match.value);
|
|
12794
13020
|
}
|
|
12795
13021
|
if (present.size <= 1) continue;
|
|
12796
|
-
const values = option.values.map((
|
|
12797
|
-
value,
|
|
13022
|
+
const values = option.values.map((value2) => ({
|
|
13023
|
+
value: value2,
|
|
12798
13024
|
// Purchasability is a question about what's buyable *now*, so it reads
|
|
12799
13025
|
// the candidate set — unlike the photo, which reads every variant.
|
|
12800
|
-
available: candidates.some((v) => carriesValue(v, option.name,
|
|
12801
|
-
image: photoForValue(product, option.name,
|
|
13026
|
+
available: candidates.some((v) => carriesValue(v, option.name, value2) && v.available === true),
|
|
13027
|
+
image: photoForValue(product, option.name, value2)
|
|
12802
13028
|
}));
|
|
12803
13029
|
axes.push({
|
|
12804
13030
|
name: option.name,
|
|
@@ -13257,17 +13483,17 @@ function resolveSwatchColor(name) {
|
|
|
13257
13483
|
}
|
|
13258
13484
|
|
|
13259
13485
|
// src/verticals/content/use-content-actions.ts
|
|
13260
|
-
import { useCallback as
|
|
13486
|
+
import { useCallback as useCallback28 } from "react";
|
|
13261
13487
|
function useContentActions() {
|
|
13262
13488
|
const canvas = useCanvasActions();
|
|
13263
|
-
const navigateToArticle =
|
|
13489
|
+
const navigateToArticle = useCallback28(
|
|
13264
13490
|
(articleId, title) => {
|
|
13265
13491
|
if (!canvas) return;
|
|
13266
13492
|
canvas.navigate({ kind: "article", id: articleId }, title);
|
|
13267
13493
|
},
|
|
13268
13494
|
[canvas]
|
|
13269
13495
|
);
|
|
13270
|
-
const subscribeNewsletter =
|
|
13496
|
+
const subscribeNewsletter = useCallback28(
|
|
13271
13497
|
(email, buttonLabel) => {
|
|
13272
13498
|
if (!canvas) return;
|
|
13273
13499
|
canvas.dispatchAction({
|
|
@@ -13287,7 +13513,7 @@ function useContentActions() {
|
|
|
13287
13513
|
import { useEffect as useEffect19, useState as useState19 } from "react";
|
|
13288
13514
|
|
|
13289
13515
|
// package.json
|
|
13290
|
-
var version = "0.5.
|
|
13516
|
+
var version = "0.5.23";
|
|
13291
13517
|
|
|
13292
13518
|
// src/host/host-modules.ts
|
|
13293
13519
|
import * as react from "react";
|
|
@@ -13374,7 +13600,7 @@ function Spacefront(props) {
|
|
|
13374
13600
|
}
|
|
13375
13601
|
|
|
13376
13602
|
// src/npm.ts
|
|
13377
|
-
import { z as
|
|
13603
|
+
import { z as z54 } from "zod";
|
|
13378
13604
|
export {
|
|
13379
13605
|
ACQUISITION_KIND_LABELS,
|
|
13380
13606
|
ACTIVE_PANEL_ATTR,
|
|
@@ -13407,9 +13633,21 @@ export {
|
|
|
13407
13633
|
AttributeScopeBucketSchema,
|
|
13408
13634
|
AttributeScopeConfigSchema,
|
|
13409
13635
|
AvailabilityStatusSchema,
|
|
13636
|
+
BOARD_MAX_FACTS,
|
|
13637
|
+
BOARD_MAX_ITEMS,
|
|
13638
|
+
BOARD_NAMESPACE,
|
|
13639
|
+
BOARD_NAME_MAX,
|
|
13640
|
+
BOARD_TITLE_MAX,
|
|
13410
13641
|
BRAND_MARK_MAX_BYTES,
|
|
13411
13642
|
BRAND_MARK_SLOTS,
|
|
13412
13643
|
BRAND_MARK_TYPES,
|
|
13644
|
+
BoardEditSchema,
|
|
13645
|
+
BoardFactSchema,
|
|
13646
|
+
BoardItemSchema,
|
|
13647
|
+
BoardMemberSchema,
|
|
13648
|
+
BoardProjectionSchema,
|
|
13649
|
+
BoardShareSchema,
|
|
13650
|
+
BoardStateSchema,
|
|
13413
13651
|
BotCheckNoticeProvider,
|
|
13414
13652
|
BotCheckNoticeSchema,
|
|
13415
13653
|
BrandMarkImageSchema,
|
|
@@ -13504,6 +13742,7 @@ export {
|
|
|
13504
13742
|
EntryContextSchema,
|
|
13505
13743
|
EntryContextValueSchema,
|
|
13506
13744
|
FACT_SHAPE,
|
|
13745
|
+
FEED_QUESTION_FLOW,
|
|
13507
13746
|
FEED_SECTION_FLOW,
|
|
13508
13747
|
FLOW_OUTPUT_SIGNAL,
|
|
13509
13748
|
FUNNEL_STEPS,
|
|
@@ -13537,6 +13776,7 @@ export {
|
|
|
13537
13776
|
ItemTransitionGroup,
|
|
13538
13777
|
JSON_PATCH_OPS,
|
|
13539
13778
|
JsonPatchOpSchema,
|
|
13779
|
+
LANDING_PATH_PARAM,
|
|
13540
13780
|
LateBoundValueSchema,
|
|
13541
13781
|
LlmSessionsDailySchema,
|
|
13542
13782
|
LlmUsageBySessionSchema,
|
|
@@ -13561,6 +13801,8 @@ export {
|
|
|
13561
13801
|
PRESENCE_OPTIMISTIC_FACTS_FLOW,
|
|
13562
13802
|
PRODUCTS_SURFACED,
|
|
13563
13803
|
PRODUCT_REVIEWS_RESOLVER_KEY,
|
|
13804
|
+
PRODUCT_SECTION_ID_PATTERN,
|
|
13805
|
+
PRODUCT_SECTION_MAX_CHARS,
|
|
13564
13806
|
PRODUCT_SELECT_OPTION_SIGNAL,
|
|
13565
13807
|
PRODUCT_VARIANTS_SCOPE,
|
|
13566
13808
|
PROJECTION_SET_SIGNAL,
|
|
@@ -13583,6 +13825,7 @@ export {
|
|
|
13583
13825
|
ProjectionPreferencesSchema,
|
|
13584
13826
|
ProjectionSetPayloadSchema,
|
|
13585
13827
|
ProjectionSignalBridge,
|
|
13828
|
+
QueueSortKeySchema,
|
|
13586
13829
|
REACTIONS_NAMESPACE,
|
|
13587
13830
|
REFERRER_HOST_PARAM,
|
|
13588
13831
|
REGISTRY_CLICKED,
|
|
@@ -13601,6 +13844,7 @@ export {
|
|
|
13601
13844
|
SDK_SHIMS,
|
|
13602
13845
|
SDK_VERSION_PATTERN,
|
|
13603
13846
|
SELECTION_ORIGIN_VISITOR,
|
|
13847
|
+
SESSION_UNAVAILABLE_CLOSE,
|
|
13604
13848
|
SIGNAL_PATCH_PREFIX,
|
|
13605
13849
|
SOCKET_BEARER_SUBPROTOCOL_PREFIX,
|
|
13606
13850
|
SOCKET_SUBPROTOCOL,
|
|
@@ -13709,6 +13953,7 @@ export {
|
|
|
13709
13953
|
attachmentFailureOfStatus,
|
|
13710
13954
|
bareComponentType,
|
|
13711
13955
|
bearerFromSocketProtocols,
|
|
13956
|
+
boardLabelKey,
|
|
13712
13957
|
buildBaseAttributesConfig,
|
|
13713
13958
|
buildBucketLabelsConfig,
|
|
13714
13959
|
buildComparisonRows,
|
|
@@ -13717,6 +13962,7 @@ export {
|
|
|
13717
13962
|
buildOptimisticCartLine,
|
|
13718
13963
|
buildPdpCompanionsConfig,
|
|
13719
13964
|
buildProductFieldsConfig,
|
|
13965
|
+
buildProductSectionsConfig,
|
|
13720
13966
|
buildWipeVariants,
|
|
13721
13967
|
canonicalOptionValue,
|
|
13722
13968
|
carriesShapeToken,
|
|
@@ -13739,6 +13985,7 @@ export {
|
|
|
13739
13985
|
clearCodeDiscountSources,
|
|
13740
13986
|
clearProductFieldReaders,
|
|
13741
13987
|
clearProductNameLookups,
|
|
13988
|
+
clearProductSectionReaders,
|
|
13742
13989
|
clearShopCheckouts,
|
|
13743
13990
|
clearStoreArticleLookups,
|
|
13744
13991
|
clearStoreThemeSources,
|
|
@@ -13863,6 +14110,7 @@ export {
|
|
|
13863
14110
|
preselectFromFacts,
|
|
13864
14111
|
presenceFactShape,
|
|
13865
14112
|
presenceReducer,
|
|
14113
|
+
previewBoardEdit,
|
|
13866
14114
|
primedEntities,
|
|
13867
14115
|
primedEntitiesFor,
|
|
13868
14116
|
productTypeBucket,
|
|
@@ -13882,6 +14130,7 @@ export {
|
|
|
13882
14130
|
readOptionAxes,
|
|
13883
14131
|
readPdpCompanions,
|
|
13884
14132
|
readProductFieldsConfig,
|
|
14133
|
+
readProductSectionsConfig,
|
|
13885
14134
|
readQueuedDiscountCodes,
|
|
13886
14135
|
recordCartActionFailure,
|
|
13887
14136
|
recordOptionSelections,
|
|
@@ -13906,6 +14155,7 @@ export {
|
|
|
13906
14155
|
registerProductFieldReader,
|
|
13907
14156
|
registerProductFieldSource,
|
|
13908
14157
|
registerProductNameLookup,
|
|
14158
|
+
registerProductSectionReader,
|
|
13909
14159
|
registerServiceHydrators,
|
|
13910
14160
|
registerSessionScopedClear,
|
|
13911
14161
|
registerShopCheckout,
|
|
@@ -13932,6 +14182,7 @@ export {
|
|
|
13932
14182
|
resolveProductFieldReader,
|
|
13933
14183
|
resolveProductFieldSource,
|
|
13934
14184
|
resolveProductNameLookup,
|
|
14185
|
+
resolveProductSectionReader,
|
|
13935
14186
|
resolveProductVariant,
|
|
13936
14187
|
resolveScope,
|
|
13937
14188
|
resolveServiceHydrators,
|
|
@@ -13957,6 +14208,7 @@ export {
|
|
|
13957
14208
|
selectedOptionsToRecord,
|
|
13958
14209
|
serverState,
|
|
13959
14210
|
serverStateEntries,
|
|
14211
|
+
serverStateRev,
|
|
13960
14212
|
serverStateVector,
|
|
13961
14213
|
setAgentPresenceFrame,
|
|
13962
14214
|
setCanvasProfile,
|
|
@@ -14002,6 +14254,7 @@ export {
|
|
|
14002
14254
|
useAnalyticsSink,
|
|
14003
14255
|
useAskAbout,
|
|
14004
14256
|
useAskStore,
|
|
14257
|
+
useBoard,
|
|
14005
14258
|
useBotCheckNotice,
|
|
14006
14259
|
useCanvasActions,
|
|
14007
14260
|
useCanvasArrangement,
|
|
@@ -14105,6 +14358,7 @@ export {
|
|
|
14105
14358
|
useProductGridFilter,
|
|
14106
14359
|
useProductReviews,
|
|
14107
14360
|
useProductSearch,
|
|
14361
|
+
useProductSection,
|
|
14108
14362
|
useProducts,
|
|
14109
14363
|
useProjection,
|
|
14110
14364
|
usePromptComposer,
|
|
@@ -14120,6 +14374,7 @@ export {
|
|
|
14120
14374
|
useScanning,
|
|
14121
14375
|
useScrollContainerRef,
|
|
14122
14376
|
useScrollHasMoreBelow,
|
|
14377
|
+
useSeedLayout,
|
|
14123
14378
|
useSelectMessage,
|
|
14124
14379
|
useSessionId,
|
|
14125
14380
|
useSessionMessages,
|
|
@@ -14166,5 +14421,5 @@ export {
|
|
|
14166
14421
|
withQueuedDiscountCodes,
|
|
14167
14422
|
withSignalTurn,
|
|
14168
14423
|
withoutClosingQuestion,
|
|
14169
|
-
|
|
14424
|
+
z54 as z
|
|
14170
14425
|
};
|