@wix/himalaya-cli 0.1406.0 → 0.1408.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/_types/core/dev-server/src/builder.d.ts +1 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/wix-cache-policy.d.ts +64 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/wix-platform/src/index.d.ts +1 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/wix-platform/src/offline.d.ts +66 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/define-app.d.ts +10 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/schema.d.ts +4 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-platform.mjs +58 -25
- package/dist/cli.mjs +310 -67
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/component-reference.json +1 -1
- package/guides/component-reference.md +4 -0
- package/guides/sdk-reference.json +6 -0
- package/guides/wix-api-usage.md +49 -0
- package/package.json +2 -2
- package/templates/beauty-salon-owner/dev/index.ts +49 -30
- package/templates/beauty-salon-owner/tier5-src/_shared/aria-chat.ts +8 -6
- package/templates/beauty-salon-owner/tier5-src/_shared/aria-widget-model.ts +84 -1
- package/templates/beauty-salon-owner/tier5-src/_shared/aria-widget-view.ts +34 -13
- package/templates/community-club-owner/dev/index.ts +49 -30
- package/templates/community-club-owner/tier5-src/_shared/aria-chat.ts +8 -6
- package/templates/community-club-owner/tier5-src/_shared/aria-widget-model.ts +84 -1
- package/templates/community-club-owner/tier5-src/_shared/aria-widget-view.ts +34 -13
- package/templates/events-meetups-owner/dev/index.ts +49 -30
- package/templates/events-meetups-owner/tier5-src/_shared/aria-chat.ts +8 -6
- package/templates/events-meetups-owner/tier5-src/_shared/aria-widget-model.ts +84 -1
- package/templates/events-meetups-owner/tier5-src/_shared/aria-widget-view.ts +34 -13
- package/templates/gym-fitness-owner/dev/index.ts +49 -30
- package/templates/gym-fitness-owner/tier5-src/_shared/aria-chat.ts +8 -6
- package/templates/gym-fitness-owner/tier5-src/_shared/aria-widget-model.ts +84 -1
- package/templates/gym-fitness-owner/tier5-src/_shared/aria-widget-view.ts +34 -13
- package/templates/nonprofit-cause-owner/dev/index.ts +49 -30
- package/templates/nonprofit-cause-owner/tier5-src/_shared/aria-chat.ts +8 -6
- package/templates/nonprofit-cause-owner/tier5-src/_shared/aria-widget-model.ts +84 -1
- package/templates/nonprofit-cause-owner/tier5-src/_shared/aria-widget-view.ts +34 -13
- package/templates/owner-lite/dev/index.ts +49 -30
- package/templates/owner-lite/tier5-src/_shared/aria-chat.ts +8 -6
- package/templates/owner-lite/tier5-src/_shared/aria-widget-model.ts +84 -1
- package/templates/owner-lite/tier5-src/_shared/aria-widget-view.ts +34 -13
- package/templates/podcast-creator-owner/dev/index.ts +49 -30
- package/templates/podcast-creator-owner/tier5-src/_shared/aria-chat.ts +8 -6
- package/templates/podcast-creator-owner/tier5-src/_shared/aria-widget-model.ts +84 -1
- package/templates/podcast-creator-owner/tier5-src/_shared/aria-widget-view.ts +34 -13
- package/templates/portfolio-creative-owner/dev/index.ts +49 -30
- package/templates/portfolio-creative-owner/tier5-src/_shared/aria-chat.ts +8 -6
- package/templates/portfolio-creative-owner/tier5-src/_shared/aria-widget-model.ts +84 -1
- package/templates/portfolio-creative-owner/tier5-src/_shared/aria-widget-view.ts +34 -13
- package/templates/restaurant-owner/dev/index.ts +49 -30
- package/templates/restaurant-owner/tier5-src/_shared/aria-chat.ts +8 -6
- package/templates/restaurant-owner/tier5-src/_shared/aria-widget-model.ts +84 -1
- package/templates/restaurant-owner/tier5-src/_shared/aria-widget-view.ts +34 -13
- package/templates/retail-store-owner/dev/index.ts +49 -30
- package/templates/retail-store-owner/tier5-src/_shared/aria-chat.ts +8 -6
- package/templates/retail-store-owner/tier5-src/_shared/aria-widget-model.ts +84 -1
- package/templates/retail-store-owner/tier5-src/_shared/aria-widget-view.ts +34 -13
- package/templates/yoga-studio-owner/dev/index.ts +49 -30
- package/templates/yoga-studio-owner/tier5-src/_shared/aria-chat.ts +8 -6
- package/templates/yoga-studio-owner/tier5-src/_shared/aria-widget-model.ts +84 -1
- package/templates/yoga-studio-owner/tier5-src/_shared/aria-widget-view.ts +34 -13
|
@@ -57609,7 +57609,7 @@ const SCREENS = runtimeSetting({
|
|
|
57609
57609
|
"height": 44,
|
|
57610
57610
|
"shape": "rounded",
|
|
57611
57611
|
"contentMode": "fill",
|
|
57612
|
-
"contentDescription": "$item.
|
|
57612
|
+
"contentDescription": "$item.label"
|
|
57613
57613
|
}
|
|
57614
57614
|
},
|
|
57615
57615
|
"modifiers": {
|
|
@@ -57617,6 +57617,7 @@ const SCREENS = runtimeSetting({
|
|
|
57617
57617
|
}
|
|
57618
57618
|
},
|
|
57619
57619
|
"title": "$item.title",
|
|
57620
|
+
"markdown": true,
|
|
57620
57621
|
"subtitle": "$item.subtitle",
|
|
57621
57622
|
"trailing": {
|
|
57622
57623
|
"id": "himi_owner_lite_aria.widget.SINGLE_SELECT.pick_$item.id",
|
|
@@ -57881,7 +57882,7 @@ const SCREENS = runtimeSetting({
|
|
|
57881
57882
|
}
|
|
57882
57883
|
},
|
|
57883
57884
|
"modifiers": {
|
|
57884
|
-
"accessibilityLabel": "$item.
|
|
57885
|
+
"accessibilityLabel": "$item.label"
|
|
57885
57886
|
}
|
|
57886
57887
|
},
|
|
57887
57888
|
{
|
|
@@ -57895,7 +57896,7 @@ const SCREENS = runtimeSetting({
|
|
|
57895
57896
|
"height": 36,
|
|
57896
57897
|
"shape": "rounded",
|
|
57897
57898
|
"contentMode": "fill",
|
|
57898
|
-
"contentDescription": "$item.
|
|
57899
|
+
"contentDescription": "$item.label"
|
|
57899
57900
|
}
|
|
57900
57901
|
},
|
|
57901
57902
|
"modifiers": {
|
|
@@ -57918,7 +57919,8 @@ const SCREENS = runtimeSetting({
|
|
|
57918
57919
|
"props": {
|
|
57919
57920
|
"text": "$item.title",
|
|
57920
57921
|
"style": "body",
|
|
57921
|
-
"maxLines": 2
|
|
57922
|
+
"maxLines": 2,
|
|
57923
|
+
"markdown": true
|
|
57922
57924
|
}
|
|
57923
57925
|
}
|
|
57924
57926
|
},
|
|
@@ -57931,7 +57933,8 @@ const SCREENS = runtimeSetting({
|
|
|
57931
57933
|
"text": "$item.subtitle",
|
|
57932
57934
|
"style": "footnote",
|
|
57933
57935
|
"color": "textSecondary",
|
|
57934
|
-
"maxLines": 2
|
|
57936
|
+
"maxLines": 2,
|
|
57937
|
+
"markdown": true
|
|
57935
57938
|
}
|
|
57936
57939
|
},
|
|
57937
57940
|
"modifiers": {
|
|
@@ -57999,7 +58002,7 @@ const SCREENS = runtimeSetting({
|
|
|
57999
58002
|
"aspectRatio": 1,
|
|
58000
58003
|
"shape": "rounded",
|
|
58001
58004
|
"contentMode": "fill",
|
|
58002
|
-
"contentDescription": "$item.
|
|
58005
|
+
"contentDescription": "$item.label"
|
|
58003
58006
|
}
|
|
58004
58007
|
},
|
|
58005
58008
|
"modifiers": {
|
|
@@ -58031,7 +58034,7 @@ const SCREENS = runtimeSetting({
|
|
|
58031
58034
|
}
|
|
58032
58035
|
},
|
|
58033
58036
|
"modifiers": {
|
|
58034
|
-
"accessibilityLabel": "$item.
|
|
58037
|
+
"accessibilityLabel": "$item.label"
|
|
58035
58038
|
}
|
|
58036
58039
|
},
|
|
58037
58040
|
{
|
|
@@ -58050,7 +58053,8 @@ const SCREENS = runtimeSetting({
|
|
|
58050
58053
|
"props": {
|
|
58051
58054
|
"text": "$item.title",
|
|
58052
58055
|
"style": "body",
|
|
58053
|
-
"maxLines": 2
|
|
58056
|
+
"maxLines": 2,
|
|
58057
|
+
"markdown": true
|
|
58054
58058
|
}
|
|
58055
58059
|
}
|
|
58056
58060
|
},
|
|
@@ -58063,7 +58067,8 @@ const SCREENS = runtimeSetting({
|
|
|
58063
58067
|
"text": "$item.subtitle",
|
|
58064
58068
|
"style": "footnote",
|
|
58065
58069
|
"color": "textSecondary",
|
|
58066
|
-
"maxLines": 2
|
|
58070
|
+
"maxLines": 2,
|
|
58071
|
+
"markdown": true
|
|
58067
58072
|
}
|
|
58068
58073
|
},
|
|
58069
58074
|
"modifiers": {
|
|
@@ -58514,7 +58519,7 @@ const SCREENS = runtimeSetting({
|
|
|
58514
58519
|
}
|
|
58515
58520
|
},
|
|
58516
58521
|
"modifiers": {
|
|
58517
|
-
"accessibilityLabel": "$item.
|
|
58522
|
+
"accessibilityLabel": "$item.label"
|
|
58518
58523
|
}
|
|
58519
58524
|
},
|
|
58520
58525
|
{
|
|
@@ -58528,7 +58533,7 @@ const SCREENS = runtimeSetting({
|
|
|
58528
58533
|
"height": 36,
|
|
58529
58534
|
"shape": "rounded",
|
|
58530
58535
|
"contentMode": "fill",
|
|
58531
|
-
"contentDescription": "$item.
|
|
58536
|
+
"contentDescription": "$item.label"
|
|
58532
58537
|
}
|
|
58533
58538
|
},
|
|
58534
58539
|
"modifiers": {
|
|
@@ -58551,7 +58556,8 @@ const SCREENS = runtimeSetting({
|
|
|
58551
58556
|
"props": {
|
|
58552
58557
|
"text": "$item.title",
|
|
58553
58558
|
"style": "body",
|
|
58554
|
-
"maxLines": 2
|
|
58559
|
+
"maxLines": 2,
|
|
58560
|
+
"markdown": true
|
|
58555
58561
|
}
|
|
58556
58562
|
}
|
|
58557
58563
|
},
|
|
@@ -58564,7 +58570,8 @@ const SCREENS = runtimeSetting({
|
|
|
58564
58570
|
"text": "$item.subtitle",
|
|
58565
58571
|
"style": "footnote",
|
|
58566
58572
|
"color": "textSecondary",
|
|
58567
|
-
"maxLines": 2
|
|
58573
|
+
"maxLines": 2,
|
|
58574
|
+
"markdown": true
|
|
58568
58575
|
}
|
|
58569
58576
|
},
|
|
58570
58577
|
"modifiers": {
|
|
@@ -58803,7 +58810,8 @@ const SCREENS = runtimeSetting({
|
|
|
58803
58810
|
"props": {
|
|
58804
58811
|
"text": "$item.title",
|
|
58805
58812
|
"style": "bodyEmphasis",
|
|
58806
|
-
"maxLines": 2
|
|
58813
|
+
"maxLines": 2,
|
|
58814
|
+
"markdown": true
|
|
58807
58815
|
}
|
|
58808
58816
|
}
|
|
58809
58817
|
},
|
|
@@ -58815,7 +58823,8 @@ const SCREENS = runtimeSetting({
|
|
|
58815
58823
|
"props": {
|
|
58816
58824
|
"text": "$item.subtitle",
|
|
58817
58825
|
"style": "title3",
|
|
58818
|
-
"maxLines": 1
|
|
58826
|
+
"maxLines": 1,
|
|
58827
|
+
"markdown": true
|
|
58819
58828
|
}
|
|
58820
58829
|
},
|
|
58821
58830
|
"modifiers": {
|
|
@@ -58900,7 +58909,8 @@ const SCREENS = runtimeSetting({
|
|
|
58900
58909
|
"props": {
|
|
58901
58910
|
"text": "$item.text",
|
|
58902
58911
|
"style": "footnote",
|
|
58903
|
-
"maxLines": 8
|
|
58912
|
+
"maxLines": 8,
|
|
58913
|
+
"markdown": true
|
|
58904
58914
|
}
|
|
58905
58915
|
},
|
|
58906
58916
|
"modifiers": {
|
|
@@ -59345,7 +59355,7 @@ const SCREENS = runtimeSetting({
|
|
|
59345
59355
|
"fillWidth": true,
|
|
59346
59356
|
"aspectRatio": 1.5,
|
|
59347
59357
|
"contentMode": "fill",
|
|
59348
|
-
"contentDescription": "$item.
|
|
59358
|
+
"contentDescription": "$item.label"
|
|
59349
59359
|
}
|
|
59350
59360
|
},
|
|
59351
59361
|
"modifiers": {
|
|
@@ -59406,7 +59416,8 @@ const SCREENS = runtimeSetting({
|
|
|
59406
59416
|
"type": "Text",
|
|
59407
59417
|
"props": {
|
|
59408
59418
|
"text": "$item.title",
|
|
59409
|
-
"style": "bodyEmphasis"
|
|
59419
|
+
"style": "bodyEmphasis",
|
|
59420
|
+
"markdown": true
|
|
59410
59421
|
}
|
|
59411
59422
|
}
|
|
59412
59423
|
},
|
|
@@ -59418,7 +59429,8 @@ const SCREENS = runtimeSetting({
|
|
|
59418
59429
|
"props": {
|
|
59419
59430
|
"text": "$item.subtitle",
|
|
59420
59431
|
"style": "body",
|
|
59421
|
-
"color": "textSecondary"
|
|
59432
|
+
"color": "textSecondary",
|
|
59433
|
+
"markdown": true
|
|
59422
59434
|
}
|
|
59423
59435
|
},
|
|
59424
59436
|
"modifiers": {
|
|
@@ -59432,7 +59444,8 @@ const SCREENS = runtimeSetting({
|
|
|
59432
59444
|
"type": "Text",
|
|
59433
59445
|
"props": {
|
|
59434
59446
|
"text": "$item.text",
|
|
59435
|
-
"style": "body"
|
|
59447
|
+
"style": "body",
|
|
59448
|
+
"markdown": true
|
|
59436
59449
|
}
|
|
59437
59450
|
},
|
|
59438
59451
|
"modifiers": {
|
|
@@ -59446,7 +59459,8 @@ const SCREENS = runtimeSetting({
|
|
|
59446
59459
|
"type": "Text",
|
|
59447
59460
|
"props": {
|
|
59448
59461
|
"text": "$item.listText",
|
|
59449
|
-
"style": "body"
|
|
59462
|
+
"style": "body",
|
|
59463
|
+
"markdown": true
|
|
59450
59464
|
}
|
|
59451
59465
|
},
|
|
59452
59466
|
"modifiers": {
|
|
@@ -59654,7 +59668,7 @@ const SCREENS = runtimeSetting({
|
|
|
59654
59668
|
"height": 36,
|
|
59655
59669
|
"shape": "rounded",
|
|
59656
59670
|
"contentMode": "fill",
|
|
59657
|
-
"contentDescription": "$item.
|
|
59671
|
+
"contentDescription": "$item.label"
|
|
59658
59672
|
}
|
|
59659
59673
|
},
|
|
59660
59674
|
"modifiers": {
|
|
@@ -59662,6 +59676,7 @@ const SCREENS = runtimeSetting({
|
|
|
59662
59676
|
}
|
|
59663
59677
|
},
|
|
59664
59678
|
"title": "$item.title",
|
|
59679
|
+
"markdown": true,
|
|
59665
59680
|
"subtitle": "$item.subtitle",
|
|
59666
59681
|
"onTap": {
|
|
59667
59682
|
"actionId": "tier5.himiOwnerLiteAria.widgetPick",
|
|
@@ -59905,7 +59920,7 @@ const SCREENS = runtimeSetting({
|
|
|
59905
59920
|
}
|
|
59906
59921
|
},
|
|
59907
59922
|
"modifiers": {
|
|
59908
|
-
"accessibilityLabel": "$item.
|
|
59923
|
+
"accessibilityLabel": "$item.label"
|
|
59909
59924
|
}
|
|
59910
59925
|
},
|
|
59911
59926
|
{
|
|
@@ -59919,7 +59934,7 @@ const SCREENS = runtimeSetting({
|
|
|
59919
59934
|
"height": 36,
|
|
59920
59935
|
"shape": "rounded",
|
|
59921
59936
|
"contentMode": "fill",
|
|
59922
|
-
"contentDescription": "$item.
|
|
59937
|
+
"contentDescription": "$item.label"
|
|
59923
59938
|
}
|
|
59924
59939
|
},
|
|
59925
59940
|
"modifiers": {
|
|
@@ -60263,7 +60278,7 @@ const SCREENS = runtimeSetting({
|
|
|
60263
60278
|
}
|
|
60264
60279
|
},
|
|
60265
60280
|
"modifiers": {
|
|
60266
|
-
"accessibilityLabel": "$item.
|
|
60281
|
+
"accessibilityLabel": "$item.label"
|
|
60267
60282
|
}
|
|
60268
60283
|
},
|
|
60269
60284
|
{
|
|
@@ -60282,7 +60297,8 @@ const SCREENS = runtimeSetting({
|
|
|
60282
60297
|
"props": {
|
|
60283
60298
|
"text": "$item.title",
|
|
60284
60299
|
"style": "body",
|
|
60285
|
-
"maxLines": 2
|
|
60300
|
+
"maxLines": 2,
|
|
60301
|
+
"markdown": true
|
|
60286
60302
|
}
|
|
60287
60303
|
}
|
|
60288
60304
|
},
|
|
@@ -60295,7 +60311,8 @@ const SCREENS = runtimeSetting({
|
|
|
60295
60311
|
"text": "$item.subtitle",
|
|
60296
60312
|
"style": "footnote",
|
|
60297
60313
|
"color": "textSecondary",
|
|
60298
|
-
"maxLines": 2
|
|
60314
|
+
"maxLines": 2,
|
|
60315
|
+
"markdown": true
|
|
60299
60316
|
}
|
|
60300
60317
|
},
|
|
60301
60318
|
"modifiers": {
|
|
@@ -60359,7 +60376,7 @@ const SCREENS = runtimeSetting({
|
|
|
60359
60376
|
}
|
|
60360
60377
|
},
|
|
60361
60378
|
"modifiers": {
|
|
60362
|
-
"accessibilityLabel": "$item.
|
|
60379
|
+
"accessibilityLabel": "$item.label"
|
|
60363
60380
|
}
|
|
60364
60381
|
},
|
|
60365
60382
|
{
|
|
@@ -60378,7 +60395,8 @@ const SCREENS = runtimeSetting({
|
|
|
60378
60395
|
"props": {
|
|
60379
60396
|
"text": "$item.title",
|
|
60380
60397
|
"style": "body",
|
|
60381
|
-
"maxLines": 2
|
|
60398
|
+
"maxLines": 2,
|
|
60399
|
+
"markdown": true
|
|
60382
60400
|
}
|
|
60383
60401
|
}
|
|
60384
60402
|
},
|
|
@@ -60391,7 +60409,8 @@ const SCREENS = runtimeSetting({
|
|
|
60391
60409
|
"text": "$item.subtitle",
|
|
60392
60410
|
"style": "footnote",
|
|
60393
60411
|
"color": "textSecondary",
|
|
60394
|
-
"maxLines": 2
|
|
60412
|
+
"maxLines": 2,
|
|
60413
|
+
"markdown": true
|
|
60395
60414
|
}
|
|
60396
60415
|
},
|
|
60397
60416
|
"modifiers": {
|
|
@@ -77,7 +77,7 @@ import type { FileHandle } from "@himalaya/sdk-types";
|
|
|
77
77
|
import { createAriaUploadQueue } from "./aria-upload-queue.js";
|
|
78
78
|
import { runClientToolExchange, type AriaClientTools, type ConsentMemory } from "./aria-client-tools.js";
|
|
79
79
|
import { proseOfParts, scanEnvelopes, stripHidden } from "./aria-widgets.js";
|
|
80
|
-
import { isWebUrl, stripMarkdown } from "./aria-widget-model.js";
|
|
80
|
+
import { drawnText, isWebUrl, stripMarkdown } from "./aria-widget-model.js";
|
|
81
81
|
import {
|
|
82
82
|
DEFAULT_QUESTIONNAIRE_COPY,
|
|
83
83
|
NO_WIDGET,
|
|
@@ -86,6 +86,7 @@ import {
|
|
|
86
86
|
questionnaireAnswers,
|
|
87
87
|
questionnaireSynced,
|
|
88
88
|
sameQuestionnaire,
|
|
89
|
+
withLabels,
|
|
89
90
|
type QuestionnaireCopy,
|
|
90
91
|
type SubtreeSlot,
|
|
91
92
|
type WidgetOptionRow,
|
|
@@ -2573,7 +2574,7 @@ export function createAriaChat(o: AriaChatOptions): AriaChatCore {
|
|
|
2573
2574
|
const withWidgetQuery = (w: WidgetView, query: string): WidgetView => {
|
|
2574
2575
|
const needle = query.toLowerCase();
|
|
2575
2576
|
const suggestions = !needle ? w.options : w.options.filter((option) =>
|
|
2576
|
-
|
|
2577
|
+
[option.title, option.subtitle, option.text].map(drawnText).join(" ").toLowerCase().includes(needle));
|
|
2577
2578
|
return { ...w, query, suggestions, suggestionsEmpty: suggestions.length === 0,
|
|
2578
2579
|
noMatches: !!needle && suggestions.length === 0 };
|
|
2579
2580
|
};
|
|
@@ -2693,7 +2694,7 @@ export function createAriaChat(o: AriaChatOptions): AriaChatCore {
|
|
|
2693
2694
|
options = items.map((item, i) => {
|
|
2694
2695
|
const pictureUrl = isWixMediaHost(hostOf(item.imageUrl)) ? item.imageUrl : "";
|
|
2695
2696
|
return {
|
|
2696
|
-
id: `o${i}`, value: item.id, title: item.title, subtitle: item.subtitle,
|
|
2697
|
+
id: `o${i}`, value: item.id, title: item.title, label: item.title, subtitle: item.subtitle,
|
|
2697
2698
|
subtitleHidden: !item.subtitle, text: "", textHidden: true, badge: "", badgeHidden: true,
|
|
2698
2699
|
pictureUrl, pictureHidden: !pictureUrl, buttonLabel: "", buttonHidden: true,
|
|
2699
2700
|
listText: "", benefits: [], listHidden: true, selected: false, respondText: "",
|
|
@@ -3599,7 +3600,8 @@ export function createAriaChat(o: AriaChatOptions): AriaChatCore {
|
|
|
3599
3600
|
// Transcript scroll — a conversation rehydrated with no send token (state persisted
|
|
3600
3601
|
// before tokens existed) still opens at its latest turn.
|
|
3601
3602
|
const opened = s.scrollSend || isGreetingOnly(messages) ? {} : openedAtLatest(s, messages);
|
|
3602
|
-
const reused: AriaChatState = { ...s, status: "ready", messages, prompts: promptsFor(messages, chipsOf(s)), ...opened
|
|
3603
|
+
const reused: AriaChatState = { ...s, status: "ready", messages, prompts: promptsFor(messages, chipsOf(s)), ...opened,
|
|
3604
|
+
...(s.widget ? { widget: withLabels(s.widget) } : {}) };
|
|
3603
3605
|
// A persisted state can be waiting on a fetch that died with the previous
|
|
3604
3606
|
// process; nothing would ever settle it, so ask again. And one minted by a
|
|
3605
3607
|
// bundle from before the suggestions existed never asked at all — the
|
|
@@ -4081,8 +4083,8 @@ export function createAriaChat(o: AriaChatOptions): AriaChatCore {
|
|
|
4081
4083
|
: questionnaire
|
|
4082
4084
|
? [questionnaireAnswers(w)].filter(Boolean)
|
|
4083
4085
|
: option && !option.selected
|
|
4084
|
-
? [option.title || option.value]
|
|
4085
|
-
: w.options.filter((o) => o.selected).map((o) => o.title || o.value);
|
|
4086
|
+
? [option.label || option.title || option.value]
|
|
4087
|
+
: w.options.filter((o) => o.selected).map((o) => o.label || o.title || o.value);
|
|
4086
4088
|
const content = substituteSelection(template, selected).trim();
|
|
4087
4089
|
if (!content) return s;
|
|
4088
4090
|
if (duplicate(s, content)) return s;
|
|
@@ -210,6 +210,88 @@ export function stripMarkdown(src: string): string {
|
|
|
210
210
|
return t.trim();
|
|
211
211
|
}
|
|
212
212
|
|
|
213
|
+
/** A literal `*` in prose drawn with `markdown: true`. Web and Android pair any two
|
|
214
|
+
* asterisks (`2*4 *Pine*` would italicise `4 `) and neither honours a backslash
|
|
215
|
+
* escape, so a star that is not part of emphasis is drawn as U+2217, which looks
|
|
216
|
+
* the same and parses as nothing. `drawnText` maps it back. The trailing word
|
|
217
|
+
* joiner (invisible) is what tells it apart from a U+2217 the prose already had:
|
|
218
|
+
* `emphasisMarkdown` drops a joiner that follows one in its input, so only a
|
|
219
|
+
* sentinel carries it. */
|
|
220
|
+
const LITERAL_STAR = "\u2217\u2060";
|
|
221
|
+
/** An underscore inside a code span, parked until emphasis has been read. */
|
|
222
|
+
const CODE_UNDERSCORE = "\u0005";
|
|
223
|
+
|
|
224
|
+
/** `stripMarkdown`, keeping inline emphasis.
|
|
225
|
+
*
|
|
226
|
+
* Option prose is drawn by `Text(markdown: true)` / `ListItem(markdown: true)`,
|
|
227
|
+
* so bold and italic can survive — everything else is stripped as `stripMarkdown`
|
|
228
|
+
* strips it. Emphasis is re-emitted as `**x**` / `*x*` only: web's parser has no
|
|
229
|
+
* underscore syntax and Android's needs word boundaries, so one spelling is the
|
|
230
|
+
* only one every renderer agrees on. Nested emphasis keeps its outer run only,
|
|
231
|
+
* because neither of those parsers pairs `***x***`.
|
|
232
|
+
*
|
|
233
|
+
* Nothing a renderer would turn into a link survives: links and images are
|
|
234
|
+
* unwrapped until none is left (a nested `[[a](x)](tel:…)` would otherwise
|
|
235
|
+
* rebuild one) and `<scheme:…>` autolinks lose their brackets. Every asterisk
|
|
236
|
+
* left over is a `LITERAL_STAR`, so no marker the renderers could mis-pair is
|
|
237
|
+
* ever emitted. `drawnText` of the result is the text the row shows. */
|
|
238
|
+
export function emphasisMarkdown(src: string): string {
|
|
239
|
+
if (!stripMarkdown(src)) return "";
|
|
240
|
+
const BOLD_OPEN = "\u0001", BOLD_CLOSE = "\u0002", EM_OPEN = "\u0003", EM_CLOSE = "\u0004";
|
|
241
|
+
// Inside a run, a paired nested marker is dropped (the outer run wins) and a lone star
|
|
242
|
+
// is content — it survives as a literal one. Double before single, or the inner
|
|
243
|
+
// `*x*` of `_**x**_` is read as the italic and its outer stars are left over.
|
|
244
|
+
const flat = (inner: string) => inner.replace(/[\u0001-\u0004]/g, "")
|
|
245
|
+
.replace(/\*\*([^*\n]+)\*\*/g, "$1").replace(/\*([^*\n]+)\*/g, "$1");
|
|
246
|
+
const bold = (inner: string) => `${BOLD_OPEN}${flat(inner)}${BOLD_CLOSE}`;
|
|
247
|
+
const em = (inner: string) => `${EM_OPEN}${flat(inner)}${EM_CLOSE}`;
|
|
248
|
+
let t = src.replace(/[\u0001-\u0005]/g, "").replace(/\u2217\u2060/g, "\u2217");
|
|
249
|
+
t = t.replace(/```[a-zA-Z0-9]*\n?/g, "").replace(/```/g, "");
|
|
250
|
+
// A code span is never read as emphasis: its paired markers are dropped, as
|
|
251
|
+
// `stripMarkdown` drops them, and whatever is left is parked so no prose marker
|
|
252
|
+
// can pair with it.
|
|
253
|
+
t = t.replace(/`([^`]+)`/g, (_, x: string) => x
|
|
254
|
+
.replace(/\*\*([^*]+)\*\*/g, "$1").replace(/\*([^*]+)\*/g, "$1")
|
|
255
|
+
.replace(/__([^_]+)__/g, "$1").replace(/_([^_]+)_/g, "$1")
|
|
256
|
+
.replace(/\*/g, LITERAL_STAR).replace(/_/g, CODE_UNDERSCORE));
|
|
257
|
+
for (let prev = ""; prev !== t;) {
|
|
258
|
+
prev = t;
|
|
259
|
+
t = t.replace(/!\[([^\]]*)\]\([^)]*\)/g, "$1").replace(/\[([^\]]+)\]\([^)]*\)/g, "$1");
|
|
260
|
+
}
|
|
261
|
+
t = t.replace(/<([a-zA-Z][a-zA-Z0-9+.-]*:[^>\s]*)>/g, "$1");
|
|
262
|
+
// Line-level markup first, so a bullet's or a rule's `*` is gone before emphasis is read.
|
|
263
|
+
t = t.replace(/^#{1,6}\s+/gm, "");
|
|
264
|
+
t = t.replace(/^>\s?/gm, "");
|
|
265
|
+
t = t.replace(/^\s*([-*_])\1{2,}\s*$/gm, "");
|
|
266
|
+
t = t.replace(/^\s*[-*+]\s+/gm, "• ");
|
|
267
|
+
// Emphasis, strictly delimited (no space just inside a marker), parked behind control
|
|
268
|
+
// characters. Bold may contain single stars — an inner italic — which it drops.
|
|
269
|
+
// Underscores first, so an asterisk run around them absorbs them. Only at word
|
|
270
|
+
// boundaries, as CommonMark reads them: an identifier like `snake_case_name` is
|
|
271
|
+
// not italic.
|
|
272
|
+
// An underscore between two word characters is content, so `_foo_bar_` is one run.
|
|
273
|
+
t = t.replace(/(^|[^\w])__(?=\S)((?:[^_\n]|(?<=\w)_(?=\w))*?[^\s_])__(?!\w)/g, (_, pre, x) => pre + bold(x));
|
|
274
|
+
t = t.replace(/(^|[^\w])_(?=\S)((?:[^_\n]|(?<=\w)_(?=\w))*?[^\s_])_(?!\w)/g, (_, pre, x) => pre + em(x));
|
|
275
|
+
t = t.replace(/\*\*\*(?=\S)([^*\n]*?\S)\*\*\*/g, (_, x) => bold(x));
|
|
276
|
+
t = t.replace(/\*\*(?=[^\s*])((?:[^*\n]|\*(?!\*))*?[^\s*])\*\*/g, (_, x) => bold(x));
|
|
277
|
+
t = t.replace(/(^|[^\w*])\*(?=[^\s*])([^*\n]*?[^\s*])\*(?![\w*])/g, (_, pre, x) => pre + em(x));
|
|
278
|
+
t = t.replace(/\n{3,}/g, "\n\n");
|
|
279
|
+
t = t.replace(/\*/g, LITERAL_STAR).replace(new RegExp(CODE_UNDERSCORE, "g"), "_");
|
|
280
|
+
t = t.replace(/\u0001([^\u0002]*)\u0002/g, "**$1**").replace(/\u0003([^\u0004]*)\u0004/g, "*$1*");
|
|
281
|
+
// (A literal star inside a run was converted with the rest, before the run's own
|
|
282
|
+
// markers were written back.)
|
|
283
|
+
return t.trim();
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/** What a row drawn with `markdown: true` shows for `emphasisMarkdown` output: the
|
|
287
|
+
* text with its `**x**` / `*x*` markers removed and literal stars restored. The
|
|
288
|
+
* accessibility name and the search haystack use this, so they say exactly what
|
|
289
|
+
* is on screen. */
|
|
290
|
+
export function drawnText(s: string): string {
|
|
291
|
+
return (s || "").replace(/\*\*([^*\n]+)\*\*/g, "$1").replace(/\*([^*\n]+)\*/g, "$1")
|
|
292
|
+
.replace(new RegExp(LITERAL_STAR, "g"), "*");
|
|
293
|
+
}
|
|
294
|
+
|
|
213
295
|
/** A display string, whether the wire wrote it bare or wrapped.
|
|
214
296
|
*
|
|
215
297
|
* QUESTIONNAIRE writes every label as `{ text: "…" }` — question titles,
|
|
@@ -323,7 +405,8 @@ export function optionsOf(o: Record<string, unknown> | null): WidgetOption[] {
|
|
|
323
405
|
const color = stringAt(spec, "color");
|
|
324
406
|
const hex = /^#[0-9a-f]{6}$/i.test(color);
|
|
325
407
|
const tint = hex ? "accentPrimary" : !name || name === "Confirm" ? "success" : "textPrimary";
|
|
326
|
-
|
|
408
|
+
// Drawn with `markdown: true`, like the option prose above it.
|
|
409
|
+
return { text: emphasisMarkdown(textOf(entry)),
|
|
327
410
|
icon: name === "Gift" ? "gift" : name === "Send" ? "paper_plane" : "check",
|
|
328
411
|
color: tint, colorHex: hex ? color : "",
|
|
329
412
|
successHidden: tint !== "success", plainHidden: tint !== "textPrimary", customHidden: tint !== "accentPrimary" };
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
// the transcript bubbles already use for their three link slots.
|
|
14
14
|
|
|
15
15
|
import type { NormalizedWidget, WidgetBenefit, WidgetKind, WidgetOption } from "./aria-widget-model.js";
|
|
16
|
-
import { SELECTED_TOKEN, VALUES_TOKEN, isWebUrl, stripMarkdown } from "./aria-widget-model.js";
|
|
16
|
+
import { SELECTED_TOKEN, VALUES_TOKEN, drawnText, emphasisMarkdown, isWebUrl, stripMarkdown } from "./aria-widget-model.js";
|
|
17
17
|
import { oauthView } from "./aria-widget-oauth.js";
|
|
18
18
|
import { composeGenericCard } from "./aria-generic-widget.js";
|
|
19
19
|
import { formatNumber } from "./engine-intl.js";
|
|
@@ -81,7 +81,11 @@ export interface WidgetRow {
|
|
|
81
81
|
export interface WidgetOptionRow {
|
|
82
82
|
id: string;
|
|
83
83
|
value: string;
|
|
84
|
+
/** Drawn prose: inline emphasis kept (`**x**` / `*x*`), parsed by `markdown: true`. */
|
|
84
85
|
title: string;
|
|
86
|
+
/** `title` stripped to plain text — the accessibility name, the search haystack,
|
|
87
|
+
* and anything echoed back as text. */
|
|
88
|
+
label: string;
|
|
85
89
|
subtitle: string;
|
|
86
90
|
subtitleHidden: boolean;
|
|
87
91
|
text: string;
|
|
@@ -400,7 +404,7 @@ export const DEFAULT_QUESTIONNAIRE_COPY: QuestionnaireCopy = {
|
|
|
400
404
|
/** A question's answer as the owner would say it: the chosen choices' titles,
|
|
401
405
|
* then anything typed. Empty when unanswered. */
|
|
402
406
|
function answerOf(q: WidgetQuestion): string {
|
|
403
|
-
const parts = q.choices.filter((c) => c.selected).map((c) => c.title || c.value);
|
|
407
|
+
const parts = q.choices.filter((c) => c.selected).map((c) => c.label || c.title || c.value);
|
|
404
408
|
const typed = q.freeText.trim();
|
|
405
409
|
if (typed) parts.push(typed);
|
|
406
410
|
return parts.join(", ");
|
|
@@ -648,23 +652,26 @@ function optionRow(
|
|
|
648
652
|
// raw `text` is still exported below for anything that wants both.
|
|
649
653
|
// "Has a title" is judged on the STRIPPED title: a title of pure markup (`***`) falls back
|
|
650
654
|
// to the option's other prose exactly as a missing one does.
|
|
651
|
-
const
|
|
652
|
-
const
|
|
653
|
-
const
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
//
|
|
658
|
-
//
|
|
659
|
-
//
|
|
660
|
-
const
|
|
661
|
-
const
|
|
655
|
+
const hasTitle = !!stripMarkdown(o.title);
|
|
656
|
+
const titleSrc = hasTitle ? o.title : (o.text || o.subtitle);
|
|
657
|
+
const subtitleSrc = hasTitle ? (o.subtitle || o.text) : (o.text && o.subtitle ? o.subtitle : "");
|
|
658
|
+
// The drawn prose keeps its inline emphasis (`**three**` is bold on
|
|
659
|
+
// every renderer, as in the native reference); the descriptor parses it with
|
|
660
|
+
// `markdown: true`. Every `*Hidden` flag and the accessibility `label` follow
|
|
661
|
+
// the STRIPPED value: prose that is only markup (`---`, `***`, an image with
|
|
662
|
+
// empty alt) strips to "" and must not paint an empty node, and a screen
|
|
663
|
+
// reader must not read `**`.
|
|
664
|
+
const rowTitle = emphasisMarkdown(titleSrc);
|
|
665
|
+
const rowSubtitle = emphasisMarkdown(subtitleSrc);
|
|
666
|
+
const text = emphasisMarkdown(o.text);
|
|
667
|
+
const listText = emphasisMarkdown(o.listText);
|
|
662
668
|
const benefits = (o.benefits ?? []).filter((b) => b.text);
|
|
663
669
|
const badge = stripMarkdown(o.badge || "");
|
|
664
670
|
return {
|
|
665
671
|
id: `o${i}`,
|
|
666
672
|
value: o.value,
|
|
667
673
|
title: rowTitle,
|
|
674
|
+
label: drawnText(rowTitle),
|
|
668
675
|
subtitle: rowSubtitle, subtitleHidden: !rowSubtitle,
|
|
669
676
|
text, textHidden: !text,
|
|
670
677
|
pictureUrl, pictureHidden: !pictureUrl,
|
|
@@ -693,6 +700,20 @@ function isDisclosedSame(disclose: Disclose, url: string): boolean {
|
|
|
693
700
|
return disclose({ label: probe, url }) === probe;
|
|
694
701
|
}
|
|
695
702
|
|
|
703
|
+
/** A widget persisted by a bundle that predates `WidgetOptionRow.label` — rows carry
|
|
704
|
+
* plain titles and no label. Rehydrating one as saved would leave every row's
|
|
705
|
+
* accessibility name empty, so its label is backfilled from the title. */
|
|
706
|
+
export function withLabels(w: WidgetView): WidgetView {
|
|
707
|
+
const fill = (rows: WidgetOptionRow[] | undefined) =>
|
|
708
|
+
rows?.map((o) => (typeof o.label === "string" ? o : { ...o, label: drawnText(o.title) }));
|
|
709
|
+
return {
|
|
710
|
+
...w,
|
|
711
|
+
options: fill(w.options) ?? w.options,
|
|
712
|
+
suggestions: fill(w.suggestions) ?? w.suggestions,
|
|
713
|
+
questions: w.questions?.map((q) => ({ ...q, choices: fill(q.choices) ?? q.choices })) ?? w.questions,
|
|
714
|
+
};
|
|
715
|
+
}
|
|
716
|
+
|
|
696
717
|
/** Re-derive an ASYNC_TOOL widget for a new job state.
|
|
697
718
|
*
|
|
698
719
|
* Separate from `viewOf` because it runs on a LIVE widget rather than a fresh
|