@debales/ai 1.2.6 → 1.3.0-canary.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.
@@ -1,6 +1,6 @@
1
1
  import { default as React, InputHTMLAttributes } from 'react';
2
2
  export interface FormError {
3
- field: "name" | "email" | "phone";
3
+ field: "name" | "email" | "phone" | "company";
4
4
  message: string;
5
5
  }
6
6
  interface FormFieldProps extends InputHTMLAttributes<HTMLInputElement> {
@@ -1,6 +1,6 @@
1
1
  import { default as React, InputHTMLAttributes } from 'react';
2
2
  export interface FormError {
3
- field: "name" | "email" | "phone";
3
+ field: "name" | "email" | "phone" | "company";
4
4
  message: string;
5
5
  }
6
6
  interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
@@ -0,0 +1,9 @@
1
+ import { default as React } from 'react';
2
+ import { Message, UiData } from '../../types';
3
+ interface ResourceCardsSliderProps {
4
+ message: Message;
5
+ botId: string;
6
+ uidata: UiData;
7
+ }
8
+ declare const ResourceCardsSlider: React.FC<ResourceCardsSliderProps>;
9
+ export default ResourceCardsSlider;
@@ -5,10 +5,15 @@ declare global {
5
5
  _klOnsite: any;
6
6
  }
7
7
  }
8
+ type FormMode = "user-info" | "lead-capture";
8
9
  interface Props {
9
10
  setShowModel: React.Dispatch<React.SetStateAction<boolean>>;
10
11
  inChat?: boolean;
11
12
  showFormInstructions?: boolean;
13
+ mode?: FormMode;
14
+ isVisible?: boolean;
15
+ instructionText?: string;
16
+ onSubmitted?: () => void;
12
17
  }
13
- export declare const UserInfoModel: ({ inChat, showFormInstructions, setShowModel, }: Props) => import("react/jsx-runtime").JSX.Element | null;
18
+ export declare const UserInfoModel: ({ inChat, showFormInstructions, setShowModel, mode, isVisible, instructionText, onSubmitted, }: Props) => import("react/jsx-runtime").JSX.Element | null;
14
19
  export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
File without changes
@@ -1,5 +1,5 @@
1
1
  import { CartState, EVENT_TYPE, LeadingQueries, MESSAGE_ROLE, MessageEvent, UserInfo } from '@debales/shared';
