UNPKG

aura-glass

Version:

A comprehensive glassmorphism design system for React applications with 142+ production-ready components

244 lines 7.55 kB
import React from "react"; export interface Product { id: string; name: string; description: string; price: number; originalPrice?: number; currency: string; images: string[]; thumbnail?: string; category: string; subcategory?: string; brand?: string; sku?: string; stock: number; rating: number; reviewCount: number; tags: string[]; features: ProductFeature[]; variants?: ProductVariant[]; specifications?: Record<string, string>; dimensions?: { width: number; height: number; depth: number; weight: number; unit: string; }; shippingInfo?: { freeShipping: boolean; weight: number; dimensions: string; estimatedDays: number; }; isOnSale?: boolean; isNew?: boolean; isBestseller?: boolean; availability: "in-stock" | "out-of-stock" | "pre-order" | "discontinued"; metadata?: Record<string, any>; } export interface ProductFeature { id: string; name: string; value: string | number | boolean; description?: string; importance?: "low" | "medium" | "high"; category?: string; } export interface ProductVariant { id: string; name: string; value: string; price?: number; stock?: number; image?: string; sku?: string; } export interface CartItem { id: string; productId: string; product: Product; quantity: number; selectedVariants?: Record<string, string>; addedAt: Date; customizations?: Record<string, any>; giftWrap?: boolean; giftMessage?: string; } export interface WishlistItem { id: string; productId: string; product: Product; addedAt: Date; notes?: string; priority: "low" | "medium" | "high"; notify?: boolean; } export interface ProductReview { id: string; productId: string; userId: string; userName: string; userAvatar?: string; rating: number; title: string; content: string; pros?: string[]; cons?: string[]; images?: string[]; verifiedPurchase: boolean; helpful: number; notHelpful: number; createdAt: Date; sentiment?: "positive" | "neutral" | "negative"; keywords?: string[]; } export interface PriceHistory { date: Date; price: number; source?: string; } export interface ProductComparison { id: string; products: Product[]; comparisonMatrix: ComparisonFeature[]; createdAt: Date; title?: string; } export interface ComparisonFeature { name: string; category: string; values: (string | number | boolean)[]; importance: "low" | "medium" | "high"; winner?: number; description?: string; } export interface Recommendation { productId: string; product: Product; score: number; reason: "viewed-together" | "bought-together" | "similar" | "trending" | "personalized"; explanation: string; confidence: number; } export interface ShippingOption { id: string; name: string; description: string; price: number; estimatedDays: number; trackingAvailable: boolean; insuranceIncluded: boolean; } export interface PaymentMethod { id: string; type: "credit-card" | "debit-card" | "paypal" | "apple-pay" | "google-pay" | "bank-transfer"; name: string; icon: string; processingFee?: number; acceptedCurrencies: string[]; } interface EcommerceContextValue { products: Product[]; addProduct: (product: Product) => void; updateProduct: (id: string, updates: Partial<Product>) => void; removeProduct: (id: string) => void; getProduct: (id: string) => Product | undefined; getProductsByCategory: (category: string) => Product[]; searchProducts: (query: string, filters?: ProductFilters) => Product[]; cart: CartItem[]; addToCart: (productId: string, quantity?: number, variants?: Record<string, string>) => void; updateCartItem: (itemId: string, quantity: number) => void; removeFromCart: (itemId: string) => void; clearCart: () => void; getCartTotal: () => number; getCartItemCount: () => number; cartSubtotal: number; cartTax: number; cartShipping: number; cartTotal: number; wishlist: WishlistItem[]; addToWishlist: (productId: string, priority?: "low" | "medium" | "high") => void; removeFromWishlist: (itemId: string) => void; moveToCart: (wishlistItemId: string) => void; shareWishlist: () => string; recommendations: Record<string, Recommendation[]>; getRecommendations: (productId: string, type?: string) => Recommendation[]; generateRecommendations: (productId: string) => Promise<Recommendation[]>; comparisons: ProductComparison[]; createComparison: (productIds: string[], title?: string) => ProductComparison; updateComparison: (id: string, updates: Partial<ProductComparison>) => void; removeComparison: (id: string) => void; compareProducts: (productIds: string[]) => ComparisonFeature[]; reviews: Record<string, ProductReview[]>; addReview: (productId: string, review: Omit<ProductReview, "id" | "createdAt">) => void; updateReview: (reviewId: string, updates: Partial<ProductReview>) => void; removeReview: (reviewId: string) => void; getProductReviews: (productId: string) => ProductReview[]; getAverageRating: (productId: string) => number; priceHistory: Record<string, PriceHistory[]>; trackPrice: (productId: string) => void; untrackPrice: (productId: string) => void; getPriceHistory: (productId: string) => PriceHistory[]; getPriceAlerts: () => { productId: string; oldPrice: number; newPrice: number; }[]; searchQuery: string; setSearchQuery: (query: string) => void; filters: ProductFilters; setFilters: (filters: ProductFilters) => void; sortBy: SortOption; setSortBy: (sort: SortOption) => void; viewProduct: (productId: string) => void; trackEvent: (event: string, data?: Record<string, any>) => void; getAnalytics: () => EcommerceAnalytics; shippingOptions: ShippingOption[]; paymentMethods: PaymentMethod[]; selectedShipping?: ShippingOption; selectedPayment?: PaymentMethod; setShippingOption: (option: ShippingOption) => void; setPaymentMethod: (method: PaymentMethod) => void; } export interface ProductFilters { category?: string[]; brand?: string[]; priceRange?: [number, number]; rating?: number; availability?: string[]; features?: Record<string, string[]>; onSale?: boolean; freeShipping?: boolean; inStock?: boolean; } export type SortOption = "relevance" | "price-low-high" | "price-high-low" | "rating" | "newest" | "bestseller" | "name-az" | "name-za"; export interface EcommerceAnalytics { totalViews: number; totalPurchases: number; conversionRate: number; averageOrderValue: number; popularProducts: { productId: string; views: number; purchases: number; }[]; categoryPerformance: Record<string, { views: number; purchases: number; }>; searchQueries: { query: string; count: number; results: number; }[]; } export declare const EcommerceProvider: React.FC<{ children: React.ReactNode; className?: string; "data-testid"?: string; }>; export { EcommerceProvider as GlassEcommerceProvider }; export declare const useEcommerce: () => EcommerceContextValue; //# sourceMappingURL=GlassEcommerceProvider.d.ts.map