@infrab4a/connect 4.0.0-beta.2 → 4.0.0-beta.20

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 (184) hide show
  1. package/domain/catalog/models/category-filter.d.ts +11 -0
  2. package/domain/catalog/models/category.d.ts +7 -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 +7 -1
  7. package/domain/catalog/models/types/index.d.ts +1 -1
  8. package/domain/catalog/models/types/product-evaluation.type.d.ts +6 -0
  9. package/domain/catalog/repositories/category-filter.repository.d.ts +5 -0
  10. package/domain/catalog/repositories/category.repository.d.ts +3 -3
  11. package/domain/catalog/repositories/filter-option.repository.d.ts +4 -0
  12. package/domain/catalog/repositories/filter.repository.d.ts +4 -0
  13. package/domain/catalog/repositories/index.d.ts +3 -0
  14. package/domain/catalog/repositories/product.repository.d.ts +1 -0
  15. package/domain/generic/repository/find.repository.d.ts +3 -0
  16. package/domain/shop-settings/models/index.d.ts +1 -0
  17. package/domain/shop-settings/models/shop-settings.d.ts +9 -0
  18. package/domain/shop-settings/models/types/index.d.ts +6 -1
  19. package/domain/shop-settings/models/types/shop-banner.type.d.ts +12 -0
  20. package/domain/shop-settings/models/types/shop-brands.type.d.ts +10 -0
  21. package/domain/shop-settings/models/types/shop-carousel.type.d.ts +5 -0
  22. package/domain/shop-settings/models/types/shop-collection.type.d.ts +9 -0
  23. package/domain/shop-settings/models/types/shop-section.type.d.ts +9 -0
  24. package/domain/shop-settings/repositories/index.d.ts +1 -0
  25. package/domain/shop-settings/repositories/shop-settings.repository.d.ts +4 -0
  26. package/domain/shopping/models/buy-2-win.d.ts +3 -1
  27. package/domain/shopping/models/campaign-dashboard.d.ts +15 -0
  28. package/domain/shopping/models/campaign-hashtag.d.ts +18 -0
  29. package/domain/shopping/models/index.d.ts +5 -4
  30. package/domain/shopping/repositories/campaign-dashboard.repository.d.ts +4 -0
  31. package/domain/shopping/repositories/campaign-hashtag.repository.d.ts +4 -0
  32. package/domain/shopping/repositories/index.d.ts +4 -2
  33. package/domain/users/models/lead.d.ts +1 -0
  34. package/esm2020/domain/catalog/models/category-filter.mjs +14 -0
  35. package/esm2020/domain/catalog/models/category.mjs +12 -1
  36. package/esm2020/domain/catalog/models/filter-option.mjs +10 -0
  37. package/esm2020/domain/catalog/models/filter.mjs +10 -0
  38. package/esm2020/domain/catalog/models/index.mjs +4 -1
  39. package/esm2020/domain/catalog/models/product.mjs +24 -1
  40. package/esm2020/domain/catalog/models/types/index.mjs +2 -2
  41. package/esm2020/domain/catalog/models/types/product-evaluation.type.mjs +2 -0
  42. package/esm2020/domain/catalog/repositories/category-filter.repository.mjs +2 -0
  43. package/esm2020/domain/catalog/repositories/category.repository.mjs +1 -1
  44. package/esm2020/domain/catalog/repositories/filter-option.repository.mjs +2 -0
  45. package/esm2020/domain/catalog/repositories/filter.repository.mjs +2 -0
  46. package/esm2020/domain/catalog/repositories/index.mjs +4 -1
  47. package/esm2020/domain/catalog/repositories/product.repository.mjs +1 -1
  48. package/esm2020/domain/generic/repository/find.repository.mjs +1 -1
  49. package/esm2020/domain/shop-settings/models/index.mjs +2 -1
  50. package/esm2020/domain/shop-settings/models/shop-settings.mjs +7 -0
  51. package/esm2020/domain/shop-settings/models/types/index.mjs +7 -2
  52. package/esm2020/domain/shop-settings/models/types/shop-banner.type.mjs +2 -0
  53. package/esm2020/domain/shop-settings/models/types/shop-brands.type.mjs +2 -0
  54. package/esm2020/domain/shop-settings/models/types/shop-carousel.type.mjs +2 -0
  55. package/esm2020/domain/shop-settings/models/types/shop-collection.type.mjs +2 -0
  56. package/esm2020/domain/shop-settings/models/types/shop-section.type.mjs +2 -0
  57. package/esm2020/domain/shop-settings/repositories/index.mjs +2 -1
  58. package/esm2020/domain/shop-settings/repositories/shop-settings.repository.mjs +2 -0
  59. package/esm2020/domain/shopping/models/buy-2-win.mjs +2 -2
  60. package/esm2020/domain/shopping/models/campaign-dashboard.mjs +7 -0
  61. package/esm2020/domain/shopping/models/campaign-hashtag.mjs +7 -0
  62. package/esm2020/domain/shopping/models/index.mjs +6 -5
  63. package/esm2020/domain/shopping/repositories/campaign-dashboard.repository.mjs +2 -0
  64. package/esm2020/domain/shopping/repositories/campaign-hashtag.repository.mjs +2 -0
  65. package/esm2020/domain/shopping/repositories/index.mjs +5 -3
  66. package/esm2020/domain/users/models/lead.mjs +1 -1
  67. package/esm2020/domain/users/models/subscription/edition.mjs +1 -1
  68. package/esm2020/domain/users/models/subscription/payment.mjs +1 -1
  69. package/esm2020/domain/users/models/user-payment-method.mjs +1 -1
  70. package/esm2020/infra/elasticsearch/adapters/axios.adapter.mjs +28 -11
  71. package/esm2020/infra/elasticsearch/adapters/elastic-search.adapter.mjs +1 -1
  72. package/esm2020/infra/elasticsearch/indexes/products-index.mjs +58 -51
  73. package/esm2020/infra/elasticsearch/types/elastic-search-result.mjs +1 -1
  74. package/esm2020/infra/firebase/firestore/mixins/with-create-firestore.mixin.mjs +7 -3
  75. package/esm2020/infra/firebase/firestore/mixins/with-crud-firestore.mixin.mjs +1 -1
  76. package/esm2020/infra/firebase/firestore/mixins/with-delete-firestore.mixin.mjs +6 -2
  77. package/esm2020/infra/firebase/firestore/mixins/with-find-firestore.mixin.mjs +9 -6
  78. package/esm2020/infra/firebase/firestore/mixins/with-firestore.mixin.mjs +11 -3
  79. package/esm2020/infra/firebase/firestore/mixins/with-get-firestore.mixin.mjs +6 -3
  80. package/esm2020/infra/firebase/firestore/mixins/with-sub-collection.mixin.mjs +5 -3
  81. package/esm2020/infra/firebase/firestore/mixins/with-update-firestore.mixin.mjs +7 -4
  82. package/esm2020/infra/firebase/firestore/repositories/catalog/category-firestore.repository.mjs +12 -8
  83. package/esm2020/infra/firebase/firestore/repositories/catalog/product-firestore.repository.mjs +11 -6
  84. package/esm2020/infra/firebase/firestore/repositories/catalog/product-variant-firestore.repository.mjs +10 -8
  85. package/esm2020/infra/firebase/firestore/repositories/catalog/subscription-product-firestore.repository.mjs +8 -6
  86. package/esm2020/infra/firebase/firestore/repositories/shop-settings/home-firestore.repository.mjs +8 -6
  87. package/esm2020/infra/firebase/firestore/repositories/shop-settings/index.mjs +2 -1
  88. package/esm2020/infra/firebase/firestore/repositories/shop-settings/shop-menu-firestore.repository.mjs +8 -6
  89. package/esm2020/infra/firebase/firestore/repositories/shop-settings/shop-settings-firestore.repository.mjs +14 -0
  90. package/esm2020/infra/firebase/firestore/repositories/shopping/buy-2-win-firestore.repository.mjs +8 -6
  91. package/esm2020/infra/firebase/firestore/repositories/shopping/campaign-dashboard-firestore.repository.mjs +14 -0
  92. package/esm2020/infra/firebase/firestore/repositories/shopping/campaign-hashtag-firestore.repository.mjs +14 -0
  93. package/esm2020/infra/firebase/firestore/repositories/shopping/checkout-firestore.repository.mjs +8 -6
  94. package/esm2020/infra/firebase/firestore/repositories/shopping/checkout-subscription-firestore.repository.mjs +8 -6
  95. package/esm2020/infra/firebase/firestore/repositories/shopping/coupon-firestore.repository.mjs +8 -6
  96. package/esm2020/infra/firebase/firestore/repositories/shopping/index.mjs +6 -4
  97. package/esm2020/infra/firebase/firestore/repositories/shopping/legacy-order-firestore.repository.mjs +6 -4
  98. package/esm2020/infra/firebase/firestore/repositories/shopping/order-firestore.repository.mjs +11 -9
  99. package/esm2020/infra/firebase/firestore/repositories/shopping/payment-firestore.repository.mjs +8 -6
  100. package/esm2020/infra/firebase/firestore/repositories/shopping/subscription-plan-firestore.repository.mjs +8 -6
  101. package/esm2020/infra/firebase/firestore/repositories/users/lead-firestore.repository.mjs +8 -6
  102. package/esm2020/infra/firebase/firestore/repositories/users/subscription-edition-firestore.repository.mjs +10 -8
  103. package/esm2020/infra/firebase/firestore/repositories/users/subscription-firestore.repository.mjs +8 -6
  104. package/esm2020/infra/firebase/firestore/repositories/users/subscription-payment-firestore.repository.mjs +10 -8
  105. package/esm2020/infra/firebase/firestore/repositories/users/user-address-firestore.repository.mjs +10 -8
  106. package/esm2020/infra/firebase/firestore/repositories/users/user-beauty-profile-firestore.repository.mjs +10 -8
  107. package/esm2020/infra/firebase/firestore/repositories/users/user-firestore.repository.mjs +8 -6
  108. package/esm2020/infra/firebase/firestore/repositories/users/user-payment-method-firestore.repository.mjs +10 -8
  109. package/esm2020/infra/firebase/firestore/types/firestore-interceptors.type.mjs +2 -0
  110. package/esm2020/infra/firebase/firestore/types/firestore.repository.type.mjs +1 -1
  111. package/esm2020/infra/firebase/firestore/types/index.mjs +4 -3
  112. package/esm2020/infra/hasura-graphql/mixins/helpers/attribute-option.helper.mjs +2 -2
  113. package/esm2020/infra/hasura-graphql/mixins/helpers/graphql-field.helper.mjs +12 -6
  114. package/esm2020/infra/hasura-graphql/mixins/with-create-hasura-graphql.mixin.mjs +2 -2
  115. package/esm2020/infra/hasura-graphql/mixins/with-crud-hasura-graphql.mixin.mjs +1 -1
  116. package/esm2020/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.mjs +16 -12
  117. package/esm2020/infra/hasura-graphql/mixins/with-hasura-graphql.mixin.mjs +30 -21
  118. package/esm2020/infra/hasura-graphql/models/product-hasura-graphql.mjs +1 -1
  119. package/esm2020/infra/hasura-graphql/repositories/catalog/category-filter-hasura-graphql.repository.mjs +56 -0
  120. package/esm2020/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.mjs +106 -12
  121. package/esm2020/infra/hasura-graphql/repositories/catalog/filter-hasura-graphql.repository.mjs +105 -0
  122. package/esm2020/infra/hasura-graphql/repositories/catalog/filter-option-hasura-graphql.repository.mjs +22 -0
  123. package/esm2020/infra/hasura-graphql/repositories/catalog/index.mjs +4 -1
  124. package/esm2020/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.mjs +41 -15
  125. package/esm2020/infra/hasura-graphql/repositories/catalog/variant-hasura-graphql.repository.mjs +8 -7
  126. package/esm2020/infra/hasura-graphql/types/hasura-graphql-fields.type.mjs +1 -1
  127. package/esm2020/utils/index.mjs +2 -3
  128. package/fesm2015/infrab4a-connect.mjs +846 -298
  129. package/fesm2015/infrab4a-connect.mjs.map +1 -1
  130. package/fesm2020/infrab4a-connect.mjs +823 -303
  131. package/fesm2020/infrab4a-connect.mjs.map +1 -1
  132. package/infra/elasticsearch/adapters/axios.adapter.d.ts +6 -4
  133. package/infra/elasticsearch/adapters/elastic-search.adapter.d.ts +3 -2
  134. package/infra/elasticsearch/indexes/products-index.d.ts +8 -10
  135. package/infra/elasticsearch/types/elastic-search-result.d.ts +2 -0
  136. package/infra/firebase/firestore/mixins/with-crud-firestore.mixin.d.ts +2 -1
  137. package/infra/firebase/firestore/mixins/with-firestore.mixin.d.ts +13 -4
  138. package/infra/firebase/firestore/mixins/with-sub-collection.mixin.d.ts +6 -2
  139. package/infra/firebase/firestore/repositories/catalog/category-firestore.repository.d.ts +5 -5
  140. package/infra/firebase/firestore/repositories/catalog/product-firestore.repository.d.ts +4 -4
  141. package/infra/firebase/firestore/repositories/catalog/product-variant-firestore.repository.d.ts +3 -4
  142. package/infra/firebase/firestore/repositories/catalog/subscription-product-firestore.repository.d.ts +3 -4
  143. package/infra/firebase/firestore/repositories/shop-settings/home-firestore.repository.d.ts +4 -4
  144. package/infra/firebase/firestore/repositories/shop-settings/index.d.ts +1 -0
  145. package/infra/firebase/firestore/repositories/shop-settings/shop-menu-firestore.repository.d.ts +3 -4
  146. package/infra/firebase/firestore/repositories/shop-settings/shop-settings-firestore.repository.d.ts +7 -0
  147. package/infra/firebase/firestore/repositories/shopping/buy-2-win-firestore.repository.d.ts +3 -4
  148. package/infra/firebase/firestore/repositories/shopping/campaign-dashboard-firestore.repository.d.ts +8 -0
  149. package/infra/firebase/firestore/repositories/shopping/campaign-hashtag-firestore.repository.d.ts +8 -0
  150. package/infra/firebase/firestore/repositories/shopping/checkout-firestore.repository.d.ts +3 -4
  151. package/infra/firebase/firestore/repositories/shopping/checkout-subscription-firestore.repository.d.ts +3 -4
  152. package/infra/firebase/firestore/repositories/shopping/coupon-firestore.repository.d.ts +4 -4
  153. package/infra/firebase/firestore/repositories/shopping/index.d.ts +5 -3
  154. package/infra/firebase/firestore/repositories/shopping/legacy-order-firestore.repository.d.ts +3 -4
  155. package/infra/firebase/firestore/repositories/shopping/order-firestore.repository.d.ts +4 -4
  156. package/infra/firebase/firestore/repositories/shopping/payment-firestore.repository.d.ts +3 -4
  157. package/infra/firebase/firestore/repositories/shopping/subscription-plan-firestore.repository.d.ts +3 -4
  158. package/infra/firebase/firestore/repositories/users/lead-firestore.repository.d.ts +3 -4
  159. package/infra/firebase/firestore/repositories/users/subscription-edition-firestore.repository.d.ts +3 -4
  160. package/infra/firebase/firestore/repositories/users/subscription-firestore.repository.d.ts +3 -4
  161. package/infra/firebase/firestore/repositories/users/subscription-payment-firestore.repository.d.ts +3 -4
  162. package/infra/firebase/firestore/repositories/users/user-address-firestore.repository.d.ts +3 -4
  163. package/infra/firebase/firestore/repositories/users/user-beauty-profile-firestore.repository.d.ts +3 -4
  164. package/infra/firebase/firestore/repositories/users/user-firestore.repository.d.ts +4 -4
  165. package/infra/firebase/firestore/repositories/users/user-payment-method-firestore.repository.d.ts +3 -4
  166. package/infra/firebase/firestore/types/firestore-interceptors.type.d.ts +14 -0
  167. package/infra/firebase/firestore/types/firestore.repository.type.d.ts +2 -0
  168. package/infra/firebase/firestore/types/index.d.ts +3 -2
  169. package/infra/hasura-graphql/mixins/with-crud-hasura-graphql.mixin.d.ts +2 -2
  170. package/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.d.ts +4 -9
  171. package/infra/hasura-graphql/mixins/with-hasura-graphql.mixin.d.ts +14 -3
  172. package/infra/hasura-graphql/models/product-hasura-graphql.d.ts +1 -0
  173. package/infra/hasura-graphql/repositories/catalog/category-filter-hasura-graphql.repository.d.ts +11 -0
  174. package/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.d.ts +9 -5
  175. package/infra/hasura-graphql/repositories/catalog/filter-hasura-graphql.repository.d.ts +18 -0
  176. package/infra/hasura-graphql/repositories/catalog/filter-option-hasura-graphql.repository.d.ts +10 -0
  177. package/infra/hasura-graphql/repositories/catalog/index.d.ts +3 -0
  178. package/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.d.ts +4 -3
  179. package/infra/hasura-graphql/repositories/catalog/variant-hasura-graphql.repository.d.ts +4 -4
  180. package/infra/hasura-graphql/types/hasura-graphql-fields.type.d.ts +1 -1
  181. package/package.json +1 -2
  182. package/utils/index.d.ts +1 -21
  183. package/domain/catalog/models/types/category-filter.type.d.ts +0 -4
  184. package/esm2020/domain/catalog/models/types/category-filter.type.mjs +0 -2
