@longvansoftware/service-js-client 1.10.9 → 1.10.10
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.
@@ -1,20 +1,23 @@
|
|
1
|
-
|
2
|
-
export declare const
|
3
|
-
export declare const
|
4
|
-
export declare const
|
5
|
-
export declare const
|
6
|
-
export declare const
|
1
|
+
import { DocumentNode } from "graphql";
|
2
|
+
export declare const GET_PRODUCT_BY_ID_QUERY: DocumentNode;
|
3
|
+
export declare const GET_PRODUCT_BY_ID_QUERY_DYNAMIC: (fields: string[]) => DocumentNode;
|
4
|
+
export declare const GET_PRODUCT_BY_SLUG_QUERY: DocumentNode;
|
5
|
+
export declare const GET_SIMPLE_PRODUCTS_QUERY: DocumentNode;
|
6
|
+
export declare const GET_CATEGORIES_QUERY: DocumentNode;
|
7
|
+
export declare const GET_CATEGORY_BY_HANDLE_QUERY: DocumentNode;
|
8
|
+
export declare const GET_CATEGORY_BY_ID_QUERY: DocumentNode;
|
7
9
|
export declare const GET_BRANDS_QUERY = "\nquery GetBrands($partnerId: String!, $storeChannel: String!, $enable: Boolean) {\n\tgetBrands(partnerId: $partnerId, storeChannel: $storeChannel, enable: $enable) {\n\t\tid\n\t\tname\n\t\timage\n\t\timageIcon\n\t}\n}\n";
|
8
10
|
export declare const GET_BRANDS_BY_CATEGORY_QUERY = "\nquery GetBrandsByCategory($partnerId: String!, $storeChannel: String!, $categoryId: String!) {\n\tgetBrandsByCategory(partnerId: $partnerId, storeChannel: $storeChannel, categoryId: $categoryId) {\n\t\tid\n\t\tname\n\t\timage\n\t\timageIcon\n\t}\n}\n";
|
9
11
|
export declare const GET_BRAND_DETAIL_QUERY = "\n query GetBrandDetail($partnerId: String!, $brandId: String!, $storeChannel: String!) {\n getDetail(partnerId: $partnerId, brandId: $brandId, storeChannel: $storeChannel) {\n id\n name\n image\n imageIcon\n }\n }\n";
|
10
|
-
export declare const GET_PRODUCT_OPTION:
|
11
|
-
export declare const GET_POLICY:
|
12
|
-
export declare const GET_PRODUCTS:
|
13
|
-
export declare const
|
14
|
-
export declare const
|
15
|
-
export declare const
|
16
|
-
export declare const
|
17
|
-
export declare const
|
18
|
-
export declare const
|
19
|
-
export declare const
|
20
|
-
export declare const
|
12
|
+
export declare const GET_PRODUCT_OPTION: DocumentNode;
|
13
|
+
export declare const GET_POLICY: DocumentNode;
|
14
|
+
export declare const GET_PRODUCTS: DocumentNode;
|
15
|
+
export declare const GET_PRODUCTS_DYNAMIC: (fields: string[]) => DocumentNode;
|
16
|
+
export declare const GET_HANDLE_BY_SERVICETYPE: DocumentNode;
|
17
|
+
export declare const GET_RESOURCE_BY_PRODUCT: DocumentNode;
|
18
|
+
export declare const GET_PRODUCT_VARIANT_BY_ID: DocumentNode;
|
19
|
+
export declare const GET_RELATED_INFOR: DocumentNode;
|
20
|
+
export declare const GET_DETAIL_STORES: DocumentNode;
|
21
|
+
export declare const GET_LIST_PRICE: DocumentNode;
|
22
|
+
export declare const GET_TAGS: DocumentNode;
|
23
|
+
export declare const GET_TAGS_BY_CATEGORY: DocumentNode;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.GET_TAGS_BY_CATEGORY = exports.GET_TAGS = exports.GET_LIST_PRICE = exports.GET_DETAIL_STORES = exports.GET_RELATED_INFOR = 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;
|
3
|
+
exports.GET_TAGS_BY_CATEGORY = exports.GET_TAGS = exports.GET_LIST_PRICE = exports.GET_DETAIL_STORES = exports.GET_RELATED_INFOR = exports.GET_PRODUCT_VARIANT_BY_ID = exports.GET_RESOURCE_BY_PRODUCT = exports.GET_HANDLE_BY_SERVICETYPE = exports.GET_PRODUCTS_DYNAMIC = 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_DYNAMIC = 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(
|
@@ -192,6 +192,25 @@ exports.GET_PRODUCT_BY_ID_QUERY = (0, graphql_tag_1.gql) `
|
|
192
192
|
}
|
193
193
|
}
|
194
194
|
`;
|
195
|
+
const GET_PRODUCT_BY_ID_QUERY_DYNAMIC = (fields) => {
|
196
|
+
const fieldStr = fields.join("\n ");
|
197
|
+
return (0, graphql_tag_1.gql) `
|
198
|
+
query GetProductById(
|
199
|
+
$partnerId: String!
|
200
|
+
$storeChannel: String!
|
201
|
+
$productId: String!
|
202
|
+
) {
|
203
|
+
getProductById(
|
204
|
+
partnerId: $partnerId
|
205
|
+
storeChannel: $storeChannel
|
206
|
+
productId: $productId
|
207
|
+
) {
|
208
|
+
${fieldStr}
|
209
|
+
}
|
210
|
+
}
|
211
|
+
`;
|
212
|
+
};
|
213
|
+
exports.GET_PRODUCT_BY_ID_QUERY_DYNAMIC = GET_PRODUCT_BY_ID_QUERY_DYNAMIC;
|
195
214
|
exports.GET_PRODUCT_BY_SLUG_QUERY = (0, graphql_tag_1.gql) `
|
196
215
|
query GetProductByHandle(
|
197
216
|
$partnerId: String!
|
@@ -668,6 +687,99 @@ exports.GET_PRODUCTS = (0, graphql_tag_1.gql) `
|
|
668
687
|
}
|
669
688
|
}
|
670
689
|
`;
|
690
|
+
const GET_PRODUCTS_DYNAMIC = (fields) => {
|
691
|
+
const fieldStr = fields.join("\n ");
|
692
|
+
return (0, graphql_tag_1.gql) `
|
693
|
+
query GetProducts(
|
694
|
+
$partnerId: String!
|
695
|
+
$storeChannel: String!
|
696
|
+
$hash: String
|
697
|
+
$publicOnStore: Boolean
|
698
|
+
$category: String
|
699
|
+
$product: String
|
700
|
+
$group: String
|
701
|
+
$sku: String
|
702
|
+
$priceFrom: BigDecimal
|
703
|
+
$priceTo: BigDecimal
|
704
|
+
$tag: String
|
705
|
+
$status: String
|
706
|
+
$ecommerceId: String
|
707
|
+
$productIgnoresIds: String
|
708
|
+
$toDate: Long
|
709
|
+
$fromDate: Long
|
710
|
+
$productType: String
|
711
|
+
$sortOrder: String
|
712
|
+
$sortBy: String
|
713
|
+
$option: String
|
714
|
+
$brandId: String
|
715
|
+
$feature: String
|
716
|
+
$keyword: String
|
717
|
+
$external: String
|
718
|
+
$userId: String
|
719
|
+
$onlyFavorite: Boolean
|
720
|
+
$buildPriceStore: Boolean
|
721
|
+
$buildType: String
|
722
|
+
$buildPromotion: Boolean
|
723
|
+
$variant: Boolean
|
724
|
+
$deleteChild: Boolean
|
725
|
+
$display: String
|
726
|
+
$subType: String
|
727
|
+
$currentPage: Int
|
728
|
+
$maxResult: Int
|
729
|
+
$isSync: Boolean
|
730
|
+
$isMapped: Boolean
|
731
|
+
) {
|
732
|
+
getProducts(
|
733
|
+
partnerId: $partnerId
|
734
|
+
storeChannel: $storeChannel
|
735
|
+
hash: $hash
|
736
|
+
publicOnStore: $publicOnStore
|
737
|
+
category: $category
|
738
|
+
product: $product
|
739
|
+
group: $group
|
740
|
+
sku: $sku
|
741
|
+
priceFrom: $priceFrom
|
742
|
+
priceTo: $priceTo
|
743
|
+
tag: $tag
|
744
|
+
status: $status
|
745
|
+
ecommerceId: $ecommerceId
|
746
|
+
productIgnoresIds: $productIgnoresIds
|
747
|
+
toDate: $toDate
|
748
|
+
fromDate: $fromDate
|
749
|
+
productType: $productType
|
750
|
+
sortOrder: $sortOrder
|
751
|
+
sortBy: $sortBy
|
752
|
+
option: $option
|
753
|
+
brandId: $brandId
|
754
|
+
feature: $feature
|
755
|
+
keyword: $keyword
|
756
|
+
external: $external
|
757
|
+
userId: $userId
|
758
|
+
onlyFavorite: $onlyFavorite
|
759
|
+
buildPriceStore: $buildPriceStore
|
760
|
+
buildType: $buildType
|
761
|
+
buildPromotion: $buildPromotion
|
762
|
+
variant: $variant
|
763
|
+
deleteChild: $deleteChild
|
764
|
+
display: $display
|
765
|
+
subType: $subType
|
766
|
+
currentPage: $currentPage
|
767
|
+
maxResult: $maxResult
|
768
|
+
isSync: $isSync
|
769
|
+
isMapped: $isMapped
|
770
|
+
) {
|
771
|
+
total
|
772
|
+
currentPage
|
773
|
+
maxResult
|
774
|
+
totalPage
|
775
|
+
data {
|
776
|
+
${fieldStr}
|
777
|
+
}
|
778
|
+
}
|
779
|
+
}
|
780
|
+
`;
|
781
|
+
};
|
782
|
+
exports.GET_PRODUCTS_DYNAMIC = GET_PRODUCTS_DYNAMIC;
|
671
783
|
exports.GET_HANDLE_BY_SERVICETYPE = (0, graphql_tag_1.gql) `
|
672
784
|
query GetHandleByServiceTypes(
|
673
785
|
$partnerId: String!
|
@@ -21,6 +21,7 @@ export declare class ProductService extends Service {
|
|
21
21
|
* @throws If an error occurs while fetching the product.
|
22
22
|
*/
|
23
23
|
getProductById(productId: string, store: string): Promise<any>;
|
24
|
+
getProductByIdDynamic(productId: string, store: string, fields: string[]): Promise<any>;
|
24
25
|
/**
|
25
26
|
* Retrieves a product by its slug.
|
26
27
|
* @param slug - The slug of the product.
|
@@ -38,6 +39,7 @@ export declare class ProductService extends Service {
|
|
38
39
|
getProductOption(productId: string, store: string): Promise<any>;
|
39
40
|
getPolicy(groupId: string): Promise<any>;
|
40
41
|
getProducts(param: getProduct, store: string): Promise<any>;
|
42
|
+
getProductsDynamic(param: getProduct, store: string, fields: string[]): Promise<any>;
|
41
43
|
getHandleByServiceTypes(serviceTypes: [string]): Promise<any>;
|
42
44
|
getResourceByProduct(productId: string): Promise<any>;
|
43
45
|
getProductVariantById(variantId: string): Promise<any>;
|
@@ -52,6 +52,24 @@ class ProductService extends serviceSDK_1.Service {
|
|
52
52
|
}
|
53
53
|
});
|
54
54
|
}
|
55
|
+
getProductByIdDynamic(productId, store, fields) {
|
56
|
+
return __awaiter(this, void 0, void 0, function* () {
|
57
|
+
const query = (0, queries_1.GET_PRODUCT_BY_ID_QUERY_DYNAMIC)(fields);
|
58
|
+
const variables = {
|
59
|
+
partnerId: this.orgId,
|
60
|
+
storeChannel: store ? store : this.storeId,
|
61
|
+
productId,
|
62
|
+
};
|
63
|
+
try {
|
64
|
+
const response = yield this.graphqlQuery(query, variables);
|
65
|
+
return response.getProductById;
|
66
|
+
}
|
67
|
+
catch (error) {
|
68
|
+
console.log(`Error fetching product by ID: ${error}`);
|
69
|
+
throw error;
|
70
|
+
}
|
71
|
+
});
|
72
|
+
}
|
55
73
|
/**
|
56
74
|
* Retrieves a product by its slug.
|
57
75
|
* @param slug - The slug of the product.
|
@@ -145,6 +163,20 @@ class ProductService extends serviceSDK_1.Service {
|
|
145
163
|
}
|
146
164
|
});
|
147
165
|
}
|
166
|
+
getProductsDynamic(param, store, fields) {
|
167
|
+
return __awaiter(this, void 0, void 0, function* () {
|
168
|
+
const query = (0, queries_1.GET_PRODUCTS_DYNAMIC)(fields);
|
169
|
+
const variablesHandle = Object.assign({ partnerId: this.orgId, storeChannel: store ? store : this.storeId }, param);
|
170
|
+
try {
|
171
|
+
const response = yield this.graphqlQueryV2(query, variablesHandle);
|
172
|
+
return response.getProducts;
|
173
|
+
}
|
174
|
+
catch (error) {
|
175
|
+
console.log(`Error fetching getProducts : ${error}`);
|
176
|
+
throw error;
|
177
|
+
}
|
178
|
+
});
|
179
|
+
}
|
148
180
|
getHandleByServiceTypes(serviceTypes) {
|
149
181
|
return __awaiter(this, void 0, void 0, function* () {
|
150
182
|
const query = queries_1.GET_HANDLE_BY_SERVICETYPE;
|