admesh-ui-sdk 0.3.1 → 0.4.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.
@@ -0,0 +1,248 @@
1
+ import React, { useState } from 'react';
2
+ import {
3
+ AdMeshConversationalUnit,
4
+ AdMeshConversationSummary,
5
+ AdMeshInlineRecommendation
6
+ } from 'admesh-ui-sdk';
7
+
8
+ // Sample conversation data
9
+ const sampleRecommendations = [
10
+ {
11
+ title: "HubSpot CRM",
12
+ reason: "Perfect for remote teams with excellent collaboration features and robust automation",
13
+ intent_match_score: 0.92,
14
+ admesh_link: "https://useadmesh.com/track?ad_id=hubspot-123",
15
+ ad_id: "hubspot-123",
16
+ product_id: "hubspot-crm",
17
+ has_free_tier: true,
18
+ trial_days: 14,
19
+ keywords: ["CRM", "Sales", "Marketing", "Automation"],
20
+ categories: ["Sales Tools", "CRM"],
21
+ features: ["Contact Management", "Deal Pipeline", "Email Integration"],
22
+ pricing: "Free tier available, paid plans from $45/month"
23
+ },
24
+ {
25
+ title: "Salesforce Sales Cloud",
26
+ reason: "Enterprise-grade CRM with advanced analytics and customization options",
27
+ intent_match_score: 0.87,
28
+ admesh_link: "https://useadmesh.com/track?ad_id=salesforce-456",
29
+ ad_id: "salesforce-456",
30
+ product_id: "salesforce-sales",
31
+ has_free_tier: false,
32
+ trial_days: 30,
33
+ keywords: ["CRM", "Enterprise", "Analytics", "Customization"],
34
+ categories: ["Sales Tools", "Enterprise Software"],
35
+ features: ["Advanced Analytics", "Custom Objects", "Workflow Automation"],
36
+ pricing: "Starting from $25/user/month"
37
+ },
38
+ {
39
+ title: "Pipedrive",
40
+ reason: "Simple and intuitive CRM designed for small to medium businesses",
41
+ intent_match_score: 0.81,
42
+ admesh_link: "https://useadmesh.com/track?ad_id=pipedrive-789",
43
+ ad_id: "pipedrive-789",
44
+ product_id: "pipedrive-crm",
45
+ has_free_tier: false,
46
+ trial_days: 14,
47
+ keywords: ["CRM", "Simple", "SMB", "Pipeline"],
48
+ categories: ["Sales Tools", "Small Business"],
49
+ features: ["Visual Pipeline", "Activity Reminders", "Email Sync"],
50
+ pricing: "Starting from $14.90/user/month"
51
+ }
52
+ ];
53
+
54
+ const conversationSummary = "We discussed your need for a CRM solution that works well for remote teams. You mentioned wanting good collaboration features, automation capabilities, and preferably something with a free tier to start. Based on your requirements, I've identified several options that match your criteria, with HubSpot CRM being the top recommendation due to its excellent free tier and collaboration features.";
55
+
56
+ export default function ConversationalUsageExample() {
57
+ const [activeDemo, setActiveDemo] = useState('inline');
58
+ const [showSummary, setShowSummary] = useState(false);
59
+
60
+ const handleRecommendationClick = (adId, admeshLink) => {
61
+ console.log('Recommendation clicked:', { adId, admeshLink });
62
+ // In a real app, this would open the tracked link
63
+ alert(`Opening recommendation: ${adId}`);
64
+ };
65
+
66
+ const handleStartNewConversation = () => {
67
+ console.log('Starting new conversation');
68
+ setShowSummary(false);
69
+ alert('Starting new conversation...');
70
+ };
71
+
72
+ const theme = {
73
+ mode: 'light',
74
+ accentColor: '#3b82f6'
75
+ };
76
+
77
+ return (
78
+ <div className="max-w-4xl mx-auto p-6 space-y-8">
79
+ <div className="text-center">
80
+ <h1 className="text-3xl font-bold text-gray-900 mb-4">
81
+ AdMesh Conversational Ad Units
82
+ </h1>
83
+ <p className="text-lg text-gray-600 mb-8">
84
+ Seamlessly integrate product recommendations into conversations and chat interfaces
85
+ </p>
86
+ </div>
87
+
88
+ {/* Demo Controls */}
89
+ <div className="bg-white rounded-lg border border-gray-200 p-6">
90
+ <h2 className="text-xl font-semibold mb-4">Interactive Demo</h2>
91
+ <div className="flex flex-wrap gap-2 mb-6">
92
+ <button
93
+ onClick={() => setActiveDemo('inline')}
94
+ className={`px-4 py-2 rounded-lg font-medium transition-colors ${
95
+ activeDemo === 'inline'
96
+ ? 'bg-blue-600 text-white'
97
+ : 'bg-gray-100 text-gray-700 hover:bg-gray-200'
98
+ }`}
99
+ >
100
+ Inline Mode
101
+ </button>
102
+ <button
103
+ onClick={() => setActiveDemo('minimal')}
104
+ className={`px-4 py-2 rounded-lg font-medium transition-colors ${
105
+ activeDemo === 'minimal'
106
+ ? 'bg-blue-600 text-white'
107
+ : 'bg-gray-100 text-gray-700 hover:bg-gray-200'
108
+ }`}
109
+ >
110
+ Minimal Mode
111
+ </button>
112
+ <button
113
+ onClick={() => setActiveDemo('floating')}
114
+ className={`px-4 py-2 rounded-lg font-medium transition-colors ${
115
+ activeDemo === 'floating'
116
+ ? 'bg-blue-600 text-white'
117
+ : 'bg-gray-100 text-gray-700 hover:bg-gray-200'
118
+ }`}
119
+ >
120
+ Floating Mode
121
+ </button>
122
+ <button
123
+ onClick={() => setShowSummary(!showSummary)}
124
+ className={`px-4 py-2 rounded-lg font-medium transition-colors ${
125
+ showSummary
126
+ ? 'bg-green-600 text-white'
127
+ : 'bg-gray-100 text-gray-700 hover:bg-gray-200'
128
+ }`}
129
+ >
130
+ {showSummary ? 'Hide' : 'Show'} Summary
131
+ </button>
132
+ </div>
133
+
134
+ {/* Demo Content */}
135
+ <div className="space-y-6">
136
+ {/* Simulated Chat Messages */}
137
+ <div className="bg-gray-50 rounded-lg p-4 space-y-4">
138
+ <div className="flex justify-end">
139
+ <div className="bg-blue-600 text-white rounded-lg px-4 py-2 max-w-xs">
140
+ I need a CRM for my remote team. Any recommendations?
141
+ </div>
142
+ </div>
143
+
144
+ <div className="flex justify-start">
145
+ <div className="bg-white rounded-lg px-4 py-2 max-w-md border border-gray-200">
146
+ I'd be happy to help you find the right CRM for your remote team!
147
+ Let me show you some great options that work well for distributed teams.
148
+ </div>
149
+ </div>
150
+
151
+ {/* Conversational Ad Unit */}
152
+ <AdMeshConversationalUnit
153
+ recommendations={sampleRecommendations}
154
+ config={{
155
+ displayMode: activeDemo,
156
+ context: 'chat',
157
+ maxRecommendations: 3,
158
+ showPoweredBy: true,
159
+ autoShow: true,
160
+ position: 'inline'
161
+ }}
162
+ theme={theme}
163
+ userQuery="I need a CRM for my remote team"
164
+ sessionId="demo-session-123"
165
+ onRecommendationClick={handleRecommendationClick}
166
+ onDismiss={() => console.log('Dismissed')}
167
+ />
168
+ </div>
169
+
170
+ {/* Conversation Summary */}
171
+ {showSummary && (
172
+ <AdMeshConversationSummary
173
+ recommendations={sampleRecommendations}
174
+ conversationSummary={conversationSummary}
175
+ theme={theme}
176
+ showTopRecommendations={3}
177
+ onRecommendationClick={handleRecommendationClick}
178
+ onStartNewConversation={handleStartNewConversation}
179
+ />
180
+ )}
181
+ </div>
182
+ </div>
183
+
184
+ {/* Individual Component Examples */}
185
+ <div className="bg-white rounded-lg border border-gray-200 p-6">
186
+ <h2 className="text-xl font-semibold mb-4">Individual Components</h2>
187
+
188
+ <div className="space-y-6">
189
+ <div>
190
+ <h3 className="text-lg font-medium mb-3">Inline Recommendation (Compact)</h3>
191
+ <AdMeshInlineRecommendation
192
+ recommendation={sampleRecommendations[0]}
193
+ theme={theme}
194
+ compact={true}
195
+ showReason={false}
196
+ onClick={handleRecommendationClick}
197
+ />
198
+ </div>
199
+
200
+ <div>
201
+ <h3 className="text-lg font-medium mb-3">Inline Recommendation (Full)</h3>
202
+ <AdMeshInlineRecommendation
203
+ recommendation={sampleRecommendations[0]}
204
+ theme={theme}
205
+ compact={false}
206
+ showReason={true}
207
+ onClick={handleRecommendationClick}
208
+ />
209
+ </div>
210
+ </div>
211
+ </div>
212
+
213
+ {/* Usage Examples */}
214
+ <div className="bg-white rounded-lg border border-gray-200 p-6">
215
+ <h2 className="text-xl font-semibold mb-4">Usage Examples</h2>
216
+
217
+ <div className="space-y-4">
218
+ <div>
219
+ <h3 className="font-medium text-gray-900 mb-2">Basic Inline Usage</h3>
220
+ <pre className="bg-gray-100 rounded p-3 text-sm overflow-x-auto">
221
+ {`<AdMeshConversationalUnit
222
+ recommendations={recommendations}
223
+ config={{
224
+ displayMode: 'inline',
225
+ context: 'chat',
226
+ maxRecommendations: 3
227
+ }}
228
+ onRecommendationClick={(adId, link) => window.open(link)}
229
+ />`}
230
+ </pre>
231
+ </div>
232
+
233
+ <div>
234
+ <h3 className="font-medium text-gray-900 mb-2">Conversation Summary</h3>
235
+ <pre className="bg-gray-100 rounded p-3 text-sm overflow-x-auto">
236
+ {`<AdMeshConversationSummary
237
+ recommendations={recommendations}
238
+ conversationSummary="Your conversation summary here..."
239
+ onRecommendationClick={(adId, link) => window.open(link)}
240
+ onStartNewConversation={() => startNewChat()}
241
+ />`}
242
+ </pre>
243
+ </div>
244
+ </div>
245
+ </div>
246
+ </div>
247
+ );
248
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "admesh-ui-sdk",
3
- "version": "0.3.1",
4
- "description": "Beautiful, modern React components for displaying AI-powered product recommendations with Tailwind CSS styling and built-in tracking",
3
+ "version": "0.4.0",
4
+ "description": "Beautiful, modern React components for displaying AI-powered product recommendations with conversational ad units, chat integration, and built-in tracking",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.mjs",
@@ -17,6 +17,7 @@
17
17
  "dist",
18
18
  "README.md",
19
19
  "INTEGRATION_GUIDE.md",
20
+ "CONVERSATIONAL_GUIDE.md",
20
21
  "USAGE.md",
21
22
  "examples"
22
23
  ],
@@ -47,7 +48,12 @@
47
48
  "cards",
48
49
  "comparison-table",
49
50
  "dark-mode",
50
- "responsive"
51
+ "responsive",
52
+ "conversational",
53
+ "chat",
54
+ "ai-assistant",
55
+ "inline-ads",
56
+ "conversation-summary"
51
57
  ],
52
58
  "author": "AdMesh",
53
59
  "license": "MIT",