@ikas/storefront-api 4.0.0-alpha.42 → 4.0.0-alpha.44

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 (45) hide show
  1. package/package.json +5 -5
  2. package/src/__api/models/CartV2.ts +5 -0
  3. package/src/__api/models/CategoryFilterInput.ts +2 -0
  4. package/src/__api/models/LocationTranslations.ts +2 -0
  5. package/src/__api/models/OrderLineBaseUnit.ts +19 -0
  6. package/src/__api/models/OrderLineItem.ts +10 -0
  7. package/src/__api/models/OrderLineVariant.ts +8 -0
  8. package/src/__api/models/OrderLineVariantPrice.ts +5 -0
  9. package/src/__api/models/OrderLineVariantUnit.ts +16 -0
  10. package/src/__api/models/OrderLineVariantUnitType.ts +16 -0
  11. package/src/__api/models/OrderSessionInfo.ts +49 -0
  12. package/src/__api/models/OrderSessionInfoTrafficSource.ts +18 -0
  13. package/src/__api/models/OrderSessionUTM.ts +21 -0
  14. package/src/__api/models/OrderSessionUserAgent.ts +18 -0
  15. package/src/__api/models/Product.ts +5 -0
  16. package/src/__api/models/ProductBaseUnitModel.ts +21 -0
  17. package/src/__api/models/RaffleParticipants.ts +2 -4
  18. package/src/__api/models/SearchProduct.ts +5 -0
  19. package/src/__api/models/SearchProductPrice.ts +5 -0
  20. package/src/__api/models/SearchVariant.ts +3 -0
  21. package/src/__api/models/StorefrontRouting.ts +4 -0
  22. package/src/__api/models/Variant.ts +3 -0
  23. package/src/__api/models/VariantUnitModel.ts +17 -0
  24. package/src/__api/mutations/addCouponCodeToCheckout.ts +10 -1
  25. package/src/__api/mutations/addItemToCart.ts +31 -1
  26. package/src/__api/mutations/createOrderRefundRequest.ts +10 -1
  27. package/src/__api/mutations/saveCart.ts +31 -1
  28. package/src/__api/mutations/saveCartCouponCode.ts +31 -1
  29. package/src/__api/mutations/saveCheckout.ts +10 -1
  30. package/src/__api/mutations/saveItemToCart.ts +10 -1
  31. package/src/__api/mutations/updateCartCampaignOffer.ts +31 -1
  32. package/src/__api/queries/getCart.ts +10 -1
  33. package/src/__api/queries/getCartById.ts +31 -1
  34. package/src/__api/queries/getCheckoutByCartId.ts +10 -1
  35. package/src/__api/queries/getCheckoutById.ts +10 -1
  36. package/src/__api/queries/getCustomerOrders.ts +10 -1
  37. package/src/__api/queries/getOrder.ts +10 -1
  38. package/src/__api/queries/getOrderByEmail.ts +10 -1
  39. package/src/__api/queries/getStorefront.ts +3 -1
  40. package/src/__api/queries/listCountry.ts +5 -1
  41. package/src/__api/queries/listProduct.ts +6 -1
  42. package/src/__api/queries/searchProducts.ts +7 -1
  43. package/src/__api/types/index.ts +130 -1
  44. package/src/api/location/index.ts +13 -4
  45. package/src/api/product/index.ts +4 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront-api",
3
- "version": "4.0.0-alpha.42",
3
+ "version": "4.0.0-alpha.44",
4
4
  "author": "Umut Ozan Yıldırım",
5
5
  "license": "ISC",
6
6
  "description": "API functions that returns models from the ikas-storefront-models package.",
@@ -21,8 +21,8 @@
21
21
  },
22
22
  "devDependencies": {
23
23
  "@rollup/plugin-commonjs": "^22.0.0",
24
- "@ikas/storefront-config": "^4.0.0-alpha.42",
25
- "@ikas/storefront-models": "^4.0.0-alpha.42",
24
+ "@ikas/storefront-config": "^4.0.0-alpha.44",
25
+ "@ikas/storefront-models": "^4.0.0-alpha.44",
26
26
  "@rollup/plugin-node-resolve": "^13.3.0",
27
27
  "prettier": "^2.2.1",
28
28
  "rollup": "^2.75.6",
@@ -35,8 +35,8 @@
35
35
  "axios": "^0.26.0"
36
36
  },
37
37
  "peerDependencies": {
38
- "@ikas/storefront-config": "^4.0.0-alpha.42",
39
- "@ikas/storefront-models": "^4.0.0-alpha.42",
38
+ "@ikas/storefront-config": "^4.0.0-alpha.44",
39
+ "@ikas/storefront-models": "^4.0.0-alpha.44",
40
40
  "axios": "^0.26.0"
41
41
  }
42
42
  }
@@ -17,6 +17,7 @@ import { OrderCustomerData } from "./OrderCustomer";
17
17
  import { OrderGiftPackageLineData } from "./OrderGiftPackageLine";
18
18
  import { OrderAdjustmentData } from "./OrderAdjustment";
19
19
  import { OrderLineItemData } from "./OrderLineItem";
