@longvansoftware/service-js-client 1.1.7 → 1.1.8

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.
@@ -11,3 +11,5 @@ export declare const GET_PRODUCT_OPTION: import("graphql").DocumentNode;
11
11
  export declare const GET_POLICY: import("graphql").DocumentNode;
12
12
  export declare const GET_PRODUCTS: import("graphql").DocumentNode;
13
13
  export declare const GET_HANDLE_BY_SERVICETYPE: import("graphql").DocumentNode;
14
+ export declare const GET_RESOURCE_BY_PRODUCT: import("graphql").DocumentNode;
15
+ export declare const GET_PRODUCT_VARIANT_BY_ID: import("graphql").DocumentNode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GET_HANDLE_BY_SERVICETYPE = exports.GET_PRODUCTS = 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_VARIANT_BY_ID = exports.GET_RESOURCE_BY_PRODUCT = exports.GET_HANDLE_BY_SERVICETYPE = exports.GET_PRODUCTS = 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(
@@ -627,3 +627,114 @@ exports.GET_HANDLE_BY_SERVICETYPE = (0, graphql_tag_1.gql) `
627
627
  )
628
628
  }
629
629
  `;
630
+ exports.GET_RESOURCE_BY_PRODUCT = (0, graphql_tag_1.gql) `
631
+ query getResourceByProduct(
632
+ $partnerId: String!
633
+ $storeChannel: String!
634
+ $productId: String!
635
+ ) {
636
+ getResourceByProduct(
637
+ partnerId: $partnerId
638
+ storeChannel: $storeChannel
639
+ productId: $productId
640
+ ) {
641
+ id
642
+ quantity
643
+ qualify
644
+ handle
645
+ unitDTO {
646
+ id
647
+ name
648
+ }
649
+ productId
650
+ productName
651
+ groupName
652
+ price
653
+ }
654
+ }
655
+ `;
656
+ exports.GET_PRODUCT_VARIANT_BY_ID = (0, graphql_tag_1.gql) `
657
+ query GetProductVariantById(
658
+ $partnerId: String!
659
+ $storeChannel: String!
660
+ $variantId: String!
661
+ ) {
662
+ getProductVariantById(
663
+ partnerId: $partnerId
664
+ storeChannel: $storeChannel
665
+ variantId: $variantId
666
+ ) {
667
+ id
668
+ title
669
+ description
670
+ sku
671
+ shortDescription
672
+ weight
673
+ width
674
+ depth
675
+ height
676
+ vat
677
+ unitDTO {
678
+ id
679
+ name
680
+ }
681
+ productAttributes {
682
+ attributeName
683
+ attributeValue
684
+ }
685
+ qualify
686
+ parentId
687
+ handle
688
+ price
689
+ priceType
690
+ salePolicy
691
+ priceTypeName
692
+ priceVaries
693
+ available
694
+ tags
695
+ options
696
+ optionsRelationship
697
+ compareAtPrice
698
+ featuredImage
699
+ images
700
+ variants {
701
+ id
702
+ handle
703
+ title
704
+ price
705
+ compareAtPrice
706
+ options
707
+ optionsIds
708
+ featuredImage
709
+ sku
710
+ }
711
+ featureTypes {
712
+ id
713
+ name
714
+ position
715
+ type
716
+ subType
717
+ fill
718
+ requireData
719
+ values
720
+ createStamp
721
+ createdBy
722
+ }
723
+ categories {
724
+ id
725
+ title
726
+ image
727
+ icon
728
+ parentId
729
+ level
730
+ handle
731
+ }
732
+ groups {
733
+ id
734
+ name
735
+ policy
736
+ image
737
+ }
738
+ }
739
+ }
740
+ `;
@@ -36,4 +36,6 @@ export declare class ProductService extends Service {
36
36
  getPolicy(groupId: string): Promise<any>;
37
37
  getProducts(param: getProduct): Promise<any>;
38
38
  getHandleByServiceTypes(serviceTypes: [string]): Promise<any>;
39
+ getResourceByProduct(productId: string): Promise<any>;
40
+ getProductVariantById(variantId: string): Promise<any>;
39
41
  }
@@ -160,5 +160,41 @@ class ProductService extends serviceSDK_1.Service {
160
160
  }
161
161
  });
162
162
  }
163
+ getResourceByProduct(productId) {
164
+ return __awaiter(this, void 0, void 0, function* () {
165
+ const query = queries_1.GET_RESOURCE_BY_PRODUCT;
166
+ const variablesHandle = {
167
+ partnerId: this.orgId,
168
+ storeChannel: this.storeId,
169
+ productId,
170
+ };
171
+ try {
172
+ const response = yield this.graphqlQueryV2(query, variablesHandle);
173
+ return response.getResourceByProduct;
174
+ }
175
+ catch (error) {
176
+ console.log(`Error fetching getResourceByProduct error : ${error}`);
177
+ throw error;
178
+ }
179
+ });
180
+ }
181
+ getProductVariantById(variantId) {
182
+ return __awaiter(this, void 0, void 0, function* () {
183
+ const query = queries_1.GET_PRODUCT_VARIANT_BY_ID;
184
+ const variablesHandle = {
185
+ partnerId: this.orgId,
186
+ storeChannel: this.storeId,
187
+ variantId,
188
+ };
189
+ try {
190
+ const response = yield this.graphqlQueryV2(query, variablesHandle);
191
+ return response.getProductVariantById;
192
+ }
193
+ catch (error) {
194
+ console.log(`Error fetching getProductVariantById error : ${error}`);
195
+ throw error;
196
+ }
197
+ });
198
+ }
163
199
  }
164
200
  exports.ProductService = ProductService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longvansoftware/service-js-client",
3
- "version": "1.1.7",
3
+ "version": "1.1.8",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "files": [