@longvansoftware/storefront-js-client 2.0.1 → 2.0.3
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/config/config.js
CHANGED
|
@@ -9,7 +9,7 @@ exports.environmentEndpoints = {
|
|
|
9
9
|
order: "https://storefront.dev.longvan.vn/v2",
|
|
10
10
|
user: "https://user.dev.longvan.vn/user-gateway/graphql",
|
|
11
11
|
payment: "https://portal.dev.longvan.vn/invoice-gateway/graphql",
|
|
12
|
-
service: "https://
|
|
12
|
+
service: "https://api-gateway.dev.longvan.vn/service-api/graphql",
|
|
13
13
|
warehouse: "https://portal.dev.longvan.vn/facility-api/public-facility/1.0.0/inventory-item",
|
|
14
14
|
computing: "https://api-gateway.dev.longvan.vn/computing-service/graphql",
|
|
15
15
|
campaign: "https://crm.dev.longvan.vn/campaign-gateway/graphql",
|
|
@@ -12,3 +12,4 @@ export declare const GET_POLICY: import("graphql").DocumentNode;
|
|
|
12
12
|
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
|
+
export declare const GET_PRODUCT: import("graphql").DocumentNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
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_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(
|
|
@@ -90,8 +90,16 @@ const graphql_tag_1 = require("graphql-tag");
|
|
|
90
90
|
// }
|
|
91
91
|
// `;
|
|
92
92
|
exports.GET_PRODUCT_BY_ID_QUERY = (0, graphql_tag_1.gql) `
|
|
93
|
-
query GetProductById(
|
|
94
|
-
|
|
93
|
+
query GetProductById(
|
|
94
|
+
$partnerId: String!
|
|
95
|
+
$storeChannel: String!
|
|
96
|
+
$productId: String!
|
|
97
|
+
) {
|
|
98
|
+
getProductById(
|
|
99
|
+
partnerId: $partnerId
|
|
100
|
+
storeChannel: $storeChannel
|
|
101
|
+
productId: $productId
|
|
102
|
+
) {
|
|
95
103
|
id
|
|
96
104
|
title
|
|
97
105
|
description
|
|
@@ -144,8 +152,16 @@ exports.GET_PRODUCT_BY_ID_QUERY = (0, graphql_tag_1.gql) `
|
|
|
144
152
|
}
|
|
145
153
|
`;
|
|
146
154
|
exports.GET_PRODUCT_BY_SLUG_QUERY = (0, graphql_tag_1.gql) `
|
|
147
|
-
query GetProductByHandle(
|
|
148
|
-
|
|
155
|
+
query GetProductByHandle(
|
|
156
|
+
$partnerId: String!
|
|
157
|
+
$storeChannel: String!
|
|
158
|
+
$handle: String!
|
|
159
|
+
) {
|
|
160
|
+
getProductByHandle(
|
|
161
|
+
partnerId: $partnerId
|
|
162
|
+
storeChannel: $storeChannel
|
|
163
|
+
handle: $handle
|
|
164
|
+
) {
|
|
149
165
|
id
|
|
150
166
|
title
|
|
151
167
|
description
|
|
@@ -277,8 +293,8 @@ exports.GET_CATEGORIES_QUERY = (0, graphql_tag_1.gql) `
|
|
|
277
293
|
icon
|
|
278
294
|
parentId
|
|
279
295
|
level
|
|
280
|
-
sequence
|
|
281
296
|
handle
|
|
297
|
+
description
|
|
282
298
|
child {
|
|
283
299
|
id
|
|
284
300
|
title
|
|
@@ -286,15 +302,23 @@ exports.GET_CATEGORIES_QUERY = (0, graphql_tag_1.gql) `
|
|
|
286
302
|
icon
|
|
287
303
|
parentId
|
|
288
304
|
level
|
|
289
|
-
sequence
|
|
290
305
|
handle
|
|
306
|
+
description
|
|
291
307
|
}
|
|
292
308
|
}
|
|
293
309
|
}
|
|
294
310
|
`;
|
|
295
311
|
exports.GET_CATEGORY_BY_HANDLE_QUERY = (0, graphql_tag_1.gql) `
|
|
296
|
-
query GetCategoryByHandle(
|
|
297
|
-
|
|
312
|
+
query GetCategoryByHandle(
|
|
313
|
+
$partnerId: String!
|
|
314
|
+
$storeChannel: String!
|
|
315
|
+
$handle: String!
|
|
316
|
+
) {
|
|
317
|
+
getCategoryByHandle(
|
|
318
|
+
partnerId: $partnerId
|
|
319
|
+
storeChannel: $storeChannel
|
|
320
|
+
handle: $handle
|
|
321
|
+
) {
|
|
298
322
|
id
|
|
299
323
|
title
|
|
300
324
|
image
|
|
@@ -315,8 +339,16 @@ exports.GET_CATEGORY_BY_HANDLE_QUERY = (0, graphql_tag_1.gql) `
|
|
|
315
339
|
}
|
|
316
340
|
`;
|
|
317
341
|
exports.GET_CATEGORY_BY_ID_QUERY = (0, graphql_tag_1.gql) `
|
|
318
|
-
query GetCategoryById(
|
|
319
|
-
|
|
342
|
+
query GetCategoryById(
|
|
343
|
+
$partnerId: String!
|
|
344
|
+
$storeChannel: String!
|
|
345
|
+
$categoryId: String!
|
|
346
|
+
) {
|
|
347
|
+
getCategoryById(
|
|
348
|
+
partnerId: $partnerId
|
|
349
|
+
storeChannel: $storeChannel
|
|
350
|
+
categoryId: $categoryId
|
|
351
|
+
) {
|
|
320
352
|
id
|
|
321
353
|
title
|
|
322
354
|
image
|
|
@@ -367,8 +399,16 @@ exports.GET_BRAND_DETAIL_QUERY = `
|
|
|
367
399
|
}
|
|
368
400
|
`;
|
|
369
401
|
exports.GET_PRODUCT_OPTION = (0, graphql_tag_1.gql) `
|
|
370
|
-
query GetProductOption(
|
|
371
|
-
|
|
402
|
+
query GetProductOption(
|
|
403
|
+
$partnerId: String!
|
|
404
|
+
$storeChannel: String!
|
|
405
|
+
$productId: String!
|
|
406
|
+
) {
|
|
407
|
+
getProductOption(
|
|
408
|
+
partnerId: $partnerId
|
|
409
|
+
storeChannel: $storeChannel
|
|
410
|
+
productId: $productId
|
|
411
|
+
) {
|
|
372
412
|
id
|
|
373
413
|
name
|
|
374
414
|
subType
|
|
@@ -445,3 +485,49 @@ exports.GET_PRODUCT_IMAGE = (0, graphql_tag_1.gql) `
|
|
|
445
485
|
getProductImage(partnerId: $partnerId, productId: $productId)
|
|
446
486
|
}
|
|
447
487
|
`;
|
|
488
|
+
exports.GET_PRODUCT = (0, graphql_tag_1.gql) `
|
|
489
|
+
query GetProducts(
|
|
490
|
+
$partnerId: String!
|
|
491
|
+
$storeChannel: String!
|
|
492
|
+
$category: String
|
|
493
|
+
) {
|
|
494
|
+
getProducts(
|
|
495
|
+
partnerId: $partnerId
|
|
496
|
+
storeChannel: $storeChannel
|
|
497
|
+
category: $category
|
|
498
|
+
) {
|
|
499
|
+
total
|
|
500
|
+
currentPage
|
|
501
|
+
maxResult
|
|
502
|
+
totalPage
|
|
503
|
+
data {
|
|
504
|
+
id
|
|
505
|
+
title
|
|
506
|
+
subType
|
|
507
|
+
description
|
|
508
|
+
sku
|
|
509
|
+
shortDescription
|
|
510
|
+
weight
|
|
511
|
+
width
|
|
512
|
+
depth
|
|
513
|
+
height
|
|
514
|
+
vat
|
|
515
|
+
qualify
|
|
516
|
+
parentId
|
|
517
|
+
handle
|
|
518
|
+
price
|
|
519
|
+
priceType
|
|
520
|
+
salePolicy
|
|
521
|
+
priceTypeName
|
|
522
|
+
priceVaries
|
|
523
|
+
available
|
|
524
|
+
tags
|
|
525
|
+
options
|
|
526
|
+
optionsRelationship
|
|
527
|
+
compareAtPrice
|
|
528
|
+
featuredImage
|
|
529
|
+
images
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
`;
|
|
@@ -37,4 +37,6 @@ export declare class ProductService extends Service {
|
|
|
37
37
|
getStores(type: string): Promise<any>;
|
|
38
38
|
getDetailStores(): Promise<any>;
|
|
39
39
|
getProductImage: (productId: string) => Promise<any>;
|
|
40
|
+
getCategory(typeBuild: string, level: number): Promise<any>;
|
|
41
|
+
getProduct(category: string): Promise<any>;
|
|
40
42
|
}
|
|
@@ -176,5 +176,40 @@ class ProductService extends serviceSDK_1.Service {
|
|
|
176
176
|
}
|
|
177
177
|
});
|
|
178
178
|
}
|
|
179
|
+
getCategory(typeBuild, level) {
|
|
180
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
181
|
+
const query = queries_1.GET_CATEGORIES_QUERY;
|
|
182
|
+
const variables = {
|
|
183
|
+
partnerId: this.orgId,
|
|
184
|
+
storeChannel: this.storeId,
|
|
185
|
+
typeBuild,
|
|
186
|
+
level,
|
|
187
|
+
};
|
|
188
|
+
try {
|
|
189
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
190
|
+
return response.getCategories;
|
|
191
|
+
}
|
|
192
|
+
catch (error) {
|
|
193
|
+
throw error;
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
getProduct(category) {
|
|
198
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
199
|
+
const query = queries_1.GET_PRODUCT;
|
|
200
|
+
const variables = {
|
|
201
|
+
partnerId: this.orgId,
|
|
202
|
+
storeChannel: this.storeId,
|
|
203
|
+
category
|
|
204
|
+
};
|
|
205
|
+
try {
|
|
206
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
207
|
+
return response.getProducts;
|
|
208
|
+
}
|
|
209
|
+
catch (error) {
|
|
210
|
+
throw error;
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
}
|
|
179
214
|
}
|
|
180
215
|
exports.ProductService = ProductService;
|