@@ -3,14 +3,13 @@ import { plainToInstance, instanceToPlain, Expose, Type } from 'class-transforme
3
3
  import { __decorate, __metadata } from 'tslib';
4
4
  import { parseISO } from 'date-fns';
5
5
  export { add, addBusinessDays, addDays, addMonths, addYears, endOfDay, format, formatISO9075, parseISO, startOfDay, sub } from 'date-fns';
6
- import * as lodash from 'lodash';
7
- import { get as get$1, isString as isString$1 } from 'lodash';
6
+ import { get as get$1, isString, isNil, isNumber, isDate, set, isObject, isEmpty, chunk, isBoolean, isInteger, isNaN as isNaN$1, omit } from 'lodash';
7
+ export { chunk, isBoolean, isDate, isEmpty, isInteger, isNaN, isNil, isNumber, isObject, isString, now, omit, pick, set } from 'lodash';
8
8
  import { CustomError } from 'ts-custom-error';
9
9
  import axios from 'axios';
10
10
  import { collection, getDoc, doc, where, orderBy, getDocs, query, startAfter, startAt, limit, addDoc, setDoc, deleteField, arrayUnion, arrayRemove, deleteDoc, Timestamp } from 'firebase/firestore';
11
11
  import { signInWithEmailAndPassword, signInWithPopup, GoogleAuthProvider, signInAnonymously, sendPasswordResetEmail, createUserWithEmailAndPassword, sendEmailVerification } from 'firebase/auth';
12
12
  import { mutation, query as query$1 } from 'gql-query-builder';
13
- import fetch from 'node-fetch';
14
13
 
