Marketplace
Product marketplace component with search, filtering, and analytics.
A ready-to-use marketplace component with Lucene.Net search, faceted filtering, and analytics tracking.
Installation
bash
npm install authscape-marketplace
Azure Setup
The marketplace requires Azure Blob Storage for search indexes.
1. Create Storage Account
- Go to Azure Portal
- Navigate to Storage Accounts → Create
- Configure:
- Storage Account Name: Choose unique name (e.g.,
authscapemarketplace) - Region: Your preferred region
- Performance: Standard
- Redundancy: LRS or higher
- Storage Account Name: Choose unique name (e.g.,
- Click Review + Create → Create
2. Create Container
- Open your storage account
- Go to Containers under Data storage
- Click + Container
- Name:
lucene-indexes - Access level: Private
- Click Create
3. Get Connection String
- Go to Access keys under Security + networking
- Copy the Connection string from key1 or key2
Configuration
Add to your appsettings.json:
json
{"AppSettings": {"LuceneSearch": {"StorageConnectionString": "DefaultEndpointsProtocol=https;AccountName=youraccountname;AccountKey=yourkey;EndpointSuffix=core.windows.net","Container": "lucene-indexes"}}}
Or use environment variables:
bash
AppSettings__LuceneSearch__StorageConnectionString=DefaultEndpointsProtocol=https;...AppSettings__LuceneSearch__Container=lucene-indexes
Usage
Basic Implementation
jsx
import Marketplace from 'authscape-marketplace';export default function MyMarketplacePage() {const [loading, setLoading] = useState(false);return (<MarketplacesetIsLoading={setLoading}oemCompanyId={null}showFilters={true}showSearch={true}/>);}
With Custom Props
jsx
<MarketplacesetIsLoading={setLoading}oemCompanyId={companyId}showFilters={true}showSearch={true}defaultSearchTerm="laptops"itemsPerPage={24}/>
Component Props
| Prop | Type | Required | Description |
|---|---|---|---|
setIsLoading | function | Yes | Loading state callback |
oemCompanyId | number/null | Yes | Company ID for filtering (null for all) |
showFilters | boolean | No | Show faceted filters sidebar (default: true) |
showSearch | boolean | No | Show search bar (default: true) |
defaultSearchTerm | string | No | Initial search term |
itemsPerPage | number | No | Products per page (default: 20) |
Features
- Full-text search - Powered by Lucene.Net with fuzzy matching
- Faceted filtering - Multi-select filters within categories
- Analytics tracking - Automatic impression and click tracking
- Responsive design - Works on desktop and mobile
- Pagination - Built-in pagination support
Customizing Products
Mark your product model properties with [MarketplaceIndex] to make them searchable:
csharp
using AuthScape.Marketplace.Attributes;public class Product{public long Id { get; set; }[MarketplaceIndex]public string Name { get; set; }[MarketplaceIndex]public string Description { get; set; }[MarketplaceIndex]public string Category { get; set; }[MarketplaceIndex]public string Brand { get; set; }[MarketplaceIndex]public decimal Price { get; set; }}
Example Page
Full marketplace page example:
jsx
import { useState } from 'react';import Marketplace from 'authscape-marketplace';import { Box, Container, Typography } from '@mui/material';export default function MarketplacePage() {const [loading, setLoading] = useState(false);return (<Container maxWidth="xl"><Box sx={{ py: 3 }}><Typography variant="h4" gutterBottom>Product Marketplace</Typography><MarketplacesetIsLoading={setLoading}oemCompanyId={null}showFilters={true}showSearch={true}itemsPerPage={24}/></Box></Container>);}
Troubleshooting
Search returns no results
- Verify Azure connection string is correct
- Ensure blob container
lucene-indexesexists - Check that product indexes have been generated
Filters not showing
- Ensure
PropertyNamematches product model properties - Check
showFiltersprop is set totrue - Verify filter categories are configured
Analytics not tracking
- Check database connection is working
- Ensure user is authenticated if tracking user interactions
Next Steps
- Set up Azure Storage Account and container
- Add configuration to appsettings.json
- Install npm package
- Add component to your page
- Customize product model with
[MarketplaceIndex]attributes - Generate search indexes for your products