@longvansoftware/storefront-js-client 2.9.9 → 3.0.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.
@@ -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 } from "../../types/auth";
3
3
  /**
4
4
  * Represents the authentication service.
5
5
  */
@@ -54,10 +54,10 @@ export declare class AuthService extends Service {
54
54
  * Creates a new organization.
55
55
  *
56
56
  * @param orgName - The name of the organization to create.
57
- * @returns A promise that resolves to the result of the createOrg mutation.
57
+ * @returns A promise that resolves to the created organization details.
58
58
  * @throws Will throw an error if the GraphQL mutation fails.
59
59
  */
60
- createOrg(orgName: string): Promise<any>;
60
+ createOrg(orgName: string): Promise<CreateOrgResponse>;
61
61
  /**
62
62
  * Adds a role to a user in an organization.
63
63
  *
@@ -92,7 +92,7 @@ export declare class AuthService extends Service {
92
92
  * @returns A promise that resolves to the result of the sendOTP mutation.
93
93
  * @throws Will throw an error if the GraphQL mutation fails.
94
94
  */
95
- sendOTP(phone: string, type?: 'SMS' | 'ZALO'): Promise<SendOTPResponse>;
95
+ sendOTP(phone: string, type?: "SMS" | "ZALO"): Promise<SendOTPResponse>;
96
96
  /**
97
97
  * Validates OTP code for the specified phone number.
98
98
  *
@@ -102,7 +102,7 @@ export declare class AuthService extends Service {
102
102
  * @returns A promise that resolves to the result of the validateOTP mutation.
103
103
  * @throws Will throw an error if the GraphQL mutation fails.
104
104
  */
105
- validateOTP(otpCode: string, phone: string, type?: 'SMS' | 'ZALO'): Promise<ValidateOTPResponse>;
105
+ validateOTP(otpCode: string, phone: string, type?: "SMS" | "ZALO"): Promise<ValidateOTPResponse>;
106
106
  /**
107
107
  * Gets access token by validating OTP code for the specified phone number.
108
108
  * This function validates the OTP and returns an access token if successful.
@@ -113,5 +113,5 @@ export declare class AuthService extends Service {
113
113
  * @returns A promise that resolves to an object containing the access token.
114
114
  * @throws Will throw an error if the GraphQL mutation fails.
115
115
  */
116
- getAccessTokenByOTP(otpCode: string, phone: string, type?: 'SMS' | 'ZALO'): Promise<GetAccessTokenByOTPResponse>;
116
+ getAccessTokenByOTP(otpCode: string, phone: string, type?: "SMS" | "ZALO"): Promise<GetAccessTokenByOTPResponse>;
117
117
  }
@@ -306,7 +306,7 @@ class AuthService extends serviceSDK_1.Service {
306
306
  * Creates a new organization.
307
307
  *
308
308
  * @param orgName - The name of the organization to create.
309
- * @returns A promise that resolves to the result of the createOrg mutation.
309
+ * @returns A promise that resolves to the created organization details.
310
310
  * @throws Will throw an error if the GraphQL mutation fails.
311
311
  */
312
312
  createOrg(orgName) {
@@ -408,7 +408,7 @@ class AuthService extends serviceSDK_1.Service {
408
408
  const variables = {
409
409
  orgId: this.orgId,
410
410
  phone,
411
- channelType: type || 'SMS', // Default to SMS if not specified
411
+ channelType: type || "SMS", // Default to SMS if not specified
412
412
  };
413
413
  try {
414
414
  const response = yield this.graphqlMutation(mutations_1.SEND_OTP_MUTATION, variables);
@@ -434,7 +434,7 @@ class AuthService extends serviceSDK_1.Service {
434
434
  const variables = {
435
435
  otpCode,
436
436
  phone,
437
- channelType: type || 'SMS',
437
+ channelType: type || "SMS",
438
438
  };
439
439
  try {
440
440
  const response = yield this.graphqlMutation(mutations_1.VALIDATE_OTP_MUTATION, variables);
@@ -461,11 +461,11 @@ class AuthService extends serviceSDK_1.Service {
461
461
  const variables = {
462
462
  otpCode,
463
463
  phone,
464
- channelType: type || 'SMS',
464
+ channelType: type || "SMS",
465
465
  };
466
466
  try {
467
467
  const response = yield this.graphqlQuery(queries_1.GET_ACCESS_TOKEN_BY_OTP, variables);
468
- return { accessToken: response.getAccessTokenByOTP };
468
+ return response;
469
469
  }
470
470
  catch (error) {
471
471
  console.log(`Error in getAccessTokenByOTP: ${error}`);
@@ -157,3 +157,43 @@ 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
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longvansoftware/storefront-js-client",
3
- "version": "2.9.9",
3
+ "version": "3.0.2",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "files": [