@longvansoftware/storefront-js-client 3.0.1 → 3.0.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.
@@ -121,8 +121,8 @@ exports.LINKING_USER_LOGIN_AND_USER_DETAIL_MUTATION = (0, graphql_tag_1.gql) `
121
121
  }
122
122
  `;
123
123
  exports.CREATE_USER_DETAIL_MUTATION = (0, graphql_tag_1.gql) `
124
- mutation CreateUserDetail($userLoginId: String!, $partnerId: String!) {
125
- createUserDetail(userLoginId: $userLoginId, partnerId: $partnerId) {
124
+ mutation CreateUserDetail($userLoginId: String!, $orgId: String!) {
125
+ createUserDetail(userLoginId: $userLoginId, orgId: $orgId) {
126
126
  partyId
127
127
  orgId
128
128
  fullName
@@ -144,7 +144,25 @@ exports.CREATE_USER_DETAIL_MUTATION = (0, graphql_tag_1.gql) `
144
144
  `;
145
145
  exports.CREATE_ORG_MUTATION = (0, graphql_tag_1.gql) `
146
146
  mutation CreateOrg($orgName: String!) {
147
- createOrg(orgName: $orgName)
147
+ createOrg(orgName: $orgName) {
148
+ id
149
+ partyId
150
+ codeId
151
+ groupName
152
+ groupType
153
+ shortName
154
+ groupNameLocal
155
+ officeSiteName
156
+ comments
157
+ logoImageUrl
158
+ isIncorporated
159
+ federalTaxId
160
+ description
161
+ deleted
162
+ status
163
+ positionIndexId
164
+ prefix
165
+ }
148
166
  }
149
167
  `;
150
168
  exports.ADD_ROLE_USER_MUTATION = (0, graphql_tag_1.gql) `
@@ -1,5 +1,5 @@
1
1
  import { Service } from "../serviceSDK";
2
- import { LoginRequest, LoginResponse, RegisterRequest, SendOTPResponse, ValidateOTPResponse, CreateUserLoginResponse, GetAccessTokenByOTPResponse } from "../../types/auth";
2
+ import { LoginRequest, LoginResponse, RegisterRequest, SendOTPResponse, ValidateOTPResponse, CreateUserLoginResponse, GetAccessTokenByOTPResponse, CreateOrgResponse, CreateUserDetailResponse } from "../../types/auth";
3
3
  /**
4
4
  * Represents the authentication service.
5
5
  */
