@infrab4a/connect 4.0.0-beta.14 → 4.0.0-beta.17

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.
Files changed (106) hide show
  1. package/domain/catalog/models/category-filter.d.ts +11 -0
  2. package/domain/catalog/models/category.d.ts +3 -2
  3. package/domain/catalog/models/filter-option.d.ts +10 -0
  4. package/domain/catalog/models/filter.d.ts +13 -0
  5. package/domain/catalog/models/index.d.ts +3 -0
  6. package/domain/catalog/models/product.d.ts +1 -0
  7. package/domain/catalog/models/types/index.d.ts +0 -1
  8. package/domain/catalog/repositories/category-filter.repository.d.ts +5 -0
  9. package/domain/catalog/repositories/category.repository.d.ts +3 -3
  10. package/domain/catalog/repositories/filter-option.repository.d.ts +4 -0
  11. package/domain/catalog/repositories/filter.repository.d.ts +4 -0
  12. package/domain/catalog/repositories/index.d.ts +3 -0
  13. package/domain/catalog/repositories/product.repository.d.ts +1 -0
  14. package/domain/generic/repository/find.repository.d.ts +3 -0
  15. package/domain/shop-settings/models/index.d.ts +1 -0
  16. package/domain/shop-settings/models/shop-settings.d.ts +9 -0
  17. package/domain/shop-settings/models/types/index.d.ts +6 -1
  18. package/domain/shop-settings/models/types/shop-banner.type.d.ts +12 -0
  19. package/domain/shop-settings/models/types/shop-brands.type.d.ts +10 -0
  20. package/domain/shop-settings/models/types/shop-carousel.type.d.ts +5 -0
  21. package/domain/shop-settings/models/types/shop-collection.type.d.ts +9 -0
  22. package/domain/shop-settings/models/types/shop-section.type.d.ts +9 -0
  23. package/domain/shop-settings/repositories/index.d.ts +1 -0
  24. package/domain/shop-settings/repositories/shop-settings.repository.d.ts +4 -0
  25. package/domain/shopping/models/buy-2-win.d.ts +3 -1
  26. package/domain/shopping/models/campaign-dashboard.d.ts +15 -0
  27. package/domain/shopping/models/campaign-hashtag.d.ts +18 -0
  28. package/domain/shopping/models/index.d.ts +5 -4
  29. package/domain/shopping/repositories/campaign-dashboard.repository.d.ts +4 -0
  30. package/domain/shopping/repositories/campaign-hashtag.repository.d.ts +4 -0
  31. package/domain/shopping/repositories/index.d.ts +4 -2
  32. package/esm2020/domain/catalog/models/category-filter.mjs +14 -0
  33. package/esm2020/domain/catalog/models/category.mjs +8 -1
  34. package/esm2020/domain/catalog/models/filter-option.mjs +10 -0
  35. package/esm2020/domain/catalog/models/filter.mjs +10 -0
  36. package/esm2020/domain/catalog/models/index.mjs +4 -1
  37. package/esm2020/domain/catalog/models/product.mjs +1 -1
  38. package/esm2020/domain/catalog/models/types/index.mjs +1 -2
  39. package/esm2020/domain/catalog/repositories/category-filter.repository.mjs +2 -0
  40. package/esm2020/domain/catalog/repositories/category.repository.mjs +1 -1
  41. package/esm2020/domain/catalog/repositories/filter-option.repository.mjs +2 -0
  42. package/esm2020/domain/catalog/repositories/filter.repository.mjs +2 -0
  43. package/esm2020/domain/catalog/repositories/index.mjs +4 -1
  44. package/esm2020/domain/catalog/repositories/product.repository.mjs +1 -1
  45. package/esm2020/domain/generic/repository/find.repository.mjs +1 -1
  46. package/esm2020/domain/shop-settings/models/index.mjs +2 -1
  47. package/esm2020/domain/shop-settings/models/shop-settings.mjs +7 -0
  48. package/esm2020/domain/shop-settings/models/types/index.mjs +7 -2
  49. package/esm2020/domain/shop-settings/models/types/shop-banner.type.mjs +2 -0
  50. package/esm2020/domain/shop-settings/models/types/shop-brands.type.mjs +2 -0
  51. package/esm2020/domain/shop-settings/models/types/shop-carousel.type.mjs +2 -0
  52. package/esm2020/domain/shop-settings/models/types/shop-collection.type.mjs +2 -0
  53. package/esm2020/domain/shop-settings/models/types/shop-section.type.mjs +2 -0
  54. package/esm2020/domain/shop-settings/repositories/index.mjs +2 -1
  55. package/esm2020/domain/shop-settings/repositories/shop-settings.repository.mjs +2 -0
  56. package/esm2020/domain/shopping/models/buy-2-win.mjs +2 -2
  57. package/esm2020/domain/shopping/models/campaign-dashboard.mjs +7 -0
  58. package/esm2020/domain/shopping/models/campaign-hashtag.mjs +7 -0
  59. package/esm2020/domain/shopping/models/index.mjs +6 -5
  60. package/esm2020/domain/shopping/repositories/campaign-dashboard.repository.mjs +2 -0
  61. package/esm2020/domain/shopping/repositories/campaign-hashtag.repository.mjs +2 -0
  62. package/esm2020/domain/shopping/repositories/index.mjs +5 -3
  63. package/esm2020/infra/elasticsearch/indexes/products-index.mjs +2 -1
  64. package/esm2020/infra/firebase/firestore/mixins/with-find-firestore.mixin.mjs +3 -2
  65. package/esm2020/infra/firebase/firestore/mixins/with-firestore.mixin.mjs +3 -1
  66. package/esm2020/infra/firebase/firestore/mixins/with-get-firestore.mixin.mjs +4 -1
  67. package/esm2020/infra/firebase/firestore/repositories/catalog/category-firestore.repository.mjs +5 -3
  68. package/esm2020/infra/firebase/firestore/repositories/catalog/product-firestore.repository.mjs +4 -1
  69. package/esm2020/infra/firebase/firestore/repositories/shop-settings/index.mjs +2 -1
  70. package/esm2020/infra/firebase/firestore/repositories/shop-settings/shop-settings-firestore.repository.mjs +14 -0
  71. package/esm2020/infra/firebase/firestore/repositories/shopping/campaign-dashboard-firestore.repository.mjs +14 -0
  72. package/esm2020/infra/firebase/firestore/repositories/shopping/campaign-hashtag-firestore.repository.mjs +14 -0
  73. package/esm2020/infra/firebase/firestore/repositories/shopping/index.mjs +6 -4
  74. package/esm2020/infra/hasura-graphql/mixins/helpers/attribute-option.helper.mjs +2 -2
  75. package/esm2020/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.mjs +16 -12
  76. package/esm2020/infra/hasura-graphql/mixins/with-hasura-graphql.mixin.mjs +12 -7
  77. package/esm2020/infra/hasura-graphql/repositories/catalog/category-filter-hasura-graphql.repository.mjs +55 -0
  78. package/esm2020/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.mjs +94 -12
  79. package/esm2020/infra/hasura-graphql/repositories/catalog/filter-hasura-graphql.repository.mjs +104 -0
  80. package/esm2020/infra/hasura-graphql/repositories/catalog/filter-option-hasura-graphql.repository.mjs +21 -0
  81. package/esm2020/infra/hasura-graphql/repositories/catalog/index.mjs +4 -1
  82. package/esm2020/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.mjs +21 -4
  83. package/esm2020/infra/hasura-graphql/repositories/catalog/variant-hasura-graphql.repository.mjs +2 -2
  84. package/esm2020/infra/hasura-graphql/types/hasura-graphql-fields.type.mjs +1 -1
  85. package/fesm2015/infrab4a-connect.mjs +481 -89
  86. package/fesm2015/infrab4a-connect.mjs.map +1 -1
  87. package/fesm2020/infrab4a-connect.mjs +460 -86
  88. package/fesm2020/infrab4a-connect.mjs.map +1 -1
  89. package/infra/firebase/firestore/repositories/catalog/category-firestore.repository.d.ts +2 -1
  90. package/infra/firebase/firestore/repositories/catalog/product-firestore.repository.d.ts +1 -0
  91. package/infra/firebase/firestore/repositories/shop-settings/index.d.ts +1 -0
  92. package/infra/firebase/firestore/repositories/shop-settings/shop-settings-firestore.repository.d.ts +7 -0
  93. package/infra/firebase/firestore/repositories/shopping/campaign-dashboard-firestore.repository.d.ts +8 -0
  94. package/infra/firebase/firestore/repositories/shopping/campaign-hashtag-firestore.repository.d.ts +8 -0
  95. package/infra/firebase/firestore/repositories/shopping/index.d.ts +5 -3
  96. package/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.d.ts +4 -9
  97. package/infra/hasura-graphql/repositories/catalog/category-filter-hasura-graphql.repository.d.ts +11 -0
  98. package/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.d.ts +6 -2
  99. package/infra/hasura-graphql/repositories/catalog/filter-hasura-graphql.repository.d.ts +18 -0
  100. package/infra/hasura-graphql/repositories/catalog/filter-option-hasura-graphql.repository.d.ts +10 -0
  101. package/infra/hasura-graphql/repositories/catalog/index.d.ts +3 -0
  102. package/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.d.ts +1 -0
  103. package/infra/hasura-graphql/types/hasura-graphql-fields.type.d.ts +1 -1
  104. package/package.json +1 -1
  105. package/domain/catalog/models/types/category-filter.type.d.ts +0 -4
  106. package/esm2020/domain/catalog/models/types/category-filter.type.mjs +0 -2
