@infrab4a/connect 0.3.1 → 0.4.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 (380) hide show
  1. package/README.md +24 -24
  2. package/bundles/infrab4a-connect.umd.js +1447 -1422
  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 +7 -7
  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 -6
  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 -0
  59. package/esm2015/lib/domain/shop-settings/models/home.js +7 -0
  60. package/esm2015/lib/domain/shop-settings/models/index.js +3 -0
  61. package/esm2015/lib/domain/shop-settings/models/types/banner.type.js +2 -0
  62. package/esm2015/lib/domain/shop-settings/models/types/benefit.type.js +2 -0
  63. package/esm2015/lib/domain/shop-settings/models/types/index.js +3 -0
  64. package/esm2015/lib/domain/shop-settings/repositories/home.repository.js +2 -0
  65. package/esm2015/lib/domain/shop-settings/repositories/index.js +2 -0
  66. package/esm2015/lib/domain/shopping/index.js +3 -3
  67. package/esm2015/lib/domain/shopping/models/buy-2-win.js +7 -7
  68. package/esm2015/lib/domain/shopping/models/checkout.js +7 -7
  69. package/esm2015/lib/domain/shopping/models/coupons/coupon.js +15 -15
  70. package/esm2015/lib/domain/shopping/models/coupons/enums/coupon-subtypes.enum.js +6 -6
  71. package/esm2015/lib/domain/shopping/models/coupons/enums/coupon-types.enum.js +8 -8
  72. package/esm2015/lib/domain/shopping/models/coupons/enums/exclusivities.enum.js +7 -7
  73. package/esm2015/lib/domain/shopping/models/coupons/enums/index.js +4 -4
  74. package/esm2015/lib/domain/shopping/models/coupons/financial-coupon.js +28 -28
  75. package/esm2015/lib/domain/shopping/models/coupons/index.js +4 -4
  76. package/esm2015/lib/domain/shopping/models/enums/checkout-types.enum.js +6 -6
  77. package/esm2015/lib/domain/shopping/models/enums/index.js +3 -3
  78. package/esm2015/lib/domain/shopping/models/enums/order-status.enum.js +12 -12
  79. package/esm2015/lib/domain/shopping/models/index.js +12 -12
  80. package/esm2015/lib/domain/shopping/models/line-item.js +4 -4
  81. package/esm2015/lib/domain/shopping/models/order.js +4 -4
  82. package/esm2015/lib/domain/shopping/models/payment.js +129 -129
  83. package/esm2015/lib/domain/shopping/models/shipping-method.js +7 -7
  84. package/esm2015/lib/domain/shopping/models/subscription/checkout.js +7 -7
  85. package/esm2015/lib/domain/shopping/models/subscription/index.js +3 -3
  86. package/esm2015/lib/domain/shopping/models/subscription/plan.js +7 -7
  87. package/esm2015/lib/domain/shopping/models/types/index.js +8 -8
  88. package/esm2015/lib/domain/shopping/models/types/payment-address.type.js +2 -2
  89. package/esm2015/lib/domain/shopping/models/types/payment-billing.type.js +2 -2
  90. package/esm2015/lib/domain/shopping/models/types/payment-card.type.js +2 -2
  91. package/esm2015/lib/domain/shopping/models/types/payment-customer.type.js +2 -2
  92. package/esm2015/lib/domain/shopping/models/types/payment-document.type.js +2 -2
  93. package/esm2015/lib/domain/shopping/models/types/payment-item.type.js +2 -2
  94. package/esm2015/lib/domain/shopping/models/types/payment-shipping.type.js +2 -2
  95. package/esm2015/lib/domain/shopping/repositories/buy-2-win.repository.js +2 -2
  96. package/esm2015/lib/domain/shopping/repositories/checkout.repository.js +2 -2
  97. package/esm2015/lib/domain/shopping/repositories/coupon.repository.js +2 -2
  98. package/esm2015/lib/domain/shopping/repositories/index.js +7 -7
  99. package/esm2015/lib/domain/shopping/repositories/order.repository.js +2 -2
  100. package/esm2015/lib/domain/shopping/repositories/payment.repository.js +2 -2
  101. package/esm2015/lib/domain/shopping/repositories/subscription/checkout.repository.js +2 -2
  102. package/esm2015/lib/domain/shopping/repositories/subscription/index.js +3 -3
  103. package/esm2015/lib/domain/shopping/repositories/subscription/plan.repository.js +2 -2
  104. package/esm2015/lib/domain/users/errors/index.js +2 -2
  105. package/esm2015/lib/domain/users/errors/unauthorized.error.js +7 -7
  106. package/esm2015/lib/domain/users/index.js +6 -6
  107. package/esm2015/lib/domain/users/models/beauty-profile.js +12 -12
  108. package/esm2015/lib/domain/users/models/enums/area.enum.js +13 -13
  109. package/esm2015/lib/domain/users/models/enums/beard-sizes.enum.js +9 -9
  110. package/esm2015/lib/domain/users/models/enums/hair-types.enum.js +9 -9
  111. package/esm2015/lib/domain/users/models/enums/index.js +7 -7
  112. package/esm2015/lib/domain/users/models/enums/office-position.enum.js +8 -8
  113. package/esm2015/lib/domain/users/models/enums/user-type.enum.js +10 -10
  114. package/esm2015/lib/domain/users/models/index.js +6 -6
  115. package/esm2015/lib/domain/users/models/subscription/edition.js +7 -7
  116. package/esm2015/lib/domain/users/models/subscription/enums/billing-status.enum.js +5 -5
  117. package/esm2015/lib/domain/users/models/subscription/enums/edition-status.enum.js +5 -5
  118. package/esm2015/lib/domain/users/models/subscription/enums/index.js +5 -5
  119. package/esm2015/lib/domain/users/models/subscription/enums/payment-type.enum.js +7 -7
  120. package/esm2015/lib/domain/users/models/subscription/enums/status.enum.js +5 -5
  121. package/esm2015/lib/domain/users/models/subscription/index.js +5 -5
  122. package/esm2015/lib/domain/users/models/subscription/payment.js +7 -7
  123. package/esm2015/lib/domain/users/models/subscription/subscription.js +7 -7
  124. package/esm2015/lib/domain/users/models/user-address.js +7 -7
  125. package/esm2015/lib/domain/users/models/user.js +17 -17
  126. package/esm2015/lib/domain/users/repositories/beauty-profile.repository.js +2 -2
  127. package/esm2015/lib/domain/users/repositories/edition.repository.js +2 -2
  128. package/esm2015/lib/domain/users/repositories/index.js +7 -7
  129. package/esm2015/lib/domain/users/repositories/subscription-payment.repository.js +2 -2
  130. package/esm2015/lib/domain/users/repositories/subscription.repository.js +2 -2
  131. package/esm2015/lib/domain/users/repositories/user-address.repository.js +2 -2
  132. package/esm2015/lib/domain/users/repositories/user.repository.js +2 -2
  133. package/esm2015/lib/domain/users/services/authentication.service.js +2 -2
  134. package/esm2015/lib/domain/users/services/index.js +2 -2
  135. package/esm2015/lib/domain/users/use-cases/authentication.js +40 -40
  136. package/esm2015/lib/domain/users/use-cases/index.js +3 -3
  137. package/esm2015/lib/domain/users/use-cases/signout.js +12 -12
  138. package/esm2015/lib/errors/index.js +4 -4
  139. package/esm2015/lib/errors/invalid-argument.error.js +7 -7
  140. package/esm2015/lib/errors/not-found.error.js +7 -7
  141. package/esm2015/lib/errors/required-argument.error.js +8 -8
  142. package/esm2015/lib/index.js +5 -5
  143. package/esm2015/lib/infra/firebase/auth/authentication-firebase-auth.service.js +27 -27
  144. package/esm2015/lib/infra/firebase/auth/index.js +2 -2
  145. package/esm2015/lib/infra/firebase/firestore/index.js +4 -4
  146. package/esm2015/lib/infra/firebase/firestore/mixins/index.js +10 -10
  147. package/esm2015/lib/infra/firebase/firestore/mixins/with-create-firestore.mixin.js +30 -30
  148. package/esm2015/lib/infra/firebase/firestore/mixins/with-crud-firestore.mixin.js +10 -10
  149. package/esm2015/lib/infra/firebase/firestore/mixins/with-delete-firestore.mixin.js +18 -18
  150. package/esm2015/lib/infra/firebase/firestore/mixins/with-find-firestore.mixin.js +62 -62
  151. package/esm2015/lib/infra/firebase/firestore/mixins/with-firestore.mixin.js +26 -26
  152. package/esm2015/lib/infra/firebase/firestore/mixins/with-get-firestore.mixin.js +24 -24
  153. package/esm2015/lib/infra/firebase/firestore/mixins/with-helpers.mixin.js +17 -17
  154. package/esm2015/lib/infra/firebase/firestore/mixins/with-sub-collection.mixin.js +11 -11
  155. package/esm2015/lib/infra/firebase/firestore/mixins/with-update-firestore.mixin.js +43 -43
  156. package/esm2015/lib/infra/firebase/firestore/repositories/catalog/category-firestore.repository.js +12 -12
  157. package/esm2015/lib/infra/firebase/firestore/repositories/catalog/index.js +4 -4
  158. package/esm2015/lib/infra/firebase/firestore/repositories/catalog/product-firestore.repository.js +12 -12
  159. package/esm2015/lib/infra/firebase/firestore/repositories/catalog/product-variant-firestore.repository.js +14 -14
  160. package/esm2015/lib/infra/firebase/firestore/repositories/index.js +5 -4
  161. package/esm2015/lib/infra/firebase/firestore/repositories/shop-settings/home-firestore.repository.js +12 -0
  162. package/esm2015/lib/infra/firebase/firestore/repositories/shop-settings/index.js +2 -0
  163. package/esm2015/lib/infra/firebase/firestore/repositories/shopping/buy-2-win-firestore.repository.js +12 -12
  164. package/esm2015/lib/infra/firebase/firestore/repositories/shopping/checkout-firestore.repository.js +12 -12
  165. package/esm2015/lib/infra/firebase/firestore/repositories/shopping/checkout-subscription-firestore.repository.js +12 -12
  166. package/esm2015/lib/infra/firebase/firestore/repositories/shopping/coupon-firestore.repository.js +12 -12
  167. package/esm2015/lib/infra/firebase/firestore/repositories/shopping/index.js +8 -8
  168. package/esm2015/lib/infra/firebase/firestore/repositories/shopping/order-firestore.repository.js +12 -12
  169. package/esm2015/lib/infra/firebase/firestore/repositories/shopping/payment-firestore.repository.js +12 -12
  170. package/esm2015/lib/infra/firebase/firestore/repositories/shopping/subscription-plan-firestore.repository.js +12 -12
  171. package/esm2015/lib/infra/firebase/firestore/repositories/users/index.js +7 -7
  172. package/esm2015/lib/infra/firebase/firestore/repositories/users/subscription-edition-firestore.repository.js +14 -14
  173. package/esm2015/lib/infra/firebase/firestore/repositories/users/subscription-firestore.repository.js +12 -12
  174. package/esm2015/lib/infra/firebase/firestore/repositories/users/subscription-payment-firestore.repository.js +14 -14
  175. package/esm2015/lib/infra/firebase/firestore/repositories/users/user-address-firestore.repository.js +14 -14
  176. package/esm2015/lib/infra/firebase/firestore/repositories/users/user-beauty-profile-firestore.repository.js +14 -14
  177. package/esm2015/lib/infra/firebase/firestore/repositories/users/user-firestore.repository.js +40 -40
  178. package/esm2015/lib/infra/firebase/firestore/types/firestore-sub.repository.type.js +2 -2
  179. package/esm2015/lib/infra/firebase/firestore/types/firestore.helpers.type.js +2 -2
  180. package/esm2015/lib/infra/firebase/firestore/types/firestore.repository.type.js +2 -2
  181. package/esm2015/lib/infra/firebase/firestore/types/index.js +4 -4
  182. package/esm2015/lib/infra/firebase/index.js +3 -3
  183. package/esm2015/lib/infra/index.js +2 -2
  184. package/esm2015/lib/utils/index.js +5 -5
  185. package/esm2015/lib/utils/mixins/base.mixin.js +6 -6
  186. package/esm2015/lib/utils/mixins/index.js +3 -3
  187. package/esm2015/lib/utils/mixins/mixin-ctor.type.js +2 -2
  188. package/esm2015/lib/utils/types/index.js +2 -2
  189. package/esm2015/lib/utils/types/prop.type.js +2 -2
  190. package/esm2015/public-api.js +2 -2
  191. package/fesm2015/infrab4a-connect.js +883 -868
  192. package/fesm2015/infrab4a-connect.js.map +1 -1
  193. package/infrab4a-connect.d.ts +5 -5
  194. package/lib/domain/catalog/index.d.ts +2 -2
  195. package/lib/domain/catalog/models/category.d.ts +20 -20
  196. package/lib/domain/catalog/models/enums/index.d.ts +1 -1
  197. package/lib/domain/catalog/models/enums/shops.enum.d.ts +4 -4
  198. package/lib/domain/catalog/models/index.d.ts +5 -5
  199. package/lib/domain/catalog/models/product.d.ts +31 -31
  200. package/lib/domain/catalog/models/types/category-condition.type.d.ts +4 -4
  201. package/lib/domain/catalog/models/types/category-filter.type.d.ts +4 -4
  202. package/lib/domain/catalog/models/types/index.d.ts +7 -7
  203. package/lib/domain/catalog/models/types/product-review.type.d.ts +12 -12
  204. package/lib/domain/catalog/models/types/shops-description.type.d.ts +7 -7
  205. package/lib/domain/catalog/models/types/shops-price.type.d.ts +10 -10
  206. package/lib/domain/catalog/models/types/stock.type.d.ts +3 -3
  207. package/lib/domain/catalog/models/types/variant-grade.type.d.ts +4 -4
  208. package/lib/domain/catalog/models/variant.d.ts +12 -12
  209. package/lib/domain/catalog/repositories/category.repository.d.ts +4 -4
  210. package/lib/domain/catalog/repositories/index.d.ts +3 -3
  211. package/lib/domain/catalog/repositories/product.repository.d.ts +4 -4
  212. package/lib/domain/catalog/repositories/variant.repository.d.ts +4 -4
  213. package/lib/domain/general/index.d.ts +2 -2
  214. package/lib/domain/general/model/base-model-with-identifier-fields.d.ts +3 -3
  215. package/lib/domain/general/model/base.model.d.ts +6 -6
  216. package/lib/domain/general/model/identifier-fields.d.ts +4 -4
  217. package/lib/domain/general/model/index.d.ts +4 -4
  218. package/lib/domain/general/model/types/base-model-builder.type.d.ts +5 -5
  219. package/lib/domain/general/model/types/index.d.ts +3 -3
  220. package/lib/domain/general/model/types/non-function-properties.type.d.ts +2 -2
  221. package/lib/domain/general/model/types/non-function-property-name.type.d.ts +3 -3
  222. package/lib/domain/general/repository/create.repository.d.ts +5 -5
  223. package/lib/domain/general/repository/crud.repository.d.ts +7 -7
  224. package/lib/domain/general/repository/delete.repository.d.ts +5 -5
  225. package/lib/domain/general/repository/enums/index.d.ts +2 -2
  226. package/lib/domain/general/repository/enums/update-option-actions.enum.d.ts +7 -7
  227. package/lib/domain/general/repository/enums/where.enum.d.ts +9 -9
  228. package/lib/domain/general/repository/find.repository.d.ts +5 -5
  229. package/lib/domain/general/repository/get.repository.d.ts +5 -5
  230. package/lib/domain/general/repository/index.d.ts +9 -9
  231. package/lib/domain/general/repository/read.repository.d.ts +5 -5
  232. package/lib/domain/general/repository/types/index.d.ts +5 -5
  233. package/lib/domain/general/repository/types/repository-find-filters.type.d.ts +10 -10
  234. package/lib/domain/general/repository/types/repository-find-result.type.d.ts +4 -4
  235. package/lib/domain/general/repository/types/repository-limit-options.type.d.ts +4 -4
  236. package/lib/domain/general/repository/types/repository-order-by-list.type.d.ts +5 -5
  237. package/lib/domain/general/repository/types/repository-update-params.type.d.ts +11 -11
  238. package/lib/domain/general/repository/update.repository.d.ts +5 -5
  239. package/lib/domain/index.d.ts +6 -5
  240. package/lib/domain/location/index.d.ts +1 -1
  241. package/lib/domain/location/models/address.d.ts +21 -21
  242. package/lib/domain/location/models/index.d.ts +2 -2
  243. package/lib/domain/location/models/types/index.d.ts +3 -3
  244. package/lib/domain/location/models/types/location-bound.type.d.ts +6 -6
  245. package/lib/domain/location/models/types/location-geometry.type.d.ts +7 -7
  246. package/lib/domain/location/models/types/location-lat-lng.type.d.ts +4 -4
  247. package/lib/domain/shop-settings/index.d.ts +2 -0
  248. package/lib/domain/shop-settings/models/home.d.ts +17 -0
  249. package/lib/domain/shop-settings/models/index.d.ts +2 -0
  250. package/lib/domain/shop-settings/models/types/banner.type.d.ts +6 -0
  251. package/lib/domain/shop-settings/models/types/benefit.type.d.ts +5 -0
  252. package/lib/domain/shop-settings/models/types/index.d.ts +2 -0
  253. package/lib/domain/shop-settings/repositories/home.repository.d.ts +4 -0
  254. package/lib/domain/shop-settings/repositories/index.d.ts +1 -0
  255. package/lib/domain/shopping/index.d.ts +2 -2
  256. package/lib/domain/shopping/models/buy-2-win.d.ts +18 -18
  257. package/lib/domain/shopping/models/checkout.d.ts +28 -28
  258. package/lib/domain/shopping/models/coupons/coupon.d.ts +25 -25
  259. package/lib/domain/shopping/models/coupons/enums/coupon-subtypes.enum.d.ts +4 -4
  260. package/lib/domain/shopping/models/coupons/enums/coupon-types.enum.d.ts +6 -6
  261. package/lib/domain/shopping/models/coupons/enums/exclusivities.enum.d.ts +5 -5
  262. package/lib/domain/shopping/models/coupons/enums/index.d.ts +3 -3
  263. package/lib/domain/shopping/models/coupons/financial-coupon.d.ts +8 -8
  264. package/lib/domain/shopping/models/coupons/index.d.ts +3 -3
  265. package/lib/domain/shopping/models/enums/checkout-types.enum.d.ts +4 -4
  266. package/lib/domain/shopping/models/enums/index.d.ts +2 -2
  267. package/lib/domain/shopping/models/enums/order-status.enum.d.ts +10 -10
  268. package/lib/domain/shopping/models/index.d.ts +11 -11
  269. package/lib/domain/shopping/models/line-item.d.ts +7 -7
  270. package/lib/domain/shopping/models/order.d.ts +7 -7
  271. package/lib/domain/shopping/models/payment.d.ts +69 -69
  272. package/lib/domain/shopping/models/shipping-method.d.ts +18 -18
  273. package/lib/domain/shopping/models/subscription/checkout.d.ts +23 -23
  274. package/lib/domain/shopping/models/subscription/index.d.ts +2 -2
  275. package/lib/domain/shopping/models/subscription/plan.d.ts +12 -12
  276. package/lib/domain/shopping/models/types/index.d.ts +7 -7
  277. package/lib/domain/shopping/models/types/payment-address.type.d.ts +12 -12
  278. package/lib/domain/shopping/models/types/payment-billing.type.d.ts +7 -7
  279. package/lib/domain/shopping/models/types/payment-card.type.d.ts +14 -14
  280. package/lib/domain/shopping/models/types/payment-customer.type.d.ts +18 -18
  281. package/lib/domain/shopping/models/types/payment-document.type.d.ts +6 -6
  282. package/lib/domain/shopping/models/types/payment-item.type.d.ts +11 -11
  283. package/lib/domain/shopping/models/types/payment-shipping.type.d.ts +10 -10
  284. package/lib/domain/shopping/repositories/buy-2-win.repository.d.ts +4 -4
  285. package/lib/domain/shopping/repositories/checkout.repository.d.ts +4 -4
  286. package/lib/domain/shopping/repositories/coupon.repository.d.ts +4 -4
  287. package/lib/domain/shopping/repositories/index.d.ts +6 -6
  288. package/lib/domain/shopping/repositories/order.repository.d.ts +4 -4
  289. package/lib/domain/shopping/repositories/payment.repository.d.ts +4 -4
  290. package/lib/domain/shopping/repositories/subscription/checkout.repository.d.ts +4 -4
  291. package/lib/domain/shopping/repositories/subscription/index.d.ts +2 -2
  292. package/lib/domain/shopping/repositories/subscription/plan.repository.d.ts +4 -4
  293. package/lib/domain/users/errors/index.d.ts +1 -1
  294. package/lib/domain/users/errors/unauthorized.error.d.ts +4 -4
  295. package/lib/domain/users/index.d.ts +5 -5
  296. package/lib/domain/users/models/beauty-profile.d.ts +12 -12
  297. package/lib/domain/users/models/enums/area.enum.d.ts +11 -11
  298. package/lib/domain/users/models/enums/beard-sizes.enum.d.ts +7 -7
  299. package/lib/domain/users/models/enums/hair-types.enum.d.ts +7 -7
  300. package/lib/domain/users/models/enums/index.d.ts +6 -6
  301. package/lib/domain/users/models/enums/office-position.enum.d.ts +6 -6
  302. package/lib/domain/users/models/enums/user-type.enum.d.ts +8 -8
  303. package/lib/domain/users/models/index.d.ts +5 -5
  304. package/lib/domain/users/models/subscription/edition.d.ts +15 -15
  305. package/lib/domain/users/models/subscription/enums/billing-status.enum.d.ts +3 -3
  306. package/lib/domain/users/models/subscription/enums/edition-status.enum.d.ts +3 -3
  307. package/lib/domain/users/models/subscription/enums/index.d.ts +4 -4
  308. package/lib/domain/users/models/subscription/enums/payment-type.enum.d.ts +5 -5
  309. package/lib/domain/users/models/subscription/enums/status.enum.d.ts +3 -3
  310. package/lib/domain/users/models/subscription/index.d.ts +4 -4
  311. package/lib/domain/users/models/subscription/payment.d.ts +14 -14
  312. package/lib/domain/users/models/subscription/subscription.d.ts +30 -30
  313. package/lib/domain/users/models/user-address.d.ts +7 -7
  314. package/lib/domain/users/models/user.d.ts +23 -23
  315. package/lib/domain/users/repositories/beauty-profile.repository.d.ts +4 -4
  316. package/lib/domain/users/repositories/edition.repository.d.ts +4 -4
  317. package/lib/domain/users/repositories/index.d.ts +6 -6
  318. package/lib/domain/users/repositories/subscription-payment.repository.d.ts +4 -4
  319. package/lib/domain/users/repositories/subscription.repository.d.ts +4 -4
  320. package/lib/domain/users/repositories/user-address.repository.d.ts +4 -4
  321. package/lib/domain/users/repositories/user.repository.d.ts +4 -4
  322. package/lib/domain/users/services/authentication.service.d.ts +10 -10
  323. package/lib/domain/users/services/index.d.ts +1 -1
  324. package/lib/domain/users/use-cases/authentication.d.ts +21 -21
  325. package/lib/domain/users/use-cases/index.d.ts +2 -2
  326. package/lib/domain/users/use-cases/signout.d.ts +6 -6
  327. package/lib/errors/index.d.ts +3 -3
  328. package/lib/errors/invalid-argument.error.d.ts +4 -4
  329. package/lib/errors/not-found.error.d.ts +4 -4
  330. package/lib/errors/required-argument.error.d.ts +5 -5
  331. package/lib/index.d.ts +4 -4
  332. package/lib/infra/firebase/auth/authentication-firebase-auth.service.d.ts +9 -9
  333. package/lib/infra/firebase/auth/index.d.ts +1 -1
  334. package/lib/infra/firebase/firestore/index.d.ts +3 -3
  335. package/lib/infra/firebase/firestore/mixins/index.d.ts +9 -9
  336. package/lib/infra/firebase/firestore/mixins/with-create-firestore.mixin.d.ts +17 -17
  337. package/lib/infra/firebase/firestore/mixins/with-crud-firestore.mixin.d.ts +29 -29
  338. package/lib/infra/firebase/firestore/mixins/with-delete-firestore.mixin.d.ts +15 -15
  339. package/lib/infra/firebase/firestore/mixins/with-find-firestore.mixin.d.ts +20 -20
  340. package/lib/infra/firebase/firestore/mixins/with-firestore.mixin.d.ts +15 -15
  341. package/lib/infra/firebase/firestore/mixins/with-get-firestore.mixin.d.ts +15 -15
  342. package/lib/infra/firebase/firestore/mixins/with-helpers.mixin.d.ts +10 -10
  343. package/lib/infra/firebase/firestore/mixins/with-sub-collection.mixin.d.ts +14 -14
  344. package/lib/infra/firebase/firestore/mixins/with-update-firestore.mixin.d.ts +16 -16
  345. package/lib/infra/firebase/firestore/repositories/catalog/category-firestore.repository.d.ts +49 -49
  346. package/lib/infra/firebase/firestore/repositories/catalog/index.d.ts +3 -3
  347. package/lib/infra/firebase/firestore/repositories/catalog/product-firestore.repository.d.ts +49 -49
  348. package/lib/infra/firebase/firestore/repositories/catalog/product-variant-firestore.repository.d.ts +60 -60
  349. package/lib/infra/firebase/firestore/repositories/index.d.ts +4 -3
  350. package/lib/infra/firebase/firestore/repositories/shop-settings/home-firestore.repository.d.ts +49 -0
  351. package/lib/infra/firebase/firestore/repositories/shop-settings/index.d.ts +1 -0
  352. package/lib/infra/firebase/firestore/repositories/shopping/buy-2-win-firestore.repository.d.ts +49 -49
  353. package/lib/infra/firebase/firestore/repositories/shopping/checkout-firestore.repository.d.ts +49 -49
  354. package/lib/infra/firebase/firestore/repositories/shopping/checkout-subscription-firestore.repository.d.ts +49 -49
  355. package/lib/infra/firebase/firestore/repositories/shopping/coupon-firestore.repository.d.ts +49 -49
  356. package/lib/infra/firebase/firestore/repositories/shopping/index.d.ts +7 -7
  357. package/lib/infra/firebase/firestore/repositories/shopping/order-firestore.repository.d.ts +49 -49
  358. package/lib/infra/firebase/firestore/repositories/shopping/payment-firestore.repository.d.ts +49 -49
  359. package/lib/infra/firebase/firestore/repositories/shopping/subscription-plan-firestore.repository.d.ts +49 -49
  360. package/lib/infra/firebase/firestore/repositories/users/index.d.ts +6 -6
  361. package/lib/infra/firebase/firestore/repositories/users/subscription-edition-firestore.repository.d.ts +60 -60
  362. package/lib/infra/firebase/firestore/repositories/users/subscription-firestore.repository.d.ts +49 -49
  363. package/lib/infra/firebase/firestore/repositories/users/subscription-payment-firestore.repository.d.ts +60 -60
  364. package/lib/infra/firebase/firestore/repositories/users/user-address-firestore.repository.d.ts +60 -60
  365. package/lib/infra/firebase/firestore/repositories/users/user-beauty-profile-firestore.repository.d.ts +60 -60
  366. package/lib/infra/firebase/firestore/repositories/users/user-firestore.repository.d.ts +52 -52
  367. package/lib/infra/firebase/firestore/types/firestore-sub.repository.type.d.ts +6 -6
  368. package/lib/infra/firebase/firestore/types/firestore.helpers.type.d.ts +8 -8
  369. package/lib/infra/firebase/firestore/types/firestore.repository.type.d.ts +8 -8
  370. package/lib/infra/firebase/firestore/types/index.d.ts +3 -3
  371. package/lib/infra/firebase/index.d.ts +2 -2
  372. package/lib/infra/index.d.ts +1 -1
  373. package/lib/utils/index.d.ts +4 -4
  374. package/lib/utils/mixins/base.mixin.d.ts +3 -3
  375. package/lib/utils/mixins/index.d.ts +2 -2
  376. package/lib/utils/mixins/mixin-ctor.type.d.ts +1 -1
  377. package/lib/utils/types/index.d.ts +1 -1
  378. package/lib/utils/types/prop.type.d.ts +1 -1
  379. package/package.json +1 -1
  380. package/public-api.d.ts +1 -1
