@smart-cloud/ai-kit-ui 1.5.0 → 1.5.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smart-cloud/ai-kit-ui",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -22,8 +22,8 @@
22
22
  "@emotion/cache": "^11.14.0",
23
23
  "@emotion/react": "^11.14.0",
24
24
  "@mantine/colors-generator": "^8.3.18",
25
- "@smart-cloud/ai-kit-core": "^1.5.0",
26
- "@smart-cloud/wpsuite-core": "^2.3.0",
25
+ "@smart-cloud/ai-kit-core": "^1.5.1",
26
+ "@smart-cloud/wpsuite-core": "^2.3.1",
27
27
  "@tabler/icons-react": "^3.44.0",
28
28
  "chroma-js": "^3.2.0",
29
29
  "country-flag-icons": "^1.6.17",
@@ -43,7 +43,7 @@
43
43
  "@mantine/core": "^8.3.18",
44
44
  "@mantine/hooks": "^8.3.18",
45
45
  "@mantine/modals": "^8.3.18",
46
- "@wordpress/data": "^10.46.0",
46
+ "@wordpress/data": "^10.47.0",
47
47
  "aws-amplify": "^6.17.0",
48
48
  "react": "^18.3.1",
49
49
  "react-dom": "^18.3.1"
@@ -57,19 +57,19 @@
57
57
  "@types/jquery": "^4.0.0",
58
58
  "@types/react": "^18.3.23",
59
59
  "@types/react-dom": "^18.3.7",
60
- "@typescript-eslint/eslint-plugin": "^8.59.4",
61
- "@typescript-eslint/parser": "^8.59.4",
62
- "@wordpress/data": "^10.46.0",
60
+ "@typescript-eslint/eslint-plugin": "^8.60.0",
61
+ "@typescript-eslint/parser": "^8.60.0",
62
+ "@wordpress/data": "^10.47.0",
63
63
  "ajv": "^8.20.0",
64
64
  "aws-amplify": "^6.17.0",
65
- "eslint": "^10.4.0",
65
+ "eslint": "^10.4.1",
66
66
  "globals": "^17.6.0",
67
67
  "jquery": "^4.0.0",
68
68
  "react": "^18.3.1",
69
69
  "react-dom": "^18.3.1",
70
70
  "tsup": "^8.5.1",
71
71
  "typescript": "^6.0.3",
72
- "typescript-eslint": "^8.59.4"
72
+ "typescript-eslint": "^8.60.0"
73
73
  },
74
74
  "exports": {
75
75
  ".": {
@@ -563,8 +563,14 @@ const AiChatbotBase: FC<AiChatbotProps & AiKitShellInjectedProps> = (props) => {
563
563
  }, [question, isChatBusy, composerAudio]);
564
564
 
565
565
  const openButtonLabel = useMemo(() => {
566
- const raw = openButtonTitle ? openButtonTitle : labels.askMeLabel;
567
- return I18n.get(raw);
566
+ const resolvedOpenButtonTitle = openButtonTitle?.trim();
567
+ const resolvedAskMeLabel = labels.askMeLabel?.trim();
568
+ const raw =
569
+ resolvedOpenButtonTitle ||
570
+ resolvedAskMeLabel ||
571
+ DEFAULT_CHATBOT_LABELS.askMeLabel;
572
+ const translated = I18n.get(raw).trim();
573
+ return translated || I18n.get(DEFAULT_CHATBOT_LABELS.askMeLabel);
568
574
  }, [openButtonTitle, labels.askMeLabel, language]);
569
575
 
570
576
  const modalTitle = useMemo(() => {
@@ -1424,6 +1424,8 @@ Follow these additional instructions: ${instructions}`
1424
1424
  };
1425
1425
  }, [close, variation]);
1426
1426
 
1427
+ const openButtonAccessibleLabel = I18n.get(openButtonTitle || defaultTitle);
1428
+
1427
1429
  return (
1428
1430
  <>
1429
1431
  {showOpenButton && (
@@ -1444,6 +1446,7 @@ Follow these additional instructions: ${instructions}`
1444
1446
  variant={"filled"}
1445
1447
  disabled={featureOpen}
1446
1448
  onClick={() => setFeatureOpen(true)}
1449
+ aria-label={openButtonAccessibleLabel}
1447
1450
  data-ai-kit-open-button
1448
1451
  >
1449
1452
  {showOpenButtonTitle && I18n.get(openButtonTitle || defaultTitle)}
@@ -271,6 +271,9 @@ const DocSearchBase: FC<Props> = (props) => {
271
271
  return I18n.get(title || "Search with AI-Kit");
272
272
  }, [language]);
273
273
 
274
+ const openButtonAccessibleLabel = I18n.get(openButtonTitle || defaultTitle);
275
+ const searchButtonAccessibleLabel = I18n.get("Search");
276
+
274
277
  const statusText = useMemo(() => {
275
278
  const e: AiKitStatusEvent | null = statusEvent;
276
279
  if (!e) return null;
@@ -690,6 +693,7 @@ const DocSearchBase: FC<Props> = (props) => {
690
693
  variant={"filled"}
691
694
  disabled={featureOpen}
692
695
  onClick={() => setFeatureOpen(true)}
696
+ aria-label={openButtonAccessibleLabel}
693
697
  data-ai-kit-open-button
694
698
  >
695
699
  {showOpenButtonTitle && I18n.get(openButtonTitle || defaultTitle)}
@@ -851,6 +855,7 @@ const DocSearchBase: FC<Props> = (props) => {
851
855
  leftSection={buttonLeftIcon}
852
856
  onClick={() => void onSearch()}
853
857
  disabled={!canSearch}
858
+ aria-label={searchButtonAccessibleLabel}
854
859
  className={
855
860
  showSearchButtonTitle
856
861
  ? "doc-search-button"
@@ -96,18 +96,26 @@ export function withAiKitShell<P extends object>(
96
96
  }, [currentLanguage, direction, directionInStore, directionOverride]);
97
97
 
98
98
  const stylesheets = useMemo(
99
- () => [
100
- (
101
- WpSuite as never as {
102
- constants: { aiKit: { mantineCssHref: string } };
103
- }
104
- )?.constants?.aiKit?.mantineCssHref,
105
- (
106
- WpSuite as never as {
107
- constants: { aiKit: { aiKitUiCssHref: string } };
108
- }
109
- )?.constants?.aiKit?.aiKitUiCssHref,
110
- ],
99
+ () =>
100
+ [
101
+ (
102
+ WpSuite as never as {
103
+ constants: { aiKit: { mantineCssHref: string } };
104
+ }
105
+ )?.constants?.aiKit?.mantineCssHref,
106
+ (
107
+ WpSuite as never as {
108
+ constants: { aiKit: { aiKitUiCssHref: string } };
109
+ }
110
+ )?.constants?.aiKit?.aiKitUiCssHref,
111
+ (
112
+ WpSuite as never as {
113
+ constants: { aiKit: { wpsuiteThemeCssHref?: string } };
114
+ }
115
+ )?.constants?.aiKit?.wpsuiteThemeCssHref,
116
+ ].filter(
117
+ (href): href is string => typeof href === "string" && href.length > 0,
118
+ ),
111
119
  [WpSuite],
112
120
  );
113
121