@bizmap/sdk 0.0.107 → 0.0.108

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
@@ -1911,6 +1911,7 @@ declare const findConflictingPartners: (...partners: (CompanyUser | MiniCompanyU
1911
1911
  * @returns {CompanyUserRole[]} The roles that are compatible with the selected role.
1912
1912
  * */
1913
1913
  declare const getCompatibleRoles: (role: CompanyUserRole) => CompanyUserRole[];
1914
+ declare const getIncompatibleRoles: (role: CompanyUserRole) => CompanyUserRole[];
1914
1915
  declare const normalizeCompanyId: (id: string) => string;
1915
1916
  declare const normalizeNidKey: (value: keyof NonNullable<ClientIdentity["nid"]>) => string;
1916
1917
  declare const parseClientName: ({ firstName, middleName, lastName, }: Pick<ClientIdentity, "firstName" | "middleName" | "lastName">) => string;
@@ -1920,4 +1921,4 @@ declare function createNotifId(options?: {
1920
1921
  to: string;
1921
1922
  }): string;
1922
1923
 
1923
- export { type AcceptedCurrency, AlphaNumeric, AppointmentDetails, type AppointmentDistAlg, AppointmentSeverity, ClientForm, ClientIdentity, CompanyBilling, CompanyDetails, CompanyIdentity, CompanyInviteList, CompanyNotifications, type CompanyPartnerRole, CompanyPreferences, type CompanyServiceSelector, CompanyStaff, CompanyState, CompanyUser, type CompanyUserRole, CompanyUserSession, CreateCompanyForm, CreditCurrency, type EmployeeRole, type Gender, type HealthcareProviderRole, type Industry, InviteResponse, InvoiceNo, MAX_COMPANY_PRICE_MODS, MedicalDetails, Medicine, MiniAppointmentDetails, MiniCompanyUser, MutableAppointmentDetails, MutableCompanyBilling, MutableCompanyDetails, MutableCompanyIdentity, MutableCompanyPreferences, Notification, PaymentDetails, type PaymentMethod, PriceMod, PriceModList, PriceTag, Reason, Receipts, ScheduleAppointmentForm, StandardTime, TicketNo, type Tier, TierList, TimeLog, Timestamp, Trn, UserDetails, Version, Vitals, acceptedCurrencies, adminRoles, appointmentDistAlgs, calcBalance, calcPriceMod, companyPartnerRoles, companyServiceSelectors, companyUserRoles, createNotifId, employeeRoles, findAvailableStaff, findConflictingPartners, findNextAvailableStaff, genders, getCompatibleRoles, healthcareProviderRoles, industries, normalizeCompanyId, normalizeNidKey, parseClientName, paymentMethods, scheduleAppointment, serviceProviders, tiers, vitalKeys };
1924
+ export { type AcceptedCurrency, AlphaNumeric, AppointmentDetails, type AppointmentDistAlg, AppointmentSeverity, ClientForm, ClientIdentity, CompanyBilling, CompanyDetails, CompanyIdentity, CompanyInviteList, CompanyNotifications, type CompanyPartnerRole, CompanyPreferences, type CompanyServiceSelector, CompanyStaff, CompanyState, CompanyUser, type CompanyUserRole, CompanyUserSession, CreateCompanyForm, CreditCurrency, type EmployeeRole, type Gender, type HealthcareProviderRole, type Industry, InviteResponse, InvoiceNo, MAX_COMPANY_PRICE_MODS, MedicalDetails, Medicine, MiniAppointmentDetails, MiniCompanyUser, MutableAppointmentDetails, MutableCompanyBilling, MutableCompanyDetails, MutableCompanyIdentity, MutableCompanyPreferences, Notification, PaymentDetails, type PaymentMethod, PriceMod, PriceModList, PriceTag, Reason, Receipts, ScheduleAppointmentForm, StandardTime, TicketNo, type Tier, TierList, TimeLog, Timestamp, Trn, UserDetails, Version, Vitals, acceptedCurrencies, adminRoles, appointmentDistAlgs, calcBalance, calcPriceMod, companyPartnerRoles, companyServiceSelectors, companyUserRoles, createNotifId, employeeRoles, findAvailableStaff, findConflictingPartners, findNextAvailableStaff, genders, getCompatibleRoles, getIncompatibleRoles, healthcareProviderRoles, industries, normalizeCompanyId, normalizeNidKey, parseClientName, paymentMethods, scheduleAppointment, serviceProviders, tiers, vitalKeys };
package/dist/main.js CHANGED
@@ -535,6 +535,10 @@ var getCompatibleRoles = (role) => {
535
535
  }
536
536
  return companyUserRoles.exclude([role]).options;
537
537
  };
538
+ var getIncompatibleRoles = (role) => {
539
+ const compatibleRoles = getCompatibleRoles(role);
540
+ return companyUserRoles.options.filter((r) => !compatibleRoles.includes(r) && r !== role);
541
+ };
538
542
  var normalizeCompanyId = (id) => {
539
543
  return id.split("-").map((value) => upperFirst2(value.toLowerCase())).join(" ");
540
544
  };
@@ -572,8 +576,8 @@ var CompanyUserSession = z15.object({
572
576
  }
573
577
  return newRoles.sort();
574
578
  }).refine((roles) => {
575
- return roles.every(
576
- (role, i) => i === 0 || getCompatibleRoles(roles[0]).includes(role)
579
+ return !roles.find(
580
+ (role) => getIncompatibleRoles(role).some((r) => roles.includes(r))
577
581
  );
578
582
  }, "A user is not allowed to have conflicting roles."),
579
583
  ttl: z15.number(),
@@ -1174,6 +1178,7 @@ export {
1174
1178
  findNextAvailableStaff,
1175
1179
  genders,
1176
1180
  getCompatibleRoles,
1181
+ getIncompatibleRoles,
1177
1182
  healthcareProviderRoles,
1178
1183
  industries,
1179
1184
  normalizeCompanyId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bizmap/sdk",
3
- "version": "0.0.107",
3
+ "version": "0.0.108",
4
4
  "main": "./dist/main.js",
5
5
  "types": "./dist/main.d.ts",
6
6
  "type": "module",