@commercelayer/demo-store-types 1.0.0 → 1.1.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.
- package/README.md +105 -21
- package/dist/config/facets.config.d.ts +8 -8
- package/dist/config/general.config.d.ts +1 -1
- package/dist/config/variants.config.d.ts +5 -5
- package/dist/json/catalogs.d.ts +34 -24
- package/dist/json/catalogs.js +2 -2
- package/dist/json/countries.d.ts +44 -38
- package/dist/json/countries.js +2 -2
- package/dist/json/languages.d.ts +23 -23
- package/dist/json/languages.js +2 -2
- package/dist/json/organization.d.ts +45 -33
- package/dist/json/organization.js +1 -2
- package/dist/json/page-components/carousel.d.ts +19 -0
- package/dist/json/page-components/carousel.js +10 -0
- package/dist/json/page-components/grid.d.ts +17 -0
- package/dist/json/page-components/grid.js +10 -0
- package/dist/json/page-components/hero.d.ts +33 -0
- package/dist/json/page-components/hero.js +13 -0
- package/dist/json/page-components/image.d.ts +12 -0
- package/dist/json/page-components/image.js +8 -0
- package/dist/json/page-components/item.d.ts +31 -0
- package/dist/json/page-components/item.js +12 -0
- package/dist/json/page-components/markdown.d.ts +18 -0
- package/dist/json/page-components/markdown.js +20 -0
- package/dist/json/page-components/product-grid.d.ts +20 -0
- package/dist/json/page-components/product-grid.js +10 -0
- package/dist/json/pages.d.ts +120 -1195
- package/dist/json/pages.js +17 -50
- package/dist/json/products.d.ts +194 -126
- package/dist/json/products.js +8 -2
- package/dist/json/taxonomies.d.ts +38 -29
- package/dist/json/taxonomies.js +2 -2
- package/dist/json/taxons.d.ts +65 -80
- package/dist/json/taxons.js +2 -2
- package/dist/utils/locale.d.ts +11 -5
- package/dist/utils/locale.js +6 -1
- package/dist/utils/sort.d.ts +2 -2
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -4,48 +4,132 @@ This package contains all `types` used by the Demo Store.
|
|
|
4
4
|
|
|
5
5
|
You can install it and use them to build your own Demo Store data and configuration files.
|
|
6
6
|
|
|
7
|
-
To build Demo Store data you'll probably need to
|
|
7
|
+
To build Demo Store data you'll probably need to write a script that converts data from your source to the Demo Store data format.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
By using this package, that operation will be much easier to do and error-proof.
|
|
10
10
|
|
|
11
|
-
<img width="
|
|
11
|
+
<img width="1158" alt="IntelliSense in Visual Studio Code" src="https://user-images.githubusercontent.com/1681269/208510718-23cd21e1-e602-41f7-8748-440bbb07d5ea.png">
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
## Data
|
|
14
|
+
|
|
15
|
+
The Demo Store data are composed of a set of 8 JSON files usually located at `/data/json`.
|
|
16
|
+
|
|
17
|
+
* **catalogs.json**
|
|
18
|
+
```ts
|
|
19
|
+
writeFileSync(
|
|
20
|
+
'catalogs.json',
|
|
21
|
+
JSON.stringify([{ ... }] satisfies RawDataCatalog[])
|
|
22
|
+
)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
* **countries.json**
|
|
26
|
+
```ts
|
|
27
|
+
writeFileSync(
|
|
28
|
+
'countries.json',
|
|
29
|
+
JSON.stringify([{ ... }] satisfies RawDataCountry[])
|
|
30
|
+
)
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
* **languages.json**
|
|
34
|
+
```ts
|
|
35
|
+
writeFileSync(
|
|
36
|
+
'languages.json',
|
|
37
|
+
JSON.stringify([{ ... }] satisfies RawDataLanguage[])
|
|
38
|
+
)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
* **organization.json**
|
|
42
|
+
```ts
|
|
43
|
+
writeFileSync(
|
|
44
|
+
'organization.json',
|
|
45
|
+
JSON.stringify({ ... } satisfies RawDataOrganization)
|
|
46
|
+
)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
* **pages.json**
|
|
50
|
+
```ts
|
|
51
|
+
writeFileSync(
|
|
52
|
+
'pages.json',
|
|
53
|
+
JSON.stringify({
|
|
54
|
+
'/': {
|
|
55
|
+
'en': { ... }
|
|
56
|
+
}
|
|
57
|
+
} satisfies RawDataPages)
|
|
58
|
+
)
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
* **products.json**
|
|
62
|
+
```ts
|
|
63
|
+
writeFileSync(
|
|
64
|
+
'products.json',
|
|
65
|
+
JSON.stringify([{ ... }] satisfies RawDataProduct[])
|
|
66
|
+
)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
* **taxonomies.json**
|
|
70
|
+
```ts
|
|
71
|
+
writeFileSync(
|
|
72
|
+
'taxonomies.json',
|
|
73
|
+
JSON.stringify([{ ... }] satisfies RawDataTaxonomy[])
|
|
74
|
+
)
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
* **taxons.json**
|
|
78
|
+
```ts
|
|
79
|
+
writeFileSync(
|
|
80
|
+
'taxons.json',
|
|
81
|
+
JSON.stringify([{ ... }] satisfies RawDataTaxon[])
|
|
82
|
+
)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Example
|
|
86
|
+
|
|
87
|
+
Here below you can find a working example with Node.js 18 that converts a list of products coming from an external service, to the Demo Store `products.json`:
|
|
14
88
|
|
|
15
89
|
```sh
|
|
16
90
|
mkdir demo
|
|
17
91
|
cd demo
|
|
18
92
|
npm init -y
|
|
19
|
-
npm install
|
|
93
|
+
npm install typescript @types/node tsm @commercelayer/demo-store-types
|
|
20
94
|
```
|
|
21
95
|
|
|
22
96
|
```ts
|
|
23
97
|
//= index.ts
|
|
24
98
|
|
|
99
|
+
import type { RawDataProduct } from '@commercelayer/demo-store-types'
|
|
100
|
+
import { writeFile } from 'fs/promises'
|
|
101
|
+
|
|
25
102
|
(async () => {
|
|
103
|
+
|
|
26
104
|
// this represent a list of products taken from an external source
|
|
27
105
|
const remoteProducts: any[] = await fetch('https://run.mocky.io/v3/57f0a452-eae1-4f67-8a33-e4119e73c2db')
|
|
28
106
|
.then(response => response.json())
|
|
29
107
|
|
|
30
|
-
const demoStoreProducts: RawDataProduct[] = remoteProducts.map(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
108
|
+
const demoStoreProducts: RawDataProduct[] = remoteProducts.map(
|
|
109
|
+
({ code, name, description, image_url }) => ({
|
|
110
|
+
productCode: code.substring(0, 8),
|
|
111
|
+
variantCode: code.substring(0, 8 + 6),
|
|
112
|
+
sku: code,
|
|
113
|
+
slug: `/${name.toLowerCase().replace(/[\W]+/g, '-').replace(/^-|-$/g, '')}/${code}`,
|
|
114
|
+
name: {
|
|
115
|
+
en: name.replace(/\s\(.*\)$/, '')
|
|
116
|
+
},
|
|
117
|
+
description: {
|
|
118
|
+
en: description
|
|
119
|
+
},
|
|
120
|
+
images: [
|
|
121
|
+
image_url
|
|
122
|
+
]
|
|
123
|
+
}) satisfies RawDataProduct
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
await writeFile('products.json', JSON.stringify(demoStoreProducts, undefined, 2))
|
|
45
127
|
|
|
46
128
|
console.log(demoStoreProducts)
|
|
129
|
+
|
|
47
130
|
})()
|
|
48
131
|
|
|
132
|
+
|
|
49
133
|
// [
|
|
50
134
|
// {
|
|
51
135
|
// "productCode": "5PANECAP",
|
|
@@ -97,4 +181,4 @@ npm install -D typescript tsm @commercelayer/demo-store-types
|
|
|
97
181
|
|
|
98
182
|
```sh
|
|
99
183
|
node -r tsm index.ts
|
|
100
|
-
```
|
|
184
|
+
```
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { SortingRule } from '../utils/sort';
|
|
2
|
-
|
|
2
|
+
type Config = {
|
|
3
3
|
/**
|
|
4
|
-
* Any product attribute key taken from `products.json`.
|
|
4
|
+
* Any product attribute key taken from `products.json` or any `facetKey` attribute value taken from `taxonomies.json`.
|
|
5
5
|
*/
|
|
6
6
|
field: string;
|
|
7
7
|
/**
|
|
@@ -9,17 +9,17 @@ declare type Config = {
|
|
|
9
9
|
*/
|
|
10
10
|
sortOrder?: SortingRule[];
|
|
11
11
|
};
|
|
12
|
-
|
|
12
|
+
type ColorSwatchAppearance = {
|
|
13
13
|
/**
|
|
14
14
|
* Make it appear like a color swatch.
|
|
15
15
|
*
|
|
16
16
|
* The field value should be a valid css color value.
|
|
17
17
|
*
|
|
18
|
-
* @example
|
|
18
|
+
* @example "#000000"
|
|
19
19
|
*/
|
|
20
20
|
appearance: 'colorSwatch';
|
|
21
21
|
};
|
|
22
|
-
|
|
22
|
+
type PriceRangeAppearance = {
|
|
23
23
|
/**
|
|
24
24
|
* Make it appear like a price-range.
|
|
25
25
|
*
|
|
@@ -27,17 +27,17 @@ declare type PriceRangeAppearance = {
|
|
|
27
27
|
*/
|
|
28
28
|
appearance: 'priceRange';
|
|
29
29
|
};
|
|
30
|
-
|
|
30
|
+
type SwitchAppearance = {
|
|
31
31
|
/**
|
|
32
32
|
* Make it appear like a switch button (on/off)
|
|
33
33
|
*/
|
|
34
34
|
appearance: 'switch';
|
|
35
35
|
};
|
|
36
|
-
|
|
36
|
+
type TagAppearance = {
|
|
37
37
|
/**
|
|
38
38
|
* Make it appear like a switchable button
|
|
39
39
|
*/
|
|
40
40
|
appearance: 'tag';
|
|
41
41
|
};
|
|
42
|
-
export
|
|
42
|
+
export type FacetConfig = Config & (ColorSwatchAppearance | PriceRangeAppearance | SwitchAppearance | TagAppearance);
|
|
43
43
|
export {};
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
type Config = {
|
|
2
2
|
/**
|
|
3
3
|
* Any product attribute key taken from `products.json`.
|
|
4
4
|
*/
|
|
5
5
|
field: string;
|
|
6
6
|
};
|
|
7
|
-
|
|
7
|
+
type ColorSwatchAppearance = {
|
|
8
8
|
/**
|
|
9
9
|
* Make it appear like a color swatch.
|
|
10
10
|
*
|
|
11
11
|
* The field value should be a valid css color value.
|
|
12
12
|
*
|
|
13
|
-
* @example
|
|
13
|
+
* @example "#000000"
|
|
14
14
|
*/
|
|
15
15
|
appearance: 'colorSwatch';
|
|
16
16
|
};
|
|
17
|
-
|
|
17
|
+
type TagAppearance = {
|
|
18
18
|
/**
|
|
19
19
|
* Make it appear like a switchable button.
|
|
20
20
|
*/
|
|
21
21
|
appearance: 'tag';
|
|
22
22
|
};
|
|
23
|
-
export
|
|
23
|
+
export type VariantConfig = Config & (ColorSwatchAppearance | TagAppearance);
|
|
24
24
|
export {};
|
package/dist/json/catalogs.d.ts
CHANGED
|
@@ -1,29 +1,39 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
|
|
2
|
+
type RawDataCatalogSchema = z.ZodObject<{
|
|
3
|
+
/**
|
|
4
|
+
* Catalog id
|
|
5
|
+
*
|
|
6
|
+
* This attribute is used to manage the relationship with `countries` and `languages`.
|
|
7
|
+
*/
|
|
3
8
|
id: z.ZodString;
|
|
9
|
+
/**
|
|
10
|
+
* Catalog name
|
|
11
|
+
*
|
|
12
|
+
* This attribute is used to better identify the catalog. **Not used on the website**.
|
|
13
|
+
*/
|
|
4
14
|
name: z.ZodString;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Reference to the `taxonomies` id
|
|
17
|
+
*
|
|
18
|
+
* Taxonomies are an approach to managing category trees.
|
|
19
|
+
* The heading of a tree is called `taxonomy`.
|
|
20
|
+
* Any child branches are called `taxons`. Taxons themselves can have their own branches.
|
|
21
|
+
*
|
|
22
|
+
* 
|
|
23
|
+
*/
|
|
24
|
+
taxonomies: z.ZodArray<z.ZodString>;
|
|
14
25
|
}>;
|
|
15
|
-
export declare const rawDataCatalogs_schema: z.ZodArray<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
export declare type RawDataCatalog = z.infer<typeof catalog_schema>;
|
|
26
|
+
export declare const rawDataCatalogs_schema: z.ZodArray<RawDataCatalogSchema, "many">;
|
|
27
|
+
/**
|
|
28
|
+
* Product catalog
|
|
29
|
+
*
|
|
30
|
+
* A catalog is a collection of taxonomies.
|
|
31
|
+
*
|
|
32
|
+
* Taxonomies are an approach to managing category trees.
|
|
33
|
+
* The heading of a tree is called `taxonomy`.
|
|
34
|
+
* Any child branches are called `taxons`. Taxons themselves can have their own branches.
|
|
35
|
+
*
|
|
36
|
+
* 
|
|
37
|
+
*/
|
|
38
|
+
export type RawDataCatalog = z.infer<RawDataCatalogSchema>;
|
|
29
39
|
export {};
|
package/dist/json/catalogs.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.rawDataCatalogs_schema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
const
|
|
5
|
+
const rawDataCatalog_schema = zod_1.z.object({
|
|
6
6
|
id: zod_1.z.string(),
|
|
7
7
|
name: zod_1.z.string(),
|
|
8
8
|
taxonomies: zod_1.z.string().array()
|
|
9
9
|
});
|
|
10
|
-
exports.rawDataCatalogs_schema =
|
|
10
|
+
exports.rawDataCatalogs_schema = rawDataCatalog_schema.array();
|
package/dist/json/countries.d.ts
CHANGED
|
@@ -1,47 +1,53 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
|
|
2
|
+
type RawDataCountrySchema = z.ZodObject<{
|
|
3
|
+
/**
|
|
4
|
+
* Country name
|
|
5
|
+
*
|
|
6
|
+
* This is shown on the country selector page.
|
|
7
|
+
* @example "United States"
|
|
8
|
+
*/
|
|
3
9
|
name: z.ZodString;
|
|
10
|
+
/**
|
|
11
|
+
* Country code or region code
|
|
12
|
+
*
|
|
13
|
+
* It follows the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard.
|
|
14
|
+
* @example "US"
|
|
15
|
+
*/
|
|
4
16
|
code: z.ZodString;
|
|
17
|
+
/**
|
|
18
|
+
* Market number from your organization
|
|
19
|
+
*
|
|
20
|
+
* When you select the country from the country selector page, this will be the market in scope when connecting to Commerce Layer.
|
|
21
|
+
*
|
|
22
|
+
* Market is an **optional** attribute. If you don't specify any market, then the country will be presented with a non-shoppable experience (no price, no availability, no cart).
|
|
23
|
+
* @see https://github.com/commercelayer/demo-store#4-choose-the-countries-where-youre-going-to-sell
|
|
24
|
+
* @example 11279
|
|
25
|
+
*/
|
|
5
26
|
market: z.ZodOptional<z.ZodNumber>;
|
|
27
|
+
/**
|
|
28
|
+
* Reference to the `catalogs` id
|
|
29
|
+
*
|
|
30
|
+
* When you select the country from the country selector page, this information is used to choose the catalog to browse.
|
|
31
|
+
*/
|
|
6
32
|
catalog: z.ZodString;
|
|
33
|
+
/**
|
|
34
|
+
* Default language
|
|
35
|
+
*
|
|
36
|
+
* This attribute is used on the country selector page to define a default language when you select a country.
|
|
37
|
+
* @example "en"
|
|
38
|
+
*/
|
|
7
39
|
default_language: z.ZodString;
|
|
40
|
+
/**
|
|
41
|
+
* Region
|
|
42
|
+
*
|
|
43
|
+
* This attribute is used on the country selector page to visually defines a group of countries.
|
|
44
|
+
* @example "AMERICAS"
|
|
45
|
+
*/
|
|
8
46
|
region: z.ZodString;
|
|
9
|
-
}, "strip", z.ZodTypeAny, {
|
|
10
|
-
market?: number | undefined;
|
|
11
|
-
name: string;
|
|
12
|
-
code: string;
|
|
13
|
-
catalog: string;
|
|
14
|
-
default_language: string;
|
|
15
|
-
region: string;
|
|
16
|
-
}, {
|
|
17
|
-
market?: number | undefined;
|
|
18
|
-
name: string;
|
|
19
|
-
code: string;
|
|
20
|
-
catalog: string;
|
|
21
|
-
default_language: string;
|
|
22
|
-
region: string;
|
|
23
47
|
}>;
|
|
24
|
-
export declare const rawDataCountries_schema: z.ZodArray<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
default_language: z.ZodString;
|
|
30
|
-
region: z.ZodString;
|
|
31
|
-
}, "strip", z.ZodTypeAny, {
|
|
32
|
-
market?: number | undefined;
|
|
33
|
-
name: string;
|
|
34
|
-
code: string;
|
|
35
|
-
catalog: string;
|
|
36
|
-
default_language: string;
|
|
37
|
-
region: string;
|
|
38
|
-
}, {
|
|
39
|
-
market?: number | undefined;
|
|
40
|
-
name: string;
|
|
41
|
-
code: string;
|
|
42
|
-
catalog: string;
|
|
43
|
-
default_language: string;
|
|
44
|
-
region: string;
|
|
45
|
-
}>, "many">;
|
|
46
|
-
export declare type RawDataCountry = z.infer<typeof country_schema>;
|
|
48
|
+
export declare const rawDataCountries_schema: z.ZodArray<RawDataCountrySchema, "many">;
|
|
49
|
+
/**
|
|
50
|
+
* Country
|
|
51
|
+
*/
|
|
52
|
+
export type RawDataCountry = z.infer<RawDataCountrySchema>;
|
|
47
53
|
export {};
|
package/dist/json/countries.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.rawDataCountries_schema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
const
|
|
5
|
+
const rawDataCountry_schema = zod_1.z.object({
|
|
6
6
|
name: zod_1.z.string(),
|
|
7
7
|
code: zod_1.z.string(),
|
|
8
8
|
market: zod_1.z.number().optional(),
|
|
@@ -10,4 +10,4 @@ const country_schema = zod_1.z.object({
|
|
|
10
10
|
default_language: zod_1.z.string(),
|
|
11
11
|
region: zod_1.z.string()
|
|
12
12
|
});
|
|
13
|
-
exports.rawDataCountries_schema =
|
|
13
|
+
exports.rawDataCountries_schema = rawDataCountry_schema.array();
|
package/dist/json/languages.d.ts
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
|
|
2
|
+
type RawDataLanguageSchema = z.ZodObject<{
|
|
3
|
+
/**
|
|
4
|
+
* Language name
|
|
5
|
+
*
|
|
6
|
+
* This is shown on the country selector page and in the language selector component.
|
|
7
|
+
* @example "English"
|
|
8
|
+
*/
|
|
3
9
|
name: z.ZodString;
|
|
10
|
+
/**
|
|
11
|
+
* Language code
|
|
12
|
+
*
|
|
13
|
+
* It follows the [ISO 639](https://iso639-3.sil.org/code_tables/639/data) standard.
|
|
14
|
+
* @example "en"
|
|
15
|
+
*/
|
|
4
16
|
code: z.ZodString;
|
|
17
|
+
/**
|
|
18
|
+
* Reference to the `catalogs` id
|
|
19
|
+
*
|
|
20
|
+
* When you select a language without choosing a country (international website), this information is used to choose the catalog to browse.
|
|
21
|
+
*/
|
|
5
22
|
catalog: z.ZodString;
|
|
6
|
-
}, "strip", z.ZodTypeAny, {
|
|
7
|
-
name: string;
|
|
8
|
-
code: string;
|
|
9
|
-
catalog: string;
|
|
10
|
-
}, {
|
|
11
|
-
name: string;
|
|
12
|
-
code: string;
|
|
13
|
-
catalog: string;
|
|
14
23
|
}>;
|
|
15
|
-
export declare const rawDataLanguages_schema: z.ZodArray<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
name: string;
|
|
21
|
-
code: string;
|
|
22
|
-
catalog: string;
|
|
23
|
-
}, {
|
|
24
|
-
name: string;
|
|
25
|
-
code: string;
|
|
26
|
-
catalog: string;
|
|
27
|
-
}>, "many">;
|
|
28
|
-
export declare type RawDataLanguage = z.infer<typeof language_schema>;
|
|
24
|
+
export declare const rawDataLanguages_schema: z.ZodArray<RawDataLanguageSchema, "many">;
|
|
25
|
+
/**
|
|
26
|
+
* Language
|
|
27
|
+
*/
|
|
28
|
+
export type RawDataLanguage = z.infer<RawDataLanguageSchema>;
|
|
29
29
|
export {};
|
package/dist/json/languages.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.rawDataLanguages_schema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
const
|
|
5
|
+
const rawDataLanguage_schema = zod_1.z.object({
|
|
6
6
|
name: zod_1.z.string(),
|
|
7
7
|
code: zod_1.z.string(),
|
|
8
8
|
catalog: zod_1.z.string()
|
|
9
9
|
});
|
|
10
|
-
exports.rawDataLanguages_schema =
|
|
10
|
+
exports.rawDataLanguages_schema = rawDataLanguage_schema.array();
|
|
@@ -1,41 +1,53 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
|
|
2
|
+
type RawDataOrganizationSchema = z.ZodObject<{
|
|
3
|
+
/**
|
|
4
|
+
* The name of your organization
|
|
5
|
+
*/
|
|
3
6
|
name: z.ZodOptional<z.ZodString>;
|
|
7
|
+
/**
|
|
8
|
+
* Your brand's logo image URL
|
|
9
|
+
*/
|
|
4
10
|
logo_url: z.ZodOptional<z.ZodString>;
|
|
11
|
+
/**
|
|
12
|
+
* Your brand's favicon image URL
|
|
13
|
+
*/
|
|
5
14
|
favicon_url: z.ZodOptional<z.ZodString>;
|
|
15
|
+
/**
|
|
16
|
+
* Your brand's primary color HEX code
|
|
17
|
+
*
|
|
18
|
+
* @example "#FF0000"
|
|
19
|
+
*/
|
|
6
20
|
primary_color: z.ZodOptional<z.ZodString>;
|
|
21
|
+
/**
|
|
22
|
+
* A custom `manifest.json` URL
|
|
23
|
+
*
|
|
24
|
+
* The web app manifest is a JSON file that tells the browser about your Progressive Web App and how it should behave when installed on the user's desktop or mobile device.
|
|
25
|
+
* A typical manifest file includes the app name, the icons the app should use, and the URL that should be opened when the app is launched, among other things.
|
|
26
|
+
*
|
|
27
|
+
* @see https://web.dev/add-manifest/
|
|
28
|
+
* @see https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json
|
|
29
|
+
* @example
|
|
30
|
+
* ```json
|
|
31
|
+
* {
|
|
32
|
+
* "name": "Commerce Layer's Demo Store",
|
|
33
|
+
* "short_name": "Demo Store",
|
|
34
|
+
* "description": "Demo Store is a fully static e-commerce solution (with SSR capability) powered by Commerce Layer.",
|
|
35
|
+
* "icons": [
|
|
36
|
+
* {
|
|
37
|
+
* "src": "/demo-store-core/icons/icon-48x48.png",
|
|
38
|
+
* "sizes": "48x48",
|
|
39
|
+
* "type": "image/png",
|
|
40
|
+
* "purpose": "maskable"
|
|
41
|
+
* }
|
|
42
|
+
* ]
|
|
43
|
+
* }
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
7
46
|
manifest: z.ZodOptional<z.ZodString>;
|
|
8
|
-
}, "strip", z.ZodTypeAny, {
|
|
9
|
-
name?: string | undefined;
|
|
10
|
-
logo_url?: string | undefined;
|
|
11
|
-
favicon_url?: string | undefined;
|
|
12
|
-
primary_color?: string | undefined;
|
|
13
|
-
manifest?: string | undefined;
|
|
14
|
-
}, {
|
|
15
|
-
name?: string | undefined;
|
|
16
|
-
logo_url?: string | undefined;
|
|
17
|
-
favicon_url?: string | undefined;
|
|
18
|
-
primary_color?: string | undefined;
|
|
19
|
-
manifest?: string | undefined;
|
|
20
47
|
}>;
|
|
21
|
-
export declare const rawDataOrganization_schema:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
manifest: z.ZodOptional<z.ZodString>;
|
|
27
|
-
}, "strip", z.ZodTypeAny, {
|
|
28
|
-
name?: string | undefined;
|
|
29
|
-
logo_url?: string | undefined;
|
|
30
|
-
favicon_url?: string | undefined;
|
|
31
|
-
primary_color?: string | undefined;
|
|
32
|
-
manifest?: string | undefined;
|
|
33
|
-
}, {
|
|
34
|
-
name?: string | undefined;
|
|
35
|
-
logo_url?: string | undefined;
|
|
36
|
-
favicon_url?: string | undefined;
|
|
37
|
-
primary_color?: string | undefined;
|
|
38
|
-
manifest?: string | undefined;
|
|
39
|
-
}>;
|
|
40
|
-
export declare type RawDataOrganization = z.infer<typeof organization_schema>;
|
|
48
|
+
export declare const rawDataOrganization_schema: RawDataOrganizationSchema;
|
|
49
|
+
/**
|
|
50
|
+
* Organization settings
|
|
51
|
+
*/
|
|
52
|
+
export type RawDataOrganization = z.infer<RawDataOrganizationSchema>;
|
|
41
53
|
export {};
|
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.rawDataOrganization_schema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
|
|
5
|
+
exports.rawDataOrganization_schema = zod_1.z.object({
|
|
6
6
|
name: zod_1.z.string().optional(),
|
|
7
7
|
logo_url: zod_1.z.string().optional(),
|
|
8
8
|
favicon_url: zod_1.z.string().optional(),
|
|
9
9
|
primary_color: zod_1.z.string().optional(),
|
|
10
10
|
manifest: zod_1.z.string().optional(),
|
|
11
11
|
});
|
|
12
|
-
exports.rawDataOrganization_schema = organization_schema;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ItemSchema } from './item';
|
|
3
|
+
export type CarouselSchema = z.ZodObject<{
|
|
4
|
+
/**
|
|
5
|
+
* Identifies the component type
|
|
6
|
+
*/
|
|
7
|
+
type: z.ZodLiteral<'carousel'>;
|
|
8
|
+
/**
|
|
9
|
+
* Unique ID
|
|
10
|
+
*/
|
|
11
|
+
id: z.ZodString;
|
|
12
|
+
/**
|
|
13
|
+
* Array of carousel slides
|
|
14
|
+
*
|
|
15
|
+
* A single slide is composed by a `title`, a `description`, an `image`, and a button link.
|
|
16
|
+
*/
|
|
17
|
+
slides: z.ZodArray<ItemSchema>;
|
|
18
|
+
}>;
|
|
19
|
+
export declare const carousel_schema: CarouselSchema;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.carousel_schema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const item_1 = require("./item");
|
|
6
|
+
exports.carousel_schema = zod_1.z.object({
|
|
7
|
+
type: zod_1.z.literal('carousel'),
|
|
8
|
+
id: zod_1.z.string(),
|
|
9
|
+
slides: item_1.item_schema.array()
|
|
10
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ItemSchema } from './item';
|
|
3
|
+
export type GridSchema = z.ZodObject<{
|
|
4
|
+
/**
|
|
5
|
+
* Identifies the component type
|
|
6
|
+
*/
|
|
7
|
+
type: z.ZodLiteral<'grid'>;
|
|
8
|
+
/**
|
|
9
|
+
* Unique ID
|
|
10
|
+
*/
|
|
11
|
+
id: z.ZodString;
|
|
12
|
+
/**
|
|
13
|
+
* List of items to show in the grid
|
|
14
|
+
*/
|
|
15
|
+
items: z.ZodArray<ItemSchema>;
|
|
16
|
+
}>;
|
|
17
|
+
export declare const grid_schema: GridSchema;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.grid_schema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const item_1 = require("./item");
|
|
6
|
+
exports.grid_schema = zod_1.z.object({
|
|
7
|
+
type: zod_1.z.literal('grid'),
|
|
8
|
+
id: zod_1.z.string(),
|
|
9
|
+
items: item_1.item_schema.array()
|
|
10
|
+
});
|