@longvansoftware/storefront-js-client 2.7.5 → 2.7.6
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 +48 -9
- 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: $updateBy
|
|
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(
|
|
@@ -102,6 +102,7 @@ exports.GET_PRODUCT_BY_ID_QUERY = (0, graphql_tag_1.gql) `
|
|
|
102
102
|
) {
|
|
103
103
|
id
|
|
104
104
|
title
|
|
105
|
+
subType
|
|
105
106
|
description
|
|
106
107
|
sku
|
|
107
108
|
shortDescription
|
|
@@ -114,20 +115,28 @@ exports.GET_PRODUCT_BY_ID_QUERY = (0, graphql_tag_1.gql) `
|
|
|
114
115
|
parentId
|
|
115
116
|
handle
|
|
116
117
|
price
|
|
118
|
+
displayPrice
|
|
119
|
+
hint
|
|
120
|
+
compareAtPrices
|
|
121
|
+
priceUnit
|
|
122
|
+
priceQuantity
|
|
123
|
+
priceType
|
|
124
|
+
salePolicy
|
|
125
|
+
priceTypeName
|
|
126
|
+
priceVaries
|
|
127
|
+
available
|
|
128
|
+
tags
|
|
117
129
|
options
|
|
118
130
|
optionsRelationship
|
|
119
131
|
compareAtPrice
|
|
120
132
|
featuredImage
|
|
121
133
|
images
|
|
122
|
-
productAttributes {
|
|
123
|
-
attributeName
|
|
124
|
-
attributeValue
|
|
125
|
-
}
|
|
126
134
|
variants {
|
|
127
135
|
id
|
|
128
136
|
handle
|
|
129
137
|
title
|
|
130
138
|
price
|
|
139
|
+
priceType
|
|
131
140
|
compareAtPrice
|
|
132
141
|
options
|
|
133
142
|
optionsIds
|
|
@@ -137,16 +146,38 @@ exports.GET_PRODUCT_BY_ID_QUERY = (0, graphql_tag_1.gql) `
|
|
|
137
146
|
featureTypes {
|
|
138
147
|
id
|
|
139
148
|
name
|
|
149
|
+
position
|
|
150
|
+
type
|
|
151
|
+
subType
|
|
152
|
+
fill
|
|
153
|
+
requireData
|
|
140
154
|
values
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
name
|
|
144
|
-
}
|
|
155
|
+
createStamp
|
|
156
|
+
createdBy
|
|
145
157
|
}
|
|
146
158
|
categories {
|
|
147
159
|
id
|
|
148
160
|
title
|
|
161
|
+
image
|
|
162
|
+
icon
|
|
163
|
+
parentId
|
|
164
|
+
level
|
|
149
165
|
handle
|
|
166
|
+
description
|
|
167
|
+
}
|
|
168
|
+
groups {
|
|
169
|
+
id
|
|
170
|
+
name
|
|
171
|
+
policy
|
|
172
|
+
image
|
|
173
|
+
}
|
|
174
|
+
productAttributes {
|
|
175
|
+
attributeName
|
|
176
|
+
attributeValue
|
|
177
|
+
}
|
|
178
|
+
unitDTO {
|
|
179
|
+
id
|
|
180
|
+
name
|
|
150
181
|
}
|
|
151
182
|
}
|
|
152
183
|
}
|
|
@@ -557,3 +588,11 @@ exports.GET_PRODUCT = (0, graphql_tag_1.gql) `
|
|
|
557
588
|
}
|
|
558
589
|
}
|
|
559
590
|
`;
|
|
591
|
+
exports.GET_UNITS = (0, graphql_tag_1.gql) `
|
|
592
|
+
query GetUnits($partnerId: String!) {
|
|
593
|
+
getUnits(partnerId: $partnerId) {
|
|
594
|
+
id
|
|
595
|
+
name
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
`;
|
|
@@ -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;
|