@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.
Files changed (38) hide show
  1. package/README.md +105 -21
  2. package/dist/config/facets.config.d.ts +8 -8
  3. package/dist/config/general.config.d.ts +1 -1
  4. package/dist/config/variants.config.d.ts +5 -5
  5. package/dist/json/catalogs.d.ts +34 -24
  6. package/dist/json/catalogs.js +2 -2
  7. package/dist/json/countries.d.ts +44 -38
  8. package/dist/json/countries.js +2 -2
  9. package/dist/json/languages.d.ts +23 -23
  10. package/dist/json/languages.js +2 -2
  11. package/dist/json/organization.d.ts +45 -33
  12. package/dist/json/organization.js +1 -2
  13. package/dist/json/page-components/carousel.d.ts +19 -0
  14. package/dist/json/page-components/carousel.js +10 -0
  15. package/dist/json/page-components/grid.d.ts +17 -0
  16. package/dist/json/page-components/grid.js +10 -0
  17. package/dist/json/page-components/hero.d.ts +33 -0
  18. package/dist/json/page-components/hero.js +13 -0
  19. package/dist/json/page-components/image.d.ts +12 -0
  20. package/dist/json/page-components/image.js +8 -0
  21. package/dist/json/page-components/item.d.ts +31 -0
  22. package/dist/json/page-components/item.js +12 -0
  23. package/dist/json/page-components/markdown.d.ts +18 -0
  24. package/dist/json/page-components/markdown.js +20 -0
  25. package/dist/json/page-components/product-grid.d.ts +20 -0
  26. package/dist/json/page-components/product-grid.js +10 -0
  27. package/dist/json/pages.d.ts +120 -1195
  28. package/dist/json/pages.js +17 -50
  29. package/dist/json/products.d.ts +194 -126
  30. package/dist/json/products.js +8 -2
  31. package/dist/json/taxonomies.d.ts +38 -29
  32. package/dist/json/taxonomies.js +2 -2
  33. package/dist/json/taxons.d.ts +65 -80
  34. package/dist/json/taxons.js +2 -2
  35. package/dist/utils/locale.d.ts +11 -5
  36. package/dist/utils/locale.js +6 -1
  37. package/dist/utils/sort.d.ts +2 -2
  38. package/package.json +4 -4
@@ -1,85 +1,70 @@
1
1
  import { z } from 'zod';
2
- declare const taxon_schema: z.ZodObject<{
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
- label: z.ZodObject<{}, "strip", z.ZodOptional<z.ZodString>, {
6
- [x: string]: string | undefined;
7
- }, {
8
- [x: string]: string | undefined;
9
- }>;
10
- description: z.ZodObject<{}, "strip", z.ZodOptional<z.ZodString>, {
11
- [x: string]: string | undefined;
12
- }, {
13
- [x: string]: string | undefined;
14
- }>;
15
- slug: z.ZodEffects<z.ZodString, string, string>;
16
- references: z.ZodArray<z.ZodString, "many">;
17
- taxons: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
18
- }, "strip", z.ZodTypeAny, {
19
- taxons?: string[] | undefined;
20
- id: string;
21
- name: string;
22
- description: {
23
- [x: string]: string | undefined;
24
- };
25
- slug: string;
26
- label: {
27
- [x: string]: string | undefined;
28
- };
29
- references: string[];
30
- }, {
31
- taxons?: string[] | undefined;
32
- id: string;
33
- name: string;
34
- description: {
35
- [x: string]: string | undefined;
36
- };
37
- slug: string;
38
- label: {
39
- [x: string]: string | undefined;
40
- };
41
- references: string[];
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
+ * ![Taxons](https://user-images.githubusercontent.com/1681269/208094650-85d0c4eb-13f6-4c5a-9737-9e224d597c2b.png|width=400px)
58
+ */
59
+ taxons: z.ZodOptional<z.ZodArray<z.ZodString>>;
42
60
  }>;
43
- export declare const rawDataTaxons_schema: z.ZodArray<z.ZodObject<{
44
- id: z.ZodString;
45
- name: z.ZodString;
46
- label: z.ZodObject<{}, "strip", z.ZodOptional<z.ZodString>, {
47
- [x: string]: string | undefined;
48
- }, {
49
- [x: string]: string | undefined;
50
- }>;
51
- description: z.ZodObject<{}, "strip", z.ZodOptional<z.ZodString>, {
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
+ * ![Taxons](https://user-images.githubusercontent.com/1681269/208096330-72ed35f9-74ef-4414-9b11-7f97a7b0687f.png|width=400px)
68
+ */
69
+ export type RawDataTaxon = z.infer<RawDataTaxonSchema>;
85
70
  export {};
@@ -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 taxon_schema = zod_1.z.object({
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 = taxon_schema.array();
15
+ exports.rawDataTaxons_schema = rawDataTaxon_schema.array();
@@ -1,9 +1,15 @@
1
1
  import { z } from 'zod';
2
- export declare const localizedFieldSchema: <T extends z.ZodTypeAny>(type: T) => z.ZodObject<{}, "strip", z.ZodOptional<T>, {
3
- [x: string]: T["_output"] | undefined;
2
+ export type LocalizedFieldSchema<T extends z.ZodTypeAny> = z.ZodObject<{}, "strip", T, {
3
+ [localeCode: string]: z.infer<T>;
4
4
  }, {
5
- [x: string]: T["_input"] | undefined;
5
+ [localeCode: string]: z.infer<T>;
6
6
  }>;
7
- export declare type LocalizedField<T> = {
8
- [localeCode: string]: T | undefined;
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>;
@@ -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.optional());
12
+ .catchall(type);
8
13
  exports.localizedFieldSchema = localizedFieldSchema;
@@ -1,5 +1,5 @@
1
- export declare type SortValue = string | boolean | number;
2
- export declare type SortingRule = {
1
+ export type SortValue = string | boolean | number;
2
+ export type SortingRule = {
3
3
  /**
4
4
  * RegExp to match the value.
5
5
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercelayer/demo-store-types",
3
- "version": "1.0.0",
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.18.0"
11
+ "zod": "^3.20.2"
12
12
  },
13
13
  "devDependencies": {
14
- "typescript": "^4.7.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": "daa49911f414b7a635544e5dd117d386ee19ea8b"
24
+ "gitHead": "10dc839ac426d16133d34e03730131503d4209e4"
25
25
  }