@devx-commerce/loyaltyx-ui-kit
v0.2.1
Published
React component library for the LoyaltyX admin dashboard. Built on @medusajs/ui.
Maintainers
Keywords
Readme
@devx-commerce/loyaltyx-ui-kit
Drop-in React component library for the LoyaltyX admin dashboard. Pre-built pages, forms, tables, charts, and modals that talk to your LoyaltyX API out of the box.
Built on @medusajs/ui + Tailwind CSS. Data flows through @devx-commerce/loyaltyx-hooks, so every page handles loading states, errors, optimistic updates, and form validation for you.
Install
pnpm add \
@devx-commerce/loyaltyx-ui-kit \
@devx-commerce/loyaltyx-hooks \
@devx-commerce/loyaltyx-api-client \
@devx-commerce/loyaltyx-corePeer dependencies your app must already have:
pnpm add react react-dom @tanstack/react-queryRequires react ≥ 18 and @tanstack/react-query ≥ 5.
Note: this kit forces
@medusajs/uias your component primitive. If your dashboard uses a different design system (Mantine, Chakra, shadcn, etc.), use@devx-commerce/loyaltyx-hooksdirectly and build your own components.
Setup
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { LoyaltyClient } from '@devx-commerce/loyaltyx-api-client';
import { LoyaltyProvider } from '@devx-commerce/loyaltyx-hooks';
import { DashboardPage, CustomersPage, TiersPage } from '@devx-commerce/loyaltyx-ui-kit';
// Import the compiled stylesheet ONCE at app entry
import '@devx-commerce/loyaltyx-ui-kit/styles.css';
const queryClient = new QueryClient();
const loyaltyClient = new LoyaltyClient('https://loyalty.your-brand.com/api/v1');
export function AdminApp() {
return (
<QueryClientProvider client={queryClient}>
<LoyaltyProvider client={loyaltyClient}>
{/* Mount whichever pages you need into your router */}
<DashboardPage />
</LoyaltyProvider>
</QueryClientProvider>
);
}Pages
| Page | Suggested Route | What it renders |
| -------------------- | ------------------ | -------------------------------------------------------------------------------- |
| DashboardPage | / | KPI cards, points-flow chart, tier distribution, enrollments, redemption summary |
| CustomersPage | /customers | Searchable table with tier filter and pagination |
| CustomerDetailPage | /customers/:id | Wallet, current tier, tier history, manual point adjust, ledger feed |
| TiersPage | /tiers | Tier cards with member counts; create/edit modal |
| TierDetailPage | /tiers/:id | Three tabs: details, earning rules, spending rules |
| LedgerPage | /ledger | Transaction table with date / type / status filters |
| SettingsPage | /settings | Program config, channel mappings, connector settings, change password |
| UsersPage | /users | Admin user CRUD with role-based access |
| ImportExportPage | /import-export | CSV upload, job tracking, error download |
| ChangePasswordPage | /change-password | First-login forced password change |
Shared components
PageHeader, LoadingSpinner, ErrorDisplay, ErrorBoundary, EmptyState, SearchBar, Pagination, TierSelect, PointsBadge, CustomerLedgerTable.
Theming
- Tailwind CSS 3 with the
@medusajs/ui-preset. - Dark mode toggles via the
.darkclass on<html>(use any switcher you like — the components react automatically). - Brand-tokenize via CSS custom properties prefixed
--loyalty-*in your own stylesheet.
Sibling packages
| Package | Purpose |
| -------------------------------------------------------------------------------------------------------- | ------------------------------------------------- |
| @devx-commerce/loyaltyx-core | Shared types + zod schemas |
| @devx-commerce/loyaltyx-api-client | Typed HTTP client |
| @devx-commerce/loyaltyx-hooks | React Query hooks (used internally by every page) |
License
Apache-2.0 — see LICENSE.
