@loyal-ix/loyalix-shared-types 1.0.0 → 1.2.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/index.d.mts CHANGED
@@ -65,6 +65,15 @@ declare enum BusinessStatus {
65
65
  SUSPENDED = "suspended"
66
66
  }
67
67
 
68
+ /**
69
+ * OAuth Provider Enum
70
+ * Supported third-party authentication providers
71
+ */
72
+ declare enum OAuthProvider {
73
+ GOOGLE = "google",
74
+ FACEBOOK = "facebook"
75
+ }
76
+
68
77
  interface SuccessResponse<T> {
69
78
  success: true;
70
79
  data: T;
@@ -153,6 +162,84 @@ interface LoginResponseDto {
153
162
  user: LoggedInUserDto;
154
163
  }
155
164
 
165
+ interface VerifyEmailDto {
166
+ token: string;
167
+ }
168
+ interface ResendVerificationDto {
169
+ email: string;
170
+ }
171
+ interface VerificationResponseDto {
172
+ success: boolean;
173
+ message: string;
174
+ }
175
+
176
+ interface ForgotPasswordDto {
177
+ email: string;
178
+ }
179
+ interface ResetPasswordDto {
180
+ token: string;
181
+ newPassword: string;
182
+ }
183
+
184
+ /**
185
+ * OAuth Authentication DTOs
186
+ * Used for third-party authentication (Google, Facebook)
187
+ */
188
+ /**
189
+ * OAuth user data received from provider after authentication
190
+ */
191
+ interface OAuthUserDto {
192
+ /** Email from OAuth provider */
193
+ email: string;
194
+ /** First name from OAuth profile */
195
+ firstName?: string;
196
+ /** Last name from OAuth profile */
197
+ lastName?: string;
198
+ /** OAuth provider name (google, facebook) */
199
+ provider: string;
200
+ /** Unique user ID from the OAuth provider */
201
+ providerId: string;
202
+ /** OAuth access token (optional, for API calls) */
203
+ accessToken?: string;
204
+ /** OAuth refresh token (optional, for token refresh) */
205
+ refreshToken?: string;
206
+ /** Profile photo URL from OAuth provider */
207
+ profilePhoto?: string;
208
+ /** Account type for new registrations */
209
+ accountType?: 'customer' | 'business';
210
+ }
211
+ /**
212
+ * DTO for initiating OAuth flow
213
+ */
214
+ interface OAuthInitiateDto {
215
+ /** Account type - required for new user registration */
216
+ accountType: 'customer' | 'business';
217
+ }
218
+ /**
219
+ * OAuth error response when authentication fails
220
+ */
221
+ interface OAuthErrorResponseDto {
222
+ /** Error code for programmatic handling */
223
+ code: string;
224
+ /** Human-readable error message */
225
+ message: string;
226
+ /** Existing auth method if email conflict (e.g., 'email', 'google', 'facebook') */
227
+ existingAuthMethod?: string;
228
+ }
229
+ /**
230
+ * OAuth callback query parameters
231
+ */
232
+ interface OAuthCallbackQueryDto {
233
+ /** OAuth authorization code */
234
+ code?: string;
235
+ /** State parameter (contains accountType) */
236
+ state?: string;
237
+ /** Error from OAuth provider */
238
+ error?: string;
239
+ /** Error description from OAuth provider */
240
+ error_description?: string;
241
+ }
242
+
156
243
  interface CreateUserDto {
157
244
  email: string;
158
245
  password: string;
@@ -174,7 +261,6 @@ interface UpdateUserDto {
174
261
  interface UserDto {
175
262
  id: string;
176
263
  email: string;
177
- username?: string;
178
264
  firstName?: string;
179
265
  lastName?: string;
180
266
  phoneNumber?: string;
@@ -182,6 +268,15 @@ interface UserDto {
182
268
  createdAt: string;
183
269
  updatedAt: string;
184
270
  }
271
+ /**
272
+ * User response DTO with roles and profile photo
273
+ * Used for API responses - excludes sensitive fields (password, deviceToken)
274
+ */
275
+ interface UserResponseDto extends UserDto {
276
+ roles: string[];
277
+ profilePhotoUrl?: string;
278
+ lastActive?: string;
279
+ }
185
280
 
186
281
  interface CreateBusinessDto {
187
282
  name: string;
@@ -213,6 +308,32 @@ interface BusinessDto {
213
308
  createdAt: string;
214
309
  updatedAt: string;
215
310
  }
311
+ /**
312
+ * Minimal business DTO for list endpoints (public-facing)
313
+ * Excludes sensitive fields: qrSecret, staffMembers details
314
+ */
315
+ interface BusinessListItemDto {
316
+ id: string;
317
+ name: string;
318
+ description?: string;
319
+ address?: string;
320
+ status: string;
321
+ industryType?: string;
322
+ activeProgramCount?: number;
323
+ totalCustomers?: number;
324
+ }
325
+ /**
326
+ * Detailed business DTO for admin views
327
+ * Excludes: qrSecret (never exposed)
328
+ */
329
+ interface BusinessDetailDto extends BusinessListItemDto {
330
+ email?: string;
331
+ phone?: string;
332
+ staffCount?: number;
333
+ programCount?: number;
334
+ createdAt: string;
335
+ updatedAt: string;
336
+ }
216
337
 
217
338
  interface CreateCustomerDto {
218
339
  userId: string;
@@ -234,6 +355,31 @@ interface CustomerDto {
234
355
  createdAt: string;
235
356
  updatedAt: string;
236
357
  }
358
+ /**
359
+ * Customer response DTO with nested user info
360
+ * Excludes sensitive user fields: password, deviceToken
361
+ */
362
+ interface CustomerResponseDto {
363
+ id: string;
364
+ status: string;
365
+ user: {
366
+ id: string;
367
+ email: string;
368
+ firstName?: string;
369
+ lastName?: string;
370
+ phoneNumber?: string;
371
+ profilePhotoUrl?: string;
372
+ };
373
+ enrollmentCount?: number;
374
+ createdAt: string;
375
+ updatedAt: string;
376
+ }
377
+ /**
378
+ * Customer response for admin views - includes notes
379
+ */
380
+ interface CustomerAdminResponseDto extends CustomerResponseDto {
381
+ notes?: string;
382
+ }
237
383
 
238
384
  interface CreateLoyaltyProgramDto {
239
385
  businessId: string;
@@ -253,4 +399,4 @@ interface LoyaltyProgramDto {
253
399
  updatedAt: string;
254
400
  }
255
401
 
256
- export { type ApiResponse, type BusinessDto, BusinessStatus, type CreateBusinessDto, type CreateCustomerDto, type CreateLoyaltyProgramDto, type CreateUserDto, type CustomerDto, type ErrorDetail, type ErrorResponse, type LoggedInUserDto, type LoginDto, type LoginResponseDto, type LoyaltyProgramDto, type PaginatedResult, type PaginationMeta, type PaginationQuery, Permission, type RefreshTokenDto, type RegisterDto, Role, type SuccessResponse, type UpdateBusinessDto, type UpdateCustomerDto, type UpdateLoyaltyProgramDto, type UpdateUserDto, type UserDto };
402
+ export { type ApiResponse, type BusinessDetailDto, type BusinessDto, type BusinessListItemDto, BusinessStatus, type CreateBusinessDto, type CreateCustomerDto, type CreateLoyaltyProgramDto, type CreateUserDto, type CustomerAdminResponseDto, type CustomerDto, type CustomerResponseDto, type ErrorDetail, type ErrorResponse, type ForgotPasswordDto, type LoggedInUserDto, type LoginDto, type LoginResponseDto, type LoyaltyProgramDto, type OAuthCallbackQueryDto, type OAuthErrorResponseDto, type OAuthInitiateDto, OAuthProvider, type OAuthUserDto, type PaginatedResult, type PaginationMeta, type PaginationQuery, Permission, type RefreshTokenDto, type RegisterDto, type ResendVerificationDto, type ResetPasswordDto, Role, type SuccessResponse, type UpdateBusinessDto, type UpdateCustomerDto, type UpdateLoyaltyProgramDto, type UpdateUserDto, type UserDto, type UserResponseDto, type VerificationResponseDto, type VerifyEmailDto };
package/dist/index.d.ts CHANGED
@@ -65,6 +65,15 @@ declare enum BusinessStatus {
65
65
  SUSPENDED = "suspended"
66
66
  }
67
67
 
68
+ /**
69
+ * OAuth Provider Enum
70
+ * Supported third-party authentication providers
71
+ */
72
+ declare enum OAuthProvider {
73
+ GOOGLE = "google",
74
+ FACEBOOK = "facebook"
75
+ }
76
+
68
77
  interface SuccessResponse<T> {
69
78
  success: true;
70
79
  data: T;
@@ -153,6 +162,84 @@ interface LoginResponseDto {
153
162
  user: LoggedInUserDto;
154
163
  }
155
164
 
165
+ interface VerifyEmailDto {
166
+ token: string;
167
+ }
168
+ interface ResendVerificationDto {
169
+ email: string;
170
+ }
171
+ interface VerificationResponseDto {
172
+ success: boolean;
173
+ message: string;
174
+ }
175
+
176
+ interface ForgotPasswordDto {
177
+ email: string;
178
+ }
179
+ interface ResetPasswordDto {
180
+ token: string;
181
+ newPassword: string;
182
+ }
183
+
184
+ /**
185
+ * OAuth Authentication DTOs
186
+ * Used for third-party authentication (Google, Facebook)
187
+ */
188
+ /**
189
+ * OAuth user data received from provider after authentication
190
+ */
191
+ interface OAuthUserDto {
192
+ /** Email from OAuth provider */
193
+ email: string;
194
+ /** First name from OAuth profile */
195
+ firstName?: string;
196
+ /** Last name from OAuth profile */
197
+ lastName?: string;
198
+ /** OAuth provider name (google, facebook) */
199
+ provider: string;
200
+ /** Unique user ID from the OAuth provider */
201
+ providerId: string;
202
+ /** OAuth access token (optional, for API calls) */
203
+ accessToken?: string;
204
+ /** OAuth refresh token (optional, for token refresh) */
205
+ refreshToken?: string;
206
+ /** Profile photo URL from OAuth provider */
207
+ profilePhoto?: string;
208
+ /** Account type for new registrations */
209
+ accountType?: 'customer' | 'business';
210
+ }
211
+ /**
212
+ * DTO for initiating OAuth flow
213
+ */
214
+ interface OAuthInitiateDto {
215
+ /** Account type - required for new user registration */
216
+ accountType: 'customer' | 'business';
217
+ }
218
+ /**
219
+ * OAuth error response when authentication fails
220
+ */
221
+ interface OAuthErrorResponseDto {
222
+ /** Error code for programmatic handling */
223
+ code: string;
224
+ /** Human-readable error message */
225
+ message: string;
226
+ /** Existing auth method if email conflict (e.g., 'email', 'google', 'facebook') */
227
+ existingAuthMethod?: string;
228
+ }
229
+ /**
230
+ * OAuth callback query parameters
231
+ */
232
+ interface OAuthCallbackQueryDto {
233
+ /** OAuth authorization code */
234
+ code?: string;
235
+ /** State parameter (contains accountType) */
236
+ state?: string;
237
+ /** Error from OAuth provider */
238
+ error?: string;
239
+ /** Error description from OAuth provider */
240
+ error_description?: string;
241
+ }
242
+
156
243
  interface CreateUserDto {
157
244
  email: string;
158
245
  password: string;
@@ -174,7 +261,6 @@ interface UpdateUserDto {
174
261
  interface UserDto {
175
262
  id: string;
176
263
  email: string;
177
- username?: string;
178
264
  firstName?: string;
179
265
  lastName?: string;
180
266
  phoneNumber?: string;
@@ -182,6 +268,15 @@ interface UserDto {
182
268
  createdAt: string;
183
269
  updatedAt: string;
184
270
  }
271
+ /**
272
+ * User response DTO with roles and profile photo
273
+ * Used for API responses - excludes sensitive fields (password, deviceToken)
274
+ */
275
+ interface UserResponseDto extends UserDto {
276
+ roles: string[];
277
+ profilePhotoUrl?: string;
278
+ lastActive?: string;
279
+ }
185
280
 
186
281
  interface CreateBusinessDto {
187
282
  name: string;
@@ -213,6 +308,32 @@ interface BusinessDto {
213
308
  createdAt: string;
214
309
  updatedAt: string;
215
310
  }
311
+ /**
312
+ * Minimal business DTO for list endpoints (public-facing)
313
+ * Excludes sensitive fields: qrSecret, staffMembers details
314
+ */
315
+ interface BusinessListItemDto {
316
+ id: string;
317
+ name: string;
318
+ description?: string;
319
+ address?: string;
320
+ status: string;
321
+ industryType?: string;
322
+ activeProgramCount?: number;
323
+ totalCustomers?: number;
324
+ }
325
+ /**
326
+ * Detailed business DTO for admin views
327
+ * Excludes: qrSecret (never exposed)
328
+ */
329
+ interface BusinessDetailDto extends BusinessListItemDto {
330
+ email?: string;
331
+ phone?: string;
332
+ staffCount?: number;
333
+ programCount?: number;
334
+ createdAt: string;
335
+ updatedAt: string;
336
+ }
216
337
 
217
338
  interface CreateCustomerDto {
218
339
  userId: string;
@@ -234,6 +355,31 @@ interface CustomerDto {
234
355
  createdAt: string;
235
356
  updatedAt: string;
236
357
  }
358
+ /**
359
+ * Customer response DTO with nested user info
360
+ * Excludes sensitive user fields: password, deviceToken
361
+ */
362
+ interface CustomerResponseDto {
363
+ id: string;
364
+ status: string;
365
+ user: {
366
+ id: string;
367
+ email: string;
368
+ firstName?: string;
369
+ lastName?: string;
370
+ phoneNumber?: string;
371
+ profilePhotoUrl?: string;
372
+ };
373
+ enrollmentCount?: number;
374
+ createdAt: string;
375
+ updatedAt: string;
376
+ }
377
+ /**
378
+ * Customer response for admin views - includes notes
379
+ */
380
+ interface CustomerAdminResponseDto extends CustomerResponseDto {
381
+ notes?: string;
382
+ }
237
383
 
238
384
  interface CreateLoyaltyProgramDto {
239
385
  businessId: string;
@@ -253,4 +399,4 @@ interface LoyaltyProgramDto {
253
399
  updatedAt: string;
254
400
  }
255
401
 
256
- export { type ApiResponse, type BusinessDto, BusinessStatus, type CreateBusinessDto, type CreateCustomerDto, type CreateLoyaltyProgramDto, type CreateUserDto, type CustomerDto, type ErrorDetail, type ErrorResponse, type LoggedInUserDto, type LoginDto, type LoginResponseDto, type LoyaltyProgramDto, type PaginatedResult, type PaginationMeta, type PaginationQuery, Permission, type RefreshTokenDto, type RegisterDto, Role, type SuccessResponse, type UpdateBusinessDto, type UpdateCustomerDto, type UpdateLoyaltyProgramDto, type UpdateUserDto, type UserDto };
402
+ export { type ApiResponse, type BusinessDetailDto, type BusinessDto, type BusinessListItemDto, BusinessStatus, type CreateBusinessDto, type CreateCustomerDto, type CreateLoyaltyProgramDto, type CreateUserDto, type CustomerAdminResponseDto, type CustomerDto, type CustomerResponseDto, type ErrorDetail, type ErrorResponse, type ForgotPasswordDto, type LoggedInUserDto, type LoginDto, type LoginResponseDto, type LoyaltyProgramDto, type OAuthCallbackQueryDto, type OAuthErrorResponseDto, type OAuthInitiateDto, OAuthProvider, type OAuthUserDto, type PaginatedResult, type PaginationMeta, type PaginationQuery, Permission, type RefreshTokenDto, type RegisterDto, type ResendVerificationDto, type ResetPasswordDto, Role, type SuccessResponse, type UpdateBusinessDto, type UpdateCustomerDto, type UpdateLoyaltyProgramDto, type UpdateUserDto, type UserDto, type UserResponseDto, type VerificationResponseDto, type VerifyEmailDto };
package/dist/index.js CHANGED
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
23
  BusinessStatus: () => BusinessStatus,
24
+ OAuthProvider: () => OAuthProvider,
24
25
  Permission: () => Permission,
25
26
  Role: () => Role
26
27
  });
@@ -98,9 +99,17 @@ var BusinessStatus = /* @__PURE__ */ ((BusinessStatus2) => {
98
99
  BusinessStatus2["SUSPENDED"] = "suspended";
99
100
  return BusinessStatus2;
100
101
  })(BusinessStatus || {});
102
+
103
+ // src/enums/oauth-provider.enum.ts
104
+ var OAuthProvider = /* @__PURE__ */ ((OAuthProvider2) => {
105
+ OAuthProvider2["GOOGLE"] = "google";
106
+ OAuthProvider2["FACEBOOK"] = "facebook";
107
+ return OAuthProvider2;
108
+ })(OAuthProvider || {});
101
109
  // Annotate the CommonJS export names for ESM import in node:
102
110
  0 && (module.exports = {
103
111
  BusinessStatus,
112
+ OAuthProvider,
104
113
  Permission,
105
114
  Role
106
115
  });
package/dist/index.mjs CHANGED
@@ -70,8 +70,16 @@ var BusinessStatus = /* @__PURE__ */ ((BusinessStatus2) => {
70
70
  BusinessStatus2["SUSPENDED"] = "suspended";
71
71
  return BusinessStatus2;
72
72
  })(BusinessStatus || {});
73
+
74
+ // src/enums/oauth-provider.enum.ts
75
+ var OAuthProvider = /* @__PURE__ */ ((OAuthProvider2) => {
76
+ OAuthProvider2["GOOGLE"] = "google";
77
+ OAuthProvider2["FACEBOOK"] = "facebook";
78
+ return OAuthProvider2;
79
+ })(OAuthProvider || {});
73
80
  export {
74
81
  BusinessStatus,
82
+ OAuthProvider,
75
83
  Permission,
76
84
  Role
77
85
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loyal-ix/loyalix-shared-types",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "description": "Shared TypeScript types for Loyalix frontend and backend",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -12,6 +12,12 @@
12
12
  "require": "./dist/index.js"
13
13
  }
14
14
  },
15
+ "scripts": {
16
+ "build": "tsup src/index.ts --format cjs,esm --dts",
17
+ "dev": "tsup src/index.ts --format cjs,esm --dts --watch",
18
+ "clean": "rm -rf dist",
19
+ "prepublishOnly": "pnpm run build"
20
+ },
15
21
  "devDependencies": {
16
22
  "tsup": "^8.0.0",
17
23
  "typescript": "^5.0.0"
@@ -29,14 +35,9 @@
29
35
  "license": "MIT",
30
36
  "repository": {
31
37
  "type": "git",
32
- "url": "https://github.com/loyalix/shared-types.git"
38
+ "url": "https://github.com/zeufack/loyalix-shared-type"
33
39
  },
34
40
  "publishConfig": {
35
41
  "access": "public"
36
- },
37
- "scripts": {
38
- "build": "tsup src/index.ts --format cjs,esm --dts",
39
- "dev": "tsup src/index.ts --format cjs,esm --dts --watch",
40
- "clean": "rm -rf dist"
41
42
  }
42
- }
43
+ }