@longvansoftware/storefront-js-client 1.2.1 → 1.2.3
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 +10 -1
- package/dist/src/graphql/user/queries.d.ts +1 -0
- package/dist/src/graphql/user/queries.js +18 -1
- package/dist/src/lib/crm/index.js +10 -10
- package/dist/src/lib/order/index.d.ts +1 -0
- package/dist/src/lib/order/index.js +4 -0
- package/dist/src/lib/product/index.d.ts +1 -0
- package/dist/src/lib/product/index.js +16 -0
- package/dist/src/lib/service.js +1 -0
- package/dist/src/lib/user/index.d.ts +1 -0
- package/dist/src/lib/user/index.js +19 -1
- package/dist/src/types/crm.d.ts +1 -0
- package/dist/src/types/user.d.ts +1 -1
- package/package.json +2 -2
|
@@ -8,3 +8,4 @@ export declare const GET_BRANDS_QUERY = "\nquery GetBrands($partnerId: String!,
|
|
|
8
8
|
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
9
|
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
10
|
export declare const GET_PRODUCT_OPTION: import("graphql").DocumentNode;
|
|
11
|
+
export declare const GET_POLICY: import("graphql").DocumentNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
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_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(
|
|
@@ -413,3 +413,12 @@ exports.GET_PRODUCT_OPTION = (0, graphql_tag_1.gql) `
|
|
|
413
413
|
}
|
|
414
414
|
}
|
|
415
415
|
`;
|
|
416
|
+
exports.GET_POLICY = (0, graphql_tag_1.gql) `
|
|
417
|
+
query GetPolicy(
|
|
418
|
+
$groupId: String!
|
|
419
|
+
) {
|
|
420
|
+
getPolicy(groupId: $groupId) {
|
|
421
|
+
value
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
`;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GET_CUSTOMER_BY_ID = exports.GET_PERSON_BY_IDS_QUERY = void 0;
|
|
3
|
+
exports.SEARCH_COMPANY = exports.GET_CUSTOMER_BY_ID = exports.GET_PERSON_BY_IDS_QUERY = void 0;
|
|
4
4
|
const graphql_tag_1 = require("graphql-tag");
|
|
5
5
|
exports.GET_PERSON_BY_IDS_QUERY = (0, graphql_tag_1.gql) `
|
|
6
6
|
query GetPersonByIds($partyIds: [String!]!) {
|
|
@@ -48,3 +48,20 @@ query GetCustomerById($id: String!){
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
`;
|
|
51
|
+
exports.SEARCH_COMPANY = (0, graphql_tag_1.gql) `
|
|
52
|
+
query SearchCompany($keyword: String, $orgId: String!, $limit: Int){
|
|
53
|
+
searchCompany(keyword: $keyword, orgId: $orgId, limit: $limit) {
|
|
54
|
+
id
|
|
55
|
+
name
|
|
56
|
+
address
|
|
57
|
+
gender
|
|
58
|
+
identityNumber
|
|
59
|
+
birthDate
|
|
60
|
+
email
|
|
61
|
+
phone
|
|
62
|
+
createdStamp
|
|
63
|
+
createdBy
|
|
64
|
+
memberLevel
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
`;
|
|
@@ -89,14 +89,14 @@ class CrmService extends service_1.Service {
|
|
|
89
89
|
}
|
|
90
90
|
updateStatusAttachmentById(performerId, attachmentId, status) {
|
|
91
91
|
return __awaiter(this, void 0, void 0, function* () {
|
|
92
|
-
const
|
|
92
|
+
const mutation = mutations_1.UPDATE_STATUS_ATTACHMENT_BY_ID;
|
|
93
93
|
const variables = {
|
|
94
94
|
performerId,
|
|
95
95
|
attachmentId,
|
|
96
96
|
status
|
|
97
97
|
};
|
|
98
98
|
try {
|
|
99
|
-
const response = yield this.
|
|
99
|
+
const response = yield this.graphqlMutation(mutation, variables);
|
|
100
100
|
return response.updateStatusAttachmentById;
|
|
101
101
|
}
|
|
102
102
|
catch (error) {
|
|
@@ -107,14 +107,14 @@ class CrmService extends service_1.Service {
|
|
|
107
107
|
}
|
|
108
108
|
updateWorkEffortDescription(performerId, workEffortId, description) {
|
|
109
109
|
return __awaiter(this, void 0, void 0, function* () {
|
|
110
|
-
const
|
|
110
|
+
const mutation = mutations_1.UPDATE_WORK_EFFORT_DESCRIPTION;
|
|
111
111
|
const variables = {
|
|
112
112
|
performerId,
|
|
113
113
|
workEffortId,
|
|
114
114
|
description
|
|
115
115
|
};
|
|
116
116
|
try {
|
|
117
|
-
const response = yield this.
|
|
117
|
+
const response = yield this.graphqlMutation(mutation, variables);
|
|
118
118
|
return response.updateWorkEffortDescription;
|
|
119
119
|
}
|
|
120
120
|
catch (error) {
|
|
@@ -125,7 +125,7 @@ class CrmService extends service_1.Service {
|
|
|
125
125
|
}
|
|
126
126
|
updateWorkEffortName(performerId, workEffortId, name) {
|
|
127
127
|
return __awaiter(this, void 0, void 0, function* () {
|
|
128
|
-
const
|
|
128
|
+
const mutation = mutations_1.UPDATE_WORK_EFFORT_NAME;
|
|
129
129
|
const variables = {
|
|
130
130
|
partyId: this.orgId,
|
|
131
131
|
performerId,
|
|
@@ -133,7 +133,7 @@ class CrmService extends service_1.Service {
|
|
|
133
133
|
newName: name
|
|
134
134
|
};
|
|
135
135
|
try {
|
|
136
|
-
const response = yield this.
|
|
136
|
+
const response = yield this.graphqlMutation(mutation, variables);
|
|
137
137
|
return response.updateWorkEffortName;
|
|
138
138
|
}
|
|
139
139
|
catch (error) {
|
|
@@ -144,7 +144,7 @@ class CrmService extends service_1.Service {
|
|
|
144
144
|
}
|
|
145
145
|
updateWorkEffortStatus(performerId, workEffortId, source, status) {
|
|
146
146
|
return __awaiter(this, void 0, void 0, function* () {
|
|
147
|
-
const
|
|
147
|
+
const mutation = mutations_1.UPDATE_WORK_EFFORT_STATUS;
|
|
148
148
|
const variables = {
|
|
149
149
|
partyId: this.orgId,
|
|
150
150
|
performerId,
|
|
@@ -153,7 +153,7 @@ class CrmService extends service_1.Service {
|
|
|
153
153
|
status
|
|
154
154
|
};
|
|
155
155
|
try {
|
|
156
|
-
const response = yield this.
|
|
156
|
+
const response = yield this.graphqlMutation(mutation, variables);
|
|
157
157
|
return response.updateWorkEffortStatus;
|
|
158
158
|
}
|
|
159
159
|
catch (error) {
|
|
@@ -164,7 +164,7 @@ class CrmService extends service_1.Service {
|
|
|
164
164
|
}
|
|
165
165
|
addAttachmentForWorkEffort(performerId, workEffortId, attachments) {
|
|
166
166
|
return __awaiter(this, void 0, void 0, function* () {
|
|
167
|
-
const
|
|
167
|
+
const mutation = mutations_1.ADD_ATTACHMENT_FOR_WORK_EFFORT;
|
|
168
168
|
const variables = {
|
|
169
169
|
partyId: this.orgId,
|
|
170
170
|
performerId,
|
|
@@ -172,7 +172,7 @@ class CrmService extends service_1.Service {
|
|
|
172
172
|
attachments,
|
|
173
173
|
};
|
|
174
174
|
try {
|
|
175
|
-
const response = yield this.
|
|
175
|
+
const response = yield this.graphqlMutation(mutation, variables);
|
|
176
176
|
return response.addAttachmentForWorkEffort;
|
|
177
177
|
}
|
|
178
178
|
catch (error) {
|
|
@@ -11,6 +11,7 @@ export declare class OrderService extends Service {
|
|
|
11
11
|
* @param storeId - The store ID.
|
|
12
12
|
*/
|
|
13
13
|
constructor(endpoint: string, orgId: string, storeId: string);
|
|
14
|
+
setToken(token: string): void;
|
|
14
15
|
/**
|
|
15
16
|
* Creates a new order.
|
|
16
17
|
* @param orderData - The data for the order.
|
|
@@ -24,6 +24,10 @@ class OrderService extends service_1.Service {
|
|
|
24
24
|
constructor(endpoint, orgId, storeId) {
|
|
25
25
|
super(endpoint, orgId, storeId);
|
|
26
26
|
}
|
|
27
|
+
setToken(token) {
|
|
28
|
+
console.log("🚀 ~ OrderService ~ setToken ~ token:", token);
|
|
29
|
+
this.token = token;
|
|
30
|
+
}
|
|
27
31
|
/**
|
|
28
32
|
* Creates a new order.
|
|
29
33
|
* @param orderData - The data for the order.
|
|
@@ -112,5 +112,21 @@ class ProductService extends service_1.Service {
|
|
|
112
112
|
}
|
|
113
113
|
});
|
|
114
114
|
}
|
|
115
|
+
getPolicy(groupId) {
|
|
116
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
117
|
+
const query = queries_1.GET_POLICY;
|
|
118
|
+
const variablesHandle = {
|
|
119
|
+
groupId
|
|
120
|
+
};
|
|
121
|
+
try {
|
|
122
|
+
const response = yield this.graphqlQuery(query, variablesHandle);
|
|
123
|
+
return response.getPolicy;
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
console.log(`Error fetching getPolicy: ${error}`);
|
|
127
|
+
throw error;
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
}
|
|
115
131
|
}
|
|
116
132
|
exports.ProductService = ProductService;
|
package/dist/src/lib/service.js
CHANGED
|
@@ -79,6 +79,7 @@ class Service {
|
|
|
79
79
|
return __awaiter(this, void 0, void 0, function* () {
|
|
80
80
|
try {
|
|
81
81
|
const modifiedHeaders = Object.assign(Object.assign({}, headers), { "Partner-Id": this.orgId, "X-Ecomos-Access-Token": this.token });
|
|
82
|
+
console.log("🚀 ~ Service ~ modifiedHeaders:", modifiedHeaders);
|
|
82
83
|
const response = yield (0, axios_1.default)({
|
|
83
84
|
url: this.endpoint + path,
|
|
84
85
|
method,
|
|
@@ -7,4 +7,5 @@ export declare class UserService extends Service {
|
|
|
7
7
|
updateCompanyInfo(id: string, fieldName: string, valueUpdate: string, updatedBy: string): Promise<any>;
|
|
8
8
|
updateCustomerV2(id: string, customerItem: updateCustomerRequest, updatedBy: string): Promise<any>;
|
|
9
9
|
getCustomerById(id: string): Promise<any>;
|
|
10
|
+
searchCompany(keyword: string, limit: number): Promise<any>;
|
|
10
11
|
}
|
|
@@ -38,7 +38,7 @@ class UserService extends service_1.Service {
|
|
|
38
38
|
orgId: this.orgId,
|
|
39
39
|
createCompanyRequest: {
|
|
40
40
|
name: payload === null || payload === void 0 ? void 0 : payload.name,
|
|
41
|
-
phone: payload === null || payload === void 0 ? void 0 : payload.
|
|
41
|
+
phone: payload === null || payload === void 0 ? void 0 : payload.referPhone,
|
|
42
42
|
address: payload === null || payload === void 0 ? void 0 : payload.address,
|
|
43
43
|
},
|
|
44
44
|
createTaxCodeRequest: null,
|
|
@@ -113,5 +113,23 @@ class UserService extends service_1.Service {
|
|
|
113
113
|
}
|
|
114
114
|
});
|
|
115
115
|
}
|
|
116
|
+
searchCompany(keyword, limit) {
|
|
117
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
118
|
+
const query = queries_1.SEARCH_COMPANY;
|
|
119
|
+
const variables = {
|
|
120
|
+
keyword,
|
|
121
|
+
orgId: this.orgId,
|
|
122
|
+
limit,
|
|
123
|
+
};
|
|
124
|
+
try {
|
|
125
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
126
|
+
return response.searchCompany;
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
console.log(`Error in searchCompany: ${error}`);
|
|
130
|
+
throw error;
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
}
|
|
116
134
|
}
|
|
117
135
|
exports.UserService = UserService;
|
package/dist/src/types/crm.d.ts
CHANGED
package/dist/src/types/user.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@longvansoftware/storefront-js-client",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"main": "dist/src/index.js",
|
|
5
5
|
"types": "dist/src/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"author": "",
|
|
20
20
|
"license": "ISC",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@apollo/client": "3.
|
|
22
|
+
"@apollo/client": "3.9.11",
|
|
23
23
|
"apollo-boost": "^0.4.9",
|
|
24
24
|
"axios": "^1.6.8",
|
|
25
25
|
"crypto-js": "^4.2.0",
|