admesh-ui-sdk 0.8.1 → 0.9.1
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/CONVERSATIONAL_GUIDE.md +1 -1
- package/README.md +97 -9
- package/dist/components/AdMeshSimpleAd.d.ts +27 -0
- package/dist/components/AdMeshSimpleAd.d.ts.map +1 -0
- package/dist/components/index.d.ts +1 -7
- package/dist/components/index.d.ts.map +1 -1
- package/dist/hooks/useAdMeshStyles.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +79 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +902 -1188
- package/dist/index.mjs.map +1 -1
- package/dist/types/index.d.ts +64 -70
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +14 -11
- package/dist/stories/Button.d.ts +0 -15
- package/dist/stories/Button.d.ts.map +0 -1
- package/dist/stories/Header.d.ts +0 -12
- package/dist/stories/Header.d.ts.map +0 -1
- package/dist/stories/Page.d.ts +0 -3
- package/dist/stories/Page.d.ts.map +0 -1
- package/examples/auto-recommendation-integration.jsx +0 -311
- package/examples/basic-usage.jsx +0 -117
- package/examples/chat-usage.jsx +0 -397
- package/examples/chat-with-recommendations-demo.jsx +0 -345
- package/examples/citation-links-demo.html +0 -167
- package/examples/citation-usage.jsx +0 -229
- package/examples/clickable-product-names-demo.html +0 -196
- package/examples/conversational-usage.jsx +0 -248
- package/examples/custom-styling.jsx +0 -297
- package/examples/nextjs-integration.jsx +0 -246
- package/examples/sidebar-usage.jsx +0 -268
package/CONVERSATIONAL_GUIDE.md
CHANGED
|
@@ -407,4 +407,4 @@ const handleMessage = async (message) => {
|
|
|
407
407
|
|
|
408
408
|
## 🎉 Complete Example
|
|
409
409
|
|
|
410
|
-
|
|
410
|
+
Check out the [AdMesh Storybook](https://storybook.useadmesh.com/) for complete working examples with all display modes and configurations.
|
package/README.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
A React + TypeScript component library for displaying AdMesh product recommendations with **citation-based conversation ads**, built-in tracking, and theming support.
|
|
4
4
|
|
|
5
|
+
## 🌐 Live Sites
|
|
6
|
+
|
|
7
|
+
- **🎭 Interactive Storybook**: [https://storybook.useadmesh.com/](https://storybook.useadmesh.com/) - Explore all components and ad formats
|
|
8
|
+
- **📚 Complete Documentation**: [https://docs.useadmesh.com/](https://docs.useadmesh.com/) - Full SDK documentation and guides
|
|
9
|
+
- **🚀 AdMesh Dashboard**: [https://useadmesh.com](https://useadmesh.com) - Get your API keys and manage campaigns
|
|
10
|
+
|
|
11
|
+
> **🎨 Component Showcase**: This repository contains the UI SDK components with an interactive Storybook for exploring all ad formats and components.
|
|
12
|
+
|
|
5
13
|
## 🚀 Features
|
|
6
14
|
|
|
7
15
|
- **Citation-Based Conversation Ads** - Display recommendations as numbered references within text, like academic papers or AI assistants
|
|
@@ -881,38 +889,118 @@ interface AdMeshTheme {
|
|
|
881
889
|
|
|
882
890
|
## 🎭 Live Storybook Examples
|
|
883
891
|
|
|
884
|
-
**🌐 Hosted Storybook**: [https://
|
|
892
|
+
**🌐 Hosted Storybook**: [https://storybook.useadmesh.com/](https://storybook.useadmesh.com/)
|
|
885
893
|
|
|
886
894
|
Explore interactive examples and component variations:
|
|
887
895
|
|
|
888
|
-
- **📚 Storybook Ad Formats** - Complete narrative examples with embedded citations
|
|
889
896
|
- **📝 Citation Components** - Different citation styles (numbered, bracketed, superscript)
|
|
890
897
|
- **💬 Conversational Ads** - Chat interface integration examples
|
|
891
|
-
- **📊 Format Comparisons** - Traditional vs AdMesh side-by-side demonstrations
|
|
892
898
|
- **🎨 Theme Variations** - Light/dark mode examples
|
|
893
899
|
- **📱 Responsive Design** - Mobile and desktop layout adaptations
|
|
894
900
|
|
|
895
901
|
**No installation required** - view all ad formats directly in your browser!
|
|
896
902
|
|
|
903
|
+
## 🎨 Theming & Dark Mode
|
|
904
|
+
|
|
905
|
+
The AdMesh UI SDK provides comprehensive theming support with full dark mode compliance:
|
|
906
|
+
|
|
907
|
+
### Theme Configuration
|
|
908
|
+
|
|
909
|
+
```jsx
|
|
910
|
+
// Light theme (default)
|
|
911
|
+
<AdMeshLayout theme={{ mode: "light" }} />
|
|
912
|
+
|
|
913
|
+
// Dark theme with proper contrast ratios
|
|
914
|
+
<AdMeshLayout theme={{ mode: "dark" }} />
|
|
915
|
+
|
|
916
|
+
// Custom accent color
|
|
917
|
+
<AdMeshLayout theme={{ mode: "light", accentColor: "#3b82f6" }} />
|
|
918
|
+
|
|
919
|
+
// Dynamic theme switching
|
|
920
|
+
const [isDarkMode, setIsDarkMode] = useState(false);
|
|
921
|
+
<AdMeshLayout theme={{ mode: isDarkMode ? "dark" : "light" }} />
|
|
922
|
+
```
|
|
923
|
+
|
|
924
|
+
### Dark Mode Features
|
|
925
|
+
|
|
926
|
+
- ✅ **Full Dark Mode Support**: All components automatically adapt to dark theme
|
|
927
|
+
- ✅ **WCAG Accessibility**: Proper contrast ratios meet accessibility guidelines
|
|
928
|
+
- ✅ **Consistent Branding**: "Powered by AdMesh" remains visible in both themes
|
|
929
|
+
- ✅ **Smooth Transitions**: Components transition smoothly between light and dark modes
|
|
930
|
+
- ✅ **CSS Variables**: Uses CSS custom properties for consistent theming
|
|
931
|
+
- ✅ **No Ambiguous Elements**: Clean, focused interface without confusing UI elements
|
|
932
|
+
|
|
933
|
+
### CSS Custom Properties
|
|
934
|
+
|
|
935
|
+
The SDK uses CSS custom properties that automatically adjust based on the theme:
|
|
936
|
+
|
|
937
|
+
```css
|
|
938
|
+
/* Light theme variables */
|
|
939
|
+
.admesh-component[data-admesh-theme="light"] {
|
|
940
|
+
--admesh-background: #ffffff;
|
|
941
|
+
--admesh-text: #111827;
|
|
942
|
+
--admesh-border: #e5e7eb;
|
|
943
|
+
--admesh-surface: #f9fafb;
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
/* Dark theme variables */
|
|
947
|
+
.admesh-component[data-admesh-theme="dark"] {
|
|
948
|
+
--admesh-background: #111827;
|
|
949
|
+
--admesh-text: #f9fafb;
|
|
950
|
+
--admesh-border: #374151;
|
|
951
|
+
--admesh-surface: #1f2937;
|
|
952
|
+
--admesh-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.3);
|
|
953
|
+
}
|
|
954
|
+
```
|
|
955
|
+
|
|
956
|
+
### Theme Integration
|
|
957
|
+
|
|
958
|
+
All AdMesh components automatically respect the theme prop:
|
|
959
|
+
|
|
960
|
+
```jsx
|
|
961
|
+
// All components support the same theme interface
|
|
962
|
+
<AdMeshProductCard theme={{ mode: "dark" }} />
|
|
963
|
+
<AdMeshCompareTable theme={{ mode: "dark" }} />
|
|
964
|
+
<AdMeshSidebar theme={{ mode: "dark" }} />
|
|
965
|
+
<AdMeshChatWidget theme={{ mode: "dark" }} />
|
|
966
|
+
```
|
|
967
|
+
|
|
897
968
|
## 🛠 Development
|
|
898
969
|
|
|
899
970
|
```bash
|
|
900
971
|
# Install dependencies
|
|
901
972
|
npm install
|
|
902
973
|
|
|
903
|
-
# Start Storybook
|
|
904
|
-
npm run storybook
|
|
974
|
+
# Start Storybook for development
|
|
975
|
+
npm run storybook # Storybook at :6006
|
|
905
976
|
|
|
906
|
-
#
|
|
907
|
-
# https://gounimanikumar12.github.io/admesh-ui-sdk/storybook/
|
|
908
|
-
|
|
909
|
-
# Build library
|
|
977
|
+
# Build library for NPM
|
|
910
978
|
npm run build
|
|
911
979
|
|
|
980
|
+
# Build Storybook for deployment
|
|
981
|
+
npm run build-storybook
|
|
982
|
+
|
|
912
983
|
# Run linting
|
|
913
984
|
npm run lint
|
|
914
985
|
```
|
|
915
986
|
|
|
987
|
+
## 🚀 Deployment
|
|
988
|
+
|
|
989
|
+
### Automatic Vercel Deployment
|
|
990
|
+
1. Go to [vercel.com](https://vercel.com) and import your GitHub repository
|
|
991
|
+
2. Configure build settings:
|
|
992
|
+
- **Build Command**: `npm run build-storybook`
|
|
993
|
+
- **Output Directory**: `storybook-static`
|
|
994
|
+
3. Deploy automatically on every push to main
|
|
995
|
+
|
|
996
|
+
**No environment variables needed** - Vercel's GitHub integration handles everything automatically!
|
|
997
|
+
|
|
998
|
+
### Manual Deployment
|
|
999
|
+
```bash
|
|
1000
|
+
npm run build-storybook
|
|
1001
|
+
npx serve storybook-static
|
|
1002
|
+
```
|
|
1003
|
+
|
|
916
1004
|
## 📄 License
|
|
917
1005
|
|
|
918
1006
|
MIT License
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { AdMeshRecommendation, AdMeshTheme } from '../types';
|
|
3
|
+
export interface AdMeshSimpleAdProps {
|
|
4
|
+
/** Product recommendation data */
|
|
5
|
+
recommendation: AdMeshRecommendation;
|
|
6
|
+
/** Theme configuration */
|
|
7
|
+
theme?: AdMeshTheme;
|
|
8
|
+
/** Custom CSS class name */
|
|
9
|
+
className?: string;
|
|
10
|
+
/** Callback when the ad is clicked */
|
|
11
|
+
onClick?: (adId: string, admeshLink: string) => void;
|
|
12
|
+
/** Show "powered by AdMesh" branding */
|
|
13
|
+
showPoweredBy?: boolean;
|
|
14
|
+
/** Variation style for the ad */
|
|
15
|
+
variation?: 'question' | 'statement';
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* AdMeshSimpleAd - A one-line ad unit with product name, simple description, and link
|
|
19
|
+
*
|
|
20
|
+
* Perfect for clean, unobtrusive product recommendations that blend naturally into content.
|
|
21
|
+
* Supports two variations:
|
|
22
|
+
* - Question: "Looking for payment solutions for your business? Try Stripe"
|
|
23
|
+
* - Statement: "Stripe is offering best payment solutions for small business, visit"
|
|
24
|
+
*/
|
|
25
|
+
export declare const AdMeshSimpleAd: React.FC<AdMeshSimpleAdProps>;
|
|
26
|
+
export default AdMeshSimpleAd;
|
|
27
|
+
//# sourceMappingURL=AdMeshSimpleAd.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AdMeshSimpleAd.d.ts","sourceRoot":"","sources":["../../src/components/AdMeshSimpleAd.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAGlE,MAAM,WAAW,mBAAmB;IAClC,kCAAkC;IAClC,cAAc,EAAE,oBAAoB,CAAC;IACrC,0BAA0B;IAC1B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,4BAA4B;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IACrD,wCAAwC;IACxC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,iCAAiC;IACjC,SAAS,CAAC,EAAE,UAAU,GAAG,WAAW,CAAC;CACtC;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CA2FxD,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -3,17 +3,11 @@ export { AdMeshCompareTable } from './AdMeshCompareTable';
|
|
|
3
3
|
export { AdMeshBadge } from './AdMeshBadge';
|
|
4
4
|
export { AdMeshLayout } from './AdMeshLayout';
|
|
5
5
|
export { AdMeshLinkTracker } from './AdMeshLinkTracker';
|
|
6
|
-
export {
|
|
6
|
+
export { AdMeshSimpleAd } from './AdMeshSimpleAd';
|
|
7
7
|
export { AdMeshConversationSummary } from './AdMeshConversationSummary';
|
|
8
|
-
export { AdMeshInlineRecommendation } from './AdMeshInlineRecommendation';
|
|
9
8
|
export { AdMeshCitationUnit } from './AdMeshCitationUnit';
|
|
10
|
-
export { AdMeshCitationReference } from './AdMeshCitationReference';
|
|
11
9
|
export { AdMeshSidebar } from './AdMeshSidebar';
|
|
12
10
|
export { AdMeshSidebarHeader } from './AdMeshSidebarHeader';
|
|
13
11
|
export { AdMeshSidebarContent } from './AdMeshSidebarContent';
|
|
14
|
-
export { AdMeshFloatingChat } from './AdMeshFloatingChat';
|
|
15
|
-
export { AdMeshChatInterface } from './AdMeshChatInterface';
|
|
16
|
-
export { AdMeshChatMessage } from './AdMeshChatMessage';
|
|
17
|
-
export { AdMeshChatInput } from './AdMeshChatInput';
|
|
18
12
|
export { AdMeshAutoRecommendationWidget } from './AdMeshAutoRecommendationWidget';
|
|
19
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG1D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAG9D,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAdMeshStyles.d.ts","sourceRoot":"","sources":["../../src/hooks/useAdMeshStyles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useAdMeshStyles.d.ts","sourceRoot":"","sources":["../../src/hooks/useAdMeshStyles.ts"],"names":[],"mappings":"AAwUA,eAAO,MAAM,eAAe,YAwB3B,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { AdMeshProductCard, AdMeshCompareTable, AdMeshBadge, AdMeshLayout, AdMeshLinkTracker,
|
|
1
|
+
export { AdMeshProductCard, AdMeshCompareTable, AdMeshBadge, AdMeshLayout, AdMeshLinkTracker, AdMeshSimpleAd, AdMeshConversationSummary, AdMeshCitationUnit, AdMeshSidebar, AdMeshSidebarHeader, AdMeshSidebarContent, AdMeshAutoRecommendationWidget } from './components';
|
|
2
2
|
export { useAdMeshTracker, setAdMeshTrackerConfig, buildAdMeshLink, extractTrackingData } from './hooks/useAdMeshTracker';
|
|
3
3
|
export { useAdMeshStyles } from './hooks/useAdMeshStyles';
|
|
4
|
-
export type { AdMeshRecommendation, AdMeshTheme, IntentType, BadgeType, BadgeVariant, BadgeSize, TrackingData, AdMeshProductCardProps, AdMeshCompareTableProps, AdMeshBadgeProps, AdMeshLayoutProps, AdMeshLinkTrackerProps, UseAdMeshTrackerReturn, AgentRecommendationResponse, AdMeshConfig, ConversationalDisplayMode, ConversationContext, ConversationalAdConfig,
|
|
4
|
+
export type { AdMeshRecommendation, AdMeshTheme, IntentType, BadgeType, BadgeVariant, BadgeSize, TrackingData, AdMeshProductCardProps, AdMeshCompareTableProps, AdMeshBadgeProps, AdMeshLayoutProps, AdMeshLinkTrackerProps, AdMeshSimpleAdProps, UseAdMeshTrackerReturn, AgentRecommendationResponse, AdMeshConfig, ConversationalDisplayMode, ConversationContext, ConversationalAdConfig, AdMeshConversationSummaryProps, AdMeshCitationUnitProps, SidebarPosition, SidebarSize, SidebarDisplayMode, AdMeshSidebarConfig, AdMeshSidebarProps, SidebarFilters, AdMeshSidebarHeaderProps, AdMeshSidebarContentProps, } from './types/index';
|
|
5
5
|
export declare const VERSION = "0.2.1";
|
|
6
6
|
export declare const DEFAULT_CONFIG: {
|
|
7
7
|
trackingEnabled: boolean;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,yBAAyB,EACzB,kBAAkB,EAClB,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,8BAA8B,EAC/B,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,eAAe,EACf,mBAAmB,EACpB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,eAAe,EAChB,MAAM,yBAAyB,CAAC;AAGjC,YAAY,EACV,oBAAoB,EACpB,WAAW,EACX,UAAU,EACV,SAAS,EACT,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,sBAAsB,EACtB,uBAAuB,EACvB,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,EACtB,2BAA2B,EAC3B,YAAY,EACZ,yBAAyB,EACzB,mBAAmB,EACnB,sBAAsB,EACtB,8BAA8B,EAC9B,uBAAuB,EACvB,eAAe,EACf,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,wBAAwB,EACxB,yBAAyB,GAE1B,MAAM,eAAe,CAAC;AAGvB,eAAO,MAAM,OAAO,UAAU,CAAC;AAG/B,eAAO,MAAM,cAAc;;;;;;;CAO1B,CAAC"}
|