admesh-ui-sdk 0.1.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/INTEGRATION_GUIDE.md +407 -0
- package/LICENSE +21 -0
- package/README.md +187 -0
- package/USAGE.md +348 -0
- package/dist/admesh-ui-sdk.css +1 -0
- package/dist/index.d.ts +187 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +858 -0
- package/dist/index.mjs.map +1 -0
- package/dist/vite.svg +1 -0
- package/examples/basic-usage.jsx +117 -0
- package/examples/custom-styling.jsx +297 -0
- package/examples/nextjs-integration.jsx +246 -0
- package/package.json +100 -0
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
# AdMesh UI SDK - Integration Guide
|
|
2
|
+
|
|
3
|
+
Complete guide for integrating AdMesh UI components into your application.
|
|
4
|
+
|
|
5
|
+
## 🚀 Getting Started
|
|
6
|
+
|
|
7
|
+
### Step 1: Install the Package
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install admesh-ui-sdk
|
|
11
|
+
# or
|
|
12
|
+
yarn add admesh-ui-sdk
|
|
13
|
+
# or
|
|
14
|
+
pnpm add admesh-ui-sdk
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Step 2: Import Styles
|
|
18
|
+
|
|
19
|
+
**Important**: Always import the CSS file for proper styling:
|
|
20
|
+
|
|
21
|
+
```jsx
|
|
22
|
+
import 'admesh-ui-sdk/dist/style.css';
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Step 3: Use Components
|
|
26
|
+
|
|
27
|
+
```jsx
|
|
28
|
+
import { AdMeshLayout } from 'admesh-ui-sdk';
|
|
29
|
+
import 'admesh-ui-sdk/dist/style.css';
|
|
30
|
+
|
|
31
|
+
function App() {
|
|
32
|
+
const recommendations = [
|
|
33
|
+
{
|
|
34
|
+
title: "Linear",
|
|
35
|
+
reason: "The issue tracking tool you'll actually love.",
|
|
36
|
+
intent_match_score: 0.98,
|
|
37
|
+
admesh_link: "https://useadmesh.com/track?ad_id=linear&redirect=https://linear.app",
|
|
38
|
+
ad_id: "linear-premium",
|
|
39
|
+
product_id: "linear-issues",
|
|
40
|
+
features: ["Issue Tracking", "Sprint Planning", "Git Integration"],
|
|
41
|
+
has_free_tier: true,
|
|
42
|
+
pricing: "$8 - $16/user/month",
|
|
43
|
+
trial_days: 14,
|
|
44
|
+
keywords: ["Project Management", "Development", "Productivity"]
|
|
45
|
+
}
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<AdMeshLayout
|
|
50
|
+
recommendations={recommendations}
|
|
51
|
+
intentType="best_for_use_case"
|
|
52
|
+
onProductClick={(adId, admeshLink) => {
|
|
53
|
+
// Track the click
|
|
54
|
+
console.log('Product clicked:', { adId, admeshLink });
|
|
55
|
+
// Open the link
|
|
56
|
+
window.open(admeshLink, '_blank');
|
|
57
|
+
}}
|
|
58
|
+
/>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## 🎯 Framework-Specific Examples
|
|
64
|
+
|
|
65
|
+
### Next.js Integration
|
|
66
|
+
|
|
67
|
+
```jsx
|
|
68
|
+
// pages/recommendations.js
|
|
69
|
+
import { AdMeshLayout } from '@admesh/ui-sdk';
|
|
70
|
+
import '@admesh/ui-sdk/dist/ui-sdk.css';
|
|
71
|
+
|
|
72
|
+
export default function RecommendationsPage({ recommendations }) {
|
|
73
|
+
const handleProductClick = (adId, admeshLink) => {
|
|
74
|
+
// Track with your analytics
|
|
75
|
+
gtag('event', 'recommendation_click', {
|
|
76
|
+
ad_id: adId,
|
|
77
|
+
source: 'admesh'
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
// Open the tracked link
|
|
81
|
+
window.open(admeshLink, '_blank');
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<div className="container mx-auto px-4 py-8">
|
|
86
|
+
<h1 className="text-3xl font-bold mb-8">Recommended for You</h1>
|
|
87
|
+
<AdMeshLayout
|
|
88
|
+
recommendations={recommendations}
|
|
89
|
+
intentType="best_for_use_case"
|
|
90
|
+
theme={{ mode: "light" }}
|
|
91
|
+
onProductClick={handleProductClick}
|
|
92
|
+
/>
|
|
93
|
+
</div>
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export async function getServerSideProps() {
|
|
98
|
+
// Fetch recommendations from your API or AdMesh API
|
|
99
|
+
const recommendations = await fetchRecommendations();
|
|
100
|
+
|
|
101
|
+
return {
|
|
102
|
+
props: {
|
|
103
|
+
recommendations
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### React + Vite
|
|
110
|
+
|
|
111
|
+
```jsx
|
|
112
|
+
// src/App.jsx
|
|
113
|
+
import { useState, useEffect } from 'react';
|
|
114
|
+
import { AdMeshLayout } from '@admesh/ui-sdk';
|
|
115
|
+
import '@admesh/ui-sdk/dist/ui-sdk.css';
|
|
116
|
+
|
|
117
|
+
function App() {
|
|
118
|
+
const [recommendations, setRecommendations] = useState([]);
|
|
119
|
+
const [loading, setLoading] = useState(true);
|
|
120
|
+
|
|
121
|
+
useEffect(() => {
|
|
122
|
+
async function fetchData() {
|
|
123
|
+
try {
|
|
124
|
+
const response = await fetch('/api/recommendations');
|
|
125
|
+
const data = await response.json();
|
|
126
|
+
setRecommendations(data.recommendations || []);
|
|
127
|
+
} catch (error) {
|
|
128
|
+
console.error('Failed to fetch recommendations:', error);
|
|
129
|
+
} finally {
|
|
130
|
+
setLoading(false);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
fetchData();
|
|
135
|
+
}, []);
|
|
136
|
+
|
|
137
|
+
if (loading) {
|
|
138
|
+
return <div className="flex justify-center p-8">Loading recommendations...</div>;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return (
|
|
142
|
+
<div className="min-h-screen bg-gray-50 dark:bg-gray-900">
|
|
143
|
+
<div className="container mx-auto px-4 py-8">
|
|
144
|
+
<AdMeshLayout
|
|
145
|
+
recommendations={recommendations}
|
|
146
|
+
theme={{ mode: "light" }}
|
|
147
|
+
maxDisplayed={6}
|
|
148
|
+
showMatchScores={true}
|
|
149
|
+
onProductClick={(adId, admeshLink) => {
|
|
150
|
+
window.open(admeshLink, '_blank');
|
|
151
|
+
}}
|
|
152
|
+
/>
|
|
153
|
+
</div>
|
|
154
|
+
</div>
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export default App;
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Vue.js Integration
|
|
162
|
+
|
|
163
|
+
```vue
|
|
164
|
+
<template>
|
|
165
|
+
<div class="recommendations-container">
|
|
166
|
+
<div ref="admeshContainer"></div>
|
|
167
|
+
</div>
|
|
168
|
+
</template>
|
|
169
|
+
|
|
170
|
+
<script>
|
|
171
|
+
import { createRoot } from 'react-dom/client';
|
|
172
|
+
import { createElement } from 'react';
|
|
173
|
+
import { AdMeshLayout } from '@admesh/ui-sdk';
|
|
174
|
+
import '@admesh/ui-sdk/dist/ui-sdk.css';
|
|
175
|
+
|
|
176
|
+
export default {
|
|
177
|
+
name: 'RecommendationsWidget',
|
|
178
|
+
props: {
|
|
179
|
+
recommendations: {
|
|
180
|
+
type: Array,
|
|
181
|
+
required: true
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
mounted() {
|
|
185
|
+
this.renderAdMeshComponent();
|
|
186
|
+
},
|
|
187
|
+
updated() {
|
|
188
|
+
this.renderAdMeshComponent();
|
|
189
|
+
},
|
|
190
|
+
methods: {
|
|
191
|
+
renderAdMeshComponent() {
|
|
192
|
+
const root = createRoot(this.$refs.admeshContainer);
|
|
193
|
+
root.render(
|
|
194
|
+
createElement(AdMeshLayout, {
|
|
195
|
+
recommendations: this.recommendations,
|
|
196
|
+
intentType: 'best_for_use_case',
|
|
197
|
+
onProductClick: (adId, admeshLink) => {
|
|
198
|
+
this.$emit('product-click', { adId, admeshLink });
|
|
199
|
+
window.open(admeshLink, '_blank');
|
|
200
|
+
}
|
|
201
|
+
})
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
</script>
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## 🎨 Styling & Customization
|
|
210
|
+
|
|
211
|
+
### Using with Tailwind CSS
|
|
212
|
+
|
|
213
|
+
The components work perfectly with Tailwind CSS:
|
|
214
|
+
|
|
215
|
+
```jsx
|
|
216
|
+
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
|
217
|
+
<div className="bg-white dark:bg-gray-900 rounded-lg shadow-lg p-6">
|
|
218
|
+
<AdMeshLayout
|
|
219
|
+
recommendations={recommendations}
|
|
220
|
+
theme={{ mode: "light" }}
|
|
221
|
+
/>
|
|
222
|
+
</div>
|
|
223
|
+
</div>
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### Custom Theme
|
|
227
|
+
|
|
228
|
+
```jsx
|
|
229
|
+
const customTheme = {
|
|
230
|
+
mode: 'light',
|
|
231
|
+
accentColor: '#10b981' // Custom green
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
<AdMeshLayout
|
|
235
|
+
recommendations={recommendations}
|
|
236
|
+
theme={customTheme}
|
|
237
|
+
/>
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### Dark Mode
|
|
241
|
+
|
|
242
|
+
```jsx
|
|
243
|
+
// Automatic dark mode based on system preference
|
|
244
|
+
const [darkMode, setDarkMode] = useState(
|
|
245
|
+
window.matchMedia('(prefers-color-scheme: dark)').matches
|
|
246
|
+
);
|
|
247
|
+
|
|
248
|
+
<AdMeshLayout
|
|
249
|
+
recommendations={recommendations}
|
|
250
|
+
theme={{ mode: darkMode ? 'dark' : 'light' }}
|
|
251
|
+
/>
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
## 📊 Analytics Integration
|
|
255
|
+
|
|
256
|
+
### Google Analytics
|
|
257
|
+
|
|
258
|
+
```jsx
|
|
259
|
+
import { gtag } from 'ga-gtag';
|
|
260
|
+
|
|
261
|
+
const handleProductClick = (adId, admeshLink) => {
|
|
262
|
+
// Track with Google Analytics
|
|
263
|
+
gtag('event', 'recommendation_click', {
|
|
264
|
+
event_category: 'AdMesh',
|
|
265
|
+
event_label: adId,
|
|
266
|
+
value: 1
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
window.open(admeshLink, '_blank');
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
<AdMeshLayout
|
|
273
|
+
recommendations={recommendations}
|
|
274
|
+
onProductClick={handleProductClick}
|
|
275
|
+
onTrackView={(adId, productId) => {
|
|
276
|
+
gtag('event', 'recommendation_view', {
|
|
277
|
+
event_category: 'AdMesh',
|
|
278
|
+
event_label: adId
|
|
279
|
+
});
|
|
280
|
+
}}
|
|
281
|
+
/>
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
### Mixpanel
|
|
285
|
+
|
|
286
|
+
```jsx
|
|
287
|
+
import mixpanel from 'mixpanel-browser';
|
|
288
|
+
|
|
289
|
+
const handleProductClick = (adId, admeshLink) => {
|
|
290
|
+
mixpanel.track('Recommendation Clicked', {
|
|
291
|
+
ad_id: adId,
|
|
292
|
+
source: 'admesh',
|
|
293
|
+
timestamp: new Date().toISOString()
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
window.open(admeshLink, '_blank');
|
|
297
|
+
};
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
## 🔧 Advanced Configuration
|
|
301
|
+
|
|
302
|
+
### Custom Layout Selection
|
|
303
|
+
|
|
304
|
+
```jsx
|
|
305
|
+
<AdMeshLayout
|
|
306
|
+
recommendations={recommendations}
|
|
307
|
+
autoLayout={false} // Disable auto layout
|
|
308
|
+
intentType="compare_products" // Force comparison table
|
|
309
|
+
maxDisplayed={4}
|
|
310
|
+
/>
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
### Individual Components
|
|
314
|
+
|
|
315
|
+
```jsx
|
|
316
|
+
import { AdMeshProductCard, AdMeshCompareTable } from '@admesh/ui-sdk';
|
|
317
|
+
|
|
318
|
+
// Use individual cards
|
|
319
|
+
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
|
320
|
+
{recommendations.map(rec => (
|
|
321
|
+
<AdMeshProductCard
|
|
322
|
+
key={rec.ad_id}
|
|
323
|
+
recommendation={rec}
|
|
324
|
+
showMatchScore={true}
|
|
325
|
+
showBadges={true}
|
|
326
|
+
maxKeywords={3}
|
|
327
|
+
onClick={(adId, admeshLink) => window.open(admeshLink, '_blank')}
|
|
328
|
+
/>
|
|
329
|
+
))}
|
|
330
|
+
</div>
|
|
331
|
+
|
|
332
|
+
// Use comparison table
|
|
333
|
+
<AdMeshCompareTable
|
|
334
|
+
recommendations={recommendations.slice(0, 3)}
|
|
335
|
+
showMatchScores={true}
|
|
336
|
+
showFeatures={true}
|
|
337
|
+
onProductClick={(adId, admeshLink) => window.open(admeshLink, '_blank')}
|
|
338
|
+
/>
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
## 🚨 Common Issues & Solutions
|
|
342
|
+
|
|
343
|
+
### CSS Not Loading
|
|
344
|
+
|
|
345
|
+
Make sure to import the CSS file:
|
|
346
|
+
|
|
347
|
+
```jsx
|
|
348
|
+
import '@admesh/ui-sdk/dist/ui-sdk.css';
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
### TypeScript Errors
|
|
352
|
+
|
|
353
|
+
Install type definitions:
|
|
354
|
+
|
|
355
|
+
```bash
|
|
356
|
+
npm install --save-dev @types/react @types/react-dom
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
### Bundle Size Optimization
|
|
360
|
+
|
|
361
|
+
Use tree shaking to import only what you need:
|
|
362
|
+
|
|
363
|
+
```jsx
|
|
364
|
+
import { AdMeshLayout } from '@admesh/ui-sdk/dist/components/AdMeshLayout';
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
## 📱 Responsive Design
|
|
368
|
+
|
|
369
|
+
Components are fully responsive out of the box:
|
|
370
|
+
|
|
371
|
+
```jsx
|
|
372
|
+
// Mobile-first responsive container
|
|
373
|
+
<div className="w-full max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
|
374
|
+
<AdMeshLayout recommendations={recommendations} />
|
|
375
|
+
</div>
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
## 🔒 Security Considerations
|
|
379
|
+
|
|
380
|
+
- All `admesh_link` URLs are validated before opening
|
|
381
|
+
- XSS protection is built into all text rendering
|
|
382
|
+
- No external scripts are loaded automatically
|
|
383
|
+
- All tracking is opt-in and configurable
|
|
384
|
+
|
|
385
|
+
## 📈 Performance Tips
|
|
386
|
+
|
|
387
|
+
1. **Lazy Loading**: Load recommendations on demand
|
|
388
|
+
2. **Memoization**: Use React.memo for static recommendations
|
|
389
|
+
3. **Virtual Scrolling**: For large lists of recommendations
|
|
390
|
+
4. **Image Optimization**: Optimize any custom images
|
|
391
|
+
|
|
392
|
+
```jsx
|
|
393
|
+
import { memo } from 'react';
|
|
394
|
+
|
|
395
|
+
const MemoizedLayout = memo(AdMeshLayout);
|
|
396
|
+
|
|
397
|
+
<MemoizedLayout recommendations={recommendations} />
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
## 🤝 Support
|
|
401
|
+
|
|
402
|
+
Need help? We're here for you:
|
|
403
|
+
|
|
404
|
+
- 📖 **Documentation**: https://docs.useadmesh.com
|
|
405
|
+
- 💬 **Discord**: https://discord.gg/admesh
|
|
406
|
+
- 📧 **Email**: support@useadmesh.com
|
|
407
|
+
- 🐛 **Issues**: https://github.com/GouniManikumar12/admesh-ui-sdk/issues
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 AdMesh
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
# AdMesh UI SDK
|
|
2
|
+
|
|
3
|
+
A React + TypeScript component library for displaying AdMesh product recommendations with built-in tracking and theming support.
|
|
4
|
+
|
|
5
|
+
## 🚀 Features
|
|
6
|
+
|
|
7
|
+
- **Pre-built UI Components** - Ready-to-use components for product recommendations
|
|
8
|
+
- **Built-in Tracking** - Automatic click, view, and conversion tracking
|
|
9
|
+
- **Intelligent Layouts** - Auto-selects optimal layout based on intent and data
|
|
10
|
+
- **Theme Support** - Light/dark mode with custom accent colors
|
|
11
|
+
- **TypeScript First** - Full type safety and IntelliSense support
|
|
12
|
+
- **Framework Agnostic** - React core, but designed for easy embedding
|
|
13
|
+
- **Responsive Design** - Mobile-first responsive components
|
|
14
|
+
- **Accessibility** - WCAG 2.1 AA compliant
|
|
15
|
+
|
|
16
|
+
## 📦 Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install admesh-ui-sdk
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## 🎯 Quick Start
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
import React from 'react';
|
|
26
|
+
import { AdMeshLayout } from 'admesh-ui-sdk';
|
|
27
|
+
import 'admesh-ui-sdk/dist/style.css';
|
|
28
|
+
|
|
29
|
+
const recommendations = [
|
|
30
|
+
{
|
|
31
|
+
title: "HubSpot CRM",
|
|
32
|
+
reason: "Perfect for remote teams with excellent collaboration features",
|
|
33
|
+
intent_match_score: 0.92,
|
|
34
|
+
admesh_link: "https://useadmesh.com/track?ad_id=hubspot-123",
|
|
35
|
+
ad_id: "hubspot-123",
|
|
36
|
+
product_id: "hubspot-crm",
|
|
37
|
+
has_free_tier: true,
|
|
38
|
+
trial_days: 14,
|
|
39
|
+
keywords: ["CRM", "Sales", "Marketing"]
|
|
40
|
+
}
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
function App() {
|
|
44
|
+
return (
|
|
45
|
+
<AdMeshLayout
|
|
46
|
+
recommendations={recommendations}
|
|
47
|
+
autoLayout={true}
|
|
48
|
+
showMatchScores={true}
|
|
49
|
+
onProductClick={(adId, admeshLink) => {
|
|
50
|
+
console.log('Product clicked:', { adId, admeshLink });
|
|
51
|
+
}}
|
|
52
|
+
/>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## 🧩 Components
|
|
58
|
+
|
|
59
|
+
### AdMeshLayout
|
|
60
|
+
The main layout component that automatically chooses the best display format.
|
|
61
|
+
|
|
62
|
+
### AdMeshProductCard
|
|
63
|
+
Individual product recommendation card.
|
|
64
|
+
|
|
65
|
+
### AdMeshCompareTable
|
|
66
|
+
Side-by-side product comparison table.
|
|
67
|
+
|
|
68
|
+
### AdMeshBadge
|
|
69
|
+
Reusable badge component.
|
|
70
|
+
|
|
71
|
+
### AdMeshLinkTracker
|
|
72
|
+
Wrapper for tracking any clickable element.
|
|
73
|
+
|
|
74
|
+
## 🎨 Theming
|
|
75
|
+
|
|
76
|
+
```tsx
|
|
77
|
+
const theme = {
|
|
78
|
+
mode: 'dark', // 'light' | 'dark'
|
|
79
|
+
accentColor: '#8b5cf6', // Custom accent color
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
<AdMeshLayout theme={theme} recommendations={recommendations} />
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## 📊 Tracking
|
|
86
|
+
|
|
87
|
+
All components include built-in view and click tracking:
|
|
88
|
+
|
|
89
|
+
```tsx
|
|
90
|
+
import { setAdMeshTrackerConfig } from '@admesh/ui-sdk';
|
|
91
|
+
|
|
92
|
+
setAdMeshTrackerConfig({
|
|
93
|
+
apiBaseUrl: 'https://api.useadmesh.com',
|
|
94
|
+
enabled: true,
|
|
95
|
+
debug: true
|
|
96
|
+
});
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## 🔗 Integration with AdMesh SDKs
|
|
100
|
+
|
|
101
|
+
Works seamlessly with AdMesh backend SDKs:
|
|
102
|
+
|
|
103
|
+
```tsx
|
|
104
|
+
import { AdMesh } from '@admesh/typescript-sdk';
|
|
105
|
+
import { AdMeshLayout } from '@admesh/ui-sdk';
|
|
106
|
+
|
|
107
|
+
const client = new AdMesh({ apiKey: 'your-api-key' });
|
|
108
|
+
|
|
109
|
+
async function getRecommendations(query: string) {
|
|
110
|
+
const response = await client.recommend.getRecommendations({
|
|
111
|
+
query,
|
|
112
|
+
format: 'auto'
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
return (
|
|
116
|
+
<AdMeshLayout
|
|
117
|
+
recommendations={response.response?.recommendations || []}
|
|
118
|
+
autoLayout={true}
|
|
119
|
+
/>
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## 📚 API Reference
|
|
125
|
+
|
|
126
|
+
### Types
|
|
127
|
+
|
|
128
|
+
```tsx
|
|
129
|
+
interface AdMeshRecommendation {
|
|
130
|
+
title: string;
|
|
131
|
+
reason: string;
|
|
132
|
+
intent_match_score: number; // 0-1
|
|
133
|
+
admesh_link: string;
|
|
134
|
+
ad_id: string;
|
|
135
|
+
product_id: string;
|
|
136
|
+
features?: string[];
|
|
137
|
+
has_free_tier?: boolean;
|
|
138
|
+
trial_days?: number;
|
|
139
|
+
pricing?: string;
|
|
140
|
+
keywords?: string[];
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
type IntentType =
|
|
144
|
+
| 'compare_products'
|
|
145
|
+
| 'best_for_use_case'
|
|
146
|
+
| 'trial_demo'
|
|
147
|
+
| 'budget_conscious';
|
|
148
|
+
|
|
149
|
+
interface AdMeshTheme {
|
|
150
|
+
mode: 'light' | 'dark';
|
|
151
|
+
accentColor?: string;
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## 🛠 Development
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
# Install dependencies
|
|
159
|
+
npm install
|
|
160
|
+
|
|
161
|
+
# Start Storybook
|
|
162
|
+
npm run storybook
|
|
163
|
+
|
|
164
|
+
# Build library
|
|
165
|
+
npm run build
|
|
166
|
+
|
|
167
|
+
# Run linting
|
|
168
|
+
npm run lint
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## 📄 License
|
|
172
|
+
|
|
173
|
+
MIT License
|
|
174
|
+
|
|
175
|
+
## 🤝 Contributing
|
|
176
|
+
|
|
177
|
+
1. Fork the repository
|
|
178
|
+
2. Create a feature branch
|
|
179
|
+
3. Make your changes
|
|
180
|
+
4. Add tests and stories
|
|
181
|
+
5. Submit a pull request
|
|
182
|
+
|
|
183
|
+
## 📞 Support
|
|
184
|
+
|
|
185
|
+
- Documentation: [AdMesh Docs](https://docs.useadmesh.com)
|
|
186
|
+
- GitHub Issues: [Report a bug](https://github.com/GouniManikumar12/admesh-ui-sdk/issues)
|
|
187
|
+
- Email: support@useadmesh.com
|