@bizmap/sdk 0.0.39 → 0.0.40

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/main.d.ts CHANGED
@@ -25,73 +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 RegisterCompanyForm: z.ZodObject<{
29
- regNo: z.ZodString;
30
- userProvisions: z.ZodNumber;
31
- slogan: z.ZodString;
32
- email: z.ZodEmail;
33
- phoneNumber: z.ZodString;
34
- logo: z.ZodObject<{
35
- lastModified: z.ZodNullable<z.ZodNumber>;
36
- uid: z.ZodOptional<z.ZodString>;
37
- uploadDate: z.ZodOptional<z.ZodNumber>;
38
- sizeInBytes: z.ZodNumber;
39
- name: z.ZodString;
40
- path: z.ZodString;
41
- extension: z.ZodString;
42
- description: z.ZodOptional<z.ZodString>;
43
- mime: z.ZodString;
44
- alias: z.ZodEnum<{
45
- pdf: "pdf";
46
- word: "word";
47
- excel: "excel";
48
- img: "img";
49
- txt: "txt";
50
- unknown: "unknown";
51
- }>;
52
- }, z.core.$strip>;
53
- receipt: z.ZodObject<{
54
- lastModified: z.ZodNullable<z.ZodNumber>;
55
- uid: z.ZodOptional<z.ZodString>;
56
- uploadDate: z.ZodOptional<z.ZodNumber>;
57
- sizeInBytes: z.ZodNumber;
58
- name: z.ZodString;
59
- path: z.ZodString;
60
- extension: z.ZodString;
61
- description: z.ZodOptional<z.ZodString>;
62
- mime: z.ZodString;
63
- alias: z.ZodEnum<{
64
- pdf: "pdf";
65
- word: "word";
66
- excel: "excel";
67
- img: "img";
68
- txt: "txt";
69
- unknown: "unknown";
70
- }>;
71
- }, z.core.$strip>;
72
- _claims: z.ZodString;
73
- }, z.core.$strip>;
74
- type RegisterCompanyForm = z.infer<typeof RegisterCompanyForm>;
75
- declare const CompanyRegistrationClaims: z.ZodObject<{
76
- createdAt: z.ZodReadonly<z.ZodInt>;
77
- lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
78
- sender: z.ZodObject<{
79
- name: z.ZodRecord<z.ZodEnum<{
80
- first: "first";
81
- last: "last";
82
- }>, z.ZodString>;
83
- photoUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
84
- email: z.ZodEmail;
85
- phoneNumber: z.ZodOptional<z.ZodString>;
86
- uid: z.ZodString;
87
- }, z.core.$strip>;
88
- pricingRate: z.ZodObject<{
89
- flatFee: z.ZodNumber;
90
- feePerUser: z.ZodNumber;
91
- lastModified: z.ZodInt;
92
- }, z.core.$strip>;
93
- }, z.core.$strip>;
94
- type CompanyRegistrationClaims = z.infer<typeof CompanyRegistrationClaims>;
95
28
  declare const CompanyUser: z.ZodObject<{
96
29
  createdAt: z.ZodReadonly<z.ZodInt>;
97
30
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
@@ -145,6 +78,15 @@ declare const CompanyDetails: z.ZodObject<{
145
78
  }, z.core.$strip>;
146
79
  lastModified: z.ZodNullable<z.ZodInt>;
147
80
  }, z.core.$strip>;
81
+ receipts: z.ZodArray<z.ZodObject<{
82
+ createdAt: z.ZodReadonly<z.ZodInt>;
83
+ item: z.ZodString;
84
+ cost: z.ZodNumber;
85
+ }, z.core.$strip>> | z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
86
+ createdAt: z.ZodReadonly<z.ZodInt>;
87
+ item: z.ZodString;
88
+ cost: z.ZodNumber;
89
+ }, z.core.$strip>>>>;
148
90
  state: z.ZodObject<{
149
91
  availableBalance: z.ZodNumber;
150
92
  totalUploads: z.ZodNumber;
@@ -498,6 +440,15 @@ declare const PartialCompanyDetails: z.ZodObject<{
498
440
  }, z.core.$strip>;
499
441
  lastModified: z.ZodNullable<z.ZodInt>;
500
442
  }, z.core.$strip>;
