@bizmap/sdk 0.0.42 → 0.0.44

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 +139 -81
  2. package/dist/main.js +84 -53
  3. package/package.json +1 -1
package/dist/main.d.ts CHANGED
@@ -79,6 +79,27 @@ declare const CompanyDetails: z.ZodObject<{
79
79
  }, z.core.$strip>;
80
80
  lastModified: z.ZodNullable<z.ZodInt>;
81
81
  }, z.core.$strip>;
82
+ notifications: z.ZodArray<z.ZodObject<{
83
+ code: z.ZodLiteral<"COMPANY_INVITE" | "INVITE_RESPONSE" | "DEV_MESSAGE">;
84
+ payload: z.ZodString;
85
+ seen: z.ZodBoolean;
86
+ src: z.ZodObject<{
87
+ name: z.ZodString;
88
+ photoUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
89
+ }, z.core.$strip>;
90
+ expiresAt: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
91
+ createdAt: z.ZodInt;
92
+ }, z.core.$strip>> | z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
93
+ code: z.ZodLiteral<"COMPANY_INVITE" | "INVITE_RESPONSE" | "DEV_MESSAGE">;
94
+ payload: z.ZodString;
95
+ seen: z.ZodBoolean;
96
+ src: z.ZodObject<{
97
+ name: z.ZodString;
98
+ photoUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
99
+ }, z.core.$strip>;
100
+ expiresAt: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
101
+ createdAt: z.ZodInt;
102
+ }, z.core.$strip>>>>;
82
103
  receipts: z.ZodArray<z.ZodObject<{
83
104
  createdAt: z.ZodReadonly<z.ZodInt>;
84
105
  item: z.ZodString;
@@ -89,29 +110,61 @@ declare const CompanyDetails: z.ZodObject<{
89
110
  cost: z.ZodNumber;
90
111
  }, z.core.$strip>>>>;
91
112
  state: z.ZodObject<{
92
- availableBalance: z.ZodNumber;
93
- totalUploads: z.ZodNumber;
113
+ availableBalance: z.ZodObject<{
114
+ value: z.ZodNumber;
115
+ lastModified: z.ZodNullable<z.ZodInt>;
116
+ }, z.core.$strip>;
94
117
  invoiceNoCounter: z.ZodInt;
95
118
  tktNoCounter: z.ZodInt;
96
- tierName: z.ZodString;
119
+ tier: z.ZodObject<{
120
+ value: z.ZodDefault<z.ZodEnum<{
121
+ free: "free";
122
+ pro: "pro";
123
+ premium: "premium";
124
+ gold: "gold";
125
+ }>>;
126
+ lastModified: z.ZodNullable<z.ZodInt>;
127
+ }, z.core.$strip>;
128
+ lastSavedAt: z.ZodNullable<z.ZodInt>;
97
129
  lastModified: z.ZodNullable<z.ZodInt>;
98
130
  }, z.core.$strip> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
99
- availableBalance: z.ZodNumber;
100
- totalUploads: z.ZodNumber;
131
+ availableBalance: z.ZodObject<{
132
+ value: z.ZodNumber;
133
+ lastModified: z.ZodNullable<z.ZodInt>;
134
+ }, z.core.$strip>;
101
135
  invoiceNoCounter: z.ZodInt;
102
136
  tktNoCounter: z.ZodInt;
103
- tierName: z.ZodString;
137
+ tier: z.ZodObject<{
138
+ value: z.ZodDefault<z.ZodEnum<{
139
+ free: "free";
140
+ pro: "pro";
141
+ premium: "premium";
142
+ gold: "gold";
143
+ }>>;
144
+ lastModified: z.ZodNullable<z.ZodInt>;
145
+ }, z.core.$strip>;
146
+ lastSavedAt: z.ZodNullable<z.ZodInt>;
104
147
  lastModified: z.ZodNullable<z.ZodInt>;
105
148
  }, z.core.$strip>>>;
