vr-commons 1.0.127 → 1.0.129

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.
@@ -91,6 +91,7 @@ export declare const JACKET_ID_REGEX: RegExp;
91
91
  export declare const JACKET_ID_PREFIX = "JKT";
92
92
  /**
93
93
  * Format user profile based on viewer type and options
94
+ * FIXED: Removed email and nationalId references
94
95
  */
95
96
  export declare const formatUserProfile: (user: User, viewerType?: UserType, options?: ProfileFormatOptions) => RiderProfile | PassengerProfile | AgentProfile | AdminProfile | SuperAdminProfile;
96
97
  /**
@@ -18,13 +18,17 @@ exports.JACKET_ID_PREFIX = "JKT";
18
18
  // ============================================================================
19
19
  /**
20
20
  * Format user profile based on viewer type and options
21
+ * FIXED: Removed email and nationalId references
21
22
  */
22
23
  const formatUserProfile = (user, viewerType = "ADMIN", options = {}) => {
24
+ // Get primary contact
25
+ const primaryContact = user.primaryContact ||
26
+ user.contacts?.find((c) => c.isPrimary === true);
23
27
  const baseProfile = {
24
28
  id: user.id,
25
29
  firstName: user.firstName,
26
30
  lastName: user.lastName,
27
- primaryContact: user.primaryContact?.contactValue,
31
+ primaryContact: primaryContact?.contactValue,
28
32
  gender: user.gender || "male",
29
33
  birthDate: user.birthDate || null,
30
34
  birthMonth: user.birthMonth || null,
@@ -280,21 +280,21 @@ export declare const loginSchema: z.ZodObject<{
280
280
  contactValue: z.ZodEffects<z.ZodString, string, string>;
281
281
  password: z.ZodString;
282
282
  }, "strip", z.ZodTypeAny, {
283
- contactValue: string;
284
283
  password: string;
285
- }, {
286
284
  contactValue: string;
285
+ }, {
287
286
  password: string;
287
+ contactValue: string;
288
288
  }>;
289
289
  }, "strip", z.ZodTypeAny, {
290
290
  body: {
291
- contactValue: string;
292
291
  password: string;
292
+ contactValue: string;
293
293
  };
294
294
  }, {
295
295
  body: {
296
- contactValue: string;
297
296
  password: string;
297
+ contactValue: string;
298
298
  };
299
299
  }>;
300
300
  export declare const forgotPasswordSchema: z.ZodObject<{
@@ -7,28 +7,28 @@ export declare const createPlanSchema: z.ZodObject<{
7
7
  productId: z.ZodString;
8
8
  }, "strip", z.ZodTypeAny, {
9
9
  userId: string;
10
+ productId: string;
10
11
  deviceIds: string[];
11
12
  pricingId: string;
12
- productId: string;
13
13
  }, {
14
14
  userId: string;
15
+ productId: string;
15
16
  deviceIds: string[];
16
17
  pricingId: string;
17
- productId: string;
18
18
  }>;
19
19
  }, "strip", z.ZodTypeAny, {
20
20
  body: {
21
21
  userId: string;
22
+ productId: string;
22
23
  deviceIds: string[];
23
24
  pricingId: string;
24
- productId: string;
25
25
  };
26
26
  }, {
27
27
  body: {
28
28
  userId: string;
29
+ productId: string;
29
30
  deviceIds: string[];
30
31
  pricingId: string;
31
- productId: string;
32
32
  };
33
33
  }>;
34
34
  export declare const listPlansSchema: z.ZodObject<{
@@ -43,49 +43,49 @@ export declare const listPlansSchema: z.ZodObject<{
43
43
  sortBy: z.ZodOptional<z.ZodEnum<["createdAt", "updatedAt", "nextInstallmentDueAt", "paidAmount", "outstandingAmount"]>>;
44
44
  sortOrder: z.ZodOptional<z.ZodEnum<["ASC", "DESC"]>>;
45
45
  }, "strip", z.ZodTypeAny, {
46
- page: number;
47
46
  limit: number;
48
- status?: "ACTIVE" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
47
+ page: number;
48
+ search?: string | undefined;
49
49
  userId?: string | undefined;
50
- deviceId?: string | undefined;
50
+ status?: "ACTIVE" | "DEFAULTED" | "COMPLETED" | "CANCELLED" | undefined;
51
51
  isOverdue?: "true" | "false" | undefined;
52
- search?: string | undefined;
53
- sortBy?: "createdAt" | "updatedAt" | "nextInstallmentDueAt" | "paidAmount" | "outstandingAmount" | undefined;
54
- sortOrder?: "ASC" | "DESC" | undefined;
52
+ sortBy?: "createdAt" | "updatedAt" | "paidAmount" | "outstandingAmount" | "nextInstallmentDueAt" | undefined;
53
+ sortOrder?: "DESC" | "ASC" | undefined;
54
+ deviceId?: string | undefined;
55
55
  }, {
56
- status?: "ACTIVE" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
56
+ search?: string | undefined;
57
+ limit?: string | undefined;
57
58
  userId?: string | undefined;
59
+ status?: "ACTIVE" | "DEFAULTED" | "COMPLETED" | "CANCELLED" | undefined;
60
+ isOverdue?: "true" | "false" | undefined;
58
61
  page?: string | undefined;
59
- limit?: string | undefined;
62
+ sortBy?: "createdAt" | "updatedAt" | "paidAmount" | "outstandingAmount" | "nextInstallmentDueAt" | undefined;
63
+ sortOrder?: "DESC" | "ASC" | undefined;
60
64
  deviceId?: string | undefined;
61
- isOverdue?: "true" | "false" | undefined;
62
- search?: string | undefined;
63
- sortBy?: "createdAt" | "updatedAt" | "nextInstallmentDueAt" | "paidAmount" | "outstandingAmount" | undefined;
64
- sortOrder?: "ASC" | "DESC" | undefined;
65
65
  }>;
66
66
  }, "strip", z.ZodTypeAny, {
67
67
  query: {
68
- page: number;
69
68
  limit: number;
70
- status?: "ACTIVE" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
69
+ page: number;
70
+ search?: string | undefined;
71
71
  userId?: string | undefined;
72
- deviceId?: string | undefined;
72
+ status?: "ACTIVE" | "DEFAULTED" | "COMPLETED" | "CANCELLED" | undefined;
73
73
  isOverdue?: "true" | "false" | undefined;
74
- search?: string | undefined;
75
- sortBy?: "createdAt" | "updatedAt" | "nextInstallmentDueAt" | "paidAmount" | "outstandingAmount" | undefined;
76
- sortOrder?: "ASC" | "DESC" | undefined;
74
+ sortBy?: "createdAt" | "updatedAt" | "paidAmount" | "outstandingAmount" | "nextInstallmentDueAt" | undefined;
75
+ sortOrder?: "DESC" | "ASC" | undefined;
76
+ deviceId?: string | undefined;
77
77
  };
78
78
  }, {
79
79
  query: {
80
- status?: "ACTIVE" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
80
+ search?: string | undefined;
81
+ limit?: string | undefined;
81
82
  userId?: string | undefined;
83
+ status?: "ACTIVE" | "DEFAULTED" | "COMPLETED" | "CANCELLED" | undefined;
84
+ isOverdue?: "true" | "false" | undefined;
82
85
  page?: string | undefined;
83
- limit?: string | undefined;
86
+ sortBy?: "createdAt" | "updatedAt" | "paidAmount" | "outstandingAmount" | "nextInstallmentDueAt" | undefined;
87
+ sortOrder?: "DESC" | "ASC" | undefined;
84
88
  deviceId?: string | undefined;
85
- isOverdue?: "true" | "false" | undefined;
86
- search?: string | undefined;
87
- sortBy?: "createdAt" | "updatedAt" | "nextInstallmentDueAt" | "paidAmount" | "outstandingAmount" | undefined;
88
- sortOrder?: "ASC" | "DESC" | undefined;
89
89
  };
90
90
  }>;
91
91
  export declare const getPlanSchema: z.ZodObject<{
@@ -117,10 +117,10 @@ export declare const getUserPlansSchema: z.ZodObject<{
117
117
  status: z.ZodOptional<z.ZodEnum<["ACTIVE", "COMPLETED", "DEFAULTED", "CANCELLED"]>>;
118
118
  includeCompleted: z.ZodOptional<z.ZodEnum<["true", "false"]>>;
119
119
  }, "strip", z.ZodTypeAny, {
120
- status?: "ACTIVE" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
120
+ status?: "ACTIVE" | "DEFAULTED" | "COMPLETED" | "CANCELLED" | undefined;
121
121
  includeCompleted?: "true" | "false" | undefined;
122
122
  }, {
123
- status?: "ACTIVE" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
123
+ status?: "ACTIVE" | "DEFAULTED" | "COMPLETED" | "CANCELLED" | undefined;
124
124
  includeCompleted?: "true" | "false" | undefined;
125
125
  }>>;
126
126
  }, "strip", z.ZodTypeAny, {
@@ -128,7 +128,7 @@ export declare const getUserPlansSchema: z.ZodObject<{
128
128
  userId: string;
129
129
  };
130
130
  query?: {
131
- status?: "ACTIVE" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
131
+ status?: "ACTIVE" | "DEFAULTED" | "COMPLETED" | "CANCELLED" | undefined;
132
132
  includeCompleted?: "true" | "false" | undefined;
133
133
  } | undefined;
134
134
  }, {
@@ -136,7 +136,7 @@ export declare const getUserPlansSchema: z.ZodObject<{
136
136
  userId: string;
137
137
  };
138
138
  query?: {
139
- status?: "ACTIVE" | "COMPLETED" | "DEFAULTED" | "CANCELLED" | undefined;
139
+ status?: "ACTIVE" | "DEFAULTED" | "COMPLETED" | "CANCELLED" | undefined;
140
140
  includeCompleted?: "true" | "false" | undefined;
141
141
  } | undefined;
142
142
  }>;
@@ -172,44 +172,44 @@ export declare const limitedUpdateSchema: z.ZodObject<{
172
172
  userId: z.ZodOptional<z.ZodString>;
173
173
  }, "strip", z.ZodTypeAny, {
174
174
  userId?: string | undefined;
175
+ productId?: string | undefined;
175
176
  deviceIds?: string[] | undefined;
176
177
  pricingId?: string | undefined;
177
- productId?: string | undefined;
178
178
  }, {
179
179
  userId?: string | undefined;
180
+ productId?: string | undefined;
180
181
  deviceIds?: string[] | undefined;
181
182
  pricingId?: string | undefined;
182
- productId?: string | undefined;
183
183
  }>, {
184
184
  userId?: string | undefined;
185
+ productId?: string | undefined;
185
186
  deviceIds?: string[] | undefined;
186
187
  pricingId?: string | undefined;
187
- productId?: string | undefined;
188
188
  }, {
189
189
  userId?: string | undefined;
190
+ productId?: string | undefined;
190
191
  deviceIds?: string[] | undefined;
191
192
  pricingId?: string | undefined;
192
- productId?: string | undefined;
193
193
  }>;
194
194
  }, "strip", z.ZodTypeAny, {
195
- params: {
196
- id: string;
197
- };
198
195
  body: {
199
196
  userId?: string | undefined;
197
+ productId?: string | undefined;
200
198
  deviceIds?: string[] | undefined;
201
199
  pricingId?: string | undefined;
202
- productId?: string | undefined;
203
200
  };
204
- }, {
205
201
  params: {
206
202
  id: string;
207
203
  };
204
+ }, {
208
205
  body: {
209
206
  userId?: string | undefined;
207
+ productId?: string | undefined;
210
208
  deviceIds?: string[] | undefined;
211
209
  pricingId?: string | undefined;
212
- productId?: string | undefined;
210
+ };
211
+ params: {
212
+ id: string;
213
213
  };
214
214
  }>;
