@infrab4a/connect 0.4.9 → 0.5.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 (392) hide show
  1. package/README.md +24 -24
  2. package/bundles/infrab4a-connect.umd.js +1787 -1625
  3. package/bundles/infrab4a-connect.umd.js.map +1 -1
  4. package/esm2015/infrab4a-connect.js +4 -4
  5. package/esm2015/lib/domain/catalog/index.js +3 -3
  6. package/esm2015/lib/domain/catalog/models/category.js +7 -7
  7. package/esm2015/lib/domain/catalog/models/enums/index.js +2 -2
  8. package/esm2015/lib/domain/catalog/models/enums/shops.enum.js +6 -6
  9. package/esm2015/lib/domain/catalog/models/index.js +6 -6
  10. package/esm2015/lib/domain/catalog/models/product.js +11 -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 -7
  51. package/esm2015/lib/domain/location/index.js +2 -2
  52. package/esm2015/lib/domain/location/models/address.js +4 -4
  53. package/esm2015/lib/domain/location/models/index.js +3 -3
  54. package/esm2015/lib/domain/location/models/types/index.js +4 -4
  55. package/esm2015/lib/domain/location/models/types/location-bound.type.js +2 -2
  56. package/esm2015/lib/domain/location/models/types/location-geometry.type.js +2 -2
  57. package/esm2015/lib/domain/location/models/types/location-lat-lng.type.js +2 -2
  58. package/esm2015/lib/domain/shop-settings/index.js +3 -3
  59. package/esm2015/lib/domain/shop-settings/models/home.js +7 -7
  60. package/esm2015/lib/domain/shop-settings/models/index.js +4 -4
  61. package/esm2015/lib/domain/shop-settings/models/shop-menu.js +7 -7
  62. package/esm2015/lib/domain/shop-settings/models/types/banner.type.js +2 -2
  63. package/esm2015/lib/domain/shop-settings/models/types/benefit.type.js +2 -2
  64. package/esm2015/lib/domain/shop-settings/models/types/index.js +5 -5
  65. package/esm2015/lib/domain/shop-settings/models/types/menu-nav.type.js +2 -2
  66. package/esm2015/lib/domain/shop-settings/models/types/sub-menu.type.js +2 -2
  67. package/esm2015/lib/domain/shop-settings/repositories/home.repository.js +2 -2
  68. package/esm2015/lib/domain/shop-settings/repositories/index.js +3 -3
  69. package/esm2015/lib/domain/shop-settings/repositories/shop-menu.repository.js +2 -2
  70. package/esm2015/lib/domain/shopping/index.js +3 -3
  71. package/esm2015/lib/domain/shopping/models/buy-2-win.js +14 -7
  72. package/esm2015/lib/domain/shopping/models/checkout.js +38 -7
  73. package/esm2015/lib/domain/shopping/models/coupons/coupon.js +19 -15
  74. package/esm2015/lib/domain/shopping/models/coupons/enums/coupon-subtypes.enum.js +6 -6
  75. package/esm2015/lib/domain/shopping/models/coupons/enums/coupon-types.enum.js +8 -8
  76. package/esm2015/lib/domain/shopping/models/coupons/enums/exclusivities.enum.js +7 -7
  77. package/esm2015/lib/domain/shopping/models/coupons/enums/index.js +4 -4
  78. package/esm2015/lib/domain/shopping/models/coupons/financial-coupon.js +28 -28
  79. package/esm2015/lib/domain/shopping/models/coupons/index.js +4 -4
  80. package/esm2015/lib/domain/shopping/models/enums/checkout-types.enum.js +6 -6
  81. package/esm2015/lib/domain/shopping/models/enums/index.js +3 -3
  82. package/esm2015/lib/domain/shopping/models/enums/order-status.enum.js +12 -12
  83. package/esm2015/lib/domain/shopping/models/index.js +12 -12
  84. package/esm2015/lib/domain/shopping/models/line-item.js +4 -4
  85. package/esm2015/lib/domain/shopping/models/order.js +11 -4
  86. package/esm2015/lib/domain/shopping/models/payment.js +169 -129
  87. package/esm2015/lib/domain/shopping/models/shipping-method.js +7 -7
  88. package/esm2015/lib/domain/shopping/models/subscription/checkout.js +28 -7
  89. package/esm2015/lib/domain/shopping/models/subscription/index.js +3 -3
  90. package/esm2015/lib/domain/shopping/models/subscription/plan.js +7 -7
  91. package/esm2015/lib/domain/shopping/models/types/index.js +8 -8
  92. package/esm2015/lib/domain/shopping/models/types/payment-address.type.js +2 -2
  93. package/esm2015/lib/domain/shopping/models/types/payment-billing.type.js +2 -2
  94. package/esm2015/lib/domain/shopping/models/types/payment-card.type.js +2 -2
  95. package/esm2015/lib/domain/shopping/models/types/payment-customer.type.js +2 -2
  96. package/esm2015/lib/domain/shopping/models/types/payment-document.type.js +2 -2
  97. package/esm2015/lib/domain/shopping/models/types/payment-item.type.js +2 -2
  98. package/esm2015/lib/domain/shopping/models/types/payment-shipping.type.js +2 -2
  99. package/esm2015/lib/domain/shopping/repositories/buy-2-win.repository.js +2 -2
  100. package/esm2015/lib/domain/shopping/repositories/checkout.repository.js +2 -2
  101. package/esm2015/lib/domain/shopping/repositories/coupon.repository.js +2 -2
  102. package/esm2015/lib/domain/shopping/repositories/index.js +7 -7
  103. package/esm2015/lib/domain/shopping/repositories/order.repository.js +2 -2
  104. package/esm2015/lib/domain/shopping/repositories/payment.repository.js +2 -2
  105. package/esm2015/lib/domain/shopping/repositories/subscription/checkout.repository.js +2 -2
  106. package/esm2015/lib/domain/shopping/repositories/subscription/index.js +3 -3
  107. package/esm2015/lib/domain/shopping/repositories/subscription/plan.repository.js +2 -2
  108. package/esm2015/lib/domain/users/errors/index.js +2 -2
  109. package/esm2015/lib/domain/users/errors/unauthorized.error.js +7 -7
  110. package/esm2015/lib/domain/users/index.js +6 -6
  111. package/esm2015/lib/domain/users/models/beauty-profile.js +12 -12
  112. package/esm2015/lib/domain/users/models/enums/area.enum.js +13 -13
  113. package/esm2015/lib/domain/users/models/enums/beard-sizes.enum.js +9 -9
  114. package/esm2015/lib/domain/users/models/enums/hair-types.enum.js +9 -9
  115. package/esm2015/lib/domain/users/models/enums/index.js +7 -7
  116. package/esm2015/lib/domain/users/models/enums/office-position.enum.js +8 -8
  117. package/esm2015/lib/domain/users/models/enums/user-type.enum.js +10 -10
  118. package/esm2015/lib/domain/users/models/index.js +6 -6
  119. package/esm2015/lib/domain/users/models/subscription/edition.js +7 -7
  120. package/esm2015/lib/domain/users/models/subscription/enums/billing-status.enum.js +5 -5
  121. package/esm2015/lib/domain/users/models/subscription/enums/edition-status.enum.js +5 -5
  122. package/esm2015/lib/domain/users/models/subscription/enums/index.js +5 -5
  123. package/esm2015/lib/domain/users/models/subscription/enums/payment-type.enum.js +7 -7
  124. package/esm2015/lib/domain/users/models/subscription/enums/status.enum.js +5 -5
  125. package/esm2015/lib/domain/users/models/subscription/index.js +5 -5
  126. package/esm2015/lib/domain/users/models/subscription/payment.js +14 -7
  127. package/esm2015/lib/domain/users/models/subscription/subscription.js +43 -7
  128. package/esm2015/lib/domain/users/models/user-address.js +7 -7
  129. package/esm2015/lib/domain/users/models/user.js +24 -17
  130. package/esm2015/lib/domain/users/repositories/beauty-profile.repository.js +2 -2
  131. package/esm2015/lib/domain/users/repositories/edition.repository.js +2 -2
  132. package/esm2015/lib/domain/users/repositories/index.js +7 -7
  133. package/esm2015/lib/domain/users/repositories/subscription-payment.repository.js +2 -2
  134. package/esm2015/lib/domain/users/repositories/subscription.repository.js +2 -2
  135. package/esm2015/lib/domain/users/repositories/user-address.repository.js +2 -2
  136. package/esm2015/lib/domain/users/repositories/user.repository.js +2 -2
  137. package/esm2015/lib/domain/users/services/authentication.service.js +2 -2
  138. package/esm2015/lib/domain/users/services/index.js +2 -2
  139. package/esm2015/lib/domain/users/use-cases/authentication.js +40 -40
  140. package/esm2015/lib/domain/users/use-cases/index.js +3 -3
  141. package/esm2015/lib/domain/users/use-cases/signout.js +12 -12
  142. package/esm2015/lib/errors/duplicated-results.error.js +7 -7
  143. package/esm2015/lib/errors/index.js +5 -5
  144. package/esm2015/lib/errors/invalid-argument.error.js +7 -7
  145. package/esm2015/lib/errors/not-found.error.js +7 -7
  146. package/esm2015/lib/errors/required-argument.error.js +8 -8
  147. package/esm2015/lib/index.js +5 -5
  148. package/esm2015/lib/infra/firebase/auth/authentication-firebase-auth.service.js +27 -27
  149. package/esm2015/lib/infra/firebase/auth/index.js +2 -2
  150. package/esm2015/lib/infra/firebase/firestore/index.js +4 -4
  151. package/esm2015/lib/infra/firebase/firestore/mixins/index.js +10 -10
  152. package/esm2015/lib/infra/firebase/firestore/mixins/with-create-firestore.mixin.js +30 -30
  153. package/esm2015/lib/infra/firebase/firestore/mixins/with-crud-firestore.mixin.js +10 -10
  154. package/esm2015/lib/infra/firebase/firestore/mixins/with-delete-firestore.mixin.js +18 -18
  155. package/esm2015/lib/infra/firebase/firestore/mixins/with-find-firestore.mixin.js +64 -64
  156. package/esm2015/lib/infra/firebase/firestore/mixins/with-firestore.mixin.js +26 -26
  157. package/esm2015/lib/infra/firebase/firestore/mixins/with-get-firestore.mixin.js +24 -24
  158. package/esm2015/lib/infra/firebase/firestore/mixins/with-helpers.mixin.js +17 -17
  159. package/esm2015/lib/infra/firebase/firestore/mixins/with-sub-collection.mixin.js +11 -11
  160. package/esm2015/lib/infra/firebase/firestore/mixins/with-update-firestore.mixin.js +45 -45
  161. package/esm2015/lib/infra/firebase/firestore/repositories/catalog/category-firestore.repository.js +74 -74
  162. package/esm2015/lib/infra/firebase/firestore/repositories/catalog/index.js +4 -4
  163. package/esm2015/lib/infra/firebase/firestore/repositories/catalog/product-firestore.repository.js +23 -23
  164. package/esm2015/lib/infra/firebase/firestore/repositories/catalog/product-variant-firestore.repository.js +14 -14
  165. package/esm2015/lib/infra/firebase/firestore/repositories/index.js +5 -5
  166. package/esm2015/lib/infra/firebase/firestore/repositories/shop-settings/home-firestore.repository.js +12 -12
  167. package/esm2015/lib/infra/firebase/firestore/repositories/shop-settings/index.js +3 -3
  168. package/esm2015/lib/infra/firebase/firestore/repositories/shop-settings/shop-menu-firestore.repository.js +12 -12
  169. package/esm2015/lib/infra/firebase/firestore/repositories/shopping/buy-2-win-firestore.repository.js +12 -12
  170. package/esm2015/lib/infra/firebase/firestore/repositories/shopping/checkout-firestore.repository.js +12 -12
  171. package/esm2015/lib/infra/firebase/firestore/repositories/shopping/checkout-subscription-firestore.repository.js +12 -12
  172. package/esm2015/lib/infra/firebase/firestore/repositories/shopping/coupon-firestore.repository.js +12 -12
  173. package/esm2015/lib/infra/firebase/firestore/repositories/shopping/index.js +8 -8
  174. package/esm2015/lib/infra/firebase/firestore/repositories/shopping/order-firestore.repository.js +12 -12
  175. package/esm2015/lib/infra/firebase/firestore/repositories/shopping/payment-firestore.repository.js +12 -12
  176. package/esm2015/lib/infra/firebase/firestore/repositories/shopping/subscription-plan-firestore.repository.js +12 -12
  177. package/esm2015/lib/infra/firebase/firestore/repositories/users/index.js +7 -7
  178. package/esm2015/lib/infra/firebase/firestore/repositories/users/subscription-edition-firestore.repository.js +14 -14
  179. package/esm2015/lib/infra/firebase/firestore/repositories/users/subscription-firestore.repository.js +12 -12
  180. package/esm2015/lib/infra/firebase/firestore/repositories/users/subscription-payment-firestore.repository.js +14 -14
  181. package/esm2015/lib/infra/firebase/firestore/repositories/users/user-address-firestore.repository.js +14 -14
  182. package/esm2015/lib/infra/firebase/firestore/repositories/users/user-beauty-profile-firestore.repository.js +14 -14
  183. package/esm2015/lib/infra/firebase/firestore/repositories/users/user-firestore.repository.js +62 -40
  184. package/esm2015/lib/infra/firebase/firestore/types/firestore-sub.repository.type.js +2 -2
  185. package/esm2015/lib/infra/firebase/firestore/types/firestore.helpers.type.js +2 -2
  186. package/esm2015/lib/infra/firebase/firestore/types/firestore.repository.type.js +2 -2
  187. package/esm2015/lib/infra/firebase/firestore/types/index.js +4 -4
  188. package/esm2015/lib/infra/firebase/index.js +3 -3
  189. package/esm2015/lib/infra/index.js +2 -2
  190. package/esm2015/lib/utils/index.js +5 -5
  191. package/esm2015/lib/utils/mixins/base.mixin.js +6 -6
  192. package/esm2015/lib/utils/mixins/index.js +3 -3
  193. package/esm2015/lib/utils/mixins/mixin-ctor.type.js +2 -2
  194. package/esm2015/lib/utils/types/index.js +2 -2
  195. package/esm2015/lib/utils/types/prop.type.js +2 -2
  196. package/esm2015/public-api.js +3 -2
  197. package/fesm2015/infrab4a-connect.js +1061 -908
  198. package/fesm2015/infrab4a-connect.js.map +1 -1
  199. package/infrab4a-connect.d.ts +5 -5
  200. package/lib/domain/catalog/index.d.ts +2 -2
  201. package/lib/domain/catalog/models/category.d.ts +20 -20
  202. package/lib/domain/catalog/models/enums/index.d.ts +1 -1
  203. package/lib/domain/catalog/models/enums/shops.enum.d.ts +4 -4
  204. package/lib/domain/catalog/models/index.d.ts +5 -5
  205. package/lib/domain/catalog/models/product.d.ts +33 -32
  206. package/lib/domain/catalog/models/types/category-condition.type.d.ts +4 -4
  207. package/lib/domain/catalog/models/types/category-filter.type.d.ts +4 -4
  208. package/lib/domain/catalog/models/types/index.d.ts +7 -7
  209. package/lib/domain/catalog/models/types/product-review.type.d.ts +12 -12
  210. package/lib/domain/catalog/models/types/shops-description.type.d.ts +7 -7
  211. package/lib/domain/catalog/models/types/shops-price.type.d.ts +10 -10
  212. package/lib/domain/catalog/models/types/stock.type.d.ts +3 -3
  213. package/lib/domain/catalog/models/types/variant-grade.type.d.ts +4 -4
  214. package/lib/domain/catalog/models/variant.d.ts +12 -12
  215. package/lib/domain/catalog/repositories/category.repository.d.ts +12 -12
  216. package/lib/domain/catalog/repositories/index.d.ts +3 -3
  217. package/lib/domain/catalog/repositories/product.repository.d.ts +5 -5
  218. package/lib/domain/catalog/repositories/variant.repository.d.ts +4 -4
  219. package/lib/domain/general/index.d.ts +2 -2
  220. package/lib/domain/general/model/base-model-with-identifier-fields.d.ts +3 -3
  221. package/lib/domain/general/model/base.model.d.ts +6 -6
  222. package/lib/domain/general/model/identifier-fields.d.ts +4 -4
  223. package/lib/domain/general/model/index.d.ts +4 -4
  224. package/lib/domain/general/model/types/base-model-builder.type.d.ts +5 -5
  225. package/lib/domain/general/model/types/index.d.ts +3 -3
  226. package/lib/domain/general/model/types/non-function-properties.type.d.ts +2 -2
  227. package/lib/domain/general/model/types/non-function-property-name.type.d.ts +3 -3
  228. package/lib/domain/general/repository/create.repository.d.ts +5 -5
  229. package/lib/domain/general/repository/crud.repository.d.ts +7 -7
  230. package/lib/domain/general/repository/delete.repository.d.ts +5 -5
  231. package/lib/domain/general/repository/enums/index.d.ts +2 -2
  232. package/lib/domain/general/repository/enums/update-option-actions.enum.d.ts +7 -7
  233. package/lib/domain/general/repository/enums/where.enum.d.ts +9 -9
  234. package/lib/domain/general/repository/find.repository.d.ts +5 -5
  235. package/lib/domain/general/repository/get.repository.d.ts +5 -5
  236. package/lib/domain/general/repository/index.d.ts +9 -9
  237. package/lib/domain/general/repository/read.repository.d.ts +5 -5
  238. package/lib/domain/general/repository/types/index.d.ts +5 -5
  239. package/lib/domain/general/repository/types/repository-find-filters.type.d.ts +10 -10
  240. package/lib/domain/general/repository/types/repository-find-result.type.d.ts +4 -4
  241. package/lib/domain/general/repository/types/repository-limit-options.type.d.ts +4 -4
  242. package/lib/domain/general/repository/types/repository-order-by-list.type.d.ts +5 -5
  243. package/lib/domain/general/repository/types/repository-update-params.type.d.ts +11 -11
  244. package/lib/domain/general/repository/update.repository.d.ts +5 -5
  245. package/lib/domain/index.d.ts +6 -6
  246. package/lib/domain/location/index.d.ts +1 -1
  247. package/lib/domain/location/models/address.d.ts +21 -21
  248. package/lib/domain/location/models/index.d.ts +2 -2
  249. package/lib/domain/location/models/types/index.d.ts +3 -3
  250. package/lib/domain/location/models/types/location-bound.type.d.ts +6 -6
  251. package/lib/domain/location/models/types/location-geometry.type.d.ts +7 -7
  252. package/lib/domain/location/models/types/location-lat-lng.type.d.ts +4 -4
  253. package/lib/domain/shop-settings/index.d.ts +2 -2
  254. package/lib/domain/shop-settings/models/home.d.ts +17 -17
  255. package/lib/domain/shop-settings/models/index.d.ts +3 -3
  256. package/lib/domain/shop-settings/models/shop-menu.d.ts +7 -7
  257. package/lib/domain/shop-settings/models/types/banner.type.d.ts +6 -6
  258. package/lib/domain/shop-settings/models/types/benefit.type.d.ts +5 -5
  259. package/lib/domain/shop-settings/models/types/index.d.ts +4 -4
  260. package/lib/domain/shop-settings/models/types/menu-nav.type.d.ts +8 -8
  261. package/lib/domain/shop-settings/models/types/sub-menu.type.d.ts +8 -8
  262. package/lib/domain/shop-settings/repositories/home.repository.d.ts +4 -4
  263. package/lib/domain/shop-settings/repositories/index.d.ts +2 -2
  264. package/lib/domain/shop-settings/repositories/shop-menu.repository.d.ts +4 -4
  265. package/lib/domain/shopping/index.d.ts +2 -2
  266. package/lib/domain/shopping/models/buy-2-win.d.ts +18 -18
  267. package/lib/domain/shopping/models/checkout.d.ts +28 -28
  268. package/lib/domain/shopping/models/coupons/coupon.d.ts +25 -25
  269. package/lib/domain/shopping/models/coupons/enums/coupon-subtypes.enum.d.ts +4 -4
  270. package/lib/domain/shopping/models/coupons/enums/coupon-types.enum.d.ts +6 -6
  271. package/lib/domain/shopping/models/coupons/enums/exclusivities.enum.d.ts +5 -5
  272. package/lib/domain/shopping/models/coupons/enums/index.d.ts +3 -3
  273. package/lib/domain/shopping/models/coupons/financial-coupon.d.ts +8 -8
  274. package/lib/domain/shopping/models/coupons/index.d.ts +3 -3
  275. package/lib/domain/shopping/models/enums/checkout-types.enum.d.ts +4 -4
  276. package/lib/domain/shopping/models/enums/index.d.ts +2 -2
  277. package/lib/domain/shopping/models/enums/order-status.enum.d.ts +10 -10
  278. package/lib/domain/shopping/models/index.d.ts +11 -11
  279. package/lib/domain/shopping/models/line-item.d.ts +8 -7
  280. package/lib/domain/shopping/models/order.d.ts +7 -7
  281. package/lib/domain/shopping/models/payment.d.ts +69 -69
  282. package/lib/domain/shopping/models/shipping-method.d.ts +18 -18
  283. package/lib/domain/shopping/models/subscription/checkout.d.ts +23 -23
  284. package/lib/domain/shopping/models/subscription/index.d.ts +2 -2
  285. package/lib/domain/shopping/models/subscription/plan.d.ts +12 -12
  286. package/lib/domain/shopping/models/types/index.d.ts +7 -7
  287. package/lib/domain/shopping/models/types/payment-address.type.d.ts +12 -12
  288. package/lib/domain/shopping/models/types/payment-billing.type.d.ts +7 -7
  289. package/lib/domain/shopping/models/types/payment-card.type.d.ts +14 -14
  290. package/lib/domain/shopping/models/types/payment-customer.type.d.ts +18 -18
  291. package/lib/domain/shopping/models/types/payment-document.type.d.ts +6 -6
  292. package/lib/domain/shopping/models/types/payment-item.type.d.ts +11 -11
  293. package/lib/domain/shopping/models/types/payment-shipping.type.d.ts +10 -10
  294. package/lib/domain/shopping/repositories/buy-2-win.repository.d.ts +4 -4
  295. package/lib/domain/shopping/repositories/checkout.repository.d.ts +4 -4
  296. package/lib/domain/shopping/repositories/coupon.repository.d.ts +4 -4
  297. package/lib/domain/shopping/repositories/index.d.ts +6 -6
  298. package/lib/domain/shopping/repositories/order.repository.d.ts +4 -4
  299. package/lib/domain/shopping/repositories/payment.repository.d.ts +4 -4
  300. package/lib/domain/shopping/repositories/subscription/checkout.repository.d.ts +4 -4
  301. package/lib/domain/shopping/repositories/subscription/index.d.ts +2 -2
  302. package/lib/domain/shopping/repositories/subscription/plan.repository.d.ts +4 -4
  303. package/lib/domain/users/errors/index.d.ts +1 -1
  304. package/lib/domain/users/errors/unauthorized.error.d.ts +4 -4
  305. package/lib/domain/users/index.d.ts +5 -5
  306. package/lib/domain/users/models/beauty-profile.d.ts +12 -12
  307. package/lib/domain/users/models/enums/area.enum.d.ts +11 -11
  308. package/lib/domain/users/models/enums/beard-sizes.enum.d.ts +7 -7
  309. package/lib/domain/users/models/enums/hair-types.enum.d.ts +7 -7
  310. package/lib/domain/users/models/enums/index.d.ts +6 -6
  311. package/lib/domain/users/models/enums/office-position.enum.d.ts +6 -6
  312. package/lib/domain/users/models/enums/user-type.enum.d.ts +8 -8
  313. package/lib/domain/users/models/index.d.ts +5 -5
  314. package/lib/domain/users/models/subscription/edition.d.ts +15 -15
  315. package/lib/domain/users/models/subscription/enums/billing-status.enum.d.ts +3 -3
  316. package/lib/domain/users/models/subscription/enums/edition-status.enum.d.ts +3 -3
  317. package/lib/domain/users/models/subscription/enums/index.d.ts +4 -4
  318. package/lib/domain/users/models/subscription/enums/payment-type.enum.d.ts +5 -5
  319. package/lib/domain/users/models/subscription/enums/status.enum.d.ts +3 -3
  320. package/lib/domain/users/models/subscription/index.d.ts +4 -4
  321. package/lib/domain/users/models/subscription/payment.d.ts +14 -14
  322. package/lib/domain/users/models/subscription/subscription.d.ts +30 -30
  323. package/lib/domain/users/models/user-address.d.ts +7 -7
  324. package/lib/domain/users/models/user.d.ts +24 -23
  325. package/lib/domain/users/repositories/beauty-profile.repository.d.ts +4 -4
  326. package/lib/domain/users/repositories/edition.repository.d.ts +4 -4
  327. package/lib/domain/users/repositories/index.d.ts +6 -6
  328. package/lib/domain/users/repositories/subscription-payment.repository.d.ts +4 -4
  329. package/lib/domain/users/repositories/subscription.repository.d.ts +4 -4
  330. package/lib/domain/users/repositories/user-address.repository.d.ts +4 -4
  331. package/lib/domain/users/repositories/user.repository.d.ts +4 -4
  332. package/lib/domain/users/services/authentication.service.d.ts +10 -10
  333. package/lib/domain/users/services/index.d.ts +1 -1
  334. package/lib/domain/users/use-cases/authentication.d.ts +21 -21
  335. package/lib/domain/users/use-cases/index.d.ts +2 -2
  336. package/lib/domain/users/use-cases/signout.d.ts +6 -6
  337. package/lib/errors/duplicated-results.error.d.ts +4 -4
  338. package/lib/errors/index.d.ts +4 -4
  339. package/lib/errors/invalid-argument.error.d.ts +4 -4
  340. package/lib/errors/not-found.error.d.ts +4 -4
  341. package/lib/errors/required-argument.error.d.ts +5 -5
  342. package/lib/index.d.ts +4 -4
  343. package/lib/infra/firebase/auth/authentication-firebase-auth.service.d.ts +9 -9
  344. package/lib/infra/firebase/auth/index.d.ts +1 -1
  345. package/lib/infra/firebase/firestore/index.d.ts +3 -3
  346. package/lib/infra/firebase/firestore/mixins/index.d.ts +9 -9
  347. package/lib/infra/firebase/firestore/mixins/with-create-firestore.mixin.d.ts +17 -17
  348. package/lib/infra/firebase/firestore/mixins/with-crud-firestore.mixin.d.ts +29 -29
  349. package/lib/infra/firebase/firestore/mixins/with-delete-firestore.mixin.d.ts +15 -15
  350. package/lib/infra/firebase/firestore/mixins/with-find-firestore.mixin.d.ts +20 -20
  351. package/lib/infra/firebase/firestore/mixins/with-firestore.mixin.d.ts +15 -15
  352. package/lib/infra/firebase/firestore/mixins/with-get-firestore.mixin.d.ts +15 -15
  353. package/lib/infra/firebase/firestore/mixins/with-helpers.mixin.d.ts +10 -10
  354. package/lib/infra/firebase/firestore/mixins/with-sub-collection.mixin.d.ts +14 -14
  355. package/lib/infra/firebase/firestore/mixins/with-update-firestore.mixin.d.ts +16 -16
  356. package/lib/infra/firebase/firestore/repositories/catalog/category-firestore.repository.d.ts +55 -55
  357. package/lib/infra/firebase/firestore/repositories/catalog/index.d.ts +3 -3
  358. package/lib/infra/firebase/firestore/repositories/catalog/product-firestore.repository.d.ts +50 -50
  359. package/lib/infra/firebase/firestore/repositories/catalog/product-variant-firestore.repository.d.ts +60 -60
  360. package/lib/infra/firebase/firestore/repositories/index.d.ts +4 -4
  361. package/lib/infra/firebase/firestore/repositories/shop-settings/home-firestore.repository.d.ts +49 -49
  362. package/lib/infra/firebase/firestore/repositories/shop-settings/index.d.ts +2 -2
  363. package/lib/infra/firebase/firestore/repositories/shop-settings/shop-menu-firestore.repository.d.ts +49 -49
  364. package/lib/infra/firebase/firestore/repositories/shopping/buy-2-win-firestore.repository.d.ts +49 -49
  365. package/lib/infra/firebase/firestore/repositories/shopping/checkout-firestore.repository.d.ts +49 -49
  366. package/lib/infra/firebase/firestore/repositories/shopping/checkout-subscription-firestore.repository.d.ts +49 -49
  367. package/lib/infra/firebase/firestore/repositories/shopping/coupon-firestore.repository.d.ts +49 -49
  368. package/lib/infra/firebase/firestore/repositories/shopping/index.d.ts +7 -7
  369. package/lib/infra/firebase/firestore/repositories/shopping/order-firestore.repository.d.ts +49 -49
  370. package/lib/infra/firebase/firestore/repositories/shopping/payment-firestore.repository.d.ts +49 -49
  371. package/lib/infra/firebase/firestore/repositories/shopping/subscription-plan-firestore.repository.d.ts +49 -49
  372. package/lib/infra/firebase/firestore/repositories/users/index.d.ts +6 -6
  373. package/lib/infra/firebase/firestore/repositories/users/subscription-edition-firestore.repository.d.ts +60 -60
  374. package/lib/infra/firebase/firestore/repositories/users/subscription-firestore.repository.d.ts +49 -49
  375. package/lib/infra/firebase/firestore/repositories/users/subscription-payment-firestore.repository.d.ts +60 -60
  376. package/lib/infra/firebase/firestore/repositories/users/user-address-firestore.repository.d.ts +60 -60
  377. package/lib/infra/firebase/firestore/repositories/users/user-beauty-profile-firestore.repository.d.ts +60 -60
  378. package/lib/infra/firebase/firestore/repositories/users/user-firestore.repository.d.ts +57 -52
  379. package/lib/infra/firebase/firestore/types/firestore-sub.repository.type.d.ts +6 -6
  380. package/lib/infra/firebase/firestore/types/firestore.helpers.type.d.ts +8 -8
  381. package/lib/infra/firebase/firestore/types/firestore.repository.type.d.ts +8 -8
  382. package/lib/infra/firebase/firestore/types/index.d.ts +3 -3
  383. package/lib/infra/firebase/index.d.ts +2 -2
  384. package/lib/infra/index.d.ts +1 -1
  385. package/lib/utils/index.d.ts +4 -4
  386. package/lib/utils/mixins/base.mixin.d.ts +3 -3
  387. package/lib/utils/mixins/index.d.ts +2 -2
  388. package/lib/utils/mixins/mixin-ctor.type.d.ts +1 -1
  389. package/lib/utils/types/index.d.ts +1 -1
  390. package/lib/utils/types/prop.type.d.ts +1 -1
  391. package/package.json +1 -1
  392. package/public-api.d.ts +2 -1