443
+ receipts: z.ZodArray<z.ZodObject<{
444
+ createdAt: z.ZodReadonly<z.ZodInt>;
445
+ item: z.ZodString;
446
+ cost: z.ZodNumber;
447
+ }, z.core.$strip>> | z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
448
+ createdAt: z.ZodReadonly<z.ZodInt>;
449
+ item: z.ZodString;
450
+ cost: z.ZodNumber;
451
+ }, z.core.$strip>>>>;
501
452
  state: z.ZodObject<{
502
453
  availableBalance: z.ZodNumber;
503
454
  totalUploads: z.ZodNumber;
@@ -898,4 +849,4 @@ declare const findConflictingPartners: (...partners: CompanyUser[]) => {
898
849
  /**@returns the roles that are compatible with the selected role. */
899
850
  declare const getCompatibleRoles: (role: CompanyUserRole) => CompanyUserRole[];
900
851
 
901
- export { type AppointmentDistAlg, CompanyDetails, type CompanyPartnerRole, CompanyRegistrationClaims, type CompanyServiceSelector, CompanyUser, type CompanyUserRole, type EmployeeRole, type HealthcareProviderRole, InvoiceNo, PartialCompanyDetails, PriceAdjustment, PriceTag, PricingRate, RegisterCompanyForm, StandardTime, TimeLog, Timestamp, UuidV4, UuidV7, appointmentDistAlgs, companyPartnerRoles, companyServiceSelectors, companyUserRoles, employeeRoles, findConflictingPartners, getCompatibleRoles, healthcareProviderRoles };
852
+ export { type AppointmentDistAlg, CompanyDetails, type CompanyPartnerRole, type CompanyServiceSelector, CompanyUser, type CompanyUserRole, type EmployeeRole, type HealthcareProviderRole, InvoiceNo, PartialCompanyDetails, PriceAdjustment, PriceTag, PricingRate, StandardTime, TimeLog, Timestamp, UuidV4, UuidV7, appointmentDistAlgs, companyPartnerRoles, companyServiceSelectors, companyUserRoles, employeeRoles, findConflictingPartners, getCompatibleRoles, healthcareProviderRoles };
package/dist/main.js CHANGED
@@ -54,7 +54,6 @@ var PriceTag = z2.object({
54
54
  import {
55
55
  Address,
56
56
  currencies,
57
- FileDetails,
58
57
  PhoneNumber,
59
58
  UserModel
60
59
  } from "@wavy/util";
@@ -82,21 +81,6 @@ var appointmentDistAlgs = z3.enum(["RR", "LOR"]);
82
81
  var companyServiceSelectors = z3.enum(["scheduler", "doctor"]);
83
82
 
84
83
  // src/schemas/Company.ts
85
- var RegisterCompanyForm = z4.object({
86
- regNo: z4.string(),
87
- userProvisions: z4.number(),
88
- slogan: z4.string(),
89
- email: z4.email(),
90
- phoneNumber: PhoneNumber,
91
- logo: FileDetails,
92
- receipt: FileDetails,
93
- _claims: z4.string()
94
- });
95
- var CompanyRegistrationClaims = z4.object({
96
- sender: UserModel,
97
- pricingRate: PricingRate.shape.companyRegistration,
98
- ...TimeLog.shape
99
- });
100
84
  var CompanyUser = z4.object({
101
85
  ...UserModel.shape,
102
86
  uid: UuidV7,
@@ -133,7 +117,7 @@ var CompanyUser = z4.object({
133
117
  );
134
118
  }
135
119
  });
136
- var IdentityDetails = z4.object({
120
+ var Identity = z4.object({
137
121
  displayName: z4.string().min(3).max(20),
138
122
  logo: z4.string().max(2500).nullish(),
139
123
  contact: z4.object({
@@ -149,7 +133,7 @@ var IdentityDetails = z4.object({
149
133
  }),
150
134
  lastModified: Timestamp.nullable()
151
135
  });
152
- var StateDetails = z4.object({
136
+ var CompanyState = z4.object({
153
137
  // This can only be changed by the server/app admin
154
138
  availableBalance: z4.number(),
155
139
  /**
@@ -165,7 +149,7 @@ var StateDetails = z4.object({
165
149
  tktNoCounter: z4.int().min(1),
166
150
  lastModified: Timestamp.nullable()
167
151
  });
168
- var PreferenceDetails = z4.object({
152
+ var CompanyPreferences = z4.object({
169
153
  /** The amount of user provisions made for this company */
170
154
  userProvisions: z4.number().max(150, { error: "The total user provisions can't exceed 150" }).refine(
171
155
  (p) => !(p > 1 && p < 10),
@@ -178,7 +162,7 @@ var PreferenceDetails = z4.object({
178
162
  apptDistAlg: appointmentDistAlgs.default("RR"),
179
163
  lastModified: Timestamp.nullable()
180
164
  });
181
- var BillingDetails = z4.object({
165
+ var Billing = z4.object({
182
166
  preferences: z4.object({
183
167
  /** Forces service selectors to use the list of service(s) that you've created. */
184
168
  useCreatedServices: z4.boolean(),
@@ -217,7 +201,7 @@ var BillingDetails = z4.object({
217
201
  ctx.addIssue("At least (1) service must be added to the services list.");
218
202
  }
219
203
  });
220
- var StaffDetails = z4.object({
204
+ var Staff = z4.object({
221
205
  members: z4.record(CompanyUser.shape.uid, CompanyUser).superRefine((data, ctx) => {
222
206
  const emails = [];
223
207
  for (const [uid, user] of Object.entries(data)) {
@@ -257,15 +241,15 @@ var StaffDetails = z4.object({
257
241
  const copy = structuredClone(d);
258
242
  for (const uid of Object.keys(copy.updateQueue)) {
259
243
  if (uid in copy.members) {
260
- const user = copy.updateQueue[uid];
261
- if ("$REMOVE" in user) {
262
- copy.updateQueue[uid] = { $REMOVE: user.$REMOVE };
263
- } else if (user.$CHANGE_ROLES && user.$CHANGE_ROLES.newRoles.length === copy.members[uid].roles.length && user.$CHANGE_ROLES.newRoles.every(
244
+ const userUpdates = copy.updateQueue[uid];
245
+ if ("$REMOVE" in userUpdates) {
246
+ copy.updateQueue[uid] = { $REMOVE: userUpdates.$REMOVE };
247
+ } else if (userUpdates.$CHANGE_ROLES && userUpdates.$CHANGE_ROLES.newRoles.length === copy.members[uid].roles.length && userUpdates.$CHANGE_ROLES.newRoles.every(
264
248
  (role) => copy.members[uid].roles.includes(role)
265
249
  )) {
266
250
  delete copy.updateQueue[uid].$CHANGE_ROLES;
267
251
  }
268
- if (Object.keys(user).length < 1) delete copy.updateQueue[uid];
252
+ if (Object.keys(userUpdates).length < 1) delete copy.updateQueue[uid];
269
253
  } else {
270
254
  delete copy.updateQueue[uid];
271
255
  }
@@ -302,14 +286,16 @@ var StaffDetails = z4.object({
302
286
  }
303
287
  }
304
288
  });
289
+ var Receipts = z4.array(PriceTag.omit({ uid: true, lastModified: true }));
305
290
  var createCompanyDetails = (options) => {
306
291
  return z4.object({
307
292
  uid: UuidV7,
308
- identity: IdentityDetails,
309
- state: options.partial ? StateDetails.nullish() : StateDetails,
310
- preferences: options.partial ? PreferenceDetails.nullish() : PreferenceDetails,
311
- billing: options.partial ? BillingDetails.nullish() : BillingDetails,
312
- staff: options.partial ? StaffDetails.nullish() : StaffDetails,
293
+ identity: Identity,
294
+ receipts: options.partial ? Receipts.nullish() : Receipts,
295
+ state: options.partial ? CompanyState.nullish() : CompanyState,
296
+ preferences: options.partial ? CompanyPreferences.nullish() : CompanyPreferences,
297
+ billing: options.partial ? Billing.nullish() : Billing,
298
+ staff: options.partial ? Staff.nullish() : Staff,
313
299
  createdAt: options.partial ? Timestamp.nullish() : Timestamp
314
300
  });
315
301
  };
@@ -348,14 +334,12 @@ var getCompatibleRoles = (role) => {
348
334
  };
349
335
  export {
350
336
  CompanyDetails,
351
- CompanyRegistrationClaims,
352
337
  CompanyUser,
353
338
  InvoiceNo,
354
339
  PartialCompanyDetails,
355
340
  PriceAdjustment,
356
341
  PriceTag,
357
342
  PricingRate,
358
- RegisterCompanyForm,
359
343
  StandardTime,
360
344
  TimeLog,
361
345
  Timestamp,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bizmap/sdk",
3
- "version": "0.0.39",
3
+ "version": "0.0.40",
4
4
  "main": "./dist/main.js",
5
5
  "types": "./dist/main.d.ts",
6
6
  "type": "module",