@longvansoftware/storefront-js-client 4.6.9 → 4.7.1

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.
@@ -90,16 +90,8 @@ 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
- $partnerId: String!
95
- $storeChannel: String!
96
- $productId: String!
97
- ) {
98
- getProductById(
99
- partnerId: $partnerId
100
- storeChannel: $storeChannel
101
- productId: $productId
102
- ) {
93
+ query GetProductById($partnerId: String!, $storeChannel: String!, $productId: String!) {
94
+ getProductById(partnerId: $partnerId, storeChannel: $storeChannel, productId: $productId) {
103
95
  id
104
96
  title
105
97
  description
@@ -210,16 +202,8 @@ exports.GET_PRODUCT_BY_ID_QUERY = (0, graphql_tag_1.gql) `
210
202
  }
211
203
  `;
212
204
  exports.GET_SIMPLE_PRODUCT_BY_ID_QUERY = (0, graphql_tag_1.gql) `
213
- query GetSimpleProductById(
214
- $partnerId: String!
215
- $storeChannel: String!
216
- $productId: String!
217
- ) {
218
- getSimpleProductById(
219
- partnerId: $partnerId
220
- storeChannel: $storeChannel
221
- productId: $productId
222
- ) {
205
+ query GetSimpleProductById($partnerId: String!, $storeChannel: String!, $productId: String!) {
206
+ getSimpleProductById(partnerId: $partnerId, storeChannel: $storeChannel, productId: $productId) {
223
207
  id
224
208
  title
225
209
  description
@@ -340,16 +324,8 @@ exports.GET_SIMPLE_PRODUCT_BY_ID_QUERY = (0, graphql_tag_1.gql) `
340
324
  }
341
325
  `;
342
326
  exports.GET_PRODUCT_BY_SLUG_QUERY = (0, graphql_tag_1.gql) `
343
- query GetProductByHandle(
344
- $partnerId: String!
345
- $storeChannel: String!
346
- $handle: String!
347
- ) {
348
- getProductByHandle(
349
- partnerId: $partnerId
350
- storeChannel: $storeChannel
351
- handle: $handle
352
- ) {
327
+ query GetProductByHandle($partnerId: String!, $storeChannel: String!, $handle: String!) {
328
+ getProductByHandle(partnerId: $partnerId, storeChannel: $storeChannel, handle: $handle) {
353
329
  id
354
330
  title
355
331
  subType
@@ -533,18 +509,8 @@ exports.GET_SIMPLE_PRODUCTS_QUERY = (0, graphql_tag_1.gql) `
533
509
  }
534
510
  `;
535
511
  exports.GET_CATEGORIES_QUERY = (0, graphql_tag_1.gql) `
536
- query GetCategories(
537
- $partnerId: String!
538
- $storeChannel: String!
539
- $typeBuild: String!
540
- $level: Int!
541
- ) {
542
- getCategories(
543
- partnerId: $partnerId
544
- storeChannel: $storeChannel
545
- typeBuild: $typeBuild
546
- level: $level
547
- ) {
512
+ query GetCategories($partnerId: String!, $storeChannel: String!, $typeBuild: String!, $level: Int!) {
513
+ getCategories(partnerId: $partnerId, storeChannel: $storeChannel, typeBuild: $typeBuild, level: $level) {
548
514
  id
549
515
  title
550
516
  image
@@ -567,16 +533,8 @@ exports.GET_CATEGORIES_QUERY = (0, graphql_tag_1.gql) `
567
533
  }
568
534
  `;
569
535
  exports.GET_CATEGORY_BY_HANDLE_QUERY = (0, graphql_tag_1.gql) `
570
- query GetCategoryByHandle(
571
- $partnerId: String!
572
- $storeChannel: String!
573
- $handle: String!
574
- ) {
575
- getCategoryByHandle(
576
- partnerId: $partnerId
577
- storeChannel: $storeChannel
578
- handle: $handle
579
- ) {
536
+ query GetCategoryByHandle($partnerId: String!, $storeChannel: String!, $handle: String!) {
537
+ getCategoryByHandle(partnerId: $partnerId, storeChannel: $storeChannel, handle: $handle) {
580
538
  id
581
539
  title
582
540
  image
@@ -597,16 +555,8 @@ exports.GET_CATEGORY_BY_HANDLE_QUERY = (0, graphql_tag_1.gql) `
597
555
  }
598
556
  `;
599
557
  exports.GET_CATEGORY_BY_ID_QUERY = (0, graphql_tag_1.gql) `
600
- query GetCategoryById(
601
- $partnerId: String!
602
- $storeChannel: String!
603
- $categoryId: String!
604
- ) {
605
- getCategoryById(
606
- partnerId: $partnerId
607
- storeChannel: $storeChannel
608
- categoryId: $categoryId
609
- ) {
558
+ query GetCategoryById($partnerId: String!, $storeChannel: String!, $categoryId: String!) {
559
+ getCategoryById(partnerId: $partnerId, storeChannel: $storeChannel, categoryId: $categoryId) {
610
560
  id
611
561
  title
612
562
  image
@@ -657,16 +607,8 @@ exports.GET_BRAND_DETAIL_QUERY = `
657
607
  }
658
608
  `;
659
609
  exports.GET_PRODUCT_OPTION = (0, graphql_tag_1.gql) `
660
- query GetProductOption(
661
- $partnerId: String!
662
- $storeChannel: String!
663
- $productId: String!
664
- ) {
665
- getProductOption(
666
- partnerId: $partnerId
667
- storeChannel: $storeChannel
668
- productId: $productId
669
- ) {
610
+ query GetProductOption($partnerId: String!, $storeChannel: String!, $productId: String!) {
611
+ getProductOption(partnerId: $partnerId, storeChannel: $storeChannel, productId: $productId) {
670
612
  id
671
613
  name
672
614
  subType
@@ -714,18 +656,8 @@ exports.GET_STORES = (0, graphql_tag_1.gql) `
714
656
  }
715
657
  `;
716
658
  exports.GET_STORES_V2 = (0, graphql_tag_1.gql) `
717
- query GetStores(
718
- $partnerId: String!
719
- $enable: Boolean
720
- $type: String
721
- $enablePortal: Boolean
722
- ) {
723
- getStores(
724
- partnerId: $partnerId
725
- enable: $enable
726
- type: $type
727
- enablePortal: $enablePortal
728
- ) {
659
+ query GetStores($partnerId: String!, $enable: Boolean, $type: String, $enablePortal: Boolean) {
660
+ getStores(partnerId: $partnerId, enable: $enable, type: $type, enablePortal: $enablePortal) {
729
661
  id
730
662
  createdStamp
731
663
  name
@@ -803,22 +735,8 @@ exports.GET_PRODUCT_IMAGE = (0, graphql_tag_1.gql) `
803
735
  }
804
736
  `;
805
737
  exports.GET_PRODUCT = (0, graphql_tag_1.gql) `
806
- query GetProducts(
807
- $partnerId: String!
808
- $storeChannel: String!
809
- $keyword: String
810
- $category: String
811
- $currentPage: Int
812
- $maxResult: Int
813
- ) {
814
- getProducts(
815
- partnerId: $partnerId
816
- storeChannel: $storeChannel
817
- keyword: $keyword
818
- category: $category
819
- currentPage: $currentPage
820
- maxResult: $maxResult
821
- ) {
738
+ query GetProducts($partnerId: String!, $storeChannel: String!, $keyword: String, $category: String, $currentPage: Int, $maxResult: Int) {
739
+ getProducts(partnerId: $partnerId, storeChannel: $storeChannel, keyword: $keyword, category: $category, currentPage: $currentPage, maxResult: $maxResult) {
822
740
  total
823
741
  currentPage
824
742
  maxResult
@@ -882,16 +800,8 @@ exports.GET_UNITS = (0, graphql_tag_1.gql) `
882
800
  }
883
801
  `;
884
802
  exports.GET_PRODUCT_VARIANT_BY_ID = (0, graphql_tag_1.gql) `
885
- query GetProductVariantById(
886
- $partnerId: String!
887
- $storeChannel: String!
888
- $variantId: String!
889
- ) {
890
- getProductVariantById(
891
- partnerId: $partnerId
892
- storeChannel: $storeChannel
893
- variantId: $variantId
894
- ) {
803
+ query GetProductVariantById($partnerId: String!, $storeChannel: String!, $variantId: String!) {
804
+ getProductVariantById(partnerId: $partnerId, storeChannel: $storeChannel, variantId: $variantId) {
895
805
  id
896
806
  title
897
807
  subType
@@ -997,16 +907,8 @@ exports.GET_TAGS = (0, graphql_tag_1.gql) `
997
907
  }
998
908
  `;
999
909
  exports.GET_PRODUCT_BY_GROUPID = (0, graphql_tag_1.gql) `
1000
- query GetProducts(
1001
- $partnerId: String!
1002
- $storeChannel: String!
1003
- $group: String
1004
- ) {
1005
- getProducts(
1006
- partnerId: $partnerId
1007
- storeChannel: $storeChannel
1008
- group: $group
1009
- ) {
910
+ query GetProducts($partnerId: String!, $storeChannel: String!, $group: String) {
911
+ getProducts(partnerId: $partnerId, storeChannel: $storeChannel, group: $group) {
1010
912
  total
1011
913
  currentPage
1012
914
  maxResult
@@ -1103,16 +1005,8 @@ exports.GET_PRODUCT_BY_GROUPID = (0, graphql_tag_1.gql) `
1103
1005
  }
1104
1006
  `;
1105
1007
  exports.GET_CATEGORY_BY_ID = (0, graphql_tag_1.gql) `
1106
- query GetCategoryById(
1107
- $partnerId: String!
1108
- $storeChannel: String!
1109
- $categoryId: String!
1110
- ) {
1111
- getCategoryById(
1112
- partnerId: $partnerId
1113
- storeChannel: $storeChannel
1114
- categoryId: $categoryId
1115
- ) {
1008
+ query GetCategoryById($partnerId: String!, $storeChannel: String!, $categoryId: String!) {
1009
+ getCategoryById(partnerId: $partnerId, storeChannel: $storeChannel, categoryId: $categoryId) {
1116
1010
  id
1117
1011
  title
1118
1012
  image
@@ -1135,16 +1029,8 @@ exports.GET_CATEGORY_BY_ID = (0, graphql_tag_1.gql) `
1135
1029
  }
1136
1030
  `;
1137
1031
  exports.GET_CATEGORY_BY_HANDLE = (0, graphql_tag_1.gql) `
1138
- query GetCategoryByHandle(
1139
- $partnerId: String!
1140
- $storeChannel: String!
1141
- $handle: String!
1142
- ) {
1143
- getCategoryByHandle(
1144
- partnerId: $partnerId
1145
- storeChannel: $storeChannel
1146
- handle: $handle
1147
- ) {
1032
+ query GetCategoryByHandle($partnerId: String!, $storeChannel: String!, $handle: String!) {
1033
+ getCategoryByHandle(partnerId: $partnerId, storeChannel: $storeChannel, handle: $handle) {
1148
1034
  id
1149
1035
  title
1150
1036
  image
@@ -1167,16 +1053,8 @@ exports.GET_CATEGORY_BY_HANDLE = (0, graphql_tag_1.gql) `
1167
1053
  }
1168
1054
  `;
1169
1055
  exports.GET_TAGS_BY_PRODUCT = (0, graphql_tag_1.gql) `
1170
- query GetTagsByProduct(
1171
- $partnerId: String!
1172
- $storeChannel: String!
1173
- $productId: String!
1174
- ) {
1175
- getTagsByProduct(
1176
- partnerId: $partnerId
1177
- storeChannel: $storeChannel
1178
- productId: $productId
1179
- ) {
1056
+ query GetTagsByProduct($partnerId: String!, $storeChannel: String!, $productId: String!) {
1057
+ getTagsByProduct(partnerId: $partnerId, storeChannel: $storeChannel, productId: $productId) {
1180
1058
  id
1181
1059
  name
1182
1060
  slug
@@ -1242,16 +1120,8 @@ exports.GET_PRODUCT_STORE_PUBLIC = (0, graphql_tag_1.gql) `
1242
1120
  }
1243
1121
  `;
1244
1122
  exports.GET_PRODUCT_MARKET_PLACE = (0, graphql_tag_1.gql) `
1245
- query GetProductMarketplace(
1246
- $storeChannel: String!
1247
- $currentPage: Int
1248
- $maxResult: Int
1249
- ) {
1250
- getProductMarketplace(
1251
- storeChannel: $storeChannel
1252
- currentPage: $currentPage
1253
- maxResult: $maxResult
1254
- ) {
1123
+ query GetProductMarketplace($storeChannel: String!, $currentPage: Int, $maxResult: Int) {
1124
+ getProductMarketplace(storeChannel: $storeChannel, currentPage: $currentPage, maxResult: $maxResult) {
1255
1125
  total
1256
1126
  currentPage
1257
1127
  maxResult
@@ -1272,6 +1142,7 @@ exports.GET_PRODUCT_MARKET_PLACE = (0, graphql_tag_1.gql) `
1272
1142
  qualify
1273
1143
  parentId
1274
1144
  handle
1145
+ slug
1275
1146
  price
1276
1147
  displayPrice
1277
1148
  hint
@@ -1363,14 +1234,8 @@ exports.GET_PRODUCT_MARKET_PLACE = (0, graphql_tag_1.gql) `
1363
1234
  }
1364
1235
  `;
1365
1236
  exports.GET_PRODUCT_MARKET_PLACE_DETAIL_BY_SLUG = (0, graphql_tag_1.gql) `
1366
- query GetProductMarketplaceDetailBySlug(
1367
- $storeChannel: String!
1368
- $slug: String!
1369
- ) {
1370
- getProductMarketplaceDetailBySlug(
1371
- storeChannel: $storeChannel
1372
- slug: $slug
1373
- ) {
1237
+ query GetProductMarketplaceDetailBySlug($storeChannel: String!, $slug: String!) {
1238
+ getProductMarketplaceDetailBySlug(storeChannel: $storeChannel, slug: $slug) {
1374
1239
  partyId
1375
1240
  id
1376
1241
  title
@@ -1609,18 +1474,8 @@ exports.GET_PRODUCT_MARKET_PLACE_BY_ID = (0, graphql_tag_1.gql) `
1609
1474
  }
1610
1475
  `;
1611
1476
  exports.GET_PRODUCT_MARKET_PLACE_BY_SUPPLIER = (0, graphql_tag_1.gql) `
1612
- query GetProductMarketplaceBySupplier(
1613
- $storeChannel: String!
1614
- $supplierId: String!
1615
- $currentPage: Int
1616
- $maxResult: Int
1617
- ) {
1618
- getProductMarketplaceBySupplier(
1619
- storeChannel: $storeChannel
1620
- supplierId: $supplierId
1621
- currentPage: $currentPage
1622
- maxResult: $maxResult
1623
- ) {
1477
+ query GetProductMarketplaceBySupplier($storeChannel: String!, $supplierId: String!, $currentPage: Int, $maxResult: Int) {
1478
+ getProductMarketplaceBySupplier(storeChannel: $storeChannel, supplierId: $supplierId, currentPage: $currentPage, maxResult: $maxResult) {
1624
1479
  total
1625
1480
  currentPage
1626
1481
  maxResult
@@ -18,6 +18,7 @@ export declare class ProductService extends Service {
18
18
  * @throws If an error occurs while fetching the product.
19
19
  */
20
20
  getProductById(productId: string): Promise<any>;
21
+ getProductByIdV2(productId: string): Promise<any>;
21
22
  getSimpleProductById(productId: string): Promise<any>;
22
23
  /**
23
24
  * Retrieves a product by its slug.
@@ -42,6 +43,7 @@ export declare class ProductService extends Service {
42
43
  getProductImage: (productId: string) => Promise<any>;
43
44
  getCategory(typeBuild: string, level: number, storeId: string): Promise<any>;
44
45
  getProduct(dataQuery: any): Promise<any>;
46
+ getProductV2(dataQuery: any): Promise<any>;
45
47
  updateProductTitle(productId: string, title: string, updatedBy: string): Promise<any>;
46
48
  updatePrice(productId: string, price: string, updatedBy: string): Promise<any>;
47
49
  updatePricePromotion(productId: string, price: string, updatedBy: string): Promise<any>;
@@ -66,6 +66,24 @@ class ProductService extends serviceSDK_1.Service {
66
66
  }
67
67
  });
68
68
  }
69
+ getProductByIdV2(productId) {
70
+ return __awaiter(this, void 0, void 0, function* () {
71
+ const query = queries_1.GET_PRODUCT_BY_ID_QUERY;
72
+ const variables = {
73
+ partnerId: this.orgId,
74
+ storeChannel: "",
75
+ productId,
76
+ };
77
+ try {
78
+ const response = yield this.graphqlQuery(query, variables);
79
+ return response.getProductById;
80
+ }
81
+ catch (error) {
82
+ console.log(`Error fetching product by ID: ${error}`);
83
+ throw error;
84
+ }
85
+ });
86
+ }
69
87
  getSimpleProductById(productId) {
70
88
  return __awaiter(this, void 0, void 0, function* () {
71
89
  const query = queries_1.GET_SIMPLE_PRODUCT_BY_ID_QUERY;
@@ -267,6 +285,26 @@ class ProductService extends serviceSDK_1.Service {
267
285
  }
268
286
  });
269
287
  }
288
+ getProductV2(dataQuery) {
289
+ return __awaiter(this, void 0, void 0, function* () {
290
+ const query = queries_1.GET_PRODUCT;
291
+ const variables = {
292
+ partnerId: this.orgId,
293
+ storeChannel: dataQuery.storeChannel,
294
+ keyword: dataQuery.keyword,
295
+ category: dataQuery.category,
296
+ currentPage: dataQuery.currentPage,
297
+ maxResult: dataQuery.maxResult,
298
+ };
299
+ try {
300
+ const response = yield this.graphqlQuery(query, variables);
301
+ return response.getProducts;
302
+ }
303
+ catch (error) {
304
+ throw error;
305
+ }
306
+ });
307
+ }
270
308
  updateProductTitle(productId, title, updatedBy) {
271
309
  return __awaiter(this, void 0, void 0, function* () {
272
310
  const mutation = mutations_1.UPDATE_PRODUCT_TITLE;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longvansoftware/storefront-js-client",
3
- "version": "4.6.9",
3
+ "version": "4.7.1",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "files": [
@@ -1 +0,0 @@
1
- export declare const SEARCH_SERVICE: import("graphql").DocumentNode;
@@ -1,71 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SEARCH_SERVICE = void 0;
4
- const graphql_tag_1 = require("graphql-tag");
5
- exports.SEARCH_SERVICE = (0, graphql_tag_1.gql) `
6
- query SearchService($filter: CloudServiceFilterInput) {
7
- searchService(filter: $filter) {
8
- total
9
- offset
10
- maxResult
11
- resultList {
12
- supplierId
13
- serviceId
14
- partnerId
15
- serviceName
16
- type
17
- typeName
18
- status
19
- statusFulfillment
20
- ownerId
21
- startDate
22
- endDate
23
- serviceType
24
- urlPrivate
25
- urlPublic
26
- username
27
- password
28
- attrs
29
- description
30
- productGroupId
31
- orderId
32
- actionRequest {
33
- id
34
- name
35
- uri
36
- type
37
- }
38
- billingCycle {
39
- quantity
40
- unit
41
- }
42
- productConfiguration {
43
- productId
44
- productTitle
45
- productResources {
46
- name
47
- quantity
48
- unit
49
- productId
50
- giftProductId
51
- gift
52
- giftQuantity
53
- campaignId
54
- campaignActionId
55
- qualify
56
- idParent
57
- addQuantity
58
- defaultQuantity
59
- title
60
- price
61
- unitPrice
62
- totalResource
63
- unitGift
64
- giftDuration
65
- giftDurationUnit
66
- }
67
- }
68
- }
69
- }
70
- }
71
- `;
@@ -1,5 +0,0 @@
1
- import { Service } from "../serviceSDK";
2
- export declare class CloudServiceService extends Service {
3
- constructor(endpoint: string, orgId: string, storeId: string);
4
- searchService(data: any): Promise<any>;
5
- }
@@ -1,35 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.CloudServiceService = void 0;
13
- const serviceSDK_1 = require("../serviceSDK");
14
- const queries_1 = require("../../graphql/cloudService/queries");
15
- class CloudServiceService extends serviceSDK_1.Service {
16
- constructor(endpoint, orgId, storeId) {
17
- super(endpoint, orgId, storeId);
18
- }
19
- searchService(data) {
20
- return __awaiter(this, void 0, void 0, function* () {
21
- const query = queries_1.SEARCH_SERVICE;
22
- const variables = {
23
- filter: data,
24
- };
25
- try {
26
- const response = yield this.graphqlQueryV4(query, variables);
27
- return response.searchService;
28
- }
29
- catch (error) {
30
- throw error;
31
- }
32
- });
33
- }
34
- }
35
- exports.CloudServiceService = CloudServiceService;