@blackcode_sa/metaestetics-api 1.14.32 → 1.14.36

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.d.mts CHANGED
@@ -200,7 +200,6 @@ interface ContraindicationDynamic {
200
200
  * @property manufacturer - Naziv proizvođača
201
201
  * @property description - Detaljan opis brenda i njegovih proizvoda
202
202
  * @property website - Web stranica brenda
203
- * @property category - Kategorija brenda (npr. "laser", "peeling", "injectables") - za filtriranje
204
203
  * @property isActive - Da li je brend aktivan u sistemu
205
204
  * @property createdAt - Datum kreiranja
206
205
  * @property updatedAt - Datum poslednjeg ažuriranja
@@ -215,7 +214,6 @@ interface Brand {
215
214
  isActive: boolean;
216
215
  website?: string;
217
216
  description?: string;
218
- category?: string;
219
217
  }
220
218
 
221
219
  /**
@@ -570,20 +568,15 @@ interface FilledDocumentFileValue {
570
568
 
571
569
  /**
572
570
  * Product used in procedures
573
- * Can be consumables, equipment, or any other product needed for performing procedures
571
+ * Simplified structure with only essential fields and flexible metadata
574
572
  *
575
573
  * @property id - Unique identifier of the product
576
574
  * @property name - Name of the product
577
- * @property brandId - ID of the brand that manufactures this product
578
- * @property brandName - Name of the brand (denormalized for display)
575
+ * @property brandId - Reference to the Brand document ID
576
+ * @property brandName - Display name of the brand (denormalized for performance)
577
+ * @property description - Detailed description of the product
579
578
  * @property assignedTechnologyIds - Array of technology IDs this product is assigned to
580
- * @property description - Detailed description of the product and its purpose
581
- * @property technicalDetails - Technical details and specifications
582
- * @property warnings - List of warnings related to product use
583
- * @property dosage - Dosage information (if applicable)
584
- * @property composition - Product composition
585
- * @property indications - List of indications for use
586
- * @property contraindications - List of contraindications
579
+ * @property metadata - Flexible key-value pairs for additional product information
587
580
  * @property isActive - Whether the product is active in the system
588
581
  * @property createdAt - Creation date
589
582
  * @property updatedAt - Last update date
@@ -593,17 +586,13 @@ interface Product {
593
586
  name: string;
594
587
  brandId: string;
595
588
  brandName: string;
589
+ description: string;
590
+ category?: string;
596
591
  assignedTechnologyIds?: string[];
592
+ metadata?: Record<string, string | number | boolean>;
593
+ isActive: boolean;
597
594
  createdAt: Date;
598
595
  updatedAt: Date;
599
- isActive: boolean;
600
- description?: string;
601
- technicalDetails?: string;
602
- warnings?: string[];
603
- dosage?: string;
604
- composition?: string;
605
- indications?: string[];
606
- contraindications?: ContraindicationDynamic[];
607
596
  /** Present only in subcollections - synced from technology metadata */
608
597
  technologyId?: string;
609
598
  /** Present only in subcollections - synced from technology name */
@@ -622,11 +611,10 @@ interface Product {
622
611
  interface IProductService {
623
612
  /**
624
613
  * Creates a new product in the top-level collection
625
- * @param brandId - ID of the brand that manufactures this product
626
614
  * @param product - Product data
627
615
  * @param technologyIds - Optional array of technology IDs to assign this product to
628
616
  */
629
- createTopLevel(brandId: string, product: Omit<Product, 'id' | 'createdAt' | 'updatedAt' | 'brandId' | 'assignedTechnologyIds'>, technologyIds?: string[]): Promise<Product>;
617
+ createTopLevel(product: Omit<Product, 'id' | 'createdAt' | 'updatedAt' | 'assignedTechnologyIds'>, technologyIds?: string[]): Promise<Product>;
630
618
  /**
631
619
  * Gets all products from the top-level collection
632
620
  * @param options - Query options
@@ -635,6 +623,7 @@ interface IProductService {
635
623
  rowsPerPage: number;
636
624
  lastVisible?: any;
637
625
  brandId?: string;
626
+ category?: string;
638
627
  }): Promise<{
639
628
  products: Product[];
640
629
  lastVisible: any;
@@ -649,7 +638,7 @@ interface IProductService {
649
638
  * @param productId - ID of the product to update
650
639
  * @param product - Updated product data
651
640
  */
652
- updateTopLevel(productId: string, product: Partial<Omit<Product, 'id' | 'createdAt' | 'brandId'>>): Promise<Product | null>;
641
+ updateTopLevel(productId: string, product: Partial<Omit<Product, 'id' | 'createdAt'>>): Promise<Product | null>;
653
642
  /**
654
643
  * Deletes a product from the top-level collection (soft delete)
655
644
  * @param productId - ID of the product to delete
@@ -1166,26 +1155,23 @@ declare class BrandService extends BaseService {
1166
1155
  name_lowercase: string;
1167
1156
  manufacturer: string;
1168
1157
  website?: string | undefined;
1169
- category?: string | undefined;
1170
1158
  id: string;
1171
1159
  }>;
1172
1160
  /**
1173
- * Gets a paginated list of active brands, optionally filtered by name and category.
1161
+ * Gets a paginated list of active brands, optionally filtered by name.
1174
1162
  * @param rowsPerPage - The number of brands to fetch.
1175
1163
  * @param searchTerm - An optional string to filter brand names by (starts-with search).
1176
1164
  * @param lastVisible - An optional document snapshot to use as a cursor for pagination.
1177
- * @param category - An optional category to filter brands by.
1178
1165
  */
1179
- getAll(rowsPerPage: number, searchTerm?: string, lastVisible?: any, category?: string): Promise<{
1166
+ getAll(rowsPerPage: number, searchTerm?: string, lastVisible?: any): Promise<{
1180
1167
  brands: Brand[];
1181
1168
  lastVisible: _firebase_firestore.QueryDocumentSnapshot<DocumentData, DocumentData>;
1182
1169
  }>;
1183
1170
  /**
1184
- * Gets the total count of active brands, optionally filtered by name and category.
1171
+ * Gets the total count of active brands, optionally filtered by name.
1185
1172
  * @param searchTerm - An optional string to filter brand names by (starts-with search).
1186
- * @param category - An optional category to filter brands by.
1187
1173
  */
1188
- getBrandsCount(searchTerm?: string, category?: string): Promise<number>;
1174
+ getBrandsCount(searchTerm?: string): Promise<number>;
1189
1175
  /**
1190
1176
  * Gets all active brands for filter dropdowns (not paginated).
1191
1177
  */
@@ -1692,7 +1678,7 @@ declare class ProductService extends BaseService implements IProductService {
1692
1678
  /**
1693
1679
  * Creates a new product in the top-level collection
1694
1680
  */
1695
- createTopLevel(brandId: string, product: Omit<Product, 'id' | 'createdAt' | 'updatedAt' | 'brandId' | 'assignedTechnologyIds'>, technologyIds?: string[]): Promise<Product>;
1681
+ createTopLevel(product: Omit<Product, 'id' | 'createdAt' | 'updatedAt' | 'assignedTechnologyIds'>, technologyIds?: string[]): Promise<Product>;
1696
1682
  /**
1697
1683
  * Gets all products from the top-level collection
1698
1684
  */
@@ -1700,6 +1686,7 @@ declare class ProductService extends BaseService implements IProductService {
1700
1686
  rowsPerPage: number;
1701
1687
  lastVisible?: any;
1702
1688
  brandId?: string;
1689
+ category?: string;
1703
1690
  }): Promise<{
1704
1691
  products: Product[];
1705
1692
  lastVisible: any;
@@ -1711,7 +1698,7 @@ declare class ProductService extends BaseService implements IProductService {
1711
1698
  /**
1712
1699
  * Updates a product in the top-level collection
1713
1700
  */
1714
- updateTopLevel(productId: string, product: Partial<Omit<Product, 'id' | 'createdAt' | 'brandId'>>): Promise<Product | null>;
1701
+ updateTopLevel(productId: string, product: Partial<Omit<Product, 'id' | 'createdAt'>>): Promise<Product | null>;
1715
1702
  /**
1716
1703
  * Deletes a product from the top-level collection (soft delete)
1717
1704
  */
@@ -2221,15 +2208,15 @@ declare class TechnologyService extends BaseService implements ITechnologyServic
2221
2208
  description: string;
2222
2209
  family: ProcedureFamily;
2223
2210
  isActive: boolean;
2224
- technicalDetails?: string | undefined;
2225
- contraindications: ContraindicationDynamic[];
2226
2211
  categoryId: string;
2227
2212
  subcategoryId: string;
2213
+ technicalDetails?: string | undefined;
2228
2214
  requirements: {
2229
2215
  pre: Requirement[];
2230
2216
  post: Requirement[];
2231
2217
  };
2232
2218
  blockingConditions: BlockingCondition[];
2219
+ contraindications: ContraindicationDynamic[];
2233
2220
  benefits: TreatmentBenefitDynamic[];
2234
2221
  certificationRequirement: CertificationRequirement;
2235
2222
  documentationTemplates?: TechnologyDocumentationTemplate[] | undefined;
package/dist/index.d.ts CHANGED
@@ -200,7 +200,6 @@ interface ContraindicationDynamic {
200
200
  * @property manufacturer - Naziv proizvođača
201
201
  * @property description - Detaljan opis brenda i njegovih proizvoda
202
202
  * @property website - Web stranica brenda
203
- * @property category - Kategorija brenda (npr. "laser", "peeling", "injectables") - za filtriranje
204
203
  * @property isActive - Da li je brend aktivan u sistemu
205
204
  * @property createdAt - Datum kreiranja
206
205
  * @property updatedAt - Datum poslednjeg ažuriranja
@@ -215,7 +214,6 @@ interface Brand {
215
214
  isActive: boolean;
216
215
  website?: string;
217
216
  description?: string;
218
- category?: string;
219
217
  }
220
218
 
221
219
  /**
@@ -570,20 +568,15 @@ interface FilledDocumentFileValue {
570
568
 
571
569
  /**
572
570
  * Product used in procedures
573
- * Can be consumables, equipment, or any other product needed for performing procedures
571
+ * Simplified structure with only essential fields and flexible metadata
574
572
  *
575
573
  * @property id - Unique identifier of the product
576
574
  * @property name - Name of the product
577
- * @property brandId - ID of the brand that manufactures this product
578
- * @property brandName - Name of the brand (denormalized for display)
575
+ * @property brandId - Reference to the Brand document ID
576
+ * @property brandName - Display name of the brand (denormalized for performance)
577
+ * @property description - Detailed description of the product
579
578
  * @property assignedTechnologyIds - Array of technology IDs this product is assigned to
580
- * @property description - Detailed description of the product and its purpose
581
- * @property technicalDetails - Technical details and specifications
582
- * @property warnings - List of warnings related to product use
583
- * @property dosage - Dosage information (if applicable)
584
- * @property composition - Product composition
585
- * @property indications - List of indications for use
586
- * @property contraindications - List of contraindications
579
+ * @property metadata - Flexible key-value pairs for additional product information
587
580
  * @property isActive - Whether the product is active in the system
588
581
  * @property createdAt - Creation date
589
582
  * @property updatedAt - Last update date
@@ -593,17 +586,13 @@ interface Product {
593
586
  name: string;
594
587
  brandId: string;
595
588
  brandName: string;
589
+ description: string;
590
+ category?: string;
596
591
  assignedTechnologyIds?: string[];
592
+ metadata?: Record<string, string | number | boolean>;
593
+ isActive: boolean;
597
594
  createdAt: Date;
598
595
  updatedAt: Date;
599
- isActive: boolean;
600
- description?: string;
601
- technicalDetails?: string;
602
- warnings?: string[];
603
- dosage?: string;
604
- composition?: string;
605
- indications?: string[];
606
- contraindications?: ContraindicationDynamic[];
607
596
  /** Present only in subcollections - synced from technology metadata */
608
597
  technologyId?: string;
609
598
  /** Present only in subcollections - synced from technology name */
@@ -622,11 +611,10 @@ interface Product {
622
611
  interface IProductService {
623
612
  /**
624
613
  * Creates a new product in the top-level collection
625
- * @param brandId - ID of the brand that manufactures this product
626
614
  * @param product - Product data
627
615
  * @param technologyIds - Optional array of technology IDs to assign this product to
628
616
  */
629
- createTopLevel(brandId: string, product: Omit<Product, 'id' | 'createdAt' | 'updatedAt' | 'brandId' | 'assignedTechnologyIds'>, technologyIds?: string[]): Promise<Product>;
617
+ createTopLevel(product: Omit<Product, 'id' | 'createdAt' | 'updatedAt' | 'assignedTechnologyIds'>, technologyIds?: string[]): Promise<Product>;
630
618
  /**
631
619
  * Gets all products from the top-level collection
632
620
  * @param options - Query options
@@ -635,6 +623,7 @@ interface IProductService {
635
623
  rowsPerPage: number;
636
624
  lastVisible?: any;
637
625
  brandId?: string;
626
+ category?: string;
638
627
  }): Promise<{
639
628
  products: Product[];
640
629
  lastVisible: any;
@@ -649,7 +638,7 @@ interface IProductService {
649
638
  * @param productId - ID of the product to update
650
639
  * @param product - Updated product data
651
640
  */
652
- updateTopLevel(productId: string, product: Partial<Omit<Product, 'id' | 'createdAt' | 'brandId'>>): Promise<Product | null>;
641
+ updateTopLevel(productId: string, product: Partial<Omit<Product, 'id' | 'createdAt'>>): Promise<Product | null>;
653
642
  /**
654
643
  * Deletes a product from the top-level collection (soft delete)
655
644
  * @param productId - ID of the product to delete
@@ -1166,26 +1155,23 @@ declare class BrandService extends BaseService {
1166
1155
  name_lowercase: string;
1167
1156
  manufacturer: string;
1168
1157
  website?: string | undefined;
1169
- category?: string | undefined;
1170
1158
  id: string;
1171
1159
  }>;
1172
1160
  /**
1173
- * Gets a paginated list of active brands, optionally filtered by name and category.
1161
+ * Gets a paginated list of active brands, optionally filtered by name.
1174
1162
  * @param rowsPerPage - The number of brands to fetch.
1175
1163
  * @param searchTerm - An optional string to filter brand names by (starts-with search).
1176
1164
  * @param lastVisible - An optional document snapshot to use as a cursor for pagination.
1177
- * @param category - An optional category to filter brands by.
1178
1165
  */
1179
- getAll(rowsPerPage: number, searchTerm?: string, lastVisible?: any, category?: string): Promise<{
1166
+ getAll(rowsPerPage: number, searchTerm?: string, lastVisible?: any): Promise<{
1180
1167
  brands: Brand[];
1181
1168
  lastVisible: _firebase_firestore.QueryDocumentSnapshot<DocumentData, DocumentData>;
1182
1169
  }>;
1183
1170
  /**
1184
- * Gets the total count of active brands, optionally filtered by name and category.
1171
+ * Gets the total count of active brands, optionally filtered by name.
1185
1172
  * @param searchTerm - An optional string to filter brand names by (starts-with search).
1186
- * @param category - An optional category to filter brands by.
1187
1173
  */
1188
- getBrandsCount(searchTerm?: string, category?: string): Promise<number>;
1174
+ getBrandsCount(searchTerm?: string): Promise<number>;
1189
1175
  /**
1190
1176
  * Gets all active brands for filter dropdowns (not paginated).
1191
1177
  */
@@ -1692,7 +1678,7 @@ declare class ProductService extends BaseService implements IProductService {
1692
1678
  /**
1693
1679
  * Creates a new product in the top-level collection
1694
1680
  */
1695
- createTopLevel(brandId: string, product: Omit<Product, 'id' | 'createdAt' | 'updatedAt' | 'brandId' | 'assignedTechnologyIds'>, technologyIds?: string[]): Promise<Product>;
1681
+ createTopLevel(product: Omit<Product, 'id' | 'createdAt' | 'updatedAt' | 'assignedTechnologyIds'>, technologyIds?: string[]): Promise<Product>;
1696
1682
  /**
1697
1683
  * Gets all products from the top-level collection
1698
1684
  */
@@ -1700,6 +1686,7 @@ declare class ProductService extends BaseService implements IProductService {
1700
1686
  rowsPerPage: number;
1701
1687
  lastVisible?: any;
1702
1688
  brandId?: string;
1689
+ category?: string;
1703
1690
  }): Promise<{
1704
1691
  products: Product[];
1705
1692
  lastVisible: any;
@@ -1711,7 +1698,7 @@ declare class ProductService extends BaseService implements IProductService {
1711
1698
  /**
1712
1699
  * Updates a product in the top-level collection
1713
1700
  */
1714
- updateTopLevel(productId: string, product: Partial<Omit<Product, 'id' | 'createdAt' | 'brandId'>>): Promise<Product | null>;
1701
+ updateTopLevel(productId: string, product: Partial<Omit<Product, 'id' | 'createdAt'>>): Promise<Product | null>;
1715
1702
  /**
1716
1703
  * Deletes a product from the top-level collection (soft delete)
1717
1704
  */
@@ -2221,15 +2208,15 @@ declare class TechnologyService extends BaseService implements ITechnologyServic
2221
2208
  description: string;
2222
2209
  family: ProcedureFamily;
2223
2210
  isActive: boolean;
2224
- technicalDetails?: string | undefined;
2225
- contraindications: ContraindicationDynamic[];
2226
2211
  categoryId: string;
2227
2212
  subcategoryId: string;
2213
+ technicalDetails?: string | undefined;
2228
2214
  requirements: {
2229
2215
  pre: Requirement[];
2230
2216
  post: Requirement[];
2231
2217
  };
2232
2218
  blockingConditions: BlockingCondition[];
2219
+ contraindications: ContraindicationDynamic[];
2233
2220
  benefits: TreatmentBenefitDynamic[];
2234
2221
  certificationRequirement: CertificationRequirement;
2235
2222
  documentationTemplates?: TechnologyDocumentationTemplate[] | undefined;
package/dist/index.js CHANGED
@@ -2295,7 +2295,8 @@ var AnalyticsService = class extends BaseService {
2295
2295
  return metrics;
2296
2296
  }
2297
2297
  }
2298
- const appointments = await this.fetchAppointments(void 0, dateRange);
2298
+ const filters = (options == null ? void 0 : options.clinicBranchId) ? { clinicBranchId: options.clinicBranchId } : void 0;
2299
+ const appointments = await this.fetchAppointments(filters, dateRange);
2299
2300
  const canceled = getCanceledAppointments(appointments);
2300
2301
  if (groupBy === "clinic") {
2301
2302
  return this.groupCancellationsByClinic(canceled, appointments);
@@ -2524,7 +2525,8 @@ var AnalyticsService = class extends BaseService {
2524
2525
  return metrics;
2525
2526
  }
2526
2527
  }
2527
- const appointments = await this.fetchAppointments(void 0, dateRange);
2528
+ const filters = (options == null ? void 0 : options.clinicBranchId) ? { clinicBranchId: options.clinicBranchId } : void 0;
2529
+ const appointments = await this.fetchAppointments(filters, dateRange);
2528
2530
  const noShow = getNoShowAppointments(appointments);
2529
2531
  if (groupBy === "clinic") {
2530
2532
  return this.groupNoShowsByClinic(noShow, appointments);
@@ -23357,13 +23359,12 @@ var BrandService = class extends BaseService {
23357
23359
  return { id: docRef.id, ...newBrand };
23358
23360
  }
23359
23361
  /**
23360
- * Gets a paginated list of active brands, optionally filtered by name and category.
23362
+ * Gets a paginated list of active brands, optionally filtered by name.
23361
23363
  * @param rowsPerPage - The number of brands to fetch.
23362
23364
  * @param searchTerm - An optional string to filter brand names by (starts-with search).
23363
23365
  * @param lastVisible - An optional document snapshot to use as a cursor for pagination.
23364
- * @param category - An optional category to filter brands by.
23365
23366
  */
23366
- async getAll(rowsPerPage, searchTerm, lastVisible, category) {
23367
+ async getAll(rowsPerPage, searchTerm, lastVisible) {
23367
23368
  const constraints = [
23368
23369
  (0, import_firestore61.where)("isActive", "==", true),
23369
23370
  (0, import_firestore61.orderBy)("name_lowercase")
@@ -23375,9 +23376,6 @@ var BrandService = class extends BaseService {
23375
23376
  (0, import_firestore61.where)("name_lowercase", "<=", lowercasedSearchTerm + "\uF8FF")
23376
23377
  );
23377
23378
  }
23378
- if (category) {
23379
- constraints.push((0, import_firestore61.where)("category", "==", category));
23380
- }
23381
23379
  if (lastVisible) {
23382
23380
  constraints.push((0, import_firestore61.startAfter)(lastVisible));
23383
23381
  }
@@ -23394,11 +23392,10 @@ var BrandService = class extends BaseService {
23394
23392
  return { brands, lastVisible: newLastVisible };
23395
23393
  }
23396
23394
  /**
23397
- * Gets the total count of active brands, optionally filtered by name and category.
23395
+ * Gets the total count of active brands, optionally filtered by name.
23398
23396
  * @param searchTerm - An optional string to filter brand names by (starts-with search).
23399
- * @param category - An optional category to filter brands by.
23400
23397
  */
23401
- async getBrandsCount(searchTerm, category) {
23398
+ async getBrandsCount(searchTerm) {
23402
23399
  const constraints = [(0, import_firestore61.where)("isActive", "==", true)];
23403
23400
  if (searchTerm) {
23404
23401
  const lowercasedSearchTerm = searchTerm.toLowerCase();
@@ -23407,9 +23404,6 @@ var BrandService = class extends BaseService {
23407
23404
  (0, import_firestore61.where)("name_lowercase", "<=", lowercasedSearchTerm + "\uF8FF")
23408
23405
  );
23409
23406
  }
23410
- if (category) {
23411
- constraints.push((0, import_firestore61.where)("category", "==", category));
23412
- }
23413
23407
  const q = (0, import_firestore61.query)(this.getBrandsRef(), ...constraints);
23414
23408
  const snapshot = await (0, import_firestore61.getCountFromServer)(q);
23415
23409
  return snapshot.data().count;
@@ -23479,7 +23473,6 @@ var BrandService = class extends BaseService {
23479
23473
  "id",
23480
23474
  "name",
23481
23475
  "manufacturer",
23482
- "category",
23483
23476
  "website",
23484
23477
  "description",
23485
23478
  "isActive"
@@ -23510,15 +23503,14 @@ var BrandService = class extends BaseService {
23510
23503
  return includeBom ? "\uFEFF" + csvBody : csvBody;
23511
23504
  }
23512
23505
  brandToCsvRow(brand) {
23513
- var _a, _b, _c, _d, _e, _f, _g;
23506
+ var _a, _b, _c, _d, _e, _f;
23514
23507
  const values = [
23515
23508
  (_a = brand.id) != null ? _a : "",
23516
23509
  (_b = brand.name) != null ? _b : "",
23517
23510
  (_c = brand.manufacturer) != null ? _c : "",
23518
- (_d = brand.category) != null ? _d : "",
23519
- (_e = brand.website) != null ? _e : "",
23520
- (_f = brand.description) != null ? _f : "",
23521
- String((_g = brand.isActive) != null ? _g : "")
23511
+ (_d = brand.website) != null ? _d : "",
23512
+ (_e = brand.description) != null ? _e : "",
23513
+ String((_f = brand.isActive) != null ? _f : "")
23522
23514
  ];
23523
23515
  return values.map((v) => this.formatCsvValue(v)).join(",");
23524
23516
  }
@@ -24944,7 +24936,8 @@ var TechnologyService = class extends BaseService {
24944
24936
  const products = await this.getAssignedProducts(technologyId);
24945
24937
  const byBrand = {};
24946
24938
  products.forEach((product) => {
24947
- byBrand[product.brandName] = (byBrand[product.brandName] || 0) + 1;
24939
+ const brandName = product.brandName || "Unknown";
24940
+ byBrand[brandName] = (byBrand[brandName] || 0) + 1;
24948
24941
  });
24949
24942
  return {
24950
24943
  totalAssigned: products.length,
@@ -25275,11 +25268,10 @@ var ProductService = class extends BaseService {
25275
25268
  /**
25276
25269
  * Creates a new product in the top-level collection
25277
25270
  */
25278
- async createTopLevel(brandId, product, technologyIds = []) {
25271
+ async createTopLevel(product, technologyIds = []) {
25279
25272
  const now = /* @__PURE__ */ new Date();
25280
25273
  const newProduct = {
25281
25274
  ...product,
25282
- brandId,
25283
25275
  assignedTechnologyIds: technologyIds,
25284
25276
  createdAt: now,
25285
25277
  updatedAt: now,
@@ -25292,11 +25284,14 @@ var ProductService = class extends BaseService {
25292
25284
  * Gets all products from the top-level collection
25293
25285
  */
25294
25286
  async getAllTopLevel(options) {
25295
- const { rowsPerPage, lastVisible, brandId } = options;
25287
+ const { rowsPerPage, lastVisible, brandId, category } = options;
25296
25288
  const constraints = [(0, import_firestore65.where)("isActive", "==", true), (0, import_firestore65.orderBy)("name")];
25297
25289
  if (brandId) {
25298
25290
  constraints.push((0, import_firestore65.where)("brandId", "==", brandId));
25299
25291
  }
25292
+ if (category) {
25293
+ constraints.push((0, import_firestore65.where)("category", "==", category));
25294
+ }
25300
25295
  if (lastVisible) {
25301
25296
  constraints.push((0, import_firestore65.startAfter)(lastVisible));
25302
25297
  }
@@ -25437,14 +25432,10 @@ var ProductService = class extends BaseService {
25437
25432
  "name",
25438
25433
  "brandId",
25439
25434
  "brandName",
25435
+ "category",
25440
25436
  "assignedTechnologyIds",
25441
25437
  "description",
25442
- "technicalDetails",
25443
- "dosage",
25444
- "composition",
25445
- "indications",
25446
- "contraindications",
25447
- "warnings",
25438
+ "metadata",
25448
25439
  "isActive"
25449
25440
  ];
25450
25441
  const rows = [];
@@ -25473,21 +25464,17 @@ var ProductService = class extends BaseService {
25473
25464
  return includeBom ? "\uFEFF" + csvBody : csvBody;
25474
25465
  }
25475
25466
  productToCsvRow(product) {
25476
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
25467
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
25477
25468
  const values = [
25478
25469
  (_a = product.id) != null ? _a : "",
25479
25470
  (_b = product.name) != null ? _b : "",
25480
25471
  (_c = product.brandId) != null ? _c : "",
25481
25472
  (_d = product.brandName) != null ? _d : "",
25482
- (_f = (_e = product.assignedTechnologyIds) == null ? void 0 : _e.join(";")) != null ? _f : "",
25483
- (_g = product.description) != null ? _g : "",
25484
- (_h = product.technicalDetails) != null ? _h : "",
25485
- (_i = product.dosage) != null ? _i : "",
25486
- (_j = product.composition) != null ? _j : "",
25487
- (_l = (_k = product.indications) == null ? void 0 : _k.join(";")) != null ? _l : "",
25488
- (_n = (_m = product.contraindications) == null ? void 0 : _m.map((c) => c.name).join(";")) != null ? _n : "",
25489
- (_p = (_o = product.warnings) == null ? void 0 : _o.join(";")) != null ? _p : "",
25490
- String((_q = product.isActive) != null ? _q : "")
25473
+ (_e = product.category) != null ? _e : "",
25474
+ (_g = (_f = product.assignedTechnologyIds) == null ? void 0 : _f.join(";")) != null ? _g : "",
25475
+ (_h = product.description) != null ? _h : "",
25476
+ product.metadata ? JSON.stringify(product.metadata) : "",
25477
+ String((_i = product.isActive) != null ? _i : "")
25491
25478
  ];
25492
25479
  return values.map((v) => this.formatCsvValue(v)).join(",");
25493
25480
  }