@longvansoftware/service-js-client 1.3.9 → 1.4.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.
- package/dist/src/graphql/product/queries.d.ts +1 -0
- package/dist/src/graphql/product/queries.js +37 -1
- package/dist/src/graphql/resource_permission/mutations.d.ts +1 -0
- package/dist/src/graphql/resource_permission/mutations.js +35 -1
- package/dist/src/lib/order/index.d.ts +18 -0
- package/dist/src/lib/order/index.js +46 -2
- package/dist/src/lib/product/index.d.ts +1 -0
- package/dist/src/lib/product/index.js +17 -0
- package/dist/src/lib/resource_permission/index.d.ts +1 -0
- package/dist/src/lib/resource_permission/index.js +20 -0
- package/dist/src/types/cloud.d.ts +1 -0
- package/package.json +1 -1
@@ -14,3 +14,4 @@ export declare const GET_HANDLE_BY_SERVICETYPE: import("graphql").DocumentNode;
|
|
14
14
|
export declare const GET_RESOURCE_BY_PRODUCT: import("graphql").DocumentNode;
|
15
15
|
export declare const GET_PRODUCT_VARIANT_BY_ID: import("graphql").DocumentNode;
|
16
16
|
export declare const GET_RELATED_INFOR: import("graphql").DocumentNode;
|
17
|
+
export declare const GET_DETAIL_STORES: import("graphql").DocumentNode;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
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_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;
|
4
4
|
const graphql_tag_1 = require("graphql-tag");
|
5
5
|
// export const GET_PRODUCT_BY_ID_QUERY = gql`
|
6
6
|
// query GetProductById(
|
@@ -791,3 +791,39 @@ exports.GET_RELATED_INFOR = (0, graphql_tag_1.gql) `
|
|
791
791
|
}
|
792
792
|
}
|
793
793
|
`;
|
794
|
+
exports.GET_DETAIL_STORES = (0, graphql_tag_1.gql) `
|
795
|
+
query GetDetailStores($partnerId: String!, $storeId: String!) {
|
796
|
+
getDetailStores(partnerId: $partnerId, storeId: $storeId) {
|
797
|
+
id
|
798
|
+
createdStamp
|
799
|
+
name
|
800
|
+
description {
|
801
|
+
name
|
802
|
+
phone
|
803
|
+
address
|
804
|
+
footer
|
805
|
+
showInfoStore
|
806
|
+
showBarcode
|
807
|
+
showFooter
|
808
|
+
showVat
|
809
|
+
showPromotion
|
810
|
+
}
|
811
|
+
type
|
812
|
+
enable
|
813
|
+
partyId
|
814
|
+
warehouses
|
815
|
+
warehouseIdDefault
|
816
|
+
enableOrderAbleFuture
|
817
|
+
enableOrderNegativeQuantity
|
818
|
+
storeEcommerceName
|
819
|
+
shippingCompanies
|
820
|
+
shippingCompanyIdPrimary
|
821
|
+
customerIdPrimary
|
822
|
+
paymentMethodIdPrimary
|
823
|
+
enableCustomProductPrice
|
824
|
+
enablePaymentPartial
|
825
|
+
paymentPartialPercent
|
826
|
+
productStoreLink
|
827
|
+
}
|
828
|
+
}
|
829
|
+
`;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.SHARE_RESOURCE = void 0;
|
3
|
+
exports.REMOVE_SHARE_PARTY = exports.SHARE_RESOURCE = void 0;
|
4
4
|
const graphql_tag_1 = require("graphql-tag");
|
5
5
|
exports.SHARE_RESOURCE = (0, graphql_tag_1.gql) `
|
6
6
|
mutation ShareResource(
|
@@ -27,3 +27,37 @@ exports.SHARE_RESOURCE = (0, graphql_tag_1.gql) `
|
|
27
27
|
}
|
28
28
|
}
|
29
29
|
`;
|
30
|
+
exports.REMOVE_SHARE_PARTY = (0, graphql_tag_1.gql) `
|
31
|
+
mutation RemoveShareParty(
|
32
|
+
$partnerId: String!
|
33
|
+
$orgId: String!
|
34
|
+
$resourceType: String!
|
35
|
+
$resourceId: String!
|
36
|
+
$sharePartyId: String!
|
37
|
+
) {
|
38
|
+
removeShareParty(
|
39
|
+
partnerId: $partnerId
|
40
|
+
orgId: $orgId
|
41
|
+
resourceType: $resourceType
|
42
|
+
resourceId: $resourceId
|
43
|
+
sharePartyId: $sharePartyId
|
44
|
+
) {
|
45
|
+
id
|
46
|
+
name
|
47
|
+
resourceId
|
48
|
+
org
|
49
|
+
resourceType
|
50
|
+
oauthSharePermissions {
|
51
|
+
role
|
52
|
+
partyId
|
53
|
+
partyName
|
54
|
+
permission
|
55
|
+
}
|
56
|
+
description
|
57
|
+
createdStamp
|
58
|
+
updatedStamp
|
59
|
+
updatedBy
|
60
|
+
createdBy
|
61
|
+
}
|
62
|
+
}
|
63
|
+
`;
|
@@ -449,4 +449,22 @@ export declare class OrderService extends Service {
|
|
449
449
|
deleteNoteWithoutLogin(orderId: string, noteId: string, deletedBy: string): Promise<any>;
|
450
450
|
updateOrderDescription(orderId: string, description: string): Promise<any>;
|
451
451
|
getOrderDetail(orderId: string): Promise<any>;
|
452
|
+
/**
|
453
|
+
* get list order realation
|
454
|
+
* @param orderId - The id of order
|
455
|
+
* @param orderItemId - The id of note
|
456
|
+
* @param reason - The id of person delete
|
457
|
+
* @param updated_by
|
458
|
+
* @returns A prom that resolves when the customer and shipping address are updated.
|
459
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
460
|
+
*/
|
461
|
+
deleteProductInOrderWithoutLogin(orderId: string, orderItemId: string, reason: string, updated_by: string): Promise<any>;
|
462
|
+
/**
|
463
|
+
* get list order realation
|
464
|
+
* @param orderId - The id of order
|
465
|
+
* @param updated_by
|
466
|
+
* @returns A prom that resolves when the customer and shipping address are updated.
|
467
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
468
|
+
*/
|
469
|
+
addProductInOrderWithoutLogin(orderId: string, updated_by: string, data: any): Promise<any>;
|
452
470
|
}
|
@@ -1185,7 +1185,7 @@ class OrderService extends serviceSDK_1.Service {
|
|
1185
1185
|
const method = "PUT";
|
1186
1186
|
try {
|
1187
1187
|
const response = yield this.restApiCallWithToken(endpoint, method, description, {
|
1188
|
-
|
1188
|
+
"Content-Type": "text/plain",
|
1189
1189
|
});
|
1190
1190
|
return response;
|
1191
1191
|
}
|
@@ -1197,7 +1197,51 @@ class OrderService extends serviceSDK_1.Service {
|
|
1197
1197
|
}
|
1198
1198
|
getOrderDetail(orderId) {
|
1199
1199
|
return __awaiter(this, void 0, void 0, function* () {
|
1200
|
-
return this.restApiCallWithToken(`/orders/${this.orgId}/${this.storeId}/${orderId}/sale_order`,
|
1200
|
+
return this.restApiCallWithToken(`/orders/${this.orgId}/${this.storeId}/${orderId}/sale_order`, "GET");
|
1201
|
+
});
|
1202
|
+
}
|
1203
|
+
/**
|
1204
|
+
* get list order realation
|
1205
|
+
* @param orderId - The id of order
|
1206
|
+
* @param orderItemId - The id of note
|
1207
|
+
* @param reason - The id of person delete
|
1208
|
+
* @param updated_by
|
1209
|
+
* @returns A prom that resolves when the customer and shipping address are updated.
|
1210
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
1211
|
+
*/
|
1212
|
+
deleteProductInOrderWithoutLogin(orderId, orderItemId, reason, updated_by) {
|
1213
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1214
|
+
const endpoint = `/front/orders/${this.orgId}/${this.storeId}/${orderId}/${orderItemId}/remove?updated_by=${updated_by}&reason=${reason}`;
|
1215
|
+
const method = "DELETE";
|
1216
|
+
try {
|
1217
|
+
const response = yield this.restApiCallWithToken(endpoint, method);
|
1218
|
+
return response;
|
1219
|
+
}
|
1220
|
+
catch (error) {
|
1221
|
+
console.log(`Error in deleteNoteWithoutLogin: ${error}`);
|
1222
|
+
throw error;
|
1223
|
+
}
|
1224
|
+
});
|
1225
|
+
}
|
1226
|
+
/**
|
1227
|
+
* get list order realation
|
1228
|
+
* @param orderId - The id of order
|
1229
|
+
* @param updated_by
|
1230
|
+
* @returns A prom that resolves when the customer and shipping address are updated.
|
1231
|
+
* @throws If an error occurs while updating the customer and shipping address.
|
1232
|
+
*/
|
1233
|
+
addProductInOrderWithoutLogin(orderId, updated_by, data) {
|
1234
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1235
|
+
const endpoint = `/front/orders/${this.orgId}/${this.storeId}/${orderId}/orderLineItem?updated_by=${updated_by}`;
|
1236
|
+
const method = "POST";
|
1237
|
+
try {
|
1238
|
+
const response = yield this.restApiCallWithToken(endpoint, method, data);
|
1239
|
+
return response;
|
1240
|
+
}
|
1241
|
+
catch (error) {
|
1242
|
+
console.log(`Error in deleteNoteWithoutLogin: ${error}`);
|
1243
|
+
throw error;
|
1244
|
+
}
|
1201
1245
|
});
|
1202
1246
|
}
|
1203
1247
|
}
|
@@ -39,4 +39,5 @@ export declare class ProductService extends Service {
|
|
39
39
|
getResourceByProduct(productId: string): Promise<any>;
|
40
40
|
getProductVariantById(variantId: string): Promise<any>;
|
41
41
|
getRelatedInfor(id: string): Promise<any>;
|
42
|
+
getDetailStores(storeId: string): Promise<any>;
|
42
43
|
}
|
@@ -212,5 +212,22 @@ class ProductService extends serviceSDK_1.Service {
|
|
212
212
|
}
|
213
213
|
});
|
214
214
|
}
|
215
|
+
getDetailStores(storeId) {
|
216
|
+
return __awaiter(this, void 0, void 0, function* () {
|
217
|
+
const query = queries_1.GET_DETAIL_STORES;
|
218
|
+
const variablesHandle = {
|
219
|
+
partnerId: this.orgId,
|
220
|
+
storeId,
|
221
|
+
};
|
222
|
+
try {
|
223
|
+
const response = yield this.graphqlQueryV2(query, variablesHandle);
|
224
|
+
return response.getDetailStores;
|
225
|
+
}
|
226
|
+
catch (error) {
|
227
|
+
console.log(`Error fetching getDetailStores error : ${error}`);
|
228
|
+
throw error;
|
229
|
+
}
|
230
|
+
});
|
231
|
+
}
|
215
232
|
}
|
216
233
|
exports.ProductService = ProductService;
|
@@ -3,4 +3,5 @@ export declare class ResourcePermissionService extends Service {
|
|
3
3
|
constructor(endpoint: string, orgId: string, storeId: string);
|
4
4
|
setToken(token: string): void;
|
5
5
|
shareResource(createModel: any): Promise<any>;
|
6
|
+
removeShareParty(resourceId: string, sharePartyId: string): Promise<any>;
|
6
7
|
}
|
@@ -36,5 +36,25 @@ class ResourcePermissionService extends serviceSDK_1.Service {
|
|
36
36
|
}
|
37
37
|
});
|
38
38
|
}
|
39
|
+
removeShareParty(resourceId, sharePartyId) {
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
41
|
+
const mutation = mutations_1.REMOVE_SHARE_PARTY;
|
42
|
+
const variables = {
|
43
|
+
partnerId: this.orgId,
|
44
|
+
orgId: this.orgId,
|
45
|
+
resourceType: "Service",
|
46
|
+
resourceId,
|
47
|
+
sharePartyId,
|
48
|
+
};
|
49
|
+
try {
|
50
|
+
const response = yield this.graphqlMutationV2(mutation, variables);
|
51
|
+
return response.removeShareParty;
|
52
|
+
}
|
53
|
+
catch (error) {
|
54
|
+
console.log(`Error in removeShareParty: ${error}`);
|
55
|
+
throw error;
|
56
|
+
}
|
57
|
+
});
|
58
|
+
}
|
39
59
|
}
|
40
60
|
exports.ResourcePermissionService = ResourcePermissionService;
|