215
215
  export declare const recordPaymentSchema: z.ZodObject<{
@@ -229,37 +229,37 @@ export declare const recordPaymentSchema: z.ZodObject<{
229
229
  }, "strip", z.ZodTypeAny, {
230
230
  amount: number;
231
231
  provider: "MTN_MOMO" | "AIRTEL_MONEY" | "DPO" | "FLUTTERWAVE";
232
+ metadata?: Record<string, any> | undefined;
232
233
  providerReference?: string | undefined;
233
234
  customerPhone?: string | undefined;
234
- metadata?: Record<string, any> | undefined;
235
235
  }, {
236
236
  amount: number;
237
237
  provider: "MTN_MOMO" | "AIRTEL_MONEY" | "DPO" | "FLUTTERWAVE";
238
+ metadata?: Record<string, any> | undefined;
238
239
  providerReference?: string | undefined;
239
240
  customerPhone?: string | undefined;
240
- metadata?: Record<string, any> | undefined;
241
241
  }>;
242
242
  }, "strip", z.ZodTypeAny, {
243
- params: {
244
- id: string;
245
- };
246
243
  body: {
247
244
  amount: number;
248
245
  provider: "MTN_MOMO" | "AIRTEL_MONEY" | "DPO" | "FLUTTERWAVE";
246
+ metadata?: Record<string, any> | undefined;
249
247
  providerReference?: string | undefined;
250
248
  customerPhone?: string | undefined;
251
- metadata?: Record<string, any> | undefined;
252
249
  };
253
- }, {
254
250
  params: {
255
251
  id: string;
256
252
  };
253
+ }, {
257
254
  body: {
258
255
  amount: number;
259
256
  provider: "MTN_MOMO" | "AIRTEL_MONEY" | "DPO" | "FLUTTERWAVE";
257
+ metadata?: Record<string, any> | undefined;
260
258
  providerReference?: string | undefined;
261
259
  customerPhone?: string | undefined;
262
- metadata?: Record<string, any> | undefined;
260
+ };
261
+ params: {
262
+ id: string;
263
263
  };
264
264
  }>;
