@reactionary/core 0.10.25 → 0.10.26

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.
@@ -27,7 +27,11 @@ class ProductCapability extends BaseCapability {
27
27
  published: false,
28
28
  sharedAttributes: [],
29
29
  slug: "",
30
- variants: []
30
+ variants: [],
31
+ complianceData: {
32
+ ce_marking: false,
33
+ weee_symbol: false
34
+ }
31
35
  };
32
36
  return product;
33
37
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reactionary/core",
3
- "version": "0.10.25",
3
+ "version": "0.10.26",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "types": "./src/index.d.ts",
@@ -2,6 +2,14 @@ import * as z from "zod";
2
2
  import { ProductIdentifierSchema, FacetValueIdentifierSchema, FacetIdentifierSchema, ProductSearchIdentifierSchema, ProductVariantIdentifierSchema } from "./identifiers.model.js";
3
3
  import { BaseModelSchema, createPaginatedResponseSchema, ImageSchema } from "./base.model.js";
4
4
  import { ProductVariantOptionSchema } from "./product.model.js";
5
+ const ProductSearchResultItemComplianceDataSchema = z.looseObject({
6
+ ce_marking: z.boolean().default(false).meta({ description: "Indicates whether CE marking can be shown on the product" }),
7
+ weee_symbol: z.boolean().default(false).meta({ description: "Indicates whether the WEEE symbol can be shown on the product" }),
8
+ energy_class: z.string().optional().meta({ description: "The energy class of the product, as required by EU regulations. A,B,C,D,E,F,G, etc" }),
9
+ garan_duration: z.number().optional().meta({ description: "The duration of the guarantee in months as by the EU Garan scheme. Only set if above 24." }),
10
+ is_organic: z.boolean().optional().meta({ description: "Indicates whether the product is organic" }),
11
+ organic_certification_type: z.string().optional().meta({ description: "The type of organic certification, e.g., EU_ORGANIC_LEAF, GOTS, ECOCERT." })
12
+ });
5
13
  const ProductSearchResultItemVariantSchema = z.looseObject({
6
14
  variant: ProductVariantIdentifierSchema.describe("The specific variant of the product"),
7
15
  image: ImageSchema.describe("The image representing this variant in the search results"),
@@ -11,6 +19,7 @@ const ProductSearchResultItemSchema = BaseModelSchema.extend({
11
19
  identifier: ProductIdentifierSchema,
12
20
  name: z.string(),
13
21
  slug: z.string(),
22
+ complianceData: ProductSearchResultItemComplianceDataSchema.optional().meta({ description: "Compliance data for the product as required by EU regulations." }),
14
23
  variants: z.array(ProductSearchResultItemVariantSchema).meta({ description: "A list of variants associated with the product in the search results. If exactly one is present, you can use add-to-cart directly from PLP. If none are present, you must direct to PDP. If mulitple are present, and no options are set, you must direct to PDP. If multiple are present, and they have options, you can render swatches on PLP and allow customer to flip between variants." })
15
24
  });
16
25
  const ProductSearchResultFacetValueSchema = z.looseObject({
@@ -31,6 +40,7 @@ const ProductSearchResultSchema = createPaginatedResponseSchema(ProductSearchRes
31
40
  export {
32
41
  ProductSearchResultFacetSchema,
33
42
  ProductSearchResultFacetValueSchema,
43
+ ProductSearchResultItemComplianceDataSchema,
34
44
  ProductSearchResultItemSchema,
35
45
  ProductSearchResultItemVariantSchema,
36
46
  ProductSearchResultSchema
@@ -1,6 +1,35 @@
1
1
  import * as z from "zod";
2
2
  import { CategoryIdentifierSchema, ProductAttributeIdentifierSchema, ProductAttributeValueIdentifierSchema, ProductIdentifierSchema, ProductOptionIdentifierSchema, ProductOptionValueIdentifierSchema, ProductVariantIdentifierSchema } from "./identifiers.model.js";
3
3
  import { BaseModelSchema, ImageSchema } from "./base.model.js";
4
+ const ProductComplianceDataSchema = z.looseObject({
5
+ ce_marking: z.boolean().default(false).meta({ description: "Indicates whether CE marking can be shown on the product" }),
6
+ weee_symbol: z.boolean().default(false).meta({ description: "Indicates whether the WEEE symbol can be shown on the product" }),
7
+ energy_class: z.string().optional().meta({ description: "The energy class of the product, as required by EU regulations. A,B,C,D,E,F,G, etc" }),
8
+ garan_duration: z.number().optional().meta({ description: "The duration of the guarantee in months as by the EU Garan scheme. Only set if above 24." }),
9
+ safety_warnings: z.string().optional().meta({ description: "Any safety warnings associated with the product as required by EU regulations." }),
10
+ composition: z.string().optional().meta({ description: "The composition of the product as required by EU regulations." }),
11
+ additional_disclosures: z.string().optional().meta({ description: "Any additional disclosures associated with the product as required by EU regulations." }),
12
+ traceability: z.object({
13
+ product_identifier: z.string().optional().meta({ description: 'The unique identifier for the product batch, e.g., "BATCH-2026-X9".' }),
14
+ manufacturer: z.object({
15
+ name: z.string().optional().meta({ description: "The name of the manufacturer." }),
16
+ postal_address: z.string().optional().meta({ description: "The postal address of the manufacturer." }),
17
+ electronic_address: z.string().optional().meta({ description: "The electronic address of the manufacturer." })
18
+ }).meta({ description: "Information about the manufacturer of the product." }),
19
+ eu_responsible_person: z.object({
20
+ name: z.string().optional().meta({ description: "The name of the EU responsible person." }),
21
+ postal_address: z.string().optional().meta({ description: "The postal address of the EU responsible person." }),
22
+ electronic_address: z.string().optional().meta({ description: "The electronic address of the EU responsible person." })
23
+ }).meta({ description: "Information about the EU responsible person for the product." })
24
+ }).optional().meta({ description: "Traceability information for the product as required by EU regulations." }),
25
+ organic: z.object({
26
+ is_organic: z.boolean().meta({ description: "true, if the product is organic according to EU regulations." }),
27
+ certification_type: z.string().optional().meta({ description: "The type of organic certification, e.g., EU_ORGANIC_LEAF, GOTS, ECOCERT." }),
28
+ control_body_code: z.string().optional().meta({ description: "The code of the control body responsible for the certification." }),
29
+ agriculture_origin: z.string().optional().meta({ description: "The origin of the agriculture, e.g., EU or non-EU." }),
30
+ certificate_url: z.url().optional().meta({ description: "The URL to the organic certification document." })
31
+ }).optional().meta({ description: "Information about the organic certification of the product as required by EU regulations." })
32
+ });
4
33
  const ProductOptionValueSchema = z.looseObject({
5
34
  identifier: ProductOptionValueIdentifierSchema.describe("The unique identifier for the product option value."),
6
35
  label: z.string().meta({ description: "The human-friendly label for the product option value." })
@@ -49,11 +78,13 @@ const ProductSchema = BaseModelSchema.extend({
49
78
  sharedAttributes: z.array(ProductAttributeSchema).meta({ description: "A list of technical attributes associated with the product" }),
50
79
  options: z.array(ProductOptionSchema).meta({ description: "A list of options available for the product, such as size or color. Can be empty if product is single-sku" }),
51
80
  mainVariant: ProductVariantSchema.describe("The primary SKU for the product"),
52
- variants: z.array(ProductVariantSchema).default([]).meta({ description: "A list of all SKUs for the product. Can be empty or omitted if product is single-sku" })
81
+ variants: z.array(ProductVariantSchema).default([]).meta({ description: "A list of all SKUs for the product. Can be empty or omitted if product is single-sku" }),
82
+ complianceData: ProductComplianceDataSchema.optional().describe("Compliance information for the product, including certifications and regulatory markings.")
53
83
  }).describe("A product is a wrapper around sellable items. It contains all the shared information for a set of SKUs. All products have at least one SKU, but can potentially have hundreds.");
54
84
  export {
55
85
  ProductAttributeSchema,
56
86
  ProductAttributeValueSchema,
87
+ ProductComplianceDataSchema,
57
88
  ProductOptionSchema,
58
89
  ProductOptionValueSchema,
59
90
  ProductSchema,
@@ -25,6 +25,14 @@ export declare const ProductAssociationProductSearchResultItemSchema: z.ZodObjec
25
25
  }, z.core.$loose>;
26
26
  name: z.ZodString;
27
27
  slug: z.ZodString;
28
+ complianceData: z.ZodOptional<z.ZodObject<{
29
+ ce_marking: z.ZodDefault<z.ZodBoolean>;
30
+ weee_symbol: z.ZodDefault<z.ZodBoolean>;
31
+ energy_class: z.ZodOptional<z.ZodString>;
32
+ garan_duration: z.ZodOptional<z.ZodNumber>;
33
+ is_organic: z.ZodOptional<z.ZodBoolean>;
34
+ organic_certification_type: z.ZodOptional<z.ZodString>;
35
+ }, z.core.$loose>>;
28
36
  variants: z.ZodArray<z.ZodObject<{
29
37
  variant: z.ZodObject<{
30
38
  sku: z.ZodString;
@@ -72,6 +80,14 @@ export declare const ProductAssociationSchema: z.ZodDiscriminatedUnion<[z.ZodObj
72
80
  }, z.core.$loose>;
73
81
  name: z.ZodString;
74
82
  slug: z.ZodString;
83
+ complianceData: z.ZodOptional<z.ZodObject<{
84
+ ce_marking: z.ZodDefault<z.ZodBoolean>;
85
+ weee_symbol: z.ZodDefault<z.ZodBoolean>;
86
+ energy_class: z.ZodOptional<z.ZodString>;
87
+ garan_duration: z.ZodOptional<z.ZodNumber>;
88
+ is_organic: z.ZodOptional<z.ZodBoolean>;
89
+ organic_certification_type: z.ZodOptional<z.ZodString>;
90
+ }, z.core.$loose>>;
75
91
  variants: z.ZodArray<z.ZodObject<{
76
92
  variant: z.ZodObject<{
77
93
  sku: z.ZodString;
@@ -28,6 +28,14 @@ export declare const ProductRecommendationProductSearchResultItemSchema: z.ZodOb
28
28
  }, z.core.$loose>;
29
29
  name: z.ZodString;
30
30
  slug: z.ZodString;
31
+ complianceData: z.ZodOptional<z.ZodObject<{
32
+ ce_marking: z.ZodDefault<z.ZodBoolean>;
33
+ weee_symbol: z.ZodDefault<z.ZodBoolean>;
34
+ energy_class: z.ZodOptional<z.ZodString>;
35
+ garan_duration: z.ZodOptional<z.ZodNumber>;
36
+ is_organic: z.ZodOptional<z.ZodBoolean>;
37
+ organic_certification_type: z.ZodOptional<z.ZodString>;
38
+ }, z.core.$loose>>;
31
39
  variants: z.ZodArray<z.ZodObject<{
32
40
  variant: z.ZodObject<{
33
41
  sku: z.ZodString;
@@ -77,6 +85,14 @@ export declare const ProductRecommendationSchema: z.ZodDiscriminatedUnion<[z.Zod
77
85
  }, z.core.$loose>;
78
86
  name: z.ZodString;
79
87
  slug: z.ZodString;
88
+ complianceData: z.ZodOptional<z.ZodObject<{
89
+ ce_marking: z.ZodDefault<z.ZodBoolean>;
90
+ weee_symbol: z.ZodDefault<z.ZodBoolean>;
91
+ energy_class: z.ZodOptional<z.ZodString>;
92
+ garan_duration: z.ZodOptional<z.ZodNumber>;
93
+ is_organic: z.ZodOptional<z.ZodBoolean>;
94
+ organic_certification_type: z.ZodOptional<z.ZodString>;
95
+ }, z.core.$loose>>;
80
96
  variants: z.ZodArray<z.ZodObject<{
81
97
  variant: z.ZodObject<{
82
98
  sku: z.ZodString;
@@ -1,5 +1,13 @@
1
1
  import * as z from 'zod';
2
2
  import type { InferType } from '../../zod-utils.js';
3
+ export declare const ProductSearchResultItemComplianceDataSchema: z.ZodObject<{
4
+ ce_marking: z.ZodDefault<z.ZodBoolean>;
5
+ weee_symbol: z.ZodDefault<z.ZodBoolean>;
6
+ energy_class: z.ZodOptional<z.ZodString>;
7
+ garan_duration: z.ZodOptional<z.ZodNumber>;
8
+ is_organic: z.ZodOptional<z.ZodBoolean>;
9
+ organic_certification_type: z.ZodOptional<z.ZodString>;
10
+ }, z.core.$loose>;
3
11
  export declare const ProductSearchResultItemVariantSchema: z.ZodObject<{
4
12
  variant: z.ZodObject<{
5
13
  sku: z.ZodString;
@@ -32,6 +40,14 @@ export declare const ProductSearchResultItemSchema: z.ZodObject<{
32
40
  }, z.core.$loose>;
33
41
  name: z.ZodString;
34
42
  slug: z.ZodString;
43
+ complianceData: z.ZodOptional<z.ZodObject<{
44
+ ce_marking: z.ZodDefault<z.ZodBoolean>;
45
+ weee_symbol: z.ZodDefault<z.ZodBoolean>;
46
+ energy_class: z.ZodOptional<z.ZodString>;
47
+ garan_duration: z.ZodOptional<z.ZodNumber>;
48
+ is_organic: z.ZodOptional<z.ZodBoolean>;
49
+ organic_certification_type: z.ZodOptional<z.ZodString>;
50
+ }, z.core.$loose>>;
35
51
  variants: z.ZodArray<z.ZodObject<{
36
52
  variant: z.ZodObject<{
37
53
  sku: z.ZodString;
@@ -98,6 +114,14 @@ export declare const ProductSearchResultSchema: z.ZodObject<{
98
114
  }, z.core.$loose>;
99
115
  name: z.ZodString;
100
116
  slug: z.ZodString;
117
+ complianceData: z.ZodOptional<z.ZodObject<{
118
+ ce_marking: z.ZodDefault<z.ZodBoolean>;
119
+ weee_symbol: z.ZodDefault<z.ZodBoolean>;
120
+ energy_class: z.ZodOptional<z.ZodString>;
121
+ garan_duration: z.ZodOptional<z.ZodNumber>;
122
+ is_organic: z.ZodOptional<z.ZodBoolean>;
123
+ organic_certification_type: z.ZodOptional<z.ZodString>;
124
+ }, z.core.$loose>>;
101
125
  variants: z.ZodArray<z.ZodObject<{
102
126
  variant: z.ZodObject<{
103
127
  sku: z.ZodString;
@@ -168,6 +192,7 @@ export declare const ProductSearchResultSchema: z.ZodObject<{
168
192
  }, z.core.$strip>;
169
193
  export type ProductSearchResultItemVariant = InferType<typeof ProductSearchResultItemVariantSchema>;
170
194
  export type ProductSearchResultItem = InferType<typeof ProductSearchResultItemSchema>;
195
+ export type ProductSearchResultItemComplianceData = InferType<typeof ProductSearchResultItemComplianceDataSchema>;
171
196
  export type ProductSearchResult = InferType<typeof ProductSearchResultSchema>;
172
197
  export type ProductSearchResultFacet = InferType<typeof ProductSearchResultFacetSchema>;
173
198
  export type ProductSearchResultFacetValue = InferType<typeof ProductSearchResultFacetValueSchema>;
@@ -1,5 +1,38 @@
1
1
  import * as z from 'zod';
2
2
  import type { InferType } from '../../zod-utils.js';
3
+ /**
4
+ * This type represents all the various compliance fields that EU law mandates for products sold within the European Union.
5
+ * It includes information such as the unique identifier for the compliance information.
6
+ */
7
+ export declare const ProductComplianceDataSchema: z.ZodObject<{
8
+ ce_marking: z.ZodDefault<z.ZodBoolean>;
9
+ weee_symbol: z.ZodDefault<z.ZodBoolean>;
10
+ energy_class: z.ZodOptional<z.ZodString>;
11
+ garan_duration: z.ZodOptional<z.ZodNumber>;
12
+ safety_warnings: z.ZodOptional<z.ZodString>;
13
+ composition: z.ZodOptional<z.ZodString>;
14
+ additional_disclosures: z.ZodOptional<z.ZodString>;
15
+ traceability: z.ZodOptional<z.ZodObject<{
16
+ product_identifier: z.ZodOptional<z.ZodString>;
17
+ manufacturer: z.ZodObject<{
18
+ name: z.ZodOptional<z.ZodString>;
19
+ postal_address: z.ZodOptional<z.ZodString>;
20
+ electronic_address: z.ZodOptional<z.ZodString>;
21
+ }, z.core.$strip>;
22
+ eu_responsible_person: z.ZodObject<{
23
+ name: z.ZodOptional<z.ZodString>;
24
+ postal_address: z.ZodOptional<z.ZodString>;
25
+ electronic_address: z.ZodOptional<z.ZodString>;
26
+ }, z.core.$strip>;
27
+ }, z.core.$strip>>;
28
+ organic: z.ZodOptional<z.ZodObject<{
29
+ is_organic: z.ZodBoolean;
30
+ certification_type: z.ZodOptional<z.ZodString>;
31
+ control_body_code: z.ZodOptional<z.ZodString>;
32
+ agriculture_origin: z.ZodOptional<z.ZodString>;
33
+ certificate_url: z.ZodOptional<z.ZodURL>;
34
+ }, z.core.$strip>>;
35
+ }, z.core.$loose>;
3
36
  export declare const ProductOptionValueSchema: z.ZodObject<{
4
37
  identifier: z.ZodObject<{
5
38
  option: z.ZodObject<{
@@ -196,9 +229,39 @@ export declare const ProductSchema: z.ZodObject<{
196
229
  }, z.core.$loose>;
197
230
  }, z.core.$loose>>;
198
231
  }, z.core.$loose>>>;
232
+ complianceData: z.ZodOptional<z.ZodObject<{
233
+ ce_marking: z.ZodDefault<z.ZodBoolean>;
234
+ weee_symbol: z.ZodDefault<z.ZodBoolean>;
235
+ energy_class: z.ZodOptional<z.ZodString>;
236
+ garan_duration: z.ZodOptional<z.ZodNumber>;
237
+ safety_warnings: z.ZodOptional<z.ZodString>;
238
+ composition: z.ZodOptional<z.ZodString>;
239
+ additional_disclosures: z.ZodOptional<z.ZodString>;
240
+ traceability: z.ZodOptional<z.ZodObject<{
241
+ product_identifier: z.ZodOptional<z.ZodString>;
242
+ manufacturer: z.ZodObject<{
243
+ name: z.ZodOptional<z.ZodString>;
244
+ postal_address: z.ZodOptional<z.ZodString>;
245
+ electronic_address: z.ZodOptional<z.ZodString>;
246
+ }, z.core.$strip>;
247
+ eu_responsible_person: z.ZodObject<{
248
+ name: z.ZodOptional<z.ZodString>;
249
+ postal_address: z.ZodOptional<z.ZodString>;
250
+ electronic_address: z.ZodOptional<z.ZodString>;
251
+ }, z.core.$strip>;
252
+ }, z.core.$strip>>;
253
+ organic: z.ZodOptional<z.ZodObject<{
254
+ is_organic: z.ZodBoolean;
255
+ certification_type: z.ZodOptional<z.ZodString>;
256
+ control_body_code: z.ZodOptional<z.ZodString>;
257
+ agriculture_origin: z.ZodOptional<z.ZodString>;
258
+ certificate_url: z.ZodOptional<z.ZodURL>;
259
+ }, z.core.$strip>>;
260
+ }, z.core.$loose>>;
199
261
  }, z.core.$loose>;
200
262
  export type ProductVariant = InferType<typeof ProductVariantSchema>;
201
263
  export type Product = InferType<typeof ProductSchema>;
264
+ export type ProductComplianceData = InferType<typeof ProductComplianceDataSchema>;
202
265
  export type ProductAttribute = InferType<typeof ProductAttributeSchema>;
203
266
  export type ProductAttributeValue = InferType<typeof ProductAttributeValueSchema>;
204
267
  export type ProductOption = InferType<typeof ProductOptionSchema>;