2
- import { DisplayMode, Product, ShopifyStoreMeta, SuggestedQuestionAnswer, UiData, VariantQuantity, Message } from '.';
2
+ import { DisplayMode, LeadCaptureData, Product, ShopifyStoreMeta, SuggestedQuestionAnswer, UiData, VariantQuantity, Message } from '.';
3
3
  export interface OnSendMessageOptions {
4
4
  message: string;
5
5
  answer?: string;
@@ -28,6 +28,7 @@ export interface DebalesContextType {
28
28
  pendingQuestion: SuggestedQuestionAnswer | null;
29
29
  isFormClosedByUser: boolean;
30
30
  onSendMessage: (options: OnSendMessageOptions) => Promise<void>;
31
+ submitLeadCapture: (lead: LeadCaptureData) => Promise<boolean>;
31
32
  setIsKlaviyoMessage: React.Dispatch<React.SetStateAction<boolean>>;
32
33
  setShowUserInfoModel: React.Dispatch<React.SetStateAction<boolean>>;
33
34
  setPendingBulkItems: React.Dispatch<React.SetStateAction<VariantQuantity[]>>;
@@ -50,6 +51,7 @@ export interface WebsocketMessageEvent extends MessageEvent {
50
51
  role: (typeof MESSAGE_ROLE)[keyof typeof MESSAGE_ROLE];
51
52
  query: string;
52
53
  nameSpace: string;
54
+ page_path?: string;
53
55
  conversationId?: string;
54
56
  userInfo?: UserInfo;
55
57
  anonymousUserId?: string;
@@ -95,6 +95,27 @@ export interface Product {
95
95
  variants?: IProductVariant[];
96
96
  options?: IProductOption[];
97
97
  }
98
+ export interface ResourceCard {
99
+ title: string;
100
+ snippet?: string;
101
+ url: string;
102
+ source?: string;
103
+ image_url?: string | null;
104
+ type?: string | null;
105
+ source_type?: string | null;
106
+ industries?: string[];
107
+ agent?: string | null;
108
+ }
109
+ export interface ChatCta {
110
+ type?: "route" | "lead_capture" | "booking" | string | null;
111
+ target_url?: string;
112
+ booking_url?: string | null;
113
+ }
114
+ export interface LeadCaptureData {
115
+ name: string;
116
+ email: string;
117
+ company: string;
118
+ }
98
119
  export interface SuggestedQuestionAnswer {
99
120
  question: string;
100
121
  answer?: string;
@@ -118,6 +139,9 @@ export interface Message {
118
139
  }
119
140
  ];
120
141
  products?: Product[];
142
+ cards?: ResourceCard[];
143
+ cta?: ChatCta | null;
144
+ booking_url?: string | null;
121
145
  variants?: [
122
146
  {
123
147
  id: string;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@debales/ai",
3
3
  "private": false,
4
4
  "access": "public",
5
- "version": "1.2.6",
5
+ "version": "1.3.0-canary.0",
6
6
  "type": "module",
7
7
  "main": "./dist/module/ai.js",
8
8
  "types": "./dist/module/index.d.ts",
@@ -42,26 +42,31 @@
42
42
  },
43
43
  "devDependencies": {
44
44
  "@eslint/js": "^9.21.0",
45
+ "@testing-library/jest-dom": "^6.9.1",
46
+ "@testing-library/react": "^16.3.2",
45
47
  "@types/crypto-js": "^4.2.2",
46
48
  "@types/mixpanel-browser": "^2.54.0",
47
49
  "@types/react": "^19.0.10",
48
50
  "@types/react-dom": "^19.0.4",
49
51
  "@types/validator": "^13.12.2",
50
52
  "@vitejs/plugin-react-swc": "^3.8.0",
53
+ "@vitest/coverage-v8": "4.0.18",
51
54
  "eslint": "^9.21.0",
52
55
  "eslint-plugin-react-hooks": "^5.1.0",
53
56
  "eslint-plugin-react-refresh": "^0.4.19",
54
57
  "globals": "^15.15.0",
58
+ "jsdom": "^28.0.0",
55
59
  "react": "^19.0.0",
56
60
  "react-dom": "^19.0.0",
57
61
  "styled-components": "^6.1.17",
58
62
  "typescript": "~5.7.2",
59
63
  "typescript-eslint": "^8.24.1",
60
- "vite": "^6.2.0",
64
+ "vite": "~6.4.2",
61
65
  "vite-plugin-dts": "^4.5.3",
62
- "@debales/typescript-config": "0.0.0",
66
+ "vitest": "^4.0.18",
67
+ "@debales/eslint-config": "0.0.0",
63
68
  "@debales/shared": "0.0.1",
64
- "@debales/eslint-config": "0.0.0"
69
+ "@debales/typescript-config": "0.0.0"
65
70
  },
66
71
  "peerDependencies": {
67
72
  "react": "^18.0.0 || ^19.0.0",
@@ -81,6 +86,9 @@
81
86
  "build:lib": "tsc -b && vite build",
82
87
  "build:browser": "tsc -b && vite build --config vite.browser.config.ts",
83
88
  "lint": "eslint --fix .",
84
- "preview": "vite preview"
89
+ "preview": "vite preview",
90
+ "test": "vitest",
91
+ "test:ui": "vitest --ui",
92
+ "test:coverage": "vitest --coverage"
85
93
  }
86
94
  }