@nlxai/touchpoint-ui 1.0.4-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.
package/lib/types.d.ts ADDED
@@ -0,0 +1,138 @@
1
+ import { BotMessage } from '@nlxai/chat-core';
2
+ import { FC } from 'react';
3
+ /**
4
+ * Window size configuration
5
+ */
6
+ export type WindowSize = "half" | "full";
7
+ /**
8
+ * Color mode configuration (light/dark modes)
9
+ */
10
+ export type ColorMode = "light" | "dark";
11
+ /**
12
+ * Logo URL if applicable. May be specified as a single image URL or as an object by color mode (light/dark)
13
+ */
14
+ export type LogoUrl = string | Record<ColorMode, string>;
15
+ /**
16
+ * Choice message with metadata
17
+ */
18
+ export interface ChoiceMessage {
19
+ /**
20
+ * Message contents
21
+ */
22
+ message: BotMessage;
23
+ /**
24
+ * Index in the response transcript history
25
+ */
26
+ responseIndex: number;
27
+ /**
28
+ * Message index in the current response
29
+ */
30
+ messageIndex: number;
31
+ }
32
+ /**
33
+ * Custom Modalities allow rendering of rich components from nodes.
34
+ * See: https://docs.studio.nlx.ai/intentflows/documentation-flows/flows-build-mode/advanced-messaging-+-functionality#modalities
35
+ */
36
+ export type CustomModalityComponent<Data> = FC<{
37
+ /**
38
+ * The payload of the Custom Modality. The schema is defined in Dialog Studio settings.
39
+ */
40
+ data: Data;
41
+ }>;
42
+ /**
43
+ * The full theme expressed as CSS custom properties
44
+ */
45
+ export interface Theme {
46
+ /**
47
+ * Font family
48
+ */
49
+ fontFamily: string;
50
+ /**
51
+ * Primary color with 80% opacity
52
+ */
53
+ primary80: string;
54
+ /**
55
+ * Primary color with 60% opacity
56
+ */
57
+ primary60: string;
58
+ /**
59
+ * Primary color with 40% opacity
60
+ */
61
+ primary40: string;
62
+ /**
63
+ * Primary color with 20% opacity
64
+ */
65
+ primary20: string;
66
+ /**
67
+ * Primary color with 10% opacity
68
+ */
69
+ primary10: string;
70
+ /**
71
+ * Primary color with 5% opacity
72
+ */
73
+ primary5: string;
74
+ /**
75
+ * Primary color with 1% opacity
76
+ */
77
+ primary1: string;
78
+ /**
79
+ * Secondary color with 80% opacity
80
+ */
81
+ secondary80: string;
82
+ /**
83
+ * Secondary color with 60% opacity
84
+ */
85
+ secondary60: string;
86
+ /**
87
+ * Secondary color with 40% opacity
88
+ */
89
+ secondary40: string;
90
+ /**
91
+ * Secondary color with 20% opacity
92
+ */
93
+ secondary20: string;
94
+ /**
95
+ * Secondary color with 10% opacity
96
+ */
97
+ secondary10: string;
98
+ /**
99
+ * Secondary color with 5% opacity
100
+ */
101
+ secondary5: string;
102
+ /**
103
+ * Secondary color with 1% opacity
104
+ */
105
+ secondary1: string;
106
+ /**
107
+ * Accent color used e.g. for prominent buttons, the loader animation as well as selected card outlines
108
+ */
109
+ accent: string;
110
+ /**
111
+ * Accent color with 20% opacity
112
+ */
113
+ accent20: string;
114
+ /**
115
+ * The background color of the main Touchpoint interface
116
+ */
117
+ background: string;
118
+ /**
119
+ * The color of the overlay covering the visible portion of the website when the Touchpoint interface does not cover the full screen
120
+ */
121
+ overlay: string;
122
+ /**
123
+ * Primary warning color
124
+ */
125
+ warningPrimary: string;
126
+ /**
127
+ * Secondary warning color
128
+ */
129
+ warningSecondary: string;
130
+ /**
131
+ * Primary error color
132
+ */
133
+ errorPrimary: string;
134
+ /**
135
+ * Secondary error color
136
+ */
137
+ errorSecondary: string;
138
+ }
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@nlxai/touchpoint-ui",
3
+ "version": "1.0.4-alpha.0",
4
+ "description": "Web UI for Touchpoint",
5
+ "type": "module",
6
+ "main": "lib/index.js",
7
+ "license": "MIT",
8
+ "author": "Peter Szerzo <peter@nlx.ai>",
9
+ "module": "lib/index.js",
10
+ "browser": "lib/index.umd.js",
11
+ "types": "lib/index.d.ts",
12
+ "scripts": {
13
+ "dev": "vite",
14
+ "design-system": "vite --mode design-system",
15
+ "build": "tsc && vite build",
16
+ "docs": "echo \"todo\"",
17
+ "lint:check": "eslint src/ --ext .ts,.tsx,.js,.jsx --max-warnings 0",
18
+ "lint": "eslint src/ --ext .ts,.tsx,.js,.jsx --fix",
19
+ "format": "git ls-files | grep -E '\\.(js|jsx|ts|tsx|css|html)$' | xargs prettier --write",
20
+ "preview-docs": "echo \"todo\"",
21
+ "publish-docs": "echo \"todo\"",
22
+ "test": "echo \"todo\"",
23
+ "tsc": "tsc"
24
+ },
25
+ "dependencies": {
26
+ "@nlxai/chat-core": "^1.0.4-alpha.0",
27
+ "@react-hookz/web": "^25.0.1",
28
+ "@react-input/mask": "^2.0.4",
29
+ "clsx": "^2.1.1",
30
+ "htm": "^3.1.1",
31
+ "marked": "^15.0.4",
32
+ "ramda": "^0.30.1",
33
+ "react": "^18.3.1",
34
+ "react-dom": "^18.3.1",
35
+ "react-indiana-drag-scroll": "^2.2.0",
36
+ "react-textarea-autosize": "^8.5.6"
37
+ },
38
+ "devDependencies": {
39
+ "@rollup/plugin-replace": "^6.0.2",
40
+ "@types/node": "^20.12.8",
41
+ "@types/ramda": "^0.30.2",
42
+ "@types/react": "^18.3.1",
43
+ "@types/react-dom": "^18.3.0",
44
+ "@typescript-eslint/eslint-plugin": "^7.8.0",
45
+ "@typescript-eslint/parser": "^7.8.0",
46
+ "@vitejs/plugin-react": "^4.2.1",
47
+ "autoprefixer": "^10.4.19",
48
+ "eslint-config-nlx": "*",
49
+ "postcss": "^8.4.38",
50
+ "tailwindcss": "^3.4.3",
51
+ "typescript": "^5.4.5",
52
+ "vite": "^5.2.11",
53
+ "vite-plugin-dts": "^4.5.0"
54
+ },
55
+ "publishConfig": {
56
+ "access": "public"
57
+ },
58
+ "gitHead": "89c742910b9622c992ce0579769c12dba6ed7557"
59
+ }
@@ -0,0 +1,6 @@
1
+ export default {
2
+ plugins: {
3
+ tailwindcss: {},
4
+ autoprefixer: {},
5
+ },
6
+ };
Binary file
@@ -0,0 +1,50 @@
1
+ /** @type {import('tailwindcss').Config} */
2
+ module.exports = {
3
+ content: ["./src/**/*.{ts,tsx}"],
4
+ prefix: "",
5
+ theme: {
6
+ fontFamily: {
7
+ sans: ["var(--font-family)"],
8
+ },
9
+ extend: {
10
+ backdropBlur: {
11
+ overlay: "48px",
12
+ },
13
+ maxWidth: {
14
+ content: "608px",
15
+ },
16
+ borderRadius: {
17
+ base: "12px",
18
+ plus: "20px",
19
+ },
20
+ zIndex: {
21
+ touchpoint: 1000,
22
+ launchButton: 100,
23
+ },
24
+ colors: {
25
+ "primary-80": "var(--primary-80)",
26
+ "primary-60": "var(--primary-60)",
27
+ "primary-40": "var(--primary-40)",
28
+ "primary-20": "var(--primary-20)",
29
+ "primary-10": "var(--primary-10)",
30
+ "primary-5": "var(--primary-5)",
31
+ "primary-1": "var(--primary-1)",
32
+ "secondary-80": "var(--secondary-80)",
33
+ "secondary-60": "var(--secondary-60)",
34
+ "secondary-40": "var(--secondary-40)",
35
+ "secondary-20": "var(--secondary-20)",
36
+ "secondary-10": "var(--secondary-10)",
37
+ "secondary-5": "var(--secondary-5)",
38
+ "secondary-1": "var(--secondary-1)",
39
+ accent: "var(--accent)",
40
+ "accent-20": "var(--accent-20)",
41
+ background: "var(--background)",
42
+ overlay: "var(--overlay)",
43
+ "warning-primary": "var(--warning-primary)",
44
+ "warning-secondary": "var(--warning-secondary)",
45
+ "error-primary": "var(--error-primary)",
46
+ "error-secondary": "var(--error-secondary)",
47
+ },
48
+ },
49
+ },
50
+ };
package/tsconfig.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "extends": "./../../tsconfig.json",
4
+ "compilerOptions": {
5
+ "lib": ["dom"],
6
+ "outDir": "./lib",
7
+ "rootDir": "./src"
8
+ },
9
+ "include": ["./src/**/*"]
10
+ }
package/vite.config.ts ADDED
@@ -0,0 +1,47 @@
1
+ import { resolve } from "path";
2
+ import react from "@vitejs/plugin-react";
3
+ import replace from "@rollup/plugin-replace";
4
+ import { defineConfig } from "vite";
5
+ import dts from "vite-plugin-dts";
6
+
7
+ /**
8
+ * Adjust the JS entry point if the app is run in prototype or review modes
9
+ */
10
+ const adjustJsEntryPoint = ({ mode }: { mode: string }): any => {
11
+ return {
12
+ name: "html-transform",
13
+ order: "pre",
14
+ transformIndexHtml: (html: string) => {
15
+ const entryPoint = "/src/index.tsx";
16
+ if (mode === "design-system") {
17
+ return html.replace(entryPoint, "/src/design-system.tsx");
18
+ }
19
+ return html;
20
+ },
21
+ };
22
+ };
23
+
24
+ // https://vitejs.dev/config/
25
+ export default defineConfig(({ mode, command }) => ({
26
+ plugins: [
27
+ react(),
28
+ replace(
29
+ command === "serve"
30
+ ? {}
31
+ : {
32
+ "process.env.NODE_ENV": JSON.stringify("production"),
33
+ },
34
+ ),
35
+ adjustJsEntryPoint({ mode }),
36
+ dts(),
37
+ ],
38
+ resolve: {},
39
+ build: {
40
+ outDir: "lib",
41
+ lib: {
42
+ entry: resolve(__dirname, "./src/index.tsx"),
43
+ name: "nlxai.touchpointUi",
44
+ fileName: "index",
45
+ },
46
+ },
47
+ }));