@longvansoftware/storefront-js-client 2.0.2 → 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.
@@ -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($partnerId: String!, $storeChannel: String!, $productId: String!) {
94
- getProductById(partnerId: $partnerId, storeChannel: $storeChannel, productId: $productId) {
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($partnerId: String!, $storeChannel: String!, $handle: String!) {
148
- getProductByHandle(partnerId: $partnerId, storeChannel: $storeChannel, handle: $handle) {
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($partnerId: String!, $storeChannel: String!, $handle: String!) {
297
- getCategoryByHandle(partnerId: $partnerId, storeChannel: $storeChannel, handle: $handle) {
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($partnerId: String!, $storeChannel: String!, $categoryId: String!) {
319
- getCategoryById(partnerId: $partnerId, storeChannel: $storeChannel, categoryId: $categoryId) {
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($partnerId: String!, $storeChannel: String!, $productId: String!) {
371
- getProductOption(partnerId: $partnerId, storeChannel: $storeChannel, productId: $productId) {
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longvansoftware/storefront-js-client",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "files": [