@infrab4a/connect 0.17.0-beta.1 → 0.17.0-beta.10

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 (492) hide show
  1. package/README.md +24 -24
  2. package/bundles/infrab4a-connect.umd.js +2448 -2376
  3. package/bundles/infrab4a-connect.umd.js.map +1 -1
  4. package/domain/catalog/index.d.ts +2 -2
  5. package/domain/catalog/models/category.d.ts +22 -22
  6. package/domain/catalog/models/enums/index.d.ts +1 -1
  7. package/domain/catalog/models/enums/shops.enum.d.ts +6 -5
  8. package/domain/catalog/models/index.d.ts +5 -5
  9. package/domain/catalog/models/product.d.ts +35 -35
  10. package/domain/catalog/models/types/category-condition.type.d.ts +4 -4
  11. package/domain/catalog/models/types/category-filter.type.d.ts +4 -4
  12. package/domain/catalog/models/types/index.d.ts +7 -7
  13. package/domain/catalog/models/types/product-review.type.d.ts +15 -15
  14. package/domain/catalog/models/types/shops-description.type.d.ts +7 -7
  15. package/domain/catalog/models/types/shops-price.type.d.ts +10 -10
  16. package/domain/catalog/models/types/stock.type.d.ts +3 -3
  17. package/domain/catalog/models/types/variant-grade.type.d.ts +4 -4
  18. package/domain/catalog/models/variant.d.ts +14 -14
  19. package/domain/catalog/repositories/category.repository.d.ts +15 -15
  20. package/domain/catalog/repositories/index.d.ts +4 -4
  21. package/domain/catalog/repositories/product.repository.d.ts +5 -5
  22. package/domain/catalog/repositories/subscription-product.repository.d.ts +4 -4
  23. package/domain/catalog/repositories/variant.repository.d.ts +4 -4
  24. package/domain/general/index.d.ts +2 -2
  25. package/domain/general/model/base-model-with-identifier-fields.d.ts +3 -3
  26. package/domain/general/model/base.model.d.ts +6 -6
  27. package/domain/general/model/identifier-fields.d.ts +4 -4
  28. package/domain/general/model/index.d.ts +4 -4
  29. package/domain/general/model/types/base-model-builder.type.d.ts +5 -5
  30. package/domain/general/model/types/index.d.ts +3 -3
  31. package/domain/general/model/types/non-function-properties.type.d.ts +2 -2
  32. package/domain/general/model/types/non-function-property-name.type.d.ts +3 -3
  33. package/domain/general/repository/create.repository.d.ts +5 -5
  34. package/domain/general/repository/crud.repository.d.ts +7 -7
  35. package/domain/general/repository/delete.repository.d.ts +5 -5
  36. package/domain/general/repository/enums/index.d.ts +2 -2
  37. package/domain/general/repository/enums/update-option-actions.enum.d.ts +7 -7
  38. package/domain/general/repository/enums/where.enum.d.ts +10 -10
  39. package/domain/general/repository/find.repository.d.ts +5 -5
  40. package/domain/general/repository/get.repository.d.ts +5 -5
  41. package/domain/general/repository/index.d.ts +9 -9
  42. package/domain/general/repository/read.repository.d.ts +5 -5
  43. package/domain/general/repository/types/index.d.ts +5 -5
  44. package/domain/general/repository/types/repository-find-filters.type.d.ts +14 -14
  45. package/domain/general/repository/types/repository-find-result.type.d.ts +4 -4
  46. package/domain/general/repository/types/repository-limit-options.type.d.ts +4 -4
  47. package/domain/general/repository/types/repository-order-by-list.type.d.ts +5 -5
  48. package/domain/general/repository/types/repository-update-params.type.d.ts +11 -11
  49. package/domain/general/repository/update.repository.d.ts +5 -5
  50. package/domain/index.d.ts +6 -6
  51. package/domain/location/index.d.ts +1 -1
  52. package/domain/location/models/address.d.ts +21 -21
  53. package/domain/location/models/index.d.ts +2 -2
  54. package/domain/location/models/types/index.d.ts +3 -3
  55. package/domain/location/models/types/location-bound.type.d.ts +6 -6
  56. package/domain/location/models/types/location-geometry.type.d.ts +7 -7
  57. package/domain/location/models/types/location-lat-lng.type.d.ts +4 -4
  58. package/domain/shop-settings/enums/filter-type.enum.d.ts +19 -19
  59. package/domain/shop-settings/enums/index.d.ts +2 -2
  60. package/domain/shop-settings/enums/questions-filters.enum.d.ts +19 -19
  61. package/domain/shop-settings/helpers/beauty-questions.helper.d.ts +9 -9
  62. package/domain/shop-settings/helpers/index.d.ts +1 -1
  63. package/domain/shop-settings/index.d.ts +4 -4
  64. package/domain/shop-settings/models/home.d.ts +17 -17
  65. package/domain/shop-settings/models/index.d.ts +3 -3
  66. package/domain/shop-settings/models/shop-menu.d.ts +7 -7
  67. package/domain/shop-settings/models/types/banner.type.d.ts +6 -6
  68. package/domain/shop-settings/models/types/benefit.type.d.ts +5 -5
  69. package/domain/shop-settings/models/types/home-data.type.d.ts +15 -15
  70. package/domain/shop-settings/models/types/index.d.ts +5 -5
  71. package/domain/shop-settings/models/types/menu-nav.type.d.ts +8 -8
  72. package/domain/shop-settings/models/types/sub-menu.type.d.ts +8 -8
  73. package/domain/shop-settings/repositories/home.repository.d.ts +4 -4
  74. package/domain/shop-settings/repositories/index.d.ts +2 -2
  75. package/domain/shop-settings/repositories/shop-menu.repository.d.ts +4 -4
  76. package/domain/shopping/index.d.ts +2 -2
  77. package/domain/shopping/models/buy-2-win.d.ts +18 -18
  78. package/domain/shopping/models/checkout.d.ts +29 -29
  79. package/domain/shopping/models/coupons/coupon.d.ts +34 -28
  80. package/domain/shopping/models/coupons/enums/coupon-club-mens.enum.d.ts +5 -0
  81. package/domain/shopping/models/coupons/enums/coupon-subtypes.enum.d.ts +4 -4
  82. package/domain/shopping/models/coupons/enums/coupon-types.enum.d.ts +4 -6
  83. package/domain/shopping/models/coupons/enums/exclusivities.enum.d.ts +8 -5
  84. package/domain/shopping/models/coupons/enums/index.d.ts +3 -3
  85. package/domain/shopping/models/coupons/index.d.ts +2 -3
  86. package/domain/shopping/models/enums/checkout-types.enum.d.ts +5 -4
  87. package/domain/shopping/models/enums/index.d.ts +2 -2
  88. package/domain/shopping/models/enums/order-status.enum.d.ts +10 -10
  89. package/domain/shopping/models/index.d.ts +11 -11
  90. package/domain/shopping/models/line-item.d.ts +8 -8
  91. package/domain/shopping/models/order.d.ts +9 -9
  92. package/domain/shopping/models/payment.d.ts +69 -69
  93. package/domain/shopping/models/shipping-method.d.ts +18 -18
  94. package/domain/shopping/models/subscription/checkout.d.ts +23 -23
  95. package/domain/shopping/models/subscription/index.d.ts +2 -2
  96. package/domain/shopping/models/subscription/plan.d.ts +12 -12
  97. package/domain/shopping/models/types/index.d.ts +7 -7
  98. package/domain/shopping/models/types/payment-address.type.d.ts +12 -12
  99. package/domain/shopping/models/types/payment-billing.type.d.ts +7 -7
  100. package/domain/shopping/models/types/payment-card.type.d.ts +14 -14
  101. package/domain/shopping/models/types/payment-customer.type.d.ts +18 -18
  102. package/domain/shopping/models/types/payment-document.type.d.ts +6 -6
  103. package/domain/shopping/models/types/payment-item.type.d.ts +11 -11
  104. package/domain/shopping/models/types/payment-shipping.type.d.ts +10 -10
  105. package/domain/shopping/repositories/buy-2-win.repository.d.ts +4 -4
  106. package/domain/shopping/repositories/checkout.repository.d.ts +4 -4
  107. package/domain/shopping/repositories/coupon.repository.d.ts +4 -4
  108. package/domain/shopping/repositories/index.d.ts +7 -7
  109. package/domain/shopping/repositories/legacy-order.repository.d.ts +3 -3
  110. package/domain/shopping/repositories/order.repository.d.ts +4 -4
  111. package/domain/shopping/repositories/payment.repository.d.ts +4 -4
  112. package/domain/shopping/repositories/subscription/checkout.repository.d.ts +4 -4
  113. package/domain/shopping/repositories/subscription/index.d.ts +2 -2
  114. package/domain/shopping/repositories/subscription/plan.repository.d.ts +4 -4
  115. package/domain/users/errors/index.d.ts +3 -3
  116. package/domain/users/errors/unauthorized.error.d.ts +4 -4
  117. package/domain/users/errors/user-already-registered.error.d.ts +4 -4
  118. package/domain/users/errors/weak-password.error.d.ts +4 -4
  119. package/domain/users/index.d.ts +5 -5
  120. package/domain/users/models/beauty-profile.d.ts +12 -12
  121. package/domain/users/models/enums/accessory-importances.enum.d.ts +5 -5
  122. package/domain/users/models/enums/area.enum.d.ts +11 -11
  123. package/domain/users/models/enums/beard-problems.enum.d.ts +9 -9
  124. package/domain/users/models/enums/beard-sizes.enum.d.ts +7 -7
  125. package/domain/users/models/enums/beauty-product-importances.enum.d.ts +6 -6
  126. package/domain/users/models/enums/body-problems.enum.d.ts +11 -11
  127. package/domain/users/models/enums/body-shapes.enum.d.ts +7 -7
  128. package/domain/users/models/enums/body-tattoos.enum.d.ts +5 -5
  129. package/domain/users/models/enums/face-skin-oilinesses.enum.d.ts +7 -7
  130. package/domain/users/models/enums/face-skin-problems.enum.d.ts +10 -10
  131. package/domain/users/models/enums/face-skin-tones.enum.d.ts +8 -8
  132. package/domain/users/models/enums/family-incomes.enum.d.ts +8 -8
  133. package/domain/users/models/enums/fragrance-importances.enum.d.ts +5 -5
  134. package/domain/users/models/enums/hair-colors.enum.d.ts +10 -10
  135. package/domain/users/models/enums/hair-problems.enum.d.ts +10 -10
  136. package/domain/users/models/enums/hair-strands.enum.d.ts +8 -8
  137. package/domain/users/models/enums/hair-types.enum.d.ts +7 -7
  138. package/domain/users/models/enums/index.d.ts +20 -20
  139. package/domain/users/models/enums/office-position.enum.d.ts +6 -6
  140. package/domain/users/models/enums/product-spents.enum.d.ts +8 -8
  141. package/domain/users/models/enums/user-type.enum.d.ts +8 -8
  142. package/domain/users/models/index.d.ts +7 -7
  143. package/domain/users/models/lead.d.ts +9 -9
  144. package/domain/users/models/subscription/edition.d.ts +17 -15
  145. package/domain/users/models/subscription/enums/billing-status.enum.d.ts +3 -3
  146. package/domain/users/models/subscription/enums/edition-status.enum.d.ts +4 -4
  147. package/domain/users/models/subscription/enums/index.d.ts +4 -4
  148. package/domain/users/models/subscription/enums/payment-type.enum.d.ts +5 -5
  149. package/domain/users/models/subscription/enums/status.enum.d.ts +4 -4
  150. package/domain/users/models/subscription/index.d.ts +4 -4
  151. package/domain/users/models/subscription/payment.d.ts +14 -14
  152. package/domain/users/models/subscription/subscription.d.ts +30 -30
  153. package/domain/users/models/user-address.d.ts +7 -7
  154. package/domain/users/models/user-payment-method.d.ts +14 -13
  155. package/domain/users/models/user.d.ts +25 -24
  156. package/domain/users/repositories/beauty-profile.repository.d.ts +4 -4
  157. package/domain/users/repositories/edition.repository.d.ts +4 -4
  158. package/domain/users/repositories/index.d.ts +8 -8
  159. package/domain/users/repositories/lead.repository.d.ts +4 -4
  160. package/domain/users/repositories/subscription-payment.repository.d.ts +4 -4
  161. package/domain/users/repositories/subscription.repository.d.ts +4 -4
  162. package/domain/users/repositories/user-address.repository.d.ts +4 -4
  163. package/domain/users/repositories/user-payment-method.repository.d.ts +4 -4
  164. package/domain/users/repositories/user.repository.d.ts +6 -6
  165. package/domain/users/services/authentication.service.d.ts +12 -12
  166. package/domain/users/services/index.d.ts +3 -3
  167. package/domain/users/services/register.service.d.ts +7 -7
  168. package/domain/users/services/types/basic-user-data.type.d.ts +4 -4
  169. package/domain/users/services/types/index.d.ts +1 -1
  170. package/domain/users/use-cases/authentication.d.ts +21 -21
  171. package/domain/users/use-cases/index.d.ts +4 -4
  172. package/domain/users/use-cases/recovery-password.d.ts +6 -6
  173. package/domain/users/use-cases/register.d.ts +13 -13
  174. package/domain/users/use-cases/signout.d.ts +6 -6
  175. package/errors/duplicated-results.error.d.ts +4 -4
  176. package/errors/index.d.ts +4 -4
  177. package/errors/invalid-argument.error.d.ts +4 -4
  178. package/errors/not-found.error.d.ts +4 -4
  179. package/errors/required-argument.error.d.ts +5 -5
  180. package/esm2015/domain/catalog/index.js +3 -3
  181. package/esm2015/domain/catalog/models/category.js +7 -7
  182. package/esm2015/domain/catalog/models/enums/index.js +2 -2
  183. package/esm2015/domain/catalog/models/enums/shops.enum.js +8 -7
  184. package/esm2015/domain/catalog/models/index.js +6 -6
  185. package/esm2015/domain/catalog/models/product.js +11 -11
  186. package/esm2015/domain/catalog/models/types/category-condition.type.js +2 -2
  187. package/esm2015/domain/catalog/models/types/category-filter.type.js +2 -2
  188. package/esm2015/domain/catalog/models/types/index.js +8 -8
  189. package/esm2015/domain/catalog/models/types/product-review.type.js +2 -2
  190. package/esm2015/domain/catalog/models/types/shops-description.type.js +2 -2
  191. package/esm2015/domain/catalog/models/types/shops-price.type.js +2 -2
  192. package/esm2015/domain/catalog/models/types/stock.type.js +2 -2
  193. package/esm2015/domain/catalog/models/types/variant-grade.type.js +2 -2
  194. package/esm2015/domain/catalog/models/variant.js +7 -7
  195. package/esm2015/domain/catalog/repositories/category.repository.js +2 -2
  196. package/esm2015/domain/catalog/repositories/index.js +5 -5
  197. package/esm2015/domain/catalog/repositories/product.repository.js +2 -2
  198. package/esm2015/domain/catalog/repositories/subscription-product.repository.js +2 -2
  199. package/esm2015/domain/catalog/repositories/variant.repository.js +2 -2
  200. package/esm2015/domain/general/index.js +3 -3
  201. package/esm2015/domain/general/model/base-model-with-identifier-fields.js +2 -2
  202. package/esm2015/domain/general/model/base.model.js +13 -13
  203. package/esm2015/domain/general/model/identifier-fields.js +2 -2
  204. package/esm2015/domain/general/model/index.js +5 -5
  205. package/esm2015/domain/general/model/types/base-model-builder.type.js +2 -2
  206. package/esm2015/domain/general/model/types/index.js +4 -4
  207. package/esm2015/domain/general/model/types/non-function-properties.type.js +2 -2
  208. package/esm2015/domain/general/model/types/non-function-property-name.type.js +2 -2
  209. package/esm2015/domain/general/repository/create.repository.js +2 -2
  210. package/esm2015/domain/general/repository/crud.repository.js +2 -2
  211. package/esm2015/domain/general/repository/delete.repository.js +2 -2
  212. package/esm2015/domain/general/repository/enums/index.js +3 -3
  213. package/esm2015/domain/general/repository/enums/update-option-actions.enum.js +9 -9
  214. package/esm2015/domain/general/repository/enums/where.enum.js +12 -12
  215. package/esm2015/domain/general/repository/find.repository.js +2 -2
  216. package/esm2015/domain/general/repository/get.repository.js +2 -2
  217. package/esm2015/domain/general/repository/index.js +10 -10
  218. package/esm2015/domain/general/repository/read.repository.js +2 -2
  219. package/esm2015/domain/general/repository/types/index.js +6 -6
  220. package/esm2015/domain/general/repository/types/repository-find-filters.type.js +2 -2
  221. package/esm2015/domain/general/repository/types/repository-find-result.type.js +2 -2
  222. package/esm2015/domain/general/repository/types/repository-limit-options.type.js +2 -2
  223. package/esm2015/domain/general/repository/types/repository-order-by-list.type.js +2 -2
  224. package/esm2015/domain/general/repository/types/repository-update-params.type.js +2 -2
  225. package/esm2015/domain/general/repository/update.repository.js +2 -2
  226. package/esm2015/domain/index.js +7 -7
  227. package/esm2015/domain/location/index.js +2 -2
  228. package/esm2015/domain/location/models/address.js +4 -4
  229. package/esm2015/domain/location/models/index.js +3 -3
  230. package/esm2015/domain/location/models/types/index.js +4 -4
  231. package/esm2015/domain/location/models/types/location-bound.type.js +2 -2
  232. package/esm2015/domain/location/models/types/location-geometry.type.js +2 -2
  233. package/esm2015/domain/location/models/types/location-lat-lng.type.js +2 -2
  234. package/esm2015/domain/shop-settings/enums/filter-type.enum.js +21 -21
  235. package/esm2015/domain/shop-settings/enums/index.js +3 -3
  236. package/esm2015/domain/shop-settings/enums/questions-filters.enum.js +21 -21
  237. package/esm2015/domain/shop-settings/helpers/beauty-questions.helper.js +46 -46
  238. package/esm2015/domain/shop-settings/helpers/index.js +2 -2
  239. package/esm2015/domain/shop-settings/index.js +5 -5
  240. package/esm2015/domain/shop-settings/models/home.js +7 -7
  241. package/esm2015/domain/shop-settings/models/index.js +4 -4
  242. package/esm2015/domain/shop-settings/models/shop-menu.js +7 -7
  243. package/esm2015/domain/shop-settings/models/types/banner.type.js +2 -2
  244. package/esm2015/domain/shop-settings/models/types/benefit.type.js +2 -2
  245. package/esm2015/domain/shop-settings/models/types/home-data.type.js +2 -2
  246. package/esm2015/domain/shop-settings/models/types/index.js +6 -6
  247. package/esm2015/domain/shop-settings/models/types/menu-nav.type.js +2 -2
  248. package/esm2015/domain/shop-settings/models/types/sub-menu.type.js +2 -2
  249. package/esm2015/domain/shop-settings/repositories/home.repository.js +2 -2
  250. package/esm2015/domain/shop-settings/repositories/index.js +3 -3
  251. package/esm2015/domain/shop-settings/repositories/shop-menu.repository.js +2 -2
  252. package/esm2015/domain/shopping/index.js +3 -3
  253. package/esm2015/domain/shopping/models/buy-2-win.js +14 -14
  254. package/esm2015/domain/shopping/models/checkout.js +38 -38
  255. package/esm2015/domain/shopping/models/coupons/coupon.js +38 -23
  256. package/esm2015/domain/shopping/models/coupons/enums/coupon-club-mens.enum.js +7 -0
  257. package/esm2015/domain/shopping/models/coupons/enums/coupon-subtypes.enum.js +6 -6
  258. package/esm2015/domain/shopping/models/coupons/enums/coupon-types.enum.js +10 -8
  259. package/esm2015/domain/shopping/models/coupons/enums/exclusivities.enum.js +10 -7
  260. package/esm2015/domain/shopping/models/coupons/enums/index.js +4 -4
  261. package/esm2015/domain/shopping/models/coupons/index.js +3 -4
  262. package/esm2015/domain/shopping/models/enums/checkout-types.enum.js +7 -6
  263. package/esm2015/domain/shopping/models/enums/index.js +3 -3
  264. package/esm2015/domain/shopping/models/enums/order-status.enum.js +12 -12
  265. package/esm2015/domain/shopping/models/index.js +12 -12
  266. package/esm2015/domain/shopping/models/line-item.js +4 -4
  267. package/esm2015/domain/shopping/models/order.js +11 -11
  268. package/esm2015/domain/shopping/models/payment.js +169 -169
  269. package/esm2015/domain/shopping/models/shipping-method.js +7 -7
  270. package/esm2015/domain/shopping/models/subscription/checkout.js +28 -28
  271. package/esm2015/domain/shopping/models/subscription/index.js +3 -3
  272. package/esm2015/domain/shopping/models/subscription/plan.js +7 -7
  273. package/esm2015/domain/shopping/models/types/index.js +8 -8
  274. package/esm2015/domain/shopping/models/types/payment-address.type.js +2 -2
  275. package/esm2015/domain/shopping/models/types/payment-billing.type.js +2 -2
  276. package/esm2015/domain/shopping/models/types/payment-card.type.js +2 -2
  277. package/esm2015/domain/shopping/models/types/payment-customer.type.js +2 -2
  278. package/esm2015/domain/shopping/models/types/payment-document.type.js +2 -2
  279. package/esm2015/domain/shopping/models/types/payment-item.type.js +2 -2
  280. package/esm2015/domain/shopping/models/types/payment-shipping.type.js +2 -2
  281. package/esm2015/domain/shopping/repositories/buy-2-win.repository.js +2 -2
  282. package/esm2015/domain/shopping/repositories/checkout.repository.js +2 -2
  283. package/esm2015/domain/shopping/repositories/coupon.repository.js +2 -2
  284. package/esm2015/domain/shopping/repositories/index.js +8 -8
  285. package/esm2015/domain/shopping/repositories/legacy-order.repository.js +2 -2
  286. package/esm2015/domain/shopping/repositories/order.repository.js +2 -2
  287. package/esm2015/domain/shopping/repositories/payment.repository.js +2 -2
  288. package/esm2015/domain/shopping/repositories/subscription/checkout.repository.js +2 -2
  289. package/esm2015/domain/shopping/repositories/subscription/index.js +3 -3
  290. package/esm2015/domain/shopping/repositories/subscription/plan.repository.js +2 -2
  291. package/esm2015/domain/users/errors/index.js +4 -4
  292. package/esm2015/domain/users/errors/unauthorized.error.js +7 -7
  293. package/esm2015/domain/users/errors/user-already-registered.error.js +7 -7
  294. package/esm2015/domain/users/errors/weak-password.error.js +7 -7
  295. package/esm2015/domain/users/index.js +6 -6
  296. package/esm2015/domain/users/models/beauty-profile.js +12 -12
  297. package/esm2015/domain/users/models/enums/accessory-importances.enum.js +7 -7
  298. package/esm2015/domain/users/models/enums/area.enum.js +13 -13
  299. package/esm2015/domain/users/models/enums/beard-problems.enum.js +11 -11
  300. package/esm2015/domain/users/models/enums/beard-sizes.enum.js +9 -9
  301. package/esm2015/domain/users/models/enums/beauty-product-importances.enum.js +8 -8
  302. package/esm2015/domain/users/models/enums/body-problems.enum.js +13 -13
  303. package/esm2015/domain/users/models/enums/body-shapes.enum.js +9 -9
  304. package/esm2015/domain/users/models/enums/body-tattoos.enum.js +7 -7
  305. package/esm2015/domain/users/models/enums/face-skin-oilinesses.enum.js +9 -9
  306. package/esm2015/domain/users/models/enums/face-skin-problems.enum.js +12 -12
  307. package/esm2015/domain/users/models/enums/face-skin-tones.enum.js +10 -10
  308. package/esm2015/domain/users/models/enums/family-incomes.enum.js +10 -10
  309. package/esm2015/domain/users/models/enums/fragrance-importances.enum.js +7 -7
  310. package/esm2015/domain/users/models/enums/hair-colors.enum.js +12 -12
  311. package/esm2015/domain/users/models/enums/hair-problems.enum.js +12 -12
  312. package/esm2015/domain/users/models/enums/hair-strands.enum.js +10 -10
  313. package/esm2015/domain/users/models/enums/hair-types.enum.js +9 -9
  314. package/esm2015/domain/users/models/enums/index.js +21 -21
  315. package/esm2015/domain/users/models/enums/office-position.enum.js +8 -8
  316. package/esm2015/domain/users/models/enums/product-spents.enum.js +10 -10
  317. package/esm2015/domain/users/models/enums/user-type.enum.js +10 -10
  318. package/esm2015/domain/users/models/index.js +8 -8
  319. package/esm2015/domain/users/models/lead.js +7 -7
  320. package/esm2015/domain/users/models/subscription/edition.js +7 -7
  321. package/esm2015/domain/users/models/subscription/enums/billing-status.enum.js +5 -5
  322. package/esm2015/domain/users/models/subscription/enums/edition-status.enum.js +6 -6
  323. package/esm2015/domain/users/models/subscription/enums/index.js +5 -5
  324. package/esm2015/domain/users/models/subscription/enums/payment-type.enum.js +7 -7
  325. package/esm2015/domain/users/models/subscription/enums/status.enum.js +6 -6
  326. package/esm2015/domain/users/models/subscription/index.js +5 -5
  327. package/esm2015/domain/users/models/subscription/payment.js +14 -14
  328. package/esm2015/domain/users/models/subscription/subscription.js +43 -43
  329. package/esm2015/domain/users/models/user-address.js +7 -7
  330. package/esm2015/domain/users/models/user-payment-method.js +7 -7
  331. package/esm2015/domain/users/models/user.js +26 -26
  332. package/esm2015/domain/users/repositories/beauty-profile.repository.js +2 -2
  333. package/esm2015/domain/users/repositories/edition.repository.js +2 -2
  334. package/esm2015/domain/users/repositories/index.js +9 -9
  335. package/esm2015/domain/users/repositories/lead.repository.js +2 -2
  336. package/esm2015/domain/users/repositories/subscription-payment.repository.js +2 -2
  337. package/esm2015/domain/users/repositories/subscription.repository.js +2 -2
  338. package/esm2015/domain/users/repositories/user-address.repository.js +2 -2
  339. package/esm2015/domain/users/repositories/user-payment-method.repository.js +2 -2
  340. package/esm2015/domain/users/repositories/user.repository.js +2 -2
  341. package/esm2015/domain/users/services/authentication.service.js +2 -2
  342. package/esm2015/domain/users/services/index.js +4 -4
  343. package/esm2015/domain/users/services/register.service.js +2 -2
  344. package/esm2015/domain/users/services/types/basic-user-data.type.js +2 -2
  345. package/esm2015/domain/users/services/types/index.js +2 -2
  346. package/esm2015/domain/users/use-cases/authentication.js +40 -40
  347. package/esm2015/domain/users/use-cases/index.js +5 -5
  348. package/esm2015/domain/users/use-cases/recovery-password.js +12 -12
  349. package/esm2015/domain/users/use-cases/register.js +34 -34
  350. package/esm2015/domain/users/use-cases/signout.js +12 -12
  351. package/esm2015/errors/duplicated-results.error.js +7 -7
  352. package/esm2015/errors/index.js +5 -5
  353. package/esm2015/errors/invalid-argument.error.js +7 -7
  354. package/esm2015/errors/not-found.error.js +7 -7
  355. package/esm2015/errors/required-argument.error.js +8 -8
  356. package/esm2015/index.js +6 -6
  357. package/esm2015/infra/elasticsearch/adapters/axios.adapter.js +22 -22
  358. package/esm2015/infra/elasticsearch/adapters/elastic-search.adapter.js +2 -2
  359. package/esm2015/infra/elasticsearch/adapters/index.js +3 -3
  360. package/esm2015/infra/elasticsearch/index.js +4 -4
  361. package/esm2015/infra/elasticsearch/indexes/index.js +2 -2
  362. package/esm2015/infra/elasticsearch/indexes/products-index.js +59 -59
  363. package/esm2015/infra/elasticsearch/types/elastic-search-result.js +2 -2
  364. package/esm2015/infra/elasticsearch/types/index.js +2 -2
  365. package/esm2015/infra/firebase/auth/authentication-firebase-auth.service.js +52 -52
  366. package/esm2015/infra/firebase/auth/index.js +3 -3
  367. package/esm2015/infra/firebase/auth/register-firebase-auth.service.js +26 -27
  368. package/esm2015/infra/firebase/auth/types/firebase-user-with-id.type.js +2 -2
  369. package/esm2015/infra/firebase/firestore/index.js +4 -4
  370. package/esm2015/infra/firebase/firestore/mixins/index.js +10 -10
  371. package/esm2015/infra/firebase/firestore/mixins/with-create-firestore.mixin.js +31 -33
  372. package/esm2015/infra/firebase/firestore/mixins/with-crud-firestore.mixin.js +10 -10
  373. package/esm2015/infra/firebase/firestore/mixins/with-delete-firestore.mixin.js +18 -17
  374. package/esm2015/infra/firebase/firestore/mixins/with-find-firestore.mixin.js +87 -93
  375. package/esm2015/infra/firebase/firestore/mixins/with-firestore.mixin.js +26 -26
  376. package/esm2015/infra/firebase/firestore/mixins/with-get-firestore.mixin.js +24 -23
  377. package/esm2015/infra/firebase/firestore/mixins/with-helpers.mixin.js +17 -17
  378. package/esm2015/infra/firebase/firestore/mixins/with-sub-collection.mixin.js +11 -11
  379. package/esm2015/infra/firebase/firestore/mixins/with-update-firestore.mixin.js +45 -44
  380. package/esm2015/infra/firebase/firestore/models/user-search.js +7 -7
  381. package/esm2015/infra/firebase/firestore/repositories/catalog/category-firestore.repository.js +70 -52
  382. package/esm2015/infra/firebase/firestore/repositories/catalog/index.js +5 -5
  383. package/esm2015/infra/firebase/firestore/repositories/catalog/product-firestore.repository.js +23 -23
  384. package/esm2015/infra/firebase/firestore/repositories/catalog/product-variant-firestore.repository.js +14 -14
  385. package/esm2015/infra/firebase/firestore/repositories/catalog/subscription-product-firestore.repository.js +12 -12
  386. package/esm2015/infra/firebase/firestore/repositories/index.js +5 -5
  387. package/esm2015/infra/firebase/firestore/repositories/shop-settings/home-firestore.repository.js +56 -56
  388. package/esm2015/infra/firebase/firestore/repositories/shop-settings/index.js +3 -3
  389. package/esm2015/infra/firebase/firestore/repositories/shop-settings/shop-menu-firestore.repository.js +12 -12
  390. package/esm2015/infra/firebase/firestore/repositories/shopping/buy-2-win-firestore.repository.js +12 -12
  391. package/esm2015/infra/firebase/firestore/repositories/shopping/checkout-firestore.repository.js +12 -12
  392. package/esm2015/infra/firebase/firestore/repositories/shopping/checkout-subscription-firestore.repository.js +12 -12
  393. package/esm2015/infra/firebase/firestore/repositories/shopping/coupon-firestore.repository.js +29 -29
  394. package/esm2015/infra/firebase/firestore/repositories/shopping/index.js +9 -9
  395. package/esm2015/infra/firebase/firestore/repositories/shopping/legacy-order-firestore.repository.js +9 -9
  396. package/esm2015/infra/firebase/firestore/repositories/shopping/order-firestore.repository.js +12 -12
  397. package/esm2015/infra/firebase/firestore/repositories/shopping/payment-firestore.repository.js +12 -12
  398. package/esm2015/infra/firebase/firestore/repositories/shopping/subscription-plan-firestore.repository.js +12 -12
  399. package/esm2015/infra/firebase/firestore/repositories/users/index.js +10 -10
  400. package/esm2015/infra/firebase/firestore/repositories/users/lead-firestore.repository.js +12 -12
  401. package/esm2015/infra/firebase/firestore/repositories/users/subscription-edition-firestore.repository.js +14 -14
  402. package/esm2015/infra/firebase/firestore/repositories/users/subscription-firestore.repository.js +12 -12
  403. package/esm2015/infra/firebase/firestore/repositories/users/subscription-payment-firestore.repository.js +14 -14
  404. package/esm2015/infra/firebase/firestore/repositories/users/user-address-firestore.repository.js +14 -14
  405. package/esm2015/infra/firebase/firestore/repositories/users/user-beauty-profile-firestore.repository.js +14 -14
  406. package/esm2015/infra/firebase/firestore/repositories/users/user-firestore.repository.js +70 -62
  407. package/esm2015/infra/firebase/firestore/repositories/users/user-payment-method-firestore.repository.js +14 -14
  408. package/esm2015/infra/firebase/firestore/repositories/users/user-search-firestore.repository.js +12 -12
  409. package/esm2015/infra/firebase/firestore/types/firestore-sub.repository.type.js +2 -2
  410. package/esm2015/infra/firebase/firestore/types/firestore.helpers.type.js +2 -2
  411. package/esm2015/infra/firebase/firestore/types/firestore.repository.type.js +2 -2
  412. package/esm2015/infra/firebase/firestore/types/index.js +4 -4
  413. package/esm2015/infra/firebase/index.js +3 -3
  414. package/esm2015/infra/index.js +3 -3
  415. package/esm2015/infrab4a-connect.js +4 -4
  416. package/esm2015/utils/index.js +6 -7
  417. package/esm2015/utils/mixins/base.mixin.js +6 -6
  418. package/esm2015/utils/mixins/index.js +3 -3
  419. package/esm2015/utils/mixins/mixin-ctor.type.js +2 -2
  420. package/esm2015/utils/types/index.js +2 -2
  421. package/esm2015/utils/types/prop.type.js +2 -2
  422. package/fesm2015/infrab4a-connect.js +1662 -1639
  423. package/fesm2015/infrab4a-connect.js.map +1 -1
  424. package/index.d.ts +5 -5
  425. package/infra/elasticsearch/adapters/axios.adapter.d.ts +11 -11
  426. package/infra/elasticsearch/adapters/elastic-search.adapter.d.ts +4 -4
  427. package/infra/elasticsearch/adapters/index.d.ts +2 -2
  428. package/infra/elasticsearch/index.d.ts +3 -3
  429. package/infra/elasticsearch/indexes/index.d.ts +1 -1
  430. package/infra/elasticsearch/indexes/products-index.d.ts +11 -11
  431. package/infra/elasticsearch/types/elastic-search-result.d.ts +7 -7
  432. package/infra/elasticsearch/types/index.d.ts +1 -1
  433. package/infra/firebase/auth/authentication-firebase-auth.service.d.ts +12 -12
  434. package/infra/firebase/auth/index.d.ts +2 -2
  435. package/infra/firebase/auth/register-firebase-auth.service.d.ts +8 -8
  436. package/infra/firebase/auth/types/firebase-user-with-id.type.d.ts +3 -4
  437. package/infra/firebase/firestore/index.d.ts +3 -3
  438. package/infra/firebase/firestore/mixins/index.d.ts +9 -9
  439. package/infra/firebase/firestore/mixins/with-create-firestore.mixin.d.ts +17 -17
  440. package/infra/firebase/firestore/mixins/with-crud-firestore.mixin.d.ts +29 -29
  441. package/infra/firebase/firestore/mixins/with-delete-firestore.mixin.d.ts +15 -15
  442. package/infra/firebase/firestore/mixins/with-find-firestore.mixin.d.ts +20 -20
  443. package/infra/firebase/firestore/mixins/with-firestore.mixin.d.ts +15 -15
  444. package/infra/firebase/firestore/mixins/with-get-firestore.mixin.d.ts +15 -15
  445. package/infra/firebase/firestore/mixins/with-helpers.mixin.d.ts +10 -10
  446. package/infra/firebase/firestore/mixins/with-sub-collection.mixin.d.ts +14 -14
  447. package/infra/firebase/firestore/mixins/with-update-firestore.mixin.d.ts +16 -16
  448. package/infra/firebase/firestore/models/user-search.d.ts +9 -9
  449. package/infra/firebase/firestore/repositories/catalog/category-firestore.repository.d.ts +58 -60
  450. package/infra/firebase/firestore/repositories/catalog/index.d.ts +4 -4
  451. package/infra/firebase/firestore/repositories/catalog/product-firestore.repository.d.ts +50 -50
  452. package/infra/firebase/firestore/repositories/catalog/product-variant-firestore.repository.d.ts +60 -60
  453. package/infra/firebase/firestore/repositories/catalog/subscription-product-firestore.repository.d.ts +49 -49
  454. package/infra/firebase/firestore/repositories/index.d.ts +4 -4
  455. package/infra/firebase/firestore/repositories/shop-settings/home-firestore.repository.d.ts +57 -57
  456. package/infra/firebase/firestore/repositories/shop-settings/index.d.ts +2 -2
  457. package/infra/firebase/firestore/repositories/shop-settings/shop-menu-firestore.repository.d.ts +49 -49
  458. package/infra/firebase/firestore/repositories/shopping/buy-2-win-firestore.repository.d.ts +49 -49
  459. package/infra/firebase/firestore/repositories/shopping/checkout-firestore.repository.d.ts +49 -49
  460. package/infra/firebase/firestore/repositories/shopping/checkout-subscription-firestore.repository.d.ts +49 -49
  461. package/infra/firebase/firestore/repositories/shopping/coupon-firestore.repository.d.ts +53 -53
  462. package/infra/firebase/firestore/repositories/shopping/index.d.ts +8 -8
  463. package/infra/firebase/firestore/repositories/shopping/legacy-order-firestore.repository.d.ts +7 -7
  464. package/infra/firebase/firestore/repositories/shopping/order-firestore.repository.d.ts +49 -49
  465. package/infra/firebase/firestore/repositories/shopping/payment-firestore.repository.d.ts +49 -49
  466. package/infra/firebase/firestore/repositories/shopping/subscription-plan-firestore.repository.d.ts +49 -49
  467. package/infra/firebase/firestore/repositories/users/index.d.ts +9 -9
  468. package/infra/firebase/firestore/repositories/users/lead-firestore.repository.d.ts +49 -49
  469. package/infra/firebase/firestore/repositories/users/subscription-edition-firestore.repository.d.ts +60 -60
  470. package/infra/firebase/firestore/repositories/users/subscription-firestore.repository.d.ts +49 -49
  471. package/infra/firebase/firestore/repositories/users/subscription-payment-firestore.repository.d.ts +60 -60
  472. package/infra/firebase/firestore/repositories/users/user-address-firestore.repository.d.ts +60 -60
  473. package/infra/firebase/firestore/repositories/users/user-beauty-profile-firestore.repository.d.ts +60 -60
  474. package/infra/firebase/firestore/repositories/users/user-firestore.repository.d.ts +60 -60
  475. package/infra/firebase/firestore/repositories/users/user-payment-method-firestore.repository.d.ts +60 -60
  476. package/infra/firebase/firestore/repositories/users/user-search-firestore.repository.d.ts +50 -50
  477. package/infra/firebase/firestore/types/firestore-sub.repository.type.d.ts +6 -6
  478. package/infra/firebase/firestore/types/firestore.helpers.type.d.ts +8 -8
  479. package/infra/firebase/firestore/types/firestore.repository.type.d.ts +8 -8
  480. package/infra/firebase/firestore/types/index.d.ts +3 -3
  481. package/infra/firebase/index.d.ts +2 -2
  482. package/infra/index.d.ts +2 -2
  483. package/infrab4a-connect.d.ts +5 -5
  484. package/package.json +2 -2
  485. package/utils/index.d.ts +6 -6
  486. package/utils/mixins/base.mixin.d.ts +3 -3
  487. package/utils/mixins/index.d.ts +2 -2
  488. package/utils/mixins/mixin-ctor.type.d.ts +1 -1
  489. package/utils/types/index.d.ts +1 -1
  490. package/utils/types/prop.type.d.ts +1 -1
  491. package/domain/shopping/models/coupons/financial-coupon.d.ts +0 -9
  492. package/esm2015/domain/shopping/models/coupons/financial-coupon.js +0 -28
