@longvansoftware/service-js-client 2.1.8 → 2.2.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/auth/queries.d.ts +1 -0
- package/dist/src/graphql/auth/queries.js +13 -1
- package/dist/src/graphql/product/queries.d.ts +1 -0
- package/dist/src/graphql/product/queries.js +82 -8
- package/dist/src/lib/auth/index.d.ts +1 -0
- package/dist/src/lib/auth/index.js +16 -0
- package/dist/src/lib/product/index.d.ts +1 -0
- package/dist/src/lib/product/index.js +14 -0
- package/package.json +1 -1
|
@@ -8,3 +8,4 @@ export declare const GET_PHONE_BY_PARTYID: DocumentNode;
|
|
|
8
8
|
export declare const GET_EMAIL_BY_PARTYID: DocumentNode;
|
|
9
9
|
export declare const GET_ACCESS_TOKEN_BY_OTP: DocumentNode;
|
|
10
10
|
export declare const GET_PARTY_DETAIL_BY_PHONE: (fields?: string[]) => DocumentNode;
|
|
11
|
+
export declare const GET_ORGANIZATIONS_BY_PARTYID: (fields?: string[]) => DocumentNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GET_PARTY_DETAIL_BY_PHONE = exports.GET_ACCESS_TOKEN_BY_OTP = exports.GET_EMAIL_BY_PARTYID = exports.GET_PHONE_BY_PARTYID = exports.GET_USER_LOGIN_BY_PARTY_ID = exports.CHECK_USERNAME_EXISTED = exports.GET_USER_LOGIN_BY_USER_LOGIN_ID = exports.GET_USER_LOGIN_BY_TOKEN = exports.GET_USER_DETAIL = void 0;
|
|
3
|
+
exports.GET_ORGANIZATIONS_BY_PARTYID = exports.GET_PARTY_DETAIL_BY_PHONE = exports.GET_ACCESS_TOKEN_BY_OTP = exports.GET_EMAIL_BY_PARTYID = exports.GET_PHONE_BY_PARTYID = exports.GET_USER_LOGIN_BY_PARTY_ID = exports.CHECK_USERNAME_EXISTED = exports.GET_USER_LOGIN_BY_USER_LOGIN_ID = exports.GET_USER_LOGIN_BY_TOKEN = exports.GET_USER_DETAIL = void 0;
|
|
4
4
|
const graphql_tag_1 = require("graphql-tag");
|
|
5
5
|
exports.GET_USER_DETAIL = (0, graphql_tag_1.gql) `
|
|
6
6
|
query GetUserDetail($orgId: String!, $accessToken: String!) {
|
|
@@ -98,3 +98,15 @@ const GET_PARTY_DETAIL_BY_PHONE = (fields = []) => {
|
|
|
98
98
|
`;
|
|
99
99
|
};
|
|
100
100
|
exports.GET_PARTY_DETAIL_BY_PHONE = GET_PARTY_DETAIL_BY_PHONE;
|
|
101
|
+
const GET_ORGANIZATIONS_BY_PARTYID = (fields = []) => {
|
|
102
|
+
const fieldStr = fields.join("\n ");
|
|
103
|
+
const hasFields = fields.length > 0;
|
|
104
|
+
return (0, graphql_tag_1.gql) `
|
|
105
|
+
query getOrganizationsByPartyId($partyId: String!) {
|
|
106
|
+
getOrganizationsByPartyId(partyId: $partyId) {
|
|
107
|
+
${hasFields ? `${fieldStr}` : ""}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
`;
|
|
111
|
+
};
|
|
112
|
+
exports.GET_ORGANIZATIONS_BY_PARTYID = GET_ORGANIZATIONS_BY_PARTYID;
|
|
@@ -25,3 +25,4 @@ export declare const GET_TAGS_BY_CATEGORY: DocumentNode;
|
|
|
25
25
|
export declare const GET_LIST_PRODUCTS_CONFIG_DYNAMIC: (fields?: string[]) => DocumentNode;
|
|
26
26
|
export declare const GET_CATEGORIES: DocumentNode;
|
|
27
27
|
export declare const GET_PRICE_MENUS: DocumentNode;
|
|
28
|
+
export declare const GET_SIMPLE_PRODUCTS_DYNAMIC: (fields?: string[]) => DocumentNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GET_PRICE_MENUS = exports.GET_CATEGORIES = exports.GET_LIST_PRODUCTS_CONFIG_DYNAMIC = 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_QUERY_DYNAMIC = 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;
|
|
3
|
+
exports.GET_SIMPLE_PRODUCTS_DYNAMIC = exports.GET_PRICE_MENUS = exports.GET_CATEGORIES = exports.GET_LIST_PRODUCTS_CONFIG_DYNAMIC = 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_QUERY_DYNAMIC = 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(
|
|
@@ -287,45 +287,53 @@ exports.GET_PRODUCT_BY_SLUG_QUERY = (0, graphql_tag_1.gql) `
|
|
|
287
287
|
}
|
|
288
288
|
`;
|
|
289
289
|
exports.GET_SIMPLE_PRODUCTS_QUERY = (0, graphql_tag_1.gql) `
|
|
290
|
-
query
|
|
290
|
+
query getSimpleProducts(
|
|
291
291
|
$partnerId: String!
|
|
292
292
|
$storeChannel: String!
|
|
293
|
+
$hash: String
|
|
293
294
|
$category: String
|
|
294
295
|
$product: String
|
|
295
296
|
$sku: String
|
|
296
|
-
$tag: String
|
|
297
297
|
$priceFrom: BigDecimal
|
|
298
298
|
$priceTo: BigDecimal
|
|
299
|
+
$tag: String
|
|
299
300
|
$status: String
|
|
301
|
+
$toDate: Long
|
|
302
|
+
$fromDate: Long
|
|
300
303
|
$productType: String
|
|
301
|
-
$subType: String
|
|
302
304
|
$sortOrder: String
|
|
303
305
|
$sortBy: String
|
|
304
306
|
$brandId: String
|
|
307
|
+
$feature: String
|
|
305
308
|
$keyword: String
|
|
309
|
+
$buildType: String
|
|
306
310
|
$display: String
|
|
307
|
-
$
|
|
311
|
+
$subType: String
|
|
308
312
|
$currentPage: Int
|
|
309
313
|
$maxResult: Int
|
|
310
314
|
) {
|
|
311
315
|
getSimpleProducts(
|
|
312
316
|
partnerId: $partnerId
|
|
313
317
|
storeChannel: $storeChannel
|
|
318
|
+
hash: $hash
|
|
314
319
|
category: $category
|
|
315
320
|
product: $product
|
|
316
321
|
sku: $sku
|
|
317
|
-
tag: $tag
|
|
318
322
|
priceFrom: $priceFrom
|
|
319
323
|
priceTo: $priceTo
|
|
324
|
+
tag: $tag
|
|
320
325
|
status: $status
|
|
326
|
+
toDate: $toDate
|
|
327
|
+
fromDate: $fromDate
|
|
321
328
|
productType: $productType
|
|
322
|
-
subType: $subType
|
|
323
329
|
sortOrder: $sortOrder
|
|
324
330
|
sortBy: $sortBy
|
|
325
331
|
brandId: $brandId
|
|
332
|
+
feature: $feature
|
|
326
333
|
keyword: $keyword
|
|
334
|
+
buildType: $buildType
|
|
327
335
|
display: $display
|
|
328
|
-
|
|
336
|
+
subType: $subType
|
|
329
337
|
currentPage: $currentPage
|
|
330
338
|
maxResult: $maxResult
|
|
331
339
|
) {
|
|
@@ -1103,3 +1111,69 @@ exports.GET_PRICE_MENUS = (0, graphql_tag_1.gql) `
|
|
|
1103
1111
|
}
|
|
1104
1112
|
}
|
|
1105
1113
|
`;
|
|
1114
|
+
const GET_SIMPLE_PRODUCTS_DYNAMIC = (fields = []) => {
|
|
1115
|
+
const fieldStr = fields.join("\n ");
|
|
1116
|
+
const hasFields = fields.length > 0;
|
|
1117
|
+
return (0, graphql_tag_1.gql) `
|
|
1118
|
+
query getSimpleProducts(
|
|
1119
|
+
$partnerId: String!
|
|
1120
|
+
$storeChannel: String!
|
|
1121
|
+
$hash: String
|
|
1122
|
+
$category: String
|
|
1123
|
+
$product: String
|
|
1124
|
+
$sku: String
|
|
1125
|
+
$priceFrom: BigDecimal
|
|
1126
|
+
$priceTo: BigDecimal
|
|
1127
|
+
$tag: String
|
|
1128
|
+
$status: String
|
|
1129
|
+
$toDate: Long
|
|
1130
|
+
$fromDate: Long
|
|
1131
|
+
$productType: String
|
|
1132
|
+
$sortOrder: String
|
|
1133
|
+
$sortBy: String
|
|
1134
|
+
$brandId: String
|
|
1135
|
+
$feature: String
|
|
1136
|
+
$keyword: String
|
|
1137
|
+
$buildType: String
|
|
1138
|
+
$display: String
|
|
1139
|
+
$subType: String
|
|
1140
|
+
$currentPage: Int
|
|
1141
|
+
$maxResult: Int
|
|
1142
|
+
) {
|
|
1143
|
+
getSimpleProducts(
|
|
1144
|
+
partnerId: $partnerId
|
|
1145
|
+
storeChannel: $storeChannel
|
|
1146
|
+
hash: $hash
|
|
1147
|
+
category: $category
|
|
1148
|
+
product: $product
|
|
1149
|
+
sku: $sku
|
|
1150
|
+
priceFrom: $priceFrom
|
|
1151
|
+
priceTo: $priceTo
|
|
1152
|
+
tag: $tag
|
|
1153
|
+
status: $status
|
|
1154
|
+
toDate: $toDate
|
|
1155
|
+
fromDate: $fromDate
|
|
1156
|
+
productType: $productType
|
|
1157
|
+
sortOrder: $sortOrder
|
|
1158
|
+
sortBy: $sortBy
|
|
1159
|
+
brandId: $brandId
|
|
1160
|
+
feature: $feature
|
|
1161
|
+
keyword: $keyword
|
|
1162
|
+
buildType: $buildType
|
|
1163
|
+
display: $display
|
|
1164
|
+
subType: $subType
|
|
1165
|
+
currentPage: $currentPage
|
|
1166
|
+
maxResult: $maxResult
|
|
1167
|
+
) {
|
|
1168
|
+
total
|
|
1169
|
+
currentPage
|
|
1170
|
+
maxResult
|
|
1171
|
+
totalPage
|
|
1172
|
+
data {
|
|
1173
|
+
${hasFields ? `${fieldStr}` : ""}
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
`;
|
|
1178
|
+
};
|
|
1179
|
+
exports.GET_SIMPLE_PRODUCTS_DYNAMIC = GET_SIMPLE_PRODUCTS_DYNAMIC;
|
|
@@ -46,4 +46,5 @@ export declare class AuthService extends Service {
|
|
|
46
46
|
getEmailByPartyId(partyId: string): Promise<any>;
|
|
47
47
|
getPartyDetailByPhone(phone: string, fields: string[]): Promise<any>;
|
|
48
48
|
createPartyDetail(name: string, phone: string, createdBy: string, source: string, fields: string[]): Promise<any>;
|
|
49
|
+
getOrganizationsByPartyIdDynamic(partyId: string, fields: string[]): Promise<any>;
|
|
49
50
|
}
|
|
@@ -428,5 +428,21 @@ class AuthService extends serviceSDK_1.Service {
|
|
|
428
428
|
}
|
|
429
429
|
});
|
|
430
430
|
}
|
|
431
|
+
getOrganizationsByPartyIdDynamic(partyId, fields) {
|
|
432
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
433
|
+
const query = (0, queries_1.GET_ORGANIZATIONS_BY_PARTYID)(fields);
|
|
434
|
+
const variables = {
|
|
435
|
+
partyId
|
|
436
|
+
};
|
|
437
|
+
try {
|
|
438
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
439
|
+
return response.getOrganizationsByPartyId;
|
|
440
|
+
}
|
|
441
|
+
catch (error) {
|
|
442
|
+
console.log(`Error in getOrganizationsByPartyId: ${error}`);
|
|
443
|
+
throw error;
|
|
444
|
+
}
|
|
445
|
+
});
|
|
446
|
+
}
|
|
431
447
|
}
|
|
432
448
|
exports.AuthService = AuthService;
|
|
@@ -52,4 +52,5 @@ export declare class ProductService extends Service {
|
|
|
52
52
|
getListProductConfigDynamic(productId: string, store: string, fields: string[]): Promise<any>;
|
|
53
53
|
getCategories(): Promise<any>;
|
|
54
54
|
getPriceMenus(categoryId: string, store: string): Promise<any>;
|
|
55
|
+
getSimpleProductsDynamic(variables: any, storeId: string, fields: string[]): Promise<any>;
|
|
55
56
|
}
|
|
@@ -387,5 +387,19 @@ class ProductService extends serviceSDK_1.Service {
|
|
|
387
387
|
}
|
|
388
388
|
});
|
|
389
389
|
}
|
|
390
|
+
getSimpleProductsDynamic(variables, storeId, fields) {
|
|
391
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
392
|
+
const query = (0, queries_1.GET_SIMPLE_PRODUCTS_DYNAMIC)(fields);
|
|
393
|
+
const variablesHandle = Object.assign({ partnerId: this.orgId, storeChannel: storeId ? storeId : this.storeId }, variables);
|
|
394
|
+
try {
|
|
395
|
+
const response = yield this.graphqlQuery(query, variablesHandle);
|
|
396
|
+
return response.getSimpleProducts;
|
|
397
|
+
}
|
|
398
|
+
catch (error) {
|
|
399
|
+
console.log(`Error fetching getSimpleProductsDynamic: ${error}`);
|
|
400
|
+
throw error;
|
|
401
|
+
}
|
|
402
|
+
});
|
|
403
|
+
}
|
|
390
404
|
}
|
|
391
405
|
exports.ProductService = ProductService;
|