@longvansoftware/storefront-js-client 2.9.6 → 2.9.8

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.
Files changed (41) hide show
  1. package/README.md +221 -185
  2. package/dist/src/graphql/auth/mutations.d.ts +6 -0
  3. package/dist/src/graphql/auth/mutations.js +192 -140
  4. package/dist/src/graphql/auth/queries.d.ts +1 -0
  5. package/dist/src/graphql/auth/queries.js +61 -56
  6. package/dist/src/graphql/campaign/mutations.js +26 -26
  7. package/dist/src/graphql/campaign/queries.js +375 -375
  8. package/dist/src/graphql/cashbook/queries.js +93 -93
  9. package/dist/src/graphql/cloud/mutations.js +103 -103
  10. package/dist/src/graphql/cloud/queries.js +112 -112
  11. package/dist/src/graphql/computing/mutations.js +96 -96
  12. package/dist/src/graphql/computing/queries.js +41 -41
  13. package/dist/src/graphql/crm/mutations.js +813 -813
  14. package/dist/src/graphql/crm/queries.js +661 -661
  15. package/dist/src/graphql/payment/mutations.js +146 -146
  16. package/dist/src/graphql/payment/queries.js +116 -116
  17. package/dist/src/graphql/paymentV2/mutations.js +47 -47
  18. package/dist/src/graphql/paymentV2/queries.js +176 -176
  19. package/dist/src/graphql/product/mutations.js +94 -94
  20. package/dist/src/graphql/product/queries.js +472 -468
  21. package/dist/src/graphql/service/mutations.js +304 -304
  22. package/dist/src/graphql/service/queries.js +131 -131
  23. package/dist/src/graphql/store/mutations.d.ts +1 -0
  24. package/dist/src/graphql/store/mutations.js +29 -0
  25. package/dist/src/graphql/store/queries.d.ts +1 -0
  26. package/dist/src/graphql/store/queries.js +29 -0
  27. package/dist/src/graphql/user/mutations.js +142 -142
  28. package/dist/src/graphql/user/queries.js +298 -298
  29. package/dist/src/lib/SDK.d.ts +3 -0
  30. package/dist/src/lib/SDK.js +7 -0
  31. package/dist/src/lib/auth/index.d.ts +65 -1
  32. package/dist/src/lib/auth/index.js +172 -0
  33. package/dist/src/lib/serviceSDK.js +12 -12
  34. package/dist/src/lib/store/index.d.ts +30 -0
  35. package/dist/src/lib/store/index.js +173 -0
  36. package/dist/src/types/auth.d.ts +77 -0
  37. package/dist/src/types/store.d.ts +158 -0
  38. package/dist/src/types/store.js +3 -0
  39. package/package.json +44 -43
  40. package/dist/src/lib/shareZalo/index.d.ts +0 -5
  41. package/dist/src/lib/shareZalo/index.js +0 -32
@@ -1,5 +1,5 @@
1
1
  import { Service } from "../serviceSDK";
2
- import { LoginRequest, LoginResponse, RegisterRequest } from "../../types/auth";
2
+ import { LoginRequest, LoginResponse, RegisterRequest, SendOTPResponse, ValidateOTPResponse, CreateUserLoginResponse, GetAccessTokenByOTPResponse } from "../../types/auth";
3
3
  /**
4
4
  * Represents the authentication service.
5
5
  */