@@ -1,2583 +1,2626 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('reflect-metadata'), require('class-transformer'), require('date-fns'), require('lodash'), require('ts-md5'), require('axios'), require('firebase/firestore'), require('firebase/auth')) :
3
- typeof define === 'function' && define.amd ? define('@infrab4a/connect', ['exports', 'reflect-metadata', 'class-transformer', 'date-fns', 'lodash', 'ts-md5', 'axios', 'firebase/firestore', 'firebase/auth'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.infrab4a = global.infrab4a || {}, global.infrab4a.connect = {}), null, global["class-transformer"], global["date-fns"], global.lodash, global.tsMd5, global.axios, global.firestore, global.auth));
5
- })(this, (function (exports, reflectMetadata, classTransformer, dateFns, lodash, tsMd5, axios, firestore, auth) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('reflect-metadata'), require('class-transformer'), require('date-fns'), require('lodash'), require('axios'), require('firebase'), require('firebase/app')) :
3
+ typeof define === 'function' && define.amd ? define('@infrab4a/connect', ['exports', 'reflect-metadata', 'class-transformer', 'date-fns', 'lodash', 'axios', '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["date-fns"], global.lodash, global.axios, global.firebase, global.firebase$1));
5
+ })(this, (function (exports, reflectMetadata, classTransformer, dateFns, lodash, axios, 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
- var lodash__default = /*#__PURE__*/_interopDefaultLegacy(lodash);
10
9
  var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
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;
10
+ var firebase__default = /*#__PURE__*/_interopDefaultLegacy(firebase);
11
+ var firebase__default$1 = /*#__PURE__*/_interopDefaultLegacy(firebase$1);
12
+
13
+ var BaseModel = /** @class */ (function () {
14
+ function BaseModel(args) {
15
+ Object.assign(this, args);
16
+ }
17
+ BaseModel.toInstance = function (data) {
18
+ return classTransformer.plainToClass(this, data);
19
+ };
20
+ BaseModel.prototype.toPlain = function () {
21
+ return classTransformer.classToPlain(this, { exposeUnsetFields: false });
22
+ };
23
+ return BaseModel;
23
24
  }());
24
25
 
25
- exports.Where = void 0;
26
- (function (Where) {
27
- Where["EQUALS"] = "==";
28
- Where["NOTEQUALS"] = "!=";
29
- Where["GT"] = ">";
30
- Where["GTE"] = ">=";
31
- Where["IN"] = "in";
32
- Where["LT"] = "<";
33
- Where["LTE"] = "<=";
34
- Where["LIKE"] = "like";
26
+ exports.Where = void 0;
27
+ (function (Where) {
28
+ Where["EQUALS"] = "==";
29
+ Where["NOTEQUALS"] = "!=";
30
+ Where["GT"] = ">";
31
+ Where["GTE"] = ">=";
32
+ Where["IN"] = "in";
33
+ Where["LT"] = "<";
34
+ Where["LTE"] = "<=";
35
+ Where["LIKE"] = "like";
35
36
  })(exports.Where || (exports.Where = {}));
36
37
 
37
- exports.UpdateOptionActions = void 0;
38
- (function (UpdateOptionActions) {
39
- UpdateOptionActions["UPDATE"] = "update";
40
- UpdateOptionActions["MERGE"] = "merge";
41
- UpdateOptionActions["REMOVE"] = "remove";
42
- UpdateOptionActions["REMOVE_FIELD"] = "removeField";
43
- UpdateOptionActions["NULL"] = "null";
38
+ exports.UpdateOptionActions = void 0;
39
+ (function (UpdateOptionActions) {
40
+ UpdateOptionActions["UPDATE"] = "update";
41
+ UpdateOptionActions["MERGE"] = "merge";
42
+ UpdateOptionActions["REMOVE"] = "remove";
43
+ UpdateOptionActions["REMOVE_FIELD"] = "removeField";
44
+ UpdateOptionActions["NULL"] = "null";
44
45
  })(exports.UpdateOptionActions || (exports.UpdateOptionActions = {}));
45
46
 
46
- exports.AccessoryImportances = void 0;
47
- (function (AccessoryImportances) {
48
- AccessoryImportances["NOT_INTERESTED"] = "N\u00E3o tenho interesse";
49
- AccessoryImportances["LIKE_RARELY_USE"] = "Gosto, mas uso poucos";
50
- AccessoryImportances["LIKE_ALWAYS_FOLLOW_FASHION"] = "Gosto muito de acess\u00F3rios e sempre procuro acompanhar a moda";
47
+ exports.AccessoryImportances = void 0;
48
+ (function (AccessoryImportances) {
49
+ AccessoryImportances["NOT_INTERESTED"] = "N\u00E3o tenho interesse";
50
+ AccessoryImportances["LIKE_RARELY_USE"] = "Gosto, mas uso poucos";
51
+ AccessoryImportances["LIKE_ALWAYS_FOLLOW_FASHION"] = "Gosto muito de acess\u00F3rios e sempre procuro acompanhar a moda";
51
52
  })(exports.AccessoryImportances || (exports.AccessoryImportances = {}));
52
53
 
53
- exports.Area = void 0;
54
- (function (Area) {
55
- Area["GP"] = "Geral";
56
- Area["CRM"] = "CRM";
57
- Area["MediaProd"] = "Media Production";
58
- Area["Tech"] = "Tecnologia";
59
- Area["Transactional"] = "Transacional";
60
- Area["Operations"] = "Opera\u00E7\u00F5es";
61
- Area["Sales"] = "Comercial";
62
- Area["Finantial"] = "Financeiro";
63
- Area["HR"] = "RH";
54
+ exports.Area = void 0;
55
+ (function (Area) {
56
+ Area["GP"] = "Geral";
57
+ Area["CRM"] = "CRM";
58
+ Area["MediaProd"] = "Media Production";
59
+ Area["Tech"] = "Tecnologia";
60
+ Area["Transactional"] = "Transacional";
61
+ Area["Operations"] = "Opera\u00E7\u00F5es";
62
+ Area["Sales"] = "Comercial";
63
+ Area["Finantial"] = "Financeiro";
64
+ Area["HR"] = "RH";
64
65
  })(exports.Area || (exports.Area = {}));
65
66
 
66
- exports.BeardProblems = void 0;
67
- (function (BeardProblems) {
68
- BeardProblems["NO_PROBLEMS"] = "Sem problemas";
69
- BeardProblems["DRY"] = "Barba Seca";
70
- BeardProblems["OILY"] = "Barba Oleaosa";
71
- BeardProblems["DANCRUFF"] = "Barba com Caspa";
72
- BeardProblems["INGROWN_HAIRS"] = "P\u00EAlos Encravados";
73
- BeardProblems["DOESNT_GROW"] = "N\u00E3o Cresce";
74
- BeardProblems["SPARSE_BEARD"] = "Barba Rala";
67
+ exports.BeardProblems = void 0;
68
+ (function (BeardProblems) {
69
+ BeardProblems["NO_PROBLEMS"] = "Sem problemas";
70
+ BeardProblems["DRY"] = "Barba Seca";
71
+ BeardProblems["OILY"] = "Barba Oleaosa";
72
+ BeardProblems["DANCRUFF"] = "Barba com Caspa";
73
+ BeardProblems["INGROWN_HAIRS"] = "P\u00EAlos Encravados";
74
+ BeardProblems["DOESNT_GROW"] = "N\u00E3o Cresce";
75
+ BeardProblems["SPARSE_BEARD"] = "Barba Rala";
75
76
  })(exports.BeardProblems || (exports.BeardProblems = {}));
76
77
 
77
- exports.BeardSizes = void 0;
78
- (function (BeardSizes) {
79
- BeardSizes["BIG"] = "Grande";
80
- BeardSizes["MEDIUM"] = "M\u00E9dia";
81
- BeardSizes["SHORT"] = "Curta";
82
- BeardSizes["MUSTACHE"] = "Bigode";
83
- BeardSizes["NOTHING"] = "Sem Barba";
78
+ exports.BeardSizes = void 0;
79
+ (function (BeardSizes) {
80
+ BeardSizes["BIG"] = "Grande";
81
+ BeardSizes["MEDIUM"] = "M\u00E9dia";
82
+ BeardSizes["SHORT"] = "Curta";
83
+ BeardSizes["MUSTACHE"] = "Bigode";
84
+ BeardSizes["NOTHING"] = "Sem Barba";
84
85
  })(exports.BeardSizes || (exports.BeardSizes = {}));
85
86
 
86
- exports.BeautyProductImportances = void 0;
87
- (function (BeautyProductImportances) {
88
- BeautyProductImportances["KNOW_LITTLE_ABOUT"] = "Conhe\u00E7o bem pouco de produtos de beleza e rotinas de cuidados";
89
- BeautyProductImportances["ALREADY_BOUGHT_NOTHING_SPECIALIZED"] = "J\u00E1 comprei alguns produtos b\u00E1sicos para cuidar de mim, mas nada muito especializado";
90
- BeautyProductImportances["GOOD_CARE_MYSELF"] = "Me considero um homem que se cuida bem. Conhe\u00E7o sobre produtos especializados e me preocupo em ter uma rotina de cuidados";
91
- BeautyProductImportances["PERSONAL_CARE_EXPERT"] = "Sou um expert em cuidados pessoais";
87
+ exports.BeautyProductImportances = void 0;
88
+ (function (BeautyProductImportances) {
89
+ BeautyProductImportances["KNOW_LITTLE_ABOUT"] = "Conhe\u00E7o bem pouco de produtos de beleza e rotinas de cuidados";
90
+ BeautyProductImportances["ALREADY_BOUGHT_NOTHING_SPECIALIZED"] = "J\u00E1 comprei alguns produtos b\u00E1sicos para cuidar de mim, mas nada muito especializado";
91
+ BeautyProductImportances["GOOD_CARE_MYSELF"] = "Me considero um homem que se cuida bem. Conhe\u00E7o sobre produtos especializados e me preocupo em ter uma rotina de cuidados";
92
+ BeautyProductImportances["PERSONAL_CARE_EXPERT"] = "Sou um expert em cuidados pessoais";
92
93
  })(exports.BeautyProductImportances || (exports.BeautyProductImportances = {}));
93
94
 
94
- exports.BodyProblems = void 0;
95
- (function (BodyProblems) {
96
- BodyProblems["NO_WORRIES"] = "Sem preocupa\u00E7\u00F5es";
97
- BodyProblems["FLACCIDITY"] = "Flacidez";
98
- BodyProblems["LOCALIZED_FAT"] = "Gordura Localizada";
99
- BodyProblems["STRETCH_MARKS"] = "Estrias";
100
- BodyProblems["SENSITIVE_SKIN"] = "Pele Sens\u00EDvel";
101
- BodyProblems["DRY_SKIN"] = "Pele Seca";
102
- BodyProblems["OILY_ACNE"] = "Oleosa/Acne";
103
- BodyProblems["SKIN_FRECKLES"] = "Pele com Sardas";
104
- BodyProblems["PHOTOSENSITIVE_SKIN"] = "Pele Fotossens\u00EDvel";
95
+ exports.BodyProblems = void 0;
96
+ (function (BodyProblems) {
97
+ BodyProblems["NO_WORRIES"] = "Sem preocupa\u00E7\u00F5es";
98
+ BodyProblems["FLACCIDITY"] = "Flacidez";
99
+ BodyProblems["LOCALIZED_FAT"] = "Gordura Localizada";
100
+ BodyProblems["STRETCH_MARKS"] = "Estrias";
101
+ BodyProblems["SENSITIVE_SKIN"] = "Pele Sens\u00EDvel";
102
+ BodyProblems["DRY_SKIN"] = "Pele Seca";
103
+ BodyProblems["OILY_ACNE"] = "Oleosa/Acne";
104
+ BodyProblems["SKIN_FRECKLES"] = "Pele com Sardas";
105
+ BodyProblems["PHOTOSENSITIVE_SKIN"] = "Pele Fotossens\u00EDvel";
105
106
  })(exports.BodyProblems || (exports.BodyProblems = {}));
106
107
 
107
- exports.BodyShapes = void 0;
108
- (function (BodyShapes) {
109
- BodyShapes["LEAN"] = "Magro";
110
- BodyShapes["REGULAR"] = "Regular";
111
- BodyShapes["OVERWEIGHT"] = "Acima do Peso";
112
- BodyShapes["ATHLETIC"] = "Atl\u00E9tico";
113
- BodyShapes["MUSCULAR"] = "Musculoso";
108
+ exports.BodyShapes = void 0;
109
+ (function (BodyShapes) {
110
+ BodyShapes["LEAN"] = "Magro";
111
+ BodyShapes["REGULAR"] = "Regular";
112
+ BodyShapes["OVERWEIGHT"] = "Acima do Peso";
113
+ BodyShapes["ATHLETIC"] = "Atl\u00E9tico";
114
+ BodyShapes["MUSCULAR"] = "Musculoso";
114
115
  })(exports.BodyShapes || (exports.BodyShapes = {}));
115
116
 
116
- exports.BodyTattoos = void 0;
117
- (function (BodyTattoos) {
118
- BodyTattoos["NONE"] = "Nenhuma";
119
- BodyTattoos["HAS_DOESNT_CARE"] = "Tenho mas n\u00E3o cuido";
120
- BodyTattoos["HAS_CARE_LOT"] = "Tenho e cuido bastante";
117
+ exports.BodyTattoos = void 0;
118
+ (function (BodyTattoos) {
119
+ BodyTattoos["NONE"] = "Nenhuma";
120
+ BodyTattoos["HAS_DOESNT_CARE"] = "Tenho mas n\u00E3o cuido";
121
+ BodyTattoos["HAS_CARE_LOT"] = "Tenho e cuido bastante";
121
122
  })(exports.BodyTattoos || (exports.BodyTattoos = {}));
122
123
 
123
- exports.FaceSkinOilinesses = void 0;
124
- (function (FaceSkinOilinesses) {
125
- FaceSkinOilinesses["DRY"] = "Seca";
126
- FaceSkinOilinesses["OILY"] = "Oleaosa";
127
- FaceSkinOilinesses["MIXED"] = "Mista";
128
- FaceSkinOilinesses["NORMAL"] = "Normal";
129
- FaceSkinOilinesses["DONT_KNOW"] = "Eu n\u00E3o sei como dizer";
124
+ exports.FaceSkinOilinesses = void 0;
125
+ (function (FaceSkinOilinesses) {
126
+ FaceSkinOilinesses["DRY"] = "Seca";
127
+ FaceSkinOilinesses["OILY"] = "Oleaosa";
128
+ FaceSkinOilinesses["MIXED"] = "Mista";
129
+ FaceSkinOilinesses["NORMAL"] = "Normal";
130
+ FaceSkinOilinesses["DONT_KNOW"] = "Eu n\u00E3o sei como dizer";
130
131
  })(exports.FaceSkinOilinesses || (exports.FaceSkinOilinesses = {}));
131
132
 
132
- exports.FaceSkinProblems = void 0;
133
- (function (FaceSkinProblems) {
134
- FaceSkinProblems["NO_PROBLEMS"] = "Sem problemas";
135
- FaceSkinProblems["DARK_CIRCLES"] = "Olheiras";
136
- FaceSkinProblems["WRINKLES"] = "Rugas";
137
- FaceSkinProblems["BLACKHEADS_PIMPLES"] = "Cravos e Espinhas";
138
- FaceSkinProblems["STAINS"] = "Manchas";
139
- FaceSkinProblems["FRECKLES"] = "Sardas";
140
- FaceSkinProblems["SENSITIVE"] = "Sens\u00EDvel";
141
- FaceSkinProblems["PHOTOSENSITIVE"] = "Fotossens\u00EDvel";
133
+ exports.FaceSkinProblems = void 0;
134
+ (function (FaceSkinProblems) {
135
+ FaceSkinProblems["NO_PROBLEMS"] = "Sem problemas";
136
+ FaceSkinProblems["DARK_CIRCLES"] = "Olheiras";
137
+ FaceSkinProblems["WRINKLES"] = "Rugas";
138
+ FaceSkinProblems["BLACKHEADS_PIMPLES"] = "Cravos e Espinhas";
139
+ FaceSkinProblems["STAINS"] = "Manchas";
140
+ FaceSkinProblems["FRECKLES"] = "Sardas";
141
+ FaceSkinProblems["SENSITIVE"] = "Sens\u00EDvel";
142
+ FaceSkinProblems["PHOTOSENSITIVE"] = "Fotossens\u00EDvel";
142
143
  })(exports.FaceSkinProblems || (exports.FaceSkinProblems = {}));
143
144
 
144
- exports.FaceSkinTones = void 0;
145
- (function (FaceSkinTones) {
146
- FaceSkinTones["VERY_CLEAR"] = "Muito Clara";
147
- FaceSkinTones["CLEAR"] = "Clara";
148
- FaceSkinTones["MEDIUM_LIGHT"] = "Clara M\u00E9dia";
149
- FaceSkinTones["MEDIUM_DARK"] = "Escura M\u00E9dia";
150
- FaceSkinTones["DARK"] = "Escura";
151
- FaceSkinTones["VERY_DARK"] = "Muito Escura";
145
+ exports.FaceSkinTones = void 0;
146
+ (function (FaceSkinTones) {
147
+ FaceSkinTones["VERY_CLEAR"] = "Muito Clara";
148
+ FaceSkinTones["CLEAR"] = "Clara";
149
+ FaceSkinTones["MEDIUM_LIGHT"] = "Clara M\u00E9dia";
150
+ FaceSkinTones["MEDIUM_DARK"] = "Escura M\u00E9dia";
151
+ FaceSkinTones["DARK"] = "Escura";
152
+ FaceSkinTones["VERY_DARK"] = "Muito Escura";
152
153
  })(exports.FaceSkinTones || (exports.FaceSkinTones = {}));
153
154
 
154
- exports.FamilyIncomes = void 0;
155
- (function (FamilyIncomes) {
156
- FamilyIncomes["UNTIL_3000"] = "At\u00E9 R$3.000";
157
- FamilyIncomes["SINCE_3001_TO_7000"] = "De R$3.001 a R$7.000";
158
- FamilyIncomes["SINCE_7001_TO_10000"] = "De R$7.001 a R$10.000";
159
- FamilyIncomes["SINCE_10001_TO_15000"] = "De R$10.001 a R$15.000";
160
- FamilyIncomes["GRAN_THAN_15000"] = "Mais de R$15.000";
161
- FamilyIncomes["NOW_ANSWER"] = "Prefiro nao responder";
155
+ exports.FamilyIncomes = void 0;
156
+ (function (FamilyIncomes) {
157
+ FamilyIncomes["UNTIL_3000"] = "At\u00E9 R$3.000";
158
+ FamilyIncomes["SINCE_3001_TO_7000"] = "De R$3.001 a R$7.000";
159
+ FamilyIncomes["SINCE_7001_TO_10000"] = "De R$7.001 a R$10.000";
160
+ FamilyIncomes["SINCE_10001_TO_15000"] = "De R$10.001 a R$15.000";
161
+ FamilyIncomes["GRAN_THAN_15000"] = "Mais de R$15.000";
162
+ FamilyIncomes["NOW_ANSWER"] = "Prefiro nao responder";
162
163
  })(exports.FamilyIncomes || (exports.FamilyIncomes = {}));
163
164
 
164
- exports.FragranceImportances = void 0;
165
- (function (FragranceImportances) {
166
- FragranceImportances["NOT_INTERESTED"] = "N\u00E3o tenho interesse";
167
- FragranceImportances["LIKE_ALWAYS_USE_SAME"] = "Gosto de perfumes, mas uso sempre os mesmos";
168
- FragranceImportances["LIKE_INNOVATE"] = "Gosto de inovar e conhecer novas fragr\u00E2ncias";
165
+ exports.FragranceImportances = void 0;
166
+ (function (FragranceImportances) {
167
+ FragranceImportances["NOT_INTERESTED"] = "N\u00E3o tenho interesse";
168
+ FragranceImportances["LIKE_ALWAYS_USE_SAME"] = "Gosto de perfumes, mas uso sempre os mesmos";
169
+ FragranceImportances["LIKE_INNOVATE"] = "Gosto de inovar e conhecer novas fragr\u00E2ncias";
169
170
  })(exports.FragranceImportances || (exports.FragranceImportances = {}));
170
171
 
171
- exports.HairColors = void 0;
172
- (function (HairColors) {
173
- HairColors["BLACK"] = "Preto";
174
- HairColors["DARK_BROWN"] = "Castanho Escuro";
175
- HairColors["LIGHT_BROWN"] = "Castanho Claro";
176
- HairColors["DARK_BLONDE"] = "Loiro Escuro";
177
- HairColors["LIGHT_BLONDE"] = "Loiro Claro";
178
- HairColors["WHITE_GRAY"] = "Branco/Grisalho";
179
- HairColors["REDHEAD"] = "Ruivo";
180
- HairColors["OTHER"] = "RuiOutroo";
172
+ exports.HairColors = void 0;
173
+ (function (HairColors) {
174
+ HairColors["BLACK"] = "Preto";
175
+ HairColors["DARK_BROWN"] = "Castanho Escuro";
176
+ HairColors["LIGHT_BROWN"] = "Castanho Claro";
177
+ HairColors["DARK_BLONDE"] = "Loiro Escuro";
178
+ HairColors["LIGHT_BLONDE"] = "Loiro Claro";
179
+ HairColors["WHITE_GRAY"] = "Branco/Grisalho";
180
+ HairColors["REDHEAD"] = "Ruivo";
181
+ HairColors["OTHER"] = "RuiOutroo";
181
182
  })(exports.HairColors || (exports.HairColors = {}));
182
183
 
183
- exports.HairProblems = void 0;
184
- (function (HairProblems) {
185
- HairProblems["NO_PROBLEMS"] = "Sem problemas";
186
- HairProblems["DANCRUFF"] = "Caspa";
187
- HairProblems["LOSS"] = "Queda";
188
- HairProblems["OILY"] = "Oleosidade";
189
- HairProblems["DRYNESS"] = "Ressecamento";
190
- HairProblems["CHEMICAL"] = "Quimica";
191
- HairProblems["WHITE_HAIR"] = "Cabelos Brancos";
192
- HairProblems["REBEL_WIRES"] = "Fios Rebeldes";
184
+ exports.HairProblems = void 0;
185
+ (function (HairProblems) {
186
+ HairProblems["NO_PROBLEMS"] = "Sem problemas";
187
+ HairProblems["DANCRUFF"] = "Caspa";
188
+ HairProblems["LOSS"] = "Queda";
189
+ HairProblems["OILY"] = "Oleosidade";
190
+ HairProblems["DRYNESS"] = "Ressecamento";
191
+ HairProblems["CHEMICAL"] = "Quimica";
192
+ HairProblems["WHITE_HAIR"] = "Cabelos Brancos";
193
+ HairProblems["REBEL_WIRES"] = "Fios Rebeldes";
193
194
  })(exports.HairProblems || (exports.HairProblems = {}));
194
195
 
195
- exports.HairStrands = void 0;
196
- (function (HairStrands) {
197
- HairStrands["NORMAL"] = "Fio Normal";
198
- HairStrands["DRY"] = "Fio Seco";
199
- HairStrands["OILY"] = "Fio Oleoso";
200
- HairStrands["MIXED"] = "Fio Misto";
201
- HairStrands["FINE"] = "Fio Fino";
202
- HairStrands["THICK"] = "Fio Grosso";
196
+ exports.HairStrands = void 0;
197
+ (function (HairStrands) {
198
+ HairStrands["NORMAL"] = "Fio Normal";
199
+ HairStrands["DRY"] = "Fio Seco";
200
+ HairStrands["OILY"] = "Fio Oleoso";
201
+ HairStrands["MIXED"] = "Fio Misto";
202
+ HairStrands["FINE"] = "Fio Fino";
203
+ HairStrands["THICK"] = "Fio Grosso";
203
204
  })(exports.HairStrands || (exports.HairStrands = {}));
204
205
 
205
- exports.HairTypes = void 0;
206
- (function (HairTypes) {
207
- HairTypes["Smooth"] = "Liso";
208
- HairTypes["WAVY"] = "Ondulado";
209
- HairTypes["CURLY"] = "Cacheado";
210
- HairTypes["FRIZZY"] = "Crespo";
211
- HairTypes["BALD"] = "Sou careca";
206
+ exports.HairTypes = void 0;
207
+ (function (HairTypes) {
208
+ HairTypes["Smooth"] = "Liso";
209
+ HairTypes["WAVY"] = "Ondulado";
210
+ HairTypes["CURLY"] = "Cacheado";
211
+ HairTypes["FRIZZY"] = "Crespo";
212
+ HairTypes["BALD"] = "Sou careca";
212
213
  })(exports.HairTypes || (exports.HairTypes = {}));
213
214
 
214
- exports.OfficePosition = void 0;
215
- (function (OfficePosition) {
216
- OfficePosition["Intern"] = "Estagi\u00E1rio";
217
- OfficePosition["Analyst"] = "Analista";
218
- OfficePosition["Manager"] = "Gerente";
219
- OfficePosition["Director"] = "Diretor";
215
+ exports.OfficePosition = void 0;
216
+ (function (OfficePosition) {
217
+ OfficePosition["Intern"] = "Estagi\u00E1rio";
218
+ OfficePosition["Analyst"] = "Analista";
219
+ OfficePosition["Manager"] = "Gerente";
220
+ OfficePosition["Director"] = "Diretor";
220
221
  })(exports.OfficePosition || (exports.OfficePosition = {}));
221
222
 
222
- exports.ProductSpents = void 0;
223
- (function (ProductSpents) {
224
- ProductSpents["UNTIL_50"] = "At\u00E9 R$50";
225
- ProductSpents["SINCE_51_TO_100"] = "De R$51 a R$100";
226
- ProductSpents["SINCE_101_TO_200"] = "De R$101 a R$200";
227
- ProductSpents["SINCE_201_TO_300"] = "De R$201 a R$300";
228
- ProductSpents["GRAN_THAN_300"] = "Mais de R$300";
229
- ProductSpents["NOW_ANSWER"] = "Prefiro nao responder";
223
+ exports.ProductSpents = void 0;
224
+ (function (ProductSpents) {
225
+ ProductSpents["UNTIL_50"] = "At\u00E9 R$50";
226
+ ProductSpents["SINCE_51_TO_100"] = "De R$51 a R$100";
227
+ ProductSpents["SINCE_101_TO_200"] = "De R$101 a R$200";
228
+ ProductSpents["SINCE_201_TO_300"] = "De R$201 a R$300";
229
+ ProductSpents["GRAN_THAN_300"] = "Mais de R$300";
230
+ ProductSpents["NOW_ANSWER"] = "Prefiro nao responder";
230
231
  })(exports.ProductSpents || (exports.ProductSpents = {}));
231
232
 
232
- exports.UserType = void 0;
233
- (function (UserType) {
234
- UserType["B2C"] = "Cliente Transacional";
235
- UserType["GlamGirl"] = "Glamgirl";
236
- UserType["MensBoy"] = "Mensboy";
237
- UserType["B2B"] = "Company";
238
- UserType["Collaborator"] = "Funcion\u00E1rio";
239
- UserType["Influencer"] = "Influencer";
233
+ exports.UserType = void 0;
234
+ (function (UserType) {
235
+ UserType["B2C"] = "Cliente Transacional";
236
+ UserType["GlamGirl"] = "Glamgirl";
237
+ UserType["MensBoy"] = "Mensboy";
238
+ UserType["B2B"] = "Company";
239
+ UserType["Collaborator"] = "Funcion\u00E1rio";
240
+ UserType["Influencer"] = "Influencer";
240
241
  })(exports.UserType || (exports.UserType = {}));
241
242
 
242
- exports.BillingStatus = void 0;
243
- (function (BillingStatus) {
244
- BillingStatus["PAYED"] = "PAGO";
243
+ exports.BillingStatus = void 0;
244
+ (function (BillingStatus) {
245
+ BillingStatus["PAYED"] = "PAGO";
245
246
  })(exports.BillingStatus || (exports.BillingStatus = {}));
246
247
 
247
- exports.EditionStatus = void 0;
248
- (function (EditionStatus) {
249
- EditionStatus["ALLOCATION_WAITING"] = "Aguardando aloca\u00E7\u00E3o";
250
- EditionStatus["SHIPPED"] = "Enviado";
248
+ exports.EditionStatus = void 0;
249
+ (function (EditionStatus) {
250
+ EditionStatus["ALLOCATION_WAITING"] = "Aguardando aloca\u00E7\u00E3o";
251
+ EditionStatus["SHIPPED"] = "Enviado";
251
252
  })(exports.EditionStatus || (exports.EditionStatus = {}));
252
253
 
253
- exports.PaymentType = void 0;
254
- (function (PaymentType) {
255
- PaymentType["AQUISITION"] = "Aquisi\u00E7\u00E3o";
256
- PaymentType["RENEWAL"] = "Renova\u00E7\u00E3o";
257
- PaymentType["FREIGHT"] = "mudan\u00E7a de endere\u00E7o, Frete";
254
+ exports.PaymentType = void 0;
255
+ (function (PaymentType) {
256
+ PaymentType["AQUISITION"] = "Aquisi\u00E7\u00E3o";
257
+ PaymentType["RENEWAL"] = "Renova\u00E7\u00E3o";
258
+ PaymentType["FREIGHT"] = "mudan\u00E7a de endere\u00E7o, Frete";
258
259
  })(exports.PaymentType || (exports.PaymentType = {}));
259
260
 
260
- exports.Status = void 0;
261
- (function (Status) {
262
- Status["ACTIVE"] = "active";
263
- Status["CANCELLED"] = "Cancelado";
261
+ exports.Status = void 0;
262
+ (function (Status) {
263
+ Status["ACTIVE"] = "active";
264
+ Status["CANCELLED"] = "Cancelado";
264
265
  })(exports.Status || (exports.Status = {}));
265
266
 
266
- /*! *****************************************************************************
267
- Copyright (c) Microsoft Corporation.
268
-
269
- Permission to use, copy, modify, and/or distribute this software for any
270
- purpose with or without fee is hereby granted.
271
-
272
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
273
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
274
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
275
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
276
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
277
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
278
- PERFORMANCE OF THIS SOFTWARE.
279
- ***************************************************************************** */
280
- /* global Reflect, Promise */
281
- var extendStatics = function (d, b) {
282
- extendStatics = Object.setPrototypeOf ||
283
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
284
- function (d, b) { for (var p in b)
285
- if (Object.prototype.hasOwnProperty.call(b, p))
286
- d[p] = b[p]; };
287
- return extendStatics(d, b);
288
- };
289
- function __extends(d, b) {
290
- if (typeof b !== "function" && b !== null)
291
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
292
- extendStatics(d, b);
293
- function __() { this.constructor = d; }
294
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
295
- }
296
- var __assign = function () {
297
- __assign = Object.assign || function __assign(t) {
298
- for (var s, i = 1, n = arguments.length; i < n; i++) {
299
- s = arguments[i];
300
- for (var p in s)
301
- if (Object.prototype.hasOwnProperty.call(s, p))
302
- t[p] = s[p];
303
- }
304
- return t;
305
- };
306
- return __assign.apply(this, arguments);
307
- };
308
- function __rest(s, e) {
309
- var t = {};
310
- for (var p in s)
311
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
312
- t[p] = s[p];
313
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
314
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
315
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
316
- t[p[i]] = s[p[i]];
317
- }
318
- return t;
319
- }
320
- function __decorate(decorators, target, key, desc) {
321
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
322
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
323
- r = Reflect.decorate(decorators, target, key, desc);
324
- else
325
- for (var i = decorators.length - 1; i >= 0; i--)
326
- if (d = decorators[i])
327
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
328
- return c > 3 && r && Object.defineProperty(target, key, r), r;
329
- }
330
- function __param(paramIndex, decorator) {
331
- return function (target, key) { decorator(target, key, paramIndex); };
332
- }
333
- function __metadata(metadataKey, metadataValue) {
334
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
335
- return Reflect.metadata(metadataKey, metadataValue);
336
- }
337
- function __awaiter(thisArg, _arguments, P, generator) {
338
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
339
- return new (P || (P = Promise))(function (resolve, reject) {
340
- function fulfilled(value) { try {
341
- step(generator.next(value));
342
- }
343
- catch (e) {
344
- reject(e);
345
- } }
346
- function rejected(value) { try {
347
- step(generator["throw"](value));
348
- }
349
- catch (e) {
350
- reject(e);
351
- } }
352
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
353
- step((generator = generator.apply(thisArg, _arguments || [])).next());
354
- });
355
- }
356
- function __generator(thisArg, body) {
357
- var _ = { label: 0, sent: function () { if (t[0] & 1)
358
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
359
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
360
- function verb(n) { return function (v) { return step([n, v]); }; }
361
- function step(op) {
362
- if (f)
363
- throw new TypeError("Generator is already executing.");
364
- while (_)
365
- try {
366
- 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)
367
- return t;
368
- if (y = 0, t)
369
- op = [op[0] & 2, t.value];
370
- switch (op[0]) {
371
- case 0:
372
- case 1:
373
- t = op;
374
- break;
375
- case 4:
376
- _.label++;
377
- return { value: op[1], done: false };
378
- case 5:
379
- _.label++;
380
- y = op[1];
381
- op = [0];
382
- continue;
383
- case 7:
384
- op = _.ops.pop();
385
- _.trys.pop();
386
- continue;
387
- default:
388
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
389
- _ = 0;
390
- continue;
391
- }
392
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
393
- _.label = op[1];
394
- break;
395
- }
396
- if (op[0] === 6 && _.label < t[1]) {
397
- _.label = t[1];
398
- t = op;
399
- break;
400
- }
401
- if (t && _.label < t[2]) {
402
- _.label = t[2];
403
- _.ops.push(op);
404
- break;
405
- }
406
- if (t[2])
407
- _.ops.pop();
408
- _.trys.pop();
409
- continue;
410
- }
411
- op = body.call(thisArg, _);
412
- }
413
- catch (e) {
414
- op = [6, e];
415
- y = 0;
416
- }
417
- finally {
418
- f = t = 0;
419
- }
420
- if (op[0] & 5)
421
- throw op[1];
422
- return { value: op[0] ? op[1] : void 0, done: true };
423
- }
424
- }
425
- var __createBinding = Object.create ? (function (o, m, k, k2) {
426
- if (k2 === undefined)
427
- k2 = k;
428
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
429
- }) : (function (o, m, k, k2) {
430
- if (k2 === undefined)
431
- k2 = k;
432
- o[k2] = m[k];
433
- });
434
- function __exportStar(m, o) {
435
- for (var p in m)
436
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
437
- __createBinding(o, m, p);
438
- }
439
- function __values(o) {
440
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
441
- if (m)
442
- return m.call(o);
443
- if (o && typeof o.length === "number")
444
- return {
445
- next: function () {
446
- if (o && i >= o.length)
447
- o = void 0;
448
- return { value: o && o[i++], done: !o };
449
- }
450
- };
451
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
452
- }
453
- function __read(o, n) {
454
- var m = typeof Symbol === "function" && o[Symbol.iterator];
455
- if (!m)
456
- return o;
457
- var i = m.call(o), r, ar = [], e;
458
- try {
459
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
460
- ar.push(r.value);
461
- }
462
- catch (error) {
463
- e = { error: error };
464
- }
465
- finally {
466
- try {
467
- if (r && !r.done && (m = i["return"]))
468
- m.call(i);
469
- }
470
- finally {
471
- if (e)
472
- throw e.error;
473
- }
474
- }
475
- return ar;
476
- }
477
- /** @deprecated */
478
- function __spread() {
479
- for (var ar = [], i = 0; i < arguments.length; i++)
480
- ar = ar.concat(__read(arguments[i]));
481
- return ar;
482
- }
483
- /** @deprecated */
484
- function __spreadArrays() {
485
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
486
- s += arguments[i].length;
487
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
488
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
489
- r[k] = a[j];
490
- return r;
491
- }
492
- function __spreadArray(to, from, pack) {
493
- if (pack || arguments.length === 2)
494
- for (var i = 0, l = from.length, ar; i < l; i++) {
495
- if (ar || !(i in from)) {
496
- if (!ar)
497
- ar = Array.prototype.slice.call(from, 0, i);
498
- ar[i] = from[i];
499
- }
500
- }
501
- return to.concat(ar || Array.prototype.slice.call(from));
502
- }
503
- function __await(v) {
504
- return this instanceof __await ? (this.v = v, this) : new __await(v);
505
- }
506
- function __asyncGenerator(thisArg, _arguments, generator) {
507
- if (!Symbol.asyncIterator)
508
- throw new TypeError("Symbol.asyncIterator is not defined.");
509
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
510
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
511
- function verb(n) { if (g[n])
512
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
513
- function resume(n, v) { try {
514
- step(g[n](v));
515
- }
516
- catch (e) {
517
- settle(q[0][3], e);
518
- } }
519
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
520
- function fulfill(value) { resume("next", value); }
521
- function reject(value) { resume("throw", value); }
522
- function settle(f, v) { if (f(v), q.shift(), q.length)
523
- resume(q[0][0], q[0][1]); }
524
- }
525
- function __asyncDelegator(o) {
526
- var i, p;
527
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
528
- 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; }
529
- }
530
- function __asyncValues(o) {
531
- if (!Symbol.asyncIterator)
532
- throw new TypeError("Symbol.asyncIterator is not defined.");
533
- var m = o[Symbol.asyncIterator], i;
534
- 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);
535
- 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); }); }; }
536
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
537
- }
538
- function __makeTemplateObject(cooked, raw) {
539
- if (Object.defineProperty) {
540
- Object.defineProperty(cooked, "raw", { value: raw });
541
- }
542
- else {
543
- cooked.raw = raw;
544
- }
545
- return cooked;
546
- }
547
- ;
548
- var __setModuleDefault = Object.create ? (function (o, v) {
549
- Object.defineProperty(o, "default", { enumerable: true, value: v });
550
- }) : function (o, v) {
551
- o["default"] = v;
552
- };
553
- function __importStar(mod) {
554
- if (mod && mod.__esModule)
555
- return mod;
556
- var result = {};
557
- if (mod != null)
558
- for (var k in mod)
559
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
560
- __createBinding(result, mod, k);
561
- __setModuleDefault(result, mod);
562
- return result;
563
- }
564
- function __importDefault(mod) {
565
- return (mod && mod.__esModule) ? mod : { default: mod };
566
- }
567
- function __classPrivateFieldGet(receiver, state, kind, f) {
568
- if (kind === "a" && !f)
569
- throw new TypeError("Private accessor was defined without a getter");
570
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
571
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
572
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
573
- }
574
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
575
- if (kind === "m")
576
- throw new TypeError("Private method is not writable");
577
- if (kind === "a" && !f)
578
- throw new TypeError("Private accessor was defined without a setter");
579
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
580
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
581
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
267
+ /*! *****************************************************************************
268
+ Copyright (c) Microsoft Corporation.
269
+
270
+ Permission to use, copy, modify, and/or distribute this software for any
271
+ purpose with or without fee is hereby granted.
272
+
273
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
274
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
275
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
276
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
277
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
278
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
279
+ PERFORMANCE OF THIS SOFTWARE.
280
+ ***************************************************************************** */
281
+ /* global Reflect, Promise */
282
+ var extendStatics = function (d, b) {
283
+ extendStatics = Object.setPrototypeOf ||
284
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
285
+ function (d, b) { for (var p in b)
286
+ if (Object.prototype.hasOwnProperty.call(b, p))
287
+ d[p] = b[p]; };
288
+ return extendStatics(d, b);
289
+ };
290
+ function __extends(d, b) {
291
+ if (typeof b !== "function" && b !== null)
292
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
293
+ extendStatics(d, b);
294
+ function __() { this.constructor = d; }
295
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
296
+ }
297
+ var __assign = function () {
298
+ __assign = Object.assign || function __assign(t) {
299
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
300
+ s = arguments[i];
301
+ for (var p in s)
302
+ if (Object.prototype.hasOwnProperty.call(s, p))
303
+ t[p] = s[p];
304
+ }
305
+ return t;
306
+ };
307
+ return __assign.apply(this, arguments);
308
+ };
309
+ function __rest(s, e) {
310
+ var t = {};
311
+ for (var p in s)
312
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
313
+ t[p] = s[p];
314
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
315
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
316
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
317
+ t[p[i]] = s[p[i]];
318
+ }
319
+ return t;
320
+ }
321
+ function __decorate(decorators, target, key, desc) {
322
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
323
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
324
+ r = Reflect.decorate(decorators, target, key, desc);
325
+ else
326
+ for (var i = decorators.length - 1; i >= 0; i--)
327
+ if (d = decorators[i])
328
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
329
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
330
+ }
331
+ function __param(paramIndex, decorator) {
332
+ return function (target, key) { decorator(target, key, paramIndex); };
333
+ }
334
+ function __metadata(metadataKey, metadataValue) {
335
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
336
+ return Reflect.metadata(metadataKey, metadataValue);
337
+ }
338
+ function __awaiter(thisArg, _arguments, P, generator) {
339
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
340
+ return new (P || (P = Promise))(function (resolve, reject) {
341
+ function fulfilled(value) { try {
342
+ step(generator.next(value));
343
+ }
344
+ catch (e) {
345
+ reject(e);
346
+ } }
347
+ function rejected(value) { try {
348
+ step(generator["throw"](value));
349
+ }
350
+ catch (e) {
351
+ reject(e);
352
+ } }
353
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
354
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
355
+ });
356
+ }
357
+ function __generator(thisArg, body) {
358
+ var _ = { label: 0, sent: function () { if (t[0] & 1)
359
+ throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
360
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
361
+ function verb(n) { return function (v) { return step([n, v]); }; }
362
+ function step(op) {
363
+ if (f)
364
+ throw new TypeError("Generator is already executing.");
365
+ while (_)
366
+ try {
367
+ 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)
368
+ return t;
369
+ if (y = 0, t)
370
+ op = [op[0] & 2, t.value];
371
+ switch (op[0]) {
372
+ case 0:
373
+ case 1:
374
+ t = op;
375
+ break;
376
+ case 4:
377
+ _.label++;
378
+ return { value: op[1], done: false };
379
+ case 5:
380
+ _.label++;
381
+ y = op[1];
382
+ op = [0];
383
+ continue;
384
+ case 7:
385
+ op = _.ops.pop();
386
+ _.trys.pop();
387
+ continue;
388
+ default:
389
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
390
+ _ = 0;
391
+ continue;
392
+ }
393
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
394
+ _.label = op[1];
395
+ break;
396
+ }
397
+ if (op[0] === 6 && _.label < t[1]) {
398
+ _.label = t[1];
399
+ t = op;
400
+ break;
401
+ }
402
+ if (t && _.label < t[2]) {
403
+ _.label = t[2];
404
+ _.ops.push(op);
405
+ break;
406
+ }
407
+ if (t[2])
408
+ _.ops.pop();
409
+ _.trys.pop();
410
+ continue;
411
+ }
412
+ op = body.call(thisArg, _);
413
+ }
414
+ catch (e) {
415
+ op = [6, e];
416
+ y = 0;
417
+ }
418
+ finally {
419
+ f = t = 0;
420
+ }
421
+ if (op[0] & 5)
422
+ throw op[1];
423
+ return { value: op[0] ? op[1] : void 0, done: true };
424
+ }
425
+ }
426
+ var __createBinding = Object.create ? (function (o, m, k, k2) {
427
+ if (k2 === undefined)
428
+ k2 = k;
429
+ Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
430
+ }) : (function (o, m, k, k2) {
431
+ if (k2 === undefined)
432
+ k2 = k;
433
+ o[k2] = m[k];
434
+ });
435
+ function __exportStar(m, o) {
436
+ for (var p in m)
437
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
438
+ __createBinding(o, m, p);
439
+ }
440
+ function __values(o) {
441
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
442
+ if (m)
443
+ return m.call(o);
444
+ if (o && typeof o.length === "number")
445
+ return {
446
+ next: function () {
447
+ if (o && i >= o.length)
448
+ o = void 0;
449
+ return { value: o && o[i++], done: !o };
450
+ }
451
+ };
452
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
453
+ }
454
+ function __read(o, n) {
455
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
456
+ if (!m)
457
+ return o;
458
+ var i = m.call(o), r, ar = [], e;
459
+ try {
460
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
461
+ ar.push(r.value);
462
+ }
463
+ catch (error) {
464
+ e = { error: error };
465
+ }
466
+ finally {
467
+ try {
468
+ if (r && !r.done && (m = i["return"]))
469
+ m.call(i);
470
+ }
471
+ finally {
472
+ if (e)
473
+ throw e.error;
474
+ }
475
+ }
476
+ return ar;
477
+ }
478
+ /** @deprecated */
479
+ function __spread() {
480
+ for (var ar = [], i = 0; i < arguments.length; i++)
481
+ ar = ar.concat(__read(arguments[i]));
482
+ return ar;
483
+ }
484
+ /** @deprecated */
485
+ function __spreadArrays() {
486
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++)
487
+ s += arguments[i].length;
488
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
489
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
490
+ r[k] = a[j];
491
+ return r;
492
+ }
493
+ function __spreadArray(to, from, pack) {
494
+ if (pack || arguments.length === 2)
495
+ for (var i = 0, l = from.length, ar; i < l; i++) {
496
+ if (ar || !(i in from)) {
497
+ if (!ar)
498
+ ar = Array.prototype.slice.call(from, 0, i);
499
+ ar[i] = from[i];
500
+ }
501
+ }
502
+ return to.concat(ar || Array.prototype.slice.call(from));
503
+ }
504
+ function __await(v) {
505
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
506
+ }
507
+ function __asyncGenerator(thisArg, _arguments, generator) {
508
+ if (!Symbol.asyncIterator)
509
+ throw new TypeError("Symbol.asyncIterator is not defined.");
510
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
511
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
512
+ function verb(n) { if (g[n])
513
+ i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
514
+ function resume(n, v) { try {
515
+ step(g[n](v));
516
+ }
517
+ catch (e) {
518
+ settle(q[0][3], e);
519
+ } }
520
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
521
+ function fulfill(value) { resume("next", value); }
522
+ function reject(value) { resume("throw", value); }
523
+ function settle(f, v) { if (f(v), q.shift(), q.length)
524
+ resume(q[0][0], q[0][1]); }
525
+ }
526
+ function __asyncDelegator(o) {
527
+ var i, p;
528
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
529
+ 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; }
530
+ }
531
+ function __asyncValues(o) {
532
+ if (!Symbol.asyncIterator)
533
+ throw new TypeError("Symbol.asyncIterator is not defined.");
534
+ var m = o[Symbol.asyncIterator], i;
535
+ 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);
536
+ 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); }); }; }
537
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
538
+ }
539
+ function __makeTemplateObject(cooked, raw) {
540
+ if (Object.defineProperty) {
541
+ Object.defineProperty(cooked, "raw", { value: raw });
542
+ }
543
+ else {
544
+ cooked.raw = raw;
545
+ }
546
+ return cooked;
547
+ }
548
+ ;
549
+ var __setModuleDefault = Object.create ? (function (o, v) {
550
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
551
+ }) : function (o, v) {
552
+ o["default"] = v;
553
+ };
554
+ function __importStar(mod) {
555
+ if (mod && mod.__esModule)
556
+ return mod;
557
+ var result = {};
558
+ if (mod != null)
559
+ for (var k in mod)
560
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
561
+ __createBinding(result, mod, k);
562
+ __setModuleDefault(result, mod);
563
+ return result;
564
+ }
565
+ function __importDefault(mod) {
566
+ return (mod && mod.__esModule) ? mod : { default: mod };
567
+ }
568
+ function __classPrivateFieldGet(receiver, state, kind, f) {
569
+ if (kind === "a" && !f)
570
+ throw new TypeError("Private accessor was defined without a getter");
571
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
572
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
573
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
574
+ }
575
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
576
+ if (kind === "m")
577
+ throw new TypeError("Private method is not writable");
578
+ if (kind === "a" && !f)
579
+ throw new TypeError("Private accessor was defined without a setter");
580
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
581
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
582
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
582
583
  }
583
584
 
584
- var Edition = /** @class */ (function (_super) {
585
- __extends(Edition, _super);
586
- function Edition() {
587
- return _super !== null && _super.apply(this, arguments) || this;
588
- }
589
- Edition.prototype.identifierFields = function () {
590
- return ['id'];
591
- };
592
- return Edition;
585
+ var Edition = /** @class */ (function (_super) {
586
+ __extends(Edition, _super);
587
+ function Edition() {
588
+ return _super !== null && _super.apply(this, arguments) || this;
589
+ }
590
+ Edition.prototype.identifierFields = function () {
591
+ return ['id'];
592
+ };
593
+ return Edition;
593
594
  }(BaseModel));
594
595
 
595
- var Payment = /** @class */ (function (_super) {
596
- __extends(Payment, _super);
597
- function Payment() {
598
- return _super !== null && _super.apply(this, arguments) || this;
599
- }
600
- Payment.prototype.identifierFields = function () {
601
- return ['id'];
602
- };
603
- return Payment;
604
- }(BaseModel));
605
- __decorate([
606
- classTransformer.Expose({ name: 'refuse_reason' }),
607
- __metadata("design:type", String)
608
- ], Payment.prototype, "refuseReason", void 0);
609
- __decorate([
610
- classTransformer.Expose({ name: 'status_reason' }),
611
- __metadata("design:type", String)
612
- ], Payment.prototype, "statusReason", void 0);
613
- __decorate([
614
- classTransformer.Expose({ name: 'acquirer_response_code' }),
615
- __metadata("design:type", String)
616
- ], Payment.prototype, "acquirerResponseCode", void 0);
617
- __decorate([
618
- classTransformer.Expose({ name: 'acquirer_name' }),
619
- __metadata("design:type", String)
620
- ], Payment.prototype, "acquirerName", void 0);
621
- __decorate([
622
- classTransformer.Expose({ name: 'acquirer_id' }),
623
- __metadata("design:type", String)
624
- ], Payment.prototype, "acquirerId", void 0);
625
- __decorate([
626
- classTransformer.Expose({ name: 'authorization_code' }),
627
- __metadata("design:type", String)
628
- ], Payment.prototype, "authorizationCode", void 0);
629
- __decorate([
630
- classTransformer.Expose({ name: 'soft_descriptor' }),
631
- __metadata("design:type", String)
632
- ], Payment.prototype, "softDescriptor", void 0);
633
- __decorate([
634
- classTransformer.Expose({ name: 'date_created' }),
635
- __metadata("design:type", String)
636
- ], Payment.prototype, "dateCreated", void 0);
637
- __decorate([
638
- classTransformer.Expose({ name: 'date_updated' }),
639
- __metadata("design:type", String)
640
- ], Payment.prototype, "dateUpdated", void 0);
641
- __decorate([
642
- classTransformer.Expose({ name: 'authorized_amount' }),
643
- __metadata("design:type", Number)
644
- ], Payment.prototype, "authorizedAmount", void 0);
645
- __decorate([
646
- classTransformer.Expose({ name: 'paid_amount' }),
647
- __metadata("design:type", Number)
648
- ], Payment.prototype, "paidAmount", void 0);
649
- __decorate([
650
- classTransformer.Expose({ name: 'refunded_amount' }),
651
- __metadata("design:type", Number)
652
- ], Payment.prototype, "refundedAmount", void 0);
653
- __decorate([
654
- classTransformer.Expose({ name: 'card_holder_name' }),
655
- __metadata("design:type", String)
656
- ], Payment.prototype, "cardHolderName", void 0);
657
- __decorate([
658
- classTransformer.Expose({ name: 'card_last_digits' }),
659
- __metadata("design:type", String)
660
- ], Payment.prototype, "cardLastDigits", void 0);
661
- __decorate([
662
- classTransformer.Expose({ name: 'card_first_digits' }),
663
- __metadata("design:type", String)
664
- ], Payment.prototype, "cardFirstDigits", void 0);
665
- __decorate([
666
- classTransformer.Expose({ name: 'card_brand' }),
667
- __metadata("design:type", String)
668
- ], Payment.prototype, "cardBrand", void 0);
669
- __decorate([
670
- classTransformer.Expose({ name: 'card_pin_mode' }),
671
- __metadata("design:type", String)
672
- ], Payment.prototype, "cardPinMode", void 0);
673
- __decorate([
674
- classTransformer.Expose({ name: 'card_magstripe_fallback' }),
675
- __metadata("design:type", Boolean)
676
- ], Payment.prototype, "cardMagstripeFallback", void 0);
677
- __decorate([
678
- classTransformer.Expose({ name: 'cvm_pin' }),
679
- __metadata("design:type", Boolean)
680
- ], Payment.prototype, "cvmPin", void 0);
681
- __decorate([
682
- classTransformer.Expose({ name: 'postback_url' }),
683
- __metadata("design:type", String)
684
- ], Payment.prototype, "postbackUrl", void 0);
685
- __decorate([
686
- classTransformer.Expose({ name: 'payment_method' }),
687
- __metadata("design:type", String)
688
- ], Payment.prototype, "paymentMethod", void 0);
689
- __decorate([
690
- classTransformer.Expose({ name: 'capture_method' }),
691
- __metadata("design:type", String)
692
- ], Payment.prototype, "captureMethod", void 0);
693
- __decorate([
694
- classTransformer.Expose({ name: 'antifraud_score' }),
695
- __metadata("design:type", String)
696
- ], Payment.prototype, "antifraudScore", void 0);
697
- __decorate([
698
- classTransformer.Expose({ name: 'boleto_url' }),
699
- __metadata("design:type", String)
700
- ], Payment.prototype, "boletoUrl", void 0);
701
- __decorate([
702
- classTransformer.Expose({ name: 'boleto_barcode' }),
703
- __metadata("design:type", String)
704
- ], Payment.prototype, "boletoBarcode", void 0);
705
- __decorate([
706
- classTransformer.Expose({ name: 'boleto_expiration_date' }),
707
- __metadata("design:type", String)
708
- ], Payment.prototype, "boletoExpirationDate", void 0);
709
- __decorate([
710
- classTransformer.Expose({ name: 'subscription_id' }),
711
- __metadata("design:type", String)
712
- ], Payment.prototype, "subscriptionId", void 0);
713
- __decorate([
714
- classTransformer.Expose({ name: 'split_rules' }),
715
- __metadata("design:type", String)
716
- ], Payment.prototype, "splitRules", void 0);
717
- __decorate([
718
- classTransformer.Expose({ name: 'antifraud_metadata' }),
719
- __metadata("design:type", Object)
720
- ], Payment.prototype, "antifraudMetadata", void 0);
721
- __decorate([
722
- classTransformer.Expose({ name: 'reference_key' }),
723
- __metadata("design:type", String)
724
- ], Payment.prototype, "referenceKey", void 0);
725
- __decorate([
726
- classTransformer.Expose({ name: 'local_transaction_id' }),
727
- __metadata("design:type", String)
728
- ], Payment.prototype, "localTransactionId", void 0);
729
- __decorate([
730
- classTransformer.Expose({ name: 'local_time' }),
731
- __metadata("design:type", String)
732
- ], Payment.prototype, "localTime", void 0);
733
- __decorate([
734
- classTransformer.Expose({ name: 'fraud_covered' }),
735
- __metadata("design:type", Boolean)
736
- ], Payment.prototype, "fraudCovered", void 0);
737
- __decorate([
738
- classTransformer.Expose({ name: 'fraud_reimbursed' }),
739
- __metadata("design:type", String)
740
- ], Payment.prototype, "fraudReimbursed", void 0);
741
- __decorate([
742
- classTransformer.Expose({ name: 'order_id' }),
743
- __metadata("design:type", String)
744
- ], Payment.prototype, "orderId", void 0);
745
- __decorate([
746
- classTransformer.Expose({ name: 'risk_level' }),
747
- __metadata("design:type", String)
748
- ], Payment.prototype, "riskLevel", void 0);
749
- __decorate([
750
- classTransformer.Expose({ name: 'receipt_url' }),
751
- __metadata("design:type", String)
752
- ], Payment.prototype, "receiptUrl", void 0);
753
- __decorate([
754
- classTransformer.Expose({ name: 'private_label' }),
755
- __metadata("design:type", String)
756
- ], Payment.prototype, "privateLabel", void 0);
757
- __decorate([
758
- classTransformer.Expose({ name: 'pix_qr_code' }),
759
- __metadata("design:type", String)
760
- ], Payment.prototype, "pixQrCode", void 0);
761
- __decorate([
762
- classTransformer.Expose({ name: 'pix_expiration_date' }),
763
- __metadata("design:type", String)
596
+ var Payment = /** @class */ (function (_super) {
597
+ __extends(Payment, _super);
598
+ function Payment() {
599
+ return _super !== null && _super.apply(this, arguments) || this;
600
+ }
601
+ Payment.prototype.identifierFields = function () {
602
+ return ['id'];
603
+ };
604
+ return Payment;
605
+ }(BaseModel));
606
+ __decorate([
607
+ classTransformer.Expose({ name: 'refuse_reason' }),
608
+ __metadata("design:type", String)
609
+ ], Payment.prototype, "refuseReason", void 0);
610
+ __decorate([
611
+ classTransformer.Expose({ name: 'status_reason' }),
612
+ __metadata("design:type", String)
613
+ ], Payment.prototype, "statusReason", void 0);
614
+ __decorate([
615
+ classTransformer.Expose({ name: 'acquirer_response_code' }),
616
+ __metadata("design:type", String)
617
+ ], Payment.prototype, "acquirerResponseCode", void 0);
618
+ __decorate([
619
+ classTransformer.Expose({ name: 'acquirer_name' }),
620
+ __metadata("design:type", String)
621
+ ], Payment.prototype, "acquirerName", void 0);
622
+ __decorate([
623
+ classTransformer.Expose({ name: 'acquirer_id' }),
624
+ __metadata("design:type", String)
625
+ ], Payment.prototype, "acquirerId", void 0);
626
+ __decorate([
627
+ classTransformer.Expose({ name: 'authorization_code' }),
628
+ __metadata("design:type", String)
629
+ ], Payment.prototype, "authorizationCode", void 0);
630
+ __decorate([
631
+ classTransformer.Expose({ name: 'soft_descriptor' }),
632
+ __metadata("design:type", String)
633
+ ], Payment.prototype, "softDescriptor", void 0);
634
+ __decorate([
635
+ classTransformer.Expose({ name: 'date_created' }),
636
+ __metadata("design:type", String)
637
+ ], Payment.prototype, "dateCreated", void 0);
638
+ __decorate([
639
+ classTransformer.Expose({ name: 'date_updated' }),
640
+ __metadata("design:type", String)
641
+ ], Payment.prototype, "dateUpdated", void 0);
642
+ __decorate([
643
+ classTransformer.Expose({ name: 'authorized_amount' }),
644
+ __metadata("design:type", Number)
645
+ ], Payment.prototype, "authorizedAmount", void 0);
646
+ __decorate([
647
+ classTransformer.Expose({ name: 'paid_amount' }),
648
+ __metadata("design:type", Number)
649
+ ], Payment.prototype, "paidAmount", void 0);
650
+ __decorate([
651
+ classTransformer.Expose({ name: 'refunded_amount' }),
652
+ __metadata("design:type", Number)
653
+ ], Payment.prototype, "refundedAmount", void 0);
654
+ __decorate([
655
+ classTransformer.Expose({ name: 'card_holder_name' }),
656
+ __metadata("design:type", String)
657
+ ], Payment.prototype, "cardHolderName", void 0);
658
+ __decorate([
659
+ classTransformer.Expose({ name: 'card_last_digits' }),
660
+ __metadata("design:type", String)
661
+ ], Payment.prototype, "cardLastDigits", void 0);
662
+ __decorate([
663
+ classTransformer.Expose({ name: 'card_first_digits' }),
664
+ __metadata("design:type", String)
665
+ ], Payment.prototype, "cardFirstDigits", void 0);
666
+ __decorate([
667
+ classTransformer.Expose({ name: 'card_brand' }),
668
+ __metadata("design:type", String)
669
+ ], Payment.prototype, "cardBrand", void 0);
670
+ __decorate([
671
+ classTransformer.Expose({ name: 'card_pin_mode' }),
672
+ __metadata("design:type", String)
673
+ ], Payment.prototype, "cardPinMode", void 0);
674
+ __decorate([
675
+ classTransformer.Expose({ name: 'card_magstripe_fallback' }),
676
+ __metadata("design:type", Boolean)
677
+ ], Payment.prototype, "cardMagstripeFallback", void 0);
678
+ __decorate([
679
+ classTransformer.Expose({ name: 'cvm_pin' }),
680
+ __metadata("design:type", Boolean)
681
+ ], Payment.prototype, "cvmPin", void 0);
682
+ __decorate([
683
+ classTransformer.Expose({ name: 'postback_url' }),
684
+ __metadata("design:type", String)
685
+ ], Payment.prototype, "postbackUrl", void 0);
686
+ __decorate([
687
+ classTransformer.Expose({ name: 'payment_method' }),
688
+ __metadata("design:type", String)
689
+ ], Payment.prototype, "paymentMethod", void 0);
690
+ __decorate([
691
+ classTransformer.Expose({ name: 'capture_method' }),
692
+ __metadata("design:type", String)
693
+ ], Payment.prototype, "captureMethod", void 0);
694
+ __decorate([
695
+ classTransformer.Expose({ name: 'antifraud_score' }),
696
+ __metadata("design:type", String)
697
+ ], Payment.prototype, "antifraudScore", void 0);
698
+ __decorate([
699
+ classTransformer.Expose({ name: 'boleto_url' }),
700
+ __metadata("design:type", String)
701
+ ], Payment.prototype, "boletoUrl", void 0);
702
+ __decorate([
703
+ classTransformer.Expose({ name: 'boleto_barcode' }),
704
+ __metadata("design:type", String)
705
+ ], Payment.prototype, "boletoBarcode", void 0);
706
+ __decorate([
707
+ classTransformer.Expose({ name: 'boleto_expiration_date' }),
708
+ __metadata("design:type", String)
709
+ ], Payment.prototype, "boletoExpirationDate", void 0);
710
+ __decorate([
711
+ classTransformer.Expose({ name: 'subscription_id' }),
712
+ __metadata("design:type", String)
713
+ ], Payment.prototype, "subscriptionId", void 0);
714
+ __decorate([
715
+ classTransformer.Expose({ name: 'split_rules' }),
716
+ __metadata("design:type", String)
717
+ ], Payment.prototype, "splitRules", void 0);
718
+ __decorate([
719
+ classTransformer.Expose({ name: 'antifraud_metadata' }),
720
+ __metadata("design:type", Object)
721
+ ], Payment.prototype, "antifraudMetadata", void 0);
722
+ __decorate([
723
+ classTransformer.Expose({ name: 'reference_key' }),
724
+ __metadata("design:type", String)
725
+ ], Payment.prototype, "referenceKey", void 0);
726
+ __decorate([
727
+ classTransformer.Expose({ name: 'local_transaction_id' }),
728
+ __metadata("design:type", String)
729
+ ], Payment.prototype, "localTransactionId", void 0);
730
+ __decorate([
731
+ classTransformer.Expose({ name: 'local_time' }),
732
+ __metadata("design:type", String)
733
+ ], Payment.prototype, "localTime", void 0);
734
+ __decorate([
735
+ classTransformer.Expose({ name: 'fraud_covered' }),
736
+ __metadata("design:type", Boolean)
737
+ ], Payment.prototype, "fraudCovered", void 0);
738
+ __decorate([
739
+ classTransformer.Expose({ name: 'fraud_reimbursed' }),
740
+ __metadata("design:type", String)
741
+ ], Payment.prototype, "fraudReimbursed", void 0);
742
+ __decorate([
743
+ classTransformer.Expose({ name: 'order_id' }),
744
+ __metadata("design:type", String)
745
+ ], Payment.prototype, "orderId", void 0);
746
+ __decorate([
747
+ classTransformer.Expose({ name: 'risk_level' }),
748
+ __metadata("design:type", String)
749
+ ], Payment.prototype, "riskLevel", void 0);
750
+ __decorate([
751
+ classTransformer.Expose({ name: 'receipt_url' }),
752
+ __metadata("design:type", String)
753
+ ], Payment.prototype, "receiptUrl", void 0);
754
+ __decorate([
755
+ classTransformer.Expose({ name: 'private_label' }),
756
+ __metadata("design:type", String)
757
+ ], Payment.prototype, "privateLabel", void 0);
758
+ __decorate([
759
+ classTransformer.Expose({ name: 'pix_qr_code' }),
760
+ __metadata("design:type", String)
761
+ ], Payment.prototype, "pixQrCode", void 0);
762
+ __decorate([
763
+ classTransformer.Expose({ name: 'pix_expiration_date' }),
764
+ __metadata("design:type", String)
764
765
  ], Payment.prototype, "pixExpirationDate", void 0);
765
766
 
766
- var SubscriptionPayment = /** @class */ (function (_super) {
767
- __extends(SubscriptionPayment, _super);
768
- function SubscriptionPayment() {
769
- return _super !== null && _super.apply(this, arguments) || this;
770
- }
771
- SubscriptionPayment.prototype.identifierFields = function () {
772
- return ['id'];
773
- };
774
- return SubscriptionPayment;
775
- }(BaseModel));
776
- __decorate([
777
- classTransformer.Type(function () { return Payment; }),
778
- __metadata("design:type", Payment)
767
+ var SubscriptionPayment = /** @class */ (function (_super) {
768
+ __extends(SubscriptionPayment, _super);
769
+ function SubscriptionPayment() {
770
+ return _super !== null && _super.apply(this, arguments) || this;
771
+ }
772
+ SubscriptionPayment.prototype.identifierFields = function () {
773
+ return ['id'];
774
+ };
775
+ return SubscriptionPayment;
776
+ }(BaseModel));
777
+ __decorate([
778
+ classTransformer.Type(function () { return Payment; }),
779
+ __metadata("design:type", Payment)
779
780
  ], SubscriptionPayment.prototype, "payment", void 0);
780
781
 
781
- var Address = /** @class */ (function (_super) {
782
- __extends(Address, _super);
783
- function Address() {
784
- return _super !== null && _super.apply(this, arguments) || this;
785
- }
786
- return Address;
782
+ var Address = /** @class */ (function (_super) {
783
+ __extends(Address, _super);
784
+ function Address() {
785
+ return _super !== null && _super.apply(this, arguments) || this;
786
+ }
787
+ return Address;
787
788
  }(BaseModel));
788
789
 
789
- var Base = /** @class */ (function () {
790
- function Base() {
791
- var args = [];
792
- for (var _i = 0; _i < arguments.length; _i++) {
793
- args[_i] = arguments[_i];
794
- }
795
- Object.assign.apply(Object, __spreadArray([this], __read(args)));
796
- }
797
- return Base;
790
+ exports.CheckoutTypes = void 0;
791
+ (function (CheckoutTypes) {
792
+ CheckoutTypes[CheckoutTypes["ECOMMERCE"] = 1] = "ECOMMERCE";
793
+ CheckoutTypes[CheckoutTypes["SUBSCRIPTION"] = 2] = "SUBSCRIPTION";
794
+ CheckoutTypes[CheckoutTypes["ALL"] = 3] = "ALL";
795
+ })(exports.CheckoutTypes || (exports.CheckoutTypes = {}));
796
+
797
+ var Base = /** @class */ (function () {
798
+ function Base() {
799
+ var args = [];
800
+ for (var _i = 0; _i < arguments.length; _i++) {
801
+ args[_i] = arguments[_i];
802
+ }
803
+ Object.assign.apply(Object, __spreadArray([this], __read(args)));
804
+ }
805
+ return Base;
798
806
  }());
799
807
 
800
- var chunk = lodash__default["default"].chunk, get = lodash__default["default"].get, isDate = lodash__default["default"].isDate, isEmpty = lodash__default["default"].isEmpty, isNil = lodash__default["default"].isNil, isNumber = lodash__default["default"].isNumber, isObject = lodash__default["default"].isObject, isString = lodash__default["default"].isString, pick = lodash__default["default"].pick, set = lodash__default["default"].set;
801
-
802
- var Coupon = /** @class */ (function (_super) {
803
- __extends(Coupon, _super);
804
- function Coupon() {
805
- return _super !== null && _super.apply(this, arguments) || this;
806
- }
807
- Object.defineProperty(Coupon.prototype, "isInfluencer", {
808
- get: function () {
809
- return !isNil(this.influencerEmail);
810
- },
811
- enumerable: false,
812
- configurable: true
813
- });
814
- Coupon.prototype.identifierFields = function () {
815
- return ['id'];
816
- };
817
- return Coupon;
818
- }(BaseModel));
819
- __decorate([
820
- classTransformer.Expose({ name: 'checkout_type' }),
821
- __metadata("design:type", Number)
822
- ], Coupon.prototype, "checkoutType", void 0);
823
- __decorate([
824
- classTransformer.Expose({ name: 'exclusivity_type' }),
825
- __metadata("design:type", Number)
808
+ exports.CouponTypes = void 0;
809
+ (function (CouponTypes) {
810
+ CouponTypes[CouponTypes["ABSOLUTE"] = 1] = "ABSOLUTE";
811
+ CouponTypes[CouponTypes["PERCENTAGE"] = 2] = "PERCENTAGE";
812
+ // FINANCIAL = 1,
813
+ // PRODUCT,
814
+ // GIFTCARD,
815
+ // VOUCHER,
816
+ })(exports.CouponTypes || (exports.CouponTypes = {}));
817
+
818
+ exports.CouponSubtypes = void 0;
819
+ (function (CouponSubtypes) {
820
+ CouponSubtypes[CouponSubtypes["ABSOLUTE"] = 1] = "ABSOLUTE";
821
+ CouponSubtypes[CouponSubtypes["PERCENTAGE"] = 2] = "PERCENTAGE";
822
+ })(exports.CouponSubtypes || (exports.CouponSubtypes = {}));
823
+
824
+ exports.Exclusivities = void 0;
825
+ (function (Exclusivities) {
826
+ Exclusivities[Exclusivities["ALL_USERS"] = 1] = "ALL_USERS";
827
+ Exclusivities[Exclusivities["SPECIFIC_USER"] = 2] = "SPECIFIC_USER";
828
+ Exclusivities[Exclusivities["COLLABORATORS"] = 3] = "COLLABORATORS";
829
+ Exclusivities[Exclusivities["ACTIVE_SUBSCRIBER"] = 4] = "ACTIVE_SUBSCRIBER";
830
+ Exclusivities[Exclusivities["INACTIVE_SUBSCRIBER"] = 5] = "INACTIVE_SUBSCRIBER";
831
+ Exclusivities[Exclusivities["NON_SUBSCRIBER"] = 6] = "NON_SUBSCRIBER";
832
+ })(exports.Exclusivities || (exports.Exclusivities = {}));
833
+
834
+ var COUPON_EXPIRATION = 60 * 60 * 24 * 30;
835
+ var Coupon = /** @class */ (function (_super) {
836
+ __extends(Coupon, _super);
837
+ function Coupon() {
838
+ return _super !== null && _super.apply(this, arguments) || this;
839
+ }
840
+ Object.defineProperty(Coupon.prototype, "isInfluencer", {
841
+ get: function () {
842
+ return !lodash.isNil(this.influencerEmail);
843
+ },
844
+ enumerable: false,
845
+ configurable: true
846
+ });
847
+ Coupon.prototype.identifierFields = function () {
848
+ return ['id'];
849
+ };
850
+ Coupon.createCoupon = function (userId) {
851
+ return this.toInstance({
852
+ nickname: "" + Date.now(),
853
+ type: exports.CouponTypes.ABSOLUTE,
854
+ checkoutType: exports.CheckoutTypes.ECOMMERCE,
855
+ discount: 30,
856
+ user: userId,
857
+ useLimit: 1,
858
+ useLimitPerUser: true,
859
+ createdAt: new Date(Date.now()),
860
+ beginAt: new Date(Date.now()),
861
+ expiresIn: new Date(Date.now() + COUPON_EXPIRATION),
862
+ });
863
+ };
864
+ return Coupon;
865
+ }(BaseModel));
866
+ __decorate([
867
+ classTransformer.Expose({ name: 'checkout_type' }),
868
+ __metadata("design:type", Number)
869
+ ], Coupon.prototype, "checkoutType", void 0);
870
+ __decorate([
871
+ classTransformer.Expose({ name: 'exclusivity_type' }),
872
+ __metadata("design:type", Number)
826
873
  ], Coupon.prototype, "exclusivityType", void 0);
827
874
 
828
- var SubscriptionPlan = /** @class */ (function (_super) {
829
- __extends(SubscriptionPlan, _super);
830
- function SubscriptionPlan() {
831
- return _super !== null && _super.apply(this, arguments) || this;
832
- }
833
- SubscriptionPlan.prototype.identifierFields = function () {
834
- return ['id'];
835
- };
836
- return SubscriptionPlan;
875
+ var SubscriptionPlan = /** @class */ (function (_super) {
876
+ __extends(SubscriptionPlan, _super);
877
+ function SubscriptionPlan() {
878
+ return _super !== null && _super.apply(this, arguments) || this;
879
+ }
880
+ SubscriptionPlan.prototype.identifierFields = function () {
881
+ return ['id'];
882
+ };
883
+ return SubscriptionPlan;
837
884
  }(BaseModel));
838
885
 
839
- var BeautyProfile = /** @class */ (function (_super) {
840
- __extends(BeautyProfile, _super);
841
- function BeautyProfile() {
842
- return _super !== null && _super.apply(this, arguments) || this;
843
- }
844
- BeautyProfile.prototype.toPlain = function () {
845
- var plain = _super.prototype.toPlain.call(this);
846
- delete plain.id;
847
- return plain;
848
- };
849
- BeautyProfile.prototype.identifierFields = function () {
850
- return ['id'];
851
- };
852
- return BeautyProfile;
886
+ var BeautyProfile = /** @class */ (function (_super) {
887
+ __extends(BeautyProfile, _super);
888
+ function BeautyProfile() {
889
+ return _super !== null && _super.apply(this, arguments) || this;
890
+ }
891
+ BeautyProfile.prototype.toPlain = function () {
892
+ var plain = _super.prototype.toPlain.call(this);
893
+ delete plain.id;
894
+ return plain;
895
+ };
896
+ BeautyProfile.prototype.identifierFields = function () {
897
+ return ['id'];
898
+ };
899
+ return BeautyProfile;
853
900
  }(BaseModel));
854
901
 
855
- var User = /** @class */ (function (_super) {
856
- __extends(User, _super);
857
- function User() {
858
- return _super !== null && _super.apply(this, arguments) || this;
859
- }
860
- User.toInstance = function (data) {
861
- var instance = _super.toInstance.call(this, data);
862
- if (!isNil(data.firstName))
863
- instance.displayName = "" + data.firstName + (!isNil(data.lastName) ? " " + data.lastName : '');
864
- return instance;
865
- };
866
- User.prototype.identifierFields = function () {
867
- return ['id'];
868
- };
869
- User.prototype.toPlain = function () {
870
- var plain = _super.prototype.toPlain.call(this);
871
- delete plain.beautyProfile;
872
- return plain;
873
- };
874
- return User;
875
- }(BaseModel));
876
- __decorate([
877
- classTransformer.Type(function () { return BeautyProfile; }),
878
- __metadata("design:type", BeautyProfile)
902
+ var User = /** @class */ (function (_super) {
903
+ __extends(User, _super);
904
+ function User() {
905
+ return _super !== null && _super.apply(this, arguments) || this;
906
+ }
907
+ User.toInstance = function (data) {
908
+ var instance = _super.toInstance.call(this, data);
909
+ if (!lodash.isNil(data.firstName))
910
+ instance.displayName = "" + data.firstName + (!lodash.isNil(data.lastName) ? " " + data.lastName : '');
911
+ return instance;
912
+ };
913
+ User.prototype.identifierFields = function () {
914
+ return ['id'];
915
+ };
916
+ User.prototype.toPlain = function () {
917
+ var plain = _super.prototype.toPlain.call(this);
918
+ delete plain.beautyProfile;
919
+ return plain;
920
+ };
921
+ return User;
922
+ }(BaseModel));
923
+ __decorate([
924
+ classTransformer.Type(function () { return BeautyProfile; }),
925
+ __metadata("design:type", BeautyProfile)
879
926
  ], User.prototype, "beautyProfile", void 0);
880
927
 
881
- var Subscription = /** @class */ (function (_super) {
882
- __extends(Subscription, _super);
883
- function Subscription() {
884
- return _super !== null && _super.apply(this, arguments) || this;
885
- }
886
- Subscription.prototype.identifierFields = function () {
887
- return ['id'];
888
- };
889
- return Subscription;
890
- }(BaseModel));
891
- __decorate([
892
- classTransformer.Type(function () { return User; }),
893
- __metadata("design:type", User)
894
- ], Subscription.prototype, "user", void 0);
895
- __decorate([
896
- classTransformer.Type(function () { return SubscriptionPlan; }),
897
- __metadata("design:type", SubscriptionPlan)
898
- ], Subscription.prototype, "subscriptionPlan", void 0);
899
- __decorate([
900
- classTransformer.Type(function () { return Address; }),
901
- __metadata("design:type", Address)
902
- ], Subscription.prototype, "shippingAddress", void 0);
903
- __decorate([
904
- classTransformer.Type(function () { return Address; }),
905
- __metadata("design:type", Address)
906
- ], Subscription.prototype, "billingAddress", void 0);
907
- __decorate([
908
- classTransformer.Type(function () { return Coupon; }),
909
- __metadata("design:type", Coupon)
910
- ], Subscription.prototype, "coupon", void 0);
911
- __decorate([
912
- classTransformer.Type(function () { return Edition; }),
913
- __metadata("design:type", Array)
914
- ], Subscription.prototype, "editions", void 0);
915
- __decorate([
916
- classTransformer.Type(function () { return SubscriptionPayment; }),
917
- __metadata("design:type", Array)
928
+ var Subscription = /** @class */ (function (_super) {
929
+ __extends(Subscription, _super);
930
+ function Subscription() {
931
+ return _super !== null && _super.apply(this, arguments) || this;
932
+ }
933
+ Subscription.prototype.identifierFields = function () {
934
+ return ['id'];
935
+ };
936
+ return Subscription;
937
+ }(BaseModel));
938
+ __decorate([
939
+ classTransformer.Type(function () { return User; }),
940
+ __metadata("design:type", User)
941
+ ], Subscription.prototype, "user", void 0);
942
+ __decorate([
943
+ classTransformer.Type(function () { return SubscriptionPlan; }),
944
+ __metadata("design:type", SubscriptionPlan)
945
+ ], Subscription.prototype, "subscriptionPlan", void 0);
946
+ __decorate([
947
+ classTransformer.Type(function () { return Address; }),
948
+ __metadata("design:type", Address)
949
+ ], Subscription.prototype, "shippingAddress", void 0);
950
+ __decorate([
951
+ classTransformer.Type(function () { return Address; }),
952
+ __metadata("design:type", Address)
953
+ ], Subscription.prototype, "billingAddress", void 0);
954
+ __decorate([
955
+ classTransformer.Type(function () { return Coupon; }),
956
+ __metadata("design:type", Coupon)
957
+ ], Subscription.prototype, "coupon", void 0);
958
+ __decorate([
959
+ classTransformer.Type(function () { return Edition; }),
960
+ __metadata("design:type", Array)
961
+ ], Subscription.prototype, "editions", void 0);
962
+ __decorate([
963
+ classTransformer.Type(function () { return SubscriptionPayment; }),
964
+ __metadata("design:type", Array)
918
965
  ], Subscription.prototype, "payment", void 0);
919
966
 
920
- var UserAddress = /** @class */ (function (_super) {
921
- __extends(UserAddress, _super);
922
- function UserAddress() {
923
- return _super !== null && _super.apply(this, arguments) || this;
924
- }
925
- UserAddress.prototype.identifierFields = function () {
926
- return ['id'];
927
- };
928
- return UserAddress;
967
+ var UserAddress = /** @class */ (function (_super) {
968
+ __extends(UserAddress, _super);
969
+ function UserAddress() {
970
+ return _super !== null && _super.apply(this, arguments) || this;
971
+ }
972
+ UserAddress.prototype.identifierFields = function () {
973
+ return ['id'];
974
+ };
975
+ return UserAddress;
929
976
  }(Address));
930
977
 
931
- var UserPaymentMethod = /** @class */ (function (_super) {
932
- __extends(UserPaymentMethod, _super);
933
- function UserPaymentMethod() {
934
- return _super !== null && _super.apply(this, arguments) || this;
935
- }
936
- UserPaymentMethod.prototype.identifierFields = function () {
937
- return ['id'];
938
- };
939
- return UserPaymentMethod;
978
+ var UserPaymentMethod = /** @class */ (function (_super) {
979
+ __extends(UserPaymentMethod, _super);
980
+ function UserPaymentMethod() {
981
+ return _super !== null && _super.apply(this, arguments) || this;
982
+ }
983
+ UserPaymentMethod.prototype.identifierFields = function () {
984
+ return ['id'];
985
+ };
986
+ return UserPaymentMethod;
940
987
  }(BaseModel));
941
988
 
942
- var Lead = /** @class */ (function (_super) {
943
- __extends(Lead, _super);
944
- function Lead() {
945
- return _super !== null && _super.apply(this, arguments) || this;
946
- }
947
- Lead.prototype.identifierFields = function () {
948
- return ['id'];
949
- };
950
- return Lead;
989
+ var Lead = /** @class */ (function (_super) {
990
+ __extends(Lead, _super);
991
+ function Lead() {
992
+ return _super !== null && _super.apply(this, arguments) || this;
993
+ }
994
+ Lead.prototype.identifierFields = function () {
995
+ return ['id'];
996
+ };
997
+ return Lead;
951
998
  }(BaseModel));
952
999
 
953
- var UnauthorizedError = /** @class */ (function (_super) {
954
- __extends(UnauthorizedError, _super);
955
- function UnauthorizedError(message) {
956
- var _this = _super.call(this, message) || this;
957
- _this.message = message;
958
- return _this;
959
- }
960
- return UnauthorizedError;
1000
+ var UnauthorizedError = /** @class */ (function (_super) {
1001
+ __extends(UnauthorizedError, _super);
1002
+ function UnauthorizedError(message) {
1003
+ var _this = _super.call(this, message) || this;
1004
+ _this.message = message;
1005
+ return _this;
1006
+ }
1007
+ return UnauthorizedError;
961
1008
  }(Error));
962
1009
 
963
- exports.SignInMethods = void 0;
964
- (function (SignInMethods) {
965
- SignInMethods["EMAIL_PASSWORD"] = "email_password";
966
- SignInMethods["GOOGLE"] = "google";
967
- })(exports.SignInMethods || (exports.SignInMethods = {}));
968
- var Authentication = /** @class */ (function () {
969
- function Authentication(authService, userRepository) {
970
- this.authService = authService;
971
- this.userRepository = userRepository;
972
- }
973
- Authentication.prototype.signIn = function (_b, signInMethod) {
974
- var email = _b.email, password = _b.password;
975
- return __awaiter(this, void 0, void 0, function () {
976
- var method, userAuth, user;
977
- return __generator(this, function (_b) {
978
- switch (_b.label) {
979
- case 0:
980
- method = this.getServiceByMethod(signInMethod);
981
- return [4 /*yield*/, this.authService[method]({ email: email, password: password })];
982
- case 1:
983
- userAuth = _b.sent();
984
- user = this.userRepository.get(userAuth);
985
- if (!isNil(user))
986
- return [2 /*return*/, user];
987
- if (/^.+@b4a.com.br$/.test(userAuth.email))
988
- return [2 /*return*/, this.createsUserByCredential(userAuth)];
989
- throw new UnauthorizedError('Invalid credentials');
990
- }
991
- });
992
- });
993
- };
994
- Authentication.prototype.getServiceByMethod = function (signInMethod) {
995
- return signInMethod === exports.SignInMethods.EMAIL_PASSWORD ? 'signInWithEmailAndPassword' : 'signInWithGoogle';
996
- };
997
- Authentication.prototype.createsUserByCredential = function (user) {
998
- var _a;
999
- return __awaiter(this, void 0, void 0, function () {
1000
- var _b, firstName, lastName, person;
1001
- return __generator(this, function (_c) {
1002
- _b = __read((_a = user.displayName) === null || _a === void 0 ? void 0 : _a.split(/\s/), 2), firstName = _b[0], lastName = _b[1];
1003
- person = User.toInstance(Object.assign(Object.assign({}, user), { cpf: '', birthday: new Date(), firstName: firstName,
1004
- lastName: lastName, acceptsNewsletter: false, area: exports.Area.Transactional, officePosition: exports.OfficePosition.Intern, type: exports.UserType.Collaborator }));
1005
- return [2 /*return*/, this.userRepository.create(person)];
1006
- });
1007
- });
1008
- };
1009
- return Authentication;
1010
+ exports.SignInMethods = void 0;
1011
+ (function (SignInMethods) {
1012
+ SignInMethods["EMAIL_PASSWORD"] = "email_password";
1013
+ SignInMethods["GOOGLE"] = "google";
1014
+ })(exports.SignInMethods || (exports.SignInMethods = {}));
1015
+ var Authentication = /** @class */ (function () {
1016
+ function Authentication(authService, userRepository) {
1017
+ this.authService = authService;
1018
+ this.userRepository = userRepository;
1019
+ }
1020
+ Authentication.prototype.signIn = function (_b, signInMethod) {
1021
+ var email = _b.email, password = _b.password;
1022
+ return __awaiter(this, void 0, void 0, function () {
1023
+ var method, userAuth, user;
1024
+ return __generator(this, function (_b) {
1025
+ switch (_b.label) {
1026
+ case 0:
1027
+ method = this.getServiceByMethod(signInMethod);
1028
+ return [4 /*yield*/, this.authService[method]({ email: email, password: password })];
1029
+ case 1:
1030
+ userAuth = _b.sent();
1031
+ user = this.userRepository.get(userAuth);
1032
+ if (!lodash.isNil(user))
1033
+ return [2 /*return*/, user];
1034
+ if (/^.+@b4a.com.br$/.test(userAuth.email))
1035
+ return [2 /*return*/, this.createsUserByCredential(userAuth)];
1036
+ throw new UnauthorizedError('Invalid credentials');
1037
+ }
1038
+ });
1039
+ });
1040
+ };
1041
+ Authentication.prototype.getServiceByMethod = function (signInMethod) {
1042
+ return signInMethod === exports.SignInMethods.EMAIL_PASSWORD ? 'signInWithEmailAndPassword' : 'signInWithGoogle';
1043
+ };
1044
+ Authentication.prototype.createsUserByCredential = function (user) {
1045
+ var _a;
1046
+ return __awaiter(this, void 0, void 0, function () {
1047
+ var _b, firstName, lastName, person;
1048
+ return __generator(this, function (_c) {
1049
+ _b = __read((_a = user.displayName) === null || _a === void 0 ? void 0 : _a.split(/\s/), 2), firstName = _b[0], lastName = _b[1];
1050
+ person = User.toInstance(Object.assign(Object.assign({}, user), { cpf: '', birthday: new Date(), firstName: firstName,
1051
+ lastName: lastName, acceptsNewsletter: false, area: exports.Area.Transactional, officePosition: exports.OfficePosition.Intern, type: exports.UserType.Collaborator }));
1052
+ return [2 /*return*/, this.userRepository.create(person)];
1053
+ });
1054
+ });
1055
+ };
1056
+ return Authentication;
1010
1057
  }());
1011
1058
 
1012
- var UserAlreadyRegisteredError = /** @class */ (function (_super) {
1013
- __extends(UserAlreadyRegisteredError, _super);
1014
- function UserAlreadyRegisteredError(message) {
1015
- var _this = _super.call(this, message) || this;
1016
- _this.message = message;
1017
- return _this;
1018
- }
1019
- return UserAlreadyRegisteredError;
1059
+ var UserAlreadyRegisteredError = /** @class */ (function (_super) {
1060
+ __extends(UserAlreadyRegisteredError, _super);
1061
+ function UserAlreadyRegisteredError(message) {
1062
+ var _this = _super.call(this, message) || this;
1063
+ _this.message = message;
1064
+ return _this;
1065
+ }
1066
+ return UserAlreadyRegisteredError;
1020
1067
  }(Error));
1021
1068
 
1022
- var WeakPasswordError = /** @class */ (function (_super) {
1023
- __extends(WeakPasswordError, _super);
1024
- function WeakPasswordError(message) {
1025
- if (message === void 0) { message = 'Weak password'; }
1026
- var _this = _super.call(this, message) || this;
1027
- _this.message = message;
1028
- return _this;
1029
- }
1030
- return WeakPasswordError;
1069
+ var WeakPasswordError = /** @class */ (function (_super) {
1070
+ __extends(WeakPasswordError, _super);
1071
+ function WeakPasswordError(message) {
1072
+ if (message === void 0) { message = 'Weak password'; }
1073
+ var _this = _super.call(this, message) || this;
1074
+ _this.message = message;
1075
+ return _this;
1076
+ }
1077
+ return WeakPasswordError;
1031
1078
  }(Error));
1032
1079
 
1033
- var Register = /** @class */ (function () {
1034
- function Register(registerService, userRepository) {
1035
- this.registerService = registerService;
1036
- this.userRepository = userRepository;
1037
- }
1038
- Register.prototype.register = function (params) {
1039
- return __awaiter(this, void 0, void 0, function () {
1040
- var email, displayName, auth, user;
1041
- return __generator(this, function (_a) {
1042
- switch (_a.label) {
1043
- case 0:
1044
- email = params.email.toLocaleLowerCase();
1045
- displayName = params.firstName + " " + params.lastName;
1046
- return [4 /*yield*/, this.userRepository.checkIfExistsByField('cpf', params.cpf)];
1047
- case 1:
1048
- if (_a.sent())
1049
- throw new UserAlreadyRegisteredError("Usu\u00E1rio com CPF " + params.cpf + " j\u00E1 registrado.");
1050
- return [4 /*yield*/, this.userRepository.checkIfExistsByField('email', params.email)];
1051
- case 2:
1052
- if (_a.sent())
1053
- throw new UserAlreadyRegisteredError("Usu\u00E1rio com e-mail " + params.email + " j\u00E1 registrado.");
1054
- return [4 /*yield*/, this.registerService.register({
1055
- birthday: params.birthday,
1056
- email: email,
1057
- firstName: params.firstName,
1058
- lastName: params.lastName,
1059
- cpf: params.cpf,
1060
- displayName: displayName,
1061
- phone: params.phone,
1062
- password: params.password,
1063
- })];
1064
- case 3:
1065
- auth = _a.sent();
1066
- delete params.password;
1067
- return [4 /*yield*/, this.userRepository.create(Object.assign(Object.assign({}, params), { id: auth.id, email: email,
1068
- displayName: displayName, type: exports.UserType.B2C, dateCreated: new Date(), dateModified: new Date() }))];
1069
- case 4:
1070
- user = _a.sent();
1071
- return [2 /*return*/, user];
1072
- }
1073
- });
1074
- });
1075
- };
1076
- return Register;
1080
+ var Register = /** @class */ (function () {
1081
+ function Register(registerService, userRepository) {
1082
+ this.registerService = registerService;
1083
+ this.userRepository = userRepository;
1084
+ }
1085
+ Register.prototype.register = function (params) {
1086
+ return __awaiter(this, void 0, void 0, function () {
1087
+ var email, displayName, auth, user;
1088
+ return __generator(this, function (_a) {
1089
+ switch (_a.label) {
1090
+ case 0:
1091
+ email = params.email.toLocaleLowerCase();
1092
+ displayName = params.firstName + " " + params.lastName;
1093
+ return [4 /*yield*/, this.userRepository.checkIfExistsByField('cpf', params.cpf)];
1094
+ case 1:
1095
+ if (_a.sent())
1096
+ throw new UserAlreadyRegisteredError("Usu\u00E1rio com CPF " + params.cpf + " j\u00E1 registrado.");
1097
+ return [4 /*yield*/, this.userRepository.checkIfExistsByField('email', params.email)];
1098
+ case 2:
1099
+ if (_a.sent())
1100
+ throw new UserAlreadyRegisteredError("Usu\u00E1rio com e-mail " + params.email + " j\u00E1 registrado.");
1101
+ return [4 /*yield*/, this.registerService.register({
1102
+ birthday: params.birthday,
1103
+ email: email,
1104
+ firstName: params.firstName,
1105
+ lastName: params.lastName,
1106
+ cpf: params.cpf,
1107
+ displayName: displayName,
1108
+ phone: params.phone,
1109
+ password: params.password,
1110
+ })];
1111
+ case 3:
1112
+ auth = _a.sent();
1113
+ delete params.password;
1114
+ return [4 /*yield*/, this.userRepository.create(Object.assign(Object.assign({}, params), { id: auth.id, email: email,
1115
+ displayName: displayName, type: exports.UserType.B2C, dateCreated: new Date(), dateModified: new Date() }))];
1116
+ case 4:
1117
+ user = _a.sent();
1118
+ return [2 /*return*/, user];
1119
+ }
1120
+ });
1121
+ });
1122
+ };
1123
+ return Register;
1077
1124
  }());
1078
1125
 
1079
- var SignOut = /** @class */ (function () {
1080
- function SignOut(authService) {
1081
- this.authService = authService;
1082
- }
1083
- SignOut.prototype.signOut = function () {
1084
- return __awaiter(this, void 0, void 0, function () {
1085
- return __generator(this, function (_a) {
1086
- switch (_a.label) {
1087
- case 0: return [4 /*yield*/, this.authService.signOut()];
1088
- case 1:
1089
- _a.sent();
1090
- return [2 /*return*/];
1091
- }
1092
- });
1093
- });
1094
- };
1095
- return SignOut;
1126
+ var SignOut = /** @class */ (function () {
1127
+ function SignOut(authService) {
1128
+ this.authService = authService;
1129
+ }
1130
+ SignOut.prototype.signOut = function () {
1131
+ return __awaiter(this, void 0, void 0, function () {
1132
+ return __generator(this, function (_a) {
1133
+ switch (_a.label) {
1134
+ case 0: return [4 /*yield*/, this.authService.signOut()];
1135
+ case 1:
1136
+ _a.sent();
1137
+ return [2 /*return*/];
1138
+ }
1139
+ });
1140
+ });
1141
+ };
1142
+ return SignOut;
1096
1143
  }());
1097
1144
 
1098
- var RecoveryPassword = /** @class */ (function () {
1099
- function RecoveryPassword(authService) {
1100
- this.authService = authService;
1101
- }
1102
- RecoveryPassword.prototype.sendEmail = function (email) {
1103
- return __awaiter(this, void 0, void 0, function () {
1104
- return __generator(this, function (_a) {
1105
- switch (_a.label) {
1106
- case 0: return [4 /*yield*/, this.authService.sendPasswordResetEmail(email)];
1107
- case 1:
1108
- _a.sent();
1109
- return [2 /*return*/];
1110
- }
1111
- });
1112
- });
1113
- };
1114
- return RecoveryPassword;
1145
+ var RecoveryPassword = /** @class */ (function () {
1146
+ function RecoveryPassword(authService) {
1147
+ this.authService = authService;
1148
+ }
1149
+ RecoveryPassword.prototype.sendEmail = function (email) {
1150
+ return __awaiter(this, void 0, void 0, function () {
1151
+ return __generator(this, function (_a) {
1152
+ switch (_a.label) {
1153
+ case 0: return [4 /*yield*/, this.authService.sendPasswordResetEmail(email)];
1154
+ case 1:
1155
+ _a.sent();
1156
+ return [2 /*return*/];
1157
+ }
1158
+ });
1159
+ });
1160
+ };
1161
+ return RecoveryPassword;
1115
1162
  }());
1116
1163
 
1117
- exports.Shops = void 0;
1118
- (function (Shops) {
1119
- Shops["MENSMARKET"] = "mensmarket";
1120
- Shops["GLAMSHOP"] = "Glamshop";
1121
- Shops["GLAMPOINTS"] = "Glampoints";
1164
+ exports.Shops = void 0;
1165
+ (function (Shops) {
1166
+ Shops["MENSMARKET"] = "mensmarket";
1167
+ Shops["GLAMSHOP"] = "Glamshop";
1168
+ Shops["GLAMPOINTS"] = "Glampoints";
1169
+ Shops["ALL"] = "ALL";
1122
1170
  })(exports.Shops || (exports.Shops = {}));
1123
1171
 
1124
- var Category = /** @class */ (function (_super) {
1125
- __extends(Category, _super);
1126
- function Category() {
1127
- return _super !== null && _super.apply(this, arguments) || this;
1128
- }
1129
- Category.prototype.identifierFields = function () {
1130
- return ['id'];
1131
- };
1132
- return Category;
1172
+ var Category = /** @class */ (function (_super) {
1173
+ __extends(Category, _super);
1174
+ function Category() {
1175
+ return _super !== null && _super.apply(this, arguments) || this;
1176
+ }
1177
+ Category.prototype.identifierFields = function () {
1178
+ return ['id'];
1179
+ };
1180
+ return Category;
1133
1181
  }(BaseModel));
1134
1182
 
1135
- var Product = /** @class */ (function (_super) {
1136
- __extends(Product, _super);
1137
- function Product() {
1138
- return _super !== null && _super.apply(this, arguments) || this;
1139
- }
1140
- Product.prototype.identifierFields = function () {
1141
- return ['id'];
1142
- };
1143
- Product.prototype.getInfoByShop = function (shop) {
1144
- var _a, _b, _c, _d, _e, _f;
1145
- 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]) || {}));
1146
- };
1147
- return Product;
1183
+ var Product = /** @class */ (function (_super) {
1184
+ __extends(Product, _super);
1185
+ function Product() {
1186
+ return _super !== null && _super.apply(this, arguments) || this;
1187
+ }
1188
+ Product.prototype.identifierFields = function () {
1189
+ return ['id'];
1190
+ };
1191
+ Product.prototype.getInfoByShop = function (shop) {
1192
+ var _a, _b, _c, _d, _e, _f;
1193
+ 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]) || {}));
1194
+ };
1195
+ return Product;
1148
1196
  }(BaseModel));
1149
1197
 
1150
- var Variant = /** @class */ (function (_super) {
1151
- __extends(Variant, _super);
1152
- function Variant() {
1153
- return _super !== null && _super.apply(this, arguments) || this;
1154
- }
1155
- Variant.prototype.identifierFields = function () {
1156
- return ['id'];
1157
- };
1158
- return Variant;
1198
+ var Variant = /** @class */ (function (_super) {
1199
+ __extends(Variant, _super);
1200
+ function Variant() {
1201
+ return _super !== null && _super.apply(this, arguments) || this;
1202
+ }
1203
+ Variant.prototype.identifierFields = function () {
1204
+ return ['id'];
1205
+ };
1206
+ return Variant;
1159
1207
  }(BaseModel));
1160
1208
 
1161
- exports.CouponTypes = void 0;
1162
- (function (CouponTypes) {
1163
- CouponTypes[CouponTypes["FINANCIAL"] = 1] = "FINANCIAL";
1164
- CouponTypes[CouponTypes["PRODUCT"] = 2] = "PRODUCT";
1165
- CouponTypes[CouponTypes["GIFTCARD"] = 3] = "GIFTCARD";
1166
- CouponTypes[CouponTypes["VOUCHER"] = 4] = "VOUCHER";
1167
- })(exports.CouponTypes || (exports.CouponTypes = {}));
1168
-
1169
- exports.CouponSubtypes = void 0;
1170
- (function (CouponSubtypes) {
1171
- CouponSubtypes[CouponSubtypes["ABSOLUTE"] = 1] = "ABSOLUTE";
1172
- CouponSubtypes[CouponSubtypes["PERCENTAGE"] = 2] = "PERCENTAGE";
1173
- })(exports.CouponSubtypes || (exports.CouponSubtypes = {}));
1174
-
1175
- exports.Exclusivities = void 0;
1176
- (function (Exclusivities) {
1177
- Exclusivities[Exclusivities["ALL_USERS"] = 1] = "ALL_USERS";
1178
- Exclusivities[Exclusivities["SPECIFIC_USER"] = 2] = "SPECIFIC_USER";
1179
- Exclusivities[Exclusivities["COLLABORATORS"] = 3] = "COLLABORATORS";
1180
- })(exports.Exclusivities || (exports.Exclusivities = {}));
1181
-
1182
- exports.CheckoutTypes = void 0;
1183
- (function (CheckoutTypes) {
1184
- CheckoutTypes[CheckoutTypes["ECOMMERCE"] = 1] = "ECOMMERCE";
1185
- CheckoutTypes[CheckoutTypes["SUBSCRIPTION"] = 2] = "SUBSCRIPTION";
1186
- })(exports.CheckoutTypes || (exports.CheckoutTypes = {}));
1187
-
1188
- var COUPON_EXPIRATION = 60 * 60 * 24 * 30;
1189
- var FinancialCoupon = /** @class */ (function (_super) {
1190
- __extends(FinancialCoupon, _super);
1191
- function FinancialCoupon() {
1192
- var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
1193
- _this.type = exports.CouponTypes.FINANCIAL;
1194
- return _this;
1195
- }
1196
- FinancialCoupon.isFinancialCoupon = function (coupon) {
1197
- return coupon.type === exports.CouponTypes.FINANCIAL && !!coupon.subtype;
1198
- };
1199
- FinancialCoupon.createCoupon = function (userId) {
1200
- return this.toInstance({
1201
- name: tsMd5.Md5.hashStr(userId + "_" + Date.now).toString(),
1202
- nickname: "" + Date.now(),
1203
- type: exports.CouponTypes.FINANCIAL,
1204
- subtype: exports.CouponSubtypes.PERCENTAGE,
1205
- checkoutType: exports.CheckoutTypes.ECOMMERCE,
1206
- discount: 30,
1207
- user: userId,
1208
- createdAt: new Date(Date.now()),
1209
- expiresIn: new Date(Date.now() + COUPON_EXPIRATION),
1210
- });
1211
- };
1212
- return FinancialCoupon;
1213
- }(Coupon));
1214
-
1215
- exports.OrderStatus = void 0;
1216
- (function (OrderStatus) {
1217
- OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
1218
- OrderStatus["EM_PREPARO"] = "Preparando pedido";
1219
- OrderStatus["NF_EMITIDA"] = "Nota Fiscal Emitida";
1220
- OrderStatus["AGUARDANDO_ENVIO"] = "Aguardando Transaportadora";
1221
- OrderStatus["ENVIADO"] = "Pedido Enviado";
1222
- OrderStatus["ENTREGUE"] = "Pedido entregue";
1223
- OrderStatus["CANCELADO"] = "Cancelado";
1224
- OrderStatus["CREDIT_CARD"] = "credit_card";
1209
+ exports.OrderStatus = void 0;
1210
+ (function (OrderStatus) {
1211
+ OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
1212
+ OrderStatus["EM_PREPARO"] = "Preparando pedido";
1213
+ OrderStatus["NF_EMITIDA"] = "Nota Fiscal Emitida";
1214
+ OrderStatus["AGUARDANDO_ENVIO"] = "Aguardando Transaportadora";
1215
+ OrderStatus["ENVIADO"] = "Pedido Enviado";
1216
+ OrderStatus["ENTREGUE"] = "Pedido entregue";
1217
+ OrderStatus["CANCELADO"] = "Cancelado";
1218
+ OrderStatus["CREDIT_CARD"] = "credit_card";
1225
1219
  })(exports.OrderStatus || (exports.OrderStatus = {}));
1226
1220
 
1227
- var LineItem = /** @class */ (function (_super) {
1228
- __extends(LineItem, _super);
1229
- function LineItem() {
1230
- return _super !== null && _super.apply(this, arguments) || this;
1231
- }
1232
- return LineItem;
1221
+ var LineItem = /** @class */ (function (_super) {
1222
+ __extends(LineItem, _super);
1223
+ function LineItem() {
1224
+ return _super !== null && _super.apply(this, arguments) || this;
1225
+ }
1226
+ return LineItem;
1233
1227
  }(Product));
1234
1228
 
1235
- var ShippingMethod = /** @class */ (function (_super) {
1236
- __extends(ShippingMethod, _super);
1237
- function ShippingMethod() {
1238
- return _super !== null && _super.apply(this, arguments) || this;
1239
- }
1240
- ShippingMethod.prototype.identifierFields = function () {
1241
- return ['id'];
1242
- };
1243
- return ShippingMethod;
1229
+ var ShippingMethod = /** @class */ (function (_super) {
1230
+ __extends(ShippingMethod, _super);
1231
+ function ShippingMethod() {
1232
+ return _super !== null && _super.apply(this, arguments) || this;
1233
+ }
1234
+ ShippingMethod.prototype.identifierFields = function () {
1235
+ return ['id'];
1236
+ };
1237
+ return ShippingMethod;
1244
1238
  }(BaseModel));
1245
1239
 
1246
- var Checkout = /** @class */ (function (_super) {
1247
- __extends(Checkout, _super);
1248
- function Checkout() {
1249
- return _super !== null && _super.apply(this, arguments) || this;
1250
- }
1251
- Checkout.prototype.identifierFields = function () {
1252
- return ['id'];
1253
- };
1254
- return Checkout;
1255
- }(BaseModel));
1256
- __decorate([
1257
- classTransformer.Type(function () { return LineItem; }),
1258
- __metadata("design:type", Array)
1259
- ], Checkout.prototype, "lineItems", void 0);
1260
- __decorate([
1261
- classTransformer.Type(function () { return User; }),
1262
- __metadata("design:type", User)
1263
- ], Checkout.prototype, "user", void 0);
1264
- __decorate([
1265
- classTransformer.Type(function () { return Address; }),
1266
- __metadata("design:type", Address)
1267
- ], Checkout.prototype, "shippingAddress", void 0);
1268
- __decorate([
1269
- classTransformer.Type(function () { return Address; }),
1270
- __metadata("design:type", Address)
1271
- ], Checkout.prototype, "billingAddress", void 0);
1272
- __decorate([
1273
- classTransformer.Type(function () { return ShippingMethod; }),
1274
- __metadata("design:type", ShippingMethod)
1275
- ], Checkout.prototype, "shipping", void 0);
1276
- __decorate([
1277
- classTransformer.Type(function () { return Coupon; }),
1278
- __metadata("design:type", Coupon)
1240
+ var Checkout = /** @class */ (function (_super) {
1241
+ __extends(Checkout, _super);
1242
+ function Checkout() {
1243
+ return _super !== null && _super.apply(this, arguments) || this;
1244
+ }
1245
+ Checkout.prototype.identifierFields = function () {
1246
+ return ['id'];
1247
+ };
1248
+ return Checkout;
1249
+ }(BaseModel));
1250
+ __decorate([
1251
+ classTransformer.Type(function () { return LineItem; }),
1252
+ __metadata("design:type", Array)
1253
+ ], Checkout.prototype, "lineItems", void 0);
1254
+ __decorate([
1255
+ classTransformer.Type(function () { return User; }),
1256
+ __metadata("design:type", User)
1257
+ ], Checkout.prototype, "user", void 0);
1258
+ __decorate([
1259
+ classTransformer.Type(function () { return Address; }),
1260
+ __metadata("design:type", Address)
1261
+ ], Checkout.prototype, "shippingAddress", void 0);
1262
+ __decorate([
1263
+ classTransformer.Type(function () { return Address; }),
1264
+ __metadata("design:type", Address)
1265
+ ], Checkout.prototype, "billingAddress", void 0);
1266
+ __decorate([
1267
+ classTransformer.Type(function () { return ShippingMethod; }),
1268
+ __metadata("design:type", ShippingMethod)
1269
+ ], Checkout.prototype, "shipping", void 0);
1270
+ __decorate([
1271
+ classTransformer.Type(function () { return Coupon; }),
1272
+ __metadata("design:type", Coupon)
1279
1273
  ], Checkout.prototype, "coupon", void 0);
1280
1274
 
1281
- var Order = /** @class */ (function (_super) {
1282
- __extends(Order, _super);
1283
- function Order() {
1284
- return _super !== null && _super.apply(this, arguments) || this;
1285
- }
1286
- return Order;
1287
- }(Checkout));
1288
- __decorate([
1289
- classTransformer.Type(function () { return Payment; }),
1290
- __metadata("design:type", Payment)
1275
+ var Order = /** @class */ (function (_super) {
1276
+ __extends(Order, _super);
1277
+ function Order() {
1278
+ return _super !== null && _super.apply(this, arguments) || this;
1279
+ }
1280
+ return Order;
1281
+ }(Checkout));
1282
+ __decorate([
1283
+ classTransformer.Type(function () { return Payment; }),
1284
+ __metadata("design:type", Payment)
1291
1285
  ], Order.prototype, "payment", void 0);
1292
1286
 
1293
- var CheckoutSubscription = /** @class */ (function (_super) {
1294
- __extends(CheckoutSubscription, _super);
1295
- function CheckoutSubscription() {
1296
- return _super !== null && _super.apply(this, arguments) || this;
1297
- }
1298
- CheckoutSubscription.prototype.identifierFields = function () {
1299
- return ['id'];
1300
- };
1301
- return CheckoutSubscription;
1302
- }(BaseModel));
1303
- __decorate([
1304
- classTransformer.Type(function () { return Address; }),
1305
- __metadata("design:type", Address)
1306
- ], CheckoutSubscription.prototype, "shippingAddress", void 0);
1307
- __decorate([
1308
- classTransformer.Type(function () { return Address; }),
1309
- __metadata("design:type", Address)
1310
- ], CheckoutSubscription.prototype, "billingAddress", void 0);
1311
- __decorate([
1312
- classTransformer.Type(function () { return SubscriptionPlan; }),
1313
- __metadata("design:type", SubscriptionPlan)
1314
- ], CheckoutSubscription.prototype, "subscriptionPlan", void 0);
1315
- __decorate([
1316
- classTransformer.Type(function () { return Coupon; }),
1317
- __metadata("design:type", Coupon)
1287
+ var CheckoutSubscription = /** @class */ (function (_super) {
1288
+ __extends(CheckoutSubscription, _super);
1289
+ function CheckoutSubscription() {
1290
+ return _super !== null && _super.apply(this, arguments) || this;
1291
+ }
1292
+ CheckoutSubscription.prototype.identifierFields = function () {
1293
+ return ['id'];
1294
+ };
1295
+ return CheckoutSubscription;
1296
+ }(BaseModel));
1297
+ __decorate([
1298
+ classTransformer.Type(function () { return Address; }),
1299
+ __metadata("design:type", Address)
1300
+ ], CheckoutSubscription.prototype, "shippingAddress", void 0);
1301
+ __decorate([
1302
+ classTransformer.Type(function () { return Address; }),
1303
+ __metadata("design:type", Address)
1304
+ ], CheckoutSubscription.prototype, "billingAddress", void 0);
1305
+ __decorate([
1306
+ classTransformer.Type(function () { return SubscriptionPlan; }),
1307
+ __metadata("design:type", SubscriptionPlan)
1308
+ ], CheckoutSubscription.prototype, "subscriptionPlan", void 0);
1309
+ __decorate([
1310
+ classTransformer.Type(function () { return Coupon; }),
1311
+ __metadata("design:type", Coupon)
1318
1312
  ], CheckoutSubscription.prototype, "coupon", void 0);
1319
1313
 
1320
- var Buy2Win = /** @class */ (function (_super) {
1321
- __extends(Buy2Win, _super);
1322
- function Buy2Win() {
1323
- return _super !== null && _super.apply(this, arguments) || this;
1324
- }
1325
- Buy2Win.prototype.identifierFields = function () {
1326
- return ['id'];
1327
- };
1328
- return Buy2Win;
1329
- }(BaseModel));
1330
- __decorate([
1331
- classTransformer.Type(function () { return Category; }),
1332
- __metadata("design:type", Array)
1314
+ var Buy2Win = /** @class */ (function (_super) {
1315
+ __extends(Buy2Win, _super);
1316
+ function Buy2Win() {
1317
+ return _super !== null && _super.apply(this, arguments) || this;
1318
+ }
1319
+ Buy2Win.prototype.identifierFields = function () {
1320
+ return ['id'];
1321
+ };
1322
+ return Buy2Win;
1323
+ }(BaseModel));
1324
+ __decorate([
1325
+ classTransformer.Type(function () { return Category; }),
1326
+ __metadata("design:type", Array)
1333
1327
  ], Buy2Win.prototype, "categories", void 0);
1334
1328
 
1335
- exports.FilterType = void 0;
1336
- (function (FilterType) {
1337
- FilterType["ACCESSORY_IMPORTANCE"] = "accessoryImportance";
1338
- FilterType["BEARD_PROBLEMS"] = "beardProblems";
1339
- FilterType["BEARD_SIZE"] = "beardSize";
1340
- FilterType["BEAUTY_PRODUCT_IMPORTANCE"] = "beautyProductImportance";
1341
- FilterType["BODY_PROBLEMS"] = "bodyProblems";
1342
- FilterType["BODY_SHAPE"] = "bodyShape";
1343
- FilterType["BODY_TATTOOS"] = "bodyTattoos";
1344
- FilterType["FACE_SKIN_OILINESS"] = "faceSkinOiliness";
1345
- FilterType["FACE_SKIN_PROBLEMS"] = "faceSkinProblems";
1346
- FilterType["FACE_SKIN_TONE"] = "faceSkinTone";
1347
- FilterType["FAMILY_INCOME"] = "familyIncome";
1348
- FilterType["FRAGRANCE_IMPORTANCE"] = "fragranceImportance";
1349
- FilterType["HAIR_COLOR"] = "hairColor";
1350
- FilterType["HAIR_PROBLEMS"] = "hairProblems";
1351
- FilterType["HAIR_STRANDS"] = "hairStrands";
1352
- FilterType["HAIR_TYPE"] = "hairType";
1353
- FilterType["PRODUCT_SPENT"] = "productSpent";
1329
+ exports.FilterType = void 0;
1330
+ (function (FilterType) {
1331
+ FilterType["ACCESSORY_IMPORTANCE"] = "accessoryImportance";
1332
+ FilterType["BEARD_PROBLEMS"] = "beardProblems";
1333
+ FilterType["BEARD_SIZE"] = "beardSize";
1334
+ FilterType["BEAUTY_PRODUCT_IMPORTANCE"] = "beautyProductImportance";
1335
+ FilterType["BODY_PROBLEMS"] = "bodyProblems";
1336
+ FilterType["BODY_SHAPE"] = "bodyShape";
1337
+ FilterType["BODY_TATTOOS"] = "bodyTattoos";
1338
+ FilterType["FACE_SKIN_OILINESS"] = "faceSkinOiliness";
1339
+ FilterType["FACE_SKIN_PROBLEMS"] = "faceSkinProblems";
1340
+ FilterType["FACE_SKIN_TONE"] = "faceSkinTone";
1341
+ FilterType["FAMILY_INCOME"] = "familyIncome";
1342
+ FilterType["FRAGRANCE_IMPORTANCE"] = "fragranceImportance";
1343
+ FilterType["HAIR_COLOR"] = "hairColor";
1344
+ FilterType["HAIR_PROBLEMS"] = "hairProblems";
1345
+ FilterType["HAIR_STRANDS"] = "hairStrands";
1346
+ FilterType["HAIR_TYPE"] = "hairType";
1347
+ FilterType["PRODUCT_SPENT"] = "productSpent";
1354
1348
  })(exports.FilterType || (exports.FilterType = {}));
1355
1349
 
1356
- exports.QuestionsFilters = void 0;
1357
- (function (QuestionsFilters) {
1358
- QuestionsFilters["ACCESSORY_IMPORTANCE"] = "Voc\u00EA gosta de usar acess\u00F3rios masculinos?";
1359
- QuestionsFilters["BEARD_PROBLEMS"] = "Quais problemas de barba voc\u00EA tem?";
1360
- QuestionsFilters["BEARD_SIZE"] = "Quais caracteristicas se aplicam \u00E0 sua BARBA/BIGODE?";
1361
- QuestionsFilters["BEAUTY_PRODUCT_IMPORTANCE"] = "O que descreve melhor a sua rela\u00E7\u00E3o com produtos de beleza e cuidados pessoais?";
1362
- QuestionsFilters["BODY_PROBLEMS"] = "Qual ou quais preocupa\u00E7\u00F5es voc\u00EA tem com a pele do seu corpo?";
1363
- QuestionsFilters["BODY_SHAPE"] = "Qual e seu tipo de CORPO?";
1364
- QuestionsFilters["BODY_TATTOOS"] = "Voc\u00EA tem alguma tatuagem?";
1365
- QuestionsFilters["FACE_SKIN_OILINESS"] = "Quais caracteristicas se aplicam \u00E0 pele do seu ROSTO?";
1366
- QuestionsFilters["FACE_SKIN_PROBLEMS"] = "Quais problemas a pele do seu rosto tem?";
1367
- QuestionsFilters["FACE_SKIN_TONE"] = "Qual seu tom de pele?";
1368
- QuestionsFilters["FAMILY_INCOME"] = "Qual a sua renda familiar mensal (considerando a renda de todas as pessoas que moram com voc\u00EA)?";
1369
- QuestionsFilters["FRAGRANCE_IMPORTANCE"] = "O quanto voc\u00EA gosta de experimentar perfumes?";
1370
- QuestionsFilters["HAIR_COLOR"] = "Seu cabelo \u00E9 naturalmente de qual COR?";
1371
- QuestionsFilters["HAIR_PROBLEMS"] = "Qual ou quais problemas/caracter\u00EDstica de cabelo te preocupam?";
1372
- QuestionsFilters["HAIR_STRANDS"] = "Como s\u00E3o seus fios?";
1373
- QuestionsFilters["HAIR_TYPE"] = "Como \u00E9 o seu cabelo?";
1374
- QuestionsFilters["PRODUCT_SPENT"] = "Qual \u00E9 o seu nivel de gasto mensal em produtos de beleza e cuidados pessoais?";
1350
+ exports.QuestionsFilters = void 0;
1351
+ (function (QuestionsFilters) {
1352
+ QuestionsFilters["ACCESSORY_IMPORTANCE"] = "Voc\u00EA gosta de usar acess\u00F3rios masculinos?";
1353
+ QuestionsFilters["BEARD_PROBLEMS"] = "Quais problemas de barba voc\u00EA tem?";
1354
+ QuestionsFilters["BEARD_SIZE"] = "Quais caracteristicas se aplicam \u00E0 sua BARBA/BIGODE?";
1355
+ QuestionsFilters["BEAUTY_PRODUCT_IMPORTANCE"] = "O que descreve melhor a sua rela\u00E7\u00E3o com produtos de beleza e cuidados pessoais?";
1356
+ QuestionsFilters["BODY_PROBLEMS"] = "Qual ou quais preocupa\u00E7\u00F5es voc\u00EA tem com a pele do seu corpo?";
1357
+ QuestionsFilters["BODY_SHAPE"] = "Qual e seu tipo de CORPO?";
1358
+ QuestionsFilters["BODY_TATTOOS"] = "Voc\u00EA tem alguma tatuagem?";
1359
+ QuestionsFilters["FACE_SKIN_OILINESS"] = "Quais caracteristicas se aplicam \u00E0 pele do seu ROSTO?";
1360
+ QuestionsFilters["FACE_SKIN_PROBLEMS"] = "Quais problemas a pele do seu rosto tem?";
1361
+ QuestionsFilters["FACE_SKIN_TONE"] = "Qual seu tom de pele?";
1362
+ QuestionsFilters["FAMILY_INCOME"] = "Qual a sua renda familiar mensal (considerando a renda de todas as pessoas que moram com voc\u00EA)?";
1363
+ QuestionsFilters["FRAGRANCE_IMPORTANCE"] = "O quanto voc\u00EA gosta de experimentar perfumes?";
1364
+ QuestionsFilters["HAIR_COLOR"] = "Seu cabelo \u00E9 naturalmente de qual COR?";
1365
+ QuestionsFilters["HAIR_PROBLEMS"] = "Qual ou quais problemas/caracter\u00EDstica de cabelo te preocupam?";
1366
+ QuestionsFilters["HAIR_STRANDS"] = "Como s\u00E3o seus fios?";
1367
+ QuestionsFilters["HAIR_TYPE"] = "Como \u00E9 o seu cabelo?";
1368
+ QuestionsFilters["PRODUCT_SPENT"] = "Qual \u00E9 o seu nivel de gasto mensal em produtos de beleza e cuidados pessoais?";
1375
1369
  })(exports.QuestionsFilters || (exports.QuestionsFilters = {}));
1376
1370
 
1377
- var BeautyQuestionsHelper = /** @class */ (function () {
1378
- function BeautyQuestionsHelper() {
1379
- }
1380
- BeautyQuestionsHelper.getAnswers = function (filter) {
1381
- switch (filter) {
1382
- case exports.FilterType.ACCESSORY_IMPORTANCE:
1383
- return exports.AccessoryImportances;
1384
- case exports.FilterType.BEARD_PROBLEMS:
1385
- return exports.BeardProblems;
1386
- case exports.FilterType.BEARD_SIZE:
1387
- return exports.BeardSizes;
1388
- case exports.FilterType.BEAUTY_PRODUCT_IMPORTANCE:
1389
- return exports.BeautyProductImportances;
1390
- case exports.FilterType.BODY_PROBLEMS:
1391
- return exports.BodyProblems;
1392
- case exports.FilterType.BODY_SHAPE:
1393
- return exports.BodyShapes;
1394
- case exports.FilterType.BODY_TATTOOS:
1395
- return exports.BodyTattoos;
1396
- case exports.FilterType.FACE_SKIN_OILINESS:
1397
- return exports.FaceSkinOilinesses;
1398
- case exports.FilterType.FACE_SKIN_PROBLEMS:
1399
- return exports.FaceSkinProblems;
1400
- case exports.FilterType.FACE_SKIN_TONE:
1401
- return exports.FaceSkinTones;
1402
- case exports.FilterType.FAMILY_INCOME:
1403
- return exports.FamilyIncomes;
1404
- case exports.FilterType.FRAGRANCE_IMPORTANCE:
1405
- return exports.FragranceImportances;
1406
- case exports.FilterType.HAIR_COLOR:
1407
- return exports.HairColors;
1408
- case exports.FilterType.HAIR_PROBLEMS:
1409
- return exports.HairProblems;
1410
- case exports.FilterType.HAIR_STRANDS:
1411
- return exports.HairStrands;
1412
- case exports.FilterType.HAIR_TYPE:
1413
- return exports.HairTypes;
1414
- case exports.FilterType.PRODUCT_SPENT:
1415
- return exports.ProductSpents;
1416
- }
1417
- };
1418
- BeautyQuestionsHelper.getQuestions = function (filter) {
1419
- return exports.QuestionsFilters[filter];
1420
- };
1421
- return BeautyQuestionsHelper;
1371
+ var BeautyQuestionsHelper = /** @class */ (function () {
1372
+ function BeautyQuestionsHelper() {
1373
+ }
1374
+ BeautyQuestionsHelper.getAnswers = function (filter) {
1375
+ switch (filter) {
1376
+ case exports.FilterType.ACCESSORY_IMPORTANCE:
1377
+ return exports.AccessoryImportances;
1378
+ case exports.FilterType.BEARD_PROBLEMS:
1379
+ return exports.BeardProblems;
1380
+ case exports.FilterType.BEARD_SIZE:
1381
+ return exports.BeardSizes;
1382
+ case exports.FilterType.BEAUTY_PRODUCT_IMPORTANCE:
1383
+ return exports.BeautyProductImportances;
1384
+ case exports.FilterType.BODY_PROBLEMS:
1385
+ return exports.BodyProblems;
1386
+ case exports.FilterType.BODY_SHAPE:
1387
+ return exports.BodyShapes;
1388
+ case exports.FilterType.BODY_TATTOOS:
1389
+ return exports.BodyTattoos;
1390
+ case exports.FilterType.FACE_SKIN_OILINESS:
1391
+ return exports.FaceSkinOilinesses;
1392
+ case exports.FilterType.FACE_SKIN_PROBLEMS:
1393
+ return exports.FaceSkinProblems;
1394
+ case exports.FilterType.FACE_SKIN_TONE:
1395
+ return exports.FaceSkinTones;
1396
+ case exports.FilterType.FAMILY_INCOME:
1397
+ return exports.FamilyIncomes;
1398
+ case exports.FilterType.FRAGRANCE_IMPORTANCE:
1399
+ return exports.FragranceImportances;
1400
+ case exports.FilterType.HAIR_COLOR:
1401
+ return exports.HairColors;
1402
+ case exports.FilterType.HAIR_PROBLEMS:
1403
+ return exports.HairProblems;
1404
+ case exports.FilterType.HAIR_STRANDS:
1405
+ return exports.HairStrands;
1406
+ case exports.FilterType.HAIR_TYPE:
1407
+ return exports.HairTypes;
1408
+ case exports.FilterType.PRODUCT_SPENT:
1409
+ return exports.ProductSpents;
1410
+ }
1411
+ };
1412
+ BeautyQuestionsHelper.getQuestions = function (filter) {
1413
+ return exports.QuestionsFilters[filter];
1414
+ };
1415
+ return BeautyQuestionsHelper;
1422
1416
  }());
1423
1417
 
1424
- var Home = /** @class */ (function (_super) {
1425
- __extends(Home, _super);
1426
- function Home() {
1427
- return _super !== null && _super.apply(this, arguments) || this;
1428
- }
1429
- Home.prototype.identifierFields = function () {
1430
- return ['id'];
1431
- };
1432
- return Home;
1418
+ var Home = /** @class */ (function (_super) {
1419
+ __extends(Home, _super);
1420
+ function Home() {
1421
+ return _super !== null && _super.apply(this, arguments) || this;
1422
+ }
1423
+ Home.prototype.identifierFields = function () {
1424
+ return ['id'];
1425
+ };
1426
+ return Home;
1433
1427
  }(BaseModel));
1434
1428
 
1435
- var ShopMenu = /** @class */ (function (_super) {
1436
- __extends(ShopMenu, _super);
1437
- function ShopMenu() {
1438
- return _super !== null && _super.apply(this, arguments) || this;
1439
- }
1440
- ShopMenu.prototype.identifierFields = function () {
1441
- return ['id'];
1442
- };
1443
- return ShopMenu;
1429
+ var ShopMenu = /** @class */ (function (_super) {
1430
+ __extends(ShopMenu, _super);
1431
+ function ShopMenu() {
1432
+ return _super !== null && _super.apply(this, arguments) || this;
1433
+ }
1434
+ ShopMenu.prototype.identifierFields = function () {
1435
+ return ['id'];
1436
+ };
1437
+ return ShopMenu;
1444
1438
  }(BaseModel));
1445
1439
 
1446
- var InvalidArgumentError = /** @class */ (function (_super) {
1447
- __extends(InvalidArgumentError, _super);
1448
- function InvalidArgumentError(message) {
1449
- var _this = _super.call(this, message) || this;
1450
- _this.message = message;
1451
- return _this;
1452
- }
1453
- return InvalidArgumentError;
1440
+ var InvalidArgumentError = /** @class */ (function (_super) {
1441
+ __extends(InvalidArgumentError, _super);
1442
+ function InvalidArgumentError(message) {
1443
+ var _this = _super.call(this, message) || this;
1444
+ _this.message = message;
1445
+ return _this;
1446
+ }
1447
+ return InvalidArgumentError;
1454
1448
  }(Error));
1455
1449
 
1456
- var RequiredArgumentError = /** @class */ (function (_super) {
1457
- __extends(RequiredArgumentError, _super);
1458
- function RequiredArgumentError(args) {
1459
- var _this = _super.call(this, "Required arguments: " + args.join(', ')) || this;
1460
- _this.args = args;
1461
- _this.arguments = args;
1462
- return _this;
1463
- }
1464
- return RequiredArgumentError;
1450
+ var RequiredArgumentError = /** @class */ (function (_super) {
1451
+ __extends(RequiredArgumentError, _super);
1452
+ function RequiredArgumentError(args) {
1453
+ var _this = _super.call(this, "Required arguments: " + args.join(', ')) || this;
1454
+ _this.args = args;
1455
+ _this.arguments = args;
1456
+ return _this;
1457
+ }
1458
+ return RequiredArgumentError;
1465
1459
  }(Error));
1466
1460
 
1467
- var NotFoundError = /** @class */ (function (_super) {
1468
- __extends(NotFoundError, _super);
1469
- function NotFoundError(message) {
1470
- var _this = _super.call(this, message) || this;
1471
- _this.message = message;
1472
- return _this;
1473
- }
1474
- return NotFoundError;
1461
+ var NotFoundError = /** @class */ (function (_super) {
1462
+ __extends(NotFoundError, _super);
1463
+ function NotFoundError(message) {
1464
+ var _this = _super.call(this, message) || this;
1465
+ _this.message = message;
1466
+ return _this;
1467
+ }
1468
+ return NotFoundError;
1475
1469
  }(Error));
1476
1470
 
1477
- var DuplicatedResultsError = /** @class */ (function (_super) {
1478
- __extends(DuplicatedResultsError, _super);
1479
- function DuplicatedResultsError(message) {
1480
- var _this = _super.call(this, message) || this;
1481
- _this.message = message;
1482
- return _this;
1483
- }
1484
- return DuplicatedResultsError;
1471
+ var DuplicatedResultsError = /** @class */ (function (_super) {
1472
+ __extends(DuplicatedResultsError, _super);
1473
+ function DuplicatedResultsError(message) {
1474
+ var _this = _super.call(this, message) || this;
1475
+ _this.message = message;
1476
+ return _this;
1477
+ }
1478
+ return DuplicatedResultsError;
1485
1479
  }(Error));
1486
1480
 
1487
- var AxiosAdapter = /** @class */ (function () {
1488
- function AxiosAdapter(config) {
1489
- this.config = config;
1490
- }
1491
- AxiosAdapter.prototype.query = function (index, query) {
1492
- return __awaiter(this, void 0, void 0, function () {
1493
- var data;
1494
- return __generator(this, function (_a) {
1495
- switch (_a.label) {
1496
- case 0: return [4 /*yield*/, axios__default["default"]({
1497
- url: this.config.url + "/" + index,
1498
- method: 'POST',
1499
- headers: { Authorization: "Basic " + this.config.credential },
1500
- data: query,
1501
- })];
1502
- case 1:
1503
- data = (_a.sent()).data;
1504
- return [2 /*return*/, {
1505
- total: data.hits.total.value,
1506
- hits: data.hits.hits,
1507
- }];
1508
- }
1509
- });
1510
- });
1511
- };
1512
- return AxiosAdapter;
1481
+ var AxiosAdapter = /** @class */ (function () {
1482
+ function AxiosAdapter(config) {
1483
+ this.config = config;
1484
+ }
1485
+ AxiosAdapter.prototype.query = function (index, query) {
1486
+ return __awaiter(this, void 0, void 0, function () {
1487
+ var data;
1488
+ return __generator(this, function (_a) {
1489
+ switch (_a.label) {
1490
+ case 0: return [4 /*yield*/, axios__default["default"]({
1491
+ url: this.config.url + "/" + index,
1492
+ method: 'POST',
1493
+ headers: { Authorization: "Basic " + this.config.credential },
1494
+ data: query,
1495
+ })];
1496
+ case 1:
1497
+ data = (_a.sent()).data;
1498
+ return [2 /*return*/, {
1499
+ total: data.hits.total.value,
1500
+ hits: data.hits.hits,
1501
+ }];
1502
+ }
1503
+ });
1504
+ });
1505
+ };
1506
+ return AxiosAdapter;
1513
1507
  }());
1514
1508
 
1515
- var ProductsIndex = /** @class */ (function () {
1516
- function ProductsIndex(adapter) {
1517
- this.adapter = adapter;
1518
- }
1519
- ProductsIndex.prototype.findById = function (ids, options) {
1520
- return __awaiter(this, void 0, void 0, function () {
1521
- var publishedField, fields, hits;
1522
- var _a;
1523
- return __generator(this, function (_b) {
1524
- switch (_b.label) {
1525
- case 0:
1526
- publishedField = options.shop === exports.Shops.GLAMSHOP ? 'publishedGlam' : 'published';
1527
- fields = [
1528
- 'brand',
1529
- 'id',
1530
- 'images',
1531
- 'miniatures',
1532
- 'name',
1533
- 'price',
1534
- 'sku',
1535
- 'stock',
1536
- 'slug',
1537
- 'reviews',
1538
- 'pricePaid',
1539
- 'isGift',
1540
- 'stock',
1541
- 'weight',
1542
- 'tags',
1543
- 'hasVariants',
1544
- ];
1545
- return [4 /*yield*/, this.adapter.query('products/_search', Object.assign({ _source: fields, query: {
1546
- bool: {
1547
- filter: __spreadArray([
1548
- {
1549
- terms: {
1550
- _id: ids,
1551
- },
1552
- },
1553
- {
1554
- term: (_a = {},
1555
- _a[publishedField] = true,
1556
- _a),
1557
- }
1558
- ], __read((options.hasStock
1559
- ? [
1560
- {
1561
- range: {
1562
- 'stock.quantity': {
1563
- gt: 0,
1564
- },
1565
- },
1566
- },
1567
- ]
1568
- : []))),
1569
- },
1570
- } }, (options.size ? { size: options.size } : {})))];
1571
- case 1:
1572
- hits = (_b.sent()).hits;
1573
- return [2 /*return*/, hits.map(function (hit) { return Product.toInstance(hit._source); })];
1574
- }
1575
- });
1576
- });
1577
- };
1578
- return ProductsIndex;
1509
+ var ProductsIndex = /** @class */ (function () {
1510
+ function ProductsIndex(adapter) {
1511
+ this.adapter = adapter;
1512
+ }
1513
+ ProductsIndex.prototype.findById = function (ids, options) {
1514
+ return __awaiter(this, void 0, void 0, function () {
1515
+ var publishedField, fields, hits;
1516
+ var _a;
1517
+ return __generator(this, function (_b) {
1518
+ switch (_b.label) {
1519
+ case 0:
1520
+ publishedField = options.shop === exports.Shops.GLAMSHOP ? 'publishedGlam' : 'published';
1521
+ fields = [
1522
+ 'brand',
1523
+ 'id',
1524
+ 'images',
1525
+ 'miniatures',
1526
+ 'name',
1527
+ 'price',
1528
+ 'sku',
1529
+ 'stock',
1530
+ 'slug',
1531
+ 'reviews',
1532
+ 'pricePaid',
1533
+ 'isGift',
1534
+ 'stock',
1535
+ 'weight',
1536
+ 'tags',
1537
+ 'hasVariants',
1538
+ ];
1539
+ return [4 /*yield*/, this.adapter.query('products/_search', Object.assign({ _source: fields, query: {
1540
+ bool: {
1541
+ filter: __spreadArray([
1542
+ {
1543
+ terms: {
1544
+ _id: ids,
1545
+ },
1546
+ },
1547
+ {
1548
+ term: (_a = {},
1549
+ _a[publishedField] = true,
1550
+ _a),
1551
+ }
1552
+ ], __read((options.hasStock
1553
+ ? [
1554
+ {
1555
+ range: {
1556
+ 'stock.quantity': {
1557
+ gt: 0,
1558
+ },
1559
+ },
1560
+ },
1561
+ ]
1562
+ : []))),
1563
+ },
1564
+ } }, (options.size ? { size: options.size } : {})))];
1565
+ case 1:
1566
+ hits = (_b.sent()).hits;
1567
+ return [2 /*return*/, hits.map(function (hit) { return Product.toInstance(hit._source); })];
1568
+ }
1569
+ });
1570
+ });
1571
+ };
1572
+ return ProductsIndex;
1579
1573
  }());
1580
1574
 
1581
- var withFirestore = function (MixinBase) {
1582
- return /** @class */ (function (_super) {
1583
- __extends(class_1, _super);
1584
- function class_1() {
1585
- var args = [];
1586
- for (var _i = 0; _i < arguments.length; _i++) {
1587
- args[_i] = arguments[_i];
1588
- }
1589
- return _super.call(this, args) || this;
1590
- }
1591
- class_1.prototype.collection = function (path) {
1592
- return firestore.collection(this.firestore, path || this.collectionName).withConverter(this.buildModelInstance());
1593
- };
1594
- class_1.prototype.buildModelInstance = function () {
1595
- var _this = this;
1596
- return {
1597
- toFirestore: function (data) { return ((data === null || data === void 0 ? void 0 : data.toPlain) ? data.toPlain() : data); },
1598
- fromFirestore: function (snap) {
1599
- var data = snap.data();
1600
- Object.keys(data).forEach(function (key) {
1601
- if (data[key] instanceof firestore.Timestamp) {
1602
- data[key] = data[key].toDate();
1603
- }
1604
- });
1605
- return _this.model.toInstance(Object.assign(Object.assign({}, data), { id: snap.id }));
1606
- },
1607
- };
1608
- };
1609
- return class_1;
1610
- }(MixinBase));
1575
+ var withFirestore = function (MixinBase) {
1576
+ return /** @class */ (function (_super) {
1577
+ __extends(class_1, _super);
1578
+ function class_1() {
1579
+ var args = [];
1580
+ for (var _i = 0; _i < arguments.length; _i++) {
1581
+ args[_i] = arguments[_i];
1582
+ }
1583
+ return _super.call(this, args) || this;
1584
+ }
1585
+ class_1.prototype.collection = function (path) {
1586
+ return this.firestore.collection(path || this.collectionName).withConverter(this.buildModelInstance());
1587
+ };
1588
+ class_1.prototype.buildModelInstance = function () {
1589
+ var _this = this;
1590
+ return {
1591
+ toFirestore: function (data) { return ((data === null || data === void 0 ? void 0 : data.toPlain) ? data.toPlain() : data); },
1592
+ fromFirestore: function (snap) {
1593
+ var data = snap.data();
1594
+ Object.keys(data).forEach(function (key) {
1595
+ if (data[key] instanceof firebase__default["default"].firestore.Timestamp) {
1596
+ data[key] = data[key].toDate();
1597
+ }
1598
+ });
1599
+ return _this.model.toInstance(Object.assign(Object.assign({}, data), { id: snap.id }));
1600
+ },
1601
+ };
1602
+ };
1603
+ return class_1;
1604
+ }(MixinBase));
1611
1605
  };
1612
1606
 
1613
- var withHelpers = function (MixinBase) {
1614
- return /** @class */ (function (_super) {
1615
- __extends(class_1, _super);
1616
- function class_1() {
1617
- return _super !== null && _super.apply(this, arguments) || this;
1618
- }
1619
- class_1.prototype.toArray = function (snapShot) {
1620
- if (Array.isArray(snapShot)) {
1621
- return snapShot.map(function (doc) { return doc.data(); });
1622
- }
1623
- else {
1624
- return snapShot.docs.map(function (doc) { return doc.data(); });
1625
- }
1626
- };
1627
- class_1.prototype.isSubCollection = function (repository) {
1628
- return !isNil(Object.keys(this).find(function (key) { return key === 'parentRepository'; }));
1629
- };
1630
- return class_1;
1631
- }(MixinBase));
1607
+ var withHelpers = function (MixinBase) {
1608
+ return /** @class */ (function (_super) {
1609
+ __extends(class_1, _super);
1610
+ function class_1() {
1611
+ return _super !== null && _super.apply(this, arguments) || this;
1612
+ }
1613
+ class_1.prototype.toArray = function (snapShot) {
1614
+ if (Array.isArray(snapShot)) {
1615
+ return snapShot.map(function (doc) { return doc.data(); });
1616
+ }
1617
+ else {
1618
+ return snapShot.docs.map(function (doc) { return doc.data(); });
1619
+ }
1620
+ };
1621
+ class_1.prototype.isSubCollection = function (repository) {
1622
+ return !lodash.isNil(Object.keys(this).find(function (key) { return key === 'parentRepository'; }));
1623
+ };
1624
+ return class_1;
1625
+ }(MixinBase));
1632
1626
  };
1633
1627
 
1634
- var withGetFirestore = function (MixinBase) {
1635
- return /** @class */ (function (_super) {
1636
- __extends(GetFirestore, _super);
1637
- function GetFirestore() {
1638
- return _super !== null && _super.apply(this, arguments) || this;
1639
- }
1640
- GetFirestore.prototype.get = function (identifiers) {
1641
- return __awaiter(this, void 0, void 0, function () {
1642
- var docRef, _a, _b, data;
1643
- return __generator(this, function (_c) {
1644
- switch (_c.label) {
1645
- case 0:
1646
- _a = firestore.getDoc;
1647
- _b = firestore.doc;
1648
- return [4 /*yield*/, this.collection(this.buildCollectionPathForGet(identifiers))];
1649
- case 1: return [4 /*yield*/, _a.apply(void 0, [_b.apply(void 0, [_c.sent(), Object.values(identifiers).shift().toString()])])];
1650
- case 2:
1651
- docRef = _c.sent();
1652
- data = docRef.data();
1653
- if (isNil(data))
1654
- throw new NotFoundError("Document " + JSON.stringify(identifiers) + " not found");
1655
- return [2 /*return*/, data];
1656
- }
1657
- });
1658
- });
1659
- };
1660
- GetFirestore.prototype.buildCollectionPathForGet = function (identifiers) {
1661
- return this.isSubCollection(this)
1662
- ? this.parentRepository.collectionName + "/" + identifiers[this.parentIdField] + "/" + this.collectionName
1663
- : this.collectionName;
1664
- };
1665
- return GetFirestore;
1666
- }(MixinBase));
1628
+ var withGetFirestore = function (MixinBase) {
1629
+ return /** @class */ (function (_super) {
1630
+ __extends(GetFirestore, _super);
1631
+ function GetFirestore() {
1632
+ return _super !== null && _super.apply(this, arguments) || this;
1633
+ }
1634
+ GetFirestore.prototype.get = function (identifiers) {
1635
+ return __awaiter(this, void 0, void 0, function () {
1636
+ var doc, data;
1637
+ return __generator(this, function (_a) {
1638
+ switch (_a.label) {
1639
+ case 0: return [4 /*yield*/, this.collection(this.buildCollectionPathForGet(identifiers))
1640
+ .doc(Object.values(identifiers).shift().toString())
1641
+ .get()];
1642
+ case 1:
1643
+ doc = _a.sent();
1644
+ data = doc.data();
1645
+ if (lodash.isNil(data))
1646
+ throw new NotFoundError("Document " + JSON.stringify(identifiers) + " not found");
1647
+ return [2 /*return*/, data];
1648
+ }
1649
+ });
1650
+ });
1651
+ };
1652
+ GetFirestore.prototype.buildCollectionPathForGet = function (identifiers) {
1653
+ return this.isSubCollection(this)
1654
+ ? this.parentRepository.collectionName + "/" + identifiers[this.parentIdField] + "/" + this.collectionName
1655
+ : this.collectionName;
1656
+ };
1657
+ return GetFirestore;
1658
+ }(MixinBase));
1667
1659
  };
1668
1660
 
1669
- var withFindFirestore = function (MixinBase) {
1670
- var checkIfIsFilterOption = function (filter) { return !isNil(filter === null || filter === void 0 ? void 0 : filter.operator); };
1671
- var getValueFromFilter = function (filter) {
1672
- return checkIfIsFilterOption(filter) ? filter.value : filter;
1673
- };
1674
- var getFinalValueFrom = function (value) { return isNumber(value) || isString(value) || isDate(value) || Array.isArray(value)
1675
- ? value
1676
- : Object.values(getFinalValueFrom); };
1677
- return /** @class */ (function (_super) {
1678
- __extends(FindFirestore, _super);
1679
- function FindFirestore() {
1680
- var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
1681
- _this.makeFirestoreWhere = function (filter) { return Object.keys(filter).reduce(function (queries, fieldName) { return __spreadArray(__spreadArray([], __read(queries)), __read(_this.buildWhereSentence(fieldName, filter[fieldName]))); }, []); };
1682
- _this.buildWhereSentence = function (fieldName, options) {
1683
- if (_this.isSubCollection(_this) && fieldName === _this.parentIdField)
1684
- [];
1685
- var value = (options === null || options === void 0 ? void 0 : options.value) || options;
1686
- var object = {};
1687
- set(object, fieldName, value);
1688
- var plainInstance = new _this.model(object).toPlain();
1689
- var firestoreFieldName = fieldName.toString().indexOf('.') > -1
1690
- ? fieldName.toString()
1691
- : Object.keys(plainInstance).find(function (key) { return plainInstance[key]; });
1692
- if ((options === null || options === void 0 ? void 0 : options.operator) === exports.Where.LIKE) {
1693
- if (Array.isArray(options === null || options === void 0 ? void 0 : options.value))
1694
- return [firestore.where(firestoreFieldName, 'array-contains-any', options.value)];
1695
- return [firestore.where(firestoreFieldName, '>=', options.value), firestore.where(firestoreFieldName, '<=', options.value + "~")];
1696
- }
1697
- if ((options === null || options === void 0 ? void 0 : options.operator) === exports.Where.IN && Array.isArray(options === null || options === void 0 ? void 0 : options.value))
1698
- return [firestore.where(firestoreFieldName, 'array-contains', options.value)];
1699
- if (isObject(options) && isNil(options === null || options === void 0 ? void 0 : options.operator) && isNil(options === null || options === void 0 ? void 0 : options.value)) {
1700
- return Object.keys(options).reduce(function (queries, key) { return __spreadArray(__spreadArray([], __read(queries)), __read(_this.buildWhereSentence(fieldName.toString() + "." + key, options[key]))); }, []);
1701
- }
1702
- return [firestore.where(firestoreFieldName, (options === null || options === void 0 ? void 0 : options.operator) || '==', (options === null || options === void 0 ? void 0 : options.value) || options)];
1703
- };
1704
- return _this;
1705
- }
1706
- FindFirestore.prototype.find = function (filters, limitList, orderByList) {
1707
- return __awaiter(this, void 0, void 0, function () {
1708
- var collection, queries, ordination, limits, queryArgumments, docs, data;
1709
- var _this = this;
1710
- return __generator(this, function (_b) {
1711
- switch (_b.label) {
1712
- case 0:
1713
- collection = this.collection(this.buildCollectionPathForFind(filters));
1714
- queries = (filters === null || filters === void 0 ? void 0 : filters.reduce(function (queriesBuilded, filterer) { return __spreadArray(__spreadArray([], __read(queriesBuilded)), __read(_this.makeFirestoreWhere(filterer))); }, [])) ||
1715
- [];
1716
- ordination = (orderByList === null || orderByList === void 0 ? void 0 : orderByList.reduce(function (ordinationBuilded, sort) { return __spreadArray(__spreadArray([], __read(ordinationBuilded)), __read(Object.keys(sort).map(function (fieldName) { return firestore.orderBy(fieldName, sort[fieldName]); }))); }, [])) || [];
1717
- return [4 /*yield*/, this.defineLimits(filters, limitList)];
1718
- case 1:
1719
- limits = _b.sent();
1720
- queryArgumments = __spreadArray(__spreadArray(__spreadArray([], __read(queries)), __read(ordination)), __read(limits));
1721
- return [4 /*yield*/, firestore.getDocs(firestore.query.apply(void 0, __spreadArray([collection], __read(queryArgumments))))];
1722
- case 2:
1723
- docs = _b.sent();
1724
- data = docs.docs.map(function (doc) { return doc.data(); });
1725
- return [2 /*return*/, {
1726
- data: data,
1727
- count: this.calculateCount(data, limitList),
1728
- }];
1729
- }
1730
- });
1731
- });
1732
- };
1733
- FindFirestore.prototype.buildCollectionPathForFind = function (filters) {
1734
- var _a;
1735
- if (!this.isSubCollection(this))
1736
- return this.collectionName;
1737
- var parentIdField = this.parentIdField;
1738
- var parentId = getValueFromFilter((_a = filters.find(function (groupFilter) { return Boolean(getValueFromFilter(groupFilter[parentIdField])); })) === null || _a === void 0 ? void 0 : _a[parentIdField]);
1739
- return this.parentRepository.collectionName + "/" + parentId + "/" + this.collectionName;
1740
- };
1741
- FindFirestore.prototype.defineLimits = function (filters, limits) {
1742
- return __awaiter(this, void 0, void 0, function () {
1743
- var queries, _b, _c, _d;
1744
- return __generator(this, function (_e) {
1745
- switch (_e.label) {
1746
- case 0:
1747
- queries = [];
1748
- if (!(limits === null || limits === void 0 ? void 0 : limits.offset)) return [3 /*break*/, 3];
1749
- if (!(limits.offset instanceof this.model)) return [3 /*break*/, 2];
1750
- _c = (_b = queries).push;
1751
- _d = firestore.startAfter;
1752
- return [4 /*yield*/, firestore.getDoc(firestore.doc(this.collection(this.buildCollectionPathForFind(filters)), limits.offset[limits.offset.identifierFields().shift()]))];
1753
- case 1:
1754
- _c.apply(_b, [_d.apply(void 0, [_e.sent()])]);
1755
- return [3 /*break*/, 3];
1756
- case 2:
1757
- if (isNumber(limits.offset) || isString(limits.offset))
1758
- queries.push(firestore.startAt(limits.offset));
1759
- _e.label = 3;
1760
- case 3:
1761
- if (limits === null || limits === void 0 ? void 0 : limits.limit)
1762
- queries.push(firestore.limit(limits.limit));
1763
- return [2 /*return*/, queries];
1764
- }
1765
- });
1766
- });
1767
- };
1768
- FindFirestore.prototype.calculateCount = function (data, limits) {
1769
- if (data.length <= 0)
1770
- return 0;
1771
- if (data.length < (limits === null || limits === void 0 ? void 0 : limits.limit))
1772
- return data.length;
1773
- return Infinity;
1774
- };
1775
- return FindFirestore;
1776
- }(MixinBase));
1661
+ var withFindFirestore = function (MixinBase) {
1662
+ var checkIfIsFilterOption = function (filter) { return !lodash.isNil(filter === null || filter === void 0 ? void 0 : filter.operator); };
1663
+ var getValueFromFilter = function (filter) {
1664
+ return checkIfIsFilterOption(filter) ? filter.value : filter;
1665
+ };
1666
+ var getFinalValueFrom = function (value) { return lodash.isNumber(value) || lodash.isString(value) || lodash.isDate(value) || Array.isArray(value)
1667
+ ? value
1668
+ : Object.values(getFinalValueFrom); };
1669
+ return /** @class */ (function (_super) {
1670
+ __extends(FindFirestore, _super);
1671
+ function FindFirestore() {
1672
+ var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
1673
+ _this.makeFirestoreWhere = function (queryReference, filter) { return Object.keys(filter).reduce(function (query, fieldName) { return _this.buildWhereSentence(query, fieldName, filter[fieldName]); }, queryReference); };
1674
+ _this.buildWhereSentence = function (queryReference, fieldName, options) {
1675
+ if (_this.isSubCollection(_this) && fieldName === _this.parentIdField)
1676
+ return queryReference;
1677
+ var value = (options === null || options === void 0 ? void 0 : options.value) || options;
1678
+ var object = {};
1679
+ lodash.set(object, fieldName, value);
1680
+ var plainInstance = new _this.model(object).toPlain();
1681
+ var firestoreFieldName = fieldName.toString().indexOf('.') > -1
1682
+ ? fieldName.toString()
1683
+ : Object.keys(plainInstance).find(function (key) { return plainInstance[key]; });
1684
+ if ((options === null || options === void 0 ? void 0 : options.operator) === exports.Where.LIKE) {
1685
+ if (Array.isArray(options === null || options === void 0 ? void 0 : options.value))
1686
+ return queryReference.where(firestoreFieldName, 'array-contains-any', options.value);
1687
+ queryReference = queryReference.where(firestoreFieldName, '>=', options.value);
1688
+ queryReference = queryReference.where(firestoreFieldName, '<=', options.value + "~");
1689
+ return queryReference;
1690
+ }
1691
+ if ((options === null || options === void 0 ? void 0 : options.operator) === exports.Where.IN && Array.isArray(options === null || options === void 0 ? void 0 : options.value))
1692
+ return queryReference.where(firestoreFieldName, 'array-contains', options.value);
1693
+ if (lodash.isObject(options) && lodash.isNil(options === null || options === void 0 ? void 0 : options.operator) && lodash.isNil(options === null || options === void 0 ? void 0 : options.value)) {
1694
+ return Object.keys(options).reduce(function (queryReferenceWithWhere, key) { return _this.buildWhereSentence(queryReferenceWithWhere, fieldName + "." + key, options[key]); }, queryReference);
1695
+ }
1696
+ return queryReference.where(firestoreFieldName, (options === null || options === void 0 ? void 0 : options.operator) || '==', (options === null || options === void 0 ? void 0 : options.value) || options);
1697
+ };
1698
+ return _this;
1699
+ }
1700
+ FindFirestore.prototype.find = function (filters, limits, orderBy) {
1701
+ return __awaiter(this, void 0, void 0, function () {
1702
+ var query, docs, data;
1703
+ var _this = this;
1704
+ return __generator(this, function (_b) {
1705
+ switch (_b.label) {
1706
+ case 0:
1707
+ query = this.collection(this.buildCollectionPathForFind(filters));
1708
+ filters === null || filters === void 0 ? void 0 : filters.forEach(function (filterer) { return (query = _this.makeFirestoreWhere(query, filterer)); });
1709
+ 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])); }); });
1710
+ return [4 /*yield*/, this.defineLimits(query, filters, limits)];
1711
+ case 1:
1712
+ query = _b.sent();
1713
+ return [4 /*yield*/, query.get()];
1714
+ case 2:
1715
+ docs = _b.sent();
1716
+ data = docs.docs.map(function (doc) { return doc.data(); });
1717
+ return [2 /*return*/, {
1718
+ data: data,
1719
+ count: this.calculateCount(data, limits),
1720
+ }];
1721
+ }
1722
+ });
1723
+ });
1724
+ };
1725
+ FindFirestore.prototype.buildCollectionPathForFind = function (filters) {
1726
+ var _a;
1727
+ if (!this.isSubCollection(this))
1728
+ return this.collectionName;
1729
+ var parentIdField = this.parentIdField;
1730
+ var parentId = getValueFromFilter((_a = filters.find(function (groupFilter) { return Boolean(getValueFromFilter(groupFilter[parentIdField])); })) === null || _a === void 0 ? void 0 : _a[parentIdField]);
1731
+ return this.parentRepository.collectionName + "/" + parentId + "/" + this.collectionName;
1732
+ };
1733
+ FindFirestore.prototype.defineLimits = function (query, filters, limits) {
1734
+ return __awaiter(this, void 0, void 0, function () {
1735
+ var _b, _c;
1736
+ return __generator(this, function (_d) {
1737
+ switch (_d.label) {
1738
+ case 0:
1739
+ if (!(limits === null || limits === void 0 ? void 0 : limits.offset)) return [3 /*break*/, 3];
1740
+ if (!(limits.offset instanceof this.model)) return [3 /*break*/, 2];
1741
+ _c = (_b = query).startAfter;
1742
+ return [4 /*yield*/, this.collection(this.buildCollectionPathForFind(filters))
1743
+ .doc(limits.offset[limits.offset.identifierFields().shift()])
1744
+ .get()];
1745
+ case 1:
1746
+ query = _c.apply(_b, [_d.sent()]);
1747
+ return [3 /*break*/, 3];
1748
+ case 2:
1749
+ if (lodash.isNumber(limits.offset) || lodash.isString(limits.offset))
1750
+ query = query.startAt(limits.offset);
1751
+ _d.label = 3;
1752
+ case 3:
1753
+ if (limits === null || limits === void 0 ? void 0 : limits.limit)
1754
+ query = query.limit(limits.limit);
1755
+ return [2 /*return*/, query];
1756
+ }
1757
+ });
1758
+ });
1759
+ };
1760
+ FindFirestore.prototype.calculateCount = function (data, limits) {
1761
+ if (data.length <= 0)
1762
+ return 0;
1763
+ if (data.length < (limits === null || limits === void 0 ? void 0 : limits.limit))
1764
+ return data.length;
1765
+ return Infinity;
1766
+ };
1767
+ return FindFirestore;
1768
+ }(MixinBase));
1777
1769
  };
1778
1770
 
1779
- var withCreateFirestore = function (MixinBase) {
1780
- return /** @class */ (function (_super) {
1781
- __extends(CreateFirestore, _super);
1782
- function CreateFirestore() {
1783
- return _super !== null && _super.apply(this, arguments) || this;
1784
- }
1785
- CreateFirestore.prototype.create = function (data) {
1786
- return __awaiter(this, void 0, void 0, function () {
1787
- var docRef, doc;
1788
- return __generator(this, function (_b) {
1789
- switch (_b.label) {
1790
- case 0: return [4 /*yield*/, this.save(this.model.toInstance(data))];
1791
- case 1:
1792
- docRef = _b.sent();
1793
- return [4 /*yield*/, firestore.getDoc(docRef)];
1794
- case 2:
1795
- doc = _b.sent();
1796
- return [2 /*return*/, doc.data()];
1797
- }
1798
- });
1799
- });
1800
- };
1801
- CreateFirestore.prototype.save = function (data) {
1802
- var _a;
1803
- return __awaiter(this, void 0, void 0, function () {
1804
- var id, collectionPath, collection, docRef;
1805
- return __generator(this, function (_b) {
1806
- switch (_b.label) {
1807
- case 0:
1808
- id = (_a = data[data.identifierFields().shift()]) === null || _a === void 0 ? void 0 : _a.toString();
1809
- collectionPath = this.buildCollectionPathForAdd(data);
1810
- collection = this.collection(collectionPath);
1811
- if (isEmpty(id))
1812
- return [2 /*return*/, firestore.addDoc(collection, data)];
1813
- docRef = firestore.doc(collection, id);
1814
- return [4 /*yield*/, firestore.setDoc(docRef, data)];
1815
- case 1:
1816
- _b.sent();
1817
- return [2 /*return*/, docRef];
1818
- }
1819
- });
1820
- });
1821
- };
1822
- CreateFirestore.prototype.buildCollectionPathForAdd = function (identifiers) {
1823
- return this.isSubCollection(this)
1824
- ? this.parentRepository.collectionName + "/" + identifiers[this.parentIdField] + "/" + this.collectionName
1825
- : this.collectionName;
1826
- };
1827
- return CreateFirestore;
1828
- }(MixinBase));
1771
+ var withCreateFirestore = function (MixinBase) {
1772
+ return /** @class */ (function (_super) {
1773
+ __extends(CreateFirestore, _super);
1774
+ function CreateFirestore() {
1775
+ return _super !== null && _super.apply(this, arguments) || this;
1776
+ }
1777
+ CreateFirestore.prototype.create = function (data) {
1778
+ return __awaiter(this, void 0, void 0, function () {
1779
+ var docRef, doc;
1780
+ return __generator(this, function (_b) {
1781
+ switch (_b.label) {
1782
+ case 0: return [4 /*yield*/, this.save(this.model.toInstance(data))];
1783
+ case 1:
1784
+ docRef = _b.sent();
1785
+ return [4 /*yield*/, docRef.get()];
1786
+ case 2:
1787
+ doc = _b.sent();
1788
+ return [2 /*return*/, doc.data()];
1789
+ }
1790
+ });
1791
+ });
1792
+ };
1793
+ CreateFirestore.prototype.save = function (data) {
1794
+ var _a;
1795
+ return __awaiter(this, void 0, void 0, function () {
1796
+ var id, collectionPath, docRef;
1797
+ return __generator(this, function (_b) {
1798
+ switch (_b.label) {
1799
+ case 0:
1800
+ id = (_a = data[data.identifierFields().shift()]) === null || _a === void 0 ? void 0 : _a.toString();
1801
+ collectionPath = this.buildCollectionPathForAdd(data);
1802
+ if (lodash.isEmpty(id))
1803
+ return [2 /*return*/, this.collection(collectionPath).add(data)];
1804
+ docRef = this.collection(collectionPath).doc(id);
1805
+ return [4 /*yield*/, docRef.set(data)];
1806
+ case 1:
1807
+ _b.sent();
1808
+ return [2 /*return*/, docRef];
1809
+ }
1810
+ });
1811
+ });
1812
+ };
1813
+ CreateFirestore.prototype.buildCollectionPathForAdd = function (identifiers) {
1814
+ return this.isSubCollection(this)
1815
+ ? this.parentRepository.collectionName + "/" + identifiers[this.parentIdField] + "/" + this.collectionName
1816
+ : this.collectionName;
1817
+ };
1818
+ return CreateFirestore;
1819
+ }(MixinBase));
1829
1820
  };
1830
1821
 
1831
- var withUpdateFirestore = function (MixinBase) {
1832
- var getValueFromParams = function (params, field) { var _a; return (isNil((_a = params[field]) === null || _a === void 0 ? void 0 : _a.value) ? params[field] : params[field].value) || null; };
1833
- var getValueByAction = function (options) {
1834
- if (isNil(options.action))
1835
- return options;
1836
- if (options.action === exports.UpdateOptionActions.REMOVE_FIELD)
1837
- return firestore.deleteField();
1838
- if (Array.isArray(options.value)) {
1839
- if (options.action === exports.UpdateOptionActions.MERGE)
1840
- return firestore.arrayUnion.apply(void 0, __spreadArray([], __read(options.value)));
1841
- if (options.action === exports.UpdateOptionActions.REMOVE)
1842
- return firestore.arrayRemove.apply(void 0, __spreadArray([], __read(options.value)));
1843
- }
1844
- return options.value;
1845
- };
1846
- return /** @class */ (function (_super) {
1847
- __extends(UpdateFirestore, _super);
1848
- function UpdateFirestore() {
1849
- return _super !== null && _super.apply(this, arguments) || this;
1850
- }
1851
- UpdateFirestore.prototype.update = function (data) {
1852
- return __awaiter(this, void 0, void 0, function () {
1853
- var model, keyField, docRef, docData;
1854
- return __generator(this, function (_b) {
1855
- switch (_b.label) {
1856
- case 0:
1857
- model = new this.model();
1858
- keyField = model.identifierFields().shift();
1859
- docRef = firestore.doc(this.collection(this.buildCollectionPathForUpdate(data)), getValueFromParams(data, keyField).toString());
1860
- return [4 /*yield*/, firestore.setDoc(docRef, this.paramsToPlain(data), { merge: true })];
1861
- case 1:
1862
- _b.sent();
1863
- return [4 /*yield*/, firestore.getDoc(docRef)];
1864
- case 2:
1865
- docData = _b.sent();
1866
- return [2 /*return*/, docData.data()];
1867
- }
1868
- });
1869
- });
1870
- };
1871
- UpdateFirestore.prototype.buildCollectionPathForUpdate = function (identifiers) {
1872
- return this.isSubCollection(this)
1873
- ? this.parentRepository.collectionName + "/" + getValueFromParams(identifiers, this.parentIdField) + "/" + this.collectionName
1874
- : this.collectionName;
1875
- };
1876
- UpdateFirestore.prototype.paramsToPlain = function (params) {
1877
- var model = this.model;
1878
- if (params instanceof model)
1879
- return params;
1880
- return Object.keys(params).reduce(function (data, currentKey) {
1881
- var _b;
1882
- return (Object.assign(Object.assign({}, data), (_b = {}, _b[currentKey] = getValueByAction(params[currentKey]), _b)));
1883
- }, {});
1884
- };
1885
- return UpdateFirestore;
1886
- }(MixinBase));
1822
+ var withUpdateFirestore = function (MixinBase) {
1823
+ 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; };
1824
+ var getValueByAction = function (options) {
1825
+ var fieldValues = firebase__default["default"].firestore.FieldValue;
1826
+ if (lodash.isNil(options.action))
1827
+ return options;
1828
+ if (options.action === exports.UpdateOptionActions.REMOVE_FIELD)
1829
+ return fieldValues.delete();
1830
+ if (Array.isArray(options.value)) {
1831
+ if (options.action === exports.UpdateOptionActions.MERGE)
1832
+ return fieldValues.arrayUnion.apply(fieldValues, __spreadArray([], __read(options.value)));
1833
+ if (options.action === exports.UpdateOptionActions.REMOVE)
1834
+ return fieldValues.arrayRemove.apply(fieldValues, __spreadArray([], __read(options.value)));
1835
+ }
1836
+ return options.value;
1837
+ };
1838
+ return /** @class */ (function (_super) {
1839
+ __extends(UpdateFirestore, _super);
1840
+ function UpdateFirestore() {
1841
+ return _super !== null && _super.apply(this, arguments) || this;
1842
+ }
1843
+ UpdateFirestore.prototype.update = function (data) {
1844
+ return __awaiter(this, void 0, void 0, function () {
1845
+ var model, keyField, docRef, doc;
1846
+ return __generator(this, function (_b) {
1847
+ switch (_b.label) {
1848
+ case 0:
1849
+ model = new this.model();
1850
+ keyField = model.identifierFields().shift();
1851
+ docRef = this.collection(this.buildCollectionPathForUpdate(data)).doc(getValueFromParams(data, keyField).toString());
1852
+ return [4 /*yield*/, docRef.set(this.paramsToPlain(data), { merge: true })];
1853
+ case 1:
1854
+ _b.sent();
1855
+ return [4 /*yield*/, docRef.get()];
1856
+ case 2:
1857
+ doc = _b.sent();
1858
+ return [2 /*return*/, doc.data()];
1859
+ }
1860
+ });
1861
+ });
1862
+ };
1863
+ UpdateFirestore.prototype.buildCollectionPathForUpdate = function (identifiers) {
1864
+ return this.isSubCollection(this)
1865
+ ? this.parentRepository.collectionName + "/" + getValueFromParams(identifiers, this.parentIdField) + "/" + this.collectionName
1866
+ : this.collectionName;
1867
+ };
1868
+ UpdateFirestore.prototype.paramsToPlain = function (params) {
1869
+ var model = this.model;
1870
+ if (params instanceof model)
1871
+ return params;
1872
+ return Object.keys(params).reduce(function (data, currentKey) {
1873
+ var _b;
1874
+ return (Object.assign(Object.assign({}, data), (_b = {}, _b[currentKey] = getValueByAction(params[currentKey]), _b)));
1875
+ }, {});
1876
+ };
1877
+ return UpdateFirestore;
1878
+ }(MixinBase));
1887
1879
  };
1888
1880
 
1889
- var withDeleteFirestore = function (MixinBase) {
1890
- return /** @class */ (function (_super) {
1891
- __extends(DeleteFirestore, _super);
1892
- function DeleteFirestore() {
1893
- return _super !== null && _super.apply(this, arguments) || this;
1894
- }
1895
- DeleteFirestore.prototype.delete = function (identifiers) {
1896
- return __awaiter(this, void 0, void 0, function () {
1897
- return __generator(this, function (_a) {
1898
- switch (_a.label) {
1899
- case 0: return [4 /*yield*/, firestore.deleteDoc(firestore.doc(this.collection(this.buildCollectionPathForRemove(identifiers)), Object.values(identifiers).shift().toString()))];
1900
- case 1:
1901
- _a.sent();
1902
- return [2 /*return*/];
1903
- }
1904
- });
1905
- });
1906
- };
1907
- DeleteFirestore.prototype.buildCollectionPathForRemove = function (identifiers) {
1908
- return this.isSubCollection(this)
1909
- ? this.parentRepository.collectionName + "/" + identifiers[this.parentIdField] + "/" + this.collectionName
1910
- : this.collectionName;
1911
- };
1912
- return DeleteFirestore;
1913
- }(MixinBase));
1881
+ var withDeleteFirestore = function (MixinBase) {
1882
+ return /** @class */ (function (_super) {
1883
+ __extends(DeleteFirestore, _super);
1884
+ function DeleteFirestore() {
1885
+ return _super !== null && _super.apply(this, arguments) || this;
1886
+ }
1887
+ DeleteFirestore.prototype.delete = function (identifiers) {
1888
+ return __awaiter(this, void 0, void 0, function () {
1889
+ return __generator(this, function (_a) {
1890
+ switch (_a.label) {
1891
+ case 0: return [4 /*yield*/, this.collection(this.buildCollectionPathForRemove(identifiers))
1892
+ .doc(Object.values(identifiers).shift().toString())
1893
+ .delete()];
1894
+ case 1:
1895
+ _a.sent();
1896
+ return [2 /*return*/];
1897
+ }
1898
+ });
1899
+ });
1900
+ };
1901
+ DeleteFirestore.prototype.buildCollectionPathForRemove = function (identifiers) {
1902
+ return this.isSubCollection(this)
1903
+ ? this.parentRepository.collectionName + "/" + identifiers[this.parentIdField] + "/" + this.collectionName
1904
+ : this.collectionName;
1905
+ };
1906
+ return DeleteFirestore;
1907
+ }(MixinBase));
1914
1908
  };
1915
1909
 
1916
- var withSubCollection = function (MixinBase, ParentModel) {
1917
- return /** @class */ (function (_super) {
1918
- __extends(SubCollectionMix, _super);
1919
- function SubCollectionMix() {
1920
- var args = [];
1921
- for (var _i = 0; _i < arguments.length; _i++) {
1922
- args[_i] = arguments[_i];
1923
- }
1924
- return _super.call(this, args) || this;
1925
- }
1926
- SubCollectionMix.prototype.collection = function (path) {
1927
- return _super.prototype.collection.call(this, path);
1928
- };
1929
- return SubCollectionMix;
1930
- }(MixinBase));
1910
+ var withSubCollection = function (MixinBase, ParentModel) {
1911
+ return /** @class */ (function (_super) {
1912
+ __extends(SubCollectionMix, _super);
1913
+ function SubCollectionMix() {
1914
+ var args = [];
1915
+ for (var _i = 0; _i < arguments.length; _i++) {
1916
+ args[_i] = arguments[_i];
1917
+ }
1918
+ return _super.call(this, args) || this;
1919
+ }
1920
+ SubCollectionMix.prototype.collection = function (path) {
1921
+ return _super.prototype.collection.call(this, path);
1922
+ };
1923
+ return SubCollectionMix;
1924
+ }(MixinBase));
1931
1925
  };
1932
1926
 
1933
- var withCrudFirestore = function (MixinBase) {
1934
- return /** @class */ (function (_super) {
1935
- __extends(CrudFirestore, _super);
1936
- function CrudFirestore() {
1937
- return _super !== null && _super.apply(this, arguments) || this;
1938
- }
1939
- return CrudFirestore;
1940
- }(withUpdateFirestore(withGetFirestore(withFindFirestore(withDeleteFirestore(withCreateFirestore(MixinBase)))))));
1927
+ var withCrudFirestore = function (MixinBase) {
1928
+ return /** @class */ (function (_super) {
1929
+ __extends(CrudFirestore, _super);
1930
+ function CrudFirestore() {
1931
+ return _super !== null && _super.apply(this, arguments) || this;
1932
+ }
1933
+ return CrudFirestore;
1934
+ }(withUpdateFirestore(withGetFirestore(withFindFirestore(withDeleteFirestore(withCreateFirestore(MixinBase)))))));
1941
1935
  };
1942
1936
 
1943
- var SubscriptionFirestoreRepository = /** @class */ (function (_super) {
1944
- __extends(SubscriptionFirestoreRepository, _super);
1945
- function SubscriptionFirestoreRepository(firestore) {
1946
- var _this = _super.call(this) || this;
1947
- _this.firestore = firestore;
1948
- _this.collectionName = 'subscription';
1949
- _this.model = Subscription;
1950
- return _this;
1951
- }
1952
- return SubscriptionFirestoreRepository;
1937
+ var SubscriptionFirestoreRepository = /** @class */ (function (_super) {
1938
+ __extends(SubscriptionFirestoreRepository, _super);
1939
+ function SubscriptionFirestoreRepository(firestore) {
1940
+ var _this = _super.call(this) || this;
1941
+ _this.firestore = firestore;
1942
+ _this.collectionName = 'subscription';
1943
+ _this.model = Subscription;
1944
+ return _this;
1945
+ }
1946
+ return SubscriptionFirestoreRepository;
1953
1947
  }(withCrudFirestore(withHelpers(withFirestore(Base)))));
1954
1948
 
1955
- var UserSearch = /** @class */ (function (_super) {
1956
- __extends(UserSearch, _super);
1957
- function UserSearch() {
1958
- return _super !== null && _super.apply(this, arguments) || this;
1959
- }
1960
- UserSearch.prototype.identifierFields = function () {
1961
- return ['id'];
1962
- };
1963
- return UserSearch;
1949
+ var UserSearch = /** @class */ (function (_super) {
1950
+ __extends(UserSearch, _super);
1951
+ function UserSearch() {
1952
+ return _super !== null && _super.apply(this, arguments) || this;
1953
+ }
1954
+ UserSearch.prototype.identifierFields = function () {
1955
+ return ['id'];
1956
+ };
1957
+ return UserSearch;
1964
1958
  }(BaseModel));
1965
1959
 
1966
- var UserSearchFirestoreRepository = /** @class */ (function (_super) {
1967
- __extends(UserSearchFirestoreRepository, _super);
1968
- function UserSearchFirestoreRepository(firestore) {
1969
- var _this = _super.call(this) || this;
1970
- _this.firestore = firestore;
1971
- _this.collectionName = 'userSearch';
1972
- _this.model = UserSearch;
1973
- return _this;
1974
- }
1975
- return UserSearchFirestoreRepository;
1960
+ var UserSearchFirestoreRepository = /** @class */ (function (_super) {
1961
+ __extends(UserSearchFirestoreRepository, _super);
1962
+ function UserSearchFirestoreRepository(firestore) {
1963
+ var _this = _super.call(this) || this;
1964
+ _this.firestore = firestore;
1965
+ _this.collectionName = 'userSearch';
1966
+ _this.model = UserSearch;
1967
+ return _this;
1968
+ }
1969
+ return UserSearchFirestoreRepository;
1976
1970
  }(withCrudFirestore(withHelpers(withFirestore(Base)))));
1977
1971
 
1978
- var UserFirestoreRepository = /** @class */ (function (_super_1) {
1979
- __extends(UserFirestoreRepository, _super_1);
1980
- function UserFirestoreRepository(firestore, userSearchFirestoreRepository) {
1981
- if (userSearchFirestoreRepository === void 0) { userSearchFirestoreRepository = new UserSearchFirestoreRepository(firestore); }
1982
- var _this = _super_1.call(this) || this;
1983
- _this.firestore = firestore;
1984
- _this.userSearchFirestoreRepository = userSearchFirestoreRepository;
1985
- _this.collectionName = 'users';
1986
- _this.model = User;
1987
- return _this;
1988
- }
1989
- UserFirestoreRepository.prototype.get = function (identifiers) {
1990
- var _super = Object.create(null, {
1991
- get: { get: function () { return _super_1.prototype.get; } }
1992
- });
1993
- return __awaiter(this, void 0, void 0, function () {
1994
- var user, _a, _b;
1995
- return __generator(this, function (_c) {
1996
- switch (_c.label) {
1997
- case 0: return [4 /*yield*/, _super.get.call(this, { id: identifiers.id })];
1998
- case 1:
1999
- user = _c.sent();
2000
- _a = user;
2001
- return [4 /*yield*/, this.getBeautyProfile(user.id)];
2002
- case 2:
2003
- _a.beautyProfile = _c.sent();
2004
- _b = user;
2005
- return [4 /*yield*/, this.checkIfIsSubscriber(user.id)];
2006
- case 3:
2007
- _b.isSubscriber = _c.sent();
2008
- return [2 /*return*/, user];
2009
- }
2010
- });
2011
- });
2012
- };
2013
- UserFirestoreRepository.prototype.checkIfExistsByField = function (field, value) {
2014
- return __awaiter(this, void 0, void 0, function () {
2015
- var result;
2016
- var _a;
2017
- return __generator(this, function (_b) {
2018
- switch (_b.label) {
2019
- case 0: return [4 /*yield*/, this.userSearchFirestoreRepository.find([(_a = {}, _a[field] = { operator: exports.Where.EQUALS, value: value }, _a)])];
2020
- case 1:
2021
- result = _b.sent();
2022
- return [2 /*return*/, result.count > 0];
2023
- }
2024
- });
2025
- });
2026
- };
2027
- UserFirestoreRepository.prototype.buildModelInstance = function () {
2028
- var _a = _super_1.prototype.buildModelInstance.call(this), fromFirestore = _a.fromFirestore, toFirestore = _a.toFirestore;
2029
- return {
2030
- toFirestore: function (data) {
2031
- var plain = toFirestore(data);
2032
- delete plain.isSubscriber;
2033
- return plain;
2034
- },
2035
- fromFirestore: fromFirestore,
2036
- };
2037
- };
2038
- UserFirestoreRepository.prototype.getBeautyProfile = function (userId) {
2039
- return __awaiter(this, void 0, void 0, function () {
2040
- var beautyProfile;
2041
- return __generator(this, function (_a) {
2042
- switch (_a.label) {
2043
- case 0: return [4 /*yield*/, firestore.getDoc(firestore.doc(this.collection(this.collectionName + "/" + userId + "/CX").withConverter(this.buildBeautyProfileModelInstance()), 'beautyProfile'))];
2044
- case 1:
2045
- beautyProfile = _a.sent();
2046
- return [2 /*return*/, beautyProfile.data()];
2047
- }
2048
- });
2049
- });
2050
- };
2051
- UserFirestoreRepository.prototype.checkIfIsSubscriber = function (userId) {
2052
- return __awaiter(this, void 0, void 0, function () {
2053
- var docs;
2054
- return __generator(this, function (_a) {
2055
- switch (_a.label) {
2056
- case 0: return [4 /*yield*/, firestore.getDocs(firestore.query(this.collection('subscription'), firestore.where('user.id', '==', userId), firestore.where('status', '==', 'active')))];
2057
- case 1:
2058
- docs = _a.sent();
2059
- return [2 /*return*/, !!docs && !!docs.size];
2060
- }
2061
- });
2062
- });
2063
- };
2064
- UserFirestoreRepository.prototype.buildBeautyProfileModelInstance = function () {
2065
- return {
2066
- toFirestore: function (data) { return data.toPlain(); },
2067
- fromFirestore: function (snap) { return BeautyProfile.toInstance(snap.data()); },
2068
- };
2069
- };
2070
- return UserFirestoreRepository;
1972
+ var UserFirestoreRepository = /** @class */ (function (_super_1) {
1973
+ __extends(UserFirestoreRepository, _super_1);
1974
+ function UserFirestoreRepository(firestore, userSearchFirestoreRepository) {
1975
+ if (userSearchFirestoreRepository === void 0) { userSearchFirestoreRepository = new UserSearchFirestoreRepository(firestore); }
1976
+ var _this = _super_1.call(this) || this;
1977
+ _this.firestore = firestore;
1978
+ _this.userSearchFirestoreRepository = userSearchFirestoreRepository;
1979
+ _this.collectionName = 'users';
1980
+ _this.model = User;
1981
+ return _this;
1982
+ }
1983
+ UserFirestoreRepository.prototype.get = function (identifiers) {
1984
+ var _super = Object.create(null, {
1985
+ get: { get: function () { return _super_1.prototype.get; } }
1986
+ });
1987
+ return __awaiter(this, void 0, void 0, function () {
1988
+ var user, _a, _b;
1989
+ return __generator(this, function (_c) {
1990
+ switch (_c.label) {
1991
+ case 0: return [4 /*yield*/, _super.get.call(this, { id: identifiers.id })];
1992
+ case 1:
1993
+ user = _c.sent();
1994
+ _a = user;
1995
+ return [4 /*yield*/, this.getBeautyProfile(user.id)];
1996
+ case 2:
1997
+ _a.beautyProfile = _c.sent();
1998
+ _b = user;
1999
+ return [4 /*yield*/, this.checkIfIsSubscriber(user.id)];
2000
+ case 3:
2001
+ _b.isSubscriber = _c.sent();
2002
+ return [2 /*return*/, user];
2003
+ }
2004
+ });
2005
+ });
2006
+ };
2007
+ UserFirestoreRepository.prototype.checkIfExistsByField = function (field, value) {
2008
+ return __awaiter(this, void 0, void 0, function () {
2009
+ var result;
2010
+ var _a;
2011
+ return __generator(this, function (_b) {
2012
+ switch (_b.label) {
2013
+ case 0: return [4 /*yield*/, this.userSearchFirestoreRepository.find([(_a = {}, _a[field] = { operator: exports.Where.EQUALS, value: value }, _a)])];
2014
+ case 1:
2015
+ result = _b.sent();
2016
+ return [2 /*return*/, result.count > 0];
2017
+ }
2018
+ });
2019
+ });
2020
+ };
2021
+ UserFirestoreRepository.prototype.buildModelInstance = function () {
2022
+ var _a = _super_1.prototype.buildModelInstance.call(this), fromFirestore = _a.fromFirestore, toFirestore = _a.toFirestore;
2023
+ return {
2024
+ toFirestore: function (data) {
2025
+ var plain = toFirestore(data);
2026
+ delete plain.isSubscriber;
2027
+ return plain;
2028
+ },
2029
+ fromFirestore: fromFirestore,
2030
+ };
2031
+ };
2032
+ UserFirestoreRepository.prototype.getBeautyProfile = function (userId) {
2033
+ return __awaiter(this, void 0, void 0, function () {
2034
+ var beautyProfile;
2035
+ return __generator(this, function (_a) {
2036
+ switch (_a.label) {
2037
+ case 0: return [4 /*yield*/, this.collection()
2038
+ .doc(userId)
2039
+ .collection('CX')
2040
+ .withConverter(this.buildBeautyProfileModelInstance())
2041
+ .doc('beautyProfile')
2042
+ .get()];
2043
+ case 1:
2044
+ beautyProfile = _a.sent();
2045
+ return [2 /*return*/, beautyProfile.data()];
2046
+ }
2047
+ });
2048
+ });
2049
+ };
2050
+ UserFirestoreRepository.prototype.checkIfIsSubscriber = function (userId) {
2051
+ return __awaiter(this, void 0, void 0, function () {
2052
+ var docs;
2053
+ return __generator(this, function (_a) {
2054
+ switch (_a.label) {
2055
+ case 0: return [4 /*yield*/, this.firestore
2056
+ .collection('subscription')
2057
+ .where('user.id', '==', userId)
2058
+ .where('status', '==', 'active')
2059
+ .get()];
2060
+ case 1:
2061
+ docs = _a.sent();
2062
+ return [2 /*return*/, !!docs && !!docs.size];
2063
+ }
2064
+ });
2065
+ });
2066
+ };
2067
+ UserFirestoreRepository.prototype.buildBeautyProfileModelInstance = function () {
2068
+ return {
2069
+ toFirestore: function (data) { return data.toPlain(); },
2070
+ fromFirestore: function (snap) { return BeautyProfile.toInstance(snap.data()); },
2071
+ };
2072
+ };
2073
+ return UserFirestoreRepository;
2071
2074
  }(withCrudFirestore(withHelpers(withFirestore(Base)))));
2072
2075
 
2073
- var SubscriptionEditionFirestoreRepository = /** @class */ (function (_super) {
2074
- __extends(SubscriptionEditionFirestoreRepository, _super);
2075
- function SubscriptionEditionFirestoreRepository(firestore, parentRepository) {
2076
- var _this = _super.call(this) || this;
2077
- _this.firestore = firestore;
2078
- _this.parentRepository = parentRepository;
2079
- _this.collectionName = 'editions';
2080
- _this.parentIdField = 'subscriptionId';
2081
- _this.model = Edition;
2082
- return _this;
2083
- }
2084
- return SubscriptionEditionFirestoreRepository;
2076
+ var SubscriptionEditionFirestoreRepository = /** @class */ (function (_super) {
2077
+ __extends(SubscriptionEditionFirestoreRepository, _super);
2078
+ function SubscriptionEditionFirestoreRepository(firestore, parentRepository) {
2079
+ var _this = _super.call(this) || this;
2080
+ _this.firestore = firestore;
2081
+ _this.parentRepository = parentRepository;
2082
+ _this.collectionName = 'editions';
2083
+ _this.parentIdField = 'subscriptionId';
2084
+ _this.model = Edition;
2085
+ return _this;
2086
+ }
2087
+ return SubscriptionEditionFirestoreRepository;
2085
2088
  }(withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Subscription)));
2086
2089
 
2087
- var UserBeautyProfileFirestoreRepository = /** @class */ (function (_super) {
2088
- __extends(UserBeautyProfileFirestoreRepository, _super);
2089
- function UserBeautyProfileFirestoreRepository(firestore, parentRepository) {
2090
- var _this = _super.call(this) || this;
2091
- _this.firestore = firestore;
2092
- _this.parentRepository = parentRepository;
2093
- _this.collectionName = 'CX';
2094
- _this.parentIdField = 'userId';
2095
- _this.model = BeautyProfile;
2096
- return _this;
2097
- }
2098
- return UserBeautyProfileFirestoreRepository;
2090
+ var UserBeautyProfileFirestoreRepository = /** @class */ (function (_super) {
2091
+ __extends(UserBeautyProfileFirestoreRepository, _super);
2092
+ function UserBeautyProfileFirestoreRepository(firestore, parentRepository) {
2093
+ var _this = _super.call(this) || this;
2094
+ _this.firestore = firestore;
2095
+ _this.parentRepository = parentRepository;
2096
+ _this.collectionName = 'CX';
2097
+ _this.parentIdField = 'userId';
2098
+ _this.model = BeautyProfile;
2099
+ return _this;
2100
+ }
2101
+ return UserBeautyProfileFirestoreRepository;
2099
2102
  }(withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User)));
2100
2103
 
2101
- var UserAddressFirestoreRepository = /** @class */ (function (_super) {
2102
- __extends(UserAddressFirestoreRepository, _super);
2103
- function UserAddressFirestoreRepository(firestore, parentRepository) {
2104
- var _this = _super.call(this) || this;
2105
- _this.firestore = firestore;
2106
- _this.parentRepository = parentRepository;
2107
- _this.collectionName = 'address';
2108
- _this.parentIdField = 'userId';
2109
- _this.model = UserAddress;
2110
- return _this;
2111
- }
2112
- return UserAddressFirestoreRepository;
2104
+ var UserAddressFirestoreRepository = /** @class */ (function (_super) {
2105
+ __extends(UserAddressFirestoreRepository, _super);
2106
+ function UserAddressFirestoreRepository(firestore, parentRepository) {
2107
+ var _this = _super.call(this) || this;
2108
+ _this.firestore = firestore;
2109
+ _this.parentRepository = parentRepository;
2110
+ _this.collectionName = 'address';
2111
+ _this.parentIdField = 'userId';
2112
+ _this.model = UserAddress;
2113
+ return _this;
2114
+ }
2115
+ return UserAddressFirestoreRepository;
2113
2116
  }(withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User)));
2114
2117
 
2115
- var UserPaymentMethodFirestoreRepository = /** @class */ (function (_super) {
2116
- __extends(UserPaymentMethodFirestoreRepository, _super);
2117
- function UserPaymentMethodFirestoreRepository(firestore, parentRepository) {
2118
- var _this = _super.call(this) || this;
2119
- _this.firestore = firestore;
2120
- _this.parentRepository = parentRepository;
2121
- _this.collectionName = 'payment_method';
2122
- _this.parentIdField = 'userId';
2123
- _this.model = UserPaymentMethod;
2124
- return _this;
2125
- }
2126
- return UserPaymentMethodFirestoreRepository;
2118
+ var UserPaymentMethodFirestoreRepository = /** @class */ (function (_super) {
2119
+ __extends(UserPaymentMethodFirestoreRepository, _super);
2120
+ function UserPaymentMethodFirestoreRepository(firestore, parentRepository) {
2121
+ var _this = _super.call(this) || this;
2122
+ _this.firestore = firestore;
2123
+ _this.parentRepository = parentRepository;
2124
+ _this.collectionName = 'payment_method';
2125
+ _this.parentIdField = 'userId';
2126
+ _this.model = UserPaymentMethod;
2127
+ return _this;
2128
+ }
2129
+ return UserPaymentMethodFirestoreRepository;
2127
2130
  }(withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User)));
2128
2131
 
2129
- var SubscriptionPaymentFirestoreRepository = /** @class */ (function (_super) {
2130
- __extends(SubscriptionPaymentFirestoreRepository, _super);
2131
- function SubscriptionPaymentFirestoreRepository(firestore, parentRepository) {
2132
- var _this = _super.call(this) || this;
2133
- _this.firestore = firestore;
2134
- _this.parentRepository = parentRepository;
2135
- _this.collectionName = 'payments';
2136
- _this.parentIdField = 'subscriptionId';
2137
- _this.model = SubscriptionPayment;
2138
- return _this;
2139
- }
2140
- return SubscriptionPaymentFirestoreRepository;
2132
+ var SubscriptionPaymentFirestoreRepository = /** @class */ (function (_super) {
2133
+ __extends(SubscriptionPaymentFirestoreRepository, _super);
2134
+ function SubscriptionPaymentFirestoreRepository(firestore, parentRepository) {
2135
+ var _this = _super.call(this) || this;
2136
+ _this.firestore = firestore;
2137
+ _this.parentRepository = parentRepository;
2138
+ _this.collectionName = 'payments';
2139
+ _this.parentIdField = 'subscriptionId';
2140
+ _this.model = SubscriptionPayment;
2141
+ return _this;
2142
+ }
2143
+ return SubscriptionPaymentFirestoreRepository;
2141
2144
  }(withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Subscription)));
2142
2145
 
2143
- var LeadFirestoreRepository = /** @class */ (function (_super) {
2144
- __extends(LeadFirestoreRepository, _super);
2145
- function LeadFirestoreRepository(firestore) {
2146
- var _this = _super.call(this) || this;
2147
- _this.firestore = firestore;
2148
- _this.collectionName = 'leads';
2149
- _this.model = Lead;
2150
- return _this;
2151
- }
2152
- return LeadFirestoreRepository;
2146
+ var LeadFirestoreRepository = /** @class */ (function (_super) {
2147
+ __extends(LeadFirestoreRepository, _super);
2148
+ function LeadFirestoreRepository(firestore) {
2149
+ var _this = _super.call(this) || this;
2150
+ _this.firestore = firestore;
2151
+ _this.collectionName = 'leads';
2152
+ _this.model = Lead;
2153
+ return _this;
2154
+ }
2155
+ return LeadFirestoreRepository;
2153
2156
  }(withCrudFirestore(withHelpers(withFirestore(Base)))));
2154
2157
 
2155
- var CategoryFirestoreRepository = /** @class */ (function (_super) {
2156
- __extends(CategoryFirestoreRepository, _super);
2157
- function CategoryFirestoreRepository(firestore, productsIndex) {
2158
- var _this = _super.call(this) || this;
2159
- _this.firestore = firestore;
2160
- _this.productsIndex = productsIndex;
2161
- _this.collectionName = 'categories';
2162
- _this.model = Category;
2163
- return _this;
2164
- }
2165
- CategoryFirestoreRepository.prototype.getCategoryBySlug = function (slug, shop) {
2166
- return __awaiter(this, void 0, void 0, function () {
2167
- var categoryDocs;
2168
- return __generator(this, function (_a) {
2169
- switch (_a.label) {
2170
- case 0: return [4 /*yield*/, firestore.getDocs(firestore.query(this.collection(this.collectionName), firestore.where('slug', '==', slug), firestore.where('shop', '==', shop), firestore.where('published', '==', true)))];
2171
- case 1:
2172
- categoryDocs = _a.sent();
2173
- if (categoryDocs.size > 1)
2174
- throw new DuplicatedResultsError('Query returned duplicated values');
2175
- if (categoryDocs.empty)
2176
- throw new NotFoundError("Document with slug " + slug + " not found");
2177
- return [2 /*return*/, categoryDocs.docs[0].data()];
2178
- }
2179
- });
2180
- });
2181
- };
2182
- CategoryFirestoreRepository.prototype.getCategoriesForHome = function (categoryIds, limit) {
2183
- if (limit === void 0) { limit = 4; }
2184
- return __awaiter(this, void 0, void 0, function () {
2185
- var categorySnap, categories, homeSections;
2186
- var _this = this;
2187
- return __generator(this, function (_a) {
2188
- switch (_a.label) {
2189
- case 0: return [4 /*yield*/, firestore.getDocs(firestore.query(this.collection(this.collectionName), firestore.where('id', 'in', categoryIds.filter(Boolean)), firestore.where('published', '==', true)))];
2190
- case 1:
2191
- categorySnap = _a.sent();
2192
- if (categorySnap.empty)
2193
- throw new NotFoundError('Categories not found');
2194
- categories = categorySnap.docs.map(function (doc) { return doc.data(); });
2195
- return [4 /*yield*/, Promise.all(categories.map(function (category) { return __awaiter(_this, void 0, void 0, function () {
2196
- var _a;
2197
- return __generator(this, function (_b) {
2198
- switch (_b.label) {
2199
- case 0:
2200
- _a = {
2201
- category: category
2202
- };
2203
- return [4 /*yield*/, this.mountCategory(category, { limit: limit, hasStock: true })];
2204
- case 1: return [2 /*return*/, (_a.products = _b.sent(),
2205
- _a)];
2206
- }
2207
- });
2208
- }); }))];
2209
- case 2:
2210
- homeSections = _a.sent();
2211
- return [2 /*return*/, homeSections];
2212
- }
2213
- });
2214
- });
2215
- };
2216
- CategoryFirestoreRepository.prototype.mountCategory = function (category, options) {
2217
- return __awaiter(this, void 0, void 0, function () {
2218
- return __generator(this, function (_a) {
2219
- if (!category.products)
2220
- throw new RequiredArgumentError(['Category products is empty']);
2221
- return [2 /*return*/, this.productsIndex.findById(category.products, {
2222
- hasStock: options === null || options === void 0 ? void 0 : options.hasStock,
2223
- size: options === null || options === void 0 ? void 0 : options.limit,
2224
- shop: category.shop,
2225
- })];
2226
- });
2227
- });
2228
- };
2229
- return CategoryFirestoreRepository;
2158
+ var CategoryFirestoreRepository = /** @class */ (function (_super) {
2159
+ __extends(CategoryFirestoreRepository, _super);
2160
+ function CategoryFirestoreRepository(firestore) {
2161
+ var _this = _super.call(this) || this;
2162
+ _this.firestore = firestore;
2163
+ _this.collectionName = 'categories';
2164
+ _this.model = Category;
2165
+ return _this;
2166
+ }
2167
+ CategoryFirestoreRepository.prototype.getCategoryBySlug = function (slug, shop) {
2168
+ return this.collection(this.collectionName)
2169
+ .where('slug', '==', slug)
2170
+ .where('shop', '==', shop)
2171
+ .where('published', '==', true)
2172
+ .get()
2173
+ .then(function (snap) {
2174
+ if (snap.size > 1)
2175
+ throw new DuplicatedResultsError('Query returned duplicated values');
2176
+ if (snap.empty)
2177
+ throw new NotFoundError("Document with slug " + slug + " not found");
2178
+ return snap.docs[0].data();
2179
+ })
2180
+ .catch(function (error) { return error; });
2181
+ };
2182
+ CategoryFirestoreRepository.prototype.getCategoriesForHome = function (categoryIds, limit) {
2183
+ if (limit === void 0) { limit = 4; }
2184
+ return __awaiter(this, void 0, void 0, function () {
2185
+ var categorySnap, categories, homeSections;
2186
+ var _this = this;
2187
+ return __generator(this, function (_a) {
2188
+ switch (_a.label) {
2189
+ case 0: return [4 /*yield*/, this.collection(this.collectionName)
2190
+ .where('id', 'in', categoryIds.filter(Boolean))
2191
+ .where('published', '==', true)
2192
+ .get()];
2193
+ case 1:
2194
+ categorySnap = _a.sent();
2195
+ if (categorySnap.empty)
2196
+ throw new NotFoundError('Categories not found');
2197
+ categories = categorySnap.docs.map(function (doc) { return doc.data(); });
2198
+ return [4 /*yield*/, Promise.all(categories.map(function (category) { return __awaiter(_this, void 0, void 0, function () {
2199
+ var _a;
2200
+ return __generator(this, function (_b) {
2201
+ switch (_b.label) {
2202
+ case 0:
2203
+ _a = {
2204
+ category: category
2205
+ };
2206
+ return [4 /*yield*/, this.mountCategory(category, { limit: limit, hasStock: true })];
2207
+ case 1: return [2 /*return*/, (_a.products = _b.sent(),
2208
+ _a)];
2209
+ }
2210
+ });
2211
+ }); }))];
2212
+ case 2:
2213
+ homeSections = _a.sent();
2214
+ return [2 /*return*/, homeSections];
2215
+ }
2216
+ });
2217
+ });
2218
+ };
2219
+ CategoryFirestoreRepository.prototype.mountCategory = function (category, options) {
2220
+ return __awaiter(this, void 0, void 0, function () {
2221
+ var chunks, products, publishedField, chunks_1, chunks_1_1, productIds, query, productSnap, e_1_1;
2222
+ var e_1, _a;
2223
+ return __generator(this, function (_b) {
2224
+ switch (_b.label) {
2225
+ case 0:
2226
+ if (!category.products)
2227
+ throw new RequiredArgumentError(['Category products is empty']);
2228
+ chunks = lodash.chunk(category.products, 10);
2229
+ products = [];
2230
+ publishedField = category.shop === exports.Shops.GLAMSHOP ? 'publishedGlam' : 'published';
2231
+ _b.label = 1;
2232
+ case 1:
2233
+ _b.trys.push([1, 7, 8, 9]);
2234
+ chunks_1 = __values(chunks), chunks_1_1 = chunks_1.next();
2235
+ _b.label = 2;
2236
+ case 2:
2237
+ if (!!chunks_1_1.done) return [3 /*break*/, 6];
2238
+ productIds = chunks_1_1.value;
2239
+ if ((options === null || options === void 0 ? void 0 : options.limit) && products.length >= (options === null || options === void 0 ? void 0 : options.limit))
2240
+ return [3 /*break*/, 6];
2241
+ return [4 /*yield*/, this.collection('products').where(publishedField, '==', true).where('id', 'in', productIds)];
2242
+ case 3:
2243
+ query = _b.sent();
2244
+ if (options === null || options === void 0 ? void 0 : options.hasStock)
2245
+ query = query.where('stock.quantity', '>', 0);
2246
+ if (options === null || options === void 0 ? void 0 : options.limit)
2247
+ query = query.limit(options === null || options === void 0 ? void 0 : options.limit);
2248
+ return [4 /*yield*/, query.get()];
2249
+ case 4:
2250
+ productSnap = _b.sent();
2251
+ if (productSnap.empty)
2252
+ return [3 /*break*/, 5];
2253
+ products.push.apply(products, __spreadArray([], __read(productSnap.docs.map(function (doc) { return doc.data(); }))));
2254
+ _b.label = 5;
2255
+ case 5:
2256
+ chunks_1_1 = chunks_1.next();
2257
+ return [3 /*break*/, 2];
2258
+ case 6: return [3 /*break*/, 9];
2259
+ case 7:
2260
+ e_1_1 = _b.sent();
2261
+ e_1 = { error: e_1_1 };
2262
+ return [3 /*break*/, 9];
2263
+ case 8:
2264
+ try {
2265
+ if (chunks_1_1 && !chunks_1_1.done && (_a = chunks_1.return)) _a.call(chunks_1);
2266
+ }
2267
+ finally { if (e_1) throw e_1.error; }
2268
+ return [7 /*endfinally*/];
2269
+ case 9: return [2 /*return*/, products];
2270
+ }
2271
+ });
2272
+ });
2273
+ };
2274
+ return CategoryFirestoreRepository;
2230
2275
  }(withCrudFirestore(withHelpers(withFirestore(Base)))));
2231
2276
 
2232
- var ProductFirestoreRepository = /** @class */ (function (_super) {
2233
- __extends(ProductFirestoreRepository, _super);
2234
- function ProductFirestoreRepository(firestore) {
2235
- var _this = _super.call(this) || this;
2236
- _this.firestore = firestore;
2237
- _this.collectionName = 'products';
2238
- _this.model = Product;
2239
- return _this;
2240
- }
2241
- ProductFirestoreRepository.prototype.getBySlug = function (slug, shop) {
2242
- var _a;
2243
- return __awaiter(this, void 0, void 0, function () {
2244
- var result;
2245
- return __generator(this, function (_b) {
2246
- switch (_b.label) {
2247
- case 0: return [4 /*yield*/, this.find([
2248
- { slug: { operator: exports.Where.EQUALS, value: slug } },
2249
- { shopAvailability: { operator: exports.Where.IN, value: [shop] } },
2250
- ])];
2251
- case 1:
2252
- result = _b.sent();
2253
- return [2 /*return*/, (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.shift()];
2254
- }
2255
- });
2256
- });
2257
- };
2258
- return ProductFirestoreRepository;
2277
+ var ProductFirestoreRepository = /** @class */ (function (_super) {
2278
+ __extends(ProductFirestoreRepository, _super);
2279
+ function ProductFirestoreRepository(firestore) {
2280
+ var _this = _super.call(this) || this;
2281
+ _this.firestore = firestore;
2282
+ _this.collectionName = 'products';
2283
+ _this.model = Product;
2284
+ return _this;
2285
+ }
2286
+ ProductFirestoreRepository.prototype.getBySlug = function (slug, shop) {
2287
+ var _a;
2288
+ return __awaiter(this, void 0, void 0, function () {
2289
+ var result;
2290
+ return __generator(this, function (_b) {
2291
+ switch (_b.label) {
2292
+ case 0: return [4 /*yield*/, this.find([
2293
+ { slug: { operator: exports.Where.EQUALS, value: slug } },
2294
+ { shopAvailability: { operator: exports.Where.IN, value: [shop] } },
2295
+ ])];
2296
+ case 1:
2297
+ result = _b.sent();
2298
+ return [2 /*return*/, (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.shift()];
2299
+ }
2300
+ });
2301
+ });
2302
+ };
2303
+ return ProductFirestoreRepository;
2259
2304
  }(withCrudFirestore(withHelpers(withFirestore(Base)))));
2260
2305
 
2261
- var ProductVariantFirestoreRepository = /** @class */ (function (_super) {
2262
- __extends(ProductVariantFirestoreRepository, _super);
2263
- function ProductVariantFirestoreRepository(firestore, parentRepository) {
2264
- var _this = _super.call(this) || this;
2265
- _this.firestore = firestore;
2266
- _this.parentRepository = parentRepository;
2267
- _this.collectionName = 'variants';
2268
- _this.parentIdField = 'productId';
2269
- _this.model = Variant;
2270
- return _this;
2271
- }
2272
- return ProductVariantFirestoreRepository;
2306
+ var ProductVariantFirestoreRepository = /** @class */ (function (_super) {
2307
+ __extends(ProductVariantFirestoreRepository, _super);
2308
+ function ProductVariantFirestoreRepository(firestore, parentRepository) {
2309
+ var _this = _super.call(this) || this;
2310
+ _this.firestore = firestore;
2311
+ _this.parentRepository = parentRepository;
2312
+ _this.collectionName = 'variants';
2313
+ _this.parentIdField = 'productId';
2314
+ _this.model = Variant;
2315
+ return _this;
2316
+ }
2317
+ return ProductVariantFirestoreRepository;
2273
2318
  }(withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Product)));
2274
2319
 
2275
- var SubscriptionProductFirestoreRepository = /** @class */ (function (_super) {
2276
- __extends(SubscriptionProductFirestoreRepository, _super);
2277
- function SubscriptionProductFirestoreRepository(firestore) {
2278
- var _this = _super.call(this) || this;
2279
- _this.firestore = firestore;
2280
- _this.collectionName = 'subscriptionProducts';
2281
- _this.model = Product;
2282
- return _this;
2283
- }
2284
- return SubscriptionProductFirestoreRepository;
2320
+ var SubscriptionProductFirestoreRepository = /** @class */ (function (_super) {
2321
+ __extends(SubscriptionProductFirestoreRepository, _super);
2322
+ function SubscriptionProductFirestoreRepository(firestore) {
2323
+ var _this = _super.call(this) || this;
2324
+ _this.firestore = firestore;
2325
+ _this.collectionName = 'subscriptionProducts';
2326
+ _this.model = Product;
2327
+ return _this;
2328
+ }
2329
+ return SubscriptionProductFirestoreRepository;
2285
2330
  }(withCrudFirestore(withHelpers(withFirestore(Base)))));
2286
2331
 
2287
- var CheckoutFirestoreRepository = /** @class */ (function (_super) {
2288
- __extends(CheckoutFirestoreRepository, _super);
2289
- function CheckoutFirestoreRepository(firestore) {
2290
- var _this = _super.call(this) || this;
2291
- _this.firestore = firestore;
2292
- _this.collectionName = 'checkouts';
2293
- _this.model = Checkout;
2294
- return _this;
2295
- }
2296
- return CheckoutFirestoreRepository;
2332
+ var CheckoutFirestoreRepository = /** @class */ (function (_super) {
2333
+ __extends(CheckoutFirestoreRepository, _super);
2334
+ function CheckoutFirestoreRepository(firestore) {
2335
+ var _this = _super.call(this) || this;
2336
+ _this.firestore = firestore;
2337
+ _this.collectionName = 'checkouts';
2338
+ _this.model = Checkout;
2339
+ return _this;
2340
+ }
2341
+ return CheckoutFirestoreRepository;
2297
2342
  }(withCrudFirestore(withHelpers(withFirestore(Base)))));
2298
2343
 
2299
- var CouponFirestoreRepository = /** @class */ (function (_super) {
2300
- __extends(CouponFirestoreRepository, _super);
2301
- function CouponFirestoreRepository(firestore) {
2302
- var _this = _super.call(this) || this;
2303
- _this.firestore = firestore;
2304
- _this.collectionName = 'coupons';
2305
- _this.model = Coupon;
2306
- return _this;
2307
- }
2308
- CouponFirestoreRepository.prototype.buildModelInstance = function () {
2309
- var _a = _super.prototype.buildModelInstance.call(this), fromFirestore = _a.fromFirestore, toFirestore = _a.toFirestore;
2310
- return {
2311
- toFirestore: function (data) {
2312
- var plain = toFirestore(data);
2313
- if (!!data.expiresIn)
2314
- plain.expiresIn = data.expiresIn.getTime();
2315
- return plain;
2316
- },
2317
- fromFirestore: function (snap) {
2318
- var instance = fromFirestore(snap);
2319
- if (!isNil(instance.expiresIn))
2320
- instance.expiresIn = new Date(snap.data().expiresIn);
2321
- return instance;
2322
- },
2323
- };
2324
- };
2325
- return CouponFirestoreRepository;
2344
+ var CouponFirestoreRepository = /** @class */ (function (_super) {
2345
+ __extends(CouponFirestoreRepository, _super);
2346
+ function CouponFirestoreRepository(firestore) {
2347
+ var _this = _super.call(this) || this;
2348
+ _this.firestore = firestore;
2349
+ _this.collectionName = 'coupons';
2350
+ _this.model = Coupon;
2351
+ return _this;
2352
+ }
2353
+ CouponFirestoreRepository.prototype.buildModelInstance = function () {
2354
+ var _a = _super.prototype.buildModelInstance.call(this), fromFirestore = _a.fromFirestore, toFirestore = _a.toFirestore;
2355
+ return {
2356
+ toFirestore: function (data) {
2357
+ var plain = toFirestore(data);
2358
+ if (!!data.expiresIn)
2359
+ plain.expiresIn = data.expiresIn.getTime();
2360
+ return plain;
2361
+ },
2362
+ fromFirestore: function (snap) {
2363
+ var instance = fromFirestore(snap);
2364
+ if (!lodash.isNil(instance.expiresIn))
2365
+ instance.expiresIn = new Date(snap.data().expiresIn);
2366
+ return instance;
2367
+ },
2368
+ };
2369
+ };
2370
+ return CouponFirestoreRepository;
2326
2371
  }(withCrudFirestore(withHelpers(withFirestore(Base)))));
2327
2372
 
2328
- var OrderFirestoreRepository = /** @class */ (function (_super) {
2329
- __extends(OrderFirestoreRepository, _super);
2330
- function OrderFirestoreRepository(firestore) {
2331
- var _this = _super.call(this) || this;
2332
- _this.firestore = firestore;
2333
- _this.collectionName = 'orders';
2334
- _this.model = Order;
2335
- return _this;
2336
- }
2337
- return OrderFirestoreRepository;
2373
+ var OrderFirestoreRepository = /** @class */ (function (_super) {
2374
+ __extends(OrderFirestoreRepository, _super);
2375
+ function OrderFirestoreRepository(firestore) {
2376
+ var _this = _super.call(this) || this;
2377
+ _this.firestore = firestore;
2378
+ _this.collectionName = 'orders';
2379
+ _this.model = Order;
2380
+ return _this;
2381
+ }
2382
+ return OrderFirestoreRepository;
2338
2383
  }(withCrudFirestore(withHelpers(withFirestore(Base)))));
2339
2384
 
2340
- var PaymentFirestoreRepository = /** @class */ (function (_super) {
2341
- __extends(PaymentFirestoreRepository, _super);
2342
- function PaymentFirestoreRepository(firestore) {
2343
- var _this = _super.call(this) || this;
2344
- _this.firestore = firestore;
2345
- _this.collectionName = 'payments';
2346
- _this.model = Payment;
2347
- return _this;
2348
- }
2349
- return PaymentFirestoreRepository;
2385
+ var PaymentFirestoreRepository = /** @class */ (function (_super) {
2386
+ __extends(PaymentFirestoreRepository, _super);
2387
+ function PaymentFirestoreRepository(firestore) {
2388
+ var _this = _super.call(this) || this;
2389
+ _this.firestore = firestore;
2390
+ _this.collectionName = 'payments';
2391
+ _this.model = Payment;
2392
+ return _this;
2393
+ }
2394
+ return PaymentFirestoreRepository;
2350
2395
  }(withCrudFirestore(withHelpers(withFirestore(Base)))));
2351
2396
 
2352
- var CheckoutSubscriptionFirestoreRepository = /** @class */ (function (_super) {
2353
- __extends(CheckoutSubscriptionFirestoreRepository, _super);
2354
- function CheckoutSubscriptionFirestoreRepository(firestore) {
2355
- var _this = _super.call(this) || this;
2356
- _this.firestore = firestore;
2357
- _this.collectionName = 'checkoutsSubscription';
2358
- _this.model = CheckoutSubscription;
2359
- return _this;
2360
- }
2361
- return CheckoutSubscriptionFirestoreRepository;
2397
+ var CheckoutSubscriptionFirestoreRepository = /** @class */ (function (_super) {
2398
+ __extends(CheckoutSubscriptionFirestoreRepository, _super);
2399
+ function CheckoutSubscriptionFirestoreRepository(firestore) {
2400
+ var _this = _super.call(this) || this;
2401
+ _this.firestore = firestore;
2402
+ _this.collectionName = 'checkoutsSubscription';
2403
+ _this.model = CheckoutSubscription;
2404
+ return _this;
2405
+ }
2406
+ return CheckoutSubscriptionFirestoreRepository;
2362
2407
  }(withCrudFirestore(withHelpers(withFirestore(Base)))));
2363
2408
 
2364
- var SubscriptionPlanFirestoreRepository = /** @class */ (function (_super) {
2365
- __extends(SubscriptionPlanFirestoreRepository, _super);
2366
- function SubscriptionPlanFirestoreRepository(firestore) {
2367
- var _this = _super.call(this) || this;
2368
- _this.firestore = firestore;
2369
- _this.collectionName = 'subscriptionPlans';
2370
- _this.model = SubscriptionPlan;
2371
- return _this;
2372
- }
2373
- return SubscriptionPlanFirestoreRepository;
2409
+ var SubscriptionPlanFirestoreRepository = /** @class */ (function (_super) {
2410
+ __extends(SubscriptionPlanFirestoreRepository, _super);
2411
+ function SubscriptionPlanFirestoreRepository(firestore) {
2412
+ var _this = _super.call(this) || this;
2413
+ _this.firestore = firestore;
2414
+ _this.collectionName = 'subscriptionPlans';
2415
+ _this.model = SubscriptionPlan;
2416
+ return _this;
2417
+ }
2418
+ return SubscriptionPlanFirestoreRepository;
2374
2419
  }(withCrudFirestore(withHelpers(withFirestore(Base)))));
2375
2420
 
2376
- var Buy2WinFirestoreRepository = /** @class */ (function (_super) {
2377
- __extends(Buy2WinFirestoreRepository, _super);
2378
- function Buy2WinFirestoreRepository(firestore) {
2379
- var _this = _super.call(this) || this;
2380
- _this.firestore = firestore;
2381
- _this.collectionName = 'buy2win';
2382
- _this.model = Buy2Win;
2383
- return _this;
2384
- }
2385
- return Buy2WinFirestoreRepository;
2421
+ var Buy2WinFirestoreRepository = /** @class */ (function (_super) {
2422
+ __extends(Buy2WinFirestoreRepository, _super);
2423
+ function Buy2WinFirestoreRepository(firestore) {
2424
+ var _this = _super.call(this) || this;
2425
+ _this.firestore = firestore;
2426
+ _this.collectionName = 'buy2win';
2427
+ _this.model = Buy2Win;
2428
+ return _this;
2429
+ }
2430
+ return Buy2WinFirestoreRepository;
2386
2431
  }(withCrudFirestore(withHelpers(withFirestore(Base)))));
2387
2432
 
2388
- var LegacyOrderFirestoreRepository = /** @class */ (function (_super) {
2389
- __extends(LegacyOrderFirestoreRepository, _super);
2390
- function LegacyOrderFirestoreRepository(firestore) {
2391
- var _this = _super.call(this, firestore) || this;
2392
- _this.firestore = firestore;
2393
- _this.collectionName = 'legacyOrders';
2394
- return _this;
2395
- }
2396
- return LegacyOrderFirestoreRepository;
2433
+ var LegacyOrderFirestoreRepository = /** @class */ (function (_super) {
2434
+ __extends(LegacyOrderFirestoreRepository, _super);
2435
+ function LegacyOrderFirestoreRepository(firestore) {
2436
+ var _this = _super.call(this, firestore) || this;
2437
+ _this.firestore = firestore;
2438
+ _this.collectionName = 'legacyOrders';
2439
+ return _this;
2440
+ }
2441
+ return LegacyOrderFirestoreRepository;
2397
2442
  }(OrderFirestoreRepository));
2398
2443
 
2399
- var HomeFirestoreRepository = /** @class */ (function (_super) {
2400
- __extends(HomeFirestoreRepository, _super);
2401
- function HomeFirestoreRepository(firestore$1) {
2402
- var _this = _super.call(this) || this;
2403
- _this.firestore = firestore$1;
2404
- _this.homeToFirestore = function (home) {
2405
- var _a;
2406
- if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
2407
- home.data.data.discoverProducts = home.data.data.discoverProducts.map(_this.homeCategoryGroupToPlain);
2408
- home.data.data.featuredProducts = home.data.data.featuredProducts.map(_this.homeCategoryGroupToPlain);
2409
- home.data.data.verticalProducts = home.data.data.verticalProducts.map(_this.homeCategoryGroupToPlain);
2410
- }
2411
- return home;
2412
- };
2413
- _this.homeCategoryGroupToPlain = function (homeCategoryGroup) { return ({
2414
- category: homeCategoryGroup.category.toPlain(),
2415
- products: homeCategoryGroup.products.map(function (product) { return product.toPlain(); }),
2416
- }); };
2417
- _this.homeFromFirestore = function (home) {
2418
- var _a;
2419
- if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
2420
- home.data.data.discoverProducts = home.data.data.discoverProducts.map(_this.plainToHomeCategoryGroup);
2421
- home.data.data.featuredProducts = home.data.data.featuredProducts.map(_this.plainToHomeCategoryGroup);
2422
- home.data.data.verticalProducts = home.data.data.verticalProducts.map(_this.plainToHomeCategoryGroup);
2423
- home.data.createdAt =
2424
- home.data.createdAt instanceof firestore.Timestamp ? home.data.createdAt.toDate() : home.data.createdAt;
2425
- home.data.expiresAt =
2426
- home.data.expiresAt instanceof firestore.Timestamp ? home.data.expiresAt.toDate() : home.data.expiresAt;
2427
- }
2428
- return home;
2429
- };
2430
- _this.plainToHomeCategoryGroup = function (homeCategoryGroup) { return ({
2431
- category: Category.toInstance(homeCategoryGroup.category),
2432
- products: homeCategoryGroup.products.map(function (product) { return Product.toInstance(product); }),
2433
- }); };
2434
- _this.collectionName = 'dms';
2435
- _this.model = Home;
2436
- return _this;
2437
- }
2438
- HomeFirestoreRepository.prototype.buildModelInstance = function () {
2439
- var _this = this;
2440
- var _b = _super.prototype.buildModelInstance.call(this), fromFirestore = _b.fromFirestore, toFirestore = _b.toFirestore;
2441
- return {
2442
- toFirestore: function (data) {
2443
- var modifiedData = _this.homeToFirestore(data);
2444
- return toFirestore(modifiedData);
2445
- },
2446
- fromFirestore: function (snap) {
2447
- var instance = fromFirestore(snap);
2448
- return _this.homeFromFirestore(instance);
2449
- },
2450
- };
2451
- };
2452
- return HomeFirestoreRepository;
2444
+ var HomeFirestoreRepository = /** @class */ (function (_super) {
2445
+ __extends(HomeFirestoreRepository, _super);
2446
+ function HomeFirestoreRepository(firestore) {
2447
+ var _this = _super.call(this) || this;
2448
+ _this.firestore = firestore;
2449
+ _this.homeToFirestore = function (home) {
2450
+ var _a;
2451
+ if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
2452
+ home.data.data.discoverProducts = home.data.data.discoverProducts.map(_this.homeCategoryGroupToPlain);
2453
+ home.data.data.featuredProducts = home.data.data.featuredProducts.map(_this.homeCategoryGroupToPlain);
2454
+ home.data.data.verticalProducts = home.data.data.verticalProducts.map(_this.homeCategoryGroupToPlain);
2455
+ }
2456
+ return home;
2457
+ };
2458
+ _this.homeCategoryGroupToPlain = function (homeCategoryGroup) { return ({
2459
+ category: homeCategoryGroup.category.toPlain(),
2460
+ products: homeCategoryGroup.products.map(function (product) { return product.toPlain(); }),
2461
+ }); };
2462
+ _this.homeFromFirestore = function (home) {
2463
+ var _a;
2464
+ if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
2465
+ home.data.data.discoverProducts = home.data.data.discoverProducts.map(_this.plainToHomeCategoryGroup);
2466
+ home.data.data.featuredProducts = home.data.data.featuredProducts.map(_this.plainToHomeCategoryGroup);
2467
+ home.data.data.verticalProducts = home.data.data.verticalProducts.map(_this.plainToHomeCategoryGroup);
2468
+ home.data.createdAt =
2469
+ home.data.createdAt instanceof firebase__default["default"].firestore.Timestamp ? home.data.createdAt.toDate() : home.data.createdAt;
2470
+ home.data.expiresAt =
2471
+ home.data.expiresAt instanceof firebase__default["default"].firestore.Timestamp ? home.data.expiresAt.toDate() : home.data.expiresAt;
2472
+ }
2473
+ return home;
2474
+ };
2475
+ _this.plainToHomeCategoryGroup = function (homeCategoryGroup) { return ({
2476
+ category: Category.toInstance(homeCategoryGroup.category),
2477
+ products: homeCategoryGroup.products.map(function (product) { return Product.toInstance(product); }),
2478
+ }); };
2479
+ _this.collectionName = 'dms';
2480
+ _this.model = Home;
2481
+ return _this;
2482
+ }
2483
+ HomeFirestoreRepository.prototype.buildModelInstance = function () {
2484
+ var _this = this;
2485
+ var _b = _super.prototype.buildModelInstance.call(this), fromFirestore = _b.fromFirestore, toFirestore = _b.toFirestore;
2486
+ return {
2487
+ toFirestore: function (data) {
2488
+ var modifiedData = _this.homeToFirestore(data);
2489
+ return toFirestore(modifiedData);
2490
+ },
2491
+ fromFirestore: function (snap) {
2492
+ var instance = fromFirestore(snap);
2493
+ return _this.homeFromFirestore(instance);
2494
+ },
2495
+ };
2496
+ };
2497
+ return HomeFirestoreRepository;
2453
2498
  }(withCrudFirestore(withHelpers(withFirestore(Base)))));
2454
2499
 
2455
- var ShopMenuFirestoreRepository = /** @class */ (function (_super) {
2456
- __extends(ShopMenuFirestoreRepository, _super);
2457
- function ShopMenuFirestoreRepository(firestore) {
2458
- var _this = _super.call(this) || this;
2459
- _this.firestore = firestore;
2460
- _this.collectionName = 'shopMenus';
2461
- _this.model = ShopMenu;
2462
- return _this;
2463
- }
2464
- return ShopMenuFirestoreRepository;
2500
+ var ShopMenuFirestoreRepository = /** @class */ (function (_super) {
2501
+ __extends(ShopMenuFirestoreRepository, _super);
2502
+ function ShopMenuFirestoreRepository(firestore) {
2503
+ var _this = _super.call(this) || this;
2504
+ _this.firestore = firestore;
2505
+ _this.collectionName = 'shopMenus';
2506
+ _this.model = ShopMenu;
2507
+ return _this;
2508
+ }
2509
+ return ShopMenuFirestoreRepository;
2465
2510
  }(withCrudFirestore(withHelpers(withFirestore(Base)))));
2466
2511
 
2467
- var AuthenticationFirebaseAuthService = /** @class */ (function () {
2468
- function AuthenticationFirebaseAuthService(firebaseAuth) {
2469
- this.firebaseAuth = firebaseAuth;
2470
- }
2471
- AuthenticationFirebaseAuthService.prototype.signInWithEmailAndPassword = function (data) {
2472
- return __awaiter(this, void 0, void 0, function () {
2473
- var credentials, user;
2474
- return __generator(this, function (_a) {
2475
- switch (_a.label) {
2476
- case 0: return [4 /*yield*/, auth.signInWithEmailAndPassword(this.firebaseAuth, data.email, data.password)];
2477
- case 1:
2478
- credentials = _a.sent();
2479
- user = credentials.user;
2480
- return [2 /*return*/, {
2481
- id: user.uid,
2482
- displayName: user.displayName,
2483
- email: user.email,
2484
- phone: user.phoneNumber,
2485
- isAnonymous: false,
2486
- }];
2487
- }
2488
- });
2489
- });
2490
- };
2491
- AuthenticationFirebaseAuthService.prototype.signInWithGoogle = function () {
2492
- return __awaiter(this, void 0, void 0, function () {
2493
- var credentials, user;
2494
- return __generator(this, function (_a) {
2495
- switch (_a.label) {
2496
- case 0: return [4 /*yield*/, auth.signInWithPopup(this.firebaseAuth, new auth.GoogleAuthProvider())];
2497
- case 1:
2498
- credentials = _a.sent();
2499
- user = credentials.user;
2500
- return [2 /*return*/, {
2501
- id: user.uid,
2502
- displayName: user.displayName,
2503
- email: user.email,
2504
- phone: user.phoneNumber,
2505
- isAnonymous: false,
2506
- }];
2507
- }
2508
- });
2509
- });
2510
- };
2511
- AuthenticationFirebaseAuthService.prototype.signOut = function () {
2512
- return __awaiter(this, void 0, void 0, function () {
2513
- return __generator(this, function (_a) {
2514
- this.firebaseAuth.signOut();
2515
- return [2 /*return*/];
2516
- });
2517
- });
2518
- };
2519
- AuthenticationFirebaseAuthService.prototype.signInAnonymously = function () {
2520
- return __awaiter(this, void 0, void 0, function () {
2521
- var auth$1, user;
2522
- return __generator(this, function (_a) {
2523
- switch (_a.label) {
2524
- case 0: return [4 /*yield*/, auth.signInAnonymously(this.firebaseAuth)];
2525
- case 1:
2526
- auth$1 = _a.sent();
2527
- user = auth$1.user;
2528
- user.id = auth$1.user.uid;
2529
- return [2 /*return*/, user];
2530
- }
2531
- });
2532
- });
2533
- };
2534
- AuthenticationFirebaseAuthService.prototype.sendPasswordResetEmail = function (email) {
2535
- return __awaiter(this, void 0, void 0, function () {
2536
- return __generator(this, function (_a) {
2537
- return [2 /*return*/, auth.sendPasswordResetEmail(this.firebaseAuth, email)];
2538
- });
2539
- });
2540
- };
2541
- return AuthenticationFirebaseAuthService;
2512
+ var AuthenticationFirebaseAuthService = /** @class */ (function () {
2513
+ function AuthenticationFirebaseAuthService(firebaseAuth) {
2514
+ this.firebaseAuth = firebaseAuth;
2515
+ }
2516
+ AuthenticationFirebaseAuthService.prototype.signInWithEmailAndPassword = function (data) {
2517
+ return __awaiter(this, void 0, void 0, function () {
2518
+ var credentials, user;
2519
+ return __generator(this, function (_a) {
2520
+ switch (_a.label) {
2521
+ case 0: return [4 /*yield*/, this.firebaseAuth.signInWithEmailAndPassword(data.email, data.password)];
2522
+ case 1:
2523
+ credentials = _a.sent();
2524
+ user = credentials.user;
2525
+ return [2 /*return*/, {
2526
+ id: user.uid,
2527
+ displayName: user.displayName,
2528
+ email: user.email,
2529
+ phone: user.phoneNumber,
2530
+ isAnonymous: false,
2531
+ }];
2532
+ }
2533
+ });
2534
+ });
2535
+ };
2536
+ AuthenticationFirebaseAuthService.prototype.signInWithGoogle = function () {
2537
+ return __awaiter(this, void 0, void 0, function () {
2538
+ var credentials, user;
2539
+ return __generator(this, function (_a) {
2540
+ switch (_a.label) {
2541
+ case 0: return [4 /*yield*/, this.firebaseAuth.signInWithPopup(new firebase__default$1["default"].auth.GoogleAuthProvider())];
2542
+ case 1:
2543
+ credentials = _a.sent();
2544
+ user = credentials.user;
2545
+ return [2 /*return*/, {
2546
+ id: user.uid,
2547
+ displayName: user.displayName,
2548
+ email: user.email,
2549
+ phone: user.phoneNumber,
2550
+ isAnonymous: false,
2551
+ }];
2552
+ }
2553
+ });
2554
+ });
2555
+ };
2556
+ AuthenticationFirebaseAuthService.prototype.signOut = function () {
2557
+ return __awaiter(this, void 0, void 0, function () {
2558
+ return __generator(this, function (_a) {
2559
+ this.firebaseAuth.signOut();
2560
+ return [2 /*return*/];
2561
+ });
2562
+ });
2563
+ };
2564
+ AuthenticationFirebaseAuthService.prototype.signInAnonymously = function () {
2565
+ return __awaiter(this, void 0, void 0, function () {
2566
+ var auth, user;
2567
+ return __generator(this, function (_a) {
2568
+ switch (_a.label) {
2569
+ case 0: return [4 /*yield*/, this.firebaseAuth.signInAnonymously()];
2570
+ case 1:
2571
+ auth = _a.sent();
2572
+ user = auth.user;
2573
+ user.id = auth.user.uid;
2574
+ return [2 /*return*/, user];
2575
+ }
2576
+ });
2577
+ });
2578
+ };
2579
+ AuthenticationFirebaseAuthService.prototype.sendPasswordResetEmail = function (email) {
2580
+ return __awaiter(this, void 0, void 0, function () {
2581
+ return __generator(this, function (_a) {
2582
+ return [2 /*return*/, this.firebaseAuth.sendPasswordResetEmail(email)];
2583
+ });
2584
+ });
2585
+ };
2586
+ return AuthenticationFirebaseAuthService;
2542
2587
  }());
2543
2588
 
2544
- var RegisterFirebaseAuthService = /** @class */ (function () {
2545
- function RegisterFirebaseAuthService(firebaseAuth) {
2546
- this.firebaseAuth = firebaseAuth;
2547
- }
2548
- RegisterFirebaseAuthService.prototype.register = function (params) {
2549
- return __awaiter(this, void 0, void 0, function () {
2550
- var auth$1, user, error_1;
2551
- return __generator(this, function (_a) {
2552
- switch (_a.label) {
2553
- case 0:
2554
- _a.trys.push([0, 3, , 4]);
2555
- return [4 /*yield*/, auth.createUserWithEmailAndPassword(this.firebaseAuth, params.email, params.password)];
2556
- case 1:
2557
- auth$1 = _a.sent();
2558
- user = auth$1.user;
2559
- return [4 /*yield*/, auth.sendEmailVerification(user)];
2560
- case 2:
2561
- _a.sent();
2562
- user.id = auth$1.user.uid;
2563
- return [2 /*return*/, user];
2564
- case 3:
2565
- error_1 = _a.sent();
2566
- if (error_1.code === 'auth/email-already-in-use')
2567
- throw new UserAlreadyRegisteredError('Email already registered');
2568
- if (error_1.code === 'auth/weak-password')
2569
- throw new WeakPasswordError();
2570
- throw error_1;
2571
- case 4: return [2 /*return*/];
2572
- }
2573
- });
2574
- });
2575
- };
2576
- return RegisterFirebaseAuthService;
2589
+ var RegisterFirebaseAuthService = /** @class */ (function () {
2590
+ function RegisterFirebaseAuthService(firebaseAuth) {
2591
+ this.firebaseAuth = firebaseAuth;
2592
+ }
2593
+ RegisterFirebaseAuthService.prototype.register = function (params) {
2594
+ return __awaiter(this, void 0, void 0, function () {
2595
+ var auth, user, error_1;
2596
+ return __generator(this, function (_a) {
2597
+ switch (_a.label) {
2598
+ case 0:
2599
+ _a.trys.push([0, 2, , 3]);
2600
+ return [4 /*yield*/, this.firebaseAuth.createUserWithEmailAndPassword(params.email, params.password)];
2601
+ case 1:
2602
+ auth = _a.sent();
2603
+ user = auth.user;
2604
+ user.sendEmailVerification();
2605
+ user.id = auth.user.uid;
2606
+ return [2 /*return*/, user];
2607
+ case 2:
2608
+ error_1 = _a.sent();
2609
+ if (error_1.code === 'auth/email-already-in-use')
2610
+ throw new UserAlreadyRegisteredError('Email already registered');
2611
+ if (error_1.code === 'auth/weak-password')
2612
+ throw new WeakPasswordError();
2613
+ throw error_1;
2614
+ case 3: return [2 /*return*/];
2615
+ }
2616
+ });
2617
+ });
2618
+ };
2619
+ return RegisterFirebaseAuthService;
2577
2620
  }());
2578
2621
 
2579
- /**
2580
- * Generated bundle index. Do not edit.
2622
+ /**
2623
+ * Generated bundle index. Do not edit.
2581
2624
  */
2582
2625
 
2583
2626
  Object.defineProperty(exports, 'add', {
@@ -2588,6 +2631,46 @@
2588
2631
  enumerable: true,
2589
2632
  get: function () { return dateFns.sub; }
2590
2633
  });
2634
+ Object.defineProperty(exports, 'chunk', {
2635
+ enumerable: true,
2636
+ get: function () { return lodash.chunk; }
2637
+ });
2638
+ Object.defineProperty(exports, 'get', {
2639
+ enumerable: true,
2640
+ get: function () { return lodash.get; }
2641
+ });
2642
+ Object.defineProperty(exports, 'isDate', {
2643
+ enumerable: true,
2644
+ get: function () { return lodash.isDate; }
2645
+ });
2646
+ Object.defineProperty(exports, 'isEmpty', {
2647
+ enumerable: true,
2648
+ get: function () { return lodash.isEmpty; }
2649
+ });
2650
+ Object.defineProperty(exports, 'isNil', {
2651
+ enumerable: true,
2652
+ get: function () { return lodash.isNil; }
2653
+ });
2654
+ Object.defineProperty(exports, 'isNumber', {
2655
+ enumerable: true,
2656
+ get: function () { return lodash.isNumber; }
2657
+ });
2658
+ Object.defineProperty(exports, 'isObject', {
2659
+ enumerable: true,
2660
+ get: function () { return lodash.isObject; }
2661
+ });
2662
+ Object.defineProperty(exports, 'isString', {
2663
+ enumerable: true,
2664
+ get: function () { return lodash.isString; }
2665
+ });
2666
+ Object.defineProperty(exports, 'pick', {
2667
+ enumerable: true,
2668
+ get: function () { return lodash.pick; }
2669
+ });
2670
+ Object.defineProperty(exports, 'set', {
2671
+ enumerable: true,
2672
+ get: function () { return lodash.set; }
2673
+ });
2591
2674
  exports.Address = Address;
2592
2675
  exports.Authentication = Authentication;
2593
2676
  exports.AuthenticationFirebaseAuthService = AuthenticationFirebaseAuthService;
@@ -2608,7 +2691,6 @@
2608
2691
  exports.CouponFirestoreRepository = CouponFirestoreRepository;
2609
2692
  exports.DuplicatedResultsError = DuplicatedResultsError;
2610
2693
  exports.Edition = Edition;
2611
- exports.FinancialCoupon = FinancialCoupon;
2612
2694
  exports.Home = Home;
2613
2695
  exports.HomeFirestoreRepository = HomeFirestoreRepository;
2614
2696
  exports.InvalidArgumentError = InvalidArgumentError;
@@ -2653,16 +2735,6 @@
2653
2735
  exports.UserSearchFirestoreRepository = UserSearchFirestoreRepository;
2654
2736
  exports.Variant = Variant;
2655
2737
  exports.WeakPasswordError = WeakPasswordError;
2656
- exports.chunk = chunk;
2657
- exports.get = get;
2658
- exports.isDate = isDate;
2659
- exports.isEmpty = isEmpty;
2660
- exports.isNil = isNil;
2661
- exports.isNumber = isNumber;
2662
- exports.isObject = isObject;
2663
- exports.isString = isString;
2664
- exports.pick = pick;
2665
- exports.set = set;
2666
2738
  exports.withCreateFirestore = withCreateFirestore;
2667
2739
  exports.withCrudFirestore = withCrudFirestore;
2668
2740
  exports.withDeleteFirestore = withDeleteFirestore;