@longvansoftware/storefront-js-client 4.5.1 → 4.5.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.
@@ -28,3 +28,6 @@ export declare const CREATE_PRODUCT: import("graphql").DocumentNode;
28
28
  export declare const REMOVE_PRODUCT: import("graphql").DocumentNode;
29
29
  export declare const UPDATE_PRODUCT_SUBTYPE: import("graphql").DocumentNode;
30
30
  export declare const UPDATE_ATTRIBUTE_METADATA: import("graphql").DocumentNode;
31
+ export declare const CREATE_TAG: import("graphql").DocumentNode;
32
+ export declare const ADD_PRODUCT_TAG: import("graphql").DocumentNode;
33
+ export declare const REMOVE_PRODUCT_TAG: import("graphql").DocumentNode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UPDATE_ATTRIBUTE_METADATA = exports.UPDATE_PRODUCT_SUBTYPE = exports.REMOVE_PRODUCT = exports.CREATE_PRODUCT = exports.REMOVE_IMAGE = exports.REMOVE_PRODUCT_IMAGES = exports.BUILD_PRODUCT_PREBUILD_BY_STORE = exports.BUILD_PRODUCT_PREBUILD_BY_PRODUCT = exports.CREATE_PRODUCT_IMAGES = exports.CREATE_UNIT = exports.CREATE_BRAND = exports.CREATE_CATEGORY = exports.CREATE_GROUP = exports.UPDATE_PRODUCT_VAT = exports.UPDATE_PRODUCT_SKU = exports.CREATE_PRODUCT_VARIANT = exports.REMOVE_PRODUCT_ATTRIBUTE = exports.UPDATE_PRODUCT_ATTRIBUTE = exports.UPDATE_PRODUCT_BRAND = exports.SAVE_PRODUCT_DRAFT = exports.ADD_PRODUCT_ATTRIBUTE = exports.CREATE_PRODUCT_FROM_TEMPLATE = exports.CREATE_PRODUCT_TEMPLATES_BY_PARTNER = 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;
3
+ exports.REMOVE_PRODUCT_TAG = exports.ADD_PRODUCT_TAG = exports.CREATE_TAG = exports.UPDATE_ATTRIBUTE_METADATA = exports.UPDATE_PRODUCT_SUBTYPE = exports.REMOVE_PRODUCT = exports.CREATE_PRODUCT = exports.REMOVE_IMAGE = exports.REMOVE_PRODUCT_IMAGES = exports.BUILD_PRODUCT_PREBUILD_BY_STORE = exports.BUILD_PRODUCT_PREBUILD_BY_PRODUCT = exports.CREATE_PRODUCT_IMAGES = exports.CREATE_UNIT = exports.CREATE_BRAND = exports.CREATE_CATEGORY = exports.CREATE_GROUP = exports.UPDATE_PRODUCT_VAT = exports.UPDATE_PRODUCT_SKU = exports.CREATE_PRODUCT_VARIANT = exports.REMOVE_PRODUCT_ATTRIBUTE = exports.UPDATE_PRODUCT_ATTRIBUTE = exports.UPDATE_PRODUCT_BRAND = exports.SAVE_PRODUCT_DRAFT = exports.ADD_PRODUCT_ATTRIBUTE = exports.CREATE_PRODUCT_FROM_TEMPLATE = exports.CREATE_PRODUCT_TEMPLATES_BY_PARTNER = 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
4
  const graphql_tag_1 = require("graphql-tag");
5
5
  exports.UPDATE_PRODUCT_TITLE = (0, graphql_tag_1.gql) `
6
6
  mutation UpdateProductTitle(
@@ -701,3 +701,54 @@ exports.UPDATE_ATTRIBUTE_METADATA = (0, graphql_tag_1.gql) `
701
701
  }
702
702
  }
