@reactionary/commercetools 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.
@@ -3,7 +3,8 @@ import {
3
3
  ProductAttributeIdentifierSchema,
4
4
  ProductAttributeSchema,
5
5
  ProductAttributeValueIdentifierSchema,
6
- ProductAttributeValueSchema
6
+ ProductAttributeValueSchema,
7
+ ProductComplianceDataSchema
7
8
  } from "@reactionary/core";
8
9
  import { getLanguageCodeFromLocale } from "../../core/locale-utils.js";
9
10
  class CommercetoolsProductFactory {
@@ -56,10 +57,14 @@ class CommercetoolsProductFactory {
56
57
  options: [],
57
58
  parentCategories: [],
58
59
  published: true,
59
- variants: otherVariants
60
+ variants: otherVariants,
61
+ complianceData: this.parseComplianceData(context, data)
60
62
  };
61
63
  return this.productSchema.parse(result);
62
64
  }
65
+ parseComplianceData(context, data) {
66
+ return ProductComplianceDataSchema.parse({});
67
+ }
63
68
  /**
64
69
  * Return true, if the attribute is a defining attribute (ie an option)
65
70
  * @param attr a variant attribute
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  ImageSchema,
3
3
  ProductOptionIdentifierSchema,
4
+ ProductSearchResultItemComplianceDataSchema,
4
5
  ProductSearchResultItemVariantSchema,
5
6
  ProductVariantIdentifierSchema,
6
7
  ProductVariantOptionSchema
@@ -31,7 +32,8 @@ class CommercetoolsProductAssociationsFactory {
31
32
  identifier: { key: data.id },
32
33
  name: data.name[localeStr] || data.id,
33
34
  slug: data.slug?.[localeStr] || data.id,
34
- variants
35
+ variants,
36
+ complianceData: this.buildProductComplianceData(data)
35
37
  };
36
38
  }
37
39
  parseVariant(context, variant, product) {
@@ -59,6 +61,9 @@ class CommercetoolsProductAssociationsFactory {
59
61
  options: mappedOption
60
62
  });
61
63
  }
64
+ buildProductComplianceData(data) {
65
+ return ProductSearchResultItemComplianceDataSchema.parse({});
66
+ }
62
67
  }
63
68
  export {
64
69
  CommercetoolsProductAssociationsFactory
@@ -5,6 +5,7 @@ import {
5
5
  ProductOptionIdentifierSchema,
6
6
  ProductSearchResultFacetSchema,
7
7
  ProductSearchResultFacetValueSchema,
8
+ ProductSearchResultItemComplianceDataSchema,
8
9
  ProductSearchResultItemVariantSchema,
9
10
  ProductVariantIdentifierSchema,
10
11
  ProductVariantOptionSchema
@@ -55,10 +56,14 @@ class CommercetoolsProductSearchFactory {
55
56
  identifier,
56
57
  name,
57
58
  slug,
59
+ complianceData: this.parseComplianceData(data),
58
60
  variants
59
61
  };
60
62
  return result;
61
63
  }
64
+ parseComplianceData(data) {
65
+ return ProductSearchResultItemComplianceDataSchema.parse({});
66
+ }
62
67
  parseFacet(facetIdentifier, facet) {
63
68
  const result = ProductSearchResultFacetSchema.parse({
64
69
  identifier: facetIdentifier,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reactionary/commercetools",
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",
@@ -9,7 +9,7 @@
9
9
  "url": "git+https://github.com/Solteq/reactionary.git"
10
10
  },
11
11
  "dependencies": {
12
- "@reactionary/core": "0.10.25",
12
+ "@reactionary/core": "0.10.26",
13
13
  "zod": "4.1.9",
14
14
  "@commercetools/ts-client": "^4.9.1",
15
15
  "@commercetools/platform-sdk": "^8.25.0",
@@ -1,11 +1,12 @@
1
1
  import { type AnyProductSchema, type ProductFactory, type ProductVariant, type RequestContext } from '@reactionary/core';
2
2
  import type * as z from 'zod';
3
3
  import type { ProductProjection, ProductVariant as CTProductVariant, Attribute as CTAttribute } from '@commercetools/platform-sdk';
4
- import type { ProductAttribute, ProductAttributeValue, ProductSchema } from '@reactionary/core';
4
+ import type { ProductAttribute, ProductAttributeValue, ProductSchema, ProductComplianceData } from '@reactionary/core';
5
5
  export declare class CommercetoolsProductFactory<TProductSchema extends AnyProductSchema = typeof ProductSchema> implements ProductFactory<TProductSchema> {
6
6
  readonly productSchema: TProductSchema;
7
7
  constructor(productSchema: TProductSchema);
8
8
  parseProduct(context: RequestContext, data: ProductProjection): z.output<TProductSchema>;
9
+ protected parseComplianceData(context: RequestContext, data: ProductProjection): ProductComplianceData;
9
10
  /**
10
11
  * Return true, if the attribute is a defining attribute (ie an option)
11
12
  * @param attr a variant attribute
@@ -1,5 +1,5 @@
1
1
  import type { ProductProjection, ProductVariant as CTProductVariant } from '@commercetools/platform-sdk';
2
- import type { ProductAssociationSchema } from '@reactionary/core';
2
+ import type { ProductAssociationSchema, ProductSearchResultItemComplianceData } from '@reactionary/core';
3
3
  import { type AnyProductAssociationSchema, type ProductAssociationsFactory, type ProductSearchResultItem, type ProductSearchResultItemVariant, type RequestContext } from '@reactionary/core';
4
4
  import type * as z from 'zod';
5
5
  export declare class CommercetoolsProductAssociationsFactory<TProductAssociationSchema extends AnyProductAssociationSchema = typeof ProductAssociationSchema> implements ProductAssociationsFactory<TProductAssociationSchema> {
@@ -12,4 +12,5 @@ export declare class CommercetoolsProductAssociationsFactory<TProductAssociation
12
12
  }): z.output<TProductAssociationSchema>;
13
13
  protected parseSearchResultItem(context: RequestContext, data: ProductProjection): ProductSearchResultItem;
14
14
  protected parseVariant(context: RequestContext, variant: CTProductVariant, product: ProductProjection): ProductSearchResultItemVariant;
15
+ protected buildProductComplianceData(data: ProductProjection): ProductSearchResultItemComplianceData;
15
16
  }
@@ -1,5 +1,5 @@
1
1
  import type { ProductPagedSearchResponse, ProductProjection, ProductSearchFacetResult as CTProductSearchFacetResult, ProductVariant as CTProductVariant } from '@commercetools/platform-sdk';
2
- import type { ProductSearchResultSchema } from '@reactionary/core';
2
+ import type { ProductSearchResultItemComplianceData, ProductSearchResultSchema } from '@reactionary/core';
3
3
  import { type AnyProductSearchResultSchema, type FacetIdentifier, type FacetValueIdentifier, type ProductSearchFactory, type ProductSearchQueryByTerm, type ProductSearchResultFacet, type ProductSearchResultFacetValue, type ProductSearchResultItem, type ProductSearchResultItemVariant, type RequestContext } from '@reactionary/core';
4
4
  import type * as z from 'zod';
5
5
  export declare class CommercetoolsProductSearchFactory<TProductSearchResultSchema extends AnyProductSearchResultSchema = typeof ProductSearchResultSchema> implements ProductSearchFactory<TProductSearchResultSchema> {
@@ -7,6 +7,7 @@ export declare class CommercetoolsProductSearchFactory<TProductSearchResultSchem
7
7
  constructor(productSearchResultSchema: TProductSearchResultSchema);
8
8
  parseSearchResult(context: RequestContext, data: ProductPagedSearchResponse, query: ProductSearchQueryByTerm): z.output<TProductSearchResultSchema>;
9
9
  protected parseSingle(context: RequestContext, data: ProductProjection): ProductSearchResultItem;
10
+ protected parseComplianceData(data: ProductProjection): ProductSearchResultItemComplianceData;
10
11
  protected parseFacet(facetIdentifier: FacetIdentifier, facet: CTProductSearchFacetResult): ProductSearchResultFacet;
11
12
  protected parseFacetValue(facetValueIdentifier: FacetValueIdentifier, label: string, count: number): ProductSearchResultFacetValue;
12
13
  protected parseVariant(context: RequestContext, variant: CTProductVariant, product: ProductProjection): ProductSearchResultItemVariant;