@bizmap/sdk 0.0.95 → 0.0.97

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
@@ -181,6 +181,7 @@ declare const CompanyDetails: z.ZodObject<{
181
181
  RR: "RR";
182
182
  LOR: "LOR";
183
183
  }>>;
184
+ servicesDeployed: z.ZodBoolean;
184
185
  }, z.core.$strip>;
185
186
  billing: z.ZodObject<{
186
187
  lastModified: z.ZodNullable<z.ZodInt>;
@@ -224,18 +225,15 @@ declare const CompanyDetails: z.ZodObject<{
224
225
  percentage: z.ZodNumber;
225
226
  isOptional: z.ZodBoolean;
226
227
  }, z.core.$strip>>;
227
- offeredServices: z.ZodObject<{
228
- deployed: z.ZodBoolean;
229
- value: z.ZodRecord<z.ZodUUID, z.ZodObject<{
230
- createdAt: z.ZodReadonly<z.ZodInt>;
231
- lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
232
- currency: z.ZodEnum<{
233
- JMD: "JMD";
234
- }>;
235
- item: z.ZodString;
236
- cost: z.ZodNumber;
237
- }, z.core.$strip>>;
238
- }, z.core.$strip>;
228
+ offeredServices: z.ZodRecord<z.ZodUUID, z.ZodObject<{
229
+ createdAt: z.ZodReadonly<z.ZodInt>;
230
+ lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
231
+ currency: z.ZodEnum<{
232
+ JMD: "JMD";
233
+ }>;
234
+ item: z.ZodString;
235
+ cost: z.ZodNumber;
236
+ }, z.core.$strip>>;
239
237
  }, z.core.$strip>;
240
238
  staff: z.ZodObject<{
241
239
  lastModified: z.ZodNullable<z.ZodInt>;
@@ -322,6 +320,7 @@ declare const MutableCompanyDetails: z.ZodObject<{
322
320
  RR: "RR";
323
321
  LOR: "LOR";
324
322
  }>>>;
323
+ servicesDeployed: z.ZodOptional<z.ZodBoolean>;
325
324
  }, z.core.$strip>>;
326
325
  billing: z.ZodOptional<z.ZodObject<{
327
326
  version: z.ZodOptional<z.ZodInt>;
@@ -365,18 +364,15 @@ declare const MutableCompanyDetails: z.ZodObject<{
365
364
  percentage: z.ZodNumber;
366
365
  isOptional: z.ZodBoolean;
367
366
  }, z.core.$strip>>>;
368
- offeredServices: z.ZodOptional<z.ZodObject<{
369
- deployed: z.ZodBoolean;
370
- value: z.ZodRecord<z.ZodUUID, z.ZodObject<{
371
- createdAt: z.ZodReadonly<z.ZodInt>;
372
- lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
373
- currency: z.ZodEnum<{
374
- JMD: "JMD";
375
- }>;
376
- item: z.ZodString;
377
- cost: z.ZodNumber;
378
- }, z.core.$strip>>;
379
- }, z.core.$strip>>;
367
+ offeredServices: z.ZodOptional<z.ZodRecord<z.ZodUUID, z.ZodObject<{
368
+ createdAt: z.ZodReadonly<z.ZodInt>;
369
+ lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
370
+ currency: z.ZodEnum<{
371
+ JMD: "JMD";
372
+ }>;
373
+ item: z.ZodString;
374
+ cost: z.ZodNumber;
375
+ }, z.core.$strip>>>;
380
376
  }, z.core.$strip>>;
381
377
  staff: z.ZodOptional<z.ZodObject<{
382
378
  partnerMap: z.ZodOptional<z.ZodRecord<z.ZodUUID, z.ZodRecord<z.ZodUUID, z.ZodObject<{
@@ -443,18 +439,15 @@ declare const CompanyBilling: z.ZodObject<{
443
439
  percentage: z.ZodNumber;
444
440
  isOptional: z.ZodBoolean;
445
441
  }, z.core.$strip>>;
446
- offeredServices: z.ZodObject<{
447
- deployed: z.ZodBoolean;
448
- value: z.ZodRecord<z.ZodUUID, z.ZodObject<{
449
- createdAt: z.ZodReadonly<z.ZodInt>;
450
- lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
451
- currency: z.ZodEnum<{
452
- JMD: "JMD";
453
- }>;
454
- item: z.ZodString;
455
- cost: z.ZodNumber;
456
- }, z.core.$strip>>;
457
- }, z.core.$strip>;
442
+ offeredServices: z.ZodRecord<z.ZodUUID, z.ZodObject<{
443
+ createdAt: z.ZodReadonly<z.ZodInt>;
444
+ lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
445
+ currency: z.ZodEnum<{
446
+ JMD: "JMD";
447
+ }>;
448
+ item: z.ZodString;
449
+ cost: z.ZodNumber;
450
+ }, z.core.$strip>>;
458
451
  version: z.ZodInt;
459
452
  lastModified: z.ZodNullable<z.ZodInt>;
460
453
  }, z.core.$strip>;
@@ -501,18 +494,15 @@ declare const MutableCompanyBilling: z.ZodObject<{
501
494
  percentage: z.ZodNumber;
502
495
  isOptional: z.ZodBoolean;
503
496
  }, z.core.$strip>>;
504
- offeredServices: z.ZodObject<{
505
- deployed: z.ZodBoolean;
506
- value: z.ZodRecord<z.ZodUUID, z.ZodObject<{
507
- createdAt: z.ZodReadonly<z.ZodInt>;
508
- lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
509
- currency: z.ZodEnum<{
510
- JMD: "JMD";
511
- }>;
512
- item: z.ZodString;
513
- cost: z.ZodNumber;
514
- }, z.core.$strip>>;
515
- }, z.core.$strip>;
497
+ offeredServices: z.ZodRecord<z.ZodUUID, z.ZodObject<{
498
+ createdAt: z.ZodReadonly<z.ZodInt>;
499
+ lastModified: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
500
+ currency: z.ZodEnum<{
501
+ JMD: "JMD";
502
+ }>;
503
+ item: z.ZodString;
504
+ cost: z.ZodNumber;
505
+ }, z.core.$strip>>;
516
506
  }, z.core.$strip>;