703
703
  `;
704
+ exports.CREATE_TAG = (0, graphql_tag_1.gql) `
705
+ mutation CreateTag(
706
+ $partnerId: String!
707
+ $name: String!
708
+ $slug: String!
709
+ $createdBy: String!
710
+ ) {
711
+ createTag(
712
+ partnerId: $partnerId
713
+ name: $name
714
+ slug: $slug
715
+ createdBy: $createdBy
716
+ ) {
717
+ id
718
+ name
719
+ slug
720
+ type
721
+ scope
722
+ storeIds
723
+ selected
724
+ }
725
+ }
726
+ `;
727
+ exports.ADD_PRODUCT_TAG = (0, graphql_tag_1.gql) `
728
+ mutation AddProductTag(
729
+ $productId: String!
730
+ $tagId: String!
731
+ $updatedBy: String!
732
+ ) {
733
+ addProductTag(productId: $productId, tagId: $tagId, updatedBy: $updatedBy) {
734
+ status
735
+ message
736
+ }
737
+ }
738
+ `;
739
+ exports.REMOVE_PRODUCT_TAG = (0, graphql_tag_1.gql) `
740
+ mutation RemoveProductTag(
741
+ $productId: String!
742
+ $tagId: String!
743
+ $updatedBy: String!
744
+ ) {
745
+ removeProductTag(
746
+ productId: $productId
747
+ tagId: $tagId
748
+ updatedBy: $updatedBy
749
+ ) {
750
+ status
751
+ message
752
+ }
753
+ }
754
+ `;
@@ -23,3 +23,4 @@ export declare const GET_TAGS: import("graphql").DocumentNode;
23
23
  export declare const GET_PRODUCT_BY_GROUPID: import("graphql").DocumentNode;
24
24
  export declare const GET_CATEGORY_BY_ID: import("graphql").DocumentNode;
25
25
  export declare const GET_CATEGORY_BY_HANDLE: import("graphql").DocumentNode;
26
+ export declare const GET_TAGS_BY_PRODUCT: import("graphql").DocumentNode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GET_CATEGORY_BY_HANDLE = exports.GET_CATEGORY_BY_ID = exports.GET_PRODUCT_BY_GROUPID = exports.GET_TAGS = exports.GET_BRAND = exports.GET_GROUPS = exports.GET_PRODUCT_TEMPLATES = exports.GET_PRODUCT_VARIANT_BY_ID = 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_SIMPLE_PRODUCT_BY_ID_QUERY = exports.GET_PRODUCT_BY_ID_QUERY = void 0;
3
+ exports.GET_TAGS_BY_PRODUCT = exports.GET_CATEGORY_BY_HANDLE = exports.GET_CATEGORY_BY_ID = exports.GET_PRODUCT_BY_GROUPID = exports.GET_TAGS = exports.GET_BRAND = exports.GET_GROUPS = exports.GET_PRODUCT_TEMPLATES = exports.GET_PRODUCT_VARIANT_BY_ID = 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_SIMPLE_PRODUCT_BY_ID_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(
@@ -120,7 +120,15 @@ exports.GET_PRODUCT_BY_ID_QUERY = (0, graphql_tag_1.gql) `
120
120
  compareAtPrice
121
121
  featuredImage
122
122
  images
