@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/dist/json/taxons.d.ts
CHANGED
|
@@ -1,85 +1,70 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
|
|
2
|
+
import { LocalizedFieldSchema } from '../utils/locale';
|
|
3
|
+
type RawDataTaxonSchema = z.ZodObject<{
|
|
4
|
+
/**
|
|
5
|
+
* The taxonomy id
|
|
6
|
+
*
|
|
7
|
+
* This attribute is used to manage the relationship with both `taxonomies` and `taxons`.
|
|
8
|
+
*/
|
|
3
9
|
id: z.ZodString;
|
|
10
|
+
/**
|
|
11
|
+
* The taxon name
|
|
12
|
+
*
|
|
13
|
+
* This attribute is used to better identify the taxon. **Not used on the website**.
|
|
14
|
+
*/
|
|
4
15
|
name: z.ZodString;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
16
|
+
/**
|
|
17
|
+
* The localized label used on the website
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* {
|
|
21
|
+
* "it": "Etichetta",
|
|
22
|
+
* "en-US": "Label"
|
|
23
|
+
* }
|
|
24
|
+
*/
|
|
25
|
+
label: LocalizedFieldSchema<z.ZodString>;
|
|
26
|
+
/**
|
|
27
|
+
* The localized description used on the website
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* {
|
|
31
|
+
* "it": "Descrizione",
|
|
32
|
+
* "en-US": "Description"
|
|
33
|
+
* }
|
|
34
|
+
*/
|
|
35
|
+
description: LocalizedFieldSchema<z.ZodString>;
|
|
36
|
+
/**
|
|
37
|
+
* The taxon URL slug
|
|
38
|
+
*
|
|
39
|
+
* The slug is the part of a URL that identifies a particular page on a website in an easy-to-read form.
|
|
40
|
+
*
|
|
41
|
+
* It should always start with a forward slash (`/`).
|
|
42
|
+
* @example "/clothing/shirts"
|
|
43
|
+
*/
|
|
44
|
+
slug: z.ZodEffects<z.ZodString>;
|
|
45
|
+
/**
|
|
46
|
+
* The list of `products` SKUs
|
|
47
|
+
*
|
|
48
|
+
* This is an array of product `SKU`s (from `products.json`).
|
|
49
|
+
* @example ["APRONXXX000000FFFFFFXXXX", "BABYBIBXA19D9D000000XXXX"]
|
|
50
|
+
*/
|
|
51
|
+
references: z.ZodArray<z.ZodString>;
|
|
52
|
+
/**
|
|
53
|
+
* Reference to the `taxons` id
|
|
54
|
+
*
|
|
55
|
+
* Any child branches of a `taxonomy` are called `taxons`. **Taxons themselves can have their own branches.**
|
|
56
|
+
*
|
|
57
|
+
* 
|
|
58
|
+
*/
|
|
59
|
+
taxons: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
42
60
|
}>;
|
|
43
|
-
export declare const rawDataTaxons_schema: z.ZodArray<
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
[x: string]: string | undefined;
|
|
53
|
-
}, {
|
|
54
|
-
[x: string]: string | undefined;
|
|
55
|
-
}>;
|
|
56
|
-
slug: z.ZodEffects<z.ZodString, string, string>;
|
|
57
|
-
references: z.ZodArray<z.ZodString, "many">;
|
|
58
|
-
taxons: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
59
|
-
}, "strip", z.ZodTypeAny, {
|
|
60
|
-
taxons?: string[] | undefined;
|
|
61
|
-
id: string;
|
|
62
|
-
name: string;
|
|
63
|
-
description: {
|
|
64
|
-
[x: string]: string | undefined;
|
|
65
|
-
};
|
|
66
|
-
slug: string;
|
|
67
|
-
label: {
|
|
68
|
-
[x: string]: string | undefined;
|
|
69
|
-
};
|
|
70
|
-
references: string[];
|
|
71
|
-
}, {
|
|
72
|
-
taxons?: string[] | undefined;
|
|
73
|
-
id: string;
|
|
74
|
-
name: string;
|
|
75
|
-
description: {
|
|
76
|
-
[x: string]: string | undefined;
|
|
77
|
-
};
|
|
78
|
-
slug: string;
|
|
79
|
-
label: {
|
|
80
|
-
[x: string]: string | undefined;
|
|
81
|
-
};
|
|
82
|
-
references: string[];
|
|
83
|
-
}>, "many">;
|
|
84
|
-
export declare type RawDataTaxon = z.infer<typeof taxon_schema>;
|
|
61
|
+
export declare const rawDataTaxons_schema: z.ZodArray<RawDataTaxonSchema, "many">;
|
|
62
|
+
/**
|
|
63
|
+
* Taxon
|
|
64
|
+
*
|
|
65
|
+
* Any child branches of a `taxonomy` are called `taxons`. Taxons themselves can have their own branches.
|
|
66
|
+
*
|
|
67
|
+
* 
|
|
68
|
+
*/
|
|
69
|
+
export type RawDataTaxon = z.infer<RawDataTaxonSchema>;
|
|
85
70
|
export {};
|
package/dist/json/taxons.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.rawDataTaxons_schema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const locale_1 = require("../utils/locale");
|
|
6
|
-
const
|
|
6
|
+
const rawDataTaxon_schema = zod_1.z.object({
|
|
7
7
|
id: zod_1.z.string(),
|
|
8
8
|
name: zod_1.z.string(),
|
|
9
9
|
label: (0, locale_1.localizedFieldSchema)(zod_1.z.string()),
|
|
@@ -12,4 +12,4 @@ const taxon_schema = zod_1.z.object({
|
|
|
12
12
|
references: zod_1.z.string().array(),
|
|
13
13
|
taxons: zod_1.z.string().array().optional()
|
|
14
14
|
});
|
|
15
|
-
exports.rawDataTaxons_schema =
|
|
15
|
+
exports.rawDataTaxons_schema = rawDataTaxon_schema.array();
|
package/dist/utils/locale.d.ts
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export
|
|
3
|
-
[
|
|
2
|
+
export type LocalizedFieldSchema<T extends z.ZodTypeAny> = z.ZodObject<{}, "strip", T, {
|
|
3
|
+
[localeCode: string]: z.infer<T>;
|
|
4
4
|
}, {
|
|
5
|
-
[
|
|
5
|
+
[localeCode: string]: z.infer<T>;
|
|
6
6
|
}>;
|
|
7
|
-
export
|
|
8
|
-
[localeCode: string]: T
|
|
7
|
+
export type LocalizedField<T> = {
|
|
8
|
+
[localeCode: string]: T;
|
|
9
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* Create a localized field schema
|
|
12
|
+
* @param type Type of the field value (any [zod](https://zod.dev/) type)
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
export declare const localizedFieldSchema: <T extends z.ZodTypeAny>(type: T) => LocalizedFieldSchema<T>;
|
package/dist/utils/locale.js
CHANGED
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.localizedFieldSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
/**
|
|
6
|
+
* Create a localized field schema
|
|
7
|
+
* @param type Type of the field value (any [zod](https://zod.dev/) type)
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
5
10
|
const localizedFieldSchema = (type) => zod_1.z
|
|
6
11
|
.object({})
|
|
7
|
-
.catchall(type
|
|
12
|
+
.catchall(type);
|
|
8
13
|
exports.localizedFieldSchema = localizedFieldSchema;
|
package/dist/utils/sort.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercelayer/demo-store-types",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Demo Store types",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
"dist"
|
|
9
9
|
],
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"zod": "^3.
|
|
11
|
+
"zod": "^3.20.2"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
|
-
"typescript": "^4.
|
|
14
|
+
"typescript": "^4.9.4"
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
17
|
"ts:check": "tsc --noEmit",
|
|
@@ -21,5 +21,5 @@
|
|
|
21
21
|
"publishConfig": {
|
|
22
22
|
"access": "public"
|
|
23
23
|
},
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "10dc839ac426d16133d34e03730131503d4209e4"
|
|
25
25
|
}
|