@@ -1,1778 +1,1940 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('class-transformer'), require('lodash'), require('ts-md5'), require('firebase'), require('firebase/app')) :
3
- typeof define === 'function' && define.amd ? define('@infrab4a/connect', ['exports', 'class-transformer', 'lodash', 'ts-md5', 'firebase', 'firebase/app'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.infrab4a = global.infrab4a || {}, global.infrab4a.connect = {}), global["class-transformer"], global.lodash, global.tsMd5, global.firebase, global.firebase$1));
5
- })(this, (function (exports, classTransformer, lodash, tsMd5, firebase, firebase$1) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('reflect-metadata'), require('class-transformer'), require('lodash'), require('ts-md5'), require('firebase'), require('firebase/app')) :
3
+ typeof define === 'function' && define.amd ? define('@infrab4a/connect', ['exports', 'reflect-metadata', 'class-transformer', 'lodash', 'ts-md5', 'firebase', 'firebase/app'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.infrab4a = global.infrab4a || {}, global.infrab4a.connect = {}), null, global["class-transformer"], global.lodash, global.tsMd5, global.firebase, global.firebase$1));
5
+ })(this, (function (exports, reflectMetadata, classTransformer, lodash, tsMd5, firebase, firebase$1) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
9
9
  var firebase__default = /*#__PURE__*/_interopDefaultLegacy(firebase);
10
10
  var firebase__default$1 = /*#__PURE__*/_interopDefaultLegacy(firebase$1);
11
11
 
12
- var BaseModel = /** @class */ (function () {
13
- function BaseModel(args) {
14
- Object.assign(this, args);
15
- }
16
- BaseModel.toInstance = function (data) {
17
- return classTransformer.plainToClass(this, data);
18
- };
19
- BaseModel.prototype.toPlain = function () {
20
- return classTransformer.classToPlain(this, { exposeUnsetFields: false });
21
- };
22
- return BaseModel;
12
+ var BaseModel = /** @class */ (function () {
13
+ function BaseModel(args) {
14
+ Object.assign(this, args);
15
+ }
16
+ BaseModel.toInstance = function (data) {
17
+ return classTransformer.plainToClass(this, data);
18
+ };
19
+ BaseModel.prototype.toPlain = function () {
20
+ return classTransformer.classToPlain(this, { exposeUnsetFields: false });
21
+ };
22
+ return BaseModel;
23
23
  }());
24
24
 
25
- exports.Where = void 0;
26
- (function (Where) {
27
- Where["EQUALS"] = "==";
28
- Where["GT"] = ">";
29
- Where["GTE"] = ">=";
30
- Where["IN"] = "in";
31
- Where["LT"] = "<";
32
- Where["LTE"] = "<=";
33
- Where["LIKE"] = "like";
25
+ exports.Where = void 0;
26
+ (function (Where) {
27
+ Where["EQUALS"] = "==";
28
+ Where["GT"] = ">";
29
+ Where["GTE"] = ">=";
30
+ Where["IN"] = "in";
31
+ Where["LT"] = "<";
32
+ Where["LTE"] = "<=";
33
+ Where["LIKE"] = "like";
34
34
  })(exports.Where || (exports.Where = {}));
35
35
 
36
- exports.UpdateOptionActions = void 0;
37
- (function (UpdateOptionActions) {
38
- UpdateOptionActions["UPDATE"] = "update";
39
- UpdateOptionActions["MERGE"] = "merge";
40
- UpdateOptionActions["REMOVE"] = "remove";
41
- UpdateOptionActions["REMOVE_FIELD"] = "removeField";
42
- UpdateOptionActions["NULL"] = "null";
36
+ exports.UpdateOptionActions = void 0;
37
+ (function (UpdateOptionActions) {
38
+ UpdateOptionActions["UPDATE"] = "update";
39
+ UpdateOptionActions["MERGE"] = "merge";
40
+ UpdateOptionActions["REMOVE"] = "remove";
41
+ UpdateOptionActions["REMOVE_FIELD"] = "removeField";
42
+ UpdateOptionActions["NULL"] = "null";
43
43
  })(exports.UpdateOptionActions || (exports.UpdateOptionActions = {}));
44
44
 
45
- exports.UserType = void 0;
46
- (function (UserType) {
47
- UserType["B2C"] = "Cliente Transacional";
48
- UserType["GlamGirl"] = "Glamgirl";
49
- UserType["MensBoy"] = "Mensboy";
50
- UserType["B2B"] = "Company";
51
- UserType["Collaborator"] = "Funcion\u00E1rio";
52
- UserType["Influencer"] = "Influencer";
45
+ exports.UserType = void 0;
46
+ (function (UserType) {
47
+ UserType["B2C"] = "Cliente Transacional";
48
+ UserType["GlamGirl"] = "Glamgirl";
49
+ UserType["MensBoy"] = "Mensboy";
50
+ UserType["B2B"] = "Company";
51
+ UserType["Collaborator"] = "Funcion\u00E1rio";
52
+ UserType["Influencer"] = "Influencer";
53
53
  })(exports.UserType || (exports.UserType = {}));
54
54
 
55
- exports.BeardSizes = void 0;
56
- (function (BeardSizes) {
57
- BeardSizes["BIG"] = "Grande";
58
- BeardSizes["MEDIUM"] = "M\u00E9dia";
59
- BeardSizes["SHORT"] = "Curta";
60
- BeardSizes["MUSTACHE"] = "Bigode";
61
- BeardSizes["NOTHING"] = "Sem Barba";
55
+ exports.BeardSizes = void 0;
56
+ (function (BeardSizes) {
57
+ BeardSizes["BIG"] = "Grande";
58
+ BeardSizes["MEDIUM"] = "M\u00E9dia";
59
+ BeardSizes["SHORT"] = "Curta";
60
+ BeardSizes["MUSTACHE"] = "Bigode";
61
+ BeardSizes["NOTHING"] = "Sem Barba";
62
62
  })(exports.BeardSizes || (exports.BeardSizes = {}));
63
63
 
64
- exports.HairTypes = void 0;
65
- (function (HairTypes) {
66
- HairTypes["Smooth"] = "Liso";
67
- HairTypes["WAVY"] = "Ondulado";
68
- HairTypes["CURLY"] = "Cacheado";
69
- HairTypes["FRIZZY"] = "Crespo";
70
- HairTypes["BALD"] = "Sou careca";
64
+ exports.HairTypes = void 0;
65
+ (function (HairTypes) {
66
+ HairTypes["Smooth"] = "Liso";
67
+ HairTypes["WAVY"] = "Ondulado";
68
+ HairTypes["CURLY"] = "Cacheado";
69
+ HairTypes["FRIZZY"] = "Crespo";
70
+ HairTypes["BALD"] = "Sou careca";
71
71
  })(exports.HairTypes || (exports.HairTypes = {}));
72
72
 
73
- exports.Area = void 0;
74
- (function (Area) {
75
- Area["GP"] = "Geral";
76
- Area["CRM"] = "CRM";
77
- Area["MediaProd"] = "Media Production";
78
- Area["Tech"] = "Tecnologia";
79
- Area["Transactional"] = "Transacional";
80
- Area["Operations"] = "Opera\u00E7\u00F5es";
81
- Area["Sales"] = "Comercial";
82
- Area["Finantial"] = "Financeiro";
83
- Area["HR"] = "RH";
73
+ exports.Area = void 0;
74
+ (function (Area) {
75
+ Area["GP"] = "Geral";
76
+ Area["CRM"] = "CRM";
77
+ Area["MediaProd"] = "Media Production";
78
+ Area["Tech"] = "Tecnologia";
79
+ Area["Transactional"] = "Transacional";
80
+ Area["Operations"] = "Opera\u00E7\u00F5es";
81
+ Area["Sales"] = "Comercial";
82
+ Area["Finantial"] = "Financeiro";
83
+ Area["HR"] = "RH";
84
84
  })(exports.Area || (exports.Area = {}));
85
85
 
86
- exports.OfficePosition = void 0;
87
- (function (OfficePosition) {
88
- OfficePosition["Intern"] = "Estagi\u00E1rio";
89
- OfficePosition["Analyst"] = "Analista";
90
- OfficePosition["Manager"] = "Gerente";
91
- OfficePosition["Director"] = "Diretor";
86
+ exports.OfficePosition = void 0;
87
+ (function (OfficePosition) {
88
+ OfficePosition["Intern"] = "Estagi\u00E1rio";
89
+ OfficePosition["Analyst"] = "Analista";
90
+ OfficePosition["Manager"] = "Gerente";
91
+ OfficePosition["Director"] = "Diretor";
92
92
  })(exports.OfficePosition || (exports.OfficePosition = {}));
93
93
 
94
- exports.BillingStatus = void 0;
95
- (function (BillingStatus) {
96
- BillingStatus["PAYED"] = "PAGO";
94
+ exports.BillingStatus = void 0;
95
+ (function (BillingStatus) {
96
+ BillingStatus["PAYED"] = "PAGO";
97
97
  })(exports.BillingStatus || (exports.BillingStatus = {}));
98
98
 
99
- exports.EditionStatus = void 0;
100
- (function (EditionStatus) {
101
- EditionStatus["ALLOCATION_WAITING"] = "Aguardando aloca\u00E7\u00E3o";
99
+ exports.EditionStatus = void 0;
100
+ (function (EditionStatus) {
101
+ EditionStatus["ALLOCATION_WAITING"] = "Aguardando aloca\u00E7\u00E3o";
102
102
  })(exports.EditionStatus || (exports.EditionStatus = {}));
103
103
 
104
- exports.PaymentType = void 0;
105
- (function (PaymentType) {
106
- PaymentType["AQUISITION"] = "Aquisi\u00E7\u00E3o";
107
- PaymentType["RENEWAL"] = "Renova\u00E7\u00E3o";
108
- PaymentType["FREIGHT"] = "mudan\u00E7a de endere\u00E7o, Frete";
104
+ exports.PaymentType = void 0;
105
+ (function (PaymentType) {
106
+ PaymentType["AQUISITION"] = "Aquisi\u00E7\u00E3o";
107
+ PaymentType["RENEWAL"] = "Renova\u00E7\u00E3o";
108
+ PaymentType["FREIGHT"] = "mudan\u00E7a de endere\u00E7o, Frete";
109
109
  })(exports.PaymentType || (exports.PaymentType = {}));
110
110
 
111
- exports.Status = void 0;
112
- (function (Status) {
113
- Status["ACTIVE"] = "active";
111
+ exports.Status = void 0;
112
+ (function (Status) {
113
+ Status["ACTIVE"] = "active";
114
114
  })(exports.Status || (exports.Status = {}));
115
115
 
116
- /*! *****************************************************************************
117
- Copyright (c) Microsoft Corporation.
118
-
119
- Permission to use, copy, modify, and/or distribute this software for any
120
- purpose with or without fee is hereby granted.
121
-
122
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
123
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
124
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
125
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
126
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
127
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
128
- PERFORMANCE OF THIS SOFTWARE.
129
- ***************************************************************************** */
130
- /* global Reflect, Promise */
131
- var extendStatics = function (d, b) {
132
- extendStatics = Object.setPrototypeOf ||
133
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
134
- function (d, b) { for (var p in b)
135
- if (Object.prototype.hasOwnProperty.call(b, p))
136
- d[p] = b[p]; };
137
- return extendStatics(d, b);
138
- };
139
- function __extends(d, b) {
140
- if (typeof b !== "function" && b !== null)
141
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
142
- extendStatics(d, b);
143
- function __() { this.constructor = d; }
144
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
145
- }
146
- var __assign = function () {
147
- __assign = Object.assign || function __assign(t) {
148
- for (var s, i = 1, n = arguments.length; i < n; i++) {
149
- s = arguments[i];
150
- for (var p in s)
151
- if (Object.prototype.hasOwnProperty.call(s, p))
152
- t[p] = s[p];
153
- }
154
- return t;
155
- };
156
- return __assign.apply(this, arguments);
157
- };
158
- function __rest(s, e) {
159
- var t = {};
160
- for (var p in s)
161
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
162
- t[p] = s[p];
163
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
164
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
165
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
166
- t[p[i]] = s[p[i]];
167
- }
168
- return t;
169
- }
170
- function __decorate(decorators, target, key, desc) {
171
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
172
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
173
- r = Reflect.decorate(decorators, target, key, desc);
174
- else
175
- for (var i = decorators.length - 1; i >= 0; i--)
176
- if (d = decorators[i])
177
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
178
- return c > 3 && r && Object.defineProperty(target, key, r), r;
179
- }
180
- function __param(paramIndex, decorator) {
181
- return function (target, key) { decorator(target, key, paramIndex); };
182
- }
183
- function __metadata(metadataKey, metadataValue) {
184
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
185
- return Reflect.metadata(metadataKey, metadataValue);
186
- }
187
- function __awaiter(thisArg, _arguments, P, generator) {
188
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
189
- return new (P || (P = Promise))(function (resolve, reject) {
190
- function fulfilled(value) { try {
191
- step(generator.next(value));
192
- }
193
- catch (e) {
194
- reject(e);
195
- } }
196
- function rejected(value) { try {
197
- step(generator["throw"](value));
198
- }
199
- catch (e) {
200
- reject(e);
201
- } }
202
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
203
- step((generator = generator.apply(thisArg, _arguments || [])).next());
204
- });
205
- }
206
- function __generator(thisArg, body) {
207
- var _ = { label: 0, sent: function () { if (t[0] & 1)
208
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
209
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
210
- function verb(n) { return function (v) { return step([n, v]); }; }
211
- function step(op) {
212
- if (f)
213
- throw new TypeError("Generator is already executing.");
214
- while (_)
215
- try {
216
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
217
- return t;
218
- if (y = 0, t)
219
- op = [op[0] & 2, t.value];
220
- switch (op[0]) {
221
- case 0:
222
- case 1:
223
- t = op;
224
- break;
225
- case 4:
226
- _.label++;
227
- return { value: op[1], done: false };
228
- case 5:
229
- _.label++;
230
- y = op[1];
231
- op = [0];
232
- continue;
233
- case 7:
234
- op = _.ops.pop();
235
- _.trys.pop();
236
- continue;
237
- default:
238
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
239
- _ = 0;
240
- continue;
241
- }
242
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
243
- _.label = op[1];
244
- break;
245
- }
246
- if (op[0] === 6 && _.label < t[1]) {
247
- _.label = t[1];
248
- t = op;
249
- break;
250
- }
251
- if (t && _.label < t[2]) {
252
- _.label = t[2];
253
- _.ops.push(op);
254
- break;
255
- }
256
- if (t[2])
257
- _.ops.pop();
258
- _.trys.pop();
259
- continue;
260
- }
261
- op = body.call(thisArg, _);
262
- }
263
- catch (e) {
264
- op = [6, e];
265
- y = 0;
266
- }
267
- finally {
268
- f = t = 0;
269
- }
270
- if (op[0] & 5)
271
- throw op[1];
272
- return { value: op[0] ? op[1] : void 0, done: true };
273
- }
274
- }
275
- var __createBinding = Object.create ? (function (o, m, k, k2) {
276
- if (k2 === undefined)
277
- k2 = k;
278
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
279
- }) : (function (o, m, k, k2) {
280
- if (k2 === undefined)
281
- k2 = k;
282
- o[k2] = m[k];
283
- });
284
- function __exportStar(m, o) {
285
- for (var p in m)
286
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
287
- __createBinding(o, m, p);
288
- }
289
- function __values(o) {
290
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
291
- if (m)
292
- return m.call(o);
293
- if (o && typeof o.length === "number")
294
- return {
295
- next: function () {
296
- if (o && i >= o.length)
297
- o = void 0;
298
- return { value: o && o[i++], done: !o };
299
- }
300
- };
301
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
302
- }
303
- function __read(o, n) {
304
- var m = typeof Symbol === "function" && o[Symbol.iterator];
305
- if (!m)
306
- return o;
307
- var i = m.call(o), r, ar = [], e;
308
- try {
309
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
310
- ar.push(r.value);
311
- }
312
- catch (error) {
313
- e = { error: error };
314
- }
315
- finally {
316
- try {
317
- if (r && !r.done && (m = i["return"]))
318
- m.call(i);
319
- }
320
- finally {
321
- if (e)
322
- throw e.error;
323
- }
324
- }
325
- return ar;
326
- }
327
- /** @deprecated */
328
- function __spread() {
329
- for (var ar = [], i = 0; i < arguments.length; i++)
330
- ar = ar.concat(__read(arguments[i]));
331
- return ar;
332
- }
333
- /** @deprecated */
334
- function __spreadArrays() {
335
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
336
- s += arguments[i].length;
337
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
338
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
339
- r[k] = a[j];
340
- return r;
341
- }
342
- function __spreadArray(to, from, pack) {
343
- if (pack || arguments.length === 2)
344
- for (var i = 0, l = from.length, ar; i < l; i++) {
345
- if (ar || !(i in from)) {
346
- if (!ar)
347
- ar = Array.prototype.slice.call(from, 0, i);
348
- ar[i] = from[i];
349
- }
350
- }
351
- return to.concat(ar || Array.prototype.slice.call(from));
352
- }
353
- function __await(v) {
354
- return this instanceof __await ? (this.v = v, this) : new __await(v);
355
- }
356
- function __asyncGenerator(thisArg, _arguments, generator) {
357
- if (!Symbol.asyncIterator)
358
- throw new TypeError("Symbol.asyncIterator is not defined.");
359
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
360
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
361
- function verb(n) { if (g[n])
362
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
363
- function resume(n, v) { try {
364
- step(g[n](v));
365
- }
366
- catch (e) {
367
- settle(q[0][3], e);
368
- } }
369
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
370
- function fulfill(value) { resume("next", value); }
371
- function reject(value) { resume("throw", value); }
372
- function settle(f, v) { if (f(v), q.shift(), q.length)
373
- resume(q[0][0], q[0][1]); }
374
- }
375
- function __asyncDelegator(o) {
376
- var i, p;
377
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
378
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
379
- }
380
- function __asyncValues(o) {
381
- if (!Symbol.asyncIterator)
382
- throw new TypeError("Symbol.asyncIterator is not defined.");
383
- var m = o[Symbol.asyncIterator], i;
384
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
385
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
386
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
387
- }
388
- function __makeTemplateObject(cooked, raw) {
389
- if (Object.defineProperty) {
390
- Object.defineProperty(cooked, "raw", { value: raw });
391
- }
392
- else {
393
- cooked.raw = raw;
394
- }
395
- return cooked;
396
- }
397
- ;
398
- var __setModuleDefault = Object.create ? (function (o, v) {
399
- Object.defineProperty(o, "default", { enumerable: true, value: v });
400
- }) : function (o, v) {
401
- o["default"] = v;
402
- };
403
- function __importStar(mod) {
404
- if (mod && mod.__esModule)
405
- return mod;
406
- var result = {};
407
- if (mod != null)
408
- for (var k in mod)
409
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
410
- __createBinding(result, mod, k);
411
- __setModuleDefault(result, mod);
412
- return result;
413
- }
414
- function __importDefault(mod) {
415
- return (mod && mod.__esModule) ? mod : { default: mod };
416
- }
417
- function __classPrivateFieldGet(receiver, state, kind, f) {
418
- if (kind === "a" && !f)
419
- throw new TypeError("Private accessor was defined without a getter");
420
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
421
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
422
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
423
- }
424
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
425
- if (kind === "m")
426
- throw new TypeError("Private method is not writable");
427
- if (kind === "a" && !f)
428
- throw new TypeError("Private accessor was defined without a setter");
429
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
430
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
431
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
116
+ /*! *****************************************************************************
117
+ Copyright (c) Microsoft Corporation.
118
+
119
+ Permission to use, copy, modify, and/or distribute this software for any
120
+ purpose with or without fee is hereby granted.
121
+
122
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
123
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
124
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
125
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
126
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
127
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
128
+ PERFORMANCE OF THIS SOFTWARE.
129
+ ***************************************************************************** */
130
+ /* global Reflect, Promise */
131
+ var extendStatics = function (d, b) {
132
+ extendStatics = Object.setPrototypeOf ||
133
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
134
+ function (d, b) { for (var p in b)
135
+ if (Object.prototype.hasOwnProperty.call(b, p))
136
+ d[p] = b[p]; };
137
+ return extendStatics(d, b);
138
+ };
139
+ function __extends(d, b) {
140
+ if (typeof b !== "function" && b !== null)
141
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
142
+ extendStatics(d, b);
143
+ function __() { this.constructor = d; }
144
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
145
+ }
146
+ var __assign = function () {
147
+ __assign = Object.assign || function __assign(t) {
148
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
149
+ s = arguments[i];
150
+ for (var p in s)
151
+ if (Object.prototype.hasOwnProperty.call(s, p))
152
+ t[p] = s[p];
153
+ }
154
+ return t;
155
+ };
156
+ return __assign.apply(this, arguments);
157
+ };
158
+ function __rest(s, e) {
159
+ var t = {};
160
+ for (var p in s)
161
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
162
+ t[p] = s[p];
163
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
164
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
165
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
166
+ t[p[i]] = s[p[i]];
167
+ }
168
+ return t;
169
+ }
170
+ function __decorate(decorators, target, key, desc) {
171
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
172
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
173
+ r = Reflect.decorate(decorators, target, key, desc);
174
+ else
175
+ for (var i = decorators.length - 1; i >= 0; i--)
176
+ if (d = decorators[i])
177
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
178
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
179
+ }
180
+ function __param(paramIndex, decorator) {
181
+ return function (target, key) { decorator(target, key, paramIndex); };
182
+ }
183
+ function __metadata(metadataKey, metadataValue) {
184
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
185
+ return Reflect.metadata(metadataKey, metadataValue);
186
+ }
187
+ function __awaiter(thisArg, _arguments, P, generator) {
188
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
189
+ return new (P || (P = Promise))(function (resolve, reject) {
190
+ function fulfilled(value) { try {
191
+ step(generator.next(value));
192
+ }
193
+ catch (e) {
194
+ reject(e);
195
+ } }
196
+ function rejected(value) { try {
197
+ step(generator["throw"](value));
198
+ }
199
+ catch (e) {
200
+ reject(e);
201
+ } }
202
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
203
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
204
+ });
205
+ }
206
+ function __generator(thisArg, body) {
207
+ var _ = { label: 0, sent: function () { if (t[0] & 1)
208
+ throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
209
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
210
+ function verb(n) { return function (v) { return step([n, v]); }; }
211
+ function step(op) {
212
+ if (f)
213
+ throw new TypeError("Generator is already executing.");
214
+ while (_)
215
+ try {
216
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
217
+ return t;
218
+ if (y = 0, t)
219
+ op = [op[0] & 2, t.value];
220
+ switch (op[0]) {
221
+ case 0:
222
+ case 1:
223
+ t = op;
224
+ break;
225
+ case 4:
226
+ _.label++;
227
+ return { value: op[1], done: false };
228
+ case 5:
229
+ _.label++;
230
+ y = op[1];
231
+ op = [0];
232
+ continue;
233
+ case 7:
234
+ op = _.ops.pop();
235
+ _.trys.pop();
236
+ continue;
237
+ default:
238
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
239
+ _ = 0;
240
+ continue;
241
+ }
242
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
243
+ _.label = op[1];
244
+ break;
245
+ }
246
+ if (op[0] === 6 && _.label < t[1]) {
247
+ _.label = t[1];
248
+ t = op;
249
+ break;
250
+ }
251
+ if (t && _.label < t[2]) {
252
+ _.label = t[2];
253
+ _.ops.push(op);
254
+ break;
255
+ }
256
+ if (t[2])
257
+ _.ops.pop();
258
+ _.trys.pop();
259
+ continue;
260
+ }
261
+ op = body.call(thisArg, _);
262
+ }
263
+ catch (e) {
264
+ op = [6, e];
265
+ y = 0;
266
+ }
267
+ finally {
268
+ f = t = 0;
269
+ }
270
+ if (op[0] & 5)
271
+ throw op[1];
272
+ return { value: op[0] ? op[1] : void 0, done: true };
273
+ }
274
+ }
275
+ var __createBinding = Object.create ? (function (o, m, k, k2) {
276
+ if (k2 === undefined)
277
+ k2 = k;
278
+ Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
279
+ }) : (function (o, m, k, k2) {
280
+ if (k2 === undefined)
281
+ k2 = k;
282
+ o[k2] = m[k];
283
+ });
284
+ function __exportStar(m, o) {
285
+ for (var p in m)
286
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
287
+ __createBinding(o, m, p);
288
+ }
289
+ function __values(o) {
290
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
291
+ if (m)
292
+ return m.call(o);
293
+ if (o && typeof o.length === "number")
294
+ return {
295
+ next: function () {
296
+ if (o && i >= o.length)
297
+ o = void 0;
298
+ return { value: o && o[i++], done: !o };
299
+ }
300
+ };
301
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
302
+ }
303
+ function __read(o, n) {
304
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
305
+ if (!m)
306
+ return o;
307
+ var i = m.call(o), r, ar = [], e;
308
+ try {
309
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
310
+ ar.push(r.value);
311
+ }
312
+ catch (error) {
313
+ e = { error: error };
314
+ }
315
+ finally {
316
+ try {
317
+ if (r && !r.done && (m = i["return"]))
318
+ m.call(i);
319
+ }
320
+ finally {
321
+ if (e)
322
+ throw e.error;
323
+ }
324
+ }
325
+ return ar;
326
+ }
327
+ /** @deprecated */
328
+ function __spread() {
329
+ for (var ar = [], i = 0; i < arguments.length; i++)
330
+ ar = ar.concat(__read(arguments[i]));
331
+ return ar;
332
+ }
333
+ /** @deprecated */
334
+ function __spreadArrays() {
335
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++)
336
+ s += arguments[i].length;
337
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
338
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
339
+ r[k] = a[j];
340
+ return r;
341
+ }
342
+ function __spreadArray(to, from, pack) {
343
+ if (pack || arguments.length === 2)
344
+ for (var i = 0, l = from.length, ar; i < l; i++) {
345
+ if (ar || !(i in from)) {
346
+ if (!ar)
347
+ ar = Array.prototype.slice.call(from, 0, i);
348
+ ar[i] = from[i];
349
+ }
350
+ }
351
+ return to.concat(ar || Array.prototype.slice.call(from));
352
+ }
353
+ function __await(v) {
354
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
355
+ }
356
+ function __asyncGenerator(thisArg, _arguments, generator) {
357
+ if (!Symbol.asyncIterator)
358
+ throw new TypeError("Symbol.asyncIterator is not defined.");
359
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
360
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
361
+ function verb(n) { if (g[n])
362
+ i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
363
+ function resume(n, v) { try {
364
+ step(g[n](v));
365
+ }
366
+ catch (e) {
367
+ settle(q[0][3], e);
368
+ } }
369
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
370
+ function fulfill(value) { resume("next", value); }
371
+ function reject(value) { resume("throw", value); }
372
+ function settle(f, v) { if (f(v), q.shift(), q.length)
373
+ resume(q[0][0], q[0][1]); }
374
+ }
375
+ function __asyncDelegator(o) {
376
+ var i, p;
377
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
378
+ function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
379
+ }
380
+ function __asyncValues(o) {
381
+ if (!Symbol.asyncIterator)
382
+ throw new TypeError("Symbol.asyncIterator is not defined.");
383
+ var m = o[Symbol.asyncIterator], i;
384
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
385
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
386
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
387
+ }
388
+ function __makeTemplateObject(cooked, raw) {
389
+ if (Object.defineProperty) {
390
+ Object.defineProperty(cooked, "raw", { value: raw });
391
+ }
392
+ else {
393
+ cooked.raw = raw;
394
+ }
395
+ return cooked;
396
+ }
397
+ ;
398
+ var __setModuleDefault = Object.create ? (function (o, v) {
399
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
400
+ }) : function (o, v) {
401
+ o["default"] = v;
402
+ };
403
+ function __importStar(mod) {
404
+ if (mod && mod.__esModule)
405
+ return mod;
406
+ var result = {};
407
+ if (mod != null)
408
+ for (var k in mod)
409
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
410
+ __createBinding(result, mod, k);
411
+ __setModuleDefault(result, mod);
412
+ return result;
413
+ }
414
+ function __importDefault(mod) {
415
+ return (mod && mod.__esModule) ? mod : { default: mod };
416
+ }
417
+ function __classPrivateFieldGet(receiver, state, kind, f) {
418
+ if (kind === "a" && !f)
419
+ throw new TypeError("Private accessor was defined without a getter");
420
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
421
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
422
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
423
+ }
424
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
425
+ if (kind === "m")
426
+ throw new TypeError("Private method is not writable");
427
+ if (kind === "a" && !f)
428
+ throw new TypeError("Private accessor was defined without a setter");
429
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
430
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
431
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
432
432
  }
433
433
 
434
- var Edition = /** @class */ (function (_super) {
435
- __extends(Edition, _super);
436
- function Edition() {
437
- return _super !== null && _super.apply(this, arguments) || this;
438
- }
439
- Edition.prototype.identifierFields = function () {
440
- return ['id'];
441
- };
442
- return Edition;
434
+ var Edition = /** @class */ (function (_super) {
435
+ __extends(Edition, _super);
436
+ function Edition() {
437
+ return _super !== null && _super.apply(this, arguments) || this;
438
+ }
439
+ Edition.prototype.identifierFields = function () {
440
+ return ['id'];
441
+ };
442
+ return Edition;
443
443
  }(BaseModel));
444
444
 
445
- var SubscriptionPayment = /** @class */ (function (_super) {
446
- __extends(SubscriptionPayment, _super);
447
- function SubscriptionPayment() {
448
- return _super !== null && _super.apply(this, arguments) || this;
449
- }
450
- SubscriptionPayment.prototype.identifierFields = function () {
451
- return ['id'];
452
- };
453
- return SubscriptionPayment;
445
+ var Payment = /** @class */ (function (_super) {
446
+ __extends(Payment, _super);
447
+ function Payment() {
448
+ return _super !== null && _super.apply(this, arguments) || this;
449
+ }
450
+ Payment.prototype.identifierFields = function () {
451
+ return ['id'];
452
+ };
453
+ return Payment;
454
454
  }(BaseModel));
455
+ __decorate([
456
+ classTransformer.Expose({ name: 'refuse_reason' }),
457
+ __metadata("design:type", String)
458
+ ], Payment.prototype, "refuseReason", void 0);
459
+ __decorate([
460
+ classTransformer.Expose({ name: 'status_reason' }),
461
+ __metadata("design:type", String)
462
+ ], Payment.prototype, "statusReason", void 0);
463
+ __decorate([
464
+ classTransformer.Expose({ name: 'acquirer_response_code' }),
465
+ __metadata("design:type", String)
466
+ ], Payment.prototype, "acquirerResponseCode", void 0);
467
+ __decorate([
468
+ classTransformer.Expose({ name: 'acquirer_name' }),
469
+ __metadata("design:type", String)
470
+ ], Payment.prototype, "acquirerName", void 0);
471
+ __decorate([
472
+ classTransformer.Expose({ name: 'acquirer_id' }),
473
+ __metadata("design:type", String)
474
+ ], Payment.prototype, "acquirerId", void 0);
475
+ __decorate([
476
+ classTransformer.Expose({ name: 'authorization_code' }),
477
+ __metadata("design:type", String)
478
+ ], Payment.prototype, "authorizationCode", void 0);
479
+ __decorate([
480
+ classTransformer.Expose({ name: 'soft_descriptor' }),
481
+ __metadata("design:type", String)
482
+ ], Payment.prototype, "softDescriptor", void 0);
483
+ __decorate([
484
+ classTransformer.Expose({ name: 'date_created' }),
485
+ __metadata("design:type", String)
486
+ ], Payment.prototype, "dateCreated", void 0);
487
+ __decorate([
488
+ classTransformer.Expose({ name: 'date_updated' }),
489
+ __metadata("design:type", String)
490
+ ], Payment.prototype, "dateUpdated", void 0);
491
+ __decorate([
492
+ classTransformer.Expose({ name: 'authorized_amount' }),
493
+ __metadata("design:type", Number)
494
+ ], Payment.prototype, "authorizedAmount", void 0);
495
+ __decorate([
496
+ classTransformer.Expose({ name: 'paid_amount' }),
497
+ __metadata("design:type", Number)
498
+ ], Payment.prototype, "paidAmount", void 0);
499
+ __decorate([
500
+ classTransformer.Expose({ name: 'refunded_amount' }),
501
+ __metadata("design:type", Number)
502
+ ], Payment.prototype, "refundedAmount", void 0);
503
+ __decorate([
504
+ classTransformer.Expose({ name: 'card_holder_name' }),
505
+ __metadata("design:type", String)
506
+ ], Payment.prototype, "cardHolderName", void 0);
507
+ __decorate([
508
+ classTransformer.Expose({ name: 'card_last_digits' }),
509
+ __metadata("design:type", String)
510
+ ], Payment.prototype, "cardLastDigits", void 0);
511
+ __decorate([
512
+ classTransformer.Expose({ name: 'card_first_digits' }),
513
+ __metadata("design:type", String)
514
+ ], Payment.prototype, "cardFirstDigits", void 0);
515
+ __decorate([
516
+ classTransformer.Expose({ name: 'card_brand' }),
517
+ __metadata("design:type", String)
518
+ ], Payment.prototype, "cardBrand", void 0);
519
+ __decorate([
520
+ classTransformer.Expose({ name: 'card_pin_mode' }),
521
+ __metadata("design:type", String)
522
+ ], Payment.prototype, "cardPinMode", void 0);
523
+ __decorate([
524
+ classTransformer.Expose({ name: 'card_magstripe_fallback' }),
525
+ __metadata("design:type", Boolean)
526
+ ], Payment.prototype, "cardMagstripeFallback", void 0);
527
+ __decorate([
528
+ classTransformer.Expose({ name: 'cvm_pin' }),
529
+ __metadata("design:type", Boolean)
530
+ ], Payment.prototype, "cvmPin", void 0);
531
+ __decorate([
532
+ classTransformer.Expose({ name: 'postback_url' }),
533
+ __metadata("design:type", String)
534
+ ], Payment.prototype, "postbackUrl", void 0);
535
+ __decorate([
536
+ classTransformer.Expose({ name: 'payment_method' }),
537
+ __metadata("design:type", String)
538
+ ], Payment.prototype, "paymentMethod", void 0);
539
+ __decorate([
540
+ classTransformer.Expose({ name: 'capture_method' }),
541
+ __metadata("design:type", String)
542
+ ], Payment.prototype, "captureMethod", void 0);
543
+ __decorate([
544
+ classTransformer.Expose({ name: 'antifraud_score' }),
545
+ __metadata("design:type", String)
546
+ ], Payment.prototype, "antifraudScore", void 0);
547
+ __decorate([
548
+ classTransformer.Expose({ name: 'boleto_url' }),
549
+ __metadata("design:type", String)
550
+ ], Payment.prototype, "boletoUrl", void 0);
551
+ __decorate([
552
+ classTransformer.Expose({ name: 'boleto_barcode' }),
553
+ __metadata("design:type", String)
554
+ ], Payment.prototype, "boletoBarcode", void 0);
555
+ __decorate([
556
+ classTransformer.Expose({ name: 'boleto_expiration_date' }),
557
+ __metadata("design:type", String)
558
+ ], Payment.prototype, "boletoExpirationDate", void 0);
559
+ __decorate([
560
+ classTransformer.Expose({ name: 'subscription_id' }),
561
+ __metadata("design:type", String)
562
+ ], Payment.prototype, "subscriptionId", void 0);
563
+ __decorate([
564
+ classTransformer.Expose({ name: 'split_rules' }),
565
+ __metadata("design:type", String)
566
+ ], Payment.prototype, "splitRules", void 0);
567
+ __decorate([
568
+ classTransformer.Expose({ name: 'antifraud_metadata' }),
569
+ __metadata("design:type", Object)
570
+ ], Payment.prototype, "antifraudMetadata", void 0);
571
+ __decorate([
572
+ classTransformer.Expose({ name: 'reference_key' }),
573
+ __metadata("design:type", String)
574
+ ], Payment.prototype, "referenceKey", void 0);
575
+ __decorate([
576
+ classTransformer.Expose({ name: 'local_transaction_id' }),
577
+ __metadata("design:type", String)
578
+ ], Payment.prototype, "localTransactionId", void 0);
579
+ __decorate([
580
+ classTransformer.Expose({ name: 'local_time' }),
581
+ __metadata("design:type", String)
582
+ ], Payment.prototype, "localTime", void 0);
583
+ __decorate([
584
+ classTransformer.Expose({ name: 'fraud_covered' }),
585
+ __metadata("design:type", Boolean)
586
+ ], Payment.prototype, "fraudCovered", void 0);
587
+ __decorate([
588
+ classTransformer.Expose({ name: 'fraud_reimbursed' }),
589
+ __metadata("design:type", String)
590
+ ], Payment.prototype, "fraudReimbursed", void 0);
591
+ __decorate([
592
+ classTransformer.Expose({ name: 'order_id' }),
593
+ __metadata("design:type", String)
594
+ ], Payment.prototype, "orderId", void 0);
595
+ __decorate([
596
+ classTransformer.Expose({ name: 'risk_level' }),
597
+ __metadata("design:type", String)
598
+ ], Payment.prototype, "riskLevel", void 0);
599
+ __decorate([
600
+ classTransformer.Expose({ name: 'receipt_url' }),
601
+ __metadata("design:type", String)
602
+ ], Payment.prototype, "receiptUrl", void 0);
603
+ __decorate([
604
+ classTransformer.Expose({ name: 'private_label' }),
605
+ __metadata("design:type", String)
606
+ ], Payment.prototype, "privateLabel", void 0);
607
+ __decorate([
608
+ classTransformer.Expose({ name: 'pix_qr_code' }),
609
+ __metadata("design:type", String)
610
+ ], Payment.prototype, "pixQrCode", void 0);
611
+ __decorate([
612
+ classTransformer.Expose({ name: 'pix_expiration_date' }),
613
+ __metadata("design:type", String)
614
+ ], Payment.prototype, "pixExpirationDate", void 0);
455
615
 
456
- var Subscription = /** @class */ (function (_super) {
457
- __extends(Subscription, _super);
458
- function Subscription() {
459
- return _super !== null && _super.apply(this, arguments) || this;
460
- }
461
- Subscription.prototype.identifierFields = function () {
462
- return ['id'];
463
- };
464
- return Subscription;
616
+ var SubscriptionPayment = /** @class */ (function (_super) {
617
+ __extends(SubscriptionPayment, _super);
618
+ function SubscriptionPayment() {
619
+ return _super !== null && _super.apply(this, arguments) || this;
620
+ }
621
+ SubscriptionPayment.prototype.identifierFields = function () {
622
+ return ['id'];
623
+ };
624
+ return SubscriptionPayment;
625
+ }(BaseModel));
626
+ __decorate([
627
+ classTransformer.Type(function () { return Payment; }),
628
+ __metadata("design:type", Payment)
629
+ ], SubscriptionPayment.prototype, "payment", void 0);
630
+
631
+ var Address = /** @class */ (function (_super) {
632
+ __extends(Address, _super);
633
+ function Address() {
634
+ return _super !== null && _super.apply(this, arguments) || this;
635
+ }
636
+ return Address;
465
637
  }(BaseModel));
466
638
 
467
- var User = /** @class */ (function (_super) {
468
- __extends(User, _super);
469
- function User() {
470
- return _super !== null && _super.apply(this, arguments) || this;
471
- }
472
- User.toInstance = function (data) {
473
- var instance = _super.toInstance.call(this, data);
474
- instance.displayName = data.firstName + " " + data.lastName;
475
- return instance;
476
- };
477
- User.prototype.identifierFields = function () {
478
- return ['id'];
479
- };
480
- User.prototype.toPlain = function () {
481
- var plain = _super.prototype.toPlain.call(this);
482
- delete plain.beautyProfile;
483
- return plain;
484
- };
485
- return User;
639
+ var Coupon = /** @class */ (function (_super) {
640
+ __extends(Coupon, _super);
641
+ function Coupon() {
642
+ return _super !== null && _super.apply(this, arguments) || this;
643
+ }
644
+ Coupon.prototype.identifierFields = function () {
645
+ return ['id'];
646
+ };
647
+ return Coupon;
486
648
  }(BaseModel));
649
+ __decorate([
650
+ classTransformer.Expose({ name: 'checkout_type' }),
651
+ __metadata("design:type", Number)
652
+ ], Coupon.prototype, "checkoutType", void 0);
653
+ __decorate([
654
+ classTransformer.Expose({ name: 'exclusivity_type' }),
655
+ __metadata("design:type", Number)
656
+ ], Coupon.prototype, "exclusivityType", void 0);
487
657
 
488
- var BeautyProfile = /** @class */ (function (_super) {
489
- __extends(BeautyProfile, _super);
490
- function BeautyProfile() {
491
- return _super !== null && _super.apply(this, arguments) || this;
492
- }
493
- BeautyProfile.prototype.toPlain = function () {
494
- var plain = _super.prototype.toPlain.call(this);
495
- delete plain.id;
496
- return plain;
497
- };
498
- BeautyProfile.prototype.identifierFields = function () {
499
- return ['id'];
500
- };
501
- return BeautyProfile;
658
+ var SubscriptionPlan = /** @class */ (function (_super) {
659
+ __extends(SubscriptionPlan, _super);
660
+ function SubscriptionPlan() {
661
+ return _super !== null && _super.apply(this, arguments) || this;
662
+ }
663
+ SubscriptionPlan.prototype.identifierFields = function () {
664
+ return ['id'];
665
+ };
666
+ return SubscriptionPlan;
502
667
  }(BaseModel));
503
668
 
504
- var Address = /** @class */ (function (_super) {
505
- __extends(Address, _super);
506
- function Address() {
507
- return _super !== null && _super.apply(this, arguments) || this;
508
- }
509
- return Address;
669
+ var BeautyProfile = /** @class */ (function (_super) {
670
+ __extends(BeautyProfile, _super);
671
+ function BeautyProfile() {
672
+ return _super !== null && _super.apply(this, arguments) || this;
673
+ }
674
+ BeautyProfile.prototype.toPlain = function () {
675
+ var plain = _super.prototype.toPlain.call(this);
676
+ delete plain.id;
677
+ return plain;
678
+ };
679
+ BeautyProfile.prototype.identifierFields = function () {
680
+ return ['id'];
681
+ };
682
+ return BeautyProfile;
510
683
  }(BaseModel));
511
684
 
512
- var UserAddress = /** @class */ (function (_super) {
513
- __extends(UserAddress, _super);
514
- function UserAddress() {
515
- return _super !== null && _super.apply(this, arguments) || this;
516
- }
517
- UserAddress.prototype.identifierFields = function () {
518
- return ['id'];
519
- };
520
- return UserAddress;
685
+ var User = /** @class */ (function (_super) {
686
+ __extends(User, _super);
687
+ function User() {
688
+ return _super !== null && _super.apply(this, arguments) || this;
689
+ }
690
+ User.toInstance = function (data) {
691
+ var instance = _super.toInstance.call(this, data);
692
+ instance.displayName = data.firstName + " " + data.lastName;
693
+ return instance;
694
+ };
695
+ User.prototype.identifierFields = function () {
696
+ return ['id'];
697
+ };
698
+ User.prototype.toPlain = function () {
699
+ var plain = _super.prototype.toPlain.call(this);
700
+ delete plain.beautyProfile;
701
+ return plain;
702
+ };
703
+ return User;
704
+ }(BaseModel));
705
+ __decorate([
706
+ classTransformer.Type(function () { return BeautyProfile; }),
707
+ __metadata("design:type", BeautyProfile)
708
+ ], User.prototype, "beautyProfile", void 0);
709
+
710
+ var Subscription = /** @class */ (function (_super) {
711
+ __extends(Subscription, _super);
712
+ function Subscription() {
713
+ return _super !== null && _super.apply(this, arguments) || this;
714
+ }
715
+ Subscription.prototype.identifierFields = function () {
716
+ return ['id'];
717
+ };
718
+ return Subscription;
719
+ }(BaseModel));
720
+ __decorate([
721
+ classTransformer.Type(function () { return User; }),
722
+ __metadata("design:type", User)
723
+ ], Subscription.prototype, "user", void 0);
724
+ __decorate([
725
+ classTransformer.Type(function () { return SubscriptionPlan; }),
726
+ __metadata("design:type", SubscriptionPlan)
727
+ ], Subscription.prototype, "subscriptionPlan", void 0);
728
+ __decorate([
729
+ classTransformer.Type(function () { return Address; }),
730
+ __metadata("design:type", Address)
731
+ ], Subscription.prototype, "shippingAddress", void 0);
732
+ __decorate([
733
+ classTransformer.Type(function () { return Address; }),
734
+ __metadata("design:type", Address)
735
+ ], Subscription.prototype, "billingAddress", void 0);
736
+ __decorate([
737
+ classTransformer.Type(function () { return Coupon; }),
738
+ __metadata("design:type", Coupon)
739
+ ], Subscription.prototype, "coupon", void 0);
740
+ __decorate([
741
+ classTransformer.Type(function () { return Edition; }),
742
+ __metadata("design:type", Array)
743
+ ], Subscription.prototype, "editions", void 0);
744
+ __decorate([
745
+ classTransformer.Type(function () { return SubscriptionPayment; }),
746
+ __metadata("design:type", Array)
747
+ ], Subscription.prototype, "payment", void 0);
748
+
749
+ var UserAddress = /** @class */ (function (_super) {
750
+ __extends(UserAddress, _super);
751
+ function UserAddress() {
752
+ return _super !== null && _super.apply(this, arguments) || this;
753
+ }
754
+ UserAddress.prototype.identifierFields = function () {
755
+ return ['id'];
756
+ };
757
+ return UserAddress;
521
758
  }(Address));
522
759
 
523
- var Base = /** @class */ (function () {
524
- function Base() {
525
- var args = [];
526
- for (var _i = 0; _i < arguments.length; _i++) {
527
- args[_i] = arguments[_i];
528
- }
529
- Object.assign.apply(Object, __spreadArray([this], __read(args)));
530
- }
531
- return Base;
760
+ var Base = /** @class */ (function () {
761
+ function Base() {
762
+ var args = [];
763
+ for (var _i = 0; _i < arguments.length; _i++) {
764
+ args[_i] = arguments[_i];
765
+ }
766
+ Object.assign.apply(Object, __spreadArray([this], __read(args)));
767
+ }
768
+ return Base;
532
769
  }());
533
770
 
534
- var UnauthorizedError = /** @class */ (function (_super) {
535
- __extends(UnauthorizedError, _super);
536
- function UnauthorizedError(message) {
537
- var _this = _super.call(this, message) || this;
538
- _this.message = message;
539
- return _this;
540
- }
541
- return UnauthorizedError;
771
+ var UnauthorizedError = /** @class */ (function (_super) {
772
+ __extends(UnauthorizedError, _super);
773
+ function UnauthorizedError(message) {
774
+ var _this = _super.call(this, message) || this;
775
+ _this.message = message;
776
+ return _this;
777
+ }
778
+ return UnauthorizedError;
542
779
  }(Error));
543
780
 
544
- exports.SignInMethods = void 0;
545
- (function (SignInMethods) {
546
- SignInMethods["EMAIL_PASSWORD"] = "email_password";
547
- SignInMethods["GOOGLE"] = "google";
548
- })(exports.SignInMethods || (exports.SignInMethods = {}));
549
- var Authentication = /** @class */ (function () {
550
- function Authentication(authService, userRepository) {
551
- this.authService = authService;
552
- this.userRepository = userRepository;
553
- }
554
- Authentication.prototype.signIn = function (_b, signInMethod) {
555
- var email = _b.email, password = _b.password;
556
- return __awaiter(this, void 0, void 0, function () {
557
- var method, userAuth, user;
558
- return __generator(this, function (_b) {
559
- switch (_b.label) {
560
- case 0:
561
- method = this.getServiceByMethod(signInMethod);
562
- return [4 /*yield*/, this.authService[method]({ email: email, password: password })];
563
- case 1:
564
- userAuth = _b.sent();
565
- user = this.userRepository.get(userAuth);
566
- if (!lodash.isNil(user))
567
- return [2 /*return*/, user];
568
- if (/^.+@b4a.com.br$/.test(userAuth.email))
569
- return [2 /*return*/, this.createsUserByCredential(userAuth)];
570
- throw new UnauthorizedError('Invalid credentials');
571
- }
572
- });
573
- });
574
- };
575
- Authentication.prototype.getServiceByMethod = function (signInMethod) {
576
- return signInMethod === exports.SignInMethods.EMAIL_PASSWORD ? 'signInWithEmailAndPassword' : 'signInWithGoogle';
577
- };
578
- Authentication.prototype.createsUserByCredential = function (user) {
579
- var _a;
580
- return __awaiter(this, void 0, void 0, function () {
581
- var _b, firstName, lastName, person;
582
- return __generator(this, function (_c) {
583
- _b = __read((_a = user.displayName) === null || _a === void 0 ? void 0 : _a.split(/\s/), 2), firstName = _b[0], lastName = _b[1];
584
- person = User.toInstance(Object.assign(Object.assign({}, user), { cpf: '', birthday: new Date(), firstName: firstName,
585
- lastName: lastName, acceptsNewsletter: false, area: exports.Area.Transactional, officePosition: exports.OfficePosition.Intern, type: exports.UserType.Collaborator }));
586
- return [2 /*return*/, this.userRepository.create(person)];
587
- });
588
- });
589
- };
590
- return Authentication;
781
+ exports.SignInMethods = void 0;
782
+ (function (SignInMethods) {
783
+ SignInMethods["EMAIL_PASSWORD"] = "email_password";
784
+ SignInMethods["GOOGLE"] = "google";
785
+ })(exports.SignInMethods || (exports.SignInMethods = {}));
786
+ var Authentication = /** @class */ (function () {
787
+ function Authentication(authService, userRepository) {
788
+ this.authService = authService;
789
+ this.userRepository = userRepository;
790
+ }
791
+ Authentication.prototype.signIn = function (_b, signInMethod) {
792
+ var email = _b.email, password = _b.password;
793
+ return __awaiter(this, void 0, void 0, function () {
794
+ var method, userAuth, user;
795
+ return __generator(this, function (_b) {
796
+ switch (_b.label) {
797
+ case 0:
798
+ method = this.getServiceByMethod(signInMethod);
799
+ return [4 /*yield*/, this.authService[method]({ email: email, password: password })];
800
+ case 1:
801
+ userAuth = _b.sent();
802
+ user = this.userRepository.get(userAuth);
803
+ if (!lodash.isNil(user))
804
+ return [2 /*return*/, user];
805
+ if (/^.+@b4a.com.br$/.test(userAuth.email))
806
+ return [2 /*return*/, this.createsUserByCredential(userAuth)];
807
+ throw new UnauthorizedError('Invalid credentials');
808
+ }
809
+ });
810
+ });
811
+ };
812
+ Authentication.prototype.getServiceByMethod = function (signInMethod) {
813
+ return signInMethod === exports.SignInMethods.EMAIL_PASSWORD ? 'signInWithEmailAndPassword' : 'signInWithGoogle';
814
+ };
815
+ Authentication.prototype.createsUserByCredential = function (user) {
816
+ var _a;
817
+ return __awaiter(this, void 0, void 0, function () {
818
+ var _b, firstName, lastName, person;
819
+ return __generator(this, function (_c) {
820
+ _b = __read((_a = user.displayName) === null || _a === void 0 ? void 0 : _a.split(/\s/), 2), firstName = _b[0], lastName = _b[1];
821
+ person = User.toInstance(Object.assign(Object.assign({}, user), { cpf: '', birthday: new Date(), firstName: firstName,
822
+ lastName: lastName, acceptsNewsletter: false, area: exports.Area.Transactional, officePosition: exports.OfficePosition.Intern, type: exports.UserType.Collaborator }));
823
+ return [2 /*return*/, this.userRepository.create(person)];
824
+ });
825
+ });
826
+ };
827
+ return Authentication;
591
828
  }());
592
829
 
593
- var SignOut = /** @class */ (function () {
594
- function SignOut(authService) {
595
- this.authService = authService;
596
- }
597
- SignOut.prototype.signOut = function () {
598
- return __awaiter(this, void 0, void 0, function () {
599
- return __generator(this, function (_a) {
600
- switch (_a.label) {
601
- case 0: return [4 /*yield*/, this.authService.signOut()];
602
- case 1:
603
- _a.sent();
604
- return [2 /*return*/];
605
- }
606
- });
607
- });
608
- };
609
- return SignOut;
830
+ var SignOut = /** @class */ (function () {
831
+ function SignOut(authService) {
832
+ this.authService = authService;
833
+ }
834
+ SignOut.prototype.signOut = function () {
835
+ return __awaiter(this, void 0, void 0, function () {
836
+ return __generator(this, function (_a) {
837
+ switch (_a.label) {
838
+ case 0: return [4 /*yield*/, this.authService.signOut()];
839
+ case 1:
840
+ _a.sent();
841
+ return [2 /*return*/];
842
+ }
843
+ });
844
+ });
845
+ };
846
+ return SignOut;
610
847
  }());
611
848
 
612
- exports.Shops = void 0;
613
- (function (Shops) {
614
- Shops["MENSMARKET"] = "Men's Market";
615
- Shops["GLAMSHOP"] = "Glamshop";
849
+ exports.Shops = void 0;
850
+ (function (Shops) {
851
+ Shops["MENSMARKET"] = "Men's Market";
852
+ Shops["GLAMSHOP"] = "Glamshop";
616
853
  })(exports.Shops || (exports.Shops = {}));
617
854
 
618
- var Category = /** @class */ (function (_super) {
619
- __extends(Category, _super);
620
- function Category() {
621
- return _super !== null && _super.apply(this, arguments) || this;
622
- }
623
- Category.prototype.identifierFields = function () {
624
- return ['id'];
625
- };
626
- return Category;
855
+ var Category = /** @class */ (function (_super) {
856
+ __extends(Category, _super);
857
+ function Category() {
858
+ return _super !== null && _super.apply(this, arguments) || this;
859
+ }
860
+ Category.prototype.identifierFields = function () {
861
+ return ['id'];
862
+ };
863
+ return Category;
627
864
  }(BaseModel));
628
865
 
629
- var Product = /** @class */ (function (_super) {
630
- __extends(Product, _super);
631
- function Product() {
632
- return _super !== null && _super.apply(this, arguments) || this;
633
- }
634
- Product.prototype.identifierFields = function () {
635
- return ['id'];
636
- };
637
- return Product;
866
+ var Product = /** @class */ (function (_super) {
867
+ __extends(Product, _super);
868
+ function Product() {
869
+ return _super !== null && _super.apply(this, arguments) || this;
870
+ }
871
+ Product.prototype.identifierFields = function () {
872
+ return ['id'];
873
+ };
874
+ Product.prototype.getInfoByShop = function (shop) {
875
+ var _a, _b, _c, _d, _e, _f;
876
+ return Object.assign(Object.assign(Object.assign({}, (((_b = (_a = this.description) === null || _a === void 0 ? void 0 : _a[shop]) === null || _b === void 0 ? void 0 : _b.description) ? { description: (_d = (_c = this.description) === null || _c === void 0 ? void 0 : _c[shop]) === null || _d === void 0 ? void 0 : _d.description } : {})), (((_e = this.price) === null || _e === void 0 ? void 0 : _e[shop]) || {})), (((_f = this.stock) === null || _f === void 0 ? void 0 : _f[shop]) || {}));
877
+ };
878
+ return Product;
638
879
  }(BaseModel));
639
880
 
640
- var Variant = /** @class */ (function (_super) {
641
- __extends(Variant, _super);
642
- function Variant() {
643
- return _super !== null && _super.apply(this, arguments) || this;
644
- }
645
- Variant.prototype.identifierFields = function () {
646
- return ['id'];
647
- };
648
- return Variant;
881
+ var Variant = /** @class */ (function (_super) {
882
+ __extends(Variant, _super);
883
+ function Variant() {
884
+ return _super !== null && _super.apply(this, arguments) || this;
885
+ }
886
+ Variant.prototype.identifierFields = function () {
887
+ return ['id'];
888
+ };
889
+ return Variant;
649
890
  }(BaseModel));
650
891
 
651
- exports.CouponTypes = void 0;
652
- (function (CouponTypes) {
653
- CouponTypes[CouponTypes["FINANCIAL"] = 1] = "FINANCIAL";
654
- CouponTypes[CouponTypes["PRODUCT"] = 2] = "PRODUCT";
655
- CouponTypes[CouponTypes["GIFTCARD"] = 3] = "GIFTCARD";
656
- CouponTypes[CouponTypes["VOUCHER"] = 4] = "VOUCHER";
892
+ exports.CouponTypes = void 0;
893
+ (function (CouponTypes) {
894
+ CouponTypes[CouponTypes["FINANCIAL"] = 1] = "FINANCIAL";
895
+ CouponTypes[CouponTypes["PRODUCT"] = 2] = "PRODUCT";
896
+ CouponTypes[CouponTypes["GIFTCARD"] = 3] = "GIFTCARD";
897
+ CouponTypes[CouponTypes["VOUCHER"] = 4] = "VOUCHER";
657
898
  })(exports.CouponTypes || (exports.CouponTypes = {}));
658
899
 
659
- exports.CouponSubtypes = void 0;
660
- (function (CouponSubtypes) {
661
- CouponSubtypes[CouponSubtypes["ABSOLUTE"] = 1] = "ABSOLUTE";
662
- CouponSubtypes[CouponSubtypes["PERCENTAGE"] = 2] = "PERCENTAGE";
900
+ exports.CouponSubtypes = void 0;
901
+ (function (CouponSubtypes) {
902
+ CouponSubtypes[CouponSubtypes["ABSOLUTE"] = 1] = "ABSOLUTE";
903
+ CouponSubtypes[CouponSubtypes["PERCENTAGE"] = 2] = "PERCENTAGE";
663
904
  })(exports.CouponSubtypes || (exports.CouponSubtypes = {}));
664
905
 
665
- exports.Exclusivities = void 0;
666
- (function (Exclusivities) {
667
- Exclusivities[Exclusivities["ALL_USERS"] = 1] = "ALL_USERS";
668
- Exclusivities[Exclusivities["SPECIFIC_USER"] = 2] = "SPECIFIC_USER";
669
- Exclusivities[Exclusivities["COLLABORATORS"] = 3] = "COLLABORATORS";
906
+ exports.Exclusivities = void 0;
907
+ (function (Exclusivities) {
908
+ Exclusivities[Exclusivities["ALL_USERS"] = 1] = "ALL_USERS";
909
+ Exclusivities[Exclusivities["SPECIFIC_USER"] = 2] = "SPECIFIC_USER";
910
+ Exclusivities[Exclusivities["COLLABORATORS"] = 3] = "COLLABORATORS";
670
911
  })(exports.Exclusivities || (exports.Exclusivities = {}));
671
912
 
672
- var Coupon = /** @class */ (function (_super) {
673
- __extends(Coupon, _super);
674
- function Coupon() {
675
- return _super !== null && _super.apply(this, arguments) || this;
676
- }
677
- Coupon.prototype.identifierFields = function () {
678
- return ['id'];
679
- };
680
- return Coupon;
681
- }(BaseModel));
682
- __decorate([
683
- classTransformer.Expose({ name: 'checkout_type' })
684
- ], Coupon.prototype, "checkoutType", void 0);
685
- __decorate([
686
- classTransformer.Expose({ name: 'exclusivity_type' })
687
- ], Coupon.prototype, "exclusivityType", void 0);
688
-
689
- exports.CheckoutTypes = void 0;
690
- (function (CheckoutTypes) {
691
- CheckoutTypes[CheckoutTypes["ECOMMERCE"] = 1] = "ECOMMERCE";
692
- CheckoutTypes[CheckoutTypes["SUBSCRIPTION"] = 2] = "SUBSCRIPTION";
913
+ exports.CheckoutTypes = void 0;
914
+ (function (CheckoutTypes) {
915
+ CheckoutTypes[CheckoutTypes["ECOMMERCE"] = 1] = "ECOMMERCE";
916
+ CheckoutTypes[CheckoutTypes["SUBSCRIPTION"] = 2] = "SUBSCRIPTION";
693
917
  })(exports.CheckoutTypes || (exports.CheckoutTypes = {}));
694
918
 
695
- var COUPON_EXPIRATION = 60 * 60 * 24 * 30;
696
- var FinancialCoupon = /** @class */ (function (_super) {
697
- __extends(FinancialCoupon, _super);
698
- function FinancialCoupon() {
699
- var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
700
- _this.type = exports.CouponTypes.FINANCIAL;
701
- return _this;
702
- }
703
- FinancialCoupon.isFinancialCoupon = function (coupon) {
704
- return coupon.type === exports.CouponTypes.FINANCIAL && !!coupon.subtype;
705
- };
706
- FinancialCoupon.createCoupon = function (userId) {
707
- return this.toInstance({
708
- name: tsMd5.Md5.hashStr(userId + "_" + Date.now).toString(),
709
- nickname: "" + Date.now(),
710
- type: exports.CouponTypes.FINANCIAL,
711
- subtype: exports.CouponSubtypes.PERCENTAGE,
712
- checkoutType: exports.CheckoutTypes.ECOMMERCE,
713
- discount: 30,
714
- user: userId,
715
- createdAt: new Date(Date.now()),
716
- expiresIn: new Date(Date.now() + COUPON_EXPIRATION),
717
- });
718
- };
719
- return FinancialCoupon;
919
+ var COUPON_EXPIRATION = 60 * 60 * 24 * 30;
920
+ var FinancialCoupon = /** @class */ (function (_super) {
921
+ __extends(FinancialCoupon, _super);
922
+ function FinancialCoupon() {
923
+ var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
924
+ _this.type = exports.CouponTypes.FINANCIAL;
925
+ return _this;
926
+ }
927
+ FinancialCoupon.isFinancialCoupon = function (coupon) {
928
+ return coupon.type === exports.CouponTypes.FINANCIAL && !!coupon.subtype;
929
+ };
930
+ FinancialCoupon.createCoupon = function (userId) {
931
+ return this.toInstance({
932
+ name: tsMd5.Md5.hashStr(userId + "_" + Date.now).toString(),
933
+ nickname: "" + Date.now(),
934
+ type: exports.CouponTypes.FINANCIAL,
935
+ subtype: exports.CouponSubtypes.PERCENTAGE,
936
+ checkoutType: exports.CheckoutTypes.ECOMMERCE,
937
+ discount: 30,
938
+ user: userId,
939
+ createdAt: new Date(Date.now()),
940
+ expiresIn: new Date(Date.now() + COUPON_EXPIRATION),
941
+ });
942
+ };
943
+ return FinancialCoupon;
720
944
  }(Coupon));
721
945
 
722
- exports.OrderStatus = void 0;
723
- (function (OrderStatus) {
724
- OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
725
- OrderStatus["EM_PREPARO"] = "Preparando pedido";
726
- OrderStatus["NF_EMITIDA"] = "Nota Fiscal Emitida";
727
- OrderStatus["AGUARDANDO_ENVIO"] = "Aguardando Transaportadora";
728
- OrderStatus["ENVIADO"] = "Pedido Enviado";
729
- OrderStatus["ENTREGUE"] = "Pedido entregue";
730
- OrderStatus["CANCELADO"] = "Cancelado";
731
- OrderStatus["CREDIT_CARD"] = "credit_card";
946
+ exports.OrderStatus = void 0;
947
+ (function (OrderStatus) {
948
+ OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
949
+ OrderStatus["EM_PREPARO"] = "Preparando pedido";
950
+ OrderStatus["NF_EMITIDA"] = "Nota Fiscal Emitida";
951
+ OrderStatus["AGUARDANDO_ENVIO"] = "Aguardando Transaportadora";
952
+ OrderStatus["ENVIADO"] = "Pedido Enviado";
953
+ OrderStatus["ENTREGUE"] = "Pedido entregue";
954
+ OrderStatus["CANCELADO"] = "Cancelado";
955
+ OrderStatus["CREDIT_CARD"] = "credit_card";
732
956
  })(exports.OrderStatus || (exports.OrderStatus = {}));
733
957
 
734
- var Checkout = /** @class */ (function (_super) {
735
- __extends(Checkout, _super);
736
- function Checkout() {
737
- return _super !== null && _super.apply(this, arguments) || this;
738
- }
739
- Checkout.prototype.identifierFields = function () {
740
- return ['id'];
741
- };
742
- return Checkout;
743
- }(BaseModel));
744
-
745
- var LineItem = /** @class */ (function (_super) {
746
- __extends(LineItem, _super);
747
- function LineItem() {
748
- return _super !== null && _super.apply(this, arguments) || this;
749
- }
750
- return LineItem;
958
+ var LineItem = /** @class */ (function (_super) {
959
+ __extends(LineItem, _super);
960
+ function LineItem() {
961
+ return _super !== null && _super.apply(this, arguments) || this;
962
+ }
963
+ return LineItem;
751
964
  }(Product));
752
965
 
753
- var Order = /** @class */ (function (_super) {
754
- __extends(Order, _super);
755
- function Order() {
756
- return _super !== null && _super.apply(this, arguments) || this;
757
- }
758
- return Order;
759
- }(Checkout));
760
-
761
- var Payment = /** @class */ (function (_super) {
762
- __extends(Payment, _super);
763
- function Payment() {
764
- return _super !== null && _super.apply(this, arguments) || this;
765
- }
766
- Payment.prototype.identifierFields = function () {
767
- return ['id'];
768
- };
769
- return Payment;
770
- }(BaseModel));
771
- __decorate([
772
- classTransformer.Expose({ name: 'refuse_reason' })
773
- ], Payment.prototype, "refuseReason", void 0);
774
- __decorate([
775
- classTransformer.Expose({ name: 'status_reason' })
776
- ], Payment.prototype, "statusReason", void 0);
777
- __decorate([
778
- classTransformer.Expose({ name: 'acquirer_response_code' })
779
- ], Payment.prototype, "acquirerResponseCode", void 0);
780
- __decorate([
781
- classTransformer.Expose({ name: 'acquirer_name' })
782
- ], Payment.prototype, "acquirerName", void 0);
783
- __decorate([
784
- classTransformer.Expose({ name: 'acquirer_id' })
785
- ], Payment.prototype, "acquirerId", void 0);
786
- __decorate([
787
- classTransformer.Expose({ name: 'authorization_code' })
788
- ], Payment.prototype, "authorizationCode", void 0);
789
- __decorate([
790
- classTransformer.Expose({ name: 'soft_descriptor' })
791
- ], Payment.prototype, "softDescriptor", void 0);
792
- __decorate([
793
- classTransformer.Expose({ name: 'date_created' })
794
- ], Payment.prototype, "dateCreated", void 0);
795
- __decorate([
796
- classTransformer.Expose({ name: 'date_updated' })
797
- ], Payment.prototype, "dateUpdated", void 0);
798
- __decorate([
799
- classTransformer.Expose({ name: 'authorized_amount' })
800
- ], Payment.prototype, "authorizedAmount", void 0);
801
- __decorate([
802
- classTransformer.Expose({ name: 'paid_amount' })
803
- ], Payment.prototype, "paidAmount", void 0);
804
- __decorate([
805
- classTransformer.Expose({ name: 'refunded_amount' })
806
- ], Payment.prototype, "refundedAmount", void 0);
807
- __decorate([
808
- classTransformer.Expose({ name: 'card_holder_name' })
809
- ], Payment.prototype, "cardHolderName", void 0);
810
- __decorate([
811
- classTransformer.Expose({ name: 'card_last_digits' })
812
- ], Payment.prototype, "cardLastDigits", void 0);
813
- __decorate([
814
- classTransformer.Expose({ name: 'card_first_digits' })
815
- ], Payment.prototype, "cardFirstDigits", void 0);
816
- __decorate([
817
- classTransformer.Expose({ name: 'card_brand' })
818
- ], Payment.prototype, "cardBrand", void 0);
819
- __decorate([
820
- classTransformer.Expose({ name: 'card_pin_mode' })
821
- ], Payment.prototype, "cardPinMode", void 0);
822
- __decorate([
823
- classTransformer.Expose({ name: 'card_magstripe_fallback' })
824
- ], Payment.prototype, "cardMagstripeFallback", void 0);
825
- __decorate([
826
- classTransformer.Expose({ name: 'cvm_pin' })
827
- ], Payment.prototype, "cvmPin", void 0);
828
- __decorate([
829
- classTransformer.Expose({ name: 'postback_url' })
830
- ], Payment.prototype, "postbackUrl", void 0);
831
- __decorate([
832
- classTransformer.Expose({ name: 'payment_method' })
833
- ], Payment.prototype, "paymentMethod", void 0);
834
- __decorate([
835
- classTransformer.Expose({ name: 'capture_method' })
836
- ], Payment.prototype, "captureMethod", void 0);
837
- __decorate([
838
- classTransformer.Expose({ name: 'antifraud_score' })
839
- ], Payment.prototype, "antifraudScore", void 0);
840
- __decorate([
841
- classTransformer.Expose({ name: 'boleto_url' })
842
- ], Payment.prototype, "boletoUrl", void 0);
843
- __decorate([
844
- classTransformer.Expose({ name: 'boleto_barcode' })
845
- ], Payment.prototype, "boletoBarcode", void 0);
846
- __decorate([
847
- classTransformer.Expose({ name: 'boleto_expiration_date' })
848
- ], Payment.prototype, "boletoExpirationDate", void 0);
849
- __decorate([
850
- classTransformer.Expose({ name: 'subscription_id' })
851
- ], Payment.prototype, "subscriptionId", void 0);
852
- __decorate([
853
- classTransformer.Expose({ name: 'split_rules' })
854
- ], Payment.prototype, "splitRules", void 0);
855
- __decorate([
856
- classTransformer.Expose({ name: 'antifraud_metadata' })
857
- ], Payment.prototype, "antifraudMetadata", void 0);
858
- __decorate([
859
- classTransformer.Expose({ name: 'reference_key' })
860
- ], Payment.prototype, "referenceKey", void 0);
861
- __decorate([
862
- classTransformer.Expose({ name: 'local_transaction_id' })
863
- ], Payment.prototype, "localTransactionId", void 0);
864
- __decorate([
865
- classTransformer.Expose({ name: 'local_time' })
866
- ], Payment.prototype, "localTime", void 0);
867
- __decorate([
868
- classTransformer.Expose({ name: 'fraud_covered' })
869
- ], Payment.prototype, "fraudCovered", void 0);
870
- __decorate([
871
- classTransformer.Expose({ name: 'fraud_reimbursed' })
872
- ], Payment.prototype, "fraudReimbursed", void 0);
873
- __decorate([
874
- classTransformer.Expose({ name: 'order_id' })
875
- ], Payment.prototype, "orderId", void 0);
876
- __decorate([
877
- classTransformer.Expose({ name: 'risk_level' })
878
- ], Payment.prototype, "riskLevel", void 0);
879
- __decorate([
880
- classTransformer.Expose({ name: 'receipt_url' })
881
- ], Payment.prototype, "receiptUrl", void 0);
882
- __decorate([
883
- classTransformer.Expose({ name: 'private_label' })
884
- ], Payment.prototype, "privateLabel", void 0);
885
- __decorate([
886
- classTransformer.Expose({ name: 'pix_qr_code' })
887
- ], Payment.prototype, "pixQrCode", void 0);
888
- __decorate([
889
- classTransformer.Expose({ name: 'pix_expiration_date' })
890
- ], Payment.prototype, "pixExpirationDate", void 0);
891
-
892
- var ShippingMethod = /** @class */ (function (_super) {
893
- __extends(ShippingMethod, _super);
894
- function ShippingMethod() {
895
- return _super !== null && _super.apply(this, arguments) || this;
896
- }
897
- ShippingMethod.prototype.identifierFields = function () {
898
- return ['id'];
899
- };
900
- return ShippingMethod;
966
+ var ShippingMethod = /** @class */ (function (_super) {
967
+ __extends(ShippingMethod, _super);
968
+ function ShippingMethod() {
969
+ return _super !== null && _super.apply(this, arguments) || this;
970
+ }
971
+ ShippingMethod.prototype.identifierFields = function () {
972
+ return ['id'];
973
+ };
974
+ return ShippingMethod;
901
975
  }(BaseModel));
902
976
 
903
- var CheckoutSubscription = /** @class */ (function (_super) {
904
- __extends(CheckoutSubscription, _super);
905
- function CheckoutSubscription() {
906
- return _super !== null && _super.apply(this, arguments) || this;
907
- }
908
- CheckoutSubscription.prototype.identifierFields = function () {
909
- return ['id'];
910
- };
911
- return CheckoutSubscription;
977
+ var Checkout = /** @class */ (function (_super) {
978
+ __extends(Checkout, _super);
979
+ function Checkout() {
980
+ return _super !== null && _super.apply(this, arguments) || this;
981
+ }
982
+ Checkout.prototype.identifierFields = function () {
983
+ return ['id'];
984
+ };
985
+ return Checkout;
912
986
  }(BaseModel));
913
-
914
- var SubscriptionPlan = /** @class */ (function (_super) {
915
- __extends(SubscriptionPlan, _super);
916
- function SubscriptionPlan() {
917
- return _super !== null && _super.apply(this, arguments) || this;
918
- }
919
- SubscriptionPlan.prototype.identifierFields = function () {
920
- return ['id'];
921
- };
922
- return SubscriptionPlan;
987
+ __decorate([
988
+ classTransformer.Type(function () { return LineItem; }),
989
+ __metadata("design:type", Array)
990
+ ], Checkout.prototype, "lineItems", void 0);
991
+ __decorate([
992
+ classTransformer.Type(function () { return User; }),
993
+ __metadata("design:type", User)
994
+ ], Checkout.prototype, "user", void 0);
995
+ __decorate([
996
+ classTransformer.Type(function () { return Address; }),
997
+ __metadata("design:type", Address)
998
+ ], Checkout.prototype, "shippingAddress", void 0);
999
+ __decorate([
1000
+ classTransformer.Type(function () { return Address; }),
1001
+ __metadata("design:type", Address)
1002
+ ], Checkout.prototype, "billingAddress", void 0);
1003
+ __decorate([
1004
+ classTransformer.Type(function () { return ShippingMethod; }),
1005
+ __metadata("design:type", ShippingMethod)
1006
+ ], Checkout.prototype, "shipping", void 0);
1007
+ __decorate([
1008
+ classTransformer.Type(function () { return Coupon; }),
1009
+ __metadata("design:type", Coupon)
1010
+ ], Checkout.prototype, "coupon", void 0);
1011
+
1012
+ var Order = /** @class */ (function (_super) {
1013
+ __extends(Order, _super);
1014
+ function Order() {
1015
+ return _super !== null && _super.apply(this, arguments) || this;
1016
+ }
1017
+ return Order;
1018
+ }(Checkout));
1019
+ __decorate([
1020
+ classTransformer.Type(function () { return Payment; }),
1021
+ __metadata("design:type", Payment)
1022
+ ], Order.prototype, "payment", void 0);
1023
+
1024
+ var CheckoutSubscription = /** @class */ (function (_super) {
1025
+ __extends(CheckoutSubscription, _super);
1026
+ function CheckoutSubscription() {
1027
+ return _super !== null && _super.apply(this, arguments) || this;
1028
+ }
1029
+ CheckoutSubscription.prototype.identifierFields = function () {
1030
+ return ['id'];
1031
+ };
1032
+ return CheckoutSubscription;
923
1033
  }(BaseModel));
924
-
925
- var Buy2Win = /** @class */ (function (_super) {
926
- __extends(Buy2Win, _super);
927
- function Buy2Win() {
928
- return _super !== null && _super.apply(this, arguments) || this;
929
- }
930
- Buy2Win.prototype.identifierFields = function () {
931
- return ['id'];
932
- };
933
- return Buy2Win;
1034
+ __decorate([
1035
+ classTransformer.Type(function () { return Address; }),
1036
+ __metadata("design:type", Address)
1037
+ ], CheckoutSubscription.prototype, "shippingAddress", void 0);
1038
+ __decorate([
1039
+ classTransformer.Type(function () { return Address; }),
1040
+ __metadata("design:type", Address)
1041
+ ], CheckoutSubscription.prototype, "billingAddress", void 0);
1042
+ __decorate([
1043
+ classTransformer.Type(function () { return SubscriptionPlan; }),
1044
+ __metadata("design:type", SubscriptionPlan)
1045
+ ], CheckoutSubscription.prototype, "subscriptionPlan", void 0);
1046
+ __decorate([
1047
+ classTransformer.Type(function () { return Coupon; }),
1048
+ __metadata("design:type", Coupon)
1049
+ ], CheckoutSubscription.prototype, "coupon", void 0);
1050
+
1051
+ var Buy2Win = /** @class */ (function (_super) {
1052
+ __extends(Buy2Win, _super);
1053
+ function Buy2Win() {
1054
+ return _super !== null && _super.apply(this, arguments) || this;
1055
+ }
1056
+ Buy2Win.prototype.identifierFields = function () {
1057
+ return ['id'];
1058
+ };
1059
+ return Buy2Win;
934
1060
  }(BaseModel));
935
-
936
- var Home = /** @class */ (function (_super) {
937
- __extends(Home, _super);
938
- function Home() {
939
- return _super !== null && _super.apply(this, arguments) || this;
940
- }
941
- Home.prototype.identifierFields = function () {
942
- return ['id'];
943
- };
944
- return Home;
1061
+ __decorate([
1062
+ classTransformer.Type(function () { return Category; }),
1063
+ __metadata("design:type", Array)
1064
+ ], Buy2Win.prototype, "categories", void 0);
1065
+
1066
+ var Home = /** @class */ (function (_super) {
1067
+ __extends(Home, _super);
1068
+ function Home() {
1069
+ return _super !== null && _super.apply(this, arguments) || this;
1070
+ }
1071
+ Home.prototype.identifierFields = function () {
1072
+ return ['id'];
1073
+ };
1074
+ return Home;
945
1075
  }(BaseModel));
946
1076
 
947
- var ShopMenu = /** @class */ (function (_super) {
948
- __extends(ShopMenu, _super);
949
- function ShopMenu() {
950
- return _super !== null && _super.apply(this, arguments) || this;
951
- }
952
- ShopMenu.prototype.identifierFields = function () {
953
- return ['id'];
954
- };
955
- return ShopMenu;
1077
+ var ShopMenu = /** @class */ (function (_super) {
1078
+ __extends(ShopMenu, _super);
1079
+ function ShopMenu() {
1080
+ return _super !== null && _super.apply(this, arguments) || this;
1081
+ }
1082
+ ShopMenu.prototype.identifierFields = function () {
1083
+ return ['id'];
1084
+ };
1085
+ return ShopMenu;
956
1086
  }(BaseModel));
957
1087
 
958
- var InvalidArgumentError = /** @class */ (function (_super) {
959
- __extends(InvalidArgumentError, _super);
960
- function InvalidArgumentError(message) {
961
- var _this = _super.call(this, message) || this;
962
- _this.message = message;
963
- return _this;
964
- }
965
- return InvalidArgumentError;
1088
+ var InvalidArgumentError = /** @class */ (function (_super) {
1089
+ __extends(InvalidArgumentError, _super);
1090
+ function InvalidArgumentError(message) {
1091
+ var _this = _super.call(this, message) || this;
1092
+ _this.message = message;
1093
+ return _this;
1094
+ }
1095
+ return InvalidArgumentError;
966
1096
  }(Error));
967
1097
 
968
- var RequiredArgumentError = /** @class */ (function (_super) {
969
- __extends(RequiredArgumentError, _super);
970
- function RequiredArgumentError(args) {
971
- var _this = _super.call(this, "Required arguments: " + args.join(', ')) || this;
972
- _this.args = args;
973
- _this.arguments = args;
974
- return _this;
975
- }
976
- return RequiredArgumentError;
1098
+ var RequiredArgumentError = /** @class */ (function (_super) {
1099
+ __extends(RequiredArgumentError, _super);
1100
+ function RequiredArgumentError(args) {
1101
+ var _this = _super.call(this, "Required arguments: " + args.join(', ')) || this;
1102
+ _this.args = args;
1103
+ _this.arguments = args;
1104
+ return _this;
1105
+ }
1106
+ return RequiredArgumentError;
977
1107
  }(Error));
978
1108
 
979
- var NotFoundError = /** @class */ (function (_super) {
980
- __extends(NotFoundError, _super);
981
- function NotFoundError(message) {
982
- var _this = _super.call(this, message) || this;
983
- _this.message = message;
984
- return _this;
985
- }
986
- return NotFoundError;
1109
+ var NotFoundError = /** @class */ (function (_super) {
1110
+ __extends(NotFoundError, _super);
1111
+ function NotFoundError(message) {
1112
+ var _this = _super.call(this, message) || this;
1113
+ _this.message = message;
1114
+ return _this;
1115
+ }
1116
+ return NotFoundError;
987
1117
  }(Error));
988
1118
 
989
- var DuplicatedResultsError = /** @class */ (function (_super) {
990
- __extends(DuplicatedResultsError, _super);
991
- function DuplicatedResultsError(message) {
992
- var _this = _super.call(this, message) || this;
993
- _this.message = message;
994
- return _this;
995
- }
996
- return DuplicatedResultsError;
1119
+ var DuplicatedResultsError = /** @class */ (function (_super) {
1120
+ __extends(DuplicatedResultsError, _super);
1121
+ function DuplicatedResultsError(message) {
1122
+ var _this = _super.call(this, message) || this;
1123
+ _this.message = message;
1124
+ return _this;
1125
+ }
1126
+ return DuplicatedResultsError;
997
1127
  }(Error));
998
1128
 
999
- var withFirestore = function (MixinBase) {
1000
- return /** @class */ (function (_super) {
1001
- __extends(class_1, _super);
1002
- function class_1() {
1003
- var args = [];
1004
- for (var _i = 0; _i < arguments.length; _i++) {
1005
- args[_i] = arguments[_i];
1006
- }
1007
- return _super.call(this, args) || this;
1008
- }
1009
- class_1.prototype.collection = function (path) {
1010
- return this.firestore.collection(path || this.collectionName).withConverter(this.buildModelInstance());
1011
- };
1012
- class_1.prototype.buildModelInstance = function () {
1013
- var _this = this;
1014
- return {
1015
- toFirestore: function (data) { return data.toPlain(); },
1016
- fromFirestore: function (snap) {
1017
- var data = snap.data();
1018
- Object.keys(data).forEach(function (key) {
1019
- if (data[key] instanceof firebase__default["default"].firestore.Timestamp) {
1020
- data[key] = data[key].toDate();
1021
- }
1022
- });
1023
- return _this.model.toInstance(Object.assign({ id: snap.id }, data));
1024
- },
1025
- };
1026
- };
1027
- return class_1;
1028
- }(MixinBase));
1129
+ var withFirestore = function (MixinBase) {
1130
+ return /** @class */ (function (_super) {
1131
+ __extends(class_1, _super);
1132
+ function class_1() {
1133
+ var args = [];
1134
+ for (var _i = 0; _i < arguments.length; _i++) {
1135
+ args[_i] = arguments[_i];
1136
+ }
1137
+ return _super.call(this, args) || this;
1138
+ }
1139
+ class_1.prototype.collection = function (path) {
1140
+ return this.firestore.collection(path || this.collectionName).withConverter(this.buildModelInstance());
1141
+ };
1142
+ class_1.prototype.buildModelInstance = function () {
1143
+ var _this = this;
1144
+ return {
1145
+ toFirestore: function (data) { return data.toPlain(); },
1146
+ fromFirestore: function (snap) {
1147
+ var data = snap.data();
1148
+ Object.keys(data).forEach(function (key) {
1149
+ if (data[key] instanceof firebase__default["default"].firestore.Timestamp) {
1150
+ data[key] = data[key].toDate();
1151
+ }
1152
+ });
1153
+ return _this.model.toInstance(Object.assign({ id: snap.id }, data));
1154
+ },
1155
+ };
1156
+ };
1157
+ return class_1;
1158
+ }(MixinBase));
1029
1159
  };
1030
1160
 
1031
- var withHelpers = function (MixinBase) {
1032
- return /** @class */ (function (_super) {
1033
- __extends(class_1, _super);
1034
- function class_1() {
1035
- return _super !== null && _super.apply(this, arguments) || this;
1036
- }
1037
- class_1.prototype.toArray = function (snapShot) {
1038
- if (Array.isArray(snapShot)) {
1039
- return snapShot.map(function (doc) { return doc.data(); });
1040
- }
1041
- else {
1042
- return snapShot.docs.map(function (doc) { return doc.data(); });
1043
- }
1044
- };
1045
- class_1.prototype.isSubCollection = function (repository) {
1046
- return !lodash.isNil(Object.keys(this).find(function (key) { return key === 'parentRepository'; }));
1047
- };
1048
- return class_1;
1049
- }(MixinBase));
1161
+ var withHelpers = function (MixinBase) {
1162
+ return /** @class */ (function (_super) {
1163
+ __extends(class_1, _super);
1164
+ function class_1() {
1165
+ return _super !== null && _super.apply(this, arguments) || this;
1166
+ }
1167
+ class_1.prototype.toArray = function (snapShot) {
1168
+ if (Array.isArray(snapShot)) {
1169
+ return snapShot.map(function (doc) { return doc.data(); });
1170
+ }
1171
+ else {
1172
+ return snapShot.docs.map(function (doc) { return doc.data(); });
1173
+ }
1174
+ };
1175
+ class_1.prototype.isSubCollection = function (repository) {
1176
+ return !lodash.isNil(Object.keys(this).find(function (key) { return key === 'parentRepository'; }));
1177
+ };
1178
+ return class_1;
1179
+ }(MixinBase));
1050
1180
  };
1051
1181
 
1052
- var withGetFirestore = function (MixinBase) {
1053
- return /** @class */ (function (_super) {
1054
- __extends(GetFirestore, _super);
1055
- function GetFirestore() {
1056
- return _super !== null && _super.apply(this, arguments) || this;
1057
- }
1058
- GetFirestore.prototype.get = function (identifiers) {
1059
- return __awaiter(this, void 0, void 0, function () {
1060
- var doc, data;
1061
- return __generator(this, function (_a) {
1062
- switch (_a.label) {
1063
- case 0: return [4 /*yield*/, this.collection(this.buildCollectionPathForGet(identifiers))
1064
- .doc(Object.values(identifiers).shift().toString())
1065
- .get()];
1066
- case 1:
1067
- doc = _a.sent();
1068
- data = doc.data();
1069
- if (lodash.isNil(data))
1070
- throw new NotFoundError("Document " + JSON.stringify(identifiers) + " not found");
1071
- return [2 /*return*/, data];
1072
- }
1073
- });
1074
- });
1075
- };
1076
- GetFirestore.prototype.buildCollectionPathForGet = function (identifiers) {
1077
- return this.isSubCollection(this)
1078
- ? this.parentRepository.collectionName + "/" + identifiers[this.parentIdField] + "/" + this.collectionName
1079
- : this.collectionName;
1080
- };
1081
- return GetFirestore;
1082
- }(MixinBase));
1182
+ var withGetFirestore = function (MixinBase) {
1183
+ return /** @class */ (function (_super) {
1184
+ __extends(GetFirestore, _super);
1185
+ function GetFirestore() {
1186
+ return _super !== null && _super.apply(this, arguments) || this;
1187
+ }
1188
+ GetFirestore.prototype.get = function (identifiers) {
1189
+ return __awaiter(this, void 0, void 0, function () {
1190
+ var doc, data;
1191
+ return __generator(this, function (_a) {
1192
+ switch (_a.label) {
1193
+ case 0: return [4 /*yield*/, this.collection(this.buildCollectionPathForGet(identifiers))
1194
+ .doc(Object.values(identifiers).shift().toString())
1195
+ .get()];
1196
+ case 1:
1197
+ doc = _a.sent();
1198
+ data = doc.data();
1199
+ if (lodash.isNil(data))
1200
+ throw new NotFoundError("Document " + JSON.stringify(identifiers) + " not found");
1201
+ return [2 /*return*/, data];
1202
+ }
1203
+ });
1204
+ });
1205
+ };
1206
+ GetFirestore.prototype.buildCollectionPathForGet = function (identifiers) {
1207
+ return this.isSubCollection(this)
1208
+ ? this.parentRepository.collectionName + "/" + identifiers[this.parentIdField] + "/" + this.collectionName
1209
+ : this.collectionName;
1210
+ };
1211
+ return GetFirestore;
1212
+ }(MixinBase));
1083
1213
  };
1084
1214
 
1085
- var withFindFirestore = function (MixinBase) {
1086
- return /** @class */ (function (_super) {
1087
- __extends(FindFirestore, _super);
1088
- function FindFirestore() {
1089
- var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
1090
- _this.makeFirestoreWhere = function (queryReference, filter) { return Object.keys(filter).reduce(function (query, fieldName) { return _this.buildWhereSentence(query, fieldName, filter[fieldName]); }, queryReference); };
1091
- _this.buildWhereSentence = function (queryReference, fieldName, options) {
1092
- if (_this.isSubCollection(_this) && fieldName === _this.parentIdField)
1093
- return queryReference;
1094
- if ((options === null || options === void 0 ? void 0 : options.operator) === exports.Where.LIKE) {
1095
- queryReference = queryReference.where(fieldName.toString(), '>=', options.value);
1096
- queryReference = queryReference.where(fieldName.toString(), '<=', options.value + "~");
1097
- return queryReference;
1098
- }
1099
- if ((options === null || options === void 0 ? void 0 : options.operator) === exports.Where.IN && Array.isArray(options === null || options === void 0 ? void 0 : options.value))
1100
- return queryReference.where(fieldName.toString(), 'array-contains-any', options.value);
1101
- return queryReference.where(fieldName.toString(), options.operator, options.value);
1102
- };
1103
- return _this;
1104
- }
1105
- FindFirestore.prototype.find = function (filters, limits, orderBy) {
1106
- return __awaiter(this, void 0, void 0, function () {
1107
- var query, docs, data;
1108
- var _this = this;
1109
- return __generator(this, function (_b) {
1110
- switch (_b.label) {
1111
- case 0:
1112
- query = this.collection(this.buildCollectionPathForFind(filters));
1113
- filters === null || filters === void 0 ? void 0 : filters.forEach(function (filterer) { return (query = _this.makeFirestoreWhere(query, filterer)); });
1114
- orderBy === null || orderBy === void 0 ? void 0 : orderBy.forEach(function (orderer) { return Object.keys(orderer).forEach(function (fieldName) { return (query = query.orderBy(fieldName, orderer[fieldName])); }); });
1115
- query = this.defineLimits(query, filters, limits);
1116
- return [4 /*yield*/, query.get()];
1117
- case 1:
1118
- docs = _b.sent();
1119
- data = docs.docs.map(function (doc) { return doc.data(); });
1120
- return [2 /*return*/, {
1121
- data: data,
1122
- count: this.calculateCount(data, limits),
1123
- }];
1124
- }
1125
- });
1126
- });
1127
- };
1128
- FindFirestore.prototype.buildCollectionPathForFind = function (filters) {
1129
- var _a;
1130
- if (!this.isSubCollection(this))
1131
- return this.collectionName;
1132
- var parentIdField = this.parentIdField;
1133
- var parentId = (_a = filters.find(function (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;
1134
- return this.parentRepository.collectionName + "/" + parentId + "/" + this.collectionName;
1135
- };
1136
- FindFirestore.prototype.defineLimits = function (query, filters, limits) {
1137
- if (limits === null || limits === void 0 ? void 0 : limits.offset) {
1138
- if (limits.offset instanceof this.model)
1139
- query = query.startAfter(this.collection(this.buildCollectionPathForFind(filters)).doc(limits.offset[limits.offset.identifierFields().shift()]));
1140
- if (lodash.isNumber(limits.offset) || lodash.isString(limits.offset))
1141
- query = query.startAt(limits.offset);
1142
- }
1143
- if (limits === null || limits === void 0 ? void 0 : limits.limit)
1144
- query = query.limit(limits.limit);
1145
- return query;
1146
- };
1147
- FindFirestore.prototype.calculateCount = function (data, limits) {
1148
- if (data.length <= 0)
1149
- return 0;
1150
- if (data.length < (limits === null || limits === void 0 ? void 0 : limits.limit))
1151
- return data.length;
1152
- return Infinity;
1153
- };
1154
- return FindFirestore;
1155
- }(MixinBase));
1215
+ var withFindFirestore = function (MixinBase) {
1216
+ return /** @class */ (function (_super) {
1217
+ __extends(FindFirestore, _super);
1218
+ function FindFirestore() {
1219
+ var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
1220
+ _this.makeFirestoreWhere = function (queryReference, filter) { return Object.keys(filter).reduce(function (query, fieldName) { return _this.buildWhereSentence(query, fieldName, filter[fieldName]); }, queryReference); };
1221
+ _this.buildWhereSentence = function (queryReference, fieldName, options) {
1222
+ if (_this.isSubCollection(_this) && fieldName === _this.parentIdField)
1223
+ return queryReference;
1224
+ if ((options === null || options === void 0 ? void 0 : options.operator) === exports.Where.LIKE) {
1225
+ queryReference = queryReference.where(fieldName.toString(), '>=', options.value);
1226
+ queryReference = queryReference.where(fieldName.toString(), '<=', options.value + "~");
1227
+ return queryReference;
1228
+ }
1229
+ if ((options === null || options === void 0 ? void 0 : options.operator) === exports.Where.IN && Array.isArray(options === null || options === void 0 ? void 0 : options.value))
1230
+ return queryReference.where(fieldName.toString(), 'array-contains-any', options.value);
1231
+ return queryReference.where(fieldName.toString(), options.operator, options.value);
1232
+ };
1233
+ return _this;
1234
+ }
1235
+ FindFirestore.prototype.find = function (filters, limits, orderBy) {
1236
+ return __awaiter(this, void 0, void 0, function () {
1237
+ var query, docs, data;
1238
+ var _this = this;
1239
+ return __generator(this, function (_b) {
1240
+ switch (_b.label) {
1241
+ case 0:
1242
+ query = this.collection(this.buildCollectionPathForFind(filters));
1243
+ filters === null || filters === void 0 ? void 0 : filters.forEach(function (filterer) { return (query = _this.makeFirestoreWhere(query, filterer)); });
1244
+ orderBy === null || orderBy === void 0 ? void 0 : orderBy.forEach(function (orderer) { return Object.keys(orderer).forEach(function (fieldName) { return (query = query.orderBy(fieldName, orderer[fieldName])); }); });
1245
+ query = this.defineLimits(query, filters, limits);
1246
+ return [4 /*yield*/, query.get()];
1247
+ case 1:
1248
+ docs = _b.sent();
1249
+ data = docs.docs.map(function (doc) { return doc.data(); });
1250
+ return [2 /*return*/, {
1251
+ data: data,
1252
+ count: this.calculateCount(data, limits),
1253
+ }];
1254
+ }
1255
+ });
1256
+ });
1257
+ };
1258
+ FindFirestore.prototype.buildCollectionPathForFind = function (filters) {
1259
+ var _a;
1260
+ if (!this.isSubCollection(this))
1261
+ return this.collectionName;
1262
+ var parentIdField = this.parentIdField;
1263
+ var parentId = (_a = filters.find(function (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;
1264
+ return this.parentRepository.collectionName + "/" + parentId + "/" + this.collectionName;
1265
+ };
1266
+ FindFirestore.prototype.defineLimits = function (query, filters, limits) {
1267
+ if (limits === null || limits === void 0 ? void 0 : limits.offset) {
1268
+ if (limits.offset instanceof this.model)
1269
+ query = query.startAfter(this.collection(this.buildCollectionPathForFind(filters)).doc(limits.offset[limits.offset.identifierFields().shift()]));
1270
+ if (lodash.isNumber(limits.offset) || lodash.isString(limits.offset))
1271
+ query = query.startAt(limits.offset);
1272
+ }
1273
+ if (limits === null || limits === void 0 ? void 0 : limits.limit)
1274
+ query = query.limit(limits.limit);
1275
+ return query;
1276
+ };
1277
+ FindFirestore.prototype.calculateCount = function (data, limits) {
1278
+ if (data.length <= 0)
1279
+ return 0;
1280
+ if (data.length < (limits === null || limits === void 0 ? void 0 : limits.limit))
1281
+ return data.length;
1282
+ return Infinity;
1283
+ };
1284
+ return FindFirestore;
1285
+ }(MixinBase));
1156
1286
  };
1157
1287
 
1158
- var withCreateFirestore = function (MixinBase) {
1159
- return /** @class */ (function (_super) {
1160
- __extends(CreateFirestore, _super);
1161
- function CreateFirestore() {
1162
- return _super !== null && _super.apply(this, arguments) || this;
1163
- }
1164
- CreateFirestore.prototype.create = function (data) {
1165
- return __awaiter(this, void 0, void 0, function () {
1166
- var docRef, doc;
1167
- return __generator(this, function (_b) {
1168
- switch (_b.label) {
1169
- case 0: return [4 /*yield*/, this.save(this.model.toInstance(data))];
1170
- case 1:
1171
- docRef = _b.sent();
1172
- return [4 /*yield*/, docRef.get()];
1173
- case 2:
1174
- doc = _b.sent();
1175
- return [2 /*return*/, doc.data()];
1176
- }
1177
- });
1178
- });
1179
- };
1180
- CreateFirestore.prototype.save = function (data) {
1181
- var _a;
1182
- return __awaiter(this, void 0, void 0, function () {
1183
- var id, docRef;
1184
- return __generator(this, function (_b) {
1185
- switch (_b.label) {
1186
- case 0:
1187
- id = (_a = data[data.identifierFields().shift()]) === null || _a === void 0 ? void 0 : _a.toString();
1188
- if (lodash.isEmpty(id))
1189
- return [2 /*return*/, this.collection(this.buildCollectionPathForAdd(data)).add(data)];
1190
- docRef = this.collection().doc(id);
1191
- return [4 /*yield*/, docRef.set(data)];
1192
- case 1:
1193
- _b.sent();
1194
- return [2 /*return*/, docRef];
1195
- }
1196
- });
1197
- });
1198
- };
1199
- CreateFirestore.prototype.buildCollectionPathForAdd = function (identifiers) {
1200
- return this.isSubCollection(this)
1201
- ? this.parentRepository.collectionName + "/" + identifiers[this.parentIdField] + "/" + this.collectionName
1202
- : this.collectionName;
1203
- };
1204
- return CreateFirestore;
1205
- }(MixinBase));
1288
+ var withCreateFirestore = function (MixinBase) {
1289
+ return /** @class */ (function (_super) {
1290
+ __extends(CreateFirestore, _super);
1291
+ function CreateFirestore() {
1292
+ return _super !== null && _super.apply(this, arguments) || this;
1293
+ }
1294
+ CreateFirestore.prototype.create = function (data) {
1295
+ return __awaiter(this, void 0, void 0, function () {
1296
+ var docRef, doc;
1297
+ return __generator(this, function (_b) {
1298
+ switch (_b.label) {
1299
+ case 0: return [4 /*yield*/, this.save(this.model.toInstance(data))];
1300
+ case 1:
1301
+ docRef = _b.sent();
1302
+ return [4 /*yield*/, docRef.get()];
1303
+ case 2:
1304
+ doc = _b.sent();
1305
+ return [2 /*return*/, doc.data()];
1306
+ }
1307
+ });
1308
+ });
1309
+ };
1310
+ CreateFirestore.prototype.save = function (data) {
1311
+ var _a;
1312
+ return __awaiter(this, void 0, void 0, function () {
1313
+ var id, docRef;
1314
+ return __generator(this, function (_b) {
1315
+ switch (_b.label) {
1316
+ case 0:
1317
+ id = (_a = data[data.identifierFields().shift()]) === null || _a === void 0 ? void 0 : _a.toString();
1318
+ if (lodash.isEmpty(id))
1319
+ return [2 /*return*/, this.collection(this.buildCollectionPathForAdd(data)).add(data)];
1320
+ docRef = this.collection().doc(id);
1321
+ return [4 /*yield*/, docRef.set(data)];
1322
+ case 1:
1323
+ _b.sent();
1324
+ return [2 /*return*/, docRef];
1325
+ }
1326
+ });
1327
+ });
1328
+ };
1329
+ CreateFirestore.prototype.buildCollectionPathForAdd = function (identifiers) {
1330
+ return this.isSubCollection(this)
1331
+ ? this.parentRepository.collectionName + "/" + identifiers[this.parentIdField] + "/" + this.collectionName
1332
+ : this.collectionName;
1333
+ };
1334
+ return CreateFirestore;
1335
+ }(MixinBase));
1206
1336
  };
1207
1337
 
1208
- var withUpdateFirestore = function (MixinBase) {
1209
- var getValueFromParams = function (params, field) { var _a; return (lodash.isNil((_a = params[field]) === null || _a === void 0 ? void 0 : _a.value) ? params[field] : params[field].value) || null; };
1210
- var getValueByAction = function (options) {
1211
- var fieldValues = firebase__default["default"].firestore.FieldValue;
1212
- if (lodash.isNil(options.action))
1213
- return options;
1214
- if (options.action === exports.UpdateOptionActions.REMOVE_FIELD)
1215
- return fieldValues.delete();
1216
- if (Array.isArray(options.value)) {
1217
- if (options.action === exports.UpdateOptionActions.MERGE)
1218
- return fieldValues.arrayUnion.apply(fieldValues, __spreadArray([], __read(options.value)));
1219
- if (options.action === exports.UpdateOptionActions.REMOVE)
1220
- return fieldValues.arrayRemove.apply(fieldValues, __spreadArray([], __read(options.value)));
1221
- }
1222
- return options.value;
1223
- };
1224
- return /** @class */ (function (_super) {
1225
- __extends(UpdateFirestore, _super);
1226
- function UpdateFirestore() {
1227
- return _super !== null && _super.apply(this, arguments) || this;
1228
- }
1229
- UpdateFirestore.prototype.update = function (data) {
1230
- return __awaiter(this, void 0, void 0, function () {
1231
- var model, keyField, docRef, doc;
1232
- return __generator(this, function (_b) {
1233
- switch (_b.label) {
1234
- case 0:
1235
- model = new this.model();
1236
- keyField = model.identifierFields().shift();
1237
- docRef = this.collection(this.buildCollectionPathForUpdate(data)).doc(getValueFromParams(data, keyField).toString());
1238
- return [4 /*yield*/, docRef.update(this.paramsToPlain(data))];
1239
- case 1:
1240
- _b.sent();
1241
- return [4 /*yield*/, docRef.get()];
1242
- case 2:
1243
- doc = _b.sent();
1244
- return [2 /*return*/, doc.data()];
1245
- }
1246
- });
1247
- });
1248
- };
1249
- UpdateFirestore.prototype.buildCollectionPathForUpdate = function (identifiers) {
1250
- return this.isSubCollection(this)
1251
- ? this.parentRepository.collectionName + "/" + getValueFromParams(identifiers, this.parentIdField) + "/" + this.collectionName
1252
- : this.collectionName;
1253
- };
1254
- UpdateFirestore.prototype.paramsToPlain = function (params) {
1255
- var model = this.model;
1256
- if (params instanceof model)
1257
- return params.toPlain();
1258
- return Object.keys(params).reduce(function (data, currentKey) {
1259
- var _b;
1260
- return (Object.assign(Object.assign({}, data), (_b = {}, _b[currentKey] = getValueByAction(params[currentKey]), _b)));
1261
- }, {});
1262
- };
1263
- return UpdateFirestore;
1264
- }(MixinBase));
1338
+ var withUpdateFirestore = function (MixinBase) {
1339
+ var getValueFromParams = function (params, field) { var _a; return (lodash.isNil((_a = params[field]) === null || _a === void 0 ? void 0 : _a.value) ? params[field] : params[field].value) || null; };
1340
+ var getValueByAction = function (options) {
1341
+ var fieldValues = firebase__default["default"].firestore.FieldValue;
1342
+ if (lodash.isNil(options.action))
1343
+ return options;
1344
+ if (options.action === exports.UpdateOptionActions.REMOVE_FIELD)
1345
+ return fieldValues.delete();
1346
+ if (Array.isArray(options.value)) {
1347
+ if (options.action === exports.UpdateOptionActions.MERGE)
1348
+ return fieldValues.arrayUnion.apply(fieldValues, __spreadArray([], __read(options.value)));
1349
+ if (options.action === exports.UpdateOptionActions.REMOVE)
1350
+ return fieldValues.arrayRemove.apply(fieldValues, __spreadArray([], __read(options.value)));
1351
+ }
1352
+ return options.value;
1353
+ };
1354
+ return /** @class */ (function (_super) {
1355
+ __extends(UpdateFirestore, _super);
1356
+ function UpdateFirestore() {
1357
+ return _super !== null && _super.apply(this, arguments) || this;
1358
+ }
1359
+ UpdateFirestore.prototype.update = function (data) {
1360
+ return __awaiter(this, void 0, void 0, function () {
1361
+ var model, keyField, docRef, doc;
1362
+ return __generator(this, function (_b) {
1363
+ switch (_b.label) {
1364
+ case 0:
1365
+ model = new this.model();
1366
+ keyField = model.identifierFields().shift();
1367
+ docRef = this.collection(this.buildCollectionPathForUpdate(data)).doc(getValueFromParams(data, keyField).toString());
1368
+ return [4 /*yield*/, docRef.update(this.paramsToPlain(data))];
1369
+ case 1:
1370
+ _b.sent();
1371
+ return [4 /*yield*/, docRef.get()];
1372
+ case 2:
1373
+ doc = _b.sent();
1374
+ return [2 /*return*/, doc.data()];
1375
+ }
1376
+ });
1377
+ });
1378
+ };
1379
+ UpdateFirestore.prototype.buildCollectionPathForUpdate = function (identifiers) {
1380
+ return this.isSubCollection(this)
1381
+ ? this.parentRepository.collectionName + "/" + getValueFromParams(identifiers, this.parentIdField) + "/" + this.collectionName
1382
+ : this.collectionName;
1383
+ };
1384
+ UpdateFirestore.prototype.paramsToPlain = function (params) {
1385
+ var model = this.model;
1386
+ if (params instanceof model)
1387
+ return params.toPlain();
1388
+ return Object.keys(params).reduce(function (data, currentKey) {
1389
+ var _b;
1390
+ return (Object.assign(Object.assign({}, data), (_b = {}, _b[currentKey] = getValueByAction(params[currentKey]), _b)));
1391
+ }, {});
1392
+ };
1393
+ return UpdateFirestore;
1394
+ }(MixinBase));
1265
1395
  };
1266
1396
 
1267
- var withDeleteFirestore = function (MixinBase) {
1268
- return /** @class */ (function (_super) {
1269
- __extends(DeleteFirestore, _super);
1270
- function DeleteFirestore() {
1271
- return _super !== null && _super.apply(this, arguments) || this;
1272
- }
1273
- DeleteFirestore.prototype.delete = function (identifiers) {
1274
- return __awaiter(this, void 0, void 0, function () {
1275
- return __generator(this, function (_a) {
1276
- switch (_a.label) {
1277
- case 0: return [4 /*yield*/, this.collection(this.buildCollectionPathForRemove(identifiers))
1278
- .doc(Object.values(identifiers).shift().toString())
1279
- .delete()];
1280
- case 1:
1281
- _a.sent();
1282
- return [2 /*return*/];
1283
- }
1284
- });
1285
- });
1286
- };
1287
- DeleteFirestore.prototype.buildCollectionPathForRemove = function (identifiers) {
1288
- return this.isSubCollection(this)
1289
- ? this.parentRepository.collectionName + "/" + identifiers[this.parentIdField] + "/" + this.collectionName
1290
- : this.collectionName;
1291
- };
1292
- return DeleteFirestore;
1293
- }(MixinBase));
1397
+ var withDeleteFirestore = function (MixinBase) {
1398
+ return /** @class */ (function (_super) {
1399
+ __extends(DeleteFirestore, _super);
1400
+ function DeleteFirestore() {
1401
+ return _super !== null && _super.apply(this, arguments) || this;
1402
+ }
1403
+ DeleteFirestore.prototype.delete = function (identifiers) {
1404
+ return __awaiter(this, void 0, void 0, function () {
1405
+ return __generator(this, function (_a) {
1406
+ switch (_a.label) {
1407
+ case 0: return [4 /*yield*/, this.collection(this.buildCollectionPathForRemove(identifiers))
1408
+ .doc(Object.values(identifiers).shift().toString())
1409
+ .delete()];
1410
+ case 1:
1411
+ _a.sent();
1412
+ return [2 /*return*/];
1413
+ }
1414
+ });
1415
+ });
1416
+ };
1417
+ DeleteFirestore.prototype.buildCollectionPathForRemove = function (identifiers) {
1418
+ return this.isSubCollection(this)
1419
+ ? this.parentRepository.collectionName + "/" + identifiers[this.parentIdField] + "/" + this.collectionName
1420
+ : this.collectionName;
1421
+ };
1422
+ return DeleteFirestore;
1423
+ }(MixinBase));
1294
1424
  };
1295
1425
 
1296
- var withSubCollection = function (MixinBase, ParentModel) {
1297
- return /** @class */ (function (_super) {
1298
- __extends(SubCollectionMix, _super);
1299
- function SubCollectionMix() {
1300
- var args = [];
1301
- for (var _i = 0; _i < arguments.length; _i++) {
1302
- args[_i] = arguments[_i];
1303
- }
1304
- return _super.call(this, args) || this;
1305
- }
1306
- SubCollectionMix.prototype.collection = function (path) {
1307
- return _super.prototype.collection.call(this, path);
1308
- };
1309
- return SubCollectionMix;
1310
- }(MixinBase));
1426
+ var withSubCollection = function (MixinBase, ParentModel) {
1427
+ return /** @class */ (function (_super) {
1428
+ __extends(SubCollectionMix, _super);
1429
+ function SubCollectionMix() {
1430
+ var args = [];
1431
+ for (var _i = 0; _i < arguments.length; _i++) {
1432
+ args[_i] = arguments[_i];
1433
+ }
1434
+ return _super.call(this, args) || this;
1435
+ }
1436
+ SubCollectionMix.prototype.collection = function (path) {
1437
+ return _super.prototype.collection.call(this, path);
1438
+ };
1439
+ return SubCollectionMix;
1440
+ }(MixinBase));
1311
1441
  };
1312
1442
 
1313
- var withCrudFirestore = function (MixinBase) {
1314
- return /** @class */ (function (_super) {
1315
- __extends(CrudFirestore, _super);
1316
- function CrudFirestore() {
1317
- return _super !== null && _super.apply(this, arguments) || this;
1318
- }
1319
- return CrudFirestore;
1320
- }(withUpdateFirestore(withGetFirestore(withFindFirestore(withDeleteFirestore(withCreateFirestore(MixinBase)))))));
1443
+ var withCrudFirestore = function (MixinBase) {
1444
+ return /** @class */ (function (_super) {
1445
+ __extends(CrudFirestore, _super);
1446
+ function CrudFirestore() {
1447
+ return _super !== null && _super.apply(this, arguments) || this;
1448
+ }
1449
+ return CrudFirestore;
1450
+ }(withUpdateFirestore(withGetFirestore(withFindFirestore(withDeleteFirestore(withCreateFirestore(MixinBase)))))));
1321
1451
  };
1322
1452
 
1323
- var SubscriptionFirestoreRepository = /** @class */ (function (_super) {
1324
- __extends(SubscriptionFirestoreRepository, _super);
1325
- function SubscriptionFirestoreRepository(firestore) {
1326
- var _this = _super.call(this) || this;
1327
- _this.firestore = firestore;
1328
- _this.collectionName = 'subscription';
1329
- _this.model = Subscription;
1330
- return _this;
1331
- }
1332
- return SubscriptionFirestoreRepository;
1453
+ var SubscriptionFirestoreRepository = /** @class */ (function (_super) {
1454
+ __extends(SubscriptionFirestoreRepository, _super);
1455
+ function SubscriptionFirestoreRepository(firestore) {
1456
+ var _this = _super.call(this) || this;
1457
+ _this.firestore = firestore;
1458
+ _this.collectionName = 'subscription';
1459
+ _this.model = Subscription;
1460
+ return _this;
1461
+ }
1462
+ return SubscriptionFirestoreRepository;
1333
1463
  }(withCrudFirestore(withHelpers(withFirestore(Base)))));
1334
1464
 
1335
- var UserFirestoreRepository = /** @class */ (function (_super_1) {
1336
- __extends(UserFirestoreRepository, _super_1);
1337
- function UserFirestoreRepository(firestore) {
1338
- var _this = _super_1.call(this) || this;
1339
- _this.firestore = firestore;
1340
- _this.collectionName = 'users';
1341
- _this.model = User;
1342
- return _this;
1343
- }
1344
- UserFirestoreRepository.prototype.get = function (identifiers) {
1345
- var _super = Object.create(null, {
1346
- get: { get: function () { return _super_1.prototype.get; } }
1347
- });
1348
- return __awaiter(this, void 0, void 0, function () {
1349
- var user, _a;
1350
- return __generator(this, function (_b) {
1351
- switch (_b.label) {
1352
- case 0: return [4 /*yield*/, _super.get.call(this, { id: identifiers.id })];
1353
- case 1:
1354
- user = _b.sent();
1355
- _a = user;
1356
- return [4 /*yield*/, this.getBeautyProfile(user.id)];
1357
- case 2:
1358
- _a.beautyProfile = _b.sent();
1359
- return [2 /*return*/, user];
1360
- }
1361
- });
1362
- });
1363
- };
1364
- UserFirestoreRepository.prototype.getBeautyProfile = function (userId) {
1365
- return __awaiter(this, void 0, void 0, function () {
1366
- var beautyProfile;
1367
- return __generator(this, function (_a) {
1368
- switch (_a.label) {
1369
- case 0: return [4 /*yield*/, this.collection()
1370
- .doc(userId)
1371
- .collection('CX')
1372
- .withConverter(this.buildBeautyProfileModelInstance())
1373
- .doc('beautyProfile')
1374
- .get()];
1375
- case 1:
1376
- beautyProfile = _a.sent();
1377
- return [2 /*return*/, beautyProfile.data()];
1378
- }
1379
- });
1380
- });
1381
- };
1382
- UserFirestoreRepository.prototype.buildBeautyProfileModelInstance = function () {
1383
- return {
1384
- toFirestore: function (data) { return data.toPlain(); },
1385
- fromFirestore: function (snap) { return BeautyProfile.toInstance(snap.data()); },
1386
- };
1387
- };
1388
- return UserFirestoreRepository;
1465
+ var UserFirestoreRepository = /** @class */ (function (_super_1) {
1466
+ __extends(UserFirestoreRepository, _super_1);
1467
+ function UserFirestoreRepository(firestore) {
1468
+ var _this = _super_1.call(this) || this;
1469
+ _this.firestore = firestore;
1470
+ _this.collectionName = 'users';
1471
+ _this.model = User;
1472
+ return _this;
1473
+ }
1474
+ UserFirestoreRepository.prototype.get = function (identifiers) {
1475
+ var _super = Object.create(null, {
1476
+ get: { get: function () { return _super_1.prototype.get; } }
1477
+ });
1478
+ return __awaiter(this, void 0, void 0, function () {
1479
+ var user, _a, _b;
1480
+ return __generator(this, function (_c) {
1481
+ switch (_c.label) {
1482
+ case 0: return [4 /*yield*/, _super.get.call(this, { id: identifiers.id })];
1483
+ case 1:
1484
+ user = _c.sent();
1485
+ _a = user;
1486
+ return [4 /*yield*/, this.getBeautyProfile(user.id)];
1487
+ case 2:
1488
+ _a.beautyProfile = _c.sent();
1489
+ _b = user;
1490
+ return [4 /*yield*/, this.checkIfIsSubscriber(user.id)];
1491
+ case 3:
1492
+ _b.isSubscriber = _c.sent();
1493
+ return [2 /*return*/, user];
1494
+ }
1495
+ });
1496
+ });
1497
+ };
1498
+ UserFirestoreRepository.prototype.buildModelInstance = function () {
1499
+ var _a = _super_1.prototype.buildModelInstance.call(this), fromFirestore = _a.fromFirestore, toFirestore = _a.toFirestore;
1500
+ return {
1501
+ toFirestore: function (data) {
1502
+ var plain = toFirestore(data);
1503
+ delete plain.isSubscriber;
1504
+ return plain;
1505
+ },
1506
+ fromFirestore: fromFirestore,
1507
+ };
1508
+ };
1509
+ UserFirestoreRepository.prototype.getBeautyProfile = function (userId) {
1510
+ return __awaiter(this, void 0, void 0, function () {
1511
+ var beautyProfile;
1512
+ return __generator(this, function (_a) {
1513
+ switch (_a.label) {
1514
+ case 0: return [4 /*yield*/, this.collection()
1515
+ .doc(userId)
1516
+ .collection('CX')
1517
+ .withConverter(this.buildBeautyProfileModelInstance())
1518
+ .doc('beautyProfile')
1519
+ .get()];
1520
+ case 1:
1521
+ beautyProfile = _a.sent();
1522
+ return [2 /*return*/, beautyProfile.data()];
1523
+ }
1524
+ });
1525
+ });
1526
+ };
1527
+ UserFirestoreRepository.prototype.checkIfIsSubscriber = function (userId) {
1528
+ return __awaiter(this, void 0, void 0, function () {
1529
+ var docs;
1530
+ return __generator(this, function (_a) {
1531
+ switch (_a.label) {
1532
+ case 0: return [4 /*yield*/, this.firestore
1533
+ .collection('subscription')
1534
+ .where('user.id', '==', userId)
1535
+ .where('status', '==', 'active')
1536
+ .get()];
1537
+ case 1:
1538
+ docs = _a.sent();
1539
+ return [2 /*return*/, !!docs && !!docs.size];
1540
+ }
1541
+ });
1542
+ });
1543
+ };
1544
+ UserFirestoreRepository.prototype.buildBeautyProfileModelInstance = function () {
1545
+ return {
1546
+ toFirestore: function (data) { return data.toPlain(); },
1547
+ fromFirestore: function (snap) { return BeautyProfile.toInstance(snap.data()); },
1548
+ };
1549
+ };
1550
+ return UserFirestoreRepository;
1389
1551
  }(withCrudFirestore(withHelpers(withFirestore(Base)))));
1390
1552
 
1391
- var SubscriptionEditionFirestoreRepository = /** @class */ (function (_super) {
1392
- __extends(SubscriptionEditionFirestoreRepository, _super);
1393
- function SubscriptionEditionFirestoreRepository(firestore, parentRepository) {
1394
- var _this = _super.call(this) || this;
1395
- _this.firestore = firestore;
1396
- _this.parentRepository = parentRepository;
1397
- _this.collectionName = 'editions';
1398
- _this.parentIdField = 'subscriptionId';
1399
- _this.model = Edition;
1400
- return _this;
1401
- }
1402
- return SubscriptionEditionFirestoreRepository;
1553
+ var SubscriptionEditionFirestoreRepository = /** @class */ (function (_super) {
1554
+ __extends(SubscriptionEditionFirestoreRepository, _super);
1555
+ function SubscriptionEditionFirestoreRepository(firestore, parentRepository) {
1556
+ var _this = _super.call(this) || this;
1557
+ _this.firestore = firestore;
1558
+ _this.parentRepository = parentRepository;
1559
+ _this.collectionName = 'editions';
1560
+ _this.parentIdField = 'subscriptionId';
1561
+ _this.model = Edition;
1562
+ return _this;
1563
+ }
1564
+ return SubscriptionEditionFirestoreRepository;
1403
1565
  }(withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Subscription)));
1404
1566
 
1405
- var UserBeautyProfileFirestoreRepository = /** @class */ (function (_super) {
1406
- __extends(UserBeautyProfileFirestoreRepository, _super);
1407
- function UserBeautyProfileFirestoreRepository(firestore, parentRepository) {
1408
- var _this = _super.call(this) || this;
1409
- _this.firestore = firestore;
1410
- _this.parentRepository = parentRepository;
1411
- _this.collectionName = 'CX';
1412
- _this.parentIdField = 'userId';
1413
- _this.model = BeautyProfile;
1414
- return _this;
1415
- }
1416
- return UserBeautyProfileFirestoreRepository;
1567
+ var UserBeautyProfileFirestoreRepository = /** @class */ (function (_super) {
1568
+ __extends(UserBeautyProfileFirestoreRepository, _super);
1569
+ function UserBeautyProfileFirestoreRepository(firestore, parentRepository) {
1570
+ var _this = _super.call(this) || this;
1571
+ _this.firestore = firestore;
1572
+ _this.parentRepository = parentRepository;
1573
+ _this.collectionName = 'CX';
1574
+ _this.parentIdField = 'userId';
1575
+ _this.model = BeautyProfile;
1576
+ return _this;
1577
+ }
1578
+ return UserBeautyProfileFirestoreRepository;
1417
1579
  }(withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User)));
1418
1580
 
1419
- var UserAddressFirestoreRepository = /** @class */ (function (_super) {
1420
- __extends(UserAddressFirestoreRepository, _super);
1421
- function UserAddressFirestoreRepository(firestore, parentRepository) {
1422
- var _this = _super.call(this) || this;
1423
- _this.firestore = firestore;
1424
- _this.parentRepository = parentRepository;
1425
- _this.collectionName = 'address';
1426
- _this.parentIdField = 'userId';
1427
- _this.model = UserAddress;
1428
- return _this;
1429
- }
1430
- return UserAddressFirestoreRepository;
1581
+ var UserAddressFirestoreRepository = /** @class */ (function (_super) {
1582
+ __extends(UserAddressFirestoreRepository, _super);
1583
+ function UserAddressFirestoreRepository(firestore, parentRepository) {
1584
+ var _this = _super.call(this) || this;
1585
+ _this.firestore = firestore;
1586
+ _this.parentRepository = parentRepository;
1587
+ _this.collectionName = 'address';
1588
+ _this.parentIdField = 'userId';
1589
+ _this.model = UserAddress;
1590
+ return _this;
1591
+ }
1592
+ return UserAddressFirestoreRepository;
1431
1593
  }(withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User)));
1432
1594
 
1433
- var SubscriptionPaymentFirestoreRepository = /** @class */ (function (_super) {
1434
- __extends(SubscriptionPaymentFirestoreRepository, _super);
1435
- function SubscriptionPaymentFirestoreRepository(firestore, parentRepository) {
1436
- var _this = _super.call(this) || this;
1437
- _this.firestore = firestore;
1438
- _this.parentRepository = parentRepository;
1439
- _this.collectionName = 'Payments';
1440
- _this.parentIdField = 'subscriptionId';
1441
- _this.model = SubscriptionPayment;
1442
- return _this;
1443
- }
1444
- return SubscriptionPaymentFirestoreRepository;
1595
+ var SubscriptionPaymentFirestoreRepository = /** @class */ (function (_super) {
1596
+ __extends(SubscriptionPaymentFirestoreRepository, _super);
1597
+ function SubscriptionPaymentFirestoreRepository(firestore, parentRepository) {
1598
+ var _this = _super.call(this) || this;
1599
+ _this.firestore = firestore;
1600
+ _this.parentRepository = parentRepository;
1601
+ _this.collectionName = 'Payments';
1602
+ _this.parentIdField = 'subscriptionId';
1603
+ _this.model = SubscriptionPayment;
1604
+ return _this;
1605
+ }
1606
+ return SubscriptionPaymentFirestoreRepository;
1445
1607
  }(withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Subscription)));
1446
1608
 
1447
- var CategoryFirestoreRepository = /** @class */ (function (_super) {
1448
- __extends(CategoryFirestoreRepository, _super);
1449
- function CategoryFirestoreRepository(firestore) {
1450
- var _this = _super.call(this) || this;
1451
- _this.firestore = firestore;
1452
- _this.collectionName = 'categories';
1453
- _this.model = Category;
1454
- return _this;
1455
- }
1456
- CategoryFirestoreRepository.prototype.getCategoryBySlug = function (slug, shop) {
1457
- return this.collection(this.collectionName)
1458
- .where("slug", "==", slug)
1459
- .where("shop", "==", shop)
1460
- .where("published", "==", true)
1461
- .get().then(function (snap) {
1462
- if (snap.size > 1)
1463
- throw new DuplicatedResultsError("Query returned duplicated values");
1464
- if (snap.empty)
1465
- throw new NotFoundError("Document with slug " + slug + " not found");
1466
- return snap.docs[0].data();
1467
- }).catch(function (error) { return error; });
1468
- };
1469
- CategoryFirestoreRepository.prototype.getCategoriesForHome = function (categoryIds) {
1470
- return __awaiter(this, void 0, void 0, function () {
1471
- var categorySnap, categories, homeSections, categories_1, categories_1_1, category, productSnap, products, e_1_1;
1472
- var e_1, _a;
1473
- return __generator(this, function (_b) {
1474
- switch (_b.label) {
1475
- case 0: return [4 /*yield*/, this.collection(this.collectionName)
1476
- .where("id", "in", categoryIds)
1477
- .where("published", "==", true)
1478
- .get()];
1479
- case 1:
1480
- categorySnap = _b.sent();
1481
- if (categorySnap.empty)
1482
- throw new NotFoundError("Categories not found");
1483
- categories = categorySnap.docs.map(function (doc) { return doc.data(); });
1484
- homeSections = [];
1485
- _b.label = 2;
1486
- case 2:
1487
- _b.trys.push([2, 7, 8, 9]);
1488
- categories_1 = __values(categories), categories_1_1 = categories_1.next();
1489
- _b.label = 3;
1490
- case 3:
1491
- if (!!categories_1_1.done) return [3 /*break*/, 6];
1492
- category = categories_1_1.value;
1493
- return [4 /*yield*/, this.collection("products")
1494
- .where("categories", "array-contains", category.id)
1495
- // .where("published", "==", true)
1496
- .where("stock.quantity", ">", 1)
1497
- .limit(4)
1498
- .get()];
1499
- case 4:
1500
- productSnap = _b.sent();
1501
- products = productSnap.docs.map(function (doc) { return doc.data(); });
1502
- homeSections.push({ title: category.name, products: products });
1503
- _b.label = 5;
1504
- case 5:
1505
- categories_1_1 = categories_1.next();
1506
- return [3 /*break*/, 3];
1507
- case 6: return [3 /*break*/, 9];
1508
- case 7:
1509
- e_1_1 = _b.sent();
1510
- e_1 = { error: e_1_1 };
1511
- return [3 /*break*/, 9];
1512
- case 8:
1513
- try {
1514
- if (categories_1_1 && !categories_1_1.done && (_a = categories_1.return)) _a.call(categories_1);
1515
- }
1516
- finally { if (e_1) throw e_1.error; }
1517
- return [7 /*endfinally*/];
1518
- case 9: return [2 /*return*/, homeSections];
1519
- }
1520
- });
1521
- });
1522
- };
1523
- CategoryFirestoreRepository.prototype.mountCategory = function (category) {
1524
- return __awaiter(this, void 0, void 0, function () {
1525
- var chunks, products, chunks_1, chunks_1_1, productIds, productSnap, e_2_1;
1526
- var e_2, _a;
1527
- return __generator(this, function (_b) {
1528
- switch (_b.label) {
1529
- case 0:
1530
- if (!category.products)
1531
- throw new RequiredArgumentError(["Category products is empty"]);
1532
- chunks = category.products.reduce(function (resultArray, item, index) {
1533
- var chunkIndex = Math.floor(index / 10);
1534
- if (!resultArray[chunkIndex])
1535
- resultArray[chunkIndex] = [];
1536
- resultArray[chunkIndex].push(item);
1537
- return resultArray;
1538
- }, []);
1539
- products = [];
1540
- _b.label = 1;
1541
- case 1:
1542
- _b.trys.push([1, 6, 7, 8]);
1543
- chunks_1 = __values(chunks), chunks_1_1 = chunks_1.next();
1544
- _b.label = 2;
1545
- case 2:
1546
- if (!!chunks_1_1.done) return [3 /*break*/, 5];
1547
- productIds = chunks_1_1.value;
1548
- return [4 /*yield*/, this.collection("products")
1549
- .where("id", "in", productIds)
1550
- // .where("published", "==", true)
1551
- .get()];
1552
- case 3:
1553
- productSnap = _b.sent();
1554
- if (productSnap.empty)
1555
- return [3 /*break*/, 4];
1556
- products.push.apply(products, __spreadArray([], __read(productSnap.docs.map(function (doc) { return doc.data(); }))));
1557
- _b.label = 4;
1558
- case 4:
1559
- chunks_1_1 = chunks_1.next();
1560
- return [3 /*break*/, 2];
1561
- case 5: return [3 /*break*/, 8];
1562
- case 6:
1563
- e_2_1 = _b.sent();
1564
- e_2 = { error: e_2_1 };
1565
- return [3 /*break*/, 8];
1566
- case 7:
1567
- try {
1568
- if (chunks_1_1 && !chunks_1_1.done && (_a = chunks_1.return)) _a.call(chunks_1);
1569
- }
1570
- finally { if (e_2) throw e_2.error; }
1571
- return [7 /*endfinally*/];
1572
- case 8: return [2 /*return*/, products];
1573
- }
1574
- });
1575
- });
1576
- };
1577
- return CategoryFirestoreRepository;
1609
+ var CategoryFirestoreRepository = /** @class */ (function (_super) {
1610
+ __extends(CategoryFirestoreRepository, _super);
1611
+ function CategoryFirestoreRepository(firestore) {
1612
+ var _this = _super.call(this) || this;
1613
+ _this.firestore = firestore;
1614
+ _this.collectionName = 'categories';
1615
+ _this.model = Category;
1616
+ return _this;
1617
+ }
1618
+ CategoryFirestoreRepository.prototype.getCategoryBySlug = function (slug, shop) {
1619
+ return this.collection(this.collectionName)
1620
+ .where("slug", "==", slug)
1621
+ .where("shop", "==", shop)
1622
+ .where("published", "==", true)
1623
+ .get().then(function (snap) {
1624
+ if (snap.size > 1)
1625
+ throw new DuplicatedResultsError("Query returned duplicated values");
1626
+ if (snap.empty)
1627
+ throw new NotFoundError("Document with slug " + slug + " not found");
1628
+ return snap.docs[0].data();
1629
+ }).catch(function (error) { return error; });
1630
+ };
1631
+ CategoryFirestoreRepository.prototype.getCategoriesForHome = function (categoryIds) {
1632
+ return __awaiter(this, void 0, void 0, function () {
1633
+ var categorySnap, categories, homeSections, categories_1, categories_1_1, category, productSnap, products, e_1_1;
1634
+ var e_1, _a;
1635
+ return __generator(this, function (_b) {
1636
+ switch (_b.label) {
1637
+ case 0: return [4 /*yield*/, this.collection(this.collectionName)
1638
+ .where("id", "in", categoryIds)
1639
+ .where("published", "==", true)
1640
+ .get()];
1641
+ case 1:
1642
+ categorySnap = _b.sent();
1643
+ if (categorySnap.empty)
1644
+ throw new NotFoundError("Categories not found");
1645
+ categories = categorySnap.docs.map(function (doc) { return doc.data(); });
1646
+ homeSections = [];
1647
+ _b.label = 2;
1648
+ case 2:
1649
+ _b.trys.push([2, 7, 8, 9]);
1650
+ categories_1 = __values(categories), categories_1_1 = categories_1.next();
1651
+ _b.label = 3;
1652
+ case 3:
1653
+ if (!!categories_1_1.done) return [3 /*break*/, 6];
1654
+ category = categories_1_1.value;
1655
+ return [4 /*yield*/, this.collection("products")
1656
+ .where("categories", "array-contains", category.id)
1657
+ // .where("published", "==", true)
1658
+ .where("stock.quantity", ">", 1)
1659
+ .limit(4)
1660
+ .get()];
1661
+ case 4:
1662
+ productSnap = _b.sent();
1663
+ products = productSnap.docs.map(function (doc) { return doc.data(); });
1664
+ homeSections.push({ title: category.name, products: products });
1665
+ _b.label = 5;
1666
+ case 5:
1667
+ categories_1_1 = categories_1.next();
1668
+ return [3 /*break*/, 3];
1669
+ case 6: return [3 /*break*/, 9];
1670
+ case 7:
1671
+ e_1_1 = _b.sent();
1672
+ e_1 = { error: e_1_1 };
1673
+ return [3 /*break*/, 9];
1674
+ case 8:
1675
+ try {
1676
+ if (categories_1_1 && !categories_1_1.done && (_a = categories_1.return)) _a.call(categories_1);
1677
+ }
1678
+ finally { if (e_1) throw e_1.error; }
1679
+ return [7 /*endfinally*/];
1680
+ case 9: return [2 /*return*/, homeSections];
1681
+ }
1682
+ });
1683
+ });
1684
+ };
1685
+ CategoryFirestoreRepository.prototype.mountCategory = function (category) {
1686
+ return __awaiter(this, void 0, void 0, function () {
1687
+ var chunks, products, chunks_1, chunks_1_1, productIds, productSnap, e_2_1;
1688
+ var e_2, _a;
1689
+ return __generator(this, function (_b) {
1690
+ switch (_b.label) {
1691
+ case 0:
1692
+ if (!category.products)
1693
+ throw new RequiredArgumentError(["Category products is empty"]);
1694
+ chunks = category.products.reduce(function (resultArray, item, index) {
1695
+ var chunkIndex = Math.floor(index / 10);
1696
+ if (!resultArray[chunkIndex])
1697
+ resultArray[chunkIndex] = [];
1698
+ resultArray[chunkIndex].push(item);
1699
+ return resultArray;
1700
+ }, []);
1701
+ products = [];
1702
+ _b.label = 1;
1703
+ case 1:
1704
+ _b.trys.push([1, 6, 7, 8]);
1705
+ chunks_1 = __values(chunks), chunks_1_1 = chunks_1.next();
1706
+ _b.label = 2;
1707
+ case 2:
1708
+ if (!!chunks_1_1.done) return [3 /*break*/, 5];
1709
+ productIds = chunks_1_1.value;
1710
+ return [4 /*yield*/, this.collection("products")
1711
+ .where("id", "in", productIds)
1712
+ // .where("published", "==", true)
1713
+ .get()];
1714
+ case 3:
1715
+ productSnap = _b.sent();
1716
+ if (productSnap.empty)
1717
+ return [3 /*break*/, 4];
1718
+ products.push.apply(products, __spreadArray([], __read(productSnap.docs.map(function (doc) { return doc.data(); }))));
1719
+ _b.label = 4;
1720
+ case 4:
1721
+ chunks_1_1 = chunks_1.next();
1722
+ return [3 /*break*/, 2];
1723
+ case 5: return [3 /*break*/, 8];
1724
+ case 6:
1725
+ e_2_1 = _b.sent();
1726
+ e_2 = { error: e_2_1 };
1727
+ return [3 /*break*/, 8];
1728
+ case 7:
1729
+ try {
1730
+ if (chunks_1_1 && !chunks_1_1.done && (_a = chunks_1.return)) _a.call(chunks_1);
1731
+ }
1732
+ finally { if (e_2) throw e_2.error; }
1733
+ return [7 /*endfinally*/];
1734
+ case 8: return [2 /*return*/, products];
1735
+ }
1736
+ });
1737
+ });
1738
+ };
1739
+ return CategoryFirestoreRepository;
1578
1740
  }(withCrudFirestore(withHelpers(withFirestore(Base)))));
1579
1741
 
1580
- var ProductFirestoreRepository = /** @class */ (function (_super) {
1581
- __extends(ProductFirestoreRepository, _super);
1582
- function ProductFirestoreRepository(firestore) {
1583
- var _this = _super.call(this) || this;
1584
- _this.firestore = firestore;
1585
- _this.collectionName = 'products';
1586
- _this.model = Product;
1587
- return _this;
1588
- }
1589
- ProductFirestoreRepository.prototype.getBySlug = function (slug, shop) {
1590
- var _a;
1591
- return __awaiter(this, void 0, void 0, function () {
1592
- var result;
1593
- return __generator(this, function (_b) {
1594
- switch (_b.label) {
1595
- case 0: return [4 /*yield*/, this.find([
1596
- { slug: { operator: exports.Where.EQUALS, value: slug } },
1597
- { shopAvailability: { operator: exports.Where.IN, value: [shop] } },
1598
- ])];
1599
- case 1:
1600
- result = _b.sent();
1601
- return [2 /*return*/, (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.shift()];
1602
- }
1603
- });
1604
- });
1605
- };
1606
- return ProductFirestoreRepository;
1742
+ var ProductFirestoreRepository = /** @class */ (function (_super) {
1743
+ __extends(ProductFirestoreRepository, _super);
1744
+ function ProductFirestoreRepository(firestore) {
1745
+ var _this = _super.call(this) || this;
1746
+ _this.firestore = firestore;
1747
+ _this.collectionName = 'products';
1748
+ _this.model = Product;
1749
+ return _this;
1750
+ }
1751
+ ProductFirestoreRepository.prototype.getBySlug = function (slug, shop) {
1752
+ var _a;
1753
+ return __awaiter(this, void 0, void 0, function () {
1754
+ var result;
1755
+ return __generator(this, function (_b) {
1756
+ switch (_b.label) {
1757
+ case 0: return [4 /*yield*/, this.find([
1758
+ { slug: { operator: exports.Where.EQUALS, value: slug } },
1759
+ { shopAvailability: { operator: exports.Where.IN, value: [shop] } },
1760
+ ])];
1761
+ case 1:
1762
+ result = _b.sent();
1763
+ return [2 /*return*/, (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.shift()];
1764
+ }
1765
+ });
1766
+ });
1767
+ };
1768
+ return ProductFirestoreRepository;
1607
1769
  }(withCrudFirestore(withHelpers(withFirestore(Base)))));
1608
1770
 
1609
- var ProductVariantFirestoreRepository = /** @class */ (function (_super) {
1610
- __extends(ProductVariantFirestoreRepository, _super);
1611
- function ProductVariantFirestoreRepository(firestore, parentRepository) {
1612
- var _this = _super.call(this) || this;
1613
- _this.firestore = firestore;
1614
- _this.parentRepository = parentRepository;
1615
- _this.collectionName = 'variants';
1616
- _this.parentIdField = 'productId';
1617
- _this.model = Variant;
1618
- return _this;
1619
- }
1620
- return ProductVariantFirestoreRepository;
1771
+ var ProductVariantFirestoreRepository = /** @class */ (function (_super) {
1772
+ __extends(ProductVariantFirestoreRepository, _super);
1773
+ function ProductVariantFirestoreRepository(firestore, parentRepository) {
1774
+ var _this = _super.call(this) || this;
1775
+ _this.firestore = firestore;
1776
+ _this.parentRepository = parentRepository;
1777
+ _this.collectionName = 'variants';
1778
+ _this.parentIdField = 'productId';
1779
+ _this.model = Variant;
1780
+ return _this;
1781
+ }
1782
+ return ProductVariantFirestoreRepository;
1621
1783
  }(withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Product)));
1622
1784
 
1623
- var CheckoutFirestoreRepository = /** @class */ (function (_super) {
1624
- __extends(CheckoutFirestoreRepository, _super);
1625
- function CheckoutFirestoreRepository(firestore) {
1626
- var _this = _super.call(this) || this;
1627
- _this.firestore = firestore;
1628
- _this.collectionName = 'checkouts';
1629
- _this.model = Checkout;
1630
- return _this;
1631
- }
1632
- return CheckoutFirestoreRepository;
1785
+ var CheckoutFirestoreRepository = /** @class */ (function (_super) {
1786
+ __extends(CheckoutFirestoreRepository, _super);
1787
+ function CheckoutFirestoreRepository(firestore) {
1788
+ var _this = _super.call(this) || this;
1789
+ _this.firestore = firestore;
1790
+ _this.collectionName = 'checkouts';
1791
+ _this.model = Checkout;
1792
+ return _this;
1793
+ }
1794
+ return CheckoutFirestoreRepository;
1633
1795
  }(withCrudFirestore(withHelpers(withFirestore(Base)))));
1634
1796
 
1635
- var CouponFirestoreRepository = /** @class */ (function (_super) {
1636
- __extends(CouponFirestoreRepository, _super);
1637
- function CouponFirestoreRepository(firestore) {
1638
- var _this = _super.call(this) || this;
1639
- _this.firestore = firestore;
1640
- _this.collectionName = 'coupons';
1641
- _this.model = Coupon;
1642
- return _this;
1643
- }
1644
- return CouponFirestoreRepository;
1797
+ var CouponFirestoreRepository = /** @class */ (function (_super) {
1798
+ __extends(CouponFirestoreRepository, _super);
1799
+ function CouponFirestoreRepository(firestore) {
1800
+ var _this = _super.call(this) || this;
1801
+ _this.firestore = firestore;
1802
+ _this.collectionName = 'coupons';
1803
+ _this.model = Coupon;
1804
+ return _this;
1805
+ }
1806
+ return CouponFirestoreRepository;
1645
1807
  }(withCrudFirestore(withHelpers(withFirestore(Base)))));
1646
1808
 
1647
- var OrderFirestoreRepository = /** @class */ (function (_super) {
1648
- __extends(OrderFirestoreRepository, _super);
1649
- function OrderFirestoreRepository(firestore) {
1650
- var _this = _super.call(this) || this;
1651
- _this.firestore = firestore;
1652
- _this.collectionName = 'orders';
1653
- _this.model = Order;
1654
- return _this;
1655
- }
1656
- return OrderFirestoreRepository;
1809
+ var OrderFirestoreRepository = /** @class */ (function (_super) {
1810
+ __extends(OrderFirestoreRepository, _super);
1811
+ function OrderFirestoreRepository(firestore) {
1812
+ var _this = _super.call(this) || this;
1813
+ _this.firestore = firestore;
1814
+ _this.collectionName = 'orders';
1815
+ _this.model = Order;
1816
+ return _this;
1817
+ }
1818
+ return OrderFirestoreRepository;
1657
1819
  }(withCrudFirestore(withHelpers(withFirestore(Base)))));
1658
1820
 
1659
- var PaymentFirestoreRepository = /** @class */ (function (_super) {
1660
- __extends(PaymentFirestoreRepository, _super);
1661
- function PaymentFirestoreRepository(firestore) {
1662
- var _this = _super.call(this) || this;
1663
- _this.firestore = firestore;
1664
- _this.collectionName = 'payments';
1665
- _this.model = Payment;
1666
- return _this;
1667
- }
1668
- return PaymentFirestoreRepository;
1821
+ var PaymentFirestoreRepository = /** @class */ (function (_super) {
1822
+ __extends(PaymentFirestoreRepository, _super);
1823
+ function PaymentFirestoreRepository(firestore) {
1824
+ var _this = _super.call(this) || this;
1825
+ _this.firestore = firestore;
1826
+ _this.collectionName = 'payments';
1827
+ _this.model = Payment;
1828
+ return _this;
1829
+ }
1830
+ return PaymentFirestoreRepository;
1669
1831
  }(withCrudFirestore(withHelpers(withFirestore(Base)))));
1670
1832
 
1671
- var CheckoutSubscriptionFirestoreRepository = /** @class */ (function (_super) {
1672
- __extends(CheckoutSubscriptionFirestoreRepository, _super);
1673
- function CheckoutSubscriptionFirestoreRepository(firestore) {
1674
- var _this = _super.call(this) || this;
1675
- _this.firestore = firestore;
1676
- _this.collectionName = 'checkoutsSubscription';
1677
- _this.model = CheckoutSubscription;
1678
- return _this;
1679
- }
1680
- return CheckoutSubscriptionFirestoreRepository;
1833
+ var CheckoutSubscriptionFirestoreRepository = /** @class */ (function (_super) {
1834
+ __extends(CheckoutSubscriptionFirestoreRepository, _super);
1835
+ function CheckoutSubscriptionFirestoreRepository(firestore) {
1836
+ var _this = _super.call(this) || this;
1837
+ _this.firestore = firestore;
1838
+ _this.collectionName = 'checkoutsSubscription';
1839
+ _this.model = CheckoutSubscription;
1840
+ return _this;
1841
+ }
1842
+ return CheckoutSubscriptionFirestoreRepository;
1681
1843
  }(withCrudFirestore(withHelpers(withFirestore(Base)))));
1682
1844
 
1683
- var SubscriptionPlanFirestoreRepository = /** @class */ (function (_super) {
1684
- __extends(SubscriptionPlanFirestoreRepository, _super);
1685
- function SubscriptionPlanFirestoreRepository(firestore) {
1686
- var _this = _super.call(this) || this;
1687
- _this.firestore = firestore;
1688
- _this.collectionName = 'subscriptionPlans';
1689
- _this.model = SubscriptionPlan;
1690
- return _this;
1691
- }
1692
- return SubscriptionPlanFirestoreRepository;
1845
+ var SubscriptionPlanFirestoreRepository = /** @class */ (function (_super) {
1846
+ __extends(SubscriptionPlanFirestoreRepository, _super);
1847
+ function SubscriptionPlanFirestoreRepository(firestore) {
1848
+ var _this = _super.call(this) || this;
1849
+ _this.firestore = firestore;
1850
+ _this.collectionName = 'subscriptionPlans';
1851
+ _this.model = SubscriptionPlan;
1852
+ return _this;
1853
+ }
1854
+ return SubscriptionPlanFirestoreRepository;
1693
1855
  }(withCrudFirestore(withHelpers(withFirestore(Base)))));
1694
1856
 
1695
- var Buy2WinFirestoreRepository = /** @class */ (function (_super) {
1696
- __extends(Buy2WinFirestoreRepository, _super);
1697
- function Buy2WinFirestoreRepository(firestore) {
1698
- var _this = _super.call(this) || this;
1699
- _this.firestore = firestore;
1700
- _this.collectionName = 'buy2win';
1701
- _this.model = Buy2Win;
1702
- return _this;
1703
- }
1704
- return Buy2WinFirestoreRepository;
1857
+ var Buy2WinFirestoreRepository = /** @class */ (function (_super) {
1858
+ __extends(Buy2WinFirestoreRepository, _super);
1859
+ function Buy2WinFirestoreRepository(firestore) {
1860
+ var _this = _super.call(this) || this;
1861
+ _this.firestore = firestore;
1862
+ _this.collectionName = 'buy2win';
1863
+ _this.model = Buy2Win;
1864
+ return _this;
1865
+ }
1866
+ return Buy2WinFirestoreRepository;
1705
1867
  }(withCrudFirestore(withHelpers(withFirestore(Base)))));
1706
1868
 
1707
- var HomeFirestoreRepository = /** @class */ (function (_super) {
1708
- __extends(HomeFirestoreRepository, _super);
1709
- function HomeFirestoreRepository(firestore) {
1710
- var _this = _super.call(this) || this;
1711
- _this.firestore = firestore;
1712
- _this.collectionName = 'dms';
1713
- _this.model = Home;
1714
- return _this;
1715
- }
1716
- return HomeFirestoreRepository;
1869
+ var HomeFirestoreRepository = /** @class */ (function (_super) {
1870
+ __extends(HomeFirestoreRepository, _super);
1871
+ function HomeFirestoreRepository(firestore) {
1872
+ var _this = _super.call(this) || this;
1873
+ _this.firestore = firestore;
1874
+ _this.collectionName = 'dms';
1875
+ _this.model = Home;
1876
+ return _this;
1877
+ }
1878
+ return HomeFirestoreRepository;
1717
1879
  }(withCrudFirestore(withHelpers(withFirestore(Base)))));
1718
1880
 
1719
- var ShopMenuFirestoreRepository = /** @class */ (function (_super) {
1720
- __extends(ShopMenuFirestoreRepository, _super);
1721
- function ShopMenuFirestoreRepository(firestore) {
1722
- var _this = _super.call(this) || this;
1723
- _this.firestore = firestore;
1724
- _this.collectionName = 'shopMenus';
1725
- _this.model = ShopMenu;
1726
- return _this;
1727
- }
1728
- return ShopMenuFirestoreRepository;
1881
+ var ShopMenuFirestoreRepository = /** @class */ (function (_super) {
1882
+ __extends(ShopMenuFirestoreRepository, _super);
1883
+ function ShopMenuFirestoreRepository(firestore) {
1884
+ var _this = _super.call(this) || this;
1885
+ _this.firestore = firestore;
1886
+ _this.collectionName = 'shopMenus';
1887
+ _this.model = ShopMenu;
1888
+ return _this;
1889
+ }
1890
+ return ShopMenuFirestoreRepository;
1729
1891
  }(withCrudFirestore(withHelpers(withFirestore(Base)))));
1730
1892
 
1731
- var AuthenticationFirebaseAuthService = /** @class */ (function () {
1732
- function AuthenticationFirebaseAuthService(firebaseAuth) {
1733
- this.firebaseAuth = firebaseAuth;
1734
- }
1735
- AuthenticationFirebaseAuthService.prototype.signInWithEmailAndPassword = function (data) {
1736
- return __awaiter(this, void 0, void 0, function () {
1737
- var credentials, user;
1738
- return __generator(this, function (_a) {
1739
- switch (_a.label) {
1740
- case 0: return [4 /*yield*/, this.firebaseAuth.signInWithEmailAndPassword(data.email, data.password)];
1741
- case 1:
1742
- credentials = _a.sent();
1743
- user = credentials.user;
1744
- return [2 /*return*/, { id: user.uid, displayName: user.displayName, email: user.email, phone: user.phoneNumber }];
1745
- }
1746
- });
1747
- });
1748
- };
1749
- AuthenticationFirebaseAuthService.prototype.signInWithGoogle = function () {
1750
- return __awaiter(this, void 0, void 0, function () {
1751
- var credentials, user;
1752
- return __generator(this, function (_a) {
1753
- switch (_a.label) {
1754
- case 0: return [4 /*yield*/, this.firebaseAuth.signInWithPopup(new firebase__default$1["default"].auth.GoogleAuthProvider())];
1755
- case 1:
1756
- credentials = _a.sent();
1757
- user = credentials.user;
1758
- return [2 /*return*/, { id: user.uid, displayName: user.displayName, email: user.email, phone: user.phoneNumber }];
1759
- }
1760
- });
1761
- });
1762
- };
1763
- AuthenticationFirebaseAuthService.prototype.signOut = function () {
1764
- return __awaiter(this, void 0, void 0, function () {
1765
- return __generator(this, function (_a) {
1766
- this.firebaseAuth.signOut();
1767
- return [2 /*return*/];
1768
- });
1769
- });
1770
- };
1771
- return AuthenticationFirebaseAuthService;
1893
+ var AuthenticationFirebaseAuthService = /** @class */ (function () {
1894
+ function AuthenticationFirebaseAuthService(firebaseAuth) {
1895
+ this.firebaseAuth = firebaseAuth;
1896
+ }
1897
+ AuthenticationFirebaseAuthService.prototype.signInWithEmailAndPassword = function (data) {
1898
+ return __awaiter(this, void 0, void 0, function () {
1899
+ var credentials, user;
1900
+ return __generator(this, function (_a) {
1901
+ switch (_a.label) {
1902
+ case 0: return [4 /*yield*/, this.firebaseAuth.signInWithEmailAndPassword(data.email, data.password)];
1903
+ case 1:
1904
+ credentials = _a.sent();
1905
+ user = credentials.user;
1906
+ return [2 /*return*/, { id: user.uid, displayName: user.displayName, email: user.email, phone: user.phoneNumber }];
1907
+ }
1908
+ });
1909
+ });
1910
+ };
1911
+ AuthenticationFirebaseAuthService.prototype.signInWithGoogle = function () {
1912
+ return __awaiter(this, void 0, void 0, function () {
1913
+ var credentials, user;
1914
+ return __generator(this, function (_a) {
1915
+ switch (_a.label) {
1916
+ case 0: return [4 /*yield*/, this.firebaseAuth.signInWithPopup(new firebase__default$1["default"].auth.GoogleAuthProvider())];
1917
+ case 1:
1918
+ credentials = _a.sent();
1919
+ user = credentials.user;
1920
+ return [2 /*return*/, { id: user.uid, displayName: user.displayName, email: user.email, phone: user.phoneNumber }];
1921
+ }
1922
+ });
1923
+ });
1924
+ };
1925
+ AuthenticationFirebaseAuthService.prototype.signOut = function () {
1926
+ return __awaiter(this, void 0, void 0, function () {
1927
+ return __generator(this, function (_a) {
1928
+ this.firebaseAuth.signOut();
1929
+ return [2 /*return*/];
1930
+ });
1931
+ });
1932
+ };
1933
+ return AuthenticationFirebaseAuthService;
1772
1934
  }());
1773
1935
 
1774
- /**
1775
- * Generated bundle index. Do not edit.
1936
+ /**
1937
+ * Generated bundle index. Do not edit.
1776
1938
  */
1777
1939
 
1778
1940
  Object.defineProperty(exports, 'chunk', {