123
- tags
123
+ tags {
124
+ id
125
+ name
126
+ slug
127
+ type
128
+ scope
129
+ storeIds
130
+ selected
131
+ }
124
132
  brand {
125
133
  id
126
134
  createStamp
@@ -241,7 +249,15 @@ exports.GET_SIMPLE_PRODUCT_BY_ID_QUERY = (0, graphql_tag_1.gql) `
241
249
  compareAtPrice
242
250
  featuredImage
243
251
  images
244
- tags
252
+ tags {
253
+ id
254
+ name
255
+ slug
256
+ type
257
+ scope
258
+ storeIds
259
+ selected
260
+ }
245
261
  version
246
262
  brand {
247
263
  id
@@ -376,7 +392,15 @@ exports.GET_PRODUCT_BY_SLUG_QUERY = (0, graphql_tag_1.gql) `
376
392
  priceTypeName
377
393
  priceVaries
378
394
  available
379
- tags
395
+ tags {
396
+ id
397
+ name
398
+ slug
399
+ type
400
+ scope
401
+ storeIds
402
+ selected
403
+ }
380
404
  options
381
405
  optionsRelationship
382
406
  compareAtPrice
@@ -487,7 +511,7 @@ exports.GET_SIMPLE_PRODUCTS_QUERY = (0, graphql_tag_1.gql) `
487
511
  onlyPromotion: $onlyPromotion
488
512
  currentPage: $currentPage
489
513
  maxResult: $maxResult
490
- feature:$feature
514
+ feature: $feature
491
515
  ) {
492
516
  total
493
517
  currentPage
@@ -503,6 +527,15 @@ exports.GET_SIMPLE_PRODUCTS_QUERY = (0, graphql_tag_1.gql) `
503
527
  vat
504
528
  qualify
505
529
  parentId
530
+ tags {
531
+ id
532
+ name
533
+ slug
534
+ type
535
+ scope
536
+ storeIds
537
+ selected
538
+ }
506
539
  handle
507
540
  price
508
541
  compareAtPrice
@@ -787,7 +820,15 @@ exports.GET_PRODUCT = (0, graphql_tag_1.gql) `
787
820
  priceTypeName
788
821
  priceVaries
789
822
  available
790
- tags
823
+ tags {
824
+ id
825
+ name
826
+ slug
827
+ type
828
+ scope
829
+ storeIds
830
+ selected
831
+ }
791
832
  options
792
833
  optionsRelationship
793
834
  compareAtPrice
@@ -861,7 +902,7 @@ exports.GET_PRODUCT_VARIANT_BY_ID = (0, graphql_tag_1.gql) `
861
902
  priceTypeName
862
903
  priceVaries
863
904
  available
864
- tags
905
+
865
906
  options
866
907
  optionsRelationship
867
908
  compareAtPrice
@@ -896,7 +937,6 @@ exports.GET_PRODUCT_TEMPLATES = (0, graphql_tag_1.gql) `
896
937
  priceTypeName
897
938
  priceVaries
898
939
  available
899
- tags
900
940
  options
901
941
  optionsRelationship
902
942
  compareAtPrice
@@ -982,7 +1022,15 @@ exports.GET_PRODUCT_BY_GROUPID = (0, graphql_tag_1.gql) `
982
1022
  priceTypeName
983
1023
  priceVaries
984
1024
  available
985
- tags
1025
+ tags {
1026
+ id
1027
+ name
1028
+ slug
1029
+ type
1030
+ scope
1031
+ storeIds
1032
+ selected
1033
+ }
986
1034
  options
987
1035
  optionsRelationship
988
1036
  compareAtPrice
@@ -1112,3 +1160,24 @@ exports.GET_CATEGORY_BY_HANDLE = (0, graphql_tag_1.gql) `
1112
1160
  }
1113
1161
  }
1114
1162
  `;
1163
+ exports.GET_TAGS_BY_PRODUCT = (0, graphql_tag_1.gql) `
1164
+ query GetTagsByProduct(
1165
+ $partnerId: String!
1166
+ $storeChannel: String!
1167
+ $productId: String!
1168
+ ) {
1169
+ getTagsByProduct(
1170
+ partnerId: $partnerId
1171
+ storeChannel: $storeChannel
1172
+ productId: $productId
1173
+ ) {
1174
+ id
1175
+ name
1176
+ slug
1177
+ type
1178
+ scope
1179
+ storeIds
1180
+ selected
1181
+ }
1182
+ }
1183
+ `;
@@ -81,4 +81,8 @@ export declare class ProductService extends Service {
81
81
  getCategoryById(categoryId: string): Promise<any>;
82
82
  getCategoryByHandle(handle: string): Promise<any>;
83
83
  updateAttributeMetadata(productId: string, attributeId: string, attributeMetadata: any): Promise<any>;
84
+ createTag(dataTag: any): Promise<any>;
85
+ addProductTag(dataTag: any): Promise<any>;
86
+ removeProductTag(dataTag: any): Promise<any>;
87
+ getTagsByProduct(productId: string): Promise<any>;
84
88
  }
@@ -913,5 +913,59 @@ class ProductService extends serviceSDK_1.Service {
913
913
  }
914
914
  });
915
915
  }
916
+ createTag(dataTag) {
917
+ return __awaiter(this, void 0, void 0, function* () {
918
+ const mutation = mutations_1.CREATE_TAG;
919
+ const variables = Object.assign({ partnerId: this.orgId }, dataTag);
920
+ try {
921
+ const response = yield this.graphqlMutation(mutation, variables);
922
+ return response.createTag;
923
+ }
924
+ catch (error) {
925
+ throw error;
926
+ }
927
+ });
928
+ }
929
+ addProductTag(dataTag) {
930
+ return __awaiter(this, void 0, void 0, function* () {
931
+ const mutation = mutations_1.ADD_PRODUCT_TAG;
932
+ try {
933
+ const response = yield this.graphqlMutation(mutation, dataTag);
934
+ return response.addProductTag;
935
+ }
936
+ catch (error) {
937
+ throw error;
938
+ }
939
+ });
940
+ }
941
+ removeProductTag(dataTag) {
942
+ return __awaiter(this, void 0, void 0, function* () {
943
+ const mutation = mutations_1.REMOVE_PRODUCT_TAG;
944
+ try {
945
+ const response = yield this.graphqlMutation(mutation, dataTag);
946
+ return response.removeProductTag;
947
+ }
948
+ catch (error) {
949
+ throw error;
950
+ }
951
+ });
952
+ }
953
+ getTagsByProduct(productId) {
954
+ return __awaiter(this, void 0, void 0, function* () {
955
+ const queries = queries_1.GET_TAGS_BY_PRODUCT;
956
+ const variables = {
957
+ partnerId: this.orgId,
958
+ storeChannel: this.storeId,
959
+ productId,
960
+ };
961
+ try {
962
+ const response = yield this.graphqlQuery(queries, variables);
963
+ return response.getTagsByProduct;
964
+ }
965
+ catch (error) {
966
+ throw error;
967
+ }
968
+ });
969
+ }
916
970
  }
917
971
  exports.ProductService = ProductService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longvansoftware/storefront-js-client",
3
- "version": "4.5.1",
3
+ "version": "4.5.3",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "files": [