payaza-storefront-layouts 1.0.0 → 1.0.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/README.md +395 -33
- package/dist/layouts/booking/components/BookingHomePage.js +1 -1
- package/dist/layouts/booking-agenda/components/BookingHomePageAgenda.d.ts.map +1 -1
- package/dist/layouts/booking-agenda/components/BookingHomePageAgenda.js +1 -1
- package/dist/layouts/clothing/components/ClothingHomePage.js +1 -1
- package/dist/layouts/clothing-minimal/components/ClothingHomePageMinimal.d.ts.map +1 -1
- package/dist/layouts/clothing-minimal/components/ClothingHomePageMinimal.js +1 -1
- package/dist/layouts/electronics/components/ElectronicsHomePage.d.ts.map +1 -1
- package/dist/layouts/electronics/components/ElectronicsHomePage.js +1 -1
- package/dist/layouts/electronics-grid/components/ElectronicsHomePageGrid.js +1 -1
- package/dist/layouts/electronics-grid/pages/CategoriesPage.js +1 -1
- package/dist/layouts/food/components/FoodHomePage.d.ts.map +1 -1
- package/dist/layouts/food/components/FoodHomePage.js +2 -2
- package/dist/layouts/food-modern/components/FoodHomePageModern.d.ts.map +1 -1
- package/dist/layouts/food-modern/components/FoodHomePageModern.js +1 -1
- package/dist/layouts/motivational-speaker/components/MotivationalHomePage.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,15 +1,23 @@
|
|
|
1
|
-
# storefront-layouts
|
|
1
|
+
# @payaza/storefront-layouts
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A comprehensive package of shared layout components, utilities, and services for StoreFront applications. This package contains all layout components, UI components, hooks, contexts, and utility functions used across Payaza StoreFront applications.
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
|
-
This package
|
|
7
|
+
This package provides a complete set of reusable layout components that are data-agnostic and accept `storeConfig` as props, allowing multiple stores to use the same layout instances with different data. It includes:
|
|
8
|
+
|
|
9
|
+
- **9 Layout Types**: Food, Food Modern, Clothing, Clothing Minimal, Booking, Booking Agenda, Electronics, Electronics Grid, and Motivational Speaker
|
|
10
|
+
- **Shared Components**: Base layouts, headers, footers, and common page components
|
|
11
|
+
- **UI Components**: Buttons, modals, toasts, product cards, and more
|
|
12
|
+
- **Learning Components**: Certificate templates, mentorship progress, and certificate viewer
|
|
13
|
+
- **Services**: API services for checkout, payment, shipping, orders, and more
|
|
14
|
+
- **Utilities**: Asset helpers, currency formatting, demo detection, and more
|
|
15
|
+
- **Contexts**: Auth, Store, and Loading contexts
|
|
8
16
|
|
|
9
17
|
## Installation
|
|
10
18
|
|
|
11
19
|
```bash
|
|
12
|
-
npm install storefront-layouts
|
|
20
|
+
npm install @payaza/storefront-layouts
|
|
13
21
|
```
|
|
14
22
|
|
|
15
23
|
Or using npm workspaces:
|
|
@@ -17,62 +25,374 @@ Or using npm workspaces:
|
|
|
17
25
|
```json
|
|
18
26
|
{
|
|
19
27
|
"dependencies": {
|
|
20
|
-
"storefront-layouts": "workspace:*"
|
|
28
|
+
"@payaza/storefront-layouts": "workspace:*"
|
|
21
29
|
}
|
|
22
30
|
}
|
|
23
31
|
```
|
|
24
32
|
|
|
33
|
+
## Peer Dependencies
|
|
34
|
+
|
|
35
|
+
This package requires the following peer dependencies (must be installed in your project):
|
|
36
|
+
|
|
37
|
+
```json
|
|
38
|
+
{
|
|
39
|
+
"framer-motion": "^12.0.0",
|
|
40
|
+
"next": "^16.0.3",
|
|
41
|
+
"react": "^19.2.0",
|
|
42
|
+
"react-dom": "^19.2.0"
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
25
46
|
## Usage
|
|
26
47
|
|
|
27
|
-
###
|
|
48
|
+
### Basic Layout Usage
|
|
28
49
|
|
|
29
50
|
```typescript
|
|
30
|
-
import { FoodHomePage } from 'storefront-layouts';
|
|
51
|
+
import { FoodHomePage, FoodProductsPage, FoodProductDetailPage } from '@payaza/storefront-layouts';
|
|
31
52
|
|
|
32
53
|
export default function StorePage({ storeConfig }) {
|
|
33
54
|
return <FoodHomePage storeConfig={storeConfig} />;
|
|
34
55
|
}
|
|
35
56
|
```
|
|
36
57
|
|
|
37
|
-
###
|
|
58
|
+
### Using Layout-Specific Pages
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
import {
|
|
62
|
+
FoodProductsPage,
|
|
63
|
+
FoodProductDetailPage,
|
|
64
|
+
FoodCategoryPage,
|
|
65
|
+
FoodCategoriesPage,
|
|
66
|
+
FoodMenuPage,
|
|
67
|
+
FoodAboutPage,
|
|
68
|
+
FoodContactPage
|
|
69
|
+
} from '@payaza/storefront-layouts';
|
|
70
|
+
|
|
71
|
+
// Use layout-specific pages
|
|
72
|
+
<FoodProductsPage storeConfig={storeConfig} />
|
|
73
|
+
<FoodProductDetailPage storeConfig={storeConfig} productId="123" />
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Using Shared Components
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
import {
|
|
80
|
+
BaseStoreLayout,
|
|
81
|
+
GenericPageWrapper,
|
|
82
|
+
StoreHeader,
|
|
83
|
+
StoreFooter,
|
|
84
|
+
AccountPage,
|
|
85
|
+
CartPage,
|
|
86
|
+
CheckoutPage
|
|
87
|
+
} from '@payaza/storefront-layouts';
|
|
88
|
+
|
|
89
|
+
<BaseStoreLayout storeConfig={storeConfig}>
|
|
90
|
+
{/* Your content */}
|
|
91
|
+
</BaseStoreLayout>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Using Learning Components
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
import {
|
|
98
|
+
CertificateCard,
|
|
99
|
+
CertificateViewer,
|
|
100
|
+
MentorshipProgress
|
|
101
|
+
} from '@payaza/storefront-layouts';
|
|
102
|
+
|
|
103
|
+
<CertificateCard
|
|
104
|
+
certificate={certificateData}
|
|
105
|
+
onDownload={(id) => console.log('Download', id)}
|
|
106
|
+
/>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Using Utilities
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
import {
|
|
113
|
+
formatCurrency,
|
|
114
|
+
filterActiveServices,
|
|
115
|
+
getBannerImage,
|
|
116
|
+
getServiceImage,
|
|
117
|
+
getThemeColor,
|
|
118
|
+
isDemoStore,
|
|
119
|
+
shouldUseAPI
|
|
120
|
+
} from '@payaza/storefront-layouts';
|
|
121
|
+
|
|
122
|
+
const price = formatCurrency(1000, 'NGN'); // "₦1,000.00"
|
|
123
|
+
const activeServices = filterActiveServices(services);
|
|
124
|
+
const bannerUrl = getBannerImage(storeConfig);
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Using JSON Layout Data
|
|
38
128
|
|
|
39
129
|
```typescript
|
|
40
|
-
import { getLayoutJSON } from 'storefront-layouts';
|
|
130
|
+
import { getLayoutJSON, layoutJSONMap } from '@payaza/storefront-layouts/json';
|
|
41
131
|
|
|
42
132
|
const layoutData = getLayoutJSON('food');
|
|
133
|
+
// or
|
|
134
|
+
const layoutData = layoutJSONMap.get('food');
|
|
43
135
|
```
|
|
44
136
|
|
|
45
137
|
## Available Layouts
|
|
46
138
|
|
|
47
|
-
|
|
48
|
-
- `
|
|
49
|
-
- `
|
|
50
|
-
- `
|
|
51
|
-
- `
|
|
52
|
-
- `
|
|
53
|
-
- `
|
|
54
|
-
- `
|
|
55
|
-
- `
|
|
56
|
-
|
|
139
|
+
### Food Layouts
|
|
140
|
+
- `FoodHomePage` - Main homepage component
|
|
141
|
+
- `FoodProductsPage` - Products listing page
|
|
142
|
+
- `FoodProductDetailPage` - Product detail page
|
|
143
|
+
- `FoodCategoryPage` - Category detail page
|
|
144
|
+
- `FoodCategoriesPage` - Categories listing page
|
|
145
|
+
- `FoodMenuPage` - Menu page
|
|
146
|
+
- `FoodAboutPage` - About page
|
|
147
|
+
- `FoodContactPage` - Contact page
|
|
148
|
+
|
|
149
|
+
### Food Modern Layouts
|
|
150
|
+
- `FoodHomePageModern` - Modern food homepage
|
|
151
|
+
- `FoodModernProductsPage` - Modern products page
|
|
152
|
+
- `FoodModernProductDetailPage` - Modern product detail
|
|
153
|
+
- `FoodModernCategoryPage` - Modern category page
|
|
154
|
+
- `FoodModernCategoriesPage` - Modern categories page
|
|
155
|
+
- `FoodModernMenuPage` - Modern menu page
|
|
156
|
+
- `FoodModernAboutPage` - Modern about page
|
|
157
|
+
- `FoodModernContactPage` - Modern contact page
|
|
158
|
+
|
|
159
|
+
### Clothing Layouts
|
|
160
|
+
- `ClothingHomePage` - Clothing homepage
|
|
161
|
+
- `ClothingProductsPage` - Products page
|
|
162
|
+
- `ClothingProductDetailPage` - Product detail
|
|
163
|
+
- `ClothingCategoryPage` - Category page
|
|
164
|
+
- `ClothingCategoriesPage` - Categories page
|
|
165
|
+
- `ClothingAboutPage` - About page
|
|
166
|
+
- `ClothingContactPage` - Contact page
|
|
167
|
+
|
|
168
|
+
### Clothing Minimal Layouts
|
|
169
|
+
- `ClothingHomePageMinimal` - Minimal clothing homepage
|
|
170
|
+
- `ClothingMinimalProductsPage` - Minimal products page
|
|
171
|
+
- `ClothingMinimalProductDetailPage` - Minimal product detail
|
|
172
|
+
- `ClothingMinimalCategoryPage` - Minimal category page
|
|
173
|
+
- `ClothingMinimalCategoriesPage` - Minimal categories page
|
|
174
|
+
- `ClothingMinimalAboutPage` - Minimal about page
|
|
175
|
+
- `ClothingMinimalContactPage` - Minimal contact page
|
|
176
|
+
|
|
177
|
+
### Booking Layouts
|
|
178
|
+
- `BookingHomePage` - Booking homepage
|
|
179
|
+
- `BookingBookPage` - Book appointment page
|
|
180
|
+
- `BookingServicesPage` - Services listing page
|
|
181
|
+
- `BookingProductDetailPage` - Service detail page
|
|
182
|
+
- `BookingCategoryPage` - Category page
|
|
183
|
+
- `BookingCategoriesPage` - Categories page
|
|
184
|
+
- `BookingAboutPage` - About page
|
|
185
|
+
- `BookingContactPage` - Contact page
|
|
186
|
+
|
|
187
|
+
### Booking Agenda Layouts
|
|
188
|
+
- `BookingHomePageAgenda` - Agenda-based booking homepage
|
|
189
|
+
- `BookingAgendaBookPage` - Agenda book page
|
|
190
|
+
- `BookingAgendaServicesPage` - Agenda services page
|
|
191
|
+
- `BookingAgendaProductDetailPage` - Agenda service detail
|
|
192
|
+
- `BookingAgendaCategoryPage` - Agenda category page
|
|
193
|
+
- `BookingAgendaCategoriesPage` - Agenda categories page
|
|
194
|
+
- `BookingAgendaAboutPage` - Agenda about page
|
|
195
|
+
- `BookingAgendaContactPage` - Agenda contact page
|
|
196
|
+
|
|
197
|
+
### Electronics Layouts
|
|
198
|
+
- `ElectronicsHomePage` - Electronics homepage
|
|
199
|
+
- `ElectronicsProductsPage` - Products page
|
|
200
|
+
- `ElectronicsProductDetailPage` - Product detail
|
|
201
|
+
- `ElectronicsCategoryPage` - Category page
|
|
202
|
+
- `ElectronicsCategoriesPage` - Categories page
|
|
203
|
+
- `ElectronicsAboutPage` - About page
|
|
204
|
+
- `ElectronicsContactPage` - Contact page
|
|
205
|
+
- `ElectronicsHelpCenterPage` - Help center page
|
|
206
|
+
- `ElectronicsPrivacyPolicyPage` - Privacy policy page
|
|
207
|
+
- `ElectronicsShippingReturnsPage` - Shipping & returns page
|
|
208
|
+
- `ElectronicsTermsPage` - Terms page
|
|
209
|
+
- `ElectronicsTrackOrderPage` - Track order page
|
|
210
|
+
- `ElectronicsPageWrapper` - Page wrapper component
|
|
211
|
+
- `ElectronicsStoreHeader` - Store header
|
|
212
|
+
- `ElectronicsStoreFooter` - Store footer
|
|
213
|
+
|
|
214
|
+
### Electronics Grid Layouts
|
|
215
|
+
- `ElectronicsHomePageGrid` - Grid-based electronics homepage
|
|
216
|
+
- `ElectronicsGridProductsPage` - Grid products page
|
|
217
|
+
- `ElectronicsGridProductDetailPage` - Grid product detail
|
|
218
|
+
- `ElectronicsGridCategoryPage` - Grid category page
|
|
219
|
+
- `ElectronicsGridCategoriesPage` - Grid categories page
|
|
220
|
+
- `ElectronicsGridAboutPage` - Grid about page
|
|
221
|
+
- `ElectronicsGridContactPage` - Grid contact page
|
|
222
|
+
- `ElectronicsGridHelpCenterPage` - Grid help center page
|
|
223
|
+
- `ElectronicsGridPrivacyPolicyPage` - Grid privacy policy page
|
|
224
|
+
- `ElectronicsGridShippingReturnsPage` - Grid shipping & returns page
|
|
225
|
+
- `ElectronicsGridTermsPage` - Grid terms page
|
|
226
|
+
- `ElectronicsGridTrackOrderPage` - Grid track order page
|
|
227
|
+
|
|
228
|
+
### Motivational Speaker Layouts
|
|
229
|
+
- `MotivationalHomePage` - Motivational speaker homepage
|
|
230
|
+
- `MotivationalProductsPage` - Products page
|
|
231
|
+
- `MotivationalCategoryPage` - Category page
|
|
232
|
+
- `MotivationalServicesPage` - Services page
|
|
233
|
+
- `MotivationalServiceDetailPage` - Service detail page
|
|
234
|
+
- `MotivationalSubscriptionPage` - Subscription page
|
|
235
|
+
- `MotivationalAboutPage` - About page
|
|
236
|
+
- `MotivationalContactPage` - Contact page
|
|
237
|
+
- `MotivationalPageWrapper` - Page wrapper component
|
|
238
|
+
|
|
239
|
+
### Shared Components
|
|
240
|
+
- `BaseStoreLayout` - Base layout wrapper for all stores
|
|
241
|
+
- `GenericPageWrapper` - Generic page wrapper
|
|
242
|
+
- `StoreHeader` - Store header component
|
|
243
|
+
- `StoreFooter` - Store footer component
|
|
244
|
+
- `PromoBanner` - Promotional banner component
|
|
245
|
+
- `TestimonialCard` - Testimonial card component
|
|
246
|
+
|
|
247
|
+
### Shared Pages
|
|
248
|
+
- `AccountPage` - User account page with tabs (Profile, Orders, Bookings, Wishlist, Learning)
|
|
249
|
+
- `CartPage` - Shopping cart page
|
|
250
|
+
- `CheckoutPage` - Checkout page
|
|
251
|
+
- `WishlistPage` - Wishlist page
|
|
252
|
+
- `TeamPage` - Team members page
|
|
253
|
+
- `PortfolioPage` - Portfolio page
|
|
254
|
+
- `HelpCenterPage` - Help center page
|
|
255
|
+
- `ShippingReturnsPage` - Shipping & returns page
|
|
256
|
+
- `PrivacyPolicyPage` - Privacy policy page
|
|
257
|
+
- `TermsPage` - Terms of service page
|
|
258
|
+
- `CookiePolicyPage` - Cookie policy page
|
|
259
|
+
- `SizeGuidePage` - Size guide page
|
|
260
|
+
- `StyleGuidePage` - Style guide page
|
|
261
|
+
- `TrackOrderPage` - Track order page
|
|
262
|
+
- `MaintenancePage` - Maintenance mode page
|
|
263
|
+
- `FeatureDisabledPage` - Feature disabled page
|
|
264
|
+
|
|
265
|
+
### Learning Components
|
|
266
|
+
- `CertificateCard` - Certificate card component
|
|
267
|
+
- `CertificateViewer` - Certificate viewer component
|
|
268
|
+
- `MentorshipProgress` - Mentorship progress component
|
|
269
|
+
|
|
270
|
+
## Utilities
|
|
271
|
+
|
|
272
|
+
### Asset Helpers
|
|
273
|
+
```typescript
|
|
274
|
+
import {
|
|
275
|
+
getBannerImage,
|
|
276
|
+
getServiceImage,
|
|
277
|
+
getTeamMemberImage,
|
|
278
|
+
getTextContent,
|
|
279
|
+
getLayoutText,
|
|
280
|
+
getThemeColor,
|
|
281
|
+
getLogoUrl
|
|
282
|
+
} from '@payaza/storefront-layouts';
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### Currency & Formatting
|
|
286
|
+
```typescript
|
|
287
|
+
import {
|
|
288
|
+
formatCurrency,
|
|
289
|
+
normalizePrice,
|
|
290
|
+
getCurrencySymbol,
|
|
291
|
+
getCurrencySymbolInfo
|
|
292
|
+
} from '@payaza/storefront-layouts';
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
### Demo Detection
|
|
296
|
+
```typescript
|
|
297
|
+
import {
|
|
298
|
+
isDemoStore,
|
|
299
|
+
shouldUseAPI,
|
|
300
|
+
getBaseStoreSlug
|
|
301
|
+
} from '@payaza/storefront-layouts';
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### Filtering
|
|
305
|
+
```typescript
|
|
306
|
+
import {
|
|
307
|
+
filterActiveProducts,
|
|
308
|
+
filterActiveServices
|
|
309
|
+
} from '@payaza/storefront-layouts';
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
### Store Configuration
|
|
313
|
+
```typescript
|
|
314
|
+
import {
|
|
315
|
+
getStoreConfigAsync,
|
|
316
|
+
transformProductToStoreProduct,
|
|
317
|
+
extractImageUrls
|
|
318
|
+
} from '@payaza/storefront-layouts';
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
## Services
|
|
322
|
+
|
|
323
|
+
The package includes service stubs for:
|
|
324
|
+
- `checkoutService` - Checkout operations
|
|
325
|
+
- `paymentService` - Payment processing
|
|
326
|
+
- `shippingService` - Shipping operations
|
|
327
|
+
- `orderService` - Order management
|
|
328
|
+
- `wishlistService` - Wishlist operations
|
|
329
|
+
- `customerService` - Customer management
|
|
330
|
+
- `bookingService` - Booking operations
|
|
331
|
+
- `cartService` - Cart operations
|
|
332
|
+
- `productService` - Product operations
|
|
333
|
+
- `categoryService` - Category operations
|
|
334
|
+
- `reviewService` - Review operations
|
|
335
|
+
- `analyticsService` - Analytics tracking
|
|
336
|
+
|
|
337
|
+
## Contexts
|
|
338
|
+
|
|
339
|
+
### Auth Context
|
|
340
|
+
```typescript
|
|
341
|
+
import { AuthProvider, useAuth } from '@payaza/storefront-layouts';
|
|
342
|
+
|
|
343
|
+
<AuthProvider>
|
|
344
|
+
<YourApp />
|
|
345
|
+
</AuthProvider>
|
|
346
|
+
|
|
347
|
+
// In components
|
|
348
|
+
const { user, isAuthenticated, login, logout } = useAuth();
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
### Store Context
|
|
352
|
+
```typescript
|
|
353
|
+
import { StoreProvider, useStore } from '@payaza/storefront-layouts';
|
|
57
354
|
|
|
58
|
-
|
|
355
|
+
const { storeConfig, updateStoreConfig } = useStore();
|
|
356
|
+
```
|
|
59
357
|
|
|
60
|
-
|
|
358
|
+
### Loading Context
|
|
359
|
+
```typescript
|
|
360
|
+
import { LoadingProvider, useLoading } from '@payaza/storefront-layouts';
|
|
61
361
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
362
|
+
const { startBackendLoading, stopBackendLoading } = useLoading();
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
## Hooks
|
|
366
|
+
|
|
367
|
+
### Payaza Checkout Hook
|
|
368
|
+
```typescript
|
|
369
|
+
import { usePayazaCheckout } from '@payaza/storefront-layouts';
|
|
370
|
+
|
|
371
|
+
const { checkout, isLoading } = usePayazaCheckout({
|
|
372
|
+
publicKey: 'your-public-key',
|
|
373
|
+
onSuccess: () => console.log('Success'),
|
|
374
|
+
onError: (error) => console.error(error)
|
|
375
|
+
});
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
### Analytics Hook
|
|
379
|
+
```typescript
|
|
380
|
+
import { useAnalytics } from '@payaza/storefront-layouts';
|
|
381
|
+
|
|
382
|
+
const { trackEvent, trackPageView } = useAnalytics();
|
|
383
|
+
```
|
|
65
384
|
|
|
66
385
|
## TypeScript Configuration
|
|
67
386
|
|
|
68
|
-
Consuming apps need to configure TypeScript paths
|
|
387
|
+
Consuming apps need to configure TypeScript paths. The package uses relative imports internally, so no special path configuration is required for the package itself.
|
|
388
|
+
|
|
389
|
+
For your app's internal `@/` aliases:
|
|
69
390
|
|
|
70
391
|
```json
|
|
71
392
|
{
|
|
72
393
|
"compilerOptions": {
|
|
73
394
|
"paths": {
|
|
74
|
-
"@/*": ["./*"]
|
|
75
|
-
"storefront-layouts": ["../storefront-layouts/src"]
|
|
395
|
+
"@/*": ["./*"]
|
|
76
396
|
}
|
|
77
397
|
}
|
|
78
398
|
}
|
|
@@ -84,10 +404,36 @@ Add to `next.config.ts`:
|
|
|
84
404
|
|
|
85
405
|
```typescript
|
|
86
406
|
const nextConfig = {
|
|
87
|
-
transpilePackages: ['storefront-layouts'],
|
|
407
|
+
transpilePackages: ['@payaza/storefront-layouts'],
|
|
88
408
|
};
|
|
89
409
|
```
|
|
90
410
|
|
|
411
|
+
## Building
|
|
412
|
+
|
|
413
|
+
```bash
|
|
414
|
+
npm run build
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
This will:
|
|
418
|
+
1. Clean the `dist/` directory
|
|
419
|
+
2. Compile TypeScript to JavaScript
|
|
420
|
+
3. Transform path aliases using `tsc-alias`
|
|
421
|
+
4. Copy JSON files to the dist directory
|
|
422
|
+
|
|
423
|
+
## Package Structure
|
|
424
|
+
|
|
425
|
+
```
|
|
426
|
+
@payaza/storefront-layouts/
|
|
427
|
+
├── dist/ # Compiled output
|
|
428
|
+
│ ├── layouts/ # Layout components
|
|
429
|
+
│ ├── components/ # UI components
|
|
430
|
+
│ ├── lib/ # Utilities, services, contexts
|
|
431
|
+
│ ├── hooks/ # Custom hooks
|
|
432
|
+
│ └── json/ # Layout JSON data
|
|
433
|
+
├── src/ # Source files
|
|
434
|
+
└── package.json
|
|
435
|
+
```
|
|
436
|
+
|
|
91
437
|
## Dynamic Data Support
|
|
92
438
|
|
|
93
439
|
Layouts are designed to work with dynamic data:
|
|
@@ -96,13 +442,29 @@ Layouts are designed to work with dynamic data:
|
|
|
96
442
|
- Layouts use hooks like `useStore()` from consuming apps
|
|
97
443
|
- No hardcoded data - all data comes from consuming apps
|
|
98
444
|
- Supports `preview_layout` query parameter for layout preview
|
|
445
|
+
- Demo store detection for mock data vs API data
|
|
99
446
|
|
|
100
|
-
##
|
|
447
|
+
## Features
|
|
101
448
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
449
|
+
- ✅ **9 Complete Layout Types** - Food, Clothing, Booking, Electronics, and more
|
|
450
|
+
- ✅ **Shared Components** - Reusable components across all layouts
|
|
451
|
+
- ✅ **Learning Components** - Certificate and mentorship features
|
|
452
|
+
- ✅ **TypeScript Support** - Full type definitions included
|
|
453
|
+
- ✅ **Utility Functions** - Currency formatting, asset helpers, filtering
|
|
454
|
+
- ✅ **Service Stubs** - Ready-to-use service interfaces
|
|
455
|
+
- ✅ **Context Providers** - Auth, Store, and Loading contexts
|
|
456
|
+
- ✅ **Custom Hooks** - Payaza checkout, analytics, and more
|
|
457
|
+
- ✅ **Responsive Design** - All components are mobile-responsive
|
|
458
|
+
- ✅ **Accessibility** - ARIA labels and keyboard navigation support
|
|
459
|
+
|
|
460
|
+
## Version
|
|
461
|
+
|
|
462
|
+
Current version: **1.0.0**
|
|
463
|
+
|
|
464
|
+
## License
|
|
105
465
|
|
|
106
|
-
|
|
466
|
+
ISC
|
|
107
467
|
|
|
468
|
+
## Support
|
|
108
469
|
|
|
470
|
+
For issues, questions, or contributions, please contact the Payaza development team.
|
|
@@ -6,7 +6,7 @@ import Link from 'next/link';
|
|
|
6
6
|
import Image from 'next/image';
|
|
7
7
|
import { formatCurrency, filterActiveServices } from '../../../lib/utils';
|
|
8
8
|
import { getBannerImage, getServiceImage, getTeamMemberImage, getTextContent, getFeaturesList, getLayoutText } from '../../../lib/utils/asset-helpers';
|
|
9
|
-
import { TestimonialCard } from '
|
|
9
|
+
import { TestimonialCard } from '../../shared/components/TestimonialCard';
|
|
10
10
|
export function BookingHomePage({ storeConfig }) {
|
|
11
11
|
const services = filterActiveServices(storeConfig.services || []);
|
|
12
12
|
const primaryColor = storeConfig.branding.primaryColor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BookingHomePageAgenda.d.ts","sourceRoot":"","sources":["../../../../src/layouts/booking-agenda/components/BookingHomePageAgenda.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAehD,UAAU,0BAA0B;
|
|
1
|
+
{"version":3,"file":"BookingHomePageAgenda.d.ts","sourceRoot":"","sources":["../../../../src/layouts/booking-agenda/components/BookingHomePageAgenda.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAehD,UAAU,0BAA0B;IACjC,WAAW,EAAE,WAAW,CAAC;CAC3B;AAED,wBAAgB,qBAAqB,CAAC,EAAE,WAAW,EAAE,EAAE,0BAA0B,2CA4oBhF"}
|
|
@@ -12,7 +12,7 @@ import { formatCurrency, filterActiveServices } from '../../../lib/utils';
|
|
|
12
12
|
import { useAuth } from '../../../lib/auth-context';
|
|
13
13
|
import { getBannerImage, getServiceImage, getTeamMemberImage, getTextContent, getLayoutText, getThemeColor } from '../../../lib/utils/asset-helpers';
|
|
14
14
|
import { isDemoStore, shouldUseAPI } from '../../../lib/utils/demo-detection';
|
|
15
|
-
import { TestimonialCard } from '
|
|
15
|
+
import { TestimonialCard } from '../../shared/components/TestimonialCard';
|
|
16
16
|
export function BookingHomePageAgenda({ storeConfig }) {
|
|
17
17
|
const layoutConfig = storeConfig.layoutConfig;
|
|
18
18
|
const categories = storeConfig.categories || [];
|
|
@@ -10,7 +10,7 @@ import { useState, useEffect } from 'react';
|
|
|
10
10
|
import { formatCurrency, filterActiveProducts } from '../../../lib/utils';
|
|
11
11
|
import { getLayoutText, getBannerImage } from '../../../lib/utils/asset-helpers';
|
|
12
12
|
import { shouldUseAPI } from '../../../lib/utils/demo-detection';
|
|
13
|
-
import { PromoBanner } from '
|
|
13
|
+
import { PromoBanner } from '../../shared/components/PromoBanner';
|
|
14
14
|
export function ClothingHomePage({ storeConfig }) {
|
|
15
15
|
const layoutConfig = storeConfig.layoutConfig;
|
|
16
16
|
const categories = storeConfig.categories || [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClothingHomePageMinimal.d.ts","sourceRoot":"","sources":["../../../../src/layouts/clothing-minimal/components/ClothingHomePageMinimal.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAgB,MAAM,mBAAmB,CAAC;AAe9D,UAAU,4BAA4B;
|
|
1
|
+
{"version":3,"file":"ClothingHomePageMinimal.d.ts","sourceRoot":"","sources":["../../../../src/layouts/clothing-minimal/components/ClothingHomePageMinimal.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAgB,MAAM,mBAAmB,CAAC;AAe9D,UAAU,4BAA4B;IACnC,WAAW,EAAE,WAAW,CAAC;CAC3B;AAED,wBAAgB,uBAAuB,CAAC,EAAE,WAAW,EAAE,EAAE,4BAA4B,2CAobpF"}
|
|
@@ -12,7 +12,7 @@ import { useState, useEffect } from 'react';
|
|
|
12
12
|
import { formatCurrency, filterActiveProducts } from '../../../lib/utils';
|
|
13
13
|
import { getLayoutText, getBannerImage, getTextContent, getLogoUrl } from '../../../lib/utils/asset-helpers';
|
|
14
14
|
import { StoreLogo } from '../../../components/ui/store-logos';
|
|
15
|
-
import { PromoBanner } from '
|
|
15
|
+
import { PromoBanner } from '../../shared/components/PromoBanner';
|
|
16
16
|
export function ClothingHomePageMinimal({ storeConfig }) {
|
|
17
17
|
const layoutConfig = storeConfig.layoutConfig;
|
|
18
18
|
const categories = storeConfig.categories || [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ElectronicsHomePage.d.ts","sourceRoot":"","sources":["../../../../src/layouts/electronics/components/ElectronicsHomePage.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAgB,MAAM,mBAAmB,CAAC;AAe9D,UAAU,wBAAwB;
|
|
1
|
+
{"version":3,"file":"ElectronicsHomePage.d.ts","sourceRoot":"","sources":["../../../../src/layouts/electronics/components/ElectronicsHomePage.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAgB,MAAM,mBAAmB,CAAC;AAe9D,UAAU,wBAAwB;IAC/B,WAAW,EAAE,WAAW,CAAC;CAC3B;AAED,wBAAgB,mBAAmB,CAAC,EAAE,WAAW,EAAE,EAAE,wBAAwB,2CAiZ5E"}
|
|
@@ -12,7 +12,7 @@ import { useStore } from '../../../lib/store-context';
|
|
|
12
12
|
import { useToast } from '../../../components/ui/toast';
|
|
13
13
|
import { formatCurrency, filterActiveProducts } from '../../../lib/utils';
|
|
14
14
|
import { getLayoutText } from '../../../lib/utils/asset-helpers';
|
|
15
|
-
import { PromoBanner } from '
|
|
15
|
+
import { PromoBanner } from '../../shared/components/PromoBanner';
|
|
16
16
|
export function ElectronicsHomePage({ storeConfig }) {
|
|
17
17
|
const { addToCart } = useStore();
|
|
18
18
|
const { addToast } = useToast();
|
|
@@ -14,7 +14,7 @@ import { useState } from 'react';
|
|
|
14
14
|
import { formatCurrency, cn, filterActiveProducts } from '../../../lib/utils';
|
|
15
15
|
import { getLayoutText, getBannerImage, getLogoUrl } from '../../../lib/utils/asset-helpers';
|
|
16
16
|
import { StoreLogo } from '../../../components/ui/store-logos';
|
|
17
|
-
import { PromoBanner } from '
|
|
17
|
+
import { PromoBanner } from '../../shared/components/PromoBanner';
|
|
18
18
|
import { ElectronicsGridProductCard } from './ElectronicsGridProductCard';
|
|
19
19
|
const ElectronicsFilterContent = ({ categories, storeSlug }) => (_jsxs("div", { className: "space-y-6", children: [_jsxs("div", { className: "bg-white border-b border-gray-100 overflow-hidden", children: [_jsxs("div", { className: "bg-white px-4 py-3 border-b border-gray-100 font-normal text-sm text-gray-900 flex justify-between items-center", children: ["Browse by ", _jsx(ChevronDown, { className: "h-4 w-4 text-gray-400" })] }), _jsx("div", { className: "py-2", children: _jsx(CategoryTree, { categories: categories, mode: "link", storeSlug: storeSlug, linkBasePath: "" }) })] }), _jsxs("div", { className: "bg-white p-6 space-y-8", children: [_jsxs("div", { children: [_jsx("h3", { className: "font-medium text-sm text-gray-900 mb-4", children: "Availability" }), _jsxs("label", { className: "flex items-center gap-2 text-sm text-gray-600 cursor-pointer hover:text-gray-900 p-2 -ml-2 transition-colors", children: [_jsx("input", { type: "checkbox", className: "rounded border-gray-300 text-gray-900 focus:ring-gray-400", defaultChecked: true }), "In Stock"] }), _jsxs("label", { className: "flex items-center gap-2 text-sm text-gray-600 cursor-pointer hover:text-gray-900 p-2 -ml-2 transition-colors mt-2", children: [_jsx("input", { type: "checkbox", className: "rounded border-gray-300 text-gray-900 focus:ring-gray-400" }), "On Sale"] })] }), _jsxs("div", { className: "border-t border-gray-100 pt-6", children: [_jsx("h3", { className: "font-medium text-sm text-gray-900 mb-4", children: "Price" }), _jsxs("div", { className: "flex items-center gap-2 mb-3", children: [_jsxs("div", { className: "relative flex-1", children: [_jsx("span", { className: "absolute left-2 top-1.5 text-gray-400 text-xs", children: "$" }), _jsx("input", { type: "number", className: "w-full pl-5 pr-2 py-1.5 text-sm border border-gray-300 rounded focus:ring-1 focus:ring-gray-400 focus:border-gray-400", placeholder: "Min" })] }), _jsx("span", { className: "text-gray-400", children: "-" }), _jsxs("div", { className: "relative flex-1", children: [_jsx("span", { className: "absolute left-2 top-1.5 text-gray-400 text-xs", children: "$" }), _jsx("input", { type: "number", className: "w-full pl-5 pr-2 py-1.5 text-sm border border-gray-300 rounded focus:ring-1 focus:ring-gray-400 focus:border-gray-400", placeholder: "Max" })] })] }), _jsx(Button, { size: "sm", variant: "outline", className: "w-full text-xs font-normal border-gray-300 text-gray-700 hover:bg-gray-50", children: "Apply Price" })] }), _jsxs("div", { className: "border-t border-gray-100 pt-6", children: [_jsx("h3", { className: "font-medium text-sm text-gray-900 mb-4", children: "Brands" }), _jsx("div", { className: "space-y-2 max-h-48 overflow-y-auto pr-1 scrollbar-thin scrollbar-thumb-gray-200", children: ['Apple'].map(brand => (_jsxs("label", { className: "flex items-center gap-2 text-sm text-gray-600 cursor-pointer hover:text-gray-900 p-2 -ml-2 transition-colors", children: [_jsx("input", { type: "checkbox", className: "rounded border-gray-300 text-gray-900 focus:ring-gray-400", defaultChecked: true }), brand] }, brand))) })] }), _jsxs("div", { className: "border-t border-gray-100 pt-6", children: [_jsx("h3", { className: "font-medium text-sm text-gray-900 mb-4", children: "Rating" }), [4, 3, 2].map(stars => (_jsxs("label", { className: "flex items-center gap-2 text-sm text-gray-600 cursor-pointer hover:text-gray-900 p-2 -ml-2 transition-colors mb-1.5", children: [_jsx("input", { type: "radio", name: "rating", className: "border-gray-300 text-gray-900 focus:ring-gray-400" }), _jsx("div", { className: "flex text-yellow-400", children: [...Array(5)].map((_, i) => (_jsx(Star, { className: `h-3 w-3 ${i < stars ? 'fill-current' : 'text-gray-200 fill-gray-200'}` }, i))) }), _jsx("span", { className: "text-xs", children: "& Up" })] }, stars)))] })] })] }));
|
|
20
20
|
export function ElectronicsHomePageGrid({ storeConfig }) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { ElectronicsGridCategoriesPage } from '
|
|
3
|
+
import { ElectronicsGridCategoriesPage } from './ElectronicsGridCategoriesPage';
|
|
4
4
|
export function CategoriesPage({ storeConfig }) {
|
|
5
5
|
return _jsx(ElectronicsGridCategoriesPage, { storeConfig: storeConfig });
|
|
6
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FoodHomePage.d.ts","sourceRoot":"","sources":["../../../../src/layouts/food/components/FoodHomePage.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAiB,MAAM,mBAAmB,CAAC;AAc/D,UAAU,iBAAiB;IACzB,WAAW,EAAE,WAAW,CAAC;CAC1B;AAED,wBAAgB,YAAY,CAAC,EAAE,WAAW,EAAE,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"FoodHomePage.d.ts","sourceRoot":"","sources":["../../../../src/layouts/food/components/FoodHomePage.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAiB,MAAM,mBAAmB,CAAC;AAc/D,UAAU,iBAAiB;IACzB,WAAW,EAAE,WAAW,CAAC;CAC1B;AAED,wBAAgB,YAAY,CAAC,EAAE,WAAW,EAAE,EAAE,iBAAiB,2CAw9B9D"}
|
|
@@ -10,8 +10,8 @@ import { useState, useEffect } from 'react';
|
|
|
10
10
|
import { formatCurrency } from '../../../lib/utils';
|
|
11
11
|
import { getLayoutText, getBannerImage, getTextContent } from '../../../lib/utils/asset-helpers';
|
|
12
12
|
import { shouldUseAPI } from '../../../lib/utils/demo-detection';
|
|
13
|
-
import { TestimonialCard } from '
|
|
14
|
-
import { PromoBanner } from '
|
|
13
|
+
import { TestimonialCard } from '../../shared/components/TestimonialCard';
|
|
14
|
+
import { PromoBanner } from '../../shared/components/PromoBanner';
|
|
15
15
|
export function FoodHomePage({ storeConfig }) {
|
|
16
16
|
const categories = storeConfig.categories || [];
|
|
17
17
|
const menuItems = storeConfig.menuItems || [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FoodHomePageModern.d.ts","sourceRoot":"","sources":["../../../../src/layouts/food-modern/components/FoodHomePageModern.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAgB,MAAM,mBAAmB,CAAC;AAgB9D,UAAU,uBAAuB;
|
|
1
|
+
{"version":3,"file":"FoodHomePageModern.d.ts","sourceRoot":"","sources":["../../../../src/layouts/food-modern/components/FoodHomePageModern.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAgB,MAAM,mBAAmB,CAAC;AAgB9D,UAAU,uBAAuB;IAC9B,WAAW,EAAE,WAAW,CAAC;CAC3B;AAED,wBAAgB,kBAAkB,CAAC,EAAE,WAAW,EAAE,EAAE,uBAAuB,2CAgoB1E"}
|
|
@@ -13,7 +13,7 @@ import { getLayoutText, getBannerImage, getLogoUrl, getAssetUrl } from '../../..
|
|
|
13
13
|
import { StoreLogo } from '../../../components/ui/store-logos';
|
|
14
14
|
import { shouldUseAPI } from '../../../lib/utils/demo-detection';
|
|
15
15
|
import { VideoPlayer } from '../../../components/ui/video-player';
|
|
16
|
-
import { PromoBanner } from '
|
|
16
|
+
import { PromoBanner } from '../../shared/components/PromoBanner';
|
|
17
17
|
export function FoodHomePageModern({ storeConfig }) {
|
|
18
18
|
const categories = storeConfig.categories || [];
|
|
19
19
|
const menuItems = storeConfig.menuItems || [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MotivationalHomePage.d.ts","sourceRoot":"","sources":["../../../../src/layouts/motivational-speaker/components/MotivationalHomePage.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAWhD,UAAU,yBAAyB;IAC/B,WAAW,EAAE,WAAW,CAAC;CAC5B;AAED,wBAAgB,oBAAoB,CAAC,EAAE,WAAW,EAAE,EAAE,yBAAyB,
|
|
1
|
+
{"version":3,"file":"MotivationalHomePage.d.ts","sourceRoot":"","sources":["../../../../src/layouts/motivational-speaker/components/MotivationalHomePage.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAWhD,UAAU,yBAAyB;IAC/B,WAAW,EAAE,WAAW,CAAC;CAC5B;AAED,wBAAgB,oBAAoB,CAAC,EAAE,WAAW,EAAE,EAAE,yBAAyB,2CA2mB9E"}
|