@wix/himalaya-cli 0.1501.0 → 0.1503.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
@@ -30788,12 +30788,17 @@ function iconGlyph(name) {
30788
30788
  const key3 = name.toLowerCase().replace(/[_.\s-]/g, "");
30789
30789
  return ICON_GLYPHS[key3] ?? "\xB7";
30790
30790
  }
30791
+ function avatarInitials(initials) {
30792
+ const Segmenter = Intl.Segmenter;
30793
+ const characters = Segmenter ? Array.from(new Segmenter(void 0, { granularity: "grapheme" }).segment(initials), (part3) => part3.segment) : [...initials];
30794
+ return characters.slice(0, 2).join("").toUpperCase();
30795
+ }
30791
30796
  function avatarCircle(initials, size, color, fill = false, fontFamily = '"Wix Madefor Text", system-ui') {
30792
30797
  let h2 = 0;
30793
30798
  for (let i2 = 0; i2 < initials.length; i2++) h2 = (h2 * 31 + initials.charCodeAt(i2)) % 360;
30794
30799
  const bg = fill ? `hsl(${h2}, 55%, 55%)` : color("surfaceTertiary", "#e6e6e6");
30795
30800
  const fg = fill ? "#fff" : color("textPrimary", "#111");
30796
- return /* @__PURE__ */ jsx2("div", { style: { width: size, height: size, borderRadius: "50%", background: bg, color: fg, display: "grid", placeItems: "center", fontWeight: 700, fontSize: size * 0.36, fontFamily, flex: "none" }, children: initials.slice(0, 2).toUpperCase() });
30801
+ return /* @__PURE__ */ jsx2("div", { style: { width: size, height: size, borderRadius: "50%", background: bg, color: fg, display: "grid", placeItems: "center", fontWeight: 700, fontSize: size * 0.36, fontFamily, flex: "none" }, children: avatarInitials(initials) });
30797
30802
  }
30798
30803
  var BINDING_SIGIL2, isBinding, isNodeLike, MD_ESCAPE, MD_ESCAPES, mdEsc, MD_INLINE, CODE_STYLE, ICON_GLYPHS, ICON_GLYPH_NAMES;
