@bizmap/sdk 0.0.49 → 0.0.50

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 +50 -50
  2. package/dist/main.js +168 -168
  3. package/package.json +1 -1
package/dist/main.d.ts CHANGED
@@ -1,5 +1,49 @@
1
1
  import * as z from 'zod';
2
2
 
3
+ declare const companyUserRoles: z.ZodEnum<{
4
+ doc: "doc";
5
+ physAsst: "physAsst";
6
+ rcpst: "rcpst";
7
+ cshr: "cshr";
8
+ admin: "admin";
9
+ }>;
10
+ type CompanyUserRole = z.infer<typeof companyUserRoles>;
11
+ declare const companyPartnerRoles: z.ZodEnum<{
12
+ doc: "doc";
13
+ physAsst: "physAsst";
14
+ }>;
15
+ type CompanyPartnerRole = z.infer<typeof companyPartnerRoles>;
16
+ declare const employeeRoles: z.ZodEnum<{
17
+ doc: "doc";
18
+ physAsst: "physAsst";
19
+ rcpst: "rcpst";
20
+ cshr: "cshr";
21
+ }>;
22
+ type EmployeeRole = z.infer<typeof employeeRoles>;
23
+ declare const healthcareProviderRoles: z.ZodEnum<{
24
+ doc: "doc";
25
+ physAsst: "physAsst";
26
+ }>;
27
+ type HealthcareProviderRole = z.infer<typeof healthcareProviderRoles>;
28
+ declare const appointmentDistAlgs: z.ZodEnum<{
29
+ RR: "RR";
30
+ LOR: "LOR";
31
+ }>;
32
+ type AppointmentDistAlg = z.infer<typeof appointmentDistAlgs>;
33
+ declare const companyServiceSelectors: z.ZodEnum<{
34
+ scheduler: "scheduler";
35
+ doctor: "doctor";
36
+ }>;
37
+ type CompanyServiceSelector = z.infer<typeof companyServiceSelectors>;
38
+
39
+ declare const tiers: z.ZodEnum<{
40
+ free: "free";
41
+ pro: "pro";
42
+ premium: "premium";
43
+ gold: "gold";
44
+ }>;
45
+ type Tier = z.infer<typeof tiers>;
46
+
3
47
  declare const PricingRate: z.ZodObject<{
4
48
  companyRegistration: z.ZodObject<{
5
49
  flatFee: z.ZodNumber;
@@ -73,7 +117,7 @@ declare const CompanyDetails: z.ZodObject<{
73
117
  country: z.ZodString;
74
118
  }, z.core.$strip>;
75
119
  tier: z.ZodObject<{
76
- value: z.ZodEnum<{
120
+ current: z.ZodEnum<{
77
121
  free: "free";
78
122
  pro: "pro";
79
123
  premium: "premium";
@@ -120,7 +164,7 @@ declare const CompanyDetails: z.ZodObject<{
120
164
  }, z.core.$strip>>>>;
121
165
  state: z.ZodObject<{
122
166
  availableBalance: z.ZodObject<{
123
- value: z.ZodNumber;
167
+ current: z.ZodNumber;
124
168
  lastModified: z.ZodNullable<z.ZodInt>;
125
169
  }, z.core.$strip>;
126
170
  invoiceNoCounter: z.ZodInt;
@@ -129,7 +173,7 @@ declare const CompanyDetails: z.ZodObject<{
129
173
  lastModified: z.ZodNullable<z.ZodInt>;
130
174
  }, z.core.$strip> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
131
175
  availableBalance: z.ZodObject<{
132
- value: z.ZodNumber;
176
+ current: z.ZodNumber;
133
177
  lastModified: z.ZodNullable<z.ZodInt>;
134
178
  }, z.core.$strip>;
135
179
  invoiceNoCounter: z.ZodInt;
@@ -461,7 +505,7 @@ declare const PartialCompanyDetails: z.ZodObject<{
461
505
  country: z.ZodString;
462
506
  }, z.core.$strip>;
463
507
  tier: z.ZodObject<{
464
- value: z.ZodEnum<{
508
+ current: z.ZodEnum<{
465
509
  free: "free";
466
510
  pro: "pro";
467
511
  premium: "premium";
@@ -508,7 +552,7 @@ declare const PartialCompanyDetails: z.ZodObject<{
508
552
  }, z.core.$strip>>>>;
509
553
  state: z.ZodObject<{
510
554
  availableBalance: z.ZodObject<{
511
- value: z.ZodNumber;
555
+ current: z.ZodNumber;
512
556
  lastModified: z.ZodNullable<z.ZodInt>;
513
557
  }, z.core.$strip>;
514
558
  invoiceNoCounter: z.ZodInt;
@@ -517,7 +561,7 @@ declare const PartialCompanyDetails: z.ZodObject<{
517
561
  lastModified: z.ZodNullable<z.ZodInt>;
518
562
  }, z.core.$strip> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
519
563
  availableBalance: z.ZodObject<{
520
- value: z.ZodNumber;
564
+ current: z.ZodNumber;
521
565
  lastModified: z.ZodNullable<z.ZodInt>;
522
566
  }, z.core.$strip>;
523
567
  invoiceNoCounter: z.ZodInt;
@@ -874,50 +918,6 @@ declare const TimeLog: z.ZodObject<{
874
918
  }, z.core.$strip>;
875
919
  type TimeLog = z.infer<typeof TimeLog>;
876
920
 
877
- declare const companyUserRoles: z.ZodEnum<{
878
- doc: "doc";
879
- physAsst: "physAsst";
880
- rcpst: "rcpst";
881
- cshr: "cshr";
882
- admin: "admin";
883
- }>;
884
- type CompanyUserRole = z.infer<typeof companyUserRoles>;
885
- declare const companyPartnerRoles: z.ZodEnum<{
886
- doc: "doc";
887
- physAsst: "physAsst";
888
- }>;
889
- type CompanyPartnerRole = z.infer<typeof companyPartnerRoles>;
890
- declare const employeeRoles: z.ZodEnum<{
891
- doc: "doc";
892
- physAsst: "physAsst";
893
- rcpst: "rcpst";
894
- cshr: "cshr";
895
- }>;
896
- type EmployeeRole = z.infer<typeof employeeRoles>;
897
- declare const healthcareProviderRoles: z.ZodEnum<{
898
- doc: "doc";
899
- physAsst: "physAsst";
900
- }>;
901
- type HealthcareProviderRole = z.infer<typeof healthcareProviderRoles>;
902
- declare const appointmentDistAlgs: z.ZodEnum<{
903
- RR: "RR";
904
- LOR: "LOR";
905
- }>;
906
- type AppointmentDistAlg = z.infer<typeof appointmentDistAlgs>;
907
- declare const companyServiceSelectors: z.ZodEnum<{
908
- scheduler: "scheduler";
909
- doctor: "doctor";
910
- }>;
911
- type CompanyServiceSelector = z.infer<typeof companyServiceSelectors>;
912
-
913
- declare const tiers: z.ZodEnum<{
914
- free: "free";
915
- pro: "pro";
916
- premium: "premium";
917
- gold: "gold";
918
- }>;
919
- type Tier = z.infer<typeof tiers>;
920
-
921
921
  /**@returns an array of the users that have conflicting roles or are incompatible with the other partners, or null if none was found. */
922
922
  declare const findConflictingPartners: (...partners: CompanyUser[]) => {
923
923
  createdAt: number;
package/dist/main.js CHANGED
@@ -1,96 +1,178 @@
1
- // src/schemas/Billing.ts
1
+ // src/enums/CompanyEnums.ts
2
+ import * as z from "zod";
3
+ var companyUserRoles = z.enum([
4
+ "doc",
5
+ "physAsst",
6
+ "rcpst",
7
+ "cshr",
8
+ "admin"
9
+ ]);
10
+ var companyPartnerRoles = companyUserRoles.extract([
11
+ "doc",
12
+ "physAsst"
13
+ ]);
14
+ var employeeRoles = companyUserRoles.exclude(["admin"]);
15
+ var healthcareProviderRoles = companyUserRoles.extract([
16
+ "physAsst",
17
+ "doc"
18
+ ]);
19
+ var appointmentDistAlgs = z.enum(["RR", "LOR"]);
20
+ var companyServiceSelectors = z.enum(["scheduler", "doctor"]);
21
+
22
+ // src/enums/Global.ts
2
23
  import * as z2 from "zod";
24
+ var tiers = z2.enum(["free", "pro", "premium", "gold"]);
25
+
26
+ // src/schemas/Billing.ts
27
+ import * as z4 from "zod";
3
28
 
4
29
  // src/schemas/utils.ts
5
30
  import { validate, version } from "uuid";
6
- import * as z from "zod";
7
- var InvoiceNo = z.string().regex(
31
+ import * as z3 from "zod";
32
+ var InvoiceNo = z3.string().regex(
8
33
  /^[0-9]{4}-(01|(0[2-9])|(1[0-2]))-(30|31|([1-2][0-9])|0[1-9])-[0-9]{7}/,
9
34
  'An invoice no. must match the pattern "yyyy-mm-dd-9999999".'
10
35
  );
11
- var UuidV4 = z.string().readonly().refine(
36
+ var UuidV4 = z3.string().readonly().refine(
12
37
  (uid) => validate(uid) && version(uid) === 4,
13
38
  "Expected a v4 uuid but received an invalid uuid."
14
39
  );
15
- var UuidV7 = z.string().readonly().refine(
40
+ var UuidV7 = z3.string().readonly().refine(
16
41
  (uid) => validate(uid) && version(uid) === 7,
17
42
  "Expected a v7 uuid but received an invalid uuid."
18
43
  );
19
- var Jwt = z.string().regex(
44
+ var Jwt = z3.string().regex(
20
45
  /^[A-Za-z0-9_-]{2,}(?:\.[A-Za-z0-9_-]{2,}){2}$/,
21
46
  "An invalid jwt token was used."
22
47
  );
23
- var StandardTime = z.string().regex(
48
+ var StandardTime = z3.string().regex(
24
49
  /^(01|(0[2-9])|(1[0-2])):(([1-5][0-9])|0[0-9]) (am|pm)/i,
25
50
  "A standard time must match the pattern hh:mm A."
26
51
  );
27
- var Timestamp = z.int().refine(
52
+ var Timestamp = z3.int().refine(
28
53
  (t) => t.toString().length === 13,
29
54
  "A timestamp must have (13) digits."
30
55
  ).positive();
31
- var InviteResponse = z.enum(["accepted", "declined"]);
32
- var TimeLog = z.object({
56
+ var InviteResponse = z3.enum(["accepted", "declined"]);
57
+ var TimeLog = z3.object({
33
58
  createdAt: Timestamp.readonly(),
34
59
  lastModified: Timestamp.nullish()
35
60
  });
36
61
 
37
62
  // src/schemas/Billing.ts
38
- var PricingRate = z2.object({
39
- companyRegistration: z2.object({
40
- flatFee: z2.number().min(0),
41
- feePerUser: z2.number().min(0),
63
+ var PricingRate = z4.object({
64
+ companyRegistration: z4.object({
65
+ flatFee: z4.number().min(0),
66
+ feePerUser: z4.number().min(0),
42
67
  lastModified: Timestamp
43
68
  })
44
69
  });
45
- var PriceAdjustment = z2.object({
46
- description: z2.string().trim().min(3, "A description must have atleast (3) characters.").max(25, "A description can't have more that (25) characters.").optional(),
47
- fixedAmount: z2.number().min(0).max(1e6, "The max fixed amount is $1,000,000.00"),
48
- percentage: z2.number().min(0).max(1e3, "The max percentage is 1,000%"),
70
+ var PriceAdjustment = z4.object({
71
+ description: z4.string().trim().min(3, "A description must have atleast (3) characters.").max(25, "A description can't have more that (25) characters.").optional(),
72
+ fixedAmount: z4.number().min(0).max(1e6, "The max fixed amount is $1,000,000.00"),
73
+ percentage: z4.number().min(0).max(1e3, "The max percentage is 1,000%"),
49
74
  ...TimeLog.shape
50
75
  });
51
- var PriceTag = z2.object({
76
+ var PriceTag = z4.object({
52
77
  uid: UuidV4,
53
78
  /**The name of the item that's being priced */
54
- item: z2.string().trim().min(3, "The price item must be atleast (3) characters long.").max(50, "The price item can't be more than (50) characters long."),
55
- cost: z2.number().min(1, "The minimum allowed cost is $1.00").max(1e9, "The max allowed cost is $1,000,000,000.00."),
79
+ item: z4.string().trim().min(3, "The price item must be atleast (3) characters long.").max(50, "The price item can't be more than (50) characters long."),
80
+ cost: z4.number().min(1, "The minimum allowed cost is $1.00").max(1e9, "The max allowed cost is $1,000,000,000.00."),
56
81
  ...TimeLog.shape
57
82
  });
58
83
 
59
84
  // src/schemas/Company.ts
60
85
  import { Address, PhoneNumber, UserModel } from "@wavy/util";
61
- import * as z4 from "zod";
86
+ import * as z6 from "zod";
62
87
 
63
- // src/enums/CompanyEnums.ts
64
- import * as z3 from "zod";
65
- var companyUserRoles = z3.enum([
66
- "doc",
67
- "physAsst",
68
- "rcpst",
69
- "cshr",
70
- "admin"
71
- ]);
72
- var companyPartnerRoles = companyUserRoles.extract([
73
- "doc",
74
- "physAsst"
75
- ]);
76
- var employeeRoles = companyUserRoles.exclude(["admin"]);
77
- var healthcareProviderRoles = companyUserRoles.extract([
78
- "physAsst",
79
- "doc"
80
- ]);
81
- var appointmentDistAlgs = z3.enum(["RR", "LOR"]);
82
- var companyServiceSelectors = z3.enum(["scheduler", "doctor"]);
88
+ // src/schemas/Global.ts
89
+ import * as z5 from "zod";
90
+ var TierList = z5.record(
91
+ tiers,
92
+ z5.object({
93
+ cost: z5.number().min(0),
94
+ perks: z5.array(z5.string()).min(1)
95
+ })
96
+ ).superRefine((data, ctx) => {
97
+ if (data.free.cost !== 0) {
98
+ ctx.addIssue("The free tier must always cost $0.00");
99
+ }
100
+ });
101
+ var Notification = z5.object({
102
+ code: z5.literal(["COMPANY_INVITE", "INVITE_RESPONSE", "DEV_MESSAGE"]),
103
+ payload: z5.string(),
104
+ seen: z5.boolean(),
105
+ src: z5.object({
106
+ name: z5.string(),
107
+ photoUrl: z5.string().nullish()
108
+ }),
109
+ expiresAt: Timestamp.nullish(),
110
+ createdAt: Timestamp
111
+ }).superRefine((data, ctx) => {
112
+ switch (data.code) {
113
+ case "COMPANY_INVITE":
114
+ if (!Jwt.safeParse(data.payload).success) {
115
+ ctx.addIssue("The payload of company invite must be a valid jwt.");
116
+ }
117
+ break;
118
+ case "DEV_MESSAGE":
119
+ if ((data.payload?.length ?? 0) < 3) {
120
+ ctx.addIssue("A dev message must have at least (3) characters.");
121
+ }
122
+ break;
123
+ case "INVITE_RESPONSE":
124
+ if (!InviteResponse.safeParse(data.payload).success) {
125
+ ctx.addIssue(
126
+ `An invite response must be one of the following: ${InviteResponse.options.join()}.`
127
+ );
128
+ }
129
+ break;
130
+ default:
131
+ return data.code;
132
+ }
133
+ });
134
+
135
+ // src/functions/helper-functions.ts
136
+ var findConflictingPartners = (...partners) => {
137
+ let hasSingleDoctor = false;
138
+ const conflicts = [];
139
+ if (!partners) return partners;
140
+ for (const partner of partners) {
141
+ if (!partner.roles || partner.roles.some(
142
+ (r) => !companyPartnerRoles.options.includes(r)
143
+ ) || !CompanyUser.shape.roles.safeParse(partner.roles).success) {
144
+ conflicts.push(partner);
145
+ continue;
146
+ }
147
+ if (partner.roles.includes("doc") && !hasSingleDoctor) {
148
+ hasSingleDoctor = true;
149
+ } else if (partner.roles.includes("doc")) {
150
+ conflicts.push(partner);
151
+ continue;
152
+ }
153
+ }
154
+ return conflicts.length === 0 ? null : conflicts;
155
+ };
156
+ var getCompatibleRoles = (role) => {
157
+ if (role === "physAsst") {
158
+ return companyUserRoles.exclude(["admin", "doc", role]).options;
159
+ }
160
+ if (role === "admin" || role === "doc") {
161
+ return companyUserRoles.exclude(["physAsst", role]).options;
162
+ }
163
+ return companyUserRoles.exclude([role]).options;
164
+ };
83
165
 
84
166
  // src/schemas/Company.ts
85
- var CompanyUser = z4.object({
167
+ var CompanyUser = z6.object({
86
168
  ...UserModel.shape,
87
169
  uid: UuidV7,
88
- status: z4.enum(["inviteSent", "active", "inactive"]),
89
- availability: z4.object({
90
- isAvailable: z4.boolean().default(true),
170
+ status: z6.enum(["inviteSent", "active", "inactive"]),
171
+ availability: z6.object({
172
+ isAvailable: z6.boolean().default(true),
91
173
  lastModified: Timestamp.nullable().default(null)
92
174
  }),
93
- roles: z4.array(companyUserRoles).transform((roles) => {
175
+ roles: z6.array(companyUserRoles).transform((roles) => {
94
176
  const newRoles = [];
95
177
  for (const role of roles) {
96
178
  if (!!role && !newRoles.includes(role)) newRoles.push(role);
@@ -101,11 +183,11 @@ var CompanyUser = z4.object({
101
183
  (role, i) => i === 0 || getCompatibleRoles(roles[0]).includes(role)
102
184
  );
103
185
  }, "A user is not allowed to have conflicting roles."),
104
- isBusy: z4.boolean(),
186
+ isBusy: z6.boolean(),
105
187
  /** This should reset at the end of every cycle. */
106
- appointmentCounter: z4.record(
107
- z4.literal(["ongoing", "completed"]),
108
- z4.int().min(0)
188
+ appointmentCounter: z6.record(
189
+ z6.literal(["ongoing", "completed"]),
190
+ z6.int().min(0)
109
191
  ),
110
192
  lastActive: Timestamp,
111
193
  ...TimeLog.shape
@@ -119,43 +201,43 @@ var CompanyUser = z4.object({
119
201
  );
120
202
  }
121
203
  });
122
- var CompanyIdentity = z4.object({
123
- displayName: z4.string().min(3).max(25),
124
- logo: z4.string().max(2500).nullish(),
125
- contact: z4.object({
126
- email: z4.email().max(25),
204
+ var CompanyIdentity = z6.object({
205
+ displayName: z6.string().min(3).max(25),
206
+ logo: z6.string().max(2500).nullish(),
207
+ contact: z6.object({
208
+ email: z6.email().max(25),
127
209
  phoneNumber: PhoneNumber.optional()
128
210
  }),
129
211
  address: Address,
130
212
  // Can only be changed by the server
131
- tier: z4.object({
132
- value: tiers,
213
+ tier: z6.object({
214
+ current: tiers,
133
215
  lastModified: Timestamp.nullable()
134
216
  }),
135
- legal: z4.object({
136
- regNo: z4.string().max(20).readonly(),
217
+ legal: z6.object({
218
+ regNo: z6.string().max(20).readonly(),
137
219
  // The company's registration number
138
- trn: z4.string().regex(/[0-9]{3}-[0-9]{3}-[0-9]{3}/).nullish(),
139
- gctRegNo: z4.string().max(15).nullish()
220
+ trn: z6.string().regex(/[0-9]{3}-[0-9]{3}-[0-9]{3}/).nullish(),
221
+ gctRegNo: z6.string().max(15).nullish()
140
222
  }),
141
223
  lastModified: Timestamp.nullable()
142
224
  });
143
- var CompanyState = z4.object({
225
+ var CompanyState = z6.object({
144
226
  // This can only be changed by the server/app admin
145
- availableBalance: z4.object({
146
- value: z4.number(),
227
+ availableBalance: z6.object({
228
+ current: z6.number(),
147
229
  lastModified: Timestamp.nullable()
148
230
  }),
149
231
  /** A counter for the company's invoice no.
150
232
  * @note This should only be null when the cycle resets
151
233
  */
152
- invoiceNoCounter: z4.int().min(1),
234
+ invoiceNoCounter: z6.int().min(1),
153
235
  /** A counter for the company's ticket no. */
154
- tktNoCounter: z4.int().min(1),
236
+ tktNoCounter: z6.int().min(1),
155
237
  lastSavedAt: Timestamp.nullable(),
156
238
  lastModified: Timestamp.nullable()
157
239
  });
158
- var CompanyPreferences = z4.object({
240
+ var CompanyPreferences = z6.object({
159
241
  /** The user that's allowed to record the client's services. */
160
242
  serviceSelector: companyServiceSelectors,
161
243
  /** A record of the payments made must be attached before creating the
@@ -163,7 +245,7 @@ var CompanyPreferences = z4.object({
163
245
  * @note
164
246
  * - only allowed when `serviceDecider === "scheduler"`
165
247
  * */
166
- enforcePaidAppts: z4.boolean(),
248
+ enforcePaidAppts: z6.boolean(),
167
249
  /**
168
250
  * @property RR (Round Robin): Even distribution.
169
251
  * @property LOR (Least Outstanding Requests): Distribute based on availability.
@@ -171,21 +253,21 @@ var CompanyPreferences = z4.object({
171
253
  apptDistAlg: appointmentDistAlgs.default("RR"),
172
254
  lastModified: Timestamp.nullable()
173
255
  });
174
- var Billing = z4.object({
175
- additionalFees: z4.array(PriceAdjustment).default([]),
176
- discounts: z4.array(PriceAdjustment).default([]),
177
- services: z4.object({
256
+ var Billing = z6.object({
257
+ additionalFees: z6.array(PriceAdjustment).default([]),
258
+ discounts: z6.array(PriceAdjustment).default([]),
259
+ services: z6.object({
178
260
  /** Forces service selectors to use the list of service(s) that you've created. */
179
- deployed: z4.boolean(),
180
- value: z4.array(PriceTag.omit({ uid: true })).max(100).default([])
261
+ deployed: z6.boolean(),
262
+ value: z6.array(PriceTag.omit({ uid: true })).max(100).default([])
181
263
  }).refine(
182
264
  (data) => !data.deployed || data.deployed && data.value.length > 0,
183
265
  "You must create at least (1) service in order to deploy your service list."
184
266
  ),
185
267
  lastModified: Timestamp.nullable()
186
268
  });
187
- var Staff = z4.object({
188
- members: z4.record(CompanyUser.shape.uid, CompanyUser).superRefine((data, ctx) => {
269
+ var Staff = z6.object({
270
+ members: z6.record(CompanyUser.shape.uid, CompanyUser).superRefine((data, ctx) => {
189
271
  const emails = [];
190
272
  for (const [uid, user] of Object.entries(data)) {
191
273
  if (uid !== user.uid) {
@@ -205,15 +287,15 @@ var Staff = z4.object({
205
287
  /**
206
288
  * @relationship one -> many
207
289
  *@description A map of doctor `uids` to their assistants `uids` */
208
- partnerMap: z4.record(
290
+ partnerMap: z6.record(
209
291
  CompanyUser.shape.uid,
210
- z4.record(CompanyUser.shape.uid, z4.object({ addedAt: Timestamp }))
292
+ z6.record(CompanyUser.shape.uid, z6.object({ addedAt: Timestamp }))
211
293
  ),
212
- updateQueue: z4.record(
294
+ updateQueue: z6.record(
213
295
  CompanyUser.shape.uid,
214
- z4.object({
215
- $REMOVE: z4.object({ addedAt: Timestamp }),
216
- $CHANGE_ROLES: z4.object({
296
+ z6.object({
297
+ $REMOVE: z6.object({ addedAt: Timestamp }),
298
+ $CHANGE_ROLES: z6.object({
217
299
  newRoles: CompanyUser.shape.roles,
218
300
  addedAt: Timestamp
219
301
  })
@@ -274,12 +356,12 @@ var Staff = z4.object({
274
356
  }
275
357
  }
276
358
  });
277
- var Receipts = z4.array(PriceTag.omit({ uid: true, lastModified: true }));
359
+ var Receipts = z6.array(PriceTag.omit({ uid: true, lastModified: true }));
278
360
  var createCompanyDetails = (options) => {
279
- return z4.object({
361
+ return z6.object({
280
362
  uid: UuidV7,
281
363
  identity: CompanyIdentity,
282
- notifications: options.partial ? z4.array(Notification).nullish() : z4.array(Notification),
364
+ notifications: options.partial ? z6.array(Notification).nullish() : z6.array(Notification),
283
365
  receipts: options.partial ? Receipts.nullish() : Receipts,
284
366
  state: options.partial ? CompanyState.nullish() : CompanyState,
285
367
  preferences: options.partial ? CompanyPreferences.nullish() : CompanyPreferences,
@@ -290,88 +372,6 @@ var createCompanyDetails = (options) => {
290
372
  };
291
373
  var CompanyDetails = createCompanyDetails({ partial: false });
292
374
  var PartialCompanyDetails = createCompanyDetails({ partial: true });
293
-
294
- // src/schemas/Global.ts
295
- import * as z5 from "zod";
296
- var TierList = z5.record(
297
- tiers,
298
- z5.object({
299
- cost: z5.number().min(0),
300
- perks: z5.array(z5.string()).min(1)
301
- })
302
- ).superRefine((data, ctx) => {
303
- if (data.free.cost !== 0) {
304
- ctx.addIssue("The free tier must always cost $0.00");
305
- }
306
- });
307
- var Notification = z5.object({
308
- code: z5.literal(["COMPANY_INVITE", "INVITE_RESPONSE", "DEV_MESSAGE"]),
309
- payload: z5.string(),
310
- seen: z5.boolean(),
311
- src: z5.object({
312
- name: z5.string(),
313
- photoUrl: z5.string().nullish()
314
- }),
315
- expiresAt: Timestamp.nullish(),
316
- createdAt: Timestamp
317
- }).superRefine((data, ctx) => {
318
- switch (data.code) {
319
- case "COMPANY_INVITE":
320
- if (!Jwt.safeParse(data.payload).success) {
321
- ctx.addIssue("The payload of company invite must be a valid jwt.");
322
- }
323
- break;
324
- case "DEV_MESSAGE":
325
- if ((data.payload?.length ?? 0) < 3) {
326
- ctx.addIssue("A dev message must have at least (3) characters.");
327
- }
328
- break;
329
- case "INVITE_RESPONSE":
330
- if (!InviteResponse.safeParse(data.payload).success) {
331
- ctx.addIssue(
332
- `An invite response must be one of the following: ${InviteResponse.options.join()}.`
333
- );
334
- }
335
- break;
336
- default:
337
- return data.code;
338
- }
339
- });
340
-
341
- // src/enums/Global.ts
342
- import * as z6 from "zod";
343
- var tiers = z6.enum(["free", "pro", "premium", "gold"]);
344
-
345
- // src/functions/helper-functions.ts
346
- var findConflictingPartners = (...partners) => {
347
- let hasSingleDoctor = false;
348
- const conflicts = [];
349
- if (!partners) return partners;
350
- for (const partner of partners) {
351
- if (!partner.roles || partner.roles.some(
352
- (r) => !companyPartnerRoles.options.includes(r)
353
- ) || !CompanyUser.shape.roles.safeParse(partner.roles).success) {
354
- conflicts.push(partner);
355
- continue;
356
- }
357
- if (partner.roles.includes("doc") && !hasSingleDoctor) {
358
- hasSingleDoctor = true;
359
- } else if (partner.roles.includes("doc")) {
360
- conflicts.push(partner);
361
- continue;
362
- }
363
- }
364
- return conflicts.length === 0 ? null : conflicts;
365
- };
366
- var getCompatibleRoles = (role) => {
367
- if (role === "physAsst") {
368
- return companyUserRoles.exclude(["admin", "doc", role]).options;
369
- }
370
- if (role === "admin" || role === "doc") {
371
- return companyUserRoles.exclude(["physAsst", role]).options;
372
- }
373
- return companyUserRoles.exclude([role]).options;
374
- };
375
375
  export {
376
376
  CompanyDetails,
377
377
  CompanyUser,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bizmap/sdk",
3
- "version": "0.0.49",
3
+ "version": "0.0.50",
4
4
  "main": "./dist/main.js",
5
5
  "types": "./dist/main.d.ts",
6
6
  "type": "module",