@infrab4a/connect 0.9.9 → 0.9.11-beta.0

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 (408) hide show
  1. package/README.md +24 -24
  2. package/bundles/infrab4a-connect.umd.js +1861 -1845
  3. package/bundles/infrab4a-connect.umd.js.map +1 -1
  4. package/esm2015/infrab4a-connect.js +4 -4
  5. package/esm2015/lib/domain/catalog/index.js +3 -3
  6. package/esm2015/lib/domain/catalog/models/category.js +7 -7
  7. package/esm2015/lib/domain/catalog/models/enums/index.js +2 -2
  8. package/esm2015/lib/domain/catalog/models/enums/shops.enum.js +6 -6
  9. package/esm2015/lib/domain/catalog/models/index.js +6 -6
  10. package/esm2015/lib/domain/catalog/models/product.js +11 -11
  11. package/esm2015/lib/domain/catalog/models/types/category-condition.type.js +2 -2
  12. package/esm2015/lib/domain/catalog/models/types/category-filter.type.js +2 -2
  13. package/esm2015/lib/domain/catalog/models/types/index.js +8 -8
  14. package/esm2015/lib/domain/catalog/models/types/product-review.type.js +2 -2
  15. package/esm2015/lib/domain/catalog/models/types/shops-description.type.js +2 -2
  16. package/esm2015/lib/domain/catalog/models/types/shops-price.type.js +2 -2
  17. package/esm2015/lib/domain/catalog/models/types/stock.type.js +2 -2
  18. package/esm2015/lib/domain/catalog/models/types/variant-grade.type.js +2 -2
  19. package/esm2015/lib/domain/catalog/models/variant.js +7 -7
  20. package/esm2015/lib/domain/catalog/repositories/category.repository.js +2 -2
  21. package/esm2015/lib/domain/catalog/repositories/index.js +4 -4
  22. package/esm2015/lib/domain/catalog/repositories/product.repository.js +2 -2
  23. package/esm2015/lib/domain/catalog/repositories/variant.repository.js +2 -2
  24. package/esm2015/lib/domain/general/index.js +3 -3
  25. package/esm2015/lib/domain/general/model/base-model-with-identifier-fields.js +2 -2
  26. package/esm2015/lib/domain/general/model/base.model.js +13 -13
  27. package/esm2015/lib/domain/general/model/identifier-fields.js +2 -2
  28. package/esm2015/lib/domain/general/model/index.js +5 -5
  29. package/esm2015/lib/domain/general/model/types/base-model-builder.type.js +2 -2
  30. package/esm2015/lib/domain/general/model/types/index.js +4 -4
  31. package/esm2015/lib/domain/general/model/types/non-function-properties.type.js +2 -2
  32. package/esm2015/lib/domain/general/model/types/non-function-property-name.type.js +2 -2
  33. package/esm2015/lib/domain/general/repository/create.repository.js +2 -2
  34. package/esm2015/lib/domain/general/repository/crud.repository.js +2 -2
  35. package/esm2015/lib/domain/general/repository/delete.repository.js +2 -2
  36. package/esm2015/lib/domain/general/repository/enums/index.js +3 -3
  37. package/esm2015/lib/domain/general/repository/enums/update-option-actions.enum.js +9 -9
  38. package/esm2015/lib/domain/general/repository/enums/where.enum.js +11 -11
  39. package/esm2015/lib/domain/general/repository/find.repository.js +2 -2
  40. package/esm2015/lib/domain/general/repository/get.repository.js +2 -2
  41. package/esm2015/lib/domain/general/repository/index.js +10 -10
  42. package/esm2015/lib/domain/general/repository/read.repository.js +2 -2
  43. package/esm2015/lib/domain/general/repository/types/index.js +6 -6
  44. package/esm2015/lib/domain/general/repository/types/repository-find-filters.type.js +2 -2
  45. package/esm2015/lib/domain/general/repository/types/repository-find-result.type.js +2 -2
  46. package/esm2015/lib/domain/general/repository/types/repository-limit-options.type.js +2 -2
  47. package/esm2015/lib/domain/general/repository/types/repository-order-by-list.type.js +2 -2
  48. package/esm2015/lib/domain/general/repository/types/repository-update-params.type.js +2 -2
  49. package/esm2015/lib/domain/general/repository/update.repository.js +2 -2
  50. package/esm2015/lib/domain/index.js +7 -7
  51. package/esm2015/lib/domain/location/index.js +2 -2
  52. package/esm2015/lib/domain/location/models/address.js +4 -4
  53. package/esm2015/lib/domain/location/models/index.js +3 -3
  54. package/esm2015/lib/domain/location/models/types/index.js +4 -4
  55. package/esm2015/lib/domain/location/models/types/location-bound.type.js +2 -2
  56. package/esm2015/lib/domain/location/models/types/location-geometry.type.js +2 -2
  57. package/esm2015/lib/domain/location/models/types/location-lat-lng.type.js +2 -2
  58. package/esm2015/lib/domain/shop-settings/index.js +3 -3
  59. package/esm2015/lib/domain/shop-settings/models/home.js +7 -7
  60. package/esm2015/lib/domain/shop-settings/models/index.js +4 -4
  61. package/esm2015/lib/domain/shop-settings/models/shop-menu.js +7 -7
  62. package/esm2015/lib/domain/shop-settings/models/types/banner.type.js +2 -2
  63. package/esm2015/lib/domain/shop-settings/models/types/benefit.type.js +2 -2
  64. package/esm2015/lib/domain/shop-settings/models/types/index.js +5 -5
  65. package/esm2015/lib/domain/shop-settings/models/types/menu-nav.type.js +2 -2
  66. package/esm2015/lib/domain/shop-settings/models/types/sub-menu.type.js +2 -2
  67. package/esm2015/lib/domain/shop-settings/repositories/home.repository.js +2 -2
  68. package/esm2015/lib/domain/shop-settings/repositories/index.js +3 -3
  69. package/esm2015/lib/domain/shop-settings/repositories/shop-menu.repository.js +2 -2
  70. package/esm2015/lib/domain/shopping/index.js +3 -3
  71. package/esm2015/lib/domain/shopping/models/buy-2-win.js +14 -14
  72. package/esm2015/lib/domain/shopping/models/checkout.js +38 -38
  73. package/esm2015/lib/domain/shopping/models/coupons/coupon.js +23 -23
  74. package/esm2015/lib/domain/shopping/models/coupons/enums/coupon-subtypes.enum.js +6 -6
  75. package/esm2015/lib/domain/shopping/models/coupons/enums/coupon-types.enum.js +8 -8
  76. package/esm2015/lib/domain/shopping/models/coupons/enums/exclusivities.enum.js +7 -7
  77. package/esm2015/lib/domain/shopping/models/coupons/enums/index.js +4 -4
  78. package/esm2015/lib/domain/shopping/models/coupons/financial-coupon.js +28 -28
  79. package/esm2015/lib/domain/shopping/models/coupons/index.js +4 -4
  80. package/esm2015/lib/domain/shopping/models/enums/checkout-types.enum.js +6 -6
  81. package/esm2015/lib/domain/shopping/models/enums/index.js +3 -3
  82. package/esm2015/lib/domain/shopping/models/enums/order-status.enum.js +12 -12
  83. package/esm2015/lib/domain/shopping/models/index.js +12 -12
  84. package/esm2015/lib/domain/shopping/models/line-item.js +4 -4
  85. package/esm2015/lib/domain/shopping/models/order.js +11 -11
  86. package/esm2015/lib/domain/shopping/models/payment.js +169 -169
  87. package/esm2015/lib/domain/shopping/models/shipping-method.js +7 -7
  88. package/esm2015/lib/domain/shopping/models/subscription/checkout.js +28 -28
  89. package/esm2015/lib/domain/shopping/models/subscription/index.js +3 -3
  90. package/esm2015/lib/domain/shopping/models/subscription/plan.js +7 -7
  91. package/esm2015/lib/domain/shopping/models/types/index.js +8 -8
  92. package/esm2015/lib/domain/shopping/models/types/payment-address.type.js +2 -2
  93. package/esm2015/lib/domain/shopping/models/types/payment-billing.type.js +2 -2
  94. package/esm2015/lib/domain/shopping/models/types/payment-card.type.js +2 -2
  95. package/esm2015/lib/domain/shopping/models/types/payment-customer.type.js +2 -2
  96. package/esm2015/lib/domain/shopping/models/types/payment-document.type.js +2 -2
  97. package/esm2015/lib/domain/shopping/models/types/payment-item.type.js +2 -2
  98. package/esm2015/lib/domain/shopping/models/types/payment-shipping.type.js +2 -2
  99. package/esm2015/lib/domain/shopping/repositories/buy-2-win.repository.js +2 -2
  100. package/esm2015/lib/domain/shopping/repositories/checkout.repository.js +2 -2
  101. package/esm2015/lib/domain/shopping/repositories/coupon.repository.js +2 -2
  102. package/esm2015/lib/domain/shopping/repositories/index.js +8 -8
  103. package/esm2015/lib/domain/shopping/repositories/legacy-order.repository.js +2 -2
  104. package/esm2015/lib/domain/shopping/repositories/order.repository.js +2 -2
  105. package/esm2015/lib/domain/shopping/repositories/payment.repository.js +2 -2
  106. package/esm2015/lib/domain/shopping/repositories/subscription/checkout.repository.js +2 -2
  107. package/esm2015/lib/domain/shopping/repositories/subscription/index.js +3 -3
  108. package/esm2015/lib/domain/shopping/repositories/subscription/plan.repository.js +2 -2
  109. package/esm2015/lib/domain/users/errors/index.js +2 -2
  110. package/esm2015/lib/domain/users/errors/unauthorized.error.js +7 -7
  111. package/esm2015/lib/domain/users/index.js +6 -6
  112. package/esm2015/lib/domain/users/models/beauty-profile.js +12 -12
  113. package/esm2015/lib/domain/users/models/enums/area.enum.js +13 -13
  114. package/esm2015/lib/domain/users/models/enums/beard-sizes.enum.js +9 -9
  115. package/esm2015/lib/domain/users/models/enums/hair-types.enum.js +9 -9
  116. package/esm2015/lib/domain/users/models/enums/index.js +7 -7
  117. package/esm2015/lib/domain/users/models/enums/office-position.enum.js +8 -8
  118. package/esm2015/lib/domain/users/models/enums/user-type.enum.js +10 -10
  119. package/esm2015/lib/domain/users/models/index.js +8 -8
  120. package/esm2015/lib/domain/users/models/lead.js +7 -7
  121. package/esm2015/lib/domain/users/models/subscription/edition.js +7 -7
  122. package/esm2015/lib/domain/users/models/subscription/enums/billing-status.enum.js +5 -5
  123. package/esm2015/lib/domain/users/models/subscription/enums/edition-status.enum.js +5 -5
  124. package/esm2015/lib/domain/users/models/subscription/enums/index.js +5 -5
  125. package/esm2015/lib/domain/users/models/subscription/enums/payment-type.enum.js +7 -7
  126. package/esm2015/lib/domain/users/models/subscription/enums/status.enum.js +5 -5
  127. package/esm2015/lib/domain/users/models/subscription/index.js +5 -5
  128. package/esm2015/lib/domain/users/models/subscription/payment.js +14 -14
  129. package/esm2015/lib/domain/users/models/subscription/subscription.js +43 -43
  130. package/esm2015/lib/domain/users/models/user-address.js +7 -7
  131. package/esm2015/lib/domain/users/models/user-payment-method.js +7 -7
  132. package/esm2015/lib/domain/users/models/user.js +26 -26
  133. package/esm2015/lib/domain/users/repositories/beauty-profile.repository.js +2 -2
  134. package/esm2015/lib/domain/users/repositories/edition.repository.js +2 -2
  135. package/esm2015/lib/domain/users/repositories/index.js +9 -9
  136. package/esm2015/lib/domain/users/repositories/lead.repository.js +2 -2
  137. package/esm2015/lib/domain/users/repositories/subscription-payment.repository.js +2 -2
  138. package/esm2015/lib/domain/users/repositories/subscription.repository.js +2 -2
  139. package/esm2015/lib/domain/users/repositories/user-address.repository.js +2 -2
  140. package/esm2015/lib/domain/users/repositories/user-payment-method.repository.js +2 -2
  141. package/esm2015/lib/domain/users/repositories/user.repository.js +2 -2
  142. package/esm2015/lib/domain/users/services/authentication.service.js +2 -2
  143. package/esm2015/lib/domain/users/services/index.js +2 -2
  144. package/esm2015/lib/domain/users/use-cases/authentication.js +40 -40
  145. package/esm2015/lib/domain/users/use-cases/index.js +3 -3
  146. package/esm2015/lib/domain/users/use-cases/signout.js +12 -12
  147. package/esm2015/lib/errors/duplicated-results.error.js +7 -7
  148. package/esm2015/lib/errors/index.js +5 -5
  149. package/esm2015/lib/errors/invalid-argument.error.js +7 -7
  150. package/esm2015/lib/errors/not-found.error.js +7 -7
  151. package/esm2015/lib/errors/required-argument.error.js +8 -8
  152. package/esm2015/lib/index.js +5 -5
  153. package/esm2015/lib/infra/firebase/auth/authentication-firebase-auth.service.js +33 -27
  154. package/esm2015/lib/infra/firebase/auth/index.js +2 -2
  155. package/esm2015/lib/infra/firebase/firestore/index.js +4 -4
  156. package/esm2015/lib/infra/firebase/firestore/mixins/index.js +10 -10
  157. package/esm2015/lib/infra/firebase/firestore/mixins/with-create-firestore.mixin.js +31 -30
  158. package/esm2015/lib/infra/firebase/firestore/mixins/with-crud-firestore.mixin.js +10 -10
  159. package/esm2015/lib/infra/firebase/firestore/mixins/with-delete-firestore.mixin.js +18 -18
  160. package/esm2015/lib/infra/firebase/firestore/mixins/with-find-firestore.mixin.js +76 -74
  161. package/esm2015/lib/infra/firebase/firestore/mixins/with-firestore.mixin.js +26 -26
  162. package/esm2015/lib/infra/firebase/firestore/mixins/with-get-firestore.mixin.js +24 -24
  163. package/esm2015/lib/infra/firebase/firestore/mixins/with-helpers.mixin.js +17 -17
  164. package/esm2015/lib/infra/firebase/firestore/mixins/with-sub-collection.mixin.js +11 -11
  165. package/esm2015/lib/infra/firebase/firestore/mixins/with-update-firestore.mixin.js +45 -45
  166. package/esm2015/lib/infra/firebase/firestore/repositories/catalog/category-firestore.repository.js +78 -78
  167. package/esm2015/lib/infra/firebase/firestore/repositories/catalog/index.js +4 -4
  168. package/esm2015/lib/infra/firebase/firestore/repositories/catalog/product-firestore.repository.js +23 -23
  169. package/esm2015/lib/infra/firebase/firestore/repositories/catalog/product-variant-firestore.repository.js +14 -14
  170. package/esm2015/lib/infra/firebase/firestore/repositories/index.js +5 -5
  171. package/esm2015/lib/infra/firebase/firestore/repositories/shop-settings/home-firestore.repository.js +12 -12
  172. package/esm2015/lib/infra/firebase/firestore/repositories/shop-settings/index.js +3 -3
  173. package/esm2015/lib/infra/firebase/firestore/repositories/shop-settings/shop-menu-firestore.repository.js +12 -12
  174. package/esm2015/lib/infra/firebase/firestore/repositories/shopping/buy-2-win-firestore.repository.js +12 -12
  175. package/esm2015/lib/infra/firebase/firestore/repositories/shopping/checkout-firestore.repository.js +12 -12
  176. package/esm2015/lib/infra/firebase/firestore/repositories/shopping/checkout-subscription-firestore.repository.js +12 -12
  177. package/esm2015/lib/infra/firebase/firestore/repositories/shopping/coupon-firestore.repository.js +12 -12
  178. package/esm2015/lib/infra/firebase/firestore/repositories/shopping/index.js +9 -9
  179. package/esm2015/lib/infra/firebase/firestore/repositories/shopping/legacy-order-firestore.repository.js +9 -9
  180. package/esm2015/lib/infra/firebase/firestore/repositories/shopping/order-firestore.repository.js +12 -12
  181. package/esm2015/lib/infra/firebase/firestore/repositories/shopping/payment-firestore.repository.js +12 -12
  182. package/esm2015/lib/infra/firebase/firestore/repositories/shopping/subscription-plan-firestore.repository.js +12 -12
  183. package/esm2015/lib/infra/firebase/firestore/repositories/users/index.js +9 -9
  184. package/esm2015/lib/infra/firebase/firestore/repositories/users/lead-firestore.repository.js +12 -12
  185. package/esm2015/lib/infra/firebase/firestore/repositories/users/subscription-edition-firestore.repository.js +14 -14
  186. package/esm2015/lib/infra/firebase/firestore/repositories/users/subscription-firestore.repository.js +12 -12
  187. package/esm2015/lib/infra/firebase/firestore/repositories/users/subscription-payment-firestore.repository.js +14 -14
  188. package/esm2015/lib/infra/firebase/firestore/repositories/users/user-address-firestore.repository.js +14 -14
  189. package/esm2015/lib/infra/firebase/firestore/repositories/users/user-beauty-profile-firestore.repository.js +14 -14
  190. package/esm2015/lib/infra/firebase/firestore/repositories/users/user-firestore.repository.js +62 -62
  191. package/esm2015/lib/infra/firebase/firestore/repositories/users/user-payment-method-firestore.repository.js +14 -14
  192. package/esm2015/lib/infra/firebase/firestore/types/firestore-sub.repository.type.js +2 -2
  193. package/esm2015/lib/infra/firebase/firestore/types/firestore.helpers.type.js +2 -2
  194. package/esm2015/lib/infra/firebase/firestore/types/firestore.repository.type.js +2 -2
  195. package/esm2015/lib/infra/firebase/firestore/types/index.js +4 -4
  196. package/esm2015/lib/infra/firebase/index.js +3 -3
  197. package/esm2015/lib/infra/index.js +2 -2
  198. package/esm2015/lib/utils/index.js +5 -5
  199. package/esm2015/lib/utils/mixins/base.mixin.js +6 -6
  200. package/esm2015/lib/utils/mixins/index.js +3 -3
  201. package/esm2015/lib/utils/mixins/mixin-ctor.type.js +2 -2
  202. package/esm2015/lib/utils/types/index.js +2 -2
  203. package/esm2015/lib/utils/types/prop.type.js +2 -2
  204. package/esm2015/public-api.js +3 -3
  205. package/fesm2015/infrab4a-connect.js +1097 -1088
  206. package/fesm2015/infrab4a-connect.js.map +1 -1
  207. package/infrab4a-connect.d.ts +5 -5
  208. package/lib/domain/catalog/index.d.ts +2 -2
  209. package/lib/domain/catalog/models/category.d.ts +22 -22
  210. package/lib/domain/catalog/models/enums/index.d.ts +1 -1
  211. package/lib/domain/catalog/models/enums/shops.enum.d.ts +4 -4
  212. package/lib/domain/catalog/models/index.d.ts +5 -5
  213. package/lib/domain/catalog/models/product.d.ts +33 -33
  214. package/lib/domain/catalog/models/types/category-condition.type.d.ts +4 -4
  215. package/lib/domain/catalog/models/types/category-filter.type.d.ts +4 -4
  216. package/lib/domain/catalog/models/types/index.d.ts +7 -7
  217. package/lib/domain/catalog/models/types/product-review.type.d.ts +12 -12
  218. package/lib/domain/catalog/models/types/shops-description.type.d.ts +7 -7
  219. package/lib/domain/catalog/models/types/shops-price.type.d.ts +10 -10
  220. package/lib/domain/catalog/models/types/stock.type.d.ts +3 -3
  221. package/lib/domain/catalog/models/types/variant-grade.type.d.ts +4 -4
  222. package/lib/domain/catalog/models/variant.d.ts +14 -14
  223. package/lib/domain/catalog/repositories/category.repository.d.ts +12 -12
  224. package/lib/domain/catalog/repositories/index.d.ts +3 -3
  225. package/lib/domain/catalog/repositories/product.repository.d.ts +5 -5
  226. package/lib/domain/catalog/repositories/variant.repository.d.ts +4 -4
  227. package/lib/domain/general/index.d.ts +2 -2
  228. package/lib/domain/general/model/base-model-with-identifier-fields.d.ts +3 -3
  229. package/lib/domain/general/model/base.model.d.ts +6 -6
  230. package/lib/domain/general/model/identifier-fields.d.ts +4 -4
  231. package/lib/domain/general/model/index.d.ts +4 -4
  232. package/lib/domain/general/model/types/base-model-builder.type.d.ts +5 -5
  233. package/lib/domain/general/model/types/index.d.ts +3 -3
  234. package/lib/domain/general/model/types/non-function-properties.type.d.ts +2 -2
  235. package/lib/domain/general/model/types/non-function-property-name.type.d.ts +3 -3
  236. package/lib/domain/general/repository/create.repository.d.ts +5 -5
  237. package/lib/domain/general/repository/crud.repository.d.ts +7 -7
  238. package/lib/domain/general/repository/delete.repository.d.ts +5 -5
  239. package/lib/domain/general/repository/enums/index.d.ts +2 -2
  240. package/lib/domain/general/repository/enums/update-option-actions.enum.d.ts +7 -7
  241. package/lib/domain/general/repository/enums/where.enum.d.ts +9 -9
  242. package/lib/domain/general/repository/find.repository.d.ts +5 -5
  243. package/lib/domain/general/repository/get.repository.d.ts +5 -5
  244. package/lib/domain/general/repository/index.d.ts +9 -9
  245. package/lib/domain/general/repository/read.repository.d.ts +5 -5
  246. package/lib/domain/general/repository/types/index.d.ts +5 -5
  247. package/lib/domain/general/repository/types/repository-find-filters.type.d.ts +14 -14
  248. package/lib/domain/general/repository/types/repository-find-result.type.d.ts +4 -4
  249. package/lib/domain/general/repository/types/repository-limit-options.type.d.ts +4 -4
  250. package/lib/domain/general/repository/types/repository-order-by-list.type.d.ts +5 -5
  251. package/lib/domain/general/repository/types/repository-update-params.type.d.ts +11 -11
  252. package/lib/domain/general/repository/update.repository.d.ts +5 -5
  253. package/lib/domain/index.d.ts +6 -6
  254. package/lib/domain/location/index.d.ts +1 -1
  255. package/lib/domain/location/models/address.d.ts +21 -21
  256. package/lib/domain/location/models/index.d.ts +2 -2
  257. package/lib/domain/location/models/types/index.d.ts +3 -3
  258. package/lib/domain/location/models/types/location-bound.type.d.ts +6 -6
  259. package/lib/domain/location/models/types/location-geometry.type.d.ts +7 -7
  260. package/lib/domain/location/models/types/location-lat-lng.type.d.ts +4 -4
  261. package/lib/domain/shop-settings/index.d.ts +2 -2
  262. package/lib/domain/shop-settings/models/home.d.ts +17 -17
  263. package/lib/domain/shop-settings/models/index.d.ts +3 -3
  264. package/lib/domain/shop-settings/models/shop-menu.d.ts +7 -7
  265. package/lib/domain/shop-settings/models/types/banner.type.d.ts +6 -6
  266. package/lib/domain/shop-settings/models/types/benefit.type.d.ts +5 -5
  267. package/lib/domain/shop-settings/models/types/index.d.ts +4 -4
  268. package/lib/domain/shop-settings/models/types/menu-nav.type.d.ts +8 -8
  269. package/lib/domain/shop-settings/models/types/sub-menu.type.d.ts +8 -8
  270. package/lib/domain/shop-settings/repositories/home.repository.d.ts +4 -4
  271. package/lib/domain/shop-settings/repositories/index.d.ts +2 -2
  272. package/lib/domain/shop-settings/repositories/shop-menu.repository.d.ts +4 -4
  273. package/lib/domain/shopping/index.d.ts +2 -2
  274. package/lib/domain/shopping/models/buy-2-win.d.ts +18 -18
  275. package/lib/domain/shopping/models/checkout.d.ts +28 -28
  276. package/lib/domain/shopping/models/coupons/coupon.d.ts +28 -28
  277. package/lib/domain/shopping/models/coupons/enums/coupon-subtypes.enum.d.ts +4 -4
  278. package/lib/domain/shopping/models/coupons/enums/coupon-types.enum.d.ts +6 -6
  279. package/lib/domain/shopping/models/coupons/enums/exclusivities.enum.d.ts +5 -5
  280. package/lib/domain/shopping/models/coupons/enums/index.d.ts +3 -3
  281. package/lib/domain/shopping/models/coupons/financial-coupon.d.ts +8 -8
  282. package/lib/domain/shopping/models/coupons/index.d.ts +3 -3
  283. package/lib/domain/shopping/models/enums/checkout-types.enum.d.ts +4 -4
  284. package/lib/domain/shopping/models/enums/index.d.ts +2 -2
  285. package/lib/domain/shopping/models/enums/order-status.enum.d.ts +10 -10
  286. package/lib/domain/shopping/models/index.d.ts +11 -11
  287. package/lib/domain/shopping/models/line-item.d.ts +8 -8
  288. package/lib/domain/shopping/models/order.d.ts +9 -9
  289. package/lib/domain/shopping/models/payment.d.ts +69 -69
  290. package/lib/domain/shopping/models/shipping-method.d.ts +18 -18
  291. package/lib/domain/shopping/models/subscription/checkout.d.ts +23 -23
  292. package/lib/domain/shopping/models/subscription/index.d.ts +2 -2
  293. package/lib/domain/shopping/models/subscription/plan.d.ts +12 -12
  294. package/lib/domain/shopping/models/types/index.d.ts +7 -7
  295. package/lib/domain/shopping/models/types/payment-address.type.d.ts +12 -12
  296. package/lib/domain/shopping/models/types/payment-billing.type.d.ts +7 -7
  297. package/lib/domain/shopping/models/types/payment-card.type.d.ts +14 -14
  298. package/lib/domain/shopping/models/types/payment-customer.type.d.ts +18 -18
  299. package/lib/domain/shopping/models/types/payment-document.type.d.ts +6 -6
  300. package/lib/domain/shopping/models/types/payment-item.type.d.ts +11 -11
  301. package/lib/domain/shopping/models/types/payment-shipping.type.d.ts +10 -10
  302. package/lib/domain/shopping/repositories/buy-2-win.repository.d.ts +4 -4
  303. package/lib/domain/shopping/repositories/checkout.repository.d.ts +4 -4
  304. package/lib/domain/shopping/repositories/coupon.repository.d.ts +4 -4
  305. package/lib/domain/shopping/repositories/index.d.ts +7 -7
  306. package/lib/domain/shopping/repositories/legacy-order.repository.d.ts +3 -3
  307. package/lib/domain/shopping/repositories/order.repository.d.ts +4 -4
  308. package/lib/domain/shopping/repositories/payment.repository.d.ts +4 -4
  309. package/lib/domain/shopping/repositories/subscription/checkout.repository.d.ts +4 -4
  310. package/lib/domain/shopping/repositories/subscription/index.d.ts +2 -2
  311. package/lib/domain/shopping/repositories/subscription/plan.repository.d.ts +4 -4
  312. package/lib/domain/users/errors/index.d.ts +1 -1
  313. package/lib/domain/users/errors/unauthorized.error.d.ts +4 -4
  314. package/lib/domain/users/index.d.ts +5 -5
  315. package/lib/domain/users/models/beauty-profile.d.ts +12 -12
  316. package/lib/domain/users/models/enums/area.enum.d.ts +11 -11
  317. package/lib/domain/users/models/enums/beard-sizes.enum.d.ts +7 -7
  318. package/lib/domain/users/models/enums/hair-types.enum.d.ts +7 -7
  319. package/lib/domain/users/models/enums/index.d.ts +6 -6
  320. package/lib/domain/users/models/enums/office-position.enum.d.ts +6 -6
  321. package/lib/domain/users/models/enums/user-type.enum.d.ts +8 -8
  322. package/lib/domain/users/models/index.d.ts +7 -7
  323. package/lib/domain/users/models/lead.d.ts +9 -9
  324. package/lib/domain/users/models/subscription/edition.d.ts +15 -15
  325. package/lib/domain/users/models/subscription/enums/billing-status.enum.d.ts +3 -3
  326. package/lib/domain/users/models/subscription/enums/edition-status.enum.d.ts +3 -3
  327. package/lib/domain/users/models/subscription/enums/index.d.ts +4 -4
  328. package/lib/domain/users/models/subscription/enums/payment-type.enum.d.ts +5 -5
  329. package/lib/domain/users/models/subscription/enums/status.enum.d.ts +3 -3
  330. package/lib/domain/users/models/subscription/index.d.ts +4 -4
  331. package/lib/domain/users/models/subscription/payment.d.ts +14 -14
  332. package/lib/domain/users/models/subscription/subscription.d.ts +30 -30
  333. package/lib/domain/users/models/user-address.d.ts +7 -7
  334. package/lib/domain/users/models/user-payment-method.d.ts +13 -13
  335. package/lib/domain/users/models/user.d.ts +24 -24
  336. package/lib/domain/users/repositories/beauty-profile.repository.d.ts +4 -4
  337. package/lib/domain/users/repositories/edition.repository.d.ts +4 -4
  338. package/lib/domain/users/repositories/index.d.ts +8 -8
  339. package/lib/domain/users/repositories/lead.repository.d.ts +4 -4
  340. package/lib/domain/users/repositories/subscription-payment.repository.d.ts +4 -4
  341. package/lib/domain/users/repositories/subscription.repository.d.ts +4 -4
  342. package/lib/domain/users/repositories/user-address.repository.d.ts +4 -4
  343. package/lib/domain/users/repositories/user-payment-method.repository.d.ts +4 -4
  344. package/lib/domain/users/repositories/user.repository.d.ts +4 -4
  345. package/lib/domain/users/services/authentication.service.d.ts +12 -10
  346. package/lib/domain/users/services/index.d.ts +1 -1
  347. package/lib/domain/users/use-cases/authentication.d.ts +21 -21
  348. package/lib/domain/users/use-cases/index.d.ts +2 -2
  349. package/lib/domain/users/use-cases/signout.d.ts +6 -6
  350. package/lib/errors/duplicated-results.error.d.ts +4 -4
  351. package/lib/errors/index.d.ts +4 -4
  352. package/lib/errors/invalid-argument.error.d.ts +4 -4
  353. package/lib/errors/not-found.error.d.ts +4 -4
  354. package/lib/errors/required-argument.error.d.ts +5 -5
  355. package/lib/index.d.ts +4 -4
  356. package/lib/infra/firebase/auth/authentication-firebase-auth.service.d.ts +10 -9
  357. package/lib/infra/firebase/auth/index.d.ts +1 -1
  358. package/lib/infra/firebase/firestore/index.d.ts +3 -3
  359. package/lib/infra/firebase/firestore/mixins/index.d.ts +9 -9
  360. package/lib/infra/firebase/firestore/mixins/with-create-firestore.mixin.d.ts +17 -17
  361. package/lib/infra/firebase/firestore/mixins/with-crud-firestore.mixin.d.ts +29 -29
  362. package/lib/infra/firebase/firestore/mixins/with-delete-firestore.mixin.d.ts +15 -15
  363. package/lib/infra/firebase/firestore/mixins/with-find-firestore.mixin.d.ts +20 -20
  364. package/lib/infra/firebase/firestore/mixins/with-firestore.mixin.d.ts +15 -15
  365. package/lib/infra/firebase/firestore/mixins/with-get-firestore.mixin.d.ts +15 -15
  366. package/lib/infra/firebase/firestore/mixins/with-helpers.mixin.d.ts +10 -10
  367. package/lib/infra/firebase/firestore/mixins/with-sub-collection.mixin.d.ts +14 -14
  368. package/lib/infra/firebase/firestore/mixins/with-update-firestore.mixin.d.ts +16 -16
  369. package/lib/infra/firebase/firestore/repositories/catalog/category-firestore.repository.d.ts +55 -55
  370. package/lib/infra/firebase/firestore/repositories/catalog/index.d.ts +3 -3
  371. package/lib/infra/firebase/firestore/repositories/catalog/product-firestore.repository.d.ts +50 -50
  372. package/lib/infra/firebase/firestore/repositories/catalog/product-variant-firestore.repository.d.ts +60 -60
  373. package/lib/infra/firebase/firestore/repositories/index.d.ts +4 -4
  374. package/lib/infra/firebase/firestore/repositories/shop-settings/home-firestore.repository.d.ts +49 -49
  375. package/lib/infra/firebase/firestore/repositories/shop-settings/index.d.ts +2 -2
  376. package/lib/infra/firebase/firestore/repositories/shop-settings/shop-menu-firestore.repository.d.ts +49 -49
  377. package/lib/infra/firebase/firestore/repositories/shopping/buy-2-win-firestore.repository.d.ts +49 -49
  378. package/lib/infra/firebase/firestore/repositories/shopping/checkout-firestore.repository.d.ts +49 -49
  379. package/lib/infra/firebase/firestore/repositories/shopping/checkout-subscription-firestore.repository.d.ts +49 -49
  380. package/lib/infra/firebase/firestore/repositories/shopping/coupon-firestore.repository.d.ts +49 -49
  381. package/lib/infra/firebase/firestore/repositories/shopping/index.d.ts +8 -8
  382. package/lib/infra/firebase/firestore/repositories/shopping/legacy-order-firestore.repository.d.ts +7 -7
  383. package/lib/infra/firebase/firestore/repositories/shopping/order-firestore.repository.d.ts +49 -49
  384. package/lib/infra/firebase/firestore/repositories/shopping/payment-firestore.repository.d.ts +49 -49
  385. package/lib/infra/firebase/firestore/repositories/shopping/subscription-plan-firestore.repository.d.ts +49 -49
  386. package/lib/infra/firebase/firestore/repositories/users/index.d.ts +8 -8
  387. package/lib/infra/firebase/firestore/repositories/users/lead-firestore.repository.d.ts +49 -49
  388. package/lib/infra/firebase/firestore/repositories/users/subscription-edition-firestore.repository.d.ts +60 -60
  389. package/lib/infra/firebase/firestore/repositories/users/subscription-firestore.repository.d.ts +49 -49
  390. package/lib/infra/firebase/firestore/repositories/users/subscription-payment-firestore.repository.d.ts +60 -60
  391. package/lib/infra/firebase/firestore/repositories/users/user-address-firestore.repository.d.ts +60 -60
  392. package/lib/infra/firebase/firestore/repositories/users/user-beauty-profile-firestore.repository.d.ts +60 -60
  393. package/lib/infra/firebase/firestore/repositories/users/user-firestore.repository.d.ts +57 -57
  394. package/lib/infra/firebase/firestore/repositories/users/user-payment-method-firestore.repository.d.ts +60 -60
  395. package/lib/infra/firebase/firestore/types/firestore-sub.repository.type.d.ts +6 -6
  396. package/lib/infra/firebase/firestore/types/firestore.helpers.type.d.ts +8 -8
  397. package/lib/infra/firebase/firestore/types/firestore.repository.type.d.ts +8 -8
  398. package/lib/infra/firebase/firestore/types/index.d.ts +3 -3
  399. package/lib/infra/firebase/index.d.ts +2 -2
  400. package/lib/infra/index.d.ts +1 -1
  401. package/lib/utils/index.d.ts +4 -4
  402. package/lib/utils/mixins/base.mixin.d.ts +3 -3
  403. package/lib/utils/mixins/index.d.ts +2 -2
  404. package/lib/utils/mixins/mixin-ctor.type.d.ts +1 -1
  405. package/lib/utils/types/index.d.ts +1 -1
  406. package/lib/utils/types/prop.type.d.ts +1 -1
  407. package/package.json +1 -1
  408. package/public-api.d.ts +2 -2
