@nlxai/touchpoint-ui 1.2.6 → 1.2.7-alpha.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.
Files changed (76) hide show
  1. package/build/App.d.ts +20 -0
  2. package/build/ProviderStack.d.ts +10 -0
  3. package/build/assets/index-B9Yzt2if.js +233 -0
  4. package/build/assets/index-BbXI3y3Q.css +1 -0
  5. package/build/bidirectional/analyzePageForms.d.ts +35 -0
  6. package/build/bidirectional/automaticContext.d.ts +12 -0
  7. package/build/bidirectional/commandHandler.d.ts +5 -0
  8. package/build/bidirectional/debug.d.ts +1 -0
  9. package/build/components/ErrorMessage.d.ts +4 -0
  10. package/build/components/FeedbackComment.d.ts +6 -0
  11. package/build/components/FullscreenError.d.ts +2 -0
  12. package/build/components/FullscreenVoice.d.ts +32 -0
  13. package/build/components/Header.d.ts +20 -0
  14. package/build/components/Input.d.ts +14 -0
  15. package/build/components/Layout.d.ts +23 -0
  16. package/build/components/Messages.d.ts +33 -0
  17. package/build/components/Notice.d.ts +4 -0
  18. package/build/components/Ripple.d.ts +9 -0
  19. package/build/components/RiveAnimation.d.ts +4 -0
  20. package/build/components/SafeMarkdown.d.ts +4 -0
  21. package/build/components/Settings.d.ts +10 -0
  22. package/build/components/Theme.d.ts +4 -0
  23. package/build/components/VoiceMini.d.ts +13 -0
  24. package/build/components/VoiceModalities.d.ts +11 -0
  25. package/build/components/defaultModalities/DefaultCard.d.ts +3 -0
  26. package/build/components/defaultModalities/DefaultCarousel.d.ts +6 -0
  27. package/build/components/defaultModalities/DefaultDateInput.d.ts +5 -0
  28. package/build/components/defaultModalities/shared.d.ts +20 -0
  29. package/build/components/ui/Carousel.d.ts +26 -0
  30. package/build/components/ui/CustomCard.d.ts +101 -0
  31. package/build/components/ui/DateInput.d.ts +30 -0
  32. package/build/components/ui/IconButton.d.ts +68 -0
  33. package/build/components/ui/Icons.d.ts +63 -0
  34. package/build/components/ui/LaunchButton.d.ts +13 -0
  35. package/build/components/ui/LightDarkToggle.d.ts +47 -0
  36. package/build/components/ui/Loader.d.ts +7 -0
  37. package/build/components/ui/MessageButton.d.ts +58 -0
  38. package/build/components/ui/PicturesContainer.d.ts +9 -0
  39. package/build/components/ui/Radio.d.ts +14 -0
  40. package/build/components/ui/TextButton.d.ts +46 -0
  41. package/build/components/ui/Typography.d.ts +29 -0
  42. package/build/components/ui/ViewMediaModal.d.ts +8 -0
  43. package/build/design-system.d.ts +1 -0
  44. package/build/favicon.ico +0 -0
  45. package/build/feedback.d.ts +38 -0
  46. package/build/index.d.ts +63 -0
  47. package/build/index.html +13 -0
  48. package/build/interface.d.ts +569 -0
  49. package/build/mocks/MockText.d.ts +10 -0
  50. package/build/mocks/MockVoice.d.ts +10 -0
  51. package/build/mocks/MockVoiceMini.d.ts +8 -0
  52. package/build/mocks/shared.d.ts +5 -0
  53. package/build/preview.d.ts +10 -0
  54. package/build/types.d.ts +5 -0
  55. package/build/utils/useAppRoot.d.ts +3 -0
  56. package/build/utils/useCopy.d.ts +4 -0
  57. package/build/utils/useTailwindMediaQuery.d.ts +1 -0
  58. package/build/voice.d.ts +70 -0
  59. package/index.html +43 -47
  60. package/lib/ProviderStack.d.ts +0 -21
  61. package/lib/components/FullscreenVoice.d.ts +4 -6
  62. package/lib/components/Layout.d.ts +23 -0
  63. package/lib/components/VoiceModalities.d.ts +11 -0
  64. package/lib/components/defaultModalities/index.d.ts +2 -0
  65. package/lib/components/ui/Radio.d.ts +14 -0
  66. package/lib/design-system/LightDarkToggle.d.ts +50 -0
  67. package/lib/design-system/index.d.ts +1 -0
  68. package/lib/index.js +11516 -11445
  69. package/lib/index.umd.js +82 -82
  70. package/lib/mocks/MockText.d.ts +10 -0
  71. package/lib/mocks/MockVoice.d.ts +10 -0
  72. package/lib/mocks/MockVoiceMini.d.ts +8 -0
  73. package/lib/mocks/shared.d.ts +5 -0
  74. package/package.json +3 -2
  75. package/vite.config.ts +61 -32
  76. package/lib/design-system.d.ts +0 -0