@@ -759,6 +759,15 @@ class RecoveryPassword {
759
759
  }
760
760
  }
761
761
 
762
+ class Filter extends BaseModel {
763
+ identifierFields() {
764
+ return ['id'];
765
+ }
766
+ static get identifiersFields() {
767
+ return ['id'];
768
+ }
769
+ }
770
+
762
771
  class Category extends BaseModel {
763
772
  identifierFields() {
764
773
  return ['id'];
@@ -767,6 +776,20 @@ class Category extends BaseModel {
767
776
  return ['id'];
768
777
  }
769
778
  }
779
+ __decorate([
780
+ Type(() => Filter),
781
+ __metadata("design:type", Array)
782
+ ], Category.prototype, "filters", void 0);
783
+
784
+ class CategoryFilter extends BaseModel {
785
+ static get identifiersFields() {
786
+ return ['id'];
787
+ }
788
+ }
789
+ __decorate([
790
+ Type(() => Filter),
791
+ __metadata("design:type", Filter)
792
+ ], CategoryFilter.prototype, "filter", void 0);
770
793
 
771
794
  var GenderDestination;
772
795
  (function (GenderDestination) {
@@ -783,6 +806,15 @@ var Shops;
783
806
  Shops["ALL"] = "ALL";
784
807
  })(Shops || (Shops = {}));
785
808
 
809
+ class FilterOption extends BaseModel {
810
+ identifierFields() {
811
+ return ['id'];
812
+ }
813
+ static get identifiersFields() {
814
+ return ['id'];
815
+ }
816
+ }
817
+
786
818
  class Product extends BaseModel {
787
819
  identifierFields() {
788
820
  return ['id'];
@@ -819,17 +851,27 @@ class Variant extends BaseModel {
819
851
  }
820
852
  }
821
853
 
822
- var OrderStatus;
823
- (function (OrderStatus) {
824
- OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
825
- OrderStatus["EM_PREPARO"] = "Preparando pedido";
826
- OrderStatus["NF_EMITIDA"] = "Nota Fiscal Emitida";
827
- OrderStatus["AGUARDANDO_ENVIO"] = "Aguardando Transaportadora";
828
- OrderStatus["ENVIADO"] = "Enviado";
829
- OrderStatus["ENTREGUE"] = "Entregue";
830
- OrderStatus["CANCELADO"] = "Cancelado";
831
- OrderStatus["CREDIT_CARD"] = "credit_card";
832
- })(OrderStatus || (OrderStatus = {}));
854
+ class Buy2Win extends BaseModel {
855
+ static get identifiersFields() {
856
+ return ['id'];
857
+ }
858
+ }
859
+ __decorate([
860
+ Type(() => Category),
861
+ __metadata("design:type", Array)
862
+ ], Buy2Win.prototype, "categories", void 0);
863
+
864
+ class CampaignDashboard extends BaseModel {
865
+ static get identifiersFields() {
866
+ return ['id'];
867
+ }
868
+ }
869
+
870
+ class CampaignHashtag extends BaseModel {
871
+ static get identifiersFields() {
872
+ return ['id'];
873
+ }
874
+ }
833
875
 
834
876
  class LineItem extends Product {
835
877
  }
@@ -870,6 +912,18 @@ __decorate([
870
912
  __metadata("design:type", Coupon)
871
913
  ], Checkout.prototype, "coupon", void 0);
872
914
 
915
+ var OrderStatus;
916
+ (function (OrderStatus) {
917
+ OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
918
+ OrderStatus["EM_PREPARO"] = "Preparando pedido";
919
+ OrderStatus["NF_EMITIDA"] = "Nota Fiscal Emitida";
920
+ OrderStatus["AGUARDANDO_ENVIO"] = "Aguardando Transaportadora";
921
+ OrderStatus["ENVIADO"] = "Enviado";
922
+ OrderStatus["ENTREGUE"] = "Entregue";
923
+ OrderStatus["CANCELADO"] = "Cancelado";
924
+ OrderStatus["CREDIT_CARD"] = "credit_card";
925
+ })(OrderStatus || (OrderStatus = {}));
926
+
873
927
  class Order extends Checkout {
874
928
  }
875
929
  __decorate([
@@ -899,16 +953,6 @@ __decorate([
899
953
  __metadata("design:type", Coupon)
900
954
  ], CheckoutSubscription.prototype, "coupon", void 0);
901
955
 
902
- class Buy2Win extends BaseModel {
903
- static get identifiersFields() {
904
- return ['id'];
905
- }
906
- }
907
- __decorate([
908
- Type(() => Category),
909
- __metadata("design:type", Array)
910
- ], Buy2Win.prototype, "categories", void 0);
911
-
912
956
  var FilterType;
913
957
  (function (FilterType) {
914
958
  FilterType["ACCESSORY_IMPORTANCE"] = "accessoryImportance";
@@ -1008,6 +1052,12 @@ class ShopMenu extends BaseModel {
1008
1052
  }
1009
1053
  }
1010
1054
 
1055
+ class ShopSettings extends BaseModel {
1056
+ static get identifiersFields() {
1057
+ return ['id'];
1058
+ }
1059
+ }
1060
+
1011
1061
  class InvalidArgumentError extends CustomError {
1012
1062
  constructor(message) {
1013
1063
  super(message);
@@ -1107,6 +1157,7 @@ class ProductsIndex {
1107
1157
  'stock',
1108
1158
  'weight',
1109
1159
  'tags',
1160
+ 'filters',
1110
1161
  'hasVariants',
1111
1162
  'type',
1112
1163
  ];
@@ -1202,6 +1253,8 @@ const withFirestore = (MixinBase) => {
1202
1253
  constructor(...params) {
1203
1254
  const options = params[0];
1204
1255
  super(...params);
1256
+ this.fields = {};
1257
+ this.interceptors = {};
1205
1258
  this.collectionName = '';
1206
1259
  this.firestore = options.firestore;
1207
1260
  this.collectionName = options.collectionName;
@@ -1254,6 +1307,9 @@ const withHelpers = (MixinBase) => {
1254
1307
  const withGetFirestore = (MixinBase) => {
1255
1308
  return class GetFirestore extends MixinBase {
1256
1309
  async get(identifiers) {
1310
+ console.log(this.buildCollectionPathForGet(identifiers));
1311
+ console.log(this.firestore);
1312
+ console.log(this.collection(this.buildCollectionPathForGet(identifiers)));
1257
1313
  const instance = this.model.toInstance(this.model.identifiersFields.reduce((acc, field) => ({ ...acc, [field]: identifiers[field] }), {}));
1258
1314
  const intercepted = await this.interceptors?.request?.({ instance });
1259
1315
  const builded = intercepted?.instance || instance;
@@ -1344,6 +1400,7 @@ const withFindFirestore = (MixinBase) => {
1344
1400
  }
1345
1401
  async find(find = {}) {
1346
1402
  const collection = this.collection(this.buildCollectionPathForFind(find.filters));
1403
+ const enableCount = find?.options?.enableCount ?? true;
1347
1404
  const intercepted = await this.interceptors?.request?.({ find });
1348
1405
  const { filters, limits, orderBy } = intercepted.find || find;
1349
1406
  const queries = this.makeFirestoreWhere(filters || {});
@@ -1354,7 +1411,7 @@ const withFindFirestore = (MixinBase) => {
1354
1411
  const data = docs.docs.map((doc) => doc.data());
1355
1412
  return {
1356
1413
  data: (await this.interceptors?.response?.(data, intercepted)) || data,
1357
- count: this.calculateCount(data, limits),
1414
+ count: enableCount ? this.calculateCount(data, limits) : Infinity,
1358
1415
  };
1359
1416
  }
1360
1417
  buildCollectionPathForFind(filters) {
@@ -1648,14 +1705,14 @@ class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFire
1648
1705
  throw new NotFoundError(`Document with slug ${slug} not found`);
1649
1706
  return categoryDocs.docs[0].data();
1650
1707
  }
1651
- async getCategoriesForHome(categoryIds, limit = 4) {
1708
+ async getCategoriesForHome(categoryIds, limit = 4, gender) {
1652
1709
  const categorySnap = await getDocs(query(this.collection(this.collectionName), where('id', 'in', categoryIds.filter(Boolean)), where('published', '==', true)));
1653
1710
  if (categorySnap.empty)
1654
1711
  throw new NotFoundError('Categories not found');
1655
1712
  const categories = categorySnap.docs.map((doc) => doc.data());
1656
1713
  const homeSections = await Promise.all(categories.map(async (category) => ({
1657
1714
  category,
1658
- products: await this.mountCategory(category, { limit, hasStock: true }),
1715
+ products: await this.mountCategory(category, { limit, hasStock: true, gender }),
1659
1716
  })));
1660
1717
  return homeSections;
1661
1718
  }
@@ -1671,6 +1728,8 @@ class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFire
1671
1728
  wheres.push(where('published', '==', true), where('id', 'in', productIds));
1672
1729
  if (options?.hasStock)
1673
1730
  wheres.push(where('stock.quantity', '>', 0));
1731
+ if (options?.gender)
1732
+ wheres.push(where('tags', 'array-contains', options?.gender));
1674
1733
  if (options?.limit)
1675
1734
  wheres.push(limit(options?.limit));
1676
1735
  const productSnap = await getDocs(query(this.collection('productsErpVitrine'), ...wheres));
@@ -1725,6 +1784,9 @@ class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFires
1725
1784
  });
1726
1785
  return this.reviews[status];
1727
1786
  }
1787
+ cleanShoppingCountFromIds() {
1788
+ return;
1789
+ }
1728
1790
  }
1729
1791
 
1730
1792
  class ProductVariantFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Product) {
@@ -1751,6 +1813,39 @@ class SubscriptionProductFirestoreRepository extends withCrudFirestore(withHelpe
1751
1813
  }
1752
1814
  }
1753
1815
 
1816
+ class Buy2WinFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1817
+ constructor({ firestore, interceptors }) {
1818
+ super({
1819
+ firestore,
1820
+ collectionName: 'buy2win',
1821
+ model: Buy2Win,
1822
+ interceptors,
1823
+ });
1824
+ }
1825
+ }
1826
+
1827
+ class CampaignDashboardFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1828
+ constructor({ firestore, interceptors, }) {
1829
+ super({
1830
+ firestore,
1831
+ collectionName: 'dashboardCampaignsAuto',
1832
+ model: CampaignDashboard,
1833
+ interceptors,
1834
+ });
1835
+ }
1836
+ }
1837
+
1838
+ class CampaignHashtagFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1839
+ constructor({ firestore, interceptors, }) {
1840
+ super({
1841
+ firestore,
1842
+ collectionName: 'hashtagCampaignsAuto',
1843
+ model: CampaignHashtag,
1844
+ interceptors,
1845
+ });
1846
+ }
1847
+ }
1848
+
1754
1849
  class CheckoutFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1755
1850
  constructor({ firestore, interceptors }) {
1756
1851
  super({
@@ -1762,6 +1857,17 @@ class CheckoutFirestoreRepository extends withCrudFirestore(withHelpers(withFire
1762
1857
  }
1763
1858
  }
1764
1859
 
1860
+ class CheckoutSubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1861
+ constructor({ firestore, interceptors, }) {
1862
+ super({
1863
+ firestore,
1864
+ collectionName: 'checkoutsSubscription',
1865
+ model: CheckoutSubscription,
1866
+ interceptors,
1867
+ });
1868
+ }
1869
+ }
1870
+
1765
1871
  class CouponFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1766
1872
  constructor({ firestore, interceptors }) {
1767
1873
  super({
@@ -1826,23 +1932,22 @@ class OrderFirestoreRepository extends withCrudFirestore(withHelpers(withFiresto
1826
1932
  }
1827
1933
  }
1828
1934
 
1829
- class PaymentFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1935
+ class LegacyOrderFirestoreRepository extends OrderFirestoreRepository {
1830
1936
  constructor({ firestore, interceptors }) {
1831
1937
  super({
1832
1938
  firestore,
1833
- collectionName: 'payments',
1834
- model: Payment,
1835
1939
  interceptors,
1836
1940
  });
1941
+ this.collectionName = 'legacyOrders';
1837
1942
  }
1838
1943
  }
1839
1944
 
1840
- class CheckoutSubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1841
- constructor({ firestore, interceptors, }) {
1945
+ class PaymentFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1946
+ constructor({ firestore, interceptors }) {
1842
1947
  super({
1843
1948
  firestore,
1844
- collectionName: 'checkoutsSubscription',
1845
- model: CheckoutSubscription,
1949
+ collectionName: 'payments',
1950
+ model: Payment,
1846
1951
  interceptors,
1847
1952
  });
1848
1953
  }
@@ -1859,27 +1964,6 @@ class SubscriptionPlanFirestoreRepository extends withCrudFirestore(withHelpers(
1859
1964
  }
1860
1965
  }
1861
1966
 
1862
- class Buy2WinFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1863
- constructor({ firestore, interceptors }) {
1864
- super({
1865
- firestore,
1866
- collectionName: 'buy2win',
1867
- model: Buy2Win,
1868
- interceptors,
1869
- });
1870
- }
1871
- }
1872
-
1873
- class LegacyOrderFirestoreRepository extends OrderFirestoreRepository {
1874
- constructor({ firestore, interceptors }) {
1875
- super({
1876
- firestore,
1877
- interceptors,
1878
- });
1879
- this.collectionName = 'legacyOrders';
1880
- }
1881
- }
1882
-
1883
1967
  class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1884
1968
  constructor({ firestore, interceptors }) {
1885
1969
  super({
@@ -1943,6 +2027,17 @@ class ShopMenuFirestoreRepository extends withCrudFirestore(withHelpers(withFire
1943
2027
  }
1944
2028
  }
1945
2029
 
2030
+ class ShopSettingsFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2031
+ constructor({ firestore, interceptors, }) {
2032
+ super({
2033
+ firestore,
2034
+ collectionName: 'shopSettings',
2035
+ model: ShopSettings,
2036
+ interceptors,
2037
+ });
2038
+ }
2039
+ }
2040
+
1946
2041
  class AuthenticationFirebaseAuthService {
1947
2042
  constructor(firebaseAuth) {
1948
2043
  this.firebaseAuth = firebaseAuth;
@@ -2016,7 +2111,7 @@ class AttributeOptionHelper {
2016
2111
  }
2017
2112
  AttributeOptionHelper.FindByAttribute = (attributeName, fields) => {
2018
2113
  if (fields.includes(attributeName))
2019
- return { columnName: attributeName.toString(), attributeName };
2114
+ return { columnName: attributeName.toString(), attributeName, to: (value) => value, from: (value) => value };
2020
2115
  const field = fields.find((columnOption) => isObject(columnOption) && Object.keys(columnOption).includes(attributeName.toString()));
2021
2116
  const fieldOption = is(field)?.[attributeName];
2022
2117
  if (isNil(fieldOption))
@@ -2351,11 +2446,14 @@ const withHasuraGraphQL = (MixinBase) => {
2351
2446
  get headers() {
2352
2447
  return {
2353
2448
  'Content-Type': 'application/json',
2354
- ...(isNil(this.authOptions.authToken) ? {} : { Authorization: this.authOptions.authToken }),
2355
- ...(isNil(this.authOptions.adminSecret) ? {} : { 'X-Hasura-Admin-Secret': this.authOptions.adminSecret }),
2356
- ...(isNil(this.authOptions.authRole)
2449
+ ...(isNil(this.authOptions?.authToken) ? {} : { Authorization: this.authOptions?.authToken }),
2450
+ ...(isNil(this.authOptions?.adminSecret) ? {} : { 'X-Hasura-Admin-Secret': this.authOptions?.adminSecret }),
2451
+ ...(isNil(this.authOptions?.authRole)
2357
2452
  ? {}
2358
- : { 'X-Hasura-Role': this.authOptions.authRole.role, 'X-Hasura-User-Id': this.authOptions.authRole.userId }),
2453
+ : {
2454
+ 'X-Hasura-Role': this.authOptions.authRole.role,
2455
+ 'X-Hasura-User-Id': this.authOptions?.authRole?.userId,
2456
+ }),
2359
2457
  };
2360
2458
  }
2361
2459
  async mutation(operation, fields, variables) {
@@ -2375,10 +2473,12 @@ const withHasuraGraphQL = (MixinBase) => {
2375
2473
  }
2376
2474
  async fetch(params) {
2377
2475
  const headers = this.headers;
2378
- const response = await axios.post(`${this.endpoint}`, params, {
2476
+ const { data: result } = await axios({
2477
+ url: `${this.endpoint}`,
2478
+ method: 'POST',
2479
+ data: params,
2379
2480
  headers,
2380
2481
  });
2381
- const result = await response.data;
2382
2482
  if (!isNil(result.errors))
2383
2483
  throw new Error(JSON.stringify(result.errors));
2384
2484
  return result.data;
@@ -2520,8 +2620,9 @@ const withGetHasuraGraphQL = (MixinBase) => {
2520
2620
 
2521
2621
  const withFindHasuraGraphQL = (MixinBase) => {
2522
2622
  return class FindHasuraGraphQLMixin extends MixinBase {
2523
- async find(options) {
2524
- const { filters, limits, orderBy } = options || {};
2623
+ async find(params) {
2624
+ const { filters, limits, orderBy, options } = params || {};
2625
+ const enableCount = options?.enableCount ?? true;
2525
2626
  const variablesCount = {
2526
2627
  ...(isNil(orderBy) ? {} : { order_by: { type: `${this.tableName}_order_by!`, list: true, value: orderBy } }),
2527
2628
  ...(isNil(filters)
@@ -2541,23 +2642,26 @@ const withFindHasuraGraphQL = (MixinBase) => {
2541
2642
  const result = await this.query([
2542
2643
  {
2543
2644
  operation: this.tableName,
2544
- fields: options.fields
2545
- ? options.fields
2645
+ fields: params.fields
2646
+ ? params.fields
2546
2647
  .map((fieldName) => this.fields.find((fieldOption) => fieldOption === fieldName) ??
2547
2648
  this.fields.find((fieldOption) => Object.keys(fieldOption).shift() === fieldName))
2548
2649
  .filter(Boolean)
2549
2650
  : this.fields,
2550
2651
  variables,
2551
2652
  },
2552
- {
2553
- operation: `${this.tableName}_aggregate`,
2554
- fields: [{ aggregate: ['count'] }],
2555
- variables: variablesCount,
2556
- },
2653
+ ...(enableCount
2654
+ ? [
2655
+ {
2656
+ operation: `${this.tableName}_aggregate`,
2657
+ fields: [{ aggregate: ['count'] }],
2658
+ variables: variablesCount,
2659
+ },
2660
+ ]
2661
+ : []),
2557
2662
  ]);
2558
2663
  const data = result[this.tableName].map((row) => this.convertDataFromHasura(row));
2559
- const count = result[`${this.tableName}_aggregate`].aggregate.count;
2560
- return { count, data };
2664
+ return { data, count: enableCount ? result[`${this.tableName}_aggregate`].aggregate.count : Infinity };
2561
2665
  }
2562
2666
  };
2563
2667
  };
@@ -2596,8 +2700,60 @@ class VariantHasuraGraphQL extends Variant {
2596
2700
  }
2597
2701
  }
2598
2702
 
2703
+ class CategoryFilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
2704
+ constructor({ endpoint, authOptions, interceptors, }) {
2705
+ super({
2706
+ tableName: 'category_filter',
2707
+ model: CategoryFilter,
2708
+ endpoint,
2709
+ authOptions,
2710
+ fields: [
2711
+ 'id',
2712
+ { filterId: { columnName: 'filter_id' } },
2713
+ { categoryId: { columnName: 'category_id' } },
2714
+ {
2715
+ filter: {
2716
+ columnName: 'filter',
2717
+ foreignKeyColumn: { id: 'filterId' },
2718
+ fields: [
2719
+ 'id',
2720
+ 'description',
2721
+ 'slug',
2722
+ 'enabled',
2723
+ { createdAt: { columnName: 'created_at' } },
2724
+ { updatedAt: { columnName: 'updated_at' } },
2725
+ {
2726
+ options: {
2727
+ columnName: 'options',
2728
+ foreignKeyColumn: { filterId: 'id' },
2729
+ fields: [
2730
+ 'id',
2731
+ { filterId: { columnName: 'filter_id' } },
2732
+ 'description',
2733
+ { createdAt: { columnName: 'created_at' } },
2734
+ { updatedAt: { columnName: 'updated_at' } },
2735
+ ],
2736
+ },
2737
+ },
2738
+ ],
2739
+ },
2740
+ },
2741
+ ],
2742
+ });
2743
+ }
2744
+ deleteByCategoryAndFilter(categoryId, filterId) {
2745
+ return this.mutation('delete_category_filter', ['affected_rows'], {
2746
+ where: {
2747
+ type: 'category_filter_bool_exp',
2748
+ required: true,
2749
+ value: { category_id: { _eq: categoryId }, filter_id: { _eq: filterId } },
2750
+ },
2751
+ });
2752
+ }
2753
+ }
2754
+
2599
2755
  class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
2600
- constructor({ endpoint, authOptions, interceptors, }, productRepository) {
2756
+ constructor({ endpoint, authOptions, interceptors, }, productRepository, categoryFilterRepository) {
2601
2757
  super({
2602
2758
  tableName: 'category',
2603
2759
  model: Category,
@@ -2640,7 +2796,17 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
2640
2796
  },
2641
2797
  },
2642
2798
  },
2643
- 'filters',
2799
+ {
2800
+ filters: {
2801
+ columnName: 'filters',
2802
+ foreignKeyColumn: { filter_id: 'id' },
2803
+ fields: [{ filter: ['id', 'description', 'slug', 'enabled'] }],
2804
+ bindPersistData: (value) => ({
2805
+ filters: { data: value.map((filter) => ({ filter_id: filter.id })) },
2806
+ }),
2807
+ from: (filters) => filters?.map((filter) => filter?.filter) || [],
2808
+ },
2809
+ },
2644
2810
  { createdAt: { columnName: 'created_at' } },
2645
2811
  { updatedAt: { columnName: 'updated_at' } },
2646
2812
  {
@@ -2665,6 +2831,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
2665
2831
  ],
2666
2832
  });
2667
2833
  this.productRepository = productRepository;
2834
+ this.categoryFilterRepository = categoryFilterRepository;
2668
2835
  }
2669
2836
  async create(params) {
2670
2837
  const { metadata, ...data } = params;
@@ -2672,29 +2839,30 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
2672
2839
  }
2673
2840
  async get(identifiers) {
2674
2841
  return Number.isNaN(+identifiers.id)
2675
- ? (await this.find({ filters: { firestoreId: identifiers.id } })).data?.[0]
2842
+ ? (await this.find({ filters: { firestoreId: identifiers.id }, options: { enableCount: false } })).data?.[0]
2676
2843
  : super.get(identifiers);
2677
2844
  }
2678
2845
  async update(params) {
2679
- const { products, id: checkId, metadata, ...data } = params;
2846
+ const { products, id: checkId, metadata, filters, ...data } = params;
2680
2847
  const plainData = this.paramsToPlain({ id: checkId });
2681
2848
  const id = await this.getId(plainData.id);
2682
2849
  const category = await super.update({ id, ...data });
2683
2850
  category.products = products && (await this.updateProducts(+id, { products }));
2684
2851
  category.metadata = metadata && (await this.updateMetadata(+id, { metadata }));
2852
+ category.filters = filters && (await this.updateFilters(+id, { filters }));
2685
2853
  return category;
2686
2854
  }
2687
2855
  async getCategoryBySlug(slug, shop) {
2688
2856
  if (!slug)
2689
2857
  return null;
2690
- const { data, count } = await this.find({ filters: { slug, shop, published: true } });
2691
- if (count > 1)
2692
- throw new DuplicatedResultsError('Query returned duplicated values');
2693
- if (!count)
2858
+ const { data } = await this.find({ filters: { slug, shop, published: true }, options: { enableCount: false } });
2859
+ if (!data.length)
2694
2860
  throw new NotFoundError(`Category with slug ${slug} not found`);
2861
+ if (data.length > 1)
2862
+ throw new DuplicatedResultsError('Query returned duplicated values');
2695
2863
  return data.shift();
2696
2864
  }
2697
- async getCategoriesForHome(categoryIds, limit = 4) {
2865
+ async getCategoriesForHome(categoryIds, limit = 4, gender) {
2698
2866
  if (!categoryIds?.length)
2699
2867
  return [];
2700
2868
  const categoriesFirestore = categoryIds.filter((categoryId) => Number.isNaN(+categoryId));
@@ -2712,7 +2880,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
2712
2880
  return [];
2713
2881
  const homeSections = await Promise.all(categories.map(async (category) => ({
2714
2882
  category,
2715
- products: await this.mountCategory(category, { limit, hasStock: true }),
2883
+ products: await this.mountCategory(category, { limit, hasStock: true, gender }),
2716
2884
  })));
2717
2885
  return homeSections;
2718
2886
  }
@@ -2725,6 +2893,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
2725
2893
  id: { operator: Where.IN, value: category.products },
2726
2894
  published: true,
2727
2895
  ...(options?.hasStock ? { stock: { quantity: { operator: Where.GT, value: 0 } } } : {}),
2896
+ ...(options?.gender ? { tags: { operator: Where.IN, value: [options?.gender] } } : {}),
2728
2897
  },
2729
2898
  fields: [
2730
2899
  'id',
@@ -2750,8 +2919,10 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
2750
2919
  'tags',
2751
2920
  'type',
2752
2921
  'shoppingCount',
2922
+ 'gender',
2753
2923
  ],
2754
2924
  ...(options?.limit ? { limits: { limit: options?.limit } } : {}),
2925
+ options: { enableCount: false },
2755
2926
  });
2756
2927
  products.push(...productsData);
2757
2928
  return products;
@@ -2759,7 +2930,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
2759
2930
  async getId(id) {
2760
2931
  if (!Number.isNaN(+id))
2761
2932
  return id;
2762
- const { data } = await this.find({ filters: { firestoreId: id } });
2933
+ const { data } = await this.find({ filters: { firestoreId: id }, options: { enableCount: false } });
2763
2934
  if (data?.[0]?.id)
2764
2935
  return data?.[0]?.id;
2765
2936
  throw new NotFoundError(`Category with id ${id} not found`);
@@ -2812,6 +2983,192 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
2812
2983
  });
2813
2984
  return plainData.metadata;
2814
2985
  }
2986
+ async updateFilters(categoryId, { filters }) {
2987
+ if ('action' in filters && filters.action === 'remove' && filters.value.length) {
2988
+ for (let i = 0; i < filters.value.length; i++) {
2989
+ await this.categoryFilterRepository.deleteByCategoryAndFilter(categoryId, filters.value[i].id);
2990
+ }
2991
+ return [];
2992
+ }
2993
+ if ('action' in filters && filters.action === 'merge' && filters.value.length) {
2994
+ let filtersList = [];
2995
+ for (let i = 0; i < filters.value.length; i++) {
2996
+ try {
2997
+ const hasFilter = await this.categoryFilterRepository
2998
+ .find({
2999
+ filters: {
3000
+ categoryId,
3001
+ filterId: filters.value[i].id,
3002
+ },
3003
+ })
3004
+ .then((data) => data.data.shift()?.filter);
3005
+ if (hasFilter) {
3006
+ filtersList.push(hasFilter);
3007
+ }
3008
+ else {
3009
+ await this.categoryFilterRepository.create({
3010
+ filterId: filters.value[i].id,
3011
+ categoryId,
3012
+ });
3013
+ filtersList.push(filters.value[i]);
3014
+ }
3015
+ }
3016
+ catch (error) {
3017
+ console.log('catch error: ', error);
3018
+ }
3019
+ }
3020
+ return filtersList;
3021
+ }
3022
+ if (Array.isArray(filters) && filters.length) {
3023
+ let filtersList = [];
3024
+ for (let i = 0; i < filters.length; i++) {
3025
+ try {
3026
+ const hasFilter = await this.categoryFilterRepository
3027
+ .find({
3028
+ filters: {
3029
+ categoryId,
3030
+ filterId: filters[i].id,
3031
+ },
3032
+ })
3033
+ .then((data) => data.data.shift()?.filter);
3034
+ if (hasFilter) {
3035
+ filtersList.push(hasFilter);
3036
+ }
3037
+ else {
3038
+ await this.categoryFilterRepository.create({
3039
+ filterId: filters[i].id,
3040
+ categoryId,
3041
+ });
3042
+ filtersList.push(filters[i]);
3043
+ }
3044
+ }
3045
+ catch (error) {
3046
+ console.log('catch error: ', error);
3047
+ }
3048
+ }
3049
+ return filtersList;
3050
+ }
3051
+ return [];
3052
+ }
3053
+ }
3054
+
3055
+ class FilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
3056
+ constructor({ endpoint, authOptions, interceptors, }, filterOptionRepository, categoryFilterRepository) {
3057
+ super({
3058
+ tableName: 'filter',
3059
+ model: Filter,
3060
+ endpoint,
3061
+ authOptions,
3062
+ fields: [
3063
+ 'id',
3064
+ 'description',
3065
+ 'slug',
3066
+ 'enabled',
3067
+ { createdAt: { columnName: 'created_at' } },
3068
+ { updatedAt: { columnName: 'updated_at' } },
3069
+ {
3070
+ options: {
3071
+ columnName: 'options',
3072
+ foreignKeyColumn: { filterId: 'id' },
3073
+ fields: [
3074
+ 'id',
3075
+ { filterId: { columnName: 'filter_id' } },
3076
+ 'description',
3077
+ { createdAt: { columnName: 'created_at' } },
3078
+ { updatedAt: { columnName: 'updated_at' } },
3079
+ ],
3080
+ },
3081
+ },
3082
+ ],
3083
+ });
3084
+ this.filterOptionRepository = filterOptionRepository;
3085
+ this.categoryFilterRepository = categoryFilterRepository;
3086
+ }
3087
+ async update(params) {
3088
+ const { options, ...data } = params;
3089
+ const filter = await super.update(data);
3090
+ filter.options = await this.updateOptions(+data.id, { options });
3091
+ return filter;
3092
+ }
3093
+ async updateOptions(filterId, { options }) {
3094
+ if (!options)
3095
+ return [];
3096
+ if ('action' in options && options.action === 'remove' && options.value.length) {
3097
+ for (let i = 0; i < options.value.length; i++) {
3098
+ await this.filterOptionRepository.delete({ id: options.value[i].id });
3099
+ }
3100
+ return [];
3101
+ }
3102
+ if ('action' in options && options.action === 'merge' && options.value.length) {
3103
+ let filterOptions = [];
3104
+ for (let i = 0; i < options.value.length; i++) {
3105
+ try {
3106
+ const hasFilter = await this.filterOptionRepository.get({ id: options.value[i].id });
3107
+ if (hasFilter)
3108
+ filterOptions.push(hasFilter);
3109
+ }
3110
+ catch (error) {
3111
+ const newOption = await this.filterOptionRepository.create({ ...options.value[i], filterId });
3112
+ filterOptions.push(newOption);
3113
+ }
3114
+ }
3115
+ return filterOptions;
3116
+ }
3117
+ if (Array.isArray(options) && options.length) {
3118
+ let filterOptions = [];
3119
+ for (let i = 0; i < options.length; i++) {
3120
+ try {
3121
+ const hasFilter = await this.filterOptionRepository.get({ id: options[i].id });
3122
+ if (hasFilter)
3123
+ filterOptions.push(hasFilter);
3124
+ }
3125
+ catch (error) {
3126
+ const newOption = await this.filterOptionRepository.create({ ...options[i], filterId });
3127
+ filterOptions.push(newOption);
3128
+ }
3129
+ }
3130
+ }
3131
+ return [];
3132
+ }
3133
+ async delete(params) {
3134
+ const { data: categoryFilters } = await this.categoryFilterRepository.find({
3135
+ filters: {
3136
+ filterId: params.id,
3137
+ },
3138
+ });
3139
+ if (categoryFilters.length)
3140
+ throw new Error('Erro: o filtro está associado a uma ou mais categoria(s)');
3141
+ await this.deleteOptions(+params.id);
3142
+ await super.delete({ id: +params.id });
3143
+ return;
3144
+ }
3145
+ async deleteOptions(filterId) {
3146
+ await this.mutation('delete_filter_option', ['affected_rows'], {
3147
+ where: {
3148
+ type: 'filter_option_bool_exp',
3149
+ required: true,
3150
+ value: { filter_id: { _eq: filterId } },
3151
+ },
3152
+ });
3153
+ }
3154
+ }
3155
+
3156
+ class FilterOptionHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
3157
+ constructor({ endpoint, authOptions, interceptors, }) {
3158
+ super({
3159
+ tableName: 'filter_option',
3160
+ model: FilterOption,
3161
+ endpoint,
3162
+ authOptions,
3163
+ fields: [
3164
+ 'id',
3165
+ 'description',
3166
+ { filterId: { columnName: 'filter_id' } },
3167
+ { createdAt: { columnName: 'created_at' } },
3168
+ { updatedAt: { columnName: 'updated_at' } },
3169
+ ],
3170
+ });
3171
+ }
2815
3172
  }
2816
3173
 
2817
3174
  class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
@@ -2950,6 +3307,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
2950
3307
  'weight',
2951
3308
  'gender',
2952
3309
  { tags: { columnName: 'tags', type: HasuraGraphQLColumnType.Jsonb } },
3310
+ { filters: { columnName: 'filters', type: HasuraGraphQLColumnType.Jsonb } },
2953
3311
  { isKit: { columnName: 'is_kit' } },
2954
3312
  { createdAt: { columnName: 'created_at' } },
2955
3313
  { updatedAt: { columnName: 'updated_at' } },
@@ -3041,7 +3399,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
3041
3399
  }
3042
3400
  async get(identifiers) {
3043
3401
  const product = Number.isNaN(+identifiers.id)
3044
- ? (await this.find({ filters: { firestoreId: identifiers.id } })).data?.[0]
3402
+ ? (await this.find({ filters: { firestoreId: identifiers.id }, options: { enableCount: false } })).data?.[0]
3045
3403
  : await super.get(identifiers);
3046
3404
  if (product.productId)
3047
3405
  throw new NotFoundError('Product not found, it is a variant');
@@ -3065,9 +3423,12 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
3065
3423
  filters: {
3066
3424
  slug,
3067
3425
  },
3426
+ fields: this.fields.map((field) => typeof field === 'string' ? field : Object.keys(field).shift()),
3427
+ options: {
3428
+ enableCount: false,
3429
+ },
3068
3430
  });
3069
3431
  const product = result?.data?.shift();
3070
- product.reviews = await this.findReviewsByProduct(+product.id);
3071
3432
  return product;
3072
3433
  }
3073
3434
  async update(params) {
@@ -3217,7 +3578,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
3217
3578
  async getId(id) {
3218
3579
  if (!Number.isNaN(+id))
3219
3580
  return id;
3220
- const { data } = await this.find({ filters: { firestoreId: id } });
3581
+ const { data } = await this.find({ filters: { firestoreId: id }, options: { enableCount: false } });
3221
3582
  if (data?.[0]?.id)
3222
3583
  return data?.[0]?.id;
3223
3584
  throw new NotFoundError(`Product with id ${id} not found`);
@@ -3273,6 +3634,19 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
3273
3634
  });
3274
3635
  return data && data[0] && this.bindReviewToModel(data[0]);
3275
3636
  }
3637
+ async cleanShoppingCountFromIds(ids) {
3638
+ return await this.mutation('update_product', ['affected_rows'], {
3639
+ where: {
3640
+ value: { id: { _nin: ids } },
3641
+ type: 'product_bool_exp',
3642
+ required: true,
3643
+ },
3644
+ _set: {
3645
+ value: { shopping_count: 0 },
3646
+ type: 'product_set_input',
3647
+ },
3648
+ });
3649
+ }
3276
3650
  }
3277
3651
 
3278
3652
  class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
@@ -3375,7 +3749,7 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
3375
3749
  async getId(id) {
3376
3750
  if (!Number.isNaN(+id))
3377
3751
  return id;
3378
- const { data } = await this.find({ filters: { firestoreId: id } });
3752
+ const { data } = await this.find({ filters: { firestoreId: id }, options: { enableCount: false } });
3379
3753
  if (data?.[0]?.id)
3380
3754
  return data?.[0]?.id;
3381
3755
  throw new NotFoundError(`Product with id ${id} not found`);
@@ -3386,5 +3760,5 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
3386
3760
  * Generated bundle index. Do not edit.
3387
3761
  */
3388
3762
 
3389
- export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository, Category, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, Coupon, CouponFirestoreRepository, CouponSubtypes, CouponTypes, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, FilterType, FragranceImportances, GenderDestination, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, NotFoundError, OfficePosition, Order, OrderFirestoreRepository, OrderStatus, Payment, PaymentFirestoreRepository, PaymentType, Product, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductSpents, ProductVariantFirestoreRepository, ProductsIndex, QuestionsFilters, RecoveryPassword, Register, RegisterFirebaseAuthService, RequiredArgumentError, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, Shops, SignInMethods, SignOut, Status, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, UnauthorizedError, UpdateOptionActions, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, WeakPasswordError, Where, get, is, isUUID, parseDateTime, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
3763
+ export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository, CampaignDashboard, CampaignDashboardFirestoreRepository, CampaignHashtag, CampaignHashtagFirestoreRepository, Category, CategoryFilter, CategoryFilterHasuraGraphQLRepository, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, Coupon, CouponFirestoreRepository, CouponSubtypes, CouponTypes, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, Filter, FilterHasuraGraphQLRepository, FilterOption, FilterOptionHasuraGraphQLRepository, FilterType, FragranceImportances, GenderDestination, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, NotFoundError, OfficePosition, Order, OrderFirestoreRepository, OrderStatus, Payment, PaymentFirestoreRepository, PaymentType, Product, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductSpents, ProductVariantFirestoreRepository, ProductsIndex, QuestionsFilters, RecoveryPassword, Register, RegisterFirebaseAuthService, RequiredArgumentError, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, ShopSettings, ShopSettingsFirestoreRepository, Shops, SignInMethods, SignOut, Status, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, UnauthorizedError, UpdateOptionActions, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, WeakPasswordError, Where, get, is, isUUID, parseDateTime, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
3390
3764
  //# sourceMappingURL=infrab4a-connect.mjs.map