@websolutespa/llm-plugin-maxmeyer 0.0.1
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/CHANGELOG.md +7 -0
- package/README.md +159 -0
- package/dist/esm/__tests/example.test.js +9 -0
- package/dist/esm/__tests/example.test.js.map +1 -0
- package/dist/esm/blocks/Action/action.js +32 -0
- package/dist/esm/blocks/Action/action.js.map +1 -0
- package/dist/esm/blocks/Action/action.module.scss +5 -0
- package/dist/esm/blocks/ActionGroup/action-group.js +17 -0
- package/dist/esm/blocks/ActionGroup/action-group.js.map +1 -0
- package/dist/esm/blocks/ActionGroup/action-group.module.scss +8 -0
- package/dist/esm/blocks/AssistantMessage/assistant-message.js +18 -0
- package/dist/esm/blocks/AssistantMessage/assistant-message.js.map +1 -0
- package/dist/esm/blocks/CustomCard/custom-card.js +68 -0
- package/dist/esm/blocks/CustomCard/custom-card.js.map +1 -0
- package/dist/esm/blocks/CustomCard/custom-card.module.scss +64 -0
- package/dist/esm/blocks/CustomCardGroup/custom-card-group.js +65 -0
- package/dist/esm/blocks/CustomCardGroup/custom-card-group.js.map +1 -0
- package/dist/esm/blocks/CustomCardGroup/custom-card-group.module.scss +58 -0
- package/dist/esm/blocks/FormRecap/FormRecap.js +250 -0
- package/dist/esm/blocks/FormRecap/FormRecap.js.map +1 -0
- package/dist/esm/blocks/FormRecap/form-recap.module.scss +103 -0
- package/dist/esm/blocks/FormRecapError/FormRecapError.js +19 -0
- package/dist/esm/blocks/FormRecapError/FormRecapError.js.map +1 -0
- package/dist/esm/blocks/FormRecapError/form-recap-error.module.scss +7 -0
- package/dist/esm/blocks/FormRecapSuccess/FormRecapSuccess.js +19 -0
- package/dist/esm/blocks/FormRecapSuccess/FormRecapSuccess.js.map +1 -0
- package/dist/esm/blocks/FormRecapSuccess/form-recap-success.module.scss +7 -0
- package/dist/esm/blocks/FormRequest/FormRequest.js +36 -0
- package/dist/esm/blocks/FormRequest/FormRequest.js.map +1 -0
- package/dist/esm/blocks/FormRequest/form-request.module.scss +17 -0
- package/dist/esm/blocks/NotFound/not-found.js +15 -0
- package/dist/esm/blocks/NotFound/not-found.js.map +1 -0
- package/dist/esm/blocks/NotFound/not-found.module.scss +5 -0
- package/dist/esm/blocks/StreamError/StreamError.js +46 -0
- package/dist/esm/blocks/StreamError/StreamError.js.map +1 -0
- package/dist/esm/blocks/StreamError/_style.scss +34 -0
- package/dist/esm/blocks/UserMessage/user-message.js +22 -0
- package/dist/esm/blocks/UserMessage/user-message.js.map +1 -0
- package/dist/esm/blocks/UserMessage/user-message.module.scss +13 -0
- package/dist/esm/blocks/index.js +28 -0
- package/dist/esm/blocks/index.js.map +1 -0
- package/dist/esm/components/chat/Root/root.js +36 -0
- package/dist/esm/components/chat/Root/root.js.map +1 -0
- package/dist/esm/components/chat/Root/root.module.scss +58 -0
- package/dist/esm/components/chat/Thread/thread.js +40 -0
- package/dist/esm/components/chat/Thread/thread.js.map +1 -0
- package/dist/esm/components/chat/Thread/thread.module.scss +30 -0
- package/dist/esm/components/chat/index.js +8 -0
- package/dist/esm/components/chat/index.js.map +1 -0
- package/dist/esm/components/index.js +3 -0
- package/dist/esm/components/index.js.map +1 -0
- package/dist/esm/components/page/PageLoading/page-loading.js +32 -0
- package/dist/esm/components/page/PageLoading/page-loading.js.map +1 -0
- package/dist/esm/components/page/PageLoading/page-loading.module.scss +302 -0
- package/dist/esm/components/page/PageRoot/page-root.js +31 -0
- package/dist/esm/components/page/PageRoot/page-root.js.map +1 -0
- package/dist/esm/components/page/PageRoot/page-root.module.scss +24 -0
- package/dist/esm/components/page/PageStreamingIndicator/page-streaming-indicator.js +18 -0
- package/dist/esm/components/page/PageStreamingIndicator/page-streaming-indicator.js.map +1 -0
- package/dist/esm/components/page/PageStreamingIndicator/page-streaming-indicator.module.scss +38 -0
- package/dist/esm/components/page/PageTrigger/page-trigger.js +20 -0
- package/dist/esm/components/page/PageTrigger/page-trigger.js.map +1 -0
- package/dist/esm/components/page/PageTrigger/page-trigger.module.scss +16 -0
- package/dist/esm/components/page/index.js +12 -0
- package/dist/esm/components/page/index.js.map +1 -0
- package/dist/esm/global.d.js +2 -0
- package/dist/esm/global.d.js.map +1 -0
- package/dist/esm/index.js +12 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/llm.js +42 -0
- package/dist/esm/llm.js.map +1 -0
- package/dist/esm/mock/chat/app.js +76 -0
- package/dist/esm/mock/chat/app.js.map +1 -0
- package/dist/esm/mock/chat/theme.js +337 -0
- package/dist/esm/mock/chat/theme.js.map +1 -0
- package/dist/esm/mock/chat/thread.js +450 -0
- package/dist/esm/mock/chat/thread.js.map +1 -0
- package/dist/esm/mock/index.js +8 -0
- package/dist/esm/mock/index.js.map +1 -0
- package/dist/esm/mock/page/app.js +74 -0
- package/dist/esm/mock/page/app.js.map +1 -0
- package/dist/esm/mock/page/theme.js +337 -0
- package/dist/esm/mock/page/theme.js.map +1 -0
- package/dist/esm/mock/page/thread.js +756 -0
- package/dist/esm/mock/page/thread.js.map +1 -0
- package/dist/esm/plugin.js +21 -0
- package/dist/esm/plugin.js.map +1 -0
- package/dist/esm/scss/_base.scss +63 -0
- package/dist/esm/scss/_mixin.scss +10 -0
- package/dist/esm/scss/_reset.scss +63 -0
- package/dist/esm/scss/_thread.scss +35 -0
- package/dist/esm/scss/_typography.scss +19 -0
- package/dist/esm/scss/mixin/_breakpoint.scss +7 -0
- package/dist/esm/scss/mixin/_button.scss +64 -0
- package/dist/esm/scss/mixin/_container.scss +14 -0
- package/dist/esm/scss/mixin/_markdown.scss +180 -0
- package/dist/esm/scss/mixin/_scrollbar.scss +50 -0
- package/dist/esm/scss/mixin/_shadow.scss +19 -0
- package/dist/esm/scss/mixin/_size.scss +42 -0
- package/dist/esm/scss/mixin/_typography.scss +129 -0
- package/dist/esm/scss/mixin/_utils.scss +103 -0
- package/dist/esm/scss/mixin/_vars.scss +4 -0
- package/dist/esm/scss/style.scss +14 -0
- package/dist/index.css +5460 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.ts +78 -0
- package/dist/umd/index.js +48828 -0
- package/dist/umd/index.js.map +1 -0
- package/dist/umd/index.min.js +20 -0
- package/package.json +119 -0
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { getClassNames } from '@websolutespa/bom-core';
|
|
3
|
+
import { useLabel } from '@websolutespa/bom-mixer-hooks';
|
|
4
|
+
import { Cta, useLlm } from '@websolutespa/bom-mixer-llm';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import style from './form-recap.module.scss';
|
|
7
|
+
export const FormRecap = ()=>{
|
|
8
|
+
const label = useLabel();
|
|
9
|
+
const app = useLlm((state)=>state.app);
|
|
10
|
+
const threadId = useLlm((state)=>state.threadId);
|
|
11
|
+
const { formRecap, getApi } = useLlm((state)=>state.actions);
|
|
12
|
+
const onSubmit = async (event)=>{
|
|
13
|
+
event.preventDefault();
|
|
14
|
+
try {
|
|
15
|
+
const formData = new FormData(event.target);
|
|
16
|
+
const data = {};
|
|
17
|
+
for (const [key, value] of formData){
|
|
18
|
+
data[key] = value;
|
|
19
|
+
}
|
|
20
|
+
data.threadId = threadId;
|
|
21
|
+
const payload = {
|
|
22
|
+
...data,
|
|
23
|
+
html: getEmailHtml(data, app)
|
|
24
|
+
};
|
|
25
|
+
const api = getApi();
|
|
26
|
+
const response = await api.postSummary(payload);
|
|
27
|
+
if (response) {
|
|
28
|
+
console.warn('FormRecap.onSubmit.success', response, payload);
|
|
29
|
+
formRecap();
|
|
30
|
+
} else {
|
|
31
|
+
console.warn('FormRecap.onSubmit.error');
|
|
32
|
+
formRecap({
|
|
33
|
+
message: 'unknown error'
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
} catch (error) {
|
|
37
|
+
console.warn('FormRecap.onSubmit.error', error);
|
|
38
|
+
formRecap(error);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
42
|
+
className: style.formRecap,
|
|
43
|
+
children: /*#__PURE__*/ _jsx("div", {
|
|
44
|
+
className: style.formRecapWrapper,
|
|
45
|
+
children: /*#__PURE__*/ _jsxs("form", {
|
|
46
|
+
className: style.formRecapForm,
|
|
47
|
+
onSubmit: onSubmit,
|
|
48
|
+
children: [
|
|
49
|
+
/*#__PURE__*/ _jsx("div", {
|
|
50
|
+
className: style.formRecapTitle,
|
|
51
|
+
children: label('llm.formRecapTitle')
|
|
52
|
+
}),
|
|
53
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
54
|
+
className: style.formRecapFields,
|
|
55
|
+
children: [
|
|
56
|
+
/*#__PURE__*/ _jsx("div", {
|
|
57
|
+
className: style.formRecapField,
|
|
58
|
+
children: /*#__PURE__*/ _jsx("input", {
|
|
59
|
+
type: "text",
|
|
60
|
+
name: "fullName",
|
|
61
|
+
id: "subscribe-fullName",
|
|
62
|
+
placeholder: label('llm.formRecapFullName')
|
|
63
|
+
})
|
|
64
|
+
}),
|
|
65
|
+
/*#__PURE__*/ _jsx("div", {
|
|
66
|
+
className: style.formRecapField,
|
|
67
|
+
children: /*#__PURE__*/ _jsx("input", {
|
|
68
|
+
type: "email",
|
|
69
|
+
name: "email",
|
|
70
|
+
id: "subscribe-email",
|
|
71
|
+
placeholder: label('llm.formRecapEmail')
|
|
72
|
+
})
|
|
73
|
+
}),
|
|
74
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
75
|
+
className: getClassNames(style.formRecapField, style.formRecapFieldPrivacy),
|
|
76
|
+
children: [
|
|
77
|
+
/*#__PURE__*/ _jsx("input", {
|
|
78
|
+
type: "checkbox",
|
|
79
|
+
name: "privacy",
|
|
80
|
+
id: "subscribe-privacy"
|
|
81
|
+
}),
|
|
82
|
+
/*#__PURE__*/ _jsx("label", {
|
|
83
|
+
htmlFor: "subscribe-privacy",
|
|
84
|
+
children: label('llm.formRecapPrivacy')
|
|
85
|
+
})
|
|
86
|
+
]
|
|
87
|
+
}),
|
|
88
|
+
/*#__PURE__*/ _jsx("div", {
|
|
89
|
+
className: style.formRecapCta,
|
|
90
|
+
children: /*#__PURE__*/ _jsx(Cta, {
|
|
91
|
+
type: "submit",
|
|
92
|
+
label: label('llm.formRecapSend')
|
|
93
|
+
})
|
|
94
|
+
})
|
|
95
|
+
]
|
|
96
|
+
})
|
|
97
|
+
]
|
|
98
|
+
})
|
|
99
|
+
})
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
export function getEmailHtml(data, app) {
|
|
103
|
+
const firstName = data.fullName ? data.fullName.split(' ')[0] : '';
|
|
104
|
+
const name = app?.contents?.shortWelcomeText || 'PlatformAI';
|
|
105
|
+
const title = `Ciao ${firstName}`;
|
|
106
|
+
const paragraphs = `<p>${[
|
|
107
|
+
'Ecco il tuo promemoria,',
|
|
108
|
+
'per qualunque altra cosa sai dove potermi trovare, sarò sempre lieto di parlare con te. 👋'
|
|
109
|
+
].join('</p><p>')}</p>`;
|
|
110
|
+
const colorAccent = '#00aeff';
|
|
111
|
+
const threadUrl = window.location.href + `${window.location.search ? '&' : '?'}llmThreadId=${data.threadId}`;
|
|
112
|
+
return `
|
|
113
|
+
<!doctype html>
|
|
114
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
|
|
115
|
+
|
|
116
|
+
<head>
|
|
117
|
+
<title> ${title} </title>
|
|
118
|
+
<!--[if !mso]><!-->
|
|
119
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
120
|
+
<!--<![endif]-->
|
|
121
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
122
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
123
|
+
<style type="text/css">
|
|
124
|
+
#outlook a {
|
|
125
|
+
padding: 0;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
body {
|
|
129
|
+
margin: 0;
|
|
130
|
+
padding: 0;
|
|
131
|
+
-webkit-text-size-adjust: 100%;
|
|
132
|
+
-ms-text-size-adjust: 100%;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
table,
|
|
136
|
+
td {
|
|
137
|
+
border-collapse: collapse;
|
|
138
|
+
mso-table-lspace: 0pt;
|
|
139
|
+
mso-table-rspace: 0pt;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
img {
|
|
143
|
+
border: 0;
|
|
144
|
+
height: auto;
|
|
145
|
+
line-height: 100%;
|
|
146
|
+
outline: none;
|
|
147
|
+
text-decoration: none;
|
|
148
|
+
-ms-interpolation-mode: bicubic;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
p {
|
|
152
|
+
display: block;
|
|
153
|
+
margin: 13px 0;
|
|
154
|
+
}
|
|
155
|
+
</style>
|
|
156
|
+
<!--[if mso]>
|
|
157
|
+
<noscript>
|
|
158
|
+
<xml>
|
|
159
|
+
<o:OfficeDocumentSettings>
|
|
160
|
+
<o:AllowPNG/>
|
|
161
|
+
<o:PixelsPerInch>96</o:PixelsPerInch>
|
|
162
|
+
</o:OfficeDocumentSettings>
|
|
163
|
+
</xml>
|
|
164
|
+
</noscript>
|
|
165
|
+
<![endif]-->
|
|
166
|
+
<!--[if lte mso 11]>
|
|
167
|
+
<style type="text/css">
|
|
168
|
+
.mj-outlook-group-fix { width:100% !important; }
|
|
169
|
+
</style>
|
|
170
|
+
<![endif]-->
|
|
171
|
+
<!--[if !mso]><!-->
|
|
172
|
+
<link href="https://fonts.googleapis.com/css?family=Inter:400,600" rel="stylesheet" type="text/css">
|
|
173
|
+
<style type="text/css">
|
|
174
|
+
@import url(https://fonts.googleapis.com/css?family=Inter:400,600);
|
|
175
|
+
</style>
|
|
176
|
+
<!--<![endif]-->
|
|
177
|
+
<style type="text/css">
|
|
178
|
+
@media only screen and (min-width:480px) {
|
|
179
|
+
.mj-column-per-100 {
|
|
180
|
+
width: 100% !important;
|
|
181
|
+
max-width: 100%;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
</style>
|
|
185
|
+
<style media="screen and (min-width:480px)">
|
|
186
|
+
.moz-text-html .mj-column-per-100 {
|
|
187
|
+
width: 100% !important;
|
|
188
|
+
max-width: 100%;
|
|
189
|
+
}
|
|
190
|
+
</style>
|
|
191
|
+
<style type="text/css">
|
|
192
|
+
</style>
|
|
193
|
+
</head>
|
|
194
|
+
|
|
195
|
+
<body style="word-spacing:normal;">
|
|
196
|
+
<div style="">
|
|
197
|
+
<!--[if mso | IE]><table align="center" border="0" cellpadding="0" cellspacing="0" class="" style="width:600px;" width="600" ><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;"><![endif]-->
|
|
198
|
+
<div style="margin:0px auto;max-width:600px;">
|
|
199
|
+
<table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation" style="width:100%;">
|
|
200
|
+
<tbody>
|
|
201
|
+
<tr>
|
|
202
|
+
<td style="direction:ltr;font-size:0px;padding:0px;padding-top:20px;text-align:center;">
|
|
203
|
+
<!--[if mso | IE]><table role="presentation" border="0" cellpadding="0" cellspacing="0"><tr><td class="" style="vertical-align:top;width:600px;" ><![endif]-->
|
|
204
|
+
<div class="mj-column-per-100 mj-outlook-group-fix" style="font-size:0px;text-align:left;direction:ltr;display:inline-block;vertical-align:top;width:100%;">
|
|
205
|
+
<table border="0" cellpadding="0" cellspacing="0" role="presentation" style="vertical-align:top;" width="100%">
|
|
206
|
+
<tbody>
|
|
207
|
+
<tr>
|
|
208
|
+
<td align="left" style="font-size:0px;padding:10px 25px;word-break:break-word;">
|
|
209
|
+
<div style="font-family:Inter;font-size:20px;font-weight:600;line-height:24px;text-align:left;color:#3b3b3b;">${name}</div>
|
|
210
|
+
</td>
|
|
211
|
+
</tr>
|
|
212
|
+
<tr>
|
|
213
|
+
<td align="center" style="font-size:0px;padding:10px 25px;word-break:break-word;">
|
|
214
|
+
<p style="border-top:solid 3px #EFEFF2;font-size:1px;margin:0px auto;width:100%;">
|
|
215
|
+
</p>
|
|
216
|
+
<!--[if mso | IE]><table align="center" border="0" cellpadding="0" cellspacing="0" style="border-top:solid 3px #EFEFF2;font-size:1px;margin:0px auto;width:550px;" role="presentation" width="550px" ><tr><td style="height:0;line-height:0;">
|
|
217
|
+
</td></tr></table><![endif]-->
|
|
218
|
+
</td>
|
|
219
|
+
</tr>
|
|
220
|
+
<tr>
|
|
221
|
+
<td align="left" style="font-size:0px;padding:10px 25px;word-break:break-word;">
|
|
222
|
+
<div style="font-family:Inter;font-size:28px;font-weight:600;line-height:24px;text-align:left;color:#3b3b3b;">${title}</div>
|
|
223
|
+
</td>
|
|
224
|
+
</tr>
|
|
225
|
+
<tr>
|
|
226
|
+
<td align="left" style="font-size:0px;padding:10px 25px;word-break:break-word;">
|
|
227
|
+
<div style="font-family:Inter, Helvetica, sans-serif;font-size:16px;font-weight:400;line-height:24px;text-align:left;color:#555555;">${paragraphs} <h3 style="font-weight: 600; margin-top: 20px; margin-bottom: 0">
|
|
228
|
+
<a href="${threadUrl}" style="color: ${colorAccent}; text-decoration: underline">link</a>
|
|
229
|
+
</h3>
|
|
230
|
+
</div>
|
|
231
|
+
</td>
|
|
232
|
+
</tr>
|
|
233
|
+
</tbody>
|
|
234
|
+
</table>
|
|
235
|
+
</div>
|
|
236
|
+
<!--[if mso | IE]></td></tr></table><![endif]-->
|
|
237
|
+
</td>
|
|
238
|
+
</tr>
|
|
239
|
+
</tbody>
|
|
240
|
+
</table>
|
|
241
|
+
</div>
|
|
242
|
+
<!--[if mso | IE]></td></tr></table><![endif]-->
|
|
243
|
+
</div>
|
|
244
|
+
</body>
|
|
245
|
+
|
|
246
|
+
</html>
|
|
247
|
+
`;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
//# sourceMappingURL=FormRecap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/blocks/FormRecap/FormRecap.tsx"],"sourcesContent":["import { getClassNames } from '@websolutespa/bom-core';\nimport { useLabel } from '@websolutespa/bom-mixer-hooks';\nimport { Cta, FormRecapData, LlmApp, PostSummaryOptions, useLlm } from '@websolutespa/bom-mixer-llm';\nimport React, { FormEvent } from 'react';\nimport style from './form-recap.module.scss';\n\nexport const FormRecap: React.FC = () => {\n const label = useLabel();\n const app = useLlm(state => state.app);\n const threadId = useLlm(state => state.threadId);\n const { formRecap, getApi } = useLlm(state => state.actions);\n\n const onSubmit = async (event: FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n try {\n const formData = new FormData(event.target as HTMLFormElement);\n const data: Partial<FormRecapData> = {};\n for (const [key, value] of formData) {\n data[key as keyof typeof data] = value as string;\n }\n data.threadId = threadId;\n const payload: PostSummaryOptions = {\n ...(data as FormRecapData),\n html: getEmailHtml(data as Required<FormRecapData>, app),\n };\n const api = getApi();\n const response = await api.postSummary(payload);\n if (response) {\n console.warn('FormRecap.onSubmit.success', response, payload);\n formRecap();\n } else {\n console.warn('FormRecap.onSubmit.error');\n formRecap({ message: 'unknown error' });\n }\n } catch (error) {\n console.warn('FormRecap.onSubmit.error', error);\n formRecap(error);\n }\n };\n\n return (\n <div className={style.formRecap}>\n <div className={style.formRecapWrapper}>\n <form className={style.formRecapForm} onSubmit={onSubmit}>\n <div className={style.formRecapTitle}>{label('llm.formRecapTitle')}</div>\n <div className={style.formRecapFields}>\n <div className={style.formRecapField}>\n <input type=\"text\" name=\"fullName\" id=\"subscribe-fullName\" placeholder={label('llm.formRecapFullName')} />\n </div>\n <div className={style.formRecapField}>\n <input type=\"email\" name=\"email\" id=\"subscribe-email\" placeholder={label('llm.formRecapEmail')} />\n </div>\n <div className={getClassNames(style.formRecapField, style.formRecapFieldPrivacy)}>\n <input type=\"checkbox\" name=\"privacy\" id=\"subscribe-privacy\" />\n <label htmlFor=\"subscribe-privacy\">{label('llm.formRecapPrivacy')}</label>\n </div>\n <div className={style.formRecapCta}>\n <Cta type=\"submit\" label={label('llm.formRecapSend')} />\n </div>\n </div>\n </form>\n </div>\n </div>\n );\n};\n\nexport function getEmailHtml(data: FormRecapData, app?: LlmApp): string {\n const firstName = data.fullName ? data.fullName.split(' ')[0] : '';\n const name = app?.contents?.shortWelcomeText || 'PlatformAI';\n const title = `Ciao ${firstName}`;\n const paragraphs = `<p>${[\n 'Ecco il tuo promemoria,',\n 'per qualunque altra cosa sai dove potermi trovare, sarò sempre lieto di parlare con te. 👋',\n ].join('</p><p>')}</p>`;\n const colorAccent = '#00aeff';\n const threadUrl = window.location.href + `${window.location.search ? '&' : '?'}llmThreadId=${data.threadId}`;\n return `\n<!doctype html>\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:o=\"urn:schemas-microsoft-com:office:office\">\n\n<head>\n <title> ${title} </title>\n <!--[if !mso]><!-->\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n <!--<![endif]-->\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n <style type=\"text/css\">\n #outlook a {\n padding: 0;\n }\n\n body {\n margin: 0;\n padding: 0;\n -webkit-text-size-adjust: 100%;\n -ms-text-size-adjust: 100%;\n }\n\n table,\n td {\n border-collapse: collapse;\n mso-table-lspace: 0pt;\n mso-table-rspace: 0pt;\n }\n\n img {\n border: 0;\n height: auto;\n line-height: 100%;\n outline: none;\n text-decoration: none;\n -ms-interpolation-mode: bicubic;\n }\n\n p {\n display: block;\n margin: 13px 0;\n }\n </style>\n <!--[if mso]>\n <noscript>\n <xml>\n <o:OfficeDocumentSettings>\n <o:AllowPNG/>\n <o:PixelsPerInch>96</o:PixelsPerInch>\n </o:OfficeDocumentSettings>\n </xml>\n </noscript>\n <![endif]-->\n <!--[if lte mso 11]>\n <style type=\"text/css\">\n .mj-outlook-group-fix { width:100% !important; }\n </style>\n <![endif]-->\n <!--[if !mso]><!-->\n <link href=\"https://fonts.googleapis.com/css?family=Inter:400,600\" rel=\"stylesheet\" type=\"text/css\">\n <style type=\"text/css\">\n @import url(https://fonts.googleapis.com/css?family=Inter:400,600);\n </style>\n <!--<![endif]-->\n <style type=\"text/css\">\n @media only screen and (min-width:480px) {\n .mj-column-per-100 {\n width: 100% !important;\n max-width: 100%;\n }\n }\n </style>\n <style media=\"screen and (min-width:480px)\">\n .moz-text-html .mj-column-per-100 {\n width: 100% !important;\n max-width: 100%;\n }\n </style>\n <style type=\"text/css\">\n </style>\n</head>\n\n<body style=\"word-spacing:normal;\">\n <div style=\"\">\n <!--[if mso | IE]><table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"\" style=\"width:600px;\" width=\"600\" ><tr><td style=\"line-height:0px;font-size:0px;mso-line-height-rule:exactly;\"><![endif]-->\n <div style=\"margin:0px auto;max-width:600px;\">\n <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"width:100%;\">\n <tbody>\n <tr>\n <td style=\"direction:ltr;font-size:0px;padding:0px;padding-top:20px;text-align:center;\">\n <!--[if mso | IE]><table role=\"presentation\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td class=\"\" style=\"vertical-align:top;width:600px;\" ><![endif]-->\n <div class=\"mj-column-per-100 mj-outlook-group-fix\" style=\"font-size:0px;text-align:left;direction:ltr;display:inline-block;vertical-align:top;width:100%;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"vertical-align:top;\" width=\"100%\">\n <tbody>\n <tr>\n <td align=\"left\" style=\"font-size:0px;padding:10px 25px;word-break:break-word;\">\n <div style=\"font-family:Inter;font-size:20px;font-weight:600;line-height:24px;text-align:left;color:#3b3b3b;\">${name}</div>\n </td>\n </tr>\n <tr>\n <td align=\"center\" style=\"font-size:0px;padding:10px 25px;word-break:break-word;\">\n <p style=\"border-top:solid 3px #EFEFF2;font-size:1px;margin:0px auto;width:100%;\">\n </p>\n <!--[if mso | IE]><table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-top:solid 3px #EFEFF2;font-size:1px;margin:0px auto;width:550px;\" role=\"presentation\" width=\"550px\" ><tr><td style=\"height:0;line-height:0;\"> \n</td></tr></table><![endif]-->\n </td>\n </tr>\n <tr>\n <td align=\"left\" style=\"font-size:0px;padding:10px 25px;word-break:break-word;\">\n <div style=\"font-family:Inter;font-size:28px;font-weight:600;line-height:24px;text-align:left;color:#3b3b3b;\">${title}</div>\n </td>\n </tr>\n <tr>\n <td align=\"left\" style=\"font-size:0px;padding:10px 25px;word-break:break-word;\">\n <div style=\"font-family:Inter, Helvetica, sans-serif;font-size:16px;font-weight:400;line-height:24px;text-align:left;color:#555555;\">${paragraphs} <h3 style=\"font-weight: 600; margin-top: 20px; margin-bottom: 0\">\n <a href=\"${threadUrl}\" style=\"color: ${colorAccent}; text-decoration: underline\">link</a>\n </h3>\n </div>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n <!--[if mso | IE]></td></tr></table><![endif]-->\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n <!--[if mso | IE]></td></tr></table><![endif]-->\n </div>\n</body>\n\n</html>\n`;\n}\n"],"names":["getClassNames","useLabel","Cta","useLlm","React","style","FormRecap","label","app","state","threadId","formRecap","getApi","actions","onSubmit","event","preventDefault","formData","FormData","target","data","key","value","payload","html","getEmailHtml","api","response","postSummary","console","warn","message","error","div","className","formRecapWrapper","form","formRecapForm","formRecapTitle","formRecapFields","formRecapField","input","type","name","id","placeholder","formRecapFieldPrivacy","htmlFor","formRecapCta","firstName","fullName","split","contents","shortWelcomeText","title","paragraphs","join","colorAccent","threadUrl","window","location","href","search"],"mappings":"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"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
@import '../../scss/mixin';
|
|
2
|
+
|
|
3
|
+
.formRecapTitle {
|
|
4
|
+
@include text(display4);
|
|
5
|
+
margin-bottom: size(3);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.formRecapFields {
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
gap: size(4);
|
|
12
|
+
|
|
13
|
+
@include bp(sm) {
|
|
14
|
+
gap: size(2);
|
|
15
|
+
flex-wrap: wrap;
|
|
16
|
+
flex-direction: row;
|
|
17
|
+
align-items: center;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.formRecapCta {
|
|
22
|
+
margin: 0 auto;
|
|
23
|
+
order: 3;
|
|
24
|
+
|
|
25
|
+
@include bp(sm) {
|
|
26
|
+
order: 1;
|
|
27
|
+
margin: 0;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.formRecapField {
|
|
32
|
+
width: 100%;
|
|
33
|
+
|
|
34
|
+
@include bp(sm) {
|
|
35
|
+
width: auto;
|
|
36
|
+
min-width: 250px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
input[type='text'],
|
|
40
|
+
input[type='email'] {
|
|
41
|
+
@include text(label-2);
|
|
42
|
+
appearance: none;
|
|
43
|
+
display: block;
|
|
44
|
+
width: 100%;
|
|
45
|
+
height: 56px;
|
|
46
|
+
padding: 0 size(4);
|
|
47
|
+
border-radius: 5px;
|
|
48
|
+
border: var(--llm-border);
|
|
49
|
+
font-family: var(--llm-input-font-family);
|
|
50
|
+
background: var(--llm-input-background);
|
|
51
|
+
color: var(--llm-input-foreground);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.formRecapFieldPrivacy {
|
|
56
|
+
width: 100%;
|
|
57
|
+
order: 99;
|
|
58
|
+
position: relative;
|
|
59
|
+
order: 2;
|
|
60
|
+
|
|
61
|
+
@include bp(sm) {
|
|
62
|
+
order: auto;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
label {
|
|
66
|
+
@include text(body5);
|
|
67
|
+
line-height: 140%;
|
|
68
|
+
position: relative;
|
|
69
|
+
display: block;
|
|
70
|
+
padding-left: 24px;
|
|
71
|
+
pointer-events: auto;
|
|
72
|
+
cursor: pointer;
|
|
73
|
+
|
|
74
|
+
&:before,
|
|
75
|
+
&:after {
|
|
76
|
+
content: '';
|
|
77
|
+
display: block;
|
|
78
|
+
position: absolute;
|
|
79
|
+
width: 16px;
|
|
80
|
+
height: 16px;
|
|
81
|
+
top: 2px;
|
|
82
|
+
left: 0;
|
|
83
|
+
border-radius: 2px;
|
|
84
|
+
border: var(--llm-checkbox-border);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
&:after {
|
|
88
|
+
display: none;
|
|
89
|
+
background-image: url('data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjEyIiB2aWV3Qm94PSIwIDAgMTIgMTIiIHdpZHRoPSIxMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJtNC42NjYyNSA5LjUwNTQyLTIuNzYtMi43NiAxLjI1Nzc4LTEuMjU3NzggMS41MDIyMiAxLjUwNjY3IDQuMzkxMTEtNC4zOTU1NiAxLjI1Nzc0IDEuMjU3Nzh6IiBmaWxsPSIjZmZmIi8+PC9zdmc+');
|
|
90
|
+
background-repeat: no-repeat;
|
|
91
|
+
background-position: center;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
input {
|
|
96
|
+
position: absolute;
|
|
97
|
+
opacity: 0;
|
|
98
|
+
|
|
99
|
+
&:checked+label:after {
|
|
100
|
+
display: block;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { getClassNames } from '@websolutespa/bom-core';
|
|
3
|
+
import { useLabel } from '@websolutespa/bom-mixer-hooks';
|
|
4
|
+
import { Text } from '@websolutespa/bom-mixer-llm';
|
|
5
|
+
import style from './form-recap-error.module.scss';
|
|
6
|
+
export const FormRecapError = ()=>{
|
|
7
|
+
const label = useLabel();
|
|
8
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
9
|
+
className: getClassNames(style.formRecapError, 'llm__row'),
|
|
10
|
+
children: /*#__PURE__*/ _jsx("div", {
|
|
11
|
+
className: "llm__col --sm-10 --md-8 --lg-6",
|
|
12
|
+
children: /*#__PURE__*/ _jsx(Text, {
|
|
13
|
+
body: label('llm.formRecapError')
|
|
14
|
+
})
|
|
15
|
+
})
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=FormRecapError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/blocks/FormRecapError/FormRecapError.tsx"],"sourcesContent":["import { getClassNames } from '@websolutespa/bom-core';\nimport { useLabel } from '@websolutespa/bom-mixer-hooks';\nimport { Text } from '@websolutespa/bom-mixer-llm';\nimport style from './form-recap-error.module.scss';\n\nexport const FormRecapError: React.FC = () => {\n const label = useLabel();\n\n return (\n <div className={getClassNames(style.formRecapError, 'llm__row')}>\n <div className=\"llm__col --sm-10 --md-8 --lg-6\">\n <Text body={label('llm.formRecapError')} />\n </div>\n </div>\n );\n};\n"],"names":["getClassNames","useLabel","Text","style","FormRecapError","label","div","className","formRecapError","body"],"mappings":";AAAA,SAASA,aAAa,QAAQ,yBAAyB;AACvD,SAASC,QAAQ,QAAQ,gCAAgC;AACzD,SAASC,IAAI,QAAQ,8BAA8B;AACnD,OAAOC,WAAW,iCAAiC;AAEnD,OAAO,MAAMC,iBAA2B;IACtC,MAAMC,QAAQJ;IAEd,qBACE,KAACK;QAAIC,WAAWP,cAAcG,MAAMK,cAAc,EAAE;kBAClD,cAAA,KAACF;YAAIC,WAAU;sBACb,cAAA,KAACL;gBAAKO,MAAMJ,MAAM;;;;AAI1B,EAAE"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { getClassNames } from '@websolutespa/bom-core';
|
|
3
|
+
import { useLabel } from '@websolutespa/bom-mixer-hooks';
|
|
4
|
+
import { Text } from '@websolutespa/bom-mixer-llm';
|
|
5
|
+
import style from './form-recap-success.module.scss';
|
|
6
|
+
export const FormRecapSuccess = ()=>{
|
|
7
|
+
const label = useLabel();
|
|
8
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
9
|
+
className: getClassNames(style.formRecapSuccess, 'llm__row'),
|
|
10
|
+
children: /*#__PURE__*/ _jsx("div", {
|
|
11
|
+
className: "llm__col --sm-10 --md-8 --lg-6",
|
|
12
|
+
children: /*#__PURE__*/ _jsx(Text, {
|
|
13
|
+
body: label('llm.formRecapSuccess')
|
|
14
|
+
})
|
|
15
|
+
})
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=FormRecapSuccess.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/blocks/FormRecapSuccess/FormRecapSuccess.tsx"],"sourcesContent":["import { getClassNames } from '@websolutespa/bom-core';\nimport { useLabel } from '@websolutespa/bom-mixer-hooks';\nimport { Text } from '@websolutespa/bom-mixer-llm';\nimport style from './form-recap-success.module.scss';\n\nexport const FormRecapSuccess: React.FC = () => {\n const label = useLabel();\n\n return (\n <div className={getClassNames(style.formRecapSuccess, 'llm__row')}>\n <div className=\"llm__col --sm-10 --md-8 --lg-6\">\n <Text body={label('llm.formRecapSuccess')} />\n </div>\n </div>\n );\n};\n"],"names":["getClassNames","useLabel","Text","style","FormRecapSuccess","label","div","className","formRecapSuccess","body"],"mappings":";AAAA,SAASA,aAAa,QAAQ,yBAAyB;AACvD,SAASC,QAAQ,QAAQ,gCAAgC;AACzD,SAASC,IAAI,QAAQ,8BAA8B;AACnD,OAAOC,WAAW,mCAAmC;AAErD,OAAO,MAAMC,mBAA6B;IACxC,MAAMC,QAAQJ;IAEd,qBACE,KAACK;QAAIC,WAAWP,cAAcG,MAAMK,gBAAgB,EAAE;kBACpD,cAAA,KAACF;YAAIC,WAAU;sBACb,cAAA,KAACL;gBAAKO,MAAMJ,MAAM;;;;AAI1B,EAAE"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useLabel } from '@websolutespa/bom-mixer-hooks';
|
|
3
|
+
import { Cta, Text, useLlm } from '@websolutespa/bom-mixer-llm';
|
|
4
|
+
import style from './form-request.module.scss';
|
|
5
|
+
export const FormRequest = ({ last })=>{
|
|
6
|
+
const label = useLabel();
|
|
7
|
+
const { formRequest } = useLlm((state)=>state.actions);
|
|
8
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
9
|
+
className: "llm__row",
|
|
10
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
11
|
+
className: "llm__col --md-8 --lg-6",
|
|
12
|
+
children: [
|
|
13
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
14
|
+
body: label('llm.formRequestTitle')
|
|
15
|
+
}),
|
|
16
|
+
last && /*#__PURE__*/ _jsxs("div", {
|
|
17
|
+
className: style.formRequestCtas,
|
|
18
|
+
children: [
|
|
19
|
+
/*#__PURE__*/ _jsx(Cta, {
|
|
20
|
+
type: "simple",
|
|
21
|
+
label: label('llm.formRequestYes'),
|
|
22
|
+
onClick: ()=>formRequest(true)
|
|
23
|
+
}),
|
|
24
|
+
/*#__PURE__*/ _jsx(Cta, {
|
|
25
|
+
type: "simple",
|
|
26
|
+
label: label('llm.formRequestNo'),
|
|
27
|
+
onClick: ()=>formRequest(false)
|
|
28
|
+
})
|
|
29
|
+
]
|
|
30
|
+
})
|
|
31
|
+
]
|
|
32
|
+
})
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=FormRequest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/blocks/FormRequest/FormRequest.tsx"],"sourcesContent":["import { useLabel } from '@websolutespa/bom-mixer-hooks';\nimport { Cta, Text, useLlm } from '@websolutespa/bom-mixer-llm';\nimport style from './form-request.module.scss';\n\nexport const FormRequest: React.FC<{ last: boolean }> = ({ last }) => {\n const label = useLabel();\n const { formRequest } = useLlm(state => state.actions);\n return (\n <div className=\"llm__row\">\n <div className=\"llm__col --md-8 --lg-6\">\n <Text body={label('llm.formRequestTitle')} />\n {last && (\n <div className={style.formRequestCtas}>\n <Cta type=\"simple\" label={label('llm.formRequestYes')} onClick={() => formRequest(true)} />\n <Cta type=\"simple\" label={label('llm.formRequestNo')} onClick={() => formRequest(false)} />\n </div>\n )}\n </div>\n </div>\n );\n};\n"],"names":["useLabel","Cta","Text","useLlm","style","FormRequest","last","label","formRequest","state","actions","div","className","body","formRequestCtas","type","onClick"],"mappings":";AAAA,SAASA,QAAQ,QAAQ,gCAAgC;AACzD,SAASC,GAAG,EAAEC,IAAI,EAAEC,MAAM,QAAQ,8BAA8B;AAChE,OAAOC,WAAW,6BAA6B;AAE/C,OAAO,MAAMC,cAA2C,CAAC,EAAEC,IAAI,EAAE;IAC/D,MAAMC,QAAQP;IACd,MAAM,EAAEQ,WAAW,EAAE,GAAGL,OAAOM,CAAAA,QAASA,MAAMC,OAAO;IACrD,qBACE,KAACC;QAAIC,WAAU;kBACb,cAAA,MAACD;YAAIC,WAAU;;8BACb,KAACV;oBAAKW,MAAMN,MAAM;;gBACjBD,sBACC,MAACK;oBAAIC,WAAWR,MAAMU,eAAe;;sCACnC,KAACb;4BAAIc,MAAK;4BAASR,OAAOA,MAAM;4BAAuBS,SAAS,IAAMR,YAAY;;sCAClF,KAACP;4BAAIc,MAAK;4BAASR,OAAOA,MAAM;4BAAsBS,SAAS,IAAMR,YAAY;;;;;;;AAM7F,EAAE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
@import '../../scss/mixin';
|
|
2
|
+
|
|
3
|
+
.formRequest {
|
|
4
|
+
&:not(:first-child) {
|
|
5
|
+
.llm__text-body {
|
|
6
|
+
@include text(display6);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.formRequestCtas {
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-wrap: wrap;
|
|
14
|
+
align-items: center;
|
|
15
|
+
gap: size(2);
|
|
16
|
+
margin-top: size(2);
|
|
17
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { getClassNames } from '@websolutespa/bom-core';
|
|
3
|
+
import style from './not-found.module.scss';
|
|
4
|
+
export const NotFound = (props)=>{
|
|
5
|
+
const { item } = props;
|
|
6
|
+
const classNames = getClassNames(style.notFound, {
|
|
7
|
+
[`.notFound--${item.type}`]: !!item.type
|
|
8
|
+
});
|
|
9
|
+
return /*#__PURE__*/ _jsx("pre", {
|
|
10
|
+
className: classNames,
|
|
11
|
+
children: JSON.stringify(item, null, 2)
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=not-found.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/blocks/NotFound/not-found.tsx"],"sourcesContent":["import { getClassNames } from '@websolutespa/bom-core';\nimport { LlmBlock, LlmChunkUnknownItem } from '@websolutespa/bom-mixer-llm';\nimport style from './not-found.module.scss';\n\nexport const NotFound: React.FC<LlmBlock<LlmChunkUnknownItem>> = (props) => {\n const { item } = props;\n const classNames = getClassNames(style.notFound, { [`.notFound--${item.type}`]: !!item.type });\n return (\n <pre className={classNames}>{JSON.stringify(item, null, 2)}</pre>\n );\n};\n"],"names":["getClassNames","style","NotFound","props","item","classNames","notFound","type","pre","className","JSON","stringify"],"mappings":";AAAA,SAASA,aAAa,QAAQ,yBAAyB;AAEvD,OAAOC,WAAW,0BAA0B;AAE5C,OAAO,MAAMC,WAAoD,CAACC;IAChE,MAAM,EAAEC,IAAI,EAAE,GAAGD;IACjB,MAAME,aAAaL,cAAcC,MAAMK,QAAQ,EAAE;QAAE,CAAC,CAAC,WAAW,EAAEF,KAAKG,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAACH,KAAKG,IAAI;IAAC;IAC5F,qBACE,KAACC;QAAIC,WAAWJ;kBAAaK,KAAKC,SAAS,CAACP,MAAM,MAAM;;AAE5D,EAAE"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { isBrowser } from '@websolutespa/bom-core';
|
|
3
|
+
import { useLabel } from '@websolutespa/bom-mixer-hooks';
|
|
4
|
+
import { Text } from '@websolutespa/bom-mixer-llm';
|
|
5
|
+
import { useState } from 'react';
|
|
6
|
+
const USE_INSPECT_PARAM = false;
|
|
7
|
+
function hasInspect() {
|
|
8
|
+
if (!isBrowser) {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
const url = new URL(window.location.href);
|
|
12
|
+
return url.searchParams.has('inspect');
|
|
13
|
+
}
|
|
14
|
+
export const StreamError = (props)=>{
|
|
15
|
+
const { item } = props;
|
|
16
|
+
const label = useLabel();
|
|
17
|
+
const [show, setShow] = useState(false);
|
|
18
|
+
const shouldShowStreamError = USE_INSPECT_PARAM ? hasInspect() : true;
|
|
19
|
+
return shouldShowStreamError ? /*#__PURE__*/ _jsxs("div", {
|
|
20
|
+
className: "llm__stream-error llm__row",
|
|
21
|
+
children: [
|
|
22
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
23
|
+
className: "llm__stream-error__info llm__col --sm-10 --md-8 --lg-6",
|
|
24
|
+
children: [
|
|
25
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
26
|
+
body: label('llm.streamError')
|
|
27
|
+
}),
|
|
28
|
+
/*#__PURE__*/ _jsx("button", {
|
|
29
|
+
className: "llm__stream-error__toggle",
|
|
30
|
+
type: "button",
|
|
31
|
+
onClick: ()=>setShow(!show),
|
|
32
|
+
"aria-label": show ? label('llm.hideError') : label('llm.showError'),
|
|
33
|
+
"aria-pressed": show,
|
|
34
|
+
children: show ? label('llm.hideError') : label('llm.showError')
|
|
35
|
+
})
|
|
36
|
+
]
|
|
37
|
+
}),
|
|
38
|
+
show && /*#__PURE__*/ _jsx("code", {
|
|
39
|
+
className: "llm__stream-error__error llm__hint",
|
|
40
|
+
children: JSON.stringify(item.error)
|
|
41
|
+
})
|
|
42
|
+
]
|
|
43
|
+
}) : undefined;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=StreamError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/blocks/StreamError/StreamError.tsx"],"sourcesContent":["import { isBrowser } from '@websolutespa/bom-core';\nimport { useLabel } from '@websolutespa/bom-mixer-hooks';\nimport { LlmBlock, LlmChunkError, Text } from '@websolutespa/bom-mixer-llm';\nimport { useState } from 'react';\n\nconst USE_INSPECT_PARAM = false;\n\nfunction hasInspect() {\n if (!isBrowser) {\n return false;\n }\n const url = new URL(window.location.href);\n return url.searchParams.has('inspect');\n}\n\nexport const StreamError: React.FC<LlmBlock<LlmChunkError>> = (props) => {\n const { item } = props;\n const label = useLabel();\n const [show, setShow] = useState(false);\n const shouldShowStreamError = USE_INSPECT_PARAM ? hasInspect() : true;\n return shouldShowStreamError ? (\n <div className=\"llm__stream-error llm__row\">\n <div className=\"llm__stream-error__info llm__col --sm-10 --md-8 --lg-6\">\n <Text body={label('llm.streamError')} />\n <button\n className=\"llm__stream-error__toggle\"\n type=\"button\"\n onClick={() => setShow(!show)}\n aria-label={show ? label('llm.hideError') : label('llm.showError')}\n aria-pressed={show}\n >{show ? label('llm.hideError') : label('llm.showError')}</button>\n </div>\n {show && (\n <code className=\"llm__stream-error__error llm__hint\">{JSON.stringify(item.error)}</code>\n )}\n </div>\n ) : undefined;\n};\n"],"names":["isBrowser","useLabel","Text","useState","USE_INSPECT_PARAM","hasInspect","url","URL","window","location","href","searchParams","has","StreamError","props","item","label","show","setShow","shouldShowStreamError","div","className","body","button","type","onClick","aria-label","aria-pressed","code","JSON","stringify","error","undefined"],"mappings":";AAAA,SAASA,SAAS,QAAQ,yBAAyB;AACnD,SAASC,QAAQ,QAAQ,gCAAgC;AACzD,SAAkCC,IAAI,QAAQ,8BAA8B;AAC5E,SAASC,QAAQ,QAAQ,QAAQ;AAEjC,MAAMC,oBAAoB;AAE1B,SAASC;IACP,IAAI,CAACL,WAAW;QACd,OAAO;IACT;IACA,MAAMM,MAAM,IAAIC,IAAIC,OAAOC,QAAQ,CAACC,IAAI;IACxC,OAAOJ,IAAIK,YAAY,CAACC,GAAG,CAAC;AAC9B;AAEA,OAAO,MAAMC,cAAiD,CAACC;IAC7D,MAAM,EAAEC,IAAI,EAAE,GAAGD;IACjB,MAAME,QAAQf;IACd,MAAM,CAACgB,MAAMC,QAAQ,GAAGf,SAAS;IACjC,MAAMgB,wBAAwBf,oBAAoBC,eAAe;IACjE,OAAOc,sCACL,MAACC;QAAIC,WAAU;;0BACb,MAACD;gBAAIC,WAAU;;kCACb,KAACnB;wBAAKoB,MAAMN,MAAM;;kCAClB,KAACO;wBACCF,WAAU;wBACVG,MAAK;wBACLC,SAAS,IAAMP,QAAQ,CAACD;wBACxBS,cAAYT,OAAOD,MAAM,mBAAmBA,MAAM;wBAClDW,gBAAcV;kCACdA,OAAOD,MAAM,mBAAmBA,MAAM;;;;YAEzCC,sBACC,KAACW;gBAAKP,WAAU;0BAAsCQ,KAAKC,SAAS,CAACf,KAAKgB,KAAK;;;SAGjFC;AACN,EAAE"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
@import '../../scss/mixin';
|
|
2
|
+
|
|
3
|
+
.llm {
|
|
4
|
+
& &__stream-error {
|
|
5
|
+
.llm__text-body {
|
|
6
|
+
@include text(display6);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
&__toggle {
|
|
10
|
+
@include button();
|
|
11
|
+
color: var(--llm-input-accent-foreground);
|
|
12
|
+
text-decoration: underline;
|
|
13
|
+
margin-top: rem(0.5);
|
|
14
|
+
|
|
15
|
+
&:hover {
|
|
16
|
+
text-decoration: none;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
svg {
|
|
20
|
+
width: 18px;
|
|
21
|
+
height: 18px;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&__error {
|
|
26
|
+
overflow-x: auto;
|
|
27
|
+
|
|
28
|
+
&,
|
|
29
|
+
&.llm__hint {
|
|
30
|
+
margin-top: rem(2);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import style from './user-message.module.scss';
|
|
3
|
+
export const UserMessage = (props)=>{
|
|
4
|
+
const { text } = props;
|
|
5
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
6
|
+
className: "llm__row",
|
|
7
|
+
children: /*#__PURE__*/ _jsx("div", {
|
|
8
|
+
className: "llm__col --end-xs-12 --xs-10 --sm-9 --md-8 --lg-7 --xl-6",
|
|
9
|
+
children: /*#__PURE__*/ _jsx("div", {
|
|
10
|
+
className: style.UserMessage,
|
|
11
|
+
children: /*#__PURE__*/ _jsx("h2", {
|
|
12
|
+
className: "llm__text-body",
|
|
13
|
+
dangerouslySetInnerHTML: {
|
|
14
|
+
__html: text
|
|
15
|
+
}
|
|
16
|
+
})
|
|
17
|
+
})
|
|
18
|
+
})
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=user-message.js.map
|