@deepfrog/pangents-widget 2.2.2 → 3.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.
Files changed (63) hide show
  1. package/README.md +29 -17
  2. package/dist/Widget.d.ts +4 -1
  3. package/dist/components/ChatbotWidget.d.ts +2 -0
  4. package/dist/components/CountryCodePicker.d.ts +9 -0
  5. package/dist/components/WidgetPopup.d.ts +2 -1
  6. package/dist/context/ChatContext.d.ts +5 -1
  7. package/dist/index.cjs.js +2 -2
  8. package/dist/index.cjs.js.map +1 -1
  9. package/dist/index.es.js +10 -16
  10. package/dist/index.es.js.map +1 -1
  11. package/dist/index.html +837 -0
  12. package/dist/pages/DataAgent/Components/AIAnswerRenderer.d.ts +6 -0
  13. package/dist/pages/DataAgent/Components/ChatHistory.d.ts +14 -0
  14. package/dist/pages/DataAgent/Components/ChatInput.d.ts +10 -0
  15. package/dist/pages/DataAgent/Components/DataAgentHeader.d.ts +8 -0
  16. package/dist/pages/DataAgent/Components/MessageBubble.d.ts +8 -0
  17. package/dist/pages/DataAgent/Components/WelcomeScreen.d.ts +6 -0
  18. package/dist/pages/DataAgent/Components/index.d.ts +5 -0
  19. package/dist/pages/DataAgent/index.d.ts +1 -0
  20. package/dist/pages/DataAgentV2/Components/AIAnswerRenderer.d.ts +6 -0
  21. package/dist/pages/DataAgentV2/Components/ChartRenderer.d.ts +10 -0
  22. package/dist/pages/DataAgentV2/Components/ChatHistory.d.ts +14 -0
  23. package/dist/pages/DataAgentV2/Components/ChatInput.d.ts +34 -0
  24. package/dist/pages/DataAgentV2/Components/DataAgentHeader.d.ts +9 -0
  25. package/dist/pages/DataAgentV2/Components/LoadingStepper.d.ts +5 -0
  26. package/dist/pages/DataAgentV2/Components/MessageBubble.d.ts +9 -0
  27. package/dist/pages/DataAgentV2/Components/WelcomeScreen.d.ts +6 -0
  28. package/dist/pages/DataAgentV2/Components/index.d.ts +5 -0
  29. package/dist/pages/DataAgentV2/index.d.ts +1 -0
  30. package/dist/pages/EmailLeads/LeadAction.d.ts +1 -0
  31. package/dist/pangents-widget.css +1 -1
  32. package/dist/preview-isolation.html +1 -0
  33. package/dist/preview-new.html +1 -0
  34. package/dist/preview-playground.html +792 -0
  35. package/dist/preview-production.html +293 -0
  36. package/dist/preview-staging.html +293 -0
  37. package/dist/preview.html +3 -4
  38. package/dist/services/api/client.d.ts +3 -0
  39. package/dist/services/api/dataAgentService.d.ts +38 -0
  40. package/dist/services/api/dataAgentServiceV2.d.ts +40 -0
  41. package/dist/services/api/emailLeadsService.d.ts +35 -0
  42. package/dist/services/mock/mockDataAgentService.d.ts +34 -0
  43. package/dist/services/mock/mockDataAgentServiceV2.d.ts +34 -0
  44. package/dist/stores/dataAgentStore.d.ts +37 -0
  45. package/dist/stores/dataAgentStoreV2.d.ts +40 -0
  46. package/dist/types/dataAgent.d.ts +37 -0
  47. package/dist/types/dataAgentV2.d.ts +97 -0
  48. package/dist/types/email.d.ts +28 -0
  49. package/dist/types/index.d.ts +0 -2
  50. package/dist/utils/countryCodes.d.ts +11 -0
  51. package/dist/widget-embed-CmAr6iD-.cjs.js +90 -0
  52. package/dist/widget-embed-CmAr6iD-.cjs.js.map +1 -0
  53. package/dist/widget-embed-DgNAEfZX.es.js +83784 -0
  54. package/dist/widget-embed-DgNAEfZX.es.js.map +1 -0
  55. package/dist/widget-embed.cjs.js +2 -2
  56. package/dist/widget-embed.d.ts +3 -0
  57. package/dist/widget-embed.es.js +2 -2
  58. package/dist/widget.js +76792 -23925
  59. package/package.json +5 -1
  60. package/dist/widget-embed-DCSN_j6Y.cjs.js +0 -46
  61. package/dist/widget-embed-DCSN_j6Y.cjs.js.map +0 -1
  62. package/dist/widget-embed-DzLM7DN8.es.js +0 -29838
  63. package/dist/widget-embed-DzLM7DN8.es.js.map +0 -1