265
265
  export declare const deletePlanSchema: z.ZodObject<{
@@ -10,21 +10,21 @@ export declare const userLoginSchema: z.ZodObject<{
10
10
  contactValue: z.ZodEffects<z.ZodString, string, string>;
11
11
  password: z.ZodString;
12
12
  }, "strip", z.ZodTypeAny, {
13
- contactValue: string;
14
13
  password: string;
15
- }, {
16
14
  contactValue: string;
15
+ }, {
17
16
  password: string;
17
+ contactValue: string;
18
18
  }>;
19
19
  }, "strip", z.ZodTypeAny, {
20
20
  body: {
21
- contactValue: string;
22
21
  password: string;
22
+ contactValue: string;
23
23
  };
24
24
  }, {
25
25
  body: {
26
- contactValue: string;
27
26
  password: string;
27
+ contactValue: string;
28
28
  };
29
29
  }>;
30
30
  export declare const forgotPasswordSchema: z.ZodObject<{
@@ -95,33 +95,33 @@ export declare const registerSchema: z.ZodObject<{
95
95
  birthMonth: z.ZodOptional<z.ZodNumber>;
96
96
  birthYear: z.ZodOptional<z.ZodNumber>;
97
97
  }, "strict", z.ZodTypeAny, {
98
- contactValue: string;
99
- password: string;
100
98
  firstName: string;
101
99
  lastName: string;
102
- role: "RIDER" | "PASSENGER";
100
+ password: string;
101
+ role: "PASSENGER" | "RIDER";
102
+ contactValue: string;
103
103
  gender?: "male" | "female" | undefined;
104
104
  birthDate?: number | undefined;
105
105
  birthMonth?: number | undefined;
106
106
  birthYear?: number | undefined;
107
107
  }, {
108
- contactValue: string;
109
- password: string;
110
108
  firstName: string;
111
109
  lastName: string;
112
- role?: "RIDER" | "PASSENGER" | undefined;
110
+ password: string;
111
+ contactValue: string;
113
112
  gender?: "male" | "female" | undefined;
114
113
  birthDate?: number | undefined;
115
114
  birthMonth?: number | undefined;
116
115
  birthYear?: number | undefined;
116
+ role?: "PASSENGER" | "RIDER" | undefined;
117
117
  }>;
118
118
  }, "strip", z.ZodTypeAny, {
119
119
  body: {
120
- contactValue: string;
121
- password: string;
122
120
  firstName: string;
123
121
  lastName: string;
124
- role: "RIDER" | "PASSENGER";
122
+ password: string;
123
+ role: "PASSENGER" | "RIDER";
124
+ contactValue: string;
125
125
  gender?: "male" | "female" | undefined;
126
126
  birthDate?: number | undefined;
127
127
  birthMonth?: number | undefined;
@@ -129,15 +129,15 @@ export declare const registerSchema: z.ZodObject<{
129
129
  };
130
130
  }, {
131
131
  body: {
132
- contactValue: string;
133
- password: string;
134
132
  firstName: string;
135
133
  lastName: string;
136
- role?: "RIDER" | "PASSENGER" | undefined;
134
+ password: string;
135
+ contactValue: string;
137
136
  gender?: "male" | "female" | undefined;
138
137
  birthDate?: number | undefined;
139
138
  birthMonth?: number | undefined;
140
139
  birthYear?: number | undefined;
140
+ role?: "PASSENGER" | "RIDER" | undefined;
141
141
  };
142
142
  }>;
143
143
  export declare const riderPasswordRegex: RegExp;
@@ -359,57 +359,57 @@ export declare const createUserSchema: z.ZodObject<{
359
359
  jacketId: z.ZodOptional<z.ZodString>;
360
360
  plateNumber: z.ZodOptional<z.ZodString>;
361
361
  }, "strip", z.ZodTypeAny, {
362
- contactValue: string;
363
- password: string;
364
362
  firstName: string;
365
363
  lastName: string;
366
- role: "RIDER" | "PASSENGER" | "ADMIN" | "AGENT" | "SUPER_ADMIN";
364
+ password: string;
365
+ role: "ADMIN" | "PASSENGER" | "RIDER" | "AGENT" | "SUPER_ADMIN";
366
+ contactValue: string;
367
+ jacketId?: string | undefined;
368
+ plateNumber?: string | undefined;
367
369
  gender?: "male" | "female" | undefined;
368
370
  birthDate?: number | undefined;
369
371
  birthMonth?: number | undefined;
370
372
  birthYear?: number | undefined;
371
- jacketId?: string | undefined;
372
- plateNumber?: string | undefined;
373
373
  }, {
374
- contactValue: string;
375
- password: string;
376
374
  firstName: string;
377
375
  lastName: string;
378
- role: "RIDER" | "PASSENGER" | "ADMIN" | "AGENT" | "SUPER_ADMIN";
376
+ password: string;
377
+ role: "ADMIN" | "PASSENGER" | "RIDER" | "AGENT" | "SUPER_ADMIN";
378
+ contactValue: string;
379
+ jacketId?: string | undefined;
380
+ plateNumber?: string | undefined;
379
381
  gender?: "male" | "female" | undefined;
380
382
  birthDate?: number | undefined;
381
383
  birthMonth?: number | undefined;
382
384
  birthYear?: number | undefined;
383
- jacketId?: string | undefined;
384
- plateNumber?: string | undefined;
385
385
  }>;
386
386
  }, "strip", z.ZodTypeAny, {
387
387
  body: {
388
- contactValue: string;
389
- password: string;
390
388
  firstName: string;
391
389
  lastName: string;
392
- role: "RIDER" | "PASSENGER" | "ADMIN" | "AGENT" | "SUPER_ADMIN";
390
+ password: string;
391
+ role: "ADMIN" | "PASSENGER" | "RIDER" | "AGENT" | "SUPER_ADMIN";
392
+ contactValue: string;
393
+ jacketId?: string | undefined;
394
+ plateNumber?: string | undefined;
393
395
  gender?: "male" | "female" | undefined;
394
396
  birthDate?: number | undefined;
395
397
  birthMonth?: number | undefined;
396
398
  birthYear?: number | undefined;
397
- jacketId?: string | undefined;
398
- plateNumber?: string | undefined;
399
399
  };
400
400
  }, {
401
401
  body: {
402
- contactValue: string;
403
- password: string;
404
402
  firstName: string;
405
403
  lastName: string;
406
- role: "RIDER" | "PASSENGER" | "ADMIN" | "AGENT" | "SUPER_ADMIN";
404
+ password: string;
405
+ role: "ADMIN" | "PASSENGER" | "RIDER" | "AGENT" | "SUPER_ADMIN";
406
+ contactValue: string;
407
+ jacketId?: string | undefined;
408
+ plateNumber?: string | undefined;
407
409
  gender?: "male" | "female" | undefined;
408
410
  birthDate?: number | undefined;
409
411
  birthMonth?: number | undefined;
410
412
  birthYear?: number | undefined;
411
- jacketId?: string | undefined;
412
- plateNumber?: string | undefined;
413
413
  };
414
414
  }>;
415
415
  export declare const updateContactSchema: z.ZodObject<{