@@ -36,7 +36,15 @@ export declare class AuthService extends Service {
36
36
  getUserLoginByUserLoginId(userLoginId: string): Promise<any>;
37
37
  checkUsernameExisted(username: string): Promise<any>;
38
38
  linkingUserLoginAndUserDetail(userLoginId: string, partyId: string): Promise<any>;
39
- createUserDetail(userLoginId: string): Promise<any>;
39
+ /**
40
+ * Creates user detail for the specified user login ID.
41
+ * Uses the SDK's configured orgId automatically.
42
+ *
43
+ * @param userLoginId - The user login ID to create detail for.
44
+ * @returns A promise that resolves to the created user detail with full profile information.
45
+ * @throws Will throw an error if the GraphQL mutation fails.
46
+ */
47
+ createUserDetail(userLoginId: string): Promise<CreateUserDetailResponse>;
40
48
  sendSmsVerifyCode(username: string): Promise<any>;
41
49
  verifyCode(username: string, code: string): Promise<any>;
42
50
  resetPassword(username: string, newPassword: string, accessToken: string): Promise<any>;
@@ -54,10 +62,10 @@ export declare class AuthService extends Service {
54
62
  * Creates a new organization.
55
63
  *
56
64
  * @param orgName - The name of the organization to create.
57
- * @returns A promise that resolves to the result of the createOrg mutation.
65
+ * @returns A promise that resolves to the created organization details.
58
66
  * @throws Will throw an error if the GraphQL mutation fails.
59
67
  */
60
- createOrg(orgName: string): Promise<any>;
68
+ createOrg(orgName: string): Promise<CreateOrgResponse>;
61
69
  /**
62
70
  * Adds a role to a user in an organization.
63
71
  *
@@ -158,11 +158,19 @@ class AuthService extends serviceSDK_1.Service {
158
158
  }
159
159
  });
160
160
  }
161
+ /**
162
+ * Creates user detail for the specified user login ID.
163
+ * Uses the SDK's configured orgId automatically.
164
+ *
165
+ * @param userLoginId - The user login ID to create detail for.
166
+ * @returns A promise that resolves to the created user detail with full profile information.
167
+ * @throws Will throw an error if the GraphQL mutation fails.
168
+ */
161
169
  createUserDetail(userLoginId) {
162
170
  return __awaiter(this, void 0, void 0, function* () {
163
171
  const variables = {
164
172
  userLoginId,
165
- partnerId: this.orgId,
173
+ orgId: this.orgId,
166
174
  };
167
175
  try {
168
176
  const response = yield this.graphqlMutation(mutations_1.CREATE_USER_DETAIL_MUTATION, variables);
@@ -306,7 +314,7 @@ class AuthService extends serviceSDK_1.Service {
306
314
  * Creates a new organization.
307
315
  *
308
316
  * @param orgName - The name of the organization to create.
309
- * @returns A promise that resolves to the result of the createOrg mutation.
317
+ * @returns A promise that resolves to the created organization details.
310
318
  * @throws Will throw an error if the GraphQL mutation fails.
311
319
  */
312
320
  createOrg(orgName) {
@@ -157,3 +157,81 @@ export interface GetAccessTokenByOTPResponse {
157
157
  /** The access token string */
158
158
  accessToken: string;
159
159
  }
160
+ /**
161
+ * Response interface for creating organization
162
+ * Returns the created PartyGroup object
163
+ */
164
+ export interface CreateOrgResponse {
165
+ /** Organization ID */
166
+ id: string;
167
+ /** Party ID */
168
+ partyId: string;
169
+ /** Code ID */
170
+ codeId: string;
171
+ /** Group name */
172
+ groupName: string;
173
+ /** Group type */
174
+ groupType: string;
175
+ /** Short name */
176
+ shortName: string;
177
+ /** Group name local */
178
+ groupNameLocal: string;
179
+ /** Office site name */
180
+ officeSiteName: string;
181
+ /** Comments */
182
+ comments: string;
183
+ /** Logo image URL */
184
+ logoImageUrl: string;
185
+ /** Is incorporated */
186
+ isIncorporated: boolean;
187
+ /** Federal tax ID */
188
+ federalTaxId: string;
189
+ /** Description */
190
+ description: string;
191
+ /** Deleted flag */
192
+ deleted: boolean;
193
+ /** Status */
194
+ status: string;
195
+ /** Position index ID */
196
+ positionIndexId: string;
197
+ /** Prefix */
198
+ prefix: string;
199
+ }
200
+ /**
201
+ * Response interface for creating user detail
202
+ * Returns the created user detail with full profile information
203
+ */
204
+ export interface CreateUserDetailResponse {
205
+ /** Party ID */
206
+ partyId: string;
207
+ /** Organization ID */
208
+ orgId: string;
209
+ /** Full name */
210
+ fullName: string;
211
+ /** Email address */
212
+ email: string;
213
+ /** Phone number */
214
+ phone: string;
215
+ /** Address */
216
+ address: string;
217
+ /** Identity number */
218
+ identityNumber: string;
219
+ /** Gender */
220
+ gender: string;
221
+ /** Birth date */
222
+ birthDate: string;
223
+ /** Avatar URL */
224
+ avatarUrl: string;
225
+ /** Access token */
226
+ accessToken: string;
227
+ /** Username */
228
+ username: string;
229
+ /** Ready V2 flag */
230
+ readyV2: boolean;
231
+ /** Organization permissions map */
232
+ orgPermissionsMap: Record<string, any>;
233
+ /** Organization positions map */
234
+ orgPositionsMap: Record<string, any>;
235
+ /** Organization roles map */
236
+ orgRolesMap: Record<string, any>;
237
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longvansoftware/storefront-js-client",
3
- "version": "3.0.1",
3
+ "version": "3.0.3",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "files": [