@@ -16,6 +16,41 @@ export declare class EmailLeadsService {
16
16
  * Get a single lead by ID
17
17
  */
18
18
  static getLeadById(leadId: string): Promise<EmailLead>;
19
+ /**
20
+ * Submit lead action to update lead details
21
+ * POST /crm/leads/lead/action/
22
+ *
23
+ * Scenarios:
24
+ * - Both flags TRUE: requires mandatory core fields + shipper fields
25
+ * - Only required_fields TRUE: requires mandatory core fields only
26
+ * - Only prospect_creation TRUE: requires shipper fields only
27
+ * - Both FALSE: no required fields (default case)
28
+ */
29
+ static submitLeadAction(leadId: string, payload: LeadActionPayload): Promise<{
30
+ success: boolean;
31
+ lead: EmailLead;
32
+ }>;
33
+ /**
34
+ * Fetch equipment types from backend
35
+ */
36
+ static getEquipmentTypes(): Promise<string[]>;
37
+ }
38
+ export interface LeadActionPayload {
39
+ equipmentType?: string;
40
+ equipmentSize?: number;
41
+ loadType?: string;
42
+ shipperTargetPrice?: number;
43
+ shipperCompanyName?: string;
44
+ shipperName?: string;
45
+ shipperEmail?: string;
46
+ shipperPhone?: string;
47
+ shipperCountryCode?: string;
48
+ shipperAddress?: string;
49
+ shipperCity?: string;
50
+ shipperState?: string;
51
+ shipperZipCode?: string;
52
+ shipperLatitude?: number;
53
+ shipperLongitude?: number;
19
54
  }
20
55
  export declare function transformApiLeadEmail(apiEmail: ApiLeadEmail): LeadEmail;
