@longvansoftware/storefront-js-client 2.7.5 → 2.7.7
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/dist/src/graphql/product/mutations.d.ts +7 -0
- package/dist/src/graphql/product/mutations.js +104 -0
- package/dist/src/graphql/product/queries.d.ts +1 -0
- package/dist/src/graphql/product/queries.js +13 -1
- package/dist/src/lib/product/index.d.ts +8 -0
- package/dist/src/lib/product/index.js +133 -0
- package/package.json +1 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const UPDATE_PRODUCT_TITLE: import("graphql").DocumentNode;
|
|
2
|
+
export declare const UPDATE_PRICE: import("graphql").DocumentNode;
|
|
3
|
+
export declare const UPDATE_PRICE_PROMOTION: import("graphql").DocumentNode;
|
|
4
|
+
export declare const UPDATE_CATEGORY: import("graphql").DocumentNode;
|
|
5
|
+
export declare const UPDATE_SHORT_DESCRIPTION: import("graphql").DocumentNode;
|
|
6
|
+
export declare const UPDATE_UNIT: import("graphql").DocumentNode;
|
|
7
|
+
export declare const CLEAR_ALL_CACHES: import("graphql").DocumentNode;
|
|
@@ -1 +1,105 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CLEAR_ALL_CACHES = exports.UPDATE_UNIT = exports.UPDATE_SHORT_DESCRIPTION = exports.UPDATE_CATEGORY = exports.UPDATE_PRICE_PROMOTION = exports.UPDATE_PRICE = exports.UPDATE_PRODUCT_TITLE = void 0;
|
|
4
|
+
const graphql_tag_1 = require("graphql-tag");
|
|
5
|
+
exports.UPDATE_PRODUCT_TITLE = (0, graphql_tag_1.gql) `
|
|
6
|
+
mutation UpdateProductTitle(
|
|
7
|
+
$productId: String!
|
|
8
|
+
$title: String!
|
|
9
|
+
$updatedBy: String!
|
|
10
|
+
) {
|
|
11
|
+
updateProductTitle(
|
|
12
|
+
productId: $productId
|
|
13
|
+
title: $title
|
|
14
|
+
updatedBy: $updatedBy
|
|
15
|
+
) {
|
|
16
|
+
status
|
|
17
|
+
message
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
`;
|
|
21
|
+
exports.UPDATE_PRICE = (0, graphql_tag_1.gql) `
|
|
22
|
+
mutation UpdatePrice(
|
|
23
|
+
$productId: String!
|
|
24
|
+
$storeId: String!
|
|
25
|
+
$price: BigDecimal!
|
|
26
|
+
$updatedBy: String!
|
|
27
|
+
) {
|
|
28
|
+
updatePrice(
|
|
29
|
+
productId: $productId
|
|
30
|
+
storeId: $storeId
|
|
31
|
+
price: $price
|
|
32
|
+
updatedBy: $updatedBy
|
|
33
|
+
) {
|
|
34
|
+
status
|
|
35
|
+
message
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
`;
|
|
39
|
+
exports.UPDATE_PRICE_PROMOTION = (0, graphql_tag_1.gql) `
|
|
40
|
+
mutation UpdatePricePromotion(
|
|
41
|
+
$productId: String!
|
|
42
|
+
$storeId: String!
|
|
43
|
+
$price: BigDecimal!
|
|
44
|
+
$updatedBy: String!
|
|
45
|
+
) {
|
|
46
|
+
updatePricePromotion(
|
|
47
|
+
productId: $productId
|
|
48
|
+
storeId: $storeId
|
|
49
|
+
price: $price
|
|
50
|
+
updatedBy: $updatedBy
|
|
51
|
+
) {
|
|
52
|
+
status
|
|
53
|
+
message
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
`;
|
|
57
|
+
exports.UPDATE_CATEGORY = (0, graphql_tag_1.gql) `
|
|
58
|
+
mutation UpdateCategory(
|
|
59
|
+
$productId: String!
|
|
60
|
+
$categoryId: String!
|
|
61
|
+
$updatedBy: String!
|
|
62
|
+
) {
|
|
63
|
+
updateCategory(
|
|
64
|
+
productId: $productId
|
|
65
|
+
categoryId: $categoryId
|
|
66
|
+
updatedBy: $updatedBy
|
|
67
|
+
) {
|
|
68
|
+
status
|
|
69
|
+
message
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
`;
|
|
73
|
+
exports.UPDATE_SHORT_DESCRIPTION = (0, graphql_tag_1.gql) `
|
|
74
|
+
mutation UpdateShortDescription(
|
|
75
|
+
$productId: String!
|
|
76
|
+
$shortDescription: String!
|
|
77
|
+
$updatedBy: String!
|
|
78
|
+
) {
|
|
79
|
+
updateShortDescription(
|
|
80
|
+
productId: $productId
|
|
81
|
+
shortDescription: $shortDescription
|
|
82
|
+
updatedBy: $updatedBy
|
|
83
|
+
) {
|
|
84
|
+
status
|
|
85
|
+
message
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
`;
|
|
89
|
+
exports.UPDATE_UNIT = (0, graphql_tag_1.gql) `
|
|
90
|
+
mutation UpdateUnit(
|
|
91
|
+
$productId: String!
|
|
92
|
+
$unitId: String!
|
|
93
|
+
$updatedBy: String!
|
|
94
|
+
) {
|
|
95
|
+
updateUnit(productId: $productId, unitId: $unitId, updatedBy: $updatedBy) {
|
|
96
|
+
status
|
|
97
|
+
message
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
`;
|
|
101
|
+
exports.CLEAR_ALL_CACHES = (0, graphql_tag_1.gql) `
|
|
102
|
+
mutation ClearAllCaches {
|
|
103
|
+
clearAllCaches
|
|
104
|
+
}
|
|
105
|
+
`;
|
|
@@ -13,3 +13,4 @@ export declare const GET_STORES: import("graphql").DocumentNode;
|
|
|
13
13
|
export declare const GET_DETAIL_STORES: import("graphql").DocumentNode;
|
|
14
14
|
export declare const GET_PRODUCT_IMAGE: import("graphql").DocumentNode;
|
|
15
15
|
export declare const GET_PRODUCT: import("graphql").DocumentNode;
|
|
16
|
+
export declare const GET_UNITS: import("graphql").DocumentNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GET_PRODUCT = exports.GET_PRODUCT_IMAGE = exports.GET_DETAIL_STORES = exports.GET_STORES = exports.GET_POLICY = exports.GET_PRODUCT_OPTION = exports.GET_BRAND_DETAIL_QUERY = exports.GET_BRANDS_BY_CATEGORY_QUERY = exports.GET_BRANDS_QUERY = exports.GET_CATEGORY_BY_ID_QUERY = exports.GET_CATEGORY_BY_HANDLE_QUERY = exports.GET_CATEGORIES_QUERY = exports.GET_SIMPLE_PRODUCTS_QUERY = exports.GET_PRODUCT_BY_SLUG_QUERY = exports.GET_PRODUCT_BY_ID_QUERY = void 0;
|
|
3
|
+
exports.GET_UNITS = exports.GET_PRODUCT = exports.GET_PRODUCT_IMAGE = exports.GET_DETAIL_STORES = exports.GET_STORES = exports.GET_POLICY = exports.GET_PRODUCT_OPTION = exports.GET_BRAND_DETAIL_QUERY = exports.GET_BRANDS_BY_CATEGORY_QUERY = exports.GET_BRANDS_QUERY = exports.GET_CATEGORY_BY_ID_QUERY = exports.GET_CATEGORY_BY_HANDLE_QUERY = exports.GET_CATEGORIES_QUERY = exports.GET_SIMPLE_PRODUCTS_QUERY = exports.GET_PRODUCT_BY_SLUG_QUERY = exports.GET_PRODUCT_BY_ID_QUERY = void 0;
|
|
4
4
|
const graphql_tag_1 = require("graphql-tag");
|
|
5
5
|
// export const GET_PRODUCT_BY_ID_QUERY = gql`
|
|
6
6
|
// query GetProductById(
|
|
@@ -206,6 +206,10 @@ exports.GET_PRODUCT_BY_SLUG_QUERY = (0, graphql_tag_1.gql) `
|
|
|
206
206
|
title
|
|
207
207
|
handle
|
|
208
208
|
}
|
|
209
|
+
unitDTO {
|
|
210
|
+
id
|
|
211
|
+
name
|
|
212
|
+
}
|
|
209
213
|
}
|
|
210
214
|
}
|
|
211
215
|
`;
|
|
@@ -557,3 +561,11 @@ exports.GET_PRODUCT = (0, graphql_tag_1.gql) `
|
|
|
557
561
|
}
|
|
558
562
|
}
|
|
559
563
|
`;
|
|
564
|
+
exports.GET_UNITS = (0, graphql_tag_1.gql) `
|
|
565
|
+
query GetUnits($partnerId: String!) {
|
|
566
|
+
getUnits(partnerId: $partnerId) {
|
|
567
|
+
id
|
|
568
|
+
name
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
`;
|
|
@@ -40,4 +40,12 @@ export declare class ProductService extends Service {
|
|
|
40
40
|
getProductImage: (productId: string) => Promise<any>;
|
|
41
41
|
getCategory(typeBuild: string, level: number): Promise<any>;
|
|
42
42
|
getProduct(dataQuery: any): Promise<any>;
|
|
43
|
+
updateProductTitle(productId: string, title: string, updatedBy: string): Promise<any>;
|
|
44
|
+
updatePrice(productId: string, price: string, updatedBy: string): Promise<any>;
|
|
45
|
+
updatePricePromotion(productId: string, price: string, updatedBy: string): Promise<any>;
|
|
46
|
+
updateCategory(productId: string, categoryId: string, updatedBy: string): Promise<any>;
|
|
47
|
+
updateShortDescription(productId: string, shortDescription: string, updatedBy: string): Promise<any>;
|
|
48
|
+
updateUnit(productId: string, unitId: string, updatedBy: string): Promise<any>;
|
|
49
|
+
getUnits(): Promise<any>;
|
|
50
|
+
clearAllCaches(): Promise<any>;
|
|
43
51
|
}
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.ProductService = void 0;
|
|
13
13
|
const serviceSDK_1 = require("../serviceSDK");
|
|
14
14
|
const queries_1 = require("../../graphql/product/queries");
|
|
15
|
+
const mutations_1 = require("../../graphql/product/mutations");
|
|
15
16
|
/**
|
|
16
17
|
* Service class for managing product-related operations.
|
|
17
18
|
*/
|
|
@@ -232,5 +233,137 @@ class ProductService extends serviceSDK_1.Service {
|
|
|
232
233
|
}
|
|
233
234
|
});
|
|
234
235
|
}
|
|
236
|
+
updateProductTitle(productId, title, updatedBy) {
|
|
237
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
238
|
+
const mutation = mutations_1.UPDATE_PRODUCT_TITLE;
|
|
239
|
+
const variables = {
|
|
240
|
+
productId: productId,
|
|
241
|
+
title: title,
|
|
242
|
+
updatedBy: updatedBy,
|
|
243
|
+
};
|
|
244
|
+
try {
|
|
245
|
+
const response = yield this.graphqlMutation(mutation, variables);
|
|
246
|
+
return response.updateProductTitle;
|
|
247
|
+
}
|
|
248
|
+
catch (error) {
|
|
249
|
+
throw error;
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
updatePrice(productId, price, updatedBy) {
|
|
254
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
255
|
+
const mutation = mutations_1.UPDATE_PRICE;
|
|
256
|
+
const variables = {
|
|
257
|
+
productId: productId,
|
|
258
|
+
storeId: this.storeId,
|
|
259
|
+
price: price,
|
|
260
|
+
updatedBy: updatedBy,
|
|
261
|
+
};
|
|
262
|
+
try {
|
|
263
|
+
const response = yield this.graphqlMutation(mutation, variables);
|
|
264
|
+
return response.updatePrice;
|
|
265
|
+
}
|
|
266
|
+
catch (error) {
|
|
267
|
+
throw error;
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
updatePricePromotion(productId, price, updatedBy) {
|
|
272
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
273
|
+
const mutation = mutations_1.UPDATE_PRICE_PROMOTION;
|
|
274
|
+
const variables = {
|
|
275
|
+
productId: productId,
|
|
276
|
+
storeId: this.storeId,
|
|
277
|
+
price: price,
|
|
278
|
+
updatedBy: updatedBy,
|
|
279
|
+
};
|
|
280
|
+
try {
|
|
281
|
+
const response = yield this.graphqlMutation(mutation, variables);
|
|
282
|
+
return response.updatePricePromotion;
|
|
283
|
+
}
|
|
284
|
+
catch (error) {
|
|
285
|
+
throw error;
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
updateCategory(productId, categoryId, updatedBy) {
|
|
290
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
291
|
+
const mutation = mutations_1.UPDATE_CATEGORY;
|
|
292
|
+
const variables = {
|
|
293
|
+
productId: productId,
|
|
294
|
+
categoryId: categoryId,
|
|
295
|
+
updatedBy: updatedBy,
|
|
296
|
+
};
|
|
297
|
+
try {
|
|
298
|
+
const response = yield this.graphqlMutation(mutation, variables);
|
|
299
|
+
return response.updateCategory;
|
|
300
|
+
}
|
|
301
|
+
catch (error) {
|
|
302
|
+
throw error;
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
updateShortDescription(productId, shortDescription, updatedBy) {
|
|
307
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
308
|
+
const mutation = mutations_1.UPDATE_SHORT_DESCRIPTION;
|
|
309
|
+
const variables = {
|
|
310
|
+
productId: productId,
|
|
311
|
+
shortDescription: shortDescription,
|
|
312
|
+
updatedBy: updatedBy,
|
|
313
|
+
};
|
|
314
|
+
try {
|
|
315
|
+
const response = yield this.graphqlMutation(mutation, variables);
|
|
316
|
+
return response.updateShortDescription;
|
|
317
|
+
}
|
|
318
|
+
catch (error) {
|
|
319
|
+
throw error;
|
|
320
|
+
}
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
updateUnit(productId, unitId, updatedBy) {
|
|
324
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
325
|
+
const mutation = mutations_1.UPDATE_UNIT;
|
|
326
|
+
const variables = {
|
|
327
|
+
productId: productId,
|
|
328
|
+
unitId: unitId,
|
|
329
|
+
updatedBy: updatedBy,
|
|
330
|
+
};
|
|
331
|
+
try {
|
|
332
|
+
const response = yield this.graphqlMutation(mutation, variables);
|
|
333
|
+
return response.updateUnit;
|
|
334
|
+
}
|
|
335
|
+
catch (error) {
|
|
336
|
+
throw error;
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
getUnits() {
|
|
341
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
342
|
+
const query = queries_1.GET_UNITS;
|
|
343
|
+
const variables = {
|
|
344
|
+
partnerId: this.orgId,
|
|
345
|
+
};
|
|
346
|
+
try {
|
|
347
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
348
|
+
return response.getUnits;
|
|
349
|
+
}
|
|
350
|
+
catch (error) {
|
|
351
|
+
throw error;
|
|
352
|
+
}
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
clearAllCaches() {
|
|
356
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
357
|
+
const mutaion = mutations_1.CLEAR_ALL_CACHES;
|
|
358
|
+
const variables = {};
|
|
359
|
+
try {
|
|
360
|
+
const response = yield this.graphqlMutation(mutaion, variables);
|
|
361
|
+
return response.clearAllCaches;
|
|
362
|
+
}
|
|
363
|
+
catch (error) {
|
|
364
|
+
throw error;
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
}
|
|
235
368
|
}
|
|
236
369
|
exports.ProductService = ProductService;
|