@wix/himalaya-cli 0.853.0 → 0.855.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/authoring-runtime/node_modules/@wix/himalaya/dist/wix-analytics.mjs +3 -3
- package/dist/cli.mjs +35 -3
- package/guides/sdk-reference.json +4 -2
- package/package.json +2 -2
- package/templates/beauty-salon-owner/config.ts +34 -4
- package/templates/beauty-salon-owner/dev/index.ts +0 -94
- package/templates/beauty-salon-owner/tier5-src/_shared/aria-chat.ts +73 -4
- package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-aria/index.ts +7 -0
- package/templates/community-club-owner/config.ts +34 -4
- package/templates/community-club-owner/dev/index.ts +0 -94
- package/templates/community-club-owner/tier5-src/_shared/aria-chat.ts +73 -4
- package/templates/community-club-owner/tier5-src/himi-owner-lite-aria/index.ts +7 -0
- package/templates/events-meetups-owner/config.ts +34 -4
- package/templates/events-meetups-owner/dev/index.ts +0 -94
- package/templates/events-meetups-owner/tier5-src/_shared/aria-chat.ts +73 -4
- package/templates/events-meetups-owner/tier5-src/himi-owner-lite-aria/index.ts +7 -0
- package/templates/gym-fitness-owner/config.ts +34 -4
- package/templates/gym-fitness-owner/dev/index.ts +0 -94
- package/templates/gym-fitness-owner/tier5-src/_shared/aria-chat.ts +73 -4
- package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-aria/index.ts +7 -0
- package/templates/nonprofit-cause-owner/config.ts +34 -4
- package/templates/nonprofit-cause-owner/dev/index.ts +0 -94
- package/templates/nonprofit-cause-owner/tier5-src/_shared/aria-chat.ts +73 -4
- package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-aria/index.ts +7 -0
- package/templates/owner-lite/config.ts +34 -4
- package/templates/owner-lite/dev/index.ts +0 -94
- package/templates/owner-lite/tier5-src/_shared/aria-chat.ts +73 -4
- package/templates/owner-lite/tier5-src/himi-owner-lite-aria/index.ts +7 -0
- package/templates/podcast-creator-owner/config.ts +34 -4
- package/templates/podcast-creator-owner/dev/index.ts +0 -94
- package/templates/podcast-creator-owner/tier5-src/_shared/aria-chat.ts +73 -4
- package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-aria/index.ts +7 -0
- package/templates/portfolio-creative-owner/config.ts +34 -4
- package/templates/portfolio-creative-owner/dev/index.ts +0 -94
- package/templates/portfolio-creative-owner/tier5-src/_shared/aria-chat.ts +73 -4
- package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-aria/index.ts +7 -0
- package/templates/restaurant-owner/config.ts +34 -4
- package/templates/restaurant-owner/dev/index.ts +0 -94
- package/templates/restaurant-owner/tier5-src/_shared/aria-chat.ts +73 -4
- package/templates/restaurant-owner/tier5-src/himi-owner-lite-aria/index.ts +7 -0
- package/templates/retail-store-owner/config.ts +34 -4
- package/templates/retail-store-owner/dev/index.ts +0 -94
- package/templates/retail-store-owner/tier5-src/_shared/aria-chat.ts +73 -4
- package/templates/retail-store-owner/tier5-src/himi-owner-lite-aria/index.ts +7 -0
- package/templates/yoga-studio-owner/config.ts +34 -4
- package/templates/yoga-studio-owner/dev/index.ts +0 -94
- package/templates/yoga-studio-owner/tier5-src/_shared/aria-chat.ts +73 -4
- package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-aria/index.ts +7 -0
|
@@ -153,6 +153,10 @@ export interface AriaChatLabels {
|
|
|
153
153
|
typing?: Resolvable<string>;
|
|
154
154
|
/** Status line when the wait ran out without a reply. */
|
|
155
155
|
slow?: Resolvable<string>;
|
|
156
|
+
/** Shown instead of a raw transport error when this HOST cannot reach Wix at
|
|
157
|
+
* all — it carries no Wix app binding to sign the chat-service call with.
|
|
158
|
+
* See `isWixAccountUnreachable`, and note what it is NOT: a signed-out user. */
|
|
159
|
+
unavailable?: Resolvable<string>;
|
|
156
160
|
}
|
|
157
161
|
|
|
158
162
|
export interface AriaChatOptions {
|
|
@@ -271,6 +275,62 @@ export function hostOf(url: string): string {
|
|
|
271
275
|
return PLAIN_HOST.test(host) ? host : "";
|
|
272
276
|
}
|
|
273
277
|
|
|
278
|
+
/** The web bridge's DESIGNED refusals — the ones that mean "this host cannot
|
|
279
|
+
* reach Wix", as opposed to "the chat-service is broken".
|
|
280
|
+
*
|
|
281
|
+
* Matched by NAME, never by the 501 status alone: 501 is also what an unrelated
|
|
282
|
+
* gateway failure carries, and an unknown future refusal should stay loud rather
|
|
283
|
+
* than be quietly absorbed into a reassuring sentence.
|
|
284
|
+
*
|
|
285
|
+
* - `webwix_bridge_no_client_id` — the host carries no Wix app binding at all,
|
|
286
|
+
* so nothing can be signed and no Wix call leaves the browser.
|
|
287
|
+
* - `webwix_owner_only` — the call targets an owner-scoped Wix host
|
|
288
|
+
* (`*.wix.com`) rather than the `wixapis.com` gateway the web bridge is
|
|
289
|
+
* host-locked to. Aria's chat-service lives on `manage.wix.com`, so on web
|
|
290
|
+
* this is the refusal it gets once a site IS connected: structural, and not
|
|
291
|
+
* fixed by any amount of signing in or re-binding.
|
|
292
|
+
* - `webwix_owner_mint_failed` — no owner session for this business on this
|
|
293
|
+
* host. The shell already puts its own "Sign in to Wix again" affordance up
|
|
294
|
+
* for this one, so Aria says the same neutral thing rather than competing
|
|
295
|
+
* with it.
|
|
296
|
+
*
|
|
297
|
+
* ALL THREE READ THE SAME WAY TO AN OWNER: Aria cannot work on this surface,
|
|
298
|
+
* and nothing they do in the chat will change it. None of them is a reason to
|
|
299
|
+
* show red, and none is a reason to tell them to sign in — an earlier version
|
|
300
|
+
* of this said "Sign in to your Wix account" and was wrong on exactly that
|
|
301
|
+
* point, since the owner is typically already signed in.
|
|
302
|
+
*
|
|
303
|
+
* Aria cannot degrade to sample rows the way the data screens do — there is no
|
|
304
|
+
* conversation to invent — so it degrades to the greeting plus one plain
|
|
305
|
+
* sentence in the NEUTRAL status line. */
|
|
306
|
+
const DESIGNED_BRIDGE_REFUSALS = [
|
|
307
|
+
"webwix_bridge_no_client_id",
|
|
308
|
+
"webwix_owner_only",
|
|
309
|
+
"webwix_owner_mint_failed",
|
|
310
|
+
];
|
|
311
|
+
|
|
312
|
+
export function isWixAccountUnreachable(e: unknown): boolean {
|
|
313
|
+
const msg = String((e as Error)?.message ?? e ?? "");
|
|
314
|
+
return DESIGNED_BRIDGE_REFUSALS.some((name) => msg.includes(name));
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/** Which of the screen's two message slots a failure belongs in.
|
|
318
|
+
*
|
|
319
|
+
* Both already exist and they say different things: `error` renders in `danger`
|
|
320
|
+
* and `statusText` in `textSecondary`. "This host has no owner session" is not
|
|
321
|
+
* a fault, so putting it in the red slot still tells the owner something broke
|
|
322
|
+
* and sends them looking for a breakage that is not there — the words would be
|
|
323
|
+
* right and the colour would be lying. It goes in the neutral slot instead.
|
|
324
|
+
*
|
|
325
|
+
* Always returns BOTH keys so the two can never show at once: a real error
|
|
326
|
+
* clears any stale status line, and the signed-out sentence clears any red text
|
|
327
|
+
* left over from an earlier failure. */
|
|
328
|
+
function failureSlots(e: unknown, unavailable: () => string): { error: string; statusText: string } {
|
|
329
|
+
return isWixAccountUnreachable(e)
|
|
330
|
+
? { error: "", statusText: unavailable() }
|
|
331
|
+
: { error: String((e as Error)?.message ?? e), statusText: "" };
|
|
332
|
+
}
|
|
333
|
+
|
|
274
334
|
/** Is this url somewhere Wix itself serves?
|
|
275
335
|
*
|
|
276
336
|
* Guarded by `PLAIN_HOST` first. The suffix tests are string operations, so
|
|
@@ -528,6 +588,13 @@ export function createAriaChat(o: AriaChatOptions): AriaChatCore {
|
|
|
528
588
|
const you = () => res(o.labels?.you ?? "You");
|
|
529
589
|
const typingText = () => res(o.labels?.typing ?? `${assistant()} is typing…`);
|
|
530
590
|
const slowText = () => res(o.labels?.slow ?? `${assistant()} is taking a while…`);
|
|
591
|
+
// States the fact and stops. It deliberately gives no instruction, because
|
|
592
|
+
// there is none the owner could follow: they are signed in, and the thing that
|
|
593
|
+
// is missing is the app's own Wix binding. "Here" is doing real work — it says
|
|
594
|
+
// the limit is this surface, not their account and not Aria.
|
|
595
|
+
const unavailableText = () => res(
|
|
596
|
+
o.labels?.unavailable ?? `${assistant()} can't reach your Wix account from here.`,
|
|
597
|
+
);
|
|
531
598
|
const promptList = () => res(o.prompts);
|
|
532
599
|
const siteOf = o.siteId ?? (() => "");
|
|
533
600
|
const resumeOf = o.resumeConversationId ?? inputConversationId;
|
|
@@ -686,12 +753,14 @@ export function createAriaChat(o: AriaChatOptions): AriaChatCore {
|
|
|
686
753
|
} catch (e) {
|
|
687
754
|
inFlightSend = null;
|
|
688
755
|
return {
|
|
689
|
-
...base, status: "ready",
|
|
756
|
+
...base, status: "ready", _pending: "",
|
|
690
757
|
// `_siteId` moves with the id or neither does: a conversation remembered
|
|
691
758
|
// without the site it belongs to reads as another business's on the next
|
|
692
759
|
// send, and gets replaced instead of retried.
|
|
693
760
|
_convId: convId, _siteId: convId === s._convId ? s._siteId : site,
|
|
694
|
-
error
|
|
761
|
+
// Sets BOTH error and statusText, so it must come after the `statusText: ""`
|
|
762
|
+
// this object used to carry — otherwise the literal would blank the sentence.
|
|
763
|
+
...failureSlots(e, unavailableText),
|
|
695
764
|
};
|
|
696
765
|
}
|
|
697
766
|
}
|
|
@@ -756,7 +825,7 @@ export function createAriaChat(o: AriaChatOptions): AriaChatCore {
|
|
|
756
825
|
messages: greetingOnly(), ...observed([]), prompts: promptList() };
|
|
757
826
|
} catch (e) {
|
|
758
827
|
// Even if create fails, show the greeting; submit retries the create.
|
|
759
|
-
return { ...s, status: "ready", _convId: "", _siteId: site, _pending: "",
|
|
828
|
+
return { ...s, status: "ready", _convId: "", _siteId: site, _pending: "", ...failureSlots(e, unavailableText),
|
|
760
829
|
messages: greetingOnly(), ...observed([]), prompts: promptList() };
|
|
761
830
|
}
|
|
762
831
|
},
|
|
@@ -801,7 +870,7 @@ export function createAriaChat(o: AriaChatOptions): AriaChatCore {
|
|
|
801
870
|
return slow({ ...s, status: "ready", _convId: conversationIdOf(res), _siteId: site, input: "", statusText: "", error: "",
|
|
802
871
|
_pending: "", messages: greetingOnly(), ...observed([]), prompts: promptList(), ok: false });
|
|
803
872
|
} catch (e) {
|
|
804
|
-
return slow({ ...s, status: "ready", _convId: "", _siteId: site, input: "",
|
|
873
|
+
return slow({ ...s, status: "ready", _convId: "", _siteId: site, input: "", ...failureSlots(e, unavailableText),
|
|
805
874
|
_pending: "", messages: greetingOnly(), ...observed([]), prompts: promptList(), ok: false });
|
|
806
875
|
}
|
|
807
876
|
},
|
|
@@ -141,6 +141,13 @@ const core = createAriaChat({
|
|
|
141
141
|
you: () => copyParam("ownerAria.you", "You"),
|
|
142
142
|
typing: () => copyParam("ownerAria.typing", "Aria is typing…"),
|
|
143
143
|
slow: () => copyParam("ownerAria.slow", "Aria is taking a while…"),
|
|
144
|
+
// Shown when the HOST carries no Wix app binding, so no Wix call can leave
|
|
145
|
+
// the browser (the web preview). Through copyParam like every other string
|
|
146
|
+
// here — a default baked into the shared core cannot be localized by this
|
|
147
|
+
// app's copy pack, and a non-English owner would have read this one line in
|
|
148
|
+
// English. Says no "sign in": the owner already is, and the missing piece is
|
|
149
|
+
// the app's binding, so there is no action for them to take.
|
|
150
|
+
unavailable: () => copyParam("ownerAria.unavailable", "Aria can't reach your Wix account from here."),
|
|
144
151
|
},
|
|
145
152
|
historyKey: "ol.aria.history.v1",
|
|
146
153
|
// No local title cache in THIS app. __HIMI_APP_NAME__ is multi-account and
|
|
@@ -103,15 +103,15 @@ export default defineApp({
|
|
|
103
103
|
"paramKeys": [
|
|
104
104
|
"conversationId"
|
|
105
105
|
],
|
|
106
|
-
"parentScreenId": "
|
|
107
|
-
"tabId": "
|
|
106
|
+
"parentScreenId": "",
|
|
107
|
+
"tabId": "aria"
|
|
108
108
|
},
|
|
109
109
|
{
|
|
110
110
|
"screenId": "himi_owner_lite_aria_history",
|
|
111
111
|
"isPublic": false,
|
|
112
112
|
"paramKeys": [],
|
|
113
113
|
"parentScreenId": "himi_owner_lite_aria",
|
|
114
|
-
"tabId": "
|
|
114
|
+
"tabId": "aria"
|
|
115
115
|
},
|
|
116
116
|
{
|
|
117
117
|
"screenId": "himi_owner_lite_brief",
|
|
@@ -541,7 +541,7 @@ export default defineApp({
|
|
|
541
541
|
"isPublic": false,
|
|
542
542
|
"paramKeys": [],
|
|
543
543
|
"parentScreenId": "",
|
|
544
|
-
"tabId": "
|
|
544
|
+
"tabId": ""
|
|
545
545
|
}
|
|
546
546
|
],
|
|
547
547
|
"tabBar": {
|
|
@@ -553,6 +553,36 @@ export default defineApp({
|
|
|
553
553
|
"icon": "home",
|
|
554
554
|
"selectedIcon": "home_fill"
|
|
555
555
|
},
|
|
556
|
+
{
|
|
557
|
+
"id": "aria",
|
|
558
|
+
"screenId": "himi_owner_lite_aria",
|
|
559
|
+
"label": "Aria",
|
|
560
|
+
"icon": "ai"
|
|
561
|
+
},
|
|
562
|
+
{
|
|
563
|
+
"id": "manage",
|
|
564
|
+
"screenId": "himi_owner_lite_manage",
|
|
565
|
+
"label": "Front of house",
|
|
566
|
+
"icon": "grid",
|
|
567
|
+
"selectedIcon": "grid_fill"
|
|
568
|
+
}
|
|
569
|
+
]
|
|
570
|
+
},
|
|
571
|
+
"sidebar": {
|
|
572
|
+
"items": [
|
|
573
|
+
{
|
|
574
|
+
"id": "home",
|
|
575
|
+
"screenId": "himi_owner_lite_home",
|
|
576
|
+
"label": "Service",
|
|
577
|
+
"icon": "home",
|
|
578
|
+
"selectedIcon": "home_fill"
|
|
579
|
+
},
|
|
580
|
+
{
|
|
581
|
+
"id": "aria",
|
|
582
|
+
"screenId": "himi_owner_lite_aria",
|
|
583
|
+
"label": "Aria",
|
|
584
|
+
"icon": "ai"
|
|
585
|
+
},
|
|
556
586
|
{
|
|
557
587
|
"id": "manage",
|
|
558
588
|
"screenId": "himi_owner_lite_manage",
|
|
@@ -50840,100 +50840,6 @@ const SCREENS = runtimeSetting({
|
|
|
50840
50840
|
"haptic": "light",
|
|
50841
50841
|
"accessibilityLabel": "himi_owner_lite.manage_analytics"
|
|
50842
50842
|
}
|
|
50843
|
-
},
|
|
50844
|
-
{
|
|
50845
|
-
"id": "",
|
|
50846
|
-
"body": {
|
|
50847
|
-
"package": "himalaya",
|
|
50848
|
-
"type": "HStack",
|
|
50849
|
-
"props": {
|
|
50850
|
-
"spacing": 12,
|
|
50851
|
-
"children": [
|
|
50852
|
-
{
|
|
50853
|
-
"id": "",
|
|
50854
|
-
"body": {
|
|
50855
|
-
"package": "himalaya",
|
|
50856
|
-
"type": "HStack",
|
|
50857
|
-
"props": {
|
|
50858
|
-
"spacing": 12,
|
|
50859
|
-
"children": [
|
|
50860
|
-
{
|
|
50861
|
-
"id": "",
|
|
50862
|
-
"body": {
|
|
50863
|
-
"package": "himalaya",
|
|
50864
|
-
"type": "Icon",
|
|
50865
|
-
"props": {
|
|
50866
|
-
"name": "chat",
|
|
50867
|
-
"size": 20,
|
|
50868
|
-
"tint": "accentPrimary"
|
|
50869
|
-
}
|
|
50870
|
-
}
|
|
50871
|
-
},
|
|
50872
|
-
{
|
|
50873
|
-
"id": "",
|
|
50874
|
-
"body": {
|
|
50875
|
-
"package": "himalaya",
|
|
50876
|
-
"type": "Text",
|
|
50877
|
-
"props": {
|
|
50878
|
-
"text": "Ask Aria",
|
|
50879
|
-
"style": "bodyEmphasis"
|
|
50880
|
-
}
|
|
50881
|
-
}
|
|
50882
|
-
}
|
|
50883
|
-
]
|
|
50884
|
-
}
|
|
50885
|
-
}
|
|
50886
|
-
},
|
|
50887
|
-
{
|
|
50888
|
-
"id": "",
|
|
50889
|
-
"body": {
|
|
50890
|
-
"package": "himalaya",
|
|
50891
|
-
"type": "Spacer",
|
|
50892
|
-
"props": {}
|
|
50893
|
-
}
|
|
50894
|
-
},
|
|
50895
|
-
{
|
|
50896
|
-
"id": "",
|
|
50897
|
-
"body": {
|
|
50898
|
-
"package": "himalaya",
|
|
50899
|
-
"type": "Icon",
|
|
50900
|
-
"props": {
|
|
50901
|
-
"name": "chevron_right",
|
|
50902
|
-
"size": 16,
|
|
50903
|
-
"tint": "textTertiary"
|
|
50904
|
-
}
|
|
50905
|
-
}
|
|
50906
|
-
}
|
|
50907
|
-
]
|
|
50908
|
-
}
|
|
50909
|
-
},
|
|
50910
|
-
"modifiers": {
|
|
50911
|
-
"background": {
|
|
50912
|
-
"token": "surfaceElevated"
|
|
50913
|
-
},
|
|
50914
|
-
"border": {
|
|
50915
|
-
"width": 1,
|
|
50916
|
-
"color": {
|
|
50917
|
-
"token": "border"
|
|
50918
|
-
}
|
|
50919
|
-
},
|
|
50920
|
-
"cornerRadius": 12,
|
|
50921
|
-
"padding": {
|
|
50922
|
-
"leading": 14,
|
|
50923
|
-
"trailing": 14,
|
|
50924
|
-
"top": 14,
|
|
50925
|
-
"bottom": 14
|
|
50926
|
-
},
|
|
50927
|
-
"onTap": {
|
|
50928
|
-
"actionId": "himi.open",
|
|
50929
|
-
"params": {
|
|
50930
|
-
"screenId": "himi_owner_lite_aria"
|
|
50931
|
-
}
|
|
50932
|
-
},
|
|
50933
|
-
"pressFeedback": "scale",
|
|
50934
|
-
"haptic": "light",
|
|
50935
|
-
"accessibilityLabel": "himi_owner_lite.manage_aria"
|
|
50936
|
-
}
|
|
50937
50843
|
}
|
|
50938
50844
|
]
|
|
50939
50845
|
}
|
|
@@ -153,6 +153,10 @@ export interface AriaChatLabels {
|
|
|
153
153
|
typing?: Resolvable<string>;
|
|
154
154
|
/** Status line when the wait ran out without a reply. */
|
|
155
155
|
slow?: Resolvable<string>;
|
|
156
|
+
/** Shown instead of a raw transport error when this HOST cannot reach Wix at
|
|
157
|
+
* all — it carries no Wix app binding to sign the chat-service call with.
|
|
158
|
+
* See `isWixAccountUnreachable`, and note what it is NOT: a signed-out user. */
|
|
159
|
+
unavailable?: Resolvable<string>;
|
|
156
160
|
}
|
|
157
161
|
|
|
158
162
|
export interface AriaChatOptions {
|
|
@@ -271,6 +275,62 @@ export function hostOf(url: string): string {
|
|
|
271
275
|
return PLAIN_HOST.test(host) ? host : "";
|
|
272
276
|
}
|
|
273
277
|
|
|
278
|
+
/** The web bridge's DESIGNED refusals — the ones that mean "this host cannot
|
|
279
|
+
* reach Wix", as opposed to "the chat-service is broken".
|
|
280
|
+
*
|
|
281
|
+
* Matched by NAME, never by the 501 status alone: 501 is also what an unrelated
|
|
282
|
+
* gateway failure carries, and an unknown future refusal should stay loud rather
|
|
283
|
+
* than be quietly absorbed into a reassuring sentence.
|
|
284
|
+
*
|
|
285
|
+
* - `webwix_bridge_no_client_id` — the host carries no Wix app binding at all,
|
|
286
|
+
* so nothing can be signed and no Wix call leaves the browser.
|
|
287
|
+
* - `webwix_owner_only` — the call targets an owner-scoped Wix host
|
|
288
|
+
* (`*.wix.com`) rather than the `wixapis.com` gateway the web bridge is
|
|
289
|
+
* host-locked to. Aria's chat-service lives on `manage.wix.com`, so on web
|
|
290
|
+
* this is the refusal it gets once a site IS connected: structural, and not
|
|
291
|
+
* fixed by any amount of signing in or re-binding.
|
|
292
|
+
* - `webwix_owner_mint_failed` — no owner session for this business on this
|
|
293
|
+
* host. The shell already puts its own "Sign in to Wix again" affordance up
|
|
294
|
+
* for this one, so Aria says the same neutral thing rather than competing
|
|
295
|
+
* with it.
|
|
296
|
+
*
|
|
297
|
+
* ALL THREE READ THE SAME WAY TO AN OWNER: Aria cannot work on this surface,
|
|
298
|
+
* and nothing they do in the chat will change it. None of them is a reason to
|
|
299
|
+
* show red, and none is a reason to tell them to sign in — an earlier version
|
|
300
|
+
* of this said "Sign in to your Wix account" and was wrong on exactly that
|
|
301
|
+
* point, since the owner is typically already signed in.
|
|
302
|
+
*
|
|
303
|
+
* Aria cannot degrade to sample rows the way the data screens do — there is no
|
|
304
|
+
* conversation to invent — so it degrades to the greeting plus one plain
|
|
305
|
+
* sentence in the NEUTRAL status line. */
|
|
306
|
+
const DESIGNED_BRIDGE_REFUSALS = [
|
|
307
|
+
"webwix_bridge_no_client_id",
|
|
308
|
+
"webwix_owner_only",
|
|
309
|
+
"webwix_owner_mint_failed",
|
|
310
|
+
];
|
|
311
|
+
|
|
312
|
+
export function isWixAccountUnreachable(e: unknown): boolean {
|
|
313
|
+
const msg = String((e as Error)?.message ?? e ?? "");
|
|
314
|
+
return DESIGNED_BRIDGE_REFUSALS.some((name) => msg.includes(name));
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/** Which of the screen's two message slots a failure belongs in.
|
|
318
|
+
*
|
|
319
|
+
* Both already exist and they say different things: `error` renders in `danger`
|
|
320
|
+
* and `statusText` in `textSecondary`. "This host has no owner session" is not
|
|
321
|
+
* a fault, so putting it in the red slot still tells the owner something broke
|
|
322
|
+
* and sends them looking for a breakage that is not there — the words would be
|
|
323
|
+
* right and the colour would be lying. It goes in the neutral slot instead.
|
|
324
|
+
*
|
|
325
|
+
* Always returns BOTH keys so the two can never show at once: a real error
|
|
326
|
+
* clears any stale status line, and the signed-out sentence clears any red text
|
|
327
|
+
* left over from an earlier failure. */
|
|
328
|
+
function failureSlots(e: unknown, unavailable: () => string): { error: string; statusText: string } {
|
|
329
|
+
return isWixAccountUnreachable(e)
|
|
330
|
+
? { error: "", statusText: unavailable() }
|
|
331
|
+
: { error: String((e as Error)?.message ?? e), statusText: "" };
|
|
332
|
+
}
|
|
333
|
+
|
|
274
334
|
/** Is this url somewhere Wix itself serves?
|
|
275
335
|
*
|
|
276
336
|
* Guarded by `PLAIN_HOST` first. The suffix tests are string operations, so
|
|
@@ -528,6 +588,13 @@ export function createAriaChat(o: AriaChatOptions): AriaChatCore {
|
|
|
528
588
|
const you = () => res(o.labels?.you ?? "You");
|
|
529
589
|
const typingText = () => res(o.labels?.typing ?? `${assistant()} is typing…`);
|
|
530
590
|
const slowText = () => res(o.labels?.slow ?? `${assistant()} is taking a while…`);
|
|
591
|
+
// States the fact and stops. It deliberately gives no instruction, because
|
|
592
|
+
// there is none the owner could follow: they are signed in, and the thing that
|
|
593
|
+
// is missing is the app's own Wix binding. "Here" is doing real work — it says
|
|
594
|
+
// the limit is this surface, not their account and not Aria.
|
|
595
|
+
const unavailableText = () => res(
|
|
596
|
+
o.labels?.unavailable ?? `${assistant()} can't reach your Wix account from here.`,
|
|
597
|
+
);
|
|
531
598
|
const promptList = () => res(o.prompts);
|
|
532
599
|
const siteOf = o.siteId ?? (() => "");
|
|
533
600
|
const resumeOf = o.resumeConversationId ?? inputConversationId;
|
|
@@ -686,12 +753,14 @@ export function createAriaChat(o: AriaChatOptions): AriaChatCore {
|
|
|
686
753
|
} catch (e) {
|
|
687
754
|
inFlightSend = null;
|
|
688
755
|
return {
|
|
689
|
-
...base, status: "ready",
|
|
756
|
+
...base, status: "ready", _pending: "",
|
|
690
757
|
// `_siteId` moves with the id or neither does: a conversation remembered
|
|
691
758
|
// without the site it belongs to reads as another business's on the next
|
|
692
759
|
// send, and gets replaced instead of retried.
|
|
693
760
|
_convId: convId, _siteId: convId === s._convId ? s._siteId : site,
|
|
694
|
-
error
|
|
761
|
+
// Sets BOTH error and statusText, so it must come after the `statusText: ""`
|
|
762
|
+
// this object used to carry — otherwise the literal would blank the sentence.
|
|
763
|
+
...failureSlots(e, unavailableText),
|
|
695
764
|
};
|
|
696
765
|
}
|
|
697
766
|
}
|
|
@@ -756,7 +825,7 @@ export function createAriaChat(o: AriaChatOptions): AriaChatCore {
|
|
|
756
825
|
messages: greetingOnly(), ...observed([]), prompts: promptList() };
|
|
757
826
|
} catch (e) {
|
|
758
827
|
// Even if create fails, show the greeting; submit retries the create.
|
|
759
|
-
return { ...s, status: "ready", _convId: "", _siteId: site, _pending: "",
|
|
828
|
+
return { ...s, status: "ready", _convId: "", _siteId: site, _pending: "", ...failureSlots(e, unavailableText),
|
|
760
829
|
messages: greetingOnly(), ...observed([]), prompts: promptList() };
|
|
761
830
|
}
|
|
762
831
|
},
|
|
@@ -801,7 +870,7 @@ export function createAriaChat(o: AriaChatOptions): AriaChatCore {
|
|
|
801
870
|
return slow({ ...s, status: "ready", _convId: conversationIdOf(res), _siteId: site, input: "", statusText: "", error: "",
|
|
802
871
|
_pending: "", messages: greetingOnly(), ...observed([]), prompts: promptList(), ok: false });
|
|
803
872
|
} catch (e) {
|
|
804
|
-
return slow({ ...s, status: "ready", _convId: "", _siteId: site, input: "",
|
|
873
|
+
return slow({ ...s, status: "ready", _convId: "", _siteId: site, input: "", ...failureSlots(e, unavailableText),
|
|
805
874
|
_pending: "", messages: greetingOnly(), ...observed([]), prompts: promptList(), ok: false });
|
|
806
875
|
}
|
|
807
876
|
},
|
|
@@ -141,6 +141,13 @@ const core = createAriaChat({
|
|
|
141
141
|
you: () => copyParam("ownerAria.you", "You"),
|
|
142
142
|
typing: () => copyParam("ownerAria.typing", "Aria is typing…"),
|
|
143
143
|
slow: () => copyParam("ownerAria.slow", "Aria is taking a while…"),
|
|
144
|
+
// Shown when the HOST carries no Wix app binding, so no Wix call can leave
|
|
145
|
+
// the browser (the web preview). Through copyParam like every other string
|
|
146
|
+
// here — a default baked into the shared core cannot be localized by this
|
|
147
|
+
// app's copy pack, and a non-English owner would have read this one line in
|
|
148
|
+
// English. Says no "sign in": the owner already is, and the missing piece is
|
|
149
|
+
// the app's binding, so there is no action for them to take.
|
|
150
|
+
unavailable: () => copyParam("ownerAria.unavailable", "Aria can't reach your Wix account from here."),
|
|
144
151
|
},
|
|
145
152
|
historyKey: "ol.aria.history.v1",
|
|
146
153
|
// No local title cache in THIS app. __HIMI_APP_NAME__ is multi-account and
|
|
@@ -103,15 +103,15 @@ export default defineApp({
|
|
|
103
103
|
"paramKeys": [
|
|
104
104
|
"conversationId"
|
|
105
105
|
],
|
|
106
|
-
"parentScreenId": "
|
|
107
|
-
"tabId": "
|
|
106
|
+
"parentScreenId": "",
|
|
107
|
+
"tabId": "aria"
|
|
108
108
|
},
|
|
109
109
|
{
|
|
110
110
|
"screenId": "himi_owner_lite_aria_history",
|
|
111
111
|
"isPublic": false,
|
|
112
112
|
"paramKeys": [],
|
|
113
113
|
"parentScreenId": "himi_owner_lite_aria",
|
|
114
|
-
"tabId": "
|
|
114
|
+
"tabId": "aria"
|
|
115
115
|
},
|
|
116
116
|
{
|
|
117
117
|
"screenId": "himi_owner_lite_brief",
|
|
@@ -485,7 +485,7 @@ export default defineApp({
|
|
|
485
485
|
"isPublic": false,
|
|
486
486
|
"paramKeys": [],
|
|
487
487
|
"parentScreenId": "",
|
|
488
|
-
"tabId": "
|
|
488
|
+
"tabId": ""
|
|
489
489
|
}
|
|
490
490
|
],
|
|
491
491
|
"tabBar": {
|
|
@@ -497,6 +497,36 @@ export default defineApp({
|
|
|
497
497
|
"icon": "home",
|
|
498
498
|
"selectedIcon": "home_fill"
|
|
499
499
|
},
|
|
500
|
+
{
|
|
501
|
+
"id": "aria",
|
|
502
|
+
"screenId": "himi_owner_lite_aria",
|
|
503
|
+
"label": "Aria",
|
|
504
|
+
"icon": "ai"
|
|
505
|
+
},
|
|
506
|
+
{
|
|
507
|
+
"id": "manage",
|
|
508
|
+
"screenId": "himi_owner_lite_manage",
|
|
509
|
+
"label": "Shop",
|
|
510
|
+
"icon": "grid",
|
|
511
|
+
"selectedIcon": "grid_fill"
|
|
512
|
+
}
|
|
513
|
+
]
|
|
514
|
+
},
|
|
515
|
+
"sidebar": {
|
|
516
|
+
"items": [
|
|
517
|
+
{
|
|
518
|
+
"id": "home",
|
|
519
|
+
"screenId": "himi_owner_lite_home",
|
|
520
|
+
"label": "Back office",
|
|
521
|
+
"icon": "home",
|
|
522
|
+
"selectedIcon": "home_fill"
|
|
523
|
+
},
|
|
524
|
+
{
|
|
525
|
+
"id": "aria",
|
|
526
|
+
"screenId": "himi_owner_lite_aria",
|
|
527
|
+
"label": "Aria",
|
|
528
|
+
"icon": "ai"
|
|
529
|
+
},
|
|
500
530
|
{
|
|
501
531
|
"id": "manage",
|
|
502
532
|
"screenId": "himi_owner_lite_manage",
|
|
@@ -50686,100 +50686,6 @@ const SCREENS = runtimeSetting({
|
|
|
50686
50686
|
"haptic": "light",
|
|
50687
50687
|
"accessibilityLabel": "himi_owner_lite.manage_analytics"
|
|
50688
50688
|
}
|
|
50689
|
-
},
|
|
50690
|
-
{
|
|
50691
|
-
"id": "",
|
|
50692
|
-
"body": {
|
|
50693
|
-
"package": "himalaya",
|
|
50694
|
-
"type": "HStack",
|
|
50695
|
-
"props": {
|
|
50696
|
-
"spacing": 12,
|
|
50697
|
-
"children": [
|
|
50698
|
-
{
|
|
50699
|
-
"id": "",
|
|
50700
|
-
"body": {
|
|
50701
|
-
"package": "himalaya",
|
|
50702
|
-
"type": "HStack",
|
|
50703
|
-
"props": {
|
|
50704
|
-
"spacing": 12,
|
|
50705
|
-
"children": [
|
|
50706
|
-
{
|
|
50707
|
-
"id": "",
|
|
50708
|
-
"body": {
|
|
50709
|
-
"package": "himalaya",
|
|
50710
|
-
"type": "Icon",
|
|
50711
|
-
"props": {
|
|
50712
|
-
"name": "chat",
|
|
50713
|
-
"size": 20,
|
|
50714
|
-
"tint": "accentPrimary"
|
|
50715
|
-
}
|
|
50716
|
-
}
|
|
50717
|
-
},
|
|
50718
|
-
{
|
|
50719
|
-
"id": "",
|
|
50720
|
-
"body": {
|
|
50721
|
-
"package": "himalaya",
|
|
50722
|
-
"type": "Text",
|
|
50723
|
-
"props": {
|
|
50724
|
-
"text": "Ask Aria",
|
|
50725
|
-
"style": "bodyEmphasis"
|
|
50726
|
-
}
|
|
50727
|
-
}
|
|
50728
|
-
}
|
|
50729
|
-
]
|
|
50730
|
-
}
|
|
50731
|
-
}
|
|
50732
|
-
},
|
|
50733
|
-
{
|
|
50734
|
-
"id": "",
|
|
50735
|
-
"body": {
|
|
50736
|
-
"package": "himalaya",
|
|
50737
|
-
"type": "Spacer",
|
|
50738
|
-
"props": {}
|
|
50739
|
-
}
|
|
50740
|
-
},
|
|
50741
|
-
{
|
|
50742
|
-
"id": "",
|
|
50743
|
-
"body": {
|
|
50744
|
-
"package": "himalaya",
|
|
50745
|
-
"type": "Icon",
|
|
50746
|
-
"props": {
|
|
50747
|
-
"name": "chevron_right",
|
|
50748
|
-
"size": 16,
|
|
50749
|
-
"tint": "textTertiary"
|
|
50750
|
-
}
|
|
50751
|
-
}
|
|
50752
|
-
}
|
|
50753
|
-
]
|
|
50754
|
-
}
|
|
50755
|
-
},
|
|
50756
|
-
"modifiers": {
|
|
50757
|
-
"background": {
|
|
50758
|
-
"token": "surfaceElevated"
|
|
50759
|
-
},
|
|
50760
|
-
"border": {
|
|
50761
|
-
"width": 1,
|
|
50762
|
-
"color": {
|
|
50763
|
-
"token": "border"
|
|
50764
|
-
}
|
|
50765
|
-
},
|
|
50766
|
-
"cornerRadius": 12,
|
|
50767
|
-
"padding": {
|
|
50768
|
-
"leading": 14,
|
|
50769
|
-
"trailing": 14,
|
|
50770
|
-
"top": 14,
|
|
50771
|
-
"bottom": 14
|
|
50772
|
-
},
|
|
50773
|
-
"onTap": {
|
|
50774
|
-
"actionId": "himi.open",
|
|
50775
|
-
"params": {
|
|
50776
|
-
"screenId": "himi_owner_lite_aria"
|
|
50777
|
-
}
|
|
50778
|
-
},
|
|
50779
|
-
"pressFeedback": "scale",
|
|
50780
|
-
"haptic": "light",
|
|
50781
|
-
"accessibilityLabel": "himi_owner_lite.manage_aria"
|
|
50782
|
-
}
|
|
50783
50689
|
}
|
|
50784
50690
|
]
|
|
50785
50691
|
}
|