21
56
  export declare class EmailConversationService {
@@ -0,0 +1,34 @@
1
+ import type { DataAgentConversation } from '../../types/dataAgent';
2
+ export declare class MockDataAgentService {
3
+ /**
4
+ * Get all conversation history
5
+ */
6
+ static getConversations(): Promise<DataAgentConversation[]>;
7
+ /**
8
+ * Get a specific conversation by ID
9
+ */
10
+ static getConversation(conversationId: string): Promise<DataAgentConversation | null>;
11
+ /**
12
+ * Send a query and get a response
13
+ */
14
+ static sendQuery(query: string, conversationId?: string): Promise<{
15
+ success: boolean;
16
+ response: string;
17
+ conversationId: string;
18
+ messageId: string;
19
+ }>;
20
+ /**
21
+ * Submit feedback for a message
22
+ */
23
+ static submitFeedback(messageId: string, feedback: 'positive' | 'negative'): Promise<{
24
+ success: boolean;
25
+ message: string;
26
+ }>;
27
+ /**
28
+ * Delete a conversation
29
+ */
30
+ static deleteConversation(conversationId: string): Promise<{
31
+ success: boolean;
32
+ }>;
33
+ }
34
+ export default MockDataAgentService;
@@ -0,0 +1,34 @@
1
+ import type { DataAgentConversation } from '../../types/dataAgent';
2
+ export declare class MockDataAgentServiceV2 {
3
+ /**
4
+ * Get all conversation history
5
+ */
6
+ static getConversations(): Promise<DataAgentConversation[]>;
7
+ /**
8
+ * Get a specific conversation by ID
9
+ */
10
+ static getConversation(conversationId: string): Promise<DataAgentConversation | null>;
11
+ /**
12
+ * Send a query and get a response
13
+ */
14
+ static sendQuery(query: string, conversationId?: string): Promise<{
15
+ success: boolean;
16
+ response: string;
17
+ conversationId: string;
18
+ messageId: string;
19
+ }>;
20
+ /**
21
+ * Submit feedback for a message
22
+ */
23
+ static submitFeedback(messageId: string, feedback: 'positive' | 'negative'): Promise<{
24
+ success: boolean;
25
+ message: string;
26
+ }>;
27
+ /**
28
+ * Delete a conversation
29
+ */
30
+ static deleteConversation(conversationId: string): Promise<{
31
+ success: boolean;
32
+ }>;
33
+ }
34
+ export default MockDataAgentServiceV2;
@@ -0,0 +1,37 @@
1
+ import type { DataAgentMessage, FeedbackType, SuggestedQuestion, DataAgentConversation } from '../types/dataAgent';
2
+ export declare const SUGGESTED_QUESTIONS: SuggestedQuestion[];
3
+ interface DataAgentState {
4
+ messages: DataAgentMessage[];
5
+ conversationId: string | null;
6
+ conversations: DataAgentConversation[];
7
+ isLoadingHistory: boolean;
8
+ showHistory: boolean;
9
+ isLoading: boolean;
10
+ isSending: boolean;
11
+ error: string | null;
12
+ inputValue: string;
13
+ setInputValue: (value: string) => void;
14
+ sendMessage: (content: string) => Promise<void>;
15
+ submitFeedback: (messageId: string, feedback: FeedbackType) => Promise<void>;
16
+ clearConversation: () => void;
17
+ selectSuggestedQuestion: (question: string) => void;
18
+ fetchConversations: () => Promise<void>;
19
+ loadConversation: (conversationId: string) => Promise<void>;
20
+ deleteConversation: (conversationId: string) => Promise<void>;
21
+ toggleHistory: () => void;
22
+ startNewConversation: () => void;
23
+ reset: () => void;
24
+ }
25
+ export declare const useDataAgentStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<DataAgentState>, "subscribe"> & {
26
+ subscribe: {
27
+ (listener: (selectedState: DataAgentState, previousSelectedState: DataAgentState) => void): () => void;
28
+ <U>(selector: (state: DataAgentState) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
29
+ equalityFn?: (a: U, b: U) => boolean;
30
+ fireImmediately?: boolean;
31
+ }): () => void;
32
+ };
33
+ }>;
34
+ export declare const useDataAgentMessages: () => DataAgentMessage[];
35
+ export declare const useDataAgentLoading: () => boolean;
36
+ export declare const useDataAgentError: () => string;
37
+ export {};
@@ -0,0 +1,40 @@
1
+ import type { ChatSessionV2, ChatMessageV2, FeedbackTypeV2, SuggestedQuestionV2 } from '../types/dataAgentV2';
2
+ export declare const SUGGESTED_QUESTIONS_V2: SuggestedQuestionV2[];
3
+ interface DataAgentStateV2 {
4
+ messages: ChatMessageV2[];
5
+ conversationId: string | null;
6
+ sessions: ChatSessionV2[];
7
+ isLoadingHistory: boolean;
8
+ showHistory: boolean;
9
+ nextCursor: string | null;
10
+ isLoadingOlderTurns: boolean;
11
+ hasOlderTurns: boolean;
12
+ isLoading: boolean;
13
+ isSending: boolean;
14
+ error: string | null;
15
+ inputValue: string;
16
+ setInputValue: (value: string) => void;
17
+ sendMessage: (content: string) => Promise<void>;
18
+ submitFeedback: (messageId: string, feedback: FeedbackTypeV2) => Promise<void>;
19
+ clearConversation: () => void;
20
+ fetchSessions: () => Promise<void>;
21
+ loadSession: (chatSessionId: string) => Promise<void>;
22
+ loadOlderTurns: () => Promise<void>;
23
+ deleteSession: (chatSessionId: string) => Promise<void>;
24
+ toggleHistory: () => void;
25
+ startNewConversation: () => void;
26
+ reset: () => void;
27
+ }
28
+ export declare const useDataAgentStoreV2: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<DataAgentStateV2>, "subscribe"> & {
29
+ subscribe: {
30
+ (listener: (selectedState: DataAgentStateV2, previousSelectedState: DataAgentStateV2) => void): () => void;
31
+ <U>(selector: (state: DataAgentStateV2) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
32
+ equalityFn?: (a: U, b: U) => boolean;
33
+ fireImmediately?: boolean;
34
+ }): () => void;
35
+ };
36
+ }>;
37
+ export declare const useDataAgentMessagesV2: () => ChatMessageV2[];
38
+ export declare const useDataAgentLoadingV2: () => boolean;
39
+ export declare const useDataAgentErrorV2: () => string;
40
+ export {};
@@ -0,0 +1,37 @@
1
+ export type FeedbackType = 'positive' | 'negative' | null;
2
+ export interface DataAgentMessage {
3
+ id: string;
4
+ content: string;
5
+ role: 'user' | 'assistant';
6
+ timestamp: string;
7
+ feedback?: FeedbackType;
8
+ isLoading?: boolean;
9
+ }
10
+ export interface DataAgentConversation {
11
+ id: string;
12
+ messages: DataAgentMessage[];
13
+ createdAt: string;
14
+ updatedAt: string;
15
+ }
16
+ export interface SuggestedQuestion {
17
+ id: string;
18
+ text: string;
19
+ icon?: string;
20
+ }
21
+ export interface DataAgentQueryRequest {
22
+ question: string;
23
+ }
24
+ export interface ApiDataAgentResponse {
25
+ data: {
26
+ question: string;
27
+ answer: string;
28
+ };
29
+ }
30
+ export interface DataAgentFeedbackRequest {
31
+ message_id: string;
32
+ feedback: 'positive' | 'negative';
33
+ }
34
+ export interface ApiDataAgentFeedbackResponse {
35
+ success: boolean;
36
+ message: string;
37
+ }
@@ -0,0 +1,97 @@
1
+ export type FeedbackTypeV2 = 'positive' | 'negative' | null;
2
+ export type ResponseType = 'text_markdown' | 'image_png' | 'serial_data' | 'serial_data_bar' | 'serial_data_line' | 'serial_data_scatter' | 'pie_chart_data';
3
+ export interface ApiChatSession {
4
+ id: string;
5
+ chat_session_id: string;
6
+ user_id: string;
7
+ tenant_id: string;
8
+ chat_title: string | null;
9
+ chat_created_date_with_time_stamp: string;
10
+ chat_updated_date_with_time_stamp: string;
11
+ total_turns: number;
12
+ }
13
+ export interface ApiChatTurn {
14
+ id: string;
15
+ chat_session_id: string;
16
+ user_id: string;
17
+ tenant_id: string;
18
+ turn_id: string;
19
+ turn_creation_date_time_stamp: string;
20
+ user_prompt: string;
21
+ agent_response_markdown: string | null;
22
+ generated_sql: string | null;
23
+ response_type: ResponseType;
24
+ serial_data: SerialData | null;
25
+ image_url: string | null;
26
+ feedback: TurnFeedback | null;
27
+ meta_data: TurnMetaData | null;
28
+ }
29
+ export interface SerialData {
30
+ graph_type: string;
31
+ data: {
32
+ x: string[];
33
+ y: number[];
34
+ };
35
+ legends: {
36
+ title: string;
37
+ x: string;
38
+ y: string;
39
+ };
40
+ }
41
+ export interface PieChartData {
42
+ graph_type: 'pie';
43
+ data: {
44
+ labels: string[];
45
+ values: number[];
46
+ };
47
+ legends: {
48
+ title: string;
49
+ };
50
+ }
51
+ export interface TurnFeedback {
52
+ type: 'positive' | 'negative';
53
+ }
54
+ export interface TurnMetaData {
55
+ execution_status: string;
56
+ row_count: number;
57
+ retry_count: number;
58
+ has_visualization: boolean;
59
+ has_summary: boolean;
60
+ last_executed_sql_query: string;
61
+ last_user_query_executed_sql: string;
62
+ }
63
+ export interface ApiChatTurnsResponse {
64
+ turns: ApiChatTurn[];
65
+ next_cursor: string | null;
66
+ }
67
+ export interface ApiChatPromptRequest {
68
+ prompt: string;
69
+ conversation_id?: string;
70
+ mock?: boolean;
71
+ }
72
+ export interface ChatSessionV2 {
73
+ id: string;
74
+ chatSessionId: string;
75
+ title: string | null;
76
+ createdAt: string;
77
+ updatedAt: string;
78
+ totalTurns: number;
79
+ }
80
+ export interface ChatMessageV2 {
81
+ id: string;
82
+ turnId: string;
83
+ content: string;
84
+ role: 'user' | 'assistant';
85
+ timestamp: string;
86
+ feedback: FeedbackTypeV2;
87
+ isLoading?: boolean;
88
+ responseType?: ResponseType;
89
+ serialData?: SerialData | null;
90
+ imageUrl?: string | null;
91
+ generatedSql?: string | null;
92
+ metaData?: TurnMetaData | null;
93
+ }
94
+ export interface SuggestedQuestionV2 {
95
+ id: string;
96
+ text: string;
97
+ }
@@ -9,6 +9,14 @@ export interface ApiEmailLead {
9
9
  shipper_email: string;
10
10
  shipper_name: string;
11
11
  shipper_company_name: string | null;
12
+ shipper_phone: string | null;
13
+ shipper_country_code: string | null;
14
+ shipper_address: string | null;
15
+ shipper_city: string | null;
16
+ shipper_state: string | null;
17
+ shipper_zip_code: string | null;
18
+ shipper_latitude: number | null;
19
+ shipper_longitude: number | null;
12
20
  origin: string;
13
21
  destination: string;
14
22
  pickup_timestamp: string | null;
@@ -26,11 +34,17 @@ export interface ApiEmailLead {
26
34
  receiver_email: string | null;
27
35
  received_datetime: string | null;
28
36
  status: EmailStatus;
37
+ action_needed: boolean;
38
+ required_fields: boolean;
39
+ prospect_creation: boolean;
29
40
  is_duplicate: boolean;
30
41
  duplicate_of: string | null;
31
42
  notes: string | null;
32
43
  created_at: string;
33
44
  updated_at: string;
45
+ external_identifier: string | null;
46
+ equipment_size: number | null;
47
+ shipper_target_price: number | null;
34
48
  }
35
49
  export interface EmailLead {
36
50
  id: string;
@@ -39,6 +53,14 @@ export interface EmailLead {
39
53
  shipperEmail: string;
40
54
  shipperName: string;
41
55
  shipperCompanyName: string | null;
56
+ shipperPhone: string | null;
57
+ shipperCountryCode: string | null;
58
+ shipperAddress: string | null;
59
+ shipperCity: string | null;
60
+ shipperState: string | null;
61
+ shipperZipCode: string | null;
62
+ shipperLatitude: number | null;
63
+ shipperLongitude: number | null;
42
64
  origin: string;
43
65
  destination: string;
44
66
  pickupTimestamp: string | null;
@@ -56,11 +78,17 @@ export interface EmailLead {
56
78
  receiverEmail: string | null;
57
79
  receivedDatetime: string | null;
58
80
  status: EmailStatus;
81
+ actionNeeded: boolean;
82
+ requiredFields: boolean;
83
+ prospectCreation: boolean;
59
84
  isDuplicate: boolean;
60
85
  duplicateOf: string | null;
61
86
  notes: string | null;
62
87
  createdAt: string;
63
88
  updatedAt: string;
89
+ externalIdentifier: string | null;
90
+ equipmentSize: number | null;
91
+ shipperTargetPrice: number | null;
64
92
  }
65
93
  export interface EmailLeadsApiResponse {
66
94
  success: boolean;
@@ -15,8 +15,6 @@ export interface WidgetTheme {
15
15
  primaryColor?: string;
16
16
  headerBg?: string;
17
17
  headerText?: string;
18
- headerTitle?: string;
19
- headerLogo?: string;
20
18
  userBubble?: string;
21
19
  botBubble?: string;
22
20
  fontFamily?: string;
@@ -0,0 +1,11 @@
1
+ export interface Country {
2
+ code: string;
3
+ name: string;
4
+ dialCode: string;
5
+ flag: string;
6
+ }
7
+ export declare const COUNTRIES: Country[];
8
+ export declare const DEFAULT_COUNTRY: Country;
9
+ export declare const getCountryByCode: (code: string) => Country | undefined;
10
+ export declare const getCountryByDialCode: (dialCode: string) => Country | undefined;
11
+ export declare const formatPhoneNumber: (countryCode: string, phoneNumber: string) => string;