@longvansoftware/storefront-js-client 1.3.9 → 1.4.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/service/mutations.d.ts +1 -0
- package/dist/src/graphql/service/mutations.js +39 -1
- package/dist/src/graphql/service/queries.d.ts +1 -0
- package/dist/src/graphql/service/queries.js +16 -1
- package/dist/src/lib/SDK.js +0 -2
- package/dist/src/lib/service/index.d.ts +2 -1
- package/dist/src/lib/service/index.js +32 -16
- package/dist/src/lib/serviceSDK.js +3 -4
- package/dist/src/lib/user/index.d.ts +1 -1
- package/dist/src/lib/user/index.js +1 -1
- package/package.json +1 -1
|
@@ -6,3 +6,4 @@ export declare const DELETE_ATTR_VALUE: import("graphql").DocumentNode;
|
|
|
6
6
|
export declare const UPDATE_SUCCESS_ACTION_PROCESS_STATUS: import("graphql").DocumentNode;
|
|
7
7
|
export declare const UPDATE_FAIL_ACTION_PROCESS_STATUS: import("graphql").DocumentNode;
|
|
8
8
|
export declare const CREATE_SERVICE_TICKET: import("graphql").DocumentNode;
|
|
9
|
+
export declare const CREATE_SERVICE_ACTION: import("graphql").DocumentNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CREATE_SERVICE_TICKET = exports.UPDATE_FAIL_ACTION_PROCESS_STATUS = exports.UPDATE_SUCCESS_ACTION_PROCESS_STATUS = exports.DELETE_ATTR_VALUE = exports.UPDATE_ATTR_VALUE = exports.DELETE_SERVICE = exports.UPDATE_SERVICE = exports.CREATE_SERVICE = void 0;
|
|
3
|
+
exports.CREATE_SERVICE_ACTION = exports.CREATE_SERVICE_TICKET = exports.UPDATE_FAIL_ACTION_PROCESS_STATUS = exports.UPDATE_SUCCESS_ACTION_PROCESS_STATUS = exports.DELETE_ATTR_VALUE = exports.UPDATE_ATTR_VALUE = exports.DELETE_SERVICE = exports.UPDATE_SERVICE = exports.CREATE_SERVICE = void 0;
|
|
4
4
|
const graphql_tag_1 = require("graphql-tag");
|
|
5
5
|
exports.CREATE_SERVICE = (0, graphql_tag_1.gql) `
|
|
6
6
|
mutation CreateService($partnerId: String!, $createModel: ServiceRequest!) {
|
|
@@ -201,3 +201,41 @@ exports.CREATE_SERVICE_TICKET = (0, graphql_tag_1.gql) `
|
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
`;
|
|
204
|
+
// mutation CreateServiceAction {
|
|
205
|
+
// createServiceAction(serviceId: null, actionType: null, createdBy: null) {
|
|
206
|
+
// id
|
|
207
|
+
// serviceId
|
|
208
|
+
// actionType
|
|
209
|
+
// description
|
|
210
|
+
// status
|
|
211
|
+
// processStatus
|
|
212
|
+
// createdBy
|
|
213
|
+
// createdStamp
|
|
214
|
+
// updatedBy
|
|
215
|
+
// updatedStamp
|
|
216
|
+
// }
|
|
217
|
+
// }
|
|
218
|
+
exports.CREATE_SERVICE_ACTION = (0, graphql_tag_1.gql) `
|
|
219
|
+
mutation CreateServiceAction(
|
|
220
|
+
$serviceId: String!
|
|
221
|
+
$actionType: String!
|
|
222
|
+
$createdBy: String!
|
|
223
|
+
) {
|
|
224
|
+
createServiceAction(
|
|
225
|
+
serviceId: $serviceId
|
|
226
|
+
actionType: $actionType
|
|
227
|
+
createdBy: $createdBy
|
|
228
|
+
) {
|
|
229
|
+
id
|
|
230
|
+
serviceId
|
|
231
|
+
actionType
|
|
232
|
+
description
|
|
233
|
+
status
|
|
234
|
+
processStatus
|
|
235
|
+
createdBy
|
|
236
|
+
createdStamp
|
|
237
|
+
updatedBy
|
|
238
|
+
updatedStamp
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
`;
|
|
@@ -2,3 +2,4 @@ export declare const GET_SERVICE_BY_ID: import("graphql").DocumentNode;
|
|
|
2
2
|
export declare const GET_SERVICE_BY_TYPE: import("graphql").DocumentNode;
|
|
3
3
|
export declare const GET_SERVICE_BY_OWNER_ID: import("graphql").DocumentNode;
|
|
4
4
|
export declare const GET_SERVICE_ACTION: import("graphql").DocumentNode;
|
|
5
|
+
export declare const GET_SERVICE_TICKETS: import("graphql").DocumentNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GET_SERVICE_ACTION = exports.GET_SERVICE_BY_OWNER_ID = exports.GET_SERVICE_BY_TYPE = exports.GET_SERVICE_BY_ID = void 0;
|
|
3
|
+
exports.GET_SERVICE_TICKETS = exports.GET_SERVICE_ACTION = exports.GET_SERVICE_BY_OWNER_ID = exports.GET_SERVICE_BY_TYPE = exports.GET_SERVICE_BY_ID = void 0;
|
|
4
4
|
const graphql_tag_1 = require("graphql-tag");
|
|
5
5
|
exports.GET_SERVICE_BY_ID = (0, graphql_tag_1.gql) `
|
|
6
6
|
query GetServiceById($partnerId: String!, $serviceId: String!) {
|
|
@@ -152,3 +152,18 @@ exports.GET_SERVICE_ACTION = (0, graphql_tag_1.gql) `
|
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
`;
|
|
155
|
+
exports.GET_SERVICE_TICKETS = (0, graphql_tag_1.gql) `
|
|
156
|
+
query GetServiceTickets($serviceId: String!) {
|
|
157
|
+
getServiceTickets(serviceId: $serviceId) {
|
|
158
|
+
id
|
|
159
|
+
serviceId
|
|
160
|
+
description
|
|
161
|
+
status
|
|
162
|
+
processStatus
|
|
163
|
+
createdBy
|
|
164
|
+
createdStamp
|
|
165
|
+
updatedBy
|
|
166
|
+
updatedStamp
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
`;
|
package/dist/src/lib/SDK.js
CHANGED
|
@@ -17,8 +17,6 @@ class SDK {
|
|
|
17
17
|
this.orgId = orgId;
|
|
18
18
|
this.storeId = storeId;
|
|
19
19
|
this.storefrontAccessToken = storefrontAccessToken;
|
|
20
|
-
// public crm: CrmService;
|
|
21
|
-
// Other services here
|
|
22
20
|
this.token = null;
|
|
23
21
|
(0, helpers_1.validateStorefrontAccessToken)(storefrontAccessToken);
|
|
24
22
|
const endpoints = config_1.environmentEndpoints.dev;
|
|
@@ -17,7 +17,6 @@ export declare class ServiceManagementService extends Service {
|
|
|
17
17
|
* get service by type
|
|
18
18
|
* @param type - The endpoint URL for the service.
|
|
19
19
|
*/
|
|
20
|
-
getServiceByType(type: string): Promise<any>;
|
|
21
20
|
/**
|
|
22
21
|
* get service by owner id
|
|
23
22
|
* @param ownerId - The endpoint URL for the service.
|
|
@@ -88,4 +87,6 @@ export declare class ServiceManagementService extends Service {
|
|
|
88
87
|
* @throws {Error} - If an error occurs during the creation of the service ticket.
|
|
89
88
|
*/
|
|
90
89
|
createServiceTicket(serviceId: string, name: string, createdBy: string, description: string): Promise<any>;
|
|
90
|
+
getServiceTicket(serviceId: string): Promise<any>;
|
|
91
|
+
createServiceAction(serviceId: string, actionType: string, createdBy: string): Promise<any>;
|
|
91
92
|
}
|
|
@@ -48,22 +48,6 @@ class ServiceManagementService extends serviceSDK_1.Service {
|
|
|
48
48
|
* get service by type
|
|
49
49
|
* @param type - The endpoint URL for the service.
|
|
50
50
|
*/
|
|
51
|
-
getServiceByType(type) {
|
|
52
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
53
|
-
const query = queries_1.GET_SERVICE_BY_TYPE;
|
|
54
|
-
const variables = {
|
|
55
|
-
partnerId: this.orgId,
|
|
56
|
-
type,
|
|
57
|
-
};
|
|
58
|
-
try {
|
|
59
|
-
const response = yield this.graphqlQuery(query, variables);
|
|
60
|
-
return response.getServiceByType;
|
|
61
|
-
}
|
|
62
|
-
catch (error) {
|
|
63
|
-
console.log(`Error in getServiceByType :${error}`);
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
51
|
/**
|
|
68
52
|
* get service by owner id
|
|
69
53
|
* @param ownerId - The endpoint URL for the service.
|
|
@@ -294,5 +278,37 @@ class ServiceManagementService extends serviceSDK_1.Service {
|
|
|
294
278
|
}
|
|
295
279
|
});
|
|
296
280
|
}
|
|
281
|
+
getServiceTicket(serviceId) {
|
|
282
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
283
|
+
const query = queries_1.GET_SERVICE_TICKETS;
|
|
284
|
+
const variables = {
|
|
285
|
+
serviceId,
|
|
286
|
+
};
|
|
287
|
+
try {
|
|
288
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
289
|
+
return response.getServiceTickets;
|
|
290
|
+
}
|
|
291
|
+
catch (error) {
|
|
292
|
+
throw error;
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
createServiceAction(serviceId, actionType, createdBy) {
|
|
297
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
298
|
+
const mutation = mutations_1.CREATE_SERVICE_ACTION;
|
|
299
|
+
const variables = {
|
|
300
|
+
serviceId,
|
|
301
|
+
actionType,
|
|
302
|
+
createdBy,
|
|
303
|
+
};
|
|
304
|
+
try {
|
|
305
|
+
const response = yield this.graphqlMutation(mutation, variables);
|
|
306
|
+
return response.createServiceAction;
|
|
307
|
+
}
|
|
308
|
+
catch (error) {
|
|
309
|
+
throw error;
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
}
|
|
297
313
|
}
|
|
298
314
|
exports.ServiceManagementService = ServiceManagementService;
|
|
@@ -70,7 +70,6 @@ class Service {
|
|
|
70
70
|
return data;
|
|
71
71
|
}
|
|
72
72
|
catch (error) {
|
|
73
|
-
console.log(`Error in graphqlMutation: ${error}`);
|
|
74
73
|
throw error;
|
|
75
74
|
}
|
|
76
75
|
});
|
|
@@ -79,7 +78,6 @@ class Service {
|
|
|
79
78
|
return __awaiter(this, void 0, void 0, function* () {
|
|
80
79
|
try {
|
|
81
80
|
const modifiedHeaders = Object.assign(Object.assign({}, headers), { "Partner-Id": this.orgId, "X-Ecomos-Access-Token": this.token });
|
|
82
|
-
console.log("🚀 ~ Service ~ modifiedHeaders:", modifiedHeaders);
|
|
83
81
|
const response = yield (0, axios_1.default)({
|
|
84
82
|
url: this.endpoint + path,
|
|
85
83
|
method,
|
|
@@ -89,7 +87,6 @@ class Service {
|
|
|
89
87
|
return response.data;
|
|
90
88
|
}
|
|
91
89
|
catch (error) {
|
|
92
|
-
console.log(`Error in restApiCallWithToken: ${error}`);
|
|
93
90
|
throw error;
|
|
94
91
|
}
|
|
95
92
|
});
|
|
@@ -98,7 +95,6 @@ class Service {
|
|
|
98
95
|
return __awaiter(this, void 0, void 0, function* () {
|
|
99
96
|
try {
|
|
100
97
|
const modifiedHeaders = Object.assign(Object.assign({}, headers), { PartnerId: this.orgId });
|
|
101
|
-
console.log("🚀 ~ Service ~ modifiedHeaders:", modifiedHeaders);
|
|
102
98
|
const response = yield (0, axios_1.default)({
|
|
103
99
|
url: this.endpoint + path,
|
|
104
100
|
method,
|
|
@@ -108,6 +104,9 @@ class Service {
|
|
|
108
104
|
return response.data;
|
|
109
105
|
}
|
|
110
106
|
catch (error) {
|
|
107
|
+
if (error.response.status === 401) {
|
|
108
|
+
throw new Error("Không có quyền truy cập!");
|
|
109
|
+
}
|
|
111
110
|
console.log(`Error in restApiCallWithNoToken: ${error}`);
|
|
112
111
|
throw error;
|
|
113
112
|
}
|
|
@@ -5,7 +5,7 @@ export declare class UserService extends Service {
|
|
|
5
5
|
getPersonByPartyIds(partyIds: string[]): Promise<any>;
|
|
6
6
|
createCompany(payload: createCompanyRequest, createdBy: string): Promise<any>;
|
|
7
7
|
updateCompanyInfo(id: string, fieldName: string, valueUpdate: string, updatedBy: string): Promise<any>;
|
|
8
|
-
|
|
8
|
+
updateCustomer(id: string, customerItem: updateCustomerRequest, updatedBy: string): Promise<any>;
|
|
9
9
|
getCustomerById(id: string): Promise<any>;
|
|
10
10
|
searchCompany(keyword: string, limit: number): Promise<any>;
|
|
11
11
|
createCustomerV2(createCustomerRequest: createCustomerRequest, createdBy: string): Promise<any>;
|
|
@@ -70,7 +70,7 @@ class UserService extends serviceSDK_1.Service {
|
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
|
-
|
|
73
|
+
updateCustomer(id, customerItem, updatedBy) {
|
|
74
74
|
return __awaiter(this, void 0, void 0, function* () {
|
|
75
75
|
const mutation = mutations_1.UPDATE_CUSTOMER_V2;
|
|
76
76
|
const variables = {
|