@@ -0,0 +1,63 @@
1
+ import { FC } from 'react';
2
+ /**
3
+ * Props for icon components
4
+ */
5
+ export interface IconProps {
6
+ /**
7
+ * Additional CSS classes to apply to the icon
8
+ */
9
+ className?: string;
10
+ /**
11
+ * Custom size in pixels for the icon
12
+ */
13
+ size?: number;
14
+ }
15
+ /**
16
+ * Type definition for an icon component
17
+ */
18
+ export type Icon = FC<IconProps>;
19
+ export declare const Action: Icon;
20
+ export declare const Touchpoint: Icon;
21
+ export declare const AssistantOld: Icon;
22
+ export declare const Add: Icon;
23
+ export declare const ArrowDown: Icon;
24
+ export declare const ArrowLeft: Icon;
25
+ export declare const ArrowRight: Icon;
26
+ export declare const ArrowUp: Icon;
27
+ export declare const ArrowForward: Icon;
28
+ export declare const Attachment: Icon;
29
+ export declare const BotMessage: Icon;
30
+ export declare const Camera: Icon;
31
+ export declare const Check: Icon;
32
+ export declare const Close: Icon;
33
+ export declare const Copy: Icon;
34
+ export declare const Date: Icon;
35
+ export declare const Delete: Icon;
36
+ export declare const Edit: Icon;
37
+ export declare const Escalate: Icon;
38
+ export declare const Error: Icon;
39
+ export declare const FullScreen: Icon;
40
+ export declare const Mic: Icon;
41
+ export declare const MicOff: Icon;
42
+ export declare const Location: Icon;
43
+ export declare const Volume: Icon;
44
+ export declare const VolumeOff: Icon;
45
+ export declare const Translate: Icon;
46
+ export declare const OpenInNew: Icon;
47
+ export declare const Play: Icon;
48
+ export declare const Preview: Icon;
49
+ export declare const Reorder: Icon;
50
+ export declare const Restart: Icon;
51
+ export declare const Settings: Icon;
52
+ export declare const Search: Icon;
53
+ export declare const Share: Icon;
54
+ export declare const Warning: Icon;
55
+ export declare const ThumbDown: Icon;
56
+ export declare const ThumbUp: Icon;
57
+ export declare const Time: Icon;
58
+ export declare const Undo: Icon;
59
+ export declare const Refresh: Icon;
60
+ export declare const Help: Icon;
61
+ export declare const OpenLink: Icon;
62
+ export declare const LightMode: Icon;
63
+ export declare const DarkMode: Icon;
@@ -0,0 +1,13 @@
1
+ import { FC, ComponentType } from 'react';
2
+ export interface LaunchButtonProps {
3
+ label: string;
4
+ className?: string;
5
+ showLabel?: boolean;
6
+ onClick?: () => void;
7
+ iconUrl?: string;
8
+ Custom?: ComponentType<{
9
+ className?: string;
10
+ onClick?: () => void;
11
+ }>;
12
+ }
13
+ export declare const LaunchButton: FC<LaunchButtonProps>;
@@ -0,0 +1,47 @@
1
+ import { FC } from 'react';
2
+ import { ColorMode } from '../../interface';
3
+ /**
4
+ * Props for the LightDarkToggle component
5
+ * @inline
6
+ * @hidden
7
+ */
8
+ interface Props {
9
+ /**
10
+ * Current theme state
11
+ */
12
+ value: ColorMode;
13
+ /**
14
+ * Callback fired when the toggle is changed
15
+ */
16
+ onChange: (value: ColorMode) => void;
17
+ /**
18
+ * Additional CSS classes to apply to the toggle
19
+ */
20
+ className?: string;
21
+ /**
22
+ * Accessible label for the toggle
23
+ */
24
+ label?: string;
25
+ }
26
+ /**
27
+ * A controlled light/dark mode toggle component
28
+ * @example
29
+ * ```tsx
30
+ * import { LightDarkToggle, React, useState } from '@nlx/touchpoint-ui';
31
+ *
32
+ * const MyToggle = () => {
33
+ * const [theme, setTheme] = useState<'light' | 'dark'>('light');
34
+ *
35
+ * return (
36
+ * <LightDarkToggle
37
+ * value={theme}
38
+ * onChange={setTheme}
39
+ * label="Toggle theme"
40
+ * />
41
+ * );
42
+ * };
43
+ * ```
44
+ * @category Modality components
45
+ */
46
+ export declare const LightDarkToggle: FC<Props>;
47
+ export {};
@@ -0,0 +1,7 @@
1
+ import { FC } from 'react';
2
+ export interface LoaderProps {
3
+ label?: string;
4
+ className?: string;
5
+ }
6
+ export declare const LoaderAnimation: FC<unknown>;
7
+ export declare const Loader: FC<LoaderProps>;
@@ -0,0 +1,58 @@
1
+ import { FC } from 'react';
2
+ import { IconProps } from './Icons';
3
+ /**
4
+ * Represents the different types of icon buttons available in the application.
5
+ *
6
+ * - `main`: The primary icon button.
7
+ * - `ghost`: A transparent or less prominent icon button.
8
+ * - `activated`: An icon button that indicates an active state.
9
+ * - `coverup`: An icon button used to cover up or mask something.
10
+ * - `overlay`: An icon button that appears over other content.
11
+ * @category Modality components
12
+ */
13
+ export type MessageButtonType = "main" | "activated";
14
+ /**
15
+ * Props for the MessageButton component
16
+ * @inline
17
+ * @hidden
18
+ */
19
+ export interface MessageButtonProps {
20
+ /**
21
+ * Handler function called when the button is clicked
22
+ */
23
+ onClick?: () => void;
24
+ /**
25
+ * Accessible label for the button
26
+ */
27
+ label: string;
28
+ /**
29
+ * Additional CSS classes to apply to the button
30
+ */
31
+ className?: string;
32
+ /**
33
+ * Visual style variant of the button. One of MessageButtonType.
34
+ */
35
+ type: MessageButtonType;
36
+ /**
37
+ * Icon component to display inside the button
38
+ */
39
+ Icon: FC<IconProps>;
40
+ }
41
+ /**
42
+ * A button showing only an icon (textual label is provided for accessibility)
43
+ * @example
44
+ * ```tsx
45
+ * import { MessageButton, Icons, React } from '@nlx/touchpoint-ui';
46
+ *
47
+ * const MyMessageButton = () => (
48
+ * <MessageButton
49
+ * label="Send message"
50
+ * onClick={() => alert('Icon button clicked!')}
51
+ * type="main"
52
+ * Icon={Icons.ArrowForward}
53
+ * />
54
+ * );
55
+ * ```
56
+ * @category Modality components
57
+ */
58
+ export declare const MessageButton: FC<MessageButtonProps>;
@@ -0,0 +1,9 @@
1
+ import { FC } from 'react';
2
+ export interface PicturesProps {
3
+ imgSrc: string;
4
+ }
5
+ interface PicturesContainerProps {
6
+ payload: PicturesProps[];
7
+ }
8
+ export declare const PicturesContainer: FC<PicturesContainerProps>;
9
+ export {};
@@ -0,0 +1,14 @@
1
+ import { FC } from 'react';
2
+ export interface RadioOption<T> {
3
+ value: T;
4
+ label: string;
5
+ }
6
+ interface RadioProps<T> {
7
+ options: Array<RadioOption<T>>;
8
+ value: T;
9
+ onChange?: (value: T) => void;
10
+ name: string;
11
+ className?: string;
12
+ }
13
+ export declare const Radio: FC<RadioProps<string | number>>;
14
+ export {};
@@ -0,0 +1,46 @@
1
+ import { FC } from 'react';
2
+ import { IconProps } from './Icons';
3
+ /**
4
+ * Props for the TextButton component
5
+ * @inline
6
+ * @hidden
7
+ */
8
+ export interface TextButtonProps {
9
+ /**
10
+ * Handler function called when the button is clicked
11
+ */
12
+ onClick?: () => void;
13
+ /**
14
+ * Text to display on the button
15
+ */
16
+ label: string;
17
+ /**
18
+ * Additional CSS classes to apply to the button
19
+ */
20
+ className?: string;
21
+ /**
22
+ * Visual style variant of the button
23
+ * Default value is "ghost"
24
+ */
25
+ type?: "main" | "ghost";
26
+ /**
27
+ * Icon component to display inside the button.
28
+ */
29
+ Icon: FC<IconProps>;
30
+ }
31
+ /**
32
+ * A button with a visible textual label
33
+ * @example
34
+ * ```tsx
35
+ * import { TextButton, ArrowForward, React } from '@nlx/touchpoint-ui';
36
+ *
37
+ * const MyTextButton = ({ onClickHandler }) => (
38
+ * <TextButton
39
+ * onClick={onClickHandler}
40
+ * label="Continue"
41
+ * />
42
+ * );
43
+ * ```
44
+ * @category Modality components
45
+ */
46
+ export declare const TextButton: FC<TextButtonProps>;
@@ -0,0 +1,29 @@
1
+ import { FC, ReactNode } from 'react';
2
+ /**
3
+ * Standard text component with base typography styles applied.
4
+ * @example
5
+ * ```tsx
6
+ * import { BaseText, React } from '@nlx/touchpoint-ui';
7
+ *
8
+ * const MyText = () => (
9
+ * <BaseText faded>This is some standard text.</BaseText>
10
+ * );
11
+ * ```
12
+ * @category Modality components
13
+ */
14
+ export declare const BaseText: FC<{
15
+ children: ReactNode;
16
+ /** Show in a slightly dimmer style (primary-60 instead of primary-80). */
17
+ faded?: boolean;
18
+ /** Custom CSS class name */
19
+ className?: string;
20
+ }>;
21
+ /**
22
+ * Small text component with smaller typography styles applied.
23
+ * @category Modality components
24
+ */
25
+ export declare const SmallText: FC<{
26
+ children: ReactNode;
27
+ /** Custom CSS class name */
28
+ className?: string;
29
+ }>;
@@ -0,0 +1,8 @@
1
+ import { FC } from 'react';
2
+ interface ViewMediaModalProps {
3
+ onClose: () => void;
4
+ src: string;
5
+ type: "picture" | "video";
6
+ }
7
+ declare const ViewMediaModal: FC<ViewMediaModalProps>;
8
+ export default ViewMediaModal;
@@ -0,0 +1 @@
1
+ export declare const renderDesignSystem: (element: HTMLElement) => void;
Binary file
@@ -0,0 +1,38 @@
1
+ import { ConversationHandler } from '@nlxai/core';
2
+ interface FeedbackInfo {
3
+ rating: number | null;
4
+ commentSubmitted: boolean;
5
+ commentText: string;
6
+ pending: boolean;
7
+ }
8
+ export interface State {
9
+ comment: CommentState;
10
+ items: Record<string, FeedbackInfo>;
11
+ }
12
+ type CommentState = {
13
+ state: "idle";
14
+ } | ({
15
+ state: "editing";
16
+ } & ActiveCommentState) | ({
17
+ state: "submitting";
18
+ } & ActiveCommentState) | ({
19
+ state: "submitted";
20
+ } & ActiveCommentState) | ({
21
+ state: "error";
22
+ } & ActiveCommentState);
23
+ interface ActiveCommentState {
24
+ activeFeedbackUrl: string;
25
+ text: string;
26
+ prompt: string;
27
+ }
28
+ export declare const getFeedbackInfo: (state: State, feedbackUrl: string) => FeedbackInfo;
29
+ export interface Actions {
30
+ clickRating: (feedbackUrl: string, value: number) => void;
31
+ clickCommentButton: (feedbackUrl: string, prompt: string) => void;
32
+ clickCommentEdit: () => void;
33
+ editCommentText: (text: string) => void;
34
+ submitComment: () => Promise<void>;
35
+ cancelComment: () => void;
36
+ }
37
+ export declare function useFeedback(handler: ConversationHandler): [State, Actions];
38
+ export {};
@@ -0,0 +1,63 @@
1
+ import { TextButton } from './components/ui/TextButton';
2
+ import { IconButton } from './components/ui/IconButton';
3
+ import { Ripple } from './components/Ripple';
4
+ import { BaseText, SmallText } from './components/ui/Typography';
5
+ import { CustomCard, CustomCardRow, CustomCardImageRow } from './components/ui/CustomCard';
6
+ import { Carousel } from './components/ui/Carousel';
7
+ import { DateInput } from './components/ui/DateInput';
8
+ import { TouchpointConfiguration, TouchpointInstance } from './interface';
9
+ import * as Icons from "./components/ui/Icons";
10
+ /**
11
+ * If you wish to build custom modalities using JSX, you will want to
12
+ *
13
+ * ```javascript
14
+ * import { React } from "@nlx/touchpoint-ui";
15
+ * ```
16
+ *
17
+ * instead of importing from "react" directly. This ensures that the custom modalities will
18
+ * be running in the same React context as the Touchpoint UI using the correct version of React.
19
+ * @category Modality components
20
+ */
21
+ export { default as React } from 'react';
22
+ /**
23
+ * Package version
24
+ * @category Utilities
25
+ */
26
+ export declare const version: string;
27
+ /**
28
+ * A tagged literal for creating reactive elements for custom modalities.
29
+ * It already knows about all Touchpoint UI components, so you can use them directly without the need to import them.
30
+ * Also very useful when using Touchpoint directly from CDN or in projects without a build step.
31
+ * @example
32
+ * ```ts
33
+ * import { html, Icons } from '@nlx/touchpoint-ui';
34
+ *
35
+ * const MyCustomModality = ({data, conversationHandler}) =>
36
+ * html`<div style="display: flex; gap: 8px;">
37
+ * <IconButton label="Cancel" Icon=${Icons.Close} type="ghost" onClick=${cancel()} />
38
+ * <TextButton
39
+ * label="Submit"
40
+ * Icon=${Icons.ArrowForward}
41
+ * type="main"
42
+ * onClick=${() => conversationHandler.sendText('Button clicked!')}
43
+ * />
44
+ * </div>`;
45
+ * ```
46
+ * @category Modality components
47
+ */
48
+ export declare const html: (strings: TemplateStringsArray, ...values: any[]) => unknown;
49
+ export { type CustomCardProps, type CustomCardRowProps, } from './components/ui/CustomCard';
50
+ export { type DateInputProps } from './components/ui/DateInput';
51
+ export { type IconButtonProps, type IconButtonType, } from './components/ui/IconButton';
52
+ export { type TextButtonProps } from './components/ui/TextButton';
53
+ export type { WindowSize, ColorMode, ChoiceMessage, CustomModalityComponent, Theme, InitializeConversation, CustomLaunchButton, Input, InputField, PageState, BidirectionalContext, BidirectionalConfig, TouchpointConfiguration, BidirectionalCustomCommand, TouchpointInstance, } from './interface';
54
+ export { analyzePageForms, type InteractiveElementInfo, type PageForms, type AccessibilityInformation, } from './bidirectional/analyzePageForms';
55
+ /**
56
+ * Creates a new Touchpoint UI instance and appends it to the document body
57
+ * @param props - Configuration props for Touchpoint
58
+ * @returns A promise that resolves to a TouchpointInstance
59
+ * @category Basics
60
+ */
61
+ export declare const create: (props: TouchpointConfiguration) => Promise<TouchpointInstance>;
62
+ export { Container as PreviewContainer } from './preview';
63
+ export { TextButton, IconButton, BaseText, SmallText, DateInput, Carousel, CustomCard, CustomCardRow, CustomCardImageRow, Icons, Ripple, };
@@ -0,0 +1,13 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Design System</title>
7
+ <script type="module" crossorigin src="/assets/index-B9Yzt2if.js"></script>
8
+ <link rel="stylesheet" crossorigin href="/assets/index-BbXI3y3Q.css">
9
+ </head>
10
+ <body>
11
+ <main></main>
12
+ </body>
13
+ </html>