@@ -50,4 +50,68 @@ export declare class AuthService extends Service {
50
50
  * @throws Will throw an error if the GraphQL query fails.
51
51
  */
52
52
  loginZalo(redirectUrl: string): Promise<any>;
53
+ /**
54
+ * Creates a new organization.
55
+ *
56
+ * @param orgName - The name of the organization to create.
57
+ * @returns A promise that resolves to the result of the createOrg mutation.
58
+ * @throws Will throw an error if the GraphQL mutation fails.
59
+ */
60
+ createOrg(orgName: string): Promise<any>;
61
+ /**
62
+ * Adds a role to a user in an organization.
63
+ *
64
+ * @param role - The role to assign to the user.
65
+ * @param partyId - The party ID of the user.
66
+ * @param roleType - Optional role type.
67
+ * @returns A promise that resolves to the result of the addRoleUser mutation.
68
+ * @throws Will throw an error if the GraphQL mutation fails.
69
+ */
70
+ addRoleUser(role: string, partyId: string, roleType?: string): Promise<any>;
71
+ /**
72
+ * Creates a new user login.
73
+ *
74
+ * @param userLoginId - The user login ID to create.
75
+ * @returns A promise that resolves to the result of the createUserLogin mutation.
76
+ * @throws Will throw an error if the GraphQL mutation fails.
77
+ */
78
+ createUserLogin(userLoginId: string): Promise<CreateUserLoginResponse>;
79
+ /**
80
+ * Checks if a user login exists.
81
+ *
82
+ * @param userLoginId - The user login ID to check.
83
+ * @returns A promise that resolves to the result of the checkUserLogin query.
84
+ * @throws Will throw an error if the GraphQL query fails.
85
+ */
86
+ checkUserLogin(userLoginId: string): Promise<any>;
87
+ /**
88
+ * Sends OTP code to the specified phone number.
89
+ *
90
+ * @param phone - The phone number to send OTP to.
91
+ * @param type - The type of OTP delivery ('SMS' or 'ZALO'). Defaults to 'SMS' if not specified.
92
+ * @returns A promise that resolves to the result of the sendOTP mutation.
93
+ * @throws Will throw an error if the GraphQL mutation fails.
94
+ */
95
+ sendOTP(phone: string, type?: 'SMS' | 'ZALO'): Promise<SendOTPResponse>;
96
+ /**
97
+ * Validates OTP code for the specified phone number.
98
+ *
99
+ * @param otpCode - The OTP code to validate.
100
+ * @param phone - The phone number associated with the OTP.
101
+ * @param type - The type of OTP delivery ('SMS' or 'ZALO'). Defaults to 'SMS' if not specified.
102
+ * @returns A promise that resolves to the result of the validateOTP mutation.
103
+ * @throws Will throw an error if the GraphQL mutation fails.
104
+ */
105
+ validateOTP(otpCode: string, phone: string, type?: 'SMS' | 'ZALO'): Promise<ValidateOTPResponse>;
106
+ /**
107
+ * Gets access token by validating OTP code for the specified phone number.
108
+ * This function validates the OTP and returns an access token if successful.
109
+ *
110
+ * @param otpCode - The OTP code to validate.
111
+ * @param phone - The phone number associated with the OTP.
112
+ * @param type - The type of OTP delivery ('SMS' or 'ZALO'). Defaults to 'SMS' if not specified.
113
+ * @returns A promise that resolves to an object containing the access token.
114
+ * @throws Will throw an error if the GraphQL mutation fails.
115
+ */
116
+ getAccessTokenByOTP(otpCode: string, phone: string, type?: 'SMS' | 'ZALO'): Promise<GetAccessTokenByOTPResponse>;
53
117
  }
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.AuthService = void 0;
13
+ // lib/auth/index.ts
13
14
  const serviceSDK_1 = require("../serviceSDK");
14
15
  const mutations_1 = require("../../graphql/auth/mutations");
15
16
  const queries_1 = require("../../graphql/auth/queries");
@@ -301,5 +302,176 @@ class AuthService extends serviceSDK_1.Service {
301
302
  }
302
303
  });
303
304
  }
