@longvansoftware/service-js-client 1.4.0 → 1.4.2
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/SDK.js +1 -1
- package/dist/src/lib/product/index.d.ts +2 -1
- package/dist/src/lib/product/index.js +19 -2
- 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
|
+
`;
|
package/dist/src/lib/SDK.js
CHANGED
@@ -26,7 +26,7 @@ class SDK {
|
|
26
26
|
this.storefrontAccessToken = storefrontAccessToken;
|
27
27
|
this.environment = environment;
|
28
28
|
this.token = null;
|
29
|
-
|
29
|
+
console.log("🚀 ~ SDK ~ storeId:", storeId);
|
30
30
|
(0, helpers_1.validateStorefrontAccessToken)(storefrontAccessToken);
|
31
31
|
const endpoints = environment == "live"
|
32
32
|
? config_1.environmentEndpoints.live
|
@@ -34,9 +34,10 @@ export declare class ProductService extends Service {
|
|
34
34
|
getSimpleProducts(variables: any): Promise<Product[] | null>;
|
35
35
|
getProductOption(productId: string): Promise<any>;
|
36
36
|
getPolicy(groupId: string): Promise<any>;
|
37
|
-
getProducts(param: getProduct): Promise<any>;
|
37
|
+
getProducts(param: getProduct, store: string): Promise<any>;
|
38
38
|
getHandleByServiceTypes(serviceTypes: [string]): Promise<any>;
|
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
|
}
|
@@ -128,10 +128,10 @@ class ProductService extends serviceSDK_1.Service {
|
|
128
128
|
}
|
129
129
|
});
|
130
130
|
}
|
131
|
-
getProducts(param) {
|
131
|
+
getProducts(param, store) {
|
132
132
|
return __awaiter(this, void 0, void 0, function* () {
|
133
133
|
const query = queries_1.GET_PRODUCTS;
|
134
|
-
const variablesHandle = Object.assign({ partnerId: this.orgId, storeChannel: this.storeId }, param);
|
134
|
+
const variablesHandle = Object.assign({ partnerId: this.orgId, storeChannel: store ? store : this.storeId }, param);
|
135
135
|
try {
|
136
136
|
const response = yield this.graphqlQueryV2(query, variablesHandle);
|
137
137
|
return response.getProducts;
|
@@ -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;
|