@phystack/products 4.3.40-dev

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 (44) hide show
  1. package/CHANGELOG.md +2736 -0
  2. package/dist/api.d.ts +11 -0
  3. package/dist/api.js +49 -0
  4. package/dist/helpers.d.ts +2 -0
  5. package/dist/helpers.js +11 -0
  6. package/dist/index.d.ts +7 -0
  7. package/dist/index.js +29 -0
  8. package/dist/index.test.d.ts +1 -0
  9. package/dist/index.test.js +1423 -0
  10. package/dist/services/grid-product-service-admin.d.ts +23 -0
  11. package/dist/services/grid-product-service-admin.js +120 -0
  12. package/dist/services/grid-product-service-client.d.ts +80 -0
  13. package/dist/services/grid-product-service-client.js +633 -0
  14. package/dist/services/grid-product-service-interface.d.ts +47 -0
  15. package/dist/services/grid-product-service-interface.js +2 -0
  16. package/dist/services/http-service.d.ts +14 -0
  17. package/dist/services/http-service.js +44 -0
  18. package/dist/types/grid-product.d.ts +458 -0
  19. package/dist/types/grid-product.js +38 -0
  20. package/dist/types/iso-currency-codes.d.ts +182 -0
  21. package/dist/types/iso-currency-codes.js +186 -0
  22. package/dist/types/iso-language-ids.d.ts +170 -0
  23. package/dist/types/iso-language-ids.js +174 -0
  24. package/dist/types/parameters.d.ts +242 -0
  25. package/dist/types/parameters.js +99 -0
  26. package/dist/utils.d.ts +27 -0
  27. package/dist/utils.js +187 -0
  28. package/jest.config.js +10 -0
  29. package/jest.setup.js +1 -0
  30. package/package.json +31 -0
  31. package/src/api.ts +47 -0
  32. package/src/helpers.ts +7 -0
  33. package/src/index.test.ts +1526 -0
  34. package/src/index.ts +8 -0
  35. package/src/services/grid-product-service-admin.ts +123 -0
  36. package/src/services/grid-product-service-client.ts +995 -0
  37. package/src/services/grid-product-service-interface.ts +105 -0
  38. package/src/services/http-service.ts +50 -0
  39. package/src/types/grid-product.ts +548 -0
  40. package/src/types/iso-currency-codes.ts +182 -0
  41. package/src/types/iso-language-ids.ts +170 -0
  42. package/src/types/parameters.ts +231 -0
  43. package/src/utils.ts +325 -0
  44. package/tsconfig.json +20 -0
