@blackcode_sa/metaestetics-api 1.12.6 → 1.12.8

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/index.mjs CHANGED
@@ -675,49 +675,67 @@ var Language = /* @__PURE__ */ ((Language2) => {
675
675
  var ClinicTag = /* @__PURE__ */ ((ClinicTag6) => {
676
676
  ClinicTag6["PARKING"] = "parking";
677
677
  ClinicTag6["WIFI"] = "wifi";
678
- ClinicTag6["WHEELCHAIR_ACCESS"] = "wheelchair_access";
679
- ClinicTag6["CAFE"] = "cafe";
680
- ClinicTag6["PHARMACY"] = "pharmacy";
681
- ClinicTag6["WAITING_ROOM"] = "waiting_room";
678
+ ClinicTag6["LUXURY_WAITING"] = "luxury_waiting";
679
+ ClinicTag6["REFRESHMENTS"] = "refreshments";
680
+ ClinicTag6["PRIVATE_ROOMS"] = "private_rooms";
681
+ ClinicTag6["RECOVERY_AREA"] = "recovery_area";
682
682
  ClinicTag6["CARD_PAYMENT"] = "card_payment";
683
- ClinicTag6["INSURANCE"] = "insurance";
684
- ClinicTag6["CHILDREN_AREA"] = "children_area";
685
- ClinicTag6["TV"] = "tv";
686
- ClinicTag6["AIR_CONDITIONING"] = "air_conditioning";
687
- ClinicTag6["WATER_DISPENSER"] = "water_dispenser";
688
- ClinicTag6["VENDING_MACHINE"] = "vending_machine";
689
- ClinicTag6["ELEVATOR"] = "elevator";
690
- ClinicTag6["RAMP"] = "ramp";
691
- ClinicTag6["HANDICAP_PARKING"] = "handicap_parking";
692
- ClinicTag6["BRAILLE"] = "braille";
693
- ClinicTag6["SIGN_LANGUAGE"] = "sign_language";
694
- ClinicTag6["EMERGENCY_SERVICE"] = "emergency_service";
695
- ClinicTag6["LAB"] = "lab";
696
- ClinicTag6["XRAY"] = "xray";
697
- ClinicTag6["ULTRASOUND"] = "ultrasound";
698
- ClinicTag6["DENTAL"] = "dental";
699
- ClinicTag6["PEDIATRIC"] = "pediatric";
700
- ClinicTag6["GYNECOLOGY"] = "gynecology";
701
- ClinicTag6["CARDIOLOGY"] = "cardiology";
702
- ClinicTag6["DERMATOLOGY"] = "dermatology";
703
- ClinicTag6["ORTHOPEDIC"] = "orthopedic";
704
- ClinicTag6["OPHTHALMOLOGY"] = "ophthalmology";
705
- ClinicTag6["TELEMEDICINE"] = "telemedicine";
706
- ClinicTag6["HOME_VISITS"] = "home_visits";
683
+ ClinicTag6["FINANCING"] = "financing";
684
+ ClinicTag6["FREE_CONSULTATION"] = "free_consultation";
685
+ ClinicTag6["VIRTUAL_CONSULTATION"] = "virtual_consultation";
686
+ ClinicTag6["BEFORE_AFTER_PHOTOS"] = "before_after_photos";
687
+ ClinicTag6["AFTERCARE_SUPPORT"] = "aftercare_support";
688
+ ClinicTag6["BOTOX"] = "botox";
689
+ ClinicTag6["DERMAL_FILLERS"] = "dermal_fillers";
690
+ ClinicTag6["LASER_HAIR_REMOVAL"] = "laser_hair_removal";
691
+ ClinicTag6["LASER_SKIN_RESURFACING"] = "laser_skin_resurfacing";
692
+ ClinicTag6["CHEMICAL_PEELS"] = "chemical_peels";
693
+ ClinicTag6["MICRONEEDLING"] = "microneedling";
694
+ ClinicTag6["COOLSCULPTING"] = "coolsculpting";
695
+ ClinicTag6["THREAD_LIFT"] = "thread_lift";
696
+ ClinicTag6["LIP_ENHANCEMENT"] = "lip_enhancement";
697
+ ClinicTag6["RHINOPLASTY"] = "rhinoplasty";
698
+ ClinicTag6["SKIN_TIGHTENING"] = "skin_tightening";
699
+ ClinicTag6["FAT_DISSOLVING"] = "fat_dissolving";
700
+ ClinicTag6["PRP_TREATMENT"] = "prp_treatment";
701
+ ClinicTag6["HYDRAFACIAL"] = "hydrafacial";
702
+ ClinicTag6["IPL_PHOTOFACIAL"] = "ipl_photofacial";
703
+ ClinicTag6["BODY_CONTOURING"] = "body_contouring";
704
+ ClinicTag6["FACELIFT"] = "facelift";
705
+ ClinicTag6["RHINOPLASTY_SURGICAL"] = "rhinoplasty_surgical";
706
+ ClinicTag6["BREAST_AUGMENTATION"] = "breast_augmentation";
707
+ ClinicTag6["BREAST_REDUCTION"] = "breast_reduction";
708
+ ClinicTag6["BREAST_LIFT"] = "breast_lift";
709
+ ClinicTag6["TUMMY_TUCK"] = "tummy_tuck";
710
+ ClinicTag6["LIPOSUCTION"] = "liposuction";
711
+ ClinicTag6["BBL"] = "bbl";
712
+ ClinicTag6["MOMMY_MAKEOVER"] = "mommy_makeover";
713
+ ClinicTag6["ARM_LIFT"] = "arm_lift";
714
+ ClinicTag6["THIGH_LIFT"] = "thigh_lift";
715
+ ClinicTag6["EYELID_SURGERY"] = "eyelid_surgery";
716
+ ClinicTag6["BROW_LIFT"] = "brow_lift";
717
+ ClinicTag6["NECK_LIFT"] = "neck_lift";
718
+ ClinicTag6["OTOPLASTY"] = "otoplasty";
719
+ ClinicTag6["LABIAPLASTY"] = "labiaplasty";
707
720
  ClinicTag6["ONLINE_BOOKING"] = "online_booking";
708
721
  ClinicTag6["MOBILE_APP"] = "mobile_app";
709
722
  ClinicTag6["SMS_NOTIFICATIONS"] = "sms_notifications";
710
723
  ClinicTag6["EMAIL_NOTIFICATIONS"] = "email_notifications";
724
+ ClinicTag6["VIRTUAL_TRY_ON"] = "virtual_try_on";
725
+ ClinicTag6["SKIN_ANALYSIS"] = "skin_analysis";
726
+ ClinicTag6["TREATMENT_TRACKING"] = "treatment_tracking";
727
+ ClinicTag6["LOYALTY_PROGRAM"] = "loyalty_program";
711
728
  ClinicTag6["ENGLISH"] = "english";
712
- ClinicTag6["SERBIAN"] = "serbian";
713
729
  ClinicTag6["GERMAN"] = "german";
714
- ClinicTag6["RUSSIAN"] = "russian";
715
- ClinicTag6["CHINESE"] = "chinese";
716
- ClinicTag6["SPANISH"] = "spanish";
717
730
  ClinicTag6["FRENCH"] = "french";
731
+ ClinicTag6["SPANISH"] = "spanish";
732
+ ClinicTag6["ITALIAN"] = "italian";
733
+ ClinicTag6["DUTCH"] = "dutch";
734
+ ClinicTag6["RUSSIAN"] = "russian";
735
+ ClinicTag6["PORTUGUESE"] = "portuguese";
718
736
  ClinicTag6["OPEN_24_7"] = "open_24_7";
719
737
  ClinicTag6["WEEKEND_HOURS"] = "weekend_hours";
720
- ClinicTag6["NIGHT_SHIFT"] = "night_shift";
738
+ ClinicTag6["EXTENDED_HOURS"] = "extended_hours";
721
739
  ClinicTag6["HOLIDAY_HOURS"] = "holiday_hours";
722
740
  return ClinicTag6;
723
741
  })(ClinicTag || {});
@@ -1919,9 +1937,9 @@ import {
1919
1937
  confirmPasswordReset
1920
1938
  } from "firebase/auth";
1921
1939
  import {
1922
- collection as collection17,
1923
- query as query17,
1924
- getDocs as getDocs17,
1940
+ collection as collection18,
1941
+ query as query18,
1942
+ getDocs as getDocs18,
1925
1943
  runTransaction
1926
1944
  } from "firebase/firestore";
1927
1945
 
@@ -7826,14 +7844,157 @@ var UserService = class extends BaseService {
7826
7844
  }
7827
7845
  };
7828
7846
 
7829
- // src/services/clinic/utils/clinic-group.utils.ts
7847
+ // src/services/clinic/billing-transactions.service.ts
7830
7848
  import {
7831
7849
  collection as collection12,
7832
- doc as doc13,
7833
- getDoc as getDoc16,
7834
7850
  getDocs as getDocs12,
7835
7851
  query as query12,
7836
- where as where12,
7852
+ orderBy as orderBy5,
7853
+ limit as limit8,
7854
+ startAfter as startAfter7,
7855
+ where as where12
7856
+ } from "firebase/firestore";
7857
+ var BillingTransactionsService = class extends BaseService {
7858
+ constructor() {
7859
+ super(...arguments);
7860
+ this.BILLING_TRANSACTIONS_COLLECTION = "billingTransactions";
7861
+ }
7862
+ /**
7863
+ * Get billing transactions for a clinic group with pagination
7864
+ * @param clinicGroupId - The clinic group ID
7865
+ * @param options - Query options
7866
+ * @returns Promise with transactions and pagination info
7867
+ */
7868
+ async getBillingTransactions(clinicGroupId, options = {}) {
7869
+ try {
7870
+ const { limit: queryLimit = 50, startAfter: startAfterDoc, transactionType } = options;
7871
+ const constraints = [];
7872
+ if (transactionType) {
7873
+ constraints.push(where12("type", "==", transactionType));
7874
+ }
7875
+ constraints.push(orderBy5("timestamp", "desc"));
7876
+ if (startAfterDoc) {
7877
+ constraints.push(startAfter7(startAfterDoc));
7878
+ }
7879
+ constraints.push(limit8(queryLimit + 1));
7880
+ const transactionsRef = collection12(
7881
+ this.db,
7882
+ CLINIC_GROUPS_COLLECTION,
7883
+ clinicGroupId,
7884
+ this.BILLING_TRANSACTIONS_COLLECTION
7885
+ );
7886
+ const q = query12(transactionsRef, ...constraints);
7887
+ const querySnapshot = await getDocs12(q);
7888
+ const docs = querySnapshot.docs;
7889
+ const hasMore = docs.length > queryLimit;
7890
+ const transactions = docs.slice(0, queryLimit).map((doc38) => ({
7891
+ id: doc38.id,
7892
+ ...doc38.data()
7893
+ }));
7894
+ const lastDoc = transactions.length > 0 ? docs[transactions.length - 1] : null;
7895
+ return {
7896
+ transactions,
7897
+ lastDoc,
7898
+ hasMore
7899
+ };
7900
+ } catch (error) {
7901
+ console.error(
7902
+ `Error fetching billing transactions for clinic group ${clinicGroupId}:`,
7903
+ error
7904
+ );
7905
+ throw new Error(
7906
+ `Failed to fetch billing transactions: ${error instanceof Error ? error.message : "Unknown error"}`
7907
+ );
7908
+ }
7909
+ }
7910
+ /**
7911
+ * Get recent billing transactions (last 10)
7912
+ * @param clinicGroupId - The clinic group ID
7913
+ * @returns Promise with recent transactions
7914
+ */
7915
+ async getRecentBillingTransactions(clinicGroupId) {
7916
+ const result = await this.getBillingTransactions(clinicGroupId, { limit: 10 });
7917
+ return result.transactions;
7918
+ }
7919
+ /**
7920
+ * Get billing transactions by type
7921
+ * @param clinicGroupId - The clinic group ID
7922
+ * @param transactionType - The transaction type to filter by
7923
+ * @param options - Additional query options
7924
+ * @returns Promise with filtered transactions
7925
+ */
7926
+ async getBillingTransactionsByType(clinicGroupId, transactionType, options = {}) {
7927
+ return this.getBillingTransactions(clinicGroupId, {
7928
+ ...options,
7929
+ transactionType
7930
+ });
7931
+ }
7932
+ /**
7933
+ * Get subscription-related transactions only
7934
+ * @param clinicGroupId - The clinic group ID
7935
+ * @param options - Query options
7936
+ * @returns Promise with subscription transactions
7937
+ */
7938
+ async getSubscriptionTransactions(clinicGroupId, options = {}) {
7939
+ try {
7940
+ const { limit: queryLimit = 50, startAfter: startAfterDoc } = options;
7941
+ const subscriptionTypes = [
7942
+ "subscription_created" /* SUBSCRIPTION_CREATED */,
7943
+ "subscription_activated" /* SUBSCRIPTION_ACTIVATED */,
7944
+ "subscription_renewed" /* SUBSCRIPTION_RENEWED */,
7945
+ "subscription_updated" /* SUBSCRIPTION_UPDATED */,
7946
+ "subscription_canceled" /* SUBSCRIPTION_CANCELED */,
7947
+ "subscription_reactivated" /* SUBSCRIPTION_REACTIVATED */,
7948
+ "subscription_deleted" /* SUBSCRIPTION_DELETED */
7949
+ ];
7950
+ const constraints = [
7951
+ where12("type", "in", subscriptionTypes),
7952
+ orderBy5("timestamp", "desc")
7953
+ ];
7954
+ if (startAfterDoc) {
7955
+ constraints.push(startAfter7(startAfterDoc));
7956
+ }
7957
+ constraints.push(limit8(queryLimit + 1));
7958
+ const transactionsRef = collection12(
7959
+ this.db,
7960
+ CLINIC_GROUPS_COLLECTION,
7961
+ clinicGroupId,
7962
+ this.BILLING_TRANSACTIONS_COLLECTION
7963
+ );
7964
+ const q = query12(transactionsRef, ...constraints);
7965
+ const querySnapshot = await getDocs12(q);
7966
+ const docs = querySnapshot.docs;
7967
+ const hasMore = docs.length > queryLimit;
7968
+ const transactions = docs.slice(0, queryLimit).map((doc38) => ({
7969
+ id: doc38.id,
7970
+ ...doc38.data()
7971
+ }));
7972
+ const lastDoc = transactions.length > 0 ? docs[transactions.length - 1] : null;
7973
+ return {
7974
+ transactions,
7975
+ lastDoc,
7976
+ hasMore
7977
+ };
7978
+ } catch (error) {
7979
+ console.error(
7980
+ `Error fetching subscription transactions for clinic group ${clinicGroupId}:`,
7981
+ error
7982
+ );
7983
+ throw new Error(
7984
+ `Failed to fetch subscription transactions: ${error instanceof Error ? error.message : "Unknown error"}`
7985
+ );
7986
+ }
7987
+ }
7988
+ };
7989
+
7990
+ // src/services/clinic/utils/clinic-group.utils.ts
7991
+ import {
7992
+ collection as collection13,
7993
+ doc as doc13,
7994
+ getDoc as getDoc16,
7995
+ getDocs as getDocs13,
7996
+ query as query13,
7997
+ where as where13,
7837
7998
  updateDoc as updateDoc13,
7838
7999
  setDoc as setDoc12,
7839
8000
  Timestamp as Timestamp16
@@ -7962,7 +8123,7 @@ async function createClinicGroup(db, data, ownerId, isDefault = false, clinicAdm
7962
8123
  }
7963
8124
  const now = Timestamp16.now();
7964
8125
  console.log("[CLINIC_GROUP] Preparing clinic group data object");
7965
- const groupId = doc13(collection12(db, CLINIC_GROUPS_COLLECTION)).id;
8126
+ const groupId = doc13(collection13(db, CLINIC_GROUPS_COLLECTION)).id;
7966
8127
  console.log("[CLINIC_GROUP] Logo value:", {
7967
8128
  logoValue: validatedData.logo,
7968
8129
  logoType: validatedData.logo === null ? "null" : typeof validatedData.logo
@@ -8066,11 +8227,11 @@ async function getClinicGroup(db, groupId) {
8066
8227
  return null;
8067
8228
  }
8068
8229
  async function getAllActiveGroups(db) {
8069
- const q = query12(
8070
- collection12(db, CLINIC_GROUPS_COLLECTION),
8071
- where12("isActive", "==", true)
8230
+ const q = query13(
8231
+ collection13(db, CLINIC_GROUPS_COLLECTION),
8232
+ where13("isActive", "==", true)
8072
8233
  );
8073
- const querySnapshot = await getDocs12(q);
8234
+ const querySnapshot = await getDocs13(q);
8074
8235
  return querySnapshot.docs.map((doc38) => doc38.data());
8075
8236
  }
8076
8237
  async function updateClinicGroup(db, groupId, data, app) {
@@ -8286,6 +8447,7 @@ var ClinicGroupService = class extends BaseService {
8286
8447
  constructor(db, auth, app, clinicAdminService) {
8287
8448
  super(db, auth, app);
8288
8449
  this.clinicAdminService = clinicAdminService;
8450
+ this.billingTransactionsService = new BillingTransactionsService(db, auth, app);
8289
8451
  }
8290
8452
  /**
8291
8453
  * Kreira novu grupaciju klinika
@@ -8322,23 +8484,13 @@ var ClinicGroupService = class extends BaseService {
8322
8484
  * Dodaje admina u grupaciju
8323
8485
  */
8324
8486
  async addAdminToGroup(groupId, adminId) {
8325
- return addAdminToGroup(
8326
- this.db,
8327
- groupId,
8328
- adminId,
8329
- this.app
8330
- );
8487
+ return addAdminToGroup(this.db, groupId, adminId, this.app);
8331
8488
  }
8332
8489
  /**
8333
8490
  * Uklanja admina iz grupacije
8334
8491
  */
8335
8492
  async removeAdminFromGroup(groupId, adminId) {
8336
- return removeAdminFromGroup(
8337
- this.db,
8338
- groupId,
8339
- adminId,
8340
- this.app
8341
- );
8493
+ return removeAdminFromGroup(this.db, groupId, adminId, this.app);
8342
8494
  }
8343
8495
  /**
8344
8496
  * Deaktivira grupaciju klinika
@@ -8378,10 +8530,7 @@ var ClinicGroupService = class extends BaseService {
8378
8530
  logoUrl = uploadedLogoUrl;
8379
8531
  }
8380
8532
  } catch (error) {
8381
- console.error(
8382
- "[CLINIC_GROUP] Error processing logo in setupClinicGroup:",
8383
- error
8384
- );
8533
+ console.error("[CLINIC_GROUP] Error processing logo in setupClinicGroup:", error);
8385
8534
  }
8386
8535
  }
8387
8536
  const updateData = {
@@ -8400,48 +8549,25 @@ var ClinicGroupService = class extends BaseService {
8400
8549
  * Kreira admin token za grupaciju
8401
8550
  */
8402
8551
  async createAdminToken(groupId, creatorAdminId, data) {
8403
- return createAdminToken(
8404
- this.db,
8405
- groupId,
8406
- creatorAdminId,
8407
- this.app,
8408
- data
8409
- );
8552
+ return createAdminToken(this.db, groupId, creatorAdminId, this.app, data);
8410
8553
  }
8411
8554
  /**
8412
8555
  * Verifikuje i koristi admin token
8413
8556
  */
8414
8557
  async verifyAndUseAdminToken(groupId, token, userRef) {
8415
- return verifyAndUseAdminToken(
8416
- this.db,
8417
- groupId,
8418
- token,
8419
- userRef,
8420
- this.app
8421
- );
8558
+ return verifyAndUseAdminToken(this.db, groupId, token, userRef, this.app);
8422
8559
  }
8423
8560
  /**
8424
8561
  * Briše admin token
8425
8562
  */
8426
8563
  async deleteAdminToken(groupId, tokenId, adminId) {
8427
- return deleteAdminToken(
8428
- this.db,
8429
- groupId,
8430
- tokenId,
8431
- adminId,
8432
- this.app
8433
- );
8564
+ return deleteAdminToken(this.db, groupId, tokenId, adminId, this.app);
8434
8565
  }
8435
8566
  /**
8436
8567
  * Dohvata aktivne admin tokene
8437
8568
  */
8438
8569
  async getActiveAdminTokens(groupId, adminId) {
8439
- return getActiveAdminTokens(
8440
- this.db,
8441
- groupId,
8442
- adminId,
8443
- this.app
8444
- );
8570
+ return getActiveAdminTokens(this.db, groupId, adminId, this.app);
8445
8571
  }
8446
8572
  // TODO: Add a method to get all admin tokens for a clinic group (not just active ones)
8447
8573
  // TODO: Refactor admin token methods not to add tokens to the clinicGroup document,
@@ -8485,14 +8611,43 @@ var ClinicGroupService = class extends BaseService {
8485
8611
  console.log("[CLINIC_GROUP] Completing onboarding", { groupId });
8486
8612
  return this.setOnboarding(groupId, { completed: true });
8487
8613
  }
8614
+ /**
8615
+ * Get billing transactions for a clinic group
8616
+ *
8617
+ * @param groupId - The clinic group ID
8618
+ * @param options - Query options for pagination and filtering
8619
+ * @returns Promise with billing transactions and pagination info
8620
+ */
8621
+ async getBillingTransactions(groupId, options = {}) {
8622
+ return this.billingTransactionsService.getBillingTransactions(groupId, options);
8623
+ }
8624
+ /**
8625
+ * Get recent billing transactions for a clinic group (last 10)
8626
+ *
8627
+ * @param groupId - The clinic group ID
8628
+ * @returns Promise with recent billing transactions
8629
+ */
8630
+ async getRecentBillingTransactions(groupId) {
8631
+ return this.billingTransactionsService.getRecentBillingTransactions(groupId);
8632
+ }
8633
+ /**
8634
+ * Get subscription-related billing transactions for a clinic group
8635
+ *
8636
+ * @param groupId - The clinic group ID
8637
+ * @param options - Query options for pagination
8638
+ * @returns Promise with subscription transactions and pagination info
8639
+ */
8640
+ async getSubscriptionTransactions(groupId, options = {}) {
8641
+ return this.billingTransactionsService.getSubscriptionTransactions(groupId, options);
8642
+ }
8488
8643
  };
8489
8644
 
8490
8645
  // src/services/clinic/clinic.service.ts
8491
8646
  import {
8492
- collection as collection16,
8647
+ collection as collection17,
8493
8648
  doc as doc15,
8494
8649
  getDoc as getDoc18,
8495
- getDocs as getDocs16,
8650
+ getDocs as getDocs17,
8496
8651
  updateDoc as updateDoc15,
8497
8652
  serverTimestamp as serverTimestamp14,
8498
8653
  writeBatch as writeBatch4,
@@ -8506,17 +8661,17 @@ import { z as z20 } from "zod";
8506
8661
 
8507
8662
  // src/services/clinic/utils/clinic.utils.ts
8508
8663
  import {
8509
- collection as collection13,
8664
+ collection as collection14,
8510
8665
  doc as doc14,
8511
8666
  getDoc as getDoc17,
8512
- getDocs as getDocs13,
8513
- query as query13,
8514
- where as where13,
8667
+ getDocs as getDocs14,
8668
+ query as query14,
8669
+ where as where14,
8515
8670
  updateDoc as updateDoc14,
8516
8671
  setDoc as setDoc13,
8517
8672
  Timestamp as Timestamp17,
8518
- limit as limit8,
8519
- startAfter as startAfter7
8673
+ limit as limit9,
8674
+ startAfter as startAfter8
8520
8675
  } from "firebase/firestore";
8521
8676
  import {
8522
8677
  geohashForLocation as geohashForLocation3,
@@ -8533,12 +8688,12 @@ async function getClinic(db, clinicId) {
8533
8688
  return null;
8534
8689
  }
8535
8690
  async function getClinicsByGroup(db, groupId) {
8536
- const q = query13(
8537
- collection13(db, CLINICS_COLLECTION),
8538
- where13("clinicGroupId", "==", groupId),
8539
- where13("isActive", "==", true)
8691
+ const q = query14(
8692
+ collection14(db, CLINICS_COLLECTION),
8693
+ where14("clinicGroupId", "==", groupId),
8694
+ where14("isActive", "==", true)
8540
8695
  );
8541
- const querySnapshot = await getDocs13(q);
8696
+ const querySnapshot = await getDocs14(q);
8542
8697
  return querySnapshot.docs.map((doc38) => doc38.data());
8543
8698
  }
8544
8699
  async function updateClinic(db, clinicId, data, adminId, clinicAdminService, app) {
@@ -8727,12 +8882,12 @@ async function getClinicsByAdmin(db, adminId, options = {}, clinicAdminService,
8727
8882
  if (clinicIds.length === 0) {
8728
8883
  return [];
8729
8884
  }
8730
- const constraints = [where13("id", "in", clinicIds)];
8885
+ const constraints = [where14("id", "in", clinicIds)];
8731
8886
  if (options.isActive !== void 0) {
8732
- constraints.push(where13("isActive", "==", options.isActive));
8887
+ constraints.push(where14("isActive", "==", options.isActive));
8733
8888
  }
8734
- const q = query13(collection13(db, CLINICS_COLLECTION), ...constraints);
8735
- const querySnapshot = await getDocs13(q);
8889
+ const q = query14(collection14(db, CLINICS_COLLECTION), ...constraints);
8890
+ const querySnapshot = await getDocs14(q);
8736
8891
  return querySnapshot.docs.map((doc38) => doc38.data());
8737
8892
  }
8738
8893
  async function getActiveClinicsByAdmin(db, adminId, clinicAdminService, clinicGroupService) {
@@ -8763,20 +8918,20 @@ async function getClinicById(db, clinicId) {
8763
8918
  }
8764
8919
  async function getAllClinics(db, pagination, lastDoc) {
8765
8920
  try {
8766
- const clinicsCollection = collection13(db, CLINICS_COLLECTION);
8767
- let clinicsQuery = query13(clinicsCollection);
8921
+ const clinicsCollection = collection14(db, CLINICS_COLLECTION);
8922
+ let clinicsQuery = query14(clinicsCollection);
8768
8923
  if (pagination && pagination > 0) {
8769
8924
  if (lastDoc) {
8770
- clinicsQuery = query13(
8925
+ clinicsQuery = query14(
8771
8926
  clinicsCollection,
8772
- startAfter7(lastDoc),
8773
- limit8(pagination)
8927
+ startAfter8(lastDoc),
8928
+ limit9(pagination)
8774
8929
  );
8775
8930
  } else {
8776
- clinicsQuery = query13(clinicsCollection, limit8(pagination));
8931
+ clinicsQuery = query14(clinicsCollection, limit9(pagination));
8777
8932
  }
8778
8933
  }
8779
- const clinicsSnapshot = await getDocs13(clinicsQuery);
8934
+ const clinicsSnapshot = await getDocs14(clinicsQuery);
8780
8935
  const lastVisible = clinicsSnapshot.docs[clinicsSnapshot.docs.length - 1];
8781
8936
  const clinics = clinicsSnapshot.docs.map((doc38) => {
8782
8937
  const data = doc38.data();
@@ -8803,12 +8958,12 @@ async function getAllClinicsInRange(db, center, rangeInKm, pagination, lastDoc)
8803
8958
  let lastDocSnapshot = null;
8804
8959
  for (const b of bounds) {
8805
8960
  const constraints = [
8806
- where13("location.geohash", ">=", b[0]),
8807
- where13("location.geohash", "<=", b[1]),
8808
- where13("isActive", "==", true)
8961
+ where14("location.geohash", ">=", b[0]),
8962
+ where14("location.geohash", "<=", b[1]),
8963
+ where14("isActive", "==", true)
8809
8964
  ];
8810
- const q = query13(collection13(db, CLINICS_COLLECTION), ...constraints);
8811
- const querySnapshot = await getDocs13(q);
8965
+ const q = query14(collection14(db, CLINICS_COLLECTION), ...constraints);
8966
+ const querySnapshot = await getDocs14(q);
8812
8967
  for (const doc38 of querySnapshot.docs) {
8813
8968
  const clinic = doc38.data();
8814
8969
  const distance = distanceBetween2(
@@ -8904,10 +9059,10 @@ async function removeTags(db, clinicId, adminId, tagsToRemove, clinicAdminServic
8904
9059
 
8905
9060
  // src/services/clinic/utils/search.utils.ts
8906
9061
  import {
8907
- collection as collection14,
8908
- query as query14,
8909
- where as where14,
8910
- getDocs as getDocs14
9062
+ collection as collection15,
9063
+ query as query15,
9064
+ where as where15,
9065
+ getDocs as getDocs15
8911
9066
  } from "firebase/firestore";
8912
9067
  import { geohashQueryBounds as geohashQueryBounds2, distanceBetween as distanceBetween3 } from "geofire-common";
8913
9068
  async function findClinicsInRadius(db, center, radiusInKm, filters) {
@@ -8918,20 +9073,20 @@ async function findClinicsInRadius(db, center, radiusInKm, filters) {
8918
9073
  const matchingDocs = [];
8919
9074
  for (const b of bounds) {
8920
9075
  const constraints = [
8921
- where14("location.geohash", ">=", b[0]),
8922
- where14("location.geohash", "<=", b[1]),
8923
- where14("isActive", "==", true)
9076
+ where15("location.geohash", ">=", b[0]),
9077
+ where15("location.geohash", "<=", b[1]),
9078
+ where15("isActive", "==", true)
8924
9079
  ];
8925
9080
  if (filters == null ? void 0 : filters.services) {
8926
9081
  constraints.push(
8927
- where14("services", "array-contains-any", filters.services)
9082
+ where15("services", "array-contains-any", filters.services)
8928
9083
  );
8929
9084
  }
8930
9085
  if ((filters == null ? void 0 : filters.tags) && filters.tags.length > 0) {
8931
- constraints.push(where14("tags", "array-contains-any", filters.tags));
9086
+ constraints.push(where15("tags", "array-contains-any", filters.tags));
8932
9087
  }
8933
- const q = query14(collection14(db, CLINICS_COLLECTION), ...constraints);
8934
- const querySnapshot = await getDocs14(q);
9088
+ const q = query15(collection15(db, CLINICS_COLLECTION), ...constraints);
9089
+ const querySnapshot = await getDocs15(q);
8935
9090
  for (const doc38 of querySnapshot.docs) {
8936
9091
  const clinic = doc38.data();
8937
9092
  const distance = distanceBetween3(
@@ -8959,13 +9114,13 @@ async function findClinicsInRadius(db, center, radiusInKm, filters) {
8959
9114
 
8960
9115
  // src/services/clinic/utils/filter.utils.ts
8961
9116
  import {
8962
- collection as collection15,
8963
- query as query15,
8964
- where as where15,
8965
- getDocs as getDocs15,
8966
- startAfter as startAfter8,
8967
- limit as limit9,
8968
- orderBy as orderBy5
9117
+ collection as collection16,
9118
+ query as query16,
9119
+ where as where16,
9120
+ getDocs as getDocs16,
9121
+ startAfter as startAfter9,
9122
+ limit as limit10,
9123
+ orderBy as orderBy6
8969
9124
  } from "firebase/firestore";
8970
9125
  import { geohashQueryBounds as geohashQueryBounds3, distanceBetween as distanceBetween4 } from "geofire-common";
8971
9126
  async function getClinicsByFilters(db, filters) {
@@ -8994,15 +9149,15 @@ async function getClinicsByFilters(db, filters) {
8994
9149
  const collected = [];
8995
9150
  for (const b of bounds) {
8996
9151
  const constraints = [
8997
- where15("location.geohash", ">=", b[0]),
8998
- where15("location.geohash", "<=", b[1]),
8999
- where15("isActive", "==", (_a = filters.isActive) != null ? _a : true)
9152
+ where16("location.geohash", ">=", b[0]),
9153
+ where16("location.geohash", "<=", b[1]),
9154
+ where16("isActive", "==", (_a = filters.isActive) != null ? _a : true)
9000
9155
  ];
9001
9156
  if (filters.tags && filters.tags.length > 0) {
9002
- constraints.push(where15("tags", "array-contains", filters.tags[0]));
9157
+ constraints.push(where16("tags", "array-contains", filters.tags[0]));
9003
9158
  }
9004
- const q0 = query15(collection15(db, CLINICS_COLLECTION), ...constraints);
9005
- const snap = await getDocs15(q0);
9159
+ const q0 = query16(collection16(db, CLINICS_COLLECTION), ...constraints);
9160
+ const snap = await getDocs16(q0);
9006
9161
  snap.docs.forEach((d) => collected.push({ ...d.data(), id: d.id }));
9007
9162
  }
9008
9163
  const uniqueMap = /* @__PURE__ */ new Map();
@@ -9030,15 +9185,15 @@ async function getClinicsByFilters(db, filters) {
9030
9185
  const getBaseConstraints = () => {
9031
9186
  var _a2;
9032
9187
  const constraints = [];
9033
- constraints.push(where15("isActive", "==", (_a2 = filters.isActive) != null ? _a2 : true));
9188
+ constraints.push(where16("isActive", "==", (_a2 = filters.isActive) != null ? _a2 : true));
9034
9189
  if (filters.tags && filters.tags.length > 0) {
9035
- constraints.push(where15("tags", "array-contains", filters.tags[0]));
9190
+ constraints.push(where16("tags", "array-contains", filters.tags[0]));
9036
9191
  }
9037
9192
  if (filters.minRating !== void 0) {
9038
- constraints.push(where15("reviewInfo.averageRating", ">=", filters.minRating));
9193
+ constraints.push(where16("reviewInfo.averageRating", ">=", filters.minRating));
9039
9194
  }
9040
9195
  if (filters.maxRating !== void 0) {
9041
- constraints.push(where15("reviewInfo.averageRating", "<=", filters.maxRating));
9196
+ constraints.push(where16("reviewInfo.averageRating", "<=", filters.maxRating));
9042
9197
  }
9043
9198
  return constraints;
9044
9199
  };
@@ -9047,21 +9202,21 @@ async function getClinicsByFilters(db, filters) {
9047
9202
  console.log("[CLINIC_SERVICE] Strategy 1: Trying nameLower search");
9048
9203
  const searchTerm = filters.nameSearch.trim().toLowerCase();
9049
9204
  const constraints = getBaseConstraints();
9050
- constraints.push(where15("nameLower", ">=", searchTerm));
9051
- constraints.push(where15("nameLower", "<=", searchTerm + "\uF8FF"));
9052
- constraints.push(orderBy5("nameLower"));
9205
+ constraints.push(where16("nameLower", ">=", searchTerm));
9206
+ constraints.push(where16("nameLower", "<=", searchTerm + "\uF8FF"));
9207
+ constraints.push(orderBy6("nameLower"));
9053
9208
  if (filters.lastDoc) {
9054
9209
  if (typeof filters.lastDoc.data === "function") {
9055
- constraints.push(startAfter8(filters.lastDoc));
9210
+ constraints.push(startAfter9(filters.lastDoc));
9056
9211
  } else if (Array.isArray(filters.lastDoc)) {
9057
- constraints.push(startAfter8(...filters.lastDoc));
9212
+ constraints.push(startAfter9(...filters.lastDoc));
9058
9213
  } else {
9059
- constraints.push(startAfter8(filters.lastDoc));
9214
+ constraints.push(startAfter9(filters.lastDoc));
9060
9215
  }
9061
9216
  }
9062
- constraints.push(limit9(filters.pagination || 5));
9063
- const q = query15(collection15(db, CLINICS_COLLECTION), ...constraints);
9064
- const querySnapshot = await getDocs15(q);
9217
+ constraints.push(limit10(filters.pagination || 5));
9218
+ const q = query16(collection16(db, CLINICS_COLLECTION), ...constraints);
9219
+ const querySnapshot = await getDocs16(q);
9065
9220
  let clinics = querySnapshot.docs.map((doc38) => ({ ...doc38.data(), id: doc38.id }));
9066
9221
  clinics = applyInMemoryFilters(clinics, filters);
9067
9222
  const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
@@ -9079,21 +9234,21 @@ async function getClinicsByFilters(db, filters) {
9079
9234
  console.log("[CLINIC_SERVICE] Strategy 2: Trying name field search");
9080
9235
  const searchTerm = filters.nameSearch.trim().toLowerCase();
9081
9236
  const constraints = getBaseConstraints();
9082
- constraints.push(where15("name", ">=", searchTerm));
9083
- constraints.push(where15("name", "<=", searchTerm + "\uF8FF"));
9084
- constraints.push(orderBy5("name"));
9237
+ constraints.push(where16("name", ">=", searchTerm));
9238
+ constraints.push(where16("name", "<=", searchTerm + "\uF8FF"));
9239
+ constraints.push(orderBy6("name"));
9085
9240
  if (filters.lastDoc) {
9086
9241
  if (typeof filters.lastDoc.data === "function") {
9087
- constraints.push(startAfter8(filters.lastDoc));
9242
+ constraints.push(startAfter9(filters.lastDoc));
9088
9243
  } else if (Array.isArray(filters.lastDoc)) {
9089
- constraints.push(startAfter8(...filters.lastDoc));
9244
+ constraints.push(startAfter9(...filters.lastDoc));
9090
9245
  } else {
9091
- constraints.push(startAfter8(filters.lastDoc));
9246
+ constraints.push(startAfter9(filters.lastDoc));
9092
9247
  }
9093
9248
  }
9094
- constraints.push(limit9(filters.pagination || 5));
9095
- const q = query15(collection15(db, CLINICS_COLLECTION), ...constraints);
9096
- const querySnapshot = await getDocs15(q);
9249
+ constraints.push(limit10(filters.pagination || 5));
9250
+ const q = query16(collection16(db, CLINICS_COLLECTION), ...constraints);
9251
+ const querySnapshot = await getDocs16(q);
9097
9252
  let clinics = querySnapshot.docs.map((doc38) => ({ ...doc38.data(), id: doc38.id }));
9098
9253
  clinics = applyInMemoryFilters(clinics, filters);
9099
9254
  const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
@@ -9111,19 +9266,19 @@ async function getClinicsByFilters(db, filters) {
9111
9266
  "[CLINIC_SERVICE] Strategy 3: Using createdAt ordering with client-side filtering"
9112
9267
  );
9113
9268
  const constraints = getBaseConstraints();
9114
- constraints.push(orderBy5("createdAt", "desc"));
9269
+ constraints.push(orderBy6("createdAt", "desc"));
9115
9270
  if (filters.lastDoc) {
9116
9271
  if (typeof filters.lastDoc.data === "function") {
9117
- constraints.push(startAfter8(filters.lastDoc));
9272
+ constraints.push(startAfter9(filters.lastDoc));
9118
9273
  } else if (Array.isArray(filters.lastDoc)) {
9119
- constraints.push(startAfter8(...filters.lastDoc));
9274
+ constraints.push(startAfter9(...filters.lastDoc));
9120
9275
  } else {
9121
- constraints.push(startAfter8(filters.lastDoc));
9276
+ constraints.push(startAfter9(filters.lastDoc));
9122
9277
  }
9123
9278
  }
9124
- constraints.push(limit9(filters.pagination || 5));
9125
- const q = query15(collection15(db, CLINICS_COLLECTION), ...constraints);
9126
- const querySnapshot = await getDocs15(q);
9279
+ constraints.push(limit10(filters.pagination || 5));
9280
+ const q = query16(collection16(db, CLINICS_COLLECTION), ...constraints);
9281
+ const querySnapshot = await getDocs16(q);
9127
9282
  let clinics = querySnapshot.docs.map((doc38) => ({ ...doc38.data(), id: doc38.id }));
9128
9283
  clinics = applyInMemoryFilters(clinics, filters);
9129
9284
  const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
@@ -9138,12 +9293,12 @@ async function getClinicsByFilters(db, filters) {
9138
9293
  try {
9139
9294
  console.log("[CLINIC_SERVICE] Strategy 4: Minimal fallback");
9140
9295
  const constraints = [
9141
- where15("isActive", "==", true),
9142
- orderBy5("createdAt", "desc"),
9143
- limit9(filters.pagination || 5)
9296
+ where16("isActive", "==", true),
9297
+ orderBy6("createdAt", "desc"),
9298
+ limit10(filters.pagination || 5)
9144
9299
  ];
9145
- const q = query15(collection15(db, CLINICS_COLLECTION), ...constraints);
9146
- const querySnapshot = await getDocs15(q);
9300
+ const q = query16(collection16(db, CLINICS_COLLECTION), ...constraints);
9301
+ const querySnapshot = await getDocs16(q);
9147
9302
  let clinics = querySnapshot.docs.map((doc38) => ({ ...doc38.data(), id: doc38.id }));
9148
9303
  clinics = applyInMemoryFilters(clinics, filters);
9149
9304
  const lastDoc = querySnapshot.docs.length > 0 ? querySnapshot.docs[querySnapshot.docs.length - 1] : null;
@@ -9718,8 +9873,8 @@ var ClinicService = class extends BaseService {
9718
9873
  * @returns Array of minimal clinic info for map
9719
9874
  */
9720
9875
  async getClinicsForMap() {
9721
- const clinicsRef = collection16(this.db, CLINICS_COLLECTION);
9722
- const snapshot = await getDocs16(clinicsRef);
9876
+ const clinicsRef = collection17(this.db, CLINICS_COLLECTION);
9877
+ const snapshot = await getDocs17(clinicsRef);
9723
9878
  const clinicsForMap = snapshot.docs.map((doc38) => {
9724
9879
  var _a, _b, _c;
9725
9880
  const data = doc38.data();
@@ -10068,9 +10223,9 @@ var AuthService = class extends BaseService {
10068
10223
  token: data.inviteToken
10069
10224
  });
10070
10225
  console.log("[AUTH] Searching for token in clinic groups");
10071
- const groupsRef = collection17(this.db, CLINIC_GROUPS_COLLECTION);
10072
- const q = query17(groupsRef);
10073
- const querySnapshot = await getDocs17(q);
10226
+ const groupsRef = collection18(this.db, CLINIC_GROUPS_COLLECTION);
10227
+ const q = query18(groupsRef);
10228
+ const querySnapshot = await getDocs18(q);
10074
10229
  let foundGroup = null;
10075
10230
  let foundToken = null;
10076
10231
  console.log(
@@ -10721,26 +10876,26 @@ import { Timestamp as Timestamp26, serverTimestamp as serverTimestamp20 } from "
10721
10876
  import {
10722
10877
  doc as doc23,
10723
10878
  getDoc as getDoc25,
10724
- collection as collection23,
10725
- query as query23,
10726
- where as where23,
10727
- getDocs as getDocs23,
10879
+ collection as collection24,
10880
+ query as query24,
10881
+ where as where24,
10882
+ getDocs as getDocs24,
10728
10883
  setDoc as setDoc21,
10729
10884
  updateDoc as updateDoc22
10730
10885
  } from "firebase/firestore";
10731
10886
 
10732
10887
  // src/services/calendar/utils/clinic.utils.ts
10733
10888
  import {
10734
- collection as collection18,
10889
+ collection as collection19,
10735
10890
  doc as doc18,
10736
10891
  getDoc as getDoc20,
10737
- getDocs as getDocs18,
10892
+ getDocs as getDocs19,
10738
10893
  setDoc as setDoc16,
10739
10894
  updateDoc as updateDoc17,
10740
10895
  deleteDoc as deleteDoc9,
10741
- query as query18,
10742
- where as where18,
10743
- orderBy as orderBy7,
10896
+ query as query19,
10897
+ where as where19,
10898
+ orderBy as orderBy8,
10744
10899
  Timestamp as Timestamp20,
10745
10900
  serverTimestamp as serverTimestamp15
10746
10901
  } from "firebase/firestore";
@@ -10836,15 +10991,15 @@ async function checkAutoConfirmAppointmentsUtil(db, clinicId) {
10836
10991
 
10837
10992
  // src/services/calendar/utils/patient.utils.ts
10838
10993
  import {
10839
- collection as collection19,
10994
+ collection as collection20,
10840
10995
  getDoc as getDoc21,
10841
- getDocs as getDocs19,
10996
+ getDocs as getDocs20,
10842
10997
  setDoc as setDoc17,
10843
10998
  updateDoc as updateDoc18,
10844
10999
  deleteDoc as deleteDoc10,
10845
- query as query19,
10846
- where as where19,
10847
- orderBy as orderBy8,
11000
+ query as query20,
11001
+ where as where20,
11002
+ orderBy as orderBy9,
10848
11003
  Timestamp as Timestamp21,
10849
11004
  serverTimestamp as serverTimestamp16
10850
11005
  } from "firebase/firestore";
@@ -10880,15 +11035,15 @@ async function updatePatientCalendarEventUtil(db, patientId, eventId, updateData
10880
11035
 
10881
11036
  // src/services/calendar/utils/practitioner.utils.ts
10882
11037
  import {
10883
- collection as collection20,
11038
+ collection as collection21,
10884
11039
  getDoc as getDoc22,
10885
- getDocs as getDocs20,
11040
+ getDocs as getDocs21,
10886
11041
  setDoc as setDoc18,
10887
11042
  updateDoc as updateDoc19,
10888
11043
  deleteDoc as deleteDoc11,
10889
- query as query20,
10890
- where as where20,
10891
- orderBy as orderBy9,
11044
+ query as query21,
11045
+ where as where21,
11046
+ orderBy as orderBy10,
10892
11047
  Timestamp as Timestamp22,
10893
11048
  serverTimestamp as serverTimestamp17
10894
11049
  } from "firebase/firestore";
@@ -10982,16 +11137,16 @@ async function updateAppointmentUtil2(db, clinicId, practitionerId, patientId, e
10982
11137
 
10983
11138
  // src/services/calendar/utils/calendar-event.utils.ts
10984
11139
  import {
10985
- collection as collection21,
11140
+ collection as collection22,
10986
11141
  doc as doc21,
10987
11142
  getDoc as getDoc23,
10988
- getDocs as getDocs21,
11143
+ getDocs as getDocs22,
10989
11144
  setDoc as setDoc19,
10990
11145
  updateDoc as updateDoc20,
10991
11146
  deleteDoc as deleteDoc12,
10992
- query as query21,
10993
- where as where21,
10994
- orderBy as orderBy10,
11147
+ query as query22,
11148
+ where as where22,
11149
+ orderBy as orderBy11,
10995
11150
  Timestamp as Timestamp23,
10996
11151
  serverTimestamp as serverTimestamp18
10997
11152
  } from "firebase/firestore";
@@ -11037,7 +11192,7 @@ async function searchCalendarEventsUtil(db, params) {
11037
11192
  );
11038
11193
  }
11039
11194
  baseCollectionPath = `${CLINICS_COLLECTION}/${entityId}/${CALENDAR_COLLECTION}`;
11040
- constraints.push(where21("clinicBranchId", "==", entityId));
11195
+ constraints.push(where22("clinicBranchId", "==", entityId));
11041
11196
  if (filters.clinicId && filters.clinicId !== entityId) {
11042
11197
  console.warn(
11043
11198
  `Provided clinicId filter (${filters.clinicId}) does not match search entityId (${entityId}). Returning empty results.`
@@ -11049,34 +11204,34 @@ async function searchCalendarEventsUtil(db, params) {
11049
11204
  default:
11050
11205
  throw new Error(`Invalid search location: ${searchLocation}`);
11051
11206
  }
11052
- const collectionRef = collection21(db, baseCollectionPath);
11207
+ const collectionRef = collection22(db, baseCollectionPath);
11053
11208
  if (filters.clinicId) {
11054
- constraints.push(where21("clinicBranchId", "==", filters.clinicId));
11209
+ constraints.push(where22("clinicBranchId", "==", filters.clinicId));
11055
11210
  }
11056
11211
  if (filters.practitionerId) {
11057
11212
  constraints.push(
11058
- where21("practitionerProfileId", "==", filters.practitionerId)
11213
+ where22("practitionerProfileId", "==", filters.practitionerId)
11059
11214
  );
11060
11215
  }
11061
11216
  if (filters.patientId) {
11062
- constraints.push(where21("patientProfileId", "==", filters.patientId));
11217
+ constraints.push(where22("patientProfileId", "==", filters.patientId));
11063
11218
  }
11064
11219
  if (filters.procedureId) {
11065
- constraints.push(where21("procedureId", "==", filters.procedureId));
11220
+ constraints.push(where22("procedureId", "==", filters.procedureId));
11066
11221
  }
11067
11222
  if (filters.eventStatus) {
11068
- constraints.push(where21("status", "==", filters.eventStatus));
11223
+ constraints.push(where22("status", "==", filters.eventStatus));
11069
11224
  }
11070
11225
  if (filters.eventType) {
11071
- constraints.push(where21("eventType", "==", filters.eventType));
11226
+ constraints.push(where22("eventType", "==", filters.eventType));
11072
11227
  }
11073
11228
  if (filters.dateRange) {
11074
- constraints.push(where21("eventTime.start", ">=", filters.dateRange.start));
11075
- constraints.push(where21("eventTime.start", "<=", filters.dateRange.end));
11229
+ constraints.push(where22("eventTime.start", ">=", filters.dateRange.start));
11230
+ constraints.push(where22("eventTime.start", "<=", filters.dateRange.end));
11076
11231
  }
11077
11232
  try {
11078
- const finalQuery = query21(collectionRef, ...constraints);
11079
- const querySnapshot = await getDocs21(finalQuery);
11233
+ const finalQuery = query22(collectionRef, ...constraints);
11234
+ const querySnapshot = await getDocs22(finalQuery);
11080
11235
  const events = querySnapshot.docs.map(
11081
11236
  (doc38) => ({ id: doc38.id, ...doc38.data() })
11082
11237
  );
@@ -11089,14 +11244,14 @@ async function searchCalendarEventsUtil(db, params) {
11089
11244
 
11090
11245
  // src/services/calendar/utils/synced-calendar.utils.ts
11091
11246
  import {
11092
- collection as collection22,
11247
+ collection as collection23,
11093
11248
  getDoc as getDoc24,
11094
- getDocs as getDocs22,
11249
+ getDocs as getDocs23,
11095
11250
  setDoc as setDoc20,
11096
11251
  updateDoc as updateDoc21,
11097
11252
  deleteDoc as deleteDoc13,
11098
- query as query22,
11099
- orderBy as orderBy11,
11253
+ query as query23,
11254
+ orderBy as orderBy12,
11100
11255
  Timestamp as Timestamp24,
11101
11256
  serverTimestamp as serverTimestamp19
11102
11257
  } from "firebase/firestore";
@@ -11165,12 +11320,12 @@ async function getPractitionerSyncedCalendarUtil(db, practitionerId, calendarId)
11165
11320
  return calendarDoc.data();
11166
11321
  }
11167
11322
  async function getPractitionerSyncedCalendarsUtil(db, practitionerId) {
11168
- const calendarsRef = collection22(
11323
+ const calendarsRef = collection23(
11169
11324
  db,
11170
11325
  `practitioners/${practitionerId}/${SYNCED_CALENDARS_COLLECTION}`
11171
11326
  );
11172
- const q = query22(calendarsRef, orderBy11("createdAt", "desc"));
11173
- const querySnapshot = await getDocs22(q);
11327
+ const q = query23(calendarsRef, orderBy12("createdAt", "desc"));
11328
+ const querySnapshot = await getDocs23(q);
11174
11329
  return querySnapshot.docs.map((doc38) => doc38.data());
11175
11330
  }
11176
11331
  async function getPatientSyncedCalendarUtil(db, patientId, calendarId) {
@@ -11182,12 +11337,12 @@ async function getPatientSyncedCalendarUtil(db, patientId, calendarId) {
11182
11337
  return calendarDoc.data();
11183
11338
  }
11184
11339
  async function getPatientSyncedCalendarsUtil(db, patientId) {
11185
- const calendarsRef = collection22(
11340
+ const calendarsRef = collection23(
11186
11341
  db,
11187
11342
  `patients/${patientId}/${SYNCED_CALENDARS_COLLECTION}`
11188
11343
  );
11189
- const q = query22(calendarsRef, orderBy11("createdAt", "desc"));
11190
- const querySnapshot = await getDocs22(q);
11344
+ const q = query23(calendarsRef, orderBy12("createdAt", "desc"));
11345
+ const querySnapshot = await getDocs23(q);
11191
11346
  return querySnapshot.docs.map((doc38) => doc38.data());
11192
11347
  }
11193
11348
  async function getClinicSyncedCalendarUtil(db, clinicId, calendarId) {
@@ -11199,12 +11354,12 @@ async function getClinicSyncedCalendarUtil(db, clinicId, calendarId) {
11199
11354
  return calendarDoc.data();
11200
11355
  }
11201
11356
  async function getClinicSyncedCalendarsUtil(db, clinicId) {
11202
- const calendarsRef = collection22(
11357
+ const calendarsRef = collection23(
11203
11358
  db,
11204
11359
  `clinics/${clinicId}/${SYNCED_CALENDARS_COLLECTION}`
11205
11360
  );
11206
- const q = query22(calendarsRef, orderBy11("createdAt", "desc"));
11207
- const querySnapshot = await getDocs22(q);
11361
+ const q = query23(calendarsRef, orderBy12("createdAt", "desc"));
11362
+ const querySnapshot = await getDocs23(q);
11208
11363
  return querySnapshot.docs.map((doc38) => doc38.data());
11209
11364
  }
11210
11365
  async function updatePractitionerSyncedCalendarUtil(db, practitionerId, calendarId, updateData) {
@@ -12488,8 +12643,8 @@ var CalendarServiceV2 = class extends BaseService {
12488
12643
  */
12489
12644
  async synchronizeExternalCalendars(lookbackDays = 7, lookforwardDays = 30) {
12490
12645
  try {
12491
- const practitionersRef = collection23(this.db, PRACTITIONERS_COLLECTION);
12492
- const practitionersSnapshot = await getDocs23(practitionersRef);
12646
+ const practitionersRef = collection24(this.db, PRACTITIONERS_COLLECTION);
12647
+ const practitionersSnapshot = await getDocs24(practitionersRef);
12493
12648
  const startDate = /* @__PURE__ */ new Date();
12494
12649
  startDate.setDate(startDate.getDate() - lookbackDays);
12495
12650
  const endDate = /* @__PURE__ */ new Date();
@@ -12547,19 +12702,19 @@ var CalendarServiceV2 = class extends BaseService {
12547
12702
  async updateExistingEventsFromExternalCalendars(doctorId, startDate, endDate) {
12548
12703
  var _a;
12549
12704
  try {
12550
- const eventsRef = collection23(
12705
+ const eventsRef = collection24(
12551
12706
  this.db,
12552
12707
  PRACTITIONERS_COLLECTION,
12553
12708
  doctorId,
12554
12709
  CALENDAR_COLLECTION
12555
12710
  );
12556
- const q = query23(
12711
+ const q = query24(
12557
12712
  eventsRef,
12558
- where23("syncStatus", "==", "external" /* EXTERNAL */),
12559
- where23("eventTime.start", ">=", Timestamp26.fromDate(startDate)),
12560
- where23("eventTime.start", "<=", Timestamp26.fromDate(endDate))
12713
+ where24("syncStatus", "==", "external" /* EXTERNAL */),
12714
+ where24("eventTime.start", ">=", Timestamp26.fromDate(startDate)),
12715
+ where24("eventTime.start", "<=", Timestamp26.fromDate(endDate))
12561
12716
  );
12562
- const eventsSnapshot = await getDocs23(q);
12717
+ const eventsSnapshot = await getDocs24(q);
12563
12718
  const events = eventsSnapshot.docs.map((doc38) => ({
12564
12719
  id: doc38.id,
12565
12720
  ...doc38.data()
@@ -13184,18 +13339,18 @@ var CalendarServiceV2 = class extends BaseService {
13184
13339
  startOfDay.setHours(0, 0, 0, 0);
13185
13340
  const endOfDay = new Date(date);
13186
13341
  endOfDay.setHours(23, 59, 59, 999);
13187
- const appointmentsRef = collection23(this.db, CALENDAR_COLLECTION);
13188
- const q = query23(
13342
+ const appointmentsRef = collection24(this.db, CALENDAR_COLLECTION);
13343
+ const q = query24(
13189
13344
  appointmentsRef,
13190
- where23("practitionerProfileId", "==", doctorId),
13191
- where23("eventTime.start", ">=", Timestamp26.fromDate(startOfDay)),
13192
- where23("eventTime.start", "<=", Timestamp26.fromDate(endOfDay)),
13193
- where23("status", "in", [
13345
+ where24("practitionerProfileId", "==", doctorId),
13346
+ where24("eventTime.start", ">=", Timestamp26.fromDate(startOfDay)),
13347
+ where24("eventTime.start", "<=", Timestamp26.fromDate(endOfDay)),
13348
+ where24("status", "in", [
13194
13349
  "confirmed" /* CONFIRMED */,
13195
13350
  "pending" /* PENDING */
13196
13351
  ])
13197
13352
  );
13198
- const querySnapshot = await getDocs23(q);
13353
+ const querySnapshot = await getDocs24(q);
13199
13354
  return querySnapshot.docs.map((doc38) => doc38.data());
13200
13355
  }
13201
13356
  /**
@@ -13624,19 +13779,19 @@ var ExternalCalendarService = class extends BaseService {
13624
13779
 
13625
13780
  // src/services/clinic/practitioner-invite.service.ts
13626
13781
  import {
13627
- collection as collection24,
13782
+ collection as collection25,
13628
13783
  doc as doc25,
13629
13784
  getDoc as getDoc27,
13630
- getDocs as getDocs24,
13631
- query as query24,
13632
- where as where24,
13785
+ getDocs as getDocs25,
13786
+ query as query25,
13787
+ where as where25,
13633
13788
  updateDoc as updateDoc24,
13634
13789
  setDoc as setDoc23,
13635
13790
  deleteDoc as deleteDoc15,
13636
13791
  Timestamp as Timestamp28,
13637
13792
  serverTimestamp as serverTimestamp22,
13638
- orderBy as orderBy12,
13639
- limit as limit11
13793
+ orderBy as orderBy13,
13794
+ limit as limit12
13640
13795
  } from "firebase/firestore";
13641
13796
  var PractitionerInviteService = class extends BaseService {
13642
13797
  constructor(db, auth, app) {
@@ -13730,17 +13885,17 @@ var PractitionerInviteService = class extends BaseService {
13730
13885
  async getAllInvitesDoctor(practitionerId, statusFilter) {
13731
13886
  try {
13732
13887
  const constraints = [
13733
- where24("practitionerId", "==", practitionerId),
13734
- orderBy12("createdAt", "desc")
13888
+ where25("practitionerId", "==", practitionerId),
13889
+ orderBy13("createdAt", "desc")
13735
13890
  ];
13736
13891
  if (statusFilter && statusFilter.length > 0) {
13737
- constraints.push(where24("status", "in", statusFilter));
13892
+ constraints.push(where25("status", "in", statusFilter));
13738
13893
  }
13739
- const q = query24(
13740
- collection24(this.db, PRACTITIONER_INVITES_COLLECTION),
13894
+ const q = query25(
13895
+ collection25(this.db, PRACTITIONER_INVITES_COLLECTION),
13741
13896
  ...constraints
13742
13897
  );
13743
- const querySnapshot = await getDocs24(q);
13898
+ const querySnapshot = await getDocs25(q);
13744
13899
  return querySnapshot.docs.map((doc38) => doc38.data());
13745
13900
  } catch (error) {
13746
13901
  console.error(
@@ -13759,17 +13914,17 @@ var PractitionerInviteService = class extends BaseService {
13759
13914
  async getAllInvitesClinic(clinicId, statusFilter) {
13760
13915
  try {
13761
13916
  const constraints = [
13762
- where24("clinicId", "==", clinicId),
13763
- orderBy12("createdAt", "desc")
13917
+ where25("clinicId", "==", clinicId),
13918
+ orderBy13("createdAt", "desc")
13764
13919
  ];
13765
13920
  if (statusFilter && statusFilter.length > 0) {
13766
- constraints.push(where24("status", "in", statusFilter));
13921
+ constraints.push(where25("status", "in", statusFilter));
13767
13922
  }
13768
- const q = query24(
13769
- collection24(this.db, PRACTITIONER_INVITES_COLLECTION),
13923
+ const q = query25(
13924
+ collection25(this.db, PRACTITIONER_INVITES_COLLECTION),
13770
13925
  ...constraints
13771
13926
  );
13772
- const querySnapshot = await getDocs24(q);
13927
+ const querySnapshot = await getDocs25(q);
13773
13928
  return querySnapshot.docs.map((doc38) => doc38.data());
13774
13929
  } catch (error) {
13775
13930
  console.error(
@@ -13903,28 +14058,28 @@ var PractitionerInviteService = class extends BaseService {
13903
14058
  try {
13904
14059
  const constraints = [];
13905
14060
  if (filters.practitionerId) {
13906
- constraints.push(where24("practitionerId", "==", filters.practitionerId));
14061
+ constraints.push(where25("practitionerId", "==", filters.practitionerId));
13907
14062
  }
13908
14063
  if (filters.clinicId) {
13909
- constraints.push(where24("clinicId", "==", filters.clinicId));
14064
+ constraints.push(where25("clinicId", "==", filters.clinicId));
13910
14065
  }
13911
14066
  if (filters.invitedBy) {
13912
- constraints.push(where24("invitedBy", "==", filters.invitedBy));
14067
+ constraints.push(where25("invitedBy", "==", filters.invitedBy));
13913
14068
  }
13914
14069
  if (filters.status && filters.status.length > 0) {
13915
- constraints.push(where24("status", "in", filters.status));
14070
+ constraints.push(where25("status", "in", filters.status));
13916
14071
  }
13917
14072
  const orderField = filters.orderBy || "createdAt";
13918
14073
  const orderDirection = filters.orderDirection || "desc";
13919
- constraints.push(orderBy12(orderField, orderDirection));
14074
+ constraints.push(orderBy13(orderField, orderDirection));
13920
14075
  if (filters.limit) {
13921
- constraints.push(limit11(filters.limit));
14076
+ constraints.push(limit12(filters.limit));
13922
14077
  }
13923
- const q = query24(
13924
- collection24(this.db, PRACTITIONER_INVITES_COLLECTION),
14078
+ const q = query25(
14079
+ collection25(this.db, PRACTITIONER_INVITES_COLLECTION),
13925
14080
  ...constraints
13926
14081
  );
13927
- const querySnapshot = await getDocs24(q);
14082
+ const querySnapshot = await getDocs25(q);
13928
14083
  let invites = querySnapshot.docs.map(
13929
14084
  (doc38) => doc38.data()
13930
14085
  );
@@ -14005,14 +14160,14 @@ var PractitionerInviteService = class extends BaseService {
14005
14160
  */
14006
14161
  async findExistingInvite(practitionerId, clinicId) {
14007
14162
  try {
14008
- const q = query24(
14009
- collection24(this.db, PRACTITIONER_INVITES_COLLECTION),
14010
- where24("practitionerId", "==", practitionerId),
14011
- where24("clinicId", "==", clinicId),
14012
- orderBy12("createdAt", "desc"),
14013
- limit11(1)
14014
- );
14015
- const querySnapshot = await getDocs24(q);
14163
+ const q = query25(
14164
+ collection25(this.db, PRACTITIONER_INVITES_COLLECTION),
14165
+ where25("practitionerId", "==", practitionerId),
14166
+ where25("clinicId", "==", clinicId),
14167
+ orderBy13("createdAt", "desc"),
14168
+ limit12(1)
14169
+ );
14170
+ const querySnapshot = await getDocs25(q);
14016
14171
  if (querySnapshot.empty) {
14017
14172
  return null;
14018
14173
  }
@@ -14029,24 +14184,24 @@ var PractitionerInviteService = class extends BaseService {
14029
14184
 
14030
14185
  // src/services/documentation-templates/documentation-template.service.ts
14031
14186
  import {
14032
- collection as collection25,
14187
+ collection as collection26,
14033
14188
  doc as doc26,
14034
14189
  getDoc as getDoc28,
14035
- getDocs as getDocs25,
14190
+ getDocs as getDocs26,
14036
14191
  setDoc as setDoc24,
14037
14192
  updateDoc as updateDoc25,
14038
14193
  deleteDoc as deleteDoc16,
14039
- query as query25,
14040
- where as where25,
14041
- orderBy as orderBy13,
14042
- limit as limit12,
14043
- startAfter as startAfter10
14194
+ query as query26,
14195
+ where as where26,
14196
+ orderBy as orderBy14,
14197
+ limit as limit13,
14198
+ startAfter as startAfter11
14044
14199
  } from "firebase/firestore";
14045
14200
  import { getCountFromServer } from "firebase/firestore";
14046
14201
  var DocumentationTemplateService = class extends BaseService {
14047
14202
  constructor(...args) {
14048
14203
  super(...args);
14049
- this.collectionRef = collection25(
14204
+ this.collectionRef = collection26(
14050
14205
  this.db,
14051
14206
  DOCUMENTATION_TEMPLATES_COLLECTION
14052
14207
  );
@@ -14130,7 +14285,7 @@ var DocumentationTemplateService = class extends BaseService {
14130
14285
  if (!template) {
14131
14286
  throw new Error(`Template with ID ${templateId} not found`);
14132
14287
  }
14133
- const versionsCollectionRef = collection25(
14288
+ const versionsCollectionRef = collection26(
14134
14289
  this.db,
14135
14290
  `${DOCUMENTATION_TEMPLATES_COLLECTION}/${templateId}/versions`
14136
14291
  );
@@ -14190,12 +14345,12 @@ var DocumentationTemplateService = class extends BaseService {
14190
14345
  * @returns Array of template versions
14191
14346
  */
14192
14347
  async getTemplateOldVersions(templateId) {
14193
- const versionsCollectionRef = collection25(
14348
+ const versionsCollectionRef = collection26(
14194
14349
  this.db,
14195
14350
  `${DOCUMENTATION_TEMPLATES_COLLECTION}/${templateId}/versions`
14196
14351
  );
14197
- const q = query25(versionsCollectionRef, orderBy13("version", "desc"));
14198
- const querySnapshot = await getDocs25(q);
14352
+ const q = query26(versionsCollectionRef, orderBy14("version", "desc"));
14353
+ const querySnapshot = await getDocs26(q);
14199
14354
  const versions = [];
14200
14355
  querySnapshot.forEach((doc38) => {
14201
14356
  versions.push(doc38.data());
@@ -14217,16 +14372,16 @@ var DocumentationTemplateService = class extends BaseService {
14217
14372
  * @returns Array of templates and the last document for pagination
14218
14373
  */
14219
14374
  async getActiveTemplates(pageSize = 20, lastDoc) {
14220
- let q = query25(
14375
+ let q = query26(
14221
14376
  this.collectionRef,
14222
- where25("isActive", "==", true),
14223
- orderBy13("updatedAt", "desc"),
14224
- limit12(pageSize)
14377
+ where26("isActive", "==", true),
14378
+ orderBy14("updatedAt", "desc"),
14379
+ limit13(pageSize)
14225
14380
  );
14226
14381
  if (lastDoc) {
14227
- q = query25(q, startAfter10(lastDoc));
14382
+ q = query26(q, startAfter11(lastDoc));
14228
14383
  }
14229
- const querySnapshot = await getDocs25(q);
14384
+ const querySnapshot = await getDocs26(q);
14230
14385
  const templates = [];
14231
14386
  let lastVisible = null;
14232
14387
  querySnapshot.forEach((doc38) => {
@@ -14252,25 +14407,25 @@ var DocumentationTemplateService = class extends BaseService {
14252
14407
  sortingOrder
14253
14408
  } = options;
14254
14409
  const constraints = [
14255
- where25("isActive", "==", true),
14256
- orderBy13("sortingOrder", "asc"),
14257
- orderBy13("title", "asc"),
14258
- limit12(pageSize)
14410
+ where26("isActive", "==", true),
14411
+ orderBy14("sortingOrder", "asc"),
14412
+ orderBy14("title", "asc"),
14413
+ limit13(pageSize)
14259
14414
  ];
14260
14415
  if (isUserForm !== void 0) {
14261
- constraints.push(where25("isUserForm", "==", isUserForm));
14416
+ constraints.push(where26("isUserForm", "==", isUserForm));
14262
14417
  }
14263
14418
  if (isRequired !== void 0) {
14264
- constraints.push(where25("isRequired", "==", isRequired));
14419
+ constraints.push(where26("isRequired", "==", isRequired));
14265
14420
  }
14266
14421
  if (sortingOrder !== void 0) {
14267
- constraints.push(where25("sortingOrder", "==", sortingOrder));
14422
+ constraints.push(where26("sortingOrder", "==", sortingOrder));
14268
14423
  }
14269
14424
  if (lastDoc) {
14270
- constraints.push(startAfter10(lastDoc));
14425
+ constraints.push(startAfter11(lastDoc));
14271
14426
  }
14272
- const q = query25(this.collectionRef, ...constraints.filter((c) => c));
14273
- const querySnapshot = await getDocs25(q);
14427
+ const q = query26(this.collectionRef, ...constraints.filter((c) => c));
14428
+ const querySnapshot = await getDocs26(q);
14274
14429
  const templates = [];
14275
14430
  let lastVisible = null;
14276
14431
  querySnapshot.forEach((doc38) => {
@@ -14289,17 +14444,17 @@ var DocumentationTemplateService = class extends BaseService {
14289
14444
  */
14290
14445
  async getTemplatesCount(options) {
14291
14446
  const { isUserForm, isRequired, sortingOrder } = options;
14292
- const constraints = [where25("isActive", "==", true)];
14447
+ const constraints = [where26("isActive", "==", true)];
14293
14448
  if (isUserForm !== void 0) {
14294
- constraints.push(where25("isUserForm", "==", isUserForm));
14449
+ constraints.push(where26("isUserForm", "==", isUserForm));
14295
14450
  }
14296
14451
  if (isRequired !== void 0) {
14297
- constraints.push(where25("isRequired", "==", isRequired));
14452
+ constraints.push(where26("isRequired", "==", isRequired));
14298
14453
  }
14299
14454
  if (sortingOrder !== void 0) {
14300
- constraints.push(where25("sortingOrder", "==", sortingOrder));
14455
+ constraints.push(where26("sortingOrder", "==", sortingOrder));
14301
14456
  }
14302
- const q = query25(this.collectionRef, ...constraints.filter((c) => c));
14457
+ const q = query26(this.collectionRef, ...constraints.filter((c) => c));
14303
14458
  const snapshot = await getCountFromServer(q);
14304
14459
  return snapshot.data().count;
14305
14460
  }
@@ -14308,12 +14463,12 @@ var DocumentationTemplateService = class extends BaseService {
14308
14463
  * @returns A promise that resolves to an array of all active templates.
14309
14464
  */
14310
14465
  async getAllActiveTemplates() {
14311
- const q = query25(
14466
+ const q = query26(
14312
14467
  this.collectionRef,
14313
- where25("isActive", "==", true),
14314
- orderBy13("title", "asc")
14468
+ where26("isActive", "==", true),
14469
+ orderBy14("title", "asc")
14315
14470
  );
14316
- const querySnapshot = await getDocs25(q);
14471
+ const querySnapshot = await getDocs26(q);
14317
14472
  const templates = [];
14318
14473
  querySnapshot.forEach((doc38) => {
14319
14474
  templates.push(doc38.data());
@@ -14328,17 +14483,17 @@ var DocumentationTemplateService = class extends BaseService {
14328
14483
  * @returns Array of templates and the last document for pagination
14329
14484
  */
14330
14485
  async getTemplatesByTags(tags, pageSize = 20, lastDoc) {
14331
- let q = query25(
14486
+ let q = query26(
14332
14487
  this.collectionRef,
14333
- where25("isActive", "==", true),
14334
- where25("tags", "array-contains-any", tags),
14335
- orderBy13("updatedAt", "desc"),
14336
- limit12(pageSize)
14488
+ where26("isActive", "==", true),
14489
+ where26("tags", "array-contains-any", tags),
14490
+ orderBy14("updatedAt", "desc"),
14491
+ limit13(pageSize)
14337
14492
  );
14338
14493
  if (lastDoc) {
14339
- q = query25(q, startAfter10(lastDoc));
14494
+ q = query26(q, startAfter11(lastDoc));
14340
14495
  }
14341
- const querySnapshot = await getDocs25(q);
14496
+ const querySnapshot = await getDocs26(q);
14342
14497
  const templates = [];
14343
14498
  let lastVisible = null;
14344
14499
  querySnapshot.forEach((doc38) => {
@@ -14358,16 +14513,16 @@ var DocumentationTemplateService = class extends BaseService {
14358
14513
  * @returns Array of templates and the last document for pagination
14359
14514
  */
14360
14515
  async getTemplatesByCreator(userId, pageSize = 20, lastDoc) {
14361
- let q = query25(
14516
+ let q = query26(
14362
14517
  this.collectionRef,
14363
- where25("createdBy", "==", userId),
14364
- orderBy13("updatedAt", "desc"),
14365
- limit12(pageSize)
14518
+ where26("createdBy", "==", userId),
14519
+ orderBy14("updatedAt", "desc"),
14520
+ limit13(pageSize)
14366
14521
  );
14367
14522
  if (lastDoc) {
14368
- q = query25(q, startAfter10(lastDoc));
14523
+ q = query26(q, startAfter11(lastDoc));
14369
14524
  }
14370
- const querySnapshot = await getDocs25(q);
14525
+ const querySnapshot = await getDocs26(q);
14371
14526
  const templates = [];
14372
14527
  let lastVisible = null;
14373
14528
  querySnapshot.forEach((doc38) => {
@@ -14385,18 +14540,18 @@ var DocumentationTemplateService = class extends BaseService {
14385
14540
  * @returns Array of templates
14386
14541
  */
14387
14542
  async getAllTemplatesForSelection(options) {
14388
- let q = query25(
14543
+ let q = query26(
14389
14544
  this.collectionRef,
14390
- where25("isActive", "==", true),
14391
- orderBy13("updatedAt", "desc")
14545
+ where26("isActive", "==", true),
14546
+ orderBy14("updatedAt", "desc")
14392
14547
  );
14393
14548
  if ((options == null ? void 0 : options.isUserForm) !== void 0) {
14394
- q = query25(q, where25("isUserForm", "==", options.isUserForm));
14549
+ q = query26(q, where26("isUserForm", "==", options.isUserForm));
14395
14550
  }
14396
14551
  if ((options == null ? void 0 : options.isRequired) !== void 0) {
14397
- q = query25(q, where25("isRequired", "==", options.isRequired));
14552
+ q = query26(q, where26("isRequired", "==", options.isRequired));
14398
14553
  }
14399
- const querySnapshot = await getDocs25(q);
14554
+ const querySnapshot = await getDocs26(q);
14400
14555
  const templates = [];
14401
14556
  querySnapshot.forEach((doc38) => {
14402
14557
  templates.push(doc38.data());
@@ -14407,16 +14562,16 @@ var DocumentationTemplateService = class extends BaseService {
14407
14562
 
14408
14563
  // src/services/documentation-templates/filled-document.service.ts
14409
14564
  import {
14410
- collection as collection26,
14565
+ collection as collection27,
14411
14566
  doc as doc27,
14412
14567
  getDoc as getDoc29,
14413
- getDocs as getDocs26,
14568
+ getDocs as getDocs27,
14414
14569
  setDoc as setDoc25,
14415
14570
  updateDoc as updateDoc26,
14416
- query as query26,
14417
- orderBy as orderBy14,
14418
- limit as limit13,
14419
- startAfter as startAfter11
14571
+ query as query27,
14572
+ orderBy as orderBy15,
14573
+ limit as limit14,
14574
+ startAfter as startAfter12
14420
14575
  } from "firebase/firestore";
14421
14576
  var FilledDocumentService = class extends BaseService {
14422
14577
  constructor(...args) {
@@ -14559,20 +14714,20 @@ var FilledDocumentService = class extends BaseService {
14559
14714
  * @param lastDoc Last document from previous page for pagination.
14560
14715
  */
14561
14716
  async getFilledUserFormsForAppointment(appointmentId, pageSize = 20, lastDoc) {
14562
- const subcollectionRef = collection26(
14717
+ const subcollectionRef = collection27(
14563
14718
  this.db,
14564
14719
  APPOINTMENTS_COLLECTION,
14565
14720
  // Replaced "appointments"
14566
14721
  appointmentId,
14567
14722
  USER_FORMS_SUBCOLLECTION
14568
14723
  );
14569
- let q = query26(
14724
+ let q = query27(
14570
14725
  subcollectionRef,
14571
- orderBy14("updatedAt", "desc"),
14572
- limit13(pageSize)
14726
+ orderBy15("updatedAt", "desc"),
14727
+ limit14(pageSize)
14573
14728
  );
14574
14729
  if (lastDoc) {
14575
- q = query26(q, startAfter11(lastDoc));
14730
+ q = query27(q, startAfter12(lastDoc));
14576
14731
  }
14577
14732
  return this.executeQuery(q);
14578
14733
  }
@@ -14583,26 +14738,26 @@ var FilledDocumentService = class extends BaseService {
14583
14738
  * @param lastDoc Last document from previous page for pagination.
14584
14739
  */
14585
14740
  async getFilledDoctorFormsForAppointment(appointmentId, pageSize = 20, lastDoc) {
14586
- const subcollectionRef = collection26(
14741
+ const subcollectionRef = collection27(
14587
14742
  this.db,
14588
14743
  APPOINTMENTS_COLLECTION,
14589
14744
  // Replaced "appointments"
14590
14745
  appointmentId,
14591
14746
  DOCTOR_FORMS_SUBCOLLECTION
14592
14747
  );
14593
- let q = query26(
14748
+ let q = query27(
14594
14749
  subcollectionRef,
14595
- orderBy14("updatedAt", "desc"),
14596
- limit13(pageSize)
14750
+ orderBy15("updatedAt", "desc"),
14751
+ limit14(pageSize)
14597
14752
  );
14598
14753
  if (lastDoc) {
14599
- q = query26(q, startAfter11(lastDoc));
14754
+ q = query27(q, startAfter12(lastDoc));
14600
14755
  }
14601
14756
  return this.executeQuery(q);
14602
14757
  }
14603
14758
  // Helper to execute query and return documents + lastDoc
14604
14759
  async executeQuery(q) {
14605
- const querySnapshot = await getDocs26(q);
14760
+ const querySnapshot = await getDocs27(q);
14606
14761
  const documents = [];
14607
14762
  let lastVisible = null;
14608
14763
  querySnapshot.forEach((doc38) => {
@@ -14767,15 +14922,15 @@ var FilledDocumentService = class extends BaseService {
14767
14922
 
14768
14923
  // src/services/notifications/notification.service.ts
14769
14924
  import {
14770
- collection as collection27,
14925
+ collection as collection28,
14771
14926
  doc as doc28,
14772
14927
  getDoc as getDoc30,
14773
- getDocs as getDocs27,
14774
- query as query27,
14775
- where as where27,
14928
+ getDocs as getDocs28,
14929
+ query as query28,
14930
+ where as where28,
14776
14931
  updateDoc as updateDoc27,
14777
14932
  deleteDoc as deleteDoc17,
14778
- orderBy as orderBy15,
14933
+ orderBy as orderBy16,
14779
14934
  Timestamp as Timestamp30,
14780
14935
  addDoc as addDoc2,
14781
14936
  writeBatch as writeBatch5
@@ -14785,7 +14940,7 @@ var NotificationService = class extends BaseService {
14785
14940
  * Kreira novu notifikaciju
14786
14941
  */
14787
14942
  async createNotification(notification) {
14788
- const notificationsRef = collection27(this.db, NOTIFICATIONS_COLLECTION);
14943
+ const notificationsRef = collection28(this.db, NOTIFICATIONS_COLLECTION);
14789
14944
  const now = Timestamp30.now();
14790
14945
  const notificationData = {
14791
14946
  ...notification,
@@ -14823,12 +14978,12 @@ var NotificationService = class extends BaseService {
14823
14978
  * Dohvata sve notifikacije za korisnika
14824
14979
  */
14825
14980
  async getUserNotifications(userId) {
14826
- const q = query27(
14827
- collection27(this.db, NOTIFICATIONS_COLLECTION),
14828
- where27("userId", "==", userId),
14829
- orderBy15("notificationTime", "desc")
14981
+ const q = query28(
14982
+ collection28(this.db, NOTIFICATIONS_COLLECTION),
14983
+ where28("userId", "==", userId),
14984
+ orderBy16("notificationTime", "desc")
14830
14985
  );
14831
- const querySnapshot = await getDocs27(q);
14986
+ const querySnapshot = await getDocs28(q);
14832
14987
  return querySnapshot.docs.map((doc38) => ({
14833
14988
  id: doc38.id,
14834
14989
  ...doc38.data()
@@ -14838,13 +14993,13 @@ var NotificationService = class extends BaseService {
14838
14993
  * Dohvata nepročitane notifikacije za korisnika
14839
14994
  */
14840
14995
  async getUnreadNotifications(userId) {
14841
- const q = query27(
14842
- collection27(this.db, NOTIFICATIONS_COLLECTION),
14843
- where27("userId", "==", userId),
14844
- where27("isRead", "==", false),
14845
- orderBy15("notificationTime", "desc")
14996
+ const q = query28(
14997
+ collection28(this.db, NOTIFICATIONS_COLLECTION),
14998
+ where28("userId", "==", userId),
14999
+ where28("isRead", "==", false),
15000
+ orderBy16("notificationTime", "desc")
14846
15001
  );
14847
- const querySnapshot = await getDocs27(q);
15002
+ const querySnapshot = await getDocs28(q);
14848
15003
  return querySnapshot.docs.map((doc38) => ({
14849
15004
  id: doc38.id,
14850
15005
  ...doc38.data()
@@ -14912,13 +15067,13 @@ var NotificationService = class extends BaseService {
14912
15067
  * Dohvata notifikacije po tipu
14913
15068
  */
14914
15069
  async getNotificationsByType(userId, type) {
14915
- const q = query27(
14916
- collection27(this.db, NOTIFICATIONS_COLLECTION),
14917
- where27("userId", "==", userId),
14918
- where27("notificationType", "==", type),
14919
- orderBy15("notificationTime", "desc")
15070
+ const q = query28(
15071
+ collection28(this.db, NOTIFICATIONS_COLLECTION),
15072
+ where28("userId", "==", userId),
15073
+ where28("notificationType", "==", type),
15074
+ orderBy16("notificationTime", "desc")
14920
15075
  );
14921
- const querySnapshot = await getDocs27(q);
15076
+ const querySnapshot = await getDocs28(q);
14922
15077
  return querySnapshot.docs.map((doc38) => ({
14923
15078
  id: doc38.id,
14924
15079
  ...doc38.data()
@@ -14928,12 +15083,12 @@ var NotificationService = class extends BaseService {
14928
15083
  * Dohvata notifikacije za određeni termin
14929
15084
  */
14930
15085
  async getAppointmentNotifications(appointmentId) {
14931
- const q = query27(
14932
- collection27(this.db, NOTIFICATIONS_COLLECTION),
14933
- where27("appointmentId", "==", appointmentId),
14934
- orderBy15("notificationTime", "desc")
15086
+ const q = query28(
15087
+ collection28(this.db, NOTIFICATIONS_COLLECTION),
15088
+ where28("appointmentId", "==", appointmentId),
15089
+ orderBy16("notificationTime", "desc")
14935
15090
  );
14936
- const querySnapshot = await getDocs27(q);
15091
+ const querySnapshot = await getDocs28(q);
14937
15092
  return querySnapshot.docs.map((doc38) => ({
14938
15093
  id: doc38.id,
14939
15094
  ...doc38.data()
@@ -14943,16 +15098,16 @@ var NotificationService = class extends BaseService {
14943
15098
 
14944
15099
  // src/services/patient/patientRequirements.service.ts
14945
15100
  import {
14946
- collection as collection28,
14947
- getDocs as getDocs28,
14948
- query as query28,
14949
- where as where28,
15101
+ collection as collection29,
15102
+ getDocs as getDocs29,
15103
+ query as query29,
15104
+ where as where29,
14950
15105
  doc as doc29,
14951
15106
  updateDoc as updateDoc28,
14952
15107
  Timestamp as Timestamp31,
14953
- orderBy as orderBy16,
14954
- limit as limit14,
14955
- startAfter as startAfter12,
15108
+ orderBy as orderBy17,
15109
+ limit as limit15,
15110
+ startAfter as startAfter13,
14956
15111
  getDoc as getDoc31
14957
15112
  } from "firebase/firestore";
14958
15113
  var PatientRequirementsService = class extends BaseService {
@@ -14960,7 +15115,7 @@ var PatientRequirementsService = class extends BaseService {
14960
15115
  super(db, auth, app);
14961
15116
  }
14962
15117
  getPatientRequirementsCollectionRef(patientId) {
14963
- return collection28(
15118
+ return collection29(
14964
15119
  this.db,
14965
15120
  `patients/${patientId}/${PATIENT_REQUIREMENTS_SUBCOLLECTION_NAME}`
14966
15121
  );
@@ -14998,22 +15153,22 @@ var PatientRequirementsService = class extends BaseService {
14998
15153
  */
14999
15154
  async getAllPatientRequirementInstances(patientId, filters, pageLimit = 20, lastVisible) {
15000
15155
  const collRef = this.getPatientRequirementsCollectionRef(patientId);
15001
- let q = query28(collRef, orderBy16("createdAt", "desc"));
15156
+ let q = query29(collRef, orderBy17("createdAt", "desc"));
15002
15157
  const queryConstraints = [];
15003
15158
  if ((filters == null ? void 0 : filters.appointmentId) && filters.appointmentId !== "all") {
15004
15159
  queryConstraints.push(
15005
- where28("appointmentId", "==", filters.appointmentId)
15160
+ where29("appointmentId", "==", filters.appointmentId)
15006
15161
  );
15007
15162
  }
15008
15163
  if ((filters == null ? void 0 : filters.statuses) && filters.statuses.length > 0) {
15009
- queryConstraints.push(where28("overallStatus", "in", filters.statuses));
15164
+ queryConstraints.push(where29("overallStatus", "in", filters.statuses));
15010
15165
  }
15011
15166
  if (lastVisible) {
15012
- queryConstraints.push(startAfter12(lastVisible));
15167
+ queryConstraints.push(startAfter13(lastVisible));
15013
15168
  }
15014
- queryConstraints.push(limit14(pageLimit));
15015
- q = query28(collRef, ...queryConstraints);
15016
- const snapshot = await getDocs28(q);
15169
+ queryConstraints.push(limit15(pageLimit));
15170
+ q = query29(collRef, ...queryConstraints);
15171
+ const snapshot = await getDocs29(q);
15017
15172
  let requirements = snapshot.docs.map((docSnap) => {
15018
15173
  const data = docSnap.data();
15019
15174
  return { id: docSnap.id, ...data };
@@ -15125,20 +15280,20 @@ var PatientRequirementsService = class extends BaseService {
15125
15280
 
15126
15281
  // src/services/procedure/procedure.service.ts
15127
15282
  import {
15128
- collection as collection29,
15283
+ collection as collection30,
15129
15284
  doc as doc30,
15130
15285
  getDoc as getDoc32,
15131
- getDocs as getDocs29,
15132
- query as query29,
15133
- where as where29,
15286
+ getDocs as getDocs30,
15287
+ query as query30,
15288
+ where as where30,
15134
15289
  updateDoc as updateDoc29,
15135
15290
  setDoc as setDoc26,
15136
15291
  deleteDoc as deleteDoc18,
15137
15292
  serverTimestamp as serverTimestamp25,
15138
15293
  writeBatch as writeBatch6,
15139
- orderBy as orderBy17,
15140
- limit as limit15,
15141
- startAfter as startAfter13,
15294
+ orderBy as orderBy18,
15295
+ limit as limit16,
15296
+ startAfter as startAfter14,
15142
15297
  documentId as documentId2
15143
15298
  } from "firebase/firestore";
15144
15299
 
@@ -15522,11 +15677,11 @@ var ProcedureService = class extends BaseService {
15522
15677
  const practitionersMap = /* @__PURE__ */ new Map();
15523
15678
  for (let i = 0; i < practitionerIds.length; i += 30) {
15524
15679
  const chunk = practitionerIds.slice(i, i + 30);
15525
- const practitionersQuery = query29(
15526
- collection29(this.db, PRACTITIONERS_COLLECTION),
15527
- where29(documentId2(), "in", chunk)
15680
+ const practitionersQuery = query30(
15681
+ collection30(this.db, PRACTITIONERS_COLLECTION),
15682
+ where30(documentId2(), "in", chunk)
15528
15683
  );
15529
- const practitionersSnapshot = await getDocs29(practitionersQuery);
15684
+ const practitionersSnapshot = await getDocs30(practitionersQuery);
15530
15685
  practitionersSnapshot.docs.forEach((doc38) => {
15531
15686
  practitionersMap.set(doc38.id, doc38.data());
15532
15687
  });
@@ -15607,8 +15762,8 @@ var ProcedureService = class extends BaseService {
15607
15762
  const fetchedProcedures = [];
15608
15763
  for (let i = 0; i < createdProcedureIds.length; i += 30) {
15609
15764
  const chunk = createdProcedureIds.slice(i, i + 30);
15610
- const q = query29(collection29(this.db, PROCEDURES_COLLECTION), where29(documentId2(), "in", chunk));
15611
- const snapshot = await getDocs29(q);
15765
+ const q = query30(collection30(this.db, PROCEDURES_COLLECTION), where30(documentId2(), "in", chunk));
15766
+ const snapshot = await getDocs30(q);
15612
15767
  snapshot.forEach((doc38) => {
15613
15768
  fetchedProcedures.push(doc38.data());
15614
15769
  });
@@ -15634,12 +15789,12 @@ var ProcedureService = class extends BaseService {
15634
15789
  * @returns List of procedures
15635
15790
  */
15636
15791
  async getProceduresByClinicBranch(clinicBranchId) {
15637
- const q = query29(
15638
- collection29(this.db, PROCEDURES_COLLECTION),
15639
- where29("clinicBranchId", "==", clinicBranchId),
15640
- where29("isActive", "==", true)
15792
+ const q = query30(
15793
+ collection30(this.db, PROCEDURES_COLLECTION),
15794
+ where30("clinicBranchId", "==", clinicBranchId),
15795
+ where30("isActive", "==", true)
15641
15796
  );
15642
- const snapshot = await getDocs29(q);
15797
+ const snapshot = await getDocs30(q);
15643
15798
  return snapshot.docs.map((doc38) => doc38.data());
15644
15799
  }
15645
15800
  /**
@@ -15648,12 +15803,12 @@ var ProcedureService = class extends BaseService {
15648
15803
  * @returns List of procedures
15649
15804
  */
15650
15805
  async getProceduresByPractitioner(practitionerId) {
15651
- const q = query29(
15652
- collection29(this.db, PROCEDURES_COLLECTION),
15653
- where29("practitionerId", "==", practitionerId),
15654
- where29("isActive", "==", true)
15806
+ const q = query30(
15807
+ collection30(this.db, PROCEDURES_COLLECTION),
15808
+ where30("practitionerId", "==", practitionerId),
15809
+ where30("isActive", "==", true)
15655
15810
  );
15656
- const snapshot = await getDocs29(q);
15811
+ const snapshot = await getDocs30(q);
15657
15812
  return snapshot.docs.map((doc38) => doc38.data());
15658
15813
  }
15659
15814
  /**
@@ -15662,12 +15817,12 @@ var ProcedureService = class extends BaseService {
15662
15817
  * @returns List of inactive procedures
15663
15818
  */
15664
15819
  async getInactiveProceduresByPractitioner(practitionerId) {
15665
- const q = query29(
15666
- collection29(this.db, PROCEDURES_COLLECTION),
15667
- where29("practitionerId", "==", practitionerId),
15668
- where29("isActive", "==", false)
15820
+ const q = query30(
15821
+ collection30(this.db, PROCEDURES_COLLECTION),
15822
+ where30("practitionerId", "==", practitionerId),
15823
+ where30("isActive", "==", false)
15669
15824
  );
15670
- const snapshot = await getDocs29(q);
15825
+ const snapshot = await getDocs30(q);
15671
15826
  return snapshot.docs.map((doc38) => doc38.data());
15672
15827
  }
15673
15828
  /**
@@ -15867,25 +16022,25 @@ var ProcedureService = class extends BaseService {
15867
16022
  */
15868
16023
  async getAllProcedures(pagination, lastDoc) {
15869
16024
  try {
15870
- const proceduresCollection = collection29(this.db, PROCEDURES_COLLECTION);
15871
- let proceduresQuery = query29(proceduresCollection);
16025
+ const proceduresCollection = collection30(this.db, PROCEDURES_COLLECTION);
16026
+ let proceduresQuery = query30(proceduresCollection);
15872
16027
  if (pagination && pagination > 0) {
15873
- const { limit: limit21, startAfter: startAfter19 } = await import("firebase/firestore");
16028
+ const { limit: limit22, startAfter: startAfter20 } = await import("firebase/firestore");
15874
16029
  if (lastDoc) {
15875
- proceduresQuery = query29(
16030
+ proceduresQuery = query30(
15876
16031
  proceduresCollection,
15877
- orderBy17("name"),
16032
+ orderBy18("name"),
15878
16033
  // Use imported orderBy
15879
- startAfter19(lastDoc),
15880
- limit21(pagination)
16034
+ startAfter20(lastDoc),
16035
+ limit22(pagination)
15881
16036
  );
15882
16037
  } else {
15883
- proceduresQuery = query29(proceduresCollection, orderBy17("name"), limit21(pagination));
16038
+ proceduresQuery = query30(proceduresCollection, orderBy18("name"), limit22(pagination));
15884
16039
  }
15885
16040
  } else {
15886
- proceduresQuery = query29(proceduresCollection, orderBy17("name"));
16041
+ proceduresQuery = query30(proceduresCollection, orderBy18("name"));
15887
16042
  }
15888
- const proceduresSnapshot = await getDocs29(proceduresQuery);
16043
+ const proceduresSnapshot = await getDocs30(proceduresQuery);
15889
16044
  const lastVisible = proceduresSnapshot.docs[proceduresSnapshot.docs.length - 1];
15890
16045
  const procedures = proceduresSnapshot.docs.map((doc38) => {
15891
16046
  const data = doc38.data();
@@ -15949,37 +16104,37 @@ var ProcedureService = class extends BaseService {
15949
16104
  const getBaseConstraints = () => {
15950
16105
  const constraints = [];
15951
16106
  if (filters.isActive !== void 0) {
15952
- constraints.push(where29("isActive", "==", filters.isActive));
16107
+ constraints.push(where30("isActive", "==", filters.isActive));
15953
16108
  } else {
15954
- constraints.push(where29("isActive", "==", true));
16109
+ constraints.push(where30("isActive", "==", true));
15955
16110
  }
15956
16111
  if (filters.procedureFamily) {
15957
- constraints.push(where29("family", "==", filters.procedureFamily));
16112
+ constraints.push(where30("family", "==", filters.procedureFamily));
15958
16113
  }
15959
16114
  if (filters.procedureCategory) {
15960
- constraints.push(where29("category.id", "==", filters.procedureCategory));
16115
+ constraints.push(where30("category.id", "==", filters.procedureCategory));
15961
16116
  }
15962
16117
  if (filters.procedureSubcategory) {
15963
- constraints.push(where29("subcategory.id", "==", filters.procedureSubcategory));
16118
+ constraints.push(where30("subcategory.id", "==", filters.procedureSubcategory));
15964
16119
  }
15965
16120
  if (filters.procedureTechnology) {
15966
- constraints.push(where29("technology.id", "==", filters.procedureTechnology));
16121
+ constraints.push(where30("technology.id", "==", filters.procedureTechnology));
15967
16122
  }
15968
16123
  if (filters.minPrice !== void 0) {
15969
- constraints.push(where29("price", ">=", filters.minPrice));
16124
+ constraints.push(where30("price", ">=", filters.minPrice));
15970
16125
  }
15971
16126
  if (filters.maxPrice !== void 0) {
15972
- constraints.push(where29("price", "<=", filters.maxPrice));
16127
+ constraints.push(where30("price", "<=", filters.maxPrice));
15973
16128
  }
15974
16129
  if (filters.minRating !== void 0) {
15975
- constraints.push(where29("reviewInfo.averageRating", ">=", filters.minRating));
16130
+ constraints.push(where30("reviewInfo.averageRating", ">=", filters.minRating));
15976
16131
  }
15977
16132
  if (filters.maxRating !== void 0) {
15978
- constraints.push(where29("reviewInfo.averageRating", "<=", filters.maxRating));
16133
+ constraints.push(where30("reviewInfo.averageRating", "<=", filters.maxRating));
15979
16134
  }
15980
16135
  if (filters.treatmentBenefits && filters.treatmentBenefits.length > 0) {
15981
16136
  const benefitIdsToMatch = filters.treatmentBenefits;
15982
- constraints.push(where29("treatmentBenefitIds", "array-contains-any", benefitIdsToMatch));
16137
+ constraints.push(where30("treatmentBenefitIds", "array-contains-any", benefitIdsToMatch));
15983
16138
  }
15984
16139
  return constraints;
15985
16140
  };
@@ -15988,21 +16143,21 @@ var ProcedureService = class extends BaseService {
15988
16143
  console.log("[PROCEDURE_SERVICE] Strategy 1: Trying nameLower search");
15989
16144
  const searchTerm = filters.nameSearch.trim().toLowerCase();
15990
16145
  const constraints = getBaseConstraints();
15991
- constraints.push(where29("nameLower", ">=", searchTerm));
15992
- constraints.push(where29("nameLower", "<=", searchTerm + "\uF8FF"));
15993
- constraints.push(orderBy17("nameLower"));
16146
+ constraints.push(where30("nameLower", ">=", searchTerm));
16147
+ constraints.push(where30("nameLower", "<=", searchTerm + "\uF8FF"));
16148
+ constraints.push(orderBy18("nameLower"));
15994
16149
  if (filters.lastDoc) {
15995
16150
  if (typeof filters.lastDoc.data === "function") {
15996
- constraints.push(startAfter13(filters.lastDoc));
16151
+ constraints.push(startAfter14(filters.lastDoc));
15997
16152
  } else if (Array.isArray(filters.lastDoc)) {
15998
- constraints.push(startAfter13(...filters.lastDoc));
16153
+ constraints.push(startAfter14(...filters.lastDoc));
15999
16154
  } else {
16000
- constraints.push(startAfter13(filters.lastDoc));
16155
+ constraints.push(startAfter14(filters.lastDoc));
16001
16156
  }
16002
16157
  }
16003
- constraints.push(limit15(filters.pagination || 10));
16004
- const q = query29(collection29(this.db, PROCEDURES_COLLECTION), ...constraints);
16005
- const querySnapshot = await getDocs29(q);
16158
+ constraints.push(limit16(filters.pagination || 10));
16159
+ const q = query30(collection30(this.db, PROCEDURES_COLLECTION), ...constraints);
16160
+ const querySnapshot = await getDocs30(q);
16006
16161
  const procedures = querySnapshot.docs.map(
16007
16162
  (doc38) => ({ ...doc38.data(), id: doc38.id })
16008
16163
  );
@@ -16021,21 +16176,21 @@ var ProcedureService = class extends BaseService {
16021
16176
  console.log("[PROCEDURE_SERVICE] Strategy 2: Trying name field search");
16022
16177
  const searchTerm = filters.nameSearch.trim().toLowerCase();
16023
16178
  const constraints = getBaseConstraints();
16024
- constraints.push(where29("name", ">=", searchTerm));
16025
- constraints.push(where29("name", "<=", searchTerm + "\uF8FF"));
16026
- constraints.push(orderBy17("name"));
16179
+ constraints.push(where30("name", ">=", searchTerm));
16180
+ constraints.push(where30("name", "<=", searchTerm + "\uF8FF"));
16181
+ constraints.push(orderBy18("name"));
16027
16182
  if (filters.lastDoc) {
16028
16183
  if (typeof filters.lastDoc.data === "function") {
16029
- constraints.push(startAfter13(filters.lastDoc));
16184
+ constraints.push(startAfter14(filters.lastDoc));
16030
16185
  } else if (Array.isArray(filters.lastDoc)) {
16031
- constraints.push(startAfter13(...filters.lastDoc));
16186
+ constraints.push(startAfter14(...filters.lastDoc));
16032
16187
  } else {
16033
- constraints.push(startAfter13(filters.lastDoc));
16188
+ constraints.push(startAfter14(filters.lastDoc));
16034
16189
  }
16035
16190
  }
16036
- constraints.push(limit15(filters.pagination || 10));
16037
- const q = query29(collection29(this.db, PROCEDURES_COLLECTION), ...constraints);
16038
- const querySnapshot = await getDocs29(q);
16191
+ constraints.push(limit16(filters.pagination || 10));
16192
+ const q = query30(collection30(this.db, PROCEDURES_COLLECTION), ...constraints);
16193
+ const querySnapshot = await getDocs30(q);
16039
16194
  const procedures = querySnapshot.docs.map(
16040
16195
  (doc38) => ({ ...doc38.data(), id: doc38.id })
16041
16196
  );
@@ -16054,19 +16209,19 @@ var ProcedureService = class extends BaseService {
16054
16209
  "[PROCEDURE_SERVICE] Strategy 3: Using createdAt orderBy with client-side filtering"
16055
16210
  );
16056
16211
  const constraints = getBaseConstraints();
16057
- constraints.push(orderBy17("createdAt", "desc"));
16212
+ constraints.push(orderBy18("createdAt", "desc"));
16058
16213
  if (filters.lastDoc) {
16059
16214
  if (typeof filters.lastDoc.data === "function") {
16060
- constraints.push(startAfter13(filters.lastDoc));
16215
+ constraints.push(startAfter14(filters.lastDoc));
16061
16216
  } else if (Array.isArray(filters.lastDoc)) {
16062
- constraints.push(startAfter13(...filters.lastDoc));
16217
+ constraints.push(startAfter14(...filters.lastDoc));
16063
16218
  } else {
16064
- constraints.push(startAfter13(filters.lastDoc));
16219
+ constraints.push(startAfter14(filters.lastDoc));
16065
16220
  }
16066
16221
  }
16067
- constraints.push(limit15(filters.pagination || 10));
16068
- const q = query29(collection29(this.db, PROCEDURES_COLLECTION), ...constraints);
16069
- const querySnapshot = await getDocs29(q);
16222
+ constraints.push(limit16(filters.pagination || 10));
16223
+ const q = query30(collection30(this.db, PROCEDURES_COLLECTION), ...constraints);
16224
+ const querySnapshot = await getDocs30(q);
16070
16225
  let procedures = querySnapshot.docs.map(
16071
16226
  (doc38) => ({ ...doc38.data(), id: doc38.id })
16072
16227
  );
@@ -16083,12 +16238,12 @@ var ProcedureService = class extends BaseService {
16083
16238
  try {
16084
16239
  console.log("[PROCEDURE_SERVICE] Strategy 4: Minimal query fallback");
16085
16240
  const constraints = [
16086
- where29("isActive", "==", true),
16087
- orderBy17("createdAt", "desc"),
16088
- limit15(filters.pagination || 10)
16241
+ where30("isActive", "==", true),
16242
+ orderBy18("createdAt", "desc"),
16243
+ limit16(filters.pagination || 10)
16089
16244
  ];
16090
- const q = query29(collection29(this.db, PROCEDURES_COLLECTION), ...constraints);
16091
- const querySnapshot = await getDocs29(q);
16245
+ const q = query30(collection30(this.db, PROCEDURES_COLLECTION), ...constraints);
16246
+ const querySnapshot = await getDocs30(q);
16092
16247
  let procedures = querySnapshot.docs.map(
16093
16248
  (doc38) => ({ ...doc38.data(), id: doc38.id })
16094
16249
  );
@@ -16232,11 +16387,11 @@ var ProcedureService = class extends BaseService {
16232
16387
  const bounds = geohashQueryBounds5([location.latitude, location.longitude], radiusInKm * 1e3);
16233
16388
  const fetches = bounds.map((b) => {
16234
16389
  const constraints = [
16235
- where29("clinicInfo.location.geohash", ">=", b[0]),
16236
- where29("clinicInfo.location.geohash", "<=", b[1]),
16237
- where29("isActive", "==", filters.isActive !== void 0 ? filters.isActive : true)
16390
+ where30("clinicInfo.location.geohash", ">=", b[0]),
16391
+ where30("clinicInfo.location.geohash", "<=", b[1]),
16392
+ where30("isActive", "==", filters.isActive !== void 0 ? filters.isActive : true)
16238
16393
  ];
16239
- return getDocs29(query29(collection29(this.db, PROCEDURES_COLLECTION), ...constraints));
16394
+ return getDocs30(query30(collection30(this.db, PROCEDURES_COLLECTION), ...constraints));
16240
16395
  });
16241
16396
  return Promise.all(fetches).then((snaps) => {
16242
16397
  const collected = [];
@@ -16388,8 +16543,8 @@ var ProcedureService = class extends BaseService {
16388
16543
  * @returns Array of minimal procedure info for map
16389
16544
  */
16390
16545
  async getProceduresForMap() {
16391
- const proceduresRef = collection29(this.db, PROCEDURES_COLLECTION);
16392
- const snapshot = await getDocs29(proceduresRef);
16546
+ const proceduresRef = collection30(this.db, PROCEDURES_COLLECTION);
16547
+ const snapshot = await getDocs30(proceduresRef);
16393
16548
  const proceduresForMap = snapshot.docs.map((doc38) => {
16394
16549
  var _a, _b, _c, _d, _e, _f, _g, _h;
16395
16550
  const data = doc38.data();
@@ -16409,12 +16564,12 @@ var ProcedureService = class extends BaseService {
16409
16564
 
16410
16565
  // src/services/reviews/reviews.service.ts
16411
16566
  import {
16412
- collection as collection30,
16567
+ collection as collection31,
16413
16568
  doc as doc31,
16414
16569
  getDoc as getDoc33,
16415
- getDocs as getDocs30,
16416
- query as query30,
16417
- where as where30,
16570
+ getDocs as getDocs31,
16571
+ query as query31,
16572
+ where as where31,
16418
16573
  setDoc as setDoc27,
16419
16574
  deleteDoc as deleteDoc19,
16420
16575
  serverTimestamp as serverTimestamp26
@@ -16531,11 +16686,11 @@ var ReviewService = class extends BaseService {
16531
16686
  * @returns Array of reviews for the patient
16532
16687
  */
16533
16688
  async getReviewsByPatient(patientId) {
16534
- const q = query30(
16535
- collection30(this.db, REVIEWS_COLLECTION),
16536
- where30("patientId", "==", patientId)
16689
+ const q = query31(
16690
+ collection31(this.db, REVIEWS_COLLECTION),
16691
+ where31("patientId", "==", patientId)
16537
16692
  );
16538
- const snapshot = await getDocs30(q);
16693
+ const snapshot = await getDocs31(q);
16539
16694
  return snapshot.docs.map((doc38) => doc38.data());
16540
16695
  }
16541
16696
  /**
@@ -16544,11 +16699,11 @@ var ReviewService = class extends BaseService {
16544
16699
  * @returns Array of reviews containing clinic reviews
16545
16700
  */
16546
16701
  async getReviewsByClinic(clinicId) {
16547
- const q = query30(
16548
- collection30(this.db, REVIEWS_COLLECTION),
16549
- where30("clinicReview.clinicId", "==", clinicId)
16702
+ const q = query31(
16703
+ collection31(this.db, REVIEWS_COLLECTION),
16704
+ where31("clinicReview.clinicId", "==", clinicId)
16550
16705
  );
16551
- const snapshot = await getDocs30(q);
16706
+ const snapshot = await getDocs31(q);
16552
16707
  return snapshot.docs.map((doc38) => doc38.data());
16553
16708
  }
16554
16709
  /**
@@ -16557,11 +16712,11 @@ var ReviewService = class extends BaseService {
16557
16712
  * @returns Array of reviews containing practitioner reviews
16558
16713
  */
16559
16714
  async getReviewsByPractitioner(practitionerId) {
16560
- const q = query30(
16561
- collection30(this.db, REVIEWS_COLLECTION),
16562
- where30("practitionerReview.practitionerId", "==", practitionerId)
16715
+ const q = query31(
16716
+ collection31(this.db, REVIEWS_COLLECTION),
16717
+ where31("practitionerReview.practitionerId", "==", practitionerId)
16563
16718
  );
16564
- const snapshot = await getDocs30(q);
16719
+ const snapshot = await getDocs31(q);
16565
16720
  return snapshot.docs.map((doc38) => doc38.data());
16566
16721
  }
16567
16722
  /**
@@ -16570,11 +16725,11 @@ var ReviewService = class extends BaseService {
16570
16725
  * @returns Array of reviews containing procedure reviews
16571
16726
  */
16572
16727
  async getReviewsByProcedure(procedureId) {
16573
- const q = query30(
16574
- collection30(this.db, REVIEWS_COLLECTION),
16575
- where30("procedureReview.procedureId", "==", procedureId)
16728
+ const q = query31(
16729
+ collection31(this.db, REVIEWS_COLLECTION),
16730
+ where31("procedureReview.procedureId", "==", procedureId)
16576
16731
  );
16577
- const snapshot = await getDocs30(q);
16732
+ const snapshot = await getDocs31(q);
16578
16733
  return snapshot.docs.map((doc38) => doc38.data());
16579
16734
  }
16580
16735
  /**
@@ -16583,11 +16738,11 @@ var ReviewService = class extends BaseService {
16583
16738
  * @returns The review for the appointment if found, null otherwise
16584
16739
  */
16585
16740
  async getReviewByAppointment(appointmentId) {
16586
- const q = query30(
16587
- collection30(this.db, REVIEWS_COLLECTION),
16588
- where30("appointmentId", "==", appointmentId)
16741
+ const q = query31(
16742
+ collection31(this.db, REVIEWS_COLLECTION),
16743
+ where31("appointmentId", "==", appointmentId)
16589
16744
  );
16590
- const snapshot = await getDocs30(q);
16745
+ const snapshot = await getDocs31(q);
16591
16746
  if (snapshot.empty) {
16592
16747
  return null;
16593
16748
  }
@@ -16675,16 +16830,16 @@ var getFirebaseFunctions = async () => {
16675
16830
  // src/backoffice/services/brand.service.ts
16676
16831
  import {
16677
16832
  addDoc as addDoc3,
16678
- collection as collection31,
16833
+ collection as collection32,
16679
16834
  doc as doc32,
16680
16835
  getDoc as getDoc34,
16681
- getDocs as getDocs31,
16682
- query as query31,
16836
+ getDocs as getDocs32,
16837
+ query as query32,
16683
16838
  updateDoc as updateDoc30,
16684
- where as where31,
16685
- limit as limit16,
16686
- orderBy as orderBy18,
16687
- startAfter as startAfter14,
16839
+ where as where32,
16840
+ limit as limit17,
16841
+ orderBy as orderBy19,
16842
+ startAfter as startAfter15,
16688
16843
  getCountFromServer as getCountFromServer2
16689
16844
  } from "firebase/firestore";
16690
16845
 
@@ -16697,7 +16852,7 @@ var BrandService = class extends BaseService {
16697
16852
  * Gets reference to brands collection
16698
16853
  */
16699
16854
  getBrandsRef() {
16700
- return collection31(this.db, BRANDS_COLLECTION);
16855
+ return collection32(this.db, BRANDS_COLLECTION);
16701
16856
  }
16702
16857
  /**
16703
16858
  * Creates a new brand
@@ -16722,22 +16877,22 @@ var BrandService = class extends BaseService {
16722
16877
  */
16723
16878
  async getAll(rowsPerPage, searchTerm, lastVisible) {
16724
16879
  const constraints = [
16725
- where31("isActive", "==", true),
16726
- orderBy18("name_lowercase")
16880
+ where32("isActive", "==", true),
16881
+ orderBy19("name_lowercase")
16727
16882
  ];
16728
16883
  if (searchTerm) {
16729
16884
  const lowercasedSearchTerm = searchTerm.toLowerCase();
16730
- constraints.push(where31("name_lowercase", ">=", lowercasedSearchTerm));
16885
+ constraints.push(where32("name_lowercase", ">=", lowercasedSearchTerm));
16731
16886
  constraints.push(
16732
- where31("name_lowercase", "<=", lowercasedSearchTerm + "\uF8FF")
16887
+ where32("name_lowercase", "<=", lowercasedSearchTerm + "\uF8FF")
16733
16888
  );
16734
16889
  }
16735
16890
  if (lastVisible) {
16736
- constraints.push(startAfter14(lastVisible));
16891
+ constraints.push(startAfter15(lastVisible));
16737
16892
  }
16738
- constraints.push(limit16(rowsPerPage));
16739
- const q = query31(this.getBrandsRef(), ...constraints);
16740
- const snapshot = await getDocs31(q);
16893
+ constraints.push(limit17(rowsPerPage));
16894
+ const q = query32(this.getBrandsRef(), ...constraints);
16895
+ const snapshot = await getDocs32(q);
16741
16896
  const brands = snapshot.docs.map(
16742
16897
  (doc38) => ({
16743
16898
  id: doc38.id,
@@ -16752,15 +16907,15 @@ var BrandService = class extends BaseService {
16752
16907
  * @param searchTerm - An optional string to filter brand names by (starts-with search).
16753
16908
  */
16754
16909
  async getBrandsCount(searchTerm) {
16755
- const constraints = [where31("isActive", "==", true)];
16910
+ const constraints = [where32("isActive", "==", true)];
16756
16911
  if (searchTerm) {
16757
16912
  const lowercasedSearchTerm = searchTerm.toLowerCase();
16758
- constraints.push(where31("name_lowercase", ">=", lowercasedSearchTerm));
16913
+ constraints.push(where32("name_lowercase", ">=", lowercasedSearchTerm));
16759
16914
  constraints.push(
16760
- where31("name_lowercase", "<=", lowercasedSearchTerm + "\uF8FF")
16915
+ where32("name_lowercase", "<=", lowercasedSearchTerm + "\uF8FF")
16761
16916
  );
16762
16917
  }
16763
- const q = query31(this.getBrandsRef(), ...constraints);
16918
+ const q = query32(this.getBrandsRef(), ...constraints);
16764
16919
  const snapshot = await getCountFromServer2(q);
16765
16920
  return snapshot.data().count;
16766
16921
  }
@@ -16768,12 +16923,12 @@ var BrandService = class extends BaseService {
16768
16923
  * Gets all active brands for filter dropdowns (not paginated).
16769
16924
  */
16770
16925
  async getAllForFilter() {
16771
- const q = query31(
16926
+ const q = query32(
16772
16927
  this.getBrandsRef(),
16773
- where31("isActive", "==", true),
16774
- orderBy18("name")
16928
+ where32("isActive", "==", true),
16929
+ orderBy19("name")
16775
16930
  );
16776
- const snapshot = await getDocs31(q);
16931
+ const snapshot = await getDocs32(q);
16777
16932
  return snapshot.docs.map(
16778
16933
  (doc38) => ({
16779
16934
  id: doc38.id,
@@ -16821,17 +16976,17 @@ var BrandService = class extends BaseService {
16821
16976
  // src/backoffice/services/category.service.ts
16822
16977
  import {
16823
16978
  addDoc as addDoc4,
16824
- collection as collection32,
16979
+ collection as collection33,
16825
16980
  doc as doc33,
16826
16981
  getCountFromServer as getCountFromServer3,
16827
16982
  getDoc as getDoc35,
16828
- getDocs as getDocs32,
16829
- limit as limit17,
16830
- orderBy as orderBy19,
16831
- query as query32,
16832
- startAfter as startAfter15,
16983
+ getDocs as getDocs33,
16984
+ limit as limit18,
16985
+ orderBy as orderBy20,
16986
+ query as query33,
16987
+ startAfter as startAfter16,
16833
16988
  updateDoc as updateDoc31,
16834
- where as where32
16989
+ where as where33
16835
16990
  } from "firebase/firestore";
16836
16991
 
16837
16992
  // src/backoffice/types/category.types.ts
@@ -16843,7 +16998,7 @@ var CategoryService = class extends BaseService {
16843
16998
  * Referenca na Firestore kolekciju kategorija
16844
16999
  */
16845
17000
  get categoriesRef() {
16846
- return collection32(this.db, CATEGORIES_COLLECTION);
17001
+ return collection33(this.db, CATEGORIES_COLLECTION);
16847
17002
  }
16848
17003
  /**
16849
17004
  * Kreira novu kategoriju u sistemu
@@ -16870,10 +17025,10 @@ var CategoryService = class extends BaseService {
16870
17025
  const counts = {};
16871
17026
  const families = Object.values(ProcedureFamily);
16872
17027
  for (const family of families) {
16873
- const q = query32(
17028
+ const q = query33(
16874
17029
  this.categoriesRef,
16875
- where32("family", "==", family),
16876
- where32("isActive", "==", active)
17030
+ where33("family", "==", family),
17031
+ where33("isActive", "==", active)
16877
17032
  );
16878
17033
  const snapshot = await getCountFromServer3(q);
16879
17034
  counts[family] = snapshot.data().count;
@@ -16885,8 +17040,8 @@ var CategoryService = class extends BaseService {
16885
17040
  * @returns Lista svih aktivnih kategorija
16886
17041
  */
16887
17042
  async getAllForFilter() {
16888
- const q = query32(this.categoriesRef, where32("isActive", "==", true));
16889
- const snapshot = await getDocs32(q);
17043
+ const q = query33(this.categoriesRef, where33("isActive", "==", true));
17044
+ const snapshot = await getDocs33(q);
16890
17045
  return snapshot.docs.map(
16891
17046
  (doc38) => ({
16892
17047
  id: doc38.id,
@@ -16900,13 +17055,13 @@ var CategoryService = class extends BaseService {
16900
17055
  * @returns Lista aktivnih kategorija koje pripadaju traženoj familiji
16901
17056
  */
16902
17057
  async getAllForFilterByFamily(family) {
16903
- const q = query32(
17058
+ const q = query33(
16904
17059
  this.categoriesRef,
16905
- where32("family", "==", family),
16906
- where32("isActive", "==", true),
16907
- orderBy19("name")
17060
+ where33("family", "==", family),
17061
+ where33("isActive", "==", true),
17062
+ orderBy20("name")
16908
17063
  );
16909
- const snapshot = await getDocs32(q);
17064
+ const snapshot = await getDocs33(q);
16910
17065
  return snapshot.docs.map(
16911
17066
  (doc38) => ({
16912
17067
  id: doc38.id,
@@ -16922,13 +17077,13 @@ var CategoryService = class extends BaseService {
16922
17077
  async getAll(options = {}) {
16923
17078
  const { active = true, limit: queryLimit = 10, lastVisible } = options;
16924
17079
  const constraints = [
16925
- where32("isActive", "==", active),
16926
- orderBy19("name"),
16927
- queryLimit ? limit17(queryLimit) : void 0,
16928
- lastVisible ? startAfter15(lastVisible) : void 0
17080
+ where33("isActive", "==", active),
17081
+ orderBy20("name"),
17082
+ queryLimit ? limit18(queryLimit) : void 0,
17083
+ lastVisible ? startAfter16(lastVisible) : void 0
16929
17084
  ].filter((c) => !!c);
16930
- const q = query32(this.categoriesRef, ...constraints);
16931
- const snapshot = await getDocs32(q);
17085
+ const q = query33(this.categoriesRef, ...constraints);
17086
+ const snapshot = await getDocs33(q);
16932
17087
  const categories = snapshot.docs.map(
16933
17088
  (doc38) => ({
16934
17089
  id: doc38.id,
@@ -16947,14 +17102,14 @@ var CategoryService = class extends BaseService {
16947
17102
  async getAllByFamily(family, options = {}) {
16948
17103
  const { active = true, limit: queryLimit = 10, lastVisible } = options;
16949
17104
  const constraints = [
16950
- where32("family", "==", family),
16951
- where32("isActive", "==", active),
16952
- orderBy19("name"),
16953
- queryLimit ? limit17(queryLimit) : void 0,
16954
- lastVisible ? startAfter15(lastVisible) : void 0
17105
+ where33("family", "==", family),
17106
+ where33("isActive", "==", active),
17107
+ orderBy20("name"),
17108
+ queryLimit ? limit18(queryLimit) : void 0,
17109
+ lastVisible ? startAfter16(lastVisible) : void 0
16955
17110
  ].filter((c) => !!c);
16956
- const q = query32(this.categoriesRef, ...constraints);
16957
- const snapshot = await getDocs32(q);
17111
+ const q = query33(this.categoriesRef, ...constraints);
17112
+ const snapshot = await getDocs33(q);
16958
17113
  const categories = snapshot.docs.map(
16959
17114
  (doc38) => ({
16960
17115
  id: doc38.id,
@@ -17012,20 +17167,20 @@ var CategoryService = class extends BaseService {
17012
17167
  // src/backoffice/services/subcategory.service.ts
17013
17168
  import {
17014
17169
  addDoc as addDoc5,
17015
- collection as collection33,
17170
+ collection as collection34,
17016
17171
  collectionGroup as collectionGroup2,
17017
17172
  deleteDoc as deleteDoc20,
17018
17173
  doc as doc34,
17019
17174
  getCountFromServer as getCountFromServer4,
17020
17175
  getDoc as getDoc36,
17021
- getDocs as getDocs33,
17022
- limit as limit18,
17023
- orderBy as orderBy20,
17024
- query as query33,
17176
+ getDocs as getDocs34,
17177
+ limit as limit19,
17178
+ orderBy as orderBy21,
17179
+ query as query34,
17025
17180
  setDoc as setDoc28,
17026
- startAfter as startAfter16,
17181
+ startAfter as startAfter17,
17027
17182
  updateDoc as updateDoc32,
17028
- where as where33
17183
+ where as where34
17029
17184
  } from "firebase/firestore";
17030
17185
 
17031
17186
  // src/backoffice/types/subcategory.types.ts
@@ -17038,7 +17193,7 @@ var SubcategoryService = class extends BaseService {
17038
17193
  * @param categoryId - ID roditeljske kategorije
17039
17194
  */
17040
17195
  getSubcategoriesRef(categoryId) {
17041
- return collection33(
17196
+ return collection34(
17042
17197
  this.db,
17043
17198
  CATEGORIES_COLLECTION,
17044
17199
  categoryId,
@@ -17072,13 +17227,13 @@ var SubcategoryService = class extends BaseService {
17072
17227
  * @returns A record mapping category ID to subcategory count.
17073
17228
  */
17074
17229
  async getSubcategoryCounts(active = true) {
17075
- const categoriesRef = collection33(this.db, CATEGORIES_COLLECTION);
17076
- const categoriesSnapshot = await getDocs33(categoriesRef);
17230
+ const categoriesRef = collection34(this.db, CATEGORIES_COLLECTION);
17231
+ const categoriesSnapshot = await getDocs34(categoriesRef);
17077
17232
  const counts = {};
17078
17233
  for (const categoryDoc of categoriesSnapshot.docs) {
17079
17234
  const categoryId = categoryDoc.id;
17080
17235
  const subcategoriesRef = this.getSubcategoriesRef(categoryId);
17081
- const q = query33(subcategoriesRef, where33("isActive", "==", active));
17236
+ const q = query34(subcategoriesRef, where34("isActive", "==", active));
17082
17237
  const snapshot = await getCountFromServer4(q);
17083
17238
  counts[categoryId] = snapshot.data().count;
17084
17239
  }
@@ -17093,13 +17248,13 @@ var SubcategoryService = class extends BaseService {
17093
17248
  async getAllByCategoryId(categoryId, options = {}) {
17094
17249
  const { active = true, limit: queryLimit = 10, lastVisible } = options;
17095
17250
  const constraints = [
17096
- where33("isActive", "==", active),
17097
- orderBy20("name"),
17098
- queryLimit ? limit18(queryLimit) : void 0,
17099
- lastVisible ? startAfter16(lastVisible) : void 0
17251
+ where34("isActive", "==", active),
17252
+ orderBy21("name"),
17253
+ queryLimit ? limit19(queryLimit) : void 0,
17254
+ lastVisible ? startAfter17(lastVisible) : void 0
17100
17255
  ].filter((c) => !!c);
17101
- const q = query33(this.getSubcategoriesRef(categoryId), ...constraints);
17102
- const querySnapshot = await getDocs33(q);
17256
+ const q = query34(this.getSubcategoriesRef(categoryId), ...constraints);
17257
+ const querySnapshot = await getDocs34(q);
17103
17258
  const subcategories = querySnapshot.docs.map(
17104
17259
  (doc38) => ({
17105
17260
  id: doc38.id,
@@ -17120,16 +17275,16 @@ var SubcategoryService = class extends BaseService {
17120
17275
  async getAll(options = {}) {
17121
17276
  const { active = true, limit: queryLimit = 10, lastVisible } = options;
17122
17277
  const constraints = [
17123
- where33("isActive", "==", active),
17124
- orderBy20("name"),
17125
- queryLimit ? limit18(queryLimit) : void 0,
17126
- lastVisible ? startAfter16(lastVisible) : void 0
17278
+ where34("isActive", "==", active),
17279
+ orderBy21("name"),
17280
+ queryLimit ? limit19(queryLimit) : void 0,
17281
+ lastVisible ? startAfter17(lastVisible) : void 0
17127
17282
  ].filter((c) => !!c);
17128
- const q = query33(
17283
+ const q = query34(
17129
17284
  collectionGroup2(this.db, SUBCATEGORIES_COLLECTION),
17130
17285
  ...constraints
17131
17286
  );
17132
- const querySnapshot = await getDocs33(q);
17287
+ const querySnapshot = await getDocs34(q);
17133
17288
  const subcategories = querySnapshot.docs.map(
17134
17289
  (doc38) => ({
17135
17290
  id: doc38.id,
@@ -17145,11 +17300,11 @@ var SubcategoryService = class extends BaseService {
17145
17300
  * @returns Lista svih aktivnih subkategorija
17146
17301
  */
17147
17302
  async getAllForFilterByCategoryId(categoryId) {
17148
- const q = query33(
17303
+ const q = query34(
17149
17304
  this.getSubcategoriesRef(categoryId),
17150
- where33("isActive", "==", true)
17305
+ where34("isActive", "==", true)
17151
17306
  );
17152
- const querySnapshot = await getDocs33(q);
17307
+ const querySnapshot = await getDocs34(q);
17153
17308
  return querySnapshot.docs.map(
17154
17309
  (doc38) => ({
17155
17310
  id: doc38.id,
@@ -17162,11 +17317,11 @@ var SubcategoryService = class extends BaseService {
17162
17317
  * @returns Lista svih aktivnih subkategorija
17163
17318
  */
17164
17319
  async getAllForFilter() {
17165
- const q = query33(
17320
+ const q = query34(
17166
17321
  collectionGroup2(this.db, SUBCATEGORIES_COLLECTION),
17167
- where33("isActive", "==", true)
17322
+ where34("isActive", "==", true)
17168
17323
  );
17169
- const querySnapshot = await getDocs33(q);
17324
+ const querySnapshot = await getDocs34(q);
17170
17325
  return querySnapshot.docs.map(
17171
17326
  (doc38) => ({
17172
17327
  id: doc38.id,
@@ -17255,16 +17410,16 @@ var SubcategoryService = class extends BaseService {
17255
17410
  // src/backoffice/services/technology.service.ts
17256
17411
  import {
17257
17412
  addDoc as addDoc6,
17258
- collection as collection34,
17413
+ collection as collection35,
17259
17414
  doc as doc35,
17260
17415
  getDoc as getDoc37,
17261
- getDocs as getDocs34,
17262
- limit as limit19,
17263
- orderBy as orderBy21,
17264
- query as query34,
17265
- startAfter as startAfter17,
17416
+ getDocs as getDocs35,
17417
+ limit as limit20,
17418
+ orderBy as orderBy22,
17419
+ query as query35,
17420
+ startAfter as startAfter18,
17266
17421
  updateDoc as updateDoc33,
17267
- where as where34,
17422
+ where as where35,
17268
17423
  arrayUnion as arrayUnion9,
17269
17424
  arrayRemove as arrayRemove8
17270
17425
  } from "firebase/firestore";
@@ -17277,7 +17432,7 @@ var TechnologyService = class extends BaseService {
17277
17432
  * Reference to the Firestore collection of technologies.
17278
17433
  */
17279
17434
  get technologiesRef() {
17280
- return collection34(this.db, TECHNOLOGIES_COLLECTION);
17435
+ return collection35(this.db, TECHNOLOGIES_COLLECTION);
17281
17436
  }
17282
17437
  /**
17283
17438
  * Creates a new technology.
@@ -17314,8 +17469,8 @@ var TechnologyService = class extends BaseService {
17314
17469
  * @returns A record mapping subcategory ID to technology count.
17315
17470
  */
17316
17471
  async getTechnologyCounts(active = true) {
17317
- const q = query34(this.technologiesRef, where34("isActive", "==", active));
17318
- const snapshot = await getDocs34(q);
17472
+ const q = query35(this.technologiesRef, where35("isActive", "==", active));
17473
+ const snapshot = await getDocs35(q);
17319
17474
  const counts = {};
17320
17475
  snapshot.docs.forEach((doc38) => {
17321
17476
  const tech = doc38.data();
@@ -17329,8 +17484,8 @@ var TechnologyService = class extends BaseService {
17329
17484
  * @returns A record mapping category ID to technology count.
17330
17485
  */
17331
17486
  async getTechnologyCountsByCategory(active = true) {
17332
- const q = query34(this.technologiesRef, where34("isActive", "==", active));
17333
- const snapshot = await getDocs34(q);
17487
+ const q = query35(this.technologiesRef, where35("isActive", "==", active));
17488
+ const snapshot = await getDocs35(q);
17334
17489
  const counts = {};
17335
17490
  snapshot.docs.forEach((doc38) => {
17336
17491
  const tech = doc38.data();
@@ -17346,13 +17501,13 @@ var TechnologyService = class extends BaseService {
17346
17501
  async getAll(options = {}) {
17347
17502
  const { active = true, limit: queryLimit = 10, lastVisible } = options;
17348
17503
  const constraints = [
17349
- where34("isActive", "==", active),
17350
- orderBy21("name"),
17351
- queryLimit ? limit19(queryLimit) : void 0,
17352
- lastVisible ? startAfter17(lastVisible) : void 0
17504
+ where35("isActive", "==", active),
17505
+ orderBy22("name"),
17506
+ queryLimit ? limit20(queryLimit) : void 0,
17507
+ lastVisible ? startAfter18(lastVisible) : void 0
17353
17508
  ].filter((c) => !!c);
17354
- const q = query34(this.technologiesRef, ...constraints);
17355
- const snapshot = await getDocs34(q);
17509
+ const q = query35(this.technologiesRef, ...constraints);
17510
+ const snapshot = await getDocs35(q);
17356
17511
  const technologies = snapshot.docs.map(
17357
17512
  (doc38) => ({
17358
17513
  id: doc38.id,
@@ -17371,14 +17526,14 @@ var TechnologyService = class extends BaseService {
17371
17526
  async getAllByCategoryId(categoryId, options = {}) {
17372
17527
  const { active = true, limit: queryLimit = 10, lastVisible } = options;
17373
17528
  const constraints = [
17374
- where34("categoryId", "==", categoryId),
17375
- where34("isActive", "==", active),
17376
- orderBy21("name"),
17377
- queryLimit ? limit19(queryLimit) : void 0,
17378
- lastVisible ? startAfter17(lastVisible) : void 0
17529
+ where35("categoryId", "==", categoryId),
17530
+ where35("isActive", "==", active),
17531
+ orderBy22("name"),
17532
+ queryLimit ? limit20(queryLimit) : void 0,
17533
+ lastVisible ? startAfter18(lastVisible) : void 0
17379
17534
  ].filter((c) => !!c);
17380
- const q = query34(this.technologiesRef, ...constraints);
17381
- const snapshot = await getDocs34(q);
17535
+ const q = query35(this.technologiesRef, ...constraints);
17536
+ const snapshot = await getDocs35(q);
17382
17537
  const technologies = snapshot.docs.map(
17383
17538
  (doc38) => ({
17384
17539
  id: doc38.id,
@@ -17397,14 +17552,14 @@ var TechnologyService = class extends BaseService {
17397
17552
  async getAllBySubcategoryId(subcategoryId, options = {}) {
17398
17553
  const { active = true, limit: queryLimit = 10, lastVisible } = options;
17399
17554
  const constraints = [
17400
- where34("subcategoryId", "==", subcategoryId),
17401
- where34("isActive", "==", active),
17402
- orderBy21("name"),
17403
- queryLimit ? limit19(queryLimit) : void 0,
17404
- lastVisible ? startAfter17(lastVisible) : void 0
17555
+ where35("subcategoryId", "==", subcategoryId),
17556
+ where35("isActive", "==", active),
17557
+ orderBy22("name"),
17558
+ queryLimit ? limit20(queryLimit) : void 0,
17559
+ lastVisible ? startAfter18(lastVisible) : void 0
17405
17560
  ].filter((c) => !!c);
17406
- const q = query34(this.technologiesRef, ...constraints);
17407
- const snapshot = await getDocs34(q);
17561
+ const q = query35(this.technologiesRef, ...constraints);
17562
+ const snapshot = await getDocs35(q);
17408
17563
  const technologies = snapshot.docs.map(
17409
17564
  (doc38) => ({
17410
17565
  id: doc38.id,
@@ -17813,13 +17968,13 @@ var TechnologyService = class extends BaseService {
17813
17968
  * @param subcategoryId - The ID of the subcategory.
17814
17969
  */
17815
17970
  async getAllForFilterBySubcategory(subcategoryId) {
17816
- const q = query34(
17817
- collection34(this.db, TECHNOLOGIES_COLLECTION),
17818
- where34("isActive", "==", true),
17819
- where34("subcategoryId", "==", subcategoryId),
17820
- orderBy21("name")
17971
+ const q = query35(
17972
+ collection35(this.db, TECHNOLOGIES_COLLECTION),
17973
+ where35("isActive", "==", true),
17974
+ where35("subcategoryId", "==", subcategoryId),
17975
+ orderBy22("name")
17821
17976
  );
17822
- const snapshot = await getDocs34(q);
17977
+ const snapshot = await getDocs35(q);
17823
17978
  return snapshot.docs.map(
17824
17979
  (doc38) => ({
17825
17980
  id: doc38.id,
@@ -17833,14 +17988,14 @@ var TechnologyService = class extends BaseService {
17833
17988
  * @param subcategoryId - The ID of the subcategory.
17834
17989
  */
17835
17990
  async getAllForFilterBySubcategoryId(categoryId, subcategoryId) {
17836
- const q = query34(
17837
- collection34(this.db, TECHNOLOGIES_COLLECTION),
17838
- where34("isActive", "==", true),
17839
- where34("categoryId", "==", categoryId),
17840
- where34("subcategoryId", "==", subcategoryId),
17841
- orderBy21("name")
17991
+ const q = query35(
17992
+ collection35(this.db, TECHNOLOGIES_COLLECTION),
17993
+ where35("isActive", "==", true),
17994
+ where35("categoryId", "==", categoryId),
17995
+ where35("subcategoryId", "==", subcategoryId),
17996
+ orderBy22("name")
17842
17997
  );
17843
- const snapshot = await getDocs34(q);
17998
+ const snapshot = await getDocs35(q);
17844
17999
  return snapshot.docs.map(
17845
18000
  (doc38) => ({
17846
18001
  id: doc38.id,
@@ -17852,12 +18007,12 @@ var TechnologyService = class extends BaseService {
17852
18007
  * Gets all active technologies for filter dropdowns.
17853
18008
  */
17854
18009
  async getAllForFilter() {
17855
- const q = query34(
17856
- collection34(this.db, TECHNOLOGIES_COLLECTION),
17857
- where34("isActive", "==", true),
17858
- orderBy21("name")
18010
+ const q = query35(
18011
+ collection35(this.db, TECHNOLOGIES_COLLECTION),
18012
+ where35("isActive", "==", true),
18013
+ orderBy22("name")
17859
18014
  );
17860
- const snapshot = await getDocs34(q);
18015
+ const snapshot = await getDocs35(q);
17861
18016
  return snapshot.docs.map(
17862
18017
  (doc38) => ({
17863
18018
  id: doc38.id,
@@ -17870,17 +18025,17 @@ var TechnologyService = class extends BaseService {
17870
18025
  // src/backoffice/services/product.service.ts
17871
18026
  import {
17872
18027
  addDoc as addDoc7,
17873
- collection as collection35,
18028
+ collection as collection36,
17874
18029
  collectionGroup as collectionGroup3,
17875
18030
  doc as doc36,
17876
18031
  getDoc as getDoc38,
17877
- getDocs as getDocs35,
17878
- query as query35,
18032
+ getDocs as getDocs36,
18033
+ query as query36,
17879
18034
  updateDoc as updateDoc34,
17880
- where as where35,
17881
- limit as limit20,
17882
- orderBy as orderBy22,
17883
- startAfter as startAfter18,
18035
+ where as where36,
18036
+ limit as limit21,
18037
+ orderBy as orderBy23,
18038
+ startAfter as startAfter19,
17884
18039
  getCountFromServer as getCountFromServer6
17885
18040
  } from "firebase/firestore";
17886
18041
 
@@ -17895,7 +18050,7 @@ var ProductService = class extends BaseService {
17895
18050
  * @returns Firestore collection reference
17896
18051
  */
17897
18052
  getProductsRef(technologyId) {
17898
- return collection35(this.db, TECHNOLOGIES_COLLECTION, technologyId, PRODUCTS_COLLECTION);
18053
+ return collection36(this.db, TECHNOLOGIES_COLLECTION, technologyId, PRODUCTS_COLLECTION);
17899
18054
  }
17900
18055
  /**
17901
18056
  * Creates a new product under technology
@@ -17919,22 +18074,22 @@ var ProductService = class extends BaseService {
17919
18074
  */
17920
18075
  async getAll(options) {
17921
18076
  const { rowsPerPage, lastVisible, categoryId, subcategoryId, technologyId } = options;
17922
- const constraints = [where35("isActive", "==", true), orderBy22("name")];
18077
+ const constraints = [where36("isActive", "==", true), orderBy23("name")];
17923
18078
  if (categoryId) {
17924
- constraints.push(where35("categoryId", "==", categoryId));
18079
+ constraints.push(where36("categoryId", "==", categoryId));
17925
18080
  }
17926
18081
  if (subcategoryId) {
17927
- constraints.push(where35("subcategoryId", "==", subcategoryId));
18082
+ constraints.push(where36("subcategoryId", "==", subcategoryId));
17928
18083
  }
17929
18084
  if (technologyId) {
17930
- constraints.push(where35("technologyId", "==", technologyId));
18085
+ constraints.push(where36("technologyId", "==", technologyId));
17931
18086
  }
17932
18087
  if (lastVisible) {
17933
- constraints.push(startAfter18(lastVisible));
18088
+ constraints.push(startAfter19(lastVisible));
17934
18089
  }
17935
- constraints.push(limit20(rowsPerPage));
17936
- const q = query35(collectionGroup3(this.db, PRODUCTS_COLLECTION), ...constraints);
17937
- const snapshot = await getDocs35(q);
18090
+ constraints.push(limit21(rowsPerPage));
18091
+ const q = query36(collectionGroup3(this.db, PRODUCTS_COLLECTION), ...constraints);
18092
+ const snapshot = await getDocs36(q);
17938
18093
  const products = snapshot.docs.map(
17939
18094
  (doc38) => ({
17940
18095
  id: doc38.id,
@@ -17949,17 +18104,17 @@ var ProductService = class extends BaseService {
17949
18104
  */
17950
18105
  async getProductsCount(options) {
17951
18106
  const { categoryId, subcategoryId, technologyId } = options;
17952
- const constraints = [where35("isActive", "==", true)];
18107
+ const constraints = [where36("isActive", "==", true)];
17953
18108
  if (categoryId) {
17954
- constraints.push(where35("categoryId", "==", categoryId));
18109
+ constraints.push(where36("categoryId", "==", categoryId));
17955
18110
  }
17956
18111
  if (subcategoryId) {
17957
- constraints.push(where35("subcategoryId", "==", subcategoryId));
18112
+ constraints.push(where36("subcategoryId", "==", subcategoryId));
17958
18113
  }
17959
18114
  if (technologyId) {
17960
- constraints.push(where35("technologyId", "==", technologyId));
18115
+ constraints.push(where36("technologyId", "==", technologyId));
17961
18116
  }
17962
- const q = query35(collectionGroup3(this.db, PRODUCTS_COLLECTION), ...constraints);
18117
+ const q = query36(collectionGroup3(this.db, PRODUCTS_COLLECTION), ...constraints);
17963
18118
  const snapshot = await getCountFromServer6(q);
17964
18119
  return snapshot.data().count;
17965
18120
  }
@@ -17968,8 +18123,8 @@ var ProductService = class extends BaseService {
17968
18123
  * This uses a single collectionGroup query for efficiency.
17969
18124
  */
17970
18125
  async getProductCounts() {
17971
- const q = query35(collectionGroup3(this.db, PRODUCTS_COLLECTION), where35("isActive", "==", true));
17972
- const snapshot = await getDocs35(q);
18126
+ const q = query36(collectionGroup3(this.db, PRODUCTS_COLLECTION), where36("isActive", "==", true));
18127
+ const snapshot = await getDocs36(q);
17973
18128
  const counts = {
17974
18129
  byCategory: {},
17975
18130
  bySubcategory: {},
@@ -17997,12 +18152,12 @@ var ProductService = class extends BaseService {
17997
18152
  * Gets all products for a specific technology (non-paginated, for filters/dropdowns)
17998
18153
  */
17999
18154
  async getAllByTechnology(technologyId) {
18000
- const q = query35(
18155
+ const q = query36(
18001
18156
  this.getProductsRef(technologyId),
18002
- where35("isActive", "==", true),
18003
- orderBy22("name")
18157
+ where36("isActive", "==", true),
18158
+ orderBy23("name")
18004
18159
  );
18005
- const snapshot = await getDocs35(q);
18160
+ const snapshot = await getDocs36(q);
18006
18161
  return snapshot.docs.map(
18007
18162
  (doc38) => ({
18008
18163
  id: doc38.id,
@@ -18014,16 +18169,16 @@ var ProductService = class extends BaseService {
18014
18169
  * Gets all products for a brand by filtering through all technologies
18015
18170
  */
18016
18171
  async getAllByBrand(brandId) {
18017
- const allTechnologiesRef = collection35(this.db, TECHNOLOGIES_COLLECTION);
18018
- const technologiesSnapshot = await getDocs35(allTechnologiesRef);
18172
+ const allTechnologiesRef = collection36(this.db, TECHNOLOGIES_COLLECTION);
18173
+ const technologiesSnapshot = await getDocs36(allTechnologiesRef);
18019
18174
  const products = [];
18020
18175
  for (const techDoc of technologiesSnapshot.docs) {
18021
- const q = query35(
18176
+ const q = query36(
18022
18177
  this.getProductsRef(techDoc.id),
18023
- where35("brandId", "==", brandId),
18024
- where35("isActive", "==", true)
18178
+ where36("brandId", "==", brandId),
18179
+ where36("isActive", "==", true)
18025
18180
  );
18026
- const snapshot = await getDocs35(q);
18181
+ const snapshot = await getDocs36(q);
18027
18182
  products.push(
18028
18183
  ...snapshot.docs.map(
18029
18184
  (doc38) => ({
@@ -18119,9 +18274,9 @@ var ConstantsService = class extends BaseService {
18119
18274
  */
18120
18275
  async getAllBenefits(options) {
18121
18276
  const allBenefits = await this.getAllBenefitsForFilter();
18122
- const { page, limit: limit21 } = options;
18123
- const startIndex = page * limit21;
18124
- const endIndex = startIndex + limit21;
18277
+ const { page, limit: limit22 } = options;
18278
+ const startIndex = page * limit22;
18279
+ const endIndex = startIndex + limit22;
18125
18280
  const paginatedBenefits = allBenefits.slice(startIndex, endIndex);
18126
18281
  return { benefits: paginatedBenefits, total: allBenefits.length };
18127
18282
  }
@@ -18218,9 +18373,9 @@ var ConstantsService = class extends BaseService {
18218
18373
  */
18219
18374
  async getAllContraindications(options) {
18220
18375
  const allContraindications = await this.getAllContraindicationsForFilter();
18221
- const { page, limit: limit21 } = options;
18222
- const startIndex = page * limit21;
18223
- const endIndex = startIndex + limit21;
18376
+ const { page, limit: limit22 } = options;
18377
+ const startIndex = page * limit22;
18378
+ const endIndex = startIndex + limit22;
18224
18379
  const paginatedContraindications = allContraindications.slice(
18225
18380
  startIndex,
18226
18381
  endIndex
@@ -18365,6 +18520,7 @@ export {
18365
18520
  AuthService,
18366
18521
  BaseService,
18367
18522
  BillingTransactionType,
18523
+ BillingTransactionsService,
18368
18524
  BlockingCondition,
18369
18525
  BrandService,
18370
18526
  CALENDAR_COLLECTION,