106
149
  preferences: z.ZodObject<{
107
- userProvisions: z.ZodNumber;
150
+ useCreatedServices: z.ZodBoolean;
151
+ serviceSelector: z.ZodEnum<{
152
+ scheduler: "scheduler";
153
+ doctor: "doctor";
154
+ }>;
155
+ enforcePaidAppts: z.ZodBoolean;
108
156
  apptDistAlg: z.ZodDefault<z.ZodEnum<{
109
157
  RR: "RR";
110
158
  LOR: "LOR";
111
159
  }>>;
112
160
  lastModified: z.ZodNullable<z.ZodInt>;
113
161
  }, z.core.$strip> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
114
- userProvisions: z.ZodNumber;
162
+ useCreatedServices: z.ZodBoolean;
163
+ serviceSelector: z.ZodEnum<{
164
+ scheduler: "scheduler";
165
+ doctor: "doctor";
166
+ }>;
167
+ enforcePaidAppts: z.ZodBoolean;
115
168
  apptDistAlg: z.ZodDefault<z.ZodEnum<{
116
169
  RR: "RR";
117
170
  LOR: "LOR";
@@ -119,21 +172,6 @@ declare const CompanyDetails: z.ZodObject<{
119
172
  lastModified: z.ZodNullable<z.ZodInt>;
120
173
  }, z.core.$strip>>>;
121
174
  billing: z.ZodObject<{
122
- preferences: z.ZodObject<{
123
- useCreatedServices: z.ZodBoolean;
124
- serviceSelector: z.ZodEnum<{
125
- scheduler: "scheduler";
126
- doctor: "doctor";
127
- }>;
128
- enforcePaidAppts: z.ZodBoolean;
129
- primaryCurrency: z.ZodEnum<{
130
- JMD: "JMD";
131
- }>;
132
- acceptedCurrencies: z.ZodPipe<z.ZodArray<z.ZodEnum<{
133
- JMD: "JMD";
134
- }>>, z.ZodTransform<"JMD"[], "JMD"[]>>;
135
- lastModified: z.ZodNullable<z.ZodInt>;
136
- }, z.core.$strip>;
137
175
  additionalFees: z.ZodDefault<z.ZodArray<z.ZodObject<{
138
176
  createdAt: z.ZodReadonly<z.ZodInt>;
139
177
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
@@ -156,21 +194,6 @@ declare const CompanyDetails: z.ZodObject<{
156
194
  }, z.core.$strip>>>;
157
195
  lastModified: z.ZodNullable<z.ZodInt>;
158
196
  }, z.core.$strip> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
159
- preferences: z.ZodObject<{
160
- useCreatedServices: z.ZodBoolean;
161
- serviceSelector: z.ZodEnum<{
162
- scheduler: "scheduler";
163
- doctor: "doctor";
164
- }>;
165
- enforcePaidAppts: z.ZodBoolean;
166
- primaryCurrency: z.ZodEnum<{
167
- JMD: "JMD";
168
- }>;
169
- acceptedCurrencies: z.ZodPipe<z.ZodArray<z.ZodEnum<{
170
- JMD: "JMD";
171
- }>>, z.ZodTransform<"JMD"[], "JMD"[]>>;
172
- lastModified: z.ZodNullable<z.ZodInt>;
173
- }, z.core.$strip>;
174
197
  additionalFees: z.ZodDefault<z.ZodArray<z.ZodObject<{
175
198
  createdAt: z.ZodReadonly<z.ZodInt>;
176
199
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
@@ -449,6 +472,27 @@ declare const PartialCompanyDetails: z.ZodObject<{
449
472
  }, z.core.$strip>;
450
473
  lastModified: z.ZodNullable<z.ZodInt>;
451
474
  }, z.core.$strip>;
475
+ notifications: z.ZodArray<z.ZodObject<{
476
+ code: z.ZodLiteral<"COMPANY_INVITE" | "INVITE_RESPONSE" | "DEV_MESSAGE">;
477
+ payload: z.ZodString;
478
+ seen: z.ZodBoolean;
479
+ src: z.ZodObject<{
480
+ name: z.ZodString;
481
+ photoUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
482
+ }, z.core.$strip>;
483
+ expiresAt: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
484
+ createdAt: z.ZodInt;
485
+ }, z.core.$strip>> | z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
486
+ code: z.ZodLiteral<"COMPANY_INVITE" | "INVITE_RESPONSE" | "DEV_MESSAGE">;
487
+ payload: z.ZodString;
488
+ seen: z.ZodBoolean;
489
+ src: z.ZodObject<{
490
+ name: z.ZodString;
491
+ photoUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
492
+ }, z.core.$strip>;
493
+ expiresAt: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
494
+ createdAt: z.ZodInt;
495
+ }, z.core.$strip>>>>;
452
496
  receipts: z.ZodArray<z.ZodObject<{
453
497
  createdAt: z.ZodReadonly<z.ZodInt>;
454
498
  item: z.ZodString;
@@ -459,29 +503,61 @@ declare const PartialCompanyDetails: z.ZodObject<{
459
503
  cost: z.ZodNumber;
460
504
  }, z.core.$strip>>>>;
461
505
  state: z.ZodObject<{
462
- availableBalance: z.ZodNumber;
463
- totalUploads: z.ZodNumber;
506
+ availableBalance: z.ZodObject<{
507
+ value: z.ZodNumber;
508
+ lastModified: z.ZodNullable<z.ZodInt>;
509
+ }, z.core.$strip>;
464
510
  invoiceNoCounter: z.ZodInt;
465
511
  tktNoCounter: z.ZodInt;
466
- tierName: z.ZodString;
512
+ tier: z.ZodObject<{
513
+ value: z.ZodDefault<z.ZodEnum<{
514
+ free: "free";
515
+ pro: "pro";
516
+ premium: "premium";
517
+ gold: "gold";
518
+ }>>;
519
+ lastModified: z.ZodNullable<z.ZodInt>;
520
+ }, z.core.$strip>;
521
+ lastSavedAt: z.ZodNullable<z.ZodInt>;
467
522
  lastModified: z.ZodNullable<z.ZodInt>;
468
523
  }, z.core.$strip> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
469
- availableBalance: z.ZodNumber;
470
- totalUploads: z.ZodNumber;
524
+ availableBalance: z.ZodObject<{
525
+ value: z.ZodNumber;
526
+ lastModified: z.ZodNullable<z.ZodInt>;
527
+ }, z.core.$strip>;
471
528
  invoiceNoCounter: z.ZodInt;
472
529
  tktNoCounter: z.ZodInt;
473
- tierName: z.ZodString;
530
+ tier: z.ZodObject<{
531
+ value: z.ZodDefault<z.ZodEnum<{
532
+ free: "free";
533
+ pro: "pro";
534
+ premium: "premium";
535
+ gold: "gold";
536
+ }>>;
537
+ lastModified: z.ZodNullable<z.ZodInt>;
538
+ }, z.core.$strip>;
539
+ lastSavedAt: z.ZodNullable<z.ZodInt>;
474
540
  lastModified: z.ZodNullable<z.ZodInt>;
475
541
  }, z.core.$strip>>>;
476
542
  preferences: z.ZodObject<{
477
- userProvisions: z.ZodNumber;
543
+ useCreatedServices: z.ZodBoolean;
544
+ serviceSelector: z.ZodEnum<{
545
+ scheduler: "scheduler";
546
+ doctor: "doctor";
547
+ }>;
548
+ enforcePaidAppts: z.ZodBoolean;
478
549
  apptDistAlg: z.ZodDefault<z.ZodEnum<{
479
550
  RR: "RR";
480
551
  LOR: "LOR";
481
552
  }>>;
482
553
  lastModified: z.ZodNullable<z.ZodInt>;
483
554
  }, z.core.$strip> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
484
- userProvisions: z.ZodNumber;
555
+ useCreatedServices: z.ZodBoolean;
556
+ serviceSelector: z.ZodEnum<{
557
+ scheduler: "scheduler";
558
+ doctor: "doctor";
559
+ }>;
560
+ enforcePaidAppts: z.ZodBoolean;
485
561
  apptDistAlg: z.ZodDefault<z.ZodEnum<{
486
562
  RR: "RR";
487
563
  LOR: "LOR";
@@ -489,21 +565,6 @@ declare const PartialCompanyDetails: z.ZodObject<{
489
565
  lastModified: z.ZodNullable<z.ZodInt>;
490
566
  }, z.core.$strip>>>;
491
567
  billing: z.ZodObject<{
492
- preferences: z.ZodObject<{
493
- useCreatedServices: z.ZodBoolean;
494
- serviceSelector: z.ZodEnum<{
495
- scheduler: "scheduler";
496
- doctor: "doctor";
497
- }>;
498
- enforcePaidAppts: z.ZodBoolean;
499
- primaryCurrency: z.ZodEnum<{
500
- JMD: "JMD";
501
- }>;
502
- acceptedCurrencies: z.ZodPipe<z.ZodArray<z.ZodEnum<{
503
- JMD: "JMD";
504
- }>>, z.ZodTransform<"JMD"[], "JMD"[]>>;
505
- lastModified: z.ZodNullable<z.ZodInt>;
506
- }, z.core.$strip>;
507
568
  additionalFees: z.ZodDefault<z.ZodArray<z.ZodObject<{
508
569
  createdAt: z.ZodReadonly<z.ZodInt>;
509
570
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
@@ -526,21 +587,6 @@ declare const PartialCompanyDetails: z.ZodObject<{
526
587
  }, z.core.$strip>>>;
527
588
  lastModified: z.ZodNullable<z.ZodInt>;
528
589
  }, z.core.$strip> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
529
- preferences: z.ZodObject<{
530
- useCreatedServices: z.ZodBoolean;
531
- serviceSelector: z.ZodEnum<{
532
- scheduler: "scheduler";
533
- doctor: "doctor";
534
- }>;
535
- enforcePaidAppts: z.ZodBoolean;
536
- primaryCurrency: z.ZodEnum<{
537
- JMD: "JMD";
538
- }>;
539
- acceptedCurrencies: z.ZodPipe<z.ZodArray<z.ZodEnum<{
540
- JMD: "JMD";
541
- }>>, z.ZodTransform<"JMD"[], "JMD"[]>>;
542
- lastModified: z.ZodNullable<z.ZodInt>;
543
- }, z.core.$strip>;
544
590
  additionalFees: z.ZodDefault<z.ZodArray<z.ZodObject<{
545
591
  createdAt: z.ZodReadonly<z.ZodInt>;
546
592
  lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
@@ -798,12 +844,16 @@ declare const PartialCompanyDetails: z.ZodObject<{
798
844
  }, z.core.$strip>;
799
845
  type PartialCompanyDetails = z.infer<typeof PartialCompanyDetails>;
800
846
 
801
- declare const Tier: z.ZodObject<{
802
- name: z.ZodLiteral<"free" | "pro" | "premium" | "gold">;
847
+ declare const TierList: z.ZodRecord<z.ZodEnum<{
848
+ free: "free";
849
+ pro: "pro";
850
+ premium: "premium";
851
+ gold: "gold";
852
+ }>, z.ZodObject<{
803
853
  cost: z.ZodNumber;
804
854
  perks: z.ZodArray<z.ZodString>;
805
- }, z.core.$strip>;
806
- type Tier = z.infer<typeof Tier>;
855
+ }, z.core.$strip>>;
856
+ type TierList = z.infer<typeof TierList>;
807
857
  declare const Notification: z.ZodObject<{
808
858
  code: z.ZodLiteral<"COMPANY_INVITE" | "INVITE_RESPONSE" | "DEV_MESSAGE">;
809
859
  payload: z.ZodString;
@@ -870,6 +920,14 @@ declare const companyServiceSelectors: z.ZodEnum<{
870
920
  }>;
871
921
  type CompanyServiceSelector = z.infer<typeof companyServiceSelectors>;
872
922
 
923
+ declare const tiers: z.ZodEnum<{
924
+ free: "free";
925
+ pro: "pro";
926
+ premium: "premium";
927
+ gold: "gold";
928
+ }>;
929
+ type Tier = z.infer<typeof tiers>;
930
+
873
931
  /**@returns an array of the users that have conflicting roles or are incompatible with the other partners, or null if none was found. */
874
932
  declare const findConflictingPartners: (...partners: CompanyUser[]) => {
875
933
  createdAt: number;
@@ -892,4 +950,4 @@ declare const findConflictingPartners: (...partners: CompanyUser[]) => {
892
950
  /**@returns the roles that are compatible with the selected role. */
893
951
  declare const getCompatibleRoles: (role: CompanyUserRole) => CompanyUserRole[];
894
952
 
895
- export { type AppointmentDistAlg, CompanyDetails, type CompanyPartnerRole, type CompanyServiceSelector, CompanyUser, type CompanyUserRole, type EmployeeRole, type HealthcareProviderRole, InviteResponse, InvoiceNo, Jwt, Notification, PartialCompanyDetails, PriceAdjustment, PriceTag, PricingRate, StandardTime, Tier, TimeLog, Timestamp, UuidV4, UuidV7, appointmentDistAlgs, companyPartnerRoles, companyServiceSelectors, companyUserRoles, employeeRoles, findConflictingPartners, getCompatibleRoles, healthcareProviderRoles };
953
+ export { type AppointmentDistAlg, CompanyDetails, type CompanyPartnerRole, type CompanyServiceSelector, CompanyUser, type CompanyUserRole, type EmployeeRole, type HealthcareProviderRole, InviteResponse, InvoiceNo, Jwt, Notification, PartialCompanyDetails, PriceAdjustment, PriceTag, PricingRate, StandardTime, type Tier, TierList, TimeLog, Timestamp, UuidV4, UuidV7, appointmentDistAlgs, companyPartnerRoles, companyServiceSelectors, companyUserRoles, employeeRoles, findConflictingPartners, getCompatibleRoles, healthcareProviderRoles, tiers };
package/dist/main.js CHANGED
@@ -59,7 +59,6 @@ var PriceTag = z2.object({
59
59
  // src/schemas/Company.ts
60
60
  import {
61
61
  Address,
62
- currencies,
63
62
  PhoneNumber,
64
63
  UserModel
65
64
  } from "@wavy/util";
@@ -142,27 +141,43 @@ var CompanyIdentity = z4.object({
142
141
  });
143
142
  var CompanyState = z4.object({
144
143
  // This can only be changed by the server/app admin
145
- availableBalance: z4.number(),
146
- /**
147
- * The total amount of uploads made by an admin.
148
- * @note - This should be refreshed daily.
149
- */
150
- totalUploads: z4.number(),
144
+ availableBalance: z4.object({
145
+ value: z4.number(),
146
+ lastModified: Timestamp.nullable()
147
+ }),
151
148
  /** A counter for the company's invoice no.
152
149
  * @note This should only be null when the cycle resets
153
150
  */
154
151
  invoiceNoCounter: z4.int().min(1),
155
152
  /** A counter for the company's ticket no. */
156
153
  tktNoCounter: z4.int().min(1),
157
- tierName: z4.string(),
154
+ tier: z4.object({
155
+ value: tiers.default("free"),
156
+ lastModified: Timestamp.nullable()
157
+ }),
158
+ lastSavedAt: Timestamp.nullable(),
158
159
  lastModified: Timestamp.nullable()
159
160
  });
160
161
  var CompanyPreferences = z4.object({
161
- /** The amount of user provisions made for this company */
162
- userProvisions: z4.number().max(150, { error: "The total user provisions can't exceed 150" }).refine(
163
- (p) => !(p > 1 && p < 10),
164
- "The total user provisions must either be 1 or at least 10."
165
- ),
162
+ /** Forces service selectors to use the list of service(s) that you've created. */
163
+ useCreatedServices: z4.boolean(),
164
+ /** The user that's allowed to record the client's services. */
165
+ serviceSelector: companyServiceSelectors,
166
+ /** A record of the payments made must be attached before creating the
167
+ * appointment
168
+ * @note
169
+ * - only allowed when `serviceDecider === "scheduler"`
170
+ * */
171
+ enforcePaidAppts: z4.boolean(),
172
+ // primaryCurrency: currencies,
173
+ // acceptedCurrencies: z.array(currencies).transform((currencies) => {
174
+ // const newCurrencies: Currency[] = [];
175
+ // for (const currency of currencies) {
176
+ // if (newCurrencies.includes(currency)) continue;
177
+ // newCurrencies.push(currency);
178
+ // }
179
+ // return newCurrencies;
180
+ // }),
166
181
  /**
167
182
  * @property RR (Round Robin): Even distribution.
168
183
  * @property LOR (Least Outstanding Requests): Distribute based on availability.
@@ -171,43 +186,40 @@ var CompanyPreferences = z4.object({
171
186
  lastModified: Timestamp.nullable()
172
187
  });
173
188
  var Billing = z4.object({
174
- preferences: z4.object({
175
- /** Forces service selectors to use the list of service(s) that you've created. */
176
- useCreatedServices: z4.boolean(),
177
- /** The user that's allowed to record the client's services. */
178
- serviceSelector: companyServiceSelectors,
179
- /** A record of the payments made must be attached before creating the
180
- * appointment
181
- * @note
182
- * - only allowed when `serviceDecider === "scheduler"`
183
- * */
184
- enforcePaidAppts: z4.boolean(),
185
- primaryCurrency: currencies,
186
- acceptedCurrencies: z4.array(currencies).transform((currencies2) => {
187
- const newCurrencies = [];
188
- for (const currency of currencies2) {
189
- if (newCurrencies.includes(currency)) continue;
190
- newCurrencies.push(currency);
191
- }
192
- return newCurrencies;
193
- }),
194
- lastModified: Timestamp.nullable()
195
- }).superRefine((data, ctx) => {
196
- if (data.enforcePaidAppts && data.serviceSelector !== "scheduler") {
197
- ctx.addIssue(
198
- "serviceDecider must be scheduler when enforcePaidAppts is true."
199
- );
200
- }
201
- }),
189
+ // preferences: z
190
+ // .object({
191
+ // /** Forces service selectors to use the list of service(s) that you've created. */
192
+ // useCreatedServices: z.boolean(),
193
+ // /** The user that's allowed to record the client's services. */
194
+ // serviceSelector: companyServiceSelectors,
195
+ // /** A record of the payments made must be attached before creating the
196
+ // * appointment
197
+ // * @note
198
+ // * - only allowed when `serviceDecider === "scheduler"`
199
+ // * */
200
+ // enforcePaidAppts: z.boolean(),
201
+ // primaryCurrency: currencies,
202
+ // acceptedCurrencies: z.array(currencies).transform((currencies) => {
203
+ // const newCurrencies: Currency[] = [];
204
+ // for (const currency of currencies) {
205
+ // if (newCurrencies.includes(currency)) continue;
206
+ // newCurrencies.push(currency);
207
+ // }
208
+ // return newCurrencies;
209
+ // }),
210
+ // lastModified: Timestamp.nullable(),
211
+ // })
212
+ // .superRefine((data, ctx) => {
213
+ // if (data.enforcePaidAppts && data.serviceSelector !== "scheduler") {
214
+ // ctx.addIssue(
215
+ // "serviceDecider must be scheduler when enforcePaidAppts is true.",
216
+ // );
217
+ // }
218
+ // }),
202
219
  additionalFees: z4.array(PriceAdjustment).default([]),
203
220
  discounts: z4.array(PriceAdjustment).default([]),
204
221
  services: z4.array(PriceTag.omit({ uid: true })).max(100).default([]),
205
222
  lastModified: Timestamp.nullable()
206
- }).superRefine((billing, ctx) => {
207
- const totalServices = billing?.services?.length ?? 0;
208
- if (billing?.preferences?.useCreatedServices && totalServices < 1) {
209
- ctx.addIssue("At least (1) service must be added to the services list.");
210
- }
211
223
  });
212
224
  var Staff = z4.object({
213
225
  members: z4.record(CompanyUser.shape.uid, CompanyUser).superRefine((data, ctx) => {
@@ -304,12 +316,19 @@ var createCompanyDetails = (options) => {
304
316
  return z4.object({
305
317
  uid: UuidV7,
306
318
  identity: CompanyIdentity,
319
+ notifications: options.partial ? z4.array(Notification).nullish() : z4.array(Notification),
307
320
  receipts: options.partial ? Receipts.nullish() : Receipts,
308
321
  state: options.partial ? CompanyState.nullish() : CompanyState,
309
322
  preferences: options.partial ? CompanyPreferences.nullish() : CompanyPreferences,
310
323
  billing: options.partial ? Billing.nullish() : Billing,
311
324
  staff: options.partial ? Staff.nullish() : Staff,
312
325
  createdAt: options.partial ? Timestamp.nullish() : Timestamp
326
+ }).superRefine((data, ctx) => {
327
+ if (data.billing && data.preferences && data.preferences?.useCreatedServices && (data.billing?.services.length || 0) < 1) {
328
+ ctx.addIssue(
329
+ "You must create At least (1) service in order to select the useCreatedServices option."
330
+ );
331
+ }
313
332
  });
314
333
  };
315
334
  var CompanyDetails = createCompanyDetails({ partial: false });
@@ -317,10 +336,17 @@ var PartialCompanyDetails = createCompanyDetails({ partial: true });
317
336
 
318
337
  // src/schemas/Global.ts
319
338
  import * as z5 from "zod";
320
- var Tier = z5.object({
321
- name: z5.literal(["free", "pro", "premium", "gold"]),
322
- cost: z5.number().min(0),
323
- perks: z5.array(z5.string()).min(1)
339
+ import { tiers as tiers2 } from "src/main";
340
+ var TierList = z5.record(
341
+ tiers2,
342
+ z5.object({
343
+ cost: z5.number().min(0),
344
+ perks: z5.array(z5.string()).min(1)
345
+ })
346
+ ).superRefine((data, ctx) => {
347
+ if (data.free.cost !== 0) {
348
+ ctx.addIssue("The free tier must always cost $0.00");
349
+ }
324
350
  });
325
351
  var Notification = z5.object({
326
352
  code: z5.literal(["COMPANY_INVITE", "INVITE_RESPONSE", "DEV_MESSAGE"]),
@@ -336,7 +362,7 @@ var Notification = z5.object({
336
362
  switch (data.code) {
337
363
  case "COMPANY_INVITE":
338
364
  if (!Jwt.safeParse(data.payload).success) {
339
- ctx.addIssue("A company invite's payload must be a valid jwt.");
365
+ ctx.addIssue("The payload of company invite must be a valid jwt.");
340
366
  }
341
367
  break;
342
368
  case "DEV_MESSAGE":
@@ -356,6 +382,10 @@ var Notification = z5.object({
356
382
  }
357
383
  });
358
384
 
385
+ // src/enums/Global.ts
386
+ import * as z6 from "zod";
387
+ var tiers = z6.enum(["free", "pro", "premium", "gold"]);
388
+
359
389
  // src/functions/helper-functions.ts
360
390
  var findConflictingPartners = (...partners) => {
361
391
  let hasSingleDoctor = false;
@@ -398,7 +428,7 @@ export {
398
428
  PriceTag,
399
429
  PricingRate,
400
430
  StandardTime,
401
- Tier,
431
+ TierList,
402
432
  TimeLog,
403
433
  Timestamp,
404
434
  UuidV4,
@@ -410,5 +440,6 @@ export {
410
440
  employeeRoles,
411
441
  findConflictingPartners,
412
442
  getCompatibleRoles,
413
- healthcareProviderRoles
443
+ healthcareProviderRoles,
444
+ tiers
414
445
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bizmap/sdk",
3
- "version": "0.0.42",
3
+ "version": "0.0.44",
4
4
  "main": "./dist/main.js",
5
5
  "types": "./dist/main.d.ts",
6
6
  "type": "module",