@longvansoftware/storefront-js-client 4.6.9 → 4.7.0
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.
|
@@ -18,6 +18,7 @@ export declare class ProductService extends Service {
|
|
|
18
18
|
* @throws If an error occurs while fetching the product.
|
|
19
19
|
*/
|
|
20
20
|
getProductById(productId: string): Promise<any>;
|
|
21
|
+
getProductByIdV2(productId: string): Promise<any>;
|
|
21
22
|
getSimpleProductById(productId: string): Promise<any>;
|
|
22
23
|
/**
|
|
23
24
|
* Retrieves a product by its slug.
|
|
@@ -42,6 +43,7 @@ export declare class ProductService extends Service {
|
|
|
42
43
|
getProductImage: (productId: string) => Promise<any>;
|
|
43
44
|
getCategory(typeBuild: string, level: number, storeId: string): Promise<any>;
|
|
44
45
|
getProduct(dataQuery: any): Promise<any>;
|
|
46
|
+
getProductV2(dataQuery: any): Promise<any>;
|
|
45
47
|
updateProductTitle(productId: string, title: string, updatedBy: string): Promise<any>;
|
|
46
48
|
updatePrice(productId: string, price: string, updatedBy: string): Promise<any>;
|
|
47
49
|
updatePricePromotion(productId: string, price: string, updatedBy: string): Promise<any>;
|
|
@@ -66,6 +66,24 @@ class ProductService extends serviceSDK_1.Service {
|
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
|
+
getProductByIdV2(productId) {
|
|
70
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
const query = queries_1.GET_PRODUCT_BY_ID_QUERY;
|
|
72
|
+
const variables = {
|
|
73
|
+
partnerId: this.orgId,
|
|
74
|
+
storeChannel: "",
|
|
75
|
+
productId,
|
|
76
|
+
};
|
|
77
|
+
try {
|
|
78
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
79
|
+
return response.getProductById;
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
console.log(`Error fetching product by ID: ${error}`);
|
|
83
|
+
throw error;
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}
|
|
69
87
|
getSimpleProductById(productId) {
|
|
70
88
|
return __awaiter(this, void 0, void 0, function* () {
|
|
71
89
|
const query = queries_1.GET_SIMPLE_PRODUCT_BY_ID_QUERY;
|
|
@@ -267,6 +285,26 @@ class ProductService extends serviceSDK_1.Service {
|
|
|
267
285
|
}
|
|
268
286
|
});
|
|
269
287
|
}
|
|
288
|
+
getProductV2(dataQuery) {
|
|
289
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
290
|
+
const query = queries_1.GET_PRODUCT;
|
|
291
|
+
const variables = {
|
|
292
|
+
partnerId: this.orgId,
|
|
293
|
+
storeChannel: dataQuery.storeChannel,
|
|
294
|
+
keyword: dataQuery.keyword,
|
|
295
|
+
category: dataQuery.category,
|
|
296
|
+
currentPage: dataQuery.currentPage,
|
|
297
|
+
maxResult: dataQuery.maxResult,
|
|
298
|
+
};
|
|
299
|
+
try {
|
|
300
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
301
|
+
return response.getProducts;
|
|
302
|
+
}
|
|
303
|
+
catch (error) {
|
|
304
|
+
throw error;
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
}
|
|
270
308
|
updateProductTitle(productId, title, updatedBy) {
|
|
271
309
|
return __awaiter(this, void 0, void 0, function* () {
|
|
272
310
|
const mutation = mutations_1.UPDATE_PRODUCT_TITLE;
|