@widgetic/chat 0.1.44 → 0.1.45
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/README.md +14 -0
- package/dist/components/ActionBar.svelte +14 -1
- package/dist/components/ActionBar.svelte.d.ts +6 -0
- package/dist/components/Chat.svelte +47 -27
- package/dist/components/PanelSuggestionButtons.svelte +67 -19
- package/dist/components/PanelSuggestionButtons.svelte.d.ts +3 -1
- package/dist/i18n/index.d.ts +1 -1
- package/dist/i18n/index.js +1 -1
- package/dist/i18n/messages.d.ts +9 -1
- package/dist/i18n/messages.js +9 -1
- package/dist/i18n/suggestions.d.ts +17 -2
- package/dist/i18n/suggestions.js +11 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -575,6 +575,20 @@ sibling `brand` checkout when it is there, and answers on `window.__agentDemo` f
|
|
|
575
575
|
follow-up card (three pills, below); the `questions` scenario adds the card of questions of the gateway (three questions, one of them with several
|
|
576
576
|
answers) and builds once it is answered in the card or by writing in the chat.
|
|
577
577
|
|
|
578
|
+
### The starting suggestions of the panel
|
|
579
|
+
|
|
580
|
+
An empty chat in the docked panel (`showPanelHeader`) shows **three cards under a "Suggestions" heading, right above the message box**: the few words of an idea
|
|
581
|
+
on the card ("A countdown to a sale"), and **the whole request behind it in a tooltip** while the pointer rests on the card for the usual time of a tooltip
|
|
582
|
+
(0.2 s) or the keyboard is on it, as the follow-up card does. A click puts that whole request in the message box (`onSuggestionSelected`: nothing is
|
|
583
|
+
sent), never the few words, so the person can read, change and send what the tooltip showed.
|
|
584
|
+
|
|
585
|
+
- **The words are messages of the catalog, not an answer of a model.** Each idea is two messages in `i18n/messages.ts`: `chat.suggestions.panel.<idea>` (the
|
|
586
|
+
card) and `chat.suggestions.panel.<idea>Request` (the request), paired in `i18n/suggestions.ts` (`panelEmptySuggestions()`), so a page that translates the
|
|
587
|
+
catalog translates both. An idea that is not translated shows its English words.
|
|
588
|
+
- **Nothing stands between the cards and the box.** In the panel the footer is the message box and what belongs to it. The page's own options (what it
|
|
589
|
+
gives as `actionBarExtras`, and the screenshot, record and selector buttons) sit in the action bar **under the panel header** (`ActionBar` `atTop`),
|
|
590
|
+
with the line under it; in the plain chat the bar stays above the message box.
|
|
591
|
+
|
|
578
592
|
### The follow-up card
|
|
579
593
|
|
|
580
594
|
After a build the person kept, the assistant can offer **ideas for what to improve next** on the widget: a card of small pills under the last
|
|
@@ -32,6 +32,12 @@
|
|
|
32
32
|
completeReplacement?: Snippet;
|
|
33
33
|
/** When true, render completeReplacement instead of Complete. */
|
|
34
34
|
replaceComplete?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Where the bar sits in the chat. False (default): above the message box, with its line on top. True: under the header of
|
|
37
|
+
* the docked panel, with its line underneath, because the panel keeps the suggestions against the message box and the bar
|
|
38
|
+
* cannot stand between the two.
|
|
39
|
+
*/
|
|
40
|
+
atTop?: boolean;
|
|
35
41
|
}
|
|
36
42
|
|
|
37
43
|
let {
|
|
@@ -56,6 +62,7 @@
|
|
|
56
62
|
children,
|
|
57
63
|
completeReplacement,
|
|
58
64
|
replaceComplete = false,
|
|
65
|
+
atTop = false,
|
|
59
66
|
}: Props = $props();
|
|
60
67
|
|
|
61
68
|
// Handle screenshot capture — attachments do not require an existing conversation.
|
|
@@ -107,7 +114,7 @@
|
|
|
107
114
|
}
|
|
108
115
|
</script>
|
|
109
116
|
|
|
110
|
-
<div class="action-bar" class:disabled>
|
|
117
|
+
<div class="action-bar" class:disabled class:action-bar-top={atTop}>
|
|
111
118
|
{#if showScreenshot}
|
|
112
119
|
<!-- Screenshot Button -->
|
|
113
120
|
<button
|
|
@@ -242,6 +249,12 @@
|
|
|
242
249
|
flex-wrap: wrap;
|
|
243
250
|
}
|
|
244
251
|
|
|
252
|
+
/* Under the header of the docked panel the line is the bar's bottom edge, against the messages */
|
|
253
|
+
.action-bar.action-bar-top {
|
|
254
|
+
border-top: none;
|
|
255
|
+
border-bottom: 1px solid #e5e7eb;
|
|
256
|
+
}
|
|
257
|
+
|
|
245
258
|
.action-bar.disabled {
|
|
246
259
|
opacity: 0.5;
|
|
247
260
|
pointer-events: none;
|
|
@@ -30,6 +30,12 @@ interface Props {
|
|
|
30
30
|
completeReplacement?: Snippet;
|
|
31
31
|
/** When true, render completeReplacement instead of Complete. */
|
|
32
32
|
replaceComplete?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Where the bar sits in the chat. False (default): above the message box, with its line on top. True: under the header of
|
|
35
|
+
* the docked panel, with its line underneath, because the panel keeps the suggestions against the message box and the bar
|
|
36
|
+
* cannot stand between the two.
|
|
37
|
+
*/
|
|
38
|
+
atTop?: boolean;
|
|
33
39
|
}
|
|
34
40
|
declare const ActionBar: import("svelte").Component<Props, {}, "">;
|
|
35
41
|
type ActionBar = ReturnType<typeof ActionBar>;
|
|
@@ -859,6 +859,10 @@
|
|
|
859
859
|
|
|
860
860
|
if (loaded.length === 0) {
|
|
861
861
|
// chatLog('[Chat] No existing conversations, creating new one');
|
|
862
|
+
// The list is empty, so the empty state (title and suggestions) is known to be right: it does not wait for the
|
|
863
|
+
// conversation to be made (a request of its own). A message sent in that moment waits for `initializePromise`
|
|
864
|
+
// in `sendMessageAndReport`; a conversation that could not be made takes it away again (the `finally` below).
|
|
865
|
+
showEmptyState = true;
|
|
862
866
|
await createNewConversation();
|
|
863
867
|
} else {
|
|
864
868
|
// chatLog('[Chat] Selecting from', loaded.length, 'conversation(s)');
|
|
@@ -2993,6 +2997,43 @@
|
|
|
2993
2997
|
}
|
|
2994
2998
|
</script>
|
|
2995
2999
|
|
|
3000
|
+
<!--
|
|
3001
|
+
The action bar, drawn only when something is left for it to hold. The plain chat keeps it in the footer, above the message
|
|
3002
|
+
box. The docked panel keeps it under its header (`atTop`): its footer is the message box and what belongs to it, so the
|
|
3003
|
+
suggestions of an empty chat (and "Try next" under a reply) touch the message box, with no bar of options between them.
|
|
3004
|
+
-->
|
|
3005
|
+
{#snippet actionBarView(atTop: boolean)}
|
|
3006
|
+
{#if showActionBar}
|
|
3007
|
+
<ActionBar
|
|
3008
|
+
{context}
|
|
3009
|
+
{atTop}
|
|
3010
|
+
conversationId={currentConversationId}
|
|
3011
|
+
isRecording={localIsRecording}
|
|
3012
|
+
isCompleted={isCompleted}
|
|
3013
|
+
disabled={isLoading}
|
|
3014
|
+
showScreenshot={config?.features?.screenshot !== false}
|
|
3015
|
+
showRecord={config?.features?.screenRecording !== false}
|
|
3016
|
+
showUpload={false}
|
|
3017
|
+
{showSelector}
|
|
3018
|
+
{isSelectorActive}
|
|
3019
|
+
showComplete={config?.features?.markComplete !== false}
|
|
3020
|
+
onScreenshot={() => void handleScreenshot()}
|
|
3021
|
+
onUpload={() => void handleUpload()}
|
|
3022
|
+
onToggleSelector={(active) => onToggleSelector?.(active)}
|
|
3023
|
+
onRecordStart={() => void handleRecordStart()}
|
|
3024
|
+
onRecordStop={() => void handleRecordStop()}
|
|
3025
|
+
onComplete={(detail) => void handleComplete(detail)}
|
|
3026
|
+
onError={handleActionError}
|
|
3027
|
+
{completeReplacement}
|
|
3028
|
+
{replaceComplete}
|
|
3029
|
+
>
|
|
3030
|
+
{#if actionBarExtras}
|
|
3031
|
+
{@render actionBarExtras()}
|
|
3032
|
+
{/if}
|
|
3033
|
+
</ActionBar>
|
|
3034
|
+
{/if}
|
|
3035
|
+
{/snippet}
|
|
3036
|
+
|
|
2996
3037
|
<div
|
|
2997
3038
|
bind:this={chatContainer}
|
|
2998
3039
|
class="{className ? className : 'prompt-chat-ct'} border-border bg-background relative flex h-full min-h-0 max-w-full flex-col overflow-hidden border {showPanelHeader ? 'w-full' : 'w-chat-panel'} {className ? '' : 'rounded-panel'}"
|
|
@@ -3045,6 +3086,10 @@
|
|
|
3045
3086
|
</div>
|
|
3046
3087
|
{/if}
|
|
3047
3088
|
|
|
3089
|
+
{#if showPanelHeader}
|
|
3090
|
+
{@render actionBarView(true)}
|
|
3091
|
+
{/if}
|
|
3092
|
+
|
|
3048
3093
|
<!-- Chat Interface -->
|
|
3049
3094
|
<div
|
|
3050
3095
|
class="prompt-chat-messages-area flex min-h-0 flex-col overflow-hidden {showPanelHeader ? 'flex-1' : ''}"
|
|
@@ -3117,33 +3162,8 @@
|
|
|
3117
3162
|
<div
|
|
3118
3163
|
class="prompt-chat-footer-ct shrink-0 flex flex-col {showPanelHeader ? 'px-3 pb-4 max-lg:px-3' : ''}"
|
|
3119
3164
|
>
|
|
3120
|
-
{#if
|
|
3121
|
-
|
|
3122
|
-
{context}
|
|
3123
|
-
conversationId={currentConversationId}
|
|
3124
|
-
isRecording={localIsRecording}
|
|
3125
|
-
isCompleted={isCompleted}
|
|
3126
|
-
disabled={isLoading}
|
|
3127
|
-
showScreenshot={config?.features?.screenshot !== false}
|
|
3128
|
-
showRecord={config?.features?.screenRecording !== false}
|
|
3129
|
-
showUpload={false}
|
|
3130
|
-
{showSelector}
|
|
3131
|
-
{isSelectorActive}
|
|
3132
|
-
showComplete={config?.features?.markComplete !== false}
|
|
3133
|
-
onScreenshot={() => void handleScreenshot()}
|
|
3134
|
-
onUpload={() => void handleUpload()}
|
|
3135
|
-
onToggleSelector={(active) => onToggleSelector?.(active)}
|
|
3136
|
-
onRecordStart={() => void handleRecordStart()}
|
|
3137
|
-
onRecordStop={() => void handleRecordStop()}
|
|
3138
|
-
onComplete={(detail) => void handleComplete(detail)}
|
|
3139
|
-
onError={handleActionError}
|
|
3140
|
-
{completeReplacement}
|
|
3141
|
-
{replaceComplete}
|
|
3142
|
-
>
|
|
3143
|
-
{#if actionBarExtras}
|
|
3144
|
-
{@render actionBarExtras()}
|
|
3145
|
-
{/if}
|
|
3146
|
-
</ActionBar>
|
|
3165
|
+
{#if !showPanelHeader}
|
|
3166
|
+
{@render actionBarView(false)}
|
|
3147
3167
|
{/if}
|
|
3148
3168
|
{#if composerExtras}
|
|
3149
3169
|
<div class="prompt-chat-generation-options shrink-0 flex flex-col" bind:this={generationOptionsEl}>
|
|
@@ -1,32 +1,48 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* The starter ideas of an empty docked chat (Figma: Chat / Empty): a few words on each card, and the whole request behind it.
|
|
4
|
+
*
|
|
5
|
+
* - The tooltip shows the whole request while the pointer rests on a card or the keyboard is on it, as the follow-up card does.
|
|
6
|
+
* - A click puts that whole request in the message box (the host does that, through `onPick`), never the few words of the card,
|
|
7
|
+
* so the person can read, change and send what was shown.
|
|
8
|
+
*
|
|
9
|
+
* `Tooltip` comes from the components barrel of the design system, as `FollowUpCard`'s does: its export map has no path to it
|
|
10
|
+
* anywhere else. It shows no word of its own, only the request it is given. The tooltip is not hoverable content: it closes when
|
|
11
|
+
* the pointer leaves the card, so it never stays over the cards above it (it opens over the card, upwards, as the follow-up card's).
|
|
12
|
+
*/
|
|
2
13
|
import IconClock from '@tabler/icons-svelte/icons/clock';
|
|
3
14
|
import IconMessage from '@tabler/icons-svelte/icons/message';
|
|
4
15
|
import IconPhoto from '@tabler/icons-svelte/icons/photo';
|
|
5
16
|
import IconArrowsMaximize from '@tabler/icons-svelte/icons/arrows-maximize';
|
|
17
|
+
import { Tooltip } from '@widgetic/design-system/components';
|
|
6
18
|
import { SuggestionCard } from '@widgetic/design-system/components/chat/index';
|
|
7
19
|
import { useChatLanguage } from '../i18n/language.js';
|
|
8
20
|
import {
|
|
9
|
-
|
|
21
|
+
panelEmptySuggestions,
|
|
10
22
|
panelEmptySuggestionTitleKey,
|
|
23
|
+
type PanelStarterSuggestion,
|
|
11
24
|
} from '../i18n/suggestions.js';
|
|
12
25
|
import type { ChatMessageKey } from '../i18n/messages.js';
|
|
13
26
|
|
|
14
27
|
const { t } = useChatLanguage();
|
|
15
28
|
|
|
16
29
|
interface Props {
|
|
30
|
+
/** A card was picked: the whole request of its idea, for the message box (not the few words the card shows). */
|
|
17
31
|
onPick: (text: string) => void;
|
|
18
32
|
disabled?: boolean;
|
|
19
33
|
titleKey?: ChatMessageKey;
|
|
20
|
-
|
|
34
|
+
suggestions?: readonly PanelStarterSuggestion[];
|
|
21
35
|
}
|
|
22
36
|
|
|
23
37
|
let {
|
|
24
38
|
onPick,
|
|
25
39
|
disabled = false,
|
|
26
40
|
titleKey = panelEmptySuggestionTitleKey(),
|
|
27
|
-
|
|
41
|
+
suggestions = panelEmptySuggestions(),
|
|
28
42
|
}: Props = $props();
|
|
29
43
|
|
|
44
|
+
type TriggerProps = Record<string, unknown>;
|
|
45
|
+
|
|
30
46
|
const ICON_BY_KEY: Partial<Record<ChatMessageKey, typeof IconClock>> = {
|
|
31
47
|
'chat.suggestions.panel.countdown': IconClock,
|
|
32
48
|
'chat.suggestions.panel.testimonials': IconMessage,
|
|
@@ -38,24 +54,56 @@
|
|
|
38
54
|
function iconForKey(key: ChatMessageKey) {
|
|
39
55
|
return ICON_BY_KEY[key] ?? IconMessage;
|
|
40
56
|
}
|
|
57
|
+
|
|
58
|
+
/** The click of a card: the tooltip's own handler first (it closes the tooltip), then the pick of the whole request. */
|
|
59
|
+
function handlePick(triggerProps: TriggerProps, event: MouseEvent, request: string) {
|
|
60
|
+
try {
|
|
61
|
+
const closeTooltip = triggerProps.onclick;
|
|
62
|
+
if (typeof closeTooltip === 'function') closeTooltip(event);
|
|
63
|
+
} catch (error) {
|
|
64
|
+
console.warn('[Chat] The suggestion tooltip could not be closed:', error);
|
|
65
|
+
}
|
|
66
|
+
if (disabled) return;
|
|
67
|
+
try {
|
|
68
|
+
onPick(request);
|
|
69
|
+
} catch (error) {
|
|
70
|
+
console.error('[Chat] A starter suggestion could not be picked:', error);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
41
73
|
</script>
|
|
42
74
|
|
|
43
75
|
<div class="panel-suggestion-ct flex w-full max-w-full flex-col gap-1 pb-2">
|
|
44
76
|
<h4 class="text-caption text-muted-foreground">{$t(titleKey)}</h4>
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
{
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
77
|
+
<Tooltip.Provider delayDuration={200} disableHoverableContent>
|
|
78
|
+
<div class="flex w-full flex-col gap-1">
|
|
79
|
+
{#each suggestions as suggestion (suggestion.titleKey)}
|
|
80
|
+
{@const title = $t(suggestion.titleKey)}
|
|
81
|
+
{@const request = $t(suggestion.requestKey)}
|
|
82
|
+
{@const Icon = iconForKey(suggestion.titleKey)}
|
|
83
|
+
<Tooltip.Root>
|
|
84
|
+
<Tooltip.Trigger>
|
|
85
|
+
{#snippet child({ props }: { props: TriggerProps })}
|
|
86
|
+
<SuggestionCard
|
|
87
|
+
{...props}
|
|
88
|
+
{title}
|
|
89
|
+
{disabled}
|
|
90
|
+
class="min-h-11"
|
|
91
|
+
data-testid="panel-suggestion-card"
|
|
92
|
+
onclick={(event: MouseEvent) => handlePick(props, event, request)}
|
|
93
|
+
>
|
|
94
|
+
{#snippet icon()}
|
|
95
|
+
<Icon class="size-4 stroke-2" aria-hidden="true" />
|
|
96
|
+
{/snippet}
|
|
97
|
+
</SuggestionCard>
|
|
98
|
+
{/snippet}
|
|
99
|
+
</Tooltip.Trigger>
|
|
100
|
+
<Tooltip.Portal>
|
|
101
|
+
<Tooltip.Content side="top" align="center" collisionPadding={8} data-testid="panel-suggestion-tooltip">
|
|
102
|
+
{request}
|
|
103
|
+
</Tooltip.Content>
|
|
104
|
+
</Tooltip.Portal>
|
|
105
|
+
</Tooltip.Root>
|
|
106
|
+
{/each}
|
|
107
|
+
</div>
|
|
108
|
+
</Tooltip.Provider>
|
|
61
109
|
</div>
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { type PanelStarterSuggestion } from '../i18n/suggestions.js';
|
|
1
2
|
import type { ChatMessageKey } from '../i18n/messages.js';
|
|
2
3
|
interface Props {
|
|
4
|
+
/** A card was picked: the whole request of its idea, for the message box (not the few words the card shows). */
|
|
3
5
|
onPick: (text: string) => void;
|
|
4
6
|
disabled?: boolean;
|
|
5
7
|
titleKey?: ChatMessageKey;
|
|
6
|
-
|
|
8
|
+
suggestions?: readonly PanelStarterSuggestion[];
|
|
7
9
|
}
|
|
8
10
|
declare const PanelSuggestionButtons: import("svelte").Component<Props, {}, "">;
|
|
9
11
|
type PanelSuggestionButtons = ReturnType<typeof PanelSuggestionButtons>;
|
package/dist/i18n/index.d.ts
CHANGED
|
@@ -3,4 +3,4 @@ export { PUBLISH_NUDGE_BY_LOCALE, PUBLISH_NUDGE_ENGLISH } from './publishNudgeLo
|
|
|
3
3
|
export { CHAT_SKETCH_LOCALE_MESSAGES } from './sketchLocales.js';
|
|
4
4
|
export { checkChatMessages, provideChatLanguage, useChatLanguage } from './language.js';
|
|
5
5
|
export { actionFailureKey, contextTypeLabel, fileSizeText, versionLabelText } from './labels.js';
|
|
6
|
-
export { suggestionKeysFor, suggestionTitleKeyFor, panelEmptySuggestionKeys, panelEmptySuggestionTitleKey, } from './suggestions.js';
|
|
6
|
+
export { suggestionKeysFor, suggestionTitleKeyFor, panelEmptySuggestions, panelEmptySuggestionKeys, panelEmptySuggestionTitleKey, type PanelStarterSuggestion, } from './suggestions.js';
|
package/dist/i18n/index.js
CHANGED
|
@@ -3,4 +3,4 @@ export { PUBLISH_NUDGE_BY_LOCALE, PUBLISH_NUDGE_ENGLISH } from './publishNudgeLo
|
|
|
3
3
|
export { CHAT_SKETCH_LOCALE_MESSAGES } from './sketchLocales.js';
|
|
4
4
|
export { checkChatMessages, provideChatLanguage, useChatLanguage } from './language.js';
|
|
5
5
|
export { actionFailureKey, contextTypeLabel, fileSizeText, versionLabelText } from './labels.js';
|
|
6
|
-
export { suggestionKeysFor, suggestionTitleKeyFor, panelEmptySuggestionKeys, panelEmptySuggestionTitleKey, } from './suggestions.js';
|
|
6
|
+
export { suggestionKeysFor, suggestionTitleKeyFor, panelEmptySuggestions, panelEmptySuggestionKeys, panelEmptySuggestionTitleKey, } from './suggestions.js';
|
package/dist/i18n/messages.d.ts
CHANGED
|
@@ -137,12 +137,20 @@ export declare const CHAT_MESSAGES: {
|
|
|
137
137
|
readonly 'chat.suggestions.title.document': "Suggested document actions";
|
|
138
138
|
readonly 'chat.suggestions.title.other': "Suggested questions";
|
|
139
139
|
readonly 'chat.suggestions.hide': "Hide suggestions";
|
|
140
|
-
/** The ideas for a widget:
|
|
140
|
+
/** The ideas for a widget: the few words a card shows. A click puts the whole request (the `…Request` message of the idea) in the message box; nothing is sent. */
|
|
141
141
|
readonly 'chat.suggestions.panel.countdown': "A countdown to a sale";
|
|
142
142
|
readonly 'chat.suggestions.panel.testimonials': "Customer testimonials";
|
|
143
143
|
readonly 'chat.suggestions.panel.gallery': "A before and after gallery";
|
|
144
144
|
readonly 'chat.suggestions.panel.changeEndDate': "Change the end date";
|
|
145
145
|
readonly 'chat.suggestions.panel.biggerButton': "Make the button bigger";
|
|
146
|
+
/**
|
|
147
|
+
* The whole request behind each of the three ideas an empty chat offers to start a widget with. The card shows only the few words above;
|
|
148
|
+
* its tooltip (after the pointer rests on it, or the keyboard is on it) shows this, and a click puts exactly this in the message box.
|
|
149
|
+
* A request is written to be sent as it is: it says what to build and what it shows, and leaves the look to the person.
|
|
150
|
+
*/
|
|
151
|
+
readonly 'chat.suggestions.panel.countdownRequest': "Create a countdown to a big sale. Show a bold headline, days, hours, minutes and seconds ticking down to an end date I can change, and a \"Shop now\" button underneath.";
|
|
152
|
+
readonly 'chat.suggestions.panel.testimonialsRequest': "Create a customer testimonials slider. Each slide shows a short quote, the name and photo of the customer and a star rating. The slides change on their own, with dots to move between them.";
|
|
153
|
+
readonly 'chat.suggestions.panel.galleryRequest': "Create a before and after gallery. Each item compares two versions of the same photo with a draggable divider, and visitors can flip through several photos.";
|
|
146
154
|
/**
|
|
147
155
|
* The follow-up card under the last reply (ideas for what to improve next, as small pills). The cross of a pill takes it out of
|
|
148
156
|
* the card: `{title}` is the few words the pill shows ("Add a sale banner"). The heading of the card is `chat.suggestions.title.tryNext`.
|
package/dist/i18n/messages.js
CHANGED
|
@@ -142,12 +142,20 @@ export const CHAT_MESSAGES = {
|
|
|
142
142
|
'chat.suggestions.title.document': 'Suggested document actions',
|
|
143
143
|
'chat.suggestions.title.other': 'Suggested questions',
|
|
144
144
|
'chat.suggestions.hide': 'Hide suggestions',
|
|
145
|
-
/** The ideas for a widget:
|
|
145
|
+
/** The ideas for a widget: the few words a card shows. A click puts the whole request (the `…Request` message of the idea) in the message box; nothing is sent. */
|
|
146
146
|
'chat.suggestions.panel.countdown': 'A countdown to a sale',
|
|
147
147
|
'chat.suggestions.panel.testimonials': 'Customer testimonials',
|
|
148
148
|
'chat.suggestions.panel.gallery': 'A before and after gallery',
|
|
149
149
|
'chat.suggestions.panel.changeEndDate': 'Change the end date',
|
|
150
150
|
'chat.suggestions.panel.biggerButton': 'Make the button bigger',
|
|
151
|
+
/**
|
|
152
|
+
* The whole request behind each of the three ideas an empty chat offers to start a widget with. The card shows only the few words above;
|
|
153
|
+
* its tooltip (after the pointer rests on it, or the keyboard is on it) shows this, and a click puts exactly this in the message box.
|
|
154
|
+
* A request is written to be sent as it is: it says what to build and what it shows, and leaves the look to the person.
|
|
155
|
+
*/
|
|
156
|
+
'chat.suggestions.panel.countdownRequest': 'Create a countdown to a big sale. Show a bold headline, days, hours, minutes and seconds ticking down to an end date I can change, and a "Shop now" button underneath.',
|
|
157
|
+
'chat.suggestions.panel.testimonialsRequest': 'Create a customer testimonials slider. Each slide shows a short quote, the name and photo of the customer and a star rating. The slides change on their own, with dots to move between them.',
|
|
158
|
+
'chat.suggestions.panel.galleryRequest': 'Create a before and after gallery. Each item compares two versions of the same photo with a draggable divider, and visitors can flip through several photos.',
|
|
151
159
|
/**
|
|
152
160
|
* The follow-up card under the last reply (ideas for what to improve next, as small pills). The cross of a pill takes it out of
|
|
153
161
|
* the card: `{title}` is the few words the pill shows ("Add a sale banner"). The heading of the card is `chat.suggestions.title.tryNext`.
|
|
@@ -1,11 +1,26 @@
|
|
|
1
1
|
import type { ChatMessageKey } from './messages.js';
|
|
2
|
+
/**
|
|
3
|
+
* The ideas the chat offers to start with, and the heading over them, for each kind of thing a chat can be about. They
|
|
4
|
+
* are message keys, so the words follow the language of the page, and a key (not the text) is what tells two ideas apart
|
|
5
|
+
* in a list: two ideas that a language happens to say with the same words are still two.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* One starter idea of the empty docked chat. The card shows the few words (`titleKey`); the whole request (`requestKey`) is what
|
|
9
|
+
* the tooltip of the card shows and what a click puts in the message box, so the person reads what will be sent before picking it.
|
|
10
|
+
*/
|
|
11
|
+
export interface PanelStarterSuggestion {
|
|
12
|
+
titleKey: ChatMessageKey;
|
|
13
|
+
requestKey: ChatMessageKey;
|
|
14
|
+
}
|
|
2
15
|
/** The messages of the ideas offered for a kind of thing, in the order they are shown. */
|
|
3
16
|
export declare function suggestionKeysFor(type: string): readonly ChatMessageKey[];
|
|
4
17
|
/** The message of the heading over the ideas offered for a kind of thing. */
|
|
5
18
|
export declare function suggestionTitleKeyFor(type: string): ChatMessageKey;
|
|
6
|
-
/** Empty side-panel suggestions (creator dock), in display order. */
|
|
19
|
+
/** Empty side-panel suggestions (creator dock), in display order: the words of each card and the request behind it. */
|
|
20
|
+
export declare function panelEmptySuggestions(): readonly PanelStarterSuggestion[];
|
|
21
|
+
/** The few words of each empty side-panel suggestion, in display order (the cards' own words, without their requests). */
|
|
7
22
|
export declare function panelEmptySuggestionKeys(): readonly ChatMessageKey[];
|
|
8
|
-
/** Heading over the empty side-panel suggestions. */
|
|
23
|
+
/** Heading over the cards of the empty side-panel suggestions. */
|
|
9
24
|
export declare function panelEmptySuggestionTitleKey(): ChatMessageKey;
|
|
10
25
|
export declare function panelFollowUpSuggestionKeys(): readonly ChatMessageKey[];
|
|
11
26
|
export declare function panelFollowUpSuggestionTitleKey(): ChatMessageKey;
|
package/dist/i18n/suggestions.js
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The ideas the chat offers to start with, and the heading over them, for each kind of thing a chat can be about. They
|
|
3
|
-
* are message keys, so the words follow the language of the page, and a key (not the text) is what tells two ideas apart
|
|
4
|
-
* in a list: two ideas that a language happens to say with the same words are still two.
|
|
5
|
-
*/
|
|
6
1
|
/** Figma side-panel empty state (widget creator): three starter ideas with icons. */
|
|
7
|
-
const
|
|
8
|
-
'chat.suggestions.panel.countdown',
|
|
9
|
-
'chat.suggestions.panel.testimonials',
|
|
10
|
-
'chat.suggestions.panel.gallery',
|
|
2
|
+
const PANEL_EMPTY_SUGGESTIONS = [
|
|
3
|
+
{ titleKey: 'chat.suggestions.panel.countdown', requestKey: 'chat.suggestions.panel.countdownRequest' },
|
|
4
|
+
{ titleKey: 'chat.suggestions.panel.testimonials', requestKey: 'chat.suggestions.panel.testimonialsRequest' },
|
|
5
|
+
{ titleKey: 'chat.suggestions.panel.gallery', requestKey: 'chat.suggestions.panel.galleryRequest' },
|
|
11
6
|
];
|
|
12
7
|
const PANEL_FOLLOW_UP_SUGGESTION_KEYS = [
|
|
13
8
|
'chat.suggestions.panel.changeEndDate',
|
|
@@ -74,11 +69,15 @@ export function suggestionKeysFor(type) {
|
|
|
74
69
|
export function suggestionTitleKeyFor(type) {
|
|
75
70
|
return TITLE_KEYS[groupOf(type)];
|
|
76
71
|
}
|
|
77
|
-
/** Empty side-panel suggestions (creator dock), in display order. */
|
|
72
|
+
/** Empty side-panel suggestions (creator dock), in display order: the words of each card and the request behind it. */
|
|
73
|
+
export function panelEmptySuggestions() {
|
|
74
|
+
return PANEL_EMPTY_SUGGESTIONS;
|
|
75
|
+
}
|
|
76
|
+
/** The few words of each empty side-panel suggestion, in display order (the cards' own words, without their requests). */
|
|
78
77
|
export function panelEmptySuggestionKeys() {
|
|
79
|
-
return
|
|
78
|
+
return PANEL_EMPTY_SUGGESTIONS.map((suggestion) => suggestion.titleKey);
|
|
80
79
|
}
|
|
81
|
-
/** Heading over the empty side-panel suggestions. */
|
|
80
|
+
/** Heading over the cards of the empty side-panel suggestions. */
|
|
82
81
|
export function panelEmptySuggestionTitleKey() {
|
|
83
82
|
return 'chat.suggestions.title.panelEmpty';
|
|
84
83
|
}
|