@netlify/spark-ui 1.17.6 → 1.18.0-alpha.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/dist/analytics/analytics.d.ts +9 -1
- package/dist/assets/AskNetlify.css +1 -1
- package/dist/assets/Popover.css +1 -1
- package/dist/chunks/{AskNetlify.1Uqf__uI.js → AskNetlify.BYFTesUF.js} +221 -213
- package/dist/chunks/analytics.D_dJH08O.js +20 -0
- package/dist/components/preact/AskNetlify/AskNetlify.js +1 -1
- package/dist/components/preact/AskNetlify/components/ActionBar.d.ts +7 -0
- package/dist/components/preact/AskNetlify/components/ActionBar.js +78 -0
- package/dist/components/preact/AskNetlify/components/ChatMessages.d.ts +2 -1
- package/dist/components/preact/AskNetlify/components/ChatMessages.js +69 -59
- package/dist/components/preact/AskNetlify/hooks/useAskAnalytics.js +1 -1
- package/dist/components/preact/Icon/index.d.ts +2 -1
- package/dist/components/preact/Icon/index.js +83 -40
- package/dist/components/preact/Popover/Popover.js +7 -7
- package/dist/components/preact/SearchModal/components/SearchModal/SearchModal.js +1 -1
- package/dist/components/preact/SearchModal/hooks/useSearchAnalytics.js +1 -1
- package/dist/components/preact/index.js +1 -1
- package/package.json +2 -2
- package/packages/analytics/analytics.ts +28 -4
- package/packages/components/preact/AskNetlify/AskNetlify.css +24 -1
- package/packages/components/preact/AskNetlify/AskNetlify.tsx +9 -2
- package/packages/components/preact/AskNetlify/components/ActionBar.tsx +118 -0
- package/packages/components/preact/AskNetlify/components/ChatMessages.tsx +11 -1
- package/packages/components/preact/Icon/index.tsx +68 -0
- package/packages/components/preact/Popover/Popover.css +5 -10
- package/packages/components/preact/Popover/Popover.tsx +2 -2
- package/dist/chunks/analytics.Ch1vuuOl.js +0 -13
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
import { u as C } from "../../../chunks/jsxRuntime.module.Bzuv3cXw.js";
|
|
2
|
-
import { Fragment as
|
|
3
|
-
function
|
|
4
|
-
const
|
|
5
|
-
if (
|
|
2
|
+
import { Fragment as t } from "preact";
|
|
3
|
+
function S(L) {
|
|
4
|
+
const r = g[L.name];
|
|
5
|
+
if (r)
|
|
6
6
|
return /* @__PURE__ */ C(
|
|
7
7
|
"svg",
|
|
8
8
|
{
|
|
9
|
-
id: `icon-${
|
|
10
|
-
"data-icon":
|
|
9
|
+
id: `icon-${L.name}`,
|
|
10
|
+
"data-icon": L.name,
|
|
11
11
|
viewBox: "0 0 16 16",
|
|
12
12
|
fill: "none",
|
|
13
13
|
xmlns: "http://www.w3.org/2000/svg",
|
|
14
|
-
|
|
14
|
+
class: L.className,
|
|
15
|
+
...L,
|
|
15
16
|
children: [
|
|
16
|
-
/* @__PURE__ */ C(
|
|
17
|
+
/* @__PURE__ */ C(r, {}),
|
|
17
18
|
";"
|
|
18
19
|
]
|
|
19
20
|
}
|
|
20
21
|
);
|
|
21
22
|
}
|
|
22
|
-
const
|
|
23
|
+
const n = () => /* @__PURE__ */ C(t, { children: [
|
|
23
24
|
/* @__PURE__ */ C(
|
|
24
25
|
"path",
|
|
25
26
|
{
|
|
@@ -98,7 +99,7 @@ const l = () => /* @__PURE__ */ C(e, { children: [
|
|
|
98
99
|
fill: "var(--n-ask-netlify-eyelid-color, currentColor)"
|
|
99
100
|
}
|
|
100
101
|
)
|
|
101
|
-
] }),
|
|
102
|
+
] }), l = () => /* @__PURE__ */ C(
|
|
102
103
|
"path",
|
|
103
104
|
{
|
|
104
105
|
d: "M12.3756 6.68667C12.3756 7.94156 11.9681 9.10077 11.2818 10.0413L14.7436 13.5052C15.0855 13.8469 15.0855 14.4019 14.7436 14.7437C14.4018 15.0854 13.8467 15.0854 13.5049 14.7437L10.043 11.2797C9.10235 11.9687 7.94292 12.3733 6.68778 12.3733C3.54583 12.3733 1 9.828 1 6.68667C1 3.54533 3.54583 1 6.68778 1C9.82973 1 12.3756 3.54533 12.3756 6.68667ZM6.68778 10.6236C7.20488 10.6236 7.71692 10.5218 8.19467 10.3239C8.67241 10.1261 9.1065 9.83607 9.47215 9.47049C9.83779 9.10491 10.1278 8.67091 10.3257 8.19326C10.5236 7.71561 10.6255 7.20367 10.6255 6.68667C10.6255 6.16966 10.5236 5.65772 10.3257 5.18007C10.1278 4.70242 9.83779 4.26842 9.47215 3.90284C9.1065 3.53726 8.67241 3.24727 8.19467 3.04942C7.71692 2.85158 7.20488 2.74974 6.68778 2.74974C6.17067 2.74974 5.65863 2.85158 5.18089 3.04942C4.70315 3.24727 4.26906 3.53726 3.90341 3.90284C3.53776 4.26842 3.24771 4.70242 3.04982 5.18007C2.85194 5.65772 2.75009 6.16966 2.75009 6.68667C2.75009 7.20367 2.85194 7.71561 3.04982 8.19326C3.24771 8.67091 3.53776 9.10491 3.90341 9.47049C4.26906 9.83607 4.70315 10.1261 5.18089 10.3239C5.65863 10.5218 6.17067 10.6236 6.68778 10.6236Z",
|
|
@@ -110,25 +111,37 @@ const l = () => /* @__PURE__ */ C(e, { children: [
|
|
|
110
111
|
d: "M4.57143 1C3.15179 1 2 2.17578 2 3.625V12.375C2 13.8242 3.15179 15 4.57143 15H12.2857H13.1429C13.617 15 14 14.609 14 14.125C14 13.641 13.617 13.25 13.1429 13.25V11.5C13.617 11.5 14 11.109 14 10.625V1.875C14 1.39102 13.617 1 13.1429 1H12.2857H4.57143ZM4.57143 11.5H11.4286V13.25H4.57143C4.09732 13.25 3.71429 12.859 3.71429 12.375C3.71429 11.891 4.09732 11.5 4.57143 11.5ZM5.42857 4.9375C5.42857 4.69687 5.62143 4.5 5.85714 4.5H11C11.2357 4.5 11.4286 4.69687 11.4286 4.9375C11.4286 5.17813 11.2357 5.375 11 5.375H5.85714C5.62143 5.375 5.42857 5.17813 5.42857 4.9375ZM5.85714 6.25H11C11.2357 6.25 11.4286 6.44687 11.4286 6.6875C11.4286 6.92813 11.2357 7.125 11 7.125H5.85714C5.62143 7.125 5.42857 6.92813 5.42857 6.6875C5.42857 6.44687 5.62143 6.25 5.85714 6.25Z",
|
|
111
112
|
fill: "currentColor"
|
|
112
113
|
}
|
|
113
|
-
),
|
|
114
|
+
), e = () => /* @__PURE__ */ C(
|
|
114
115
|
"path",
|
|
115
116
|
{
|
|
116
117
|
d: "M11.7071 7.29399C12.0976 7.68448 12.0976 8.31864 11.7071 8.70914L5.70826 14.7071C5.31771 15.0976 4.68346 15.0976 4.29291 14.7071C3.90236 14.3166 3.90236 13.6825 4.29291 13.292L9.58563 8L4.29604 2.70802C3.90549 2.31753 3.90549 1.68336 4.29604 1.29287C4.68658 0.902376 5.32084 0.902376 5.71138 1.29287L11.7102 7.29086L11.7071 7.29399Z",
|
|
117
118
|
fill: "currentColor"
|
|
118
119
|
}
|
|
119
|
-
),
|
|
120
|
+
), c = () => /* @__PURE__ */ C(
|
|
120
121
|
"path",
|
|
121
122
|
{
|
|
122
123
|
d: "M0 4.57143C0 2.04286 2.04286 0 4.57143 0C37.4 0 64 26.6 64 59.4286C64 61.9571 61.9571 64 59.4286 64C56.9 64 54.8571 61.9571 54.8571 59.4286C54.8571 31.6571 32.3429 9.14286 4.57143 9.14286C2.04286 9.14286 0 7.1 0 4.57143ZM0 54.8571C0 52.4323 0.963263 50.1068 2.67788 48.3922C4.3925 46.6776 6.71802 45.7143 9.14286 45.7143C11.5677 45.7143 13.8932 46.6776 15.6078 48.3922C17.3225 50.1068 18.2857 52.4323 18.2857 54.8571C18.2857 57.282 17.3225 59.6075 15.6078 61.3221C13.8932 63.0367 11.5677 64 9.14286 64C6.71802 64 4.3925 63.0367 2.67788 61.3221C0.963263 59.6075 0 57.282 0 54.8571ZM4.57143 18.2857C27.3 18.2857 45.7143 36.7 45.7143 59.4286C45.7143 61.9571 43.6714 64 41.1429 64C38.6143 64 36.5714 61.9571 36.5714 59.4286C36.5714 41.7571 22.2429 27.4286 4.57143 27.4286C2.04286 27.4286 0 25.3857 0 22.8571C0 20.3286 2.04286 18.2857 4.57143 18.2857Z",
|
|
123
124
|
fill: "currentColor"
|
|
124
125
|
}
|
|
125
|
-
),
|
|
126
|
+
), i = () => /* @__PURE__ */ C(
|
|
127
|
+
"path",
|
|
128
|
+
{
|
|
129
|
+
d: "M15.5281 0.223937C16.0388 0.598824 16.1531 1.31976 15.7817 1.83523L6.63858 14.5237C6.44215 14.7977 6.13857 14.9671 5.80284 14.9959C5.46712 15.0248 5.14211 14.8986 4.90639 14.6607L0.334831 10.0467C-0.11161 9.59612 -0.11161 8.86437 0.334831 8.41378C0.781272 7.9632 1.50629 7.9632 1.95273 8.41378L5.57783 12.0725L13.9352 0.476265C14.3067 -0.0392051 15.021 -0.154555 15.5317 0.220332L15.5281 0.223937Z",
|
|
130
|
+
fill: "currentColor"
|
|
131
|
+
}
|
|
132
|
+
), u = () => /* @__PURE__ */ C(
|
|
126
133
|
"path",
|
|
127
134
|
{
|
|
128
135
|
d: "M15 7.57143C15 10.6491 11.8666 13.1429 8.00041 13.1429C6.98601 13.1429 6.02357 12.9714 5.15409 12.6634C4.82871 12.8964 4.29828 13.2152 3.66941 13.483C3.01319 13.7616 2.22301 14 1.43829 14C1.26056 14 1.10198 13.8955 1.03362 13.7348C0.965266 13.5741 1.00355 13.392 1.12658 13.2688L1.13479 13.2607C1.14299 13.2527 1.15393 13.242 1.17033 13.2232C1.20041 13.1911 1.24689 13.1402 1.30431 13.0705C1.41641 12.9366 1.56679 12.7384 1.71991 12.492C1.99333 12.0473 2.25308 11.4634 2.30503 10.8071C1.48477 9.89643 1.00081 8.77946 1.00081 7.57143C1.00081 4.49375 4.13422 2 8.00041 2C11.8666 2 15 4.49375 15 7.57143Z",
|
|
129
136
|
fill: "currentColor"
|
|
130
137
|
}
|
|
131
|
-
),
|
|
138
|
+
), H = () => /* @__PURE__ */ C(
|
|
139
|
+
"path",
|
|
140
|
+
{
|
|
141
|
+
d: "M12 10.5H6C5.725 10.5 5.5 10.275 5.5 10V2C5.5 1.725 5.725 1.5 6 1.5H10.1719C10.3031 1.5 10.4312 1.55312 10.525 1.64687L12.3531 3.475C12.4469 3.56875 12.5 3.69688 12.5 3.82812V10C12.5 10.275 12.275 10.5 12 10.5ZM6 12H12C13.1031 12 14 11.1031 14 10V3.82812C14 3.29688 13.7906 2.7875 13.4156 2.4125L11.5844 0.584375C11.2094 0.209375 10.7031 0 10.1719 0H6C4.89688 0 4 0.896875 4 2V10C4 11.1031 4.89688 12 6 12ZM2 4C0.896875 4 0 4.89688 0 6V14C0 15.1031 0.896875 16 2 16H8C9.10312 16 10 15.1031 10 14V13.5H8.5V14C8.5 14.275 8.275 14.5 8 14.5H2C1.725 14.5 1.5 14.275 1.5 14V6C1.5 5.725 1.725 5.5 2 5.5H2.5V4H2Z",
|
|
142
|
+
fill: "currentColor"
|
|
143
|
+
}
|
|
144
|
+
), d = () => /* @__PURE__ */ C(t, { children: [
|
|
132
145
|
/* @__PURE__ */ C(
|
|
133
146
|
"path",
|
|
134
147
|
{
|
|
@@ -145,31 +158,55 @@ const l = () => /* @__PURE__ */ C(e, { children: [
|
|
|
145
158
|
fill: "currentColor"
|
|
146
159
|
}
|
|
147
160
|
)
|
|
148
|
-
] }),
|
|
161
|
+
] }), a = () => /* @__PURE__ */ C(
|
|
149
162
|
"path",
|
|
150
163
|
{
|
|
151
164
|
d: "M58.0309 26.6159C63.6509 21.0179 63.6509 11.9435 58.0309 6.34543C52.6809 1.01633 44.0909 0.72746 38.3909 5.69797L37.7809 6.23586C36.7809 7.10246 36.6809 8.61652 37.5509 9.61262C38.4209 10.6087 39.9409 10.7083 40.9409 9.84172L41.5509 9.30383C45.3509 5.9968 51.0709 6.18605 54.6409 9.74211C58.3809 13.4675 58.3809 19.5138 54.6409 23.2491L43.3109 34.5249C39.5709 38.2503 33.4909 38.2503 29.7509 34.5249C26.1809 30.9689 25.9909 25.2712 29.3109 21.4861L29.7809 20.9482C30.6509 19.9521 30.5509 18.448 29.5509 17.5714C28.5509 16.6948 27.0409 16.8044 26.1609 17.8005L25.6909 18.3384C20.7109 24.0161 21.0009 32.5726 26.3509 37.9017C31.9709 43.4997 41.0809 43.4997 46.7009 37.9017L58.0309 26.6159ZM5.97086 24.3847C0.350859 29.9827 0.350859 39.0571 5.97086 44.6452C11.3309 49.9843 19.9209 50.2632 25.6209 45.2927L26.2309 44.7548C27.2309 43.8882 27.3309 42.3741 26.4609 41.378C25.5909 40.382 24.0709 40.2823 23.0709 41.1489L22.4609 41.6868C18.6609 44.9939 12.9409 44.8046 9.37086 41.2486C5.63086 37.5232 5.63086 31.4769 9.37086 27.7415L20.7009 16.4757C24.4409 12.7503 30.5109 12.7503 34.2609 16.4757C37.8309 20.0318 38.0209 25.7294 34.7009 29.5146L34.1609 30.1222C33.2909 31.1183 33.3909 32.6224 34.3909 33.4989C35.3909 34.3755 36.9009 34.2659 37.7809 33.2698L38.3209 32.6622C43.3109 26.9845 43.0209 18.428 37.6709 13.089C32.0509 7.49094 22.9409 7.49094 17.3209 13.089L5.97086 24.3847Z",
|
|
152
165
|
fill: "currentColor"
|
|
153
166
|
}
|
|
154
|
-
),
|
|
167
|
+
), h = () => /* @__PURE__ */ C(
|
|
155
168
|
"path",
|
|
156
169
|
{
|
|
157
170
|
d: "M49.8875 0.137732C48.3 -0.349768 46.625 0.525232 46.1375 2.11273L28.1375 60.1127C27.65 61.7002 28.525 63.3752 30.1125 63.8627C31.7 64.3502 33.375 63.4752 33.8625 61.8877L51.8625 3.88773C52.35 2.30023 51.475 0.625232 49.8875 0.137732ZM58.8125 14.9502C57.675 16.1627 57.7375 18.0627 58.95 19.1877L72.6125 32.0002L58.95 44.8127C57.7375 45.9502 57.675 47.8502 58.8125 49.0502C59.95 50.2502 61.85 50.3252 63.05 49.1877L79.05 34.1877C79.65 33.6252 80 32.8252 80 32.0002C80 31.1752 79.6625 30.3752 79.05 29.8127L63.05 14.8127C61.8375 13.6752 59.9375 13.7377 58.8125 14.9502ZM21.1875 14.9502C20.05 13.7377 18.15 13.6752 16.95 14.8127L0.95 29.8127C0.3375 30.3752 0 31.1752 0 32.0002C0 32.8252 0.3375 33.6252 0.95 34.1877L16.95 49.1877C18.1625 50.3252 20.0625 50.2627 21.1875 49.0502C22.3125 47.8377 22.2625 45.9377 21.05 44.8127L7.3875 32.0002L21.05 19.1877C22.2625 18.0502 22.325 16.1502 21.1875 14.9502Z",
|
|
158
171
|
fill: "currentColor"
|
|
159
172
|
}
|
|
160
|
-
),
|
|
173
|
+
), M = () => /* @__PURE__ */ C(
|
|
161
174
|
"path",
|
|
162
175
|
{
|
|
163
176
|
d: "M4.83333 1C3.82214 1 3 1.78477 3 2.75V13.25C3 14.2152 3.82214 15 4.83333 15H12.1667C13.1779 15 14 14.2152 14 13.25V5.375H10.3333C9.8263 5.375 9.41667 4.98398 9.41667 4.5V1H4.83333ZM10.3333 1V4.5H14L10.3333 1ZM6.20833 8H10.7917C11.0438 8 11.25 8.19687 11.25 8.4375C11.25 8.67813 11.0438 8.875 10.7917 8.875H6.20833C5.95625 8.875 5.75 8.67813 5.75 8.4375C5.75 8.19687 5.95625 8 6.20833 8ZM6.20833 9.75H10.7917C11.0438 9.75 11.25 9.94687 11.25 10.1875C11.25 10.4281 11.0438 10.625 10.7917 10.625H6.20833C5.95625 10.625 5.75 10.4281 5.75 10.1875C5.75 9.94687 5.95625 9.75 6.20833 9.75ZM6.20833 11.5H10.7917C11.0438 11.5 11.25 11.6969 11.25 11.9375C11.25 12.1781 11.0438 12.375 10.7917 12.375H6.20833C5.95625 12.375 5.75 12.1781 5.75 11.9375C5.75 11.6969 5.95625 11.5 6.20833 11.5Z",
|
|
164
177
|
fill: "currentColor"
|
|
165
178
|
}
|
|
166
|
-
),
|
|
179
|
+
), Z = () => /* @__PURE__ */ C(
|
|
167
180
|
"path",
|
|
168
181
|
{
|
|
169
182
|
d: "M0.787918 9.02542C-0.337082 7.80042 -0.249582 5.91292 0.962918 4.78792C2.17542 3.66292 4.07542 3.75042 5.20042 4.96292L28.2004 29.9629C29.2629 31.1129 29.2629 32.8754 28.2004 34.0254L5.20042 59.0254C4.07542 60.2504 2.17542 60.3254 0.962918 59.2004C-0.249582 58.0754 -0.337082 56.1754 0.787918 54.9629L21.9254 32.0004L0.787918 9.02542ZM31.0004 54.0004H69.0004C70.6629 54.0004 72.0004 55.3379 72.0004 57.0004C72.0004 58.6629 70.6629 60.0004 69.0004 60.0004H31.0004C29.3379 60.0004 28.0004 58.6629 28.0004 57.0004C28.0004 55.3379 29.3379 54.0004 31.0004 54.0004Z",
|
|
170
183
|
fill: "currentColor"
|
|
171
184
|
}
|
|
172
|
-
),
|
|
185
|
+
), s = () => /* @__PURE__ */ C(
|
|
186
|
+
"path",
|
|
187
|
+
{
|
|
188
|
+
d: "M12.0008 0L12.2474 0.0133305C13.4139 0.133305 14.3303 1.08643 14.3937 2.26951C14.9869 2.66276 15.3968 3.31595 15.4601 4.06579L15.4668 4.26575C15.4668 4.45571 15.4434 4.639 15.4001 4.81563C15.7401 5.19888 15.96 5.69211 15.9933 6.23865L16 6.39862C16 6.83852 15.88 7.2451 15.6734 7.59836C15.8367 7.8783 15.9467 8.1949 15.9833 8.53149L15.9967 8.7981C15.9967 10.0412 15.0535 11.0609 13.8438 11.1843L13.5972 11.1976H9.94126L10.4112 12.1974L10.5145 12.4506C10.9311 13.6404 10.4545 14.9668 9.37471 15.6166L9.13476 15.7466C7.88502 16.3331 6.412 15.8666 5.71548 14.7068L5.69548 14.6768L5.6055 14.5102L5.5855 14.4702L4.58238 12.3373C4.26911 12.9305 3.64924 13.3338 2.93272 13.3338H1.86628C0.836492 13.3338 0 12.4973 0 11.4675L0.00333259 3.99914C0.00333259 2.96936 0.839825 2.13287 1.86961 2.13287H2.93606C3.3493 2.13287 3.73256 2.26951 4.04249 2.49946C4.4824 1.78628 5.10894 1.18641 5.87544 0.779832L6.28202 0.563212L6.30535 0.553214L6.52531 0.44657L6.54864 0.436572L6.78525 0.336594C7.3418 0.116641 7.93501 0.00666513 8.53822 0.00666513L12.0008 0ZM8.53156 1.59965C8.13164 1.59965 7.73506 1.67631 7.3618 1.81961L7.20517 1.88626L7.02854 1.97291L6.62195 2.18953C5.64882 2.70608 5.01229 3.68587 4.93231 4.77564L4.92564 5.04225V8.80477L4.92897 8.9414C4.94564 9.21468 5.01229 9.48129 5.12893 9.73123L7.02187 13.7604L7.09186 13.887C7.3718 14.3436 7.95834 14.5235 8.45157 14.2936L8.54822 14.2403C8.98146 13.9803 9.17142 13.4504 9.00479 12.9739L8.9648 12.8739L7.95834 10.7344C7.8417 10.4877 7.8617 10.1978 8.00833 9.96452C8.15497 9.73123 8.40825 9.5946 8.68152 9.5946H13.5972L13.6772 9.59126C14.0537 9.5546 14.3537 9.25467 14.3903 8.87808L14.3937 8.79477C14.3937 8.55815 14.2904 8.34487 14.1204 8.1949C13.9471 8.0416 13.8471 7.82498 13.8471 7.59503C13.8471 7.36508 13.9471 7.14846 14.1204 6.99516C14.267 6.86518 14.367 6.68522 14.387 6.48527L14.3937 6.39529C14.3937 6.11535 14.247 5.8654 14.0204 5.7221C13.6638 5.49215 13.5472 5.02558 13.7538 4.65566C13.8038 4.56901 13.8371 4.46904 13.8504 4.36906L13.8571 4.26241C13.8571 3.90916 13.6272 3.60922 13.3039 3.50258C12.914 3.37594 12.6807 2.97269 12.7707 2.56945C12.7773 2.53945 12.7807 2.50946 12.784 2.4828L12.7907 2.39615C12.7907 1.98291 12.4741 1.64298 12.0708 1.60299L12.0008 1.59965H8.53156ZM1.86961 3.73253C1.72297 3.73253 1.603 3.8525 1.603 3.99914V11.4642C1.603 11.6108 1.72297 11.7308 1.86961 11.7308H2.93606C3.08269 11.7308 3.20267 11.6108 3.20267 11.4642V3.99914C3.20267 3.8525 3.08269 3.73253 2.93606 3.73253H1.86961Z",
|
|
189
|
+
fill: "currentColor"
|
|
190
|
+
}
|
|
191
|
+
), f = () => /* @__PURE__ */ C(
|
|
192
|
+
"path",
|
|
193
|
+
{
|
|
194
|
+
d: "M12.3871 0C13.2419 0 13.9355 0.695193 13.9355 1.55206C13.9355 1.75577 13.8935 1.94654 13.8258 2.12438C14.4839 2.30222 14.9677 2.90364 14.9677 3.62147C14.9677 3.91571 14.8839 4.19056 14.7419 4.4266C15.4581 4.56241 16 5.19293 16 5.94956C16 6.58655 15.6161 7.133 15.0677 7.37228C15.6161 7.61155 16 8.15801 16 8.795C16 9.65186 15.3065 10.3471 14.4516 10.3471H9.29032L10.2 12.6234C10.2806 12.8271 10.3226 13.047 10.3226 13.2669V13.4027C10.3226 14.2854 9.60968 15 8.72903 15C8.12581 15 7.57419 14.6573 7.30323 14.1173L5.4871 10.4861C5.27097 10.056 5.16129 9.58073 5.16129 9.09894V3.06532C5.16129 2.43803 5.44839 1.84307 5.93548 1.44859L6.32903 1.13494C7.24516 0.400949 8.38065 0 9.55161 0H12.3871ZM2.58065 2.06941C3.15161 2.06941 3.6129 2.5318 3.6129 3.10412V11.3818C3.6129 11.9541 3.15161 12.4165 2.58065 12.4165H1.03226C0.46129 12.4165 0 11.9541 0 11.3818V3.10412C0 2.5318 0.46129 2.06941 1.03226 2.06941H2.58065Z",
|
|
195
|
+
fill: "currentColor"
|
|
196
|
+
}
|
|
197
|
+
), V = () => /* @__PURE__ */ C(
|
|
198
|
+
"path",
|
|
199
|
+
{
|
|
200
|
+
d: "M5.72095 1.29317C6.41399 0.133424 7.88671 -0.333142 9.13619 0.253398L9.37609 0.380037C10.5356 1.07655 11.0021 2.54957 10.4157 3.7993L9.94586 4.79908H13.601L13.8476 4.81241C15.0571 4.93572 16 5.95883 16 7.19857C16 7.63847 15.8801 8.04505 15.6735 8.39831C15.8767 8.75157 15.9967 9.15814 16 9.59805C16 10.2079 15.7701 10.7578 15.4003 11.181C15.4436 11.3577 15.4669 11.541 15.4669 11.7309C15.4669 12.5674 15.0371 13.2973 14.394 13.7272C14.3307 14.9102 13.4144 15.8667 12.2482 15.9833L12.0017 15.9967H8.53311C7.93336 15.9967 7.33694 15.8834 6.78051 15.6667L6.54394 15.5668L6.52062 15.5568L6.30071 15.4501L6.27738 15.4401L5.87089 15.2235C5.46106 15.0069 5.09454 14.7336 4.77468 14.4203C4.63807 15.3168 3.86506 16 2.93211 16H1.86589C0.836318 16 0 15.1635 0 14.1337L0.00666392 6.66535C0.00666392 5.63557 0.842982 4.79908 1.87255 4.79908H2.93878C3.29863 4.79908 3.63515 4.9024 3.9217 5.08236L5.591 1.53312L5.611 1.49313L5.70096 1.3265L5.72095 1.29651V1.29317ZM1.87255 6.39874C1.72595 6.39874 1.606 6.51871 1.606 6.66535V14.1304C1.606 14.277 1.72595 14.397 1.87255 14.397H2.93878C3.08538 14.397 3.20533 14.277 3.20533 14.1304V6.66535C3.20533 6.51871 3.08538 6.39874 2.93878 6.39874H1.87255ZM8.45648 1.69975C7.96335 1.4698 7.38026 1.64643 7.10037 2.09967L7.02707 2.23297L5.13453 6.2621C5.01791 6.51205 4.95127 6.77866 4.93461 7.05193L4.93128 7.1919V10.9544L4.93794 11.2177C5.01791 12.3075 5.65098 13.2873 6.62724 13.8071L7.01041 14.0104L7.22032 14.1137C7.63349 14.3004 8.07997 14.397 8.53311 14.397H12.0017L12.0816 14.3937C12.4848 14.3537 12.8013 14.0104 12.8013 13.5972L12.7947 13.5105C12.7913 13.4805 12.788 13.4539 12.7813 13.4239C12.6914 13.0206 12.9246 12.6174 13.3145 12.4908C13.6377 12.3874 13.8676 12.0842 13.8676 11.7309C13.8676 11.5876 13.8309 11.4576 13.7643 11.3377C13.5544 10.9678 13.671 10.4979 14.0308 10.2712C14.2574 10.1279 14.404 9.87799 14.404 9.59805C14.404 9.36143 14.3007 9.14815 14.1308 8.99818C13.9575 8.84488 13.8576 8.62826 13.8576 8.39831C13.8576 8.16836 13.9575 7.95174 14.1308 7.79844C14.3007 7.64847 14.404 7.43518 14.404 7.19857L14.4007 7.11858C14.364 6.742 14.0641 6.44206 13.6876 6.40541L13.6077 6.40207H8.69305C8.41983 6.40207 8.1666 6.2621 8.01999 6.03215C7.87339 5.8022 7.85339 5.50893 7.97001 5.26232L8.9696 3.11945C9.20283 2.61955 9.01624 2.02968 8.5531 1.75307L8.45648 1.69975Z",
|
|
201
|
+
fill: "currentColor"
|
|
202
|
+
}
|
|
203
|
+
), p = () => /* @__PURE__ */ C(
|
|
204
|
+
"path",
|
|
205
|
+
{
|
|
206
|
+
d: "M2.58065 4.65517C3.15161 4.65517 3.6129 5.11746 3.6129 5.68965V13.9655C3.6129 14.5377 3.15161 15 2.58065 15H1.03226C0.46129 15 0 14.5377 0 13.9655V5.68965C0 5.11746 0.46129 4.65517 1.03226 4.65517H2.58065ZM8.72903 0C9.60968 0 10.3226 0.714439 10.3226 1.59698V1.73276C10.3226 1.95259 10.2806 2.17241 10.2 2.37608L9.29032 4.65517H14.4516C15.3065 4.65517 16 5.35022 16 6.2069C16 6.84375 15.6161 7.39009 15.0677 7.62931C15.6161 7.86853 16 8.41487 16 9.05172C16 9.80819 15.4581 10.4386 14.7419 10.5744C14.8839 10.8103 14.9677 11.0851 14.9677 11.3793C14.9677 12.097 14.4839 12.6983 13.8258 12.8761C13.8968 13.0539 13.9355 13.2478 13.9355 13.4483C13.9355 14.305 13.2419 15 12.3871 15H9.55161C8.38065 15 7.24194 14.5991 6.32903 13.8653L5.93548 13.5517C5.44516 13.1606 5.16129 12.5657 5.16129 11.9353V5.90302C5.16129 5.42134 5.27419 4.94612 5.4871 4.51616L7.3 0.882543C7.57097 0.342672 8.12258 0 8.72903 0Z",
|
|
207
|
+
fill: "currentColor"
|
|
208
|
+
}
|
|
209
|
+
), k = () => /* @__PURE__ */ C(
|
|
173
210
|
"path",
|
|
174
211
|
{
|
|
175
212
|
"fill-rule": "evenodd",
|
|
@@ -177,48 +214,54 @@ const l = () => /* @__PURE__ */ C(e, { children: [
|
|
|
177
214
|
d: "M15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1C11.866 1 15 4.13401 15 8ZM7.48998 7.58293C7.24532 7.9418 7.1073 8.36489 7.09243 8.80158L7.09232 9.00062C7.09232 9.21263 7.17498 9.41595 7.32211 9.56587C7.46924 9.71578 7.6688 9.8 7.87688 9.8C8.08495 9.8 8.28451 9.71578 8.43164 9.56587C8.57878 9.41595 8.66143 9.21263 8.66143 9.00062V8.8172C8.67459 8.68789 8.72283 8.56481 8.80083 8.46179C8.82284 8.43271 8.87624 8.39281 8.96482 8.34893C9.04677 8.30834 9.13665 8.27475 9.21483 8.24583L9.2194 8.24414L9.22961 8.24053L9.23662 8.2376C9.7635 8.01739 10.1981 7.61624 10.4651 7.10372C10.7321 6.5912 10.8149 5.99957 10.6987 5.43153L10.6962 5.42197C10.5641 4.91215 10.2876 4.45323 9.90133 4.10235C9.51593 3.7523 9.03819 3.52522 8.52737 3.44924C8.1077 3.37054 7.67619 3.38633 7.26312 3.49553C6.849 3.605 6.46349 3.80568 6.13376 4.08342C5.58181 4.54443 5.25866 5.23048 5.25 5.95706V5.95934C5.25 6.17135 5.33266 6.37468 5.47979 6.52459C5.62692 6.6745 5.82648 6.75872 6.03456 6.75872C6.24264 6.75872 6.44219 6.6745 6.58933 6.52459C6.73595 6.37519 6.81855 6.17275 6.81911 5.96153C6.82486 5.70702 6.94287 5.46722 7.13988 5.30865C7.29566 5.18188 7.47721 5.09021 7.67067 5.04112C7.86413 4.99203 8.06566 4.98632 8.26159 5.02383L8.2716 5.02518C8.47683 5.05273 8.67003 5.13962 8.82831 5.27556C8.98372 5.40903 9.09909 5.5843 9.16133 5.78128C9.23237 6.20988 8.99652 6.63061 8.59639 6.78484L8.59136 6.78696C8.22065 6.94277 7.74615 7.20718 7.48998 7.58293ZM7.87406 12.6C8.42636 12.6 8.8741 12.1523 8.8741 11.6C8.8741 11.0477 8.42636 10.6 7.87406 10.6C7.32175 10.6 6.87402 11.0477 6.87402 11.6C6.87402 12.1523 7.32175 12.6 7.87406 12.6Z",
|
|
178
215
|
fill: "currentColor"
|
|
179
216
|
}
|
|
180
|
-
),
|
|
217
|
+
), m = () => /* @__PURE__ */ C(
|
|
181
218
|
"path",
|
|
182
219
|
{
|
|
183
220
|
d: "M59.4286 0H4.55714C2.04286 0 0 2.07143 0 4.61429V59.3857C0 61.9286 2.04286 64 4.55714 64H59.4286C61.9429 64 64 61.9286 64 59.3857V4.61429C64 2.07143 61.9429 0 59.4286 0ZM19.3429 54.8571H9.85714V24.3143H19.3571V54.8571H19.3429ZM14.6 20.1429C11.5571 20.1429 9.1 17.6714 9.1 14.6429C9.1 11.6143 11.5571 9.14286 14.6 9.14286C17.6286 9.14286 20.1 11.6143 20.1 14.6429C20.1 17.6857 17.6429 20.1429 14.6 20.1429ZM54.9 54.8571H45.4143V40C45.4143 36.4571 45.3429 31.9 40.4857 31.9C35.5429 31.9 34.7857 35.7571 34.7857 39.7429V54.8571H25.3V24.3143H34.4V28.4857H34.5286C35.8 26.0857 38.9 23.5571 43.5143 23.5571C53.1143 23.5571 54.9 29.8857 54.9 38.1143V54.8571Z",
|
|
184
221
|
fill: "currentColor"
|
|
185
222
|
}
|
|
186
|
-
),
|
|
223
|
+
), y = () => /* @__PURE__ */ C(
|
|
187
224
|
"path",
|
|
188
225
|
{
|
|
189
226
|
d: "M48.6496 6H57.4746L38.1996 28.025L60.8746 58H43.1246L29.2121 39.825L13.3121 58H4.47461L25.0871 34.4375L3.34961 6H21.5496L34.1121 22.6125L48.6496 6ZM45.5496 52.725H50.4371L18.8871 11H13.6371L45.5496 52.725Z",
|
|
190
227
|
fill: "currentColor"
|
|
191
228
|
}
|
|
192
|
-
),
|
|
229
|
+
), I = () => /* @__PURE__ */ C(
|
|
193
230
|
"path",
|
|
194
231
|
{
|
|
195
232
|
d: "M13.975 7.77494C21.275 13.2374 29.125 24.3374 32 30.2999C34.875 24.3499 42.725 13.2499 50.025 7.77494C55.2875 3.82494 63.8125 0.77494 63.8125 10.4999C63.8125 12.4374 62.7 26.8124 62.05 29.1499C59.775 37.2499 51.5 39.3249 44.1375 38.0624C57 40.2499 60.275 47.4999 53.2 54.7499C39.775 68.5249 33.9125 51.2999 32.4125 46.8874C32.2 46.2749 32.0875 45.9124 32 45.9124C31.9125 45.9124 31.8 46.2874 31.5875 46.8874C30.0875 51.2999 24.2125 68.5249 10.8 54.7499C3.7375 47.4999 7 40.2499 19.8625 38.0624C12.5 39.3249 4.225 37.2499 1.9625 29.1374C1.3 26.7999 0.1875 12.4249 0.1875 10.4874C0.1875 0.76244 8.7125 3.81244 13.975 7.76244V7.77494Z",
|
|
196
233
|
fill: "currentColor"
|
|
197
234
|
}
|
|
198
|
-
),
|
|
235
|
+
), b = () => /* @__PURE__ */ C(
|
|
199
236
|
"path",
|
|
200
237
|
{
|
|
201
238
|
d: "M61.0785 13.8158C60.3785 11.1773 58.3229 9.10664 55.7118 8.40527C50.9785 7.125 32.0007 7.125 32.0007 7.125C32.0007 7.125 13.0229 7.125 8.28958 8.40527C5.67847 9.10664 3.62292 11.1773 2.92292 13.8158C1.65625 18.5918 1.65625 28.5445 1.65625 28.5445C1.65625 28.5445 1.65625 38.4973 2.92292 43.2732C3.62292 45.9117 5.67847 47.8934 8.28958 48.5947C13.0229 49.875 32.0007 49.875 32.0007 49.875C32.0007 49.875 50.9785 49.875 55.7118 48.5947C58.3229 47.8934 60.3785 45.9006 61.0785 43.2732C62.3451 38.4973 62.3451 28.5445 62.3451 28.5445C62.3451 28.5445 62.3451 18.5918 61.0785 13.8158ZM25.8007 37.5844V19.5047L41.6563 28.5445L25.8007 37.5844Z",
|
|
202
239
|
fill: "currentColor"
|
|
203
240
|
}
|
|
204
|
-
),
|
|
205
|
-
askNetlify:
|
|
241
|
+
), g = {
|
|
242
|
+
askNetlify: n,
|
|
206
243
|
book: o,
|
|
207
|
-
caretRight:
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
244
|
+
caretRight: e,
|
|
245
|
+
check: i,
|
|
246
|
+
code: h,
|
|
247
|
+
comment: u,
|
|
248
|
+
copy: H,
|
|
249
|
+
link: a,
|
|
250
|
+
lightbulb: d,
|
|
251
|
+
pageWithLines: M,
|
|
252
|
+
rss: c,
|
|
253
|
+
search: l,
|
|
254
|
+
terminal: Z,
|
|
255
|
+
thumbsDown: s,
|
|
256
|
+
thumbsDownSolid: f,
|
|
257
|
+
thumbsUp: V,
|
|
258
|
+
thumbsUpSolid: p,
|
|
259
|
+
question: k,
|
|
260
|
+
bluesky: I,
|
|
261
|
+
linkedin: m,
|
|
262
|
+
twitter: y,
|
|
263
|
+
youtube: b
|
|
221
264
|
};
|
|
222
265
|
export {
|
|
223
|
-
|
|
266
|
+
S as default
|
|
224
267
|
};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { u as r } from "../../../chunks/jsxRuntime.module.Bzuv3cXw.js";
|
|
2
|
-
import { g as
|
|
2
|
+
import { g as d } from "../../../chunks/hooks.module.DGkdD5n9.js";
|
|
3
3
|
import '../../../assets/Popover.css';const v = ({
|
|
4
4
|
id: e,
|
|
5
|
-
content:
|
|
6
|
-
position:
|
|
5
|
+
content: p,
|
|
6
|
+
position: t = "top",
|
|
7
7
|
class: n = "",
|
|
8
8
|
children: s,
|
|
9
9
|
...i
|
|
10
10
|
}) => {
|
|
11
|
-
const
|
|
12
|
-
return /* @__PURE__ */ r("div", { id: o, class: `n-popover-container n-popover-${
|
|
13
|
-
/* @__PURE__ */ r("
|
|
11
|
+
const a = d(), o = e || a;
|
|
12
|
+
return /* @__PURE__ */ r("div", { id: o, class: `n-popover-container n-popover-${t} ${n}`, ...i, children: [
|
|
13
|
+
/* @__PURE__ */ r("span", { class: "n-popover-trigger", "aria-describedby": `${o}-popover`, children: s }),
|
|
14
14
|
/* @__PURE__ */ r(
|
|
15
15
|
"div",
|
|
16
16
|
{
|
|
17
17
|
id: `${o}-popover`,
|
|
18
18
|
class: "n-popover",
|
|
19
19
|
role: "tooltip",
|
|
20
|
-
dangerouslySetInnerHTML: { __html:
|
|
20
|
+
dangerouslySetInnerHTML: { __html: p }
|
|
21
21
|
}
|
|
22
22
|
)
|
|
23
23
|
] });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { u as e } from "../../../../../chunks/jsxRuntime.module.Bzuv3cXw.js";
|
|
2
2
|
import { A as g, y as f, d } from "../../../../../chunks/hooks.module.DGkdD5n9.js";
|
|
3
|
-
import { A as K, K as L } from "../../../../../chunks/AskNetlify.
|
|
3
|
+
import { A as K, K as L } from "../../../../../chunks/AskNetlify.BYFTesUF.js";
|
|
4
4
|
import P from "../../../Modal/Modal.js";
|
|
5
5
|
import h from "../../../KeyboardKey/KeyboardKey.js";
|
|
6
6
|
import M from "../SearchWindow.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { A as y, y as h, q as d } from "../../../../chunks/hooks.module.DGkdD5n9.js";
|
|
2
|
-
import { A as T } from "../../../../chunks/analytics.
|
|
2
|
+
import { A as T } from "../../../../chunks/analytics.D_dJH08O.js";
|
|
3
3
|
function A(r, l) {
|
|
4
4
|
const n = y(new T()).current, e = (c) => c.debug_mode = !0;
|
|
5
5
|
return h(() => {
|
|
@@ -4,7 +4,7 @@ import { default as m } from "./Icon/index.js";
|
|
|
4
4
|
import { default as s } from "./SearchModal/components/SearchLink/SearchLink.js";
|
|
5
5
|
import { default as u } from "./SearchModal/components/SearchHeading/SearchHeading.js";
|
|
6
6
|
import { default as i } from "./SearchModal/components/SearchToggle/SearchToggle.js";
|
|
7
|
-
import { A as S } from "../../chunks/AskNetlify.
|
|
7
|
+
import { A as S } from "../../chunks/AskNetlify.BYFTesUF.js";
|
|
8
8
|
import "preact";
|
|
9
9
|
import "../../chunks/hooks.module.DGkdD5n9.js";
|
|
10
10
|
import { default as n } from "./SearchModal/components/SearchModal/SearchModal.js";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/spark-ui",
|
|
3
3
|
"description": "Assets, design tokens, components, and utilities",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.18.0-alpha.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/components/preact/index.js",
|
|
7
7
|
"types": "dist/components/preact/index.d.ts",
|
|
@@ -68,4 +68,4 @@
|
|
|
68
68
|
"prettier": "^3.5.3",
|
|
69
69
|
"prettier-plugin-astro": "^0.14.1"
|
|
70
70
|
}
|
|
71
|
-
}
|
|
71
|
+
}
|
|
@@ -1,16 +1,40 @@
|
|
|
1
1
|
export default class Analytics {
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
|
-
* Pushes an event payload into
|
|
3
|
+
* Pushes an event payload into both Google Analytics (gtag) and Segment.
|
|
5
4
|
* @param eventName e.g. 'www:search_new_query'
|
|
6
5
|
* @param payload additional key/value data
|
|
7
6
|
*/
|
|
8
7
|
track(eventName: string, payload: Record<string, any> = {}): void {
|
|
9
|
-
//
|
|
8
|
+
// Track with Google Analytics (gtag)
|
|
10
9
|
if (typeof gtag === 'function') {
|
|
11
10
|
gtag('event', eventName, { ...payload });
|
|
12
11
|
} else {
|
|
13
12
|
console.error(`gtag is not defined. Event [${eventName}] failed.`);
|
|
14
13
|
}
|
|
14
|
+
|
|
15
|
+
// Track with Segment
|
|
16
|
+
if (typeof window !== 'undefined' && window.analytics) {
|
|
17
|
+
try {
|
|
18
|
+
window.analytics.track(eventName, payload);
|
|
19
|
+
} catch (error) {
|
|
20
|
+
console.error(`Segment track failed for event [${eventName}]:`, error);
|
|
21
|
+
}
|
|
22
|
+
} else {
|
|
23
|
+
console.warn(`Segment analytics is not loaded. Event [${eventName}] not sent to Segment.`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
declare global {
|
|
29
|
+
interface Window {
|
|
30
|
+
analytics: {
|
|
31
|
+
track: (
|
|
32
|
+
event: string,
|
|
33
|
+
properties?: Record<string, any>,
|
|
34
|
+
options?: Record<string, any>,
|
|
35
|
+
callback?: () => void
|
|
36
|
+
) => void;
|
|
37
|
+
};
|
|
15
38
|
}
|
|
16
|
-
|
|
39
|
+
function gtag(...args: any[]): void;
|
|
40
|
+
}
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
.n-ask-sources {
|
|
124
|
-
margin-block-start: var(--space-
|
|
124
|
+
margin-block-start: var(--space-xs);
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
.n-ask-sources-title {
|
|
@@ -168,6 +168,29 @@
|
|
|
168
168
|
transform: rotate(270deg);
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
+
.n-ask-action-bar {
|
|
172
|
+
margin-block-start: var(--space-m);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.n-ask-action-bar button {
|
|
176
|
+
display: grid;
|
|
177
|
+
border: none;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.n-ask-action-bar button svg {
|
|
181
|
+
pointer-events: none;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.n-ask-action-bar .n-popover {
|
|
185
|
+
--n-popover-padding: var(--space-3xs) var(--space-2xs);
|
|
186
|
+
--n-popover-bottom: 125%;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.n-ask-action-bar [id*='icon-'] {
|
|
190
|
+
width: auto;
|
|
191
|
+
height: 1rem;
|
|
192
|
+
}
|
|
193
|
+
|
|
171
194
|
/* ----------------------------- */
|
|
172
195
|
/* Form UI */
|
|
173
196
|
/* ----------------------------- */
|
|
@@ -23,8 +23,14 @@ export default function AskNetlify({ setModalState, searchQuery, urlParamQuery }
|
|
|
23
23
|
const inputRef = useRef<HTMLInputElement>(null);
|
|
24
24
|
const lastMessageRef = useRef<HTMLDivElement | null>(null);
|
|
25
25
|
|
|
26
|
-
const {
|
|
27
|
-
|
|
26
|
+
const {
|
|
27
|
+
conversation,
|
|
28
|
+
submitQuery,
|
|
29
|
+
isGeneratingAnswer,
|
|
30
|
+
isPreparingAnswer,
|
|
31
|
+
stopGeneration,
|
|
32
|
+
addFeedback,
|
|
33
|
+
} = useChat();
|
|
28
34
|
|
|
29
35
|
const handleSubmit = (e: Event | preact.JSX.TargetedMouseEvent<HTMLButtonElement>) => {
|
|
30
36
|
e.preventDefault();
|
|
@@ -78,6 +84,7 @@ export default function AskNetlify({ setModalState, searchQuery, urlParamQuery }
|
|
|
78
84
|
isPreparingAnswer={isPreparingAnswer}
|
|
79
85
|
conversation={conversation}
|
|
80
86
|
lastMessageRef={lastMessageRef}
|
|
87
|
+
addFeedback={addFeedback}
|
|
81
88
|
/>
|
|
82
89
|
)}
|
|
83
90
|
</div>
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import Icon from '@components/preact/Icon';
|
|
2
|
+
import Popover from '@components/preact/Popover/Popover';
|
|
3
|
+
import Analytics from '@analtyics/analytics';
|
|
4
|
+
interface ActionBarProps {
|
|
5
|
+
answer: string;
|
|
6
|
+
questionAnswerId: string;
|
|
7
|
+
addFeedback: (id: string, type: string, meta?: object) => void;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const toggleFeedbackButton = (e: MouseEvent): void => {
|
|
11
|
+
const btn = (e.target as HTMLElement).closest('button');
|
|
12
|
+
if (!btn) return;
|
|
13
|
+
|
|
14
|
+
const isHelpfulBtn = btn.classList.contains('btn-feedback-helpful');
|
|
15
|
+
const isIncorrectBtn = btn.classList.contains('btn-feedback-incorrect');
|
|
16
|
+
|
|
17
|
+
// Only proceed if it's one of the feedback buttons
|
|
18
|
+
if (!isHelpfulBtn && !isIncorrectBtn) return;
|
|
19
|
+
|
|
20
|
+
// Get both feedback buttons
|
|
21
|
+
const actionBar = btn.closest('.n-ask-action-bar');
|
|
22
|
+
const helpfulBtn = actionBar?.querySelector('.btn-feedback-helpful');
|
|
23
|
+
const incorrectBtn = actionBar?.querySelector('.btn-feedback-incorrect');
|
|
24
|
+
|
|
25
|
+
// Reset both buttons first (hide all solid icons, show all outline icons)
|
|
26
|
+
[helpfulBtn, incorrectBtn].forEach(button => {
|
|
27
|
+
if (!button) return;
|
|
28
|
+
const icons = button.querySelectorAll('[id*="icon"]');
|
|
29
|
+
icons.forEach((icon, index) => {
|
|
30
|
+
if (index === 0) {
|
|
31
|
+
icon.classList.remove('hidden'); // Show outline
|
|
32
|
+
} else {
|
|
33
|
+
icon.classList.add('hidden'); // Hide solid
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
// Toggle the clicked button
|
|
39
|
+
const clickedIcons = btn.querySelectorAll('[id*="icon"]');
|
|
40
|
+
clickedIcons.forEach(icon => {
|
|
41
|
+
icon.classList.toggle('hidden');
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const copyToClipboard = async (text: string): Promise<void> => {
|
|
46
|
+
const copyPopover = document.getElementById('copy-popover');
|
|
47
|
+
try {
|
|
48
|
+
await navigator.clipboard.writeText(text);
|
|
49
|
+
if (copyPopover) {
|
|
50
|
+
copyPopover.textContent = 'Copied';
|
|
51
|
+
setTimeout(() => {
|
|
52
|
+
copyPopover.textContent = 'Copy';
|
|
53
|
+
copyPopover.blur();
|
|
54
|
+
}, 2000);
|
|
55
|
+
}
|
|
56
|
+
} catch (error) {
|
|
57
|
+
console.error('Failed to copy code: ', error);
|
|
58
|
+
if (copyPopover) {
|
|
59
|
+
copyPopover.textContent = 'Failed to copy';
|
|
60
|
+
setTimeout(() => {
|
|
61
|
+
copyPopover.textContent = 'Copy';
|
|
62
|
+
copyPopover.blur();
|
|
63
|
+
}, 2000);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export function ActionBar({ answer, questionAnswerId, addFeedback }: ActionBarProps) {
|
|
69
|
+
const analytics = new Analytics();
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<div className="n-ask-action-bar">
|
|
73
|
+
<Popover id="copy" content={`Copy`}>
|
|
74
|
+
<button
|
|
75
|
+
onClick={() => {
|
|
76
|
+
copyToClipboard(answer);
|
|
77
|
+
analytics.track('ask:copy_answer', { id: questionAnswerId });
|
|
78
|
+
}}
|
|
79
|
+
>
|
|
80
|
+
<Icon name="copy" />
|
|
81
|
+
</button>
|
|
82
|
+
</Popover>
|
|
83
|
+
|
|
84
|
+
<Popover id="feedback-helpful" content={`Helpful`}>
|
|
85
|
+
<button
|
|
86
|
+
class="btn-feedback-helpful n-stack"
|
|
87
|
+
onClick={e => {
|
|
88
|
+
toggleFeedbackButton(e as unknown as MouseEvent);
|
|
89
|
+
addFeedback(questionAnswerId, 'upvote');
|
|
90
|
+
analytics.track('ask:feedback_helpful', { id: questionAnswerId });
|
|
91
|
+
}}
|
|
92
|
+
>
|
|
93
|
+
<Icon name="thumbsUp" />
|
|
94
|
+
<Icon name="thumbsUpSolid" className="hidden" />
|
|
95
|
+
</button>
|
|
96
|
+
</Popover>
|
|
97
|
+
|
|
98
|
+
<Popover id="feedback-incorrect" content={`Not helpful`}>
|
|
99
|
+
<button
|
|
100
|
+
class="btn-feedback-incorrect n-stack"
|
|
101
|
+
onClick={e => {
|
|
102
|
+
toggleFeedbackButton(e as unknown as MouseEvent);
|
|
103
|
+
addFeedback(questionAnswerId, 'downvote', {
|
|
104
|
+
incorrect: true,
|
|
105
|
+
irrelevant: false,
|
|
106
|
+
unaddressed: false,
|
|
107
|
+
issue: "This information isn't accurate",
|
|
108
|
+
});
|
|
109
|
+
analytics.track('ask:feedback_not_helpful', { id: questionAnswerId });
|
|
110
|
+
}}
|
|
111
|
+
>
|
|
112
|
+
<Icon name="thumbsDown" />
|
|
113
|
+
<Icon name="thumbsDownSolid" className="hidden" />
|
|
114
|
+
</button>
|
|
115
|
+
</Popover>
|
|
116
|
+
</div>
|
|
117
|
+
);
|
|
118
|
+
}
|
|
@@ -2,15 +2,18 @@ import { marked } from 'marked';
|
|
|
2
2
|
import Icon from '../../Icon';
|
|
3
3
|
import { Ref } from 'preact';
|
|
4
4
|
import { SourcesList } from './SourcesList';
|
|
5
|
+
import { ActionBar } from './ActionBar';
|
|
5
6
|
|
|
6
7
|
export function ChatMessages({
|
|
7
8
|
conversation,
|
|
8
9
|
lastMessageRef,
|
|
9
10
|
isPreparingAnswer,
|
|
11
|
+
addFeedback,
|
|
10
12
|
}: {
|
|
11
13
|
conversation: any[];
|
|
12
14
|
lastMessageRef: Ref<HTMLDivElement>;
|
|
13
15
|
isPreparingAnswer: boolean;
|
|
16
|
+
addFeedback: any;
|
|
14
17
|
}) {
|
|
15
18
|
return (
|
|
16
19
|
<>
|
|
@@ -29,11 +32,18 @@ export function ChatMessages({
|
|
|
29
32
|
|
|
30
33
|
<div class="n-ask-message-left">
|
|
31
34
|
{qa.answer && (
|
|
32
|
-
<div class="n-ask-message-bubble n-ask-bot-message">
|
|
35
|
+
<div class="n-ask-message-bubble n-ask-bot-message flow">
|
|
33
36
|
<div
|
|
34
37
|
class="n-ask-message-answer n-ask-prose prose flow"
|
|
35
38
|
dangerouslySetInnerHTML={{ __html: marked.parse(qa.answer) }}
|
|
36
39
|
/>
|
|
40
|
+
{qa.id && (
|
|
41
|
+
<ActionBar
|
|
42
|
+
answer={qa.answer}
|
|
43
|
+
addFeedback={addFeedback}
|
|
44
|
+
questionAnswerId={qa.id}
|
|
45
|
+
/>
|
|
46
|
+
)}
|
|
37
47
|
{qa.id && <SourcesList sources={qa.sources} />}
|
|
38
48
|
</div>
|
|
39
49
|
)}
|