@bizmap/sdk 0.0.11 → 0.0.13

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
@@ -53,34 +53,37 @@ declare const CompanyOpState: z.ZodObject<{
53
53
  lastModified: z.ZodNullable<z.ZodNumber>;
54
54
  uid: z.ZodReadonly<z.ZodString>;
55
55
  availableBalance: z.ZodNumber;
56
- isOffline: z.ZodBoolean;
56
+ preferences: z.ZodObject<{
57
+ userProvisions: z.ZodNumber;
58
+ apptDistAlg: z.ZodEnum<{
59
+ RR: "RR";
60
+ LOR: "LOR";
61
+ }>;
62
+ }, z.core.$strip>;
57
63
  }, z.core.$strip>;
58
64
  type CompanyOpState = z.infer<typeof CompanyOpState>;
59
- declare const CompanyPreferences: z.ZodObject<{
60
- createdAt: z.ZodReadonly<z.ZodNumber>;
61
- lastModified: z.ZodNullable<z.ZodNumber>;
62
- uid: z.ZodReadonly<z.ZodString>;
63
- userProvisions: z.ZodNumber;
64
- apptDistAlg: z.ZodEnum<{
65
- RR: "RR";
66
- LOR: "LOR";
67
- }>;
68
- }, z.core.$strip>;
69
- type CompanyPreferences = z.infer<typeof CompanyPreferences>;
70
65
  declare const CompanyBillingModel: z.ZodObject<{
71
66
  createdAt: z.ZodReadonly<z.ZodNumber>;
72
67
  lastModified: z.ZodNullable<z.ZodNumber>;
73
68
  uid: z.ZodReadonly<z.ZodString>;
74
- biller: z.ZodEnum<{
75
- doc: "doc";
76
- fdc: "fdc";
77
- }>;
78
- primaryCurrency: z.ZodEnum<{
79
- JMD: "JMD";
80
- }>;
81
- acceptedCurrencies: z.ZodArray<z.ZodEnum<{
82
- JMD: "JMD";
83
- }>>;
69
+ preferences: z.ZodObject<{
70
+ allowInvoiceDist: z.ZodBoolean;
71
+ serviceDecider: z.ZodEnum<{
72
+ scheduler: "scheduler";
73
+ doctor: "doctor";
74
+ }>;
75
+ enforcePaidAppts: z.ZodBoolean;
76
+ paymentCollector: z.ZodNullable<z.ZodEnum<{
77
+ doc: "doc";
78
+ cshr: "cshr";
79
+ }>>;
80
+ primaryCurrency: z.ZodEnum<{
81
+ JMD: "JMD";
82
+ }>;
83
+ acceptedCurrencies: z.ZodArray<z.ZodEnum<{
84
+ JMD: "JMD";
85
+ }>>;
86
+ }, z.core.$strip>;
84
87
  additionalFees: z.ZodOptional<z.ZodArray<z.ZodObject<{
85
88
  createdAt: z.ZodReadonly<z.ZodNumber>;
86
89
  lastModified: z.ZodNullable<z.ZodNumber>;
@@ -184,7 +187,6 @@ declare const CompanyUser: z.ZodObject<{
184
187
  physAsst: "physAsst";
185
188
  rcpst: "rcpst";
186
189
  cshr: "cshr";
187
- fdc: "fdc";
188
190
  admin: "admin";
189
191
  }>>;
190
192
  name: z.ZodRecord<z.ZodEnum<{
@@ -214,7 +216,6 @@ declare const StaffDetails: z.ZodObject<{
214
216
  physAsst: "physAsst";
215
217
  rcpst: "rcpst";
216
218
  cshr: "cshr";
217
- fdc: "fdc";
218
219
  admin: "admin";
219
220
  }>>;
220
221
  name: z.ZodRecord<z.ZodEnum<{
@@ -243,7 +244,6 @@ declare const companyUserRoles: z.ZodEnum<{
243
244
  physAsst: "physAsst";
244
245
  rcpst: "rcpst";
245
246
  cshr: "cshr";
246
- fdc: "fdc";
247
247
  admin: "admin";
248
248
  }>;
249
249
  type CompanyUserRole = z.infer<typeof companyUserRoles>;
@@ -257,7 +257,6 @@ declare const employeeRoles: z.ZodEnum<{
257
257
  physAsst: "physAsst";
258
258
  rcpst: "rcpst";
259
259
  cshr: "cshr";
260
- fdc: "fdc";
261
260
  }>;
262
261
  type EmployeeRole = z.infer<typeof employeeRoles>;
263
262
  declare const appointmentDistAlgs: z.ZodEnum<{
@@ -266,4 +265,4 @@ declare const appointmentDistAlgs: z.ZodEnum<{
266
265
  }>;
267
266
  type AppointmentDistAlg = z.infer<typeof appointmentDistAlgs>;
268
267
 
269
- export { type AppointmentDistAlg, CompanyBillingModel, CompanyIdentity, CompanyOpState, type CompanyPartnerRole, CompanyPreferences, CompanyRegistrationClaims, CompanyUser, type CompanyUserRole, type EmployeeRole, PriceAdjustment, PriceTag, PricingRate, RegisterCompanyForm, StaffDetails, Time, TimeLog, appointmentDistAlgs, companyPartnerRoles, companyUserRoles, employeeRoles };
268
+ export { type AppointmentDistAlg, CompanyBillingModel, CompanyIdentity, CompanyOpState, type CompanyPartnerRole, CompanyRegistrationClaims, CompanyUser, type CompanyUserRole, type EmployeeRole, PriceAdjustment, PriceTag, PricingRate, RegisterCompanyForm, StaffDetails, Time, TimeLog, appointmentDistAlgs, companyPartnerRoles, companyUserRoles, employeeRoles };
package/dist/main.js CHANGED
@@ -48,7 +48,6 @@ var companyUserRoles = z3.enum([
48
48
  "physAsst",
49
49
  "rcpst",
50
50
  "cshr",
51
- "fdc",
52
51
  "admin"
53
52
  ]);
54
53
  var companyPartnerRoles = companyUserRoles.extract([
@@ -80,40 +79,59 @@ var CompanyIdentity = z4.object({
80
79
  var CompanyOpState = z4.object({
81
80
  // The company's uid
82
81
  uid: CompanyIdentity.shape.uid,
82
+ // This can only be changed by the server/app admin
83
83
  availableBalance: z4.number(),
84
- isOffline: z4.boolean(),
85
- ...TimeLog.shape
86
- });
87
- var CompanyPreferences = z4.object({
88
- // The company's uid
89
- uid: CompanyIdentity.shape.uid,
90
- /** The amount of user provisions made for this company */
91
- userProvisions: z4.number(),
92
- /**
93
- * @property RR (Round Robin): Even distribution.
94
- * @property LOR (Least Outstanding Requests): Distribute based on availability.
95
- */
96
- apptDistAlg: appointmentDistAlgs,
97
- // // Required to determine:
98
- // // [1] when the working directory on the server should reset
99
- // // [2] the time that company session requests are cut-off
100
- // // (the cutoff time affects non-admins)
101
- // workingHours: z.object({
102
- // start: Time,
103
- // end: Time,
104
- // }),
84
+ // This can be changed by the company's admin
85
+ preferences: z4.object({
86
+ /** The amount of user provisions made for this company */
87
+ userProvisions: z4.number(),
88
+ /**
89
+ * @property RR (Round Robin): Even distribution.
90
+ * @property LOR (Least Outstanding Requests): Distribute based on availability.
91
+ */
92
+ apptDistAlg: appointmentDistAlgs
93
+ }),
105
94
  ...TimeLog.shape
106
95
  });
107
96
  var CompanyBillingModel = z4.object({
108
97
  uid: CompanyIdentity.shape.uid,
109
- // Preferences
110
- /** The user that provides the bill to the client */
111
- biller: companyUserRoles.extract(["doc", "fdc"]),
112
- primaryCurrency: currencies,
113
- acceptedCurrencies: z4.array(currencies),
98
+ preferences: z4.object({
99
+ /** Allows the serviceDecider to distribute invoices. */
100
+ allowInvoiceDist: z4.boolean(),
101
+ /** The user that's allowed to record the client's services. */
102
+ serviceDecider: z4.enum(["scheduler", "doctor"]),
103
+ /** A record of the payments made must be attached before creating the
104
+ * appointment
105
+ * @note
106
+ * - only allowed when `serviceDecider === "scheduler"`
107
+ * - removes the `cshr` role from the company's allowed user roles
108
+ * */
109
+ enforcePaidAppts: z4.boolean(),
110
+ /**
111
+ * Determines who collects & records payments made by clients.
112
+ * @default "cshr"
113
+ * @note
114
+ * - if `collector === "doc"`, the `cshr` role will be removed from the company's allowed user roles.
115
+ * - if `enforcePaidAppts === true`, this should be null.
116
+ */
117
+ paymentCollector: companyUserRoles.extract(["doc", "cshr"]).nullable(),
118
+ primaryCurrency: currencies,
119
+ acceptedCurrencies: z4.array(currencies)
120
+ }).superRefine((data, ctx) => {
121
+ if (data.enforcePaidAppts && data.serviceDecider !== "scheduler") {
122
+ ctx.addIssue(
123
+ "serviceDecider must be scheduler when enforcePaidAppts is true."
124
+ );
125
+ }
126
+ if (data.enforcePaidAppts && data.paymentCollector !== null) {
127
+ ctx.addIssue(
128
+ "paymentCollector must be null when enforcePaidAppts is true."
129
+ );
130
+ }
131
+ }),
114
132
  additionalFees: z4.array(PriceAdjustment).optional(),
115
133
  discounts: z4.array(PriceAdjustment).optional(),
116
- services: z4.array(PriceTag.omit({ uid: true })).optional(),
134
+ services: z4.array(PriceTag.omit({ uid: true })).min(1).max(100).optional(),
117
135
  ...TimeLog.shape
118
136
  });
119
137
  var RegisterCompanyForm = z4.object({
@@ -151,7 +169,6 @@ export {
151
169
  CompanyBillingModel,
152
170
  CompanyIdentity,
153
171
  CompanyOpState,
154
- CompanyPreferences,
155
172
  CompanyRegistrationClaims,
156
173
  CompanyUser,
157
174
  PriceAdjustment,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bizmap/sdk",
3
- "version": "0.0.11",
3
+ "version": "0.0.13",
4
4
  "main": "./dist/main.js",
5
5
  "types": "./dist/main.d.ts",
6
6
  "type": "module",