@@ -7,1256 +7,1265 @@ import { Md5 } from 'ts-md5';
7
7
  import firebase from 'firebase';
8
8
  import firebase$1 from 'firebase/app';
9
9
 
10
- class BaseModel {
11
- constructor(args) {
12
- Object.assign(this, args);
13
- }
14
- static toInstance(data) {
15
- return plainToClass(this, data);
16
- }
17
- toPlain() {
18
- return classToPlain(this, { exposeUnsetFields: false });
19
- }
10
+ class BaseModel {
11
+ constructor(args) {
12
+ Object.assign(this, args);
13
+ }
14
+ static toInstance(data) {
15
+ return plainToClass(this, data);
16
+ }
17
+ toPlain() {
18
+ return classToPlain(this, { exposeUnsetFields: false });
19
+ }
20
20
  }
21
21
 
22
- var Where;
23
- (function (Where) {
24
- Where["EQUALS"] = "==";
25
- Where["GT"] = ">";
26
- Where["GTE"] = ">=";
27
- Where["IN"] = "in";
28
- Where["LT"] = "<";
29
- Where["LTE"] = "<=";
30
- Where["LIKE"] = "like";
22
+ var Where;
23
+ (function (Where) {
24
+ Where["EQUALS"] = "==";
25
+ Where["GT"] = ">";
26
+ Where["GTE"] = ">=";
27
+ Where["IN"] = "in";
28
+ Where["LT"] = "<";
29
+ Where["LTE"] = "<=";
30
+ Where["LIKE"] = "like";
31
31
  })(Where || (Where = {}));
32
32
 
33
- var UpdateOptionActions;
34
- (function (UpdateOptionActions) {
35
- UpdateOptionActions["UPDATE"] = "update";
36
- UpdateOptionActions["MERGE"] = "merge";
37
- UpdateOptionActions["REMOVE"] = "remove";
38
- UpdateOptionActions["REMOVE_FIELD"] = "removeField";
39
- UpdateOptionActions["NULL"] = "null";
33
+ var UpdateOptionActions;
34
+ (function (UpdateOptionActions) {
35
+ UpdateOptionActions["UPDATE"] = "update";
36
+ UpdateOptionActions["MERGE"] = "merge";
37
+ UpdateOptionActions["REMOVE"] = "remove";
38
+ UpdateOptionActions["REMOVE_FIELD"] = "removeField";
39
+ UpdateOptionActions["NULL"] = "null";
40
40
  })(UpdateOptionActions || (UpdateOptionActions = {}));
41
41
 
42
- var UserType;
43
- (function (UserType) {
44
- UserType["B2C"] = "Cliente Transacional";
45
- UserType["GlamGirl"] = "Glamgirl";
46
- UserType["MensBoy"] = "Mensboy";
47
- UserType["B2B"] = "Company";
48
- UserType["Collaborator"] = "Funcion\u00E1rio";
49
- UserType["Influencer"] = "Influencer";
42
+ var UserType;
43
+ (function (UserType) {
44
+ UserType["B2C"] = "Cliente Transacional";
45
+ UserType["GlamGirl"] = "Glamgirl";
46
+ UserType["MensBoy"] = "Mensboy";
47
+ UserType["B2B"] = "Company";
48
+ UserType["Collaborator"] = "Funcion\u00E1rio";
49
+ UserType["Influencer"] = "Influencer";
50
50
  })(UserType || (UserType = {}));
51
51
 
52
- var BeardSizes;
53
- (function (BeardSizes) {
54
- BeardSizes["BIG"] = "Grande";
55
- BeardSizes["MEDIUM"] = "M\u00E9dia";
56
- BeardSizes["SHORT"] = "Curta";
57
- BeardSizes["MUSTACHE"] = "Bigode";
58
- BeardSizes["NOTHING"] = "Sem Barba";
52
+ var BeardSizes;
53
+ (function (BeardSizes) {
54
+ BeardSizes["BIG"] = "Grande";
55
+ BeardSizes["MEDIUM"] = "M\u00E9dia";
56
+ BeardSizes["SHORT"] = "Curta";
57
+ BeardSizes["MUSTACHE"] = "Bigode";
58
+ BeardSizes["NOTHING"] = "Sem Barba";
59
59
  })(BeardSizes || (BeardSizes = {}));
60
60
 
61
- var HairTypes;
62
- (function (HairTypes) {
63
- HairTypes["Smooth"] = "Liso";
64
- HairTypes["WAVY"] = "Ondulado";
65
- HairTypes["CURLY"] = "Cacheado";
66
- HairTypes["FRIZZY"] = "Crespo";
67
- HairTypes["BALD"] = "Sou careca";
61
+ var HairTypes;
62
+ (function (HairTypes) {
63
+ HairTypes["Smooth"] = "Liso";
64
+ HairTypes["WAVY"] = "Ondulado";
65
+ HairTypes["CURLY"] = "Cacheado";
66
+ HairTypes["FRIZZY"] = "Crespo";
67
+ HairTypes["BALD"] = "Sou careca";
68
68
  })(HairTypes || (HairTypes = {}));
69
69
 
70
- var Area;
71
- (function (Area) {
72
- Area["GP"] = "Geral";
73
- Area["CRM"] = "CRM";
74
- Area["MediaProd"] = "Media Production";
75
- Area["Tech"] = "Tecnologia";
76
- Area["Transactional"] = "Transacional";
77
- Area["Operations"] = "Opera\u00E7\u00F5es";
78
- Area["Sales"] = "Comercial";
79
- Area["Finantial"] = "Financeiro";
80
- Area["HR"] = "RH";
70
+ var Area;
71
+ (function (Area) {
72
+ Area["GP"] = "Geral";
73
+ Area["CRM"] = "CRM";
74
+ Area["MediaProd"] = "Media Production";
75
+ Area["Tech"] = "Tecnologia";
76
+ Area["Transactional"] = "Transacional";
77
+ Area["Operations"] = "Opera\u00E7\u00F5es";
78
+ Area["Sales"] = "Comercial";
79
+ Area["Finantial"] = "Financeiro";
80
+ Area["HR"] = "RH";
81
81
  })(Area || (Area = {}));
82
82
 
83
- var OfficePosition;
84
- (function (OfficePosition) {
85
- OfficePosition["Intern"] = "Estagi\u00E1rio";
86
- OfficePosition["Analyst"] = "Analista";
87
- OfficePosition["Manager"] = "Gerente";
88
- OfficePosition["Director"] = "Diretor";
83
+ var OfficePosition;
84
+ (function (OfficePosition) {
85
+ OfficePosition["Intern"] = "Estagi\u00E1rio";
86
+ OfficePosition["Analyst"] = "Analista";
87
+ OfficePosition["Manager"] = "Gerente";
88
+ OfficePosition["Director"] = "Diretor";
89
89
  })(OfficePosition || (OfficePosition = {}));
90
90
 
91
- var BillingStatus;
92
- (function (BillingStatus) {
93
- BillingStatus["PAYED"] = "PAGO";
91
+ var BillingStatus;
92
+ (function (BillingStatus) {
93
+ BillingStatus["PAYED"] = "PAGO";
94
94
  })(BillingStatus || (BillingStatus = {}));
95
95
 
96
- var EditionStatus;
97
- (function (EditionStatus) {
98
- EditionStatus["ALLOCATION_WAITING"] = "Aguardando aloca\u00E7\u00E3o";
96
+ var EditionStatus;
97
+ (function (EditionStatus) {
98
+ EditionStatus["ALLOCATION_WAITING"] = "Aguardando aloca\u00E7\u00E3o";
99
99
  })(EditionStatus || (EditionStatus = {}));
100
100
 
101
- var PaymentType;
102
- (function (PaymentType) {
103
- PaymentType["AQUISITION"] = "Aquisi\u00E7\u00E3o";
104
- PaymentType["RENEWAL"] = "Renova\u00E7\u00E3o";
105
- PaymentType["FREIGHT"] = "mudan\u00E7a de endere\u00E7o, Frete";
101
+ var PaymentType;
102
+ (function (PaymentType) {
103
+ PaymentType["AQUISITION"] = "Aquisi\u00E7\u00E3o";
104
+ PaymentType["RENEWAL"] = "Renova\u00E7\u00E3o";
105
+ PaymentType["FREIGHT"] = "mudan\u00E7a de endere\u00E7o, Frete";
106
106
  })(PaymentType || (PaymentType = {}));
107
107
 
108
- var Status;
109
- (function (Status) {
110
- Status["ACTIVE"] = "active";
108
+ var Status;
109
+ (function (Status) {
110
+ Status["ACTIVE"] = "active";
111
111
  })(Status || (Status = {}));
112
112
 
113
- class Edition extends BaseModel {
114
- identifierFields() {
115
- return ['id'];
116
- }
113
+ class Edition extends BaseModel {
114
+ identifierFields() {
115
+ return ['id'];
116
+ }
117
117
  }
118
118
 
119
- class Payment extends BaseModel {
120
- identifierFields() {
121
- return ['id'];
122
- }
123
- }
124
- __decorate([
125
- Expose({ name: 'refuse_reason' }),
126
- __metadata("design:type", String)
127
- ], Payment.prototype, "refuseReason", void 0);
128
- __decorate([
129
- Expose({ name: 'status_reason' }),
130
- __metadata("design:type", String)
131
- ], Payment.prototype, "statusReason", void 0);
132
- __decorate([
133
- Expose({ name: 'acquirer_response_code' }),
134
- __metadata("design:type", String)
135
- ], Payment.prototype, "acquirerResponseCode", void 0);
136
- __decorate([
137
- Expose({ name: 'acquirer_name' }),
138
- __metadata("design:type", String)
139
- ], Payment.prototype, "acquirerName", void 0);
140
- __decorate([
141
- Expose({ name: 'acquirer_id' }),
142
- __metadata("design:type", String)
143
- ], Payment.prototype, "acquirerId", void 0);
144
- __decorate([
145
- Expose({ name: 'authorization_code' }),
146
- __metadata("design:type", String)
147
- ], Payment.prototype, "authorizationCode", void 0);
148
- __decorate([
149
- Expose({ name: 'soft_descriptor' }),
150
- __metadata("design:type", String)
151
- ], Payment.prototype, "softDescriptor", void 0);
152
- __decorate([
153
- Expose({ name: 'date_created' }),
154
- __metadata("design:type", String)
155
- ], Payment.prototype, "dateCreated", void 0);
156
- __decorate([
157
- Expose({ name: 'date_updated' }),
158
- __metadata("design:type", String)
159
- ], Payment.prototype, "dateUpdated", void 0);
160
- __decorate([
161
- Expose({ name: 'authorized_amount' }),
162
- __metadata("design:type", Number)
163
- ], Payment.prototype, "authorizedAmount", void 0);
164
- __decorate([
165
- Expose({ name: 'paid_amount' }),
166
- __metadata("design:type", Number)
167
- ], Payment.prototype, "paidAmount", void 0);
168
- __decorate([
169
- Expose({ name: 'refunded_amount' }),
170
- __metadata("design:type", Number)
171
- ], Payment.prototype, "refundedAmount", void 0);
172
- __decorate([
173
- Expose({ name: 'card_holder_name' }),
174
- __metadata("design:type", String)
175
- ], Payment.prototype, "cardHolderName", void 0);
176
- __decorate([
177
- Expose({ name: 'card_last_digits' }),
178
- __metadata("design:type", String)
179
- ], Payment.prototype, "cardLastDigits", void 0);
180
- __decorate([
181
- Expose({ name: 'card_first_digits' }),
182
- __metadata("design:type", String)
183
- ], Payment.prototype, "cardFirstDigits", void 0);
184
- __decorate([
185
- Expose({ name: 'card_brand' }),
186
- __metadata("design:type", String)
187
- ], Payment.prototype, "cardBrand", void 0);
188
- __decorate([
189
- Expose({ name: 'card_pin_mode' }),
190
- __metadata("design:type", String)
191
- ], Payment.prototype, "cardPinMode", void 0);
192
- __decorate([
193
- Expose({ name: 'card_magstripe_fallback' }),
194
- __metadata("design:type", Boolean)
195
- ], Payment.prototype, "cardMagstripeFallback", void 0);
196
- __decorate([
197
- Expose({ name: 'cvm_pin' }),
198
- __metadata("design:type", Boolean)
199
- ], Payment.prototype, "cvmPin", void 0);
200
- __decorate([
201
- Expose({ name: 'postback_url' }),
202
- __metadata("design:type", String)
203
- ], Payment.prototype, "postbackUrl", void 0);
204
- __decorate([
205
- Expose({ name: 'payment_method' }),
206
- __metadata("design:type", String)
207
- ], Payment.prototype, "paymentMethod", void 0);
208
- __decorate([
209
- Expose({ name: 'capture_method' }),
210
- __metadata("design:type", String)
211
- ], Payment.prototype, "captureMethod", void 0);
212
- __decorate([
213
- Expose({ name: 'antifraud_score' }),
214
- __metadata("design:type", String)
215
- ], Payment.prototype, "antifraudScore", void 0);
216
- __decorate([
217
- Expose({ name: 'boleto_url' }),
218
- __metadata("design:type", String)
219
- ], Payment.prototype, "boletoUrl", void 0);
220
- __decorate([
221
- Expose({ name: 'boleto_barcode' }),
222
- __metadata("design:type", String)
223
- ], Payment.prototype, "boletoBarcode", void 0);
224
- __decorate([
225
- Expose({ name: 'boleto_expiration_date' }),
226
- __metadata("design:type", String)
227
- ], Payment.prototype, "boletoExpirationDate", void 0);
228
- __decorate([
229
- Expose({ name: 'subscription_id' }),
230
- __metadata("design:type", String)
231
- ], Payment.prototype, "subscriptionId", void 0);
232
- __decorate([
233
- Expose({ name: 'split_rules' }),
234
- __metadata("design:type", String)
235
- ], Payment.prototype, "splitRules", void 0);
236
- __decorate([
237
- Expose({ name: 'antifraud_metadata' }),
238
- __metadata("design:type", Object)
239
- ], Payment.prototype, "antifraudMetadata", void 0);
240
- __decorate([
241
- Expose({ name: 'reference_key' }),
242
- __metadata("design:type", String)
243
- ], Payment.prototype, "referenceKey", void 0);
244
- __decorate([
245
- Expose({ name: 'local_transaction_id' }),
246
- __metadata("design:type", String)
247
- ], Payment.prototype, "localTransactionId", void 0);
248
- __decorate([
249
- Expose({ name: 'local_time' }),
250
- __metadata("design:type", String)
251
- ], Payment.prototype, "localTime", void 0);
252
- __decorate([
253
- Expose({ name: 'fraud_covered' }),
254
- __metadata("design:type", Boolean)
255
- ], Payment.prototype, "fraudCovered", void 0);
256
- __decorate([
257
- Expose({ name: 'fraud_reimbursed' }),
258
- __metadata("design:type", String)
259
- ], Payment.prototype, "fraudReimbursed", void 0);
260
- __decorate([
261
- Expose({ name: 'order_id' }),
262
- __metadata("design:type", String)
263
- ], Payment.prototype, "orderId", void 0);
264
- __decorate([
265
- Expose({ name: 'risk_level' }),
266
- __metadata("design:type", String)
267
- ], Payment.prototype, "riskLevel", void 0);
268
- __decorate([
269
- Expose({ name: 'receipt_url' }),
270
- __metadata("design:type", String)
271
- ], Payment.prototype, "receiptUrl", void 0);
272
- __decorate([
273
- Expose({ name: 'private_label' }),
274
- __metadata("design:type", String)
275
- ], Payment.prototype, "privateLabel", void 0);
276
- __decorate([
277
- Expose({ name: 'pix_qr_code' }),
278
- __metadata("design:type", String)
279
- ], Payment.prototype, "pixQrCode", void 0);
280
- __decorate([
281
- Expose({ name: 'pix_expiration_date' }),
282
- __metadata("design:type", String)
119
+ class Payment extends BaseModel {
120
+ identifierFields() {
121
+ return ['id'];
122
+ }
123
+ }
124
+ __decorate([
125
+ Expose({ name: 'refuse_reason' }),
126
+ __metadata("design:type", String)
127
+ ], Payment.prototype, "refuseReason", void 0);
128
+ __decorate([
129
+ Expose({ name: 'status_reason' }),
130
+ __metadata("design:type", String)
131
+ ], Payment.prototype, "statusReason", void 0);
132
+ __decorate([
133
+ Expose({ name: 'acquirer_response_code' }),
134
+ __metadata("design:type", String)
135
+ ], Payment.prototype, "acquirerResponseCode", void 0);
136
+ __decorate([
137
+ Expose({ name: 'acquirer_name' }),
138
+ __metadata("design:type", String)
139
+ ], Payment.prototype, "acquirerName", void 0);
140
+ __decorate([
141
+ Expose({ name: 'acquirer_id' }),
142
+ __metadata("design:type", String)
143
+ ], Payment.prototype, "acquirerId", void 0);
144
+ __decorate([
145
+ Expose({ name: 'authorization_code' }),
146
+ __metadata("design:type", String)
147
+ ], Payment.prototype, "authorizationCode", void 0);
148
+ __decorate([
149
+ Expose({ name: 'soft_descriptor' }),
150
+ __metadata("design:type", String)
151
+ ], Payment.prototype, "softDescriptor", void 0);
152
+ __decorate([
153
+ Expose({ name: 'date_created' }),
154
+ __metadata("design:type", String)
155
+ ], Payment.prototype, "dateCreated", void 0);
156
+ __decorate([
157
+ Expose({ name: 'date_updated' }),
158
+ __metadata("design:type", String)
159
+ ], Payment.prototype, "dateUpdated", void 0);
160
+ __decorate([
161
+ Expose({ name: 'authorized_amount' }),
162
+ __metadata("design:type", Number)
163
+ ], Payment.prototype, "authorizedAmount", void 0);
164
+ __decorate([
165
+ Expose({ name: 'paid_amount' }),
166
+ __metadata("design:type", Number)
167
+ ], Payment.prototype, "paidAmount", void 0);
168
+ __decorate([
169
+ Expose({ name: 'refunded_amount' }),
170
+ __metadata("design:type", Number)
171
+ ], Payment.prototype, "refundedAmount", void 0);
172
+ __decorate([
173
+ Expose({ name: 'card_holder_name' }),
174
+ __metadata("design:type", String)
175
+ ], Payment.prototype, "cardHolderName", void 0);
176
+ __decorate([
177
+ Expose({ name: 'card_last_digits' }),
178
+ __metadata("design:type", String)
179
+ ], Payment.prototype, "cardLastDigits", void 0);
180
+ __decorate([
181
+ Expose({ name: 'card_first_digits' }),
182
+ __metadata("design:type", String)
183
+ ], Payment.prototype, "cardFirstDigits", void 0);
184
+ __decorate([
185
+ Expose({ name: 'card_brand' }),
186
+ __metadata("design:type", String)
187
+ ], Payment.prototype, "cardBrand", void 0);
188
+ __decorate([
189
+ Expose({ name: 'card_pin_mode' }),
190
+ __metadata("design:type", String)
191
+ ], Payment.prototype, "cardPinMode", void 0);
192
+ __decorate([
193
+ Expose({ name: 'card_magstripe_fallback' }),
194
+ __metadata("design:type", Boolean)
195
+ ], Payment.prototype, "cardMagstripeFallback", void 0);
196
+ __decorate([
197
+ Expose({ name: 'cvm_pin' }),
198
+ __metadata("design:type", Boolean)
199
+ ], Payment.prototype, "cvmPin", void 0);
200
+ __decorate([
201
+ Expose({ name: 'postback_url' }),
202
+ __metadata("design:type", String)
203
+ ], Payment.prototype, "postbackUrl", void 0);
204
+ __decorate([
205
+ Expose({ name: 'payment_method' }),
206
+ __metadata("design:type", String)
207
+ ], Payment.prototype, "paymentMethod", void 0);
208
+ __decorate([
209
+ Expose({ name: 'capture_method' }),
210
+ __metadata("design:type", String)
211
+ ], Payment.prototype, "captureMethod", void 0);
212
+ __decorate([
213
+ Expose({ name: 'antifraud_score' }),
214
+ __metadata("design:type", String)
215
+ ], Payment.prototype, "antifraudScore", void 0);
216
+ __decorate([
217
+ Expose({ name: 'boleto_url' }),
218
+ __metadata("design:type", String)
219
+ ], Payment.prototype, "boletoUrl", void 0);
220
+ __decorate([
221
+ Expose({ name: 'boleto_barcode' }),
222
+ __metadata("design:type", String)
223
+ ], Payment.prototype, "boletoBarcode", void 0);
224
+ __decorate([
225
+ Expose({ name: 'boleto_expiration_date' }),
226
+ __metadata("design:type", String)
227
+ ], Payment.prototype, "boletoExpirationDate", void 0);
228
+ __decorate([
229
+ Expose({ name: 'subscription_id' }),
230
+ __metadata("design:type", String)
231
+ ], Payment.prototype, "subscriptionId", void 0);
232
+ __decorate([
233
+ Expose({ name: 'split_rules' }),
234
+ __metadata("design:type", String)
235
+ ], Payment.prototype, "splitRules", void 0);
236
+ __decorate([
237
+ Expose({ name: 'antifraud_metadata' }),
238
+ __metadata("design:type", Object)
239
+ ], Payment.prototype, "antifraudMetadata", void 0);
240
+ __decorate([
241
+ Expose({ name: 'reference_key' }),
242
+ __metadata("design:type", String)
243
+ ], Payment.prototype, "referenceKey", void 0);
244
+ __decorate([
245
+ Expose({ name: 'local_transaction_id' }),
246
+ __metadata("design:type", String)
247
+ ], Payment.prototype, "localTransactionId", void 0);
248
+ __decorate([
249
+ Expose({ name: 'local_time' }),
250
+ __metadata("design:type", String)
251
+ ], Payment.prototype, "localTime", void 0);
252
+ __decorate([
253
+ Expose({ name: 'fraud_covered' }),
254
+ __metadata("design:type", Boolean)
255
+ ], Payment.prototype, "fraudCovered", void 0);
256
+ __decorate([
257
+ Expose({ name: 'fraud_reimbursed' }),
258
+ __metadata("design:type", String)
259
+ ], Payment.prototype, "fraudReimbursed", void 0);
260
+ __decorate([
261
+ Expose({ name: 'order_id' }),
262
+ __metadata("design:type", String)
263
+ ], Payment.prototype, "orderId", void 0);
264
+ __decorate([
265
+ Expose({ name: 'risk_level' }),
266
+ __metadata("design:type", String)
267
+ ], Payment.prototype, "riskLevel", void 0);
268
+ __decorate([
269
+ Expose({ name: 'receipt_url' }),
270
+ __metadata("design:type", String)
271
+ ], Payment.prototype, "receiptUrl", void 0);
272
+ __decorate([
273
+ Expose({ name: 'private_label' }),
274
+ __metadata("design:type", String)
275
+ ], Payment.prototype, "privateLabel", void 0);
276
+ __decorate([
277
+ Expose({ name: 'pix_qr_code' }),
278
+ __metadata("design:type", String)
279
+ ], Payment.prototype, "pixQrCode", void 0);
280
+ __decorate([
281
+ Expose({ name: 'pix_expiration_date' }),
282
+ __metadata("design:type", String)
283
283
  ], Payment.prototype, "pixExpirationDate", void 0);
284
284
 
285
- class SubscriptionPayment extends BaseModel {
286
- identifierFields() {
287
- return ['id'];
288
- }
289
- }
290
- __decorate([
291
- Type(() => Payment),
292
- __metadata("design:type", Payment)
285
+ class SubscriptionPayment extends BaseModel {
286
+ identifierFields() {
287
+ return ['id'];
288
+ }
289
+ }
290
+ __decorate([
291
+ Type(() => Payment),
292
+ __metadata("design:type", Payment)
293
293
  ], SubscriptionPayment.prototype, "payment", void 0);
294
294
 
295
- class Address extends BaseModel {
295
+ class Address extends BaseModel {
296
296
  }
297
297
 
298
- var CheckoutTypes;
299
- (function (CheckoutTypes) {
300
- CheckoutTypes[CheckoutTypes["ECOMMERCE"] = 1] = "ECOMMERCE";
301
- CheckoutTypes[CheckoutTypes["SUBSCRIPTION"] = 2] = "SUBSCRIPTION";
298
+ var CheckoutTypes;
299
+ (function (CheckoutTypes) {
300
+ CheckoutTypes[CheckoutTypes["ECOMMERCE"] = 1] = "ECOMMERCE";
301
+ CheckoutTypes[CheckoutTypes["SUBSCRIPTION"] = 2] = "SUBSCRIPTION";
302
302
  })(CheckoutTypes || (CheckoutTypes = {}));
303
303
 
304
- class Base {
305
- constructor(...args) {
306
- Object.assign(this, ...args);
307
- }
304
+ class Base {
305
+ constructor(...args) {
306
+ Object.assign(this, ...args);
307
+ }
308
308
  }
309
309
 
310
- var CouponTypes;
311
- (function (CouponTypes) {
312
- CouponTypes[CouponTypes["FINANCIAL"] = 1] = "FINANCIAL";
313
- CouponTypes[CouponTypes["PRODUCT"] = 2] = "PRODUCT";
314
- CouponTypes[CouponTypes["GIFTCARD"] = 3] = "GIFTCARD";
315
- CouponTypes[CouponTypes["VOUCHER"] = 4] = "VOUCHER";
310
+ var CouponTypes;
311
+ (function (CouponTypes) {
312
+ CouponTypes[CouponTypes["FINANCIAL"] = 1] = "FINANCIAL";
313
+ CouponTypes[CouponTypes["PRODUCT"] = 2] = "PRODUCT";
314
+ CouponTypes[CouponTypes["GIFTCARD"] = 3] = "GIFTCARD";
315
+ CouponTypes[CouponTypes["VOUCHER"] = 4] = "VOUCHER";
316
316
  })(CouponTypes || (CouponTypes = {}));
317
317
 
318
- var CouponSubtypes;
319
- (function (CouponSubtypes) {
320
- CouponSubtypes[CouponSubtypes["ABSOLUTE"] = 1] = "ABSOLUTE";
321
- CouponSubtypes[CouponSubtypes["PERCENTAGE"] = 2] = "PERCENTAGE";
318
+ var CouponSubtypes;
319
+ (function (CouponSubtypes) {
320
+ CouponSubtypes[CouponSubtypes["ABSOLUTE"] = 1] = "ABSOLUTE";
321
+ CouponSubtypes[CouponSubtypes["PERCENTAGE"] = 2] = "PERCENTAGE";
322
322
  })(CouponSubtypes || (CouponSubtypes = {}));
323
323
 
324
- var Exclusivities;
325
- (function (Exclusivities) {
326
- Exclusivities[Exclusivities["ALL_USERS"] = 1] = "ALL_USERS";
327
- Exclusivities[Exclusivities["SPECIFIC_USER"] = 2] = "SPECIFIC_USER";
328
- Exclusivities[Exclusivities["COLLABORATORS"] = 3] = "COLLABORATORS";
324
+ var Exclusivities;
325
+ (function (Exclusivities) {
326
+ Exclusivities[Exclusivities["ALL_USERS"] = 1] = "ALL_USERS";
327
+ Exclusivities[Exclusivities["SPECIFIC_USER"] = 2] = "SPECIFIC_USER";
328
+ Exclusivities[Exclusivities["COLLABORATORS"] = 3] = "COLLABORATORS";
329
329
  })(Exclusivities || (Exclusivities = {}));
330
330
 
331
- class Coupon extends BaseModel {
332
- get isInfluencer() {
333
- return !isNil(this.influencerEmail);
334
- }
335
- identifierFields() {
336
- return ['id'];
337
- }
338
- }
339
- __decorate([
340
- Expose({ name: 'checkout_type' }),
341
- __metadata("design:type", Number)
342
- ], Coupon.prototype, "checkoutType", void 0);
343
- __decorate([
344
- Expose({ name: 'exclusivity_type' }),
345
- __metadata("design:type", Number)
331
+ class Coupon extends BaseModel {
332
+ get isInfluencer() {
333
+ return !isNil(this.influencerEmail);
334
+ }
335
+ identifierFields() {
336
+ return ['id'];
337
+ }
338
+ }
339
+ __decorate([
340
+ Expose({ name: 'checkout_type' }),
341
+ __metadata("design:type", Number)
342
+ ], Coupon.prototype, "checkoutType", void 0);
343
+ __decorate([
344
+ Expose({ name: 'exclusivity_type' }),
345
+ __metadata("design:type", Number)
346
346
  ], Coupon.prototype, "exclusivityType", void 0);
347
347
 
348
- class SubscriptionPlan extends BaseModel {
349
- identifierFields() {
350
- return ['id'];
351
- }
348
+ class SubscriptionPlan extends BaseModel {
349
+ identifierFields() {
350
+ return ['id'];
351
+ }
352
352
  }
353
353
 
354
- class BeautyProfile extends BaseModel {
355
- toPlain() {
356
- const plain = super.toPlain();
357
- delete plain.id;
358
- return plain;
359
- }
360
- identifierFields() {
361
- return ['id'];
362
- }
354
+ class BeautyProfile extends BaseModel {
355
+ toPlain() {
356
+ const plain = super.toPlain();
357
+ delete plain.id;
358
+ return plain;
359
+ }
360
+ identifierFields() {
361
+ return ['id'];
362
+ }
363
363
  }
364
364
 
365
- class User extends BaseModel {
366
- static toInstance(data) {
367
- const instance = super.toInstance(data);
368
- if (!isNil(data.firstName))
369
- instance.displayName = `${data.firstName}${!isNil(data.lastName) ? ` ${data.lastName}` : ''}`;
370
- return instance;
371
- }
372
- identifierFields() {
373
- return ['id'];
374
- }
375
- toPlain() {
376
- const plain = super.toPlain();
377
- delete plain.beautyProfile;
378
- return plain;
379
- }
380
- }
381
- __decorate([
382
- Type(() => BeautyProfile),
383
- __metadata("design:type", BeautyProfile)
365
+ class User extends BaseModel {
366
+ static toInstance(data) {
367
+ const instance = super.toInstance(data);
368
+ if (!isNil(data.firstName))
369
+ instance.displayName = `${data.firstName}${!isNil(data.lastName) ? ` ${data.lastName}` : ''}`;
370
+ return instance;
371
+ }
372
+ identifierFields() {
373
+ return ['id'];
374
+ }
375
+ toPlain() {
376
+ const plain = super.toPlain();
377
+ delete plain.beautyProfile;
378
+ return plain;
379
+ }
380
+ }
381
+ __decorate([
382
+ Type(() => BeautyProfile),
383
+ __metadata("design:type", BeautyProfile)
384
384
  ], User.prototype, "beautyProfile", void 0);
385
385
 
386
- class Subscription extends BaseModel {
387
- identifierFields() {
388
- return ['id'];
389
- }
390
- }
391
- __decorate([
392
- Type(() => User),
393
- __metadata("design:type", User)
394
- ], Subscription.prototype, "user", void 0);
395
- __decorate([
396
- Type(() => SubscriptionPlan),
397
- __metadata("design:type", SubscriptionPlan)
398
- ], Subscription.prototype, "subscriptionPlan", void 0);
399
- __decorate([
400
- Type(() => Address),
401
- __metadata("design:type", Address)
402
- ], Subscription.prototype, "shippingAddress", void 0);
403
- __decorate([
404
- Type(() => Address),
405
- __metadata("design:type", Address)
406
- ], Subscription.prototype, "billingAddress", void 0);
407
- __decorate([
408
- Type(() => Coupon),
409
- __metadata("design:type", Coupon)
410
- ], Subscription.prototype, "coupon", void 0);
411
- __decorate([
412
- Type(() => Edition),
413
- __metadata("design:type", Array)
414
- ], Subscription.prototype, "editions", void 0);
415
- __decorate([
416
- Type(() => SubscriptionPayment),
417
- __metadata("design:type", Array)
386
+ class Subscription extends BaseModel {
387
+ identifierFields() {
388
+ return ['id'];
389
+ }
390
+ }
391
+ __decorate([
392
+ Type(() => User),
393
+ __metadata("design:type", User)
394
+ ], Subscription.prototype, "user", void 0);
395
+ __decorate([
396
+ Type(() => SubscriptionPlan),
397
+ __metadata("design:type", SubscriptionPlan)
398
+ ], Subscription.prototype, "subscriptionPlan", void 0);
399
+ __decorate([
400
+ Type(() => Address),
401
+ __metadata("design:type", Address)
402
+ ], Subscription.prototype, "shippingAddress", void 0);
403
+ __decorate([
404
+ Type(() => Address),
405
+ __metadata("design:type", Address)
406
+ ], Subscription.prototype, "billingAddress", void 0);
407
+ __decorate([
408
+ Type(() => Coupon),
409
+ __metadata("design:type", Coupon)
410
+ ], Subscription.prototype, "coupon", void 0);
411
+ __decorate([
412
+ Type(() => Edition),
413
+ __metadata("design:type", Array)
414
+ ], Subscription.prototype, "editions", void 0);
415
+ __decorate([
416
+ Type(() => SubscriptionPayment),
417
+ __metadata("design:type", Array)
418
418
  ], Subscription.prototype, "payment", void 0);
419
419
 
420
- class UserAddress extends Address {
421
- identifierFields() {
422
- return ['id'];
423
- }
420
+ class UserAddress extends Address {
421
+ identifierFields() {
422
+ return ['id'];
423
+ }
424
424
  }
425
425
 
426
- class UserPaymentMethod extends BaseModel {
427
- identifierFields() {
428
- return ['id'];
429
- }
426
+ class UserPaymentMethod extends BaseModel {
427
+ identifierFields() {
428
+ return ['id'];
429
+ }
430
430
  }
431
431
 
432
- class Lead extends BaseModel {
433
- identifierFields() {
434
- return ['id'];
435
- }
432
+ class Lead extends BaseModel {
433
+ identifierFields() {
434
+ return ['id'];
435
+ }
436
436
  }
437
437
 
438
- class UnauthorizedError extends Error {
439
- constructor(message) {
440
- super(message);
441
- this.message = message;
442
- }
438
+ class UnauthorizedError extends Error {
439
+ constructor(message) {
440
+ super(message);
441
+ this.message = message;
442
+ }
443
443
  }
444
444
 
445
- var SignInMethods;
446
- (function (SignInMethods) {
447
- SignInMethods["EMAIL_PASSWORD"] = "email_password";
448
- SignInMethods["GOOGLE"] = "google";
449
- })(SignInMethods || (SignInMethods = {}));
450
- class Authentication {
451
- constructor(authService, userRepository) {
452
- this.authService = authService;
453
- this.userRepository = userRepository;
454
- }
455
- signIn({ email, password }, signInMethod) {
456
- return __awaiter(this, void 0, void 0, function* () {
457
- const method = this.getServiceByMethod(signInMethod);
458
- const userAuth = yield this.authService[method]({ email, password });
459
- const user = this.userRepository.get(userAuth);
460
- if (!isNil(user))
461
- return user;
462
- if (/^.+@b4a.com.br$/.test(userAuth.email))
463
- return this.createsUserByCredential(userAuth);
464
- throw new UnauthorizedError('Invalid credentials');
465
- });
466
- }
467
- getServiceByMethod(signInMethod) {
468
- return signInMethod === SignInMethods.EMAIL_PASSWORD ? 'signInWithEmailAndPassword' : 'signInWithGoogle';
469
- }
470
- createsUserByCredential(user) {
471
- var _a;
472
- return __awaiter(this, void 0, void 0, function* () {
473
- const [firstName, lastName] = (_a = user.displayName) === null || _a === void 0 ? void 0 : _a.split(/\s/);
474
- const person = User.toInstance(Object.assign(Object.assign({}, user), { cpf: '', birthday: new Date(), firstName,
475
- lastName, acceptsNewsletter: false, area: Area.Transactional, officePosition: OfficePosition.Intern, type: UserType.Collaborator }));
476
- return this.userRepository.create(person);
477
- });
478
- }
445
+ var SignInMethods;
446
+ (function (SignInMethods) {
447
+ SignInMethods["EMAIL_PASSWORD"] = "email_password";
448
+ SignInMethods["GOOGLE"] = "google";
449
+ })(SignInMethods || (SignInMethods = {}));
450
+ class Authentication {
451
+ constructor(authService, userRepository) {
452
+ this.authService = authService;
453
+ this.userRepository = userRepository;
454
+ }
455
+ signIn({ email, password }, signInMethod) {
456
+ return __awaiter(this, void 0, void 0, function* () {
457
+ const method = this.getServiceByMethod(signInMethod);
458
+ const userAuth = yield this.authService[method]({ email, password });
459
+ const user = this.userRepository.get(userAuth);
460
+ if (!isNil(user))
461
+ return user;
462
+ if (/^.+@b4a.com.br$/.test(userAuth.email))
463
+ return this.createsUserByCredential(userAuth);
464
+ throw new UnauthorizedError('Invalid credentials');
465
+ });
466
+ }
467
+ getServiceByMethod(signInMethod) {
468
+ return signInMethod === SignInMethods.EMAIL_PASSWORD ? 'signInWithEmailAndPassword' : 'signInWithGoogle';
469
+ }
470
+ createsUserByCredential(user) {
471
+ var _a;
472
+ return __awaiter(this, void 0, void 0, function* () {
473
+ const [firstName, lastName] = (_a = user.displayName) === null || _a === void 0 ? void 0 : _a.split(/\s/);
474
+ const person = User.toInstance(Object.assign(Object.assign({}, user), { cpf: '', birthday: new Date(), firstName,
475
+ lastName, acceptsNewsletter: false, area: Area.Transactional, officePosition: OfficePosition.Intern, type: UserType.Collaborator }));
476
+ return this.userRepository.create(person);
477
+ });
478
+ }
479
479
  }
480
480
 
481
- class SignOut {
482
- constructor(authService) {
483
- this.authService = authService;
484
- }
485
- signOut() {
486
- return __awaiter(this, void 0, void 0, function* () {
487
- yield this.authService.signOut();
488
- });
489
- }
481
+ class SignOut {
482
+ constructor(authService) {
483
+ this.authService = authService;
484
+ }
485
+ signOut() {
486
+ return __awaiter(this, void 0, void 0, function* () {
487
+ yield this.authService.signOut();
488
+ });
489
+ }
490
490
  }
491
491
 
492
- var Shops;
493
- (function (Shops) {
494
- Shops["MENSMARKET"] = "mensmarket";
495
- Shops["GLAMSHOP"] = "Glamshop";
492
+ var Shops;
493
+ (function (Shops) {
494
+ Shops["MENSMARKET"] = "mensmarket";
495
+ Shops["GLAMSHOP"] = "Glamshop";
496
496
  })(Shops || (Shops = {}));
497
497
 
498
- class Category extends BaseModel {
499
- identifierFields() {
500
- return ['id'];
501
- }
498
+ class Category extends BaseModel {
499
+ identifierFields() {
500
+ return ['id'];
501
+ }
502
502
  }
503
503
 
504
- class Product extends BaseModel {
505
- identifierFields() {
506
- return ['id'];
507
- }
508
- getInfoByShop(shop) {
509
- var _a, _b, _c, _d, _e, _f;
510
- return Object.assign(Object.assign(Object.assign({}, (((_b = (_a = this.description) === null || _a === void 0 ? void 0 : _a[shop]) === null || _b === void 0 ? void 0 : _b.description) ? { description: (_d = (_c = this.description) === null || _c === void 0 ? void 0 : _c[shop]) === null || _d === void 0 ? void 0 : _d.description } : {})), (((_e = this.price) === null || _e === void 0 ? void 0 : _e[shop]) || {})), (((_f = this.stock) === null || _f === void 0 ? void 0 : _f[shop]) || {}));
511
- }
504
+ class Product extends BaseModel {
505
+ identifierFields() {
506
+ return ['id'];
507
+ }
508
+ getInfoByShop(shop) {
509
+ var _a, _b, _c, _d, _e, _f;
510
+ return Object.assign(Object.assign(Object.assign({}, (((_b = (_a = this.description) === null || _a === void 0 ? void 0 : _a[shop]) === null || _b === void 0 ? void 0 : _b.description) ? { description: (_d = (_c = this.description) === null || _c === void 0 ? void 0 : _c[shop]) === null || _d === void 0 ? void 0 : _d.description } : {})), (((_e = this.price) === null || _e === void 0 ? void 0 : _e[shop]) || {})), (((_f = this.stock) === null || _f === void 0 ? void 0 : _f[shop]) || {}));
511
+ }
512
512
  }
513
513
 
514
- class Variant extends BaseModel {
515
- identifierFields() {
516
- return ['id'];
517
- }
514
+ class Variant extends BaseModel {
515
+ identifierFields() {
516
+ return ['id'];
517
+ }
518
518
  }
519
519
 
520
- const COUPON_EXPIRATION = 60 * 60 * 24 * 30;
521
- class FinancialCoupon extends Coupon {
522
- constructor() {
523
- super(...arguments);
524
- this.type = CouponTypes.FINANCIAL;
525
- }
526
- static isFinancialCoupon(coupon) {
527
- return coupon.type === CouponTypes.FINANCIAL && !!coupon.subtype;
528
- }
529
- static createCoupon(userId) {
530
- return this.toInstance({
531
- name: Md5.hashStr(`${userId}_${Date.now}`).toString(),
532
- nickname: `${Date.now()}`,
533
- type: CouponTypes.FINANCIAL,
534
- subtype: CouponSubtypes.PERCENTAGE,
535
- checkoutType: CheckoutTypes.ECOMMERCE,
536
- discount: 30,
537
- user: userId,
538
- createdAt: new Date(Date.now()),
539
- expiresIn: new Date(Date.now() + COUPON_EXPIRATION),
540
- });
541
- }
520
+ const COUPON_EXPIRATION = 60 * 60 * 24 * 30;
521
+ class FinancialCoupon extends Coupon {
522
+ constructor() {
523
+ super(...arguments);
524
+ this.type = CouponTypes.FINANCIAL;
525
+ }
526
+ static isFinancialCoupon(coupon) {
527
+ return coupon.type === CouponTypes.FINANCIAL && !!coupon.subtype;
528
+ }
529
+ static createCoupon(userId) {
530
+ return this.toInstance({
531
+ name: Md5.hashStr(`${userId}_${Date.now}`).toString(),
532
+ nickname: `${Date.now()}`,
533
+ type: CouponTypes.FINANCIAL,
534
+ subtype: CouponSubtypes.PERCENTAGE,
535
+ checkoutType: CheckoutTypes.ECOMMERCE,
536
+ discount: 30,
537
+ user: userId,
538
+ createdAt: new Date(Date.now()),
539
+ expiresIn: new Date(Date.now() + COUPON_EXPIRATION),
540
+ });
541
+ }
542
542
  }
543
543
 
544
- var OrderStatus;
545
- (function (OrderStatus) {
546
- OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
547
- OrderStatus["EM_PREPARO"] = "Preparando pedido";
548
- OrderStatus["NF_EMITIDA"] = "Nota Fiscal Emitida";
549
- OrderStatus["AGUARDANDO_ENVIO"] = "Aguardando Transaportadora";
550
- OrderStatus["ENVIADO"] = "Pedido Enviado";
551
- OrderStatus["ENTREGUE"] = "Pedido entregue";
552
- OrderStatus["CANCELADO"] = "Cancelado";
553
- OrderStatus["CREDIT_CARD"] = "credit_card";
544
+ var OrderStatus;
545
+ (function (OrderStatus) {
546
+ OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
547
+ OrderStatus["EM_PREPARO"] = "Preparando pedido";
548
+ OrderStatus["NF_EMITIDA"] = "Nota Fiscal Emitida";
549
+ OrderStatus["AGUARDANDO_ENVIO"] = "Aguardando Transaportadora";
550
+ OrderStatus["ENVIADO"] = "Pedido Enviado";
551
+ OrderStatus["ENTREGUE"] = "Pedido entregue";
552
+ OrderStatus["CANCELADO"] = "Cancelado";
553
+ OrderStatus["CREDIT_CARD"] = "credit_card";
554
554
  })(OrderStatus || (OrderStatus = {}));
555
555
 
556
- class LineItem extends Product {
556
+ class LineItem extends Product {
557
557
  }
558
558
 
559
- class ShippingMethod extends BaseModel {
560
- identifierFields() {
561
- return ['id'];
562
- }
559
+ class ShippingMethod extends BaseModel {
560
+ identifierFields() {
561
+ return ['id'];
562
+ }
563
563
  }
564
564
 
565
- class Checkout extends BaseModel {
566
- identifierFields() {
567
- return ['id'];
568
- }
569
- }
570
- __decorate([
571
- Type(() => LineItem),
572
- __metadata("design:type", Array)
573
- ], Checkout.prototype, "lineItems", void 0);
574
- __decorate([
575
- Type(() => User),
576
- __metadata("design:type", User)
577
- ], Checkout.prototype, "user", void 0);
578
- __decorate([
579
- Type(() => Address),
580
- __metadata("design:type", Address)
581
- ], Checkout.prototype, "shippingAddress", void 0);
582
- __decorate([
583
- Type(() => Address),
584
- __metadata("design:type", Address)
585
- ], Checkout.prototype, "billingAddress", void 0);
586
- __decorate([
587
- Type(() => ShippingMethod),
588
- __metadata("design:type", ShippingMethod)
589
- ], Checkout.prototype, "shipping", void 0);
590
- __decorate([
591
- Type(() => Coupon),
592
- __metadata("design:type", Coupon)
565
+ class Checkout extends BaseModel {
566
+ identifierFields() {
567
+ return ['id'];
568
+ }
569
+ }
570
+ __decorate([
571
+ Type(() => LineItem),
572
+ __metadata("design:type", Array)
573
+ ], Checkout.prototype, "lineItems", void 0);
574
+ __decorate([
575
+ Type(() => User),
576
+ __metadata("design:type", User)
577
+ ], Checkout.prototype, "user", void 0);
578
+ __decorate([
579
+ Type(() => Address),
580
+ __metadata("design:type", Address)
581
+ ], Checkout.prototype, "shippingAddress", void 0);
582
+ __decorate([
583
+ Type(() => Address),
584
+ __metadata("design:type", Address)
585
+ ], Checkout.prototype, "billingAddress", void 0);
586
+ __decorate([
587
+ Type(() => ShippingMethod),
588
+ __metadata("design:type", ShippingMethod)
589
+ ], Checkout.prototype, "shipping", void 0);
590
+ __decorate([
591
+ Type(() => Coupon),
592
+ __metadata("design:type", Coupon)
593
593
  ], Checkout.prototype, "coupon", void 0);
594
594
 
595
- class Order extends Checkout {
596
- }
597
- __decorate([
598
- Type(() => Payment),
599
- __metadata("design:type", Payment)
595
+ class Order extends Checkout {
596
+ }
597
+ __decorate([
598
+ Type(() => Payment),
599
+ __metadata("design:type", Payment)
600
600
  ], Order.prototype, "payment", void 0);
601
601
 
602
- class CheckoutSubscription extends BaseModel {
603
- identifierFields() {
604
- return ['id'];
605
- }
606
- }
607
- __decorate([
608
- Type(() => Address),
609
- __metadata("design:type", Address)
610
- ], CheckoutSubscription.prototype, "shippingAddress", void 0);
611
- __decorate([
612
- Type(() => Address),
613
- __metadata("design:type", Address)
614
- ], CheckoutSubscription.prototype, "billingAddress", void 0);
615
- __decorate([
616
- Type(() => SubscriptionPlan),
617
- __metadata("design:type", SubscriptionPlan)
618
- ], CheckoutSubscription.prototype, "subscriptionPlan", void 0);
619
- __decorate([
620
- Type(() => Coupon),
621
- __metadata("design:type", Coupon)
602
+ class CheckoutSubscription extends BaseModel {
603
+ identifierFields() {
604
+ return ['id'];
605
+ }
606
+ }
607
+ __decorate([
608
+ Type(() => Address),
609
+ __metadata("design:type", Address)
610
+ ], CheckoutSubscription.prototype, "shippingAddress", void 0);
611
+ __decorate([
612
+ Type(() => Address),
613
+ __metadata("design:type", Address)
614
+ ], CheckoutSubscription.prototype, "billingAddress", void 0);
615
+ __decorate([
616
+ Type(() => SubscriptionPlan),
617
+ __metadata("design:type", SubscriptionPlan)
618
+ ], CheckoutSubscription.prototype, "subscriptionPlan", void 0);
619
+ __decorate([
620
+ Type(() => Coupon),
621
+ __metadata("design:type", Coupon)
622
622
  ], CheckoutSubscription.prototype, "coupon", void 0);
623
623
 
624
- class Buy2Win extends BaseModel {
625
- identifierFields() {
626
- return ['id'];
627
- }
628
- }
629
- __decorate([
630
- Type(() => Category),
631
- __metadata("design:type", Array)
624
+ class Buy2Win extends BaseModel {
625
+ identifierFields() {
626
+ return ['id'];
627
+ }
628
+ }
629
+ __decorate([
630
+ Type(() => Category),
631
+ __metadata("design:type", Array)
632
632
  ], Buy2Win.prototype, "categories", void 0);
633
633
 
634
- class Home extends BaseModel {
635
- identifierFields() {
636
- return ['id'];
637
- }
634
+ class Home extends BaseModel {
635
+ identifierFields() {
636
+ return ['id'];
637
+ }
638
638
  }
639
639
 
640
- class ShopMenu extends BaseModel {
641
- identifierFields() {
642
- return ['id'];
643
- }
640
+ class ShopMenu extends BaseModel {
641
+ identifierFields() {
642
+ return ['id'];
643
+ }
644
644
  }
645
645
 
646
- class InvalidArgumentError extends Error {
647
- constructor(message) {
648
- super(message);
649
- this.message = message;
650
- }
646
+ class InvalidArgumentError extends Error {
647
+ constructor(message) {
648
+ super(message);
649
+ this.message = message;
650
+ }
651
651
  }
652
652
 
653
- class RequiredArgumentError extends Error {
654
- constructor(args) {
655
- super(`Required arguments: ${args.join(', ')}`);
656
- this.args = args;
657
- this.arguments = args;
658
- }
653
+ class RequiredArgumentError extends Error {
654
+ constructor(args) {
655
+ super(`Required arguments: ${args.join(', ')}`);
656
+ this.args = args;
657
+ this.arguments = args;
658
+ }
659
659
  }
660
660
 
661
- class NotFoundError extends Error {
662
- constructor(message) {
663
- super(message);
664
- this.message = message;
665
- }
661
+ class NotFoundError extends Error {
662
+ constructor(message) {
663
+ super(message);
664
+ this.message = message;
665
+ }
666
666
  }
667
667
 
668
- class DuplicatedResultsError extends Error {
669
- constructor(message) {
670
- super(message);
671
- this.message = message;
672
- }
668
+ class DuplicatedResultsError extends Error {
669
+ constructor(message) {
670
+ super(message);
671
+ this.message = message;
672
+ }
673
673
  }
674
674
 
675
- const withFirestore = (MixinBase) => {
676
- return class extends MixinBase {
677
- constructor(...args) {
678
- super(args);
679
- }
680
- collection(path) {
681
- return this.firestore.collection(path || this.collectionName).withConverter(this.buildModelInstance());
682
- }
683
- buildModelInstance() {
684
- return {
685
- toFirestore: (data) => ((data === null || data === void 0 ? void 0 : data.toPlain) ? data.toPlain() : data),
686
- fromFirestore: (snap) => {
687
- const data = snap.data();
688
- Object.keys(data).forEach((key) => {
689
- if (data[key] instanceof firebase.firestore.Timestamp) {
690
- data[key] = data[key].toDate();
691
- }
692
- });
693
- return this.model.toInstance(Object.assign({ id: snap.id }, data));
694
- },
695
- };
696
- }
697
- };
675
+ const withFirestore = (MixinBase) => {
676
+ return class extends MixinBase {
677
+ constructor(...args) {
678
+ super(args);
679
+ }
680
+ collection(path) {
681
+ return this.firestore.collection(path || this.collectionName).withConverter(this.buildModelInstance());
682
+ }
683
+ buildModelInstance() {
684
+ return {
685
+ toFirestore: (data) => ((data === null || data === void 0 ? void 0 : data.toPlain) ? data.toPlain() : data),
686
+ fromFirestore: (snap) => {
687
+ const data = snap.data();
688
+ Object.keys(data).forEach((key) => {
689
+ if (data[key] instanceof firebase.firestore.Timestamp) {
690
+ data[key] = data[key].toDate();
691
+ }
692
+ });
693
+ return this.model.toInstance(Object.assign({ id: snap.id }, data));
694
+ },
695
+ };
696
+ }
697
+ };
698
698
  };
699
699
 
700
- const withHelpers = (MixinBase) => {
701
- return class extends MixinBase {
702
- toArray(snapShot) {
703
- if (Array.isArray(snapShot)) {
704
- return snapShot.map((doc) => doc.data());
705
- }
706
- else {
707
- return snapShot.docs.map((doc) => doc.data());
708
- }
709
- }
710
- isSubCollection(repository) {
711
- return !isNil(Object.keys(this).find((key) => key === 'parentRepository'));
712
- }
713
- };
700
+ const withHelpers = (MixinBase) => {
701
+ return class extends MixinBase {
702
+ toArray(snapShot) {
703
+ if (Array.isArray(snapShot)) {
704
+ return snapShot.map((doc) => doc.data());
705
+ }
706
+ else {
707
+ return snapShot.docs.map((doc) => doc.data());
708
+ }
709
+ }
710
+ isSubCollection(repository) {
711
+ return !isNil(Object.keys(this).find((key) => key === 'parentRepository'));
712
+ }
713
+ };
714
714
  };
715
715
 
716
- const withGetFirestore = (MixinBase) => {
717
- return class GetFirestore extends MixinBase {
718
- get(identifiers) {
719
- return __awaiter(this, void 0, void 0, function* () {
720
- const doc = yield this.collection(this.buildCollectionPathForGet(identifiers))
721
- .doc(Object.values(identifiers).shift().toString())
722
- .get();
723
- const data = doc.data();
724
- if (isNil(data))
725
- throw new NotFoundError(`Document ${JSON.stringify(identifiers)} not found`);
726
- return data;
727
- });
728
- }
729
- buildCollectionPathForGet(identifiers) {
730
- return this.isSubCollection(this)
731
- ? `${this.parentRepository.collectionName}/${identifiers[this.parentIdField]}/${this.collectionName}`
732
- : this.collectionName;
733
- }
734
- };
716
+ const withGetFirestore = (MixinBase) => {
717
+ return class GetFirestore extends MixinBase {
718
+ get(identifiers) {
719
+ return __awaiter(this, void 0, void 0, function* () {
720
+ const doc = yield this.collection(this.buildCollectionPathForGet(identifiers))
721
+ .doc(Object.values(identifiers).shift().toString())
722
+ .get();
723
+ const data = doc.data();
724
+ if (isNil(data))
725
+ throw new NotFoundError(`Document ${JSON.stringify(identifiers)} not found`);
726
+ return data;
727
+ });
728
+ }
729
+ buildCollectionPathForGet(identifiers) {
730
+ return this.isSubCollection(this)
731
+ ? `${this.parentRepository.collectionName}/${identifiers[this.parentIdField]}/${this.collectionName}`
732
+ : this.collectionName;
733
+ }
734
+ };
735
735
  };
736
736
 
737
- const withFindFirestore = (MixinBase) => {
738
- const checkIfIsFilterOption = (filter) => !isNil(filter === null || filter === void 0 ? void 0 : filter.operator);
739
- const getValueFromFilter = (filter) => {
740
- return checkIfIsFilterOption(filter) ? filter.value : filter;
741
- };
742
- return class FindFirestore extends MixinBase {
743
- constructor() {
744
- super(...arguments);
745
- this.makeFirestoreWhere = (queryReference, filter) => Object.keys(filter).reduce((query, fieldName) => this.buildWhereSentence(query, fieldName, filter[fieldName]), queryReference);
746
- this.buildWhereSentence = (queryReference, fieldName, options) => {
747
- if (this.isSubCollection(this) && fieldName === this.parentIdField)
748
- return queryReference;
749
- if ((options === null || options === void 0 ? void 0 : options.operator) === Where.LIKE) {
750
- queryReference = queryReference.where(fieldName.toString(), '>=', options.value);
751
- queryReference = queryReference.where(fieldName.toString(), '<=', `${options.value}~`);
752
- return queryReference;
753
- }
754
- if ((options === null || options === void 0 ? void 0 : options.operator) === Where.IN && Array.isArray(options === null || options === void 0 ? void 0 : options.value))
755
- return queryReference.where(fieldName.toString(), 'array-contains-any', options.value);
756
- if (isObject(options) && isNil(options === null || options === void 0 ? void 0 : options.operator) && isNil(options === null || options === void 0 ? void 0 : options.value))
757
- return Object.keys(options).reduce((queryReferenceWithWhere, key) => this.buildWhereSentence(queryReferenceWithWhere, `${fieldName}.${key}`, options[key]), queryReference);
758
- return queryReference.where(fieldName.toString(), (options === null || options === void 0 ? void 0 : options.operator) || '==', (options === null || options === void 0 ? void 0 : options.value) || options);
759
- };
760
- }
761
- find(filters, limits, orderBy) {
762
- return __awaiter(this, void 0, void 0, function* () {
763
- let query = this.collection(this.buildCollectionPathForFind(filters));
764
- filters === null || filters === void 0 ? void 0 : filters.forEach((filterer) => (query = this.makeFirestoreWhere(query, filterer)));
765
- orderBy === null || orderBy === void 0 ? void 0 : orderBy.forEach((orderer) => Object.keys(orderer).forEach((fieldName) => (query = query.orderBy(fieldName, orderer[fieldName]))));
766
- query = yield this.defineLimits(query, filters, limits);
767
- const docs = yield query.get();
768
- const data = docs.docs.map((doc) => doc.data());
769
- return {
770
- data,
771
- count: this.calculateCount(data, limits),
772
- };
773
- });
774
- }
775
- buildCollectionPathForFind(filters) {
776
- var _a;
777
- if (!this.isSubCollection(this))
778
- return this.collectionName;
779
- const parentIdField = this.parentIdField;
780
- const parentId = getValueFromFilter((_a = filters.find((groupFilter) => Boolean(getValueFromFilter(groupFilter[parentIdField])))) === null || _a === void 0 ? void 0 : _a[parentIdField]);
781
- return `${this.parentRepository.collectionName}/${parentId}/${this.collectionName}`;
782
- }
783
- defineLimits(query, filters, limits) {
784
- return __awaiter(this, void 0, void 0, function* () {
785
- if (limits === null || limits === void 0 ? void 0 : limits.offset) {
786
- if (limits.offset instanceof this.model)
787
- query = query.startAfter(yield this.collection(this.buildCollectionPathForFind(filters))
788
- .doc(limits.offset[limits.offset.identifierFields().shift()])
789
- .get());
790
- else if (isNumber(limits.offset) || isString(limits.offset))
791
- query = query.startAt(limits.offset);
792
- }
793
- if (limits === null || limits === void 0 ? void 0 : limits.limit)
794
- query = query.limit(limits.limit);
795
- return query;
796
- });
797
- }
798
- calculateCount(data, limits) {
799
- if (data.length <= 0)
800
- return 0;
801
- if (data.length < (limits === null || limits === void 0 ? void 0 : limits.limit))
802
- return data.length;
803
- return Infinity;
804
- }
805
- };
737
+ const withFindFirestore = (MixinBase) => {
738
+ const checkIfIsFilterOption = (filter) => !isNil(filter === null || filter === void 0 ? void 0 : filter.operator);
739
+ const getValueFromFilter = (filter) => {
740
+ return checkIfIsFilterOption(filter) ? filter.value : filter;
741
+ };
742
+ return class FindFirestore extends MixinBase {
743
+ constructor() {
744
+ super(...arguments);
745
+ this.makeFirestoreWhere = (queryReference, filter) => Object.keys(filter).reduce((query, fieldName) => this.buildWhereSentence(query, fieldName, filter[fieldName]), queryReference);
746
+ this.buildWhereSentence = (queryReference, fieldName, options) => {
747
+ if (this.isSubCollection(this) && fieldName === this.parentIdField)
748
+ return queryReference;
749
+ if ((options === null || options === void 0 ? void 0 : options.operator) === Where.LIKE) {
750
+ if (Array.isArray(options === null || options === void 0 ? void 0 : options.value))
751
+ return queryReference.where(fieldName.toString(), 'array-contains-any', options.value);
752
+ queryReference = queryReference.where(fieldName.toString(), '>=', options.value);
753
+ queryReference = queryReference.where(fieldName.toString(), '<=', `${options.value}~`);
754
+ return queryReference;
755
+ }
756
+ if ((options === null || options === void 0 ? void 0 : options.operator) === Where.IN && Array.isArray(options === null || options === void 0 ? void 0 : options.value))
757
+ return queryReference.where(fieldName.toString(), 'array-contains', options.value);
758
+ if (isObject(options) && isNil(options === null || options === void 0 ? void 0 : options.operator) && isNil(options === null || options === void 0 ? void 0 : options.value))
759
+ return Object.keys(options).reduce((queryReferenceWithWhere, key) => this.buildWhereSentence(queryReferenceWithWhere, `${fieldName}.${key}`, options[key]), queryReference);
760
+ return queryReference.where(fieldName.toString(), (options === null || options === void 0 ? void 0 : options.operator) || '==', (options === null || options === void 0 ? void 0 : options.value) || options);
761
+ };
762
+ }
763
+ find(filters, limits, orderBy) {
764
+ return __awaiter(this, void 0, void 0, function* () {
765
+ let query = this.collection(this.buildCollectionPathForFind(filters));
766
+ filters === null || filters === void 0 ? void 0 : filters.forEach((filterer) => (query = this.makeFirestoreWhere(query, filterer)));
767
+ orderBy === null || orderBy === void 0 ? void 0 : orderBy.forEach((orderer) => Object.keys(orderer).forEach((fieldName) => (query = query.orderBy(fieldName, orderer[fieldName]))));
768
+ query = yield this.defineLimits(query, filters, limits);
769
+ const docs = yield query.get();
770
+ const data = docs.docs.map((doc) => doc.data());
771
+ return {
772
+ data,
773
+ count: this.calculateCount(data, limits),
774
+ };
775
+ });
776
+ }
777
+ buildCollectionPathForFind(filters) {
778
+ var _a;
779
+ if (!this.isSubCollection(this))
780
+ return this.collectionName;
781
+ const parentIdField = this.parentIdField;
782
+ const parentId = getValueFromFilter((_a = filters.find((groupFilter) => Boolean(getValueFromFilter(groupFilter[parentIdField])))) === null || _a === void 0 ? void 0 : _a[parentIdField]);
783
+ return `${this.parentRepository.collectionName}/${parentId}/${this.collectionName}`;
784
+ }
785
+ defineLimits(query, filters, limits) {
786
+ return __awaiter(this, void 0, void 0, function* () {
787
+ if (limits === null || limits === void 0 ? void 0 : limits.offset) {
788
+ if (limits.offset instanceof this.model)
789
+ query = query.startAfter(yield this.collection(this.buildCollectionPathForFind(filters))
790
+ .doc(limits.offset[limits.offset.identifierFields().shift()])
791
+ .get());
792
+ else if (isNumber(limits.offset) || isString(limits.offset))
793
+ query = query.startAt(limits.offset);
794
+ }
795
+ if (limits === null || limits === void 0 ? void 0 : limits.limit)
796
+ query = query.limit(limits.limit);
797
+ return query;
798
+ });
799
+ }
800
+ calculateCount(data, limits) {
801
+ if (data.length <= 0)
802
+ return 0;
803
+ if (data.length < (limits === null || limits === void 0 ? void 0 : limits.limit))
804
+ return data.length;
805
+ return Infinity;
806
+ }
807
+ };
806
808
  };
807
809
 
808
- const withCreateFirestore = (MixinBase) => {
809
- return class CreateFirestore extends MixinBase {
810
- create(data) {
811
- return __awaiter(this, void 0, void 0, function* () {
812
- const docRef = yield this.save(this.model.toInstance(data));
813
- const doc = yield docRef.get();
814
- return doc.data();
815
- });
816
- }
817
- save(data) {
818
- var _a;
819
- return __awaiter(this, void 0, void 0, function* () {
820
- const id = (_a = data[data.identifierFields().shift()]) === null || _a === void 0 ? void 0 : _a.toString();
821
- if (isEmpty(id))
822
- return this.collection(this.buildCollectionPathForAdd(data)).add(data);
823
- const docRef = this.collection().doc(id);
824
- yield docRef.set(data);
825
- return docRef;
826
- });
827
- }
828
- buildCollectionPathForAdd(identifiers) {
829
- return this.isSubCollection(this)
830
- ? `${this.parentRepository.collectionName}/${identifiers[this.parentIdField]}/${this.collectionName}`
831
- : this.collectionName;
832
- }
833
- };
810
+ const withCreateFirestore = (MixinBase) => {
811
+ return class CreateFirestore extends MixinBase {
812
+ create(data) {
813
+ return __awaiter(this, void 0, void 0, function* () {
814
+ const docRef = yield this.save(this.model.toInstance(data));
815
+ const doc = yield docRef.get();
816
+ return doc.data();
817
+ });
818
+ }
819
+ save(data) {
820
+ var _a;
821
+ return __awaiter(this, void 0, void 0, function* () {
822
+ const id = (_a = data[data.identifierFields().shift()]) === null || _a === void 0 ? void 0 : _a.toString();
823
+ const collectionPath = this.buildCollectionPathForAdd(data);
824
+ if (isEmpty(id))
825
+ return this.collection(collectionPath).add(data);
826
+ const docRef = this.collection(collectionPath).doc(id);
827
+ yield docRef.set(data);
828
+ return docRef;
829
+ });
830
+ }
831
+ buildCollectionPathForAdd(identifiers) {
832
+ return this.isSubCollection(this)
833
+ ? `${this.parentRepository.collectionName}/${identifiers[this.parentIdField]}/${this.collectionName}`
834
+ : this.collectionName;
835
+ }
836
+ };
834
837
  };
835
838
 
836
- const withUpdateFirestore = (MixinBase) => {
837
- const getValueFromParams = (params, field) => { var _a; return (isNil((_a = params[field]) === null || _a === void 0 ? void 0 : _a.value) ? params[field] : params[field].value) || null; };
838
- const getValueByAction = (options) => {
839
- const fieldValues = firebase.firestore.FieldValue;
840
- if (isNil(options.action))
841
- return options;
842
- if (options.action === UpdateOptionActions.REMOVE_FIELD)
843
- return fieldValues.delete();
844
- if (Array.isArray(options.value)) {
845
- if (options.action === UpdateOptionActions.MERGE)
846
- return fieldValues.arrayUnion(...options.value);
847
- if (options.action === UpdateOptionActions.REMOVE)
848
- return fieldValues.arrayRemove(...options.value);
849
- }
850
- return options.value;
851
- };
852
- return class UpdateFirestore extends MixinBase {
853
- update(data) {
854
- return __awaiter(this, void 0, void 0, function* () {
855
- const model = new this.model();
856
- const keyField = model.identifierFields().shift();
857
- const docRef = this.collection(this.buildCollectionPathForUpdate(data)).doc(getValueFromParams(data, keyField).toString());
858
- yield docRef.set(this.paramsToPlain(data), { merge: true });
859
- const doc = yield docRef.get();
860
- return doc.data();
861
- });
862
- }
863
- buildCollectionPathForUpdate(identifiers) {
864
- return this.isSubCollection(this)
865
- ? `${this.parentRepository.collectionName}/${getValueFromParams(identifiers, this.parentIdField)}/${this.collectionName}`
866
- : this.collectionName;
867
- }
868
- paramsToPlain(params) {
869
- const model = this.model;
870
- if (params instanceof model)
871
- return params;
872
- return Object.keys(params).reduce((data, currentKey) => (Object.assign(Object.assign({}, data), { [currentKey]: getValueByAction(params[currentKey]) })), {});
873
- }
874
- };
839
+ const withUpdateFirestore = (MixinBase) => {
840
+ const getValueFromParams = (params, field) => { var _a; return (isNil((_a = params[field]) === null || _a === void 0 ? void 0 : _a.value) ? params[field] : params[field].value) || null; };
841
+ const getValueByAction = (options) => {
842
+ const fieldValues = firebase.firestore.FieldValue;
843
+ if (isNil(options.action))
844
+ return options;
845
+ if (options.action === UpdateOptionActions.REMOVE_FIELD)
846
+ return fieldValues.delete();
847
+ if (Array.isArray(options.value)) {
848
+ if (options.action === UpdateOptionActions.MERGE)
849
+ return fieldValues.arrayUnion(...options.value);
850
+ if (options.action === UpdateOptionActions.REMOVE)
851
+ return fieldValues.arrayRemove(...options.value);
852
+ }
853
+ return options.value;
854
+ };
855
+ return class UpdateFirestore extends MixinBase {
856
+ update(data) {
857
+ return __awaiter(this, void 0, void 0, function* () {
858
+ const model = new this.model();
859
+ const keyField = model.identifierFields().shift();
860
+ const docRef = this.collection(this.buildCollectionPathForUpdate(data)).doc(getValueFromParams(data, keyField).toString());
861
+ yield docRef.set(this.paramsToPlain(data), { merge: true });
862
+ const doc = yield docRef.get();
863
+ return doc.data();
864
+ });
865
+ }
866
+ buildCollectionPathForUpdate(identifiers) {
867
+ return this.isSubCollection(this)
868
+ ? `${this.parentRepository.collectionName}/${getValueFromParams(identifiers, this.parentIdField)}/${this.collectionName}`
869
+ : this.collectionName;
870
+ }
871
+ paramsToPlain(params) {
872
+ const model = this.model;
873
+ if (params instanceof model)
874
+ return params;
875
+ return Object.keys(params).reduce((data, currentKey) => (Object.assign(Object.assign({}, data), { [currentKey]: getValueByAction(params[currentKey]) })), {});
876
+ }
877
+ };
875
878
  };
876
879
 
877
- const withDeleteFirestore = (MixinBase) => {
878
- return class DeleteFirestore extends MixinBase {
879
- delete(identifiers) {
880
- return __awaiter(this, void 0, void 0, function* () {
881
- yield this.collection(this.buildCollectionPathForRemove(identifiers))
882
- .doc(Object.values(identifiers).shift().toString())
883
- .delete();
884
- });
885
- }
886
- buildCollectionPathForRemove(identifiers) {
887
- return this.isSubCollection(this)
888
- ? `${this.parentRepository.collectionName}/${identifiers[this.parentIdField]}/${this.collectionName}`
889
- : this.collectionName;
890
- }
891
- };
880
+ const withDeleteFirestore = (MixinBase) => {
881
+ return class DeleteFirestore extends MixinBase {
882
+ delete(identifiers) {
883
+ return __awaiter(this, void 0, void 0, function* () {
884
+ yield this.collection(this.buildCollectionPathForRemove(identifiers))
885
+ .doc(Object.values(identifiers).shift().toString())
886
+ .delete();
887
+ });
888
+ }
889
+ buildCollectionPathForRemove(identifiers) {
890
+ return this.isSubCollection(this)
891
+ ? `${this.parentRepository.collectionName}/${identifiers[this.parentIdField]}/${this.collectionName}`
892
+ : this.collectionName;
893
+ }
894
+ };
892
895
  };
893
896
 
894
- const withSubCollection = (MixinBase, ParentModel) => {
895
- return class SubCollectionMix extends MixinBase {
896
- constructor(...args) {
897
- super(args);
898
- }
899
- collection(path) {
900
- return super.collection(path);
901
- }
902
- };
897
+ const withSubCollection = (MixinBase, ParentModel) => {
898
+ return class SubCollectionMix extends MixinBase {
899
+ constructor(...args) {
900
+ super(args);
901
+ }
902
+ collection(path) {
903
+ return super.collection(path);
904
+ }
905
+ };
903
906
  };
904
907
 
905
- const withCrudFirestore = (MixinBase) => {
906
- return class CrudFirestore extends withUpdateFirestore(withGetFirestore(withFindFirestore(withDeleteFirestore(withCreateFirestore(MixinBase))))) {
907
- };
908
+ const withCrudFirestore = (MixinBase) => {
909
+ return class CrudFirestore extends withUpdateFirestore(withGetFirestore(withFindFirestore(withDeleteFirestore(withCreateFirestore(MixinBase))))) {
910
+ };
908
911
  };
909
912
 
910
- class SubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
911
- constructor(firestore) {
912
- super();
913
- this.firestore = firestore;
914
- this.collectionName = 'subscription';
915
- this.model = Subscription;
916
- }
913
+ class SubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
914
+ constructor(firestore) {
915
+ super();
916
+ this.firestore = firestore;
917
+ this.collectionName = 'subscription';
918
+ this.model = Subscription;
919
+ }
917
920
  }
918
921
 
919
- class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
920
- constructor(firestore) {
921
- super();
922
- this.firestore = firestore;
923
- this.collectionName = 'users';
924
- this.model = User;
925
- }
926
- get(identifiers) {
927
- const _super = Object.create(null, {
928
- get: { get: () => super.get }
929
- });
930
- return __awaiter(this, void 0, void 0, function* () {
931
- const user = yield _super.get.call(this, { id: identifiers.id });
932
- user.beautyProfile = yield this.getBeautyProfile(user.id);
933
- user.isSubscriber = yield this.checkIfIsSubscriber(user.id);
934
- return user;
935
- });
936
- }
937
- buildModelInstance() {
938
- const { fromFirestore, toFirestore } = super.buildModelInstance();
939
- return {
940
- toFirestore: (data) => {
941
- const plain = toFirestore(data);
942
- delete plain.isSubscriber;
943
- return plain;
944
- },
945
- fromFirestore,
946
- };
947
- }
948
- getBeautyProfile(userId) {
949
- return __awaiter(this, void 0, void 0, function* () {
950
- const beautyProfile = yield this.collection()
951
- .doc(userId)
952
- .collection('CX')
953
- .withConverter(this.buildBeautyProfileModelInstance())
954
- .doc('beautyProfile')
955
- .get();
956
- return beautyProfile.data();
957
- });
958
- }
959
- checkIfIsSubscriber(userId) {
960
- return __awaiter(this, void 0, void 0, function* () {
961
- const docs = yield this.firestore
962
- .collection('subscription')
963
- .where('user.id', '==', userId)
964
- .where('status', '==', 'active')
965
- .get();
966
- return !!docs && !!docs.size;
967
- });
968
- }
969
- buildBeautyProfileModelInstance() {
970
- return {
971
- toFirestore: (data) => data.toPlain(),
972
- fromFirestore: (snap) => BeautyProfile.toInstance(snap.data()),
973
- };
974
- }
922
+ class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
923
+ constructor(firestore) {
924
+ super();
925
+ this.firestore = firestore;
926
+ this.collectionName = 'users';
927
+ this.model = User;
928
+ }
929
+ get(identifiers) {
930
+ const _super = Object.create(null, {
931
+ get: { get: () => super.get }
932
+ });
933
+ return __awaiter(this, void 0, void 0, function* () {
934
+ const user = yield _super.get.call(this, { id: identifiers.id });
935
+ user.beautyProfile = yield this.getBeautyProfile(user.id);
936
+ user.isSubscriber = yield this.checkIfIsSubscriber(user.id);
937
+ return user;
938
+ });
939
+ }
940
+ buildModelInstance() {
941
+ const { fromFirestore, toFirestore } = super.buildModelInstance();
942
+ return {
943
+ toFirestore: (data) => {
944
+ const plain = toFirestore(data);
945
+ delete plain.isSubscriber;
946
+ return plain;
947
+ },
948
+ fromFirestore,
949
+ };
950
+ }
951
+ getBeautyProfile(userId) {
952
+ return __awaiter(this, void 0, void 0, function* () {
953
+ const beautyProfile = yield this.collection()
954
+ .doc(userId)
955
+ .collection('CX')
956
+ .withConverter(this.buildBeautyProfileModelInstance())
957
+ .doc('beautyProfile')
958
+ .get();
959
+ return beautyProfile.data();
960
+ });
961
+ }
962
+ checkIfIsSubscriber(userId) {
963
+ return __awaiter(this, void 0, void 0, function* () {
964
+ const docs = yield this.firestore
965
+ .collection('subscription')
966
+ .where('user.id', '==', userId)
967
+ .where('status', '==', 'active')
968
+ .get();
969
+ return !!docs && !!docs.size;
970
+ });
971
+ }
972
+ buildBeautyProfileModelInstance() {
973
+ return {
974
+ toFirestore: (data) => data.toPlain(),
975
+ fromFirestore: (snap) => BeautyProfile.toInstance(snap.data()),
976
+ };
977
+ }
975
978
  }
976
979
 
977
- class SubscriptionEditionFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Subscription) {
978
- constructor(firestore, parentRepository) {
979
- super();
980
- this.firestore = firestore;
981
- this.parentRepository = parentRepository;
982
- this.collectionName = 'editions';
983
- this.parentIdField = 'subscriptionId';
984
- this.model = Edition;
985
- }
980
+ class SubscriptionEditionFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Subscription) {
981
+ constructor(firestore, parentRepository) {
982
+ super();
983
+ this.firestore = firestore;
984
+ this.parentRepository = parentRepository;
985
+ this.collectionName = 'editions';
986
+ this.parentIdField = 'subscriptionId';
987
+ this.model = Edition;
988
+ }
986
989
  }
987
990
 
988
- class UserBeautyProfileFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User) {
989
- constructor(firestore, parentRepository) {
990
- super();
991
- this.firestore = firestore;
992
- this.parentRepository = parentRepository;
993
- this.collectionName = 'CX';
994
- this.parentIdField = 'userId';
995
- this.model = BeautyProfile;
996
- }
991
+ class UserBeautyProfileFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User) {
992
+ constructor(firestore, parentRepository) {
993
+ super();
994
+ this.firestore = firestore;
995
+ this.parentRepository = parentRepository;
996
+ this.collectionName = 'CX';
997
+ this.parentIdField = 'userId';
998
+ this.model = BeautyProfile;
999
+ }
997
1000
  }
998
1001
 
999
- class UserAddressFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User) {
1000
- constructor(firestore, parentRepository) {
1001
- super();
1002
- this.firestore = firestore;
1003
- this.parentRepository = parentRepository;
1004
- this.collectionName = 'address';
1005
- this.parentIdField = 'userId';
1006
- this.model = UserAddress;
1007
- }
1002
+ class UserAddressFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User) {
1003
+ constructor(firestore, parentRepository) {
1004
+ super();
1005
+ this.firestore = firestore;
1006
+ this.parentRepository = parentRepository;
1007
+ this.collectionName = 'address';
1008
+ this.parentIdField = 'userId';
1009
+ this.model = UserAddress;
1010
+ }
1008
1011
  }
1009
1012
 
1010
- class UserPaymentMethodFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User) {
1011
- constructor(firestore, parentRepository) {
1012
- super();
1013
- this.firestore = firestore;
1014
- this.parentRepository = parentRepository;
1015
- this.collectionName = 'payment_method';
1016
- this.parentIdField = 'userId';
1017
- this.model = UserPaymentMethod;
1018
- }
1013
+ class UserPaymentMethodFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User) {
1014
+ constructor(firestore, parentRepository) {
1015
+ super();
1016
+ this.firestore = firestore;
1017
+ this.parentRepository = parentRepository;
1018
+ this.collectionName = 'payment_method';
1019
+ this.parentIdField = 'userId';
1020
+ this.model = UserPaymentMethod;
1021
+ }
1019
1022
  }
1020
1023
 
1021
- class SubscriptionPaymentFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Subscription) {
1022
- constructor(firestore, parentRepository) {
1023
- super();
1024
- this.firestore = firestore;
1025
- this.parentRepository = parentRepository;
1026
- this.collectionName = 'payments';
1027
- this.parentIdField = 'subscriptionId';
1028
- this.model = SubscriptionPayment;
1029
- }
1024
+ class SubscriptionPaymentFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Subscription) {
1025
+ constructor(firestore, parentRepository) {
1026
+ super();
1027
+ this.firestore = firestore;
1028
+ this.parentRepository = parentRepository;
1029
+ this.collectionName = 'payments';
1030
+ this.parentIdField = 'subscriptionId';
1031
+ this.model = SubscriptionPayment;
1032
+ }
1030
1033
  }
1031
1034
 
1032
- class LeadFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1033
- constructor(firestore) {
1034
- super();
1035
- this.firestore = firestore;
1036
- this.collectionName = 'leads';
1037
- this.model = Lead;
1038
- }
1035
+ class LeadFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1036
+ constructor(firestore) {
1037
+ super();
1038
+ this.firestore = firestore;
1039
+ this.collectionName = 'leads';
1040
+ this.model = Lead;
1041
+ }
1039
1042
  }
1040
1043
 
1041
- class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1042
- constructor(firestore) {
1043
- super();
1044
- this.firestore = firestore;
1045
- this.collectionName = 'categories';
1046
- this.model = Category;
1047
- }
1048
- getCategoryBySlug(slug, shop) {
1049
- return this.collection(this.collectionName)
1050
- .where('slug', '==', slug)
1051
- .where('shop', '==', shop)
1052
- .where('published', '==', true)
1053
- .get()
1054
- .then((snap) => {
1055
- if (snap.size > 1)
1056
- throw new DuplicatedResultsError('Query returned duplicated values');
1057
- if (snap.empty)
1058
- throw new NotFoundError(`Document with slug ${slug} not found`);
1059
- return snap.docs[0].data();
1060
- })
1061
- .catch((error) => error);
1062
- }
1063
- getCategoriesForHome(categoryIds, limit = 4) {
1064
- return __awaiter(this, void 0, void 0, function* () {
1065
- const categorySnap = yield this.collection(this.collectionName)
1066
- .where('id', 'in', categoryIds)
1067
- .where('published', '==', true)
1068
- .get();
1069
- if (categorySnap.empty)
1070
- throw new NotFoundError('Categories not found');
1071
- const categories = categorySnap.docs.map((doc) => doc.data());
1072
- const homeSections = [];
1073
- for (const category of categories) {
1074
- const publishedField = category.shop === Shops.GLAMSHOP ? 'publishedGlam' : 'published';
1075
- const productSnap = yield this.collection('products')
1076
- .where('categories', 'array-contains', category.id)
1077
- .where(publishedField, '==', true)
1078
- .where('stock.quantity', '>', 1)
1079
- .limit(limit)
1080
- .get();
1081
- const products = productSnap.docs.map((doc) => doc.data());
1082
- homeSections.push({ category, products });
1083
- }
1084
- return homeSections;
1085
- });
1086
- }
1087
- mountCategory(category) {
1088
- return __awaiter(this, void 0, void 0, function* () {
1089
- if (!category.products)
1090
- throw new RequiredArgumentError(['Category products is empty']);
1091
- const chunks = category.products.reduce((resultArray, item, index) => {
1092
- const chunkIndex = Math.floor(index / 10);
1093
- if (!resultArray[chunkIndex])
1094
- resultArray[chunkIndex] = [];
1095
- resultArray[chunkIndex].push(item);
1096
- return resultArray;
1097
- }, []);
1098
- const products = [];
1099
- const publishedField = category.shop === Shops.GLAMSHOP ? 'publishedGlam' : 'published';
1100
- yield Promise.all(chunks.map((productIds) => __awaiter(this, void 0, void 0, function* () {
1101
- const productSnap = yield this.collection('products')
1102
- .where(publishedField, '==', true)
1103
- .where('id', 'in', productIds)
1104
- .get();
1105
- if (productSnap.empty)
1106
- return;
1107
- products.push(...productSnap.docs.map((doc) => doc.data()));
1108
- })));
1109
- return products;
1110
- });
1111
- }
1044
+ class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1045
+ constructor(firestore) {
1046
+ super();
1047
+ this.firestore = firestore;
1048
+ this.collectionName = 'categories';
1049
+ this.model = Category;
1050
+ }
1051
+ getCategoryBySlug(slug, shop) {
1052
+ return this.collection(this.collectionName)
1053
+ .where('slug', '==', slug)
1054
+ .where('shop', '==', shop)
1055
+ .where('published', '==', true)
1056
+ .get()
1057
+ .then((snap) => {
1058
+ if (snap.size > 1)
1059
+ throw new DuplicatedResultsError('Query returned duplicated values');
1060
+ if (snap.empty)
1061
+ throw new NotFoundError(`Document with slug ${slug} not found`);
1062
+ return snap.docs[0].data();
1063
+ })
1064
+ .catch((error) => error);
1065
+ }
1066
+ getCategoriesForHome(categoryIds, limit = 4) {
1067
+ return __awaiter(this, void 0, void 0, function* () {
1068
+ const categorySnap = yield this.collection(this.collectionName)
1069
+ .where('id', 'in', categoryIds)
1070
+ .where('published', '==', true)
1071
+ .get();
1072
+ if (categorySnap.empty)
1073
+ throw new NotFoundError('Categories not found');
1074
+ const categories = categorySnap.docs.map((doc) => doc.data());
1075
+ const homeSections = [];
1076
+ for (const category of categories) {
1077
+ const publishedField = category.shop === Shops.GLAMSHOP ? 'publishedGlam' : 'published';
1078
+ const productSnap = yield this.collection('products')
1079
+ .where('categories', 'array-contains', category.id)
1080
+ .where(publishedField, '==', true)
1081
+ .where('stock.quantity', '>', 1)
1082
+ .limit(limit)
1083
+ .get();
1084
+ const products = productSnap.docs.map((doc) => doc.data());
1085
+ homeSections.push({ category, products });
1086
+ }
1087
+ return homeSections;
1088
+ });
1089
+ }
1090
+ mountCategory(category) {
1091
+ return __awaiter(this, void 0, void 0, function* () {
1092
+ if (!category.products)
1093
+ throw new RequiredArgumentError(['Category products is empty']);
1094
+ const chunks = category.products.reduce((resultArray, item, index) => {
1095
+ const chunkIndex = Math.floor(index / 10);
1096
+ if (!resultArray[chunkIndex])
1097
+ resultArray[chunkIndex] = [];
1098
+ resultArray[chunkIndex].push(item);
1099
+ return resultArray;
1100
+ }, []);
1101
+ const products = [];
1102
+ const publishedField = category.shop === Shops.GLAMSHOP ? 'publishedGlam' : 'published';
1103
+ yield Promise.all(chunks.map((productIds) => __awaiter(this, void 0, void 0, function* () {
1104
+ const productSnap = yield this.collection('products')
1105
+ .where(publishedField, '==', true)
1106
+ .where('id', 'in', productIds)
1107
+ .get();
1108
+ if (productSnap.empty)
1109
+ return;
1110
+ products.push(...productSnap.docs.map((doc) => doc.data()));
1111
+ })));
1112
+ return products;
1113
+ });
1114
+ }
1112
1115
  }
1113
1116
 
1114
- class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1115
- constructor(firestore) {
1116
- super();
1117
- this.firestore = firestore;
1118
- this.collectionName = 'products';
1119
- this.model = Product;
1120
- }
1121
- getBySlug(slug, shop) {
1122
- var _a;
1123
- return __awaiter(this, void 0, void 0, function* () {
1124
- const result = yield this.find([
1125
- { slug: { operator: Where.EQUALS, value: slug } },
1126
- { shopAvailability: { operator: Where.IN, value: [shop] } },
1127
- ]);
1128
- return (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.shift();
1129
- });
1130
- }
1117
+ class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1118
+ constructor(firestore) {
1119
+ super();
1120
+ this.firestore = firestore;
1121
+ this.collectionName = 'products';
1122
+ this.model = Product;
1123
+ }
1124
+ getBySlug(slug, shop) {
1125
+ var _a;
1126
+ return __awaiter(this, void 0, void 0, function* () {
1127
+ const result = yield this.find([
1128
+ { slug: { operator: Where.EQUALS, value: slug } },
1129
+ { shopAvailability: { operator: Where.IN, value: [shop] } },
1130
+ ]);
1131
+ return (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.shift();
1132
+ });
1133
+ }
1131
1134
  }
1132
1135
 
1133
- class ProductVariantFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Product) {
1134
- constructor(firestore, parentRepository) {
1135
- super();
1136
- this.firestore = firestore;
1137
- this.parentRepository = parentRepository;
1138
- this.collectionName = 'variants';
1139
- this.parentIdField = 'productId';
1140
- this.model = Variant;
1141
- }
1136
+ class ProductVariantFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Product) {
1137
+ constructor(firestore, parentRepository) {
1138
+ super();
1139
+ this.firestore = firestore;
1140
+ this.parentRepository = parentRepository;
1141
+ this.collectionName = 'variants';
1142
+ this.parentIdField = 'productId';
1143
+ this.model = Variant;
1144
+ }
1142
1145
  }
1143
1146
 
1144
- class CheckoutFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1145
- constructor(firestore) {
1146
- super();
1147
- this.firestore = firestore;
1148
- this.collectionName = 'checkouts';
1149
- this.model = Checkout;
1150
- }
1147
+ class CheckoutFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1148
+ constructor(firestore) {
1149
+ super();
1150
+ this.firestore = firestore;
1151
+ this.collectionName = 'checkouts';
1152
+ this.model = Checkout;
1153
+ }
1151
1154
  }
1152
1155
 
1153
- class CouponFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1154
- constructor(firestore) {
1155
- super();
1156
- this.firestore = firestore;
1157
- this.collectionName = 'coupons';
1158
- this.model = Coupon;
1159
- }
1156
+ class CouponFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1157
+ constructor(firestore) {
1158
+ super();
1159
+ this.firestore = firestore;
1160
+ this.collectionName = 'coupons';
1161
+ this.model = Coupon;
1162
+ }
1160
1163
  }
1161
1164
 
1162
- class OrderFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1163
- constructor(firestore) {
1164
- super();
1165
- this.firestore = firestore;
1166
- this.collectionName = 'orders';
1167
- this.model = Order;
1168
- }
1165
+ class OrderFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1166
+ constructor(firestore) {
1167
+ super();
1168
+ this.firestore = firestore;
1169
+ this.collectionName = 'orders';
1170
+ this.model = Order;
1171
+ }
1169
1172
  }
1170
1173
 
1171
- class PaymentFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1172
- constructor(firestore) {
1173
- super();
1174
- this.firestore = firestore;
1175
- this.collectionName = 'payments';
1176
- this.model = Payment;
1177
- }
1174
+ class PaymentFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1175
+ constructor(firestore) {
1176
+ super();
1177
+ this.firestore = firestore;
1178
+ this.collectionName = 'payments';
1179
+ this.model = Payment;
1180
+ }
1178
1181
  }
1179
1182
 
1180
- class CheckoutSubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1181
- constructor(firestore) {
1182
- super();
1183
- this.firestore = firestore;
1184
- this.collectionName = 'checkoutsSubscription';
1185
- this.model = CheckoutSubscription;
1186
- }
1183
+ class CheckoutSubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1184
+ constructor(firestore) {
1185
+ super();
1186
+ this.firestore = firestore;
1187
+ this.collectionName = 'checkoutsSubscription';
1188
+ this.model = CheckoutSubscription;
1189
+ }
1187
1190
  }
1188
1191
 
1189
- class SubscriptionPlanFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1190
- constructor(firestore) {
1191
- super();
1192
- this.firestore = firestore;
1193
- this.collectionName = 'subscriptionPlans';
1194
- this.model = SubscriptionPlan;
1195
- }
1192
+ class SubscriptionPlanFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1193
+ constructor(firestore) {
1194
+ super();
1195
+ this.firestore = firestore;
1196
+ this.collectionName = 'subscriptionPlans';
1197
+ this.model = SubscriptionPlan;
1198
+ }
1196
1199
  }
1197
1200
 
1198
- class Buy2WinFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1199
- constructor(firestore) {
1200
- super();
1201
- this.firestore = firestore;
1202
- this.collectionName = 'buy2win';
1203
- this.model = Buy2Win;
1204
- }
1201
+ class Buy2WinFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1202
+ constructor(firestore) {
1203
+ super();
1204
+ this.firestore = firestore;
1205
+ this.collectionName = 'buy2win';
1206
+ this.model = Buy2Win;
1207
+ }
1205
1208
  }
1206
1209
 
1207
- class LegacyOrderFirestoreRepository extends OrderFirestoreRepository {
1208
- constructor(firestore) {
1209
- super(firestore);
1210
- this.firestore = firestore;
1211
- this.collectionName = 'legacyOrders';
1212
- }
1210
+ class LegacyOrderFirestoreRepository extends OrderFirestoreRepository {
1211
+ constructor(firestore) {
1212
+ super(firestore);
1213
+ this.firestore = firestore;
1214
+ this.collectionName = 'legacyOrders';
1215
+ }
1213
1216
  }
1214
1217
 
1215
- class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1216
- constructor(firestore) {
1217
- super();
1218
- this.firestore = firestore;
1219
- this.collectionName = 'dms';
1220
- this.model = Home;
1221
- }
1218
+ class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1219
+ constructor(firestore) {
1220
+ super();
1221
+ this.firestore = firestore;
1222
+ this.collectionName = 'dms';
1223
+ this.model = Home;
1224
+ }
1222
1225
  }
1223
1226
 
1224
- class ShopMenuFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1225
- constructor(firestore) {
1226
- super();
1227
- this.firestore = firestore;
1228
- this.collectionName = 'shopMenus';
1229
- this.model = ShopMenu;
1230
- }
1227
+ class ShopMenuFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1228
+ constructor(firestore) {
1229
+ super();
1230
+ this.firestore = firestore;
1231
+ this.collectionName = 'shopMenus';
1232
+ this.model = ShopMenu;
1233
+ }
1231
1234
  }
1232
1235
 
1233
- class AuthenticationFirebaseAuthService {
1234
- constructor(firebaseAuth) {
1235
- this.firebaseAuth = firebaseAuth;
1236
- }
1237
- signInWithEmailAndPassword(data) {
1238
- return __awaiter(this, void 0, void 0, function* () {
1239
- const credentials = yield this.firebaseAuth.signInWithEmailAndPassword(data.email, data.password);
1240
- const user = credentials.user;
1241
- return { id: user.uid, displayName: user.displayName, email: user.email, phone: user.phoneNumber };
1242
- });
1243
- }
1244
- signInWithGoogle() {
1245
- return __awaiter(this, void 0, void 0, function* () {
1246
- const credentials = yield this.firebaseAuth.signInWithPopup(new firebase$1.auth.GoogleAuthProvider());
1247
- const user = credentials.user;
1248
- return { id: user.uid, displayName: user.displayName, email: user.email, phone: user.phoneNumber };
1249
- });
1250
- }
1251
- signOut() {
1252
- return __awaiter(this, void 0, void 0, function* () {
1253
- this.firebaseAuth.signOut();
1254
- });
1255
- }
1236
+ class AuthenticationFirebaseAuthService {
1237
+ constructor(firebaseAuth) {
1238
+ this.firebaseAuth = firebaseAuth;
1239
+ }
1240
+ signInWithEmailAndPassword(data) {
1241
+ return __awaiter(this, void 0, void 0, function* () {
1242
+ const credentials = yield this.firebaseAuth.signInWithEmailAndPassword(data.email, data.password);
1243
+ const user = credentials.user;
1244
+ return { id: user.uid, displayName: user.displayName, email: user.email, phone: user.phoneNumber };
1245
+ });
1246
+ }
1247
+ signInWithGoogle() {
1248
+ return __awaiter(this, void 0, void 0, function* () {
1249
+ const credentials = yield this.firebaseAuth.signInWithPopup(new firebase$1.auth.GoogleAuthProvider());
1250
+ const user = credentials.user;
1251
+ return { id: user.uid, displayName: user.displayName, email: user.email, phone: user.phoneNumber };
1252
+ });
1253
+ }
1254
+ signOut() {
1255
+ return __awaiter(this, void 0, void 0, function* () {
1256
+ this.firebaseAuth.signOut();
1257
+ });
1258
+ }
1259
+ signInAnonymously() {
1260
+ return __awaiter(this, void 0, void 0, function* () {
1261
+ const auth = yield this.firebaseAuth.signInAnonymously();
1262
+ return auth.user;
1263
+ });
1264
+ }
1256
1265
  }
1257
1266
 
1258
- /**
1259
- * Generated bundle index. Do not edit.
1267
+ /**
1268
+ * Generated bundle index. Do not edit.
1260
1269
  */
1261
1270
 
1262
1271
  export { Address, Area, Authentication, AuthenticationFirebaseAuthService, Base, BaseModel, BeardSizes, BeautyProfile, BillingStatus, Buy2Win, Buy2WinFirestoreRepository, Category, CategoryFirestoreRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, Coupon, CouponFirestoreRepository, CouponSubtypes, CouponTypes, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FinancialCoupon, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, NotFoundError, OfficePosition, Order, OrderFirestoreRepository, OrderStatus, Payment, PaymentFirestoreRepository, PaymentType, Product, ProductFirestoreRepository, ProductVariantFirestoreRepository, RequiredArgumentError, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, Shops, SignInMethods, SignOut, Status, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, UnauthorizedError, UpdateOptionActions, User, UserAddress, UserAddressFirestoreRepository, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, Where, withCreateFirestore, withCrudFirestore, withDeleteFirestore, withFindFirestore, withFirestore, withGetFirestore, withHelpers, withSubCollection, withUpdateFirestore };