@infrab4a/connect 0.8.3 → 0.9.1

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