@@ -0,0 +1,105 @@
1
+ import HttpService from './http-service';
2
+ import {
3
+ ProductDetailsByCodeQueryParameters,
4
+ ProductDetailsQueryParameters,
5
+ ProductFiltersQueryParameters,
6
+ ProductGroupStoresInventoryParam,
7
+ ProductGroupStoresInventoryResponse,
8
+ ProductQueryParameters,
9
+ ProductRecommendationsQueryParameters,
10
+ ProductTypesListQueryParameters,
11
+ RequestTypeEnum,
12
+ SearchQueryParameters,
13
+ } from '../types/parameters';
14
+ import {
15
+ FacetsType,
16
+ FilterByGroup,
17
+ FilterByLanguage,
18
+ GetCartPromotionsParams,
19
+ GetCartPromotionsResponse,
20
+ GetVariantActivePriceParams,
21
+ GetVariantActivePriceResponse,
22
+ GridProduct,
23
+ InventoryItem,
24
+ ProductRecommendationResponse,
25
+ ProductType,
26
+ SortOptionsResponse,
27
+ VariantInfo,
28
+ VariantInventory,
29
+ } from '../types/grid-product';
30
+ import { IsoLanguageIds } from '../types/iso-language-ids';
31
+
32
+ interface GridProductServiceInterface {
33
+ readonly httpService: HttpService;
34
+ locale: IsoLanguageIds | '*';
35
+ getProductById: (
36
+ id: string,
37
+ params: ProductDetailsQueryParameters,
38
+ ) => Promise<Partial<GridProduct>>;
39
+ getProductByBarcode: (
40
+ code: string,
41
+ params: ProductDetailsByCodeQueryParameters,
42
+ ) => Promise<{
43
+ productDetails: Partial<GridProduct>;
44
+ productId: string;
45
+ }>;
46
+ getProductList: (
47
+ params?: ProductQueryParameters,
48
+ requestType?: RequestTypeEnum,
49
+ ) => Promise<{
50
+ list: Partial<GridProduct>[];
51
+ attributeFilters: FilterByLanguage;
52
+ }>;
53
+ search: (params: SearchQueryParameters) => Promise<{
54
+ products: Array<Partial<GridProduct>>;
55
+ productTypes: Array<ProductType>;
56
+ }>;
57
+ getProductTypesList: (
58
+ params?: ProductTypesListQueryParameters,
59
+ ) => Promise<ProductType[]>;
60
+ getProductType: (id: string) => Promise<ProductType>;
61
+ getProductFilters: (params: ProductFiltersQueryParameters) => Promise<FilterByGroup>;
62
+ getProductSortOptions: (isoLanguageId?: IsoLanguageIds) => Promise<SortOptionsResponse>;
63
+ getProductRecommendations: (id: string) => Promise<Partial<GridProduct>[]>;
64
+ getProductRecommendationsByProductId: (
65
+ id: string,
66
+ params: Partial<ProductRecommendationsQueryParameters>,
67
+ ) => Promise<ProductRecommendationResponse>;
68
+ getVariantsList: (productIds: string[]) => Promise<VariantInfo[]>;
69
+ getVariantDetails: (productId: string) => Promise<VariantInfo>;
70
+ getProductEanByEpc: (epc: string) => Promise<string>;
71
+ getProductByEpc: (
72
+ code: string,
73
+ params: ProductDetailsByCodeQueryParameters,
74
+ ) => Promise<{
75
+ productDetails: Partial<GridProduct>;
76
+ productId: string;
77
+ }>;
78
+ getProductInventory: ({
79
+ deviceId,
80
+ requestedQty,
81
+ skuId,
82
+ }: {
83
+ deviceId?: string;
84
+ requestedQty: number;
85
+ skuId: string;
86
+ }) => Promise<InventoryItem | null>;
87
+ getVariantInventory: ({
88
+ productId,
89
+ spaceId,
90
+ }: {
91
+ productId: string;
92
+ spaceId?: string;
93
+ }) => Promise<VariantInventory>;
94
+ getProductGroupStoresInventory: (
95
+ params: ProductGroupStoresInventoryParam,
96
+ ) => Promise<ProductGroupStoresInventoryResponse | null>;
97
+ getCartPromotions: (
98
+ params: GetCartPromotionsParams,
99
+ ) => Promise<GetCartPromotionsResponse | null>;
100
+ getVariantActivePrice: (
101
+ params: GetVariantActivePriceParams,
102
+ ) => Promise<GetVariantActivePriceResponse | null>;
103
+ }
104
+
105
+ export default GridProductServiceInterface;
@@ -0,0 +1,50 @@
1
+ import axios, { AxiosInstance, AxiosRequestConfig } from 'axios';
2
+
3
+ type Options = {
4
+ baseUrl?: string;
5
+ accessToken?: string;
6
+ };
7
+ class HttpService {
8
+ private readonly client: AxiosInstance;
9
+
10
+ constructor({ baseUrl, accessToken }: Options) {
11
+ this.client = axios.create({
12
+ baseURL: baseUrl ?? '',
13
+ headers: accessToken
14
+ ? {
15
+ 'x-api-key': accessToken,
16
+ }
17
+ : {},
18
+ });
19
+ }
20
+
21
+ get = async <T = any>(path: string, config: AxiosRequestConfig): Promise<T> => {
22
+ const { data } = await this.client.get<T>(path, config);
23
+ return data;
24
+ };
25
+
26
+ post = async <T = any>(
27
+ path: string,
28
+ data?: any,
29
+ config?: AxiosRequestConfig,
30
+ ): Promise<T> => {
31
+ const response = await this.client.post<T>(path, data, config);
32
+ return response.data;
33
+ };
34
+
35
+ patch = async <T = any>(
36
+ path: string,
37
+ data?: any,
38
+ config?: AxiosRequestConfig,
39
+ ): Promise<T> => {
40
+ const response = await this.client.patch<T>(path, data, config);
41
+ return response.data;
42
+ };
43
+
44
+ delete = async <T = any>(path: string, config?: AxiosRequestConfig): Promise<T> => {
45
+ const response = await this.client.delete<T>(path, config);
46
+ return response.data;
47
+ };
48
+ }
49
+
50
+ export default HttpService;
@@ -0,0 +1,548 @@
1
+ import { IsoLanguageIds } from './iso-language-ids';
2
+
3
+ export enum DataResidencyEnum {
4
+ 'EU' = "EU",
5
+ 'US' = "US",
6
+ 'UAE' = "UAE",
7
+ 'AU' = "AU",
8
+ 'IN' = "IN",
9
+ 'QA' = "QA",
10
+ 'DEV' = "DEV"
11
+ }
12
+
13
+ export type FacetsType =
14
+ | {
15
+ [propertyName: string]: {
16
+ [property: string]: any;
17
+ readonly count?: number;
18
+ };
19
+ }
20
+ | undefined;
21
+
22
+ export type FilterByLanguage = {
23
+ [key: string]: {
24
+ [language: string]: string[];
25
+ };
26
+ };
27
+
28
+ export type FilterByGroup = {
29
+ [key: string]: {
30
+ [group: string]:
31
+ | string[]
32
+ | {
33
+ min: number;
34
+ max: number;
35
+ isoCurrencyCode: string;
36
+ };
37
+ };
38
+ };
39
+
40
+ export type SortOptionsResponse = {
41
+ sortOptions: {
42
+ [isoLanguageId: string]: string[];
43
+ };
44
+ sortOptionsEnum: {
45
+ [isoLanguageId: string]: string[];
46
+ };
47
+ };
48
+
49
+ export enum PriceListTypeEnum {
50
+ Standard = 'Standard',
51
+ Promotional = 'Promotional',
52
+ StandardConditional = 'StandardConditional',
53
+ }
54
+
55
+ export enum ProductStatusEnum {
56
+ Active = 'Active',
57
+ Inactive = 'Inactive',
58
+ Discontinued = 'Discontinued',
59
+ Dormant = 'Dormant',
60
+ Frozen = 'Frozen',
61
+ Replaced = 'Replaced',
62
+ Obsolete = 'Obsolete',
63
+ Abandoned = 'Abandoned',
64
+ Blocked = 'Blocked',
65
+ }
66
+
67
+ export enum ProductRelationshipTypes {
68
+ Recommended = 'Recommended',
69
+ StyleWith = 'StyleWith',
70
+ Similar = 'Similar',
71
+ // Other ProductRelationshipType to support in future
72
+ }
73
+
74
+ export interface ProductShortDescription {
75
+ isoLanguageId: IsoLanguageIds;
76
+ productShortDescription: string;
77
+ }
78
+
79
+ export interface ProductInternalName {
80
+ isoLanguageId: IsoLanguageIds;
81
+ productInternalName: string;
82
+ }
83
+
84
+ export interface ProductStorageInstructions {
85
+ isoLanguageId: IsoLanguageIds;
86
+ storageInstructions: string;
87
+ }
88
+
89
+ export interface ProductConsumerStorageInstruction {
90
+ isoLanguageId: IsoLanguageIds;
91
+ consumerStorageInstruction: string;
92
+ }
93
+
94
+ export interface ProductShippingInstruction {
95
+ isoLanguageId: IsoLanguageIds;
96
+ productShippingInstruction: string;
97
+ }
98
+
99
+ export interface ProductName {
100
+ isoLanguageId: IsoLanguageIds;
101
+ productName: string;
102
+ }
103
+
104
+ export interface ProductDescription {
105
+ isoLanguageId: IsoLanguageIds;
106
+ productDescription: string;
107
+ }
108
+
109
+ export interface RelatedProductGroup {
110
+ relatedProductGroupId: string;
111
+ productRelationshipType: ProductRelationshipTypes;
112
+ }
113
+
114
+ export interface VariantProductName {
115
+ isoLanguageId: IsoLanguageIds;
116
+ productName: string;
117
+ }
118
+
119
+ export interface Variant {
120
+ productId: string;
121
+ productGroupId: string;
122
+ globalTradeItemNumber?: string[];
123
+ gtinName?: string[];
124
+ europeanArticleNumber?: string[];
125
+ universalProductCode?: string[];
126
+ productName?: VariantProductName[];
127
+ periodStartDate?: string;
128
+ periodEndDate?: string;
129
+ color?: string;
130
+ colorImageUrl?: string;
131
+ colorRgb?: string;
132
+ style?: string;
133
+ size?: string;
134
+ productLink?: string;
135
+ }
136
+
137
+ export interface ProductBrand {
138
+ isoLanguageId: IsoLanguageIds;
139
+ brandName: string;
140
+ brandDescription?: string;
141
+ brandMark?: string;
142
+ brandTrademark?: string;
143
+ brandLogo?: string; // URL
144
+ }
145
+
146
+ export interface ProductStatus {
147
+ productStatus: ProductStatusEnum;
148
+ spaceId: string;
149
+ isoLanguageId?: IsoLanguageIds;
150
+ periodStartDate?: string;
151
+ periodEndDate?: string;
152
+ productStatusNote?: string;
153
+ }
154
+
155
+ export interface ProductFeature {
156
+ productId: string;
157
+ isoLanguageId: IsoLanguageIds;
158
+ productFeatureType: string;
159
+ productFeatureValue: string;
160
+ }
161
+
162
+ export interface ProductPriceList {
163
+ productId: string;
164
+ spaceId: string;
165
+ priceListType: PriceListTypeEnum;
166
+ isoLanguageId?: IsoLanguageIds;
167
+ pricingUomId?: string;
168
+ periodStartTimestamp?: string;
169
+ periodEndTimestamp?: string;
170
+ isoCurrencyCode: string;
171
+ suggestedRetailPrice?: number;
172
+ listPrice: number;
173
+ }
174
+
175
+ export interface CatalogPageLocationProduct {
176
+ productId: string;
177
+ productGroupId: string;
178
+ catalogType: string;
179
+ catalogPage?: string;
180
+ catalogPageLocation?: string;
181
+ catalogPageLocationProduct: string;
182
+ defaultImage?: boolean;
183
+ }
184
+
185
+ export interface ProductLabel {
186
+ isoLanguageId: IsoLanguageIds;
187
+ spaceId: string;
188
+ productLabel: string;
189
+ }
190
+
191
+ export interface ProductItemQuantity {
192
+ productId: string;
193
+ spaceId: string;
194
+ productItemQuantityStartDate?: string;
195
+ productItemQuantityEndDate?: string;
196
+ productItemQuantity: number;
197
+ }
198
+
199
+ export interface ProductVendor {
200
+ vendorId: string;
201
+ productVendor: string;
202
+ periodStartDate?: string;
203
+ periodEndDate?: string;
204
+ }
205
+
206
+ export type ProductTags = {
207
+ isoLanguageId: IsoLanguageIds;
208
+ productTags: string[];
209
+ };
210
+
211
+ export type CustomProperties = {
212
+ key: string;
213
+ spaceId: string;
214
+ value: string;
215
+ productId?: string;
216
+ };
217
+
218
+ // ❌ - property has not been used yet anywhere
219
+ // ✅ - selector implemented
220
+
221
+ export type GridProduct = {
222
+ productGroupId: string;
223
+ tenantId?: string; // Pre-filled during push. tenantId from console
224
+ tenantIndex?: string; // Pre-filled during push. Formatted to {tenant-id}_{data_residency}
225
+ spaceIds: string[];
226
+ productShortDescription?: ProductShortDescription[]; // selector: ✅, result - single
227
+ productInternalName?: ProductInternalName[]; // selector: ❌, result - single
228
+ introductionDate?: string;
229
+ plannedAbandonmentDate?: string;
230
+ storageInstructions?: ProductStorageInstructions[]; // selector ❌, result - unknown
231
+ shellLifeDays?: number;
232
+ consumerStorageInstruction?: ProductConsumerStorageInstruction[]; // selector ❌, result - unknown
233
+ productShippingInstruction?: ProductShippingInstruction[]; // selector ❌, result - unknown
234
+ productName: ProductName[]; // selector ✅, result - single
235
+ productDescription: ProductDescription[]; // selector ✅, result - single
236
+ relatedProductGroups?: RelatedProductGroup[]; // selector ❌, result - unknown
237
+ variants: Variant[]; // selector ✅, result - multiple
238
+ brand?: ProductBrand[]; // selector ✅, result - single (brandName)
239
+ productStatus: ProductStatus[]; // selector ❌, result - single
240
+ productFeature?: ProductFeature[]; // selector ✅, result - multiple,
241
+ productPriceList: ProductPriceList[]; // selector: ✅, result - multiple
242
+ catalogPageLocationProduct: CatalogPageLocationProduct[]; // selector ✅, result - multiple (catalogPageLocationProduct)
243
+ productType: Array<string>; //productTypeId value in ProductTypes DB and supports multiple ProductType
244
+ productLabel?: ProductLabel[]; // selector: ✅, result - multiple
245
+ productTags?: ProductTags[]; // selector ❌, result - multiple
246
+ productItemQuantity?: ProductItemQuantity[]; // selector ✅, result - single (productItemQuantity)
247
+ productVendor?: ProductVendor[]; // selector ❌, result - unknown
248
+ isDeleted?: boolean;
249
+ variantsGroupId?: string; //used as option to group together variants from different products
250
+ customProperties?: CustomProperties[]; // selector ❌, result - unknown
251
+
252
+ // Sort keys
253
+ sortName?: string;
254
+ sortPrice?: number;
255
+ sortQuantity?: number;
256
+ ranking?: number;
257
+ };
258
+
259
+ interface Price {
260
+ amount: number;
261
+ currencyCode: string;
262
+ }
263
+
264
+ export interface BaseSelectorProps {
265
+ locale?: IsoLanguageIds | '*';
266
+ }
267
+
268
+ export type SingleLocalizedResult<
269
+ T extends BaseSelectorProps,
270
+ U,
271
+ V,
272
+ > = T['locale'] extends '*' ? U[] : V;
273
+
274
+ interface FilterProps<T> {
275
+ filter?: (item: T) => boolean;
276
+ }
277
+
278
+ export interface GetProductLabelProps
279
+ extends BaseSelectorProps,
280
+ FilterProps<ProductLabel> {}
281
+
282
+ export interface GetProductLabelBySpaceProps extends BaseSelectorProps {
283
+ spaceId: string;
284
+ }
285
+
286
+ export interface GetProductPriceListProps extends FilterProps<ProductPriceList> {}
287
+
288
+ export interface GetProductPriceProps {
289
+ spaceId: string;
290
+ }
291
+
292
+ export interface GetVariantPriceProps {
293
+ variantId: string;
294
+ spaceId: string;
295
+ }
296
+
297
+ export interface GetProductItemQuantityProps extends FilterProps<ProductItemQuantity> {}
298
+
299
+ export interface GetProductQuantityProps {
300
+ variantId: string;
301
+ spaceId?: string;
302
+ }
303
+
304
+ export interface GetCatalogPageLocationProductProps
305
+ extends FilterProps<CatalogPageLocationProduct> {}
306
+
307
+ export interface GetProductFeatureProps
308
+ extends BaseSelectorProps,
309
+ FilterProps<ProductFeature> {}
310
+
311
+ export interface GetVariantFeatureProps extends BaseSelectorProps {
312
+ productId: string;
313
+ }
314
+
315
+ export interface GetProductVariantsProps extends FilterProps<Variant> {}
316
+
317
+ export interface GetProductVariantsByProductIdProps {
318
+ productId: string;
319
+ }
320
+
321
+ export interface GetVariantImagesProps {
322
+ variantId: string;
323
+ }
324
+
325
+ export interface GridProductSelectors {
326
+ getShortDescription: <T extends BaseSelectorProps>(
327
+ input?: T,
328
+ ) => SingleLocalizedResult<T, ProductShortDescription, string>;
329
+ getLabel: (input?: GetProductLabelProps) => ProductLabel['productLabel'][];
330
+ getLabelBySpace: (input: GetProductLabelBySpaceProps) => ProductLabel['productLabel'][];
331
+ getPriceList: (input?: GetProductPriceListProps) => ProductPriceList[];
332
+ getStandardPrice: (input: GetProductPriceProps) => Price | undefined;
333
+ getPromotionalPrice: (input: GetProductPriceProps) => Price | undefined;
334
+ getName: <T extends BaseSelectorProps>(
335
+ input?: T,
336
+ ) => SingleLocalizedResult<T, ProductName, string>;
337
+ getDescription: <T extends BaseSelectorProps>(
338
+ input?: T,
339
+ ) => SingleLocalizedResult<T, ProductDescription, string>;
340
+ getBrandName: <T extends BaseSelectorProps>(
341
+ input?: T,
342
+ ) => SingleLocalizedResult<T, ProductBrand, string>;
343
+ getItemQuantity: (input?: GetProductItemQuantityProps) => ProductItemQuantity[];
344
+ getVariantQuantity: (input: GetProductQuantityProps) => number;
345
+ getCatalogPageLocationProduct: (
346
+ input?: GetCatalogPageLocationProductProps,
347
+ ) => CatalogPageLocationProduct[];
348
+ getImages: () => string[];
349
+ getImage: () => string;
350
+ getFeature: (input?: GetProductFeatureProps) => ProductFeature[];
351
+ getVariants: (input?: GetProductVariantsProps) => Variant[];
352
+ getFirstVariant: () => Variant;
353
+ getVariantsByProductId: (input: GetProductVariantsByProductIdProps) => Variant[];
354
+ getVariantImages: (input: GetVariantImagesProps) => string[];
355
+ getVariantStandardPrice: (input: GetVariantPriceProps) => Price | undefined;
356
+ getVariantPromotionalPrice: (input: GetVariantPriceProps) => Price | undefined;
357
+ getVariantFeature: (input: GetVariantFeatureProps) => ProductFeature[];
358
+ }
359
+
360
+ export type SelectablePartialProduct = GridProductSelectors & Partial<GridProduct>;
361
+
362
+ export interface CategoryResult {
363
+ id: string;
364
+ title: string;
365
+ parent: string;
366
+ isoLanguageId: IsoLanguageIds;
367
+ }
368
+
369
+ export interface ProductTypeTitle {
370
+ isoLanguageId: IsoLanguageIds;
371
+ label: string;
372
+ path?: string;
373
+ }
374
+
375
+ export type ProductType = {
376
+ isRoot: boolean;
377
+ parentId: string;
378
+ productTypeId: string;
379
+ title: ProductTypeTitle[];
380
+ };
381
+
382
+ export type ProductFeatureModel = {
383
+ id: string;
384
+ partitionKey: string; // price or feature
385
+ tenantId: string;
386
+ environment: string;
387
+ tenantIndex: string;
388
+ productId: string;
389
+ productGroupId: string;
390
+ productFeatureType: string;
391
+ productFeatureValue: string;
392
+ isoLanguageId: IsoLanguageIds;
393
+ productType: string[];
394
+ spaceId?: string; // Used for Price filters
395
+ };
396
+
397
+ export type ProductRecommendationResponse = {
398
+ default: Partial<GridProduct>[];
399
+ similar: Partial<GridProduct>[];
400
+ styleWith: Partial<GridProduct>[];
401
+ similarItems: Partial<GridProduct>[];
402
+ completeTheLook: Partial<GridProduct>[];
403
+ };
404
+
405
+ export interface ProductRecommendationLibraryResponse
406
+ extends ProductRecommendationResponse {
407
+ default: SelectablePartialProduct[];
408
+ similar: SelectablePartialProduct[];
409
+ styleWith: SelectablePartialProduct[];
410
+ similarItems: SelectablePartialProduct[];
411
+ completeTheLook: SelectablePartialProduct[];
412
+ }
413
+
414
+ export type VariantInfo = Variant & {
415
+ spaceIds: string[];
416
+ productName: ProductName[];
417
+ productDescription: ProductDescription[];
418
+ catalogPageLocationProduct: CatalogPageLocationProduct[];
419
+ productLabel: ProductLabel[];
420
+ productPriceList: ProductPriceList[];
421
+ productItemQuantity: ProductItemQuantity[];
422
+ };
423
+
424
+ export interface InventoryItem {
425
+ requestedQty: number;
426
+ skuId: string;
427
+ productId: string;
428
+ name: string;
429
+ brandDesc: string;
430
+ category: string;
431
+ color: string;
432
+ styleCode: string;
433
+ size: string;
434
+ imageUrl: string | null;
435
+ zones: InventoryZone[];
436
+ }
437
+
438
+ export interface VariantInventory {
439
+ productItemQuantity: ProductItemQuantity[];
440
+ }
441
+
442
+ export interface InventoryZone {
443
+ zoneId: string;
444
+ availableQty: number;
445
+ zoneName: string;
446
+ zoneType: string;
447
+ }
448
+
449
+ export interface CartItem {
450
+ sequenceId: number;
451
+ productId: string;
452
+ barcode: string;
453
+ price: number;
454
+ quantity: number;
455
+ }
456
+
457
+ export interface GetCartPromotionsParams {
458
+ storeId: string;
459
+ transactionId: string;
460
+ transactionTotal: number;
461
+ dateTime: string;
462
+ items: CartItem[];
463
+ posId?: string;
464
+ }
465
+
466
+ export interface CartItemPromotionList {
467
+ promoId: string;
468
+ promoAmount: number;
469
+ promoDescription: string;
470
+ }
471
+
472
+ export interface CartItemPromotion {
473
+ productId: string;
474
+ originalPrice: number;
475
+ discountValue: number;
476
+ newPrice: number;
477
+ promoList: CartItemPromotionList[];
478
+ }
479
+
480
+ export interface GetCartPromotionsResponse {
481
+ totalPrice: number;
482
+ items: CartItemPromotion[];
483
+ }
484
+
485
+ export interface UploadExcelDataResponse {
486
+ message: string;
487
+ isError: boolean;
488
+ count: {
489
+ productGroups: number;
490
+ products: number;
491
+ productTypes: number;
492
+ } | null;
493
+ }
494
+
495
+ export interface GetVariantActivePriceParams {
496
+ spaceId: string;
497
+ storeId: string;
498
+ productId: string;
499
+ dateTime?: string;
500
+ posId?: string;
501
+ }
502
+
503
+ export interface GetVariantActivePriceResponse {
504
+ productId: string;
505
+ productGroupId: string;
506
+ spaceId: string;
507
+ price: ProductPriceList;
508
+ }
509
+
510
+ export type VariantUpdateFields = Variant & {
511
+ productGroupId?: string; // convert productGroupId as optional
512
+ productPriceList?: ProductPriceList[];
513
+ productFeature?: ProductFeature[];
514
+ productItemQuantity?: ProductItemQuantity[];
515
+ };
516
+
517
+ export interface UpdateVariantsParams {
518
+ data: (Partial<VariantUpdateFields> & { productId: string })[];
519
+ upsertSpaceIds: boolean;
520
+ }
521
+
522
+ export type GridProductPushPayload = {
523
+ productGroupId: string;
524
+ productShortDescription?: ProductShortDescription[];
525
+ productInternalName?: ProductInternalName[];
526
+ introductionDate?: string;
527
+ plannedAbandonmentDate?: string;
528
+ storageInstructions?: ProductStorageInstructions[];
529
+ shellLifeDays?: number;
530
+ consumerStorageInstruction?: ProductConsumerStorageInstruction[];
531
+ productShippingInstruction?: ProductShippingInstruction[];
532
+ productName?: ProductName[];
533
+ productDescription?: ProductDescription[];
534
+ relatedProductGroups?: RelatedProductGroup[];
535
+ variants?: Variant[];
536
+ brand?: ProductBrand[];
537
+ productStatus?: ProductStatus[];
538
+ productFeature?: ProductFeature[];
539
+ productPriceList?: ProductPriceList[];
540
+ catalogPageLocationProduct?: CatalogPageLocationProduct[];
541
+ productType?: Array<string>;
542
+ productLabel?: ProductLabel[];
543
+ productTags?: ProductTags[];
544
+ productItemQuantity?: ProductItemQuantity[];
545
+ productVendor?: ProductVendor[];
546
+ variantsGroupId?: string;
547
+ customProperties?: CustomProperties[];
548
+ };