305
+ /**
306
+ * Creates a new organization.
307
+ *
308
+ * @param orgName - The name of the organization to create.
309
+ * @returns A promise that resolves to the result of the createOrg mutation.
310
+ * @throws Will throw an error if the GraphQL mutation fails.
311
+ */
312
+ createOrg(orgName) {
313
+ return __awaiter(this, void 0, void 0, function* () {
314
+ const variables = {
315
+ orgName,
316
+ };
317
+ try {
318
+ const response = yield this.graphqlMutation(mutations_1.CREATE_ORG_MUTATION, variables);
319
+ return response.createOrg;
320
+ }
321
+ catch (error) {
322
+ console.log(`Error in createOrg: ${error}`);
323
+ throw error;
324
+ }
325
+ });
326
+ }
327
+ /**
328
+ * Adds a role to a user in an organization.
329
+ *
330
+ * @param role - The role to assign to the user.
331
+ * @param partyId - The party ID of the user.
332
+ * @param roleType - Optional role type.
333
+ * @returns A promise that resolves to the result of the addRoleUser mutation.
334
+ * @throws Will throw an error if the GraphQL mutation fails.
335
+ */
336
+ addRoleUser(role, partyId, roleType) {
337
+ return __awaiter(this, void 0, void 0, function* () {
338
+ const variables = {
339
+ role,
340
+ roleType,
341
+ partyId,
342
+ orgId: this.orgId,
343
+ };
344
+ try {
345
+ const response = yield this.graphqlMutation(mutations_1.ADD_ROLE_USER_MUTATION, variables);
346
+ return response.addRoleUser;
347
+ }
348
+ catch (error) {
349
+ console.log(`Error in addRoleUser: ${error}`);
350
+ throw error;
351
+ }
352
+ });
353
+ }
354
+ /**
355
+ * Creates a new user login.
356
+ *
357
+ * @param userLoginId - The user login ID to create.
358
+ * @returns A promise that resolves to the result of the createUserLogin mutation.
359
+ * @throws Will throw an error if the GraphQL mutation fails.
360
+ */
361
+ createUserLogin(userLoginId) {
362
+ return __awaiter(this, void 0, void 0, function* () {
363
+ const variables = {
364
+ userLoginId,
365
+ };
366
+ try {
367
+ const response = yield this.graphqlMutation(mutations_1.CREATE_USER_LOGIN_MUTATION, variables);
368
+ return response.createUserLogin;
369
+ }
370
+ catch (error) {
371
+ console.log(`Error in createUserLogin: ${error}`);
372
+ throw error;
373
+ }
374
+ });
375
+ }
376
+ /**
377
+ * Checks if a user login exists.
378
+ *
379
+ * @param userLoginId - The user login ID to check.
380
+ * @returns A promise that resolves to the result of the checkUserLogin query.
381
+ * @throws Will throw an error if the GraphQL query fails.
382
+ */
383
+ checkUserLogin(userLoginId) {
384
+ return __awaiter(this, void 0, void 0, function* () {
385
+ const variables = {
386
+ userLoginId,
387
+ };
388
+ try {
389
+ const response = yield this.graphqlQuery(queries_1.CHECK_USER_LOGIN, variables);
390
+ return response.checkUserLogin;
391
+ }
392
+ catch (error) {
393
+ console.log(`Error in checkUserLogin: ${error}`);
394
+ throw error;
395
+ }
396
+ });
397
+ }
398
+ /**
399
+ * Sends OTP code to the specified phone number.
400
+ *
401
+ * @param phone - The phone number to send OTP to.
402
+ * @param type - The type of OTP delivery ('SMS' or 'ZALO'). Defaults to 'SMS' if not specified.
403
+ * @returns A promise that resolves to the result of the sendOTP mutation.
404
+ * @throws Will throw an error if the GraphQL mutation fails.
405
+ */
406
+ sendOTP(phone, type) {
407
+ return __awaiter(this, void 0, void 0, function* () {
408
+ const variables = {
409
+ orgId: this.orgId,
410
+ phone,
411
+ channelType: type || 'SMS', // Default to SMS if not specified
412
+ };
413
+ try {
414
+ const response = yield this.graphqlMutation(mutations_1.SEND_OTP_MUTATION, variables);
415
+ return response.sendOTP;
416
+ }
417
+ catch (error) {
418
+ console.log(`Error in sendOTP: ${error}`);
419
+ throw error;
420
+ }
421
+ });
422
+ }
423
+ /**
424
+ * Validates OTP code for the specified phone number.
425
+ *
426
+ * @param otpCode - The OTP code to validate.
427
+ * @param phone - The phone number associated with the OTP.
428
+ * @param type - The type of OTP delivery ('SMS' or 'ZALO'). Defaults to 'SMS' if not specified.
429
+ * @returns A promise that resolves to the result of the validateOTP mutation.
430
+ * @throws Will throw an error if the GraphQL mutation fails.
431
+ */
432
+ validateOTP(otpCode, phone, type) {
433
+ return __awaiter(this, void 0, void 0, function* () {
434
+ const variables = {
435
+ otpCode,
436
+ phone,
437
+ channelType: type || 'SMS',
438
+ };
439
+ try {
440
+ const response = yield this.graphqlMutation(mutations_1.VALIDATE_OTP_MUTATION, variables);
441
+ return { result: response.validateOTP };
442
+ }
443
+ catch (error) {
444
+ console.log(`Error in validateOTP: ${error}`);
445
+ throw error;
446
+ }
447
+ });
448
+ }
449
+ /**
450
+ * Gets access token by validating OTP code for the specified phone number.
451
+ * This function validates the OTP and returns an access token if successful.
452
+ *
453
+ * @param otpCode - The OTP code to validate.
454
+ * @param phone - The phone number associated with the OTP.
455
+ * @param type - The type of OTP delivery ('SMS' or 'ZALO'). Defaults to 'SMS' if not specified.
456
+ * @returns A promise that resolves to an object containing the access token.
457
+ * @throws Will throw an error if the GraphQL mutation fails.
458
+ */
459
+ getAccessTokenByOTP(otpCode, phone, type) {
460
+ return __awaiter(this, void 0, void 0, function* () {
461
+ const variables = {
462
+ otpCode,
463
+ phone,
464
+ channelType: type || 'SMS',
465
+ };
466
+ try {
467
+ const response = yield this.graphqlMutation(mutations_1.GET_ACCESS_TOKEN_BY_OTP_MUTATION, variables);
468
+ return { accessToken: response.getAccessTokenByOTP };
469
+ }
470
+ catch (error) {
471
+ console.log(`Error in getAccessTokenByOTP: ${error}`);
472
+ throw error;
473
+ }
474
+ });
475
+ }
304
476
  }
