@lucrex/storefront-blocks 0.1.0 → 0.2.0

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.
@@ -2,7 +2,7 @@ import { ReactElement, ReactNode } from 'react';
2
2
  import { z } from 'zod';
3
3
  import { PageData } from './data';
4
4
  import { BlockStyle } from './style';
5
- export type BlockCategory = 'layout' | 'content' | 'product' | 'checkout';
5
+ export type BlockCategory = 'layout' | 'content' | 'product' | 'checkout' | 'store';
6
6
  export type FieldDefinition = {
7
7
  type: 'text' | 'textarea' | 'number';
8
8
  label: string;
@@ -0,0 +1,75 @@
1
+ export declare const AnnouncementBar: import("..").BlockDefinition<Record<string, never>>;
2
+ export declare const StoreHeader: import("..").BlockDefinition<{
3
+ navCategories: number;
4
+ }>;
5
+ export declare const StoreFooter: import("..").BlockDefinition<{
6
+ footerCategories: number;
7
+ }>;
8
+ export declare const StoreHeroTitle: import("..").BlockDefinition<{
9
+ text: string;
10
+ }>;
11
+ export declare const StoreHeroSubtitle: import("..").BlockDefinition<{
12
+ text: string;
13
+ }>;
14
+ export declare const StoreHeroButton: import("..").BlockDefinition<{
15
+ label: string;
16
+ href: string;
17
+ }>;
18
+ export declare const StoreHeroImage: import("..").BlockDefinition<{
19
+ frameClassName: string;
20
+ }>;
21
+ export declare const StoreCategories: import("..").BlockDefinition<{
22
+ layout: "section" | "nav";
23
+ listClassName: string;
24
+ itemStyle: "link" | "tag" | "card" | "pill" | "chip" | "room";
25
+ title: string;
26
+ titleLabel: "bestSellers" | "newArrivals" | "shopByCategory" | "youMayAlsoLike" | "categories" | "allProducts" | "cod";
27
+ }>;
28
+ export declare const StoreProductGrid: import("..").BlockDefinition<{
29
+ source: "home" | "related";
30
+ gridClassName: string;
31
+ title: string;
32
+ titleLabel: "bestSellers" | "newArrivals" | "shopByCategory" | "youMayAlsoLike" | "categories" | "allProducts" | "cod";
33
+ viewAll: boolean;
34
+ hideWhenEmpty: boolean;
35
+ }>;
36
+ export declare const StoreTrust: import("..").BlockDefinition<{
37
+ variant: "list" | "bento";
38
+ }>;
39
+ export declare const StoreTagline: import("..").BlockDefinition<Record<string, never>>;
40
+ export declare const StoreTicker: import("..").BlockDefinition<{
41
+ labels: ("bestSellers" | "newArrivals" | "shopByCategory" | "youMayAlsoLike" | "categories" | "allProducts" | "cod")[];
42
+ repeat: number;
43
+ }>;
44
+ export declare const StoreSearch: import("..").BlockDefinition<Record<string, never>>;
45
+ export declare const Ornament: import("..").BlockDefinition<Record<string, never>>;
46
+ export declare const StorePageHeading: import("..").BlockDefinition<{
47
+ source: "article" | "listing" | "contact";
48
+ title: string;
49
+ text: string;
50
+ }>;
51
+ export declare const ListingToolbar: import("..").BlockDefinition<Record<string, never>>;
52
+ export declare const ListingGrid: import("..").BlockDefinition<Record<string, never>>;
53
+ export declare const ListingEmpty: import("..").BlockDefinition<{
54
+ text: string;
55
+ }>;
56
+ export declare const ListingLoadMore: import("..").BlockDefinition<{
57
+ label: string;
58
+ }>;
59
+ export declare const StoreProductGallery: import("..").BlockDefinition<Record<string, never>>;
60
+ export declare const StoreBreadcrumbs: import("..").BlockDefinition<Record<string, never>>;
61
+ export declare const StoreProductTitle: import("..").BlockDefinition<Record<string, never>>;
62
+ export declare const StoreProductPrice: import("..").BlockDefinition<Record<string, never>>;
63
+ export declare const StoreProductDescription: import("..").BlockDefinition<Record<string, never>>;
64
+ export declare const StoreProductFaq: import("..").BlockDefinition<Record<string, never>>;
65
+ export declare const ContactDetails: import("..").BlockDefinition<Record<string, never>>;
66
+ export declare const ContactForm: import("..").BlockDefinition<Record<string, never>>;
67
+ export declare const StoreThankYou: import("..").BlockDefinition<{
68
+ title: string;
69
+ text: string;
70
+ }>;
71
+ export declare const StoreNotFound: import("..").BlockDefinition<{
72
+ title: string;
73
+ text: string;
74
+ }>;
75
+ export declare const StoreArticle: import("..").BlockDefinition<Record<string, never>>;
@@ -1,7 +1,11 @@
1
1
  import { ReactNode } from 'react';
2
- import { PageData } from './data';
2
+ import { FunnelPageData, OnlineStorePageData, PageData } from './data';
3
3
  export declare function PageDataProvider({ data, children }: {
4
4
  data: PageData;
5
5
  children: ReactNode;
6
6
  }): import("react").JSX.Element;
7
7
  export declare function usePageData(): PageData;
8
+ export declare function checkoutData(data: PageData): FunnelPageData;
9
+ export declare function useCheckoutData(): FunnelPageData;
10
+ export declare function storeData(data: PageData): OnlineStorePageData;
11
+ export declare function useStoreData(): OnlineStorePageData;
@@ -67,5 +67,75 @@ export interface FunnelPageData {
67
67
  api: {
68
68
  recaptchaSiteKey: string;
69
69
  };
70
+ lazyCities?: boolean;
70
71
  }
71
- export type PageData = FunnelPageData;
72
+ export interface MoneyFormat {
73
+ language: string;
74
+ iso2: string;
75
+ currency: string;
76
+ }
77
+ export interface StoreCategoryData {
78
+ trackingId: string;
79
+ name: string;
80
+ url: string;
81
+ imageUrl: string;
82
+ }
83
+ export interface StoreProductCardData {
84
+ url: string;
85
+ categoryId: string | null;
86
+ fromPrice: number;
87
+ compareAtPrice: number | null;
88
+ discountPercent: number | null;
89
+ cardImage: string | null;
90
+ cardHoverImage: string | null;
91
+ product: {
92
+ trackingId: string;
93
+ name: string;
94
+ };
95
+ }
96
+ export interface StoreContactData {
97
+ phone: string | null;
98
+ whatsapp: string | null;
99
+ email: string | null;
100
+ address: string | null;
101
+ facebook: string | null;
102
+ instagram: string | null;
103
+ tiktok: string | null;
104
+ }
105
+ export interface OnlineStorePageData {
106
+ labels: Record<string, string>;
107
+ money: MoneyFormat;
108
+ onlineStore: {
109
+ name: string;
110
+ tagline: string | null;
111
+ logoUrl: string | null;
112
+ hero: {
113
+ title: string | null;
114
+ subtitle: string | null;
115
+ imageUrl: string | null;
116
+ ctaLabel: string | null;
117
+ };
118
+ contact: StoreContactData;
119
+ announcementBarEnabled: boolean;
120
+ announcementBarText: string | null;
121
+ };
122
+ categories: StoreCategoryData[];
123
+ homeProducts: StoreProductCardData[];
124
+ listing?: {
125
+ category: StoreCategoryData | null;
126
+ products: StoreProductCardData[];
127
+ };
128
+ productPage?: {
129
+ price: number;
130
+ gallery: string[];
131
+ categoryName: string | null;
132
+ related: StoreProductCardData[];
133
+ };
134
+ article?: {
135
+ title: string;
136
+ html: string;
137
+ };
138
+ }
139
+ export type PageData = Partial<FunnelPageData> & {
140
+ store?: OnlineStorePageData;
141
+ };
@@ -1,14 +1,17 @@
1
1
  export type { BlockNode, PageDocument, PageFont, PageIssue, PageRootProps } from './document';
2
2
  export { PageDocumentError } from './document';
3
- export type { FunnelPageData, PageCity, PageData, PageFormField, PageOffer, PageState, PageVariantDefinition, } from './data';
3
+ export type { FunnelPageData, MoneyFormat, OnlineStorePageData, PageCity, PageData, PageFormField, PageOffer, PageState, PageVariantDefinition, StoreCategoryData, StoreContactData, StoreProductCardData, } from './data';
4
4
  export type { BaseBlockProps, BlockCategory, BlockDefinition, BlockRenderProps, FieldDefinition, } from './block';
5
5
  export type { BlockStyle, StyleDeclarations, StyleProperty } from './style';
6
6
  export { Breakpoints, StyleProperties } from './style';
7
7
  export { blocks } from './blocks';
8
- export { PageDataProvider, usePageData } from './context';
8
+ export { checkoutData, PageDataProvider, storeData, useCheckoutData, usePageData, useStoreData, } from './context';
9
+ export { moneyFormatter } from './money';
9
10
  export { BlockList, PageContent, blockSelector, pageCss, pageFontStylesheets, pagePreloadImages, } from './page';
10
11
  export { countBlocks, parsePageDocument, walkBlocks } from './validate';
11
12
  export { pageJsonSchema } from './json-schema';
12
13
  export type { BlockJsonSchema, PageJsonSchema } from './json-schema';
13
14
  export { FunnelTemplateIds, funnelTemplate } from './templates/funnels';
14
15
  export type { FunnelTemplateId, FunnelTemplateOptions } from './templates/funnels';
16
+ export { OnlineStorePageTypes, OnlineStoreTemplateIds, onlineStorePages, onlineStoreTemplate, } from './templates/online-stores';
17
+ export type { OnlineStorePageType, OnlineStoreTemplateId } from './templates/online-stores';
@@ -0,0 +1,2 @@
1
+ import { MoneyFormat } from './data';
2
+ export declare function moneyFormatter({ language, iso2, currency, }: MoneyFormat): (value: number) => string;
@@ -0,0 +1,10 @@
1
+ import { PageDocument } from '../document';
2
+ export declare const OnlineStoreTemplateIds: readonly ["maison", "atelier", "noor", "block", "glow", "oud", "circuit", "hearth", "pebble", "souq"];
3
+ export type OnlineStoreTemplateId = (typeof OnlineStoreTemplateIds)[number];
4
+ export declare const OnlineStorePageTypes: readonly ["header", "footer", "home", "all-products", "category", "product", "thank-you", "contact", "about", "privacy-policy", "refund-policy", "terms-of-service", "not-found"];
5
+ export type OnlineStorePageType = (typeof OnlineStorePageTypes)[number];
6
+ export declare function onlineStoreTemplate(templateId: string, pageType: string): PageDocument;
7
+ export declare function onlineStorePages(templateId: string): {
8
+ pageType: OnlineStorePageType;
9
+ document: PageDocument;
10
+ }[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lucrex/storefront-blocks",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Lucrex storefront page blocks: the JSON page format, the React blocks, the built-in templates and the server renderer shared by the page builder and the backend",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",