@aigentyc/chat-sdk 0.2.3 → 0.2.5
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/bin/aigentyc.mjs +45 -0
- package/bin/lib/add.mjs +267 -0
- package/bin/{doctor.mjs → lib/doctor.mjs} +2 -11
- package/bin/lib/io.mjs +59 -0
- package/context7.json +1 -1
- package/dist/{chunk-2677FDTG.js → chunk-FOZXDUSZ.js} +3 -3
- package/dist/{chunk-2677FDTG.js.map → chunk-FOZXDUSZ.js.map} +1 -1
- package/dist/{chunk-UKEL7FWS.js → chunk-IU7Q7O5G.js} +3 -2
- package/dist/chunk-IU7Q7O5G.js.map +1 -0
- package/dist/{chunk-WQARQ2FJ.cjs → chunk-MC6QDYB6.cjs} +4 -4
- package/dist/{chunk-WQARQ2FJ.cjs.map → chunk-MC6QDYB6.cjs.map} +1 -1
- package/dist/{chunk-7BNYTOTE.cjs → chunk-P3RPAI4F.cjs} +3 -2
- package/dist/chunk-P3RPAI4F.cjs.map +1 -0
- package/dist/components.cjs +13 -13
- package/dist/components.js +3 -3
- package/dist/hooks.cjs +2 -2
- package/dist/hooks.js +1 -1
- package/dist/index.cjs +11 -11
- package/dist/index.js +3 -3
- package/dist/theme.cjs +3 -3
- package/dist/theme.js +1 -1
- package/package.json +5 -3
- package/dist/chunk-7BNYTOTE.cjs.map +0 -1
- package/dist/chunk-UKEL7FWS.js.map +0 -1
|
@@ -19,6 +19,7 @@ function themeToCSSVars(theme) {
|
|
|
19
19
|
"--ac-border": theme.borderColor,
|
|
20
20
|
"--ac-placeholder": theme.placeholderColor,
|
|
21
21
|
"--ac-font-family": theme.fontFamily,
|
|
22
|
+
"--ac-font-sans": theme.fontFamily,
|
|
22
23
|
"--ac-heading-font-family": theme.headingFontFamily,
|
|
23
24
|
"--ac-border-radius": theme.borderRadius,
|
|
24
25
|
"--ac-assistant-bubble-padding": theme.assistantBubblePadding,
|
|
@@ -60,5 +61,5 @@ function useTheme() {
|
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
export { ThemeProvider, useTheme };
|
|
63
|
-
//# sourceMappingURL=chunk-
|
|
64
|
-
//# sourceMappingURL=chunk-
|
|
64
|
+
//# sourceMappingURL=chunk-IU7Q7O5G.js.map
|
|
65
|
+
//# sourceMappingURL=chunk-IU7Q7O5G.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/providers/ThemeProvider.tsx"],"names":[],"mappings":";;;;AA8CA,IAAM,YAAA,GAAe,cAAwC,IAAI,CAAA;AAUjE,SAAS,eAAe,KAAA,EAAmC;AACzD,EAAA,MAAM,IAAA,GAA2C;AAAA,IAC/C,gBAAgB,KAAA,CAAM,YAAA;AAAA,IACtB,eAAe,KAAA,CAAM,WAAA;AAAA,IACrB,mBAAmB,KAAA,CAAM,eAAA;AAAA,IACzB,aAAa,KAAA,CAAM,SAAA;AAAA,IACnB,aAAa,KAAA,CAAM,SAAA;AAAA,IACnB,eAAe,KAAA,CAAM,WAAA;AAAA,IACrB,oBAAoB,KAAA,CAAM,eAAA;AAAA,IAC1B,yBAAyB,KAAA,CAAM,oBAAA;AAAA,IAC/B,8BAA8B,KAAA,CAAM,wBAAA;AAAA,IACpC,kBAAkB,KAAA,CAAM,cAAA;AAAA,IACxB,eAAe,KAAA,CAAM,WAAA;AAAA,IACrB,oBAAoB,KAAA,CAAM,gBAAA;AAAA,IAC1B,oBAAoB,KAAA,CAAM,UAAA;AAAA,IAC1B,kBAAkB,KAAA,CAAM,UAAA;AAAA,IACxB,4BAA4B,KAAA,CAAM,iBAAA;AAAA,IAClC,sBAAsB,KAAA,CAAM,YAAA;AAAA,IAC5B,iCAAiC,KAAA,CAAM,sBAAA;AAAA,IACvC,4BAA4B,KAAA,CAAM;AAAA,GACpC;AAGA,EAAA,MAAM,QAAgC,EAAC;AACvC,EAAA,KAAA,MAAW,CAAC,GAAA,EAAK,KAAK,KAAK,MAAA,CAAO,OAAA,CAAQ,IA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A,EAChE;AACA,EAAA,OAAO,GAAA;AACT","file":"chunk-IU7Q7O5G.js","sourcesContent":["\"use client\";\n\nimport {\n createContext,\n useContext,\n useState,\n useMemo,\n type ReactNode,\n type CSSProperties,\n} from \"react\";\nimport { useI18n } from \"./I18nProvider\";\n\n/**\n * Theme configuration for the chat widget.\n */\nexport interface ThemeConfig {\n primaryColor?: string;\n accentColor?: string;\n backgroundColor?: string;\n textColor?: string;\n linkColor?: string;\n loaderColor?: string;\n userBubbleColor?: string;\n assistantBubbleColor?: string;\n assistantBubbleTextColor?: string;\n secondaryColor?: string;\n borderColor?: string;\n placeholderColor?: string;\n fontFamily?: string;\n headingFontFamily?: string;\n borderRadius?: string;\n assistantBubblePadding?: string;\n assistantMaxWidth?: string;\n /** Arbitrary CSS custom properties (key must start with `--`). */\n customProperties?: Record<string, string>;\n}\n\ninterface ThemeContextValue {\n /** Current theme configuration. */\n theme: ThemeConfig;\n /** Update the theme at runtime. */\n setTheme: (theme: ThemeConfig) => void;\n /** Current text direction derived from language. */\n direction: \"ltr\" | \"rtl\";\n}\n\nconst ThemeContext = createContext<ThemeContextValue | null>(null);\n\n/** Props for the ThemeProvider component. */\nexport interface ThemeProviderProps {\n /** Theme configuration. */\n theme?: ThemeConfig;\n children: ReactNode;\n}\n\n/** Map a ThemeConfig to CSS custom properties. */\nfunction themeToCSSVars(theme: ThemeConfig): CSSProperties {\n const vars: Record<string, string | undefined> = {\n \"--ac-primary\": theme.primaryColor,\n \"--ac-accent\": theme.accentColor,\n \"--ac-background\": theme.backgroundColor,\n \"--ac-text\": theme.textColor,\n \"--ac-link\": theme.linkColor,\n \"--ac-loader\": theme.loaderColor,\n \"--ac-user-bubble\": theme.userBubbleColor,\n \"--ac-assistant-bubble\": theme.assistantBubbleColor,\n \"--ac-assistant-bubble-text\": theme.assistantBubbleTextColor,\n \"--ac-secondary\": theme.secondaryColor,\n \"--ac-border\": theme.borderColor,\n \"--ac-placeholder\": theme.placeholderColor,\n \"--ac-font-family\": theme.fontFamily,\n \"--ac-font-sans\": theme.fontFamily,\n \"--ac-heading-font-family\": theme.headingFontFamily,\n \"--ac-border-radius\": theme.borderRadius,\n \"--ac-assistant-bubble-padding\": theme.assistantBubblePadding,\n \"--ac-assistant-max-width\": theme.assistantMaxWidth,\n };\n\n // Strip undefined values\n const style: Record<string, string> = {};\n for (const [key, value] of Object.entries(vars)) {\n if (value !== undefined) {\n style[key] = value;\n }\n }\n\n // Merge arbitrary custom properties\n if (theme.customProperties) {\n for (const [key, value] of Object.entries(theme.customProperties)) {\n style[key] = value;\n }\n }\n\n return style as CSSProperties;\n}\n\n/**\n * Provides theme context and renders a wrapper `<div data-aigentyc-chat>`\n * that sets CSS custom properties for styling.\n * Reads direction from I18nProvider.\n */\nexport function ThemeProvider({\n theme: initialTheme = {},\n children,\n}: ThemeProviderProps) {\n const [theme, setTheme] = useState<ThemeConfig>(initialTheme);\n const i18n = useI18n();\n const direction = i18n.direction;\n\n const cssVars = useMemo(() => themeToCSSVars(theme), [theme]);\n\n const value = useMemo<ThemeContextValue>(\n () => ({ theme, setTheme, direction }),\n [theme, direction]\n );\n\n return (\n <ThemeContext.Provider value={value}>\n <div data-aigentyc-chat=\"\" dir={direction} style={cssVars}>\n {children}\n </div>\n </ThemeContext.Provider>\n );\n}\n\n/**\n * Returns the current theme configuration and `setTheme` updater.\n * Must be used within a `ThemeProvider`.\n */\nexport function useTheme(): ThemeContextValue {\n const ctx = useContext(ThemeContext);\n if (!ctx) {\n throw new Error(\"useTheme must be used within a ThemeProvider\");\n }\n return ctx;\n}\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var chunkNYQSM3EB_cjs = require('./chunk-NYQSM3EB.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunkP3RPAI4F_cjs = require('./chunk-P3RPAI4F.cjs');
|
|
6
6
|
var chunkRTVEBPAJ_cjs = require('./chunk-RTVEBPAJ.cjs');
|
|
7
7
|
var chunk3MP2EGEJ_cjs = require('./chunk-3MP2EGEJ.cjs');
|
|
8
8
|
var chunkDMGYQ6NN_cjs = require('./chunk-DMGYQ6NN.cjs');
|
|
@@ -795,7 +795,7 @@ function ChatInterface(props) {
|
|
|
795
795
|
const { showSources = false } = props;
|
|
796
796
|
const { messages, status, sendMessage, sessionId, config, clearMessages } = chunkJ2K7EJYP_cjs.useChatContext();
|
|
797
797
|
const { t, direction } = chunk3MP2EGEJ_cjs.useI18n();
|
|
798
|
-
|
|
798
|
+
chunkP3RPAI4F_cjs.useTheme();
|
|
799
799
|
const slots = chunkJ2K7EJYP_cjs.useSlots();
|
|
800
800
|
let liveChat = null;
|
|
801
801
|
try {
|
|
@@ -1687,5 +1687,5 @@ exports.MobileLiveChatDrawer = MobileLiveChatDrawer;
|
|
|
1687
1687
|
exports.PreviewEmbedPanel = PreviewEmbedPanel;
|
|
1688
1688
|
exports.QuickQuestions = QuickQuestions;
|
|
1689
1689
|
exports.WelcomePage = WelcomePage;
|
|
1690
|
-
//# sourceMappingURL=chunk-
|
|
1691
|
-
//# sourceMappingURL=chunk-
|
|
1690
|
+
//# sourceMappingURL=chunk-MC6QDYB6.cjs.map
|
|
1691
|
+
//# sourceMappingURL=chunk-MC6QDYB6.cjs.map
|