@40rty/ams-sdk 0.5.22 → 0.5.24
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 +823 -631
- package/dist/types/ecommerce/src/buyer-sign-in.d.ts +2 -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 +455 -23
- 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/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,
|
|
@@ -217,6 +231,7 @@ __export(src_exports3, {
|
|
|
217
231
|
ProjectionPreferencesSchema: () => ProjectionPreferencesSchema,
|
|
218
232
|
ProjectionSetPayloadSchema: () => ProjectionSetPayloadSchema,
|
|
219
233
|
ProjectionSignalBridge: () => ProjectionSignalBridge,
|
|
234
|
+
QueueSortKeySchema: () => QueueSortKeySchema,
|
|
220
235
|
REACTIONS_NAMESPACE: () => REACTIONS_NAMESPACE,
|
|
221
236
|
REFERRER_HOST_PARAM: () => REFERRER_HOST_PARAM,
|
|
222
237
|
REGISTRY_CLICKED: () => REGISTRY_CLICKED,
|
|
@@ -235,6 +250,7 @@ __export(src_exports3, {
|
|
|
235
250
|
SDK_SHIMS: () => SDK_SHIMS,
|
|
236
251
|
SDK_VERSION_PATTERN: () => SDK_VERSION_PATTERN,
|
|
237
252
|
SELECTION_ORIGIN_VISITOR: () => SELECTION_ORIGIN_VISITOR,
|
|
253
|
+
SESSION_UNAVAILABLE_CLOSE: () => SESSION_UNAVAILABLE_CLOSE,
|
|
238
254
|
SIGNAL_PATCH_PREFIX: () => SIGNAL_PATCH_PREFIX,
|
|
239
255
|
SOCKET_BEARER_SUBPROTOCOL_PREFIX: () => SOCKET_BEARER_SUBPROTOCOL_PREFIX,
|
|
240
256
|
SOCKET_SUBPROTOCOL: () => SOCKET_SUBPROTOCOL,
|
|
@@ -342,6 +358,7 @@ __export(src_exports3, {
|
|
|
342
358
|
attachmentFailureOfStatus: () => attachmentFailureOfStatus,
|
|
343
359
|
bareComponentType: () => bareComponentType,
|
|
344
360
|
bearerFromSocketProtocols: () => bearerFromSocketProtocols,
|
|
361
|
+
boardLabelKey: () => boardLabelKey,
|
|
345
362
|
buildBaseAttributesConfig: () => buildBaseAttributesConfig,
|
|
346
363
|
buildBucketLabelsConfig: () => buildBucketLabelsConfig,
|
|
347
364
|
buildComparisonRows: () => buildComparisonRows,
|
|
@@ -497,6 +514,7 @@ __export(src_exports3, {
|
|
|
497
514
|
preselectFromFacts: () => preselectFromFacts,
|
|
498
515
|
presenceFactShape: () => presenceFactShape,
|
|
499
516
|
presenceReducer: () => presenceReducer,
|
|
517
|
+
previewBoardEdit: () => previewBoardEdit,
|
|
500
518
|
primedEntities: () => primedEntities,
|
|
501
519
|
primedEntitiesFor: () => primedEntitiesFor,
|
|
502
520
|
productTypeBucket: () => productTypeBucket,
|
|
@@ -594,6 +612,7 @@ __export(src_exports3, {
|
|
|
594
612
|
selectedOptionsToRecord: () => selectedOptionsToRecord,
|
|
595
613
|
serverState: () => serverState,
|
|
596
614
|
serverStateEntries: () => serverStateEntries,
|
|
615
|
+
serverStateRev: () => serverStateRev,
|
|
597
616
|
serverStateVector: () => serverStateVector,
|
|
598
617
|
setAgentPresenceFrame: () => setAgentPresenceFrame,
|
|
599
618
|
setCanvasProfile: () => setCanvasProfile,
|
|
@@ -639,6 +658,7 @@ __export(src_exports3, {
|
|
|
639
658
|
useAnalyticsSink: () => useAnalyticsSink,
|
|
640
659
|
useAskAbout: () => useAskAbout,
|
|
641
660
|
useAskStore: () => useAskStore,
|
|
661
|
+
useBoard: () => useBoard,
|
|
642
662
|
useBotCheckNotice: () => useBotCheckNotice,
|
|
643
663
|
useCanvasActions: () => useCanvasActions,
|
|
644
664
|
useCanvasArrangement: () => useCanvasArrangement,
|
|
@@ -758,6 +778,7 @@ __export(src_exports3, {
|
|
|
758
778
|
useScanning: () => useScanning,
|
|
759
779
|
useScrollContainerRef: () => useScrollContainerRef,
|
|
760
780
|
useScrollHasMoreBelow: () => useScrollHasMoreBelow,
|
|
781
|
+
useSeedLayout: () => useSeedLayout,
|
|
761
782
|
useSelectMessage: () => useSelectMessage,
|
|
762
783
|
useSessionId: () => useSessionId,
|
|
763
784
|
useSessionMessages: () => useSessionMessages,
|
|
@@ -888,23 +909,23 @@ function eventCatalog(...kinds) {
|
|
|
888
909
|
}
|
|
889
910
|
};
|
|
890
911
|
}
|
|
891
|
-
function accepts(catalog,
|
|
892
|
-
if (typeof
|
|
893
|
-
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");
|
|
894
915
|
if (typeof name !== "string" || name.length === 0) return false;
|
|
895
916
|
const found = catalog.lookup(name);
|
|
896
917
|
if (found === null) return false;
|
|
897
918
|
if (emittableOnly && found.trust !== "client") return false;
|
|
898
|
-
const payload = Reflect.get(
|
|
919
|
+
const payload = Reflect.get(value2, "payload");
|
|
899
920
|
return found.schema.safeParse(payload).success;
|
|
900
921
|
}
|
|
901
922
|
function catalogEventSchema(catalog) {
|
|
902
|
-
return z2.custom((
|
|
923
|
+
return z2.custom((value2) => accepts(catalog, value2, false), {
|
|
903
924
|
message: "Not a registered analytics event kind, or the payload does not match its schema"
|
|
904
925
|
});
|
|
905
926
|
}
|
|
906
927
|
function catalogEmittableSchema(catalog) {
|
|
907
|
-
return z2.custom((
|
|
928
|
+
return z2.custom((value2) => accepts(catalog, value2, true), {
|
|
908
929
|
message: "Not a registered, browser-emittable analytics event kind, or the payload does not match its schema"
|
|
909
930
|
});
|
|
910
931
|
}
|
|
@@ -1056,8 +1077,8 @@ function consentDisposition(consent) {
|
|
|
1056
1077
|
}
|
|
1057
1078
|
|
|
1058
1079
|
// src/analytics/outbox.ts
|
|
1059
|
-
function isWirePayload(
|
|
1060
|
-
return typeof
|
|
1080
|
+
function isWirePayload(value2) {
|
|
1081
|
+
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
|
|
1061
1082
|
}
|
|
1062
1083
|
function isAttributed(row) {
|
|
1063
1084
|
return row.sessionId !== null;
|
|
@@ -1556,6 +1577,7 @@ __export(session_exports, {
|
|
|
1556
1577
|
registerSessionScopedClear: () => registerSessionScopedClear,
|
|
1557
1578
|
runSessionScopedClearHandlers: () => runSessionScopedClearHandlers,
|
|
1558
1579
|
useAction: () => useAction,
|
|
1580
|
+
useBoard: () => useBoard,
|
|
1559
1581
|
useComposerDraft: () => useComposerDraft,
|
|
1560
1582
|
useFourtySession: () => useFourtySession,
|
|
1561
1583
|
useOptionalFourtySession: () => useOptionalFourtySession,
|
|
@@ -1592,9 +1614,21 @@ __export(src_exports, {
|
|
|
1592
1614
|
AttributeDefSchema: () => AttributeDefSchema,
|
|
1593
1615
|
AttributeScopeBucketSchema: () => AttributeScopeBucketSchema,
|
|
1594
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,
|
|
1595
1622
|
BRAND_MARK_MAX_BYTES: () => BRAND_MARK_MAX_BYTES,
|
|
1596
1623
|
BRAND_MARK_SLOTS: () => BRAND_MARK_SLOTS,
|
|
1597
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,
|
|
1598
1632
|
BotCheckNoticeSchema: () => BotCheckNoticeSchema,
|
|
1599
1633
|
BrandMarkImageSchema: () => BrandMarkImageSchema,
|
|
1600
1634
|
BrandMarkSchema: () => BrandMarkSchema,
|
|
@@ -1645,6 +1679,7 @@ __export(src_exports, {
|
|
|
1645
1679
|
EntryContextNamespaceSchema: () => EntryContextNamespaceSchema,
|
|
1646
1680
|
EntryContextSchema: () => EntryContextSchema,
|
|
1647
1681
|
EntryContextValueSchema: () => EntryContextValueSchema,
|
|
1682
|
+
FEED_QUESTION_FLOW: () => FEED_QUESTION_FLOW,
|
|
1648
1683
|
FEED_SECTION_FLOW: () => FEED_SECTION_FLOW,
|
|
1649
1684
|
FLOW_OUTPUT_SIGNAL: () => FLOW_OUTPUT_SIGNAL,
|
|
1650
1685
|
FileBugInputSchema: () => FileBugInputSchema,
|
|
@@ -1658,6 +1693,7 @@ __export(src_exports, {
|
|
|
1658
1693
|
InteractionSignalSchema: () => InteractionSignalSchema,
|
|
1659
1694
|
JSON_PATCH_OPS: () => JSON_PATCH_OPS,
|
|
1660
1695
|
JsonPatchOpSchema: () => JsonPatchOpSchema,
|
|
1696
|
+
LANDING_PATH_PARAM: () => LANDING_PATH_PARAM,
|
|
1661
1697
|
LateBoundValueSchema: () => LateBoundValueSchema,
|
|
1662
1698
|
LlmSessionsDailySchema: () => LlmSessionsDailySchema,
|
|
1663
1699
|
LlmUsageBySessionSchema: () => LlmUsageBySessionSchema,
|
|
@@ -1687,6 +1723,7 @@ __export(src_exports, {
|
|
|
1687
1723
|
ProjectionDirectiveSchema: () => ProjectionDirectiveSchema,
|
|
1688
1724
|
ProjectionPreferencesSchema: () => ProjectionPreferencesSchema,
|
|
1689
1725
|
ProjectionSetPayloadSchema: () => ProjectionSetPayloadSchema,
|
|
1726
|
+
QueueSortKeySchema: () => QueueSortKeySchema,
|
|
1690
1727
|
REACTIONS_NAMESPACE: () => REACTIONS_NAMESPACE,
|
|
1691
1728
|
REFERRER_HOST_PARAM: () => REFERRER_HOST_PARAM,
|
|
1692
1729
|
RELEASE_MESSAGE_MAX: () => RELEASE_MESSAGE_MAX,
|
|
@@ -1700,6 +1737,7 @@ __export(src_exports, {
|
|
|
1700
1737
|
SDK_SHIMS: () => SDK_SHIMS,
|
|
1701
1738
|
SDK_VERSION_PATTERN: () => SDK_VERSION_PATTERN,
|
|
1702
1739
|
SELECTION_ORIGIN_VISITOR: () => SELECTION_ORIGIN_VISITOR,
|
|
1740
|
+
SESSION_UNAVAILABLE_CLOSE: () => SESSION_UNAVAILABLE_CLOSE,
|
|
1703
1741
|
SIGNAL_PATCH_PREFIX: () => SIGNAL_PATCH_PREFIX,
|
|
1704
1742
|
SOCKET_BEARER_SUBPROTOCOL_PREFIX: () => SOCKET_BEARER_SUBPROTOCOL_PREFIX,
|
|
1705
1743
|
SOCKET_SUBPROTOCOL: () => SOCKET_SUBPROTOCOL,
|
|
@@ -1778,6 +1816,7 @@ __export(src_exports, {
|
|
|
1778
1816
|
attachmentFailureOfStatus: () => attachmentFailureOfStatus,
|
|
1779
1817
|
bareComponentType: () => bareComponentType,
|
|
1780
1818
|
bearerFromSocketProtocols: () => bearerFromSocketProtocols,
|
|
1819
|
+
boardLabelKey: () => boardLabelKey,
|
|
1781
1820
|
canonicalOptionValue: () => canonicalOptionValue,
|
|
1782
1821
|
carriesShapeToken: () => carriesShapeToken,
|
|
1783
1822
|
catalogFromWire: () => catalogFromWire,
|
|
@@ -1826,6 +1865,7 @@ __export(src_exports, {
|
|
|
1826
1865
|
parseReleasePreview: () => parseReleasePreview,
|
|
1827
1866
|
placeBlocks: () => placeBlocks,
|
|
1828
1867
|
placedEntityRefsOf: () => placedEntityRefsOf,
|
|
1868
|
+
previewBoardEdit: () => previewBoardEdit,
|
|
1829
1869
|
projectCollection: () => projectCollection,
|
|
1830
1870
|
prose: () => prose,
|
|
1831
1871
|
readHosting: () => readHosting,
|
|
@@ -2082,6 +2122,7 @@ var DIRECTION_FLOW = "direction.standing";
|
|
|
2082
2122
|
var COMPANION_FLOW = "companion.note";
|
|
2083
2123
|
var GREETING_FLOW = "greeting.line";
|
|
2084
2124
|
var FEED_SECTION_FLOW = "feed.section";
|
|
2125
|
+
var FEED_QUESTION_FLOW = "feed.question";
|
|
2085
2126
|
var EPHEMERAL_FACT_FLOWS = [PRESENCE_FLOW, DIRECTION_FLOW];
|
|
2086
2127
|
|
|
2087
2128
|
// ../spacestation/src/shell/shell.ts
|
|
@@ -2161,7 +2202,7 @@ function kindOmits(kind, key) {
|
|
|
2161
2202
|
return omit !== void 0 && omit.has(key);
|
|
2162
2203
|
}
|
|
2163
2204
|
function pageIdentityKey(page) {
|
|
2164
|
-
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}`);
|
|
2165
2206
|
return parts2.length === 0 ? page.kind : `${page.kind}:${parts2.join(",")}`;
|
|
2166
2207
|
}
|
|
2167
2208
|
|
|
@@ -2799,15 +2840,15 @@ function ownersAt(root, keys) {
|
|
|
2799
2840
|
for (const key of keys.slice(0, -1)) {
|
|
2800
2841
|
const next = [];
|
|
2801
2842
|
for (const owner of owners) {
|
|
2802
|
-
const
|
|
2803
|
-
if (isPlainObject(
|
|
2804
|
-
next.push({ container:
|
|
2843
|
+
const value2 = owner.container[key];
|
|
2844
|
+
if (isPlainObject(value2)) {
|
|
2845
|
+
next.push({ container: value2, indexInParent: -1 });
|
|
2805
2846
|
continue;
|
|
2806
2847
|
}
|
|
2807
|
-
if (!Array.isArray(
|
|
2808
|
-
for (let i = 0; i <
|
|
2809
|
-
const item =
|
|
2810
|
-
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 });
|
|
2811
2852
|
}
|
|
2812
2853
|
}
|
|
2813
2854
|
owners = next;
|
|
@@ -2821,27 +2862,27 @@ function collectPlacedEntityRefs(props, sites) {
|
|
|
2821
2862
|
const leaf = keys[keys.length - 1];
|
|
2822
2863
|
if (leaf === void 0) continue;
|
|
2823
2864
|
for (const owner of ownersAt(props, keys)) {
|
|
2824
|
-
const
|
|
2825
|
-
if (Array.isArray(
|
|
2826
|
-
for (const item of
|
|
2865
|
+
const value2 = owner.container[leaf];
|
|
2866
|
+
if (Array.isArray(value2)) {
|
|
2867
|
+
for (const item of value2) {
|
|
2827
2868
|
if (typeof item !== "string" || item.length === 0) continue;
|
|
2828
2869
|
placed.push({
|
|
2829
2870
|
site,
|
|
2830
2871
|
ref: item,
|
|
2831
2872
|
remove: () => {
|
|
2832
|
-
const at =
|
|
2833
|
-
if (at !== -1)
|
|
2873
|
+
const at = value2.indexOf(item);
|
|
2874
|
+
if (at !== -1) value2.splice(at, 1);
|
|
2834
2875
|
}
|
|
2835
2876
|
});
|
|
2836
2877
|
}
|
|
2837
2878
|
continue;
|
|
2838
2879
|
}
|
|
2839
|
-
if (typeof
|
|
2880
|
+
if (typeof value2 !== "string" || value2.length === 0) continue;
|
|
2840
2881
|
const required = site.meta.min !== void 0 && site.meta.min >= 1;
|
|
2841
2882
|
const isArrayElement = owner.parentArray !== void 0;
|
|
2842
2883
|
placed.push({
|
|
2843
2884
|
site,
|
|
2844
|
-
ref:
|
|
2885
|
+
ref: value2,
|
|
2845
2886
|
remove: () => {
|
|
2846
2887
|
if (isArrayElement && required && owner.parentArray !== void 0) {
|
|
2847
2888
|
const at = owner.parentArray.indexOf(owner.container);
|
|
@@ -2934,9 +2975,9 @@ function walk2(schema, path, when, out, visited) {
|
|
|
2934
2975
|
if (schema instanceof z19.ZodDiscriminatedUnion) {
|
|
2935
2976
|
const key = schema.discriminator;
|
|
2936
2977
|
for (const opt of schema.options) {
|
|
2937
|
-
const
|
|
2938
|
-
if (
|
|
2939
|
-
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);
|
|
2940
2981
|
}
|
|
2941
2982
|
return;
|
|
2942
2983
|
}
|
|
@@ -2951,8 +2992,8 @@ function discriminatorValue(option, key) {
|
|
|
2951
2992
|
if (!(option instanceof z19.ZodObject)) return void 0;
|
|
2952
2993
|
const field = option.shape[key];
|
|
2953
2994
|
if (!(field instanceof z19.ZodLiteral)) return void 0;
|
|
2954
|
-
const
|
|
2955
|
-
return typeof
|
|
2995
|
+
const value2 = field.value;
|
|
2996
|
+
return typeof value2 === "string" ? value2 : void 0;
|
|
2956
2997
|
}
|
|
2957
2998
|
|
|
2958
2999
|
// ../spacestation/src/catalog/required-props.ts
|
|
@@ -2969,10 +3010,10 @@ function requiredTopLevelProps(schema) {
|
|
|
2969
3010
|
}
|
|
2970
3011
|
return out;
|
|
2971
3012
|
}
|
|
2972
|
-
function isEmptyPropValue(
|
|
2973
|
-
if (
|
|
2974
|
-
if (typeof
|
|
2975
|
-
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;
|
|
2976
3017
|
return false;
|
|
2977
3018
|
}
|
|
2978
3019
|
function isOptionalSchema(schema) {
|
|
@@ -3092,11 +3133,11 @@ function* expandInner(node, remaining, real) {
|
|
|
3092
3133
|
if (node === null || typeof node !== "object") return;
|
|
3093
3134
|
yield* expandInner(node[seg], rest, [...real, seg]);
|
|
3094
3135
|
}
|
|
3095
|
-
function normalizeRefs(
|
|
3096
|
-
if (typeof
|
|
3097
|
-
if (Array.isArray(
|
|
3136
|
+
function normalizeRefs(value2) {
|
|
3137
|
+
if (typeof value2 === "string") return [value2];
|
|
3138
|
+
if (Array.isArray(value2)) {
|
|
3098
3139
|
const out = [];
|
|
3099
|
-
for (const v of
|
|
3140
|
+
for (const v of value2) if (typeof v === "string") out.push(v);
|
|
3100
3141
|
return out;
|
|
3101
3142
|
}
|
|
3102
3143
|
return [];
|
|
@@ -3104,8 +3145,8 @@ function normalizeRefs(value) {
|
|
|
3104
3145
|
function derivedSourceFilled(meta, props) {
|
|
3105
3146
|
const source = meta.derivedFrom;
|
|
3106
3147
|
if (typeof source !== "string" || source.length === 0) return false;
|
|
3107
|
-
for (const
|
|
3108
|
-
if (
|
|
3148
|
+
for (const ref2 of normalizeRefs(props[source])) {
|
|
3149
|
+
if (ref2.length > 0) return true;
|
|
3109
3150
|
}
|
|
3110
3151
|
return false;
|
|
3111
3152
|
}
|
|
@@ -3122,8 +3163,8 @@ function isElementUnfilled(element, catalog, aliases, options) {
|
|
|
3122
3163
|
if (typeof top === "string" && isOptionalTopLevelProp(entry.propsSchema, top)) continue;
|
|
3123
3164
|
const expansions = Array.from(expandPath(props, path));
|
|
3124
3165
|
if (expansions.length === 0) return true;
|
|
3125
|
-
for (const { value } of expansions) {
|
|
3126
|
-
if (normalizeRefs(
|
|
3166
|
+
for (const { value: value2 } of expansions) {
|
|
3167
|
+
if (normalizeRefs(value2).length === 0) return true;
|
|
3127
3168
|
}
|
|
3128
3169
|
}
|
|
3129
3170
|
for (const prop of requiredTopLevelProps(entry.propsSchema)) {
|
|
@@ -3150,22 +3191,22 @@ function rendersNothing(spec, catalog, aliases) {
|
|
|
3150
3191
|
|
|
3151
3192
|
// ../spacestation/src/catalog/shape-tokens.ts
|
|
3152
3193
|
var SHAPE_TOKEN = /<(?![/!])[^<>=]*\s[^<>=]*(?<!\/)>/;
|
|
3153
|
-
function carriesShapeToken(
|
|
3154
|
-
if (typeof
|
|
3155
|
-
if (Array.isArray(
|
|
3156
|
-
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);
|
|
3157
3198
|
return false;
|
|
3158
3199
|
}
|
|
3159
3200
|
|
|
3160
3201
|
// ../spacestation/src/layout/apply-patch.ts
|
|
3161
|
-
function arrayAdd(arr, key,
|
|
3202
|
+
function arrayAdd(arr, key, value2) {
|
|
3162
3203
|
if (key === "-") {
|
|
3163
|
-
arr.push(
|
|
3204
|
+
arr.push(value2);
|
|
3164
3205
|
return true;
|
|
3165
3206
|
}
|
|
3166
3207
|
const idx = Number(key);
|
|
3167
3208
|
if (!Number.isInteger(idx) || idx < 0 || idx > arr.length) return false;
|
|
3168
|
-
arr.splice(idx, 0,
|
|
3209
|
+
arr.splice(idx, 0, value2);
|
|
3169
3210
|
return true;
|
|
3170
3211
|
}
|
|
3171
3212
|
function arrayIndex(arr, key) {
|
|
@@ -3470,8 +3511,8 @@ function objectNode(schema, path) {
|
|
|
3470
3511
|
return { t: "object", shape, unknownKeys: schema._def.unknownKeys };
|
|
3471
3512
|
}
|
|
3472
3513
|
function literalNode(schema, path) {
|
|
3473
|
-
const
|
|
3474
|
-
if (typeof
|
|
3514
|
+
const value2 = schema.value;
|
|
3515
|
+
if (typeof value2 === "string" || typeof value2 === "number" || typeof value2 === "boolean") return { t: "literal", value: value2 };
|
|
3475
3516
|
throw new UnsupportedSchemaError(path, "only string, number and boolean literals are supported");
|
|
3476
3517
|
}
|
|
3477
3518
|
function bare(schema, path) {
|
|
@@ -3910,8 +3951,8 @@ function projectCollection(items, directive, acc) {
|
|
|
3910
3951
|
if (resolved2 === void 0) continue;
|
|
3911
3952
|
const target = norm(resolved2);
|
|
3912
3953
|
out = out.filter((item) => {
|
|
3913
|
-
const
|
|
3914
|
-
return
|
|
3954
|
+
const value2 = acc.axisValueOf(item, axis);
|
|
3955
|
+
return value2 !== void 0 && norm(value2) === target;
|
|
3915
3956
|
});
|
|
3916
3957
|
}
|
|
3917
3958
|
}
|
|
@@ -4069,6 +4110,11 @@ var SessionArrivalSchema = z37.object({
|
|
|
4069
4110
|
/** Host only — never a full URL. A path carries query strings, and query
|
|
4070
4111
|
* strings carry emails and order ids. Normalised server-side. */
|
|
4071
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(),
|
|
4072
4118
|
surface: SurfaceSchema.optional(),
|
|
4073
4119
|
visitorIdDurability: VisitorIdDurabilitySchema.optional()
|
|
4074
4120
|
}).strict().refine(
|
|
@@ -4085,6 +4131,7 @@ var UTM_PARAMS = [
|
|
|
4085
4131
|
["utm_term", "utmTerm"]
|
|
4086
4132
|
];
|
|
4087
4133
|
var REFERRER_HOST_PARAM = "referrer_host";
|
|
4134
|
+
var LANDING_PATH_PARAM = "landing_path";
|
|
4088
4135
|
var ARRIVAL_PARAMS = [
|
|
4089
4136
|
...UTM_PARAMS.map(([param]) => param),
|
|
4090
4137
|
...CLICK_ID_KINDS
|
|
@@ -4094,9 +4141,9 @@ function firstClickId(params) {
|
|
|
4094
4141
|
for (const kind of CLICK_ID_PRECEDENCE) {
|
|
4095
4142
|
const raw = params.get(kind);
|
|
4096
4143
|
if (raw === null) continue;
|
|
4097
|
-
const
|
|
4098
|
-
if (
|
|
4099
|
-
return { kind, value };
|
|
4144
|
+
const value2 = raw.trim();
|
|
4145
|
+
if (value2.length === 0) continue;
|
|
4146
|
+
return { kind, value: value2 };
|
|
4100
4147
|
}
|
|
4101
4148
|
return null;
|
|
4102
4149
|
}
|
|
@@ -4105,9 +4152,9 @@ function arrivalFromParams(evidence) {
|
|
|
4105
4152
|
for (const [param, field] of UTM_PARAMS) {
|
|
4106
4153
|
const raw = evidence.params.get(param);
|
|
4107
4154
|
if (raw === null) continue;
|
|
4108
|
-
const
|
|
4109
|
-
if (
|
|
4110
|
-
draft[field] =
|
|
4155
|
+
const value2 = raw.trim();
|
|
4156
|
+
if (value2.length === 0) continue;
|
|
4157
|
+
draft[field] = value2;
|
|
4111
4158
|
}
|
|
4112
4159
|
const click = firstClickId(evidence.params);
|
|
4113
4160
|
if (click !== null) {
|
|
@@ -4117,6 +4164,9 @@ function arrivalFromParams(evidence) {
|
|
|
4117
4164
|
if (evidence.referrerHost !== void 0 && evidence.referrerHost.length > 0) {
|
|
4118
4165
|
draft.referrerHost = evidence.referrerHost;
|
|
4119
4166
|
}
|
|
4167
|
+
if (evidence.landingPath !== void 0 && evidence.landingPath.length > 0) {
|
|
4168
|
+
draft.landingPath = evidence.landingPath;
|
|
4169
|
+
}
|
|
4120
4170
|
const hostFields = {
|
|
4121
4171
|
surface: evidence.surface,
|
|
4122
4172
|
...evidence.visitorIdDurability === void 0 ? {} : { visitorIdDurability: evidence.visitorIdDurability }
|
|
@@ -4131,13 +4181,14 @@ function arrivalFromParams(evidence) {
|
|
|
4131
4181
|
}
|
|
4132
4182
|
function arrivalToParams(arrival, into) {
|
|
4133
4183
|
for (const [param, field] of UTM_PARAMS) {
|
|
4134
|
-
const
|
|
4135
|
-
if (
|
|
4184
|
+
const value2 = arrival[field];
|
|
4185
|
+
if (value2 !== void 0) into.set(param, value2);
|
|
4136
4186
|
}
|
|
4137
4187
|
if (arrival.clickIdKind !== void 0 && arrival.clickId !== void 0) {
|
|
4138
4188
|
into.set(arrival.clickIdKind, arrival.clickId);
|
|
4139
4189
|
}
|
|
4140
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);
|
|
4141
4192
|
if (arrival.surface !== void 0) into.set("surface", arrival.surface);
|
|
4142
4193
|
if (arrival.visitorIdDurability !== void 0) into.set("visitorIdDurability", arrival.visitorIdDurability);
|
|
4143
4194
|
}
|
|
@@ -4169,6 +4220,7 @@ var WIRE_PROTOCOL_VERSION = 1;
|
|
|
4169
4220
|
var MIN_WIRE_PROTOCOL_VERSION = 1;
|
|
4170
4221
|
var WIRE_PROTOCOL_PARAM = "protocol";
|
|
4171
4222
|
var WIRE_PROTOCOL_UNSUPPORTED_CLOSE = 4426;
|
|
4223
|
+
var SESSION_UNAVAILABLE_CLOSE = 4404;
|
|
4172
4224
|
|
|
4173
4225
|
// ../spacestation/src/catalog/attribute-registry.ts
|
|
4174
4226
|
import { z as z38 } from "zod";
|
|
@@ -4372,8 +4424,8 @@ var DEFAULT_HOSTING = {
|
|
|
4372
4424
|
headless: true,
|
|
4373
4425
|
embedded: false
|
|
4374
4426
|
};
|
|
4375
|
-
function isRecord(
|
|
4376
|
-
return typeof
|
|
4427
|
+
function isRecord(value2) {
|
|
4428
|
+
return typeof value2 === "object" && value2 !== null;
|
|
4377
4429
|
}
|
|
4378
4430
|
function readHosting(platformConfigBag) {
|
|
4379
4431
|
const bag = isRecord(platformConfigBag) ? platformConfigBag : {};
|
|
@@ -4488,12 +4540,20 @@ var SessionTurnSchema = z42.object({
|
|
|
4488
4540
|
/** Full cumulative Spec committed by this turn — never a patch delta. */
|
|
4489
4541
|
layout: z42.unknown().nullable(),
|
|
4490
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(),
|
|
4491
4548
|
latencyTotal: z42.number().int().nullable(),
|
|
4492
4549
|
phaseTimings: z42.record(z42.number()).nullable(),
|
|
4493
|
-
tokensByModel: z42.record(
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
|
|
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(),
|
|
4497
4557
|
toolCalls: z42.array(z42.unknown()).nullable(),
|
|
4498
4558
|
diagnostics: z42.array(z42.unknown()).nullable()
|
|
4499
4559
|
});
|
|
@@ -4596,6 +4656,7 @@ var SessionActivitySchema = z43.object({
|
|
|
4596
4656
|
});
|
|
4597
4657
|
|
|
4598
4658
|
// ../spacestation/src/space/session-queue.ts
|
|
4659
|
+
var QueueSortKeySchema = z44.enum(["lastActive", "stage", "source", "location", "turns", "duration"]);
|
|
4599
4660
|
var SessionVerdictSchema = z44.enum(["unreviewed", "viewed", "bug"]);
|
|
4600
4661
|
var RecordableVerdictSchema = z44.enum(["viewed", "bug"]);
|
|
4601
4662
|
var SessionReviewEventSchema = z44.object({
|
|
@@ -4914,6 +4975,7 @@ var SessionCaptureInputSchema = z44.object({
|
|
|
4914
4975
|
var SessionArrivalRecordSchema = z44.object({
|
|
4915
4976
|
trafficBucket: z44.string().nullable(),
|
|
4916
4977
|
referrerHost: z44.string().nullable(),
|
|
4978
|
+
landingPath: z44.string().nullable(),
|
|
4917
4979
|
utmSource: z44.string().nullable(),
|
|
4918
4980
|
utmMedium: z44.string().nullable(),
|
|
4919
4981
|
utmCampaign: z44.string().nullable(),
|
|
@@ -4950,13 +5012,13 @@ var FileBugInputSchema = z44.object({
|
|
|
4950
5012
|
});
|
|
4951
5013
|
|
|
4952
5014
|
// ../spacestation/src/contracts/retrieval/ecommerce/option-values.ts
|
|
4953
|
-
function canonicalOptionValue(
|
|
4954
|
-
return
|
|
5015
|
+
function canonicalOptionValue(value2) {
|
|
5016
|
+
return value2.trim().toLowerCase();
|
|
4955
5017
|
}
|
|
4956
|
-
function statedValueVerdict(axes, axisName,
|
|
5018
|
+
function statedValueVerdict(axes, axisName, value2) {
|
|
4957
5019
|
const values = reportedAxisValues(axes, axisName);
|
|
4958
5020
|
if (values === void 0) return "unknown";
|
|
4959
|
-
const want = canonicalOptionValue(
|
|
5021
|
+
const want = canonicalOptionValue(value2);
|
|
4960
5022
|
return values.some((v) => canonicalOptionValue(v) === want) ? "carries" : "lacks";
|
|
4961
5023
|
}
|
|
4962
5024
|
function reportedAxisValues(axes, axisName) {
|
|
@@ -5129,6 +5191,69 @@ function stringifyForScoring(v) {
|
|
|
5129
5191
|
}
|
|
5130
5192
|
}
|
|
5131
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
|
+
|
|
5132
5257
|
// src/session/turn-attributed-session.ts
|
|
5133
5258
|
var TURN_ATTRIBUTED_SIGNALS = /* @__PURE__ */ new Set([CART_ADD_SIGNAL]);
|
|
5134
5259
|
function withSignalTurn(signal, turnId) {
|
|
@@ -5159,45 +5284,45 @@ function useOptionalFourtySession() {
|
|
|
5159
5284
|
}
|
|
5160
5285
|
function useComposerDraft() {
|
|
5161
5286
|
const { composerDraftStore, setComposerDraft } = useFourtySession();
|
|
5162
|
-
const
|
|
5287
|
+
const value2 = useSyncExternalStore(
|
|
5163
5288
|
composerDraftStore.subscribe,
|
|
5164
5289
|
composerDraftStore.get,
|
|
5165
5290
|
composerDraftStore.get
|
|
5166
5291
|
);
|
|
5167
|
-
return [
|
|
5292
|
+
return [value2, setComposerDraft];
|
|
5168
5293
|
}
|
|
5169
5294
|
|
|
5170
5295
|
// src/session/use-action.ts
|
|
5171
5296
|
import { useCallback } from "react";
|
|
5172
|
-
function useAction(
|
|
5297
|
+
function useAction(label2, action) {
|
|
5173
5298
|
const session = useOptionalFourtySession();
|
|
5174
5299
|
return useCallback(() => {
|
|
5175
5300
|
if (!session) return;
|
|
5176
5301
|
const dispatchable = action !== void 0 && isDispatchable(action);
|
|
5177
5302
|
if (action !== void 0 && !dispatchable) {
|
|
5178
5303
|
console.warn(
|
|
5179
|
-
`[useAction] "${
|
|
5304
|
+
`[useAction] "${label2}" carries an undispatchable ${action.type} action \u2014 falling back to message("${label2}")`,
|
|
5180
5305
|
action.payload
|
|
5181
5306
|
);
|
|
5182
5307
|
}
|
|
5183
5308
|
const resolved2 = dispatchable && action !== void 0 ? {
|
|
5184
|
-
id: action.id ?? `cta-${action.type}-${
|
|
5309
|
+
id: action.id ?? `cta-${action.type}-${label2}`,
|
|
5185
5310
|
// A control always has a visible label as its
|
|
5186
5311
|
// user-visible string; the action.label override is rare. Fall
|
|
5187
5312
|
// back to the control's own `label` prop so SuggestionAction's
|
|
5188
5313
|
// required `label` field is never undefined.
|
|
5189
|
-
label: action.label ??
|
|
5314
|
+
label: action.label ?? label2,
|
|
5190
5315
|
type: action.type,
|
|
5191
5316
|
payload: action.payload ?? {},
|
|
5192
5317
|
...action.icon ? { icon: action.icon } : {}
|
|
5193
5318
|
} : {
|
|
5194
|
-
id: `cta-message-${
|
|
5195
|
-
label,
|
|
5319
|
+
id: `cta-message-${label2}`,
|
|
5320
|
+
label: label2,
|
|
5196
5321
|
type: "message",
|
|
5197
|
-
payload: { text:
|
|
5322
|
+
payload: { text: label2 }
|
|
5198
5323
|
};
|
|
5199
5324
|
session.dispatchSuggestionAction(resolved2);
|
|
5200
|
-
}, [
|
|
5325
|
+
}, [label2, action, session]);
|
|
5201
5326
|
}
|
|
5202
5327
|
function isDispatchable(action) {
|
|
5203
5328
|
if (action.type !== NAVIGATE_SIGNAL) return true;
|
|
@@ -5305,60 +5430,60 @@ __export(src_exports2, {
|
|
|
5305
5430
|
});
|
|
5306
5431
|
|
|
5307
5432
|
// ../ecommerce/src/commerce-schemas.ts
|
|
5308
|
-
import { z as
|
|
5309
|
-
var MoneySchema =
|
|
5310
|
-
amount:
|
|
5311
|
-
currencyCode:
|
|
5312
|
-
});
|
|
5313
|
-
var ImageSchema =
|
|
5314
|
-
url:
|
|
5315
|
-
altText:
|
|
5316
|
-
width:
|
|
5317
|
-
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(),
|
|
5318
5443
|
/** Responsive candidate set, resolved at the commerce-adapter boundary —
|
|
5319
5444
|
* never computed in a component. Renderers use it as `<img srcSet>` paired
|
|
5320
5445
|
* with a layout `sizes`. Absent for non-CDN / unsizable images. */
|
|
5321
|
-
srcSet:
|
|
5446
|
+
srcSet: z46.string().optional()
|
|
5322
5447
|
});
|
|
5323
|
-
var AssetSchema =
|
|
5448
|
+
var AssetSchema = z46.object({
|
|
5324
5449
|
/** Opaque asset id — the `resolved()` ref the agent emitted. */
|
|
5325
|
-
id:
|
|
5326
|
-
url:
|
|
5327
|
-
altText:
|
|
5328
|
-
srcSet:
|
|
5329
|
-
});
|
|
5330
|
-
var SelectedOptionSchema =
|
|
5331
|
-
name:
|
|
5332
|
-
value:
|
|
5333
|
-
});
|
|
5334
|
-
var VideoSourceSchema =
|
|
5335
|
-
url:
|
|
5336
|
-
mimeType:
|
|
5337
|
-
width:
|
|
5338
|
-
height:
|
|
5339
|
-
});
|
|
5340
|
-
var ProductVideoSchema =
|
|
5341
|
-
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"]),
|
|
5342
5467
|
previewImage: ImageSchema.optional(),
|
|
5343
|
-
altText:
|
|
5468
|
+
altText: z46.string().default(""),
|
|
5344
5469
|
/** `kind: 'hosted'` only — empty for external embeds. */
|
|
5345
|
-
sources:
|
|
5470
|
+
sources: z46.array(VideoSourceSchema).default([]),
|
|
5346
5471
|
/** `kind: 'external'` only — iframe embed URL. */
|
|
5347
|
-
embedUrl:
|
|
5472
|
+
embedUrl: z46.string().optional(),
|
|
5348
5473
|
/** `kind: 'external'` only — e.g. `YOUTUBE` | `VIMEO`. */
|
|
5349
|
-
host:
|
|
5474
|
+
host: z46.string().optional()
|
|
5350
5475
|
});
|
|
5351
|
-
var AvailabilityStatusSchema =
|
|
5476
|
+
var AvailabilityStatusSchema = z46.enum([
|
|
5352
5477
|
"in_stock",
|
|
5353
5478
|
"backorder",
|
|
5354
5479
|
"preorder",
|
|
5355
5480
|
"out_of_stock",
|
|
5356
5481
|
"discontinued"
|
|
5357
5482
|
]);
|
|
5358
|
-
var ProductVariantSchema =
|
|
5359
|
-
id:
|
|
5360
|
-
title:
|
|
5361
|
-
available:
|
|
5483
|
+
var ProductVariantSchema = z46.object({
|
|
5484
|
+
id: z46.string(),
|
|
5485
|
+
title: z46.string(),
|
|
5486
|
+
available: z46.boolean(),
|
|
5362
5487
|
/**
|
|
5363
5488
|
* Qualifies `available` with the fulfillment state behind it. Absent means
|
|
5364
5489
|
* the backend did not say — which is NOT the same as in stock, and must not
|
|
@@ -5373,10 +5498,10 @@ var ProductVariantSchema = z45.object({
|
|
|
5373
5498
|
availabilityStatus: AvailabilityStatusSchema.optional(),
|
|
5374
5499
|
price: MoneySchema,
|
|
5375
5500
|
compareAtPrice: MoneySchema.optional(),
|
|
5376
|
-
selectedOptions:
|
|
5501
|
+
selectedOptions: z46.array(SelectedOptionSchema).optional(),
|
|
5377
5502
|
image: ImageSchema.optional(),
|
|
5378
5503
|
/** The merchant's stock-keeping code. Absent when the backend has none. */
|
|
5379
|
-
sku:
|
|
5504
|
+
sku: z46.string().optional()
|
|
5380
5505
|
});
|
|
5381
5506
|
var MP4_MIME = "video/mp4";
|
|
5382
5507
|
var HLS_MIME = "application/x-mpegURL";
|
|
@@ -5386,34 +5511,34 @@ function orderedVideoSources(video) {
|
|
|
5386
5511
|
const hls = video.sources.filter((s) => s.mimeType === HLS_MIME);
|
|
5387
5512
|
return [...mp4, ...hls];
|
|
5388
5513
|
}
|
|
5389
|
-
var SiblingProductSchema =
|
|
5390
|
-
id:
|
|
5391
|
-
handle:
|
|
5392
|
-
title:
|
|
5514
|
+
var SiblingProductSchema = z46.object({
|
|
5515
|
+
id: z46.string(),
|
|
5516
|
+
handle: z46.string(),
|
|
5517
|
+
title: z46.string(),
|
|
5393
5518
|
/** The differentiating value across siblings — typically the color
|
|
5394
5519
|
* label ("OLIVE", "STONE"). Rendered next to the swatch row. */
|
|
5395
|
-
color:
|
|
5520
|
+
color: z46.string(),
|
|
5396
5521
|
/** Swatch artwork. Hydrators populate from the sibling product's
|
|
5397
5522
|
* first image; renderers crop / fit to the swatch tile. */
|
|
5398
5523
|
swatchImage: ImageSchema.optional(),
|
|
5399
|
-
available:
|
|
5524
|
+
available: z46.boolean().default(true),
|
|
5400
5525
|
/** Marks the sibling that IS the currently-rendered product. The
|
|
5401
5526
|
* picker uses this to highlight the active swatch without an
|
|
5402
5527
|
* external id comparison. */
|
|
5403
|
-
current:
|
|
5528
|
+
current: z46.boolean().default(false)
|
|
5404
5529
|
});
|
|
5405
|
-
var ProductSchema =
|
|
5406
|
-
id:
|
|
5407
|
-
handle:
|
|
5408
|
-
title:
|
|
5409
|
-
description:
|
|
5410
|
-
descriptionHtml:
|
|
5411
|
-
vendor:
|
|
5412
|
-
productType:
|
|
5413
|
-
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([]),
|
|
5414
5539
|
price: MoneySchema.default({ amount: 0, currencyCode: "USD" }),
|
|
5415
5540
|
compareAtPrice: MoneySchema.optional(),
|
|
5416
|
-
images:
|
|
5541
|
+
images: z46.array(ImageSchema).default([]),
|
|
5417
5542
|
/**
|
|
5418
5543
|
* Product videos (`Video` + `ExternalVideo` media). Shopify's MCP
|
|
5419
5544
|
* catalog drops video media — it only surfaces through the Storefront
|
|
@@ -5421,21 +5546,21 @@ var ProductSchema = z45.object({
|
|
|
5421
5546
|
* boundary. Default `[]` so renderers gate on `length > 0` without a
|
|
5422
5547
|
* presence guard.
|
|
5423
5548
|
*/
|
|
5424
|
-
videos:
|
|
5425
|
-
variants:
|
|
5426
|
-
availableForSale:
|
|
5427
|
-
options:
|
|
5428
|
-
name:
|
|
5429
|
-
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())
|
|
5430
5555
|
})).optional(),
|
|
5431
|
-
collections:
|
|
5556
|
+
collections: z46.array(z46.string()).optional(),
|
|
5432
5557
|
/** See `SiblingProductSchema`. Default `[]` so renderers can check
|
|
5433
5558
|
* `length > 1` to decide whether to draw the swatch row without a
|
|
5434
5559
|
* presence guard. */
|
|
5435
|
-
colorVariants:
|
|
5436
|
-
rating:
|
|
5437
|
-
value:
|
|
5438
|
-
count:
|
|
5560
|
+
colorVariants: z46.array(SiblingProductSchema).default([]),
|
|
5561
|
+
rating: z46.object({
|
|
5562
|
+
value: z46.number(),
|
|
5563
|
+
count: z46.number()
|
|
5439
5564
|
}).optional(),
|
|
5440
5565
|
/**
|
|
5441
5566
|
* Product reviews surfaced from the brand's review store. SDK
|
|
@@ -5444,12 +5569,12 @@ var ProductSchema = z45.object({
|
|
|
5444
5569
|
* review bodies. Renderers (`Reviews` component, `ProductDetail`,
|
|
5445
5570
|
* etc.) consume directly.
|
|
5446
5571
|
*/
|
|
5447
|
-
reviews:
|
|
5448
|
-
author:
|
|
5449
|
-
rating:
|
|
5450
|
-
content:
|
|
5451
|
-
date:
|
|
5452
|
-
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()
|
|
5453
5578
|
})).optional(),
|
|
5454
5579
|
/**
|
|
5455
5580
|
* Ghost-entity flag — `true` when the Storefront API could not hydrate
|
|
@@ -5461,7 +5586,7 @@ var ProductSchema = z45.object({
|
|
|
5461
5586
|
* Set exclusively by `createUnavailableProduct()` — never by the
|
|
5462
5587
|
* Storefront mapper.
|
|
5463
5588
|
*/
|
|
5464
|
-
unavailable:
|
|
5589
|
+
unavailable: z46.boolean().default(false)
|
|
5465
5590
|
});
|
|
5466
5591
|
function createUnavailableProduct(gid) {
|
|
5467
5592
|
return {
|
|
@@ -5480,71 +5605,71 @@ function createUnavailableProduct(gid) {
|
|
|
5480
5605
|
unavailable: true
|
|
5481
5606
|
};
|
|
5482
5607
|
}
|
|
5483
|
-
function isGhostEntity(
|
|
5484
|
-
return typeof
|
|
5485
|
-
}
|
|
5486
|
-
var ReviewSchema =
|
|
5487
|
-
id:
|
|
5488
|
-
productId:
|
|
5489
|
-
author:
|
|
5490
|
-
rating:
|
|
5491
|
-
text:
|
|
5492
|
-
date:
|
|
5493
|
-
verified:
|
|
5494
|
-
});
|
|
5495
|
-
var ArticleSchema =
|
|
5496
|
-
id:
|
|
5497
|
-
handle:
|
|
5498
|
-
title:
|
|
5499
|
-
excerpt:
|
|
5500
|
-
content:
|
|
5501
|
-
contentHtml:
|
|
5502
|
-
author:
|
|
5503
|
-
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(""),
|
|
5504
5629
|
image: ImageSchema.optional(),
|
|
5505
|
-
blogHandle:
|
|
5506
|
-
tags:
|
|
5630
|
+
blogHandle: z46.string().default(""),
|
|
5631
|
+
tags: z46.array(z46.string()).default([])
|
|
5507
5632
|
});
|
|
5508
|
-
var CmsPageSchema =
|
|
5509
|
-
id:
|
|
5510
|
-
handle:
|
|
5511
|
-
title:
|
|
5512
|
-
body:
|
|
5513
|
-
bodyHtml:
|
|
5514
|
-
bodySummary:
|
|
5515
|
-
updatedAt:
|
|
5516
|
-
seoTitle:
|
|
5517
|
-
seoDescription:
|
|
5518
|
-
});
|
|
5519
|
-
var CmsPolicySchema =
|
|
5520
|
-
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(),
|
|
5521
5646
|
/** Stable policy slot identifier: 'refund' | 'privacy' | 'terms' |
|
|
5522
5647
|
* 'shipping' | 'subscription' | 'warranty' | custom string. Open so
|
|
5523
5648
|
* platforms with custom policy types can extend. */
|
|
5524
|
-
kind:
|
|
5649
|
+
kind: z46.string(),
|
|
5525
5650
|
/** Slug-shaped handle the platform exposes for storefront URLs
|
|
5526
5651
|
* (e.g. `refund-policy`). Empty string when the backend doesn't
|
|
5527
5652
|
* surface one. */
|
|
5528
|
-
handle:
|
|
5529
|
-
title:
|
|
5530
|
-
body:
|
|
5531
|
-
bodyHtml:
|
|
5532
|
-
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("")
|
|
5533
5658
|
});
|
|
5534
|
-
var CollectionSchema =
|
|
5535
|
-
id:
|
|
5536
|
-
handle:
|
|
5537
|
-
title:
|
|
5538
|
-
description:
|
|
5659
|
+
var CollectionSchema = z46.object({
|
|
5660
|
+
id: z46.string(),
|
|
5661
|
+
handle: z46.string().default(""),
|
|
5662
|
+
title: z46.string(),
|
|
5663
|
+
description: z46.string().default(""),
|
|
5539
5664
|
image: ImageSchema.optional(),
|
|
5540
|
-
productCount:
|
|
5665
|
+
productCount: z46.number().int().nonnegative().optional()
|
|
5541
5666
|
});
|
|
5542
|
-
var CartLineSchema =
|
|
5543
|
-
id:
|
|
5544
|
-
merchandiseId:
|
|
5545
|
-
productId:
|
|
5546
|
-
title:
|
|
5547
|
-
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(),
|
|
5548
5673
|
/**
|
|
5549
5674
|
* The variant's option axes as structured pairs (e.g.
|
|
5550
5675
|
* `[{name:'Size', value:'7'}]`). The machine-readable counterpart of
|
|
@@ -5553,10 +5678,10 @@ var CartLineSchema = z45.object({
|
|
|
5553
5678
|
* single-variant products (the degenerate `Title: Default Title` axis
|
|
5554
5679
|
* is normalized away at the adapter boundary).
|
|
5555
5680
|
*/
|
|
5556
|
-
selectedOptions:
|
|
5557
|
-
vendor:
|
|
5558
|
-
sku:
|
|
5559
|
-
quantity:
|
|
5681
|
+
selectedOptions: z46.array(SelectedOptionSchema).optional(),
|
|
5682
|
+
vendor: z46.string().optional(),
|
|
5683
|
+
sku: z46.string().optional(),
|
|
5684
|
+
quantity: z46.number().int().positive(),
|
|
5560
5685
|
unitPrice: MoneySchema,
|
|
5561
5686
|
totalPrice: MoneySchema,
|
|
5562
5687
|
image: ImageSchema.optional(),
|
|
@@ -5576,32 +5701,32 @@ var CartLineSchema = z45.object({
|
|
|
5576
5701
|
* client-minted id the backend rejects, line-tap navigation is
|
|
5577
5702
|
* suppressed, and the money never folds into a settled-looking total.
|
|
5578
5703
|
*/
|
|
5579
|
-
pending:
|
|
5704
|
+
pending: z46.boolean().optional(),
|
|
5580
5705
|
/**
|
|
5581
5706
|
* The line's custom attributes (Shopify line item properties), as the
|
|
5582
5707
|
* backend holds them — how a surface tells whether a line carries a tag such
|
|
5583
5708
|
* as `_checkbox_discount`. Absent when the line has none.
|
|
5584
5709
|
*/
|
|
5585
|
-
attributes:
|
|
5710
|
+
attributes: z46.array(CartLineAttributeSchema).optional()
|
|
5586
5711
|
});
|
|
5587
5712
|
function isPendingCartLine(line) {
|
|
5588
5713
|
return line.pending === true;
|
|
5589
5714
|
}
|
|
5590
|
-
var CartDiscountCodeSchema =
|
|
5591
|
-
code:
|
|
5592
|
-
applicable:
|
|
5715
|
+
var CartDiscountCodeSchema = z46.object({
|
|
5716
|
+
code: z46.string(),
|
|
5717
|
+
applicable: z46.boolean()
|
|
5593
5718
|
});
|
|
5594
|
-
var CartMessageSchema =
|
|
5595
|
-
kind:
|
|
5719
|
+
var CartMessageSchema = z46.object({
|
|
5720
|
+
kind: z46.enum(["error", "warning", "info"]),
|
|
5596
5721
|
/** Machine code for branching; opaque and backend-defined. */
|
|
5597
|
-
code:
|
|
5722
|
+
code: z46.string(),
|
|
5598
5723
|
/** Human-readable text, meant to be shown as-is. */
|
|
5599
|
-
content:
|
|
5724
|
+
content: z46.string()
|
|
5600
5725
|
});
|
|
5601
|
-
var CartSchema =
|
|
5602
|
-
id:
|
|
5603
|
-
lines:
|
|
5604
|
-
totalQuantity:
|
|
5726
|
+
var CartSchema = z46.object({
|
|
5727
|
+
id: z46.string(),
|
|
5728
|
+
lines: z46.array(CartLineSchema),
|
|
5729
|
+
totalQuantity: z46.number().int().nonnegative(),
|
|
5605
5730
|
subtotal: MoneySchema,
|
|
5606
5731
|
/**
|
|
5607
5732
|
* Cart total after discounts (pre-shipping/tax). Absent when the
|
|
@@ -5611,11 +5736,11 @@ var CartSchema = z45.object({
|
|
|
5611
5736
|
*/
|
|
5612
5737
|
total: MoneySchema.optional(),
|
|
5613
5738
|
/** Discount codes currently attached to the cart. */
|
|
5614
|
-
discountCodes:
|
|
5739
|
+
discountCodes: z46.array(CartDiscountCodeSchema).default([]),
|
|
5615
5740
|
/** Notices the backend attached to this cart — see `CartMessageSchema`.
|
|
5616
5741
|
* Empty when the backend said nothing or does not report them. */
|
|
5617
|
-
messages:
|
|
5618
|
-
checkoutUrl:
|
|
5742
|
+
messages: z46.array(CartMessageSchema).default([]),
|
|
5743
|
+
checkoutUrl: z46.string().optional(),
|
|
5619
5744
|
/**
|
|
5620
5745
|
* Opaque handle this cart is known by in the connector's BACK OFFICE — the
|
|
5621
5746
|
* value a space owner searches there to find the order this cart became.
|
|
@@ -5628,14 +5753,14 @@ var CartSchema = z45.object({
|
|
|
5628
5753
|
* Absent when the platform has no such handle, or while the cart is still the
|
|
5629
5754
|
* client's optimistic paint and its id is client-minted.
|
|
5630
5755
|
*/
|
|
5631
|
-
backOfficeRef:
|
|
5756
|
+
backOfficeRef: z46.string().optional(),
|
|
5632
5757
|
/**
|
|
5633
5758
|
* URL that recreates this cart on the merchant's own store website
|
|
5634
5759
|
* (replace semantics — overwrites any cart the visitor already has
|
|
5635
5760
|
* there). Populated by platform adapters that support it; absent when
|
|
5636
5761
|
* the cart is empty or the URL cannot be built.
|
|
5637
5762
|
*/
|
|
5638
|
-
storeCartUrl:
|
|
5763
|
+
storeCartUrl: z46.string().optional(),
|
|
5639
5764
|
/**
|
|
5640
5765
|
* True while this cart exists only in the client's optimistic paint —
|
|
5641
5766
|
* no backend cart has been created yet, so its `id` is client-minted and
|
|
@@ -5643,19 +5768,19 @@ var CartSchema = z45.object({
|
|
|
5643
5768
|
* `CartLineSchema.pending`: the adapter never sets it, and callers that
|
|
5644
5769
|
* need a real cart id read THIS rather than sniffing the id's shape.
|
|
5645
5770
|
*/
|
|
5646
|
-
pending:
|
|
5771
|
+
pending: z46.boolean().optional()
|
|
5647
5772
|
});
|
|
5648
|
-
var StoreCheckoutSchema =
|
|
5649
|
-
|
|
5650
|
-
|
|
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() })
|
|
5651
5776
|
]);
|
|
5652
|
-
var ShopCheckoutResultSchema =
|
|
5653
|
-
|
|
5654
|
-
|
|
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) })
|
|
5655
5780
|
]);
|
|
5656
|
-
var ShopCheckoutAnswerSchema =
|
|
5657
|
-
|
|
5658
|
-
|
|
5781
|
+
var ShopCheckoutAnswerSchema = z46.union([
|
|
5782
|
+
z46.object({ available: z46.literal(false) }),
|
|
5783
|
+
z46.object({ available: z46.literal(true), result: ShopCheckoutResultSchema })
|
|
5659
5784
|
]);
|
|
5660
5785
|
function settledCart(cart) {
|
|
5661
5786
|
if (cart === null || cart === void 0) return null;
|
|
@@ -5663,27 +5788,27 @@ function settledCart(cart) {
|
|
|
5663
5788
|
}
|
|
5664
5789
|
|
|
5665
5790
|
// ../ecommerce/src/review-schemas.ts
|
|
5666
|
-
import { z as
|
|
5791
|
+
import { z as z47 } from "zod";
|
|
5667
5792
|
var PRODUCT_REVIEWS_RESOLVER_KEY = "productReviews";
|
|
5668
|
-
var ProductReviewItemSchema =
|
|
5669
|
-
author:
|
|
5670
|
-
rating:
|
|
5793
|
+
var ProductReviewItemSchema = z47.object({
|
|
5794
|
+
author: z47.string(),
|
|
5795
|
+
rating: z47.number(),
|
|
5671
5796
|
/** The reviewer's own headline ("love"), when they wrote one — the site shows it above `content`. */
|
|
5672
|
-
title:
|
|
5673
|
-
content:
|
|
5674
|
-
date:
|
|
5675
|
-
verified:
|
|
5797
|
+
title: z47.string().optional(),
|
|
5798
|
+
content: z47.string(),
|
|
5799
|
+
date: z47.string(),
|
|
5800
|
+
verified: z47.boolean().optional(),
|
|
5676
5801
|
/**
|
|
5677
5802
|
* Non-empty when the review was written for a grouped SIBLING product rather
|
|
5678
5803
|
* than this one (brands pool reviews across a product line). A surface can
|
|
5679
5804
|
* attribute it; empty / absent ⇒ the product's own review.
|
|
5680
5805
|
*/
|
|
5681
|
-
writtenFor:
|
|
5806
|
+
writtenFor: z47.string().optional()
|
|
5682
5807
|
});
|
|
5683
5808
|
var ProductReviewHighlightSchema = ProductReviewItemSchema.extend({
|
|
5684
5809
|
/** The sentence(s) the ranking fired on. Descriptive — it is what the matcher
|
|
5685
5810
|
* scored, NOT necessarily text that occurs in `content`. */
|
|
5686
|
-
highlight:
|
|
5811
|
+
highlight: z47.string().optional(),
|
|
5687
5812
|
/**
|
|
5688
5813
|
* `highlight` resolved back into `content` as a VERBATIM substring, so a
|
|
5689
5814
|
* surface can mark it with a plain `indexOf` and no matcher of its own.
|
|
@@ -5698,39 +5823,39 @@ var ProductReviewHighlightSchema = ProductReviewItemSchema.extend({
|
|
|
5698
5823
|
* Absent when the passage genuinely has no home in the body (one cut from the
|
|
5699
5824
|
* title). A surface then marks NOTHING rather than guessing at a span.
|
|
5700
5825
|
*/
|
|
5701
|
-
mark:
|
|
5826
|
+
mark: z47.string().optional()
|
|
5702
5827
|
});
|
|
5703
|
-
var ReviewAggregateSchema =
|
|
5704
|
-
value:
|
|
5705
|
-
count:
|
|
5828
|
+
var ReviewAggregateSchema = z47.object({
|
|
5829
|
+
value: z47.number(),
|
|
5830
|
+
count: z47.number()
|
|
5706
5831
|
});
|
|
5707
|
-
var ProductReviewDataSchema =
|
|
5708
|
-
id:
|
|
5832
|
+
var ProductReviewDataSchema = z47.object({
|
|
5833
|
+
id: z47.string(),
|
|
5709
5834
|
/** The product's FULL retrieved set — what a filterable list renders. */
|
|
5710
|
-
reviews:
|
|
5835
|
+
reviews: z47.array(ProductReviewItemSchema).default([]),
|
|
5711
5836
|
aggregate: ReviewAggregateSchema.default({ value: 0, count: 0 }),
|
|
5712
5837
|
/** 5★→1★ star COUNTS over the full set (index 0 = 5-star). */
|
|
5713
|
-
distribution:
|
|
5838
|
+
distribution: z47.array(z47.number()).default([]),
|
|
5714
5839
|
/**
|
|
5715
5840
|
* The reviews that ANSWER the surface's intent, best first. Empty when no
|
|
5716
5841
|
* intent was asked for — never a silent copy of `reviews`.
|
|
5717
5842
|
*/
|
|
5718
|
-
highlights:
|
|
5843
|
+
highlights: z47.array(ProductReviewHighlightSchema).default([]),
|
|
5719
5844
|
/**
|
|
5720
5845
|
* True when the review provider could not be read and nothing is indexed —
|
|
5721
5846
|
* the empty lists mean "not loaded", NOT "this product has no reviews".
|
|
5722
5847
|
*/
|
|
5723
|
-
unavailable:
|
|
5848
|
+
unavailable: z47.boolean().optional()
|
|
5724
5849
|
});
|
|
5725
5850
|
var ProductReviewPayloadSchema = ProductReviewDataSchema.omit({ id: true });
|
|
5726
5851
|
|
|
5727
5852
|
// ../ecommerce/src/format-variant-value.ts
|
|
5728
5853
|
var ONE_SIZE_LABEL = "One Size";
|
|
5729
5854
|
var ONE_SIZE_TOKENS = /* @__PURE__ */ new Set(["onesz", "one size", "one_size", "os", "osfa", "osfm"]);
|
|
5730
|
-
function formatVariantValue(
|
|
5731
|
-
const normalized =
|
|
5855
|
+
function formatVariantValue(value2) {
|
|
5856
|
+
const normalized = value2.trim().toLowerCase();
|
|
5732
5857
|
if (ONE_SIZE_TOKENS.has(normalized)) return ONE_SIZE_LABEL;
|
|
5733
|
-
return
|
|
5858
|
+
return value2;
|
|
5734
5859
|
}
|
|
5735
5860
|
|
|
5736
5861
|
// ../ecommerce/src/locale.ts
|
|
@@ -5795,7 +5920,7 @@ function cartLineMatchesSelections(line, wanted) {
|
|
|
5795
5920
|
if (pairs.length === 0) return true;
|
|
5796
5921
|
const actual = selectedOptionsToRecord(line.selectedOptions);
|
|
5797
5922
|
if (actual === void 0) return false;
|
|
5798
|
-
return pairs.every(([axis,
|
|
5923
|
+
return pairs.every(([axis, value2]) => actual[axis] === value2);
|
|
5799
5924
|
}
|
|
5800
5925
|
function cartLinesForProduct(lines, productId, selections3) {
|
|
5801
5926
|
return lines.filter((line) => {
|
|
@@ -6008,15 +6133,15 @@ function buildPdpCompanionsConfig(types) {
|
|
|
6008
6133
|
}
|
|
6009
6134
|
function readPdpCompanions(config) {
|
|
6010
6135
|
if (config === void 0) return void 0;
|
|
6011
|
-
const
|
|
6012
|
-
if (!Array.isArray(
|
|
6013
|
-
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");
|
|
6014
6139
|
}
|
|
6015
6140
|
|
|
6016
6141
|
// ../ecommerce/src/base-attributes.ts
|
|
6017
|
-
import { z as
|
|
6142
|
+
import { z as z48 } from "zod";
|
|
6018
6143
|
var BASE_ATTRIBUTES_CONFIG_KEY = "baseAttributes";
|
|
6019
|
-
var BaseAttributesRecordSchema =
|
|
6144
|
+
var BaseAttributesRecordSchema = z48.record(z48.string(), AttributeDefSchema);
|
|
6020
6145
|
function buildBaseAttributesConfig(attributes) {
|
|
6021
6146
|
return { [BASE_ATTRIBUTES_CONFIG_KEY]: attributes };
|
|
6022
6147
|
}
|
|
@@ -6027,9 +6152,9 @@ function readBaseAttributesConfig(config) {
|
|
|
6027
6152
|
}
|
|
6028
6153
|
|
|
6029
6154
|
// ../ecommerce/src/bucket-labels.ts
|
|
6030
|
-
import { z as
|
|
6155
|
+
import { z as z49 } from "zod";
|
|
6031
6156
|
var BUCKET_LABELS_CONFIG_KEY = "bucketLabels";
|
|
6032
|
-
var BucketLabelsRecordSchema =
|
|
6157
|
+
var BucketLabelsRecordSchema = z49.record(z49.string(), z49.string());
|
|
6033
6158
|
function buildBucketLabelsConfig(labels) {
|
|
6034
6159
|
return { [BUCKET_LABELS_CONFIG_KEY]: labels };
|
|
6035
6160
|
}
|
|
@@ -6060,17 +6185,17 @@ var PRODUCT_FIELDS_CONFIG_KEY = "productFields";
|
|
|
6060
6185
|
function buildProductFieldsConfig(fields) {
|
|
6061
6186
|
return { [PRODUCT_FIELDS_CONFIG_KEY]: fields.map((f) => ({ namespace: f.namespace, key: f.key })) };
|
|
6062
6187
|
}
|
|
6063
|
-
function isFieldRef(
|
|
6064
|
-
if (typeof
|
|
6065
|
-
const namespace = Reflect.get(
|
|
6066
|
-
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");
|
|
6067
6192
|
return typeof namespace === "string" && namespace.length > 0 && typeof key === "string" && key.length > 0;
|
|
6068
6193
|
}
|
|
6069
6194
|
function readProductFieldsConfig(config) {
|
|
6070
6195
|
if (config === void 0) return void 0;
|
|
6071
|
-
const
|
|
6072
|
-
if (!Array.isArray(
|
|
6073
|
-
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 }));
|
|
6074
6199
|
}
|
|
6075
6200
|
function isDeclaredProductField(declared, field) {
|
|
6076
6201
|
return declared.some((d) => d.namespace === field.namespace && d.key === field.key);
|
|
@@ -6115,14 +6240,14 @@ var PRODUCT_SECTIONS_CONFIG_KEY = "productSections";
|
|
|
6115
6240
|
function buildProductSectionsConfig(sectionIds) {
|
|
6116
6241
|
return { [PRODUCT_SECTIONS_CONFIG_KEY]: [...sectionIds] };
|
|
6117
6242
|
}
|
|
6118
|
-
function isSectionId(
|
|
6119
|
-
return typeof
|
|
6243
|
+
function isSectionId(value2) {
|
|
6244
|
+
return typeof value2 === "string" && PRODUCT_SECTION_ID_PATTERN.test(value2);
|
|
6120
6245
|
}
|
|
6121
6246
|
function readProductSectionsConfig(config) {
|
|
6122
6247
|
if (config === void 0) return void 0;
|
|
6123
|
-
const
|
|
6124
|
-
if (!Array.isArray(
|
|
6125
|
-
return
|
|
6248
|
+
const value2 = config[PRODUCT_SECTIONS_CONFIG_KEY];
|
|
6249
|
+
if (!Array.isArray(value2)) return void 0;
|
|
6250
|
+
return value2.filter(isSectionId);
|
|
6126
6251
|
}
|
|
6127
6252
|
var factories3 = [];
|
|
6128
6253
|
function registerProductSectionReader(factory) {
|
|
@@ -6322,6 +6447,100 @@ function runSessionScopedClearHandlers() {
|
|
|
6322
6447
|
}
|
|
6323
6448
|
}
|
|
6324
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
|
+
|
|
6325
6544
|
// src/shell/index.ts
|
|
6326
6545
|
var shell_exports = {};
|
|
6327
6546
|
__export(shell_exports, {
|
|
@@ -6373,19 +6592,19 @@ import React2 from "react";
|
|
|
6373
6592
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
6374
6593
|
var ScrollContainerContext = React2.createContext(null);
|
|
6375
6594
|
function ScrollContainerProvider({
|
|
6376
|
-
value,
|
|
6595
|
+
value: value2,
|
|
6377
6596
|
children
|
|
6378
6597
|
}) {
|
|
6379
|
-
return /* @__PURE__ */ jsx2(ScrollContainerContext.Provider, { value, children });
|
|
6598
|
+
return /* @__PURE__ */ jsx2(ScrollContainerContext.Provider, { value: value2, children });
|
|
6380
6599
|
}
|
|
6381
6600
|
function useScrollContainerRef() {
|
|
6382
|
-
const
|
|
6383
|
-
if (!
|
|
6601
|
+
const ref2 = React2.useContext(ScrollContainerContext);
|
|
6602
|
+
if (!ref2) {
|
|
6384
6603
|
throw new Error(
|
|
6385
6604
|
"useScrollContainerRef must be used inside <ScrollContainerProvider> (mounted by FourtyProvider)."
|
|
6386
6605
|
);
|
|
6387
6606
|
}
|
|
6388
|
-
return
|
|
6607
|
+
return ref2;
|
|
6389
6608
|
}
|
|
6390
6609
|
|
|
6391
6610
|
// src/shell/ShellRegistry.tsx
|
|
@@ -6406,8 +6625,8 @@ function useShellRegistry() {
|
|
|
6406
6625
|
import { createContext as createContext5, useContext as useContext5 } from "react";
|
|
6407
6626
|
var ShellRootContext = createContext5(null);
|
|
6408
6627
|
function useShellRoot() {
|
|
6409
|
-
const
|
|
6410
|
-
return
|
|
6628
|
+
const ref2 = useContext5(ShellRootContext);
|
|
6629
|
+
return ref2 ? ref2.current : null;
|
|
6411
6630
|
}
|
|
6412
6631
|
|
|
6413
6632
|
// src/shell/dock-persistence.tsx
|
|
@@ -6419,10 +6638,10 @@ var DockPersistenceContext = React4.createContext({
|
|
|
6419
6638
|
}
|
|
6420
6639
|
});
|
|
6421
6640
|
function DockPersistenceProvider({
|
|
6422
|
-
value,
|
|
6641
|
+
value: value2,
|
|
6423
6642
|
children
|
|
6424
6643
|
}) {
|
|
6425
|
-
return /* @__PURE__ */ jsx4(DockPersistenceContext.Provider, { value, children });
|
|
6644
|
+
return /* @__PURE__ */ jsx4(DockPersistenceContext.Provider, { value: value2, children });
|
|
6426
6645
|
}
|
|
6427
6646
|
function useDockPersistence() {
|
|
6428
6647
|
return React4.useContext(DockPersistenceContext);
|
|
@@ -6433,10 +6652,10 @@ import React5 from "react";
|
|
|
6433
6652
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
6434
6653
|
var BotCheckNoticeContext = React5.createContext(null);
|
|
6435
6654
|
function BotCheckNoticeProvider({
|
|
6436
|
-
value,
|
|
6655
|
+
value: value2,
|
|
6437
6656
|
children
|
|
6438
6657
|
}) {
|
|
6439
|
-
return /* @__PURE__ */ jsx5(BotCheckNoticeContext.Provider, { value, children });
|
|
6658
|
+
return /* @__PURE__ */ jsx5(BotCheckNoticeContext.Provider, { value: value2, children });
|
|
6440
6659
|
}
|
|
6441
6660
|
function useBotCheckNotice() {
|
|
6442
6661
|
return React5.useContext(BotCheckNoticeContext);
|
|
@@ -6491,6 +6710,9 @@ function useSessionId() {
|
|
|
6491
6710
|
function useSessionMessages() {
|
|
6492
6711
|
return useFourtyRuntime().useSessionMessages();
|
|
6493
6712
|
}
|
|
6713
|
+
function useSeedLayout() {
|
|
6714
|
+
return useFourtyRuntime().useSeedLayout();
|
|
6715
|
+
}
|
|
6494
6716
|
function useFacts() {
|
|
6495
6717
|
return useFourtyRuntime().useFacts();
|
|
6496
6718
|
}
|
|
@@ -6569,14 +6791,14 @@ function useHydrated() {
|
|
|
6569
6791
|
import React7 from "react";
|
|
6570
6792
|
function useOverridableToggle(defaultValue) {
|
|
6571
6793
|
const [override, setOverride] = React7.useState(null);
|
|
6572
|
-
const
|
|
6794
|
+
const value2 = override === null ? defaultValue : override;
|
|
6573
6795
|
const set = React7.useCallback((next) => {
|
|
6574
6796
|
setOverride(next);
|
|
6575
6797
|
}, []);
|
|
6576
6798
|
const toggle = () => {
|
|
6577
|
-
setOverride(!
|
|
6799
|
+
setOverride(!value2);
|
|
6578
6800
|
};
|
|
6579
|
-
return { value, toggle, set };
|
|
6801
|
+
return { value: value2, toggle, set };
|
|
6580
6802
|
}
|
|
6581
6803
|
|
|
6582
6804
|
// src/shell/use-dock-state.ts
|
|
@@ -6706,7 +6928,7 @@ function useComposerAttachments() {
|
|
|
6706
6928
|
failure: null
|
|
6707
6929
|
});
|
|
6708
6930
|
session.uploadAttachment(file).then(
|
|
6709
|
-
(
|
|
6931
|
+
(ref2) => update2(localId, { status: "ready", ref: ref2 }),
|
|
6710
6932
|
(err) => update2(localId, { status: "error", failure: failureOf(err) })
|
|
6711
6933
|
);
|
|
6712
6934
|
},
|
|
@@ -6785,10 +7007,10 @@ function useComposerAttachments() {
|
|
|
6785
7007
|
import * as React11 from "react";
|
|
6786
7008
|
|
|
6787
7009
|
// src/voice/use-voice-capture.ts
|
|
6788
|
-
import { useCallback as
|
|
7010
|
+
import { useCallback as useCallback5, useEffect as useEffect4, useRef as useRef4, useState as useState3 } from "react";
|
|
6789
7011
|
|
|
6790
7012
|
// src/voice/use-dictation.ts
|
|
6791
|
-
import { useCallback as
|
|
7013
|
+
import { useCallback as useCallback4, useEffect as useEffect3, useRef as useRef3, useState as useState2 } from "react";
|
|
6792
7014
|
function resolveSpeechRecognitionCtor() {
|
|
6793
7015
|
if (typeof globalThis.SpeechRecognition === "function") {
|
|
6794
7016
|
return globalThis.SpeechRecognition;
|
|
@@ -6818,7 +7040,7 @@ function useDictation(options) {
|
|
|
6818
7040
|
useEffect3(() => {
|
|
6819
7041
|
setSupported(resolveSpeechRecognitionCtor() !== null);
|
|
6820
7042
|
}, []);
|
|
6821
|
-
const start =
|
|
7043
|
+
const start = useCallback4(() => {
|
|
6822
7044
|
if (recognitionRef.current !== null) return;
|
|
6823
7045
|
const Ctor = resolveSpeechRecognitionCtor();
|
|
6824
7046
|
if (Ctor === null) return;
|
|
@@ -6889,7 +7111,7 @@ function useDictation(options) {
|
|
|
6889
7111
|
setListening(true);
|
|
6890
7112
|
setPermissionDenied(false);
|
|
6891
7113
|
}, []);
|
|
6892
|
-
const stop =
|
|
7114
|
+
const stop = useCallback4(() => {
|
|
6893
7115
|
intentRef.current = false;
|
|
6894
7116
|
const recognition = recognitionRef.current;
|
|
6895
7117
|
if (recognition !== null) {
|
|
@@ -6898,7 +7120,7 @@ function useDictation(options) {
|
|
|
6898
7120
|
recognition.stop();
|
|
6899
7121
|
}
|
|
6900
7122
|
}, []);
|
|
6901
|
-
const toggle =
|
|
7123
|
+
const toggle = useCallback4(() => {
|
|
6902
7124
|
if (recognitionRef.current !== null) {
|
|
6903
7125
|
stop();
|
|
6904
7126
|
} else {
|
|
@@ -6935,7 +7157,7 @@ function useVoiceCapture(options) {
|
|
|
6935
7157
|
const commitRef = useRef4(() => {
|
|
6936
7158
|
});
|
|
6937
7159
|
const wakeLockRef = useRef4(null);
|
|
6938
|
-
const releaseWakeLock =
|
|
7160
|
+
const releaseWakeLock = useCallback5(() => {
|
|
6939
7161
|
const sentinel = wakeLockRef.current;
|
|
6940
7162
|
if (sentinel === null) return;
|
|
6941
7163
|
wakeLockRef.current = null;
|
|
@@ -6943,7 +7165,7 @@ function useVoiceCapture(options) {
|
|
|
6943
7165
|
console.warn("[useVoiceCapture] failed to release the screen wake lock:", err);
|
|
6944
7166
|
});
|
|
6945
7167
|
}, []);
|
|
6946
|
-
const acquireWakeLock =
|
|
7168
|
+
const acquireWakeLock = useCallback5(() => {
|
|
6947
7169
|
if (typeof navigator === "undefined" || !("wakeLock" in navigator)) return;
|
|
6948
7170
|
releaseWakeLock();
|
|
6949
7171
|
navigator.wakeLock.request("screen").then(
|
|
@@ -6955,13 +7177,13 @@ function useVoiceCapture(options) {
|
|
|
6955
7177
|
}
|
|
6956
7178
|
);
|
|
6957
7179
|
}, [releaseWakeLock]);
|
|
6958
|
-
const clearSilenceTimer =
|
|
7180
|
+
const clearSilenceTimer = useCallback5(() => {
|
|
6959
7181
|
if (silenceTimerRef.current !== null) {
|
|
6960
7182
|
clearTimeout(silenceTimerRef.current);
|
|
6961
7183
|
silenceTimerRef.current = null;
|
|
6962
7184
|
}
|
|
6963
7185
|
}, []);
|
|
6964
|
-
const reset =
|
|
7186
|
+
const reset = useCallback5(() => {
|
|
6965
7187
|
stateRef.current = "idle";
|
|
6966
7188
|
clearSilenceTimer();
|
|
6967
7189
|
releaseWakeLock();
|
|
@@ -6969,7 +7191,7 @@ function useVoiceCapture(options) {
|
|
|
6969
7191
|
setTranscript("");
|
|
6970
7192
|
setState("idle");
|
|
6971
7193
|
}, [clearSilenceTimer, releaseWakeLock]);
|
|
6972
|
-
const handleResult =
|
|
7194
|
+
const handleResult = useCallback5(
|
|
6973
7195
|
(next) => {
|
|
6974
7196
|
if (stateRef.current !== "listening") return;
|
|
6975
7197
|
transcriptRef.current = next;
|
|
@@ -6985,7 +7207,7 @@ function useVoiceCapture(options) {
|
|
|
6985
7207
|
const dictation = useDictation({ onResult: handleResult, lang });
|
|
6986
7208
|
const dictationRef = useRef4(dictation);
|
|
6987
7209
|
dictationRef.current = dictation;
|
|
6988
|
-
const commit =
|
|
7210
|
+
const commit = useCallback5(() => {
|
|
6989
7211
|
if (stateRef.current !== "listening") return;
|
|
6990
7212
|
const text2 = transcriptRef.current.trim();
|
|
6991
7213
|
reset();
|
|
@@ -6993,11 +7215,11 @@ function useVoiceCapture(options) {
|
|
|
6993
7215
|
if (text2.length > 0) onCommitRef.current(text2);
|
|
6994
7216
|
}, [reset]);
|
|
6995
7217
|
commitRef.current = commit;
|
|
6996
|
-
const cancel =
|
|
7218
|
+
const cancel = useCallback5(() => {
|
|
6997
7219
|
reset();
|
|
6998
7220
|
dictationRef.current.stop();
|
|
6999
7221
|
}, [reset]);
|
|
7000
|
-
const start =
|
|
7222
|
+
const start = useCallback5(() => {
|
|
7001
7223
|
if (!dictationRef.current.supported || stateRef.current === "listening") return;
|
|
7002
7224
|
stateRef.current = "listening";
|
|
7003
7225
|
transcriptRef.current = "";
|
|
@@ -7006,7 +7228,7 @@ function useVoiceCapture(options) {
|
|
|
7006
7228
|
acquireWakeLock();
|
|
7007
7229
|
dictationRef.current.start();
|
|
7008
7230
|
}, [acquireWakeLock]);
|
|
7009
|
-
const toggle =
|
|
7231
|
+
const toggle = useCallback5(() => {
|
|
7010
7232
|
if (stateRef.current === "listening") commit();
|
|
7011
7233
|
else start();
|
|
7012
7234
|
}, [commit, start]);
|
|
@@ -7053,11 +7275,11 @@ var ORIGIN_TTL_MS = 3e3;
|
|
|
7053
7275
|
var noted = null;
|
|
7054
7276
|
var notedAt = 0;
|
|
7055
7277
|
var expiry = null;
|
|
7056
|
-
var
|
|
7057
|
-
var
|
|
7278
|
+
var listeners2 = /* @__PURE__ */ new Set();
|
|
7279
|
+
var notify2 = () => listeners2.forEach((l) => l());
|
|
7058
7280
|
var sameWords = (a, b) => a.replace(/\s+/g, " ").trim() === b.replace(/\s+/g, " ").trim();
|
|
7059
|
-
var px = (
|
|
7060
|
-
const n = Number.parseFloat(
|
|
7281
|
+
var px = (value2, fallback) => {
|
|
7282
|
+
const n = Number.parseFloat(value2);
|
|
7061
7283
|
return Number.isFinite(n) ? n : fallback;
|
|
7062
7284
|
};
|
|
7063
7285
|
function noteSubmitOrigin(text2, el) {
|
|
@@ -7081,9 +7303,9 @@ function noteSubmitOrigin(text2, el) {
|
|
|
7081
7303
|
expiry = setTimeout(() => {
|
|
7082
7304
|
noted = null;
|
|
7083
7305
|
expiry = null;
|
|
7084
|
-
|
|
7306
|
+
notify2();
|
|
7085
7307
|
}, ORIGIN_TTL_MS);
|
|
7086
|
-
|
|
7308
|
+
notify2();
|
|
7087
7309
|
}
|
|
7088
7310
|
function takeSubmitOrigin(text2) {
|
|
7089
7311
|
const origin = noted;
|
|
@@ -7091,12 +7313,12 @@ function takeSubmitOrigin(text2) {
|
|
|
7091
7313
|
noted = null;
|
|
7092
7314
|
if (expiry !== null) clearTimeout(expiry);
|
|
7093
7315
|
expiry = null;
|
|
7094
|
-
|
|
7316
|
+
notify2();
|
|
7095
7317
|
return origin;
|
|
7096
7318
|
}
|
|
7097
7319
|
function subscribe(listener) {
|
|
7098
|
-
|
|
7099
|
-
return () =>
|
|
7320
|
+
listeners2.add(listener);
|
|
7321
|
+
return () => listeners2.delete(listener);
|
|
7100
7322
|
}
|
|
7101
7323
|
function useWaitingSubmitOrigin() {
|
|
7102
7324
|
return React10.useSyncExternalStore(subscribe, () => noted, () => null);
|
|
@@ -7108,7 +7330,7 @@ function usePromptComposer(options = {}) {
|
|
|
7108
7330
|
const session = useFourtySession();
|
|
7109
7331
|
const internalAttach = useComposerAttachments();
|
|
7110
7332
|
const attach = attachmentsController !== void 0 ? attachmentsController : internalAttach;
|
|
7111
|
-
const [
|
|
7333
|
+
const [value2, setValue] = useComposerDraft();
|
|
7112
7334
|
const dictationBaseRef = React11.useRef("");
|
|
7113
7335
|
const handleDictationResult = React11.useCallback((transcript) => {
|
|
7114
7336
|
const base = dictationBaseRef.current;
|
|
@@ -7120,8 +7342,8 @@ function usePromptComposer(options = {}) {
|
|
|
7120
7342
|
onResult: handleDictationResult,
|
|
7121
7343
|
onCommit: () => submitRef.current()
|
|
7122
7344
|
});
|
|
7123
|
-
const valueRef = React11.useRef(
|
|
7124
|
-
valueRef.current =
|
|
7345
|
+
const valueRef = React11.useRef(value2);
|
|
7346
|
+
valueRef.current = value2;
|
|
7125
7347
|
const toggleDictation = React11.useCallback(() => {
|
|
7126
7348
|
if (voiceCapture.state !== "listening") {
|
|
7127
7349
|
dictationBaseRef.current = valueRef.current;
|
|
@@ -7138,23 +7360,23 @@ function usePromptComposer(options = {}) {
|
|
|
7138
7360
|
},
|
|
7139
7361
|
[attach]
|
|
7140
7362
|
);
|
|
7141
|
-
const canSend = (
|
|
7363
|
+
const canSend = (value2.trim().length > 0 || attach.readyRefs.length > 0) && !attach.hasPending;
|
|
7142
7364
|
const submit = React11.useCallback(() => {
|
|
7143
|
-
if (!((
|
|
7365
|
+
if (!((value2.trim().length > 0 || attach.readyRefs.length > 0) && !attach.hasPending)) return;
|
|
7144
7366
|
voiceCapture.cancel();
|
|
7145
7367
|
const originEl = origin === void 0 ? null : origin.current;
|
|
7146
|
-
if (originEl !== null &&
|
|
7147
|
-
const text2 =
|
|
7368
|
+
if (originEl !== null && value2.trim().length > 0) noteSubmitOrigin(value2, originEl);
|
|
7369
|
+
const text2 = value2;
|
|
7148
7370
|
const options2 = attach.readyRefs.length > 0 ? { attachments: attach.readyRefs } : void 0;
|
|
7149
7371
|
setValue("");
|
|
7150
7372
|
attach.clear();
|
|
7151
7373
|
requestAnimationFrame(() => {
|
|
7152
7374
|
setTimeout(() => session.sendMessage(text2, options2), 0);
|
|
7153
7375
|
});
|
|
7154
|
-
}, [session,
|
|
7376
|
+
}, [session, value2, attach, setValue, voiceCapture, origin]);
|
|
7155
7377
|
submitRef.current = submit;
|
|
7156
7378
|
return {
|
|
7157
|
-
value,
|
|
7379
|
+
value: value2,
|
|
7158
7380
|
setValue,
|
|
7159
7381
|
attachments: attach,
|
|
7160
7382
|
dictation: {
|
|
@@ -7289,7 +7511,7 @@ function useThreadRows() {
|
|
|
7289
7511
|
ask: pending2.streams.ask
|
|
7290
7512
|
});
|
|
7291
7513
|
}
|
|
7292
|
-
const
|
|
7514
|
+
const sessionId = useSessionId();
|
|
7293
7515
|
const settled = sessionId !== null;
|
|
7294
7516
|
return { rows, isEmpty: hydrated && settled && messages.length === 0 && pending2 === null };
|
|
7295
7517
|
}
|
|
@@ -7302,18 +7524,18 @@ import * as React17 from "react";
|
|
|
7302
7524
|
function useIsSeedHome() {
|
|
7303
7525
|
const layout = useDisplayedLayout();
|
|
7304
7526
|
const turn = useTurn();
|
|
7305
|
-
const
|
|
7527
|
+
const seedLayout = useSeedLayout();
|
|
7306
7528
|
return React17.useMemo(() => {
|
|
7307
|
-
if (
|
|
7529
|
+
if (seedLayout === null) return false;
|
|
7308
7530
|
if (turn.index !== 0) return false;
|
|
7309
7531
|
if (turn.userMessage !== "") return false;
|
|
7310
7532
|
try {
|
|
7311
|
-
return JSON.stringify(layout) === JSON.stringify(
|
|
7533
|
+
return JSON.stringify(layout) === JSON.stringify(seedLayout);
|
|
7312
7534
|
} catch (err) {
|
|
7313
7535
|
console.warn("[useIsSeedHome] could not compare the layout with the seed \u2014 treating it as not home", err);
|
|
7314
7536
|
return false;
|
|
7315
7537
|
}
|
|
7316
|
-
}, [layout,
|
|
7538
|
+
}, [layout, seedLayout, turn.index, turn.userMessage]);
|
|
7317
7539
|
}
|
|
7318
7540
|
|
|
7319
7541
|
// src/shell/conversation/answer-text.ts
|
|
@@ -7341,8 +7563,8 @@ function withoutClosingQuestion(body) {
|
|
|
7341
7563
|
}
|
|
7342
7564
|
|
|
7343
7565
|
// src/canvas/turn-edit.ts
|
|
7344
|
-
function isRecord2(
|
|
7345
|
-
return typeof
|
|
7566
|
+
function isRecord2(value2) {
|
|
7567
|
+
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
|
|
7346
7568
|
}
|
|
7347
7569
|
function sameValue(a, b) {
|
|
7348
7570
|
if (a === b) return true;
|
|
@@ -7421,29 +7643,29 @@ function recordsOf(output) {
|
|
|
7421
7643
|
const parsed = parse(output);
|
|
7422
7644
|
if (typeof parsed !== "object" || parsed === null) return void 0;
|
|
7423
7645
|
for (const key of SCAN_RECORD_KEYS) {
|
|
7424
|
-
const
|
|
7425
|
-
if (!Array.isArray(
|
|
7426
|
-
return
|
|
7646
|
+
const value2 = Reflect.get(parsed, key);
|
|
7647
|
+
if (!Array.isArray(value2)) continue;
|
|
7648
|
+
return value2.filter((item) => typeof item === "object" && item !== null);
|
|
7427
7649
|
}
|
|
7428
7650
|
return void 0;
|
|
7429
7651
|
}
|
|
7430
7652
|
function imageOf(record2) {
|
|
7431
7653
|
for (const key of SCAN_IMAGE_KEYS) {
|
|
7432
|
-
const
|
|
7433
|
-
if (typeof
|
|
7654
|
+
const value2 = Reflect.get(record2, key);
|
|
7655
|
+
if (typeof value2 === "string" && value2.length > 0) return value2;
|
|
7434
7656
|
}
|
|
7435
7657
|
return void 0;
|
|
7436
7658
|
}
|
|
7437
7659
|
function metaOf(record2) {
|
|
7438
7660
|
const meta = {};
|
|
7439
|
-
for (const [key,
|
|
7661
|
+
for (const [key, value2] of Object.entries(record2)) {
|
|
7440
7662
|
if (key === "id" || key.startsWith("__") || SCAN_IMAGE_KEYS.includes(key)) continue;
|
|
7441
|
-
if (typeof
|
|
7442
|
-
meta[key] =
|
|
7663
|
+
if (typeof value2 === "number" || typeof value2 === "boolean") {
|
|
7664
|
+
meta[key] = value2;
|
|
7443
7665
|
continue;
|
|
7444
7666
|
}
|
|
7445
|
-
if (typeof
|
|
7446
|
-
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);
|
|
7447
7669
|
}
|
|
7448
7670
|
}
|
|
7449
7671
|
return Object.keys(meta).length > 0 ? meta : void 0;
|
|
@@ -7452,12 +7674,12 @@ function refOf(record2) {
|
|
|
7452
7674
|
if (typeof record2 !== "object" || record2 === null) return void 0;
|
|
7453
7675
|
const id = Reflect.get(record2, "id");
|
|
7454
7676
|
if (typeof id !== "string" || id.length === 0) return void 0;
|
|
7455
|
-
const
|
|
7677
|
+
const ref2 = { id };
|
|
7456
7678
|
const imageUrl = imageOf(record2);
|
|
7457
|
-
if (imageUrl !== void 0)
|
|
7679
|
+
if (imageUrl !== void 0) ref2.imageUrl = imageUrl;
|
|
7458
7680
|
const meta = metaOf(record2);
|
|
7459
|
-
if (meta !== void 0)
|
|
7460
|
-
return
|
|
7681
|
+
if (meta !== void 0) ref2.meta = meta;
|
|
7682
|
+
return ref2;
|
|
7461
7683
|
}
|
|
7462
7684
|
function pendingSourceElement(input) {
|
|
7463
7685
|
return {
|
|
@@ -7475,8 +7697,8 @@ function deriveSourceElement(input) {
|
|
|
7475
7697
|
if (records === void 0) return void 0;
|
|
7476
7698
|
const refs = [];
|
|
7477
7699
|
for (const record2 of records) {
|
|
7478
|
-
const
|
|
7479
|
-
if (
|
|
7700
|
+
const ref2 = refOf(record2);
|
|
7701
|
+
if (ref2 !== void 0) refs.push(ref2);
|
|
7480
7702
|
}
|
|
7481
7703
|
const element = {
|
|
7482
7704
|
id: input.id,
|
|
@@ -7523,9 +7745,9 @@ function projectSourceOutput(output) {
|
|
|
7523
7745
|
}
|
|
7524
7746
|
|
|
7525
7747
|
// ../spacestation/src/widgets/presence/element.ts
|
|
7526
|
-
function isPresenceStreamArtifact(
|
|
7527
|
-
if (typeof
|
|
7528
|
-
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"));
|
|
7529
7751
|
}
|
|
7530
7752
|
var PRESENCE_LIFECYCLE = {
|
|
7531
7753
|
// Two-stage, and the two stages are MARK then PRUNE:
|
|
@@ -7546,8 +7768,8 @@ var PRESENCE_LIFECYCLE = {
|
|
|
7546
7768
|
};
|
|
7547
7769
|
|
|
7548
7770
|
// ../spacestation/src/widgets/presence/profile.ts
|
|
7549
|
-
import { z as
|
|
7550
|
-
var PresenceProfileSchema =
|
|
7771
|
+
import { z as z50 } from "zod";
|
|
7772
|
+
var PresenceProfileSchema = z50.object({
|
|
7551
7773
|
/**
|
|
7552
7774
|
* How much the agent SPEAKS in presence.
|
|
7553
7775
|
* - 'off' the faculty generates no prose at all. Zero tokens, and
|
|
@@ -7557,14 +7779,14 @@ var PresenceProfileSchema = z49.object({
|
|
|
7557
7779
|
* - 'terse' one lead line per turn. The default — see below.
|
|
7558
7780
|
* - 'full' a lead line plus asides beside individual elements.
|
|
7559
7781
|
*/
|
|
7560
|
-
voice:
|
|
7782
|
+
voice: z50.enum(["off", "terse", "full"]),
|
|
7561
7783
|
/**
|
|
7562
7784
|
* Which source kinds this space surfaces. 'all' = every tool that declares a
|
|
7563
7785
|
* `sourceKind`. An explicit list lets a space stay quiet about lookups its
|
|
7564
7786
|
* visitors would find uninteresting (policy checks on a fashion space)
|
|
7565
7787
|
* without the tool having to lie about what it is.
|
|
7566
7788
|
*/
|
|
7567
|
-
sources:
|
|
7789
|
+
sources: z50.union([z50.array(z50.string()), z50.literal("all")]),
|
|
7568
7790
|
/**
|
|
7569
7791
|
* Which facts render.
|
|
7570
7792
|
* - 'inferred-only' hides `provenance: 'stated'` facts. The default and the
|
|
@@ -7573,7 +7795,7 @@ var PresenceProfileSchema = z49.object({
|
|
|
7573
7795
|
* - 'all' shows stated facts too — for spaces where confirming the brief
|
|
7574
7796
|
* back is itself the product (intake, configuration).
|
|
7575
7797
|
*/
|
|
7576
|
-
facts:
|
|
7798
|
+
facts: z50.enum(["inferred-only", "all"])
|
|
7577
7799
|
});
|
|
7578
7800
|
var DEFAULT_PRESENCE_PROFILE = {
|
|
7579
7801
|
voice: "terse",
|
|
@@ -7609,7 +7831,7 @@ function usePresenceLiveTurn() {
|
|
|
7609
7831
|
}
|
|
7610
7832
|
|
|
7611
7833
|
// src/widgets/presence/flows/flow-store.ts
|
|
7612
|
-
import { useSyncExternalStore as
|
|
7834
|
+
import { useSyncExternalStore as useSyncExternalStore4 } from "react";
|
|
7613
7835
|
|
|
7614
7836
|
// src/utils/storage.ts
|
|
7615
7837
|
var opened = /* @__PURE__ */ new Map();
|
|
@@ -7622,7 +7844,7 @@ function openWebStorage(kind) {
|
|
|
7622
7844
|
if (storage3 === null) throw new Error(`window.${kind} is null (DOM storage disabled)`);
|
|
7623
7845
|
adapter = {
|
|
7624
7846
|
get: (key) => storage3.getItem(key),
|
|
7625
|
-
set: (key,
|
|
7847
|
+
set: (key, value2) => storage3.setItem(key, value2),
|
|
7626
7848
|
remove: (key) => storage3.removeItem(key)
|
|
7627
7849
|
};
|
|
7628
7850
|
} catch (err) {
|
|
@@ -7638,9 +7860,9 @@ function createWebStorageAdapter(kind) {
|
|
|
7638
7860
|
if (typeof window === "undefined") return null;
|
|
7639
7861
|
return openWebStorage(kind).get(key);
|
|
7640
7862
|
},
|
|
7641
|
-
set(key,
|
|
7863
|
+
set(key, value2) {
|
|
7642
7864
|
if (typeof window === "undefined") return;
|
|
7643
|
-
openWebStorage(kind).set(key,
|
|
7865
|
+
openWebStorage(kind).set(key, value2);
|
|
7644
7866
|
},
|
|
7645
7867
|
remove(key) {
|
|
7646
7868
|
if (typeof window === "undefined") return;
|
|
@@ -7660,8 +7882,8 @@ function createMemoryStorageAdapter() {
|
|
|
7660
7882
|
get(key) {
|
|
7661
7883
|
return store.get(key) ?? null;
|
|
7662
7884
|
},
|
|
7663
|
-
set(key,
|
|
7664
|
-
store.set(key,
|
|
7885
|
+
set(key, value2) {
|
|
7886
|
+
store.set(key, value2);
|
|
7665
7887
|
},
|
|
7666
7888
|
remove(key) {
|
|
7667
7889
|
store.delete(key);
|
|
@@ -7699,14 +7921,14 @@ function load() {
|
|
|
7699
7921
|
}
|
|
7700
7922
|
var outputs = load();
|
|
7701
7923
|
var freshIds = /* @__PURE__ */ new Set();
|
|
7702
|
-
var
|
|
7703
|
-
function
|
|
7704
|
-
for (const listener of
|
|
7924
|
+
var listeners3 = /* @__PURE__ */ new Set();
|
|
7925
|
+
function notify3() {
|
|
7926
|
+
for (const listener of listeners3) listener();
|
|
7705
7927
|
}
|
|
7706
7928
|
function subscribe2(listener) {
|
|
7707
|
-
|
|
7929
|
+
listeners3.add(listener);
|
|
7708
7930
|
return () => {
|
|
7709
|
-
|
|
7931
|
+
listeners3.delete(listener);
|
|
7710
7932
|
};
|
|
7711
7933
|
}
|
|
7712
7934
|
function persist() {
|
|
@@ -7717,7 +7939,7 @@ function setFlowOutput(flowId, data) {
|
|
|
7717
7939
|
outputs = { ...outputs, [flowId]: data };
|
|
7718
7940
|
freshIds.add(flowId);
|
|
7719
7941
|
persist();
|
|
7720
|
-
|
|
7942
|
+
notify3();
|
|
7721
7943
|
}
|
|
7722
7944
|
function getFlowOutput(flowId) {
|
|
7723
7945
|
return Object.prototype.hasOwnProperty.call(outputs, flowId) ? outputs[flowId] : null;
|
|
@@ -7726,14 +7948,14 @@ function subscribeFlowOutputs(listener) {
|
|
|
7726
7948
|
return subscribe2(listener);
|
|
7727
7949
|
}
|
|
7728
7950
|
function useAgentFlow(flowId) {
|
|
7729
|
-
return
|
|
7951
|
+
return useSyncExternalStore4(
|
|
7730
7952
|
subscribe2,
|
|
7731
7953
|
() => Object.prototype.hasOwnProperty.call(outputs, flowId) ? outputs[flowId] : null,
|
|
7732
7954
|
() => null
|
|
7733
7955
|
);
|
|
7734
7956
|
}
|
|
7735
7957
|
function useAgentFlowFresh(flowId) {
|
|
7736
|
-
return
|
|
7958
|
+
return useSyncExternalStore4(
|
|
7737
7959
|
subscribe2,
|
|
7738
7960
|
() => freshIds.has(flowId),
|
|
7739
7961
|
() => false
|
|
@@ -7744,7 +7966,7 @@ if (typeof window !== "undefined") {
|
|
|
7744
7966
|
outputs = {};
|
|
7745
7967
|
freshIds.clear();
|
|
7746
7968
|
persist();
|
|
7747
|
-
|
|
7969
|
+
notify3();
|
|
7748
7970
|
});
|
|
7749
7971
|
}
|
|
7750
7972
|
|
|
@@ -7767,7 +7989,7 @@ function useAgentPresenceFresh(flowId = PRESENCE_FLOW) {
|
|
|
7767
7989
|
}
|
|
7768
7990
|
|
|
7769
7991
|
// src/widgets/presence/use-layout-entity-ids.ts
|
|
7770
|
-
import { useMemo as
|
|
7992
|
+
import { useMemo as useMemo6 } from "react";
|
|
7771
7993
|
|
|
7772
7994
|
// src/catalog/CatalogContext.tsx
|
|
7773
7995
|
import { createContext as createContext9, useContext as useContext9 } from "react";
|
|
@@ -7788,7 +8010,7 @@ function collectLayoutGids(layout, catalog) {
|
|
|
7788
8010
|
const refs = /* @__PURE__ */ new Set();
|
|
7789
8011
|
if (!layout || !layout.elements) return refs;
|
|
7790
8012
|
for (const el of Object.values(layout.elements)) {
|
|
7791
|
-
for (const
|
|
8013
|
+
for (const ref2 of collectElementEntityRefs(el, catalog)) refs.add(ref2);
|
|
7792
8014
|
}
|
|
7793
8015
|
return refs;
|
|
7794
8016
|
}
|
|
@@ -7797,7 +8019,7 @@ function collectLayoutGids(layout, catalog) {
|
|
|
7797
8019
|
function useLayoutEntityIds() {
|
|
7798
8020
|
const layout = useLayout();
|
|
7799
8021
|
const catalog = useComponentCatalog();
|
|
7800
|
-
return
|
|
8022
|
+
return useMemo6(() => [...collectLayoutGids(layout, catalog)], [layout, catalog]);
|
|
7801
8023
|
}
|
|
7802
8024
|
|
|
7803
8025
|
// src/widgets/presence/use-presence.ts
|
|
@@ -7916,9 +8138,9 @@ function readEntries(data) {
|
|
|
7916
8138
|
const out = [];
|
|
7917
8139
|
for (const e of raw) {
|
|
7918
8140
|
if (typeof e !== "object" || e === null) continue;
|
|
7919
|
-
const
|
|
7920
|
-
const
|
|
7921
|
-
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 });
|
|
7922
8144
|
}
|
|
7923
8145
|
return out;
|
|
7924
8146
|
}
|
|
@@ -7985,7 +8207,7 @@ function useConversationPage() {
|
|
|
7985
8207
|
const currentIndex = useCurrentMessageIndex();
|
|
7986
8208
|
const pending2 = usePendingMessage();
|
|
7987
8209
|
const layout = useDisplayedLayout();
|
|
7988
|
-
const
|
|
8210
|
+
const seedLayout = useSeedLayout();
|
|
7989
8211
|
const onSeedHome = useIsSeedHome();
|
|
7990
8212
|
const selectMessage = useSelectMessage();
|
|
7991
8213
|
const goHome = useGoHome();
|
|
@@ -8378,10 +8600,10 @@ var AGENT_ASK_SIGNAL = "agent_ask";
|
|
|
8378
8600
|
import React26 from "react";
|
|
8379
8601
|
|
|
8380
8602
|
// src/shared/use-expandable.ts
|
|
8381
|
-
import { useCallback as
|
|
8603
|
+
import { useCallback as useCallback12, useState as useState5 } from "react";
|
|
8382
8604
|
function useExpandable(initial = false) {
|
|
8383
8605
|
const [expanded, setExpanded] = useState5(initial);
|
|
8384
|
-
const toggle =
|
|
8606
|
+
const toggle = useCallback12(() => setExpanded((p) => !p), []);
|
|
8385
8607
|
return { expanded, toggle, setExpanded };
|
|
8386
8608
|
}
|
|
8387
8609
|
|
|
@@ -8389,9 +8611,9 @@ function useExpandable(initial = false) {
|
|
|
8389
8611
|
function useClampToggle(contentKey) {
|
|
8390
8612
|
const { expanded, toggle } = useExpandable(false);
|
|
8391
8613
|
const [overflowing, setOverflowing] = React26.useState(false);
|
|
8392
|
-
const
|
|
8614
|
+
const ref2 = React26.useRef(null);
|
|
8393
8615
|
React26.useEffect(() => {
|
|
8394
|
-
const el =
|
|
8616
|
+
const el = ref2.current;
|
|
8395
8617
|
if (el === null) return;
|
|
8396
8618
|
if (expanded) return;
|
|
8397
8619
|
const measure = () => {
|
|
@@ -8402,7 +8624,7 @@ function useClampToggle(contentKey) {
|
|
|
8402
8624
|
ro.observe(el);
|
|
8403
8625
|
return () => ro.disconnect();
|
|
8404
8626
|
}, [expanded, contentKey]);
|
|
8405
|
-
return { expanded, toggle, overflowing, ref };
|
|
8627
|
+
return { expanded, toggle, overflowing, ref: ref2 };
|
|
8406
8628
|
}
|
|
8407
8629
|
|
|
8408
8630
|
// src/provider/use-timed-flag.ts
|
|
@@ -8521,6 +8743,7 @@ __export(canvas_exports, {
|
|
|
8521
8743
|
usePendingMessage: () => usePendingMessage,
|
|
8522
8744
|
useReasoning: () => useReasoning,
|
|
8523
8745
|
useSafeFacts: () => useSafeFacts,
|
|
8746
|
+
useSeedLayout: () => useSeedLayout,
|
|
8524
8747
|
useSelectMessage: () => useSelectMessage,
|
|
8525
8748
|
useSessionId: () => useSessionId,
|
|
8526
8749
|
useSessionMessages: () => useSessionMessages,
|
|
@@ -8619,11 +8842,11 @@ import { jsx as jsx11 } from "react/jsx-runtime";
|
|
|
8619
8842
|
function FadeGroup({ children }) {
|
|
8620
8843
|
return /* @__PURE__ */ jsx11(AnimatePresence, { mode: "popLayout", initial: false, children });
|
|
8621
8844
|
}
|
|
8622
|
-
var FadeItem = React29.forwardRef(function FadeItem2({ id, children, style, className },
|
|
8845
|
+
var FadeItem = React29.forwardRef(function FadeItem2({ id, children, style, className }, ref2) {
|
|
8623
8846
|
return /* @__PURE__ */ jsx11(
|
|
8624
8847
|
motion2.div,
|
|
8625
8848
|
{
|
|
8626
|
-
ref,
|
|
8849
|
+
ref: ref2,
|
|
8627
8850
|
style,
|
|
8628
8851
|
className,
|
|
8629
8852
|
children
|
|
@@ -8656,8 +8879,8 @@ function CanvasArrangementProvider({
|
|
|
8656
8879
|
stackedTurns = false,
|
|
8657
8880
|
children
|
|
8658
8881
|
}) {
|
|
8659
|
-
const
|
|
8660
|
-
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 });
|
|
8661
8884
|
}
|
|
8662
8885
|
function useCanvasArrangement() {
|
|
8663
8886
|
return useContext14(CanvasArrangementContext);
|
|
@@ -8674,15 +8897,15 @@ function CanvasLeadProvider(props) {
|
|
|
8674
8897
|
const listed = "types" in props ? props.types : props.except;
|
|
8675
8898
|
const only = "types" in props;
|
|
8676
8899
|
const canLead = React31.useCallback((type) => listed.includes(type) === only, [listed, only]);
|
|
8677
|
-
const
|
|
8678
|
-
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 });
|
|
8679
8902
|
}
|
|
8680
8903
|
function CanvasLeadSlot({ className }) {
|
|
8681
8904
|
const lead = React31.useContext(CanvasLeadContext);
|
|
8682
8905
|
if (lead === null) throw new Error("<CanvasLeadSlot> must be rendered inside <CanvasLeadProvider>.");
|
|
8683
8906
|
const { setTarget } = lead;
|
|
8684
|
-
const
|
|
8685
|
-
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": "" });
|
|
8686
8909
|
}
|
|
8687
8910
|
function useCanvasLead() {
|
|
8688
8911
|
const lead = React31.useContext(CanvasLeadContext);
|
|
@@ -8816,29 +9039,29 @@ var INITIAL_NAV_PRESENTATION = {
|
|
|
8816
9039
|
};
|
|
8817
9040
|
|
|
8818
9041
|
// src/canvas/use-canvas-actions.ts
|
|
8819
|
-
import { useCallback as
|
|
9042
|
+
import { useCallback as useCallback14 } from "react";
|
|
8820
9043
|
function navigateActionId(page) {
|
|
8821
9044
|
const id = Reflect.get(page, "id");
|
|
8822
9045
|
return typeof id === "string" ? `navigate-${page.kind}-${id}` : `navigate-${page.kind}`;
|
|
8823
9046
|
}
|
|
8824
9047
|
function useCanvasActions() {
|
|
8825
9048
|
const session = useOptionalFourtySession();
|
|
8826
|
-
const dispatchAction =
|
|
9049
|
+
const dispatchAction = useCallback14(
|
|
8827
9050
|
(action) => {
|
|
8828
9051
|
if (!session) return;
|
|
8829
9052
|
session.dispatchSuggestionAction(action);
|
|
8830
9053
|
},
|
|
8831
9054
|
[session]
|
|
8832
9055
|
);
|
|
8833
|
-
const navigate =
|
|
8834
|
-
(page,
|
|
8835
|
-
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 } });
|
|
8836
9059
|
},
|
|
8837
9060
|
[dispatchAction]
|
|
8838
9061
|
);
|
|
8839
|
-
const ask =
|
|
8840
|
-
(text2,
|
|
8841
|
-
dispatchAction({ id: `ask-${
|
|
9062
|
+
const ask = useCallback14(
|
|
9063
|
+
(text2, label2) => {
|
|
9064
|
+
dispatchAction({ id: `ask-${label2}`, label: label2, type: "message", payload: { text: text2 } });
|
|
8842
9065
|
},
|
|
8843
9066
|
[dispatchAction]
|
|
8844
9067
|
);
|
|
@@ -9684,23 +9907,23 @@ function buildComponentLibrary(catalog, componentMap) {
|
|
|
9684
9907
|
}
|
|
9685
9908
|
|
|
9686
9909
|
// src/catalog/define.ts
|
|
9687
|
-
import { z as
|
|
9688
|
-
var HYDRATED_ENTITY =
|
|
9910
|
+
import { z as z51 } from "zod";
|
|
9911
|
+
var HYDRATED_ENTITY = z51.object({}).passthrough();
|
|
9689
9912
|
function entity(resolverKey, opts) {
|
|
9690
9913
|
return resolved(HYDRATED_ENTITY, resolverKey, opts);
|
|
9691
9914
|
}
|
|
9692
|
-
var text = prose(
|
|
9915
|
+
var text = prose(z51.string());
|
|
9693
9916
|
function plain() {
|
|
9694
|
-
return
|
|
9917
|
+
return z51.string();
|
|
9695
9918
|
}
|
|
9696
9919
|
function token(values) {
|
|
9697
|
-
return
|
|
9920
|
+
return z51.enum(values);
|
|
9698
9921
|
}
|
|
9699
9922
|
function catalogComponent(meta, render) {
|
|
9700
9923
|
const { props, requires, ...rest } = meta;
|
|
9701
9924
|
return {
|
|
9702
9925
|
...rest,
|
|
9703
|
-
propsSchema:
|
|
9926
|
+
propsSchema: z51.object(props),
|
|
9704
9927
|
...requires !== void 0 ? { requires } : {},
|
|
9705
9928
|
component: adaptComponent(render)
|
|
9706
9929
|
};
|
|
@@ -9775,10 +9998,10 @@ function listRegisteredServices() {
|
|
|
9775
9998
|
}
|
|
9776
9999
|
|
|
9777
10000
|
// src/catalog/prose-value.ts
|
|
9778
|
-
function hasProse(
|
|
9779
|
-
if (
|
|
9780
|
-
if (typeof
|
|
9781
|
-
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;
|
|
9782
10005
|
return true;
|
|
9783
10006
|
}
|
|
9784
10007
|
|
|
@@ -9926,12 +10149,12 @@ __export(presence_exports2, {
|
|
|
9926
10149
|
});
|
|
9927
10150
|
|
|
9928
10151
|
// src/widgets/presence/use-standing-signal.ts
|
|
9929
|
-
import { useMemo as
|
|
10152
|
+
import { useMemo as useMemo12 } from "react";
|
|
9930
10153
|
|
|
9931
10154
|
// src/widgets/presence/core-presence/standing-signal-store.ts
|
|
9932
|
-
import { useSyncExternalStore as
|
|
10155
|
+
import { useSyncExternalStore as useSyncExternalStore5 } from "react";
|
|
9933
10156
|
var current = null;
|
|
9934
|
-
var
|
|
10157
|
+
var listeners4 = /* @__PURE__ */ new Set();
|
|
9935
10158
|
var scope = null;
|
|
9936
10159
|
var seen = /* @__PURE__ */ new Set();
|
|
9937
10160
|
function seenKey(forScope) {
|
|
@@ -9962,13 +10185,13 @@ function bindScope(next) {
|
|
|
9962
10185
|
scope = next;
|
|
9963
10186
|
seen = readSeen(next);
|
|
9964
10187
|
}
|
|
9965
|
-
function
|
|
9966
|
-
for (const listener of
|
|
10188
|
+
function notify4() {
|
|
10189
|
+
for (const listener of listeners4) listener();
|
|
9967
10190
|
}
|
|
9968
10191
|
function subscribe3(listener) {
|
|
9969
|
-
|
|
10192
|
+
listeners4.add(listener);
|
|
9970
10193
|
return () => {
|
|
9971
|
-
|
|
10194
|
+
listeners4.delete(listener);
|
|
9972
10195
|
};
|
|
9973
10196
|
}
|
|
9974
10197
|
function raiseStanding(type, id, payload, signalScope) {
|
|
@@ -9977,7 +10200,7 @@ function raiseStanding(type, id, payload, signalScope) {
|
|
|
9977
10200
|
if (seen.has(id)) return;
|
|
9978
10201
|
if (current !== null) return;
|
|
9979
10202
|
current = { type, id, payload };
|
|
9980
|
-
|
|
10203
|
+
notify4();
|
|
9981
10204
|
}
|
|
9982
10205
|
function resolveStanding(id, signalScope) {
|
|
9983
10206
|
bindScope(signalScope);
|
|
@@ -9985,11 +10208,11 @@ function resolveStanding(id, signalScope) {
|
|
|
9985
10208
|
persistSeen();
|
|
9986
10209
|
if (current !== null && current.id === id) {
|
|
9987
10210
|
current = null;
|
|
9988
|
-
|
|
10211
|
+
notify4();
|
|
9989
10212
|
}
|
|
9990
10213
|
}
|
|
9991
10214
|
function useStandingOfType(type) {
|
|
9992
|
-
return
|
|
10215
|
+
return useSyncExternalStore5(
|
|
9993
10216
|
subscribe3,
|
|
9994
10217
|
() => current !== null && current.type === type ? current : null,
|
|
9995
10218
|
() => null
|
|
@@ -10001,7 +10224,7 @@ if (typeof window !== "undefined") {
|
|
|
10001
10224
|
seen.clear();
|
|
10002
10225
|
persistSeen();
|
|
10003
10226
|
scope = null;
|
|
10004
|
-
|
|
10227
|
+
notify4();
|
|
10005
10228
|
});
|
|
10006
10229
|
}
|
|
10007
10230
|
|
|
@@ -10010,7 +10233,7 @@ function useConsumeStandingSignal(type) {
|
|
|
10010
10233
|
const session = useFourtySession();
|
|
10011
10234
|
const scope2 = session.sessionId === null ? void 0 : session.sessionId;
|
|
10012
10235
|
useRegisterSignalHandlers(
|
|
10013
|
-
|
|
10236
|
+
useMemo12(
|
|
10014
10237
|
() => ({
|
|
10015
10238
|
[type]: (payload) => {
|
|
10016
10239
|
const id = typeof payload.id === "string" && payload.id.length > 0 ? payload.id : type;
|
|
@@ -10021,7 +10244,7 @@ function useConsumeStandingSignal(type) {
|
|
|
10021
10244
|
)
|
|
10022
10245
|
);
|
|
10023
10246
|
const standing = useStandingOfType(type);
|
|
10024
|
-
return
|
|
10247
|
+
return useMemo12(() => {
|
|
10025
10248
|
if (standing === null) return null;
|
|
10026
10249
|
const id = standing.id;
|
|
10027
10250
|
return {
|
|
@@ -10225,8 +10448,8 @@ var COLOR_TERMS = {
|
|
|
10225
10448
|
denim: "#3a5f8a",
|
|
10226
10449
|
indigo: "#3f3a8c"
|
|
10227
10450
|
};
|
|
10228
|
-
function colorHexOf(
|
|
10229
|
-
const key =
|
|
10451
|
+
function colorHexOf(value2) {
|
|
10452
|
+
const key = value2.trim().toLowerCase().replace(/[^a-z-]/g, "");
|
|
10230
10453
|
if (key.length === 0) return null;
|
|
10231
10454
|
if (!(key in COLOR_TERMS)) return null;
|
|
10232
10455
|
return COLOR_TERMS[key];
|
|
@@ -10234,24 +10457,24 @@ function colorHexOf(value) {
|
|
|
10234
10457
|
var EMBEDDED_FIGURE = /\d+(?:[.,]\d+)?/;
|
|
10235
10458
|
var TRAILING_SYMBOLS = /[^\p{L}\d\s]+$/u;
|
|
10236
10459
|
function factFigureParts(fact) {
|
|
10237
|
-
const
|
|
10238
|
-
const match = EMBEDDED_FIGURE.exec(
|
|
10460
|
+
const value2 = fact.value.trim();
|
|
10461
|
+
const match = EMBEDDED_FIGURE.exec(value2);
|
|
10239
10462
|
if (match === null) return null;
|
|
10240
10463
|
const numeral = match[0];
|
|
10241
|
-
const lead =
|
|
10464
|
+
const lead = value2.slice(0, match.index).trim();
|
|
10242
10465
|
const symbolAt = lead.search(TRAILING_SYMBOLS);
|
|
10243
10466
|
const glued = symbolAt === -1 ? "" : lead.slice(symbolAt).replace(/\s+/g, "");
|
|
10244
10467
|
return {
|
|
10245
10468
|
before: symbolAt === -1 ? lead : lead.slice(0, symbolAt).trim(),
|
|
10246
10469
|
figure: `${glued}${numeral}`,
|
|
10247
|
-
after:
|
|
10470
|
+
after: value2.slice(match.index + numeral.length).trim()
|
|
10248
10471
|
};
|
|
10249
10472
|
}
|
|
10250
10473
|
var BARE_NUMERAL = /^\d+(?:[.,]\d+)?$/;
|
|
10251
10474
|
function presenceFactShape(fact) {
|
|
10252
|
-
const
|
|
10253
|
-
if (
|
|
10254
|
-
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;
|
|
10255
10478
|
const parts2 = factFigureParts(fact);
|
|
10256
10479
|
if (parts2 === null) return FACT_SHAPE.plain;
|
|
10257
10480
|
const alone = parts2.before.length === 0 && parts2.after.length === 0;
|
|
@@ -10272,7 +10495,7 @@ function isFact(el) {
|
|
|
10272
10495
|
return el.kind === "fact";
|
|
10273
10496
|
}
|
|
10274
10497
|
function chosenOnly(source, materialized) {
|
|
10275
|
-
const refs = source.refs.filter((
|
|
10498
|
+
const refs = source.refs.filter((ref2) => materialized.has(ref2.id));
|
|
10276
10499
|
if (refs.length === 0) return void 0;
|
|
10277
10500
|
const chosen = {
|
|
10278
10501
|
id: source.id,
|
|
@@ -10376,8 +10599,8 @@ var FACT_PROVENANCES = [
|
|
|
10376
10599
|
"inferred",
|
|
10377
10600
|
"recalled"
|
|
10378
10601
|
];
|
|
10379
|
-
function stringField(
|
|
10380
|
-
const raw = Reflect.get(
|
|
10602
|
+
function stringField(value2, key) {
|
|
10603
|
+
const raw = Reflect.get(value2, key);
|
|
10381
10604
|
if (typeof raw !== "string" || raw.length === 0) return void 0;
|
|
10382
10605
|
return raw;
|
|
10383
10606
|
}
|
|
@@ -10386,15 +10609,15 @@ function asDurableFact(entry) {
|
|
|
10386
10609
|
if (Reflect.get(entry, "kind") !== "fact") return void 0;
|
|
10387
10610
|
const id = stringField(entry, "id");
|
|
10388
10611
|
const turnId = stringField(entry, "turnId");
|
|
10389
|
-
const
|
|
10390
|
-
const
|
|
10391
|
-
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) {
|
|
10392
10615
|
return void 0;
|
|
10393
10616
|
}
|
|
10394
10617
|
const tier = FACT_TIERS.find((t) => t === Reflect.get(entry, "tier"));
|
|
10395
10618
|
const provenance = FACT_PROVENANCES.find((p) => p === Reflect.get(entry, "provenance"));
|
|
10396
10619
|
if (tier === void 0 || provenance === void 0) return void 0;
|
|
10397
|
-
const restored = { id, turnId, kind: "fact", label, value, tier, provenance };
|
|
10620
|
+
const restored = { id, turnId, kind: "fact", label: label2, value: value2, tier, provenance };
|
|
10398
10621
|
const scope2 = stringField(entry, "scope");
|
|
10399
10622
|
if (scope2 !== void 0) restored.scope = scope2;
|
|
10400
10623
|
return restored;
|
|
@@ -10427,7 +10650,7 @@ function useFourtyChat() {
|
|
|
10427
10650
|
}
|
|
10428
10651
|
|
|
10429
10652
|
// src/rendering/post-hydration.ts
|
|
10430
|
-
import { useCallback as
|
|
10653
|
+
import { useCallback as useCallback16 } from "react";
|
|
10431
10654
|
var registry = [];
|
|
10432
10655
|
function registerPostHydrationTransform(transform) {
|
|
10433
10656
|
const existing = registry.findIndex((t) => t.id === transform.id);
|
|
@@ -10436,7 +10659,7 @@ function registerPostHydrationTransform(transform) {
|
|
|
10436
10659
|
}
|
|
10437
10660
|
function usePostHydrationTransforms() {
|
|
10438
10661
|
const fns = registry.map((t) => t.use());
|
|
10439
|
-
return
|
|
10662
|
+
return useCallback16(
|
|
10440
10663
|
(props, ctx) => {
|
|
10441
10664
|
let out = props;
|
|
10442
10665
|
for (const fn of fns) {
|
|
@@ -10452,10 +10675,10 @@ function usePostHydrationTransforms() {
|
|
|
10452
10675
|
}
|
|
10453
10676
|
|
|
10454
10677
|
// src/projection/transform.ts
|
|
10455
|
-
import { useMemo as
|
|
10678
|
+
import { useMemo as useMemo13 } from "react";
|
|
10456
10679
|
|
|
10457
10680
|
// src/projection/preferences.ts
|
|
10458
|
-
import { useSyncExternalStore as
|
|
10681
|
+
import { useSyncExternalStore as useSyncExternalStore6 } from "react";
|
|
10459
10682
|
var STORAGE_KEY2 = "fourty.projection.preferences";
|
|
10460
10683
|
var storage2 = createSessionStorageAdapter();
|
|
10461
10684
|
function load2() {
|
|
@@ -10470,22 +10693,22 @@ function load2() {
|
|
|
10470
10693
|
}
|
|
10471
10694
|
}
|
|
10472
10695
|
var preferences = load2();
|
|
10473
|
-
var
|
|
10696
|
+
var listeners5 = /* @__PURE__ */ new Set();
|
|
10474
10697
|
registerSessionScopedClear(() => {
|
|
10475
10698
|
preferences = {};
|
|
10476
10699
|
storage2.remove(STORAGE_KEY2);
|
|
10477
|
-
|
|
10700
|
+
notify5();
|
|
10478
10701
|
});
|
|
10479
|
-
function
|
|
10480
|
-
for (const listener of
|
|
10702
|
+
function notify5() {
|
|
10703
|
+
for (const listener of listeners5) listener();
|
|
10481
10704
|
}
|
|
10482
10705
|
function getProjectionPreferences() {
|
|
10483
10706
|
return preferences;
|
|
10484
10707
|
}
|
|
10485
10708
|
function subscribeProjectionPreferences(listener) {
|
|
10486
|
-
|
|
10709
|
+
listeners5.add(listener);
|
|
10487
10710
|
return () => {
|
|
10488
|
-
|
|
10711
|
+
listeners5.delete(listener);
|
|
10489
10712
|
};
|
|
10490
10713
|
}
|
|
10491
10714
|
function allProjectableScopes() {
|
|
@@ -10526,11 +10749,11 @@ function applyProjectionSet(payload) {
|
|
|
10526
10749
|
if (!changed) return;
|
|
10527
10750
|
preferences = next;
|
|
10528
10751
|
storage2.set(STORAGE_KEY2, JSON.stringify(preferences));
|
|
10529
|
-
|
|
10752
|
+
notify5();
|
|
10530
10753
|
}
|
|
10531
10754
|
var EMPTY = {};
|
|
10532
10755
|
function useProjectionPreferences() {
|
|
10533
|
-
return
|
|
10756
|
+
return useSyncExternalStore6(
|
|
10534
10757
|
subscribeProjectionPreferences,
|
|
10535
10758
|
getProjectionPreferences,
|
|
10536
10759
|
() => EMPTY
|
|
@@ -10580,7 +10803,7 @@ var projectionTransform = {
|
|
|
10580
10803
|
use: () => {
|
|
10581
10804
|
const preferences2 = useProjectionPreferences();
|
|
10582
10805
|
const facts = useFacts();
|
|
10583
|
-
return
|
|
10806
|
+
return useMemo13(() => {
|
|
10584
10807
|
if (Object.keys(preferences2).length === 0) return null;
|
|
10585
10808
|
return buildTransform(preferences2, facts);
|
|
10586
10809
|
}, [preferences2, facts]);
|
|
@@ -10596,21 +10819,21 @@ function ProjectionSignalBridge() {
|
|
|
10596
10819
|
}
|
|
10597
10820
|
|
|
10598
10821
|
// src/projection/use-projection.ts
|
|
10599
|
-
import { useCallback as
|
|
10822
|
+
import { useCallback as useCallback17, useEffect as useEffect12, useState as useState8 } from "react";
|
|
10600
10823
|
function readResult(raw) {
|
|
10601
10824
|
if (raw === null || typeof raw !== "object") return void 0;
|
|
10602
10825
|
if (!("hiddenCount" in raw) || typeof raw.hiddenCount !== "number") return void 0;
|
|
10603
10826
|
const trimmedAxes = "trimmedAxes" in raw && Array.isArray(raw.trimmedAxes) ? raw.trimmedAxes.filter((a) => typeof a === "string") : [];
|
|
10604
10827
|
return { full: "full" in raw ? raw.full : void 0, hiddenCount: raw.hiddenCount, trimmedAxes };
|
|
10605
10828
|
}
|
|
10606
|
-
function entityIdOf(
|
|
10607
|
-
if (
|
|
10608
|
-
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 : "";
|
|
10609
10832
|
}
|
|
10610
10833
|
var NO_AXES = [];
|
|
10611
10834
|
function useProjection(projectionProp, entity2) {
|
|
10612
10835
|
const [expanded, setExpanded] = useState8(false);
|
|
10613
|
-
const toggle =
|
|
10836
|
+
const toggle = useCallback17(() => setExpanded((e) => !e), []);
|
|
10614
10837
|
const entityId = entityIdOf(entity2);
|
|
10615
10838
|
useEffect12(() => {
|
|
10616
10839
|
setExpanded(false);
|
|
@@ -10756,7 +10979,7 @@ __export(utils_exports, {
|
|
|
10756
10979
|
});
|
|
10757
10980
|
|
|
10758
10981
|
// src/utils/use-form-factor.ts
|
|
10759
|
-
import { useSyncExternalStore as
|
|
10982
|
+
import { useSyncExternalStore as useSyncExternalStore7 } from "react";
|
|
10760
10983
|
|
|
10761
10984
|
// src/utils/viewport-window.tsx
|
|
10762
10985
|
import { createContext as createContext26, useContext as useContext26 } from "react";
|
|
@@ -10772,10 +10995,10 @@ function useViewportWindow() {
|
|
|
10772
10995
|
return canAnswer(global) ? global : null;
|
|
10773
10996
|
}
|
|
10774
10997
|
function ViewportWindowProvider({
|
|
10775
|
-
value,
|
|
10998
|
+
value: value2,
|
|
10776
10999
|
children
|
|
10777
11000
|
}) {
|
|
10778
|
-
return /* @__PURE__ */ jsx23(ViewportWindowContext.Provider, { value, children });
|
|
11001
|
+
return /* @__PURE__ */ jsx23(ViewportWindowContext.Provider, { value: value2, children });
|
|
10779
11002
|
}
|
|
10780
11003
|
|
|
10781
11004
|
// src/utils/use-form-factor.ts
|
|
@@ -10834,7 +11057,7 @@ var noWindowRead = () => SERVER_SNAPSHOT;
|
|
|
10834
11057
|
function useFormFactor() {
|
|
10835
11058
|
const win = useViewportWindow();
|
|
10836
11059
|
const store = win === null ? null : storeFor(win);
|
|
10837
|
-
return
|
|
11060
|
+
return useSyncExternalStore7(
|
|
10838
11061
|
store === null ? noWindowSubscribe : store.subscribe,
|
|
10839
11062
|
store === null ? noWindowRead : store.read,
|
|
10840
11063
|
noWindowRead
|
|
@@ -10842,27 +11065,27 @@ function useFormFactor() {
|
|
|
10842
11065
|
}
|
|
10843
11066
|
|
|
10844
11067
|
// src/utils/use-inline-completion.ts
|
|
10845
|
-
import { useCallback as
|
|
11068
|
+
import { useCallback as useCallback18, useMemo as useMemo14, useState as useState9 } from "react";
|
|
10846
11069
|
function useInlineCompletion(opts) {
|
|
10847
|
-
const { value, candidates } = opts;
|
|
11070
|
+
const { value: value2, candidates } = opts;
|
|
10848
11071
|
const minChars = opts.minChars !== void 0 ? opts.minChars : 2;
|
|
10849
11072
|
const enabled = opts.enabled !== void 0 ? opts.enabled : true;
|
|
10850
11073
|
const [dismissedValue, setDismissedValue] = useState9(null);
|
|
10851
|
-
const dismiss =
|
|
10852
|
-
return
|
|
10853
|
-
if (!enabled ||
|
|
11074
|
+
const dismiss = useCallback18(() => setDismissedValue(value2), [value2]);
|
|
11075
|
+
return useMemo14(() => {
|
|
11076
|
+
if (!enabled || value2.length < minChars || dismissedValue === value2) {
|
|
10854
11077
|
return { completion: "", ghost: "", active: false, dismiss };
|
|
10855
11078
|
}
|
|
10856
|
-
const needle =
|
|
11079
|
+
const needle = value2.toLowerCase();
|
|
10857
11080
|
for (const cand of candidates) {
|
|
10858
|
-
if (typeof cand !== "string" || cand.length <=
|
|
11081
|
+
if (typeof cand !== "string" || cand.length <= value2.length) continue;
|
|
10859
11082
|
if (!cand.toLowerCase().startsWith(needle)) continue;
|
|
10860
|
-
const ghost = cand.slice(
|
|
11083
|
+
const ghost = cand.slice(value2.length);
|
|
10861
11084
|
if (ghost.length === 0) continue;
|
|
10862
11085
|
return { completion: cand, ghost, active: true, dismiss };
|
|
10863
11086
|
}
|
|
10864
11087
|
return { completion: "", ghost: "", active: false, dismiss };
|
|
10865
|
-
}, [
|
|
11088
|
+
}, [value2, candidates, minChars, enabled, dismissedValue, dismiss]);
|
|
10866
11089
|
}
|
|
10867
11090
|
|
|
10868
11091
|
// src/utils/use-document-visible.ts
|
|
@@ -10894,7 +11117,7 @@ function useInterval(callback, ms, active = true) {
|
|
|
10894
11117
|
}
|
|
10895
11118
|
|
|
10896
11119
|
// src/utils/use-success-flash.ts
|
|
10897
|
-
import { useCallback as
|
|
11120
|
+
import { useCallback as useCallback19, useEffect as useEffect13, useRef as useRef9, useState as useState10 } from "react";
|
|
10898
11121
|
import { useAnimationControls } from "framer-motion";
|
|
10899
11122
|
function useSuccessFlash(options) {
|
|
10900
11123
|
const duration = options !== void 0 && options.duration !== void 0 ? options.duration : 900;
|
|
@@ -10910,7 +11133,7 @@ function useSuccessFlash(options) {
|
|
|
10910
11133
|
if (timerRef.current !== null) window.clearTimeout(timerRef.current);
|
|
10911
11134
|
};
|
|
10912
11135
|
}, []);
|
|
10913
|
-
const trigger =
|
|
11136
|
+
const trigger = useCallback19(() => {
|
|
10914
11137
|
setFlashing(true);
|
|
10915
11138
|
controls.start({
|
|
10916
11139
|
scale: scaleRef.current,
|
|
@@ -11011,91 +11234,37 @@ function validateAll(items, schema, context) {
|
|
|
11011
11234
|
}
|
|
11012
11235
|
|
|
11013
11236
|
// src/client-state/store.ts
|
|
11014
|
-
var
|
|
11015
|
-
var
|
|
11237
|
+
var entries2 = /* @__PURE__ */ new Map();
|
|
11238
|
+
var listeners6 = /* @__PURE__ */ new Set();
|
|
11016
11239
|
var vectorCache = {};
|
|
11017
|
-
var
|
|
11018
|
-
function
|
|
11240
|
+
var entriesCache2 = /* @__PURE__ */ new Map();
|
|
11241
|
+
function notify6() {
|
|
11019
11242
|
vectorCache = {};
|
|
11020
|
-
for (const [ns, e] of
|
|
11021
|
-
|
|
11022
|
-
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();
|
|
11023
11246
|
}
|
|
11024
11247
|
function publishClientState(namespace, payload) {
|
|
11025
11248
|
if (namespace.length === 0) return;
|
|
11026
11249
|
const key = JSON.stringify(payload);
|
|
11027
|
-
const prev =
|
|
11250
|
+
const prev = entries2.get(namespace);
|
|
11028
11251
|
if (prev !== void 0 && prev.key === key) return;
|
|
11029
11252
|
const rev = prev !== void 0 ? prev.rev + 1 : 1;
|
|
11030
|
-
|
|
11031
|
-
|
|
11253
|
+
entries2.set(namespace, { payload, rev, key });
|
|
11254
|
+
notify6();
|
|
11032
11255
|
}
|
|
11033
11256
|
function clientStateVector() {
|
|
11034
11257
|
return vectorCache;
|
|
11035
11258
|
}
|
|
11036
11259
|
function clientStateEntries() {
|
|
11037
|
-
return entriesCache;
|
|
11038
|
-
}
|
|
11039
|
-
function subscribeClientState(listener) {
|
|
11040
|
-
listeners5.add(listener);
|
|
11041
|
-
return () => {
|
|
11042
|
-
listeners5.delete(listener);
|
|
11043
|
-
};
|
|
11044
|
-
}
|
|
11045
|
-
|
|
11046
|
-
// src/client-state/server-store.ts
|
|
11047
|
-
var entries2 = /* @__PURE__ */ new Map();
|
|
11048
|
-
var listeners6 = /* @__PURE__ */ new Set();
|
|
11049
|
-
var entriesCache2 = /* @__PURE__ */ new Map();
|
|
11050
|
-
function notify6() {
|
|
11051
|
-
entriesCache2 = new Map(entries2);
|
|
11052
|
-
for (const l of listeners6) l();
|
|
11053
|
-
}
|
|
11054
|
-
function applyServerState(namespace, rev, payload) {
|
|
11055
|
-
if (namespace.length === 0) return false;
|
|
11056
|
-
const prev = entries2.get(namespace);
|
|
11057
|
-
if (prev !== void 0 && rev <= prev.rev) return false;
|
|
11058
|
-
entries2.set(namespace, { payload, rev });
|
|
11059
|
-
notify6();
|
|
11060
|
-
return true;
|
|
11061
|
-
}
|
|
11062
|
-
function serverState(namespace) {
|
|
11063
|
-
const entry = entries2.get(namespace);
|
|
11064
|
-
return entry === void 0 ? void 0 : entry.payload;
|
|
11065
|
-
}
|
|
11066
|
-
function serverStateVector() {
|
|
11067
|
-
const out = {};
|
|
11068
|
-
for (const [ns, e] of entries2) out[ns] = e.rev;
|
|
11069
|
-
return out;
|
|
11070
|
-
}
|
|
11071
|
-
function serverStateEntries() {
|
|
11072
11260
|
return entriesCache2;
|
|
11073
11261
|
}
|
|
11074
|
-
function
|
|
11262
|
+
function subscribeClientState(listener) {
|
|
11075
11263
|
listeners6.add(listener);
|
|
11076
11264
|
return () => {
|
|
11077
11265
|
listeners6.delete(listener);
|
|
11078
11266
|
};
|
|
11079
11267
|
}
|
|
11080
|
-
function resetServerState() {
|
|
11081
|
-
if (entries2.size === 0) return;
|
|
11082
|
-
entries2.clear();
|
|
11083
|
-
notify6();
|
|
11084
|
-
}
|
|
11085
|
-
function primedEntities() {
|
|
11086
|
-
const payload = serverState(ENTITY_PRIME_NAMESPACE);
|
|
11087
|
-
if (payload === void 0) return {};
|
|
11088
|
-
const out = {};
|
|
11089
|
-
for (const [resolverKey, byRef] of Object.entries(payload)) {
|
|
11090
|
-
if (byRef === null || typeof byRef !== "object" || Array.isArray(byRef)) continue;
|
|
11091
|
-
out[resolverKey] = byRef;
|
|
11092
|
-
}
|
|
11093
|
-
return out;
|
|
11094
|
-
}
|
|
11095
|
-
function primedEntitiesFor(resolverKey) {
|
|
11096
|
-
const byKey = primedEntities()[resolverKey];
|
|
11097
|
-
return byKey === void 0 ? {} : byKey;
|
|
11098
|
-
}
|
|
11099
11268
|
|
|
11100
11269
|
// src/preview/SpacefrontPreviewProvider.tsx
|
|
11101
11270
|
import * as React43 from "react";
|
|
@@ -11106,15 +11275,15 @@ var ASYNC_NOOP = () => Promise.resolve();
|
|
|
11106
11275
|
var VIEW = { page: { kind: "home" }, layout: EMPTY_SPEC, shell: EMPTY_SHELL };
|
|
11107
11276
|
var PreviewContext = React43.createContext(null);
|
|
11108
11277
|
function usePreview() {
|
|
11109
|
-
const
|
|
11110
|
-
if (
|
|
11111
|
-
return
|
|
11278
|
+
const value2 = React43.useContext(PreviewContext);
|
|
11279
|
+
if (value2 === null) throw new Error("preview runtime used outside <SpacefrontPreviewProvider>");
|
|
11280
|
+
return value2;
|
|
11112
11281
|
}
|
|
11113
|
-
function list(
|
|
11114
|
-
return
|
|
11282
|
+
function list(value2) {
|
|
11283
|
+
return value2 === void 0 ? [] : value2;
|
|
11115
11284
|
}
|
|
11116
|
-
function orNull(
|
|
11117
|
-
return
|
|
11285
|
+
function orNull(value2) {
|
|
11286
|
+
return value2 === void 0 ? null : value2;
|
|
11118
11287
|
}
|
|
11119
11288
|
function derive(scene, sessionId) {
|
|
11120
11289
|
const turns = list(scene.turns);
|
|
@@ -11144,7 +11313,7 @@ function derive(scene, sessionId) {
|
|
|
11144
11313
|
const labels = list(scene.suggestions);
|
|
11145
11314
|
const suggestions = labels.length === 0 ? null : {
|
|
11146
11315
|
type: "suggestion_cards",
|
|
11147
|
-
actions: labels.map((
|
|
11316
|
+
actions: labels.map((label2, i) => ({ id: `chip-${i}`, label: label2, type: "message", payload: { text: label2 } }))
|
|
11148
11317
|
};
|
|
11149
11318
|
const turnId = `turn-${Math.max(0, turns.length - (p === null ? 1 : 0))}`;
|
|
11150
11319
|
const elements = [];
|
|
@@ -11209,6 +11378,7 @@ var RUNTIME = {
|
|
|
11209
11378
|
},
|
|
11210
11379
|
useSessionId: () => usePreview().sessionId,
|
|
11211
11380
|
useSessionMessages: () => usePreview().chat,
|
|
11381
|
+
useSeedLayout: () => null,
|
|
11212
11382
|
useFacts: () => ({}),
|
|
11213
11383
|
useVisitorName: () => ({ name: null, setName: NOOP }),
|
|
11214
11384
|
useConversationMessages: () => usePreview().messages,
|
|
@@ -11317,6 +11487,7 @@ function SpacefrontPreviewProvider({ scene, onSend, children }) {
|
|
|
11317
11487
|
clearSession: NOOP,
|
|
11318
11488
|
forgetVisitor: ASYNC_NOOP,
|
|
11319
11489
|
shareCanvas: () => Promise.resolve(null),
|
|
11490
|
+
board: () => Promise.resolve(null),
|
|
11320
11491
|
recentConversations: [],
|
|
11321
11492
|
newConversation: NOOP,
|
|
11322
11493
|
switchConversation: NOOP,
|
|
@@ -11640,7 +11811,7 @@ function navigateToExternalCommerceUrl(url) {
|
|
|
11640
11811
|
}
|
|
11641
11812
|
|
|
11642
11813
|
// src/verticals/commerce/variant/variant-selection-store.ts
|
|
11643
|
-
import { useSyncExternalStore as
|
|
11814
|
+
import { useSyncExternalStore as useSyncExternalStore8 } from "react";
|
|
11644
11815
|
var EMPTY2 = /* @__PURE__ */ new Map();
|
|
11645
11816
|
var selections = /* @__PURE__ */ new Map();
|
|
11646
11817
|
var listeners7 = /* @__PURE__ */ new Set();
|
|
@@ -11666,7 +11837,7 @@ function getVariantSelection(productId) {
|
|
|
11666
11837
|
return selections.get(productId);
|
|
11667
11838
|
}
|
|
11668
11839
|
function useVariantSelections() {
|
|
11669
|
-
return
|
|
11840
|
+
return useSyncExternalStore8(subscribe5, () => selections, () => EMPTY2);
|
|
11670
11841
|
}
|
|
11671
11842
|
registerSessionScopedClear(() => {
|
|
11672
11843
|
if (selections.size === 0) return;
|
|
@@ -11675,7 +11846,7 @@ registerSessionScopedClear(() => {
|
|
|
11675
11846
|
});
|
|
11676
11847
|
|
|
11677
11848
|
// src/verticals/commerce/variant/pending-variant-choice-store.ts
|
|
11678
|
-
import { useSyncExternalStore as
|
|
11849
|
+
import { useSyncExternalStore as useSyncExternalStore9 } from "react";
|
|
11679
11850
|
var pending = null;
|
|
11680
11851
|
var listeners8 = /* @__PURE__ */ new Set();
|
|
11681
11852
|
function notify8() {
|
|
@@ -11697,11 +11868,11 @@ function clearVariantChoice() {
|
|
|
11697
11868
|
notify8();
|
|
11698
11869
|
}
|
|
11699
11870
|
function usePendingVariantChoice() {
|
|
11700
|
-
return
|
|
11871
|
+
return useSyncExternalStore9(subscribe6, () => pending, () => null);
|
|
11701
11872
|
}
|
|
11702
11873
|
|
|
11703
11874
|
// src/verticals/commerce/variant/option-selection-store.ts
|
|
11704
|
-
import { useSyncExternalStore as
|
|
11875
|
+
import { useSyncExternalStore as useSyncExternalStore10 } from "react";
|
|
11705
11876
|
var EMPTY3 = /* @__PURE__ */ new Map();
|
|
11706
11877
|
var selections2 = /* @__PURE__ */ new Map();
|
|
11707
11878
|
var listeners9 = /* @__PURE__ */ new Set();
|
|
@@ -11723,9 +11894,9 @@ function recordOptionSelections(productId, picks) {
|
|
|
11723
11894
|
const current2 = selections2.get(productId);
|
|
11724
11895
|
const merged = current2 !== void 0 ? { ...current2 } : {};
|
|
11725
11896
|
let changed = false;
|
|
11726
|
-
for (const [axis,
|
|
11727
|
-
if (merged[axis] !==
|
|
11728
|
-
merged[axis] =
|
|
11897
|
+
for (const [axis, value2] of entries3) {
|
|
11898
|
+
if (merged[axis] !== value2) {
|
|
11899
|
+
merged[axis] = value2;
|
|
11729
11900
|
changed = true;
|
|
11730
11901
|
}
|
|
11731
11902
|
}
|
|
@@ -11739,7 +11910,7 @@ function getOptionSelections(productId) {
|
|
|
11739
11910
|
return selections2.get(productId);
|
|
11740
11911
|
}
|
|
11741
11912
|
function useOptionSelections() {
|
|
11742
|
-
return
|
|
11913
|
+
return useSyncExternalStore10(subscribe7, () => selections2, () => EMPTY3);
|
|
11743
11914
|
}
|
|
11744
11915
|
registerSessionScopedClear(() => {
|
|
11745
11916
|
if (selections2.size === 0) return;
|
|
@@ -11769,18 +11940,18 @@ __export(ecommerce_exports, {
|
|
|
11769
11940
|
});
|
|
11770
11941
|
|
|
11771
11942
|
// ../spacestation/src/analytics/ecommerce/surfacing.ts
|
|
11772
|
-
import { z as
|
|
11943
|
+
import { z as z52 } from "zod";
|
|
11773
11944
|
var PRODUCTS_SURFACED = defineEventKind(
|
|
11774
11945
|
"commerce.products_surfaced",
|
|
11775
11946
|
"client",
|
|
11776
|
-
|
|
11947
|
+
z52.object({
|
|
11777
11948
|
/** The turn whose commit this describes. Minted where the prompt signal
|
|
11778
11949
|
* is built and shared with `agent_runs`, so the read layer can line a
|
|
11779
11950
|
* surfacing up against the prompt that asked for it. */
|
|
11780
|
-
turnId:
|
|
11951
|
+
turnId: z52.string().min(1).max(128),
|
|
11781
11952
|
/** Distinct entity refs this turn placed that were not on the canvas
|
|
11782
11953
|
* before it. ZERO IS A REAL VALUE — see the header. */
|
|
11783
|
-
productCount:
|
|
11954
|
+
productCount: z52.number().int().nonnegative()
|
|
11784
11955
|
}).strict()
|
|
11785
11956
|
);
|
|
11786
11957
|
|
|
@@ -11798,38 +11969,38 @@ var ACQUISITION_KIND_LABELS = {
|
|
|
11798
11969
|
"commerce.cart_line_added": "Cart",
|
|
11799
11970
|
"commerce.registry_clicked": "Registry"
|
|
11800
11971
|
};
|
|
11801
|
-
function isFunnelStep(
|
|
11802
|
-
return FUNNEL_STEPS.some((step) => step ===
|
|
11972
|
+
function isFunnelStep(value2) {
|
|
11973
|
+
return FUNNEL_STEPS.some((step) => step === value2);
|
|
11803
11974
|
}
|
|
11804
11975
|
|
|
11805
11976
|
// src/verticals/commerce/product/use-product-grid-filter.ts
|
|
11806
|
-
import { useCallback as
|
|
11977
|
+
import { useCallback as useCallback20, useMemo as useMemo16, useState as useState12 } from "react";
|
|
11807
11978
|
function useProductGridFilter(chips) {
|
|
11808
|
-
const labelKey =
|
|
11979
|
+
const labelKey = useMemo16(() => chips.map((c) => c.label).join("|"), [chips]);
|
|
11809
11980
|
const first = chips[0];
|
|
11810
11981
|
const [activeLabel, setActiveLabel] = useState12(
|
|
11811
11982
|
first !== void 0 ? first.label : null
|
|
11812
11983
|
);
|
|
11813
|
-
const activeFromKey =
|
|
11984
|
+
const activeFromKey = useMemo16(() => {
|
|
11814
11985
|
void labelKey;
|
|
11815
11986
|
if (first === void 0) return null;
|
|
11816
11987
|
const found = chips.find((c) => c.label === activeLabel);
|
|
11817
11988
|
return found !== void 0 ? found : first;
|
|
11818
11989
|
}, [chips, first, activeLabel, labelKey]);
|
|
11819
|
-
const setActive =
|
|
11990
|
+
const setActive = useCallback20((next) => {
|
|
11820
11991
|
setActiveLabel(next.label);
|
|
11821
11992
|
}, []);
|
|
11822
11993
|
return { chips, active: activeFromKey, setActive };
|
|
11823
11994
|
}
|
|
11824
11995
|
|
|
11825
11996
|
// src/verticals/commerce/product/use-product-detail.ts
|
|
11826
|
-
import { useCallback as
|
|
11997
|
+
import { useCallback as useCallback22, useMemo as useMemo17, useRef as useRef13, useState as useState15 } from "react";
|
|
11827
11998
|
|
|
11828
11999
|
// src/verticals/commerce/checkout/use-buy-now.ts
|
|
11829
|
-
import { useCallback as
|
|
12000
|
+
import { useCallback as useCallback21, useEffect as useEffect16, useState as useState13 } from "react";
|
|
11830
12001
|
|
|
11831
12002
|
// src/verticals/commerce/checkout/checkout-handoff-store.ts
|
|
11832
|
-
import { useSyncExternalStore as
|
|
12003
|
+
import { useSyncExternalStore as useSyncExternalStore11 } from "react";
|
|
11833
12004
|
|
|
11834
12005
|
// src/verticals/commerce/checkout/checkout-handoff-reasons.ts
|
|
11835
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.";
|
|
@@ -11940,7 +12111,7 @@ function readCheckoutHandoff() {
|
|
|
11940
12111
|
return state;
|
|
11941
12112
|
}
|
|
11942
12113
|
function useCheckoutHandoff() {
|
|
11943
|
-
return
|
|
12114
|
+
return useSyncExternalStore11(subscribe8, readCheckoutHandoff, () => IDLE);
|
|
11944
12115
|
}
|
|
11945
12116
|
registerSessionScopedClear(() => {
|
|
11946
12117
|
if (state === IDLE) return;
|
|
@@ -11967,7 +12138,7 @@ function useBuyNow(addToCart) {
|
|
|
11967
12138
|
const cartApi = useCart();
|
|
11968
12139
|
const analytics = useOptionalAnalyticsSink();
|
|
11969
12140
|
const [pending2, setPending] = useState13(null);
|
|
11970
|
-
const start =
|
|
12141
|
+
const start = useCallback21((variantId) => {
|
|
11971
12142
|
if (pending2 !== null) return;
|
|
11972
12143
|
addToCart();
|
|
11973
12144
|
setPending(variantId);
|
|
@@ -12084,9 +12255,9 @@ function useSelectedVariantsState(product, facts) {
|
|
|
12084
12255
|
setSelectedVariants((prev) => {
|
|
12085
12256
|
let changed = false;
|
|
12086
12257
|
const merged = { ...prev };
|
|
12087
|
-
for (const [axis,
|
|
12088
|
-
if (merged[axis] !==
|
|
12089
|
-
merged[axis] =
|
|
12258
|
+
for (const [axis, value2] of Object.entries(recorded)) {
|
|
12259
|
+
if (merged[axis] !== value2) {
|
|
12260
|
+
merged[axis] = value2;
|
|
12090
12261
|
changed = true;
|
|
12091
12262
|
}
|
|
12092
12263
|
}
|
|
@@ -12119,19 +12290,19 @@ function useProductDetail(product, options) {
|
|
|
12119
12290
|
}
|
|
12120
12291
|
const { selectedVariants, setSelectedVariants, markTouched } = useSelectedVariantsState(product, facts);
|
|
12121
12292
|
const desc = useExpandable(false);
|
|
12122
|
-
const variantGroups =
|
|
12293
|
+
const variantGroups = useMemo17(
|
|
12123
12294
|
() => deriveVariantGroups(product),
|
|
12124
12295
|
[product]
|
|
12125
12296
|
);
|
|
12126
|
-
const allSelected =
|
|
12297
|
+
const allSelected = useMemo17(
|
|
12127
12298
|
() => variantGroups.every((g) => selectedVariants[g.name] !== void 0),
|
|
12128
12299
|
[variantGroups, selectedVariants]
|
|
12129
12300
|
);
|
|
12130
|
-
const missingGroup =
|
|
12301
|
+
const missingGroup = useMemo17(
|
|
12131
12302
|
() => variantGroups.find((g) => selectedVariants[g.name] === void 0),
|
|
12132
12303
|
[variantGroups, selectedVariants]
|
|
12133
12304
|
);
|
|
12134
|
-
const findVariant =
|
|
12305
|
+
const findVariant = useCallback22(
|
|
12135
12306
|
(opts) => matchVariant(product, opts),
|
|
12136
12307
|
[product]
|
|
12137
12308
|
);
|
|
@@ -12142,11 +12313,11 @@ function useProductDetail(product, options) {
|
|
|
12142
12313
|
const matchIndex = product.images.findIndex((img) => img.url === activeVariantImageUrl);
|
|
12143
12314
|
if (matchIndex >= 0) setSelectedImage(matchIndex);
|
|
12144
12315
|
}
|
|
12145
|
-
const isVariantUnavailable =
|
|
12316
|
+
const isVariantUnavailable = useCallback22(
|
|
12146
12317
|
(group, opt) => isOptionUnavailable(product, selectedVariants, group, opt),
|
|
12147
12318
|
[product, selectedVariants]
|
|
12148
12319
|
);
|
|
12149
|
-
const selectVariant =
|
|
12320
|
+
const selectVariant = useCallback22((group, opt) => {
|
|
12150
12321
|
markTouched();
|
|
12151
12322
|
setSelectedVariants((prev) => ({ ...prev, [group]: opt }));
|
|
12152
12323
|
session.dispatchSignal({
|
|
@@ -12155,7 +12326,7 @@ function useProductDetail(product, options) {
|
|
|
12155
12326
|
});
|
|
12156
12327
|
optimisticFacts.add({ label: group, value: opt });
|
|
12157
12328
|
}, [session, product.id, markTouched, setSelectedVariants, optimisticFacts]);
|
|
12158
|
-
const addPicked =
|
|
12329
|
+
const addPicked = useCallback22((acknowledgeInDrawer) => {
|
|
12159
12330
|
if (!allSelected) return;
|
|
12160
12331
|
const variant = findVariant(selectedVariants);
|
|
12161
12332
|
if (variant === void 0) {
|
|
@@ -12180,10 +12351,10 @@ function useProductDetail(product, options) {
|
|
|
12180
12351
|
}
|
|
12181
12352
|
});
|
|
12182
12353
|
}, [allSelected, findVariant, product.id, product.title, product.images, selectedVariants, session, lineAttributes]);
|
|
12183
|
-
const onAddToBag =
|
|
12184
|
-
const addForBuyNow =
|
|
12354
|
+
const onAddToBag = useCallback22(() => addPicked(true), [addPicked]);
|
|
12355
|
+
const addForBuyNow = useCallback22(() => addPicked(false), [addPicked]);
|
|
12185
12356
|
const buyNow = useBuyNow(addForBuyNow);
|
|
12186
|
-
const onBuyNow =
|
|
12357
|
+
const onBuyNow = useCallback22(() => {
|
|
12187
12358
|
if (!allSelected) return;
|
|
12188
12359
|
const variant = findVariant(selectedVariants);
|
|
12189
12360
|
if (variant === void 0) {
|
|
@@ -12192,10 +12363,10 @@ function useProductDetail(product, options) {
|
|
|
12192
12363
|
}
|
|
12193
12364
|
buyNow.start(variant.id);
|
|
12194
12365
|
}, [allSelected, findVariant, selectedVariants, buyNow]);
|
|
12195
|
-
const onAskAgent =
|
|
12366
|
+
const onAskAgent = useCallback22(() => {
|
|
12196
12367
|
session.sendMessage(`Tell me more about the ${product.title}`);
|
|
12197
12368
|
}, [session, product.title]);
|
|
12198
|
-
const onPickSibling =
|
|
12369
|
+
const onPickSibling = useCallback22((sibling) => {
|
|
12199
12370
|
if (sibling.current === true) return;
|
|
12200
12371
|
session.dispatchSuggestionAction({
|
|
12201
12372
|
id: `navigate-product-${sibling.id}`,
|
|
@@ -12210,7 +12381,7 @@ function useProductDetail(product, options) {
|
|
|
12210
12381
|
payload: { page: { kind: "product", id: sibling.id, morph: true } }
|
|
12211
12382
|
});
|
|
12212
12383
|
}, [session]);
|
|
12213
|
-
const toggleZoom =
|
|
12384
|
+
const toggleZoom = useCallback22(() => setZoomed((p) => !p), []);
|
|
12214
12385
|
return {
|
|
12215
12386
|
selectedImage,
|
|
12216
12387
|
selectImage: setSelectedImage,
|
|
@@ -12237,7 +12408,7 @@ function useProductDetail(product, options) {
|
|
|
12237
12408
|
}
|
|
12238
12409
|
|
|
12239
12410
|
// src/verticals/commerce/comparison/use-comparison-table.ts
|
|
12240
|
-
import { useCallback as
|
|
12411
|
+
import { useCallback as useCallback23 } from "react";
|
|
12241
12412
|
function classifyComparisonValue(v) {
|
|
12242
12413
|
if (v === void 0) return { kind: "value", value: "" };
|
|
12243
12414
|
if (v === true || v === "true" || v === "Yes") return { kind: "true" };
|
|
@@ -12245,7 +12416,7 @@ function classifyComparisonValue(v) {
|
|
|
12245
12416
|
return { kind: "value", value: v };
|
|
12246
12417
|
}
|
|
12247
12418
|
function useComparisonHighlight(highlightedId) {
|
|
12248
|
-
const isHighlighted =
|
|
12419
|
+
const isHighlighted = useCallback23(
|
|
12249
12420
|
(id) => id === highlightedId,
|
|
12250
12421
|
[highlightedId]
|
|
12251
12422
|
);
|
|
@@ -12253,7 +12424,7 @@ function useComparisonHighlight(highlightedId) {
|
|
|
12253
12424
|
}
|
|
12254
12425
|
|
|
12255
12426
|
// src/verticals/commerce/cart/use-cart-drawer.ts
|
|
12256
|
-
import { useCallback as
|
|
12427
|
+
import { useCallback as useCallback24 } from "react";
|
|
12257
12428
|
|
|
12258
12429
|
// src/verticals/commerce/cart/use-safe-cart.ts
|
|
12259
12430
|
var warnedCart = false;
|
|
@@ -12287,7 +12458,7 @@ function useSafeCart() {
|
|
|
12287
12458
|
}
|
|
12288
12459
|
|
|
12289
12460
|
// src/verticals/commerce/cart/cart-drawer-store.ts
|
|
12290
|
-
import { useSyncExternalStore as
|
|
12461
|
+
import { useSyncExternalStore as useSyncExternalStore12 } from "react";
|
|
12291
12462
|
var isOpen = false;
|
|
12292
12463
|
var focus = null;
|
|
12293
12464
|
var listeners11 = /* @__PURE__ */ new Set();
|
|
@@ -12317,7 +12488,7 @@ function openCartDrawerFocusedOn(productId) {
|
|
|
12317
12488
|
notify11();
|
|
12318
12489
|
}
|
|
12319
12490
|
function useCartDrawerFocus() {
|
|
12320
|
-
return
|
|
12491
|
+
return useSyncExternalStore12(subscribe9, () => focus, () => null);
|
|
12321
12492
|
}
|
|
12322
12493
|
function closeCartDrawer() {
|
|
12323
12494
|
if (!isOpen) return;
|
|
@@ -12330,7 +12501,7 @@ function toggleCartDrawer() {
|
|
|
12330
12501
|
notify11();
|
|
12331
12502
|
}
|
|
12332
12503
|
function useCartDrawerOpen() {
|
|
12333
|
-
return
|
|
12504
|
+
return useSyncExternalStore12(subscribe9, () => isOpen, () => false);
|
|
12334
12505
|
}
|
|
12335
12506
|
registerExclusiveOverlay("cart", closeCartDrawer);
|
|
12336
12507
|
registerSessionScopedClear(() => {
|
|
@@ -12344,9 +12515,9 @@ registerSessionScopedClear(() => {
|
|
|
12344
12515
|
function useCartDrawer() {
|
|
12345
12516
|
const cart = useSafeCart();
|
|
12346
12517
|
const isOpen2 = useCartDrawerOpen();
|
|
12347
|
-
const open =
|
|
12348
|
-
const close =
|
|
12349
|
-
const toggle =
|
|
12518
|
+
const open = useCallback24(() => openCartDrawer(), []);
|
|
12519
|
+
const close = useCallback24(() => closeCartDrawer(), []);
|
|
12520
|
+
const toggle = useCallback24(() => toggleCartDrawer(), []);
|
|
12350
12521
|
return {
|
|
12351
12522
|
isOpen: isOpen2,
|
|
12352
12523
|
open,
|
|
@@ -12366,7 +12537,7 @@ function useCartDrawer() {
|
|
|
12366
12537
|
import React44 from "react";
|
|
12367
12538
|
|
|
12368
12539
|
// src/verticals/commerce/cart/queued-discount-codes.ts
|
|
12369
|
-
import { useSyncExternalStore as
|
|
12540
|
+
import { useSyncExternalStore as useSyncExternalStore13 } from "react";
|
|
12370
12541
|
var queued = [];
|
|
12371
12542
|
var listeners12 = /* @__PURE__ */ new Set();
|
|
12372
12543
|
function notify12() {
|
|
@@ -12411,7 +12582,7 @@ function subscribe10(listener) {
|
|
|
12411
12582
|
}
|
|
12412
12583
|
var NONE = [];
|
|
12413
12584
|
function useQueuedDiscountCodes() {
|
|
12414
|
-
return
|
|
12585
|
+
return useSyncExternalStore13(subscribe10, readQueuedDiscountCodes, () => NONE);
|
|
12415
12586
|
}
|
|
12416
12587
|
registerSessionScopedClear(() => {
|
|
12417
12588
|
if (queued.length === 0) return;
|
|
@@ -12494,7 +12665,7 @@ function useCartView(cart, onCheckout) {
|
|
|
12494
12665
|
}
|
|
12495
12666
|
|
|
12496
12667
|
// src/verticals/commerce/cart/cart-action-failures.ts
|
|
12497
|
-
import { useMemo as
|
|
12668
|
+
import { useMemo as useMemo18, useSyncExternalStore as useSyncExternalStore14 } from "react";
|
|
12498
12669
|
var FAILURE_TTL_MS = 2 * 6e4;
|
|
12499
12670
|
var FAILURE_CAP = 5;
|
|
12500
12671
|
var failures = [];
|
|
@@ -12541,12 +12712,12 @@ function subscribe11(listener) {
|
|
|
12541
12712
|
}
|
|
12542
12713
|
var NO_FAILURES = [];
|
|
12543
12714
|
function useCartActionFailures() {
|
|
12544
|
-
return
|
|
12715
|
+
return useSyncExternalStore14(subscribe11, snapshot, () => NO_FAILURES);
|
|
12545
12716
|
}
|
|
12546
12717
|
function useCartActionFailuresFor(productIdsInCart) {
|
|
12547
12718
|
const all = useCartActionFailures();
|
|
12548
12719
|
const key = productIdsInCart.join("\0");
|
|
12549
|
-
return
|
|
12720
|
+
return useMemo18(() => {
|
|
12550
12721
|
const present = new Set(key.length === 0 ? [] : key.split("\0"));
|
|
12551
12722
|
return all.filter((f) => f.productId !== void 0 && !present.has(f.productId));
|
|
12552
12723
|
}, [all, key]);
|
|
@@ -12561,17 +12732,17 @@ registerSessionScopedClear(() => {
|
|
|
12561
12732
|
import * as React45 from "react";
|
|
12562
12733
|
|
|
12563
12734
|
// src/verticals/commerce/use-commerce-actions.ts
|
|
12564
|
-
import { useCallback as
|
|
12735
|
+
import { useCallback as useCallback25 } from "react";
|
|
12565
12736
|
function useCommerceActions() {
|
|
12566
12737
|
const canvas = useCanvasActions();
|
|
12567
|
-
const navigateToProduct =
|
|
12738
|
+
const navigateToProduct = useCallback25(
|
|
12568
12739
|
(productId, title) => {
|
|
12569
12740
|
if (!canvas) return;
|
|
12570
12741
|
canvas.navigate({ kind: "product", id: productId }, title);
|
|
12571
12742
|
},
|
|
12572
12743
|
[canvas]
|
|
12573
12744
|
);
|
|
12574
|
-
const showCollection =
|
|
12745
|
+
const showCollection = useCallback25(
|
|
12575
12746
|
(collectionTitle) => {
|
|
12576
12747
|
if (!canvas) return;
|
|
12577
12748
|
canvas.dispatchAction({
|
|
@@ -12583,7 +12754,7 @@ function useCommerceActions() {
|
|
|
12583
12754
|
},
|
|
12584
12755
|
[canvas]
|
|
12585
12756
|
);
|
|
12586
|
-
const navigateToProductSet =
|
|
12757
|
+
const navigateToProductSet = useCallback25(
|
|
12587
12758
|
(handle, title, productIds) => {
|
|
12588
12759
|
if (!canvas) return;
|
|
12589
12760
|
canvas.dispatchAction({
|
|
@@ -12641,7 +12812,7 @@ function useCartLineRow(line, opts) {
|
|
|
12641
12812
|
}
|
|
12642
12813
|
|
|
12643
12814
|
// src/verticals/commerce/wishlist/use-wishlist-drawer.ts
|
|
12644
|
-
import { useCallback as
|
|
12815
|
+
import { useCallback as useCallback27, useState as useState16 } from "react";
|
|
12645
12816
|
var warnedDegraded = false;
|
|
12646
12817
|
function useSafeWishlist() {
|
|
12647
12818
|
try {
|
|
@@ -12665,11 +12836,11 @@ function useSafeWishlist() {
|
|
|
12665
12836
|
function useWishlistDrawer() {
|
|
12666
12837
|
const wishlist = useSafeWishlist();
|
|
12667
12838
|
const [isOpen2, setIsOpen] = useState16(false);
|
|
12668
|
-
const open =
|
|
12669
|
-
const close =
|
|
12670
|
-
const toggle =
|
|
12839
|
+
const open = useCallback27(() => setIsOpen(true), []);
|
|
12840
|
+
const close = useCallback27(() => setIsOpen(false), []);
|
|
12841
|
+
const toggle = useCallback27(() => setIsOpen((p) => !p), []);
|
|
12671
12842
|
useExclusiveOverlay("wishlist", isOpen2, close);
|
|
12672
|
-
const removeLine =
|
|
12843
|
+
const removeLine = useCallback27(
|
|
12673
12844
|
(productId) => {
|
|
12674
12845
|
if (wishlist === null) {
|
|
12675
12846
|
console.warn("[useWishlistDrawer] removeLine called with no commerce provider");
|
|
@@ -12779,9 +12950,9 @@ function pickColorCount(product) {
|
|
|
12779
12950
|
import * as React46 from "react";
|
|
12780
12951
|
|
|
12781
12952
|
// src/verticals/commerce/variant/variant-option-axes.ts
|
|
12782
|
-
function carriesValue(variant, name,
|
|
12953
|
+
function carriesValue(variant, name, value2) {
|
|
12783
12954
|
const wantName = canonicalOptionValue(name);
|
|
12784
|
-
const wantValue = canonicalOptionValue(
|
|
12955
|
+
const wantValue = canonicalOptionValue(value2);
|
|
12785
12956
|
return variant.selectedOptions?.some(
|
|
12786
12957
|
(o) => canonicalOptionValue(o.name) === wantName && canonicalOptionValue(o.value) === wantValue
|
|
12787
12958
|
) === true;
|
|
@@ -12809,8 +12980,8 @@ function variantsMatching(product, selections3) {
|
|
|
12809
12980
|
function purchasableAlternativesFor(product, axisName, selections3) {
|
|
12810
12981
|
if (!hasAxis(product, axisName)) return null;
|
|
12811
12982
|
const others = {};
|
|
12812
|
-
for (const [name,
|
|
12813
|
-
if (name !== axisName) others[name] =
|
|
12983
|
+
for (const [name, value2] of Object.entries(selections3)) {
|
|
12984
|
+
if (name !== axisName) others[name] = value2;
|
|
12814
12985
|
}
|
|
12815
12986
|
const pool = Object.keys(others).length > 0 ? variantsMatching(product, others) : product.variants;
|
|
12816
12987
|
const want = canonicalOptionValue(axisName);
|
|
@@ -12822,13 +12993,13 @@ function purchasableAlternativesFor(product, axisName, selections3) {
|
|
|
12822
12993
|
}
|
|
12823
12994
|
return values;
|
|
12824
12995
|
}
|
|
12825
|
-
function photoForValue(product, name,
|
|
12826
|
-
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));
|
|
12827
12998
|
const available = matches.find((v) => v.available === true && v.image !== void 0);
|
|
12828
12999
|
const withImage = available !== void 0 ? available : matches.find((v) => v.image !== void 0);
|
|
12829
13000
|
if (withImage === void 0 || withImage.image === void 0) return void 0;
|
|
12830
13001
|
const { url, altText } = withImage.image;
|
|
12831
|
-
return { url, altText: altText.length > 0 ? altText :
|
|
13002
|
+
return { url, altText: altText.length > 0 ? altText : value2 };
|
|
12832
13003
|
}
|
|
12833
13004
|
function photosDiscriminate(values) {
|
|
12834
13005
|
const urls = /* @__PURE__ */ new Set();
|
|
@@ -12848,12 +13019,12 @@ function differingAxes(product, candidates) {
|
|
|
12848
13019
|
if (match !== void 0) present.add(match.value);
|
|
12849
13020
|
}
|
|
12850
13021
|
if (present.size <= 1) continue;
|
|
12851
|
-
const values = option.values.map((
|
|
12852
|
-
value,
|
|
13022
|
+
const values = option.values.map((value2) => ({
|
|
13023
|
+
value: value2,
|
|
12853
13024
|
// Purchasability is a question about what's buyable *now*, so it reads
|
|
12854
13025
|
// the candidate set — unlike the photo, which reads every variant.
|
|
12855
|
-
available: candidates.some((v) => carriesValue(v, option.name,
|
|
12856
|
-
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)
|
|
12857
13028
|
}));
|
|
12858
13029
|
axes.push({
|
|
12859
13030
|
name: option.name,
|
|
@@ -13312,17 +13483,17 @@ function resolveSwatchColor(name) {
|
|
|
13312
13483
|
}
|
|
13313
13484
|
|
|
13314
13485
|
// src/verticals/content/use-content-actions.ts
|
|
13315
|
-
import { useCallback as
|
|
13486
|
+
import { useCallback as useCallback28 } from "react";
|
|
13316
13487
|
function useContentActions() {
|
|
13317
13488
|
const canvas = useCanvasActions();
|
|
13318
|
-
const navigateToArticle =
|
|
13489
|
+
const navigateToArticle = useCallback28(
|
|
13319
13490
|
(articleId, title) => {
|
|
13320
13491
|
if (!canvas) return;
|
|
13321
13492
|
canvas.navigate({ kind: "article", id: articleId }, title);
|
|
13322
13493
|
},
|
|
13323
13494
|
[canvas]
|
|
13324
13495
|
);
|
|
13325
|
-
const subscribeNewsletter =
|
|
13496
|
+
const subscribeNewsletter = useCallback28(
|
|
13326
13497
|
(email, buttonLabel) => {
|
|
13327
13498
|
if (!canvas) return;
|
|
13328
13499
|
canvas.dispatchAction({
|
|
@@ -13342,7 +13513,7 @@ function useContentActions() {
|
|
|
13342
13513
|
import { useEffect as useEffect19, useState as useState19 } from "react";
|
|
13343
13514
|
|
|
13344
13515
|
// package.json
|
|
13345
|
-
var version = "0.5.
|
|
13516
|
+
var version = "0.5.24";
|
|
13346
13517
|
|
|
13347
13518
|
// src/host/host-modules.ts
|
|
13348
13519
|
import * as react from "react";
|
|
@@ -13429,7 +13600,7 @@ function Spacefront(props) {
|
|
|
13429
13600
|
}
|
|
13430
13601
|
|
|
13431
13602
|
// src/npm.ts
|
|
13432
|
-
import { z as
|
|
13603
|
+
import { z as z54 } from "zod";
|
|
13433
13604
|
export {
|
|
13434
13605
|
ACQUISITION_KIND_LABELS,
|
|
13435
13606
|
ACTIVE_PANEL_ATTR,
|
|
@@ -13462,9 +13633,21 @@ export {
|
|
|
13462
13633
|
AttributeScopeBucketSchema,
|
|
13463
13634
|
AttributeScopeConfigSchema,
|
|
13464
13635
|
AvailabilityStatusSchema,
|
|
13636
|
+
BOARD_MAX_FACTS,
|
|
13637
|
+
BOARD_MAX_ITEMS,
|
|
13638
|
+
BOARD_NAMESPACE,
|
|
13639
|
+
BOARD_NAME_MAX,
|
|
13640
|
+
BOARD_TITLE_MAX,
|
|
13465
13641
|
BRAND_MARK_MAX_BYTES,
|
|
13466
13642
|
BRAND_MARK_SLOTS,
|
|
13467
13643
|
BRAND_MARK_TYPES,
|
|
13644
|
+
BoardEditSchema,
|
|
13645
|
+
BoardFactSchema,
|
|
13646
|
+
BoardItemSchema,
|
|
13647
|
+
BoardMemberSchema,
|
|
13648
|
+
BoardProjectionSchema,
|
|
13649
|
+
BoardShareSchema,
|
|
13650
|
+
BoardStateSchema,
|
|
13468
13651
|
BotCheckNoticeProvider,
|
|
13469
13652
|
BotCheckNoticeSchema,
|
|
13470
13653
|
BrandMarkImageSchema,
|
|
@@ -13559,6 +13742,7 @@ export {
|
|
|
13559
13742
|
EntryContextSchema,
|
|
13560
13743
|
EntryContextValueSchema,
|
|
13561
13744
|
FACT_SHAPE,
|
|
13745
|
+
FEED_QUESTION_FLOW,
|
|
13562
13746
|
FEED_SECTION_FLOW,
|
|
13563
13747
|
FLOW_OUTPUT_SIGNAL,
|
|
13564
13748
|
FUNNEL_STEPS,
|
|
@@ -13592,6 +13776,7 @@ export {
|
|
|
13592
13776
|
ItemTransitionGroup,
|
|
13593
13777
|
JSON_PATCH_OPS,
|
|
13594
13778
|
JsonPatchOpSchema,
|
|
13779
|
+
LANDING_PATH_PARAM,
|
|
13595
13780
|
LateBoundValueSchema,
|
|
13596
13781
|
LlmSessionsDailySchema,
|
|
13597
13782
|
LlmUsageBySessionSchema,
|
|
@@ -13640,6 +13825,7 @@ export {
|
|
|
13640
13825
|
ProjectionPreferencesSchema,
|
|
13641
13826
|
ProjectionSetPayloadSchema,
|
|
13642
13827
|
ProjectionSignalBridge,
|
|
13828
|
+
QueueSortKeySchema,
|
|
13643
13829
|
REACTIONS_NAMESPACE,
|
|
13644
13830
|
REFERRER_HOST_PARAM,
|
|
13645
13831
|
REGISTRY_CLICKED,
|
|
@@ -13658,6 +13844,7 @@ export {
|
|
|
13658
13844
|
SDK_SHIMS,
|
|
13659
13845
|
SDK_VERSION_PATTERN,
|
|
13660
13846
|
SELECTION_ORIGIN_VISITOR,
|
|
13847
|
+
SESSION_UNAVAILABLE_CLOSE,
|
|
13661
13848
|
SIGNAL_PATCH_PREFIX,
|
|
13662
13849
|
SOCKET_BEARER_SUBPROTOCOL_PREFIX,
|
|
13663
13850
|
SOCKET_SUBPROTOCOL,
|
|
@@ -13766,6 +13953,7 @@ export {
|
|
|
13766
13953
|
attachmentFailureOfStatus,
|
|
13767
13954
|
bareComponentType,
|
|
13768
13955
|
bearerFromSocketProtocols,
|
|
13956
|
+
boardLabelKey,
|
|
13769
13957
|
buildBaseAttributesConfig,
|
|
13770
13958
|
buildBucketLabelsConfig,
|
|
13771
13959
|
buildComparisonRows,
|
|
@@ -13922,6 +14110,7 @@ export {
|
|
|
13922
14110
|
preselectFromFacts,
|
|
13923
14111
|
presenceFactShape,
|
|
13924
14112
|
presenceReducer,
|
|
14113
|
+
previewBoardEdit,
|
|
13925
14114
|
primedEntities,
|
|
13926
14115
|
primedEntitiesFor,
|
|
13927
14116
|
productTypeBucket,
|
|
@@ -14019,6 +14208,7 @@ export {
|
|
|
14019
14208
|
selectedOptionsToRecord,
|
|
14020
14209
|
serverState,
|
|
14021
14210
|
serverStateEntries,
|
|
14211
|
+
serverStateRev,
|
|
14022
14212
|
serverStateVector,
|
|
14023
14213
|
setAgentPresenceFrame,
|
|
14024
14214
|
setCanvasProfile,
|
|
@@ -14064,6 +14254,7 @@ export {
|
|
|
14064
14254
|
useAnalyticsSink,
|
|
14065
14255
|
useAskAbout,
|
|
14066
14256
|
useAskStore,
|
|
14257
|
+
useBoard,
|
|
14067
14258
|
useBotCheckNotice,
|
|
14068
14259
|
useCanvasActions,
|
|
14069
14260
|
useCanvasArrangement,
|
|
@@ -14183,6 +14374,7 @@ export {
|
|
|
14183
14374
|
useScanning,
|
|
14184
14375
|
useScrollContainerRef,
|
|
14185
14376
|
useScrollHasMoreBelow,
|
|
14377
|
+
useSeedLayout,
|
|
14186
14378
|
useSelectMessage,
|
|
14187
14379
|
useSessionId,
|
|
14188
14380
|
useSessionMessages,
|
|
@@ -14229,5 +14421,5 @@ export {
|
|
|
14229
14421
|
withQueuedDiscountCodes,
|
|
14230
14422
|
withSignalTurn,
|
|
14231
14423
|
withoutClosingQuestion,
|
|
14232
|
-
|
|
14424
|
+
z54 as z
|
|
14233
14425
|
};
|