@longvansoftware/storefront-js-client 4.6.8 → 4.7.0
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/src/graphql/cloudService/queries.d.ts +1 -0
- package/dist/src/graphql/cloudService/queries.js +71 -0
- package/dist/src/graphql/product/queries.d.ts +1 -0
- package/dist/src/graphql/product/queries.js +64 -5
- package/dist/src/lib/cloudService/index.d.ts +5 -0
- package/dist/src/lib/cloudService/index.js +35 -0
- package/dist/src/lib/product/index.d.ts +3 -0
- package/dist/src/lib/product/index.js +50 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SEARCH_SERVICE: import("graphql").DocumentNode;
|
|
@@ -0,0 +1,71 @@
|
|
|
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
|
+
`;
|
|
@@ -12,6 +12,7 @@ export declare const GET_BRAND_DETAIL_QUERY = "\n query GetBrandDetail($partner
|
|
|
12
12
|
export declare const GET_PRODUCT_OPTION: DocumentNode;
|
|
13
13
|
export declare const GET_POLICY: DocumentNode;
|
|
14
14
|
export declare const GET_STORES: DocumentNode;
|
|
15
|
+
export declare const GET_STORES_V2: DocumentNode;
|
|
15
16
|
export declare const GET_DETAIL_STORES: DocumentNode;
|
|
16
17
|
export declare const GET_PRODUCT_IMAGE: DocumentNode;
|
|
17
18
|
export declare const GET_PRODUCT: DocumentNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GET_PRODUCT_SIMPLE_BY_HANDLE_DYNAMIC = exports.GET_PRODUCT_MARKET_PLACE_BY_SUPPLIER = exports.GET_PRODUCT_MARKET_PLACE_BY_ID = exports.GET_PRODUCT_MARKET_PLACE_DETAIL_BY_SLUG = exports.GET_PRODUCT_MARKET_PLACE = exports.GET_PRODUCT_STORE_PUBLIC = exports.GET_PRODUCT_STORE_BY_SCOPE = 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;
|
|
3
|
+
exports.GET_PRODUCT_SIMPLE_BY_HANDLE_DYNAMIC = exports.GET_PRODUCT_MARKET_PLACE_BY_SUPPLIER = exports.GET_PRODUCT_MARKET_PLACE_BY_ID = exports.GET_PRODUCT_MARKET_PLACE_DETAIL_BY_SLUG = exports.GET_PRODUCT_MARKET_PLACE = exports.GET_PRODUCT_STORE_PUBLIC = exports.GET_PRODUCT_STORE_BY_SCOPE = 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_V2 = 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(
|
|
@@ -500,7 +500,7 @@ exports.GET_SIMPLE_PRODUCTS_QUERY = (0, graphql_tag_1.gql) `
|
|
|
500
500
|
vat
|
|
501
501
|
qualify
|
|
502
502
|
parentId
|
|
503
|
-
|
|
503
|
+
|
|
504
504
|
handle
|
|
505
505
|
price
|
|
506
506
|
compareAtPrice
|
|
@@ -713,6 +713,65 @@ exports.GET_STORES = (0, graphql_tag_1.gql) `
|
|
|
713
713
|
}
|
|
714
714
|
}
|
|
715
715
|
`;
|
|
716
|
+
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
|
+
) {
|
|
729
|
+
id
|
|
730
|
+
createdStamp
|
|
731
|
+
name
|
|
732
|
+
type
|
|
733
|
+
enable
|
|
734
|
+
partyId
|
|
735
|
+
warehouses
|
|
736
|
+
warehouseIdDefault
|
|
737
|
+
enableOrderAbleFuture
|
|
738
|
+
enableOrderNegativeQuantity
|
|
739
|
+
storeEcommerceName
|
|
740
|
+
shippingCompanies
|
|
741
|
+
shippingCompanyIdPrimary
|
|
742
|
+
customerIdPrimary
|
|
743
|
+
paymentMethodIdPrimary
|
|
744
|
+
enableCustomProductPrice
|
|
745
|
+
enablePaymentPartial
|
|
746
|
+
paymentPartialPercent
|
|
747
|
+
productStoreLink
|
|
748
|
+
applyVat
|
|
749
|
+
scope
|
|
750
|
+
description {
|
|
751
|
+
name
|
|
752
|
+
phone
|
|
753
|
+
address
|
|
754
|
+
footer
|
|
755
|
+
description
|
|
756
|
+
slug
|
|
757
|
+
logo
|
|
758
|
+
banner
|
|
759
|
+
ward
|
|
760
|
+
wardId
|
|
761
|
+
province
|
|
762
|
+
provinceId
|
|
763
|
+
showLogo
|
|
764
|
+
showBanner
|
|
765
|
+
showMap
|
|
766
|
+
showInfoStore
|
|
767
|
+
showBarcode
|
|
768
|
+
showFooter
|
|
769
|
+
showVat
|
|
770
|
+
showPromotion
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
`;
|
|
716
775
|
exports.GET_DETAIL_STORES = (0, graphql_tag_1.gql) `
|
|
717
776
|
query GetDetailStores($partnerId: String!, $storeId: String!) {
|
|
718
777
|
getDetailStores(partnerId: $partnerId, storeId: $storeId) {
|
|
@@ -1185,13 +1244,13 @@ exports.GET_PRODUCT_STORE_PUBLIC = (0, graphql_tag_1.gql) `
|
|
|
1185
1244
|
exports.GET_PRODUCT_MARKET_PLACE = (0, graphql_tag_1.gql) `
|
|
1186
1245
|
query GetProductMarketplace(
|
|
1187
1246
|
$storeChannel: String!
|
|
1188
|
-
$currentPage:Int
|
|
1247
|
+
$currentPage: Int
|
|
1189
1248
|
$maxResult: Int
|
|
1190
1249
|
) {
|
|
1191
1250
|
getProductMarketplace(
|
|
1192
1251
|
storeChannel: $storeChannel
|
|
1193
|
-
currentPage
|
|
1194
|
-
maxResult
|
|
1252
|
+
currentPage: $currentPage
|
|
1253
|
+
maxResult: $maxResult
|
|
1195
1254
|
) {
|
|
1196
1255
|
total
|
|
1197
1256
|
currentPage
|
|
@@ -0,0 +1,35 @@
|
|
|
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;
|
|
@@ -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>;
|
|
@@ -93,4 +95,5 @@ export declare class ProductService extends Service {
|
|
|
93
95
|
getProductMarketplaceDetailById(storeChannel: string, id: string): Promise<any>;
|
|
94
96
|
getProductMarketplaceBySupplier(dataQuery: any): Promise<any>;
|
|
95
97
|
getProductSimpleByHandle(handle: string, store: string, fields: string[]): Promise<any>;
|
|
98
|
+
getStoresAndDescription(dataQuery: any): Promise<any>;
|
|
96
99
|
}
|
|
@@ -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;
|
|
@@ -1092,5 +1130,17 @@ class ProductService extends serviceSDK_1.Service {
|
|
|
1092
1130
|
}
|
|
1093
1131
|
});
|
|
1094
1132
|
}
|
|
1133
|
+
getStoresAndDescription(dataQuery) {
|
|
1134
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1135
|
+
const queries = queries_1.GET_STORES_V2;
|
|
1136
|
+
try {
|
|
1137
|
+
const response = yield this.graphqlQuery(queries, dataQuery);
|
|
1138
|
+
return response.getStores;
|
|
1139
|
+
}
|
|
1140
|
+
catch (error) {
|
|
1141
|
+
throw error;
|
|
1142
|
+
}
|
|
1143
|
+
});
|
|
1144
|
+
}
|
|
1095
1145
|
}
|
|
1096
1146
|
exports.ProductService = ProductService;
|