20
+ import { OrderSessionInfoData } from "./OrderSessionInfo";
20
21
  import { OrderShippingLineData } from "./OrderShippingLine";
21
22
  import { OrderStorefrontRoutingData } from "./OrderStorefrontRouting";
22
23
  import { OrderTaxLineData } from "./OrderTaxLine";
@@ -54,6 +55,7 @@ export class CartV2Data extends BaseModelData {
54
55
  recoverEmailStatus: CheckoutRecoveryEmailStatusEnum | null;
55
56
  recoveryStatus: CheckoutRecoveryStatusEnum | null;
56
57
  salesChannelId: string;
58
+ sessionInfo: OrderSessionInfoData | null;
57
59
  shippingAddress: OrderAddressData | null;
58
60
  shippingLines: OrderShippingLineData[] | null;
59
61
  shippingMethod: ShippingMethodEnum;
@@ -129,6 +131,9 @@ export class CartV2Data extends BaseModelData {
129
131
  this.recoverEmailStatus = data.recoverEmailStatus || null;
130
132
  this.recoveryStatus = data.recoveryStatus || null;
131
133
  this.salesChannelId = data.salesChannelId || "";
134
+ this.sessionInfo = data.sessionInfo
135
+ ? new OrderSessionInfoData(data.sessionInfo)
136
+ : null;
132
137
  this.shippingAddress = data.shippingAddress
133
138
  ? new OrderAddressData(data.shippingAddress)
134
139
  : null;
@@ -3,10 +3,12 @@ import { DeepReadonly } from "ts-essentials";
3
3
  export class CategoryFilterInputData {
4
4
  eq: string | null;
5
5
  in: string[] | null;
6
+ nin: string[] | null;
6
7
 
7
8
  constructor(data: Partial<CategoryFilterInputData> = {}) {
8
9
  this.eq = data.eq || null;
9
10
  this.in = data.in || null;
11
+ this.nin = data.nin || null;
10
12
  }
11
13
  }
12
14
 
@@ -1,10 +1,12 @@
1
1
  import { DeepReadonly } from "ts-essentials";
2
2
 
3
3
  export class LocationTranslationsData {
4
+ de: string | null;
4
5
  en: string;
5
6
  tr: string;
6
7
 
7
8
  constructor(data: Partial<LocationTranslationsData> = {}) {
9
+ this.de = data.de || null;
8
10
  this.en = data.en || "";
9
11
  this.tr = data.tr || "";
10
12
  }
@@ -0,0 +1,19 @@
1
+ import { DeepReadonly } from "ts-essentials";
2
+ import { ProductUnitTypeEnum } from "../types";
3
+ import { OrderLineVariantUnitTypeData } from "./OrderLineVariantUnitType";
4
+
5
+ export class OrderLineBaseUnitData {
6
+ baseAmount: number;
7
+ type: ProductUnitTypeEnum;
8
+ unit: OrderLineVariantUnitTypeData | null;
9
+
10
+ constructor(data: Partial<OrderLineBaseUnitData> = {}) {
11
+ this.baseAmount = data.baseAmount || 0;
12
+ this.type = data.type || ProductUnitTypeEnum.CENTILITER;
13
+ this.unit = data.unit ? new OrderLineVariantUnitTypeData(data.unit) : null;
14
+ }
15
+ }
16
+
17
+ export class OrderLineBaseUnit extends OrderLineBaseUnitData {}
18
+ export type PartialOrderLineBaseUnit = Partial<OrderLineBaseUnit>;
19
+ export type ReadOnlyOrderLineBaseUnit = DeepReadonly<OrderLineBaseUnit>;
@@ -11,6 +11,7 @@ export class OrderLineItemData extends BaseModelData {
11
11
  discount: OrderLineDiscountData | null;
12
12
  discountPrice: number | null;
13
13
  finalPrice: number | null;
14
+ finalUnitPrice: number | null;
14
15
  options: OrderLineOptionData[] | null;
15
16
  originalOrderLineItemId: string | null;
16
17
  price: number;
@@ -19,6 +20,7 @@ export class OrderLineItemData extends BaseModelData {
19
20
  statusUpdatedAt: any | null;
20
21
  stockLocationId: string | null;
21
22
  taxValue: number | null;
23
+ unitPrice: number | null;
22
24
  variant: OrderLineVariantData;
23
25
 
24
26
  constructor(data: Partial<OrderLineItemData> = {}) {
@@ -37,6 +39,10 @@ export class OrderLineItemData extends BaseModelData {
37
39
  data.finalPrice !== undefined && data.finalPrice !== null
38
40
  ? data.finalPrice
39
41
  : null;
42
+ this.finalUnitPrice =
43
+ data.finalUnitPrice !== undefined && data.finalUnitPrice !== null
44
+ ? data.finalUnitPrice
45
+ : null;
40
46
  this.options = data.options
41
47
  ? data.options.map((o) => new OrderLineOptionData(o))
42
48
  : null;
@@ -50,6 +56,10 @@ export class OrderLineItemData extends BaseModelData {
50
56
  data.taxValue !== undefined && data.taxValue !== null
51
57
  ? data.taxValue
52
58
  : null;
59
+ this.unitPrice =
60
+ data.unitPrice !== undefined && data.unitPrice !== null
61
+ ? data.unitPrice
62
+ : null;
53
63
  this.variant = data.variant
54
64
  ? new OrderLineVariantData(data.variant)
55
65
  : new OrderLineVariantData();
@@ -1,11 +1,14 @@
1
1
  import { DeepReadonly } from "ts-essentials";
2
+ import { OrderLineBaseUnitData } from "./OrderLineBaseUnit";
2
3
  import { OrderLineVariantBrandData } from "./OrderLineVariantBrand";
3
4
  import { OrderLineVariantCategoryData } from "./OrderLineVariantCategory";
4
5
  import { OrderLineVariantPriceData } from "./OrderLineVariantPrice";
6
+ import { OrderLineVariantUnitData } from "./OrderLineVariantUnit";
5
7
  import { OrderLineVariantVariantValuesData } from "./OrderLineVariantVariantValues";
6
8
 
7
9
  export class OrderLineVariantData {
8
10
  barcodeList: string[] | null;
11
+ baseUnit: OrderLineBaseUnitData | null;
9
12
  brand: OrderLineVariantBrandData | null;
10
13
  categories: OrderLineVariantCategoryData[] | null;
11
14
  id: string | null;
@@ -18,11 +21,15 @@ export class OrderLineVariantData {
18
21
  tagIds: string[] | null;
19
22
  taxValue: number | null;
20
23
  type: number | null;
24
+ unit: OrderLineVariantUnitData | null;
21
25
  variantValues: OrderLineVariantVariantValuesData[] | null;
22
26
  weight: number | null;
23
27
 
24
28
  constructor(data: Partial<OrderLineVariantData> = {}) {
25
29
  this.barcodeList = data.barcodeList || null;
30
+ this.baseUnit = data.baseUnit
31
+ ? new OrderLineBaseUnitData(data.baseUnit)
32
+ : null;
26
33
  this.brand = data.brand ? new OrderLineVariantBrandData(data.brand) : null;
27
34
  this.categories = data.categories
28
35
  ? data.categories.map((o) => new OrderLineVariantCategoryData(o))
@@ -43,6 +50,7 @@ export class OrderLineVariantData {
43
50
  : null;
44
51
  this.type =
45
52
  data.type !== undefined && data.type !== null ? data.type : null;
53
+ this.unit = data.unit ? new OrderLineVariantUnitData(data.unit) : null;
46
54
  this.variantValues = data.variantValues
47
55
  ? data.variantValues.map((o) => new OrderLineVariantVariantValuesData(o))
48
56
  : null;
@@ -7,6 +7,7 @@ export class OrderLineVariantPriceData {
7
7
  discountPrice: number | null;
8
8
  priceListId: string | null;
9
9
  sellPrice: number;
10
+ unitPrice: number | null;
10
11
 
11
12
  constructor(data: Partial<OrderLineVariantPriceData> = {}) {
12
13
  this.buyPrice =
@@ -21,6 +22,10 @@ export class OrderLineVariantPriceData {
21
22
  : null;
22
23
  this.priceListId = data.priceListId || null;
23
24
  this.sellPrice = data.sellPrice || 0;
25
+ this.unitPrice =
26
+ data.unitPrice !== undefined && data.unitPrice !== null
27
+ ? data.unitPrice
28
+ : null;
24
29
  }
25
30
  }
26
31
 
@@ -0,0 +1,16 @@
1
+ import { DeepReadonly } from "ts-essentials";
2
+ import { ProductUnitTypeEnum } from "../types";
3
+
4
+ export class OrderLineVariantUnitData {
5
+ amount: number;
6
+ type: ProductUnitTypeEnum;
7
+
8
+ constructor(data: Partial<OrderLineVariantUnitData> = {}) {
9
+ this.amount = data.amount || 0;
10
+ this.type = data.type || ProductUnitTypeEnum.CENTILITER;
11
+ }
12
+ }
13
+
14
+ export class OrderLineVariantUnit extends OrderLineVariantUnitData {}
15
+ export type PartialOrderLineVariantUnit = Partial<OrderLineVariantUnit>;
16
+ export type ReadOnlyOrderLineVariantUnit = DeepReadonly<OrderLineVariantUnit>;
@@ -0,0 +1,16 @@
1
+ import { DeepReadonly } from "ts-essentials";
2
+
3
+ export class OrderLineVariantUnitTypeData {
4
+ id: string;
5
+ name: string;
6
+
7
+ constructor(data: Partial<OrderLineVariantUnitTypeData> = {}) {
8
+ this.id = data.id || "";
9
+ this.name = data.name || "";
10
+ }
11
+ }
12
+
13
+ export class OrderLineVariantUnitType extends OrderLineVariantUnitTypeData {}
14
+ export type PartialOrderLineVariantUnitType = Partial<OrderLineVariantUnitType>;
15
+ export type ReadOnlyOrderLineVariantUnitType =
16
+ DeepReadonly<OrderLineVariantUnitType>;
@@ -0,0 +1,49 @@
1
+ import { DeepReadonly } from "ts-essentials";
2
+ import { OrderSessionInfoTrafficSourceData } from "./OrderSessionInfoTrafficSource";
3
+ import { OrderSessionUserAgentData } from "./OrderSessionUserAgent";
4
+ import { OrderSessionUTMData } from "./OrderSessionUTM";
5
+
6
+ export class OrderSessionInfoData {
7
+ countryCode: string | null;
8
+ durationMS: number | null;
9
+ end: any | null;
10
+ host: string | null;
11
+ ip: string | null;
12
+ referer: string | null;
13
+ salesChannelId: string | null;
14
+ sessionId: string | null;
15
+ start: any | null;
16
+ storefrontId: string | null;
17
+ trafficSource: OrderSessionInfoTrafficSourceData | null;
18
+ userAgent: OrderSessionUserAgentData | null;
19
+ utm: OrderSessionUTMData | null;
20
+ visitorId: string | null;
21
+
22
+ constructor(data: Partial<OrderSessionInfoData> = {}) {
23
+ this.countryCode = data.countryCode || null;
24
+ this.durationMS =
25
+ data.durationMS !== undefined && data.durationMS !== null
26
+ ? data.durationMS
27
+ : null;
28
+ this.end = data.end || null;
29
+ this.host = data.host || null;
30
+ this.ip = data.ip || null;
31
+ this.referer = data.referer || null;
32
+ this.salesChannelId = data.salesChannelId || null;
33
+ this.sessionId = data.sessionId || null;
34
+ this.start = data.start || null;
35
+ this.storefrontId = data.storefrontId || null;
36
+ this.trafficSource = data.trafficSource
37
+ ? new OrderSessionInfoTrafficSourceData(data.trafficSource)
38
+ : null;
39
+ this.userAgent = data.userAgent
40
+ ? new OrderSessionUserAgentData(data.userAgent)
41
+ : null;
42
+ this.utm = data.utm ? new OrderSessionUTMData(data.utm) : null;
43
+ this.visitorId = data.visitorId || null;
44
+ }
45
+ }
46
+
47
+ export class OrderSessionInfo extends OrderSessionInfoData {}
48
+ export type PartialOrderSessionInfo = Partial<OrderSessionInfo>;
49
+ export type ReadOnlyOrderSessionInfo = DeepReadonly<OrderSessionInfo>;
@@ -0,0 +1,18 @@
1
+ import { DeepReadonly } from "ts-essentials";
2
+ import { SFAnalyticsTrafficSourceEnum } from "../types";
3
+
4
+ export class OrderSessionInfoTrafficSourceData {
5
+ source: string | null;
6
+ type: SFAnalyticsTrafficSourceEnum;
7
+
8
+ constructor(data: Partial<OrderSessionInfoTrafficSourceData> = {}) {
9
+ this.source = data.source || null;
10
+ this.type = data.type || SFAnalyticsTrafficSourceEnum.ADS_OTHER;
11
+ }
12
+ }
13
+
14
+ export class OrderSessionInfoTrafficSource extends OrderSessionInfoTrafficSourceData {}
15
+ export type PartialOrderSessionInfoTrafficSource =
16
+ Partial<OrderSessionInfoTrafficSource>;
17
+ export type ReadOnlyOrderSessionInfoTrafficSource =
18
+ DeepReadonly<OrderSessionInfoTrafficSource>;
@@ -0,0 +1,21 @@
1
+ import { DeepReadonly } from "ts-essentials";
2
+
3
+ export class OrderSessionUTMData {
4
+ campaign: string | null;
5
+ content: string | null;
6
+ medium: string | null;
7
+ source: string | null;
8
+ term: string | null;
9
+
10
+ constructor(data: Partial<OrderSessionUTMData> = {}) {
11
+ this.campaign = data.campaign || null;
12
+ this.content = data.content || null;
13
+ this.medium = data.medium || null;
14
+ this.source = data.source || null;
15
+ this.term = data.term || null;
16
+ }
17
+ }
18
+
19
+ export class OrderSessionUTM extends OrderSessionUTMData {}
20
+ export type PartialOrderSessionUTM = Partial<OrderSessionUTM>;
21
+ export type ReadOnlyOrderSessionUTM = DeepReadonly<OrderSessionUTM>;
@@ -0,0 +1,18 @@
1
+ import { DeepReadonly } from "ts-essentials";
2
+ import { UserAgentDeviceType } from "../types";
3
+
4
+ export class OrderSessionUserAgentData {
5
+ deviceType: UserAgentDeviceType;
6
+ name: string;
7
+ os: string;
8
+
9
+ constructor(data: Partial<OrderSessionUserAgentData> = {}) {
10
+ this.deviceType = data.deviceType || UserAgentDeviceType.CAMERA;
11
+ this.name = data.name || "";
12
+ this.os = data.os || "";
13
+ }
14
+ }
15
+
16
+ export class OrderSessionUserAgent extends OrderSessionUserAgentData {}
17
+ export type PartialOrderSessionUserAgent = Partial<OrderSessionUserAgent>;
18
+ export type ReadOnlyOrderSessionUserAgent = DeepReadonly<OrderSessionUserAgent>;
@@ -2,6 +2,7 @@ import { DeepReadonly } from "ts-essentials";
2
2
  import BaseModelData from "./_base";
3
3
  import { ProductTypeEnum } from "../types";
4
4
  import { ProductAttributeValueData } from "./ProductAttributeValue";
5
+ import { ProductBaseUnitModelData } from "./ProductBaseUnitModel";
5
6
  import { HTMLMetaDataData } from "./HTMLMetaData";
6
7
  import { ProductVariantTypeData } from "./ProductVariantType";
7
8
  import { ProductTranslationData } from "./ProductTranslation";
@@ -9,6 +10,7 @@ import { VariantData } from "./Variant";
9
10
 
10
11
  export class ProductData extends BaseModelData {
11
12
  attributes: ProductAttributeValueData[] | null;
13
+ baseUnit: ProductBaseUnitModelData | null;
12
14
  brandId: string | null;
13
15
  categoryIds: string[] | null;
14
16
  description: string | null;
@@ -33,6 +35,9 @@ export class ProductData extends BaseModelData {
33
35
  this.attributes = data.attributes
34
36
  ? data.attributes.map((p) => new ProductAttributeValueData(p))
35
37
  : null;
38
+ this.baseUnit = data.baseUnit
39
+ ? new ProductBaseUnitModelData(data.baseUnit)
40
+ : null;
36
41
  this.brandId = data.brandId || null;
37
42
  this.categoryIds = data.categoryIds || null;
38
43
  this.description = data.description || null;
@@ -0,0 +1,21 @@
1
+ import { DeepReadonly } from "ts-essentials";
2
+ import { ProductUnitTypeEnum } from "../types";
3
+
4
+ export class ProductBaseUnitModelData {
5
+ baseAmount: number | null;
6
+ type: ProductUnitTypeEnum;
7
+ unitId: string | null;
8
+
9
+ constructor(data: Partial<ProductBaseUnitModelData> = {}) {
10
+ this.baseAmount =
11
+ data.baseAmount !== undefined && data.baseAmount !== null
12
+ ? data.baseAmount
13
+ : null;
14
+ this.type = data.type || ProductUnitTypeEnum.CENTILITER;
15
+ this.unitId = data.unitId || null;
16
+ }
17
+ }
18
+
19
+ export class ProductBaseUnitModel extends ProductBaseUnitModelData {}
20
+ export type PartialProductBaseUnitModel = Partial<ProductBaseUnitModel>;
21
+ export type ReadOnlyProductBaseUnitModel = DeepReadonly<ProductBaseUnitModel>;
@@ -15,7 +15,7 @@ export class RaffleParticipantsData extends BaseModelData {
15
15
  isDeliveredCargo: boolean | null;
16
16
  lastName: string;
17
17
  phone: string | null;
18
- raffle: StorefrontRaffleData;
18
+ raffle: StorefrontRaffleData | null;
19
19
  raffleId: string;
20
20
  status: RaffleParticipantStatusEnum | null;
21
21
 
@@ -37,9 +37,7 @@ export class RaffleParticipantsData extends BaseModelData {
37
37
  : null;
38
38
  this.lastName = data.lastName || "";
39
39
  this.phone = data.phone || null;
40
- this.raffle = data.raffle
41
- ? new StorefrontRaffleData(data.raffle)
42
- : new StorefrontRaffleData();
40
+ this.raffle = data.raffle ? new StorefrontRaffleData(data.raffle) : null;
43
41
  this.raffleId = data.raffleId || "";
44
42
  this.status = data.status || null;
45
43
  }
@@ -3,6 +3,7 @@ import { SearchProductAttributeValueData } from "./SearchProductAttributeValue";
3
3
  import { SearchProductBrandData } from "./SearchProductBrand";
4
4
  import { SearchCategoryData } from "./SearchCategory";
5
5
  import { SearchHTMLMetaDataData } from "./SearchHTMLMetaData";
6
+ import { ProductBaseUnitModelData } from "./ProductBaseUnitModel";
6
7
  import { SearchProductVariantTypeData } from "./SearchProductVariantType";
7
8
  import { SearchProductTagData } from "./SearchProductTag";
8
9
  import { ProductTranslationData } from "./ProductTranslation";
@@ -19,6 +20,7 @@ export class SearchProductData {
19
20
  metaData: SearchHTMLMetaDataData | null;
20
21
  name: string;
21
22
  productOptionSetId: string | null;
23
+ productUnit: ProductBaseUnitModelData | null;
22
24
  productVariantTypes: SearchProductVariantTypeData[];
23
25
  salesChannelIds: string[] | null;
24
26
  shortDescription: string | null;
@@ -47,6 +49,9 @@ export class SearchProductData {
47
49
  : null;
48
50
  this.name = data.name || "";
49
51
  this.productOptionSetId = data.productOptionSetId || null;
52
+ this.productUnit = data.productUnit
53
+ ? new ProductBaseUnitModelData(data.productUnit)
54
+ : null;
50
55
  this.productVariantTypes = data.productVariantTypes
51
56
  ? data.productVariantTypes.map((s) => new SearchProductVariantTypeData(s))
52
57
  : [];
@@ -8,6 +8,7 @@ export class SearchProductPriceData {
8
8
  discountPrice: number | null;
9
9
  priceListId: string | null;
10
10
  sellPrice: number;
11
+ unitPrice: number | null;
11
12
 
12
13
  constructor(data: Partial<SearchProductPriceData> = {}) {
13
14
  this.buyPrice =
@@ -23,6 +24,10 @@ export class SearchProductPriceData {
23
24
  : null;
24
25
  this.priceListId = data.priceListId || null;
25
26
  this.sellPrice = data.sellPrice || 0;
27
+ this.unitPrice =
28
+ data.unitPrice !== undefined && data.unitPrice !== null
29
+ ? data.unitPrice
30
+ : null;
26
31
  }
27
32
  }
28
33
 
@@ -3,6 +3,7 @@ import { SearchProductAttributeValueData } from "./SearchProductAttributeValue";
3
3
  import { SearchProductImageData } from "./SearchProductImage";
4
4
  import { SearchProductPriceData } from "./SearchProductPrice";
5
5
  import { SearchProductStockLocationData } from "./SearchProductStockLocation";
6
+ import { VariantUnitModelData } from "./VariantUnitModel";
6
7
  import { SearchVariationValueRelationData } from "./SearchVariationValueRelation";
7
8
 
8
9
  export class SearchVariantData {
@@ -16,6 +17,7 @@ export class SearchVariantData {
16
17
  sellIfOutOfStock: boolean | null;
17
18
  sku: string | null;
18
19
  stocks: SearchProductStockLocationData[] | null;
20
+ unit: VariantUnitModelData | null;
19
21
  variantValues: SearchVariationValueRelationData[] | null;
20
22
  weight: number | null;
21
23
 
@@ -45,6 +47,7 @@ export class SearchVariantData {
45
47
  this.stocks = data.stocks
46
48
  ? data.stocks.map((s) => new SearchProductStockLocationData(s))
47
49
  : null;
50
+ this.unit = data.unit ? new VariantUnitModelData(data.unit) : null;
48
51
  this.variantValues = data.variantValues
49
52
  ? data.variantValues.map((s) => new SearchVariationValueRelationData(s))
50
53
  : null;
@@ -4,6 +4,8 @@ import { StorefrontDynamicCurrencySettingsData } from "./StorefrontDynamicCurren
4
4
 
5
5
  export class StorefrontRoutingData extends BaseModelData {
6
6
  countryCodes: string[] | null;
7
+ currencyCode: string | null;
8
+ currencySymbol: string | null;
7
9
  domain: string | null;
8
10
  dynamicCurrencySettings: StorefrontDynamicCurrencySettingsData | null;
9
11
  locale: string;
@@ -14,6 +16,8 @@ export class StorefrontRoutingData extends BaseModelData {
14
16
  super(data);
15
17
 
16
18
  this.countryCodes = data.countryCodes || null;
19
+ this.currencyCode = data.currencyCode || null;
20
+ this.currencySymbol = data.currencySymbol || null;
17
21
  this.domain = data.domain || null;
18
22
  this.dynamicCurrencySettings = data.dynamicCurrencySettings
19
23
  ? new StorefrontDynamicCurrencySettingsData(data.dynamicCurrencySettings)
@@ -4,6 +4,7 @@ import { ProductAttributeValueData } from "./ProductAttributeValue";
4
4
  import { ProductImageData } from "./ProductImage";
5
5
  import { ProductPriceData } from "./ProductPrice";
6
6
  import { VariantStockData } from "./VariantStock";
7
+ import { VariantUnitModelData } from "./VariantUnitModel";
7
8
  import { VariantValueRelationData } from "./VariantValueRelation";
8
9
 
9
10
  export class VariantData extends BaseModelData {
@@ -16,6 +17,7 @@ export class VariantData extends BaseModelData {
16
17
  sellIfOutOfStock: boolean | null;
17
18
  sku: string | null;
18
19
  stocks: VariantStockData[] | null;
20
+ unit: VariantUnitModelData | null;
19
21
  variantValueIds: VariantValueRelationData[] | null;
20
22
  weight: number | null;
21
23
 
@@ -45,6 +47,7 @@ export class VariantData extends BaseModelData {
45
47
  this.stocks = data.stocks
46
48
  ? data.stocks.map((v) => new VariantStockData(v))
47
49
  : null;
50
+ this.unit = data.unit ? new VariantUnitModelData(data.unit) : null;
48
51
  this.variantValueIds = data.variantValueIds
49
52
  ? data.variantValueIds.map((v) => new VariantValueRelationData(v))
50
53
  : null;
@@ -0,0 +1,17 @@
1
+ import { DeepReadonly } from "ts-essentials";
2
+ import { ProductUnitTypeEnum } from "../types";
3
+
4
+ export class VariantUnitModelData {
5
+ amount: number | null;
6
+ type: ProductUnitTypeEnum;
7
+
8
+ constructor(data: Partial<VariantUnitModelData> = {}) {
9
+ this.amount =
10
+ data.amount !== undefined && data.amount !== null ? data.amount : null;
11
+ this.type = data.type || ProductUnitTypeEnum.CENTILITER;
12
+ }
13
+ }
14
+
15
+ export class VariantUnitModel extends VariantUnitModelData {}
16
+ export type PartialVariantUnitModel = Partial<VariantUnitModel>;
17
+ export type ReadOnlyVariantUnitModel = DeepReadonly<VariantUnitModel>;
@@ -45,7 +45,7 @@ export type QueryParams = {
45
45
  };
46
46
 
47
47
  const allReturnFields =
48
- "{abandonedCheckoutFlows {campaignId canApplicable couponId customerFilters {sendOnlyActiveAccount sendOnlySubscribedToEmail } flowId mailSendDate mailTranslationId recoverEmailStatus sendAfter } adjustments {amount amountType appliedOrderLines {amount appliedQuantity isAutoCreated orderLineId } campaignId campaignType couponId name order type } availableShippingMethods {price rateName shippingMethod shippingSettingsId shippingZoneRateId } billingAddress {addressLine1 addressLine2 city {code id name } company country {code id iso2 iso3 name } district {code id name } firstName id identityNumber isDefault lastName phone postalCode state {code id name } taxNumber taxOffice } cart {campaignOffers {appliedOrderLineId campaignOfferId campaignOfferProductId offerEndDate offerStartDate status targetPageTypes triggerSourceOrderLineId } createdAt createdBy currencyCode currencySymbol customerId deleted dueDate id itemCount items {createdAt currencyCode currencySymbol deleted discount {amount amountType campaignOfferId campaignOfferProductId maxApplicableQuantity reason } discountPrice finalPrice id options {name productOptionId productOptionsSetId type values {name price value } } originalOrderLineItemId price quantity status statusUpdatedAt stockLocationId taxValue updatedAt variant {barcodeList brand {id name } categories {categoryPath {id name } id name } id mainImageId name prices {buyPrice currency currencySymbol discountPrice priceListId sellPrice } productId sku slug tagIds taxValue type variantValues {order variantTypeId variantTypeName variantValueId variantValueName } weight } } merchantId priceListId salesChannelId status storefrontId storefrontRouting {domain dynamicCurrencySettings {roundingFormat targetCurrencyCode targetCurrencySymbol } id locale path priceListId } storefrontRoutingId storefrontThemeId taxLines {price rate } totalPrice updatedAt } cartId couponCode createdAt customer {accountStatus customerGroupIds email firstName id identityNumber lastName notificationsAccepted phone subscriptionStatus } deleted giftPackageLines {price taxValue } giftPackageNote id isGiftPackage merchantId note orderId orderNumber orderedAt recoverEmailStatus recoveryStatus shippingAddress {addressLine1 addressLine2 city {code id name } company country {code id iso2 iso3 name } district {code id name } firstName id identityNumber isDefault lastName phone postalCode state {code id name } taxNumber taxOffice } shippingLines {finalPrice isRefunded paymentMethod price shippingSettingsId shippingZoneRateId taxValue title } shippingMethod shippingSettingsId shippingZoneRateId status stockLocationId totalFinalPrice updatedAt }";
48
+ "{abandonedCheckoutFlows {campaignId canApplicable couponId customerFilters {sendOnlyActiveAccount sendOnlySubscribedToEmail } flowId mailSendDate mailTranslationId recoverEmailStatus sendAfter } adjustments {amount amountType appliedOrderLines {amount appliedQuantity isAutoCreated orderLineId } campaignId campaignType couponId name order type } availableShippingMethods {price rateName shippingMethod shippingSettingsId shippingZoneRateId } billingAddress {addressLine1 addressLine2 city {code id name } company country {code id iso2 iso3 name } district {code id name } firstName id identityNumber isDefault lastName phone postalCode state {code id name } taxNumber taxOffice } cart {campaignOffers {appliedOrderLineId campaignOfferId campaignOfferProductId offerEndDate offerStartDate status targetPageTypes triggerSourceOrderLineId } createdAt createdBy currencyCode currencySymbol customerId deleted dueDate id itemCount items {createdAt currencyCode currencySymbol deleted discount {amount amountType campaignOfferId campaignOfferProductId maxApplicableQuantity reason } discountPrice finalPrice finalUnitPrice id options {name productOptionId productOptionsSetId type values {name price value } } originalOrderLineItemId price quantity status statusUpdatedAt stockLocationId taxValue unitPrice updatedAt variant {barcodeList baseUnit {baseAmount type unit {id name } } brand {id name } categories {categoryPath {id name } id name } id mainImageId name prices {buyPrice currency currencySymbol discountPrice priceListId sellPrice unitPrice } productId sku slug tagIds taxValue type unit {amount type } variantValues {order variantTypeId variantTypeName variantValueId variantValueName } weight } } merchantId priceListId salesChannelId status storefrontId storefrontRouting {domain dynamicCurrencySettings {roundingFormat targetCurrencyCode targetCurrencySymbol } id locale path priceListId } storefrontRoutingId storefrontThemeId taxLines {price rate } totalPrice updatedAt } cartId couponCode createdAt customer {accountStatus customerGroupIds email firstName id identityNumber lastName notificationsAccepted phone subscriptionStatus } deleted giftPackageLines {price taxValue } giftPackageNote id isGiftPackage merchantId note orderId orderNumber orderedAt recoverEmailStatus recoveryStatus shippingAddress {addressLine1 addressLine2 city {code id name } company country {code id iso2 iso3 name } district {code id name } firstName id identityNumber isDefault lastName phone postalCode state {code id name } taxNumber taxOffice } shippingLines {finalPrice isRefunded paymentMethod price shippingSettingsId shippingZoneRateId taxValue title } shippingMethod shippingSettingsId shippingZoneRateId status stockLocationId totalFinalPrice updatedAt }";
49
49
 
50
50
  export enum ResponseField {
51
51
  ABANDONED_CHECKOUT_FLOWS__CAMPAIGN_ID = "abandonedCheckoutFlows.campaignId",
@@ -130,6 +130,7 @@ export enum ResponseField {
130
130
  CART__ITEMS__DISCOUNT__REASON = "cart.items.discount.reason",
131
131
  CART__ITEMS__DISCOUNT_PRICE = "cart.items.discountPrice",
132
132
  CART__ITEMS__FINAL_PRICE = "cart.items.finalPrice",
133
+ CART__ITEMS__FINAL_UNIT_PRICE = "cart.items.finalUnitPrice",
133
134
  CART__ITEMS__ID = "cart.items.id",
134
135
  CART__ITEMS__OPTIONS__NAME = "cart.items.options.name",
135
136
  CART__ITEMS__OPTIONS__PRODUCT_OPTION_ID = "cart.items.options.productOptionId",
@@ -145,8 +146,13 @@ export enum ResponseField {
145
146
  CART__ITEMS__STATUS_UPDATED_AT = "cart.items.statusUpdatedAt",
146
147
  CART__ITEMS__STOCK_LOCATION_ID = "cart.items.stockLocationId",
147
148
  CART__ITEMS__TAX_VALUE = "cart.items.taxValue",
149
+ CART__ITEMS__UNIT_PRICE = "cart.items.unitPrice",
148
150
  CART__ITEMS__UPDATED_AT = "cart.items.updatedAt",
149
151
  CART__ITEMS__VARIANT__BARCODE_LIST = "cart.items.variant.barcodeList",
152
+ CART__ITEMS__VARIANT__BASE_UNIT__BASE_AMOUNT = "cart.items.variant.baseUnit.baseAmount",
153
+ CART__ITEMS__VARIANT__BASE_UNIT__TYPE = "cart.items.variant.baseUnit.type",
154
+ CART__ITEMS__VARIANT__BASE_UNIT__UNIT__ID = "cart.items.variant.baseUnit.unit.id",
155
+ CART__ITEMS__VARIANT__BASE_UNIT__UNIT__NAME = "cart.items.variant.baseUnit.unit.name",
150
156
  CART__ITEMS__VARIANT__BRAND__ID = "cart.items.variant.brand.id",
151
157
  CART__ITEMS__VARIANT__BRAND__NAME = "cart.items.variant.brand.name",
152
158
  CART__ITEMS__VARIANT__CATEGORIES__CATEGORY_PATH__ID = "cart.items.variant.categories.categoryPath.id",
@@ -162,12 +168,15 @@ export enum ResponseField {
162
168
  CART__ITEMS__VARIANT__PRICES__DISCOUNT_PRICE = "cart.items.variant.prices.discountPrice",
163
169
  CART__ITEMS__VARIANT__PRICES__PRICE_LIST_ID = "cart.items.variant.prices.priceListId",
164
170
  CART__ITEMS__VARIANT__PRICES__SELL_PRICE = "cart.items.variant.prices.sellPrice",
171
+ CART__ITEMS__VARIANT__PRICES__UNIT_PRICE = "cart.items.variant.prices.unitPrice",
165
172
  CART__ITEMS__VARIANT__PRODUCT_ID = "cart.items.variant.productId",
166
173
  CART__ITEMS__VARIANT__SKU = "cart.items.variant.sku",
167
174
  CART__ITEMS__VARIANT__SLUG = "cart.items.variant.slug",
168
175
  CART__ITEMS__VARIANT__TAG_IDS = "cart.items.variant.tagIds",
169
176
  CART__ITEMS__VARIANT__TAX_VALUE = "cart.items.variant.taxValue",
170
177
  CART__ITEMS__VARIANT__TYPE = "cart.items.variant.type",
178
+ CART__ITEMS__VARIANT__UNIT__AMOUNT = "cart.items.variant.unit.amount",
179
+ CART__ITEMS__VARIANT__UNIT__TYPE = "cart.items.variant.unit.type",
171
180
  CART__ITEMS__VARIANT__VARIANT_VALUES__ORDER = "cart.items.variant.variantValues.order",
172
181
  CART__ITEMS__VARIANT__VARIANT_VALUES__VARIANT_TYPE_ID = "cart.items.variant.variantValues.variantTypeId",
173
182
  CART__ITEMS__VARIANT__VARIANT_VALUES__VARIANT_TYPE_NAME = "cart.items.variant.variantValues.variantTypeName",