@wallavi/widget 1.12.5 → 1.12.6
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/index.js +71 -15
- package/dist/index.mjs +71 -15
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3040,6 +3040,20 @@ function computeRelevanceScore(item, keywords, pageUrl) {
|
|
|
3040
3040
|
score += 20;
|
|
3041
3041
|
}
|
|
3042
3042
|
}
|
|
3043
|
+
if (item.keywords) {
|
|
3044
|
+
const allItemKeywords = [
|
|
3045
|
+
...item.keywords.en || [],
|
|
3046
|
+
...item.keywords.es || [],
|
|
3047
|
+
...item.keywords.fr || []
|
|
3048
|
+
].map(
|
|
3049
|
+
(k) => k.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "")
|
|
3050
|
+
);
|
|
3051
|
+
for (const keyword of keywords) {
|
|
3052
|
+
if (allItemKeywords.includes(keyword)) {
|
|
3053
|
+
score += 45;
|
|
3054
|
+
}
|
|
3055
|
+
}
|
|
3056
|
+
}
|
|
3043
3057
|
return score;
|
|
3044
3058
|
}
|
|
3045
3059
|
var STAGGER_MS = 50;
|
|
@@ -3211,7 +3225,13 @@ function CommandPanel({
|
|
|
3211
3225
|
locale
|
|
3212
3226
|
}) {
|
|
3213
3227
|
const relevantDocs = react.useMemo(() => {
|
|
3214
|
-
const keywords = getContextKeywords(
|
|
3228
|
+
const keywords = getContextKeywords(
|
|
3229
|
+
pageUrl,
|
|
3230
|
+
pageTitle,
|
|
3231
|
+
pageParams,
|
|
3232
|
+
pageVars,
|
|
3233
|
+
metadata
|
|
3234
|
+
);
|
|
3215
3235
|
const scored = ragDocuments.map((doc) => ({
|
|
3216
3236
|
...doc,
|
|
3217
3237
|
score: computeRelevanceScore(doc, keywords, pageUrl)
|
|
@@ -3219,7 +3239,13 @@ function CommandPanel({
|
|
|
3219
3239
|
return scored.sort((a, b) => b.score - a.score).slice(0, 5);
|
|
3220
3240
|
}, [ragDocuments, pageUrl, pageTitle, pageParams, pageVars, metadata]);
|
|
3221
3241
|
const topicQuestions = react.useMemo(() => {
|
|
3222
|
-
const keywords = getContextKeywords(
|
|
3242
|
+
const keywords = getContextKeywords(
|
|
3243
|
+
pageUrl,
|
|
3244
|
+
pageTitle,
|
|
3245
|
+
pageParams,
|
|
3246
|
+
pageVars,
|
|
3247
|
+
metadata
|
|
3248
|
+
);
|
|
3223
3249
|
const scored = ragTopics.map((topic) => ({
|
|
3224
3250
|
...topic,
|
|
3225
3251
|
score: computeRelevanceScore(topic, keywords),
|
|
@@ -3228,7 +3254,13 @@ function CommandPanel({
|
|
|
3228
3254
|
return scored.sort((a, b) => b.score - a.score).slice(0, 5);
|
|
3229
3255
|
}, [ragTopics, pageUrl, pageTitle, pageParams, pageVars, metadata, locale]);
|
|
3230
3256
|
const sortedActions = react.useMemo(() => {
|
|
3231
|
-
const keywords = getContextKeywords(
|
|
3257
|
+
const keywords = getContextKeywords(
|
|
3258
|
+
pageUrl,
|
|
3259
|
+
pageTitle,
|
|
3260
|
+
pageParams,
|
|
3261
|
+
pageVars,
|
|
3262
|
+
metadata
|
|
3263
|
+
);
|
|
3232
3264
|
const scored = clientActions.map((action) => ({
|
|
3233
3265
|
...action,
|
|
3234
3266
|
score: computeRelevanceScore(action, keywords)
|
|
@@ -3563,7 +3595,9 @@ function ChatWidget({
|
|
|
3563
3595
|
variants.push(word.slice(0, -2));
|
|
3564
3596
|
}
|
|
3565
3597
|
}
|
|
3566
|
-
return variants.some(
|
|
3598
|
+
return variants.some(
|
|
3599
|
+
(variant) => name.includes(variant) || desc.includes(variant)
|
|
3600
|
+
);
|
|
3567
3601
|
});
|
|
3568
3602
|
});
|
|
3569
3603
|
}, [clientActions, query, showQuickActions]);
|
|
@@ -3582,7 +3616,9 @@ function ChatWidget({
|
|
|
3582
3616
|
setActiveActionIndex((prev) => (prev + 1) % matchingActions.length);
|
|
3583
3617
|
} else if (e.key === "ArrowUp") {
|
|
3584
3618
|
e.preventDefault();
|
|
3585
|
-
setActiveActionIndex(
|
|
3619
|
+
setActiveActionIndex(
|
|
3620
|
+
(prev) => (prev - 1 + matchingActions.length) % matchingActions.length
|
|
3621
|
+
);
|
|
3586
3622
|
} else if (e.key === "Enter") {
|
|
3587
3623
|
e.preventDefault();
|
|
3588
3624
|
const selectedAction = matchingActions[activeActionIndex];
|
|
@@ -3800,7 +3836,17 @@ function ChatWidget({
|
|
|
3800
3836
|
matchingActions.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ww-absolute ww-bottom-[72px] ww-left-4 ww-right-4 ww-bg-background/90 ww-backdrop-blur-md ww-border ww-border-border ww-rounded-xl ww-shadow-xl ww-z-50 ww-overflow-hidden ww-flex ww-flex-col ww-max-h-[220px] ww-animate-in ww-fade-in ww-slide-in-from-bottom-2 ww-duration-200", children: [
|
|
3801
3837
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ww-px-3 ww-py-2 ww-bg-muted/40 ww-border-b ww-border-border/60 ww-flex ww-items-center ww-justify-between", children: [
|
|
3802
3838
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "ww-text-[10px] ww-font-bold ww-text-muted-foreground/80 ww-uppercase ww-tracking-wider ww-flex ww-items-center ww-gap-1.5", children: [
|
|
3803
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3839
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3840
|
+
"svg",
|
|
3841
|
+
{
|
|
3842
|
+
className: "ww-w-3 ww-h-3 ww-text-amber-500",
|
|
3843
|
+
viewBox: "0 0 24 24",
|
|
3844
|
+
fill: "none",
|
|
3845
|
+
stroke: "currentColor",
|
|
3846
|
+
strokeWidth: "2.5",
|
|
3847
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M13 2L3 14h9l-1 8 10-12h-9l1-8z" })
|
|
3848
|
+
}
|
|
3849
|
+
),
|
|
3804
3850
|
locale === "es" ? "Acciones R\xE1pidas Disponibles" : "Available Quick Actions"
|
|
3805
3851
|
] }),
|
|
3806
3852
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "ww-text-[9px] ww-text-muted-foreground/80", children: locale === "es" ? "\u2191\u2193 para mover, Enter para ejecutar" : "\u2191\u2193 to navigate, Enter to run" })
|
|
@@ -3819,18 +3865,28 @@ function ChatWidget({
|
|
|
3819
3865
|
isSelected ? "ww-bg-muted/90 ww-border-primary/20 ww-shadow-sm ww-scale-[0.99]" : "hover:ww-bg-muted/40"
|
|
3820
3866
|
),
|
|
3821
3867
|
children: [
|
|
3822
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3823
|
-
"
|
|
3868
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "ww-shrink-0 ww-w-6 ww-h-6 ww-rounded-md ww-flex ww-items-center ww-justify-center ww-bg-amber-500/10 ww-text-amber-500", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3869
|
+
"svg",
|
|
3824
3870
|
{
|
|
3825
|
-
className: "ww-
|
|
3826
|
-
|
|
3871
|
+
className: "ww-w-3.5 ww-h-3.5",
|
|
3872
|
+
viewBox: "0 0 24 24",
|
|
3873
|
+
fill: "none",
|
|
3874
|
+
stroke: "currentColor",
|
|
3875
|
+
strokeWidth: "2.5",
|
|
3876
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M13 2L3 14h9l-1 8 10-12h-9l1-8z" })
|
|
3827
3877
|
}
|
|
3828
|
-
),
|
|
3878
|
+
) }),
|
|
3829
3879
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ww-flex-1 ww-min-w-0", children: [
|
|
3830
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3831
|
-
"
|
|
3832
|
-
|
|
3833
|
-
|
|
3880
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3881
|
+
"span",
|
|
3882
|
+
{
|
|
3883
|
+
className: cn(
|
|
3884
|
+
"ww-text-[12px] ww-font-medium ww-block ww-truncate",
|
|
3885
|
+
isSelected ? "ww-text-foreground ww-font-semibold" : "ww-text-foreground/90"
|
|
3886
|
+
),
|
|
3887
|
+
children: action.name
|
|
3888
|
+
}
|
|
3889
|
+
),
|
|
3834
3890
|
action.description && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ww-text-[10px] ww-block ww-truncate ww-text-muted-foreground", children: action.description })
|
|
3835
3891
|
] }),
|
|
3836
3892
|
isSelected && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ww-shrink-0 ww-text-[10px] ww-font-mono ww-bg-background ww-border ww-border-border ww-text-muted-foreground ww-px-1.5 ww-py-0.5 ww-rounded-md ww-self-center ww-opacity-90", children: "ENTER" })
|
package/dist/index.mjs
CHANGED
|
@@ -3014,6 +3014,20 @@ function computeRelevanceScore(item, keywords, pageUrl) {
|
|
|
3014
3014
|
score += 20;
|
|
3015
3015
|
}
|
|
3016
3016
|
}
|
|
3017
|
+
if (item.keywords) {
|
|
3018
|
+
const allItemKeywords = [
|
|
3019
|
+
...item.keywords.en || [],
|
|
3020
|
+
...item.keywords.es || [],
|
|
3021
|
+
...item.keywords.fr || []
|
|
3022
|
+
].map(
|
|
3023
|
+
(k) => k.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "")
|
|
3024
|
+
);
|
|
3025
|
+
for (const keyword of keywords) {
|
|
3026
|
+
if (allItemKeywords.includes(keyword)) {
|
|
3027
|
+
score += 45;
|
|
3028
|
+
}
|
|
3029
|
+
}
|
|
3030
|
+
}
|
|
3017
3031
|
return score;
|
|
3018
3032
|
}
|
|
3019
3033
|
var STAGGER_MS = 50;
|
|
@@ -3185,7 +3199,13 @@ function CommandPanel({
|
|
|
3185
3199
|
locale
|
|
3186
3200
|
}) {
|
|
3187
3201
|
const relevantDocs = useMemo(() => {
|
|
3188
|
-
const keywords = getContextKeywords(
|
|
3202
|
+
const keywords = getContextKeywords(
|
|
3203
|
+
pageUrl,
|
|
3204
|
+
pageTitle,
|
|
3205
|
+
pageParams,
|
|
3206
|
+
pageVars,
|
|
3207
|
+
metadata
|
|
3208
|
+
);
|
|
3189
3209
|
const scored = ragDocuments.map((doc) => ({
|
|
3190
3210
|
...doc,
|
|
3191
3211
|
score: computeRelevanceScore(doc, keywords, pageUrl)
|
|
@@ -3193,7 +3213,13 @@ function CommandPanel({
|
|
|
3193
3213
|
return scored.sort((a, b) => b.score - a.score).slice(0, 5);
|
|
3194
3214
|
}, [ragDocuments, pageUrl, pageTitle, pageParams, pageVars, metadata]);
|
|
3195
3215
|
const topicQuestions = useMemo(() => {
|
|
3196
|
-
const keywords = getContextKeywords(
|
|
3216
|
+
const keywords = getContextKeywords(
|
|
3217
|
+
pageUrl,
|
|
3218
|
+
pageTitle,
|
|
3219
|
+
pageParams,
|
|
3220
|
+
pageVars,
|
|
3221
|
+
metadata
|
|
3222
|
+
);
|
|
3197
3223
|
const scored = ragTopics.map((topic) => ({
|
|
3198
3224
|
...topic,
|
|
3199
3225
|
score: computeRelevanceScore(topic, keywords),
|
|
@@ -3202,7 +3228,13 @@ function CommandPanel({
|
|
|
3202
3228
|
return scored.sort((a, b) => b.score - a.score).slice(0, 5);
|
|
3203
3229
|
}, [ragTopics, pageUrl, pageTitle, pageParams, pageVars, metadata, locale]);
|
|
3204
3230
|
const sortedActions = useMemo(() => {
|
|
3205
|
-
const keywords = getContextKeywords(
|
|
3231
|
+
const keywords = getContextKeywords(
|
|
3232
|
+
pageUrl,
|
|
3233
|
+
pageTitle,
|
|
3234
|
+
pageParams,
|
|
3235
|
+
pageVars,
|
|
3236
|
+
metadata
|
|
3237
|
+
);
|
|
3206
3238
|
const scored = clientActions.map((action) => ({
|
|
3207
3239
|
...action,
|
|
3208
3240
|
score: computeRelevanceScore(action, keywords)
|
|
@@ -3537,7 +3569,9 @@ function ChatWidget({
|
|
|
3537
3569
|
variants.push(word.slice(0, -2));
|
|
3538
3570
|
}
|
|
3539
3571
|
}
|
|
3540
|
-
return variants.some(
|
|
3572
|
+
return variants.some(
|
|
3573
|
+
(variant) => name.includes(variant) || desc.includes(variant)
|
|
3574
|
+
);
|
|
3541
3575
|
});
|
|
3542
3576
|
});
|
|
3543
3577
|
}, [clientActions, query, showQuickActions]);
|
|
@@ -3556,7 +3590,9 @@ function ChatWidget({
|
|
|
3556
3590
|
setActiveActionIndex((prev) => (prev + 1) % matchingActions.length);
|
|
3557
3591
|
} else if (e.key === "ArrowUp") {
|
|
3558
3592
|
e.preventDefault();
|
|
3559
|
-
setActiveActionIndex(
|
|
3593
|
+
setActiveActionIndex(
|
|
3594
|
+
(prev) => (prev - 1 + matchingActions.length) % matchingActions.length
|
|
3595
|
+
);
|
|
3560
3596
|
} else if (e.key === "Enter") {
|
|
3561
3597
|
e.preventDefault();
|
|
3562
3598
|
const selectedAction = matchingActions[activeActionIndex];
|
|
@@ -3774,7 +3810,17 @@ function ChatWidget({
|
|
|
3774
3810
|
matchingActions.length > 0 && /* @__PURE__ */ jsxs("div", { className: "ww-absolute ww-bottom-[72px] ww-left-4 ww-right-4 ww-bg-background/90 ww-backdrop-blur-md ww-border ww-border-border ww-rounded-xl ww-shadow-xl ww-z-50 ww-overflow-hidden ww-flex ww-flex-col ww-max-h-[220px] ww-animate-in ww-fade-in ww-slide-in-from-bottom-2 ww-duration-200", children: [
|
|
3775
3811
|
/* @__PURE__ */ jsxs("div", { className: "ww-px-3 ww-py-2 ww-bg-muted/40 ww-border-b ww-border-border/60 ww-flex ww-items-center ww-justify-between", children: [
|
|
3776
3812
|
/* @__PURE__ */ jsxs("span", { className: "ww-text-[10px] ww-font-bold ww-text-muted-foreground/80 ww-uppercase ww-tracking-wider ww-flex ww-items-center ww-gap-1.5", children: [
|
|
3777
|
-
/* @__PURE__ */ jsx(
|
|
3813
|
+
/* @__PURE__ */ jsx(
|
|
3814
|
+
"svg",
|
|
3815
|
+
{
|
|
3816
|
+
className: "ww-w-3 ww-h-3 ww-text-amber-500",
|
|
3817
|
+
viewBox: "0 0 24 24",
|
|
3818
|
+
fill: "none",
|
|
3819
|
+
stroke: "currentColor",
|
|
3820
|
+
strokeWidth: "2.5",
|
|
3821
|
+
children: /* @__PURE__ */ jsx("path", { d: "M13 2L3 14h9l-1 8 10-12h-9l1-8z" })
|
|
3822
|
+
}
|
|
3823
|
+
),
|
|
3778
3824
|
locale === "es" ? "Acciones R\xE1pidas Disponibles" : "Available Quick Actions"
|
|
3779
3825
|
] }),
|
|
3780
3826
|
/* @__PURE__ */ jsx("span", { className: "ww-text-[9px] ww-text-muted-foreground/80", children: locale === "es" ? "\u2191\u2193 para mover, Enter para ejecutar" : "\u2191\u2193 to navigate, Enter to run" })
|
|
@@ -3793,18 +3839,28 @@ function ChatWidget({
|
|
|
3793
3839
|
isSelected ? "ww-bg-muted/90 ww-border-primary/20 ww-shadow-sm ww-scale-[0.99]" : "hover:ww-bg-muted/40"
|
|
3794
3840
|
),
|
|
3795
3841
|
children: [
|
|
3796
|
-
/* @__PURE__ */ jsx(
|
|
3797
|
-
"
|
|
3842
|
+
/* @__PURE__ */ jsx("div", { className: "ww-shrink-0 ww-w-6 ww-h-6 ww-rounded-md ww-flex ww-items-center ww-justify-center ww-bg-amber-500/10 ww-text-amber-500", children: /* @__PURE__ */ jsx(
|
|
3843
|
+
"svg",
|
|
3798
3844
|
{
|
|
3799
|
-
className: "ww-
|
|
3800
|
-
|
|
3845
|
+
className: "ww-w-3.5 ww-h-3.5",
|
|
3846
|
+
viewBox: "0 0 24 24",
|
|
3847
|
+
fill: "none",
|
|
3848
|
+
stroke: "currentColor",
|
|
3849
|
+
strokeWidth: "2.5",
|
|
3850
|
+
children: /* @__PURE__ */ jsx("path", { d: "M13 2L3 14h9l-1 8 10-12h-9l1-8z" })
|
|
3801
3851
|
}
|
|
3802
|
-
),
|
|
3852
|
+
) }),
|
|
3803
3853
|
/* @__PURE__ */ jsxs("div", { className: "ww-flex-1 ww-min-w-0", children: [
|
|
3804
|
-
/* @__PURE__ */ jsx(
|
|
3805
|
-
"
|
|
3806
|
-
|
|
3807
|
-
|
|
3854
|
+
/* @__PURE__ */ jsx(
|
|
3855
|
+
"span",
|
|
3856
|
+
{
|
|
3857
|
+
className: cn(
|
|
3858
|
+
"ww-text-[12px] ww-font-medium ww-block ww-truncate",
|
|
3859
|
+
isSelected ? "ww-text-foreground ww-font-semibold" : "ww-text-foreground/90"
|
|
3860
|
+
),
|
|
3861
|
+
children: action.name
|
|
3862
|
+
}
|
|
3863
|
+
),
|
|
3808
3864
|
action.description && /* @__PURE__ */ jsx("span", { className: "ww-text-[10px] ww-block ww-truncate ww-text-muted-foreground", children: action.description })
|
|
3809
3865
|
] }),
|
|
3810
3866
|
isSelected && /* @__PURE__ */ jsx("span", { className: "ww-shrink-0 ww-text-[10px] ww-font-mono ww-bg-background ww-border ww-border-border ww-text-muted-foreground ww-px-1.5 ww-py-0.5 ww-rounded-md ww-self-center ww-opacity-90", children: "ENTER" })
|
package/package.json
CHANGED
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
"private": false,
|
|
44
44
|
"types": "./dist/index.d.ts",
|
|
45
|
-
"version": "1.12.
|
|
45
|
+
"version": "1.12.6",
|
|
46
46
|
"scripts": {
|
|
47
47
|
"build": "tsup && pnpm build:css",
|
|
48
48
|
"build:css": "tailwindcss -i ./src/styles.css -o ./dist/styles.css --config tailwind.config.cjs --minify",
|