@@ -6,936 +6,951 @@ import { Md5 } from 'ts-md5';
6
6
  import firebase from 'firebase';
7
7
  import firebase$1 from 'firebase/app';
8
8
 
9
- class BaseModel {
10
- constructor(args) {
11
- Object.assign(this, args);
12
- }
13
- static toInstance(data) {
14
- return plainToClass(this, data);
15
- }
16
- toPlain() {
17
- return classToPlain(this, { exposeUnsetFields: false });
18
- }
19
- }
20
-
21
- var Where;
22
- (function (Where) {
23
- Where["EQUALS"] = "==";
24
- Where["GT"] = ">";
25
- Where["GTE"] = ">=";
26
- Where["IN"] = "in";
27
- Where["LT"] = "<";
28
- Where["LTE"] = "<=";
29
- Where["LIKE"] = "like";
9
+ class BaseModel {
10
+ constructor(args) {
11
+ Object.assign(this, args);
12
+ }
13
+ static toInstance(data) {
14
+ return plainToClass(this, data);
15
+ }
16
+ toPlain() {
17
+ return classToPlain(this, { exposeUnsetFields: false });
18
+ }
19
+ }
20
+
21
+ var Where;
22
+ (function (Where) {
23
+ Where["EQUALS"] = "==";
24
+ Where["GT"] = ">";
25
+ Where["GTE"] = ">=";
26
+ Where["IN"] = "in";
27
+ Where["LT"] = "<";
28
+ Where["LTE"] = "<=";
29
+ Where["LIKE"] = "like";
30
30
  })(Where || (Where = {}));
31
31
 
32
- var UpdateOptionActions;
33
- (function (UpdateOptionActions) {
34
- UpdateOptionActions["UPDATE"] = "update";
35
- UpdateOptionActions["MERGE"] = "merge";
36
- UpdateOptionActions["REMOVE"] = "remove";
37
- UpdateOptionActions["REMOVE_FIELD"] = "removeField";
38
- UpdateOptionActions["NULL"] = "null";
32
+ var UpdateOptionActions;
33
+ (function (UpdateOptionActions) {
34
+ UpdateOptionActions["UPDATE"] = "update";
35
+ UpdateOptionActions["MERGE"] = "merge";
36
+ UpdateOptionActions["REMOVE"] = "remove";
37
+ UpdateOptionActions["REMOVE_FIELD"] = "removeField";
38
+ UpdateOptionActions["NULL"] = "null";
39
39
  })(UpdateOptionActions || (UpdateOptionActions = {}));
40
40
 
41
- var UserType;
42
- (function (UserType) {
43
- UserType["B2C"] = "Cliente Transacional";
44
- UserType["GlamGirl"] = "Glamgirl";
45
- UserType["MensBoy"] = "Mensboy";
46
- UserType["B2B"] = "Company";
47
- UserType["Collaborator"] = "Funcion\u00E1rio";
48
- UserType["Influencer"] = "Influencer";
41
+ var UserType;
42
+ (function (UserType) {
43
+ UserType["B2C"] = "Cliente Transacional";
44
+ UserType["GlamGirl"] = "Glamgirl";
45
+ UserType["MensBoy"] = "Mensboy";
46
+ UserType["B2B"] = "Company";
47
+ UserType["Collaborator"] = "Funcion\u00E1rio";
48
+ UserType["Influencer"] = "Influencer";
49
49
  })(UserType || (UserType = {}));
50
50
 
51
- var BeardSizes;
52
- (function (BeardSizes) {
53
- BeardSizes["BIG"] = "Grande";
54
- BeardSizes["MEDIUM"] = "M\u00E9dia";
55
- BeardSizes["SHORT"] = "Curta";
56
- BeardSizes["MUSTACHE"] = "Bigode";
57
- BeardSizes["NOTHING"] = "Sem Barba";
51
+ var BeardSizes;
52
+ (function (BeardSizes) {
53
+ BeardSizes["BIG"] = "Grande";
54
+ BeardSizes["MEDIUM"] = "M\u00E9dia";
55
+ BeardSizes["SHORT"] = "Curta";
56
+ BeardSizes["MUSTACHE"] = "Bigode";
57
+ BeardSizes["NOTHING"] = "Sem Barba";
58
58
  })(BeardSizes || (BeardSizes = {}));
59
59
 
60
- var HairTypes;
61
- (function (HairTypes) {
62
- HairTypes["Smooth"] = "Liso";
63
- HairTypes["WAVY"] = "Ondulado";
64
- HairTypes["CURLY"] = "Cacheado";
65
- HairTypes["FRIZZY"] = "Crespo";
66
- HairTypes["BALD"] = "Sou careca";
60
+ var HairTypes;
61
+ (function (HairTypes) {
62
+ HairTypes["Smooth"] = "Liso";
63
+ HairTypes["WAVY"] = "Ondulado";
64
+ HairTypes["CURLY"] = "Cacheado";
65
+ HairTypes["FRIZZY"] = "Crespo";
66
+ HairTypes["BALD"] = "Sou careca";
67
67
  })(HairTypes || (HairTypes = {}));
68
68
 
69
- var Area;
70
- (function (Area) {
71
- Area["GP"] = "Geral";
72
- Area["CRM"] = "CRM";
73
- Area["MediaProd"] = "Media Production";
74
- Area["Tech"] = "Tecnologia";
75
- Area["Transactional"] = "Transacional";
76
- Area["Operations"] = "Opera\u00E7\u00F5es";
77
- Area["Sales"] = "Comercial";
78
- Area["Finantial"] = "Financeiro";
79
- Area["HR"] = "RH";
69
+ var Area;
70
+ (function (Area) {
71
+ Area["GP"] = "Geral";
72
+ Area["CRM"] = "CRM";
73
+ Area["MediaProd"] = "Media Production";
74
+ Area["Tech"] = "Tecnologia";
75
+ Area["Transactional"] = "Transacional";
76
+ Area["Operations"] = "Opera\u00E7\u00F5es";
77
+ Area["Sales"] = "Comercial";
78
+ Area["Finantial"] = "Financeiro";
79
+ Area["HR"] = "RH";
80
80
  })(Area || (Area = {}));
81
81
 
82
- var OfficePosition;
83
- (function (OfficePosition) {
84
- OfficePosition["Intern"] = "Estagi\u00E1rio";
85
- OfficePosition["Analyst"] = "Analista";
86
- OfficePosition["Manager"] = "Gerente";
87
- OfficePosition["Director"] = "Diretor";
82
+ var OfficePosition;
83
+ (function (OfficePosition) {
84
+ OfficePosition["Intern"] = "Estagi\u00E1rio";
85
+ OfficePosition["Analyst"] = "Analista";
86
+ OfficePosition["Manager"] = "Gerente";
87
+ OfficePosition["Director"] = "Diretor";
88
88
  })(OfficePosition || (OfficePosition = {}));
89
89
 
90
- var BillingStatus;
91
- (function (BillingStatus) {
92
- BillingStatus["PAYED"] = "PAGO";
90
+ var BillingStatus;
91
+ (function (BillingStatus) {
92
+ BillingStatus["PAYED"] = "PAGO";
93
93
  })(BillingStatus || (BillingStatus = {}));
94
94
 
95
- var EditionStatus;
96
- (function (EditionStatus) {
97
- EditionStatus["ALLOCATION_WAITING"] = "Aguardando aloca\u00E7\u00E3o";
95
+ var EditionStatus;
96
+ (function (EditionStatus) {
97
+ EditionStatus["ALLOCATION_WAITING"] = "Aguardando aloca\u00E7\u00E3o";
98
98
  })(EditionStatus || (EditionStatus = {}));
99
99
 
100
- var PaymentType;
101
- (function (PaymentType) {
102
- PaymentType["AQUISITION"] = "Aquisi\u00E7\u00E3o";
103
- PaymentType["RENEWAL"] = "Renova\u00E7\u00E3o";
104
- PaymentType["FREIGHT"] = "mudan\u00E7a de endere\u00E7o, Frete";
100
+ var PaymentType;
101
+ (function (PaymentType) {
102
+ PaymentType["AQUISITION"] = "Aquisi\u00E7\u00E3o";
103
+ PaymentType["RENEWAL"] = "Renova\u00E7\u00E3o";
104
+ PaymentType["FREIGHT"] = "mudan\u00E7a de endere\u00E7o, Frete";
105
105
  })(PaymentType || (PaymentType = {}));
106
106
 
107
- var Status;
108
- (function (Status) {
109
- Status["ACTIVE"] = "active";
107
+ var Status;
108
+ (function (Status) {
109
+ Status["ACTIVE"] = "active";
110
110
  })(Status || (Status = {}));
111
111
 
112
- class Edition extends BaseModel {
113
- identifierFields() {
114
- return ['id'];
115
- }
116
- }
117
-
118
- class SubscriptionPayment extends BaseModel {
119
- identifierFields() {
120
- return ['id'];
121
- }
122
- }
123
-
124
- class Subscription extends BaseModel {
125
- identifierFields() {
126
- return ['id'];
127
- }
128
- }
129
-
130
- class User extends BaseModel {
131
- static toInstance(data) {
132
- const instance = super.toInstance(data);
133
- instance.displayName = `${data.firstName} ${data.lastName}`;
134
- return instance;
135
- }
136
- identifierFields() {
137
- return ['id'];
138
- }
139
- toPlain() {
140
- const plain = super.toPlain();
141
- delete plain.beautyProfile;
142
- return plain;
143
- }
144
- }
145
-
146
- class BeautyProfile extends BaseModel {
147
- toPlain() {
148
- const plain = super.toPlain();
149
- delete plain.id;
150
- return plain;
151
- }
152
- identifierFields() {
153
- return ['id'];
154
- }
155
- }
156
-
157
- class Address extends BaseModel {
158
- }
159
-
160
- class UserAddress extends Address {
161
- identifierFields() {
162
- return ['id'];
163
- }
164
- }
165
-
166
- class Base {
167
- constructor(...args) {
168
- Object.assign(this, ...args);
169
- }
170
- }
171
-
172
- class UnauthorizedError extends Error {
173
- constructor(message) {
174
- super(message);
175
- this.message = message;
176
- }
177
- }
178
-
179
- var SignInMethods;
180
- (function (SignInMethods) {
181
- SignInMethods["EMAIL_PASSWORD"] = "email_password";
182
- SignInMethods["GOOGLE"] = "google";
183
- })(SignInMethods || (SignInMethods = {}));
184
- class Authentication {
185
- constructor(authService, userRepository) {
186
- this.authService = authService;
187
- this.userRepository = userRepository;
188
- }
189
- signIn({ email, password }, signInMethod) {
190
- return __awaiter(this, void 0, void 0, function* () {
191
- const method = this.getServiceByMethod(signInMethod);
192
- const userAuth = yield this.authService[method]({ email, password });
193
- const user = this.userRepository.get(userAuth);
194
- if (!isNil(user))
195
- return user;
196
- if (/^.+@b4a.com.br$/.test(userAuth.email))
197
- return this.createsUserByCredential(userAuth);
198
- throw new UnauthorizedError('Invalid credentials');
199
- });
200
- }
201
- getServiceByMethod(signInMethod) {
202
- return signInMethod === SignInMethods.EMAIL_PASSWORD ? 'signInWithEmailAndPassword' : 'signInWithGoogle';
203
- }
204
- createsUserByCredential(user) {
205
- var _a;
206
- return __awaiter(this, void 0, void 0, function* () {
207
- const [firstName, lastName] = (_a = user.displayName) === null || _a === void 0 ? void 0 : _a.split(/\s/);
208
- const person = User.toInstance(Object.assign(Object.assign({}, user), { cpf: '', birthday: new Date(), firstName,
209
- lastName, acceptsNewsletter: false, area: Area.Transactional, officePosition: OfficePosition.Intern, type: UserType.Collaborator }));
210
- return this.userRepository.create(person);
211
- });
212
- }
213
- }
214
-
215
- class SignOut {
216
- constructor(authService) {
217
- this.authService = authService;
218
- }
219
- signOut() {
220
- return __awaiter(this, void 0, void 0, function* () {
221
- yield this.authService.signOut();
222
- });
223
- }
224
- }
225
-
226
- var Shops;
227
- (function (Shops) {
228
- Shops["MENSMARKET"] = "Men's Market";
229
- Shops["GLAMSHOP"] = "Glamshop";
112
+ class Edition extends BaseModel {
113
+ identifierFields() {
114
+ return ['id'];
115
+ }
116
+ }
117
+
118
+ class SubscriptionPayment extends BaseModel {
119
+ identifierFields() {
120
+ return ['id'];
121
+ }
122
+ }
123
+
124
+ class Subscription extends BaseModel {
125
+ identifierFields() {
126
+ return ['id'];
127
+ }
128
+ }
129
+
130
+ class User extends BaseModel {
131
+ static toInstance(data) {
132
+ const instance = super.toInstance(data);
133
+ instance.displayName = `${data.firstName} ${data.lastName}`;
134
+ return instance;
135
+ }
136
+ identifierFields() {
137
+ return ['id'];
138
+ }
139
+ toPlain() {
140
+ const plain = super.toPlain();
141
+ delete plain.beautyProfile;
142
+ return plain;
143
+ }
144
+ }
145
+
146
+ class BeautyProfile extends BaseModel {
147
+ toPlain() {
148
+ const plain = super.toPlain();
149
+ delete plain.id;
150
+ return plain;
151
+ }
152
+ identifierFields() {
153
+ return ['id'];
154
+ }
155
+ }
156
+
157
+ class Address extends BaseModel {
158
+ }
159
+
160
+ class UserAddress extends Address {
161
+ identifierFields() {
162
+ return ['id'];
163
+ }
164
+ }
165
+
166
+ class Base {
167
+ constructor(...args) {
168
+ Object.assign(this, ...args);
169
+ }
170
+ }
171
+
172
+ class UnauthorizedError extends Error {
173
+ constructor(message) {
174
+ super(message);
175
+ this.message = message;
176
+ }
177
+ }
178
+
179
+ var SignInMethods;
180
+ (function (SignInMethods) {
181
+ SignInMethods["EMAIL_PASSWORD"] = "email_password";
182
+ SignInMethods["GOOGLE"] = "google";
183
+ })(SignInMethods || (SignInMethods = {}));
184
+ class Authentication {
185
+ constructor(authService, userRepository) {
186
+ this.authService = authService;
187
+ this.userRepository = userRepository;
188
+ }
189
+ signIn({ email, password }, signInMethod) {
190
+ return __awaiter(this, void 0, void 0, function* () {
191
+ const method = this.getServiceByMethod(signInMethod);
192
+ const userAuth = yield this.authService[method]({ email, password });
193
+ const user = this.userRepository.get(userAuth);
194
+ if (!isNil(user))
195
+ return user;
196
+ if (/^.+@b4a.com.br$/.test(userAuth.email))
197
+ return this.createsUserByCredential(userAuth);
198
+ throw new UnauthorizedError('Invalid credentials');
199
+ });
200
+ }
201
+ getServiceByMethod(signInMethod) {
202
+ return signInMethod === SignInMethods.EMAIL_PASSWORD ? 'signInWithEmailAndPassword' : 'signInWithGoogle';
203
+ }
204
+ createsUserByCredential(user) {
205
+ var _a;
206
+ return __awaiter(this, void 0, void 0, function* () {
207
+ const [firstName, lastName] = (_a = user.displayName) === null || _a === void 0 ? void 0 : _a.split(/\s/);
208
+ const person = User.toInstance(Object.assign(Object.assign({}, user), { cpf: '', birthday: new Date(), firstName,
209
+ lastName, acceptsNewsletter: false, area: Area.Transactional, officePosition: OfficePosition.Intern, type: UserType.Collaborator }));
210
+ return this.userRepository.create(person);
211
+ });
212
+ }
213
+ }
214
+
215
+ class SignOut {
216
+ constructor(authService) {
217
+ this.authService = authService;
218
+ }
219
+ signOut() {
220
+ return __awaiter(this, void 0, void 0, function* () {
221
+ yield this.authService.signOut();
222
+ });
223
+ }
224
+ }
225
+
226
+ var Shops;
227
+ (function (Shops) {
228
+ Shops["MENSMARKET"] = "Men's Market";
229
+ Shops["GLAMSHOP"] = "Glamshop";
230
230
  })(Shops || (Shops = {}));
231
231
 
232
- class Category extends BaseModel {
233
- identifierFields() {
234
- return ['id'];
235
- }
232
+ class Category extends BaseModel {
233
+ identifierFields() {
234
+ return ['id'];
235
+ }
236
236
  }
237
237
 
238
- class Product extends BaseModel {
239
- identifierFields() {
240
- return ['id'];
241
- }
238
+ class Product extends BaseModel {
239
+ identifierFields() {
240
+ return ['id'];
241
+ }
242
242
  }
243
243
 
244
- class Variant extends BaseModel {
245
- identifierFields() {
246
- return ['id'];
247
- }
244
+ class Variant extends BaseModel {
245
+ identifierFields() {
246
+ return ['id'];
247
+ }
248
248
  }
249
249
 
250
- var CouponTypes;
251
- (function (CouponTypes) {
252
- CouponTypes[CouponTypes["FINANCIAL"] = 1] = "FINANCIAL";
253
- CouponTypes[CouponTypes["PRODUCT"] = 2] = "PRODUCT";
254
- CouponTypes[CouponTypes["GIFTCARD"] = 3] = "GIFTCARD";
255
- CouponTypes[CouponTypes["VOUCHER"] = 4] = "VOUCHER";
250
+ var CouponTypes;
251
+ (function (CouponTypes) {
252
+ CouponTypes[CouponTypes["FINANCIAL"] = 1] = "FINANCIAL";
253
+ CouponTypes[CouponTypes["PRODUCT"] = 2] = "PRODUCT";
254
+ CouponTypes[CouponTypes["GIFTCARD"] = 3] = "GIFTCARD";
255
+ CouponTypes[CouponTypes["VOUCHER"] = 4] = "VOUCHER";
256
256
  })(CouponTypes || (CouponTypes = {}));
257
257
 
258
- var CouponSubtypes;
259
- (function (CouponSubtypes) {
260
- CouponSubtypes[CouponSubtypes["ABSOLUTE"] = 1] = "ABSOLUTE";
261
- CouponSubtypes[CouponSubtypes["PERCENTAGE"] = 2] = "PERCENTAGE";
258
+ var CouponSubtypes;
259
+ (function (CouponSubtypes) {
260
+ CouponSubtypes[CouponSubtypes["ABSOLUTE"] = 1] = "ABSOLUTE";
261
+ CouponSubtypes[CouponSubtypes["PERCENTAGE"] = 2] = "PERCENTAGE";
262
262
  })(CouponSubtypes || (CouponSubtypes = {}));
263
263
 
264
- var Exclusivities;
265
- (function (Exclusivities) {
266
- Exclusivities[Exclusivities["ALL_USERS"] = 1] = "ALL_USERS";
267
- Exclusivities[Exclusivities["SPECIFIC_USER"] = 2] = "SPECIFIC_USER";
268
- Exclusivities[Exclusivities["COLLABORATORS"] = 3] = "COLLABORATORS";
264
+ var Exclusivities;
265
+ (function (Exclusivities) {
266
+ Exclusivities[Exclusivities["ALL_USERS"] = 1] = "ALL_USERS";
267
+ Exclusivities[Exclusivities["SPECIFIC_USER"] = 2] = "SPECIFIC_USER";
268
+ Exclusivities[Exclusivities["COLLABORATORS"] = 3] = "COLLABORATORS";
269
269
  })(Exclusivities || (Exclusivities = {}));
270
270
 
271
- class Coupon extends BaseModel {
272
- identifierFields() {
273
- return ['id'];
274
- }
275
- }
276
- __decorate([
277
- Expose({ name: 'checkout_type' })
278
- ], Coupon.prototype, "checkoutType", void 0);
279
- __decorate([
280
- Expose({ name: 'exclusivity_type' })
271
+ class Coupon extends BaseModel {
272
+ identifierFields() {
273
+ return ['id'];
274
+ }
275
+ }
276
+ __decorate([
277
+ Expose({ name: 'checkout_type' })
278
+ ], Coupon.prototype, "checkoutType", void 0);
279
+ __decorate([
280
+ Expose({ name: 'exclusivity_type' })
281
281
  ], Coupon.prototype, "exclusivityType", void 0);
282
282
 
283
- var CheckoutTypes;
284
- (function (CheckoutTypes) {
285
- CheckoutTypes[CheckoutTypes["ECOMMERCE"] = 1] = "ECOMMERCE";
286
- CheckoutTypes[CheckoutTypes["SUBSCRIPTION"] = 2] = "SUBSCRIPTION";
283
+ var CheckoutTypes;
284
+ (function (CheckoutTypes) {
285
+ CheckoutTypes[CheckoutTypes["ECOMMERCE"] = 1] = "ECOMMERCE";
286
+ CheckoutTypes[CheckoutTypes["SUBSCRIPTION"] = 2] = "SUBSCRIPTION";
287
287
  })(CheckoutTypes || (CheckoutTypes = {}));
288
288
 
289
- const COUPON_EXPIRATION = 60 * 60 * 24 * 30;
290
- class FinancialCoupon extends Coupon {
291
- constructor() {
292
- super(...arguments);
293
- this.type = CouponTypes.FINANCIAL;
294
- }
295
- static isFinancialCoupon(coupon) {
296
- return coupon.type === CouponTypes.FINANCIAL && !!coupon.subtype;
297
- }
298
- static createCoupon(userId) {
299
- return this.toInstance({
300
- name: Md5.hashStr(`${userId}_${Date.now}`).toString(),
301
- nickname: `${Date.now()}`,
302
- type: CouponTypes.FINANCIAL,
303
- subtype: CouponSubtypes.PERCENTAGE,
304
- checkoutType: CheckoutTypes.ECOMMERCE,
305
- discount: 30,
306
- user: userId,
307
- createdAt: new Date(Date.now()),
308
- expiresIn: new Date(Date.now() + COUPON_EXPIRATION),
309
- });
310
- }
311
- }
312
-
313
- var OrderStatus;
314
- (function (OrderStatus) {
315
- OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
316
- OrderStatus["EM_PREPARO"] = "Preparando pedido";
317
- OrderStatus["NF_EMITIDA"] = "Nota Fiscal Emitida";
318
- OrderStatus["AGUARDANDO_ENVIO"] = "Aguardando Transaportadora";
319
- OrderStatus["ENVIADO"] = "Pedido Enviado";
320
- OrderStatus["ENTREGUE"] = "Pedido entregue";
321
- OrderStatus["CANCELADO"] = "Cancelado";
322
- OrderStatus["CREDIT_CARD"] = "credit_card";
289
+ const COUPON_EXPIRATION = 60 * 60 * 24 * 30;
290
+ class FinancialCoupon extends Coupon {
291
+ constructor() {
292
+ super(...arguments);
293
+ this.type = CouponTypes.FINANCIAL;
294
+ }
295
+ static isFinancialCoupon(coupon) {
296
+ return coupon.type === CouponTypes.FINANCIAL && !!coupon.subtype;
297
+ }
298
+ static createCoupon(userId) {
299
+ return this.toInstance({
300
+ name: Md5.hashStr(`${userId}_${Date.now}`).toString(),
301
+ nickname: `${Date.now()}`,
302
+ type: CouponTypes.FINANCIAL,
303
+ subtype: CouponSubtypes.PERCENTAGE,
304
+ checkoutType: CheckoutTypes.ECOMMERCE,
305
+ discount: 30,
306
+ user: userId,
307
+ createdAt: new Date(Date.now()),
308
+ expiresIn: new Date(Date.now() + COUPON_EXPIRATION),
309
+ });
310
+ }
311
+ }
312
+
313
+ var OrderStatus;
314
+ (function (OrderStatus) {
315
+ OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
316
+ OrderStatus["EM_PREPARO"] = "Preparando pedido";
317
+ OrderStatus["NF_EMITIDA"] = "Nota Fiscal Emitida";
318
+ OrderStatus["AGUARDANDO_ENVIO"] = "Aguardando Transaportadora";
319
+ OrderStatus["ENVIADO"] = "Pedido Enviado";
320
+ OrderStatus["ENTREGUE"] = "Pedido entregue";
321
+ OrderStatus["CANCELADO"] = "Cancelado";
322
+ OrderStatus["CREDIT_CARD"] = "credit_card";
323
323
  })(OrderStatus || (OrderStatus = {}));
324
324
 
325
- class Checkout extends BaseModel {
326
- identifierFields() {
327
- return ['id'];
328
- }
329
- }
330
-
331
- class LineItem extends Product {
332
- }
333
-
334
- class Order extends Checkout {
335
- }
336
-
337
- class Payment extends BaseModel {
338
- identifierFields() {
339
- return ['id'];
340
- }
341
- }
342
- __decorate([
343
- Expose({ name: 'refuse_reason' })
344
- ], Payment.prototype, "refuseReason", void 0);
345
- __decorate([
346
- Expose({ name: 'status_reason' })
347
- ], Payment.prototype, "statusReason", void 0);
348
- __decorate([
349
- Expose({ name: 'acquirer_response_code' })
350
- ], Payment.prototype, "acquirerResponseCode", void 0);
351
- __decorate([
352
- Expose({ name: 'acquirer_name' })
353
- ], Payment.prototype, "acquirerName", void 0);
354
- __decorate([
355
- Expose({ name: 'acquirer_id' })
356
- ], Payment.prototype, "acquirerId", void 0);
357
- __decorate([
358
- Expose({ name: 'authorization_code' })
359
- ], Payment.prototype, "authorizationCode", void 0);
360
- __decorate([
361
- Expose({ name: 'soft_descriptor' })
362
- ], Payment.prototype, "softDescriptor", void 0);
363
- __decorate([
364
- Expose({ name: 'date_created' })
365
- ], Payment.prototype, "dateCreated", void 0);
366
- __decorate([
367
- Expose({ name: 'date_updated' })
368
- ], Payment.prototype, "dateUpdated", void 0);
369
- __decorate([
370
- Expose({ name: 'authorized_amount' })
371
- ], Payment.prototype, "authorizedAmount", void 0);
372
- __decorate([
373
- Expose({ name: 'paid_amount' })
374
- ], Payment.prototype, "paidAmount", void 0);
375
- __decorate([
376
- Expose({ name: 'refunded_amount' })
377
- ], Payment.prototype, "refundedAmount", void 0);
378
- __decorate([
379
- Expose({ name: 'card_holder_name' })
380
- ], Payment.prototype, "cardHolderName", void 0);
381
- __decorate([
382
- Expose({ name: 'card_last_digits' })
383
- ], Payment.prototype, "cardLastDigits", void 0);
384
- __decorate([
385
- Expose({ name: 'card_first_digits' })
386
- ], Payment.prototype, "cardFirstDigits", void 0);
387
- __decorate([
388
- Expose({ name: 'card_brand' })
389
- ], Payment.prototype, "cardBrand", void 0);
390
- __decorate([
391
- Expose({ name: 'card_pin_mode' })
392
- ], Payment.prototype, "cardPinMode", void 0);
393
- __decorate([
394
- Expose({ name: 'card_magstripe_fallback' })
395
- ], Payment.prototype, "cardMagstripeFallback", void 0);
396
- __decorate([
397
- Expose({ name: 'cvm_pin' })
398
- ], Payment.prototype, "cvmPin", void 0);
399
- __decorate([
400
- Expose({ name: 'postback_url' })
401
- ], Payment.prototype, "postbackUrl", void 0);
402
- __decorate([
403
- Expose({ name: 'payment_method' })
404
- ], Payment.prototype, "paymentMethod", void 0);
405
- __decorate([
406
- Expose({ name: 'capture_method' })
407
- ], Payment.prototype, "captureMethod", void 0);
408
- __decorate([
409
- Expose({ name: 'antifraud_score' })
410
- ], Payment.prototype, "antifraudScore", void 0);
411
- __decorate([
412
- Expose({ name: 'boleto_url' })
413
- ], Payment.prototype, "boletoUrl", void 0);
414
- __decorate([
415
- Expose({ name: 'boleto_barcode' })
416
- ], Payment.prototype, "boletoBarcode", void 0);
417
- __decorate([
418
- Expose({ name: 'boleto_expiration_date' })
419
- ], Payment.prototype, "boletoExpirationDate", void 0);
420
- __decorate([
421
- Expose({ name: 'subscription_id' })
422
- ], Payment.prototype, "subscriptionId", void 0);
423
- __decorate([
424
- Expose({ name: 'split_rules' })
425
- ], Payment.prototype, "splitRules", void 0);
426
- __decorate([
427
- Expose({ name: 'antifraud_metadata' })
428
- ], Payment.prototype, "antifraudMetadata", void 0);
429
- __decorate([
430
- Expose({ name: 'reference_key' })
431
- ], Payment.prototype, "referenceKey", void 0);
432
- __decorate([
433
- Expose({ name: 'local_transaction_id' })
434
- ], Payment.prototype, "localTransactionId", void 0);
435
- __decorate([
436
- Expose({ name: 'local_time' })
437
- ], Payment.prototype, "localTime", void 0);
438
- __decorate([
439
- Expose({ name: 'fraud_covered' })
440
- ], Payment.prototype, "fraudCovered", void 0);
441
- __decorate([
442
- Expose({ name: 'fraud_reimbursed' })
443
- ], Payment.prototype, "fraudReimbursed", void 0);
444
- __decorate([
445
- Expose({ name: 'order_id' })
446
- ], Payment.prototype, "orderId", void 0);
447
- __decorate([
448
- Expose({ name: 'risk_level' })
449
- ], Payment.prototype, "riskLevel", void 0);
450
- __decorate([
451
- Expose({ name: 'receipt_url' })
452
- ], Payment.prototype, "receiptUrl", void 0);
453
- __decorate([
454
- Expose({ name: 'private_label' })
455
- ], Payment.prototype, "privateLabel", void 0);
456
- __decorate([
457
- Expose({ name: 'pix_qr_code' })
458
- ], Payment.prototype, "pixQrCode", void 0);
459
- __decorate([
460
- Expose({ name: 'pix_expiration_date' })
325
+ class Checkout extends BaseModel {
326
+ identifierFields() {
327
+ return ['id'];
328
+ }
329
+ }
330
+
331
+ class LineItem extends Product {
332
+ }
333
+
334
+ class Order extends Checkout {
335
+ }
336
+
337
+ class Payment extends BaseModel {
338
+ identifierFields() {
339
+ return ['id'];
340
+ }
341
+ }
342
+ __decorate([
343
+ Expose({ name: 'refuse_reason' })
344
+ ], Payment.prototype, "refuseReason", void 0);
345
+ __decorate([
346
+ Expose({ name: 'status_reason' })
347
+ ], Payment.prototype, "statusReason", void 0);
348
+ __decorate([
349
+ Expose({ name: 'acquirer_response_code' })
350
+ ], Payment.prototype, "acquirerResponseCode", void 0);
351
+ __decorate([
352
+ Expose({ name: 'acquirer_name' })
353
+ ], Payment.prototype, "acquirerName", void 0);
354
+ __decorate([
355
+ Expose({ name: 'acquirer_id' })
356
+ ], Payment.prototype, "acquirerId", void 0);
357
+ __decorate([
358
+ Expose({ name: 'authorization_code' })
359
+ ], Payment.prototype, "authorizationCode", void 0);
360
+ __decorate([
361
+ Expose({ name: 'soft_descriptor' })
362
+ ], Payment.prototype, "softDescriptor", void 0);
363
+ __decorate([
364
+ Expose({ name: 'date_created' })
365
+ ], Payment.prototype, "dateCreated", void 0);
366
+ __decorate([
367
+ Expose({ name: 'date_updated' })
368
+ ], Payment.prototype, "dateUpdated", void 0);
369
+ __decorate([
370
+ Expose({ name: 'authorized_amount' })
371
+ ], Payment.prototype, "authorizedAmount", void 0);
372
+ __decorate([
373
+ Expose({ name: 'paid_amount' })
374
+ ], Payment.prototype, "paidAmount", void 0);
375
+ __decorate([
376
+ Expose({ name: 'refunded_amount' })
377
+ ], Payment.prototype, "refundedAmount", void 0);
378
+ __decorate([
379
+ Expose({ name: 'card_holder_name' })
380
+ ], Payment.prototype, "cardHolderName", void 0);
381
+ __decorate([
382
+ Expose({ name: 'card_last_digits' })
383
+ ], Payment.prototype, "cardLastDigits", void 0);
384
+ __decorate([
385
+ Expose({ name: 'card_first_digits' })
386
+ ], Payment.prototype, "cardFirstDigits", void 0);
387
+ __decorate([
388
+ Expose({ name: 'card_brand' })
389
+ ], Payment.prototype, "cardBrand", void 0);
390
+ __decorate([
391
+ Expose({ name: 'card_pin_mode' })
392
+ ], Payment.prototype, "cardPinMode", void 0);
393
+ __decorate([
394
+ Expose({ name: 'card_magstripe_fallback' })
395
+ ], Payment.prototype, "cardMagstripeFallback", void 0);
396
+ __decorate([
397
+ Expose({ name: 'cvm_pin' })
398
+ ], Payment.prototype, "cvmPin", void 0);
399
+ __decorate([
400
+ Expose({ name: 'postback_url' })
401
+ ], Payment.prototype, "postbackUrl", void 0);
402
+ __decorate([
403
+ Expose({ name: 'payment_method' })
404
+ ], Payment.prototype, "paymentMethod", void 0);
405
+ __decorate([
406
+ Expose({ name: 'capture_method' })
407
+ ], Payment.prototype, "captureMethod", void 0);
408
+ __decorate([
409
+ Expose({ name: 'antifraud_score' })
410
+ ], Payment.prototype, "antifraudScore", void 0);
411
+ __decorate([
412
+ Expose({ name: 'boleto_url' })
413
+ ], Payment.prototype, "boletoUrl", void 0);
414
+ __decorate([
415
+ Expose({ name: 'boleto_barcode' })
416
+ ], Payment.prototype, "boletoBarcode", void 0);
417
+ __decorate([
418
+ Expose({ name: 'boleto_expiration_date' })
419
+ ], Payment.prototype, "boletoExpirationDate", void 0);
420
+ __decorate([
421
+ Expose({ name: 'subscription_id' })
422
+ ], Payment.prototype, "subscriptionId", void 0);
423
+ __decorate([
424
+ Expose({ name: 'split_rules' })
425
+ ], Payment.prototype, "splitRules", void 0);
426
+ __decorate([
427
+ Expose({ name: 'antifraud_metadata' })
428
+ ], Payment.prototype, "antifraudMetadata", void 0);
429
+ __decorate([
430
+ Expose({ name: 'reference_key' })
431
+ ], Payment.prototype, "referenceKey", void 0);
432
+ __decorate([
433
+ Expose({ name: 'local_transaction_id' })
434
+ ], Payment.prototype, "localTransactionId", void 0);
435
+ __decorate([
436
+ Expose({ name: 'local_time' })
437
+ ], Payment.prototype, "localTime", void 0);
438
+ __decorate([
439
+ Expose({ name: 'fraud_covered' })
440
+ ], Payment.prototype, "fraudCovered", void 0);
441
+ __decorate([
442
+ Expose({ name: 'fraud_reimbursed' })
443
+ ], Payment.prototype, "fraudReimbursed", void 0);
444
+ __decorate([
445
+ Expose({ name: 'order_id' })
446
+ ], Payment.prototype, "orderId", void 0);
447
+ __decorate([
448
+ Expose({ name: 'risk_level' })
449
+ ], Payment.prototype, "riskLevel", void 0);
450
+ __decorate([
451
+ Expose({ name: 'receipt_url' })
452
+ ], Payment.prototype, "receiptUrl", void 0);
453
+ __decorate([
454
+ Expose({ name: 'private_label' })
455
+ ], Payment.prototype, "privateLabel", void 0);
456
+ __decorate([
457
+ Expose({ name: 'pix_qr_code' })
458
+ ], Payment.prototype, "pixQrCode", void 0);
459
+ __decorate([
460
+ Expose({ name: 'pix_expiration_date' })
461
461
  ], Payment.prototype, "pixExpirationDate", void 0);
462
462
 
463
- class ShippingMethod extends BaseModel {
464
- identifierFields() {
465
- return ['id'];
466
- }
467
- }
468
-
469
- class CheckoutSubscription extends BaseModel {
470
- identifierFields() {
471
- return ['id'];
472
- }
473
- }
474
-
475
- class SubscriptionPlan extends BaseModel {
476
- identifierFields() {
477
- return ['id'];
478
- }
479
- }
480
-
481
- class Buy2Win extends BaseModel {
482
- identifierFields() {
483
- return ['id'];
484
- }
485
- }
486
-
487
- class InvalidArgumentError extends Error {
488
- constructor(message) {
489
- super(message);
490
- this.message = message;
491
- }
492
- }
493
-
494
- class RequiredArgumentError extends Error {
495
- constructor(args) {
496
- super(`Required arguments: ${args.join(', ')}`);
497
- this.args = args;
498
- this.arguments = args;
499
- }
500
- }
501
-
502
- class NotFoundError extends Error {
503
- constructor(message) {
504
- super(message);
505
- this.message = message;
506
- }
507
- }
508
-
509
- const withFirestore = (MixinBase) => {
510
- return class extends MixinBase {
511
- constructor(...args) {
512
- super(args);
513
- }
514
- collection(path) {
515
- return this.firestore.collection(path || this.collectionName).withConverter(this.buildModelInstance());
516
- }
517
- buildModelInstance() {
518
- return {
519
- toFirestore: (data) => data.toPlain(),
520
- fromFirestore: (snap) => {
521
- const data = snap.data();
522
- Object.keys(data).forEach((key) => {
523
- if (data[key] instanceof firebase.firestore.Timestamp) {
524
- data[key] = data[key].toDate();
525
- }
526
- });
527
- return this.model.toInstance(Object.assign({ id: snap.id }, data));
528
- },
529
- };
530
- }
531
- };
463
+ class ShippingMethod extends BaseModel {
464
+ identifierFields() {
465
+ return ['id'];
466
+ }
467
+ }
468
+
469
+ class CheckoutSubscription extends BaseModel {
470
+ identifierFields() {
471
+ return ['id'];
472
+ }
473
+ }
474
+
475
+ class SubscriptionPlan extends BaseModel {
476
+ identifierFields() {
477
+ return ['id'];
478
+ }
479
+ }
480
+
481
+ class Buy2Win extends BaseModel {
482
+ identifierFields() {
483
+ return ['id'];
484
+ }
485
+ }
486
+
487
+ class Home extends BaseModel {
488
+ identifierFields() {
489
+ return ['id'];
490
+ }
491
+ }
492
+
493
+ class InvalidArgumentError extends Error {
494
+ constructor(message) {
495
+ super(message);
496
+ this.message = message;
497
+ }
498
+ }
499
+
500
+ class RequiredArgumentError extends Error {
501
+ constructor(args) {
502
+ super(`Required arguments: ${args.join(', ')}`);
503
+ this.args = args;
504
+ this.arguments = args;
505
+ }
506
+ }
507
+
508
+ class NotFoundError extends Error {
509
+ constructor(message) {
510
+ super(message);
511
+ this.message = message;
512
+ }
513
+ }
514
+
515
+ const withFirestore = (MixinBase) => {
516
+ return class extends MixinBase {
517
+ constructor(...args) {
518
+ super(args);
519
+ }
520
+ collection(path) {
521
+ return this.firestore.collection(path || this.collectionName).withConverter(this.buildModelInstance());
522
+ }
523
+ buildModelInstance() {
524
+ return {
525
+ toFirestore: (data) => data.toPlain(),
526
+ fromFirestore: (snap) => {
527
+ const data = snap.data();
528
+ Object.keys(data).forEach((key) => {
529
+ if (data[key] instanceof firebase.firestore.Timestamp) {
530
+ data[key] = data[key].toDate();
531
+ }
532
+ });
533
+ return this.model.toInstance(Object.assign({ id: snap.id }, data));
534
+ },
535
+ };
536
+ }
537
+ };
532
538
  };
533
539
 
534
- const withHelpers = (MixinBase) => {
535
- return class extends MixinBase {
536
- toArray(snapShot) {
537
- if (Array.isArray(snapShot)) {
538
- return snapShot.map((doc) => doc.data());
539
- }
540
- else {
541
- return snapShot.docs.map((doc) => doc.data());
542
- }
543
- }
544
- isSubCollection(repository) {
545
- return !isNil(Object.keys(this).find((key) => key === 'parentRepository'));
546
- }
547
- };
540
+ const withHelpers = (MixinBase) => {
541
+ return class extends MixinBase {
542
+ toArray(snapShot) {
543
+ if (Array.isArray(snapShot)) {
544
+ return snapShot.map((doc) => doc.data());
545
+ }
546
+ else {
547
+ return snapShot.docs.map((doc) => doc.data());
548
+ }
549
+ }
550
+ isSubCollection(repository) {
551
+ return !isNil(Object.keys(this).find((key) => key === 'parentRepository'));
552
+ }
553
+ };
548
554
  };
549
555
 
550
- const withGetFirestore = (MixinBase) => {
551
- return class GetFirestore extends MixinBase {
552
- get(identifiers) {
553
- return __awaiter(this, void 0, void 0, function* () {
554
- const doc = yield this.collection(this.buildCollectionPathForGet(identifiers))
555
- .doc(Object.values(identifiers).shift().toString())
556
- .get();
557
- const data = doc.data();
558
- if (isNil(data))
559
- throw new NotFoundError(`Document ${JSON.stringify(identifiers)} not found`);
560
- return data;
561
- });
562
- }
563
- buildCollectionPathForGet(identifiers) {
564
- return this.isSubCollection(this)
565
- ? `${this.parentRepository.collectionName}/${identifiers[this.parentIdField]}/${this.collectionName}`
566
- : this.collectionName;
567
- }
568
- };
556
+ const withGetFirestore = (MixinBase) => {
557
+ return class GetFirestore extends MixinBase {
558
+ get(identifiers) {
559
+ return __awaiter(this, void 0, void 0, function* () {
560
+ const doc = yield this.collection(this.buildCollectionPathForGet(identifiers))
561
+ .doc(Object.values(identifiers).shift().toString())
562
+ .get();
563
+ const data = doc.data();
564
+ if (isNil(data))
565
+ throw new NotFoundError(`Document ${JSON.stringify(identifiers)} not found`);
566
+ return data;
567
+ });
568
+ }
569
+ buildCollectionPathForGet(identifiers) {
570
+ return this.isSubCollection(this)
571
+ ? `${this.parentRepository.collectionName}/${identifiers[this.parentIdField]}/${this.collectionName}`
572
+ : this.collectionName;
573
+ }
574
+ };
569
575
  };
570
576
 
571
- const withFindFirestore = (MixinBase) => {
572
- return class FindFirestore extends MixinBase {
573
- constructor() {
574
- super(...arguments);
575
- this.makeFirestoreWhere = (queryReference, filter) => Object.keys(filter).reduce((query, fieldName) => this.buildWhereSentence(query, fieldName, filter[fieldName]), queryReference);
576
- this.buildWhereSentence = (queryReference, fieldName, options) => {
577
- if (this.isSubCollection(this) && fieldName === this.parentIdField)
578
- return queryReference;
579
- if (options.operator === Where.LIKE) {
580
- queryReference = queryReference.where(fieldName.toString(), '>=', options.value);
581
- queryReference = queryReference.where(fieldName.toString(), '<=', `${options.value}~`);
582
- return queryReference;
583
- }
584
- return queryReference.where(fieldName.toString(), options.operator, options.value);
585
- };
586
- }
587
- find(filters, limits, orderBy) {
588
- return __awaiter(this, void 0, void 0, function* () {
589
- let query = this.collection(this.buildCollectionPathForFind(filters));
590
- filters === null || filters === void 0 ? void 0 : filters.forEach((filterer) => (query = this.makeFirestoreWhere(query, filterer)));
591
- orderBy === null || orderBy === void 0 ? void 0 : orderBy.forEach((orderer) => Object.keys(orderer).forEach((fieldName) => (query = query.orderBy(fieldName, orderer[fieldName]))));
592
- query = this.defineLimits(query, filters, limits);
593
- const docs = yield query.get();
594
- const data = docs.docs.map((doc) => doc.data());
595
- return {
596
- data,
597
- count: this.calculateCount(data, limits),
598
- };
599
- });
600
- }
601
- buildCollectionPathForFind(filters) {
602
- var _a;
603
- if (!this.isSubCollection(this))
604
- return this.collectionName;
605
- const parentIdField = this.parentIdField;
606
- const parentId = (_a = filters.find((groupFilter) => { var _a; return Boolean((_a = groupFilter[parentIdField]) === null || _a === void 0 ? void 0 : _a.value); })) === null || _a === void 0 ? void 0 : _a[parentIdField].value;
607
- return `${this.parentRepository.collectionName}/${parentId}/${this.collectionName}`;
608
- }
609
- defineLimits(query, filters, limits) {
610
- if (limits === null || limits === void 0 ? void 0 : limits.offset) {
611
- if (limits.offset instanceof this.model)
612
- query = query.startAfter(this.collection(this.buildCollectionPathForFind(filters)).doc(limits.offset[limits.offset.identifierFields().shift()]));
613
- if (isNumber(limits.offset) || isString(limits.offset))
614
- query = query.startAt(limits.offset);
615
- }
616
- if (limits === null || limits === void 0 ? void 0 : limits.limit)
617
- query = query.limit(limits.limit);
618
- return query;
619
- }
620
- calculateCount(data, limits) {
621
- if (data.length <= 0)
622
- return 0;
623
- if (data.length < (limits === null || limits === void 0 ? void 0 : limits.limit))
624
- return data.length;
625
- return Infinity;
626
- }
627
- };
577
+ const withFindFirestore = (MixinBase) => {
578
+ return class FindFirestore extends MixinBase {
579
+ constructor() {
580
+ super(...arguments);
581
+ this.makeFirestoreWhere = (queryReference, filter) => Object.keys(filter).reduce((query, fieldName) => this.buildWhereSentence(query, fieldName, filter[fieldName]), queryReference);
582
+ this.buildWhereSentence = (queryReference, fieldName, options) => {
583
+ if (this.isSubCollection(this) && fieldName === this.parentIdField)
584
+ return queryReference;
585
+ if (options.operator === Where.LIKE) {
586
+ queryReference = queryReference.where(fieldName.toString(), '>=', options.value);
587
+ queryReference = queryReference.where(fieldName.toString(), '<=', `${options.value}~`);
588
+ return queryReference;
589
+ }
590
+ return queryReference.where(fieldName.toString(), options.operator, options.value);
591
+ };
592
+ }
593
+ find(filters, limits, orderBy) {
594
+ return __awaiter(this, void 0, void 0, function* () {
595
+ let query = this.collection(this.buildCollectionPathForFind(filters));
596
+ filters === null || filters === void 0 ? void 0 : filters.forEach((filterer) => (query = this.makeFirestoreWhere(query, filterer)));
597
+ orderBy === null || orderBy === void 0 ? void 0 : orderBy.forEach((orderer) => Object.keys(orderer).forEach((fieldName) => (query = query.orderBy(fieldName, orderer[fieldName]))));
598
+ query = this.defineLimits(query, filters, limits);
599
+ const docs = yield query.get();
600
+ const data = docs.docs.map((doc) => doc.data());
601
+ return {
602
+ data,
603
+ count: this.calculateCount(data, limits),
604
+ };
605
+ });
606
+ }
607
+ buildCollectionPathForFind(filters) {
608
+ var _a;
609
+ if (!this.isSubCollection(this))
610
+ return this.collectionName;
611
+ const parentIdField = this.parentIdField;
612
+ const parentId = (_a = filters.find((groupFilter) => { var _a; return Boolean((_a = groupFilter[parentIdField]) === null || _a === void 0 ? void 0 : _a.value); })) === null || _a === void 0 ? void 0 : _a[parentIdField].value;
613
+ return `${this.parentRepository.collectionName}/${parentId}/${this.collectionName}`;
614
+ }
615
+ defineLimits(query, filters, limits) {
616
+ if (limits === null || limits === void 0 ? void 0 : limits.offset) {
617
+ if (limits.offset instanceof this.model)
618
+ query = query.startAfter(this.collection(this.buildCollectionPathForFind(filters)).doc(limits.offset[limits.offset.identifierFields().shift()]));
619
+ if (isNumber(limits.offset) || isString(limits.offset))
620
+ query = query.startAt(limits.offset);
621
+ }
622
+ if (limits === null || limits === void 0 ? void 0 : limits.limit)
623
+ query = query.limit(limits.limit);
624
+ return query;
625
+ }
626
+ calculateCount(data, limits) {
627
+ if (data.length <= 0)
628
+ return 0;
629
+ if (data.length < (limits === null || limits === void 0 ? void 0 : limits.limit))
630
+ return data.length;
631
+ return Infinity;
632
+ }
633
+ };
628
634
  };
629
635
 
630
- const withCreateFirestore = (MixinBase) => {
631
- return class CreateFirestore extends MixinBase {
632
- create(data) {
633
- return __awaiter(this, void 0, void 0, function* () {
634
- const docRef = yield this.save(this.model.toInstance(data));
635
- const doc = yield docRef.get();
636
- return doc.data();
637
- });
638
- }
639
- save(data) {
640
- var _a;
641
- return __awaiter(this, void 0, void 0, function* () {
642
- const id = (_a = data[data.identifierFields().shift()]) === null || _a === void 0 ? void 0 : _a.toString();
643
- if (isEmpty(id))
644
- return this.collection(this.buildCollectionPathForAdd(data)).add(data);
645
- const docRef = this.collection().doc(id);
646
- yield docRef.set(data);
647
- return docRef;
648
- });
649
- }
650
- buildCollectionPathForAdd(identifiers) {
651
- return this.isSubCollection(this)
652
- ? `${this.parentRepository.collectionName}/${identifiers[this.parentIdField]}/${this.collectionName}`
653
- : this.collectionName;
654
- }
655
- };
636
+ const withCreateFirestore = (MixinBase) => {
637
+ return class CreateFirestore extends MixinBase {
638
+ create(data) {
639
+ return __awaiter(this, void 0, void 0, function* () {
640
+ const docRef = yield this.save(this.model.toInstance(data));
641
+ const doc = yield docRef.get();
642
+ return doc.data();
643
+ });
644
+ }
645
+ save(data) {
646
+ var _a;
647
+ return __awaiter(this, void 0, void 0, function* () {
648
+ const id = (_a = data[data.identifierFields().shift()]) === null || _a === void 0 ? void 0 : _a.toString();
649
+ if (isEmpty(id))
650
+ return this.collection(this.buildCollectionPathForAdd(data)).add(data);
651
+ const docRef = this.collection().doc(id);
652
+ yield docRef.set(data);
653
+ return docRef;
654
+ });
655
+ }
656
+ buildCollectionPathForAdd(identifiers) {
657
+ return this.isSubCollection(this)
658
+ ? `${this.parentRepository.collectionName}/${identifiers[this.parentIdField]}/${this.collectionName}`
659
+ : this.collectionName;
660
+ }
661
+ };
656
662
  };
657
663
 
658
- const withUpdateFirestore = (MixinBase) => {
659
- 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; };
660
- const getValueByAction = (options) => {
661
- const fieldValues = firebase.firestore.FieldValue;
662
- if (options.action === UpdateOptionActions.REMOVE_FIELD)
663
- return fieldValues.delete();
664
- if (Array.isArray(options.value)) {
665
- if (options.action === UpdateOptionActions.MERGE)
666
- return fieldValues.arrayUnion(options.value);
667
- if (options.action === UpdateOptionActions.REMOVE)
668
- return fieldValues.arrayRemove(options.value);
669
- }
670
- return options.value;
671
- };
672
- return class UpdateFirestore extends MixinBase {
673
- update(data) {
674
- return __awaiter(this, void 0, void 0, function* () {
675
- const model = new this.model();
676
- const keyField = model.identifierFields().shift();
677
- const docRef = this.collection(this.buildCollectionPathForUpdate(data)).doc(getValueFromParams(data, keyField).toString());
678
- yield docRef.update(this.paramsToPlain(data));
679
- const doc = yield docRef.get();
680
- return doc.data();
681
- });
682
- }
683
- buildCollectionPathForUpdate(identifiers) {
684
- return this.isSubCollection(this)
685
- ? `${this.parentRepository.collectionName}/${getValueFromParams(identifiers, this.parentIdField)}/${this.collectionName}`
686
- : this.collectionName;
687
- }
688
- paramsToPlain(params) {
689
- const model = this.model;
690
- if (params instanceof model)
691
- return params.toPlain();
692
- return Object.keys(params).reduce((data, currentKey) => (Object.assign(Object.assign({}, data), { [currentKey]: getValueByAction(data[currentKey]) })), {});
693
- }
694
- };
664
+ const withUpdateFirestore = (MixinBase) => {
665
+ 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; };
666
+ const getValueByAction = (options) => {
667
+ const fieldValues = firebase.firestore.FieldValue;
668
+ if (options.action === UpdateOptionActions.REMOVE_FIELD)
669
+ return fieldValues.delete();
670
+ if (Array.isArray(options.value)) {
671
+ if (options.action === UpdateOptionActions.MERGE)
672
+ return fieldValues.arrayUnion(options.value);
673
+ if (options.action === UpdateOptionActions.REMOVE)
674
+ return fieldValues.arrayRemove(options.value);
675
+ }
676
+ return options.value;
677
+ };
678
+ return class UpdateFirestore extends MixinBase {
679
+ update(data) {
680
+ return __awaiter(this, void 0, void 0, function* () {
681
+ const model = new this.model();
682
+ const keyField = model.identifierFields().shift();
683
+ const docRef = this.collection(this.buildCollectionPathForUpdate(data)).doc(getValueFromParams(data, keyField).toString());
684
+ yield docRef.update(this.paramsToPlain(data));
685
+ const doc = yield docRef.get();
686
+ return doc.data();
687
+ });
688
+ }
689
+ buildCollectionPathForUpdate(identifiers) {
690
+ return this.isSubCollection(this)
691
+ ? `${this.parentRepository.collectionName}/${getValueFromParams(identifiers, this.parentIdField)}/${this.collectionName}`
692
+ : this.collectionName;
693
+ }
694
+ paramsToPlain(params) {
695
+ const model = this.model;
696
+ if (params instanceof model)
697
+ return params.toPlain();
698
+ return Object.keys(params).reduce((data, currentKey) => (Object.assign(Object.assign({}, data), { [currentKey]: getValueByAction(data[currentKey]) })), {});
699
+ }
700
+ };
695
701
  };
696
702
 
697
- const withDeleteFirestore = (MixinBase) => {
698
- return class DeleteFirestore extends MixinBase {
699
- delete(identifiers) {
700
- return __awaiter(this, void 0, void 0, function* () {
701
- yield this.collection(this.buildCollectionPathForRemove(identifiers))
702
- .doc(Object.values(identifiers).shift().toString())
703
- .delete();
704
- });
705
- }
706
- buildCollectionPathForRemove(identifiers) {
707
- return this.isSubCollection(this)
708
- ? `${this.parentRepository.collectionName}/${identifiers[this.parentIdField]}/${this.collectionName}`
709
- : this.collectionName;
710
- }
711
- };
703
+ const withDeleteFirestore = (MixinBase) => {
704
+ return class DeleteFirestore extends MixinBase {
705
+ delete(identifiers) {
706
+ return __awaiter(this, void 0, void 0, function* () {
707
+ yield this.collection(this.buildCollectionPathForRemove(identifiers))
708
+ .doc(Object.values(identifiers).shift().toString())
709
+ .delete();
710
+ });
711
+ }
712
+ buildCollectionPathForRemove(identifiers) {
713
+ return this.isSubCollection(this)
714
+ ? `${this.parentRepository.collectionName}/${identifiers[this.parentIdField]}/${this.collectionName}`
715
+ : this.collectionName;
716
+ }
717
+ };
712
718
  };
713
719
 
714
- const withSubCollection = (MixinBase, ParentModel) => {
715
- return class SubCollectionMix extends MixinBase {
716
- constructor(...args) {
717
- super(args);
718
- }
719
- collection(path) {
720
- return super.collection(path);
721
- }
722
- };
720
+ const withSubCollection = (MixinBase, ParentModel) => {
721
+ return class SubCollectionMix extends MixinBase {
722
+ constructor(...args) {
723
+ super(args);
724
+ }
725
+ collection(path) {
726
+ return super.collection(path);
727
+ }
728
+ };
723
729
  };
724
730
 
725
- const withCrudFirestore = (MixinBase) => {
726
- return class CrudFirestore extends withUpdateFirestore(withGetFirestore(withFindFirestore(withDeleteFirestore(withCreateFirestore(MixinBase))))) {
727
- };
731
+ const withCrudFirestore = (MixinBase) => {
732
+ return class CrudFirestore extends withUpdateFirestore(withGetFirestore(withFindFirestore(withDeleteFirestore(withCreateFirestore(MixinBase))))) {
733
+ };
728
734
  };
729
735
 
730
- class SubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
731
- constructor(firestore) {
732
- super();
733
- this.firestore = firestore;
734
- this.collectionName = 'subscription';
735
- this.model = Subscription;
736
- }
737
- }
738
-
739
- class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
740
- constructor(firestore) {
741
- super();
742
- this.firestore = firestore;
743
- this.collectionName = 'users';
744
- this.model = User;
745
- }
746
- get(identifiers) {
747
- const _super = Object.create(null, {
748
- get: { get: () => super.get }
749
- });
750
- return __awaiter(this, void 0, void 0, function* () {
751
- const user = yield _super.get.call(this, { id: identifiers.id });
752
- user.beautyProfile = yield this.getBeautyProfile(user.id);
753
- return user;
754
- });
755
- }
756
- getBeautyProfile(userId) {
757
- return __awaiter(this, void 0, void 0, function* () {
758
- const beautyProfile = yield this.collection()
759
- .doc(userId)
760
- .collection('CX')
761
- .withConverter(this.buildBeautyProfileModelInstance())
762
- .doc('beautyProfile')
763
- .get();
764
- return beautyProfile.data();
765
- });
766
- }
767
- buildBeautyProfileModelInstance() {
768
- return {
769
- toFirestore: (data) => data.toPlain(),
770
- fromFirestore: (snap) => BeautyProfile.toInstance(snap.data()),
771
- };
772
- }
773
- }
774
-
775
- class SubscriptionEditionFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Subscription) {
776
- constructor(firestore, parentRepository) {
777
- super();
778
- this.firestore = firestore;
779
- this.parentRepository = parentRepository;
780
- this.collectionName = 'editions';
781
- this.parentIdField = 'subscriptionId';
782
- this.model = Edition;
783
- }
784
- }
785
-
786
- class UserBeautyProfileFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User) {
787
- constructor(firestore, parentRepository) {
788
- super();
789
- this.firestore = firestore;
790
- this.parentRepository = parentRepository;
791
- this.collectionName = 'CX';
792
- this.parentIdField = 'userId';
793
- this.model = BeautyProfile;
794
- }
795
- }
796
-
797
- class UserAddressFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User) {
798
- constructor(firestore, parentRepository) {
799
- super();
800
- this.firestore = firestore;
801
- this.parentRepository = parentRepository;
802
- this.collectionName = 'address';
803
- this.parentIdField = 'userId';
804
- this.model = UserAddress;
805
- }
806
- }
807
-
808
- class SubscriptionPaymentFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Subscription) {
809
- constructor(firestore, parentRepository) {
810
- super();
811
- this.firestore = firestore;
812
- this.parentRepository = parentRepository;
813
- this.collectionName = 'Payments';
814
- this.parentIdField = 'subscriptionId';
815
- this.model = SubscriptionPayment;
816
- }
817
- }
818
-
819
- class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
820
- constructor(firestore) {
821
- super();
822
- this.firestore = firestore;
823
- this.collectionName = 'categories';
824
- this.model = Category;
825
- }
826
- }
827
-
828
- class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
829
- constructor(firestore) {
830
- super();
831
- this.firestore = firestore;
832
- this.collectionName = 'products';
833
- this.model = Product;
834
- }
835
- }
836
-
837
- class ProductVariantFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Product) {
838
- constructor(firestore, parentRepository) {
839
- super();
840
- this.firestore = firestore;
841
- this.parentRepository = parentRepository;
842
- this.collectionName = 'Variants';
843
- this.parentIdField = 'productId';
844
- this.model = Variant;
845
- }
846
- }
847
-
848
- class CheckoutFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
849
- constructor(firestore) {
850
- super();
851
- this.firestore = firestore;
852
- this.collectionName = 'checkouts';
853
- this.model = Checkout;
854
- }
855
- }
856
-
857
- class CouponFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
858
- constructor(firestore) {
859
- super();
860
- this.firestore = firestore;
861
- this.collectionName = 'coupons';
862
- this.model = Coupon;
863
- }
864
- }
865
-
866
- class OrderFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
867
- constructor(firestore) {
868
- super();
869
- this.firestore = firestore;
870
- this.collectionName = 'orders';
871
- this.model = Order;
872
- }
873
- }
874
-
875
- class PaymentFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
876
- constructor(firestore) {
877
- super();
878
- this.firestore = firestore;
879
- this.collectionName = 'payments';
880
- this.model = Payment;
881
- }
882
- }
883
-
884
- class CheckoutSubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
885
- constructor(firestore) {
886
- super();
887
- this.firestore = firestore;
888
- this.collectionName = 'checkoutsSubscription';
889
- this.model = CheckoutSubscription;
890
- }
891
- }
892
-
893
- class SubscriptionPlanFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
894
- constructor(firestore) {
895
- super();
896
- this.firestore = firestore;
897
- this.collectionName = 'subscriptionPlans';
898
- this.model = SubscriptionPlan;
899
- }
900
- }
901
-
902
- class Buy2WinFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
903
- constructor(firestore) {
904
- super();
905
- this.firestore = firestore;
906
- this.collectionName = 'buy2win';
907
- this.model = Buy2Win;
908
- }
909
- }
910
-
911
- class AuthenticationFirebaseAuthService {
912
- constructor(firebaseAuth) {
913
- this.firebaseAuth = firebaseAuth;
914
- }
915
- signInWithEmailAndPassword(data) {
916
- return __awaiter(this, void 0, void 0, function* () {
917
- const credentials = yield this.firebaseAuth.signInWithEmailAndPassword(data.email, data.password);
918
- const user = credentials.user;
919
- return { id: user.uid, displayName: user.displayName, email: user.email, phone: user.phoneNumber };
920
- });
921
- }
922
- signInWithGoogle() {
923
- return __awaiter(this, void 0, void 0, function* () {
924
- const credentials = yield this.firebaseAuth.signInWithPopup(new firebase$1.auth.GoogleAuthProvider());
925
- const user = credentials.user;
926
- return { id: user.uid, displayName: user.displayName, email: user.email, phone: user.phoneNumber };
927
- });
928
- }
929
- signOut() {
930
- return __awaiter(this, void 0, void 0, function* () {
931
- this.firebaseAuth.signOut();
932
- });
933
- }
934
- }
935
-
936
- /**
937
- * Generated bundle index. Do not edit.
736
+ class SubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
737
+ constructor(firestore) {
738
+ super();
739
+ this.firestore = firestore;
740
+ this.collectionName = 'subscription';
741
+ this.model = Subscription;
742
+ }
743
+ }
744
+
745
+ class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
746
+ constructor(firestore) {
747
+ super();
748
+ this.firestore = firestore;
749
+ this.collectionName = 'users';
750
+ this.model = User;
751
+ }
752
+ get(identifiers) {
753
+ const _super = Object.create(null, {
754
+ get: { get: () => super.get }
755
+ });
756
+ return __awaiter(this, void 0, void 0, function* () {
757
+ const user = yield _super.get.call(this, { id: identifiers.id });
758
+ user.beautyProfile = yield this.getBeautyProfile(user.id);
759
+ return user;
760
+ });
761
+ }
762
+ getBeautyProfile(userId) {
763
+ return __awaiter(this, void 0, void 0, function* () {
764
+ const beautyProfile = yield this.collection()
765
+ .doc(userId)
766
+ .collection('CX')
767
+ .withConverter(this.buildBeautyProfileModelInstance())
768
+ .doc('beautyProfile')
769
+ .get();
770
+ return beautyProfile.data();
771
+ });
772
+ }
773
+ buildBeautyProfileModelInstance() {
774
+ return {
775
+ toFirestore: (data) => data.toPlain(),
776
+ fromFirestore: (snap) => BeautyProfile.toInstance(snap.data()),
777
+ };
778
+ }
779
+ }
780
+
781
+ class SubscriptionEditionFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Subscription) {
782
+ constructor(firestore, parentRepository) {
783
+ super();
784
+ this.firestore = firestore;
785
+ this.parentRepository = parentRepository;
786
+ this.collectionName = 'editions';
787
+ this.parentIdField = 'subscriptionId';
788
+ this.model = Edition;
789
+ }
790
+ }
791
+
792
+ class UserBeautyProfileFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User) {
793
+ constructor(firestore, parentRepository) {
794
+ super();
795
+ this.firestore = firestore;
796
+ this.parentRepository = parentRepository;
797
+ this.collectionName = 'CX';
798
+ this.parentIdField = 'userId';
799
+ this.model = BeautyProfile;
800
+ }
801
+ }
802
+
803
+ class UserAddressFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User) {
804
+ constructor(firestore, parentRepository) {
805
+ super();
806
+ this.firestore = firestore;
807
+ this.parentRepository = parentRepository;
808
+ this.collectionName = 'address';
809
+ this.parentIdField = 'userId';
810
+ this.model = UserAddress;
811
+ }
812
+ }
813
+
814
+ class SubscriptionPaymentFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Subscription) {
815
+ constructor(firestore, parentRepository) {
816
+ super();
817
+ this.firestore = firestore;
818
+ this.parentRepository = parentRepository;
819
+ this.collectionName = 'Payments';
820
+ this.parentIdField = 'subscriptionId';
821
+ this.model = SubscriptionPayment;
822
+ }
823
+ }
824
+
825
+ class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
826
+ constructor(firestore) {
827
+ super();
828
+ this.firestore = firestore;
829
+ this.collectionName = 'categories';
830
+ this.model = Category;
831
+ }
832
+ }
833
+
834
+ class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
835
+ constructor(firestore) {
836
+ super();
837
+ this.firestore = firestore;
838
+ this.collectionName = 'products';
839
+ this.model = Product;
840
+ }
841
+ }
842
+
843
+ class ProductVariantFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Product) {
844
+ constructor(firestore, parentRepository) {
845
+ super();
846
+ this.firestore = firestore;
847
+ this.parentRepository = parentRepository;
848
+ this.collectionName = 'Variants';
849
+ this.parentIdField = 'productId';
850
+ this.model = Variant;
851
+ }
852
+ }
853
+
854
+ class CheckoutFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
855
+ constructor(firestore) {
856
+ super();
857
+ this.firestore = firestore;
858
+ this.collectionName = 'checkouts';
859
+ this.model = Checkout;
860
+ }
861
+ }
862
+
863
+ class CouponFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
864
+ constructor(firestore) {
865
+ super();
866
+ this.firestore = firestore;
867
+ this.collectionName = 'coupons';
868
+ this.model = Coupon;
869
+ }
870
+ }
871
+
872
+ class OrderFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
873
+ constructor(firestore) {
874
+ super();
875
+ this.firestore = firestore;
876
+ this.collectionName = 'orders';
877
+ this.model = Order;
878
+ }
879
+ }
880
+
881
+ class PaymentFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
882
+ constructor(firestore) {
883
+ super();
884
+ this.firestore = firestore;
885
+ this.collectionName = 'payments';
886
+ this.model = Payment;
887
+ }
888
+ }
889
+
890
+ class CheckoutSubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
891
+ constructor(firestore) {
892
+ super();
893
+ this.firestore = firestore;
894
+ this.collectionName = 'checkoutsSubscription';
895
+ this.model = CheckoutSubscription;
896
+ }
897
+ }
898
+
899
+ class SubscriptionPlanFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
900
+ constructor(firestore) {
901
+ super();
902
+ this.firestore = firestore;
903
+ this.collectionName = 'subscriptionPlans';
904
+ this.model = SubscriptionPlan;
905
+ }
906
+ }
907
+
908
+ class Buy2WinFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
909
+ constructor(firestore) {
910
+ super();
911
+ this.firestore = firestore;
912
+ this.collectionName = 'buy2win';
913
+ this.model = Buy2Win;
914
+ }
915
+ }
916
+
917
+ class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
918
+ constructor(firestore) {
919
+ super();
920
+ this.firestore = firestore;
921
+ this.collectionName = 'dms';
922
+ this.model = Home;
923
+ }
924
+ }
925
+
926
+ class AuthenticationFirebaseAuthService {
927
+ constructor(firebaseAuth) {
928
+ this.firebaseAuth = firebaseAuth;
929
+ }
930
+ signInWithEmailAndPassword(data) {
931
+ return __awaiter(this, void 0, void 0, function* () {
932
+ const credentials = yield this.firebaseAuth.signInWithEmailAndPassword(data.email, data.password);
933
+ const user = credentials.user;
934
+ return { id: user.uid, displayName: user.displayName, email: user.email, phone: user.phoneNumber };
935
+ });
936
+ }
937
+ signInWithGoogle() {
938
+ return __awaiter(this, void 0, void 0, function* () {
939
+ const credentials = yield this.firebaseAuth.signInWithPopup(new firebase$1.auth.GoogleAuthProvider());
940
+ const user = credentials.user;
941
+ return { id: user.uid, displayName: user.displayName, email: user.email, phone: user.phoneNumber };
942
+ });
943
+ }
944
+ signOut() {
945
+ return __awaiter(this, void 0, void 0, function* () {
946
+ this.firebaseAuth.signOut();
947
+ });
948
+ }
949
+ }
950
+
951
+ /**
952
+ * Generated bundle index. Do not edit.
938
953
  */
939
954
 
940
- export { Address, Area, Authentication, AuthenticationFirebaseAuthService, Base, BaseModel, BeardSizes, BeautyProfile, BillingStatus, Buy2Win, Buy2WinFirestoreRepository, Category, CategoryFirestoreRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, Coupon, CouponFirestoreRepository, CouponSubtypes, CouponTypes, Edition, EditionStatus, Exclusivities, FinancialCoupon, HairTypes, InvalidArgumentError, LineItem, NotFoundError, OfficePosition, Order, OrderFirestoreRepository, OrderStatus, Payment, PaymentFirestoreRepository, PaymentType, Product, ProductFirestoreRepository, ProductVariantFirestoreRepository, RequiredArgumentError, ShippingMethod, 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 };
955
+ export { Address, Area, Authentication, AuthenticationFirebaseAuthService, Base, BaseModel, BeardSizes, BeautyProfile, BillingStatus, Buy2Win, Buy2WinFirestoreRepository, Category, CategoryFirestoreRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, Coupon, CouponFirestoreRepository, CouponSubtypes, CouponTypes, Edition, EditionStatus, Exclusivities, FinancialCoupon, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, LineItem, NotFoundError, OfficePosition, Order, OrderFirestoreRepository, OrderStatus, Payment, PaymentFirestoreRepository, PaymentType, Product, ProductFirestoreRepository, ProductVariantFirestoreRepository, RequiredArgumentError, ShippingMethod, 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 };
941
956
  //# sourceMappingURL=infrab4a-connect.js.map