@aigentyc/chat-sdk 0.2.3 → 0.2.4
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} +1 -10
- 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
|
@@ -21,6 +21,7 @@ function themeToCSSVars(theme) {
|
|
|
21
21
|
"--ac-border": theme.borderColor,
|
|
22
22
|
"--ac-placeholder": theme.placeholderColor,
|
|
23
23
|
"--ac-font-family": theme.fontFamily,
|
|
24
|
+
"--ac-font-sans": theme.fontFamily,
|
|
24
25
|
"--ac-heading-font-family": theme.headingFontFamily,
|
|
25
26
|
"--ac-border-radius": theme.borderRadius,
|
|
26
27
|
"--ac-assistant-bubble-padding": theme.assistantBubblePadding,
|
|
@@ -63,5 +64,5 @@ function useTheme() {
|
|
|
63
64
|
|
|
64
65
|
exports.ThemeProvider = ThemeProvider;
|
|
65
66
|
exports.useTheme = useTheme;
|
|
66
|
-
//# sourceMappingURL=chunk-
|
|
67
|
-
//# sourceMappingURL=chunk-
|
|
67
|
+
//# sourceMappingURL=chunk-P3RPAI4F.cjs.map
|
|
68
|
+
//# sourceMappingURL=chunk-P3RPAI4F.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/providers/ThemeProvider.tsx"],"names":["createContext","useState","useI18n","useMemo","jsx","useContext"],"mappings":";;;;;;AA8CA,IAAM,YAAA,GAAeA,oBAAwC,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,C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,CAAC,GAAA,EAAK;AACR,IAAA,MAAM,IAAI,MAAM,8CAA8C,CAAA;AAAA,EAChE;AACA,EAAA,OAAO,GAAA;AACT","file":"chunk-P3RPAI4F.cjs","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"]}
|
package/dist/components.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var chunkMC6QDYB6_cjs = require('./chunk-MC6QDYB6.cjs');
|
|
5
5
|
require('./chunk-NYQSM3EB.cjs');
|
|
6
|
-
require('./chunk-
|
|
6
|
+
require('./chunk-P3RPAI4F.cjs');
|
|
7
7
|
require('./chunk-RTVEBPAJ.cjs');
|
|
8
8
|
require('./chunk-X7R334SB.cjs');
|
|
9
9
|
var chunk3MP2EGEJ_cjs = require('./chunk-3MP2EGEJ.cjs');
|
|
@@ -286,7 +286,7 @@ function ChatDrawer({
|
|
|
286
286
|
className: "w-full sm:w-[450px] sm:max-w-[450px] p-0 flex flex-col [&>button]:hidden",
|
|
287
287
|
children: [
|
|
288
288
|
/* @__PURE__ */ jsxRuntime.jsx(VisuallyHidden__namespace.Root, { children: /* @__PURE__ */ jsxRuntime.jsx(SheetTitle, { children: "Chat Assistant" }) }),
|
|
289
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
289
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkMC6QDYB6_cjs.ChatInterface, {})
|
|
290
290
|
]
|
|
291
291
|
}
|
|
292
292
|
)
|
|
@@ -502,43 +502,43 @@ function SatisfactionRating({ onSubmit, onSkip }) {
|
|
|
502
502
|
|
|
503
503
|
Object.defineProperty(exports, "CartDrawer", {
|
|
504
504
|
enumerable: true,
|
|
505
|
-
get: function () { return
|
|
505
|
+
get: function () { return chunkMC6QDYB6_cjs.CartDrawer; }
|
|
506
506
|
});
|
|
507
507
|
Object.defineProperty(exports, "ChatFooter", {
|
|
508
508
|
enumerable: true,
|
|
509
|
-
get: function () { return
|
|
509
|
+
get: function () { return chunkMC6QDYB6_cjs.ChatFooter; }
|
|
510
510
|
});
|
|
511
511
|
Object.defineProperty(exports, "ChatHeader", {
|
|
512
512
|
enumerable: true,
|
|
513
|
-
get: function () { return
|
|
513
|
+
get: function () { return chunkMC6QDYB6_cjs.ChatHeader; }
|
|
514
514
|
});
|
|
515
515
|
Object.defineProperty(exports, "ChatInput", {
|
|
516
516
|
enumerable: true,
|
|
517
|
-
get: function () { return
|
|
517
|
+
get: function () { return chunkMC6QDYB6_cjs.ChatInput; }
|
|
518
518
|
});
|
|
519
519
|
Object.defineProperty(exports, "ChatInterface", {
|
|
520
520
|
enumerable: true,
|
|
521
|
-
get: function () { return
|
|
521
|
+
get: function () { return chunkMC6QDYB6_cjs.ChatInterface; }
|
|
522
522
|
});
|
|
523
523
|
Object.defineProperty(exports, "FloatingButton", {
|
|
524
524
|
enumerable: true,
|
|
525
|
-
get: function () { return
|
|
525
|
+
get: function () { return chunkMC6QDYB6_cjs.FloatingButton; }
|
|
526
526
|
});
|
|
527
527
|
Object.defineProperty(exports, "LiveChatPanel", {
|
|
528
528
|
enumerable: true,
|
|
529
|
-
get: function () { return
|
|
529
|
+
get: function () { return chunkMC6QDYB6_cjs.LiveChatPanel; }
|
|
530
530
|
});
|
|
531
531
|
Object.defineProperty(exports, "PreviewEmbedPanel", {
|
|
532
532
|
enumerable: true,
|
|
533
|
-
get: function () { return
|
|
533
|
+
get: function () { return chunkMC6QDYB6_cjs.PreviewEmbedPanel; }
|
|
534
534
|
});
|
|
535
535
|
Object.defineProperty(exports, "QuickQuestions", {
|
|
536
536
|
enumerable: true,
|
|
537
|
-
get: function () { return
|
|
537
|
+
get: function () { return chunkMC6QDYB6_cjs.QuickQuestions; }
|
|
538
538
|
});
|
|
539
539
|
Object.defineProperty(exports, "WelcomePage", {
|
|
540
540
|
enumerable: true,
|
|
541
|
-
get: function () { return
|
|
541
|
+
get: function () { return chunkMC6QDYB6_cjs.WelcomePage; }
|
|
542
542
|
});
|
|
543
543
|
exports.ChatDrawer = ChatDrawer;
|
|
544
544
|
exports.ChatInputWithAttachments = ChatInputWithAttachments;
|
package/dist/components.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { ChatInterface } from './chunk-
|
|
3
|
-
export { CartDrawer, ChatFooter, ChatHeader, ChatInput, ChatInterface, FloatingButton, LiveChatPanel, PreviewEmbedPanel, QuickQuestions, WelcomePage } from './chunk-
|
|
2
|
+
import { ChatInterface } from './chunk-FOZXDUSZ.js';
|
|
3
|
+
export { CartDrawer, ChatFooter, ChatHeader, ChatInput, ChatInterface, FloatingButton, LiveChatPanel, PreviewEmbedPanel, QuickQuestions, WelcomePage } from './chunk-FOZXDUSZ.js';
|
|
4
4
|
import './chunk-5F3O3ZJH.js';
|
|
5
|
-
import './chunk-
|
|
5
|
+
import './chunk-IU7Q7O5G.js';
|
|
6
6
|
import './chunk-A7PCSWIK.js';
|
|
7
7
|
import './chunk-MZQKGNWF.js';
|
|
8
8
|
import { useI18n } from './chunk-QYCEHFAB.js';
|
package/dist/hooks.cjs
CHANGED
|
@@ -5,7 +5,7 @@ var chunk5QSXB6UL_cjs = require('./chunk-5QSXB6UL.cjs');
|
|
|
5
5
|
var chunkKBGPBUTI_cjs = require('./chunk-KBGPBUTI.cjs');
|
|
6
6
|
require('./chunk-NG7OTWXQ.cjs');
|
|
7
7
|
var chunkNYQSM3EB_cjs = require('./chunk-NYQSM3EB.cjs');
|
|
8
|
-
var
|
|
8
|
+
var chunkP3RPAI4F_cjs = require('./chunk-P3RPAI4F.cjs');
|
|
9
9
|
require('./chunk-X7R334SB.cjs');
|
|
10
10
|
var chunk3MP2EGEJ_cjs = require('./chunk-3MP2EGEJ.cjs');
|
|
11
11
|
var chunkJ2K7EJYP_cjs = require('./chunk-J2K7EJYP.cjs');
|
|
@@ -296,7 +296,7 @@ Object.defineProperty(exports, "usePreviewEmbed", {
|
|
|
296
296
|
});
|
|
297
297
|
Object.defineProperty(exports, "useTheme", {
|
|
298
298
|
enumerable: true,
|
|
299
|
-
get: function () { return
|
|
299
|
+
get: function () { return chunkP3RPAI4F_cjs.useTheme; }
|
|
300
300
|
});
|
|
301
301
|
Object.defineProperty(exports, "useI18n", {
|
|
302
302
|
enumerable: true,
|
package/dist/hooks.js
CHANGED
|
@@ -3,7 +3,7 @@ export { useAigentycChat } from './chunk-4FBVV64J.js';
|
|
|
3
3
|
export { useInteractionTracker } from './chunk-MT2AMINB.js';
|
|
4
4
|
import './chunk-BKDV2H6Z.js';
|
|
5
5
|
export { useIsMobile, useLiveChat, usePreviewEmbed } from './chunk-5F3O3ZJH.js';
|
|
6
|
-
export { useTheme } from './chunk-
|
|
6
|
+
export { useTheme } from './chunk-IU7Q7O5G.js';
|
|
7
7
|
import './chunk-MZQKGNWF.js';
|
|
8
8
|
export { useI18n } from './chunk-QYCEHFAB.js';
|
|
9
9
|
export { useChatContext, useSlot, useSlots } from './chunk-FYPJSHCL.js';
|
package/dist/index.cjs
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
var chunk5QSXB6UL_cjs = require('./chunk-5QSXB6UL.cjs');
|
|
5
5
|
require('./chunk-NG7OTWXQ.cjs');
|
|
6
|
-
var
|
|
6
|
+
var chunkMC6QDYB6_cjs = require('./chunk-MC6QDYB6.cjs');
|
|
7
7
|
var chunkNYQSM3EB_cjs = require('./chunk-NYQSM3EB.cjs');
|
|
8
|
-
var
|
|
8
|
+
var chunkP3RPAI4F_cjs = require('./chunk-P3RPAI4F.cjs');
|
|
9
9
|
require('./chunk-RTVEBPAJ.cjs');
|
|
10
10
|
require('./chunk-X7R334SB.cjs');
|
|
11
11
|
var chunk3MP2EGEJ_cjs = require('./chunk-3MP2EGEJ.cjs');
|
|
@@ -76,7 +76,7 @@ function ChatProvider(props) {
|
|
|
76
76
|
children: /* @__PURE__ */ jsxRuntime.jsx(chunkNYQSM3EB_cjs.PreviewEmbedProvider, { children })
|
|
77
77
|
}
|
|
78
78
|
) : /* @__PURE__ */ jsxRuntime.jsx(chunkNYQSM3EB_cjs.PreviewEmbedProvider, { children });
|
|
79
|
-
return /* @__PURE__ */ jsxRuntime.jsx(chunk3MP2EGEJ_cjs.I18nProvider, { language, translations: translationOverrides, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
79
|
+
return /* @__PURE__ */ jsxRuntime.jsx(chunk3MP2EGEJ_cjs.I18nProvider, { language, translations: translationOverrides, children: /* @__PURE__ */ jsxRuntime.jsx(chunkP3RPAI4F_cjs.ThemeProvider, { theme, children: /* @__PURE__ */ jsxRuntime.jsx(chunkJ2K7EJYP_cjs.SlotsProvider, { slots, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
80
80
|
chunkJ2K7EJYP_cjs.ChatContextProvider,
|
|
81
81
|
{
|
|
82
82
|
config,
|
|
@@ -87,7 +87,7 @@ function ChatProvider(props) {
|
|
|
87
87
|
}
|
|
88
88
|
function Chat({ className, children, showSources, ...providerProps }) {
|
|
89
89
|
return /* @__PURE__ */ jsxRuntime.jsx(ChatProvider, { ...providerProps, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className, children: [
|
|
90
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
90
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkMC6QDYB6_cjs.ChatInterface, { showSources }),
|
|
91
91
|
children
|
|
92
92
|
] }) });
|
|
93
93
|
}
|
|
@@ -260,7 +260,7 @@ function ChatWidgetInner({
|
|
|
260
260
|
[isOpen, handleClose, logoUrl, welcomeTitle, welcomeSubtitle, hideWelcomeHeader, footerText, hideHeader, showFirstMessage, questionsLayout, questionsLayoutMobile, showSources, pendingMessage]
|
|
261
261
|
);
|
|
262
262
|
if (mode === "inline") {
|
|
263
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col w-full h-full", dir: dirRTL ? "rtl" : "ltr", style: { backgroundColor: "var(--ac-background)" }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
263
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col w-full h-full", dir: dirRTL ? "rtl" : "ltr", style: { backgroundColor: "var(--ac-background)" }, children: /* @__PURE__ */ jsxRuntime.jsx(chunkMC6QDYB6_cjs.ChatInterface, { ...chatInterfaceProps }) });
|
|
264
264
|
}
|
|
265
265
|
const panelZIndex = zIndex || 9999;
|
|
266
266
|
const floatingButtonProps = {
|
|
@@ -304,8 +304,8 @@ function ChatWidgetInner({
|
|
|
304
304
|
onClick: handleClose
|
|
305
305
|
}
|
|
306
306
|
),
|
|
307
|
-
!isMobile && /* @__PURE__ */ jsxRuntime.jsx(
|
|
308
|
-
!isMobile && /* @__PURE__ */ jsxRuntime.jsx(
|
|
307
|
+
!isMobile && /* @__PURE__ */ jsxRuntime.jsx(chunkMC6QDYB6_cjs.PreviewEmbedPanel, { isOpen, isRightSide, zIndex: panelZIndex - 1 }),
|
|
308
|
+
!isMobile && /* @__PURE__ */ jsxRuntime.jsx(chunkMC6QDYB6_cjs.LiveChatPanel, { isWidgetOpen: isOpen, isRightSide, zIndex: panelZIndex - 1 }),
|
|
309
309
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
310
310
|
"div",
|
|
311
311
|
{
|
|
@@ -334,15 +334,15 @@ function ChatWidgetInner({
|
|
|
334
334
|
},
|
|
335
335
|
children: [
|
|
336
336
|
isMobile && /* @__PURE__ */ jsxRuntime.jsx(MobilePreviewDrawer, {}),
|
|
337
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
338
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
337
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkMC6QDYB6_cjs.MobileLiveChatDrawer, {}),
|
|
338
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkMC6QDYB6_cjs.ChatInterface, { ...chatInterfaceProps })
|
|
339
339
|
]
|
|
340
340
|
}
|
|
341
341
|
),
|
|
342
342
|
!isOpen && chunkJ2K7EJYP_cjs.renderSlot(
|
|
343
343
|
"floatingButton",
|
|
344
344
|
floatingButtonProps,
|
|
345
|
-
|
|
345
|
+
chunkMC6QDYB6_cjs.FloatingButton,
|
|
346
346
|
slots
|
|
347
347
|
)
|
|
348
348
|
] });
|
|
@@ -443,7 +443,7 @@ Object.defineProperty(exports, "useLiveChat", {
|
|
|
443
443
|
});
|
|
444
444
|
Object.defineProperty(exports, "useTheme", {
|
|
445
445
|
enumerable: true,
|
|
446
|
-
get: function () { return
|
|
446
|
+
get: function () { return chunkP3RPAI4F_cjs.useTheme; }
|
|
447
447
|
});
|
|
448
448
|
Object.defineProperty(exports, "useI18n", {
|
|
449
449
|
enumerable: true,
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
export { useAigentycChat } from './chunk-4FBVV64J.js';
|
|
3
3
|
import './chunk-BKDV2H6Z.js';
|
|
4
|
-
import { ChatInterface, PreviewEmbedPanel, LiveChatPanel, MobileLiveChatDrawer, FloatingButton } from './chunk-
|
|
4
|
+
import { ChatInterface, PreviewEmbedPanel, LiveChatPanel, MobileLiveChatDrawer, FloatingButton } from './chunk-FOZXDUSZ.js';
|
|
5
5
|
import { LiveChatProvider, PreviewEmbedProvider, useIsMobile, usePreviewEmbed } from './chunk-5F3O3ZJH.js';
|
|
6
6
|
export { useLiveChat } from './chunk-5F3O3ZJH.js';
|
|
7
|
-
import { ThemeProvider } from './chunk-
|
|
8
|
-
export { useTheme } from './chunk-
|
|
7
|
+
import { ThemeProvider } from './chunk-IU7Q7O5G.js';
|
|
8
|
+
export { useTheme } from './chunk-IU7Q7O5G.js';
|
|
9
9
|
import './chunk-A7PCSWIK.js';
|
|
10
10
|
import './chunk-MZQKGNWF.js';
|
|
11
11
|
import { I18nProvider } from './chunk-QYCEHFAB.js';
|
package/dist/theme.cjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var chunkP3RPAI4F_cjs = require('./chunk-P3RPAI4F.cjs');
|
|
5
5
|
require('./chunk-3MP2EGEJ.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
Object.defineProperty(exports, "ThemeProvider", {
|
|
10
10
|
enumerable: true,
|
|
11
|
-
get: function () { return
|
|
11
|
+
get: function () { return chunkP3RPAI4F_cjs.ThemeProvider; }
|
|
12
12
|
});
|
|
13
13
|
Object.defineProperty(exports, "useTheme", {
|
|
14
14
|
enumerable: true,
|
|
15
|
-
get: function () { return
|
|
15
|
+
get: function () { return chunkP3RPAI4F_cjs.useTheme; }
|
|
16
16
|
});
|
|
17
17
|
//# sourceMappingURL=theme.cjs.map
|
|
18
18
|
//# sourceMappingURL=theme.cjs.map
|
package/dist/theme.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aigentyc/chat-sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "React SDK for building AI-powered chat interfaces connected to the Aigentyc platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
"LICENSE"
|
|
123
123
|
],
|
|
124
124
|
"bin": {
|
|
125
|
-
"aigentyc": "./bin/
|
|
125
|
+
"aigentyc": "./bin/aigentyc.mjs"
|
|
126
126
|
},
|
|
127
127
|
"homepage": "https://www.npmjs.com/package/@aigentyc/chat-sdk",
|
|
128
128
|
"scripts": {
|
|
@@ -138,7 +138,9 @@
|
|
|
138
138
|
"prepublishOnly": "pnpm build",
|
|
139
139
|
"publish:sdk": "pnpm build && npm publish --access public",
|
|
140
140
|
"publish:cli": "cd cli/create-aigentyc-chat && npm publish",
|
|
141
|
-
"publish:all": "pnpm publish:sdk && pnpm publish:cli"
|
|
141
|
+
"publish:all": "pnpm publish:sdk && pnpm publish:cli",
|
|
142
|
+
"release": "node scripts/release.mjs",
|
|
143
|
+
"release:dry": "node scripts/release.mjs --dry"
|
|
142
144
|
},
|
|
143
145
|
"publishConfig": {
|
|
144
146
|
"access": "public"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/providers/ThemeProvider.tsx"],"names":["createContext","useState","useI18n","useMemo","jsx","useContext"],"mappings":";;;;;;AA8CA,IAAM,YAAA,GAAeA,oBAAwC,IAAI,CAAA;AAUjE,SAAS,eAAe,KAAA,EAA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EAAC;AAAA,EACvB;AACF,CAAA,EAAuB;AACrB,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAIC,eAAsB,YAAY,CAAA;AAC5D,EAAA,MAAM,OAAOC,yBAAA,EAAQ;AACrB,EAAA,MAAM,YAAY,IAAA,CAAK,SAAA;AAEvB,EAAA,MAAM,OAAA,GAAUC,cAAQ,MAAM,cAAA,CAAe,KAAK,CAAA,EAAG,CAAC,KAAK,CAAC,CAAA;AAE5D,EAAA,MAAM,KAAA,GAAQA,aAAA;AAAA,IACZ,OAAO,EAAE,KAAA,EAAO,QAAA,EAAU,SAAA,EAAU,CAAA;AAAA,IACpC,CAAC,OAAO,SAAS;AAAA,GACnB;AAEA,EAAA,uBACEC,cAAA,CAAC,YAAA,CAAa,QAAA,EAAb,EAAsB,OACrB,QAAA,kBAAAA,cAAA,CAAC,KAAA,EAAA,EAAI,oBAAA,EAAmB,EAAA,EAAG,GAAA,EAAK,SAAA,EAAW,KAAA,EAAO,OAAA,EAC/C,UACH,CAAA,EACF,CAAA;AAEJ;AAMO,SAAS,QAAA,GAA8B;AAC5C,EAAA,MAAM,GAAA,GAAMC,iBAAW,YAAY,CAAA;AACnC,EAAA,IAAI,CAAC,GAAA,EAAK;AACR,IAAA,MAAM,IAAI,MAAM,8CAA8C,CAAA;AAAA,EAChE;AACA,EAAA,OAAO,GAAA;AACT","file":"chunk-7BNYTOTE.cjs","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-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"]}
|
|
@@ -1 +0,0 @@
|
|
|
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;AAA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EAAA,EAAI,oBAAA,EAAmB,EAAA,EAAG,GAAA,EAAK,SAAA,EAAW,KAAA,EAAO,OAAA,EAC/C,UACH,CAAA,EACF,CAAA;AAEJ;AAMO,SAAS,QAAA,GAA8B;AAC5C,EAAA,MAAM,GAAA,GAAM,WAAW,YAAY,CAAA;AACnC,EAAA,IAAI,CAAC,GAAA,EAAK;AACR,IAAA,MAAM,IAAI,MAAM,8CAA8C,CAAA;AAAA,EAChE;AACA,EAAA,OAAO,GAAA;AACT","file":"chunk-UKEL7FWS.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-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"]}
|