305
477
  exports.AuthService = AuthService;
@@ -57,8 +57,8 @@ class Service {
57
57
  return __awaiter(this, void 0, void 0, function* () {
58
58
  try {
59
59
  const { data, errors } = yield this.client.query({
60
- query: (0, client_1.gql) `
61
- ${query}
60
+ query: (0, client_1.gql) `
61
+ ${query}
62
62
  `,
63
63
  variables,
64
64
  context: {
@@ -84,8 +84,8 @@ class Service {
84
84
  return __awaiter(this, void 0, void 0, function* () {
85
85
  try {
86
86
  const { data, errors } = yield this.client.mutate({
87
- mutation: (0, client_1.gql) `
88
- ${mutation}
87
+ mutation: (0, client_1.gql) `
88
+ ${mutation}
89
89
  `,
90
90
  variables,
91
91
  context: {
@@ -169,8 +169,8 @@ class Service {
169
169
  return __awaiter(this, void 0, void 0, function* () {
170
170
  try {
171
171
  const { data, errors } = yield this.client.query({
172
- query: (0, client_1.gql) `
173
- ${query}
172
+ query: (0, client_1.gql) `
173
+ ${query}
174
174
  `,
175
175
  variables,
176
176
  context: {
@@ -197,8 +197,8 @@ class Service {
197
197
  return __awaiter(this, void 0, void 0, function* () {
198
198
  try {
199
199
  const { data, errors } = yield this.client.mutate({
200
- mutation: (0, client_1.gql) `
201
- ${mutation}
200
+ mutation: (0, client_1.gql) `
201
+ ${mutation}
202
202
  `,
203
203
  variables,
204
204
  context: {
@@ -224,8 +224,8 @@ class Service {
224
224
  return __awaiter(this, void 0, void 0, function* () {
225
225
  try {
226
226
  const { data, errors } = yield this.client.query({
227
- query: (0, client_1.gql) `
228
- ${query}
227
+ query: (0, client_1.gql) `
228
+ ${query}
229
229
  `,
230
230
  variables,
231
231
  context: {
@@ -252,8 +252,8 @@ class Service {
252
252
  return __awaiter(this, void 0, void 0, function* () {
253
253
  try {
254
254
  const { data, errors } = yield this.client.mutate({
255
- mutation: (0, client_1.gql) `
256
- ${mutation}
255
+ mutation: (0, client_1.gql) `
256
+ ${mutation}
257
257
  `,
258
258
  variables,
259
259
  context: {
@@ -0,0 +1,30 @@
1
+ import { Service } from "../serviceSDK";
2
+ import type { StoreDTO } from "../../types/store";
3
+ /**
4
+ * Service class for managing store-related operations.
5
+ */
6
+ export declare class StoreService extends Service {
7
+ /**
8
+ * Constructs a new StoreService instance.
9
+ * @param endpoint - The endpoint URL for the service.
10
+ * @param orgId - The organization ID.
11
+ * @param storeId - The store ID.
12
+ */
13
+ constructor(endpoint: string, orgId: string, storeId: string);
14
+ /**
15
+ * Creates a new store.
16
+ * @param partnerId - The partner ID.
17
+ * @param storeName - The name of the store to create.
18
+ * @returns A promise that resolves to the created store data.
19
+ * @throws Will throw an error if the GraphQL mutation fails.
20
+ */
21
+ createStore(partnerId: string, storeName: string): Promise<StoreDTO>;
22
+ /**
23
+ * Gets store channels by employee ID.
24
+ * If user has high permissions, will return all channels.
25
+ * @param saleId - The employee/sale ID.
26
+ * @returns A promise that resolves to an array of store data.
27
+ * @throws Will throw an error if the GraphQL query fails.
28
+ */
29
+ getStoreChannelByEmpId(saleId: string): Promise<StoreDTO[]>;
30
+ }
@@ -0,0 +1,173 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.StoreService = void 0;
13
+ // src/lib/store/index.ts
14
+ const serviceSDK_1 = require("../serviceSDK");
15
+ /**
16
+ * Service class for managing store-related operations.
17
+ */
18
+ class StoreService extends serviceSDK_1.Service {
19
+ /**
20
+ * Constructs a new StoreService instance.
21
+ * @param endpoint - The endpoint URL for the service.
22
+ * @param orgId - The organization ID.
23
+ * @param storeId - The store ID.
24
+ */
25
+ constructor(endpoint, orgId, storeId) {
26
+ super(endpoint, orgId, storeId);
27
+ }
28
+ /**
29
+ * Creates a new store.
30
+ * @param partnerId - The partner ID.
31
+ * @param storeName - The name of the store to create.
32
+ * @returns A promise that resolves to the created store data.
33
+ * @throws Will throw an error if the GraphQL mutation fails.
34
+ */
35
+ createStore(partnerId, storeName) {
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ // Mock data for now
38
+ const mockStoreData = {
39
+ id: `store-${Date.now()}`,
40
+ createdStamp: new Date().toISOString(),
41
+ name: storeName,
42
+ type: "pos",
43
+ enable: true,
44
+ partyId: partnerId,
45
+ warehouses: [
46
+ "1699410559510051",
47
+ "1701063268074130",
48
+ "1710863353245977"
49
+ ],
50
+ warehouseIdDefault: "1701063268074130",
51
+ enableOrderAbleFuture: false,
52
+ enableOrderNegativeQuantity: false,
53
+ storeEcommerceName: null,
54
+ shippingCompanies: [
55
+ "1680338339238",
56
+ "20.10008",
57
+ "20.10009",
58
+ "20.10010"
59
+ ],
60
+ shippingCompanyIdPrimary: "1680338339238",
61
+ customerIdPrimary: "20.52415",
62
+ paymentMethodIdPrimary: "231123143230155ypCQ7vC4",
63
+ enableCustomProductPrice: true,
64
+ enablePaymentPartial: true,
65
+ paymentPartialPercent: [10],
66
+ productStoreLink: null,
67
+ __typename: "ProductStore"
68
+ };
69
+ try {
70
+ // TODO: Replace with actual GraphQL mutation when ready
71
+ // const variables = { partnerId, storeName };
72
+ // const response = await this.graphqlMutation(CREATE_STORE_MUTATION, variables);
73
+ // return response.createStore;
74
+ // Return mock data for now
75
+ console.log(`Creating store: ${storeName} for partner: ${partnerId}`);
76
+ return mockStoreData;
77
+ }
78
+ catch (error) {
79
+ console.log(`Error in createStore: ${error}`);
80
+ throw error;
81
+ }
82
+ });
83
+ }
84
+ /**
85
+ * Gets store channels by employee ID.
86
+ * If user has high permissions, will return all channels.
87
+ * @param saleId - The employee/sale ID.
88
+ * @returns A promise that resolves to an array of store data.
89
+ * @throws Will throw an error if the GraphQL query fails.
90
+ */
91
+ getStoreChannelByEmpId(saleId) {
92
+ return __awaiter(this, void 0, void 0, function* () {
93
+ // Mock data for now
94
+ const mockStoreChannels = [
95
+ {
96
+ id: "pos-nowzone",
97
+ createdStamp: null,
98
+ name: "NowZone",
99
+ type: "pos",
100
+ enable: true,
101
+ partyId: "FOX",
102
+ warehouses: [
103
+ "1699410559510051",
104
+ "1701063268074130",
105
+ "1710863353245977",
106
+ "1708420902576454",
107
+ "1708414435504879"
108
+ ],
109
+ warehouseIdDefault: "1701063268074130",
110
+ enableOrderAbleFuture: false,
111
+ enableOrderNegativeQuantity: false,
112
+ storeEcommerceName: null,
113
+ shippingCompanies: [
114
+ "1680338339238",
115
+ "20.10008",
116
+ "20.10009",
117
+ "20.10010"
118
+ ],
119
+ shippingCompanyIdPrimary: "1680338339238",
120
+ customerIdPrimary: "20.52415",
121
+ paymentMethodIdPrimary: "231123143230155ypCQ7vC4",
122
+ enableCustomProductPrice: true,
123
+ enablePaymentPartial: true,
124
+ paymentPartialPercent: [10],
125
+ productStoreLink: null,
126
+ __typename: "ProductStore"
127
+ },
128
+ {
129
+ id: "ecommerce-main",
130
+ createdStamp: "2024-01-15T10:30:00Z",
131
+ name: "Main E-commerce Store",
132
+ type: "ecommerce",
133
+ enable: true,
134
+ partyId: "FOX",
135
+ warehouses: [
136
+ "1699410559510051",
137
+ "1701063268074130"
138
+ ],
139
+ warehouseIdDefault: "1699410559510051",
140
+ enableOrderAbleFuture: true,
141
+ enableOrderNegativeQuantity: false,
142
+ storeEcommerceName: "fox-ecommerce",
143
+ shippingCompanies: [
144
+ "1680338339238",
145
+ "20.10008"
146
+ ],
147
+ shippingCompanyIdPrimary: "1680338339238",
148
+ customerIdPrimary: "20.52415",
149
+ paymentMethodIdPrimary: "231123143230155ypCQ7vC4",
150
+ enableCustomProductPrice: false,
151
+ enablePaymentPartial: true,
152
+ paymentPartialPercent: [20, 50],
153
+ productStoreLink: "https://fox-store.com",
154
+ __typename: "ProductStore"
155
+ }
156
+ ];
157
+ try {
158
+ // TODO: Replace with actual GraphQL query when ready
159
+ // const variables = { saleId };
160
+ // const response = await this.graphqlQuery(GET_STORE_CHANNEL_BY_EMP_ID_QUERY, variables);
161
+ // return response.getStoreChannelByEmpId;
162
+ // Return mock data for now
163
+ console.log(`Getting store channels for employee: ${saleId}`);
164
+ return mockStoreChannels;
165
+ }
166
+ catch (error) {
167
+ console.log(`Error in getStoreChannelByEmpId: ${error}`);
168
+ throw error;
169
+ }
170
+ });
171
+ }
172
+ }
173
+ exports.StoreService = StoreService;
@@ -80,3 +80,80 @@ export interface UpdateInfoResponse {
80
80
  birthDate: string;
81
81
  avatarUrl: string;
82
82
  }
83
+ /**
84
+ * Request interface for sending OTP
85
+ */
86
+ export interface SendOTPRequest {
87
+ /** Organization ID */
88
+ orgId: string;
89
+ /** Phone number to send OTP to */
90
+ phone: string;
91
+ /** Type of OTP delivery - SMS or ZALO (defaults to SMS) */
92
+ type?: 'SMS' | 'ZALO';
93
+ }
94
+ /**
95
+ * Response interface for sending OTP
96
+ */
97
+ export interface SendOTPResponse {
98
+ /** SMS ID */
99
+ id?: string;
100
+ /** OTP code (for development) */
101
+ code?: string;
102
+ /** Username/phone number */
103
+ username?: string;
104
+ /** Expiration timestamp */
105
+ timeExpired?: number;
106
+ }
107
+ /**
108
+ * Request interface for validating OTP
109
+ */
110
+ export interface ValidateOTPRequest {
111
+ /** OTP code to validate */
112
+ otpCode: string;
113
+ /** Phone number associated with the OTP */
114
+ phone: string;
115
+ }
116
+ /**
117
+ * Response interface for validating OTP
118
+ * validateOTP returns a simple string result
119
+ */
120
+ export interface ValidateOTPResponse {
121
+ /** Result message from validateOTP */
122
+ result: string;
123
+ }
124
+ /**
125
+ * Response interface for creating user login
126
+ */
127
+ export interface CreateUserLoginResponse {
128
+ /** User login ID */
129
+ id: string;
130
+ /** Party ID associated with the user login */
131
+ partyId: string;
132
+ /** Type of user login */
133
+ type: string;
134
+ /** Username */
135
+ username: string;
136
+ /** Status of the user login */
137
+ status: string;
138
+ /** Access token for the user */
139
+ accessToken: string;
140
+ }
141
+ /**
142
+ * Request interface for getting access token by OTP
143
+ */
144
+ export interface GetAccessTokenByOTPRequest {
145
+ /** OTP code to validate */
146
+ otpCode: string;
147
+ /** Phone number associated with the OTP */
148
+ phone: string;
149
+ /** Type of OTP delivery - SMS or ZALO (defaults to SMS) */
150
+ type?: 'SMS' | 'ZALO';
151
+ }
152
+ /**
153
+ * Response interface for getting access token by OTP
154
+ * Returns just the access token as a string
155
+ */
156
+ export interface GetAccessTokenByOTPResponse {
157
+ /** The access token string */
158
+ accessToken: string;
159
+ }