517
507
  type MutableCompanyBilling = z.infer<typeof MutableCompanyBilling>;
518
508
 
@@ -601,6 +591,7 @@ declare const CompanyPreferences: z.ZodObject<{
601
591
  RR: "RR";
602
592
  LOR: "LOR";
603
593
  }>>;
594
+ servicesDeployed: z.ZodBoolean;
604
595
  version: z.ZodInt;
605
596
  lastModified: z.ZodNullable<z.ZodInt>;
606
597
  }, z.core.$strip>;
@@ -617,6 +608,7 @@ declare const MutableCompanyPreferences: z.ZodObject<{
617
608
  RR: "RR";
618
609
  LOR: "LOR";
619
610
  }>>;
611
+ servicesDeployed: z.ZodBoolean;
620
612
  }, z.core.$strip>;
621
613
  type MutableCompanyPreferences = z.infer<typeof MutableCompanyPreferences>;
622
614
 
package/dist/main.js CHANGED
@@ -80,10 +80,7 @@ var StandardTime = z5.string().trim().refine(
80
80
  (d) => d && d.replace(/^(01|(0[2-9])|(1[0-2])):(([1-5][0-9])|0[0-9]) (am|pm)/i, "").length === 0,
81
81
  'Invalid standard time: must match the pattern "hh:mm A"'
82
82
  );
83
- var Timestamp = z5.int().refine(
84
- (t) => t.toString().length === 13,
85
- "A timestamp must have (13) digits."
86
- ).positive();
83
+ var Timestamp = z5.int().min(10, "A timestamp must have at least (10) digits.").max(15, "A timestamp can't have more than (15) digits.").positive();
87
84
  var InviteResponse = z5.enum(["accepted", "declined"]);
88
85
  var TimeLog = z5.object({
89
86
  createdAt: Timestamp.readonly(),
@@ -191,24 +188,13 @@ var CompanyBilling = z8.object({
191
188
  discounts: createAdjustments("discount"),
192
189
  /** Optionally deductable from bills */
193
190
  prepayments: createAdjustments("pre-payment"),
194
- offeredServices: z8.object({
195
- /** Forces service selectors to use the list of service(s) that you've created. */
196
- deployed: z8.boolean(),
197
- // An object is used instead of an array so that updates to a particular service is accurate
198
- // and consistent.
199
- value: z8.record(z8.uuidv4(), PriceTag.omit({ uid: true }))
200
- }).superRefine((data, ctx) => {
201
- const services = Object.entries(data.value);
191
+ offeredServices: z8.record(z8.uuidv4(), PriceTag.omit({ uid: true })).superRefine((data, ctx) => {
192
+ const services = Object.entries(data);
202
193
  if (services.length > 150) {
203
194
  ctx.addIssue(
204
195
  "Creating more services than the max allowed services (150) is prohibited."
205
196
  );
206
197
  }
207
- if (data.deployed && services.length < 1) {
208
- ctx.addIssue(
209
- "You must create at least (1) service in order to deploy your service list."
210
- );
211
- }
212
198
  }),
213
199
  version: Version,
214
200
  lastModified: Timestamp.nullable()
@@ -407,6 +393,7 @@ var CompanyPreferences = z12.object({
407
393
  * @property LOR (Least Outstanding Requests): Distribute based on availability.
408
394
  */
409
395
  apptDistAlg: appointmentDistAlgs.default("RR"),
396
+ servicesDeployed: z12.boolean(),
410
397
  version: Version,
411
398
  lastModified: Timestamp.nullable()
412
399
  }).refine(
@@ -1012,7 +999,7 @@ async function scheduleAppointment(request) {
1012
999
  if (request.preferences.serviceSelector === "scheduler" && (!request.form.charges || request.form.charges.length < 1)) {
1013
1000
  throw new Error("Insufficient services selected.");
1014
1001
  } else if (request.preferences.serviceSelector === "scheduler" && request.billing.offeredServices.deployed && request.form.charges.find(
1015
- (charge) => !!Object.values(request.billing.offeredServices.value).find(
1002
+ (charge) => !!Object.values(request.billing.offeredServices).find(
1016
1003
  (createdCharge) => findChanges(charge, createdCharge).length > 0
1017
1004
  )
1018
1005
  )) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bizmap/sdk",
3
- "version": "0.0.95",
3
+ "version": "0.0.97",
4
4
  "main": "./dist/main.js",
5
5
  "types": "./dist/main.d.ts",
6
6
  "type": "module",