@longvansoftware/storefront-js-client 1.2.4 → 1.2.6
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 +25 -0
- package/dist/src/lib/auth/index.d.ts +1 -0
- package/dist/src/lib/auth/index.js +18 -0
- package/dist/src/lib/user/index.d.ts +2 -2
- package/dist/src/lib/user/index.js +3 -11
- package/dist/src/types/user.d.ts +6 -2
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const GET_USER_DETAIL: import("graphql").DocumentNode;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GET_USER_DETAIL = void 0;
|
|
4
|
+
const graphql_tag_1 = require("graphql-tag");
|
|
5
|
+
exports.GET_USER_DETAIL = (0, graphql_tag_1.gql) `
|
|
6
|
+
query GetUserDetail($orgId: String!, $accessToken: String!) {
|
|
7
|
+
getUserDetail(orgId: $orgId, accessToken: $accessToken) {
|
|
8
|
+
partyId
|
|
9
|
+
orgId
|
|
10
|
+
fullName
|
|
11
|
+
email
|
|
12
|
+
phone
|
|
13
|
+
address
|
|
14
|
+
identityNumber
|
|
15
|
+
gender
|
|
16
|
+
birthDate
|
|
17
|
+
avatarUrl
|
|
18
|
+
accessToken
|
|
19
|
+
username
|
|
20
|
+
orgPermissionsMap
|
|
21
|
+
orgPositionsMap
|
|
22
|
+
orgRolesMap
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.AuthService = void 0;
|
|
13
13
|
const service_1 = require("../service");
|
|
14
14
|
const mutations_1 = require("../../graphql/auth/mutations");
|
|
15
|
+
const queries_1 = require("../../graphql/auth/queries");
|
|
15
16
|
/**
|
|
16
17
|
* Represents the authentication service.
|
|
17
18
|
*/
|
|
@@ -50,5 +51,22 @@ class AuthService extends service_1.Service {
|
|
|
50
51
|
yield this.graphqlMutation(mutations_1.REGISTER_MUTATION, variables);
|
|
51
52
|
});
|
|
52
53
|
}
|
|
54
|
+
getUserDetail(accessToken) {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
const query = queries_1.GET_USER_DETAIL;
|
|
57
|
+
const variables = {
|
|
58
|
+
orgId: this.orgId,
|
|
59
|
+
accessToken,
|
|
60
|
+
};
|
|
61
|
+
try {
|
|
62
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
63
|
+
return response.getUserDetail;
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
console.log(`Error in getUserDetail: ${error}`);
|
|
67
|
+
throw error;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
53
71
|
}
|
|
54
72
|
exports.AuthService = AuthService;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Service } from
|
|
2
|
-
import { createCompanyRequest, updateCustomerRequest } from
|
|
1
|
+
import { Service } from "../service";
|
|
2
|
+
import { createCompanyRequest, updateCustomerRequest } from "../../types/user";
|
|
3
3
|
export declare class UserService extends Service {
|
|
4
4
|
constructor(endpoint: string, orgId: string, storeId: string);
|
|
5
5
|
getPersonByPartyIds(partyIds: string[]): Promise<any>;
|
|
@@ -36,11 +36,7 @@ class UserService extends service_1.Service {
|
|
|
36
36
|
const mutation = mutations_1.CREATE_COMPANY;
|
|
37
37
|
const variables = {
|
|
38
38
|
orgId: this.orgId,
|
|
39
|
-
createCompanyRequest:
|
|
40
|
-
name: payload === null || payload === void 0 ? void 0 : payload.name,
|
|
41
|
-
phone: payload === null || payload === void 0 ? void 0 : payload.referPhone,
|
|
42
|
-
address: payload === null || payload === void 0 ? void 0 : payload.address,
|
|
43
|
-
},
|
|
39
|
+
createCompanyRequest: payload,
|
|
44
40
|
createTaxCodeRequest: null,
|
|
45
41
|
createdBy,
|
|
46
42
|
};
|
|
@@ -80,11 +76,7 @@ class UserService extends service_1.Service {
|
|
|
80
76
|
const variables = {
|
|
81
77
|
tenantId: this.orgId,
|
|
82
78
|
id,
|
|
83
|
-
updateCustomerRequest:
|
|
84
|
-
name: customerItem === null || customerItem === void 0 ? void 0 : customerItem.fullName,
|
|
85
|
-
phone: customerItem === null || customerItem === void 0 ? void 0 : customerItem.phone,
|
|
86
|
-
address: customerItem === null || customerItem === void 0 ? void 0 : customerItem.address
|
|
87
|
-
},
|
|
79
|
+
updateCustomerRequest: customerItem,
|
|
88
80
|
updatedBy,
|
|
89
81
|
};
|
|
90
82
|
try {
|
|
@@ -101,7 +93,7 @@ class UserService extends service_1.Service {
|
|
|
101
93
|
return __awaiter(this, void 0, void 0, function* () {
|
|
102
94
|
const query = queries_1.GET_CUSTOMER_BY_ID;
|
|
103
95
|
const variables = {
|
|
104
|
-
id
|
|
96
|
+
id,
|
|
105
97
|
};
|
|
106
98
|
try {
|
|
107
99
|
const response = yield this.graphqlQuery(query, variables);
|
package/dist/src/types/user.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export interface createCompanyRequest {
|
|
2
2
|
name: string;
|
|
3
|
-
|
|
3
|
+
phone: string;
|
|
4
4
|
address: string;
|
|
5
|
+
email: string;
|
|
5
6
|
}
|
|
6
7
|
export interface CreateCompany {
|
|
7
8
|
id: string;
|
|
@@ -17,9 +18,12 @@ export interface CreateCompany {
|
|
|
17
18
|
memberLevel: string;
|
|
18
19
|
}
|
|
19
20
|
export interface updateCustomerRequest {
|
|
20
|
-
|
|
21
|
+
name: string;
|
|
21
22
|
phone: string;
|
|
22
23
|
address: string;
|
|
24
|
+
birthDate: Date;
|
|
25
|
+
email: string;
|
|
26
|
+
gender: string;
|
|
23
27
|
}
|
|
24
28
|
export interface GetPersonByPartyIds {
|
|
25
29
|
status: string;
|