15
14
  class BaseModel {
16
15
  get identifier() {
@@ -473,7 +472,7 @@ function is(value) {
473
472
  return value;
474
473
  }
475
474
 
476
- const isUUID = (value) => isString$1(value) && /[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}/.test(value);
475
+ const isUUID = (value) => isString(value) && /[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}/.test(value);
477
476
 
478
477
  class Base {
479
478
  constructor(...args) {
@@ -482,7 +481,7 @@ class Base {
482
481
  }
483
482
 
484
483
  const parseDateTime = (value) => {
485
- if (!isString$1(value))
484
+ if (!isString(value))
486
485
  return value;
487
486
  if (!/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.test(value) &&
488
487
  !/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T\d{2}:\d{2}:\d{2}/.test(value))
@@ -493,8 +492,6 @@ const parseDateTime = (value) => {
493
492
  return date;
494
493
  };
495
494
 
496
- const { chunk, isBoolean, isDate, isEmpty, isInteger, isNaN: isNaN$1, isNil, isNumber, isObject, isString, now, omit, pick, set, } = lodash;
497
-
498
495
  var CheckoutTypes;
499
496
  (function (CheckoutTypes) {
500
497
  CheckoutTypes[CheckoutTypes["ECOMMERCE"] = 1] = "ECOMMERCE";
@@ -762,6 +759,15 @@ class RecoveryPassword {
762
759
  }
763
760
  }
764
761
 
762
+ class Filter extends BaseModel {
763
+ identifierFields() {
764
+ return ['id'];
765
+ }
766
+ static get identifiersFields() {
767
+ return ['id'];
768
+ }
769
+ }
770
+
765
771
  class Category extends BaseModel {
766
772
  identifierFields() {
767
773
  return ['id'];
@@ -770,6 +776,24 @@ class Category extends BaseModel {
770
776
  return ['id'];
771
777
  }
772
778
  }
779
+ __decorate([
780
+ Type(() => Category),
781
+ __metadata("design:type", Category)
782
+ ], Category.prototype, "parent", void 0);
783
+ __decorate([
784
+ Type(() => Filter),
785
+ __metadata("design:type", Array)
786
+ ], Category.prototype, "filters", void 0);
787
+
788
+ class CategoryFilter extends BaseModel {
789
+ static get identifiersFields() {
790
+ return ['id'];
791
+ }
792
+ }
793
+ __decorate([
794
+ Type(() => Filter),
795
+ __metadata("design:type", Filter)
796
+ ], CategoryFilter.prototype, "filter", void 0);
773
797
 
774
798
  var GenderDestination;
775
799
  (function (GenderDestination) {
@@ -786,7 +810,34 @@ var Shops;
786
810
  Shops["ALL"] = "ALL";
787
811
  })(Shops || (Shops = {}));
788
812
 
813
+ class FilterOption extends BaseModel {
814
+ identifierFields() {
815
+ return ['id'];
816
+ }
817
+ static get identifiersFields() {
818
+ return ['id'];
819
+ }
820
+ }
821
+
789
822
  class Product extends BaseModel {
823
+ get evaluation() {
824
+ return {
825
+ reviews: this.reviews,
826
+ count: this.reviewsTotal,
827
+ rating: this.rate,
828
+ };
829
+ }
830
+ set evaluation(evaluation) {
831
+ if (!evaluation) {
832
+ this.reviews = null;
833
+ this.reviewsTotal = null;
834
+ this.rate = null;
835
+ return;
836
+ }
837
+ this.reviews = evaluation.reviews || this.reviews;
838
+ this.reviewsTotal = evaluation.count || this.reviewsTotal;
839
+ this.rate = evaluation.rating || this.rate;
840
+ }
790
841
  identifierFields() {
791
842
  return ['id'];
792
843
  }
@@ -794,6 +845,10 @@ class Product extends BaseModel {
794
845
  return ['id'];
795
846
  }
796
847
  }
848
+ __decorate([
849
+ Type(() => Category),
850
+ __metadata("design:type", Category)
851
+ ], Product.prototype, "category", void 0);
797
852
  __decorate([
798
853
  Type(() => KitProduct),
799
854
  __metadata("design:type", Array)
@@ -822,17 +877,27 @@ class Variant extends BaseModel {
822
877
  }
823
878
  }
824
879
 
825
- var OrderStatus;
826
- (function (OrderStatus) {
827
- OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
828
- OrderStatus["EM_PREPARO"] = "Preparando pedido";
829
- OrderStatus["NF_EMITIDA"] = "Nota Fiscal Emitida";
830
- OrderStatus["AGUARDANDO_ENVIO"] = "Aguardando Transaportadora";
831
- OrderStatus["ENVIADO"] = "Enviado";
832
- OrderStatus["ENTREGUE"] = "Entregue";
833
- OrderStatus["CANCELADO"] = "Cancelado";
834
- OrderStatus["CREDIT_CARD"] = "credit_card";
835
- })(OrderStatus || (OrderStatus = {}));
880
+ class Buy2Win extends BaseModel {
881
+ static get identifiersFields() {
882
+ return ['id'];
883
+ }
884
+ }
885
+ __decorate([
886
+ Type(() => Category),
887
+ __metadata("design:type", Array)
888
+ ], Buy2Win.prototype, "categories", void 0);
889
+
890
+ class CampaignDashboard extends BaseModel {
891
+ static get identifiersFields() {
892
+ return ['id'];
893
+ }
894
+ }
895
+
896
+ class CampaignHashtag extends BaseModel {
897
+ static get identifiersFields() {
898
+ return ['id'];
899
+ }
900
+ }
836
901
 
837
902
  class LineItem extends Product {
838
903
  }
@@ -873,6 +938,18 @@ __decorate([
873
938
  __metadata("design:type", Coupon)
874
939
  ], Checkout.prototype, "coupon", void 0);
875
940
 
941
+ var OrderStatus;
942
+ (function (OrderStatus) {
943
+ OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
944
+ OrderStatus["EM_PREPARO"] = "Preparando pedido";
945
+ OrderStatus["NF_EMITIDA"] = "Nota Fiscal Emitida";
946
+ OrderStatus["AGUARDANDO_ENVIO"] = "Aguardando Transaportadora";
947
+ OrderStatus["ENVIADO"] = "Enviado";
948
+ OrderStatus["ENTREGUE"] = "Entregue";
949
+ OrderStatus["CANCELADO"] = "Cancelado";
950
+ OrderStatus["CREDIT_CARD"] = "credit_card";
951
+ })(OrderStatus || (OrderStatus = {}));
952
+
876
953
  class Order extends Checkout {
877
954
  }
878
955
  __decorate([
@@ -902,16 +979,6 @@ __decorate([
902
979
  __metadata("design:type", Coupon)
903
980
  ], CheckoutSubscription.prototype, "coupon", void 0);
904
981
 
905
- class Buy2Win extends BaseModel {
906
- static get identifiersFields() {
907
- return ['id'];
908
- }
909
- }
910
- __decorate([
911
- Type(() => Category),
912
- __metadata("design:type", Array)
913
- ], Buy2Win.prototype, "categories", void 0);
914
-
915
982
  var FilterType;
916
983
  (function (FilterType) {
917
984
  FilterType["ACCESSORY_IMPORTANCE"] = "accessoryImportance";
@@ -1011,6 +1078,12 @@ class ShopMenu extends BaseModel {
1011
1078
  }
1012
1079
  }
1013
1080
 
1081
+ class ShopSettings extends BaseModel {
1082
+ static get identifiersFields() {
1083
+ return ['id'];
1084
+ }
1085
+ }
1086
+
1014
1087
  class InvalidArgumentError extends CustomError {
1015
1088
  constructor(message) {
1016
1089
  super(message);
@@ -1041,12 +1114,16 @@ class AxiosAdapter {
1041
1114
  constructor(config) {
1042
1115
  this.config = config;
1043
1116
  }
1044
- async get(index) {
1117
+ async get(index, id) {
1045
1118
  try {
1046
1119
  const { data } = await axios({
1047
- url: `${this.config.url}/${index}`,
1120
+ url: `${this.config.url}/${index}/_doc/${id}`,
1048
1121
  method: 'GET',
1049
- headers: { Authorization: `Basic ${this.config.credential}` },
1122
+ responseType: 'json',
1123
+ headers: {
1124
+ 'Content-Type': 'application/json',
1125
+ Authorization: `ApiKey ${this.config.credential}`,
1126
+ },
1050
1127
  });
1051
1128
  return data._source;
1052
1129
  }
@@ -1058,9 +1135,14 @@ class AxiosAdapter {
1058
1135
  }
1059
1136
  async query(index, query) {
1060
1137
  const { data } = await axios({
1061
- url: `${this.config.url}/${index}`,
1138
+ url: `${this.config.url}/${index}/_search`,
1062
1139
  method: 'POST',
1063
- headers: { Authorization: `Basic ${this.config.credential}` },
1140
+ responseType: 'json',
1141
+ headers: {
1142
+ Accept: 'application/vnd.elasticsearch+json;compatible-with=7',
1143
+ 'Content-Type': 'application/vnd.elasticsearch+json;compatible-with=7',
1144
+ Authorization: `ApiKey ${this.config.credential}`,
1145
+ },
1064
1146
  data: query,
1065
1147
  });
1066
1148
  return {
@@ -1070,17 +1152,25 @@ class AxiosAdapter {
1070
1152
  }
1071
1153
  async save(index, data) {
1072
1154
  await axios({
1073
- url: `${this.config.url}/${index}`,
1155
+ url: `${this.config.url}/${index}/_doc`,
1156
+ method: 'POST',
1157
+ headers: { Authorization: `ApiKey ${this.config.credential}` },
1158
+ data,
1159
+ });
1160
+ }
1161
+ async update(index, id, data) {
1162
+ await axios({
1163
+ url: `${this.config.url}/${index}/_update/${id}`,
1074
1164
  method: 'PUT',
1075
- headers: { Authorization: `Basic ${this.config.credential}` },
1165
+ headers: { Authorization: `ApiKey ${this.config.credential}` },
1076
1166
  data,
1077
1167
  });
1078
1168
  }
1079
- async delete(index) {
1169
+ async delete(index, id) {
1080
1170
  await axios({
1081
- url: `${this.config.url}/${index}`,
1171
+ url: `${this.config.url}/${index}/_doc/${id}`,
1082
1172
  method: 'DELETE',
1083
- headers: { Authorization: `Basic ${this.config.credential}` },
1173
+ headers: { Authorization: `ApiKey ${this.config.credential}` },
1084
1174
  });
1085
1175
  }
1086
1176
  }
@@ -1088,13 +1178,16 @@ class AxiosAdapter {
1088
1178
  class ProductsIndex {
1089
1179
  constructor(adapter) {
1090
1180
  this.adapter = adapter;
1181
+ this.index = `products`;
1091
1182
  }
1092
- async get(id) {
1093
- const data = await this.adapter.get(`products/_doc/${id}`);
1183
+ async getById(id) {
1184
+ const data = await this.adapter.get(this.index, id);
1094
1185
  return Product.toInstance(data);
1095
1186
  }
1096
- async findById(ids, options) {
1187
+ async search(searchTerm, total, shop) {
1188
+ const size = total >= 10 ? 500 : 9;
1097
1189
  const fields = [
1190
+ 'EAN',
1098
1191
  'brand',
1099
1192
  'id',
1100
1193
  'images',
@@ -1105,73 +1198,77 @@ class ProductsIndex {
1105
1198
  'stock',
1106
1199
  'slug',
1107
1200
  'reviews',
1108
- 'pricePaid',
1109
- 'isGift',
1110
- 'stock',
1111
- 'weight',
1112
- 'tags',
1113
1201
  'hasVariants',
1114
- 'type',
1202
+ 'rate',
1115
1203
  ];
1116
- const { hits } = await this.adapter.query('products/_search', {
1204
+ const filter = [{ term: { published: true } }];
1205
+ if (size > 9) {
1206
+ fields.push(...['pricePaid', 'isGift', 'stock', 'weight', 'tags']);
1207
+ }
1208
+ else {
1209
+ filter.push({ term: { tags: shop == Shops.GLAMSHOP ? 'feminino' : 'masculino' } });
1210
+ }
1211
+ const search = await this.adapter.query(this.index, {
1212
+ size,
1117
1213
  _source: fields,
1118
1214
  query: {
1119
1215
  bool: {
1120
- filter: [
1121
- {
1122
- terms: {
1123
- _id: ids,
1124
- },
1216
+ must: {
1217
+ multi_match: {
1218
+ query: `${searchTerm}`,
1219
+ type: 'bool_prefix',
1220
+ fields: [
1221
+ 'name',
1222
+ 'name.folded',
1223
+ 'name.search',
1224
+ 'description',
1225
+ 'description.search',
1226
+ 'description.folded',
1227
+ 'brand',
1228
+ 'brand.search',
1229
+ 'brand.folded',
1230
+ ],
1231
+ fuzziness: 2,
1125
1232
  },
1126
- {
1127
- term: {
1128
- published: true,
1233
+ },
1234
+ should: {
1235
+ match_phrase_prefix: {
1236
+ 'name.search': {
1237
+ query: `${searchTerm}`,
1238
+ slop: 10,
1129
1239
  },
1130
1240
  },
1131
- ...(options?.hasStock
1132
- ? [
1133
- {
1134
- range: {
1135
- 'stock.quantity': {
1136
- gt: 0,
1137
- },
1138
- },
1139
- },
1140
- ]
1141
- : []),
1142
- ],
1241
+ },
1242
+ filter,
1143
1243
  },
1144
1244
  },
1145
- ...(options?.size ? { size: options?.size } : {}),
1146
1245
  });
1147
- return hits.map((hit) => Product.toInstance(hit._source));
1246
+ search.hits = search.hits.filter((e) => e._source.name !== '');
1247
+ return search;
1148
1248
  }
1149
1249
  async save(product) {
1150
- delete product.createdAt;
1151
- delete product.updatedAt;
1152
- delete product.kitProducts;
1153
1250
  try {
1154
- if (!product.firestoreId)
1155
- throw new Error('Is not a product from firestore');
1156
- await this.get(product.firestoreId);
1157
- await this.adapter.save(`products/_doc/${product.firestoreId}`, product.toPlain());
1251
+ const { createdAt, updatedAt, kitProducts, ...data } = product;
1252
+ this.adapter.save(this.index, data);
1158
1253
  }
1159
1254
  catch (error) {
1160
- if (!(error instanceof Error))
1161
- throw error;
1162
- console.error(error.message);
1163
- await this.adapter.save(`products/_doc/${product.id}`, product.toPlain());
1255
+ console.error(error);
1164
1256
  }
1165
1257
  }
1166
- async delete(product) {
1167
- if (!product.firestoreId)
1168
- return;
1258
+ async update(product) {
1259
+ try {
1260
+ await this.adapter.update(this.index, product.id, product);
1261
+ }
1262
+ catch (error) {
1263
+ console.error(error);
1264
+ }
1265
+ }
1266
+ async delete(id) {
1169
1267
  try {
1170
- await this.get(product.firestoreId);
1171
- await this.adapter.delete(`products/_doc/${product.firestoreId}`);
1268
+ await this.adapter.delete(this.index, id);
1172
1269
  }
1173
1270
  catch (error) {
1174
- await this.adapter.delete(`products/_doc/${product.id}`);
1271
+ console.error(error);
1175
1272
  }
1176
1273
  }
1177
1274
  }
@@ -1202,9 +1299,17 @@ const withFirestore = (MixinBase) => {
1202
1299
  }), {});
1203
1300
  };
1204
1301
  return class extends MixinBase {
1205
- constructor() {
1206
- super(...arguments);
1302
+ constructor(...params) {
1303
+ const options = params[0];
1304
+ super(...params);
1305
+ this.fields = {};
1306
+ this.interceptors = {};
1207
1307
  this.collectionName = '';
1308
+ this.firestore = options.firestore;
1309
+ this.collectionName = options.collectionName;
1310
+ this.model = options.model;
1311
+ this.fields = options.fields;
1312
+ this.interceptors = options.interceptors;
1208
1313
  }
1209
1314
  collection(path) {
1210
1315
  return collection(this.firestore, path || this.collectionName).withConverter(this.buildModelInstance());
@@ -1251,11 +1356,14 @@ const withHelpers = (MixinBase) => {
1251
1356
  const withGetFirestore = (MixinBase) => {
1252
1357
  return class GetFirestore extends MixinBase {
1253
1358
  async get(identifiers) {
1254
- const docRef = await getDoc(doc(await this.collection(this.buildCollectionPathForGet(identifiers)), Object.values(identifiers).shift().toString()));
1359
+ const instance = this.model.toInstance(this.model.identifiersFields.reduce((acc, field) => ({ ...acc, [field]: identifiers[field] }), {}));
1360
+ const intercepted = await this.interceptors?.request?.({ instance });
1361
+ const builded = intercepted?.instance || instance;
1362
+ const docRef = await getDoc(doc(await this.collection(this.buildCollectionPathForGet(identifiers)), Object.values(builded.identifier).shift().toString()));
1255
1363
  const data = docRef.data();
1256
1364
  if (isNil(data))
1257
1365
  throw new NotFoundError(`Document ${JSON.stringify(identifiers)} not found`);
1258
- return data;
1366
+ return this.interceptors?.response?.(data, intercepted) || data;
1259
1367
  }
1260
1368
  buildCollectionPathForGet(identifiers) {
1261
1369
  return this.isSubCollection(this)
@@ -1336,8 +1444,11 @@ const withFindFirestore = (MixinBase) => {
1336
1444
  return Object.keys(fieldsToOrderBy).map((fieldName) => orderBy(fieldName, fieldsToOrderBy[fieldName]));
1337
1445
  };
1338
1446
  }
1339
- async find({ filters, limits, orderBy, } = {}) {
1340
- const collection = this.collection(this.buildCollectionPathForFind(filters));
1447
+ async find(find = {}) {
1448
+ const collection = this.collection(this.buildCollectionPathForFind(find.filters));
1449
+ const enableCount = find?.options?.enableCount ?? true;
1450
+ const intercepted = await this.interceptors?.request?.({ find });
1451
+ const { filters, limits, orderBy } = intercepted.find || find;
1341
1452
  const queries = this.makeFirestoreWhere(filters || {});
1342
1453
  const ordination = this.makeFirestoreOrderBy(filters, orderBy);
1343
1454
  const offsets = await this.defineLimits(filters, limits);
@@ -1345,8 +1456,8 @@ const withFindFirestore = (MixinBase) => {
1345
1456
  const docs = await getDocs(query(collection, ...queryArgumments));
1346
1457
  const data = docs.docs.map((doc) => doc.data());
1347
1458
  return {
1348
- data,
1349
- count: this.calculateCount(data, limits),
1459
+ data: (await this.interceptors?.response?.(data, intercepted)) || data,
1460
+ count: enableCount ? this.calculateCount(data, limits) : Infinity,
1350
1461
  };
1351
1462
  }
1352
1463
  buildCollectionPathForFind(filters) {
@@ -1360,7 +1471,7 @@ const withFindFirestore = (MixinBase) => {
1360
1471
  const queries = [];
1361
1472
  if (limits?.offset) {
1362
1473
  if (this.model.isModel(limits.offset))
1363
- queries.push(startAfter(await getDoc(doc(this.collection(this.buildCollectionPathForFind(filters)), limits.offset.identifier.shift()))));
1474
+ queries.push(startAfter(await getDoc(doc(this.collection(this.buildCollectionPathForFind(filters)), limits.offset.identifier[limits.offset.identifiersFields?.shift()]))));
1364
1475
  else if (isNumber(limits.offset) || isString(limits.offset))
1365
1476
  queries.push(startAt(limits.offset));
1366
1477
  }
@@ -1381,9 +1492,13 @@ const withFindFirestore = (MixinBase) => {
1381
1492
  const withCreateFirestore = (MixinBase) => {
1382
1493
  return class CreateFirestore extends MixinBase {
1383
1494
  async create(data) {
1384
- const docRef = await this.save(this.model.toInstance(data));
1495
+ const instance = this.model.toInstance(data);
1496
+ const intercepted = await this.interceptors?.request?.({ instance });
1497
+ const builded = intercepted?.instance || instance;
1498
+ const docRef = await this.save(builded);
1385
1499
  const doc = await getDoc(docRef);
1386
- return doc.data();
1500
+ const docBuilded = (await this.interceptors?.response?.(doc.data(), intercepted)) || doc.data();
1501
+ return docBuilded;
1387
1502
  }
1388
1503
  async save(data) {
1389
1504
  const id = data.identifier[data.identifiersFields?.shift()]?.toString();
@@ -1427,9 +1542,12 @@ const withUpdateFirestore = (MixinBase) => {
1427
1542
  const model = new this.model();
1428
1543
  const keyField = model.identifiersFields.shift();
1429
1544
  const docRef = doc(this.collection(this.buildCollectionPathForUpdate(data)), getValueFromParams(data, keyField).toString());
1430
- await setDoc(docRef, this.paramsToPlain(data), { merge: true });
1431
- const docData = await getDoc(docRef);
1432
- return docData.data();
1545
+ const plainFromData = this.model.toInstance(this.paramsToPlain(data));
1546
+ const intercepted = await this.interceptors?.request?.({ instance: plainFromData });
1547
+ const builded = intercepted?.instance || plainFromData;
1548
+ await setDoc(docRef, builded.toPlain(), { merge: true });
1549
+ const docData = await getDoc(docRef).then((doc) => doc.data());
1550
+ return this.interceptors?.response?.(docData, intercepted) || docData;
1433
1551
  }
1434
1552
  buildCollectionPathForUpdate(identifiers) {
1435
1553
  return this.isSubCollection(this)
@@ -1451,7 +1569,11 @@ const withUpdateFirestore = (MixinBase) => {
1451
1569
  const withDeleteFirestore = (MixinBase) => {
1452
1570
  return class DeleteFirestore extends MixinBase {
1453
1571
  async delete(identifiers) {
1454
- await deleteDoc(doc(this.collection(this.buildCollectionPathForRemove(identifiers)), Object.values(identifiers).shift().toString()));
1572
+ const instance = this.model.toInstance(this.model.identifiersFields.reduce((acc, field) => ({ ...acc, [field]: identifiers[field] }), {}));
1573
+ const intercepted = await this.interceptors?.request?.({ instance });
1574
+ const builded = intercepted?.instance || instance;
1575
+ await deleteDoc(doc(this.collection(this.buildCollectionPathForRemove(identifiers)), Object.values(builded.identifier).shift().toString()));
1576
+ await this.interceptors?.response?.(instance, intercepted);
1455
1577
  }
1456
1578
  buildCollectionPathForRemove(identifiers) {
1457
1579
  return this.isSubCollection(this)
@@ -1463,8 +1585,10 @@ const withDeleteFirestore = (MixinBase) => {
1463
1585
 
1464
1586
  const withSubCollection = (MixinBase, ParentModel) => {
1465
1587
  return class SubCollectionMix extends MixinBase {
1466
- constructor(...args) {
1467
- super(args);
1588
+ constructor(...params) {
1589
+ const options = params[0];
1590
+ super(...params);
1591
+ this.parentIdField = options.parentIdField;
1468
1592
  }
1469
1593
  collection(path) {
1470
1594
  return super.collection(path);
@@ -1478,73 +1602,87 @@ const withCrudFirestore = (MixinBase) => {
1478
1602
  };
1479
1603
 
1480
1604
  class LeadFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1481
- constructor(firestore) {
1482
- super();
1483
- this.firestore = firestore;
1484
- this.collectionName = 'leads';
1485
- this.model = Lead;
1605
+ constructor({ firestore, interceptors }) {
1606
+ super({
1607
+ firestore,
1608
+ collectionName: 'leads',
1609
+ model: Lead,
1610
+ interceptors,
1611
+ });
1486
1612
  }
1487
1613
  }
1488
1614
 
1489
1615
  class SubscriptionEditionFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Subscription) {
1490
- constructor(firestore, parentRepository) {
1491
- super();
1492
- this.firestore = firestore;
1616
+ constructor({ firestore, interceptors }, parentRepository) {
1617
+ super({
1618
+ firestore,
1619
+ collectionName: 'editions',
1620
+ parentIdField: 'subscriptionId',
1621
+ model: Edition,
1622
+ interceptors,
1623
+ });
1493
1624
  this.parentRepository = parentRepository;
1494
- this.collectionName = 'editions';
1495
- this.parentIdField = 'subscriptionId';
1496
- this.model = Edition;
1497
1625
  }
1498
1626
  }
1499
1627
 
1500
1628
  class SubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1501
- constructor(firestore) {
1502
- super();
1503
- this.firestore = firestore;
1504
- this.collectionName = 'subscription';
1505
- this.model = Subscription;
1629
+ constructor({ firestore, interceptors, }) {
1630
+ super({
1631
+ firestore,
1632
+ collectionName: 'subscription',
1633
+ model: Subscription,
1634
+ interceptors,
1635
+ });
1506
1636
  }
1507
1637
  }
1508
1638
 
1509
1639
  class SubscriptionPaymentFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Subscription) {
1510
- constructor(firestore, parentRepository) {
1511
- super();
1512
- this.firestore = firestore;
1640
+ constructor({ firestore, interceptors }, parentRepository) {
1641
+ super({
1642
+ firestore,
1643
+ collectionName: 'payments',
1644
+ parentIdField: 'subscriptionId',
1645
+ model: SubscriptionPayment,
1646
+ interceptors,
1647
+ });
1513
1648
  this.parentRepository = parentRepository;
1514
- this.collectionName = 'payments';
1515
- this.parentIdField = 'subscriptionId';
1516
- this.model = SubscriptionPayment;
1517
1649
  }
1518
1650
  }
1519
1651
 
1520
1652
  class UserAddressFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User) {
1521
- constructor(firestore, parentRepository) {
1522
- super();
1523
- this.firestore = firestore;
1653
+ constructor({ firestore, interceptors }, parentRepository) {
1654
+ super({
1655
+ firestore,
1656
+ collectionName: 'address',
1657
+ parentIdField: 'userId',
1658
+ model: UserAddress,
1659
+ interceptors,
1660
+ });
1524
1661
  this.parentRepository = parentRepository;
1525
- this.collectionName = 'address';
1526
- this.parentIdField = 'userId';
1527
- this.model = UserAddress;
1528
1662
  }
1529
1663
  }
1530
1664
 
1531
1665
  class UserBeautyProfileFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User) {
1532
- constructor(firestore, parentRepository) {
1533
- super();
1534
- this.firestore = firestore;
1666
+ constructor({ firestore, interceptors }, parentRepository) {
1667
+ super({
1668
+ firestore,
1669
+ collectionName: 'CX',
1670
+ parentIdField: 'userId',
1671
+ model: BeautyProfile,
1672
+ interceptors,
1673
+ });
1535
1674
  this.parentRepository = parentRepository;
1536
- this.collectionName = 'CX';
1537
- this.parentIdField = 'userId';
1538
- this.model = BeautyProfile;
1539
1675
  }
1540
1676
  }
1541
1677
 
1542
1678
  class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1543
- constructor(firestore) {
1544
- super();
1545
- this.firestore = firestore;
1546
- this.collectionName = 'users';
1547
- this.model = User;
1679
+ constructor({ firestore, interceptors }) {
1680
+ super({
1681
+ firestore,
1682
+ collectionName: 'users',
1683
+ model: User,
1684
+ interceptors,
1685
+ });
1548
1686
  }
1549
1687
  async get(identifiers) {
1550
1688
  const user = await super.get({ id: identifiers.id });
@@ -1584,22 +1722,26 @@ class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestor
1584
1722
  }
1585
1723
 
1586
1724
  class UserPaymentMethodFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User) {
1587
- constructor(firestore, parentRepository) {
1588
- super();
1589
- this.firestore = firestore;
1725
+ constructor({ firestore, interceptors }, parentRepository) {
1726
+ super({
1727
+ firestore,
1728
+ collectionName: 'payment_method',
1729
+ parentIdField: 'userId',
1730
+ model: UserPaymentMethod,
1731
+ interceptors,
1732
+ });
1590
1733
  this.parentRepository = parentRepository;
1591
- this.collectionName = 'payment_method';
1592
- this.parentIdField = 'userId';
1593
- this.model = UserPaymentMethod;
1594
1734
  }
1595
1735
  }
1596
1736
 
1597
1737
  class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1598
- constructor(firestore) {
1599
- super();
1600
- this.firestore = firestore;
1601
- this.collectionName = 'categories';
1602
- this.model = Category;
1738
+ constructor({ firestore, interceptors }) {
1739
+ super({
1740
+ firestore,
1741
+ collectionName: 'categories',
1742
+ model: Category,
1743
+ interceptors,
1744
+ });
1603
1745
  }
1604
1746
  async getCategoryBySlug(slug, shop) {
1605
1747
  const categoryDocs = await getDocs(query(this.collection(this.collectionName), where('slug', '==', slug), where('shop', '==', shop), where('published', '==', true)));
@@ -1609,14 +1751,14 @@ class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFire
1609
1751
  throw new NotFoundError(`Document with slug ${slug} not found`);
1610
1752
  return categoryDocs.docs[0].data();
1611
1753
  }
1612
- async getCategoriesForHome(categoryIds, limit = 4) {
1754
+ async getCategoriesForHome(categoryIds, limit = 4, gender) {
1613
1755
  const categorySnap = await getDocs(query(this.collection(this.collectionName), where('id', 'in', categoryIds.filter(Boolean)), where('published', '==', true)));
1614
1756
  if (categorySnap.empty)
1615
1757
  throw new NotFoundError('Categories not found');
1616
1758
  const categories = categorySnap.docs.map((doc) => doc.data());
1617
1759
  const homeSections = await Promise.all(categories.map(async (category) => ({
1618
1760
  category,
1619
- products: await this.mountCategory(category, { limit, hasStock: true }),
1761
+ products: await this.mountCategory(category, { limit, hasStock: true, gender }),
1620
1762
  })));
1621
1763
  return homeSections;
1622
1764
  }
@@ -1632,6 +1774,8 @@ class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFire
1632
1774
  wheres.push(where('published', '==', true), where('id', 'in', productIds));
1633
1775
  if (options?.hasStock)
1634
1776
  wheres.push(where('stock.quantity', '>', 0));
1777
+ if (options?.gender)
1778
+ wheres.push(where('tags', 'array-contains', options?.gender));
1635
1779
  if (options?.limit)
1636
1780
  wheres.push(limit(options?.limit));
1637
1781
  const productSnap = await getDocs(query(this.collection('productsErpVitrine'), ...wheres));
@@ -1644,12 +1788,14 @@ class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFire
1644
1788
  }
1645
1789
 
1646
1790
  class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1647
- constructor(firestore) {
1648
- super();
1649
- this.firestore = firestore;
1791
+ constructor({ firestore, interceptors }) {
1792
+ super({
1793
+ firestore,
1794
+ collectionName: 'productsErpVitrine',
1795
+ model: Product,
1796
+ interceptors,
1797
+ });
1650
1798
  this.reviews = {};
1651
- this.collectionName = 'productsErpVitrine';
1652
- this.model = Product;
1653
1799
  }
1654
1800
  async getBySlug(slug) {
1655
1801
  const result = await this.find({
@@ -1684,43 +1830,98 @@ class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFires
1684
1830
  });
1685
1831
  return this.reviews[status];
1686
1832
  }
1833
+ cleanShoppingCountFromIds() {
1834
+ return;
1835
+ }
1687
1836
  }
1688
1837
 
1689
1838
  class ProductVariantFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Product) {
1690
- constructor(firestore, parentRepository) {
1691
- super();
1692
- this.firestore = firestore;
1839
+ constructor({ firestore, interceptors }, parentRepository) {
1840
+ super({
1841
+ firestore,
1842
+ collectionName: 'variants',
1843
+ parentIdField: 'productId',
1844
+ model: Variant,
1845
+ interceptors,
1846
+ });
1693
1847
  this.parentRepository = parentRepository;
1694
- this.collectionName = 'variants';
1695
- this.parentIdField = 'productId';
1696
- this.model = Variant;
1697
1848
  }
1698
1849
  }
1699
1850
 
1700
1851
  class SubscriptionProductFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1701
- constructor(firestore) {
1702
- super();
1703
- this.firestore = firestore;
1704
- this.collectionName = 'subscriptionProducts';
1705
- this.model = Product;
1852
+ constructor({ firestore, interceptors }) {
1853
+ super({
1854
+ firestore,
1855
+ collectionName: 'subscriptionProducts',
1856
+ model: Product,
1857
+ interceptors,
1858
+ });
1859
+ }
1860
+ }
1861
+
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 CampaignDashboardFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1874
+ constructor({ firestore, interceptors, }) {
1875
+ super({
1876
+ firestore,
1877
+ collectionName: 'dashboardCampaignsAuto',
1878
+ model: CampaignDashboard,
1879
+ interceptors,
1880
+ });
1881
+ }
1882
+ }
1883
+
1884
+ class CampaignHashtagFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1885
+ constructor({ firestore, interceptors, }) {
1886
+ super({
1887
+ firestore,
1888
+ collectionName: 'hashtagCampaignsAuto',
1889
+ model: CampaignHashtag,
1890
+ interceptors,
1891
+ });
1706
1892
  }
1707
1893
  }
1708
1894
 
1709
1895
  class CheckoutFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1710
- constructor(firestore) {
1711
- super();
1712
- this.firestore = firestore;
1713
- this.collectionName = 'checkouts';
1714
- this.model = Checkout;
1896
+ constructor({ firestore, interceptors }) {
1897
+ super({
1898
+ firestore,
1899
+ collectionName: 'checkouts',
1900
+ model: Checkout,
1901
+ interceptors,
1902
+ });
1903
+ }
1904
+ }
1905
+
1906
+ class CheckoutSubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1907
+ constructor({ firestore, interceptors, }) {
1908
+ super({
1909
+ firestore,
1910
+ collectionName: 'checkoutsSubscription',
1911
+ model: CheckoutSubscription,
1912
+ interceptors,
1913
+ });
1715
1914
  }
1716
1915
  }
1717
1916
 
1718
1917
  class CouponFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1719
- constructor(firestore) {
1720
- super();
1721
- this.firestore = firestore;
1722
- this.collectionName = 'coupons';
1723
- this.model = Coupon;
1918
+ constructor({ firestore, interceptors }) {
1919
+ super({
1920
+ firestore,
1921
+ collectionName: 'coupons',
1922
+ model: Coupon,
1923
+ interceptors,
1924
+ });
1724
1925
  }
1725
1926
  buildModelInstance() {
1726
1927
  const { fromFirestore, toFirestore } = super.buildModelInstance();
@@ -1742,9 +1943,16 @@ class CouponFirestoreRepository extends withCrudFirestore(withHelpers(withFirest
1742
1943
  }
1743
1944
 
1744
1945
  class OrderFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1745
- constructor(firestore) {
1746
- super();
1747
- this.firestore = firestore;
1946
+ constructor({ firestore, interceptors }) {
1947
+ super({
1948
+ firestore,
1949
+ collectionName: 'orders',
1950
+ model: Order,
1951
+ interceptors,
1952
+ fields: {
1953
+ status: FirestoreFieldType.String,
1954
+ },
1955
+ });
1748
1956
  this.orderFromFirestore = (order) => {
1749
1957
  if (!!order?.lineItems?.length) {
1750
1958
  order.lineItems = order.lineItems.map((lineItem) => {
@@ -1757,11 +1965,6 @@ class OrderFirestoreRepository extends withCrudFirestore(withHelpers(withFiresto
1757
1965
  }
1758
1966
  return order;
1759
1967
  };
1760
- this.collectionName = 'orders';
1761
- this.model = Order;
1762
- this.fields = {
1763
- status: FirestoreFieldType.String,
1764
- };
1765
1968
  }
1766
1969
  buildModelInstance() {
1767
1970
  const { fromFirestore, toFirestore } = super.buildModelInstance();
@@ -1775,54 +1978,46 @@ class OrderFirestoreRepository extends withCrudFirestore(withHelpers(withFiresto
1775
1978
  }
1776
1979
  }
1777
1980
 
1778
- class PaymentFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1779
- constructor(firestore) {
1780
- super();
1781
- this.firestore = firestore;
1782
- this.collectionName = 'payments';
1783
- this.model = Payment;
1981
+ class LegacyOrderFirestoreRepository extends OrderFirestoreRepository {
1982
+ constructor({ firestore, interceptors }) {
1983
+ super({
1984
+ firestore,
1985
+ interceptors,
1986
+ });
1987
+ this.collectionName = 'legacyOrders';
1784
1988
  }
1785
1989
  }
1786
1990
 
1787
- class CheckoutSubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1788
- constructor(firestore) {
1789
- super();
1790
- this.firestore = firestore;
1791
- this.collectionName = 'checkoutsSubscription';
1792
- this.model = CheckoutSubscription;
1991
+ class PaymentFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1992
+ constructor({ firestore, interceptors }) {
1993
+ super({
1994
+ firestore,
1995
+ collectionName: 'payments',
1996
+ model: Payment,
1997
+ interceptors,
1998
+ });
1793
1999
  }
1794
2000
  }
1795
2001
 
1796
2002
  class SubscriptionPlanFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1797
- constructor(firestore) {
1798
- super();
1799
- this.firestore = firestore;
1800
- this.collectionName = 'subscriptionPlans';
1801
- this.model = SubscriptionPlan;
1802
- }
1803
- }
1804
-
1805
- class Buy2WinFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1806
- constructor(firestore) {
1807
- super();
1808
- this.firestore = firestore;
1809
- this.collectionName = 'buy2win';
1810
- this.model = Buy2Win;
1811
- }
1812
- }
1813
-
1814
- class LegacyOrderFirestoreRepository extends OrderFirestoreRepository {
1815
- constructor(firestore) {
1816
- super(firestore);
1817
- this.firestore = firestore;
1818
- this.collectionName = 'legacyOrders';
2003
+ constructor({ firestore, interceptors, }) {
2004
+ super({
2005
+ firestore,
2006
+ collectionName: 'subscriptionPlans',
2007
+ model: SubscriptionPlan,
2008
+ interceptors,
2009
+ });
1819
2010
  }
1820
2011
  }
1821
2012
 
1822
2013
  class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1823
- constructor(firestore) {
1824
- super();
1825
- this.firestore = firestore;
2014
+ constructor({ firestore, interceptors }) {
2015
+ super({
2016
+ firestore,
2017
+ collectionName: 'dms',
2018
+ model: Home,
2019
+ interceptors,
2020
+ });
1826
2021
  this.homeToFirestore = (home) => {
1827
2022
  if (home.data?.data) {
1828
2023
  home.data.data.discoverProducts = home.data.data.discoverProducts.map(this.homeCategoryGroupToPlain);
@@ -1851,8 +2046,6 @@ class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestor
1851
2046
  category: Category.toInstance(homeCategoryGroup.category),
1852
2047
  products: homeCategoryGroup.products.map((product) => Product.toInstance(product)),
1853
2048
  });
1854
- this.collectionName = 'dms';
1855
- this.model = Home;
1856
2049
  }
1857
2050
  buildModelInstance() {
1858
2051
  const { fromFirestore, toFirestore } = super.buildModelInstance();
@@ -1870,11 +2063,24 @@ class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestor
1870
2063
  }
1871
2064
 
1872
2065
  class ShopMenuFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1873
- constructor(firestore) {
1874
- super();
1875
- this.firestore = firestore;
1876
- this.collectionName = 'shopMenus';
1877
- this.model = ShopMenu;
2066
+ constructor({ firestore, interceptors }) {
2067
+ super({
2068
+ firestore,
2069
+ collectionName: 'shopMenus',
2070
+ model: ShopMenu,
2071
+ interceptors,
2072
+ });
2073
+ }
2074
+ }
2075
+
2076
+ class ShopSettingsFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2077
+ constructor({ firestore, interceptors, }) {
2078
+ super({
2079
+ firestore,
2080
+ collectionName: 'shopSettings',
2081
+ model: ShopSettings,
2082
+ interceptors,
2083
+ });
1878
2084
  }
1879
2085
  }
1880
2086
 
@@ -1951,7 +2157,7 @@ class AttributeOptionHelper {
1951
2157
  }
1952
2158
  AttributeOptionHelper.FindByAttribute = (attributeName, fields) => {
1953
2159
  if (fields.includes(attributeName))
1954
- return { columnName: attributeName.toString(), attributeName };
2160
+ return { columnName: attributeName.toString(), attributeName, to: (value) => value, from: (value) => value };
1955
2161
  const field = fields.find((columnOption) => isObject(columnOption) && Object.keys(columnOption).includes(attributeName.toString()));
1956
2162
  const fieldOption = is(field)?.[attributeName];
1957
2163
  if (isNil(fieldOption))
@@ -2153,7 +2359,10 @@ GraphQLFieldHelper.ConvertFieldValueFrom = (data, fields) => Object.keys(data).r
2153
2359
  }
2154
2360
  if (!!from)
2155
2361
  return { ...result, [attributeName]: from(data[columnName], data) };
2156
- return { ...result, [attributeName]: parseDateTime(data[columnName].toString()) };
2362
+ return {
2363
+ ...result,
2364
+ [attributeName]: isString(data[columnName]) ? parseDateTime(data[columnName].toString()) : data[columnName],
2365
+ };
2157
2366
  }, {});
2158
2367
  GraphQLFieldHelper.ConvertFieldValueTo = (instance, fields, update = false) => {
2159
2368
  const data = instance.toPlain?.() || instance;
@@ -2169,10 +2378,13 @@ GraphQLFieldHelper.ConvertFieldValueTo = (instance, fields, update = false) => {
2169
2378
  if (!!foreignKeyColumn &&
2170
2379
  !isEmpty(foreignKeyColumn) &&
2171
2380
  !Object.keys(foreignKeyColumn).filter((key) => !is(data[attributeName])?.[key]).length)
2172
- return Object.keys(foreignKeyColumn).reduce((object, current) => ({
2173
- ...object,
2174
- [foreignKeyColumn[current]]: data[attributeName]?.[current],
2175
- }), { ...result });
2381
+ return Object.keys(foreignKeyColumn).reduce((object, current) => {
2382
+ const { columnName: foreignColumnName } = AttributeOptionHelper.FindByAttribute(foreignKeyColumn[current], fields);
2383
+ return {
2384
+ ...object,
2385
+ [foreignColumnName]: data[attributeName]?.[current],
2386
+ };
2387
+ }, { ...result });
2176
2388
  if (update &&
2177
2389
  isObject(data[attributeName]) &&
2178
2390
  !isNil(attributeFields) &&
@@ -2225,7 +2437,7 @@ const withCreateHasuraGraphQL = (MixinBase) => {
2225
2437
  const columnOptions = Object.values(field).shift();
2226
2438
  return (AttributeOptionHelper.CheckIsColumnOption(columnOptions) &&
2227
2439
  columnOptions.foreignKeyColumn && [
2228
- ...Object.values(columnOptions.foreignKeyColumn),
2440
+ ...Object.values(columnOptions.foreignKeyColumn).map((foreignKeyName) => AttributeOptionHelper.FindByAttribute(foreignKeyName, this.fields)?.columnName),
2229
2441
  {
2230
2442
  [columnOptions.columnName]: Object.keys(columnOptions.foreignKeyColumn).map((foreignKeyField) => AttributeOptionHelper.FindByAttribute(foreignKeyField, columnOptions?.fields)?.columnName ||
2231
2443
  foreignKeyField),
@@ -2283,11 +2495,14 @@ const withHasuraGraphQL = (MixinBase) => {
2283
2495
  get headers() {
2284
2496
  return {
2285
2497
  'Content-Type': 'application/json',
2286
- ...(isNil(this.authOptions.authToken) ? {} : { Authorization: this.authOptions.authToken }),
2287
- ...(isNil(this.authOptions.adminSecret) ? {} : { 'X-Hasura-Admin-Secret': this.authOptions.adminSecret }),
2288
- ...(isNil(this.authOptions.authRole)
2498
+ ...(isNil(this.authOptions?.authToken) ? {} : { Authorization: this.authOptions?.authToken }),
2499
+ ...(isNil(this.authOptions?.adminSecret) ? {} : { 'X-Hasura-Admin-Secret': this.authOptions?.adminSecret }),
2500
+ ...(isNil(this.authOptions?.authRole)
2289
2501
  ? {}
2290
- : { 'X-Hasura-Role': this.authOptions.authRole.role, 'X-Hasura-User-Id': this.authOptions.authRole.userId }),
2502
+ : {
2503
+ 'X-Hasura-Role': this.authOptions.authRole.role,
2504
+ 'X-Hasura-User-Id': this.authOptions?.authRole?.userId,
2505
+ }),
2291
2506
  };
2292
2507
  }
2293
2508
  async mutation(operation, fields, variables) {
@@ -2299,27 +2514,20 @@ const withHasuraGraphQL = (MixinBase) => {
2299
2514
  return this.fetch(resultQuery);
2300
2515
  }
2301
2516
  async query(operation, fields, variables) {
2302
- const resultQuery = GraphQLFieldHelper.CheckIsGraphQLParams(operation)
2303
- ? query$1(operation.map((option) => ({
2304
- operation: option.operation,
2305
- variables: option.variables,
2306
- fields: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(option.fields),
2307
- })))
2308
- : query$1({
2309
- operation,
2310
- variables,
2311
- fields: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fields),
2312
- });
2313
- return this.fetch(resultQuery);
2517
+ const builded = this.buildHasuraQueryFields({ operation, fields, variables });
2518
+ const interpected = (await this.interceptors?.request?.(builded)) || builded;
2519
+ const resultQuery = query$1(interpected);
2520
+ const result = await this.fetch(resultQuery);
2521
+ return (await this.interceptors?.response?.(result, interpected)) || result;
2314
2522
  }
2315
2523
  async fetch(params) {
2316
2524
  const headers = this.headers;
2317
- const response = await fetch(`${this.endpoint}`, {
2525
+ const { data: result } = await axios({
2526
+ url: `${this.endpoint}`,
2318
2527
  method: 'POST',
2319
- body: JSON.stringify(params),
2528
+ data: params,
2320
2529
  headers,
2321
2530
  });
2322
- const result = await response.json();
2323
2531
  if (!isNil(result.errors))
2324
2532
  throw new Error(JSON.stringify(result.errors));
2325
2533
  return result.data;
@@ -2354,6 +2562,19 @@ const withHasuraGraphQL = (MixinBase) => {
2354
2562
  convertDataToHasura(instance, update = false) {
2355
2563
  return GraphQLFieldHelper.ConvertFieldValueTo(instance, this.fields, update);
2356
2564
  }
2565
+ buildHasuraQueryFields({ operation, fields, variables, }) {
2566
+ return GraphQLFieldHelper.CheckIsGraphQLParams(operation)
2567
+ ? operation.map((option) => ({
2568
+ operation: option.operation,
2569
+ variables: option.variables,
2570
+ fields: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(option.fields),
2571
+ }))
2572
+ : {
2573
+ operation,
2574
+ variables,
2575
+ fields: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fields),
2576
+ };
2577
+ }
2357
2578
  };
2358
2579
  };
2359
2580
 
@@ -2448,8 +2669,9 @@ const withGetHasuraGraphQL = (MixinBase) => {
2448
2669
 
2449
2670
  const withFindHasuraGraphQL = (MixinBase) => {
2450
2671
  return class FindHasuraGraphQLMixin extends MixinBase {
2451
- async find(options) {
2452
- const { filters, limits, orderBy } = options || {};
2672
+ async find(params) {
2673
+ const { filters, limits, orderBy, options } = params || {};
2674
+ const enableCount = options?.enableCount ?? true;
2453
2675
  const variablesCount = {
2454
2676
  ...(isNil(orderBy) ? {} : { order_by: { type: `${this.tableName}_order_by!`, list: true, value: orderBy } }),
2455
2677
  ...(isNil(filters)
@@ -2469,23 +2691,26 @@ const withFindHasuraGraphQL = (MixinBase) => {
2469
2691
  const result = await this.query([
2470
2692
  {
2471
2693
  operation: this.tableName,
2472
- fields: options.fields
2473
- ? options.fields
2694
+ fields: params.fields
2695
+ ? params.fields
2474
2696
  .map((fieldName) => this.fields.find((fieldOption) => fieldOption === fieldName) ??
2475
2697
  this.fields.find((fieldOption) => Object.keys(fieldOption).shift() === fieldName))
2476
2698
  .filter(Boolean)
2477
2699
  : this.fields,
2478
2700
  variables,
2479
2701
  },
2480
- {
2481
- operation: `${this.tableName}_aggregate`,
2482
- fields: [{ aggregate: ['count'] }],
2483
- variables: variablesCount,
2484
- },
2702
+ ...(enableCount
2703
+ ? [
2704
+ {
2705
+ operation: `${this.tableName}_aggregate`,
2706
+ fields: [{ aggregate: ['count'] }],
2707
+ variables: variablesCount,
2708
+ },
2709
+ ]
2710
+ : []),
2485
2711
  ]);
2486
2712
  const data = result[this.tableName].map((row) => this.convertDataFromHasura(row));
2487
- const count = result[`${this.tableName}_aggregate`].aggregate.count;
2488
- return { count, data };
2713
+ return { data, count: enableCount ? result[`${this.tableName}_aggregate`].aggregate.count : Infinity };
2489
2714
  }
2490
2715
  };
2491
2716
  };
@@ -2524,13 +2749,67 @@ class VariantHasuraGraphQL extends Variant {
2524
2749
  }
2525
2750
  }
2526
2751
 
2752
+ class CategoryFilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
2753
+ constructor({ endpoint, authOptions, interceptors, }) {
2754
+ super({
2755
+ tableName: 'category_filter',
2756
+ model: CategoryFilter,
2757
+ endpoint,
2758
+ authOptions,
2759
+ interceptors,
2760
+ fields: [
2761
+ 'id',
2762
+ { filterId: { columnName: 'filter_id' } },
2763
+ { categoryId: { columnName: 'category_id' } },
2764
+ {
2765
+ filter: {
2766
+ columnName: 'filter',
2767
+ foreignKeyColumn: { id: 'filterId' },
2768
+ fields: [
2769
+ 'id',
2770
+ 'description',
2771
+ 'slug',
2772
+ 'enabled',
2773
+ { createdAt: { columnName: 'created_at' } },
2774
+ { updatedAt: { columnName: 'updated_at' } },
2775
+ {
2776
+ options: {
2777
+ columnName: 'options',
2778
+ foreignKeyColumn: { filterId: 'id' },
2779
+ fields: [
2780
+ 'id',
2781
+ { filterId: { columnName: 'filter_id' } },
2782
+ 'description',
2783
+ { createdAt: { columnName: 'created_at' } },
2784
+ { updatedAt: { columnName: 'updated_at' } },
2785
+ ],
2786
+ },
2787
+ },
2788
+ ],
2789
+ },
2790
+ },
2791
+ ],
2792
+ });
2793
+ }
2794
+ deleteByCategoryAndFilter(categoryId, filterId) {
2795
+ return this.mutation('delete_category_filter', ['affected_rows'], {
2796
+ where: {
2797
+ type: 'category_filter_bool_exp',
2798
+ required: true,
2799
+ value: { category_id: { _eq: categoryId }, filter_id: { _eq: filterId } },
2800
+ },
2801
+ });
2802
+ }
2803
+ }
2804
+
2527
2805
  class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
2528
- constructor(endpoint, authOptions, productRepository) {
2806
+ constructor({ endpoint, authOptions, interceptors, }, productRepository, categoryFilterRepository) {
2529
2807
  super({
2530
2808
  tableName: 'category',
2531
2809
  model: Category,
2532
2810
  endpoint,
2533
2811
  authOptions,
2812
+ interceptors,
2534
2813
  fields: [
2535
2814
  { id: { columnName: 'id', to: (value) => +value, from: (value) => value.toString() } },
2536
2815
  { firestoreId: { columnName: 'firestore_id' } },
@@ -2567,7 +2846,17 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
2567
2846
  },
2568
2847
  },
2569
2848
  },
2570
- 'filters',
2849
+ {
2850
+ filters: {
2851
+ columnName: 'filters',
2852
+ foreignKeyColumn: { filter_id: 'id' },
2853
+ fields: [{ filter: ['id', 'description', 'slug', 'enabled'] }],
2854
+ bindPersistData: (value) => ({
2855
+ filters: { data: value.map((filter) => ({ filter_id: filter.id })) },
2856
+ }),
2857
+ from: (filters) => filters?.map((filter) => filter?.filter) || [],
2858
+ },
2859
+ },
2571
2860
  { createdAt: { columnName: 'created_at' } },
2572
2861
  { updatedAt: { columnName: 'updated_at' } },
2573
2862
  {
@@ -2589,9 +2878,20 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
2589
2878
  }),
2590
2879
  },
2591
2880
  },
2881
+ { isCollection: { columnName: 'is_collection' } },
2882
+ 'reference',
2883
+ { parentId: { columnName: 'parent_id' } },
2884
+ {
2885
+ parent: {
2886
+ columnName: 'parent',
2887
+ foreignKeyColumn: { id: 'parentId' },
2888
+ fields: ['id', 'name', 'reference', 'slug'],
2889
+ },
2890
+ },
2592
2891
  ],
2593
2892
  });
2594
2893
  this.productRepository = productRepository;
2894
+ this.categoryFilterRepository = categoryFilterRepository;
2595
2895
  }
2596
2896
  async create(params) {
2597
2897
  const { metadata, ...data } = params;
@@ -2599,29 +2899,30 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
2599
2899
  }
2600
2900
  async get(identifiers) {
2601
2901
  return Number.isNaN(+identifiers.id)
2602
- ? (await this.find({ filters: { firestoreId: identifiers.id } })).data?.[0]
2902
+ ? (await this.find({ filters: { firestoreId: identifiers.id }, options: { enableCount: false } })).data?.[0]
2603
2903
  : super.get(identifiers);
2604
2904
  }
2605
2905
  async update(params) {
2606
- const { products, id: checkId, metadata, ...data } = params;
2906
+ const { products, id: checkId, metadata, filters, ...data } = params;
2607
2907
  const plainData = this.paramsToPlain({ id: checkId });
2608
2908
  const id = await this.getId(plainData.id);
2609
2909
  const category = await super.update({ id, ...data });
2610
2910
  category.products = products && (await this.updateProducts(+id, { products }));
2611
2911
  category.metadata = metadata && (await this.updateMetadata(+id, { metadata }));
2912
+ category.filters = filters && (await this.updateFilters(+id, { filters }));
2612
2913
  return category;
2613
2914
  }
2614
2915
  async getCategoryBySlug(slug, shop) {
2615
2916
  if (!slug)
2616
2917
  return null;
2617
- const { data, count } = await this.find({ filters: { slug, shop, published: true } });
2618
- if (count > 1)
2619
- throw new DuplicatedResultsError('Query returned duplicated values');
2620
- if (!count)
2918
+ const { data } = await this.find({ filters: { slug, shop, published: true }, options: { enableCount: false } });
2919
+ if (!data.length)
2621
2920
  throw new NotFoundError(`Category with slug ${slug} not found`);
2921
+ if (data.length > 1)
2922
+ throw new DuplicatedResultsError('Query returned duplicated values');
2622
2923
  return data.shift();
2623
2924
  }
2624
- async getCategoriesForHome(categoryIds, limit = 4) {
2925
+ async getCategoriesForHome(categoryIds, limit = 4, gender) {
2625
2926
  if (!categoryIds?.length)
2626
2927
  return [];
2627
2928
  const categoriesFirestore = categoryIds.filter((categoryId) => Number.isNaN(+categoryId));
@@ -2639,7 +2940,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
2639
2940
  return [];
2640
2941
  const homeSections = await Promise.all(categories.map(async (category) => ({
2641
2942
  category,
2642
- products: await this.mountCategory(category, { limit, hasStock: true }),
2943
+ products: await this.mountCategory(category, { limit, hasStock: true, gender }),
2643
2944
  })));
2644
2945
  return homeSections;
2645
2946
  }
@@ -2652,6 +2953,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
2652
2953
  id: { operator: Where.IN, value: category.products },
2653
2954
  published: true,
2654
2955
  ...(options?.hasStock ? { stock: { quantity: { operator: Where.GT, value: 0 } } } : {}),
2956
+ ...(options?.gender ? { tags: { operator: Where.IN, value: [options?.gender] } } : {}),
2655
2957
  },
2656
2958
  fields: [
2657
2959
  'id',
@@ -2677,8 +2979,11 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
2677
2979
  'tags',
2678
2980
  'type',
2679
2981
  'shoppingCount',
2982
+ 'gender',
2983
+ 'createdAt',
2680
2984
  ],
2681
2985
  ...(options?.limit ? { limits: { limit: options?.limit } } : {}),
2986
+ options: { enableCount: false },
2682
2987
  });
2683
2988
  products.push(...productsData);
2684
2989
  return products;
@@ -2686,7 +2991,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
2686
2991
  async getId(id) {
2687
2992
  if (!Number.isNaN(+id))
2688
2993
  return id;
2689
- const { data } = await this.find({ filters: { firestoreId: id } });
2994
+ const { data } = await this.find({ filters: { firestoreId: id }, options: { enableCount: false } });
2690
2995
  if (data?.[0]?.id)
2691
2996
  return data?.[0]?.id;
2692
2997
  throw new NotFoundError(`Category with id ${id} not found`);
@@ -2739,15 +3044,204 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
2739
3044
  });
2740
3045
  return plainData.metadata;
2741
3046
  }
3047
+ async updateFilters(categoryId, { filters }) {
3048
+ if ('action' in filters && filters.action === 'remove' && filters.value.length) {
3049
+ for (let i = 0; i < filters.value.length; i++) {
3050
+ await this.categoryFilterRepository.deleteByCategoryAndFilter(categoryId, filters.value[i].id);
3051
+ }
3052
+ return [];
3053
+ }
3054
+ if ('action' in filters && filters.action === 'merge' && filters.value.length) {
3055
+ let filtersList = [];
3056
+ for (let i = 0; i < filters.value.length; i++) {
3057
+ try {
3058
+ const hasFilter = await this.categoryFilterRepository
3059
+ .find({
3060
+ filters: {
3061
+ categoryId,
3062
+ filterId: filters.value[i].id,
3063
+ },
3064
+ })
3065
+ .then((data) => data.data.shift()?.filter);
3066
+ if (hasFilter) {
3067
+ filtersList.push(hasFilter);
3068
+ }
3069
+ else {
3070
+ await this.categoryFilterRepository.create({
3071
+ filterId: filters.value[i].id,
3072
+ categoryId,
3073
+ });
3074
+ filtersList.push(filters.value[i]);
3075
+ }
3076
+ }
3077
+ catch (error) {
3078
+ console.log('catch error: ', error);
3079
+ }
3080
+ }
3081
+ return filtersList;
3082
+ }
3083
+ if (Array.isArray(filters) && filters.length) {
3084
+ let filtersList = [];
3085
+ for (let i = 0; i < filters.length; i++) {
3086
+ try {
3087
+ const hasFilter = await this.categoryFilterRepository
3088
+ .find({
3089
+ filters: {
3090
+ categoryId,
3091
+ filterId: filters[i].id,
3092
+ },
3093
+ })
3094
+ .then((data) => data.data.shift()?.filter);
3095
+ if (hasFilter) {
3096
+ filtersList.push(hasFilter);
3097
+ }
3098
+ else {
3099
+ await this.categoryFilterRepository.create({
3100
+ filterId: filters[i].id,
3101
+ categoryId,
3102
+ });
3103
+ filtersList.push(filters[i]);
3104
+ }
3105
+ }
3106
+ catch (error) {
3107
+ console.log('catch error: ', error);
3108
+ }
3109
+ }
3110
+ return filtersList;
3111
+ }
3112
+ return [];
3113
+ }
3114
+ }
3115
+
3116
+ class FilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
3117
+ constructor({ endpoint, authOptions, interceptors, }, filterOptionRepository, categoryFilterRepository) {
3118
+ super({
3119
+ tableName: 'filter',
3120
+ model: Filter,
3121
+ endpoint,
3122
+ authOptions,
3123
+ interceptors,
3124
+ fields: [
3125
+ 'id',
3126
+ 'description',
3127
+ 'slug',
3128
+ 'enabled',
3129
+ { createdAt: { columnName: 'created_at' } },
3130
+ { updatedAt: { columnName: 'updated_at' } },
3131
+ {
3132
+ options: {
3133
+ columnName: 'options',
3134
+ foreignKeyColumn: { filterId: 'id' },
3135
+ fields: [
3136
+ 'id',
3137
+ { filterId: { columnName: 'filter_id' } },
3138
+ 'description',
3139
+ { createdAt: { columnName: 'created_at' } },
3140
+ { updatedAt: { columnName: 'updated_at' } },
3141
+ ],
3142
+ },
3143
+ },
3144
+ ],
3145
+ });
3146
+ this.filterOptionRepository = filterOptionRepository;
3147
+ this.categoryFilterRepository = categoryFilterRepository;
3148
+ }
3149
+ async update(params) {
3150
+ const { options, ...data } = params;
3151
+ const filter = await super.update(data);
3152
+ filter.options = await this.updateOptions(+data.id, { options });
3153
+ return filter;
3154
+ }
3155
+ async updateOptions(filterId, { options }) {
3156
+ if (!options)
3157
+ return [];
3158
+ if ('action' in options && options.action === 'remove' && options.value.length) {
3159
+ for (let i = 0; i < options.value.length; i++) {
3160
+ await this.filterOptionRepository.delete({ id: options.value[i].id });
3161
+ }
3162
+ return [];
3163
+ }
3164
+ if ('action' in options && options.action === 'merge' && options.value.length) {
3165
+ let filterOptions = [];
3166
+ for (let i = 0; i < options.value.length; i++) {
3167
+ try {
3168
+ const hasFilter = await this.filterOptionRepository.get({ id: options.value[i].id });
3169
+ if (hasFilter)
3170
+ filterOptions.push(hasFilter);
3171
+ }
3172
+ catch (error) {
3173
+ const newOption = await this.filterOptionRepository.create({ ...options.value[i], filterId });
3174
+ filterOptions.push(newOption);
3175
+ }
3176
+ }
3177
+ return filterOptions;
3178
+ }
3179
+ if (Array.isArray(options) && options.length) {
3180
+ let filterOptions = [];
3181
+ for (let i = 0; i < options.length; i++) {
3182
+ try {
3183
+ const hasFilter = await this.filterOptionRepository.get({ id: options[i].id });
3184
+ if (hasFilter)
3185
+ filterOptions.push(hasFilter);
3186
+ }
3187
+ catch (error) {
3188
+ const newOption = await this.filterOptionRepository.create({ ...options[i], filterId });
3189
+ filterOptions.push(newOption);
3190
+ }
3191
+ }
3192
+ }
3193
+ return [];
3194
+ }
3195
+ async delete(params) {
3196
+ const { data: categoryFilters } = await this.categoryFilterRepository.find({
3197
+ filters: {
3198
+ filterId: params.id,
3199
+ },
3200
+ });
3201
+ if (categoryFilters.length)
3202
+ throw new Error('Erro: o filtro está associado a uma ou mais categoria(s)');
3203
+ await this.deleteOptions(+params.id);
3204
+ await super.delete({ id: +params.id });
3205
+ return;
3206
+ }
3207
+ async deleteOptions(filterId) {
3208
+ await this.mutation('delete_filter_option', ['affected_rows'], {
3209
+ where: {
3210
+ type: 'filter_option_bool_exp',
3211
+ required: true,
3212
+ value: { filter_id: { _eq: filterId } },
3213
+ },
3214
+ });
3215
+ }
3216
+ }
3217
+
3218
+ class FilterOptionHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
3219
+ constructor({ endpoint, authOptions, interceptors, }) {
3220
+ super({
3221
+ tableName: 'filter_option',
3222
+ model: FilterOption,
3223
+ endpoint,
3224
+ authOptions,
3225
+ interceptors,
3226
+ fields: [
3227
+ 'id',
3228
+ 'description',
3229
+ { filterId: { columnName: 'filter_id' } },
3230
+ { createdAt: { columnName: 'created_at' } },
3231
+ { updatedAt: { columnName: 'updated_at' } },
3232
+ ],
3233
+ });
3234
+ }
2742
3235
  }
2743
3236
 
2744
3237
  class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
2745
- constructor(endpoint, authOptions) {
3238
+ constructor({ endpoint, authOptions, interceptors, }) {
2746
3239
  super({
2747
3240
  tableName: 'product',
2748
3241
  model: ProductHasuraGraphQL,
2749
3242
  endpoint,
2750
3243
  authOptions,
3244
+ interceptors,
2751
3245
  fields: [],
2752
3246
  });
2753
3247
  this.bindReviewToModel = (plain) => ({
@@ -2876,21 +3370,21 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
2876
3370
  'weight',
2877
3371
  'gender',
2878
3372
  { tags: { columnName: 'tags', type: HasuraGraphQLColumnType.Jsonb } },
3373
+ { filters: { columnName: 'filters', type: HasuraGraphQLColumnType.Jsonb } },
2879
3374
  { isKit: { columnName: 'is_kit' } },
2880
3375
  { createdAt: { columnName: 'created_at' } },
2881
3376
  { updatedAt: { columnName: 'updated_at' } },
3377
+ { rate: { columnName: 'rating' } },
3378
+ { reviewsTotal: { columnName: 'reviews_total' } },
3379
+ { shoppingCount: { columnName: 'shopping_count' } },
3380
+ { categoryId: { columnName: 'category_id' } },
2882
3381
  {
2883
- rate: {
2884
- columnName: 'reviews_aggregate',
2885
- filters: {
2886
- filters: { status: true },
2887
- filterType: 'product_review_bool_exp',
2888
- },
2889
- fields: [{ aggregate: [{ avg: ['rate'] }] }],
2890
- from: (value) => value.aggregate.avg.rate,
3382
+ category: {
3383
+ columnName: 'category',
3384
+ foreignKeyColumn: { id: 'categoryId' },
3385
+ fields: ['id', 'name', 'reference', 'slug'],
2891
3386
  },
2892
3387
  },
2893
- { shoppingCount: { columnName: 'shopping_count' } },
2894
3388
  ];
2895
3389
  this.fields = [
2896
3390
  ...commonFields,
@@ -2967,7 +3461,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
2967
3461
  }
2968
3462
  async get(identifiers) {
2969
3463
  const product = Number.isNaN(+identifiers.id)
2970
- ? (await this.find({ filters: { firestoreId: identifiers.id } })).data?.[0]
3464
+ ? (await this.find({ filters: { firestoreId: identifiers.id }, options: { enableCount: false } })).data?.[0]
2971
3465
  : await super.get(identifiers);
2972
3466
  if (product.productId)
2973
3467
  throw new NotFoundError('Product not found, it is a variant');
@@ -2983,7 +3477,16 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
2983
3477
  return super.find({
2984
3478
  ...options,
2985
3479
  filters: { ...filters, productId: { operator: Where.ISNULL } },
2986
- fields: bindFields,
3480
+ fields: [
3481
+ ...bindFields,
3482
+ ...(bindFields.includes('price')
3483
+ ? [
3484
+ 'subscriberPrice',
3485
+ 'subscriberDiscountPercentage',
3486
+ 'fullPrice',
3487
+ ]
3488
+ : []),
3489
+ ],
2987
3490
  });
2988
3491
  }
2989
3492
  async getBySlug(slug) {
@@ -2991,9 +3494,12 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
2991
3494
  filters: {
2992
3495
  slug,
2993
3496
  },
3497
+ fields: this.fields.map((field) => typeof field === 'string' ? field : Object.keys(field).shift()),
3498
+ options: {
3499
+ enableCount: false,
3500
+ },
2994
3501
  });
2995
3502
  const product = result?.data?.shift();
2996
- product.reviews = await this.findReviewsByProduct(+product.id);
2997
3503
  return product;
2998
3504
  }
2999
3505
  async update(params) {
@@ -3143,7 +3649,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
3143
3649
  async getId(id) {
3144
3650
  if (!Number.isNaN(+id))
3145
3651
  return id;
3146
- const { data } = await this.find({ filters: { firestoreId: id } });
3652
+ const { data } = await this.find({ filters: { firestoreId: id }, options: { enableCount: false } });
3147
3653
  if (data?.[0]?.id)
3148
3654
  return data?.[0]?.id;
3149
3655
  throw new NotFoundError(`Product with id ${id} not found`);
@@ -3199,15 +3705,29 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
3199
3705
  });
3200
3706
  return data && data[0] && this.bindReviewToModel(data[0]);
3201
3707
  }
3708
+ async cleanShoppingCountFromIds(ids) {
3709
+ return await this.mutation('update_product', ['affected_rows'], {
3710
+ where: {
3711
+ value: { id: { _nin: ids } },
3712
+ type: 'product_bool_exp',
3713
+ required: true,
3714
+ },
3715
+ _set: {
3716
+ value: { shopping_count: 0 },
3717
+ type: 'product_set_input',
3718
+ },
3719
+ });
3720
+ }
3202
3721
  }
3203
3722
 
3204
3723
  class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
3205
- constructor(endpoint, authOptions) {
3724
+ constructor({ endpoint, authOptions, interceptors, }) {
3206
3725
  super({
3207
3726
  tableName: 'product',
3208
3727
  model: VariantHasuraGraphQL,
3209
3728
  endpoint,
3210
3729
  authOptions,
3730
+ interceptors,
3211
3731
  fields: [
3212
3732
  { id: { columnName: 'id', to: (value) => +value, from: (value) => value.toString() } },
3213
3733
  { firestoreId: { columnName: 'firestore_id' } },
@@ -3243,12 +3763,12 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
3243
3763
  };
3244
3764
  },
3245
3765
  bindPersistData: (priceData) => ({
3246
- ...(priceData?.price >= 0 && { price: priceData.price }),
3247
- ...(priceData.fullPrice >= 0 && { full_price: priceData.fullPrice }),
3248
- ...(priceData.subscriberDiscountPercentage >= 0 && {
3766
+ ...((priceData?.price || 0) >= 0 && { price: priceData.price }),
3767
+ ...((priceData?.fullPrice || 0) >= 0 && { full_price: priceData.fullPrice }),
3768
+ ...((priceData?.subscriberDiscountPercentage || 0) >= 0 && {
3249
3769
  subscriber_discount_percentage: priceData.subscriberDiscountPercentage,
3250
3770
  }),
3251
- ...(priceData.subscriberPrice >= 0 && { subscriber_price: priceData.subscriberPrice }),
3771
+ ...((priceData?.subscriberPrice || 0) >= 0 && { subscriber_price: priceData.subscriberPrice }),
3252
3772
  }),
3253
3773
  },
3254
3774
  },
@@ -3300,7 +3820,7 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
3300
3820
  async getId(id) {
3301
3821
  if (!Number.isNaN(+id))
3302
3822
  return id;
3303
- const { data } = await this.find({ filters: { firestoreId: id } });
3823
+ const { data } = await this.find({ filters: { firestoreId: id }, options: { enableCount: false } });
3304
3824
  if (data?.[0]?.id)
3305
3825
  return data?.[0]?.id;
3306
3826
  throw new NotFoundError(`Product with id ${id} not found`);
@@ -3311,5 +3831,5 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
3311
3831
  * Generated bundle index. Do not edit.
3312
3832
  */
3313
3833
 
3314
- 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, chunk, get, is, isBoolean, isDate, isEmpty, isInteger, isNaN$1 as isNaN, isNil, isNumber, isObject, isString, isUUID, now, omit, parseDateTime, pick, set, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
3834
+ 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 };
3315
3835
  //# sourceMappingURL=infrab4a-connect.mjs.map