@bizmap/sdk 0.0.27 → 0.0.29

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 (3) hide show
  1. package/dist/main.d.ts +59 -218
  2. package/dist/main.js +65 -73
  3. package/package.json +1 -1
package/dist/main.d.ts CHANGED
@@ -25,90 +25,6 @@ declare const PriceTag: z.ZodObject<{
25
25
  }, z.core.$strip>;
26
26
  type PriceTag = z.infer<typeof PriceTag>;
27
27
 
28
- declare const CompanyIdentity: z.ZodObject<{
29
- createdAt: z.ZodReadonly<z.ZodInt>;
30
- lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
31
- uid: z.ZodReadonly<z.ZodString>;
32
- displayName: z.ZodString;
33
- logo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
34
- contact: z.ZodObject<{
35
- email: z.ZodEmail;
36
- phoneNumber: z.ZodOptional<z.ZodString>;
37
- }, z.core.$strip>;
38
- address: z.ZodObject<{
39
- streetAddress: z.ZodString;
40
- city: z.ZodOptional<z.ZodString>;
41
- parish: z.ZodString;
42
- country: z.ZodString;
43
- }, z.core.$strip>;
44
- legal: z.ZodObject<{
45
- regNo: z.ZodReadonly<z.ZodString>;
46
- trn: z.ZodOptional<z.ZodNullable<z.ZodString>>;
47
- gctRegNo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
48
- }, z.core.$strip>;
49
- }, z.core.$strip>;
50
- type CompanyIdentity = z.infer<typeof CompanyIdentity>;
51
- declare const CompanyOpState: z.ZodObject<{
52
- createdAt: z.ZodReadonly<z.ZodInt>;
53
- lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
54
- uid: z.ZodReadonly<z.ZodString>;
55
- availableBalance: z.ZodNumber;
56
- invoiceNoRef: z.ZodNullable<z.ZodString>;
57
- totalUploads: z.ZodNumber;
58
- preferences: z.ZodObject<{
59
- createdAt: z.ZodReadonly<z.ZodInt>;
60
- lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
61
- userProvisions: z.ZodNumber;
62
- apptDistAlg: z.ZodDefault<z.ZodEnum<{
63
- RR: "RR";
64
- LOR: "LOR";
65
- }>>;
66
- }, z.core.$strip>;
67
- }, z.core.$strip>;
68
- type CompanyOpState = z.infer<typeof CompanyOpState>;
69
- declare const CompanyBillingModel: z.ZodObject<{
70
- createdAt: z.ZodReadonly<z.ZodInt>;
71
- lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
72
- uid: z.ZodReadonly<z.ZodString>;
73
- preferences: z.ZodObject<{
74
- createdAt: z.ZodReadonly<z.ZodInt>;
75
- lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
76
- allowInvoiceDist: z.ZodBoolean;
77
- useCreatedServices: z.ZodBoolean;
78
- serviceSelector: z.ZodEnum<{
79
- scheduler: "scheduler";
80
- doctor: "doctor";
81
- }>;
82
- enforcePaidAppts: z.ZodBoolean;
83
- primaryCurrency: z.ZodEnum<{
84
- JMD: "JMD";
85
- }>;
86
- acceptedCurrencies: z.ZodPipe<z.ZodArray<z.ZodEnum<{
87
- JMD: "JMD";
88
- }>>, z.ZodTransform<"JMD"[], "JMD"[]>>;
89
- }, z.core.$strip>;
90
- additionalFees: z.ZodDefault<z.ZodArray<z.ZodObject<{
91
- createdAt: z.ZodReadonly<z.ZodInt>;
92
- lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
93
- description: z.ZodOptional<z.ZodString>;
94
- fixedAmount: z.ZodNumber;
95
- percentage: z.ZodNumber;
96
- }, z.core.$strip>>>;
97
- discounts: z.ZodDefault<z.ZodArray<z.ZodObject<{
98
- createdAt: z.ZodReadonly<z.ZodInt>;
99
- lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
100
- description: z.ZodOptional<z.ZodString>;
101
- fixedAmount: z.ZodNumber;
102
- percentage: z.ZodNumber;
103
- }, z.core.$strip>>>;
104
- services: z.ZodDefault<z.ZodArray<z.ZodObject<{
105
- createdAt: z.ZodReadonly<z.ZodInt>;
106
- lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
107
- item: z.ZodString;
108
- cost: z.ZodNumber;
109
- }, z.core.$strip>>>;
110
- }, z.core.$strip>;
111
- type CompanyBillingModel = z.infer<typeof CompanyBillingModel>;
112
28
  declare const RegisterCompanyForm: z.ZodObject<{
113
29
  regNo: z.ZodString;
114
30
  userProvisions: z.ZodNumber;
@@ -202,153 +118,44 @@ declare const CompanyUser: z.ZodObject<{
202
118
  phoneNumber: z.ZodOptional<z.ZodString>;
203
119
  }, z.core.$strip>;
204
120
  type CompanyUser = z.infer<typeof CompanyUser>;
205
- declare const _staffDetails: z.ZodObject<{
206
- createdAt: z.ZodReadonly<z.ZodInt>;
207
- lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
208
- uid: z.ZodReadonly<z.ZodString>;
209
- members: z.ZodArray<z.ZodObject<{
210
- createdAt: z.ZodReadonly<z.ZodInt>;
211
- lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
212
- uid: z.ZodReadonly<z.ZodString>;
213
- status: z.ZodEnum<{
214
- inviteSent: "inviteSent";
215
- active: "active";
216
- inactive: "inactive";
217
- }>;
218
- roles: z.ZodPipe<z.ZodArray<z.ZodEnum<{
219
- doc: "doc";
220
- physAsst: "physAsst";
221
- rcpst: "rcpst";
222
- cshr: "cshr";
223
- admin: "admin";
224
- }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[]>>;
225
- lastActive: z.ZodInt;
226
- name: z.ZodRecord<z.ZodEnum<{
227
- first: "first";
228
- last: "last";
229
- }>, z.ZodString>;
230
- photoUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
231
- email: z.ZodEmail;
232
- phoneNumber: z.ZodOptional<z.ZodString>;
233
- }, z.core.$strip>>;
234
- partnerMap: z.ZodRecord<z.ZodReadonly<z.ZodString>, z.ZodPipe<z.ZodArray<z.ZodReadonly<z.ZodString>>, z.ZodTransform<string[], string[]>>>;
235
- blackList: z.ZodPipe<z.ZodArray<z.ZodReadonly<z.ZodString>>, z.ZodTransform<string[], string[]>>;
236
- }, z.core.$strip>;
237
- /** The unpacked Staff Details */
238
- declare const StaffDetails: z.ZodPipe<z.ZodObject<{
239
- createdAt: z.ZodReadonly<z.ZodInt>;
240
- lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
241
- uid: z.ZodReadonly<z.ZodString>;
242
- members: z.ZodArray<z.ZodObject<{
243
- createdAt: z.ZodReadonly<z.ZodInt>;
244
- lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
245
- uid: z.ZodReadonly<z.ZodString>;
246
- status: z.ZodEnum<{
247
- inviteSent: "inviteSent";
248
- active: "active";
249
- inactive: "inactive";
250
- }>;
251
- roles: z.ZodPipe<z.ZodArray<z.ZodEnum<{
252
- doc: "doc";
253
- physAsst: "physAsst";
254
- rcpst: "rcpst";
255
- cshr: "cshr";
256
- admin: "admin";
257
- }>>, z.ZodTransform<("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[], ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[]>>;
258
- lastActive: z.ZodInt;
259
- name: z.ZodRecord<z.ZodEnum<{
260
- first: "first";
261
- last: "last";
262
- }>, z.ZodString>;
263
- photoUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
264
- email: z.ZodEmail;
265
- phoneNumber: z.ZodOptional<z.ZodString>;
266
- }, z.core.$strip>>;
267
- partnerMap: z.ZodRecord<z.ZodReadonly<z.ZodString>, z.ZodPipe<z.ZodArray<z.ZodReadonly<z.ZodString>>, z.ZodTransform<string[], string[]>>>;
268
- blackList: z.ZodPipe<z.ZodArray<z.ZodReadonly<z.ZodString>>, z.ZodTransform<string[], string[]>>;
269
- }, z.core.$strip>, z.ZodTransform<{
270
- createdAt: number;
271
- uid: string;
272
- members: {
273
- createdAt: number;
274
- uid: string;
275
- status: "inviteSent" | "active" | "inactive";
276
- roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
277
- lastActive: number;
278
- name: Record<"first" | "last", string>;
279
- email: string;
280
- lastModified?: number | null | undefined;
281
- photoUrl?: string | null | undefined;
282
- phoneNumber?: string | undefined;
283
- }[];
284
- partnerMap: Record<string, string[]>;
285
- blackList: string[];
286
- lastModified?: number | null | undefined;
287
- }, {
288
- createdAt: number;
289
- uid: string;
290
- members: {
291
- createdAt: number;
292
- uid: string;
293
- status: "inviteSent" | "active" | "inactive";
294
- roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
295
- lastActive: number;
296
- name: Record<"first" | "last", string>;
297
- email: string;
298
- lastModified?: number | null | undefined;
299
- photoUrl?: string | null | undefined;
300
- phoneNumber?: string | undefined;
301
- }[];
302
- partnerMap: Record<string, string[]>;
303
- blackList: string[];
304
- lastModified?: number | null | undefined;
305
- }>>;
306
- type StaffDetails = z.infer<typeof _staffDetails>;
307
121
  declare const CompanyDetails: z.ZodObject<{
308
122
  uid: z.ZodReadonly<z.ZodString>;
123
+ state: z.ZodObject<{
124
+ availableBalance: z.ZodNumber;
125
+ invoiceNoRef: z.ZodNullable<z.ZodString>;
126
+ totalUploads: z.ZodNumber;
127
+ lastModified: z.ZodNullable<z.ZodInt>;
128
+ }, z.core.$strip>;
309
129
  identity: z.ZodObject<{
310
- createdAt: z.ZodReadonly<z.ZodInt>;
311
- lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
312
- address: z.ZodObject<{
313
- streetAddress: z.ZodString;
314
- city: z.ZodOptional<z.ZodString>;
315
- parish: z.ZodString;
316
- country: z.ZodString;
317
- }, z.core.$strip>;
318
130
  displayName: z.ZodString;
319
131
  logo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
320
132
  contact: z.ZodObject<{
321
133
  email: z.ZodEmail;
322
134
  phoneNumber: z.ZodOptional<z.ZodString>;
323
135
  }, z.core.$strip>;
136
+ address: z.ZodObject<{
137
+ streetAddress: z.ZodString;
138
+ city: z.ZodOptional<z.ZodString>;
139
+ parish: z.ZodString;
140
+ country: z.ZodString;
141
+ }, z.core.$strip>;
324
142
  legal: z.ZodObject<{
325
143
  regNo: z.ZodReadonly<z.ZodString>;
326
144
  trn: z.ZodOptional<z.ZodNullable<z.ZodString>>;
327
145
  gctRegNo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
328
146
  }, z.core.$strip>;
147
+ lastModified: z.ZodNullable<z.ZodInt>;
329
148
  }, z.core.$strip>;
330
- opState: z.ZodObject<{
331
- createdAt: z.ZodReadonly<z.ZodInt>;
332
- lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
333
- availableBalance: z.ZodNumber;
334
- invoiceNoRef: z.ZodNullable<z.ZodString>;
335
- totalUploads: z.ZodNumber;
336
- preferences: z.ZodObject<{
337
- createdAt: z.ZodReadonly<z.ZodInt>;
338
- lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
339
- userProvisions: z.ZodNumber;
340
- apptDistAlg: z.ZodDefault<z.ZodEnum<{
341
- RR: "RR";
342
- LOR: "LOR";
343
- }>>;
344
- }, z.core.$strip>;
149
+ preferences: z.ZodObject<{
150
+ userProvisions: z.ZodNumber;
151
+ apptDistAlg: z.ZodDefault<z.ZodEnum<{
152
+ RR: "RR";
153
+ LOR: "LOR";
154
+ }>>;
155
+ lastModified: z.ZodNullable<z.ZodInt>;
345
156
  }, z.core.$strip>;
346
157
  billing: z.ZodObject<{
347
- createdAt: z.ZodReadonly<z.ZodInt>;
348
- lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
349
158
  preferences: z.ZodObject<{
350
- createdAt: z.ZodReadonly<z.ZodInt>;
351
- lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
352
159
  allowInvoiceDist: z.ZodBoolean;
353
160
  useCreatedServices: z.ZodBoolean;
354
161
  serviceSelector: z.ZodEnum<{
@@ -362,6 +169,7 @@ declare const CompanyDetails: z.ZodObject<{
362
169
  acceptedCurrencies: z.ZodPipe<z.ZodArray<z.ZodEnum<{
363
170
  JMD: "JMD";
364
171
  }>>, z.ZodTransform<"JMD"[], "JMD"[]>>;
172
+ lastModified: z.ZodNullable<z.ZodInt>;
365
173
  }, z.core.$strip>;
366
174
  additionalFees: z.ZodDefault<z.ZodArray<z.ZodObject<{
367
175
  createdAt: z.ZodReadonly<z.ZodInt>;
@@ -383,10 +191,9 @@ declare const CompanyDetails: z.ZodObject<{
383
191
  item: z.ZodString;
384
192
  cost: z.ZodNumber;
385
193
  }, z.core.$strip>>>;
194
+ lastModified: z.ZodNullable<z.ZodInt>;
386
195
  }, z.core.$strip>;
387
- staffDetails: z.ZodObject<{
388
- createdAt: z.ZodReadonly<z.ZodInt>;
389
- lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
196
+ staffDetails: z.ZodPipe<z.ZodObject<{
390
197
  members: z.ZodArray<z.ZodObject<{
391
198
  createdAt: z.ZodReadonly<z.ZodInt>;
392
199
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
@@ -414,7 +221,41 @@ declare const CompanyDetails: z.ZodObject<{
414
221
  }, z.core.$strip>>;
415
222
  partnerMap: z.ZodRecord<z.ZodReadonly<z.ZodString>, z.ZodPipe<z.ZodArray<z.ZodReadonly<z.ZodString>>, z.ZodTransform<string[], string[]>>>;
416
223
  blackList: z.ZodPipe<z.ZodArray<z.ZodReadonly<z.ZodString>>, z.ZodTransform<string[], string[]>>;
417
- }, z.core.$strip>;
224
+ lastModified: z.ZodNullable<z.ZodInt>;
225
+ }, z.core.$strip>, z.ZodTransform<{
226
+ members: {
227
+ createdAt: number;
228
+ uid: string;
229
+ status: "inviteSent" | "active" | "inactive";
230
+ roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
231
+ lastActive: number;
232
+ name: Record<"first" | "last", string>;
233
+ email: string;
234
+ lastModified?: number | null | undefined;
235
+ photoUrl?: string | null | undefined;
236
+ phoneNumber?: string | undefined;
237
+ }[];
238
+ partnerMap: Record<string, string[]>;
239
+ blackList: string[];
240
+ lastModified: number | null;
241
+ }, {
242
+ members: {
243
+ createdAt: number;
244
+ uid: string;
245
+ status: "inviteSent" | "active" | "inactive";
246
+ roles: ("doc" | "physAsst" | "rcpst" | "cshr" | "admin")[];
247
+ lastActive: number;
248
+ name: Record<"first" | "last", string>;
249
+ email: string;
250
+ lastModified?: number | null | undefined;
251
+ photoUrl?: string | null | undefined;
252
+ phoneNumber?: string | undefined;
253
+ }[];
254
+ partnerMap: Record<string, string[]>;
255
+ blackList: string[];
256
+ lastModified: number | null;
257
+ }>>;
258
+ createdAt: z.ZodInt;
418
259
  }, z.core.$strip>;
419
260
  type CompanyDetails = z.infer<typeof CompanyDetails>;
420
261
 
@@ -471,4 +312,4 @@ declare const findConflictingPartners: (...partners: CompanyUser[]) => {
471
312
  /**@returns the roles that are compatible with the selected role. */
472
313
  declare const getCompatibleRoles: (role: CompanyUserRole) => CompanyUserRole[];
473
314
 
474
- export { type AppointmentDistAlg, CompanyBillingModel, CompanyDetails, CompanyIdentity, CompanyOpState, type CompanyPartnerRole, CompanyRegistrationClaims, CompanyUser, type CompanyUserRole, type EmployeeRole, InvoiceNo, PriceAdjustment, PriceTag, PricingRate, RegisterCompanyForm, StaffDetails, StandardTime, TimeLog, Timestamp, UuidV4, UuidV7, appointmentDistAlgs, companyPartnerRoles, companyUserRoles, employeeRoles, findConflictingPartners, getCompatibleRoles };
315
+ export { type AppointmentDistAlg, CompanyDetails, type CompanyPartnerRole, CompanyRegistrationClaims, CompanyUser, type CompanyUserRole, type EmployeeRole, InvoiceNo, PriceAdjustment, PriceTag, PricingRate, RegisterCompanyForm, StandardTime, TimeLog, Timestamp, UuidV4, UuidV7, appointmentDistAlgs, companyPartnerRoles, companyUserRoles, employeeRoles, findConflictingPartners, getCompatibleRoles };
package/dist/main.js CHANGED
@@ -71,9 +71,41 @@ var employeeRoles = companyUserRoles.exclude(["admin"]);
71
71
  var appointmentDistAlgs = z3.enum(["RR", "LOR"]);
72
72
 
73
73
  // src/schemas/Company.ts
74
- var CompanyIdentity = z4.object({
74
+ var RegisterCompanyForm = z4.object({
75
+ regNo: z4.string(),
76
+ userProvisions: z4.number(),
77
+ slogan: z4.string(),
78
+ email: z4.email(),
79
+ phoneNumber: PhoneNumber,
80
+ logo: FileDetails,
81
+ receipt: FileDetails,
82
+ _claims: z4.string()
83
+ });
84
+ var CompanyRegistrationClaims = z4.object({
85
+ sender: UserModel,
86
+ pricingRate: PricingRate.shape.companyRegistration,
87
+ ...TimeLog.shape
88
+ });
89
+ var CompanyUser = z4.object({
90
+ ...UserModel.shape,
75
91
  uid: UuidV7,
76
- // The company's uid
92
+ status: z4.enum(["inviteSent", "active", "inactive"]),
93
+ roles: z4.array(companyUserRoles).transform((roles) => {
94
+ const newRoles = [];
95
+ for (const role of roles) {
96
+ if (!!role && !newRoles.includes(role)) newRoles.push(role);
97
+ }
98
+ return newRoles.sort();
99
+ }).refine((roles) => {
100
+ const compatibleRoles = getCompatibleRoles(roles[0]);
101
+ return roles.every(
102
+ (role, i) => i === 0 || compatibleRoles.includes(role)
103
+ );
104
+ }, "A user is not allowed to have conflicting roles."),
105
+ lastActive: Timestamp,
106
+ ...TimeLog.shape
107
+ });
108
+ var CompanyIdentity = z4.object({
77
109
  displayName: z4.string().min(3).max(20),
78
110
  logo: z4.string().max(2500).nullish(),
79
111
  contact: z4.object({
@@ -87,11 +119,9 @@ var CompanyIdentity = z4.object({
87
119
  trn: z4.string().regex(/[0-9]{3}-[0-9]{3}-[0-9]{3}/).nullish(),
88
120
  gctRegNo: z4.string().max(15).nullish()
89
121
  }),
90
- ...TimeLog.shape
122
+ lastModified: Timestamp.nullable()
91
123
  });
92
- var CompanyOpState = z4.object({
93
- // The company's uid
94
- uid: UuidV7,
124
+ var CompanyState = z4.object({
95
125
  // This can only be changed by the server/app admin
96
126
  availableBalance: z4.number(),
97
127
  /** A counter for the company's invoice numbers. */
@@ -101,24 +131,22 @@ var CompanyOpState = z4.object({
101
131
  * @note - This should be refreshed daily.
102
132
  */
103
133
  totalUploads: z4.number(),
104
- // This can be changed by the company's admin
105
- preferences: z4.object({
106
- /** The amount of user provisions made for this company */
107
- userProvisions: z4.number().max(150, { error: "The total user provisions can't exceed 150" }).refine(
108
- (p) => !(p > 1 && p < 10),
109
- "The total user provisions must either be 1 or at least 10."
110
- ),
111
- /**
112
- * @property RR (Round Robin): Even distribution.
113
- * @property LOR (Least Outstanding Requests): Distribute based on availability.
114
- */
115
- apptDistAlg: appointmentDistAlgs.default("RR"),
116
- ...TimeLog.shape
117
- }),
118
- ...TimeLog.shape
134
+ lastModified: Timestamp.nullable()
135
+ });
136
+ var CompanyPreferences = z4.object({
137
+ /** The amount of user provisions made for this company */
138
+ userProvisions: z4.number().max(150, { error: "The total user provisions can't exceed 150" }).refine(
139
+ (p) => !(p > 1 && p < 10),
140
+ "The total user provisions must either be 1 or at least 10."
141
+ ),
142
+ /**
143
+ * @property RR (Round Robin): Even distribution.
144
+ * @property LOR (Least Outstanding Requests): Distribute based on availability.
145
+ */
146
+ apptDistAlg: appointmentDistAlgs.default("RR"),
147
+ lastModified: Timestamp.nullable()
119
148
  });
120
149
  var CompanyBillingModel = z4.object({
121
- uid: UuidV7,
122
150
  preferences: z4.object({
123
151
  /** Allows the serviceDecider to distribute invoices. */
124
152
  allowInvoiceDist: z4.boolean(),
@@ -141,7 +169,7 @@ var CompanyBillingModel = z4.object({
141
169
  }
142
170
  return newCurrencies;
143
171
  }),
144
- ...TimeLog.shape
172
+ lastModified: Timestamp.nullable()
145
173
  }).superRefine((data, ctx) => {
146
174
  if (data.enforcePaidAppts && data.serviceSelector !== "scheduler") {
147
175
  ctx.addIssue(
@@ -152,49 +180,14 @@ var CompanyBillingModel = z4.object({
152
180
  additionalFees: z4.array(PriceAdjustment).default([]),
153
181
  discounts: z4.array(PriceAdjustment).default([]),
154
182
  services: z4.array(PriceTag.omit({ uid: true })).max(100).default([]),
155
- ...TimeLog.shape
183
+ lastModified: Timestamp.nullable()
156
184
  }).superRefine((billing, ctx) => {
157
185
  const totalServices = billing?.services?.length ?? 0;
158
186
  if (billing?.preferences?.useCreatedServices && totalServices < 1) {
159
187
  ctx.addIssue("At least (1) service must be added to the services list.");
160
188
  }
161
189
  });
162
- var RegisterCompanyForm = z4.object({
163
- regNo: z4.string(),
164
- userProvisions: z4.number(),
165
- slogan: z4.string(),
166
- email: z4.email(),
167
- phoneNumber: PhoneNumber,
168
- logo: FileDetails,
169
- receipt: FileDetails,
170
- _claims: z4.string()
171
- });
172
- var CompanyRegistrationClaims = z4.object({
173
- sender: UserModel,
174
- pricingRate: PricingRate.shape.companyRegistration,
175
- ...TimeLog.shape
176
- });
177
- var CompanyUser = z4.object({
178
- ...UserModel.shape,
179
- uid: UuidV7,
180
- status: z4.enum(["inviteSent", "active", "inactive"]),
181
- roles: z4.array(companyUserRoles).transform((roles) => {
182
- const newRoles = [];
183
- for (const role of roles) {
184
- if (!!role && !newRoles.includes(role)) newRoles.push(role);
185
- }
186
- return newRoles.sort();
187
- }).refine((roles) => {
188
- const compatibleRoles = getCompatibleRoles(roles[0]);
189
- return roles.every(
190
- (role, i) => i === 0 || compatibleRoles.includes(role)
191
- );
192
- }, "A user is not allowed to have conflicting roles."),
193
- lastActive: Timestamp,
194
- ...TimeLog.shape
195
- });
196
- var _staffDetails = z4.object({
197
- uid: UuidV7,
190
+ var StaffDetails = z4.object({
198
191
  members: z4.array(CompanyUser).superRefine((users, ctx) => {
199
192
  const duplicateUids = [];
200
193
  const duplicateEmails = [];
@@ -246,15 +239,16 @@ var _staffDetails = z4.object({
246
239
  const newList = [];
247
240
  for (const uid of list) {
248
241
  if (!uid || typeof uid !== "string") continue;
249
- if (!newList.some((newUid) => newUid.toLowerCase() === uid.toLowerCase())) {
242
+ if (!newList.some(
243
+ (newUid) => newUid.toLowerCase() === uid.toLowerCase()
244
+ )) {
250
245
  newList.push(uid);
251
246
  }
252
247
  }
253
248
  return newList.sort();
254
249
  }),
255
- ...TimeLog.shape
256
- });
257
- var StaffDetails = _staffDetails.transform((d) => {
250
+ lastModified: Timestamp.nullable()
251
+ }).transform((d) => {
258
252
  let blackListWithExisitingUsers = [];
259
253
  for (const uid of d.blackList) {
260
254
  if (!uid || typeof uid !== "string") continue;
@@ -294,11 +288,13 @@ var StaffDetails = _staffDetails.transform((d) => {
294
288
  }
295
289
  });
296
290
  var CompanyDetails = z4.object({
297
- uid: CompanyIdentity.shape.uid,
298
- identity: CompanyIdentity.omit({ uid: true }),
299
- opState: CompanyOpState.omit({ uid: true }),
300
- billing: CompanyBillingModel.omit({ uid: true }),
301
- staffDetails: _staffDetails.omit({ uid: true })
291
+ uid: UuidV7,
292
+ state: CompanyState,
293
+ identity: CompanyIdentity,
294
+ preferences: CompanyPreferences,
295
+ billing: CompanyBillingModel,
296
+ staffDetails: StaffDetails,
297
+ createdAt: Timestamp
302
298
  });
303
299
 
304
300
  // src/functions/helper-functions.ts
@@ -332,10 +328,7 @@ var getCompatibleRoles = (role) => {
332
328
  return companyUserRoles.exclude([role]).options;
333
329
  };
334
330
  export {
335
- CompanyBillingModel,
336
331
  CompanyDetails,
337
- CompanyIdentity,
338
- CompanyOpState,
339
332
  CompanyRegistrationClaims,
340
333
  CompanyUser,
341
334
  InvoiceNo,
@@ -343,7 +336,6 @@ export {
343
336
  PriceTag,
344
337
  PricingRate,
345
338
  RegisterCompanyForm,
346
- StaffDetails,
347
339
  StandardTime,
348
340
  TimeLog,
349
341
  Timestamp,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bizmap/sdk",
3
- "version": "0.0.27",
3
+ "version": "0.0.29",
4
4
  "main": "./dist/main.js",
5
5
  "types": "./dist/main.d.ts",
6
6
  "type": "module",