@reactionary/provider-commercetools 0.6.1 → 0.6.2
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/core/capability-descriptors.js +274 -0
- package/core/initialize.js +26 -135
- package/core/initialize.types.js +8 -0
- package/factories/cart/cart.factory.js +108 -0
- package/factories/category/category.factory.js +38 -0
- package/factories/checkout/checkout-initializer-overrides.example.js +67 -0
- package/factories/checkout/checkout.factory.js +232 -0
- package/factories/identity/identity.factory.js +13 -0
- package/factories/inventory/inventory.factory.js +29 -0
- package/factories/order/order.factory.js +113 -0
- package/factories/order-search/order-search.factory.js +67 -0
- package/factories/price/price.factory.js +51 -0
- package/factories/product/product-factory-baseline.example.js +10 -0
- package/factories/product/product-factory-schema-and-parse-extension.example.js +25 -0
- package/factories/product/product-factory-schema-extension.example.js +18 -0
- package/factories/product/product-initializer-factory-extension.example.js +33 -0
- package/factories/product/product-provider-custom-method-only.example.js +38 -0
- package/factories/product/product-provider-schema-signature-extension.example.js +46 -0
- package/factories/product/product.factory.js +150 -0
- package/factories/product/utils.example.js +8 -0
- package/factories/product-associations/product-associations.factory.js +62 -0
- package/factories/product-list/product-list.factory.js +61 -0
- package/factories/product-reviews/product-reviews.factory.js +39 -0
- package/factories/product-search/product-search.factory.js +113 -0
- package/factories/profile/profile.factory.js +61 -0
- package/factories/store/store.factory.js +28 -0
- package/index.js +15 -0
- package/package.json +2 -2
- package/providers/cart.provider.js +14 -126
- package/providers/category.provider.js +9 -41
- package/providers/checkout.provider.js +20 -233
- package/providers/identity.provider.js +22 -9
- package/providers/inventory.provider.js +3 -21
- package/providers/order-search.provider.js +4 -76
- package/providers/order.provider.js +3 -111
- package/providers/price.provider.js +15 -35
- package/providers/product-associations.provider.js +24 -71
- package/providers/product-list.provider.js +13 -12
- package/providers/product-reviews.provider.js +15 -8
- package/providers/product-search.provider.js +4 -112
- package/providers/product.provider.js +5 -139
- package/providers/profile.provider.js +9 -52
- package/providers/store.provider.js +3 -20
- package/schema/capabilities.schema.js +25 -0
- package/src/core/capability-descriptors.d.ts +16 -0
- package/src/core/initialize.d.ts +3 -2
- package/src/core/initialize.types.d.ts +118 -0
- package/src/factories/cart/cart.factory.d.ts +14 -0
- package/src/factories/category/category.factory.d.ts +11 -0
- package/src/factories/checkout/checkout-initializer-overrides.example.d.ts +1 -0
- package/src/factories/checkout/checkout.factory.d.ts +18 -0
- package/src/factories/identity/identity.factory.d.ts +8 -0
- package/src/factories/inventory/inventory.factory.d.ts +9 -0
- package/src/factories/order/order.factory.d.ts +9 -0
- package/src/factories/order-search/order-search.factory.d.ts +11 -0
- package/src/factories/price/price.factory.d.ts +11 -0
- package/src/factories/product/product-factory-baseline.example.d.ts +1 -0
- package/src/factories/product/product-factory-schema-and-parse-extension.example.d.ts +1 -0
- package/src/factories/product/product-factory-schema-extension.example.d.ts +1 -0
- package/src/factories/product/product-initializer-factory-extension.example.d.ts +1 -0
- package/src/factories/product/product-provider-custom-method-only.example.d.ts +1 -0
- package/src/factories/product/product-provider-schema-signature-extension.example.d.ts +1 -0
- package/src/factories/product/product.factory.d.ts +18 -0
- package/src/factories/product/utils.example.d.ts +4 -0
- package/src/factories/product-associations/product-associations.factory.d.ts +15 -0
- package/src/factories/product-list/product-list.factory.d.ts +17 -0
- package/src/factories/product-reviews/product-reviews.factory.d.ts +14 -0
- package/src/factories/product-search/product-search.factory.d.ts +13 -0
- package/src/factories/profile/profile.factory.d.ts +11 -0
- package/src/factories/store/store.factory.d.ts +9 -0
- package/src/index.d.ts +15 -0
- package/src/providers/cart.provider.d.ts +15 -15
- package/src/providers/category.provider.d.ts +13 -23
- package/src/providers/checkout.provider.d.ts +16 -32
- package/src/providers/identity.provider.d.ts +9 -7
- package/src/providers/inventory.provider.d.ts +6 -6
- package/src/providers/order-search.provider.d.ts +7 -65
- package/src/providers/order.provider.d.ts +6 -5
- package/src/providers/price.provider.d.ts +12 -9
- package/src/providers/product-associations.provider.d.ts +11 -18
- package/src/providers/product-list.provider.d.ts +12 -10
- package/src/providers/product-reviews.provider.d.ts +9 -7
- package/src/providers/product-search.provider.d.ts +8 -51
- package/src/providers/product.provider.d.ts +9 -18
- package/src/providers/profile.provider.d.ts +13 -13
- package/src/providers/store.provider.d.ts +6 -6
- package/src/schema/capabilities.schema.d.ts +102 -17
- package/src/test/client-builder-merge-extensions.example.d.ts +1 -0
- package/test/client-builder-merge-extensions.example.js +94 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Cart as CTCart, LineItem } from '@commercetools/platform-sdk';
|
|
2
|
+
import type { CartIdentifierSchema, CartSchema } from '@reactionary/core';
|
|
3
|
+
import { type AnyCartIdentifierSchema, type AnyCartSchema, type CartFactory, type CartItem, type RequestContext } from '@reactionary/core';
|
|
4
|
+
import type * as z from 'zod';
|
|
5
|
+
export declare class CommercetoolsCartFactory<TCartSchema extends AnyCartSchema = typeof CartSchema, TCartIdentifierSchema extends AnyCartIdentifierSchema = typeof CartIdentifierSchema> implements CartFactory<TCartSchema, TCartIdentifierSchema> {
|
|
6
|
+
readonly cartSchema: TCartSchema;
|
|
7
|
+
readonly cartIdentifierSchema: TCartIdentifierSchema;
|
|
8
|
+
constructor(cartSchema: TCartSchema, cartIdentifierSchema: TCartIdentifierSchema);
|
|
9
|
+
parseCartIdentifier(_context: RequestContext, data: {
|
|
10
|
+
key?: string;
|
|
11
|
+
}): z.output<TCartIdentifierSchema>;
|
|
12
|
+
parseCart(context: RequestContext, data: CTCart): z.output<TCartSchema>;
|
|
13
|
+
protected parseCartItem(lineItem: LineItem): CartItem;
|
|
14
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Category as CTCategory, CategoryPagedQueryResponse } from '@commercetools/platform-sdk';
|
|
2
|
+
import type { CategoryPaginatedResultSchema, CategorySchema } from '@reactionary/core';
|
|
3
|
+
import { type AnyCategoryPaginatedResultSchema, type AnyCategorySchema, type CategoryFactory, type RequestContext } from '@reactionary/core';
|
|
4
|
+
import type * as z from 'zod';
|
|
5
|
+
export declare class CommercetoolsCategoryFactory<TCategorySchema extends AnyCategorySchema = typeof CategorySchema, TCategoryPaginatedSchema extends AnyCategoryPaginatedResultSchema = typeof CategoryPaginatedResultSchema> implements CategoryFactory<TCategorySchema, TCategoryPaginatedSchema> {
|
|
6
|
+
readonly categorySchema: TCategorySchema;
|
|
7
|
+
readonly categoryPaginatedResultSchema: TCategoryPaginatedSchema;
|
|
8
|
+
constructor(categorySchema: TCategorySchema, categoryPaginatedResultSchema: TCategoryPaginatedSchema);
|
|
9
|
+
parseCategory(context: RequestContext, data: CTCategory): z.output<TCategorySchema>;
|
|
10
|
+
parseCategoryPaginatedResult(context: RequestContext, data: CategoryPagedQueryResponse): z.output<TCategoryPaginatedSchema>;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Address as CTAddress, Cart as CTCart, LineItem, Payment as CTPayment, ShippingMethod as CTShippingMethod } from '@commercetools/platform-sdk';
|
|
2
|
+
import type { CheckoutSchema, PaymentMethodSchema, ShippingMethodSchema } from '@reactionary/core';
|
|
3
|
+
import { type Address, type AnyCheckoutSchema, type AnyPaymentMethodSchema, type AnyShippingMethodSchema, type CheckoutFactory, type CheckoutItem, type CostBreakDown, type PaymentInstruction, type PaymentMethod, type RequestContext, type ShippingInstruction } from '@reactionary/core';
|
|
4
|
+
import type * as z from 'zod';
|
|
5
|
+
export declare class CommercetoolsCheckoutFactory<TCheckoutSchema extends AnyCheckoutSchema = typeof CheckoutSchema, TShippingMethodSchema extends AnyShippingMethodSchema = typeof ShippingMethodSchema, TPaymentMethodSchema extends AnyPaymentMethodSchema = typeof PaymentMethodSchema> implements CheckoutFactory<TCheckoutSchema, TShippingMethodSchema, TPaymentMethodSchema> {
|
|
6
|
+
readonly checkoutSchema: TCheckoutSchema;
|
|
7
|
+
readonly shippingMethodSchema: TShippingMethodSchema;
|
|
8
|
+
readonly paymentMethodSchema: TPaymentMethodSchema;
|
|
9
|
+
constructor(checkoutSchema: TCheckoutSchema, shippingMethodSchema: TShippingMethodSchema, paymentMethodSchema: TPaymentMethodSchema);
|
|
10
|
+
parseCheckout(context: RequestContext, data: CTCart): z.output<TCheckoutSchema>;
|
|
11
|
+
parseShippingMethod(context: RequestContext, data: CTShippingMethod): z.output<TShippingMethodSchema>;
|
|
12
|
+
parsePaymentMethod(_context: RequestContext, data: PaymentMethod): z.output<TPaymentMethodSchema>;
|
|
13
|
+
protected parseCheckoutItem(remoteItem: LineItem): CheckoutItem;
|
|
14
|
+
protected isReadyForFinalization(price: CostBreakDown, paymentInstructions: PaymentInstruction[], billingAddress?: Address, shippingAddress?: Address, shippingInstruction?: ShippingInstruction): boolean;
|
|
15
|
+
protected parsePaymentInstruction(context: RequestContext, data: CTPayment): PaymentInstruction;
|
|
16
|
+
protected parseAddress(data: CTAddress): Address;
|
|
17
|
+
protected parseShippingInstruction(data: CTCart): ShippingInstruction | undefined;
|
|
18
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IdentitySchema } from '@reactionary/core';
|
|
2
|
+
import { type AnyIdentitySchema, type IdentityFactory, type RequestContext } from '@reactionary/core';
|
|
3
|
+
import type * as z from 'zod';
|
|
4
|
+
export declare class CommercetoolsIdentityFactory<TIdentitySchema extends AnyIdentitySchema = typeof IdentitySchema> implements IdentityFactory<TIdentitySchema> {
|
|
5
|
+
readonly identitySchema: TIdentitySchema;
|
|
6
|
+
constructor(identitySchema: TIdentitySchema);
|
|
7
|
+
parseIdentity(_context: RequestContext, data: unknown): z.output<TIdentitySchema>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { InventoryEntry } from '@commercetools/platform-sdk';
|
|
2
|
+
import type { InventorySchema } from '@reactionary/core';
|
|
3
|
+
import { type AnyInventorySchema, type InventoryFactory, type RequestContext } from '@reactionary/core';
|
|
4
|
+
import type * as z from 'zod';
|
|
5
|
+
export declare class CommercetoolsInventoryFactory<TInventorySchema extends AnyInventorySchema = typeof InventorySchema> implements InventoryFactory<TInventorySchema> {
|
|
6
|
+
readonly inventorySchema: TInventorySchema;
|
|
7
|
+
constructor(inventorySchema: TInventorySchema);
|
|
8
|
+
parseInventory(_context: RequestContext, data: InventoryEntry): z.output<TInventorySchema>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Order as CTOrder } from '@commercetools/platform-sdk';
|
|
2
|
+
import type { OrderSchema } from '@reactionary/core';
|
|
3
|
+
import { type AnyOrderSchema, type OrderFactory, type RequestContext } from '@reactionary/core';
|
|
4
|
+
import type * as z from 'zod';
|
|
5
|
+
export declare class CommercetoolsOrderFactory<TOrderSchema extends AnyOrderSchema = typeof OrderSchema> implements OrderFactory<TOrderSchema> {
|
|
6
|
+
readonly orderSchema: TOrderSchema;
|
|
7
|
+
constructor(orderSchema: TOrderSchema);
|
|
8
|
+
parseOrder(_context: RequestContext, data: CTOrder): z.output<TOrderSchema>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Address as CTAddress, Order as CTOrder, OrderPagedQueryResponse } from '@commercetools/platform-sdk';
|
|
2
|
+
import type { OrderSearchResultSchema } from '@reactionary/core';
|
|
3
|
+
import { type Address, type AnyOrderSearchResultSchema, type OrderSearchFactory, type OrderSearchQueryByTerm, type OrderSearchResultItem, type RequestContext } from '@reactionary/core';
|
|
4
|
+
import type * as z from 'zod';
|
|
5
|
+
export declare class CommercetoolsOrderSearchFactory<TOrderSearchResultSchema extends AnyOrderSearchResultSchema = typeof OrderSearchResultSchema> implements OrderSearchFactory<TOrderSearchResultSchema> {
|
|
6
|
+
readonly orderSearchResultSchema: TOrderSearchResultSchema;
|
|
7
|
+
constructor(orderSearchResultSchema: TOrderSearchResultSchema);
|
|
8
|
+
parseOrderSearchResult(context: RequestContext, data: OrderPagedQueryResponse, query: OrderSearchQueryByTerm): z.output<TOrderSearchResultSchema>;
|
|
9
|
+
protected parseAddress(data: CTAddress): Address;
|
|
10
|
+
protected parseOrderSearchItem(context: RequestContext, data: CTOrder): OrderSearchResultItem;
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ProductVariant as CTProductVariant } from '@commercetools/platform-sdk';
|
|
2
|
+
import type { PriceSchema } from '@reactionary/core';
|
|
3
|
+
import { type AnyPriceSchema, type PriceFactory, type RequestContext } from '@reactionary/core';
|
|
4
|
+
import type * as z from 'zod';
|
|
5
|
+
export declare class CommercetoolsPriceFactory<TPriceSchema extends AnyPriceSchema = typeof PriceSchema> implements PriceFactory<TPriceSchema> {
|
|
6
|
+
readonly priceSchema: TPriceSchema;
|
|
7
|
+
constructor(priceSchema: TPriceSchema);
|
|
8
|
+
parsePrice(context: RequestContext, data: CTProductVariant, options?: {
|
|
9
|
+
includeDiscounts: boolean;
|
|
10
|
+
}): z.output<TPriceSchema>;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type AnyProductSchema, type ProductFactory, type ProductVariant, type RequestContext } from '@reactionary/core';
|
|
2
|
+
import type * as z from 'zod';
|
|
3
|
+
import type { ProductProjection, ProductVariant as CTProductVariant, Attribute as CTAttribute } from '@commercetools/platform-sdk';
|
|
4
|
+
import type { ProductAttribute, ProductAttributeValue, ProductSchema } from '@reactionary/core';
|
|
5
|
+
export declare class CommercetoolsProductFactory<TProductSchema extends AnyProductSchema = typeof ProductSchema> implements ProductFactory<TProductSchema> {
|
|
6
|
+
readonly productSchema: TProductSchema;
|
|
7
|
+
constructor(productSchema: TProductSchema);
|
|
8
|
+
parseProduct(context: RequestContext, data: ProductProjection): z.output<TProductSchema>;
|
|
9
|
+
/**
|
|
10
|
+
* Return true, if the attribute is a defining attribute (ie an option)
|
|
11
|
+
* @param attr a variant attribute
|
|
12
|
+
* @returns true if the attribute is an option
|
|
13
|
+
*/
|
|
14
|
+
protected isVariantAttributeAnOption(attr: CTAttribute): boolean;
|
|
15
|
+
protected parseVariant(context: RequestContext, variant: CTProductVariant, product: ProductProjection): ProductVariant;
|
|
16
|
+
protected parseAttribute(context: RequestContext, attr: CTAttribute): ProductAttribute;
|
|
17
|
+
protected parseAttributeValue(context: RequestContext, attr: CTAttribute): ProductAttributeValue;
|
|
18
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ProductProjection, ProductVariant as CTProductVariant } from '@commercetools/platform-sdk';
|
|
2
|
+
import type { ProductAssociationSchema } from '@reactionary/core';
|
|
3
|
+
import { type AnyProductAssociationSchema, type ProductAssociationsFactory, type ProductSearchResultItem, type ProductSearchResultItemVariant, type RequestContext } from '@reactionary/core';
|
|
4
|
+
import type * as z from 'zod';
|
|
5
|
+
export declare class CommercetoolsProductAssociationsFactory<TProductAssociationSchema extends AnyProductAssociationSchema = typeof ProductAssociationSchema> implements ProductAssociationsFactory<TProductAssociationSchema> {
|
|
6
|
+
readonly productAssociationSchema: TProductAssociationSchema;
|
|
7
|
+
constructor(productAssociationSchema: TProductAssociationSchema);
|
|
8
|
+
parseAssociation(context: RequestContext, data: {
|
|
9
|
+
sourceProductKey: string;
|
|
10
|
+
relation: 'accessory' | 'sparepart' | 'replacement';
|
|
11
|
+
product: ProductProjection;
|
|
12
|
+
}): z.output<TProductAssociationSchema>;
|
|
13
|
+
protected parseSearchResultItem(context: RequestContext, data: ProductProjection): ProductSearchResultItem;
|
|
14
|
+
protected parseVariant(context: RequestContext, variant: CTProductVariant, product: ProductProjection): ProductSearchResultItemVariant;
|
|
15
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ShoppingList, ShoppingListLineItem } from '@commercetools/platform-sdk';
|
|
2
|
+
import type { ProductListItemPaginatedResultsSchema, ProductListItemSchema, ProductListPaginatedResultsSchema, ProductListSchema } from '@reactionary/core';
|
|
3
|
+
import { type AnyProductListItemPaginatedSchema, type AnyProductListItemSchema, type AnyProductListPaginatedSchema, type AnyProductListSchema, type ProductList, type ProductListFactory, type ProductListIdentifier, type ProductListItem, type ProductListItemPaginatedResult, type ProductListPaginatedResult, type RequestContext } from '@reactionary/core';
|
|
4
|
+
import type * as z from 'zod';
|
|
5
|
+
export declare class CommercetoolsProductListFactory<TProductListSchema extends AnyProductListSchema = typeof ProductListSchema, TProductListItemSchema extends AnyProductListItemSchema = typeof ProductListItemSchema, TProductListPaginatedSchema extends AnyProductListPaginatedSchema = typeof ProductListPaginatedResultsSchema, TProductListItemPaginatedSchema extends AnyProductListItemPaginatedSchema = typeof ProductListItemPaginatedResultsSchema> implements ProductListFactory<TProductListSchema, TProductListItemSchema, TProductListPaginatedSchema, TProductListItemPaginatedSchema> {
|
|
6
|
+
readonly productListSchema: TProductListSchema;
|
|
7
|
+
readonly productListItemSchema: TProductListItemSchema;
|
|
8
|
+
readonly productListPaginatedSchema: TProductListPaginatedSchema;
|
|
9
|
+
readonly productListItemPaginatedSchema: TProductListItemPaginatedSchema;
|
|
10
|
+
constructor(productListSchema: TProductListSchema, productListItemSchema: TProductListItemSchema, productListPaginatedSchema: TProductListPaginatedSchema, productListItemPaginatedSchema: TProductListItemPaginatedSchema);
|
|
11
|
+
parseProductList(_context: RequestContext, data: ProductList): z.output<TProductListSchema>;
|
|
12
|
+
parseProductListItem(_context: RequestContext, data: ProductListItem): z.output<TProductListItemSchema>;
|
|
13
|
+
parseProductListPaginatedResult(_context: RequestContext, data: ProductListPaginatedResult): z.output<TProductListPaginatedSchema>;
|
|
14
|
+
parseProductListItemPaginatedResult(_context: RequestContext, data: ProductListItemPaginatedResult): z.output<TProductListItemPaginatedSchema>;
|
|
15
|
+
parseListFromCommercetools(list: ShoppingList): z.output<TProductListSchema>;
|
|
16
|
+
parseListItemFromCommercetools(listIdentifier: ProductListIdentifier, lineItem: ShoppingListLineItem): z.output<TProductListItemSchema>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Review as CTReview } from '@commercetools/platform-sdk';
|
|
2
|
+
import type { ProductRatingSummarySchema, ProductReviewPaginatedResultSchema, ProductReviewSchema } from '@reactionary/core';
|
|
3
|
+
import { type AnyProductRatingSummarySchema, type AnyProductReviewPaginatedSchema, type AnyProductReviewSchema, type ProductRatingSummary, type ProductReview, type ProductReviewPaginatedResult, type ProductReviewsFactory, type RequestContext } from '@reactionary/core';
|
|
4
|
+
import type * as z from 'zod';
|
|
5
|
+
export declare class CommercetoolsProductReviewsFactory<TRatingSummarySchema extends AnyProductRatingSummarySchema = typeof ProductRatingSummarySchema, TReviewSchema extends AnyProductReviewSchema = typeof ProductReviewSchema, TReviewPaginatedSchema extends AnyProductReviewPaginatedSchema = typeof ProductReviewPaginatedResultSchema> implements ProductReviewsFactory<TRatingSummarySchema, TReviewSchema, TReviewPaginatedSchema> {
|
|
6
|
+
readonly ratingSummarySchema: TRatingSummarySchema;
|
|
7
|
+
readonly reviewSchema: TReviewSchema;
|
|
8
|
+
readonly reviewPaginatedSchema: TReviewPaginatedSchema;
|
|
9
|
+
constructor(ratingSummarySchema: TRatingSummarySchema, reviewSchema: TReviewSchema, reviewPaginatedSchema: TReviewPaginatedSchema);
|
|
10
|
+
parseRatingSummary(_context: RequestContext, data: ProductRatingSummary): z.output<TRatingSummarySchema>;
|
|
11
|
+
parseReview(_context: RequestContext, data: ProductReview): z.output<TReviewSchema>;
|
|
12
|
+
parseReviewPaginatedResult(_context: RequestContext, data: ProductReviewPaginatedResult): z.output<TReviewPaginatedSchema>;
|
|
13
|
+
parseReviewFromCommercetools(_context: RequestContext, review: CTReview, productKey: string): z.output<TReviewSchema>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ProductPagedSearchResponse, ProductProjection, ProductSearchFacetResult as CTProductSearchFacetResult, ProductVariant as CTProductVariant } from '@commercetools/platform-sdk';
|
|
2
|
+
import type { ProductSearchResultSchema } from '@reactionary/core';
|
|
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
|
+
import type * as z from 'zod';
|
|
5
|
+
export declare class CommercetoolsProductSearchFactory<TProductSearchResultSchema extends AnyProductSearchResultSchema = typeof ProductSearchResultSchema> implements ProductSearchFactory<TProductSearchResultSchema> {
|
|
6
|
+
readonly productSearchResultSchema: TProductSearchResultSchema;
|
|
7
|
+
constructor(productSearchResultSchema: TProductSearchResultSchema);
|
|
8
|
+
parseSearchResult(context: RequestContext, data: ProductPagedSearchResponse, query: ProductSearchQueryByTerm): z.output<TProductSearchResultSchema>;
|
|
9
|
+
protected parseSingle(context: RequestContext, data: ProductProjection): ProductSearchResultItem;
|
|
10
|
+
protected parseFacet(facetIdentifier: FacetIdentifier, facet: CTProductSearchFacetResult): ProductSearchResultFacet;
|
|
11
|
+
protected parseFacetValue(facetValueIdentifier: FacetValueIdentifier, label: string, count: number): ProductSearchResultFacetValue;
|
|
12
|
+
protected parseVariant(context: RequestContext, variant: CTProductVariant, product: ProductProjection): ProductSearchResultItemVariant;
|
|
13
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Address as CTAddress, Customer } from '@commercetools/platform-sdk';
|
|
2
|
+
import type { ProfileSchema } from '@reactionary/core';
|
|
3
|
+
import { type Address, type AnyProfileSchema, type ProfileFactory, type RequestContext } from '@reactionary/core';
|
|
4
|
+
import type * as z from 'zod';
|
|
5
|
+
export declare class CommercetoolsProfileFactory<TProfileSchema extends AnyProfileSchema = typeof ProfileSchema> implements ProfileFactory<TProfileSchema> {
|
|
6
|
+
readonly profileSchema: TProfileSchema;
|
|
7
|
+
constructor(profileSchema: TProfileSchema);
|
|
8
|
+
parseProfile(_context: RequestContext, data: Customer): z.output<TProfileSchema>;
|
|
9
|
+
protected parseAddress(address: CTAddress): Address;
|
|
10
|
+
protected isIncompleteAddress(address: CTAddress | undefined): boolean;
|
|
11
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Channel } from '@commercetools/platform-sdk';
|
|
2
|
+
import type { StoreSchema } from '@reactionary/core';
|
|
3
|
+
import { type AnyStoreSchema, type RequestContext, type StoreFactory } from '@reactionary/core';
|
|
4
|
+
import type * as z from 'zod';
|
|
5
|
+
export declare class CommercetoolsStoreFactory<TStoreSchema extends AnyStoreSchema = typeof StoreSchema> implements StoreFactory<TStoreSchema> {
|
|
6
|
+
readonly storeSchema: TStoreSchema;
|
|
7
|
+
constructor(storeSchema: TStoreSchema);
|
|
8
|
+
parseStore(_context: RequestContext, data: Channel): z.output<TStoreSchema>;
|
|
9
|
+
}
|
package/src/index.d.ts
CHANGED
|
@@ -9,5 +9,20 @@ export * from './providers/product-associations.provider.js';
|
|
|
9
9
|
export * from './providers/product.provider.js';
|
|
10
10
|
export * from './providers/product-reviews.provider.js';
|
|
11
11
|
export * from './providers/product-search.provider.js';
|
|
12
|
+
export * from './factories/product/product.factory.js';
|
|
13
|
+
export * from './factories/checkout/checkout.factory.js';
|
|
14
|
+
export * from './factories/product-search/product-search.factory.js';
|
|
15
|
+
export * from './factories/inventory/inventory.factory.js';
|
|
16
|
+
export * from './factories/price/price.factory.js';
|
|
17
|
+
export * from './factories/store/store.factory.js';
|
|
18
|
+
export * from './factories/order/order.factory.js';
|
|
19
|
+
export * from './factories/category/category.factory.js';
|
|
20
|
+
export * from './factories/cart/cart.factory.js';
|
|
21
|
+
export * from './factories/profile/profile.factory.js';
|
|
22
|
+
export * from './factories/order-search/order-search.factory.js';
|
|
23
|
+
export * from './factories/product-associations/product-associations.factory.js';
|
|
24
|
+
export * from './factories/product-reviews/product-reviews.factory.js';
|
|
25
|
+
export * from './factories/product-list/product-list.factory.js';
|
|
26
|
+
export * from './factories/identity/identity.factory.js';
|
|
12
27
|
export * from './schema/capabilities.schema.js';
|
|
13
28
|
export * from './schema/configuration.schema.js';
|
|
@@ -1,24 +1,26 @@
|
|
|
1
|
-
import { CartProvider } from '@reactionary/core';
|
|
2
|
-
import type {
|
|
1
|
+
import { type CartFactory, type CartFactoryCartOutput, type CartFactoryWithOutput, CartProvider } from '@reactionary/core';
|
|
2
|
+
import type { CartMutationItemAdd, CartMutationItemQuantityChange, CartMutationItemRemove, CartQueryById, CartMutationApplyCoupon, CartMutationDeleteCart, CartMutationRemoveCoupon, CartMutationChangeCurrency, RequestContext, CartIdentifier, Cache, Result, NotFoundError } from '@reactionary/core';
|
|
3
3
|
import type { CommercetoolsConfiguration } from '../schema/configuration.schema.js';
|
|
4
|
-
import type {
|
|
4
|
+
import type { MyCartUpdateAction } from '@commercetools/platform-sdk';
|
|
5
5
|
import type { CommercetoolsAPI } from '../core/client.js';
|
|
6
|
-
|
|
6
|
+
import type { CommercetoolsCartFactory } from '../factories/cart/cart.factory.js';
|
|
7
|
+
export declare class CommercetoolsCartProvider<TFactory extends CartFactory = CommercetoolsCartFactory> extends CartProvider<CartFactoryCartOutput<TFactory>, CartIdentifier> {
|
|
7
8
|
protected config: CommercetoolsConfiguration;
|
|
8
9
|
protected commercetools: CommercetoolsAPI;
|
|
9
10
|
protected expandedCartFields: string[];
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
protected factory: CartFactoryWithOutput<TFactory>;
|
|
12
|
+
constructor(config: CommercetoolsConfiguration, cache: Cache, context: RequestContext, commercetools: CommercetoolsAPI, factory: CartFactoryWithOutput<TFactory>);
|
|
13
|
+
getById(payload: CartQueryById): Promise<Result<CartFactoryCartOutput<TFactory>, NotFoundError>>;
|
|
14
|
+
add(payload: CartMutationItemAdd): Promise<Result<CartFactoryCartOutput<TFactory>>>;
|
|
15
|
+
remove(payload: CartMutationItemRemove): Promise<Result<CartFactoryCartOutput<TFactory>>>;
|
|
16
|
+
changeQuantity(payload: CartMutationItemQuantityChange): Promise<Result<CartFactoryCartOutput<TFactory>>>;
|
|
15
17
|
getActiveCartId(): Promise<Result<CartIdentifier, NotFoundError>>;
|
|
16
18
|
deleteCart(payload: CartMutationDeleteCart): Promise<Result<void>>;
|
|
17
|
-
applyCouponCode(payload: CartMutationApplyCoupon): Promise<Result<
|
|
18
|
-
removeCouponCode(payload: CartMutationRemoveCoupon): Promise<Result<
|
|
19
|
-
changeCurrency(payload: CartMutationChangeCurrency): Promise<Result<
|
|
19
|
+
applyCouponCode(payload: CartMutationApplyCoupon): Promise<Result<CartFactoryCartOutput<TFactory>>>;
|
|
20
|
+
removeCouponCode(payload: CartMutationRemoveCoupon): Promise<Result<CartFactoryCartOutput<TFactory>>>;
|
|
21
|
+
changeCurrency(payload: CartMutationChangeCurrency): Promise<Result<CartFactoryCartOutput<TFactory>>>;
|
|
20
22
|
protected createCart(): Promise<CartIdentifier>;
|
|
21
|
-
protected applyActions(cart: CartIdentifier, actions: MyCartUpdateAction[]): Promise<
|
|
23
|
+
protected applyActions(cart: CartIdentifier, actions: MyCartUpdateAction[]): Promise<CartFactoryCartOutput<TFactory>>;
|
|
22
24
|
/**
|
|
23
25
|
* Creates a new Commercetools client, optionally upgrading it from Anonymous mode to Guest mode.
|
|
24
26
|
* For now, any Query or Mutation will require an upgrade to Guest mode.
|
|
@@ -29,6 +31,4 @@ export declare class CommercetoolsCartProvider extends CartProvider {
|
|
|
29
31
|
activeCart: import("@commercetools/platform-sdk").ByProjectKeyMeActiveCartRequestBuilder;
|
|
30
32
|
orders: import("@commercetools/platform-sdk").ByProjectKeyMeOrdersRequestBuilder;
|
|
31
33
|
}>;
|
|
32
|
-
protected parseCartItem(remoteItem: LineItem): CartItem;
|
|
33
|
-
protected parseSingle(remote: CTCart): Cart;
|
|
34
34
|
}
|
|
@@ -1,26 +1,28 @@
|
|
|
1
|
-
import { CategoryProvider } from '@reactionary/core';
|
|
2
|
-
import type { CategoryQueryById, CategoryQueryBySlug, CategoryQueryForBreadcrumb, CategoryQueryForChildCategories, CategoryQueryForTopCategories, RequestContext, Cache,
|
|
1
|
+
import { type CategoryFactory, type CategoryFactoryCategoryOutput, type CategoryFactoryWithOutput, CategoryProvider } from '@reactionary/core';
|
|
2
|
+
import type { CategoryQueryById, CategoryQueryBySlug, CategoryQueryForBreadcrumb, CategoryQueryForChildCategories, CategoryQueryForTopCategories, RequestContext, Cache, CategoryPaginatedResult, Result, NotFoundError } from '@reactionary/core';
|
|
3
3
|
import type { CommercetoolsConfiguration } from '../schema/configuration.schema.js';
|
|
4
4
|
import type { ByProjectKeyCategoriesRequestBuilder } from '@commercetools/platform-sdk';
|
|
5
5
|
import type { CommercetoolsAPI } from '../core/client.js';
|
|
6
|
-
|
|
6
|
+
import type { CommercetoolsCategoryFactory } from '../factories/category/category.factory.js';
|
|
7
|
+
export declare class CommercetoolsCategoryProvider<TFactory extends CategoryFactory = CommercetoolsCategoryFactory> extends CategoryProvider<CategoryFactoryCategoryOutput<TFactory>, CategoryPaginatedResult> {
|
|
7
8
|
protected config: CommercetoolsConfiguration;
|
|
8
9
|
protected commercetools: CommercetoolsAPI;
|
|
9
|
-
|
|
10
|
+
protected factory: CategoryFactoryWithOutput<TFactory>;
|
|
11
|
+
constructor(config: CommercetoolsConfiguration, cache: Cache, context: RequestContext, commercetools: CommercetoolsAPI, factory: CategoryFactoryWithOutput<TFactory>);
|
|
10
12
|
protected getClient(): Promise<ByProjectKeyCategoriesRequestBuilder>;
|
|
11
13
|
/**
|
|
12
14
|
* Look it up by the category ID (key in commercetools), and if not there, return a placeholder.
|
|
13
15
|
*/
|
|
14
|
-
getById(payload: CategoryQueryById): Promise<Result<
|
|
16
|
+
getById(payload: CategoryQueryById): Promise<Result<CategoryFactoryCategoryOutput<TFactory>, NotFoundError>>;
|
|
15
17
|
/**
|
|
16
18
|
* Resolve the category by slug, in the users current locale.
|
|
17
19
|
*/
|
|
18
|
-
getBySlug(payload: CategoryQueryBySlug): Promise<Result<
|
|
20
|
+
getBySlug(payload: CategoryQueryBySlug): Promise<Result<CategoryFactoryCategoryOutput<TFactory>, NotFoundError>>;
|
|
19
21
|
/**
|
|
20
22
|
* Returns the breadcrumb path to the category, i.e. all parents up to the root.
|
|
21
23
|
* The returned order is from root to leaf.
|
|
22
24
|
*/
|
|
23
|
-
getBreadcrumbPathToCategory(payload: CategoryQueryForBreadcrumb): Promise<Result<
|
|
25
|
+
getBreadcrumbPathToCategory(payload: CategoryQueryForBreadcrumb): Promise<Result<Array<CategoryFactoryCategoryOutput<TFactory>>>>;
|
|
24
26
|
/**
|
|
25
27
|
* Returns a page of child categories for the given parent category ID.
|
|
26
28
|
* You must provide the pagination options to control the size of the result set.
|
|
@@ -28,30 +30,18 @@ export declare class CommercetoolsCategoryProvider extends CategoryProvider {
|
|
|
28
30
|
*
|
|
29
31
|
* This is cached by ID + page number + page size + locale + store
|
|
30
32
|
*/
|
|
31
|
-
findChildCategories(payload: CategoryQueryForChildCategories): Promise<import("@reactionary/core").Ok<{
|
|
33
|
+
findChildCategories(payload: CategoryQueryForChildCategories): Promise<import("@reactionary/core").Ok<ReturnType<TFactory["parseCategoryPaginatedResult"]>> | import("@reactionary/core").Ok<{
|
|
34
|
+
items: never[];
|
|
32
35
|
pageNumber: number;
|
|
33
36
|
pageSize: number;
|
|
34
37
|
totalCount: number;
|
|
35
38
|
totalPages: number;
|
|
36
|
-
items: Category[];
|
|
37
39
|
}>>;
|
|
38
|
-
findTopCategories(payload: CategoryQueryForTopCategories): Promise<import("@reactionary/core").Ok<{
|
|
40
|
+
findTopCategories(payload: CategoryQueryForTopCategories): Promise<import("@reactionary/core").Ok<ReturnType<TFactory["parseCategoryPaginatedResult"]>> | import("@reactionary/core").Ok<{
|
|
41
|
+
items: never[];
|
|
39
42
|
pageNumber: number;
|
|
40
43
|
pageSize: number;
|
|
41
44
|
totalCount: number;
|
|
42
45
|
totalPages: number;
|
|
43
|
-
items: Category[];
|
|
44
46
|
}>>;
|
|
45
|
-
/**
|
|
46
|
-
* Handler for parsing a response from a remote provider and converting it
|
|
47
|
-
* into the typed domain model.
|
|
48
|
-
*/
|
|
49
|
-
protected parseSingle(_body: unknown): Category;
|
|
50
|
-
protected parsePaginatedResult(_body: unknown): {
|
|
51
|
-
pageNumber: number;
|
|
52
|
-
pageSize: number;
|
|
53
|
-
totalCount: number;
|
|
54
|
-
totalPages: number;
|
|
55
|
-
items: Category[];
|
|
56
|
-
};
|
|
57
47
|
}
|
|
@@ -1,32 +1,34 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { MyCartUpdateAction } from '@commercetools/platform-sdk';
|
|
2
|
+
import type { Cache, CheckoutFactory, CheckoutFactoryCheckoutOutput, CheckoutFactoryPaymentMethodOutput, CheckoutFactoryShippingMethodOutput, CheckoutFactoryWithOutput, CheckoutIdentifier, CheckoutMutationAddPaymentInstruction, CheckoutMutationFinalizeCheckout, CheckoutMutationInitiateCheckout, CheckoutMutationRemovePaymentInstruction, CheckoutMutationSetShippingAddress, CheckoutMutationSetShippingInstruction, CheckoutQueryById, CheckoutQueryForAvailablePaymentMethods, CheckoutQueryForAvailableShippingMethods, NotFoundError, PaymentMethod, RequestContext, Result } from '@reactionary/core';
|
|
3
3
|
import { CheckoutProvider } from '@reactionary/core';
|
|
4
4
|
import type { CommercetoolsAPI } from '../core/client.js';
|
|
5
5
|
import type { CommercetoolsConfiguration } from '../schema/configuration.schema.js';
|
|
6
|
+
import type { CommercetoolsCheckoutFactory } from '../factories/checkout/checkout.factory.js';
|
|
6
7
|
export declare class CheckoutNotReadyForFinalizationError extends Error {
|
|
7
8
|
checkoutIdentifier: CheckoutIdentifier;
|
|
8
9
|
constructor(checkoutIdentifier: CheckoutIdentifier);
|
|
9
10
|
}
|
|
10
|
-
export declare class CommercetoolsCheckoutProvider extends CheckoutProvider {
|
|
11
|
+
export declare class CommercetoolsCheckoutProvider<TFactory extends CheckoutFactory = CommercetoolsCheckoutFactory> extends CheckoutProvider<CheckoutFactoryCheckoutOutput<TFactory>, CheckoutFactoryShippingMethodOutput<TFactory>, CheckoutFactoryPaymentMethodOutput<TFactory>> {
|
|
11
12
|
protected config: CommercetoolsConfiguration;
|
|
12
13
|
protected commercetools: CommercetoolsAPI;
|
|
13
|
-
|
|
14
|
+
protected factory: CheckoutFactoryWithOutput<TFactory>;
|
|
15
|
+
constructor(config: CommercetoolsConfiguration, cache: Cache, context: RequestContext, commercetools: CommercetoolsAPI, factory: CheckoutFactoryWithOutput<TFactory>);
|
|
14
16
|
protected getClient(): Promise<{
|
|
15
17
|
payments: import("@commercetools/platform-sdk").ByProjectKeyMePaymentsRequestBuilder;
|
|
16
18
|
carts: import("@commercetools/platform-sdk").ByProjectKeyMeCartsRequestBuilder;
|
|
17
19
|
shippingMethods: import("@commercetools/platform-sdk").ByProjectKeyShippingMethodsRequestBuilder;
|
|
18
20
|
orders: import("@commercetools/platform-sdk").ByProjectKeyMeOrdersRequestBuilder;
|
|
19
21
|
}>;
|
|
20
|
-
initiateCheckoutForCart(payload: CheckoutMutationInitiateCheckout): Promise<Result<
|
|
21
|
-
getById(payload: CheckoutQueryById): Promise<Result<
|
|
22
|
-
setShippingAddress(payload: CheckoutMutationSetShippingAddress): Promise<Result<
|
|
23
|
-
getAvailableShippingMethods(payload: CheckoutQueryForAvailableShippingMethods): Promise<Result<
|
|
24
|
-
getAvailablePaymentMethods(payload: CheckoutQueryForAvailablePaymentMethods): Promise<Result<
|
|
25
|
-
addPaymentInstruction(payload: CheckoutMutationAddPaymentInstruction): Promise<Result<
|
|
26
|
-
removePaymentInstruction(payload: CheckoutMutationRemovePaymentInstruction): Promise<Result<
|
|
27
|
-
setShippingInstruction(payload: CheckoutMutationSetShippingInstruction): Promise<Result<
|
|
28
|
-
finalizeCheckout(payload: CheckoutMutationFinalizeCheckout): Promise<Result<
|
|
29
|
-
protected applyActions(checkout: CheckoutIdentifier, actions: MyCartUpdateAction[]): Promise<
|
|
22
|
+
initiateCheckoutForCart(payload: CheckoutMutationInitiateCheckout): Promise<Result<CheckoutFactoryCheckoutOutput<TFactory>>>;
|
|
23
|
+
getById(payload: CheckoutQueryById): Promise<Result<CheckoutFactoryCheckoutOutput<TFactory>, NotFoundError>>;
|
|
24
|
+
setShippingAddress(payload: CheckoutMutationSetShippingAddress): Promise<Result<CheckoutFactoryCheckoutOutput<TFactory>>>;
|
|
25
|
+
getAvailableShippingMethods(payload: CheckoutQueryForAvailableShippingMethods): Promise<Result<CheckoutFactoryShippingMethodOutput<TFactory>[]>>;
|
|
26
|
+
getAvailablePaymentMethods(payload: CheckoutQueryForAvailablePaymentMethods): Promise<Result<CheckoutFactoryPaymentMethodOutput<TFactory>[]>>;
|
|
27
|
+
addPaymentInstruction(payload: CheckoutMutationAddPaymentInstruction): Promise<Result<CheckoutFactoryCheckoutOutput<TFactory>>>;
|
|
28
|
+
removePaymentInstruction(payload: CheckoutMutationRemovePaymentInstruction): Promise<Result<CheckoutFactoryCheckoutOutput<TFactory>>>;
|
|
29
|
+
setShippingInstruction(payload: CheckoutMutationSetShippingInstruction): Promise<Result<CheckoutFactoryCheckoutOutput<TFactory>>>;
|
|
30
|
+
finalizeCheckout(payload: CheckoutMutationFinalizeCheckout): Promise<Result<CheckoutFactoryCheckoutOutput<TFactory>>>;
|
|
31
|
+
protected applyActions(checkout: CheckoutIdentifier, actions: MyCartUpdateAction[]): Promise<CheckoutFactoryCheckoutOutput<TFactory>>;
|
|
30
32
|
/**
|
|
31
33
|
* Extension point, to allow filtering the options, or adding new ones, like invoicing for b2b.
|
|
32
34
|
*
|
|
@@ -34,22 +36,4 @@ export declare class CommercetoolsCheckoutProvider extends CheckoutProvider {
|
|
|
34
36
|
* @returns
|
|
35
37
|
*/
|
|
36
38
|
protected getStaticPaymentMethods(_checkout: CheckoutIdentifier): PaymentMethod[];
|
|
37
|
-
protected parseCheckoutItem(remoteItem: LineItem): CheckoutItem;
|
|
38
|
-
protected parseSingle(remote: CTCart): Checkout;
|
|
39
|
-
protected isReadyForFinalization(price: CostBreakDown, paymentInstructions: Array<PaymentInstruction>, billingAddress?: Address, shippingAddress?: Address, shippingInstruction?: ShippingInstruction): boolean;
|
|
40
|
-
protected parsePaymentInstruction(remote: CTPayment): PaymentInstruction;
|
|
41
|
-
protected parseAddress(remote: CTAddress): {
|
|
42
|
-
countryCode: string;
|
|
43
|
-
firstName: string;
|
|
44
|
-
lastName: string;
|
|
45
|
-
streetAddress: string;
|
|
46
|
-
streetNumber: string;
|
|
47
|
-
postalCode: string;
|
|
48
|
-
city: string;
|
|
49
|
-
identifier: {
|
|
50
|
-
nickName: string;
|
|
51
|
-
};
|
|
52
|
-
region: string;
|
|
53
|
-
};
|
|
54
|
-
protected parseShippingInstruction(remote: CTCart): ShippingInstruction | undefined;
|
|
55
39
|
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type IdentityFactory, type IdentityFactoryOutput, type IdentityFactoryWithOutput, type IdentityMutationLogin, type IdentityQuerySelf, type RequestContext, type Cache, IdentityProvider, type IdentityMutationRegister, type Result } from '@reactionary/core';
|
|
2
2
|
import type { CommercetoolsConfiguration } from '../schema/configuration.schema.js';
|
|
3
3
|
import type { CommercetoolsAPI } from '../core/client.js';
|
|
4
|
-
|
|
4
|
+
import type { CommercetoolsIdentityFactory } from '../factories/identity/identity.factory.js';
|
|
5
|
+
export declare class CommercetoolsIdentityProvider<TFactory extends IdentityFactory = CommercetoolsIdentityFactory> extends IdentityProvider<IdentityFactoryOutput<TFactory>> {
|
|
5
6
|
protected config: CommercetoolsConfiguration;
|
|
6
7
|
protected commercetools: CommercetoolsAPI;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
protected factory: IdentityFactoryWithOutput<TFactory>;
|
|
9
|
+
constructor(config: CommercetoolsConfiguration, cache: Cache, context: RequestContext, commercetools: CommercetoolsAPI, factory: IdentityFactoryWithOutput<TFactory>);
|
|
10
|
+
getSelf(payload: IdentityQuerySelf): Promise<Result<IdentityFactoryOutput<TFactory>>>;
|
|
11
|
+
login(payload: IdentityMutationLogin): Promise<Result<IdentityFactoryOutput<TFactory>>>;
|
|
12
|
+
logout(payload: Record<string, never>): Promise<Result<IdentityFactoryOutput<TFactory>>>;
|
|
13
|
+
register(payload: IdentityMutationRegister): Promise<Result<IdentityFactoryOutput<TFactory>>>;
|
|
12
14
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { InventoryFactory, InventoryFactoryOutput, InventoryFactoryWithOutput, RequestContext, Cache, InventoryQueryBySKU, Result, NotFoundError } from '@reactionary/core';
|
|
2
2
|
import { InventoryProvider } from '@reactionary/core';
|
|
3
3
|
import type { CommercetoolsConfiguration } from '../schema/configuration.schema.js';
|
|
4
|
-
import type { InventoryEntry } from '@commercetools/platform-sdk';
|
|
5
4
|
import type { CommercetoolsAPI } from '../core/client.js';
|
|
6
|
-
|
|
5
|
+
import type { CommercetoolsInventoryFactory } from '../factories/inventory/inventory.factory.js';
|
|
6
|
+
export declare class CommercetoolsInventoryProvider<TFactory extends InventoryFactory = CommercetoolsInventoryFactory> extends InventoryProvider<InventoryFactoryOutput<TFactory>> {
|
|
7
7
|
protected config: CommercetoolsConfiguration;
|
|
8
8
|
protected commercetools: CommercetoolsAPI;
|
|
9
|
-
|
|
9
|
+
protected factory: InventoryFactoryWithOutput<TFactory>;
|
|
10
|
+
constructor(config: CommercetoolsConfiguration, cache: Cache, context: RequestContext, commercetools: CommercetoolsAPI, factory: InventoryFactoryWithOutput<TFactory>);
|
|
10
11
|
protected getClient(): Promise<import("@commercetools/platform-sdk").ByProjectKeyRequestBuilder>;
|
|
11
|
-
getBySKU(payload: InventoryQueryBySKU): Promise<Result<
|
|
12
|
-
protected parseSingle(body: InventoryEntry): Inventory;
|
|
12
|
+
getBySKU(payload: InventoryQueryBySKU): Promise<Result<InventoryFactoryOutput<TFactory>, NotFoundError>>;
|
|
13
13
|
}
|
|
@@ -1,71 +1,13 @@
|
|
|
1
|
-
import type { RequestContext, Cache,
|
|
2
|
-
import { OrderSearchProvider
|
|
1
|
+
import type { RequestContext, Cache, OrderSearchFactory, OrderSearchFactoryOutput, OrderSearchFactoryWithOutput, OrderSearchQueryByTerm, Result } from '@reactionary/core';
|
|
2
|
+
import { OrderSearchProvider } from '@reactionary/core';
|
|
3
3
|
import type { CommercetoolsConfiguration } from '../schema/configuration.schema.js';
|
|
4
4
|
import type { CommercetoolsAPI } from '../core/client.js';
|
|
5
|
-
import type {
|
|
6
|
-
export declare class CommercetoolsOrderSearchProvider extends OrderSearchProvider {
|
|
5
|
+
import type { CommercetoolsOrderSearchFactory } from '../factories/order-search/order-search.factory.js';
|
|
6
|
+
export declare class CommercetoolsOrderSearchProvider<TFactory extends OrderSearchFactory = CommercetoolsOrderSearchFactory> extends OrderSearchProvider<OrderSearchFactoryOutput<TFactory>> {
|
|
7
7
|
protected config: CommercetoolsConfiguration;
|
|
8
8
|
protected commercetools: CommercetoolsAPI;
|
|
9
|
-
|
|
9
|
+
protected factory: OrderSearchFactoryWithOutput<TFactory>;
|
|
10
|
+
constructor(config: CommercetoolsConfiguration, cache: Cache, context: RequestContext, commercetools: CommercetoolsAPI, factory: OrderSearchFactoryWithOutput<TFactory>);
|
|
10
11
|
protected getClient(): Promise<import("@commercetools/platform-sdk").ByProjectKeyMeOrdersRequestBuilder>;
|
|
11
|
-
queryByTerm(payload: OrderSearchQueryByTerm): Promise<Result<
|
|
12
|
-
protected parseAddress(remote: CTAddress): {
|
|
13
|
-
countryCode: string;
|
|
14
|
-
firstName: string;
|
|
15
|
-
lastName: string;
|
|
16
|
-
streetAddress: string;
|
|
17
|
-
streetNumber: string;
|
|
18
|
-
postalCode: string;
|
|
19
|
-
city: string;
|
|
20
|
-
identifier: {
|
|
21
|
-
nickName: string;
|
|
22
|
-
};
|
|
23
|
-
region: string;
|
|
24
|
-
};
|
|
25
|
-
protected parseSingle(body: CTOrder): {
|
|
26
|
-
identifier: {
|
|
27
|
-
key: string;
|
|
28
|
-
};
|
|
29
|
-
userId: IdentityIdentifier;
|
|
30
|
-
customerName: string;
|
|
31
|
-
shippingAddress: {
|
|
32
|
-
countryCode: string;
|
|
33
|
-
firstName: string;
|
|
34
|
-
lastName: string;
|
|
35
|
-
streetAddress: string;
|
|
36
|
-
streetNumber: string;
|
|
37
|
-
postalCode: string;
|
|
38
|
-
city: string;
|
|
39
|
-
identifier: {
|
|
40
|
-
nickName: string;
|
|
41
|
-
};
|
|
42
|
-
region: string;
|
|
43
|
-
};
|
|
44
|
-
orderDate: string;
|
|
45
|
-
orderStatus: "AwaitingPayment" | "ReleasedToFulfillment" | "Shipped";
|
|
46
|
-
inventoryStatus: "NotAllocated" | "Allocated";
|
|
47
|
-
totalAmount: MonetaryAmount;
|
|
48
|
-
};
|
|
49
|
-
protected parsePaginatedResult(body: OrderPagedQueryResponse, query: OrderSearchQueryByTerm): {
|
|
50
|
-
identifier: {
|
|
51
|
-
term: string;
|
|
52
|
-
filters: string[];
|
|
53
|
-
paginationOptions: {
|
|
54
|
-
pageNumber: number;
|
|
55
|
-
pageSize: number;
|
|
56
|
-
};
|
|
57
|
-
partNumber?: string[] | undefined;
|
|
58
|
-
orderStatus?: ("AwaitingPayment" | "ReleasedToFulfillment" | "Shipped" | "Cancelled")[] | undefined;
|
|
59
|
-
user?: {
|
|
60
|
-
userId: string;
|
|
61
|
-
} | undefined;
|
|
62
|
-
startDate?: string | undefined;
|
|
63
|
-
endDate?: string | undefined;
|
|
64
|
-
};
|
|
65
|
-
pageNumber: number;
|
|
66
|
-
pageSize: number;
|
|
67
|
-
totalCount: number;
|
|
68
|
-
totalPages: number;
|
|
69
|
-
items: OrderSearchResultItem[];
|
|
70
|
-
};
|
|
12
|
+
queryByTerm(payload: OrderSearchQueryByTerm): Promise<Result<OrderSearchFactoryOutput<TFactory>>>;
|
|
71
13
|
}
|