@daisy-plus/embed-react 1.0.0 → 2.0.0
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/CLAUDE.md +45 -0
- package/dist/copilot/DaisyCopilotChat.d.ts +11 -0
- package/dist/copilot/DaisyCopilotChat.d.ts.map +1 -0
- package/dist/copilot/DaisyCopilotPopup.d.ts +10 -0
- package/dist/copilot/DaisyCopilotPopup.d.ts.map +1 -0
- package/dist/copilot/DaisyCopilotSidebar.d.ts +12 -0
- package/dist/copilot/DaisyCopilotSidebar.d.ts.map +1 -0
- package/dist/copilot/index.d.ts +4 -0
- package/dist/copilot/index.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +4 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/useDaisyAction.d.ts +15 -0
- package/dist/hooks/useDaisyAction.d.ts.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/providers/DaisyProvider.d.ts +18 -0
- package/dist/providers/DaisyProvider.d.ts.map +1 -0
- package/dist/providers/DaisyThemeProvider.d.ts +17 -0
- package/dist/providers/DaisyThemeProvider.d.ts.map +1 -0
- package/dist/providers/index.d.ts +3 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/types/business.d.ts +35 -0
- package/dist/types/business.d.ts.map +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/theme.d.ts +107 -0
- package/dist/types/theme.d.ts.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/themeMapper.d.ts +57 -0
- package/dist/utils/themeMapper.d.ts.map +1 -0
- package/package.json +7 -3
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
This is `@daisy-plus/embed-react`, a React wrapper library for embedding Daisy+ chat interfaces. It provides React components that wrap the `@daisy-plus/embed` web components.
|
|
8
|
+
|
|
9
|
+
## Build Commands
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# Build the library
|
|
13
|
+
yarn build
|
|
14
|
+
|
|
15
|
+
# Development mode with watch
|
|
16
|
+
yarn dev
|
|
17
|
+
|
|
18
|
+
# Lint and fix TypeScript files
|
|
19
|
+
yarn lint
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Architecture
|
|
23
|
+
|
|
24
|
+
The library exports two React components that dynamically load and wrap custom elements from `@daisy-plus/embed`:
|
|
25
|
+
|
|
26
|
+
- **BubbleChat** (`src/BubbleChat.tsx`): Popup chat bubble that appends a `<daisy-interface>` custom element to the document body. Props are injected directly onto the element.
|
|
27
|
+
|
|
28
|
+
- **FullPageChat** (`src/FullPageChat.tsx`): Full-page chat component that renders a `<daisy-fullinterface>` custom element inline. Supports `style` and `className` props for container styling.
|
|
29
|
+
|
|
30
|
+
Both components:
|
|
31
|
+
1. Dynamically import `@daisy-plus/embed/dist/web.js` on mount to register the custom elements
|
|
32
|
+
2. Use refs to access the underlying HTML elements
|
|
33
|
+
3. Assign component props directly to the custom element properties via `Object.assign()`
|
|
34
|
+
|
|
35
|
+
## Dependencies
|
|
36
|
+
|
|
37
|
+
- **Peer dependency**: `@daisy-plus/embed` - the core embed library containing web component definitions
|
|
38
|
+
- **Peer dependency**: React 18.x
|
|
39
|
+
- Build toolchain: Rollup with Babel and TypeScript
|
|
40
|
+
|
|
41
|
+
## Key Files
|
|
42
|
+
|
|
43
|
+
- `src/index.ts` - Library entry point, exports both components
|
|
44
|
+
- `rollup.config.js` - Build configuration, outputs ES module to `dist/index.js`
|
|
45
|
+
- Types are generated via TypeScript compiler (`emitDeclarationOnly: true`)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CopilotChat } from '@copilotkit/react-ui';
|
|
2
|
+
import type { ComponentProps } from 'react';
|
|
3
|
+
import type { DaisyUnifiedTheme } from '../types/theme';
|
|
4
|
+
type CopilotChatProps = ComponentProps<typeof CopilotChat>;
|
|
5
|
+
export interface DaisyCopilotChatProps extends Partial<CopilotChatProps> {
|
|
6
|
+
theme?: DaisyUnifiedTheme;
|
|
7
|
+
showDaisyBranding?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function DaisyCopilotChat({ theme: propTheme, showDaisyBranding, className, labels, ...copilotProps }: DaisyCopilotChatProps): JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=DaisyCopilotChat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DaisyCopilotChat.d.ts","sourceRoot":"","sources":["../../src/copilot/DaisyCopilotChat.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAG5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,KAAK,gBAAgB,GAAG,cAAc,CAAC,OAAO,WAAW,CAAC,CAAC;AAE3D,MAAM,WAAW,qBAAsB,SAAQ,OAAO,CAAC,gBAAgB,CAAC;IACtE,KAAK,CAAC,EAAE,iBAAiB,CAAC;IAC1B,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EAAE,SAAS,EAChB,iBAAwB,EACxB,SAAS,EACT,MAAM,EACN,GAAG,YAAY,EAChB,EAAE,qBAAqB,eA4BvB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CopilotPopup } from '@copilotkit/react-ui';
|
|
2
|
+
import type { ComponentProps } from 'react';
|
|
3
|
+
import type { DaisyUnifiedTheme } from '../types/theme';
|
|
4
|
+
type CopilotPopupProps = ComponentProps<typeof CopilotPopup>;
|
|
5
|
+
export interface DaisyCopilotPopupProps extends Partial<CopilotPopupProps> {
|
|
6
|
+
theme?: DaisyUnifiedTheme;
|
|
7
|
+
}
|
|
8
|
+
export declare function DaisyCopilotPopup({ theme: propTheme, className, labels, ...copilotProps }: DaisyCopilotPopupProps): JSX.Element;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=DaisyCopilotPopup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DaisyCopilotPopup.d.ts","sourceRoot":"","sources":["../../src/copilot/DaisyCopilotPopup.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAG5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,KAAK,iBAAiB,GAAG,cAAc,CAAC,OAAO,YAAY,CAAC,CAAC;AAE7D,MAAM,WAAW,sBAAuB,SAAQ,OAAO,CAAC,iBAAiB,CAAC;IACxE,KAAK,CAAC,EAAE,iBAAiB,CAAC;CAC3B;AAED,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EAAE,SAAS,EAChB,SAAS,EACT,MAAM,EACN,GAAG,YAAY,EAChB,EAAE,sBAAsB,eA4BxB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CopilotSidebar } from '@copilotkit/react-ui';
|
|
2
|
+
import type { ComponentProps, ReactNode } from 'react';
|
|
3
|
+
import type { DaisyUnifiedTheme } from '../types/theme';
|
|
4
|
+
type CopilotSidebarProps = ComponentProps<typeof CopilotSidebar>;
|
|
5
|
+
export interface DaisyCopilotSidebarProps extends Partial<CopilotSidebarProps> {
|
|
6
|
+
theme?: DaisyUnifiedTheme;
|
|
7
|
+
position?: 'left' | 'right';
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export declare function DaisyCopilotSidebar({ theme: propTheme, position, className, labels, children, ...copilotProps }: DaisyCopilotSidebarProps): JSX.Element;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=DaisyCopilotSidebar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DaisyCopilotSidebar.d.ts","sourceRoot":"","sources":["../../src/copilot/DaisyCopilotSidebar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,KAAK,mBAAmB,GAAG,cAAc,CAAC,OAAO,cAAc,CAAC,CAAC;AAEjE,MAAM,WAAW,wBAAyB,SAAQ,OAAO,CAAC,mBAAmB,CAAC;IAC5E,KAAK,CAAC,EAAE,iBAAiB,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,wBAAgB,mBAAmB,CAAC,EAClC,KAAK,EAAE,SAAS,EAChB,QAAkB,EAClB,SAAS,EACT,MAAM,EACN,QAAQ,EACR,GAAG,YAAY,EAChB,EAAE,wBAAwB,eA+B1B"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { DaisyCopilotChat, type DaisyCopilotChatProps, } from './DaisyCopilotChat';
|
|
2
|
+
export { DaisyCopilotPopup, type DaisyCopilotPopupProps, } from './DaisyCopilotPopup';
|
|
3
|
+
export { DaisyCopilotSidebar, type DaisyCopilotSidebarProps, } from './DaisyCopilotSidebar';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/copilot/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,KAAK,qBAAqB,GAC3B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,iBAAiB,EACjB,KAAK,sBAAsB,GAC5B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,mBAAmB,EACnB,KAAK,wBAAwB,GAC9B,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { useDaisyAction, type UseDaisyActionOptions, type UseDaisyActionResult, } from './useDaisyAction';
|
|
2
|
+
export { useCopilotAction, useCopilotChat, useCopilotReadable, } from '@copilotkit/react-core';
|
|
3
|
+
export type { CopilotContextParams, } from '@copilotkit/react-core';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,GAC1B,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,kBAAkB,GACnB,MAAM,wBAAwB,CAAC;AAIhC,YAAY,EACV,oBAAoB,GACrB,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface UseDaisyActionOptions {
|
|
2
|
+
chatflowId: string;
|
|
3
|
+
apiHost?: string;
|
|
4
|
+
name?: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
chatflowConfig?: Record<string, unknown>;
|
|
7
|
+
onRequest?: (request: RequestInit) => Promise<void>;
|
|
8
|
+
onResponse?: (response: unknown) => void;
|
|
9
|
+
onError?: (error: Error) => void;
|
|
10
|
+
}
|
|
11
|
+
export interface UseDaisyActionResult {
|
|
12
|
+
actionName: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function useDaisyAction({ chatflowId, apiHost, name, description, chatflowConfig, onRequest, onResponse, onError, }: UseDaisyActionOptions): UseDaisyActionResult;
|
|
15
|
+
//# sourceMappingURL=useDaisyAction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDaisyAction.d.ts","sourceRoot":"","sources":["../../src/hooks/useDaisyAction.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpD,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAClC;AAED,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,cAAc,CAAC,EAC7B,UAAU,EACV,OAAsC,EACtC,IAAI,EACJ,WAAW,EACX,cAAc,EACd,SAAS,EACT,UAAU,EACV,OAAO,GACR,EAAE,qBAAqB,GAAG,oBAAoB,CA8D9C"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
export { FullPageChat } from './FullPageChat';
|
|
2
2
|
export { BubbleChat } from './BubbleChat';
|
|
3
|
+
export { DaisyCopilotChat, DaisyCopilotPopup, DaisyCopilotSidebar, type DaisyCopilotChatProps, type DaisyCopilotPopupProps, type DaisyCopilotSidebarProps, } from './copilot';
|
|
4
|
+
export { DaisyThemeProvider, DaisyProvider, useDaisyTheme, useDaisyThemeOptional, useDaisyContext, useDaisyContextOptional, type DaisyThemeProviderProps, type DaisyProviderProps, } from './providers';
|
|
5
|
+
export { useDaisyAction, useCopilotAction, useCopilotChat, useCopilotReadable, type UseDaisyActionOptions, type UseDaisyActionResult, } from './hooks';
|
|
6
|
+
export type { BusinessConfig, BusinessBranding, BusinessFeatures, BusinessDisclaimer, DaisyUnifiedTheme, MessageTheme, TextInputTheme, FooterTheme, FeedbackTheme, ChatWindowTheme, ButtonTheme, TooltipTheme, DisclaimerTheme, DateTimeToggleTheme, CopilotKitOverrides, } from './types';
|
|
7
|
+
export { mapToDaisyTheme, mapToCopilotKitStyles, mapBusinessToTheme, type DaisyThemeOutput, type CopilotKitStyleOutput, } from './utils';
|
|
3
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,GAC9B,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,qBAAqB,EACrB,eAAe,EACf,uBAAuB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,GACxB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,kBAAkB,EAClB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,GAC1B,MAAM,SAAS,CAAC;AAGjB,YAAY,EACV,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,WAAW,EACX,aAAa,EACb,eAAe,EACf,WAAW,EACX,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,kBAAkB,EAClB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,GAC3B,MAAM,SAAS,CAAC"}
|