A comprehensive training repository for building NextGen UGC (User Generated Content) widgets using Nosto's Widget SDK. This repository contains AI training materials, documentation, code examples, and component libraries for developing sophisticated, customizable UGC widgets.
- Overview
- Key Features
- Repository Structure
- Widget Types
- Component Library
- Getting Started
- Documentation
- Development Guides
- AI Training Materials
- Widget SDK Reference
- Examples
- Best Practices
- Troubleshooting
- Contributing
- Support
- License
The NextGen Widget AI Training repository is designed to train AI assistants and developers on building advanced UGC widgets that seamlessly integrate social media content with e-commerce functionality. This repository serves as a comprehensive knowledge base for:
- AI Assistant Training: Structured data for training AI models to assist with widget development
- Developer Education: Complete documentation and examples for widget creation
- Component Reference: Reusable components and templates for rapid development
- Best Practices: Industry-standard approaches to UGC widget development
- Visual Styling: Complete control over appearance with SCSS/CSS
- Layout Options: Grid, Carousel, Masonry, Waterfall, and Story layouts
- Responsive Design: Mobile-first approach with breakpoint management
- Theme Support: Light/dark themes and custom branding
- Product Tagging: Link social content to specific products
- Add-to-Cart: Direct purchase integration with Shopify and other platforms
- Cross-selling: AI-powered product recommendations
- Dynamic Filtering: Content filtering by products, brands, and categories
- Shopspots: Interactive product hotspots on images/videos
- Expanded Tiles: Detailed view with product information
- Social Sharing: Built-in sharing functionality
- Analytics Integration: Google Analytics and custom event tracking
- Performance Optimization: Lazy loading and progressive enhancement
nextgen-widget-ai-training/
βββ components.txt # Complete component library documentation
βββ guides.txt # Step-by-step development guides
βββ handlebars.txt # Template system documentation
βββ libs.txt # External library integrations
βββ placement.sdk.txt # Widget placement and configuration
βββ prompt.txt # AI assistant behavior guidelines
βββ sample-html.txt # HTML examples and snippets
βββ sdk.txt # Core SDK API reference
βββ types.txt # TypeScript definitions and interfaces
βββ widget-loader.txt # Widget loading and initialization
βββ widget-templates.txt # Pre-built widget templates
βββ .gitignore # Git ignore patterns
βββ README.md # This comprehensive documentation
- Purpose: Display content in a responsive grid layout
- Best For: Product showcases, gallery displays
- Features: Masonry support, lazy loading, infinite scroll
- Purpose: Horizontal scrolling content display
- Best For: Featured content, product highlights
- Features: Touch/swipe support, navigation arrows, autoplay
- Purpose: Pinterest-style masonry layout
- Best For: Mixed content types, dynamic heights
- Features: Variable tile sizes, infinite scroll, responsive columns
- Purpose: Instagram Stories-like vertical format
- Best For: Mobile-first experiences, video content
- Features: Full-screen viewing, auto-progression, interactive elements
- Purpose: Completely customizable starting point
- Best For: Unique designs, specific requirements
- Features: No default styling, maximum flexibility
Display tile metadata including user info, captions, and timestamps.
<tile-content
tile-id="123"
render-user-info="true"
render-description="true"
trim-description="true"
/>Render content tags with optional carousel functionality.
<tile-tags
tile-id="123"
mode="swiper"
navigation-arrows="true"
theme="light"
/>Shopify integration for direct purchases.
<add-to-cart
productId="123"
url="https://store.com/product"
currency="USD"
availability="true"
/>Social sharing functionality.
<share-menu
tile-id="123"
theme="light"
source-id="custom-id"
/>Interactive product hotspots.
<shopspot-icon
tile-id="123"
show-tooltip="true"
mode="expanded"
/>Pagination and infinite scroll.
<load-more
button-text="Load More Content"
auto-load="false"
/>- Node.js 18+ (LTS) and npm/yarn
- TypeScript knowledge
- Basic understanding of web components
- Familiarity with SCSS/CSS
-
Choose a Widget Template
import { loadWidget } from '@stackla/widget-utils' loadWidget({ config: { style: { widget_background: '#ffffff', margin: '10' } } })
-
Customize Layout (layout.hbs)
-
Style Components (widget.scss)
.grid { display: grid; gap: var(--margin); grid-template-columns: repeat(auto-fit, minmax(var(--tile-size), 1fr)); }
-
Add Interactivity (widget.tsx)
sdk.querySelector('#search-input')?.addEventListener('input', async e => { const searchValue = (e.target as HTMLInputElement).value await sdk.searchTiles(searchValue, true) })
The Widget SDK provides a comprehensive API for:
- Tile Management: CRUD operations for content tiles
- Event System: Custom event handling and analytics
- State Management: Widget state persistence
- DOM Manipulation: Shadow DOM-safe element queries
- Web Components: Self-contained, reusable elements
- Shadow DOM: Encapsulated styling and behavior
- Event-driven: Reactive updates and interactions
- TypeScript: Type-safe development experience
- Server-side Rendering: Initial content generation
- Dynamic Content: Data binding and conditionals
- Partial Support: Reusable template components
- Helper Functions: Custom template logic
// Tile Operations
sdk.getTiles(): Tile[]
sdk.getTileById(id: string): Tile | undefined
sdk.searchTiles(query: string): void
sdk.hideTileById(id: string): Promise<void>
// Event Management
sdk.addEventListener(event: string, callback: Function): void
sdk.triggerEvent(event: string, data?: object): void
// DOM Queries (Shadow DOM safe)
sdk.querySelector(selector: string): HTMLElement | null
sdk.querySelectorAll(selector: string): NodeListOf<HTMLElement>
// State Management
sdk.getState(key: string): any
sdk.setState(key: string, value: any): voidLearn to build reusable web components with proper lifecycle management and event handling.
Implement product-based filtering, category filtering, and brand-specific content display.
Connect widgets to Shopify, WooCommerce, and other platforms for seamless shopping experiences.
Implement lazy loading, image optimization, and efficient DOM manipulation techniques.
Create mobile-first designs with touch gestures and responsive breakpoints.
Set up Google Analytics, custom events, and conversion tracking.
Ensure WCAG compliance with proper ARIA labels and keyboard navigation.
This repository contains specialized training data for AI assistants:
- Code Generation: Generate widget code based on requirements
- Problem Solving: Debug and troubleshoot widget issues
- Best Practices: Recommend optimal implementation approaches
- Documentation: Provide clear explanations and examples
- Focus on the
blankcanvaswidget template as reference - Prioritize SDK-based solutions over manual implementations
- Always generate HTML within Handlebars templates when possible
- Provide file-specific code recommendations
- Support both Front-End Engineers and Customer Support Managers
- Shadow DOM environment awareness
- Distinguish between inline and expanded tile contexts
- Understand widget lifecycle and event system
- Recognize template modification requirements
// widget.tsx
import { loadWidget } from '@stackla/widget-utils'
loadWidget({
config: {
style: {
widget_background: '#f5f5f5',
margin: '15'
}
}
})// widget.tsx
import { loadWidget, ISdk } from '@stackla/widget-utils'
declare const sdk: ISdk
loadWidget({
extensions: { swiper: true },
features: { handleLoadMore: false }
})
// Add search functionality
sdk.querySelector('#search-input')?.addEventListener('input', async e => {
const query = (e.target as HTMLInputElement).value
await sdk.searchTiles(query, true)
})- β Use TypeScript for type safety
- β Implement proper error handling
- β Follow component lifecycle patterns
- β Use semantic HTML structure
- β Implement lazy loading for images and components
- β Use CSS transforms for animations
- β Minimize DOM queries and caching selectors
- β Optimize bundle size with tree shaking
- β Provide proper ARIA labels
- β Ensure keyboard navigation
- β Use semantic HTML elements
- β Test with screen readers
- β Use CSS custom properties for theming
- β Implement mobile-first responsive design
- β Follow BEM or similar naming conventions
- β Avoid global style conflicts
// Check for SDK availability
if (window.ugc && window.ugc.widgets) {
console.log('SDK loaded successfully')
} else {
console.error('SDK not loaded')
}// Always use SDK methods for DOM queries
const element = sdk.querySelector('.my-element') // β
Correct
const element = document.querySelector('.my-element') // β Won't work in Shadow DOM// Ensure proper component registration
try {
customElements.define('my-component', MyComponent)
} catch (err) {
console.warn('Component already defined:', err)
}Enable debug logging by setting:
window.ugc = { debug: true }We welcome contributions to improve the training materials and documentation:
- Fork the repository
- Create a feature branch
- Make your changes with proper documentation
- Test thoroughly
- Submit a pull request
- Follow existing code style and conventions
- Add comprehensive documentation for new features
- Include examples and use cases
- Update relevant training materials
- Documentation: Comprehensive guides and API reference
- Examples: Real-world implementation patterns
- Community: Developer forums and discussions
- Training: AI assistant knowledge base
- Check the troubleshooting section
- Review existing examples and guides
- Consult the API documentation
- Contact the development team
Built with β€οΈ by the Nosto UGC Team
Transform social content into shoppable experiences with NextGen Widgets