30799
30804
  var init_helpers = __esm({
@@ -121376,7 +121381,7 @@ var init_renderNode = __esm({
121376
121381
  if (typeof imageUrl === "string" && imageUrl) {
121377
121382
  return /* @__PURE__ */ jsx11("img", { ...a11y, src: resolveAssetUrl(imageUrl, ctx.assetBaseUrl), alt: "", style: { width: size, height: size, borderRadius: "50%", objectFit: "cover", flex: "none", ...wrap } });
121378
121383
  }
121379
- return /* @__PURE__ */ jsx11("div", { ...a11y, style: { width: size, height: size, borderRadius: "50%", background: C2("accentPrimary", "#116DFF"), color: C2("textOnAccent", "#fff"), display: "grid", placeItems: "center", fontWeight: 600, fontSize: size * 0.4, fontFamily: bodyFont(ctx), flex: "none", ...wrap }, children: (asText2(initials) || "?").slice(0, 2).toUpperCase() });
121384
+ return /* @__PURE__ */ jsx11("div", { ...a11y, style: { width: size, height: size, borderRadius: "50%", background: C2("accentPrimary", "#116DFF"), color: C2("textOnAccent", "#fff"), display: "grid", placeItems: "center", fontWeight: 600, fontSize: size * 0.4, fontFamily: bodyFont(ctx), flex: "none", ...wrap }, children: avatarInitials(asText2(initials) || "?") });
121380
121385
  });
121381
121386
  IconNode = withExtras("IconNode", ({ props, ctx, wrap }) => {
121382
121387
  const C2 = ctx.color;
@@ -165106,33 +165111,33 @@ var init_preview_assets_generated = __esm({
165106
165111
  "../../packages/serve/src/preview-assets.generated.ts"() {
165107
165112
  init_preview_assets_format();
165108
165113
  PREVIEW_ASSET_MANIFEST = [
165109
- { key: "assets/DashboardHost-CS6I7XZ7.js", contentType: "application/javascript; charset=utf-8", offset: 8, length: 2916, sha256: "7e13e030e2223d9fed83c3024e7b51a0b8be61844c90b0d344464a05e306cd17" },
165110
- { key: "assets/DevDrawer-BV0fkFcn.js", contentType: "application/javascript; charset=utf-8", offset: 2924, length: 16744, sha256: "2fe306e399e3515b9d7c8e1067047fde256609f4ad5af96bb3571718dcc52ea4" },
165111
- { key: "assets/IdiomCompare-DAvTYEEK.js", contentType: "application/javascript; charset=utf-8", offset: 19668, length: 1892, sha256: "033a163f8235ad7d07c4e381218c45916c17ce78fe1def80b93139e6f92d52b4" },
165112
- { key: "assets/LightboxViewer-I1HjAp2g.js", contentType: "application/javascript; charset=utf-8", offset: 21560, length: 8132, sha256: "fca9b7f08cd339a117f0c6e887515624d349dd99244e5877f53733b1bd7bea52" },
165113
- { key: "assets/PhonePreviewControl-B0RzQSna.js", contentType: "application/javascript; charset=utf-8", offset: 29692, length: 37729, sha256: "f7ce59c76b6c4ee4882b2d3a0cab9186af73b842178c0593d0d5c1f823ed114b" },
165114
- { key: "assets/SchemeCompare-D0tgDWrF.js", contentType: "application/javascript; charset=utf-8", offset: 67421, length: 1824, sha256: "e8144c33eb8dfa78c04f40c858984669bf9a27523f0a314a270f0ce845e842bf" },
165115
- { key: "assets/index-BAh0R8_v.js", contentType: "application/javascript; charset=utf-8", offset: 69245, length: 1311448, sha256: "1542b2c64fb4d5c1f54de967321432bde20193fc14232e340703b4b6a58a0a8c" },
165116
- { key: "assets/pdf-DgdAmLW5.js", contentType: "application/javascript; charset=utf-8", offset: 1380693, length: 488199, sha256: "a8eb7d447d19e34d8237c5df6e35d08aabf01126ba594b44489ede78fc349bb4" },
165117
- { key: "assets/pdf.worker.min-BQa_JDET.js", contentType: "application/javascript; charset=utf-8", offset: 1868892, length: 73, sha256: "41bcfda4f3c8c0a81c785ea87c69afc8e7d0ed8c333324aee94c273d881bb6aa" },
165118
- { key: "assets/pdf.worker.min-BmVo14Nb.mjs", contentType: "application/javascript; charset=utf-8", offset: 1868965, length: 1317034, sha256: "a33cfe728c584fdba4fcc1fd54bcdc2f9f2f13889ddbb5b2bd1d0f8cbe49b84e" },
165119
- { key: "assets/pdfDocument-B_UlhT7d.js", contentType: "application/javascript; charset=utf-8", offset: 3185999, length: 3379, sha256: "21cb0ad41e19173c89ddca62b5ce78a3198100c421a1ce866f1f45b7b13ccb22" },
165120
- { key: "assets/pdfFetch-Cc8i1I1h.js", contentType: "application/javascript; charset=utf-8", offset: 3189378, length: 2266, sha256: "1d21ad008921942217c9eac0c35b1713773b9d89c71e3ab4412781f7bb88f463" },
165121
- { key: "fonts/Roboto-LICENSE.txt", contentType: "application/octet-stream", offset: 3191644, length: 4610, sha256: "994062dd7af4186a739de55dd9e151c63b6301f8e2cbafc608d35c2e87da0cd2" },
165122
- { key: "fonts/Roboto-Variable.ttf", contentType: "font/ttf", offset: 3196254, length: 488584, sha256: "d7598e12c5dbef095ff8272cfc55da0250bd07fbdecbac8a530b9b277872a134" },
165123
- { key: "fonts/WixMadeforDisplay-Bold.ttf", contentType: "font/ttf", offset: 3684838, length: 90924, sha256: "ec4c7d63772d980d6e147b2df6215fd2737e4b04cebe0cf7e11dc695fb63cdcf" },
165124
- { key: "fonts/WixMadeforDisplay-ExtraBold.ttf", contentType: "font/ttf", offset: 3775762, length: 90984, sha256: "bf4c16a2774edd38a921edf3099469866cd74c094fd596f3fa4e81f54a04dfaa" },
165125
- { key: "fonts/WixMadeforDisplay-Medium.ttf", contentType: "font/ttf", offset: 3866746, length: 90980, sha256: "368faca44fb9f7207e4af784e94750b1ee59c1098b8689e0f4a918926f244fb5" },
165126
- { key: "fonts/WixMadeforDisplay-Regular.ttf", contentType: "font/ttf", offset: 3957726, length: 90872, sha256: "97ed8f1a6772abe26e3d8af5cecfc4b02faa94497d585b0398b5053b739a70c1" },
165127
- { key: "fonts/WixMadeforDisplay-SemiBold.ttf", contentType: "font/ttf", offset: 4048598, length: 90980, sha256: "642feab8a48ddf6c7a89d7c2a7c0edfa0e6e773f671287e460e222703563191e" },
165128
- { key: "fonts/WixMadeforText-Bold.ttf", contentType: "font/ttf", offset: 4139578, length: 108636, sha256: "37c179b4fefb63ea9637322b84583a2df53aa226c150294eea1675c14b1b8e29" },
165129
- { key: "fonts/WixMadeforText-ExtraBold.ttf", contentType: "font/ttf", offset: 4248214, length: 109084, sha256: "62e2fe4718129f36ecdb0ae4de385bd6b81ecc876146447167c6c140fad699a9" },
165130
- { key: "fonts/WixMadeforText-Medium.ttf", contentType: "font/ttf", offset: 4357298, length: 109048, sha256: "4ecf270136af928612c76fe4ebade91d8156975e5ea4c0cf9225501dd1788e02" },
165131
- { key: "fonts/WixMadeforText-Regular.ttf", contentType: "font/ttf", offset: 4466346, length: 107700, sha256: "dee56f09fd3efc127c1ea95557edc74110c1460a46287da36e0af25efd341ef5" },
165132
- { key: "fonts/WixMadeforText-SemiBold.ttf", contentType: "font/ttf", offset: 4574046, length: 88108, sha256: "dced97a77624bc5f8b1ae65850360908297f4588e09feb6f22792d29dc7e765b" },
165133
- { key: "himi-sw.js", contentType: "application/javascript; charset=utf-8", offset: 4662154, length: 6748, sha256: "4a92459977d7cefa1a6a7e020c3a63509737f083b3f2773557c1a5771665811a" },
165134
- { key: "index.html", contentType: "text/html; charset=utf-8", offset: 4668902, length: 4947, sha256: "f0e748ce1be1cafd0edcfff4ef423adf10f290982ee4ae68f1362c926f9b8101" },
165135
- { key: "t5-frame.html", contentType: "text/html; charset=utf-8", offset: 4673849, length: 18080, sha256: "937286e50af2fc4e44f7fb35b277f35254e5eb24a3d364a70cfa914d4286d0d9" }
165114
+ { key: "assets/DashboardHost-lyHYXHuD.js", contentType: "application/javascript; charset=utf-8", offset: 8, length: 2916, sha256: "d714aaba06f8832b04b089fba6db6a70218f08a5ea412486af05e7ae6be4f3bf" },
165115
+ { key: "assets/DevDrawer-DFjJakFH.js", contentType: "application/javascript; charset=utf-8", offset: 2924, length: 16744, sha256: "451195288ed7538b5837eb2728db9e238b79994bada3c0da2d68cc724180c309" },
165116
+ { key: "assets/IdiomCompare-BS8D62MN.js", contentType: "application/javascript; charset=utf-8", offset: 19668, length: 1892, sha256: "2733ff1ba2fb1a7db4acbf792d658aa5351b97b7f66d76d05bc0636d2ae5b9a6" },
165117
+ { key: "assets/LightboxViewer-BA8NnNMt.js", contentType: "application/javascript; charset=utf-8", offset: 21560, length: 8132, sha256: "a6d325a705486aeec5b75074b105f4c96f247b6c658831d0ee9931eb9850394a" },
165118
+ { key: "assets/PhonePreviewControl-IcIGz4PD.js", contentType: "application/javascript; charset=utf-8", offset: 29692, length: 37729, sha256: "b19a2f60077f23fa575957ef829eaf6025a310401afed4993903e15ec73eabfb" },
165119
+ { key: "assets/SchemeCompare-DV8FUeO3.js", contentType: "application/javascript; charset=utf-8", offset: 67421, length: 1824, sha256: "66b0b48bbe708ff7c09734cf74ab537292b812b0fecb5b0dc7d326bde35575df" },
165120
+ { key: "assets/index-CVbkvo-O.js", contentType: "application/javascript; charset=utf-8", offset: 69245, length: 1311557, sha256: "63f6534405cc00ea45d6dd48fee69bffba89d343493a3169ef75055f4f8e5e77" },
165121
+ { key: "assets/pdf-D7kp5epP.js", contentType: "application/javascript; charset=utf-8", offset: 1380802, length: 488199, sha256: "3cf5f09fe2432fdc0cfe85bfc66956c8abac0862cf17d942caeeba19111b2c33" },
165122
+ { key: "assets/pdf.worker.min-BQa_JDET.js", contentType: "application/javascript; charset=utf-8", offset: 1869001, length: 73, sha256: "41bcfda4f3c8c0a81c785ea87c69afc8e7d0ed8c333324aee94c273d881bb6aa" },
165123
+ { key: "assets/pdf.worker.min-BmVo14Nb.mjs", contentType: "application/javascript; charset=utf-8", offset: 1869074, length: 1317034, sha256: "a33cfe728c584fdba4fcc1fd54bcdc2f9f2f13889ddbb5b2bd1d0f8cbe49b84e" },
165124
+ { key: "assets/pdfDocument-C_peMth9.js", contentType: "application/javascript; charset=utf-8", offset: 3186108, length: 3379, sha256: "e7525980a1a991d29caba74a158a21fcd926bacbab64ce5bd2d177ffa199df1c" },
165125
+ { key: "assets/pdfFetch-Cc8i1I1h.js", contentType: "application/javascript; charset=utf-8", offset: 3189487, length: 2266, sha256: "1d21ad008921942217c9eac0c35b1713773b9d89c71e3ab4412781f7bb88f463" },
165126
+ { key: "fonts/Roboto-LICENSE.txt", contentType: "application/octet-stream", offset: 3191753, length: 4610, sha256: "994062dd7af4186a739de55dd9e151c63b6301f8e2cbafc608d35c2e87da0cd2" },
165127
+ { key: "fonts/Roboto-Variable.ttf", contentType: "font/ttf", offset: 3196363, length: 488584, sha256: "d7598e12c5dbef095ff8272cfc55da0250bd07fbdecbac8a530b9b277872a134" },
165128
+ { key: "fonts/WixMadeforDisplay-Bold.ttf", contentType: "font/ttf", offset: 3684947, length: 90924, sha256: "ec4c7d63772d980d6e147b2df6215fd2737e4b04cebe0cf7e11dc695fb63cdcf" },
165129
+ { key: "fonts/WixMadeforDisplay-ExtraBold.ttf", contentType: "font/ttf", offset: 3775871, length: 90984, sha256: "bf4c16a2774edd38a921edf3099469866cd74c094fd596f3fa4e81f54a04dfaa" },
165130
+ { key: "fonts/WixMadeforDisplay-Medium.ttf", contentType: "font/ttf", offset: 3866855, length: 90980, sha256: "368faca44fb9f7207e4af784e94750b1ee59c1098b8689e0f4a918926f244fb5" },
165131
+ { key: "fonts/WixMadeforDisplay-Regular.ttf", contentType: "font/ttf", offset: 3957835, length: 90872, sha256: "97ed8f1a6772abe26e3d8af5cecfc4b02faa94497d585b0398b5053b739a70c1" },
165132
+ { key: "fonts/WixMadeforDisplay-SemiBold.ttf", contentType: "font/ttf", offset: 4048707, length: 90980, sha256: "642feab8a48ddf6c7a89d7c2a7c0edfa0e6e773f671287e460e222703563191e" },
165133
+ { key: "fonts/WixMadeforText-Bold.ttf", contentType: "font/ttf", offset: 4139687, length: 108636, sha256: "37c179b4fefb63ea9637322b84583a2df53aa226c150294eea1675c14b1b8e29" },
165134
+ { key: "fonts/WixMadeforText-ExtraBold.ttf", contentType: "font/ttf", offset: 4248323, length: 109084, sha256: "62e2fe4718129f36ecdb0ae4de385bd6b81ecc876146447167c6c140fad699a9" },
165135
+ { key: "fonts/WixMadeforText-Medium.ttf", contentType: "font/ttf", offset: 4357407, length: 109048, sha256: "4ecf270136af928612c76fe4ebade91d8156975e5ea4c0cf9225501dd1788e02" },
165136
+ { key: "fonts/WixMadeforText-Regular.ttf", contentType: "font/ttf", offset: 4466455, length: 107700, sha256: "dee56f09fd3efc127c1ea95557edc74110c1460a46287da36e0af25efd341ef5" },
165137
+ { key: "fonts/WixMadeforText-SemiBold.ttf", contentType: "font/ttf", offset: 4574155, length: 88108, sha256: "dced97a77624bc5f8b1ae65850360908297f4588e09feb6f22792d29dc7e765b" },
165138
+ { key: "himi-sw.js", contentType: "application/javascript; charset=utf-8", offset: 4662263, length: 6748, sha256: "4a92459977d7cefa1a6a7e020c3a63509737f083b3f2773557c1a5771665811a" },
165139
+ { key: "index.html", contentType: "text/html; charset=utf-8", offset: 4669011, length: 4947, sha256: "dbe3e83a81c236caac3350f4e59823c980a304e29e51f8866c562d3ee7ceddad" },
165140
+ { key: "t5-frame.html", contentType: "text/html; charset=utf-8", offset: 4673958, length: 18080, sha256: "937286e50af2fc4e44f7fb35b277f35254e5eb24a3d364a70cfa914d4286d0d9" }
165136
165141
  ];
165137
165142
  }
165138
165143
  });
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/himalaya-cli",
3
- "version": "0.1501.0",
3
+ "version": "0.1503.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": "b4581cb1b19e25892ccdd324431e2a5db2facd8ae8c8759bcc8c69cc"
74
+ "falconPackageHash": "9361a8f187b8af53a348ca96ac2b69757252496d7d1dc26397fa689f"
75
75
  }
@@ -89102,18 +89102,16 @@ const SCREENS = runtimeSetting({
89102
89102
  "package": "himalaya",
89103
89103
  "type": "Image",
89104
89104
  "props": {
89105
- "url": "$item.senderAvatar",
89106
- "initials": "$item.senderInitials",
89107
- "icon": "person",
89105
+ "initials": "$service:businessChat.businessInitials",
89108
89106
  "width": 30,
89109
89107
  "height": 30,
89110
89108
  "contentMode": "fill",
89111
89109
  "shape": "circle",
89112
- "contentDescription": "$item.sender"
89110
+ "contentDescription": "$service:businessChat.businessName"
89113
89111
  }
89114
89112
  },
89115
89113
  "modifiers": {
89116
- "accessibilityLabel": "$item.sender"
89114
+ "accessibilityLabel": "$service:businessChat.businessName"
89117
89115
  }
89118
89116
  },
89119
89117
  {
@@ -89136,14 +89134,35 @@ const SCREENS = runtimeSetting({
89136
89134
  "package": "himalaya",
89137
89135
  "type": "Text",
89138
89136
  "props": {
89139
- "text": "$item.senderName",
89137
+ "text": "__HIMI_APP_NAME__",
89140
89138
  "style": "caption",
89141
89139
  "color": "accentPrimary",
89142
89140
  "collapseWhenEmpty": true,
89143
- "textDirection": "auto"
89141
+ "textDirection": "auto",
89142
+ "maxLines": 1
89144
89143
  }
89145
89144
  },
89146
- "modifiers": {}
89145
+ "modifiers": {
89146
+ "hiddenPath": "$service:businessChat.hasHostedName"
89147
+ }
89148
+ },
89149
+ {
89150
+ "id": "himi_business_chat.incoming_sender_hosted_$item.id",
89151
+ "body": {
89152
+ "package": "himalaya",
89153
+ "type": "Text",
89154
+ "props": {
89155
+ "text": "$service:businessChat.hostedName",
89156
+ "style": "caption",
89157
+ "color": "accentPrimary",
89158
+ "collapseWhenEmpty": true,
89159
+ "textDirection": "auto",
89160
+ "maxLines": 1
89161
+ }
89162
+ },
89163
+ "modifiers": {
89164
+ "hiddenPath": "$service:businessChat.noHostedName"
89165
+ }
89147
89166
  },
89148
89167
  {
89149
89168
  "id": "himi_business_chat.staff_badge_$item.id",
@@ -89463,14 +89482,35 @@ const SCREENS = runtimeSetting({
89463
89482
  "package": "himalaya",
89464
89483
  "type": "Text",
89465
89484
  "props": {
89466
- "text": "$item.senderName",
89485
+ "text": "__HIMI_APP_NAME__",
89467
89486
  "style": "caption",
89468
89487
  "color": "accentPrimary",
89469
89488
  "collapseWhenEmpty": true,
89470
- "textDirection": "auto"
89489
+ "textDirection": "auto",
89490
+ "maxLines": 1
89471
89491
  }
89472
89492
  },
89473
- "modifiers": {}
89493
+ "modifiers": {
89494
+ "hiddenPath": "$service:businessChat.hasHostedName"
89495
+ }
89496
+ },
89497
+ {
89498
+ "id": "himi_business_chat.card_sender_hosted_$item.id",
89499
+ "body": {
89500
+ "package": "himalaya",
89501
+ "type": "Text",
89502
+ "props": {
89503
+ "text": "$service:businessChat.hostedName",
89504
+ "style": "caption",
89505
+ "color": "accentPrimary",
89506
+ "collapseWhenEmpty": true,
89507
+ "textDirection": "auto",
89508
+ "maxLines": 1
89509
+ }
89510
+ },
89511
+ "modifiers": {
89512
+ "hiddenPath": "$service:businessChat.noHostedName"
89513
+ }
89474
89514
  },
89475
89515
  {
89476
89516
  "id": "himi_business_chat.card_badge_$item.id",
@@ -90074,6 +90114,7 @@ const SCREENS = runtimeSetting({
90074
90114
  "onAppear": {
90075
90115
  "actionId": "tier5.businessChat.init",
90076
90116
  "params": {
90117
+ "displayName": "__HIMI_APP_NAME__",
90077
90118
  "siteUrl": "__HIMI_MEMBER_SITE_URL__",
90078
90119
  "productScreen": "himi_product",
90079
90120
  "serviceScreen": "himi_service"
@@ -26,11 +26,26 @@ type State = {
26
26
  liveState:string; liveReason:string; realtimeEventCount:number; lastRealtimeEventType:string; pendingIntent:PendingIntent|null; scrollAnchor:string; scrollSend:number; usedSuggestionIds:string[]; visitorOptions:BusinessVisitorOptions|null; quickReplies:BusinessSuggestion[]; hasQuickReplies:boolean; noQuickReplies:boolean;
27
27
  liveLabel:string; hasActiveRoom:boolean; noActiveRoom:boolean; isGuest:boolean; notGuest:boolean; realtimeDiagnostic:string; noError:boolean; noNotice:boolean; noMessages:boolean; hasMessages:boolean; noEmpty:boolean; notLoading:boolean;
28
28
  hostedName:string; hasHostedName:boolean; noHostedName:boolean;
29
+ /** Who signs business messages: the hosted site, else the name the screen's `init` passes. */
30
+ businessName:string; businessInitials:string;
29
31
  sendDisabled:boolean; sendEnabled:boolean; noLive:boolean; loadingHidden:boolean; errorText:string; loadFailure:string;
30
32
  };
31
33
  // A hosted build serves many businesses: the title is the site the host opened, not the app's own name.
32
34
  const hostedName=hostSiteFromInput((globalThis as {himalaya?:{input?:unknown}}).himalaya?.input)?.name??'';
33
- const initial:State={hostedName,hasHostedName:!!hostedName,noHostedName:!hostedName,phase:'loading',error:'',notice:'',member:false,roomId:'',principal:'',scope:'',messages:[],draft:'',busy:false,
35
+ /** One or two capitals for a name, as an avatar shows it ("Hush Studio" → "HS"). */
36
+ // What a reader sees as one character: an emoji joined from several code points (👩‍🍳, a flag) stays whole. Code
37
+ // points are the fallback where the engine has no Intl.Segmenter.
38
+ function graphemes(text:string):string[]{
39
+ // The wrist's engine has no Intl at all, so it is only read behind this check.
40
+ const Segmenter=typeof Intl!=='undefined'?(Intl as unknown as {Segmenter?:new(locale?:string,options?:{granularity:'grapheme'})=>{segment(input:string):Iterable<{segment:string}>}}).Segmenter:undefined;
41
+ return Segmenter?Array.from(new Segmenter(undefined,{granularity:'grapheme'}).segment(text),(part)=>part.segment):[...text];
42
+ }
43
+ function initialsOf(name:string):string{
44
+ const first=(word:string)=>graphemes(word)[0]??'';
45
+ const words=name.trim().split(/\s+/).filter(Boolean);
46
+ return (words.length>1?`${first(words[0]!)}${first(words[words.length-1]!)}`:first(words[0]??'')).toUpperCase();
47
+ }
48
+ const initial:State={hostedName,businessName:hostedName,businessInitials:initialsOf(hostedName),hasHostedName:!!hostedName,noHostedName:!hostedName,phase:'loading',error:'',notice:'',member:false,roomId:'',principal:'',scope:'',messages:[],draft:'',busy:false,
34
49
  liveState:'unavailable',liveReason:'',realtimeEventCount:0,lastRealtimeEventType:'',liveLabel:'',hasActiveRoom:false,noActiveRoom:true,isGuest:false,notGuest:true,realtimeDiagnostic:'',pendingIntent:null,scrollAnchor:'',scrollSend:0,usedSuggestionIds:[],visitorOptions:null,quickReplies:[],hasQuickReplies:false,noQuickReplies:true,noError:true,noNotice:true,noMessages:true,hasMessages:false,noEmpty:true,notLoading:false,sendDisabled:true,sendEnabled:false,noLive:true,loadingHidden:false,errorText:'',loadFailure:''};
35
50
  let currentIdentity:ChatIdentity|null=null;
36
51
  let subscriptionId='';
@@ -309,6 +324,11 @@ const svc=defineService<State,Record<string,(s:State,a?:unknown)=>State|undefine
309
324
  // A retry passes no site: the one the screen gave first stays. A site the screen passes, even an empty one (a
310
325
  // business with no site), replaces it, so an earlier business's links are not routed to this one's screens.
311
326
  if(hasParam(a,'siteUrl')){ownSiteUrl=param(a,'siteUrl');ownScreens.product=param(a,'productScreen');ownScreens.service=param(a,'serviceScreen');}
327
+ // A retry passes no name: the one the screen gave first stays. Under `displayName`, a copy key, so a template
328
+ // sweep that renames the business renames it here too and the initials follow.
329
+ const signedBy=s.hostedName||param(a,'displayName')||s.businessName;
330
+ const signed=(st:State):State=>({...st,businessName:signedBy,businessInitials:initialsOf(signedBy)});
331
+ s=signed(s);
312
332
  const oldPrincipal=s.principal;
313
333
  const initRevision=draftRevision;
314
334
  // Text typed at any point of the load, subscribe step included, outlives the snapshot this started from. So does the
@@ -336,7 +356,7 @@ const svc=defineService<State,Record<string,(s:State,a?:unknown)=>State|undefine
336
356
  const identity=await getCurrentMember();
337
357
  if(myEpoch!==epoch)return undefined;
338
358
  if(!identity.authenticated)throw new Error('member_sign_in_required');
339
- if(oldPrincipal&&(oldPrincipal!==(identity.userId||identity.email)||s.scope!==identity.scope)){s=clearPrivate(s,'guest');myEpoch=epoch;reset=true;}
359
+ if(oldPrincipal&&(oldPrincipal!==(identity.userId||identity.email)||s.scope!==identity.scope)){s=signed(clearPrivate(s,'guest'));myEpoch=epoch;reset=true;}
340
360
  currentIdentity=identity;
341
361
  s=shape({...s,phase:'loading',member:true,principal:identity.userId||identity.email,scope:identity.scope,error:'',notice:''});
342
362
  const existingRoom=await resolveExistingBusinessRoom(myEpoch);