@wix/himalaya-cli 0.1425.0 → 0.1427.0
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/cli.mjs
CHANGED
|
@@ -122286,6 +122286,8 @@ function makeCtx(tokens2, scheme = "light", opts = {}) {
|
|
|
122286
122286
|
assetBaseUrl: opts.assetBaseUrl,
|
|
122287
122287
|
runtimeDegraded: opts.runtimeDegraded,
|
|
122288
122288
|
previewSurface: opts.previewSurface,
|
|
122289
|
+
debugUnknownComponents: opts.debugUnknownComponents,
|
|
122290
|
+
appId: opts.appId,
|
|
122289
122291
|
idiomContext: opts.idiomContext,
|
|
122290
122292
|
idiom: controlIdiomFor(opts.idiomContext)
|
|
122291
122293
|
};
|
|
@@ -125197,15 +125199,24 @@ function renderInner(node, ctx) {
|
|
|
125197
125199
|
default: {
|
|
125198
125200
|
const intent = pkg ? ctx.intents?.[`${pkg}.${type}`] : void 0;
|
|
125199
125201
|
if (intent) return /* @__PURE__ */ jsx10("div", { style: { alignSelf: "stretch", ...wrap }, children: intent(props, ctx) });
|
|
125200
|
-
|
|
125201
|
-
return /* @__PURE__ */ jsxs7("div", { "data-unknown-type": type, style: { display: "flex", flexDirection: "column", gap: 6, padding: 6, border: `1px dashed ${C2("border", "#c5cdd6")}`, borderRadius: 6, ...wrap }, children: [
|
|
125202
|
-
/* @__PURE__ */ jsx10("div", { style: { alignSelf: "flex-start", fontSize: pxToRem(9), fontWeight: 700, letterSpacing: 0.4, padding: "1px 6px", borderRadius: 999, background: C2("surfaceTertiary", "#f0f0f3"), color: C2("textSecondary", "#9aa2ad"), fontFamily: "ui-monospace, monospace" }, children: type }),
|
|
125203
|
-
childKeys.map(([k2, v2]) => /* @__PURE__ */ jsx10(React9.Fragment, { children: Array.isArray(v2) ? kids2(v2.filter(isNodeLike), ctx) : renderNode(v2, ctx) }, k2))
|
|
125204
|
-
] });
|
|
125202
|
+
return /* @__PURE__ */ jsx10(UnknownComponentNode, { pkg: pkg ?? "himalaya", type, props, ctx, wrap });
|
|
125205
125203
|
}
|
|
125206
125204
|
}
|
|
125207
125205
|
}
|
|
125208
|
-
|
|
125206
|
+
function reportUnknownComponent(ctx, pkg, type) {
|
|
125207
|
+
if (!ctx.emitTelemetry) return false;
|
|
125208
|
+
const key2 = JSON.stringify([ctx.appId ?? null, ctx.screenId ?? null, pkg, type]);
|
|
125209
|
+
if (reportedUnknownComponents.has(key2)) return false;
|
|
125210
|
+
reportedUnknownComponents.add(key2);
|
|
125211
|
+
const payload = { pkg, type };
|
|
125212
|
+
if (ctx.screenId) payload.screenId = ctx.screenId;
|
|
125213
|
+
ctx.emitTelemetry("unknown_component_fallback", payload, ctx.screenId);
|
|
125214
|
+
return true;
|
|
125215
|
+
}
|
|
125216
|
+
function unknownComponentShowsDeveloperLabel(ctx) {
|
|
125217
|
+
return ctx.debugUnknownComponents ?? ctx.previewSurface != null;
|
|
125218
|
+
}
|
|
125219
|
+
var useIsomorphicLayoutEffect, ResponsiveGrid, SPLIT_EXPANDED_MIN_WIDTH, SPLIT_COLUMN_GAP, ResponsiveSplitView, ABSOLUTE_URL_RE, appearKeyframesInjected, valueSwapKeyframesInjected, NUMERIC_TEXT, shimmerKeyframesInjected, pressStylesInjected, REVEAL_ON_FOCUS_ATTR, FOCUS_RING_CSS, focusStylesInjected, HLIST_CHILD_CSS, hListStylesInjected, listAnimateRuntimeInstalled, transitionKeyframesInjected, countUpRuntimeInjected, MEASURE_PREFIX, measureRuntimeInjected, revealRuntimeInjected, AMBIENT_HOST_STYLE, AmbientMotionBox, vectorAnimStylesInjected, scrollProgressRuntimeInjected, confettiRuntimeInjected, lottieRuntimeInjected, riveRuntimeInjected, gradientKeyframesInjected, parallaxRuntimeInjected, spinKeyframesInjected, marqueeKeyframesInjected, alignItems, zJustifyItems, hAlignItems, bodyFont, kids2, rowKidCtx, rowKids, staggeredKids, asTextL10n, asFinalTextL10n, asBoundText, useBoundString, InterpolatedTextView, txt, selectFragmentCase, fragmentValueHash, fragmentSlotContent, FragmentSlotNode, RichContentEditorNode, MediaFieldNode, WorkerSubtreeNode, RichContentNode, resolveItemDeep2, resolveRowAction2, resolveSwipeActions, resolveModBindings, resolvedComponentId, directServiceBindings, withRootStyle, ReactiveDirectScalars, HiddenGate, ExitPresence, StatefulSectionNode, KEYBOARD_INPUT_MODES, AUTOCAPITALIZE_VALUES, ENTER_KEY_HINTS, AUTOGROW_CEILING, EditableField, MENU_LONG_PRESS_MS, MenuNode, LoadMoreSentinel, FieldErrorNode, FormView, MediaSlotProvider, MEDIA_ITEM_BINDABLE, MediaPlayerView, VideoNode, PdfDocumentCanvas, PdfViewNode, WebViewNode, InteractivePicker, InteractiveDatePicker, InteractiveSearchField, InteractiveStepper, NODE_EXTRAS_TARGET, SYNTHETIC_TAP_ROLE, SYNTHETIC_TABINDEX, INFERRED_DECORATIVE, SELF_RENDERED_LEAF, ROLE_WHEN_NAMED, AUTHORED_ROLE, PENDING_RANGE, RANGE_ROLES, NODE_A11Y_ATTRS, INTERACTIVE_ROLES, ALWAYS_INTERACTIVE_COMPONENT_TYPES, TAP_ACTIVATOR_ATTR, TAP_GROUP_ATTR, NESTED_CONTROL_SELECTOR, VISUALLY_HIDDEN, NAME_SKIP_SELECTOR, activatorNameObservers, ACTIVATOR_STATE_ATTRS, controlNode, ToggleNode, SliderNode, SelectionControlNode, TabsNode, SegmentedControlNode, DisclosureGroupNode, GridNode, SplitViewNode, REVEAL_RELEASE_MS, REVEAL_FADE_MS, REVEAL_BUFFER, revealProgress, countWords, RevealText, TextNode, ImageNode, ANIMATION_LEAF, LottieNode, RiveNode, AvatarNode, IconNode, EMPTY_STATE_SPACING, EmptyStateNode, ButtonNode, OtpInputNode, ProgressBarNode, ACTIVITY_DEFAULT_NAME, ActivityIndicatorNode, NATIVELY_TABBABLE, BottomSheetNode, BOTTOM_DRAWER_HOST_STACK_EVENT, ModalBottomSheetNode, BottomDrawerNode, PRESENTED_OVERLAY_ATTR, PopoverNode, ChipsInputNode, ChipNode, TableNode, GaugeRing, GaugeNode, RATING_METRICS, ratingMetrics, RatingNode, AvatarStripNode, CHART_STROKE_CYCLE, chartStrokeAt, chartBarCenter, ChartNode, donutSliceOpacity, DonutChartNode, LegendMarker, LegendNode, cellAlign, DataTableNode, voiceNoteState, voiceNoteDelivery, VOICE_NOTE_DEFAULT_BARS, clampBarCount, VoiceNoteNode, TimelineNode, PagingNode, WheelPickerNode, ColorPickerNode, FilterChipsNode, TILE_PX, MAX_MERCATOR_LAT, DEFAULT_TILE_MAX_ZOOM, CIRCLE_SEGMENTS, METRES_PER_DEG_LAT, MARKER_HIT_RADIUS, SHAPE_HIT_RADIUS, MapNode, CAROUSEL_SETTLE_MS, scrollCarouselTo, CarouselNode, BannerNode, CollapsingHeaderNode, UnsupportedOnSurface, CALENDAR_DATE_ONLY_RE, CAL_DEFAULT_MAX_DOTS, CAL_AGENDA_INITIAL_DAYS, CAL_AGENDA_PAGE_DAYS, CAL_DEFAULT_SNAP_MINUTES, CAL_UNASSIGNED_LANE_ID, MonthCalendarNode, TimeGridNode, AgendaNode, ARIA_ROLE, initialFocusScheduled, PRESENTED_SCOPE, focusRoots, A11yHintDescription, reportedUnknownComponents, UnknownComponentNode, WebRenderer;
|
|
125209
125220
|
var init_renderNode = __esm({
|
|
125210
125221
|
"../../core/web-renderer/src/renderNode.tsx"() {
|
|
125211
125222
|
"use strict";
|
|
@@ -130460,6 +130471,31 @@ var init_renderNode = __esm({
|
|
|
130460
130471
|
/* @__PURE__ */ jsx10("span", { id: descId, hidden: true, "data-hm-a11y-hint": "", children: hint })
|
|
130461
130472
|
] });
|
|
130462
130473
|
};
|
|
130474
|
+
reportedUnknownComponents = /* @__PURE__ */ new Set();
|
|
130475
|
+
UnknownComponentNode = ({ pkg, type, props, ctx, wrap, ...extras }) => {
|
|
130476
|
+
const hasTelemetry = !!ctx.emitTelemetry;
|
|
130477
|
+
React9.useEffect(() => {
|
|
130478
|
+
reportUnknownComponent(ctx, pkg, type);
|
|
130479
|
+
}, [ctx.appId, ctx.screenId, hasTelemetry, pkg, type]);
|
|
130480
|
+
const { style: extraStyle, children: extraChildren, ...attrs } = extras;
|
|
130481
|
+
const nodeProps = (entries) => entries.filter(([, v2]) => isNodeLike(v2) || Array.isArray(v2) && v2.some(isNodeLike));
|
|
130482
|
+
const renderProps = (entries) => entries.map(([k2, v2]) => /* @__PURE__ */ jsx10(React9.Fragment, { children: Array.isArray(v2) ? kids2(v2.filter(isNodeLike), ctx) : renderNode(v2, ctx) }, k2));
|
|
130483
|
+
const childKeys = nodeProps(Object.entries(props ?? {}));
|
|
130484
|
+
if (!unknownComponentShowsDeveloperLabel(ctx)) {
|
|
130485
|
+
const contentKeys = childKeys.filter(([k2]) => k2 === "child" || k2 === "children");
|
|
130486
|
+
if (contentKeys.length) return /* @__PURE__ */ jsxs7("div", { ...attrs, "data-unknown-type": type, style: { display: "contents" }, children: [
|
|
130487
|
+
renderProps(contentKeys),
|
|
130488
|
+
extraChildren
|
|
130489
|
+
] });
|
|
130490
|
+
return /* @__PURE__ */ jsx10("div", { ...attrs, "data-unknown-type": type, hidden: true, "aria-hidden": "true", style: { display: "none" } });
|
|
130491
|
+
}
|
|
130492
|
+
const C2 = ctx.color;
|
|
130493
|
+
return /* @__PURE__ */ jsxs7("div", { ...attrs, "data-unknown-type": type, style: { display: "flex", flexDirection: "column", gap: 6, padding: 6, border: `1px dashed ${C2("border", "#c5cdd6")}`, borderRadius: 6, ...wrap, ...extraStyle }, children: [
|
|
130494
|
+
/* @__PURE__ */ jsx10("div", { style: { alignSelf: "flex-start", fontSize: pxToRem(9), fontWeight: 700, letterSpacing: 0.4, padding: "1px 6px", borderRadius: 999, background: C2("surfaceTertiary", "#f0f0f3"), color: C2("textSecondary", "#9aa2ad"), fontFamily: "ui-monospace, monospace" }, children: type }),
|
|
130495
|
+
renderProps(childKeys),
|
|
130496
|
+
extraChildren
|
|
130497
|
+
] });
|
|
130498
|
+
};
|
|
130463
130499
|
WebRenderer = ({ node, tokens: tokens2, scheme = "light", opts }) => {
|
|
130464
130500
|
return /* @__PURE__ */ jsx10(Fragment4, { children: renderNode(node, makeCtx(tokens2, scheme, opts)) });
|
|
130465
130501
|
};
|
|
@@ -130476,7 +130512,8 @@ function renderDescriptorToHtml(payload, tokens2, scheme = "light", provider = n
|
|
|
130476
130512
|
staticRender: true,
|
|
130477
130513
|
...typeof width === "number" && Number.isFinite(width) && width > 0 ? { sizeClass: sizeClassFromWidth(width), containerWidth: width } : {},
|
|
130478
130514
|
...rtl ? { isRTL: true } : {},
|
|
130479
|
-
...opts?.idiomContext ? { idiomContext: opts.idiomContext } : {}
|
|
130515
|
+
...opts?.idiomContext ? { idiomContext: opts.idiomContext } : {},
|
|
130516
|
+
...opts?.debugUnknownComponents ? { debugUnknownComponents: true } : {}
|
|
130480
130517
|
});
|
|
130481
130518
|
const FOCUS_STYLE_MARKUP = `<style data-himalaya-focus-ring>${FOCUS_RING_CSS}</style>`;
|
|
130482
130519
|
const withFocusRing = (markup) => markup ? FOCUS_STYLE_MARKUP + markup : markup;
|
|
@@ -130934,7 +130971,9 @@ async function renderDescriptorWeb(descriptor, tokens2, scheme, wantPng, service
|
|
|
130934
130971
|
provider,
|
|
130935
130972
|
width,
|
|
130936
130973
|
stickyHeader || stickyFooter ? { stickyHeader, stickyFooter } : void 0,
|
|
130937
|
-
|
|
130974
|
+
// #4497 — the agent fast loop is a dev tool: an unknown component type keeps its
|
|
130975
|
+
// developer label here (a shipped web app renders nothing for it).
|
|
130976
|
+
{ ...isRTL ? { isRTL: true } : {}, ...idiomContext ? { idiomContext } : {}, debugUnknownComponents: true }
|
|
130938
130977
|
);
|
|
130939
130978
|
} catch (err) {
|
|
130940
130979
|
return {
|
|
@@ -159931,32 +159970,32 @@ var init_preview_assets_generated = __esm({
|
|
|
159931
159970
|
"../../packages/serve/src/preview-assets.generated.ts"() {
|
|
159932
159971
|
init_preview_assets_format();
|
|
159933
159972
|
PREVIEW_ASSET_MANIFEST = [
|
|
159934
|
-
{ key: "assets/DashboardHost-
|
|
159935
|
-
{ key: "assets/DevDrawer-
|
|
159936
|
-
{ key: "assets/IdiomCompare-
|
|
159937
|
-
{ key: "assets/LightboxViewer-
|
|
159938
|
-
{ key: "assets/PhonePreviewControl-
|
|
159939
|
-
{ key: "assets/SchemeCompare-
|
|
159940
|
-
{ key: "assets/index-
|
|
159941
|
-
{ key: "assets/pdf-
|
|
159942
|
-
{ key: "assets/pdf.worker.min-BQa_JDET.js", contentType: "application/javascript; charset=utf-8", offset:
|
|
159943
|
-
{ key: "assets/pdf.worker.min-BmVo14Nb.mjs", contentType: "application/javascript; charset=utf-8", offset:
|
|
159944
|
-
{ key: "assets/pdfDocument-
|
|
159945
|
-
{ key: "fonts/Roboto-LICENSE.txt", contentType: "application/octet-stream", offset:
|
|
159946
|
-
{ key: "fonts/Roboto-Variable.ttf", contentType: "font/ttf", offset:
|
|
159947
|
-
{ key: "fonts/WixMadeforDisplay-Bold.ttf", contentType: "font/ttf", offset:
|
|
159948
|
-
{ key: "fonts/WixMadeforDisplay-ExtraBold.ttf", contentType: "font/ttf", offset:
|
|
159949
|
-
{ key: "fonts/WixMadeforDisplay-Medium.ttf", contentType: "font/ttf", offset:
|
|
159950
|
-
{ key: "fonts/WixMadeforDisplay-Regular.ttf", contentType: "font/ttf", offset:
|
|
159951
|
-
{ key: "fonts/WixMadeforDisplay-SemiBold.ttf", contentType: "font/ttf", offset:
|
|
159952
|
-
{ key: "fonts/WixMadeforText-Bold.ttf", contentType: "font/ttf", offset:
|
|
159953
|
-
{ key: "fonts/WixMadeforText-ExtraBold.ttf", contentType: "font/ttf", offset:
|
|
159954
|
-
{ key: "fonts/WixMadeforText-Medium.ttf", contentType: "font/ttf", offset:
|
|
159955
|
-
{ key: "fonts/WixMadeforText-Regular.ttf", contentType: "font/ttf", offset:
|
|
159956
|
-
{ key: "fonts/WixMadeforText-SemiBold.ttf", contentType: "font/ttf", offset:
|
|
159957
|
-
{ key: "himi-sw.js", contentType: "application/javascript; charset=utf-8", offset:
|
|
159958
|
-
{ key: "index.html", contentType: "text/html; charset=utf-8", offset:
|
|
159959
|
-
{ key: "t5-frame.html", contentType: "text/html; charset=utf-8", offset:
|
|
159973
|
+
{ key: "assets/DashboardHost-DAO-rMWL.js", contentType: "application/javascript; charset=utf-8", offset: 8, length: 2916, sha256: "2d1247adf113161d444c1a0e22cb04c9d83e603332fec188b2f642b403d0c7a7" },
|
|
159974
|
+
{ key: "assets/DevDrawer-D_q_fays.js", contentType: "application/javascript; charset=utf-8", offset: 2924, length: 16744, sha256: "64098416ad161eb06f7d03ce0fef4f1767dea86eddcd96b7b4575f16b0d5f076" },
|
|
159975
|
+
{ key: "assets/IdiomCompare-Bd-HANgZ.js", contentType: "application/javascript; charset=utf-8", offset: 19668, length: 1892, sha256: "09566d576783834c9fa3d53ed237ee3b0c5190c883af134346a8e2be49a77dcd" },
|
|
159976
|
+
{ key: "assets/LightboxViewer-CVRTkaYU.js", contentType: "application/javascript; charset=utf-8", offset: 21560, length: 8132, sha256: "b44394f05c22bbfdee01e244569006f4facea828ceb5f8254e237e7fbda75074" },
|
|
159977
|
+
{ key: "assets/PhonePreviewControl-gd29EplR.js", contentType: "application/javascript; charset=utf-8", offset: 29692, length: 37729, sha256: "6a5242bcde853e44f167fec0152cc31cade7dcc91dcd40bd40454482410f60fb" },
|
|
159978
|
+
{ key: "assets/SchemeCompare-BJpHRsfB.js", contentType: "application/javascript; charset=utf-8", offset: 67421, length: 1824, sha256: "405b08d3f254b238de808980391ea64f29b373717d2f37c28ffad714e80696c4" },
|
|
159979
|
+
{ key: "assets/index-DsL8IH-9.js", contentType: "application/javascript; charset=utf-8", offset: 69245, length: 1255677, sha256: "25ae3f3f168c96a6d824cab980d12eeb2f17625e2a5d7a1ff705427bffd72875" },
|
|
159980
|
+
{ key: "assets/pdf-Di3QVsBe.js", contentType: "application/javascript; charset=utf-8", offset: 1324922, length: 488199, sha256: "61410658efd7db37197efbef29ecf40f3b8a30557b192a94e44cbe3d0d2da213" },
|
|
159981
|
+
{ key: "assets/pdf.worker.min-BQa_JDET.js", contentType: "application/javascript; charset=utf-8", offset: 1813121, length: 73, sha256: "41bcfda4f3c8c0a81c785ea87c69afc8e7d0ed8c333324aee94c273d881bb6aa" },
|
|
159982
|
+
{ key: "assets/pdf.worker.min-BmVo14Nb.mjs", contentType: "application/javascript; charset=utf-8", offset: 1813194, length: 1317034, sha256: "a33cfe728c584fdba4fcc1fd54bcdc2f9f2f13889ddbb5b2bd1d0f8cbe49b84e" },
|
|
159983
|
+
{ key: "assets/pdfDocument-D71exx6d.js", contentType: "application/javascript; charset=utf-8", offset: 3130228, length: 2868, sha256: "8ed3de628f76f7944f24d20ba875ea40d6308afe2366ddb462eabf36280db26e" },
|
|
159984
|
+
{ key: "fonts/Roboto-LICENSE.txt", contentType: "application/octet-stream", offset: 3133096, length: 4610, sha256: "994062dd7af4186a739de55dd9e151c63b6301f8e2cbafc608d35c2e87da0cd2" },
|
|
159985
|
+
{ key: "fonts/Roboto-Variable.ttf", contentType: "font/ttf", offset: 3137706, length: 488584, sha256: "d7598e12c5dbef095ff8272cfc55da0250bd07fbdecbac8a530b9b277872a134" },
|
|
159986
|
+
{ key: "fonts/WixMadeforDisplay-Bold.ttf", contentType: "font/ttf", offset: 3626290, length: 90924, sha256: "ec4c7d63772d980d6e147b2df6215fd2737e4b04cebe0cf7e11dc695fb63cdcf" },
|
|
159987
|
+
{ key: "fonts/WixMadeforDisplay-ExtraBold.ttf", contentType: "font/ttf", offset: 3717214, length: 90984, sha256: "bf4c16a2774edd38a921edf3099469866cd74c094fd596f3fa4e81f54a04dfaa" },
|
|
159988
|
+
{ key: "fonts/WixMadeforDisplay-Medium.ttf", contentType: "font/ttf", offset: 3808198, length: 90980, sha256: "368faca44fb9f7207e4af784e94750b1ee59c1098b8689e0f4a918926f244fb5" },
|
|
159989
|
+
{ key: "fonts/WixMadeforDisplay-Regular.ttf", contentType: "font/ttf", offset: 3899178, length: 90872, sha256: "97ed8f1a6772abe26e3d8af5cecfc4b02faa94497d585b0398b5053b739a70c1" },
|
|
159990
|
+
{ key: "fonts/WixMadeforDisplay-SemiBold.ttf", contentType: "font/ttf", offset: 3990050, length: 90980, sha256: "642feab8a48ddf6c7a89d7c2a7c0edfa0e6e773f671287e460e222703563191e" },
|
|
159991
|
+
{ key: "fonts/WixMadeforText-Bold.ttf", contentType: "font/ttf", offset: 4081030, length: 108636, sha256: "37c179b4fefb63ea9637322b84583a2df53aa226c150294eea1675c14b1b8e29" },
|
|
159992
|
+
{ key: "fonts/WixMadeforText-ExtraBold.ttf", contentType: "font/ttf", offset: 4189666, length: 109084, sha256: "62e2fe4718129f36ecdb0ae4de385bd6b81ecc876146447167c6c140fad699a9" },
|
|
159993
|
+
{ key: "fonts/WixMadeforText-Medium.ttf", contentType: "font/ttf", offset: 4298750, length: 109048, sha256: "4ecf270136af928612c76fe4ebade91d8156975e5ea4c0cf9225501dd1788e02" },
|
|
159994
|
+
{ key: "fonts/WixMadeforText-Regular.ttf", contentType: "font/ttf", offset: 4407798, length: 107700, sha256: "dee56f09fd3efc127c1ea95557edc74110c1460a46287da36e0af25efd341ef5" },
|
|
159995
|
+
{ key: "fonts/WixMadeforText-SemiBold.ttf", contentType: "font/ttf", offset: 4515498, length: 88108, sha256: "dced97a77624bc5f8b1ae65850360908297f4588e09feb6f22792d29dc7e765b" },
|
|
159996
|
+
{ key: "himi-sw.js", contentType: "application/javascript; charset=utf-8", offset: 4603606, length: 6748, sha256: "4a92459977d7cefa1a6a7e020c3a63509737f083b3f2773557c1a5771665811a" },
|
|
159997
|
+
{ key: "index.html", contentType: "text/html; charset=utf-8", offset: 4610354, length: 4947, sha256: "87e59dc14f91a652f71d23ccb219eb080b20cfc7716a1f27accbae3a1f4abfbd" },
|
|
159998
|
+
{ key: "t5-frame.html", contentType: "text/html; charset=utf-8", offset: 4615301, length: 17768, sha256: "a47dec8623a0f58def7d8785ee74d08483626e75d07c9328bfc9ecb2172c2e0d" }
|
|
159960
159999
|
];
|
|
159961
160000
|
}
|
|
159962
160001
|
});
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/himalaya-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1427.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "himi — the Himalaya authoring CLI. Build a Tier-5 content package on your own machine, push it to the production serve as a draft, preview it on web + Himi Player, and read worker logs back — the remote dev loop. Wraps @himalaya/serve-cli for transport.",
|
|
6
6
|
"keywords": [
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"artifactId": "himalaya-cli"
|
|
72
72
|
}
|
|
73
73
|
},
|
|
74
|
-
"falconPackageHash": "
|
|
74
|
+
"falconPackageHash": "b4d2420d483886e1ce73160edcfdc6a91646977229bb741920a0ea2f"
|
|
75
75
|
}
|
|
@@ -34620,71 +34620,294 @@ const SCREENS = runtimeSetting({
|
|
|
34620
34620
|
"itemsPath": "$service:spacesChatThread.messages",
|
|
34621
34621
|
"items": [
|
|
34622
34622
|
{
|
|
34623
|
-
"id": "",
|
|
34623
|
+
"id": "himi_chat_thread.message_$item.id",
|
|
34624
34624
|
"body": {
|
|
34625
34625
|
"package": "himalaya",
|
|
34626
|
-
"type": "
|
|
34626
|
+
"type": "VStack",
|
|
34627
34627
|
"props": {
|
|
34628
|
+
"spacing": 6,
|
|
34628
34629
|
"children": [
|
|
34629
34630
|
{
|
|
34630
34631
|
"id": "",
|
|
34631
34632
|
"body": {
|
|
34632
34633
|
"package": "himalaya",
|
|
34633
|
-
"type": "
|
|
34634
|
+
"type": "HStack",
|
|
34634
34635
|
"props": {
|
|
34635
|
-
"
|
|
34636
|
-
"
|
|
34636
|
+
"spacing": 8,
|
|
34637
|
+
"children": [
|
|
34638
|
+
{
|
|
34639
|
+
"id": "",
|
|
34640
|
+
"body": {
|
|
34641
|
+
"package": "himalaya",
|
|
34642
|
+
"type": "Spacer",
|
|
34643
|
+
"props": {}
|
|
34644
|
+
}
|
|
34645
|
+
},
|
|
34646
|
+
{
|
|
34647
|
+
"id": "",
|
|
34648
|
+
"body": {
|
|
34649
|
+
"package": "himalaya",
|
|
34650
|
+
"type": "Text",
|
|
34651
|
+
"props": {
|
|
34652
|
+
"text": "$item.dayLabel",
|
|
34653
|
+
"style": "caption",
|
|
34654
|
+
"color": "textSecondary",
|
|
34655
|
+
"collapseWhenEmpty": true
|
|
34656
|
+
}
|
|
34657
|
+
}
|
|
34658
|
+
},
|
|
34659
|
+
{
|
|
34660
|
+
"id": "",
|
|
34661
|
+
"body": {
|
|
34662
|
+
"package": "himalaya",
|
|
34663
|
+
"type": "Spacer",
|
|
34664
|
+
"props": {}
|
|
34665
|
+
}
|
|
34666
|
+
}
|
|
34667
|
+
]
|
|
34637
34668
|
}
|
|
34669
|
+
},
|
|
34670
|
+
"modifiers": {
|
|
34671
|
+
"padding": {
|
|
34672
|
+
"leading": 16,
|
|
34673
|
+
"trailing": 16,
|
|
34674
|
+
"top": 16,
|
|
34675
|
+
"bottom": 8
|
|
34676
|
+
},
|
|
34677
|
+
"hiddenPath": "$item.dayHidden"
|
|
34638
34678
|
}
|
|
34639
34679
|
},
|
|
34640
34680
|
{
|
|
34641
34681
|
"id": "",
|
|
34642
34682
|
"body": {
|
|
34643
34683
|
"package": "himalaya",
|
|
34644
|
-
"type": "
|
|
34684
|
+
"type": "HStack",
|
|
34645
34685
|
"props": {
|
|
34646
|
-
"spacing":
|
|
34686
|
+
"spacing": 8,
|
|
34647
34687
|
"alignment": "leading",
|
|
34648
34688
|
"children": [
|
|
34649
34689
|
{
|
|
34650
|
-
"id": "",
|
|
34690
|
+
"id": "himi_chat_thread.incoming_avatar_$item.id",
|
|
34651
34691
|
"body": {
|
|
34652
34692
|
"package": "himalaya",
|
|
34653
|
-
"type": "
|
|
34693
|
+
"type": "Image",
|
|
34654
34694
|
"props": {
|
|
34655
|
-
"
|
|
34656
|
-
"
|
|
34695
|
+
"url": "$item.avatarUrl",
|
|
34696
|
+
"initials": "$item.avatarInitials",
|
|
34697
|
+
"icon": "person",
|
|
34698
|
+
"width": 32,
|
|
34699
|
+
"height": 32,
|
|
34700
|
+
"contentMode": "fill",
|
|
34701
|
+
"shape": "circle"
|
|
34657
34702
|
}
|
|
34703
|
+
},
|
|
34704
|
+
"modifiers": {
|
|
34705
|
+
"accessibilityRole": "decorative"
|
|
34658
34706
|
}
|
|
34659
34707
|
},
|
|
34660
34708
|
{
|
|
34661
34709
|
"id": "",
|
|
34662
34710
|
"body": {
|
|
34663
34711
|
"package": "himalaya",
|
|
34664
|
-
"type": "
|
|
34712
|
+
"type": "VStack",
|
|
34665
34713
|
"props": {
|
|
34666
|
-
"
|
|
34667
|
-
"
|
|
34668
|
-
"
|
|
34669
|
-
|
|
34714
|
+
"spacing": 6,
|
|
34715
|
+
"alignment": "leading",
|
|
34716
|
+
"children": [
|
|
34717
|
+
{
|
|
34718
|
+
"id": "",
|
|
34719
|
+
"body": {
|
|
34720
|
+
"package": "himalaya",
|
|
34721
|
+
"type": "Text",
|
|
34722
|
+
"props": {
|
|
34723
|
+
"text": "$item.senderBadge",
|
|
34724
|
+
"style": "caption",
|
|
34725
|
+
"color": "accentPrimary",
|
|
34726
|
+
"maxLines": 1,
|
|
34727
|
+
"collapseWhenEmpty": true
|
|
34728
|
+
}
|
|
34729
|
+
},
|
|
34730
|
+
"modifiers": {
|
|
34731
|
+
"background": {
|
|
34732
|
+
"token": "accentSurface"
|
|
34733
|
+
},
|
|
34734
|
+
"cornerRadius": 8,
|
|
34735
|
+
"padding": {
|
|
34736
|
+
"leading": 8,
|
|
34737
|
+
"trailing": 8,
|
|
34738
|
+
"top": 4,
|
|
34739
|
+
"bottom": 4
|
|
34740
|
+
}
|
|
34741
|
+
}
|
|
34742
|
+
},
|
|
34743
|
+
{
|
|
34744
|
+
"id": "",
|
|
34745
|
+
"body": {
|
|
34746
|
+
"package": "himalaya",
|
|
34747
|
+
"type": "Text",
|
|
34748
|
+
"props": {
|
|
34749
|
+
"text": "$item.text",
|
|
34750
|
+
"style": "body",
|
|
34751
|
+
"maxLines": 50
|
|
34752
|
+
}
|
|
34753
|
+
}
|
|
34754
|
+
},
|
|
34755
|
+
{
|
|
34756
|
+
"id": "himi_chat_thread.image_$item.id",
|
|
34757
|
+
"body": {
|
|
34758
|
+
"package": "himalaya",
|
|
34759
|
+
"type": "Image",
|
|
34760
|
+
"props": {
|
|
34761
|
+
"url": "$item.imageUrl",
|
|
34762
|
+
"fillWidth": true,
|
|
34763
|
+
"aspectRatio": 1,
|
|
34764
|
+
"contentMode": "fill",
|
|
34765
|
+
"contentDescription": "$item.imageDescription"
|
|
34766
|
+
}
|
|
34767
|
+
},
|
|
34768
|
+
"modifiers": {
|
|
34769
|
+
"cornerRadius": 12,
|
|
34770
|
+
"fillMaxWidth": true,
|
|
34771
|
+
"hiddenPath": "$item.imageHidden"
|
|
34772
|
+
}
|
|
34773
|
+
},
|
|
34774
|
+
{
|
|
34775
|
+
"id": "",
|
|
34776
|
+
"body": {
|
|
34777
|
+
"package": "himalaya",
|
|
34778
|
+
"type": "Text",
|
|
34779
|
+
"props": {
|
|
34780
|
+
"text": "$item.when",
|
|
34781
|
+
"style": "caption",
|
|
34782
|
+
"color": "textSecondary",
|
|
34783
|
+
"collapseWhenEmpty": true
|
|
34784
|
+
}
|
|
34785
|
+
}
|
|
34786
|
+
}
|
|
34787
|
+
]
|
|
34788
|
+
}
|
|
34789
|
+
},
|
|
34790
|
+
"modifiers": {
|
|
34791
|
+
"background": {
|
|
34792
|
+
"token": "surfaceElevated"
|
|
34793
|
+
},
|
|
34794
|
+
"cornerRadius": 16,
|
|
34795
|
+
"maxWidth": 270,
|
|
34796
|
+
"padding": {
|
|
34797
|
+
"leading": 12,
|
|
34798
|
+
"trailing": 12,
|
|
34799
|
+
"top": 10,
|
|
34800
|
+
"bottom": 10
|
|
34670
34801
|
}
|
|
34671
34802
|
}
|
|
34803
|
+
},
|
|
34804
|
+
{
|
|
34805
|
+
"id": "",
|
|
34806
|
+
"body": {
|
|
34807
|
+
"package": "himalaya",
|
|
34808
|
+
"type": "Spacer",
|
|
34809
|
+
"props": {}
|
|
34810
|
+
}
|
|
34672
34811
|
}
|
|
34673
34812
|
]
|
|
34674
34813
|
}
|
|
34675
34814
|
},
|
|
34676
34815
|
"modifiers": {
|
|
34677
|
-
"
|
|
34678
|
-
|
|
34679
|
-
|
|
34680
|
-
|
|
34681
|
-
|
|
34682
|
-
|
|
34683
|
-
|
|
34684
|
-
|
|
34685
|
-
|
|
34686
|
-
"
|
|
34816
|
+
"hiddenPath": "$item.mine"
|
|
34817
|
+
}
|
|
34818
|
+
},
|
|
34819
|
+
{
|
|
34820
|
+
"id": "",
|
|
34821
|
+
"body": {
|
|
34822
|
+
"package": "himalaya",
|
|
34823
|
+
"type": "HStack",
|
|
34824
|
+
"props": {
|
|
34825
|
+
"spacing": 8,
|
|
34826
|
+
"alignment": "leading",
|
|
34827
|
+
"children": [
|
|
34828
|
+
{
|
|
34829
|
+
"id": "",
|
|
34830
|
+
"body": {
|
|
34831
|
+
"package": "himalaya",
|
|
34832
|
+
"type": "Spacer",
|
|
34833
|
+
"props": {}
|
|
34834
|
+
}
|
|
34835
|
+
},
|
|
34836
|
+
{
|
|
34837
|
+
"id": "",
|
|
34838
|
+
"body": {
|
|
34839
|
+
"package": "himalaya",
|
|
34840
|
+
"type": "VStack",
|
|
34841
|
+
"props": {
|
|
34842
|
+
"spacing": 6,
|
|
34843
|
+
"alignment": "leading",
|
|
34844
|
+
"children": [
|
|
34845
|
+
{
|
|
34846
|
+
"id": "",
|
|
34847
|
+
"body": {
|
|
34848
|
+
"package": "himalaya",
|
|
34849
|
+
"type": "Text",
|
|
34850
|
+
"props": {
|
|
34851
|
+
"text": "$item.text",
|
|
34852
|
+
"style": "body",
|
|
34853
|
+
"maxLines": 50
|
|
34854
|
+
}
|
|
34855
|
+
}
|
|
34856
|
+
},
|
|
34857
|
+
{
|
|
34858
|
+
"id": "himi_chat_thread.outgoing_image_$item.id",
|
|
34859
|
+
"body": {
|
|
34860
|
+
"package": "himalaya",
|
|
34861
|
+
"type": "Image",
|
|
34862
|
+
"props": {
|
|
34863
|
+
"url": "$item.imageUrl",
|
|
34864
|
+
"fillWidth": true,
|
|
34865
|
+
"aspectRatio": 1,
|
|
34866
|
+
"contentMode": "fill",
|
|
34867
|
+
"contentDescription": "$item.imageDescription"
|
|
34868
|
+
}
|
|
34869
|
+
},
|
|
34870
|
+
"modifiers": {
|
|
34871
|
+
"cornerRadius": 12,
|
|
34872
|
+
"fillMaxWidth": true,
|
|
34873
|
+
"hiddenPath": "$item.imageHidden"
|
|
34874
|
+
}
|
|
34875
|
+
},
|
|
34876
|
+
{
|
|
34877
|
+
"id": "",
|
|
34878
|
+
"body": {
|
|
34879
|
+
"package": "himalaya",
|
|
34880
|
+
"type": "Text",
|
|
34881
|
+
"props": {
|
|
34882
|
+
"text": "$item.when",
|
|
34883
|
+
"style": "caption",
|
|
34884
|
+
"color": "textSecondary",
|
|
34885
|
+
"collapseWhenEmpty": true
|
|
34886
|
+
}
|
|
34887
|
+
}
|
|
34888
|
+
}
|
|
34889
|
+
]
|
|
34890
|
+
}
|
|
34891
|
+
},
|
|
34892
|
+
"modifiers": {
|
|
34893
|
+
"background": {
|
|
34894
|
+
"token": "accentSurface"
|
|
34895
|
+
},
|
|
34896
|
+
"cornerRadius": 16,
|
|
34897
|
+
"maxWidth": 270,
|
|
34898
|
+
"padding": {
|
|
34899
|
+
"leading": 12,
|
|
34900
|
+
"trailing": 12,
|
|
34901
|
+
"top": 10,
|
|
34902
|
+
"bottom": 10
|
|
34903
|
+
}
|
|
34904
|
+
}
|
|
34905
|
+
}
|
|
34906
|
+
]
|
|
34687
34907
|
}
|
|
34908
|
+
},
|
|
34909
|
+
"modifiers": {
|
|
34910
|
+
"hiddenPath": "$item.notMine"
|
|
34688
34911
|
}
|
|
34689
34912
|
}
|
|
34690
34913
|
]
|
|
@@ -34705,15 +34928,14 @@ const SCREENS = runtimeSetting({
|
|
|
34705
34928
|
}
|
|
34706
34929
|
},
|
|
34707
34930
|
{
|
|
34708
|
-
"id": "",
|
|
34931
|
+
"id": "himi_chat_thread.empty",
|
|
34709
34932
|
"body": {
|
|
34710
34933
|
"package": "himalaya",
|
|
34711
|
-
"type": "
|
|
34934
|
+
"type": "EmptyState",
|
|
34712
34935
|
"props": {
|
|
34713
|
-
"
|
|
34714
|
-
"
|
|
34715
|
-
"
|
|
34716
|
-
"collapseWhenEmpty": true
|
|
34936
|
+
"icon": "chat",
|
|
34937
|
+
"title": "$service:spacesChatThread.emptyText",
|
|
34938
|
+
"subtitle": "Send a message to start the conversation."
|
|
34717
34939
|
}
|
|
34718
34940
|
},
|
|
34719
34941
|
"modifiers": {
|
|
@@ -34721,8 +34943,9 @@ const SCREENS = runtimeSetting({
|
|
|
34721
34943
|
"leading": 16,
|
|
34722
34944
|
"trailing": 16,
|
|
34723
34945
|
"top": 24,
|
|
34724
|
-
"bottom":
|
|
34725
|
-
}
|
|
34946
|
+
"bottom": 24
|
|
34947
|
+
},
|
|
34948
|
+
"hiddenPath": "$service:spacesChatThread.emptyHidden"
|
|
34726
34949
|
}
|
|
34727
34950
|
},
|
|
34728
34951
|
{
|
|
@@ -34864,29 +35087,37 @@ const SCREENS = runtimeSetting({
|
|
|
34864
35087
|
"bottom": 0
|
|
34865
35088
|
}
|
|
34866
35089
|
}
|
|
34867
|
-
}
|
|
34868
|
-
|
|
34869
|
-
|
|
34870
|
-
|
|
34871
|
-
|
|
34872
|
-
|
|
34873
|
-
|
|
34874
|
-
|
|
34875
|
-
|
|
34876
|
-
|
|
34877
|
-
|
|
34878
|
-
|
|
34879
|
-
|
|
34880
|
-
|
|
34881
|
-
|
|
34882
|
-
|
|
34883
|
-
|
|
34884
|
-
|
|
34885
|
-
|
|
34886
|
-
|
|
34887
|
-
|
|
34888
|
-
|
|
34889
|
-
|
|
35090
|
+
}
|
|
35091
|
+
]
|
|
35092
|
+
}
|
|
35093
|
+
},
|
|
35094
|
+
"modifiers": {
|
|
35095
|
+
"background": {
|
|
35096
|
+
"token": "surfaceSecondary"
|
|
35097
|
+
},
|
|
35098
|
+
"onAppear": {
|
|
35099
|
+
"actionId": "tier5.spacesChatThread.load"
|
|
35100
|
+
}
|
|
35101
|
+
}
|
|
35102
|
+
},
|
|
35103
|
+
"logicBundle": {
|
|
35104
|
+
"url": "http://localhost:8190/v1/bundles/wix-spaces-chat-thread?integrity=",
|
|
35105
|
+
"integrity": "",
|
|
35106
|
+
"contentType": "application/javascript+ts-bundle",
|
|
35107
|
+
"declaredCapabilities": [
|
|
35108
|
+
"wix_api"
|
|
35109
|
+
],
|
|
35110
|
+
"minBinaryVersion": "0.1.0",
|
|
35111
|
+
"bundleVersion": "0.0.1"
|
|
35112
|
+
},
|
|
35113
|
+
"stickyFooter": {
|
|
35114
|
+
"id": "himi_chat_thread.composer_footer",
|
|
35115
|
+
"body": {
|
|
35116
|
+
"package": "himalaya",
|
|
35117
|
+
"type": "VStack",
|
|
35118
|
+
"props": {
|
|
35119
|
+
"spacing": 4,
|
|
35120
|
+
"children": [
|
|
34890
35121
|
{
|
|
34891
35122
|
"id": "",
|
|
34892
35123
|
"body": {
|
|
@@ -34901,15 +35132,31 @@ const SCREENS = runtimeSetting({
|
|
|
34901
35132
|
"package": "himalaya",
|
|
34902
35133
|
"type": "TextField",
|
|
34903
35134
|
"props": {
|
|
34904
|
-
"placeholder": "
|
|
35135
|
+
"placeholder": "Type your message…",
|
|
34905
35136
|
"value": "$service:spacesChatThread.draft",
|
|
34906
35137
|
"onChange": {
|
|
34907
35138
|
"actionId": "tier5.spacesChatThread.setDraft"
|
|
34908
|
-
}
|
|
35139
|
+
},
|
|
35140
|
+
"onSubmit": {
|
|
35141
|
+
"actionId": "tier5.spacesChatThread.send"
|
|
35142
|
+
},
|
|
35143
|
+
"submitLabel": "send",
|
|
35144
|
+
"borderless": true
|
|
34909
35145
|
}
|
|
34910
35146
|
},
|
|
34911
35147
|
"modifiers": {
|
|
34912
|
-
"weight": 1
|
|
35148
|
+
"weight": 1,
|
|
35149
|
+
"accessibilityLabel": "Type your message",
|
|
35150
|
+
"padding": {
|
|
35151
|
+
"leading": 16,
|
|
35152
|
+
"trailing": 8,
|
|
35153
|
+
"top": 8,
|
|
35154
|
+
"bottom": 8
|
|
35155
|
+
},
|
|
35156
|
+
"background": {
|
|
35157
|
+
"token": "surfaceSecondary"
|
|
35158
|
+
},
|
|
35159
|
+
"cornerRadius": 28
|
|
34913
35160
|
}
|
|
34914
35161
|
},
|
|
34915
35162
|
{
|
|
@@ -34919,11 +35166,21 @@ const SCREENS = runtimeSetting({
|
|
|
34919
35166
|
"type": "Button",
|
|
34920
35167
|
"props": {
|
|
34921
35168
|
"title": "Send",
|
|
34922
|
-
"style": "primary",
|
|
34923
35169
|
"action": {
|
|
34924
35170
|
"actionId": "tier5.spacesChatThread.send"
|
|
34925
|
-
}
|
|
35171
|
+
},
|
|
35172
|
+
"style": "primary",
|
|
35173
|
+
"iconOnly": true,
|
|
35174
|
+
"leadingIcon": "send",
|
|
35175
|
+
"cornerRadius": 22,
|
|
35176
|
+
"minHeight": 44
|
|
34926
35177
|
}
|
|
35178
|
+
},
|
|
35179
|
+
"modifiers": {
|
|
35180
|
+
"width": 44,
|
|
35181
|
+
"height": 44,
|
|
35182
|
+
"accessibilityLabel": "Send",
|
|
35183
|
+
"accessibilityRole": "button"
|
|
34927
35184
|
}
|
|
34928
35185
|
}
|
|
34929
35186
|
]
|
|
@@ -34934,9 +35191,29 @@ const SCREENS = runtimeSetting({
|
|
|
34934
35191
|
"leading": 12,
|
|
34935
35192
|
"trailing": 12,
|
|
34936
35193
|
"top": 8,
|
|
34937
|
-
"bottom":
|
|
34938
|
-
}
|
|
34939
|
-
|
|
35194
|
+
"bottom": 8
|
|
35195
|
+
}
|
|
35196
|
+
}
|
|
35197
|
+
},
|
|
35198
|
+
{
|
|
35199
|
+
"id": "",
|
|
35200
|
+
"body": {
|
|
35201
|
+
"package": "himalaya",
|
|
35202
|
+
"type": "Text",
|
|
35203
|
+
"props": {
|
|
35204
|
+
"text": "$service:spacesChatThread.sendHint",
|
|
35205
|
+
"style": "footnote",
|
|
35206
|
+
"color": "accentPrimary",
|
|
35207
|
+
"collapseWhenEmpty": true
|
|
35208
|
+
}
|
|
35209
|
+
},
|
|
35210
|
+
"modifiers": {
|
|
35211
|
+
"padding": {
|
|
35212
|
+
"leading": 16,
|
|
35213
|
+
"trailing": 16,
|
|
35214
|
+
"top": 0,
|
|
35215
|
+
"bottom": 4
|
|
35216
|
+
}
|
|
34940
35217
|
}
|
|
34941
35218
|
}
|
|
34942
35219
|
]
|
|
@@ -34946,20 +35223,12 @@ const SCREENS = runtimeSetting({
|
|
|
34946
35223
|
"background": {
|
|
34947
35224
|
"token": "surfacePrimary"
|
|
34948
35225
|
},
|
|
34949
|
-
"
|
|
34950
|
-
"actionId": "tier5.spacesChatThread.load"
|
|
34951
|
-
}
|
|
35226
|
+
"hiddenPath": "$service:spacesChatThread.noEntity"
|
|
34952
35227
|
}
|
|
34953
35228
|
},
|
|
34954
|
-
"
|
|
34955
|
-
"
|
|
34956
|
-
"
|
|
34957
|
-
"contentType": "application/javascript+ts-bundle",
|
|
34958
|
-
"declaredCapabilities": [
|
|
34959
|
-
"wix_api"
|
|
34960
|
-
],
|
|
34961
|
-
"minBinaryVersion": "0.1.0",
|
|
34962
|
-
"bundleVersion": "0.0.1"
|
|
35229
|
+
"transcriptScroll": {
|
|
35230
|
+
"sendPath": "$service:spacesChatThread.scrollSend",
|
|
35231
|
+
"jumpLabel": "Jump to latest"
|
|
34963
35232
|
}
|
|
34964
35233
|
},
|
|
34965
35234
|
"himi_new_message": {
|
|
@@ -12,19 +12,28 @@
|
|
|
12
12
|
import { defineService, type PollDirective, type StreamDirective } from "@himalaya/state";
|
|
13
13
|
import { getMessages, sendChatMessage, getOrCreateDirectChatroom, getChatToken, type ChatMessage } from "@himalaya/wix-chat-web";
|
|
14
14
|
import { getMyData } from "@himalaya/wix-users";
|
|
15
|
-
import { formatMonthDayTime } from "../_shared/engine-intl.js";
|
|
15
|
+
import { formatMonthDay, formatMonthDayTime } from "../_shared/engine-intl.js";
|
|
16
|
+
import { initials } from "../_shared/himi-text.js";
|
|
17
|
+
import { copyParam, stashCopy } from "../_shared/himi-copy.js";
|
|
16
18
|
import { presence, presenceAfterError, detailInputId, type PresenceFlags } from "../_shared/detail-presence.js";
|
|
17
19
|
import { writeMayHaveLanded } from "../_shared/owner-load-error.js";
|
|
18
20
|
import { chatRealtimeConfig, createReloadGate, createSendIntents, createVisitToken, liveDirectives, postWithVisitToken, liveFallback, type ChatLiveMode, type ChatRealtimeConfig } from "../_shared/chat-live.js";
|
|
19
21
|
|
|
20
22
|
const SERVICE = "spacesChatThread";
|
|
23
|
+
const EMPTY_TEXT = "No messages yet. Say hello!";
|
|
21
24
|
|
|
22
|
-
//
|
|
23
|
-
//
|
|
24
|
-
// (
|
|
25
|
-
interface Row {
|
|
25
|
+
// `mine` / `notMine` pick the incoming or outgoing row layout (the descriptor hides the other
|
|
26
|
+
// one). Empty strings and `*Hidden` flags let a row drop its badge, avatar or attachment.
|
|
27
|
+
// `leadFill` (" " for my messages) stays for screens that right-align with a gated spacer.
|
|
28
|
+
interface Row {
|
|
29
|
+
id: string; text: string; when: string; leadFill: string; mine: boolean; notMine: boolean;
|
|
30
|
+
senderBadge: string; avatarUrl: string; avatarInitials: string;
|
|
31
|
+
imageUrl: string; imageDescription: string; imageHidden: boolean; dayLabel: string; dayHidden: boolean;
|
|
32
|
+
}
|
|
26
33
|
interface S extends PresenceFlags {
|
|
27
|
-
status: "loading" | "ready"; messages: Row[]; emptyText: string; draft: string; sendHint: string; resolvedChatroomId: string; myUserId: string;
|
|
34
|
+
status: "loading" | "ready"; messages: Row[]; emptyText: string; emptyHidden: boolean; draft: string; sendHint: string; resolvedChatroomId: string; myUserId: string;
|
|
35
|
+
/** Send token for the host's transcript scroll: a new value follows the tail. */
|
|
36
|
+
scrollSend: string;
|
|
28
37
|
/** Which path keeps the open thread live (diagnostic). */
|
|
29
38
|
live?: ChatLiveMode;
|
|
30
39
|
_stream?: StreamDirective;
|
|
@@ -55,14 +64,61 @@ async function resolveChatroomId(raw: string, kind: string): Promise<string> {
|
|
|
55
64
|
function val(arg?: unknown): string {
|
|
56
65
|
return typeof arg === "string" ? arg : ((arg as { value?: string; text?: string })?.value ?? (arg as { text?: string })?.text ?? "");
|
|
57
66
|
}
|
|
58
|
-
function
|
|
59
|
-
|
|
60
|
-
|
|
67
|
+
function dayKeyOf(d: Date): string {
|
|
68
|
+
return `${d.getFullYear()}-${d.getMonth()}-${d.getDate()}`;
|
|
69
|
+
}
|
|
70
|
+
/** chat-web marks the business side as "business", "businessUser" or "user" (the same predicate
|
|
71
|
+
* as wix-owner-inbox-thread); a visitor or member is anything else. */
|
|
72
|
+
function isBusinessSender(m: ChatMessage): boolean {
|
|
73
|
+
const type = String(m.sender?.type ?? "").toLowerCase();
|
|
74
|
+
return type === "business" || type === "businessuser" || type === "user";
|
|
75
|
+
}
|
|
76
|
+
function norm(m: ChatMessage, i: number, myUserId: string): Row & { timestamp: number; dayKey: string } {
|
|
77
|
+
const mm = m as unknown as {
|
|
78
|
+
id?: string; summary?: string; data?: Array<{ mimeType?: string; data?: { text?: string; uri?: string; thumbnailUrl?: string } }>;
|
|
79
|
+
payload?: { text?: string }; content?: string; createdAt?: number; createdDate?: string;
|
|
80
|
+
senderDisplayData?: { name?: string; image?: { url?: string } };
|
|
81
|
+
};
|
|
82
|
+
const text = mm.data?.find((part) => part.data?.text)?.data?.text || mm.summary || mm.payload?.text || mm.content || "";
|
|
61
83
|
const ms = mm.createdAt || (mm.createdDate ? Date.parse(mm.createdDate) : 0);
|
|
62
|
-
const
|
|
84
|
+
const date = ms ? new Date(ms) : null;
|
|
85
|
+
const senderName = mm.senderDisplayData?.name || "";
|
|
86
|
+
const avatarUrl = mm.senderDisplayData?.image?.url || "";
|
|
87
|
+
const image = mm.data?.find((part) => part.mimeType?.startsWith("image/") || part.data?.thumbnailUrl);
|
|
88
|
+
const imageUrl = image?.data?.thumbnailUrl || image?.data?.uri || "";
|
|
63
89
|
// Mine when the message sender matches my user id (resolved once per load).
|
|
64
90
|
const mine = !!(myUserId && m.sender?.userId && m.sender.userId === myUserId);
|
|
65
|
-
return {
|
|
91
|
+
return {
|
|
92
|
+
id: mm.id || `m${i}`, text: text || "Message", when: date ? formatMonthDayTime(date) : "", leadFill: mine ? " " : "", mine, notMine: !mine,
|
|
93
|
+
senderBadge: isBusinessSender(m) ? copyParam("chatThread.businessBadge", "Business") : "",
|
|
94
|
+
avatarUrl, avatarInitials: initials(senderName),
|
|
95
|
+
imageUrl, imageDescription: imageUrl ? `${senderName || "Message"} attachment` : "", imageHidden: !imageUrl,
|
|
96
|
+
dayLabel: "", dayHidden: true, timestamp: ms, dayKey: date ? dayKeyOf(date) : "",
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** Oldest first, one row per message id, and a day label on the first message of each day. */
|
|
101
|
+
function rowsOf(messages: ChatMessage[], myUserId: string): Row[] {
|
|
102
|
+
const sorted = messages.map((m, i) => norm(m, i, myUserId)).sort((a, b) => a.timestamp - b.timestamp);
|
|
103
|
+
const today = new Date();
|
|
104
|
+
const todayKey = dayKeyOf(today);
|
|
105
|
+
const yesterdayKey = dayKeyOf(new Date(today.getFullYear(), today.getMonth(), today.getDate() - 1));
|
|
106
|
+
const seen = new Set<string>();
|
|
107
|
+
const rows: Row[] = [];
|
|
108
|
+
let previousDay = "";
|
|
109
|
+
for (const { timestamp, dayKey, ...row } of sorted) {
|
|
110
|
+
if (seen.has(row.id)) continue;
|
|
111
|
+
seen.add(row.id);
|
|
112
|
+
const startsDay = !!dayKey && dayKey !== previousDay;
|
|
113
|
+
if (dayKey) previousDay = dayKey;
|
|
114
|
+
const dayLabel = !startsDay ? "" : dayKey === todayKey ? copyParam("chatThread.today", "Today") : dayKey === yesterdayKey ? copyParam("chatThread.yesterday", "Yesterday") : formatMonthDay(new Date(timestamp));
|
|
115
|
+
rows.push({ ...row, dayLabel, dayHidden: !dayLabel });
|
|
116
|
+
}
|
|
117
|
+
return rows;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function nextScrollToken(prev: string): string {
|
|
121
|
+
return String((Number(prev) || 0) + 1);
|
|
66
122
|
}
|
|
67
123
|
|
|
68
124
|
// ONE member chatToken per visit (`_shared/chat-live.ts`): a 4 s re-read would otherwise
|
|
@@ -74,7 +130,7 @@ async function reload(id: string, myUserId: string): Promise<Row[]> {
|
|
|
74
130
|
const token = memberToken.get();
|
|
75
131
|
try {
|
|
76
132
|
const msgs = await getMessages(id, 30, { role: "member", chatToken: await token });
|
|
77
|
-
return (msgs ?? []
|
|
133
|
+
return rowsOf(msgs ?? [], myUserId);
|
|
78
134
|
} catch (e) {
|
|
79
135
|
memberToken.drop(token);
|
|
80
136
|
throw e;
|
|
@@ -114,7 +170,7 @@ async function reread(s: S): Promise<S> {
|
|
|
114
170
|
const messages = await gate.request();
|
|
115
171
|
const now = svc.getState();
|
|
116
172
|
if (now.resolvedChatroomId !== s.resolvedChatroomId) return now;
|
|
117
|
-
return { ...now, messages, emptyText: messages.length ? "" : now.emptyText };
|
|
173
|
+
return { ...now, messages, emptyText: messages.length ? "" : now.emptyText || EMPTY_TEXT, emptyHidden: messages.length > 0 };
|
|
118
174
|
} catch {
|
|
119
175
|
return svc.getState();
|
|
120
176
|
}
|
|
@@ -139,31 +195,32 @@ const svc = defineService<S, {
|
|
|
139
195
|
onStreamEvent: (s: S) => Promise<S>;
|
|
140
196
|
onStreamError: (s: S) => S;
|
|
141
197
|
}>(SERVICE, {
|
|
142
|
-
state: { status: "loading", messages: [], emptyText: "", draft: "", sendHint: "", resolvedChatroomId: "", myUserId: "", ...presence("loading") },
|
|
198
|
+
state: { status: "loading", messages: [], emptyText: "", emptyHidden: true, scrollSend: "", draft: "", sendHint: "", resolvedChatroomId: "", myUserId: "", ...presence("loading") },
|
|
143
199
|
actions: {
|
|
144
200
|
load: async (s, a) => {
|
|
201
|
+
stashCopy(a);
|
|
145
202
|
const param = (a as { chatRealtime?: unknown } | null | undefined)?.chatRealtime;
|
|
146
203
|
if (param !== undefined) realtime = chatRealtimeConfig(param);
|
|
147
204
|
const raw = inputId();
|
|
148
205
|
// No thread / recipient id (a stale link, a route opened directly) -> the shared
|
|
149
206
|
// not-found state, and no composer: there is nobody to send to.
|
|
150
|
-
if (!detailInputId()) return { ...s, status: "ready", messages: [], emptyText: "", ...presence("missing") };
|
|
207
|
+
if (!detailInputId()) return { ...s, status: "ready", messages: [], emptyText: "", emptyHidden: true, ...presence("missing") };
|
|
151
208
|
memberToken.reset();
|
|
152
209
|
// Resolve chatroom + my user id concurrently (myUserId tags own messages).
|
|
153
210
|
const [chatroomId, myUserId] = await Promise.all([resolveChatroomId(raw, inputKind()), resolveMyUserId()]);
|
|
154
211
|
// A recipient whose 1:1 chatroom could not be resolved is not a conversation yet:
|
|
155
212
|
// reload("") would return [] without throwing and publish a live, empty thread
|
|
156
213
|
// whose Send can only fail. Show the load-error line instead.
|
|
157
|
-
if (!chatroomId) return { ...s, status: "ready", resolvedChatroomId: "", myUserId, messages: [], emptyText: "", ...presence("failed") };
|
|
214
|
+
if (!chatroomId) return { ...s, status: "ready", resolvedChatroomId: "", myUserId, messages: [], emptyText: "", emptyHidden: true, ...presence("failed") };
|
|
158
215
|
try {
|
|
159
216
|
const messages = await reload(chatroomId, myUserId);
|
|
160
217
|
current = { chatroomId, myUserId };
|
|
161
|
-
return { ...s, status: "ready", resolvedChatroomId: chatroomId, myUserId, messages, emptyText: messages.length ? "" :
|
|
218
|
+
return { ...s, status: "ready", resolvedChatroomId: chatroomId, myUserId, messages, emptyText: messages.length ? "" : EMPTY_TEXT, emptyHidden: messages.length > 0, scrollSend: messages.length ? nextScrollToken(s.scrollSend) : "", ...presence("found"), ...liveDirectives(realtime, chatroomId, SERVICE) };
|
|
162
219
|
} catch (e) {
|
|
163
220
|
// A thread whose messages cannot be read is not a live, empty conversation: a 404
|
|
164
221
|
// is the shared not-found state, anything else the load-error line — never a
|
|
165
222
|
// "Say hello!" composer that can only fail.
|
|
166
|
-
return { ...s, status: "ready", resolvedChatroomId: chatroomId, myUserId, messages: [], emptyText: "", ...presenceAfterError(e) };
|
|
223
|
+
return { ...s, status: "ready", resolvedChatroomId: chatroomId, myUserId, messages: [], emptyText: "", emptyHidden: true, ...presenceAfterError(e) };
|
|
167
224
|
}
|
|
168
225
|
},
|
|
169
226
|
setDraft: (s, a) => ({ ...s, draft: val(a) }),
|
|
@@ -208,11 +265,11 @@ const svc = defineService<S, {
|
|
|
208
265
|
try {
|
|
209
266
|
const messages = await gate.request();
|
|
210
267
|
const now = liveState();
|
|
211
|
-
return { ...now, resolvedChatroomId: chatroomId, myUserId, messages, draft: cleared(now), emptyText: "", sendHint: "Sent ✓" };
|
|
268
|
+
return { ...now, resolvedChatroomId: chatroomId, myUserId, messages, draft: cleared(now), emptyText: "", emptyHidden: true, scrollSend: nextScrollToken(now.scrollSend), sendHint: "Sent ✓" };
|
|
212
269
|
} catch {
|
|
213
270
|
const now = liveState();
|
|
214
|
-
const
|
|
215
|
-
return { ...now, resolvedChatroomId: chatroomId, myUserId, messages: [...now.messages,
|
|
271
|
+
const local: Row = { id: `local-${now.messages.length}`, text, when: "", leadFill: " ", mine: true, notMine: false, senderBadge: "", avatarUrl: "", avatarInitials: "", imageUrl: "", imageDescription: "", imageHidden: true, dayLabel: "", dayHidden: true };
|
|
272
|
+
return { ...now, resolvedChatroomId: chatroomId, myUserId, messages: [...now.messages, local], draft: cleared(now), emptyText: "", emptyHidden: true, scrollSend: nextScrollToken(now.scrollSend), sendHint: "Sent ✓" };
|
|
216
273
|
}
|
|
217
274
|
} finally {
|
|
218
275
|
sendingNow = false;
|